From 4959bbf56f639e0c6a19eb9745f45223505135b9 Mon Sep 17 00:00:00 2001 From: Cezary Kaliszyk Date: Mon, 26 Aug 2013 17:43:31 +0200 Subject: [PATCH] Update from HH --- development/thales/chaff/august9_2011_session.hl | 105 + development/thales/chaff/external_arith.hl | 119 + development/thales/chaff/general/flyshot.hl | 744 + development/thales/chaff/general/flyshot2.hl | 737 + .../thales/chaff/general/flyspeck_utility.hl | 70 + .../thales/chaff/general/generate_definitions.ml | 78 + development/thales/chaff/general/log.hl | 36 + development/thales/chaff/general/snapshot.hl | 1202 + development/thales/chaff/general/template_def.ml | 163 + development/thales/chaff/general/xx.hl | 26 + development/thales/chaff/load_path.ml | 16 + development/thales/chaff/meson_edit.hl | 964 + development/thales/chaff/tactic.hl | 97 + development/thales/chaff/tactics.hl | 1395 + development/thales/chaff/tame_constants.ml | 46 + development/thales/chaff/tmp/determinants_patch.ml | 2166 ++ development/thales/chaff/tmp/vectors_patch.ml | 7480 ++++ development/thales/examples/axiom_example.hl | 75 + development/thales/examples/beta_pair_thm.hl | 63 + development/thales/examples/lemma_negligible.hl | 42 + development/thales/examples/sierpinski.hl | 375 + .../thales/examples/workshop2010_beta_pair_thm.hl | 44 + .../examples/workshop2010_ky_lemma_negligible.hl | 30 + .../thales/examples/workshop2010_quyen_example.hl | 49 + development/thales/log/log_searches.hl | 7488 ++++ development/thales/ocaml/leech.ml | 201 + development/thales/ocaml/rank_boost.hl | 142 + development/thales/ocaml/script.ml | 34 + development/thales/ocaml/sphere.ml | 73 + development/thales/session/cleanup.hl | 6 + development/thales/session/experiment_.hl | 489 + development/thales/session/localbuild.hl | 66 + development/thales/session/scratch.hl | 3831 ++ development/thales/session/work_in_progress.hl | 99 + emacs/print-types.ml | 58 + formal_ineqs/arith/arith_cache.hl | 212 + formal_ineqs/arith/arith_num.hl | 1544 + formal_ineqs/arith/eval_interval.hl | 278 + formal_ineqs/arith/float.hl | 3889 +++ formal_ineqs/arith/float_atn.hl | 582 + formal_ineqs/arith/float_theory.hl | 87 + formal_ineqs/arith/interval_arith.hl | 59 + formal_ineqs/arith/more_float.hl | 491 + formal_ineqs/arith/nat.hl | 106 + formal_ineqs/arith/num_exp_theory.hl | 251 + formal_ineqs/arith_options.hl | 25 + formal_ineqs/examples.hl | 74 + formal_ineqs/examples_flyspeck.hl | 326 + formal_ineqs/examples_poly.hl | 141 + formal_ineqs/informal/informal_arith.hl | 805 + formal_ineqs/informal/informal_eval_interval.hl | 275 + formal_ineqs/informal/informal_m_taylor.hl | 403 + formal_ineqs/informal/informal_m_verifier.hl | 317 + .../jordan/parse_ext_override_interface.hl | 213 + formal_ineqs/jordan/real_ext.hl | 303 + formal_ineqs/jordan/refinement.hl | 79 + formal_ineqs/jordan/taylor_atn.hl | 917 + formal_ineqs/lib/ssrbool-compiled.hl | 759 + formal_ineqs/lib/ssreflect/sections.hl | 273 + formal_ineqs/lib/ssreflect/ssreflect.hl | 1032 + formal_ineqs/lib/ssrfun-compiled.hl | 304 + formal_ineqs/lib/ssrnat-compiled.hl | 1634 + formal_ineqs/list/list_conversions.hl | 523 + formal_ineqs/list/list_float.hl | 202 + formal_ineqs/list/more_list.hl | 128 + formal_ineqs/misc/misc.hl | 63 + formal_ineqs/misc/vars.hl | 148 + formal_ineqs/taylor/m_taylor.hl | 1487 + formal_ineqs/taylor/m_taylor_arith.hl | 1604 + formal_ineqs/taylor/m_taylor_arith2.hl | 682 + .../taylor/theory/multivariate_taylor-compiled.hl | 2917 ++ .../taylor/theory/taylor_interval-compiled.hl | 2464 ++ formal_ineqs/verifier/interval_m/interval.ml | 173 + formal_ineqs/verifier/interval_m/line_interval.ml | 114 + formal_ineqs/verifier/interval_m/recurse.hl | 411 + formal_ineqs/verifier/interval_m/recurse.ml | 315 + formal_ineqs/verifier/interval_m/recurse0.ml | 152 + formal_ineqs/verifier/interval_m/report.ml | 50 + formal_ineqs/verifier/interval_m/taylor.ml | 376 + formal_ineqs/verifier/interval_m/types.ml | 52 + formal_ineqs/verifier/interval_m/univariate.ml | 107 + formal_ineqs/verifier/interval_m/verifier.hl | 327 + formal_ineqs/verifier/interval_m/verifier.ml | 305 + formal_ineqs/verifier/m_verifier.hl | 1610 + formal_ineqs/verifier/m_verifier_build.hl | 214 + formal_ineqs/verifier/m_verifier_main.hl | 463 + formal_ineqs/verifier_options.hl | 18 + formal_lp/glpk/build_certificates.hl | 394 + formal_lp/glpk/build_main.hl | 95 + formal_lp/glpk/ex1/bb1_out.hl | 82 + formal_lp/glpk/ex2/bb2_1_out.hl | 81 + formal_lp/glpk/ex2/bb2_2_out.hl | 82 + formal_lp/glpk/ex2/bb2_3_out.hl | 83 + formal_lp/glpk/ex2/bb2_4_out.hl | 79 + formal_lp/glpk/ex2/bb2_5_out.hl | 76 + formal_lp/glpk/feasible.hl | 479 + formal_lp/glpk/lp_binary_certificate.hl | 65 + formal_lp/glpk/onepass.hl | 278 + formal_lp/glpk/test_hard.hl | 76 + formal_lp/hypermap/arith_link.hl | 12 + .../hypermap/computations/informal_computations.hl | 45 + .../hypermap/computations/list_conversions2.hl | 1065 + .../computations/list_hypermap_computations.hl | 912 + .../hypermap/computations/more_theory-compiled.hl | 294 + formal_lp/hypermap/ineqs/lp_approx_ineqs.hl | 292 + formal_lp/hypermap/ineqs/lp_body_ineqs.hl | 244 + formal_lp/hypermap/ineqs/lp_body_ineqs_data.hl | 132 + formal_lp/hypermap/ineqs/lp_gen_ineqs.hl | 235 + formal_lp/hypermap/ineqs/lp_gen_theory-compiled.hl | 497 + formal_lp/hypermap/ineqs/lp_head_ineqs.hl | 406 + formal_lp/hypermap/ineqs/lp_ineqs.hl | 314 + formal_lp/hypermap/ineqs/lp_ineqs_defs.hl | 137 + .../hypermap/ineqs/lp_ineqs_proofs-compiled.hl | 3592 ++ .../hypermap/ineqs/lp_ineqs_proofs2-compiled.hl | 1396 + .../hypermap/ineqs/lp_main_estimate-compiled.hl | 2179 ++ formal_lp/hypermap/main/lp_certificate.hl | 114 + formal_lp/hypermap/main/prove_flyspeck_lp.hl | 1066 + formal_lp/hypermap/main/test6.hl | 68 + formal_lp/hypermap/main/test_ex2_complete.hl | 266 + formal_lp/hypermap/main/test_hard.hl | 574 + .../hypermap/ssreflect/add_triangle-compiled.hl | 1477 + .../hypermap/ssreflect/list_hypermap-compiled.hl | 1293 + .../ssreflect/list_hypermap_iso-compiled.hl | 1027 + formal_lp/hypermap/tests/test_all_lists.hl | 147 + formal_lp/hypermap/verify_all.hl | 99 + formal_lp/ineqs/constants_approx.hl | 572 + formal_lp/ineqs/delta_ineq.hl | 166 + formal_lp/lp_example/out_test.hl | 21 + formal_lp/more_arith/arith_int.hl | 275 + formal_lp/more_arith/lin_f.hl | 112 + formal_lp/more_arith/prove_lp.hl | 440 + formal_lp/old/arith/arith_array.hl | 1849 + formal_lp/old/arith/arith_cache.hl | 211 + formal_lp/old/arith/arith_hash.hl | 1803 + formal_lp/old/arith/arith_hash2.hl | 1800 + formal_lp/old/arith/arith_hash_int.hl | 277 + formal_lp/old/arith/arith_hash_rat.hl | 389 + formal_lp/old/arith/arith_options.hl | 21 + formal_lp/old/arith/float.hl | 4613 +++ formal_lp/old/arith/float_atn.hl | 1028 + formal_lp/old/arith/float_test.hl | 166 + formal_lp/old/arith/float_theory.hl | 92 + formal_lp/old/arith/informal/informal_arith.hl | 904 + .../old/arith/informal/informal_eval_interval.hl | 298 + formal_lp/old/arith/informal/informal_m_taylor.hl | 540 + .../old/arith/informal/informal_m_verifier.hl | 283 + formal_lp/old/arith/informal/tests1.hl | 493 + formal_lp/old/arith/informal/tests2.hl | 601 + formal_lp/old/arith/informal/tests3.hl | 247 + formal_lp/old/arith/informal/tests_poly.hl | 134 + formal_lp/old/arith/interval_arith.hl | 26 + formal_lp/old/arith/misc.hl | 58 + formal_lp/old/arith/nat.hl | 100 + formal_lp/old/arith/num_exp_theory.hl | 184 + formal_lp/old/arith/prove_lp.hl | 523 + formal_lp/old/arith/tests/arith_test_data10.hl | 1002 + formal_lp/old/arith/tests/arith_test_data15.hl | 1002 + formal_lp/old/arith/tests/arith_test_data18.hl | 1002 + formal_lp/old/arith/tests/arith_test_data20.hl | 1002 + formal_lp/old/arith/tests/arith_test_data25.hl | 1002 + formal_lp/old/arith/tests/arith_test_data27.hl | 1002 + formal_lp/old/arith/tests/arith_test_data5.hl | 1002 + formal_lp/old/arith/tests/test_nat_arith.hl | 197 + formal_lp/old/formal_interval/eval_interval.hl | 261 + .../old/formal_interval/interval_1d/interval.hl | 165 + .../formal_interval/interval_1d/line_interval.hl | 109 + .../old/formal_interval/interval_1d/recurse.hl | 170 + .../old/formal_interval/interval_1d/report.hl | 40 + .../old/formal_interval/interval_1d/taylor.hl | 230 + .../old/formal_interval/interval_1d/test1d.hl | 258 + formal_lp/old/formal_interval/interval_1d/types.hl | 43 + .../old/formal_interval/interval_1d/univariate.hl | 98 + .../formal_interval/interval_m/function_data.hl | 338 + .../old/formal_interval/interval_m/interval.hl | 166 + .../formal_interval/interval_m/line_interval.hl | 108 + .../old/formal_interval/interval_m/recurse.hl | 282 + .../old/formal_interval/interval_m/recurse0.hl | 145 + formal_lp/old/formal_interval/interval_m/report.hl | 40 + formal_lp/old/formal_interval/interval_m/taylor.hl | 367 + formal_lp/old/formal_interval/interval_m/types.hl | 47 + .../old/formal_interval/interval_m/univariate.hl | 99 + .../old/formal_interval/interval_m/verifier.hl | 414 + formal_lp/old/formal_interval/lin_approx.hl | 641 + formal_lp/old/formal_interval/m_examples_poly.hl | 35 + formal_lp/old/formal_interval/m_taylor.hl | 1867 + formal_lp/old/formal_interval/m_taylor_arith.hl | 1684 + formal_lp/old/formal_interval/m_taylor_arith2.hl | 669 + formal_lp/old/formal_interval/m_taylor_old.hl | 891 + formal_lp/old/formal_interval/m_test.hl | 183 + formal_lp/old/formal_interval/m_tests.hl | 588 + formal_lp/old/formal_interval/m_tests2.hl | 599 + formal_lp/old/formal_interval/m_tests3.hl | 437 + formal_lp/old/formal_interval/m_tests4.hl | 235 + formal_lp/old/formal_interval/m_verifier.hl | 1331 + formal_lp/old/formal_interval/m_verifier0.hl | 88 + formal_lp/old/formal_interval/more_float.hl | 576 + formal_lp/old/formal_interval/second_approx.hl | 1200 + formal_lp/old/formal_interval/test.hl | 418 + formal_lp/old/formal_interval/test_taylor_arith.hl | 313 + formal_lp/old/formal_interval/tests_cmp.hl | 165 + .../formal_interval/theory/multivariate_taylor.hl | 2124 ++ .../old/formal_interval/theory/taylor_interval.hl | 1786 + formal_lp/old/formal_interval/verifier.hl | 284 + formal_lp/old/hypermap/constants_approx.hl | 368 + formal_lp/old/hypermap/contravening_ineqs.hl | 1832 + formal_lp/old/hypermap/list_conversions.hl | 531 + formal_lp/old/hypermap/list_hypermap.hl | 2514 ++ .../old/hypermap/list_hypermap_computations.hl | 1712 + formal_lp/old/hypermap/list_hypermap_defs.hl | 219 + formal_lp/old/hypermap/list_hypermap_iso.hl | 672 + formal_lp/old/hypermap/nobranching_lp.hl | 165 + formal_lp/old/ineqs/contravening_ineqs.hl | 1845 + formal_lp/old/ineqs/list_conversions.hl | 531 + formal_lp/old/ineqs/list_hypermap.hl | 2514 ++ formal_lp/old/ineqs/list_hypermap_computations.hl | 1712 + formal_lp/old/ineqs/list_hypermap_defs.hl | 219 + formal_lp/old/ineqs/list_hypermap_iso.hl | 672 + formal_lp/old/ineqs/list_hypermap_vars.hl | 116 + formal_lp/old/ineqs/nobranching_lp.hl | 279 + formal_lp/old/ineqs/tests/149438122187_out.hl | 89 + formal_lp/old/ineqs/tests/156588677070_out.hl | 90 + formal_lp/old/ineqs/tests/168941837467_out.hl | 91 + formal_lp/old/ineqs/tests/176747399778_out.hl | 87 + formal_lp/old/ineqs/tests/196565289721_out.hl | 91 + formal_lp/old/ineqs/tests/202328731904_out.hl | 88 + formal_lp/old/ineqs/tests/204898223616_out.hl | 90 + formal_lp/old/ineqs/tests/206221606034_out.hl | 89 + formal_lp/old/ineqs/tests/209986500083_out.hl | 90 + formal_lp/old/ineqs/tests/234860659776_out.hl | 88 + formal_lp/old/ineqs/tests/241242841715_out.hl | 88 + formal_lp/old/ineqs/tests/241966209046_out.hl | 89 + formal_lp/old/ineqs/tests/28820130324_out.hl | 89 + formal_lp/old/ineqs/tests/62059307362_out.hl | 86 + formal_lp/old/ineqs/tests/63917576180_out.hl | 90 + formal_lp/old/ineqs/tests/72977109430_out.hl | 88 + formal_lp/old/ineqs/tests/75655754509_out.hl | 88 + formal_lp/old/ineqs/tests/86324340346_out.hl | 90 + formal_lp/old/ineqs/tests/95170601659_out.hl | 90 + formal_lp/old/ineqs/tests/97685954266_out.hl | 86 + formal_lp/old/ineqs/tests/all.hl | 5 + formal_lp/old/ineqs/tests/all_tests.hl | 43 + formal_lp/old/ineqs/tests2/118343205068_out.hl | 84 + formal_lp/old/ineqs/tests2/118760185161_out.hl | 88 + formal_lp/old/ineqs/tests2/119040238600_out.hl | 83 + formal_lp/old/ineqs/tests2/122526068934_out.hl | 90 + formal_lp/old/ineqs/tests2/123040027899_out.hl | 87 + formal_lp/old/ineqs/tests2/125719999821_out.hl | 89 + formal_lp/old/ineqs/tests2/147671934133_out.hl | 89 + formal_lp/old/ineqs/tests2/156401568298_out.hl | 82 + formal_lp/old/ineqs/tests2/156615503428_out.hl | 87 + formal_lp/old/ineqs/tests2/158856256118_out.hl | 86 + formal_lp/old/ineqs/tests2/165950391005_out.hl | 88 + formal_lp/old/ineqs/tests2/168156828154_out.hl | 85 + formal_lp/old/ineqs/tests2/17272290668_out.hl | 89 + formal_lp/old/ineqs/tests2/195482381558_out.hl | 86 + formal_lp/old/ineqs/tests2/196021155893_out.hl | 85 + formal_lp/old/ineqs/tests2/206084941231_out.hl | 88 + formal_lp/old/ineqs/tests2/211626865969_out.hl | 90 + formal_lp/old/ineqs/tests2/219955817888_out.hl | 86 + formal_lp/old/ineqs/tests2/245859035526_out.hl | 84 + formal_lp/old/ineqs/tests2/25168582633_out.hl | 87 + formal_lp/old/ineqs/tests2/30500231120_out.hl | 80 + formal_lp/old/ineqs/tests2/4436579732_out.hl | 91 + formal_lp/old/ineqs/tests2/63626063287_out.hl | 84 + formal_lp/old/ineqs/tests2/69964410750_out.hl | 88 + formal_lp/old/ineqs/tests2/74394196986_out.hl | 83 + formal_lp/old/ineqs/tests2/91057093091_out.hl | 87 + formal_lp/old/ineqs/tests2/945145744_out.hl | 87 + formal_lp/old/ineqs/tests2/all_tests.hl | 93 + formal_lp/old/list/list_conversions.hl | 718 + formal_lp/old/list/list_float.hl | 195 + glpk/glpk_link.ml | 248 + glpk/minorlp/OXLZLEZ.ml | 347 + glpk/minorlp/tame_table.ml | 189 + glpk/sphere.ml | 76 + glpk/tame_archive/build_lp.hl | 120 + glpk/tame_archive/hard_lp.ml | 378 + glpk/tame_archive/lpproc.ml | 477 + glpk/tame_archive/scaffolding.hl | 138 + graph_generator/graph_control.hl | 256 + jHOLLight/Examples/group_sylow-compiled.hl | 2789 ++ jHOLLight/Examples/seq-compiled.hl | 3821 ++ jHOLLight/Examples/ssrbool-compiled.hl | 766 + jHOLLight/Examples/ssrfun-compiled.hl | 371 + jHOLLight/Examples/ssrnat-compiled.hl | 2221 ++ .../JHOL.app/Contents/Resources/Java/newprinter.ml | 768 + jHOLLight/caml/raw_printer.hl | 70 + jHOLLight/caml/sections.hl | 327 + jHOLLight/caml/ssreflect.hl | 1059 + kepler_tex/tikz/tikz.ml | 1359 + legacy/general/database_more.ml | 2107 ++ legacy/general/deprecated_sphere.hl | 1546 + legacy/glpk/glpk/glpk_def.hl | 39 + legacy/glpk/glpk/mkineq.ml | 230 + legacy/glpk/glpk/tame_archive_hard_notes.hl | 889 + legacy/inequalities/definitions_kepler.ml | 1268 + legacy/inequalities/definitions_keplerC.ml | 673 + legacy/inequalities/dodec_ineq_names.ml | 117 + legacy/inequalities/dodec_inequalities.ml | 284 + legacy/inequalities/generate-ineq-syntax.ml | 40 + legacy/inequalities/inequality_spec.ml | 653 + legacy/inequalities/kep_deprecated.ml | 772 + legacy/inequalities/kep_ineq_bis.ml | 484 + legacy/inequalities/kep_inequalities.ml |13573 ++++++++ legacy/inequalities/kep_inequalities2.ml | 1152 + legacy/inequalities/kepler_ineq_names.ml | 1130 + legacy/inequalities/ocaml_to_sml.ml | 1102 + legacy/inequalities/sigmahat.hl | 61 + legacy/inequalities/sphere.ml | 526 + legacy/linear_program/LinProg.ml | 42 + legacy/load_def_kepler.ml | 42 + legacy/oldfan/Conforming2.hl |17815 ++++++++++ legacy/oldfan/DHVFGBC.hl | 6061 ++++ legacy/oldfan/DWWUTKW.hl | 286 + legacy/oldfan/IBZWFFH.hl | 93 + legacy/oldfan/JBDNJJB.hl | 102 + legacy/oldfan/JGIYDLE.hl | 1638 + legacy/oldfan/JUTSTKG.hl | 1342 + legacy/oldfan/LEMMA.hl | 4744 +++ legacy/oldfan/RWXUYZZ.hl | 1519 + legacy/oldfan/TACTIC.hl | 37 + legacy/oldfan/ULEKUUB.hl | 371 + legacy/oldfan/VBTIKLP.hl | 1025 + legacy/oldfan/ch_fan/FAN_DEF.ml | 24 + legacy/oldfan/ch_fan/fan_definition.hl | 37 + legacy/oldfan/ch_fan/fan_definition2.hl | 7 + legacy/oldfan/ch_fan/fan_summary.hl | 31 + legacy/oldfan/definition_fan.hl | 231 + legacy/oldfan/fan_concl.hl | 53 + legacy/oldfan/fantopology.ml | 3042 ++ legacy/oldfan/fully_surrounded.hl | 139 + legacy/oldfan/hypermap_of_fan.hl | 1010 + legacy/oldfan/introduction1.hl | 1493 + legacy/oldfan/leads_into.hl | 215 + legacy/oldfan/node_fan.hl | 645 + legacy/oldhypermap/ch_hypermap/hypermap_summary.hl | 52 + legacy/oldleg/assembly.ml | 1072 + legacy/oldleg/collect_geom.ml | 7385 ++++ legacy/oldleg/collect_geom_a.ml | 6 + legacy/oldleg/collect_geom_error.ml | 70 + legacy/oldleg/collect_geom_spec.ml | 2122 ++ legacy/oldleg/geomdetail.ml | 2839 ++ legacy/oldleg/geomdetail_08.ml | 1420 + legacy/oldleg/hull.ml | 131 + legacy/oldleg/hull_error.ml | 149 + legacy/oldlocal/PQCSXWG_old.hl | 138 + legacy/oldlocal/XBJRPHC.hl | 765 + legacy/oldlocal/ch_local/CKQOWSA.hl | 25 + legacy/oldlocal/ch_local/cyclic_definition.hl | 16 + legacy/oldlocal/ch_local/local_defs.hl | 201 + legacy/oldlocal/ch_local/local_defs2.hl | 126 + legacy/oldlocal/ch_local/local_fan.ml | 211 + legacy/oldlocal/nguyenquangtruong270983/JBDNJJB.hl | 305 + .../nguyenquangtruong270983/WRGCVDR_CIZMRRH.hl | 2203 ++ legacy/oldnonlinear/cutlemmas.hl | 1406 + .../oldnonlinear/deprecated_main_estimate_ineq.hl | 1784 + legacy/oldnonlinear/mdtau.hl | 237 + .../oldnonlinear/nonlinear/break_quad_jul2013.hl | 471 + .../oldnonlinear/nonlinear/experiments/oracle.hl | 134 + legacy/oldnonlinear/nonlinear/experiments/test.hl | 3643 ++ .../nonlinear/experiments/test_may_2012.hl | 143 + .../nonlinear/experiments/zumkeller_test.hl | 398 + legacy/oldnonlinear/nonlinear/fejestoth12.hl | 221 + legacy/oldnonlinear/nonlinear/ineq_cell23.hl | 67 + .../main_estimate_pent_hex_cut_may_2013.hl | 865 + legacy/oldnonlinear/nonlinear/main_ineq_calcs.ml | 69 + legacy/oldnonlinear/nonlinear/partials.hl | 135 + legacy/oldnonlinear/nonlinear/temp_ineq.hl | 212 + legacy/oldnonlinear/nonlinear/test_ineq.hl | 480 + .../nonlinear/test_jun2012_ZTG_series.hl | 556 + .../test_may2013_terminal_pent_hex_series.hl | 2158 ++ legacy/oldnonlinear/nonlinear/text_interface.hl | 56 + legacy/oldnonlinear/post.hl | 221 + legacy/oldnonlinear/removedef.hl | 312 + legacy/oldpacking/BBDTRGC_def.hl | 31 + legacy/oldpacking/DRUQUFE.hl | 34 + legacy/oldpacking/IDBEZAL.hl | 27 + legacy/oldpacking/JJGTQMN_def.hl | 25 + legacy/oldpacking/JNRJQSM_def.hl | 33 + legacy/oldpacking/KHEJKCI.hl | 26 + legacy/oldpacking/NOPZSEH_def.hl | 27 + legacy/oldpacking/PHZVPFY_def.hl | 25 + legacy/oldpacking/RHWVGNP.hl | 49 + legacy/oldpacking/TIWWFYQ.hl | 37 + legacy/oldpacking/ch_packing/TSKAJXY.hl | 69 + legacy/oldpacking/ch_packing/oxl_lemma.hl | 316 + legacy/oldpacking/ky_packing/EMNWUUS.hl | 494 + legacy/oldpacking/ky_packing/UPFZBZM.hl | 847 + legacy/oldpacking/ky_packing/UPFZBZM_axioms.hl | 84 + .../ky_packing/UPFZBZM_support_lemmas.hl | 411 + legacy/oldpacking/ky_packing/UPFZBZM_working.hl | 969 + legacy/oldpacking/ky_packing/marchal_cells.hl | 680 + .../packing/development/Backup/GRUTOTI.hl | 7970 +++++ .../packing/development/Backup/KIZHLTL.hl | 1090 + .../packing/development/Backup/RDWKARC.hl | 273 + .../packing/development/Backup/UPFZBZM.hl | 201 + .../packing/development/Backup/load_sequence.hl | 93 + .../packing/development/Backup/marchal_cells_3.hl | 7366 ++++ .../Backup/sum_gammaX_lmfun_estimate.hl | 1437 + legacy/oldpacking/packing/development/REUHADY.hl | 8235 +++++ legacy/oldpacking/packing/development/TSKAJXY.hl | 807 + .../packing/development/marchal_cells_2.hl | 4100 +++ .../packing/development/sum_beta_bump.hl | 2857 ++ legacy/oldpacking/packing/development/working.hl | 24 + legacy/oldtame/UBHDEUU.hl | 336 + legacy/oldtame/dangtatdatusb/DLWCHEM.hl | 2628 ++ legacy/oldtame/dangtatdatusb/UBHDEUU.hl | 67 + legacy/oldtame/pishort.hl | 127 + legacy/oldtame/quarantine/SZIPOAS.hl | 404 + legacy/oldtrig/run_file_euler.ml | 22 + legacy/oldtrig/trig_old.ml | 243 + legacy/oldvolume/ch_volume/vol2.hl | 75 + legacy/oldvolume/ch_volume/volume.hl | 201 + legacy/oldvolume/ch_volume/volume_temp.hl | 13 + legacy/toplevel.ml | 63 + make.ml | 4 + port_interval/compose.hl | 324 + port_interval/function_data.hl | 100 + port_interval/interval.hl | 161 + port_interval/line_interval.hl | 107 + port_interval/recurse.hl | 274 + port_interval/report.hl | 40 + port_interval/taylor.hl | 286 + port_interval/types.hl | 46 + port_interval/univariate.hl | 84 + projects_discrete_geom/bcc_lattice.hl | 743 + projects_discrete_geom/bezdek_reid/bezdek_reid.hl | 283 + projects_discrete_geom/fejestoth12/defs.hl | 11 + projects_discrete_geom/fejestoth12/lipstick_ft.ml | 134 + .../strong_dodec_conj/strongdodec_ineq.hl | 342 + tame_archive/tame_archive.hl | 168 + text_formalization/boot.hl | 21 + text_formalization/boot.ml | 49 + text_formalization/build.hl | 258 + text_formalization/computational_build.hl | 116 + text_formalization/fan/CFYXFTY.hl | 1455 + text_formalization/fan/Conforming.hl |17809 ++++++++++ text_formalization/fan/GMLWKPK.hl | 297 + text_formalization/fan/HypermapAndFan.hl | 2767 ++ text_formalization/fan/fan_defs.hl | 304 + text_formalization/fan/fan_misc.hl | 155 + text_formalization/fan/hypermap_iso-compiled.hl | 1174 + text_formalization/fan/introduction.hl | 3020 ++ text_formalization/fan/planarity.hl |16206 +++++++++ text_formalization/fan/polyhedron.hl | 3163 ++ text_formalization/fan/topology.hl | 4775 +++ text_formalization/general/debug.hl | 118 + text_formalization/general/flyspeck_lib.hl | 125 + text_formalization/general/hol_pervasives.hl | 64 + text_formalization/general/lib.hl | 848 + text_formalization/general/package_constant.hl | 67 + text_formalization/general/parser_verbose.hl | 297 + text_formalization/general/print_types.hl | 92 + text_formalization/general/prove_by_refinement.hl | 125 + text_formalization/general/sphere.hl | 851 + text_formalization/general/state_manager.hl | 294 + text_formalization/general/tactics.hl | 118 + text_formalization/general/update_database_310.ml | 315 + text_formalization/general/update_database_400.ml | 340 + text_formalization/hypermap/bauer_nipkow.hl | 1011 + text_formalization/hypermap/hypermap.hl |15868 +++++++++ text_formalization/hypermap/summary.hl | 303 + text_formalization/jordan/compute_pi.hl | 223 + text_formalization/jordan/float.hl | 2108 ++ text_formalization/jordan/float_example.hl | 79 + text_formalization/jordan/flyspeck_constants.hl | 47 + text_formalization/jordan/goal_printer.hl | 160 + text_formalization/jordan/hash_term.hl | 93 + text_formalization/jordan/lib_ext.hl | 79 + text_formalization/jordan/make.hl | 33 + text_formalization/jordan/misc_defs_and_lemmas.hl | 1792 + text_formalization/jordan/num_ext_gcd.hl | 266 + text_formalization/jordan/num_ext_nabs.hl | 114 + .../jordan/parse_ext_override_interface.hl | 213 + text_formalization/jordan/real_ext.hl | 306 + text_formalization/jordan/real_ext_geom_series.hl | 66 + text_formalization/jordan/refinement.hl | 80 + text_formalization/jordan/tactics_jordan.hl | 1717 + text_formalization/jordan/taylor_atn.hl | 869 + text_formalization/leg/AFF_SGN_TAC.hl | 50 + text_formalization/leg/abc_of_quadratic_def.hl | 36 + text_formalization/leg/affprops.hl | 136 + text_formalization/leg/basics.hl | 518 + text_formalization/leg/cayleyR_def.hl | 106 + text_formalization/leg/collect_geom.hl | 2775 ++ text_formalization/leg/collect_geom2.hl | 3074 ++ text_formalization/leg/enclosed_def.hl | 51 + text_formalization/leg/geomdetail.hl | 1132 + text_formalization/leg/muR_def.hl | 49 + text_formalization/leg/quadratic_root_plus_def.hl | 32 + text_formalization/local/ARDBZYE.hl | 2991 ++ text_formalization/local/AUEAHEH.hl | 2994 ++ text_formalization/local/AURSIPD.hl | 1850 + text_formalization/local/AXJRPNC.hl | 1058 + text_formalization/local/AYQJTMD.hl | 237 + text_formalization/local/BKOSSGE.hl | 396 + text_formalization/local/CNICGSF.hl | 930 + text_formalization/local/CQAOQLR.hl | 335 + text_formalization/local/CUXVZOZ.hl | 5105 +++ text_formalization/local/EYYPQDW.hl | 517 + text_formalization/local/FEKTYIY.hl | 212 + text_formalization/local/GBYCPXS.hl | 690 + text_formalization/local/HDPLYGY.hl | 1871 + text_formalization/local/HIJQAHA.hl | 4373 +++ text_formalization/local/HXHYTIJ.hl | 131 + text_formalization/local/IMJXPHR.hl |11657 +++++++ text_formalization/local/IUNBUIG.hl | 2597 ++ text_formalization/local/JCYFMRP.hl | 625 + text_formalization/local/JEJTVGB.hl | 233 + text_formalization/local/JKQEWGV.hl | 3307 ++ text_formalization/local/JLXFDMJ.hl | 825 + text_formalization/local/JOTSWIX.hl | 3954 +++ text_formalization/local/LDURDPN.hl | 133 + text_formalization/local/LFJCIXP.hl | 64 + text_formalization/local/LKGRQUI.hl | 269 + text_formalization/local/LOCAL_LEMMAS.hl | 7811 +++++ text_formalization/local/LVDUCXU.hl | 2455 ++ text_formalization/local/MIQMCSN.hl | 3484 ++ text_formalization/local/MTUWLUN.hl | 4909 +++ text_formalization/local/NKEZBFC.hl | 2618 ++ text_formalization/local/NUXCOEA.hl | 7755 +++++ text_formalization/local/OCBICBY.hl | 4960 +++ text_formalization/local/ODXLSTCv2.hl | 4114 +++ text_formalization/local/OTMTOTJ.hl | 1574 + text_formalization/local/PCRTTID.hl | 401 + text_formalization/local/PPBTYDQ.hl | 614 + text_formalization/local/PQCSXWG.hl | 320 + text_formalization/local/QKNVMLB.hl |10773 ++++++ text_formalization/local/RNSYJXM-compiled.hl | 397 + text_formalization/local/RRCWNSJ.hl | 878 + text_formalization/local/SGTRNAF.hl | 191 + text_formalization/local/TECOXBM.hl | 1742 + text_formalization/local/TFITSKC.hl | 673 + text_formalization/local/UAGHHBM.hl | 4153 +++ text_formalization/local/UXCKFPE.hl | 2656 ++ text_formalization/local/VASYYAU.hl | 2861 ++ text_formalization/local/VPWSHTO.hl | 2969 ++ text_formalization/local/WJSCPRO.hl | 3216 ++ text_formalization/local/WKEIDFT.hl | 834 + text_formalization/local/WRGCVDR_CIZMRRH.hl | 3860 +++ text_formalization/local/XIVPHKS.hl | 487 + text_formalization/local/XWITCCN.hl | 8426 +++++ text_formalization/local/YRTAFYH.hl | 520 + text_formalization/local/YXIONXL.hl | 2800 ++ text_formalization/local/YXIONXL2.hl | 4195 +++ text_formalization/local/ZITHLQN.hl | 3202 ++ text_formalization/local/ZLZTHIC.hl | 4009 +++ text_formalization/local/appendix_main_estimate.hl | 1949 ++ text_formalization/local/deformation.hl | 1040 + text_formalization/local/dih2k.hl | 3587 ++ text_formalization/local/hexagons.hl | 2188 ++ text_formalization/local/local_lemmas1.hl | 7266 ++++ text_formalization/local/localization.hl | 1644 + text_formalization/local/lp_details.hl | 1235 + text_formalization/local/lunar_deform.hl | 5421 +++ text_formalization/local/pent_hex.hl | 3123 ++ text_formalization/local/polar_fan.hl | 3365 ++ text_formalization/local/terminal.hl | 4432 +++ text_formalization/nonlinear/auto_lib.hl | 441 + text_formalization/nonlinear/break_case_exec.hl | 377 + text_formalization/nonlinear/break_case_log.hl |29271 ++++++++++++++++ text_formalization/nonlinear/calc_derivative.hl | 1508 + text_formalization/nonlinear/check_completeness.hl | 2439 ++ text_formalization/nonlinear/cleanDeriv.hl | 362 + .../nonlinear/cleanDeriv_examples.hl | 83 + text_formalization/nonlinear/compute_2158872499.hl | 1422 + .../nonlinear/formal_tests/hminus.hl | 225 + .../nonlinear/formal_tests/ineq_ids.hl | 643 + text_formalization/nonlinear/formal_tests/load.hl | 53 + text_formalization/nonlinear/formal_tests/test1.hl | 258 + text_formalization/nonlinear/formal_tests/test2.hl | 103 + text_formalization/nonlinear/function_list.hl | 364 + .../nonlinear/functional_equation.hl | 1508 + text_formalization/nonlinear/ineq.hl | 3678 ++ text_formalization/nonlinear/ineqdata3q1h.hl | 1164 + text_formalization/nonlinear/lemma.hl | 1607 + text_formalization/nonlinear/main_estimate_ineq.hl | 1634 + text_formalization/nonlinear/merge_ineq.hl | 5456 +++ text_formalization/nonlinear/mk_all_ineq.hl | 149 + text_formalization/nonlinear/nonlin_def.hl | 522 + text_formalization/nonlinear/optimize.hl | 1088 + text_formalization/nonlinear/parse_ineq.hl | 691 + text_formalization/nonlinear/prep.hl |36568 ++++++++++++++++++++ text_formalization/nonlinear/scripts.hl | 547 + text_formalization/nonlinear/sharp.hl | 43 + text_formalization/nonlinear/types.hl | 154 + text_formalization/nonlinear/vukhacky_tactics.hl | 65 + text_formalization/packing/AJRIPQN.hl | 1051 + text_formalization/packing/DDZUPHJ.hl | 611 + text_formalization/packing/EMNWUUS.hl | 526 + text_formalization/packing/GRUTOTI.hl | 8005 +++++ text_formalization/packing/HDTFNFZ.hl | 114 + text_formalization/packing/KIZHLTL.hl | 1032 + text_formalization/packing/LEPJBDJ.hl | 927 + text_formalization/packing/NJIUTIU.hl | 581 + text_formalization/packing/OXLZLEZ.hl | 9717 ++++++ text_formalization/packing/OXL_def.hl | 830 + text_formalization/packing/QZKSYKG.hl | 2255 ++ text_formalization/packing/QZYZMJC.hl | 1111 + text_formalization/packing/RDWKARC.hl | 314 + text_formalization/packing/REUHADY.hl | 8358 +++++ text_formalization/packing/RVFXZBU.hl | 198 + text_formalization/packing/Rogers.hl |10872 ++++++ text_formalization/packing/SLTSTLO.hl | 3692 ++ text_formalization/packing/TARJJUW.hl | 666 + text_formalization/packing/TEZFFSK.hl | 586 + text_formalization/packing/TSKAJXY.hl | 2489 ++ text_formalization/packing/TSKAJXY_034.hl | 749 + text_formalization/packing/TSKAJXY_lemmas.hl | 5668 +++ text_formalization/packing/UPFZBZM.hl | 238 + .../packing/UPFZBZM_support_lemmas.hl | 399 + text_formalization/packing/URRPHBZ1.hl | 688 + text_formalization/packing/URRPHBZ2.hl | 972 + text_formalization/packing/URRPHBZ3.hl | 71 + text_formalization/packing/YNHYJIT.hl | 107 + text_formalization/packing/YSSKQOY.hl | 584 + text_formalization/packing/bump.hl | 1294 + text_formalization/packing/counting_spheres.hl | 7692 ++++ text_formalization/packing/leaf_cell.hl | 4809 +++ text_formalization/packing/marchal_cells.hl | 676 + text_formalization/packing/marchal_cells_2_new.hl | 7048 ++++ text_formalization/packing/marchal_cells_3.hl | 7376 ++++ text_formalization/packing/oxl_2012.hl | 6299 ++++ text_formalization/packing/pack1.hl | 620 + text_formalization/packing/pack2.hl | 561 + text_formalization/packing/pack3.hl | 2529 ++ text_formalization/packing/pack_concl.hl | 357 + text_formalization/packing/pack_defs.hl | 306 + .../packing/sum_gammaX_lmfun_estimate.hl | 1470 + text_formalization/strictbuild.hl | 243 + text_formalization/tame/ArcProperties.hl | 1091 + text_formalization/tame/CDTETAT.hl | 324 + text_formalization/tame/CKQOWSA.hl | 580 + text_formalization/tame/CKQOWSA_3.hl | 1455 + text_formalization/tame/CKQOWSA_4.hl | 4272 +++ text_formalization/tame/CRTTXAT.hl | 584 + text_formalization/tame/FATUGPD.hl | 1580 + text_formalization/tame/HRXEFDM.hl | 284 + text_formalization/tame/Inequalities.hl | 740 + text_formalization/tame/JGTDEBU.hl | 256 + text_formalization/tame/TameGeneral.hl | 1117 + text_formalization/tame/dont_repeat_yourself.hl | 84 + .../tame/ssreflect/FNJLBXS-compiled.hl | 1828 + .../tame/ssreflect/KCBLRQC-compiled.hl | 1054 + .../tame/ssreflect/MQMSMAB-compiled.hl | 89 + text_formalization/tame/ssreflect/seq2-compiled.hl | 2046 ++ text_formalization/tame/ssreflect/sort-compiled.hl | 646 + .../tame/ssreflect/tame_lemmas-compiled.hl | 899 + text_formalization/tame/tame_concl.hl | 108 + text_formalization/tame/tame_defs.hl | 312 + text_formalization/tame/tame_opposite.hl | 616 + text_formalization/trigonometry/HVIHVEC.hl | 53 + text_formalization/trigonometry/delta_x.hl | 230 + .../trigonometry/euler_complement.hl | 872 + .../trigonometry/euler_main_theorem.hl | 522 + .../trigonometry/euler_multivariate.hl | 3272 ++ text_formalization/trigonometry/trig1.hl | 1004 + text_formalization/trigonometry/trig2.hl | 5197 +++ text_formalization/trigonometry/trigonometry.hl | 328 + text_formalization/usr/thales/hales_tactic.hl | 458 + text_formalization/usr/thales/init_search.hl | 372 + text_formalization/usr/thales/searching.hl | 1097 + text_formalization/volume/vol1.hl | 2274 ++ 663 files changed, 811667 insertions(+), 0 deletions(-) create mode 100644 development/thales/chaff/august9_2011_session.hl create mode 100644 development/thales/chaff/external_arith.hl create mode 100644 development/thales/chaff/general/flyshot.hl create mode 100644 development/thales/chaff/general/flyshot2.hl create mode 100644 development/thales/chaff/general/flyspeck_utility.hl create mode 100644 development/thales/chaff/general/generate_definitions.ml create mode 100644 development/thales/chaff/general/log.hl create mode 100644 development/thales/chaff/general/snapshot.hl create mode 100644 development/thales/chaff/general/template_def.ml create mode 100644 development/thales/chaff/general/xx.hl create mode 100644 development/thales/chaff/load_path.ml create mode 100644 development/thales/chaff/meson_edit.hl create mode 100644 development/thales/chaff/tactic.hl create mode 100644 development/thales/chaff/tactics.hl create mode 100644 development/thales/chaff/tame_constants.ml create mode 100644 development/thales/chaff/tmp/determinants_patch.ml create mode 100644 development/thales/chaff/tmp/vectors_patch.ml create mode 100644 development/thales/examples/axiom_example.hl create mode 100644 development/thales/examples/beta_pair_thm.hl create mode 100644 development/thales/examples/lemma_negligible.hl create mode 100644 development/thales/examples/sierpinski.hl create mode 100644 development/thales/examples/workshop2010_beta_pair_thm.hl create mode 100644 development/thales/examples/workshop2010_ky_lemma_negligible.hl create mode 100644 development/thales/examples/workshop2010_quyen_example.hl create mode 100644 development/thales/log/log_searches.hl create mode 100755 development/thales/ocaml/leech.ml create mode 100644 development/thales/ocaml/rank_boost.hl create mode 100644 development/thales/ocaml/script.ml create mode 100644 development/thales/ocaml/sphere.ml create mode 100644 development/thales/session/cleanup.hl create mode 100644 development/thales/session/experiment_.hl create mode 100644 development/thales/session/localbuild.hl create mode 100644 development/thales/session/scratch.hl create mode 100644 development/thales/session/work_in_progress.hl create mode 100644 emacs/print-types.ml create mode 100644 formal_ineqs/arith/arith_cache.hl create mode 100644 formal_ineqs/arith/arith_num.hl create mode 100644 formal_ineqs/arith/eval_interval.hl create mode 100644 formal_ineqs/arith/float.hl create mode 100644 formal_ineqs/arith/float_atn.hl create mode 100644 formal_ineqs/arith/float_theory.hl create mode 100644 formal_ineqs/arith/interval_arith.hl create mode 100644 formal_ineqs/arith/more_float.hl create mode 100644 formal_ineqs/arith/nat.hl create mode 100644 formal_ineqs/arith/num_exp_theory.hl create mode 100644 formal_ineqs/arith_options.hl create mode 100644 formal_ineqs/examples.hl create mode 100644 formal_ineqs/examples_flyspeck.hl create mode 100644 formal_ineqs/examples_poly.hl create mode 100644 formal_ineqs/informal/informal_arith.hl create mode 100644 formal_ineqs/informal/informal_eval_interval.hl create mode 100644 formal_ineqs/informal/informal_m_taylor.hl create mode 100644 formal_ineqs/informal/informal_m_verifier.hl create mode 100644 formal_ineqs/jordan/parse_ext_override_interface.hl create mode 100644 formal_ineqs/jordan/real_ext.hl create mode 100644 formal_ineqs/jordan/refinement.hl create mode 100644 formal_ineqs/jordan/taylor_atn.hl create mode 100644 formal_ineqs/lib/ssrbool-compiled.hl create mode 100644 formal_ineqs/lib/ssreflect/sections.hl create mode 100644 formal_ineqs/lib/ssreflect/ssreflect.hl create mode 100644 formal_ineqs/lib/ssrfun-compiled.hl create mode 100644 formal_ineqs/lib/ssrnat-compiled.hl create mode 100644 formal_ineqs/list/list_conversions.hl create mode 100644 formal_ineqs/list/list_float.hl create mode 100644 formal_ineqs/list/more_list.hl create mode 100644 formal_ineqs/misc/misc.hl create mode 100644 formal_ineqs/misc/vars.hl create mode 100644 formal_ineqs/taylor/m_taylor.hl create mode 100644 formal_ineqs/taylor/m_taylor_arith.hl create mode 100644 formal_ineqs/taylor/m_taylor_arith2.hl create mode 100644 formal_ineqs/taylor/theory/multivariate_taylor-compiled.hl create mode 100644 formal_ineqs/taylor/theory/taylor_interval-compiled.hl create mode 100644 formal_ineqs/verifier/interval_m/interval.ml create mode 100644 formal_ineqs/verifier/interval_m/line_interval.ml create mode 100644 formal_ineqs/verifier/interval_m/recurse.hl create mode 100644 formal_ineqs/verifier/interval_m/recurse.ml create mode 100644 formal_ineqs/verifier/interval_m/recurse0.ml create mode 100644 formal_ineqs/verifier/interval_m/report.ml create mode 100644 formal_ineqs/verifier/interval_m/taylor.ml create mode 100644 formal_ineqs/verifier/interval_m/types.ml create mode 100644 formal_ineqs/verifier/interval_m/univariate.ml create mode 100644 formal_ineqs/verifier/interval_m/verifier.hl create mode 100644 formal_ineqs/verifier/interval_m/verifier.ml create mode 100644 formal_ineqs/verifier/m_verifier.hl create mode 100644 formal_ineqs/verifier/m_verifier_build.hl create mode 100644 formal_ineqs/verifier/m_verifier_main.hl create mode 100644 formal_ineqs/verifier_options.hl create mode 100644 formal_lp/glpk/build_certificates.hl create mode 100644 formal_lp/glpk/build_main.hl create mode 100644 formal_lp/glpk/ex1/bb1_out.hl create mode 100644 formal_lp/glpk/ex2/bb2_1_out.hl create mode 100644 formal_lp/glpk/ex2/bb2_2_out.hl create mode 100644 formal_lp/glpk/ex2/bb2_3_out.hl create mode 100644 formal_lp/glpk/ex2/bb2_4_out.hl create mode 100644 formal_lp/glpk/ex2/bb2_5_out.hl create mode 100644 formal_lp/glpk/feasible.hl create mode 100644 formal_lp/glpk/lp_binary_certificate.hl create mode 100644 formal_lp/glpk/onepass.hl create mode 100644 formal_lp/glpk/test_hard.hl create mode 100644 formal_lp/hypermap/arith_link.hl create mode 100644 formal_lp/hypermap/computations/informal_computations.hl create mode 100644 formal_lp/hypermap/computations/list_conversions2.hl create mode 100644 formal_lp/hypermap/computations/list_hypermap_computations.hl create mode 100644 formal_lp/hypermap/computations/more_theory-compiled.hl create mode 100644 formal_lp/hypermap/ineqs/lp_approx_ineqs.hl create mode 100644 formal_lp/hypermap/ineqs/lp_body_ineqs.hl create mode 100644 formal_lp/hypermap/ineqs/lp_body_ineqs_data.hl create mode 100644 formal_lp/hypermap/ineqs/lp_gen_ineqs.hl create mode 100644 formal_lp/hypermap/ineqs/lp_gen_theory-compiled.hl create mode 100644 formal_lp/hypermap/ineqs/lp_head_ineqs.hl create mode 100644 formal_lp/hypermap/ineqs/lp_ineqs.hl create mode 100644 formal_lp/hypermap/ineqs/lp_ineqs_defs.hl create mode 100644 formal_lp/hypermap/ineqs/lp_ineqs_proofs-compiled.hl create mode 100644 formal_lp/hypermap/ineqs/lp_ineqs_proofs2-compiled.hl create mode 100644 formal_lp/hypermap/ineqs/lp_main_estimate-compiled.hl create mode 100644 formal_lp/hypermap/main/lp_certificate.hl create mode 100644 formal_lp/hypermap/main/prove_flyspeck_lp.hl create mode 100644 formal_lp/hypermap/main/test6.hl create mode 100644 formal_lp/hypermap/main/test_ex2_complete.hl create mode 100644 formal_lp/hypermap/main/test_hard.hl create mode 100644 formal_lp/hypermap/ssreflect/add_triangle-compiled.hl create mode 100644 formal_lp/hypermap/ssreflect/list_hypermap-compiled.hl create mode 100644 formal_lp/hypermap/ssreflect/list_hypermap_iso-compiled.hl create mode 100644 formal_lp/hypermap/tests/test_all_lists.hl create mode 100644 formal_lp/hypermap/verify_all.hl create mode 100644 formal_lp/ineqs/constants_approx.hl create mode 100644 formal_lp/ineqs/delta_ineq.hl create mode 100644 formal_lp/lp_example/out_test.hl create mode 100644 formal_lp/more_arith/arith_int.hl create mode 100644 formal_lp/more_arith/lin_f.hl create mode 100644 formal_lp/more_arith/prove_lp.hl create mode 100644 formal_lp/old/arith/arith_array.hl create mode 100644 formal_lp/old/arith/arith_cache.hl create mode 100644 formal_lp/old/arith/arith_hash.hl create mode 100644 formal_lp/old/arith/arith_hash2.hl create mode 100644 formal_lp/old/arith/arith_hash_int.hl create mode 100644 formal_lp/old/arith/arith_hash_rat.hl create mode 100644 formal_lp/old/arith/arith_options.hl create mode 100644 formal_lp/old/arith/float.hl create mode 100644 formal_lp/old/arith/float_atn.hl create mode 100644 formal_lp/old/arith/float_test.hl create mode 100644 formal_lp/old/arith/float_theory.hl create mode 100644 formal_lp/old/arith/informal/informal_arith.hl create mode 100644 formal_lp/old/arith/informal/informal_eval_interval.hl create mode 100644 formal_lp/old/arith/informal/informal_m_taylor.hl create mode 100644 formal_lp/old/arith/informal/informal_m_verifier.hl create mode 100644 formal_lp/old/arith/informal/tests1.hl create mode 100644 formal_lp/old/arith/informal/tests2.hl create mode 100644 formal_lp/old/arith/informal/tests3.hl create mode 100644 formal_lp/old/arith/informal/tests_poly.hl create mode 100644 formal_lp/old/arith/interval_arith.hl create mode 100644 formal_lp/old/arith/misc.hl create mode 100644 formal_lp/old/arith/nat.hl create mode 100644 formal_lp/old/arith/num_exp_theory.hl create mode 100644 formal_lp/old/arith/prove_lp.hl create mode 100644 formal_lp/old/arith/tests/arith_test_data10.hl create mode 100644 formal_lp/old/arith/tests/arith_test_data15.hl create mode 100644 formal_lp/old/arith/tests/arith_test_data18.hl create mode 100644 formal_lp/old/arith/tests/arith_test_data20.hl create mode 100644 formal_lp/old/arith/tests/arith_test_data25.hl create mode 100644 formal_lp/old/arith/tests/arith_test_data27.hl create mode 100644 formal_lp/old/arith/tests/arith_test_data5.hl create mode 100644 formal_lp/old/arith/tests/test_nat_arith.hl create mode 100644 formal_lp/old/formal_interval/eval_interval.hl create mode 100644 formal_lp/old/formal_interval/interval_1d/interval.hl create mode 100644 formal_lp/old/formal_interval/interval_1d/line_interval.hl create mode 100644 formal_lp/old/formal_interval/interval_1d/recurse.hl create mode 100644 formal_lp/old/formal_interval/interval_1d/report.hl create mode 100644 formal_lp/old/formal_interval/interval_1d/taylor.hl create mode 100644 formal_lp/old/formal_interval/interval_1d/test1d.hl create mode 100644 formal_lp/old/formal_interval/interval_1d/types.hl create mode 100644 formal_lp/old/formal_interval/interval_1d/univariate.hl create mode 100644 formal_lp/old/formal_interval/interval_m/function_data.hl create mode 100644 formal_lp/old/formal_interval/interval_m/interval.hl create mode 100644 formal_lp/old/formal_interval/interval_m/line_interval.hl create mode 100644 formal_lp/old/formal_interval/interval_m/recurse.hl create mode 100644 formal_lp/old/formal_interval/interval_m/recurse0.hl create mode 100644 formal_lp/old/formal_interval/interval_m/report.hl create mode 100644 formal_lp/old/formal_interval/interval_m/taylor.hl create mode 100644 formal_lp/old/formal_interval/interval_m/types.hl create mode 100644 formal_lp/old/formal_interval/interval_m/univariate.hl create mode 100644 formal_lp/old/formal_interval/interval_m/verifier.hl create mode 100644 formal_lp/old/formal_interval/lin_approx.hl create mode 100644 formal_lp/old/formal_interval/m_examples_poly.hl create mode 100644 formal_lp/old/formal_interval/m_taylor.hl create mode 100644 formal_lp/old/formal_interval/m_taylor_arith.hl create mode 100644 formal_lp/old/formal_interval/m_taylor_arith2.hl create mode 100644 formal_lp/old/formal_interval/m_taylor_old.hl create mode 100644 formal_lp/old/formal_interval/m_test.hl create mode 100644 formal_lp/old/formal_interval/m_tests.hl create mode 100644 formal_lp/old/formal_interval/m_tests2.hl create mode 100644 formal_lp/old/formal_interval/m_tests3.hl create mode 100644 formal_lp/old/formal_interval/m_tests4.hl create mode 100644 formal_lp/old/formal_interval/m_verifier.hl create mode 100644 formal_lp/old/formal_interval/m_verifier0.hl create mode 100644 formal_lp/old/formal_interval/more_float.hl create mode 100644 formal_lp/old/formal_interval/second_approx.hl create mode 100644 formal_lp/old/formal_interval/test.hl create mode 100644 formal_lp/old/formal_interval/test_taylor_arith.hl create mode 100644 formal_lp/old/formal_interval/tests_cmp.hl create mode 100644 formal_lp/old/formal_interval/theory/multivariate_taylor.hl create mode 100644 formal_lp/old/formal_interval/theory/taylor_interval.hl create mode 100644 formal_lp/old/formal_interval/verifier.hl create mode 100644 formal_lp/old/hypermap/constants_approx.hl create mode 100644 formal_lp/old/hypermap/contravening_ineqs.hl create mode 100644 formal_lp/old/hypermap/list_conversions.hl create mode 100644 formal_lp/old/hypermap/list_hypermap.hl create mode 100644 formal_lp/old/hypermap/list_hypermap_computations.hl create mode 100644 formal_lp/old/hypermap/list_hypermap_defs.hl create mode 100644 formal_lp/old/hypermap/list_hypermap_iso.hl create mode 100644 formal_lp/old/hypermap/nobranching_lp.hl create mode 100644 formal_lp/old/ineqs/contravening_ineqs.hl create mode 100644 formal_lp/old/ineqs/list_conversions.hl create mode 100644 formal_lp/old/ineqs/list_hypermap.hl create mode 100644 formal_lp/old/ineqs/list_hypermap_computations.hl create mode 100644 formal_lp/old/ineqs/list_hypermap_defs.hl create mode 100644 formal_lp/old/ineqs/list_hypermap_iso.hl create mode 100644 formal_lp/old/ineqs/list_hypermap_vars.hl create mode 100644 formal_lp/old/ineqs/nobranching_lp.hl create mode 100644 formal_lp/old/ineqs/tests/149438122187_out.hl create mode 100644 formal_lp/old/ineqs/tests/156588677070_out.hl create mode 100644 formal_lp/old/ineqs/tests/168941837467_out.hl create mode 100644 formal_lp/old/ineqs/tests/176747399778_out.hl create mode 100644 formal_lp/old/ineqs/tests/196565289721_out.hl create mode 100644 formal_lp/old/ineqs/tests/202328731904_out.hl create mode 100644 formal_lp/old/ineqs/tests/204898223616_out.hl create mode 100644 formal_lp/old/ineqs/tests/206221606034_out.hl create mode 100644 formal_lp/old/ineqs/tests/209986500083_out.hl create mode 100644 formal_lp/old/ineqs/tests/234860659776_out.hl create mode 100644 formal_lp/old/ineqs/tests/241242841715_out.hl create mode 100644 formal_lp/old/ineqs/tests/241966209046_out.hl create mode 100644 formal_lp/old/ineqs/tests/28820130324_out.hl create mode 100644 formal_lp/old/ineqs/tests/62059307362_out.hl create mode 100644 formal_lp/old/ineqs/tests/63917576180_out.hl create mode 100644 formal_lp/old/ineqs/tests/72977109430_out.hl create mode 100644 formal_lp/old/ineqs/tests/75655754509_out.hl create mode 100644 formal_lp/old/ineqs/tests/86324340346_out.hl create mode 100644 formal_lp/old/ineqs/tests/95170601659_out.hl create mode 100644 formal_lp/old/ineqs/tests/97685954266_out.hl create mode 100644 formal_lp/old/ineqs/tests/all.hl create mode 100644 formal_lp/old/ineqs/tests/all_tests.hl create mode 100644 formal_lp/old/ineqs/tests2/118343205068_out.hl create mode 100644 formal_lp/old/ineqs/tests2/118760185161_out.hl create mode 100644 formal_lp/old/ineqs/tests2/119040238600_out.hl create mode 100644 formal_lp/old/ineqs/tests2/122526068934_out.hl create mode 100644 formal_lp/old/ineqs/tests2/123040027899_out.hl create mode 100644 formal_lp/old/ineqs/tests2/125719999821_out.hl create mode 100644 formal_lp/old/ineqs/tests2/147671934133_out.hl create mode 100644 formal_lp/old/ineqs/tests2/156401568298_out.hl create mode 100644 formal_lp/old/ineqs/tests2/156615503428_out.hl create mode 100644 formal_lp/old/ineqs/tests2/158856256118_out.hl create mode 100644 formal_lp/old/ineqs/tests2/165950391005_out.hl create mode 100644 formal_lp/old/ineqs/tests2/168156828154_out.hl create mode 100644 formal_lp/old/ineqs/tests2/17272290668_out.hl create mode 100644 formal_lp/old/ineqs/tests2/195482381558_out.hl create mode 100644 formal_lp/old/ineqs/tests2/196021155893_out.hl create mode 100644 formal_lp/old/ineqs/tests2/206084941231_out.hl create mode 100644 formal_lp/old/ineqs/tests2/211626865969_out.hl create mode 100644 formal_lp/old/ineqs/tests2/219955817888_out.hl create mode 100644 formal_lp/old/ineqs/tests2/245859035526_out.hl create mode 100644 formal_lp/old/ineqs/tests2/25168582633_out.hl create mode 100644 formal_lp/old/ineqs/tests2/30500231120_out.hl create mode 100644 formal_lp/old/ineqs/tests2/4436579732_out.hl create mode 100644 formal_lp/old/ineqs/tests2/63626063287_out.hl create mode 100644 formal_lp/old/ineqs/tests2/69964410750_out.hl create mode 100644 formal_lp/old/ineqs/tests2/74394196986_out.hl create mode 100644 formal_lp/old/ineqs/tests2/91057093091_out.hl create mode 100644 formal_lp/old/ineqs/tests2/945145744_out.hl create mode 100644 formal_lp/old/ineqs/tests2/all_tests.hl create mode 100644 formal_lp/old/list/list_conversions.hl create mode 100644 formal_lp/old/list/list_float.hl create mode 100644 glpk/glpk_link.ml create mode 100644 glpk/minorlp/OXLZLEZ.ml create mode 100644 glpk/minorlp/tame_table.ml create mode 100644 glpk/sphere.ml create mode 100644 glpk/tame_archive/build_lp.hl create mode 100644 glpk/tame_archive/hard_lp.ml create mode 100644 glpk/tame_archive/lpproc.ml create mode 100644 glpk/tame_archive/scaffolding.hl create mode 100644 graph_generator/graph_control.hl create mode 100644 jHOLLight/Examples/group_sylow-compiled.hl create mode 100644 jHOLLight/Examples/seq-compiled.hl create mode 100644 jHOLLight/Examples/ssrbool-compiled.hl create mode 100644 jHOLLight/Examples/ssrfun-compiled.hl create mode 100644 jHOLLight/Examples/ssrnat-compiled.hl create mode 100644 jHOLLight/JHOL.app/Contents/Resources/Java/newprinter.ml create mode 100644 jHOLLight/caml/raw_printer.hl create mode 100644 jHOLLight/caml/sections.hl create mode 100644 jHOLLight/caml/ssreflect.hl create mode 100644 kepler_tex/tikz/tikz.ml create mode 100644 legacy/general/database_more.ml create mode 100644 legacy/general/deprecated_sphere.hl create mode 100644 legacy/glpk/glpk/glpk_def.hl create mode 100644 legacy/glpk/glpk/mkineq.ml create mode 100644 legacy/glpk/glpk/tame_archive_hard_notes.hl create mode 100644 legacy/inequalities/definitions_kepler.ml create mode 100644 legacy/inequalities/definitions_keplerC.ml create mode 100644 legacy/inequalities/dodec_ineq_names.ml create mode 100644 legacy/inequalities/dodec_inequalities.ml create mode 100644 legacy/inequalities/generate-ineq-syntax.ml create mode 100644 legacy/inequalities/inequality_spec.ml create mode 100644 legacy/inequalities/kep_deprecated.ml create mode 100644 legacy/inequalities/kep_ineq_bis.ml create mode 100644 legacy/inequalities/kep_inequalities.ml create mode 100644 legacy/inequalities/kep_inequalities2.ml create mode 100644 legacy/inequalities/kepler_ineq_names.ml create mode 100644 legacy/inequalities/ocaml_to_sml.ml create mode 100644 legacy/inequalities/sigmahat.hl create mode 100644 legacy/inequalities/sphere.ml create mode 100644 legacy/linear_program/LinProg.ml create mode 100644 legacy/load_def_kepler.ml create mode 100644 legacy/oldfan/Conforming2.hl create mode 100755 legacy/oldfan/DHVFGBC.hl create mode 100755 legacy/oldfan/DWWUTKW.hl create mode 100755 legacy/oldfan/IBZWFFH.hl create mode 100755 legacy/oldfan/JBDNJJB.hl create mode 100755 legacy/oldfan/JGIYDLE.hl create mode 100755 legacy/oldfan/JUTSTKG.hl create mode 100755 legacy/oldfan/LEMMA.hl create mode 100755 legacy/oldfan/RWXUYZZ.hl create mode 100644 legacy/oldfan/TACTIC.hl create mode 100755 legacy/oldfan/ULEKUUB.hl create mode 100755 legacy/oldfan/VBTIKLP.hl create mode 100644 legacy/oldfan/ch_fan/FAN_DEF.ml create mode 100644 legacy/oldfan/ch_fan/fan_definition.hl create mode 100644 legacy/oldfan/ch_fan/fan_definition2.hl create mode 100644 legacy/oldfan/ch_fan/fan_summary.hl create mode 100755 legacy/oldfan/definition_fan.hl create mode 100644 legacy/oldfan/fan_concl.hl create mode 100644 legacy/oldfan/fantopology.ml create mode 100755 legacy/oldfan/fully_surrounded.hl create mode 100755 legacy/oldfan/hypermap_of_fan.hl create mode 100755 legacy/oldfan/introduction1.hl create mode 100755 legacy/oldfan/leads_into.hl create mode 100755 legacy/oldfan/node_fan.hl create mode 100644 legacy/oldhypermap/ch_hypermap/hypermap_summary.hl create mode 100644 legacy/oldleg/assembly.ml create mode 100644 legacy/oldleg/collect_geom.ml create mode 100644 legacy/oldleg/collect_geom_a.ml create mode 100644 legacy/oldleg/collect_geom_error.ml create mode 100644 legacy/oldleg/collect_geom_spec.ml create mode 100644 legacy/oldleg/geomdetail.ml create mode 100644 legacy/oldleg/geomdetail_08.ml create mode 100644 legacy/oldleg/hull.ml create mode 100644 legacy/oldleg/hull_error.ml create mode 100644 legacy/oldlocal/PQCSXWG_old.hl create mode 100644 legacy/oldlocal/XBJRPHC.hl create mode 100644 legacy/oldlocal/ch_local/CKQOWSA.hl create mode 100644 legacy/oldlocal/ch_local/cyclic_definition.hl create mode 100644 legacy/oldlocal/ch_local/local_defs.hl create mode 100644 legacy/oldlocal/ch_local/local_defs2.hl create mode 100644 legacy/oldlocal/ch_local/local_fan.ml create mode 100644 legacy/oldlocal/nguyenquangtruong270983/JBDNJJB.hl create mode 100644 legacy/oldlocal/nguyenquangtruong270983/WRGCVDR_CIZMRRH.hl create mode 100644 legacy/oldnonlinear/cutlemmas.hl create mode 100644 legacy/oldnonlinear/deprecated_main_estimate_ineq.hl create mode 100644 legacy/oldnonlinear/mdtau.hl create mode 100644 legacy/oldnonlinear/nonlinear/break_quad_jul2013.hl create mode 100644 legacy/oldnonlinear/nonlinear/experiments/oracle.hl create mode 100644 legacy/oldnonlinear/nonlinear/experiments/test.hl create mode 100644 legacy/oldnonlinear/nonlinear/experiments/test_may_2012.hl create mode 100644 legacy/oldnonlinear/nonlinear/experiments/zumkeller_test.hl create mode 100644 legacy/oldnonlinear/nonlinear/fejestoth12.hl create mode 100644 legacy/oldnonlinear/nonlinear/ineq_cell23.hl create mode 100644 legacy/oldnonlinear/nonlinear/main_estimate_pent_hex_cut_may_2013.hl create mode 100644 legacy/oldnonlinear/nonlinear/main_ineq_calcs.ml create mode 100644 legacy/oldnonlinear/nonlinear/partials.hl create mode 100644 legacy/oldnonlinear/nonlinear/temp_ineq.hl create mode 100644 legacy/oldnonlinear/nonlinear/test_ineq.hl create mode 100644 legacy/oldnonlinear/nonlinear/test_jun2012_ZTG_series.hl create mode 100644 legacy/oldnonlinear/nonlinear/test_may2013_terminal_pent_hex_series.hl create mode 100644 legacy/oldnonlinear/nonlinear/text_interface.hl create mode 100644 legacy/oldnonlinear/post.hl create mode 100644 legacy/oldnonlinear/removedef.hl create mode 100644 legacy/oldpacking/BBDTRGC_def.hl create mode 100644 legacy/oldpacking/DRUQUFE.hl create mode 100644 legacy/oldpacking/IDBEZAL.hl create mode 100644 legacy/oldpacking/JJGTQMN_def.hl create mode 100644 legacy/oldpacking/JNRJQSM_def.hl create mode 100644 legacy/oldpacking/KHEJKCI.hl create mode 100644 legacy/oldpacking/NOPZSEH_def.hl create mode 100644 legacy/oldpacking/PHZVPFY_def.hl create mode 100644 legacy/oldpacking/RHWVGNP.hl create mode 100644 legacy/oldpacking/TIWWFYQ.hl create mode 100644 legacy/oldpacking/ch_packing/TSKAJXY.hl create mode 100644 legacy/oldpacking/ch_packing/oxl_lemma.hl create mode 100644 legacy/oldpacking/ky_packing/EMNWUUS.hl create mode 100644 legacy/oldpacking/ky_packing/UPFZBZM.hl create mode 100644 legacy/oldpacking/ky_packing/UPFZBZM_axioms.hl create mode 100644 legacy/oldpacking/ky_packing/UPFZBZM_support_lemmas.hl create mode 100644 legacy/oldpacking/ky_packing/UPFZBZM_working.hl create mode 100644 legacy/oldpacking/ky_packing/marchal_cells.hl create mode 100644 legacy/oldpacking/packing/development/Backup/GRUTOTI.hl create mode 100644 legacy/oldpacking/packing/development/Backup/KIZHLTL.hl create mode 100644 legacy/oldpacking/packing/development/Backup/RDWKARC.hl create mode 100644 legacy/oldpacking/packing/development/Backup/UPFZBZM.hl create mode 100644 legacy/oldpacking/packing/development/Backup/load_sequence.hl create mode 100644 legacy/oldpacking/packing/development/Backup/marchal_cells_3.hl create mode 100644 legacy/oldpacking/packing/development/Backup/sum_gammaX_lmfun_estimate.hl create mode 100644 legacy/oldpacking/packing/development/REUHADY.hl create mode 100644 legacy/oldpacking/packing/development/TSKAJXY.hl create mode 100755 legacy/oldpacking/packing/development/marchal_cells_2.hl create mode 100755 legacy/oldpacking/packing/development/sum_beta_bump.hl create mode 100644 legacy/oldpacking/packing/development/working.hl create mode 100644 legacy/oldtame/UBHDEUU.hl create mode 100644 legacy/oldtame/dangtatdatusb/DLWCHEM.hl create mode 100644 legacy/oldtame/dangtatdatusb/UBHDEUU.hl create mode 100644 legacy/oldtame/pishort.hl create mode 100644 legacy/oldtame/quarantine/SZIPOAS.hl create mode 100755 legacy/oldtrig/run_file_euler.ml create mode 100644 legacy/oldtrig/trig_old.ml create mode 100644 legacy/oldvolume/ch_volume/vol2.hl create mode 100644 legacy/oldvolume/ch_volume/volume.hl create mode 100644 legacy/oldvolume/ch_volume/volume_temp.hl create mode 100644 legacy/toplevel.ml create mode 100644 make.ml create mode 100644 port_interval/compose.hl create mode 100644 port_interval/function_data.hl create mode 100644 port_interval/interval.hl create mode 100644 port_interval/line_interval.hl create mode 100644 port_interval/recurse.hl create mode 100644 port_interval/report.hl create mode 100644 port_interval/taylor.hl create mode 100644 port_interval/types.hl create mode 100644 port_interval/univariate.hl create mode 100644 projects_discrete_geom/bcc_lattice.hl create mode 100644 projects_discrete_geom/bezdek_reid/bezdek_reid.hl create mode 100644 projects_discrete_geom/fejestoth12/defs.hl create mode 100644 projects_discrete_geom/fejestoth12/lipstick_ft.ml create mode 100644 projects_discrete_geom/strong_dodec_conj/strongdodec_ineq.hl create mode 100644 tame_archive/tame_archive.hl create mode 100644 text_formalization/boot.hl create mode 100644 text_formalization/boot.ml create mode 100644 text_formalization/build.hl create mode 100644 text_formalization/computational_build.hl create mode 100644 text_formalization/fan/CFYXFTY.hl create mode 100755 text_formalization/fan/Conforming.hl create mode 100644 text_formalization/fan/GMLWKPK.hl create mode 100644 text_formalization/fan/HypermapAndFan.hl create mode 100644 text_formalization/fan/fan_defs.hl create mode 100644 text_formalization/fan/fan_misc.hl create mode 100644 text_formalization/fan/hypermap_iso-compiled.hl create mode 100755 text_formalization/fan/introduction.hl create mode 100755 text_formalization/fan/planarity.hl create mode 100644 text_formalization/fan/polyhedron.hl create mode 100755 text_formalization/fan/topology.hl create mode 100644 text_formalization/general/debug.hl create mode 100644 text_formalization/general/flyspeck_lib.hl create mode 100644 text_formalization/general/hol_pervasives.hl create mode 100644 text_formalization/general/lib.hl create mode 100644 text_formalization/general/package_constant.hl create mode 100644 text_formalization/general/parser_verbose.hl create mode 100644 text_formalization/general/print_types.hl create mode 100644 text_formalization/general/prove_by_refinement.hl create mode 100644 text_formalization/general/sphere.hl create mode 100644 text_formalization/general/state_manager.hl create mode 100644 text_formalization/general/tactics.hl create mode 100644 text_formalization/general/update_database_310.ml create mode 100644 text_formalization/general/update_database_400.ml create mode 100644 text_formalization/hypermap/bauer_nipkow.hl create mode 100644 text_formalization/hypermap/hypermap.hl create mode 100644 text_formalization/hypermap/summary.hl create mode 100644 text_formalization/jordan/compute_pi.hl create mode 100644 text_formalization/jordan/float.hl create mode 100644 text_formalization/jordan/float_example.hl create mode 100644 text_formalization/jordan/flyspeck_constants.hl create mode 100644 text_formalization/jordan/goal_printer.hl create mode 100644 text_formalization/jordan/hash_term.hl create mode 100644 text_formalization/jordan/lib_ext.hl create mode 100644 text_formalization/jordan/make.hl create mode 100644 text_formalization/jordan/misc_defs_and_lemmas.hl create mode 100644 text_formalization/jordan/num_ext_gcd.hl create mode 100644 text_formalization/jordan/num_ext_nabs.hl create mode 100644 text_formalization/jordan/parse_ext_override_interface.hl create mode 100644 text_formalization/jordan/real_ext.hl create mode 100644 text_formalization/jordan/real_ext_geom_series.hl create mode 100644 text_formalization/jordan/refinement.hl create mode 100644 text_formalization/jordan/tactics_jordan.hl create mode 100644 text_formalization/jordan/taylor_atn.hl create mode 100644 text_formalization/leg/AFF_SGN_TAC.hl create mode 100644 text_formalization/leg/abc_of_quadratic_def.hl create mode 100644 text_formalization/leg/affprops.hl create mode 100644 text_formalization/leg/basics.hl create mode 100644 text_formalization/leg/cayleyR_def.hl create mode 100644 text_formalization/leg/collect_geom.hl create mode 100644 text_formalization/leg/collect_geom2.hl create mode 100644 text_formalization/leg/enclosed_def.hl create mode 100644 text_formalization/leg/geomdetail.hl create mode 100644 text_formalization/leg/muR_def.hl create mode 100644 text_formalization/leg/quadratic_root_plus_def.hl create mode 100644 text_formalization/local/ARDBZYE.hl create mode 100644 text_formalization/local/AUEAHEH.hl create mode 100644 text_formalization/local/AURSIPD.hl create mode 100644 text_formalization/local/AXJRPNC.hl create mode 100755 text_formalization/local/AYQJTMD.hl create mode 100644 text_formalization/local/BKOSSGE.hl create mode 100644 text_formalization/local/CNICGSF.hl create mode 100644 text_formalization/local/CQAOQLR.hl create mode 100644 text_formalization/local/CUXVZOZ.hl create mode 100755 text_formalization/local/EYYPQDW.hl create mode 100644 text_formalization/local/FEKTYIY.hl create mode 100755 text_formalization/local/GBYCPXS.hl create mode 100755 text_formalization/local/HDPLYGY.hl create mode 100644 text_formalization/local/HIJQAHA.hl create mode 100755 text_formalization/local/HXHYTIJ.hl create mode 100755 text_formalization/local/IMJXPHR.hl create mode 100644 text_formalization/local/IUNBUIG.hl create mode 100644 text_formalization/local/JCYFMRP.hl create mode 100644 text_formalization/local/JEJTVGB.hl create mode 100755 text_formalization/local/JKQEWGV.hl create mode 100644 text_formalization/local/JLXFDMJ.hl create mode 100644 text_formalization/local/JOTSWIX.hl create mode 100644 text_formalization/local/LDURDPN.hl create mode 100644 text_formalization/local/LFJCIXP.hl create mode 100755 text_formalization/local/LKGRQUI.hl create mode 100644 text_formalization/local/LOCAL_LEMMAS.hl create mode 100644 text_formalization/local/LVDUCXU.hl create mode 100644 text_formalization/local/MIQMCSN.hl create mode 100755 text_formalization/local/MTUWLUN.hl create mode 100644 text_formalization/local/NKEZBFC.hl create mode 100644 text_formalization/local/NUXCOEA.hl create mode 100644 text_formalization/local/OCBICBY.hl create mode 100755 text_formalization/local/ODXLSTCv2.hl create mode 100644 text_formalization/local/OTMTOTJ.hl create mode 100644 text_formalization/local/PCRTTID.hl create mode 100644 text_formalization/local/PPBTYDQ.hl create mode 100644 text_formalization/local/PQCSXWG.hl create mode 100755 text_formalization/local/QKNVMLB.hl create mode 100644 text_formalization/local/RNSYJXM-compiled.hl create mode 100644 text_formalization/local/RRCWNSJ.hl create mode 100755 text_formalization/local/SGTRNAF.hl create mode 100644 text_formalization/local/TECOXBM.hl create mode 100644 text_formalization/local/TFITSKC.hl create mode 100755 text_formalization/local/UAGHHBM.hl create mode 100755 text_formalization/local/UXCKFPE.hl create mode 100644 text_formalization/local/VASYYAU.hl create mode 100644 text_formalization/local/VPWSHTO.hl create mode 100755 text_formalization/local/WJSCPRO.hl create mode 100644 text_formalization/local/WKEIDFT.hl create mode 100644 text_formalization/local/WRGCVDR_CIZMRRH.hl create mode 100644 text_formalization/local/XIVPHKS.hl create mode 100755 text_formalization/local/XWITCCN.hl create mode 100644 text_formalization/local/YRTAFYH.hl create mode 100755 text_formalization/local/YXIONXL.hl create mode 100755 text_formalization/local/YXIONXL2.hl create mode 100644 text_formalization/local/ZITHLQN.hl create mode 100644 text_formalization/local/ZLZTHIC.hl create mode 100644 text_formalization/local/appendix_main_estimate.hl create mode 100644 text_formalization/local/deformation.hl create mode 100755 text_formalization/local/dih2k.hl create mode 100644 text_formalization/local/hexagons.hl create mode 100644 text_formalization/local/local_lemmas1.hl create mode 100644 text_formalization/local/localization.hl create mode 100644 text_formalization/local/lp_details.hl create mode 100644 text_formalization/local/lunar_deform.hl create mode 100644 text_formalization/local/pent_hex.hl create mode 100644 text_formalization/local/polar_fan.hl create mode 100644 text_formalization/local/terminal.hl create mode 100644 text_formalization/nonlinear/auto_lib.hl create mode 100644 text_formalization/nonlinear/break_case_exec.hl create mode 100644 text_formalization/nonlinear/break_case_log.hl create mode 100644 text_formalization/nonlinear/calc_derivative.hl create mode 100644 text_formalization/nonlinear/check_completeness.hl create mode 100644 text_formalization/nonlinear/cleanDeriv.hl create mode 100644 text_formalization/nonlinear/cleanDeriv_examples.hl create mode 100644 text_formalization/nonlinear/compute_2158872499.hl create mode 100644 text_formalization/nonlinear/formal_tests/hminus.hl create mode 100644 text_formalization/nonlinear/formal_tests/ineq_ids.hl create mode 100644 text_formalization/nonlinear/formal_tests/load.hl create mode 100644 text_formalization/nonlinear/formal_tests/test1.hl create mode 100644 text_formalization/nonlinear/formal_tests/test2.hl create mode 100644 text_formalization/nonlinear/function_list.hl create mode 100644 text_formalization/nonlinear/functional_equation.hl create mode 100644 text_formalization/nonlinear/ineq.hl create mode 100644 text_formalization/nonlinear/ineqdata3q1h.hl create mode 100644 text_formalization/nonlinear/lemma.hl create mode 100644 text_formalization/nonlinear/main_estimate_ineq.hl create mode 100644 text_formalization/nonlinear/merge_ineq.hl create mode 100644 text_formalization/nonlinear/mk_all_ineq.hl create mode 100644 text_formalization/nonlinear/nonlin_def.hl create mode 100644 text_formalization/nonlinear/optimize.hl create mode 100644 text_formalization/nonlinear/parse_ineq.hl create mode 100755 text_formalization/nonlinear/prep.hl create mode 100644 text_formalization/nonlinear/scripts.hl create mode 100644 text_formalization/nonlinear/sharp.hl create mode 100644 text_formalization/nonlinear/types.hl create mode 100644 text_formalization/nonlinear/vukhacky_tactics.hl create mode 100755 text_formalization/packing/AJRIPQN.hl create mode 100755 text_formalization/packing/DDZUPHJ.hl create mode 100755 text_formalization/packing/EMNWUUS.hl create mode 100755 text_formalization/packing/GRUTOTI.hl create mode 100755 text_formalization/packing/HDTFNFZ.hl create mode 100755 text_formalization/packing/KIZHLTL.hl create mode 100755 text_formalization/packing/LEPJBDJ.hl create mode 100755 text_formalization/packing/NJIUTIU.hl create mode 100644 text_formalization/packing/OXLZLEZ.hl create mode 100644 text_formalization/packing/OXL_def.hl create mode 100755 text_formalization/packing/QZKSYKG.hl create mode 100644 text_formalization/packing/QZYZMJC.hl create mode 100755 text_formalization/packing/RDWKARC.hl create mode 100644 text_formalization/packing/REUHADY.hl create mode 100755 text_formalization/packing/RVFXZBU.hl create mode 100644 text_formalization/packing/Rogers.hl create mode 100755 text_formalization/packing/SLTSTLO.hl create mode 100644 text_formalization/packing/TARJJUW.hl create mode 100755 text_formalization/packing/TEZFFSK.hl create mode 100644 text_formalization/packing/TSKAJXY.hl create mode 100644 text_formalization/packing/TSKAJXY_034.hl create mode 100644 text_formalization/packing/TSKAJXY_lemmas.hl create mode 100755 text_formalization/packing/UPFZBZM.hl create mode 100755 text_formalization/packing/UPFZBZM_support_lemmas.hl create mode 100644 text_formalization/packing/URRPHBZ1.hl create mode 100755 text_formalization/packing/URRPHBZ2.hl create mode 100755 text_formalization/packing/URRPHBZ3.hl create mode 100755 text_formalization/packing/YNHYJIT.hl create mode 100644 text_formalization/packing/YSSKQOY.hl create mode 100644 text_formalization/packing/bump.hl create mode 100644 text_formalization/packing/counting_spheres.hl create mode 100644 text_formalization/packing/leaf_cell.hl create mode 100755 text_formalization/packing/marchal_cells.hl create mode 100755 text_formalization/packing/marchal_cells_2_new.hl create mode 100755 text_formalization/packing/marchal_cells_3.hl create mode 100644 text_formalization/packing/oxl_2012.hl create mode 100644 text_formalization/packing/pack1.hl create mode 100644 text_formalization/packing/pack2.hl create mode 100644 text_formalization/packing/pack3.hl create mode 100644 text_formalization/packing/pack_concl.hl create mode 100644 text_formalization/packing/pack_defs.hl create mode 100755 text_formalization/packing/sum_gammaX_lmfun_estimate.hl create mode 100644 text_formalization/strictbuild.hl create mode 100644 text_formalization/tame/ArcProperties.hl create mode 100644 text_formalization/tame/CDTETAT.hl create mode 100644 text_formalization/tame/CKQOWSA.hl create mode 100644 text_formalization/tame/CKQOWSA_3.hl create mode 100644 text_formalization/tame/CKQOWSA_4.hl create mode 100644 text_formalization/tame/CRTTXAT.hl create mode 100755 text_formalization/tame/FATUGPD.hl create mode 100644 text_formalization/tame/HRXEFDM.hl create mode 100644 text_formalization/tame/Inequalities.hl create mode 100644 text_formalization/tame/JGTDEBU.hl create mode 100644 text_formalization/tame/TameGeneral.hl create mode 100644 text_formalization/tame/dont_repeat_yourself.hl create mode 100644 text_formalization/tame/ssreflect/FNJLBXS-compiled.hl create mode 100644 text_formalization/tame/ssreflect/KCBLRQC-compiled.hl create mode 100644 text_formalization/tame/ssreflect/MQMSMAB-compiled.hl create mode 100644 text_formalization/tame/ssreflect/seq2-compiled.hl create mode 100644 text_formalization/tame/ssreflect/sort-compiled.hl create mode 100644 text_formalization/tame/ssreflect/tame_lemmas-compiled.hl create mode 100644 text_formalization/tame/tame_concl.hl create mode 100644 text_formalization/tame/tame_defs.hl create mode 100644 text_formalization/tame/tame_opposite.hl create mode 100644 text_formalization/trigonometry/HVIHVEC.hl create mode 100755 text_formalization/trigonometry/delta_x.hl create mode 100755 text_formalization/trigonometry/euler_complement.hl create mode 100755 text_formalization/trigonometry/euler_main_theorem.hl create mode 100755 text_formalization/trigonometry/euler_multivariate.hl create mode 100644 text_formalization/trigonometry/trig1.hl create mode 100644 text_formalization/trigonometry/trig2.hl create mode 100644 text_formalization/trigonometry/trigonometry.hl create mode 100644 text_formalization/usr/thales/hales_tactic.hl create mode 100644 text_formalization/usr/thales/init_search.hl create mode 100644 text_formalization/usr/thales/searching.hl create mode 100644 text_formalization/volume/vol1.hl diff --git a/development/thales/chaff/august9_2011_session.hl b/development/thales/chaff/august9_2011_session.hl new file mode 100644 index 0000000..e730323 --- /dev/null +++ b/development/thales/chaff/august9_2011_session.hl @@ -0,0 +1,105 @@ +(* Code from Carnegie Library Session with + Tom Hales and Nick Volker, August 9, 2011 + +*) + + +Trigonometry1.ATN2_BREAKDOWN;; + +(* modify Calc_derivative module to remove signature, + reload, then open *) + +open Calc_derivative;; + + +let test_aug9_2011 = prove_by_refinement( + `!x. (x > &0) ==> (?eps. abs(x - eps) > &0)`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; +EXISTS_TAC `x / &2`; +ASM_REAL_ARITH_TAC + ]);; + (* }}} *) + +let derived_imp_pos_open = prove_by_refinement( + `!p f f' x s. p /\ derived_form p f f' x s /\ &0 < f x ==> + (?d. &0 < d /\ (!x'. x' IN s /\ abs (x' - x) < d ==> &0 < f x'))`, + (* {{{ proof *) + [ +REWRITE_TAC[Calc_derivative.derived_form]; +REWRITE_TAC[TAUT `(a /\ (a ==> b) /\ c) <=> (a /\ b /\ c)`]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o ( MATCH_MP HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_WITHINREAL )); +REWRITE_TAC[real_continuous_withinreal]; +DISCH_THEN (MP_TAC o (SPEC `(f:real->real) x`)); +ASM_REWRITE_TAC[]; +STRIP_TAC; +EXISTS_TAC `d:real`; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC `x':real`)); +ASM_REWRITE_TAC[]; +ASM_REAL_ARITH_TAC; + ]);; + (* }}} *) + + +let derived_form_chain_simple = prove_by_refinement( + `!x s g g' f f' p p'. + derived_form p g g' (f x) (:real) /\ + derived_form p' f f' x s + ==> derived_form (p /\ p') (\x. g (f x)) (f' * g') x s`, + (* {{{ proof *) + [ + MESON_TAC[derived_form_chain] + ]);; + (* }}} *) + +let atn2_lemma = prove_by_refinement( + `!x pf f f' pg g g' s. (&0 < f x) /\ derived_form pf f f' x s /\ derived_form pg g g' x s ==> derived_form (T /\ (pg /\ pf)) (\x. atn( g x / f x)) ((g' * f x - g x * f')/(f x pow 2) *inv (&1 + (g x / f x) pow 2)) x s`, + (* {{{ proof *) + [ +REPEAT STRIP_TAC; +MATCH_MP_TAC derived_form_chain_simple; +REWRITE_TAC[derived_form_atn]; +MP_TAC (REAL_ARITH `&0 < (f:real->real) x ==> ~(f x = &0)`); +SUBGOAL_THEN `derived_form (pg /\ pf /\ ~(f x = &0)) (\x. g x / f x) ((g' * f x - g x * f') / f x pow 2) x s` MP_TAC; +MATCH_MP_TAC derived_form_div; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[derived_form]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[] + ]);; + (* }}} *) + + +(* UNFINISHED +let atn2_derived_form_pos = prove_by_refinement( + `!x pf f f' pg g g' s. (&0 < f x) /\ derived_form pf f f' x s /\ derived_form pg g g' x s ==> derived_form (pf /\ pg) (\x. atn( g x / f x)) ((g' * f x - g x * f')*inv (f x pow 2 + g x pow 2)) x s`, + (* {{{ proof *) + [ +REPEAT STRIP_TAC +UNDISCH_TAC `pf ==> (f has_real_derivative f') (atreal x within s)` +UNDISCH_TAC `pg ==> (g has_real_derivative g') (atreal x within s)` +ASM_REWRITE_TAC[] +REPEAT STRIP_TAC + ]);; + (* }}} *) + +*) + +(* UNFINISHED +let atn2_atn_open = prove_by_refinement( + `!p f f' g x s. p /\ derived_form p f f' x s /\ (&0 < f x)==> + (?d. &0 < d /\ (!x'. x' IN s /\ abs (x' - x) < d ==> + atn2 (f x', g x') = atn(g x' / f x')))`, + (* {{{ proof *) + [ +REPEAT GEN_TAC; + DISCH_THEN (MP_TAC o (MATCH_MP derived_imp_pos_open)) + ]);; + (* }}} *) +*) + diff --git a/development/thales/chaff/external_arith.hl b/development/thales/chaff/external_arith.hl new file mode 100644 index 0000000..d0d71db --- /dev/null +++ b/development/thales/chaff/external_arith.hl @@ -0,0 +1,119 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* External Rational Number Operations *) +(* Author: Thomas C. Hales *) +(* Date: 2010-09-17 *) +(* ========================================================================== *) + + +type mixed_term = + | Ocaml_num of num + | Ocaml_real of num + | Hol_light of bool*term;; (* true if changed *) + +(* +type num = +| Int of int +| Big_int of Big_int.big_int +| Ratio of Ratio.ratio ///;; + +let internalize_bool = function + | true -> `T` + | false -> `F`;; +*) + +let realize = + let amp = `real_of_num` in + fun x -> mk_comb (amp,x);; + +let real_of_rat = + let real_div = `real_div` in + let quot n d = mk_binop real_div (realize n) (realize d) in + fun x -> + let n = mk_numeral(Big_int (Ratio.numerator_ratio x)) in + let d = mk_numeral(Big_int (Ratio.denominator_ratio x)) in + quot n d;; + +let term_of_mixed = + function + | Ocaml_real a -> + (match a with + | Big_int _ -> realize(mk_numeral a) + | Int x -> realize (mk_small_numeral x) + | Ratio x -> real_of_rat x) + | Ocaml_num a -> + (match a with + | Big_int _ ->(mk_numeral a) + | Int x -> (mk_small_numeral x) + | Ratio _ -> failwith "unnatural quotient") + | Hol_light (changed,t) -> t;; + +let dest_binop_from oplist t = + let (h,y)= dest_comb t in + let (op,x) = dest_comb h in + if (mem op oplist) then (op,x,y) else failwith "op not found";; + +let zero = Int 0;; + +let one = Int 1;; + +let num_trunc_minus x y = if ( y >/ x) then zero else x -/ y;; + +let rat_div x y = if (y =/ zero) then zero else (x // y);; + +let rat_inv x = if (x =/ zero) then zero else (one // x);; + +let mk_cty ty = map (fun (a,b)-> (mk_mconst(a,ty),b));; + +(* +let real_rels = mk_cty `:real->real->bool` + ["real_lt";"real_le";"=";"real_ge";"real_gt"];; + +let num_rels = mk_cty `:num->num->bool` + ["<=";"<";"=";">=";">="];; +*) + +let real_binop = mk_cty `:real->real->real` + [("real_add",( +/ ));("real_sub", ( -/ ));("real_mul", ( */ ));("real_div",rat_div)];; + +let num_binop = mk_cty `:num->num->num` + [("+",( +/ ));("-",num_trunc_minus);("*", ( */ ))];; + +let dec_op = mk_cty `:num->num->real` + [("DECIMAL",( // ))];; + +let numeral_op = mk_cty `:num->real` ["real_of_num",I];; + +let real_unary = mk_cty `:real->real` [("real_neg",minus_num);("real_inv",rat_inv)];; + +(* +let lift (a,b) x = function;; +*) + +let rec mixed_of_term arith = function + | Var _ as u -> Hol_light (false,u) + | Const _ as u -> Hol_light (false,u) + | Abs(x,t) as u -> let t' = mixed_of_term false t in + (match t' with + | Hol_light (false,_) -> Hol_light (false,u) + | _ -> Hol_light (true,mk_abs(x, term_of_mixed t'))) +(* + | Const (h,y) as u -> Hol_lightu;; + if (is_const h) +*) +;; + +type_of `DECIMAL`;; +type_of `3`;; +let mixedalize t = t;; + +mk_numeral;; +Int 3;; + +Int 3;; + +let v = Int 3 // Int 4;; +let rec sqx n v = if (n = 0) then Int 1 else if (n=1) then v else (sqx (n-1) v)*/ (sqx (n-1) v);; + +let vv = sqx 10 v;; diff --git a/development/thales/chaff/general/flyshot.hl b/development/thales/chaff/general/flyshot.hl new file mode 100644 index 0000000..6a9c6df --- /dev/null +++ b/development/thales/chaff/general/flyshot.hl @@ -0,0 +1,744 @@ +(* Extension of snapshot.hl. This has to be read in after the flyspeck build, + because it contains new types defined by the build *) + +module Snapshot_flyspeck_build_2010_02_12 : Snapshot_type = struct + + let hol_version = "2.20++";; + let hol_snapshot = "7_31_09";; + let svn_version = 1524;; + + let the_interface = Snapshot_v220_7_31_2009.the_interface;; + let the_filetable = [("general/flyspeck_utility.hl", 832); + ("general/update_database_310.ml", 832); ("hypermap/hypermap.hl", 832); + ("volume/vol1.hl", 737); ("trigonometry/trigonometry.hl", 719); + ("general/flyspeck_utility.hl", 717); ("trigonometry/trig2.hl", 717); + ("trigonometry/trig1.hl", 708); ("nonlinear/ineqdata3q1h.hl", 707); + ("nonlinear/ineq.hl", 707); ("leg/enclosed_def.hl", 707); + ("leg/quadratic_root_plus_def.hl", 706); + ("leg/abc_of_quadratic_def.hl", 705); ("leg/muR_def.hl", 704); + ("leg/collect_geom.hl", 703); ("leg/cayleyR_def.hl", 678); + ("leg/affprops.hl", 677); ("leg/AFF_SGN_TAC.hl", 677); + ("leg/geomdetail.hl", 677); ("pervasives", 673)];; + + let the_constants = + [ + ("map3", `:real^3->real^3->real^3`); + ("canon", `:(A)hypermap->((A)loop->bool)->((A->bool)->bool)->bool`); + ("is_flag", `:(A)hypermap->((A->bool)->bool)->bool`); + ("is_gen_flag", `:(A)hypermap->(A->bool)->((A->bool)->bool)->bool`); + ("edge_nondegenerate", `:(A)hypermap->bool`); + ("face_collection", `:(A)hypermap->(A)loop->bool`); + ("face_loop", `:(A)hypermap->A->(A)loop`); + ("res", `:(A->A)->(A->bool)->A->A`); + ("team", `:(A)hypermap->(A)loop->(A->bool)->bool`); + ("iso", `:(A)hypermap->(B)hypermap->bool`); + ("quotient", `:(A)hypermap->((A)loop->bool)->(A->bool)hypermap`); + ("nmap", `:(A)hypermap->((A)loop->bool)->(A->bool)->A->bool`); + ("fmap", `:(A)hypermap->((A)loop->bool)->(A->bool)->A->bool`); + ("tail", `:(A)hypermap->((A)loop->bool)->A->A`); + ("head", `:(A)hypermap->((A)loop->bool)->A->A`); + ("choice", `:(A)hypermap->((A)loop->bool)->A->A->bool`); + ("support_darts", `:((A)loop->bool)->A->bool`); + ("quotient_darts", `:(A)hypermap->((A)loop->bool)->(A->bool)->bool`); + ("is_normal", `:(A)hypermap->((A)loop->bool)->bool`); + ("atom", `:(A)hypermap->(A)loop->A->A->bool`); + ("is_node_going", `:(A)hypermap->(A)loop->A->A->bool`); + ("in_path", `:(num->A)->num->A->bool`); + ("set_dart_of", `:(num->A)->num->A->bool`); + ("contour_of", `:(A)loop->A->num->A`); + ("is_loop", `:(A)hypermap->(A)loop->bool`); ("top", `:(A)loop->num`); + ("size", `:(A)loop->num`); ("inside", `:A->(A)loop->bool`); + ("back", `:(A)loop->A->A`); ("next", `:(A)loop->A->A`); + ("dart_of", `:(A)loop->A->bool`); + ("tuple_loop", `:(A)loop->(A->bool)#(A->A)`); + ("loop", `:(A->bool)#(A->A)->(A)loop`); + ("shift_path", `:(num->A)->num->num->A`); + ("is_Moebius_contour", `:(A)hypermap->(num->A)->num->bool`); + ("is_splitting_component", `:(A)hypermap->A->bool`); + ("planar_ind", `:(A)hypermap->real`); + ("is_face_split", `:(A)hypermap->A->bool`); + ("is_node_split", `:(A)hypermap->A->bool`); + ("is_edge_split", `:(A)hypermap->A->bool`); + ("is_face_merge", `:(A)hypermap->A->bool`); + ("is_node_merge", `:(A)hypermap->A->bool`); + ("is_edge_merge", `:(A)hypermap->A->bool`); + ("inj_orbit", `:(A->A)->A->num->bool`); + ("double_face_walkup", `:(A)hypermap->A->A->(A)hypermap`); + ("double_node_walkup", `:(A)hypermap->A->A->(A)hypermap`); + ("double_edge_walkup", `:(A)hypermap->A->A->(A)hypermap`); + ("face_walkup", `:(A)hypermap->A->(A)hypermap`); + ("node_walkup", `:(A)hypermap->A->(A)hypermap`); + ("edge_walkup", `:(A)hypermap->A->(A)hypermap`); + ("shift", `:(A)hypermap->(A)hypermap`); + ("is_face_degenerate", `:(A)hypermap->A->bool`); + ("is_node_degenerate", `:(A)hypermap->A->bool`); + ("is_edge_degenerate", `:(A)hypermap->A->bool`); + ("isolated_dart", `:(A)hypermap->A->bool`); + ("is_inj_contour", `:(A)hypermap->(num->A)->num->bool`); + ("face_contour", `:(A)hypermap->A->num->A`); + ("node_contour", `:(A)hypermap->A->num->A`); + ("is_contour", `:(A)hypermap->(num->A)->num->bool`); + ("one_step_contour", `:(A)hypermap->A->A->bool`); + ("face_path", `:(A)hypermap->A->num->A`); + ("node_path", `:(A)hypermap->A->num->A`); + ("edge_path", `:(A)hypermap->A->num->A`); + ("connected_hypermap", `:(A)hypermap->bool`); + ("dart_nondegenerate", `:(A)hypermap->A->bool`); + ("dart_degenerate", `:(A)hypermap->A->bool`); + ("simple_hypermap", `:(A)hypermap->bool`); + ("planar_hypermap", `:(A)hypermap->bool`); + ("plain_hypermap", `:(A)hypermap->bool`); + ("number_of_components", `:(A)hypermap->num`); + ("number_of_faces", `:(A)hypermap->num`); + ("number_of_nodes", `:(A)hypermap->num`); + ("number_of_edges", `:(A)hypermap->num`); + ("set_of_components", `:(A)hypermap->(A->bool)->bool`); + ("set_part_components", `:(A)hypermap->(A->bool)->(A->bool)->bool`); + ("set_components", `:(A)hypermap->(A->bool)->(A->bool)->bool`); + ("face_set", `:(A)hypermap->(A->bool)->bool`); + ("node_set", `:(A)hypermap->(A->bool)->bool`); + ("edge_set", `:(A)hypermap->(A->bool)->bool`); + ("number_of_orbits", `:(A->bool)->(A->A)->num`); + ("set_of_orbits", `:(A->bool)->(A->A)->(A->bool)->bool`); + ("comb_component", `:(A)hypermap->A->A->bool`); + ("is_in_component", `:(A)hypermap->A->A->bool`); + ("is_path", `:(A)hypermap->(num->A)->num->bool`); + ("go_one_step", `:(A)hypermap->A->A->bool`); + ("face", `:(A)hypermap->A->A->bool`); + ("node", `:(A)hypermap->A->A->bool`); + ("edge", `:(A)hypermap->A->A->bool`); ("face_map", `:(A)hypermap->A->A`); + ("node_map", `:(A)hypermap->A->A`); ("edge_map", `:(A)hypermap->A->A`); + ("dart", `:(A)hypermap->A->bool`); + ("tuple_hypermap", `:(A)hypermap->(A->bool)#(A->A)#(A->A)#(A->A)`); + ("hypermap", `:(A->bool)#(A->A)#(A->A)#(A->A)->(A)hypermap`); + ("orbit_map", `:(A->A)->A->A->bool`); ("POWER", `:(A->A)->num->A->A`); + ("integer_point", `:(real^3->bool)->real^3->bool`); + ("map1", `:real^3->real^3->bool`); + ("close_hinhcau", `:real^3->real->real^3->bool`); + ("set_of_ccube", `:(real^3->bool)->(real^3->bool)->bool`); + ("ccube", `:real^3->real^3->bool`); + ("vector_to_pair", `:real^3->real#real#real`); + ("int_interval", `:real->real->real->bool`); + ("map0", `:real^3->real^3->bool`); + ("union_of_int_cube", `:real^3->real->real^3->bool`); + ("int_ball", `:real^3->real->real^3->bool`); + ("union_of_cube", `:real^3->real->real^3->bool`); + ("set_of_cube", `:(real^3->bool)->(real^3->bool)->bool`); + ("hinhcau", `:real^3->real->real^3->bool`); + ("cube", `:real^3->real^3->bool`); + ("sol", `:(real^3->bool)->real^3->real`); + ("volume_prop_fix", `:((real^3->bool)->real)->bool`); + ("eventually_radial_norm", `:real^A->(real^A->bool)->bool`); + ("radial_norm", `:real->real^A->(real^A->bool)->bool`); + ("parallel", `:real^N->real^N->bool`); ("unknown", `:bool`); + ("arg_diff", `:real^2->real^2->real`); ("pl_angle", `:real^2->real`); + ("polar_cycle_on", `:(real^2->real^2)->(real^2->bool)->bool`); + ("polar_le", `:real^2->real^2->bool`); + ("polar_lt", `:real^2->real^2->bool`); ("tri_itv", `:real->bool`); + ("real_itv", `:real->real->real->bool`); + ("sinV", `:real^A->real^A->real`); ("cosV", `:real^A->real^A->real`); + ("atan2_temp", `:real#real->real`); + ("enclosed", + `:real->real->real->real->real->real->real->real->real->real`); + ("quadratic_root_plus", `:real#real#real->real`); + ("abc_of_quadratic", `:(real->real)->real#real#real`); + ("muR", + `:real->real->real->real->real->real->real->real->real->real->real`); + ("muy_v", `:real^N->real^N->real^N->real^N->real^N->real->real`); + ("muy_delta", `:real->real->real->real->real->real->real`); + ("det_vec3", `:real^3->real^3->real^3->real`); + ("condA", + `:real^3->real^3->real^3->real^3->real->real->real->real->real->A->bool`); + ("coplanar_alt", `:(real^A->bool)->bool`); + ("cayleytr", + `:real->real->real->real->real->real->real->real->real->real->real`); + ("delta_x14", `:real->real->real->real->real->real->real`); + ("delta_x13", `:real->real->real->real->real->real->real`); + ("delta_x12", `:real->real->real->real->real->real->real`); + ("coef3", `:real^N->real^N->real^N->real^N->real`); + ("coef2", `:real^N->real^N->real^N->real^N->real`); + ("coef1", `:real^N->real^N->real^N->real^N->real`); + ("c_coef", `:real->real->real->real->real->real`); + ("b_coef", `:real->real->real->real->real->real`); + ("cm3_ups_x", `:real^3->real^3->real^3->real`); + ("plane_3p", `:real^3->real^3->real^3->real^3->bool`); + ("delta_x34", `:real->real->real->real->real->real->real`); + ("plane_norm", `:(real^A->bool)->bool`); + ("ups_x_pow2", `:real->real->real->real`); + ("max_real3", `:real->real->real->real`); + ("max_real", `:real->real->real`); + ("eta_v", `:real^N->real^N->real^N->real`); + ("delta", `:real->real->real->real->real->real->real`); + ("chi", `:real->real->real->real->real->real->real`); + ("rho_ij", `:real->real->real->real->real->real->real`); + ("cayleyR", + `:real->real->real->real->real->real->real->real->real->real->real`); + ("min_dist", `:real^3->(real^3->bool)->bool`); + ("e_plane", `:real^N->real^N->real^N->bool`); + ("near2t0", `:real^A->(real^A->bool)->real^A->bool`); + ("near", `:real^N->real->(real^N->bool)->real^N->bool`); + ("VC_INFI", `:(real^3->bool)->real^3->bool`); + ("VC", `:real^3->(real^3->bool)->real^3->bool`); + ("lambda_y", `:real^3->(real^3->bool)->real^3->bool`); + ("lambda_x", `:real^3->(real^3->bool)->real^3->bool`); + ("VC_INFI_trg", `:(real^3->bool)->real^3->bool`); + ("VC_trg", `:real^3->(real^3->bool)->real^3->bool`); + ("unobstructed", `:real^3->real^3->(real^3->bool)->bool`); + ("obstruct", `:real^3->real^3->(real^3->bool)->bool`); + ("conv", `:(real^A->bool)->real^A->bool`); + ("obstructed", `:real^3->real^3->(real^3->bool)->bool`); + ("barrier", `:(real^3->bool)->(real^3->bool)->bool`); + ("Q_SYS", `:(real^3->bool)->(real^3->bool)->bool`); + ("anchor_points", `:real^3->real^3->(real^3->bool)->real^3->bool`); + ("anchor", `:real^3->real^3->real^3->(real^3->bool)->bool`); + ("isolated_pai", `:(real^3->bool)->(real^3->bool)->(real^3->bool)->bool`); + ("isolated_qua", `:(real^3->bool)->(real^3->bool)->bool`); + ("interior_pos", + `:real^3->real^3->real^3->real^3->real^3->(real^3->bool)->bool`); + ("conflicting_dia", + `:real^3->real^3->real^3->real^3->real^3->(real^3->bool)->bool`); + ("adjacent_pai", + `:real^3->real^3->real^3->real^3->real^3->(real^3->bool)->bool`); + ("quartered_oct", + `:real^3->real^3->real^3->real^3->real^3->real^3->(real^3->bool)->bool`); + ("strict_qua2", `:(real^3->bool)->(real^3->bool)->(real^3->bool)->bool`); + ("strict_qua", `:(real^3->bool)->(real^3->bool)->bool`); + ("diagonal", `:real^3->real^3->(real^3->bool)->(real^3->bool)->bool`); + ("quarter", `:(real^3->bool)->(real^3->bool)->bool`); + ("quasi_reg_tet", `:(real^3->bool)->(real^3->bool)->bool`); + ("simplex", `:(real^3->bool)->(real^3->bool)->bool`); + ("quasi_tri", `:(real^3->bool)->(real^3->bool)->bool`); ("t0", `:real`); + ("voro2", `:real^3->(real^3->bool)->real^3->bool`); + ("voronoi2", `:real^3->(real^3->bool)->real^3->bool`); + ("d3", `:real^3->real^3->real`); + ("centered_pac", `:(real^3->bool)->real^3->bool`); + ("center_pac", `:(real^3->bool)->real^3->bool`); + ("packing_trg", `:(real^3->bool)->bool`); + ("border", `:(real^A->bool)->real^A->bool`); + ("conv_trg", `:(real^A->bool)->real^A->bool`); + ("conv0_2", `:(real^A->bool)->real^A->bool`); + ("voronoi_trg", `:real^A->(real^A->bool)->real^A->bool`); + ("ineq", `:(real#real#real)list->bool->bool`); + ("abc_param", `:real^A->real^A->real^A->B->real#real#B`); + ("make_point", + `:real^3->real^3->real^3->real^3->real->real->real->real^3`); + ("ortho0", `:real^A->real^A->real^A->real^A->real^A->bool`); + ("rcone_lt", `:real^A->real^A->real->real^A->bool`); + ("eventually_radial", `:real^A->(real^A->bool)->bool`); + ("radial", `:real->real^A->(real^A->bool)->bool`); + ("null_equiv", `:(real^3->bool)#(real^3->bool)->bool`); + ("packing", `:(real^3->bool)->bool`); + ("azim_cycle", `:(real^3->bool)->real^3->real^3->real^3->real^3`); + ("projection", `:real^A->real^A->real^A`); + ("cyclic_set", `:(real^A->bool)->real^A->real^A->bool`); + ("polar_cycle", `:(real#real->bool)->real#real->real#real`); + ("cyclic_order", `:real#real->real#real->real#real->bool`); + ("radius", `:real#real->real`); + ("directed_angle", `:real#real->real#real->real`); + ("beta", `:real->real->real`); + ("euler_p", `:real^A->real^A->real^A->real^A->real`); + ("xlist", + `:real^A->real^A->real^A->real^A->real#real#real#real#real#real`); + ("ylist", + `:real^A->real^A->real^A->real^A->real#real#real#real#real#real`); + ("orientation", `:(real^A->bool)->real^A->(real->bool)->bool`); + ("radV", `:(real^A->bool)->real`); + ("circumcenter", `:(real^A->bool)->real^A`); + ("bis_lt", `:real^A->real^A->real^A->bool`); + ("bis_le", `:real^A->real^A->real^A->bool`); + ("bis", `:real^A->real^A->real^A->bool`); + ("open_half_space", `:(real^A->bool)->bool`); + ("closed_half_space", `:(real^A->bool)->bool`); + ("open_half_plane", `:(real^A->bool)->bool`); + ("closed_half_plane", `:(real^A->bool)->bool`); + ("line", `:(real^A->bool)->bool`); + ("voronoi_le", `:real^A->(real^A->bool)->real^A->bool`); + ("voronoi", `:real^A->(real^A->bool)->real^A->bool`); + ("aff", `:(real^A->bool)->real^A->bool`); + ("rad2_x", `:real->real->real->real->real->real->real`); + ("dihR", `:real->real->real->real`); ("solR", `:real->real->real->real`); + ("volR", `:real->real->real->real`); + ("arclength", `:real->real->real->real`); + ("vol_x", `:real->real->real->real->real->real->real`); + ("tauq", `:real->real->real->real->real->real->real->real->real->real`); + ("taum", `:real->real->real->real->real->real->real`); + ("lnazim", `:real->real->real->real->real->real->real`); + ("rhazim", `:real->real->real->real->real->real->real`); + ("rho", `:real->real`); ("ly", `:real->real`); ("const1", `:real`); + ("interp", `:real->real->real->real->real->real`); + ("sol_y", `:real->real->real->real->real->real->real`); + ("sol_x", `:real->real->real->real->real->real->real`); + ("dih3_x", `:real->real->real->real->real->real->real`); + ("dih2_x", `:real->real->real->real->real->real->real`); + ("dih3_y", `:real->real->real->real->real->real->real`); + ("dih2_y", `:real->real->real->real->real->real->real`); + ("dih_y", `:real->real->real->real->real->real->real`); + ("dih_x", `:real->real->real->real->real->real->real`); + ("chi_x", `:real->real->real->real->real->real->real`); + ("rho_x", `:real->real->real->real->real->real->real`); + ("eta_y", `:real->real->real->real`); + ("eta_x", `:real->real->real->real`); + ("ups_x", `:real->real->real->real`); + ("delta_x6", `:real->real->real->real->real->real->real`); + ("delta_x4", `:real->real->real->real->real->real->real`); + ("delta_y", `:real->real->real->real->real->real->real`); + ("pi_rt18", `:real`); ("sqrt2", `:real`); ("sqrt8", `:real`); + ("atn2", `:real#real->real`); ("SDIFF", `:(A->bool)->(A->bool)->A->bool`); + ("vol_ball_wedge", `:real^3->real^3->real^3->real^3->real->real`); + ("vol_rect", `:real^A->real^B->real`); + ("vol_conv", `:real^A->real^A->real^A->real^A->real`); + ("vol_conic_cap_wedge", + `:real^3->real^3->real^3->real^3->real->real->real`); + ("vol_frustt_wedge", `:real^3->real^3->real^3->real^3->real->real->real`); + ("vol_solid_triangle", `:real^A->real^A->real^A->real^A->real->real`); + ("primitive", `:(real^3->bool)->bool`); + ("circular_cone", `:(real^3->bool)->bool`); + ("c_cone", `:real^3#real^3#real->real^3->bool`); + ("sphere", `:(real^3->bool)->bool`); + ("rect", `:real^3->real^3->real^3->bool`); + ("solid_triangle", `:real^A->(real^A->bool)->real->real^A->bool`); + ("cone0", `:real^A->(real^A->bool)->real^A->bool`); + ("cone", `:real^A->(real^A->bool)->real^A->bool`); + ("dihV", `:real^A->real^A->real^A->real^A->real`); + ("opposite", `:real^N->real^N->(real^N->bool)->bool`); + ("wedge", `:real^3->real^3->real^3->real^3->real^3->bool`); + ("azim", `:real^3->real^3->real^3->real^3->real`); + ("arcV", `:real^A->real^A->real^A->real`); + ("orthonormal", `:real^3->real^3->real^3->bool`); + ("conic_cap", `:real^A->real^A->real->real->real^A->bool`); + ("ellipsoid", `:real^3->real->real^3->bool`); + ("normball", `:real^A->real->real^A->bool`); + ("scale", `:real^3->real^3->real^3`); + ("frustt", `:real^A->real^A->real->real->real^A->bool`); + ("frustum", `:real^N->real^N->real->real->real->real^N->bool`); + ("rcone_eq", `:real^A->real^A->real->real^A->bool`); + ("rcone_ge", `:real^A->real^A->real->real^A->bool`); + ("rcone_gt", `:real^A->real^A->real->real^A->bool`); + ("rconesgn", `:(real->real->bool)->real^A->real^A->real->real^A->bool`); + ("delta_x", `:real->real->real->real->real->real->real`); + ("conv0", `:(real^A->bool)->real^A->bool`); + ("aff_le", `:(real^A->bool)->(real^A->bool)->real^A->bool`); + ("aff_lt", `:(real^A->bool)->(real^A->bool)->real^A->bool`); + ("aff_ge", `:(real^A->bool)->(real^A->bool)->real^A->bool`); + ("aff_gt", `:(real^A->bool)->(real^A->bool)->real^A->bool`); + ("sgn_le", `:real->bool`); ("sgn_lt", `:real->bool`); + ("sgn_ge", `:real->bool`); ("sgn_gt", `:real->bool`); + ("affsign", `:(real->bool)->(real^A->bool)->(real^A->bool)->real^A->bool`); + ("lin_combo", `:(real^N->bool)->(real^N->real)->real^N`); + ("pad2d3d", `:real^2->real^3`); ("plane", `:(real^A->bool)->bool`); + ("slice", `:num->real->(real^A->bool)->real^B->bool`); + ("pushin", `:num->B->B^A->B^C`); ("dropout", `:num->real^N->real^M`); + ("real_measure", `:(real->bool)->real`); + ("real_measurable", `:(real->bool)->bool`); + ("has_real_measure", `:(real->bool)->real->bool`); + ("absolutely_real_integrable_on", `:(real->real)->(real->bool)->bool`); + ("real_negligible", `:(real->bool)->bool`); + ("real_integral", `:(real->bool)->(real->real)->real`); + ("real_integrable_on", `:(real->real)->(real->bool)->bool`); + ("has_real_integral", `:(real->real)->real->(real->bool)->bool`); + ("closed_real_interval", `:(real#real)list->real->bool`); + ("open_real_interval", `:real#real->real->bool`); + ("is_realinterval", `:(real->bool)->bool`); + ("real_differentiable_on", `:(real->real)->(real->bool)->bool`); + ("higher_real_derivative", `:num->(real->real)->real->real`); + ("real_derivative", `:(real->real)->real->real`); + ("real_differentiable", `:(real->real)->(real)net->bool`); + ("has_real_derivative", `:(real->real)->real->(real)net->bool`); + ("real_continuous_on", `:(real->real)->(real->bool)->bool`); + ("real_continuous", `:(A->real)->(A)net->bool`); + ("at_neginfinity", `:(real)net`); ("at_posinfinity", `:(real)net`); + ("atreal", `:real->(real)net`); + ("real_summable", `:(num->bool)->(num->real)->bool`); + ("real_infsum", `:(num->bool)->(num->real)->real`); + ("real_sums", `:(num->real)->real->(num->bool)->bool`); + ("--->", `:(A->real)->real->(A)net->bool`); + ("real_compact", `:(real->bool)->bool`); + ("real_bounded", `:(real->bool)->bool`); + ("euclideanreal", `:(real)topology`); + ("real_closed", `:(real->bool)->bool`); + ("real_open", `:(real->bool)->bool`); + ("measure", `:(real^A->bool)->real`); + ("measurable", `:(real^A->bool)->bool`); + ("has_measure", `:(real^A->bool)->real->bool`); + ("*_c", `:(A->bool)->(B->bool)->A#B->bool`); + ("+_c", `:(A->bool)->(B->bool)->A+B->bool`); + ("ordinal", `:(A#A->bool)->bool`); + ("linseg", `:(A#A->bool)->A->A#A->bool`); + ("inseg", `:(A#A->bool)->(A#A->bool)->bool`); + ("woset", `:(A#A->bool)->bool`); + ("chain", `:(A#A->bool)->(A->bool)->bool`); + ("poset", `:(A#A->bool)->bool`); ("fl", `:(A#A->bool)->A->bool`); + ("less", `:(A#A->bool)->A#A->bool`); + ("angle", `:real^A#real^A#real^A->real`); + ("vector_angle", `:real^A->real^A->real`); ("acs", `:real->real`); + ("asn", `:real->real`); ("cacs", `:real^2->real^2`); + ("casn", `:real^2->real^2`); ("atn", `:real->real`); + ("catn", `:real^2->real^2`); ("unwinding", `:real^2->real^2`); + ("cpow", `:real^2->real^2->real^2`); ("clog", `:real^2->real^2`); + ("tan", `:real->real`); ("ctan", `:real^2->real^2`); + ("rotate2d", `:real->real^2->real^2`); ("Arg", `:real^2->real`); + ("pi", `:real`); ("log", `:real->real`); ("cos", `:real->real`); + ("sin", `:real->real`); ("exp", `:real->real`); + ("csin", `:real^2->real^2`); ("ccos", `:real^2->real^2`); + ("cexp", `:real^2->real^2`); + ("analytic_on", `:(real^2->real^2)->(real^2->bool)->bool`); + ("holomorphic_on", `:(real^2->real^2)->(real^2->bool)->bool`); + ("higher_complex_derivative", `:num->(real^2->real^2)->real^2->real^2`); + ("complex_derivative", `:(real^2->real^2)->real^2->real^2`); + ("complex_differentiable", `:(real^2->real^2)->(real^2)net->bool`); + ("has_complex_derivative", `:(real^2->real^2)->real^2->(real^2)net->bool`); + ("cproduct", `:(A->bool)->(A->real^2)->real^2`); + ("real", `:real^2->bool`); ("csqrt", `:real^2->real^2`); + ("cnj", `:real^2->real^2`); ("complex_pow", `:real^2->num->real^2`); + ("complex_div", `:real^2->real^2->real^2`); + ("complex_inv", `:real^2->real^2`); + ("complex_mul", `:real^2->real^2->real^2`); ("ii", `:real^2`); + ("Cx", `:real->real^2`); ("complex", `:real#real->real^2`); + ("Im", `:real^2->real`); ("Re", `:real^2->real`); + ("absolutely_integrable_on", `:(real^B->real^A)->(real^B->bool)->bool`); + ("negligible", `:(real^A->bool)->bool`); + ("indicator", `:(real^M->bool)->real^M->real^1`); + ("division_points", + `:(real^N->bool)->((real^N->bool)->bool)->num#real->bool`); + ("lifted", `:(A->A->B)->(A)option->(A)option->(B)option`); + ("operative", `:(A->A->A)->((real^N->bool)->A)->bool`); + ("integral", `:(real^A->bool)->(real^A->real^B)->real^B`); + ("integrable_on", `:(real^B->real^A)->(real^B->bool)->bool`); + ("has_integral", `:(real^B->real^A)->real^A->(real^B->bool)->bool`); + ("has_integral_compact_interval", + `:(real^B->real^A)->real^A->(real^B->bool)->bool`); + ("fine", `:(A->B->bool)->(A#(B->bool)->bool)->bool`); + ("tagged_division_of", + `:(real^A#(real^A->bool)->bool)->(real^A->bool)->bool`); + ("tagged_partial_division_of", + `:(real^A#(real^A->bool)->bool)->(real^A->bool)->bool`); + ("division_of", `:((real^A->bool)->bool)->(real^A->bool)->bool`); + ("gauge", `:(real^A->real^A->bool)->bool`); + ("content", `:(real^M->bool)->real`); + ("interval_lowerbound", `:(real^M->bool)->real^M`); + ("interval_upperbound", `:(real^M->bool)->real^M`); + ("vector_derivative", `:(real^1->real^N)->(real^1)net->real^N`); + ("has_vector_derivative", `:(real^1->real^A)->real^A->(real^1)net->bool`); + ("jacobian", `:(real^A->real^B)->(real^A)net->real^A^B`); + ("frechet_derivative", `:(real^A->real^B)->(real^A)net->real^A->real^B`); + ("differentiable_on", `:(real^B->real^A)->(real^B->bool)->bool`); + ("differentiable", `:(real^B->real^A)->(real^B)net->bool`); + ("has_derivative", + `:(real^B->real^A)->(real^B->real^A)->(real^B)net->bool`); + ("interval_bij", `:real^N#real^N->real^N#real^N->real^N->real^N`); + ("retract_of", `:(real^A->bool)->(real^A->bool)->bool`); + ("retraction", `:(real^N->bool)#(real^N->bool)->(real^N->real^N)->bool`); + ("reduced", `:((num->num)->num->num)->num->(num->num)->num`); + ("ksimplex", `:num->num->((num->num)->bool)->bool`); + ("kle", `:num->(num->num)->(num->num)->bool`); + ("path_connected", `:(real^A->bool)->bool`); + ("path_component", `:(real^A->bool)->real^A->real^A->bool`); + ("linepath", `:real^A#real^A->real^1->real^A`); + ("shiftpath", `:real^1->(real^1->real^N)->real^1->real^N`); + ("arc", `:(real^1->real^N)->bool`); + ("simple_path", `:(real^1->real^N)->bool`); + ("++", `:(real^1->A)->(real^1->A)->real^1->A`); + ("reversepath", `:(real^1->real^N)->real^1->real^N`); + ("path_image", `:(real^1->real^N)->real^N->bool`); + ("pathfinish", `:(real^1->real^N)->real^N`); + ("pathstart", `:(real^1->real^N)->real^N`); + ("path", `:(real^1->real^N)->bool`); + ("extreme_point_of", `:real^A->(real^A->bool)->bool`); + ("face_of", `:(real^A->bool)->(real^A->bool)->bool`); + ("relative_interior", `:(real^A->bool)->real^A->bool`); + ("starlike", `:(real^A->bool)->bool`); + ("epigraph", + `:(real^N->bool)->(real^N->real)->real^(N,1)finite_sum->bool`); + ("convex_on", `:(real^A->real)->(real^A->bool)->bool`); + ("coplanar", `:(real^A->bool)->bool`); + ("affine_dependent", `:(real^N->bool)->bool`); + ("conic", `:(real^A->bool)->bool`); ("convex", `:(real^A->bool)->bool`); + ("affine", `:(real^A->bool)->bool`); + ("closest_point", `:(real^A->bool)->real^A->real^A`); + ("from", `:num->num->bool`); + ("summable", `:(num->bool)->(num->real^A)->bool`); + ("infsum", `:(num->bool)->(num->real^A)->real^A`); + ("sums", `:(num->real^A)->real^A->(num->bool)->bool`); + ("homeomorphic", `:(real^A->bool)->(real^B->bool)->bool`); + ("homeomorphism", + `:(real^B->bool)#(real^A->bool)->(real^B->real^A)#(real^A->real^B)->bool`); + ("open_segment", `:real^A#real^A->real^A->bool`); + ("closed_segment", `:(real^A#real^A)list->real^A->bool`); + ("is_interval", `:(real^N->bool)->bool`); + ("closed_interval", `:(real^N#real^N)list->real^N->bool`); + ("open_interval", `:real^N#real^N->real^N->bool`); + ("diameter", `:(real^A->bool)->real`); + ("connected_component", `:(real^A->bool)->real^A->real^A->bool`); + ("uniformly_continuous_on", `:(real^B->real^A)->(real^B->bool)->bool`); + ("continuous_on", `:(real^B->real^A)->(real^B->bool)->bool`); + ("continuous", `:(B->real^A)->(B)net->bool`); + ("complete", `:(real^N->bool)->bool`); ("cauchy", `:(num->real^N)->bool`); + ("compact", `:(real^N->bool)->bool`); + ("bounded", `:(real^N->bool)->bool`); ("netlimit", `:(A)net->A`); + ("lim", `:(A)net->(A->real^B)->real^B`); + ("-->", `:(B->real^A)->real^A->(B)net->bool`); + ("eventually", `:(A->bool)->(A)net->bool`); + ("trivial_limit", `:(A)net->bool`); + ("in_direction", `:real^A->real^A->(real^A)net`); + ("within", `:(A)net->(A->bool)->(A)net`); ("sequentially", `:(num)net`); + ("at_infinity", `:(real^A)net`); ("at", `:real^A->(real^A)net`); + ("netord", `:(A)net->A->A->bool`); ("mk_net", `:(A->A->bool)->(A)net`); + ("frontier", `:(real^A->bool)->real^A->bool`); + ("closure", `:(real^A->bool)->real^A->bool`); + ("interior", `:(real^A->bool)->real^A->bool`); + ("limit_point_of", `:real^A->(real^A->bool)->bool`); + ("connected", `:(real^A->bool)->bool`); + ("cball", `:real^A#real->real^A->bool`); + ("ball", `:real^A#real->real^A->bool`); + ("euclidean", `:(real^A)topology`); ("closed", `:(real^N->bool)->bool`); + ("open", `:(real^A->bool)->bool`); + ("subtopology", `:(A)topology->(A->bool)->(A)topology`); + ("closed_in", `:(A)topology->(A->bool)->bool`); + ("topspace", `:(A)topology->A->bool`); + ("open_in", `:(A)topology->(A->bool)->bool`); + ("topology", `:((A->bool)->bool)->(A)topology`); + ("istopology", `:((A->bool)->bool)->bool`); + ("ITER", `:num->(A->A)->A->A`); ("frac", `:real->real`); + ("floor", `:real->real`); ("integer", `:real->bool`); + ("cross", `:real^3->real^3->real^3`); + ("rotoinversion_matrix", `:real^A^A->bool`); + ("rotation_matrix", `:real^A^A->bool`); + ("orthogonal_matrix", `:real^N^N->bool`); + ("orthogonal_transformation", `:(real^N->real^N)->bool`); + ("det", `:real^N^N->real`); ("trace", `:real^N^N->real`); + ("product", `:(A->bool)->(A->real)->real`); ("sign", `:(A->A)->real`); + ("evenperm", `:(A->A)->bool`); ("permutation", `:(A->A)->bool`); + ("swapseq", `:num->(A->A)->bool`); ("swap", `:A#A->A->A`); + ("inverse", `:(B->A)->A->B`); ("permutes", `:(A->A)->(A->bool)->bool`); + ("midpoint", `:real^A#real^A->real^A`); + ("between", `:real^A->real^A#real^A->bool`); + ("collinear", `:(real^A->bool)->bool`); ("infnorm", `:real^N->real`); + ("rank", `:real^M^N->num`); ("columnvector", `:real^N->real^1^N`); + ("rowvector", `:real^N->real^N^1`); ("dim", `:(real^A->bool)->num`); + ("independent", `:(real^A->bool)->bool`); + ("dependent", `:(real^A->bool)->bool`); + ("span", `:(real^A->bool)->real^A->bool`); + ("subspace", `:(real^A->bool)->bool`); ("drop", `:real^1->real`); + ("lift", `:real->real^1`); ("onorm", `:(real^M->real^N)->real`); + ("matrix", `:(real^M->real^N)->real^M^N`); + ("matrix_inv", `:real^N^M->real^M^N`); ("invertible", `:real^N^M->bool`); + ("columns", `:real^N^M->real^M->bool`); + ("rows", `:real^N^M->real^N->bool`); ("column", `:num->real^N^M->real^M`); + ("row", `:num->real^N^M->real^N`); ("transp", `:real^N^M->real^M^N`); + ("mat", `:num->real^N^M`); + ("vector_matrix_mul", `:real^M->real^N^M->real^N`); + ("matrix_vector_mul", `:real^N^M->real^N->real^M`); + ("matrix_mul", `:real^N^M->real^P^N->real^P^M`); + ("matrix_sub", `:real^N^M->real^N^M->real^N^M`); + ("matrix_add", `:real^N^M->real^N^M->real^N^M`); + ("matrix_neg", `:real^N^M->real^N^M`); + ("adjoint", `:(real^M->real^N)->real^N->real^M`); + ("bilinear", `:(real^A->real^B->real^C)->bool`); + ("linear", `:(real^M->real^N)->bool`); + ("orthogonal", `:real^A->real^A->bool`); ("basis", `:num->real^A`); + ("vsum", `:(A->bool)->(A->real^N)->real^N`); + ("distance", `:real^A#real^A->real`); ("vector_norm", `:real^A->real`); + ("dot", `:real^N->real^N->real`); ("vec", `:num->real^N`); + ("%", `:real->real^N->real^N`); ("vector_neg", `:real^N->real^N`); + ("vector_sub", `:real^N->real^N->real^N`); + ("vector_add", `:real^N->real^N->real^N`); ("sqrt", `:real->real`); + ("hull", `:((A->bool)->bool)->(A->bool)->A->bool`); + ("inf", `:(real->bool)->real`); ("sup", `:(real->bool)->real`); + ("superadmissible", + `:(A->A->bool)->((A->C)->B->bool)->(B->A)->((A->C)->B->C)->bool`); + ("tailadmissible", + `:(A->A->bool)->((A->B)->P->bool)->(P->A)->((A->B)->P->B)->bool`); + ("admissible", + `:(B->A->bool)->((B->C)->D->bool)->(D->A)->((B->C)->D->E)->bool`); + ("CASEWISE", `:((A->C)#(B->A->D))list->B->C->D`); + ("vector", `:(A)list->A^N`); + ("dest_auto_define_finite_type_3", `:3->num`); + ("mk_auto_define_finite_type_3", `:num->3`); + ("dest_auto_define_finite_type_2", `:2->num`); + ("mk_auto_define_finite_type_2", `:num->2`); + ("sndcart", `:A^(M,N)finite_sum->A^N`); + ("fstcart", `:A^(M,N)finite_sum->A^M`); + ("pastecart", `:A^M->A^N->A^(M,N)finite_sum`); + ("dest_finite_sum", `:(A,B)finite_sum->num`); + ("mk_finite_sum", `:num->(A,B)finite_sum`); ("lambda", `:(num->A)->A^B`); + ("$", `:B^A->num->B`); ("dest_cart", `:A^B->(B)finite_image->A`); + ("mk_cart", `:((B)finite_image->A)->A^B`); + ("dest_finite_image", `:(A)finite_image->num`); + ("finite_index", `:num->(A)finite_image`); + ("dimindex", `:(A->bool)->num`); ("sum", `:(A->bool)->(A->real)->real`); + ("nsum", `:(A->bool)->(A->num)->num`); + ("iterate", `:(B->B->B)->(A->bool)->(A->B)->B`); + ("support", `:(B->B->B)->(A->B)->(A->bool)->A->bool`); + ("monoidal", `:(A->A->A)->bool`); ("neutral", `:(A->A->A)->A`); + ("..", `:num->num->num->bool`); ("COUNTABLE", `:(A->bool)->bool`); + (">_c", `:(A->bool)->(B->bool)->bool`); + (">=_c", `:(A->bool)->(B->bool)->bool`); + ("=_c", `:(A->bool)->(B->bool)->bool`); + ("<_c", `:(A->bool)->(B->bool)->bool`); + ("<=_c", `:(A->bool)->(B->bool)->bool`); + ("PAIRWISE", `:(A->A->bool)->(A)list->bool`); + ("pairwise", `:(A->A->bool)->(A->bool)->bool`); + ("list_of_set", `:(A->bool)->(A)list`); + ("set_of_list", `:(A)list->A->bool`); + ("CROSS", `:(A->bool)->(B->bool)->A#B->bool`); + ("HAS_SIZE", `:(A->bool)->num->bool`); ("CARD", `:(A->bool)->num`); + ("ITSET", `:(A->B->B)->(A->bool)->B->B`); + ("FINREC", `:(A->B->B)->B->(A->bool)->B->num->bool`); + ("REST", `:(A->bool)->A->bool`); ("CHOICE", `:(A->bool)->A`); + ("BIJ", `:(A->B)->(A->bool)->(B->bool)->bool`); + ("SURJ", `:(A->B)->(A->bool)->(B->bool)->bool`); + ("INJ", `:(A->B)->(A->bool)->(B->bool)->bool`); + ("IMAGE", `:(A->B)->(A->bool)->B->bool`); + ("INFINITE", `:(A->bool)->bool`); ("FINITE", `:(A->bool)->bool`); + ("SING", `:(A->bool)->bool`); ("DISJOINT", `:(A->bool)->(A->bool)->bool`); + ("PSUBSET", `:(A->bool)->(A->bool)->bool`); + ("SUBSET", `:(A->bool)->(A->bool)->bool`); + ("DELETE", `:(A->bool)->A->A->bool`); + ("DIFF", `:(A->bool)->(A->bool)->A->bool`); + ("INTERS", `:((A->bool)->bool)->A->bool`); + ("INTER", `:(A->bool)->(A->bool)->A->bool`); + ("UNIONS", `:((A->bool)->bool)->A->bool`); + ("UNION", `:(A->bool)->(A->bool)->A->bool`); ("UNIV", `:A->bool`); + ("INSERT", `:A->(A->bool)->A->bool`); ("EMPTY", `:A->bool`); + ("SETSPEC", `:A->bool->A->bool`); ("GSPEC", `:(A->bool)->A->bool`); + ("IN", `:A->(A->bool)->bool`); ("num_gcd", `:num#num->num`); + ("num_coprime", `:num#num->bool`); ("num_mod", `:num->num->num->bool`); + ("num_divides", `:num->num->bool`); ("num_of_int", `:int->num`); + ("int_gcd", `:int#int->int`); ("int_coprime", `:int#int->bool`); + ("int_mod", `:int->int->int->bool`); ("int_divides", `:int->int->bool`); + ("real_mod", `:real->real->real->bool`); + ("==", `:A->A->(A->A->bool)->bool`); ("rem", `:int->int->int`); + ("div", `:int->int->int`); ("int_pow", `:int->num->int`); + ("int_min", `:int->int->int`); ("int_max", `:int->int->int`); + ("int_abs", `:int->int`); ("int_mul", `:int->int->int`); + ("int_sub", `:int->int->int`); ("int_add", `:int->int->int`); + ("int_neg", `:int->int`); ("int_of_num", `:num->int`); + ("int_gt", `:int->int->bool`); ("int_ge", `:int->int->bool`); + ("int_lt", `:int->int->bool`); ("int_le", `:int->int->bool`); + ("real_of_int", `:int->real`); ("int_of_real", `:real->int`); + ("is_int", `:real->bool`); ("DECIMAL", `:num->num->real`); + ("real_min", `:real->real->real`); ("real_max", `:real->real->real`); + ("real_div", `:real->real->real`); ("real_pow", `:real->num->real`); + ("real_abs", `:real->real`); ("real_gt", `:real->real->bool`); + ("real_ge", `:real->real->bool`); ("real_lt", `:real->real->bool`); + ("real_sub", `:real->real->real`); ("real_inv", `:real->real`); + ("real_le", `:real->real->bool`); ("real_mul", `:real->real->real`); + ("real_add", `:real->real->real`); ("real_neg", `:real->real`); + ("real_of_num", `:num->real`); ("dest_real", `:real->hreal#hreal->bool`); + ("mk_real", `:(hreal#hreal->bool)->real`); + ("treal_eq", `:hreal#hreal->hreal#hreal->bool`); + ("treal_inv", `:hreal#hreal->hreal#hreal`); + ("treal_le", `:hreal#hreal->hreal#hreal->bool`); + ("treal_mul", `:hreal#hreal->hreal#hreal->hreal#hreal`); + ("treal_add", `:hreal#hreal->hreal#hreal->hreal#hreal`); + ("treal_neg", `:hreal#hreal->hreal#hreal`); + ("treal_of_num", `:num->hreal#hreal`); ("hreal_inv", `:hreal->hreal`); + ("hreal_le", `:hreal->hreal->bool`); + ("hreal_mul", `:hreal->hreal->hreal`); + ("hreal_add", `:hreal->hreal->hreal`); ("hreal_of_num", `:num->hreal`); + ("dest_hreal", `:hreal->nadd->bool`); + ("mk_hreal", `:(nadd->bool)->hreal`); ("nadd_inv", `:nadd->nadd`); + ("nadd_rinv", `:nadd->num->num`); ("nadd_mul", `:nadd->nadd->nadd`); + ("nadd_add", `:nadd->nadd->nadd`); ("nadd_le", `:nadd->nadd->bool`); + ("nadd_of_num", `:num->nadd`); ("nadd_eq", `:nadd->nadd->bool`); + ("dest_nadd", `:nadd->num->num`); ("mk_nadd", `:(num->num)->nadd`); + ("is_nadd", `:(num->num)->bool`); ("dist", `:num#num->num`); + ("ASCII", `:bool->bool->bool->bool->bool->bool->bool->bool->char`); + ("_16756", `:bool->bool->bool->bool->bool->bool->bool->bool->char`); + ("_dest_char", `:char->(bool#bool#bool#bool#bool#bool#bool#bool)recspace`); + ("_mk_char", `:(bool#bool#bool#bool#bool#bool#bool#bool)recspace->char`); + ("ZIP", `:(A)list->(B)list->(A#B)list`); + ("ITLIST2", `:(A->B->C->C)->(A)list->(B)list->C->C`); + ("ASSOC", `:A->(A#B)list->B`); ("FILTER", `:(A->bool)->(A)list->(A)list`); + ("EL", `:num->(A)list->A`); + ("MAP2", `:(A->B->C)->(A)list->(B)list->(C)list`); + ("ALL2", `:(A->B->bool)->(A)list->(B)list->bool`); + ("MEM", `:A->(A)list->bool`); ("ITLIST", `:(A->B->B)->(A)list->B->B`); + ("EX", `:(A->bool)->(A)list->bool`); ("ALL", `:(A->bool)->(A)list->bool`); + ("NULL", `:(A)list->bool`); ("REPLICATE", `:num->A->(A)list`); + ("LAST", `:(A)list->A`); ("MAP", `:(A->B)->(A)list->(B)list`); + ("LENGTH", `:(A)list->num`); ("REVERSE", `:(A)list->(A)list`); + ("APPEND", `:(A)list->(A)list->(A)list`); ("TL", `:(A)list->(A)list`); + ("HD", `:(A)list->A`); ("ISO", `:(A->B)->(B->A)->bool`); + ("CONS", `:A->(A)list->(A)list`); ("NIL", `:(A)list`); + ("_dest_list", `:(A)list->(A)recspace`); + ("_mk_list", `:(A)recspace->(A)list`); ("SOME", `:A->(A)option`); + ("NONE", `:(A)option`); ("_dest_option", `:(A)option->(A)recspace`); + ("_mk_option", `:(A)recspace->(A)option`); ("OUTR", `:A+B->B`); + ("OUTL", `:A+B->A`); ("INR", `:B->A+B`); ("INL", `:A->A+B`); + ("_dest_sum", `:A+B->(A#B)recspace`); ("_mk_sum", `:(A#B)recspace->A+B`); + ("FNIL", `:num->A`); ("FCONS", `:A->(num->A)->num->A`); + ("CONSTR", `:num->A->(num->(A)recspace)->(A)recspace`); + ("BOTTOM", `:(A)recspace`); ("_dest_rec", `:(A)recspace->num->A->bool`); + ("_mk_rec", `:(num->A->bool)->(A)recspace`); + ("ZRECSPACE", `:(num->A->bool)->bool`); ("ZBOT", `:num->A->bool`); + ("ZCONSTR", `:num->A->(num->num->A->bool)->num->A->bool`); + ("INJP", `:(num->A->bool)->(num->A->bool)->num->A->bool`); + ("INJF", `:(num->num->A->bool)->num->A->bool`); + ("INJA", `:A->num->A->bool`); ("INJN", `:num->num->A->bool`); + ("NUMRIGHT", `:num->num`); ("NUMLEFT", `:num->bool`); + ("NUMSUM", `:bool->num->num`); ("NUMSND", `:num->num`); + ("NUMFST", `:num->num`); ("NUMPAIR", `:num->num->num`); + ("MEASURE", `:(A->num)->A->A->bool`); ("WF", `:(A->A->bool)->bool`); + ("minimal", `:(num->bool)->num`); ("MIN", `:num->num->num`); + ("MAX", `:num->num->num`); ("MOD", `:num->num->num`); + ("DIV", `:num->num->num`); ("FACT", `:num->num`); ("-", `:num->num->num`); + ("ODD", `:num->bool`); ("EVEN", `:num->bool`); (">", `:num->num->bool`); + (">=", `:num->num->bool`); ("<", `:num->num->bool`); + ("<=", `:num->num->bool`); ("EXP", `:num->num->num`); + ("*", `:num->num->num`); ("BIT1", `:num->num`); ("BIT0", `:num->num`); + ("+", `:num->num->num`); ("PRE", `:num->num`); ("NUMERAL", `:num->num`); + ("SUC", `:num->num`); ("_0", `:num`); ("dest_num", `:num->ind`); + ("mk_num", `:ind->num`); ("NUM_REP", `:ind->bool`); ("IND_0", `:ind`); + ("IND_SUC", `:ind->ind`); ("ONTO", `:(A->B)->bool`); + ("ONE_ONE", `:(A->B)->bool`); ("PASSOC", `:((A#B)#C->D)->A#B#C->D`); + ("UNCURRY", `:(A->B->C)->A#B->C`); ("CURRY", `:(A#B->C)->A->B->C`); + ("SND", `:A#B->B`); ("FST", `:A#B->A`); (",", `:A->B->A#B`); + ("REP_prod", `:A#B->A->B->bool`); ("ABS_prod", `:(A->B->bool)->A#B`); + ("mk_pair", `:A->B->A->B->bool`); ("_FUNCTION", `:(A->B->bool)->A->B`); + ("_MATCH", `:A->(A->B->bool)->B`); + ("_GUARDED_PATTERN", `:bool->bool->bool->bool`); + ("_UNGUARDED_PATTERN", `:bool->bool->bool`); + ("_SEQPATTERN", `:(A->B->bool)->(A->B->bool)->A->B->bool`); + ("GEQ", `:A->A->bool`); ("GABS", `:(A->bool)->A`); ("LET_END", `:A->A`); + ("LET", `:(A->B)->A->B`); ("one", `:1`); ("one_REP", `:1->bool`); + ("one_ABS", `:bool->1`); ("I", `:A->A`); ("o", `:(B->C)->(A->B)->A->C`); + ("COND", `:bool->A->A->A`); ("@", `:(A->bool)->A`); + ("_FALSITY_", `:bool`); ("?!", `:(A->bool)->bool`); ("~", `:bool->bool`); + ("F", `:bool`); ("\\/", `:bool->bool->bool`); ("?", `:(A->bool)->bool`); + ("!", `:(A->bool)->bool`); ("==>", `:bool->bool->bool`); + ("/\\", `:bool->bool->bool`); ("T", `:bool`); ("=", `:A->A->bool`)];; + + let the_loaded_files = + ["flyspeck_utility.hl"; "update_database_310.ml"; "hypermap.hl"; "vol1.hl"; + "trigonometry.hl"; "database2194fe.ml"; "flyspeck_utility.hl"; "trig2.hl"; + "trig1.hl"; "ineqdata3q1h.hl"; "ineq.hl"; "enclosed_def.hl"; + "quadratic_root_plus_def.hl"; "abc_of_quadratic_def.hl"; "muR_def.hl"; + "collect_geom.hl"; "cayleyR_def.hl"; "affprops.hl"; "AFF_SGN_TAC.hl"; + "geomdetail.hl"; "snapshot.hl"; "snapshot.hl"; "snapshot.hl"; + "snapshot.hl"; "snapshot.hl"; "sphere.hl"; "prove_by_refinement.hl"; + "update_database_310.ml"; "database3be71a.ml"; "snapshot.hl"; + "print-types.ml"; "flyspeck.ml"; "wlog_examples.ml"; "wlog.ml"; "real.ml"; + "measure.ml"; "card.ml"; "wo.ml"; "geom.ml"; "transc.ml"; "canal.ml"; + "complex.ml"; "integration.ml"; "analysis.ml"; "dimension.ml"; + "convex.ml"; "topology.ml"; "iter.ml"; "floor.ml"; "cross.ml"; + "determinants.ml"; "products.ml"; "permutations.ml"; "vectors.ml"; + "misc.ml"; "database.ml"; "help.ml"; "define.ml"; "cart.ml"; "iter.ml"; + "sets.ml"; "int.ml"; "calc_rat.ml"; "real.ml"; "realarith.ml"; + "calc_int.ml"; "realax.ml"; "list.ml"; "ind-types.ml"; "grobner.ml"; + "normalizer.ml"; "calc_num.ml"; "wf.ml"; "arith.ml"; "num.ml"; "pair.ml"; + "recursion.ml"; "quot.ml"; "meson.ml"; "canon.ml"; "trivia.ml"; + "class.ml"; "ind-defs.ml"; "theorems.ml"; "simp.ml"; "itab.ml"; + "tactics.ml"; "drule.ml"; "bool.ml"; "equal.ml"; "printer.ml"; + "parser.ml"; "preterm.ml"; "nets.ml"; "basics.ml"; "fusion.ml"; "lib.ml"; + "sys.ml"];; + + let the_types = [("loop", 1); ("hypermap", 1); ("net", 1); ("topology", 1); ("3", 0); + ("2", 0); ("finite_sum", 2); ("cart", 2); ("finite_image", 1); ("int", 0); + ("real", 0); ("hreal", 0); ("nadd", 0); ("char", 0); ("list", 1); + ("option", 1); ("sum", 2); ("recspace", 1); ("num", 0); ("ind", 0); + ("prod", 2); ("1", 0); ("bool", 0); ("fun", 2)];; + + let the_overload_skeletons = Snapshot_v220_7_31_2009.the_overload_skeletons;; + +end;; diff --git a/development/thales/chaff/general/flyshot2.hl b/development/thales/chaff/general/flyshot2.hl new file mode 100644 index 0000000..1afd9bf --- /dev/null +++ b/development/thales/chaff/general/flyshot2.hl @@ -0,0 +1,737 @@ + + +module Snapshot_flyspeck_build_2010_02_12 = struct + (* contains hypermap types, so must be loaded late in the build *) + let hol_version = "2.20++";; + let hol_snapshot = "7_31_09";; + let svn_version = 1524;; (* I think, I didn't make a careful record. Definitely pre-1525. *) + let the_filetable = [("general/flyspeck_utility.hl", 832); + ("general/update_database_310.ml", 832); ("hypermap/hypermap.hl", 832); + ("volume/vol1.hl", 737); ("trigonometry/trigonometry.hl", 719); + ("general/flyspeck_utility.hl", 717); ("trigonometry/trig2.hl", 717); + ("trigonometry/trig1.hl", 708); ("nonlinear/ineqdata3q1h.hl", 707); + ("nonlinear/ineq.hl", 707); ("leg/enclosed_def.hl", 707); + ("leg/quadratic_root_plus_def.hl", 706); + ("leg/abc_of_quadratic_def.hl", 705); ("leg/muR_def.hl", 704); + ("leg/collect_geom.hl", 703); ("leg/cayleyR_def.hl", 678); + ("leg/affprops.hl", 677); ("leg/AFF_SGN_TAC.hl", 677); + ("leg/geomdetail.hl", 677); ("pervasives", 673)];; + let the_constants = + [ (* ("geomdetail'simplex", `:(real^3->bool)->(real^3->bool)->bool`); *) + ("map3", `:real^3->real^3->real^3`); + ("canon", `:(A)hypermap->((A)loop->bool)->((A->bool)->bool)->bool`); + ("is_flag", `:(A)hypermap->((A->bool)->bool)->bool`); + ("is_gen_flag", `:(A)hypermap->(A->bool)->((A->bool)->bool)->bool`); + ("edge_nondegenerate", `:(A)hypermap->bool`); + ("face_collection", `:(A)hypermap->(A)loop->bool`); + ("face_loop", `:(A)hypermap->A->(A)loop`); + ("res", `:(A->A)->(A->bool)->A->A`); + ("team", `:(A)hypermap->(A)loop->(A->bool)->bool`); + ("iso", `:(A)hypermap->(B)hypermap->bool`); + ("quotient", `:(A)hypermap->((A)loop->bool)->(A->bool)hypermap`); + ("nmap", `:(A)hypermap->((A)loop->bool)->(A->bool)->A->bool`); + ("fmap", `:(A)hypermap->((A)loop->bool)->(A->bool)->A->bool`); + ("tail", `:(A)hypermap->((A)loop->bool)->A->A`); + ("head", `:(A)hypermap->((A)loop->bool)->A->A`); + ("choice", `:(A)hypermap->((A)loop->bool)->A->A->bool`); + ("support_darts", `:((A)loop->bool)->A->bool`); + ("quotient_darts", `:(A)hypermap->((A)loop->bool)->(A->bool)->bool`); + ("is_normal", `:(A)hypermap->((A)loop->bool)->bool`); + ("atom", `:(A)hypermap->(A)loop->A->A->bool`); + ("is_node_going", `:(A)hypermap->(A)loop->A->A->bool`); + ("in_path", `:(num->A)->num->A->bool`); + ("set_dart_of", `:(num->A)->num->A->bool`); + ("contour_of", `:(A)loop->A->num->A`); + ("is_loop", `:(A)hypermap->(A)loop->bool`); ("top", `:(A)loop->num`); + ("size", `:(A)loop->num`); ("inside", `:A->(A)loop->bool`); + ("back", `:(A)loop->A->A`); ("next", `:(A)loop->A->A`); + ("dart_of", `:(A)loop->A->bool`); + ("tuple_loop", `:(A)loop->(A->bool)#(A->A)`); + ("loop", `:(A->bool)#(A->A)->(A)loop`); + ("shift_path", `:(num->A)->num->num->A`); + ("is_Moebius_contour", `:(A)hypermap->(num->A)->num->bool`); + ("is_splitting_component", `:(A)hypermap->A->bool`); + ("planar_ind", `:(A)hypermap->real`); + ("is_face_split", `:(A)hypermap->A->bool`); + ("is_node_split", `:(A)hypermap->A->bool`); + ("is_edge_split", `:(A)hypermap->A->bool`); + ("is_face_merge", `:(A)hypermap->A->bool`); + ("is_node_merge", `:(A)hypermap->A->bool`); + ("is_edge_merge", `:(A)hypermap->A->bool`); + ("inj_orbit", `:(A->A)->A->num->bool`); + ("double_face_walkup", `:(A)hypermap->A->A->(A)hypermap`); + ("double_node_walkup", `:(A)hypermap->A->A->(A)hypermap`); + ("double_edge_walkup", `:(A)hypermap->A->A->(A)hypermap`); + ("face_walkup", `:(A)hypermap->A->(A)hypermap`); + ("node_walkup", `:(A)hypermap->A->(A)hypermap`); + ("edge_walkup", `:(A)hypermap->A->(A)hypermap`); + ("shift", `:(A)hypermap->(A)hypermap`); + ("is_face_degenerate", `:(A)hypermap->A->bool`); + ("is_node_degenerate", `:(A)hypermap->A->bool`); + ("is_edge_degenerate", `:(A)hypermap->A->bool`); + ("isolated_dart", `:(A)hypermap->A->bool`); + ("is_inj_contour", `:(A)hypermap->(num->A)->num->bool`); + ("face_contour", `:(A)hypermap->A->num->A`); + ("node_contour", `:(A)hypermap->A->num->A`); + ("is_contour", `:(A)hypermap->(num->A)->num->bool`); + ("one_step_contour", `:(A)hypermap->A->A->bool`); + ("face_path", `:(A)hypermap->A->num->A`); + ("node_path", `:(A)hypermap->A->num->A`); + ("edge_path", `:(A)hypermap->A->num->A`); + ("connected_hypermap", `:(A)hypermap->bool`); + ("dart_nondegenerate", `:(A)hypermap->A->bool`); + ("dart_degenerate", `:(A)hypermap->A->bool`); + ("simple_hypermap", `:(A)hypermap->bool`); + ("planar_hypermap", `:(A)hypermap->bool`); + ("plain_hypermap", `:(A)hypermap->bool`); + ("number_of_components", `:(A)hypermap->num`); + ("number_of_faces", `:(A)hypermap->num`); + ("number_of_nodes", `:(A)hypermap->num`); + ("number_of_edges", `:(A)hypermap->num`); + ("set_of_components", `:(A)hypermap->(A->bool)->bool`); + ("set_part_components", `:(A)hypermap->(A->bool)->(A->bool)->bool`); + ("set_components", `:(A)hypermap->(A->bool)->(A->bool)->bool`); + ("face_set", `:(A)hypermap->(A->bool)->bool`); + ("node_set", `:(A)hypermap->(A->bool)->bool`); + ("edge_set", `:(A)hypermap->(A->bool)->bool`); + ("number_of_orbits", `:(A->bool)->(A->A)->num`); + ("set_of_orbits", `:(A->bool)->(A->A)->(A->bool)->bool`); + ("comb_component", `:(A)hypermap->A->A->bool`); + ("is_in_component", `:(A)hypermap->A->A->bool`); + ("is_path", `:(A)hypermap->(num->A)->num->bool`); + ("go_one_step", `:(A)hypermap->A->A->bool`); + ("face", `:(A)hypermap->A->A->bool`); + ("node", `:(A)hypermap->A->A->bool`); + ("edge", `:(A)hypermap->A->A->bool`); ("face_map", `:(A)hypermap->A->A`); + ("node_map", `:(A)hypermap->A->A`); ("edge_map", `:(A)hypermap->A->A`); + ("dart", `:(A)hypermap->A->bool`); + ("tuple_hypermap", `:(A)hypermap->(A->bool)#(A->A)#(A->A)#(A->A)`); + ("hypermap", `:(A->bool)#(A->A)#(A->A)#(A->A)->(A)hypermap`); + ("orbit_map", `:(A->A)->A->A->bool`); ("POWER", `:(A->A)->num->A->A`); + ("integer_point", `:(real^3->bool)->real^3->bool`); + ("map1", `:real^3->real^3->bool`); + ("close_hinhcau", `:real^3->real->real^3->bool`); + ("set_of_ccube", `:(real^3->bool)->(real^3->bool)->bool`); + ("ccube", `:real^3->real^3->bool`); + ("vector_to_pair", `:real^3->real#real#real`); + ("int_interval", `:real->real->real->bool`); + ("map0", `:real^3->real^3->bool`); + ("union_of_int_cube", `:real^3->real->real^3->bool`); + ("int_ball", `:real^3->real->real^3->bool`); + ("union_of_cube", `:real^3->real->real^3->bool`); + ("set_of_cube", `:(real^3->bool)->(real^3->bool)->bool`); + ("hinhcau", `:real^3->real->real^3->bool`); + ("cube", `:real^3->real^3->bool`); + ("sol", `:(real^3->bool)->real^3->real`); + ("volume_prop_fix", `:((real^3->bool)->real)->bool`); + ("eventually_radial_norm", `:real^A->(real^A->bool)->bool`); + ("radial_norm", `:real->real^A->(real^A->bool)->bool`); + ("parallel", `:real^N->real^N->bool`); ("unknown", `:bool`); + ("arg_diff", `:real^2->real^2->real`); ("pl_angle", `:real^2->real`); + ("polar_cycle_on", `:(real^2->real^2)->(real^2->bool)->bool`); + ("polar_le", `:real^2->real^2->bool`); + ("polar_lt", `:real^2->real^2->bool`); ("tri_itv", `:real->bool`); + ("real_itv", `:real->real->real->bool`); + ("sinV", `:real^A->real^A->real`); ("cosV", `:real^A->real^A->real`); + ("atan2_temp", `:real#real->real`); + ("enclosed", + `:real->real->real->real->real->real->real->real->real->real`); + ("quadratic_root_plus", `:real#real#real->real`); + ("abc_of_quadratic", `:(real->real)->real#real#real`); + ("muR", + `:real->real->real->real->real->real->real->real->real->real->real`); + ("muy_v", `:real^N->real^N->real^N->real^N->real^N->real->real`); + ("muy_delta", `:real->real->real->real->real->real->real`); + ("det_vec3", `:real^3->real^3->real^3->real`); + ("condA", + `:real^3->real^3->real^3->real^3->real->real->real->real->real->A->bool`); + ("coplanar_alt", `:(real^A->bool)->bool`); + ("cayleytr", + `:real->real->real->real->real->real->real->real->real->real->real`); + ("delta_x14", `:real->real->real->real->real->real->real`); + ("delta_x13", `:real->real->real->real->real->real->real`); + ("delta_x12", `:real->real->real->real->real->real->real`); + ("coef3", `:real^N->real^N->real^N->real^N->real`); + ("coef2", `:real^N->real^N->real^N->real^N->real`); + ("coef1", `:real^N->real^N->real^N->real^N->real`); + ("c_coef", `:real->real->real->real->real->real`); + ("b_coef", `:real->real->real->real->real->real`); + ("cm3_ups_x", `:real^3->real^3->real^3->real`); + ("plane_3p", `:real^3->real^3->real^3->real^3->bool`); + ("delta_x34", `:real->real->real->real->real->real->real`); + ("plane_norm", `:(real^A->bool)->bool`); + ("ups_x_pow2", `:real->real->real->real`); + ("max_real3", `:real->real->real->real`); + ("max_real", `:real->real->real`); + ("eta_v", `:real^N->real^N->real^N->real`); + ("delta", `:real->real->real->real->real->real->real`); + ("chi", `:real->real->real->real->real->real->real`); + ("rho_ij", `:real->real->real->real->real->real->real`); + ("cayleyR", + `:real->real->real->real->real->real->real->real->real->real->real`); + ("min_dist", `:real^3->(real^3->bool)->bool`); + ("e_plane", `:real^N->real^N->real^N->bool`); + ("near2t0", `:real^A->(real^A->bool)->real^A->bool`); + ("near", `:real^N->real->(real^N->bool)->real^N->bool`); + ("VC_INFI", `:(real^3->bool)->real^3->bool`); + ("VC", `:real^3->(real^3->bool)->real^3->bool`); + ("lambda_y", `:real^3->(real^3->bool)->real^3->bool`); + ("lambda_x", `:real^3->(real^3->bool)->real^3->bool`); + ("VC_INFI_trg", `:(real^3->bool)->real^3->bool`); + ("VC_trg", `:real^3->(real^3->bool)->real^3->bool`); + ("unobstructed", `:real^3->real^3->(real^3->bool)->bool`); + ("obstruct", `:real^3->real^3->(real^3->bool)->bool`); + ("conv", `:(real^A->bool)->real^A->bool`); + ("obstructed", `:real^3->real^3->(real^3->bool)->bool`); + ("barrier", `:(real^3->bool)->(real^3->bool)->bool`); + ("Q_SYS", `:(real^3->bool)->(real^3->bool)->bool`); + ("anchor_points", `:real^3->real^3->(real^3->bool)->real^3->bool`); + ("anchor", `:real^3->real^3->real^3->(real^3->bool)->bool`); + ("isolated_pai", `:(real^3->bool)->(real^3->bool)->(real^3->bool)->bool`); + ("isolated_qua", `:(real^3->bool)->(real^3->bool)->bool`); + ("interior_pos", + `:real^3->real^3->real^3->real^3->real^3->(real^3->bool)->bool`); + ("conflicting_dia", + `:real^3->real^3->real^3->real^3->real^3->(real^3->bool)->bool`); + ("adjacent_pai", + `:real^3->real^3->real^3->real^3->real^3->(real^3->bool)->bool`); + ("quartered_oct", + `:real^3->real^3->real^3->real^3->real^3->real^3->(real^3->bool)->bool`); + ("strict_qua2", `:(real^3->bool)->(real^3->bool)->(real^3->bool)->bool`); + ("strict_qua", `:(real^3->bool)->(real^3->bool)->bool`); + ("diagonal", `:real^3->real^3->(real^3->bool)->(real^3->bool)->bool`); + ("quarter", `:(real^3->bool)->(real^3->bool)->bool`); + ("quasi_reg_tet", `:(real^3->bool)->(real^3->bool)->bool`); + ("simplex", `:(real^3->bool)->(real^3->bool)->bool`); + ("quasi_tri", `:(real^3->bool)->(real^3->bool)->bool`); ("t0", `:real`); + ("voro2", `:real^3->(real^3->bool)->real^3->bool`); + ("voronoi2", `:real^3->(real^3->bool)->real^3->bool`); + ("d3", `:real^3->real^3->real`); + ("centered_pac", `:(real^3->bool)->real^3->bool`); + ("center_pac", `:(real^3->bool)->real^3->bool`); + ("packing_trg", `:(real^3->bool)->bool`); + ("border", `:(real^A->bool)->real^A->bool`); + ("conv_trg", `:(real^A->bool)->real^A->bool`); + ("conv0_2", `:(real^A->bool)->real^A->bool`); + ("voronoi_trg", `:real^A->(real^A->bool)->real^A->bool`); + ("ineq", `:(real#real#real)list->bool->bool`); + ("abc_param", `:real^A->real^A->real^A->B->real#real#B`); + ("make_point", + `:real^3->real^3->real^3->real^3->real->real->real->real^3`); + ("ortho0", `:real^A->real^A->real^A->real^A->real^A->bool`); + ("rcone_lt", `:real^A->real^A->real->real^A->bool`); + ("eventually_radial", `:real^A->(real^A->bool)->bool`); + ("radial", `:real->real^A->(real^A->bool)->bool`); + ("null_equiv", `:(real^3->bool)#(real^3->bool)->bool`); + ("packing", `:(real^3->bool)->bool`); + ("azim_cycle", `:(real^3->bool)->real^3->real^3->real^3->real^3`); + ("projection", `:real^A->real^A->real^A`); + ("cyclic_set", `:(real^A->bool)->real^A->real^A->bool`); + ("polar_cycle", `:(real#real->bool)->real#real->real#real`); + ("cyclic_order", `:real#real->real#real->real#real->bool`); + ("radius", `:real#real->real`); + ("directed_angle", `:real#real->real#real->real`); + ("beta", `:real->real->real`); + ("euler_p", `:real^A->real^A->real^A->real^A->real`); + ("xlist", + `:real^A->real^A->real^A->real^A->real#real#real#real#real#real`); + ("ylist", + `:real^A->real^A->real^A->real^A->real#real#real#real#real#real`); + ("orientation", `:(real^A->bool)->real^A->(real->bool)->bool`); + ("radV", `:(real^A->bool)->real`); + ("circumcenter", `:(real^A->bool)->real^A`); + ("bis_lt", `:real^A->real^A->real^A->bool`); + ("bis_le", `:real^A->real^A->real^A->bool`); + ("bis", `:real^A->real^A->real^A->bool`); + ("open_half_space", `:(real^A->bool)->bool`); + ("closed_half_space", `:(real^A->bool)->bool`); + ("open_half_plane", `:(real^A->bool)->bool`); + ("closed_half_plane", `:(real^A->bool)->bool`); + ("line", `:(real^A->bool)->bool`); + ("voronoi_le", `:real^A->(real^A->bool)->real^A->bool`); + ("voronoi", `:real^A->(real^A->bool)->real^A->bool`); + ("aff", `:(real^A->bool)->real^A->bool`); + ("rad2_x", `:real->real->real->real->real->real->real`); + ("dihR", `:real->real->real->real`); ("solR", `:real->real->real->real`); + ("volR", `:real->real->real->real`); + ("arclength", `:real->real->real->real`); + ("vol_x", `:real->real->real->real->real->real->real`); + ("tauq", `:real->real->real->real->real->real->real->real->real->real`); + ("taum", `:real->real->real->real->real->real->real`); + ("lnazim", `:real->real->real->real->real->real->real`); + ("rhazim", `:real->real->real->real->real->real->real`); + ("rho", `:real->real`); ("ly", `:real->real`); ("const1", `:real`); + ("interp", `:real->real->real->real->real->real`); + ("sol_y", `:real->real->real->real->real->real->real`); + ("sol_x", `:real->real->real->real->real->real->real`); + ("dih3_x", `:real->real->real->real->real->real->real`); + ("dih2_x", `:real->real->real->real->real->real->real`); + ("dih3_y", `:real->real->real->real->real->real->real`); + ("dih2_y", `:real->real->real->real->real->real->real`); + ("dih_y", `:real->real->real->real->real->real->real`); + ("dih_x", `:real->real->real->real->real->real->real`); + ("chi_x", `:real->real->real->real->real->real->real`); + ("rho_x", `:real->real->real->real->real->real->real`); + ("eta_y", `:real->real->real->real`); + ("eta_x", `:real->real->real->real`); + ("ups_x", `:real->real->real->real`); + ("delta_x6", `:real->real->real->real->real->real->real`); + ("delta_x4", `:real->real->real->real->real->real->real`); + ("delta_y", `:real->real->real->real->real->real->real`); + ("pi_rt18", `:real`); ("sqrt2", `:real`); ("sqrt8", `:real`); + ("atn2", `:real#real->real`); ("SDIFF", `:(A->bool)->(A->bool)->A->bool`); + ("vol_ball_wedge", `:real^3->real^3->real^3->real^3->real->real`); + ("vol_rect", `:real^A->real^B->real`); + ("vol_conv", `:real^A->real^A->real^A->real^A->real`); + ("vol_conic_cap_wedge", + `:real^3->real^3->real^3->real^3->real->real->real`); + ("vol_frustt_wedge", `:real^3->real^3->real^3->real^3->real->real->real`); + ("vol_solid_triangle", `:real^A->real^A->real^A->real^A->real->real`); + ("primitive", `:(real^3->bool)->bool`); + ("circular_cone", `:(real^3->bool)->bool`); + ("c_cone", `:real^3#real^3#real->real^3->bool`); + ("sphere", `:(real^3->bool)->bool`); + ("rect", `:real^3->real^3->real^3->bool`); + ("solid_triangle", `:real^A->(real^A->bool)->real->real^A->bool`); + ("cone0", `:real^A->(real^A->bool)->real^A->bool`); + ("cone", `:real^A->(real^A->bool)->real^A->bool`); + ("dihV", `:real^A->real^A->real^A->real^A->real`); + ("opposite", `:real^N->real^N->(real^N->bool)->bool`); + ("wedge", `:real^3->real^3->real^3->real^3->real^3->bool`); + ("azim", `:real^3->real^3->real^3->real^3->real`); + ("arcV", `:real^A->real^A->real^A->real`); + ("orthonormal", `:real^3->real^3->real^3->bool`); + ("conic_cap", `:real^A->real^A->real->real->real^A->bool`); + ("ellipsoid", `:real^3->real->real^3->bool`); + ("normball", `:real^A->real->real^A->bool`); + ("scale", `:real^3->real^3->real^3`); + ("frustt", `:real^A->real^A->real->real->real^A->bool`); + ("frustum", `:real^N->real^N->real->real->real->real^N->bool`); + ("rcone_eq", `:real^A->real^A->real->real^A->bool`); + ("rcone_ge", `:real^A->real^A->real->real^A->bool`); + ("rcone_gt", `:real^A->real^A->real->real^A->bool`); + ("rconesgn", `:(real->real->bool)->real^A->real^A->real->real^A->bool`); + ("delta_x", `:real->real->real->real->real->real->real`); + ("conv0", `:(real^A->bool)->real^A->bool`); + ("aff_le", `:(real^A->bool)->(real^A->bool)->real^A->bool`); + ("aff_lt", `:(real^A->bool)->(real^A->bool)->real^A->bool`); + ("aff_ge", `:(real^A->bool)->(real^A->bool)->real^A->bool`); + ("aff_gt", `:(real^A->bool)->(real^A->bool)->real^A->bool`); + ("sgn_le", `:real->bool`); ("sgn_lt", `:real->bool`); + ("sgn_ge", `:real->bool`); ("sgn_gt", `:real->bool`); + ("affsign", `:(real->bool)->(real^A->bool)->(real^A->bool)->real^A->bool`); + ("lin_combo", `:(real^N->bool)->(real^N->real)->real^N`); + ("pad2d3d", `:real^2->real^3`); ("plane", `:(real^A->bool)->bool`); + ("slice", `:num->real->(real^A->bool)->real^B->bool`); + ("pushin", `:num->B->B^A->B^C`); ("dropout", `:num->real^N->real^M`); + ("real_measure", `:(real->bool)->real`); + ("real_measurable", `:(real->bool)->bool`); + ("has_real_measure", `:(real->bool)->real->bool`); + ("absolutely_real_integrable_on", `:(real->real)->(real->bool)->bool`); + ("real_negligible", `:(real->bool)->bool`); + ("real_integral", `:(real->bool)->(real->real)->real`); + ("real_integrable_on", `:(real->real)->(real->bool)->bool`); + ("has_real_integral", `:(real->real)->real->(real->bool)->bool`); + ("closed_real_interval", `:(real#real)list->real->bool`); + ("open_real_interval", `:real#real->real->bool`); + ("is_realinterval", `:(real->bool)->bool`); + ("real_differentiable_on", `:(real->real)->(real->bool)->bool`); + ("higher_real_derivative", `:num->(real->real)->real->real`); + ("real_derivative", `:(real->real)->real->real`); + ("real_differentiable", `:(real->real)->(real)net->bool`); + ("has_real_derivative", `:(real->real)->real->(real)net->bool`); + ("real_continuous_on", `:(real->real)->(real->bool)->bool`); + ("real_continuous", `:(A->real)->(A)net->bool`); + ("at_neginfinity", `:(real)net`); ("at_posinfinity", `:(real)net`); + ("atreal", `:real->(real)net`); + ("real_summable", `:(num->bool)->(num->real)->bool`); + ("real_infsum", `:(num->bool)->(num->real)->real`); + ("real_sums", `:(num->real)->real->(num->bool)->bool`); + ("--->", `:(A->real)->real->(A)net->bool`); + ("real_compact", `:(real->bool)->bool`); + ("real_bounded", `:(real->bool)->bool`); + ("euclideanreal", `:(real)topology`); + ("real_closed", `:(real->bool)->bool`); + ("real_open", `:(real->bool)->bool`); + ("measure", `:(real^A->bool)->real`); + ("measurable", `:(real^A->bool)->bool`); + ("has_measure", `:(real^A->bool)->real->bool`); + ("*_c", `:(A->bool)->(B->bool)->A#B->bool`); + ("+_c", `:(A->bool)->(B->bool)->A+B->bool`); + ("ordinal", `:(A#A->bool)->bool`); + ("linseg", `:(A#A->bool)->A->A#A->bool`); + ("inseg", `:(A#A->bool)->(A#A->bool)->bool`); + ("woset", `:(A#A->bool)->bool`); + ("chain", `:(A#A->bool)->(A->bool)->bool`); + ("poset", `:(A#A->bool)->bool`); ("fl", `:(A#A->bool)->A->bool`); + ("less", `:(A#A->bool)->A#A->bool`); + ("angle", `:real^A#real^A#real^A->real`); + ("vector_angle", `:real^A->real^A->real`); ("acs", `:real->real`); + ("asn", `:real->real`); ("cacs", `:real^2->real^2`); + ("casn", `:real^2->real^2`); ("atn", `:real->real`); + ("catn", `:real^2->real^2`); ("unwinding", `:real^2->real^2`); + ("cpow", `:real^2->real^2->real^2`); ("clog", `:real^2->real^2`); + ("tan", `:real->real`); ("ctan", `:real^2->real^2`); + ("rotate2d", `:real->real^2->real^2`); ("Arg", `:real^2->real`); + ("pi", `:real`); ("log", `:real->real`); ("cos", `:real->real`); + ("sin", `:real->real`); ("exp", `:real->real`); + ("csin", `:real^2->real^2`); ("ccos", `:real^2->real^2`); + ("cexp", `:real^2->real^2`); + ("analytic_on", `:(real^2->real^2)->(real^2->bool)->bool`); + ("holomorphic_on", `:(real^2->real^2)->(real^2->bool)->bool`); + ("higher_complex_derivative", `:num->(real^2->real^2)->real^2->real^2`); + ("complex_derivative", `:(real^2->real^2)->real^2->real^2`); + ("complex_differentiable", `:(real^2->real^2)->(real^2)net->bool`); + ("has_complex_derivative", `:(real^2->real^2)->real^2->(real^2)net->bool`); + ("cproduct", `:(A->bool)->(A->real^2)->real^2`); + ("real", `:real^2->bool`); ("csqrt", `:real^2->real^2`); + ("cnj", `:real^2->real^2`); ("complex_pow", `:real^2->num->real^2`); + ("complex_div", `:real^2->real^2->real^2`); + ("complex_inv", `:real^2->real^2`); + ("complex_mul", `:real^2->real^2->real^2`); ("ii", `:real^2`); + ("Cx", `:real->real^2`); ("complex", `:real#real->real^2`); + ("Im", `:real^2->real`); ("Re", `:real^2->real`); + ("absolutely_integrable_on", `:(real^B->real^A)->(real^B->bool)->bool`); + ("negligible", `:(real^A->bool)->bool`); + ("indicator", `:(real^M->bool)->real^M->real^1`); + ("division_points", + `:(real^N->bool)->((real^N->bool)->bool)->num#real->bool`); + ("lifted", `:(A->A->B)->(A)option->(A)option->(B)option`); + ("operative", `:(A->A->A)->((real^N->bool)->A)->bool`); + ("integral", `:(real^A->bool)->(real^A->real^B)->real^B`); + ("integrable_on", `:(real^B->real^A)->(real^B->bool)->bool`); + ("has_integral", `:(real^B->real^A)->real^A->(real^B->bool)->bool`); + ("has_integral_compact_interval", + `:(real^B->real^A)->real^A->(real^B->bool)->bool`); + ("fine", `:(A->B->bool)->(A#(B->bool)->bool)->bool`); + ("tagged_division_of", + `:(real^A#(real^A->bool)->bool)->(real^A->bool)->bool`); + ("tagged_partial_division_of", + `:(real^A#(real^A->bool)->bool)->(real^A->bool)->bool`); + ("division_of", `:((real^A->bool)->bool)->(real^A->bool)->bool`); + ("gauge", `:(real^A->real^A->bool)->bool`); + ("content", `:(real^M->bool)->real`); + ("interval_lowerbound", `:(real^M->bool)->real^M`); + ("interval_upperbound", `:(real^M->bool)->real^M`); + ("vector_derivative", `:(real^1->real^N)->(real^1)net->real^N`); + ("has_vector_derivative", `:(real^1->real^A)->real^A->(real^1)net->bool`); + ("jacobian", `:(real^A->real^B)->(real^A)net->real^A^B`); + ("frechet_derivative", `:(real^A->real^B)->(real^A)net->real^A->real^B`); + ("differentiable_on", `:(real^B->real^A)->(real^B->bool)->bool`); + ("differentiable", `:(real^B->real^A)->(real^B)net->bool`); + ("has_derivative", + `:(real^B->real^A)->(real^B->real^A)->(real^B)net->bool`); + ("interval_bij", `:real^N#real^N->real^N#real^N->real^N->real^N`); + ("retract_of", `:(real^A->bool)->(real^A->bool)->bool`); + ("retraction", `:(real^N->bool)#(real^N->bool)->(real^N->real^N)->bool`); + ("reduced", `:((num->num)->num->num)->num->(num->num)->num`); + ("ksimplex", `:num->num->((num->num)->bool)->bool`); + ("kle", `:num->(num->num)->(num->num)->bool`); + ("path_connected", `:(real^A->bool)->bool`); + ("path_component", `:(real^A->bool)->real^A->real^A->bool`); + ("linepath", `:real^A#real^A->real^1->real^A`); + ("shiftpath", `:real^1->(real^1->real^N)->real^1->real^N`); + ("arc", `:(real^1->real^N)->bool`); + ("simple_path", `:(real^1->real^N)->bool`); + ("++", `:(real^1->A)->(real^1->A)->real^1->A`); + ("reversepath", `:(real^1->real^N)->real^1->real^N`); + ("path_image", `:(real^1->real^N)->real^N->bool`); + ("pathfinish", `:(real^1->real^N)->real^N`); + ("pathstart", `:(real^1->real^N)->real^N`); + ("path", `:(real^1->real^N)->bool`); + ("extreme_point_of", `:real^A->(real^A->bool)->bool`); + ("face_of", `:(real^A->bool)->(real^A->bool)->bool`); + ("relative_interior", `:(real^A->bool)->real^A->bool`); + ("starlike", `:(real^A->bool)->bool`); + ("epigraph", + `:(real^N->bool)->(real^N->real)->real^(N,1)finite_sum->bool`); + ("convex_on", `:(real^A->real)->(real^A->bool)->bool`); + ("coplanar", `:(real^A->bool)->bool`); + ("affine_dependent", `:(real^N->bool)->bool`); + ("conic", `:(real^A->bool)->bool`); ("convex", `:(real^A->bool)->bool`); + ("affine", `:(real^A->bool)->bool`); + ("closest_point", `:(real^A->bool)->real^A->real^A`); + ("from", `:num->num->bool`); + ("summable", `:(num->bool)->(num->real^A)->bool`); + ("infsum", `:(num->bool)->(num->real^A)->real^A`); + ("sums", `:(num->real^A)->real^A->(num->bool)->bool`); + ("homeomorphic", `:(real^A->bool)->(real^B->bool)->bool`); + ("homeomorphism", + `:(real^B->bool)#(real^A->bool)->(real^B->real^A)#(real^A->real^B)->bool`); + ("open_segment", `:real^A#real^A->real^A->bool`); + ("closed_segment", `:(real^A#real^A)list->real^A->bool`); + ("is_interval", `:(real^N->bool)->bool`); + ("closed_interval", `:(real^N#real^N)list->real^N->bool`); + ("open_interval", `:real^N#real^N->real^N->bool`); + ("diameter", `:(real^A->bool)->real`); + ("connected_component", `:(real^A->bool)->real^A->real^A->bool`); + ("uniformly_continuous_on", `:(real^B->real^A)->(real^B->bool)->bool`); + ("continuous_on", `:(real^B->real^A)->(real^B->bool)->bool`); + ("continuous", `:(B->real^A)->(B)net->bool`); + ("complete", `:(real^N->bool)->bool`); ("cauchy", `:(num->real^N)->bool`); + ("compact", `:(real^N->bool)->bool`); + ("bounded", `:(real^N->bool)->bool`); ("netlimit", `:(A)net->A`); + ("lim", `:(A)net->(A->real^B)->real^B`); + ("-->", `:(B->real^A)->real^A->(B)net->bool`); + ("eventually", `:(A->bool)->(A)net->bool`); + ("trivial_limit", `:(A)net->bool`); + ("in_direction", `:real^A->real^A->(real^A)net`); + ("within", `:(A)net->(A->bool)->(A)net`); ("sequentially", `:(num)net`); + ("at_infinity", `:(real^A)net`); ("at", `:real^A->(real^A)net`); + ("netord", `:(A)net->A->A->bool`); ("mk_net", `:(A->A->bool)->(A)net`); + ("frontier", `:(real^A->bool)->real^A->bool`); + ("closure", `:(real^A->bool)->real^A->bool`); + ("interior", `:(real^A->bool)->real^A->bool`); + ("limit_point_of", `:real^A->(real^A->bool)->bool`); + ("connected", `:(real^A->bool)->bool`); + ("cball", `:real^A#real->real^A->bool`); + ("ball", `:real^A#real->real^A->bool`); + ("euclidean", `:(real^A)topology`); ("closed", `:(real^N->bool)->bool`); + ("open", `:(real^A->bool)->bool`); + ("subtopology", `:(A)topology->(A->bool)->(A)topology`); + ("closed_in", `:(A)topology->(A->bool)->bool`); + ("topspace", `:(A)topology->A->bool`); + ("open_in", `:(A)topology->(A->bool)->bool`); + ("topology", `:((A->bool)->bool)->(A)topology`); + ("istopology", `:((A->bool)->bool)->bool`); + ("ITER", `:num->(A->A)->A->A`); ("frac", `:real->real`); + ("floor", `:real->real`); ("integer", `:real->bool`); + ("cross", `:real^3->real^3->real^3`); + ("rotoinversion_matrix", `:real^A^A->bool`); + ("rotation_matrix", `:real^A^A->bool`); + ("orthogonal_matrix", `:real^N^N->bool`); + ("orthogonal_transformation", `:(real^N->real^N)->bool`); + ("det", `:real^N^N->real`); ("trace", `:real^N^N->real`); + ("product", `:(A->bool)->(A->real)->real`); ("sign", `:(A->A)->real`); + ("evenperm", `:(A->A)->bool`); ("permutation", `:(A->A)->bool`); + ("swapseq", `:num->(A->A)->bool`); ("swap", `:A#A->A->A`); + ("inverse", `:(B->A)->A->B`); ("permutes", `:(A->A)->(A->bool)->bool`); + ("midpoint", `:real^A#real^A->real^A`); + ("between", `:real^A->real^A#real^A->bool`); + ("collinear", `:(real^A->bool)->bool`); ("infnorm", `:real^N->real`); + ("rank", `:real^M^N->num`); ("columnvector", `:real^N->real^1^N`); + ("rowvector", `:real^N->real^N^1`); ("dim", `:(real^A->bool)->num`); + ("independent", `:(real^A->bool)->bool`); + ("dependent", `:(real^A->bool)->bool`); + ("span", `:(real^A->bool)->real^A->bool`); + ("subspace", `:(real^A->bool)->bool`); ("drop", `:real^1->real`); + ("lift", `:real->real^1`); ("onorm", `:(real^M->real^N)->real`); + ("matrix", `:(real^M->real^N)->real^M^N`); + ("matrix_inv", `:real^N^M->real^M^N`); ("invertible", `:real^N^M->bool`); + ("columns", `:real^N^M->real^M->bool`); + ("rows", `:real^N^M->real^N->bool`); ("column", `:num->real^N^M->real^M`); + ("row", `:num->real^N^M->real^N`); ("transp", `:real^N^M->real^M^N`); + ("mat", `:num->real^N^M`); + ("vector_matrix_mul", `:real^M->real^N^M->real^N`); + ("matrix_vector_mul", `:real^N^M->real^N->real^M`); + ("matrix_mul", `:real^N^M->real^P^N->real^P^M`); + ("matrix_sub", `:real^N^M->real^N^M->real^N^M`); + ("matrix_add", `:real^N^M->real^N^M->real^N^M`); + ("matrix_neg", `:real^N^M->real^N^M`); + ("adjoint", `:(real^M->real^N)->real^N->real^M`); + ("bilinear", `:(real^A->real^B->real^C)->bool`); + ("linear", `:(real^M->real^N)->bool`); + ("orthogonal", `:real^A->real^A->bool`); ("basis", `:num->real^A`); + ("vsum", `:(A->bool)->(A->real^N)->real^N`); + ("distance", `:real^A#real^A->real`); ("vector_norm", `:real^A->real`); + ("dot", `:real^N->real^N->real`); ("vec", `:num->real^N`); + ("%", `:real->real^N->real^N`); ("vector_neg", `:real^N->real^N`); + ("vector_sub", `:real^N->real^N->real^N`); + ("vector_add", `:real^N->real^N->real^N`); ("sqrt", `:real->real`); + ("hull", `:((A->bool)->bool)->(A->bool)->A->bool`); + ("inf", `:(real->bool)->real`); ("sup", `:(real->bool)->real`); + ("superadmissible", + `:(A->A->bool)->((A->C)->B->bool)->(B->A)->((A->C)->B->C)->bool`); + ("tailadmissible", + `:(A->A->bool)->((A->B)->P->bool)->(P->A)->((A->B)->P->B)->bool`); + ("admissible", + `:(B->A->bool)->((B->C)->D->bool)->(D->A)->((B->C)->D->E)->bool`); + ("CASEWISE", `:((A->C)#(B->A->D))list->B->C->D`); + ("vector", `:(A)list->A^N`); + ("dest_auto_define_finite_type_3", `:3->num`); + ("mk_auto_define_finite_type_3", `:num->3`); + ("dest_auto_define_finite_type_2", `:2->num`); + ("mk_auto_define_finite_type_2", `:num->2`); + ("sndcart", `:A^(M,N)finite_sum->A^N`); + ("fstcart", `:A^(M,N)finite_sum->A^M`); + ("pastecart", `:A^M->A^N->A^(M,N)finite_sum`); + ("dest_finite_sum", `:(A,B)finite_sum->num`); + ("mk_finite_sum", `:num->(A,B)finite_sum`); ("lambda", `:(num->A)->A^B`); + ("$", `:B^A->num->B`); ("dest_cart", `:A^B->(B)finite_image->A`); + ("mk_cart", `:((B)finite_image->A)->A^B`); + ("dest_finite_image", `:(A)finite_image->num`); + ("finite_index", `:num->(A)finite_image`); + ("dimindex", `:(A->bool)->num`); ("sum", `:(A->bool)->(A->real)->real`); + ("nsum", `:(A->bool)->(A->num)->num`); + ("iterate", `:(B->B->B)->(A->bool)->(A->B)->B`); + ("support", `:(B->B->B)->(A->B)->(A->bool)->A->bool`); + ("monoidal", `:(A->A->A)->bool`); ("neutral", `:(A->A->A)->A`); + ("..", `:num->num->num->bool`); ("COUNTABLE", `:(A->bool)->bool`); + (">_c", `:(A->bool)->(B->bool)->bool`); + (">=_c", `:(A->bool)->(B->bool)->bool`); + ("=_c", `:(A->bool)->(B->bool)->bool`); + ("<_c", `:(A->bool)->(B->bool)->bool`); + ("<=_c", `:(A->bool)->(B->bool)->bool`); + ("PAIRWISE", `:(A->A->bool)->(A)list->bool`); + ("pairwise", `:(A->A->bool)->(A->bool)->bool`); + ("list_of_set", `:(A->bool)->(A)list`); + ("set_of_list", `:(A)list->A->bool`); + ("CROSS", `:(A->bool)->(B->bool)->A#B->bool`); + ("HAS_SIZE", `:(A->bool)->num->bool`); ("CARD", `:(A->bool)->num`); + ("ITSET", `:(A->B->B)->(A->bool)->B->B`); + ("FINREC", `:(A->B->B)->B->(A->bool)->B->num->bool`); + ("REST", `:(A->bool)->A->bool`); ("CHOICE", `:(A->bool)->A`); + ("BIJ", `:(A->B)->(A->bool)->(B->bool)->bool`); + ("SURJ", `:(A->B)->(A->bool)->(B->bool)->bool`); + ("INJ", `:(A->B)->(A->bool)->(B->bool)->bool`); + ("IMAGE", `:(A->B)->(A->bool)->B->bool`); + ("INFINITE", `:(A->bool)->bool`); ("FINITE", `:(A->bool)->bool`); + ("SING", `:(A->bool)->bool`); ("DISJOINT", `:(A->bool)->(A->bool)->bool`); + ("PSUBSET", `:(A->bool)->(A->bool)->bool`); + ("SUBSET", `:(A->bool)->(A->bool)->bool`); + ("DELETE", `:(A->bool)->A->A->bool`); + ("DIFF", `:(A->bool)->(A->bool)->A->bool`); + ("INTERS", `:((A->bool)->bool)->A->bool`); + ("INTER", `:(A->bool)->(A->bool)->A->bool`); + ("UNIONS", `:((A->bool)->bool)->A->bool`); + ("UNION", `:(A->bool)->(A->bool)->A->bool`); ("UNIV", `:A->bool`); + ("INSERT", `:A->(A->bool)->A->bool`); ("EMPTY", `:A->bool`); + ("SETSPEC", `:A->bool->A->bool`); ("GSPEC", `:(A->bool)->A->bool`); + ("IN", `:A->(A->bool)->bool`); ("num_gcd", `:num#num->num`); + ("num_coprime", `:num#num->bool`); ("num_mod", `:num->num->num->bool`); + ("num_divides", `:num->num->bool`); ("num_of_int", `:int->num`); + ("int_gcd", `:int#int->int`); ("int_coprime", `:int#int->bool`); + ("int_mod", `:int->int->int->bool`); ("int_divides", `:int->int->bool`); + ("real_mod", `:real->real->real->bool`); + ("==", `:A->A->(A->A->bool)->bool`); ("rem", `:int->int->int`); + ("div", `:int->int->int`); ("int_pow", `:int->num->int`); + ("int_min", `:int->int->int`); ("int_max", `:int->int->int`); + ("int_abs", `:int->int`); ("int_mul", `:int->int->int`); + ("int_sub", `:int->int->int`); ("int_add", `:int->int->int`); + ("int_neg", `:int->int`); ("int_of_num", `:num->int`); + ("int_gt", `:int->int->bool`); ("int_ge", `:int->int->bool`); + ("int_lt", `:int->int->bool`); ("int_le", `:int->int->bool`); + ("real_of_int", `:int->real`); ("int_of_real", `:real->int`); + ("is_int", `:real->bool`); ("DECIMAL", `:num->num->real`); + ("real_min", `:real->real->real`); ("real_max", `:real->real->real`); + ("real_div", `:real->real->real`); ("real_pow", `:real->num->real`); + ("real_abs", `:real->real`); ("real_gt", `:real->real->bool`); + ("real_ge", `:real->real->bool`); ("real_lt", `:real->real->bool`); + ("real_sub", `:real->real->real`); ("real_inv", `:real->real`); + ("real_le", `:real->real->bool`); ("real_mul", `:real->real->real`); + ("real_add", `:real->real->real`); ("real_neg", `:real->real`); + ("real_of_num", `:num->real`); ("dest_real", `:real->hreal#hreal->bool`); + ("mk_real", `:(hreal#hreal->bool)->real`); + ("treal_eq", `:hreal#hreal->hreal#hreal->bool`); + ("treal_inv", `:hreal#hreal->hreal#hreal`); + ("treal_le", `:hreal#hreal->hreal#hreal->bool`); + ("treal_mul", `:hreal#hreal->hreal#hreal->hreal#hreal`); + ("treal_add", `:hreal#hreal->hreal#hreal->hreal#hreal`); + ("treal_neg", `:hreal#hreal->hreal#hreal`); + ("treal_of_num", `:num->hreal#hreal`); ("hreal_inv", `:hreal->hreal`); + ("hreal_le", `:hreal->hreal->bool`); + ("hreal_mul", `:hreal->hreal->hreal`); + ("hreal_add", `:hreal->hreal->hreal`); ("hreal_of_num", `:num->hreal`); + ("dest_hreal", `:hreal->nadd->bool`); + ("mk_hreal", `:(nadd->bool)->hreal`); ("nadd_inv", `:nadd->nadd`); + ("nadd_rinv", `:nadd->num->num`); ("nadd_mul", `:nadd->nadd->nadd`); + ("nadd_add", `:nadd->nadd->nadd`); ("nadd_le", `:nadd->nadd->bool`); + ("nadd_of_num", `:num->nadd`); ("nadd_eq", `:nadd->nadd->bool`); + ("dest_nadd", `:nadd->num->num`); ("mk_nadd", `:(num->num)->nadd`); + ("is_nadd", `:(num->num)->bool`); ("dist", `:num#num->num`); + ("ASCII", `:bool->bool->bool->bool->bool->bool->bool->bool->char`); + ("_16756", `:bool->bool->bool->bool->bool->bool->bool->bool->char`); + ("_dest_char", `:char->(bool#bool#bool#bool#bool#bool#bool#bool)recspace`); + ("_mk_char", `:(bool#bool#bool#bool#bool#bool#bool#bool)recspace->char`); + ("ZIP", `:(A)list->(B)list->(A#B)list`); + ("ITLIST2", `:(A->B->C->C)->(A)list->(B)list->C->C`); + ("ASSOC", `:A->(A#B)list->B`); ("FILTER", `:(A->bool)->(A)list->(A)list`); + ("EL", `:num->(A)list->A`); + ("MAP2", `:(A->B->C)->(A)list->(B)list->(C)list`); + ("ALL2", `:(A->B->bool)->(A)list->(B)list->bool`); + ("MEM", `:A->(A)list->bool`); ("ITLIST", `:(A->B->B)->(A)list->B->B`); + ("EX", `:(A->bool)->(A)list->bool`); ("ALL", `:(A->bool)->(A)list->bool`); + ("NULL", `:(A)list->bool`); ("REPLICATE", `:num->A->(A)list`); + ("LAST", `:(A)list->A`); ("MAP", `:(A->B)->(A)list->(B)list`); + ("LENGTH", `:(A)list->num`); ("REVERSE", `:(A)list->(A)list`); + ("APPEND", `:(A)list->(A)list->(A)list`); ("TL", `:(A)list->(A)list`); + ("HD", `:(A)list->A`); ("ISO", `:(A->B)->(B->A)->bool`); + ("CONS", `:A->(A)list->(A)list`); ("NIL", `:(A)list`); + ("_dest_list", `:(A)list->(A)recspace`); + ("_mk_list", `:(A)recspace->(A)list`); ("SOME", `:A->(A)option`); + ("NONE", `:(A)option`); ("_dest_option", `:(A)option->(A)recspace`); + ("_mk_option", `:(A)recspace->(A)option`); ("OUTR", `:A+B->B`); + ("OUTL", `:A+B->A`); ("INR", `:B->A+B`); ("INL", `:A->A+B`); + ("_dest_sum", `:A+B->(A#B)recspace`); ("_mk_sum", `:(A#B)recspace->A+B`); + ("FNIL", `:num->A`); ("FCONS", `:A->(num->A)->num->A`); + ("CONSTR", `:num->A->(num->(A)recspace)->(A)recspace`); + ("BOTTOM", `:(A)recspace`); ("_dest_rec", `:(A)recspace->num->A->bool`); + ("_mk_rec", `:(num->A->bool)->(A)recspace`); + ("ZRECSPACE", `:(num->A->bool)->bool`); ("ZBOT", `:num->A->bool`); + ("ZCONSTR", `:num->A->(num->num->A->bool)->num->A->bool`); + ("INJP", `:(num->A->bool)->(num->A->bool)->num->A->bool`); + ("INJF", `:(num->num->A->bool)->num->A->bool`); + ("INJA", `:A->num->A->bool`); ("INJN", `:num->num->A->bool`); + ("NUMRIGHT", `:num->num`); ("NUMLEFT", `:num->bool`); + ("NUMSUM", `:bool->num->num`); ("NUMSND", `:num->num`); + ("NUMFST", `:num->num`); ("NUMPAIR", `:num->num->num`); + ("MEASURE", `:(A->num)->A->A->bool`); ("WF", `:(A->A->bool)->bool`); + ("minimal", `:(num->bool)->num`); ("MIN", `:num->num->num`); + ("MAX", `:num->num->num`); ("MOD", `:num->num->num`); + ("DIV", `:num->num->num`); ("FACT", `:num->num`); ("-", `:num->num->num`); + ("ODD", `:num->bool`); ("EVEN", `:num->bool`); (">", `:num->num->bool`); + (">=", `:num->num->bool`); ("<", `:num->num->bool`); + ("<=", `:num->num->bool`); ("EXP", `:num->num->num`); + ("*", `:num->num->num`); ("BIT1", `:num->num`); ("BIT0", `:num->num`); + ("+", `:num->num->num`); ("PRE", `:num->num`); ("NUMERAL", `:num->num`); + ("SUC", `:num->num`); ("_0", `:num`); ("dest_num", `:num->ind`); + ("mk_num", `:ind->num`); ("NUM_REP", `:ind->bool`); ("IND_0", `:ind`); + ("IND_SUC", `:ind->ind`); ("ONTO", `:(A->B)->bool`); + ("ONE_ONE", `:(A->B)->bool`); ("PASSOC", `:((A#B)#C->D)->A#B#C->D`); + ("UNCURRY", `:(A->B->C)->A#B->C`); ("CURRY", `:(A#B->C)->A->B->C`); + ("SND", `:A#B->B`); ("FST", `:A#B->A`); (",", `:A->B->A#B`); + ("REP_prod", `:A#B->A->B->bool`); ("ABS_prod", `:(A->B->bool)->A#B`); + ("mk_pair", `:A->B->A->B->bool`); ("_FUNCTION", `:(A->B->bool)->A->B`); + ("_MATCH", `:A->(A->B->bool)->B`); + ("_GUARDED_PATTERN", `:bool->bool->bool->bool`); + ("_UNGUARDED_PATTERN", `:bool->bool->bool`); + ("_SEQPATTERN", `:(A->B->bool)->(A->B->bool)->A->B->bool`); + ("GEQ", `:A->A->bool`); ("GABS", `:(A->bool)->A`); ("LET_END", `:A->A`); + ("LET", `:(A->B)->A->B`); ("one", `:1`); ("one_REP", `:1->bool`); + ("one_ABS", `:bool->1`); ("I", `:A->A`); ("o", `:(B->C)->(A->B)->A->C`); + ("COND", `:bool->A->A->A`); ("@", `:(A->bool)->A`); + ("_FALSITY_", `:bool`); ("?!", `:(A->bool)->bool`); ("~", `:bool->bool`); + ("F", `:bool`); ("\\/", `:bool->bool->bool`); ("?", `:(A->bool)->bool`); + ("!", `:(A->bool)->bool`); ("==>", `:bool->bool->bool`); + ("/\\", `:bool->bool->bool`); ("T", `:bool`); ("=", `:A->A->bool`)];; + let the_loaded_files = + ["flyspeck_utility.hl"; "update_database_310.ml"; "hypermap.hl"; "vol1.hl"; + "trigonometry.hl"; "database2194fe.ml"; "flyspeck_utility.hl"; "trig2.hl"; + "trig1.hl"; "ineqdata3q1h.hl"; "ineq.hl"; "enclosed_def.hl"; + "quadratic_root_plus_def.hl"; "abc_of_quadratic_def.hl"; "muR_def.hl"; + "collect_geom.hl"; "cayleyR_def.hl"; "affprops.hl"; "AFF_SGN_TAC.hl"; + "geomdetail.hl"; "snapshot.hl"; "snapshot.hl"; "snapshot.hl"; + "snapshot.hl"; "snapshot.hl"; "sphere.hl"; "prove_by_refinement.hl"; + "update_database_310.ml"; "database3be71a.ml"; "snapshot.hl"; + "print-types.ml"; "flyspeck.ml"; "wlog_examples.ml"; "wlog.ml"; "real.ml"; + "measure.ml"; "card.ml"; "wo.ml"; "geom.ml"; "transc.ml"; "canal.ml"; + "complex.ml"; "integration.ml"; "analysis.ml"; "dimension.ml"; + "convex.ml"; "topology.ml"; "iter.ml"; "floor.ml"; "cross.ml"; + "determinants.ml"; "products.ml"; "permutations.ml"; "vectors.ml"; + "misc.ml"; "database.ml"; "help.ml"; "define.ml"; "cart.ml"; "iter.ml"; + "sets.ml"; "int.ml"; "calc_rat.ml"; "real.ml"; "realarith.ml"; + "calc_int.ml"; "realax.ml"; "list.ml"; "ind-types.ml"; "grobner.ml"; + "normalizer.ml"; "calc_num.ml"; "wf.ml"; "arith.ml"; "num.ml"; "pair.ml"; + "recursion.ml"; "quot.ml"; "meson.ml"; "canon.ml"; "trivia.ml"; + "class.ml"; "ind-defs.ml"; "theorems.ml"; "simp.ml"; "itab.ml"; + "tactics.ml"; "drule.ml"; "bool.ml"; "equal.ml"; "printer.ml"; + "parser.ml"; "preterm.ml"; "nets.ml"; "basics.ml"; "fusion.ml"; "lib.ml"; + "sys.ml"];; + let the_types = [("loop", 1); ("hypermap", 1); ("net", 1); ("topology", 1); ("3", 0); + ("2", 0); ("finite_sum", 2); ("cart", 2); ("finite_image", 1); ("int", 0); + ("real", 0); ("hreal", 0); ("nadd", 0); ("char", 0); ("list", 1); + ("option", 1); ("sum", 2); ("recspace", 1); ("num", 0); ("ind", 0); + ("prod", 2); ("1", 0); ("bool", 0); ("fun", 2)];; + let the_overload_skeletons = Snapshot_v220_7_31_2009.the_overload_skeletons;; + +end;; diff --git a/development/thales/chaff/general/flyspeck_utility.hl b/development/thales/chaff/general/flyspeck_utility.hl new file mode 100644 index 0000000..b562b48 --- /dev/null +++ b/development/thales/chaff/general/flyspeck_utility.hl @@ -0,0 +1,70 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: leg *) +(* Author: Thomas C. Hales *) +(* Date: 2010-02-10 *) +(* ========================================================================== *) + +(* +General utilities. + +*) + + + +module type Flyspeck_utility_type = sig + +(* looks up all constants first defined in a given file. + The file should be specified in the same way as the "flyspeck_needs" statement + Also, the first argument is filetable() from build.hl +*) + +val constants_by_file : (string * int) list -> string -> (string * hol_type) list + +(* inverse lookup *) + +val file_of_constant : (string * int) list -> string -> string + + +end;; + + +module Flyspeck_utility :Flyspeck_utility_type = struct + + + +(* track constants by file *) + let rec findpos c a = function + [] -> failwith "find" + | b::bs -> if Pervasives.compare a b = 0 then c else findpos (c+1) a bs;; + +let rec sublist t a b = match t with + [] -> [] + | t0::ts -> if (a>0) then sublist ts (a-1) (b-1) else if (b<=0) then [] else t0::sublist ts 0 (b-1);; + +let range_by_table c (m:(string*int)list) (s:string) = + try( + let r = assoc s m in + let i = findpos 0 (s,r) m in + let start = if (i<=0) then 0 else (let (_,j) = List.nth m (i-1) in j) in + sublist c start r) + with Failure "find" -> [];; + +let rec rev_assoc_sorted t i = match t with + [] -> failwith "find" + | (x,j)::ts -> if (i>=j) then rev_assoc_sorted ts i else x;; + + +let constants_by_file = fun (ftable:(string*int)list) s -> range_by_table (List.rev (constants())) ftable s;; + +(* Example: constants_by_file "trigonometry/trig1.hl" *) + +let file_of_constant ftable s = + let cs = map fst (List.rev (constants())) in + try (let i = findpos 0 s cs in rev_assoc_sorted (List.rev ftable) i) + with Failure "find" -> "Constant not located";; + +(* Example: file_of_constant ftable "packing" *) + +end;; diff --git a/development/thales/chaff/general/generate_definitions.ml b/development/thales/chaff/general/generate_definitions.ml new file mode 100644 index 0000000..2eacc89 --- /dev/null +++ b/development/thales/chaff/general/generate_definitions.ml @@ -0,0 +1,78 @@ +(* ------------------------------------------------------------------ *) +(* Generate Definition files from the Collection in Elementary Geometry *) +(* ------------------------------------------------------------------ *) + +open Template_hol;; + +(* let _ = set_root_dir "/flyspeck_google/source/text_formalization";; *) + +let cayleyRstr="new_definition `cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 = + -- (x14*x14*x23*x23) + &2 *x14*x15*x23*x23 - x15*x15*x23*x23 + &2 *x13*x14*x23*x24 - &2 *x13*x15*x23*x24 - &2 *x14*x15*x23*x24 + + &2 *x15*x15*x23*x24 - x13*x13*x24*x24 + &2 *x13*x15*x24*x24 - x15*x15*x24*x24 - &2 *x13*x14*x23*x25 + + &2 *x14*x14*x23*x25 + &2 *x13*x15*x23*x25 - &2 *x14*x15*x23*x25 + &2 *x13*x13*x24*x25 - &2 *x13*x14*x24*x25 - &2 *x13*x15*x24*x25 + + &2 *x14*x15*x24*x25 - x13*x13*x25*x25 + &2 *x13*x14*x25*x25 - x14*x14*x25*x25 + &2 *x12*x14*x23*x34 - &2 *x12*x15*x23*x34 - + &2 *x14*x15*x23*x34 + &2 *x15*x15*x23*x34 + &2 *x12*x13*x24*x34 - &2 *x12*x15*x24*x34 - &2 *x13*x15*x24*x34 + &2 *x15*x15*x24*x34 + + &4 *x15*x23*x24*x34 - &2 *x12*x13*x25*x34 - &2 *x12*x14*x25*x34 + &4 *x13*x14*x25*x34 + &4 *x12*x15*x25*x34 - &2 *x13*x15*x25*x34 - &2 *x14*x15*x25*x34 - + &2 *x14*x23*x25*x34 - &2 *x15*x23*x25*x34 - &2 *x13*x24*x25*x34 - &2 *x15*x24*x25*x34 + &2 *x13*x25*x25*x34 + &2 *x14*x25*x25*x34 - + x12*x12*x34*x34 + &2 *x12*x15*x34*x34 - x15*x15*x34*x34 + &2 *x12*x25*x34*x34 + &2 *x15*x25*x34*x34 - + x25*x25*x34*x34 - &2 *x12*x14*x23*x35 + &2 *x14*x14*x23*x35 + &2 *x12*x15*x23*x35 - &2 *x14*x15*x23*x35 - &2 *x12*x13*x24*x35 + + &4 *x12*x14*x24*x35 - &2 *x13*x14*x24*x35 - &2 *x12*x15*x24*x35 + &4 *x13*x15*x24*x35 - &2 *x14*x15*x24*x35 - &2 *x14*x23*x24*x35 - &2 *x15*x23*x24*x35 + + &2 *x13*x24*x24*x35 + &2 *x15*x24*x24*x35 + &2 *x12*x13*x25*x35 - &2 *x12*x14*x25*x35 - &2 *x13*x14*x25*x35 + &2 *x14*x14*x25*x35 + + &4 *x14*x23*x25*x35 - &2 *x13*x24*x25*x35 - &2 *x14*x24*x25*x35 + &2 *x12*x12*x34*x35 - &2 *x12*x14*x34*x35 - &2 *x12*x15*x34*x35 + + &2 *x14*x15*x34*x35 - &2 *x12*x24*x34*x35 - &2 *x15*x24*x34*x35 - &2 *x12*x25*x34*x35 - &2 *x14*x25*x34*x35 + &2 *x24*x25*x34*x35 - + x12*x12*x35*x35 + &2 *x12*x14*x35*x35 - x14*x14*x35*x35 + &2 *x12*x24*x35*x35 + &2 *x14*x24*x35*x35 - + x24*x24*x35*x35 + &4 *x12*x13*x23*x45 - &2 *x12*x14*x23*x45 - &2 *x13*x14*x23*x45 - &2 *x12*x15*x23*x45 - &2 *x13*x15*x23*x45 + + &4 *x14*x15*x23*x45 + &2 *x14*x23*x23*x45 + &2 *x15*x23*x23*x45 - &2 *x12*x13*x24*x45 + &2 *x13*x13*x24*x45 + &2 *x12*x15*x24*x45 - + &2 *x13*x15*x24*x45 - &2 *x13*x23*x24*x45 - &2 *x15*x23*x24*x45 - &2 *x12*x13*x25*x45 + &2 *x13*x13*x25*x45 + &2 *x12*x14*x25*x45 - + &2 *x13*x14*x25*x45 - &2 *x13*x23*x25*x45 - &2 *x14*x23*x25*x45 + &4 *x13*x24*x25*x45 + &2 *x12*x12*x34*x45 - &2 *x12*x13*x34*x45 - + &2 *x12*x15*x34*x45 + &2 *x13*x15*x34*x45 - &2 *x12*x23*x34*x45 - &2 *x15*x23*x34*x45 - &2 *x12*x25*x34*x45 - &2 *x13*x25*x34*x45 + &2 *x23*x25*x34*x45 + + &2 *x12*x12*x35*x45 - &2 *x12*x13*x35*x45 - &2 *x12*x14*x35*x45 + &2 *x13*x14*x35*x45 - &2 *x12*x23*x35*x45 - &2 *x14*x23*x35*x45 - + &2 *x12*x24*x35*x45 - &2 *x13*x24*x35*x45 + &2 *x23*x24*x35*x45 + &4 *x12*x34*x35*x45 - x12*x12*x45*x45 + &2 *x12*x13*x45*x45 - + x13*x13*x45*x45 + &2 *x12*x23*x45*x45 + &2 *x13*x23*x45*x45 - x23*x23*x45*x45` ";; + +let mkd def code comments needlist = + let ud = + {identifier=def; + chapter="LEG"; + author="Thomas C. Hales"; + date="2010-02-07"; + code=code; + comments=comments; + needlist=needlist; + } in + output_template_def ud;; + +mkd "cayleyR" cayleyRstr ["This is the 5 vertex Cayley-Menger determinant";"EDSFZOT";"NUHSVLM"; + "See http://www.math.pitt.edu/~thales/papers/Lemmas_Elementary_Geometry.pdf"; + "Properties of cayleyR have been formalized by Nguyen Quang Truong"] + [];; + +mkd "quadratic_root_plus" + " new_definition `quadratic_root_plus (a, b, c) = ( -- b + sqrt(b pow 2 - &4 * a * c))/ (&2 * a)`;;" + ["Lemmas Elementary Geometry (def:calE), RPFVZDI"] [];; + +mkd "muR" + "new_definition `muR y1 y2 y3 y4 y5 y6 y7 y8 y9 x = cayleyR (y6*y6) (y5*y5) (y1*y1) (y7*y7) (y4*y4) (y2*y2) (y8*y8) (y3*y3) (y9*y9) x`;;" + [ + "This is the cayleyR function, expressed in terms of the unsquared variables"; + "indexing: five vertices v1..v5, yij runs from vi to vj,"; + "two tetrahedra, shared face v1,v2,v3."; + "v4 v5 in opposite half-planes."; + "enclosed = y45 = sqrt(x45) is the distance from v4 to v5."; + "[y1,y2,y3,y4,y5,y6,y7,y8,y9]=[y14,y24,y34,y23,y13,y12,y15,y25,y35]."; + "y1..y6 is the usual indexing of a simplex."; + "y4..y9 is mod 6 congruent to the usual indexing."] ["leg/cayleyR_def.hl"];; + +mkd "abc_of_quadratic" + "new_definition `abc_of_quadratic f = + let c = f (&0) in + let p = f (&1) in + let n = f (-- &1) in + ((p + n)/(&2) - c, (p -n)/(&2), c)` ;;" ["f = \\x. a x^2 + b x + c, extract a b c"] [];; + +mkd "enclosed" + "new_definition `enclosed y1 y2 y3 y4 y5 y6 y7 y8 y9 = sqrt + (quadratic_root_plus (abc_of_quadratic (muR y1 y2 y3 y4 y5 y6 y7 y8 y9)))`;;" + ["The function of 9 variables defined on page 37 of the Kepler Conjecture, DCG vol 36(1), July 2006"; + "It is generally typeset as a calligraphic E"] ["leg/muR_def.hl";"leg/abc_of_quadratic_def.hl";"leg/quadratic_root_plus.hl"];; + diff --git a/development/thales/chaff/general/log.hl b/development/thales/chaff/general/log.hl new file mode 100644 index 0000000..f99c12c --- /dev/null +++ b/development/thales/chaff/general/log.hl @@ -0,0 +1,36 @@ + +module Log = struct + +type t = { + date: string; (* "yearXXXX/monthXX/dayXX" *) + hol_version: string; + hol_snapshot: string; (* yearXXmonthXXdayXX *) + svn_version: int; (* from http://code.google.com/p/flyspeck *) + ftable : (string*int) list; + comment : string; +};; + +let loglist = [ (* put newest at the beginnning *) +{ +date = "2010/01/12"; +hol_version="2.20+"; +hol_snapshot="091221"; +svn_version=1531; +ftable=[("volume/vol1.hl", 750); ("trigonometry/trigonometry.hl", 732); + ("trigonometry/trig2.hl", 730); ("trigonometry/trig1.hl", 721); + ("nonlinear/ineqdata3q1h.hl", 720); ("nonlinear/ineq.hl", 720); + ("leg/enclosed_def.hl", 720); ("leg/quadratic_root_plus_def.hl", 719); + ("leg/abc_of_quadratic_def.hl", 718); ("leg/muR_def.hl", 717); + ("leg/collect_geom.hl", 716); ("leg/cayleyR_def.hl", 691); + ("leg/affprops.hl", 690); ("leg/AFF_SGN_TAC.hl", 690); + ("leg/geomdetail.hl", 690); ("general/sphere.hl", 648); + ("general/flyspeck_utility.hl", 580); + ("general/prove_by_refinement.hl", 580); + ("general/update_database_310.ml", 580); ("general/print-types.ml", 580); + ("pervasives", 580)]; + comment = "Thales, office Mac, Virtual Box, Ubuntu, checkpointed, hypermap.hl failed"; +}; +];; + +end;; + diff --git a/development/thales/chaff/general/snapshot.hl b/development/thales/chaff/general/snapshot.hl new file mode 100644 index 0000000..301c5ea --- /dev/null +++ b/development/thales/chaff/general/snapshot.hl @@ -0,0 +1,1202 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: General *) +(* Author: Thomas C. Hales *) +(* Date: 2010-02-10 *) +(* ========================================================================== *) + +(* +store data from different HOL Light snapshots to make it easier to make +an upgrade from one snapshot to the next. +*) + + + +module type Snapshot_type = sig + val the_constants : (string * hol_type) list + val the_loaded_files : string list + val the_overload_skeletons : (string*hol_type) list + val the_interface : (string * (string * hol_type)) list + val the_types:(string*int) list +end;; + +module Snapshot_utility = struct + +(* This was used to make printable manufactured types. No more `:?467346` *) + +let clean_ty ty = + let fr = (union (tyvars ty) []) in + let alpha = map (mk_vartype o (String.make 1) o (char_of_int)) (65--(65+List.length(fr))) in + let alphafr = subtract alpha fr in + let sel = filter (fun t -> (dest_vartype t).[0]='?') fr in + type_subst (map (fun t-> (List.nth alphafr t,List.nth sel t)) (0--(List.length sel - 1))) ty;; + +(* +0;; +#print_length 10000;; +map (fun (t,u) -> (t, clean_ty u)) (constants());; +map fst !loaded_files;; +!the_overload_skeletons;; +map (fun (t,(u,v)) -> (t,(u,clean_ty v))) (!the_interface);; +types();; +#print_length 500;; +*) + +end;; + + +module Snapshot_v220_7_29_2009 : Snapshot_type = struct + + let the_types = [("net", 1); ("topology", 1); ("3", 0); ("2", 0); ("finite_sum", 2); + ("cart", 2); ("finite_image", 1); ("int", 0); ("real", 0); ("hreal", 0); + ("nadd", 0); ("char", 0); ("list", 1); ("option", 1); ("sum", 2); + ("recspace", 1); ("num", 0); ("ind", 0); ("prod", 2); ("1", 0); + ("bool", 0); ("fun", 2)];; + + let the_loaded_files = ["flyspeck.ml"; "wlog_examples.ml"; "wlog.ml"; "real.ml"; "measure.ml"; + "card.ml"; "wo.ml"; "geom.ml"; "transc.ml"; "canal.ml"; "complex.ml"; + "integration.ml"; "analysis.ml"; "dimension.ml"; "convex.ml"; + "topology.ml"; "iter.ml"; "floor.ml"; "cross.ml"; "determinants.ml"; + "products.ml"; "permutations.ml"; "vectors.ml"; "misc.ml"; "database.ml"; + "help.ml"; "define.ml"; "cart.ml"; "iter.ml"; "sets.ml"; "int.ml"; + "calc_rat.ml"; "real.ml"; "realarith.ml"; "calc_int.ml"; "realax.ml"; + "list.ml"; "ind-types.ml"; "grobner.ml"; "normalizer.ml"; "calc_num.ml"; + "wf.ml"; "arith.ml"; "num.ml"; "pair.ml"; "recursion.ml"; "quot.ml"; + "meson.ml"; "canon.ml"; "trivia.ml"; "class.ml"; "ind-defs.ml"; + "theorems.ml"; "simp.ml"; "itab.ml"; "tactics.ml"; "drule.ml"; "bool.ml"; + "equal.ml"; "printer.ml"; "parser.ml"; "preterm.ml"; "nets.ml"; + "basics.ml"; "fusion.ml"; "lib.ml"; "sys.ml"];; + + let the_overload_skeletons = + [("real_interval", `:A`); ("segment", `:A`); ("interval", `:A`); + ("**", `:A->B->C`); ("norm", `:A->real`); ("gcd", `:A#A->A`); + ("coprime", `:A#A->bool`); ("mod", `:A->A->A->bool`); + ("divides", `:A->A->bool`); ("&", `:num->A`); ("min", `:A->A->A`); + ("max", `:A->A->A`); ("abs", `:A->A`); ("inv", `:A->A`); + ("pow", `:A->num->A`); ("--", `:A->A`); (">=", `:A->A->bool`); + (">", `:A->A->bool`); ("<=", `:A->A->bool`); ("<", `:A->A->bool`); + ("/", `:A->A->A`); ("*", `:A->A->A`); ("-", `:A->A->A`); + ("+", `:A->A->A`)];; + +(* this should be regenerated. It was not captured at the right moment *) + let the_interface = + [("+", ("real_add", `:real->real->real`)); + ("-", ("real_sub", `:real->real->real`)); + ("*", ("real_mul", `:real->real->real`)); + ("/", ("real_div", `:real->real->real`)); + ("<", ("real_lt", `:real->real->bool`)); + ("<=", ("real_le", `:real->real->bool`)); + (">", ("real_gt", `:real->real->bool`)); + (">=", ("real_ge", `:real->real->bool`)); + ("--", ("real_neg", `:real->real`)); + ("pow", ("real_pow", `:real->num->real`)); + ("inv", ("real_inv", `:real->real`)); + ("abs", ("real_abs", `:real->real`)); + ("max", ("real_max", `:real->real->real`)); + ("min", ("real_min", `:real->real->real`)); + ("&", ("real_of_num", `:num->real`)); + ("mod", ("real_mod", `:real->real->real->bool`)); + ("+", ("+", `:num->num->num`)); ("-", ("-", `:num->num->num`)); + ("*", ("*", `:num->num->num`)); ("<", ("<", `:num->num->bool`)); + ("<=", ("<=", `:num->num->bool`)); (">", (">", `:num->num->bool`)); + (">=", (">=", `:num->num->bool`)); + ("divides", ("num_divides", `:num->num->bool`)); + ("mod", ("num_mod", `:num->num->num->bool`)); + ("coprime", ("num_coprime", `:num#num->bool`)); + ("gcd", ("num_gcd", `:num#num->num`)); + ("vol", ("measure", `:(real^3->bool)->real`)); + ("NULLSET", ("negligible", `:(real^3->bool)->bool`)); + ("+", ("vector_add", `:real^N->real^N->real^N`)); + ("-", ("vector_sub", `:real^N->real^N->real^N`)); + ("--", ("vector_neg", `:real^N->real^N`)); + ("norm", ("vector_norm", `:real^N->real`)); + ("**", ("vector_matrix_mul", `:real^M->real^N^M->real^N`)); + ("real_interval", + ("closed_real_interval", `:(real#real)list->real->bool`)); + ("real_interval", ("open_real_interval", `:real#real->real->bool`)); + ("inv", ("complex_inv", `:real^2->real^2`)); + ("pow", ("complex_pow", `:real^2->num->real^2`)); + ("/", ("complex_div", `:real^2->real^2->real^2`)); + ("*", ("complex_mul", `:real^2->real^2->real^2`)); + ("-", ("vector_sub", `:real^2->real^2->real^2`)); + ("+", ("vector_add", `:real^2->real^2->real^2`)); + ("--", ("vector_neg", `:real^2->real^2`)); + ("segment", ("closed_segment", `:(real^A#real^A)list->real^A->bool`)); + ("segment", ("open_segment", `:real^A#real^A->real^A->bool`)); + ("interval", ("closed_interval", `:(real^A#real^A)list->real^A->bool`)); + ("interval", ("open_interval", `:real^A#real^A->real^A->bool`)); + ("**", ("matrix_vector_mul", `:real^N^M->real^N->real^M`)); + ("**", ("matrix_mul", `:real^N^M->real^P^N->real^P^M`)); + ("-", ("matrix_sub", `:real^N^M->real^N^M->real^N^M`)); + ("+", ("matrix_add", `:real^N^M->real^N^M->real^N^M`)); + ("--", ("matrix_neg", `:real^N^M->real^N^M`)); + ("dist", ("distance", `:real^N#real^N->real`)); + ("gcd", ("int_gcd", `:int#int->int`)); + ("coprime", ("int_coprime", `:int#int->bool`)); + ("mod", ("int_mod", `:int->int->int->bool`)); + ("divides", ("int_divides", `:int->int->bool`)); + ("&", ("int_of_num", `:num->int`)); + ("min", ("int_min", `:int->int->int`)); + ("max", ("int_max", `:int->int->int`)); ("abs", ("int_abs", `:int->int`)); + ("pow", ("int_pow", `:int->num->int`)); ("--", ("int_neg", `:int->int`)); + (">=", ("int_ge", `:int->int->bool`)); + (">", ("int_gt", `:int->int->bool`)); + ("<=", ("int_le", `:int->int->bool`)); + ("<", ("int_lt", `:int->int->bool`)); + ("*", ("int_mul", `:int->int->int`)); + ("-", ("int_sub", `:int->int->int`)); + ("+", ("int_add", `:int->int->int`)); + ("&", ("hreal_of_num", `:num->hreal`)); + ("<=>", ("=", `:bool->bool->bool`))];; + + let the_constants = + [("SDIFF", `:(A->bool)->(A->bool)->A->bool`); + ("vol_ball_wedge", `:real^3->real^3->real^3->real^3->real->real`); + ("vol_rect", `:real^A->real^B->real`); + ("vol_conv", `:real^A->real^A->real^A->real^A->real`); + ("vol_conic_cap_wedge", + `:real^3->real^3->real^3->real^3->real->real->real`); + ("vol_frustt_wedge", `:real^3->real^3->real^3->real^3->real->real->real`); + ("vol_solid_triangle", `:real^A->real^A->real^A->real^A->real->real`); + ("primitive", `:(real^3->bool)->bool`); + ("circular_cone", `:(real^3->bool)->bool`); + ("c_cone", `:real^3#real^3#real->real^3->bool`); + ("sphere", `:(real^3->bool)->bool`); + ("rect", `:real^3->real^3->real^3->bool`); + ("solid_triangle", `:real^A->(real^A->bool)->real->real^A->bool`); + ("cone0", `:real^A->(real^A->bool)->real^A->bool`); + ("cone", `:real^A->(real^A->bool)->real^A->bool`); + ("dihV", `:real^A->real^A->real^A->real^A->real`); + ("opposite", `:real^N->real^N->(real^N->bool)->bool`); + ("arcV", `:real^A->real^A->real^A->real`); + ("wedge", `:real^3->real^3->real^3->real^3->real^3->bool`); + ("azim", `:real^3->real^3->real^3->real^3->real`); + ("orthonormal", `:real^3->real^3->real^3->bool`); + ("conic_cap", `:real^A->real^A->real->real->real^A->bool`); + ("ellipsoid", `:real^3->real->real^3->bool`); + ("normball", `:real^A->real->real^A->bool`); + ("scale", `:real^3->real^3->real^3`); + ("frustt", `:real^A->real^A->real->real->real^A->bool`); + ("frustum", `:real^N->real^N->real->real->real->real^N->bool`); + ("rcone_eq", `:real^A->real^A->real->real^A->bool`); + ("rcone_ge", `:real^A->real^A->real->real^A->bool`); + ("rcone_gt", `:real^A->real^A->real->real^A->bool`); + ("rconesgn", `:(real->real->bool)->real^A->real^A->real->real^A->bool`); + ("delta_x", `:real->real->real->real->real->real->real`); + ("conv0", `:(real^A->bool)->real^A->bool`); + ("aff_le", `:(real^A->bool)->(real^A->bool)->real^A->bool`); + ("aff_lt", `:(real^A->bool)->(real^A->bool)->real^A->bool`); + ("aff_ge", `:(real^A->bool)->(real^A->bool)->real^A->bool`); + ("aff_gt", `:(real^A->bool)->(real^A->bool)->real^A->bool`); + ("sgn_le", `:real->bool`); ("sgn_lt", `:real->bool`); + ("sgn_ge", `:real->bool`); ("sgn_gt", `:real->bool`); + ("affsign", `:(real->bool)->(real^A->bool)->(real^A->bool)->real^A->bool`); + ("lin_combo", `:(real^N->bool)->(real^N->real)->real^N`); + ("pad2d3d", `:real^2->real^3`); ("plane", `:(real^A->bool)->bool`); + ("slice", `:num->real->(real^A->bool)->real^B->bool`); + ("pushin", `:num->B->B^A->B^C`); ("dropout", `:num->real^N->real^M`); + ("real_measure", `:(real->bool)->real`); + ("real_measurable", `:(real->bool)->bool`); + ("has_real_measure", `:(real->bool)->real->bool`); + ("absolutely_real_integrable_on", `:(real->real)->(real->bool)->bool`); + ("real_negligible", `:(real->bool)->bool`); + ("real_integral", `:(real->bool)->(real->real)->real`); + ("real_integrable_on", `:(real->real)->(real->bool)->bool`); + ("has_real_integral", `:(real->real)->real->(real->bool)->bool`); + ("closed_real_interval", `:(real#real)list->real->bool`); + ("open_real_interval", `:real#real->real->bool`); + ("is_realinterval", `:(real->bool)->bool`); + ("real_differentiable_on", `:(real->real)->(real->bool)->bool`); + ("higher_real_derivative", `:num->(real->real)->real->real`); + ("real_derivative", `:(real->real)->real->real`); + ("real_differentiable", `:(real->real)->(real)net->bool`); + ("has_real_derivative", `:(real->real)->real->(real)net->bool`); + ("real_continuous_on", `:(real->real)->(real->bool)->bool`); + ("real_continuous", `:(A->real)->(A)net->bool`); + ("at_neginfinity", `:(real)net`); ("at_posinfinity", `:(real)net`); + ("atreal", `:real->(real)net`); + ("real_summable", `:(num->bool)->(num->real)->bool`); + ("real_infsum", `:(num->bool)->(num->real)->real`); + ("real_sums", `:(num->real)->real->(num->bool)->bool`); + ("--->", `:(A->real)->real->(A)net->bool`); + ("real_compact", `:(real->bool)->bool`); + ("real_bounded", `:(real->bool)->bool`); + ("euclideanreal", `:(real)topology`); + ("real_closed", `:(real->bool)->bool`); + ("real_open", `:(real->bool)->bool`); + ("measure", `:(real^A->bool)->real`); + ("measurable", `:(real^A->bool)->bool`); + ("has_measure", `:(real^A->bool)->real->bool`); + ("*_c", `:(A->bool)->(B->bool)->A#B->bool`); + ("+_c", `:(A->bool)->(B->bool)->A+B->bool`); + ("ordinal", `:(A#A->bool)->bool`); + ("linseg", `:(A#A->bool)->A->A#A->bool`); + ("inseg", `:(A#A->bool)->(A#A->bool)->bool`); + ("woset", `:(A#A->bool)->bool`); + ("chain", `:(A#A->bool)->(A->bool)->bool`); + ("poset", `:(A#A->bool)->bool`); ("fl", `:(A#A->bool)->A->bool`); + ("less", `:(A#A->bool)->A#A->bool`); + ("angle", `:real^A#real^A#real^A->real`); + ("vector_angle", `:real^A->real^A->real`); ("acs", `:real->real`); + ("asn", `:real->real`); ("cacs", `:real^2->real^2`); + ("casn", `:real^2->real^2`); ("atn", `:real->real`); + ("catn", `:real^2->real^2`); ("unwinding", `:real^2->real^2`); + ("cpow", `:real^2->real^2->real^2`); ("clog", `:real^2->real^2`); + ("tan", `:real->real`); ("ctan", `:real^2->real^2`); + ("rotate2d", `:real->real^2->real^2`); ("Arg", `:real^2->real`); + ("pi", `:real`); ("log", `:real->real`); ("cos", `:real->real`); + ("sin", `:real->real`); ("exp", `:real->real`); + ("csin", `:real^2->real^2`); ("ccos", `:real^2->real^2`); + ("cexp", `:real^2->real^2`); + ("analytic_on", `:(real^2->real^2)->(real^2->bool)->bool`); + ("holomorphic_on", `:(real^2->real^2)->(real^2->bool)->bool`); + ("higher_complex_derivative", `:num->(real^2->real^2)->real^2->real^2`); + ("complex_derivative", `:(real^2->real^2)->real^2->real^2`); + ("complex_differentiable", `:(real^2->real^2)->(real^2)net->bool`); + ("has_complex_derivative", `:(real^2->real^2)->real^2->(real^2)net->bool`); + ("cproduct", `:(A->bool)->(A->real^2)->real^2`); + ("real", `:real^2->bool`); ("csqrt", `:real^2->real^2`); + ("cnj", `:real^2->real^2`); ("complex_pow", `:real^2->num->real^2`); + ("complex_div", `:real^2->real^2->real^2`); + ("complex_inv", `:real^2->real^2`); + ("complex_mul", `:real^2->real^2->real^2`); ("ii", `:real^2`); + ("Cx", `:real->real^2`); ("complex", `:real#real->real^2`); + ("Im", `:real^2->real`); ("Re", `:real^2->real`); + ("absolutely_integrable_on", `:(real^B->real^A)->(real^B->bool)->bool`); + ("negligible", `:(real^A->bool)->bool`); + ("indicator", `:(real^M->bool)->real^M->real^1`); + ("division_points", + `:(real^N->bool)->((real^N->bool)->bool)->num#real->bool`); + ("lifted", `:(A->A->B)->(A)option->(A)option->(B)option`); + ("operative", `:(A->A->A)->((real^N->bool)->A)->bool`); + ("integral", `:(real^A->bool)->(real^A->real^B)->real^B`); + ("integrable_on", `:(real^B->real^A)->(real^B->bool)->bool`); + ("has_integral", `:(real^B->real^A)->real^A->(real^B->bool)->bool`); + ("has_integral_compact_interval", + `:(real^B->real^A)->real^A->(real^B->bool)->bool`); + ("fine", `:(A->B->bool)->(A#(B->bool)->bool)->bool`); + ("tagged_division_of", + `:(real^A#(real^A->bool)->bool)->(real^A->bool)->bool`); + ("tagged_partial_division_of", + `:(real^A#(real^A->bool)->bool)->(real^A->bool)->bool`); + ("division_of", `:((real^A->bool)->bool)->(real^A->bool)->bool`); + ("gauge", `:(real^A->real^A->bool)->bool`); + ("content", `:(real^M->bool)->real`); + ("interval_lowerbound", `:(real^M->bool)->real^M`); + ("interval_upperbound", `:(real^M->bool)->real^M`); + ("vector_derivative", `:(real^1->real^N)->(real^1)net->real^N`); + ("has_vector_derivative", `:(real^1->real^A)->real^A->(real^1)net->bool`); + ("jacobian", `:(real^A->real^B)->(real^A)net->real^A^B`); + ("frechet_derivative", `:(real^A->real^B)->(real^A)net->real^A->real^B`); + ("differentiable_on", `:(real^B->real^A)->(real^B->bool)->bool`); + ("differentiable", `:(real^B->real^A)->(real^B)net->bool`); + ("has_derivative", + `:(real^B->real^A)->(real^B->real^A)->(real^B)net->bool`); + ("interval_bij", `:real^N#real^N->real^N#real^N->real^N->real^N`); + ("retract_of", `:(real^A->bool)->(real^A->bool)->bool`); + ("retraction", `:(real^N->bool)#(real^N->bool)->(real^N->real^N)->bool`); + ("reduced", `:((num->num)->num->num)->num->(num->num)->num`); + ("ksimplex", `:num->num->((num->num)->bool)->bool`); + ("kle", `:num->(num->num)->(num->num)->bool`); + ("path_connected", `:(real^A->bool)->bool`); + ("path_component", `:(real^A->bool)->real^A->real^A->bool`); + ("linepath", `:real^A#real^A->real^1->real^A`); + ("shiftpath", `:real^1->(real^1->real^N)->real^1->real^N`); + ("arc", `:(real^1->real^N)->bool`); + ("simple_path", `:(real^1->real^N)->bool`); + ("++", `:(real^1->A)->(real^1->A)->real^1->A`); + ("reversepath", `:(real^1->real^N)->real^1->real^N`); + ("path_image", `:(real^1->real^N)->real^N->bool`); + ("pathfinish", `:(real^1->real^N)->real^N`); + ("pathstart", `:(real^1->real^N)->real^N`); + ("path", `:(real^1->real^N)->bool`); + ("extreme_point_of", `:real^A->(real^A->bool)->bool`); + ("face_of", `:(real^A->bool)->(real^A->bool)->bool`); + ("relative_interior", `:(real^A->bool)->real^A->bool`); + ("starlike", `:(real^A->bool)->bool`); + ("epigraph", + `:(real^N->bool)->(real^N->real)->real^(N,1)finite_sum->bool`); + ("convex_on", `:(real^A->real)->(real^A->bool)->bool`); + ("coplanar", `:(real^A->bool)->bool`); + ("affine_dependent", `:(real^N->bool)->bool`); + ("conic", `:(real^A->bool)->bool`); ("convex", `:(real^A->bool)->bool`); + ("affine", `:(real^A->bool)->bool`); + ("closest_point", `:(real^A->bool)->real^A->real^A`); + ("from", `:num->num->bool`); + ("summable", `:(num->bool)->(num->real^A)->bool`); + ("infsum", `:(num->bool)->(num->real^A)->real^A`); + ("sums", `:(num->real^A)->real^A->(num->bool)->bool`); + ("homeomorphic", `:(real^A->bool)->(real^B->bool)->bool`); + ("homeomorphism", + `:(real^B->bool)#(real^A->bool)->(real^B->real^A)#(real^A->real^B)->bool`); + ("open_segment", `:real^A#real^A->real^A->bool`); + ("closed_segment", `:(real^A#real^A)list->real^A->bool`); + ("is_interval", `:(real^N->bool)->bool`); + ("closed_interval", `:(real^N#real^N)list->real^N->bool`); + ("open_interval", `:real^N#real^N->real^N->bool`); + ("diameter", `:(real^A->bool)->real`); + ("connected_component", `:(real^A->bool)->real^A->real^A->bool`); + ("uniformly_continuous_on", `:(real^B->real^A)->(real^B->bool)->bool`); + ("continuous_on", `:(real^B->real^A)->(real^B->bool)->bool`); + ("continuous", `:(B->real^A)->(B)net->bool`); + ("complete", `:(real^N->bool)->bool`); ("cauchy", `:(num->real^N)->bool`); + ("compact", `:(real^N->bool)->bool`); + ("bounded", `:(real^N->bool)->bool`); ("netlimit", `:(A)net->A`); + ("lim", `:(A)net->(A->real^B)->real^B`); + ("-->", `:(B->real^A)->real^A->(B)net->bool`); + ("eventually", `:(A->bool)->(A)net->bool`); + ("trivial_limit", `:(A)net->bool`); + ("in_direction", `:real^A->real^A->(real^A)net`); + ("within", `:(A)net->(A->bool)->(A)net`); ("sequentially", `:(num)net`); + ("at_infinity", `:(real^A)net`); ("at", `:real^A->(real^A)net`); + ("netord", `:(A)net->A->A->bool`); ("mk_net", `:(A->A->bool)->(A)net`); + ("frontier", `:(real^A->bool)->real^A->bool`); + ("closure", `:(real^A->bool)->real^A->bool`); + ("interior", `:(real^A->bool)->real^A->bool`); + ("limit_point_of", `:real^A->(real^A->bool)->bool`); + ("connected", `:(real^A->bool)->bool`); + ("cball", `:real^A#real->real^A->bool`); + ("ball", `:real^A#real->real^A->bool`); + ("euclidean", `:(real^A)topology`); ("closed", `:(real^N->bool)->bool`); + ("open", `:(real^A->bool)->bool`); + ("subtopology", `:(A)topology->(A->bool)->(A)topology`); + ("closed_in", `:(A)topology->(A->bool)->bool`); + ("topspace", `:(A)topology->A->bool`); + ("open_in", `:(A)topology->(A->bool)->bool`); + ("topology", `:((A->bool)->bool)->(A)topology`); + ("istopology", `:((A->bool)->bool)->bool`); + ("ITER", `:num->(A->A)->A->A`); ("frac", `:real->real`); + ("floor", `:real->real`); ("integer", `:real->bool`); + ("cross", `:real^3->real^3->real^3`); + ("rotoinversion_matrix", `:real^A^A->bool`); + ("rotation_matrix", `:real^A^A->bool`); + ("orthogonal_matrix", `:real^N^N->bool`); + ("orthogonal_transformation", `:(real^N->real^N)->bool`); + ("det", `:real^N^N->real`); ("trace", `:real^N^N->real`); + ("product", `:(A->bool)->(A->real)->real`); ("sign", `:(A->A)->real`); + ("evenperm", `:(A->A)->bool`); ("permutation", `:(A->A)->bool`); + ("swapseq", `:num->(A->A)->bool`); ("swap", `:A#A->A->A`); + ("inverse", `:(B->A)->A->B`); ("permutes", `:(A->A)->(A->bool)->bool`); + ("midpoint", `:real^A#real^A->real^A`); + ("between", `:real^A->real^A#real^A->bool`); + ("collinear", `:(real^A->bool)->bool`); ("infnorm", `:real^N->real`); + ("rank", `:real^M^N->num`); ("columnvector", `:real^N->real^1^N`); + ("rowvector", `:real^N->real^N^1`); ("dim", `:(real^A->bool)->num`); + ("independent", `:(real^A->bool)->bool`); + ("dependent", `:(real^A->bool)->bool`); + ("span", `:(real^A->bool)->real^A->bool`); + ("subspace", `:(real^A->bool)->bool`); ("drop", `:real^1->real`); + ("lift", `:real->real^1`); ("onorm", `:(real^M->real^N)->real`); + ("matrix", `:(real^M->real^N)->real^M^N`); + ("matrix_inv", `:real^N^M->real^M^N`); ("invertible", `:real^N^M->bool`); + ("columns", `:real^N^M->real^M->bool`); + ("rows", `:real^N^M->real^N->bool`); ("column", `:num->real^N^M->real^M`); + ("row", `:num->real^N^M->real^N`); ("transp", `:real^N^M->real^M^N`); + ("mat", `:num->real^N^M`); + ("vector_matrix_mul", `:real^M->real^N^M->real^N`); + ("matrix_vector_mul", `:real^N^M->real^N->real^M`); + ("matrix_mul", `:real^N^M->real^P^N->real^P^M`); + ("matrix_sub", `:real^N^M->real^N^M->real^N^M`); + ("matrix_add", `:real^N^M->real^N^M->real^N^M`); + ("matrix_neg", `:real^N^M->real^N^M`); + ("adjoint", `:(real^M->real^N)->real^N->real^M`); + ("bilinear", `:(real^A->real^B->real^C)->bool`); + ("linear", `:(real^M->real^N)->bool`); + ("orthogonal", `:real^A->real^A->bool`); ("basis", `:num->real^A`); + ("vsum", `:(A->bool)->(A->real^N)->real^N`); + ("distance", `:real^A#real^A->real`); ("vector_norm", `:real^A->real`); + ("dot", `:real^N->real^N->real`); ("vec", `:num->real^N`); + ("%", `:real->real^N->real^N`); ("vector_neg", `:real^N->real^N`); + ("vector_sub", `:real^N->real^N->real^N`); + ("vector_add", `:real^N->real^N->real^N`); ("sqrt", `:real->real`); + ("hull", `:((A->bool)->bool)->(A->bool)->A->bool`); + ("inf", `:(real->bool)->real`); ("sup", `:(real->bool)->real`); + ("superadmissible", + `:(A->A->bool)->((A->C)->B->bool)->(B->A)->((A->C)->B->C)->bool`); + ("tailadmissible", + `:(A->A->bool)->((A->B)->P->bool)->(P->A)->((A->B)->P->B)->bool`); + ("admissible", + `:(B->A->bool)->((B->C)->D->bool)->(D->A)->((B->C)->D->E)->bool`); + ("CASEWISE", `:((A->C)#(B->A->D))list->B->C->D`); + ("vector", `:(A)list->A^N`); + ("dest_auto_define_finite_type_3", `:3->num`); + ("mk_auto_define_finite_type_3", `:num->3`); + ("dest_auto_define_finite_type_2", `:2->num`); + ("mk_auto_define_finite_type_2", `:num->2`); + ("sndcart", `:A^(M,N)finite_sum->A^N`); + ("fstcart", `:A^(M,N)finite_sum->A^M`); + ("pastecart", `:A^M->A^N->A^(M,N)finite_sum`); + ("dest_finite_sum", `:(A,B)finite_sum->num`); + ("mk_finite_sum", `:num->(A,B)finite_sum`); ("lambda", `:(num->A)->A^B`); + ("$", `:B^A->num->B`); ("dest_cart", `:A^B->(B)finite_image->A`); + ("mk_cart", `:((B)finite_image->A)->A^B`); + ("dest_finite_image", `:(A)finite_image->num`); + ("finite_index", `:num->(A)finite_image`); + ("dimindex", `:(A->bool)->num`); ("sum", `:(A->bool)->(A->real)->real`); + ("nsum", `:(A->bool)->(A->num)->num`); + ("iterate", `:(B->B->B)->(A->bool)->(A->B)->B`); + ("support", `:(B->B->B)->(A->B)->(A->bool)->A->bool`); + ("monoidal", `:(A->A->A)->bool`); ("neutral", `:(A->A->A)->A`); + ("..", `:num->num->num->bool`); ("COUNTABLE", `:(A->bool)->bool`); + (">_c", `:(A->bool)->(B->bool)->bool`); + (">=_c", `:(A->bool)->(B->bool)->bool`); + ("=_c", `:(A->bool)->(B->bool)->bool`); + ("<_c", `:(A->bool)->(B->bool)->bool`); + ("<=_c", `:(A->bool)->(B->bool)->bool`); + ("PAIRWISE", `:(A->A->bool)->(A)list->bool`); + ("pairwise", `:(A->A->bool)->(A->bool)->bool`); + ("list_of_set", `:(A->bool)->(A)list`); + ("set_of_list", `:(A)list->A->bool`); + ("CROSS", `:(A->bool)->(B->bool)->A#B->bool`); + ("HAS_SIZE", `:(A->bool)->num->bool`); ("CARD", `:(A->bool)->num`); + ("ITSET", `:(A->B->B)->(A->bool)->B->B`); + ("FINREC", `:(A->B->B)->B->(A->bool)->B->num->bool`); + ("REST", `:(A->bool)->A->bool`); ("CHOICE", `:(A->bool)->A`); + ("BIJ", `:(A->B)->(A->bool)->(B->bool)->bool`); + ("SURJ", `:(A->B)->(A->bool)->(B->bool)->bool`); + ("INJ", `:(A->B)->(A->bool)->(B->bool)->bool`); + ("IMAGE", `:(A->B)->(A->bool)->B->bool`); + ("INFINITE", `:(A->bool)->bool`); ("FINITE", `:(A->bool)->bool`); + ("SING", `:(A->bool)->bool`); ("DISJOINT", `:(A->bool)->(A->bool)->bool`); + ("PSUBSET", `:(A->bool)->(A->bool)->bool`); + ("SUBSET", `:(A->bool)->(A->bool)->bool`); + ("DELETE", `:(A->bool)->A->A->bool`); + ("DIFF", `:(A->bool)->(A->bool)->A->bool`); + ("INTERS", `:((A->bool)->bool)->A->bool`); + ("INTER", `:(A->bool)->(A->bool)->A->bool`); + ("UNIONS", `:((A->bool)->bool)->A->bool`); + ("UNION", `:(A->bool)->(A->bool)->A->bool`); ("UNIV", `:A->bool`); + ("INSERT", `:A->(A->bool)->A->bool`); ("EMPTY", `:A->bool`); + ("SETSPEC", `:A->bool->A->bool`); ("GSPEC", `:(A->bool)->A->bool`); + ("IN", `:A->(A->bool)->bool`); ("num_gcd", `:num#num->num`); + ("num_coprime", `:num#num->bool`); ("num_mod", `:num->num->num->bool`); + ("num_divides", `:num->num->bool`); ("num_of_int", `:int->num`); + ("int_gcd", `:int#int->int`); ("int_coprime", `:int#int->bool`); + ("int_mod", `:int->int->int->bool`); ("int_divides", `:int->int->bool`); + ("real_mod", `:real->real->real->bool`); + ("==", `:A->A->(A->A->bool)->bool`); ("rem", `:int->int->int`); + ("div", `:int->int->int`); ("int_pow", `:int->num->int`); + ("int_min", `:int->int->int`); ("int_max", `:int->int->int`); + ("int_abs", `:int->int`); ("int_mul", `:int->int->int`); + ("int_sub", `:int->int->int`); ("int_add", `:int->int->int`); + ("int_neg", `:int->int`); ("int_of_num", `:num->int`); + ("int_gt", `:int->int->bool`); ("int_ge", `:int->int->bool`); + ("int_lt", `:int->int->bool`); ("int_le", `:int->int->bool`); + ("real_of_int", `:int->real`); ("int_of_real", `:real->int`); + ("is_int", `:real->bool`); ("DECIMAL", `:num->num->real`); + ("real_min", `:real->real->real`); ("real_max", `:real->real->real`); + ("real_div", `:real->real->real`); ("real_pow", `:real->num->real`); + ("real_abs", `:real->real`); ("real_gt", `:real->real->bool`); + ("real_ge", `:real->real->bool`); ("real_lt", `:real->real->bool`); + ("real_sub", `:real->real->real`); ("real_inv", `:real->real`); + ("real_le", `:real->real->bool`); ("real_mul", `:real->real->real`); + ("real_add", `:real->real->real`); ("real_neg", `:real->real`); + ("real_of_num", `:num->real`); ("dest_real", `:real->hreal#hreal->bool`); + ("mk_real", `:(hreal#hreal->bool)->real`); + ("treal_eq", `:hreal#hreal->hreal#hreal->bool`); + ("treal_inv", `:hreal#hreal->hreal#hreal`); + ("treal_le", `:hreal#hreal->hreal#hreal->bool`); + ("treal_mul", `:hreal#hreal->hreal#hreal->hreal#hreal`); + ("treal_add", `:hreal#hreal->hreal#hreal->hreal#hreal`); + ("treal_neg", `:hreal#hreal->hreal#hreal`); + ("treal_of_num", `:num->hreal#hreal`); ("hreal_inv", `:hreal->hreal`); + ("hreal_le", `:hreal->hreal->bool`); + ("hreal_mul", `:hreal->hreal->hreal`); + ("hreal_add", `:hreal->hreal->hreal`); ("hreal_of_num", `:num->hreal`); + ("dest_hreal", `:hreal->nadd->bool`); + ("mk_hreal", `:(nadd->bool)->hreal`); ("nadd_inv", `:nadd->nadd`); + ("nadd_rinv", `:nadd->num->num`); ("nadd_mul", `:nadd->nadd->nadd`); + ("nadd_add", `:nadd->nadd->nadd`); ("nadd_le", `:nadd->nadd->bool`); + ("nadd_of_num", `:num->nadd`); ("nadd_eq", `:nadd->nadd->bool`); + ("dest_nadd", `:nadd->num->num`); ("mk_nadd", `:(num->num)->nadd`); + ("is_nadd", `:(num->num)->bool`); ("dist", `:num#num->num`); + ("ASCII", `:bool->bool->bool->bool->bool->bool->bool->bool->char`); + ("_16756", `:bool->bool->bool->bool->bool->bool->bool->bool->char`); + ("_dest_char", `:char->(bool#bool#bool#bool#bool#bool#bool#bool)recspace`); + ("_mk_char", `:(bool#bool#bool#bool#bool#bool#bool#bool)recspace->char`); + ("ZIP", `:(A)list->(B)list->(A#B)list`); + ("ITLIST2", `:(A->B->C->C)->(A)list->(B)list->C->C`); + ("ASSOC", `:A->(A#B)list->B`); ("FILTER", `:(A->bool)->(A)list->(A)list`); + ("EL", `:num->(A)list->A`); + ("MAP2", `:(A->B->C)->(A)list->(B)list->(C)list`); + ("ALL2", `:(A->B->bool)->(A)list->(B)list->bool`); + ("MEM", `:A->(A)list->bool`); ("ITLIST", `:(A->B->B)->(A)list->B->B`); + ("EX", `:(A->bool)->(A)list->bool`); ("ALL", `:(A->bool)->(A)list->bool`); + ("NULL", `:(A)list->bool`); ("REPLICATE", `:num->A->(A)list`); + ("LAST", `:(A)list->A`); ("MAP", `:(A->B)->(A)list->(B)list`); + ("LENGTH", `:(A)list->num`); ("REVERSE", `:(A)list->(A)list`); + ("APPEND", `:(A)list->(A)list->(A)list`); ("TL", `:(A)list->(A)list`); + ("HD", `:(A)list->A`); ("ISO", `:(A->B)->(B->A)->bool`); + ("CONS", `:A->(A)list->(A)list`); ("NIL", `:(A)list`); + ("_dest_list", `:(A)list->(A)recspace`); + ("_mk_list", `:(A)recspace->(A)list`); ("SOME", `:A->(A)option`); + ("NONE", `:(A)option`); ("_dest_option", `:(A)option->(A)recspace`); + ("_mk_option", `:(A)recspace->(A)option`); ("OUTR", `:A+B->B`); + ("OUTL", `:A+B->A`); ("INR", `:B->A+B`); ("INL", `:A->A+B`); + ("_dest_sum", `:A+B->(A#B)recspace`); ("_mk_sum", `:(A#B)recspace->A+B`); + ("FNIL", `:num->A`); ("FCONS", `:A->(num->A)->num->A`); + ("CONSTR", `:num->A->(num->(A)recspace)->(A)recspace`); + ("BOTTOM", `:(A)recspace`); ("_dest_rec", `:(A)recspace->num->A->bool`); + ("_mk_rec", `:(num->A->bool)->(A)recspace`); + ("ZRECSPACE", `:(num->A->bool)->bool`); ("ZBOT", `:num->A->bool`); + ("ZCONSTR", `:num->A->(num->num->A->bool)->num->A->bool`); + ("INJP", `:(num->A->bool)->(num->A->bool)->num->A->bool`); + ("INJF", `:(num->num->A->bool)->num->A->bool`); + ("INJA", `:A->num->A->bool`); ("INJN", `:num->num->A->bool`); + ("NUMRIGHT", `:num->num`); ("NUMLEFT", `:num->bool`); + ("NUMSUM", `:bool->num->num`); ("NUMSND", `:num->num`); + ("NUMFST", `:num->num`); ("NUMPAIR", `:num->num->num`); + ("MEASURE", `:(A->num)->A->A->bool`); ("WF", `:(A->A->bool)->bool`); + ("minimal", `:(num->bool)->num`); ("MIN", `:num->num->num`); + ("MAX", `:num->num->num`); ("MOD", `:num->num->num`); + ("DIV", `:num->num->num`); ("FACT", `:num->num`); ("-", `:num->num->num`); + ("ODD", `:num->bool`); ("EVEN", `:num->bool`); (">", `:num->num->bool`); + (">=", `:num->num->bool`); ("<", `:num->num->bool`); + ("<=", `:num->num->bool`); ("EXP", `:num->num->num`); + ("*", `:num->num->num`); ("BIT1", `:num->num`); ("BIT0", `:num->num`); + ("+", `:num->num->num`); ("PRE", `:num->num`); ("NUMERAL", `:num->num`); + ("SUC", `:num->num`); ("_0", `:num`); ("dest_num", `:num->ind`); + ("mk_num", `:ind->num`); ("NUM_REP", `:ind->bool`); ("IND_0", `:ind`); + ("IND_SUC", `:ind->ind`); ("ONTO", `:(A->B)->bool`); + ("ONE_ONE", `:(A->B)->bool`); ("PASSOC", `:((A#B)#C->D)->A#B#C->D`); + ("UNCURRY", `:(A->B->C)->A#B->C`); ("CURRY", `:(A#B->C)->A->B->C`); + ("SND", `:A#B->B`); ("FST", `:A#B->A`); (",", `:A->B->A#B`); + ("REP_prod", `:A#B->A->B->bool`); ("ABS_prod", `:(A->B->bool)->A#B`); + ("mk_pair", `:A->B->A->B->bool`); ("_FUNCTION", `:(A->B->bool)->A->B`); + ("_MATCH", `:A->(A->B->bool)->B`); + ("_GUARDED_PATTERN", `:bool->bool->bool->bool`); + ("_UNGUARDED_PATTERN", `:bool->bool->bool`); + ("_SEQPATTERN", `:(A->B->bool)->(A->B->bool)->A->B->bool`); + ("GEQ", `:A->A->bool`); ("GABS", `:(A->bool)->A`); ("LET_END", `:A->A`); + ("LET", `:(A->B)->A->B`); ("one", `:1`); ("one_REP", `:1->bool`); + ("one_ABS", `:bool->1`); ("I", `:A->A`); ("o", `:(B->C)->(A->B)->A->C`); + ("COND", `:bool->A->A->A`); ("@", `:(A->bool)->A`); + ("_FALSITY_", `:bool`); ("?!", `:(A->bool)->bool`); ("~", `:bool->bool`); + ("F", `:bool`); ("\\/", `:bool->bool->bool`); ("?", `:(A->bool)->bool`); + ("!", `:(A->bool)->bool`); ("==>", `:bool->bool->bool`); + ("/\\", `:bool->bool->bool`); ("T", `:bool`); ("=", `:A->A->bool`)];; + +end;; + + +module Snapshot_v220_7_31_2009 : Snapshot_type = struct + + let the_constants = + [("SDIFF", `:(A->bool)->(A->bool)->A->bool`); + ("vol_ball_wedge", `:real^3->real^3->real^3->real^3->real->real`); + ("vol_rect", `:real^A->real^B->real`); + ("vol_conv", `:real^A->real^A->real^A->real^A->real`); + ("vol_conic_cap_wedge", + `:real^3->real^3->real^3->real^3->real->real->real`); + ("vol_frustt_wedge", `:real^3->real^3->real^3->real^3->real->real->real`); + ("vol_solid_triangle", `:real^A->real^A->real^A->real^A->real->real`); + ("primitive", `:(real^3->bool)->bool`); + ("circular_cone", `:(real^3->bool)->bool`); + ("c_cone", `:real^3#real^3#real->real^3->bool`); + ("sphere", `:(real^3->bool)->bool`); + ("rect", `:real^3->real^3->real^3->bool`); + ("solid_triangle", `:real^A->(real^A->bool)->real->real^A->bool`); + ("cone0", `:real^A->(real^A->bool)->real^A->bool`); + ("cone", `:real^A->(real^A->bool)->real^A->bool`); + ("dihV", `:real^A->real^A->real^A->real^A->real`); + ("opposite", `:real^N->real^N->(real^N->bool)->bool`); + ("wedge", `:real^3->real^3->real^3->real^3->real^3->bool`); + ("azim", `:real^3->real^3->real^3->real^3->real`); + ("arcV", `:real^A->real^A->real^A->real`); + ("orthonormal", `:real^3->real^3->real^3->bool`); + ("conic_cap", `:real^A->real^A->real->real->real^A->bool`); + ("ellipsoid", `:real^3->real->real^3->bool`); + ("normball", `:real^A->real->real^A->bool`); + ("scale", `:real^3->real^3->real^3`); + ("frustt", `:real^A->real^A->real->real->real^A->bool`); + ("frustum", `:real^N->real^N->real->real->real->real^N->bool`); + ("rcone_eq", `:real^A->real^A->real->real^A->bool`); + ("rcone_ge", `:real^A->real^A->real->real^A->bool`); + ("rcone_gt", `:real^A->real^A->real->real^A->bool`); + ("rconesgn", `:(real->real->bool)->real^A->real^A->real->real^A->bool`); + ("delta_x", `:real->real->real->real->real->real->real`); + ("conv0", `:(real^A->bool)->real^A->bool`); + ("aff_le", `:(real^A->bool)->(real^A->bool)->real^A->bool`); + ("aff_lt", `:(real^A->bool)->(real^A->bool)->real^A->bool`); + ("aff_ge", `:(real^A->bool)->(real^A->bool)->real^A->bool`); + ("aff_gt", `:(real^A->bool)->(real^A->bool)->real^A->bool`); + ("sgn_le", `:real->bool`); ("sgn_lt", `:real->bool`); + ("sgn_ge", `:real->bool`); ("sgn_gt", `:real->bool`); + ("affsign", `:(real->bool)->(real^A->bool)->(real^A->bool)->real^A->bool`); + ("lin_combo", `:(real^N->bool)->(real^N->real)->real^N`); + ("pad2d3d", `:real^2->real^3`); ("plane", `:(real^A->bool)->bool`); + ("slice", `:num->real->(real^A->bool)->real^B->bool`); + ("pushin", `:num->B->B^A->B^C`); ("dropout", `:num->real^N->real^M`); + ("real_measure", `:(real->bool)->real`); + ("real_measurable", `:(real->bool)->bool`); + ("has_real_measure", `:(real->bool)->real->bool`); + ("absolutely_real_integrable_on", `:(real->real)->(real->bool)->bool`); + ("real_negligible", `:(real->bool)->bool`); + ("real_integral", `:(real->bool)->(real->real)->real`); + ("real_integrable_on", `:(real->real)->(real->bool)->bool`); + ("has_real_integral", `:(real->real)->real->(real->bool)->bool`); + ("closed_real_interval", `:(real#real)list->real->bool`); + ("open_real_interval", `:real#real->real->bool`); + ("is_realinterval", `:(real->bool)->bool`); + ("real_differentiable_on", `:(real->real)->(real->bool)->bool`); + ("higher_real_derivative", `:num->(real->real)->real->real`); + ("real_derivative", `:(real->real)->real->real`); + ("real_differentiable", `:(real->real)->(real)net->bool`); + ("has_real_derivative", `:(real->real)->real->(real)net->bool`); + ("real_continuous_on", `:(real->real)->(real->bool)->bool`); + ("real_continuous", `:(A->real)->(A)net->bool`); + ("at_neginfinity", `:(real)net`); ("at_posinfinity", `:(real)net`); + ("atreal", `:real->(real)net`); + ("real_summable", `:(num->bool)->(num->real)->bool`); + ("real_infsum", `:(num->bool)->(num->real)->real`); + ("real_sums", `:(num->real)->real->(num->bool)->bool`); + ("--->", `:(A->real)->real->(A)net->bool`); + ("real_compact", `:(real->bool)->bool`); + ("real_bounded", `:(real->bool)->bool`); + ("euclideanreal", `:(real)topology`); + ("real_closed", `:(real->bool)->bool`); + ("real_open", `:(real->bool)->bool`); + ("measure", `:(real^A->bool)->real`); + ("measurable", `:(real^A->bool)->bool`); + ("has_measure", `:(real^A->bool)->real->bool`); + ("*_c", `:(A->bool)->(B->bool)->A#B->bool`); + ("+_c", `:(A->bool)->(B->bool)->A+B->bool`); + ("ordinal", `:(A#A->bool)->bool`); + ("linseg", `:(A#A->bool)->A->A#A->bool`); + ("inseg", `:(A#A->bool)->(A#A->bool)->bool`); + ("woset", `:(A#A->bool)->bool`); + ("chain", `:(A#A->bool)->(A->bool)->bool`); + ("poset", `:(A#A->bool)->bool`); ("fl", `:(A#A->bool)->A->bool`); + ("less", `:(A#A->bool)->A#A->bool`); + ("angle", `:real^A#real^A#real^A->real`); + ("vector_angle", `:real^A->real^A->real`); ("acs", `:real->real`); + ("asn", `:real->real`); ("cacs", `:real^2->real^2`); + ("casn", `:real^2->real^2`); ("atn", `:real->real`); + ("catn", `:real^2->real^2`); ("unwinding", `:real^2->real^2`); + ("cpow", `:real^2->real^2->real^2`); ("clog", `:real^2->real^2`); + ("tan", `:real->real`); ("ctan", `:real^2->real^2`); + ("rotate2d", `:real->real^2->real^2`); ("Arg", `:real^2->real`); + ("pi", `:real`); ("log", `:real->real`); ("cos", `:real->real`); + ("sin", `:real->real`); ("exp", `:real->real`); + ("csin", `:real^2->real^2`); ("ccos", `:real^2->real^2`); + ("cexp", `:real^2->real^2`); + ("analytic_on", `:(real^2->real^2)->(real^2->bool)->bool`); + ("holomorphic_on", `:(real^2->real^2)->(real^2->bool)->bool`); + ("higher_complex_derivative", `:num->(real^2->real^2)->real^2->real^2`); + ("complex_derivative", `:(real^2->real^2)->real^2->real^2`); + ("complex_differentiable", `:(real^2->real^2)->(real^2)net->bool`); + ("has_complex_derivative", `:(real^2->real^2)->real^2->(real^2)net->bool`); + ("cproduct", `:(A->bool)->(A->real^2)->real^2`); + ("real", `:real^2->bool`); ("csqrt", `:real^2->real^2`); + ("cnj", `:real^2->real^2`); ("complex_pow", `:real^2->num->real^2`); + ("complex_div", `:real^2->real^2->real^2`); + ("complex_inv", `:real^2->real^2`); + ("complex_mul", `:real^2->real^2->real^2`); ("ii", `:real^2`); + ("Cx", `:real->real^2`); ("complex", `:real#real->real^2`); + ("Im", `:real^2->real`); ("Re", `:real^2->real`); + ("absolutely_integrable_on", `:(real^B->real^A)->(real^B->bool)->bool`); + ("negligible", `:(real^A->bool)->bool`); + ("indicator", `:(real^M->bool)->real^M->real^1`); + ("division_points", + `:(real^N->bool)->((real^N->bool)->bool)->num#real->bool`); + ("lifted", `:(A->A->B)->(A)option->(A)option->(B)option`); + ("operative", `:(A->A->A)->((real^N->bool)->A)->bool`); + ("integral", `:(real^A->bool)->(real^A->real^B)->real^B`); + ("integrable_on", `:(real^B->real^A)->(real^B->bool)->bool`); + ("has_integral", `:(real^B->real^A)->real^A->(real^B->bool)->bool`); + ("has_integral_compact_interval", + `:(real^B->real^A)->real^A->(real^B->bool)->bool`); + ("fine", `:(A->B->bool)->(A#(B->bool)->bool)->bool`); + ("tagged_division_of", + `:(real^A#(real^A->bool)->bool)->(real^A->bool)->bool`); + ("tagged_partial_division_of", + `:(real^A#(real^A->bool)->bool)->(real^A->bool)->bool`); + ("division_of", `:((real^A->bool)->bool)->(real^A->bool)->bool`); + ("gauge", `:(real^A->real^A->bool)->bool`); + ("content", `:(real^M->bool)->real`); + ("interval_lowerbound", `:(real^M->bool)->real^M`); + ("interval_upperbound", `:(real^M->bool)->real^M`); + ("vector_derivative", `:(real^1->real^N)->(real^1)net->real^N`); + ("has_vector_derivative", `:(real^1->real^A)->real^A->(real^1)net->bool`); + ("jacobian", `:(real^A->real^B)->(real^A)net->real^A^B`); + ("frechet_derivative", `:(real^A->real^B)->(real^A)net->real^A->real^B`); + ("differentiable_on", `:(real^B->real^A)->(real^B->bool)->bool`); + ("differentiable", `:(real^B->real^A)->(real^B)net->bool`); + ("has_derivative", + `:(real^B->real^A)->(real^B->real^A)->(real^B)net->bool`); + ("interval_bij", `:real^N#real^N->real^N#real^N->real^N->real^N`); + ("retract_of", `:(real^A->bool)->(real^A->bool)->bool`); + ("retraction", `:(real^N->bool)#(real^N->bool)->(real^N->real^N)->bool`); + ("reduced", `:((num->num)->num->num)->num->(num->num)->num`); + ("ksimplex", `:num->num->((num->num)->bool)->bool`); + ("kle", `:num->(num->num)->(num->num)->bool`); + ("path_connected", `:(real^A->bool)->bool`); + ("path_component", `:(real^A->bool)->real^A->real^A->bool`); + ("linepath", `:real^A#real^A->real^1->real^A`); + ("shiftpath", `:real^1->(real^1->real^N)->real^1->real^N`); + ("arc", `:(real^1->real^N)->bool`); + ("simple_path", `:(real^1->real^N)->bool`); + ("++", `:(real^1->A)->(real^1->A)->real^1->A`); + ("reversepath", `:(real^1->real^N)->real^1->real^N`); + ("path_image", `:(real^1->real^N)->real^N->bool`); + ("pathfinish", `:(real^1->real^N)->real^N`); + ("pathstart", `:(real^1->real^N)->real^N`); + ("path", `:(real^1->real^N)->bool`); + ("extreme_point_of", `:real^A->(real^A->bool)->bool`); + ("face_of", `:(real^A->bool)->(real^A->bool)->bool`); + ("relative_interior", `:(real^A->bool)->real^A->bool`); + ("starlike", `:(real^A->bool)->bool`); + ("epigraph", + `:(real^N->bool)->(real^N->real)->real^(N,1)finite_sum->bool`); + ("convex_on", `:(real^A->real)->(real^A->bool)->bool`); + ("coplanar", `:(real^A->bool)->bool`); + ("affine_dependent", `:(real^N->bool)->bool`); + ("conic", `:(real^A->bool)->bool`); ("convex", `:(real^A->bool)->bool`); + ("affine", `:(real^A->bool)->bool`); + ("closest_point", `:(real^A->bool)->real^A->real^A`); + ("from", `:num->num->bool`); + ("summable", `:(num->bool)->(num->real^A)->bool`); + ("infsum", `:(num->bool)->(num->real^A)->real^A`); + ("sums", `:(num->real^A)->real^A->(num->bool)->bool`); + ("homeomorphic", `:(real^A->bool)->(real^B->bool)->bool`); + ("homeomorphism", + `:(real^B->bool)#(real^A->bool)->(real^B->real^A)#(real^A->real^B)->bool`); + ("open_segment", `:real^A#real^A->real^A->bool`); + ("closed_segment", `:(real^A#real^A)list->real^A->bool`); + ("is_interval", `:(real^N->bool)->bool`); + ("closed_interval", `:(real^N#real^N)list->real^N->bool`); + ("open_interval", `:real^N#real^N->real^N->bool`); + ("diameter", `:(real^A->bool)->real`); + ("connected_component", `:(real^A->bool)->real^A->real^A->bool`); + ("uniformly_continuous_on", `:(real^B->real^A)->(real^B->bool)->bool`); + ("continuous_on", `:(real^B->real^A)->(real^B->bool)->bool`); + ("continuous", `:(B->real^A)->(B)net->bool`); + ("complete", `:(real^N->bool)->bool`); ("cauchy", `:(num->real^N)->bool`); + ("compact", `:(real^N->bool)->bool`); + ("bounded", `:(real^N->bool)->bool`); ("netlimit", `:(A)net->A`); + ("lim", `:(A)net->(A->real^B)->real^B`); + ("-->", `:(B->real^A)->real^A->(B)net->bool`); + ("eventually", `:(A->bool)->(A)net->bool`); + ("trivial_limit", `:(A)net->bool`); + ("in_direction", `:real^A->real^A->(real^A)net`); + ("within", `:(A)net->(A->bool)->(A)net`); ("sequentially", `:(num)net`); + ("at_infinity", `:(real^A)net`); ("at", `:real^A->(real^A)net`); + ("netord", `:(A)net->A->A->bool`); ("mk_net", `:(A->A->bool)->(A)net`); + ("frontier", `:(real^A->bool)->real^A->bool`); + ("closure", `:(real^A->bool)->real^A->bool`); + ("interior", `:(real^A->bool)->real^A->bool`); + ("limit_point_of", `:real^A->(real^A->bool)->bool`); + ("connected", `:(real^A->bool)->bool`); + ("cball", `:real^A#real->real^A->bool`); + ("ball", `:real^A#real->real^A->bool`); + ("euclidean", `:(real^A)topology`); ("closed", `:(real^N->bool)->bool`); + ("open", `:(real^A->bool)->bool`); + ("subtopology", `:(A)topology->(A->bool)->(A)topology`); + ("closed_in", `:(A)topology->(A->bool)->bool`); + ("topspace", `:(A)topology->A->bool`); + ("open_in", `:(A)topology->(A->bool)->bool`); + ("topology", `:((A->bool)->bool)->(A)topology`); + ("istopology", `:((A->bool)->bool)->bool`); + ("ITER", `:num->(A->A)->A->A`); ("frac", `:real->real`); + ("floor", `:real->real`); ("integer", `:real->bool`); + ("cross", `:real^3->real^3->real^3`); + ("rotoinversion_matrix", `:real^A^A->bool`); + ("rotation_matrix", `:real^A^A->bool`); + ("orthogonal_matrix", `:real^N^N->bool`); + ("orthogonal_transformation", `:(real^N->real^N)->bool`); + ("det", `:real^N^N->real`); ("trace", `:real^N^N->real`); + ("product", `:(A->bool)->(A->real)->real`); ("sign", `:(A->A)->real`); + ("evenperm", `:(A->A)->bool`); ("permutation", `:(A->A)->bool`); + ("swapseq", `:num->(A->A)->bool`); ("swap", `:A#A->A->A`); + ("inverse", `:(B->A)->A->B`); ("permutes", `:(A->A)->(A->bool)->bool`); + ("midpoint", `:real^A#real^A->real^A`); + ("between", `:real^A->real^A#real^A->bool`); + ("collinear", `:(real^A->bool)->bool`); ("infnorm", `:real^N->real`); + ("rank", `:real^M^N->num`); ("columnvector", `:real^N->real^1^N`); + ("rowvector", `:real^N->real^N^1`); ("dim", `:(real^A->bool)->num`); + ("independent", `:(real^A->bool)->bool`); + ("dependent", `:(real^A->bool)->bool`); + ("span", `:(real^A->bool)->real^A->bool`); + ("subspace", `:(real^A->bool)->bool`); ("drop", `:real^1->real`); + ("lift", `:real->real^1`); ("onorm", `:(real^M->real^N)->real`); + ("matrix", `:(real^M->real^N)->real^M^N`); + ("matrix_inv", `:real^N^M->real^M^N`); ("invertible", `:real^N^M->bool`); + ("columns", `:real^N^M->real^M->bool`); + ("rows", `:real^N^M->real^N->bool`); ("column", `:num->real^N^M->real^M`); + ("row", `:num->real^N^M->real^N`); ("transp", `:real^N^M->real^M^N`); + ("mat", `:num->real^N^M`); + ("vector_matrix_mul", `:real^M->real^N^M->real^N`); + ("matrix_vector_mul", `:real^N^M->real^N->real^M`); + ("matrix_mul", `:real^N^M->real^P^N->real^P^M`); + ("matrix_sub", `:real^N^M->real^N^M->real^N^M`); + ("matrix_add", `:real^N^M->real^N^M->real^N^M`); + ("matrix_neg", `:real^N^M->real^N^M`); + ("adjoint", `:(real^M->real^N)->real^N->real^M`); + ("bilinear", `:(real^A->real^B->real^C)->bool`); + ("linear", `:(real^M->real^N)->bool`); + ("orthogonal", `:real^A->real^A->bool`); ("basis", `:num->real^A`); + ("vsum", `:(A->bool)->(A->real^N)->real^N`); + ("distance", `:real^A#real^A->real`); ("vector_norm", `:real^A->real`); + ("dot", `:real^N->real^N->real`); ("vec", `:num->real^N`); + ("%", `:real->real^N->real^N`); ("vector_neg", `:real^N->real^N`); + ("vector_sub", `:real^N->real^N->real^N`); + ("vector_add", `:real^N->real^N->real^N`); ("sqrt", `:real->real`); + ("hull", `:((A->bool)->bool)->(A->bool)->A->bool`); + ("inf", `:(real->bool)->real`); ("sup", `:(real->bool)->real`); + ("superadmissible", + `:(A->A->bool)->((A->C)->B->bool)->(B->A)->((A->C)->B->C)->bool`); + ("tailadmissible", + `:(A->A->bool)->((A->B)->P->bool)->(P->A)->((A->B)->P->B)->bool`); + ("admissible", + `:(B->A->bool)->((B->C)->D->bool)->(D->A)->((B->C)->D->E)->bool`); + ("CASEWISE", `:((A->C)#(B->A->D))list->B->C->D`); + ("vector", `:(A)list->A^N`); + ("dest_auto_define_finite_type_3", `:3->num`); + ("mk_auto_define_finite_type_3", `:num->3`); + ("dest_auto_define_finite_type_2", `:2->num`); + ("mk_auto_define_finite_type_2", `:num->2`); + ("sndcart", `:A^(M,N)finite_sum->A^N`); + ("fstcart", `:A^(M,N)finite_sum->A^M`); + ("pastecart", `:A^M->A^N->A^(M,N)finite_sum`); + ("dest_finite_sum", `:(A,B)finite_sum->num`); + ("mk_finite_sum", `:num->(A,B)finite_sum`); ("lambda", `:(num->A)->A^B`); + ("$", `:B^A->num->B`); ("dest_cart", `:A^B->(B)finite_image->A`); + ("mk_cart", `:((B)finite_image->A)->A^B`); + ("dest_finite_image", `:(A)finite_image->num`); + ("finite_index", `:num->(A)finite_image`); + ("dimindex", `:(A->bool)->num`); ("sum", `:(A->bool)->(A->real)->real`); + ("nsum", `:(A->bool)->(A->num)->num`); + ("iterate", `:(B->B->B)->(A->bool)->(A->B)->B`); + ("support", `:(B->B->B)->(A->B)->(A->bool)->A->bool`); + ("monoidal", `:(A->A->A)->bool`); ("neutral", `:(A->A->A)->A`); + ("..", `:num->num->num->bool`); ("COUNTABLE", `:(A->bool)->bool`); + (">_c", `:(A->bool)->(B->bool)->bool`); + (">=_c", `:(A->bool)->(B->bool)->bool`); + ("=_c", `:(A->bool)->(B->bool)->bool`); + ("<_c", `:(A->bool)->(B->bool)->bool`); + ("<=_c", `:(A->bool)->(B->bool)->bool`); + ("PAIRWISE", `:(A->A->bool)->(A)list->bool`); + ("pairwise", `:(A->A->bool)->(A->bool)->bool`); + ("list_of_set", `:(A->bool)->(A)list`); + ("set_of_list", `:(A)list->A->bool`); + ("CROSS", `:(A->bool)->(B->bool)->A#B->bool`); + ("HAS_SIZE", `:(A->bool)->num->bool`); ("CARD", `:(A->bool)->num`); + ("ITSET", `:(A->B->B)->(A->bool)->B->B`); + ("FINREC", `:(A->B->B)->B->(A->bool)->B->num->bool`); + ("REST", `:(A->bool)->A->bool`); ("CHOICE", `:(A->bool)->A`); + ("BIJ", `:(A->B)->(A->bool)->(B->bool)->bool`); + ("SURJ", `:(A->B)->(A->bool)->(B->bool)->bool`); + ("INJ", `:(A->B)->(A->bool)->(B->bool)->bool`); + ("IMAGE", `:(A->B)->(A->bool)->B->bool`); + ("INFINITE", `:(A->bool)->bool`); ("FINITE", `:(A->bool)->bool`); + ("SING", `:(A->bool)->bool`); ("DISJOINT", `:(A->bool)->(A->bool)->bool`); + ("PSUBSET", `:(A->bool)->(A->bool)->bool`); + ("SUBSET", `:(A->bool)->(A->bool)->bool`); + ("DELETE", `:(A->bool)->A->A->bool`); + ("DIFF", `:(A->bool)->(A->bool)->A->bool`); + ("INTERS", `:((A->bool)->bool)->A->bool`); + ("INTER", `:(A->bool)->(A->bool)->A->bool`); + ("UNIONS", `:((A->bool)->bool)->A->bool`); + ("UNION", `:(A->bool)->(A->bool)->A->bool`); ("UNIV", `:A->bool`); + ("INSERT", `:A->(A->bool)->A->bool`); ("EMPTY", `:A->bool`); + ("SETSPEC", `:A->bool->A->bool`); ("GSPEC", `:(A->bool)->A->bool`); + ("IN", `:A->(A->bool)->bool`); ("num_gcd", `:num#num->num`); + ("num_coprime", `:num#num->bool`); ("num_mod", `:num->num->num->bool`); + ("num_divides", `:num->num->bool`); ("num_of_int", `:int->num`); + ("int_gcd", `:int#int->int`); ("int_coprime", `:int#int->bool`); + ("int_mod", `:int->int->int->bool`); ("int_divides", `:int->int->bool`); + ("real_mod", `:real->real->real->bool`); + ("==", `:A->A->(A->A->bool)->bool`); ("rem", `:int->int->int`); + ("div", `:int->int->int`); ("int_pow", `:int->num->int`); + ("int_min", `:int->int->int`); ("int_max", `:int->int->int`); + ("int_abs", `:int->int`); ("int_mul", `:int->int->int`); + ("int_sub", `:int->int->int`); ("int_add", `:int->int->int`); + ("int_neg", `:int->int`); ("int_of_num", `:num->int`); + ("int_gt", `:int->int->bool`); ("int_ge", `:int->int->bool`); + ("int_lt", `:int->int->bool`); ("int_le", `:int->int->bool`); + ("real_of_int", `:int->real`); ("int_of_real", `:real->int`); + ("is_int", `:real->bool`); ("DECIMAL", `:num->num->real`); + ("real_min", `:real->real->real`); ("real_max", `:real->real->real`); + ("real_div", `:real->real->real`); ("real_pow", `:real->num->real`); + ("real_abs", `:real->real`); ("real_gt", `:real->real->bool`); + ("real_ge", `:real->real->bool`); ("real_lt", `:real->real->bool`); + ("real_sub", `:real->real->real`); ("real_inv", `:real->real`); + ("real_le", `:real->real->bool`); ("real_mul", `:real->real->real`); + ("real_add", `:real->real->real`); ("real_neg", `:real->real`); + ("real_of_num", `:num->real`); ("dest_real", `:real->hreal#hreal->bool`); + ("mk_real", `:(hreal#hreal->bool)->real`); + ("treal_eq", `:hreal#hreal->hreal#hreal->bool`); + ("treal_inv", `:hreal#hreal->hreal#hreal`); + ("treal_le", `:hreal#hreal->hreal#hreal->bool`); + ("treal_mul", `:hreal#hreal->hreal#hreal->hreal#hreal`); + ("treal_add", `:hreal#hreal->hreal#hreal->hreal#hreal`); + ("treal_neg", `:hreal#hreal->hreal#hreal`); + ("treal_of_num", `:num->hreal#hreal`); ("hreal_inv", `:hreal->hreal`); + ("hreal_le", `:hreal->hreal->bool`); + ("hreal_mul", `:hreal->hreal->hreal`); + ("hreal_add", `:hreal->hreal->hreal`); ("hreal_of_num", `:num->hreal`); + ("dest_hreal", `:hreal->nadd->bool`); + ("mk_hreal", `:(nadd->bool)->hreal`); ("nadd_inv", `:nadd->nadd`); + ("nadd_rinv", `:nadd->num->num`); ("nadd_mul", `:nadd->nadd->nadd`); + ("nadd_add", `:nadd->nadd->nadd`); ("nadd_le", `:nadd->nadd->bool`); + ("nadd_of_num", `:num->nadd`); ("nadd_eq", `:nadd->nadd->bool`); + ("dest_nadd", `:nadd->num->num`); ("mk_nadd", `:(num->num)->nadd`); + ("is_nadd", `:(num->num)->bool`); ("dist", `:num#num->num`); + ("ASCII", `:bool->bool->bool->bool->bool->bool->bool->bool->char`); + ("_16756", `:bool->bool->bool->bool->bool->bool->bool->bool->char`); + ("_dest_char", `:char->(bool#bool#bool#bool#bool#bool#bool#bool)recspace`); + ("_mk_char", `:(bool#bool#bool#bool#bool#bool#bool#bool)recspace->char`); + ("ZIP", `:(A)list->(B)list->(A#B)list`); + ("ITLIST2", `:(A->B->C->C)->(A)list->(B)list->C->C`); + ("ASSOC", `:A->(A#B)list->B`); ("FILTER", `:(A->bool)->(A)list->(A)list`); + ("EL", `:num->(A)list->A`); + ("MAP2", `:(A->B->C)->(A)list->(B)list->(C)list`); + ("ALL2", `:(A->B->bool)->(A)list->(B)list->bool`); + ("MEM", `:A->(A)list->bool`); ("ITLIST", `:(A->B->B)->(A)list->B->B`); + ("EX", `:(A->bool)->(A)list->bool`); ("ALL", `:(A->bool)->(A)list->bool`); + ("NULL", `:(A)list->bool`); ("REPLICATE", `:num->A->(A)list`); + ("LAST", `:(A)list->A`); ("MAP", `:(A->B)->(A)list->(B)list`); + ("LENGTH", `:(A)list->num`); ("REVERSE", `:(A)list->(A)list`); + ("APPEND", `:(A)list->(A)list->(A)list`); ("TL", `:(A)list->(A)list`); + ("HD", `:(A)list->A`); ("ISO", `:(A->B)->(B->A)->bool`); + ("CONS", `:A->(A)list->(A)list`); ("NIL", `:(A)list`); + ("_dest_list", `:(A)list->(A)recspace`); + ("_mk_list", `:(A)recspace->(A)list`); ("SOME", `:A->(A)option`); + ("NONE", `:(A)option`); ("_dest_option", `:(A)option->(A)recspace`); + ("_mk_option", `:(A)recspace->(A)option`); ("OUTR", `:A+B->B`); + ("OUTL", `:A+B->A`); ("INR", `:B->A+B`); ("INL", `:A->A+B`); + ("_dest_sum", `:A+B->(A#B)recspace`); ("_mk_sum", `:(A#B)recspace->A+B`); + ("FNIL", `:num->A`); ("FCONS", `:A->(num->A)->num->A`); + ("CONSTR", `:num->A->(num->(A)recspace)->(A)recspace`); + ("BOTTOM", `:(A)recspace`); ("_dest_rec", `:(A)recspace->num->A->bool`); + ("_mk_rec", `:(num->A->bool)->(A)recspace`); + ("ZRECSPACE", `:(num->A->bool)->bool`); ("ZBOT", `:num->A->bool`); + ("ZCONSTR", `:num->A->(num->num->A->bool)->num->A->bool`); + ("INJP", `:(num->A->bool)->(num->A->bool)->num->A->bool`); + ("INJF", `:(num->num->A->bool)->num->A->bool`); + ("INJA", `:A->num->A->bool`); ("INJN", `:num->num->A->bool`); + ("NUMRIGHT", `:num->num`); ("NUMLEFT", `:num->bool`); + ("NUMSUM", `:bool->num->num`); ("NUMSND", `:num->num`); + ("NUMFST", `:num->num`); ("NUMPAIR", `:num->num->num`); + ("MEASURE", `:(A->num)->A->A->bool`); ("WF", `:(A->A->bool)->bool`); + ("minimal", `:(num->bool)->num`); ("MIN", `:num->num->num`); + ("MAX", `:num->num->num`); ("MOD", `:num->num->num`); + ("DIV", `:num->num->num`); ("FACT", `:num->num`); ("-", `:num->num->num`); + ("ODD", `:num->bool`); ("EVEN", `:num->bool`); (">", `:num->num->bool`); + (">=", `:num->num->bool`); ("<", `:num->num->bool`); + ("<=", `:num->num->bool`); ("EXP", `:num->num->num`); + ("*", `:num->num->num`); ("BIT1", `:num->num`); ("BIT0", `:num->num`); + ("+", `:num->num->num`); ("PRE", `:num->num`); ("NUMERAL", `:num->num`); + ("SUC", `:num->num`); ("_0", `:num`); ("dest_num", `:num->ind`); + ("mk_num", `:ind->num`); ("NUM_REP", `:ind->bool`); ("IND_0", `:ind`); + ("IND_SUC", `:ind->ind`); ("ONTO", `:(A->B)->bool`); + ("ONE_ONE", `:(A->B)->bool`); ("PASSOC", `:((A#B)#C->D)->A#B#C->D`); + ("UNCURRY", `:(A->B->C)->A#B->C`); ("CURRY", `:(A#B->C)->A->B->C`); + ("SND", `:A#B->B`); ("FST", `:A#B->A`); (",", `:A->B->A#B`); + ("REP_prod", `:A#B->A->B->bool`); ("ABS_prod", `:(A->B->bool)->A#B`); + ("mk_pair", `:A->B->A->B->bool`); ("_FUNCTION", `:(A->B->bool)->A->B`); + ("_MATCH", `:A->(A->B->bool)->B`); + ("_GUARDED_PATTERN", `:bool->bool->bool->bool`); + ("_UNGUARDED_PATTERN", `:bool->bool->bool`); + ("_SEQPATTERN", `:(A->B->bool)->(A->B->bool)->A->B->bool`); + ("GEQ", `:A->A->bool`); ("GABS", `:(A->bool)->A`); ("LET_END", `:A->A`); + ("LET", `:(A->B)->A->B`); ("one", `:1`); ("one_REP", `:1->bool`); + ("one_ABS", `:bool->1`); ("I", `:A->A`); ("o", `:(B->C)->(A->B)->A->C`); + ("COND", `:bool->A->A->A`); ("@", `:(A->bool)->A`); + ("_FALSITY_", `:bool`); ("?!", `:(A->bool)->bool`); ("~", `:bool->bool`); + ("F", `:bool`); ("\\/", `:bool->bool->bool`); ("?", `:(A->bool)->bool`); + ("!", `:(A->bool)->bool`); ("==>", `:bool->bool->bool`); + ("/\\", `:bool->bool->bool`); ("T", `:bool`); ("=", `:A->A->bool`)];; + + let the_loaded_files = ["flyspeck.ml"; "wlog_examples.ml"; "wlog.ml"; "real.ml"; "measure.ml"; + "card.ml"; "wo.ml"; "geom.ml"; "transc.ml"; "canal.ml"; "complex.ml"; + "integration.ml"; "analysis.ml"; "dimension.ml"; "convex.ml"; + "topology.ml"; "iter.ml"; "floor.ml"; "cross.ml"; "determinants.ml"; + "products.ml"; "permutations.ml"; "vectors.ml"; "misc.ml"; "database.ml"; + "help.ml"; "define.ml"; "cart.ml"; "iter.ml"; "sets.ml"; "int.ml"; + "calc_rat.ml"; "real.ml"; "realarith.ml"; "calc_int.ml"; "realax.ml"; + "list.ml"; "ind-types.ml"; "grobner.ml"; "normalizer.ml"; "calc_num.ml"; + "wf.ml"; "arith.ml"; "num.ml"; "pair.ml"; "recursion.ml"; "quot.ml"; + "meson.ml"; "canon.ml"; "trivia.ml"; "class.ml"; "ind-defs.ml"; + "theorems.ml"; "simp.ml"; "itab.ml"; "tactics.ml"; "drule.ml"; "bool.ml"; + "equal.ml"; "printer.ml"; "parser.ml"; "preterm.ml"; "nets.ml"; + "basics.ml"; "fusion.ml"; "lib.ml"; "sys.ml"];; + + let the_overload_skeletons = [("real_interval", `:A`); ("segment", `:A`); ("interval", `:A`); + ("**", `:A->B->C`); ("norm", `:A->real`); ("gcd", `:A#A->A`); + ("coprime", `:A#A->bool`); ("mod", `:A->A->A->bool`); + ("divides", `:A->A->bool`); ("&", `:num->A`); ("min", `:A->A->A`); + ("max", `:A->A->A`); ("abs", `:A->A`); ("inv", `:A->A`); + ("pow", `:A->num->A`); ("--", `:A->A`); (">=", `:A->A->bool`); + (">", `:A->A->bool`); ("<=", `:A->A->bool`); ("<", `:A->A->bool`); + ("/", `:A->A->A`); ("*", `:A->A->A`); ("-", `:A->A->A`); + ("+", `:A->A->A`)];; + + let the_interface = [("vol", ("measure", `:(real^3->bool)->real`)); + ("NULLSET", ("negligible", `:(real^3->bool)->bool`)); + ("+", ("vector_add", `:real^N->real^N->real^N`)); + ("-", ("vector_sub", `:real^N->real^N->real^N`)); + ("--", ("vector_neg", `:real^N->real^N`)); + ("norm", ("vector_norm", `:real^N->real`)); + ("**", ("vector_matrix_mul", `:real^M->real^N^M->real^N`)); + ("real_interval", + ("closed_real_interval", `:(real#real)list->real->bool`)); + ("real_interval", ("open_real_interval", `:real#real->real->bool`)); + ("+", ("real_add", `:real->real->real`)); + ("-", ("real_sub", `:real->real->real`)); + ("*", ("real_mul", `:real->real->real`)); + ("/", ("real_div", `:real->real->real`)); + ("<", ("real_lt", `:real->real->bool`)); + ("<=", ("real_le", `:real->real->bool`)); + (">", ("real_gt", `:real->real->bool`)); + (">=", ("real_ge", `:real->real->bool`)); + ("--", ("real_neg", `:real->real`)); + ("pow", ("real_pow", `:real->num->real`)); + ("inv", ("real_inv", `:real->real`)); + ("abs", ("real_abs", `:real->real`)); + ("max", ("real_max", `:real->real->real`)); + ("min", ("real_min", `:real->real->real`)); + ("&", ("real_of_num", `:num->real`)); + ("mod", ("real_mod", `:real->real->real->bool`)); + ("inv", ("complex_inv", `:real^2->real^2`)); + ("pow", ("complex_pow", `:real^2->num->real^2`)); + ("/", ("complex_div", `:real^2->real^2->real^2`)); + ("*", ("complex_mul", `:real^2->real^2->real^2`)); + ("-", ("vector_sub", `:real^2->real^2->real^2`)); + ("+", ("vector_add", `:real^2->real^2->real^2`)); + ("--", ("vector_neg", `:real^2->real^2`)); + ("segment", ("closed_segment", `:(real^A#real^A)list->real^A->bool`)); + ("segment", ("open_segment", `:real^A#real^A->real^A->bool`)); + ("interval", ("closed_interval", `:(real^A#real^A)list->real^A->bool`)); + ("interval", ("open_interval", `:real^A#real^A->real^A->bool`)); + ("**", ("matrix_vector_mul", `:real^N^M->real^N->real^M`)); + ("**", ("matrix_mul", `:real^N^M->real^P^N->real^P^M`)); + ("-", ("matrix_sub", `:real^N^M->real^N^M->real^N^M`)); + ("+", ("matrix_add", `:real^N^M->real^N^M->real^N^M`)); + ("--", ("matrix_neg", `:real^N^M->real^N^M`)); + ("dist", ("distance", `:real^N#real^N->real`)); + ("+", ("+", `:num->num->num`)); ("-", ("-", `:num->num->num`)); + ("*", ("*", `:num->num->num`)); ("<", ("<", `:num->num->bool`)); + ("<=", ("<=", `:num->num->bool`)); (">", (">", `:num->num->bool`)); + (">=", (">=", `:num->num->bool`)); + ("divides", ("num_divides", `:num->num->bool`)); + ("mod", ("num_mod", `:num->num->num->bool`)); + ("coprime", ("num_coprime", `:num#num->bool`)); + ("gcd", ("num_gcd", `:num#num->num`)); + ("gcd", ("int_gcd", `:int#int->int`)); + ("coprime", ("int_coprime", `:int#int->bool`)); + ("mod", ("int_mod", `:int->int->int->bool`)); + ("divides", ("int_divides", `:int->int->bool`)); + ("&", ("int_of_num", `:num->int`)); + ("min", ("int_min", `:int->int->int`)); + ("max", ("int_max", `:int->int->int`)); ("abs", ("int_abs", `:int->int`)); + ("pow", ("int_pow", `:int->num->int`)); ("--", ("int_neg", `:int->int`)); + (">=", ("int_ge", `:int->int->bool`)); + (">", ("int_gt", `:int->int->bool`)); + ("<=", ("int_le", `:int->int->bool`)); + ("<", ("int_lt", `:int->int->bool`)); + ("*", ("int_mul", `:int->int->int`)); + ("-", ("int_sub", `:int->int->int`)); + ("+", ("int_add", `:int->int->int`)); + ("&", ("hreal_of_num", `:num->hreal`)); + ("<=>", ("=", `:bool->bool->bool`))];; + + let the_types = [("net", 1); ("topology", 1); ("3", 0); ("2", 0); ("finite_sum", 2); + ("cart", 2); ("finite_image", 1); ("int", 0); ("real", 0); ("hreal", 0); + ("nadd", 0); ("char", 0); ("list", 1); ("option", 1); ("sum", 2); + ("recspace", 1); ("num", 0); ("ind", 0); ("prod", 2); ("1", 0); + ("bool", 0); ("fun", 2)];; + +end;; + +module Snapshot_flyspeck_init_2010_02_11 : Snapshot_type = struct + + let the_constants = Snapshot_v220_7_31_2009.the_constants;; + let the_loaded_files = Snapshot_v220_7_31_2009.the_loaded_files;; + let the_types = Snapshot_v220_7_31_2009.the_types;; + let the_overload_skeletons = Snapshot_v220_7_31_2009.the_overload_skeletons;; + +(* + +(* start with the hol-light snapshot v220_7_31_2009 then *) +prioritize_complex();; (* lowest priority *) +prioritize_int();; +prioritize_num();; +prioritize_vector();; +prioritize_real();; (* highest priority *) + +*) + + let the_interface = + [("+", ("real_add", `:real->real->real`)); + ("-", ("real_sub", `:real->real->real`)); + ("*", ("real_mul", `:real->real->real`)); + ("/", ("real_div", `:real->real->real`)); + ("<", ("real_lt", `:real->real->bool`)); + ("<=", ("real_le", `:real->real->bool`)); + (">", ("real_gt", `:real->real->bool`)); + (">=", ("real_ge", `:real->real->bool`)); + ("--", ("real_neg", `:real->real`)); + ("pow", ("real_pow", `:real->num->real`)); + ("inv", ("real_inv", `:real->real`)); + ("abs", ("real_abs", `:real->real`)); + ("max", ("real_max", `:real->real->real`)); + ("min", ("real_min", `:real->real->real`)); + ("&", ("real_of_num", `:num->real`)); + ("mod", ("real_mod", `:real->real->real->bool`)); + ("+", ("vector_add", `:real^N->real^N->real^N`)); + ("-", ("vector_sub", `:real^N->real^N->real^N`)); + ("--", ("vector_neg", `:real^N->real^N`)); + ("norm", ("vector_norm", `:real^N->real`)); + ("**", ("vector_matrix_mul", `:real^M->real^N^M->real^N`)); + ("+", ("+", `:num->num->num`)); ("-", ("-", `:num->num->num`)); + ("*", ("*", `:num->num->num`)); ("<", ("<", `:num->num->bool`)); + ("<=", ("<=", `:num->num->bool`)); (">", (">", `:num->num->bool`)); + (">=", (">=", `:num->num->bool`)); + ("divides", ("num_divides", `:num->num->bool`)); + ("mod", ("num_mod", `:num->num->num->bool`)); + ("coprime", ("num_coprime", `:num#num->bool`)); + ("gcd", ("num_gcd", `:num#num->num`)); + ("+", ("int_add", `:int->int->int`)); + ("-", ("int_sub", `:int->int->int`)); + ("*", ("int_mul", `:int->int->int`)); + ("<", ("int_lt", `:int->int->bool`)); + ("<=", ("int_le", `:int->int->bool`)); + (">", ("int_gt", `:int->int->bool`)); + (">=", ("int_ge", `:int->int->bool`)); ("--", ("int_neg", `:int->int`)); + ("pow", ("int_pow", `:int->num->int`)); ("abs", ("int_abs", `:int->int`)); + ("max", ("int_max", `:int->int->int`)); + ("min", ("int_min", `:int->int->int`)); + ("&", ("int_of_num", `:num->int`)); + ("divides", ("int_divides", `:int->int->bool`)); + ("mod", ("int_mod", `:int->int->int->bool`)); + ("coprime", ("int_coprime", `:int#int->bool`)); + ("gcd", ("int_gcd", `:int#int->int`)); + ("inv", ("complex_inv", `:real^2->real^2`)); + ("pow", ("complex_pow", `:real^2->num->real^2`)); + ("/", ("complex_div", `:real^2->real^2->real^2`)); + ("*", ("complex_mul", `:real^2->real^2->real^2`)); + ("-", ("vector_sub", `:real^2->real^2->real^2`)); + ("+", ("vector_add", `:real^2->real^2->real^2`)); + ("--", ("vector_neg", `:real^2->real^2`)); + ("vol", ("measure", `:(real^3->bool)->real`)); + ("NULLSET", ("negligible", `:(real^3->bool)->bool`)); + ("real_interval", + ("closed_real_interval", `:(real#real)list->real->bool`)); + ("real_interval", ("open_real_interval", `:real#real->real->bool`)); + ("segment", ("closed_segment", `:(real^A#real^A)list->real^A->bool`)); + ("segment", ("open_segment", `:real^A#real^A->real^A->bool`)); + ("interval", ("closed_interval", `:(real^A#real^A)list->real^A->bool`)); + ("interval", ("open_interval", `:real^A#real^A->real^A->bool`)); + ("**", ("matrix_vector_mul", `:real^N^M->real^N->real^M`)); + ("**", ("matrix_mul", `:real^N^M->real^P^N->real^P^M`)); + ("-", ("matrix_sub", `:real^N^M->real^N^M->real^N^M`)); + ("+", ("matrix_add", `:real^N^M->real^N^M->real^N^M`)); + ("--", ("matrix_neg", `:real^N^M->real^N^M`)); + ("dist", ("distance", `:real^N#real^N->real`)); + ("&", ("hreal_of_num", `:num->hreal`)); + ("<=>", ("=", `:bool->bool->bool`))];; + + end;; + diff --git a/development/thales/chaff/general/template_def.ml b/development/thales/chaff/general/template_def.ml new file mode 100644 index 0000000..fea6aef --- /dev/null +++ b/development/thales/chaff/general/template_def.ml @@ -0,0 +1,163 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Author: Thomas C. Hales *) +(* Date: Feb 7, 2010 *) +(* ========================================================================== *) + + +(* +Outputs to a file +a formatted HOL Light identifier, as a module with signature. +The author and date information are added as comments. + +The file pathname is derived from the root directory, which can be set by the user, +the lowercase of chapter string must match a subdirectory name precisely, +and the identifier is used to create the file name. +*) + + +module type Template_hol_type = sig + + type data = + { + identifier : string; + chapter : string; + author: string; + date:string; + code:string; + comments:string list; + needlist:string list; + } + + val output_template_def : data -> unit + + val output_template_lemma : data -> unit + + val set_root_dir : string-> unit (* default is "/tmp" *) + +end;; + +(* +Example: The following code creates a template identifier file + "/tmp/Trigonometry/azim_def.hl", +populated with the code from def1 +*) + +(* + +open Template_hol;; +let example1() = + let def1 = + {identifier="azim"; + chapter="Trigonometry"; + author="Thomas C. Hales"; + date="Feb 7, 2010"; + code=""; + comments=["This is just a test!"]; + needlist=["Multivariate/flyspeck.ml"]; + } in + let _ = set_root_dir "/tmp" in + output_template_def def1;; +example1();; + +*) + +module Template_hol : Template_hol_type = +struct + + type data = + { + identifier : string; + chapter : string; + author: string; + date:string; + code:string; + comments: string list; + needlist:string list; + };; + + (* Comments and Line Formatting *) + + let sep= "/";; + let pad='=';; + let space=' ';; + let emptystring="";; + + let unsplit d f = function + | (x::xs) -> List.fold_left (fun s t -> s^d^(f t)) (f x) xs + | [] -> "";; + + let join_lines = unsplit "\n" (fun x-> x);; + let width = 80 - 6;; + + let c_enclose s = "(* "^s^String.make (width - String.length s) space^" *)";; + let pad_line = (String.make width pad);; + let space_line = String.make width space;; + + type opt = Def | Lemma;; + let label t = if t=Def then "Definition" else "Lemma";; + let ext t = if t=Def then "_def" else "";; + + (* Content *) + + let header t dat = + let p = Printf.sprintf in + unsplit "\n" c_enclose [ + pad_line; + p"FLYSPECK - BOOK FORMALIZATION"; + space_line; + p"%s: %s" (label t) dat.identifier; + p"Chapter: %s" dat.chapter; + p"Author: %s" dat.author; + p"Date: %s" dat.date; + pad_line; + ];; + + let more_comments dat = + if (dat.comments =[]) then emptystring else + "(*\n"^(join_lines dat.comments)^"\n*)\n\n\n";; + + let neededfiles dat = + if (dat.needlist =[]) then emptystring else + (unsplit "\n" (fun s -> "flyspeck_needs \""^s^"\";;") dat.needlist)^"\n\n\n";; + + let body dat = + let p = Printf.sprintf in + let uc = String.capitalize (String.lowercase dat.identifier) in (* HOL Light parsing: cap first char only *) + join_lines [ + p"module type %s_def_type = sig" uc; + p" val %s : thm" dat.identifier; + "end;;\n\n"; + neededfiles dat; + p"module %s : %s_def_type = struct\n" uc uc; + p" let %s = " dat.identifier; + dat.code; + "\nend;;\n"; + ];; + + (* Output *) + + let rootdir =ref "/tmp";; + let set_root_dir s = (rootdir := s);; + + let filename t dat = (!rootdir)^sep^(String.lowercase dat.chapter)^sep^dat.identifier^(ext t)^".hl";; + + let save_stringarray filename xs = + let oc = open_out filename in + for i=0 to List.length xs -1 + do + Pervasives.output_string oc (List.nth xs i ^ "\n"); + done; + close_out oc;; + + let output_template t dat = save_stringarray (filename t dat) + [header t dat;"\n\n\n";more_comments dat; + body dat];; + + let output_template_def dat = output_template Def dat;; + let output_template_lemma dat = output_template Lemma dat;; + +end;; + + diff --git a/development/thales/chaff/general/xx.hl b/development/thales/chaff/general/xx.hl new file mode 100644 index 0000000..f2b016f --- /dev/null +++ b/development/thales/chaff/general/xx.hl @@ -0,0 +1,26 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Lemma: xx *) +(* Chapter: leg *) +(* Author: Thomas C. Hales *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + + + +module type Xx_def_type = sig + val xx : thm +end;; + + +module Xx : Xx_def_type = struct + + + let xx = + + +end;; + diff --git a/development/thales/chaff/load_path.ml b/development/thales/chaff/load_path.ml new file mode 100644 index 0000000..d1d6d7a --- /dev/null +++ b/development/thales/chaff/load_path.ml @@ -0,0 +1,16 @@ +#use "hol.ml";; + +(* My customization *) + +load_path := + ["/Users/thomashales/Desktop/flyspeck_google/source/inequalities/"; + "/Users/thomashales/Desktop/flyspeck_google/source/text_formalization/"] + @ (!load_path);; + +load_path := + ["/Users/thomashales/Desktop/flyspeck_google/flyspeck/inequalities/"; + "/Users/thomashales/Desktop/flyspeck_google/flyspeck/text_formalization/"] + @ (!load_path);; + + +needs "build.ml";; diff --git a/development/thales/chaff/meson_edit.hl b/development/thales/chaff/meson_edit.hl new file mode 100644 index 0000000..757f47c --- /dev/null +++ b/development/thales/chaff/meson_edit.hl @@ -0,0 +1,964 @@ +(* ========================================================================= *) +(* Version of the MESON procedure a la PTTP. Various search options. *) +(* *) +(* John Harrison, University of Cambridge Computer Laboratory *) +(* *) +(* (c) Copyright, University of Cambridge 1998 *) +(* (c) Copyright, John Harrison 1998-2007 *) +(* ========================================================================= *) + +needs "canon.ml";; + + +module Meson_edit = struct + +(* +Collect into a list +first-order formulas that occur in MESON_TAC calls. + +Notes: +(1) This just does MESON_TAC, ASM_MESON_TAC is similar. +(2) Right now, MESON_TAC runs twice. Optimize to remove. + +sample usage: + +flyspeck_needs "../development/thales/holcode/meson_edit.hl";; +let MESON_TAC=Meson_edit.MESON_SAVE_FOF_TAC;; (* redefine *) +reneeds"trigonometry/trig2.hl";; (* run file with modified meson *) +reneeds "../../hol_light/meson.ml";; (* restore MESON_TAC *) +!Meson_edit.fof_list;; + +*) + + +(* ------------------------------------------------------------------------- *) +(* Some parameters controlling MESON behaviour. *) +(* ------------------------------------------------------------------------- *) + +(* +let meson_depth = ref false;; (* Use depth not inference bound. *) + +let meson_prefine = ref true;; (* Use Plaisted's positive refinement. *) + +let meson_dcutin = ref 1;; (* Min size for d-and-c optimization cut-in. *) + +let meson_skew = ref 3;; (* Skew proof bias (one side is <= n / skew) *) + +let meson_brand = ref false;; (* Use Brand transformation *) + +let meson_split_limit = ref 8;; (* Limit of case splits before MESON proper *) + +let meson_chatty = ref false;; (* Old-style verbose MESON output *) +*) + +(* ------------------------------------------------------------------------- *) +(* Prolog exception. *) +(* ------------------------------------------------------------------------- *) +(* +exception Cut;; +*) +(* ------------------------------------------------------------------------- *) +(* Shadow syntax for FOL terms in NNF. Functions and predicates have *) +(* numeric codes, and negation is done by negating the predicate code. *) +(* ------------------------------------------------------------------------- *) + +(* +type fol_term = Fvar of int + | Fnapp of int * fol_term list;; + +type fol_atom = int * fol_term list;; + +type fol_form = Atom of fol_atom + | Conj of fol_form * fol_form + | Disj of fol_form * fol_form + | Forallq of int * fol_form;; + +(* ------------------------------------------------------------------------- *) +(* Type for recording a MESON proof tree. *) +(* ------------------------------------------------------------------------- *) + +type fol_goal = + Subgoal of fol_atom * fol_goal list * (int * thm) * + int * (fol_term * int)list;; + +*) + +(* ------------------------------------------------------------------------- *) +(* General MESON procedure, using assumptions and with settable limits. *) +(* ------------------------------------------------------------------------- *) + + let offinc = 10000;; + + let inferences = ref 0;; + + (* ----------------------------------------------------------------------- *) + (* Like partition, but with short-circuiting for special situation. *) + (* ----------------------------------------------------------------------- *) + + + let qpartition p m = + let rec qpartition l = + if l == m then raise Unchanged else + match l with + [] -> raise Unchanged + | (h::t) -> if p h then + try let yes,no = qpartition t in h::yes,no + with Unchanged -> [h],t + else + let yes,no = qpartition t in yes,h::no in + function l -> try qpartition l + with Unchanged -> [],l ;; + + let reset_vars,fol_of_var,hol_of_var = + let vstore = ref [] + and gstore = ref [] + and vcounter = ref 0 in + let inc_vcounter() = + let n = !vcounter in + let m = n + 1 in + if m >= offinc then failwith "inc_vcounter: too many variables" else + (vcounter := m; n) in + let reset_vars() = vstore := []; gstore := []; vcounter := 0 in + let fol_of_var v = + let currentvars = !vstore in + try assoc v currentvars with Failure _ -> + let n = inc_vcounter() in + vstore := (v,n)::currentvars; n in + let hol_of_var v = + try rev_assoc v (!vstore) + with Failure _ -> rev_assoc v (!gstore) in + let hol_of_bumped_var v = + try hol_of_var v with Failure _ -> + let v' = v mod offinc in + let hv' = hol_of_var v' in + let gv = genvar(type_of hv') in + gstore := (gv,v)::(!gstore); gv in + reset_vars,fol_of_var,hol_of_bumped_var ;; + +fol_of_var `x:real`;; +hol_of_var 0;; + + let reset_consts,fol_of_const,hol_of_const = + let false_tm = `F` in + let cstore = ref ([]:(term * int)list) + and ccounter = ref 2 in + let reset_consts() = cstore := [false_tm,1]; ccounter := 2 in + let fol_of_const c = + let currentconsts = !cstore in + try assoc c currentconsts with Failure _ -> + let n = !ccounter in + ccounter := n + 1; cstore := (c,n)::currentconsts; n in + let hol_of_const c = rev_assoc c (!cstore) in + reset_consts,fol_of_const,hol_of_const ;; + +fol_of_const `sin`;; +hol_of_const 2;; + + + let rec fol_of_term env consts tm = + if is_var tm & not (mem tm consts) then + Fvar(fol_of_var tm) + else + let f,args = strip_comb tm in + if mem f env then failwith "fol_of_term: higher order" else + let ff = fol_of_const f in + Fnapp(ff,map (fol_of_term env consts) args) ;; + +fol_of_term [] [] `sin x pow 2 + cos x pow 2`;; +hol_of_const 4;; + + let fol_of_atom env consts tm = + let f,args = strip_comb tm in + if mem f env then failwith "fol_of_atom: higher order" else + let ff = fol_of_const f in + ff,map (fol_of_term env consts) args ;; + +fol_of_atom [] [] `cos x`;; + + let fol_of_literal env consts tm = + try let tm' = dest_neg tm in + let p,a = fol_of_atom env consts tm' in + -p,a + with Failure _ -> fol_of_atom env consts tm ;; + + + let rec fol_of_form env consts tm = + try let v,bod = dest_forall tm in + let fv = fol_of_var v in + let fbod = fol_of_form (v::env) (subtract consts [v]) bod in + Forallq(fv,fbod) + with Failure _ -> try + let l,r = dest_conj tm in + let fl = fol_of_form env consts l + and fr = fol_of_form env consts r in + Conj(fl,fr) + with Failure _ -> try + let l,r = dest_disj tm in + let fl = fol_of_form env consts l + and fr = fol_of_form env consts r in + Disj(fl,fr) + with Failure _ -> + Atom(fol_of_literal env consts tm) ;; + + + + + + + (* ----------------------------------------------------------------------- *) + (* Further translation functions for HOL formulas. *) + (* ----------------------------------------------------------------------- *) + + let rec hol_of_term tm = + match tm with + Fvar v -> hol_of_var v + | Fnapp(f,args) -> list_mk_comb(hol_of_const f,map hol_of_term args) ;; + + let hol_of_atom (p,args) = + list_mk_comb(hol_of_const p,map hol_of_term args) ;; + + let hol_of_literal (p,args) = + if p < 0 then mk_neg(hol_of_atom(-p,args)) + else hol_of_atom (p,args) ;; + + (* ----------------------------------------------------------------------- *) + (* Versions of shadow syntax operations with variable bumping. *) + (* ----------------------------------------------------------------------- *) + + let rec fol_free_in v tm = + match tm with + Fvar x -> x = v + | Fnapp(_,lis) -> exists (fol_free_in v) lis ;; + + let rec fol_subst theta tm = + match tm with + Fvar v -> rev_assocd v theta tm + | Fnapp(f,args) -> + let args' = qmap (fol_subst theta) args in + if args' == args then tm else Fnapp(f,args') ;; + + let fol_inst theta ((p,args) as at:fol_atom) = + let args' = qmap (fol_subst theta) args in + if args' == args then at else p,args' ;; + + let rec fol_subst_bump offset theta tm = + match tm with + Fvar v -> if v < offinc then + let v' = v + offset in + rev_assocd v' theta (Fvar(v')) + else + rev_assocd v theta tm + | Fnapp(f,args) -> + let args' = qmap (fol_subst_bump offset theta) args in + if args' == args then tm else Fnapp(f,args') ;; + + let fol_inst_bump offset theta ((p,args) as at:fol_atom) = + let args' = qmap (fol_subst_bump offset theta) args in + if args' == args then at else p,args' ;; + + + let rec istriv env x t = + match t with + Fvar y -> y = x or + (try let t' = rev_assoc y env in istriv env x t' + with Failure "find" -> false) + | Fnapp(f,args) -> exists (istriv env x) args & failwith "cyclic" ;; + + + (* ----------------------------------------------------------------------- *) + (* Main unification function, maintaining a "graph" instantiation. *) + (* We implicitly apply an offset to variables in the second term, so this *) + (* is not symmetric between the arguments. *) + (* ----------------------------------------------------------------------- *) + + let rec fol_unify offset tm1 tm2 sofar = + match tm1,tm2 with + Fnapp(f,fargs),Fnapp(g,gargs) -> + if f <> g then failwith "" else + itlist2 (fol_unify offset) fargs gargs sofar + | _,Fvar(x) -> + (let x' = x + offset in + try let tm2' = rev_assoc x' sofar in + fol_unify 0 tm1 tm2' sofar + with Failure "find" -> + if istriv sofar x' tm1 then sofar + else (tm1,x')::sofar) + | Fvar(x),_ -> + (try let tm1' = rev_assoc x sofar in + fol_unify offset tm1' tm2 sofar + with Failure "find" -> + let tm2' = fol_subst_bump offset [] tm2 in + if istriv sofar x tm2' then sofar + else (tm2',x)::sofar) ;; + + + (* ----------------------------------------------------------------------- *) + (* Test for equality under the pending instantiations. *) + (* ----------------------------------------------------------------------- *) + + let rec fol_eq insts tm1 tm2 = + tm1 == tm2 or + match tm1,tm2 with + Fnapp(f,fargs),Fnapp(g,gargs) -> + f = g & forall2 (fol_eq insts) fargs gargs + | _,Fvar(x) -> + (try let tm2' = rev_assoc x insts in + fol_eq insts tm1 tm2' + with Failure "find" -> + try istriv insts x tm1 with Failure _ -> false) + | Fvar(x),_ -> + (try let tm1' = rev_assoc x insts in + fol_eq insts tm1' tm2 + with Failure "find" -> + try istriv insts x tm2 with Failure _ -> false) ;; + + let fol_atom_eq insts (p1,args1) (p2,args2) = + p1 = p2 & forall2 (fol_eq insts) args1 args2 ;; + + + (* ----------------------------------------------------------------------- *) + (* Cacheing continuations. Very crude, but it works remarkably well. *) + (* ----------------------------------------------------------------------- *) + + let cacheconts f = + let memory = ref [] in + fun (gg,(insts,offset,size) as input) -> + if exists (fun (_,(insts',_,size')) -> + insts = insts' & (size <= size' or !meson_depth)) + (!memory) + then failwith "cachecont" + else memory := input::(!memory); f input ;; + + + (* ----------------------------------------------------------------------- *) + (* Check ancestor list for repetition. *) + (* ----------------------------------------------------------------------- *) + + let checkan insts (p,a) ancestors = + let p' = -p in + let t' = (p',a) in + try let ours = assoc p' ancestors in + if exists (fun u -> fol_atom_eq insts t' (snd(fst u))) ours + then failwith "checkan" + else ancestors + with Failure "find" -> ancestors ;; + + (* ----------------------------------------------------------------------- *) + (* Insert new goal's negation in ancestor clause, given refinement. *) + (* ----------------------------------------------------------------------- *) + + let insertan insts (p,a) ancestors = + let p' = -p in + let t' = (p',a) in + let ourancp,otheranc = + try remove (fun (pr,_) -> pr = p') ancestors + with Failure _ -> (p',[]),ancestors in + let ouranc = snd ourancp in + if exists (fun u -> fol_atom_eq insts t' (snd(fst u))) ouranc + then failwith "insertan: loop" + else (p',(([],t'),(0,TRUTH))::ouranc)::otheranc ;; + + (* ----------------------------------------------------------------------- *) + (* Apply a multi-level "graph" instantiation. *) + (* ----------------------------------------------------------------------- *) + + let rec fol_subst_partial insts tm = + match tm with + Fvar(v) -> (try let t = rev_assoc v insts in + fol_subst_partial insts t + with Failure "find" -> tm) + | Fnapp(f,args) -> Fnapp(f,map (fol_subst_partial insts) args) ;; + + (* ----------------------------------------------------------------------- *) + (* Tease apart local and global instantiations. *) + (* At the moment we also force a full evaluation; should eliminate this. *) + (* ----------------------------------------------------------------------- *) + + let separate_insts offset oldinsts newinsts = + let locins,globins = + qpartition (fun (_,v) -> offset <= v) oldinsts newinsts in + if globins = oldinsts then + map (fun (t,x) -> fol_subst_partial newinsts t,x) locins,oldinsts + else + map (fun (t,x) -> fol_subst_partial newinsts t,x) locins, + map (fun (t,x) -> fol_subst_partial newinsts t,x) globins ;; + + (* ----------------------------------------------------------------------- *) + (* Perform basic MESON expansion. *) + (* ----------------------------------------------------------------------- *) + + let meson_single_expand loffset rule ((g,ancestors),(insts,offset,size)) = + let (hyps,conc),tag = rule in + let allins = rev_itlist2 (fol_unify loffset) (snd g) (snd conc) insts in + let locin,globin = separate_insts offset insts allins in + let mk_ihyp h = + let h' = fol_inst_bump offset locin h in + h',checkan insts h' ancestors in + let newhyps = map mk_ihyp hyps in + inferences := !inferences + 1; + newhyps,(globin,offset+offinc,size-length hyps) ;; + + (* ----------------------------------------------------------------------- *) + (* Perform first basic expansion which allows continuation call. *) + (* ----------------------------------------------------------------------- *) + + let meson_expand_cont loffset rules state cont = + tryfind + (fun r -> cont (snd r) (meson_single_expand loffset r state)) rules;; + + (* ----------------------------------------------------------------------- *) + (* Try expansion and continuation call with ancestor or initial rule. *) + (* ----------------------------------------------------------------------- *) + + let meson_expand rules ((g,ancestors),((insts,offset,size) as tup)) cont = + let pr = fst g in + let newancestors = insertan insts g ancestors in + let newstate = (g,newancestors),tup in + try if !meson_prefine & pr > 0 then failwith "meson_expand" else + let arules = assoc pr ancestors in + meson_expand_cont 0 arules newstate cont + with Cut -> failwith "meson_expand" | Failure _ -> + try let crules = + filter (fun ((h,_),_) -> length h <= size) (assoc pr rules) in + meson_expand_cont offset crules newstate cont + with Cut -> failwith "meson_expand" + | Failure _ -> failwith "meson_expand" ;; + + + + + + (* ----------------------------------------------------------------------- *) + (* Simple Prolog engine organizing search and backtracking. *) + (* ----------------------------------------------------------------------- *) + + let expand_goal rules = + let rec expand_goal depth ((g,_),(insts,offset,size) as state) cont = + if depth < 0 then failwith "expand_goal: too deep" else + meson_expand rules state + (fun apprule (_,(pinsts,_,_) as newstate) -> + expand_goals (depth-1) newstate + (cacheconts(fun (gs,(newinsts,newoffset,newsize)) -> + let locin,globin = separate_insts offset pinsts newinsts in + let g' = Subgoal(g,gs,apprule,offset,locin) in + if globin = insts & gs = [] then + try cont(g',(globin,newoffset,size)) + with Failure _ -> raise Cut + else + try cont(g',(globin,newoffset,newsize)) + with Cut -> failwith "expand_goal" + | Failure _ -> failwith "expand_goal"))) + + and expand_goals depth (gl,(insts,offset,size as tup)) cont = + match gl with + [] -> cont ([],tup) + + | [g] -> expand_goal depth (g,tup) (fun (g',stup) -> cont([g'],stup)) + + | gl -> if size >= !meson_dcutin then + let lsize = size / (!meson_skew) in + let rsize = size - lsize in + let lgoals,rgoals = chop_list (length gl / 2) gl in + try expand_goals depth (lgoals,(insts,offset,lsize)) + (cacheconts(fun (lg',(i,off,n)) -> + expand_goals depth (rgoals,(i,off,n + rsize)) + (cacheconts(fun (rg',ztup) -> cont (lg'@rg',ztup))))) + with Failure _ -> + expand_goals depth (rgoals,(insts,offset,lsize)) + (cacheconts(fun (rg',(i,off,n)) -> + expand_goals depth (lgoals,(i,off,n + rsize)) + (cacheconts (fun (lg',((_,_,fsize) as ztup)) -> + if n + rsize <= lsize + fsize + then failwith "repetition of demigoal pair" + else cont (lg'@rg',ztup))))) + else + let g::gs = gl in + expand_goal depth (g,tup) + (cacheconts(fun (g',stup) -> + expand_goals depth (gs,stup) + (cacheconts(fun (gs',ftup) -> cont(g'::gs',ftup))))) in + + fun g maxdep maxinf cont -> + expand_goal maxdep (g,([],2 * offinc,maxinf)) cont ;; + + + (* ----------------------------------------------------------------------- *) + (* With iterative deepening of inferences or depth. *) + (* ----------------------------------------------------------------------- *) + + let solve_goal rules incdepth min max incsize = + let rec solve n g = + if n > max then failwith "solve_goal: Too deep" else + (if !meson_chatty & !verbose then + (Format.print_string + ((string_of_int (!inferences))^" inferences so far. "^ + "Searching with maximum size "^(string_of_int n)^"."); + Format.print_newline()) + else if !verbose then + (Format.print_string(string_of_int (!inferences)^".."); + Format.print_flush()) + else ()); + try let gi = + if incdepth then expand_goal rules g n 100000 (fun x -> x) + else expand_goal rules g 100000 n (fun x -> x) in + (if !meson_chatty & !verbose then + (Format.print_string + ("Goal solved with "^(string_of_int (!inferences))^ + " inferences."); + Format.print_newline()) + else if !verbose then + (Format.print_string("solved at "^string_of_int (!inferences)); + Format.print_newline()) + else ()); + gi + with Failure _ -> solve (n + incsize) g in + fun g -> solve min (g,[]) ;; + + (* ----------------------------------------------------------------------- *) + (* Creation of tagged contrapositives from a HOL clause. *) + (* This includes any possible support clauses (1 = falsity). *) + (* The rules are partitioned into association lists. *) + (* ----------------------------------------------------------------------- *) + + let fol_of_hol_clauses = + let eqt (a1,(b1,c1)) (a2, (b2,c2)) = + ((a1 = a2) & (b1 = b2) & (equals_thm c1 c2)) in + let mk_negated (p,a) = -p,a in + let rec mk_contraposes n th used unused sofar = + match unused with + [] -> sofar + | h::t -> let nw = (map mk_negated (used @ t),h),(n,th) in + mk_contraposes (n + 1) th (used@[h]) t (nw::sofar) in + let fol_of_hol_clause th = + let lconsts = freesl (hyp th) in + let tm = concl th in + let hlits = disjuncts tm in + let flits = map (fol_of_literal [] lconsts) hlits in + let basics = mk_contraposes 0 th [] flits [] in + if forall (fun (p,_) -> p < 0) flits then + ((map mk_negated flits,(1,[])),(-1,th))::basics + else basics in + fun thms -> + let rawrules = itlist (union' eqt o fol_of_hol_clause) thms [] in + let prs = setify (map (fst o snd o fst) rawrules) in + let prules = + map (fun t -> t,filter ((=) t o fst o snd o fst) rawrules) prs in + let srules = sort (fun (p,_) (q,_) -> abs(p) <= abs(q)) prules in + srules ;; + + + (* ----------------------------------------------------------------------- *) + (* Optimize set of clauses; changing literal order complicates HOL stuff. *) + (* ----------------------------------------------------------------------- *) + + let optimize_rules = + let optimize_clause_order cls = + sort (fun ((l1,_),_) ((l2,_),_) -> length l1 <= length l2) cls in + map (fun (a,b) -> a,optimize_clause_order b) ;; + + + (* ----------------------------------------------------------------------- *) + (* Create a HOL contrapositive on demand, with a cache. *) + (* ----------------------------------------------------------------------- *) + + let clear_contrapos_cache,make_hol_contrapos = + let DISJ_AC = AC DISJ_ACI + and imp_CONV = REWR_CONV(TAUT `a \/ b <=> ~b ==> a`) + and push_CONV = + GEN_REWRITE_CONV TOP_SWEEP_CONV + [TAUT `~(a \/ b) <=> ~a /\ ~b`; TAUT `~(~a) <=> a`] + and pull_CONV = GEN_REWRITE_CONV DEPTH_CONV + [TAUT `~a \/ ~b <=> ~(a /\ b)`] + and imf_CONV = REWR_CONV(TAUT `~p <=> p ==> F`) in + let memory = ref [] in + let clear_contrapos_cache() = memory := [] in + let make_hol_contrapos (n,th) = + let tm = concl th in + let key = (n,tm) in + try assoc key (!memory) with Failure _ -> + if n < 0 then + CONV_RULE (pull_CONV THENC imf_CONV) th + else + let djs = disjuncts tm in + let acth = + if n = 0 then th else + let ldjs,rdjs = chop_list n djs in + let ndjs = (hd rdjs)::(ldjs@(tl rdjs)) in + EQ_MP (DISJ_AC(mk_eq(tm,list_mk_disj ndjs))) th in + let fth = + if length djs = 1 then acth + else CONV_RULE (imp_CONV THENC push_CONV) acth in + (memory := (key,fth)::(!memory); fth) in + clear_contrapos_cache,make_hol_contrapos ;; + + + (* ----------------------------------------------------------------------- *) + (* Translate back the saved proof into HOL. *) + (* ----------------------------------------------------------------------- *) + + let meson_to_hol = + let hol_negate tm = + try dest_neg tm with Failure _ -> mk_neg tm in + let merge_inst (t,x) current = + (fol_subst current t,x)::current in + let finish_RULE = + GEN_REWRITE_RULE I + [TAUT `(~p ==> p) <=> p`; TAUT `(p ==> ~p) <=> ~p`] in + let rec meson_to_hol insts (Subgoal(g,gs,(n,th),offset,locin)) = + let newins = itlist merge_inst locin insts in + let g' = fol_inst newins g in + let hol_g = hol_of_literal g' in + let ths = map (meson_to_hol newins) gs in + let hth = + if equals_thm th TRUTH then ASSUME hol_g else + let cth = make_hol_contrapos(n,th) in + if ths = [] then cth else MATCH_MP cth (end_itlist CONJ ths) in + let ith = PART_MATCH I hth hol_g in + finish_RULE (DISCH (hol_negate(concl ith)) ith) in + meson_to_hol ;; + + + (* ----------------------------------------------------------------------- *) + (* Create equality axioms for all the function and predicate symbols in *) + (* a HOL term. Not very efficient (but then neither is throwing them into *) + (* automated proof search!) *) + (* ----------------------------------------------------------------------- *) + + let create_equality_axioms = + let eq_thms = (CONJUNCTS o prove) + (`(x:A = x) /\ + (~(x:A = y) \/ ~(x = z) \/ (y = z))`, + REWRITE_TAC[] THEN ASM_CASES_TAC `x:A = y` THEN + ASM_REWRITE_TAC[] THEN CONV_TAC TAUT) in + let imp_elim_CONV = REWR_CONV + (TAUT `(a ==> b) <=> ~a \/ b`) in + let eq_elim_RULE = + MATCH_MP(TAUT `(a <=> b) ==> b \/ ~a`) in + let veq_tm = rator(rator(concl(hd eq_thms))) in + let create_equivalence_axioms (eq,_) = + let tyins = type_match (type_of veq_tm) (type_of eq) [] in + map (INST_TYPE tyins) eq_thms in + let rec tm_consts tm acc = + let fn,args = strip_comb tm in + if args = [] then acc + else itlist tm_consts args (insert (fn,length args) acc) in + let rec fm_consts tm ((preds,funs) as acc) = + try fm_consts(snd(dest_forall tm)) acc with Failure _ -> + try fm_consts(snd(dest_exists tm)) acc with Failure _ -> + try let l,r = dest_conj tm in fm_consts l (fm_consts r acc) + with Failure _ -> try + let l,r = dest_disj tm in fm_consts l (fm_consts r acc) + with Failure _ -> try + let l,r = dest_imp tm in fm_consts l (fm_consts r acc) + with Failure _ -> try + fm_consts (dest_neg tm) acc with Failure _ -> + try let l,r = dest_eq tm in + if type_of l = bool_ty + then fm_consts r (fm_consts l acc) + else failwith "atomic equality" + with Failure _ -> + let pred,args = strip_comb tm in + if args = [] then acc else + insert (pred,length args) preds,itlist tm_consts args funs in + let create_congruence_axiom pflag (tm,len) = + let atys,rty = splitlist (fun ty -> let op,l = dest_type ty in + if op = "fun" then hd l,hd(tl l) + else fail()) + (type_of tm) in + let ctys = fst(chop_list len atys) in + let largs = map genvar ctys + and rargs = map genvar ctys in + let th1 = rev_itlist (C (curry MK_COMB)) (map (ASSUME o mk_eq) + (zip largs rargs)) (REFL tm) in + let th2 = if pflag then eq_elim_RULE th1 else th1 in + itlist (fun e th -> CONV_RULE imp_elim_CONV (DISCH e th)) (hyp th2) th2 in + fun tms -> let preds,funs = itlist fm_consts tms ([],[]) in + let eqs0,noneqs = partition + (fun (t,_) -> is_const t & fst(dest_const t) = "=") preds in + if eqs0 = [] then [] else + let pcongs = map (create_congruence_axiom true) noneqs + and fcongs = map (create_congruence_axiom false) funs in + let preds1,_ = + itlist fm_consts (map concl (pcongs @ fcongs)) ([],[]) in + let eqs1 = filter + (fun (t,_) -> is_const t & fst(dest_const t) = "=") preds1 in + let eqs = union eqs0 eqs1 in + let equivs = + itlist (union' equals_thm o create_equivalence_axioms) + eqs [] in + equivs@pcongs@fcongs ;; + + (* ----------------------------------------------------------------------- *) + (* Brand's transformation. *) + (* ----------------------------------------------------------------------- *) + + let perform_brand_modification = + let rec subterms_irrefl lconsts tm acc = + if is_var tm or is_const tm then acc else + let fn,args = strip_comb tm in + itlist (subterms_refl lconsts) args acc + and subterms_refl lconsts tm acc = + if is_var tm then if mem tm lconsts then insert tm acc else acc + else if is_const tm then insert tm acc else + let fn,args = strip_comb tm in + itlist (subterms_refl lconsts) args (insert tm acc) in + let CLAUSIFY = CONV_RULE(REWR_CONV(TAUT `a ==> b <=> ~a \/ b`)) in + let rec BRAND tms th = + if tms = [] then th else + let tm = hd tms in + let gv = genvar (type_of tm) in + let eq = mk_eq(gv,tm) in + let th' = CLAUSIFY (DISCH eq (SUBS [SYM (ASSUME eq)] th)) + and tms' = map (subst [gv,tm]) (tl tms) in + BRAND tms' th' in + let BRAND_CONGS th = + let lconsts = freesl (hyp th) in + let lits = disjuncts (concl th) in + let atoms = map (fun t -> try dest_neg t with Failure _ -> t) lits in + let eqs,noneqs = partition + (fun t -> try fst(dest_const(fst(strip_comb t))) = "=" + with Failure _ -> false) atoms in + let acc = itlist (subterms_irrefl lconsts) noneqs [] in + let uts = itlist + (itlist (subterms_irrefl lconsts) o snd o strip_comb) eqs acc in + let sts = sort (fun s t -> not(free_in s t)) uts in + BRAND sts th in + let BRANDE th = + let tm = concl th in + let l,r = dest_eq tm in + let gv = genvar(type_of l) in + let eq = mk_eq(r,gv) in + CLAUSIFY(DISCH eq (EQ_MP (AP_TERM (rator tm) (ASSUME eq)) th)) in + let LDISJ_CASES th lth rth = + DISJ_CASES th (DISJ1 lth (concl rth)) (DISJ2 (concl lth) rth) in + let ASSOCIATE = CONV_RULE(REWR_CONV(GSYM DISJ_ASSOC)) in + let rec BRAND_TRANS th = + let tm = concl th in + try let l,r = dest_disj tm in + if is_eq l then + let lth = ASSUME l in + let lth1 = BRANDE lth + and lth2 = BRANDE (SYM lth) + and rth = BRAND_TRANS (ASSUME r) in + map (ASSOCIATE o LDISJ_CASES th lth1) rth @ + map (ASSOCIATE o LDISJ_CASES th lth2) rth + else + let rth = BRAND_TRANS (ASSUME r) in + map (LDISJ_CASES th (ASSUME l)) rth + with Failure _ -> + if is_eq tm then [BRANDE th; BRANDE (SYM th)] + else [th] in + let find_eqs = + find_terms (fun t -> try fst(dest_const t) = "=" + with Failure _ -> false) in + let REFLEXATE ths = + let eqs = itlist (union o find_eqs o concl) ths [] in + let tys = map (hd o snd o dest_type o snd o dest_const) eqs in + let gvs = map genvar tys in + itlist (fun v acc -> (REFL v)::acc) gvs ths in + fun ths -> + if exists (can (find_term is_eq o concl)) ths then + let ths' = map BRAND_CONGS ths in + let ths'' = itlist (union' equals_thm o BRAND_TRANS) ths' [] in + REFLEXATE ths'' + else ths ;; + + + (* ----------------------------------------------------------------------- *) + (* Push duplicated copies of poly theorems to match existing assumptions. *) + (* ----------------------------------------------------------------------- *) + + let POLY_ASSUME_TAC = + let rec uniq' eq = + fun l -> + match l with + x::(y::_ as t) -> let t' = uniq' eq t in + if eq x y then t' else + if t'==t then l else x::t' + | _ -> l in + let setify' le eq s = uniq' eq (sort le s) in + let rec grab_constants tm acc = + if is_forall tm or is_exists tm then grab_constants (body(rand tm)) acc + else if is_iff tm or is_imp tm or is_conj tm or is_disj tm then + grab_constants (rand tm) (grab_constants (lhand tm) acc) + else if is_neg tm then grab_constants (rand tm) acc + else union (find_terms is_const tm) acc in + let match_consts (tm1,tm2) = + let s1,ty1 = dest_const tm1 + and s2,ty2 = dest_const tm2 in + if s1 = s2 then type_match ty1 ty2 [] + else failwith "match_consts" in + let polymorph mconsts th = + let tvs = subtract (type_vars_in_term (concl th)) + (unions (map type_vars_in_term (hyp th))) in + if tvs = [] then [th] else + let pconsts = grab_constants (concl th) [] in + let tyins = mapfilter match_consts + (allpairs (fun x y -> x,y) pconsts mconsts) in + let ths' = + setify' (fun th th' -> dest_thm th <= dest_thm th') + equals_thm (mapfilter (C INST_TYPE th) tyins) in + if ths' = [] then + (warn true "No useful-looking instantiations of lemma"; [th]) + else ths' in + let rec polymorph_all mconsts ths acc = + if ths = [] then acc else + let ths' = polymorph mconsts (hd ths) in + let mconsts' = itlist grab_constants (map concl ths') mconsts in + polymorph_all mconsts' (tl ths) (union' equals_thm ths' acc) in + fun ths (asl,w as gl) -> + let mconsts = itlist (grab_constants o concl o snd) asl [] in + let ths' = polymorph_all mconsts ths [] in + MAP_EVERY ASSUME_TAC ths' gl ;; + + (* ----------------------------------------------------------------------- *) + (* Basic HOL MESON procedure. *) + (* ----------------------------------------------------------------------- *) + + let SIMPLE_MESON_REFUTE min max inc ths = + clear_contrapos_cache(); + inferences := 0; + let old_dcutin = !meson_dcutin in + if !meson_depth then meson_dcutin := 100001 else (); + let ths' = if !meson_brand then perform_brand_modification ths + else ths @ create_equality_axioms (map concl ths) in + let rules = optimize_rules(fol_of_hol_clauses ths') in + let proof,(insts,_,_) = + solve_goal rules (!meson_depth) min max inc (1,[]) in + meson_dcutin := old_dcutin; + meson_to_hol insts proof ;; + + let PREP_SIMPLE_MESON_REFUTE ths = + clear_contrapos_cache(); + inferences := 0; + let old_dcutin = !meson_dcutin in + if !meson_depth then meson_dcutin := 100001 else (); + let ths' = if !meson_brand then perform_brand_modification ths + else ths @ create_equality_axioms (map concl ths) in + optimize_rules(fol_of_hol_clauses ths') ;; + + let CONJUNCTS_THEN' ttac cth = + ttac(CONJUNCT1 cth) THEN ttac(CONJUNCT2 cth) ;; + + let PURE_MESON_TAC min max inc gl = + reset_vars(); reset_consts(); + (FIRST_ASSUM CONTR_TAC ORELSE + W(ACCEPT_TAC o SIMPLE_MESON_REFUTE min max inc o map snd o fst)) gl ;; + + let QUANT_BOOL_CONV = + PURE_REWRITE_CONV[FORALL_BOOL_THM; EXISTS_BOOL_THM; COND_CLAUSES; + NOT_CLAUSES; IMP_CLAUSES; AND_CLAUSES; OR_CLAUSES; + EQ_CLAUSES; FORALL_SIMP; EXISTS_SIMP] ;; + + let rec SPLIT_TAC n g = + ((FIRST_X_ASSUM(CONJUNCTS_THEN' ASSUME_TAC) THEN SPLIT_TAC n) ORELSE + (if n > 0 then FIRST_X_ASSUM DISJ_CASES_TAC THEN SPLIT_TAC (n - 1) + else NO_TAC) ORELSE + ALL_TAC) g ;; + +(* + let SHORT_PREP_MESON_TAC ths = + REFUTE_THEN ASSUME_TAC THEN + POLY_ASSUME_TAC (map GEN_ALL ths) THEN + W(MAP_EVERY(UNDISCH_TAC o concl o snd) o fst) THEN + SELECT_ELIM_TAC THEN + W(fun (asl,w) -> MAP_EVERY (fun v -> SPEC_TAC(v,v)) (frees w)) THEN + CONV_TAC(PRESIMP_CONV THENC + TOP_DEPTH_CONV BETA_CONV THENC + LAMBDA_ELIM_CONV THENC + CONDS_CELIM_CONV THENC + QUANT_BOOL_CONV) THEN + REPEAT(GEN_TAC ORELSE DISCH_TAC) THEN + REFUTE_THEN ASSUME_TAC ;; +*) + let PREP_MESON_TAC ths = + REFUTE_THEN ASSUME_TAC THEN + POLY_ASSUME_TAC (map GEN_ALL ths) THEN + W(MAP_EVERY(UNDISCH_TAC o concl o snd) o fst) THEN + SELECT_ELIM_TAC THEN + W(fun (asl,w) -> MAP_EVERY (fun v -> SPEC_TAC(v,v)) (frees w)) THEN + CONV_TAC(PRESIMP_CONV THENC + TOP_DEPTH_CONV BETA_CONV THENC + LAMBDA_ELIM_CONV THENC + CONDS_CELIM_CONV THENC + QUANT_BOOL_CONV) THEN + REPEAT(GEN_TAC ORELSE DISCH_TAC) THEN + REFUTE_THEN ASSUME_TAC THEN + RULE_ASSUM_TAC(CONV_RULE(NNF_CONV THENC SKOLEM_CONV)) THEN + REPEAT (FIRST_X_ASSUM CHOOSE_TAC) THEN + ASM_FOL_TAC THEN + SPLIT_TAC (!meson_split_limit) THEN + RULE_ASSUM_TAC(CONV_RULE(PRENEX_CONV THENC WEAK_CNF_CONV)) THEN + RULE_ASSUM_TAC(repeat + (fun th -> SPEC(genvar(type_of(fst(dest_forall(concl th))))) th)) THEN + REPEAT (FIRST_X_ASSUM (CONJUNCTS_THEN' ASSUME_TAC)) THEN + RULE_ASSUM_TAC(CONV_RULE(ASSOC_CONV DISJ_ASSOC)) THEN + REPEAT (FIRST_X_ASSUM SUBST_VAR_TAC);; + + + + +let GEN_MESON_TAC = + fun min max step ths -> + PREP_MESON_TAC ths THEN PURE_MESON_TAC min max step;; + + +(* ------------------------------------------------------------------------- *) +(* Common cases. *) +(* ------------------------------------------------------------------------- *) + +let ASM_MESON_TAC = GEN_MESON_TAC 0 50 1;; + +let MESON_TAC ths = POP_ASSUM_LIST(K ALL_TAC) THEN ASM_MESON_TAC ths;; + +(* ------------------------------------------------------------------------- *) +(* Also introduce a rule. *) +(* ------------------------------------------------------------------------- *) + +let MESON ths tm = prove(tm,MESON_TAC ths);; + +(* MESON_PREP_TAC *) + +let fof_list = ref [];; + +let MESON_SAVE_FOF_TAC thms (asl,g) = + let (_,gs,_) = PREP_MESON_TAC thms (asl,g) in + let g' = hd gs in + let fof = PREP_SIMPLE_MESON_REFUTE (map snd (fst g')) in + let _ = fof_list := fof :: !fof_list in + MESON_TAC thms (asl,g);; + +(* print first order formulas *) + +let rec print_fol_term tm = match tm with + Fvar i -> print_string "Fvar("; print_int i; print_string ")" + | Fnapp (i,fls) -> print_string "Fnapp ("; print_int i; + print_string ", ["; + do_list (fun t -> print_fol_term t;print_string ";") fls; print_string "])";; + +let print_fol_atom (i,fls) = + print_int i; print_string ", ["; + do_list (fun t -> print_fol_term t;print_string ";") fls; print_string "])";; + +let rec print_fol_form fo = match fo with + | Atom a -> print_string "Atom("; print_fol_atom a; print_string ")" + | Conj(a,b) -> print_string "Conj("; print_fol_form a; print_string ","; print_fol_form b; print_string ")" + | Disj(a,b) -> print_string "Disj("; print_fol_form a; print_string ","; print_fol_form b; print_string ")" + | Forallq (i,f) -> print_string "Forallq("; print_int i; print_string ","; print_fol_form f; print_string ")";; + +let (print_dl:((fol_atom list * (int * fol_term list)) * (int * thm))->unit)= + fun ((fas,(i,fts)),(k,th)) -> + print_string "("; + do_list print_fol_atom fas; + print_string ",("; print_int i; + print_string ","; do_list print_fol_term fts; + print_string "),("; print_int k; + print_string ","; print_thm th; print_string ")) ";; + +let print_data (i,dls) = + print_string "("; print_int i; print_string ","; + do_list print_dl dls; print_string ")\n\n";; + + + +end;; diff --git a/development/thales/chaff/tactic.hl b/development/thales/chaff/tactic.hl new file mode 100644 index 0000000..8ea81ed --- /dev/null +++ b/development/thales/chaff/tactic.hl @@ -0,0 +1,97 @@ +(* +places: + goal, assumption list, input box with prompts, proof text, search results + + +*) + +(* +theorem searching -n NAME, -o omit, -r rewrite format, -s sort by length, - +save search history and selected results., + +*) + +(* Jordan from: + eventually merge... *) + +let rec type_set: (string*term) list -> (term list*term) -> (term list*term)= + fun tinfo (acclist,utm) -> match acclist with + | [] -> (acclist,utm) + | (Var(s,_) as a)::rest -> + let a' = (assocd s tinfo a) in + if (a = a') then type_set tinfo (rest,utm) + else let inst = instantiate (term_match [] a a') in + type_set tinfo ((map inst rest),inst utm) + | _ -> failwith "type_set: variable expected" + ;; + +let has_stv t = + let typ = (type_vars_in_term t) in + can (find (fun ty -> (is_vartype ty) && ((dest_vartype ty).[0] = '?'))) typ;; + +let typeinfo (asl,w) = + let freel = itlist (union o frees o concl o snd) asl (frees w) in + let pairup = (function + |Var(s,_) as t -> (s,t) + | _ -> failwith "typeinfo: unreachable state" ) in + map pairup freel;; + +let set_types_from_goal (asl,w) = + let set_types tinfo t = snd (type_set tinfo ((frees t),t)) in + set_types (typeinfo(asl,w));; + +let TYPE_THEN: term -> (term -> tactic) -> tactic = + fun t tac (asl,w) -> + let t' = set_types_from_goal(asl,w) t in + (warn ((has_stv t')) "TYPE_THEN: unresolved type variables"); + tac t' (asl,w);; + +let TYPEL_THEN: term list -> (term list -> tactic) -> tactic = + fun t tac (asl,w) -> + let t' = map (set_types_from_goal(asl,w)) t in + (warn ((can (find has_stv) t')) "TYPEL_THEN: unresolved type vars"); + tac t' (asl,w);; + +help "ABBREV_TAC";; +(* hightlight term, typeover abbrev *) +let MK_ABBREV_TAC: term -> string -> goal -> goalstate = + fun oldtext abbrev (asl,w) -> + let text = set_types_from_goal (asl,w) oldtext in + let abbrev' = mk_var(abbrev,(type_of text)) in + ABBREV_TAC (mk_eq (abbrev', text)) (asl,w);; + +help "ABS_TAC";; +(* delete the lambda, or the bound variable *) + +help "ACCEPT_TAC";; (* ignore for now *) + +help "ALL_TAC";; (* ignore for now *) + +help "ANTE_RES_THEN";; (* ignore for now *) + +help "ANTS_TAC";; (* delete ant of ant, subgoal button *) + +help "AP_TERM_TAC";; (* delete f in f x = f y, either first or second instance *) + +help "AP_THM_TAC";; (* delete x in f x = g x, either first or second *) + +help "ARITH_TAC";; (* terminator, try if it is an arithmetic expression. *) + +help "ASM_CASES_TAC";; (* needs a term u to split *) + +help "ASM_FOL_TAC";; (* ignore forever *) + +help "ASM_MESON_TAC";; (* terminator , option -a on MESON_TAC *) + +help "ASM_REWRITE_TAC";; (* option -a on REWRITE_TAC *) + +help "ASM_SIMP_TAC";; (* option -a on SIMP_TAC *) + +help "ASSUME_TAC";; (* needs theorem *) + +help "BETA_TAC";; (* delete lambda *) + + + + + diff --git a/development/thales/chaff/tactics.hl b/development/thales/chaff/tactics.hl new file mode 100644 index 0000000..b54c9ce --- /dev/null +++ b/development/thales/chaff/tactics.hl @@ -0,0 +1,1395 @@ +(* +Hales, tactics +*) + +(* + A type conflict is defined as two terms in the same context with + the same string name and different types. We search for type conflicts in the + head of the current goal stack. +*) + +let conflict () = + let rec atoms tm = + match tm with + | Var(_,_) -> [dest_var tm] + | Const(_,_) -> [] + | Abs(bv,bod) -> dest_var bv :: atoms bod + | Comb(s,t) -> atoms s @ atoms t in + let atoml tml = itlist (union o atoms) tml [] in + let atomg (r,t) = atoml (t :: map (concl o snd) r) in + let rec atomgl r = match r with + [] -> [] + | b::bs -> atomg b @ atomgl bs in + let atomc() = sort (<) (atomgl ((fun (_,x,_) -> x) (hd (!current_goalstack)))) in + let rec confl x acc = match x with + [] -> acc + | b::[] -> acc + | a::b::bs -> if ((fst a = fst b) && not(snd a = snd b) ) + then (confl (b::bs) ((a,b)::acc)) else confl (b::bs) acc in + confl (atomc()) [];; + +(* ------------------------------------------------------------------ *) +(* This bundles an interactive session into a proof. *) +(* From jordan_curve/hol_ext/tactics_refine.ml *) +(* ------------------------------------------------------------------ *) + + +let (set_label,no_label,labeled) = + let flag = ref false in + (fun () -> (flag:= true)),(fun ()-> (flag:=false)),(fun () -> !flag);; + +let LABEL_ALL_TAC:tactic = + let mk_label avoid = + let rec mk_one_label i avoid = + let label = "Z-"^(string_of_int i) in + if not(mem label avoid) then label else mk_one_label (i+1) avoid in + mk_one_label 0 avoid in + let update_label i asl = + let rec f_at_i f j = + function [] -> [] + | a::b -> if (j=0) then (f a)::b else a::(f_at_i f (j-1) b) in + let avoid = map fst asl in + let current = el i avoid in + let new_label = mk_label avoid in + if (String.length current > 0) then asl else + f_at_i (fun (_,y) -> (new_label,y) ) i asl in + fun (asl,w) -> + let aslp = ref asl in + (for i=0 to ((length asl)-1) do (aslp := update_label i !aslp) done; + (ALL_TAC (!aslp,w)));; + +(* global_var *) +let (EVERY_STEP_TAC:tactic ref) = ref ALL_TAC;; + +let (e:tactic ->goalstack) = + fun tac -> refine(by(VALID + (if labeled() then (tac THEN (!EVERY_STEP_TAC)) THEN LABEL_ALL_TAC + else tac)));; + +let has_stv t = + let typ = (type_vars_in_term t) in + can (find (fun ty -> (is_vartype ty) && ((dest_vartype ty).[0] = '?'))) typ;; + +let prove_by_refinement(t,(tacl:tactic list)) = + if (length (frees t) > 0) + then failwith "prove_by_refinement: free vars" else + if (has_stv t) + then failwith "prove_by_refinement: has stv" else + let gstate = mk_goalstate ([],t) in + let _,sgs,just = rev_itlist + (fun tac gs -> by + (if labeled() then (tac THEN + (!EVERY_STEP_TAC) THEN LABEL_ALL_TAC ) else tac) gs) + tacl gstate in + let th = if sgs = [] then just null_inst [] + else failwith "BY_REFINEMENT_PROOF: Unsolved goals" in + let t' = concl th in + if t' = t then th else + try EQ_MP (ALPHA t' t) th + with Failure _ -> failwith "prove_by_refinement: generated wrong theorem";; + +(* ------------------------------------------------------------------------- *) +(* A printer for goals etc. *) +(* ------------------------------------------------------------------------- *) + +(* had (rev asl) in this method. I don't want to reverse the list *) + +let save_hashstring,mem_hashstring,remove_hashstring,find_hashstring,memhash_of_string = + let saved_hashstring = + ref ((Hashtbl.create 300):(string,int) Hashtbl.t) in +(fun string -> + Hashtbl.add !saved_hashstring (string) (hash_of_string string)), +(fun s -> Hashtbl.mem !saved_hashstring s), +(fun s -> Hashtbl.remove !saved_hashstring s), +(fun s-> Hashtbl.find !saved_hashstring s), +(fun s->if not(mem_hashstring s) then (save_hashstring s) ; + find_hashstring s);; + +let hash_of_string = + let q = 1223 in + let p = 8831 in + let hashll = itlist (fun x y -> (int_of_char (String.get x 0) + q*y) mod p) in + fun s -> + hashll (explode s) 0;; + +let hash_of_type = + let q = [863;941;1069;1151; 9733] in (* some primes *) + let p n = List.nth q n in + let red n = n mod p 4 in + let m s = memhash_of_string s in + let rec hashl v = itlist (fun x y -> red(hasht x + p 3*y)) v 0 and + hasht v = match v with + | Tyvar s -> red (p 0*m s + p 1) + | Tyapp (s,tlt) -> let h = m s in + let h2 = red (h*h) in + red (p 2*h2 + hashl tlt ) in + hasht;; + +(* +make hash_of_term constant on alpha-equivalence classes of +terms + +based on jordan_curve/hol_ext/tactics_fix.ml +*) + +let hash_of_term = (* q = list of primes *) + let q = [ 9887 ;1291; 1373; 1451; 1511; 1583; 1657; 1733; 1811] in + let p n = List.nth q n in + let red n = 100+(n mod p 0) in + let sq n = red (n*n) in + let ren level v = ("??_"^(string_of_int level),type_of v) in + let m s = memhash_of_string s in + let ty s = hash_of_type s in + let hh n s t = red (p n * m s + ty t) in + let hhh ht level e n i j = red(p n * sq (ht level e i) + p (n+1) * (ht level e j) + p (n+2)) in + let rec ht level e u = match u with + | Var(s,t) -> let (s',t') = assocd (s,t) e (s,t) in hh 1 s' t' + | Const(s,t) -> hh 2 s t + | Comb (s,t) -> hhh ht level e 3 s t + | Abs(s,t) -> hhh ht (level+1) ((dest_var s,ren level s)::e) 6 s t + in ht 0 [] ;; + + +(* printing *) + +let print_hyp n (s,th) = + open_hbox(); + print_string " "; + print_as 4 (string_of_int (hash_of_term (concl th))); + print_string " ["; + print_qterm (concl th); + print_string "]"; + (if not (s = "") then (print_string (" ("^s^")")) else ()); + close_box(); + print_newline();; + +let rec print_hyps n asl = + if asl = [] then () else + (print_hyp n (hd asl); + print_hyps (n + 1) (tl asl));; + +let (print_goal_hashed:goal->unit) = + fun (asl,w) -> + print_newline(); + if asl <> [] then (print_hyps 0 (asl); print_newline()) else (); + print_qterm w; print_newline();; + +let (print_goalstate_hashed:int->goalstate->unit) = + fun k gs -> let (_,gl,_) = gs in + let n = length gl in + let s = if n = 0 then "No subgoals" else + (string_of_int k)^" subgoal"^(if k > 1 then "s" else "") + ^" ("^(string_of_int n)^" total)" in + print_string s; print_newline(); + if gl = [] then () else + do_list (print_goal_hashed o C el gl) (rev(0 -- (k-1)));; + +let (print_goalstack_hashed:goalstack->unit) = + fun (l) -> + if l = [] then print_string "Empty goalstack" + else if tl l = [] then + let (_,gl,_ as gs) = hd l in + print_goalstate_hashed 1 gs + else + let (_,gl,_ as gs) = hd l + and (_,gl0,_) = hd(tl l) in + let p = length gl - length gl0 in + let p' = if p < 1 then 1 else p + 1 in + print_goalstate_hashed p' gs;; + +#install_printer print_goal_hashed;; +#install_printer print_goalstack_hashed;; + + +(* ------------------------------------------------------------------ *) +(* MORE RECENT ADDITIONS *) +(* ------------------------------------------------------------------ *) + + + +(* abbrev_type copied from definitions_group.ml *) + +let pthm = prove_by_refinement( + `(\ (x:A) .T) (@(x:A). T)`, + [BETA_TAC]);; + +(* + +let abbrev_type ty s = let (a,b) = new_basic_type_definition s + ("mk_"^s,"dest_"^s) + (INST_TYPE [ty,`:A`] pthm) in + let abst t = list_mk_forall ((frees t), t) in + let a' = abst (concl a) in + let b' = abst (rhs (concl b)) in + ( + prove_by_refinement(a',[REWRITE_TAC[a]]), + prove_by_refinement(b',[REWRITE_TAC[GSYM b]]));; + +*) + +(* ------------------------------------------------------------------ *) +(* KILL IN *) +(* ------------------------------------------------------------------ *) + +let un = REWRITE_RULE[IN];; + +(* ------------------------------------------------------------------ *) +(* Nonfunctional Experiment *) +(* ------------------------------------------------------------------ *) + +let goal=0;; +let first=1;; +let last=99;; +let all=55;; + +type form = Existential | Universal | Conjunction | Disjunction | Lambda | Equality | Unknown;; + +let form tm = if (is_forall tm) then Existential else Existential;; + +(* break down *) + +let br i = match i with + 0 -> true + | 1 -> false;; + +(* insert *) + +let in i = match i with + 0 -> true;; + +(* combine *) + +(* ------------------------------------------------------------------ *) +(* some general tactics *) +(* ------------------------------------------------------------------ *) + + +let SUBCONJ_TAC = + MATCH_MP_TAC (TAUT `A /\ (A ==>B) ==> (A /\ B)`) THEN CONJ_TAC;; + +let PROOF_BY_CONTR_TAC = + MATCH_MP_TAC (TAUT `(~A ==> F) ==> A`) THEN DISCH_TAC;; + + + +(* ------------------------------------------------------------------ *) +(* some general tactics *) +(* ------------------------------------------------------------------ *) + +(* before adding assumption to hypothesis list, cleanse it + of unnecessary conditions *) + + +let CLEAN_ASSUME_TAC th = + MP_TAC th THEN ASM_REWRITE_TAC[] THEN DISCH_TAC;; + +let CLEAN_THEN th ttac = + MP_TAC th THEN ASM_REWRITE_TAC[] THEN DISCH_THEN ttac;; + +(* looks for a hypothesis by matching a subterm *) +let (UNDISCH_FIND_TAC: term -> tactic) = + fun tm (asl,w) -> + let p = can (term_match[] tm) in + try let sthm,_ = remove + (fun (_,asm) -> can (find_term p) (concl ( asm))) asl in + UNDISCH_TAC (concl (snd sthm)) (asl,w) + with Failure _ -> failwith "UNDISCH_FIND_TAC";; + +let (UNDISCH_FIND_THEN: term -> thm_tactic -> tactic) = + fun tm ttac (asl,w) -> + let p = can (term_match[] tm) in + try let sthm,_ = remove + (fun (_,asm) -> can (find_term p) (concl ( asm))) asl in + UNDISCH_THEN (concl (snd sthm)) ttac (asl,w) + with Failure _ -> failwith "UNDISCH_FIND_TAC";; + +(* ------------------------------------------------------------------ *) +(* NAME_CONFLICT_TAC : eliminate name conflicts in a term *) +(* ------------------------------------------------------------------ *) + +let relabel_bound_conv tm = + let rec vars_and_constants tm acc = + match tm with + | Var _ -> tm::acc + | Const _ -> tm::acc + | Comb(a,b) -> vars_and_constants b (vars_and_constants a acc) + | Abs(a,b) -> a::(vars_and_constants b acc) in + let relabel_bound tm = + match tm with + | Abs(x,t) -> + let avoids = gather ((!=) x) (vars_and_constants tm []) in + let x' = mk_primed_var avoids x in + if (x=x') then failwith "relabel_bound" else (alpha x' tm) + | _ -> failwith "relabel_bound" in + DEPTH_CONV (fun t -> ALPHA t (relabel_bound t)) tm;; + +(* example *) +let _ = + let bad_term = mk_abs (`x:bool`,`(x:num)+1=2`) in + relabel_bound_conv bad_term;; + +let NAME_CONFLICT_CONV = relabel_bound_conv;; + +let NAME_CONFLICT_TAC = CONV_TAC (relabel_bound_conv);; + +(* renames given bound variables *) +let alpha_conv env tm = ALPHA tm (deep_alpha env tm);; + +(* replaces given alpha-equivalent terms with- the term itself *) +let unify_alpha_tac = SUBST_ALL_TAC o REFL;; + +let rec get_abs tm acc = match tm with + Abs(u,v) -> get_abs v (tm::acc) + |Comb(u,v) -> get_abs u (get_abs v acc) + |_ -> acc;; + +(* for purposes such as sorting, it helps if ALL ALPHA-equiv + abstractions are replaced by equal abstractions *) +let (alpha_tac:tactic) = + fun (asl,w' ) -> + EVERY (map unify_alpha_tac (get_abs w' [])) (asl,w');; + +(* ------------------------------------------------------------------ *) +(* SELECT ELIMINATION. + SELECT_TAC should work whenever there is a single predicate selected. + Something more sophisticated might be needed when there + is (@)A and (@)B + in the same formula. + Useful for proving statements such as `1 + (@x. (x=3)) = 4` *) +(* ------------------------------------------------------------------ *) + +(* spec form of SELECT_AX *) +let select_thm select_fn select_exist = + BETA_RULE (ISPECL [select_fn;select_exist] + SELECT_AX);; + +(* example *) +select_thm + `\m. (X:num->bool) m /\ (!n. X n ==> m <=| n)` `n:num`;; + +let SELECT_EXIST = prove_by_refinement( + `!(P:A->bool) Q. (?y. P y) /\ (!t. (P t ==> Q t)) ==> Q ((@) P)`, + (* {{{ proof *) [ REPEAT GEN_TAC; DISCH_ALL_TAC; UNDISCH_FIND_TAC `(?)`; DISCH_THEN CHOOSE_TAC; ASSUME_TAC (ISPECL[`P:(A->bool)`;`y:A`] SELECT_AX); ASM_MESON_TAC[]; ]);; (* }}} *) + +let SELECT_THM = prove_by_refinement( + `!(P:A->bool) Q. (((?y. P y) ==> (!t. (P t ==> Q t))) /\ ((~(?y. P y)) ==> + (!t. Q t))) ==> Q ((@) P)`, + (* {{{ proof *) [ MESON_TAC[SELECT_EXIST]; ]);; (* }}} *) + +let SELECT_TAC = + (* explicitly pull apart the clause Q((@) P), + because MATCH_MP_TAC isn't powerful + enough to do this by itself. *) + let unbeta = prove( + `!(P:A->bool) (Q:A->bool). (Q ((@) P)) = (\t. Q t) ((@) P)`,MESON_TAC[]) in + let unbeta_tac = CONV_TAC (HIGHER_REWRITE_CONV[unbeta] true) in + unbeta_tac THEN (MATCH_MP_TAC SELECT_THM) THEN BETA_TAC THEN CONJ_TAC + THENL[ + (DISCH_THEN (fun t-> ALL_TAC)) THEN GEN_TAC; + DISCH_TAC THEN GEN_TAC];; + +(* EXAMPLE: + +# g `(R:A->bool) ((@) S)`;; +val it : Core.goalstack = 1 subgoal (1 total) + +`R ((@) S)` + +# e SELECT_TAC ;; +val it : Core.goalstack = 2 subgoals (2 total) + + 0 [`~(?y. S y)`] + +`R t` + +`S t ==> R t` + +*) + + +(* ------------------------------------------------------------------ *) +(* TYPE_THEN and TYPEL_THEN calculate the types of the terms supplied + in a proof, avoiding the hassle of working them out by hand. + It locates the terms among the free variables in the goal. + Ambiguious if a free variables have name conflicts. + + Now TYPE_THEN handles general terms. +*) +(* ------------------------------------------------------------------ *) + + +let rec type_set: (string*term) list -> (term list*term) -> (term list*term)= + fun typinfo (acclist,utm) -> match acclist with + | [] -> (acclist,utm) + | (Var(s,_) as a)::rest -> + let a' = (assocd s typinfo a) in + if (a = a') then type_set typinfo (rest,utm) + else let inst = instantiate (term_match [] a a') in + type_set typinfo ((map inst rest),inst utm) + | _ -> failwith "type_set: variable expected" + ;; + +let has_stv t = + let typ = (type_vars_in_term t) in + can (find (fun ty -> (is_vartype ty) && ((dest_vartype ty).[0] = '?'))) typ;; + + +let TYPE_THEN: term -> (term -> tactic) -> tactic = + fun t (tac:term->tactic) (asl,w) -> + let avoids = itlist (union o frees o concl o snd) asl + (frees w) in + let strip = fun t-> (match t with + |Var(s,_) -> (s,t) | _ -> failwith "TYPE_THEN" ) in + let typinfo = map strip avoids in + let t' = (snd (type_set typinfo ((frees t),t))) in + (warn ((has_stv t')) "TYPE_THEN: unresolved type variables"); + tac t' (asl,w);; + +(* this version must take variables *) +let TYPEL_THEN: term list -> (term list -> tactic) -> tactic = + fun t (tac:term list->tactic) (asl,w) -> + let avoids = itlist (union o frees o concl o snd) asl + (frees w) in + let strip = fun t-> (match t with + |Var(s,_) -> (s,t) | _ -> failwith "TYPE_THEN" ) in + let typinfo = map strip avoids in + let t' = map (fun u -> snd (type_set typinfo ((frees u),u))) t in + (warn ((can (find has_stv) t')) "TYPEL_THEN: unresolved type vars"); + tac t' (asl,w);; + +(* trivial example *) + +let _ = prove_by_refinement(`!y. y:num = y`, + [ + GEN_TAC; + TYPE_THEN `y:A` (fun t -> ASSUME_TAC(ISPEC t (TAUT `!x:B. x=x`))); + UNDISCH_TAC `y:num = y`; (* evidence that `y:A` was retyped as `y:num` *) + MESON_TAC[]; + ]);; + + +(* ------------------------------------------------------------------ *) +(* SAVE the goalstate, and retrieve later *) +(* ------------------------------------------------------------------ *) + +let (save_goal,get_goal) = + let goal_buffer = ref [] in + let save_goal s = + goal_buffer := (s,!current_goalstack )::!goal_buffer in + let get_goal (s:string) = (current_goalstack:= assoc s !goal_buffer) in + (save_goal,get_goal);; + + +(* ------------------------------------------------------------------ *)g +(* ordered rewrites with general ord function . + This allows rewrites with an arbitrary condition + -- adapted from simp.ml *) +(* ------------------------------------------------------------------ *) + + + +let net_of_thm_ord ord rep force th = + let t = concl th in + let lconsts = freesl (hyp th) in + let matchable = can o term_match lconsts in + try let l,r = dest_eq t in + if rep & free_in l r then + let th' = EQT_INTRO th in + enter lconsts (l,(1,REWR_CONV th')) + else if rep & matchable l r & matchable r l then + enter lconsts (l,(1,ORDERED_REWR_CONV ord th)) + else if force then + enter lconsts (l,(1,ORDERED_REWR_CONV ord th)) + else enter lconsts (l,(1,REWR_CONV th)) + with Failure _ -> + let l,r = dest_eq(rand t) in + if rep & free_in l r then + let tm = lhand t in + let th' = DISCH tm (EQT_INTRO(UNDISCH th)) in + enter lconsts (l,(3,IMP_REWR_CONV th')) + else if rep & matchable l r & matchable r l then + enter lconsts (l,(3,ORDERED_IMP_REWR_CONV ord th)) + else enter lconsts(l,(3,IMP_REWR_CONV th));; + +let GENERAL_REWRITE_ORD_CONV ord rep force (cnvl:conv->conv) (builtin_net:gconv net) thl = + let thl_canon = itlist (mk_rewrites false) thl [] in + let final_net = itlist (net_of_thm_ord ord rep force ) thl_canon builtin_net in + cnvl (REWRITES_CONV final_net);; + +let GEN_REWRITE_ORD_CONV ord force (cnvl:conv->conv) thl = + GENERAL_REWRITE_ORD_CONV ord false force cnvl empty_net thl;; + +let PURE_REWRITE_ORD_CONV ord force thl = + GENERAL_REWRITE_ORD_CONV ord true force TOP_DEPTH_CONV empty_net thl;; + +let REWRITE_ORD_CONV ord force thl = + GENERAL_REWRITE_ORD_CONV ord true force TOP_DEPTH_CONV (basic_net()) thl;; + +let PURE_ONCE_REWRITE_ORD_CONV ord force thl = + GENERAL_REWRITE_ORD_CONV ord false force ONCE_DEPTH_CONV empty_net thl;; + +let ONCE_REWRITE_ORD_CONV ord force thl = + GENERAL_REWRITE_ORD_CONV ord false force ONCE_DEPTH_CONV (basic_net()) thl;; + +let REWRITE_ORD_TAC ord force thl = CONV_TAC(REWRITE_ORD_CONV ord force thl);; + + + +(* ------------------------------------------------------------------ *) +(* Move quantifier left. Use class.ml and theorems.ml to bubble + quantifiers towards the head of an expression. It should move + quantifiers past other quantifiers, past conjunctions, disjunctions, + implications, etc. + + val quant_left_CONV : string -> term -> thm = + Arguments: + var_name:string -- The name of the variable that is to be shifted. + + It tends to return `T` when the conversion fails. + + Example: + quant_left_CONV "a" `!b. ?a. a = b*4`;; + val it : thm = |- (!b. ?a. a = b *| 4) = (?a. !b. a b = b *| 4) + *) +(* ------------------------------------------------------------------ *) + +let tagb = new_definition `TAGB (x:bool) = x`;; + +let is_quant tm = (is_forall tm) or (is_exists tm);; + +let rec tag_quant var_name tm = + if (is_forall tm && (fst (dest_var (fst (dest_forall tm))) = var_name)) + then mk_comb (`TAGB`,tm) + else if (is_exists tm && (fst (dest_var (fst (dest_exists tm))) = var_name)) then mk_comb (`TAGB`,tm) + else match tm with + | Comb (x,y) -> Comb(tag_quant var_name x,tag_quant var_name y) + | Abs (x,y) -> Abs(x,tag_quant var_name y) + | _ -> tm;; + +let quant_left_CONV = + (* ~! -> ?~ *) + let iprove f = prove(f,REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let NOT_FORALL_TAG = prove(`!P. ~(TAGB(!x. P x)) = (?x:A. ~(P x))`, + REWRITE_TAC[tagb;NOT_FORALL_THM]) in + let SKOLEM_TAG = + prove(`!P. (?y. TAGB (!(x:A). P x ((y:A->B) x))) = + ( (!(x:A). ?y. P x ((y:B))))`,REWRITE_TAC[tagb;SKOLEM_THM]) in + let SKOLEM_TAG2 = + prove(`!P. (!x:A. TAGB(?y:B. P x y)) = (?y. !x. P x (y x))`, + REWRITE_TAC[tagb;SKOLEM_THM]) in + (* !1 !2 -> !2 !1 *) + let SWAP_FORALL_TAG = + prove(`!P:A->B->bool. (!x. TAGB(! y. P x y)) = (!y x. P x y)`, + REWRITE_TAC[SWAP_FORALL_THM;tagb]) in + let SWAP_EXISTS_THM = iprove + `!P:A->B->bool. (?x. TAGB (?y. P x y)) = (?y x. P x y)` in + (* ! /\ ! -> ! /\ *) + let AND_FORALL_TAG = prove(`!P Q. (TAGB (!x. P x) /\ TAGB (!x. Q x) = + (!x. P x /\ Q x))`,REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let LEFT_AND_FORALL_TAG = prove(`!P Q. (TAGB (!x. P x) /\ Q) = + (!x. P x /\ Q )`,REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let RIGHT_AND_FORALL_TAG = prove(`!P Q. P /\ TAGB (!x. Q x) = + (!x. P /\ Q x)`,REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let TRIV_OR_FORALL_TAG = prove + (`!P Q. TAGB (!x:A. P) \/ TAGB (!x:A. Q) = (!x:A. P \/ Q)`, + REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let RIGHT_IMP_FORALL_TAG = prove + (`!P Q. (P ==> TAGB (!x:A. Q x)) = (!x. P ==> Q x)`, + REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let OR_EXISTS_THM = iprove + `!P Q. TAGB (?x. P x) \/ TAGB (?x. Q x) = (?x:A. P x \/ Q x)` in + let LEFT_OR_EXISTS_THM = iprove + `!P Q. TAGB (?x. P x) \/ Q = (?x:A. P x \/ Q)` in + let RIGHT_OR_EXISTS_THM = iprove + `!P Q. P \/ TAGB (?x. Q x) = (?x:A. P \/ Q x)` in + let LEFT_AND_EXISTS_THM = iprove + `!P Q. TAGB (?x:A. P x) /\ Q = (?x:A. P x /\ Q)` in + let RIGHT_AND_EXISTS_THM = iprove + `!P Q. P /\ TAGB (?x:A. Q x) = (?x:A. P /\ Q x)` in + let TRIV_AND_EXISTS_THM = iprove + `!P Q. TAGB (?x:A. P) /\ TAGB (?x:A. Q) = (?x:A. P /\ Q)` in + let LEFT_IMP_EXISTS_THM = iprove + `!P Q. (TAGB (?x:A. P x) ==> Q) = (!x. P x ==> Q)` in + let TRIV_FORALL_IMP_THM = iprove + `!P Q. (TAGB (?x:A. P) ==> TAGB (!x:A. Q)) = (!x:A. P ==> Q) ` in + let TRIV_EXISTS_IMP_THM = iprove + `!P Q. (TAGB(!x:A. P) ==> TAGB (?x:A. Q)) = (?x:A. P ==> Q) ` in + let NOT_EXISTS_TAG = prove( + `!P. ~(TAGB(?x:A. P x)) = (!x. ~(P x))`, + REWRITE_TAC[tagb;NOT_EXISTS_THM]) in + let LEFT_OR_FORALL_TAG = prove + (`!P Q. TAGB(!x:A. P x) \/ Q = (!x. P x \/ Q)`, + REWRITE_TAC[tagb;LEFT_OR_FORALL_THM]) in + let RIGHT_OR_FORALL_TAG = prove + (`!P Q. P \/ TAGB(!x:A. Q x) = (!x. P \/ Q x)`, + REWRITE_TAC[tagb;RIGHT_OR_FORALL_THM]) in + let LEFT_IMP_FORALL_TAG = prove + (`!P Q. (TAGB(!x:A. P x) ==> Q) = (?x. P x ==> Q)`, + REWRITE_TAC[tagb;LEFT_IMP_FORALL_THM]) in + let RIGHT_IMP_EXISTS_TAG = prove + (`!P Q. (P ==> TAGB(?x:A. Q x)) = (?x:A. P ==> Q x)`, + REWRITE_TAC[tagb;RIGHT_IMP_EXISTS_THM]) in + fun var_name tm -> + REWRITE_RULE [tagb] + (TOP_SWEEP_CONV + (GEN_REWRITE_CONV I + [NOT_FORALL_TAG;SKOLEM_TAG;SKOLEM_TAG2; + SWAP_FORALL_TAG;SWAP_EXISTS_THM; + SWAP_EXISTS_THM; + AND_FORALL_TAG;LEFT_AND_FORALL_TAG;RIGHT_AND_FORALL_TAG; + TRIV_OR_FORALL_TAG;RIGHT_IMP_FORALL_TAG; + OR_EXISTS_THM;LEFT_OR_EXISTS_THM;RIGHT_OR_EXISTS_THM; + LEFT_AND_EXISTS_THM; + RIGHT_AND_EXISTS_THM; + TRIV_AND_EXISTS_THM;LEFT_IMP_EXISTS_THM;TRIV_FORALL_IMP_THM; + TRIV_EXISTS_IMP_THM;NOT_EXISTS_TAG; + LEFT_OR_FORALL_TAG;RIGHT_OR_FORALL_TAG;LEFT_IMP_FORALL_TAG; + RIGHT_IMP_EXISTS_TAG; + ]) + (tag_quant var_name tm));; + +(* same, but never pass a quantifier past another. No Skolem, etc. *) +let quant_left_noswap_CONV = + (* ~! -> ?~ *) + let iprove f = prove(f,REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let NOT_FORALL_TAG = prove(`!P. ~(TAGB(!x. P x)) = (?x:A. ~(P x))`, + REWRITE_TAC[tagb;NOT_FORALL_THM]) in + let SKOLEM_TAG = + prove(`!P. (?y. TAGB (!(x:A). P x ((y:A->B) x))) = + ( (!(x:A). ?y. P x ((y:B))))`,REWRITE_TAC[tagb;SKOLEM_THM]) in + let SKOLEM_TAG2 = + prove(`!P. (!x:A. TAGB(?y:B. P x y)) = (?y. !x. P x (y x))`, + REWRITE_TAC[tagb;SKOLEM_THM]) in + (* !1 !2 -> !2 !1 *) + let SWAP_FORALL_TAG = + prove(`!P:A->B->bool. (!x. TAGB(! y. P x y)) = (!y x. P x y)`, + REWRITE_TAC[SWAP_FORALL_THM;tagb]) in + let SWAP_EXISTS_THM = iprove + `!P:A->B->bool. (?x. TAGB (?y. P x y)) = (?y x. P x y)` in + (* ! /\ ! -> ! /\ *) + let AND_FORALL_TAG = prove(`!P Q. (TAGB (!x. P x) /\ TAGB (!x. Q x) = + (!x. P x /\ Q x))`,REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let LEFT_AND_FORALL_TAG = prove(`!P Q. (TAGB (!x. P x) /\ Q) = + (!x. P x /\ Q )`,REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let RIGHT_AND_FORALL_TAG = prove(`!P Q. P /\ TAGB (!x. Q x) = + (!x. P /\ Q x)`,REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let TRIV_OR_FORALL_TAG = prove + (`!P Q. TAGB (!x:A. P) \/ TAGB (!x:A. Q) = (!x:A. P \/ Q)`, + REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let RIGHT_IMP_FORALL_TAG = prove + (`!P Q. (P ==> TAGB (!x:A. Q x)) = (!x. P ==> Q x)`, + REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let OR_EXISTS_THM = iprove + `!P Q. TAGB (?x. P x) \/ TAGB (?x. Q x) = (?x:A. P x \/ Q x)` in + let LEFT_OR_EXISTS_THM = iprove + `!P Q. TAGB (?x. P x) \/ Q = (?x:A. P x \/ Q)` in + let RIGHT_OR_EXISTS_THM = iprove + `!P Q. P \/ TAGB (?x. Q x) = (?x:A. P \/ Q x)` in + let LEFT_AND_EXISTS_THM = iprove + `!P Q. TAGB (?x:A. P x) /\ Q = (?x:A. P x /\ Q)` in + let RIGHT_AND_EXISTS_THM = iprove + `!P Q. P /\ TAGB (?x:A. Q x) = (?x:A. P /\ Q x)` in + let TRIV_AND_EXISTS_THM = iprove + `!P Q. TAGB (?x:A. P) /\ TAGB (?x:A. Q) = (?x:A. P /\ Q)` in + let LEFT_IMP_EXISTS_THM = iprove + `!P Q. (TAGB (?x:A. P x) ==> Q) = (!x. P x ==> Q)` in + let TRIV_FORALL_IMP_THM = iprove + `!P Q. (TAGB (?x:A. P) ==> TAGB (!x:A. Q)) = (!x:A. P ==> Q) ` in + let TRIV_EXISTS_IMP_THM = iprove + `!P Q. (TAGB(!x:A. P) ==> TAGB (?x:A. Q)) = (?x:A. P ==> Q) ` in + let NOT_EXISTS_TAG = prove( + `!P. ~(TAGB(?x:A. P x)) = (!x. ~(P x))`, + REWRITE_TAC[tagb;NOT_EXISTS_THM]) in + let LEFT_OR_FORALL_TAG = prove + (`!P Q. TAGB(!x:A. P x) \/ Q = (!x. P x \/ Q)`, + REWRITE_TAC[tagb;LEFT_OR_FORALL_THM]) in + let RIGHT_OR_FORALL_TAG = prove + (`!P Q. P \/ TAGB(!x:A. Q x) = (!x. P \/ Q x)`, + REWRITE_TAC[tagb;RIGHT_OR_FORALL_THM]) in + let LEFT_IMP_FORALL_TAG = prove + (`!P Q. (TAGB(!x:A. P x) ==> Q) = (?x. P x ==> Q)`, + REWRITE_TAC[tagb;LEFT_IMP_FORALL_THM]) in + let RIGHT_IMP_EXISTS_TAG = prove + (`!P Q. (P ==> TAGB(?x:A. Q x)) = (?x:A. P ==> Q x)`, + REWRITE_TAC[tagb;RIGHT_IMP_EXISTS_THM]) in + fun var_name tm -> + REWRITE_RULE [tagb] + (TOP_SWEEP_CONV + (GEN_REWRITE_CONV I + [NOT_FORALL_TAG; (* SKOLEM_TAG;SKOLEM_TAG2; *) + (* SWAP_FORALL_TAG;SWAP_EXISTS_THM; + SWAP_EXISTS_THM; *) + AND_FORALL_TAG;LEFT_AND_FORALL_TAG;RIGHT_AND_FORALL_TAG; + TRIV_OR_FORALL_TAG;RIGHT_IMP_FORALL_TAG; + OR_EXISTS_THM;LEFT_OR_EXISTS_THM;RIGHT_OR_EXISTS_THM; + LEFT_AND_EXISTS_THM; + RIGHT_AND_EXISTS_THM; + TRIV_AND_EXISTS_THM;LEFT_IMP_EXISTS_THM;TRIV_FORALL_IMP_THM; + TRIV_EXISTS_IMP_THM;NOT_EXISTS_TAG; + LEFT_OR_FORALL_TAG;RIGHT_OR_FORALL_TAG;LEFT_IMP_FORALL_TAG; + RIGHT_IMP_EXISTS_TAG; + ]) + (tag_quant var_name tm));; + +let quant_right_CONV = + (* ~! -> ?~ *) + let iprove f = prove(f,REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let NOT_FORALL_TAG = prove(`!P. TAGB(?x:A. ~(P x)) = ~((!x. P x))`, + REWRITE_TAC[tagb;GSYM NOT_FORALL_THM]) in + let SKOLEM_TAG = + prove(`!P. ( TAGB(!(x:A). ?y. P x ((y:B))))= + (?y. (!(x:A). P x ((y:A->B) x)))`, + REWRITE_TAC[tagb;GSYM SKOLEM_THM]) + in + let SKOLEM_TAG2 = + prove(`!P. TAGB(?y. !x. P x (y x)) = (!x:A. (?y:B. P x y))`, + REWRITE_TAC[tagb;GSYM SKOLEM_THM]) in + (* !1 !2 -> !2 !1.. *) + let SWAP_FORALL_TAG = + prove(`!P:A->B->bool. TAGB(!y x. P x y)= (!x. (! y. P x y))`, + REWRITE_TAC[GSYM SWAP_FORALL_THM;tagb]) in + let SWAP_EXISTS_THM = iprove + `!P:A->B->bool. TAGB (?y x. P x y)=(?x. (?y. P x y))` in + (* ! /\ ! -> ! /\ *) + let AND_FORALL_TAG = iprove`!P Q. TAGB(!x. P x /\ Q x)= + ((!x. P x) /\ (!x. Q x))` in + let LEFT_AND_FORALL_TAG = prove(`!P Q. + TAGB(!x. P x /\ Q ) = ((!x. P x) /\ Q)`, + REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let RIGHT_AND_FORALL_TAG = prove(`!P Q. + TAGB(!x. P /\ Q x) = P /\ (!x. Q x)`, + REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let TRIV_OR_FORALL_TAG = prove + (`!P Q. TAGB(!x:A. P \/ Q)=(!x:A. P) \/ (!x:A. Q)`, + REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let RIGHT_IMP_FORALL_TAG = prove + (`!P Q. TAGB (!x. P ==> Q x) = (P ==> (!x:A. Q x)) `, + REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let OR_EXISTS_THM = iprove + `!P Q. TAGB(?x:A. P x \/ Q x) = (?x. P x) \/ (?x. Q x) ` in + let LEFT_OR_EXISTS_THM = iprove + `!P Q. TAGB (?x:A. P x \/ Q) = (?x. P x) \/ Q ` in + let RIGHT_OR_EXISTS_THM = iprove + `!P Q.TAGB (?x:A. P \/ Q x)= P \/ (?x. Q x)` in + let LEFT_AND_EXISTS_THM = iprove + `!P Q.TAGB (?x:A. P x /\ Q) = (?x:A. P x) /\ Q` in + let RIGHT_AND_EXISTS_THM = iprove + `!P Q. TAGB (?x:A. P /\ Q x) = P /\ (?x:A. Q x) ` in + let TRIV_AND_EXISTS_THM = iprove + `!P Q. TAGB(?x:A. P /\ Q) = (?x:A. P) /\ (?x:A. Q) ` in (* *) + let LEFT_IMP_EXISTS_THM = iprove + `!P Q. TAGB(!x. P x ==> Q) = ( (?x:A. P x) ==> Q) ` in (* *) + let TRIV_FORALL_IMP_THM = iprove + `!P Q. TAGB(!x:A. P ==> Q) = ( (?x:A. P) ==> (!x:A. Q)) ` in + let TRIV_EXISTS_IMP_THM = iprove + `!P Q. TAGB(?x:A. P ==> Q) = ((!x:A. P) ==> (?x:A. Q)) ` in + let NOT_EXISTS_TAG = prove( + `!P. TAGB(!x. ~(P x)) = ~((?x:A. P x)) `, + REWRITE_TAC[tagb;NOT_EXISTS_THM]) in + let LEFT_OR_FORALL_TAG = prove + (`!P Q. TAGB(!x. P x \/ Q) = (!x:A. P x) \/ Q `, + REWRITE_TAC[tagb;LEFT_OR_FORALL_THM]) in + let RIGHT_OR_FORALL_TAG = prove + (`!P Q. TAGB(!x. P \/ Q x) = P \/ (!x:A. Q x) `, + REWRITE_TAC[tagb;RIGHT_OR_FORALL_THM]) in + let LEFT_IMP_FORALL_TAG = prove + (`!P Q. TAGB(?x. P x ==> Q) = ((!x:A. P x) ==> Q) `, + REWRITE_TAC[tagb;LEFT_IMP_FORALL_THM]) in + let RIGHT_IMP_EXISTS_TAG = prove + (`!P Q. TAGB(?x:A. P ==> Q x) = (P ==> (?x:A. Q x)) `, + REWRITE_TAC[tagb;RIGHT_IMP_EXISTS_THM]) in + fun var_name tm -> + REWRITE_RULE [tagb] + (TOP_SWEEP_CONV + (GEN_REWRITE_CONV I + [NOT_FORALL_TAG;SKOLEM_TAG;SKOLEM_TAG2; + SWAP_FORALL_TAG;SWAP_EXISTS_THM; + SWAP_EXISTS_THM; + AND_FORALL_TAG;LEFT_AND_FORALL_TAG;RIGHT_AND_FORALL_TAG; + TRIV_OR_FORALL_TAG;RIGHT_IMP_FORALL_TAG; + OR_EXISTS_THM;LEFT_OR_EXISTS_THM;RIGHT_OR_EXISTS_THM; + LEFT_AND_EXISTS_THM; + RIGHT_AND_EXISTS_THM; + TRIV_AND_EXISTS_THM;LEFT_IMP_EXISTS_THM;TRIV_FORALL_IMP_THM; + TRIV_EXISTS_IMP_THM;NOT_EXISTS_TAG; + LEFT_OR_FORALL_TAG;RIGHT_OR_FORALL_TAG;LEFT_IMP_FORALL_TAG; + RIGHT_IMP_EXISTS_TAG; + ]) + (tag_quant var_name tm));; + + +(* ------------------------------------------------------------------ *) +(* Dropping Superfluous Quantifiers . + Example: ?u. (u = t) /\ ... + We can eliminate the u. + *) +(* ------------------------------------------------------------------ *) + +let mark_term = new_definition `mark_term (u:A) = u`;; + +let rec markq qname tm = + match tm with + Var (a,b) -> if (a=qname) then mk_icomb (`mark_term:A->A`,tm) else tm + |Const(_,_) -> tm + |Comb(s,b) -> Comb(markq qname s,markq qname b) + |Abs (x,t) -> Abs (x,markq qname t);; + +let rec getquants tm = + if (is_forall tm) then + (fst (dest_var (fst (dest_forall tm)))):: + (getquants (snd (dest_forall tm))) + else if (is_exists tm) then + (fst (dest_var (fst (dest_exists tm)))):: + (getquants (snd (dest_exists tm))) + else match tm with + Comb(s,b) -> (getquants s) @ (getquants b) + | Abs (x,t) -> (getquants t) + | _ -> [];; + +(* can loop if there are TWO *) +let rewrite_conjs = [ + prove_by_refinement (`!A B C. (A /\ B) /\ C = A /\ B /\ C`,[REWRITE_TAC[CONJ_ACI]]); + prove_by_refinement (`!u. (mark_term (u:A) = mark_term u) = T`,[MESON_TAC[]]); + prove_by_refinement (`!u t. (t = mark_term (u:A)) = (mark_term u = t)`,[MESON_TAC[]]); + prove_by_refinement (`!u a b. (mark_term (u:A) = a) /\ (mark_term u = b) = (mark_term u = a) /\ (a = b)`,[MESON_TAC[]]); + prove_by_refinement (`!u a b B. (mark_term (u:A) = a) /\ (mark_term u = b) /\ B = (mark_term u = a) /\ (a = b) /\ B`,[MESON_TAC[]]); + prove_by_refinement (`!u t A C. A /\ (mark_term (u:A) = t) /\ C = + (mark_term u = t) /\ A /\ C`,[MESON_TAC[]]); + prove_by_refinement (`!A u t. A /\ (mark_term (u:A) = t) = + (mark_term u = t) /\ A `,[MESON_TAC[]]); + prove_by_refinement (`!u t C D. (((mark_term (u:A) = t) /\ C) ==> D) = + ((mark_term (u:A) = t) ==> C ==> D)`,[MESON_TAC[]]); + prove_by_refinement (`!A u t B. (A ==> (mark_term (u:A) = t) ==> B) = + ((mark_term (u:A) = t) ==> A ==> B)`,[MESON_TAC[]]); +];; + +let higher_conjs = [ + prove_by_refinement (`!C u t. ((mark_term u = t) ==> C (mark_term u)) = + ((mark_term u = t) ==> C (t:A))`,[MESON_TAC[mark_term]]); + prove_by_refinement (`!C u t. ((mark_term u = t) /\ C (mark_term u)) = + ((mark_term u = t) /\ C (t:A))`,[MESON_TAC[mark_term]]); +];; + + +let dropq_conv = + let drop_exist = + REWRITE_CONV [prove_by_refinement (`!t. ?(u:A). (u = t)`,[MESON_TAC[]])] in + fun qname tm -> + let quanlist = getquants tm in + let quantleft_CONV = EVERY_CONV + (map (REPEATC o quant_left_noswap_CONV) quanlist) in + let qname_conv tm = prove(mk_eq(tm,markq qname tm), + REWRITE_TAC[mark_term]) in + let conj_conv = REWRITE_CONV rewrite_conjs in + let quantright_CONV = (REPEATC (quant_right_CONV qname)) in + let drop_mark_CONV = REWRITE_CONV [mark_term] in + (quantleft_CONV THENC qname_conv THENC conj_conv THENC + (ONCE_REWRITE_CONV higher_conjs) + THENC drop_mark_CONV THENC quantright_CONV THENC + drop_exist ) tm ;; + + +(* Examples : *) +dropq_conv "u" `!P Q R . (?(u:B). (?(x:A). (u = P x) /\ (Q x)) /\ (R u))`;; +dropq_conv "t" `!P Q R. (!(t:B). (?(x:A). P x /\ (t = Q x)) ==> R t)`;; + +dropq_conv "u" `?u v. + ((t * (a + &1) + (&1 - t) *a = u) /\ + (t * (b + &0) + (&1 - t) * b = v)) /\ + a < u /\ + u < r /\ + (v = b)`;; + + + +(* ------------------------------------------------------------------ *) +(* SOME GENERAL TACTICS FOR THE ASSUMPTION LIST *) +(* ------------------------------------------------------------------ *) + +let (%) i = HYP (string_of_int i);; + +let WITH i rule = (H_VAL (rule) (HYP (string_of_int i))) ;; + +let (UND:int -> tactic) = + fun i (asl,w) -> + let name = "Z-"^(string_of_int i) in + try let thm= assoc name asl in + let tm = concl (thm) in + let (_,asl') = partition (fun t-> ((=) name (fst t))) asl in + null_meta,[asl',mk_imp(tm,w)], + fun i [th] -> MP th (INSTANTIATE_ALL i thm) + with Failure _ -> failwith "UND";; + +let KILL i = + (UND i) THEN (DISCH_THEN (fun t -> ALL_TAC));; + +let USE i rule = (WITH i rule) THEN (KILL i);; + +let CHO i = (UND i) THEN (DISCH_THEN CHOOSE_TAC);; + +let X_CHO i t = (UND i) THEN (DISCH_THEN (X_CHOOSE_TAC t));; + +let AND i = (UND i) THEN + (DISCH_THEN (fun t-> (ASSUME_TAC (CONJUNCT1 t) + THEN (ASSUME_TAC (CONJUNCT2 t)))));; + +let JOIN i j = + (H_VAL2 CONJ ((%)i) ((%)j)) THEN (KILL i) THEN (KILL j);; + +let COPY i = WITH i I;; + +let REP n tac = EVERY (replicate tac n);; + +let REWR i = (UND i) THEN (ASM_REWRITE_TAC[]) THEN DISCH_TAC;; + +let LEFT i t = (USE i (CONV_RULE (quant_left_CONV t)));; + +let RIGHT i t = (USE i (CONV_RULE (quant_right_CONV t)));; + +let LEFT_TAC t = ((CONV_TAC (quant_left_CONV t)));; + +let RIGHT_TAC t = ( (CONV_TAC (quant_right_CONV t)));; + +let INR = REWRITE_RULE[IN];; + +(* + + + +let rec REP n tac = if (n<=0) then ALL_TAC + else (tac THEN (REP (n-1) tac));; (* doesn't seem to work? *) + + +let COPY i = (UNDISCH_WITH i) THEN (DISCH_THEN (fun t->ALL_TAC));; + + +MANIPULATING ASSUMPTIONS. (MAKE 0= GOAL) + +COPY: int -> tactic Make a copy in adjacent slot. + + +EXPAND: int -> tactic. + conjunction -> two separate. + exists/goal-forall -> choose. + goal-if-then -> discharge +EXPAND_TERM: int -> term -> tactic. + constant -> expand definition or other rewrites associated. +ADD: term -> tactic. + +SIMPLIFY: int -> tactic. Apply simplification rules. + + +*) + +let CONTRAPOSITIVE_TAC = MATCH_MP_TAC (TAUT `(~q ==> ~p) ==> (p ==> q)`) + THEN REWRITE_TAC[];; + +let REWRT_TAC = (fun t-> REWRITE_TAC[t]);; + +let (REDUCE_CONV,REDUCE_TAC) = + let list = [ + (* reals *) REAL_NEG_GE0; + REAL_HALF_DOUBLE; + REAL_SUB_REFL ; + REAL_NEG_NEG; + REAL_LE; LE_0; + REAL_ADD_LINV;REAL_ADD_RINV; + REAL_NEG_0; + REAL_NEG_LE0; + REAL_NEG_GE0; + REAL_LE_NEGL; + REAL_LE_NEGR; + REAL_LE_NEG; + REAL_NEG_EQ_0; + REAL_SUB_RNEG; + REAL_ARITH `!(x:real). (--x = x) = (x = &.0)`; + REAL_ARITH `!(a:real) b. (a - b + b) = a`; + REAL_ADD_LID; + REAL_ADD_RID ; + REAL_INV_0; + REAL_OF_NUM_EQ; + REAL_OF_NUM_LE; + REAL_OF_NUM_LT; + REAL_OF_NUM_ADD; + REAL_OF_NUM_MUL; + REAL_POS; + REAL_MUL_RZERO; + REAL_MUL_LZERO; + REAL_LE_01; + REAL_SUB_RZERO; + REAL_LE_SQUARE; + REAL_MUL_RID; + REAL_MUL_LID; + REAL_ABS_ZERO; + REAL_ABS_NUM; + REAL_ABS_1; + REAL_ABS_NEG; + REAL_ABS_POS; + ABS_ZERO; + ABS_ABS; + REAL_NEG_LT0; + REAL_NEG_GT0; + REAL_LT_NEG; + REAL_NEG_MUL2; + REAL_OF_NUM_POW; + REAL_LT_INV_EQ; + REAL_POW_1; + REAL_INV2; + prove (`(--. (&.n) < (&.m)) = (&.0 < (&.n) + (&.m))`,REAL_ARITH_TAC); + prove (`(--. (&.n) <= (&.m)) = (&.0 <= (&.n) + (&.m))`,REAL_ARITH_TAC); + prove (`(--. (&.n) = (&.m)) = ((&.n) + (&.m) = (&.0))`,REAL_ARITH_TAC); + prove (`((&.n) < --.(&.m)) = ((&.n) + (&.m) <. (&.0))`,REAL_ARITH_TAC); + prove (`((&.n) <= --.(&.m)) = ((&.n) + (&.m) <=. (&.0))`,REAL_ARITH_TAC); + prove (`((&.n) = --.(&.m)) = ((&.n) + (&.m) = (&.0))`,REAL_ARITH_TAC); + prove (`((&.n) < --.(&.m) + &.r) = ((&.n) + (&.m) < (&.r))`,REAL_ARITH_TAC); + prove (`(--. x = --. y) = (x = y)`,REAL_ARITH_TAC); + prove (`(--(&.n) < --.(&.m) + &.r) = ( (&.m) < &.n + (&.r))`,REAL_ARITH_TAC); + prove (`(--. x = --. y) = (x = y)`,REAL_ARITH_TAC); + prove (`((--. (&.1))* x < --. y = y < x)`,REAL_ARITH_TAC ); + prove (`((--. (&.1))* x <= --. y = y <= x)`,REAL_ARITH_TAC ); + (* num *) + EXP_1; + EXP_LT_0; + ADD_0; + ARITH_RULE `0+| m = m`; + ADD_EQ_0; + prove (`(0 = m +|n) = (m = 0)/\ (n=0)`,MESON_TAC[ADD_EQ_0]); + EQ_ADD_LCANCEL_0; + EQ_ADD_RCANCEL_0; + LT_ADD; + LT_ADDR; + ARITH_RULE `(0 = j -| i) = (j <=| i)`; + ARITH_RULE `(j -| i = 0) = (j <=| i)`; + ARITH_RULE `0 -| i = 0`; + ARITH_RULE `(i<=| j) /\ (j <=| i) = (i = j)`; + ARITH_RULE `0 <| 1`; + (* SUC *) + NOT_SUC; + SUC_INJ; + PRE; + ADD_CLAUSES; + MULT; + MULT_CLAUSES; + LE; LT; + ARITH_RULE `SUC b -| 1 = b`; + ARITH_RULE `SUC b -| b = 1`; + prove(`&.(SUC x) - &.x = &.1`, + REWRITE_TAC [REAL_ARITH `(a -. b=c) =(a = b+.c)`; + REAL_OF_NUM_ADD;REAL_OF_NUM_EQ] THEN ARITH_TAC); + (* (o) *) + o_DEF; + (* I *) + I_THM; + I_O_ID; + (* pow *) + REAL_POW_1; + REAL_POW_ONE; + (* INT *) + INT_ADD_LINV; + INT_ADD_RINV; + INT_ADD_SUB2; + INT_EQ_NEG2; + INT_LE_NEG; + INT_LE_NEGL; + INT_LE_NEGR; + INT_LT_NEG; + INT_LT_NEG2; + INT_NEGNEG; + INT_NEG_0; + INT_NEG_EQ_0; + INT_NEG_GE0; + INT_NEG_GT0; + INT_NEG_LE0; + INT_NEG_LT0; + GSYM INT_NEG_MINUS1; + INT_NEG_MUL2; + INT_NEG_NEG; + (* sets *) + ] in +(REWRITE_CONV list,REWRITE_TAC list);; + + + + + +(* prove by squaring *) +let REAL_POW_2_LE = prove_by_refinement( + `!x y. (&.0 <= x) /\ (&.0 <= y) /\ (x pow 2 <=. y pow 2) ==> (x <=. y)`, + (* {{{ proof *) [ DISCH_ALL_TAC; MP_TAC (SPECL[` (x:real) pow 2`;`(y:real)pow 2`] SQRT_MONO_LE); ASM_REWRITE_TAC[]; ASM_SIMP_TAC[REAL_POW_LE]; ASM_SIMP_TAC[POW_2_SQRT]; ]);; (* }}} *) + +(* prove by squaring *) +let REAL_POW_2_LT = prove_by_refinement( + `!x y. (&.0 <= x) /\ (&.0 <= y) /\ (x pow 2 <. y pow 2) ==> (x <. y)`, + (* {{{ proof *) [ DISCH_ALL_TAC; MP_TAC (SPECL[` (x:real) pow 2`;`(y:real)pow 2`] SQRT_MONO_LT); ASM_REWRITE_TAC[]; ASM_SIMP_TAC[REAL_POW_LE]; ASM_SIMP_TAC[POW_2_SQRT]; ]);; (* }}} *) + +let SQUARE_TAC = + FIRST[ + MATCH_MP_TAC REAL_LE_LSQRT; + MATCH_MP_TAC REAL_POW_2_LT; + MATCH_MP_TAC REAL_POW_2_LE + ] + THEN REWRITE_TAC[];; + +(****) + +let SPEC2_TAC t = SPEC_TAC (t,t);; + +let IN_ELIM i = (USE i (REWRITE_RULE[IN]));; + +let rec range i n = + if (n>0) then (i::(range (i+1) (n-1))) else [];; + + +(* in elimination *) + +let (IN_OUT_TAC: tactic) = + fun (asl,g) -> (REWRITE_TAC [IN] THEN + (EVERY (map (IN_ELIM) (range 0 (length asl))))) (asl,g);; + +let (IWRITE_TAC : thm list -> tactic) = + fun thlist -> REWRITE_TAC (map INR thlist);; + +let (IWRITE_RULE : thm list -> thm -> thm) = + fun thlist -> REWRITE_RULE (map INR thlist);; + +let IMATCH_MP imp ant = MATCH_MP (INR imp) (INR ant);; + +let IMATCH_MP_TAC imp = MATCH_MP_TAC (INR imp);; + + +let GBETA_TAC = (CONV_TAC (TOP_DEPTH_CONV GEN_BETA_CONV));; +let GBETA_RULE = (CONV_RULE (TOP_DEPTH_CONV GEN_BETA_CONV));; + +(* breaks antecedent into multiple cases *) +let REP_CASES_TAC = + REPEAT (DISCH_THEN (REPEAT_TCL DISJ_CASES_THEN ASSUME_TAC));; + +let TSPEC t i = TYPE_THEN t (USE i o SPEC);; + +let IMP_REAL t i = (USE i (MATCH_MP (REAL_ARITH t)));; + +(* goes from f = g to fz = gz *) +let TAPP z i = TYPE_THEN z (fun u -> (USE i(fun t -> AP_THM t u)));; + +(* ONE NEW TACTIC -- DOESN'T WORK!! DON'T USE.... +let CONCL_TAC t = let co = snd (dest_imp (concl t)) in + SUBGOAL_TAC co THEN (TRY (IMATCH_MP_TAC t));; +*) + +(* subgoal the antecedent of a THM, in order to USE the conclusion *) +let ANT_TAC t = let (ant,co) = (dest_imp (concl t)) in + SUBGOAL_TAC ant + THENL [ALL_TAC;DISCH_THEN (fun u-> MP_TAC (MATCH_MP t u))];; + + +let TH_INTRO_TAC tl th = TYPEL_THEN tl (fun t-> ANT_TAC (ISPECL t th));; + +let THM_INTRO_TAC tl th = TYPEL_THEN tl + (fun t-> + let s = ISPECL t th in + if is_imp (concl s) then ANT_TAC s else ASSUME_TAC s);; + +let (DISCH_THEN_FULL_REWRITE:tactic) = + DISCH_THEN (fun t-> REWRITE_TAC[t] THEN + (RULE_ASSUM_TAC (REWRITE_RULE[t])));; + +let FULL_REWRITE_TAC t = (REWRITE_TAC t THEN (RULE_ASSUM_TAC (REWRITE_RULE t)));; + +(* ------------------------------------------------------------------ *) + +let BASIC_TAC = + [ GEN_TAC; + IMATCH_MP_TAC (TAUT ` (a ==> b ==> C) ==> ( a /\ b ==> C)`); + DISCH_THEN (CHOOSE_THEN MP_TAC); + FIRST_ASSUM (fun t-> UNDISCH_TAC (concl t) THEN + (DISCH_THEN CHOOSE_TAC)); + FIRST_ASSUM (fun t -> + (if (length (CONJUNCTS t) < 2) then failwith "BASIC_TAC" + else UNDISCH_TAC (concl t))); + DISCH_TAC; + ];; + +let REP_BASIC_TAC = REPEAT (CHANGED_TAC (FIRST BASIC_TAC));; + +(* ------------------------------------------------------------------ *) + +let USE_FIRST rule = + FIRST_ASSUM (fun t -> (UNDISCH_TAC (concl t) THEN + (DISCH_THEN (ASSUME_TAC o rule))));; + +let WITH_FIRST rule = + FIRST_ASSUM (fun t -> ASSUME_TAC (rule t));; + +let UNDF t = (TYPE_THEN t UNDISCH_FIND_TAC );; + +let GRABF t ttac = (UNDF t THEN (DISCH_THEN ttac));; + +let USEF t rule = + (TYPE_THEN t (fun t' -> UNDISCH_FIND_THEN t' + (fun u -> ASSUME_TAC (rule u))));; + + +(* ------------------------------------------------------------------ *) +(* UNIFY_EXISTS_TAC *) +(* ------------------------------------------------------------------ *) + +let rec EXISTSL_TAC tml = match tml with + a::tml' -> EXISTS_TAC a THEN EXISTSL_TAC tml' | + [] -> ALL_TAC;; + +(* + Goal: ?x1....xn. P1 /\ ... /\ Pm + Try to pick ALL of x1...xn to unify ONE or more Pi with terms + appearing in the assumption list, trying term_unify on + each Pi with each assumption. +*) +let (UNIFY_EXISTS_TAC:tactic) = + let run_one wc assum (varl,sofar) = + if varl = [] then (varl,sofar) else + try ( + let wc' = instantiate ([],sofar,[]) wc in + let (_,ins,_) = term_unify varl wc' assum in + let insv = map snd ins in + ( subtract varl insv , union sofar ins ) + ) with failure -> (varl,sofar) in + let run_onel asl wc (varl,sofar) = + itlist (run_one wc) asl (varl,sofar) in + let run_all varl sofar wcl asl = + itlist (run_onel asl) wcl (varl,sofar) in + let full_unify (asl,w) = + let (varl,ws) = strip_exists w in + let vargl = map genvar (map type_of varl) in + let wg = instantiate ([],zip vargl varl,[]) ws in + let wcg = conjuncts wg in + let (vargl',sofar) = run_all vargl [] wcg ( asl) in + if (vargl' = []) then + map (C rev_assoc sofar) (map (C rev_assoc (zip vargl varl)) varl) + else failwith "full_unify: unification not found " in + fun (asl,w) -> + try( + let asl' = map (concl o snd) asl in + let asl'' = flat (map (conjuncts ) asl') in + let varsub = full_unify (asl'',w) in + EXISTSL_TAC varsub (asl,w) + ) with failure -> failwith "UNIFY_EXIST_TAC: unification not found.";; + +(* partial example *) +let unify_exists_tac_example = try(prove_by_refinement( + `!C a b v A R TX U SS. (A v /\ (a = v) /\ (C:num->num->bool) a b /\ R a ==> + ?v v'. TX v' /\ U v v' /\ C v' v /\ SS v)`, + (* {{{ proof *) [ REP_BASIC_TAC; UNIFY_EXISTS_TAC; (* v' -> a and v -> b *) (* not finished. Here is a variant approach. *) REP_GEN_TAC; DISCH_TAC; UNIFY_EXISTS_TAC; ])) with failure -> (REFL `T`);; (* }}} *) + +(* ------------------------------------------------------------------ *) +(* UNIFY_EXISTS conversion *) +(* ------------------------------------------------------------------ *) + +(* + FIRST argument is the "certificate" + second arg is the goal. + Example: + UNIFY_EXISTS `(f:num->bool) x` `?t. (f:num->bool) t` +*) + +let (UNIFY_EXISTS:thm -> term -> thm) = + let run_one wc assum (varl,sofar) = + if varl = [] then (varl,sofar) else + try ( + let wc' = instantiate ([],sofar,[]) wc in + let (_,ins,_) = term_unify varl wc' assum in + let insv = map snd ins in + ( subtract varl insv , union sofar ins ) + ) with failure -> (varl,sofar) in + let run_onel asl wc (varl,sofar) = + itlist (run_one wc) asl (varl,sofar) in + let run_all varl sofar wcl asl = + itlist (run_onel asl) wcl (varl,sofar) in + let full_unify (t,w) = + let (varl,ws) = strip_exists w in + let vargl = map genvar (map type_of varl) in + let wg = instantiate ([],zip vargl varl,[]) ws in + let wcg = conjuncts wg in + let (vargl',sofar) = run_all vargl [] wcg ( [concl t]) in + if (vargl' = []) then + map (C rev_assoc sofar) (map (C rev_assoc (zip vargl varl)) varl) + else failwith "full_unify: unification not found " in + fun t w -> + try( + if not(is_exists w) then failwith "UNIFY_EXISTS: not EXISTS" else + let varl' = (full_unify (t,w)) in + let (varl,ws) = strip_exists w in + let varsub = zip varl' varl in + let varlb = map (fun s-> chop_list s (rev varl)) + (range 1 (length varl)) in + let targets = map (fun s-> (instantiate ([],varsub,[]) + (list_mk_exists( rev (fst s), ws)) )) varlb in + let target_zip = zip (rev targets) varl' in + itlist (fun s th -> EXISTS s th) target_zip t + ) with failure -> failwith "UNIFY_EXISTS: unification not found.";; + +let unify_exists_example= + UNIFY_EXISTS (ARITH_RULE `2 = 0+2`) `(?x y. ((x:num) = y))`;; + +(* now make a prover for it *) + + +(* ------------------------------------------------------------------ *) + +(* +drop_ant_tac replaces + 0 A ==>B + 1 A +with + 0 B + 1 A +in hypothesis list +*) +let DROP_ANT_TAC pq = + UNDISCH_TAC pq THEN (UNDISCH_TAC (fst (dest_imp pq))) THEN + DISCH_THEN (fun pthm -> ASSUME_TAC pthm THEN + DISCH_THEN (fun pqthm -> ASSUME_TAC (MATCH_MP pqthm pthm )));; + +let (DROP_ALL_ANT_TAC:tactic) = + fun (asl,w) -> + let imps = gather (is_imp) (map (concl o snd) asl) in + MAP_EVERY (TRY o DROP_ANT_TAC) imps (asl,w);; + +let drop_ant_tac_example = prove_by_refinement( + `!A B C D E. (A /\ (A ==> B) /\ (C ==>D) /\ C) ==> (E \/ C \/ B)`, + (* {{{ proof *) [ REP_BASIC_TAC; DROP_ALL_ANT_TAC; ASM_REWRITE_TAC[]; ]);; (* }}} *) + +(* ------------------------------------------------------------------ *) + +(* ASSUME tm, then prove it later. almost the same as asm-cases-tac *) +let (BACK_TAC : term -> tactic) = + fun tm (asl,w) -> + let ng = mk_imp (tm,w) in + (SUBGOAL_TAC ng THENL [ALL_TAC;DISCH_THEN IMATCH_MP_TAC ]) (asl,w);; + +(* --- *) +(* Using hash numbers for tactics *) +(* --- *) + +let label_of_hash ((asl,g):goal) (h:int) = + let one_label h (s,tm) = + if (h = hash_of_term (concl tm)) then + let s1 = String.sub s 2 (String.length s - 2) in + int_of_string s1 + else failwith "label_of_hash" in + tryfind (one_label h) asl;; + +let HASHIFY m h w = m (label_of_hash w h) w;; +let UNDH = HASHIFY UND;; +let REWRH = HASHIFY REWR;; +let KILLH = HASHIFY KILL;; +let COPYH = HASHIFY COPY;; +let HASHIFY1 m h tm w = m (label_of_hash w h) tm w;; +let USEH = HASHIFY1 USE;; +let LEFTH = HASHIFY1 LEFT;; +let RIGHTH = HASHIFY1 RIGHT;; +let TSPECH tm h w = TSPEC tm (label_of_hash w h) w ;; + + + + + + diff --git a/development/thales/chaff/tame_constants.ml b/development/thales/chaff/tame_constants.ml new file mode 100644 index 0000000..84a375e --- /dev/null +++ b/development/thales/chaff/tame_constants.ml @@ -0,0 +1,46 @@ +(* modified from +http://afp.sourceforge.net/browser_info/current/HOL/Flyspeck-Tame/Tame.html +*) +subsection {* Constants \label{sec:TameConstants}*} + +constdefs squanderTarget :: "nat" + "squanderTarget ≡ 1541" + +constdefs excessTCount :: "nat => nat" (*<*) ("\")(*>*) + + "\ t ≡ if t < 5 then squanderTarget + else 630" + +constdefs squanderVertex :: "nat => nat => nat" (*<*)("\")(*>*) + + "\ p q ≡ if p = 0 ∧ q = 2 then 1296 + else if p = 0 ∧ q = 3 then 618 + else if p = 0 ∧ q = 4 then 1000 + else if p = 1 ∧ q = 2 then 660 + else if p = 1 ∧ q = 3 then 618 + else if p = 2 ∧ q = 1 then 800 + else if p = 2 ∧ q = 2 then 412 + else if p = 2 ∧ q = 3 then 1285 + else if p = 3 ∧ q = 1 then 315 + else if p = 3 ∧ q = 2 then 830 + else if p = 4 ∧ q = 0 then 350 + else if p = 4 ∧ q = 1 then 374 + else if p = 5 ∧ q = 0 then 40 + else if p = 5 ∧ q = 1 then 1144 + else if p = 6 ∧ q = 0 then 689 + else if p = 7 ∧ q = 0 then 1450 + else squanderTarget" + +constdefs scoreFace :: "nat => int" (*<*)("\")(*>*) + + "\ n ≡ 0" + +constdefs squanderFace :: "nat => nat" (*<*)("\")(*>*) + + "\ n ≡ if n = 3 then 0 + else if n = 4 then 206 + else if n = 5 then 483 + else if n = 6 then 760 + else if n = 7 then 1038 + else if n = 8 then 1315 + else squanderTarget" diff --git a/development/thales/chaff/tmp/determinants_patch.ml b/development/thales/chaff/tmp/determinants_patch.ml new file mode 100644 index 0000000..0329323 --- /dev/null +++ b/development/thales/chaff/tmp/determinants_patch.ml @@ -0,0 +1,2166 @@ +(* ========================================================================= *) +(* Determinant and trace of a square matrix. *) +(* *) +(* (c) Copyright, John Harrison 1998-2008 *) +(* ========================================================================= *) + +(* Feb 2, 2012, patch of a file not yet committed to SVN. + Sent by email by Harrison. Delete in a few weeks after Harrison commits changes *) + + +overload_interface ("--",`(matrix_neg):real^N^M->real^N^M`);; +overload_interface ("+",`(matrix_add):real^N^M->real^N^M->real^N^M`);; +overload_interface ("-",`(matrix_sub):real^N^M->real^N^M->real^N^M`);; + +make_overloadable "**" `:A->B->C`;; + +overload_interface ("**",`(matrix_mul):real^N^M->real^P^N->real^P^M`);; +overload_interface ("**",`(matrix_vector_mul):real^N^M->real^N->real^M`);; +overload_interface ("**",`(vector_matrix_mul):real^M->real^N^M->real^N`);; + +parse_as_infix("%%",(21,"right"));; + + +needs "Multivariate/vectors.ml";; +needs "Library/permutations.ml";; +needs "Library/floor.ml";; +needs "Library/products.ml";; + + + +prioritize_real();; + +(* ------------------------------------------------------------------------- *) +(* Trace of a matrix (this is relatively easy). *) +(* ------------------------------------------------------------------------- *) + +let trace = new_definition + `(trace:real^N^N->real) A = sum(1..dimindex(:N)) (\i. A$i$i)`;; + +let TRACE_0 = prove + (`trace(mat 0) = &0`, + SIMP_TAC[trace; mat; LAMBDA_BETA; SUM_0]);; + +let TRACE_I = prove + (`trace(mat 1 :real^N^N) = &(dimindex(:N))`, + SIMP_TAC[trace; mat; LAMBDA_BETA; SUM_CONST_NUMSEG; REAL_MUL_RID] THEN + AP_TERM_TAC THEN ARITH_TAC);; + +let TRACE_ADD = prove + (`!A B:real^N^N. trace(A + B) = trace(A) + trace(B)`, + SIMP_TAC[trace; matrix_add; SUM_ADD_NUMSEG; LAMBDA_BETA]);; + +let TRACE_SUB = prove + (`!A B:real^N^N. trace(A - B) = trace(A) - trace(B)`, + SIMP_TAC[trace; matrix_sub; SUM_SUB_NUMSEG; LAMBDA_BETA]);; + +let TRACE_MUL_SYM = prove + (`!A B:real^N^N. trace(A ** B) = trace(B ** A)`, + REPEAT GEN_TAC THEN SIMP_TAC[trace; matrix_mul; LAMBDA_BETA] THEN + GEN_REWRITE_TAC RAND_CONV [SUM_SWAP_NUMSEG] THEN REWRITE_TAC[REAL_MUL_SYM]);; + +(* ------------------------------------------------------------------------- *) +(* Definition of determinant. *) +(* ------------------------------------------------------------------------- *) + +let det = new_definition + `det(A:real^N^N) = + sum { p | p permutes 1..dimindex(:N) } + (\p. sign(p) * product (1..dimindex(:N)) (\i. A$i$(p i)))`;; + +(* ------------------------------------------------------------------------- *) +(* A few general lemmas we need below. *) +(* ------------------------------------------------------------------------- *) + +let IN_DIMINDEX_SWAP = prove + (`!m n j. 1 <= m /\ m <= dimindex(:N) /\ + 1 <= n /\ n <= dimindex(:N) /\ + 1 <= j /\ j <= dimindex(:N) + ==> 1 <= swap(m,n) j /\ swap(m,n) j <= dimindex(:N)`, + REWRITE_TAC[swap] THEN ARITH_TAC);; + +let LAMBDA_BETA_PERM = prove + (`!p i. p permutes 1..dimindex(:N) /\ 1 <= i /\ i <= dimindex(:N) + ==> ((lambda) g :A^N) $ p(i) = g(p i)`, + ASM_MESON_TAC[LAMBDA_BETA; PERMUTES_IN_IMAGE; IN_NUMSEG]);; + +let PRODUCT_PERMUTE = prove + (`!f p s. p permutes s ==> product s f = product s (f o p)`, + REWRITE_TAC[product] THEN MATCH_MP_TAC ITERATE_PERMUTE THEN + REWRITE_TAC[MONOIDAL_REAL_MUL]);; + +let PRODUCT_PERMUTE_NUMSEG = prove + (`!f p m n. p permutes m..n ==> product(m..n) f = product(m..n) (f o p)`, + MESON_TAC[PRODUCT_PERMUTE; FINITE_NUMSEG]);; + +let REAL_MUL_SUM = prove + (`!s t f g. + FINITE s /\ FINITE t + ==> sum s f * sum t g = sum s (\i. sum t (\j. f(i) * g(j)))`, + SIMP_TAC[SUM_LMUL] THEN + ONCE_REWRITE_TAC[REAL_MUL_SYM] THEN SIMP_TAC[SUM_LMUL]);; + +let REAL_MUL_SUM_NUMSEG = prove + (`!m n p q. sum(m..n) f * sum(p..q) g = + sum(m..n) (\i. sum(p..q) (\j. f(i) * g(j)))`, + SIMP_TAC[REAL_MUL_SUM; FINITE_NUMSEG]);; + +(* ------------------------------------------------------------------------- *) +(* Basic determinant properties. *) +(* ------------------------------------------------------------------------- *) + +let DET_TRANSP = prove + (`!A:real^N^N. det(transp A) = det A`, + GEN_TAC THEN REWRITE_TAC[det] THEN + GEN_REWRITE_TAC LAND_CONV [SUM_PERMUTATIONS_INVERSE] THEN + MATCH_MP_TAC SUM_EQ THEN + SIMP_TAC[FINITE_PERMUTATIONS; FINITE_NUMSEG] THEN X_GEN_TAC `p:num->num` THEN + REWRITE_TAC[IN_ELIM_THM] THEN DISCH_TAC THEN BINOP_TAC THENL + [ASM_MESON_TAC[SIGN_INVERSE; PERMUTATION_PERMUTES; FINITE_NUMSEG]; + ALL_TAC] THEN + FIRST_ASSUM(fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) + [GSYM(MATCH_MP PERMUTES_IMAGE th)]) THEN + MATCH_MP_TAC EQ_TRANS THEN EXISTS_TAC + `product(1..dimindex(:N)) + ((\i. (transp A:real^N^N)$i$inverse p(i)) o p)` THEN + CONJ_TAC THENL + [MATCH_MP_TAC PRODUCT_IMAGE THEN + ASM_MESON_TAC[FINITE_NUMSEG; PERMUTES_INJECTIVE; PERMUTES_INVERSE]; + MATCH_MP_TAC PRODUCT_EQ THEN REWRITE_TAC[FINITE_NUMSEG; IN_NUMSEG] THEN + SIMP_TAC[transp; LAMBDA_BETA; o_THM] THEN + FIRST_ASSUM(MP_TAC o MATCH_MP PERMUTES_INVERSES_o) THEN + SIMP_TAC[FUN_EQ_THM; I_THM; o_THM] THEN STRIP_TAC THEN + ASM_SIMP_TAC[PERMUTES_IN_NUMSEG; LAMBDA_BETA_PERM; LAMBDA_BETA]]);; + +let DET_LOWERTRIANGULAR = prove + (`!A:real^N^N. + (!i j. 1 <= i /\ i <= dimindex(:N) /\ + 1 <= j /\ j <= dimindex(:N) /\ i < j ==> A$i$j = &0) + ==> det(A) = product(1..dimindex(:N)) (\i. A$i$i)`, + REPEAT STRIP_TAC THEN REWRITE_TAC[det] THEN MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `sum {I} + (\p. sign p * product(1..dimindex(:N)) (\i. (A:real^N^N)$i$p(i)))` THEN + CONJ_TAC THENL + [ALL_TAC; REWRITE_TAC[SUM_SING; SIGN_I; REAL_MUL_LID; I_THM]] THEN + MATCH_MP_TAC SUM_SUPERSET THEN + SIMP_TAC[IN_SING; FINITE_RULES; SUBSET; IN_ELIM_THM; PERMUTES_I] THEN + X_GEN_TAC `p:num->num` THEN STRIP_TAC THEN + ASM_REWRITE_TAC[PRODUCT_EQ_0_NUMSEG; REAL_ENTIRE; SIGN_NZ] THEN + MP_TAC(SPECL [`p:num->num`; `1..dimindex(:N)`] PERMUTES_NUMSET_LE) THEN + ASM_MESON_TAC[PERMUTES_IN_IMAGE; IN_NUMSEG; NOT_LT]);; + +let DET_UPPERTRIANGULAR = prove + (`!A:real^N^N. + (!i j. 1 <= i /\ i <= dimindex(:N) /\ + 1 <= j /\ j <= dimindex(:N) /\ j < i ==> A$i$j = &0) + ==> det(A) = product(1..dimindex(:N)) (\i. A$i$i)`, + REPEAT STRIP_TAC THEN REWRITE_TAC[det] THEN MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `sum {I} + (\p. sign p * product(1..dimindex(:N)) (\i. (A:real^N^N)$i$p(i)))` THEN + CONJ_TAC THENL + [ALL_TAC; REWRITE_TAC[SUM_SING; SIGN_I; REAL_MUL_LID; I_THM]] THEN + MATCH_MP_TAC SUM_SUPERSET THEN + SIMP_TAC[IN_SING; FINITE_RULES; SUBSET; IN_ELIM_THM; PERMUTES_I] THEN + X_GEN_TAC `p:num->num` THEN STRIP_TAC THEN + ASM_REWRITE_TAC[PRODUCT_EQ_0_NUMSEG; REAL_ENTIRE; SIGN_NZ] THEN + MP_TAC(SPECL [`p:num->num`; `1..dimindex(:N)`] PERMUTES_NUMSET_GE) THEN + ASM_MESON_TAC[PERMUTES_IN_IMAGE; IN_NUMSEG; NOT_LT]);; + +let DET_DIAGONAL = prove + (`!A:real^N^N. + (!i j. 1 <= i /\ i <= dimindex(:N) /\ + 1 <= j /\ j <= dimindex(:N) /\ ~(i = j) ==> A$i$j = &0) + ==> det(A) = product(1..dimindex(:N)) (\i. A$i$i)`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC DET_LOWERTRIANGULAR THEN + REPEAT STRIP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[LT_REFL]);; + +let DET_I = prove + (`det(mat 1 :real^N^N) = &1`, + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `product(1..dimindex(:N)) (\i. (mat 1:real^N^N)$i$i)` THEN + CONJ_TAC THENL + [MATCH_MP_TAC DET_LOWERTRIANGULAR; + MATCH_MP_TAC PRODUCT_EQ_1_NUMSEG] THEN + SIMP_TAC[mat; LAMBDA_BETA] THEN MESON_TAC[LT_REFL]);; + +let DET_0 = prove + (`det(mat 0 :real^N^N) = &0`, + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `product(1..dimindex(:N)) (\i. (mat 0:real^N^N)$i$i)` THEN + CONJ_TAC THENL + [MATCH_MP_TAC DET_LOWERTRIANGULAR; + REWRITE_TAC[PRODUCT_EQ_0_NUMSEG] THEN EXISTS_TAC `1`] THEN + SIMP_TAC[mat; LAMBDA_BETA; COND_ID; DIMINDEX_GE_1; LE_REFL]);; + +let DET_PERMUTE_ROWS = prove + (`!A:real^N^N p. + p permutes 1..dimindex(:N) + ==> det(lambda i. A$p(i)) = sign(p) * det(A)`, + REWRITE_TAC[det] THEN SIMP_TAC[LAMBDA_BETA] THEN REPEAT STRIP_TAC THEN + SIMP_TAC[GSYM SUM_LMUL; FINITE_PERMUTATIONS; FINITE_NUMSEG] THEN + FIRST_ASSUM(fun th -> GEN_REWRITE_TAC LAND_CONV + [MATCH_MP SUM_PERMUTATIONS_COMPOSE_R th]) THEN + MATCH_MP_TAC SUM_EQ THEN + SIMP_TAC[FINITE_PERMUTATIONS; FINITE_NUMSEG] THEN X_GEN_TAC `q:num->num` THEN + REWRITE_TAC[IN_ELIM_THM; REAL_MUL_ASSOC] THEN DISCH_TAC THEN BINOP_TAC THENL + [ONCE_REWRITE_TAC[REAL_MUL_SYM] THEN + ASM_MESON_TAC[SIGN_COMPOSE; PERMUTATION_PERMUTES; FINITE_NUMSEG]; + ALL_TAC] THEN + MP_TAC(MATCH_MP PERMUTES_INVERSE (ASSUME `p permutes 1..dimindex(:N)`)) THEN + DISCH_THEN(fun th -> GEN_REWRITE_TAC LAND_CONV + [MATCH_MP PRODUCT_PERMUTE_NUMSEG th]) THEN + MATCH_MP_TAC PRODUCT_EQ THEN REWRITE_TAC[IN_NUMSEG; FINITE_NUMSEG] THEN + REPEAT STRIP_TAC THEN REWRITE_TAC[o_THM] THEN + ASM_MESON_TAC[PERMUTES_INVERSES]);; + +let DET_PERMUTE_COLUMNS = prove + (`!A:real^N^N p. + p permutes 1..dimindex(:N) + ==> det((lambda i j. A$i$p(j)):real^N^N) = sign(p) * det(A)`, + REPEAT STRIP_TAC THEN + GEN_REWRITE_TAC (funpow 2 RAND_CONV) [GSYM DET_TRANSP] THEN + FIRST_ASSUM(fun th -> ONCE_REWRITE_TAC + [GSYM(MATCH_MP DET_PERMUTE_ROWS th)]) THEN + GEN_REWRITE_TAC RAND_CONV [GSYM DET_TRANSP] THEN AP_TERM_TAC THEN + ASM_SIMP_TAC[CART_EQ; transp; LAMBDA_BETA; LAMBDA_BETA_PERM]);; + +let DET_IDENTICAL_ROWS = prove + (`!A:real^N^N i j. 1 <= i /\ i <= dimindex(:N) /\ + 1 <= j /\ j <= dimindex(:N) /\ ~(i = j) /\ + row i A = row j A + ==> det A = &0`, + REPEAT STRIP_TAC THEN + MP_TAC(SPECL [`A:real^N^N`; `swap(i:num,j:num)`] DET_PERMUTE_ROWS) THEN + ASM_SIMP_TAC[PERMUTES_SWAP; IN_NUMSEG; SIGN_SWAP] THEN + MATCH_MP_TAC(REAL_ARITH `a = b ==> b = -- &1 * a ==> a = &0`) THEN + AP_TERM_TAC THEN FIRST_X_ASSUM(MP_TAC o SYM) THEN + SIMP_TAC[row; CART_EQ; LAMBDA_BETA] THEN + REWRITE_TAC[swap] THEN ASM_MESON_TAC[]);; + +let DET_IDENTICAL_COLUMNS = prove + (`!A:real^N^N i j. 1 <= i /\ i <= dimindex(:N) /\ + 1 <= j /\ j <= dimindex(:N) /\ ~(i = j) /\ + column i A = column j A + ==> det A = &0`, + REPEAT STRIP_TAC THEN ONCE_REWRITE_TAC[GSYM DET_TRANSP] THEN + MATCH_MP_TAC DET_IDENTICAL_ROWS THEN ASM_MESON_TAC[ROW_TRANSP]);; + +let DET_ZERO_ROW = prove + (`!A:real^N^N i. + 1 <= i /\ i <= dimindex(:N) /\ row i A = vec 0 ==> det A = &0`, + SIMP_TAC[det; row; CART_EQ; LAMBDA_BETA; VEC_COMPONENT] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC SUM_EQ_0 THEN + REWRITE_TAC[IN_ELIM_THM; REAL_ENTIRE; SIGN_NZ] THEN REPEAT STRIP_TAC THEN + SIMP_TAC[PRODUCT_EQ_0; FINITE_NUMSEG; IN_NUMSEG] THEN + ASM_MESON_TAC[PERMUTES_IN_IMAGE; IN_NUMSEG]);; + +let DET_ZERO_COLUMN = prove + (`!A:real^N^N i. + 1 <= i /\ i <= dimindex(:N) /\ column i A = vec 0 ==> det A = &0`, + REPEAT STRIP_TAC THEN ONCE_REWRITE_TAC[GSYM DET_TRANSP] THEN + MATCH_MP_TAC DET_ZERO_ROW THEN ASM_MESON_TAC[ROW_TRANSP]);; + +let DET_ROW_ADD = prove + (`!a b c k. + 1 <= k /\ k <= dimindex(:N) + ==> det((lambda i. if i = k then a + b else c i):real^N^N) = + det((lambda i. if i = k then a else c i):real^N^N) + + det((lambda i. if i = k then b else c i):real^N^N)`, + SIMP_TAC[det; LAMBDA_BETA; GSYM SUM_ADD; + FINITE_PERMUTATIONS; FINITE_NUMSEG] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC SUM_EQ THEN + SIMP_TAC[FINITE_PERMUTATIONS; FINITE_NUMSEG] THEN + X_GEN_TAC `p:num->num` THEN REWRITE_TAC[IN_ELIM_THM] THEN + DISCH_TAC THEN REWRITE_TAC[GSYM REAL_ADD_LDISTRIB] THEN AP_TERM_TAC THEN + SUBGOAL_THEN `1..dimindex(:N) = k INSERT ((1..dimindex(:N)) DELETE k)` + SUBST1_TAC THENL [ASM_MESON_TAC[INSERT_DELETE; IN_NUMSEG]; ALL_TAC] THEN + SIMP_TAC[PRODUCT_CLAUSES; FINITE_DELETE; FINITE_NUMSEG; IN_DELETE] THEN + MATCH_MP_TAC(REAL_RING + `c = a + b /\ y = x:real /\ z = x ==> c * x = a * y + b * z`) THEN + REWRITE_TAC[VECTOR_ADD_COMPONENT] THEN + CONJ_TAC THEN MATCH_MP_TAC PRODUCT_EQ THEN + SIMP_TAC[IN_DELETE; FINITE_DELETE; FINITE_NUMSEG]);; + +let DET_ROW_MUL = prove + (`!a b c k. + 1 <= k /\ k <= dimindex(:N) + ==> det((lambda i. if i = k then c % a else b i):real^N^N) = + c * det((lambda i. if i = k then a else b i):real^N^N)`, + SIMP_TAC[det; LAMBDA_BETA; GSYM SUM_LMUL; + FINITE_PERMUTATIONS; FINITE_NUMSEG] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC SUM_EQ THEN + SIMP_TAC[FINITE_PERMUTATIONS; FINITE_NUMSEG] THEN + X_GEN_TAC `p:num->num` THEN REWRITE_TAC[IN_ELIM_THM] THEN DISCH_TAC THEN + SUBGOAL_THEN `1..dimindex(:N) = k INSERT ((1..dimindex(:N)) DELETE k)` + SUBST1_TAC THENL [ASM_MESON_TAC[INSERT_DELETE; IN_NUMSEG]; ALL_TAC] THEN + SIMP_TAC[PRODUCT_CLAUSES; FINITE_DELETE; FINITE_NUMSEG; IN_DELETE] THEN + MATCH_MP_TAC(REAL_RING + `cp = c * p /\ p1 = p2:real ==> s * cp * p1 = c * s * p * p2`) THEN + REWRITE_TAC[VECTOR_MUL_COMPONENT] THEN MATCH_MP_TAC PRODUCT_EQ THEN + SIMP_TAC[IN_DELETE; FINITE_DELETE; FINITE_NUMSEG]);; + +let DET_ROW_OPERATION = prove + (`!A:real^N^N i. + 1 <= i /\ i <= dimindex(:N) /\ + 1 <= j /\ j <= dimindex(:N) /\ ~(i = j) + ==> det(lambda k. if k = i then row i A + c % row j A else row k A) = + det A`, + REPEAT STRIP_TAC THEN ASM_SIMP_TAC[DET_ROW_ADD; DET_ROW_MUL] THEN + MATCH_MP_TAC(REAL_RING `a = b /\ d = &0 ==> a + c * d = b`) THEN + CONJ_TAC THENL + [AP_TERM_TAC THEN ASM_SIMP_TAC[LAMBDA_BETA; CART_EQ] THEN + REPEAT STRIP_TAC THEN COND_CASES_TAC THEN + ASM_SIMP_TAC[row; LAMBDA_BETA; CART_EQ]; + MATCH_MP_TAC DET_IDENTICAL_ROWS THEN + MAP_EVERY EXISTS_TAC [`i:num`; `j:num`] THEN + ASM_SIMP_TAC[row; LAMBDA_BETA; CART_EQ]]);; + +let DET_ROW_SPAN = prove + (`!A:real^N^N i x. + 1 <= i /\ i <= dimindex(:N) /\ + x IN span {row j A | 1 <= j /\ j <= dimindex(:N) /\ ~(j = i)} + ==> det(lambda k. if k = i then row i A + x else row k A) = + det A`, + GEN_TAC THEN GEN_TAC THEN + REWRITE_TAC[IMP_CONJ; RIGHT_FORALL_IMP_THM] THEN REPEAT DISCH_TAC THEN + MATCH_MP_TAC SPAN_INDUCT_ALT THEN CONJ_TAC THENL + [AP_TERM_TAC THEN SIMP_TAC[CART_EQ; LAMBDA_BETA; VECTOR_ADD_RID] THEN + REPEAT STRIP_TAC THEN COND_CASES_TAC THEN ASM_SIMP_TAC[row; LAMBDA_BETA]; + ALL_TAC] THEN + REPEAT GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN + DISCH_THEN(CONJUNCTS_THEN2 (X_CHOOSE_TAC `j:num`) (SUBST_ALL_TAC o SYM)) THEN + ONCE_REWRITE_TAC[VECTOR_ARITH + `a + c % x + y:real^N = (a + y) + c % x`] THEN + ABBREV_TAC `z = row i (A:real^N^N) + y` THEN + ASM_SIMP_TAC[DET_ROW_MUL; DET_ROW_ADD] THEN + MATCH_MP_TAC(REAL_RING `d = &0 ==> a + c * d = a`) THEN + MATCH_MP_TAC DET_IDENTICAL_ROWS THEN + MAP_EVERY EXISTS_TAC [`i:num`; `j:num`] THEN + ASM_SIMP_TAC[row; LAMBDA_BETA; CART_EQ]);; + +(* ------------------------------------------------------------------------- *) +(* May as well do this, though it's a bit unsatisfactory since it ignores *) +(* exact duplicates by considering the rows/columns as a set. *) +(* ------------------------------------------------------------------------- *) + +let DET_DEPENDENT_ROWS = prove + (`!A:real^N^N. dependent(rows A) ==> det A = &0`, + GEN_TAC THEN + REWRITE_TAC[dependent; rows; IN_ELIM_THM; LEFT_AND_EXISTS_THM] THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN GEN_TAC THEN X_GEN_TAC `i:num` THEN + STRIP_TAC THEN FIRST_X_ASSUM SUBST_ALL_TAC THEN + ASM_CASES_TAC + `?i j. 1 <= i /\ i <= dimindex(:N) /\ + 1 <= j /\ j <= dimindex(:N) /\ ~(i = j) /\ + row i (A:real^N^N) = row j A` + THENL [ASM_MESON_TAC[DET_IDENTICAL_ROWS]; ALL_TAC] THEN + MP_TAC(SPECL [`A:real^N^N`; `i:num`; `--(row i (A:real^N^N))`] + DET_ROW_SPAN) THEN + ANTS_TAC THENL + [ASM_REWRITE_TAC[] THEN MATCH_MP_TAC SPAN_NEG THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [IN]) THEN + MATCH_MP_TAC(TAUT `a = b ==> a ==> b`) THEN + REWRITE_TAC[IN] THEN AP_THM_TAC THEN AP_TERM_TAC THEN + REWRITE_TAC[EXTENSION; IN_DELETE; IN_ELIM_THM] THEN ASM_MESON_TAC[]; + DISCH_THEN(SUBST1_TAC o SYM) THEN MATCH_MP_TAC DET_ZERO_ROW THEN + EXISTS_TAC `i:num` THEN + ASM_SIMP_TAC[row; LAMBDA_BETA; CART_EQ; VECTOR_ADD_COMPONENT; + VECTOR_NEG_COMPONENT; VEC_COMPONENT] THEN + REAL_ARITH_TAC]);; + +let DET_DEPENDENT_COLUMNS = prove + (`!A:real^N^N. dependent(columns A) ==> det A = &0`, + MESON_TAC[DET_DEPENDENT_ROWS; ROWS_TRANSP; DET_TRANSP]);; + +(* ------------------------------------------------------------------------- *) +(* Multilinearity and the multiplication formula. *) +(* ------------------------------------------------------------------------- *) + +let DET_LINEAR_ROW_VSUM = prove + (`!a c s k. + FINITE s /\ 1 <= k /\ k <= dimindex(:N) + ==> det((lambda i. if i = k then vsum s a else c i):real^N^N) = + sum s + (\j. det((lambda i. if i = k then a(j) else c i):real^N^N))`, + GEN_TAC THEN GEN_TAC THEN ONCE_REWRITE_TAC[IMP_CONJ] THEN + REWRITE_TAC[RIGHT_FORALL_IMP_THM] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + SIMP_TAC[VSUM_CLAUSES; SUM_CLAUSES; DET_ROW_ADD] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC DET_ZERO_ROW THEN EXISTS_TAC `k:num` THEN + ASM_SIMP_TAC[row; LAMBDA_BETA; CART_EQ; VEC_COMPONENT]);; + +let BOUNDED_FUNCTIONS_BIJECTIONS_1 = prove + (`!p. p IN {(y,g) | y IN s /\ + g IN {f | (!i. 1 <= i /\ i <= k ==> f i IN s) /\ + (!i. ~(1 <= i /\ i <= k) ==> f i = i)}} + ==> (\(y,g) i. if i = SUC k then y else g(i)) p IN + {f | (!i. 1 <= i /\ i <= SUC k ==> f i IN s) /\ + (!i. ~(1 <= i /\ i <= SUC k) ==> f i = i)} /\ + (\h. h(SUC k),(\i. if i = SUC k then i else h(i))) + ((\(y,g) i. if i = SUC k then y else g(i)) p) = p`, + REWRITE_TAC[FORALL_PAIR_THM; IN_ELIM_PAIR_THM] THEN + CONV_TAC(REDEPTH_CONV GEN_BETA_CONV) THEN REWRITE_TAC[IN_ELIM_THM] THEN + MAP_EVERY X_GEN_TAC [`y:num`; `h:num->num`] THEN REPEAT STRIP_TAC THENL + [ASM_MESON_TAC[LE]; + ASM_MESON_TAC[LE; ARITH_RULE `~(1 <= i /\ i <= SUC k) ==> ~(i = SUC k)`]; + REWRITE_TAC[PAIR_EQ; FUN_EQ_THM] THEN + ASM_MESON_TAC[ARITH_RULE `~(SUC k <= k)`]]);; + +let BOUNDED_FUNCTIONS_BIJECTIONS_2 = prove + (`!h. h IN {f | (!i. 1 <= i /\ i <= SUC k ==> f i IN s) /\ + (!i. ~(1 <= i /\ i <= SUC k) ==> f i = i)} + ==> (\h. h(SUC k),(\i. if i = SUC k then i else h(i))) h IN + {(y,g) | y IN s /\ + g IN {f | (!i. 1 <= i /\ i <= k ==> f i IN s) /\ + (!i. ~(1 <= i /\ i <= k) ==> f i = i)}} /\ + (\(y,g) i. if i = SUC k then y else g(i)) + ((\h. h(SUC k),(\i. if i = SUC k then i else h(i))) h) = h`, + REWRITE_TAC[IN_ELIM_PAIR_THM] THEN + CONV_TAC(REDEPTH_CONV GEN_BETA_CONV) THEN REWRITE_TAC[IN_ELIM_THM] THEN + X_GEN_TAC `h:num->num` THEN REPEAT STRIP_TAC THENL + [FIRST_X_ASSUM MATCH_MP_TAC THEN ARITH_TAC; + ASM_MESON_TAC[ARITH_RULE `i <= k ==> i <= SUC k /\ ~(i = SUC k)`]; + ASM_MESON_TAC[ARITH_RULE `i <= SUC k /\ ~(i = SUC k) ==> i <= k`]; + REWRITE_TAC[FUN_EQ_THM] THEN ASM_MESON_TAC[LE_REFL]]);; + +let FINITE_BOUNDED_FUNCTIONS = prove + (`!s k. FINITE s + ==> FINITE {f | (!i. 1 <= i /\ i <= k ==> f(i) IN s) /\ + (!i. ~(1 <= i /\ i <= k) ==> f(i) = i)}`, + REWRITE_TAC[RIGHT_FORALL_IMP_THM] THEN GEN_TAC THEN DISCH_TAC THEN + INDUCT_TAC THENL + [REWRITE_TAC[ARITH_RULE `~(1 <= i /\ i <= 0)`] THEN + SIMP_TAC[GSYM FUN_EQ_THM; SET_RULE `{x | x = y} = {y}`; FINITE_RULES]; + ALL_TAC] THEN + UNDISCH_TAC `FINITE(s:num->bool)` THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[TAUT `a ==> b ==> c <=> b /\ a ==> c`] THEN + DISCH_THEN(MP_TAC o MATCH_MP FINITE_PRODUCT) THEN + DISCH_THEN(MP_TAC o ISPEC `\(y:num,g) i. if i = SUC k then y else g(i)` o + MATCH_MP FINITE_IMAGE) THEN + MATCH_MP_TAC(TAUT `a = b ==> a ==> b`) THEN AP_TERM_TAC THEN + REWRITE_TAC[EXTENSION; IN_IMAGE] THEN + X_GEN_TAC `h:num->num` THEN EQ_TAC THENL + [STRIP_TAC THEN ASM_SIMP_TAC[BOUNDED_FUNCTIONS_BIJECTIONS_1]; ALL_TAC] THEN + DISCH_TAC THEN EXISTS_TAC + `(\h. h(SUC k),(\i. if i = SUC k then i else h(i))) h` THEN + PURE_ONCE_REWRITE_TAC[CONJ_SYM] THEN CONV_TAC (RAND_CONV SYM_CONV) THEN + MATCH_MP_TAC BOUNDED_FUNCTIONS_BIJECTIONS_2 THEN ASM_REWRITE_TAC[]);; + +let DET_LINEAR_ROWS_VSUM_LEMMA = prove + (`!s k a c. + FINITE s /\ k <= dimindex(:N) + ==> det((lambda i. if i <= k then vsum s (a i) else c i):real^N^N) = + sum {f | (!i. 1 <= i /\ i <= k ==> f(i) IN s) /\ + !i. ~(1 <= i /\ i <= k) ==> f(i) = i} + (\f. det((lambda i. if i <= k then a i (f i) else c i) + :real^N^N))`, + let lemma = prove + (`(lambda i. if i <= 0 then x(i) else y(i)) = (lambda i. y i)`, + SIMP_TAC[CART_EQ; ARITH; LAMBDA_BETA; ARITH_RULE + `1 <= k ==> ~(k <= 0)`]) in + ONCE_REWRITE_TAC[IMP_CONJ] THEN + REWRITE_TAC[RIGHT_FORALL_IMP_THM] THEN GEN_TAC THEN DISCH_TAC THEN + INDUCT_TAC THENL + [REWRITE_TAC[lemma; LE_0] THEN GEN_TAC THEN + REWRITE_TAC[ARITH_RULE `~(1 <= i /\ i <= 0)`] THEN + REWRITE_TAC[GSYM FUN_EQ_THM; SET_RULE `{x | x = y} = {y}`] THEN + REWRITE_TAC[SUM_SING]; + ALL_TAC] THEN + DISCH_TAC THEN FIRST_X_ASSUM(MP_TAC o check (is_imp o concl)) THEN + ASM_SIMP_TAC[ARITH_RULE `SUC k <= n ==> k <= n`] THEN REPEAT STRIP_TAC THEN + GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [LE] THEN + REWRITE_TAC[TAUT + `(if a \/ b then c else d) = (if a then c else if b then c else d)`] THEN + ASM_SIMP_TAC[DET_LINEAR_ROW_VSUM; ARITH_RULE `1 <= SUC k`] THEN + ONCE_REWRITE_TAC[TAUT + `(if a then b else if c then d else e) = + (if c then (if a then b else d) else (if a then b else e))`] THEN + ASM_SIMP_TAC[ARITH_RULE `i <= k ==> ~(i = SUC k)`] THEN + ASM_SIMP_TAC[SUM_SUM_PRODUCT; FINITE_BOUNDED_FUNCTIONS] THEN + MATCH_MP_TAC SUM_EQ_GENERAL_INVERSES THEN + EXISTS_TAC `\(y:num,g) i. if i = SUC k then y else g(i)` THEN + EXISTS_TAC `\h. h(SUC k),(\i. if i = SUC k then i else h(i))` THEN + CONJ_TAC THENL [ACCEPT_TAC BOUNDED_FUNCTIONS_BIJECTIONS_2; ALL_TAC] THEN + X_GEN_TAC `p:num#(num->num)` THEN + DISCH_THEN(STRIP_ASSUME_TAC o MATCH_MP BOUNDED_FUNCTIONS_BIJECTIONS_1) THEN + ASM_REWRITE_TAC[] THEN + SPEC_TAC(`p:num#(num->num)`,`q:num#(num->num)`) THEN + REWRITE_TAC[FORALL_PAIR_THM] THEN + CONV_TAC(ONCE_DEPTH_CONV GEN_BETA_CONV) THEN + MAP_EVERY X_GEN_TAC [`y:num`; `g:num->num`] THEN AP_TERM_TAC THEN + SIMP_TAC[CART_EQ; LAMBDA_BETA] THEN + REPEAT STRIP_TAC THEN REPEAT(COND_CASES_TAC THEN ASM_REWRITE_TAC[]) THEN + ASM_MESON_TAC[LE; ARITH_RULE `~(SUC k <= k)`]);; + +let DET_LINEAR_ROWS_VSUM = prove + (`!s a. + FINITE s + ==> det((lambda i. vsum s (a i)):real^N^N) = + sum {f | (!i. 1 <= i /\ i <= dimindex(:N) ==> f(i) IN s) /\ + !i. ~(1 <= i /\ i <= dimindex(:N)) ==> f(i) = i} + (\f. det((lambda i. a i (f i)):real^N^N))`, + let lemma = prove + (`(lambda i. if i <= dimindex(:N) then x(i) else y(i)):real^N^N = + (lambda i. x(i))`, + SIMP_TAC[CART_EQ; LAMBDA_BETA]) in + REPEAT STRIP_TAC THEN + MP_TAC(SPECL [`s:num->bool`; `dimindex(:N)`] DET_LINEAR_ROWS_VSUM_LEMMA) THEN + ASM_REWRITE_TAC[LE_REFL; lemma] THEN SIMP_TAC[]);; + +let MATRIX_MUL_VSUM_ALT = prove + (`!A:real^N^N B:real^N^N. A ** B = + lambda i. vsum (1..dimindex(:N)) (\k. A$i$k % B$k)`, + SIMP_TAC[matrix_mul; CART_EQ; LAMBDA_BETA; VECTOR_MUL_COMPONENT; + VSUM_COMPONENT]);; + +let DET_ROWS_MUL = prove + (`!a c. det((lambda i. c(i) % a(i)):real^N^N) = + product(1..dimindex(:N)) (\i. c(i)) * + det((lambda i. a(i)):real^N^N)`, + REPEAT GEN_TAC THEN SIMP_TAC[det; LAMBDA_BETA] THEN + SIMP_TAC[GSYM SUM_LMUL; FINITE_PERMUTATIONS; FINITE_NUMSEG] THEN + MATCH_MP_TAC SUM_EQ THEN SIMP_TAC[FINITE_PERMUTATIONS; FINITE_NUMSEG] THEN + X_GEN_TAC `p:num->num` THEN REWRITE_TAC[IN_ELIM_THM] THEN DISCH_TAC THEN + MATCH_MP_TAC(REAL_RING `b = c * d ==> s * b = c * s * d`) THEN + SIMP_TAC[GSYM PRODUCT_MUL_NUMSEG] THEN + MATCH_MP_TAC PRODUCT_EQ_NUMSEG THEN + ASM_MESON_TAC[PERMUTES_IN_IMAGE; IN_NUMSEG; VECTOR_MUL_COMPONENT]);; + +let DET_MUL = prove + (`!A B:real^N^N. det(A ** B) = det(A) * det(B)`, + REPEAT GEN_TAC THEN REWRITE_TAC[MATRIX_MUL_VSUM_ALT] THEN + SIMP_TAC[DET_LINEAR_ROWS_VSUM; FINITE_NUMSEG] THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `sum {p | p permutes 1..dimindex(:N)} + (\f. det (lambda i. (A:real^N^N)$i$f i % (B:real^N^N)$f i))` THEN + CONJ_TAC THENL + [REWRITE_TAC[DET_ROWS_MUL] THEN + MATCH_MP_TAC SUM_SUPERSET THEN + SIMP_TAC[FINITE_PERMUTATIONS; FINITE_NUMSEG] THEN + REWRITE_TAC[SUBSET; IN_ELIM_THM] THEN CONJ_TAC THENL + [MESON_TAC[permutes; IN_NUMSEG]; ALL_TAC] THEN + X_GEN_TAC `f:num->num` THEN REWRITE_TAC[permutes; IN_NUMSEG] THEN + DISCH_THEN(CONJUNCTS_THEN2 STRIP_ASSUME_TAC MP_TAC) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + REWRITE_TAC[REAL_ENTIRE] THEN DISJ2_TAC THEN + MATCH_MP_TAC DET_IDENTICAL_ROWS THEN + MP_TAC(ISPECL [`1..dimindex(:N)`; `f:num->num`] + SURJECTIVE_IFF_INJECTIVE) THEN + ASM_REWRITE_TAC[SUBSET; IN_NUMSEG; FINITE_NUMSEG; FORALL_IN_IMAGE] THEN + MATCH_MP_TAC(TAUT `(~b ==> c) /\ (b ==> ~a) ==> (a <=> b) ==> c`) THEN + CONJ_TAC THENL + [REWRITE_TAC[NOT_FORALL_THM] THEN + REPEAT(MATCH_MP_TAC MONO_EXISTS THEN GEN_TAC) THEN + SIMP_TAC[CART_EQ; LAMBDA_BETA; row; NOT_IMP]; + ALL_TAC] THEN + DISCH_TAC THEN + SUBGOAL_THEN `!x y. (f:num->num)(x) = f(y) ==> x = y` ASSUME_TAC THENL + [REPEAT GEN_TAC THEN + ASM_CASES_TAC `1 <= x /\ x <= dimindex(:N)` THEN + ASM_CASES_TAC `1 <= y /\ y <= dimindex(:N)` THEN + ASM_MESON_TAC[]; + ALL_TAC] THEN + ASM_MESON_TAC[]; + ALL_TAC] THEN + SIMP_TAC[det; REAL_MUL_SUM; FINITE_PERMUTATIONS; FINITE_NUMSEG] THEN + MATCH_MP_TAC SUM_EQ THEN SIMP_TAC[FINITE_PERMUTATIONS; FINITE_NUMSEG] THEN + X_GEN_TAC `p:num->num` THEN REWRITE_TAC[IN_ELIM_THM] THEN DISCH_TAC THEN + FIRST_ASSUM(fun th -> GEN_REWRITE_TAC RAND_CONV + [MATCH_MP SUM_PERMUTATIONS_COMPOSE_R (MATCH_MP PERMUTES_INVERSE th)]) THEN + MATCH_MP_TAC SUM_EQ THEN SIMP_TAC[FINITE_PERMUTATIONS; FINITE_NUMSEG] THEN + X_GEN_TAC `q:num->num` THEN REWRITE_TAC[IN_ELIM_THM] THEN DISCH_TAC THEN + REWRITE_TAC[o_THM] THEN ONCE_REWRITE_TAC[AC REAL_MUL_AC + `(p * x) * (q * y) = (p * q) * (x * y)`] THEN + BINOP_TAC THENL + [SUBGOAL_THEN `sign(q o inverse p) = sign(p:num->num) * sign(q:num->num)` + (fun t -> SIMP_TAC[REAL_MUL_ASSOC; SIGN_IDEMPOTENT; REAL_MUL_LID; t]) THEN + ASM_MESON_TAC[SIGN_COMPOSE; PERMUTES_INVERSE; PERMUTATION_PERMUTES; + FINITE_NUMSEG; SIGN_INVERSE; REAL_MUL_SYM]; + ALL_TAC] THEN + GEN_REWRITE_TAC (RAND_CONV o RAND_CONV) + [MATCH_MP PRODUCT_PERMUTE_NUMSEG (ASSUME `p permutes 1..dimindex(:N)`)] THEN + SIMP_TAC[GSYM PRODUCT_MUL; FINITE_NUMSEG] THEN + MATCH_MP_TAC PRODUCT_EQ_NUMSEG THEN + ASM_SIMP_TAC[LAMBDA_BETA; LAMBDA_BETA_PERM; o_THM] THEN + X_GEN_TAC `i:num` THEN STRIP_TAC THEN MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `(A:real^N^N)$i$p(i) * (B:real^N^N)$p(i)$q(i)` THEN CONJ_TAC THENL + [ASM_MESON_TAC[VECTOR_MUL_COMPONENT; PERMUTES_IN_IMAGE; IN_NUMSEG]; + ASM_MESON_TAC[PERMUTES_INVERSES]]);; + +(* ------------------------------------------------------------------------- *) +(* Relation to invertibility. *) +(* ------------------------------------------------------------------------- *) + +let INVERTIBLE_DET_NZ = prove + (`!A:real^N^N. invertible(A) <=> ~(det A = &0)`, + GEN_TAC THEN EQ_TAC THENL + [REWRITE_TAC[INVERTIBLE_RIGHT_INVERSE; LEFT_IMP_EXISTS_THM] THEN + GEN_TAC THEN DISCH_THEN(MP_TAC o AP_TERM `det:real^N^N->real`) THEN + REWRITE_TAC[DET_MUL; DET_I] THEN CONV_TAC REAL_RING; + ALL_TAC] THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[INVERTIBLE_RIGHT_INVERSE] THEN + REWRITE_TAC[MATRIX_RIGHT_INVERTIBLE_INDEPENDENT_ROWS] THEN + REWRITE_TAC[NOT_FORALL_THM; NOT_IMP] THEN + REWRITE_TAC[RIGHT_AND_EXISTS_THM; LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`c:num->real`; `i:num`] THEN STRIP_TAC THEN + MP_TAC(SPECL [`A:real^N^N`; `i:num`; `--(row i (A:real^N^N))`] + DET_ROW_SPAN) THEN + ANTS_TAC THENL + [ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN + `--(row i (A:real^N^N)) = + vsum ((1..dimindex(:N)) DELETE i) (\j. inv(c i) % c j % row j A)` + SUBST1_TAC THENL + [ASM_SIMP_TAC[VSUM_DELETE_CASES; FINITE_NUMSEG; IN_NUMSEG; VSUM_LMUL] THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV] THEN VECTOR_ARITH_TAC; + ALL_TAC] THEN + MATCH_MP_TAC SPAN_VSUM THEN + REWRITE_TAC[FINITE_NUMSEG; IN_NUMSEG; FINITE_DELETE; IN_DELETE] THEN + X_GEN_TAC `j:num` THEN STRIP_TAC THEN REPEAT(MATCH_MP_TAC SPAN_MUL) THEN + MATCH_MP_TAC(CONJUNCT1 SPAN_CLAUSES) THEN + REWRITE_TAC[IN_ELIM_THM] THEN ASM_MESON_TAC[]; + ALL_TAC] THEN + DISCH_THEN(SUBST1_TAC o SYM) THEN MATCH_MP_TAC DET_ZERO_ROW THEN + EXISTS_TAC `i:num` THEN + ASM_SIMP_TAC[row; CART_EQ; LAMBDA_BETA; VEC_COMPONENT; + VECTOR_ARITH `x + --x:real^N = vec 0`]);; + +let DET_EQ_0 = prove + (`!A:real^N^N. det(A) = &0 <=> ~invertible(A)`, + REWRITE_TAC[INVERTIBLE_DET_NZ]);; + +let MATRIX_MUL_LINV = prove + (`!A:real^N^N. ~(det A = &0) ==> matrix_inv A ** A = mat 1`, + SIMP_TAC[MATRIX_INV; DET_EQ_0]);; + +let MATRIX_MUL_RINV = prove + (`!A:real^N^N. ~(det A = &0) ==> A ** matrix_inv A = mat 1`, + SIMP_TAC[MATRIX_INV; DET_EQ_0]);; + +let DET_MATRIX_EQ_0 = prove + (`!f:real^N->real^N. + linear f + ==> (det(matrix f) = &0 <=> + ~(?g. linear g /\ f o g = I /\ g o f = I))`, + SIMP_TAC[DET_EQ_0; MATRIX_INVERTIBLE]);; + +let DET_MATRIX_EQ_0_LEFT = prove + (`!f:real^N->real^N. + linear f + ==> (det(matrix f) = &0 <=> + ~(?g. linear g /\ g o f = I))`, + SIMP_TAC[DET_MATRIX_EQ_0] THEN MESON_TAC[LINEAR_INVERSE_LEFT]);; + +let DET_MATRIX_EQ_0_RIGHT = prove + (`!f:real^N->real^N. + linear f + ==> (det(matrix f) = &0 <=> + ~(?g. linear g /\ f o g = I))`, + SIMP_TAC[DET_MATRIX_EQ_0] THEN MESON_TAC[LINEAR_INVERSE_LEFT]);; + +let DET_EQ_0_RANK = prove + (`!A:real^N^N. det A = &0 <=> rank A < dimindex(:N)`, + REWRITE_TAC[DET_EQ_0; INVERTIBLE_LEFT_INVERSE; GSYM FULL_RANK_INJECTIVE; + MATRIX_LEFT_INVERTIBLE_INJECTIVE] THEN + GEN_TAC THEN MP_TAC(ISPEC `A:real^N^N` RANK_BOUND) THEN + ARITH_TAC);; + +let HOMOGENEOUS_LINEAR_EQUATIONS_DET = prove + (`!A:real^N^N. (?x. ~(x = vec 0) /\ A ** x = vec 0) <=> det A = &0`, + GEN_TAC THEN + REWRITE_TAC[MATRIX_NONFULL_LINEAR_EQUATIONS_EQ; DET_EQ_0_RANK] THEN + MATCH_MP_TAC(ARITH_RULE `r <= MIN N N ==> (~(r = N) <=> r < N)`) THEN + REWRITE_TAC[RANK_BOUND]);; + +(* ------------------------------------------------------------------------- *) +(* Cramer's rule. *) +(* ------------------------------------------------------------------------- *) + +let CRAMER_LEMMA_TRANSP = prove + (`!A:real^N^N x:real^N. + 1 <= k /\ k <= dimindex(:N) + ==> det((lambda i. if i = k + then vsum(1..dimindex(:N)) (\i. x$i % row i A) + else row i A):real^N^N) = + x$k * det A`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `1..dimindex(:N) = k INSERT ((1..dimindex(:N)) DELETE k)` + SUBST1_TAC THENL [ASM_MESON_TAC[INSERT_DELETE; IN_NUMSEG]; ALL_TAC] THEN + SIMP_TAC[VSUM_CLAUSES; FINITE_NUMSEG; FINITE_DELETE; IN_DELETE] THEN + REWRITE_TAC[VECTOR_ARITH + `(x:real^N)$k % row k (A:real^N^N) + s = + (x$k - &1) % row k A + row k A + s`] THEN + W(MP_TAC o PART_MATCH (lhs o rand) DET_ROW_ADD o lhand o snd) THEN + ASM_SIMP_TAC[DET_ROW_MUL] THEN DISCH_THEN(K ALL_TAC) THEN + MATCH_MP_TAC(REAL_RING `d = d' /\ e = d' ==> (c - &1) * d + e = c * d'`) THEN + CONJ_TAC THENL + [AP_TERM_TAC THEN ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA] THEN + REPEAT STRIP_TAC THEN COND_CASES_TAC THEN ASM_SIMP_TAC[LAMBDA_BETA; row]; + MATCH_MP_TAC DET_ROW_SPAN THEN ASM_REWRITE_TAC[] THEN + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC SPAN_VSUM THEN + REWRITE_TAC[FINITE_NUMSEG; IN_NUMSEG; FINITE_DELETE; IN_DELETE] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC SPAN_MUL THEN + MATCH_MP_TAC(CONJUNCT1 SPAN_CLAUSES) THEN + REWRITE_TAC[IN_ELIM_THM] THEN ASM_MESON_TAC[]]);; + +let CRAMER_LEMMA = prove + (`!A:real^N^N x:real^N. + 1 <= k /\ k <= dimindex(:N) + ==> det((lambda i j. if j = k then (A**x)$i else A$i$j):real^N^N) = + x$k * det(A)`, + REPEAT GEN_TAC THEN DISCH_TAC THEN REWRITE_TAC[MATRIX_MUL_VSUM] THEN + FIRST_ASSUM(MP_TAC o SYM o SPECL [`transp(A:real^N^N)`; `x:real^N`] o + MATCH_MP CRAMER_LEMMA_TRANSP) THEN + REWRITE_TAC[DET_TRANSP] THEN DISCH_THEN SUBST1_TAC THEN + GEN_REWRITE_TAC LAND_CONV [GSYM DET_TRANSP] THEN AP_TERM_TAC THEN + ASM_SIMP_TAC[CART_EQ; transp; LAMBDA_BETA; MATRIX_MUL_VSUM; row; column; + COND_COMPONENT; VECTOR_MUL_COMPONENT; VSUM_COMPONENT]);; + +let CRAMER = prove + (`!A:real^N^N x b. + ~(det(A) = &0) + ==> (A ** x = b <=> + x = lambda k. + det((lambda i j. if j = k then b$i else A$i$j):real^N^N) / + det(A))`, + GEN_TAC THEN REWRITE_TAC[RIGHT_FORALL_IMP_THM] THEN DISCH_TAC THEN + ONCE_REWRITE_TAC[SWAP_FORALL_THM] THEN GEN_TAC THEN MATCH_MP_TAC(MESON[] + `(?x. p(x)) /\ (!x. p(x) ==> x = a) ==> !x. p(x) <=> x = a`) THEN + CONJ_TAC THENL + [MP_TAC(SPEC `A:real^N^N` INVERTIBLE_DET_NZ) THEN + ASM_MESON_TAC[invertible; MATRIX_VECTOR_MUL_ASSOC; MATRIX_VECTOR_MUL_LID]; + GEN_TAC THEN DISCH_THEN(SUBST1_TAC o SYM) THEN + ASM_SIMP_TAC[CART_EQ; CRAMER_LEMMA; LAMBDA_BETA; REAL_FIELD + `~(z = &0) ==> (x = y / z <=> x * z = y)`]]);; + +(* ------------------------------------------------------------------------- *) +(* Variants of Cramer's rule for matrix-matrix multiplication. *) +(* ------------------------------------------------------------------------- *) + +let CRAMER_MATRIX_LEFT = prove + (`!A:real^N^N X:real^N^N B:real^N^N. + ~(det A = &0) + ==> (X ** A = B <=> + X = lambda k l. + det((lambda i j. if j = l then B$k$i else A$j$i):real^N^N) / + det A)`, + REPEAT STRIP_TAC THEN ONCE_REWRITE_TAC[CART_EQ] THEN + ASM_SIMP_TAC[MATRIX_MUL_COMPONENT; CRAMER; DET_TRANSP] THEN + SIMP_TAC[CART_EQ; LAMBDA_BETA] THEN + REPLICATE_TAC 2 (AP_TERM_TAC THEN ABS_TAC THEN AP_TERM_TAC) THEN + AP_TERM_TAC THEN AP_THM_TAC THEN AP_TERM_TAC THEN AP_TERM_TAC THEN + SIMP_TAC[CART_EQ; LAMBDA_BETA; transp]);; + +let CRAMER_MATRIX_RIGHT = prove + (`!A:real^N^N X:real^N^N B:real^N^N. + ~(det A = &0) + ==> (A ** X = B <=> + X = lambda k l. + det((lambda i j. if j = k then B$i$l else A$i$j):real^N^N) / + det A)`, + REPEAT STRIP_TAC THEN + GEN_REWRITE_TAC LAND_CONV [GSYM TRANSP_EQ] THEN + REWRITE_TAC[MATRIX_TRANSP_MUL] THEN + ASM_SIMP_TAC[CRAMER_MATRIX_LEFT; DET_TRANSP] THEN + GEN_REWRITE_TAC LAND_CONV [GSYM TRANSP_EQ] THEN + REWRITE_TAC[TRANSP_TRANSP] THEN AP_TERM_TAC THEN + SIMP_TAC[CART_EQ; LAMBDA_BETA; transp] THEN + REPEAT(GEN_TAC THEN STRIP_TAC) THEN + AP_THM_TAC THEN AP_TERM_TAC THEN AP_TERM_TAC THEN + SIMP_TAC[CART_EQ; LAMBDA_BETA; transp]);; + +let CRAMER_MATRIX_RIGHT_INVERSE = prove + (`!A:real^N^N A':real^N^N. + A ** A' = mat 1 <=> + ~(det A = &0) /\ + A' = lambda k l. + det((lambda i j. if j = k then if i = l then &1 else &0 + else A$i$j):real^N^N) / + det A`, + REPEAT GEN_TAC THEN ASM_CASES_TAC `det(A:real^N^N) = &0` THENL + [ASM_REWRITE_TAC[] THEN + DISCH_THEN(MP_TAC o AP_TERM `det:real^N^N->real`) THEN + ASM_REWRITE_TAC[DET_MUL; DET_I] THEN REAL_ARITH_TAC; + ASM_SIMP_TAC[CRAMER_MATRIX_RIGHT] THEN AP_TERM_TAC THEN + SIMP_TAC[CART_EQ; LAMBDA_BETA] THEN + REPEAT(GEN_TAC THEN STRIP_TAC) THEN + AP_THM_TAC THEN AP_TERM_TAC THEN AP_TERM_TAC THEN + ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA; mat]]);; + +let CRAMER_MATRIX_LEFT_INVERSE = prove + (`!A:real^N^N A':real^N^N. + A' ** A = mat 1 <=> + ~(det A = &0) /\ + A' = lambda k l. + det((lambda i j. if j = l then if i = k then &1 else &0 + else A$j$i):real^N^N) / + det A`, + REPEAT GEN_TAC THEN ASM_CASES_TAC `det(A:real^N^N) = &0` THENL + [ASM_REWRITE_TAC[] THEN + DISCH_THEN(MP_TAC o AP_TERM `det:real^N^N->real`) THEN + ASM_REWRITE_TAC[DET_MUL; DET_I] THEN REAL_ARITH_TAC; + ASM_SIMP_TAC[CRAMER_MATRIX_LEFT] THEN AP_TERM_TAC THEN + SIMP_TAC[CART_EQ; LAMBDA_BETA] THEN + REPEAT(GEN_TAC THEN STRIP_TAC) THEN + AP_THM_TAC THEN AP_TERM_TAC THEN AP_TERM_TAC THEN + ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA; mat] THEN MESON_TAC[]]);; + +(* ------------------------------------------------------------------------- *) +(* Cofactors and their relationship to inverse matrices. *) +(* ------------------------------------------------------------------------- *) + +let cofactor = new_definition + `(cofactor:real^N^N->real^N^N) A = + lambda i j. det((lambda k l. if k = i /\ l = j then &1 + else if k = i \/ l = j then &0 + else A$k$l):real^N^N)`;; + +let COFACTOR_TRANSP = prove + (`!A:real^N^N. cofactor(transp A) = transp(cofactor A)`, + SIMP_TAC[cofactor; CART_EQ; LAMBDA_BETA; transp] THEN REPEAT STRIP_TAC THEN + GEN_REWRITE_TAC RAND_CONV [GSYM DET_TRANSP] THEN + AP_TERM_TAC THEN SIMP_TAC[cofactor; CART_EQ; LAMBDA_BETA; transp] THEN + MESON_TAC[]);; + +let COFACTOR_COLUMN = prove + (`!A:real^N^N. + cofactor A = + lambda i j. det((lambda k l. if l = j then if k = i then &1 else &0 + else A$k$l):real^N^N)`, + GEN_TAC THEN CONV_TAC SYM_CONV THEN + SIMP_TAC[cofactor; CART_EQ; LAMBDA_BETA] THEN + X_GEN_TAC `i:num` THEN STRIP_TAC THEN + X_GEN_TAC `j:num` THEN STRIP_TAC THEN + REWRITE_TAC[det] THEN MATCH_MP_TAC SUM_EQ THEN + REWRITE_TAC[FORALL_IN_GSPEC] THEN GEN_TAC THEN + DISCH_TAC THEN AP_TERM_TAC THEN + ASM_CASES_TAC `(p:num->num) i = j` THENL + [MATCH_MP_TAC PRODUCT_EQ THEN + X_GEN_TAC `k:num` THEN SIMP_TAC[IN_NUMSEG; LAMBDA_BETA] THEN STRIP_TAC THEN + SUBGOAL_THEN `(p:num->num) k IN 1..dimindex(:N)` MP_TAC THENL + [ASM_MESON_TAC[PERMUTES_IN_IMAGE; IN_NUMSEG]; + SIMP_TAC[LAMBDA_BETA; IN_NUMSEG] THEN STRIP_TAC] THEN + ASM_CASES_TAC `(p:num->num) k = j` THEN ASM_REWRITE_TAC[] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[]; + MATCH_MP_TAC(REAL_ARITH `s = &0 /\ t = &0 ==> s = t`) THEN + ASM_SIMP_TAC[PRODUCT_EQ_0; FINITE_NUMSEG] THEN CONJ_TAC THEN + EXISTS_TAC `inverse (p:num->num) j` THEN + ASM_SIMP_TAC[IN_NUMSEG; LAMBDA_BETA] THEN + (SUBGOAL_THEN `inverse(p:num->num) j IN 1..dimindex(:N)` MP_TAC THENL + [ASM_MESON_TAC[PERMUTES_IN_IMAGE; PERMUTES_INVERSE; IN_NUMSEG]; + SIMP_TAC[LAMBDA_BETA; IN_NUMSEG] THEN STRIP_TAC] THEN + SUBGOAL_THEN `(p:num->num)(inverse p j) = j` SUBST1_TAC THENL + [ASM_MESON_TAC[PERMUTES_INVERSES; IN_NUMSEG]; + ASM_SIMP_TAC[LAMBDA_BETA] THEN + ASM_MESON_TAC[PERMUTES_INVERSE_EQ]])]);; + +let COFACTOR_ROW = prove + (`!A:real^N^N. + cofactor A = + lambda i j. det((lambda k l. if k = i then if l = j then &1 else &0 + else A$k$l):real^N^N)`, + GEN_TAC THEN ONCE_REWRITE_TAC[GSYM TRANSP_EQ] THEN + REWRITE_TAC[GSYM COFACTOR_TRANSP] THEN + SIMP_TAC[COFACTOR_COLUMN; CART_EQ; LAMBDA_BETA; transp] THEN + REPEAT STRIP_TAC THEN + GEN_REWRITE_TAC RAND_CONV [GSYM DET_TRANSP] THEN + AP_TERM_TAC THEN SIMP_TAC[cofactor; CART_EQ; LAMBDA_BETA; transp]);; + +let MATRIX_RIGHT_INVERSE_COFACTOR = prove + (`!A:real^N^N A':real^N^N. + A ** A' = mat 1 <=> + ~(det A = &0) /\ A' = inv(det A) %% transp(cofactor A)`, + REPEAT GEN_TAC THEN REWRITE_TAC[CRAMER_MATRIX_RIGHT_INVERSE] THEN + ASM_CASES_TAC `det(A:real^N^N) = &0` THEN ASM_REWRITE_TAC[] THEN + AP_TERM_TAC THEN SIMP_TAC[CART_EQ; LAMBDA_BETA; MATRIX_CMUL_COMPONENT] THEN + X_GEN_TAC `k:num` THEN STRIP_TAC THEN + X_GEN_TAC `l:num` THEN STRIP_TAC THEN + REWRITE_TAC[ONCE_REWRITE_RULE[REAL_MUL_SYM] real_div] THEN AP_TERM_TAC THEN + ASM_SIMP_TAC[transp; COFACTOR_COLUMN; LAMBDA_BETA] THEN + AP_TERM_TAC THEN SIMP_TAC[CART_EQ; LAMBDA_BETA]);; + +let MATRIX_LEFT_INVERSE_COFACTOR = prove + (`!A:real^N^N A':real^N^N. + A' ** A = mat 1 <=> + ~(det A = &0) /\ A' = inv(det A) %% transp(cofactor A)`, + REPEAT GEN_TAC THEN + ONCE_REWRITE_TAC[MATRIX_LEFT_RIGHT_INVERSE] THEN + REWRITE_TAC[MATRIX_RIGHT_INVERSE_COFACTOR]);; + +let MATRIX_INV_COFACTOR = prove + (`!A. ~(det A = &0) ==> matrix_inv A = inv(det A) %% transp(cofactor A)`, + GEN_TAC THEN DISCH_THEN(MP_TAC o MATCH_MP MATRIX_MUL_LINV) THEN + SIMP_TAC[MATRIX_LEFT_INVERSE_COFACTOR]);; + +let COFACTOR_MATRIX_INV = prove + (`!A:real^N^N. ~(det A = &0) ==> cofactor A = det(A) %% transp(matrix_inv A)`, + SIMP_TAC[MATRIX_INV_COFACTOR; TRANSP_MATRIX_CMUL; TRANSP_TRANSP] THEN + SIMP_TAC[MATRIX_CMUL_ASSOC; REAL_MUL_RINV; MATRIX_CMUL_LID]);; + +let DET_COFACTOR_EXPANSION = prove + (`!A:real^N^N i. + 1 <= i /\ i <= dimindex(:N) + ==> det A = sum (1..dimindex(:N)) + (\j. A$i$j * (cofactor A)$i$j)`, + REPEAT STRIP_TAC THEN ASM_SIMP_TAC[COFACTOR_COLUMN; LAMBDA_BETA; det] THEN + REWRITE_TAC[GSYM SUM_LMUL] THEN + W(MP_TAC o PART_MATCH (lhand o rand) SUM_SWAP o rand o snd) THEN + ANTS_TAC THENL [SIMP_TAC[FINITE_PERMUTATIONS; FINITE_NUMSEG]; ALL_TAC] THEN + DISCH_THEN SUBST1_TAC THEN + MATCH_MP_TAC SUM_EQ THEN REWRITE_TAC[FORALL_IN_GSPEC] THEN + GEN_TAC THEN DISCH_TAC THEN + ONCE_REWRITE_TAC[REAL_ARITH `a * s * p:real = s * a * p`] THEN + REWRITE_TAC[SUM_LMUL] THEN AP_TERM_TAC THEN MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC + `sum (1..dimindex (:N)) + (\j. (A:real^N^N)$i$j * + product + (inverse p j INSERT ((1..dimindex(:N)) DELETE (inverse p j))) + (\k. if k = inverse p j then if k = i then &1 else &0 + else A$k$(p k)))` THEN + CONJ_TAC THENL + [SIMP_TAC[PRODUCT_CLAUSES; FINITE_DELETE; FINITE_PERMUTATIONS; + FINITE_NUMSEG; IN_DELETE] THEN + SUBGOAL_THEN `!j. inverse (p:num->num) j = i <=> j = p i` + (fun th -> REWRITE_TAC[th]) + THENL [ASM_MESON_TAC[PERMUTES_INVERSES; IN_NUMSEG]; ALL_TAC] THEN + REWRITE_TAC[REAL_ARITH + `x * (if p then &1 else &0) * y = if p then x * y else &0`] THEN + SIMP_TAC[SUM_DELTA] THEN COND_CASES_TAC THENL + [ALL_TAC; ASM_MESON_TAC[PERMUTES_IN_IMAGE; IN_NUMSEG]] THEN + SUBGOAL_THEN + `1..dimindex(:N) = i INSERT ((1..dimindex(:N)) DELETE i)` + (fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [th]) + THENL + [ASM_SIMP_TAC[IN_NUMSEG; SET_RULE `s = x INSERT (s DELETE x) <=> x IN s`]; + SIMP_TAC[PRODUCT_CLAUSES; FINITE_DELETE; FINITE_NUMSEG; IN_DELETE] THEN + AP_TERM_TAC THEN MATCH_MP_TAC(MESON[PRODUCT_EQ] + `s = t /\ (!x. x IN t ==> f x = g x) ==> product s f = product t g`) THEN + SIMP_TAC[IN_DELETE] THEN ASM_MESON_TAC[PERMUTES_INVERSES; IN_NUMSEG]]; + MATCH_MP_TAC SUM_EQ_NUMSEG THEN X_GEN_TAC `j:num` THEN STRIP_TAC THEN + REWRITE_TAC[] THEN AP_TERM_TAC THEN MATCH_MP_TAC(MESON[PRODUCT_EQ] + `s = t /\ (!x. x IN t ==> f x = g x) ==> product s f = product t g`) THEN + CONJ_TAC THENL + [REWRITE_TAC[SET_RULE `x INSERT (s DELETE x) = s <=> x IN s`] THEN + ASM_MESON_TAC[PERMUTES_IN_IMAGE; IN_NUMSEG; PERMUTES_INVERSE]; + X_GEN_TAC `k:num` THEN REWRITE_TAC[IN_NUMSEG] THEN STRIP_TAC THEN + SUBGOAL_THEN `(p:num->num) k IN 1..dimindex(:N)` MP_TAC THENL + [ASM_MESON_TAC[PERMUTES_IN_IMAGE; IN_NUMSEG]; ALL_TAC] THEN + SIMP_TAC[LAMBDA_BETA; IN_NUMSEG] THEN + ASM_MESON_TAC[PERMUTES_INVERSES; IN_NUMSEG]]]);; + +let MATRIX_MUL_RIGHT_COFACTOR = prove + (`!A:real^N^N. A ** transp(cofactor A) = det(A) %% mat 1`, + GEN_TAC THEN + SIMP_TAC[CART_EQ; MATRIX_CMUL_COMPONENT; mat; + matrix_mul; LAMBDA_BETA; transp] THEN + X_GEN_TAC `i:num` THEN STRIP_TAC THEN + X_GEN_TAC `i':num` THEN STRIP_TAC THEN + COND_CASES_TAC THEN + ASM_SIMP_TAC[GSYM DET_COFACTOR_EXPANSION; REAL_MUL_RID] THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `det((lambda k l. if k = i' then (A:real^N^N)$i$l + else A$k$l):real^N^N)` THEN + CONJ_TAC THENL + [MP_TAC(GEN `A:real^N^N` + (ISPECL [`A:real^N^N`; `i':num`] DET_COFACTOR_EXPANSION)) THEN + ASM_REWRITE_TAC[] THEN ASM_SIMP_TAC[] THEN DISCH_THEN(K ALL_TAC) THEN + MATCH_MP_TAC SUM_EQ THEN X_GEN_TAC `j:num` THEN + REWRITE_TAC[IN_NUMSEG] THEN STRIP_TAC THEN + ASM_SIMP_TAC[LAMBDA_BETA] THEN AP_TERM_TAC THEN + ASM_SIMP_TAC[cofactor; LAMBDA_BETA] THEN AP_TERM_TAC THEN + SIMP_TAC[CART_EQ; LAMBDA_BETA] THEN ASM_MESON_TAC[]; + REWRITE_TAC[REAL_MUL_RZERO] THEN MATCH_MP_TAC DET_IDENTICAL_ROWS THEN + MAP_EVERY EXISTS_TAC [`i:num`;` i':num`] THEN + ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA; row]]);; + +let MATRIX_MUL_LEFT_COFACTOR = prove + (`!A:real^N^N. transp(cofactor A) ** A = det(A) %% mat 1`, + GEN_TAC THEN ONCE_REWRITE_TAC[GSYM TRANSP_EQ] THEN + REWRITE_TAC[MATRIX_TRANSP_MUL] THEN + ONCE_REWRITE_TAC[GSYM COFACTOR_TRANSP] THEN + REWRITE_TAC[MATRIX_MUL_RIGHT_COFACTOR; TRANSP_MATRIX_CMUL] THEN + REWRITE_TAC[DET_TRANSP; TRANSP_MAT]);; + +(* ------------------------------------------------------------------------- *) +(* Explicit formulas for low dimensions. *) +(* ------------------------------------------------------------------------- *) + +let PRODUCT_1 = prove + (`product(1..1) f = f(1)`, + REWRITE_TAC[PRODUCT_SING_NUMSEG]);; + +let PRODUCT_2 = prove + (`!t. product(1..2) t = t(1) * t(2)`, + REWRITE_TAC[num_CONV `2`; PRODUCT_CLAUSES_NUMSEG] THEN + REWRITE_TAC[PRODUCT_SING_NUMSEG; ARITH; REAL_MUL_ASSOC]);; + +let PRODUCT_3 = prove + (`!t. product(1..3) t = t(1) * t(2) * t(3)`, + REWRITE_TAC[num_CONV `3`; num_CONV `2`; PRODUCT_CLAUSES_NUMSEG] THEN + REWRITE_TAC[PRODUCT_SING_NUMSEG; ARITH; REAL_MUL_ASSOC]);; + +let DET_1 = prove + (`!A:real^1^1. det A = A$1$1`, + REWRITE_TAC[det; DIMINDEX_1; PERMUTES_SING; NUMSEG_SING] THEN + REWRITE_TAC[SUM_SING; SET_RULE `{x | x = a} = {a}`; PRODUCT_SING] THEN + REWRITE_TAC[SIGN_I; I_THM] THEN REAL_ARITH_TAC);; + +let DET_2 = prove + (`!A:real^2^2. det A = A$1$1 * A$2$2 - A$1$2 * A$2$1`, + GEN_TAC THEN REWRITE_TAC[det; DIMINDEX_2] THEN + CONV_TAC(LAND_CONV(RATOR_CONV(ONCE_DEPTH_CONV NUMSEG_CONV))) THEN + SIMP_TAC[SUM_OVER_PERMUTATIONS_INSERT; FINITE_INSERT; FINITE_EMPTY; + ARITH_EQ; IN_INSERT; NOT_IN_EMPTY] THEN + REWRITE_TAC[PERMUTES_EMPTY; SUM_SING; SET_RULE `{x | x = a} = {a}`] THEN + REWRITE_TAC[SWAP_REFL; I_O_ID] THEN + REWRITE_TAC[GSYM(NUMSEG_CONV `1..2`); SUM_2] THEN + SIMP_TAC[SUM_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + ARITH_EQ; IN_INSERT; NOT_IN_EMPTY] THEN + SIMP_TAC[SIGN_COMPOSE; PERMUTATION_SWAP] THEN + REWRITE_TAC[SIGN_SWAP; ARITH] THEN REWRITE_TAC[PRODUCT_2] THEN + REWRITE_TAC[o_THM; swap; ARITH] THEN REAL_ARITH_TAC);; + +let DET_3 = prove + (`!A:real^3^3. + det(A) = A$1$1 * A$2$2 * A$3$3 + + A$1$2 * A$2$3 * A$3$1 + + A$1$3 * A$2$1 * A$3$2 - + A$1$1 * A$2$3 * A$3$2 - + A$1$2 * A$2$1 * A$3$3 - + A$1$3 * A$2$2 * A$3$1`, + GEN_TAC THEN REWRITE_TAC[det; DIMINDEX_3] THEN + CONV_TAC(LAND_CONV(RATOR_CONV(ONCE_DEPTH_CONV NUMSEG_CONV))) THEN + SIMP_TAC[SUM_OVER_PERMUTATIONS_INSERT; FINITE_INSERT; FINITE_EMPTY; + ARITH_EQ; IN_INSERT; NOT_IN_EMPTY] THEN + REWRITE_TAC[PERMUTES_EMPTY; SUM_SING; SET_RULE `{x | x = a} = {a}`] THEN + REWRITE_TAC[SWAP_REFL; I_O_ID] THEN + REWRITE_TAC[GSYM(NUMSEG_CONV `1..3`); SUM_3] THEN + SIMP_TAC[SUM_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + ARITH_EQ; IN_INSERT; NOT_IN_EMPTY] THEN + SIMP_TAC[SIGN_COMPOSE; PERMUTATION_SWAP] THEN + REWRITE_TAC[SIGN_SWAP; ARITH] THEN REWRITE_TAC[PRODUCT_3] THEN + REWRITE_TAC[o_THM; swap; ARITH] THEN REAL_ARITH_TAC);; + +(* ------------------------------------------------------------------------- *) +(* Grassmann-Plucker relations for n = 2 and n = 3. *) +(* I have a proof of the general n case but the proof is a bit long and the *) +(* result doesn't seem generally useful enough to go in the main theories. *) +(* ------------------------------------------------------------------------- *) + +let GRASSMANN_PLUCKER_2 = prove + (`!x1 x2 y1 y2:real^2. + det(vector[x1;x2]) * det(vector[y1;y2]) = + det(vector[y1;x2]) * det(vector[x1;y2]) + + det(vector[y2;x2]) * det(vector[y1;x1])`, + REWRITE_TAC[DET_2; VECTOR_2] THEN REAL_ARITH_TAC);; + +let GRASSMANN_PLUCKER_3 = prove + (`!x1 x2 x3 y1 y2 y3:real^3. + det(vector[x1;x2;x3]) * det(vector[y1;y2;y3]) = + det(vector[y1;x2;x3]) * det(vector[x1;y2;y3]) + + det(vector[y2;x2;x3]) * det(vector[y1;x1;y3]) + + det(vector[y3;x2;x3]) * det(vector[y1;y2;x1])`, + REWRITE_TAC[DET_3; VECTOR_3] THEN REAL_ARITH_TAC);; + +(* ------------------------------------------------------------------------- *) +(* Determinants of integer matrices. *) +(* ------------------------------------------------------------------------- *) + +let INTEGER_PRODUCT = prove + (`!f s. (!x. x IN s ==> integer(f x)) ==> integer(product s f)`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC PRODUCT_CLOSED THEN + ASM_REWRITE_TAC[INTEGER_CLOSED]);; + +let INTEGER_SIGN = prove + (`!p. integer(sign p)`, + SIMP_TAC[sign; COND_RAND; INTEGER_CLOSED; COND_ID]);; + +let INTEGER_DET = prove + (`!M:real^N^N. + (!i j. 1 <= i /\ i <= dimindex(:N) /\ + 1 <= j /\ j <= dimindex(:N) + ==> integer(M$i$j)) + ==> integer(det M)`, + REPEAT STRIP_TAC THEN REWRITE_TAC[det] THEN + MATCH_MP_TAC INTEGER_SUM THEN X_GEN_TAC `p:num->num` THEN + REWRITE_TAC[IN_ELIM_THM] THEN DISCH_TAC THEN + MATCH_MP_TAC INTEGER_MUL THEN REWRITE_TAC[INTEGER_SIGN] THEN + MATCH_MP_TAC INTEGER_PRODUCT THEN REWRITE_TAC[IN_NUMSEG] THEN + REPEAT STRIP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_MESON_TAC[IN_NUMSEG; permutes]);; + +(* ------------------------------------------------------------------------- *) +(* Orthogonality of a transformation and matrix. *) +(* ------------------------------------------------------------------------- *) + +let orthogonal_transformation = new_definition + `orthogonal_transformation(f:real^N->real^N) <=> + linear f /\ !v w. f(v) dot f(w) = v dot w`;; + +let ORTHOGONAL_TRANSFORMATION = prove + (`!f. orthogonal_transformation f <=> linear f /\ !v. norm(f v) = norm(v)`, + GEN_TAC THEN REWRITE_TAC[orthogonal_transformation] THEN EQ_TAC THENL + [MESON_TAC[vector_norm]; SIMP_TAC[DOT_NORM] THEN MESON_TAC[LINEAR_ADD]]);; + +let orthogonal_matrix = new_definition + `orthogonal_matrix(Q:real^N^N) <=> + transp(Q) ** Q = mat 1 /\ Q ** transp(Q) = mat 1`;; + +let ORTHOGONAL_MATRIX = prove + (`orthogonal_matrix(Q:real^N^N) <=> transp(Q) ** Q = mat 1`, + MESON_TAC[MATRIX_LEFT_RIGHT_INVERSE; orthogonal_matrix]);; + +let ORTHOGONAL_MATRIX_ID = prove + (`orthogonal_matrix(mat 1)`, + REWRITE_TAC[orthogonal_matrix; TRANSP_MAT; MATRIX_MUL_LID]);; + +let ORTHOGONAL_MATRIX_MUL = prove + (`!A B. orthogonal_matrix A /\ orthogonal_matrix B + ==> orthogonal_matrix(A ** B)`, + REWRITE_TAC[orthogonal_matrix; MATRIX_TRANSP_MUL] THEN + REPEAT STRIP_TAC THEN ONCE_REWRITE_TAC[GSYM MATRIX_MUL_ASSOC] THEN + GEN_REWRITE_TAC (LAND_CONV o RAND_CONV) [MATRIX_MUL_ASSOC] THEN + ASM_REWRITE_TAC[MATRIX_MUL_LID; MATRIX_MUL_RID]);; + +let ORTHOGONAL_TRANSFORMATION_MATRIX = prove + (`!f:real^N->real^N. + orthogonal_transformation f <=> linear f /\ orthogonal_matrix(matrix f)`, + REPEAT STRIP_TAC THEN EQ_TAC THENL + [REWRITE_TAC[orthogonal_transformation; ORTHOGONAL_MATRIX] THEN + STRIP_TAC THEN ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA] THEN + X_GEN_TAC `i:num` THEN STRIP_TAC THEN + X_GEN_TAC `j:num` THEN STRIP_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPECL [`basis i:real^N`; `basis j:real^N`]) THEN + FIRST_ASSUM(fun th -> REWRITE_TAC[GSYM(MATCH_MP MATRIX_WORKS th)]) THEN + REWRITE_TAC[DOT_MATRIX_VECTOR_MUL] THEN + ABBREV_TAC `A = transp (matrix f) ** matrix(f:real^N->real^N)` THEN + ASM_SIMP_TAC[matrix_mul; columnvector; rowvector; basis; LAMBDA_BETA; + SUM_DELTA; DIMINDEX_1; LE_REFL; dot; IN_NUMSEG; mat; + MESON[REAL_MUL_LID; REAL_MUL_LZERO; REAL_MUL_RID; REAL_MUL_RZERO] + `(if b then &1 else &0) * x = (if b then x else &0) /\ + x * (if b then &1 else &0) = (if b then x else &0)`]; + REWRITE_TAC[orthogonal_matrix; ORTHOGONAL_TRANSFORMATION; NORM_EQ] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + FIRST_ASSUM(fun th -> REWRITE_TAC[GSYM(MATCH_MP MATRIX_WORKS th)]) THEN + ASM_REWRITE_TAC[DOT_MATRIX_VECTOR_MUL] THEN + SIMP_TAC[DOT_MATRIX_PRODUCT; MATRIX_MUL_LID]]);; + +let DET_ORTHOGONAL_MATRIX = prove + (`!Q. orthogonal_matrix Q ==> det(Q) = &1 \/ det(Q) = -- &1`, + GEN_TAC THEN REWRITE_TAC[REAL_RING `x = &1 \/ x = -- &1 <=> x * x = &1`] THEN + GEN_REWRITE_TAC (RAND_CONV o LAND_CONV o RAND_CONV) [GSYM DET_TRANSP] THEN + SIMP_TAC[GSYM DET_MUL; orthogonal_matrix; DET_I]);; + +let ORTHOGONAL_MATRIX_TRANSP = prove + (`!A:real^N^N. orthogonal_matrix(transp A) <=> orthogonal_matrix A`, + REWRITE_TAC[orthogonal_matrix; TRANSP_TRANSP; CONJ_ACI]);; + +let MATRIX_MUL_LTRANSP_DOT_COLUMN = prove + (`!A:real^N^N. transp A ** A = (lambda i j. (column i A) dot (column j A))`, + SIMP_TAC[matrix_mul; CART_EQ; LAMBDA_BETA; transp; dot; column]);; + +let MATRIX_MUL_RTRANSP_DOT_ROW = prove + (`!A:real^N^N. A ** transp A = (lambda i j. (row i A) dot (row j A))`, + SIMP_TAC[matrix_mul; CART_EQ; LAMBDA_BETA; transp; dot; row]);; + +let ORTHOGONAL_MATRIX_ORTHONORMAL_COLUMNS = prove + (`!A:real^N^N. + orthogonal_matrix A <=> + (!i. 1 <= i /\ i <= dimindex(:N) ==> norm(column i A) = &1) /\ + (!i j. 1 <= i /\ i <= dimindex(:N) /\ + 1 <= j /\ j <= dimindex(:N) /\ ~(i = j) + ==> orthogonal (column i A) (column j A))`, + REWRITE_TAC[ORTHOGONAL_MATRIX] THEN + SIMP_TAC[MATRIX_MUL_LTRANSP_DOT_COLUMN; CART_EQ; mat; LAMBDA_BETA] THEN + REWRITE_TAC[orthogonal; NORM_EQ_1] THEN MESON_TAC[]);; + +let ORTHOGONAL_MATRIX_ORTHONORMAL_ROWS = prove + (`!A:real^N^N. + orthogonal_matrix A <=> + (!i. 1 <= i /\ i <= dimindex(:N) ==> norm(row i A) = &1) /\ + (!i j. 1 <= i /\ i <= dimindex(:N) /\ + 1 <= j /\ j <= dimindex(:N) /\ ~(i = j) + ==> orthogonal (row i A) (row j A))`, + ONCE_REWRITE_TAC[GSYM ORTHOGONAL_MATRIX_TRANSP] THEN + SIMP_TAC[ORTHOGONAL_MATRIX_ORTHONORMAL_COLUMNS; COLUMN_TRANSP]);; + +let ORTHOGONAL_MATRIX_2 = prove + (`!A:real^2^2. orthogonal_matrix A <=> + A$1$1 pow 2 + A$2$1 pow 2 = &1 /\ + A$1$2 pow 2 + A$2$2 pow 2 = &1 /\ + A$1$1 * A$1$2 + A$2$1 * A$2$2 = &0`, + SIMP_TAC[orthogonal_matrix; CART_EQ; matrix_mul; LAMBDA_BETA; + TRANSP_COMPONENT; MAT_COMPONENT] THEN + REWRITE_TAC[DIMINDEX_2; FORALL_2; SUM_2] THEN + CONV_TAC NUM_REDUCE_CONV THEN CONV_TAC REAL_RING);; + +let ORTHOGONAL_MATRIX_2_ALT = prove + (`!A:real^2^2. orthogonal_matrix A <=> + A$1$1 pow 2 + A$2$1 pow 2 = &1 /\ + (A$1$1 = A$2$2 /\ A$1$2 = --(A$2$1) \/ + A$1$1 = --(A$2$2) /\ A$1$2 = A$2$1)`, + REWRITE_TAC[ORTHOGONAL_MATRIX_2] THEN CONV_TAC REAL_RING);; + +(* ------------------------------------------------------------------------- *) +(* Linearity of scaling, and hence isometry, that preserves origin. *) +(* ------------------------------------------------------------------------- *) + +let SCALING_LINEAR = prove + (`!f:real^M->real^N c. + (f(vec 0) = vec 0) /\ (!x y. dist(f x,f y) = c * dist(x,y)) + ==> linear(f)`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `!v w. ((f:real^M->real^N) v) dot (f w) = c pow 2 * (v dot w)` + ASSUME_TAC THENL + [FIRST_ASSUM(MP_TAC o GEN `v:real^M` o + SPECL [`v:real^M`; `vec 0 :real^M`]) THEN + REWRITE_TAC[dist] THEN ASM_REWRITE_TAC[VECTOR_SUB_RZERO] THEN + DISCH_TAC THEN ASM_REWRITE_TAC[DOT_NORM_NEG; GSYM dist] THEN + REAL_ARITH_TAC; + ALL_TAC] THEN + REWRITE_TAC[linear; VECTOR_EQ] THEN + ASM_REWRITE_TAC[DOT_LADD; DOT_RADD; DOT_LMUL; DOT_RMUL] THEN + REAL_ARITH_TAC);; + +let ISOMETRY_LINEAR = prove + (`!f:real^M->real^N. + (f(vec 0) = vec 0) /\ (!x y. dist(f x,f y) = dist(x,y)) + ==> linear(f)`, + MESON_TAC[SCALING_LINEAR; REAL_MUL_LID]);; + +(* ------------------------------------------------------------------------- *) +(* Hence another formulation of orthogonal transformation. *) +(* ------------------------------------------------------------------------- *) + +let ORTHOGONAL_TRANSFORMATION_ISOMETRY = prove + (`!f:real^N->real^N. + orthogonal_transformation f <=> + (f(vec 0) = vec 0) /\ (!x y. dist(f x,f y) = dist(x,y))`, + GEN_TAC THEN REWRITE_TAC[ORTHOGONAL_TRANSFORMATION] THEN EQ_TAC THENL + [MESON_TAC[LINEAR_0; LINEAR_SUB; dist]; STRIP_TAC] THEN + ASM_SIMP_TAC[ISOMETRY_LINEAR] THEN X_GEN_TAC `x:real^N` THEN + FIRST_X_ASSUM(MP_TAC o SPECL [`x:real^N`; `vec 0:real^N`]) THEN + ASM_REWRITE_TAC[dist; VECTOR_SUB_RZERO]);; + +(* ------------------------------------------------------------------------- *) +(* Can extend an isometry from unit sphere. *) +(* ------------------------------------------------------------------------- *) + +let ISOMETRY_SPHERE_EXTEND = prove + (`!f:real^N->real^N. + (!x. norm(x) = &1 ==> norm(f x) = &1) /\ + (!x y. norm(x) = &1 /\ norm(y) = &1 ==> dist(f x,f y) = dist(x,y)) + ==> ?g. orthogonal_transformation g /\ + (!x. norm(x) = &1 ==> g(x) = f(x))`, + let lemma = prove + (`!x:real^N y:real^N x':real^N y':real^N x0 y0 x0' y0'. + x = norm(x) % x0 /\ y = norm(y) % y0 /\ + x' = norm(x) % x0' /\ y' = norm(y) % y0' /\ + norm(x0) = &1 /\ norm(x0') = &1 /\ norm(y0) = &1 /\ norm(y0') = &1 /\ + norm(x0' - y0') = norm(x0 - y0) + ==> norm(x' - y') = norm(x - y)`, + REPEAT GEN_TAC THEN + MAP_EVERY ABBREV_TAC [`a = norm(x:real^N)`; `b = norm(y:real^N)`] THEN + REPLICATE_TAC 4 (DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + ASM_REWRITE_TAC[] THEN REWRITE_TAC[NORM_EQ; NORM_EQ_1] THEN + REWRITE_TAC[DOT_LSUB; DOT_RSUB; DOT_LMUL; DOT_RMUL] THEN + REWRITE_TAC[DOT_SYM] THEN CONV_TAC REAL_RING) in + REPEAT STRIP_TAC THEN + EXISTS_TAC `\x. if x = vec 0 then vec 0 + else norm(x) % (f:real^N->real^N)(inv(norm x) % x)` THEN + REWRITE_TAC[ORTHOGONAL_TRANSFORMATION_ISOMETRY] THEN + SIMP_TAC[VECTOR_MUL_LID; REAL_INV_1] THEN CONJ_TAC THENL + [ALL_TAC; MESON_TAC[NORM_0; REAL_ARITH `~(&1 = &0)`]] THEN + REPEAT GEN_TAC THEN REPEAT(COND_CASES_TAC THEN ASM_REWRITE_TAC[]) THEN + REWRITE_TAC[dist; VECTOR_SUB_LZERO; VECTOR_SUB_RZERO; NORM_NEG; NORM_MUL; + REAL_ABS_NORM] THEN + ONCE_REWRITE_TAC[REAL_MUL_SYM] THEN + ASM_SIMP_TAC[GSYM REAL_EQ_RDIV_EQ; NORM_POS_LT] THEN + ASM_SIMP_TAC[REAL_DIV_REFL; REAL_LT_IMP_NZ; NORM_EQ_0] THEN + TRY(FIRST_X_ASSUM MATCH_MP_TAC) THEN + REWRITE_TAC[NORM_MUL; REAL_ABS_INV; REAL_ABS_NORM] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; NORM_EQ_0] THEN + MATCH_MP_TAC lemma THEN MAP_EVERY EXISTS_TAC + [`inv(norm x) % x:real^N`; `inv(norm y) % y:real^N`; + `(f:real^N->real^N) (inv (norm x) % x)`; + `(f:real^N->real^N) (inv (norm y) % y)`] THEN + REWRITE_TAC[NORM_MUL; VECTOR_MUL_ASSOC; REAL_ABS_INV; REAL_ABS_NORM] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_MUL_RINV; NORM_EQ_0] THEN + ASM_REWRITE_TAC[GSYM dist; VECTOR_MUL_LID] THEN + REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[NORM_MUL; VECTOR_MUL_ASSOC; REAL_ABS_INV; REAL_ABS_NORM] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_MUL_RINV; NORM_EQ_0]);; + +let ORTHOGONAL_TRANSFORMATION_LINEAR = prove + (`!f:real^N->real^N. orthogonal_transformation f ==> linear f`, + SIMP_TAC[orthogonal_transformation]);; + +let ORTHOGONAL_TRANSFORMATION_INJECTIVE = prove + (`!f:real^N->real^N. + orthogonal_transformation f ==> !x y. f x = f y ==> x = y`, + SIMP_TAC[LINEAR_INJECTIVE_0; ORTHOGONAL_TRANSFORMATION; GSYM NORM_EQ_0]);; + +let ORTHOGONAL_TRANSFORMATION_SURJECTIVE = prove + (`!f:real^N->real^N. + orthogonal_transformation f ==> !y. ?x. f x = y`, + MESON_TAC[LINEAR_INJECTIVE_IMP_SURJECTIVE; + ORTHOGONAL_TRANSFORMATION_INJECTIVE; orthogonal_transformation]);; + +let ORTHOGONAL_TRANSFORMATION_INVERSE_o = prove + (`!f:real^N->real^N. + orthogonal_transformation f + ==> ?g. orthogonal_transformation g /\ g o f = I /\ f o g = I`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP ORTHOGONAL_TRANSFORMATION_LINEAR) THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP ORTHOGONAL_TRANSFORMATION_INJECTIVE) THEN + MP_TAC(ISPEC `f:real^N->real^N` LINEAR_INJECTIVE_LEFT_INVERSE) THEN + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC MONO_EXISTS THEN + X_GEN_TAC `g:real^N->real^N` THEN STRIP_TAC THEN + MP_TAC(ISPECL [`f:real^N->real^N`; `g:real^N->real^N`] + LINEAR_INVERSE_LEFT) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_REWRITE_TAC[ORTHOGONAL_TRANSFORMATION] THEN X_GEN_TAC `v:real^N` THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `norm((f:real^N->real^N)((g:real^N->real^N) v))` THEN + CONJ_TAC THENL [ASM_MESON_TAC[ORTHOGONAL_TRANSFORMATION]; ALL_TAC] THEN + RULE_ASSUM_TAC(REWRITE_RULE[FUN_EQ_THM; o_THM; I_THM]) THEN + ASM_REWRITE_TAC[]);; + +let ORTHOGONAL_TRANSFORMATION_INVERSE = prove + (`!f:real^N->real^N. + orthogonal_transformation f + ==> ?g. orthogonal_transformation g /\ + (!x. g(f x) = x) /\ (!y. f(g y) = y)`, + GEN_TAC THEN + DISCH_THEN(MP_TAC o MATCH_MP ORTHOGONAL_TRANSFORMATION_INVERSE_o) THEN + REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM]);; + +let ORTHOGONAL_TRANSFORMATION_ID = prove + (`orthogonal_transformation(\x. x)`, + REWRITE_TAC[orthogonal_transformation; LINEAR_ID]);; + +let ORTHOGONAL_TRANSFORMATION_I = prove + (`orthogonal_transformation I`, + REWRITE_TAC[I_DEF; ORTHOGONAL_TRANSFORMATION_ID]);; + +(* ------------------------------------------------------------------------- *) +(* We can find an orthogonal matrix taking any unit vector to any other. *) +(* ------------------------------------------------------------------------- *) + +let FINITE_INDEX_NUMSEG_SPECIAL = prove + (`!s a:A. + FINITE s /\ a IN s + ==> ?f. (!i j. i IN 1..CARD s /\ j IN 1..CARD s /\ f i = f j + ==> i = j) /\ + s = IMAGE f (1..CARD s) /\ + f 1 = a`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM(MP_TAC o GEN_REWRITE_RULE I [FINITE_INDEX_NUMSEG]) THEN + DISCH_THEN(X_CHOOSE_THEN `f:num->A` STRIP_ASSUME_TAC) THEN + SUBGOAL_THEN `?k. k IN 1..CARD(s:A->bool) /\ (a:A) = f k` + STRIP_ASSUME_TAC THENL[ASM SET_TAC[]; ALL_TAC] THEN + EXISTS_TAC `(f:num->A) o swap(1,k)` THEN + SUBGOAL_THEN `1 IN 1..CARD(s:A->bool)` ASSUME_TAC THENL + [REWRITE_TAC[IN_NUMSEG; LE_REFL; ARITH_RULE `1 <= x <=> ~(x = 0)`] THEN + ASM_SIMP_TAC[CARD_EQ_0; ARITH_EQ] THEN ASM SET_TAC[]; + ALL_TAC] THEN + ASM_REWRITE_TAC[o_THM; swap] THEN + CONJ_TAC THENL [ASM SET_TAC[]; ALL_TAC] THEN + UNDISCH_THEN `s = IMAGE (f:num->A) (1..CARD(s:A->bool))` + (fun th -> GEN_REWRITE_TAC LAND_CONV [th]) THEN + REWRITE_TAC[EXTENSION; IN_IMAGE; o_THM] THEN + X_GEN_TAC `b:A` THEN EQ_TAC THEN + DISCH_THEN(X_CHOOSE_THEN `i:num` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `swap(1,k) i` THEN + REWRITE_TAC[swap] THEN ASM_MESON_TAC[swap]);; + +let ORTHOGONAL_MATRIX_EXISTS_BASIS = prove + (`!a:real^N. + norm(a) = &1 + ==> ?A. orthogonal_matrix A /\ A**(basis 1) = a`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM(MP_TAC o MATCH_MP VECTOR_IN_ORTHONORMAL_BASIS) THEN + REWRITE_TAC[HAS_SIZE] THEN + DISCH_THEN(X_CHOOSE_THEN `s:real^N->bool` STRIP_ASSUME_TAC) THEN + MP_TAC(ISPECL [`s:real^N->bool`; `a:real^N`] + FINITE_INDEX_NUMSEG_SPECIAL) THEN ASM_REWRITE_TAC[IN_NUMSEG] THEN + REWRITE_TAC[TAUT `a /\ b ==> c <=> c \/ ~a \/ ~b`] THEN + DISCH_THEN(X_CHOOSE_THEN `f:num->real^N` + (CONJUNCTS_THEN2 ASSUME_TAC (CONJUNCTS_THEN2 (ASSUME_TAC o SYM) + ASSUME_TAC))) THEN + EXISTS_TAC `(lambda i j. ((f j):real^N)$i):real^N^N` THEN + SIMP_TAC[CART_EQ; LAMBDA_BETA; matrix_vector_mul; BASIS_COMPONENT; + IN_NUMSEG] THEN + ONCE_REWRITE_TAC[COND_RAND] THEN SIMP_TAC[REAL_MUL_RZERO; SUM_DELTA] THEN + ASM_REWRITE_TAC[IN_NUMSEG; REAL_MUL_RID; LE_REFL; DIMINDEX_GE_1] THEN + REWRITE_TAC[ORTHOGONAL_MATRIX_ORTHONORMAL_COLUMNS] THEN + SIMP_TAC[column; LAMBDA_BETA] THEN CONJ_TAC THENL + [X_GEN_TAC `i:num` THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `norm((f:num->real^N) i)` THEN CONJ_TAC THENL + [AP_TERM_TAC THEN ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA]; + ASM_MESON_TAC[IN_IMAGE; IN_NUMSEG]]; + MAP_EVERY X_GEN_TAC [`i:num`; `j:num`] THEN STRIP_TAC THEN + SUBGOAL_THEN `orthogonal ((f:num->real^N) i) (f j)` MP_TAC THENL + [ASM_MESON_TAC[pairwise; IN_IMAGE; IN_NUMSEG]; ALL_TAC] THEN + MATCH_MP_TAC EQ_IMP THEN BINOP_TAC THEN + ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA]]);; + +let ORTHOGONAL_TRANSFORMATION_EXISTS_1 = prove + (`!a b:real^N. + norm(a) = &1 /\ norm(b) = &1 + ==> ?f. orthogonal_transformation f /\ f a = b`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPEC `b:real^N` ORTHOGONAL_MATRIX_EXISTS_BASIS) THEN + MP_TAC(ISPEC `a:real^N` ORTHOGONAL_MATRIX_EXISTS_BASIS) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN(X_CHOOSE_THEN `A:real^N^N` (STRIP_ASSUME_TAC o GSYM)) THEN + DISCH_THEN(X_CHOOSE_THEN `B:real^N^N` (STRIP_ASSUME_TAC o GSYM)) THEN + EXISTS_TAC `\x:real^N. ((B:real^N^N) ** transp(A:real^N^N)) ** x` THEN + REWRITE_TAC[ORTHOGONAL_TRANSFORMATION_MATRIX; MATRIX_VECTOR_MUL_LINEAR; + MATRIX_OF_MATRIX_VECTOR_MUL] THEN + ASM_SIMP_TAC[ORTHOGONAL_MATRIX_MUL; ORTHOGONAL_MATRIX_TRANSP] THEN + REWRITE_TAC[GSYM MATRIX_VECTOR_MUL_ASSOC] THEN AP_TERM_TAC THEN + RULE_ASSUM_TAC(REWRITE_RULE[ORTHOGONAL_MATRIX]) THEN + ASM_REWRITE_TAC[MATRIX_VECTOR_MUL_ASSOC; MATRIX_VECTOR_MUL_LID]);; + +let ORTHOGONAL_TRANSFORMATION_EXISTS = prove + (`!a b:real^N. + norm(a) = norm(b) ==> ?f. orthogonal_transformation f /\ f a = b`, + REPEAT GEN_TAC THEN ASM_CASES_TAC `b:real^N = vec 0` THEN + ASM_SIMP_TAC[NORM_0; NORM_EQ_0] THENL + [MESON_TAC[ORTHOGONAL_TRANSFORMATION_ID]; ALL_TAC] THEN + ASM_CASES_TAC `a:real^N = vec 0` THENL + [ASM_MESON_TAC[NORM_0; NORM_EQ_0]; ALL_TAC] THEN + DISCH_TAC THEN + MP_TAC(ISPECL [`inv(norm a) % a:real^N`; `inv(norm b) % b:real^N`] + ORTHOGONAL_TRANSFORMATION_EXISTS_1) THEN + REWRITE_TAC[NORM_MUL; REAL_ABS_INV; REAL_ABS_NORM] THEN + ASM_SIMP_TAC[NORM_EQ_0; REAL_MUL_LINV] THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `f:real^N->real^N` THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + ASM_REWRITE_TAC[] THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP LINEAR_CMUL o + MATCH_MP ORTHOGONAL_TRANSFORMATION_LINEAR) THEN + ASM_REWRITE_TAC[VECTOR_ARITH + `a % x:real^N = a % y <=> a % (x - y) = vec 0`] THEN + ASM_REWRITE_TAC[VECTOR_MUL_EQ_0; REAL_INV_EQ_0; NORM_EQ_0; VECTOR_SUB_EQ]);; + +(* ------------------------------------------------------------------------- *) +(* Rotation, reflection, rotoinversion. *) +(* ------------------------------------------------------------------------- *) + +let rotation_matrix = new_definition + `rotation_matrix Q <=> orthogonal_matrix Q /\ det(Q) = &1`;; + +let rotoinversion_matrix = new_definition + `rotoinversion_matrix Q <=> orthogonal_matrix Q /\ det(Q) = -- &1`;; + +let ORTHOGONAL_ROTATION_OR_ROTOINVERSION = prove + (`!Q. orthogonal_matrix Q <=> rotation_matrix Q \/ rotoinversion_matrix Q`, + MESON_TAC[rotation_matrix; rotoinversion_matrix; DET_ORTHOGONAL_MATRIX]);; + +let ROTATION_MATRIX_2 = prove + (`!A:real^2^2. rotation_matrix A <=> + A$1$1 pow 2 + A$2$1 pow 2 = &1 /\ + A$1$1 = A$2$2 /\ A$1$2 = --(A$2$1)`, + REWRITE_TAC[rotation_matrix; ORTHOGONAL_MATRIX_2; DET_2] THEN + CONV_TAC REAL_RING);; + +(* ------------------------------------------------------------------------- *) +(* Slightly stronger results giving rotation, but only in >= 2 dimensions. *) +(* ------------------------------------------------------------------------- *) + +let ROTATION_MATRIX_EXISTS_BASIS = prove + (`!a:real^N. + 2 <= dimindex(:N) /\ norm(a) = &1 + ==> ?A. rotation_matrix A /\ A**(basis 1) = a`, + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM(X_CHOOSE_THEN `A:real^N^N` STRIP_ASSUME_TAC o + MATCH_MP ORTHOGONAL_MATRIX_EXISTS_BASIS) THEN + FIRST_ASSUM(DISJ_CASES_TAC o GEN_REWRITE_RULE I + [ORTHOGONAL_ROTATION_OR_ROTOINVERSION]) + THENL [ASM_MESON_TAC[]; ALL_TAC] THEN + EXISTS_TAC `transp(lambda i. if i = dimindex(:N) then -- &1 % transp A$i + else (transp A:real^N^N)$i):real^N^N` THEN + REWRITE_TAC[rotation_matrix; DET_TRANSP] THEN REPEAT CONJ_TAC THENL + [REWRITE_TAC[ORTHOGONAL_MATRIX_TRANSP]; + SIMP_TAC[DET_ROW_MUL; DIMINDEX_GE_1; LE_REFL] THEN + MATCH_MP_TAC(REAL_ARITH `x = -- &1 ==> -- &1 * x = &1`) THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [rotoinversion_matrix]) THEN + DISCH_THEN(SUBST1_TAC o SYM o CONJUNCT2) THEN + GEN_REWRITE_TAC RAND_CONV [GSYM DET_TRANSP] THEN + AP_TERM_TAC THEN SIMP_TAC[CART_EQ; LAMBDA_BETA] THEN MESON_TAC[]; + FIRST_X_ASSUM(SUBST1_TAC o SYM) THEN + SIMP_TAC[matrix_vector_mul; LAMBDA_BETA; CART_EQ; transp; + BASIS_COMPONENT] THEN + ONCE_REWRITE_TAC[REAL_ARITH + `x * (if p then &1 else &0) = if p then x else &0`] THEN + ASM_SIMP_TAC[ARITH_RULE `2 <= n ==> ~(1 = n)`; LAMBDA_BETA]] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I + [GSYM ORTHOGONAL_MATRIX_TRANSP]) THEN + SPEC_TAC(`transp(A:real^N^N)`,`B:real^N^N`) THEN GEN_TAC THEN + SUBGOAL_THEN `!i. 1 <= i /\ i <= dimindex(:N) + ==> row i ((lambda i. if i = dimindex(:N) then -- &1 % B$i + else (B:real^N^N)$i):real^N^N) = + if i = dimindex(:N) then --(row i B) else row i B` + ASSUME_TAC THENL + [SIMP_TAC[row; LAMBDA_BETA; LAMBDA_ETA; VECTOR_MUL_LID; VECTOR_MUL_LNEG]; + ASM_SIMP_TAC[ORTHOGONAL_MATRIX_ORTHONORMAL_ROWS] THEN + ASM_MESON_TAC[ORTHOGONAL_LNEG; ORTHOGONAL_RNEG; NORM_NEG]]);; + +let ROTATION_EXISTS_1 = prove + (`!a b:real^N. + 2 <= dimindex(:N) /\ norm(a) = &1 /\ norm(b) = &1 + ==> ?f. orthogonal_transformation f /\ det(matrix f) = &1 /\ f a = b`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPEC `b:real^N` ROTATION_MATRIX_EXISTS_BASIS) THEN + MP_TAC(ISPEC `a:real^N` ROTATION_MATRIX_EXISTS_BASIS) THEN + ASM_REWRITE_TAC[rotation_matrix] THEN + DISCH_THEN(X_CHOOSE_THEN `A:real^N^N` + (CONJUNCTS_THEN2 STRIP_ASSUME_TAC (ASSUME_TAC o SYM))) THEN + DISCH_THEN(X_CHOOSE_THEN `B:real^N^N` + (CONJUNCTS_THEN2 STRIP_ASSUME_TAC (ASSUME_TAC o SYM))) THEN + EXISTS_TAC `\x:real^N. ((B:real^N^N) ** transp(A:real^N^N)) ** x` THEN + REWRITE_TAC[ORTHOGONAL_TRANSFORMATION_MATRIX; MATRIX_VECTOR_MUL_LINEAR; + MATRIX_OF_MATRIX_VECTOR_MUL; DET_MUL; DET_TRANSP] THEN + ASM_SIMP_TAC[ORTHOGONAL_MATRIX_MUL; ORTHOGONAL_MATRIX_TRANSP] THEN + REWRITE_TAC[GSYM MATRIX_VECTOR_MUL_ASSOC; REAL_MUL_LID] THEN AP_TERM_TAC THEN + RULE_ASSUM_TAC(REWRITE_RULE[ORTHOGONAL_MATRIX]) THEN + ASM_REWRITE_TAC[MATRIX_VECTOR_MUL_ASSOC; MATRIX_VECTOR_MUL_LID]);; + +let ROTATION_EXISTS = prove + (`!a b:real^N. + 2 <= dimindex(:N) /\ norm(a) = norm(b) + ==> ?f. orthogonal_transformation f /\ det(matrix f) = &1 /\ f a = b`, + REPEAT GEN_TAC THEN ASM_CASES_TAC `b:real^N = vec 0` THEN + ASM_SIMP_TAC[NORM_0; NORM_EQ_0] THENL + [MESON_TAC[ORTHOGONAL_TRANSFORMATION_ID; MATRIX_ID; DET_I]; ALL_TAC] THEN + ASM_CASES_TAC `a:real^N = vec 0` THENL + [ASM_MESON_TAC[ORTHOGONAL_TRANSFORMATION_ID; MATRIX_ID; DET_I; NORM_0; + NORM_EQ_0]; ALL_TAC] THEN + DISCH_TAC THEN + MP_TAC(ISPECL [`inv(norm a) % a:real^N`; `inv(norm b) % b:real^N`] + ROTATION_EXISTS_1) THEN + REWRITE_TAC[NORM_MUL; REAL_ABS_INV; REAL_ABS_NORM] THEN + ASM_SIMP_TAC[NORM_EQ_0; REAL_MUL_LINV] THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `f:real^N->real^N` THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + ASM_REWRITE_TAC[] THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP LINEAR_CMUL o + MATCH_MP ORTHOGONAL_TRANSFORMATION_LINEAR) THEN + ASM_REWRITE_TAC[VECTOR_ARITH + `a % x:real^N = a % y <=> a % (x - y) = vec 0`] THEN + ASM_REWRITE_TAC[VECTOR_MUL_EQ_0; REAL_INV_EQ_0; NORM_EQ_0; VECTOR_SUB_EQ]);; + +let ROTATION_RIGHTWARD_LINE = prove + (`!a:real^N k. + 1 <= k /\ k <= dimindex(:N) + ==> ?b f. orthogonal_transformation f /\ + (2 <= dimindex(:N) ==> det(matrix f) = &1) /\ + f(b % basis k) = a /\ + &0 <= b`, + REPEAT STRIP_TAC THEN EXISTS_TAC `norm(a:real^N)` THEN + ASM_SIMP_TAC[VECTOR_MUL_COMPONENT; BASIS_COMPONENT; LE_REFL; DIMINDEX_GE_1; + REAL_MUL_RID; NORM_POS_LE; LT_IMP_LE; LTE_ANTISYM] THEN + REWRITE_TAC[ARITH_RULE `2 <= n <=> 1 <= n /\ ~(n = 1)`; DIMINDEX_GE_1] THEN + ASM_CASES_TAC `dimindex(:N) = 1` THEN ASM_REWRITE_TAC[] THENL + [MATCH_MP_TAC ORTHOGONAL_TRANSFORMATION_EXISTS; + MATCH_MP_TAC ROTATION_EXISTS] THEN + ASM_SIMP_TAC[NORM_MUL; NORM_BASIS; LE_REFL; DIMINDEX_GE_1] THEN + REWRITE_TAC[REAL_ABS_NORM; REAL_MUL_RID] THEN + MATCH_MP_TAC(ARITH_RULE `~(n = 1) /\ 1 <= n ==> 2 <= n`) THEN + ASM_REWRITE_TAC[DIMINDEX_GE_1]);; + +(* ------------------------------------------------------------------------- *) +(* We can always rotate so that a hyperplane is "horizontal". *) +(* ------------------------------------------------------------------------- *) + +let ROTATION_LOWDIM_HORIZONTAL = prove + (`!s:real^N->bool. + dim s < dimindex(:N) + ==> ?f. orthogonal_transformation f /\ det(matrix f) = &1 /\ + (IMAGE f s) SUBSET {z | z$(dimindex(:N)) = &0}`, + GEN_TAC THEN ASM_CASES_TAC `dim(s:real^N->bool) = 0` THENL + [RULE_ASSUM_TAC(REWRITE_RULE[DIM_EQ_0]) THEN DISCH_TAC THEN + EXISTS_TAC `\x:real^N. x` THEN + REWRITE_TAC[ORTHOGONAL_TRANSFORMATION_ID; MATRIX_ID; DET_I] THEN + FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (SET_RULE + `s SUBSET {a} ==> a IN t ==> IMAGE (\x. x) s SUBSET t`)) THEN + SIMP_TAC[IN_ELIM_THM; VEC_COMPONENT; LE_REFL; DIMINDEX_GE_1]; + DISCH_TAC] THEN + SUBGOAL_THEN `2 <= dimindex(:N)` ASSUME_TAC THENL + [ASM_ARITH_TAC; ALL_TAC] THEN + FIRST_X_ASSUM(X_CHOOSE_THEN `a:real^N` STRIP_ASSUME_TAC o MATCH_MP + LOWDIM_SUBSET_HYPERPLANE) THEN + MP_TAC(ISPECL [`a:real^N`; `norm(a:real^N) % basis(dimindex(:N)):real^N`] + ROTATION_EXISTS) THEN + ASM_SIMP_TAC[NORM_MUL; NORM_BASIS; LE_REFL; DIMINDEX_GE_1] THEN + REWRITE_TAC[REAL_ABS_NORM; REAL_MUL_RID] THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `f:real^N->real^N` THEN + STRIP_TAC THEN ASM_REWRITE_TAC[FORALL_IN_IMAGE; SUBSET; IN_ELIM_THM] THEN + X_GEN_TAC `x:real^N` THEN DISCH_TAC THEN + SUBGOAL_THEN `(f:real^N->real^N) x dot (f a) = &0` MP_TAC THENL + [RULE_ASSUM_TAC(REWRITE_RULE[orthogonal_transformation]) THEN + ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[DOT_SYM] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [SUBSET]) THEN + ASM_SIMP_TAC[SPAN_SUPERSET; IN_ELIM_THM]; + ASM_SIMP_TAC[DOT_BASIS; LE_REFL; DIMINDEX_GE_1; DOT_RMUL] THEN + ASM_REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0]]);; + +let ORTHOGONAL_TRANSFORMATION_LOWDIM_HORIZONTAL = prove + (`!s:real^N->bool. + dim s < dimindex(:N) + ==> ?f. orthogonal_transformation f /\ + (IMAGE f s) SUBSET {z | z$(dimindex(:N)) = &0}`, + GEN_TAC THEN DISCH_THEN(MP_TAC o MATCH_MP ROTATION_LOWDIM_HORIZONTAL) THEN + MATCH_MP_TAC MONO_EXISTS THEN SIMP_TAC[]);; + +(* ------------------------------------------------------------------------- *) +(* Extract scaling, translation and linear invariance theorems. *) +(* For the linear case, chain through some basic consequences automatically, *) +(* e.g. norm-preserving and linear implies injective. *) +(* ------------------------------------------------------------------------- *) + +let SCALING_THEOREMS v = + let th1 = UNDISCH(snd(EQ_IMP_RULE(ISPEC v NORM_POS_LT))) in + let t = rand(concl th1) in + end_itlist CONJ (map (C MP th1 o SPEC t) (!scaling_theorems));; + +let TRANSLATION_INVARIANTS x = + end_itlist CONJ (mapfilter (ISPEC x) (!invariant_under_translation));; + +let USABLE_CONCLUSION f ths th = + let ith = PURE_REWRITE_RULE[RIGHT_FORALL_IMP_THM] (ISPEC f th) in + let bod = concl ith in + let cjs = conjuncts(fst(dest_imp bod)) in + let ths = map (fun t -> find(fun th -> aconv (concl th) t) ths) cjs in + GEN_ALL(MP ith (end_itlist CONJ ths));; + +let LINEAR_INVARIANTS = + let sths = (CONJUNCTS o prove) + (`(!f:real^M->real^N. + linear f /\ (!x. norm(f x) = norm x) + ==> (!x y. f x = f y ==> x = y)) /\ + (!f:real^N->real^N. + linear f /\ (!x. norm(f x) = norm x) ==> (!y. ?x. f x = y)) /\ + (!f:real^N->real^N. linear f /\ (!x y. f x = f y ==> x = y) + ==> (!y. ?x. f x = y)) /\ + (!f:real^N->real^N. linear f /\ (!y. ?x. f x = y) + ==> (!x y. f x = f y ==> x = y))`, + CONJ_TAC THENL + [ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN + SIMP_TAC[GSYM LINEAR_SUB; GSYM NORM_EQ_0]; + MESON_TAC[ORTHOGONAL_TRANSFORMATION_SURJECTIVE; + ORTHOGONAL_TRANSFORMATION_INJECTIVE; ORTHOGONAL_TRANSFORMATION; + LINEAR_SURJECTIVE_IFF_INJECTIVE]]) in + fun f ths -> + let ths' = ths @ mapfilter (USABLE_CONCLUSION f ths) sths in + end_itlist CONJ + (mapfilter (USABLE_CONCLUSION f ths') (!invariant_under_linear));; + +(* ------------------------------------------------------------------------- *) +(* Tactic to pick WLOG a particular point as the origin. The conversion form *) +(* assumes it's the outermost universal variable; the tactic is more general *) +(* and allows any free or outer universally quantified variable. The list *) +(* "avoid" is the points not to translate. There is also a tactic to help in *) +(* proving new translation theorems, which uses similar machinery. *) +(* ------------------------------------------------------------------------- *) + +let GEOM_ORIGIN_CONV,GEOM_TRANSLATE_CONV = + let pth = prove + (`!a:real^N. a = a + vec 0 /\ + {} = IMAGE (\x. a + x) {} /\ + {} = IMAGE (IMAGE (\x. a + x)) {} /\ + (:real^N) = IMAGE (\x. a + x) (:real^N) /\ + (:real^N->bool) = IMAGE (IMAGE (\x. a + x)) (:real^N->bool) /\ + [] = MAP (\x. a + x) []`, + REWRITE_TAC[IMAGE_CLAUSES; VECTOR_ADD_RID; MAP] THEN + REWRITE_TAC[SET_RULE `UNIV = IMAGE f UNIV <=> !y. ?x. f x = y`] THEN + REWRITE_TAC[SURJECTIVE_IMAGE] THEN + REWRITE_TAC[VECTOR_ARITH `a + y:real^N = x <=> y = x - a`; EXISTS_REFL]) + and qth = prove + (`!a:real^N. + ((!P. (!x. P x) <=> (!x. P (a + x))) /\ + (!P. (?x. P x) <=> (?x. P (a + x))) /\ + (!Q. (!s. Q s) <=> (!s. Q(IMAGE (\x. a + x) s))) /\ + (!Q. (?s. Q s) <=> (?s. Q(IMAGE (\x. a + x) s))) /\ + (!Q. (!s. Q s) <=> (!s. Q(IMAGE (IMAGE (\x. a + x)) s))) /\ + (!Q. (?s. Q s) <=> (?s. Q(IMAGE (IMAGE (\x. a + x)) s))) /\ + (!P. (!g:real^1->real^N. P g) <=> (!g. P ((\x. a + x) o g))) /\ + (!P. (?g:real^1->real^N. P g) <=> (?g. P ((\x. a + x) o g))) /\ + (!P. (!g:num->real^N. P g) <=> (!g. P ((\x. a + x) o g))) /\ + (!P. (?g:num->real^N. P g) <=> (?g. P ((\x. a + x) o g))) /\ + (!Q. (!l. Q l) <=> (!l. Q(MAP (\x. a + x) l))) /\ + (!Q. (?l. Q l) <=> (?l. Q(MAP (\x. a + x) l)))) /\ + ((!P. {x | P x} = IMAGE (\x. a + x) {x | P(a + x)}) /\ + (!Q. {s | Q s} = + IMAGE (IMAGE (\x. a + x)) {s | Q(IMAGE (\x. a + x) s)}) /\ + (!R. {l | R l} = IMAGE (MAP (\x. a + x)) {l | R(MAP (\x. a + x) l)}))`, + GEN_TAC THEN MATCH_MP_TAC QUANTIFY_SURJECTION_HIGHER_THM THEN + X_GEN_TAC `y:real^N` THEN EXISTS_TAC `y - a:real^N` THEN + VECTOR_ARITH_TAC) in + let GEOM_ORIGIN_CONV avoid tm = + let x,tm0 = dest_forall tm in + let th0 = ISPEC x pth in + let x' = genvar(type_of x) in + let ith = ISPEC x' qth in + let th1 = PARTIAL_EXPAND_QUANTS_CONV avoid (ASSUME(concl ith)) tm0 in + let th2 = CONV_RULE(RAND_CONV(SUBS_CONV(CONJUNCTS th0))) th1 in + let th3 = INST[x,x'] (PROVE_HYP ith th2) in + let ths = TRANSLATION_INVARIANTS x in + let thr = REFL x in + let th4 = GEN_REWRITE_RULE (RAND_CONV o REDEPTH_CONV) + [BETA_THM;ADD_ASSUM(concl thr) ths] th3 in + let th5 = MK_FORALL x (PROVE_HYP thr th4) in + GEN_REWRITE_RULE (RAND_CONV o TRY_CONV) [FORALL_SIMP] th5 + and GEOM_TRANSLATE_CONV avoid a tm = + let cth = CONJUNCT2(ISPEC a pth) + and vth = ISPEC a qth in + let th1 = PARTIAL_EXPAND_QUANTS_CONV avoid (ASSUME(concl vth)) tm in + let th2 = CONV_RULE(RAND_CONV(SUBS_CONV(CONJUNCTS cth))) th1 in + let th3 = PROVE_HYP vth th2 in + let ths = TRANSLATION_INVARIANTS a in + let thr = REFL a in + let th4 = GEN_REWRITE_RULE (RAND_CONV o REDEPTH_CONV) + [BETA_THM;ADD_ASSUM(concl thr) ths] th3 in + PROVE_HYP thr th4 in + GEOM_ORIGIN_CONV,GEOM_TRANSLATE_CONV;; + +let GEN_GEOM_ORIGIN_TAC x avoid (asl,w as gl) = + let avs,bod = strip_forall w + and avs' = subtract (frees w) (freesl(map (concl o snd) asl)) in + (MAP_EVERY X_GEN_TAC avs THEN + MAP_EVERY (fun t -> SPEC_TAC(t,t)) (rev(subtract (avs@avs') [x])) THEN + SPEC_TAC(x,x) THEN CONV_TAC(GEOM_ORIGIN_CONV avoid)) gl;; + +let GEOM_ORIGIN_TAC x = GEN_GEOM_ORIGIN_TAC x [];; + +let GEOM_TRANSLATE_TAC avoid (asl,w) = + let a,bod = dest_forall w in + let n = length(fst(strip_forall bod)) in + (X_GEN_TAC a THEN + CONV_TAC(funpow n BINDER_CONV (LAND_CONV(GEOM_TRANSLATE_CONV avoid a))) THEN + REWRITE_TAC[]) (asl,w);; + +(* ------------------------------------------------------------------------- *) +(* Rename existential variables in conclusion to fresh genvars. *) +(* ------------------------------------------------------------------------- *) + +let EXISTS_GENVAR_RULE = + let rec rule vs th = + match vs with + [] -> th + | v::ovs -> let x,bod = dest_exists(concl th) in + let th1 = rule ovs (ASSUME bod) in + let th2 = SIMPLE_CHOOSE x (SIMPLE_EXISTS x th1) in + PROVE_HYP th (CONV_RULE (GEN_ALPHA_CONV v) th2) in + fun th -> rule (map (genvar o type_of) (fst(strip_exists(concl th)))) th;; + +(* ------------------------------------------------------------------------- *) +(* Rotate so that WLOG some point is a +ve multiple of basis vector k. *) +(* For general N, it's better to use k = 1 so the side-condition can be *) +(* discharged. For dimensions 1, 2 and 3 anything will work automatically. *) +(* Could generalize by asking the user to prove theorem 1 <= k <= N. *) +(* ------------------------------------------------------------------------- *) + +let GEOM_BASIS_MULTIPLE_RULE = + let pth = prove + (`!f. orthogonal_transformation (f:real^N->real^N) + ==> (vec 0 = f(vec 0) /\ + {} = IMAGE f {} /\ + {} = IMAGE (IMAGE f) {} /\ + (:real^N) = IMAGE f (:real^N) /\ + (:real^N->bool) = IMAGE (IMAGE f) (:real^N->bool) /\ + [] = MAP f []) /\ + ((!P. (!x. P x) <=> (!x. P (f x))) /\ + (!P. (?x. P x) <=> (?x. P (f x))) /\ + (!Q. (!s. Q s) <=> (!s. Q (IMAGE f s))) /\ + (!Q. (?s. Q s) <=> (?s. Q (IMAGE f s))) /\ + (!Q. (!s. Q s) <=> (!s. Q (IMAGE (IMAGE f) s))) /\ + (!Q. (?s. Q s) <=> (?s. Q (IMAGE (IMAGE f) s))) /\ + (!P. (!g:real^1->real^N. P g) <=> (!g. P (f o g))) /\ + (!P. (?g:real^1->real^N. P g) <=> (?g. P (f o g))) /\ + (!P. (!g:num->real^N. P g) <=> (!g. P (f o g))) /\ + (!P. (?g:num->real^N. P g) <=> (?g. P (f o g))) /\ + (!Q. (!l. Q l) <=> (!l. Q(MAP f l))) /\ + (!Q. (?l. Q l) <=> (?l. Q(MAP f l)))) /\ + ((!P. {x | P x} = IMAGE f {x | P(f x)}) /\ + (!Q. {s | Q s} = IMAGE (IMAGE f) {s | Q(IMAGE f s)}) /\ + (!R. {l | R l} = IMAGE (MAP f) {l | R(MAP f l)}))`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + FIRST_ASSUM(ASSUME_TAC o + MATCH_MP ORTHOGONAL_TRANSFORMATION_SURJECTIVE) THEN + CONJ_TAC THENL + [REWRITE_TAC[IMAGE_CLAUSES; MAP] THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP ORTHOGONAL_TRANSFORMATION_LINEAR) THEN + CONJ_TAC THENL [ASM_MESON_TAC[LINEAR_0]; ALL_TAC] THEN + REWRITE_TAC[SET_RULE `UNIV = IMAGE f UNIV <=> !y. ?x. f x = y`] THEN + ASM_REWRITE_TAC[SURJECTIVE_IMAGE]; + MATCH_MP_TAC QUANTIFY_SURJECTION_HIGHER_THM THEN ASM_REWRITE_TAC[]]) + and oth = prove + (`!f:real^N->real^N. + orthogonal_transformation f /\ + (2 <= dimindex(:N) ==> det(matrix f) = &1) + ==> linear f /\ + (!x y. f x = f y ==> x = y) /\ + (!y. ?x. f x = y) /\ + (!x. norm(f x) = norm x) /\ + (2 <= dimindex(:N) ==> det(matrix f) = &1)`, + GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT CONJ_TAC THENL + [ASM_SIMP_TAC[ORTHOGONAL_TRANSFORMATION_LINEAR]; + ASM_MESON_TAC[ORTHOGONAL_TRANSFORMATION_INJECTIVE]; + ASM_MESON_TAC[ORTHOGONAL_TRANSFORMATION_SURJECTIVE]; + ASM_MESON_TAC[ORTHOGONAL_TRANSFORMATION]]) + and arithconv = REWRITE_CONV[DIMINDEX_1; DIMINDEX_2; DIMINDEX_3; + ARITH_RULE `1 <= 1`; DIMINDEX_GE_1] THENC + NUM_REDUCE_CONV in + fun k tm -> + let x,bod = dest_forall tm in + let th0 = ISPECL [x; mk_small_numeral k] ROTATION_RIGHTWARD_LINE in + let th1 = EXISTS_GENVAR_RULE + (MP th0 (EQT_ELIM(arithconv(lhand(concl th0))))) in + let [a;f],tm1 = strip_exists(concl th1) in + let th_orth,th2 = CONJ_PAIR(ASSUME tm1) in + let th_det,th2a = CONJ_PAIR th2 in + let th_works,th_zero = CONJ_PAIR th2a in + let thc,thq = CONJ_PAIR(PROVE_HYP th2 (UNDISCH(ISPEC f pth))) in + let th3 = CONV_RULE(RAND_CONV(SUBS_CONV(GSYM th_works::CONJUNCTS thc))) + (EXPAND_QUANTS_CONV(ASSUME(concl thq)) bod) in + let th4 = PROVE_HYP thq th3 in + let thps = CONJUNCTS(MATCH_MP oth (CONJ th_orth th_det)) in + let th5 = LINEAR_INVARIANTS f thps in + let th6 = PROVE_HYP th_orth + (GEN_REWRITE_RULE (RAND_CONV o REDEPTH_CONV) [BETA_THM; th5] th4) in + let ntm = mk_forall(a,mk_imp(concl th_zero,rand(concl th6))) in + let th7 = MP(SPEC a (ASSUME ntm)) th_zero in + let th8 = DISCH ntm (EQ_MP (SYM th6) th7) in + if intersect (frees(concl th8)) [a;f] = [] then + let th9 = PROVE_HYP th1 (itlist SIMPLE_CHOOSE [a;f] th8) in + let th10 = DISCH ntm (GEN x (UNDISCH th9)) in + let a' = variant (frees(concl th10)) + (mk_var(fst(dest_var x),snd(dest_var a))) in + CONV_RULE(LAND_CONV (GEN_ALPHA_CONV a')) th10 + else + let mtm = list_mk_forall([a;f],mk_imp(hd(hyp th8),rand(concl th6))) in + let th9 = EQ_MP (SYM th6) (UNDISCH(SPECL [a;f] (ASSUME mtm))) in + let th10 = itlist SIMPLE_CHOOSE [a;f] (DISCH mtm th9) in + let th11 = GEN x (PROVE_HYP th1 th10) in + MATCH_MP MONO_FORALL th11;; + +let GEOM_BASIS_MULTIPLE_TAC k l (asl,w as gl) = + let avs,bod = strip_forall w + and avs' = subtract (frees w) (freesl(map (concl o snd) asl)) in + (MAP_EVERY X_GEN_TAC avs THEN + MAP_EVERY (fun t -> SPEC_TAC(t,t)) (rev(subtract (avs@avs') [l])) THEN + SPEC_TAC(l,l) THEN + W(MATCH_MP_TAC o GEOM_BASIS_MULTIPLE_RULE k o snd)) gl;; + +(* ------------------------------------------------------------------------- *) +(* Create invariance theorems automatically, in simple cases. If there are *) +(* any nested quantifiers, this will need surjectivity. It's often possible *) +(* to prove a stronger theorem by more delicate manual reasoning, so this *) +(* isn't used nearly as often as GEOM_TRANSLATE_CONV / GEOM_TRANSLATE_TAC. *) +(* As a small step, some ad-hoc rewrites analogous to FORALL_IN_IMAGE are *) +(* tried if the first step doesn't finish the goal, but it's very ad hoc. *) +(* ------------------------------------------------------------------------- *) + +let GEOM_TRANSFORM_TAC = + let cth0 = prove + (`!f:real^M->real^N. + linear f + ==> vec 0 = f(vec 0) /\ + {} = IMAGE f {} /\ + {} = IMAGE (IMAGE f) {}`, + REWRITE_TAC[IMAGE_CLAUSES] THEN MESON_TAC[LINEAR_0]) + and cth1 = prove + (`!f:real^M->real^N. + (!y. ?x. f x = y) + ==> (:real^N) = IMAGE f (:real^M) /\ + (:real^N->bool) = IMAGE (IMAGE f) (:real^M->bool)`, + REWRITE_TAC[SET_RULE `UNIV = IMAGE f UNIV <=> !y. ?x. f x = y`] THEN + REWRITE_TAC[SURJECTIVE_IMAGE]) + and sths = (CONJUNCTS o prove) + (`(!f:real^M->real^N. + linear f /\ (!x. norm(f x) = norm x) + ==> (!x y. f x = f y ==> x = y)) /\ + (!f:real^N->real^N. + linear f /\ (!x. norm(f x) = norm x) ==> (!y. ?x. f x = y)) /\ + (!f:real^N->real^N. linear f /\ (!x y. f x = f y ==> x = y) + ==> (!y. ?x. f x = y)) /\ + (!f:real^N->real^N. linear f /\ (!y. ?x. f x = y) + ==> (!x y. f x = f y ==> x = y))`, + CONJ_TAC THENL + [ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN + SIMP_TAC[GSYM LINEAR_SUB; GSYM NORM_EQ_0]; + MESON_TAC[ORTHOGONAL_TRANSFORMATION_SURJECTIVE; + ORTHOGONAL_TRANSFORMATION_INJECTIVE; ORTHOGONAL_TRANSFORMATION; + LINEAR_SURJECTIVE_IFF_INJECTIVE]]) + and aths = (CONJUNCTS o prove) + (`(!f s P. (!y. y IN IMAGE f s ==> P y) <=> (!x. x IN s ==> P(f x))) /\ + (!f s P. (!u. u IN IMAGE (IMAGE f) s ==> P u) <=> + (!t. t IN s ==> P(IMAGE f t))) /\ + (!f s P. (?y. y IN IMAGE f s /\ P y) <=> (?x. x IN s /\ P(f x))) /\ + (!f s P. (?u. u IN IMAGE (IMAGE f) s /\ P u) <=> + (?t. t IN s /\ P(IMAGE f t)))`, + SET_TAC[]) in + fun avoid (asl,w as gl) -> + let f,wff = dest_forall w in + let vs,bod = strip_forall wff in + let ant,cons = dest_imp bod in + let hths = CONJUNCTS(ASSUME ant) in + let fths = hths @ mapfilter (USABLE_CONCLUSION f hths) sths in + let cths = mapfilter (USABLE_CONCLUSION f fths) [cth0; cth1] + and vconv = + try let vth = USABLE_CONCLUSION f fths QUANTIFY_SURJECTION_HIGHER_THM in + PROVE_HYP vth o PARTIAL_EXPAND_QUANTS_CONV avoid (ASSUME(concl vth)) + with Failure _ -> ALL_CONV + and bths = LINEAR_INVARIANTS f fths in + (MAP_EVERY X_GEN_TAC (f::vs) THEN DISCH_TAC THEN + GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) cths THEN + CONV_TAC(LAND_CONV vconv) THEN + GEN_REWRITE_TAC (LAND_CONV o REDEPTH_CONV) [bths] THEN + REWRITE_TAC[] THEN + REWRITE_TAC(mapfilter (ADD_ASSUM ant o ISPEC f) aths) THEN + GEN_REWRITE_TAC (LAND_CONV o REDEPTH_CONV) [bths] THEN + REWRITE_TAC[]) gl;; + +(* ------------------------------------------------------------------------- *) +(* Scale so that a chosen vector has size 1. Generates a conjunction of *) +(* two formulas, one for the zero case (which one hopes is trivial) and *) +(* one just like the original goal but with a norm(...) = 1 assumption. *) +(* ------------------------------------------------------------------------- *) + +let GEOM_NORMALIZE_RULE = + let pth = prove + (`!a:real^N. ~(a = vec 0) + ==> vec 0 = norm(a) % vec 0 /\ + a = norm(a) % inv(norm a) % a /\ + {} = IMAGE (\x. norm(a) % x) {} /\ + {} = IMAGE (IMAGE (\x. norm(a) % x)) {} /\ + (:real^N) = IMAGE (\x. norm(a) % x) (:real^N) /\ + (:real^N->bool) = + IMAGE (IMAGE (\x. norm(a) % x)) (:real^N->bool) /\ + [] = MAP (\x. norm(a) % x) []`, + REWRITE_TAC[IMAGE_CLAUSES; VECTOR_MUL_ASSOC; VECTOR_MUL_RZERO; MAP] THEN + SIMP_TAC[NORM_EQ_0; REAL_MUL_RINV; VECTOR_MUL_LID] THEN + GEN_TAC THEN DISCH_TAC THEN + REWRITE_TAC[SET_RULE `UNIV = IMAGE f UNIV <=> !y. ?x. f x = y`] THEN + ASM_REWRITE_TAC[SURJECTIVE_IMAGE] THEN + X_GEN_TAC `y:real^N` THEN EXISTS_TAC `inv(norm(a:real^N)) % y:real^N` THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; NORM_EQ_0; REAL_MUL_RINV; VECTOR_MUL_LID]) + and qth = prove + (`!a:real^N. + ~(a = vec 0) + ==> ((!P. (!r:real. P r) <=> (!r. P(norm a * r))) /\ + (!P. (?r:real. P r) <=> (?r. P(norm a * r))) /\ + (!P. (!x:real^N. P x) <=> (!x. P (norm(a) % x))) /\ + (!P. (?x:real^N. P x) <=> (?x. P (norm(a) % x))) /\ + (!Q. (!s:real^N->bool. Q s) <=> + (!s. Q(IMAGE (\x. norm(a) % x) s))) /\ + (!Q. (?s:real^N->bool. Q s) <=> + (?s. Q(IMAGE (\x. norm(a) % x) s))) /\ + (!Q. (!s:(real^N->bool)->bool. Q s) <=> + (!s. Q(IMAGE (IMAGE (\x. norm(a) % x)) s))) /\ + (!Q. (?s:(real^N->bool)->bool. Q s) <=> + (?s. Q(IMAGE (IMAGE (\x. norm(a) % x)) s))) /\ + (!P. (!g:real^1->real^N. P g) <=> + (!g. P ((\x. norm(a) % x) o g))) /\ + (!P. (?g:real^1->real^N. P g) <=> + (?g. P ((\x. norm(a) % x) o g))) /\ + (!P. (!g:num->real^N. P g) <=> + (!g. P ((\x. norm(a) % x) o g))) /\ + (!P. (?g:num->real^N. P g) <=> + (?g. P ((\x. norm(a) % x) o g))) /\ + (!Q. (!l. Q l) <=> (!l. Q(MAP (\x:real^N. norm(a) % x) l))) /\ + (!Q. (?l. Q l) <=> (?l. Q(MAP (\x:real^N. norm(a) % x) l)))) /\ + ((!P. {x:real^N | P x} = + IMAGE (\x. norm(a) % x) {x | P(norm(a) % x)}) /\ + (!Q. {s:real^N->bool | Q s} = + IMAGE (IMAGE (\x. norm(a) % x)) + {s | Q(IMAGE (\x. norm(a) % x) s)}) /\ + (!R. {l:(real^N)list | R l} = + IMAGE (MAP (\x:real^N. norm(a) % x)) + {l | R(MAP (\x:real^N. norm(a) % x) l)}))`, + GEN_TAC THEN DISCH_TAC THEN MATCH_MP_TAC(TAUT + `(a /\ b) /\ c /\ d ==> (a /\ b /\ c) /\ d`) THEN + CONJ_TAC THENL + [ASM_MESON_TAC[NORM_EQ_0; REAL_FIELD `~(x = &0) ==> x * inv x * a = a`]; + MP_TAC(ISPEC `\x:real^N. norm(a:real^N) % x` + (INST_TYPE [`:real^1`,`:C`] QUANTIFY_SURJECTION_HIGHER_THM)) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN MATCH_MP_TAC THEN + ASM_SIMP_TAC[SURJECTIVE_SCALING; NORM_EQ_0]]) + and lth = prove + (`(!b:real^N. ~(b = vec 0) ==> (P(b) <=> Q(inv(norm b) % b))) + ==> P(vec 0) /\ (!b. norm(b) = &1 ==> Q b) ==> (!b. P b)`, + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `b:real^N = vec 0` THEN ASM_SIMP_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_SIMP_TAC[NORM_MUL; REAL_ABS_INV; REAL_ABS_NORM; + REAL_MUL_LINV; NORM_EQ_0]) in + fun avoid tm -> + let x,tm0 = dest_forall tm in + let cth = UNDISCH(ISPEC x pth) + and vth = UNDISCH(ISPEC x qth) in + let th1 = ONCE_REWRITE_CONV[cth] tm0 in + let th2 = CONV_RULE (RAND_CONV + (PARTIAL_EXPAND_QUANTS_CONV avoid vth)) th1 in + let th3 = SCALING_THEOREMS x in + let th3' = (end_itlist CONJ (map + (fun th -> let avs,_ = strip_forall(concl th) in + let gvs = map (genvar o type_of) avs in + GENL gvs (SPECL gvs th)) + (CONJUNCTS th3))) in + let th4 = GEN_REWRITE_RULE (RAND_CONV o REDEPTH_CONV) + [BETA_THM; th3'] th2 in + MATCH_MP lth (GEN x (DISCH_ALL th4));; + +let GEN_GEOM_NORMALIZE_TAC x avoid (asl,w as gl) = + let avs,bod = strip_forall w + and avs' = subtract (frees w) (freesl(map (concl o snd) asl)) in + (MAP_EVERY X_GEN_TAC avs THEN + MAP_EVERY (fun t -> SPEC_TAC(t,t)) (rev(subtract (avs@avs') [x])) THEN + SPEC_TAC(x,x) THEN + W(MATCH_MP_TAC o GEOM_NORMALIZE_RULE avoid o snd)) gl;; + +let GEOM_NORMALIZE_TAC x = GEN_GEOM_NORMALIZE_TAC x [];; + +(* ------------------------------------------------------------------------- *) +(* Add invariance theorems for collinearity. *) +(* ------------------------------------------------------------------------- *) + +let COLLINEAR_TRANSLATION_EQ = prove + (`!a s. collinear (IMAGE (\x. a + x) s) <=> collinear s`, + REWRITE_TAC[collinear] THEN GEOM_TRANSLATE_TAC["u"]);; + +add_translation_invariants [COLLINEAR_TRANSLATION_EQ];; + +let COLLINEAR_TRANSLATION = prove + (`!s a. collinear s ==> collinear (IMAGE (\x. a + x) s)`, + REWRITE_TAC[COLLINEAR_TRANSLATION_EQ]);; + +let COLLINEAR_LINEAR_IMAGE = prove + (`!f s. collinear s /\ linear f ==> collinear(IMAGE f s)`, + REPEAT GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN + REWRITE_TAC[collinear; IMP_CONJ; RIGHT_FORALL_IMP_THM; FORALL_IN_IMAGE] THEN + ASM_MESON_TAC[LINEAR_SUB; LINEAR_CMUL]);; + +let COLLINEAR_LINEAR_IMAGE_EQ = prove + (`!f s. linear f /\ (!x y. f x = f y ==> x = y) + ==> (collinear (IMAGE f s) <=> collinear s)`, + MATCH_ACCEPT_TAC(LINEAR_INVARIANT_RULE COLLINEAR_LINEAR_IMAGE));; + +add_linear_invariants [COLLINEAR_LINEAR_IMAGE_EQ];; + +(* ------------------------------------------------------------------------- *) +(* Take a theorem "th" with outer universal quantifiers involving real^N *) +(* and a theorem "dth" asserting |- dimindex(:M) <= dimindex(:N) and *) +(* return a theorem replacing type :N by :M in th. Neither N or M need be a *) +(* type variable. *) +(* ------------------------------------------------------------------------- *) + +let GEOM_DROP_DIMENSION_RULE = + let oth = prove + (`!f:real^M->real^N. + linear f /\ (!x. norm(f x) = norm x) + ==> linear f /\ + (!x y. f x = f y ==> x = y) /\ + (!x. norm(f x) = norm x)`, + MESON_TAC[PRESERVES_NORM_INJECTIVE]) + and cth = prove + (`linear(f:real^M->real^N) + ==> vec 0 = f(vec 0) /\ + {} = IMAGE f {} /\ + {} = IMAGE (IMAGE f) {} /\ + [] = MAP f []`, + REWRITE_TAC[IMAGE_CLAUSES; MAP; GSYM LINEAR_0]) in + fun dth th -> + let ath = GEN_ALL th + and eth = MATCH_MP ISOMETRY_UNIV_UNIV dth + and avoid = variables(concl th) in + let f,bod = dest_exists(concl eth) in + let fimage = list_mk_icomb "IMAGE" [f] + and fmap = list_mk_icomb "MAP" [f] + and fcompose = list_mk_icomb "o" [f] in + let fimage2 = list_mk_icomb "IMAGE" [fimage] in + let lin,iso = CONJ_PAIR(ASSUME bod) in + let olduniv = rand(rand(concl dth)) + and newuniv = rand(lhand(concl dth)) in + let oldty = fst(dest_fun_ty(type_of olduniv)) + and newty = fst(dest_fun_ty(type_of newuniv)) in + let newvar v = + let n,t = dest_var v in + variant avoid (mk_var(n,tysubst[newty,oldty] t)) in + let newterm v = + try let v' = newvar v in + tryfind (fun f -> mk_comb(f,v')) [f;fimage;fmap;fcompose;fimage2] + with Failure _ -> v in + let specrule th = + let v = fst(dest_forall(concl th)) in SPEC (newterm v) th in + let sth = SUBS(CONJUNCTS(MATCH_MP cth lin)) ath in + let fth = SUBS[SYM(MATCH_MP LINEAR_0 lin)] (repeat specrule sth) in + let thps = CONJUNCTS(MATCH_MP oth (ASSUME bod)) in + let th5 = LINEAR_INVARIANTS f thps in + let th6 = GEN_REWRITE_RULE REDEPTH_CONV [th5] fth in + let th7 = PROVE_HYP eth (SIMPLE_CHOOSE f th6) in + GENL (map newvar (fst(strip_forall(concl ath)))) th7;; + +(* ------------------------------------------------------------------------- *) +(* Transfer theorems automatically between same-dimension spaces. *) +(* Given dth = A |- dimindex(:M) = dimindex(:N) *) +(* and a theorem th involving variables of type real^N *) +(* returns a corresponding theorem mapped to type real^M with assumptions A. *) +(* ------------------------------------------------------------------------- *) + +let GEOM_EQUAL_DIMENSION_RULE = + let bth = prove + (`dimindex(:M) = dimindex(:N) + ==> ?f:real^M->real^N. + (linear f /\ (!y. ?x. f x = y)) /\ + (!x. norm(f x) = norm x)`, + REWRITE_TAC[SET_RULE `(!y. ?x. f x = y) <=> IMAGE f UNIV = UNIV`] THEN + DISCH_TAC THEN REWRITE_TAC[GSYM CONJ_ASSOC] THEN + MATCH_MP_TAC ISOMETRY_UNIV_SUBSPACE THEN + REWRITE_TAC[SUBSPACE_UNIV; DIM_UNIV] THEN FIRST_ASSUM ACCEPT_TAC) + and pth = prove + (`!f:real^M->real^N. + linear f /\ (!y. ?x. f x = y) + ==> (vec 0 = f(vec 0) /\ + {} = IMAGE f {} /\ + {} = IMAGE (IMAGE f) {} /\ + (:real^N) = IMAGE f (:real^M) /\ + (:real^N->bool) = IMAGE (IMAGE f) (:real^M->bool) /\ + [] = MAP f []) /\ + ((!P. (!x. P x) <=> (!x. P (f x))) /\ + (!P. (?x. P x) <=> (?x. P (f x))) /\ + (!Q. (!s. Q s) <=> (!s. Q (IMAGE f s))) /\ + (!Q. (?s. Q s) <=> (?s. Q (IMAGE f s))) /\ + (!Q. (!s. Q s) <=> (!s. Q (IMAGE (IMAGE f) s))) /\ + (!Q. (?s. Q s) <=> (?s. Q (IMAGE (IMAGE f) s))) /\ + (!P. (!g:real^1->real^N. P g) <=> (!g. P (f o g))) /\ + (!P. (?g:real^1->real^N. P g) <=> (?g. P (f o g))) /\ + (!P. (!g:num->real^N. P g) <=> (!g. P (f o g))) /\ + (!P. (?g:num->real^N. P g) <=> (?g. P (f o g))) /\ + (!Q. (!l. Q l) <=> (!l. Q(MAP f l))) /\ + (!Q. (?l. Q l) <=> (?l. Q(MAP f l)))) /\ + ((!P. {x | P x} = IMAGE f {x | P(f x)}) /\ + (!Q. {s | Q s} = IMAGE (IMAGE f) {s | Q(IMAGE f s)}) /\ + (!R. {l | R l} = IMAGE (MAP f) {l | R(MAP f l)}))`, + GEN_TAC THEN + SIMP_TAC[SET_RULE `UNIV = IMAGE f UNIV <=> (!y. ?x. f x = y)`; + SURJECTIVE_IMAGE] THEN + MATCH_MP_TAC MONO_AND THEN + REWRITE_TAC[QUANTIFY_SURJECTION_HIGHER_THM] THEN + REWRITE_TAC[IMAGE_CLAUSES; MAP] THEN MESON_TAC[LINEAR_0]) in + fun dth th -> + let eth = EXISTS_GENVAR_RULE (MATCH_MP bth dth) in + let f,bod = dest_exists(concl eth) in + let lsth,neth = CONJ_PAIR(ASSUME bod) in + let cth,qth = CONJ_PAIR(MATCH_MP pth lsth) in + let th1 = CONV_RULE (EXPAND_QUANTS_CONV qth) th in + let ith = LINEAR_INVARIANTS f (neth::CONJUNCTS lsth) in + let th2 = GEN_REWRITE_RULE (RAND_CONV o REDEPTH_CONV) [BETA_THM;ith] th1 in + PROVE_HYP eth (SIMPLE_CHOOSE f th2);; diff --git a/development/thales/chaff/tmp/vectors_patch.ml b/development/thales/chaff/tmp/vectors_patch.ml new file mode 100644 index 0000000..34719c8 --- /dev/null +++ b/development/thales/chaff/tmp/vectors_patch.ml @@ -0,0 +1,7480 @@ +(* ========================================================================= *) +(* Real vectors in Euclidean space, and elementary linear algebra. *) +(* *) +(* (c) Copyright, John Harrison 1998-2008 *) +(* ========================================================================= *) + +(* Feb 2, 2012, patch of a file not yet committed to SVN. + Sent by email by Harrison. Delete in a few weeks after Harrison commits changes *) + +needs "Multivariate/misc.ml";; + +(* ------------------------------------------------------------------------- *) +(* Some common special cases. *) +(* ------------------------------------------------------------------------- *) + +let FORALL_1 = prove + (`(!i. 1 <= i /\ i <= 1 ==> P i) <=> P 1`, + MESON_TAC[LE_ANTISYM]);; + +let FORALL_2 = prove + (`!P. (!i. 1 <= i /\ i <= 2 ==> P i) <=> P 1 /\ P 2`, + MESON_TAC[ARITH_RULE `1 <= i /\ i <= 2 <=> i = 1 \/ i = 2`]);; + +let FORALL_3 = prove + (`!P. (!i. 1 <= i /\ i <= 3 ==> P i) <=> P 1 /\ P 2 /\ P 3`, + MESON_TAC[ARITH_RULE `1 <= i /\ i <= 3 <=> i = 1 \/ i = 2 \/ i = 3`]);; + +let SUM_1 = prove + (`sum(1..1) f = f(1)`, + REWRITE_TAC[SUM_SING_NUMSEG]);; + +let SUM_2 = prove + (`!t. sum(1..2) t = t(1) + t(2)`, + REWRITE_TAC[num_CONV `2`; SUM_CLAUSES_NUMSEG] THEN + REWRITE_TAC[SUM_SING_NUMSEG; ARITH; REAL_ADD_ASSOC]);; + +let SUM_3 = prove + (`!t. sum(1..3) t = t(1) + t(2) + t(3)`, + REWRITE_TAC[num_CONV `3`; num_CONV `2`; SUM_CLAUSES_NUMSEG] THEN + REWRITE_TAC[SUM_SING_NUMSEG; ARITH; REAL_ADD_ASSOC]);; + +(* ------------------------------------------------------------------------- *) +(* Basic componentwise operations on vectors. *) +(* ------------------------------------------------------------------------- *) + +let vector_add = new_definition + `(vector_add:real^N->real^N->real^N) x y = lambda i. x$i + y$i`;; + +let vector_sub = new_definition + `(vector_sub:real^N->real^N->real^N) x y = lambda i. x$i - y$i`;; + +let vector_neg = new_definition + `(vector_neg:real^N->real^N) x = lambda i. --(x$i)`;; + +overload_interface ("+",`(vector_add):real^N->real^N->real^N`);; +overload_interface ("-",`(vector_sub):real^N->real^N->real^N`);; +overload_interface ("--",`(vector_neg):real^N->real^N`);; + +prioritize_real();; + +let prioritize_vector = let ty = `:real^N` in + fun () -> prioritize_overload ty;; + +(* ------------------------------------------------------------------------- *) +(* Also the scalar-vector multiplication. *) +(* ------------------------------------------------------------------------- *) + +parse_as_infix("%",(21,"right"));; + +let vector_mul = new_definition + `((%):real->real^N->real^N) c x = lambda i. c * x$i`;; + +(* ------------------------------------------------------------------------- *) +(* Vectors corresponding to small naturals. Perhaps should overload "&"? *) +(* ------------------------------------------------------------------------- *) + +let vec = new_definition + `(vec:num->real^N) n = lambda i. &n`;; + +(* ------------------------------------------------------------------------- *) +(* Dot products. *) +(* ------------------------------------------------------------------------- *) + +parse_as_infix("dot",(20,"right"));; + +let dot = new_definition + `(x:real^N) dot (y:real^N) = sum(1..dimindex(:N)) (\i. x$i * y$i)`;; + +let DOT_1 = prove + (`(x:real^1) dot (y:real^1) = x$1 * y$1`, + REWRITE_TAC[dot; DIMINDEX_1; SUM_1]);; + +let DOT_2 = prove + (`(x:real^2) dot (y:real^2) = x$1 * y$1 + x$2 * y$2`, + REWRITE_TAC[dot; DIMINDEX_2; SUM_2]);; + +let DOT_3 = prove + (`(x:real^3) dot (y:real^3) = x$1 * y$1 + x$2 * y$2 + x$3 * y$3`, + REWRITE_TAC[dot; DIMINDEX_3; SUM_3]);; + +(* ------------------------------------------------------------------------- *) +(* A naive proof procedure to lift really trivial arithmetic stuff from R. *) +(* ------------------------------------------------------------------------- *) + +let VECTOR_ARITH_TAC = + let RENAMED_LAMBDA_BETA th = + if fst(dest_fun_ty(type_of(funpow 3 rand (concl th)))) = aty + then INST_TYPE [aty,bty; bty,aty] LAMBDA_BETA else LAMBDA_BETA in + POP_ASSUM_LIST(K ALL_TAC) THEN + REPEAT(GEN_TAC ORELSE CONJ_TAC ORELSE DISCH_TAC ORELSE EQ_TAC) THEN + REPEAT(POP_ASSUM MP_TAC) THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] THEN + REWRITE_TAC[dot; GSYM SUM_ADD_NUMSEG; GSYM SUM_SUB_NUMSEG; + GSYM SUM_LMUL; GSYM SUM_RMUL; GSYM SUM_NEG] THEN + (MATCH_MP_TAC SUM_EQ_NUMSEG ORELSE MATCH_MP_TAC SUM_EQ_0_NUMSEG ORELSE + GEN_REWRITE_TAC ONCE_DEPTH_CONV [CART_EQ]) THEN + REWRITE_TAC[AND_FORALL_THM] THEN TRY EQ_TAC THEN + TRY(MATCH_MP_TAC MONO_FORALL) THEN GEN_TAC THEN + REWRITE_TAC[TAUT `(a ==> b) /\ (a ==> c) <=> a ==> b /\ c`; + TAUT `(a ==> b) \/ (a ==> c) <=> a ==> b \/ c`] THEN + TRY(MATCH_MP_TAC(TAUT `(a ==> b ==> c) ==> (a ==> b) ==> (a ==> c)`)) THEN + REWRITE_TAC[vector_add; vector_sub; vector_neg; vector_mul; vec] THEN + DISCH_THEN(fun th -> REWRITE_TAC[MATCH_MP(RENAMED_LAMBDA_BETA th) th]) THEN + REAL_ARITH_TAC;; + +let VECTOR_ARITH tm = prove(tm,VECTOR_ARITH_TAC);; + +(* ------------------------------------------------------------------------- *) +(* Obvious "component-pushing". *) +(* ------------------------------------------------------------------------- *) + +let VEC_COMPONENT = prove + (`!k i. (vec k :real^N)$i = &k`, + REPEAT GEN_TAC THEN + SUBGOAL_THEN `?k. 1 <= k /\ k <= dimindex(:N) /\ !z:real^N. z$i = z$k` + CHOOSE_TAC THENL + [REWRITE_TAC[FINITE_INDEX_INRANGE]; + ASM_SIMP_TAC[vec; CART_EQ; LAMBDA_BETA]]);; + +let VECTOR_ADD_COMPONENT = prove + (`!x:real^N y i. (x + y)$i = x$i + y$i`, + REPEAT GEN_TAC THEN + SUBGOAL_THEN `?k. 1 <= k /\ k <= dimindex(:N) /\ !z:real^N. z$i = z$k` + CHOOSE_TAC THENL + [REWRITE_TAC[FINITE_INDEX_INRANGE]; + ASM_SIMP_TAC[vector_add; CART_EQ; LAMBDA_BETA]]);; + +let VECTOR_SUB_COMPONENT = prove + (`!x:real^N y i. (x - y)$i = x$i - y$i`, + REPEAT GEN_TAC THEN + SUBGOAL_THEN `?k. 1 <= k /\ k <= dimindex(:N) /\ !z:real^N. z$i = z$k` + CHOOSE_TAC THENL + [REWRITE_TAC[FINITE_INDEX_INRANGE]; + ASM_SIMP_TAC[vector_sub; CART_EQ; LAMBDA_BETA]]);; + +let VECTOR_NEG_COMPONENT = prove + (`!x:real^N i. (--x)$i = --(x$i)`, + REPEAT GEN_TAC THEN + SUBGOAL_THEN `?k. 1 <= k /\ k <= dimindex(:N) /\ !z:real^N. z$i = z$k` + CHOOSE_TAC THENL + [REWRITE_TAC[FINITE_INDEX_INRANGE]; + ASM_SIMP_TAC[vector_neg; CART_EQ; LAMBDA_BETA]]);; + +let VECTOR_MUL_COMPONENT = prove + (`!c x:real^N i. (c % x)$i = c * x$i`, + REPEAT GEN_TAC THEN + SUBGOAL_THEN `?k. 1 <= k /\ k <= dimindex(:N) /\ !z:real^N. z$i = z$k` + CHOOSE_TAC THENL + [REWRITE_TAC[FINITE_INDEX_INRANGE]; + ASM_SIMP_TAC[vector_mul; CART_EQ; LAMBDA_BETA]]);; + +let COND_COMPONENT = prove + (`(if b then x else y)$i = if b then x$i else y$i`, + MESON_TAC[]);; + +(* ------------------------------------------------------------------------- *) +(* Some frequently useful arithmetic lemmas over vectors. *) +(* ------------------------------------------------------------------------- *) + +let VECTOR_ADD_SYM = VECTOR_ARITH `!x y:real^N. x + y = y + x`;; + +let VECTOR_ADD_LID = VECTOR_ARITH `!x. vec 0 + x = x`;; + +let VECTOR_ADD_RID = VECTOR_ARITH `!x. x + vec 0 = x`;; + +let VECTOR_SUB_REFL = VECTOR_ARITH `!x. x - x = vec 0`;; + +let VECTOR_ADD_LINV = VECTOR_ARITH `!x. --x + x = vec 0`;; + +let VECTOR_ADD_RINV = VECTOR_ARITH `!x. x + --x = vec 0`;; + +let VECTOR_SUB_RADD = VECTOR_ARITH `!x y. x - (x + y) = --y:real^N`;; + +let VECTOR_NEG_SUB = VECTOR_ARITH `!x:real^N y. --(x - y) = y - x`;; + +let VECTOR_SUB_EQ = VECTOR_ARITH `!x y. (x - y = vec 0) <=> (x = y)`;; + +let VECTOR_MUL_ASSOC = VECTOR_ARITH `!a b x. a % (b % x) = (a * b) % x`;; + +let VECTOR_MUL_LID = VECTOR_ARITH `!x. &1 % x = x`;; + +let VECTOR_MUL_LZERO = VECTOR_ARITH `!x. &0 % x = vec 0`;; + +let VECTOR_SUB_ADD = VECTOR_ARITH `(x - y) + y = x:real^N`;; + +let VECTOR_SUB_ADD2 = VECTOR_ARITH `y + (x - y) = x:real^N`;; + +let VECTOR_ADD_LDISTRIB = VECTOR_ARITH `c % (x + y) = c % x + c % y`;; + +let VECTOR_SUB_LDISTRIB = VECTOR_ARITH `c % (x - y) = c % x - c % y`;; + +let VECTOR_ADD_RDISTRIB = VECTOR_ARITH `(a + b) % x = a % x + b % x`;; + +let VECTOR_SUB_RDISTRIB = VECTOR_ARITH `(a - b) % x = a % x - b % x`;; + +let VECTOR_ADD_SUB = VECTOR_ARITH `(x + y:real^N) - x = y`;; + +let VECTOR_EQ_ADDR = VECTOR_ARITH `(x + y = x) <=> (y = vec 0)`;; + +let VECTOR_SUB = VECTOR_ARITH `x - y = x + --(y:real^N)`;; + +let VECTOR_SUB_RZERO = VECTOR_ARITH `x - vec 0 = x`;; + +let VECTOR_MUL_RZERO = VECTOR_ARITH `c % vec 0 = vec 0`;; + +let VECTOR_NEG_MINUS1 = VECTOR_ARITH `--x = (--(&1)) % x`;; + +let VECTOR_ADD_ASSOC = VECTOR_ARITH `(x:real^N) + y + z = (x + y) + z`;; + +let VECTOR_SUB_LZERO = VECTOR_ARITH `vec 0 - x = --x`;; + +let VECTOR_NEG_NEG = VECTOR_ARITH `--(--(x:real^N)) = x`;; + +let VECTOR_MUL_LNEG = VECTOR_ARITH `--c % x = --(c % x)`;; + +let VECTOR_MUL_RNEG = VECTOR_ARITH `c % --x = --(c % x)`;; + +let VECTOR_NEG_0 = VECTOR_ARITH `--(vec 0) = vec 0`;; + +let VECTOR_NEG_EQ_0 = VECTOR_ARITH `--x = vec 0 <=> x = vec 0`;; + +let VECTOR_ADD_AC = VECTOR_ARITH + `(m + n = n + m:real^N) /\ + ((m + n) + p = m + n + p) /\ + (m + n + p = n + m + p)`;; + +let VEC_EQ = prove + (`!m n. (vec m = vec n) <=> (m = n)`, + SIMP_TAC[CART_EQ; VEC_COMPONENT; REAL_OF_NUM_EQ] THEN + MESON_TAC[LE_REFL; DIMINDEX_GE_1]);; + +(* ------------------------------------------------------------------------- *) +(* Infinitude of Euclidean space. *) +(* ------------------------------------------------------------------------- *) + +let EUCLIDEAN_SPACE_INFINITE = prove + (`INFINITE(:real^N)`, + REWRITE_TAC[INFINITE] THEN DISCH_TAC THEN + FIRST_ASSUM(MP_TAC o ISPEC `vec:num->real^N` o + MATCH_MP (REWRITE_RULE[IMP_CONJ_ALT] FINITE_IMAGE_INJ)) THEN + REWRITE_TAC[VEC_EQ; SET_RULE `{x | f x IN UNIV} = UNIV`] THEN + REWRITE_TAC[GSYM INFINITE; num_INFINITE]);; + +(* ------------------------------------------------------------------------- *) +(* Properties of the dot product. *) +(* ------------------------------------------------------------------------- *) + +let DOT_SYM = VECTOR_ARITH `!x y. x dot y = y dot x`;; + +let DOT_LADD = VECTOR_ARITH `!x y z. (x + y) dot z = (x dot z) + (y dot z)`;; + +let DOT_RADD = VECTOR_ARITH `!x y z. x dot (y + z) = (x dot y) + (x dot z)`;; + +let DOT_LSUB = VECTOR_ARITH `!x y z. (x - y) dot z = (x dot z) - (y dot z)`;; + +let DOT_RSUB = VECTOR_ARITH `!x y z. x dot (y - z) = (x dot y) - (x dot z)`;; + +let DOT_LMUL = VECTOR_ARITH `!c x y. (c % x) dot y = c * (x dot y)`;; + +let DOT_RMUL = VECTOR_ARITH `!c x y. x dot (c % y) = c * (x dot y)`;; + +let DOT_LNEG = VECTOR_ARITH `!x y. (--x) dot y = --(x dot y)`;; + +let DOT_RNEG = VECTOR_ARITH `!x y. x dot (--y) = --(x dot y)`;; + +let DOT_LZERO = VECTOR_ARITH `!x. (vec 0) dot x = &0`;; + +let DOT_RZERO = VECTOR_ARITH `!x. x dot (vec 0) = &0`;; + +let DOT_POS_LE = prove + (`!x. &0 <= x dot x`, + SIMP_TAC[dot; SUM_POS_LE_NUMSEG; REAL_LE_SQUARE]);; + +let DOT_EQ_0 = prove + (`!x:real^N. ((x dot x = &0) <=> (x = vec 0))`, + REPEAT GEN_TAC THEN EQ_TAC THENL [ALL_TAC; MESON_TAC[DOT_LZERO]] THEN + SIMP_TAC[dot; CART_EQ; vec; LAMBDA_BETA] THEN DISCH_TAC THEN + ONCE_REWRITE_TAC[GSYM(REWRITE_CONV[REAL_ENTIRE] `x * x = &0`)] THEN + MATCH_MP_TAC SUM_POS_EQ_0_NUMSEG THEN ASM_REWRITE_TAC[REAL_LE_SQUARE]);; + +let DOT_POS_LT = prove + (`!x. (&0 < x dot x) <=> ~(x = vec 0)`, + REWRITE_TAC[REAL_LT_LE; DOT_POS_LE] THEN MESON_TAC[DOT_EQ_0]);; + +let FORALL_DOT_EQ_0 = prove + (`(!y. (!x. x dot y = &0) <=> y = vec 0) /\ + (!x. (!y. x dot y = &0) <=> x = vec 0)`, + MESON_TAC[DOT_LZERO; DOT_RZERO; DOT_EQ_0]);; + +(* ------------------------------------------------------------------------- *) +(* Introduce norms, but defer many properties till we get square roots. *) +(* ------------------------------------------------------------------------- *) + +make_overloadable "norm" `:A->real`;; +overload_interface("norm",`vector_norm:real^N->real`);; + +let vector_norm = new_definition + `norm x = sqrt(x dot x)`;; + +(* ------------------------------------------------------------------------- *) +(* Useful for the special cases of 1 dimension. *) +(* ------------------------------------------------------------------------- *) + +let FORALL_DIMINDEX_1 = prove + (`(!i. 1 <= i /\ i <= dimindex(:1) ==> P i) <=> P 1`, + MESON_TAC[DIMINDEX_1; LE_ANTISYM]);; + +(* ------------------------------------------------------------------------- *) +(* The collapse of the general concepts to the real line R^1. *) +(* ------------------------------------------------------------------------- *) + +let VECTOR_ONE = prove + (`!x:real^1. x = lambda i. x$1`, + SIMP_TAC[CART_EQ; LAMBDA_BETA] THEN MESON_TAC[DIMINDEX_1; LE_ANTISYM]);; + +let FORALL_REAL_ONE = prove + (`(!x:real^1. P x) <=> (!x. P(lambda i. x))`, + EQ_TAC THEN SIMP_TAC[] THEN DISCH_TAC THEN GEN_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `(x:real^1)$1`) THEN + REWRITE_TAC[GSYM VECTOR_ONE]);; + +let NORM_REAL = prove + (`!x:real^1. norm(x) = abs(x$1)`, + REWRITE_TAC[vector_norm; dot; DIMINDEX_1; SUM_SING_NUMSEG; + GSYM REAL_POW_2; POW_2_SQRT_ABS]);; + +(* ------------------------------------------------------------------------- *) +(* Metric function. *) +(* ------------------------------------------------------------------------- *) + +override_interface("dist",`distance:real^N#real^N->real`);; + +let dist = new_definition + `dist(x,y) = norm(x - y)`;; + +let DIST_REAL = prove + (`!x:real^1 y. dist(x,y) = abs(x$1 - y$1)`, + SIMP_TAC[dist; NORM_REAL; vector_sub; LAMBDA_BETA; LE_REFL; DIMINDEX_1]);; + +(* ------------------------------------------------------------------------- *) +(* A connectedness or intermediate value lemma with several applications. *) +(* ------------------------------------------------------------------------- *) + +let CONNECTED_REAL_LEMMA = prove + (`!f:real->real^N a b e1 e2. + a <= b /\ f(a) IN e1 /\ f(b) IN e2 /\ + (!e x. a <= x /\ x <= b /\ &0 < e + ==> ?d. &0 < d /\ + !y. abs(y - x) < d ==> dist(f(y),f(x)) < e) /\ + (!y. y IN e1 ==> ?e. &0 < e /\ !y'. dist(y',y) < e ==> y' IN e1) /\ + (!y. y IN e2 ==> ?e. &0 < e /\ !y'. dist(y',y) < e ==> y' IN e2) /\ + ~(?x. a <= x /\ x <= b /\ f(x) IN e1 /\ f(x) IN e2) + ==> ?x. a <= x /\ x <= b /\ ~(f(x) IN e1) /\ ~(f(x) IN e2)`, + let tac = ASM_MESON_TAC[REAL_LT_IMP_LE; REAL_LE_TOTAL; REAL_LE_ANTISYM] in + REWRITE_TAC[EXTENSION; NOT_IN_EMPTY] THEN REPEAT STRIP_TAC THEN + MP_TAC(SPEC `\c. !x. a <= x /\ x <= c ==> (f(x):real^N) IN e1` + REAL_COMPLETE) THEN + REWRITE_TAC[] THEN ANTS_TAC THENL [tac; ALL_TAC] THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `x:real` THEN STRIP_TAC THEN + SUBGOAL_THEN `a <= x /\ x <= b` STRIP_ASSUME_TAC THENL [tac; ALL_TAC] THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `!z. a <= z /\ z < x ==> (f(z):real^N) IN e1` ASSUME_TAC THENL + [ASM_MESON_TAC[REAL_NOT_LT; REAL_LT_IMP_LE]; ALL_TAC] THEN + REPEAT STRIP_TAC THENL + [SUBGOAL_THEN + `?d. &0 < d /\ !y. abs(y - x) < d ==> (f(y):real^N) IN e1` + STRIP_ASSUME_TAC THENL [ASM_MESON_TAC[]; ALL_TAC] THEN + ASM_MESON_TAC[REAL_ARITH `z <= x + e /\ e < d ==> z < x \/ abs(z - x) < d`; + REAL_ARITH `&0 < e ==> ~(x + e <= x)`; REAL_DOWN]; + SUBGOAL_THEN + `?d. &0 < d /\ !y. abs(y - x) < d ==> (f(y):real^N) IN e2` + STRIP_ASSUME_TAC THENL [ASM_MESON_TAC[]; ALL_TAC] THEN + MP_TAC(SPECL [`x - a`; `d:real`] REAL_DOWN2) THEN ANTS_TAC THENL + [ASM_MESON_TAC[REAL_LT_LE; REAL_SUB_LT]; ALL_TAC] THEN + ASM_MESON_TAC[REAL_ARITH `e < x - a ==> a <= x - e`; + REAL_ARITH `&0 < e /\ x <= b ==> x - e <= b`; + REAL_ARITH `&0 < e /\ e < d ==> x - e < x /\ abs((x - e) - x) < d`]]);; + +(* ------------------------------------------------------------------------- *) +(* One immediately useful corollary is the existence of square roots! *) +(* ------------------------------------------------------------------------- *) + +let SQUARE_BOUND_LEMMA = prove + (`!x. x < (&1 + x) * (&1 + x)`, + GEN_TAC THEN REWRITE_TAC[REAL_POW_2] THEN + MAP_EVERY (fun t -> MP_TAC(SPEC t REAL_LE_SQUARE)) [`x:real`; `&1 + x`] THEN + REAL_ARITH_TAC);; + +let SQUARE_CONTINUOUS = prove + (`!x e. &0 < e + ==> ?d. &0 < d /\ !y. abs(y - x) < d ==> abs(y * y - x * x) < e`, + REPEAT STRIP_TAC THEN ASM_CASES_TAC `x = &0` THENL + [ASM_REWRITE_TAC[REAL_MUL_LZERO; REAL_SUB_RZERO] THEN + EXISTS_TAC `inv(&1 + inv(e))` THEN + ASM_SIMP_TAC[REAL_LT_INV_EQ; REAL_LT_ADD; REAL_LT_01] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC REAL_LTE_TRANS THEN + EXISTS_TAC `inv(&1 + inv(e)) * inv(&1 + inv(e))` THEN + ASM_SIMP_TAC[REAL_ABS_MUL; REAL_LT_MUL2; REAL_ABS_POS] THEN + REWRITE_TAC[GSYM REAL_INV_MUL] THEN + GEN_REWRITE_TAC RAND_CONV [GSYM REAL_INV_INV] THEN + MATCH_MP_TAC REAL_LE_INV2 THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE; SQUARE_BOUND_LEMMA; REAL_LT_INV_EQ]; + MP_TAC(SPECL [`abs(x)`; `e / (&3 * abs(x))`] REAL_DOWN2)THEN + ASM_SIMP_TAC[GSYM REAL_ABS_NZ; REAL_LT_DIV; REAL_LT_MUL; REAL_OF_NUM_LT; + ARITH; REAL_LT_RDIV_EQ] THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `d:real` THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN X_GEN_TAC `y:real` THEN + REWRITE_TAC[REAL_ARITH `x * x - y * y = (x - y) * (x + y)`] THEN + DISCH_TAC THEN MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `d * &3 * abs(x)` THEN ASM_REWRITE_TAC[REAL_ABS_MUL] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_SIMP_TAC[REAL_ABS_POS; REAL_LT_IMP_LE] THEN + MAP_EVERY UNDISCH_TAC [`abs (y - x) < d`; `d < abs(x)`] THEN + REAL_ARITH_TAC]);; + +let SQRT_WORKS = prove + (`!x. &0 <= x ==> &0 <= sqrt(x) /\ (sqrt(x) pow 2 = x)`, + GEN_TAC THEN GEN_REWRITE_TAC LAND_CONV [REAL_LE_LT] THEN STRIP_TAC THENL + [ALL_TAC; + ASM_MESON_TAC[SQRT_0; REAL_POW_2; REAL_LE_REFL; REAL_MUL_LZERO]] THEN + REWRITE_TAC[sqrt] THEN CONV_TAC SELECT_CONV THEN + MP_TAC(ISPECL [`(\u. lambda i. u):real->real^1`; `&0`; `&1 + x`; + `{u:real^1 | u$1 * u$1 < x}`; `{u:real^1 | u$1 * u$1 > x}`] + CONNECTED_REAL_LEMMA) THEN + SIMP_TAC[LAMBDA_BETA; LE_REFL; DIMINDEX_1; DIST_REAL; + EXTENSION; IN_INTER; IN_ELIM_THM; NOT_IN_EMPTY; + REAL_MUL_LZERO; FORALL_REAL_ONE; real_gt] THEN + ANTS_TAC THENL [ALL_TAC; ASM_MESON_TAC[REAL_POW_2; REAL_LT_TOTAL]] THEN + ASM_SIMP_TAC[REAL_LT_ANTISYM; REAL_ARITH `&0 < x ==> &0 <= &1 + x`] THEN + REWRITE_TAC[SQUARE_BOUND_LEMMA] THEN + MESON_TAC[SQUARE_CONTINUOUS; REAL_SUB_LT; + REAL_ARITH `abs(z2 - x2) < y - x2 ==> z2 < y`; + REAL_ARITH `abs(z2 - x2) < x2 - y ==> y < z2`]);; + +let SQRT_POS_LE = prove + (`!x. &0 <= x ==> &0 <= sqrt(x)`, + MESON_TAC[SQRT_WORKS]);; + +let SQRT_POW_2 = prove + (`!x. &0 <= x ==> (sqrt(x) pow 2 = x)`, + MESON_TAC[SQRT_WORKS]);; + +let SQRT_MUL = prove + (`!x y. &0 <= x /\ &0 <= y + ==> (sqrt(x * y) = sqrt x * sqrt y)`, + ASM_MESON_TAC[REAL_POW_2; SQRT_WORKS; REAL_LE_MUL; SQRT_UNIQUE; + REAL_ARITH `(x * y) * (x * y) = (x * x) * y * y`]);; + +let SQRT_INV = prove + (`!x. &0 <= x ==> (sqrt (inv x) = inv(sqrt x))`, + MESON_TAC[SQRT_UNIQUE; SQRT_WORKS; REAL_POW_INV; REAL_LE_INV_EQ]);; + +let SQRT_DIV = prove + (`!x y. &0 <= x /\ &0 <= y ==> (sqrt (x / y) = sqrt x / sqrt y)`, + SIMP_TAC[real_div; SQRT_MUL; SQRT_INV; REAL_LE_INV_EQ]);; + +let SQRT_POW2 = prove + (`!x. (sqrt(x) pow 2 = x) <=> &0 <= x`, + MESON_TAC[REAL_POW_2; REAL_LE_SQUARE; SQRT_POW_2]);; + +let SQRT_MONO_LT = prove + (`!x y. &0 <= x /\ x < y ==> sqrt(x) < sqrt(y)`, + REWRITE_TAC[GSYM REAL_NOT_LE] THEN + MESON_TAC[REAL_LT_IMP_LE; REAL_NOT_LE; REAL_LE_TRANS; + REAL_POW_LE2; SQRT_WORKS]);; + +let SQRT_MONO_LE = prove + (`!x y. &0 <= x /\ x <= y ==> sqrt(x) <= sqrt(y)`, + MESON_TAC[REAL_LE_LT; SQRT_MONO_LT]);; + +let SQRT_MONO_LT_EQ = prove + (`!x y. &0 <= x /\ &0 <= y ==> (sqrt(x) < sqrt(y) <=> x < y)`, + MESON_TAC[REAL_NOT_LT; SQRT_MONO_LT; SQRT_MONO_LE]);; + +let SQRT_MONO_LE_EQ = prove + (`!x y. &0 <= x /\ &0 <= y ==> (sqrt(x) <= sqrt(y) <=> x <= y)`, + MESON_TAC[REAL_NOT_LT; SQRT_MONO_LT; SQRT_MONO_LE]);; + +let SQRT_INJ = prove + (`!x y. &0 <= x /\ &0 <= y ==> ((sqrt(x) = sqrt(y)) <=> (x = y))`, + SIMP_TAC[GSYM REAL_LE_ANTISYM; SQRT_MONO_LE_EQ]);; + +let SQRT_LT_0 = prove + (`!x. &0 <= x ==> (&0 < sqrt x <=> &0 < x)`, + MESON_TAC[SQRT_0; REAL_LE_REFL; SQRT_MONO_LT_EQ]);; + +let SQRT_EQ_0 = prove + (`!x. &0 <= x ==> ((sqrt x = &0) <=> (x = &0))`, + MESON_TAC[SQRT_INJ; SQRT_0; REAL_LE_REFL]);; + +let SQRT_POS_LT = prove + (`!x. &0 < x ==> &0 < sqrt(x)`, + MESON_TAC[REAL_LT_LE; SQRT_POS_LE; SQRT_EQ_0]);; + +let REAL_LE_LSQRT = prove + (`!x y. &0 <= x /\ &0 <= y /\ x <= y pow 2 ==> sqrt(x) <= y`, + MESON_TAC[SQRT_MONO_LE; REAL_POW_LE; POW_2_SQRT]);; + +let REAL_LE_RSQRT = prove + (`!x y. x pow 2 <= y ==> x <= sqrt(y)`, + MESON_TAC[REAL_LE_TOTAL; SQRT_MONO_LE; SQRT_POS_LE; REAL_POW_2; + REAL_LE_SQUARE; REAL_LE_TRANS; POW_2_SQRT]);; + +let REAL_LT_RSQRT = prove + (`!x y. x pow 2 < y ==> x < sqrt(y)`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC(REAL_ARITH `abs x < a ==> x < a`) THEN + REWRITE_TAC[GSYM POW_2_SQRT_ABS] THEN MATCH_MP_TAC SQRT_MONO_LT THEN + ASM_REWRITE_TAC[REAL_POW_2; REAL_LE_SQUARE]);; + +let SQRT_EVEN_POW2 = prove + (`!n. EVEN n ==> (sqrt(&2 pow n) = &2 pow (n DIV 2))`, + SIMP_TAC[EVEN_EXISTS; LEFT_IMP_EXISTS_THM; DIV_MULT; ARITH_EQ] THEN + MESON_TAC[SQRT_UNIQUE; REAL_POW_POW; MULT_SYM; REAL_POW_LE; REAL_POS]);; + +let REAL_DIV_SQRT = prove + (`!x. &0 <= x ==> (x / sqrt(x) = sqrt(x))`, + REWRITE_TAC[REAL_LE_LT] THEN REPEAT STRIP_TAC THENL + [ALL_TAC; ASM_MESON_TAC[SQRT_0; real_div; REAL_MUL_LZERO]] THEN + ASM_SIMP_TAC[REAL_EQ_LDIV_EQ; SQRT_POS_LT; GSYM REAL_POW_2] THEN + ASM_SIMP_TAC[SQRT_POW_2; REAL_LT_IMP_LE]);; + +let REAL_RSQRT_LE = prove + (`!x y. &0 <= x /\ &0 <= y /\ x <= sqrt y ==> x pow 2 <= y`, + MESON_TAC[REAL_POW_LE2; SQRT_POW_2]);; + +let REAL_LSQRT_LE = prove + (`!x y. &0 <= x /\ sqrt x <= y ==> x <= y pow 2`, + MESON_TAC[REAL_POW_LE2; SQRT_POS_LE; REAL_LE_TRANS; SQRT_POW_2]);; + +(* ------------------------------------------------------------------------- *) +(* Hence derive more interesting properties of the norm. *) +(* ------------------------------------------------------------------------- *) + +let NORM_0 = prove + (`norm(vec 0) = &0`, + REWRITE_TAC[vector_norm; DOT_LZERO; SQRT_0]);; + +let NORM_POS_LE = prove + (`!x. &0 <= norm x`, + GEN_TAC THEN SIMP_TAC[DOT_POS_LE; vector_norm; SQRT_POS_LE]);; + +let NORM_NEG = prove + (`!x. norm(--x) = norm x`, + REWRITE_TAC[vector_norm; DOT_LNEG; DOT_RNEG; REAL_NEG_NEG]);; + +let NORM_SUB = prove + (`!x y. norm(x - y) = norm(y - x)`, + MESON_TAC[NORM_NEG; VECTOR_NEG_SUB]);; + +let NORM_MUL = prove + (`!a x. norm(a % x) = abs(a) * norm x`, + REWRITE_TAC[vector_norm; DOT_LMUL; DOT_RMUL; REAL_MUL_ASSOC] THEN + SIMP_TAC[SQRT_MUL; SQRT_POS_LE; DOT_POS_LE; REAL_LE_SQUARE] THEN + REWRITE_TAC[GSYM REAL_POW_2; POW_2_SQRT_ABS]);; + +let NORM_EQ_0_DOT = prove + (`!x. (norm x = &0) <=> (x dot x = &0)`, + SIMP_TAC[vector_norm; SQRT_EQ_0; DOT_POS_LE]);; + +let NORM_EQ_0 = prove + (`!x. (norm x = &0) <=> (x = vec 0)`, + SIMP_TAC[vector_norm; DOT_EQ_0; SQRT_EQ_0; DOT_POS_LE]);; + +let NORM_POS_LT = prove + (`!x. &0 < norm x <=> ~(x = vec 0)`, + MESON_TAC[REAL_LT_LE; NORM_POS_LE; NORM_EQ_0]);; + +let NORM_POW_2 = prove + (`!x. norm(x) pow 2 = x dot x`, + SIMP_TAC[vector_norm; SQRT_POW_2; DOT_POS_LE]);; + +let NORM_EQ_0_IMP = prove + (`!x. (norm x = &0) ==> (x = vec 0)`, + MESON_TAC[NORM_EQ_0]);; + +let NORM_LE_0 = prove + (`!x. norm x <= &0 <=> (x = vec 0)`, + MESON_TAC[REAL_LE_ANTISYM; NORM_EQ_0; NORM_POS_LE]);; + +let VECTOR_MUL_EQ_0 = prove + (`!a x. (a % x = vec 0) <=> (a = &0) \/ (x = vec 0)`, + REWRITE_TAC[GSYM NORM_EQ_0; NORM_MUL; REAL_ABS_ZERO; REAL_ENTIRE]);; + +let VECTOR_MUL_LCANCEL = prove + (`!a x y. (a % x = a % y) <=> (a = &0) \/ (x = y)`, + MESON_TAC[VECTOR_MUL_EQ_0; VECTOR_SUB_LDISTRIB; VECTOR_SUB_EQ]);; + +let VECTOR_MUL_RCANCEL = prove + (`!a b x. (a % x = b % x) <=> (a = b) \/ (x = vec 0)`, + MESON_TAC[VECTOR_MUL_EQ_0; VECTOR_SUB_RDISTRIB; REAL_SUB_0; VECTOR_SUB_EQ]);; + +let VECTOR_MUL_LCANCEL_IMP = prove + (`!a x y. ~(a = &0) /\ (a % x = a % y) ==> (x = y)`, + MESON_TAC[VECTOR_MUL_LCANCEL]);; + +let VECTOR_MUL_RCANCEL_IMP = prove + (`!a b x. ~(x = vec 0) /\ (a % x = b % x) ==> (a = b)`, + MESON_TAC[VECTOR_MUL_RCANCEL]);; + +let NORM_CAUCHY_SCHWARZ = prove + (`!(x:real^N) y. x dot y <= norm(x) * norm(y)`, + REPEAT STRIP_TAC THEN MAP_EVERY ASM_CASES_TAC + [`norm(x:real^N) = &0`; `norm(y:real^N) = &0`] THEN + ASM_SIMP_TAC[NORM_EQ_0_IMP; DOT_LZERO; DOT_RZERO; + REAL_MUL_LZERO; REAL_MUL_RZERO] THEN + MP_TAC(ISPEC `norm(y:real^N) % x - norm(x:real^N) % y` DOT_POS_LE) THEN + REWRITE_TAC[DOT_RSUB; DOT_LSUB; DOT_LMUL; DOT_RMUL; GSYM NORM_POW_2; + REAL_POW_2; REAL_LE_REFL] THEN + REWRITE_TAC[DOT_SYM; REAL_ARITH + `&0 <= y * (y * x * x - x * d) - x * (y * d - x * y * y) <=> + x * y * d <= x * y * x * y`] THEN + ASM_SIMP_TAC[REAL_LE_LMUL_EQ; REAL_LT_LE; NORM_POS_LE]);; + +let NORM_CAUCHY_SCHWARZ_ABS = prove + (`!x:real^N y. abs(x dot y) <= norm(x) * norm(y)`, + REPEAT GEN_TAC THEN MP_TAC(ISPEC `x:real^N` NORM_CAUCHY_SCHWARZ) THEN + DISCH_THEN(fun th -> MP_TAC(SPEC `y:real^N` th) THEN + MP_TAC(SPEC `--(y:real^N)` th)) THEN + REWRITE_TAC[DOT_RNEG; NORM_NEG] THEN REAL_ARITH_TAC);; + +let REAL_ABS_NORM = prove + (`!x. abs(norm x) = norm x`, + REWRITE_TAC[NORM_POS_LE; REAL_ABS_REFL]);; + +let NORM_CAUCHY_SCHWARZ_DIV = prove + (`!x:real^N y. abs((x dot y) / (norm x * norm y)) <= &1`, + REPEAT GEN_TAC THEN + MAP_EVERY ASM_CASES_TAC [`x:real^N = vec 0`; `y:real^N = vec 0`] THEN + ASM_REWRITE_TAC[NORM_0; REAL_MUL_LZERO; REAL_MUL_RZERO; real_div; + REAL_INV_1; DOT_LZERO; DOT_RZERO; REAL_ABS_NUM; REAL_POS] THEN + ASM_SIMP_TAC[GSYM real_div; REAL_ABS_DIV; REAL_LE_LDIV_EQ; REAL_LT_MUL; + REAL_ABS_INV; NORM_POS_LT; REAL_ABS_MUL; REAL_ABS_NORM] THEN + REWRITE_TAC[REAL_MUL_LID; NORM_CAUCHY_SCHWARZ_ABS]);; + +let NORM_TRIANGLE = prove + (`!x y. norm(x + y) <= norm(x) + norm(y)`, + REPEAT GEN_TAC THEN REWRITE_TAC[vector_norm] THEN + MATCH_MP_TAC REAL_LE_LSQRT THEN + SIMP_TAC[GSYM vector_norm; DOT_POS_LE; NORM_POS_LE; REAL_LE_ADD] THEN + REWRITE_TAC[DOT_LADD; DOT_RADD; REAL_POW_2; GSYM NORM_POW_2] THEN + SIMP_TAC[NORM_CAUCHY_SCHWARZ; DOT_SYM; REAL_ARITH + `d <= x * y ==> (x * x + d) + (d + y * y) <= (x + y) * (x + y)`]);; + +let NORM_TRIANGLE_SUB = prove + (`!x y:real^N. norm(x) <= norm(y) + norm(x - y)`, + MESON_TAC[NORM_TRIANGLE; VECTOR_SUB_ADD2]);; + +let NORM_TRIANGLE_LE = prove + (`!x y. norm(x) + norm(y) <= e ==> norm(x + y) <= e`, + MESON_TAC[REAL_LE_TRANS; NORM_TRIANGLE]);; + +let NORM_TRIANGLE_LT = prove + (`!x y. norm(x) + norm(y) < e ==> norm(x + y) < e`, + MESON_TAC[REAL_LET_TRANS; NORM_TRIANGLE]);; + +let COMPONENT_LE_NORM = prove + (`!x:real^N i. 1 <= i /\ i <= dimindex(:N) + ==> abs(x$i) <= norm x`, + REPEAT STRIP_TAC THEN REWRITE_TAC[vector_norm] THEN + MATCH_MP_TAC REAL_LE_RSQRT THEN REWRITE_TAC[GSYM REAL_ABS_POW] THEN + REWRITE_TAC[real_abs; REAL_POW_2; REAL_LE_SQUARE] THEN + SUBGOAL_THEN + `x$i * (x:real^N)$i = + sum(1..dimindex(:N)) (\k. if k = i then x$i * x$i else &0)` + SUBST1_TAC THENL + [REWRITE_TAC[SUM_DELTA] THEN ASM_REWRITE_TAC[IN_NUMSEG]; ALL_TAC] THEN + REWRITE_TAC[dot] THEN MATCH_MP_TAC SUM_LE THEN + REWRITE_TAC[FINITE_NUMSEG] THEN + REPEAT STRIP_TAC THEN COND_CASES_TAC THEN + ASM_REWRITE_TAC[REAL_LE_REFL; REAL_LE_SQUARE]);; + +let NORM_BOUND_COMPONENT_LE = prove + (`!x:real^N e. norm(x) <= e + ==> !i. 1 <= i /\ i <= dimindex(:N) ==> abs(x$i) <= e`, + MESON_TAC[COMPONENT_LE_NORM; REAL_LE_TRANS]);; + +let NORM_BOUND_COMPONENT_LT = prove + (`!x:real^N e. norm(x) < e + ==> !i. 1 <= i /\ i <= dimindex(:N) ==> abs(x$i) < e`, + MESON_TAC[COMPONENT_LE_NORM; REAL_LET_TRANS]);; + +let NORM_LE_L1 = prove + (`!x:real^N. norm x <= sum(1..dimindex(:N)) (\i. abs(x$i))`, + REPEAT GEN_TAC THEN REWRITE_TAC[vector_norm; dot] THEN + MATCH_MP_TAC REAL_LE_LSQRT THEN REWRITE_TAC[REAL_POW_2] THEN + SIMP_TAC[SUM_POS_LE; FINITE_NUMSEG; REAL_LE_SQUARE; REAL_ABS_POS] THEN + SPEC_TAC(`dimindex(:N)`,`n:num`) THEN INDUCT_TAC THEN + REWRITE_TAC[SUM_CLAUSES_NUMSEG; ARITH_EQ; ARITH_RULE `1 <= SUC n`] THEN + SIMP_TAC[REAL_MUL_LZERO; REAL_LE_REFL] THEN + MATCH_MP_TAC(REAL_ARITH + `a2 <= a * a /\ &0 <= a * b /\ b2 <= b * b + ==> a2 + b2 <= (a + b) * (a + b)`) THEN + ASM_SIMP_TAC[SUM_POS_LE; REAL_LE_MUL; REAL_ABS_POS; FINITE_NUMSEG] THEN + REWRITE_TAC[GSYM REAL_ABS_MUL] THEN REAL_ARITH_TAC);; + +let REAL_ABS_SUB_NORM = prove + (`abs(norm(x) - norm(y)) <= norm(x - y)`, + REWRITE_TAC[REAL_ARITH `abs(x - y) <= a <=> x <= y + a /\ y <= x + a`] THEN + MESON_TAC[NORM_TRIANGLE_SUB; NORM_SUB]);; + +let NORM_LE = prove + (`!x y. norm(x) <= norm(y) <=> x dot x <= y dot y`, + REWRITE_TAC[vector_norm] THEN MESON_TAC[SQRT_MONO_LE_EQ; DOT_POS_LE]);; + +let NORM_LT = prove + (`!x y. norm(x) < norm(y) <=> x dot x < y dot y`, + REWRITE_TAC[vector_norm] THEN MESON_TAC[SQRT_MONO_LT_EQ; DOT_POS_LE]);; + +let NORM_EQ = prove + (`!x y. (norm x = norm y) <=> (x dot x = y dot y)`, + REWRITE_TAC[GSYM REAL_LE_ANTISYM; NORM_LE]);; + +let NORM_EQ_1 = prove + (`!x. norm(x) = &1 <=> x dot x = &1`, + GEN_TAC THEN GEN_REWRITE_TAC (LAND_CONV o RAND_CONV) [GSYM SQRT_1] THEN + SIMP_TAC[vector_norm; SQRT_INJ; DOT_POS_LE; REAL_POS]);; + +let NORM_LE_COMPONENTWISE = prove + (`!x:real^N y:real^N. + (!i. 1 <= i /\ i <= dimindex(:N) ==> abs(x$i) <= abs(y$i)) + ==> norm(x) <= norm(y)`, + REPEAT STRIP_TAC THEN REWRITE_TAC[NORM_LE; dot] THEN + MATCH_MP_TAC SUM_LE_NUMSEG THEN + ASM_SIMP_TAC[GSYM REAL_POW_2; GSYM REAL_LE_SQUARE_ABS]);; + +(* ------------------------------------------------------------------------- *) +(* Squaring equations and inequalities involving norms. *) +(* ------------------------------------------------------------------------- *) + +let DOT_SQUARE_NORM = prove + (`!x. x dot x = norm(x) pow 2`, + SIMP_TAC[vector_norm; SQRT_POW_2; DOT_POS_LE]);; + +let NORM_EQ_SQUARE = prove + (`!x:real^N. norm(x) = a <=> &0 <= a /\ x dot x = a pow 2`, + REWRITE_TAC[DOT_SQUARE_NORM] THEN + ONCE_REWRITE_TAC[REAL_RING `x pow 2 = a pow 2 <=> x = a \/ x + a = &0`] THEN + GEN_TAC THEN MP_TAC(ISPEC `x:real^N` NORM_POS_LE) THEN REAL_ARITH_TAC);; + +let NORM_LE_SQUARE = prove + (`!x:real^N. norm(x) <= a <=> &0 <= a /\ x dot x <= a pow 2`, + REWRITE_TAC[DOT_SQUARE_NORM; GSYM REAL_LE_SQUARE_ABS] THEN + GEN_TAC THEN MP_TAC(ISPEC `x:real^N` NORM_POS_LE) THEN REAL_ARITH_TAC);; + +let NORM_GE_SQUARE = prove + (`!x:real^N. norm(x) >= a <=> a <= &0 \/ x dot x >= a pow 2`, + REWRITE_TAC[real_ge; DOT_SQUARE_NORM; GSYM REAL_LE_SQUARE_ABS] THEN + GEN_TAC THEN MP_TAC(ISPEC `x:real^N` NORM_POS_LE) THEN REAL_ARITH_TAC);; + +let NORM_LT_SQUARE = prove + (`!x:real^N. norm(x) < a <=> &0 < a /\ x dot x < a pow 2`, + REWRITE_TAC[REAL_ARITH `x < a <=> ~(x >= a)`; NORM_GE_SQUARE] THEN + REAL_ARITH_TAC);; + +let NORM_GT_SQUARE = prove + (`!x:real^N. norm(x) > a <=> a < &0 \/ x dot x > a pow 2`, + REWRITE_TAC[REAL_ARITH `x > a <=> ~(x <= a)`; NORM_LE_SQUARE] THEN + REAL_ARITH_TAC);; + +let NORM_LT_SQUARE_ALT = prove + (`!x:real^N. norm(x) < a <=> &0 <= a /\ x dot x < a pow 2`, + REWRITE_TAC[REAL_ARITH `x < a <=> ~(x >= a)`; NORM_GE_SQUARE] THEN + REPEAT GEN_TAC THEN ASM_CASES_TAC `a = &0` THENL + [ASM_REWRITE_TAC[real_ge] THEN CONV_TAC REAL_RAT_REDUCE_CONV THEN + REWRITE_TAC[DOT_POS_LE]; + ASM_REAL_ARITH_TAC]);; + +(* ------------------------------------------------------------------------- *) +(* General linear decision procedure for normed spaces. *) +(* ------------------------------------------------------------------------- *) + +let NORM_ARITH = + let find_normedterms = + let augment_norm b tm acc = + match tm with + Comb(Const("vector_norm",_),v) -> insert (b,v) acc + | _ -> acc in + let rec find_normedterms tm acc = + match tm with + Comb(Comb(Const("real_add",_),l),r) -> + find_normedterms l (find_normedterms r acc) + | Comb(Comb(Const("real_mul",_),c),n) -> + if not (is_ratconst c) then acc else + augment_norm (rat_of_term c >=/ Int 0) n acc + | _ -> augment_norm true tm acc in + find_normedterms in + let lincomb_neg t = mapf minus_num t in + let lincomb_cmul c t = if c =/ Int 0 then undefined else mapf (( */ ) c) t in + let lincomb_add l r = combine (+/) (fun x -> x =/ Int 0) l r in + let lincomb_sub l r = lincomb_add l (lincomb_neg r) in + let lincomb_eq l r = lincomb_sub l r = undefined in + let rec vector_lincomb tm = + match tm with + Comb(Comb(Const("vector_add",_),l),r) -> + lincomb_add (vector_lincomb l) (vector_lincomb r) + | Comb(Comb(Const("vector_sub",_),l),r) -> + lincomb_sub (vector_lincomb l) (vector_lincomb r) + | Comb(Comb(Const("%",_),l),r) -> + lincomb_cmul (rat_of_term l) (vector_lincomb r) + | Comb(Const("vector_neg",_),t) -> + lincomb_neg (vector_lincomb t) + | Comb(Const("vec",_),n) when is_numeral n & dest_numeral n =/ Int 0 -> + undefined + | _ -> (tm |=> Int 1) in + let vector_lincombs tms = + itlist (fun t fns -> + if can (assoc t) fns then fns else + let f = vector_lincomb t in + try let _,f' = find (fun (_,f') -> lincomb_eq f f') fns in + (t,f')::fns + with Failure _ -> (t,f)::fns) tms [] in + let rec replacenegnorms fn tm = + match tm with + Comb(Comb(Const("real_add",_),l),r) -> + BINOP_CONV (replacenegnorms fn) tm + | Comb(Comb(Const("real_mul",_),c),n) when rat_of_term c + RAND_CONV fn tm + | _ -> REFL tm in + let flip v eq = + if defined eq v then (v |-> minus_num(apply eq v)) eq else eq in + let rec allsubsets s = + match s with + [] -> [[]] + | (a::t) -> let res = allsubsets t in + map (fun b -> a::b) res @ res in + let evaluate env lin = + foldr (fun x c s -> s +/ c */ apply env x) lin (Int 0) in + let rec solve (vs,eqs) = + match (vs,eqs) with + [],[] -> (0 |=> Int 1) + | _,eq::oeqs -> + let v = hd(intersect vs (dom eq)) in + let c = apply eq v in + let vdef = lincomb_cmul (Int(-1) // c) eq in + let eliminate eqn = + if not(defined eqn v) then eqn else + lincomb_add (lincomb_cmul (apply eqn v) vdef) eqn in + let soln = solve (subtract vs [v],map eliminate oeqs) in + (v |-> evaluate soln (undefine v vdef)) soln in + let rec combinations k l = + if k = 0 then [[]] else + match l with + [] -> [] + | h::t -> map (fun c -> h::c) (combinations (k - 1) t) @ + combinations k t in + let vertices vs eqs = + let vertex cmb = + let soln = solve(vs,cmb) in + map (fun v -> tryapplyd soln v (Int 0)) vs in + let rawvs = mapfilter vertex (combinations (length vs) eqs) in + let unset = filter (forall (fun c -> c >=/ Int 0)) rawvs in + itlist (insert' (forall2 (=/))) unset [] in + let subsumes l m = forall2 (fun x y -> abs_num x <=/ abs_num y) l m in + let rec subsume todo dun = + match todo with + [] -> dun + | v::ovs -> let dun' = if exists (fun w -> subsumes w v) dun then dun + else v::(filter (fun w -> not(subsumes v w)) dun) in + subsume ovs dun' in + let NORM_CMUL_RULE = + let MATCH_pth = (MATCH_MP o prove) + (`!b x. b >= norm(x) ==> !c. abs(c) * b >= norm(c % x)`, + SIMP_TAC[NORM_MUL; real_ge; REAL_LE_LMUL; REAL_ABS_POS]) in + fun c th -> ISPEC(term_of_rat c) (MATCH_pth th) in + let NORM_ADD_RULE = + let MATCH_pth = (MATCH_MP o prove) + (`!b1 b2 x1 x2. b1 >= norm(x1) /\ b2 >= norm(x2) + ==> b1 + b2 >= norm(x1 + x2)`, + REWRITE_TAC[real_ge] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC NORM_TRIANGLE_LE THEN ASM_SIMP_TAC[REAL_LE_ADD2]) in + fun th1 th2 -> MATCH_pth (CONJ th1 th2) in + let INEQUALITY_CANON_RULE = + CONV_RULE(LAND_CONV REAL_POLY_CONV) o + CONV_RULE(LAND_CONV REAL_RAT_REDUCE_CONV) o + GEN_REWRITE_RULE I [REAL_ARITH `s >= t <=> s - t >= &0`] in + let NORM_CANON_CONV = + let APPLY_pth1 = GEN_REWRITE_CONV I + [VECTOR_ARITH `x:real^N = &1 % x`] + and APPLY_pth2 = GEN_REWRITE_CONV I + [VECTOR_ARITH `x - y:real^N = x + --y`] + and APPLY_pth3 = GEN_REWRITE_CONV I + [VECTOR_ARITH `--x:real^N = -- &1 % x`] + and APPLY_pth4 = GEN_REWRITE_CONV I + [VECTOR_ARITH `&0 % x:real^N = vec 0`; + VECTOR_ARITH `c % vec 0:real^N = vec 0`] + and APPLY_pth5 = GEN_REWRITE_CONV I + [VECTOR_ARITH `c % (d % x) = (c * d) % x`] + and APPLY_pth6 = GEN_REWRITE_CONV I + [VECTOR_ARITH `c % (x + y) = c % x + c % y`] + and APPLY_pth7 = GEN_REWRITE_CONV I + [VECTOR_ARITH `vec 0 + x = x`; + VECTOR_ARITH `x + vec 0 = x`] + and APPLY_pth8 = + GEN_REWRITE_CONV I [VECTOR_ARITH `c % x + d % x = (c + d) % x`] THENC + LAND_CONV REAL_RAT_ADD_CONV THENC + GEN_REWRITE_CONV TRY_CONV [VECTOR_ARITH `&0 % x = vec 0`] + and APPLY_pth9 = + GEN_REWRITE_CONV I + [VECTOR_ARITH `(c % x + z) + d % x = (c + d) % x + z`; + VECTOR_ARITH `c % x + (d % x + z) = (c + d) % x + z`; + VECTOR_ARITH `(c % x + w) + (d % x + z) = (c + d) % x + (w + z)`] THENC + LAND_CONV(LAND_CONV REAL_RAT_ADD_CONV) + and APPLY_ptha = + GEN_REWRITE_CONV I [VECTOR_ARITH `&0 % x + y = y`] + and APPLY_pthb = + GEN_REWRITE_CONV I + [VECTOR_ARITH `c % x + d % y = c % x + d % y`; + VECTOR_ARITH `(c % x + z) + d % y = c % x + (z + d % y)`; + VECTOR_ARITH `c % x + (d % y + z) = c % x + (d % y + z)`; + VECTOR_ARITH `(c % x + w) + (d % y + z) = c % x + (w + (d % y + z))`] + and APPLY_pthc = + GEN_REWRITE_CONV I + [VECTOR_ARITH `c % x + d % y = d % y + c % x`; + VECTOR_ARITH `(c % x + z) + d % y = d % y + (c % x + z)`; + VECTOR_ARITH `c % x + (d % y + z) = d % y + (c % x + z)`; + VECTOR_ARITH `(c % x + w) + (d % y + z) = d % y + ((c % x + w) + z)`] + and APPLY_pthd = + GEN_REWRITE_CONV TRY_CONV + [VECTOR_ARITH `x + vec 0 = x`] in + let headvector tm = + match tm with + Comb(Comb(Const("vector_add",_),Comb(Comb(Const("%",_),l),v)),r) -> v + | Comb(Comb(Const("%",_),l),v) -> v + | _ -> failwith "headvector: non-canonical term" in + let rec VECTOR_CMUL_CONV tm = + ((APPLY_pth5 THENC LAND_CONV REAL_RAT_MUL_CONV) ORELSEC + (APPLY_pth6 THENC BINOP_CONV VECTOR_CMUL_CONV)) tm + and VECTOR_ADD_CONV tm = + try APPLY_pth7 tm with Failure _ -> + try APPLY_pth8 tm with Failure _ -> + match tm with + Comb(Comb(Const("vector_add",_),lt),rt) -> + let l = headvector lt and r = headvector rt in + if l < r then (APPLY_pthb THENC + RAND_CONV VECTOR_ADD_CONV THENC + APPLY_pthd) tm + else if r < l then (APPLY_pthc THENC + RAND_CONV VECTOR_ADD_CONV THENC + APPLY_pthd) tm else + (APPLY_pth9 THENC + ((APPLY_ptha THENC VECTOR_ADD_CONV) ORELSEC + RAND_CONV VECTOR_ADD_CONV THENC + APPLY_pthd)) tm + | _ -> REFL tm in + let rec VECTOR_CANON_CONV tm = + match tm with + Comb(Comb(Const("vector_add",_),l),r) -> + let lth = VECTOR_CANON_CONV l and rth = VECTOR_CANON_CONV r in + let th = MK_COMB(AP_TERM (rator(rator tm)) lth,rth) in + CONV_RULE (RAND_CONV VECTOR_ADD_CONV) th + | Comb(Comb(Const("%",_),l),r) -> + let rth = AP_TERM (rator tm) (VECTOR_CANON_CONV r) in + CONV_RULE (RAND_CONV(APPLY_pth4 ORELSEC VECTOR_CMUL_CONV)) rth + | Comb(Comb(Const("vector_sub",_),l),r) -> + (APPLY_pth2 THENC VECTOR_CANON_CONV) tm + | Comb(Const("vector_neg",_),t) -> + (APPLY_pth3 THENC VECTOR_CANON_CONV) tm + | Comb(Const("vec",_),n) when is_numeral n & dest_numeral n =/ Int 0 -> + REFL tm + | _ -> APPLY_pth1 tm in + fun tm -> + match tm with + Comb(Const("vector_norm",_),e) -> RAND_CONV VECTOR_CANON_CONV tm + | _ -> failwith "NORM_CANON_CONV" in + let REAL_VECTOR_COMBO_PROVER = + let pth_zero = prove(`norm(vec 0:real^N) = &0`,REWRITE_TAC[NORM_0]) + and tv_n = mk_vartype "N" in + fun translator (nubs,ges,gts) -> + let sources = map (rand o rand o concl) nubs + and rawdests = itlist (find_normedterms o lhand o concl) (ges @ gts) [] in + if not (forall fst rawdests) then failwith "Sanity check" else + let dests = setify (map snd rawdests) in + let srcfuns = map vector_lincomb sources + and destfuns = map vector_lincomb dests in + let vvs = itlist (union o dom) (srcfuns @ destfuns) [] in + let n = length srcfuns in + let nvs = 1--n in + let srccombs = zip srcfuns nvs in + let consider d = + let coefficients x = + let inp = if defined d x then 0 |=> minus_num(apply d x) + else undefined in + itlist (fun (f,v) g -> if defined f x then (v |-> apply f x) g else g) + srccombs inp in + let equations = map coefficients vvs + and inequalities = map (fun n -> (n |=> Int 1)) nvs in + let plausiblevertices f = + let flippedequations = map (itlist flip f) equations in + let constraints = flippedequations @ inequalities in + let rawverts = vertices nvs constraints in + let check_solution v = + let f = itlist2 (|->) nvs v (0 |=> Int 1) in + forall (fun e -> evaluate f e =/ Int 0) flippedequations in + let goodverts = filter check_solution rawverts in + let signfixups = map (fun n -> if mem n f then -1 else 1) nvs in + map (map2 (fun s c -> Int s */ c) signfixups) goodverts in + let allverts = itlist (@) (map plausiblevertices (allsubsets nvs)) [] in + subsume allverts [] in + let compute_ineq v = + let ths = mapfilter (fun (v,t) -> if v =/ Int 0 then fail() + else NORM_CMUL_RULE v t) + (zip v nubs) in + INEQUALITY_CANON_RULE (end_itlist NORM_ADD_RULE ths) in + let ges' = mapfilter compute_ineq (itlist ((@) o consider) destfuns []) @ + map INEQUALITY_CANON_RULE nubs @ ges in + let zerodests = filter + (fun t -> dom(vector_lincomb t) = []) (map snd rawdests) in + REAL_LINEAR_PROVER translator + (map (fun t -> INST_TYPE [last(snd(dest_type(type_of t))),tv_n] pth_zero) + zerodests, + map (CONV_RULE(ONCE_DEPTH_CONV NORM_CANON_CONV THENC + LAND_CONV REAL_POLY_CONV)) ges', + map (CONV_RULE(ONCE_DEPTH_CONV NORM_CANON_CONV THENC + LAND_CONV REAL_POLY_CONV)) gts) in + let REAL_VECTOR_INEQ_PROVER = + let pth = prove + (`norm(x) = n ==> norm(x) >= &0 /\ n >= norm(x)`, + DISCH_THEN(SUBST_ALL_TAC o SYM) THEN + REWRITE_TAC[real_ge; NORM_POS_LE] THEN REAL_ARITH_TAC) in + let NORM_MP = MATCH_MP pth in + fun translator (ges,gts) -> + let ntms = itlist find_normedterms (map (lhand o concl) (ges @ gts)) [] in + let lctab = vector_lincombs (map snd (filter (not o fst) ntms)) in + let asl = map (fun (t,_) -> + ASSUME(mk_eq(mk_icomb(mk_const("vector_norm",[]),t), + genvar `:real`))) lctab in + let replace_conv = GEN_REWRITE_CONV TRY_CONV asl in + let replace_rule = CONV_RULE (LAND_CONV (replacenegnorms replace_conv)) in + let ges' = + itlist (fun th ths -> CONJUNCT1(NORM_MP th)::ths) + asl (map replace_rule ges) + and gts' = map replace_rule gts + and nubs = map (CONJUNCT2 o NORM_MP) asl in + let th1 = REAL_VECTOR_COMBO_PROVER translator (nubs,ges',gts') in + let th2 = INST + (map (fun th -> let l,r = dest_eq(concl th) in (l,r)) asl) th1 in + itlist PROVE_HYP (map (REFL o lhand o concl) asl) th2 in + let REAL_VECTOR_PROVER = + let rawrule = + GEN_REWRITE_RULE I [REAL_ARITH `x = &0 <=> x >= &0 /\ --x >= &0`] in + let splitequation th acc = + let th1,th2 = CONJ_PAIR(rawrule th) in + th1::CONV_RULE(LAND_CONV REAL_POLY_NEG_CONV) th2::acc in + fun translator (eqs,ges,gts) -> + REAL_VECTOR_INEQ_PROVER translator + (itlist splitequation eqs ges,gts) in + let pth = prove + (`(!x y:real^N. x = y <=> norm(x - y) <= &0) /\ + (!x y:real^N. ~(x = y) <=> ~(norm(x - y) <= &0))`, + REWRITE_TAC[NORM_LE_0; VECTOR_SUB_EQ]) in + let conv1 = GEN_REWRITE_CONV TRY_CONV [pth] in + let conv2 tm = (conv1 tm,conv1(mk_neg tm)) in + let init = GEN_REWRITE_CONV ONCE_DEPTH_CONV [DECIMAL] THENC + REAL_RAT_REDUCE_CONV THENC + GEN_REWRITE_CONV ONCE_DEPTH_CONV [dist] THENC + GEN_NNF_CONV true (conv1,conv2) + and pure = GEN_REAL_ARITH REAL_VECTOR_PROVER in + fun tm -> let th = init tm in EQ_MP (SYM th) (pure(rand(concl th)));; + +let NORM_ARITH_TAC = CONV_TAC NORM_ARITH;; + +let ASM_NORM_ARITH_TAC = + REPEAT(FIRST_X_ASSUM(MP_TAC o check (not o is_forall o concl))) THEN + NORM_ARITH_TAC;; + +(* ------------------------------------------------------------------------- *) +(* Dot product in terms of the norm rather than conversely. *) +(* ------------------------------------------------------------------------- *) + +let DOT_NORM = prove + (`!x y. x dot y = (norm(x + y) pow 2 - norm(x) pow 2 - norm(y) pow 2) / &2`, + REWRITE_TAC[NORM_POW_2; DOT_LADD; DOT_RADD; DOT_SYM] THEN REAL_ARITH_TAC);; + +let DOT_NORM_NEG = prove + (`!x y. x dot y = ((norm(x) pow 2 + norm(y) pow 2) - norm(x - y) pow 2) / &2`, + REWRITE_TAC[NORM_POW_2; DOT_LADD; DOT_RADD; DOT_LSUB; DOT_RSUB; DOT_SYM] THEN + REAL_ARITH_TAC);; + +(* ------------------------------------------------------------------------- *) +(* Equality of vectors in terms of dot products. *) +(* ------------------------------------------------------------------------- *) + +let VECTOR_EQ = prove + (`!x y. (x = y) <=> (x dot x = x dot y) /\ (y dot y = x dot x)`, + REPEAT GEN_TAC THEN EQ_TAC THENL [SIMP_TAC[]; ALL_TAC] THEN + ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN + REWRITE_TAC[GSYM DOT_EQ_0] THEN + SIMP_TAC[DOT_LSUB; DOT_RSUB; DOT_SYM] THEN REAL_ARITH_TAC);; + +(* ------------------------------------------------------------------------- *) +(* Hence more metric properties. *) +(* ------------------------------------------------------------------------- *) + +let DIST_REFL = prove + (`!x. dist(x,x) = &0`, + NORM_ARITH_TAC);; + +let DIST_SYM = prove + (`!x y. dist(x,y) = dist(y,x)`, + NORM_ARITH_TAC);; + +let DIST_POS_LE = prove + (`!x y. &0 <= dist(x,y)`, + NORM_ARITH_TAC);; + +let DIST_TRIANGLE = prove + (`!x:real^N y z. dist(x,z) <= dist(x,y) + dist(y,z)`, + NORM_ARITH_TAC);; + +let DIST_TRIANGLE_ALT = prove + (`!x y z. dist(y,z) <= dist(x,y) + dist(x,z)`, + NORM_ARITH_TAC);; + +let DIST_EQ_0 = prove + (`!x y. (dist(x,y) = &0) <=> (x = y)`, + NORM_ARITH_TAC);; + +let DIST_POS_LT = prove + (`!x y. ~(x = y) ==> &0 < dist(x,y)`, + NORM_ARITH_TAC);; + +let DIST_NZ = prove + (`!x y. ~(x = y) <=> &0 < dist(x,y)`, + NORM_ARITH_TAC);; + +let DIST_TRIANGLE_LE = prove + (`!x y z e. dist(x,z) + dist(y,z) <= e ==> dist(x,y) <= e`, + NORM_ARITH_TAC);; + +let DIST_TRIANGLE_LT = prove + (`!x y z e. dist(x,z) + dist(y,z) < e ==> dist(x,y) < e`, + NORM_ARITH_TAC);; + +let DIST_TRIANGLE_HALF_L = prove + (`!x1 x2 y. dist(x1,y) < e / &2 /\ dist(x2,y) < e / &2 ==> dist(x1,x2) < e`, + NORM_ARITH_TAC);; + +let DIST_TRIANGLE_HALF_R = prove + (`!x1 x2 y. dist(y,x1) < e / &2 /\ dist(y,x2) < e / &2 ==> dist(x1,x2) < e`, + NORM_ARITH_TAC);; + +let DIST_TRIANGLE_ADD = prove + (`!x x' y y'. dist(x + y,x' + y') <= dist(x,x') + dist(y,y')`, + NORM_ARITH_TAC);; + +let DIST_MUL = prove + (`!x y c. dist(c % x,c % y) = abs(c) * dist(x,y)`, + REWRITE_TAC[dist; GSYM VECTOR_SUB_LDISTRIB; NORM_MUL]);; + +let DIST_TRIANGLE_ADD_HALF = prove + (`!x x' y y':real^N. + dist(x,x') < e / &2 /\ dist(y,y') < e / &2 ==> dist(x + y,x' + y') < e`, + NORM_ARITH_TAC);; + +let DIST_LE_0 = prove + (`!x y. dist(x,y) <= &0 <=> x = y`, + NORM_ARITH_TAC);; + +let DIST_EQ = prove + (`!w x y z. dist(w,x) = dist(y,z) <=> dist(w,x) pow 2 = dist(y,z) pow 2`, + REWRITE_TAC[dist; NORM_POW_2; NORM_EQ]);; + +let DIST_0 = prove + (`!x. dist(x,vec 0) = norm(x) /\ dist(vec 0,x) = norm(x)`, + NORM_ARITH_TAC);; + +(* ------------------------------------------------------------------------- *) +(* Sums of vectors. *) +(* ------------------------------------------------------------------------- *) + +let NEUTRAL_VECTOR_ADD = prove + (`neutral(+) = vec 0:real^N`, + REWRITE_TAC[neutral] THEN MATCH_MP_TAC SELECT_UNIQUE THEN + REWRITE_TAC[VECTOR_ARITH `x + y = y <=> x = vec 0`; + VECTOR_ARITH `x + y = x <=> y = vec 0`]);; + +let MONOIDAL_VECTOR_ADD = prove + (`monoidal((+):real^N->real^N->real^N)`, + REWRITE_TAC[monoidal; NEUTRAL_VECTOR_ADD] THEN + REPEAT CONJ_TAC THEN VECTOR_ARITH_TAC);; + +let vsum = new_definition + `(vsum:(A->bool)->(A->real^N)->real^N) s f = lambda i. sum s (\x. f(x)$i)`;; + +let VSUM_CLAUSES = prove + (`(!f. vsum {} f = vec 0) /\ + (!x f s. FINITE s + ==> (vsum (x INSERT s) f = + if x IN s then vsum s f else f(x) + vsum s f))`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; VECTOR_ADD_COMPONENT; SUM_CLAUSES] THEN + SIMP_TAC[VEC_COMPONENT] THEN REPEAT STRIP_TAC THEN + COND_CASES_TAC THEN ASM_SIMP_TAC[LAMBDA_BETA; VECTOR_ADD_COMPONENT]);; + +let VSUM = prove + (`!f s. FINITE s ==> vsum s f = iterate (+) s f`, + GEN_TAC THEN MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + ASM_SIMP_TAC[VSUM_CLAUSES; ITERATE_CLAUSES; MONOIDAL_VECTOR_ADD] THEN + REWRITE_TAC[NEUTRAL_VECTOR_ADD]);; + +let VSUM_EQ_0 = prove + (`!f s. (!x:A. x IN s ==> (f(x) = vec 0)) ==> (vsum s f = vec 0)`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; vec; SUM_EQ_0]);; + +let VSUM_0 = prove + (`vsum s (\x. vec 0) = vec 0`, + SIMP_TAC[VSUM_EQ_0]);; + +let VSUM_LMUL = prove + (`!f c s. vsum s (\x. c % f(x)) = c % vsum s f`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; VECTOR_MUL_COMPONENT; SUM_LMUL]);; + +let VSUM_RMUL = prove + (`!c s v. vsum s (\x. c x % v) = (sum s c) % v`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; VECTOR_MUL_COMPONENT; SUM_RMUL]);; + +let VSUM_ADD = prove + (`!f g s. FINITE s ==> (vsum s (\x. f x + g x) = vsum s f + vsum s g)`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; VECTOR_ADD_COMPONENT; SUM_ADD]);; + +let VSUM_SUB = prove + (`!f g s. FINITE s ==> (vsum s (\x. f x - g x) = vsum s f - vsum s g)`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; VECTOR_SUB_COMPONENT; SUM_SUB]);; + +let VSUM_CONST = prove + (`!c s. FINITE s ==> (vsum s (\n. c) = &(CARD s) % c)`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; SUM_CONST; VECTOR_MUL_COMPONENT]);; + +let VSUM_COMPONENT = prove + (`!s f i. 1 <= i /\ i <= dimindex(:N) + ==> ((vsum s (f:A->real^N))$i = sum s (\x. f(x)$i))`, + SIMP_TAC[vsum; LAMBDA_BETA]);; + +let VSUM_IMAGE = prove + (`!f g s. FINITE s /\ (!x y. x IN s /\ y IN s /\ (f x = f y) ==> (x = y)) + ==> (vsum (IMAGE f s) g = vsum s (g o f))`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA] THEN REPEAT STRIP_TAC THEN + W(MP_TAC o PART_MATCH (lhs o rand) SUM_IMAGE o lhs o snd) THEN + ASM_REWRITE_TAC[o_DEF]);; + +let VSUM_UNION = prove + (`!f s t. FINITE s /\ FINITE t /\ DISJOINT s t + ==> (vsum (s UNION t) f = vsum s f + vsum t f)`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; SUM_UNION; VECTOR_ADD_COMPONENT]);; + +let VSUM_DIFF = prove + (`!f s t. FINITE s /\ t SUBSET s + ==> (vsum (s DIFF t) f = vsum s f - vsum t f)`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; SUM_DIFF; VECTOR_SUB_COMPONENT]);; + +let VSUM_DELETE = prove + (`!f s a. FINITE s /\ a IN s + ==> vsum (s DELETE a) f = vsum s f - f a`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; SUM_DELETE; VECTOR_SUB_COMPONENT]);; + +let VSUM_INCL_EXCL = prove + (`!s t (f:A->real^N). + FINITE s /\ FINITE t + ==> vsum s f + vsum t f = vsum (s UNION t) f + vsum (s INTER t) f`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; VECTOR_ADD_COMPONENT] THEN + SIMP_TAC[SUM_INCL_EXCL]);; + +let VSUM_NEG = prove + (`!f s. vsum s (\x. --f x) = --vsum s f`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; SUM_NEG; VECTOR_NEG_COMPONENT]);; + +let VSUM_EQ = prove + (`!f g s. (!x. x IN s ==> (f x = g x)) ==> (vsum s f = vsum s g)`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC SUM_EQ THEN ASM_SIMP_TAC[]);; + +let VSUM_SUPERSET = prove + (`!f:A->real^N u v. + u SUBSET v /\ (!x. x IN v /\ ~(x IN u) ==> (f(x) = vec 0)) + ==> (vsum v f = vsum u f)`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; VEC_COMPONENT; SUM_SUPERSET]);; + +let VSUM_EQ_SUPERSET = prove + (`!f s t:A->bool. + FINITE t /\ t SUBSET s /\ + (!x. x IN t ==> (f x = g x)) /\ + (!x. x IN s /\ ~(x IN t) ==> f(x) = vec 0) + ==> vsum s f = vsum t g`, + MESON_TAC[VSUM_SUPERSET; VSUM_EQ]);; + +let VSUM_UNION_RZERO = prove + (`!f:A->real^N u v. + FINITE u /\ (!x. x IN v /\ ~(x IN u) ==> (f(x) = vec 0)) + ==> (vsum (u UNION v) f = vsum u f)`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; VEC_COMPONENT; SUM_UNION_RZERO]);; + +let VSUM_UNION_LZERO = prove + (`!f:A->real^N u v. + FINITE v /\ (!x. x IN u /\ ~(x IN v) ==> (f(x) = vec 0)) + ==> (vsum (u UNION v) f = vsum v f)`, + MESON_TAC[VSUM_UNION_RZERO; UNION_COMM]);; + +let VSUM_RESTRICT = prove + (`!f s. FINITE s + ==> (vsum s (\x. if x IN s then f(x) else vec 0) = vsum s f)`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC VSUM_EQ THEN ASM_SIMP_TAC[]);; + +let VSUM_RESTRICT_SET = prove + (`!P s f. vsum {x | x IN s /\ P x} f = + vsum s (\x. if P x then f x else vec 0)`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; VEC_COMPONENT; SUM_RESTRICT_SET; + COND_COMPONENT]);; + +let VSUM_CASES = prove + (`!s P f g. FINITE s + ==> vsum s (\x:A. if P x then (f x):real^N else g x) = + vsum {x | x IN s /\ P x} f + vsum {x | x IN s /\ ~P x} g`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; VECTOR_ADD_COMPONENT; SUM_CASES; + COND_COMPONENT]);; + +let VSUM_SING = prove + (`!f x. vsum {x} f = f(x)`, + SIMP_TAC[VSUM_CLAUSES; FINITE_RULES; NOT_IN_EMPTY; VECTOR_ADD_RID]);; + +let VSUM_NORM = prove + (`!f s. FINITE s ==> norm(vsum s f) <= sum s (\x. norm(f x))`, + GEN_TAC THEN MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + SIMP_TAC[SUM_CLAUSES; VSUM_CLAUSES; NORM_0; REAL_LE_REFL] THEN + NORM_ARITH_TAC);; + +let VSUM_NORM_LE = prove + (`!s f:A->real^N g. + FINITE s /\ (!x. x IN s ==> norm(f x) <= g(x)) + ==> norm(vsum s f) <= sum s g`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `sum s (\x:A. norm(f x :real^N))` THEN + ASM_SIMP_TAC[VSUM_NORM; SUM_LE]);; + +let VSUM_NORM_TRIANGLE = prove + (`!s f b. FINITE s /\ sum s (\a. norm(f a)) <= b + ==> norm(vsum s f) <= b`, + MESON_TAC[VSUM_NORM; REAL_LE_TRANS]);; + +let VSUM_NORM_BOUND = prove + (`!s f b. FINITE s /\ (!x:A. x IN s ==> norm(f(x)) <= b) + ==> norm(vsum s f) <= &(CARD s) * b`, + SIMP_TAC[GSYM SUM_CONST; VSUM_NORM_LE]);; + +let VSUM_CLAUSES_NUMSEG = prove + (`(!m. vsum(m..0) f = if m = 0 then f(0) else vec 0) /\ + (!m n. vsum(m..SUC n) f = if m <= SUC n then vsum(m..n) f + f(SUC n) + else vsum(m..n) f)`, + REWRITE_TAC[NUMSEG_CLAUSES] THEN REPEAT STRIP_TAC THEN + COND_CASES_TAC THEN + ASM_SIMP_TAC[VSUM_SING; VSUM_CLAUSES; FINITE_NUMSEG; IN_NUMSEG] THEN + REWRITE_TAC[ARITH_RULE `~(SUC n <= n)`; VECTOR_ADD_AC]);; + +let VSUM_CLAUSES_RIGHT = prove + (`!f m n. 0 < n /\ m <= n ==> vsum(m..n) f = vsum(m..n-1) f + (f n):real^N`, + GEN_TAC THEN GEN_TAC THEN INDUCT_TAC THEN + SIMP_TAC[LT_REFL; VSUM_CLAUSES_NUMSEG; SUC_SUB1]);; + +let VSUM_CMUL_NUMSEG = prove + (`!f c m n. vsum (m..n) (\x. c % f x) = c % vsum (m..n) f`, + SIMP_TAC[VSUM_LMUL; FINITE_NUMSEG]);; + +let VSUM_EQ_NUMSEG = prove + (`!f g m n. + (!x. m <= x /\ x <= n ==> (f x = g x)) + ==> (vsum(m .. n) f = vsum(m .. n) g)`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC VSUM_EQ THEN + ASM_SIMP_TAC[FINITE_NUMSEG; IN_NUMSEG]);; + +let VSUM_IMAGE_GEN = prove + (`!f:A->B g s. + FINITE s + ==> (vsum s g = + vsum (IMAGE f s) (\y. vsum {x | x IN s /\ (f(x) = y)} g))`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; SUM_IMAGE_GEN]);; + +let VSUM_GROUP = prove + (`!f:A->B g s t. + FINITE s /\ IMAGE f s SUBSET t + ==> vsum t (\y. vsum {x | x IN s /\ f(x) = y} g) = vsum s g`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; SUM_GROUP]);; + +let VSUM_VMUL = prove + (`!f v s. FINITE s ==> ((sum s f) % v = vsum s (\x. f(x) % v))`, + GEN_TAC THEN GEN_TAC THEN MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + ASM_SIMP_TAC[SUM_CLAUSES; VSUM_CLAUSES] THEN + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[VECTOR_ADD_RDISTRIB] THEN + VECTOR_ARITH_TAC);; + +let VSUM_DELTA = prove + (`!s a. vsum s (\x. if x = a then b else vec 0) = + if a IN s then b else vec 0`, + SIMP_TAC[CART_EQ; LAMBDA_BETA; VSUM_COMPONENT; COND_COMPONENT] THEN + SIMP_TAC[VEC_COMPONENT; SUM_DELTA]);; + +let VSUM_ADD_NUMSEG = prove + (`!f g m n. vsum(m..n) (\i. f i + g i) = vsum(m..n) f + vsum(m..n) g`, + SIMP_TAC[VSUM_ADD; FINITE_NUMSEG]);; + +let VSUM_SUB_NUMSEG = prove + (`!f g m n. vsum(m..n) (\i. f i - g i) = vsum(m..n) f - vsum(m..n) g`, + SIMP_TAC[VSUM_SUB; FINITE_NUMSEG]);; + +let VSUM_ADD_SPLIT = prove + (`!f m n p. + m <= n + 1 ==> vsum(m..n + p) f = vsum(m..n) f + vsum(n + 1..n + p) f`, + SIMP_TAC[CART_EQ; LAMBDA_BETA; VSUM_COMPONENT; VECTOR_ADD_COMPONENT; + SUM_ADD_SPLIT]);; + +let VSUM_VSUM_PRODUCT = prove + (`!s:A->bool t:A->B->bool x. + FINITE s /\ (!i. i IN s ==> FINITE(t i)) + ==> vsum s (\i. vsum (t i) (x i)) = + vsum {i,j | i IN s /\ j IN t i} (\(i,j). x i j)`, + SIMP_TAC[CART_EQ; LAMBDA_BETA; VSUM_COMPONENT; COND_COMPONENT] THEN + SIMP_TAC[SUM_SUM_PRODUCT] THEN REPEAT STRIP_TAC THEN AP_TERM_TAC THEN + REWRITE_TAC[FUN_EQ_THM; FORALL_PAIR_THM]);; + +let VSUM_IMAGE_NONZERO = prove + (`!d:B->real^N i:A->B s. + FINITE s /\ + (!x y. x IN s /\ y IN s /\ ~(x = y) /\ i x = i y ==> d(i x) = vec 0) + ==> vsum (IMAGE i s) d = vsum s (d o i)`, + GEN_TAC THEN GEN_TAC THEN ONCE_REWRITE_TAC[IMP_CONJ] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + SIMP_TAC[IMAGE_CLAUSES; VSUM_CLAUSES; FINITE_IMAGE] THEN + MAP_EVERY X_GEN_TAC [`a:A`; `s:A->bool`] THEN + REWRITE_TAC[IN_INSERT] THEN REPEAT STRIP_TAC THEN + SUBGOAL_THEN `vsum s ((d:B->real^N) o (i:A->B)) = vsum (IMAGE i s) d` + SUBST1_TAC THENL [ASM_MESON_TAC[]; ALL_TAC] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[o_THM] THEN + REWRITE_TAC[VECTOR_ARITH `a = x + a <=> x = vec 0`] THEN + ASM_MESON_TAC[IN_IMAGE]);; + +let VSUM_UNION_NONZERO = prove + (`!f s t. FINITE s /\ FINITE t /\ (!x. x IN s INTER t ==> f(x) = vec 0) + ==> vsum (s UNION t) f = vsum s f + vsum t f`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; VECTOR_ADD_COMPONENT] THEN + SIMP_TAC[VEC_COMPONENT; SUM_UNION_NONZERO]);; + +let VSUM_UNIONS_NONZERO = prove + (`!f s. FINITE s /\ (!t:A->bool. t IN s ==> FINITE t) /\ + (!t1 t2 x. t1 IN s /\ t2 IN s /\ ~(t1 = t2) /\ x IN t1 /\ x IN t2 + ==> f x = vec 0) + ==> vsum (UNIONS s) f = vsum s (\t. vsum t f)`, + GEN_TAC THEN ONCE_REWRITE_TAC[IMP_CONJ] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + REWRITE_TAC[UNIONS_0; UNIONS_INSERT; VSUM_CLAUSES; IN_INSERT] THEN + MAP_EVERY X_GEN_TAC [`t:A->bool`; `s:(A->bool)->bool`] THEN + DISCH_THEN(fun th -> STRIP_TAC THEN MP_TAC th) THEN + ONCE_REWRITE_TAC[IMP_CONJ] THEN ASM_SIMP_TAC[VSUM_CLAUSES] THEN + ANTS_TAC THENL [ASM_MESON_TAC[]; DISCH_THEN(SUBST_ALL_TAC o SYM)] THEN + STRIP_TAC THEN MATCH_MP_TAC VSUM_UNION_NONZERO THEN + ASM_SIMP_TAC[FINITE_UNIONS; IN_INTER; IN_UNIONS] THEN ASM_MESON_TAC[]);; + +let VSUM_CLAUSES_LEFT = prove + (`!f m n. m <= n ==> vsum(m..n) f = f m + vsum(m + 1..n) f`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; VECTOR_ADD_COMPONENT] THEN + SIMP_TAC[VEC_COMPONENT; SUM_CLAUSES_LEFT]);; + +let VSUM_DIFFS = prove + (`!m n. vsum(m..n) (\k. f(k) - f(k + 1)) = + if m <= n then f(m) - f(n + 1) else vec 0`, + GEN_TAC THEN INDUCT_TAC THEN ASM_SIMP_TAC[VSUM_CLAUSES_NUMSEG; LE] THEN + ASM_CASES_TAC `m = SUC n` THEN + ASM_REWRITE_TAC[ARITH_RULE `~(SUC n <= n)`; VECTOR_ADD_LID] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[GSYM ADD1] THEN VECTOR_ARITH_TAC);; + +let VSUM_DIFFS_ALT = prove + (`!m n. vsum(m..n) (\k. f(k + 1) - f(k)) = + if m <= n then f(n + 1) - f(m) else vec 0`, + REPEAT GEN_TAC THEN ONCE_REWRITE_TAC[GSYM VECTOR_NEG_SUB] THEN + SIMP_TAC[VSUM_NEG; VSUM_DIFFS] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[VECTOR_NEG_SUB; VECTOR_NEG_0]);; + +let VSUM_DELETE_CASES = prove + (`!x f s. + FINITE(s:A->bool) + ==> vsum(s DELETE x) f = if x IN s then vsum s f - f x else vsum s f`, + REPEAT STRIP_TAC THEN COND_CASES_TAC THEN + ASM_SIMP_TAC[SET_RULE `~(x IN s) ==> s DELETE x = s`] THEN + FIRST_ASSUM(fun th -> GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) + [MATCH_MP (SET_RULE `x IN s ==> s = x INSERT (s DELETE x)`) th]) THEN + ASM_SIMP_TAC[VSUM_CLAUSES; FINITE_DELETE; IN_DELETE] THEN VECTOR_ARITH_TAC);; + +let VSUM_EQ_GENERAL = prove + (`!s:A->bool t:B->bool (f:A->real^N) g h. + (!y. y IN t ==> ?!x. x IN s /\ h x = y) /\ + (!x. x IN s ==> h x IN t /\ g(h x) = f x) + ==> vsum s f = vsum t g`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC SUM_EQ_GENERAL THEN + EXISTS_TAC `h:A->B` THEN ASM_MESON_TAC[]);; + +let VSUM_EQ_GENERAL_INVERSES = prove + (`!s t (f:A->real^N) (g:B->real^N) h k. + (!y. y IN t ==> k y IN s /\ h (k y) = y) /\ + (!x. x IN s ==> h x IN t /\ k (h x) = x /\ g (h x) = f x) + ==> vsum s f = vsum t g`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC SUM_EQ_GENERAL_INVERSES THEN + MAP_EVERY EXISTS_TAC [`h:A->B`; `k:B->A`] THEN ASM_MESON_TAC[]);; + +let VSUM_NORM_ALLSUBSETS_BOUND = prove + (`!f:A->real^N p e. + FINITE p /\ + (!q. q SUBSET p ==> norm(vsum q f) <= e) + ==> sum p (\x. norm(f x)) <= &2 * &(dimindex(:N)) * e`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC + `sum p (\x:A. sum (1..dimindex(:N)) (\i. abs((f x:real^N)$i)))` THEN + CONJ_TAC THENL + [MATCH_MP_TAC SUM_LE THEN ASM_SIMP_TAC[NORM_LE_L1]; ALL_TAC] THEN + W(MP_TAC o PART_MATCH (lhand o rand) SUM_SWAP o lhand o snd) THEN + ASM_REWRITE_TAC[FINITE_NUMSEG] THEN DISCH_THEN SUBST1_TAC THEN + ONCE_REWRITE_TAC[REAL_ARITH `&2 * &n * e = &n * &2 * e`] THEN + GEN_REWRITE_TAC (RAND_CONV o LAND_CONV o RAND_CONV) + [GSYM CARD_NUMSEG_1] THEN + MATCH_MP_TAC SUM_BOUND THEN REWRITE_TAC[FINITE_NUMSEG; IN_NUMSEG] THEN + X_GEN_TAC `k:num` THEN STRIP_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `sum {x:A | x IN p /\ &0 <= (f x:real^N)$k} (\x. abs((f x)$k)) + + sum {x | x IN p /\ (f x)$k < &0} (\x. abs((f x)$k))` THEN + CONJ_TAC THENL + [MATCH_MP_TAC(REAL_ARITH `a = b ==> b <= a`) THEN + MATCH_MP_TAC SUM_UNION_EQ THEN + ASM_SIMP_TAC[EXTENSION; NOT_IN_EMPTY; IN_INTER; IN_UNION; IN_ELIM_THM] THEN + CONJ_TAC THEN X_GEN_TAC `x:A` THEN ASM_CASES_TAC `(x:A) IN p` THEN + ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; + ALL_TAC] THEN + MATCH_MP_TAC(REAL_ARITH `x <= e /\ y <= e ==> x + y <= &2 * e`) THEN + GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [GSYM REAL_ABS_NEG] THEN + CONJ_TAC THEN MATCH_MP_TAC(REAL_ARITH + `!g. sum s g = sum s f /\ sum s g <= e ==> sum s f <= e`) + THENL + [EXISTS_TAC `\x. ((f:A->real^N) x)$k`; + EXISTS_TAC `\x. --(((f:A->real^N) x)$k)`] THEN + (CONJ_TAC THENL + [MATCH_MP_TAC SUM_EQ THEN REWRITE_TAC[IN_ELIM_THM] THEN REAL_ARITH_TAC; + ALL_TAC]) THEN + ASM_SIMP_TAC[GSYM VSUM_COMPONENT; SUM_NEG; FINITE_RESTRICT] THEN + MATCH_MP_TAC(REAL_ARITH `abs(x) <= e ==> x <= e`) THEN + REWRITE_TAC[REAL_ABS_NEG] THEN + MATCH_MP_TAC(REAL_ARITH + `abs((vsum q f)$k) <= norm(vsum q f) /\ + norm(vsum q f) <= e + ==> abs((vsum q f)$k) <= e`) THEN + ASM_SIMP_TAC[COMPONENT_LE_NORM] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN SET_TAC[]);; + +let DOT_LSUM = prove + (`!s f y. FINITE s ==> (vsum s f) dot y = sum s (\x. f(x) dot y)`, + REWRITE_TAC[RIGHT_FORALL_IMP_THM] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + ASM_SIMP_TAC[VSUM_CLAUSES; SUM_CLAUSES; DOT_LZERO; DOT_LADD]);; + +let DOT_RSUM = prove + (`!s f x. FINITE s ==> x dot (vsum s f) = sum s (\y. x dot f(y))`, + REWRITE_TAC[RIGHT_FORALL_IMP_THM] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + ASM_SIMP_TAC[VSUM_CLAUSES; SUM_CLAUSES; DOT_RZERO; DOT_RADD]);; + +let VSUM_OFFSET = prove + (`!f m p. vsum(m + p..n + p) f = vsum(m..n) (\i. f (i + p))`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; VEC_COMPONENT; SUM_OFFSET]);; + +let VSUM_OFFSET_0 = prove + (`!f m n. m <= n ==> vsum(m..n) f = vsum(0..n - m) (\i. f (i + m))`, + SIMP_TAC[vsum; CART_EQ; LAMBDA_BETA; VEC_COMPONENT; SUM_OFFSET_0]);; + +let VSUM_TRIV_NUMSEG = prove + (`!f m n. n < m ==> vsum(m..n) f = vec 0`, + SIMP_TAC[GSYM NUMSEG_EMPTY; VSUM_CLAUSES]);; + +let VSUM_CONST_NUMSEG = prove + (`!c m n. vsum(m..n) (\n. c) = &((n + 1) - m) % c`, + SIMP_TAC[VSUM_CONST; FINITE_NUMSEG; CARD_NUMSEG]);; + +let VSUM_SUC = prove + (`!f m n. vsum (SUC n..SUC m) f = vsum (n..m) (f o SUC)`, + REPEAT GEN_TAC THEN + SUBGOAL_THEN `SUC n..SUC m = IMAGE SUC (n..m)` SUBST1_TAC THENL + [REWRITE_TAC [ADD1; NUMSEG_OFFSET_IMAGE] THEN + REWRITE_TAC [ONE; ADD_SUC; ADD_0; ETA_AX]; + SIMP_TAC [VSUM_IMAGE; FINITE_NUMSEG; SUC_INJ]]);; + +let VSUM_BIJECTION = prove + (`!f:A->real^N p s:A->bool. + (!x. x IN s ==> p(x) IN s) /\ + (!y. y IN s ==> ?!x. x IN s /\ p(x) = y) + ==> vsum s f = vsum s (f o p)`, + REPEAT STRIP_TAC THEN CONV_TAC SYM_CONV THEN + MATCH_MP_TAC VSUM_EQ_GENERAL THEN EXISTS_TAC `p:A->A` THEN + ASM_REWRITE_TAC[o_THM]);; + +let VSUM_PARTIAL_SUC = prove + (`!f g:num->real^N m n. + vsum (m..n) (\k. f(k) % (g(k + 1) - g(k))) = + if m <= n then f(n + 1) % g(n + 1) - f(m) % g(m) - + vsum (m..n) (\k. (f(k + 1) - f(k)) % g(k + 1)) + else vec 0`, + GEN_TAC THEN GEN_TAC THEN GEN_TAC THEN INDUCT_TAC THEN + COND_CASES_TAC THEN ASM_SIMP_TAC[VSUM_TRIV_NUMSEG; GSYM NOT_LE] THEN + ASM_REWRITE_TAC[VSUM_CLAUSES_NUMSEG] THENL + [COND_CASES_TAC THEN ASM_SIMP_TAC[ARITH] THENL + [VECTOR_ARITH_TAC; ASM_ARITH_TAC]; + ALL_TAC] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [LE]) THEN + DISCH_THEN(DISJ_CASES_THEN2 SUBST_ALL_TAC ASSUME_TAC) THEN + ASM_SIMP_TAC[GSYM NOT_LT; VSUM_TRIV_NUMSEG; ARITH_RULE `n < SUC n`] THEN + ASM_SIMP_TAC[GSYM ADD1; ADD_CLAUSES] THEN VECTOR_ARITH_TAC);; + +let VSUM_PARTIAL_PRE = prove + (`!f g:num->real^N m n. + vsum (m..n) (\k. f(k) % (g(k) - g(k - 1))) = + if m <= n then f(n + 1) % g(n) - f(m) % g(m - 1) - + vsum (m..n) (\k. (f(k + 1) - f(k)) % g(k)) + else vec 0`, + REPEAT GEN_TAC THEN + MP_TAC(ISPECL [`f:num->real`; `\k. (g:num->real^N)(k - 1)`; + `m:num`; `n:num`] VSUM_PARTIAL_SUC) THEN + REWRITE_TAC[ADD_SUB] THEN DISCH_THEN SUBST1_TAC THEN + COND_CASES_TAC THEN REWRITE_TAC[]);; + +let VSUM_COMBINE_L = prove + (`!f m n p. + 0 < n /\ m <= n /\ n <= p + 1 + ==> vsum(m..n - 1) f + vsum(n..p) f = vsum(m..p) f`, + SIMP_TAC[CART_EQ; VECTOR_ADD_COMPONENT; VSUM_COMPONENT; SUM_COMBINE_L]);; + +let VSUM_COMBINE_R = prove + (`!f m n p. + m <= n + 1 /\ n <= p + ==> vsum(m..n) f + vsum(n + 1..p) f = vsum(m..p) f`, + SIMP_TAC[CART_EQ; VECTOR_ADD_COMPONENT; VSUM_COMPONENT; SUM_COMBINE_R]);; + +let VSUM_INJECTION = prove + (`!f p s. + FINITE s /\ + (!x. x IN s ==> p x IN s) /\ + (!x y. x IN s /\ y IN s /\ p x = p y ==> x = y) + ==> vsum s (f o p) = vsum s f`, + REPEAT GEN_TAC THEN DISCH_THEN(MP_TAC o MATCH_MP SUM_INJECTION) THEN + SIMP_TAC[CART_EQ; VSUM_COMPONENT; o_DEF]);; + +let VSUM_SWAP = prove + (`!f s t. + FINITE s /\ FINITE t + ==> vsum s (\i. vsum t (f i)) = vsum t (\j. vsum s (\i. f i j))`, + SIMP_TAC[CART_EQ; VSUM_COMPONENT] THEN REPEAT STRIP_TAC THEN + W(MP_TAC o PART_MATCH (lhs o rand) SUM_SWAP o lhs o snd) THEN + ASM_REWRITE_TAC[]);; + +let VSUM_SWAP_NUMSEG = prove + (`!a b c d f. + vsum (a..b) (\i. vsum (c..d) (f i)) = + vsum (c..d) (\j. vsum (a..b) (\i. f i j))`, + REPEAT GEN_TAC THEN MATCH_MP_TAC VSUM_SWAP THEN REWRITE_TAC[FINITE_NUMSEG]);; + +let VSUM_ADD_GEN = prove + (`!f g s. + FINITE {x | x IN s /\ ~(f x = vec 0)} /\ + FINITE {x | x IN s /\ ~(g x = vec 0)} + ==> vsum s (\x. f x + g x) = vsum s f + vsum s g`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + SIMP_TAC[CART_EQ; vsum; LAMBDA_BETA; VECTOR_ADD_COMPONENT] THEN + REPEAT GEN_TAC THEN DISCH_THEN(K ALL_TAC) THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC SUM_ADD_GEN THEN + POP_ASSUM MP_TAC THEN MATCH_MP_TAC MONO_AND THEN + CONJ_TAC THEN MATCH_MP_TAC(REWRITE_RULE[IMP_CONJ_ALT] FINITE_SUBSET) THEN + REWRITE_TAC[SUBSET; IN_ELIM_THM] THEN GEN_TAC THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN REWRITE_TAC[DE_MORGAN_THM] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[VEC_COMPONENT]);; + +let VSUM_CASES_1 = prove + (`!s a. FINITE s /\ a IN s + ==> vsum s (\x. if x = a then y else f(x)) = vsum s f + (y - f a)`, + REPEAT STRIP_TAC THEN ASM_SIMP_TAC[VSUM_CASES] THEN + ASM_SIMP_TAC[GSYM DELETE; VSUM_DELETE] THEN + ASM_SIMP_TAC[SET_RULE `a IN s ==> {x | x IN s /\ x = a} = {a}`] THEN + REWRITE_TAC[VSUM_SING] THEN VECTOR_ARITH_TAC);; + +let VSUM_SING_NUMSEG = prove + (`vsum(n..n) f = f n`, + REWRITE_TAC[NUMSEG_SING; VSUM_SING]);; + +let VSUM_1 = prove + (`vsum(1..1) f = f(1)`, + REWRITE_TAC[VSUM_SING_NUMSEG]);; + +let VSUM_2 = prove + (`!t. vsum(1..2) t = t(1) + t(2)`, + REWRITE_TAC[num_CONV `2`; VSUM_CLAUSES_NUMSEG] THEN + REWRITE_TAC[VSUM_SING_NUMSEG; ARITH; REAL_ADD_ASSOC]);; + +let VSUM_3 = prove + (`!t. vsum(1..3) t = t(1) + t(2) + t(3)`, + REWRITE_TAC[num_CONV `3`; num_CONV `2`; VSUM_CLAUSES_NUMSEG] THEN + REWRITE_TAC[VSUM_SING_NUMSEG; ARITH; VECTOR_ADD_ASSOC]);; + +let VSUM_PAIR = prove + (`!f:num->real^N m n. + vsum(2*m..2*n+1) f = vsum(m..n) (\i. f(2*i) + f(2*i+1))`, + SIMP_TAC[CART_EQ; VSUM_COMPONENT; VECTOR_ADD_COMPONENT; SUM_PAIR]);; + +let VSUM_PAIR_0 = prove + (`!f:num->real^N n. vsum(0..2*n+1) f = vsum(0..n) (\i. f(2*i) + f(2*i+1))`, + REPEAT GEN_TAC THEN + MP_TAC(ISPECL [`f:num->real^N`; `0`; `n:num`] VSUM_PAIR) THEN + ASM_REWRITE_TAC[ARITH]);; + +(* ------------------------------------------------------------------------- *) +(* Add useful congruences to the simplifier. *) +(* ------------------------------------------------------------------------- *) + +let th = prove + (`(!f g s. (!x. x IN s ==> f(x) = g(x)) + ==> vsum s (\i. f(i)) = vsum s g) /\ + (!f g a b. (!i. a <= i /\ i <= b ==> f(i) = g(i)) + ==> vsum(a..b) (\i. f(i)) = vsum(a..b) g) /\ + (!f g p. (!x. p x ==> f x = g x) + ==> vsum {y | p y} (\i. f(i)) = vsum {y | p y} g)`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC VSUM_EQ THEN + ASM_SIMP_TAC[IN_ELIM_THM; IN_NUMSEG]) in + extend_basic_congs (map SPEC_ALL (CONJUNCTS th));; + +(* ------------------------------------------------------------------------- *) +(* A conversion for evaluation of `vsum(m..n) f` for numerals m and n. *) +(* ------------------------------------------------------------------------- *) + +let EXPAND_VSUM_CONV = + let pth_0,pth_1 = (CONJ_PAIR o prove) + (`vsum(0..0) (f:num->real^N) = f(0) /\ + vsum(0..SUC n) f = vsum(0..n) f + f(SUC n)`, + REWRITE_TAC[VSUM_CLAUSES_NUMSEG; LE_0; VECTOR_ADD_AC]) in + let conv_0 = REWR_CONV pth_0 and conv_1 = REWR_CONV pth_1 in + let rec conv tm = + try (LAND_CONV(RAND_CONV num_CONV) THENC conv_1 THENC + NUM_REDUCE_CONV THENC LAND_CONV conv) tm + with Failure _ -> conv_0 tm in + conv THENC + (REDEPTH_CONV BETA_CONV) THENC + GEN_REWRITE_CONV TOP_DEPTH_CONV [GSYM VECTOR_ADD_ASSOC];; + +(* ------------------------------------------------------------------------- *) +(* Basis vectors in coordinate directions. *) +(* ------------------------------------------------------------------------- *) + +let basis = new_definition + `basis k = lambda i. if i = k then &1 else &0`;; + +let NORM_BASIS = prove + (`!k. 1 <= k /\ k <= dimindex(:N) + ==> (norm(basis k :real^N) = &1)`, + REPEAT GEN_TAC THEN DISCH_TAC THEN REWRITE_TAC[basis; dot; vector_norm] THEN + GEN_REWRITE_TAC RAND_CONV [GSYM SQRT_1] THEN AP_TERM_TAC THEN + MATCH_MP_TAC EQ_TRANS THEN EXISTS_TAC + `sum (1..dimindex(:N)) (\i. if i = k then &1 else &0)` THEN + CONJ_TAC THENL + [MATCH_MP_TAC SUM_EQ_NUMSEG THEN + ASM_SIMP_TAC[LAMBDA_BETA; IN_NUMSEG; EQ_SYM_EQ] THEN + REPEAT STRIP_TAC THEN COND_CASES_TAC THEN REAL_ARITH_TAC; + ASM_REWRITE_TAC[SUM_DELTA; IN_NUMSEG]]);; + +let NORM_BASIS_1 = prove + (`norm(basis 1) = &1`, + SIMP_TAC[NORM_BASIS; ARITH_EQ; ARITH_RULE `1 <= k <=> ~(k = 0)`; + DIMINDEX_NONZERO]);; + +let VECTOR_CHOOSE_SIZE = prove + (`!c. &0 <= c ==> ?x:real^N. norm(x) = c`, + REPEAT STRIP_TAC THEN EXISTS_TAC `c % basis 1 :real^N` THEN + ASM_REWRITE_TAC[NORM_MUL; real_abs; NORM_BASIS_1; REAL_MUL_RID]);; + +let VECTOR_CHOOSE_DIST = prove + (`!x e. &0 <= e ==> ?y:real^N. dist(x,y) = e`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `?c:real^N. norm(c) = e` CHOOSE_TAC THENL + [ASM_SIMP_TAC[VECTOR_CHOOSE_SIZE]; ALL_TAC] THEN + EXISTS_TAC `x - c:real^N` THEN REWRITE_TAC[dist] THEN + ASM_REWRITE_TAC[VECTOR_ARITH `x - (x - c) = c:real^N`]);; + +let BASIS_INJ = prove + (`!i j. 1 <= i /\ i <= dimindex(:N) /\ + 1 <= j /\ j <= dimindex(:N) /\ + (basis i :real^N = basis j) + ==> (i = j)`, + SIMP_TAC[basis; CART_EQ; LAMBDA_BETA] THEN REPEAT GEN_TAC THEN + REPEAT STRIP_TAC THEN FIRST_X_ASSUM(MP_TAC o SPEC `i:num`) THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + ASM_SIMP_TAC[REAL_OF_NUM_EQ; ARITH_EQ]);; + +let BASIS_NE = prove + (`!i j. 1 <= i /\ i <= dimindex(:N) /\ + 1 <= j /\ j <= dimindex(:N) /\ + ~(i = j) + ==> ~(basis i :real^N = basis j)`, + MESON_TAC[BASIS_INJ]);; + +let BASIS_COMPONENT = prove + (`!k i. 1 <= i /\ i <= dimindex(:N) + ==> ((basis k :real^N)$i = if i = k then &1 else &0)`, + SIMP_TAC[basis; LAMBDA_BETA] THEN MESON_TAC[]);; + +let BASIS_EXPANSION = prove + (`!x:real^N. vsum(1..dimindex(:N)) (\i. x$i % basis i) = x`, + SIMP_TAC[CART_EQ; VSUM_COMPONENT; VECTOR_MUL_COMPONENT; BASIS_COMPONENT] THEN + ONCE_REWRITE_TAC[COND_RAND] THEN REWRITE_TAC[REAL_MUL_RZERO] THEN + REPEAT STRIP_TAC THEN + GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [EQ_SYM_EQ] THEN + ASM_SIMP_TAC[SUM_DELTA; IN_NUMSEG; REAL_MUL_RID]);; + +let BASIS_EXPANSION_UNIQUE = prove + (`!f x:real^N. (vsum(1..dimindex(:N)) (\i. f(i) % basis i) = x) <=> + (!i. 1 <= i /\ i <= dimindex(:N) ==> f(i) = x$i)`, + SIMP_TAC[CART_EQ; VSUM_COMPONENT; VECTOR_MUL_COMPONENT; BASIS_COMPONENT] THEN + REPEAT GEN_TAC THEN REWRITE_TAC[COND_RAND; REAL_MUL_RZERO; REAL_MUL_RID] THEN + GEN_REWRITE_TAC (LAND_CONV o BINDER_CONV o RAND_CONV o LAND_CONV o + ONCE_DEPTH_CONV) [EQ_SYM_EQ] THEN + SIMP_TAC[SUM_DELTA; IN_NUMSEG]);; + +let DOT_BASIS = prove + (`!x:real^N i. + 1 <= i /\ i <= dimindex(:N) + ==> ((basis i) dot x = x$i) /\ (x dot (basis i) = x$i)`, + SIMP_TAC[dot; basis; LAMBDA_BETA] THEN + REWRITE_TAC[COND_RATOR; COND_RAND] THEN + REWRITE_TAC[REAL_MUL_LZERO; REAL_MUL_RZERO] THEN + SIMP_TAC[SUM_DELTA; IN_NUMSEG; REAL_MUL_LID; REAL_MUL_RID]);; + +let DOT_BASIS_BASIS = prove + (`!i j. 1 <= i /\ i <= dimindex(:N) /\ + 1 <= j /\ j <= dimindex(:N) + ==> (basis i:real^N) dot (basis j) = if i = j then &1 else &0`, + SIMP_TAC[DOT_BASIS; BASIS_COMPONENT]);; + +let DOT_BASIS_BASIS_UNEQUAL = prove + (`!i j. ~(i = j) ==> (basis i) dot (basis j) = &0`, + SIMP_TAC[basis; dot; LAMBDA_BETA] THEN ONCE_REWRITE_TAC[COND_RAND] THEN + SIMP_TAC[SUM_0; REAL_MUL_RZERO; REAL_MUL_LZERO; COND_ID]);; + +let BASIS_EQ_0 = prove + (`!i. (basis i :real^N = vec 0) <=> ~(i IN 1..dimindex(:N))`, + SIMP_TAC[CART_EQ; BASIS_COMPONENT; VEC_COMPONENT; IN_NUMSEG] THEN + MESON_TAC[REAL_ARITH `~(&1 = &0)`]);; + +let BASIS_NONZERO = prove + (`!k. 1 <= k /\ k <= dimindex(:N) + ==> ~(basis k :real^N = vec 0)`, + REWRITE_TAC[BASIS_EQ_0; IN_NUMSEG]);; + +let VECTOR_EQ_LDOT = prove + (`!y z. (!x. x dot y = x dot z) <=> y = z`, + REPEAT GEN_TAC THEN EQ_TAC THEN SIMP_TAC[] THEN + REWRITE_TAC[CART_EQ] THEN MESON_TAC[DOT_BASIS]);; + +let VECTOR_EQ_RDOT = prove + (`!x y. (!z. x dot z = y dot z) <=> x = y`, + REPEAT GEN_TAC THEN EQ_TAC THEN SIMP_TAC[] THEN + REWRITE_TAC[CART_EQ] THEN MESON_TAC[DOT_BASIS]);; + +(* ------------------------------------------------------------------------- *) +(* Orthogonality. *) +(* ------------------------------------------------------------------------- *) + +let orthogonal = new_definition + `orthogonal x y <=> (x dot y = &0)`;; + +let ORTHOGONAL_0 = prove + (`!x. orthogonal (vec 0) x /\ orthogonal x (vec 0)`, + REWRITE_TAC[orthogonal; DOT_LZERO; DOT_RZERO]);; + +let ORTHOGONAL_REFL = prove + (`!x. orthogonal x x <=> x = vec 0`, + REWRITE_TAC[orthogonal; DOT_EQ_0]);; + +let ORTHOGONAL_SYM = prove + (`!x y. orthogonal x y <=> orthogonal y x`, + REWRITE_TAC[orthogonal; DOT_SYM]);; + +let ORTHOGONAL_LNEG = prove + (`!x y. orthogonal (--x) y <=> orthogonal x y`, + REWRITE_TAC[orthogonal; DOT_LNEG; REAL_NEG_EQ_0]);; + +let ORTHOGONAL_RNEG = prove + (`!x y. orthogonal x (--y) <=> orthogonal x y`, + REWRITE_TAC[orthogonal; DOT_RNEG; REAL_NEG_EQ_0]);; + +let ORTHOGONAL_BASIS = prove + (`!x:real^N i. 1 <= i /\ i <= dimindex(:N) + ==> (orthogonal (basis i) x <=> (x$i = &0))`, + REPEAT STRIP_TAC THEN SIMP_TAC[orthogonal; dot; basis; LAMBDA_BETA] THEN + REWRITE_TAC[COND_RAND; COND_RATOR; REAL_MUL_LZERO] THEN + ASM_SIMP_TAC[SUM_DELTA; IN_NUMSEG; REAL_MUL_LID]);; + +let ORTHOGONAL_BASIS_BASIS = prove + (`!i j. 1 <= i /\ i <= dimindex(:N) /\ + 1 <= j /\ j <= dimindex(:N) + ==> (orthogonal (basis i :real^N) (basis j) <=> ~(i = j))`, + ASM_SIMP_TAC[ORTHOGONAL_BASIS] THEN ASM_SIMP_TAC[BASIS_COMPONENT] THEN + MESON_TAC[REAL_ARITH `~(&1 = &0)`]);; + +let ORTHOGONAL_CLAUSES = prove + (`(!a. orthogonal a (vec 0)) /\ + (!a x c. orthogonal a x ==> orthogonal a (c % x)) /\ + (!a x. orthogonal a x ==> orthogonal a (--x)) /\ + (!a x y. orthogonal a x /\ orthogonal a y ==> orthogonal a (x + y)) /\ + (!a x y. orthogonal a x /\ orthogonal a y ==> orthogonal a (x - y)) /\ + (!a. orthogonal (vec 0) a) /\ + (!a x c. orthogonal x a ==> orthogonal (c % x) a) /\ + (!a x. orthogonal x a ==> orthogonal (--x) a) /\ + (!a x y. orthogonal x a /\ orthogonal y a ==> orthogonal (x + y) a) /\ + (!a x y. orthogonal x a /\ orthogonal y a ==> orthogonal (x - y) a)`, + REWRITE_TAC[orthogonal; DOT_RNEG; DOT_RMUL; DOT_RADD; DOT_RSUB; + DOT_LZERO; DOT_RZERO; DOT_LNEG; DOT_LMUL; DOT_LADD; DOT_LSUB] THEN + SIMP_TAC[] THEN REAL_ARITH_TAC);; + +(* ------------------------------------------------------------------------- *) +(* Explicit vector construction from lists. *) +(* ------------------------------------------------------------------------- *) + +let VECTOR_1 = prove + (`(vector[x]:A^1)$1 = x`, + SIMP_TAC[vector; LAMBDA_BETA; DIMINDEX_1; ARITH; LENGTH; EL; HD; TL]);; + +let VECTOR_2 = prove + (`(vector[x;y]:A^2)$1 = x /\ + (vector[x;y]:A^2)$2 = y`, + SIMP_TAC[vector; LAMBDA_BETA; DIMINDEX_2; ARITH; LENGTH; EL] THEN + REWRITE_TAC[num_CONV `1`; HD; TL; EL]);; + +let VECTOR_3 = prove + (`(vector[x;y;z]:A^3)$1 = x /\ + (vector[x;y;z]:A^3)$2 = y /\ + (vector[x;y;z]:A^3)$3 = z`, + SIMP_TAC[vector; LAMBDA_BETA; DIMINDEX_3; ARITH; LENGTH; EL] THEN + REWRITE_TAC[num_CONV `2`; num_CONV `1`; HD; TL; EL]);; + +let FORALL_VECTOR_1 = prove + (`(!v:A^1. P v) <=> !x. P(vector[x])`, + EQ_TAC THEN SIMP_TAC[] THEN REPEAT STRIP_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `(v:A^1)$1`) THEN + MATCH_MP_TAC EQ_IMP THEN AP_TERM_TAC THEN + REWRITE_TAC[CART_EQ; FORALL_1; VECTOR_1; DIMINDEX_1]);; + +let FORALL_VECTOR_2 = prove + (`(!v:A^2. P v) <=> !x y. P(vector[x;y])`, + EQ_TAC THEN SIMP_TAC[] THEN REPEAT STRIP_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPECL [`(v:A^2)$1`; `(v:A^2)$2`]) THEN + MATCH_MP_TAC EQ_IMP THEN AP_TERM_TAC THEN + REWRITE_TAC[CART_EQ; FORALL_2; VECTOR_2; DIMINDEX_2]);; + +let FORALL_VECTOR_3 = prove + (`(!v:A^3. P v) <=> !x y z. P(vector[x;y;z])`, + EQ_TAC THEN SIMP_TAC[] THEN REPEAT STRIP_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPECL + [`(v:A^3)$1`; `(v:A^3)$2`; `(v:A^3)$3`]) THEN + MATCH_MP_TAC EQ_IMP THEN AP_TERM_TAC THEN + REWRITE_TAC[CART_EQ; FORALL_3; VECTOR_3; DIMINDEX_3]);; + +let EXISTS_VECTOR_1 = prove + (`(?v:A^1. P v) <=> ?x. P(vector[x])`, + REWRITE_TAC[MESON[] `(?x. P x) <=> ~(!x. ~P x)`] THEN + REWRITE_TAC[FORALL_VECTOR_1]);; + +let EXISTS_VECTOR_2 = prove + (`(?v:A^2. P v) <=> ?x y. P(vector[x;y])`, + REWRITE_TAC[MESON[] `(?x. P x) <=> ~(!x. ~P x)`] THEN + REWRITE_TAC[FORALL_VECTOR_2]);; + +let EXISTS_VECTOR_3 = prove + (`(?v:A^3. P v) <=> ?x y z. P(vector[x;y;z])`, + REWRITE_TAC[MESON[] `(?x. P x) <=> ~(!x. ~P x)`] THEN + REWRITE_TAC[FORALL_VECTOR_3]);; + +(* ------------------------------------------------------------------------- *) +(* Linear functions. *) +(* ------------------------------------------------------------------------- *) + +let linear = new_definition + `linear (f:real^M->real^N) <=> + (!x y. f(x + y) = f(x) + f(y)) /\ + (!c x. f(c % x) = c % f(x))`;; + +let LINEAR_COMPOSE_CMUL = prove + (`!f c. linear f ==> linear (\x. c % f(x))`, + SIMP_TAC[linear] THEN REPEAT STRIP_TAC THEN VECTOR_ARITH_TAC);; + +let LINEAR_COMPOSE_NEG = prove + (`!f. linear f ==> linear (\x. --(f(x)))`, + SIMP_TAC[linear] THEN REPEAT STRIP_TAC THEN VECTOR_ARITH_TAC);; + +let LINEAR_COMPOSE_ADD = prove + (`!f g. linear f /\ linear g ==> linear (\x. f(x) + g(x))`, + SIMP_TAC[linear] THEN REPEAT STRIP_TAC THEN VECTOR_ARITH_TAC);; + +let LINEAR_COMPOSE_SUB = prove + (`!f g. linear f /\ linear g ==> linear (\x. f(x) - g(x))`, + SIMP_TAC[linear] THEN REPEAT STRIP_TAC THEN VECTOR_ARITH_TAC);; + +let LINEAR_COMPOSE = prove + (`!f g. linear f /\ linear g ==> linear (g o f)`, + SIMP_TAC[linear; o_THM]);; + +let LINEAR_ID = prove + (`linear (\x. x)`, + REWRITE_TAC[linear]);; + +let LINEAR_I = prove + (`linear I`, + REWRITE_TAC[I_DEF; LINEAR_ID]);; + +let LINEAR_ZERO = prove + (`linear (\x. vec 0)`, + REWRITE_TAC[linear] THEN CONJ_TAC THEN VECTOR_ARITH_TAC);; + +let LINEAR_NEGATION = prove + (`linear(--)`, + REWRITE_TAC[linear] THEN VECTOR_ARITH_TAC);; + +let LINEAR_COMPOSE_VSUM = prove + (`!f s. FINITE s /\ (!a. a IN s ==> linear(f a)) + ==> linear(\x. vsum s (\a. f a x))`, + GEN_TAC THEN REWRITE_TAC[IMP_CONJ] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + SIMP_TAC[VSUM_CLAUSES; LINEAR_ZERO] THEN + ASM_SIMP_TAC[ETA_AX; IN_INSERT; LINEAR_COMPOSE_ADD]);; + +let LINEAR_VMUL_COMPONENT = prove + (`!f:real^M->real^N v k. + linear f /\ 1 <= k /\ k <= dimindex(:N) + ==> linear (\x. f(x)$k % v)`, + SIMP_TAC[linear; VECTOR_ADD_COMPONENT; VECTOR_MUL_COMPONENT] THEN + REPEAT STRIP_TAC THEN VECTOR_ARITH_TAC);; + +let LINEAR_0 = prove + (`!f. linear f ==> (f(vec 0) = vec 0)`, + MESON_TAC[VECTOR_MUL_LZERO; linear]);; + +let LINEAR_CMUL = prove + (`!f c x. linear f ==> (f(c % x) = c % f(x))`, + SIMP_TAC[linear]);; + +let LINEAR_NEG = prove + (`!f x. linear f ==> (f(--x) = --(f x))`, + ONCE_REWRITE_TAC[VECTOR_NEG_MINUS1] THEN SIMP_TAC[LINEAR_CMUL]);; + +let LINEAR_ADD = prove + (`!f x y. linear f ==> (f(x + y) = f(x) + f(y))`, + SIMP_TAC[linear]);; + +let LINEAR_SUB = prove + (`!f x y. linear f ==> (f(x - y) = f(x) - f(y))`, + SIMP_TAC[VECTOR_SUB; LINEAR_ADD; LINEAR_NEG]);; + +let LINEAR_VSUM = prove + (`!f g s. linear f /\ FINITE s ==> (f(vsum s g) = vsum s (f o g))`, + GEN_TAC THEN GEN_TAC THEN SIMP_TAC[IMP_CONJ; RIGHT_FORALL_IMP_THM] THEN + DISCH_TAC THEN MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + SIMP_TAC[VSUM_CLAUSES] THEN FIRST_ASSUM(fun th -> + SIMP_TAC[MATCH_MP LINEAR_0 th; MATCH_MP LINEAR_ADD th; o_THM]));; + +let LINEAR_VSUM_MUL = prove + (`!f s c v. + linear f /\ FINITE s + ==> f(vsum s (\i. c i % v i)) = vsum s (\i. c(i) % f(v i))`, + SIMP_TAC[LINEAR_VSUM; o_DEF; LINEAR_CMUL]);; + +let LINEAR_INJECTIVE_0 = prove + (`!f. linear f + ==> ((!x y. (f(x) = f(y)) ==> (x = y)) <=> + (!x. (f(x) = vec 0) ==> (x = vec 0)))`, + REPEAT STRIP_TAC THEN + GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [GSYM VECTOR_SUB_EQ] THEN + ASM_SIMP_TAC[GSYM LINEAR_SUB] THEN MESON_TAC[VECTOR_SUB_RZERO]);; + +let LINEAR_BOUNDED = prove + (`!f:real^M->real^N. linear f ==> ?B. !x. norm(f x) <= B * norm(x)`, + REPEAT STRIP_TAC THEN EXISTS_TAC + `sum(1..dimindex(:M)) (\i. norm((f:real^M->real^N)(basis i)))` THEN + GEN_TAC THEN + GEN_REWRITE_TAC (LAND_CONV o funpow 2 RAND_CONV) [GSYM BASIS_EXPANSION] THEN + ASM_SIMP_TAC[LINEAR_VSUM; FINITE_NUMSEG] THEN + ONCE_REWRITE_TAC[REAL_MUL_SYM] THEN REWRITE_TAC[GSYM SUM_LMUL] THEN + MATCH_MP_TAC VSUM_NORM_LE THEN + SIMP_TAC[FINITE_CROSS; FINITE_NUMSEG; IN_NUMSEG] THEN + ASM_SIMP_TAC[o_DEF; NORM_MUL; LINEAR_CMUL] THEN + ASM_SIMP_TAC[REAL_LE_RMUL; NORM_POS_LE; COMPONENT_LE_NORM]);; + +let LINEAR_BOUNDED_POS = prove + (`!f:real^M->real^N. linear f ==> ?B. &0 < B /\ !x. norm(f x) <= B * norm(x)`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM(X_CHOOSE_TAC `B:real` o MATCH_MP LINEAR_BOUNDED) THEN + EXISTS_TAC `abs(B) + &1` THEN CONJ_TAC THENL [REAL_ARITH_TAC; ALL_TAC] THEN + POP_ASSUM MP_TAC THEN MATCH_MP_TAC MONO_FORALL THEN GEN_TAC THEN + MATCH_MP_TAC(REAL_ARITH `a <= b ==> x <= a ==> x <= b`) THEN + MATCH_MP_TAC REAL_LE_RMUL THEN REWRITE_TAC[NORM_POS_LE] THEN + REAL_ARITH_TAC);; + +let SYMMETRIC_LINEAR_IMAGE = prove + (`!f s. (!x. x IN s ==> --x IN s) /\ linear f + ==> !x. x IN (IMAGE f s) ==> --x IN (IMAGE f s)`, + REWRITE_TAC[FORALL_IN_IMAGE] THEN + SIMP_TAC[GSYM LINEAR_NEG] THEN SET_TAC[]);; + +(* ------------------------------------------------------------------------- *) +(* Bilinear functions. *) +(* ------------------------------------------------------------------------- *) + +let bilinear = new_definition + `bilinear f <=> (!x. linear(\y. f x y)) /\ (!y. linear(\x. f x y))`;; + +let BILINEAR_LADD = prove + (`!h x y z. bilinear h ==> h (x + y) z = (h x z) + (h y z)`, + SIMP_TAC[bilinear; linear]);; + +let BILINEAR_RADD = prove + (`!h x y z. bilinear h ==> h x (y + z) = (h x y) + (h x z)`, + SIMP_TAC[bilinear; linear]);; + +let BILINEAR_LMUL = prove + (`!h c x y. bilinear h ==> h (c % x) y = c % (h x y)`, + SIMP_TAC[bilinear; linear]);; + +let BILINEAR_RMUL = prove + (`!h c x y. bilinear h ==> h x (c % y) = c % (h x y)`, + SIMP_TAC[bilinear; linear]);; + +let BILINEAR_LNEG = prove + (`!h x y. bilinear h ==> h (--x) y = --(h x y)`, + ONCE_REWRITE_TAC[VECTOR_NEG_MINUS1] THEN SIMP_TAC[BILINEAR_LMUL]);; + +let BILINEAR_RNEG = prove + (`!h x y. bilinear h ==> h x (--y) = --(h x y)`, + ONCE_REWRITE_TAC[VECTOR_NEG_MINUS1] THEN SIMP_TAC[BILINEAR_RMUL]);; + +let BILINEAR_LZERO = prove + (`!h x. bilinear h ==> h (vec 0) x = vec 0`, + ONCE_REWRITE_TAC[VECTOR_ARITH `x = vec 0 <=> x + x = x`] THEN + SIMP_TAC[GSYM BILINEAR_LADD; VECTOR_ADD_LID]);; + +let BILINEAR_RZERO = prove + (`!h x. bilinear h ==> h x (vec 0) = vec 0`, + ONCE_REWRITE_TAC[VECTOR_ARITH `x = vec 0 <=> x + x = x`] THEN + SIMP_TAC[GSYM BILINEAR_RADD; VECTOR_ADD_LID]);; + +let BILINEAR_LSUB = prove + (`!h x y z. bilinear h ==> h (x - y) z = (h x z) - (h y z)`, + SIMP_TAC[VECTOR_SUB; BILINEAR_LNEG; BILINEAR_LADD]);; + +let BILINEAR_RSUB = prove + (`!h x y z. bilinear h ==> h x (y - z) = (h x y) - (h x z)`, + SIMP_TAC[VECTOR_SUB; BILINEAR_RNEG; BILINEAR_RADD]);; + +let BILINEAR_VSUM = prove + (`!h:real^M->real^N->real^P. + bilinear h /\ FINITE s /\ FINITE t + ==> h (vsum s f) (vsum t g) = vsum (s CROSS t) (\(i,j). h (f i) (g j))`, + REPEAT GEN_TAC THEN SIMP_TAC[bilinear; ETA_AX] THEN + ONCE_REWRITE_TAC[TAUT `(a /\ b) /\ c /\ d <=> (a /\ d) /\ (b /\ c)`] THEN + DISCH_THEN(CONJUNCTS_THEN2 STRIP_ASSUME_TAC MP_TAC) THEN + ONCE_REWRITE_TAC[LEFT_AND_FORALL_THM] THEN DISCH_TAC THEN + FIRST_ASSUM(MP_TAC o GEN_ALL o MATCH_MP LINEAR_VSUM o SPEC_ALL) THEN + SIMP_TAC[] THEN ASM_SIMP_TAC[LINEAR_VSUM; o_DEF; VSUM_VSUM_PRODUCT] THEN + REWRITE_TAC[GSYM CROSS]);; + +let BILINEAR_BOUNDED = prove + (`!h:real^M->real^N->real^P. + bilinear h ==> ?B. !x y. norm(h x y) <= B * norm(x) * norm(y)`, + REPEAT STRIP_TAC THEN + EXISTS_TAC `sum ((1..dimindex(:M)) CROSS (1..dimindex(:N))) + (\(i,j). norm((h:real^M->real^N->real^P) + (basis i) (basis j)))` THEN + REPEAT GEN_TAC THEN GEN_REWRITE_TAC + (LAND_CONV o RAND_CONV o BINOP_CONV) [GSYM BASIS_EXPANSION] THEN + ASM_SIMP_TAC[BILINEAR_VSUM; FINITE_NUMSEG] THEN + ONCE_REWRITE_TAC[REAL_MUL_SYM] THEN REWRITE_TAC[GSYM SUM_LMUL] THEN + MATCH_MP_TAC VSUM_NORM_LE THEN + SIMP_TAC[FINITE_CROSS; FINITE_NUMSEG; FORALL_PAIR_THM; IN_CROSS] THEN + REWRITE_TAC[IN_NUMSEG] THEN REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[BILINEAR_LMUL; NORM_MUL] THEN + ASM_SIMP_TAC[BILINEAR_RMUL; NORM_MUL; REAL_MUL_ASSOC] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN REWRITE_TAC[NORM_POS_LE] THEN + ASM_SIMP_TAC[COMPONENT_LE_NORM; REAL_ABS_POS; REAL_LE_MUL2]);; + +let BILINEAR_BOUNDED_POS = prove + (`!h. bilinear h + ==> ?B. &0 < B /\ !x y. norm(h x y) <= B * norm(x) * norm(y)`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM(X_CHOOSE_TAC `B:real` o MATCH_MP BILINEAR_BOUNDED) THEN + EXISTS_TAC `abs(B) + &1` THEN CONJ_TAC THENL [REAL_ARITH_TAC; ALL_TAC] THEN + POP_ASSUM MP_TAC THEN REPEAT(MATCH_MP_TAC MONO_FORALL THEN GEN_TAC) THEN + MATCH_MP_TAC(REAL_ARITH `a <= b ==> x <= a ==> x <= b`) THEN + REPEAT(MATCH_MP_TAC REAL_LE_RMUL THEN + SIMP_TAC[NORM_POS_LE; REAL_LE_MUL]) THEN + REAL_ARITH_TAC);; + +let BILINEAR_VSUM_PARTIAL_SUC = prove + (`!f g h:real^M->real^N->real^P m n. + bilinear h + ==> vsum (m..n) (\k. h (f k) (g(k + 1) - g(k))) = + if m <= n then h (f(n + 1)) (g(n + 1)) - h (f m) (g m) - + vsum (m..n) (\k. h (f(k + 1) - f(k)) (g(k + 1))) + else vec 0`, + REWRITE_TAC[RIGHT_FORALL_IMP_THM] THEN REPEAT GEN_TAC THEN DISCH_TAC THEN + GEN_TAC THEN INDUCT_TAC THEN + COND_CASES_TAC THEN ASM_SIMP_TAC[VSUM_TRIV_NUMSEG; GSYM NOT_LE] THEN + ASM_REWRITE_TAC[VSUM_CLAUSES_NUMSEG] THENL + [COND_CASES_TAC THEN ASM_SIMP_TAC[ARITH] THENL + [ASM_SIMP_TAC[BILINEAR_RSUB; BILINEAR_LSUB] THEN VECTOR_ARITH_TAC; + ASM_ARITH_TAC]; + ALL_TAC] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [LE]) THEN + DISCH_THEN(DISJ_CASES_THEN2 SUBST_ALL_TAC ASSUME_TAC) THEN + ASM_SIMP_TAC[GSYM NOT_LT; VSUM_TRIV_NUMSEG; ARITH_RULE `n < SUC n`] THEN + ASM_SIMP_TAC[GSYM ADD1; ADD_CLAUSES] THEN + ASM_SIMP_TAC[BILINEAR_RSUB; BILINEAR_LSUB] THEN VECTOR_ARITH_TAC);; + +let BILINEAR_VSUM_PARTIAL_PRE = prove + (`!f g h:real^M->real^N->real^P m n. + bilinear h + ==> vsum (m..n) (\k. h (f k) (g(k) - g(k - 1))) = + if m <= n then h (f(n + 1)) (g(n)) - h (f m) (g(m - 1)) - + vsum (m..n) (\k. h (f(k + 1) - f(k)) (g(k))) + else vec 0`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM(MP_TAC o ISPECL [`f:num->real^M`; `\k. (g:num->real^N)(k - 1)`; + `m:num`; `n:num`] o MATCH_MP BILINEAR_VSUM_PARTIAL_SUC) THEN + REWRITE_TAC[ADD_SUB] THEN DISCH_THEN SUBST1_TAC THEN + COND_CASES_TAC THEN REWRITE_TAC[]);; + +(* ------------------------------------------------------------------------- *) +(* Adjoints. *) +(* ------------------------------------------------------------------------- *) + +let adjoint = new_definition + `adjoint(f:real^M->real^N) = @f'. !x y. f(x) dot y = x dot f'(y)`;; + +let ADJOINT_WORKS = prove + (`!f:real^M->real^N. linear f ==> !x y. f(x) dot y = x dot (adjoint f)(y)`, + GEN_TAC THEN DISCH_TAC THEN SIMP_TAC[adjoint] THEN CONV_TAC SELECT_CONV THEN + ONCE_REWRITE_TAC[SWAP_FORALL_THM] THEN ONCE_REWRITE_TAC[GSYM SKOLEM_THM] THEN + X_GEN_TAC `y:real^N` THEN + EXISTS_TAC `(lambda i. (f:real^M->real^N) (basis i) dot y):real^M` THEN + X_GEN_TAC `x:real^M` THEN + GEN_REWRITE_TAC (funpow 2 LAND_CONV o RAND_CONV) [GSYM BASIS_EXPANSION] THEN + ASM_SIMP_TAC[LINEAR_VSUM; FINITE_NUMSEG] THEN + SIMP_TAC[dot; LAMBDA_BETA; VSUM_COMPONENT; GSYM SUM_LMUL; GSYM SUM_RMUL] THEN + GEN_REWRITE_TAC RAND_CONV [SUM_SWAP_NUMSEG] THEN + ASM_SIMP_TAC[o_THM; VECTOR_MUL_COMPONENT; LINEAR_CMUL; REAL_MUL_ASSOC]);; + +let ADJOINT_LINEAR = prove + (`!f:real^M->real^N. linear f ==> linear(adjoint f)`, + REPEAT STRIP_TAC THEN REWRITE_TAC[linear; GSYM VECTOR_EQ_LDOT] THEN + ASM_SIMP_TAC[DOT_RMUL; DOT_RADD; GSYM ADJOINT_WORKS]);; + +let ADJOINT_CLAUSES = prove + (`!f:real^M->real^N. + linear f ==> (!x y. x dot (adjoint f)(y) = f(x) dot y) /\ + (!x y. (adjoint f)(y) dot x = y dot f(x))`, + MESON_TAC[ADJOINT_WORKS; DOT_SYM]);; + +let ADJOINT_ADJOINT = prove + (`!f:real^M->real^N. linear f ==> adjoint(adjoint f) = f`, + SIMP_TAC[FUN_EQ_THM; GSYM VECTOR_EQ_LDOT; ADJOINT_CLAUSES; ADJOINT_LINEAR]);; + +let ADJOINT_UNIQUE = prove + (`!f f'. linear f /\ (!x y. f'(x) dot y = x dot f(y)) + ==> f' = adjoint f`, + SIMP_TAC[FUN_EQ_THM; GSYM VECTOR_EQ_RDOT; ADJOINT_CLAUSES]);; + +(* ------------------------------------------------------------------------- *) +(* Matrix notation. NB: an MxN matrix is of type real^N^M, not real^M^N. *) +(* We could define a special type if we're going to use them a lot. *) +(* ------------------------------------------------------------------------- *) + +overload_interface ("--",`(matrix_neg):real^N^M->real^N^M`);; +overload_interface ("+",`(matrix_add):real^N^M->real^N^M->real^N^M`);; +overload_interface ("-",`(matrix_sub):real^N^M->real^N^M->real^N^M`);; + +make_overloadable "**" `:A->B->C`;; + +overload_interface ("**",`(matrix_mul):real^N^M->real^P^N->real^P^M`);; +overload_interface ("**",`(matrix_vector_mul):real^N^M->real^N->real^M`);; +overload_interface ("**",`(vector_matrix_mul):real^M->real^N^M->real^N`);; + +parse_as_infix("%%",(21,"right"));; + +prioritize_real();; + +let matrix_cmul = new_definition + `((%%):real->real^N^M->real^N^M) c A = lambda i j. c * A$i$j`;; + +let matrix_neg = new_definition + `!A:real^N^M. --A = lambda i j. --(A$i$j)`;; + +let matrix_add = new_definition + `!A:real^N^M B:real^N^M. A + B = lambda i j. A$i$j + B$i$j`;; + +let matrix_sub = new_definition + `!A:real^N^M B:real^N^M. A - B = lambda i j. A$i$j - B$i$j`;; + +let matrix_mul = new_definition + `!A:real^N^M B:real^P^N. + A ** B = + lambda i j. sum(1..dimindex(:N)) (\k. A$i$k * B$k$j)`;; + +let matrix_vector_mul = new_definition + `!A:real^N^M x:real^N. + A ** x = lambda i. sum(1..dimindex(:N)) (\j. A$i$j * x$j)`;; + +let vector_matrix_mul = new_definition + `!A:real^N^M x:real^M. + x ** A = lambda j. sum(1..dimindex(:M)) (\i. A$i$j * x$i)`;; + +let mat = new_definition + `(mat:num->real^N^M) k = lambda i j. if i = j then &k else &0`;; + +let transp = new_definition + `(transp:real^N^M->real^M^N) A = lambda i j. A$j$i`;; + +let row = new_definition + `(row:num->real^N^M->real^N) i A = lambda j. A$i$j`;; + +let column = new_definition + `(column:num->real^N^M->real^M) j A = lambda i. A$i$j`;; + +let rows = new_definition + `rows(A:real^N^M) = { row i A | 1 <= i /\ i <= dimindex(:M)}`;; + +let columns = new_definition + `columns(A:real^N^M) = { column i A | 1 <= i /\ i <= dimindex(:N)}`;; + +let MATRIX_CMUL_COMPONENT = prove + (`!c A:real^N^M i. (c %% A)$i$j = c * A$i$j`, + REPEAT GEN_TAC THEN + SUBGOAL_THEN `?k. 1 <= k /\ k <= dimindex(:M) /\ !A:real^N^M. A$i = A$k` + CHOOSE_TAC THENL [REWRITE_TAC[FINITE_INDEX_INRANGE]; ALL_TAC] THEN + SUBGOAL_THEN `?l. 1 <= l /\ l <= dimindex(:N) /\ !z:real^N. z$j = z$l` + CHOOSE_TAC THENL [REWRITE_TAC[FINITE_INDEX_INRANGE]; ALL_TAC] THEN + ASM_SIMP_TAC[matrix_cmul; CART_EQ; LAMBDA_BETA]);; + +let MATRIX_ADD_COMPONENT = prove + (`!A B:real^N^M i j. (A + B)$i$j = A$i$j + B$i$j`, + REPEAT GEN_TAC THEN + SUBGOAL_THEN `?k. 1 <= k /\ k <= dimindex(:M) /\ !A:real^N^M. A$i = A$k` + CHOOSE_TAC THENL [REWRITE_TAC[FINITE_INDEX_INRANGE]; ALL_TAC] THEN + SUBGOAL_THEN `?l. 1 <= l /\ l <= dimindex(:N) /\ !z:real^N. z$j = z$l` + CHOOSE_TAC THENL [REWRITE_TAC[FINITE_INDEX_INRANGE]; ALL_TAC] THEN + ASM_SIMP_TAC[matrix_add; LAMBDA_BETA]);; + +let MATRIX_SUB_COMPONENT = prove + (`!A B:real^N^M i j. (A - B)$i$j = A$i$j - B$i$j`, + REPEAT GEN_TAC THEN + SUBGOAL_THEN `?k. 1 <= k /\ k <= dimindex(:M) /\ !A:real^N^M. A$i = A$k` + CHOOSE_TAC THENL [REWRITE_TAC[FINITE_INDEX_INRANGE]; ALL_TAC] THEN + SUBGOAL_THEN `?l. 1 <= l /\ l <= dimindex(:N) /\ !z:real^N. z$j = z$l` + CHOOSE_TAC THENL [REWRITE_TAC[FINITE_INDEX_INRANGE]; ALL_TAC] THEN + ASM_SIMP_TAC[matrix_sub; LAMBDA_BETA]);; + +let MATRIX_NEG_COMPONENT = prove + (`!A:real^N^M i j. (--A)$i$j = --(A$i$j)`, + REPEAT GEN_TAC THEN + SUBGOAL_THEN `?k. 1 <= k /\ k <= dimindex(:M) /\ !A:real^N^M. A$i = A$k` + CHOOSE_TAC THENL [REWRITE_TAC[FINITE_INDEX_INRANGE]; ALL_TAC] THEN + SUBGOAL_THEN `?l. 1 <= l /\ l <= dimindex(:N) /\ !z:real^N. z$j = z$l` + CHOOSE_TAC THENL [REWRITE_TAC[FINITE_INDEX_INRANGE]; ALL_TAC] THEN + ASM_SIMP_TAC[matrix_neg; LAMBDA_BETA]);; + +let TRANSP_COMPONENT = prove + (`!A:real^N^M i j. (transp A)$i$j = A$j$i`, + REPEAT GEN_TAC THEN + SUBGOAL_THEN `?k. 1 <= k /\ k <= dimindex(:N) /\ + (!A:real^M^N. A$i = A$k) /\ (!z:real^N. z$i = z$k)` + CHOOSE_TAC THENL [REWRITE_TAC[FINITE_INDEX_INRANGE_2]; ALL_TAC] THEN + SUBGOAL_THEN `?l. 1 <= l /\ l <= dimindex(:M) /\ + (!A:real^N^M. A$j = A$l) /\ (!z:real^M. z$j = z$l)` + CHOOSE_TAC THENL [REWRITE_TAC[FINITE_INDEX_INRANGE_2]; ALL_TAC] THEN + ASM_SIMP_TAC[transp; LAMBDA_BETA]);; + +let MAT_COMPONENT = prove + (`!n i j. + 1 <= i /\ i <= dimindex(:M) /\ + 1 <= j /\ j <= dimindex(:N) + ==> (mat n:real^N^M)$i$j = if i = j then &n else &0`, + SIMP_TAC[mat; LAMBDA_BETA]);; + +let MATRIX_CMUL_ASSOC = prove + (`!a b X:real^M^N. a %% (b %% X) = (a * b) %% X`, + SIMP_TAC[CART_EQ; matrix_cmul; LAMBDA_BETA; REAL_MUL_ASSOC]);; + +let MATRIX_CMUL_LID = prove + (`!X:real^M^N. &1 %% X = X`, + SIMP_TAC[CART_EQ; matrix_cmul; LAMBDA_BETA; REAL_MUL_LID]);; + +let MATRIX_ADD_SYM = prove + (`!A:real^N^M B. A + B = B + A`, + SIMP_TAC[matrix_add; CART_EQ; LAMBDA_BETA; REAL_ADD_AC]);; + +let MATRIX_ADD_ASSOC = prove + (`!A:real^N^M B C. A + (B + C) = (A + B) + C`, + SIMP_TAC[matrix_add; CART_EQ; LAMBDA_BETA; REAL_ADD_AC]);; + +let MATRIX_ADD_LID = prove + (`!A. mat 0 + A = A`, + SIMP_TAC[matrix_add; mat; COND_ID; CART_EQ; LAMBDA_BETA; REAL_ADD_LID]);; + +let MATRIX_ADD_RID = prove + (`!A. A + mat 0 = A`, + SIMP_TAC[matrix_add; mat; COND_ID; CART_EQ; LAMBDA_BETA; REAL_ADD_RID]);; + +let MATRIX_ADD_LNEG = prove + (`!A. --A + A = mat 0`, + SIMP_TAC[matrix_neg; matrix_add; mat; COND_ID; + CART_EQ; LAMBDA_BETA; REAL_ADD_LINV]);; + +let MATRIX_ADD_RNEG = prove + (`!A. A + --A = mat 0`, + SIMP_TAC[matrix_neg; matrix_add; mat; COND_ID; + CART_EQ; LAMBDA_BETA; REAL_ADD_RINV]);; + +let MATRIX_SUB = prove + (`!A:real^N^M B. A - B = A + --B`, + SIMP_TAC[matrix_neg; matrix_add; matrix_sub; CART_EQ; LAMBDA_BETA; + real_sub]);; + +let MATRIX_SUB_REFL = prove + (`!A. A - A = mat 0`, + REWRITE_TAC[MATRIX_SUB; MATRIX_ADD_RNEG]);; + +let MATRIX_ADD_LDISTRIB = prove + (`!A:real^N^M B:real^P^N C. A ** (B + C) = A ** B + A ** C`, + SIMP_TAC[matrix_mul; matrix_add; CART_EQ; LAMBDA_BETA; + GSYM SUM_ADD_NUMSEG] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC SUM_EQ_NUMSEG THEN + ASM_SIMP_TAC[LAMBDA_BETA; REAL_ADD_LDISTRIB]);; + +let MATRIX_MUL_LID = prove + (`!A:real^N^M. mat 1 ** A = A`, + REWRITE_TAC[matrix_mul; + GEN_REWRITE_RULE (RAND_CONV o ONCE_DEPTH_CONV) [EQ_SYM_EQ] + (SPEC_ALL mat)] THEN + SIMP_TAC[CART_EQ; LAMBDA_BETA] THEN REWRITE_TAC[COND_RATOR; COND_RAND] THEN + SIMP_TAC[SUM_DELTA; REAL_MUL_LZERO; IN_NUMSEG; REAL_MUL_LID]);; + +let MATRIX_MUL_RID = prove + (`!A:real^N^M. A ** mat 1 = A`, + REWRITE_TAC[matrix_mul; mat] THEN + SIMP_TAC[CART_EQ; LAMBDA_BETA] THEN REWRITE_TAC[COND_RATOR; COND_RAND] THEN + SIMP_TAC[SUM_DELTA; REAL_MUL_RZERO; IN_NUMSEG; REAL_MUL_RID]);; + +let MATRIX_MUL_ASSOC = prove + (`!A:real^N^M B:real^P^N C:real^Q^P. A ** B ** C = (A ** B) ** C`, + REPEAT GEN_TAC THEN + SIMP_TAC[matrix_mul; CART_EQ; LAMBDA_BETA; GSYM SUM_LMUL; GSYM SUM_RMUL] THEN + REWRITE_TAC[REAL_MUL_ASSOC] THEN REPEAT STRIP_TAC THEN + GEN_REWRITE_TAC RAND_CONV [SUM_SWAP_NUMSEG] THEN REWRITE_TAC[]);; + +let MATRIX_MUL_LZERO = prove + (`!A. (mat 0:real^N^M) ** (A:real^P^N) = mat 0`, + SIMP_TAC[matrix_mul; mat; CART_EQ; LAMBDA_BETA; COND_ID; REAL_MUL_LZERO] THEN + REWRITE_TAC[SUM_0]);; + +let MATRIX_MUL_RZERO = prove + (`!A. (A:real^N^M) ** (mat 0:real^P^N) = mat 0`, + SIMP_TAC[matrix_mul; mat; CART_EQ; LAMBDA_BETA; COND_ID; REAL_MUL_RZERO] THEN + REWRITE_TAC[SUM_0]);; + +let MATRIX_ADD_RDISTRIB = prove + (`!A:real^N^M B C:real^P^N. (A + B) ** C = A ** C + B ** C`, + SIMP_TAC[matrix_mul; matrix_add; CART_EQ; LAMBDA_BETA] THEN + REWRITE_TAC[REAL_ADD_RDISTRIB; SUM_ADD_NUMSEG]);; + +let MATRIX_SUB_LDISTRIB = prove + (`!A:real^N^M B C:real^P^N. A ** (B - C) = A ** B - A ** C`, + SIMP_TAC[matrix_mul; matrix_sub; CART_EQ; LAMBDA_BETA] THEN + REWRITE_TAC[REAL_SUB_LDISTRIB; SUM_SUB_NUMSEG]);; + +let MATRIX_SUB_RDISTRIB = prove + (`!A:real^N^M B C:real^P^N. (A - B) ** C = A ** C - B ** C`, + SIMP_TAC[matrix_mul; matrix_sub; CART_EQ; LAMBDA_BETA] THEN + REWRITE_TAC[REAL_SUB_RDISTRIB; SUM_SUB_NUMSEG]);; + +let MATRIX_MUL_LMUL = prove + (`!A:real^N^M B:real^P^N c. (c %% A) ** B = c %% (A ** B)`, + SIMP_TAC[matrix_mul; matrix_cmul; CART_EQ; LAMBDA_BETA] THEN + REWRITE_TAC[GSYM REAL_MUL_ASSOC; SUM_LMUL]);; + +let MATRIX_MUL_RMUL = prove + (`!A:real^N^M B:real^P^N c. A ** (c %% B) = c %% (A ** B)`, + SIMP_TAC[matrix_mul; matrix_cmul; CART_EQ; LAMBDA_BETA] THEN + ONCE_REWRITE_TAC[REAL_ARITH `A * c * B:real = c * A * B`] THEN + REWRITE_TAC[SUM_LMUL]);; + +let MATRIX_CMUL_ADD_LDISTRIB = prove + (`!A:real^N^M B c. c %% (A + B) = c %% A + c %% B`, + SIMP_TAC[matrix_cmul; matrix_add; CART_EQ; LAMBDA_BETA] THEN + REWRITE_TAC[REAL_ADD_LDISTRIB]);; + +let MATRIX_CMUL_SUB_LDISTRIB = prove + (`!A:real^N^M B c. c %% (A - B) = c %% A - c %% B`, + SIMP_TAC[matrix_cmul; matrix_sub; CART_EQ; LAMBDA_BETA] THEN + REWRITE_TAC[REAL_SUB_LDISTRIB]);; + +let MATRIX_CMUL_ADD_RDISTRIB = prove + (`!A:real^N^M b c. (b + c) %% A = b %% A + c %% A`, + SIMP_TAC[matrix_cmul; matrix_add; CART_EQ; LAMBDA_BETA] THEN + REWRITE_TAC[REAL_ADD_RDISTRIB]);; + +let MATRIX_CMUL_SUB_RDISTRIB = prove + (`!A:real^N^M b c. (b - c) %% A = b %% A - c %% A`, + SIMP_TAC[matrix_cmul; matrix_sub; CART_EQ; LAMBDA_BETA] THEN + REWRITE_TAC[REAL_SUB_RDISTRIB]);; + +let MATRIX_CMUL_RZERO = prove + (`!c. c %% mat 0 = mat 0`, + SIMP_TAC[matrix_cmul; mat; CART_EQ; LAMBDA_BETA; COND_ID; REAL_MUL_RZERO]);; + +let MATRIX_CMUL_LZERO = prove + (`!A. &0 %% A = mat 0`, + SIMP_TAC[matrix_cmul; mat; CART_EQ; LAMBDA_BETA; COND_ID; REAL_MUL_LZERO]);; + +let MATRIX_NEG_MINUS1 = prove + (`!A:real^N^M. --A = --(&1) %% A`, + REWRITE_TAC[matrix_cmul; matrix_neg; CART_EQ; LAMBDA_BETA] THEN + REWRITE_TAC[GSYM REAL_NEG_MINUS1]);; + +let MATRIX_ADD_AC = prove + (`(A:real^N^M) + B = B + A /\ + (A + B) + C = A + (B + C) /\ + A + (B + C) = B + (A + C)`, + MESON_TAC[MATRIX_ADD_ASSOC; MATRIX_ADD_SYM]);; + +let MATRIX_NEG_ADD = prove + (`!A B:real^N^M. --(A + B) = --A + --B`, + SIMP_TAC[matrix_neg; matrix_add; CART_EQ; LAMBDA_BETA; REAL_NEG_ADD]);; + +let MATRIX_NEG_SUB = prove + (`!A B:real^N^M. --(A - B) = B - A`, + SIMP_TAC[matrix_neg; matrix_sub; CART_EQ; LAMBDA_BETA; REAL_NEG_SUB]);; + +let MATRIX_NEG_0 = prove + (`--(mat 0) = mat 0`, + SIMP_TAC[CART_EQ; mat; matrix_neg; LAMBDA_BETA; REAL_NEG_0; COND_ID]);; + +let MATRIX_SUB_RZERO = prove + (`!A:real^N^M. A - mat 0 = A`, + SIMP_TAC[CART_EQ; mat; matrix_sub; LAMBDA_BETA; REAL_SUB_RZERO; COND_ID]);; + +let MATRIX_SUB_LZERO = prove + (`!A:real^N^M. mat 0 - A = --A`, + SIMP_TAC[CART_EQ; mat; matrix_sub; matrix_neg; + LAMBDA_BETA; REAL_SUB_LZERO; COND_ID]);; + +let MATRIX_NEG_EQ_0 = prove + (`!A:real^N^M. --A = mat 0 <=> A = mat 0`, + SIMP_TAC[CART_EQ; matrix_neg; mat; LAMBDA_BETA; REAL_NEG_EQ_0; COND_ID]);; + +let MATRIX_VECTOR_MUL_ASSOC = prove + (`!A:real^N^M B:real^P^N x:real^P. A ** B ** x = (A ** B) ** x`, + REPEAT GEN_TAC THEN + SIMP_TAC[matrix_mul; matrix_vector_mul; + CART_EQ; LAMBDA_BETA; GSYM SUM_LMUL; GSYM SUM_RMUL] THEN + REWRITE_TAC[REAL_MUL_ASSOC] THEN REPEAT STRIP_TAC THEN + GEN_REWRITE_TAC RAND_CONV [SUM_SWAP_NUMSEG] THEN REWRITE_TAC[]);; + +let MATRIX_VECTOR_MUL_LID = prove + (`!x:real^N. mat 1 ** x = x`, + REWRITE_TAC[matrix_vector_mul; + GEN_REWRITE_RULE (RAND_CONV o ONCE_DEPTH_CONV) [EQ_SYM_EQ] + (SPEC_ALL mat)] THEN + SIMP_TAC[CART_EQ; LAMBDA_BETA] THEN REWRITE_TAC[COND_RATOR; COND_RAND] THEN + SIMP_TAC[SUM_DELTA; REAL_MUL_LZERO; IN_NUMSEG; REAL_MUL_LID]);; + +let MATRIX_VECTOR_MUL_LZERO = prove + (`!x:real^N. mat 0 ** x = vec 0`, + SIMP_TAC[mat; matrix_vector_mul; CART_EQ; VEC_COMPONENT; LAMBDA_BETA; + COND_ID; REAL_MUL_LZERO; SUM_0]);; + +let MATRIX_VECTOR_MUL_RZERO = prove + (`!A:real^M^N. A ** vec 0 = vec 0`, + SIMP_TAC[mat; matrix_vector_mul; CART_EQ; VEC_COMPONENT; LAMBDA_BETA; + COND_ID; REAL_MUL_RZERO; SUM_0]);; + +let MATRIX_VECTOR_MUL_ADD_LDISTRIB = prove + (`!A:real^M^N x:real^M y. A ** (x + y) = A ** x + A ** y`, + SIMP_TAC[CART_EQ; matrix_vector_mul; VECTOR_ADD_COMPONENT; LAMBDA_BETA; + SUM_ADD_NUMSEG; REAL_ADD_LDISTRIB]);; + +let MATRIX_VECTOR_MUL_SUB_LDISTRIB = prove + (`!A:real^M^N x:real^M y. A ** (x - y) = A ** x - A ** y`, + SIMP_TAC[CART_EQ; matrix_vector_mul; VECTOR_SUB_COMPONENT; LAMBDA_BETA; + SUM_SUB_NUMSEG; REAL_SUB_LDISTRIB]);; + +let MATRIX_VECTOR_MUL_ADD_RDISTRIB = prove + (`!A:real^M^N B x. (A + B) ** x = (A ** x) + (B ** x)`, + SIMP_TAC[CART_EQ; matrix_vector_mul; matrix_add; LAMBDA_BETA; + VECTOR_ADD_COMPONENT; REAL_ADD_RDISTRIB; SUM_ADD_NUMSEG]);; + +let MATRIX_VECTOR_MUL_SUB_RDISTRIB = prove + (`!A:real^M^N B x. (A - B) ** x = (A ** x) - (B ** x)`, + SIMP_TAC[CART_EQ; matrix_vector_mul; matrix_sub; LAMBDA_BETA; + VECTOR_SUB_COMPONENT; REAL_SUB_RDISTRIB; SUM_SUB_NUMSEG]);; + +let MATRIX_VECTOR_MUL_RMUL = prove + (`!A:real^M^N x:real^M c. A ** (c % x) = c % (A ** x)`, + SIMP_TAC[CART_EQ; VECTOR_MUL_COMPONENT; matrix_vector_mul; LAMBDA_BETA] THEN + REWRITE_TAC[GSYM SUM_LMUL] THEN REWRITE_TAC[REAL_MUL_AC]);; + +let MATRIX_TRANSP_MUL = prove + (`!A B. transp(A ** B) = transp(B) ** transp(A)`, + SIMP_TAC[matrix_mul; transp; CART_EQ; LAMBDA_BETA] THEN + REWRITE_TAC[REAL_MUL_AC]);; + +let MATRIX_EQ = prove + (`!A:real^N^M B. (A = B) = !x:real^N. A ** x = B ** x`, + REPEAT GEN_TAC THEN EQ_TAC THENL [MESON_TAC[]; ALL_TAC] THEN + DISCH_THEN(MP_TAC o GEN `i:num` o SPEC `(basis i):real^N`) THEN + SIMP_TAC[CART_EQ; matrix_vector_mul; LAMBDA_BETA; basis] THEN + SIMP_TAC[SUM_DELTA; COND_RAND; REAL_MUL_RZERO] THEN + REWRITE_TAC[TAUT `(if p then b else T) <=> p ==> b`] THEN + SIMP_TAC[REAL_MUL_RID; IN_NUMSEG]);; + +let MATRIX_VECTOR_MUL_COMPONENT = prove + (`!A:real^N^M x k. + 1 <= k /\ k <= dimindex(:M) ==> ((A ** x)$k = (A$k) dot x)`, + SIMP_TAC[matrix_vector_mul; LAMBDA_BETA; dot]);; + +let DOT_LMUL_MATRIX = prove + (`!A:real^N^M x:real^M y:real^N. (x ** A) dot y = x dot (A ** y)`, + SIMP_TAC[dot; matrix_vector_mul; vector_matrix_mul; dot; LAMBDA_BETA] THEN + REPEAT GEN_TAC THEN REWRITE_TAC[GSYM SUM_LMUL] THEN + REWRITE_TAC[GSYM SUM_RMUL] THEN + GEN_REWRITE_TAC RAND_CONV [SUM_SWAP_NUMSEG] THEN REWRITE_TAC[REAL_MUL_AC]);; + +let TRANSP_MATRIX_CMUL = prove + (`!A:real^M^N c. transp(c %% A) = c %% transp A`, + SIMP_TAC[CART_EQ; transp; MATRIX_CMUL_COMPONENT; LAMBDA_BETA]);; + +let TRANSP_MATRIX_ADD = prove + (`!A B:real^N^M. transp(A + B) = transp A + transp B`, + SIMP_TAC[CART_EQ; transp; LAMBDA_BETA; matrix_add]);; + +let TRANSP_MATRIX_SUB = prove + (`!A B:real^N^M. transp(A - B) = transp A - transp B`, + SIMP_TAC[CART_EQ; transp; LAMBDA_BETA; matrix_sub]);; + +let TRANSP_MATRIX_NEG = prove + (`!A:real^N^M. transp(--A) = --(transp A)`, + SIMP_TAC[CART_EQ; transp; LAMBDA_BETA; matrix_neg]);; + +let TRANSP_MAT = prove + (`!n. transp(mat n) = mat n`, + SIMP_TAC[transp; mat; LAMBDA_BETA; CART_EQ; EQ_SYM_EQ]);; + +let TRANSP_TRANSP = prove + (`!A:real^N^M. transp(transp A) = A`, + SIMP_TAC[CART_EQ; transp; LAMBDA_BETA]);; + +let TRANSP_EQ = prove + (`!A B:real^M^N. transp A = transp B <=> A = B`, + MESON_TAC[TRANSP_TRANSP]);; + +let ROW_TRANSP = prove + (`!A:real^N^M i. + 1 <= i /\ i <= dimindex(:N) ==> row i (transp A) = column i A`, + SIMP_TAC[row; column; transp; CART_EQ; LAMBDA_BETA]);; + +let COLUMN_TRANSP = prove + (`!A:real^N^M i. + 1 <= i /\ i <= dimindex(:M) ==> column i (transp A) = row i A`, + SIMP_TAC[row; column; transp; CART_EQ; LAMBDA_BETA]);; + +let ROWS_TRANSP = prove + (`!A:real^N^M. rows(transp A) = columns A`, + REWRITE_TAC[rows; columns; EXTENSION; IN_ELIM_THM] THEN + MESON_TAC[ROW_TRANSP]);; + +let COLUMNS_TRANSP = prove + (`!A:real^N^M. columns(transp A) = rows A`, + MESON_TAC[TRANSP_TRANSP; ROWS_TRANSP]);; + +let VECTOR_MATRIX_MUL_TRANSP = prove + (`!A:real^M^N x:real^N. x ** A = transp A ** x`, + REWRITE_TAC[matrix_vector_mul; vector_matrix_mul; transp] THEN + SIMP_TAC[LAMBDA_BETA; CART_EQ]);; + +let MATRIX_VECTOR_MUL_TRANSP = prove + (`!A:real^M^N x:real^M. A ** x = x ** transp A`, + REWRITE_TAC[VECTOR_MATRIX_MUL_TRANSP; TRANSP_TRANSP]);; + +(* ------------------------------------------------------------------------- *) +(* Two sometimes fruitful ways of looking at matrix-vector multiplication. *) +(* ------------------------------------------------------------------------- *) + +let MATRIX_MUL_DOT = prove + (`!A:real^N^M x. A ** x = lambda i. A$i dot x`, + REWRITE_TAC[matrix_vector_mul; dot] THEN SIMP_TAC[CART_EQ; LAMBDA_BETA]);; + +let MATRIX_MUL_VSUM = prove + (`!A:real^N^M x. A ** x = vsum(1..dimindex(:N)) (\i. x$i % column i A)`, + SIMP_TAC[matrix_vector_mul; CART_EQ; VSUM_COMPONENT; LAMBDA_BETA; + VECTOR_MUL_COMPONENT; column; REAL_MUL_AC]);; + +(* ------------------------------------------------------------------------- *) +(* Slightly gruesome lemmas: better to define sums over vectors really... *) +(* ------------------------------------------------------------------------- *) + +let VECTOR_COMPONENTWISE = prove + (`!x:real^N. + x = lambda j. sum(1..dimindex(:N)) + (\i. x$i * (basis i :real^N)$j)`, + SIMP_TAC[CART_EQ; LAMBDA_BETA; basis] THEN + ONCE_REWRITE_TAC[ARITH_RULE `(m:num = n) <=> (n = m)`] THEN + SIMP_TAC[COND_RAND; REAL_MUL_RZERO; SUM_DELTA; IN_NUMSEG] THEN + REWRITE_TAC[REAL_MUL_RID; COND_ID]);; + +let LINEAR_COMPONENTWISE = prove + (`!f:real^M->real^N. + linear(f) + ==> !x j. 1 <= j /\ j <= dimindex(:N) + ==> (f x $j = + sum(1..dimindex(:M)) (\i. x$i * f(basis i)$j))`, + REWRITE_TAC[linear] THEN REPEAT STRIP_TAC THEN + GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o RAND_CONV) + [VECTOR_COMPONENTWISE] THEN + SPEC_TAC(`dimindex(:M)`,`n:num`) THEN + INDUCT_TAC THEN REWRITE_TAC[SUM_CLAUSES_NUMSEG; ARITH] THENL + [REWRITE_TAC[GSYM vec] THEN + GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o RAND_CONV) + [GSYM VECTOR_MUL_LZERO] THEN + ASM_REWRITE_TAC[] THEN REWRITE_TAC[VECTOR_MUL_LZERO] THEN + ASM_SIMP_TAC[vec; LAMBDA_BETA]; + REWRITE_TAC[ARITH_RULE `1 <= SUC n`] THEN + ASSUM_LIST(fun thl -> REWRITE_TAC(map GSYM thl)) THEN + SIMP_TAC[GSYM VECTOR_MUL_COMPONENT; + ASSUME `1 <= j`; ASSUME `j <= dimindex(:N)`] THEN + ASSUM_LIST(fun thl -> REWRITE_TAC(map GSYM thl)) THEN + SIMP_TAC[GSYM VECTOR_ADD_COMPONENT; + ASSUME `1 <= j`; ASSUME `j <= dimindex(:N)`] THEN + ASSUM_LIST(fun thl -> REWRITE_TAC(map GSYM thl)) THEN + AP_THM_TAC THEN AP_TERM_TAC THEN AP_TERM_TAC THEN + ASM_SIMP_TAC[CART_EQ; VECTOR_ADD_COMPONENT; LAMBDA_BETA] THEN + SIMP_TAC[VECTOR_MUL_COMPONENT]]);; + +(* ------------------------------------------------------------------------- *) +(* Inverse matrices (not necessarily square, but it's vacuous otherwise). *) +(* ------------------------------------------------------------------------- *) + +let invertible = new_definition + `invertible(A:real^N^M) <=> + ?A':real^M^N. (A ** A' = mat 1) /\ (A' ** A = mat 1)`;; + +let matrix_inv = new_definition + `matrix_inv(A:real^N^M) = + @A':real^M^N. (A ** A' = mat 1) /\ (A' ** A = mat 1)`;; + +let MATRIX_INV = prove + (`!A:real^N^M. + invertible A ==> A ** matrix_inv A = mat 1 /\ matrix_inv A ** A = mat 1`, + GEN_TAC THEN DISCH_TAC THEN REWRITE_TAC[matrix_inv; invertible] THEN + CONV_TAC SELECT_CONV THEN ASM_REWRITE_TAC[GSYM invertible]);; + +(* ------------------------------------------------------------------------- *) +(* Correspondence between matrices and linear operators. *) +(* ------------------------------------------------------------------------- *) + +let matrix = new_definition + `(matrix:(real^M->real^N)->real^M^N) f = lambda i j. f(basis j)$i`;; + +let MATRIX_VECTOR_MUL_LINEAR = prove + (`!A:real^N^M. linear(\x. A ** x)`, + REWRITE_TAC[linear; matrix_vector_mul] THEN + SIMP_TAC[CART_EQ; LAMBDA_BETA; VECTOR_ADD_COMPONENT; + VECTOR_MUL_COMPONENT] THEN + REWRITE_TAC[GSYM SUM_ADD_NUMSEG; GSYM SUM_LMUL; REAL_ADD_LDISTRIB] THEN + REWRITE_TAC[REAL_ADD_AC; REAL_MUL_AC]);; + +let MATRIX_WORKS = prove + (`!f:real^M->real^N. linear f ==> !x. matrix f ** x = f(x)`, + REWRITE_TAC[matrix; matrix_vector_mul] THEN + SIMP_TAC[CART_EQ; LAMBDA_BETA] THEN GEN_TAC THEN DISCH_TAC THEN + REPEAT GEN_TAC THEN DISCH_TAC THEN + ONCE_REWRITE_TAC[REAL_MUL_SYM] THEN + ASM_SIMP_TAC[GSYM LINEAR_COMPONENTWISE]);; + +let MATRIX_VECTOR_MUL = prove + (`!f:real^M->real^N. linear f ==> f = \x. matrix f ** x`, + SIMP_TAC[FUN_EQ_THM; MATRIX_WORKS]);; + +let MATRIX_OF_MATRIX_VECTOR_MUL = prove + (`!A:real^N^M. matrix(\x. A ** x) = A`, + SIMP_TAC[MATRIX_EQ; MATRIX_VECTOR_MUL_LINEAR; MATRIX_WORKS]);; + +let MATRIX_COMPOSE = prove + (`!f g. linear f /\ linear g ==> (matrix(g o f) = matrix g ** matrix f)`, + SIMP_TAC[MATRIX_EQ; MATRIX_WORKS; LINEAR_COMPOSE; + GSYM MATRIX_VECTOR_MUL_ASSOC; o_THM]);; + +let MATRIX_VECTOR_COLUMN = prove + (`!A:real^N^M x. + A ** x = vsum(1..dimindex(:N)) (\i. x$i % (transp A)$i)`, + REWRITE_TAC[matrix_vector_mul; transp] THEN + SIMP_TAC[CART_EQ; LAMBDA_BETA; VSUM_COMPONENT; VECTOR_MUL_COMPONENT] THEN + REWRITE_TAC[REAL_MUL_AC]);; + +let MATRIX_MUL_COMPONENT = prove + (`!i. 1 <= i /\ i <= dimindex(:N) + ==> ((A:real^N^N) ** (B:real^N^N))$i = transp B ** A$i`, + SIMP_TAC[matrix_mul; LAMBDA_BETA; matrix_vector_mul; vector_matrix_mul; + transp; CART_EQ] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC SUM_EQ_NUMSEG THEN + REWRITE_TAC[REAL_MUL_AC]);; + +let ADJOINT_MATRIX = prove + (`!A:real^N^M. adjoint(\x. A ** x) = (\x. transp A ** x)`, + GEN_TAC THEN CONV_TAC SYM_CONV THEN MATCH_MP_TAC ADJOINT_UNIQUE THEN + REWRITE_TAC[MATRIX_VECTOR_MUL_LINEAR] THEN REPEAT GEN_TAC THEN + SIMP_TAC[transp; dot; LAMBDA_BETA; matrix_vector_mul; + GSYM SUM_LMUL; GSYM SUM_RMUL] THEN + GEN_REWRITE_TAC LAND_CONV [SUM_SWAP_NUMSEG] THEN REWRITE_TAC[REAL_MUL_AC]);; + +let MATRIX_ADJOINT = prove + (`!f. linear f ==> matrix(adjoint f) = transp(matrix f)`, + GEN_TAC THEN DISCH_THEN + (fun th -> GEN_REWRITE_TAC (LAND_CONV o funpow 2 RAND_CONV) + [MATCH_MP MATRIX_VECTOR_MUL th]) THEN + REWRITE_TAC[ADJOINT_MATRIX; MATRIX_OF_MATRIX_VECTOR_MUL]);; + +let MATRIX_ID = prove + (`matrix(\x. x) = mat 1`, + SIMP_TAC[MATRIX_EQ; LINEAR_ID; MATRIX_WORKS; MATRIX_VECTOR_MUL_LID]);; + +let MATRIX_I = prove + (`matrix I = mat 1`, + REWRITE_TAC[I_DEF; MATRIX_ID]);; + +let LINEAR_EQ_MATRIX = prove + (`!f g. linear f /\ linear g /\ matrix f = matrix g ==> f = g`, + REPEAT STRIP_TAC THEN + REPEAT(FIRST_X_ASSUM(SUBST1_TAC o MATCH_MP MATRIX_VECTOR_MUL)) THEN + ASM_REWRITE_TAC[]);; + +(* ------------------------------------------------------------------------- *) +(* Operator norm. *) +(* ------------------------------------------------------------------------- *) + +let onorm = new_definition + `onorm (f:real^M->real^N) = sup { norm(f x) | norm(x) = &1 }`;; + +let NORM_BOUND_GENERALIZE = prove + (`!f:real^M->real^N b. + linear f + ==> ((!x. (norm(x) = &1) ==> norm(f x) <= b) <=> + (!x. norm(f x) <= b * norm(x)))`, + REPEAT STRIP_TAC THEN EQ_TAC THEN DISCH_TAC THENL + [ALL_TAC; ASM_MESON_TAC[REAL_MUL_RID]] THEN + X_GEN_TAC `x:real^M` THEN ASM_CASES_TAC `x:real^M = vec 0` THENL + [ASM_REWRITE_TAC[NORM_0; REAL_MUL_RZERO] THEN + ASM_MESON_TAC[LINEAR_0; NORM_0; REAL_LE_REFL]; + ALL_TAC] THEN + ASM_SIMP_TAC[GSYM REAL_LE_LDIV_EQ; NORM_POS_LT; real_div] THEN + MATCH_MP_TAC(REAL_ARITH `abs(a * b) <= c ==> b * a <= c`) THEN + REWRITE_TAC[REAL_ABS_MUL; REAL_ABS_NORM; GSYM NORM_MUL] THEN + FIRST_ASSUM(fun th -> REWRITE_TAC[GSYM(MATCH_MP LINEAR_CMUL th)]) THEN + ASM_SIMP_TAC[NORM_MUL; REAL_ABS_INV; REAL_ABS_NORM; REAL_MUL_LINV; + NORM_EQ_0]);; + +let ONORM = prove + (`!f:real^M->real^N. + linear f + ==> (!x. norm(f x) <= onorm f * norm(x)) /\ + (!b. (!x. norm(f x) <= b * norm(x)) ==> onorm f <= b)`, + GEN_TAC THEN DISCH_TAC THEN + MP_TAC(SPEC `{ norm((f:real^M->real^N) x) | norm(x) = &1 }` SUP) THEN + SIMP_TAC[IN_ELIM_THM; LEFT_IMP_EXISTS_THM] THEN + ONCE_REWRITE_TAC[SWAP_FORALL_THM] THEN + REWRITE_TAC[LEFT_FORALL_IMP_THM; RIGHT_EXISTS_AND_THM; EXISTS_REFL] THEN + ASM_SIMP_TAC[NORM_BOUND_GENERALIZE; GSYM onorm; GSYM MEMBER_NOT_EMPTY] THEN + DISCH_THEN MATCH_MP_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN + ASM_MESON_TAC[VECTOR_CHOOSE_SIZE; LINEAR_BOUNDED; REAL_POS]);; + +let ONORM_POS_LE = prove + (`!f. linear f ==> &0 <= onorm f`, + MESON_TAC[ONORM; VECTOR_CHOOSE_SIZE; REAL_POS; REAL_MUL_RID; NORM_POS_LE; + REAL_LE_TRANS]);; + +let ONORM_EQ_0 = prove + (`!f:real^M->real^N. linear f ==> ((onorm f = &0) <=> (!x. f x = vec 0))`, + REPEAT STRIP_TAC THEN EQ_TAC THEN DISCH_TAC THEN + MP_TAC(SPEC `f:real^M->real^N` ONORM) THEN + ASM_SIMP_TAC[GSYM REAL_LE_ANTISYM; ONORM_POS_LE; NORM_0; REAL_MUL_LZERO; + NORM_LE_0; REAL_LE_REFL]);; + +let ONORM_CONST = prove + (`!y:real^N. onorm(\x:real^M. y) = norm(y)`, + GEN_TAC THEN REWRITE_TAC[onorm] THEN + MATCH_MP_TAC EQ_TRANS THEN EXISTS_TAC `sup {norm(y:real^N)}` THEN + CONJ_TAC THENL + [AP_TERM_TAC THEN MATCH_MP_TAC(SET_RULE + `(?x. P x) ==> {f y | x | P x} = {f y}`) THEN + EXISTS_TAC `basis 1 :real^M` THEN + SIMP_TAC[NORM_BASIS; DIMINDEX_GE_1; LE_REFL]; + MATCH_MP_TAC REAL_SUP_UNIQUE THEN SET_TAC[REAL_LE_REFL]]);; + +let ONORM_POS_LT = prove + (`!f. linear f ==> (&0 < onorm f <=> ~(!x. f x = vec 0))`, + SIMP_TAC[GSYM ONORM_EQ_0; ONORM_POS_LE; + REAL_ARITH `(&0 < x <=> ~(x = &0)) <=> &0 <= x`]);; + +let ONORM_COMPOSE = prove + (`!f g. linear f /\ linear g ==> onorm(f o g) <= onorm f * onorm g`, + MESON_TAC[ONORM; LINEAR_COMPOSE; o_THM; REAL_MUL_ASSOC; REAL_LE_TRANS; ONORM; + REAL_LE_LMUL; ONORM_POS_LE]);; + +let ONORM_NEG_LEMMA = prove + (`!f. linear f ==> onorm(\x. --(f x)) <= onorm f`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM(STRIP_ASSUME_TAC o MATCH_MP ONORM o + MATCH_MP LINEAR_COMPOSE_NEG) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_SIMP_TAC[NORM_NEG; ONORM]);; + +let ONORM_NEG = prove + (`!f:real^M->real^N. linear f ==> (onorm(\x. --(f x)) = onorm f)`, + REPEAT STRIP_TAC THEN REWRITE_TAC[GSYM REAL_LE_ANTISYM] THEN + ASM_SIMP_TAC[ONORM_NEG_LEMMA] THEN + SUBGOAL_THEN `f:real^M->real^N = \x. --(--(f x))` + (fun th -> GEN_REWRITE_TAC (LAND_CONV o RAND_CONV) [th]) THEN + ASM_SIMP_TAC[ONORM_NEG_LEMMA; LINEAR_COMPOSE_NEG] THEN + REWRITE_TAC[VECTOR_NEG_NEG; ETA_AX]);; + +let ONORM_TRIANGLE = prove + (`!f:real^M->real^N g. + linear f /\ linear g ==> onorm(\x. f x + g x) <= onorm f + onorm g`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + FIRST_ASSUM(MATCH_MP_TAC o CONJUNCT2 o MATCH_MP ONORM o MATCH_MP + LINEAR_COMPOSE_ADD) THEN + REWRITE_TAC[REAL_ADD_RDISTRIB] THEN + ASM_MESON_TAC[REAL_LE_ADD2; REAL_LE_TRANS; NORM_TRIANGLE; ONORM]);; + +let ONORM_TRIANGLE_LE = prove + (`!f g. linear f /\ linear g /\ onorm(f) + onorm(g) <= e + ==> onorm(\x. f x + g x) <= e`, + MESON_TAC[REAL_LE_TRANS; ONORM_TRIANGLE]);; + +let ONORM_TRIANGLE_LT = prove + (`!f g. linear f /\ linear g /\ onorm(f) + onorm(g) < e + ==> onorm(\x. f x + g x) < e`, + MESON_TAC[REAL_LET_TRANS; ONORM_TRIANGLE]);; + +(* ------------------------------------------------------------------------- *) +(* It's handy to "lift" from R to R^1 and "drop" from R^1 to R. *) +(* ------------------------------------------------------------------------- *) + +let lift = new_definition + `(lift:real->real^1) x = lambda i. x`;; + +let drop = new_definition + `(drop:real^1->real) x = x$1`;; + +let LIFT_COMPONENT = prove + (`!x. (lift x)$1 = x`, + SIMP_TAC[lift; LAMBDA_BETA; DIMINDEX_1; LE_ANTISYM]);; + +let LIFT_DROP = prove + (`(!x. lift(drop x) = x) /\ (!x. drop(lift x) = x)`, + SIMP_TAC[lift; drop; CART_EQ; LAMBDA_BETA; DIMINDEX_1; LE_ANTISYM]);; + +let IMAGE_LIFT_DROP = prove + (`(!s. IMAGE (lift o drop) s = s) /\ (!s. IMAGE (drop o lift) s = s)`, + REWRITE_TAC[o_DEF; LIFT_DROP] THEN SET_TAC[]);; + +let IN_IMAGE_LIFT_DROP = prove + (`(!x s. x IN IMAGE lift s <=> drop x IN s) /\ + (!x s. x IN IMAGE drop s <=> lift x IN s)`, + REWRITE_TAC[IN_IMAGE] THEN MESON_TAC[LIFT_DROP]);; + +let FORALL_LIFT = prove + (`(!x. P x) = (!x. P(lift x))`, + MESON_TAC[LIFT_DROP]);; + +let EXISTS_LIFT = prove + (`(?x. P x) = (?x. P(lift x))`, + MESON_TAC[LIFT_DROP]);; + +let FORALL_DROP = prove + (`(!x. P x) = (!x. P(drop x))`, + MESON_TAC[LIFT_DROP]);; + +let EXISTS_DROP = prove + (`(?x. P x) = (?x. P(drop x))`, + MESON_TAC[LIFT_DROP]);; + +let FORALL_LIFT_FUN = prove + (`!P:(A->real^1)->bool. (!f. P f) <=> (!f. P(lift o f))`, + GEN_TAC THEN EQ_TAC THEN SIMP_TAC[] THEN DISCH_TAC THEN + X_GEN_TAC `f:A->real^1` THEN + FIRST_X_ASSUM(MP_TAC o SPEC `drop o (f:A->real^1)`) THEN + REWRITE_TAC[o_DEF; LIFT_DROP; ETA_AX]);; + +let FORALL_DROP_FUN = prove + (`!P:(A->real)->bool. (!f. P f) <=> (!f. P(drop o f))`, + REWRITE_TAC[FORALL_LIFT_FUN; o_DEF; LIFT_DROP; ETA_AX]);; + +let EXISTS_LIFT_FUN = prove + (`!P:(A->real^1)->bool. (?f. P f) <=> (?f. P(lift o f))`, + ONCE_REWRITE_TAC[MESON[] `(?x. P x) <=> ~(!x. ~P x)`] THEN + REWRITE_TAC[FORALL_LIFT_FUN]);; + +let EXISTS_DROP_FUN = prove + (`!P:(A->real)->bool. (?f. P f) <=> (?f. P(drop o f))`, + ONCE_REWRITE_TAC[MESON[] `(?x. P x) <=> ~(!x. ~P x)`] THEN + REWRITE_TAC[FORALL_DROP_FUN]);; + +let LIFT_EQ = prove + (`!x y. (lift x = lift y) <=> (x = y)`, + MESON_TAC[LIFT_DROP]);; + +let DROP_EQ = prove + (`!x y. (drop x = drop y) <=> (x = y)`, + MESON_TAC[LIFT_DROP]);; + +let LIFT_IN_IMAGE_LIFT = prove + (`!x s. (lift x) IN (IMAGE lift s) <=> x IN s`, + REWRITE_TAC[IN_IMAGE] THEN MESON_TAC[LIFT_DROP]);; + +let LIFT_NUM = prove + (`!n. lift(&n) = vec n`, + SIMP_TAC[CART_EQ; lift; vec; LAMBDA_BETA]);; + +let LIFT_ADD = prove + (`!x y. lift(x + y) = lift x + lift y`, + SIMP_TAC[CART_EQ; lift; LAMBDA_BETA; VECTOR_ADD_COMPONENT]);; + +let LIFT_SUB = prove + (`!x y. lift(x - y) = lift x - lift y`, + SIMP_TAC[CART_EQ; lift; LAMBDA_BETA; VECTOR_SUB_COMPONENT]);; + +let LIFT_CMUL = prove + (`!x c. lift(c * x) = c % lift(x)`, + SIMP_TAC[CART_EQ; lift; LAMBDA_BETA; VECTOR_MUL_COMPONENT]);; + +let LIFT_NEG = prove + (`!x. lift(--x) = --(lift x)`, + SIMP_TAC[CART_EQ; lift; LAMBDA_BETA; VECTOR_NEG_COMPONENT]);; + +let LIFT_EQ_CMUL = prove + (`!x. lift x = x % vec 1`, + REWRITE_TAC[GSYM LIFT_NUM; GSYM LIFT_CMUL; REAL_MUL_RID]);; + +let LIFT_SUM = prove + (`!k x. FINITE k ==> (lift(sum k x) = vsum k (lift o x))`, + REWRITE_TAC[RIGHT_FORALL_IMP_THM] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + SIMP_TAC[SUM_CLAUSES; VSUM_CLAUSES; o_THM; LIFT_ADD; LIFT_NUM]);; + +let DROP_LAMBDA = prove + (`!x. drop(lambda i. x i) = x 1`, + SIMP_TAC[drop; LAMBDA_BETA; DIMINDEX_1; LE_REFL]);; + +let DROP_VEC = prove + (`!n. drop(vec n) = &n`, + MESON_TAC[LIFT_DROP; LIFT_NUM]);; + +let DROP_ADD = prove + (`!x y. drop(x + y) = drop x + drop y`, + MESON_TAC[LIFT_DROP; LIFT_ADD]);; + +let DROP_SUB = prove + (`!x y. drop(x - y) = drop x - drop y`, + MESON_TAC[LIFT_DROP; LIFT_SUB]);; + +let DROP_CMUL = prove + (`!x c. drop(c % x) = c * drop(x)`, + MESON_TAC[LIFT_DROP; LIFT_CMUL]);; + +let DROP_NEG = prove + (`!x. drop(--x) = --(drop x)`, + MESON_TAC[LIFT_DROP; LIFT_NEG]);; + +let DROP_VSUM = prove + (`!k x. FINITE k ==> (drop(vsum k x) = sum k (drop o x))`, + REWRITE_TAC[RIGHT_FORALL_IMP_THM] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + SIMP_TAC[SUM_CLAUSES; VSUM_CLAUSES; o_THM; DROP_ADD; DROP_VEC]);; + +let NORM_LIFT = prove + (`!x. norm(lift x) = abs(x)`, + SIMP_TAC[lift; NORM_REAL; LIFT_COMPONENT]);; + +let DIST_LIFT = prove + (`!x y. dist(lift x,lift y) = abs(x - y)`, + REWRITE_TAC[DIST_REAL; LIFT_COMPONENT]);; + +let ABS_DROP = prove + (`!x. norm x = abs(drop x)`, + REWRITE_TAC[FORALL_LIFT; LIFT_DROP; NORM_LIFT]);; + +let LINEAR_VMUL_DROP = prove + (`!f v. linear f ==> linear (\x. drop(f x) % v)`, + SIMP_TAC[drop; LINEAR_VMUL_COMPONENT; DIMINDEX_1; LE_REFL]);; + +let LINEAR_FROM_REALS = prove + (`!f:real^1->real^N. linear f ==> f = \x. drop x % column 1 (matrix f)`, + GEN_TAC THEN REWRITE_TAC[FUN_EQ_THM] THEN + DISCH_THEN(fun th -> REWRITE_TAC[GSYM(MATCH_MP MATRIX_WORKS th)]) THEN + SIMP_TAC[CART_EQ; matrix_vector_mul; vector_mul; LAMBDA_BETA; + DIMINDEX_1; SUM_SING_NUMSEG; drop; column] THEN + REWRITE_TAC[REAL_MUL_AC]);; + +let LINEAR_TO_REALS = prove + (`!f:real^N->real^1. linear f ==> f = \x. lift(row 1 (matrix f) dot x)`, + GEN_TAC THEN REWRITE_TAC[FUN_EQ_THM] THEN + DISCH_THEN(fun th -> REWRITE_TAC[GSYM(MATCH_MP MATRIX_WORKS th)]) THEN + SIMP_TAC[CART_EQ; matrix_vector_mul; dot; LAMBDA_BETA; + DIMINDEX_1; SUM_SING_NUMSEG; lift; row; LE_ANTISYM]);; + +let DROP_EQ_0 = prove + (`!x. drop x = &0 <=> x = vec 0`, + REWRITE_TAC[GSYM DROP_EQ; DROP_VEC]);; + +let VSUM_REAL = prove + (`!f s. FINITE s ==> vsum s f = lift(sum s (drop o f))`, + SIMP_TAC[LIFT_SUM; o_DEF; LIFT_DROP; ETA_AX]);; + +let DROP_WLOG_LE = prove + (`(!x y. P x y <=> P y x) /\ (!x y. drop x <= drop y ==> P x y) + ==> (!x y. P x y)`, + MESON_TAC[REAL_LE_TOTAL]);; + +let IMAGE_LIFT_UNIV = prove + (`IMAGE lift (:real) = (:real^1)`, + REWRITE_TAC[EXTENSION; IN_IMAGE; IN_UNIV] THEN MESON_TAC[LIFT_DROP]);; + +let IMAGE_DROP_UNIV = prove + (`IMAGE drop (:real^1) = (:real)`, + REWRITE_TAC[EXTENSION; IN_IMAGE; IN_UNIV] THEN MESON_TAC[LIFT_DROP]);; + +let SUM_VSUM = prove + (`!f s. FINITE s ==> sum s f = drop(vsum s (lift o f))`, + SIMP_TAC[VSUM_REAL; o_DEF; LIFT_DROP; ETA_AX]);; + +let LINEAR_LIFT_DOT = prove + (`!a. linear(\x. lift(a dot x))`, + REWRITE_TAC[linear; DOT_RMUL; DOT_RADD; LIFT_ADD; LIFT_CMUL]);; + +let LINEAR_LIFT_COMPONENT = prove + (`!k. linear(\x:real^N. lift(x$k))`, + REPEAT GEN_TAC THEN + SUBGOAL_THEN `?j. 1 <= j /\ j <= dimindex(:N) /\ !z:real^N. z$k = z$j` + CHOOSE_TAC THENL + [REWRITE_TAC[FINITE_INDEX_INRANGE]; + MP_TAC(ISPEC `basis j:real^N` LINEAR_LIFT_DOT) THEN + ASM_SIMP_TAC[DOT_BASIS]]);; + +(* ------------------------------------------------------------------------- *) +(* Pasting vectors. *) +(* ------------------------------------------------------------------------- *) + +let LINEAR_FSTCART = prove + (`linear fstcart`, + SIMP_TAC[linear; fstcart; CART_EQ; LAMBDA_BETA; VECTOR_ADD_COMPONENT; + VECTOR_MUL_COMPONENT; DIMINDEX_FINITE_SUM; + ARITH_RULE `x <= a ==> x <= a + b:num`]);; + +let LINEAR_SNDCART = prove + (`linear sndcart`, + SIMP_TAC[linear; sndcart; CART_EQ; LAMBDA_BETA; VECTOR_ADD_COMPONENT; + VECTOR_MUL_COMPONENT; DIMINDEX_FINITE_SUM; + ARITH_RULE `x <= a ==> x <= a + b:num`; + ARITH_RULE `x <= b ==> x + a <= a + b:num`]);; + +let FSTCART_VEC = prove + (`!n. fstcart(vec n) = vec n`, + SIMP_TAC[vec; fstcart; LAMBDA_BETA; CART_EQ; DIMINDEX_FINITE_SUM; + ARITH_RULE `m <= n:num ==> m <= n + p`]);; + +let FSTCART_ADD = prove + (`!x:real^(M,N)finite_sum y. fstcart(x + y) = fstcart(x) + fstcart(y)`, + REWRITE_TAC[REWRITE_RULE[linear] LINEAR_FSTCART]);; + +let FSTCART_CMUL = prove + (`!x:real^(M,N)finite_sum c. fstcart(c % x) = c % fstcart(x)`, + REWRITE_TAC[REWRITE_RULE[linear] LINEAR_FSTCART]);; + +let FSTCART_NEG = prove + (`!x:real^(M,N)finite_sum. --(fstcart x) = fstcart(--x)`, + ONCE_REWRITE_TAC[VECTOR_ARITH `--x = --(&1) % x`] THEN + REWRITE_TAC[FSTCART_CMUL]);; + +let FSTCART_SUB = prove + (`!x:real^(M,N)finite_sum y. fstcart(x - y) = fstcart(x) - fstcart(y)`, + REWRITE_TAC[VECTOR_SUB; FSTCART_NEG; FSTCART_ADD]);; + +let FSTCART_VSUM = prove + (`!k x. FINITE k ==> (fstcart(vsum k x) = vsum k (\i. fstcart(x i)))`, + REWRITE_TAC[RIGHT_FORALL_IMP_THM] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + SIMP_TAC[VSUM_CLAUSES; FINITE_RULES; FSTCART_ADD; FSTCART_VEC]);; + +let SNDCART_VEC = prove + (`!n. sndcart(vec n) = vec n`, + SIMP_TAC[vec; sndcart; LAMBDA_BETA; CART_EQ; DIMINDEX_FINITE_SUM; + ARITH_RULE `x <= a ==> x <= a + b:num`; + ARITH_RULE `x <= b ==> x + a <= a + b:num`]);; + +let SNDCART_ADD = prove + (`!x:real^(M,N)finite_sum y. sndcart(x + y) = sndcart(x) + sndcart(y)`, + REWRITE_TAC[REWRITE_RULE[linear] LINEAR_SNDCART]);; + +let SNDCART_CMUL = prove + (`!x:real^(M,N)finite_sum c. sndcart(c % x) = c % sndcart(x)`, + REWRITE_TAC[REWRITE_RULE[linear] LINEAR_SNDCART]);; + +let SNDCART_NEG = prove + (`!x:real^(M,N)finite_sum. --(sndcart x) = sndcart(--x)`, + ONCE_REWRITE_TAC[VECTOR_ARITH `--x = --(&1) % x`] THEN + REWRITE_TAC[SNDCART_CMUL]);; + +let SNDCART_SUB = prove + (`!x:real^(M,N)finite_sum y. sndcart(x - y) = sndcart(x) - sndcart(y)`, + REWRITE_TAC[VECTOR_SUB; SNDCART_NEG; SNDCART_ADD]);; + +let SNDCART_VSUM = prove + (`!k x. FINITE k ==> (sndcart(vsum k x) = vsum k (\i. sndcart(x i)))`, + REWRITE_TAC[RIGHT_FORALL_IMP_THM] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + SIMP_TAC[VSUM_CLAUSES; FINITE_RULES; SNDCART_ADD; SNDCART_VEC]);; + +let PASTECART_VEC = prove + (`!n. pastecart (vec n) (vec n) = vec n`, + REWRITE_TAC[PASTECART_EQ; FSTCART_VEC; SNDCART_VEC; + FSTCART_PASTECART; SNDCART_PASTECART]);; + +let PASTECART_ADD = prove + (`!x1 y1 x2:real^M y2:real^N. + pastecart x1 y1 + pastecart x2 y2 = pastecart (x1 + x2) (y1 + y2)`, + REWRITE_TAC[PASTECART_EQ; FSTCART_ADD; SNDCART_ADD; + FSTCART_PASTECART; SNDCART_PASTECART]);; + +let PASTECART_CMUL = prove + (`!x1 y1 c. pastecart (c % x1) (c % y1) = c % pastecart x1 y1`, + REWRITE_TAC[PASTECART_EQ; FSTCART_CMUL; SNDCART_CMUL; + FSTCART_PASTECART; SNDCART_PASTECART]);; + +let PASTECART_NEG = prove + (`!x:real^M y:real^N. pastecart (--x) (--y) = --(pastecart x y)`, + ONCE_REWRITE_TAC[VECTOR_ARITH `--x = --(&1) % x`] THEN + REWRITE_TAC[PASTECART_CMUL]);; + +let PASTECART_SUB = prove + (`!x1 y1 x2:real^M y2:real^N. + pastecart x1 y1 - pastecart x2 y2 = pastecart (x1 - x2) (y1 - y2)`, + REWRITE_TAC[VECTOR_SUB; GSYM PASTECART_NEG; PASTECART_ADD]);; + +let PASTECART_VSUM = prove + (`!k x y. FINITE k ==> (pastecart (vsum k x) (vsum k y) = + vsum k (\i. pastecart (x i) (y i)))`, + SIMP_TAC[PASTECART_EQ; FSTCART_VSUM; SNDCART_VSUM; + FSTCART_PASTECART; SNDCART_PASTECART; ETA_AX]);; + +let PASTECART_EQ_VEC = prove + (`!x y n. pastecart x y = vec n <=> x = vec n /\ y = vec n`, + REWRITE_TAC[PASTECART_EQ; FSTCART_VEC; SNDCART_VEC; + FSTCART_PASTECART; SNDCART_PASTECART]);; + +let NORM_FSTCART = prove + (`!x. norm(fstcart x) <= norm x`, + GEN_TAC THEN + GEN_REWRITE_TAC (RAND_CONV o RAND_CONV) [GSYM PASTECART_FST_SND] THEN + SIMP_TAC[SQRT_MONO_LE_EQ; DOT_POS_LE; vector_norm] THEN + SIMP_TAC[pastecart; dot; DIMINDEX_FINITE_SUM; LAMBDA_BETA; DIMINDEX_NONZERO; + SUM_ADD_SPLIT; REAL_LE_ADDR; SUM_POS_LE; FINITE_NUMSEG; + REAL_LE_SQUARE; ARITH_RULE `x <= a ==> x <= a + b:num`; + ARITH_RULE `~(d = 0) ==> 1 <= d + 1`]);; + +let DIST_FSTCART = prove + (`!x y. dist(fstcart x,fstcart y) <= dist(x,y)`, + REWRITE_TAC[dist; GSYM FSTCART_SUB; NORM_FSTCART]);; + +let NORM_SNDCART = prove + (`!x. norm(sndcart x) <= norm x`, + GEN_TAC THEN + GEN_REWRITE_TAC (RAND_CONV o RAND_CONV) [GSYM PASTECART_FST_SND] THEN + SIMP_TAC[SQRT_MONO_LE_EQ; DOT_POS_LE; vector_norm] THEN + SIMP_TAC[pastecart; dot; DIMINDEX_FINITE_SUM; LAMBDA_BETA; DIMINDEX_NONZERO; + SUM_ADD_SPLIT; ARITH_RULE `x <= a ==> x <= a + b:num`; + ARITH_RULE `~(d = 0) ==> 1 <= d + 1`] THEN + ONCE_REWRITE_TAC[ADD_SYM] THEN REWRITE_TAC[NUMSEG_OFFSET_IMAGE] THEN + SIMP_TAC[SUM_IMAGE; FINITE_NUMSEG; EQ_ADD_RCANCEL; o_DEF; ADD_SUB] THEN + SIMP_TAC[ARITH_RULE `1 <= x ==> ~(x + a <= a)`; SUM_POS_LE; FINITE_NUMSEG; + REAL_LE_ADDL; REAL_LE_SQUARE]);; + +let DIST_SNDCART = prove + (`!x y. dist(sndcart x,sndcart y) <= dist(x,y)`, + REWRITE_TAC[dist; GSYM SNDCART_SUB; NORM_SNDCART]);; + +let DOT_PASTECART = prove + (`!x1 x2 y1 y2. (pastecart x1 x2) dot (pastecart y1 y2) = + x1 dot y1 + x2 dot y2`, + SIMP_TAC[pastecart; dot; LAMBDA_BETA; DIMINDEX_FINITE_SUM] THEN + SIMP_TAC[SUM_ADD_SPLIT; ARITH_RULE `~(d = 0) ==> 1 <= d + 1`; + DIMINDEX_NONZERO; REAL_LE_LADD] THEN + ONCE_REWRITE_TAC[ADD_SYM] THEN REWRITE_TAC[NUMSEG_OFFSET_IMAGE] THEN + SIMP_TAC[SUM_IMAGE; FINITE_NUMSEG; EQ_ADD_RCANCEL; o_DEF; ADD_SUB] THEN + SIMP_TAC[ARITH_RULE `1 <= x ==> ~(x + a <= a)`; REAL_LE_REFL]);; + +let NORM_PASTECART = prove + (`!x y. norm(pastecart x y) = sqrt(norm(x) pow 2 + norm(y) pow 2)`, + REWRITE_TAC[NORM_EQ_SQUARE] THEN + SIMP_TAC[SQRT_POS_LE; SQRT_POW_2; REAL_LE_ADD; REAL_LE_POW_2] THEN + REWRITE_TAC[DOT_PASTECART; NORM_POW_2]);; + +let NORM_PASTECART_LE = prove + (`!x y. norm(pastecart x y) <= norm(x) + norm(y)`, + REPEAT GEN_TAC THEN MATCH_MP_TAC TRIANGLE_LEMMA THEN + REWRITE_TAC[NORM_POS_LE; NORM_POW_2; DOT_PASTECART; REAL_LE_REFL]);; + +let NORM_LE_PASTECART = prove + (`!x:real^M y:real^M. + norm(x) <= norm(pastecart x y) /\ + norm(y) <= norm(pastecart x y)`, + REPEAT GEN_TAC THEN REWRITE_TAC[NORM_PASTECART] THEN CONJ_TAC THEN + MATCH_MP_TAC REAL_LE_RSQRT THEN + REWRITE_TAC[REAL_LE_ADDL; REAL_LE_ADDR; REAL_LE_POW_2]);; + +(* ------------------------------------------------------------------------- *) +(* A bit of linear algebra. *) +(* ------------------------------------------------------------------------- *) + +let subspace = new_definition + `subspace s <=> + vec(0) IN s /\ + (!x y. x IN s /\ y IN s ==> (x + y) IN s) /\ + (!c x. x IN s ==> (c % x) IN s)`;; + +let span = new_definition + `span s = subspace hull s`;; + +let dependent = new_definition + `dependent s <=> ?a. a IN s /\ a IN span(s DELETE a)`;; + +let independent = new_definition + `independent s <=> ~(dependent s)`;; + +(* ------------------------------------------------------------------------- *) +(* Closure properties of subspaces. *) +(* ------------------------------------------------------------------------- *) + +let SUBSPACE_UNIV = prove + (`subspace(UNIV:real^N->bool)`, + REWRITE_TAC[subspace; IN_UNIV]);; + +let SUBSPACE_IMP_NONEMPTY = prove + (`!s. subspace s ==> ~(s = {})`, + REWRITE_TAC[subspace] THEN SET_TAC[]);; + +let SUBSPACE_0 = prove + (`subspace s ==> vec(0) IN s`, + SIMP_TAC[subspace]);; + +let SUBSPACE_ADD = prove + (`!x y s. subspace s /\ x IN s /\ y IN s ==> (x + y) IN s`, + SIMP_TAC[subspace]);; + +let SUBSPACE_MUL = prove + (`!x c s. subspace s /\ x IN s ==> (c % x) IN s`, + SIMP_TAC[subspace]);; + +let SUBSPACE_NEG = prove + (`!x s. subspace s /\ x IN s ==> (--x) IN s`, + SIMP_TAC[VECTOR_ARITH `--x = --(&1) % x`; SUBSPACE_MUL]);; + +let SUBSPACE_SUB = prove + (`!x y s. subspace s /\ x IN s /\ y IN s ==> (x - y) IN s`, + SIMP_TAC[VECTOR_SUB; SUBSPACE_ADD; SUBSPACE_NEG]);; + +let SUBSPACE_VSUM = prove + (`!s f t. subspace s /\ FINITE t /\ (!x. x IN t ==> f(x) IN s) + ==> (vsum t f) IN s`, + REWRITE_TAC[IMP_CONJ; RIGHT_FORALL_IMP_THM] THEN + GEN_TAC THEN DISCH_TAC THEN GEN_TAC THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + ASM_SIMP_TAC[VSUM_CLAUSES; SUBSPACE_0; IN_INSERT; SUBSPACE_ADD]);; + +let SUBSPACE_LINEAR_IMAGE = prove + (`!f s. linear f /\ subspace s ==> subspace(IMAGE f s)`, + REWRITE_TAC[subspace; IMP_CONJ; RIGHT_FORALL_IMP_THM] THEN + REWRITE_TAC[FORALL_IN_IMAGE] THEN REWRITE_TAC[IN_IMAGE] THEN + MESON_TAC[linear; LINEAR_0]);; + +let SUBSPACE_LINEAR_PREIMAGE = prove + (`!f s. linear f /\ subspace s ==> subspace {x | f(x) IN s}`, + REWRITE_TAC[subspace; IN_ELIM_THM] THEN + MESON_TAC[linear; LINEAR_0]);; + +let SUBSPACE_TRIVIAL = prove + (`subspace {vec 0}`, + SIMP_TAC[subspace; IN_SING] THEN CONJ_TAC THEN VECTOR_ARITH_TAC);; + +let SUBSPACE_INTER = prove + (`!s t. subspace s /\ subspace t ==> subspace (s INTER t)`, + REWRITE_TAC[subspace; IN_INTER] THEN MESON_TAC[]);; + +let SUBSPACE_INTERS = prove + (`!f. (!s. s IN f ==> subspace s) ==> subspace(INTERS f)`, + SIMP_TAC[subspace; IMP_CONJ; RIGHT_FORALL_IMP_THM; IN_INTERS]);; + +let LINEAR_INJECTIVE_0_SUBSPACE = prove + (`!f:real^M->real^N s. + linear f /\ subspace s + ==> ((!x y. x IN s /\ y IN s /\ f x = f y ==> x = y) <=> + (!x. x IN s /\ f x = vec 0 ==> x = vec 0))`, + REPEAT STRIP_TAC THEN + GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [GSYM VECTOR_SUB_EQ] THEN + ASM_SIMP_TAC[GSYM LINEAR_SUB] THEN + ASM_MESON_TAC[VECTOR_SUB_RZERO; SUBSPACE_SUB; SUBSPACE_0]);; + +let SUBSPACE_UNION_CHAIN = prove + (`!s t:real^N->bool. + subspace s /\ subspace t /\ subspace(s UNION t) + ==> s SUBSET t \/ t SUBSET s`, + REPEAT STRIP_TAC THEN REWRITE_TAC[SET_RULE + `s SUBSET t \/ t SUBSET s <=> + ~(?x y. x IN s /\ ~(x IN t) /\ y IN t /\ ~(y IN s))`] THEN + STRIP_TAC THEN SUBGOAL_THEN `(x + y:real^N) IN s UNION t` MP_TAC THENL + [MATCH_MP_TAC SUBSPACE_ADD THEN ASM_REWRITE_TAC[] THEN ASM SET_TAC[]; + REWRITE_TAC[IN_UNION; DE_MORGAN_THM] THEN + ASM_MESON_TAC[SUBSPACE_SUB; VECTOR_ARITH + `(x + y) - x:real^N = y /\ (x + y) - y = x`]]);; + +(* ------------------------------------------------------------------------- *) +(* Lemmas. *) +(* ------------------------------------------------------------------------- *) + +let SPAN_SPAN = prove + (`!s. span(span s) = span s`, + REWRITE_TAC[span; HULL_HULL]);; + +let SPAN_MONO = prove + (`!s t. s SUBSET t ==> span s SUBSET span t`, + REWRITE_TAC[span; HULL_MONO]);; + +let SUBSPACE_SPAN = prove + (`!s. subspace(span s)`, + GEN_TAC THEN REWRITE_TAC[span] THEN MATCH_MP_TAC P_HULL THEN + SIMP_TAC[subspace; IN_INTERS]);; + +let SPAN_CLAUSES = prove + (`(!a s. a IN s ==> a IN span s) /\ + (vec(0) IN span s) /\ + (!x y s. x IN span s /\ y IN span s ==> (x + y) IN span s) /\ + (!x c s. x IN span s ==> (c % x) IN span s)`, + MESON_TAC[span; HULL_SUBSET; SUBSET; SUBSPACE_SPAN; subspace]);; + +let SPAN_INDUCT = prove + (`!s h. (!x. x IN s ==> x IN h) /\ subspace h ==> !x. x IN span(s) ==> h(x)`, + REWRITE_TAC[span] THEN MESON_TAC[SUBSET; HULL_MINIMAL; IN]);; + +let SPAN_EMPTY = prove + (`span {} = {vec 0}`, + REWRITE_TAC[span] THEN MATCH_MP_TAC HULL_UNIQUE THEN + SIMP_TAC[subspace; SUBSET; IN_SING; NOT_IN_EMPTY] THEN + REPEAT STRIP_TAC THEN VECTOR_ARITH_TAC);; + +let INDEPENDENT_EMPTY = prove + (`independent {}`, + REWRITE_TAC[independent; dependent; NOT_IN_EMPTY]);; + +let INDEPENDENT_NONZERO = prove + (`!s. independent s ==> ~(vec 0 IN s)`, + REWRITE_TAC[independent; dependent] THEN MESON_TAC[SPAN_CLAUSES]);; + +let INDEPENDENT_MONO = prove + (`!s t. independent t /\ s SUBSET t ==> independent s`, + REWRITE_TAC[independent; dependent] THEN + ASM_MESON_TAC[SPAN_MONO; SUBSET; IN_DELETE]);; + +let DEPENDENT_MONO = prove + (`!s t:real^N->bool. dependent s /\ s SUBSET t ==> dependent t`, + ONCE_REWRITE_TAC[TAUT `p /\ q ==> r <=> ~r /\ q ==> ~p`] THEN + REWRITE_TAC[GSYM independent; INDEPENDENT_MONO]);; + +let SPAN_SUBSPACE = prove + (`!b s. b SUBSET s /\ s SUBSET (span b) /\ subspace s ==> (span b = s)`, + MESON_TAC[SUBSET_ANTISYM; span; HULL_MINIMAL]);; + +let SPAN_INDUCT_ALT = prove + (`!s h. h(vec 0) /\ + (!c x y. x IN s /\ h(y) ==> h(c % x + y)) + ==> !x:real^N. x IN span(s) ==> h(x)`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + FIRST_ASSUM(MP_TAC o prove_inductive_relations_exist o concl) THEN + DISCH_THEN(X_CHOOSE_THEN `g:real^N->bool` STRIP_ASSUME_TAC) THEN + SUBGOAL_THEN `!x:real^N. x IN span(s) ==> g(x)` + (fun th -> ASM_MESON_TAC[th]) THEN + MATCH_MP_TAC SPAN_INDUCT THEN REWRITE_TAC[subspace; IN_ELIM_THM] THEN + REWRITE_TAC[IN; IMP_CONJ; RIGHT_FORALL_IMP_THM] THEN + ONCE_REWRITE_TAC[SWAP_FORALL_THM] THEN REWRITE_TAC[RIGHT_FORALL_IMP_THM] THEN + REPEAT CONJ_TAC THEN TRY(FIRST_X_ASSUM MATCH_MP_TAC) THEN + REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC] THEN + ASM_MESON_TAC[IN; VECTOR_ADD_LID; VECTOR_ADD_ASSOC; VECTOR_ADD_SYM; + VECTOR_MUL_LID; VECTOR_MUL_RZERO]);; + +(* ------------------------------------------------------------------------- *) +(* Individual closure properties. *) +(* ------------------------------------------------------------------------- *) + +let SPAN_SUPERSET = prove + (`!x. x IN s ==> x IN span s`, + MESON_TAC[SPAN_CLAUSES]);; + +let SPAN_INC = prove + (`!s. s SUBSET span s`, + REWRITE_TAC[SUBSET; SPAN_SUPERSET]);; + +let SPAN_UNION_SUBSET = prove + (`!s t. span s UNION span t SUBSET span(s UNION t)`, + REWRITE_TAC[span; HULL_UNION_SUBSET]);; + +let SPAN_UNIV = prove + (`span(:real^N) = (:real^N)`, + SIMP_TAC[SPAN_INC; SET_RULE `UNIV SUBSET s ==> s = UNIV`]);; + +let SPAN_0 = prove + (`vec(0) IN span s`, + MESON_TAC[SUBSPACE_SPAN; SUBSPACE_0]);; + +let SPAN_ADD = prove + (`!x y s. x IN span s /\ y IN span s ==> (x + y) IN span s`, + MESON_TAC[SUBSPACE_SPAN; SUBSPACE_ADD]);; + +let SPAN_MUL = prove + (`!x c s. x IN span s ==> (c % x) IN span s`, + MESON_TAC[SUBSPACE_SPAN; SUBSPACE_MUL]);; + +let SPAN_MUL_EQ = prove + (`!x:real^N c s. ~(c = &0) ==> ((c % x) IN span s <=> x IN span s)`, + REPEAT(STRIP_TAC ORELSE EQ_TAC) THEN ASM_SIMP_TAC[SPAN_MUL] THEN + SUBGOAL_THEN `(inv(c) % c % x:real^N) IN span s` MP_TAC THENL + [ASM_SIMP_TAC[SPAN_MUL]; + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; VECTOR_MUL_LID]]);; + +let SPAN_NEG = prove + (`!x s. x IN span s ==> (--x) IN span s`, + MESON_TAC[SUBSPACE_SPAN; SUBSPACE_NEG]);; + +let SPAN_NEG_EQ = prove + (`!x s. --x IN span s <=> x IN span s`, + MESON_TAC[SPAN_NEG; VECTOR_NEG_NEG]);; + +let SPAN_SUB = prove + (`!x y s. x IN span s /\ y IN span s ==> (x - y) IN span s`, + MESON_TAC[SUBSPACE_SPAN; SUBSPACE_SUB]);; + +let SPAN_VSUM = prove + (`!s f t. FINITE t /\ (!x. x IN t ==> f(x) IN span(s)) + ==> (vsum t f) IN span(s)`, + MESON_TAC[SUBSPACE_SPAN; SUBSPACE_VSUM]);; + +let SPAN_ADD_EQ = prove + (`!s x y. x IN span s ==> ((x + y) IN span s <=> y IN span s)`, + MESON_TAC[SPAN_ADD; SPAN_SUB; VECTOR_ARITH `(x + y) - x:real^N = y`]);; + +let SPAN_EQ_SELF = prove + (`!s. span s = s <=> subspace s`, + GEN_TAC THEN EQ_TAC THENL [MESON_TAC[SUBSPACE_SPAN]; ALL_TAC] THEN + DISCH_TAC THEN MATCH_MP_TAC SPAN_SUBSPACE THEN + ASM_REWRITE_TAC[SUBSET_REFL; SPAN_INC]);; + +let SPAN_SUBSET_SUBSPACE = prove + (`!s t:real^N->bool. s SUBSET t /\ subspace t ==> span s SUBSET t`, + MESON_TAC[SPAN_MONO; SPAN_EQ_SELF]);; + +let SUBSPACE_TRANSLATION_SELF = prove + (`!s a. subspace s /\ a IN s ==> IMAGE (\x. a + x) s = s`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC SURJECTIVE_IMAGE_EQ THEN + FIRST_ASSUM(SUBST1_TAC o SYM o GEN_REWRITE_RULE I [GSYM SPAN_EQ_SELF]) THEN + ASM_SIMP_TAC[SPAN_ADD_EQ; SPAN_CLAUSES] THEN + REWRITE_TAC[VECTOR_ARITH `a + x:real^N = y <=> x = y - a`; EXISTS_REFL]);; + +let SUBSPACE_TRANSLATION_SELF_EQ = prove + (`!s a:real^N. subspace s ==> (IMAGE (\x. a + x) s = s <=> a IN s)`, + REPEAT STRIP_TAC THEN EQ_TAC THEN + ASM_SIMP_TAC[SUBSPACE_TRANSLATION_SELF] THEN + DISCH_THEN(MP_TAC o AP_TERM `\s. (a:real^N) IN s`) THEN + REWRITE_TAC[] THEN DISCH_THEN(SUBST1_TAC o SYM) THEN + REWRITE_TAC[IN_IMAGE] THEN EXISTS_TAC `vec 0:real^N` THEN + ASM_MESON_TAC[subspace; VECTOR_ADD_RID]);; + +let SUBSPACE_SUMS = prove + (`!s t. subspace s /\ subspace t + ==> subspace {x + y | x IN s /\ y IN t}`, + REWRITE_TAC[subspace; FORALL_IN_GSPEC; IMP_CONJ; RIGHT_FORALL_IMP_THM] THEN + REWRITE_TAC[IN_ELIM_THM] THEN REPEAT STRIP_TAC THENL + [ASM_MESON_TAC[VECTOR_ADD_LID]; + ONCE_REWRITE_TAC[VECTOR_ARITH + `(x + y) + (x' + y'):real^N = (x + x') + (y + y')`] THEN + ASM_MESON_TAC[]; + REWRITE_TAC[VECTOR_ADD_LDISTRIB] THEN ASM_MESON_TAC[]]);; + +let SPAN_UNION = prove + (`!s t. span(s UNION t) = {x + y:real^N | x IN span s /\ y IN span t}`, + REPEAT GEN_TAC THEN MATCH_MP_TAC SUBSET_ANTISYM THEN CONJ_TAC THENL + [MATCH_MP_TAC SPAN_SUBSET_SUBSPACE THEN + SIMP_TAC[SUBSPACE_SUMS; SUBSPACE_SPAN] THEN + REWRITE_TAC[SUBSET; IN_UNION; IN_ELIM_THM] THEN + X_GEN_TAC `x:real^N` THEN STRIP_TAC THENL + [MAP_EVERY EXISTS_TAC [`x:real^N`; `vec 0:real^N`] THEN + ASM_SIMP_TAC[SPAN_SUPERSET; SPAN_0; VECTOR_ADD_RID]; + MAP_EVERY EXISTS_TAC [`vec 0:real^N`; `x:real^N`] THEN + ASM_SIMP_TAC[SPAN_SUPERSET; SPAN_0; VECTOR_ADD_LID]]; + REWRITE_TAC[SUBSET; FORALL_IN_GSPEC] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC SPAN_ADD THEN + ASM_MESON_TAC[SPAN_MONO; SUBSET_UNION; SUBSET]]);; + +(* ------------------------------------------------------------------------- *) +(* Mapping under linear image. *) +(* ------------------------------------------------------------------------- *) + +let SPAN_LINEAR_IMAGE = prove + (`!f:real^M->real^N s. linear f ==> (span(IMAGE f s) = IMAGE f (span s))`, + REPEAT STRIP_TAC THEN GEN_REWRITE_TAC I [EXTENSION] THEN + X_GEN_TAC `x:real^N` THEN EQ_TAC THENL + [SPEC_TAC(`x:real^N`,`x:real^N`) THEN MATCH_MP_TAC SPAN_INDUCT THEN + REWRITE_TAC[SET_RULE `(\x. x IN s) = s`] THEN + ASM_SIMP_TAC[SUBSPACE_SPAN; SUBSPACE_LINEAR_IMAGE] THEN + REWRITE_TAC[FORALL_IN_IMAGE] THEN REWRITE_TAC[IN_IMAGE] THEN + MESON_TAC[SPAN_SUPERSET; SUBSET]; + SPEC_TAC(`x:real^N`,`x:real^N`) THEN REWRITE_TAC[FORALL_IN_IMAGE] THEN + MATCH_MP_TAC SPAN_INDUCT THEN + REWRITE_TAC[SET_RULE `(\x. f x IN span(s)) = {x | f(x) IN span s}`] THEN + ASM_SIMP_TAC[SUBSPACE_LINEAR_PREIMAGE; SUBSPACE_SPAN] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + MESON_TAC[SPAN_SUPERSET; SUBSET; IN_IMAGE]]);; + +let DEPENDENT_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N s. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (dependent(IMAGE f s) <=> dependent s)`, + REPEAT STRIP_TAC THEN REWRITE_TAC[dependent; EXISTS_IN_IMAGE] THEN + AP_TERM_TAC THEN REWRITE_TAC[FUN_EQ_THM] THEN X_GEN_TAC `a:real^M` THEN + ASM_CASES_TAC `(a:real^M) IN s` THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `(f:real^M->real^N) a IN span(IMAGE f (s DELETE a))` THEN + CONJ_TAC THENL + [AP_TERM_TAC THEN AP_TERM_TAC THEN ASM SET_TAC[]; + ASM_SIMP_TAC[SPAN_LINEAR_IMAGE] THEN ASM SET_TAC[]]);; + +let DEPENDENT_LINEAR_IMAGE = prove + (`!f:real^M->real^N s. + linear f /\ (!x y. x IN s /\ y IN s /\ f x = f y ==> x = y) /\ + dependent(s) + ==> dependent(IMAGE f s)`, + REPEAT GEN_TAC THEN + REPEAT(DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + REWRITE_TAC[dependent; EXISTS_IN_IMAGE] THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `a:real^M` THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `IMAGE (f:real^M->real^N) s DELETE f a = IMAGE f (s DELETE a)` + (fun th -> ASM_SIMP_TAC[FUN_IN_IMAGE; SPAN_LINEAR_IMAGE; th]) THEN + ASM SET_TAC[]);; + +let INDEPENDENT_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N s. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (independent(IMAGE f s) <=> independent s)`, + REWRITE_TAC[independent; TAUT `(~p <=> ~q) <=> (p <=> q)`] THEN + REWRITE_TAC[DEPENDENT_LINEAR_IMAGE_EQ]);; + +(* ------------------------------------------------------------------------- *) +(* The key breakdown property. *) +(* ------------------------------------------------------------------------- *) + +let SPAN_BREAKDOWN = prove + (`!b s a:real^N. + b IN s /\ a IN span s ==> ?k. (a - k % b) IN span(s DELETE b)`, + REWRITE_TAC[IMP_CONJ; RIGHT_FORALL_IMP_THM] THEN + REPEAT GEN_TAC THEN DISCH_TAC THEN MATCH_MP_TAC SPAN_INDUCT THEN + REWRITE_TAC[subspace; IN_ELIM_THM] THEN CONJ_TAC THENL + [GEN_TAC THEN DISCH_TAC THEN ASM_CASES_TAC `a:real^N = b`; ALL_TAC] THEN + ASM_MESON_TAC[SPAN_CLAUSES; IN_DELETE; VECTOR_ARITH + `(a - &1 % a = vec 0) /\ (a - &0 % b = a) /\ + ((x + y) - (k1 + k2) % b = (x - k1 % b) + (y - k2 % b)) /\ + (c % x - (c * k) % y = c % (x - k % y))`]);; + +let SPAN_BREAKDOWN_EQ = prove + (`!a:real^N s. (x IN span(a INSERT s) <=> (?k. (x - k % a) IN span s))`, + REPEAT STRIP_TAC THEN EQ_TAC THENL + [DISCH_THEN(MP_TAC o CONJ(SET_RULE `(a:real^N) IN (a INSERT s)`)) THEN + DISCH_THEN(MP_TAC o MATCH_MP SPAN_BREAKDOWN) THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `k:real` THEN + SPEC_TAC(`x - k % a:real^N`,`y:real^N`) THEN + REWRITE_TAC[GSYM SUBSET] THEN MATCH_MP_TAC SPAN_MONO THEN SET_TAC[]; + DISCH_THEN(X_CHOOSE_TAC `k:real`) THEN + SUBST1_TAC(VECTOR_ARITH `x = (x - k % a) + k % a:real^N`) THEN + MATCH_MP_TAC SPAN_ADD THEN + ASM_MESON_TAC[SPAN_MONO; SUBSET; IN_INSERT; SPAN_CLAUSES]]);; + +let SPAN_INSERT_0 = prove + (`!s. span(vec 0 INSERT s) = span s`, + SIMP_TAC[EXTENSION; SPAN_BREAKDOWN_EQ; VECTOR_MUL_RZERO; VECTOR_SUB_RZERO]);; + +let SPAN_SING = prove + (`!a. span {a} = {u % a | u IN (:real)}`, + REWRITE_TAC[EXTENSION; IN_ELIM_THM; SPAN_BREAKDOWN_EQ; SPAN_EMPTY] THEN + REWRITE_TAC[IN_UNIV; IN_SING; VECTOR_SUB_EQ]);; + +let SPAN_2 = prove + (`!a b. span {a,b} = {u % a + v % b | u IN (:real) /\ v IN (:real)}`, + REWRITE_TAC[EXTENSION; IN_ELIM_THM; SPAN_BREAKDOWN_EQ; SPAN_EMPTY] THEN + REWRITE_TAC[IN_UNIV; IN_SING; VECTOR_SUB_EQ] THEN + REWRITE_TAC[VECTOR_ARITH `x - y:real^N = z <=> x = y + z`]);; + +let SPAN_3 = prove + (`!a b c. span {a,b,c} = + {u % a + v % b + w % c | u IN (:real) /\ v IN (:real) /\ w IN (:real)}`, + REWRITE_TAC[EXTENSION; IN_ELIM_THM; SPAN_BREAKDOWN_EQ; SPAN_EMPTY] THEN + REWRITE_TAC[IN_UNIV; IN_SING; VECTOR_SUB_EQ] THEN + REWRITE_TAC[VECTOR_ARITH `x - y:real^N = z <=> x = y + z`]);; + +(* ------------------------------------------------------------------------- *) +(* Hence some "reversal" results. *) +(* ------------------------------------------------------------------------- *) + +let IN_SPAN_INSERT = prove + (`!a b:real^N s. + a IN span(b INSERT s) /\ ~(a IN span s) ==> b IN span(a INSERT s)`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPECL [`b:real^N`; `(b:real^N) INSERT s`; `a:real^N`] + SPAN_BREAKDOWN) THEN ASM_REWRITE_TAC[IN_INSERT] THEN + DISCH_THEN(X_CHOOSE_THEN `k:real` MP_TAC) THEN ASM_CASES_TAC `k = &0` THEN + ASM_REWRITE_TAC[VECTOR_ARITH `a - &0 % b = a`; DELETE_INSERT] THENL + [ASM_MESON_TAC[SPAN_MONO; SUBSET; DELETE_SUBSET]; ALL_TAC] THEN + DISCH_THEN(MP_TAC o SPEC `inv(k)` o MATCH_MP SPAN_MUL) THEN + ASM_SIMP_TAC[VECTOR_SUB_LDISTRIB; VECTOR_MUL_ASSOC; REAL_MUL_LINV] THEN + DISCH_TAC THEN SUBST1_TAC(VECTOR_ARITH + `b:real^N = inv(k) % a - (inv(k) % a - &1 % b)`) THEN + MATCH_MP_TAC SPAN_SUB THEN + ASM_MESON_TAC[SPAN_CLAUSES; IN_INSERT; SUBSET; IN_DELETE; SPAN_MONO]);; + +let IN_SPAN_DELETE = prove + (`!a b s. + a IN span s /\ ~(a IN span (s DELETE b)) + ==> b IN span (a INSERT (s DELETE b))`, + ASM_MESON_TAC[IN_SPAN_INSERT; SPAN_MONO; SUBSET; IN_INSERT; IN_DELETE]);; + +let EQ_SPAN_INSERT_EQ = prove + (`!s x y:real^N. (x - y) IN span s ==> span(x INSERT s) = span(y INSERT s)`, + REPEAT STRIP_TAC THEN REWRITE_TAC[SPAN_BREAKDOWN_EQ; EXTENSION] THEN + ASM_MESON_TAC[SPAN_ADD; SPAN_SUB; SPAN_MUL; + VECTOR_ARITH `(z - k % y) - k % (x - y) = z - k % x`; + VECTOR_ARITH `(z - k % x) + k % (x - y) = z - k % y`]);; + +(* ------------------------------------------------------------------------- *) +(* Transitivity property. *) +(* ------------------------------------------------------------------------- *) + +let SPAN_TRANS = prove + (`!x y:real^N s. x IN span(s) /\ y IN span(x INSERT s) ==> y IN span(s)`, + REPEAT STRIP_TAC THEN + MP_TAC(SPECL [`x:real^N`; `(x:real^N) INSERT s`; `y:real^N`] + SPAN_BREAKDOWN) THEN + ASM_REWRITE_TAC[IN_INSERT] THEN + DISCH_THEN(X_CHOOSE_THEN `k:real` STRIP_ASSUME_TAC) THEN + SUBST1_TAC(VECTOR_ARITH `y:real^N = (y - k % x) + k % x`) THEN + MATCH_MP_TAC SPAN_ADD THEN ASM_SIMP_TAC[SPAN_MUL] THEN + ASM_MESON_TAC[SPAN_MONO; SUBSET; IN_INSERT; IN_DELETE]);; + +(* ------------------------------------------------------------------------- *) +(* An explicit expansion is sometimes needed. *) +(* ------------------------------------------------------------------------- *) + +let SPAN_EXPLICIT = prove + (`!(p:real^N -> bool). + span p = + {y | ?s u. FINITE s /\ s SUBSET p /\ + vsum s (\v. u v % v) = y}`, + GEN_TAC THEN MATCH_MP_TAC SUBSET_ANTISYM THEN CONJ_TAC THENL + [ALL_TAC; + REWRITE_TAC[SUBSET; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN FIRST_X_ASSUM(SUBST1_TAC o SYM) THEN + MATCH_MP_TAC SPAN_VSUM THEN ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[SPAN_SUPERSET; SPAN_MUL]] THEN + REWRITE_TAC[SUBSET; IN_ELIM_THM] THEN + MATCH_MP_TAC SPAN_INDUCT_ALT THEN CONJ_TAC THENL + [EXISTS_TAC `{}:real^N->bool` THEN + REWRITE_TAC[FINITE_RULES; VSUM_CLAUSES; EMPTY_SUBSET; NOT_IN_EMPTY]; + ALL_TAC] THEN + MAP_EVERY X_GEN_TAC [`c:real`; `x:real^N`; `y:real^N`] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`s:real^N->bool`; `u:real^N->real`] THEN + STRIP_TAC THEN EXISTS_TAC `(x:real^N) INSERT s` THEN + EXISTS_TAC `\y. if y = x then (if x IN s then (u:real^N->real) y + c else c) + else u y` THEN + ASM_SIMP_TAC[FINITE_INSERT; IN_INSERT; VSUM_CLAUSES] THEN + CONJ_TAC THENL [ASM_MESON_TAC[]; ALL_TAC] THEN + FIRST_X_ASSUM(SUBST_ALL_TAC o SYM) THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[] THENL + [FIRST_X_ASSUM(SUBST1_TAC o MATCH_MP (SET_RULE + `x IN s ==> s = x INSERT (s DELETE x)`)) THEN + ASM_SIMP_TAC[VSUM_CLAUSES; FINITE_INSERT; FINITE_DELETE; IN_DELETE] THEN + MATCH_MP_TAC(VECTOR_ARITH + `y = z ==> (c + d) % x + y = d % x + c % x + z`); + AP_TERM_TAC] THEN + MATCH_MP_TAC VSUM_EQ THEN ASM_MESON_TAC[IN_DELETE]);; + +let DEPENDENT_EXPLICIT = prove + (`!p. dependent (p:real^N -> bool) <=> + ?s u. FINITE s /\ s SUBSET p /\ + (?v. v IN s /\ ~(u v = &0)) /\ + vsum s (\v. u v % v) = vec 0`, + GEN_TAC THEN REWRITE_TAC[dependent; SPAN_EXPLICIT; IN_ELIM_THM] THEN + REWRITE_TAC[RIGHT_AND_EXISTS_THM; LEFT_AND_EXISTS_THM] THEN + EQ_TAC THEN REWRITE_TAC[LEFT_IMP_EXISTS_THM] THENL + [MAP_EVERY X_GEN_TAC [`a:real^N`; `s:real^N->bool`; `u:real^N->real`] THEN + STRIP_TAC THEN MAP_EVERY EXISTS_TAC + [`(a:real^N) INSERT s`; + `\y. if y = a then -- &1 else (u:real^N->real) y`; + `a:real^N`] THEN + ASM_REWRITE_TAC[IN_INSERT; INSERT_SUBSET; FINITE_INSERT] THEN + CONJ_TAC THENL [ASM SET_TAC[]; CONV_TAC REAL_RAT_REDUCE_CONV] THEN + ASM_SIMP_TAC[VSUM_CLAUSES] THEN + COND_CASES_TAC THENL [ASM SET_TAC[]; ALL_TAC] THEN + REWRITE_TAC[VECTOR_ARITH `-- &1 % a + s = vec 0 <=> a = s`] THEN + FIRST_X_ASSUM(fun th -> GEN_REWRITE_TAC LAND_CONV [SYM th]) THEN + MATCH_MP_TAC VSUM_EQ THEN ASM SET_TAC[]; + MAP_EVERY X_GEN_TAC [`s:real^N->bool`; `u:real^N->real`; `a:real^N`] THEN + STRIP_TAC THEN MAP_EVERY EXISTS_TAC + [`a:real^N`; `s DELETE (a:real^N)`; + `\i. --((u:real^N->real) i) / (u a)`] THEN + ASM_SIMP_TAC[VSUM_DELETE; FINITE_DELETE] THEN + REPEAT(CONJ_TAC THENL [ASM SET_TAC[]; ALL_TAC]) THEN + REWRITE_TAC[real_div] THEN ONCE_REWRITE_TAC[REAL_MUL_SYM] THEN + ASM_REWRITE_TAC[VECTOR_MUL_LNEG; GSYM VECTOR_MUL_ASSOC; VSUM_LMUL; + VSUM_NEG; VECTOR_MUL_RNEG; VECTOR_MUL_RZERO] THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV] THEN VECTOR_ARITH_TAC]);; + +let DEPENDENT_FINITE = prove + (`!s:real^N->bool. + FINITE s + ==> (dependent s <=> ?u. (?v. v IN s /\ ~(u v = &0)) /\ + vsum s (\v. u(v) % v) = vec 0)`, + REPEAT STRIP_TAC THEN REWRITE_TAC[DEPENDENT_EXPLICIT] THEN EQ_TAC THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THENL + [MAP_EVERY X_GEN_TAC [`t:real^N->bool`; `u:real^N->real`] THEN + DISCH_THEN(REPEAT_TCL CONJUNCTS_THEN ASSUME_TAC) THEN + EXISTS_TAC `\v:real^N. if v IN t then u(v) else &0` THEN + REWRITE_TAC[] THEN CONJ_TAC THENL [ASM SET_TAC[]; ALL_TAC] THEN + ONCE_REWRITE_TAC[COND_RAND] THEN ONCE_REWRITE_TAC[COND_RATOR] THEN + ASM_SIMP_TAC[VECTOR_MUL_LZERO; GSYM VSUM_RESTRICT_SET] THEN + ASM_SIMP_TAC[SET_RULE `t SUBSET s ==> {x | x IN s /\ x IN t} = t`]; + GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN ASSUME_TAC) THEN + MAP_EVERY EXISTS_TAC [`s:real^N->bool`; `u:real^N->real`] THEN + ASM_REWRITE_TAC[SUBSET_REFL]]);; + +let SPAN_FINITE = prove + (`!s:real^N->bool. + FINITE s ==> span s = {y | ?u. vsum s (\v. u v % v) = y}`, + REPEAT STRIP_TAC THEN REWRITE_TAC[SPAN_EXPLICIT; EXTENSION; IN_ELIM_THM] THEN + X_GEN_TAC `y:real^N` THEN EQ_TAC THEN REWRITE_TAC[LEFT_IMP_EXISTS_THM] THENL + [MAP_EVERY X_GEN_TAC [`t:real^N->bool`; `u:real^N->real`] THEN + STRIP_TAC THEN FIRST_X_ASSUM(SUBST1_TAC o SYM) THEN + EXISTS_TAC `\x:real^N. if x IN t then u(x) else &0` THEN + REWRITE_TAC[COND_RAND; COND_RATOR; VECTOR_MUL_LZERO] THEN + ASM_SIMP_TAC[GSYM VSUM_RESTRICT_SET] THEN + ASM_SIMP_TAC[SET_RULE `t SUBSET s ==> {x | x IN s /\ x IN t} = t`]; + X_GEN_TAC `u:real^N->real` THEN DISCH_THEN(SUBST1_TAC o SYM) THEN + MAP_EVERY EXISTS_TAC [`s:real^N->bool`; `u:real^N->real`] THEN + ASM_REWRITE_TAC[SUBSET_REFL]]);; + +(* ------------------------------------------------------------------------- *) +(* Standard bases are a spanning set, and obviously finite. *) +(* ------------------------------------------------------------------------- *) + +let SPAN_STDBASIS = prove + (`span {basis i :real^N | 1 <= i /\ i <= dimindex(:N)} = UNIV`, + REWRITE_TAC[EXTENSION; IN_UNIV] THEN X_GEN_TAC `x:real^N` THEN + GEN_REWRITE_TAC LAND_CONV [GSYM BASIS_EXPANSION] THEN + MATCH_MP_TAC SPAN_VSUM THEN SIMP_TAC[FINITE_NUMSEG; IN_NUMSEG] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC SPAN_MUL THEN + MATCH_MP_TAC SPAN_SUPERSET THEN REWRITE_TAC[IN_ELIM_THM] THEN + ASM_MESON_TAC[]);; + +let HAS_SIZE_STDBASIS = prove + (`{basis i :real^N | 1 <= i /\ i <= dimindex(:N)} HAS_SIZE + dimindex(:N)`, + ONCE_REWRITE_TAC[SET_RULE `{f x | P x} = IMAGE f {x | P x}`] THEN + MATCH_MP_TAC HAS_SIZE_IMAGE_INJ THEN + REWRITE_TAC[GSYM numseg; HAS_SIZE_NUMSEG_1; IN_NUMSEG] THEN + MESON_TAC[BASIS_INJ]);; + +let FINITE_STDBASIS = prove + (`FINITE {basis i :real^N | 1 <= i /\ i <= dimindex(:N)}`, + MESON_TAC[HAS_SIZE_STDBASIS; HAS_SIZE]);; + +let CARD_STDBASIS = prove + (`CARD {basis i :real^N | 1 <= i /\ i <= dimindex(:N)} = + dimindex(:N)`, + MESON_TAC[HAS_SIZE_STDBASIS; HAS_SIZE]);; + +let IN_SPAN_IMAGE_BASIS = prove + (`!x:real^N s. + x IN span(IMAGE basis s) <=> + !i. 1 <= i /\ i <= dimindex(:N) /\ ~(i IN s) ==> x$i = &0`, + REPEAT GEN_TAC THEN EQ_TAC THENL + [SPEC_TAC(`x:real^N`,`x:real^N`) THEN MATCH_MP_TAC SPAN_INDUCT THEN + SIMP_TAC[subspace; IN_ELIM_THM; VEC_COMPONENT; VECTOR_ADD_COMPONENT; + VECTOR_MUL_COMPONENT; REAL_MUL_RZERO; REAL_ADD_RID] THEN + SIMP_TAC[FORALL_IN_IMAGE; BASIS_COMPONENT] THEN MESON_TAC[]; + DISCH_TAC THEN REWRITE_TAC[SPAN_EXPLICIT; IN_ELIM_THM] THEN + EXISTS_TAC `(IMAGE basis ((1..dimindex(:N)) INTER s)):real^N->bool` THEN + SIMP_TAC[FINITE_IMAGE; FINITE_INTER; FINITE_NUMSEG] THEN + REWRITE_TAC[RIGHT_EXISTS_AND_THM] THEN + CONJ_TAC THENL [SET_TAC[]; ALL_TAC] THEN + EXISTS_TAC `\v:real^N. x dot v` THEN + W(MP_TAC o PART_MATCH (lhs o rand) VSUM_IMAGE o lhand o snd) THEN + ANTS_TAC THENL + [SIMP_TAC[FINITE_IMAGE; FINITE_INTER; FINITE_NUMSEG] THEN + REWRITE_TAC[IN_INTER; IN_NUMSEG] THEN MESON_TAC[BASIS_INJ]; + DISCH_THEN SUBST1_TAC THEN REWRITE_TAC[]] THEN + REWRITE_TAC[o_DEF] THEN + SIMP_TAC[CART_EQ; VSUM_COMPONENT; VECTOR_MUL_COMPONENT; + BASIS_COMPONENT] THEN + ONCE_REWRITE_TAC[COND_RAND] THEN + ONCE_REWRITE_TAC[MESON[] + `(if x = y then p else q) = (if y = x then p else q)`] THEN + SIMP_TAC[SUM_DELTA; REAL_MUL_RZERO; IN_INTER; IN_NUMSEG; DOT_BASIS] THEN + ASM_MESON_TAC[REAL_MUL_RID]]);; + +let INDEPENDENT_STDBASIS = prove + (`independent {basis i :real^N | 1 <= i /\ i <= dimindex(:N)}`, + REWRITE_TAC[independent; dependent] THEN + ONCE_REWRITE_TAC[SET_RULE `{f x | P x} = IMAGE f {x | P x}`] THEN + REWRITE_TAC[EXISTS_IN_IMAGE] THEN REWRITE_TAC[IN_ELIM_THM] THEN + DISCH_THEN(X_CHOOSE_THEN `k:num` (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + SUBGOAL_THEN + `IMAGE basis {i | 1 <= i /\ i <= dimindex(:N)} DELETE + (basis k:real^N) = + IMAGE basis ({i | 1 <= i /\ i <= dimindex(:N)} DELETE k)` + SUBST1_TAC THENL + [REWRITE_TAC[EXTENSION; IN_IMAGE; IN_DELETE; IN_ELIM_THM] THEN + GEN_TAC THEN EQ_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[BASIS_INJ]; + ALL_TAC] THEN + REWRITE_TAC[IN_SPAN_IMAGE_BASIS] THEN DISCH_THEN(MP_TAC o SPEC `k:num`) THEN + ASM_SIMP_TAC[IN_DELETE; BASIS_COMPONENT; REAL_OF_NUM_EQ; ARITH]);; + +(* ------------------------------------------------------------------------- *) +(* This is useful for building a basis step-by-step. *) +(* ------------------------------------------------------------------------- *) + +let INDEPENDENT_INSERT = prove + (`!a:real^N s. independent(a INSERT s) <=> + if a IN s then independent s + else independent s /\ ~(a IN span s)`, + REPEAT GEN_TAC THEN ASM_CASES_TAC `(a:real^N) IN s` THEN + ASM_SIMP_TAC[SET_RULE `x IN s ==> (x INSERT s = s)`] THEN + EQ_TAC THENL + [DISCH_TAC THEN CONJ_TAC THENL + [ASM_MESON_TAC[INDEPENDENT_MONO; SUBSET; IN_INSERT]; + POP_ASSUM MP_TAC THEN REWRITE_TAC[independent; dependent] THEN + ASM_MESON_TAC[IN_INSERT; SET_RULE + `~(a IN s) ==> ((a INSERT s) DELETE a = s)`]]; + ALL_TAC] THEN + REWRITE_TAC[independent; dependent; NOT_EXISTS_THM] THEN + STRIP_TAC THEN X_GEN_TAC `b:real^N` THEN + REWRITE_TAC[IN_INSERT] THEN ASM_CASES_TAC `b:real^N = a` THEN + ASM_SIMP_TAC[SET_RULE `~(a IN s) ==> ((a INSERT s) DELETE a = s)`] THEN + ASM_SIMP_TAC[SET_RULE + `~(a IN s) /\ ~(b = a) + ==> ((a INSERT s) DELETE b = a INSERT (s DELETE b))`] THEN + ASM_MESON_TAC[IN_SPAN_INSERT; SET_RULE + `b IN s ==> (b INSERT (s DELETE b) = s)`]);; + +(* ------------------------------------------------------------------------- *) +(* The degenerate case of the Exchange Lemma. *) +(* ------------------------------------------------------------------------- *) + +let SPANNING_SUBSET_INDEPENDENT = prove + (`!s t:real^N->bool. + t SUBSET s /\ independent s /\ s SUBSET span(t) ==> (s = t)`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC SUBSET_ANTISYM THEN + ASM_REWRITE_TAC[] THEN REWRITE_TAC[SUBSET] THEN + X_GEN_TAC `a:real^N` THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [independent]) THEN + REWRITE_TAC[dependent; NOT_EXISTS_THM] THEN + DISCH_THEN(MP_TAC o SPEC `a:real^N`) THEN ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[SPAN_MONO; SUBSET; IN_DELETE]);; + +(* ------------------------------------------------------------------------- *) +(* The general case of the Exchange Lemma, the key to what follows. *) +(* ------------------------------------------------------------------------- *) + +let EXCHANGE_LEMMA = prove + (`!s t:real^N->bool. + FINITE t /\ independent s /\ s SUBSET span t + ==> ?t'. t' HAS_SIZE (CARD t) /\ + s SUBSET t' /\ t' SUBSET (s UNION t) /\ s SUBSET (span t')`, + REPEAT GEN_TAC THEN + WF_INDUCT_TAC `CARD(t DIFF s :real^N->bool)` THEN + ASM_CASES_TAC `(s:real^N->bool) SUBSET t` THENL + [ASM_MESON_TAC[HAS_SIZE; SUBSET_UNION]; ALL_TAC] THEN + ASM_CASES_TAC `t SUBSET (s:real^N->bool)` THENL + [ASM_MESON_TAC[SPANNING_SUBSET_INDEPENDENT; HAS_SIZE]; ALL_TAC] THEN + STRIP_TAC THEN + FIRST_X_ASSUM(MP_TAC o REWRITE_RULE[SUBSET] o check(is_neg o concl)) THEN + REWRITE_TAC[NOT_FORALL_THM; NOT_IMP] THEN + DISCH_THEN(X_CHOOSE_THEN `b:real^N` STRIP_ASSUME_TAC) THEN + ASM_CASES_TAC `s SUBSET span(t DELETE (b:real^N))` THENL + [FIRST_X_ASSUM(MP_TAC o + SPECL [`t DELETE (b:real^N)`; `s:real^N->bool`]) THEN + ASM_REWRITE_TAC[SET_RULE `s DELETE a DIFF t = (s DIFF t) DELETE a`] THEN + ASM_SIMP_TAC[CARD_DELETE; FINITE_DIFF; IN_DIFF; FINITE_DELETE; + CARD_EQ_0; ARITH_RULE `n - 1 < n <=> ~(n = 0)`] THEN + ANTS_TAC THENL + [UNDISCH_TAC `~((s:real^N->bool) SUBSET t)` THEN ASM SET_TAC[]; + ALL_TAC] THEN + DISCH_THEN(X_CHOOSE_THEN `u:real^N->bool` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `(b:real^N) INSERT u` THEN + ASM_SIMP_TAC[SUBSET_INSERT; INSERT_SUBSET; IN_UNION] THEN CONJ_TAC THENL + [UNDISCH_TAC `(u:real^N->bool) HAS_SIZE CARD(t:real^N->bool) - 1` THEN + SIMP_TAC[HAS_SIZE; FINITE_RULES; CARD_CLAUSES] THEN STRIP_TAC THEN + COND_CASES_TAC THENL + [ASM_MESON_TAC[SUBSET; IN_UNION; IN_DELETE]; ALL_TAC] THEN + ASM_MESON_TAC[ARITH_RULE `~(n = 0) ==> (SUC(n - 1) = n)`; + CARD_EQ_0; MEMBER_NOT_EMPTY]; + ALL_TAC] THEN + CONJ_TAC THENL + [UNDISCH_TAC `u SUBSET s UNION t DELETE (b:real^N)` THEN SET_TAC[]; + ASM_MESON_TAC[SUBSET; SPAN_MONO; IN_INSERT]]; + ALL_TAC] THEN + UNDISCH_TAC `~(s SUBSET span (t DELETE (b:real^N)))` THEN + GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [SUBSET] THEN + REWRITE_TAC[NOT_FORALL_THM; NOT_IMP] THEN + DISCH_THEN(X_CHOOSE_THEN `a:real^N` STRIP_ASSUME_TAC) THEN + SUBGOAL_THEN `~(a:real^N = b)` ASSUME_TAC THENL + [ASM_MESON_TAC[]; ALL_TAC] THEN + SUBGOAL_THEN `~((a:real^N) IN t)` ASSUME_TAC THENL + [ASM_MESON_TAC[IN_DELETE; SPAN_CLAUSES]; ALL_TAC] THEN + FIRST_X_ASSUM(MP_TAC o SPECL + [`(a:real^N) INSERT (t DELETE b)`; `s:real^N->bool`]) THEN + ANTS_TAC THENL + [ASM_SIMP_TAC[SET_RULE + `a IN s ==> ((a INSERT (t DELETE b) DIFF s) = (t DIFF s) DELETE b)`] THEN + ASM_SIMP_TAC[CARD_DELETE; FINITE_DELETE; FINITE_DIFF; IN_DIFF] THEN + ASM_SIMP_TAC[ARITH_RULE `n - 1 < n <=> ~(n = 0)`; CARD_EQ_0; + FINITE_DIFF] THEN + UNDISCH_TAC `~((s:real^N->bool) SUBSET t)` THEN ASM SET_TAC[]; + ALL_TAC] THEN + ANTS_TAC THENL + [ASM_SIMP_TAC[FINITE_RULES; FINITE_DELETE] THEN + REWRITE_TAC[SUBSET] THEN X_GEN_TAC `x:real^N` THEN + DISCH_TAC THEN MATCH_MP_TAC SPAN_TRANS THEN EXISTS_TAC `b:real^N` THEN + ASM_MESON_TAC[IN_SPAN_DELETE; SUBSET; SPAN_MONO; + SET_RULE `t SUBSET (b INSERT (a INSERT (t DELETE b)))`]; + ALL_TAC] THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `u:real^N->bool` THEN + ASM_SIMP_TAC[HAS_SIZE; CARD_CLAUSES; CARD_DELETE; FINITE_DELETE; IN_DELETE; + ARITH_RULE `(SUC(n - 1) = n) <=> ~(n = 0)`; + CARD_EQ_0] THEN + UNDISCH_TAC `(b:real^N) IN t` THEN ASM SET_TAC[]);; + +(* ------------------------------------------------------------------------- *) +(* This implies corresponding size bounds. *) +(* ------------------------------------------------------------------------- *) + +let INDEPENDENT_SPAN_BOUND = prove + (`!s t. FINITE t /\ independent s /\ s SUBSET span(t) + ==> FINITE s /\ CARD(s) <= CARD(t)`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + FIRST_ASSUM(MP_TAC o MATCH_MP EXCHANGE_LEMMA) THEN + ASM_MESON_TAC[HAS_SIZE; CARD_SUBSET; FINITE_SUBSET]);; + +let INDEPENDENT_BOUND = prove + (`!s:real^N->bool. + independent s ==> FINITE s /\ CARD(s) <= dimindex(:N)`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + ONCE_REWRITE_TAC[GSYM CARD_STDBASIS] THEN + MATCH_MP_TAC INDEPENDENT_SPAN_BOUND THEN + ASM_REWRITE_TAC[FINITE_STDBASIS; SPAN_STDBASIS; SUBSET_UNIV]);; + +let DEPENDENT_BIGGERSET = prove + (`!s:real^N->bool. (FINITE s ==> CARD(s) > dimindex(:N)) ==> dependent s`, + MP_TAC INDEPENDENT_BOUND THEN MATCH_MP_TAC MONO_FORALL THEN + REWRITE_TAC[GT; GSYM NOT_LE; independent] THEN MESON_TAC[]);; + +let INDEPENDENT_IMP_FINITE = prove + (`!s:real^N->bool. independent s ==> FINITE s`, + SIMP_TAC[INDEPENDENT_BOUND]);; + +(* ------------------------------------------------------------------------- *) +(* Explicit formulation of independence. *) +(* ------------------------------------------------------------------------- *) + +let INDEPENDENT_EXPLICIT = prove + (`!b:real^N->bool. + independent b <=> + FINITE b /\ + !c. vsum b (\v. c(v) % v) = vec 0 ==> !v. v IN b ==> c(v) = &0`, + GEN_TAC THEN + ASM_CASES_TAC `FINITE(b:real^N->bool)` THENL + [ALL_TAC; ASM_MESON_TAC[INDEPENDENT_BOUND]] THEN + ASM_SIMP_TAC[independent; DEPENDENT_FINITE] THEN MESON_TAC[]);; + +let INDEPENDENT_2 = prove + (`!a b:real^N x y. + independent{a,b} /\ ~(a = b) + ==> (x % a + y % b = vec 0 <=> x = &0 /\ y = &0)`, + REWRITE_TAC[INDEPENDENT_EXPLICIT] THEN REPEAT STRIP_TAC THEN EQ_TAC THEN + SIMP_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID] THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `\c:real^N. if c = a then x else y:real`) THEN + SIMP_TAC[VSUM_CLAUSES; FINITE_INSERT; FINITE_EMPTY] THEN + ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; VECTOR_ADD_RID] THEN + DISCH_THEN(fun th -> + MP_TAC(SPEC `a:real^N` th) THEN MP_TAC(SPEC `b:real^N` th)) THEN + ASM_SIMP_TAC[]);; + +let INDEPENDENT_3 = prove + (`!a b c:real^N x y z. + independent{a,b,c} /\ ~(a = b) /\ ~(a = c) /\ ~(b = c) + ==> (x % a + y % b + z % c = vec 0 <=> x = &0 /\ y = &0 /\ z = &0)`, + REWRITE_TAC[INDEPENDENT_EXPLICIT] THEN REPEAT STRIP_TAC THEN EQ_TAC THEN + SIMP_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID] THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC + `\v:real^N. if v = a then x else if v = b then y else z:real`) THEN + SIMP_TAC[VSUM_CLAUSES; FINITE_INSERT; FINITE_EMPTY] THEN + ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; VECTOR_ADD_RID] THEN + DISCH_THEN(fun th -> + MP_TAC(SPEC `a:real^N` th) THEN MP_TAC(SPEC `b:real^N` th) THEN + MP_TAC(SPEC `c:real^N` th)) THEN + ASM_SIMP_TAC[]);; + +(* ------------------------------------------------------------------------- *) +(* Hence we can create a maximal independent subset. *) +(* ------------------------------------------------------------------------- *) + +let MAXIMAL_INDEPENDENT_SUBSET_EXTEND = prove + (`!s v:real^N->bool. + s SUBSET v /\ independent s + ==> ?b. s SUBSET b /\ b SUBSET v /\ independent b /\ + v SUBSET (span b)`, + REPEAT GEN_TAC THEN + WF_INDUCT_TAC `dimindex(:N) - CARD(s:real^N->bool)` THEN + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `v SUBSET (span(s:real^N->bool))` THENL + [ASM_MESON_TAC[SUBSET_REFL]; ALL_TAC] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE RAND_CONV [SUBSET]) THEN + REWRITE_TAC[NOT_FORALL_THM; NOT_IMP] THEN + DISCH_THEN(X_CHOOSE_THEN `a:real^N` STRIP_ASSUME_TAC) THEN + FIRST_X_ASSUM(MP_TAC o SPEC `(a:real^N) INSERT s`) THEN + REWRITE_TAC[IMP_IMP] THEN ANTS_TAC THENL + [ALL_TAC; MESON_TAC[INSERT_SUBSET]] THEN + SUBGOAL_THEN `independent ((a:real^N) INSERT s)` ASSUME_TAC THENL + [ASM_REWRITE_TAC[INDEPENDENT_INSERT; COND_ID]; ALL_TAC] THEN + ASM_REWRITE_TAC[INSERT_SUBSET] THEN + MATCH_MP_TAC(ARITH_RULE `(b = a + 1) /\ b <= n ==> n - b < n - a`) THEN + ASM_SIMP_TAC[CARD_CLAUSES; INDEPENDENT_BOUND] THEN + ASM_MESON_TAC[SPAN_SUPERSET; ADD1]);; + +let MAXIMAL_INDEPENDENT_SUBSET = prove + (`!v:real^N->bool. ?b. b SUBSET v /\ independent b /\ v SUBSET (span b)`, + MP_TAC(SPEC `EMPTY:real^N->bool` MAXIMAL_INDEPENDENT_SUBSET_EXTEND) THEN + REWRITE_TAC[EMPTY_SUBSET; INDEPENDENT_EMPTY]);; + +(* ------------------------------------------------------------------------- *) +(* Notion of dimension. *) +(* ------------------------------------------------------------------------- *) + +let dim = new_definition + `dim v = @n. ?b. b SUBSET v /\ independent b /\ v SUBSET (span b) /\ + b HAS_SIZE n`;; + +let BASIS_EXISTS = prove + (`!v. ?b. b SUBSET v /\ independent b /\ v SUBSET (span b) /\ + b HAS_SIZE (dim v)`, + GEN_TAC THEN REWRITE_TAC[dim] THEN CONV_TAC SELECT_CONV THEN + MESON_TAC[MAXIMAL_INDEPENDENT_SUBSET; HAS_SIZE; INDEPENDENT_BOUND]);; + +let BASIS_EXISTS_FINITE = prove + (`!v. ?b. FINITE b /\ + b SUBSET v /\ + independent b /\ + v SUBSET (span b) /\ + b HAS_SIZE (dim v)`, + MESON_TAC[BASIS_EXISTS; INDEPENDENT_IMP_FINITE]);; + +let BASIS_SUBSPACE_EXISTS = prove + (`!s:real^N->bool. + subspace s + ==> ?b. FINITE b /\ + b SUBSET s /\ + independent b /\ + span b = s /\ + b HAS_SIZE dim s`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPEC `s:real^N->bool` BASIS_EXISTS) THEN + MATCH_MP_TAC MONO_EXISTS THEN REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[GSYM SUBSET_ANTISYM_EQ] THEN + ASM_MESON_TAC[SPAN_EQ_SELF; SPAN_MONO; INDEPENDENT_IMP_FINITE]);; + +(* ------------------------------------------------------------------------- *) +(* Consequences of independence or spanning for cardinality. *) +(* ------------------------------------------------------------------------- *) + +let INDEPENDENT_CARD_LE_DIM = prove + (`!v b:real^N->bool. + b SUBSET v /\ independent b ==> FINITE b /\ CARD(b) <= dim v`, + MESON_TAC[BASIS_EXISTS; INDEPENDENT_SPAN_BOUND; HAS_SIZE;SUBSET_TRANS]);; + +let SPAN_CARD_GE_DIM = prove + (`!v b:real^N->bool. + v SUBSET (span b) /\ FINITE b ==> dim(v) <= CARD(b)`, + MESON_TAC[BASIS_EXISTS; INDEPENDENT_SPAN_BOUND; HAS_SIZE;SUBSET_TRANS]);; + +let BASIS_CARD_EQ_DIM = prove + (`!v b. b SUBSET v /\ v SUBSET (span b) /\ independent b + ==> FINITE b /\ (CARD b = dim v)`, + MESON_TAC[LE_ANTISYM; INDEPENDENT_CARD_LE_DIM; SPAN_CARD_GE_DIM]);; + +let BASIS_HAS_SIZE_DIM = prove + (`!v b. independent b /\ span b = v ==> b HAS_SIZE (dim v)`, + REPEAT STRIP_TAC THEN REWRITE_TAC[HAS_SIZE] THEN + MATCH_MP_TAC BASIS_CARD_EQ_DIM THEN ASM_REWRITE_TAC[SUBSET_REFL] THEN + FIRST_X_ASSUM(SUBST1_TAC o SYM) THEN REWRITE_TAC[SPAN_INC]);; + +let DIM_UNIQUE = prove + (`!v b. b SUBSET v /\ v SUBSET (span b) /\ independent b /\ b HAS_SIZE n + ==> (dim v = n)`, + MESON_TAC[BASIS_CARD_EQ_DIM; HAS_SIZE]);; + +let DIM_LE_CARD = prove + (`!s. FINITE s ==> dim s <= CARD s`, + GEN_TAC THEN DISCH_TAC THEN MATCH_MP_TAC SPAN_CARD_GE_DIM THEN + ASM_REWRITE_TAC[SPAN_INC; SUBSET_REFL]);; + +(* ------------------------------------------------------------------------- *) +(* More lemmas about dimension. *) +(* ------------------------------------------------------------------------- *) + +let DIM_UNIV = prove + (`dim(:real^N) = dimindex(:N)`, + MATCH_MP_TAC DIM_UNIQUE THEN + EXISTS_TAC `{basis i :real^N | 1 <= i /\ i <= dimindex(:N)}` THEN + REWRITE_TAC[SUBSET_UNIV; SPAN_STDBASIS; HAS_SIZE_STDBASIS; + INDEPENDENT_STDBASIS]);; + +let DIM_SUBSET = prove + (`!s t:real^N->bool. s SUBSET t ==> dim(s) <= dim(t)`, + MESON_TAC[BASIS_EXISTS; INDEPENDENT_SPAN_BOUND; SUBSET; HAS_SIZE]);; + +let DIM_SUBSET_UNIV = prove + (`!s:real^N->bool. dim(s) <= dimindex(:N)`, + GEN_TAC THEN REWRITE_TAC[GSYM DIM_UNIV] THEN + MATCH_MP_TAC DIM_SUBSET THEN REWRITE_TAC[SUBSET_UNIV]);; + +let BASIS_HAS_SIZE_UNIV = prove + (`!b. independent b /\ span b = (:real^N) ==> b HAS_SIZE (dimindex(:N))`, + REWRITE_TAC[GSYM DIM_UNIV; BASIS_HAS_SIZE_DIM]);; + +(* ------------------------------------------------------------------------- *) +(* Converses to those. *) +(* ------------------------------------------------------------------------- *) + +let CARD_GE_DIM_INDEPENDENT = prove + (`!v b:real^N->bool. + b SUBSET v /\ independent b /\ dim v <= CARD(b) + ==> v SUBSET (span b)`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `!a:real^N. ~(a IN v /\ ~(a IN span b))` MP_TAC THENL + [ALL_TAC; SET_TAC[]] THEN + X_GEN_TAC `a:real^N` THEN STRIP_TAC THEN + SUBGOAL_THEN `independent((a:real^N) INSERT b)` ASSUME_TAC THENL + [ASM_MESON_TAC[INDEPENDENT_INSERT]; ALL_TAC] THEN + MP_TAC(ISPECL [`v:real^N->bool`; `(a:real^N) INSERT b`] + INDEPENDENT_CARD_LE_DIM) THEN + ASM_SIMP_TAC[INSERT_SUBSET; CARD_CLAUSES; INDEPENDENT_BOUND] THEN + ASM_MESON_TAC[SPAN_SUPERSET; SUBSET; ARITH_RULE + `x <= y ==> ~(SUC y <= x)`]);; + +let CARD_LE_DIM_SPANNING = prove + (`!v b:real^N->bool. + v SUBSET (span b) /\ FINITE b /\ CARD(b) <= dim v + ==> independent b`, + REPEAT STRIP_TAC THEN REWRITE_TAC[independent; dependent] THEN + DISCH_THEN(X_CHOOSE_THEN `a:real^N` STRIP_ASSUME_TAC) THEN + SUBGOAL_THEN `dim(v:real^N->bool) <= CARD(b DELETE (a:real^N))` MP_TAC THENL + [ALL_TAC; + ASM_SIMP_TAC[CARD_DELETE] THEN MATCH_MP_TAC + (ARITH_RULE `b <= n /\ ~(b = 0) ==> ~(n <= b - 1)`) THEN + ASM_SIMP_TAC[CARD_EQ_0] THEN ASM_MESON_TAC[MEMBER_NOT_EMPTY]] THEN + MATCH_MP_TAC SPAN_CARD_GE_DIM THEN ASM_SIMP_TAC[FINITE_DELETE] THEN + REWRITE_TAC[SUBSET] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC SPAN_TRANS THEN EXISTS_TAC `a:real^N` THEN + ASM_SIMP_TAC[SET_RULE `a IN b ==> (a INSERT (b DELETE a) = b)`] THEN + ASM_MESON_TAC[SUBSET]);; + +let CARD_EQ_DIM = prove + (`!v b. b SUBSET v /\ b HAS_SIZE (dim v) + ==> (independent b <=> v SUBSET (span b))`, + REWRITE_TAC[HAS_SIZE; GSYM LE_ANTISYM] THEN + MESON_TAC[CARD_LE_DIM_SPANNING; CARD_GE_DIM_INDEPENDENT]);; + +(* ------------------------------------------------------------------------- *) +(* More general size bound lemmas. *) +(* ------------------------------------------------------------------------- *) + +let INDEPENDENT_BOUND_GENERAL = prove + (`!s:real^N->bool. independent s ==> FINITE s /\ CARD(s) <= dim(s)`, + MESON_TAC[INDEPENDENT_CARD_LE_DIM; INDEPENDENT_BOUND; SUBSET_REFL]);; + +let DEPENDENT_BIGGERSET_GENERAL = prove + (`!s:real^N->bool. (FINITE s ==> CARD(s) > dim(s)) ==> dependent s`, + MP_TAC INDEPENDENT_BOUND_GENERAL THEN MATCH_MP_TAC MONO_FORALL THEN + REWRITE_TAC[GT; GSYM NOT_LE; independent] THEN MESON_TAC[]);; + +let DIM_SPAN = prove + (`!s:real^N->bool. dim(span s) = dim s`, + GEN_TAC THEN REWRITE_TAC[GSYM LE_ANTISYM] THEN CONJ_TAC THENL + [ALL_TAC; + MATCH_MP_TAC DIM_SUBSET THEN MESON_TAC[SUBSET; SPAN_SUPERSET]] THEN + MP_TAC(ISPEC `s:real^N->bool` BASIS_EXISTS) THEN + REWRITE_TAC[HAS_SIZE] THEN STRIP_TAC THEN + FIRST_X_ASSUM(SUBST1_TAC o SYM) THEN + MATCH_MP_TAC SPAN_CARD_GE_DIM THEN ASM_REWRITE_TAC[] THEN + GEN_REWRITE_TAC RAND_CONV [GSYM SPAN_SPAN] THEN + MATCH_MP_TAC SPAN_MONO THEN ASM_REWRITE_TAC[]);; + +let DIM_INSERT_0 = prove + (`!s:real^N->bool. dim(vec 0 INSERT s) = dim s`, + ONCE_REWRITE_TAC[GSYM DIM_SPAN] THEN + REWRITE_TAC[SPAN_INSERT_0]);; + +let DIM_EQ_CARD = prove + (`!s:real^N->bool. independent s ==> dim s = CARD s`, + REPEAT STRIP_TAC THEN MP_TAC + (ISPECL [`span s:real^N->bool`; `s:real^N->bool`] BASIS_CARD_EQ_DIM) THEN + ASM_SIMP_TAC[SUBSET_REFL; SPAN_INC; DIM_SPAN]);; + +let SUBSET_LE_DIM = prove + (`!s t:real^N->bool. s SUBSET (span t) ==> dim s <= dim t`, + MESON_TAC[DIM_SPAN; DIM_SUBSET]);; + +let SPAN_EQ_DIM = prove + (`!s t. span s = span t ==> dim s = dim t`, + MESON_TAC[DIM_SPAN]);; + +let SPANS_IMAGE = prove + (`!f b v. linear f /\ v SUBSET (span b) + ==> (IMAGE f v) SUBSET span(IMAGE f b)`, + SIMP_TAC[SPAN_LINEAR_IMAGE; IMAGE_SUBSET]);; + +let DIM_LINEAR_IMAGE_LE = prove + (`!f:real^M->real^N s. linear f ==> dim(IMAGE f s) <= dim s`, + REPEAT STRIP_TAC THEN MP_TAC(ISPEC `s:real^M->bool` BASIS_EXISTS) THEN + REWRITE_TAC[HAS_SIZE] THEN STRIP_TAC THEN FIRST_ASSUM(SUBST1_TAC o SYM) THEN + MATCH_MP_TAC LE_TRANS THEN EXISTS_TAC `CARD(IMAGE (f:real^M->real^N) b)` THEN + ASM_SIMP_TAC[CARD_IMAGE_LE] THEN MATCH_MP_TAC SPAN_CARD_GE_DIM THEN + ASM_MESON_TAC[SPAN_LINEAR_IMAGE; SPANS_IMAGE; SUBSET_IMAGE; FINITE_IMAGE]);; + +(* ------------------------------------------------------------------------- *) +(* Some stepping theorems. *) +(* ------------------------------------------------------------------------- *) + +let DIM_EMPTY = prove + (`dim({}:real^N->bool) = 0`, + MATCH_MP_TAC DIM_UNIQUE THEN EXISTS_TAC `{}:real^N->bool` THEN + REWRITE_TAC[SUBSET_REFL; SPAN_EMPTY; INDEPENDENT_EMPTY; HAS_SIZE_0; + EMPTY_SUBSET]);; + +let DIM_INSERT = prove + (`!x:real^N s. dim(x INSERT s) = if x IN span s then dim s else dim s + 1`, + REPEAT GEN_TAC THEN COND_CASES_TAC THENL + [MATCH_MP_TAC SPAN_EQ_DIM THEN MATCH_MP_TAC SUBSET_ANTISYM THEN + ASM_MESON_TAC[SPAN_TRANS; SUBSET; SPAN_MONO; IN_INSERT]; + ALL_TAC] THEN + X_CHOOSE_THEN `b:real^N->bool` STRIP_ASSUME_TAC + (ISPEC `span s:real^N->bool` BASIS_EXISTS) THEN + ONCE_REWRITE_TAC[GSYM DIM_SPAN] THEN + MATCH_MP_TAC DIM_UNIQUE THEN + EXISTS_TAC `(x:real^N) INSERT b` THEN REPEAT CONJ_TAC THENL + [REWRITE_TAC[INSERT_SUBSET] THEN + ASM_MESON_TAC[SUBSET; SPAN_MONO; IN_INSERT; SPAN_SUPERSET]; + REWRITE_TAC[SUBSET; SPAN_BREAKDOWN_EQ] THEN + ASM_MESON_TAC[SUBSET]; + REWRITE_TAC[INDEPENDENT_INSERT] THEN + ASM_MESON_TAC[SUBSET; SPAN_SUPERSET; SPAN_MONO; SPAN_SPAN]; + RULE_ASSUM_TAC(REWRITE_RULE[HAS_SIZE]) THEN + ASM_SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; ADD1] THEN + ASM_MESON_TAC[SUBSET; SPAN_SUPERSET; SPAN_MONO; SPAN_SPAN]]);; + +let DIM_SING = prove + (`!x. dim{x} = if x = vec 0 then 0 else 1`, + REWRITE_TAC[DIM_INSERT; DIM_EMPTY; SPAN_EMPTY; IN_SING; ARITH]);; + +let DIM_EQ_0 = prove + (`!s:real^N->bool. dim s = 0 <=> s SUBSET {vec 0}`, + REPEAT STRIP_TAC THEN EQ_TAC THEN DISCH_TAC THENL + [MATCH_MP_TAC(SET_RULE + `~(?b. ~(b = a) /\ {b} SUBSET s) ==> s SUBSET {a}`) THEN + STRIP_TAC THEN FIRST_X_ASSUM(MP_TAC o MATCH_MP DIM_SUBSET); + MATCH_MP_TAC(ARITH_RULE `!m. m = 0 /\ n <= m ==> n = 0`) THEN + EXISTS_TAC `dim{vec 0:real^N}` THEN ASM_SIMP_TAC[DIM_SUBSET]] THEN + ASM_REWRITE_TAC[DIM_SING; ARITH]);; + +(* ------------------------------------------------------------------------- *) +(* Relation between bases and injectivity/surjectivity of map. *) +(* ------------------------------------------------------------------------- *) + +let SPANNING_SURJECTIVE_IMAGE = prove + (`!f:real^M->real^N s. + UNIV SUBSET (span s) /\ linear f /\ (!y. ?x. f(x) = y) + ==> UNIV SUBSET span(IMAGE f s)`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `IMAGE (f:real^M->real^N) UNIV` THEN + ASM_SIMP_TAC[SPANS_IMAGE] THEN + REWRITE_TAC[SUBSET; IN_UNIV; IN_IMAGE] THEN ASM_MESON_TAC[]);; + +let INDEPENDENT_INJECTIVE_IMAGE_GEN = prove + (`!f:real^M->real^N s. + independent s /\ linear f /\ + (!x y. x IN span s /\ y IN span s /\ f(x) = f(y) ==> x = y) + ==> independent (IMAGE f s)`, + REPEAT GEN_TAC THEN + DISCH_THEN(CONJUNCTS_THEN2 MP_TAC STRIP_ASSUME_TAC) THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[independent; DEPENDENT_EXPLICIT] THEN + REWRITE_TAC[CONJ_ASSOC; FINITE_SUBSET_IMAGE] THEN + REWRITE_TAC[MESON[] + `(?s u. ((?t. p t /\ s = f t) /\ q s u) /\ r s u) <=> + (?t u. p t /\ q (f t) u /\ r (f t) u)`] THEN + REWRITE_TAC[EXISTS_IN_IMAGE; LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`t:real^M->bool`; `u:real^N->real`] THEN + DISCH_THEN(REPEAT_TCL CONJUNCTS_THEN ASSUME_TAC) THEN + MAP_EVERY EXISTS_TAC + [`t:real^M->bool`; `(u:real^N->real) o (f:real^M->real^N)`] THEN + ASM_REWRITE_TAC[o_THM] THEN + FIRST_ASSUM MATCH_MP_TAC THEN REPEAT CONJ_TAC THENL + [MATCH_MP_TAC SPAN_VSUM THEN ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC SPAN_MUL THEN + MATCH_MP_TAC SPAN_SUPERSET THEN ASM SET_TAC[]; + REWRITE_TAC[SPAN_0]; + ASM_SIMP_TAC[LINEAR_VSUM] THEN + FIRST_ASSUM(SUBST1_TAC o MATCH_MP LINEAR_0) THEN + FIRST_X_ASSUM(SUBST1_TAC o SYM) THEN CONV_TAC SYM_CONV THEN + W(MP_TAC o PART_MATCH (lhs o rand) VSUM_IMAGE o lhand o snd) THEN + ASM_SIMP_TAC[o_DEF; LINEAR_CMUL] THEN DISCH_THEN MATCH_MP_TAC THEN + ASM_MESON_TAC[SPAN_SUPERSET; SUBSET]]);; + +let INDEPENDENT_INJECTIVE_IMAGE = prove + (`!f:real^M->real^N s. + independent s /\ linear f /\ (!x y. (f(x) = f(y)) ==> (x = y)) + ==> independent (IMAGE f s)`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC INDEPENDENT_INJECTIVE_IMAGE_GEN THEN + ASM_MESON_TAC[]);; + +(* ------------------------------------------------------------------------- *) +(* Picking an orthogonal replacement for a spanning set. *) +(* ------------------------------------------------------------------------- *) + +let VECTOR_SUB_PROJECT_ORTHOGONAL = prove + (`!b:real^N x. b dot (x - ((b dot x) / (b dot b)) % b) = &0`, + REPEAT GEN_TAC THEN ASM_CASES_TAC `b = vec 0 :real^N` THENL + [ASM_REWRITE_TAC[DOT_LZERO]; ALL_TAC] THEN + ASM_SIMP_TAC[DOT_RSUB; DOT_RMUL] THEN + ASM_SIMP_TAC[REAL_SUB_REFL; REAL_DIV_RMUL; DOT_EQ_0]);; + +let BASIS_ORTHOGONAL = prove + (`!b:real^N->bool. + FINITE b + ==> ?c. FINITE c /\ CARD c <= CARD b /\ + span c = span b /\ pairwise orthogonal c`, + REWRITE_TAC[pairwise; orthogonal] THEN MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + CONJ_TAC THENL + [EXISTS_TAC `{}:real^N->bool` THEN + REWRITE_TAC[FINITE_RULES; NOT_IN_EMPTY; LE_REFL]; + ALL_TAC] THEN + MAP_EVERY X_GEN_TAC [`a:real^N`; `b:real^N->bool`] THEN + DISCH_THEN(CONJUNCTS_THEN2 (X_CHOOSE_THEN `c:real^N->bool` STRIP_ASSUME_TAC) + STRIP_ASSUME_TAC) THEN + EXISTS_TAC `(a - vsum c (\x. ((x dot a) / (x dot x)) % x):real^N) + INSERT c` THEN + ASM_SIMP_TAC[FINITE_RULES; CARD_CLAUSES] THEN REPEAT CONJ_TAC THENL + [ASM_ARITH_TAC; + REWRITE_TAC[EXTENSION; SPAN_BREAKDOWN_EQ] THEN + FIRST_X_ASSUM(SUBST_ALL_TAC o SYM) THEN GEN_TAC THEN + AP_TERM_TAC THEN ABS_TAC THEN REWRITE_TAC[VECTOR_SUB_LDISTRIB] THEN + REWRITE_TAC[VECTOR_ARITH `a - (x - y):real^N = y + (a - x)`] THEN + MATCH_MP_TAC SPAN_ADD_EQ THEN MATCH_MP_TAC SPAN_MUL THEN + MATCH_MP_TAC SPAN_VSUM THEN ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC SPAN_MUL THEN + ASM_SIMP_TAC[SPAN_SUPERSET]; + REWRITE_TAC[IN_INSERT] THEN REPEAT STRIP_TAC THENL + [ASM_MESON_TAC[]; + FIRST_X_ASSUM SUBST_ALL_TAC; + FIRST_X_ASSUM SUBST_ALL_TAC; + ASM_MESON_TAC[]] THEN + REWRITE_TAC[DOT_LSUB; DOT_RSUB; REAL_SUB_0] THEN + FIRST_ASSUM(SUBST1_TAC o MATCH_MP (SET_RULE + `x IN s ==> s = x INSERT (s DELETE x)`)) THEN + ASM_SIMP_TAC[VSUM_CLAUSES; FINITE_DELETE; IN_DELETE] THEN + REWRITE_TAC[DOT_LADD; DOT_RADD; DOT_LMUL; DOT_RMUL] THEN + MATCH_MP_TAC(REAL_ARITH `s = &0 /\ a = b ==> b = a + s`) THEN + ASM_SIMP_TAC[DOT_LSUM; DOT_RSUM; FINITE_DELETE] THEN + (CONJ_TAC THENL + [MATCH_MP_TAC SUM_EQ_0 THEN + ASM_SIMP_TAC[DOT_LMUL; DOT_RMUL; IN_DELETE; + REAL_MUL_RZERO; REAL_MUL_LZERO]; + W(MP_TAC o PART_MATCH (lhand o rand) REAL_DIV_RMUL o lhand o snd) THEN + REWRITE_TAC[DOT_SYM] THEN + MATCH_MP_TAC(TAUT `(p ==> q) ==> (~p ==> q) ==> q`) THEN + SIMP_TAC[] THEN SIMP_TAC[DOT_EQ_0; DOT_RZERO; DOT_LZERO] THEN + REWRITE_TAC[REAL_MUL_LZERO; REAL_MUL_RZERO]])]);; + +let ORTHOGONAL_BASIS_EXISTS = prove + (`!v:real^N->bool. + ?b. independent b /\ + b SUBSET span v /\ + v SUBSET span b /\ + b HAS_SIZE dim v /\ + pairwise orthogonal b`, + GEN_TAC THEN MP_TAC(ISPEC `v:real^N->bool` BASIS_EXISTS) THEN + DISCH_THEN(X_CHOOSE_THEN `b:real^N->bool` STRIP_ASSUME_TAC) THEN + MP_TAC(SPEC `b:real^N->bool` BASIS_ORTHOGONAL) THEN + ANTS_TAC THENL [ASM_MESON_TAC[HAS_SIZE]; ALL_TAC] THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `c:real^N->bool` THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT CONJ_TAC THENL + [MATCH_MP_TAC CARD_LE_DIM_SPANNING THEN ASM_REWRITE_TAC[] THEN + EXISTS_TAC `span(v):real^N->bool` THEN CONJ_TAC THENL + [ASM_MESON_TAC[SPAN_SPAN; SPAN_MONO]; + ASM_MESON_TAC[LE_TRANS; HAS_SIZE; DIM_SPAN]]; + ASM_MESON_TAC[SUBSET_TRANS; SPAN_INC; SPAN_SPAN; SPAN_MONO]; + RULE_ASSUM_TAC(REWRITE_RULE[HAS_SIZE]) THEN + ASM_REWRITE_TAC[HAS_SIZE; GSYM LE_ANTISYM] THEN + CONJ_TAC THENL [ASM_MESON_TAC[LE_TRANS]; ALL_TAC] THEN + ONCE_REWRITE_TAC[GSYM DIM_SPAN] THEN MATCH_MP_TAC SPAN_CARD_GE_DIM THEN + ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[SPAN_SPAN; SPAN_MONO; SUBSET_TRANS; SPAN_INC]]);; + +let SPAN_EQ = prove + (`!s t. span s = span t <=> s SUBSET span t /\ t SUBSET span s`, + REWRITE_TAC[GSYM SUBSET_ANTISYM_EQ] THEN + MESON_TAC[SUBSET_TRANS; SPAN_SPAN; SPAN_MONO; SPAN_INC]);; + +(* ------------------------------------------------------------------------- *) +(* We can extend a linear basis-basis injection to the whole set. *) +(* ------------------------------------------------------------------------- *) + +let LINEAR_INDEP_IMAGE_LEMMA = prove + (`!f b. linear(f:real^M->real^N) /\ + FINITE b /\ + independent (IMAGE f b) /\ + (!x y. x IN b /\ y IN b /\ (f x = f y) ==> (x = y)) + ==> !x. x IN span b ==> (f(x) = vec 0) ==> (x = vec 0)`, + REWRITE_TAC[IMP_CONJ; RIGHT_FORALL_IMP_THM] THEN + GEN_TAC THEN DISCH_TAC THEN + GEN_REWRITE_TAC (BINDER_CONV o RAND_CONV) [IMP_IMP] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + CONJ_TAC THENL [SIMP_TAC[IN_SING; SPAN_EMPTY]; ALL_TAC] THEN + MAP_EVERY X_GEN_TAC [`a:real^M`; `b:real^M->bool`] THEN STRIP_TAC THEN + STRIP_TAC THEN FIRST_X_ASSUM(MP_TAC o check (is_imp o concl)) THEN + ANTS_TAC THENL + [ASM_MESON_TAC[INDEPENDENT_MONO; IMAGE_CLAUSES; SUBSET; IN_INSERT]; + ALL_TAC] THEN + DISCH_TAC THEN X_GEN_TAC `x:real^M` THEN DISCH_TAC THEN + MP_TAC(ISPECL [`a:real^M`; `(a:real^M) INSERT b`; `x:real^M`] + SPAN_BREAKDOWN) THEN + ASM_REWRITE_TAC[IN_INSERT] THEN + SIMP_TAC[ASSUME `~((a:real^M) IN b)`; SET_RULE + `~(a IN b) ==> ((a INSERT b) DELETE a = b)`] THEN + DISCH_THEN(X_CHOOSE_THEN `k:real` STRIP_ASSUME_TAC) THEN DISCH_TAC THEN + SUBGOAL_THEN `(f:real^M->real^N)(x - k % a) IN span(IMAGE f b)` MP_TAC THENL + [ASM_MESON_TAC[SPAN_LINEAR_IMAGE; IN_IMAGE]; ALL_TAC] THEN + FIRST_ASSUM(fun th -> REWRITE_TAC[MATCH_MP LINEAR_SUB th]) THEN + FIRST_ASSUM(fun th -> REWRITE_TAC[MATCH_MP LINEAR_CMUL th]) THEN + ASM_REWRITE_TAC[VECTOR_ARITH `vec 0 - k % x = (--k) % x`] THEN + ASM_CASES_TAC `k = &0` THENL + [ASM_MESON_TAC[VECTOR_ARITH `x - &0 % y = x`]; ALL_TAC] THEN + DISCH_THEN(MP_TAC o SPEC `--inv(k)` o MATCH_MP SPAN_MUL) THEN + REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LNEG; REAL_MUL_RNEG] THEN + SIMP_TAC[REAL_NEGNEG; REAL_MUL_LINV; ASSUME `~(k = &0)`] THEN + REWRITE_TAC[VECTOR_MUL_LID] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [independent]) THEN + REWRITE_TAC[dependent; NOT_EXISTS_THM] THEN + DISCH_THEN(MP_TAC o SPEC `(f:real^M->real^N) a`) THEN + SUBGOAL_THEN + `IMAGE (f:real^M->real^N) (a INSERT b) DELETE f a = + IMAGE f ((a INSERT b) DELETE a)` + SUBST1_TAC THENL + [REWRITE_TAC[EXTENSION; IN_IMAGE; IN_DELETE; IN_INSERT] THEN + ASM_MESON_TAC[IN_INSERT]; + ALL_TAC] THEN + ASM_REWRITE_TAC[DELETE_INSERT] THEN + SIMP_TAC[SET_RULE `~(a IN b) ==> (b DELETE a = b)`; + ASSUME `~(a:real^M IN b)`] THEN + SIMP_TAC[IMAGE_CLAUSES; IN_INSERT]);; + +(* ------------------------------------------------------------------------- *) +(* We can extend a linear mapping from basis. *) +(* ------------------------------------------------------------------------- *) + +let LINEAR_INDEPENDENT_EXTEND_LEMMA = prove + (`!f b. FINITE b + ==> independent b + ==> ?g:real^M->real^N. + (!x y. x IN span b /\ y IN span b + ==> (g(x + y) = g(x) + g(y))) /\ + (!x c. x IN span b ==> (g(c % x) = c % g(x))) /\ + (!x. x IN b ==> (g x = f x))`, + GEN_TAC THEN MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + REWRITE_TAC[NOT_IN_EMPTY; INDEPENDENT_INSERT] THEN CONJ_TAC THENL + [REPEAT STRIP_TAC THEN EXISTS_TAC `(\x. vec 0):real^M->real^N` THEN + SIMP_TAC[SPAN_EMPTY] THEN REPEAT STRIP_TAC THEN VECTOR_ARITH_TAC; + ALL_TAC] THEN + SIMP_TAC[] THEN MAP_EVERY X_GEN_TAC [`a:real^M`; `b:real^M->bool`] THEN + DISCH_THEN(fun th -> STRIP_TAC THEN MP_TAC th) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN(CONJUNCTS_THEN2 MP_TAC STRIP_ASSUME_TAC) THEN + DISCH_THEN(X_CHOOSE_THEN `g:real^M->real^N` STRIP_ASSUME_TAC) THEN + ABBREV_TAC `h = \z:real^M. @k. (z - k % a) IN span b` THEN + SUBGOAL_THEN `!z:real^M. z IN span(a INSERT b) + ==> (z - h(z) % a) IN span(b) /\ + !k. (z - k % a) IN span(b) ==> (k = h(z))` + MP_TAC THENL + [GEN_TAC THEN DISCH_TAC THEN + MATCH_MP_TAC(TAUT `a /\ (a ==> b) ==> a /\ b`) THEN CONJ_TAC THENL + [EXPAND_TAC "h" THEN CONV_TAC SELECT_CONV THEN + ASM_MESON_TAC[SPAN_BREAKDOWN_EQ]; + ALL_TAC] THEN + REWRITE_TAC[RIGHT_IMP_FORALL_THM; IMP_IMP] THEN GEN_TAC THEN + DISCH_THEN(MP_TAC o MATCH_MP SPAN_SUB) THEN + REWRITE_TAC[VECTOR_ARITH `(z - a % v) - (z - b % v) = (b - a) % v`] THEN + ASM_CASES_TAC `k = (h:real^M->real) z` THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN(MP_TAC o SPEC `inv(k - (h:real^M->real) z)` o + MATCH_MP SPAN_MUL) THEN + ASM_SIMP_TAC[REAL_MUL_LINV; VECTOR_MUL_ASSOC; REAL_SUB_0] THEN + ASM_REWRITE_TAC[VECTOR_MUL_LID]; + ALL_TAC] THEN + REWRITE_TAC[TAUT `(a ==> b /\ c) <=> (a ==> b) /\ (a ==> c)`] THEN + REWRITE_TAC[RIGHT_IMP_FORALL_THM; IMP_IMP] THEN + GEN_REWRITE_TAC LAND_CONV [FORALL_AND_THM] THEN STRIP_TAC THEN + EXISTS_TAC `\z:real^M. h(z) % (f:real^M->real^N)(a) + g(z - h(z) % a)` THEN + REPEAT CONJ_TAC THENL + [MAP_EVERY X_GEN_TAC [`x:real^M`; `y:real^M`] THEN STRIP_TAC THEN + SUBGOAL_THEN `(h:real^M->real)(x + y) = h(x) + h(y)` ASSUME_TAC THENL + [CONV_TAC SYM_CONV THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[VECTOR_ARITH + `(x + y) - (k + l) % a = (x - k % a) + (y - l % a)`] THEN + CONJ_TAC THEN MATCH_MP_TAC SPAN_ADD THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[]; + ALL_TAC] THEN + ASM_REWRITE_TAC[VECTOR_ARITH + `(x + y) - (k + l) % a = (x - k % a) + (y - l % a)`] THEN + ASM_SIMP_TAC[] THEN VECTOR_ARITH_TAC; + MAP_EVERY X_GEN_TAC [`x:real^M`; `c:real`] THEN STRIP_TAC THEN + SUBGOAL_THEN `(h:real^M->real)(c % x) = c * h(x)` ASSUME_TAC THENL + [CONV_TAC SYM_CONV THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[VECTOR_ARITH + `c % x - (c * k) % a = c % (x - k % a)`] THEN + CONJ_TAC THEN MATCH_MP_TAC SPAN_MUL THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[]; + ALL_TAC] THEN + ASM_REWRITE_TAC[VECTOR_ARITH + `c % x - (c * k) % a = c % (x - k % a)`] THEN + ASM_SIMP_TAC[] THEN VECTOR_ARITH_TAC; + ALL_TAC] THEN + X_GEN_TAC `x:real^M` THEN REWRITE_TAC[IN_INSERT] THEN + DISCH_THEN(DISJ_CASES_THEN2 SUBST_ALL_TAC ASSUME_TAC) THENL + [SUBGOAL_THEN `&1 = h(a:real^M)` (SUBST1_TAC o SYM) THENL + [FIRST_X_ASSUM MATCH_MP_TAC; ALL_TAC] THEN + REWRITE_TAC[VECTOR_ARITH `a - &1 % a = vec 0`; SPAN_0] THENL + [ASM_MESON_TAC[SPAN_SUPERSET; SUBSET; IN_INSERT]; ALL_TAC] THEN + FIRST_X_ASSUM(MP_TAC o SPECL [`vec 0:real^M`; `vec 0:real^M`]) THEN + REWRITE_TAC[SPAN_0; VECTOR_ADD_LID] THEN + REWRITE_TAC[VECTOR_ARITH `(a = a + a) <=> (a = vec 0)`] THEN + DISCH_THEN SUBST1_TAC THEN VECTOR_ARITH_TAC; + ALL_TAC] THEN + SUBGOAL_THEN `&0 = h(x:real^M)` (SUBST1_TAC o SYM) THENL + [FIRST_X_ASSUM MATCH_MP_TAC; ALL_TAC] THEN + REWRITE_TAC[VECTOR_ADD_LID; VECTOR_MUL_LZERO; VECTOR_SUB_RZERO] THEN + ASM_MESON_TAC[SUBSET; IN_INSERT; SPAN_SUPERSET]);; + +let LINEAR_INDEPENDENT_EXTEND = prove + (`!f b. independent b + ==> ?g:real^M->real^N. linear g /\ (!x. x IN b ==> (g x = f x))`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPECL [`b:real^M->bool`; `(:real^M)`] + MAXIMAL_INDEPENDENT_SUBSET_EXTEND) THEN + ASM_REWRITE_TAC[SUBSET_UNIV; UNIV_SUBSET] THEN + REWRITE_TAC[EXTENSION; IN_UNIV] THEN + DISCH_THEN(X_CHOOSE_THEN `c:real^M->bool` STRIP_ASSUME_TAC) THEN + MP_TAC(ISPECL [`f:real^M->real^N`; `c:real^M->bool`] + LINEAR_INDEPENDENT_EXTEND_LEMMA) THEN + ASM_SIMP_TAC[INDEPENDENT_BOUND; linear] THEN + ASM_MESON_TAC[SUBSET]);; + +(* ------------------------------------------------------------------------- *) +(* Linear functions are equal on a subspace if they are on a spanning set. *) +(* ------------------------------------------------------------------------- *) + +let SUBSPACE_KERNEL = prove + (`!f. linear f ==> subspace {x | f(x) = vec 0}`, + REWRITE_TAC[subspace; IN_ELIM_THM] THEN + SIMP_TAC[LINEAR_ADD; LINEAR_CMUL; VECTOR_ADD_LID; VECTOR_MUL_RZERO] THEN + MESON_TAC[LINEAR_0]);; + +let LINEAR_EQ_0_SPAN = prove + (`!f:real^M->real^N b. + linear f /\ (!x. x IN b ==> f(x) = vec 0) + ==> !x. x IN span(b) ==> f(x) = vec 0`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + RULE_ASSUM_TAC(REWRITE_RULE[IN]) THEN + MATCH_MP_TAC SPAN_INDUCT THEN ASM_REWRITE_TAC[IN] THEN + MP_TAC(ISPEC `f:real^M->real^N` SUBSPACE_KERNEL) THEN + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC EQ_IMP THEN + AP_TERM_TAC THEN REWRITE_TAC[EXTENSION; IN_ELIM_THM]);; + +let LINEAR_EQ_0 = prove + (`!f b s. linear f /\ s SUBSET (span b) /\ (!x. x IN b ==> f(x) = vec 0) + ==> !x. x IN s ==> f(x) = vec 0`, + MESON_TAC[LINEAR_EQ_0_SPAN; SUBSET]);; + +let LINEAR_EQ = prove + (`!f g b s. linear f /\ linear g /\ s SUBSET (span b) /\ + (!x. x IN b ==> f(x) = g(x)) + ==> !x. x IN s ==> f(x) = g(x)`, + REPEAT GEN_TAC THEN ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN + STRIP_TAC THEN MATCH_MP_TAC LINEAR_EQ_0 THEN + ASM_MESON_TAC[LINEAR_COMPOSE_SUB]);; + +let LINEAR_EQ_STDBASIS = prove + (`!f:real^M->real^N g. + linear f /\ linear g /\ + (!i. 1 <= i /\ i <= dimindex(:M) + ==> f(basis i) = g(basis i)) + ==> f = g`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `!x. x IN UNIV ==> (f:real^M->real^N) x = g x` + (fun th -> MP_TAC th THEN REWRITE_TAC[FUN_EQ_THM; IN_UNIV]) THEN + MATCH_MP_TAC LINEAR_EQ THEN + EXISTS_TAC `{basis i :real^M | 1 <= i /\ i <= dimindex(:M)}` THEN + ASM_REWRITE_TAC[SPAN_STDBASIS; SUBSET_REFL; IN_ELIM_THM] THEN + ASM_MESON_TAC[]);; + +(* ------------------------------------------------------------------------- *) +(* Similar results for bilinear functions. *) +(* ------------------------------------------------------------------------- *) + +let BILINEAR_EQ = prove + (`!f:real^M->real^N->real^P g b c s. + bilinear f /\ bilinear g /\ + s SUBSET (span b) /\ t SUBSET (span c) /\ + (!x y. x IN b /\ y IN c ==> f x y = g x y) + ==> !x y. x IN s /\ y IN t ==> f x y = g x y`, + REPEAT STRIP_TAC THEN SUBGOAL_THEN + `!x:real^M. x IN span b + ==> !y:real^N. y IN span c ==> (f x y :real^P = g x y)` + (fun th -> ASM_MESON_TAC[th; SUBSET]) THEN + MATCH_MP_TAC SPAN_INDUCT THEN REWRITE_TAC[subspace; IN_ELIM_THM] THEN + CONJ_TAC THENL + [GEN_TAC THEN DISCH_TAC; + ASM_SIMP_TAC[BILINEAR_LADD; BILINEAR_LMUL] THEN + ASM_MESON_TAC[BILINEAR_LZERO]] THEN + MATCH_MP_TAC SPAN_INDUCT THEN REWRITE_TAC[subspace; IN_ELIM_THM] THEN + ASM_SIMP_TAC[BILINEAR_RADD; BILINEAR_RMUL] THEN + ASM_MESON_TAC[BILINEAR_RZERO]);; + +let BILINEAR_EQ_STDBASIS = prove + (`!f:real^M->real^N->real^P g. + bilinear f /\ bilinear g /\ + (!i j. 1 <= i /\ i <= dimindex(:M) /\ 1 <= j /\ j <= dimindex(:N) + ==> f (basis i) (basis j) = g (basis i) (basis j)) + ==> f = g`, + REPEAT STRIP_TAC THEN SUBGOAL_THEN + `!x y. x IN UNIV /\ y IN UNIV ==> (f:real^M->real^N->real^P) x y = g x y` + (fun th -> MP_TAC th THEN REWRITE_TAC[FUN_EQ_THM; IN_UNIV]) THEN + MATCH_MP_TAC BILINEAR_EQ THEN + EXISTS_TAC `{basis i :real^M | 1 <= i /\ i <= dimindex(:M)}` THEN + EXISTS_TAC `{basis i :real^N | 1 <= i /\ i <= dimindex(:N)}` THEN + ASM_REWRITE_TAC[SPAN_STDBASIS; SUBSET_REFL; IN_ELIM_THM] THEN + ASM_MESON_TAC[]);; + +(* ------------------------------------------------------------------------- *) +(* Detailed theorems about left and right invertibility in general case. *) +(* ------------------------------------------------------------------------- *) + +let LEFT_INVERTIBLE_TRANSP = prove + (`!A:real^N^M. + (?B:real^N^M. B ** transp A = mat 1) <=> (?B:real^M^N. A ** B = mat 1)`, + MESON_TAC[MATRIX_TRANSP_MUL; TRANSP_MAT; TRANSP_TRANSP]);; + +let RIGHT_INVERTIBLE_TRANSP = prove + (`!A:real^N^M. + (?B:real^N^M. transp A ** B = mat 1) <=> (?B:real^M^N. B ** A = mat 1)`, + MESON_TAC[MATRIX_TRANSP_MUL; TRANSP_MAT; TRANSP_TRANSP]);; + +let LINEAR_INJECTIVE_LEFT_INVERSE = prove + (`!f:real^M->real^N. + linear f /\ (!x y. f x = f y ==> x = y) + ==> ?g. linear g /\ g o f = I`, + REWRITE_TAC[INJECTIVE_LEFT_INVERSE] THEN REPEAT STRIP_TAC THEN SUBGOAL_THEN + `?h. linear(h:real^N->real^M) /\ + !x. x IN IMAGE (f:real^M->real^N) + {basis i | 1 <= i /\ i <= dimindex(:M)} ==> h x = g x` + MP_TAC THENL + [MATCH_MP_TAC LINEAR_INDEPENDENT_EXTEND THEN + MATCH_MP_TAC INDEPENDENT_INJECTIVE_IMAGE THEN + ASM_MESON_TAC[INJECTIVE_LEFT_INVERSE; INDEPENDENT_STDBASIS]; + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `h:real^N->real^M` THEN + ASM_REWRITE_TAC[FORALL_IN_IMAGE; IN_ELIM_THM] THEN STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC LINEAR_EQ_STDBASIS THEN + ASM_SIMP_TAC[I_DEF; LINEAR_COMPOSE; LINEAR_ID; o_THM] THEN + ASM_MESON_TAC[]]);; + +let LINEAR_SURJECTIVE_RIGHT_INVERSE = prove + (`!f:real^M->real^N. + linear f /\ (!y. ?x. f x = y) ==> ?g. linear g /\ f o g = I`, + REWRITE_TAC[SURJECTIVE_RIGHT_INVERSE] THEN REPEAT STRIP_TAC THEN SUBGOAL_THEN + `?h. linear(h:real^N->real^M) /\ + !x. x IN {basis i | 1 <= i /\ i <= dimindex(:N)} ==> h x = g x` + MP_TAC THENL + [MATCH_MP_TAC LINEAR_INDEPENDENT_EXTEND THEN + REWRITE_TAC[INDEPENDENT_STDBASIS]; + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `h:real^N->real^M` THEN + ASM_REWRITE_TAC[FORALL_IN_IMAGE; IN_ELIM_THM] THEN STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC LINEAR_EQ_STDBASIS THEN + ASM_SIMP_TAC[I_DEF; LINEAR_COMPOSE; LINEAR_ID; o_THM] THEN + ASM_MESON_TAC[]]);; + +let MATRIX_LEFT_INVERTIBLE_INJECTIVE = prove + (`!A:real^N^M. + (?B:real^M^N. B ** A = mat 1) <=> + !x y:real^N. A ** x = A ** y ==> x = y`, + GEN_TAC THEN EQ_TAC THENL + [STRIP_TAC THEN REPEAT GEN_TAC THEN + DISCH_THEN(MP_TAC o AP_TERM `\x:real^M. (B:real^M^N) ** x`) THEN + ASM_REWRITE_TAC[MATRIX_VECTOR_MUL_ASSOC; MATRIX_VECTOR_MUL_LID]; + DISCH_TAC THEN MP_TAC(ISPEC + `\x:real^N. (A:real^N^M) ** x` LINEAR_INJECTIVE_LEFT_INVERSE) THEN + ASM_REWRITE_TAC[MATRIX_VECTOR_MUL_LINEAR; FUN_EQ_THM; I_THM; o_THM] THEN + DISCH_THEN(X_CHOOSE_THEN `g:real^M->real^N` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `matrix(g):real^M^N` THEN + REWRITE_TAC[MATRIX_EQ; MATRIX_VECTOR_MUL_LID] THEN + ASM_MESON_TAC[MATRIX_VECTOR_MUL_ASSOC; MATRIX_WORKS]]);; + +let MATRIX_LEFT_INVERTIBLE_KER = prove + (`!A:real^N^M. + (?B:real^M^N. B ** A = mat 1) <=> !x. A ** x = vec 0 ==> x = vec 0`, + GEN_TAC THEN REWRITE_TAC[MATRIX_LEFT_INVERTIBLE_INJECTIVE] THEN + MATCH_MP_TAC LINEAR_INJECTIVE_0 THEN REWRITE_TAC[MATRIX_VECTOR_MUL_LINEAR]);; + +let MATRIX_RIGHT_INVERTIBLE_SURJECTIVE = prove + (`!A:real^N^M. + (?B:real^M^N. A ** B = mat 1) <=> !y. ?x. A ** x = y`, + GEN_TAC THEN EQ_TAC THENL + [STRIP_TAC THEN X_GEN_TAC `y:real^M` THEN + EXISTS_TAC `(B:real^M^N) ** (y:real^M)` THEN + ASM_REWRITE_TAC[MATRIX_VECTOR_MUL_ASSOC; MATRIX_VECTOR_MUL_LID]; + DISCH_TAC THEN MP_TAC(ISPEC + `\x:real^N. (A:real^N^M) ** x` LINEAR_SURJECTIVE_RIGHT_INVERSE) THEN + ASM_REWRITE_TAC[MATRIX_VECTOR_MUL_LINEAR; FUN_EQ_THM; I_THM; o_THM] THEN + DISCH_THEN(X_CHOOSE_THEN `g:real^M->real^N` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `matrix(g):real^M^N` THEN + REWRITE_TAC[MATRIX_EQ; MATRIX_VECTOR_MUL_LID] THEN + ASM_MESON_TAC[MATRIX_VECTOR_MUL_ASSOC; MATRIX_WORKS]]);; + +let MATRIX_LEFT_INVERTIBLE_INDEPENDENT_COLUMNS = prove + (`!A:real^N^M. (?B:real^M^N. B ** A = mat 1) <=> + !c. vsum(1..dimindex(:N)) (\i. c(i) % column i A) = vec 0 ==> + !i. 1 <= i /\ i <= dimindex(:N) ==> c(i) = &0`, + GEN_TAC THEN REWRITE_TAC[MATRIX_LEFT_INVERTIBLE_KER; MATRIX_MUL_VSUM] THEN + EQ_TAC THEN DISCH_TAC THENL + [X_GEN_TAC `c:num->real` THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `(lambda i. c(i)):real^N`); + X_GEN_TAC `x:real^N` THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `\i. (x:real^N)$i`)] THEN + ASM_SIMP_TAC[LAMBDA_BETA; CART_EQ; VEC_COMPONENT]);; + +let MATRIX_RIGHT_INVERTIBLE_INDEPENDENT_ROWS = prove + (`!A:real^N^M. (?B:real^M^N. A ** B = mat 1) <=> + !c. vsum(1..dimindex(:M)) (\i. c(i) % row i A) = vec 0 ==> + !i. 1 <= i /\ i <= dimindex(:M) ==> c(i) = &0`, + ONCE_REWRITE_TAC[GSYM LEFT_INVERTIBLE_TRANSP] THEN + REWRITE_TAC[MATRIX_LEFT_INVERTIBLE_INDEPENDENT_COLUMNS] THEN + SIMP_TAC[COLUMN_TRANSP]);; + +let MATRIX_RIGHT_INVERTIBLE_SPAN_COLUMNS = prove + (`!A:real^N^M. (?B:real^M^N. A ** B = mat 1) <=> span(columns A) = (:real^M)`, + GEN_TAC THEN REWRITE_TAC[MATRIX_RIGHT_INVERTIBLE_SURJECTIVE] THEN + REWRITE_TAC[MATRIX_MUL_VSUM; EXTENSION; IN_UNIV] THEN + AP_TERM_TAC THEN REWRITE_TAC[FUN_EQ_THM] THEN X_GEN_TAC `y:real^M` THEN + EQ_TAC THENL + [DISCH_THEN(X_CHOOSE_THEN `x:real^N` (SUBST1_TAC o SYM)) THEN + MATCH_MP_TAC SPAN_VSUM THEN REWRITE_TAC[FINITE_NUMSEG; IN_NUMSEG] THEN + X_GEN_TAC `i:num` THEN STRIP_TAC THEN MATCH_MP_TAC SPAN_MUL THEN + MATCH_MP_TAC(CONJUNCT1 SPAN_CLAUSES) THEN + REWRITE_TAC[columns; IN_ELIM_THM] THEN ASM_MESON_TAC[]; + ALL_TAC] THEN + SPEC_TAC(`y:real^M`,`y:real^M`) THEN MATCH_MP_TAC SPAN_INDUCT_ALT THEN + CONJ_TAC THENL + [EXISTS_TAC `vec 0 :real^N` THEN + SIMP_TAC[VEC_COMPONENT; VECTOR_MUL_LZERO; VSUM_0]; + ALL_TAC] THEN + MAP_EVERY X_GEN_TAC [`c:real`; `y1:real^M`; `y2:real^M`] THEN + REWRITE_TAC[columns; IN_ELIM_THM] THEN DISCH_THEN(CONJUNCTS_THEN2 + (X_CHOOSE_THEN `i:num` STRIP_ASSUME_TAC) + (X_CHOOSE_THEN `x:real^N` (SUBST1_TAC o SYM))) THEN + EXISTS_TAC `(lambda j. if j = i then c + (x:real^N)$i else x$j):real^N` THEN + SUBGOAL_THEN `1..dimindex(:N) = i INSERT ((1..dimindex(:N)) DELETE i)` + SUBST1_TAC THENL [ASM_MESON_TAC[INSERT_DELETE; IN_NUMSEG]; ALL_TAC] THEN + SIMP_TAC[VSUM_CLAUSES; FINITE_DELETE; FINITE_NUMSEG; IN_DELETE] THEN + ASM_SIMP_TAC[LAMBDA_BETA; VECTOR_ADD_RDISTRIB; VECTOR_ADD_ASSOC] THEN + AP_TERM_TAC THEN MATCH_MP_TAC VSUM_EQ THEN + SIMP_TAC[FINITE_DELETE; IN_DELETE; FINITE_NUMSEG; LAMBDA_BETA; IN_NUMSEG]);; + +let MATRIX_LEFT_INVERTIBLE_SPAN_ROWS = prove + (`!A:real^N^M. (?B:real^M^N. B ** A = mat 1) <=> span(rows A) = (:real^N)`, + MESON_TAC[RIGHT_INVERTIBLE_TRANSP; COLUMNS_TRANSP; + MATRIX_RIGHT_INVERTIBLE_SPAN_COLUMNS]);; + +(* ------------------------------------------------------------------------- *) +(* An injective map real^N->real^N is also surjective. *) +(* ------------------------------------------------------------------------- *) + +let LINEAR_INJECTIVE_IMP_SURJECTIVE = prove + (`!f:real^N->real^N. + linear f /\ (!x y. (f(x) = f(y)) ==> (x = y)) + ==> !y. ?x. f(x) = y`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPEC `(:real^N)` BASIS_EXISTS) THEN + REWRITE_TAC[SUBSET_UNIV; HAS_SIZE] THEN + DISCH_THEN(X_CHOOSE_THEN `b:real^N->bool` STRIP_ASSUME_TAC) THEN + SUBGOAL_THEN `UNIV SUBSET span(IMAGE (f:real^N->real^N) b)` MP_TAC THENL + [MATCH_MP_TAC CARD_GE_DIM_INDEPENDENT THEN + ASM_MESON_TAC[INDEPENDENT_INJECTIVE_IMAGE; LE_REFL; + SUBSET_UNIV; CARD_IMAGE_INJ]; + ASM_SIMP_TAC[SPAN_LINEAR_IMAGE] THEN + ASM_MESON_TAC[SUBSET; IN_IMAGE; IN_UNIV]]);; + +(* ------------------------------------------------------------------------- *) +(* And vice versa. *) +(* ------------------------------------------------------------------------- *) + +let LINEAR_SURJECTIVE_IMP_INJECTIVE = prove + (`!f:real^N->real^N. + linear f /\ (!y. ?x. f(x) = y) + ==> !x y. (f(x) = f(y)) ==> (x = y)`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + MP_TAC(ISPEC `(:real^N)` BASIS_EXISTS) THEN + REWRITE_TAC[SUBSET_UNIV; HAS_SIZE] THEN + DISCH_THEN(X_CHOOSE_THEN `b:real^N->bool` STRIP_ASSUME_TAC) THEN + SUBGOAL_THEN + `!x. x IN span b ==> (f:real^N->real^N) x = vec 0 ==> x = vec 0` + (fun th -> ASM_MESON_TAC[th; LINEAR_INJECTIVE_0; SUBSET; IN_UNIV]) THEN + MATCH_MP_TAC LINEAR_INDEP_IMAGE_LEMMA THEN + ASM_REWRITE_TAC[] THEN CONJ_TAC THENL + [MATCH_MP_TAC CARD_LE_DIM_SPANNING THEN + EXISTS_TAC `(:real^N)` THEN + ASM_SIMP_TAC[SUBSET_UNIV; FINITE_IMAGE; SPAN_LINEAR_IMAGE] THEN + REWRITE_TAC[SUBSET; IN_UNIV; IN_IMAGE] THEN + ASM_MESON_TAC[CARD_IMAGE_LE; SUBSET; IN_UNIV]; + ALL_TAC] THEN + SUBGOAL_THEN `dim(:real^N) <= CARD(IMAGE (f:real^N->real^N) b)` + MP_TAC THENL + [MATCH_MP_TAC SPAN_CARD_GE_DIM THEN + ASM_SIMP_TAC[SUBSET_UNIV; FINITE_IMAGE] THEN + ASM_SIMP_TAC[SPAN_LINEAR_IMAGE] THEN MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `IMAGE (f:real^N->real^N) UNIV` THEN + ASM_SIMP_TAC[IMAGE_SUBSET] THEN + ASM_REWRITE_TAC[SUBSET; IN_IMAGE; IN_UNIV] THEN ASM_MESON_TAC[]; + ALL_TAC] THEN + FIRST_X_ASSUM(MP_TAC o ISPEC `f:real^N->real^N` o + MATCH_MP CARD_IMAGE_LE) THEN + ASM_REWRITE_TAC[IMP_IMP; LE_ANTISYM] THEN DISCH_TAC THEN + MP_TAC(ISPECL + [`b:real^N->bool`; `IMAGE (f:real^N->real^N) b`; `f:real^N->real^N`] + SURJECTIVE_IFF_INJECTIVE_GEN) THEN + ASM_SIMP_TAC[FINITE_IMAGE; INDEPENDENT_BOUND; SUBSET_REFL] THEN + REWRITE_TAC[FORALL_IN_IMAGE] THEN MESON_TAC[]);; + +let LINEAR_SURJECTIVE_IFF_INJECTIVE = prove + (`!f:real^N->real^N. + linear f ==> ((!y. ?x. f x = y) <=> (!x y. f x = f y ==> x = y))`, + MESON_TAC[LINEAR_INJECTIVE_IMP_SURJECTIVE; + LINEAR_SURJECTIVE_IMP_INJECTIVE]);; + +(* ------------------------------------------------------------------------- *) +(* Hence either is enough for isomorphism. *) +(* ------------------------------------------------------------------------- *) + +let LEFT_RIGHT_INVERSE_EQ = prove + (`!f:A->A g h. f o g = I /\ g o h = I ==> f = h`, + MESON_TAC[o_ASSOC; I_O_ID]);; + +let ISOMORPHISM_EXPAND = prove + (`!f g. f o g = I /\ g o f = I <=> (!x. f(g x) = x) /\ (!x. g(f x) = x)`, + REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM]);; + +let LINEAR_INJECTIVE_ISOMORPHISM = prove + (`!f:real^N->real^N. + linear f /\ (!x y. f x = f y ==> x = y) + ==> ?f'. linear f' /\ (!x. f'(f x) = x) /\ (!x. f(f' x) = x)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[GSYM ISOMORPHISM_EXPAND] THEN + MP_TAC(ISPEC `f:real^N->real^N` LINEAR_SURJECTIVE_RIGHT_INVERSE) THEN + MP_TAC(ISPEC `f:real^N->real^N` LINEAR_INJECTIVE_LEFT_INVERSE) THEN + MP_TAC(ISPEC `f:real^N->real^N` LINEAR_INJECTIVE_IMP_SURJECTIVE) THEN + ASM_REWRITE_TAC[] THEN SIMP_TAC[] THEN MESON_TAC[LEFT_RIGHT_INVERSE_EQ]);; + +let LINEAR_SURJECTIVE_ISOMORPHISM = prove + (`!f:real^N->real^N. + linear f /\ (!y. ?x. f x = y) + ==> ?f'. linear f' /\ (!x. f'(f x) = x) /\ (!x. f(f' x) = x)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[GSYM ISOMORPHISM_EXPAND] THEN + MP_TAC(ISPEC `f:real^N->real^N` LINEAR_SURJECTIVE_RIGHT_INVERSE) THEN + MP_TAC(ISPEC `f:real^N->real^N` LINEAR_INJECTIVE_LEFT_INVERSE) THEN + MP_TAC(ISPEC `f:real^N->real^N` LINEAR_SURJECTIVE_IMP_INJECTIVE) THEN + ASM_REWRITE_TAC[] THEN SIMP_TAC[] THEN MESON_TAC[LEFT_RIGHT_INVERSE_EQ]);; + +(* ------------------------------------------------------------------------- *) +(* Left and right inverses are the same for R^N->R^N. *) +(* ------------------------------------------------------------------------- *) + +let LINEAR_INVERSE_LEFT = prove + (`!f:real^N->real^N f'. + linear f /\ linear f' ==> ((f o f' = I) <=> (f' o f = I))`, + SUBGOAL_THEN + `!f:real^N->real^N f'. + linear f /\ linear f' /\ (f o f' = I) ==> (f' o f = I)` + (fun th -> MESON_TAC[th]) THEN + REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM] THEN REPEAT STRIP_TAC THEN + MP_TAC(ISPEC `f:real^N->real^N` LINEAR_SURJECTIVE_ISOMORPHISM) THEN + ASM_MESON_TAC[]);; + +(* ------------------------------------------------------------------------- *) +(* Moreover, a one-sided inverse is automatically linear. *) +(* ------------------------------------------------------------------------- *) + +let LEFT_INVERSE_LINEAR = prove + (`!f g:real^N->real^N. linear f /\ (g o f = I) ==> linear g`, + REPEAT GEN_TAC THEN REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM] THEN + STRIP_TAC THEN SUBGOAL_THEN + `?h:real^N->real^N. linear h /\ (!x. h(f x) = x) /\ (!x. f(h x) = x)` + CHOOSE_TAC THENL + [MATCH_MP_TAC LINEAR_INJECTIVE_ISOMORPHISM THEN ASM_MESON_TAC[]; + SUBGOAL_THEN `g:real^N->real^N = h` (fun th -> ASM_REWRITE_TAC[th]) THEN + REWRITE_TAC[FUN_EQ_THM] THEN ASM_MESON_TAC[]]);; + +let RIGHT_INVERSE_LINEAR = prove + (`!f g:real^N->real^N. linear f /\ (f o g = I) ==> linear g`, + REPEAT GEN_TAC THEN REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM] THEN + STRIP_TAC THEN SUBGOAL_THEN + `?h:real^N->real^N. linear h /\ (!x. h(f x) = x) /\ (!x. f(h x) = x)` + CHOOSE_TAC THENL [ASM_MESON_TAC[LINEAR_SURJECTIVE_ISOMORPHISM]; ALL_TAC] THEN + SUBGOAL_THEN `g:real^N->real^N = h` (fun th -> ASM_REWRITE_TAC[th]) THEN + REWRITE_TAC[FUN_EQ_THM] THEN ASM_MESON_TAC[]);; + +(* ------------------------------------------------------------------------- *) +(* Without (ostensible) constraints on types, though dimensions must match. *) +(* ------------------------------------------------------------------------- *) + +let LEFT_RIGHT_INVERSE_LINEAR = prove + (`!f g:real^M->real^N. + linear f /\ g o f = I /\ f o g = I ==> linear g`, + REWRITE_TAC[linear; FUN_EQ_THM; o_THM; I_THM] THEN MESON_TAC[]);; + +let LINEAR_BIJECTIVE_LEFT_RIGHT_INVERSE = prove + (`!f:real^M->real^N. + linear f /\ (!x y. f x = f y ==> x = y) /\ (!y. ?x. f x = y) + ==> ?g. linear g /\ (!x. g(f x) = x) /\ (!y. f(g y) = y)`, + GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN ASSUME_TAC) THEN + FIRST_ASSUM(MP_TAC o GEN_REWRITE_RULE I [BIJECTIVE_LEFT_RIGHT_INVERSE]) THEN + MATCH_MP_TAC MONO_EXISTS THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC LEFT_RIGHT_INVERSE_LINEAR THEN + EXISTS_TAC `f:real^M->real^N` THEN + ASM_REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM]);; + +(* ------------------------------------------------------------------------- *) +(* The same result in terms of square matrices. *) +(* ------------------------------------------------------------------------- *) + +let MATRIX_LEFT_RIGHT_INVERSE = prove + (`!A:real^N^N A':real^N^N. (A ** A' = mat 1) <=> (A' ** A = mat 1)`, + SUBGOAL_THEN + `!A:real^N^N A':real^N^N. (A ** A' = mat 1) ==> (A' ** A = mat 1)` + (fun th -> MESON_TAC[th]) THEN + REPEAT STRIP_TAC THEN + MP_TAC(ISPEC `\x:real^N. A:(real^N^N) ** x` + LINEAR_SURJECTIVE_ISOMORPHISM) THEN + REWRITE_TAC[MATRIX_VECTOR_MUL_LINEAR] THEN ANTS_TAC THENL + [X_GEN_TAC `x:real^N` THEN EXISTS_TAC `(A':real^N^N) ** (x:real^N)` THEN + ASM_REWRITE_TAC[MATRIX_VECTOR_MUL_ASSOC; MATRIX_VECTOR_MUL_LID]; + ALL_TAC] THEN + DISCH_THEN(X_CHOOSE_THEN `f':real^N->real^N` STRIP_ASSUME_TAC) THEN + SUBGOAL_THEN `matrix (f':real^N->real^N) ** (A:real^N^N) = mat 1` + MP_TAC THENL + [ASM_SIMP_TAC[MATRIX_EQ; MATRIX_WORKS; GSYM MATRIX_VECTOR_MUL_ASSOC; + MATRIX_VECTOR_MUL_LID]; + ALL_TAC] THEN + DISCH_THEN(fun th -> ASSUME_TAC th THEN MP_TAC th) THEN + DISCH_THEN(MP_TAC o AP_TERM `(\m:real^N^N. m ** (A':real^N^N))`) THEN + REWRITE_TAC[GSYM MATRIX_MUL_ASSOC] THEN + ASM_REWRITE_TAC[MATRIX_MUL_RID; MATRIX_MUL_LID] THEN ASM_MESON_TAC[]);; + +(* ------------------------------------------------------------------------- *) +(* Invertibility of matrices and corresponding linear functions. *) +(* ------------------------------------------------------------------------- *) + +let MATRIX_LEFT_INVERTIBLE = prove + (`!f:real^M->real^N. + linear f ==> ((?B:real^N^M. B ** matrix f = mat 1) <=> + (?g. linear g /\ g o f = I))`, + GEN_TAC THEN DISCH_TAC THEN EQ_TAC THEN STRIP_TAC THENL + [EXISTS_TAC `\y:real^N. (B:real^N^M) ** y` THEN + REWRITE_TAC[MATRIX_VECTOR_MUL_LINEAR] THEN + FIRST_X_ASSUM(fun th -> GEN_REWRITE_TAC (LAND_CONV o RAND_CONV) + [MATCH_MP MATRIX_VECTOR_MUL th]) THEN + ASM_REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM; MATRIX_VECTOR_MUL_ASSOC; + MATRIX_VECTOR_MUL_LID]; + EXISTS_TAC `matrix(g:real^N->real^M)` THEN + ASM_SIMP_TAC[GSYM MATRIX_COMPOSE; MATRIX_I]]);; + +let MATRIX_RIGHT_INVERTIBLE = prove + (`!f:real^M->real^N. + linear f ==> ((?B:real^N^M. matrix f ** B = mat 1) <=> + (?g. linear g /\ f o g = I))`, + GEN_TAC THEN DISCH_TAC THEN EQ_TAC THEN STRIP_TAC THENL + [EXISTS_TAC `\y:real^N. (B:real^N^M) ** y` THEN + REWRITE_TAC[MATRIX_VECTOR_MUL_LINEAR] THEN + FIRST_X_ASSUM(fun th -> GEN_REWRITE_TAC (LAND_CONV o LAND_CONV) + [MATCH_MP MATRIX_VECTOR_MUL th]) THEN + ASM_REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM; MATRIX_VECTOR_MUL_ASSOC; + MATRIX_VECTOR_MUL_LID]; + EXISTS_TAC `matrix(g:real^N->real^M)` THEN + ASM_SIMP_TAC[GSYM MATRIX_COMPOSE; MATRIX_I]]);; + +let INVERTIBLE_LEFT_INVERSE = prove + (`!A:real^N^N. invertible(A) <=> ?B:real^N^N. B ** A = mat 1`, + MESON_TAC[invertible; MATRIX_LEFT_RIGHT_INVERSE]);; + +let INVERTIBLE_RIGHT_INVERSE = prove + (`!A:real^N^N. invertible(A) <=> ?B:real^N^N. A ** B = mat 1`, + MESON_TAC[invertible; MATRIX_LEFT_RIGHT_INVERSE]);; + +let MATRIX_INVERTIBLE = prove + (`!f:real^N->real^N. + linear f + ==> (invertible(matrix f) <=> + ?g. linear g /\ f o g = I /\ g o f = I)`, + SIMP_TAC[INVERTIBLE_LEFT_INVERSE; MATRIX_LEFT_INVERTIBLE] THEN + MESON_TAC[LINEAR_INVERSE_LEFT]);; + +(* ------------------------------------------------------------------------- *) +(* Left-invertible linear transformation has a lower bound. *) +(* ------------------------------------------------------------------------- *) + +let LINEAR_INVERTIBLE_BOUNDED_BELOW_POS = prove + (`!f:real^M->real^N g. + linear f /\ linear g /\ (g o f = I) + ==> ?B. &0 < B /\ !x. B * norm(x) <= norm(f x)`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPEC `g:real^N->real^M` LINEAR_BOUNDED_POS) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN(X_CHOOSE_THEN `B:real` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `inv B:real` THEN ASM_REWRITE_TAC[REAL_LT_INV_EQ] THEN + X_GEN_TAC `x:real^M` THEN MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `inv(B) * norm(((g:real^N->real^M) o (f:real^M->real^N)) x)` THEN + CONJ_TAC THENL [ASM_SIMP_TAC[I_THM; REAL_LE_REFL]; ALL_TAC] THEN + REWRITE_TAC[REAL_ARITH `inv B * x = x / B`] THEN + ASM_SIMP_TAC[o_THM; REAL_LE_LDIV_EQ] THEN + ONCE_REWRITE_TAC[REAL_MUL_SYM] THEN ASM_REWRITE_TAC[]);; + +let LINEAR_INVERTIBLE_BOUNDED_BELOW = prove + (`!f:real^M->real^N g. + linear f /\ linear g /\ (g o f = I) + ==> ?B. !x. B * norm(x) <= norm(f x)`, + MESON_TAC[LINEAR_INVERTIBLE_BOUNDED_BELOW_POS]);; + +let LINEAR_INJECTIVE_BOUNDED_BELOW_POS = prove + (`!f:real^M->real^N. + linear f /\ (!x y. f x = f y ==> x = y) + ==> ?B. &0 < B /\ !x. norm(x) * B <= norm(f x)`, + REPEAT STRIP_TAC THEN ONCE_REWRITE_TAC[REAL_MUL_SYM] THEN + MATCH_MP_TAC LINEAR_INVERTIBLE_BOUNDED_BELOW_POS THEN + ASM_MESON_TAC[LINEAR_INJECTIVE_LEFT_INVERSE]);; + +(* ------------------------------------------------------------------------- *) +(* Preservation of dimension by injective map. *) +(* ------------------------------------------------------------------------- *) + +let DIM_INJECTIVE_LINEAR_IMAGE = prove + (`!f:real^M->real^N s. + linear f /\ (!x y. f x = f y ==> x = y) ==> dim(IMAGE f s) = dim s`, + REPEAT STRIP_TAC THEN REWRITE_TAC[GSYM LE_ANTISYM] THEN + CONJ_TAC THENL [ASM_MESON_TAC[DIM_LINEAR_IMAGE_LE]; ALL_TAC] THEN + MP_TAC(ISPEC `f:real^M->real^N` LINEAR_INJECTIVE_LEFT_INVERSE) THEN + ASM_REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM] THEN + DISCH_THEN(X_CHOOSE_THEN `g:real^N->real^M` STRIP_ASSUME_TAC) THEN + MATCH_MP_TAC LE_TRANS THEN + EXISTS_TAC `dim(IMAGE (g:real^N->real^M) (IMAGE (f:real^M->real^N) s))` THEN + CONJ_TAC THENL + [ASM_REWRITE_TAC[GSYM IMAGE_o; o_DEF; IMAGE_ID; LE_REFL]; + MATCH_MP_TAC DIM_LINEAR_IMAGE_LE THEN ASM_REWRITE_TAC[]]);; + +(* ------------------------------------------------------------------------- *) +(* Considering an n-element vector as an n-by-1 or 1-by-n matrix. *) +(* ------------------------------------------------------------------------- *) + +let rowvector = new_definition + `(rowvector:real^N->real^N^1) v = lambda i j. v$j`;; + +let columnvector = new_definition + `(columnvector:real^N->real^1^N) v = lambda i j. v$i`;; + +let TRANSP_COLUMNVECTOR = prove + (`!v. transp(columnvector v) = rowvector v`, + SIMP_TAC[transp; columnvector; rowvector; CART_EQ; LAMBDA_BETA]);; + +let TRANSP_ROWVECTOR = prove + (`!v. transp(rowvector v) = columnvector v`, + SIMP_TAC[transp; columnvector; rowvector; CART_EQ; LAMBDA_BETA]);; + +let DOT_ROWVECTOR_COLUMNVECTOR = prove + (`!A:real^N^M v:real^N. columnvector(A ** v) = A ** columnvector v`, + REWRITE_TAC[rowvector; columnvector; matrix_mul; matrix_vector_mul] THEN + SIMP_TAC[CART_EQ; LAMBDA_BETA]);; + +let DOT_MATRIX_PRODUCT = prove + (`!x y:real^N. x dot y = (rowvector x ** columnvector y)$1$1`, + REWRITE_TAC[matrix_mul; columnvector; rowvector; dot] THEN + SIMP_TAC[LAMBDA_BETA; DIMINDEX_1; LE_REFL]);; + +let DOT_MATRIX_VECTOR_MUL = prove + (`!A:real^N^N B:real^N^N x:real^N y:real^N. + (A ** x) dot (B ** y) = + ((rowvector x) ** (transp(A) ** B) ** (columnvector y))$1$1`, + REWRITE_TAC[DOT_MATRIX_PRODUCT] THEN + ONCE_REWRITE_TAC[GSYM TRANSP_COLUMNVECTOR] THEN + REWRITE_TAC[DOT_ROWVECTOR_COLUMNVECTOR; MATRIX_TRANSP_MUL] THEN + REWRITE_TAC[MATRIX_MUL_ASSOC]);; + +(* ------------------------------------------------------------------------- *) +(* Rank of a matrix. Equivalence of row and column rank is taken from *) +(* George Mackiw's paper, Mathematics Magazine 1995, p. 285. *) +(* ------------------------------------------------------------------------- *) + +let MATRIX_VECTOR_MUL_IN_COLUMNSPACE = prove + (`!A:real^M^N x:real^M. (A ** x) IN span(columns A)`, + REPEAT GEN_TAC THEN REWRITE_TAC[MATRIX_VECTOR_COLUMN; columns] THEN + MATCH_MP_TAC SPAN_VSUM THEN + SIMP_TAC[FINITE_NUMSEG; IN_NUMSEG; transp; LAMBDA_BETA] THEN + X_GEN_TAC `k:num` THEN STRIP_TAC THEN MATCH_MP_TAC SPAN_MUL THEN + MATCH_MP_TAC SPAN_SUPERSET THEN + REWRITE_TAC[IN_ELIM_THM; column] THEN EXISTS_TAC `k:num` THEN + ASM_REWRITE_TAC[]);; + +let SUBSPACE_ORTHOGONAL_TO_VECTOR = prove + (`!x. subspace {y | orthogonal x y}`, + SIMP_TAC[subspace; IN_ELIM_THM; ORTHOGONAL_CLAUSES]);; + +let SUBSPACE_ORTHOGONAL_TO_VECTORS = prove + (`!s. subspace {y | (!x. x IN s ==> orthogonal x y)}`, + SIMP_TAC[subspace; IN_ELIM_THM; ORTHOGONAL_CLAUSES]);; + +let ORTHOGONAL_TO_SPAN = prove + (`!s x. (!y. y IN s ==> orthogonal x y) + ==> !y. y IN span(s) ==> orthogonal x y`, + REPEAT GEN_TAC THEN DISCH_TAC THEN MATCH_MP_TAC SPAN_INDUCT THEN + REWRITE_TAC[SET_RULE `(\y. orthogonal x y) = {y | orthogonal x y}`] THEN + ASM_SIMP_TAC[SUBSPACE_ORTHOGONAL_TO_VECTOR; IN_ELIM_THM]);; + +let ORTHOGONAL_TO_SPAN_EQ = prove + (`!s x. (!y. y IN span(s) ==> orthogonal x y) <=> + (!y. y IN s ==> orthogonal x y)`, + MESON_TAC[SPAN_SUPERSET; ORTHOGONAL_TO_SPAN]);; + +let ORTHOGONAL_TO_SPANS_EQ = prove + (`!s t. (!x y. x IN span(s) /\ y IN span(t) ==> orthogonal x y) <=> + (!x y. x IN s /\ y IN t ==> orthogonal x y)`, + MESON_TAC[ORTHOGONAL_TO_SPAN_EQ; ORTHOGONAL_SYM]);; + +let ORTHOGONAL_NULLSPACE_ROWSPACE = prove + (`!A:real^M^N x y:real^M. + A ** x = vec 0 /\ y IN span(rows A) ==> orthogonal x y`, + REWRITE_TAC[IMP_CONJ; RIGHT_FORALL_IMP_THM] THEN + REPEAT GEN_TAC THEN DISCH_TAC THEN MATCH_MP_TAC SPAN_INDUCT THEN + REWRITE_TAC[SET_RULE `(\y. orthogonal x y) = {y | orthogonal x y}`] THEN + REWRITE_TAC[SUBSPACE_ORTHOGONAL_TO_VECTOR; rows; FORALL_IN_GSPEC] THEN + X_GEN_TAC `k:num` THEN STRIP_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN + FIRST_X_ASSUM(MP_TAC o AP_TERM `\y:real^N. y$k`) THEN + ASM_SIMP_TAC[MATRIX_VECTOR_MUL_COMPONENT; VEC_COMPONENT; row; dot; + orthogonal; LAMBDA_BETA] THEN + REWRITE_TAC[REAL_MUL_SYM]);; + +let NULLSPACE_INTER_ROWSPACE = prove + (`!A:real^M^N x:real^M. A ** x = vec 0 /\ x IN span(rows A) <=> x = vec 0`, + REPEAT GEN_TAC THEN EQ_TAC THENL + [MESON_TAC[ORTHOGONAL_NULLSPACE_ROWSPACE; ORTHOGONAL_REFL]; + SIMP_TAC[MATRIX_VECTOR_MUL_RZERO; SPAN_0]]);; + +let MATRIX_VECTOR_MUL_INJECTIVE_ON_ROWSPACE = prove + (`!A:real^M^N x y:real^M. + x IN span(rows A) /\ y IN span(rows A) /\ A ** x = A ** y ==> x = y`, + ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN + REWRITE_TAC[GSYM MATRIX_VECTOR_MUL_SUB_LDISTRIB] THEN + REPEAT STRIP_TAC THEN ONCE_REWRITE_TAC[GSYM NULLSPACE_INTER_ROWSPACE] THEN + ASM_SIMP_TAC[SPAN_SUB]);; + +let DIM_ROWS_LE_DIM_COLUMNS = prove + (`!A:real^M^N. dim(rows A) <= dim(columns A)`, + REPEAT STRIP_TAC THEN ONCE_REWRITE_TAC[GSYM DIM_SPAN] THEN + X_CHOOSE_THEN `b:real^M->bool` STRIP_ASSUME_TAC + (ISPEC `span(rows(A:real^M^N))` BASIS_EXISTS) THEN + SUBGOAL_THEN `FINITE(IMAGE (\x:real^M. (A:real^M^N) ** x) b) /\ + CARD (IMAGE (\x:real^M. (A:real^M^N) ** x) b) <= + dim(span(columns A))` + MP_TAC THENL + [MATCH_MP_TAC INDEPENDENT_CARD_LE_DIM THEN + REWRITE_TAC[SUBSET; FORALL_IN_IMAGE; MATRIX_VECTOR_MUL_IN_COLUMNSPACE] THEN + MATCH_MP_TAC INDEPENDENT_INJECTIVE_IMAGE_GEN THEN + ASM_REWRITE_TAC[MATRIX_VECTOR_MUL_LINEAR] THEN + SUBGOAL_THEN `span(b) = span(rows(A:real^M^N))` SUBST1_TAC THENL + [ALL_TAC; ASM_MESON_TAC[MATRIX_VECTOR_MUL_INJECTIVE_ON_ROWSPACE]] THEN + MATCH_MP_TAC SUBSET_ANTISYM THEN ASM_REWRITE_TAC[] THEN + GEN_REWRITE_TAC RAND_CONV [GSYM SPAN_SPAN] THEN + ASM_SIMP_TAC[SPAN_MONO]; + DISCH_THEN(MP_TAC o CONJUNCT2) THEN MATCH_MP_TAC EQ_IMP THEN + AP_THM_TAC THEN AP_TERM_TAC THEN + FIRST_ASSUM(CONJUNCTS_THEN2 ASSUME_TAC (SUBST1_TAC o SYM) o + GEN_REWRITE_RULE I [HAS_SIZE]) THEN + MATCH_MP_TAC CARD_IMAGE_INJ THEN ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC + (ISPEC `A:real^M^N` MATRIX_VECTOR_MUL_INJECTIVE_ON_ROWSPACE) THEN + ASM SET_TAC[]]);; + +let rank = new_definition + `rank(A:real^M^N) = dim(columns A)`;; + +let RANK_ROW = prove + (`!A:real^M^N. rank(A) = dim(rows A)`, + GEN_TAC THEN REWRITE_TAC[rank] THEN + MP_TAC(ISPEC `A:real^M^N` DIM_ROWS_LE_DIM_COLUMNS) THEN + MP_TAC(ISPEC `transp(A:real^M^N)` DIM_ROWS_LE_DIM_COLUMNS) THEN + REWRITE_TAC[ROWS_TRANSP; COLUMNS_TRANSP] THEN ARITH_TAC);; + +let RANK_TRANSP = prove + (`!A:real^M^N. rank(transp A) = rank A`, + GEN_TAC THEN GEN_REWRITE_TAC RAND_CONV [RANK_ROW] THEN + REWRITE_TAC[rank; COLUMNS_TRANSP]);; + +let MATRIX_VECTOR_MUL_BASIS = prove + (`!A:real^M^N k. 1 <= k /\ k <= dimindex(:M) + ==> A ** (basis k) = column k A`, + SIMP_TAC[CART_EQ; column; MATRIX_VECTOR_MUL_COMPONENT; DOT_BASIS; + LAMBDA_BETA]);; + +let COLUMNS_IMAGE_BASIS = prove + (`!A:real^M^N. + columns A = IMAGE (\x. A ** x) {basis i | 1 <= i /\ i <= dimindex(:M)}`, + GEN_TAC THEN REWRITE_TAC[columns] THEN + ONCE_REWRITE_TAC[SIMPLE_IMAGE_GEN] THEN + REWRITE_TAC[GSYM IMAGE_o; o_DEF] THEN + MATCH_MP_TAC(SET_RULE + `(!x. x IN s ==> f x = g x) ==> IMAGE f s = IMAGE g s`) THEN + SIMP_TAC[IN_ELIM_THM; MATRIX_VECTOR_MUL_BASIS]);; + +let RANK_DIM_IM = prove + (`!A:real^M^N. rank A = dim(IMAGE (\x. A ** x) (:real^M))`, + GEN_TAC THEN REWRITE_TAC[rank] THEN + MATCH_MP_TAC SPAN_EQ_DIM THEN REWRITE_TAC[COLUMNS_IMAGE_BASIS] THEN + SIMP_TAC[SPAN_LINEAR_IMAGE; MATRIX_VECTOR_MUL_LINEAR] THEN + AP_TERM_TAC THEN GEN_REWRITE_TAC LAND_CONV [GSYM SPAN_SPAN] THEN + REWRITE_TAC[SPAN_STDBASIS]);; + +let DIM_EQ_SPAN = prove + (`!s t:real^N->bool. s SUBSET t /\ dim t <= dim s ==> span s = span t`, + REPEAT STRIP_TAC THEN + X_CHOOSE_THEN `b:real^N->bool` STRIP_ASSUME_TAC + (ISPEC `span s:real^N->bool` BASIS_EXISTS) THEN + MP_TAC(ISPECL [`span t:real^N->bool`; `b:real^N->bool`] + CARD_GE_DIM_INDEPENDENT) THEN + RULE_ASSUM_TAC(REWRITE_RULE[HAS_SIZE]) THEN + ASM_REWRITE_TAC[DIM_SPAN] THEN + ASM_MESON_TAC[SPAN_MONO; SPAN_SPAN; SUBSET_TRANS; SUBSET_ANTISYM]);; + +let DIM_EQ_FULL = prove + (`!s:real^N->bool. dim s = dimindex(:N) <=> span s = (:real^N)`, + GEN_TAC THEN ONCE_REWRITE_TAC[GSYM DIM_SPAN] THEN EQ_TAC THEN + SIMP_TAC[DIM_UNIV] THEN DISCH_TAC THEN + GEN_REWRITE_TAC RAND_CONV [GSYM SPAN_UNIV] THEN MATCH_MP_TAC DIM_EQ_SPAN THEN + ASM_REWRITE_TAC[SUBSET_UNIV; DIM_UNIV] THEN + ASM_MESON_TAC[LE_REFL; DIM_SPAN]);; + +let DIM_PSUBSET = prove + (`!s t. (span s) PSUBSET (span t) ==> dim s < dim t`, + ONCE_REWRITE_TAC[GSYM DIM_SPAN] THEN + SIMP_TAC[PSUBSET; DIM_SUBSET; LT_LE] THEN + MESON_TAC[EQ_IMP_LE; DIM_EQ_SPAN; SPAN_SPAN]);; + +let RANK_BOUND = prove + (`!A:real^M^N. rank(A) <= MIN (dimindex(:M)) (dimindex(:N))`, + GEN_TAC THEN REWRITE_TAC[ARITH_RULE `x <= MIN a b <=> x <= a /\ x <= b`] THEN + CONJ_TAC THENL + [REWRITE_TAC[DIM_SUBSET_UNIV; RANK_ROW]; + REWRITE_TAC[DIM_SUBSET_UNIV; rank]]);; + +let FULL_RANK_INJECTIVE = prove + (`!A:real^M^N. + rank A = dimindex(:M) <=> + (!x y:real^M. A ** x = A ** y ==> x = y)`, + REWRITE_TAC[GSYM MATRIX_LEFT_INVERTIBLE_INJECTIVE] THEN + REWRITE_TAC[MATRIX_LEFT_INVERTIBLE_SPAN_ROWS] THEN + REWRITE_TAC[RANK_ROW; DIM_EQ_FULL]);; + +let FULL_RANK_SURJECTIVE = prove + (`!A:real^M^N. + rank A = dimindex(:N) <=> (!y:real^N. ?x:real^M. A ** x = y)`, + REWRITE_TAC[GSYM MATRIX_RIGHT_INVERTIBLE_SURJECTIVE] THEN + REWRITE_TAC[GSYM LEFT_INVERTIBLE_TRANSP] THEN + REWRITE_TAC[MATRIX_LEFT_INVERTIBLE_INJECTIVE] THEN + REWRITE_TAC[GSYM FULL_RANK_INJECTIVE; RANK_TRANSP]);; + +let MATRIX_FULL_LINEAR_EQUATIONS = prove + (`!A:real^M^N b:real^N. + rank A = dimindex(:N) ==> ?x. A ** x = b`, + SIMP_TAC[FULL_RANK_SURJECTIVE]);; + +let MATRIX_NONFULL_LINEAR_EQUATIONS_EQ = prove + (`!A:real^M^N. + (?x. ~(x = vec 0) /\ A ** x = vec 0) <=> ~(rank A = dimindex(:M))`, + REPEAT GEN_TAC THEN REWRITE_TAC[FULL_RANK_INJECTIVE] THEN + SIMP_TAC[LINEAR_INJECTIVE_0; MATRIX_VECTOR_MUL_LINEAR] THEN + MESON_TAC[]);; + +let MATRIX_NONFULL_LINEAR_EQUATIONS = prove + (`!A:real^M^N. + ~(rank A = dimindex(:M)) ==> ?x. ~(x = vec 0) /\ A ** x = vec 0`, + REWRITE_TAC[MATRIX_NONFULL_LINEAR_EQUATIONS_EQ]);; + +let MATRIX_TRIVIAL_LINEAR_EQUATIONS = prove + (`!A:real^M^N. + dimindex(:N) < dimindex(:M) + ==> ?x. ~(x = vec 0) /\ A ** x = vec 0`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC MATRIX_NONFULL_LINEAR_EQUATIONS THEN + MATCH_MP_TAC(ARITH_RULE + `!a. x <= MIN b a /\ a < b ==> ~(x = b)`) THEN + EXISTS_TAC `dimindex(:N)` THEN ASM_REWRITE_TAC[RANK_BOUND]);; + +let RANK_EQ_0 = prove + (`!A:real^M^N. rank A = 0 <=> A = mat 0`, + REWRITE_TAC[RANK_DIM_IM; DIM_EQ_0; SUBSET; FORALL_IN_IMAGE; IN_SING; + IN_UNIV] THEN + GEN_TAC THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [CART_EQ] THEN + SIMP_TAC[CART_EQ; MATRIX_MUL_DOT; VEC_COMPONENT; LAMBDA_BETA; mat] THEN + ONCE_REWRITE_TAC[SWAP_FORALL_THM] THEN + REWRITE_TAC[RIGHT_FORALL_IMP_THM; FORALL_DOT_EQ_0; COND_ID] THEN + REWRITE_TAC[CART_EQ; VEC_COMPONENT]);; + +let RANK_0 = prove + (`rank(mat 0) = 0`, + REWRITE_TAC[RANK_EQ_0]);; + +let RANK_MUL_LE_RIGHT = prove + (`!A:real^N^M B:real^P^N. rank(A ** B) <= rank(B)`, + REPEAT GEN_TAC THEN MATCH_MP_TAC LE_TRANS THEN + EXISTS_TAC `dim(IMAGE (\y. (A:real^N^M) ** y) + (IMAGE (\x. (B:real^P^N) ** x) (:real^P)))` THEN + REWRITE_TAC[RANK_DIM_IM] THEN CONJ_TAC THENL + [REWRITE_TAC[GSYM IMAGE_o; o_DEF; MATRIX_VECTOR_MUL_ASSOC; LE_REFL]; + MATCH_MP_TAC DIM_LINEAR_IMAGE_LE THEN + REWRITE_TAC[MATRIX_VECTOR_MUL_LINEAR]]);; + +let RANK_MUL_LE_LEFT = prove + (`!A:real^N^M B:real^P^N. rank(A ** B) <= rank(A)`, + ONCE_REWRITE_TAC[GSYM RANK_TRANSP] THEN + REWRITE_TAC[MATRIX_TRANSP_MUL] THEN + REWRITE_TAC[RANK_MUL_LE_RIGHT]);; + +(* ------------------------------------------------------------------------- *) +(* A non-injective linear function maps into a hyperplane. *) +(* ------------------------------------------------------------------------- *) + +let ADJOINT_INJECTIVE = prove + (`!f:real^M->real^N. + linear f + ==> ((!x y. adjoint f x = adjoint f y ==> x = y) <=> + (!y. ?x. f x = y))`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM(ASSUME_TAC o GSYM o MATCH_MP MATRIX_WORKS o MATCH_MP + ADJOINT_LINEAR) THEN + FIRST_ASSUM(ASSUME_TAC o GSYM o MATCH_MP MATRIX_WORKS) THEN + ASM_REWRITE_TAC[GSYM FULL_RANK_INJECTIVE; GSYM FULL_RANK_SURJECTIVE] THEN + ASM_SIMP_TAC[MATRIX_ADJOINT; RANK_TRANSP]);; + +let ADJOINT_SURJECTIVE = prove + (`!f:real^M->real^N. + linear f + ==> ((!y. ?x. adjoint f x = y) <=> (!x y. f x = f y ==> x = y))`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM(fun th -> GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) + [GSYM(MATCH_MP ADJOINT_ADJOINT th)]) THEN + ASM_SIMP_TAC[ADJOINT_INJECTIVE; ADJOINT_LINEAR]);; + +let ADJOINT_INJECTIVE_INJECTIVE = prove + (`!f:real^N->real^N. + linear f + ==> ((!x y. adjoint f x = adjoint f y ==> x = y) <=> + (!x y. f x = f y ==> x = y))`, + SIMP_TAC[ADJOINT_INJECTIVE] THEN + MESON_TAC[LINEAR_INJECTIVE_IMP_SURJECTIVE; + LINEAR_SURJECTIVE_IMP_INJECTIVE]);; + +let ADJOINT_INJECTIVE_INJECTIVE_0 = prove + (`!f:real^N->real^N. + linear f + ==> ((!x. adjoint f x = vec 0 ==> x = vec 0) <=> + (!x. f x = vec 0 ==> x = vec 0))`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM(MP_TAC o MATCH_MP ADJOINT_INJECTIVE_INJECTIVE) THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP ADJOINT_LINEAR) THEN + ASM_MESON_TAC[LINEAR_INJECTIVE_0]);; + +let LINEAR_SINGULAR_INTO_HYPERPLANE = prove + (`!f:real^N->real^N. + linear f + ==> (~(!x y. f(x) = f(y) ==> x = y) <=> + ?a. ~(a = vec 0) /\ !x. a dot f(x) = &0)`, + REPEAT STRIP_TAC THEN ONCE_REWRITE_TAC[DOT_SYM] THEN + ASM_SIMP_TAC[ADJOINT_WORKS; FORALL_DOT_EQ_0] THEN + REWRITE_TAC[MESON[] `(?a. ~p a /\ q a) <=> ~(!a. q a ==> p a)`] THEN + ASM_SIMP_TAC[ADJOINT_INJECTIVE_INJECTIVE_0; LINEAR_INJECTIVE_0]);; + +let LINEAR_SINGULAR_IMAGE_HYPERPLANE = prove + (`!f:real^N->real^N. + linear f /\ ~(!x y. f(x) = f(y) ==> x = y) + ==> ?a. ~(a = vec 0) /\ !s. IMAGE f s SUBSET {x | a dot x = &0}`, + GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + ASM_SIMP_TAC[LINEAR_SINGULAR_INTO_HYPERPLANE] THEN + SIMP_TAC[SUBSET; FORALL_IN_IMAGE; IN_ELIM_THM] THEN MESON_TAC[]);; + +let LOWDIM_EXPAND_DIMENSION = prove + (`!s:real^N->bool n. + dim s <= n /\ n <= dimindex(:N) + ==> ?t. dim(t) = n /\ span s SUBSET span t`, + GEN_TAC THEN + GEN_REWRITE_TAC (BINDER_CONV o LAND_CONV o LAND_CONV) [LE_EXISTS] THEN + SIMP_TAC[LEFT_AND_EXISTS_THM; LEFT_IMP_EXISTS_THM; IMP_CONJ] THEN + ONCE_REWRITE_TAC[SWAP_FORALL_THM] THEN + REWRITE_TAC[RIGHT_FORALL_IMP_THM; LEFT_FORALL_IMP_THM; EXISTS_REFL] THEN + INDUCT_TAC THENL [MESON_TAC[ADD_CLAUSES; SUBSET_REFL]; ALL_TAC] THEN + REWRITE_TAC[ARITH_RULE `s + SUC d <= n <=> s + d < n`] THEN + DISCH_TAC THEN FIRST_X_ASSUM(MP_TAC o check (is_imp o concl)) THEN + ASM_SIMP_TAC[LT_IMP_LE; LEFT_IMP_EXISTS_THM] THEN + X_GEN_TAC `t:real^N->bool` THEN STRIP_TAC THEN + REWRITE_TAC[ADD_CLAUSES] THEN FIRST_X_ASSUM(SUBST_ALL_TAC o SYM) THEN + SUBGOAL_THEN `~(span t = (:real^N))` MP_TAC THENL + [REWRITE_TAC[GSYM DIM_EQ_FULL] THEN ASM_ARITH_TAC; ALL_TAC] THEN + REWRITE_TAC[EXTENSION; IN_UNIV; NOT_FORALL_THM; LEFT_IMP_EXISTS_THM] THEN + X_GEN_TAC `a:real^N` THEN DISCH_TAC THEN + EXISTS_TAC `(a:real^N) INSERT t` THEN ASM_REWRITE_TAC[DIM_INSERT; ADD1] THEN + MATCH_MP_TAC SUBSET_TRANS THEN EXISTS_TAC `span(t:real^N->bool)` THEN + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC SPAN_MONO THEN SET_TAC[]);; + +let LOWDIM_EXPAND_BASIS = prove + (`!s:real^N->bool n. + dim s <= n /\ n <= dimindex(:N) + ==> ?b. b HAS_SIZE n /\ independent b /\ span s SUBSET span b`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + FIRST_ASSUM(X_CHOOSE_THEN `t:real^N->bool` STRIP_ASSUME_TAC o + MATCH_MP LOWDIM_EXPAND_DIMENSION) THEN + MP_TAC(ISPEC `t:real^N->bool` BASIS_EXISTS) THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `b:real^N->bool` THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[SPAN_SPAN; SUBSET_TRANS; SPAN_MONO]);; + +(* ------------------------------------------------------------------------- *) +(* Orthogonal bases, Gram-Schmidt process, and related theorems. *) +(* ------------------------------------------------------------------------- *) + +let SPAN_DELETE_0 = prove + (`!s:real^N->bool. span(s DELETE vec 0) = span s`, + GEN_TAC THEN MATCH_MP_TAC SUBSET_ANTISYM THEN + SIMP_TAC[DELETE_SUBSET; SPAN_MONO] THEN + MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `span((vec 0:real^N) INSERT (s DELETE vec 0))` THEN CONJ_TAC THENL + [MATCH_MP_TAC SPAN_MONO THEN SET_TAC[]; + SIMP_TAC[SUBSET; SPAN_BREAKDOWN_EQ; VECTOR_MUL_RZERO; VECTOR_SUB_RZERO]]);; + +let SPAN_IMAGE_SCALE = prove + (`!c s. FINITE s /\ (!x. x IN s ==> ~(c x = &0)) + ==> span (IMAGE (\x:real^N. c(x) % x) s) = span s`, + GEN_TAC THEN REWRITE_TAC[IMP_CONJ] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + SIMP_TAC[IMAGE_CLAUSES; SPAN_BREAKDOWN_EQ; EXTENSION; FORALL_IN_INSERT] THEN + MAP_EVERY X_GEN_TAC [`x:real^N`; `t:real^N->bool`] THEN + STRIP_TAC THEN STRIP_TAC THEN X_GEN_TAC `y:real^N` THEN + REWRITE_TAC[VECTOR_MUL_ASSOC] THEN EQ_TAC THENL [MESON_TAC[]; ALL_TAC] THEN + DISCH_THEN(X_CHOOSE_TAC `k:real`) THEN + EXISTS_TAC `k / (c:real^N->real) x` THEN + ASM_SIMP_TAC[REAL_DIV_RMUL]);; + +let PAIRWISE_ORTHOGONAL_INDEPENDENT = prove + (`!s:real^N->bool. + pairwise orthogonal s /\ ~(vec 0 IN s) ==> independent s`, + REWRITE_TAC[pairwise; orthogonal] THEN REPEAT STRIP_TAC THEN + REWRITE_TAC[independent; dependent] THEN + DISCH_THEN(X_CHOOSE_THEN `a:real^N` (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + REWRITE_TAC[SPAN_EXPLICIT; IN_ELIM_THM; NOT_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`t:real^N->bool`; `u:real^N->real`] THEN + REWRITE_TAC[SUBSET; IN_DELETE] THEN STRIP_TAC THEN + FIRST_X_ASSUM(MP_TAC o AP_TERM `\x:real^N. a dot x`) THEN + ASM_SIMP_TAC[DOT_RSUM; DOT_RMUL; REAL_MUL_RZERO; SUM_0] THEN + ASM_MESON_TAC[DOT_EQ_0]);; + +let PAIRWISE_ORTHOGONAL_IMP_FINITE = prove + (`!s:real^N->bool. pairwise orthogonal s ==> FINITE s`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `independent (s DELETE (vec 0:real^N))` MP_TAC THENL + [MATCH_MP_TAC PAIRWISE_ORTHOGONAL_INDEPENDENT THEN + REWRITE_TAC[IN_DELETE] THEN MATCH_MP_TAC PAIRWISE_MONO THEN + EXISTS_TAC `s:real^N->bool` THEN + ASM_SIMP_TAC[SUBSET; IN_DELETE]; + DISCH_THEN(MP_TAC o MATCH_MP INDEPENDENT_IMP_FINITE) THEN + REWRITE_TAC[FINITE_DELETE]]);; + +let GRAM_SCHMIDT_STEP = prove + (`!s a x. + pairwise orthogonal s /\ x IN span s + ==> orthogonal x (a - vsum s (\b:real^N. (b dot a) / (b dot b) % b))`, + REWRITE_TAC[IMP_CONJ; RIGHT_FORALL_IMP_THM] THEN + REWRITE_TAC[ONCE_REWRITE_RULE[ORTHOGONAL_SYM] ORTHOGONAL_TO_SPAN_EQ] THEN + X_GEN_TAC `s:real^N->bool` THEN STRIP_TAC THEN + MAP_EVERY X_GEN_TAC [`a:real^N`; `x:real^N`] THEN DISCH_TAC THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP PAIRWISE_ORTHOGONAL_IMP_FINITE) THEN + REWRITE_TAC[orthogonal; DOT_RSUB] THEN ASM_SIMP_TAC[DOT_RSUM] THEN + REWRITE_TAC[REAL_SUB_0; DOT_RMUL] THEN MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `sum s (\y:real^N. if y = x then y dot a else &0)` THEN + CONJ_TAC THENL [ASM_SIMP_TAC[SUM_DELTA; DOT_SYM]; ALL_TAC] THEN + MATCH_MP_TAC SUM_EQ THEN X_GEN_TAC `y:real^N` THEN DISCH_TAC THEN + RULE_ASSUM_TAC(REWRITE_RULE[pairwise; orthogonal]) THEN + ASM_CASES_TAC `x:real^N = y` THEN ASM_SIMP_TAC[DOT_LMUL; REAL_MUL_RZERO] THEN + ASM_CASES_TAC `y:real^N = vec 0` THEN + ASM_SIMP_TAC[REAL_DIV_RMUL; DOT_EQ_0; DOT_LZERO; REAL_MUL_RZERO]);; + +let ORTHOGONAL_EXTENSION = prove + (`!t s:real^N->bool. + FINITE t /\ FINITE s /\ pairwise orthogonal s + ==> ?u. pairwise orthogonal (s UNION u) /\ + span (s UNION u) = span (s UNION t)`, + REWRITE_TAC[IMP_CONJ; RIGHT_FORALL_IMP_THM] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN CONJ_TAC THENL + [REPEAT STRIP_TAC THEN EXISTS_TAC `{}:real^N->bool` THEN + ASM_REWRITE_TAC[UNION_EMPTY]; + ALL_TAC] THEN + MAP_EVERY X_GEN_TAC [`a:real^N`; `t:real^N->bool`] THEN + REWRITE_TAC[pairwise; orthogonal] THEN REPEAT STRIP_TAC THEN + ABBREV_TAC `a' = a - vsum s (\b:real^N. (b dot a) / (b dot b) % b)` THEN + FIRST_X_ASSUM(MP_TAC o SPEC `(a':real^N) INSERT s`) THEN + ASM_REWRITE_TAC[FINITE_INSERT] THEN ANTS_TAC THENL + [SUBGOAL_THEN `!x:real^N. x IN s ==> a' dot x = &0` + (fun th -> REWRITE_TAC[IN_INSERT] THEN ASM_MESON_TAC[DOT_SYM; th]) THEN + REPEAT STRIP_TAC THEN EXPAND_TAC "a'" THEN + REWRITE_TAC[GSYM orthogonal] THEN ONCE_REWRITE_TAC[ORTHOGONAL_SYM] THEN + MATCH_MP_TAC GRAM_SCHMIDT_STEP THEN + ASM_SIMP_TAC[pairwise; orthogonal; SPAN_CLAUSES]; + DISCH_THEN(X_CHOOSE_THEN `u:real^N->bool` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `(a':real^N) INSERT u` THEN + ASM_REWRITE_TAC[SET_RULE `s UNION a INSERT u = a INSERT s UNION u`] THEN + REWRITE_TAC[SET_RULE `(x INSERT s) UNION t = x INSERT (s UNION t)`] THEN + MATCH_MP_TAC EQ_SPAN_INSERT_EQ THEN EXPAND_TAC "a'" THEN + REWRITE_TAC[VECTOR_ARITH `a - x - a:real^N = --x`] THEN + MATCH_MP_TAC SPAN_NEG THEN MATCH_MP_TAC SPAN_VSUM THEN + ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC SPAN_MUL THEN ASM_SIMP_TAC[SPAN_SUPERSET; IN_UNION]]);; + +let VECTOR_IN_ORTHOGONAL_SPANNINGSET = prove + (`!a. ?s. a IN s /\ pairwise orthogonal s /\ span s = (:real^N)`, + GEN_TAC THEN + MP_TAC(ISPECL [`(IMAGE basis (1..dimindex(:N))):real^N->bool`; + `{a:real^N}`] ORTHOGONAL_EXTENSION) THEN + SIMP_TAC[FINITE_SING; PAIRWISE_SING; FINITE_IMAGE; FINITE_NUMSEG] THEN + DISCH_THEN(X_CHOOSE_THEN `u:real^N->bool` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `{a:real^N} UNION u` THEN ASM_REWRITE_TAC[IN_UNION; IN_SING] THEN + MATCH_MP_TAC(SET_RULE `!s. s = UNIV /\ s SUBSET t ==> t = UNIV`) THEN + EXISTS_TAC `span {basis i:real^N | 1 <= i /\ i <= dimindex (:N)}` THEN + CONJ_TAC THENL [REWRITE_TAC[SPAN_STDBASIS]; MATCH_MP_TAC SPAN_MONO] THEN + REWRITE_TAC[SUBSET; FORALL_IN_GSPEC; GSYM IN_NUMSEG] THEN SET_TAC[]);; + +let VECTOR_IN_ORTHOGONAL_BASIS = prove + (`!a. ~(a = vec 0) + ==> ?s. a IN s /\ ~(vec 0 IN s) /\ + pairwise orthogonal s /\ + independent s /\ + s HAS_SIZE (dimindex(:N)) /\ + span s = (:real^N)`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPEC `a:real^N` VECTOR_IN_ORTHOGONAL_SPANNINGSET) THEN + DISCH_THEN(X_CHOOSE_THEN `s:real^N->bool` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `s DELETE (vec 0:real^N)` THEN ASM_REWRITE_TAC[IN_DELETE] THEN + MATCH_MP_TAC(TAUT `a /\ (a ==> b) ==> a /\ b`) THEN CONJ_TAC THENL + [RULE_ASSUM_TAC(REWRITE_RULE[pairwise]) THEN + ASM_SIMP_TAC[pairwise; IN_DELETE]; + DISCH_TAC] THEN + MATCH_MP_TAC(TAUT `a /\ (a ==> b) ==> a /\ b`) THEN CONJ_TAC THENL + [MATCH_MP_TAC PAIRWISE_ORTHOGONAL_INDEPENDENT THEN ASM_SIMP_TAC[IN_DELETE]; + DISCH_TAC] THEN + MATCH_MP_TAC(TAUT `b /\ (b ==> a) ==> a /\ b`) THEN CONJ_TAC THENL + [ASM_MESON_TAC[SPAN_DELETE_0]; + DISCH_TAC THEN ASM_SIMP_TAC[BASIS_HAS_SIZE_UNIV]]);; + +let VECTOR_IN_ORTHONORMAL_BASIS = prove + (`!a. norm a = &1 + ==> ?s. a IN s /\ + pairwise orthogonal s /\ + (!x. x IN s ==> norm x = &1) /\ + independent s /\ + s HAS_SIZE (dimindex(:N)) /\ + span s = (:real^N)`, + GEN_TAC THEN ASM_CASES_TAC `a:real^N = vec 0` THEN + ASM_REWRITE_TAC[NORM_0; REAL_OF_NUM_EQ; ARITH_EQ] THEN DISCH_TAC THEN + FIRST_ASSUM(MP_TAC o MATCH_MP VECTOR_IN_ORTHOGONAL_BASIS) THEN + DISCH_THEN(X_CHOOSE_THEN `s:real^N->bool` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `IMAGE (\x:real^N. inv(norm x) % x) s` THEN + CONJ_TAC THENL + [REWRITE_TAC[IN_IMAGE] THEN EXISTS_TAC `a:real^N` THEN + ASM_REWRITE_TAC[REAL_INV_1; VECTOR_MUL_LID]; + ALL_TAC] THEN + MATCH_MP_TAC(TAUT `a /\ (a ==> b) ==> a /\ b`) THEN CONJ_TAC THENL + [REWRITE_TAC[pairwise; IMP_CONJ; RIGHT_FORALL_IMP_THM; FORALL_IN_IMAGE] THEN + RULE_ASSUM_TAC(REWRITE_RULE[pairwise]) THEN + ASM_MESON_TAC[ORTHOGONAL_CLAUSES]; + DISCH_TAC] THEN + MATCH_MP_TAC(TAUT `a /\ (a ==> b) ==> a /\ b`) THEN CONJ_TAC THENL + [REWRITE_TAC[FORALL_IN_IMAGE; NORM_MUL; REAL_ABS_INV; REAL_ABS_NORM] THEN + ASM_MESON_TAC[REAL_MUL_LINV; NORM_EQ_0]; + DISCH_TAC] THEN + MATCH_MP_TAC(TAUT `a /\ (a ==> b) ==> a /\ b`) THEN CONJ_TAC THENL + [MATCH_MP_TAC PAIRWISE_ORTHOGONAL_INDEPENDENT THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[IN_IMAGE] THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN + SIMP_TAC[VECTOR_MUL_EQ_0; REAL_INV_EQ_0; NORM_EQ_0] THEN ASM_MESON_TAC[]; + DISCH_TAC] THEN + MATCH_MP_TAC(TAUT `b /\ (b ==> a) ==> a /\ b`) THEN CONJ_TAC THENL + [ALL_TAC; ASM_SIMP_TAC[BASIS_HAS_SIZE_UNIV]] THEN + UNDISCH_THEN `span s = (:real^N)` (SUBST1_TAC o SYM) THEN + MATCH_MP_TAC SPAN_IMAGE_SCALE THEN + REWRITE_TAC[REAL_INV_EQ_0; NORM_EQ_0] THEN + ASM_MESON_TAC[HAS_SIZE]);; + +(* ------------------------------------------------------------------------- *) +(* Analogous theorems for existence of orthonormal basis for a subspace. *) +(* ------------------------------------------------------------------------- *) + +let ORTHOGONAL_SPANNINGSET_SUBSPACE = prove + (`!s:real^N->bool. + subspace s + ==> ?b. b SUBSET s /\ pairwise orthogonal b /\ span b = s`, + REPEAT STRIP_TAC THEN MP_TAC(ISPEC `s:real^N->bool` BASIS_EXISTS) THEN + DISCH_THEN(X_CHOOSE_THEN `b:real^N->bool` STRIP_ASSUME_TAC) THEN + MP_TAC(ISPECL[`b:real^N->bool`; `{}:real^N->bool`] ORTHOGONAL_EXTENSION) THEN + RULE_ASSUM_TAC(REWRITE_RULE[HAS_SIZE]) THEN + ASM_REWRITE_TAC[FINITE_EMPTY; PAIRWISE_EMPTY; UNION_EMPTY] THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `c:real^N->bool` THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC(TAUT `b /\ (b ==> a) ==> a /\ b`) THEN CONJ_TAC THENL + [MATCH_MP_TAC SPAN_SUBSPACE THEN ASM_REWRITE_TAC[]; + DISCH_THEN(SUBST1_TAC o SYM) THEN ASM_MESON_TAC[SPAN_INC]]);; + +let ORTHOGONAL_BASIS_SUBSPACE = prove + (`!s:real^N->bool. + subspace s + ==> ?b. ~(vec 0 IN b) /\ + b SUBSET s /\ + pairwise orthogonal b /\ + independent b /\ + b HAS_SIZE (dim s) /\ + span b = s`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM(MP_TAC o MATCH_MP ORTHOGONAL_SPANNINGSET_SUBSPACE) THEN + DISCH_THEN(X_CHOOSE_THEN `b:real^N->bool` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `b DELETE (vec 0:real^N)` THEN ASM_REWRITE_TAC[IN_DELETE] THEN + CONJ_TAC THENL [ASM SET_TAC[]; ALL_TAC] THEN + MATCH_MP_TAC(TAUT `a /\ (a ==> b) ==> a /\ b`) THEN CONJ_TAC THENL + [RULE_ASSUM_TAC(REWRITE_RULE[pairwise]) THEN + ASM_SIMP_TAC[pairwise; IN_DELETE]; + DISCH_TAC] THEN + MATCH_MP_TAC(TAUT `a /\ (a ==> b) ==> a /\ b`) THEN CONJ_TAC THENL + [MATCH_MP_TAC PAIRWISE_ORTHOGONAL_INDEPENDENT THEN ASM_SIMP_TAC[IN_DELETE]; + DISCH_TAC] THEN + MATCH_MP_TAC(TAUT `b /\ (b ==> a) ==> a /\ b`) THEN CONJ_TAC THENL + [ASM_MESON_TAC[SPAN_DELETE_0]; + DISCH_TAC THEN ASM_SIMP_TAC[BASIS_HAS_SIZE_DIM]]);; + +let ORTHONORMAL_BASIS_SUBSPACE = prove + (`!s:real^N->bool. + subspace s + ==> ?b. b SUBSET span s /\ + pairwise orthogonal b /\ + (!x. x IN b ==> norm x = &1) /\ + independent b /\ + b HAS_SIZE (dim s) /\ + span b = s`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM(MP_TAC o MATCH_MP ORTHOGONAL_BASIS_SUBSPACE) THEN + DISCH_THEN(X_CHOOSE_THEN `b:real^N->bool` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `IMAGE (\x:real^N. inv(norm x) % x) b` THEN + CONJ_TAC THENL + [REWRITE_TAC[SUBSET; FORALL_IN_IMAGE] THEN + ASM_MESON_TAC[SPAN_MUL; SPAN_INC; SUBSET]; + ALL_TAC] THEN + MATCH_MP_TAC(TAUT `a /\ (a ==> b) ==> a /\ b`) THEN CONJ_TAC THENL + [REWRITE_TAC[pairwise; IMP_CONJ; RIGHT_FORALL_IMP_THM; FORALL_IN_IMAGE] THEN + RULE_ASSUM_TAC(REWRITE_RULE[pairwise]) THEN + ASM_MESON_TAC[ORTHOGONAL_CLAUSES]; + DISCH_TAC] THEN + MATCH_MP_TAC(TAUT `a /\ (a ==> b) ==> a /\ b`) THEN CONJ_TAC THENL + [REWRITE_TAC[FORALL_IN_IMAGE; NORM_MUL; REAL_ABS_INV; REAL_ABS_NORM] THEN + ASM_MESON_TAC[REAL_MUL_LINV; NORM_EQ_0]; + DISCH_TAC] THEN + MATCH_MP_TAC(TAUT `a /\ (a ==> b) ==> a /\ b`) THEN CONJ_TAC THENL + [MATCH_MP_TAC PAIRWISE_ORTHOGONAL_INDEPENDENT THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[IN_IMAGE] THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN + SIMP_TAC[VECTOR_MUL_EQ_0; REAL_INV_EQ_0; NORM_EQ_0] THEN ASM_MESON_TAC[]; + DISCH_TAC] THEN + MATCH_MP_TAC(TAUT `b /\ (b ==> a) ==> a /\ b`) THEN CONJ_TAC THENL + [ALL_TAC; ASM_SIMP_TAC[BASIS_HAS_SIZE_DIM]] THEN + UNDISCH_THEN `span b = (s:real^N->bool)` (SUBST1_TAC o SYM) THEN + MATCH_MP_TAC SPAN_IMAGE_SCALE THEN + REWRITE_TAC[REAL_INV_EQ_0; NORM_EQ_0] THEN + ASM_MESON_TAC[HAS_SIZE]);; + +let ORTHOGONAL_TO_SUBSPACE_EXISTS_GEN = prove + (`!s t:real^N->bool. + span s PSUBSET span t + ==> ?x. ~(x = vec 0) /\ x IN span t /\ + (!y. y IN span s ==> orthogonal x y)`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPEC `span s:real^N->bool` ORTHOGONAL_BASIS_SUBSPACE) THEN + REWRITE_TAC[SUBSPACE_SPAN] THEN + DISCH_THEN(X_CHOOSE_THEN `b:real^N->bool` STRIP_ASSUME_TAC) THEN + FIRST_X_ASSUM(SUBST_ALL_TAC o SYM) THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [PSUBSET_ALT]) THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC + (X_CHOOSE_THEN `u:real^N` STRIP_ASSUME_TAC)) THEN + MP_TAC(ISPECL [`{u:real^N}`; `b:real^N->bool`] ORTHOGONAL_EXTENSION) THEN + ANTS_TAC THENL [ASM_MESON_TAC[FINITE_SING; HAS_SIZE]; ALL_TAC] THEN + DISCH_THEN(X_CHOOSE_THEN `ns:real^N->bool` MP_TAC) THEN + ASM_CASES_TAC `ns SUBSET (vec 0:real^N) INSERT b` THENL + [DISCH_THEN(MP_TAC o AP_TERM `(IN) (u:real^N)` o CONJUNCT2) THEN + SIMP_TAC[SPAN_SUPERSET; IN_UNION; IN_SING] THEN + MATCH_MP_TAC(TAUT `~p ==> p ==> q`) THEN + SUBGOAL_THEN `~(u IN span (b UNION {vec 0:real^N}))` MP_TAC THENL + [ASM_REWRITE_TAC[SET_RULE `s UNION {a} = a INSERT s`; SPAN_INSERT_0]; + MATCH_MP_TAC(SET_RULE `s SUBSET t ==> ~(x IN t) ==> ~(x IN s)`) THEN + MATCH_MP_TAC SPAN_MONO THEN ASM SET_TAC[]]; + ALL_TAC] THEN + FIRST_X_ASSUM(MP_TAC o MATCH_MP (SET_RULE + `~(s SUBSET t) ==> ?z. z IN s /\ ~(z IN t)`)) THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM; IN_INSERT; DE_MORGAN_THM] THEN + X_GEN_TAC `n:real^N` THEN STRIP_TAC THEN + DISCH_THEN(CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN + REWRITE_TAC[pairwise; IMP_CONJ; RIGHT_FORALL_IMP_THM] THEN + DISCH_THEN(MP_TAC o SPEC `n:real^N`) THEN ASM_REWRITE_TAC[IN_UNION] THEN + REWRITE_TAC[IMP_IMP] THEN DISCH_TAC THEN EXISTS_TAC `n:real^N` THEN + ASM_REWRITE_TAC[] THEN CONJ_TAC THENL + [SUBGOAL_THEN `(n:real^N) IN span (b UNION ns)` MP_TAC THENL + [MATCH_MP_TAC SPAN_SUPERSET THEN ASM SET_TAC[]; + ASM_REWRITE_TAC[] THEN SPEC_TAC(`n:real^N`,`n:real^N`) THEN + REWRITE_TAC[GSYM SUBSET] THEN + MATCH_MP_TAC SPAN_SUBSET_SUBSPACE THEN REWRITE_TAC[SUBSPACE_SPAN] THEN + ASM_REWRITE_TAC[SET_RULE + `s UNION {a} SUBSET t <=> s SUBSET t /\ a IN t`] THEN + ASM_MESON_TAC[SPAN_INC; SUBSET_TRANS]]; + MATCH_MP_TAC SPAN_INDUCT THEN + REWRITE_TAC[SET_RULE `(\y. orthogonal n y) = {y | orthogonal n y}`] THEN + REWRITE_TAC[SUBSPACE_ORTHOGONAL_TO_VECTOR] THEN ASM SET_TAC[]]);; + +let ORTHOGONAL_TO_SUBSPACE_EXISTS = prove + (`!s:real^N->bool. dim s < dimindex(:N) + ==> ?x. ~(x = vec 0) /\ !y. y IN s ==> orthogonal x y`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPECL [`s:real^N->bool`; `(:real^N)`] + ORTHOGONAL_TO_SUBSPACE_EXISTS_GEN) THEN + ANTS_TAC THENL [REWRITE_TAC[PSUBSET]; MESON_TAC[SPAN_SUPERSET]] THEN + REWRITE_TAC[SPAN_UNIV; SUBSET_UNIV] THEN + ASM_MESON_TAC[DIM_SPAN; DIM_UNIV; LT_REFL]);; + +let ORTHOGONAL_TO_VECTOR_EXISTS = prove + (`!x:real^N. 2 <= dimindex(:N) ==> ?y. ~(y = vec 0) /\ orthogonal x y`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPEC `{x:real^N}` ORTHOGONAL_TO_SUBSPACE_EXISTS) THEN + SIMP_TAC[DIM_SING; IN_SING; LEFT_FORALL_IMP_THM; EXISTS_REFL] THEN + ANTS_TAC THENL [ASM_ARITH_TAC; MESON_TAC[ORTHOGONAL_SYM]]);; + +let SPAN_NOT_UNIV_ORTHOGONAL = prove + (`!s. ~(span s = (:real^N)) + ==> ?a. ~(a = vec 0) /\ !x. x IN span s ==> a dot x = &0`, + REWRITE_TAC[GSYM DIM_EQ_FULL; GSYM LE_ANTISYM; DIM_SUBSET_UNIV; + NOT_LE] THEN + REPEAT STRIP_TAC THEN REWRITE_TAC[GSYM orthogonal] THEN + MATCH_MP_TAC ORTHOGONAL_TO_SUBSPACE_EXISTS THEN ASM_REWRITE_TAC[DIM_SPAN]);; + +let SPAN_NOT_UNIV_SUBSET_HYPERPLANE = prove + (`!s. ~(span s = (:real^N)) + ==> ?a. ~(a = vec 0) /\ span s SUBSET {x | a dot x = &0}`, + REWRITE_TAC[SUBSET; IN_ELIM_THM; SPAN_NOT_UNIV_ORTHOGONAL]);; + +let LOWDIM_SUBSET_HYPERPLANE = prove + (`!s. dim s < dimindex(:N) + ==> ?a:real^N. ~(a = vec 0) /\ span s SUBSET {x | a dot x = &0}`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC SPAN_NOT_UNIV_SUBSET_HYPERPLANE THEN + REWRITE_TAC[GSYM SUBSET_ANTISYM_EQ; SUBSET_UNIV] THEN + DISCH_THEN(MP_TAC o MATCH_MP DIM_SUBSET) THEN + ASM_REWRITE_TAC[NOT_LE; DIM_SPAN; DIM_UNIV]);; + +(* ------------------------------------------------------------------------- *) +(* Decomposing a vector into parts in orthogonal subspaces. *) +(* ------------------------------------------------------------------------- *) + +let ORTHOGONAL_SUBSPACE_DECOMP_UNIQUE = prove + (`!s t x y x' y':real^N. + (!a b. a IN s /\ b IN t ==> orthogonal a b) /\ + x IN span s /\ x' IN span s /\ y IN span t /\ y' IN span t /\ + x + y = x' + y' + ==> x = x' /\ y = y'`, + REWRITE_TAC[VECTOR_ARITH `x + y:real^N = x' + y' <=> x - x' = y' - y`] THEN + ONCE_REWRITE_TAC[GSYM ORTHOGONAL_TO_SPANS_EQ] THEN + REPEAT GEN_TAC THEN ONCE_REWRITE_TAC[VECTOR_ARITH + `x:real^N = x' /\ y:real^N = y' <=> x - x' = vec 0 /\ y' - y = vec 0`] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[GSYM ORTHOGONAL_REFL] THEN + FIRST_X_ASSUM(fun th -> GEN_REWRITE_TAC RAND_CONV [SYM th]) THEN + ASM_MESON_TAC[ORTHOGONAL_CLAUSES; ORTHOGONAL_SYM]);; + +let ORTHOGONAL_SUBSPACE_DECOMP_EXISTS = prove + (`!s x:real^N. ?y z. y IN span s /\ (!w. w IN span s ==> orthogonal z w) /\ + x = y + z`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPEC `span s:real^N->bool` ORTHOGONAL_BASIS_SUBSPACE) THEN + REWRITE_TAC[SUBSPACE_SPAN; LEFT_IMP_EXISTS_THM] THEN + X_GEN_TAC `t:real^N->bool` THEN STRIP_TAC THEN + FIRST_X_ASSUM(SUBST1_TAC o SYM) THEN + EXISTS_TAC `vsum t (\b:real^N. (b dot x) / (b dot b) % b)` THEN + EXISTS_TAC `x - vsum t (\b:real^N. (b dot x) / (b dot b) % b)` THEN + REPEAT CONJ_TAC THENL + [MATCH_MP_TAC SPAN_VSUM THEN + ASM_SIMP_TAC[INDEPENDENT_IMP_FINITE; SPAN_CLAUSES]; + REPEAT STRIP_TAC THEN ONCE_REWRITE_TAC[ORTHOGONAL_SYM] THEN + MATCH_MP_TAC GRAM_SCHMIDT_STEP THEN ASM_SIMP_TAC[]; + VECTOR_ARITH_TAC]);; + +let ORTHOGONAL_SUBSPACE_DECOMP = prove + (`!s x. ?!(y,z). y IN span s /\ + z IN {z:real^N | !x. x IN span s ==> orthogonal z x} /\ + x = y + z`, + REWRITE_TAC[EXISTS_UNIQUE_DEF; IN_ELIM_THM] THEN + REWRITE_TAC[EXISTS_PAIRED_THM; FORALL_PAIRED_THM] THEN + REWRITE_TAC[FORALL_PAIR_THM; ORTHOGONAL_SUBSPACE_DECOMP_EXISTS] THEN + REPEAT STRIP_TAC THEN REWRITE_TAC[PAIR_EQ] THEN + MATCH_MP_TAC ORTHOGONAL_SUBSPACE_DECOMP_UNIQUE THEN + MAP_EVERY EXISTS_TAC + [`s:real^N->bool`; `{z:real^N | !x. x IN span s ==> orthogonal z x}`] THEN + ASM_SIMP_TAC[SPAN_CLAUSES; IN_ELIM_THM] THEN + ASM_MESON_TAC[SPAN_CLAUSES; ORTHOGONAL_SYM]);; + +(* ------------------------------------------------------------------------- *) +(* Existence of isometry between subspaces of same dimension. *) +(* ------------------------------------------------------------------------- *) + +let ISOMETRY_SUBSPACES = prove + (`!s:real^M->bool t:real^N->bool. + subspace s /\ subspace t /\ dim s = dim t + ==> ?f:real^M->real^N. linear f /\ IMAGE f s = t /\ + (!x. x IN s ==> norm(f x) = norm(x))`, + REPEAT STRIP_TAC THEN ABBREV_TAC `n = dim(t:real^N->bool)` THEN + MP_TAC(ISPEC `t:real^N->bool` ORTHONORMAL_BASIS_SUBSPACE) THEN + MP_TAC(ISPEC `s:real^M->bool` ORTHONORMAL_BASIS_SUBSPACE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN(X_CHOOSE_THEN `b:real^M->bool` STRIP_ASSUME_TAC) THEN + DISCH_THEN(X_CHOOSE_THEN `c:real^N->bool` STRIP_ASSUME_TAC) THEN + MP_TAC(ISPECL [`b:real^M->bool`; `c:real^N->bool`] CARD_EQ_BIJECTIONS) THEN + RULE_ASSUM_TAC(REWRITE_RULE[HAS_SIZE]) THEN + ASM_REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`f:real^M->real^N`; `g:real^N->real^M`] THEN + STRIP_TAC THEN + MP_TAC(ISPECL [`f:real^M->real^N`; `b:real^M->bool`] + LINEAR_INDEPENDENT_EXTEND) THEN + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC MONO_EXISTS THEN + X_GEN_TAC `h:real^M->real^N` THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN CONJ_TAC THENL + [REWRITE_TAC[SYM(ASSUME `span(b:real^M->bool) = s`); + SYM(ASSUME `span(c:real^N->bool) = t`)] THEN + MATCH_MP_TAC SUBSET_ANTISYM THEN + REWRITE_TAC[SUBSET; FORALL_IN_IMAGE] THEN + CONJ_TAC THEN MATCH_MP_TAC SPAN_INDUCT THEN REWRITE_TAC[IN_ELIM_THM] THENL + [GEN_REWRITE_TAC (RAND_CONV o RAND_CONV) + [SET_RULE `(\x. p x) = {x | p x}`] THEN + ASM_SIMP_TAC[SUBSPACE_LINEAR_PREIMAGE] THEN + ASM_MESON_TAC[SPAN_INC; SUBSET]; + ONCE_REWRITE_TAC[SET_RULE `(\x. x IN s) = s`] THEN + ASM_SIMP_TAC[SUBSPACE_LINEAR_IMAGE; SUBSPACE_SPAN] THEN + X_GEN_TAC `x:real^N` THEN DISCH_TAC THEN REWRITE_TAC[IN_IMAGE] THEN + ASM_MESON_TAC[SPAN_INC; SUBSET]]; + X_GEN_TAC `x:real^M` THEN + REWRITE_TAC[SYM(ASSUME `span(b:real^M->bool) = s`)] THEN + SIMP_TAC[SPAN_FINITE; ASSUME `FINITE(b:real^M->bool) /\ CARD b = n`] THEN + REWRITE_TAC[IN_ELIM_THM; LEFT_IMP_EXISTS_THM] THEN + X_GEN_TAC `u:real^M->real` THEN DISCH_THEN(SUBST1_TAC o SYM) THEN + ASM_SIMP_TAC[LINEAR_VSUM; NORM_EQ] THEN + ASM_SIMP_TAC[o_DEF; LINEAR_CMUL] THEN + ASM_SIMP_TAC[DOT_LSUM; DOT_RSUM; DOT_RMUL; DOT_LMUL] THEN + MATCH_MP_TAC SUM_EQ THEN X_GEN_TAC `x:real^M` THEN DISCH_TAC THEN + REWRITE_TAC[] THEN MATCH_MP_TAC SUM_EQ THEN X_GEN_TAC `y:real^M` THEN + DISCH_TAC THEN REWRITE_TAC[] THEN AP_TERM_TAC THEN AP_TERM_TAC THEN + RULE_ASSUM_TAC(REWRITE_RULE[pairwise; orthogonal]) THEN + ASM_CASES_TAC `x:real^M = y` THEN ASM_REWRITE_TAC[GSYM NORM_EQ] THEN + ASM SET_TAC[]]);; + +let ISOMETRY_UNIV_SUBSPACE = prove + (`!s. subspace s /\ dimindex(:M) = dim s + ==> ?f:real^M->real^N. + linear f /\ IMAGE f (:real^M) = s /\ + (!x. norm(f x) = norm(x))`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPECL [`(:real^M)`; `s:real^N->bool`] ISOMETRY_SUBSPACES) THEN + ASM_REWRITE_TAC[SUBSPACE_UNIV; IN_UNIV; DIM_UNIV]);; + +let ISOMETRY_UNIV_SUPERSET_SUBSPACE = prove + (`!s. subspace s /\ dim s <= dimindex(:M) /\ dimindex(:M) <= dimindex(:N) + ==> ?f:real^M->real^N. + linear f /\ s SUBSET (IMAGE f (:real^M)) /\ + (!x. norm(f x) = norm(x))`, + GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN ASSUME_TAC) THEN + FIRST_ASSUM(MP_TAC o MATCH_MP LOWDIM_EXPAND_DIMENSION) THEN + DISCH_THEN(X_CHOOSE_THEN `t:real^N->bool` STRIP_ASSUME_TAC) THEN + MP_TAC(ISPECL [`(:real^M)`; `span t:real^N->bool`] ISOMETRY_SUBSPACES) THEN + ASM_REWRITE_TAC[SUBSPACE_SPAN; SUBSPACE_UNIV; DIM_UNIV; DIM_SPAN] THEN + MATCH_MP_TAC MONO_EXISTS THEN SIMP_TAC[IN_UNIV] THEN + ASM_MESON_TAC[SUBSET; SPAN_INC]);; + +let ISOMETRY_UNIV_UNIV = prove + (`dimindex(:M) <= dimindex(:N) + ==> ?f:real^M->real^N. linear f /\ (!x. norm(f x) = norm(x))`, + DISCH_TAC THEN + MP_TAC(ISPEC `{vec 0:real^N}`ISOMETRY_UNIV_SUPERSET_SUBSPACE) THEN + ASM_REWRITE_TAC[SUBSPACE_TRIVIAL] THEN + ANTS_TAC THENL [ALL_TAC; ASM_MESON_TAC[]] THEN + MATCH_MP_TAC(ARITH_RULE `x = 0 /\ 1 <= y ==> x <= y`) THEN + ASM_REWRITE_TAC[DIM_EQ_0; DIMINDEX_GE_1] THEN SET_TAC[]);; + +let SUBSPACE_ISOMORPHISM = prove + (`!s t. subspace s /\ subspace t /\ dim(s) = dim(t) + ==> ?f:real^M->real^N. + linear f /\ (IMAGE f s = t) /\ + (!x y. x IN s /\ y IN s /\ f x = f y ==> (x = y))`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + FIRST_ASSUM(MP_TAC o MATCH_MP ISOMETRY_SUBSPACES) THEN + MATCH_MP_TAC MONO_EXISTS THEN + ASM_SIMP_TAC[LINEAR_INJECTIVE_0_SUBSPACE] THEN MESON_TAC[NORM_EQ_0]);; + +let ISOMORPHISMS_UNIV_UNIV = prove + (`dimindex(:M) = dimindex(:N) + ==> ?f:real^M->real^N g. + linear f /\ linear g /\ + (!x. norm(f x) = norm x) /\ (!y. norm(g y) = norm y) /\ + (!x. g(f x) = x) /\ (!y. f(g y) = y)`, + REPEAT STRIP_TAC THEN + EXISTS_TAC `(\x. lambda i. x$i):real^M->real^N` THEN + EXISTS_TAC `(\x. lambda i. x$i):real^N->real^M` THEN + SIMP_TAC[vector_norm; dot; LAMBDA_BETA] THEN + SIMP_TAC[linear; CART_EQ; VECTOR_ADD_COMPONENT; VECTOR_MUL_COMPONENT; + LAMBDA_BETA] THEN + FIRST_ASSUM SUBST1_TAC THEN SIMP_TAC[LAMBDA_BETA] THEN + FIRST_X_ASSUM(SUBST1_TAC o SYM) THEN SIMP_TAC[LAMBDA_BETA]);; + +(* ------------------------------------------------------------------------- *) +(* Properties of special hyperplanes. *) +(* ------------------------------------------------------------------------- *) + +let SUBSPACE_HYPERPLANE = prove + (`!a. subspace {x:real^N | a dot x = &0}`, + SIMP_TAC[subspace; DOT_RADD; DOT_RMUL; IN_ELIM_THM; REAL_ADD_LID; + REAL_MUL_RZERO; DOT_RZERO]);; + +let SUBSPACE_SPECIAL_HYPERPLANE = prove + (`!k. subspace {x:real^N | x$k = &0}`, + SIMP_TAC[subspace; IN_ELIM_THM; VEC_COMPONENT; + VECTOR_ADD_COMPONENT; VECTOR_MUL_COMPONENT] THEN REAL_ARITH_TAC);; + +let SPECIAL_HYPERPLANE_SPAN = prove + (`!k. 1 <= k /\ k <= dimindex(:N) + ==> {x:real^N | x$k = &0} = + span(IMAGE basis ((1..dimindex(:N)) DELETE k))`, + REPEAT STRIP_TAC THEN CONV_TAC SYM_CONV THEN MATCH_MP_TAC SPAN_SUBSPACE THEN + ASM_SIMP_TAC[SUBSPACE_SPECIAL_HYPERPLANE] THEN CONJ_TAC THENL + [REWRITE_TAC[SUBSET; FORALL_IN_IMAGE; IN_ELIM_THM] THEN + ASM_SIMP_TAC[BASIS_COMPONENT; IN_DELETE]; + REWRITE_TAC[SUBSET; IN_ELIM_THM] THEN + X_GEN_TAC `x:real^N` THEN DISCH_TAC THEN + GEN_REWRITE_TAC LAND_CONV [GSYM BASIS_EXPANSION] THEN + SIMP_TAC[SPAN_FINITE; FINITE_IMAGE; FINITE_DELETE; FINITE_NUMSEG] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + EXISTS_TAC `\v:real^N. x dot v` THEN + W(MP_TAC o PART_MATCH (lhs o rand) VSUM_IMAGE o lhs o snd) THEN + ANTS_TAC THENL + [REWRITE_TAC[FINITE_DELETE; FINITE_NUMSEG; IN_NUMSEG; IN_DELETE] THEN + MESON_TAC[BASIS_INJ]; + DISCH_THEN SUBST1_TAC THEN REWRITE_TAC[o_DEF] THEN + ASM_SIMP_TAC[VSUM_DELETE; FINITE_NUMSEG; IN_NUMSEG; DOT_BASIS] THEN + REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_SUB_RZERO]]]);; + +let DIM_SPECIAL_HYPERPLANE = prove + (`!k. 1 <= k /\ k <= dimindex(:N) + ==> dim {x:real^N | x$k = &0} = dimindex(:N) - 1`, + SIMP_TAC[SPECIAL_HYPERPLANE_SPAN] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC DIM_UNIQUE THEN + EXISTS_TAC `IMAGE (basis:num->real^N) ((1..dimindex(:N)) DELETE k)` THEN + REWRITE_TAC[SUBSET_REFL; SPAN_INC] THEN CONJ_TAC THENL + [MATCH_MP_TAC INDEPENDENT_MONO THEN + EXISTS_TAC `{basis i:real^N | 1 <= i /\ i <= dimindex(:N)}` THEN + REWRITE_TAC[INDEPENDENT_STDBASIS; SUBSET; FORALL_IN_IMAGE] THEN + REWRITE_TAC[IN_DELETE; IN_NUMSEG; IN_ELIM_THM] THEN MESON_TAC[]; + MATCH_MP_TAC HAS_SIZE_IMAGE_INJ THEN CONJ_TAC THENL + [REWRITE_TAC[FINITE_DELETE; FINITE_NUMSEG; IN_NUMSEG; IN_DELETE] THEN + MESON_TAC[BASIS_INJ]; + ASM_SIMP_TAC[HAS_SIZE; FINITE_DELETE; FINITE_NUMSEG; CARD_DELETE; + FINITE_IMAGE; IN_NUMSEG; CARD_NUMSEG_1]]]);; + +(* ------------------------------------------------------------------------- *) +(* More theorems about dimensions of different subspaces. *) +(* ------------------------------------------------------------------------- *) + +let DIM_IMAGE_KERNEL_GEN = prove + (`!f:real^M->real^N s. + linear f /\ subspace s + ==> dim(IMAGE f s) + dim {x | x IN s /\ f x = vec 0} = dim(s)`, + REPEAT STRIP_TAC THEN MP_TAC + (ISPEC `{x | x IN s /\ (f:real^M->real^N) x = vec 0}` BASIS_EXISTS) THEN + DISCH_THEN(X_CHOOSE_THEN `v:real^M->bool` STRIP_ASSUME_TAC) THEN + MP_TAC(ISPECL [`v:real^M->bool`; `s:real^M->bool`] + MAXIMAL_INDEPENDENT_SUBSET_EXTEND) THEN + ANTS_TAC THENL [ASM SET_TAC[]; ALL_TAC] THEN + DISCH_THEN(X_CHOOSE_THEN `w:real^M->bool` STRIP_ASSUME_TAC) THEN + SUBGOAL_THEN `span(w:real^M->bool) = s` + (fun th -> GEN_REWRITE_TAC (RAND_CONV o RAND_CONV) [SYM th] THEN + ASSUME_TAC th) + THENL [ASM_SIMP_TAC[SPAN_SUBSPACE]; ALL_TAC] THEN + SUBGOAL_THEN `subspace {x | x IN s /\ (f:real^M->real^N) x = vec 0}` + ASSUME_TAC THENL + [REWRITE_TAC[SET_RULE `{x | x IN s /\ P x} = s INTER {x | P x}`] THEN + ASM_SIMP_TAC[SUBSPACE_INTER; SUBSPACE_KERNEL]; + ALL_TAC] THEN + SUBGOAL_THEN `{x | x IN s /\ (f:real^M->real^N) x = vec 0} = span v` + ASSUME_TAC THENL + [ASM_MESON_TAC[SUBSET_ANTISYM; SPAN_SUBSET_SUBSPACE; SUBSPACE_KERNEL]; + ALL_TAC] THEN + ASM_SIMP_TAC[DIM_SPAN; DIM_EQ_CARD] THEN + SUBGOAL_THEN + `!x. x IN span(w DIFF v) /\ (f:real^M->real^N) x = vec 0 ==> x = vec 0` + (LABEL_TAC "*") THENL + [MATCH_MP_TAC(SET_RULE + `!t. s SUBSET t /\ (!x. x IN s /\ x IN t /\ P x ==> Q x) + ==> (!x. x IN s /\ P x ==> Q x)`) THEN + EXISTS_TAC `s:real^M->bool` THEN CONJ_TAC THENL + [ASM_MESON_TAC[SPAN_MONO; SUBSET_DIFF]; ALL_TAC] THEN + ASM_SIMP_TAC[SPAN_FINITE; IN_ELIM_THM; IMP_CONJ; FINITE_DIFF; + INDEPENDENT_IMP_FINITE; LEFT_IMP_EXISTS_THM] THEN + GEN_TAC THEN X_GEN_TAC `u:real^M->real` THEN + DISCH_THEN(SUBST1_TAC o SYM) THEN REWRITE_TAC[IMP_IMP] THEN + ONCE_REWRITE_TAC[SET_RULE + `y IN s /\ f y = a <=> y IN {x | x IN s /\ f x = a}`] THEN + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[SPAN_FINITE; INDEPENDENT_IMP_FINITE; IN_ELIM_THM] THEN + DISCH_THEN(X_CHOOSE_TAC `t:real^M->real`) THEN + MP_TAC(ISPEC `w:real^M->bool` INDEPENDENT_EXPLICIT) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + DISCH_THEN(MP_TAC o SPEC + `(\x. if x IN w DIFF v then --u x else t x):real^M->real`) THEN + ASM_REWRITE_TAC[COND_RAND] THEN ONCE_REWRITE_TAC[COND_RATOR] THEN + ASM_SIMP_TAC[VSUM_CASES; INDEPENDENT_IMP_FINITE] THEN + REWRITE_TAC[SET_RULE `{x | x IN w /\ x IN (w DIFF v)} = w DIFF v`] THEN + SIMP_TAC[ASSUME `(v:real^M->bool) SUBSET w`; SET_RULE + `v SUBSET w ==> {x | x IN w /\ ~(x IN (w DIFF v))} = v`] THEN + ASM_REWRITE_TAC[VECTOR_MUL_LNEG; VSUM_NEG; VECTOR_ADD_LINV] THEN + DISCH_THEN(fun th -> MATCH_MP_TAC VSUM_EQ_0 THEN MP_TAC th) THEN + REWRITE_TAC[REAL_NEG_EQ_0; VECTOR_MUL_EQ_0; IN_DIFF] THEN MESON_TAC[]; + ALL_TAC] THEN + SUBGOAL_THEN `!x y. x IN (w DIFF v) /\ y IN (w DIFF v) /\ + (f:real^M->real^N) x = f y ==> x = y` + ASSUME_TAC THENL + [REMOVE_THEN "*" MP_TAC THEN + ASM_SIMP_TAC[GSYM LINEAR_INJECTIVE_0_SUBSPACE; SUBSPACE_SPAN] THEN + MP_TAC(ISPEC `w DIFF v:real^M->bool` SPAN_INC) THEN SET_TAC[]; + ALL_TAC] THEN + SUBGOAL_THEN `IMAGE (f:real^M->real^N) s = span(IMAGE f (w DIFF v))` + SUBST1_TAC THENL + [MATCH_MP_TAC SUBSET_ANTISYM THEN CONJ_TAC THENL + [ALL_TAC; + ASM_MESON_TAC[SUBSPACE_LINEAR_IMAGE; SPAN_MONO; IMAGE_SUBSET; + SUBSET_TRANS; SUBSET_DIFF; SPAN_EQ_SELF]] THEN + SIMP_TAC[SUBSET; FORALL_IN_IMAGE] THEN X_GEN_TAC `x:real^M` THEN + DISCH_TAC THEN UNDISCH_TAC `span w:real^M->bool = s` THEN + REWRITE_TAC[EXTENSION] THEN DISCH_THEN(MP_TAC o SPEC `x:real^M`) THEN + ASM_REWRITE_TAC[] THEN + REMOVE_THEN "*" (MP_TAC o SPEC `x:real^M`) THEN + (CONV_TAC o GEN_SIMPLIFY_CONV TOP_DEPTH_SQCONV (basic_ss []) 4) + [IN_UNIV; SPAN_FINITE; INDEPENDENT_IMP_FINITE; IN_ELIM_THM; + FINITE_IMAGE; FINITE_DIFF; ASSUME `independent(w:real^M->bool)`] THEN + REWRITE_TAC[IMP_CONJ; LEFT_IMP_EXISTS_THM] THEN DISCH_TAC THEN + X_GEN_TAC `u:real^M->real` THEN DISCH_THEN(SUBST1_TAC o SYM) THEN + FIRST_ASSUM(MP_TAC o GEN_REWRITE_RULE I [INJECTIVE_ON_LEFT_INVERSE]) THEN + DISCH_THEN(X_CHOOSE_TAC `g:real^N->real^M`) THEN + EXISTS_TAC `(u:real^M->real) o (g:real^N->real^M)` THEN + W(MP_TAC o PART_MATCH (lhs o rand) VSUM_IMAGE o lhand o snd) THEN + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[FINITE_DIFF; INDEPENDENT_IMP_FINITE; LINEAR_VSUM] THEN + DISCH_THEN SUBST1_TAC THEN ASM_REWRITE_TAC[o_DEF] THEN + CONV_TAC SYM_CONV THEN MATCH_MP_TAC VSUM_EQ_SUPERSET THEN + SIMP_TAC[SUBSET_DIFF; FINITE_DIFF; INDEPENDENT_IMP_FINITE; + LINEAR_CMUL; IN_DIFF; TAUT `a /\ ~(a /\ ~b) <=> a /\ b`; + ASSUME `independent(w:real^M->bool)`; + ASSUME `linear(f:real^M->real^N)`] THEN + REWRITE_TAC[VECTOR_MUL_EQ_0] THEN ASM SET_TAC[]; + SUBGOAL_THEN `independent(IMAGE (f:real^M->real^N) (w DIFF v))` + ASSUME_TAC THENL + [MATCH_MP_TAC INDEPENDENT_INJECTIVE_IMAGE_GEN THEN + ASM_SIMP_TAC[LINEAR_INJECTIVE_0_SUBSPACE; SUBSPACE_SPAN] THEN + ASM_MESON_TAC[INDEPENDENT_MONO; SUBSET_DIFF]; + ASM_SIMP_TAC[DIM_SPAN; DIM_EQ_CARD] THEN + W(MP_TAC o PART_MATCH (lhs o rand) CARD_IMAGE_INJ o + lhand o lhand o snd) THEN + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[FINITE_DIFF; CARD_DIFF; INDEPENDENT_IMP_FINITE] THEN + DISCH_THEN SUBST1_TAC THEN MATCH_MP_TAC SUB_ADD THEN + ASM_MESON_TAC[CARD_SUBSET; INDEPENDENT_IMP_FINITE]]]);; + +let DIM_IMAGE_KERNEL = prove + (`!f:real^M->real^N. + linear f + ==> dim(IMAGE f (:real^M)) + dim {x | f x = vec 0} = dimindex(:M)`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPECL [`f:real^M->real^N`; `(:real^M)`] DIM_IMAGE_KERNEL_GEN) THEN + ASM_REWRITE_TAC[SUBSPACE_UNIV; IN_UNIV; DIM_UNIV]);; + +let DIM_SUMS_INTER = prove + (`!s t:real^N->bool. + subspace s /\ subspace t + ==> dim {x + y | x IN s /\ y IN t} + dim(s INTER t) = dim(s) + dim(t)`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPEC `s INTER t:real^N->bool` BASIS_EXISTS) THEN + DISCH_THEN(X_CHOOSE_THEN `b:real^N->bool` STRIP_ASSUME_TAC) THEN + MP_TAC(ISPECL [`b:real^N->bool`; `s:real^N->bool`] + MAXIMAL_INDEPENDENT_SUBSET_EXTEND) THEN + ANTS_TAC THENL [ASM SET_TAC[]; ALL_TAC] THEN + DISCH_THEN(X_CHOOSE_THEN `c:real^N->bool` STRIP_ASSUME_TAC) THEN + MP_TAC(ISPECL [`b:real^N->bool`; `t:real^N->bool`] + MAXIMAL_INDEPENDENT_SUBSET_EXTEND) THEN + ANTS_TAC THENL [ASM SET_TAC[]; ALL_TAC] THEN + DISCH_THEN(X_CHOOSE_THEN `d:real^N->bool` STRIP_ASSUME_TAC) THEN + SUBGOAL_THEN `(c:real^N->bool) INTER d = b` ASSUME_TAC THENL + [MATCH_MP_TAC SUBSET_ANTISYM THEN ASM_REWRITE_TAC[SUBSET_INTER] THEN + REWRITE_TAC[SUBSET; IN_INTER] THEN X_GEN_TAC `x:real^N` THEN + STRIP_TAC THEN MP_TAC(ISPEC `c:real^N->bool` independent) THEN + ASM_REWRITE_TAC[dependent; NOT_EXISTS_THM] THEN + DISCH_THEN(MP_TAC o SPEC `x:real^N`) THEN ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN STRIP_TAC THEN + REWRITE_TAC[] THEN + SUBGOAL_THEN `(x:real^N) IN span b` MP_TAC THENL + [ASM_MESON_TAC[SUBSET; IN_INTER; SPAN_INC]; + MP_TAC(ISPECL [`b:real^N->bool`; `c DELETE (x:real^N)`] SPAN_MONO) THEN + ASM SET_TAC[]]; + ALL_TAC] THEN + SUBGOAL_THEN + `dim (s INTER t:real^N->bool) = CARD(b:real^N->bool) /\ + dim s = CARD c /\ dim t = CARD d /\ + dim {x + y:real^N | x IN s /\ y IN t} = CARD(c UNION d:real^N->bool)` + (REPEAT_TCL CONJUNCTS_THEN SUBST1_TAC) THENL + [ALL_TAC; + ASM_SIMP_TAC[CARD_UNION_GEN; INDEPENDENT_IMP_FINITE] THEN + MATCH_MP_TAC(ARITH_RULE `b:num <= c ==> (c + d) - b + b = c + d`) THEN + ASM_SIMP_TAC[CARD_SUBSET; INDEPENDENT_IMP_FINITE]] THEN + REPEAT CONJ_TAC THEN MATCH_MP_TAC DIM_UNIQUE THENL + [EXISTS_TAC `b:real^N->bool`; + EXISTS_TAC `c:real^N->bool`; + EXISTS_TAC `d:real^N->bool`; + EXISTS_TAC `c UNION d:real^N->bool`] THEN + ASM_SIMP_TAC[HAS_SIZE; INDEPENDENT_IMP_FINITE; FINITE_UNION] THEN + REWRITE_TAC[UNION_SUBSET; GSYM CONJ_ASSOC] THEN + REWRITE_TAC[SUBSET; IN_ELIM_THM; FORALL_IN_GSPEC] THEN REPEAT CONJ_TAC THENL + [X_GEN_TAC `x:real^N` THEN DISCH_TAC THEN + MAP_EVERY EXISTS_TAC [`x:real^N`; `vec 0:real^N`] THEN + ASM_SIMP_TAC[SUBSPACE_0; VECTOR_ADD_RID] THEN ASM SET_TAC[]; + X_GEN_TAC `x:real^N` THEN DISCH_TAC THEN + MAP_EVERY EXISTS_TAC [`vec 0:real^N`; `x:real^N`] THEN + ASM_SIMP_TAC[SUBSPACE_0; VECTOR_ADD_LID] THEN ASM SET_TAC[]; + MAP_EVERY X_GEN_TAC [`x:real^N`; `y:real^N`] THEN STRIP_TAC THEN + MATCH_MP_TAC SPAN_ADD THEN CONJ_TAC THENL + [MP_TAC(ISPECL[`c:real^N->bool`; `c UNION d:real^N->bool`] SPAN_MONO); + MP_TAC(ISPECL[`d:real^N->bool`; `c UNION d:real^N->bool`] SPAN_MONO)] THEN + REWRITE_TAC[SUBSET_UNION] THEN REWRITE_TAC[SUBSET] THEN + DISCH_THEN MATCH_MP_TAC THEN ASM SET_TAC[]; + ALL_TAC] THEN + ASM_SIMP_TAC[INDEPENDENT_EXPLICIT; FINITE_UNION; INDEPENDENT_IMP_FINITE] THEN + X_GEN_TAC `a:real^N->real` THEN + GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) + [SET_RULE `s UNION t = s UNION (t DIFF s)`] THEN + ASM_SIMP_TAC[VSUM_UNION; SET_RULE `DISJOINT c (d DIFF c)`; + INDEPENDENT_IMP_FINITE; FINITE_DIFF; FINITE_UNION] THEN + DISCH_TAC THEN + SUBGOAL_THEN + `(vsum (d DIFF c) (\v:real^N. a v % v)) IN span b` + MP_TAC THENL + [FIRST_ASSUM(MATCH_MP_TAC o GEN_REWRITE_RULE I [SUBSET]) THEN + REWRITE_TAC[IN_INTER] THEN CONJ_TAC THENL + [FIRST_X_ASSUM(SUBST1_TAC o MATCH_MP (VECTOR_ARITH + `a + b = vec 0 ==> b = --a`)) THEN + MATCH_MP_TAC SUBSPACE_NEG THEN ASM_REWRITE_TAC[]; + ALL_TAC] THEN + MATCH_MP_TAC SUBSPACE_VSUM THEN + ASM_SIMP_TAC[FINITE_DIFF; INDEPENDENT_IMP_FINITE] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC SUBSPACE_MUL THEN + ASM_REWRITE_TAC[] THEN ASM SET_TAC[]; + ALL_TAC] THEN + ASM_SIMP_TAC[SPAN_FINITE; INDEPENDENT_IMP_FINITE; IN_ELIM_THM] THEN + DISCH_THEN(X_CHOOSE_TAC `e:real^N->real`) THEN + MP_TAC(ISPEC `c:real^N->bool` INDEPENDENT_EXPLICIT) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC + (MP_TAC o SPEC `(\x. if x IN b then a x + e x else a x):real^N->real`)) THEN + REWRITE_TAC[] THEN ONCE_REWRITE_TAC[COND_RAND] THEN + ONCE_REWRITE_TAC[COND_RATOR] THEN ASM_SIMP_TAC[VSUM_CASES] THEN + REWRITE_TAC[VECTOR_ADD_RDISTRIB; GSYM DIFF] THEN + ASM_SIMP_TAC[SET_RULE `b SUBSET c ==> {x | x IN c /\ x IN b} = b`] THEN + ASM_SIMP_TAC[VSUM_ADD; INDEPENDENT_IMP_FINITE] THEN + ONCE_REWRITE_TAC[VECTOR_ARITH `(a + b) + c:real^N = (a + c) + b`] THEN + ASM_SIMP_TAC[GSYM VSUM_UNION; FINITE_DIFF; INDEPENDENT_IMP_FINITE; + SET_RULE `DISJOINT b (c DIFF b)`] THEN + ASM_SIMP_TAC[SET_RULE `b SUBSET c ==> b UNION (c DIFF b) = c`] THEN + DISCH_TAC THEN + SUBGOAL_THEN `!v:real^N. v IN (c DIFF b) ==> a v = &0` ASSUME_TAC THENL + [ASM SET_TAC[]; ALL_TAC] THEN + MP_TAC(ISPEC `d:real^N->bool` INDEPENDENT_EXPLICIT) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC + (MP_TAC o SPEC `a:real^N->real`)) THEN + SUBGOAL_THEN `d:real^N->bool = b UNION (d DIFF c)` + (fun th -> GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [th]) + THENL [ASM SET_TAC[]; ALL_TAC] THEN + ANTS_TAC THENL [ALL_TAC; ASM SET_TAC[]] THEN + ASM_SIMP_TAC[VSUM_UNION; FINITE_DIFF; INDEPENDENT_IMP_FINITE; + SET_RULE `c INTER d = b ==> DISJOINT b (d DIFF c)`] THEN + SUBGOAL_THEN `vsum b (\x:real^N. a x % x) = vsum c (\x. a x % x)` + (fun th -> ASM_REWRITE_TAC[th]) THEN + CONV_TAC SYM_CONV THEN MATCH_MP_TAC VSUM_SUPERSET THEN + ASM_SIMP_TAC[VECTOR_MUL_EQ_0] THEN ASM_MESON_TAC[]);; + +let DIM_KERNEL_COMPOSE = prove + (`!f:real^M->real^N g:real^N->real^P. + linear f /\ linear g + ==> dim {x | (g o f) x = vec 0} <= + dim {x | f(x) = vec 0} + + dim {y | g(y) = vec 0}`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPEC `{x | (f:real^M->real^N) x = vec 0}` BASIS_EXISTS_FINITE) THEN + DISCH_THEN(X_CHOOSE_THEN `b:real^M->bool` STRIP_ASSUME_TAC) THEN + SUBGOAL_THEN + `?c. FINITE c /\ + IMAGE f c SUBSET {y | g(y):real^P = vec 0} /\ + independent (IMAGE (f:real^M->real^N) c) /\ + IMAGE f (:real^M) INTER {y | g(y) = vec 0} SUBSET span(IMAGE f c) /\ + (!x y. x IN c /\ y IN c ==> (f x = f y <=> x = y)) /\ + (IMAGE f c) HAS_SIZE dim (IMAGE f (:real^M) INTER {y | g(y) = vec 0})` + STRIP_ASSUME_TAC THENL + [MP_TAC(ISPEC `IMAGE (f:real^M->real^N) (:real^M) INTER + {x | (g:real^N->real^P) x = vec 0}` BASIS_EXISTS_FINITE) THEN + REWRITE_TAC[SUBSET_INTER; GSYM CONJ_ASSOC; EXISTS_FINITE_SUBSET_IMAGE] THEN + DISCH_THEN(X_CHOOSE_THEN `c:real^M->bool` STRIP_ASSUME_TAC) THEN + MP_TAC(ISPECL [`f:real^M->real^N`; `c:real^M->bool`] + IMAGE_INJECTIVE_IMAGE_OF_SUBSET) THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `d:real^M->bool` THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC + (CONJUNCTS_THEN2 SUBST_ALL_TAC ASSUME_TAC)) THEN + ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[FINITE_SUBSET]; + ALL_TAC] THEN + MATCH_MP_TAC LE_TRANS THEN + EXISTS_TAC `dim(span(b UNION c:real^M->bool))` THEN CONJ_TAC THENL + [MATCH_MP_TAC DIM_SUBSET THEN + REWRITE_TAC[SUBSET; FORALL_IN_GSPEC; o_THM] THEN + X_GEN_TAC `x:real^M` THEN DISCH_TAC THEN + SUBGOAL_THEN `(f:real^M->real^N) x IN span(IMAGE f c)` MP_TAC THENL + [ASM SET_TAC[]; ALL_TAC] THEN + ASM_SIMP_TAC[SPAN_LINEAR_IMAGE; IN_IMAGE; LEFT_IMP_EXISTS_THM] THEN + X_GEN_TAC `y:real^M` THEN STRIP_TAC THEN + SUBST1_TAC(VECTOR_ARITH `x:real^M = y + (x - y)`) THEN + MATCH_MP_TAC SPAN_ADD THEN CONJ_TAC THENL + [ASM_MESON_TAC[SUBSET_UNION; SPAN_MONO; SUBSET]; ALL_TAC] THEN + MATCH_MP_TAC(SET_RULE + `!t. x IN t /\ t SUBSET s ==> x IN s`) THEN + EXISTS_TAC `{x | (f:real^M->real^N) x = vec 0}` THEN CONJ_TAC THENL + [REWRITE_TAC[IN_ELIM_THM] THEN ASM_MESON_TAC[LINEAR_SUB; VECTOR_SUB_EQ]; + ASM_MESON_TAC[SUBSET_TRANS; SUBSET_UNION; SPAN_MONO]]; + REWRITE_TAC[DIM_SPAN] THEN MATCH_MP_TAC LE_TRANS THEN + EXISTS_TAC `CARD(b UNION c:real^M->bool)` THEN + ASM_SIMP_TAC[DIM_LE_CARD; FINITE_UNION; INDEPENDENT_IMP_FINITE] THEN + MATCH_MP_TAC LE_TRANS THEN + EXISTS_TAC `CARD(b:real^M->bool) + CARD(c:real^M->bool)` THEN + ASM_SIMP_TAC[CARD_UNION_LE] THEN MATCH_MP_TAC LE_ADD2 THEN CONJ_TAC THENL + [ASM_SIMP_TAC[GSYM DIM_EQ_CARD; DIM_SUBSET]; ALL_TAC] THEN + MATCH_MP_TAC LE_TRANS THEN + EXISTS_TAC `dim(IMAGE (f:real^M->real^N) c)` THEN CONJ_TAC THENL + [ASM_SIMP_TAC[DIM_EQ_CARD] THEN + ASM_MESON_TAC[CARD_IMAGE_INJ; LE_REFL]; + ASM_SIMP_TAC[GSYM DIM_EQ_CARD; DIM_SUBSET]]]);; + +let DIM_ORTHOGONAL_SUM = prove + (`!s t:real^N->bool. + (!x y. x IN s /\ y IN t ==> x dot y = &0) + ==> dim(s UNION t) = dim(s) + dim(t)`, + REPEAT STRIP_TAC THEN ONCE_REWRITE_TAC[GSYM DIM_SPAN] THEN + REWRITE_TAC[SPAN_UNION] THEN + SIMP_TAC[GSYM DIM_SUMS_INTER; SUBSPACE_SPAN] THEN + REWRITE_TAC[ARITH_RULE `x = x + y <=> y = 0`] THEN + REWRITE_TAC[DIM_EQ_0; SUBSET; IN_INTER] THEN + SUBGOAL_THEN + `!x:real^N. x IN span s ==> !y:real^N. y IN span t ==> x dot y = &0` + MP_TAC THENL + [MATCH_MP_TAC SPAN_INDUCT THEN CONJ_TAC THENL + [X_GEN_TAC `x:real^N` THEN DISCH_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN + MATCH_MP_TAC SPAN_INDUCT THEN ASM_SIMP_TAC[IN_ELIM_THM] THEN + SIMP_TAC[subspace; IN_ELIM_THM; DOT_RMUL; DOT_RADD; DOT_RZERO] THEN + REAL_ARITH_TAC; + SIMP_TAC[subspace; IN_ELIM_THM; DOT_LMUL; DOT_LADD; DOT_LZERO] THEN + REAL_ARITH_TAC]; + REWRITE_TAC[IN_SING] THEN MESON_TAC[DOT_EQ_0]]);; + +(* ------------------------------------------------------------------------- *) +(* More about rank from the rank/nullspace formula. *) +(* ------------------------------------------------------------------------- *) + +let RANK_NULLSPACE = prove + (`!A:real^M^N. rank A + dim {x | A ** x = vec 0} = dimindex(:M)`, + GEN_TAC THEN REWRITE_TAC[RANK_DIM_IM] THEN + MATCH_MP_TAC DIM_IMAGE_KERNEL THEN + REWRITE_TAC[MATRIX_VECTOR_MUL_LINEAR]);; + +let RANK_SYLVESTER = prove + (`!A:real^N^M B:real^P^N. + rank(A) + rank(B) <= rank(A ** B) + dimindex(:N)`, + REPEAT GEN_TAC THEN MATCH_MP_TAC(ARITH_RULE + `!ia ib iab p:num. + ra + ia = n /\ + rb + ib = p /\ + rab + iab = p /\ + iab <= ia + ib + ==> ra + rb <= rab + n`) THEN + MAP_EVERY EXISTS_TAC + [`dim {x | (A:real^N^M) ** x = vec 0}`; + `dim {x | (B:real^P^N) ** x = vec 0}`; + `dim {x | ((A:real^N^M) ** (B:real^P^N)) ** x = vec 0}`; + `dimindex(:P)`] THEN + REWRITE_TAC[RANK_NULLSPACE] THEN + REWRITE_TAC[GSYM MATRIX_VECTOR_MUL_ASSOC] THEN + ONCE_REWRITE_TAC[ADD_SYM] THEN + MATCH_MP_TAC(REWRITE_RULE[o_DEF] DIM_KERNEL_COMPOSE) THEN + CONJ_TAC THEN GEN_REWRITE_TAC RAND_CONV [GSYM ETA_AX] THEN + REWRITE_TAC[MATRIX_VECTOR_MUL_LINEAR]);; + +let RANK_GRAM = prove + (`!A:real^M^N. rank(transp A ** A) = rank A`, + GEN_TAC THEN MATCH_MP_TAC(ARITH_RULE + `!n n' k. r + n:num = k /\ r' + n' = k /\ n = n' ==> r = r'`) THEN + MAP_EVERY EXISTS_TAC + [`dim {x | (transp A ** (A:real^M^N)) ** x = vec 0}`; + `dim {x | (A:real^M^N) ** x = vec 0}`; + `dimindex(:M)`] THEN + REWRITE_TAC[RANK_NULLSPACE] THEN AP_TERM_TAC THEN + MATCH_MP_TAC SUBSET_ANTISYM THEN + SIMP_TAC[SUBSET; IN_ELIM_THM; GSYM MATRIX_VECTOR_MUL_ASSOC; + MATRIX_VECTOR_MUL_RZERO] THEN + X_GEN_TAC `x:real^M` THEN + DISCH_THEN(MP_TAC o AP_TERM `(dot) (x:real^M)`) THEN + ONCE_REWRITE_TAC[GSYM DOT_LMUL_MATRIX] THEN + REWRITE_TAC[VECTOR_MATRIX_MUL_TRANSP; TRANSP_TRANSP; DOT_RZERO] THEN + REWRITE_TAC[DOT_EQ_0]);; + +let RANK_TRIANGLE = prove + (`!A B:real^M^N. rank(A + B) <= rank(A) + rank(B)`, + REPEAT GEN_TAC THEN REWRITE_TAC[RANK_DIM_IM] THEN + MP_TAC(ISPECL [`IMAGE (\x. (A:real^M^N) ** x) (:real^M)`; + `IMAGE (\x. (B:real^M^N) ** x) (:real^M)`] + DIM_SUMS_INTER) THEN + ASM_SIMP_TAC[SUBSPACE_LINEAR_IMAGE; SUBSPACE_UNIV; + MATRIX_VECTOR_MUL_LINEAR] THEN + DISCH_THEN(SUBST1_TAC o SYM) THEN + MATCH_MP_TAC(ARITH_RULE `x:num <= y ==> x <= y + z`) THEN + MATCH_MP_TAC DIM_SUBSET THEN + REWRITE_TAC[SUBSET; FORALL_IN_IMAGE; IN_UNIV; + MATRIX_VECTOR_MUL_ADD_RDISTRIB] THEN + REWRITE_TAC[IN_ELIM_THM; IN_IMAGE; IN_UNIV] THEN MESON_TAC[]);; + +(* ------------------------------------------------------------------------- *) +(* Infinity norm. *) +(* ------------------------------------------------------------------------- *) + +let infnorm = define + `infnorm (x:real^N) = sup { abs(x$i) | 1 <= i /\ i <= dimindex(:N) }`;; + +let NUMSEG_DIMINDEX_NONEMPTY = prove + (`?i. i IN 1..dimindex(:N)`, + REWRITE_TAC[MEMBER_NOT_EMPTY; NUMSEG_EMPTY; NOT_LT; DIMINDEX_GE_1]);; + +let INFNORM_SET_IMAGE = prove + (`{abs(x$i) | 1 <= i /\ i <= dimindex(:N)} = + IMAGE (\i. abs(x$i)) (1..dimindex(:N))`, + REWRITE_TAC[numseg] THEN SET_TAC[]);; + +let INFNORM_SET_LEMMA = prove + (`FINITE {abs((x:real^N)$i) | 1 <= i /\ i <= dimindex(:N)} /\ + ~({abs(x$i) | 1 <= i /\ i <= dimindex(:N)} = {})`, + SIMP_TAC[INFNORM_SET_IMAGE; FINITE_NUMSEG; FINITE_IMAGE; IMAGE_EQ_EMPTY] THEN + REWRITE_TAC[NUMSEG_EMPTY; NOT_LT; DIMINDEX_GE_1]);; + +let INFNORM_POS_LE = prove + (`!x. &0 <= infnorm x`, + REWRITE_TAC[infnorm] THEN + SIMP_TAC[REAL_LE_SUP_FINITE; INFNORM_SET_LEMMA] THEN + REWRITE_TAC[INFNORM_SET_IMAGE; NUMSEG_DIMINDEX_NONEMPTY; + EXISTS_IN_IMAGE; REAL_ABS_POS]);; + +let INFNORM_TRIANGLE = prove + (`!x y. infnorm(x + y) <= infnorm x + infnorm y`, + REWRITE_TAC[infnorm] THEN + SIMP_TAC[REAL_SUP_LE_FINITE; INFNORM_SET_LEMMA] THEN + ONCE_REWRITE_TAC[GSYM REAL_LE_SUB_RADD] THEN + SIMP_TAC[REAL_LE_SUP_FINITE; INFNORM_SET_LEMMA] THEN + ONCE_REWRITE_TAC[REAL_ARITH `x - y <= z <=> x - z <= y`] THEN + SIMP_TAC[REAL_LE_SUP_FINITE; INFNORM_SET_LEMMA] THEN + REWRITE_TAC[INFNORM_SET_IMAGE; FORALL_IN_IMAGE; EXISTS_IN_IMAGE] THEN + SIMP_TAC[VECTOR_ADD_COMPONENT; GSYM IN_NUMSEG] THEN + MESON_TAC[NUMSEG_DIMINDEX_NONEMPTY; + REAL_ARITH `abs(x + y) - abs(x) <= abs(y)`]);; + +let INFNORM_EQ_0 = prove + (`!x. infnorm x = &0 <=> x = vec 0`, + REWRITE_TAC[GSYM REAL_LE_ANTISYM; INFNORM_POS_LE] THEN + SIMP_TAC[infnorm; REAL_SUP_LE_FINITE; INFNORM_SET_LEMMA] THEN + SIMP_TAC[FORALL_IN_IMAGE; INFNORM_SET_IMAGE; CART_EQ; VEC_COMPONENT] THEN + REWRITE_TAC[IN_NUMSEG; REAL_ARITH `abs(x) <= &0 <=> x = &0`]);; + +let INFNORM_0 = prove + (`infnorm(vec 0) = &0`, + REWRITE_TAC[INFNORM_EQ_0]);; + +let INFNORM_NEG = prove + (`!x. infnorm(--x) = infnorm x`, + GEN_TAC THEN REWRITE_TAC[infnorm] THEN AP_TERM_TAC THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN + MESON_TAC[REAL_ABS_NEG; VECTOR_NEG_COMPONENT]);; + +let INFNORM_SUB = prove + (`!x y. infnorm(x - y) = infnorm(y - x)`, + MESON_TAC[INFNORM_NEG; VECTOR_NEG_SUB]);; + +let REAL_ABS_SUB_INFNORM = prove + (`abs(infnorm x - infnorm y) <= infnorm(x - y)`, + MATCH_MP_TAC(REAL_ARITH + `nx <= n + ny /\ ny <= n + nx ==> abs(nx - ny) <= n`) THEN + MESON_TAC[INFNORM_SUB; VECTOR_SUB_ADD2; INFNORM_TRIANGLE; VECTOR_ADD_SYM]);; + +let REAL_ABS_INFNORM = prove + (`!x. abs(infnorm x) = infnorm x`, + REWRITE_TAC[real_abs; INFNORM_POS_LE]);; + +let COMPONENT_LE_INFNORM = prove + (`!x:real^N i. 1 <= i /\ i <= dimindex (:N) ==> abs(x$i) <= infnorm x`, + REPEAT GEN_TAC THEN REWRITE_TAC[infnorm] THEN + MP_TAC(SPEC `{ abs((x:real^N)$i) | 1 <= i /\ i <= dimindex(:N) }` + SUP_FINITE) THEN + REWRITE_TAC[INFNORM_SET_LEMMA] THEN + SIMP_TAC[INFNORM_SET_IMAGE; FORALL_IN_IMAGE; IN_NUMSEG]);; + +let INFNORM_MUL_LEMMA = prove + (`!a x. infnorm(a % x) <= abs a * infnorm x`, + REPEAT STRIP_TAC THEN GEN_REWRITE_TAC LAND_CONV [infnorm] THEN + SIMP_TAC[REAL_SUP_LE_FINITE; INFNORM_SET_LEMMA] THEN + REWRITE_TAC[FORALL_IN_IMAGE; INFNORM_SET_IMAGE] THEN + SIMP_TAC[REAL_ABS_MUL; VECTOR_MUL_COMPONENT; IN_NUMSEG] THEN + SIMP_TAC[COMPONENT_LE_INFNORM; REAL_LE_LMUL; REAL_ABS_POS]);; + +let INFNORM_MUL = prove + (`!a x:real^N. infnorm(a % x) = abs a * infnorm x`, + REPEAT GEN_TAC THEN ASM_CASES_TAC `a = &0` THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; INFNORM_0; REAL_ABS_0; REAL_MUL_LZERO] THEN + REWRITE_TAC[GSYM REAL_LE_ANTISYM; INFNORM_MUL_LEMMA] THEN + GEN_REWRITE_TAC (LAND_CONV o funpow 2 RAND_CONV) [GSYM VECTOR_MUL_LID] THEN + FIRST_ASSUM(SUBST1_TAC o SYM o MATCH_MP REAL_MUL_LINV) THEN + REWRITE_TAC[GSYM VECTOR_MUL_ASSOC] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `abs(a) * abs(inv a) * infnorm(a % x:real^N)` THEN + ASM_SIMP_TAC[INFNORM_MUL_LEMMA; REAL_LE_LMUL; REAL_ABS_POS] THEN + ASM_SIMP_TAC[REAL_MUL_ASSOC; GSYM REAL_ABS_MUL; REAL_MUL_RINV] THEN + REAL_ARITH_TAC);; + +let INFNORM_POS_LT = prove + (`!x. &0 < infnorm x <=> ~(x = vec 0)`, + MESON_TAC[REAL_LT_LE; INFNORM_POS_LE; INFNORM_EQ_0]);; + +(* ------------------------------------------------------------------------- *) +(* Prove that it differs only up to a bound from Euclidean norm. *) +(* ------------------------------------------------------------------------- *) + +let INFNORM_LE_NORM = prove + (`!x. infnorm(x) <= norm(x)`, + SIMP_TAC[infnorm; REAL_SUP_LE_FINITE; INFNORM_SET_LEMMA] THEN + REWRITE_TAC[IN_ELIM_THM] THEN MESON_TAC[COMPONENT_LE_NORM]);; + +let NORM_LE_INFNORM = prove + (`!x:real^N. norm(x) <= sqrt(&(dimindex(:N))) * infnorm(x)`, + GEN_TAC THEN GEN_REWRITE_TAC (RAND_CONV o LAND_CONV o funpow 2 RAND_CONV) + [GSYM CARD_NUMSEG_1] THEN + REWRITE_TAC[vector_norm] THEN MATCH_MP_TAC REAL_LE_LSQRT THEN + SIMP_TAC[DOT_POS_LE; SQRT_POS_LE; REAL_POS; REAL_LE_MUL; INFNORM_POS_LE; + SQRT_POW_2; REAL_POW_MUL] THEN + REWRITE_TAC[dot] THEN MATCH_MP_TAC SUM_BOUND THEN + REWRITE_TAC[FINITE_NUMSEG; IN_NUMSEG] THEN REPEAT STRIP_TAC THEN + REWRITE_TAC[GSYM REAL_POW_2] THEN ONCE_REWRITE_TAC[GSYM REAL_POW2_ABS] THEN + MATCH_MP_TAC REAL_POW_LE2 THEN REWRITE_TAC[REAL_ABS_POS] THEN + MATCH_MP_TAC(REAL_ARITH `x <= y ==> x <= abs(y)`) THEN + SIMP_TAC[infnorm; REAL_LE_SUP_FINITE; INFNORM_SET_LEMMA] THEN + REWRITE_TAC[IN_ELIM_THM] THEN ASM_MESON_TAC[REAL_LE_REFL]);; + +(* ------------------------------------------------------------------------- *) +(* Equality in Cauchy-Schwarz and triangle inequalities. *) +(* ------------------------------------------------------------------------- *) + +let NORM_CAUCHY_SCHWARZ_EQ = prove + (`!x:real^N y. x dot y = norm(x) * norm(y) <=> norm(x) % y = norm(y) % x`, + REPEAT STRIP_TAC THEN + MAP_EVERY ASM_CASES_TAC [`x:real^N = vec 0`; `y:real^N = vec 0`] THEN + ASM_REWRITE_TAC[NORM_0; REAL_MUL_LZERO; REAL_MUL_RZERO; + DOT_LZERO; DOT_RZERO; VECTOR_MUL_LZERO; VECTOR_MUL_RZERO] THEN + MP_TAC(ISPEC `norm(y:real^N) % x - norm(x:real^N) % y` DOT_EQ_0) THEN + REWRITE_TAC[DOT_RSUB; DOT_LSUB; DOT_LMUL; DOT_RMUL; GSYM NORM_POW_2; + REAL_POW_2; VECTOR_SUB_EQ] THEN + REWRITE_TAC[DOT_SYM; REAL_ARITH + `y * (y * x * x - x * d) - x * (y * d - x * y * y) = + &2 * x * y * (x * y - d)`] THEN + ASM_SIMP_TAC[REAL_ENTIRE; NORM_EQ_0; REAL_SUB_0; REAL_OF_NUM_EQ; ARITH] THEN + REWRITE_TAC[EQ_SYM_EQ]);; + +let NORM_CAUCHY_SCHWARZ_ABS_EQ = prove + (`!x:real^N y. abs(x dot y) = norm(x) * norm(y) <=> + norm(x) % y = norm(y) % x \/ norm(x) % y = --norm(y) % x`, + SIMP_TAC[REAL_ARITH `&0 <= a ==> (abs x = a <=> x = a \/ --x = a)`; + REAL_LE_MUL; NORM_POS_LE; GSYM DOT_RNEG] THEN + REPEAT GEN_TAC THEN + GEN_REWRITE_TAC (LAND_CONV o funpow 3 RAND_CONV) [GSYM NORM_NEG] THEN + REWRITE_TAC[NORM_CAUCHY_SCHWARZ_EQ] THEN REWRITE_TAC[NORM_NEG] THEN + BINOP_TAC THEN VECTOR_ARITH_TAC);; + +let NORM_TRIANGLE_EQ = prove + (`!x y:real^N. norm(x + y) = norm(x) + norm(y) <=> norm(x) % y = norm(y) % x`, + REPEAT GEN_TAC THEN REWRITE_TAC[GSYM NORM_CAUCHY_SCHWARZ_EQ] THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `norm(x + y:real^N) pow 2 = (norm(x) + norm(y)) pow 2` THEN + CONJ_TAC THENL + [REWRITE_TAC[REAL_RING `x pow 2 = y pow 2 <=> x = y \/ x + y = &0`] THEN + MAP_EVERY (MP_TAC o C ISPEC NORM_POS_LE) + [`x + y:real^N`; `x:real^N`; `y:real^N`] THEN + REAL_ARITH_TAC; + REWRITE_TAC[NORM_POW_2; DOT_LADD; DOT_RADD; REAL_ARITH + `(x + y) pow 2 = x pow 2 + y pow 2 + &2 * x * y`] THEN + REWRITE_TAC[DOT_SYM] THEN REAL_ARITH_TAC]);; + +let DIST_TRIANGLE_EQ = prove + (`!x y z. dist(x,z) = dist(x,y) + dist(y,z) <=> + norm (x - y) % (y - z) = norm (y - z) % (x - y)`, + REWRITE_TAC[GSYM NORM_TRIANGLE_EQ] THEN NORM_ARITH_TAC);; + +let NORM_CROSS_MULTIPLY = prove + (`!a b x y:real^N. + a % x = b % y /\ &0 < a /\ &0 < b + ==> norm y % x = norm x % y`, + REPEAT GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN2 MP_TAC STRIP_ASSUME_TAC) THEN + ASM_CASES_TAC `y:real^N = vec 0` THEN + ASM_SIMP_TAC[VECTOR_MUL_EQ_0; REAL_LT_IMP_NZ; VECTOR_MUL_RZERO] THEN + DISCH_THEN(MP_TAC o AP_TERM `\x:real^N. inv(a) % x`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; REAL_LT_IMP_NZ; VECTOR_MUL_LID; + NORM_MUL; REAL_ABS_MUL; REAL_ABS_INV] THEN + ASM_SIMP_TAC[real_abs; REAL_LT_IMP_LE; REAL_MUL_AC]);; + +(* ------------------------------------------------------------------------- *) +(* Collinearity. *) +(* ------------------------------------------------------------------------- *) + +let collinear = new_definition + `collinear s <=> ?u. !x y. x IN s /\ y IN s ==> ?c. x - y = c % u`;; + +let COLLINEAR_SUBSET = prove + (`!s t. collinear t /\ s SUBSET t ==> collinear s`, + REWRITE_TAC[collinear] THEN SET_TAC[]);; + +let COLLINEAR_EMPTY = prove + (`collinear {}`, + REWRITE_TAC[collinear; NOT_IN_EMPTY]);; + +let COLLINEAR_SING = prove + (`!x. collinear {x}`, + SIMP_TAC[collinear; IN_SING; VECTOR_SUB_REFL] THEN + MESON_TAC[VECTOR_MUL_LZERO]);; + +let COLLINEAR_2 = prove + (`!x y:real^N. collinear {x,y}`, + REPEAT GEN_TAC THEN REWRITE_TAC[collinear; IN_INSERT; NOT_IN_EMPTY] THEN + EXISTS_TAC `x - y:real^N` THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [EXISTS_TAC `&0`; EXISTS_TAC `&1`; EXISTS_TAC `-- &1`; EXISTS_TAC `&0`] THEN + VECTOR_ARITH_TAC);; + +let COLLINEAR_SMALL = prove + (`!s. FINITE s /\ CARD s <= 2 ==> collinear s`, + REWRITE_TAC[ARITH_RULE `s <= 2 <=> s = 0 \/ s = 1 \/ s = 2`] THEN + REWRITE_TAC[LEFT_OR_DISTRIB; GSYM HAS_SIZE] THEN + CONV_TAC(ONCE_DEPTH_CONV HAS_SIZE_CONV) THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[COLLINEAR_EMPTY; COLLINEAR_SING; COLLINEAR_2]);; + +let COLLINEAR_3 = prove + (`!x y z. collinear {x,y,z} <=> collinear {vec 0,x - y,z - y}`, + REPEAT GEN_TAC THEN + REWRITE_TAC[collinear; FORALL_IN_INSERT; IMP_CONJ; RIGHT_FORALL_IMP_THM; + NOT_IN_EMPTY] THEN + AP_TERM_TAC THEN ABS_TAC THEN + MESON_TAC[VECTOR_ARITH `x - y = (x - y) - vec 0`; + VECTOR_ARITH `y - x = vec 0 - (x - y)`; + VECTOR_ARITH `x - z:real^N = (x - y) - (z - y)`]);; + +let COLLINEAR_LEMMA = prove + (`!x y:real^N. collinear {vec 0,x,y} <=> + x = vec 0 \/ y = vec 0 \/ ?c. y = c % x`, + REPEAT GEN_TAC THEN + MAP_EVERY ASM_CASES_TAC [`x:real^N = vec 0`; `y:real^N = vec 0`] THEN + TRY(ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_SING; COLLINEAR_2] THEN NO_TAC) THEN + ASM_REWRITE_TAC[collinear] THEN EQ_TAC THENL + [DISCH_THEN(X_CHOOSE_THEN `u:real^N` + (fun th -> MP_TAC(SPECL [`x:real^N`; `vec 0:real^N`] th) THEN + MP_TAC(SPECL [`y:real^N`; `vec 0:real^N`] th))) THEN + REWRITE_TAC[IN_INSERT; VECTOR_SUB_RZERO] THEN + DISCH_THEN(X_CHOOSE_THEN `e:real` SUBST_ALL_TAC) THEN + DISCH_THEN(X_CHOOSE_THEN `d:real` SUBST_ALL_TAC) THEN + EXISTS_TAC `e / d` THEN REWRITE_TAC[VECTOR_MUL_ASSOC] THEN + RULE_ASSUM_TAC(REWRITE_RULE[VECTOR_MUL_EQ_0; DE_MORGAN_THM]) THEN + ASM_SIMP_TAC[REAL_DIV_RMUL]; + STRIP_TAC THEN EXISTS_TAC `x:real^N` THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY] THEN REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[] THENL + [EXISTS_TAC `&0`; EXISTS_TAC `-- &1`; EXISTS_TAC `--c`; + EXISTS_TAC `&1`; EXISTS_TAC `&0`; EXISTS_TAC `&1 - c`; + EXISTS_TAC `c:real`; EXISTS_TAC `c - &1`; EXISTS_TAC `&0`] THEN + VECTOR_ARITH_TAC]);; + +let COLLINEAR_LEMMA_ALT = prove + (`!x y. collinear {vec 0,x,y} <=> x = vec 0 \/ ?c. y = c % x`, + REWRITE_TAC[COLLINEAR_LEMMA] THEN MESON_TAC[VECTOR_MUL_LZERO]);; + +let NORM_CAUCHY_SCHWARZ_EQUAL = prove + (`!x y:real^N. abs(x dot y) = norm(x) * norm(y) <=> collinear {vec 0,x,y}`, + REPEAT GEN_TAC THEN REWRITE_TAC[NORM_CAUCHY_SCHWARZ_ABS_EQ] THEN + MAP_EVERY ASM_CASES_TAC [`x:real^N = vec 0`; `y:real^N = vec 0`] THEN + TRY(ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_SING; COLLINEAR_2; NORM_0; + VECTOR_MUL_LZERO; VECTOR_MUL_RZERO] THEN NO_TAC) THEN + ASM_REWRITE_TAC[COLLINEAR_LEMMA] THEN EQ_TAC THENL + [STRIP_TAC THENL + [FIRST_X_ASSUM(MP_TAC o AP_TERM + `(%) (inv(norm(x:real^N))):real^N->real^N`); + FIRST_X_ASSUM(MP_TAC o AP_TERM + `(%) (--inv(norm(x:real^N))):real^N->real^N`)] THEN + ASM_REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LNEG] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; NORM_EQ_0; VECTOR_MUL_LNEG; VECTOR_MUL_LID; + VECTOR_ARITH `--x = --y <=> x:real^N = y`] THEN + MESON_TAC[]; + STRIP_TAC THEN ASM_REWRITE_TAC[NORM_MUL; VECTOR_MUL_ASSOC] THEN + MATCH_MP_TAC(MESON[] + `t = a \/ t = b ==> t % x = a % x \/ t % x = b % x`) THEN + REWRITE_TAC[GSYM REAL_MUL_LNEG; + REAL_ARITH `x * c = d * x <=> x * (c - d) = &0`] THEN + ASM_REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0] THEN REAL_ARITH_TAC]);; + +let DOT_CAUCHY_SCHWARZ_EQUAL = prove + (`!x y:real^N. + (x dot y) pow 2 = (x dot x) * (y dot y) <=> + collinear {vec 0,x,y}`, + REWRITE_TAC[GSYM NORM_CAUCHY_SCHWARZ_EQUAL] THEN + REPEAT GEN_TAC THEN MATCH_MP_TAC(REAL_ARITH + `&0 <= y /\ (u:real = v <=> x = abs y) ==> (u = v <=> x = y)`) THEN + SIMP_TAC[NORM_POS_LE; REAL_LE_MUL] THEN + REWRITE_TAC[REAL_EQ_SQUARE_ABS] THEN REWRITE_TAC[REAL_POW_MUL; NORM_POW_2]);; + +let COLLINEAR_3_EXPAND = prove + (`!a b c:real^N. collinear{a,b,c} <=> a = c \/ ?u. b = u % a + (&1 - u) % c`, + REPEAT GEN_TAC THEN + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`] THEN + ONCE_REWRITE_TAC[COLLINEAR_3] THEN + REWRITE_TAC[COLLINEAR_LEMMA; VECTOR_SUB_EQ] THEN + ASM_CASES_TAC `a:real^N = c` THEN ASM_REWRITE_TAC[] THEN + ASM_CASES_TAC `b:real^N = c` THEN + ASM_REWRITE_TAC[VECTOR_ARITH `u % c + (&1 - u) % c = c`] THENL + [EXISTS_TAC `&0` THEN VECTOR_ARITH_TAC; + AP_TERM_TAC THEN ABS_TAC THEN VECTOR_ARITH_TAC]);; + +let COLLINEAR_TRIPLES = prove + (`!s a b:real^N. + ~(a = b) + ==> (collinear(a INSERT b INSERT s) <=> + !x. x IN s ==> collinear{a,b,x})`, + REPEAT STRIP_TAC THEN EQ_TAC THENL + [REPEAT STRIP_TAC THEN FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP + (REWRITE_RULE[IMP_CONJ] COLLINEAR_SUBSET)) THEN + ASM SET_TAC[]; + ONCE_REWRITE_TAC[SET_RULE `{a,b,x} = {a,x,b}`] THEN + ASM_REWRITE_TAC[COLLINEAR_3_EXPAND] THEN DISCH_TAC THEN + SUBGOAL_THEN + `!x:real^N. x IN (a INSERT b INSERT s) ==> ?u. x = u % a + (&1 - u) % b` + MP_TAC THENL + [ASM_REWRITE_TAC[FORALL_IN_INSERT] THEN CONJ_TAC THENL + [EXISTS_TAC `&1` THEN VECTOR_ARITH_TAC; + EXISTS_TAC `&0` THEN VECTOR_ARITH_TAC]; + POP_ASSUM_LIST(K ALL_TAC) THEN DISCH_TAC THEN + REWRITE_TAC[collinear] THEN EXISTS_TAC `b - a:real^N` THEN + MAP_EVERY X_GEN_TAC [`x:real^N`; `y:real^N`] THEN STRIP_TAC THEN + FIRST_X_ASSUM(fun th -> MP_TAC(SPEC `x:real^N` th) THEN MP_TAC(SPEC + `y:real^N` th)) THEN + ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[VECTOR_ARITH + `(u % a + (&1 - u) % b) - (v % a + (&1 - v) % b):real^N = + (v - u) % (b - a)`] THEN + MESON_TAC[]]]);; + +let COLLINEAR_4_3 = prove + (`!a b c d:real^N. + ~(a = b) + ==> (collinear {a,b,c,d} <=> collinear{a,b,c} /\ collinear{a,b,d})`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPECL [`{c:real^N,d}`; `a:real^N`; `b:real^N`] + COLLINEAR_TRIPLES) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN SUBST1_TAC THEN + REWRITE_TAC[FORALL_IN_INSERT; NOT_IN_EMPTY]);; + +let COLLINEAR_3_TRANS = prove + (`!a b c d:real^N. + collinear{a,b,c} /\ collinear{b,c,d} /\ ~(b = c) ==> collinear{a,b,d}`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC COLLINEAR_SUBSET THEN + EXISTS_TAC `{b:real^N,c,a,d}` THEN ASM_SIMP_TAC[COLLINEAR_4_3] THEN + CONJ_TAC THENL [ALL_TAC; SET_TAC[]] THEN + REPEAT(POP_ASSUM MP_TAC) THEN SIMP_TAC[INSERT_AC]);; + +let ORTHOGONAL_TO_ORTHOGONAL_2D = prove + (`!x y z:real^2. + ~(x = vec 0) /\ orthogonal x y /\ orthogonal x z + ==> collinear {vec 0,y,z}`, + REWRITE_TAC[orthogonal; GSYM DOT_CAUCHY_SCHWARZ_EQUAL; GSYM DOT_EQ_0] THEN + REWRITE_TAC[DOT_2] THEN CONV_TAC REAL_RING);; + +let COLLINEAR_3_2D = prove + (`!x y z:real^2. collinear{x,y,z} <=> + (z$1 - x$1) * (y$2 - x$2) = (y$1 - x$1) * (z$2 - x$2)`, + ONCE_REWRITE_TAC[COLLINEAR_3] THEN + REWRITE_TAC[GSYM DOT_CAUCHY_SCHWARZ_EQUAL] THEN + REWRITE_TAC[DOT_2; VECTOR_SUB_COMPONENT] THEN CONV_TAC REAL_RING);; + +(* ------------------------------------------------------------------------- *) +(* Between-ness. *) +(* ------------------------------------------------------------------------- *) + +let between = new_definition + `between x (a,b) <=> dist(a,b) = dist(a,x) + dist(x,b)`;; + +let BETWEEN_REFL = prove + (`!a b. between a (a,b) /\ between b (a,b) /\ between a (a,a)`, + REWRITE_TAC[between] THEN NORM_ARITH_TAC);; + +let BETWEEN_REFL_EQ = prove + (`!a x. between x (a,a) <=> x = a`, + REWRITE_TAC[between] THEN NORM_ARITH_TAC);; + +let BETWEEN_SYM = prove + (`!a b x. between x (a,b) <=> between x (b,a)`, + REWRITE_TAC[between] THEN NORM_ARITH_TAC);; + +let BETWEEN_ANTISYM = prove + (`!a b c. between a (b,c) /\ between b (a,c) ==> a = b`, + REWRITE_TAC[between; DIST_SYM] THEN NORM_ARITH_TAC);; + +let BETWEEN_TRANS = prove + (`!a b c d. between a (b,c) /\ between d (a,c) ==> between d (b,c)`, + REWRITE_TAC[between; DIST_SYM] THEN NORM_ARITH_TAC);; + +let BETWEEN_TRANS_2 = prove + (`!a b c d. between a (b,c) /\ between d (a,b) ==> between a (c,d)`, + REWRITE_TAC[between; DIST_SYM] THEN NORM_ARITH_TAC);; + +let BETWEEN_NORM = prove + (`!a b x:real^N. + between x (a,b) <=> norm(x - a) % (b - x) = norm(b - x) % (x - a)`, + REPEAT GEN_TAC THEN REWRITE_TAC[between; DIST_TRIANGLE_EQ] THEN + REWRITE_TAC[NORM_SUB] THEN VECTOR_ARITH_TAC);; + +let BETWEEN_DOT = prove + (`!a b x:real^N. + between x (a,b) <=> (x - a) dot (b - x) = norm(x - a) * norm(b - x)`, + REWRITE_TAC[BETWEEN_NORM; NORM_CAUCHY_SCHWARZ_EQ]);; + +let BETWEEN_IMP_COLLINEAR = prove + (`!a b x:real^N. between x (a,b) ==> collinear {a,x,b}`, + REPEAT GEN_TAC THEN MAP_EVERY + (fun t -> ASM_CASES_TAC t THEN + TRY(ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_2] THEN NO_TAC)) + [`x:real^N = a`; `x:real^N = b`; `a:real^N = b`] THEN + ONCE_REWRITE_TAC[COLLINEAR_3; BETWEEN_NORM] THEN + DISCH_TAC THEN REWRITE_TAC[COLLINEAR_LEMMA] THEN + REPEAT DISJ2_TAC THEN EXISTS_TAC `--(norm(b - x:real^N) / norm(x - a))` THEN + MATCH_MP_TAC VECTOR_MUL_LCANCEL_IMP THEN EXISTS_TAC `norm(x - a:real^N)` THEN + ASM_REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_MUL_RNEG] THEN + ASM_SIMP_TAC[REAL_DIV_LMUL; NORM_EQ_0; VECTOR_SUB_EQ] THEN + VECTOR_ARITH_TAC);; + +let COLLINEAR_BETWEEN_CASES = prove + (`!a b c:real^N. + collinear {a,b,c} <=> + between a (b,c) \/ between b (c,a) \/ between c (a,b)`, + REPEAT STRIP_TAC THEN EQ_TAC THENL + [REWRITE_TAC[COLLINEAR_3_EXPAND] THEN + ASM_CASES_TAC `c:real^N = a` THEN ASM_REWRITE_TAC[BETWEEN_REFL] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[between; dist] THEN + REWRITE_TAC[VECTOR_ARITH `(u % a + (&1 - u) % c) - c = --u % (c - a)`; + VECTOR_ARITH `(u % a + (&1 - u) % c) - a = (&1 - u) % (c - a)`; + VECTOR_ARITH `c - (u % a + (&1 - u) % c) = u % (c - a)`; + VECTOR_ARITH `a - (u % a + (&1 - u) % c) = (u - &1) % (c - a)`] THEN + REWRITE_TAC[NORM_MUL] THEN + SUBST1_TAC(NORM_ARITH `norm(a - c:real^N) = norm(c - a)`) THEN + REWRITE_TAC[REAL_ARITH `a * c + c = (a + &1) * c`; GSYM REAL_ADD_RDISTRIB; + REAL_ARITH `c + a * c = (a + &1) * c`] THEN + ASM_REWRITE_TAC[REAL_EQ_MUL_RCANCEL; + REAL_RING `n = x * n <=> n = &0 \/ x = &1`] THEN + ASM_REWRITE_TAC[NORM_EQ_0; VECTOR_SUB_EQ] THEN REAL_ARITH_TAC; + DISCH_THEN(REPEAT_TCL DISJ_CASES_THEN (MP_TAC o MATCH_MP + BETWEEN_IMP_COLLINEAR)) THEN + REWRITE_TAC[INSERT_AC]]);; + +let COLLINEAR_DIST_BETWEEN = prove + (`!a b x. collinear {x,a,b} /\ + dist(x,a) <= dist(a,b) /\ dist(x,b) <= dist(a,b) + ==> between x (a,b)`, + SIMP_TAC[COLLINEAR_BETWEEN_CASES; between; DIST_SYM] THEN NORM_ARITH_TAC);; + +let COLLINEAR_1 = prove + (`!s:real^1->bool. collinear s`, + GEN_TAC THEN MATCH_MP_TAC COLLINEAR_SUBSET THEN + EXISTS_TAC `(vec 0:real^1) INSERT (vec 1) INSERT s` THEN + CONJ_TAC THENL [ALL_TAC; SET_TAC[]] THEN + W(MP_TAC o PART_MATCH (lhs o rand) COLLINEAR_TRIPLES o snd) THEN + REWRITE_TAC[VEC_EQ; ARITH_EQ] THEN DISCH_THEN SUBST1_TAC THEN + REWRITE_TAC[COLLINEAR_BETWEEN_CASES] THEN + REWRITE_TAC[between; DIST_REAL; GSYM drop; DROP_VEC; REAL_ABS_NUM] THEN + REAL_ARITH_TAC);; + +(* ------------------------------------------------------------------------- *) +(* Midpoint between two points. *) +(* ------------------------------------------------------------------------- *) + +let midpoint = new_definition + `midpoint(a,b) = inv(&2) % (a + b)`;; + +let MIDPOINT_REFL = prove + (`!x. midpoint(x,x) = x`, + REWRITE_TAC[midpoint] THEN VECTOR_ARITH_TAC);; + +let MIDPOINT_SYM = prove + (`!a b. midpoint(a,b) = midpoint(b,a)`, + REWRITE_TAC[midpoint; VECTOR_ADD_SYM]);; + +let DIST_MIDPOINT = prove + (`!a b. dist(a,midpoint(a,b)) = dist(a,b) / &2 /\ + dist(b,midpoint(a,b)) = dist(a,b) / &2 /\ + dist(midpoint(a,b),a) = dist(a,b) / &2 /\ + dist(midpoint(a,b),b) = dist(a,b) / &2`, + REWRITE_TAC[midpoint] THEN NORM_ARITH_TAC);; + +let MIDPOINT_EQ_ENDPOINT = prove + (`!a b. (midpoint(a,b) = a <=> a = b) /\ + (midpoint(a,b) = b <=> a = b) /\ + (a = midpoint(a,b) <=> a = b) /\ + (b = midpoint(a,b) <=> a = b)`, + REWRITE_TAC[midpoint] THEN NORM_ARITH_TAC);; + +let BETWEEN_MIDPOINT = prove + (`!a b. between (midpoint(a,b)) (a,b) /\ between (midpoint(a,b)) (b,a)`, + REWRITE_TAC[between; midpoint] THEN NORM_ARITH_TAC);; + +let MIDPOINT_LINEAR_IMAGE = prove + (`!f a b. linear f ==> midpoint(f a,f b) = f(midpoint(a,b))`, + SIMP_TAC[midpoint; LINEAR_ADD; LINEAR_CMUL]);; + +let COLLINEAR_MIDPOINT = prove + (`!a b. collinear{a,midpoint(a,b),b}`, + REPEAT GEN_TAC THEN REWRITE_TAC[COLLINEAR_3_EXPAND; midpoint] THEN + DISJ2_TAC THEN EXISTS_TAC `&1 / &2` THEN VECTOR_ARITH_TAC);; + +let MIDPOINT_COLLINEAR = prove + (`!a b c:real^N. + ~(a = c) + ==> (b = midpoint(a,c) <=> collinear{a,b,c} /\ dist(a,b) = dist(b,c))`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC(TAUT `(a ==> b) /\ (b ==> (a <=> c)) ==> (a <=> b /\ c)`) THEN + SIMP_TAC[COLLINEAR_MIDPOINT] THEN ASM_REWRITE_TAC[COLLINEAR_3_EXPAND] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[midpoint; dist] THEN + REWRITE_TAC + [VECTOR_ARITH `a - (u % a + (&1 - u) % c) = (&1 - u) % (a - c)`; + VECTOR_ARITH `(u % a + (&1 - u) % c) - c = u % (a - c)`; + VECTOR_ARITH `u % a + (&1 - u) % c = inv (&2) % (a + c) <=> + (u - &1 / &2) % (a - c) = vec 0`] THEN + ASM_SIMP_TAC[NORM_MUL; REAL_EQ_MUL_RCANCEL; NORM_EQ_0; VECTOR_SUB_EQ; + VECTOR_MUL_EQ_0] THEN + REAL_ARITH_TAC);; + +(* ------------------------------------------------------------------------- *) +(* General "one way" lemma for properties preserved by injective map. *) +(* ------------------------------------------------------------------------- *) + +let WLOG_LINEAR_INJECTIVE_IMAGE_2 = prove + (`!P Q. (!f s. P s /\ linear f ==> Q(IMAGE f s)) /\ + (!g t. Q t /\ linear g ==> P(IMAGE g t)) + ==> !f:real^M->real^N. + linear f /\ (!x y. f x = f y ==> x = y) + ==> !s. Q(IMAGE f s) <=> P s`, + REPEAT STRIP_TAC THEN EQ_TAC THEN ASM_SIMP_TAC[] THEN DISCH_TAC THEN + MP_TAC(ISPEC `f:real^M->real^N` LINEAR_INJECTIVE_LEFT_INVERSE) THEN + ASM_REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM] THEN + DISCH_THEN(X_CHOOSE_THEN `g:real^N->real^M` STRIP_ASSUME_TAC) THEN + FIRST_X_ASSUM(MP_TAC o SPECL + [`g:real^N->real^M`; `IMAGE (f:real^M->real^N) s`]) THEN + ASM_REWRITE_TAC[GSYM IMAGE_o; o_DEF; IMAGE_ID]);; + +let WLOG_LINEAR_INJECTIVE_IMAGE_2_ALT = prove + (`!P Q f s. (!h u. P u /\ linear h ==> Q(IMAGE h u)) /\ + (!g t. Q t /\ linear g ==> P(IMAGE g t)) /\ + linear f /\ (!x y. f x = f y ==> x = y) + ==> (Q(IMAGE f s) <=> P s)`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + MATCH_MP_TAC(REWRITE_RULE[RIGHT_IMP_FORALL_THM; IMP_IMP] + WLOG_LINEAR_INJECTIVE_IMAGE_2) THEN + ASM_REWRITE_TAC[]);; + +let WLOG_LINEAR_INJECTIVE_IMAGE = prove + (`!P. (!f s. P s /\ linear f ==> P(IMAGE f s)) + ==> !f:real^N->real^N. linear f /\ (!x y. f x = f y ==> x = y) + ==> !s. P(IMAGE f s) <=> P s`, + GEN_TAC THEN DISCH_TAC THEN MATCH_MP_TAC WLOG_LINEAR_INJECTIVE_IMAGE_2 THEN + ASM_REWRITE_TAC[]);; + +let WLOG_LINEAR_INJECTIVE_IMAGE_ALT = prove + (`!P f s. (!g t. P t /\ linear g ==> P(IMAGE g t)) /\ + linear f /\ (!x y. f x = f y ==> x = y) + ==> (P(IMAGE f s) <=> P s)`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + MATCH_MP_TAC(REWRITE_RULE[RIGHT_IMP_FORALL_THM; IMP_IMP] + WLOG_LINEAR_INJECTIVE_IMAGE) THEN + ASM_REWRITE_TAC[]);; + +(* ------------------------------------------------------------------------- *) +(* Inference rule to apply it conveniently. *) +(* *) +(* |- !f s. P s /\ linear f ==> P(IMAGE f s) [or /\ commuted] *) +(* --------------------------------------------------------------- *) +(* |- !f s. linear f /\ (!x y. f x = f y ==> x = y) *) +(* ==> (Q(IMAGE f s) <=> P s) *) +(* ------------------------------------------------------------------------- *) + +let LINEAR_INVARIANT_RULE th = + let [f;s] = fst(strip_forall(concl th)) in + let (rm,rn) = dest_fun_ty (type_of f) in + let m = last(snd(dest_type rm)) and n = last(snd(dest_type rn)) in + let th' = INST_TYPE [m,n; n,m] th in + let th0 = CONJ th th' in + let th1 = try MATCH_MP WLOG_LINEAR_INJECTIVE_IMAGE_2 th0 + with Failure _ -> + MATCH_MP WLOG_LINEAR_INJECTIVE_IMAGE_2 + (GEN_REWRITE_RULE (BINOP_CONV o ONCE_DEPTH_CONV) [CONJ_SYM] th0) in + GEN_REWRITE_RULE BINDER_CONV [RIGHT_IMP_FORALL_THM] th1;; + +(* ------------------------------------------------------------------------- *) +(* Immediate application. *) +(* ------------------------------------------------------------------------- *) + +let SUBSPACE_LINEAR_IMAGE_EQ = prove + (`!f s. linear f /\ (!x y. f x = f y ==> x = y) + ==> (subspace (IMAGE f s) <=> subspace s)`, + MATCH_ACCEPT_TAC(LINEAR_INVARIANT_RULE SUBSPACE_LINEAR_IMAGE));; + +(* ------------------------------------------------------------------------- *) +(* Storage of useful "invariance under linear map / translation" theorems. *) +(* ------------------------------------------------------------------------- *) + +let invariant_under_linear = ref([]:thm list);; + +let invariant_under_translation = ref([]:thm list);; + +let scaling_theorems = ref([]:thm list);; + +(* ------------------------------------------------------------------------- *) +(* Scaling theorems and derivation from linear invariance. *) +(* ------------------------------------------------------------------------- *) + +let LINEAR_SCALING = prove + (`!c. linear(\x:real^N. c % x)`, + REWRITE_TAC[linear] THEN VECTOR_ARITH_TAC);; + +let INJECTIVE_SCALING = prove + (`!c. (!x y:real^N. c % x = c % y ==> x = y) <=> ~(c = &0)`, + GEN_TAC THEN REWRITE_TAC[VECTOR_MUL_LCANCEL] THEN + ASM_CASES_TAC `c:real = &0` THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN(MP_TAC o SPECL [`vec 0:real^N`; `vec 1:real^N`]) THEN + REWRITE_TAC[VEC_EQ; ARITH]);; + +let SURJECTIVE_SCALING = prove + (`!c. (!y:real^N. ?x. c % x = y) <=> ~(c = &0)`, + ASM_SIMP_TAC[LINEAR_SURJECTIVE_IFF_INJECTIVE; LINEAR_SCALING] THEN + REWRITE_TAC[INJECTIVE_SCALING]);; + +let SCALING_INVARIANT = + let pths = (CONJUNCTS o UNDISCH o prove) + (`&0 < c + ==> linear(\x:real^N. c % x) /\ + (!x y:real^N. c % x = c % y ==> x = y) /\ + (!y:real^N. ?x. c % x = y)`, + SIMP_TAC[REAL_LT_IMP_NZ; LINEAR_SCALING; + INJECTIVE_SCALING; SURJECTIVE_SCALING]) + and sc_tm = `\x:real^N. c % x` + and sa_tm = `&0:real < c` + and c_tm = `c:real` in + fun th -> + let ith = BETA_RULE(ISPEC sc_tm th) in + let avs,bod = strip_forall(concl ith) in + let cjs = conjuncts(lhand bod) in + let cths = map (fun t -> find(fun th -> aconv (concl th) t) pths) cjs in + let oth = MP (SPECL avs ith) (end_itlist CONJ cths) in + GEN c_tm (DISCH sa_tm (GENL avs oth));; + +let scaling_theorems = ref([]:thm list);; + +(* ------------------------------------------------------------------------- *) +(* Augmentation of the lists. The "add_linear_invariants" also updates *) +(* the scaling theorems automatically, so only a few of those will need *) +(* to be added explicitly. *) +(* ------------------------------------------------------------------------- *) + +let add_scaling_theorems thl = + (scaling_theorems := (!scaling_theorems) @ thl);; + +let add_linear_invariants thl = + ignore(mapfilter (fun th -> add_scaling_theorems[SCALING_INVARIANT th]) thl); + (invariant_under_linear := (!invariant_under_linear) @ thl);; + +let add_translation_invariants thl = + (invariant_under_translation := (!invariant_under_translation) @ thl);; + +(* ------------------------------------------------------------------------- *) +(* Start with some basic set equivalences. *) +(* We give them all an injectivity hypothesis even if it's not necessary. *) +(* For just the intersection theorem we add surjectivity (more manageable *) +(* than assuming that the set isn't empty). *) +(* ------------------------------------------------------------------------- *) + +let th_sets = prove + (`!f. (!x y. f x = f y ==> x = y) + ==> (if p then f x else f y) = f(if p then x else y) /\ + (if p then IMAGE f s else IMAGE f t) = + IMAGE f (if p then s else t) /\ + (f x) INSERT (IMAGE f s) = IMAGE f (x INSERT s) /\ + (IMAGE f s) DELETE (f x) = IMAGE f (s DELETE x) /\ + (IMAGE f s) INTER (IMAGE f t) = IMAGE f (s INTER t) /\ + (IMAGE f s) UNION (IMAGE f t) = IMAGE f (s UNION t) /\ + UNIONS(IMAGE (IMAGE f) u) = IMAGE f (UNIONS u) /\ + (IMAGE f s) DIFF (IMAGE f t) = IMAGE f (s DIFF t) /\ + ((f x) IN (IMAGE f s) <=> x IN s) /\ + ((f o xs) (n:num) = f(xs n)) /\ + ((f o pt) (tt:real^1) = f(pt tt)) /\ + (DISJOINT (IMAGE f s) (IMAGE f t) <=> DISJOINT s t) /\ + ((IMAGE f s) SUBSET (IMAGE f t) <=> s SUBSET t) /\ + ((IMAGE f s) PSUBSET (IMAGE f t) <=> s PSUBSET t) /\ + (IMAGE f s = IMAGE f t <=> s = t) /\ + ((IMAGE f s) HAS_SIZE n <=> s HAS_SIZE n) /\ + (FINITE(IMAGE f s) <=> FINITE s) /\ + (INFINITE(IMAGE f s) <=> INFINITE s)`, + REPEAT GEN_TAC THEN DISCH_TAC THEN REWRITE_TAC[IMAGE_UNIONS] THEN + REWRITE_TAC[o_THM] THEN + REPLICATE_TAC 2 (CONJ_TAC THENL [MESON_TAC[]; ALL_TAC]) THEN + REWRITE_TAC[INFINITE; TAUT `(~p <=> ~q) <=> (p <=> q)`] THEN + REPLICATE_TAC 10 (CONJ_TAC THENL [ASM SET_TAC[]; ALL_TAC]) THEN + REWRITE_TAC[HAS_SIZE] THEN + ASM_MESON_TAC[FINITE_IMAGE_INJ_EQ; CARD_IMAGE_INJ]) in +let f = `f:real^M->real^N` +and imf = `IMAGE (f:real^M->real^N)` +and a = `a:real^N` +and ima = `IMAGE (\x:real^N. a + x)` +and vth = VECTOR_ARITH `!x y. a + x:real^N = a + y ==> x = y` in +let th1 = UNDISCH(ISPEC f th_sets) +and th1' = UNDISCH + (GEN_REWRITE_RULE LAND_CONV [INJECTIVE_IMAGE] (ISPEC imf th_sets)) +and th2 = MATCH_MP th_sets vth +and th2' = MATCH_MP + (BETA_RULE(GEN_REWRITE_RULE LAND_CONV [INJECTIVE_IMAGE] (ISPEC ima th_sets))) + vth in +let fn a th = GENL (a::subtract (frees(concl th)) [a]) th in +add_linear_invariants(map (fn f o DISCH_ALL) (CONJUNCTS th1 @ CONJUNCTS th1')), +add_translation_invariants(map (fn a) (CONJUNCTS th2 @ CONJUNCTS th2'));; + +let th_set = prove + (`!f:A->B s. (!x y. f x = f y ==> x = y) /\ (!y. ?x. f x = y) + ==> INTERS (IMAGE (IMAGE f) s) = IMAGE f (INTERS s)`, + REWRITE_TAC[INTERS_IMAGE] THEN SET_TAC[]) in +let th_vec = prove + (`!a:real^N s. + INTERS (IMAGE (IMAGE (\x. a + x)) s) = IMAGE (\x. a + x) (INTERS s)`, + REPEAT GEN_TAC THEN MATCH_MP_TAC th_set THEN + REWRITE_TAC[VECTOR_ARITH `a + x:real^N = a + y <=> x = y`] THEN + REWRITE_TAC[VECTOR_ARITH `a + x:real^N = y <=> x = y - a`; EXISTS_REFL]) in +add_linear_invariants [th_set],add_translation_invariants[th_vec];; + +(* ------------------------------------------------------------------------- *) +(* Now add arithmetical equivalences. *) +(* ------------------------------------------------------------------------- *) + +let PRESERVES_NORM_PRESERVES_DOT = prove + (`!f:real^M->real^N x y. + linear f /\ (!x. norm(f x) = norm x) + ==> (f x) dot (f y) = x dot y`, + REWRITE_TAC[NORM_EQ] THEN REPEAT STRIP_TAC THEN + FIRST_ASSUM(MP_TAC o SPEC `x + y:real^M`) THEN + FIRST_ASSUM(fun th -> REWRITE_TAC[MATCH_MP LINEAR_ADD th]) THEN + ASM_REWRITE_TAC[DOT_LADD; DOT_RADD] THEN + REWRITE_TAC[DOT_SYM] THEN REAL_ARITH_TAC);; + +let PRESERVES_NORM_INJECTIVE = prove + (`!f:real^M->real^N. + linear f /\ (!x. norm(f x) = norm x) + ==> !x y. f x = f y ==> x = y`, + SIMP_TAC[LINEAR_INJECTIVE_0; GSYM NORM_EQ_0]);; + +let ORTHOGONAL_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x y. + linear f /\ (!x. norm(f x) = norm x) + ==> (orthogonal (f x) (f y) <=> orthogonal x y)`, + SIMP_TAC[orthogonal; PRESERVES_NORM_PRESERVES_DOT]);; + +add_linear_invariants + [GSYM LINEAR_ADD; + GSYM LINEAR_CMUL; + GSYM LINEAR_SUB; + GSYM LINEAR_NEG; + MIDPOINT_LINEAR_IMAGE; + MESON[] `!f:real^M->real^N x. + (!x. norm(f x) = norm x) ==> norm(f x) = norm x`; + PRESERVES_NORM_PRESERVES_DOT; + MESON[dist; LINEAR_SUB] + `!f:real^M->real^N x y. + linear f /\ (!x. norm(f x) = norm x) + ==> dist(f x,f y) = dist(x,y)`; + MESON[] `!f:real^M->real^N x y. + (!x y. f x = f y ==> x = y) ==> (f x = f y <=> x = y)`; + SUBSPACE_LINEAR_IMAGE_EQ; + ORTHOGONAL_LINEAR_IMAGE_EQ; + SPAN_LINEAR_IMAGE; + DEPENDENT_LINEAR_IMAGE_EQ; + INDEPENDENT_LINEAR_IMAGE_EQ; + DIM_INJECTIVE_LINEAR_IMAGE];; + +add_translation_invariants + [VECTOR_ARITH `!a x y. a + x:real^N = a + y <=> x = y`; + NORM_ARITH `!a x y. dist(a + x,a + y) = dist(x,y)`; + VECTOR_ARITH `!a x y. &1 / &2 % ((a + x) + (a + y)) = a + &1 / &2 % (x + y)`; + VECTOR_ARITH `!a x y. inv(&2) % ((a + x) + (a + y)) = a + inv(&2) % (x + y)`; + VECTOR_ARITH `!a x y. (a + x) - (a + y):real^N = x - y`; + (EQT_ELIM o (REWRITE_CONV[midpoint] THENC(EQT_INTRO o NORM_ARITH))) + `!a x y. midpoint(a + x,a + y) = a + midpoint(x,y)`; + (EQT_ELIM o (REWRITE_CONV[between] THENC(EQT_INTRO o NORM_ARITH))) + `!a x y z. between (a + x) (a + y,a + z) <=> between x (y,z)`];; + +(* ------------------------------------------------------------------------- *) +(* A few for lists. *) +(* ------------------------------------------------------------------------- *) + +let MEM_TRANSLATION = prove + (`!a:real^N x l. MEM (a + x) (MAP (\x. a + x) l) <=> MEM x l`, + REWRITE_TAC[MEM_MAP; VECTOR_ARITH `a + x:real^N = a + y <=> x = y`] THEN + MESON_TAC[]);; + +add_translation_invariants [MEM_TRANSLATION];; + +let MEM_LINEAR_IMAGE = prove + (`!f:real^M->real^N x l. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (MEM (f x) (MAP f l) <=> MEM x l)`, + REWRITE_TAC[MEM_MAP] THEN MESON_TAC[]);; + +add_linear_invariants [MEM_LINEAR_IMAGE];; + +let LENGTH_TRANSLATION = prove + (`!a:real^N l. LENGTH(MAP (\x. a + x) l) = LENGTH l`, + REWRITE_TAC[LENGTH_MAP]) in +add_translation_invariants [LENGTH_TRANSLATION];; + +let LENGTH_LINEAR_IMAGE = prove + (`!f:real^M->real^N l. linear f ==> LENGTH(MAP f l) = LENGTH l`, + REWRITE_TAC[LENGTH_MAP]) in +add_linear_invariants [LENGTH_LINEAR_IMAGE];; + +let CONS_TRANSLATION = prove + (`!a:real^N h t. + CONS ((\x. a + x) h) (MAP (\x. a + x) t) = MAP (\x. a + x) (CONS h t)`, + REWRITE_TAC[MAP]) in +add_translation_invariants [CONS_TRANSLATION];; + +let CONS_LINEAR_IMAGE = prove + (`!f:real^M->real^N h t. + linear f ==> CONS (f h) (MAP f t) = MAP f (CONS h t)`, + REWRITE_TAC[MAP]) in +add_linear_invariants [CONS_LINEAR_IMAGE];; + +let APPEND_TRANSLATION = prove + (`!a:real^N l1 l2. + APPEND (MAP (\x. a + x) l1) (MAP (\x. a + x) l2) = + MAP (\x. a + x) (APPEND l1 l2)`, + REWRITE_TAC[MAP_APPEND]) in +add_translation_invariants [APPEND_TRANSLATION];; + +let APPEND_LINEAR_IMAGE = prove + (`!f:real^M->real^N l1 l2. + linear f ==> APPEND (MAP f l1) (MAP f l2) = MAP f (APPEND l1 l2)`, + REWRITE_TAC[MAP_APPEND]) in +add_linear_invariants [APPEND_LINEAR_IMAGE];; + +let REVERSE_TRANSLATION = prove + (`!a:real^N l. REVERSE(MAP (\x. a + x) l) = MAP (\x. a + x) (REVERSE l)`, + REWRITE_TAC[MAP_REVERSE]) in +add_translation_invariants [REVERSE_TRANSLATION];; + +let REVERSE_LINEAR_IMAGE = prove + (`!f:real^M->real^N l. linear f ==> REVERSE(MAP f l) = MAP f (REVERSE l)`, + REWRITE_TAC[MAP_REVERSE]) in +add_linear_invariants [REVERSE_LINEAR_IMAGE];; + +(* ------------------------------------------------------------------------- *) +(* A few scaling theorems that don't come from invariance theorems. Most are *) +(* artificially weak with 0 < c hypotheses, so we don't bind them to names. *) +(* ------------------------------------------------------------------------- *) + +let DOT_SCALING = prove + (`!c. &0 < c ==> !x y. (c % x) dot (c % y) = c pow 2 * (x dot y)`, + REWRITE_TAC[DOT_LMUL; DOT_RMUL] THEN REAL_ARITH_TAC) in +add_scaling_theorems [DOT_SCALING];; + +let DIST_SCALING = prove + (`!c. &0 < c ==> !x y. dist(c % x,c % y) = c * dist(x,y)`, + SIMP_TAC[DIST_MUL; REAL_ARITH `&0 < c ==> abs c = c`]) in +add_scaling_theorems [DIST_SCALING];; + +let ORTHOGONAL_SCALING = prove + (`!c. &0 < c ==> !x y. orthogonal (c % x) (c % y) <=> orthogonal x y`, + REWRITE_TAC[orthogonal; DOT_LMUL; DOT_RMUL] THEN CONV_TAC REAL_FIELD) in +add_scaling_theorems [ORTHOGONAL_SCALING];; + +let NORM_SCALING = prove + (`!c. &0 < c ==> !x. norm(c % x) = c * norm x`, + SIMP_TAC[NORM_MUL; REAL_ARITH `&0 < c ==> abs c = c`]) in +add_scaling_theorems [NORM_SCALING];; + +add_scaling_theorems + [REAL_ARITH `!c. &0 < c ==> !a b. a * c * b = c * a * b`; + REAL_ARITH `!c. &0 < c ==> !a b. c * a + c * b = c * (a + b)`; + REAL_ARITH `!c. &0 < c ==> !a b. c * a - c * b = c * (a - b)`; + REAL_FIELD `!c. &0 < c ==> !a b. c * a = c * b <=> a = b`; + MESON[REAL_LT_LMUL_EQ] `!c. &0 < c ==> !a b. c * a < c * b <=> a < b`; + MESON[REAL_LE_LMUL_EQ] `!c. &0 < c ==> !a b. c * a <= c * b <=> a <= b`; + MESON[REAL_LT_LMUL_EQ; real_gt] + `!c. &0 < c ==> !a b. c * a > c * b <=> a > b`; + MESON[REAL_LE_LMUL_EQ; real_ge] + `!c. &0 < c ==> !a b. c * a >= c * b <=> a >= b`; + MESON[REAL_POW_MUL] + `!c. &0 < c ==> !a n. (c * a) pow n = c pow n * a pow n`; + REAL_ARITH `!c. &0 < c ==> !a b n. a * c pow n * b = c pow n * a * b`; + REAL_ARITH + `!c. &0 < c ==> !a b n. c pow n * a + c pow n * b = c pow n * (a + b)`; + REAL_ARITH + `!c. &0 < c ==> !a b n. c pow n * a - c pow n * b = c pow n * (a - b)`; + MESON[REAL_POW_LT; REAL_EQ_LCANCEL_IMP; REAL_LT_IMP_NZ] + `!c. &0 < c ==> !a b n. c pow n * a = c pow n * b <=> a = b`; + MESON[REAL_LT_LMUL_EQ; REAL_POW_LT] + `!c. &0 < c ==> !a b n. c pow n * a < c pow n * b <=> a < b`; + MESON[REAL_LE_LMUL_EQ; REAL_POW_LT] + `!c. &0 < c ==> !a b n. c pow n * a <= c pow n * b <=> a <= b`; + MESON[REAL_LT_LMUL_EQ; real_gt; REAL_POW_LT] + `!c. &0 < c ==> !a b n. c pow n * a > c pow n * b <=> a > b`; + MESON[REAL_LE_LMUL_EQ; real_ge; REAL_POW_LT] + `!c. &0 < c ==> !a b n. c pow n * a >= c pow n * b <=> a >= b`];; + +(* ------------------------------------------------------------------------- *) +(* Theorem deducing quantifier mappings from surjectivity. *) +(* ------------------------------------------------------------------------- *) + +let QUANTIFY_SURJECTION_THM = prove + (`!f:A->B. + (!y. ?x. f x = y) + ==> ((!P. (!x. P x) <=> (!x. P (f x))) /\ + (!P. (?x. P x) <=> (?x. P (f x))) /\ + (!Q. (!s. Q s) <=> (!s. Q(IMAGE f s))) /\ + (!Q. (?s. Q s) <=> (?s. Q(IMAGE f s)))) /\ + (!P. {x | P x} = IMAGE f {x | P(f x)})`, + GEN_TAC THEN GEN_REWRITE_TAC LAND_CONV [SURJECTIVE_RIGHT_INVERSE] THEN + DISCH_THEN(X_CHOOSE_TAC `g:B->A`) THEN + SUBGOAL_THEN `!s. IMAGE (f:A->B) (IMAGE g s) = s` ASSUME_TAC THENL + [ASM SET_TAC[]; CONJ_TAC THENL [ASM MESON_TAC[]; ASM SET_TAC[]]]);; + +let QUANTIFY_SURJECTION_HIGHER_THM = prove + (`!f:A->B. + (!y. ?x. f x = y) + ==> ((!P. (!x. P x) <=> (!x. P (f x))) /\ + (!P. (?x. P x) <=> (?x. P (f x))) /\ + (!Q. (!s. Q s) <=> (!s. Q(IMAGE f s))) /\ + (!Q. (?s. Q s) <=> (?s. Q(IMAGE f s))) /\ + (!Q. (!s. Q s) <=> (!s. Q(IMAGE (IMAGE f) s))) /\ + (!Q. (?s. Q s) <=> (?s. Q(IMAGE (IMAGE f) s))) /\ + (!P. (!g:real^1->B. P g) <=> (!g. P(f o g))) /\ + (!P. (?g:real^1->B. P g) <=> (?g. P(f o g))) /\ + (!P. (!g:num->B. P g) <=> (!g. P(f o g))) /\ + (!P. (?g:num->B. P g) <=> (?g. P(f o g))) /\ + (!Q. (!l. Q l) <=> (!l. Q(MAP f l))) /\ + (!Q. (?l. Q l) <=> (?l. Q(MAP f l)))) /\ + ((!P. {x | P x} = IMAGE f {x | P(f x)}) /\ + (!Q. {s | Q s} = IMAGE (IMAGE f) {s | Q(IMAGE f s)}) /\ + (!R. {l | R l} = IMAGE (MAP f) {l | R(MAP f l)}))`, + GEN_TAC THEN DISCH_TAC THEN CONV_TAC(ONCE_DEPTH_CONV SYM_CONV) THEN + ASM_REWRITE_TAC[GSYM SURJECTIVE_FORALL_THM; GSYM SURJECTIVE_EXISTS_THM; + GSYM SURJECTIVE_IMAGE_THM; SURJECTIVE_IMAGE; SURJECTIVE_MAP] THEN + REWRITE_TAC[FUN_EQ_THM; o_THM; GSYM SKOLEM_THM] THEN ASM_MESON_TAC[]);; + +(* ------------------------------------------------------------------------- *) +(* Apply such quantifier and set expansions once per level at depth. *) +(* In the PARTIAL version, avoid expanding named variables in list. *) +(* ------------------------------------------------------------------------- *) + +let PARTIAL_EXPAND_QUANTS_CONV avoid th = + let ath,sth = CONJ_PAIR th in + let conv1 = GEN_REWRITE_CONV I [ath] + and conv2 = GEN_REWRITE_CONV I [sth] in + let conv1' tm = + let th = conv1 tm in + if mem (fst(dest_var(fst(dest_abs(rand tm))))) avoid + then failwith "Not going to expand this variable" else th in + let rec conv tm = + ((conv1' THENC BINDER_CONV conv) ORELSEC + (conv2 THENC + RAND_CONV(RAND_CONV(ABS_CONV(BINDER_CONV(LAND_CONV conv))))) ORELSEC + SUB_CONV conv) tm in + conv;; + +let EXPAND_QUANTS_CONV = PARTIAL_EXPAND_QUANTS_CONV [];; diff --git a/development/thales/examples/axiom_example.hl b/development/thales/examples/axiom_example.hl new file mode 100644 index 0000000..085fd77 --- /dev/null +++ b/development/thales/examples/axiom_example.hl @@ -0,0 +1,75 @@ + + + +module My_module = struct + +open Pack_concl;; + +let concl_list = [GLTVHUM_concl;DUUNHOR_concl;QXSKIIT_concl] ;; + +let module_assum = list_mk_conj concl_list;; + +(* +frees module_assum;; +type_vars_in_term module_assum;; +*) + +axioms();; + +let my_assum = new_definition (mk_eq (`(my_assum:(N#A->bool)) x`,module_assum));; + +let my_thm = prove_by_refinement( + `(my_assum ((@) UNIV)) ==> (!x y z. (x = y) ==> (y =x ))`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + ]);; + (* }}} *) + +let INTRO_THEN (axiom,concl) = + FIRST_X_ASSUM (MATCH_MP axom + + +;; +help "MATCH_MP";; +INTRO_TAC (my_assum,GLTVHUM_concl);; + +let fold_binop f = function + [] -> failwith "fold_binop" + | [a] -> a + | a::xs -> List.fold_left f a xs;; + +let make_assumption name concls = + let concl = list_mk_conj concls in + let _ = (frees concl = []) or (failwith "make_assumption: free vars") in + let z = type_vars_in_term concl in + let ty = if (List.length z =0) then `:bool` + else + let f a b = mk_type("prod",[a;b]) in + let C = fold_binop f z in + mk_type("fun",[C;`:bool`]) in + ty;; + + +mk_type("fun",[`:A`;`:B`]);; +mk_type("prod",[`:A`;`:B`;`:C`]);; +List.fold_left;; +List.fold_right;; +make_assumption "" [`T`];; +concl_list;; +help "mk_type";; +dest_type `:A#B#C`;; +mk_type ("prod",[`:A`;`:B`]);; +help_grep"strip";; +help "mk_list";; +help_grep "mk";; +striplist;; +let GLTVHUM = prove(mk_comb(`GLTVHUM_concl, + + + + + + + +end;; diff --git a/development/thales/examples/beta_pair_thm.hl b/development/thales/examples/beta_pair_thm.hl new file mode 100644 index 0000000..7b90f86 --- /dev/null +++ b/development/thales/examples/beta_pair_thm.hl @@ -0,0 +1,63 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Definitions: (General definitions file) *) +(* Chapter: Packings *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-01 *) +(* ========================================================================== *) + + +(* +Support for functions f {a,b} defined by lambda abstraction. +*) + +module Beta_pair = struct + + +let pre_beta = prove_by_refinement +(`!g u' v'. (?f. (!u v. f { u, v } = (g:A->A->B) u v)) ==> + ((\ { u, v}. g u v) {u',v'} = g u' v')`, +[ +REWRITE_TAC[GABS_DEF;GEQ_DEF]; +SELECT_ELIM_TAC; +MESON_TAC[]; +]);; + +let WELLDEFINED_FUNCTION_2 = prove_by_refinement( +`(?f:C->D. (!x:A y:B. f(s x y) = t x y)) <=> + (!x x' y y'. (s x y = s x' y') ==> t x y = t x' y')`, +[ + MATCH_MP_TAC EQ_TRANS ; + EXISTS_TAC `?f:C->D. !z. !x:A y:B. (s x y = z) ==> f z = t x y`; + CONJ_TAC; + MESON_TAC[]; + REWRITE_TAC[GSYM SKOLEM_THM]; + MESON_TAC[]; +]);; + +let well_defined_unordered_pair = prove_by_refinement +(`(?f. (!u v. f { u, v} = (g:A->A->B) u v)) <=> + (! u v. g u v = g v u)`, +[ +REWRITE_TAC[WELLDEFINED_FUNCTION_2]; +SUBGOAL_THEN `!u v x' y'. ({u,v} = {x',y'}) <=> ((((u:A)=x') /\ (v = y'))\/ ((u= y') /\ (v = x')))` ASSUME_TAC; +SET_TAC[]; +ASM_REWRITE_TAC[]; +MESON_TAC[]; +] +);; + +let BETA_PAIR_THM = prove_by_refinement( +`!g u' v'. (!u v. (g:A->A->B) u v = g v u) ==> + ((\ { u, v}. g u v) {u',v'} = g u' v')`, +[ +REPEAT STRIP_TAC; +MATCH_MP_TAC pre_beta; +REWRITE_TAC[well_defined_unordered_pair]; +ASM_REWRITE_TAC[]; +] +);; + + +end;; diff --git a/development/thales/examples/lemma_negligible.hl b/development/thales/examples/lemma_negligible.hl new file mode 100644 index 0000000..5c46beb --- /dev/null +++ b/development/thales/examples/lemma_negligible.hl @@ -0,0 +1,42 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Definitions: (General definitions file) *) +(* Chapter: Packings *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-01 *) +(* ========================================================================== *) + +module Lemma_negligible = struct + + open Real_ext;; + +let pos_lemma = prove_by_refinement( + `!Q. (?C. (&0 <= C /\ (!r. &1 <= r ==> Q r <= C * r pow 2))) <=> + (?C. ( (!r. &1 <= r ==> Q r <= C * r pow 2)))`, +[ +GEN_TAC; +EQ_TAC; +REPEAT STRIP_TAC; +EXISTS_TAC `C:real`; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +EXISTS_TAC `abs(C)`; +REWRITE_TAC[REAL_ARITH `&0 <= abs C`]; +REPEAT STRIP_TAC; +ASSUME_TAC (REAL_ARITH `C <= abs C`); +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC `C * r pow 2`; +CONJ_TAC; +ASM_SIMP_TAC[]; +MATCH_MP_TAC REAL_LE_RMUL_IMP; +ASM_REWRITE_TAC[Collect_geom.REAL_LE_POW_2]; +]);; + +let negligible_fun_any_C = prove( + `!f S. negligible_fun_0 f S <=> + (?C. (!r. &1 <= r ==> sum (S INTER ball ((vec 0),r)) f <= C * r pow 2))`, + REWRITE_TAC[Pack_defs.negligible_fun_0;Pack_defs.negligible_fun_p;pos_lemma]);; + + +end;; diff --git a/development/thales/examples/sierpinski.hl b/development/thales/examples/sierpinski.hl new file mode 100644 index 0000000..1a247cd --- /dev/null +++ b/development/thales/examples/sierpinski.hl @@ -0,0 +1,375 @@ + + +flyspeck_needs "general/tactics.hl";; + +module Sierpinski:sig + + val INFINITE_CRIT:thm + + val INFINITE_EXISTS:thm + + val num_seq_type:thm + + val sierpinski:thm + +end = + +struct + +let SELECT_TAC= Tactics.SELECT_TAC;; +let EVERY_PAT_ASSUM = Tactics.EVERY_PAT_ASSUM;; + +(* Sierpinski's theorem *) + +(* start 3:36 July 3 *) + +let INFINITE_CRIT = prove( + `!X Y Z. INFINITE X /\ FINITE Y /\ (Z = X DIFF Y) ==> INFINITE Z`, +MESON_TAC[INFINITE_DIFF_FINITE] +);; + +(* +let INFINITE_EXISTS = prove_by_refinement ( +`!x P. INFINITE { (x:A) | P x } ==> (?x. P x)`, +[ +REWRITE_TAC[INFINITE]; +REPEAT STRIP_TAC; +SUBGOAL_THEN `~({(x:A) | P x} = {})` MP_TAC; +ASM_MESON_TAC[FINITE_EMPTY]; +REWRITE_TAC[EXTENSION;NOT_IN_EMPTY;IN_ELIM_THM]; +MESON_TAC[]; +]);; +*) + +let INFINITE_EXISTS = prove_by_refinement ( +`!x P. INFINITE { (x:A) | P x } ==> (?x. P x)`, +[ +REWRITE_TAC[INFINITE]; +REPEAT STRIP_TAC; +ASM_CASES_TAC `({(x:A) | P x} = {})` ; +ASM_MESON_TAC[FINITE_EMPTY]; +POP_ASSUM MP_TAC; +SET_TAC[]; +]);; + +let numm0 = prove_by_refinement(`{n | n > 0 } = (:num) DIFF {0}`, +[ +REWRITE_TAC[DIFF;FUN_EQ_THM;IN_ELIM_THM;IN_SING;SET_RULE `x IN (:num)`]; +ARITH_TAC; +]);; + +let inf_pos_y = prove_by_refinement( + `!y N. INFINITE N ==> INFINITE { (n:num) | n > y /\ n IN N }`, +[ +REPEAT STRIP_TAC; +MATCH_MP_TAC INFINITE_CRIT; (* strategy *) +ASM_MESON_TAC[num_y;FINITE_NUMSEG_LE]; (* terminator *) +]);; + +let inf_pos = prove_by_refinement( +`INFINITE { n | n > 0 }`, +[ +MATCH_MP_TAC INFINITE_CRIT; +MESON_TAC[numm0;FINITE_SING;num_INFINITE]; +]);; + + +let num_seq_exists = prove_by_refinement( +`?x. (!n. ~(SND x n) ==> (FST x n = &0)) /\ + INFINITE (SND x) /\ (!n. n IN SND x ==> n >0)`, +[ + EXISTS_TAC `(\n:num. &0), { n | n > 0}`; + REWRITE_TAC[FST;SND;IN_ELIM_THM;inf_pos] +]);; + +let num_seq_type = new_type_definition + "num_seq" ("mk_num_seq","dest_num_seq") num_seq_exists;; + +let num_seq_axiom = `(?f:real->num_seq. ONTO f)`;; + +let phin = new_definition `phin = @(f:real->num_seq). ONTO f`;; + +let phi_domain = new_definition + `phi_domain b = SND (dest_num_seq (phin b))`;; + +let phi = new_definition + `phi b = FST (dest_num_seq (phin b))`;; + +let phin_ONTO = prove_by_refinement( + `(?f: real->num_seq. ONTO f) ==> (!ns. ?b. phin b = ns)`, +[ +REWRITE_TAC[phin]; +SELECT_ELIM_TAC; +MESON_TAC[ONTO] +]);; + +let h_b = define + `(h_b N 0 = @(n:num). N 0 n) /\ (h_b N (SUC i) = @n. (N (SUC i) n /\ n > h_b N i))`;; + + +let num_y = prove_by_refinement( + `{(n:num) | n > y /\ n IN N} = N DIFF {n | n <= y}`, +[ +REWRITE_TAC[DIFF;FUN_EQ_THM;IN_ELIM_THM;IN_SING]; +GEN_TAC; +MATCH_MP_TAC (TAUT` (x = y) ==> (x /\ a <=> a /\ y) `); +ARITH_TAC; +]);; + +let inf_ex = prove_by_refinement( `!y. INFINITE N ==> ?(n:num). n > y /\ n IN N`, +[ +REPEAT STRIP_TAC; +MATCH_MP_TAC INFINITE_EXISTS; +MATCH_MP_TAC inf_pos_y; +ASM_REWRITE_TAC[] +]);; + +let h_b_inc = prove_by_refinement( +`(!i. INFINITE (N i)) ==> (!i. (h_b N i < h_b N (SUC i) ))`, +[ +(* unpack *) +REWRITE_TAC[h_b]; +DISCH_TAC; +GEN_TAC; +(* prep assumptions *) +FIRST_X_ASSUM (ASSUME_TAC o (ISPEC `SUC i:num`)); +FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP inf_ex)); +(* resolve *) +SELECT_TAC; +POP_ASSUM MP_TAC THEN ARITH_TAC; +ASM_MESON_TAC[IN]; +]);; + +let lemma_inc_injective = Hypermap.lemma_inc_injective;; + +let h_b_inj = prove( + `(!i. INFINITE (N i)) ==> (!i j. (i = j) <=> (h_b N i = h_b N j))`, + MESON_TAC [h_b_inc;lemma_inc_injective]);; + +let continuum_family = new_definition `continuum_family A = + ((!(x:real). INFINITE(A x) /\ (COUNTABLE (A x))) /\ + (!x y. x IN A y \/ y IN A x))`;; + +let continuum_bij = prove_by_refinement( + `continuum_family A ==> (!x. (?b. (A x = IMAGE b (:num)) /\ + (!m n. (b m = b n) ==> (m = n))))`, +[ +REWRITE_TAC[continuum_family]; +MESON_TAC[COUNTABLE_AS_INJECTIVE_IMAGE] +]);; + +(* Harrison's lemma *) +let WELLDEFINED_FUNCTION_1 = Tactics.WELLDEFINED_FUNCTION_1;; + +let countable_bij = prove_by_refinement( + `!s. (COUNTABLE (s:A->bool)) /\ (INFINITE s) ==> (?f g. + (s = IMAGE f (:num) /\ (!m n. f m = f n ==> m = n) /\ + (!n. g (f n) = n) /\ (!a. a IN s ==> f (g a) = a) /\ + (!a b. a IN s /\ b IN s /\ (g a = g b) ==> (a = b))))`, +[ +REPEAT STRIP_TAC; +MP_TAC (ISPEC `s:A->bool` COUNTABLE_AS_INJECTIVE_IMAGE); +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +EXISTS_TAC `f:num->A`; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN `?g:A->num. (!n. g (f n) = n)` MP_TAC; +ASM_REWRITE_TAC[WELLDEFINED_FUNCTION_1]; +REPEAT STRIP_TAC; +EXISTS_TAC `g:A->num`; +ASM_REWRITE_TAC[IN_IMAGE]; +ASM_MESON_TAC[]; +]);; + + +let h_b_IN = prove_by_refinement( + `(!i. INFINITE (N i)) ==> (!i. (h_b N i IN N i))`, +[ +REPEAT STRIP_TAC; +DISJ_CASES_TAC (SPEC `i:num` num_CASES) THEN +TRY(FIRST_X_ASSUM MP_TAC) THEN REPEAT STRIP_TAC THEN +ASM_REWRITE_TAC[h_b;IN] THEN +SELECT_ELIM_TAC THEN +REPEAT STRIP_TAC THEN +ASM_MESON_TAC[inf_ex;IN]; +]);; + +let phi_domain_inf = prove_by_refinement( + `(?b:real->num_seq. ONTO b) ==> + (!x. INFINITE (phi_domain x))`, +[ +REWRITE_TAC[phi_domain;phin]; +DISCH_TAC; +SELECT_ELIM_TAC; +REPEAT STRIP_TAC; +ASM_MESON_TAC[num_seq_type] +]);; + +let lemma1 = prove_by_refinement + (`(?b:real->num_seq. ONTO b) ==> (!A x. continuum_family A ==> + (?h. ( + (! y z. A x y /\ A x z /\ (h y = h z) ==> (y = z))) /\ + (!y. A x y ==> h y IN phi_domain y) /\ (!y. ~(A x y) ==> h y = 0)))`, +[ +(* unpack *) +REWRITE_TAC[continuum_family]; +REPEAT STRIP_TAC; +(* fact gathering *) +MP_TAC (ISPEC `(A:real->real->bool) x` countable_bij); +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +SUBGOAL_THEN `!a. a IN (A:real->real->bool) x ==> (phi_domain a) = (phi_domain o (f:num->real)) (g a) ` ASSUME_TAC; +REWRITE_TAC[o_THM]; +ASM_MESON_TAC[IN]; +SUBGOAL_THEN `!i:num. INFINITE ((phi_domain o f) i)` ASSUME_TAC; +REWRITE_TAC[o_THM]; +ASM_MESON_TAC[phi_domain_inf]; +(* hit the goal *) +EXISTS_TAC `\(y:real). if A (x:real) y then h_b (phi_domain o f) (g y) else 0`; +BETA_TAC; +REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN +(* terminate every subgoal *) +TRY(FIRST_X_ASSUM MP_TAC) THEN +ASM_REWRITE_TAC[] THEN +ASM_MESON_TAC[IN;h_b_inj;h_b_IN]; +]);; + +let lem = REWRITE_RULE [RIGHT_IMP_EXISTS_THM;SKOLEM_THM] + lemma1;; + +let hx = new_specification ["hx"] lem;; + +let WELLDEFINED_FUNCTION_2b = Tactics.WELLDEFINED_FUNCTION_2b;; + +(* next existence of f *) +let f_ex = prove_by_refinement +(`!A (b:real->num_seq). (continuum_family A) /\ (ONTO b) ==> + (?(f:(num#real) -> real). !x y. A x y ==> f ((hx A x y), x) = phi y (hx A x y))`, +[ +REPEAT STRIP_TAC; (* unpack *) +REWRITE_TAC[WELLDEFINED_FUNCTION_2b;PAIR_EQ]; (* strategy *) +REPEAT STRIP_TAC; +SUBGOAL_THEN `(y:real) = y'` ASSUME_TAC ; +ASM_MESON_TAC[hx]; +ASM_REWRITE_TAC[] +]);; + +let fc_ex = prove_by_refinement( + `!A (b:real->num_seq). (continuum_family A) /\ (ONTO b) ==> + (?(f:num->real -> real). !x y. A x y ==> + f (hx A x y) x = phi y (hx A x y))`, +[ +REPEAT STRIP_TAC; +MP_TAC (ISPECL [`A:real->real->bool`; `b:real->num_seq`] f_ex); +ASM_REWRITE_TAC[]; +STRIP_TAC; +EXISTS_TAC `\ n x . (f:num#real->real) (n,x)`; +BETA_TAC; +ASM_REWRITE_TAC[]; +]);; + +let fd_ex = prove_by_refinement( + `?f. !A. (continuum_family A) /\ (?(b:real->num_seq). ONTO b) + ==> + (!x y. A x y ==> f A (hx A x y) x = phi y (hx A x y))`, +[ +REWRITE_TAC[GSYM SKOLEM_THM]; +ASM_MESON_TAC[fc_ex] +]);; + +let fd = new_specification[ "fd"] fd_ex;; + + +let r_exists = prove_by_refinement( + `!X (b:real->num_seq). INFINITE { n | ~((X n) = (:real)) } /\ (ONTO b) ==> + (?r. + (phi_domain r = {n | n > 0 /\ (~((X n) = (:real))) } ) /\ + (!n. if n IN phi_domain r then ~(phi r n IN X n) else (phi r n = &0)))`, +[ +REPEAT GEN_TAC; +ABBREV_TAC `N = { n:num | ~(X n = (:real) ) }`; +STRIP_TAC; +FIRST_RULE_ASSUM (MATCH_MP (ISPEC `0` inf_pos_y)) ASSUME_TAC; +(* intro ph, N0 *) +ABBREV_TAC `N0 = {n | n > 0 /\ n IN N}`; +SUBGOAL_THEN `?ph. !(n:num). if (n IN N0) then (~(ph n IN X n)) else (ph n= &0)` MP_TAC; +REWRITE_TAC[GSYM SKOLEM_THM]; +ASM SET_TAC[IN_ELIM_THM]; +REPEAT STRIP_TAC; +(* *) +SUBGOAL_THEN `dest_num_seq (mk_num_seq (ph,N0)) = (ph,N0)` ASSUME_TAC; +ASM_REWRITE_TAC[GSYM num_seq_type]; +CONJ_TAC; +ASM_MESON_TAC[IN]; +EXPAND_TAC "N0"; +REWRITE_TAC[IN_ELIM_THM;TAUT `a /\ b ==> a`]; +(* intro r *) +SUBGOAL_THEN `?(r:real). phin r = mk_num_seq (ph,N0)` MP_TAC; +ASM_MESON_TAC[ONTO;phin]; +REPEAT STRIP_TAC; +(* *) +SUBGOAL_THEN `(phi_domain r = N0) /\ (phi r = ph)` MP_TAC; +ASM_REWRITE_TAC[phi_domain;phi]; +REPEAT STRIP_TAC; +EXISTS_TAC `r:real`; +ASM_REWRITE_TAC[]; +EVERY_PAT_ASSUM [`ph:num->real`] (fun t-> UNDISCH_THEN (concl t) (K ALL_TAC)); +EVERY_PAT_ASSUM [`phi_domain`] (fun t-> UNDISCH_THEN (concl t) (K ALL_TAC)); +EXPAND_TAC"N0"; +EXPAND_TAC"N"; +REWRITE_TAC[IN_ELIM_THM]; +] +);; + + +let countable_s = prove_by_refinement( + `!A (b:real->num_seq) s. (continuum_family A) /\ (ONTO b) /\ + (INFINITE { n | ~(IMAGE (fd A n) s = (:real) ) }) ==> (COUNTABLE s)`, +[ +(* unpack *) +REPEAT STRIP_TAC; +ABBREV_TAC `N = { n | ~(IMAGE (fd A n) s = (:real) ) }`; +MP_TAC (ISPECL [`\n. IMAGE (fd A n) s`;`b:real->num_seq`] r_exists); +BETA_TAC; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +(* unpack continuum family *) +UNDISCH_THEN `continuum_family A` (fun t -> ASSUME_TAC t THEN MP_TAC (REWRITE_RULE[continuum_family] t)); +REPEAT STRIP_TAC; +(* unpack goal *) +MATCH_MP_TAC COUNTABLE_SUBSET; (* strategy *) +EXISTS_TAC `(A:real->real->bool) r`; +ASM_REWRITE_TAC[SUBSET]; +REPEAT STRIP_TAC; +REFUTE_THEN ASSUME_TAC; +(* *) +SUBGOAL_TAC "A" `r IN (A:real->real -> bool) x` [ASM_MESON_TAC[]]; +SUBGOAL_TAC "B" `fd A (hx A x r) x = phi r (hx A x r)` [ASM_MESON_TAC[IN;fd]]; +(* *) +SUBGOAL_THEN `hx A x r IN phi_domain r` ASSUME_TAC; +ASM_MESON_TAC[hx;IN]; +(* *) +SUBGOAL_THEN `~(phi r (hx A x r) IN IMAGE (fd A (hx A x r)) s)` MP_TAC; +ASM_MESON_TAC[]; +REWRITE_TAC[IN_IMAGE]; +EXISTS_TAC`x:real`; +ASM_REWRITE_TAC[]; +]);; + + + +let sierpinski = prove_by_refinement +(`!A (b:real->num_seq). (continuum_family A) /\ (ONTO b) ==> + (?(f:num->real->real). !s. + (~(COUNTABLE s) ==> FINITE { n | ~(IMAGE (f n) s = (:real)) }))`, +[ +REPEAT STRIP_TAC; +EXISTS_TAC`fd A`; +REPEAT STRIP_TAC; +MP_TAC (ISPECL[`A:real->real->bool`;`b:real->num_seq`;`s:real->bool`] countable_s); +ASM_REWRITE_TAC[INFINITE]; +]);; + +(* complete at 1:25 pm July 4, 2010. *) + +end;; diff --git a/development/thales/examples/workshop2010_beta_pair_thm.hl b/development/thales/examples/workshop2010_beta_pair_thm.hl new file mode 100644 index 0000000..caa620b --- /dev/null +++ b/development/thales/examples/workshop2010_beta_pair_thm.hl @@ -0,0 +1,44 @@ + +let pre_beta = prove_by_refinement +(`!g u' v'. (?f. (!u v. f { u, v } = (g:A->A->B) u v)) ==> + ((\ { u, v}. g u v) {u',v'} = g u' v')`, +[ +REWRITE_TAC[GABS_DEF;GEQ_DEF]; +SELECT_ELIM_TAC; +MESON_TAC[]; +]);; + +let WELLDEFINED_FUNCTION_2 = prove_by_refinement( +`(?f:C->D. (!x:A y:B. f(s x y) = t x y)) <=> + (!x x' y y'. (s x y = s x' y') ==> t x y = t x' y')`, +[ + MATCH_MP_TAC EQ_TRANS ; + EXISTS_TAC `?f:C->D. !z. !x:A y:B. (s x y = z) ==> f z = t x y`; + CONJ_TAC; + MESON_TAC[]; + REWRITE_TAC[GSYM SKOLEM_THM]; + MESON_TAC[]; +]);; + +let well_defined_unordered_pair = prove_by_refinement +(`(?f. (!u v. f { u, v} = (g:A->A->B) u v)) <=> + (! u v. g u v = g v u)`, +[ +REWRITE_TAC[WELLDEFINED_FUNCTION_2]; +SUBGOAL_THEN `!u v x' y'. ({u,v} = {x',y'}) <=> ((((u:A)=x') /\ (v = y'))\/ ((u= y') /\ (v = x')))` ASSUME_TAC; +SET_TAC[]; +ASM_REWRITE_TAC[]; +MESON_TAC[]; +] +);; + +let BETA_PAIR_THM = prove_by_refinement( +`!g u' v'. (!u v. (g:A->A->B) u v = g v u) ==> + ((\ { u, v}. g u v) {u',v'} = g u' v')`, +[ +REPEAT STRIP_TAC; +MATCH_MP_TAC pre_beta; +REWRITE_TAC[well_defined_unordered_pair]; +ASM_REWRITE_TAC[]; +] +);; diff --git a/development/thales/examples/workshop2010_ky_lemma_negligible.hl b/development/thales/examples/workshop2010_ky_lemma_negligible.hl new file mode 100644 index 0000000..fd79aa6 --- /dev/null +++ b/development/thales/examples/workshop2010_ky_lemma_negligible.hl @@ -0,0 +1,30 @@ + + +let pos_lemma = prove_by_refinement( + `!Q. (?C. (&0 <= C /\ (!r. &1 <= r ==> Q r <= C * r pow 2))) <=> + (?C. ( (!r. &1 <= r ==> Q r <= C * r pow 2)))`, +[ +GEN_TAC; +EQ_TAC; +REPEAT STRIP_TAC; +EXISTS_TAC `C:real`; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +EXISTS_TAC `abs(C)`;search[`negligible_fun_0`];; +REWRITE_TAC[REAL_ARITH `&0 <= abs C`]; +REPEAT STRIP_TAC; +ASSUME_TAC (REAL_ARITH `C <= abs C`); +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC `C * r pow 2`; +CONJ_TAC; +ASM_SIMP_TAC[]; +MATCH_MP_TAC REAL_LE_RMUL_IMP; +ASM_REWRITE_TAC[Collect_geom.REAL_LE_POW_2]; +]);; + +let negligible_fun_any_C = prove( + `!f S. negligible_fun_0 f S <=> + (?C. (!r. &1 <= r ==> sum (S INTER ball ((vec 0),r)) f <= C * r pow 2))`, + REWRITE_TAC[Pack_defs.negligible_fun_0;Pack_defs.negligible_fun_p;pos_lemma]);; + + diff --git a/development/thales/examples/workshop2010_quyen_example.hl b/development/thales/examples/workshop2010_quyen_example.hl new file mode 100644 index 0000000..4af568a --- /dev/null +++ b/development/thales/examples/workshop2010_quyen_example.hl @@ -0,0 +1,49 @@ +(* +People who are working on the later chapters may use results from earlier chapters. Suppose I want to use +GLTVHUM_concl from the file pack/pack_concl.hl before it has been proved. + +First, create a new definition: +let GLTVHUM_concl = mk_eq (`GLTVHUM_concl:bool`,Pack_concl.GLTVHUM_concl);; + +Then use it: +let mylemma = prove (`GLTVHUM_concl ==> RiemannHypothesis`,AMAZING_TAC);; + +*) + +(* lemma about sup of function on finite set *) +let let finite_num_func_attain_max = +prove_by_refinement( +`! (S:A->bool) (f:A->num). FINITE S /\ ~ (S = {}) + ==> (? x. x IN S /\ (! y. y IN S ==> f y <= f x))`, +[ + (REPEAT STRIP_TAC); + +(* subgoal 1 *) + (SUBGOAL_THEN +` FINITE (IMAGE (& o(f:A->num)) (S:A->bool)) /\ ~ (IMAGE (& o f) S = {})` +ASSUME_TAC); + CONJ_TAC; +(* subgoal 1.1 *) + (ASM_SIMP_TAC[FINITE_IMAGE]); +(* subgoal 2.1 *) + (ASM_SIMP_TAC[NOT_EMPTY_IMAGE]); + + (FIRST_ASSUM(MP_TAC o (MATCH_MP SUP_FINITE))); + (CONV_TAC(PAT_CONV `\k. _ IN k /\ _ ==> _` (REWRITE_CONV[IMAGE]))); + (PURE_REWRITE_TAC[IN_ELIM_THM]); + STRIP_TAC; + (EXISTS_TAC `x:A`); + (ASM_SIMP_TAC[]); + (REPEAT STRIP_TAC); + (FIRST_X_ASSUM(MP_TAC o SPEC ` (& o (f:A->num)) y`)); + +(* subgoal 2 *) + (SUBGOAL_THEN ` (& o (f:A->num)) y IN IMAGE (& o f) S` ASSUME_TAC); + (PURE_REWRITE_TAC[IMAGE;IN_ELIM_THM]); + (EXISTS_TAC `y:A` THEN ASM_SIMP_TAC[]); + + (ASM_SIMP_TAC[o_THM; REAL_OF_NUM_LE]); +]);; + + + diff --git a/development/thales/log/log_searches.hl b/development/thales/log/log_searches.hl new file mode 100644 index 0000000..8bb33ef --- /dev/null +++ b/development/thales/log/log_searches.hl @@ -0,0 +1,7488 @@ +let NAN = 0;; + +let searchd pat = + searchl (map (fun t -> ("",t)) (definitions())) pat;; + +let ineq_as_thm = + map (fun t -> t.idv,ASSUME t.ineq) (!Ineq.ineqs);; + +let prep_as_thm = + map (fun t -> t.idv,ASSUME t.ineq) (!Prep.prep_ineqs);; + +let searchi pat = + searchl (ineq_as_thm) pat;; + +let searchp pat = + searchl (prep_as_thm) pat;; + + +Sphere.vol2r;; +Sphere.vol2f;; +Sphere.gamma23f;; +Sphere.a_spine5;; +Sphere.b_spine5;; +Sphere.gamma3f;; +Sphere.vol3f;; +vol3f_palt;; +search[`vol3f`];; +search[`gchi`];; +search[`delta_x`;`eta_x`];; +vol3f_x_sqrt2_lmplus;; +vol3f_x_lfun;; +vol3_x_sqrt;; +vol3f_palt;; +help_grep "GEN";; + +Sphere.eta2_135;; +ineq;; +Sphere.vol3r;; +searcht 5 [`lfun`];; +cpp_string_of_term `#3.0`;; +chop_list 3 [`a`;`b`;`c`;`d`];; + +Parse_ineq.autogen;; +let ineq = Sphere.ineq;; +let all_forall = Sphere.all_forall;; +split_ineq;; +Sphere.vol3r;; +Sphere.vol_x;; +(* *) +Sys.command("pwd");; + + +search[`vol3f`];; +search[`sqrt2`];; +search[`dihRy`];; +search[`solRy`];; +search[`lmfun`;`lfun`];; +search[`lmfun`;`h0`];; + +Sphere.dih_x;; +Sphere.atn2;; +Sphere.vol_x;; +Sphere.vol4f;; +Sphere.gamma4f;; + +search [`lfun`];; +search [`ly`];; +searcht 3 [`matn`];; +type_of `matan`;; +Sphere.vol4f;; +help "dest_binder";; +help_grep "binder";; +help "is_binder";; +binders();; + +Sphere.arclength;; +searcht 5 [`acs`;`atn`];; +searcht 5 [`acs`;`asn`];; + +Sphere.a_spine5;; +Sphere.atn2;; +Sphere.dih_x;; +Sphere.vol3r;; +Sphere.vol_x;; +Sphere.vol3f;; +Sphere.sol_y;; +searcht 5 [`sol_y`;`atn`];; +searcht 20 [`delta_x4`];; +search [name "Euler"];; +it;; +Sphere.gamma3f;; +Sphere.vol3f;; +Sphere.gamma23f;; +Sphere.vol2r;; +Sphere.marchal_quartic;; +Sphere.taum;; +Sphere.lnazim;; +Sphere.rhazim;; +Sphere.rho;; +Sphere.rhazim;; +Sphere.ly;; +Sphere.const1;; +Sphere.vol4f;; +Sphere.vol_y;; +Sphere.const1;; +Sphere.lfun;; +Sphere.lmfun;; +Sphere.mm1;; +Sphere.mm2;; +Sphere.rhazim2;; +Sphere.sol0;; +Sphere.edge_flat;; + +Sphere.vol2r;; +Sphere.vol2f;; +Sphere.mm1;; +Sphere.mm2;; +Sphere.tau0;; +Sphere.marchal_quartic;; +Sphere.hplus;; +searcht 100 [`asn`;`atn`];; +searcht 100 [`rhazim2`];; +searcht 100 [`sol0`];; +Sphere.arclength;; + +REAL_FIELD;; +search[`];; +search[`&0 < sol0`];; + +Sphere.edge_flat;; +Sphere.flat_term;; +Sphere.tame_table_d;; + + +search[`radV`];; +Sphere.gamma4f;; +Sphere.rad2_y;; +Sphere.rad2_x;; +Parse_ineq.y_of_x_e;; +Sphere.vol_x;; +Sphere.dih6_y;; +gchi1_x;; +gchi;; +dih4_x;; +List.length !Ineq.ineqs;; +Sphere.atn2;; +"string";; + +curry;; +search [name "Packing"];; +help_grep "list";; +help "chop_list";; + +Sphere.gamma4f;; +Sphere.vol4f;; +Sphere.vol3f;; +Sphere.vol2f;; + +Sphere.ups_x;; +Sphere.quadratic_root_plus;; +searcht 10 [`edge_flat`];; +searcht 10 [`(sqrt x) pow 2`];; +searcht 4 [`abs`;`sqrt`];; + +searcht 5 [`sqrt x pow 2`];; SQRT_POW_2;; +help_grep "REWRITE_TAC";; +(* +Sphere.beta_bump_y;; +Sphere.bump;; +Sphere.lmfun;; +Sphere.beta_bump_force_y;; +Sphere.critical_edge_y;; +Sphere.vol4f;; +Sphere.hminus;; +Sphere.h0;; +Sphere.hplus;; +*) + +search[`vol4f`;`lmfun`];; +search[`gcy`;`gchi`];; +search[`gcy`];; +ineq_expand;; + + +help_grep "REP";; +search [name "cycle_";];; +help "REPEATC";; +help "MATCH_MP";; +help_grep "CHANGED";; +search[name "MVT"];;"MVT_GENERAL";; +search[name "IVT"];; +REAL_IVT_DECREASING;; +REAL_IVT_DECREASING;; +search[`real_continuous_on`];;"REAL_CONTINUOUS_ON_NEG","REAL_CONTINUOUS_ON_MUL","REAL_CONTINUOUS_ON_POW",("REAL_CONTINUOUS_ON_LMUL"),"REAL_CONTINUOUS_ON_SUB","REAL_CONTINUOUS_ON_RMUL","REAL_CONTINUOUS_ON_ID","REAL_ROLLE","REAL_CONTINUOUS_ON_ADD","REAL_CONTINUOUS_ON_CONST"; +(* also REAL_CONTINUOUS_MUL, REAL_CONTINUOUS_SUB, etc. *) +REAL_CONTINUOUS_ON_POW;; + +searcht 5 [`has_real_derivative`;`u + v`],"HAS_REAL_DERIVATIVE_ADD";; +search [name "HAS_REAL_DERIVATIVE"];; +"HAS_REAL_DERIVATIVE_INCREASING_IMP","HAS_REAL_DERIVATIVE_CONST","HAS_REAL_DERIVATIVE_POW_ATREAL",("HAS_REAL_DERIVATIVE_POW_WITHIN"),"HAS_REAL_DERIVATIVE_INCREASING","HAS_REAL_DERIVATIVE_ADD","HAS_REAL_DERIVATIVE_ID", +search[`has_real_derivative`;name "MVT"];; +REAL_ROLLE;; +HAS_REAL_DERIVATIVE_INCREASING;; +searcht 10 [`has_real_derivative`;`f x < f y`];; + + +REAL_ROLLE;; + +searcht 5 [`&0 <= a /\ &0 <= b ==> &0 <= a * b`];; +searcht 5 [`(a /\ b) /\ c` ; `a /\ b /\ c`];; + + + +searcht 5 [`#1.2`;`hminus`]; hminus_prop;; +searcht 5 [`rhazim_x`];; +rhazim_x;; +rhazim2_x;; + + +searcht 5 [`(\x. f (x) * g x) real_continuous_on s`];; +searcht 10 [`inv (x * y)`;`inv x * inv y`];; +searcht 10 [`inv(inv x)`];; +searcht 5 [`&0 <= inv (x) <=> &0 <= x`];; + +searcht 10 [`x ==> (&0 < u / v)`];; +searcht 10 [`x < t /\ t <= u ==> x < u`];; +searcht 10 [`x pow 2 < y pow 2`];; +searcht 10 [`x ==> (&0 <= u/v)`];; + +searcht 5 [`lmfun`;`lfun`];; + +Sphere.marchal_quartic;; +Sphere.lmfun;; +Sphere.hminus;; + + +searcht 5[`FST a,SND a`],PAIR;; +searcht 5 [`sol0`];;GSYM Tame_general.sol0_over_pi_EQ_const1 +searcht 5 [`&0 < pi`],PI_POS; + +searcht 4 [` (x * y) pow n`];;REAL_POW_MUL;; +searcht 10 [`x * inv y`];; + + +searcht 10 [`sqrt8`;`sqrt2`];; +searcht 5 [`sqrt ( x pow 2)`];; +searcht 5 [`sqrt (x ) * sqrt(a)`];; + + +searcht 10 [`&0 <= sqrt (x)`],SQRT_POS_LE;;; + +search [name "TAYLOR"];; +search [name "GRAD"];; + +(search [`x pow 2 <= y pow 2 `],Collect_gome.POW2_COND);; +searcht 10 [`(sqrt x) pow 2`],Collect_geom.POW2_COND;; +searcht 10 [`&0 <= a pow 2`],Collect_geom.REAL_LE_SQUARE_POW;; +searcht 10 [`abs b pow 2 = b pow 2`];; +searcht 10 [`x <=y /\ y <= z ==> P`],REAL_LE_TRANS;;; +searcht 10 [`&0 <= sqrt x`],Collect_geom.REAL_LE_SQUARE_POW;; +(search [`x pow 2 <= y pow 2 `],SQRT_POW2);; +searcht 10 [`x pow 2 = x * x`], REAL_POW_2;; + +searcht 10 [`x pow 2 <= y pow 2`];; +searcht 10 [`sqrt(y pow 2)`];; + + +search[`sqrt(a*b) = sqrt a * sqrt b`],SQRT_MUL;; +search[`sqrt(a pow 2 * b)`];; +search[`sqrt(x pow 2)`],POW_2_SQRT_ABS;; + + +search[`acs`;`atn`],ACS_ATN;; +search[`atn`;`pi`],ATN_1;; +search[`pi`;`atn`],ATN_1;; +search[`interval_eps (float a b) r e`];; +search[`real_of_int (& n)`];; +search[`twopow (-- (int_of_num n))`],Float.TWOPOW_NEG;; +search[`x:1`];; +search_thml (term_match []) [(concl Hypermap.lemma_mAdd)] (map (fun t -> ("",t)) (definitions()));; +search!definitions +searcht 10 [`pi`;`atn`];; +searcht 10 [`atn`;`halfatn4`];; +search[`acs`;`atn`];; +searcht 10[`atn`;`pi`];; +searcht 10 [`ssqrt`];; +search[`!i. 1 <= i /\ i <= 3 ==> vec 1$ i = &1`];; +searcht[`x <= y /\ y <= z ==> x <= z`];; +search[`atn`];; +search[`cos`];; +search[`sin`;`FACT`];; +search [`sum (:num)`];; +search[`has_real_derivative`;`atn`];; (* HAS_REAL_DERIVATIVE_ATN *) +search[`binom`];; +search[`has_real_derivative`;`Re`];; (* HAS_REAL_COMPLEX_DERIVATIVE_AT *) +search[`has_complex_derivative`];; +search[`atn`;`catn`];; (* yes *) +search[`dihX3`];; +search[`sin x = t`];; +search[`mcell_set`];; +search[`dihV a b c d = dihV a' b' c' d'`];; +search[`facet_of`];; +searcht 5[`aff_ge`];; +searcht 5[`sum X f = &0`], SUM_TRIV_NUMSEG;; +search [`sum (i..SUC j) f`], CONJUNCT2 SUM_CLAUSES_NUMSEG;; +search [`sum (i..i)`],SUM_SING_NUMSEG;; +searcht 5[`sum (i..j) f`;`i< j`];; +search[`sum (SUC i..j) f`];; +search[`fan80 (x,V,E) = y`];; +search[`fan81 (x,V,E) = y`];; +search[`let x = (y:A) in (z:B)`];; +search[`let x = y in z`];; +search[name "CZZH"];; +fst(List.nth (search[full `sqrt(&x) = y`]) 0);; +search[full `!x y. x + y = y + x`];; +search[`sqrt`;omit `x:num`];; +search[];; +search[exactly `a + b = b + a`];; +search[full `!a b. a + b = b + a`];; +search[`x:hypermap`];; +search[`sqrt(&x) = y`];; + +search [`sum (i..SUC j)`];; +Searching.suggest();; +search[`abs(atn u - &16 *x)`];; +search[`abs(x + y) <= abs(x) + abs y`],REAL_ABS_TRIANGLE;; + +help_grep "mk_n";; +help "instantiate";; +help "INSTANTIATE";; +help_grep "TERM";; +help "AP_TERM";; +help_grep "DISCH";; +help "UNDISCH";; +help_grep "conj";; +help_grep "mk.*eq";; +help_grep "ty.*var";; +help_grep "ty";; +help_grep "strip";; +help_grep "_TAC$";; +help_grep "^ASM";; +help "PROVE_HYP";; +help "EQ_MP";; +help "AP_TERM";; +Searching.help_grep "AP_";; +help "striplist";; +help"MK_CONJ";; +help "META_EXISTS_TAC";; +help "UNIFY_ACCEPT_TAC";; +help_grep "PURE_";; +help "BETA_CONV";; +help_grep "ARITH";; + + +(* +g `(P:num-> bool) ( @ t. t >0)`;; +g `(a /\ b) ==> c`;; +g `(a \/ b) ==> c`;; +g `(?x . t) ==> c`;; +g `(f:A->B) = g`;; +g `(x:A->B) = g`;; +g `sqrt(&3) < sqrt(&4)`;; +g `?x. f x`;; +DISCH_TAC; +s 0;; + +eh 1;; +eh 0;; +eh 0;; + +eh 1;; +suggest();; +g `?x. f x`;; +g `(f:A->B) =g`;; +*) + + +(* + + +termination tactics MESON, REAL_ARITH, SET_TAC, ARITH_TAC;; +REAL_FIELD, REAL_RING, SIMPLE_COMPLEX_ARITH_TAC; + + REAL_LET_TRANS;; +FORALL_PAIR_THM;; +REWRITE_TAC[FORALL_PAIR_THM];; + EXISTS_PAIRED_THM;; +REWRITE_TAC[GSYM EXISTS_PAIRED_THM] ;; +*) + + +(* IMP_RES_THEN forward implications of assumption list *) +(* MATCH_ACCEPT_TAC goal is instance of supplied theorem + PATH_CONV, find_path, follow_path + PAT_CONV (can be used on swapping quantifiers! ) + POP_ASSUM, POP_ASSUM_LIST + REPLICATE_TAC n GEN_TAC + RULE_ASSUM_TAC (maps an inference rule over assumption list) + RULE_ASSUM_TAC (TRY (CHOOSE_)) + SUBST1_TAC, SUBST_ALL_TAC. + *) + +(* +NAMED ASSUMPTIONS +*) + +(* +theorem usage. +rewrites, simplifications, introductions, definitions, +assume ispecl, +*) + +(* +amplifications, +curtailments, +*) + +(* +terminators. +*) + +(* +quants. +*) + +(searcht 5 [`x pow (a + y) = x pow a * x pow y`],REAL_POW_ADD);; +(searcht 5 [`x pow 1`],REAL_POW_1);; +searcht 5 [`x pow 0`],(CONJUNCT1 real_pow);; + +(* some searches that came up in practice. *) + +Searching.suggest();; +search[`atn has_real_derivative z`];; +searcht 10[name "WITHIN";`atreal`;`has_real_derivative`],"HAS_REAL_DERIVATIVE_ATREAL_WITHIN"; +searcht 3[name "MVT";`has_real_derivative`],REAL_MVT_VERY_SIMPLE;; +searcht 5 [`inv (x * y ) = inv (x ) * inv (y)`],REAL_INV_MUL;; +searcht 5 [`z pow (a + b) = z pow a * z pow b`],REAL_POW_ADD;; +searcht 5 [`(z pow a) pow b = z pow (a * b)`];; +searcht 8 [`halfatn`],halfatn_bounds_abs;; +searcht 8 [`atn(halfatn x)`];; +halfatn_half; +searcht 8 [`&0 <= abs(x)`],REAL_ABS_POS;; +searcht 8 [`inv (x pow k)`],REAL_INV_POW;; +search[`x pow k <= y pow k`],Real_ext.REAL_PROP_LE_POW; +search[`&0 <= x pow 2`];; +search[`inv x <= inv y`];REAL_LE_INV2;; +search[`&0 <= abs(x)`],REAL_ABS_POS;; +search[`abs(inv x)`;`inv(abs x)`],REAL_ABS_INV;; +search[`abs(x * y) = abs(x) * abs y`],REAL_ABS_MUL;; +search[`x * y <= x * z`],REAL_LE_LMUL;; + +searcht 5 [`EVEN`;`ODD`],NOT_EVEN;; +searcht 5 [`~(?x. P)`],NOT_EXISTS_THM;; +searcht 10 [`(=) (a..b)`],numseg;; +searcht 3[`sum (IMAGE f X)`],SUM_IMAGE;; +searcht 3[`sum`;`SUBSET`;`&0`],SUM_SUPERSET;; +search[`m/m = &1`],REAL_DIV_REFL;; +search [`&x = &y`;`(x:num) = y`],REAL_OF_NUM_EQ;; +searcht 4 [`& (x * y)`; `& x * & y`],REAL_OF_NUM_MUL;; +searcht 4 [`ODD`;`2 * k`], ODD_EXISTS;; +searcht 4 [`EVEN`;`ODD`],NOT_EVEN;; +search[`norm (Cx x)`],COMPLEX_NORM_CX;; +search[`Cx x pow i`],CX_POW;; +search[`Cx a - Cx b`],CX_SUB;; +search[`Cx (x) * Cx (y)`],CX_MUL;; +search[`Cx(x)/Cx(y)`],CX_DIV;; +searcht 5 [`f (if x then y else z)`;`(if x then f y else f z)`];; "not found" +search[`Im (Cx x)`];; +search[`catn`;`atn`],GSYM CX_ATN;; +search[`taylor_coeff_catn`;`DIV`],taylor_coeff0;; +(searcht 10 [`Im z = &0`;`Cx`],"not found" (Im z = &0 <=> (?x. z = Cx(x))));; +search[`Im (Cx x) = &0`],IM_CX;; +search[`(x:num) > y <=> y < x`],GT;; +search [`0 < FACT n`],FACT_LT;; +search[`(&x = &y) = (x = y)`],REAL_OF_NUM_EQ;; +(search[`((a:real) * b /a = b)`],REAL_DIV_LMUL); +(search[`taylor_coeff_catn 0`],taylor_coeff_catn0);; +search[`taylor_coeff_catn`;`has_complex_derivative`];; + +(* -- hard one to find. (at x) (at x within y) *) +([`at x within y`,`has_complex_derivative`],HAS_COMPLEX_DERIVATIVE_AT_WITHIN); +(search[`Im ( v % x )`],IM_CMUL); +(`Im (x + y)`,IM_ADD); +(`&1 pow n`,REAL_POW_ONE); +(`abs( -- x)`,REAL_ABS_NEG); +(`abs(&n)`,REAL_ABS_NUM); +[ +(`norm((a:real^A) + b) <= norm (a) + norm(b)`,"NORM_TRIANGLE",NORM_TRIANGLE);; +];; + +MATCH_MPlist: +[ +(`((a:real) <= c ) /\ (b <= d) ==> (a + b <= c + d)`,"REAL_LE_ADD2",REAL_LE_ADD2); +];; +num_CASES;; +search[`norm(a-b)`;`dist`];; +search[`0 <= FACT n`];; +search[`norm(inv(a))`];; +search[`&a <= &b`;`(a:num) <= (b:num)`];; +search[`norm (a * b) = norm (a) * norm (b)`];; +search[`norm ii`];; +search[`norm (z pow k)`];; +search[`norm (Cx a)`];; +search[`norm(inv z)`];; +COMPLEX_NORM_POW;; +COMPLEX_NORM_INV;; +search [`(z:real) pow (a + b)`];; +search[`z pow (a + b)`];; +search[`EVEN`;`2*m`];; +search[`atn (&0)`];; +search[`catn`;`atn`];; +search[`EVEN`;`ODD`];; +search[`Cx(&1) pow n`];; +search[`Cx (a * b)`];; +search[`z pow 0`];; + +search[`vsum`;`sum`;`Cx`],VSUM_CX_NUMSEG;; +VSUM_CX_NUMSEG;; +search[`has_complex_derivative`;`has_real_derivative`];; +COMPLEX_TAYLOR;; +HAS_COMPLEX_REAL_DERIVATIVE_AT;; + +([`vsum`;`sum`;`Cx`],VSUM_CX_NUMSEG);; +([`vsum:(num->bool) -> (num->complex)->complex`;`sum`],VSUM_CX_NUMSEG);; + +type_of `vsum`;; + +(* counting_spheres *) + + +(* +PRESERVES_NORM_INJECTIVE;; +MEASURABLE_LINEAR_IMAGE_EQ;; +RADIAL_NORM_LINEAR_INVARIANT;; +linear_inter_normball;; +search [`solvec0`];; +searcht 10 [`radial`];; +Marchal_cells_2.RADIAL_VS_RADIAL_NORM;; +searcht 1 [`radial_norm`];; +searcht 0 [`linear`;`radial_norm`];; +MEASURABLE_LINEAR_IMAGE_EQ;; +searcht 15 [`measurable`;`linear`];; +Vol1.sol;; +searcht 15 [`sol`];; +searcht 10 [`measurable (a INTER b)`];; +*) + + +(* +Vol1.sol;; +sol0_linear_r;; +linear_inter_normball;; +MEASURE_LINEAR_IMAGE_SAME;; +search[`vol`;`measure`];; +Marchal_cells_2.RADIAL_VS_RADIAL_NORM;; +search[`linear`;`measurable`];; +Vol1.sol;; +search[`radial_norm`];; +sol;; +SUBGOAL_TAC;; +SUBGOAL_THEN;; +search[`linear`;`t % f u`];; +type_of_goal ();; +help "apropos_types";; +PRESERVES_NORM_INJECTIVE;; +searcht 15 [`norm u = norm v`;`(f x = f y) ==> (x = y)`];; +searcht 5 [`<=>`;`(A ==> b) /\ (b ==> A)`];; +srch[`dist`;`norm`];; +ball;; +srch[`ball`];; +srch[`X SUBSET ball(u,r)`];; +srch[`vec 0 + x`];; +srch;; +srch [`IMAGE f x SUBSET IMAGE f t`];; +srch [`vec 0 + x`];; +type_of `radial_norm`;; +*) + +(* Work in progress + +def_of_regexp "radial$";; +def_of_regexp "radial_norm";; +def_of_regexp "radial$";; +srch [`eventually_radial`];; +srch [`radial_norm`];; +more();; +srch [`normball`;`ball`];; +search [`sol`];; +Vol1.sol;; +type_of `sol`;; +type_of_thm LINEAR_CMUL;; +type_of_goal();; +linear;; +srch [`f (t % u)`;`linear`];; +help "ISPECL";; + RELATIVE_INTERIOR_INJECTIVE_LINEAR_IMAGE;; +srch [`relative_interior (IMAGE f c)`];; +Polyhedron.fchanged;; +search_thml (term_match []) [`sol`] (map (fun s -> ("",s)) (!invariant_under_linear));; +srch [`fchanged`];; + +*) + +(* +add_linear_invariants;; +*) + +(* add_linear_invariants [FCHANGED_LINEAR_INVARIANT ; LINEAR_0;RCONE_LINEAR_INVARIANT ];; *) + + + + +(* +searcht 15 [`rcone_gt`];; +more();; +def_of_regexp "rconesgn";; +help_grep "without";; +searcht 5 [`dropout`];; +searcht 5 [`azim`;`Arg`];; +type_of `hypermap_of_fanx`;; +def_of_regexp "wedge";; +def_of_regexp "cyclic_set";; +search [`wedge_ge`;];; +search [`azim v1 v2 x y + azim v1 v2 y z`;name "sum"];; +search [`wedge_ge`];; +search [`cwedge`];; +search [`cw_dart_fan`];; +search [`cwedge`];; +search [`fan`];; +search [`FAN`];; +*) + +(* a polyhedral bound *) + +(* February 2012 searches *) + +results[];; +mark 0;; + +Calc_derivative.rational_identity `b / a * a = b`;; +searcht 5 [`face_of`;`t % v`];; +searcht 5 [`v dot v`;`&0`];; +mark 3;; +searcht 5 [`a dot (vec 0)`];; +mark 0;; +searcht 15 [`facet_of`;`{}`];; +mark 1;; +searcht 5 [`(a % b) dot c`];; +searcht 15 [`rcone_gt`];; +mark 1;; +searcht 5 [`x:real^3`;`x dot y = &0`];; +EUSOTYP_general;; +1;; +searcht 5 [`pad2d3d x = pad2d3d y`];; +mark 0;; +searcht 5 [`vec 0`;`Cx (&0)`];; +searcht 5 [`norm (facet_rep_a P c)`];; +mark 1;; +searcht 5 [`Cx u = Cx v`];; +searcht 5 [`norm x = r`];; +searcht 5 [`norm (vec 0)`];; +searcht 5 [`-- &1`;`aff_dim p`];; +searcht 5 [`polytope`;`polyhedron`];; +mark 4;; +facet_arg_lt_pi;; +!search_results;; +results[];; +mark 0;; +searcht 10 [`convex`;`polytope`];; +searcht 10 [`(?)`;`extreme_point_of`];; +searcht 10 [def "extreme"];; +searcht 10 [`extreme_point_of`;`face_of`];; +searcht 10 [`?`;`face_of`];; +searcht 15 [`X = {}`;`IN`];; +searcht 5 [`u HAS_SIZE 0`];; +1;; + + +searcht 15 [`radial_norm`];; +searcht 15 [`fchanged`;`radial_norm`];; +searcht 15 [`fchanged`;`radial`];; +searcht 15 [`fchanged`;`eventually_radial_norm`];; +searcht 15 [`wedge`;`radial_norm`];; +searcht 15 [`wedge`;`radial`];; +searcht 15 [`wedge`;`eventually_radial_norm`];; +searcht 15 [`wedge`;`sol`];; +searchn 0 [`sol`;`UNION`] "Conforming.SOL_DISJOINT_UNION";; +searchn 1 [`sol`;`UNIONS`] "Conforming.SOL_UNIONS";; +searchn 0 [`sol`;`UNIONS`] "Conforming.SUM_SOL_TOPOLOGICAL_COMPONENT_YFAN_EQ_SOL_UNIONS";; +searcht 15 [`sol`];; +searchn 2 [`sol`] "Conforming.SOLID_ANGLE_YFAN";; (* 4 Pi sum *) +searcht 5 [`fchanged`;`sol`];; +searchn 0 [`open`;`measurable`] "MEASURABLE_OPEN";; +searcht 10 [`fchanged`];; +search [name "AMHFNXP"];; +searcht 5 [`sum (n..n)`];; +searchn 2 [`sum X f = sum X g`] "SUM_EQ";; +SUM_ADD_SPLIT;; +SUM_PAIR;; +searcht 15 [`sum`;`(a..( n+m))`];; +searcht 15 [name "SUM_DIFF"];; +searchn 0 [`sum`;`\i. (f (i+1) - f (i))`] "SUM_DIFFS_ALT";; +searcht 15 [name "TELE"];; +searcht 15 [`azim`;`sum`];; +AZIM;; +searcht 5 [`&0 <= azim x y z w`];; +AZIM_BASE_SHIFT_LT;; +X_IN;; +X_GEN_TAC;; +help_grep "GEN";; +search [`p IN {}`];; +REAL_WLOG_LE;; +AZIM_BASE_SHIFT_LT;; +search[`cyclic_set`];; +Fan.sum4_azim_fan;; (* lower ineq *) +Fan.sum5_azim_fan;; (* upper ineq *) +Counting_spheres.EUSOTYP_general;; +searcht 5 [`azim a b c d < azim a b c' d'`];; +searcht 5 [`&0 <= azim a b c d`];; +searchn 1 [`azim`;`&2 * pi`] "Local_lemmas.AZIM_RANGE";; +searchn 2 [`azim`;`&2 * pi`] "Rogers.AZIM_COMPL_EXT";; +searcht 10 [`azim`;`&2 * pi`];; +searcht 25 [`wedge`];; +searcht 5 [`sum`;`azim`];; +searchn 3 [`azim a b c d + azim a b c' d'`] "Fan.sum5_azim_fan";; +searcht 50 [`azim a b c d + azim a b c' d'`;omit `cyclic_set`];; +vol_solid_triangle_ortho;; +vol_solid_triangle;; +searcht 5 [`vol_solid_triangle`];; +searcht 5 [name "solid_triangle"];; +searcht 5 [name "cone0"];; +searcht 5 [name "normball"];; +searcht 5 [`ball`;`( < )`];; +1;; + + +searcht 5 [`x IN IMAGE (dropout 3) U`];; +pad2d3d_dot;; +VECTOR_ARITH;; + linear;; +LINEAR_NEG;; +searcht 65 [def "linear"];; +searcht 15 [`linear`;`f (x:real^A) + f y`];; +searcht 15 [`linear`;`pad2d3d`;LINEAR_PAD2D3D];; +searcht 15 [`pad2d3d`;`(x:real^2)`];; +searcht 5 [`pad2d3d`;`dot`];; +types_of (concl pad2d3d_dot);; + +EUSOTYP_simple;; + +(* +searcht 5 [`(z:complex) * u = u * z`];; +searcht 5 [`Arg (Cx r * u)`];; +searcht 5 [`cnj (x * y)`];; +searcht 5[ `cnj`;`Cx`];; +searcht 5 [`Cx x = Cx y`];; +searcht 5 [`z * u = Cx(&0)`];; +ASM_CASES_TAC;; +searcht 5 [`inv( Cx (&0))`];; +*) + + +asimp[sym Ysskqoy.COS_ARG_VECTOR_ANGLE] +amt[Ysskqoy.COS_ARG_VECTOR_ANGLE;COMPLEX_ENTIRE;CX_INJ;arith `&0 < r ==> ~(r = &0)`] +searcht 5 [`Cx u = Cx v`];; +searcht 15 [`norm x = &0`];; +searcht 15 [`pi = &0`];; +searcht 15 [`cos x = &0`];; +searcht 5 [`inv x = &0`];; +Ysskqoy.COS_ARG_VECTOR_ANGLE;; +searcht 5 [`vector_angle u v = vector_angle v u`];; +GSYM +Ysskqoy.SEC_DOT;; +searcht 5 [`norm (facet_rep_a P c)`];; +searcht 5 [`norm (Cx r)`];; +searcht 5 [`(x:complex)/ x`];; +facet_arg_lt_pi;; +searcht 5 [` x HAS_SIZE 1`];; +facet_arg_lt_pi;; +POLY_SORT_BIJ;; +searcht 5 [`inv (Cx u)`];; +ARG_MUL_CX;; +searcht 5 [`inv (a * (b:complex))`];; +searcht 5 [`Arg`; `Cx`];; +searcht 5 [`(z:complex) * w`;`r % u`];; +searcht 5 [`facet_rep_a`;`&0`];; +mt[] +art[] + +POLYSORT_BIJ2;; +suggest();; +Counting_spheres.facet_rep_nz;; +searcht 5 [`Arg (Cx (&n))`];; +searcht 5 [`(x:complex)/x`];; +POLYTOPE_FACET_EXISTS;; +searcht 5 [`(?)`;`facet_of`];; +searcht 5 [`facet_rep_a P u = Cx (&0)`];; +SPECL [`u:real^2`;`h = \(i:num). facet_rep_a P (if i IN 1..n then f i else f 1)`;`n:num`] ARG_ORDER;; +types_of `h = \(i:num). facet_rep_a P (if i IN 1..n then f i else f 1)`;; +type_of_thm ARG_ORDER;; +ARG_ORDER;; +searcht 5 [`&0 <= Arg z`];; +ARG_INV_ALT;; +REAL;; +complex_frac_cancel;; +SIMPLE_COMPLEX_ARITH;; +help_grep "COMPLEX.*TAC";; +searcht 5 [`Cx (&1) * b = b`];; +searcht 5 [`inv b * b = Cx (&1)`];; +complex_div;; +searcht 0 [`inv (a:complex/b)`] "COMPLEX_INV_DIV" ;; +searcht 5 [`((a:complex)/b)/(c/d)`];; +searcht 5 [`Arg ((x/y)/(z/y))`];; +searcht 5 [`Arg (x/y)`];; +searchn 0 [`a /b = Cx (&0)`] "Ysskqoy.ARG_0_DIV";; +ARG_LE_DIV_SUM;; +searcht 0 [` (inv (z/(u:complex)))`] "COMPLEX_INV_DIV";; +searchn 0 [`&0 <= Arg z`] "ARG";; +searcht 5 [`facet_of`;`polyhedron`;`HAS_SIZE`];; +SEC_DOT;; +searcht 20 [`wedge`];; +searcht 10 [`Arg (z) + Arg (w) `];; +facet_arg_lt_pi;; +searcht 10 [`bisector_point`];; +searcht 10 [`norm (Cx (&0))`];; +searcht 10 [`Arg`;`Cx`];; +searcht 10 [`( * ):real^2->real^2->real^2`;`(%)`];; +searcht 10 [`Arg`;`(%)`];; + dest_const `(..)`;; +searcht 10 [`(..)`;`IN`];; +searcht 5 [`&0 < r`;`abs r = r`];; +searcht 5 [`norm (a % v)`];; +type_of `facet_rep_a`;; +searchn 3 [`facet_rep_a`] "Counting_spheres.facet_rep_in_poly";; +searchn 9 [`facet_rep_a`] "Counting_spheres.facet_arg_lt_pi";; +searchn 10 [`facet_rep_a`] "Counting_spheres.facet_rep_def";; (* rep has norm 1 *) +POLYHEDRON_LINEAR_IMAGE;; +Ysskqoy.COS_ARG_VECTOR_ANGLE;; +bisector_point;; +Ysskqoy.SEC_DOT;; +searchn 0 [`BIJ`;`HAS_SIZE`] "Counting_spheres.POLY_SORT_BIJ";; + +searcht 10 [`pad2d3d`];; +searcht 10 [`aff_dim`;`plane`];; +searcht 10 [`affine`;`SUBSET`];; +pad_in;; +searcht 15 [`IN`;`SUBSET`];; +searcht 15 [`pad2d3d`];; +searchn 0 [`Cx (&0)`;`vec 0`] "COMPLEX_VEC_0";; +searcht 5 [`x SUBSET x`];; +searcht 5 [`SUBSET`;`facet_of`];; +searcht 5 [`IMAGE h x = x`];; +searcht 5 [`IMAGE f (IMAGE g x)`];; +BIJECTIONS_HAS_SIZE;; +searchn 0 [`linear`;`facet_of`] "FACET_OF_LINEAR_IMAGE" ;; +searcht 5 [`dropout`;`(f x = f y) ==> (x =y)`] (* none *);; +searchn 0 [`dropout`;`linear`] "LINEAR_DROPOUT";; +searcht 15 [`dropout`;`face_of`] ;; +PRESERVES_NORM_INJECTIVE;; +searcht 5 [`dropout`;`norm`];; (* none *) +searcht 15 [`(f x = f y) ==> (x = y)`;`HAS_SIZE`];; + +searchn 0 [`pad2d3d`;`linear`] "LINEAR_PAD2D3D";; +AZIM_SPECIAL_SCALE;; + +PRESERVES_NORM_INJECTIVE;; +NORM_PAD2D3D;; + +searchn 0 [`linear`;`polyhedron`] "POLYHEDRON_LINEAR_IMAGE";; +searchn 0 [`linear`;`bounded`] "BOUNDED_LINEAR_IMAGE";; +searchn 0 [`pad2d3d`;`linear`] "LINEAR_PAD2D3D";; +type_of_goal();; + +searchn 1 [`norm z = &0`] "COMPLEX_NORM_ZERO" +searchn 1 [`real`;`Re`]"REAL_NORM";; +searcht 5 [`(a = b) = (b = a)`];; +searcht 5 [`Cx (Re (t))`];; +searcht 5 [`Arg (Cx (&0))`];; +searcht 5 [`Arg x = Arg y`];; +searcht 5 [`Arg`;`Re`];; +searcht 5 [`inv (x/(y:complex))`];; +searcht 15 [`Arg`;`real`];; + +help "LAND_CONV";; +searchn 6 [`Arg (x)`;`pi`] "ARG_INV";; +type_of_goal();; +type_of `azim`;; +type_of `plane`;; + + +(* + GEOM_BASIS_MULTIPLE_TAC 3`v:real^3` +*) + +(* add_linear_invariants [FCHANGED_LINEAR_INVARIANT ; LINEAR_0;RCONE_LINEAR_INVARIANT ];; *) +(* let backup_invariant_under_linear = !invariant_under_linear;; *) +(* +let restore _ = + invariant_under_linear := backup_invariant_under_linear;; +restore();; +*) +(* add_linear_invariants [SOLVEC0_LINEAR_INVARIANT_3];; *) + +(* +searcht 15 [`facet_rep_a`];; +POLY_SORT_BIJ;; +searcht 15 [`plane`];; +*) + + +(* +let _ = [`ball`;`half_spaces`;`weakly_saturated`;`lmfun_ineq_center`];; + +let _ = [ball;Tarjjuw.half_spaces;Tarjjuw.weakly_saturated;Pack_defs.lmfun_ineq_center];; + +let _ = [Tarjjuw.TARJJUW;Ysskqoy.YSSKQOY];; +*) + + + + + +(* TARJJUW *) +(* +searcht 5 [`packing`;`FINITE`];; +searcht 15 [`ball_annulus`];; +searcht 5 [`sup`;`FINITE`];; +weakly_saturated;; +ball_annulus;; +searcht 5 [`weakly_saturated`];; +type_of `ball_annulus`;; +def_of_regexp "ball_annulus";; +constant_of_regexp "ball_annulus";; +def_of_regexp "ball_annul";; +Tarjjuw.TARJJUW;; +search [name "TARJ"];; +apropos();; +constant_of_regexp "TRI";; +def_of_regexp "sol$";; +def_of_regexp "solid_triangle";; +help "apropos_searching";; +constant_of_regexp "satur";; ["weakly_saturated"; "saturated"];; +def_of_regexp "weakly_saturated";; +def_of_regexp "max";; +constant_of_regexp "inter";; +def_of_regexp "closed_real_interval";; +search [`weakly_saturated`];; (* "Tarjjuw.TARJJUW" *) +Tarjjuw.TARJJUW;; +def_of_regexp "ball";; (* open *) +def_of_regexp "half_spaces";; +def_of_regexp "ineq_cen";; +searcht 5 [`weakly_saturated`];; +let ineq693 = `~lmfun_ineq_center V`;; +type_of `sum`;; +searcht 5 [`..`];; +type_of `lmfun`;; +searcht 5 [`lmfn_ineq_center`];; +*) + + + +searcht 5 [`pad2d3d`;`dot`];; + + + + + +(* Tue Feb 28 08:27:45 EST 2012 *) + +searcht 50 [`facet_of`;`polyhedron`;`IN`;`t % v`];; +mark 0;; +searcht 20 [`rcone_gt`;`vec`];; +searcht 20 [`rconesgn`];; +mark 6;; +mark 7;; +searcht 20 [`x - vec 0`];; +mark 0;; +searcht 5 [`dist (x, vec 0)`];; +mark 0;; +searcht 5 [`(a % v) dot u`];; +mark 0;; +searcht 5 [`norm (a % v)`];; +mark 0;; +searcht 5 [`norm`; `v dot v`];; +mark 4;; +searcht 15 [`(a:real) * c < b * d`];; +searcht 15 [`abs x = x`];; +mark 12;; +searcht 15[`&0 < a / b`];; +mark 1;; +mark 6;; +searcht 15 [`x * y < x * v`];; +mark 4;; +searcht 15[`&0 < a * b`];; +mark 4;; +searcht 15 [`polyhedron`;`face_of`;`a % v`];; +searcht 15 [name "INTERI";name "POLY"];; +mark 0;; +searcht 100 [`relative_interior`;`polyhedron`];; +mark 0;; +FACET_OF_POLYHEDRON_EXPLICIT;; +searcht 50 [`polyhedron`;`fchanged`];; +searcht 5 [`x /\ y <=> ((u:A->bool) = b)`];; +searcht 5 [`x SUBSET y /\ y SUBSET x`];; +searcht 5 [`x SUBSET a INTER b`];; +searcht 5[`relative_interior f SUBSET fchanged f`];; +mark 0;; +searcht 5 [`x SUBSET affine hull x`];; +mark 0;; +searcht 5 [`relative_interior s SUBSET s`];; +mark 0;; +searcht 10 [`fchanged`];; +searcht 10 [`a % v`;` affine hull f`];; +mark 3;; +searcht 10 [`a % v = b % v`];; +mark 0;; +searcht 10 [`affine`;`vec 0`];; +mark 2;; +searcht 10 [`dependent`];; +searcht 5 [`a % vec 0`];; +searcht 5 [`a - vec 0`];; +searcht 5 [`vec 0 + u`];; +searcht 5 [`vec 0 - u`];; +searcht 5 [`u IN (:A)`];; +VECTOR_ARITH;; +searcht 5 [` t % u = vec 0`];; +mark 2;; +searcht 5[`face_of`;`affine`];; + +(* Sun Mar 4 10:27:12 EST 2012, counting spheres *) + +searcht 15 [`relative_interior`;`face_of`];; +mark 1;; +searcht 10 [`face_of`;`hull`];; +mark 2;; +searcht 10 [`~(X = {})`];; +searcht 10 [`relative_interior f SUBSET y`];; +mark 0;; +searcht 10 [`affine hull A SUBSET affine hull B`];; +mark 0;; +searcht 10 [`&1 % v`];; +mark 0;; +searcht 10 [`u hull A SUBSET u hull B`];; +mark 3;; +searcht 5 [`u hull (u hull A)`];; +mark 1;; +searcht 5 [`u IN {a,b}`];; +research 5;; +searcht 5 [`f SUBSET P hull x`];; +mark 0;; +searcht 5 [`convex`; `polyhedron`];; +mark 0;; +searcht 5 [`face_of`;`facet_of`];; +mark 1;; +searcht 5 [`relative_interior`;`interior`];; +mark 0;; +searcht 15 [`facet_of`];; +searcht 5 [`relative_interior x SUBSET y`];; +mark 0;; +FCHANGED_AFFINE;; +searcht 5 [name "POLY"; name "COLL"; name "FACE"];; +searcht 5 [`affine hull c`;`facet_of`];; +mark 1;; +searcht 5 [`affine hull u = (:real^N)`];; +mark 3;; +searcht 5 [`x dot y = y dot x`];; +mark 0;; +searcht 5 [`v dot (a % w)`];; +searcht 5 [`rcone_gt`];; +searcht 15 [`rconesgn`];; +searcht 15 [`dist(v,vec 0)`];; +searcht 15 [`a < b`;`a pow 2 < b pow 2`];; +mark 3;; +searcht 5 [`(a * b) pow 2`];; +mark 1;; +searcht 5 [`norm p pow 2`];; +mark 1;; +mark 2;; +searcht 5 [`&0 <= a * b`];; +mark 4;; +searcht 5 [`&0 <= norm x`];; +mark 0;; +searcht 15 [`a < b`;`a pow 2 < b pow 2`];; +mark 2;; +searcht 5 [`dist (a,b) pow 2`];; +mark 0;; +searcht 20 [`sqrt(&1 - a pow 2)`];; +searcht 5 [`norm v = &0`];; +mark 3;; +searcht 5 [`sqrt x pow 2`];; +mark 1;; +searcht 5 [`&0 <= &1 - t pow 2`];; +mark 0;; +searcht 15 [`a * x < b * x`];; +mark 2;; +searcht 5 [`&0 < a * b`];; +mark 4;; +searcht 5 [`&0 < t pow 2`];; +mark 0;; +searcht 5 [`cos (arcV a b c)`];; +mark 0;; +searcht 5 [`&0 < a * b`];; +mark 4;; +mark 3;; +searcht 5 [`&0 < &1 - t pow 2`];; +searcht 5 [`t pow 2 < &1`];; +mark 0;; +searcht 5 [`&0 < sqrt u`];; +mark 1;; +searcht 5 [`&0 < norm v`];; +mark 0;; +searcht 5 [`a*b = a * c`];; +mark 0;; +searcht 5 [`a % v = vec 0`];; +mark 2;; +searcht 5 [`a / b = &0`];; +mark 2;; +searcht 5 [`vec 0 dot u = &0`];; +mark 0;; +searcht 5 [`(a/b) pow 2`];; +mark 0;; +searcht 5 [`x pow 2 = y pow 2`];; +mark 4;; +searcht 5 [`a dot b = b dot a`];; +mark 0;; +searchk 5 [`&0 <= a/b`];; +mark 1;; +searcht 5 [`&0 <= a * b`];; +mark 4;; +searcht 5 [`&0 <= norm t`];; +mark 0;; +searcht 5 [`v dot v = &0`];; +mark 0;; +searcht 5 [`norm x = &0`];; +mark 3;; +searchk 5 [`norm x pow 2`];; +searchk 5 [`measure A <= measure ( B)`];; +mark 0;; +searcht 5 [`measurable`;`wedge`];; +mark 0;; +searcht 5 [`eventually_radial`;`wedge`];; +searcht 14 [`eventually_radial`];; +mark 7;; +vol_solid_triangle_ortho;; +searcht 5 [`vol_solid_triangle`;`solid_triangle`];; +mark 1;; +searcht 3 [`solid_triangle`];; +mark 0;; +searcht 5 [`cone0`];; +mark 1;; +searcht 5 [`measure`;`measurable`];; +searchk 5 [`primitive`];; (* measurability of solid_triangle *) +mark 0;; +mark 1;; +searchk 50 [`fchanged`;`topological_component_yfan`];; +mark 1;; +searcht 50 [`topological_component_yfan`;`measurable`];; +mark 0;; +searcht 50 [`FAN`;`polyhedron`];; +mark 0;; +searcht 50 [name "PIIJ"];; +mark 0;; +searcht 5 [`fan80`];; +mark 0;; +searcht 5 [`set_of_edge`;`polyhedron`];; +mark 1;; +searcht 5 [`eventually_radial`;`topological_component_yfan`];; +searchk 5 [`radial`];; +mark 5;; +searchk 5 [`normball`;`ball`];; +mark 1;; +searchk 5 [`fchanged`;`t % v`];; +mark 0;; +searchk 5 [`a % b % c`];; +mark 0;; +searchk 5 [`&0 < a * b`];; +searcht 5 [`radial`;`ball`];; +searcht 5 [`IN`;`ball`];; +mark 3;; +searcht 5 [`dist`;`norm`];; +mark 1;; +searchk 5 [`norm (--u)`];; +mark 0;; +searchk 5 [`norm (t % u)`];; +searchk 10 [`wedge`;`azim`];; +mark 5;; +searcht 5 [`azim`;`azim a b c d + azim a b d e`];; +searcht 5 [`X = {}`;`?`];; +mark 2;; +searchk 5 [name "SHIFT";`azim`];; +mark 0;; +searchk 5 [`azim a b c c `];; +mark 0;; +searchk 5 [`aff_gt`];; +mark 1;; +searchk 5 [`cone0`];; +searcht 15 [`affsign`;`SUBSET`];; +searchk 5 [`affsign`];; +mark 32;; +searcht 15 [`aff_gt`;`convex`];; +mark 0;; +searcht 15 [`convex`;`fchanged`];; +searcht 5 [`convex`;`topological_component_yfan`];; +searcht 15 [`fchanged`;`aff_gt`];; +searcht 15[ `fchanged`;`affsign`];; +searchk 5 [`cone0`];; +searchk 5 [`fchanged`];; +searchk 5 [`convex0`];; +search [`affsign`];; +AFFSIGN;; +searcht 5 [`{} UNION X`];; +mark 0;; +searchk 5 [`x IN {}`];; +mark 0;; +searchk 8 [`vsum`;`INSERT`];; +mark 4;; +mark 6;; +searchk 5 [`collinear`;`~(x = y)`];; +mark 0;; +searcht 15 [`collinear {x,y,z} = collinear {u,v,w}`];; +1;; + +(* Tue Mar 6 06:09:41 EST 2012 *) +searcht 15 [`face_of`;`SUBSET`;`convex`];; +mark 8;; +searchk 5 [`sum`;`INSERT`];; +mark 7;; +mark 2;; +searcht 15 [`convex`;`sum`];; (*117*) +mark 9;; +searchk 5 [`relative_interior a SUBSET relative_interior b`];; +mark 0;; +searcht 15 [`convex`;`facet_of`];; +mark 4;; +searchk 5 [`convex`;`face_of`];; (* ?120 *) +mark 2;; +searcht 5 [`sgn_gt`];; +mark 3;; +searcht 15 [`a <= sum s f `];; +mark 6;; +searcht 5 [`sum (A UNION B) f `];; +mark 0;; +searcht 5 [`x HAS_SIZE n`;`x IN u`];; +searcht 5 [`x HAS_SIZE 0`];; +mark 0;; +searcht 5 [`x HAS_SIZE 1`;`x IN u`];; +mark 0;; +searchk 5 [`sum s f <= sum s' f`];; +mark 0;; +searchk 15 [`CARD`;`INSERT`];; +searchk 15 [`convex hull a SUBSET f`];; (* 128 *) +mark 3;; +searchk 15 [`convex hull s = s`];; (* 129 *) +mark 2;; +searchk 15 [`convex`;`facet_of`];; +searchk 5 [`face_of`;`facet_of`];; +searchk 15 [`affine hull u`;`aff_dim`];; +mark 5;; +searchk 15 [`convex hull u `;`aff_dim`];; +searchk 15 [`aff_dim`;`facet_of`];; (* 42 *) +searchk 15 [`interior`;`aff_dim`];; +mark 0;; +searchk 15 [`collinear`;`aff_dim`];; +searchk 5 [`SUBSET`;`aff_dim`];; (* 132 *) +mark 0;; +searchk 5 [`x SUBSET P hull x`];; +searchk 15 [`aff_dim`;`INSERT`];; +mark 3;; +mark 2;; +searchk 5 [`affine`;`collinear`];; +mark 2;; +searchk 5 [`affsign`;`{}`;`{x}`];; +searchk 5 [`a % vsum s f`];; +mark 0;; +searchk 5 [`a % b % c`];; +searchk 5 [`UNION`;`INSERT`];; +mark 3;; +searchk 15 [`sum`;`INSERT`];; +mark 6;; +searchk 15 [`a % vec 0 `];; +mark 0;; +searchk 5 [`sum s (\v. f v * u)` ];; +mark 1;; +searchk 5 [`x / y`;`inv`];; +mark 1;; +searchk 5 [`face_of`;`interior`];; +mark 0;; +searcht 15 [`a INTER b = {}`];; +mark 14;; +searchk 5 [`aff_dim (convex hull s)`];; +mark 0;; +searchk 5 [`x:real^3`;`?`;`u dot v = &0`;`~(v = vec 0)`];; +searchk 5 [`eventually_radial`;`sol`];; +searcht 50 [`sol`];; +mark 8;; (* 145, sol def *) +mark 15;; (* 146, SOL_UNIONS *) +searchk 5 [`radial_norm`;`radial`];; +mark 0;; (* 147 *) +vol_solid_triangle_ortho;; +searcht 15 [def "collinear"];; +searchk 15 [`collinear`;`~(a = (b:real^N))`];; +mark 11;; +searchk 15 [`affine hull {x,y}`];; +mark 10;; +searchk 15 [`affine`;`aff`];; +mark 5;; +searchk 15 [`aff_gt`;`wedge`];; +mark 2;; +searchk 15 [`collinear {vec 0 ,a,b}`];; +mark 13;; +mark 4;; +searchk 15 [`v dot v = &0`];; +1;; + +(* Wed Mar 7 07:03:30 EST 2012 *) + +searchk 5 [`&0 <= sqrt x`];; +mark 2;; +searchk 5 [`(\x. Q x) x = Q x`];; +1;; + +(*---^^ command line ^^ --- *) + + + +(* GG generic commands *) + +List.map (fun n -> List.nth !search_results n) (100--120);; +suggest();; +result 200 [];; +mark 0;; +type_of_goal();; +write 0;; + +map (fun (_,s,_,_) -> s) !search_results;; + +let search_result_dump = +["REAL_LT_MUL"; "REAL_LT_LMUL"; "REAL_LT_DIV"; + "Local_lemmas.REAL_LT_DIV_NEG"; "Trigonometry2.LT_IMP_ABS_REFL"; + "NORM_POW_2"; "NORM_MUL"; "DOT_LMUL"; "DIST_0"; "VECTOR_SUB_RZERO"; + "rconesgn"; "rcone_gt"; "Polyhedron.REDUCE_POINT_FACET_EXISTS"; + "POLYHEDRON_COLLINEAR_FACES"; "DOT_POS_LT"; "DOT_RZERO"; "facet_of"; + "DOT_LMUL"; "Trigonometry2.EXISTS_OTHOR_VECTOR_DIFFF_VEC0"; + "Trigonometry2.EXISTS_UNIT_OTHOR_VECTOR"; "INJECTIVE_PAD2D3D"; + "COMPLEX_VEC_0"; "COMPLEX_VEC_0"; "Counting_spheres.facet_rep_def"; + "CX_INJ"; "COMPLEX_NORM_CX"; "POLYTOPE_EQ_BOUNDED_POLYHEDRON"; + "POLYTOPE_IMP_CONVEX"; "POLYTOPE_IMP_COMPACT"; + "EXTREME_POINT_EXISTS_CONVEX"; "FACE_OF_SING"; + "FACE_OF_POLYHEDRON_SUBSET_FACET"; "POLYTOPE_FACET_EXISTS"];; + +let search_result_dump_march7_8am = ["Trigonometry2.COLLINEAR_TRANSABLE"; "Trigonometry2.COLLINEAR_TRANSABLE"; + "Trigonometry2.COLLINEAR_TRANSABLE"; "Trigonometry2.COLLINEAR_TRANSABLE"; + "COLLINEAR_LEMMA_ALT"; "WEDGE_LUNE_GT"; "COLLINEAR_3_AFFINE_HULL"; + "Sphere.aff"; "AFFINE_HULL_2_ALT"; + "Marchal_cells_2.RADIAL_VS_RADIAL_NORM"; "Conforming.SOL_UNIONS"; + "Vol1.sol"; "AFF_DIM_CONVEX_HULL"; "Hypermap.lemma_in_disjoint"; + "FACE_OF_DISJOINT_INTERIOR"; "real_div"; "SUM_RMUL"; "VECTOR_MUL_RZERO"; + "SUM_CLAUSES"; "Packing3.SING_UNION_EQ_INSERT"; "VSUM_LMUL"; + "Collect_geom.IN_AFFINE_HULL_IMP_COLLINEAR"; "AFF_DIM_2"; + "AFF_DIM_INSERT"; "AFF_DIM_SUBSET"; "Polyhedron.AFF_DIM_INTERIOR_EQ_3"; + "AFF_DIM_EQ_AFFINE_HULL"; "CONVEX_HULL_EQ"; + "Marchal_cells.CONVEX_HULL_SUBSET"; + "Upfzbzm_support_lemmas.SUM_SET_OF_2_ELEMENTS"; "SUM_SUBSET_SIMPLE"; + "HAS_SIZE_1_EXISTS"; "HAS_SIZE_0"; "SUM_UNION"; "SUM_POS_LE"; "sgn_gt"; + "FACE_OF_IMP_CONVEX"; "POLYTOPE_UNION_CONVEX_HULL_FACETS"; + "SUBSET_RELATIVE_INTERIOR"; + "EXPLICIT_SUBSET_RELATIVE_INTERIOR_CONVEX_HULL"; "Geomdetail.SUM_DIS3"; + "face_of"; "FACE_OF_CONVEX_HULL_SUBSET"; "Geomdetail.VSUM_DIS3"; + "Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL"; + "Marchal_cells_2.VSUM_CLAUSES_alt"; "NOT_IN_EMPTY"; "UNION_EMPTY"; + "aff_gt_def"; "CONVEX_AFF_GT"; "affsign"; "Sphere.aff_gt_def"; + "AZIM_REFL"; "AZIM_BASE_SHIFT_LT"; "Counting_spheres.EMPTY_NOT_EXISTS_IN"; + "wedge"; "NORM_NEG"; "dist"; "IN_BALL"; "VECTOR_MUL_ASSOC"; + "Polyhedron.fchanged"; "NORMBALL_BALL"; "Sphere.radial"; + "Polyhedron.CARD_SET_OF_EDGE_INEQ_1_POLYHEDRON"; + "Polyhedron.POLYTOPE_FAN80"; "Conforming.PIIJBJK"; + "Polyhedron.POLYHEDRON_FAN"; + "Conforming.MEASURABLE_TOPOLOGICAL_COMPONENT_YFAN_INTER_BALL"; + "Polyhedron.FCHANGED_IN_COMPONENT"; "primitive"; "MEASURABLE_RULES"; + "Sphere.cone0"; "solid_triangle"; "Vol1.volume_prop_fix"; + "Sphere.eventually_radial"; "MEASURABLE_BALL_WEDGE"; "MEASURE_SUBSET"; + "NORM_EQ_0"; "DOT_EQ_0"; "NORM_POS_LE"; "Real_ext.REAL_PROP_NN_MUL2"; + "Calc_derivative.invert_den_le"; "DOT_SYM"; "Collect_geom.EQ_POW2_COND"; + "Trigonometry2.DIV_POW2"; "DOT_LZERO"; "Calc_derivative.invert_den_eq"; + "VECTOR_MUL_EQ_0"; "REAL_EQ_MUL_LCANCEL"; "NORM_POS_LT"; "SQRT_POS_LT"; + "ABS_SQUARE_LT_1"; "Calc_derivative.invert_den_lt"; "REAL_LT_MUL"; + "Trigonometry1.DOT_COS"; "Trigonometry2.NOT_ZERO_EQ_POW2_LT"; + "REAL_LT_MUL"; "REAL_LT_RMUL"; "Trigonometry2.UNIT_BOUNDED_IN_TOW_FORMS"; + "SQRT_POW_2"; "NORM_EQ_0"; "Collect_geom.DIST_POW2_DOT"; + "Tarjjuw.CHANGE_TARJJUW_4"; "NORM_POS_LE"; "Real_ext.REAL_PROP_NN_MUL2"; + "NORM_POW_2"; "DOT_SQUARE_NORM"; "Trigonometry2.MUL_POW2"; + "Tactics_jordan.REAL_POW_2_LT"; "DOT_SYM"; + "Polyhedron.INTERIOR_AFFINIE_HUL_EQ_UNIV"; + "Counting_spheres.affine_facet_hyper"; "RELATIVE_INTERIOR_SUBSET"; + "INTERIOR_SUBSET_RELATIVE_INTERIOR"; "facet_of"; "POLYHEDRON_IMP_CONVEX"; + "Ldurdpn.SUBSET_P_HULL"; "HULL_HULL"; "HULL_MONO"; "VECTOR_MUL_LID"; + "Marchal_cells_2.AFFINE_SUBSET_KY_LEMMA"; "RELATIVE_INTERIOR_SUBSET"; + "FACE_OF_STILLCONVEX"; "FACE_OF_DISJOINT_RELATIVE_INTERIOR"; + "REAL_LT_MUL"; "REAL_LT_LMUL"; "REAL_LT_DIV"; + "Local_lemmas.REAL_LT_DIV_NEG"; "Trigonometry2.LT_IMP_ABS_REFL"; + "NORM_POW_2"; "NORM_MUL"; "DOT_LMUL"; "DIST_0"; "VECTOR_SUB_RZERO"; + "rconesgn"; "rcone_gt"; "Polyhedron.REDUCE_POINT_FACET_EXISTS"; + "POLYHEDRON_COLLINEAR_FACES"; "DOT_POS_LT"; "DOT_RZERO"; "facet_of"; + "DOT_LMUL"; "Trigonometry2.EXISTS_OTHOR_VECTOR_DIFFF_VEC0"; + "Trigonometry2.EXISTS_UNIT_OTHOR_VECTOR"; "INJECTIVE_PAD2D3D"; + "COMPLEX_VEC_0"; "COMPLEX_VEC_0"; "Counting_spheres.facet_rep_def"; + "CX_INJ"; "COMPLEX_NORM_CX"; "POLYTOPE_EQ_BOUNDED_POLYHEDRON"; + "POLYTOPE_IMP_CONVEX"; "POLYTOPE_IMP_COMPACT"; + "EXTREME_POINT_EXISTS_CONVEX"; "FACE_OF_SING"; + "FACE_OF_POLYHEDRON_SUBSET_FACET"; "POLYTOPE_FACET_EXISTS"];; + +search_results := [];; +search_results := augment_search_results search_result_dump;; + +map retrieve_search_number (21--39);; + + +(* Oct 24, 2012 searches for EUSOTYP2_general *) +ALL_TAC;; +searc '0' 2 [`azim a b c d = azim a' b' c' d'`];; +searcht 5 [`DISJOINT`;`collinear`];; +EQ_SYM;; + (GSYM Topology.th1);;; +CHOOSE_TAC;; +VECTOR_ARITH;; +azim_axis;; +searc 'a' 3 [`~(?x. p)`;];; +searc 'b' 2 [`bounded`;`SUBSET`];; +searc 'c' 1 [`collinear`;`vec 0 `;`t % v`];; +searc 'd' 3 [`~(a \/ b)`];; +searc 'e' 0 [`(c % v) dot w`];; +searc 'f' 0 [`face_of`;`facet_of`];; +searc 'g' 0 [`(&0) % v`];; +searc 'h' 3 [`i IN a..b`];; +searc 'i' 3 [`&0 < a / b`];; +searc 'j' 0 [`x % v = y % v`];; +searc 'l' 0 [`(a + b) dot v`];; +searc 'p' 0 [`polyhedron`;`face_of`;`==>`];; + +searc 's' 0 [`SUBSET`;`face_of`];; +searc 't' 1 [`collinear {(vec 0),a,b}`;`t % x`];; +searc 'u' 8 [`collinear`;`t % x`];; +searc 'v' 0 [`a % b % c`];; +searc 'w' 6 [`collinear`;`vec 0`];; +searc 'x' 6 [`&0 < a * b`];; +searc 'y' 0 [`arcV a b c = arcV a c b`];; +searc 'z' 1 [`arcV`;`t % v`];; + + +Print_types.print_goal_types();; +searcht 5 [`(a - b) dot v`];; + + + type_of `rcone`;; +searcht 5[`&0 < u dot u`];; +searcht 5 [`{x,x,y}`];; +RDISK_R;; +Counting_spheres.EUSOTYP_general;; + +searc '5' 2 [`x % y = (vec 0)`];; +searcht 5 [`x IN (a INSERT b)`];; +searc '4' 7 [`X INTER Y = {}`];; + +(* +searc '2' 1 [`facet_of`;`face_of`];; +searc '1' 3 [`{}`;`?`];; +searc '0' 0 [`interior`;`face_of`];; +*) + + +(* +WEDGE_LUNE_GT;; +searc '0' 0 [`azim`;`dihV`];; +*) + + + +(* Oct 28, 2012 *) +let searcj c = searcht;; +searc '3' 6 [`&0 < t2/t`];; +searc '2' 0 [`t % u % v`];; +searc '1' 16 [`<=>`;`==>`];; +searcht 25 [`(?t. u) <=> (?t. y)`];; +searc '0' 2 [`aff_gt {x} {u,v,w}`; `t % v`];; +searcht 5 [`collinear`;`DISJOINT`];; +searcht 5 [def "t0"];; +type_of `t0`;; +searcht 5 [`aff_gt`; `t % x`];; +Print_types.print_thm_types CONE0_FCHANGED;; +Print_types.print_goal_types();; +searc '4' 0 [`t % (vec 0)`];; +searc '5' 2 [`x = {}`;`?`];; +searc '6' 2 [`collinear`;`coplanar`];; +searc '7' 0 [`coplanar`;`~(a = (b:real^A))`];; +searc '8' 0 [`coplanar`;`t % v`;`vec 0`];; +searc '9' 0 [`x IN {y}`];; +searc 'a' 0 [`x IN A INTER B`];; + +searc 'b' 0 [`coplanar`;`dihV`];; +searc 'c' 1 [`&0 <= dihV a b c d`];; +searc 'd' 6 [`SUBSET`;`INTER`];; +searcht 5 [`wedge`;`aff_gt`];; +searc 'i' 0 [`cone0`;`aff_gt`];; +searc 'e' 0 [`x IN {}`];; +searc '0' 2 [`a SUBSET b INTER c`];; +searcht 5 [`measurable`;`cone0`];; +searc 'f' 0 [`measurable`;`aff_gt`];; +searc 'g' 1 [`ball`;`normball`];; +searc 'h' 0 [`A INTER B = B INTER A`];; +searc 'i' 0 [`cone0`;`aff_gt`];; +searcht 5 [`measurable (A INTER B)`];; +searc 'j' 2 [`radial_norm`;`aff_gt`];; +searcht 5 [`solid_triangle`;`cone0`];; +searcht 5 [`vol`;`sol`];; +searcht 5 [`vol`;`vol_solid_triangle`];; +CONJUNCT2 Vol1.volume_props;; +help "CONJUNCT2";; +searc 'k' 0 [`azim`;`dihV`];; +searcht 5 [`&0 < pi`];; +searc 'l' 2 [`wedge`;`aff_gt`];; +searc 'm' 0 [`measurable (X UNION Y)`];; +searcht 5 [`(A UNION B) INTER C`];; +UNION_OVER_INTER;; +searc 'n' 0 [`radial_norm`;`UNION`];; +searc 'p' 1 [`radial_norm`;`UNION`];; +searc 'q' 1 [`dihV a b c d = dihV a b d c`];; +searc 'r' 2 [`wedge`;`aff_gt`];; +searcht 15 [`aff_gt {x,x'} y SUBSET aff_gt {x,x'} z`];; +searcht 15 [`x IN wedge a b c d`];; +searc 's' 5 [`wedge`;`azim`];; +searc 't' 1 [`fchanged c = x`];; +searcht 5 [`relative_interior x SUBSET y`];; +searc 'u' 0 [`a % v dot w`];; +searcht 5 [`x*b = b`];; +searc 'v' 0 [`sol`;`vol`];; +searc 'w' 8 [`measure`;`sum`];; +type_of `measure`;; +`measure:(real^3->bool)->real`;; +GOTCJAH_convex_sum;; + +(* Oct 29, 2012 *) + + +searc 'a' 0 [`collinear {(vec 0),v,u}`;`t % v`];; +Trigonometry2.EXISTS_OTHOR_VECTOR_DIFFF_VEC0;; +searc 'b' 1 [`~(?t. p)`];; +searc 'c' 2 [`t % v = vec 0`];; + + +searc 'd' 3 [`azim a b c d + azim a b d e `];; + + +searc 'e' 0 [`measurable {}`];; +searc 'f' 0 [`radial_norm a b {}`];; + +help_grep "CAS.*TAC";; +searc 'g' 0 [`{} INTER B`];; +searc 'h' 0 [`sol u {}`];; +searc 'i' 0 [`sin(&0)`];; +searc 'j' 0 [`asn(&0)`];; +SKOLEM_THM;; +searc 'k' 3 [`measure`;`has_measure`];; +searc 'l' 0]\[`measure`;`SUBSET`];; +GOTCJAH_convex_sum;; +WEDGE_ORDER_DISJOINT;; +ORDER_AZIM_SUM2Pi;; +searcht 5 [`sum`;`a..b`;`f o c`];; +searc 'm' 2 [`sum (a..b) f = sum (c..d) g`];; +searc 'n' 1 [`a < (b:num)`;`a < b`];; +searc 'o' 4 [`&0 <= a * b`];; +searc 'p' 0 [`a <= (b:num)`;`a <= b`];; +searc 'q' 1 [`&0 <= azim a b c d`];; +searc 'r' 2 [`sum f x = sum f y`];; +searc 's' 0 [`sum f (\i. t * r i)`];; +searc 't' 0 [`sol`;`vol`];; +searc 'u' 1 [`(UNIONS X) INTER Y`];; +searc 'v' 4 [`measurable (UNIONS s)`];; +searcht 5 [`radial_norm`;`UNIONS`];; + +SOL_UNIONS;; +searc 'w' 0 [`radial_norm`;`DIFF`];; +searc 'x' 0 [`sol`;`UNION`];; +searcht 5 [`sol`;`DIFF`];; +searcht 5 [`sol x y <= sol x z`];; +searc 'y' 1 [`sol`;`UNIONS`];; +searc 'z' 0 [`FINITE (IMAGE X u)`];; +searc 'a' 0 [`FINITE (a..b)`];; +searc 'b' 2 [`sum (IMAGE X y)`];; + +searc 'c' 3 [`sum (IMAGE X y)`];; +searcht 35 [`(\i. f i = \j. g j) <=> `];; +EXT_AXIOM;; +FUN_EQ_THM;; +searcht 5 [`sol`;`SUBSET`];; +searcht 5 [`sol x y <= sol x z`];; +searc 'd' 0 [`measurable`;`DIFF`];; +searc 'e' 0 [`radial_norm`;`DIFF`];; +searcht 5 [`(t DIFF s) INTER u`];; +searcht 5 [`sol x y >= &0`];; +searc 'h' 0 [`&0 <= measure u`];; +searc 'f' 4 [`&0 <= x / y`];; +searc 'g' 4 [`&0 <= x * y`];; +searc 'i' 11 [`&0 <= x pow n`];; +searc 'j' 0 [`radial_norm`;`UNIONS`];; +searcht 15 [`FINITE { f s | g s }`];; +searc 'k' 0 [`measurable`;`fchanged`];; +FCHANGED_RADIAL;; +searc 'l' 0 [`radial`;`radial_norm`];; + +(* Oct 31, 2012 *) +searcht 5 [`v IN rcone_gt x y z`];; +searcht 15 [`rcone_gt x y z`];; +searc 'a' 0 [`dist(v, vec 0)`;`norm`];; +searcht 5 [`norm v = &0`];; +searc 'b' 4 [`norm`;`dot`];; +searc 'c' 5 [`&0 < a * b`];; +searc 'd' 0 [`&0 < norm x`];; +searc 'e' 0 [`norm x = &0`];; +searc 'f' 0 [`vec 0 dot v`];; +searc 'g' 0 [`v dot vec 0`];; +searc 'h' 0 [`a % v dot u`];; +searcht 2 [`arcV`;`rcone_gt`];; +searc 'i' 0 [`cos`;`a dot b`];; +Print_types.print_thm_types Trigonometry1.DOT_COS;; +searcht 5 [`&0 < cos x`];; +searc 'j' 1 [`cos x < cos y`];; +searc 'k' 0 [`&0 <= arcV a b c`];; +searc 'p' 2 [`x * y < x * z`];; +searc 'q' 0 [`arcV x y z + arcV x y' z'`];; +searc 'r' 1 [`&0 < cos x`];; +searc 's' 0 [`cos x <= &1`];; +searc 't' 4 [`cos x = &1`];; +searc 'u' 2 [`~(?x. p)`];; +searc 'v' 1 [`~(a /\ b) = c`];; +searc 'w' 4 [`a <= b`;`&a <= &b`];; +searc 'x' 4 [`&0 <= x * y`];; +searcht 5 [`&0 <= arcV x y z`];; +searc 'y' 0 [`arcV x y z = arcV x z y`];; +searc 'z' 12 [`&0 < x * y`];; +searcht 5 [`x * y <= &0`];; + + +(* START WITH THIS ONE. Nov 1. *) + + +searc 'a' 0 [name "WBLARHH"];; +searc 'b' 0 [name "AMH"];; +(* need to relat facet_of^2 to edges,edge_of *) + +searc 'c' 0 [`edges`;`edge_of`];; +searc 'd' 0 [`edge_of`;`face_of`];; (* def of edge_of=face_of aff_dim 1 *) +searc 'e' 0 [`conforming`];; (* def of conforming *) + +searcht 5 [name "CFYXF"];; (* 0 relates edges<=> EDGES0_FAN *) +searcht 5 [def "edge_of"];; +searcht 5 [`fully_surrounded`];; +searcht 5 [`plain_hypermap`];; + +searcht 5 [def "plain"];; +searcht 50 [`FAN`];; + +(* Nov 1, 2012 *) +searcht 5 [`edges`;`face_of`];; +searcht 5 [`hypermap_of_fan`;`hypermap1_of_fanx`];; +searcht 50 [`hypermap_of_fan`];; +searcht 50 [`hypermap1_of_fanx`];; +searcht 5 [`facet_of`;`aff_dim`];; +searc 'a' 1 [`x = y`;`x ==> y`;`x /\ y`];; +searc 'b' 2 [`face_of`;`facet_of`];; +searcht 'f' 18 [`face_of`];; +searc 'c' 3 [`aff_dim`;`{}`];; +type_of `aff_dim`;; +searc 'd' 0 [`aff_dim`;`interior`;`3`];; +searc 'e' 0 [`aff_dim`;`interior`;`2`];; +searc 'f' 18 [`face_of`];; +searc 'g' 1 [`face_of`;`SUBSET`];; +searcht 5 [`facet_of`;`aff_dim`];; +searc 'h' 0 [`edges`;`segment`];; +BIJ_SYM;; +searc 'i' 0 [`r (BIJ f U V) (BIJ g V U)`];; +searcht 15 [`BIJ`;`(a,b)`];; +searcht 5 [def "preimage"];; +searcht 5 [`preimage`;`BIJ`];; +searcht 5 [`IMAGE`;`BIJ`];; +type_of `preimage`;; + +searc 'j' 0 [`( p ==> (?x. q x)) <=> (?x. p ==> q x)`];; +SKOLEM_THM;; +searcht 35 [`BIJ`];; +searcht 5 [`BIJ`;`x ==> (u = v)`;`?`];; +searcht 5 [def "BIJ"];; +searcht 10 [def "INJ"];; +searc 'k' 0 [`preimage`];; +searcht 5 [`IMAGE f X SUBSET Y`];; +INST_TYPE;; +Print_types.print_goal_types();; +searcht 5 [`FST (x,y)`];; +searc 'l' 1 [`preimage`];; +searcht 5 [def "hypermap1_of_fanx"];; +searc 'm' 0 [`hypermap1_of_fanx`;`hypermap`;`e_fan`];; +searc 'n' 1 [`face_set`];; +Hypermap.dart;; +searcht 5 [`tuple_hypermap`;`hypermap`];; +searcht 50 [`hypermap_of_fan`;`hypermap`];; +searcht 5 [`hypermap1_of_fanx`;`hypermap`];; +searcht 15 [`HYP`];; +searcht 15 [`d1_fan`];; +searcht 5 [`{a,b} = {a',b'}`];; + + lemmaTGJISOK;; +searcht 50 [`FAN`;`azim`];; +searc 'a' 0 [`conforming`];; (* def *) +searcht 50 [`conforming`];; +searcht 50 [`conforming_fan`];; +searc 'c' 0 [name "PIIJ"];; +searc 'b' 2 [`fully_surrounded`];; (* dart_of_fan azim_dart *) +searcht 5 [`azim_dart`];; (* azim_dart -> azim_fan *) +searcht 5 [`azim_fan`];; (* sigma_fan *) +searcht 5 [`FAN`;`sigma_fan`];; +List.length (searcht 1000 [`FAN`]);; +searcht 500 [`conforming`];; +searc 'a' 0 [name "BSXA"];; +searc 'b' 0 [`FAN`;`vertices`];; (* POLYHEDRON_FAN *) +searc 'd' 0 [`fan80`;`polyhedron`];; +searc 'e' 1 [`polyhedron`;`set_of_edge`];; +searcht 5 [`polyhedron`;`conforming_fan`];; +searcht 30 [`hypermap1_of_fanx`;`conforming_fan`];; +searc 'f' 5 [`CARD`;`simple_hypermap`];; (* conditions for 3 <= CARD face *) +searc 'g' 0 [name "TGJ"];; +searc 'h' 0 [name "WGV"];; +searc 'i' 0 [`plain_hypermap`;`FAN`];; +searcht 5 [`plain_hypermap`;`FAN`];; +Fan.plain_hypermap_fan;; + +Fan.e_fan_no_fix_point;; +searcht 5 [`edge_map`;`e_fan`];; +Fan.hypermap_of_fan_rep;; +Hypermap.is_restricted;; +searcht 5 [`d1_fan`;`d_fan`];; +searcht 5 [`FAN`;`d20_fan`];; +searc 'j' 7 [`d1_fan`;`d_fan`];; +Print_types.print_goal_types();; +searc 'k' 4 [`res`; `e_fan`];; +searcht 5 [`p e_fan x = e_fan x`];; +searc 'l' 0 [`x IN d1_fan u`;`res`];; (* not IN *) +searc 'm' 2 [`x IN d1_fan u`;`res`];; +help_grep "GEN";; +GEN_ALL;; +(GEN_ALL Fan.into_domain_e_fan);; +Fan.plain_hypermap_fan;; +searc 'm' 2 [`x IN d1_fan u`;`res`];; +searcht 5 [`is_no_double_joins`];; +Fan.face_subset_dart_fan;; (* each face is subset of d_fan *) +Fan.FACE_FAN_NOT_EMPTY;; +searc 'n' 4 [`3`;`CARD (face H x)`];; (* for hypermap_of_fan *) +searc 'o' 0 [`planar_hypermap`;`FAN`];; +searc 'p' 2 [`dart`;`hypermap1_of_fanx`];; +searcht 3 [`dart`;`hypermap1_of_fanx`];; +searc 'q' 0 [name "e_fan_no_fix"];; +searcht 5 [`edge_map`;`e_fan`];; +searcht 5 [`fan80`];; +searcht 5 [`hypermap_of_fan`];; +searcht 50 [`node`;`3`];; +SURROUNDED_IMP_CARD_NODE_GE_3;; +searcht 50 [`node_set`;`hypermap1_of_fanx`];; +Conforming.SUM_AZIM_FAN_OF_NODE_EQ_2PI_I_FAN;; +searcht 5 [`fan80`;`azim`];; +searcht 5 [`n_fan`;`sigma_fan`];; +searcht 5 [def "d1_fan"];; +searcht 5 [def "dart_of_fan"];; +searcht 5 [def "n_fan_pair"];; +searcht 100 [`sigma_fan`;`CARD`];; +searc 'r' 0 [`azim_fan`;`pi`;`sum`];; (* sum over node set azim_fan is 2pi *) +searcht 5 [def"node_set"];; +searc 'u' 0 [`node`;`node_set`];; +searc 's' 0 [`fan80`;`polyhedron`];; +searc 't' 0 [`polyhedron`;`azim_fan`];; +searcht 5 [`sum f x < sum f y`];; +searc 'v' 0 [`FINITE`;`node`];; +searcht 5 [`node`;`{}`;omit `INSERT`];; +searc 'w' 0 [`x IN node f x`];; +searc 'x' 14 [`~(x = {})`];; +searc 'y' 0 [`node f x SUBSET dart g`];; +searc 'z' 1 [`sum`;`CARD`];; +searc '0' 3 [`a * x <= b * x`];; +searc '1' 4 [`&x <= &y`];; +searcht 5 [def "edge_set"];; +searcht 25 [`simple_hypermap`];; + +(* Nov 3, 2012 *) +searcht 5 [`BIJ`;`o`];; +searc 'a' 3 [`pr2`;`d_fan`];; (* injectivity of pr2,pr3 *) +searc 'b' 2 [`{x,y} = {x',y'}`];; +searc 'c' 7 [`e_fan`];; +searcht 5 [def "e_fan"];; +let nil = 0;; +searcht nil [`e_fan`;`e_fan_pair`];; +searcht 5 [`?`;`x = (a,b)`];; +searcht 5 [`pr2`];; +searc 'd' 0 [`dart`;`d_fan`];; +searc 'e' 1 [`r e_fan x = e_fan y V E x`];; +searc 'h' 0 [`(x,y) = (x',y')`];; +searc 'f'0 [`d_fan`;`dart`];; +searc 'g' 8 [`d_fan`;`d1_fan`];; + +EDGE_PAIR_pr23;; +searc 'h' 10 [`e_fan`;`d1_fan`];; + +searc 'n' 14 [`simple_hypermap`];; +searc 'i' 1 [`node_map H o face_map H`];; + searcht 50 [`node_map H ( face_map H t)`];; +searc 'k' 3 [`inverse f y = z`];; +searc 'l' 0 [`(x = y) <=> (y = x)`];; +searc 'm' 0 [`edge_map H permutes s`];; +searc 'o' 0 [`node_map H y IN dart H`];; +searc 'p' 0 [`y IN node H y`];; +searcht 5 [`node_map H y IN node H y`];; +searc 'q' 1 [`x IN node H y`];; +searc 'r' 0 [`x POWER 1`];; +searcht 5 [`face H (f x)`];; +searc 's' 0 [`face H x = face H y`];; +searc 't' 2 [`x IN face H y`];; +searcht 15 [`x IN face H y`];; +searcht 15 [`face H x = face H y`];; +searcht 8 [`POWER`;`node`];; +searc 'u' 16 [`(f POWER n) x = x`;`f x = x`];; +searc 'v' 0 [`orbit_map`;`node`];; +searc 'w' 0 [`f POWER 0`];; +searc 'x' 1 [`CARD {x}`];; + +POLYHEDRON_CONFORMING_FAN;; +searc 'y' 0 [`simple_hypermap`;`conforming_fan`];; +searc 'a' 0 [`polyhedron`;`FAN`];; +searc 'b' 0 [name "POLYHEDRON_NODE_3"];; +searcht 5 [`d_fan`;`f1_fan`];; +searc 'c' 0 [`d_fan`;`dart`];; +searc 'd' 0 [`face_map H x IN dart H`];; +searc 'e' 2 [`face_set H`;`dart`];; +searcht 5 [`set_of_orbits`;`SUBSET`];; +searc 'f' 0 [`face`;`dart`];; +searc 'g' 6 [`y IN face H x`];; +searc 'h' 0 [`y IN face H x`];; +searcht 5 [name "D1_D"];; +searc 'i' 0 [`set_of_edge`;`CARD`;`1`];; +searcht 5 [name "WBL"];; +searcht 5 [name "AMH"];; +Cfyxfty.WBLARHH_BIJ;; +Polyhedron.AMHFNXP_BIJ;; + +type_of `(topological_component_yfan (vec 0,vertices p,edges p))`;; +searcht 5 [name "WGV"];; +searc 'j' 0 [`edges`;`segment`];; +searcht 5 [`edge_of`;`segment`];; +searc 'k' 0 [`3`;`interior`;`aff_dim`];; +searc 'l' 0 [`2`;`aff_dim`;`facet_of`];; +searc 'm' 3 [`aff_dim`;`{}`];; +searc 'n' 0 [`convex hull x`;`segment`];; +searc 'o' 1 [`segment [a,b] = segment [c,d]`];; +searc 'p' 0 [`{a,b} = {c,d}`];; +searc 'q' 0 [`aff_dim`;`segment`];; +searc 'r' 0 [`edge_of`;`aff_dim`];; +searc 's' 1 [`polytope`;`polyhedron`];; +searcht 5 [`face_of`;`facet_of`];; +PREIMAGE_BIJ;; +searcht 5 [`dartset_leads_into_fan`;`fchanged`];; +Polyhedron.WBLARHH;; +searc 't' 0 [`face H a IN face_set H`];; +searc 'u' 4 [`?!`;`?`];; +searc 'v' 1 [`preimage`];; +searc 'w' 0 [`x IN {y}`];; +searc 'x' 2 [`?`;`facet_of`];; +searcht 5 [`s face_of s' ==> polyhedron s`;`polyhedron`];; +searc 'y' 0 [`face_of`;`polytope`];; +searc 'z' 12 [`facet_of`;`fchanged`];; +searc 'a' 4 [`facet_of`;`fchanged`];; +searc 'b' 0 [`x INTER x`];; +searc 'c' 14 [`~(x = {})`];; +searc 'd' 0 [`(x,y) = (x',y')`];; + +(* Nov 5, 2012 *) +let searct _ = searcht;; +searcht 5 [name "eq_sym"];; +searcht 5 [`(x = y) <=> (y = x)`];; +searc 'a' 0 [name "WBL"];; +searc 'b' 2 [`?`;`?!`];; +searc 'c' 0 [name "AMH"];; +searc 'd' 1 [`preimage`];; +searcht 5 [`face_set`;`face`];; +searc 'e' 8 [`==>`;`<=>`];; +searc 'f' 0 [`x IN face H x`];; +Print_types.print_goal_types();; +BIJ_FACET2_EDGE;; +Print_types.print_thm_types BIJ_FACET2_EDGE;; +type_of `edges c`;; +BIJ_EDGES_DART_FACE;; + +(* Nov 6, 2012 *) +searcht 15 [`sum f (\x. sum h g)`];; +SUM_SUM_PRODUCT;; +searc 'g' 0 [`CARD`;`sum`];; +searc 'h' 8 [`(FINITE:((A#B)->bool)->bool)`];; +searcht 5 [`SUBSET`;`FINITE`];; +searc 'i' 0 [`face_of`;`facet_of`];; +searc 'i' 0 [`face_of`;`facet_of`];; +FACE_OF_TRANS;; +help_grep "BETA_TAC";; +searc 'j' 0 [`(\(a,b). f a b)`];; +searc 'k' 0 [`FINITE`;`facet_of`];; +searc 'l' 1 [`polytope`;`polyhedron`];; +searc 'm' 0 [`face_of`;`FINITE`];; +searc 'n' 2 [`sum f X = sum f Y`];; +searcht 5 [`&x <= &y`;`(x:num) <= (y:num)`];; +searcht 15 [name "REAL_OF_NUM"];; +searcht 5 [`CARD {f,e | f facet_of P /\ e facet_of f}`];; +searcht 5 [`6 * n - 12`];; +searcht 5 [name "BIJ_FACET"];; +POLYHEDRON_TGJISOK;; +BIJ_DART_POLYEDGE;; +searc 'o' 0 [`number_of_faces`];; +searc 'p' 2 [`BIJ`;`CARD x= CARD y`];; +searcht 5 [`rcone_gt`;`fchanged`];; +searc 'q' 0 [`open`;`INTERS`];; +searc 'r' 0 [`FINITE`;`IMAGE`];; +searc 's' 0 [`FINITE`;`DIFF`];; +searc 't' 0 [`open`;`a dot v < b`];; +searc 'u' 1 [`open`;`ball`];; +searcht 5 [`A INTER B SUBSET D INTER C`];; +searc 'v' 3 [`affine hull x = x`];; +searc 'w' 0 [`affine hull x SUBSET affine hull y`];; +searc 'x' 0 [`affine`;`dot`];; +searc 'y' 0 [`A INTER B SUBSET B`];; +searcht 5 [`(A= B) ==> A SUBSET B `];; + +SET_CONV;; +searcht 15 [`INTERS (IMAGE h f)`];; + +search [`relative_interior`;`<`];; + + Polyhedron.IN_RELATIVE_INTERIOR1;; +RELATIVE_INTERIOR_POLYHEDRON_EXPLICIT;; (* via hyperplane ineqs *) + +FACET_OF_POLYHEDRON_EXPLICIT;; +searc 'a' 0 [`( p ==> (?x. q x)) <=> (?x. p ==> q x)`];; +searc 'b' 0 [`interior`;`affine`;`hull`];; +searc 'c' 1 [`(UNIV) INTER A`];; +searcht 5 [`INTERS A SUBSET INTERS B`];; +DE_MORGAN_THM;; +searc 'd' 2 [`~(?x. p)`];; + +(* Nov 8 *) +Print_types.print_goal_types();; +searc 'e' 0 [`x dot (vec 0) = &0`];; +searc 'f' 0 [`a dot (t % p)`];; +searc 'g' 2 [`x * z < y * z`];; +searc 'h' 6 [`&0 < x/y`];; +searc 'i' 0 [`&0 < norm p`];; +searcht 5 [`dist`;`norm`];; +searc 'j' 0 [`norm (t % p)`];; +searc 'k' 3 [`norm p = &0`];; +searcht 5 [`(a dot x < b) <=> (a' dot x < b')`];; +searc 'l' 0 [`interior`;`a dot x <= b`];; +searc 'm' 0 [`(x = y) <=> (y = x)`];; +avoids;; +searc 'n' 0 [`~(!x. p)`];; +searcht 5 [`polyhedron`;`dot`;`<=`];; +searcht 30 [name "TARJJ"];; +Tarjjuw.TARJJUW;; +searc 'o' 0 [`ball_annulus = y`];; +searc 'p' 0 [`norm (vec 0) = &0`];; +searc 'q' 6 [`&0 < x * y`];; +searc 'r' 1 [`interior`;`ball`];; +searc 's' 0 [`half_spaces`];; +searc 't' 8 [`==>`;`<=>`];; +FACET_OF_POLYHEDRON_EXPLICIT_ALT;; +searc 'u' 0 [`v dot v = &0`];; +searcht 5 [`v IN rcone_gt a v c`];; +searc 'v' 1 [`fchanged`;`relative_interior`];; +searc 'w' 0 [name "rcone_gt_facet"];; +RELATIVE_INTERIOR_POLYHEDRON_EXPLICIT_ALT;; +rcone_gt_facet;; +FACET_OF_POLYHEDRON_EXPLICIT_ALT;; +searc 'x' 0 [`x % y % z`];; +searc 'y' 0 [`v % x = u % x`];; +searcht 5 [`rcone_gt`;`dot`];; +searc 'z' 0 [`&0 < &1 / x`];; +searcht 5 [`&0 < x/ y `];; +searc 'h' 6 [`&0 < x/y`];; +rcone_gt_facet;; + +(* Nov 10, 2012 *) +searc 'i' 0 [`lmfun_ineq_center`];; +searc 'j' 0 [`ball_annulus`;`norm`];; +searc 'k' 0 [`sum V x <= sum V y`];; +searc 'l' 1 [`hl`];; +searc 'm' 1 [`dist(vec 0,x)`];; +searc 'n' 9 [`lmfun`];; +searc 'o' 4 [`h0`];; +searc 'p' 0 [`a / x <= b /x `];; +searc 'q' 0 [`sum V (\v. &1)`];; +searc 'r' 4 [`&x <= &y`];; +searcht 5 [name "weak_sat"];; +searc 's' 0 [`sum w x <= sum v x`];; +searc 't' 0 [`&0 <= lmfun h`];; +searc 'u' 0 [`sum`;`&4 * pi`];; +searc 'v' 0 [`polyhedron`;`FAN`];; +searc 'w' 0 [`conforming_fan`;`polyhedron`];; +searcht 5 [`SURJ`;`sum`];; +searc 'x' 0 [name "AMH"];; +searc 'y' 1 [`sum`;`topological_component_yfan`];; +searc 'z' 2 [`SURJ`;`IMAGE`];; +searc 'a' 4 [`IMAGE`;`sum`];; +asearcht 5 [`{x | f x } = \y. f y`];; +searcht 5 [name "DLWCHEM"];; +searc 'b' 4 [`3`;`face`];; +searcht 15 [name "CFY"];; +searcht 5 [`facet_of`;`FINITE`];; +searc 'c' 0 [`lfun`;`lmfun`];; +searcht 5 [`regular_spherical_polygon_area`];; +searc 'd' 3 [`cos(x - y)`];; +searc 'e' 0 [`cos (pi/ &6)`];; +searcht 5 [`cos(acs t)`];; +searcht 5 [`BIJ`;`CARD`];; +searc 'f' 0 [`face_of`;`FINITE`];; +searc 'g' 0 [`face_of`;`facet_of`];; +BIJ_FACET2_EDGE;; +BIJ_EDGES_DART_FACE;; +searcht 5 [`facet_of`;`2`];; +searc 'h' 4 [`dartset_leads_into_fan`;`edges`];; +searc 'i' 1 [`fchanged`;`topological_component_yfan`];; +searc 'j' 2 [`?`;`?!`];; +searcht 25 [`fully_surrounded`;];; +searcht 25 [`conforming_fan`];; +searcht 5 [`facet_of`;`?`];; +searc 'k' 2 [`facet_of`;`?`];; +searc 'l' 1 [`polytope`;`polyhedron`];; +searcht 5 [`facet_of`;`{}`];; +searcht 5 [`face_of`;`SUBSET`];; +searcht 5 [`p facet_of p`];; +searcht 15 [name "KREIN"];; +searc 'm' 0 [`polyhedron`;`convex`];; +searc 'n' 0 [`polytope`;`compact`];; +searc 'o' 4 [`SUBSET`;`convex hull x`];; +searcht 5 [`convex hull x`;`face_of`];; +searc 'p' 2 [`face_of`;`convex`];; +searc 'q' 0 [`convex x`;`convex hull y = y`];; +searc 'r' 0 [`extreme_point_of`;`face_of`];; +searc 's' 0 [`face_of`;`facet_of`;`INTERS`];; +searc 't' 0 [`CARD x = 0`];; +searc 'u' 14 [`~(x = {})`];; +searc 'v' 18 [`CARD x` ;`2`];; + +searcht 15 [`CARD`;`3`];; +searcht 5 [`CARD A < CARD B`];; +searc 'w' 12 [`PSUBSET`];; +searc 'x' 0 [`CARD{x,y} = 2`];; +searc 'y' 1 [`INTERS {}`];; +searcht 15 [`(:A)`;`{x}`];; +searc 'z' 0 [`aff_dim x <= aff_dim y`;`SUBSET`];; +searc 'a' 0 [`aff_dim {y}`];; +searcht 25 [`A = {x}`];; +searc 'b' 0 [`INTERS {x}`];; +searc 'd' 0 [`x ==> polyhedron p`;`face_of`];; +searc 'g' 0 [`face_of`;`facet_of`];; +searcht 5 [`SUBSET`;`bounded`];; +searc 'h' 0 [`face_of`;`SUBSET`];; +searcht 5 [`aff_dim`;`2`;`facet_of`];; +searc 'k' 0 [`3`;`interior`;`aff_dim`];; +searcht 5 [`ball_annulus`;`FINITE`];; +searcht 5 [`x IN {}`];; +searcht 5 [`CARD`;`SUBSET`];; +EXISTS_M_POLYHEDRON;; +searcht 5 [`CARD {}`];; +searc 'l' 0 [`ball_annulus`;`norm`];; +searc 'm' 0 [`arclength`;`arcV`];; +searc 'n' 0 [`arclength a b c <= arclength a b c'`];; +searcht 5 [`arcV a b c <= arcV a' b' c'`];; +searcht 5 [`arcV a b c < arcV a' b' c'`];; +searcht 5 [`arclength a b c <= arclength a' b' c'`];; +searc 'p' 0 [`acs x <= acs y`];; + +searc 'o' 3 [`acs`;`arclength`];; +searc 'q' 0 [`dist (x,y) <= dist (x,p) + dist(p,y)`];; +searc 'r' 5 [`(a *a + b *b - c *c)/(&2 *a* b)`];; +searc 's' 0 [`x / y <= z / y`];; +searc 't' 6 [`&0 < x * y`];; +searc 'u' 0 [`x * x <= y * y`];; +searcht 5 [`x < acs y`];; +searc 'v' 0 [`pi / &2 - acs x`];; +COS_PI6;; +searcht 5 [`acs (sqrt(&3)/ &2)`];; +searcht 5 [`acs (x ) = pi/ &6`];; +searcht 5 [`acs (cos x)`];; +searc 'w' 1 [`asn (-- x)`];; +searc 'x' 0 [`acs (&0)`];; +searc 'y' 0 [`acs x < acs y`];; +searc 'z' 0 [`acs x <= acs y`];; +searcht 15 [`sqrt3`];; +searcht 5 [`BIJ`;`a..b`];; +searcht 5 [`BIJ`;`CARD`];; +searcht 5 [`IMAGE`;`CARD`];; +searcht 5 [`HAS_SIZE`;`BIJ`];; + +(* Nov 11, 2012 *) +searcht 50 [`CARD`;`f:num->B`;`?`];; +searcht 5 [def "CARD"];; +searcht 5 [`ITSET`];; +searcht 50 [`BIJ`];; +type_of `CHOICE`;; +searc 'a' 0 [`CARD A = 0`];; +searc 'b' 0 [`A SUBSET {}`];; +searcht 5 [`INJ`;`?`;`(f:A->B)`];; +searcht 50 [`(f x = f y) ==> (x = y)`];; +searc 'c' 0 [`x HAS_SIZE 0`];; +searc 'u' 14 [`~(x = {})`];; +searc 'e' 0 [`DELETE`;`HAS_SIZE`];; +searc 'd' 1 [`DELETE`;`FINITE`];; +type_of `PRE`;; +searcht 5 [`A DIFF B HAS_SIZE c`];; +searcht 5 [`FINITE (A DIFF B) `];; +searc 'f' 1 [`CARD( A DIFF B)`];; +searc 'g' 0 [`CARD (IMAGE j A)`];; +searcht 5 [name "INJ_IFF_SURJ"];; +searcht 5 [` (a..b) HAS_SIZE t`];; +searc 'l' 0 [`ball_annulus`;`norm`];; +searcht 5 [`sum V x = sum V y`];; +searc 'm' 3 [`lmfun_ineq_center`];; +searc 'n' 1 [`hl x`];; +searc 'o' 1 [`lfun`;`lmfun`];; +searcht 5 [`sum(a..n)`;`sum(b..n) f + sum (a..r) f`];; +searc 'p' 1 [`sum(a..a)`];; +SUM_EQ;; +searcht 5 [`3 <= CARD x`;`facet_of`];; +searcht 5 [`sum`;`&6 * &n - &12`];; +searcht 5 [`BIJ`;`HAS_SIZE`];; +searc 'q' 2 [`BIJ`;`CARD`];; +searc 'r' 3 [`BIJ`;`FINITE`];; +GOTCJAH;; +searcht 5 [`&0 <= sol x U`];; +searcht 5 [`fchanged`];; +RADIAL_NORMBALL;; +FCHANGED_RADIAL;; +FCHANGED_MEASURABLE;; +searc 's' 0 [`radial`;`radial_norm`];; +SUM_EQ;; +searc 't' 0 [`regular_spherical_polygon_area`];; +searc 'u' 2 [`FINITE`;`facet_of`];; +searc 'v' 3 [`pack_ineq_def_a`];; +searc 'w' 1 [`acs_sqrt_x1_d4`];; +searc 'x' 2 [`arclength_x_123`];; +searc 'y' 2 [`x pow 2 <= y pow 2`];; +searc 'z' 2 [`sqrt (x pow 2)`];; +searc 'a' 0 [`sqrt(&4)`];; +searcht 5 [`arclength x y z <= arclength x' y' z'`];; + Trigonometry1.TRI_SQUARES_BOUNDS;; +searc 'b' 0 [`arcV`;`arclength`];; +searc 'c' 0 [`arclength a b c = arclength b a c`];; +searc 'd' 0 [`ball_annulus`;`norm`];; +PACK_INEQ_DEF_A_797;; +searc 'e' 0 [`arcV x y z = arcV x z y`];; +searcht 15 [name "plain_hyper"];; + +(* Nov 13, 2012 *) +searcht 5 [`gamma3f_x_div_sqrtdelta`];; +searcht 50 [def "gamma3f"];; +searc 'a' 1 [`delta`;`ups_x`];; +searcht 5 [`delta`;`delta_x`];; +searc 'b' 3 [`x / y < z`];; +searc 'c' 2 [`sqrt x < sqrt y`];; +searc 'd' 4 [`&0 <= x/y`];; +searc 'e' 5 [`&0 <= x * y`];; +searc 'f' 5 [`&0 < x* y`];; +searcht 5 [def "cut"];; +searcht 5 [`lfun`;`h0cut`];; +searcht 5 [`vol_x`;`vol_y`];; +searcht 5 [`vol_y`;`sqrt`];; +searc 'g' 0 [`sqrt( x * x) = x`];; +searc 'h' 0 [`sqrt2 * sqrt2`];; +searcht 5 [`dih_x_div_sqrtdelta_posbranch`;`dih_x`];; +searcht 50 [`dih_x_div_sqrtdelta_posbranch`];; +searcht 15 [name "LET"];; +searc 'i' 1[`sol_y`;`sol_x`];; +searc 'j' 0 [`dih_x x1 x2 x3 x4 x5 x6 = dih_x x1 x2' x3' x4' x5' x6'`];; +searc 'k' 1 [`dih_x x1 x2 x3 x4 x5 x6 = dih_x x1 x2' x3' x4' x5' x6'`];; +searc 'l' 1 [`sol_euler_x_div_sqrtdelta`;`delta_x`];; +searc 'm' 0 [`sol_x`;`sol_euler_x`];; +searc 'n' 0 [`sol_x a b c d e f = sol_x a' b' c' d' e' f'`];; +searc 'o' 1 [`sol_x a b c d e f = sol_x a' b' c' d' e' f'`];; +searc 'p' 0 [`dih_x_div_sqrtdelta_posbranch`;`dih_x`];; +searcht 5 [`delta_x a b c d e f = delta_x a' b' c' d' e' f'`];; +searc 'q' 1 [`ups_x a b c = ups_x a' b' c'`];; +searc 'r' 4 [`&0 < ups_x x y z`];; +searcht 5 [`sqrt(&2) * sqrt(&2)`];; +searc 's' 0 [`ups_x a b c = ups_x a' b' c'`];; +searcht 5 [`eulerA_x a b c d e f = eulerA_x a' b' c' d' e' f'`];; +searc 't' 12 [`&0 < x * y`];; +searcht 5 [`sqrt x <= sqrt y`];; +searcht 5 [`eta_y`;`&2 * x`];; +searcht 5 [`x * x <= y * y`];; +searcht 5 [`sqrt8 * sqrt8`];; +searc 'u' 13 [`dih_x_div_sqrtdelta_posbranch`];; +searc 'w' 0 [`dih_x`;`atn2`];; +searc 'v' 5 [`atn2`;`pi`;`<=`];; +searc 'w' 5 [`atn`;`<`;`pi`];; +searcht 50 [`&0 <= a * b`];; +searcht 10 [`dih4_x_div_sqrtdelta_posbranch`];; +searcht 5 [`eta_y`;`&0 < delta_x`];; +searcht 5 [`&0 <= ups_x a b c`];; +cell_3_delta_x_pos_x;; (* &0 < delta_x <=> (eta_x < sqrt2 *) +UPS_X_POS;; +delta_x4_pos;; +searcht 10 [`delta_x`;`ups_x`];; +GSYM delta_delta_x;; +Collect_geom.DELTA_RRR_INTERPRETE;; +searcht 5 [`sqrt8 * sqrt8`];; +searc 'x' 0 [`&0 <= x pow 2`];; +searc 'y' 0 [`eta_y a b c = eta_y a' b' c'`];; +searc 'z' 0 [`sqrt8`;`sqrt2`];; +searcht 5 [`delta_x a b c d e f = delta_x a' b' c' d' e' f'`];; +searc 'a' 0 [`sqrt8 * sqrt8`];; +searcht 5 [`radV`];; + +(* Nov 18, 2012 *) +searcht 5 [`gamma3f_x_div_sqrtdelta`];; +searcht 5 [`sol_euler_x_div_sqrtdelta a b c d e f = sol_euler_x_div_sqrtdelta a' b' c' d' e' f'`];; +searc 'b' 0 [`eta_x a b c = eta_x a' b' c'`];; +searcht 5 [`gamma3f a b c r s = gamma3f a' b' c' r' s'`];; +searc 'h' 0 [`sqrt2 * sqrt2`];; +searc 'i' 0 [`sol_x a b c d e f = sol_x a' b' c' d' e' f'`];; +searc 'j' 1 [`sol_x a b c d e f = sol_x a' b' c' d' e' f'`];; +searc 'k' 1[`sol_y`;`sol_x`];; +searc 'l' 0 [`dih_y a b c d e f = dih_y a' b' c' d' e' f'`];; +searc 'm' 1 [`dih_y a b c d e f = dih_y a' b' c' d' e' f'`];; +searc 'n' 23 [`!y. (p ==> q y)`; `p ==> (!y. q y)`];; +searcht 5 [`&0 <= eta_x a b c`];; +searcht 6 [`&0 <= x*y`];; +searcht 5 [`&0 <= x*x`];; +searcht 5 [`&0 <= y_of_x dih4_x_div_sqrtdelta_posbranch a b c d e f`];; +searc 'o' 0 [`hminus`;`h0`];; +searc 'p' 0 [`h0cut y = &1`];; +searc 'q' 0 [`hplus`;`h0`];; +searc 'r' 0 [`h0cut y = &0`];; +type_of `h0cut`;; +bb 30;; +bb 5;; +bb 12;; +searc 's' 0 [`gamma3f a b c d e = gamma3f a' b' c' d' e'`];; +searc 't' 0 [`eta_y a b c = eta_y a' b' c'`];; +searcht 5 [`ineq u T`];; + +(* Nov 22, 2012 *) +searcht 15 [`x * y < x' * y' `];; +searc 'a' 1 [`gamma2_x1_div_a`;`gamma2_x_div_azim`];; +searc 'b' 0 [`h0cut y = &0`];; +searc 'c' 0 [`h0`;`hplus`];; +searcht 5 [`h0cut`;`lfun`];; +searcht 500 [`rad2_y`];; +searcht 5 [name "RHUFIIB"];; +searcht 5 [`rho_ij`;`rho_x`];; +searc 'd' 11 [`x <= y/ z`];; +searcht 5 [`sqrt x pow 2 `];; +searcht 5 [`x/ y * z`];; +searcht 5 [`x /y <= z`];; +searc 'e' 1 [`ups_x a b c = ups_x a' b' c'`];; +searc 'f' 1 [name "RHUFIIB"];; +searc 'g' 0 [`delta`;`delta_x`];; +searcht 5 [`&0 <= x pow 2`];; +searc 'h' 0 [`sqrt8`;`sqrt2`];; +searcht 5 [`hminus`;`DECIMAL`];; +searcht 1 [`rad2_x`;`rad2_y`];; +searcht 5 [`eta_y a b c < sqrt2`];; +searcht 15 [`x < sqrt y`];; +searcht 5 [`hplus`;`DECIMAL`];; +searc 'i' 0 [`rad2_x x1 x2 x3 x4 x5 x6 = rad2_x a b c d e f`];; +searcht 5 [`delta_x a b c d e f = delta_x a' b' c' d' e' f'`];; +searcht 5 [def "wt"];; +searcht 5 [`wtcount6_y`];; +bb 4;; +searc 'j' 0 [`beta_bump_y`;`beta_bump_lb`;omit `ineq`];; +searcht 5 [`x / y <= x / z`];; +bb 3;; +searcht 5 [`beta_bump_y`;`beta_bump_lb`;omit `ineq`];; +searcht 5 [`if a then b else c = b`];; +searcht 5 [`norm2hh`;`gamma4fgcy`];; +searcht 5 [`gamma23_full8_x`];; +searcht 5 [`gamma3_x`;];; +searcht 5 [`vol3f_456`];; +searcht 5 [`critical_edge_y`];; +searc 'k' 0 [`sqrt2 * sqrt2`];; +searc 'l' 1 [`sol_y`;`sol_x`];; +searcht 5 [`sqrt (y * y)`];; +searc 'm' 0 [`lfun`;`h0cut`];; +searc 'n' 1 [`lmfun x = lfun x`];; +searc 'o' 0 [`hminus`;`h0`;omit `ineq`];; +searcht 5 [`dih_x a b c d e f = dih_x a' b' c' d' e' f'`];; +searcht 5 [`x * y <= x * z`];; +searcht 5 [`#0.008`;`gamma2_x_div_azim`];; +searcht 5 [`gamma2_x1_div_a`;`gamma2_x_div_azim`];; +searcht 5 [`atn2 (x,y) + atn2 (u,v)`];; +searc 'q' 3 [`tan (x + y)`];; +searc 'p' 2 [`tan x = tan y`];; +searcht 5 [`tan (atn x)`];; +searcht 5 [`abs(atn x) < pi / &2`];; +searcht 15 [`cos x = &0`];; +searc 'r' 7 [`atn2(x,y)`];; +searcht 5 [`&0 < atn x`];; +searc 's' 7 [ `atn2`;`atn`];; +searcht 5 [`atn x < atn y`];; +searcht 35 [`y < u / x`];; +searcht 5 [`delta_x`;`ups_x`];; +Sphere.dih_x;; +searc 't' 0 [`sqrt (x pow 2)`];; +fynlist 3;; +follow_your_nose_string_list();; +searcht 5 [`sqrt x * sqrt y`];; +searcht 5 [`sqrt (x1 pow 2)`];; +searc 'u' 1 [`atn2 (a* x,a*y)`];; +ETA_Y_BOUNDS;; +searc 'v' 4 [`gamma3f_x_div_sqrtdelta`;`gamma3f`];; +searcht 50 [`dih4_x_div_sqrtdelta_posbranch`;omit `ineq`];; + dih_x_div_sqrtdelta_pos;; +searc 'w' 1 [`&0 < delta_x4 a b c d e f`];; +searcht 5 [`sqrt8 * sqrt8`];; +searcht 5 [`x * x < y * y`];; +searc 'x' 1 [`h0cut y = &1`];; +searcht 5 [`x * y < x * z`];; +searcht 5 [`dih4_x_div_sqrtdelta_posbranch`;`dih_x_div_sqrtdelta_posbranch`];; +bb 22;; +bb 3;; +searcht 5 [`dih_y a b c d e f = dih_y a' b' c' d' e'f 'f`];; +searcht 5 [`eta_y a b c = eta_y a' b' c'`];; +searcht 5 [`gamma3f a b c d e = gamma3f a' b' c' d' e' `];; +searcht 15 [`x <= y/z`];; +searcht 35 [`dih_y_div_sqrtdelta_posbranch a b c d e f = dih_y_div_sqrtdelta_posbranch a' b' c' d' e' f'`];; +searcht 5 [`dih_x_div_sqrtdelta_posbranch`;`dih_x`];; +searc 'y' 0 [`(?x. p /\ q x) <=> (p /\ ?x. q x)`];; +searcht 5 [`gamma2_x1_div_a`;`gamma2_x_div_azim`];; +searcht 5 [name "VICUATE"];; +searcht 5 [def "wedge"];; + +(* Nov 29, 2012 *) +bb 3;; +searcht 5 [`gamma4fgcy a b c d e f l = u a' b' c' d' e' f' l`];; +searcht 5 [`rad2_y`;`eta_y`;omit `ineq`];; +searc 'a' 0 [`sqrt8`;`sqrt2`];; +Sphere.delta_y;; +Sphere.bump;; +searcht 5 [`m1`;`pi`];; +searcht 5 [`wedge a b c d INTER wedge a' b' c' d'`];; +searcht 5 [name "WEDGE_ORDER_DIS"];; +searcht 5 [`wedge_ge a b c d INTER wedge_ge a' b' c' d'`];; +searcht 5 [`wedge`;`wedge_ge`];; +searcht 25 [`&2 * pi`;`azim`];; +searcht 15 [`azim a b c d = &0`];; +Local_lemmas.AZIM_EQ_0_GE_ALT2;; +searcht 5 [`x IN Y <=> x IN Z`];; +searcht 5 [`wedge_ge`;`azim`];; +searcht 5 [`&0 <= azim a b c d `];; +searcht 15 [`collinear`;`aff_ge`];; +searc 'b' 3 [`azim a b c d + azim a b d e`];; +searcht 5 [`collinear {a,b,c} ==> (c IN affine hull X)`];; +searcht 5 [`aff_ge X {}`];; +searcht 25 [`collinear {a,b,c}`];; +searc 'c' 4 [`aff_ge`;`aff`];; +searc 'd' 2 [`aff_ge X Y SUBSET aff_ge X' Y'`];; +searcht 35 [`x IN aff_ge X Y`;omit `azim`;omit `%`];; +searc 'e' 22 [`affsign`];; +searcht 35 [`affsign`];; +searcht 5 [`DISJOINT`;`aff_ge S U`];; +searcht 5 [`x IN aff_ge {x} U`];; +AFF_GE_MONO_RIGHT;; +SUBSET;; +searcht 5 [`x IN X /\ X SUBSET Y`];; +searcht 5 [`aff_ge S {}`];; +searcht 5 [`x IN u hull v`];; +searcht 5 [`collinear`;`~(x = y)`];; +searcht 15 [`wedge`;`wedge_ge`];; +searcht 15 [`&0 <= azim a b c d `];; +searcht 15 [`wedge`;`azim`];; +searcht 15 [`collinear`;`affine hull X`];; +AFFINE_HULL_3_IMP_COLLINEAR;; +searcht 15 [`affine hull X`;`aff_ge`];; +searcht 5 [`X INTER {u}`];; +searcht 15 [`X INTER Y = {}`;`!`];; +searcht 5 [`azim`;`aff_ge X Y`];; +searcht 15 [`azim a b c d = azim a b c d'`;omit `norm`];; +searcht 15 [`azim a b c d = &0`];; +searcht 15 [`aff_gt`;`aff_ge`];; +searcht 5 [`azim a b c c`];; + +(* Dec 1, 2012 *) +searcht 5 [`&x < &y`];; +bb 6;; +searcht 50 [`beta_bump_y`];; +Sphere.beta_bump_y;; +searcht 5 [`x /y`;`inv`];; +searcht 5 [`inv x <= inv y`];; +searcht 5 [`hminus`;`hplus`];; +searcht 5 [`hplus`;`sqrt8`];; +searc 'a' 0 [`sqrt8`;`sqrt2`];; +searcht 5 [`dih_y a b c d e f = dih_y a' b' c' d' e'f 'f`];; +searcht 3 [`rad2_y`;`y_of_x`];; +searc 'b' 1 [`norm2hh`;omit `ineq`];; + +(* Dec 5, 2012 *) +searcht 5 [`sum`;`IMAGE`];; +Counting_spheres.BIJ_SUM;; +searcht 55 [`x MOD n`;`(v = q * x + (b:num))`];; +searcht 5 [`MOD`;`DIV`];; +DIVISION;; +searcht 5 [`x IN a..b`;`?`;`x+(a:num)`];; +searcht 5 [`(a - b) MOD n`];; +searcht 30 [`MOD`];; +searcht 5 [`a <= (b:num)`;`a >= (b:num)`];; +searcht 30 [`DIV`];; +MOD_EQ_0;; +searcht 30 [`(x - y) * (n:num) = x * n - y * n`];; +searc 'c' 0 [`(x * y + a ) MOD n`];; +searcht 5 [`a MOD n = a`];; +searcht 5 [`sum {}`];; +searcht 5 [`CARD X = 0`];; +searcht 5 [`~(X = {})`;`?`];; +searcht 5 [name "STRONG";name "INDUCT"];; +searcht 5 [`{} INTER X`];; +bb 8;; + +(* Dec 14, 2012 *) +searcht 5 [`CARD x = 0`];; +searcht 15 [`(X = {})`;`?`];; +searcht 5 [`~(!x. P x)`];; +searcht 15 [`&0 <= sum X f`];; +searcht 15 [`sum {i}`];; +searcht 15 [`i..i`];; +searcht 5 [`x IN Y <=> x IN Z`];; +searcht 15 [`EL 0 x`];; +searcht 5 [`HAS_SIZE`;`0`;`{}`];; +bb 9;; +searcht 5 [`x HAS_SIZE (SUC n)`];; +searcht 5 [`( k * n + i) MOD n`];; +Print_types.print_goal_types();; +searcht 5 [`i MOD n = i`];; +searcht 5 [`0 MOD n`];; +searcht 5 [`periodic`;`cc_qu_v9`;omit `a_spine5`];; +searcht 50 [`sum (a..b) f`;`f a + sum (c..d) f`];; +searcht 5 [`sum (a..b) f`;`(b:num) < a`];; +searcht 5 [`sum (n..n) f`];; +searcht 5 [`sum X f = sum X g`];; + +(* Dec 21, 2012 *) +searcht 5 [name "MHFTT"];; +searcht 5 [`collinear`;`aff_dim`];; +searcht 5 [name "IDBEZ"];; +searcht 5 [`voronoi_list`;`omega_list`];; +searcht 15 [`barV`;`aff_dim`];; +searcht 5 [`aff_dim`;`segment`];; +searcht 5 [`segment`;`face_of`];; +searcht 5 [`segment`;`extreme_point_of`];; +searc 'a' 0 [`extreme_point_of`;`face_of`];; +FACE_OF_REFL;; +searcht 5 [`polytope`;`voronoi_list`];; +searcht 5 [`segment`;`hull`];; +searcht 5 [`{x} face_of p`];; +searcht 5 [`aff_dim`;`facet_of`];; +searcht 5 [`segment`;`aff_dim`];; +searc 'b' 8 [`segment`;`~(a = b)`];; +searc 'c' 0 [`aff_dim {c}`];; +searcht 5 [`aff_dim x = &0`];; +searcht 5 [name "YNHY"];; +searcht 5 [name "BARV_3_EXPLICIT"];; +searcht 5 [name "TRUNCATE_SIMPLEX_EXPLICIT_3"];; +searcht 5 [name "LEFT_ACTION_LIST_PROPERTIES"];; +searcht 5 [name "OMEGA_LIST_2_EXPLICIT_NEW"];; +searc 'd' 0 [`permutes`;`hl`;`barV`];; +searcht 5 [`p permutes a..b ==> p permutes c..d`];; +searcht 50 [`u ==> x permutes y`];; +searcht 15 [`truncate_simplex 2 (CONS x y)`];; +searcht 15 [`set_of_list (CONS x y)`];; +searcht 15 [`hl x `;` (left_action_list p q)`];; +searcht 15 [`hl`];; +searcht 15 [`barV V k (truncate_simplex a b)`];; +searcht 15 [`left_action_list`;`swap`];; +searcht 15 [`TABLE`];; +searcht 15 [`EL i x = EL i y`];; +searcht 15 [`LENGTH`;`TABLE`];; +searcht 15 [`inverse (swap(a,b))`];; +searcht 5 [`EL j (truncate_simplex k p)`];; +EL;; + +(* Dec 22, 2012 *) +searcht 15 [def "circ"];; +searcht 15 [name "MHFT"];; +searcht 15 [`affine hull (convex hull s)`];; +searc 'e' 14 [`affine hull {a,b}`];; +searcht 15 [`voronoi_list`;`dist`];; +searcht 5 [`norm x pow 2`;`dot`];; +searcht 15 [`voronoi_closed`;`voronoi_list`];; +Packing3.VORONOI_LIST_SUBSET_VORONOI_CLOSED;; +searcht 15 [def "voronoi_closed"];; +searcht 15 [`omega_list`;`voronoi_list`];; +searcht 5 [name "XYOF"];; +searcht 5 [`barV`;`x SUBSET V`];; +bb 4;; +searcht 5 [`affine_dependent`;`barV`];; +searcht 5 [`dist(x,y) < dist (u,v)`];; +searcht 5 [`EL x y IN set_of_list p`];; +searc 'f' 0 [`x IN set_of_list p`];; +searc 'h' 1 [`MEM x u`;`EL`];; +searcht 5 [`aff_dim`;`barV`];; +searcht 15 [`truncate_simplex`;`set_of_list`];; +searc 'g' 0 [`EL`;`truncate_simplex`];; +searc 'h' 0 [`LENGTH (truncate_simplex a b)`];; +searcht 5 [`aff_dim X <= aff_dim Y`];; +searcht 5 [`barV`;`aff_dim`];; +searcht 5 [`voronoi_closed`;`bis`];; +searcht 5 [`voronoi_closed`;`dist`];; +searcht 5 [`x IN s ==> x IN convex hull s`];; +searcht 15 [`barV`;`circumcenter`];; +searcht 10 [`omega_list`;`voronoi_list`;`barV`];; +searcht 10 [`circumcenter`;`dist`];; +searcht 5 [`sqrt x = sqrt y`];; +searcht 5 [`HD (truncate_simplex k u)`];; +searcht 15 [`&0 < x * y`;`&0 < x`];; + +(* Dec 23, 2012 *) +searcht 15 [`CONS`;`LENGTH`;`3`];; +searcht 15 [`CONS`;`(x:(A)list) = y`];; +searcht 15 [`LENGTH t = 0`];; +searcht 15 [`set_of_list (CONS x y)`];; +searc 'i' 15 [`affine hull {a,b,c}`];; +searcht 8 [`(a cross b) dot c`];; +searcht 5 [`a cross a`];; +searcht 5 [`(vec 0) dot b`];; +searcht 5 [`coplanar`;`cross`];; +searcht 5 [`aff_dim`;`coplanar`];; +searcht 15 [`aff_dim`;`INSERT`];; +searcht 5 [`coplanar`;`affine_dependent`];; +searcht 50 [`coplanar`];; +searcht 5 [`aff_dim x <= aff_dim y`];; +searcht 5 [`aff_dim`;`{a,b,c}`];; +searcht 5 [`aff_dim (affine hull s)`];; +searcht 5 [`aff_dim {a,b}`];; +searcht 5 [`barV`;`aff_dim`];; +searcht 5 [`x IN y <=> x IN z`];; +searcht 5 [`affine hull (convex hull s)`];; +searcht 5 [`y SUBSET affine hull y`];; +searcht 5 [`t % x = t % y`];; +searcht 5 [`circumcenter x IN affine hull y`];; +searcht 15 [`&0 < a * b`];; +searc 'j' 1 [`extreme_point_of`;`segment`];; +searcht 5 [`aff_dim {a}`];; +searcht 5 [`aff_dim`;` {a,b}`];; +searcht 5 [`aff_dim`;`convex hull x`];; +searcht 5 [`face_of`;`extreme_point_of`];; +searcht 5 [`segment`;`convex`];; +searcht 15 [`X SUBSET aff_gt U V`];; +searcht 5 [`aff_gt {x,y} {z}`];; +searcht 5 [`set_of_list ul`;`LENGTH`];; +searcht 5 [`collinear {a,b}`];; +searcht 5 [`truncate_simplex i ul = ul`];; +searcht 5 [`x IN S ==> x IN (convex hull S)`];; +searcht 5 [`set_of_list (truncate_simplex i ul)`];; +searcht 5 [`EL i ul IN set_of_list ul`];; +searcht 5 [`MEM (EL i ul) ul`];; +searcht 5 [`EL k (truncate_simplex i ul)`];; +searcht 5 [`convex hull X SUBSET aff_ge X Y`];; +searcht 4 [`aff_ge X Y = aff_ge X Z`];; +searcht 5 [`convex hull X`;`aff_ge`];; +searcht 5 [`aff_ge X Y SUBSET aff_ge X' Y'`];; +searcht 25 [`aff_ge {a,b,c} {d}`];; +searc 'k' 1 [`coplanar`;`DISJOINT`];; +searcht 5 [`coplanar`;`aff_dim`];; +searcht 15 [`aff_dim (r:real^A->bool) <= x`];; +searcht 5 [`dimindex (:3)`];; +searcht 5 [`x IN interior (UNIV)`];; +searcht 5 [`aff_dim`;`(UNIV)`;`affine hull x`];; +searcht 5 [`affine hull {a,b,c,d}`];; +searcht 5 [name "JBD"];; +searcht 5 [`a cross (b+ c)`];; +searcht 5 [`(a + b) dot c`];; +searcht 5 [`vec 0 dot a`];; +searcht 5 [`-- (x dot y)`];; +searcht 5 [`-- (x cross y)`];; +searcht 15 [def "wedge"];; +searcht 15 [`wedge`;`open`];; +searcht 5 [`convex`;`&1`;`%`];; +searcht 5 [`convex hull S = S`];; +searcht 3 [`(a + b) cross d`];; +searcht 5 [`convex hull A SUBSET convex hull b`];; +searcht 5 [`convex`;`omega_list`];; +searcht 5 [`convex hull {a,b,c,d}`;`%`];; +searcht 5 [`vec 0 dot u`];; +searcht 5 [`re_eqvl a (t * b)`];; +searc 'l' 2 [`re_eqvl`];; +searcht 5 [`&0 < inv x`];; +searcht 5 [`barV`;`aff_dim`];; +searcht 5 [`INSERT`;`aff_dim`];; +searcht 5 [`convex hull x`;`mxi`];; +searcht 50 [`mxi`];; +between;; +searcht 5 [`between`;`a % b`]; +searcht 5 [`between`;`segment`];; +searcht 5 [`segment`;`a % b`];; +searcht 5 [`omega_list_n`;`omega_list`];; +searcht 5 [`omega_list`;`circumcenter`];; +searcht 5 [`truncate_simplex k ul = ul`];; +searcht 5 [` &0 % x`];; +searcht 5 [`x + vec 0`];; +searcht 5 [`hl`;`dist`];; +searcht 5 [`HD`;`EL 0`];; +searcht 5 [`a % u + b % v IN f hull s`];; +searcht 5 [`a + b IN affine hull s`];; +searcht 25 [`a % u`;`affine`];; +searcht 5 [`affine (affine hull s)`];; +searcht 5 [`circumcenter x IN affine hull s`];; +searcht 5 [`cc_cell`;`convex`];; +searcht 15 [`convex hull y SUBSET x`;`convex u`];; +searcht 5 [`S SUBSET affine hull S`];; +searcht 5 [`convex hull s = s`];; +searcht 5 [`mcell2`;`voronoi_closed`];; +searcht 5 [`vol`;`convex hull {a,b,c,d}`];; +searcht 5 [`coplanar`;`delta`];; +searcht 15 [`coplanar`;`vol`];; +searcht 5 [name "POLFLZY"];; +searcht 5 [`delta_x`;`delta`];; +searcht 5 [`coplanar`;`coplanar_alt`];; +searcht 5 [`dimindex (:3)`];; +searcht 5 [`&0 <= delta a b c d e f`];; + Rogers.MHFTTZN1;; +searcht 5 [`mcell4`;`convex hull s`];; +searcht 5 [`mcell4`;`coplanar`];; +searcht 5 [`coplanar`;`aff_dim`];; +searcht 5 [`aff_dim x <= aff_dim y`];; +searcht 5 [`s SUBSET f hull s`];; +searcht 5 [`convex`;`mcell`];; +searc 'a' 0 [`convex hull s SUBSET affine hull s`];; +searc 'b' 0 [`x IN s /\ s SUBSET t`];; +searcht 5 [`set_of_list (truncate_simplex k vl)`];; +searcht 5 [`s SUBSET affine hull s`];; +searcht 5 [`affine hull s SUBSET affine hull t`];; +searcht 5 [`affine hull (affine hull s)`];; +searcht 5 [`coplanar {a,b,c}`];; +searcht 5 [`LENGTH(truncate_simplex k vl)`];; +searcht 25 [`circumcenter`];; +searcht 5 [`affine_dependent`;`collinear`];; +searcht 5 [`truncate_simplex k vl`;` barV V k`];; + +AFFINE_DEPENDENT_IMP_COLLINEAR_3;; +searcht 5 [`EL k (truncate_simplex j ul)`];; +searcht 5 [`mxi`;`dist`];; +searc 'c' 3 [`omega_list_n`;`voronoi_list`];; +searcht 5 [`convex`;`voronoi_list`];; +searcht 5 [`between`;`mxi`];; +searcht 5 [`between`;`convex hull s`];; +searc 'd' 0 [`convex hull a SUBSET convex hull b`];; +searcht 5 [`convex hull s = s`];; +searcht 5 [`voronoi_set`;`dist`];; +searcht 15 [`(?v. p v) ==> t`];; +searcht 15 [`~(x = {})`;`?`];; +searcht 15 [`set_of_list ul SUBSET V`];; +searcht 15 [`q IN set_of_list (truncate_simplex k vl)`];; +bb 5;; +searcht 5 [`radV`;`dist`];; +searcht 5 [`collinear`;`leaf`];; +searcht 5 [`coplanar`;`SUBSET`];; +searcht 5 [`s SUBSET f hull s`];; +searcht 5 [`aff_dim`;`coplanar`];; +searcht 5 [`aff_dim`;`collinear`];; +searcht 5 [`x UNION {y} = y INSERT x`];; +type_of `INSERT`;; +searcht 5 [`aff_dim`;`INSERT`];; +type_of `mcell`;; +searcht 5 [def "rog"];; +searcht 5 [`rogers`;`omega_list_n`];; +searcht 5 [`rogers`;`aff_ge`];; +searcht 5 [`aff_ge`;`convex`];; +searcht 15 [`aff_ge a b = aff_ge c d`];; +searcht 15 [`mcell2`;`aff_ge`];; +searcht 5 [`aff_gt`;`aff_ge`];; +searcht 15 [`aff_gt {a,b}`];; +searcht 5 [`aff_ge a b SUBSET aff_ge c d`];; +searcht 15 [`FINITE`;`aff_dim`];; +searcht 5 [`?(x:real^A). p`;`~(x = (a:real^A))`];; +searcht 5 [`DISJOINT`;`collinear`];; +searcht 5 [`{} SUBSET X`];; +searcht 5 [`aff_ge S {}`];; +searcht 5 [`affine`;`aff`];; +searcht 5 [def "aff"];; +searcht 15 [def "aff"];; +searcht 35[`affine_dependent`];; +searcht 5 [`affine hull s`;`aff_ge`];; +searcht 5 [`collinear`;`affine hull {a,b}`];; +searcht 5 [`collinear`;`aff_dim`];; +searcht 5 [`aff_dim {a,b}`];; +searcht 5 [`aff_dim {a,b,c} = &2`];; +searcht 5 [`affine hull s = affine hull t`;`aff_dim`];; +searcht 5 [`x IN s ==> x IN f hull s`];; +searcht 5 [`coplanar`;`aff_dim`];; +searcht 5 [`aff_dim (affine hull s)`];; +searcht 5 [`affine hull (affine hull x)`];; +searcht 5 [`affine hull {a,b,c}`;`%`];; +searcht 5 [`%`;`conv`];; +searcht 5 [`affine hull {a,b}`;`%`];; +searcht 5 [`%`;`aff_ge {a,b} {c,d}`];; +searcht 5 [`conv`;`convex hull s`];; +searcht 5 [def "conv"];; +searcht 5 [`aff_ge`;`conv`];; +searcht 50 [`conv`];; +bb 5;; +searcht 5 [`a % v = a % w`];; +searcht 5 [`a % (b + c)`];; +searcht 5 [`a % b % c`];; +searcht 5 [`collinear`;`DISJOINT`];; +searcht 5 [`affine_dependent`;`~`;`{a,b,c,d}`];; +AFFINE_DEPENDENT_EXPLICIT;; +searcht 8 [`vsum`;`INSERT`];; +searcht 5 [`CARD`;`DISJOINT`];; +searcht 5 [name "CARD4_IMP_DISTINCT"];; +VSUM_CLAUSES;; +CONJUNCT1 VSUM_CLAUSES;; + +(* Dec 27, 2012 *) +searc 'a' 0 [`coplanar {a,b,c}`];; +searcht 5 [`s SUBSET f hull s`];; +searc 'b' 1 [`DISJOINT`;`coplanar`];; +searcht 5 [`%`;`aff_gt {a,b} {p}`];; +searcht 5 [`%`;`aff_ge {a,b} {p}`];; +searcht 5 [`DISJOINT`;`collinear`];; +searcht 5 [`%`;`affine hull {a,b,p}`];; +searcht 5 [`affine_dependent`;`coplanar`];; +searcht 5 [`coplanar`;`CARD`];; +searcht 5 [`CARD {a,b,c,d}`];; +searcht 5 [`coplanar`;`coplanar_alt`];; +searcht 5 [`dimindex (:3)`];; +searcht 15 [`affine_dependent {a,b,c,d}`];; +searcht 5 [`aff_dim`;`coplanar`];; +searc 'c' 0 [`(&0 <= w * t3) <=> p`];; +searcht 5 [`affine hull {a,b}`;`%`];; +searcht 15 [`mxi`];; +searcht 15 [`convex hull {a,b,c}`];; +searcht 5 [`&0 <= inv x `];; +searcht 5 [`abs(a * b)`];; +searcht 5 [`%`;`aff_gt {a,b,c} {p}`];; +searcht 5 [`DISJOINT`;`coplanar`];; +searcht 5 [`x INTER x`];; +searcht 5 [`convex hull {a,b,c,d}`;`%`];; +searcht 5 [`a/b < c`];; +searcht 15 [`coplanar {a,b,c,d}`];; +searcht 5 [`chi_msb [a;b;c]`;`%`];; +searcht 5 [`aff_gt`;`affine hull s`];; +searcht 5 [`x = [a;b;c]`;`3`];; +searcht 5 [`coplanar {a,b,c}`];; +searcht 5 [`coplanar (affine hull s)`];; +searcht 5 [`coplanar`;`SUBSET`];; +searcht 5 [`convex`;`mcell_set`];; +searc 'd' 1 [`convex`;`rcone_ge`];; +searcht 5 [`&0 <= hl ul`];; +searcht 5 [`convex`;`aff_ge`];; +searc 'e' 0 [`hl [a;b]`];; +searcht 5 [`truncate_simplex 1`];; +searcht 5 [`convex {}`];; +searc 'f' 0 [`convex (convex hull s)`];; +searcht 50 [`edgeX`];; +searcht 50 [`VX`];; +searcht 5 [`rogers`;`voronoi_closed`];; +searcht 5 [`rogers`;`VX`];; +searcht 5 [`VX`;`mcell`];; +searcht 15 [`voronoi_closed V v INTER x`];; +searcht 15 [`voronoi_set V {u,v}`];; +searcht 5 [`dist(x,w) = &0`];; +searcht 5 [`&0 <= dist (x,y)`];; +Hdtfnfz.HDTFNFZ;; +searcht 5 [`cell_params`];; +searcht 5 [`(\(a,b). f a b) t`];; +searcht 5 [`NULLSET`;`vol`];; +searcht 15 [`cell_params`];; +searcht 15 [`barV`;`HD vl IN V`];; +searcht 5 [`barV`;`set_of_list ul SUBSET V`];; +searcht 5 [`sqrt(&4)`];; +searcht 50 [`NULLSET`];; +COPLANAR_IMP_NEGLIGIBLE;; +CHI_MSB_COPLANAR;; +searcht 5 [`aff_dim`;`barV`];; +searcht 5 [`convex hull X SUBSET convex hull Y`];; +searcht 15 [`edgeX`];; +searcht 5 [`convex hull X = X`];; +CC_CELL34;; +ZASUVOR;; +searcht 5 [`x SUBSET f hull y`];; +searcht 5 [`p IN aff_gt s {p}`];; +searcht 5 [`chi_msb`;`coplanar`];; +searcht 10 [`coplanar {a,b,c,d}`;`%`];; +searcht 15 [`affine_dependent`;`{a,b,c,(d:real^3)}`];; +searcht 5 [`affine_dependent`;`aff_dim`];; +searcht 5 [`aff_dim x <= aff_dim y`;`x = y`];; +searcht 5 [`aff_dim (:real^A)`];; +searcht 5 [`aff_dim`;`coplanar`];; +searcht 5 [`affine hull {a,b,c,d}`];; +searcht 15 [`(&0 < z) ==> u`;`&0 < x * y`];; +searcht 5 [`aff_gt {a,b,c} {d}`;`%`];; +searcht 5 [`collinear`;`DISJOINT`];; +searcht 5 [`x IN convex hull (x INSERT y)`];; + +(* Dec 29, 2012 *) +searcht 5 [`%`;`aff_gt {a,b} {c}`];; +searcht 5 [name "chi_msb_add"];; +Fan.th3a;; + +GBEWYFX;; +searcht 5 [`coplanar`;`chi_msb`];; +bb 15;; +searcht 5 [name "AJRI"];; +searcht 5 [`coplanar`;`NULLSET`];; +searcht 5 [`convex hull x SUBSET convex hull y`];; +HULL_INC;; +searcht 15 [`a hull X = X`];; +searcht 5 [`convex`;`mcell`];; +searcht 5 [`barV`;`cc_uh`];; +searcht 5 [`convex hull s SUBSET convex hull y`];; +searcht 5 [`f hull (f hull s)`];; +HULL_INC;; +searcht 5 [`NULLSET`;`SUBSET`];; +searcht 5 [`NULLSET`;`vol`];; +searcht 5 [`SUBSET`;`measure`];; +searcht 25 [ `negligible`;`SUBSET`];; +searcht 5 [`X INTER Y = Y INTER X`];; +cc_cell;; +bb 4;; +searcht 5 [`NULLSET`;`coplanar`];; +searcht 5 [`coplanar`;`vol`];; +searcht 5 [name "ZWV"];; +searcht 5 [name "RVF"];; +Pack_defs.mcell_set;; +searcht 5 [`mcell_set`;`cc_cell`];; +searcht 30 [`VX`];; +searcht 15 [`convex hull j`;`rogers`];; +searcht 15 [`rogers`;`voronoi_closed`];; +searcht 15 [`EL`;`left_action_list`];; +Packing3.EL_LEFT_ACTION_LIST;; +searcht 15 [`set_of_list`;`left_action_list`];; +Packing3.SET_OF_LIST_LEFT_ACTION_LIST;; +searcht 5 [`set_of_list [a;b;c;d]`];; +set_of_list4;; +searcht 5 [`CARD {a,b,c,d}`];; +searcht 5 [name "WQP"];; +searcht 5 [name "AJR"];; +searcht 15 [`convex hull s = convex hull t`];; +EXTREME_POINTS_OF_CONVEX_HULL_EQ;; +Packing3.CONVEX_HULL_EQ_EQ_SET_EQ;; +Rogers.WQPRRD4;; +searcht 5 [`coplanar (convex hull s)`];; +searcht 5 [`coplanar`;`convex hull s`];; +searcht 5 [`coplanar`;`affine hull s`];; +searcht 5 [`coplanar s`;`s SUBSET t`];; +searcht 5 [`convex hull s SUBSET affine hull s`];; +MCELL3_NONPLANAR;; +searcht 5 [`truncate_simplex 2 (cc_uh V ul)`];; +cc_uh;; +searcht 5 [`X INTER X`];; + +(* Dec 30, 2012 *) +CC_CELL34;; +searcht 5 [`affine_dependent`;`coplanar`];; +searcht 5 [`affine_dependent`;`aff_dim`];; +searcht 5 [`CARD`;`coplanar`];; +searcht 5 [`CARD {a,b,c,d}`];; +searcht 5 [`coplanar`;`coplanar_alt`];; +searcht 5 [`coplanar`;`affine hull s`];; +searcht 5 [`coplanar`;`SUBSET`];; +ZWVCBMN;; +searcht 5 [`FINITE`;`INSERT`];; +searcht 5 [`aff_dim {a,b,c,d}`];; +searcht 5 [`coplanar`;`aff_dim`];; +searcht 5 [`aff_dim`;`dimindex`];; +searcht 5 [`cc_uh`;`barV`];; +searcht 5 [`set_of_length`;`INSERT`];; +EL_CC_UH;; +K4_CHI_MSB_POS;; +set_of_list2;; +searcht 5 [`set_of_list`;`truncate_simplex 1`];; +searcht 5 [`EL`;`truncate_simplex`];; +searcht 20 [`LENGTH`;`truncate_simplex`];; +LENGTH3;; +LENGTH4_SET2;; +searcht 5 [`CARD`;`4`;`cc_uh`];; +set_of_list4_explicit;; +LIST_OF_CC_UH;; +searcht 5 [`truncate_simplex 2 (cc_uh V ul)`];; +searcht 5[`sqrt(&4)`];; +searcht 5 [`set_of_list`;`barV`];; +searcht 5 [`HD ul`;`packing V`];; +Packing3.BARV_SUBSET;; +Packing3.BARV_IMP_HD_IN_SET_OF_LIST;; +searcht 5 [`x IN Y /\ Y SUBSET Z`];; +searcht 5 [`barV`;`set_of_list ul SUBSET V`];; +searcht 5 [`A SUBSET B /\ B SUBSET A`];; +searcht 15 [`cc_ke V ul = 4`];; +searcht 5 [name "CARD4"];; +searcht 5 [`CARD {EL 0 ul,b,c,d}`];; +searcht 5 [`{a,b} = {c,d}`];; +bb 6;; +searcht 5 [`{a,b,c} = {a',b',c'}`];; +searcht 5 [`(A =B) <=> (B = A)`];; +searcht 5 [``;`barV`];; +searcht 50 [`left_action_list`];; +searcht 5 [`CARD`;`DIFF`];; + +(* Dec 31, 2012 *) +Pack_defs.HL;; +searcht 5 [name "RDW"];; +Rvfxzbu.RVFXZBU;; +searcht 5 [`TSKAJXY_statement`];; + +Marchal_cells_3.LEFT_ACTION_LIST_3_EXISTS;; +Marchal_cells_3.LEFT_ACTION_LIST_2_EXISTS;; +Rvfxzbu.RVFXZBU;; +searcht 5 [`left_action_list`;`mcell`];; +CARD_DIFF;; +searcht 5 [`left_action_list`;`barV`];; +Rogers.YIFVQDV_1;; +searcht 5 [`cell_cluster_estimate`];; +searcht 50 [`left_action_list`;`mcell`];; +Marchal_cells_2_new.LEFT_ACTION_LIST_PROPERTIES;; + +searcht 5 [`convex hull s`;`mcell3`];; +searcht 5 [name "REUH"];; +searcht 5 [`{a,b} = {c,d}`];; +searcht 5 [`VX`];; +searcht 5 [`VX`;`set_of_list`];; +searcht 5 [`cell_params`];; +searcht 15 [`mcell4 V ul = mcell4 V vl`];; +searcht 25 [` x IN mcell i V vl`];; +searcht 5 [`x IN mcell2 V vl`];; +Urrphbz1.MCELL_2_PROPERTIES_lemma1;; +Rogers.XYOFCGX;; +searcht 5 [name "CGX"];; +searcht 5 [`VX`;`mcell2`];; +searcht 5 [name "AJR"];; +searcht 5 [`VX V X SUBSET y`];; +searcht 5 [`midpoint`;`circumcenter {a,b}`];; +searcht 5 [`X SUBSET set_of_list ul`];; +searcht 5 [`set_of_list V SUBSET Q`];; +searcht 5 [`affine_dependent {a,b}`];; +searcht 15 [`set_of_list (truncate_simplex k ul)`];; +searcht 15 [`truncate_simplex 1 ul`];; +searcht 5 [`stem x = {a,b}`];; +searcht 5 [`set_of_list [a;b]`];; +searcht 5 [`radV`;`midpoint`];; +searcht 5 [`radV`;`dist`];; +searcht 5 [`hl [a;b]`];; +searcht 5 [`midpoint`;`dist`];; +searcht 50 [`VX`];; +searcht 5 [`gammaX`;`gamma4fgcy`];; +searcht 15 [`permutes`;`hl`];; +Pack_defs.mcell3;; +Pack_defs.VX;; +searcht 15 [`(\(k,u). f k u) (a,b)`];; +searcht 15 [name "BETA_PAIR"];; +searcht 15 [`(FST x, SND x)`];; +Pack_defs.cell_params;; +searcht 5 [`mcell4`;`mcell 4`];; +searcht 5 [`x INTER x`];; +searcht 25 [`(@)`];; +searcht 5 [`(?x. P x) ==> (P (@x. P x))`];; +searcht 5 [`(A = B) ==> A SUBSET B`];; +searcht 5 [`truncate_simplex k X = X`];; + +(* Jan 1, 2013 *) +searc 'a' 0 [`set_of_list`;`FINITE`];; +searc 'b' 1 [`CARD`;`LENGTH`;`set_of_list`];; +searcht 5 [`CARD B <= CARD A`;`A SUBSET B`;`FINITE`];; +searcht 5 [`mcell4`;`convex hull s`];; +searcht 5 [`set_of_list ul SUBSET V`;`barV`];; +searcht 5 [`set_of_set ul SUBSET mcell4 V ul`];; +searcht 5 [`s SUBSET f hull s`];; +searcht 5 [`neglibible`;`{}`];; +searcht 5 [`VX V X`;`INTER`];; +searcht 5 [`CARD`;`barV`];; +searc 'c' 2 [`{a,b} = {c,d}`];; + Ajripqn.AJRIPQN;; +searc 'd' 0 [`set_of_list`;`truncate_simplex`;`SUBSET`];; +searc 'e' 5 [`LENGTH`;`truncate_simplex`];; +Geomdetail.CARD_SET_OF_LIST_LE;; +Marchal_cells_3.BARV_CARD_LEMMA;; +searcht 5 [`INSERT`;`set_of_list`];; +searcht 5 [`truncate_simplex 2 (CONS x y)`];; +searcht 5 [`set_of_list (CONS x y)`];; +CARD_CLAUSES;; +searcht 5 [`CARD {a,b,c}`];; +searcht 5 [`{ x| F}`];; +GSPEC_EMPTY;; +conj_list;; +searcht 5 [`\x. F`];; +CONJ;; +searcht 5 [`sum {}`];; +searcht 5 [`edgeX`;`mcell2`];; +searcht 15 [`truncate_simplex 2 ul`];; +Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_2;; +searcht 5 [`LENGTH (truncate_simplex k ul)`];; +searcht 5 [`EL k (truncate_simplex r ul)`];; +searcht 5 [`edgeX`;`mcell`];; +searcht 5 [`CARD {u,v}`];; +set_of_list3;; +searcht 15 [`truncate_simplex k ul`];; +set_of_list3;; +searcht 5 [`CARD (X UNION Y)`];; +searcht 5 [`CARD {}`];; +searcht 5 [`CARD x <= CARD y`;`SUBSET`];; +searcht 5 [name "HDT"];; +searcht 5 [`set_of_list ul = A INTER B`];; +set_of_list4;; +searcht 5 [`SUBSET`;`CARD`;`a=b`];; +searcht 5 [`CARD`;`edgeX`];; +searcht 5[ `CARD {a,b} <= 2`];; +searcht 5 [`edgeX`;`mcell4`];; +searcht 5 [`CARD`;`barV`];; +searcht 5 [`CARD`;`DIFF`];; +searcht;; +HDTFNFZ_ALT;; +Hdtfnfz.HDTFNFZ;; +searcht 15 [`BIJ`;`f(g(x))`];; +searcht 15 [`sum X f = sum Y f`;`f x = &0`];; +searcht 15 [`sum X f = sum X g`];; +searcht 5 [`sum s (\x. -- f x)`];; +searcht 5 [name"BIJ_SUM"];; + +(* Jan 2, 2013 *) +searcht 5 [`abs x <= abs a + abs b`];; +searcht 5 [`abs (x - y) <= abs x + abs y`];; +searcht 5 [`abs (x/ y) = abs x / abs y`];; +searcht 5 [`x / y <= z / y`];; +searcht 5 [`x/y = x * inv y`];; +searcht 15 [`x * c <= y * c`];; +searcht 5 [`x pow 2 <= y pow 2`];; +searcht 5 [`abs (x pow n)`];; +searcht 5 [name "HL_2"];; +searcht 5 [`dihu2`];; +searcht 5 [`dihu3`];; +searcht 15 [`gammaX`];; +searcht 5 [`permutes`;`barV`;`mcell`];; +searcht 5 [`mcell2`;`edgeX`];; +searcht 5 [`{a,b} = {c,d}`];; +searcht 5 [`permutes`;`INSERT`];; +Marchal_cells_3.LEFT_ACTION_LIST_3_EXISTS;; +Marchal_cells_3.LEFT_ACTION_LIST_2_EXISTS;; +searcht 5 [`p permutes 0..1`;`left_action_list`];; +Qzksykg.TWO_REARRANGEMENT_LEMMA;; +Rvfxzbu.RVFXZBU;; +Qzksykg.QZKSYKG1;; +searcht 5 [`edgeX`;`{}`];; +searcht 5 [`negligible {}`];; +RIJRIED;; +searcht 5 [`edgeX`;`mcell3`];; +searcht 5 [`CARD {a,b,c}`];; +searcht 5 [`CARD`;`DIFF`];; +searcht 5 [`CARD {a,b}`];; +searcht 5 [`CARD X = 0`];; +searcht 5 [`CARD X = 1`];; +searcht 5 [`set_of_list (truncate_simplex 2 ul) = x INSERT y`];; +searcht 5 [`barV`;`CARD`];; +LENGTH4;; +set_of_list4;; +searcht 15 [`X DIFF e`;`edgeX`];; +searcht 5 [`CARD {x,y} = 2`];; +searcht 15 [`CARD x = 2`];; +searcht 5 [`edgeX`;`mcell k`];; +searcht 5 [`hl a < hl b`];; +searcht 5 [`truncate_simplex k ul = ul`];; +searcht 5 [`truncate_simplex`;`barV`];; +searcht 5 [name "CFFO"];; +searcht 5 [`EL k (truncate_simplex r ul)`];; +searcht 5 [`stem`;`EL`];; +searcht 5 [`cc_A0`;`EL`];; +searcht 5 [`~(x = {})`;`?`];; +searcht 5 [`V INTER X = set_of_list a`];; +searcht 5 [`x IN aff_gt u {x}`];; +searcht 5 [`leaf V (CONS x y)`];; +searcht 15 [`truncate_simplex k vl`;`CONS`];; +LENGTH3;; +searcht 5 [`LENGTH (truncate_simplex k vl)`];; +Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_2;; +STEM_OF_LEAF;; +STEM_OF_LEAF;; +searcht 5 [name "CFF"];; +searcht 5 [`edgeX`;`cc_cell`];; +searcht 5 [`mcell3`;`edgeX`];; +searcht 5 [`cc_cell`;`NULLSET`];; +searcht 5 [`barV V 3`;`cc_uh`];; +searcht 5 [`EL`;`cc_uh`];; +searcht 5 [`set_of_list (truncate_simplex k (ul))`];; +searcht 15 [`EL k (cc_uh V ul)`];; +searcht 15 [`LENGTH (cc_uh V ul)`];; +searcht 5 [`CARD`;`barV`];; +cc_uh;; +Bump.SET_OF_LIST_TRUNCATE_2;; +LENGTH3;; +set_of_list3;; +searcht 5 [`CARD`;`4`;`~(a =b)`];; +searcht 5 [`truncate_simplex k ul SUBSET ul`];; +searcht 5 [`mcell_set`;`cc_cell`];; +searcht 5 [`cc_cell`;`cc_A0`];; +searcht 5 [name "FUE"];; +searcht 5 [`CONS x y = CONS x' y'`];; +ZASUVOR;; + FUEIMOV_4;; +searcht 5 [`cc_uh V ul = CONS x y`];; +searcht 5 [`{a,b} = {c,d}`];; +searcht 5 [`cc_uh V ul = CONS x y`];; +searcht 5 [`coplanar`;`cc_uh`];; +searcht 5 [`coplanar`;`affine hull {a,b,c}`];; +searcht 5 [`aff_gt`;`affine hull s`];; +searcht 15 [`s IN aff_gt u v`];; +SUBSET_HULL;; +searcht 15 [`s SUBSET f hull s`];; +searcht 15 [`s IN S /\ S SUBSET U`];; + +(* Jan 3, 2013 *) +searc 'a' 1 [`coplanar`;`affine hull s`];; +searc 'b' 0 [`aff_dim`;`collinear`];; +searcht 5 [`aff_dim`;`INSERT`];; +searcht 5 [`aff_dim x <= aff_dim y`;`x = y`];; +searcht 5 [`affine hull (affine hull h)`];; +searcht 5 [`s SUBSET f hull s`];; +searcht 5 [`aff_dim (affine hull s)`];; +coplanar;; +searc 'c' 1 [`connected`;`segment`];; +searcht 25 [`connected`;`open`];; +searcht 5 [`a IN segment [a,b]`];; +searcht 5 [`wedge_ge`;`wedge`];; +searcht 5 [`wedge_ge`];; +searcht 35 [`wedge`];; + +Local_lemmas1.AFF_GE_WEDGE_DISJOINTION;; +OPEN_WEDGE;; +Local_lemmas1.EDGE_NOT_INTER_WITH_WEDGE;; +WEDGE_ALT;; +searcht 5 [name "WEDGE_GE_ALMOST"];; +WEDGE_GE_ALMOST_DISJOINT ;; (* not loaded in work_in_progress_merge.hl *) +COPLANAR_UNION;; +CONNECTED_SEGMENT_NOT_COVERED;; +searcht NAN [`closed`;`wedge_ge`];; +searcht 5 [`mcell`;`convex`];; + +searcht 5 [def "wedge_ge"];; +searcht 55 [def "azim"];; +Sphere.AZIM;; +azim;; +searc 'e' 0 [`wedge_ge`;`aff_ge`];; +searcht NAN [`wedge_ge`;name "split"];; +searcht 5 [`wedge`;`UNION`];; +searc 'd' 1 [`closed`;`aff_ge`];; +searcht NAN [`?`;`azim a b c d = e`];; +searcht 5 [`wedge_ge`;`azim a b c d = pi`];; +searcht 5 [`convex`;`closed`];; +searc 'f' [`polyhedron`;`closed`];; +searcht 5 [`~(x = {})`;`?`];; +searcht 5 [`wedge_ge`;`azim`];; +searcht 50 [`collinear`;`azim`];; +searcht 5 [`azim a b c d + azim a b d e`];; +searc 'g' 0 [`collinear`;`azim`;omit `~`];; +searcht 5 [`&0 <= azim a b c d`];; +searcht 5 [`open`;`closed`];; +searcht 5 [`azim`;`-- x`];; +searcht 5 [`azim`;`pi`];; +searcht 25 [`conv0`];; +searcht 5 [`aff_ge {} {a,b}`];; +searcht 5 [`aff_sgn`;`aff_gt`];; +searcht 15 [`aff_gt`;`%`];; +searcht 15[ `azim`;`&2 * pi`];; +searcht 5 [`closed`;` a dot b`];; +searcht 5 [`aff_ge`;`closed`];; +searcht 5 [`closed (A UNION B)`];; +searcht 5 [`NULLSET`;`edgeX`];; +searcht 5 [`edgeX V X = {}`];; +searcht 5 [`convex`;`mcell`];; +searcht 5 [`coplanar`;`SUBSET`];; +searcht 5 [`coplanar`;`NULLSET`];; +WEDGE_WEDGE_GE;; +searcht 5 [`NULLSET `;`UNION`];; +searcht 5 [`NULLSET`;`aff_ge`];; +Conforming.NEGLIGIBLE_AFF_GE_2_1;; +searcht 5 [`collinear`;`leaf`];; +searcht 5 [`set_of_list (CONS x y)`];; +searcht 5 [`SUBSET`;`negligible`];; +searcht 5 [`coplanar`;`SUBSET`];; +searcht 5 [`azim`;`aff_ge`];; +AZIM_DEGENERATE;; +searcht 5 [`wedge_ge`;`azim`];; + +(* Jan 4, 2012 *) +searcht 5 [`((!x. p x) /\ (!x. q x)) <=> R`];; +Local_lemmas.AZIM_EQ_0_GE_ALT2;; +searc 'r' 0 [`&0 <= azim a b c d`];; +searcht 5 [`azim a b c d + azim a b d e`];; +searcht 5 [`collinear`;`affine hull {a,b}`];; +help_grep "DISJ";; +searcht 5 [`collinear`;`~(a = b)`];; +searcht 5 [`affine hull s SUBSET aff_ge a b`];; +searcht 5 [`DISJOINT`;`collinear`];; +bb 15;; +COPLANAR_INSERT;; +searcht 5 [name "COPLANAR_INSERT"];; +searcht 5 [`open`;`wedge`];; +searcht 5 [`closed`;`wedge_ge`];; +searcht 5 [`open`;`closed`];; +searcht 5 [`wedge a b c d SUBSET wedge_ge a b c d`];; +searcht 5 [`wedge`;`wedge_ge`];; +searcht 5 [`wedge_ge`];; +searcht 5 [`segment`;`convex`];; +searcht 15 [`aff_ge`;`aff_gt`];; + DISJOINT {u, v} {w} +Collect_geom.IN_AFF_GE_INTERPRET_TO_AFF_GT_AND_AFF;; +searcht 5 [`segment`;`%`];; +searcht 5 [`wedge`;`wedge_ge`];; +searcht 5 [name "CFF"];; +searcht 20 [`coplanar {a,b,c,d}`];; +searcht 5 [`coplanar`;`INTER`];; +searcht 5 [`s SUBSET f hull s`];; +searcht 15 [`aff_dim s <= &2`];; +Print_types.print_thm_types Njiutiu.AFF_DEPENDENT_AFF_DIM_4;; +searcht 5 [`coplanar`;`aff_dim`];; +searcht 5 [`coplanar`;`affine_dependent`];; +searcht 15 [`affine_dependent {a,b,c,d}`];; +searcht 15 [`affine_dependent`;`sum`];; +searcht 15 [`sum (x INSERT y)`];; +searcht 5 [`affine hull {a,b}`;`%`];; +searcht 5 [`affine hull {a,b,c}`;`%`];; +searcht 5 [`a % v = a % u`];; +searcht 5 [`a % (b + c)`];; +searcht 5 [`a % (b % c)`];; +searcht 5 [`aff_ge`;`aff_gt`];; +searcht 5 [`collinear`;`DISJOINT`];; +searcht 5 [`stem [a;b;c]`];; +searcht 5 [`stem`];; +CELL_NN;; +searcht 5 [`set_of_list [a;b;c]`];; +searcht 5 [`aff_gt x y SUBSET affine hull u`];; +searcht 5 [`chi_msb ul`;`%`];; +searcht 5 [`affine hull s`;`chi_msb`];; +CHI_MSB_IMP_COPLANAR;; +searcht 15 [`coplanar`;`affine hull s`];; +searcht 5 [`aff_dim {a,b,c} <= &2`];; +searcht 5 [`aff_dim`;`collinear`];; +searcht 5 [`collinear`;`leaf`];; +bb 20;; +chi_msb_coplanar;; +COPLANAR_INSERT;; +searcht 5 [`set_of_list ul = {a,b,c}`];; +searcht 5 [`azim a b c d = &0`];; +searcht 50 [`wedge_ge`;`wedge`;];; +searcht 5 [`collinear`;`leaf`];; +searcht 5 [`wedge_ge`;`(:real^3)`];; +searcht 5 [`aff_ge`;`azim a b c d = &0`];; +searcht 5 [`SUBSET`;`negligible`];; +searcht 5 [`wedge_ge`];; +searcht 15 [`collinear`;`affine hull s`];; +searcht 15 [`affine hull s SUBSET aff_ge u v`];; +searcht 5 [`DISJOINT`;`collinear`];; +Local_lemmas.AZIM_EQ_0_GE_ALT2;; +AZIM_BASE_SHIFT_LE;; +searcht 5 [`azim a b c c`];; + Local_lemmas.AZIM_EQ_0_GE_ALT2;; +searcht 5 [`azim a b c d`;`&2 * pi - azim a b c d`];; +Rogers.AZIM_COMPL_EXT;; + +(* Jan 5, 2012 *) +searcht 5 [`wedge_ge`];; +AZIM_DEGENERATE;; +searcht 5 [`&0 <= azim a b c d `];; +searcht 5 [`azim a b c d + azim a b d e`];; +searcht 5 [`azim a b c d = &0`];; +searcht 15 [`wedge_ge`;`wedge`;`aff_ge`];; + +(* link in Ky's work *) +searcht 5 [name "REU"];; +searcht 15 [name "Tsk"];; +Tskajxy_lemmas.SOL_SOL_Y_EXPLICIT;; +Tskajxy_lemmas.DIHX_DIH_Y_lemma;; +searcht 5 [name "REU"];; +Reuhady.REUHADY1;; +searcht 5 [`hl x < hl y`];; +searcht 5 [`truncate_simplex k (CONS x y)`];; +searcht 5 [`set_of_list [a;b]`];; +searcht 5 [`CONS a b = CONS a' b'`];; +searcht 5 [`collinear`;`leaf`];; +searcht 5 [`set_of_list [u0;u1;u2]`];; +searcht 5 [`wedge_ge`;`INTER`;`aff_ge`];; +searcht 5 [`collinear`;`~(a = b)`];; +searcht 5 [`set_of_list x SUBSET V`;`barV`];; +searcht 5 [`azim`;`aff_ge`];; +Leaf_cell.FCHKUGT;; +TL;; +searcht 5 [`aff_gt s t = aff_gt s t'`];; +searcht 15 [`aff_gt`;`aff_ge`];; +searcht 5 [`DISJOINT`;`collinear`];; +searcht 5 [`affine hull {a,b}`;`collinear`];; +Pack_defs.mcell_set;; +Print_types.print_thm_types;; +Tskajxy_lemmas.gammaX_gamma3f;; +bb 5;; +searcht 5 [`radV`;`eta_y`];; +Sphere.packing;; +searcht 5 [`dist(a,b) + dist(b,c)`];; +bb 4;; +searcht 5 [`coplanar`;`collinear`];; +searcht 5 [`set_of_list (truncate_simplex 2 ul)`];; +searcht 5 [`{}`;`negligible`];; +print_proof();; +Print_types.print_goal_types();; +print_goalstack;; +print_proof();; + + +(* Jan 6, 2013 TSKAJXY 1 and 2 cells *) +searcht 15 [`mcell1`];; +searc 'a' 1 [`mcell1`;`HD`];; +searc 'b' 0 [`mcell`;`HD`];; +searc 'c' 2 [`edgeX`;`mcell`];; +searcht 10 [`gammaX`];; +searcht 5 [`gammaX`;`{}`];; +searcht 5 [`total_solid`];; +searcht 5 [`sum {x}`];; +searc 'h' 1 [`a SUBSET b /\ b SUBSET a`];; +searcht 25 [`VX V`];; +searc 'd' 0 [`{}`;`negligible`];; +searc 'e' 0 [`VX V X = {}`];; +searcht 5 [`edgeX V X = {}`];; +searcht 5 [`NULLSET`;`vol`];; +searc 'f' 0 [`set_of_list ul SUBSET V`;`barV`];; +searcht 15 [`set_of_list ul = x INSERT y `];; +searcht 5 [`mcell2`;`VX`];; +searcht 5 [`mcell2`;`edgeX`];; +searcht 15 [`mcell`;`barV`;`V INTER X`];; +searcht 15 [`set_of_list (truncate_simplex 1 ul)`];; +update_database();; +Sphere.BARV;; +searcht 4 [`CARD`;`barV`];; +searc 'g' 1 [`CARD X = 4`;`~(x = y)`];; +searcht 5 [`set_of_list ul`;`4`];; +searcht 5 [`sum {a,b}`];; +searc 'i' 0 [name "BETA_PAIR"];; +searcht 5 [`set_of_list [a;b]`];; +searcht 5 [`dihX`];; +searcht 5 [`mcell2`;`VX`];; +searcht 15 [`radial`];; +searcht 15 [`radial_norm`];; +searcht 15 [`eventually_radial`];; +searcht 15 [def "eventually"];; +searc 'j' 0 [`radial_norm`;`DIFF`];; +searcht 5 [`radial_norm`;`INTER`];; +searcht 5 [def "rcone"];; +searcht 5 [`radial_norm`;`rcone_lt`];; +searcht 500 [name "Vol1.";`sol`];; +searcht 5 [`solid_triangle`];; +searcht 15 [`conic_cap`];; +searc 'k' 0 [`eventually_radial`;`mcell`];; +Urrphbz2.URRPHBZ2;; +Urrphbz2.EVENTUALLY_RADIAL_RCONE_GE_ABC_A;; +searcht 5 [name "Count";`rcone_gt`];; +Sphere.rcone_gt;; +searcht 5 [`rcone_ge`;`dot`];; +searcht 5 [`&0 < dist (p,q)`];; +Print_types.print_thm_types DIST_NZ;; +DIST_NZ;; +type_of `radial_norm`;; +searcht 15 [`convex hull s`;`INTERS`];; +searcht 15 [`aff_ge s t INTER aff_ge s' t'`];; +Cfyxfty.inter_aff_ge_3_1_is_aff_ge_1_3;; (* ! *) +Collect_geom2.ARIKWRQ;; +searcht 5 [`&0 <= dist(a,b)`];; +searcht 5 [`dist (p,x ) <= dist (p,y)`;`dot`];; +searcht 5 [`dist (x,y) pow 2`;`dot`];; +searcht 5 [`norm = r`;`NULLSET`];; +searcht 5 [name "OWCZKJR"];; +type_of `radial_norm`;; +radial_norm;; +searcht 5 [`normball`;`dist (y,x) < u`];; +searcht 5 [def "normball"];; +searcht 5 [`sphere`;`NULLSET`];; +searcht 5 [`eventually_radial_norm`;`eventually_radial`];; +List.length(searcht 500 [`radial_norm`]);; (* 37 *) +hd (definitions());; +searchl (map (fun t -> ("",t)) (definitions())) [`radial_norm`];; +type_of `eventually_radial_norm`;; +Vol1.eventually_radial_norm;; +searcht 15 [def "^sol$"];; +searcht 5 [`sol`;`measurable`;`INTER`;`normball`];; +Vol1.pre_def_4_3b;; +open Vol1;; +radial_normball;; +Vol1.sol;; +searcht 50 [`rect`];; +searcht 50 [`volume_prop_fix`];; +searcht 50 [`primitive`];; +searcht 50 [`ellipsoid`];; +searcht 50 [`hinhcau`];; +Vol1.hinhcau;; +searcht 50 [`map0`];; +DISJOINT;; +INTER_ACI;; +nonempty_cube;; +Vol1.sol_spec;; + +(* Jan 7, 2013 *) +searcht 5 [`vol X = vol Y`];; +searcht 5 [`measurable`;`mcell`];; +volume_props;; +searcht 5 [`sphere`];; +searcht 5 [`measurable (X INTER Y)`];; +searcht 5 [`measurable (ball (x,r))`];; +searcht 1 [`SDIFF`;`vol`];; +searcht 5 [`NULLSET`;`UNION`];; +searcht 5 [`negligible {}`];; +print_proof();; +type_of `sphere`;; +searcht 5 [`sphere`];; +NEGLIGIBLE_SPHERE;; +searc 'a' 0 [`negligible`;`SUBSET`];; +searcht NAN [`sol`;`INTER`;`ball`];; +searcht 50 [`sol`];; +searcht 5 [`mcell`;`eventually_radial`];; +searcht 5 [`set_of_list ul SUBSET V`;`barV`];; +searcht 20 [`set_of_list ul = x INSERT y`];; +searc 'b' 0 [`radial_norm`;`x < t`;`==>`];; +searcht 5 [`radial_norm`;`radial`];; +Vol1.sol;; +searcht 5 [`(X INTER Y) INTER Z`;`X INTER Y INTER Z`];; +Cfyxfty.inter_aff_ge_3_1_is_aff_ge_1_3;; (* ! *) +Collect_geom2.ARIKWRQ;; +searcht 5 [`aff_ge`;`convex hull s`];; +searcht 25 [def "^conv"];; +searcht 5 [`conv`;`affsign`];; +searcht 5 [`aff_ge`;`affsign`];; +searcht 5 [`coplanar`;`coplanar_alt`];; +searcht 5 [name "MCELL2_VX_PROPS"];; +searcht 5 [`coplanar`;`CARD`];; +searcht 5 [`CARD {a,b,c,d}`;`~(a = b)`];; +print_proof();; +searcht 50 [`rogers`];; +searcht 5 [`aff `;`rogers`];; +searcht 5 [`omega_list_n`;`aff`];; +searcht 50 [`aff`];; + +searcht 5 [name "COMPATIBLE_BW_TWO_LEMMAS2"];; +type_of `hypermap`;; +type_of `HYP`;; + searcht 5 [`coplanar`;`coplanar_alt`];; + +(* Jan 18, 2013 *) +(* TSK_in_progress *) +searcht 5 [`norm`;`dist`];; +searcht 5 [`norm (a % b)`];; +searcht 5 [`aff_ge {a} {b,c,d}`;`%`];; +searcht 5 [`DISJOINT`;`coplanar`];; +searcht 15 [`convex`;`%`;`INSERT`;`{a,b,c,d}`];; +searcht 5 [def "bis"];; +searcht 100 [`omega_list_n`];; +searcht 100 [`omega_list`];; +searcht 5 [`coplanar`;`omega_list_n`];; +searcht 5 [`omega_list_n`;`aff_dim`];; +searcht 5 [`negligible`;`aff_dim`];; +searcht 5 [`mcell1`;`rogers`];; +searcht 5 [`SUBSET`;`negligible`];; +searcht 5 [`convex`;`rogers`;`omega_list_n`];; +Marchal_cells.OMEGA_LIST_0_EXPLICIT;; +searcht 15 [`omega_list`;`HD`];; +searcht 5 [`omega_list_n`];; +searcht 5 [`omega_list_n V ul 0`];; +searcht 5 [`NULLSET`;`affine hull s`];; +searcht 5 [`coplanar`;`affine hull s`];; +searcht 5 [`convex hull s SUBSET affine hull s`];; +searcht 5 [`f hull s SUBSET f hull t`];; +searcht 5 [`affine hull (affine hull x)`];; +searcht 5 [`aff_ge {a,b,c} {d}`;`%`];; +searcht 5 [`DISJOINT a b = DISJOINT b a`];; +searcht 5 [`dot`;`dist(a,b) <= dist(c,d)`];; +searc 'a' 1 [`convex`;`a dot b`];; +searcht 8 [`convex`;`%`;`vsum`];; +searcht 5 [`vsum`;`{a,b,c,d}`];; +searcht 15 [`sum (i..k)`;`SUC`];; +searcht 5 [`convex`;`%`;`&1`;omit `vsum`];; +Leaf_cell.DIST_LE_HALF_PLANE;; +searcht 5 [`voronoi_list`;`omega_list_n`];; +searcht 5 [`voronoi_list`;`dist (a,b)`];; +searcht 5 [`set_of_list(truncate_simplex k ul)`];; +searcht 5 [`barV`;`truncate_simplex`];; +searcht 5 [`dist(a,b) = dist(c,d)`;`dot`];; +searcht 5 [`&0 <= dist(x,y)`];; +searcht 25 [`~coplanar {(a:real^3),b,c,d}`;`%`;`&1`];; +searcht 15 [`affine hull s`;`(:real^A)`];; +searcht 5 [`coplanar`;`aff_dim`];; +searcht 5 [`aff_dim`;`dimindex`];; +searcht 5 [`affine hull {a,b,c,d}`;`%`];; +searcht 15 [`&0 <= a * b`;`&0 < x`];; +searcht 15 [`dot`;`dist(a,b) < dist(c,d)`];; +searcht 5 [`&0 < dist (x,y)`];; +searcht 15 [`barV`;`~(x = y)`];; +Sphere.BARV;; +searcht 5 [def "voronoi_nondg"];; +searcht 5 [`voronoi_nondg`];; +searcht 5 [`voronoi_list`;`aff_dim`];; +Sphere.VORONOI_LIST;; +searcht 5 [`initial_sublist ul ul`];; +searcht 5 [`barV`;`truncate_simplex`];; +searcht 5 [`truncate_simplex 0`];; +searcht 15 [`set_of_list`;`LENGTH`];; +searcht 15 [`set_of_list`;`CONS x y`];; + +searcht 5 [`barV`;`truncate_simplex`];; +searcht 5 [`EL`;`truncate_simplex`];; +searcht 5 [`mcell1`;`cball`];; +searcht 5 [`ball`;`cball`;`SUBSET`];; +searcht 5 [`(X DIFF Y) INTER Z`;`(X INTER Y) DIFF Z`];; +Pack_defs.mcell1;; +searcht 5 [`rcone_gt`;`dot`];; +searcht 30 [`rcone_gt`];; +RCONE_GT_HYPERPLANE;; +searcht 5 [`a % b dot c`];; +searcht 5 [`a % b % c`];; +searcht 5 [`rogers`;`{a,b,c,d}`;`convex`];; +searcht 5 [`hl [a;b]`];; +searcht 15 [`truncate_simplex k`;`CONS`];; +searcht 5 [`barV`;`CONS`;`EL`];; +searcht 5 [name "LENGTH4"];; +searcht 5 [`radial`;`sol`];; +searcht 5 [` A INTER A`];; +searcht 5 [`measurable`;`ball`];; +searcht 5 [`measurable`;`mcell`];; +searcht 5 [`mcell`;`mcell1`];; +searcht 5 [`sqrt x = &0`];; +searcht 5 [`gammaX`];; +searcht 5 [`gammaX`];; +searcht 5 [`&0 <= sol a b`];; +searcht 5 [`pow`;`mm1`];; +searcht 5 [`&0 <= vol X`];; +searcht 5 [`vol X >= &0`];; +searcht 15 [`&0 <= x * y`];; +searcht 5 [`sqrt x pow n`];; +searcht 5 [`sqrt x pow 2`];; +searcht 5 [def "mxi"];; + +(* Jan 20 *) +print_proof();; +GAMMAX_MCELL2;; +Pack_defs.dihX;; +Pack_defs.dihu2;; +searcht 5 [`cell_params_d`];; +searcht 5 [`cell_params`];; +searcht 25 [`initial_sublist`];; +searcht 15 [`CONS`;`LENGTH`];; +LENGTH4;; +searcht 30 [`APPEND`];; +searcht 5 [name "AJR"];; +searcht 5 [`omega_list_n`;`permutes`];; +Marchal_cells_2_new.LEFT_ACTION_LIST_1_PROPERTIES;; +Bump.BETA_ORDERED_PAIR_THM;; +searcht 5 [`mxi V ul = mxi V vl`];; +Marchal_cells_3.MCELL_ID_MXI_2;; +searcht 15 [`omega_list_n V ul k = omega_list_n V vl k`];; +Marchal_cells_3.MCELL_ID_OMEGA_LIST_N;; +searcht 5 [`CONS x y = CONS x' y'`];; +searcht 5 [`measure X + measure Y`];; +searcht 5 [`bis_le`;`bis`];; +searc 'a' 0 [`negligible`;`dot`];; +DOT_RMUL;; +searcht 5 [`measurable`;`dist`];; +searc 'e' 1 [`measurable`;`convex`;`bounded`];; +searc 'b' 0 [`convex`;`mcell`];; +searc 'c' 0 [`bounded`;`mcell`];; +searc 'd' 0 [`convex`;`bis_le`];; +searcht 5 [`negligible`;`SUBSET`];; +searcht 5 [`a % v = vec 0`];; +searcht 5 [`mcell2`;`rcone_ge`];; +searcht 5 [`negligible {}`];; +searcht 5 [`~ ~ x`];; +searcht 5 [`frustum`];; +searcht 15 [`frustt`];; +VOLUME_FRUSTT_WEDGE;; +searcht 5 [def "^wedge"];; +RCONE_GT_HYPERPLANE;; +searcht 8 [`rcone_ge`;`dot`];; +RCONE_GE;; +searcht 5 [`dot`;`dist(a,b) <= dist(c,d)`];; +searcht 5 [`dist(x,y) = &0`];; +searcht 5 [name "Cou";`ball`];; +DIST_NZ;; +searcht 5 [`norm`;`dot`];; +searcht 15 [`x pow 2 <= y pow 2`];; +searcht 15 [`atn2`;`ups_x`];; +Sphere.arclength;; +searcht 5 [`arcV`;`dot`];; +Trigonometry1.DOT_COS;; +searcht 5 [`arclength`;`arcV`];; +Trigonometry1.arcVarc;; +searcht 5 [`cos`;`rcone_ge`];; +searcht 5 [`arcV a b c = arcV a c b`];; +searcht 5 [`arcV u u v`];; +searcht 5 [`(v:real^A) - v`];; +searcht 5 [`norm (vec 0)`];; +searcht 5 [`norm x = &0`];; +searcht 15 [`&0 <= x * y <=> &0 <= y`];; +searcht 5 [`&0 < norm x`];; +searcht 5 [`arcV a b c = arcV a' b' c'`];; +searcht 5 [`arcV v u u`];; +searcht 5 [`cos (&0)`];; +searcht 5 [`arcV`;`pi`];; +Local_lemmas1.ARCV_BOUNDS;; +searcht 5 [`cos x <= cos y`];; +searcht 5 [`atn2 (&0,y)`];; +searcht 5 [`ups_x a b c = ups_x a' b' c'`];; +searcht 5 [`atn2 (x,y) <= atn2(x',y')`];; +searcht 17 [`arcV`;`cos`];; +searcht 5 [`&0 < dist(a,b)`];; +searcht 5 [`&0 <= ups_x a b c`];; +searcht 5 [`atn2(x, -- y)`];; +searcht 5 [`atn`;`atn2`];; +searcht 15 [`atn(x / y)`];; +searcht 5 [`x / (--u)`];; +searcht 5 [`inv (--x)`];; + + +searcht 5 [`a pow 2 <= b pow 2`];; +searcht 5 [`atn x <= atn y`];; +searcht 5 [`x pow 2`;`x * x`];; +searcht 5 [`frustt`;`vol`];; +searcht 5 [`frustum`];; +type_of `dihV`;; +searcht 5 [`bis_le`;`dot`];; +searcht 5 [`SDIFF`];; +searcht 5 [`NULLSET`;`sphere`];; +searcht 5 [`circular_cone`];; +searcht 5 [`c_cone`];; +searcht 5 [`rcone_ge`;`rcone_gt`];; +searcht 5 [`SDIFF`];; +searcht 5 [`negligible {}`];; +searcht 15 [`rcone_ge`;`rcone_gt`];; +searcht 5 [`?(u,v). p`];; +searc 'k' 0 [`negligible`;`dot`];; +searcht 5 [`vol`;`rcone_ge`];; +searcht 5 [`SDIFF`;`measurable`];; +searcht 15 [`measure X = measure Y`];; +searcht 5 [`measurable`;`rcone_ge`];; +searcht 5 [`wedge`;`wedge_ge`];; +searcht 5 [`affine`;`NULLSET`];; +searcht 5 [`aff_ge s t SUBSET affine hull t'`];; +searcht 5 [`(A UNION B) SUBSET (A' UNION B')`];; +searcht 5 [`aff_ge`;`wedge_ge`];; +searcht 5 [`dihV a b c d <= pi`];; +searcht 5 [`dihV a b c d = pi`];; +searcht 5 [`coplanar`;`mxi`];; +searcht 2 [`coplanar`;`NULLSET`];; +searcht 5 [`coplanar`;`affine hull s`];; +searcht 5 [`collinear`;`coplanar`];; +SET_RULE;; +searcht 15 [`azim`;`dihV`];; +searcht 5 [`azim a b c d`;`&2 * pi`];; +searc 'l' 2 [`{a,b} = {c,d}`];; +searc 'm' 1 [`&0 < hl u`];; +searcht 5 [`sqrt2 * sqrt2`];; +searcht 1 [`SDIFF`;`vol X = vol Y`];; +searcht 5 [`measurable`;`mcell2`];; +searcht 1 [`measurable`;`frustt`;`wedge`];; +searcht 5 [`bis_le`;`dot`];; +searcht 5 [`norm`;`pow`;`dot`];; +searcht 5 [`a dot a - b dot b`];; +searcht 5 [`(a + b) dot c`];; +searcht 5 [`hl`;`dist`];; +searcht 5 [`SDIFF`;`mcell2`];; +FRUSTT_WEDGE_RCONE_GE;; +MCELL2_SPLIT;; +searcht 5 [`wedge_ge`;`aff_ge`];; +searcht 5 [`mcell2`;`rcone_ge`];; +searcht 5 [`SDIFF X Y = SDIFF Y X`];; +searcht 5 [`&0 < hl(truncate_simplex 1 ul)`];; + +searcht 5 [def "gamma2_x_div_azim"];; +searcht 5 [def "^lmfun"];; +searcht 5 [`gamma2_x_div_azim`;`lfun`;`sqrt`];; +Pack_defs.mcell2;; + + + +(* Jan 22, 2013 *) +searcht 5 [`vol X = vol Y + vol Z`;`mcell2`];; +searcht 5 [`p permutes 0..1`];; +Marchal_cells_2_new.LEFT_ACTION_LIST_1_PROPERTIES;; +searcht 5 [`permutes`;`left_action_list`;`mcell i j k = mcell i' j' k'`];; +searcht 3 [`truncate_simplex`;`permutes`];; +searcht 5 [`set_of_list`;`truncate_simplex`];; +searcht 5 [`dihV a b c d = dihV b a c d`];; +searcht 5 [`sol`;`mcell2`];; +searc 't' 0 [`eventually_radial`;`mcell`];; +searcht 5 [def"^radial"];; +searcht 5 [`radial`;`sol`];; +searcht 15 [`dist`;`hl`];; +VOLUME_FRUSTT_WEDGE;; +searcht 15 [`conic_cap`;`vol`];; + +(* Jan 23, 2013 *) +MCELL2_VX_PROPS;; +searcht 5 [`VX`;`V INTER X`];; +searcht 5 [`eventually_radial`;`sol`];; +searcht 5 [`radial_norm`;`r' <= r`];; +searcht 5 [`radial`;`radial_norm`];; +searcht 5 [`normball`;`ball`];; +Marchal_cells_2_new.RADIAL_VS_RADIAL_NORM;; +RADIAL_LE;; +searcht 5 [`sol`;`radial`];; +searcht 5 [`measurable`;`mcell`];; +Sphere.bis_le;; +Reuhady.VOLUME_CONIC_CAP_WEDGE_GE_VS_CONIC_CAP;; +searcht 5 [`vol X = vol Y`];; +searcht 5 [`measurable`;`wedge`];; +searcht 5 [`SDIFF`;`rcone_ge`];; +searcht 5 [`h / a < t`];; +searcht 5 [`SDIFF`;`X INTER Y`];; +bb 10;; +searcht 5 [`dist a < dist b`;`dot`];; +searcht 5 [`mcell2`;`bis_le`];; +searcht 5 [`wedge_ge`;`aff_ge`];; +searcht 5 [`vol`;`mcell2`];; +searcht 5 [`hl(truncate_simplex 1 ul) = hl(truncate_simplex 1 vl)`];; +searcht 5 [`dihV a b c d = dihV b a c d`];; +searcht 5 [`dihX V X`;`dihV`];; +searcht 5 [`dihV`;`dih_y`];; +searcht 5 [`gamma2_x_div_azim`];; +searcht 5 [`truncate_simplex`;`CONS`];; +searcht 2 [`lmfun`;`h0cut`];; +searcht 5 [`sqrt8`;`sqrt2`];; +searcht 5 [`sqrt(x) = &0`];; +searcht 15 [`gamma2_x_div_azim`];; +searcht 5 [name "BALL_DIFF_RCONE_GE"];; + +(* Jan 24, 2013 *) +searcht 5 [`&0 <= a`;`dih_x`];; +searcht 5 [`&0 <= dihV a b c d`];; +searcht 5 [`gamma2_x_div_azim_v2`;`ineq`];; +searcht 5 [`sqrt8`;`sqrt2`];; +searcht 5 [`mcell1`;name "TSK"];; + + + +(* Jan 25, 2013 *) +Counting_spheres.POLY_SORT_BIJ;; +Counting_spheres.WEDGE_ORDER_DISJOINT;; +Counting_spheres.PREIMAGE_BIJ;; +Counting_spheres.ORDER_AZIM_SUM2Pi;; +TOPOLOGICAL_SORT;; +searcht 25 [name "SORT"];; +searcht 5 [name "EL_EXPLICIT"];; +searcht 5 [name "aff"];; +searcht 5 [name "FCHK"];; +searcht 5 [`azim`;`aff_ge`];; +searcht 5 [`s_leaf`];; +searcht 5 [`leaf`;`collinear`];; +searcht 5 [`set_of_list (CONS x y)`];; +searcht 15 [`azim a b c d = azim a b c d'`];; +searcht 5 [`aff_gt s t = aff_gt s {y}`];; +searcht 5 [`(i + j) MOD n`];; +searcht 5 [`i MOD n = i`];; +searcht 5 [`(x MOD n) < n`];; +DIVISION;; +type_of `PRE`;; +type_of `min:num->num->bool`;; +searcht 25 [`?(x:num). P x`;`x <= (y:num)`];; +Print_types.print_thm_types UPPER_BOUND_FINITE_SET;; +searcht 50 [name "MAX";`x:num`];; +;`(x:num) IN s`];; +searcht 15 [`x:(num->bool)->num`];; +type_of`min_num`;; +searcht 15 [`min_num`];; +searcht 15 [`wedge`;`wedge_ge`;`mcell_set`];; +Leaf_cell.BDXKHTW;; +Leaf_cell.EWYBJUA;; +searcht 25 [`azim a b c d = &0`;omit `wedge`;omit `wedge_ge`;omit `aff_ge`];; +searcht 5 [`azim a b c d + azim a b c' d'`];; +searcht 5 [`wedge`;`azim`];; +searcht 5 [`azim a b c c`];; +searcht 5 [`&0 <= azim a b c d`];; +searcht 5 [`azim a b c d = &0`;`aff_ge`];; +searcht 5 [`aff_ge s t SUBSET affine hull t'`];; +searcht 5 [`negligible`;`affine hull {a,b,c}`];; +searcht 5 [`a /\ (?x. P x)`];; + + +(* Jan 26, 2013 *) +searcht 5 [`barV`;`FINITE`];; +searcht 5 [`packing`;`FINITE`];; +searcht 5 [`barV`;`ball`];; +searcht 5 [`set_of_list ul SUBSET V`;`barV`];; +Packing3.BARV_SUBSET;; +searcht 5 [`set_of_list`;`CONS`];; +searcht 5 [`hl`;`dist pr`];; +DIST_SYM;; +Qzyzmjc.BARV_3_IMP_FINITE_lemma2;; +SUBSET_UNIONS;; +IN_UNIONS;; +searcht 5 [`negligible`;`UNIONS`];; +searcht 5 [`NULLSET`;`aff_ge`];; +searcht 5 [`NULLSET`;`affine`];; +searcht 5 [`aff_ge`;`affine hull (s UNION t)`];; +searcht 5 [`aff_ge {a,b} {c}`;`collinear`];; +Local_lemmas.AZIM_EQ_0_GE_ALT2;; +searcht 5 [`wedge_ge a b c d SUBSET X`;`aff_ge`];; +searcht 5 [`collinear`;`s_leaf`];; +searcht 5 [name "OXL"];; +searcht 5 [`sum X f = &0`];; +searcht 5 [name "TSK"];; +searcht 5 [`beta_bump_v1`];; +searcht 5 [`critical_weight`;`&0 <= x`];; +searcht 5 [`0 <= CARD X`];; +searcht 5 [`;; +Leaf_cell.BDXKHTW;; +searcht 5 [`s_leaf`;`leaf`];; +searcht 5 [`collinear`;`leaf`];; +searcht 5 [`azim a b c d = &0`;`aff_ge`];; +searcht 5 [`periodic`];; +searcht 50 [`azim a b w w' = &0`];; +searcht 15 [`azim a b c d + azim a b d e`];; +searcht 5 [`&0 <= azim a b c d`];; +searcht 5 [`periodic `;`MOD`];; +searcht 5 [`((a ==> b ) /\ (b ==> a))`];; +searcht 5 [`i MOD n < n`];; +searcht 15 [`(a + b) MOD n`];; +searcht 5[`wedeg`;`wedge_ge`;`DIFF`];; +searcht 5 [`a MOD n = b MOD n`;`a < n`];; +searcht 5 [`0 MOD n`];; +DIVISION;; +searcht 15 [`a MOD n = a`];; +searcht 5 [`wedge_ge`;`azim`];; +Local_lemmas.AZIM_EQ_0_GE_ALT2;; +searcht 5 [`wedge`;`azim`];; +searcht 5 [`azim a b c d - azim a' b' c' d' = azim a'' b'' c'' d'' - azim a''' b''' c''' d'''`];; +searcht 15 [`collinear`;`aff`];; +searcht 15 [`collinear`;`affine hull s`];; +COLLINEAR_3_AFFINE_HULL;; +searcht 5 [`collinear`;`~(a = b)`];; +searcht 5 [`affine hull s SUBSET aff_ge s' t'`];; +searcht 5 [`DISJOINT`;`collinear {a,b,c}`];; +bb 3;; +searcht 5 [`azim a b c d = &0 <=> p`];; +searcht 5 [`azim a b c d = &0`;`aff_ge`];; +searcht 5 [name "REUH"];; +Oxl_def.periodic_mod;; +searcht 5 [`azim a b c c `];; +searcht 5 [`sum`;`azim`;`&2 * pi`];; +searcht 5 [name "GRUT"];; +searcht 15 [`sum X (\i. sum Y f)`];; +searcht 5 [`FINITE {i | (i:num) < n}`];; +searcht 5 [`FINITE`;`mcell_set`];; +searcht 5 [`preimage`;`BIJ`];; +searcht 5 [`a,b = a',b'`];; +MCELL_WEDGE_UNIQUE;; +searcht 5 [`edgeX`;`NULLSET`];; +Bump.RIJRIED;; +searcht 5 [`BIJ`;`sum`];; +searcht 5 [name "BETA"];; +searcht 5 [`collinear`;`~(a = b)`];; +searcht 5[`hplus`;`hminus`];; +searcht 5 [`periodic`;`leaf_rank`];; + + +(* Jan 28, 2013 *) +searcht 5 [`beta_bumpA_y`];; +Counting_spheres.ORDER_AZIM_SUM2Pi;; +searcht 5 [`sum x f = sum x f'`];; +searcht 5 [`collinear`;`leaf_rank`];; + +(* Jan 30, 2013 *) +searcht 5 [`mcell4`;`leaf`];; +searcht 5 [`mcell`;`leaf`];; +searcht 15 [`cc_cell`;`leaf`];; +searcht 5 [`hl`;`radV`];; +searcht 15 [`radV`;`eta_y`];; +searcht 5 [`dist`;`d3`];; +searcht 15 [`hl`;`dist`];; +searcht 15 [`hl a < hl b`];; +searcht 15 [`hl a <= hl b`];; +searc 'a' 0 [`radV a <= radV b`];; +searcht 5 [`affine_dependent`;`collinear`];; +searcht 5 [`radV {a,b}`];; +searcht 5 [`hl [a;b]`];; +Pack_defs.HL;; +Marchal_cells_3.HL_2;; +searcht 5 [`eta_y a b c = eta_y a b' c'`];; +searcht 5 [`&0 <= ups_x a b c`];; +searcht 5 [`x pow 2`;`x*x`];; +searcht 5 [`&0 <= eta_y a b c`];; +searcht 5 [`ups_x a b c = ups_x a c b`];; +searcht 5 [`x pow 2 <= y pow 2`];; +Sphere.BARV;; +searcht 5 [`barV`;`X SUBSET V`];; +searcht 5 [`collinear`;`leaf`];; +searcht 5 [`collinear `;`~(a = b)`];; +searcht 5 [`NULLSET`;`edgeX`];; +searcht 15 [`dihX`;`NULLSET`];; +searcht 15 [`dihX`;`dihV`];; +searcht 50 [`dihX`];; +searcht 50 [`dihu4`];; +searcht 50 [`mcell2`;`aff_ge`];; +searcht 5 [`mcell2`;`dihX`];; +searcht 5 [`&0 <= dihV a b c d`];; +searcht 5 [`dihV a b c d = &0`];; +searcht 5 [`collinear`;`mxi`];; +searcht 5 [`collinear`;`omega_list_n`];; +searcht 5 [`coplanar`;`collinear`];; +searcht 5 [`NULLSET`;`coplanar`];; +searcht 5 [`coplanar`;`affine hull s`];; +searcht 5 [`aff_ge s t SUBSET affine hull s'`];; +searcht 5 [`dihX`;`COND`];; +searcht 5 [`dihu3`];; +searcht 5 [`FST`;`cell_params_d`];; +searcht 5 [`mcell i V ul = mcell i V ul'`];; +searcht 15 [`initial_sublist`];; +searcht 5 [`barV`;`LENGTH`];; +searcht 5 [`SND`;`cell_params_d`];; +searcht 5 [`mcell3`;`convex`];; +Pack_defs.mcell3;; +searcht 15 [`initial_sublist`];; +searcht 5 [`APPEND (CONS x y)`];; +searcht 5 [`((a ==> b) /\ (b ==> a))`];; +searcht 5 [`convex hull s = convex hull y`];; +searcht 5 [`set_of_list (truncate_simplex 2 ul)`];; +searcht 5 [`affine_dependent`;`NULLSET`];; +searcht 5 [`affine_dependent`;`aff_dim`];; +searcht 5 [`CARD`;`mxi`];; +searcht 5 [`mcell 3`;`cc_cell`];; +searcht 15 [`coplanar`;`hull`];; +searcht 5 [`affine hull (convex hull s)`];; +searcht 5 [`FINITE`;`INSERT`];; +searcht 5 [`aff_dim`;`coplanar`];; +searcht 5 [`aff_dim`;`DIMINDEX`];; +searcht 5 [`coplanar (convex hull s)`];; +searcht 25 [`CARD`;`4`];; +searcht 5 [`dihV a b c d = dihV a b d c`];; +DIHV_SYM;; +MCELL2_DIHX_POS;; +searcht 5 [`mcell4`;`edgeX`];; + + +(* Jan 31, 2013 *) +searcht 5 [`barV`;`mcell4`;`leaf`];; +Leaf_cell.RBUTTCS;; +searcht 5 [`mcell4`;`convex`];; +searcht 5 [`barV V`;`truncate_simplex`];; +searcht 5 [`truncate_simplex 2`];; +searcht 5 [`hl s <= hl t`];; +searcht 15 [`permutes`;`left_action_list`;`?`];; +Marchal_cells_3.LEFT_ACTION_LIST_3_EXISTS;; +searcht 5 [`CARD`;`mcell4`];; +Collect_geom2.NOT_COPLANAR_IMP_CARD4;; +Bump.LENGTH4;; +searcht 15 [`set_of_list`;`LENGTH`];; +searcht 5 [`barV`;`LENGTH`];; +searcht 5 [`mcell i V ul = mcell i' V ul'`];; +Rvfxzbu.RVFXZBU;; +searcht 5 [`barV`;`left_action_list`];; +searcht 15 [`CARD`;`2`];; +Hypermap.CARD_TWO_ELEMENTS;; +searcht 5 [`CARD x <= CARD y`;`SUBSET`];; +searcht 5 [`CARD`;`4`;`~(x = y)`];; +Marchal_cells_2_new.CARD4_IMP_DISTINCT;; +searcht 5 [`a = b ==> b = a`];; +searcht 5 [`FINITE`;`s_leaf`];; +searcht 3 [`edgeX`;`cc_cell`];; +searcht 5 [`cc_cell`;`cc_ke`];; +searcht 5 [`mcell4`;`edgeX`];; +searcht 5 [`u IN p hull s`];; +searcht 5 [`u IN aff_gt s t`];; +searcht 10 [`mcell i V ul = mcell i' V ul'`];; +searcht 5 [`barV`;`cc_uh`];; +searcht 5 [`cc_ke`;`4`];; +searcht 5 [`leaf V a ==> leaf V b`];; +Leaf_cell.cc_uh;; +searcht 5 [`wedge_ge`;`wedge`;`aff_ge`];; +searcht 5 [`collinear`;`leaf_rank`];; +Print_types.print_goal_types();; +searcht 50 [`leaf_rank`;`periodic`];; +searcht 5 [`j MOD n < n`];; +searcht 5 [`periodic`;`MOD`];; +searcht 5 [`wedge`;`azim`];; +searcht 5 [`azim a b c c `];; +searcht 5 [name "SHIFT";`azim a b c d - azim a' b' c' d'`];; +searcht 8 [`azim a b c d + azim a b d e`;omit `pi`];; + +print_proof();; +(* Feb 1, 2013 *) +searcht 5 [`azim`;`wedge_ge`];; +searcht 5 [`wedge_ge`;`DIFF`];; +GSYM Leaf_cell.WEDGE_COMPLEMENT;; +searcht 5 [`azim a b c d = &0`];; +searcht 5 [`azim a b c d`;`&2 * pi`];; +searcht 5 [`mcell4`;`convex`];; +searcht 5 [`{a,b} = {c,d}`;`~(a = b)`];; +searcht 5 [`CARD`;`mcell4`];; +searcht 5 [`CARD`;`4`;`~(a = b)`];; +MCELL4_LEAF2;; +searcht 5 [`x IN convex hull s`];; +searcht 5 [`chi_msb`;`sin`];; +searcht 5 [`sin`;`azim`];; +searcht 5 [`aff_ge`;`wedge_ge`];; +searcht 5 [`convex hull s SUBSET aff_ge a b`];; +searcht 5 [`azim a b c d = pi`;`coplanar`];; +searcht 5 [`leaf_rank`;`collinear`];; +searcht 5 [`coplanar (convex hull s)`];; +searcht 5 [`coplanar`;`NULLSET`];; +searcht 5 [`azim a b c d + azim a b d c`];; +searcht 5 [`wedge_ge a b c d INTER wedge_ge a b c' d'`];; +searcht 5 [`NULLSET`;`aff_ge`];; +searcht 5 [`aff_ge s t SUBSET affine hull s'`];; +searcht 5 [`azim`;`dihV`];; +searcht 5 [`dihX`;`dihV`];; +searcht 5 [`dihX`;`mcell 4`];; +Tskajxy_lemmas.DIHX_DIH_Y_lemma;; +searcht 5 [`dihV`;`dih_y`];; +searcht 5 [`CARD`;`4`;`mcell4`];; +searcht 5 [`barV`;`left_action_list`];; +searcht 5 [`mcell j V ul = mcell i V ul'`];; +searcht 5 [`barV`;`LENGTH`];; +MCELL4_BARV_FI;; +searcht 5 [name "S_LEAF_COLLINEAR"];; +searcht 5 [`packing V /\ saturated V /\ leaf_rank V ul w0 n f + ==> ~collinear {EL 0 ul, EL 1 ul, f k}`];; +searcht 5 [`mcell`;`?`;`4`];; +searcht 5 [`edgeX V X = {}`];; +searcht 5 [`edgeX`;`NULLSET`];; +Bump.RIJRIED;; +searcht 5 [`leaf_rank`;`CARD`];; +searcht 5 [`s_leaf`;`FINITE`];; +searcht 5 [`leaf_rank`;name "INJ"];; +searcht 5 [`periodic`;`IMAGE`];; +searcht 5 [`periodic`;`MOD`];; +searcht 5 [`BIJ`;`CARD`];; +searcht 5 [`{i | i < n}`;`HAS_SIZE`];; +searcht 5 [`i<(n:num)`;`FINITE`];; +searcht 5 [`u MOD n = u`];; +GSYM MOD_LT;; +searcht 5 [`sum s f <= sum s' f`;`SUBSET`];; +searcht 5 [`mcell_set`;`FINITE`];; +searcht 5 [`mcell4`;`edgeX`];; +searcht 5 [`CARD`;`4`;`barV`];; +searcht 5 [`set_of_list`;`LENGTH`;`4`];; +searcht 5 [`&0 <= dihX V x u`];; +searcht 5 [`sum {a,b}`];; +searcht 5 [`mcell2`;`edgeX`];; +type_of `gg_mcell`;; +searcht 5 [`gg_mcell`];; +searcht 5 [`sum {X}`];; + +print_proof();; +update_database();; +(* Feb 2, 2013 *) +searcht 10 [`EL`;`cc_uh`];; +searcht 5 [`leaf`;`leaf_rank`];; +searcht 5 [`leaf`;`s_leaf`];; +searcht 15 [`s_leaf`;`leaf_rank`];; +searcht 5 [`{a,b} = {c,d}`];; +searcht 5 [`leaf V a ==> leaf V b`];; +Leaf_cell.ZASUVOR;; +MCELL_IN_WEDGE;; +searcht 5 [`s_leaf`;`HAS_SIZE`];; +searcht 5 [`mcell_set`;`cc_cell`];; +searcht 5 [`NULLSET`;`cc_cell`];; +searcht 5 [`edgeX`;`cc_cell`];; +searcht 5 [`x IN cc_cell V ul`];; +bb 3;; + S_LEAF_IN_WEDGE_GE ;; +searcht 5 [`leaf_rank`;name "INJ"];; +searcht 5 [`azim a b c c = &0`];; +searcht 5 [`periodic`;`leaf_rank`];; +searcht 5 [`MOD`;`SUC`];; +searcht 5 [`periodic`;`f (i MOD n)`];; +Oxl_def.periodic_mod;; +searcht 15 [`((i MOD n) + j) MOD n`;];; +searcht 5 [`(a*n + i) MOD n`];; +Leaf_cell.cc_cell;; +searcht 5 [`cc_cell V a = cc_cell V b`];; +searcht 5 [`stem [a;b;c]`];; +searcht 5 [`stem`;`{a,b}`];; + +print_proof();; +update_database();; +(* Feb 3, 2013 *) +Leaf_cell.ZASUVOR;; +Leaf_cell.STEM_OF_LEAF;; +searcht 50 [`hl`;`sqrt`;`barV`];; +(* want barV as a conclusion if hl < sqrt2 *) +Marchal_cells_3.HL_LE_SQRT2_IMP_BARV_1;; +Leaf_cell.leaf;; +MCELL4_FULL_WEDGE;; +searcht 5 [`mcell4`;name "FIRST"];; +searcht 5 [`cc_uh`;`barV`];; +searcht 2 [`cc_cell`;`edgeX`];; +searcht 2 [`NULLSET`;`cc_cell`];; +EQ_SYM_EQ;; +searcht 5 [`mcell_set`;`cc_cell`];; +searcht 5 [`stem ul = {a,b}`];; +searcht 5 [`cc_cell`;`convex hull s`];; +searcht 8 [`mcell i V ul = mcell j V ul'`];; +searcht 5 [`barV`;`cc_uh`];; +searcht 5 [`cc_ke`;`3`;`4`];; +INTER_IDEMPOT;; +searcht 5 [`NULLSET`;`affine hull s`];; +searcht 5 [`convex hull s SUBSET convex hull t`];; +searcht 5 [`convex hull (affine hull s)`];; +searcht 5 [`convex hull s = s`];; +searcht 5 [`affine s ==> convex s`];; +searcht 5 [`s SUBSET P hull t`];; +searcht 5 [`set_of_list`;`LENGTH`;`4`];; +searcht 5 [`barV`;`cc_uh`];; +searcht 5 [`&0 < sin x`];; +searcht 15 [`azim (vec 0) b c d`];; +searcht 5 [`azim (a + x)`];; +searcht 5 [`&0 <= azim a b c d`];; +searcht 5 [`azim a b c d = &0`;`leaf_rank`];; +searcht 5 [`i MOD n = i`];; +searcht 5 [`n MOD n`];; +Oxl_def.periodic_mod;; +searcht 5 [`cc_cell`;`convex hull s`];; +searcht 15 [`convex hull s = convex hull s'`];; +searcht 5 [`affine_dependent`;`aff_dim`];; +bb 5;; +searcht 5 [`affine hull (convex hull s)`];; +searcht 5 [`aff_dim`;`affine hull s`];; +searcht 5 [`set_of_list`;`cc_uh`];; +searcht 15 [`CARD`;`4`;`{a,b}`];; +Leaf_cell.LENGTH4_SET2;; +searcht 15 [`CARD`;; +MCELL4_CARD4;; +searcht 5 [`aff_dim`;`coplanar`];; +searcht 5 [`coplanar`;`NULLSET`];; +searcht 5 [`coplanar`;`convex hull s`];; +searcht 5 [`int_of_num x = int_of_num y`];; +searcht 5 [`mcell4`;`set_of_list`];; +searcht 5 [`CARD`;`aff_dim`];; +AFF_DIM_LE_CARD;; +searcht 5 [`CARD {a,b,c,d} <= 4`];; +searcht 5 [`cc_ke`;`&0 < chi_msb V ul`];; +searcht 5 [`chi_msb a b = -- chi_msb a' b'`];; +CC_CELL_WEDGE_MATCH_UH;; +searcht 5 [`MOD`;`periodic`;`f i = f j`];; +searcht 5[`(x MOD n) MOD n`];; +searcht 5 [name "INJ";`azim`];; +searcht 5 [`azim a b c c = &0`];; +searcht 5 [`i MOD n = j MOD n`];; +searcht 5 [`~(i MOD n = j MOD n)`];; +LEAF_RANK4_CHI_MSB_ALT;; +searcht 5 [`mcell4`;`set_of_list`];; +searcht 5 [`set_of_list ul = {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul}`];; +searcht 5[`barV`;`LENGTH x = k + 1`];; +searcht 15 [`left_action_list`;`barV`];; +searcht 15 [`cc_cell V a = cc_cell V b`];; +LEAF_RANK4_CHI_MSB_ALT;; +searcht 5 [`CARD`;`4`;`cc_uh`];; +searcht 5 [`barV`;`cc_uh`];; +searcht 5 [`NULLSET`;`cc_cell`];; + CC_CELL_WEDGE_MATCH_UH_ALT;; +LEAF_RANK_AZIM_INJ;; +Oxl_2012.MOD_INJ1;; +searcht 5 [name "WEDGE_UNIQUE"];; +searcht 5 [`i MOD n MOD n`];; +searcht 8 [`(a + b) MOD n`];; +searcht 5 [`i MOD n = i`];; + +print_proof();; +update_database();; +(* Feb 5, 2013 *) + WEDGE_UNIQUE_CC_CELL;; +searcht 5 [`cc_ke`;`3`;`4`];; +searcht 5 [`barV`;`cc_uh`];; +searcht 1 [`edgeX`;`cc_cell`];; +Leaf_cell.cc_cell;; +searcht 5 [`SUC i + n - 1`;`MOD`];; +searcht 5 [`cc_cell V a = cc_cell V b`];; +searcht 5 [`e IN critical_edgeX V X`];; +searcht 5[`sum {}`];; +searcht 5 [`mcell4`;name "FIRST"];; +searcht 5 [`NULLSET`;`edgeX`];; +searcht 5 [`sum`;`edgeX`];; +searcht 2 [`cc_cell`;`edgeX`];; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +(* Feb 6, 2013 *) +cc_prep_model_data;; +searcht 5 [`leaf_rank`;`cc_ke`];; +searcht 5 [`leaf_rank`;`s_leaf`];; +S_LEAF_SYM;; +searcht 5 [`barV`;`cc_uh`];; +searcht 5 [`gammaX`;`&0 <= x`];; +Tskajxy.GAMMAX_GAMMA2_X;; +searcht 5 [`gammaX`;`x >= &0`];; +Tskajxy.TSKAJXY_1;; +Tskajxy.TSKAJXY_2;; +searcht 5 [`mcell`;`edgeX V X = {}`];; +Bump.EDGE_IMP_K2;; +searcht 5 [`&0 <= sum X f`];; +searcht 5 [`FINITE`;`mcell_set`];; +searcht 5 [`mcell_set`;`4`];; +searcht 5 [`NULLSET`;`edgeX`];; +searcht 5 [`critical_edgeX`;`hl`];; +searcht 5 [`gammaX`;name "034"];; +searcht 5 [`gammaX`;`mcell 3`];; +searcht 15 [`gamma3f`];; +searcht 5 [`eta_y`;`radV`];; +searcht 5 [`eta_y a b c = eta_y a' b' c'`];; +searcht 5 [`radV`;`hl`];; +bb 3;; +searcht 5 [`truncate_simplex 2 ul`];; +searcht 5 [`collinear`;`ups_x`];; +searcht 5 [`ups_x (x pow 2)`;`a * b * c`];; +searcht 5 [`hl x <= hl y`];; +searc 'a' 0 [`radV x <= radV y`];; +searcht 5 [`aff_dim`;`affine_dependent`];; +searcht 5 [`collinear`;`coplanar`];; +searcht 5 [`coplanar (convex hull s)`];; +searcht 5 [`convex hull s`;`mcell3`];; +searcht 3 [`coplanar`;`NULLSET`];; +searcht 5 [`affine_dependent`;`collinear`];; +searcht 5 [`radV {x,y}`;`dist`];; +searcht 5 [`barV`;`set_of_list ul SUBSET V`];; +searcht 5 [`set_of_list ul = x INSERT y`];; +searcht 5 [`collinear`;`~(x = y)`];; +searcht 5 [`initial_sublist`;`CONS`];; +searcht 15 [`truncate_simplex 2 ul`];; +Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_2;; +Print_types.print_thm_types Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_2;; +searcht 5 [`CONS`;`[]`];; +searcht 5 [`x = []`;`x = CONS u v`];; +help_grep "CASE";; +help "STRUCT_CASES_TAC";; +searcht 5 [`initial_sublist []`];; +searcht 5 [`initial_sublist`;`APPEND`];; +searcht 5 [`aff_dim x = &0`];; +searcht 5 [def "circum"];; +searcht 5 [`circumcenter`;`voronoi_list`];; +searcht 5 [name "XYOF"];; +searcht 5 [`coplanar`;`affine_dependent`];; +searcht 5 [`coplanar`;`aff_dim`];; +searcht 5 [`aff_dim`;`coplanar`];; +searcht 5 [`CARD`;`coplanar`];; +searcht 5 [`CARD {a,b,c,d}`];; +searcht 5 [`coplanar`;`coplanar_alt`];; +searcht 5 [`voronoi_list V ul`;`voronoi_set`];; +searcht 15 [`voronoi_set`];; +Sphere.VORONOI_SET;; +searcht 5 [`voronoi_set`;`circumcenter`];; +searcht 50 [`circumcenter`];; +searcht 5 [name "OAPV"];; +searcht 5 [`affine hull s `;`coplanar`;`(:real^3)`];; +searcht 5 [`coplanar`;`azim`;`pi`];; +searcht 5 [`leaf_rank`;`azim`;name "INJ"];; +searcht 5 [`SUC i MOD n`];; +searcht 5 [`barV`;`x SUBSET V`];; +searcht 5 [`truncate_simplex 2 (CONS x y)`];; +searcht 5 [`mcell4`;`edgeX`];; +searcht 5 [`vol`;`convex hull s`];; +searcht 5 [`vol`;`NULLSET`];; +searcht 5 [`collinear`;`~(a = b)`];; +searcht 5 [`mcell4`;`convex hull s`];; +searcht 5 [`wedge_ge`;`aff_ge`];; +searcht 5 [`leaf`;`collinear`];; +searcht 5 [`collinear`;`leaf_rank`];; +searcht 5 [`convex hull s`;`aff_ge`];; +MCELL3_DOMAIN;; +searcht 5 [`truncate_simplex 2 ul = ul`];; +searcht 5 [`leaf`;`collinear`];; +searcht 5 [`delta_x`;`delta_y`];; +searcht 5 [`sqrt8`;`sqrt2`];; +searcht 15 [`rad2_x`];; +searcht 5 [`dih_x a b c d e f < dih_x a' b' c' d' e' f'`];; +Tame_inequalities.DIH_X_MONO_LT_4;; +searcht 5 [`eta_x`;`rad2_x`];; +searcht 5 [`x <= f(eta_x a b c)`;];; +searcht 50 [`eta_y`;omit `ineq`];; +Merge_ineq.rad2_x_eta_x;; +Collect_geom.HVXIKHW;; +SQRT_MUL;; +searcht 5 [`sqrt x * sqrt x`];; +searcht 5 [`x pow 2 <= y pow 2`];; +searcht 5 [`max_real3`];; +searcht 5 [`x <= max_real u v`];; +searcht 5 [`ups_x`;`collinear`];; +Collect_geom.COL_EQ_UPS_0;; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +WEDGE3_Y4;; +(* Feb 7, 2013 *) +searcht 5 [`rad2_y`;`rad2_x`];; +searcht 5 [`sqrt8 * sqrt8`];; +searcht 15 [`ups_x (y * y) ( u * u) (v * v)`];; +searcht 5 [`dih_y`;` pi`];; +searcht 5 [`atn2 (x,y)`;`pi / &2`];; +searcht 5 [`atn (x) < pi/ &2`];; +searcht 5 [`atn2`;`atn`];; +searcht 5 [`&0 < atn x`];; +searcht 5 [`atn u < c`];; +ATN_BOUNDS;; +Flyspeck_constants.bounds;; +searcht 5 [`hminus`;`DECIMAL`];; +searcht 5 [`sqrt2`;`sqrt8`];; +searcht 5 [`sqrt8 < y`];; +bb 4;; +searcht 5 [`azim`;`dihV`];; +searcht 5 [`dih_y`;`dihV`];; +searcht 5 [`delta_x (x *x )`;`delta_y`];; +searcht 5 [`azim`;`delta_x`];; +searcht 35 [def "^delta"];; (* no vector version *) + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types Merge_ineq.GDRQXLGv2 ;; +WEDGE3_Y4;; +(* Feb 8, 2013 *) +searcht 5 [`coplanar_alt`;`delta`];; +Collect_geom2.POS_EQ_NOT_COPLANANR;; +searcht 5 [`coplanar`;`coplanar_alt`];; +searcht 5 [`delta`;`delta_x`];; +searcht 5 [`delta_x (x *x)`;`delta_y`];; +searcht 5 [`azim a b c c `];; +searcht 5 [`barV`;`set_of_list ul SUBSET V`];; +searcht 5 [`azim`;`dihV`];; +searcht 5 [`dihV`;`dih_y`];; +searcht 5 [`rad2_x`;`radV`];; +Merge_ineq.GDRQXLGv2;; +searcht 5 [name "GDRQ"];; +searcht 5 [`coplanar`;`CARD`];; + type_of `coplanar`;; +searcht 5 [`CARD {a,b,c,d}`];; +searcht 5 [`rad2_y`;`rad2_x`];; +searcht 5 [`&0 <= radV s`];; +Rogers.AFFINE_HULL_RADV;; +RAD_PI_IMP_WEDGE4;; +searcht 5 [`sqrt2 * sqrt2`];; +searcht 5 [`x * x <= y * y`];; +searcht 15 [`abs x = x`];; +searcht 5 [`gg_mcell`];; +searcht 5 [`azim_mcell`];; +searcht 5 [`cell_cluster_estimate_v1`;`edgeX`];; +searcht 5 [`?`;`~collinear {a,b,c}`];; +searcht 5 [`edgeX`;`~(u = v)`];; +searcht 5 [`{a,b} = {c,d}`];; +searcht 5 [`~a ==> ~b`];; +searcht 5 [`FINITE`;`s_leaf`];; +searcht 5 [`gg_mcell`;`gammaX`];; +searcht 5 [`leaf_rank`;`periodic`];; +searcht 5 [`sum`;`azim_mcell`];; +searcht 5 [`hplus`;`sqrt2`];; +searcht 5 [`azim_mcell`;`azim`];; +searcht 5 [`bool_model_data_v10`;`cc_data_v4`];; +searcht 5 [`hl [a;b]`];; +cc_bool_model_data;; +searcht 5 [`cc_data_v4`;`leaf_rank`];; +searcht 5 [`cc_card_v10`;`cc_data_v4`];; +searcht 5 [`cc_hassmall_v10`;`cc_data_v4`];; +Oxl_def.cc_qx_v10;; + type_of `(\x. azim_mcell V x u0 u1)`;; +searcht 5 [`0..r`;`{i | i < j}`];; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types Merge_ineq.GDRQXLGv2 ;; +(* Feb 9, 2013 *) +searcht 5 [`gamma4fgcy`;`gammaX`];; (* gamma4fgcy <=> gammaX *) +Tskajxy_lemmas.gammaX_gamm4fgcy;; +Merge_ineq.DIHV_DIH_X;; (* dihV <=> dih_x *) +Merge_ineq.UPS_X_POS;; +cell3_008_from_ineq;; +Merge_ineq.ox3q1h_merge;; +searcht 5 [`gg_mcell`;`gammaX`];; +searcht 25 [`beta_bump_v1`];; +searcht 5 [`beta_bump_force_y`];; +Sphere.beta_bump_force_y;; +Sphere.beta_bump_y;; +searcht 5 [`cc_cell`;`wedge_ge`];; +searcht 5 [`cc_ke`;`3`;`4`];; +searcht 5 [`j < (n:num)`;`f (i:num) = f j`;`f (SUC i) = f (SUC j)`];; +Bump.RIJRIED;; +searcht 5 [`mcell_set`;`cc_cell`];; +searcht 5 [`edgeX`;`cc_cell`];; +searcht 15 [`mcell i V ul = mcell j V ul'`];; +searcht 5 [`barV`;`cc_uh`];; +searcht 5 [`mcell`;`cc_uh`;`cc_cell`];; +Bump.RIJRIED;; +searcht 8 [`EL`;`cc_uh`];; +searcht 5 [`NULLSET`;`cc_cell`];; +DIV_LE;; +searcht 5 [`truncate_simplex (SUC n) (CONS x y)`];; +searcht 5 [`set_of_list`;`CONS`];; +searcht 5 [`truncate_simplex 0`];; +searcht 5 [`inv (&0)`];; +searcht 5 [`&0 <= x pow 2`];; +searcht 5 [`truncate_simplex 0`];; +searcht 15 [`truncate_simplex`;`initial_sublist`];; +searcht 15 [`initial_sublist (CONS x y) (CONS x' y')`];; +searcht 5 [`LENGTH (CONS x y)`];; +searcht 5 [`initial_sublist []`];; +searcht 5 [`LENGTH (truncate_simplex k ul)`];; +searcht 5 [`initial_sublist(truncate_simplex k z) y`];; + +searcht 5 [`leaf`;`barV`];; +searcht 5 [`x ==> (?u. p u)`];; +searcht 5 [`(?x. P x) ==> q`;`!`];; +searcht 5 [`P u ==> (?x. P x)`];; +searcht 5 [`(?x. P x) ==> (?x. Q x)`];; +searcht 25 [`p ==> (?x. Q x)`];; +searcht 5 [`x <= (x:num)`];; +searcht 5 [`DROP`];; +searcht 5 [`truncate_simplex`];; +searcht 50 [`APPEND`];; +searcht 50 [`BUTLAST`];; +searcht 5 [`initial_sublist a b /\ initial_sublist b c`];; +searcht 5 [`1 <= LENGTH v`;`CONS`];; +searcht 5 [`initial_sublist`;`BUTLAST`];; +searcht 15 [`initial_sublist`];; +searcht 5 [`APPEND a b = APPEND a' b'`];; +searcht 5 [`initial_sublist x []`];; +searcht 5 [`APPEND x y = []`];; +searcht 5 [`LENGTH x = 0`];; +searcht 5 [`?x y. u = CONS x y`];; +searcht 5 [`CONS x y = []`];; +searcht 5 [`SUC x = SUC y`];; +searcht 5 [`initial_sublist`;`LENGTH`];; +searcht 5 [`APPEND`;`LENGTH`];; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types Merge_ineq.GDRQXLGv2 ;; +(* Feb 11, 2013 *) +searcht 5 [`CONS x (CONS y z)`;`LENGTH`];; +searcht 5 [name "LENGTH_CONS"];; +LENGTH0;; +searcht 5 [`beta_bump_v1`;`sum`];; +searcht 5 [`beta_bump_force_y`];; +searcht 15 [`cc_4`];; +searcht 5 [`leaf_rank`;`leaf`];; +cc_4_cc_cell;; +Oxl_merge.MCELL4_GG;; +searcht 15 [`cc_uh`;`EL`];; +searcht 15 [`beta_bump_v1`];; +searcht 5[`mcell_set`;`cc_cell`];; +searcht 5 [`NULLSET`;`cc_cell`];; +searcht 5 [`barV`;`leaf`];; +searcht 5 [`barV V 3`;`NULLSET`];; +searcht 5 [`barV V 3`;`[u0;u1;f i;f (SUC i)]`];; +searcht 5 [`barV`;`cc_uh`];; +searcht 5 [`radV {a,b}`];; +searcht 15 [`critical_edgeX`];; +searcht 5 [`subcritical_edgeX`];; +searcht 15 [`edgeX`;`mcell4`];; +searcht 15 [`!x. (p ==> Q x)`;`(p ==> (!x. Q x)) <=> r`];; +RIGHT_FORALL_IMP_THM;; +searcht 5 [`edgeX`];; +searcht 5 [`CARD e = 2`;`INSERT`];; +searcht 5 [`edgeX`;`CARD`];; +searcht 5 [`CARD {a,b,c,d}= 4`;`mcell4`;`4`];; +searcht 5 [`CARD`;`~(a = b)`;`4`];; +searcht 5 [`{a,b} = {c,d}`];; +searcht 5 [`gammaX`;`gamma4fgcy`];; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types Merge_ineq.GDRQXLGv2 ;; +(* Feb 12, 2013 *) +searcht 15 [`critical_weight`];; +searcht 5 [`wtcount6_y`;`critical_weight`];; +searcht 5 [`inv x = inv y`];; +searcht 5 [`&x = &y`];; +searcht 5 [`critical_edgeX`;`FINITE`];; +searcht 5 [`CARD( x INSERT y)`];; +searcht 5 [`CARD (Z INTER ((x INSERT y)))`];; +CARD_CLAUSES;; +searcht 5 [`(x INSERT y) INTER Z`];; +searcht 5 [`FINITE (A INTER B)`];; + MCELL4_EDGE_EXPLICIT;; +searcht 5 [`{} INTER X`];; +searcht 5 [`wtcount3_y`];; +Pack_defs.critical_edgeX;; +searcht 5 [`critical_edgeX`;`critical_edge_y`];; +searcht 5 [`hl [a;b]`];; +searcht 5[`{} INTER x`];; +searcht 5 [`azim_mcell`;`azim`];; +searcht 5 [`azim a b c d < pi`;`mcell4`];; +searcht 15 [`azim`;`dihV`];; +searcht 5 [`leaf`;`collinear`];; +searcht 5 [`dihV`;`dih_y`];; +EDGE_LE_2RAD;; +searcht 5 [`radV`;`rad2_x`];; + Collect_geom2.NOT_COPLANAR_IMP_CARD4;; +searcht 5 [`coplanar (convex hull s)`];; +searcht 5 [`mcell4`;`convex hull s`];; +searcht 5 [`delta_y`;`coplanar`];; +searcht 5 [`&0 < ups_x (dist(x,y) pow 2) b c`];; +searcht 5 [`collinear`;`coplanar`];; +searcht 5 [`barV`;`set_of_list ul SUBSET V`];; +searcht 5 [`rad2_x a b c d e f = rad2_f a' b' c' d' e' f'`];; +searcht 5 [`&0 <= radV s`];; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types Collect_geom2.NOT_COPLANAR_IMP_CARD4;; +(* Feb 13, 2013 *) +searcht 5 [`x <= radV s`];; +searcht 5 [`affine_dependent`;`coplanar`];; +searcht 5 [`CARD`;`coplanar`];; +searcht 8 [`CARD {a,b,c,d}`;`4`];; +searcht 5 [`radV {a,b}`];; +searcht 15 [`d pow 2 <= r pow 2`];; +searcht 5 [`rad2_x`;`radV`];; +searcht 5 [`{a,b} SUBSET {a',b',c,d}`];; +searcht 5 [`CARD`;`~(a=b)`;`4`];; +searcht 5 [`sqrt2 * sqrt2`];; +searcht 5 [`x pow 2 <= r pow 2`];; +searcht 5 [`&0 <= dist (x,y)`];; +searcht 5 [`sqrt8 = &2 * x`];; +searcht 5 [`cc_eps`];; +searcht 5 [`gg_mcell`];; +searcht 5 [`gammaX`;`gamma4fgcy`];; +searcht 5 [`cc_4`;`beta_bump_v1 V e x = &0`];; +searcht 5 [`hminus`;`sqrt8`];; +searcht 5 [`radV`;`eta_y`];; +searcht 5 [`d3`;`&0 <= eta_y a b c`];; +searcht 5 [`dist`;`d3`];; +searcht 5 [`collinear`;`leaf`];; +searcht 5 [`gamma4fgcy a b c d e f r = gamma4fgcy a' b' c' d' e' f' r`];; +searcht 5 [`rad2_y a b c d e f = rad2_y a' b' c' d' e' f'`];; +searcht 5 [`azim_mcell`;`azim`];; +WEDGE3_Y4;; +searcht 5 [`azim_mcell`;`azim`];; +searcht 5 [`leaf_rank`;`leaf`];; +searcht 5 [`leaf V ul = leaf V ul'`];; +searcht 5 [`s_leaf V ul = s_leaf V ul'`];; +searcht 5 [`s_leaf`;`leaf`];; +searcht 5 [`leaf_rank`;`s_leaf`];; +LEAF_RANK_TRUNCATE;; +searcht 5 [`leaf`;`s_leaf`];; +searcht 5 [`NULLSET`;`cc_cell`];; +searcht 5 [`collinear`;`leaf`];; +searcht 5 [`eta_y a b c = eta_y a' b' c'`];; +searcht 5 [`azim_mcell`;`sum`;`pi`];; +searcht 5 [`hl [u;v]`];; +searcht 5 [`hplus`;`sqrt2`];; +searcht 3 [`sum`;`periodic`];; +searcht 3 [`beta_bump_v1`;`bump`];; +searcht 5 [`periodic`;`gg_mcell`];; +searcht 15 [`sum (a..b)`;`SUC`];; +SUM_CLAUSES_NUMSEG;; +searcht 5 [`sum (a..a)`];; +searcht 5 [`periodic`;`f i = f j`];; +searcht 5 [`azim_mcell`;`sum`;`pi`];; +searcht 5 [`cc_4`;`azim_mcell`;`dih_y`];; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types Collect_geom2.NOT_COPLANAR_IMP_CARD4;; +(* Feb 14, 2013 *) +searcht 5 [`gammaX`;`gamma3f`];; +searcht 5 [`mxi`;`sqrt2`];; +searcht 5 [`barV`;`cc_uh`];; +searcht 5 [`cc_uh`;`EL`];; +searcht 5 [`gamma3f a b c r f =gamma3f a' b' c' r f`];; +searcht 5 [`dih_y a b c d e f = dih_y a' b' c' d' e' f'`];; +searcht 5 [`dihX V X (u0,u1) = dihX V X (u0',u1')`];; +searcht 5 [`mcell_set`;`cc_cell`];; +searcht 5 [`edgeX`;`cc_cell`];; +searcht 5 [`gg_mcell`;`gamma4fgcy`];; +searcht 5 [`gamma4fgcy a b c d e f r = gamma4fgcy a c b d f e r`];; +searcht 5 [`gamma4fgcy a b c d e f r = gamma4fgcy a' b' c' d' e' f' r`];; +searcht 5 [`rad2_y a b c d e f = rad2_y a' b' c' d' e' f'`];; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types Collect_geom2.NOT_COPLANAR_IMP_CARD4;; +(* Feb 15, 2013 *) +searcht 5 [def "beta_bumpA_y"];; +searcht 5 [`beta_bumpA_y`];; +searcht 5 [`cc_4`;`azim_mcell`];; +Merge_ineq.gamma_qx;; +Merge_ineq.gamma10_gamma11;; +searcht 5 [`hminus`;`DECIMAL`];; +searcht 5 [`hplus`;`sqrt`];; +searcht 5 [`wtcount6_y a b c d e f = wtcount6_y a' b' c' d' e' f'`];; +Merge_ineq.cell3_from_ineq_thm;; +searcht 3 [`radV`;`eta_y`];; +searcht 5 [`collinear`;`leaf`];; +searcht 7 [`x pow 2 < y pow 2`];; +searcht 5 [`&0 <= sqrt2`];; +searcht 5 [`&0 <= eta_y a b c`];; +searcht 5 [`sqrt2 * sqrt2`];; +searcht 5 [` gamma4fgcy a b c d e f r > &0`;omit `ineq`];; +searcht 5 [`beta_bumpA_y a b c d e f = &0`];; +searcht 5 [`norm2hh`;omit `ineq`];; +searcht 15 [`hminus`;`sqrt8`;omit `ineq`];; +searcht 5 [`beta_bumpA_y`;`beta_bump_lb`];; +Merge_ineq.beta_bumpA_lb1 ;; +searcht 15 [`#0.008`];; +NO_4CELL_IMP_K3;; +searcht 5 [`sum`;`gg_mcell`];; +gg_mcell;; (*def*) +searcht 5 [`sum`;`azim_mcell`];; +searcht 5 [`sum (x INSERT y)`];; +searcht 5 [`sum `;`DISJOINT`];; +searcht 5 [`cc_cell`;`edgeX`];; +searcht 5 [`mcell_set`;`cc_cell`];; +searcht 5 [`FINITE`;`mcell_set`;`edgeX`];; +searcht 5 [`sum{a,b}`];; +Merge_ineq.cell3_008_from_ineq_ALT;; +searcht 15 [`mcell3`;`gammaX`];; +searcht 15 [`edgeX`;`mcell`];; +searcht 5 [`mcell_set`;`mcell`];; +searcht 5 [`mcell`;name "FIRST"];; +Bump.LENGTH4;; +Pack_defs.critical_weight;; +searcht 5 [`critical_edgeX`;`edgeX`];; +searcht 5 [`CARD x = 1`];; +searcht 5 [`SING`];; +searcht 8 [`edgeX`;`?`];; +searcht 5 [`edgeX`;`mcell3`];; +searcht 5 [`edgeX`;`mcell4`;`{a,b,c,d}`];; +searcht 5 [`mcell3`;`CARD`];; +searcht 5 [`truncate_simplex 2 [a;b;c;d]`];; +searcht 5 [`cc_uh V ul = CONS x y`];; +searcht 5 [`{a,b}= {c,d} ==> dist u = dist v`];; +searcht 5[`leaf`;`barV`;`cc_uh`];; +searcht 5 [`beta_bump_v1`;`mcell`];; +Bump.MCELL_BUMP_0;; +searcht 5 [`sum A f <= sum A g`];; +searcht 5 [`edgeX`;`NULLSET`];; +searcht 5 [`mcell2`;`#0.008`];; +searcht 50 [`gamma2_x_div_azim_v2`];; +Tskajxy.GAMMAX_GAMMA2_X;; +searcht 5 [`dihX`;`mcell2`];; +Tskajxy.MCELL2_DIHX;; +searcht 5 [`mcell2`;name "FIRST"];; +searcht 5 [`a * x < b * x`];; +searcht 5 [`gamma2_x_div_azim_v2`;`gamma2_x_div_a_v2`];; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types Collect_geom2.NOT_COPLANAR_IMP_CARD4;; +(* Feb 17, 2013 *) +searcht 5 [`hminus`;`<`];; + Tskajxy.GAMMAX_GAMMA2_X;; +searcht 5 [`dihV`;`dih_y`];; +searcht 5 [`collinear`;`mxi`];; +searcht 5 [`coplanar`;`mcell2`];; +searcht 5 [`coplanar`;`collinear`];; +critical_weight_wtcount6_y;; +searcht 5 [`inv(x) = y`];; +searcht 5 [`CARD x = 1`];; +searcht 5 [`x IN critical_edgeX V X`];; +searcht 5 [`edgeX`;`mcell2`];; +searcht 5 [`gammaX`;`gamma3f`];; +searcht 5 [`critical_weight`;`cc_cell`];; +critical_weight_wtcount6_y;; +critical_edgeX_critical_edge_y;; +searcht 5 [`critical_edgeX`;`edgeX`];; +searcht 5 [`CARD ((x INSERT y) INTER b)`];; +searcht 5 [`FINITE`;`critical_edgeX`];; +searcht 5 [`{} INTER B`];; +searcht 5 [`critical_edgeX`;`edgeX`];; +searcht 5 [`CARD`;`4`;`mcell3`];; +searcht 5 [`CARD s = 4`;`~(a = b)`];; +searcht 5 [`gamma3f a b c r f = gamma3f a' b' c' r f`];; +searcht 5 [`eta_y a b c = eta_y a' b' c'`];; +searcht 5 [`&0 <= sum s f`];; +searcht 5 [`&0 <= dihX V x e`];; +searcht 5 [`critical_weight`;`cc_cell`];; +searcht 5 [`&0 <= critical_weight V X`];; +searcht 15 [`&0`;`gammaX V X f`];; +searcht 15 [`beta_bump_v1`;`cc_cell`];; +searcht 5 [`sum s f = sum s g`];; +searcht 5 [`beta_bump_v1 V e X = &0`];; +searcht 5 [`a * sum s f`];; +real_model_008;; +searcht 5 [`mcell3`;name "FIRST"];; +Bump.MCELL_BUMP_0;; +searcht 5 [`cc_cell`;`edgeX`];; +searcht 5 [`dihX V X e = dihX V X e'`];; +searcht 5 [`mcell_set`;`cc_cell`];; +searcht 5 [`azim_mcell`;`azim`];; +Sphere.b_spine5;; +searcht 5 [`gamma23_keep135_x`;name "Merge_ineq"];; +TSKAJXY_3;; +searcht 5 [`gammaX`;`gamma3f`];; +searcht 5 [`gamma23_keep135_x`;`gamma3f`];; +searcht 5 [`gamma23_keep135_x`;omit `ineq`];; +searcht 5 [`gamma3_x`;`gamma3f`];; +Merge_ineq.gamma3_x_gamma3f;; +searcht 5 [`dih_y`;`dih_x`];; +searcht 5 [`hl`;`eta_y`];; +Collect_geom.POW2_COND_LT;; +searcht 5 [`&0 <= eta_y a b c`];; +searcht 5 [`sqrt2 * sqrt2`];; +bb 4;; +Nonlinear_lemma.dih_y_sym;; +searcht 5 [`dihX`;`cc_cell`;`dih_y`];; +mcell3_dihX_dih_y;; +searcht 5 [`gamma23_full8_x`;`gamma3f`];; +searcht 15 [`delta_x4`;`dih_x`];; +searcht 5 [`&0 < atn2 (x,y)`];; +searcht 5 [`&0 < atn x`];; +searcht 8 [`&0 < x / y`];; +searcht 5 [`hminus`;`DECIMAL`];; +searcht 5[`abs (atn x)`];; +searcht 5 [`tan(atn x)`];; +searcht 5 [`sqrt s pow 2 = s`];; +searcht 6 [`x pow 2 < y pow 2`];; +searcht 5 [`x pow 2`;`eta_y`];; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types Collect_geom2.NOT_COPLANAR_IMP_CARD4;; +(* Feb 18, 2013 *) +critical_weight1;; +searcht 5 [`azim a b c d`;`dih_y`];; +searcht 10 [`azim`;`dihV`];; +searcht 5 [`dih_y`;`dihV`];; +searcht 5 [`&2 <= dist(f i,f (SUC i))`];; +searcht 5 [`radV`;`azim a b c d < pi`];; +searcht 5 [`radV`;`rad2_x`];; +searcht 15 [`coplanar`;`azim`];; +searcht 5 [`coplanar`;`f i`;`f (SUC i)`];; +searcht 15 [`azim a b c d = &0`];; +searcht 5 [`leaf`;`cc_A0`];; +searcht 3 [`aff_gt a s = aff_gt a t`];; +searcht 5 [`aff_gt`;`aff_ge {a,b} {c}`];; +searcht 5 [`collinear`;`DISJOINT`];; +searcht 5 [`aff`;`collinear`];; +searcht 5 [`dist(x,x)`];; +searcht 5 [`delta_y`;`coplanar`];; +GSYM (REWRITE_RULE[LET_DEF;LET_END_DEF] GDRQXLGv3);; +searcht 5 [`&2`;`sqrt2 * sqrt2`];; +searcht 10 [`x pow 2 <= y pow 2`];; +searcht 5 [`eta_y`;`x pow 2 <= y pow 2`];; +searcht 5 [name "TRUNCATE_SIMPLEX_EXPLICIT"];; +searcht 5 [name "Local_lemmas1"];; +searcht 5 [name "Local_lemmas"];; +searcht 5 [name "MOD_REFL"];; +MOD_REFL;; +searcht 5 [name "EJR"];; +REBIND_TAC;; +searcht 5 [`x IN {(a,b) | f a b}`];; +searcht 15 [`!(x:A#B). f x`;`!a b. g a b`];; +FORALL_PAIR_THM;; + IN_ELIM_PAIR_THM;; +searcht 5 [`(a,b) = (c,d)`];; +searcht 5 [`?v. P v /\ (p = v)`];; +searcht 50 [`fan`];; +searcht 50 [`base_point_fan`];; +searcht 15 [`FAN`;`SUBSET`];; +searcht 5 [`dart1_of_fan`;`dart_of_fan`];; + type_of `nn_of_hyp`;; +searcht 5 [`azim_cycle`;`sigma_fan`];; +searcht 5 [`azim_cycle`];; +searcht 5 [`ivs_azim_cycle`;`inverse_sigma_fan`];; +searcht 50 [`dih2k`];; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types Collect_geom2.NOT_COPLANAR_IMP_CARD4;; +(* Feb 21, 2013 *) +searcht 5 [`gamma2_x1_div_a`];; +searcht 5 [`gamma2_x1_div_a`];; +searcht 5 [`beta`];; +searcht 5 [`radius`];; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas1.ALL_TO_THE_NONPARALLEL_PART;; +(* Feb 22, 2013 *) +searcht 5 [`azim_cycle`];; +searcht 5 [`sigma_fan`];; +searcht 15 [`inverse1_sigma_fan`;`inverse_sigma_fan`];; +searcht 15 [`ivs_azim_cycle`];; +searcht 25 [`dart1_of_fan`];; +searcht 5 [name "PAIR";name "ELIM"];; +searcht 5 [`{a,b} = {b,a}`];; +searcht 5 [`ivs_azim_cycle {}`];; +searcht 5 [`wedge_ge`];; +searcht 15 [`hypermap`];; + type_of `face_set`;; +searcht 5 [`face`;`face_set`];; +searcht 5 [name "WRGC"];; + type_of `hro`;; +dest_const `hro`;; + type_of `rho`;; +searcht 5 [def "rho_node"];; + type_of `rho_node1`;; +searcht 50 [`rho_node1`;`FST`];; +searcht 5 [`rho_node1`];; +searcht 5 [name "KOMW"];; +searcht 15 [`rho_node`];; +searcht 5 [`rho_node1`;`rho_node`];; +searcht 5 [`per`];; +searcht 5 [`perimeterbound`];; +searcht 5 [`tauVEF`];; +searcht 50 [`w_node_fan`];; +searcht 50 [`wedge_in_fan_ge`];; +searcht 50 [name "LVD"];; +searcht 5 [name "RNS"];; +searcht 5 [def "fan80"];; +searcht 5 [`fan80`;`convex_local_fan`];; +searcht 5 [name "CIZM"];; +searcht 25 [def "flat"];; +searcht 5 [name "LDU"];; +searcht 5 [def "straight"];; +searcht 5 [name "HKIR"];; +searcht 5 [name "interior_angle1"];; +searcht 50 [`interior_angle1`];; +searcht 5 [name "KOM"];; +searcht 5 [name "OZQ"];; +searcht 5 [name "KCH"];; +searcht 5 [name "HKIR"];; +searcht 5 [name "EGH"];; +searcht 5 [name "deform"];; +searcht 5 [name "XRECQNS"];; +searcht 5 [`deformation`];; +searcht 5 [def "^FAN$"];; +searcht 5 [`FAN`;`fan1`];; +searcht 5 [`slicef`;`f_slice`];; +searcht 15 [def "slice"];; +searcht 5 [`slice`];; +searcht 50 [`f_slice`];; +List.length (searcht 50 [`e_slice`]);; +searcht 50 [`slicef`];; +searcht 50 [name "Wjs"];; +searcht 100 [name "Dih2k_";omit `vecmat`;omit `dimindex`];; +searcht 5 [name "COMPATIBLE_BW_TWO_LEMMAS2"];; +searcht 5 [name "EJRC"];; +searcht 5 [`sol_local_fan`];; +searcht 5 [`azim_in_fan`;`interior_angle1`];; +searcht 5 [`v_prime`];; +searcht 5 [`v_prime`];; +searcht 8 [`aff_gt {x} {y}`];; +searcht 5 [`v IN wedge a v c d`];; +searcht 5 [`collinear {a,b}`];; +searcht 7 [`v,rho_node1 FF v`];; +searcht 5 [`convex_local_fan`;`local_fan`];; +searcht 5 [`{v,v} = {v}`];; +searcht 5 [`CARD`;`EE`];; +searcht 1 [`v IN v_prime V U`];; +searcht 5 [`face HS a INTER face HS b`];; +searcht 5 [`mdtau_y_LC`];; +searcht 1 [`safesqrt`];; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas1.ALL_TO_THE_NONPARALLEL_PART;; +(* Feb 23, 2013 *) +searcht 50 [name "Arc_properties"];; +searcht 50 [name "Ckqowsa."];; +searcht 50 [`tame_13a`];; + type_of `deformation`;; + type_of `localization`;; + type_of `taum`;; +searcht 5 [def "stable"];; +searcht 5 [`lunar_deform`];; +searcht 5 [`spherical_map`];; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types SUM_CONST;; +(* Feb 24, 2013 *) +searcht 5 [`slicev`;`CARD`];; +searcht 15 [`v_prime`;`CARD`];; +Local_lemmas1.CONDS_IN_V_PRIME_NUM2;; +Local_lemmas1.CONDS_IN_V_PRIME_NUM;; +searcht 5 [`rho_node1`;`v_prime`];; +Local_lemmas1.POINTS_IN_HAFL_CIRCLE;; +searcht 5 [`ITER i (rho_node1 FF) v IN V`];; +Local_lemmas.LOCAL_FAN_ORBIT_MAP_VITER;; +searcht 5 [`ITER n f v = v`;`rho_node1`];; +Local_lemmas1.CARD_IS_LEAST_CYCLE;; +Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID;; +searcht 5 [`POWER`;`ITER`];; +searcht 5 [`ITER`;`?`;`rho_node1`;`v IN V`];; +searcht 5 [`coplanar`;`plane`];; +searcht 50 [`plane`];; +searcht 5 [`local_fan`;`CARD`;`EE`];; +searcht 5 [`aff_gt`;`wedge`];; +searcht 5 [`wedge`;`wedge_ge`];; +searcht 5 [`wedge_in_fan_gt`;`{}`];; +searcht 5 [`wedge a b c d = {}`];; +searcht 5 [`collinear`;`rho_node1`];; +searcht 5 [`collinear`;`azim_cycle`];; +searcht 5 [`collinear`;`ivs_rho_node1`];; +searcht 5 [`azim_cycle`;`ivs_rho_node1`];; +searcht 5 [`x IN wedge a b c d `];; +searcht 5 [`azim a b c c`];; +searcht 5 [`ITER (a + b)`];; +searcht 5 [`slicev`;`v_prime`];; +searcht 5 [`local_fan`;`convex_local_fan`];; +searcht 15 [`CARD`;`local_fan`];; +Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1;; +searcht 5 [`ITER 0`];; +searcht 5 [`{a,b}={b,a}`];; +searcht 5 [`(w,rho_node1 FF w) IN FF`];; +searcht 5 [`rho_node1 FF (ivs_rho_node1 FF v)`];; +REWRITE_RULE[TAUT `(a ==> b ==> c) <=> (a /\ b ==> c)`] Local_lemmas1.CONDS_IN_V_PRIME_NUM;; +searcht 5 [`A SUBSET B /\ B SUBSET A`];; +searcht 5 [`v_prime`;`ITER`];; +searcht 5 [`v_prime V f SUBSET E`];; +help_grep "GEN";; +help "X_GEN_TAC";; +searcht 5 [`ITER i (rho_node1 FF) v = ITER j (rho_node1 FF) v`];; +Local_lemmas1.LT_CARD_MONO_LOFA;; +searcht 5 [`IMAGE`;`CARD`];; +searcht 5 [`FINITE`;`{i | (i:num) < j}`];; +searcht 5[ `CARD`;`{i | (i:num) < j}`];; +searcht 5 [`{a,b,c} = {a,c,b}`];; +searcht 50 [`generic`];; +searcht 5 [`e_prime`;`SUBSET`];; +searcht 5 [`aff_ge {a} {b,c}`;`aff_gt`];; +searcht 5 [`(A UNION B) INTER C`];; +searcht 5 [`A SUBSET {}`];; +searcht 5 [`A UNION B SUBSET C`];; +searcht 5 [`aff_ge`;`aff_lt`;`collinear`];; +searcht 5 [`aff_ge {a} {b}`;`aff_lt`];; +searcht 5 [def "aff_ge"];; +searcht 5 [`aff_ge`;`affsign`];; +searcht 5 [`aff_ge {a} {b}`;`%`];; +searcht 5 [`aff_lt {a} {b}`;`%`];; +searcht 5 [`a % (vec 0)`];; +searcht 5 [`a % y = vec 0`];; +searcht 5 [`v_prime V fw SUBSET V`];; +searcht 5 [`wedge_in_fan_gt`;`wedge`];; +searcht 5 [`vec 0 + a`];; +searcht 5 [`collinear`;`%`];; +searcht 5 [`interior_angle1`;`azim_in_fan`];; +searcht 5 [`convex_local_fan`;`slicev`];; +Local_lemmas1.CONDS_IN_V_PRIME_NUM2;; +Polar_fan.LOCAL_FAN_ORBIT_MAP_EXPLICIT;; +searcht 15 [`IMAGE`;`?`];; +searcht 5 [`SURJ`;`IMAGE`];; +searcht 5 [`CARD V = 0`];; +searcht 5 [`FINITE`;`local_fan`];; +searcht 5 [`BIJ`;`CARD`];; +searcht 5 [`FINITE {i | i < (j:num)}`];; +searcht 5 [`FINITE(A UNION B)`];; +searcht 5 [`CARD`;`{x | f (x:num)}`;`(a:num) <= b`];; +searcht 5 [`CARD (A UNION B)`];; +searcht 5 [`ITER 0`];; +searcht 5 [`CARD {}`];; +searcht 5 [`CARD {a}`];; +searcht 5 [`CARD (a..b)`];; +searcht 5 [`a..b`;`(a:num) <= x`];; +searcht 15 [`local_fan`;`CARD:(real^3#real^3->bool) -> num`];; +searcht 25 [`local_fan`;`CARD:(real^3->bool) -> num`];; +Local_lemmas1.LOFA_HYP_UNION_CARD_GT2;; +searcht 15 [`ITER`;`rho_node1`];; +Local_lemmas.LOFA_IMP_LT_CARD_SET_V;; +searcht 5 [`BIJ`;`sum`];; +searcht 5 [`BIJ`;`local_fan`];; +searcht 5 [`sum V f = sum V g`];; +searcht 5 [`interior_angle1`;`azim_in_fan`];; +searcht 15 [`v,rho_node1 FF v`];; +searcht 5 [`local_fan`;`FST x IN V`];; +searcht 5[`local_fan`;`v_prime V fv,E,f`];; +Local_lemmas1.HAFL_CIRCLE_FORM_LOCAL_FAN;; +Local_lemmas1.HAFL_CIRCLE_FORM_LOCAL_FAN2;; +searcht 5[`&a + &b`];; +searcht 5 [`&a = &b`];; +X_CHOOSE_TAC;; +searcht 5 [`BIJ`;`CARD`];; +searcht 5 [`FINITE`;`local_fan`];; +bb 4;; +Local_lemmas.LOFA_IMP_CARD_FF_V_EQ;; +searcht 5 [`2 <= CARD x`];; +searcht 5 [`FINITE`;`local_fan`];; +searcht 5 [`sum V (\e. f e - c)`];; +searcht 5 [`sum V (\e. f)`;`CARD`];; +searcht 5 [`x:(A->B)->(C->D)->(A#C) -> (B#D)`];; +searcht 15 [`x:(A->B->C)->(B->A->C)`];; +searcht 10 [def "rho"];; +searcht 5 [`sol_y`;`sol0`];; +searcht 5 [`taum`;`rho_fun`];; +searcht 5 [`rhazim`];; +searcht 5 [`const1`];; +searcht 5 [`ly`;`lnfun`];; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types SUM_CONST;; +(* Feb 26, 2013 *) +searcht 5 [`tau_fun`];; +searcht 5 [`main_estimate`];; +searcht 5 [`#0.206`];; +searcht 5 [`d_tame`];; +searcht 5 [`diagonal1`];; +searcht 5 [`protracted`];; +searcht 5 [name "AZIM_SUM"];; +searcht 5 [`arcV`;`rho_node`];; +searcht 20 [`azim a b c d + azim a b d e`];; +searcht 5 [name "KCH"];; +searcht 5 [`azim a b c d = pi`];; +searcht 5 [def "power_map_points"];; +searcht 5 [`power_map_points`];; +searcht 5 [`sigma_fan`;`rho_node1`];; +searcht 5 [def "if_azims_fan"];; +searcht 23 [`azim_cycle`];; +searcht 5 [`azim_cycle`;`cyclic_set`];; +TOPOLOGICAL_SORT;; + + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types SUM_CONST;; +(* March 2, 2013 *) +searcht 5 [`(a:num) * i + b`;`MOD`];; +searcht 5 [`k - (a MOD k)`];; +searcht 5 [`MOD`;`(a:num) - b`];; +searcht 5 [`FST (SND (SND(SND x)))`];; +searcht 10 [def "^part"];; + type_of `taustar`;; +searcht 5 [`{i | F}`];; + +searcht 5 [`part0`];; + +(* March 18, 2013 *) +help "MK_CONJ";; +searcht 5 [`periodic {}`];; +searcht 50 [def "min"];; +searcht 5 [`min_num`];; + type_of `MEM`;; +searcht 5 [`sol_local`];; +searcht 5 [`circular`];; +searcht 5 [`azim_in_fan`];; + type_of `min_num`;; + type_of `max_num`;; +searcht 5 [`max_num`];; + type_of `max`;; + type_of `scs_J_v4 s`;; + +(* March 31, 2013 *) +searcht 5 [def "assoc"];; +searcht 5 [`ASSOC`];; +searcht 5 [`MAP`];; + +(* April 1, 2013 *) +help_grep "list";; +listof;; +mk_list;; +help "mk_flist";; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types SUM_CONST;; + +(* April 17, 2013 *) +searcht 15 [`taum`];; +searcht 0 [`&0 <= sol_x y1 y2 y3 y4 y5 y6`];; +searcht 0 [`sol_x`;`&0`];; +searcht 0 [`&0`;`sol_euler_x_div_sqrtdelta`];; +searcht 0 [`sol_x`;`x:real^3`];; +searcht 5 [`sol`;`dihV`];; +searcht 2 [`&0 <= sol a b`];; +Counting_spheres.SOL_NN;; +searcht 5 [`sol`;`dihV`];; +Tskajxy_lemmas.SOL_SOLID_TRIANGLE;; +searcht 5 [`dihV`;`dih_y`];; +Merge_ineq.DIHV_EQ_DIH_Y;; +searcht 5 [`dih_y`;`sol_y`];; +Sphere.sol_y;; +searcht 5 [`sol_x`;`sol_y`];; +searcht 5 [`collinear`;`ups_x`];; +searcht 5 [`ups_x a b c = ups_x a' b' c'`];; +searcht 5 [`radial`;`convex hull S`];; +MEASURABLE_RULES;; +searcht 5 [`primitive`];; +searcht 5 [`solid_triangle`];; +searcht 5 [`convex hull S`;` normball`];; +searcht 5 [name "NKEZ"];; +searcht 5 [`sol_local`];; +Nkezbfc_local.SOL_LOCAL_FAN_POS_CASE3;; +searcht 15 [`convex_local_fan`];; +searcht 5 [`local_fan`;`convex_local_fan`;`FAN`];; +searcht 5 [def "sol_eu"];; +searcht 5 [`sol_euler_x`;`delta_x`];; +searcht 15 [`eulerA_x`;omit `compose6`];; +searcht 5 [`cstab`;`DECIMAL`];; +Merge_ineq.sol_x_sol_euler_x;; +searcht 5 [`eulerA_x`;`sqrt`];; +Sphere.eulerA_x;; +searcht 5 [`sqrt(x *y) = sqrt x * sqrt y`];; +searcht 5 [`&0 < atn2 (x,y)`];; +Euler_main_theorem.EULER_TRIANGLE;; +searcht 5 [`dihV`;`coplanar`];; +DIHV_EQ_0_PI_EQ_COPLANAR;; +searcht 5 [`dih_x a b c d e f = pi`];; +searcht 15 [`azim a b c d = pi`];; +searcht 5 [`atn2`;`dih_x`];; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types SUM_CONST;; +(* April 17, 2013 *) +searcht 5 [`cstab`;`DECIMAL`];; +searcht 5 [`sol0`;`DECIMAL`];; +searcht 5 [`taum`;`rhazim`];; +searcht 5 [`&0 <= dih_x y1 y2 y3 y4 y5 y6`];; +searcht 5 [`dih_y`;`rhazim`];; +searcht 5 [`a <= rho y`];; +searcht 5 [`ly y`;`<=`];; +searcht 5 [`rho`;`lfun`];; +searcht 5 [`rho y = x`];; +searcht 5 [`const1`;`DECIMAL`];; +searcht 5 [`const1`;`sol0`];; +searcht 5 [`atn2(&0,x)`];; +searcht 5 [`delta_y y1 y2 y3 y4 y5 y6 = delta_y y'1 y'2 y'3 y'4 y'5 y'6`];; +searcht 5 [`delta_x y1 y2 y3 y4 y5 y6 = delta_x y'1 y'2 y'3 y'4 y'5 y'6`];; +searcht 5 [`delta_x4 y1 y2 y3 y4 y5 y6 = delta_x4 y'1 y'2 y'3 y'4 y'5 y'6`];; +UNDISCH;; +searcht 5 [`dih_x y1 y2 y3 y4 y5 y6`;`pi`];; +searcht 5 [`sol_y`;`sol_x`];; +searcht 5 [`ups_x (a*a) (b*b) (c*c) = u`];; +searcht 5 [`tau_residual_x`];; +searcht 15 [`taum_x`;`rhazim_x`];; +searcht 5 [`taum`;`rhazim`];; +searcht 5 [`sqrt(x * x)`];; +searcht 5 [`scs_k_v14 s = y`];; +searcht 5 [`{i | F}`];; +searcht 5 [`sum {}`];; +searcht 5 [`ball_annulus`;`h0`];; +searcht 5 [`IMAGE v S SUBSET U`];; +searcht 5 [`taum`;`rhazim`];; +searcht 5 [`rhazim`;`rho`];; +searcht 5 [`dihV`;`dih_y`];; +searcht 5 [`collinear`;`ball_annulus`];; +Dih2k_hypermap.NONPARALLEL_BALL_ANNULUS;; +searcht 5 [`norm`;`dist`;`vec 0`];; +searcht 5 [`norm(v-w)`;`dist`];; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types SUM_CONST;; +(* April 19, 2013 *) +searcht 5 [`&0`;`delta`;`dist`];; +searcht 5 [`delta`;`delta_x`];; +searcht 5 [`norm`;`dist`];; +searcht 5 [`MAP f []`];; +searcht 5 [`i MOD k = i`];; +searcht 5 [`d_tame2`];; +Sphere.tame_table_d;; +help_grep "recurs";; +help "new_recursive_definition";; +searcht 5 [`(a,b) = (c,d)`];; + type_of `ASSOCD_v18`;; +searcht 5 [`taum y1 y2 y3 y4 y5 y6 = taum y'1 y'2 y'3 y'4 y'5 y'6`];; +searcht 5 [`taum`;`rhazim`];; +searcht 5 [`&2 <= sqrt8`];; +0.103 +. 2.0 *. 0.2759;; +NONPARALLEL_BALL_ANNULUS_ALT;; +searcht 5 [`tau_star`];; +searcht 5 [`tauVEF`;`tau_fun`];; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types SUM_CONST;; +(* April 21, 2013 *) +searcht 5 [name "EJRCF"];; +searcht 2 [`tauVEF`];; +searcht 5 [`tau_fun`;`sum`];; +searcht 5 [`azim_dart`;`azim_in_fan`];; +searcht 5 [def "azim_dart"];; +searcht 5 [`azim_dart`;`azim_fan`];; +searcht 5 [`azim_in_fan`;`azim_fan`];; +searcht 5 [`azim_fan`];; +searcht 5 [`periodic {}`];; +searcht 5 [`a * k + b:num`;`MOD`];; +searcht 5 [`periodic`;`MOD`];; +searcht 5 [`i MOD k < k`];; +searcht 5 [`(a ==> b) /\ (b ==> a)`];; +searcht 15 [`(!x. (a ==> b x)) <=> (a ==> (!x. b x))`];; +[GSYM (REWRITE_RULE[Appendix.periodic2] periodic2_funlist);GSYM (REWRITE_RULE[Appendix.periodic2] periodic2_funlistA)];; +searcht 15 [`sum (A INTER B)`;`FINITE`];; +searcht 5 [`sum`;`SUBSET`;`&0`];; +searcht 5 [`sum A f = sum A g`];; +SUM_CLAUSES;; +searcht 5 [`FINITE`;`INSERT`];; +searcht 5 [`tau_fun`];; +searcht 5 [`tau_fun`;`tauVEF`];; +searcht 15 [`tauVEF`];; +searcht 5 [`&(x - y) `];; +searcht 5 [`rho_fun`;`lmfun`];; +searcht 5 [`azim_dart`;`azim_in_fan`];; +searcht 5 [`rho_fun`;`rho`];; +searcht 5 [`rho`;`lfun`];; +searcht 5 [`rho_fun`];; +searcht 5 [`rho`];; +searcht 5 [`const1`;`sol0`];; +searcht 5 [`ly`;`lmfun`];; +searcht 5 [`azim_dart`;`azim_fan`];; +searcht 0 [`azim_in_fan`;`azim_fan`];; +searcht 0 [`azim_in_fan`;`azim_dart`];; +Tame_general.ly_EQ_lmfun;; +searcht 5 [`ly`;`lfun`];; +searcht 5 [def "azim_in_fan"];; +searcht 5 [`azim_cycle`;`sigma_fan`];; +searcht 5 [`azim_cycle`;`azim_in_fan`];; +searcht 5 [`azim`;`azim_fan`];; +searcht 5 [def "EE"];; +searcht 5 [def "set_of_edge"];; +searcht 5 [`set_of_edge`;`EE`];; +searcht 5 [`FAN`;`CARD`;`2`];; +searcht 15 [def "FAN"];; +searcht 5 [`FAN`;`fan2`];; +searcht 5 [`graph`];; +searcht 5 [`HAS_SIZE`;`{x}`];; +searcht 5 [`FAN`;`local_fan`];; +searcht 5 [`local_fan`;`{x,y} IN E`];; +searcht 5 [`(i + k) MOD k`];; +searcht 5 [`(a * k + b) MOD k`];; +searcht 5 [`k MOD k`];; +searcht 5 [`0 MOD k`];; +searcht 5 [`CARD x <= CARD y`];; +searcht 5 [`CARD {i | i <= k }`];; +searcht 5 [`CARD (i..j)`];; +searcht 5 [`(i..j)`;`{i | a <= i /\ i <= j}`];; +IN_NUMSEG;; +searcht 5 [`FINITE`;`{i | i < (j:num)}`];; +Appendix.is_ear_v25;; +searcht 5 [`unadorned_v25`];; +searcht 5 [`i < j /\ j < 3`];; +searcht 15 [`sqrt8`;`cstab`];; +searcht 5 [`funlist_v25 a a0 k i i`];; +searcht 5 [`k MOD k`];; + + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types SUM_CONST;; +(* May 3, 2013 *) +searcht 5 [`{i | F}`];; +searcht 5 [`a INSERT b = {}`];; +Appendix.get_main_nonlinear "5691615370";; +searcht 5 [`IMAGE f X SUBSET Y`];; +searcht 5 [`x IN ball_annulus`];; +searcht 5 [`i MOD k = i`];; +searcht 5 [`k MOD k`];; +searcht 5 [`&0 <= delta_y a b c d e f`;`dist`];; +bb 3;; +Appendix.taustar_v25;; +Merge_ineq.REAL_FINITE_MAX_EXISTS;; +searcht 5 [name "WLOG";`P x1 x2 = P x2 x1`];; +searcht 5 [`enclosed`];; +searcht 5 [name "dart_leads_into_eq1"];; +Appendix.tau_fun;; +searcht 5 [`IMAGE`;`periodic`;`(:A)`];; +searcht 5 [`CARD (IMAGE f X)`];; +searcht 5[`FINITE`;`{i | (i:num) < j}`];; +searcht 5 [`CARD`;`{i | (i:num) < j}`];; +searcht 5 [`&(a - b)`];; +searcht 5 [`sum (IMAGE f X) g`];; +searcht 15 [`azim_in_fan`;`azim`];; +searcht 5 [`azim_cycle`];; +searcht 5 [def "EE"];; +searcht 5 [`EE`;`IN`];; +help_grep "GEN";; +searcht 5 [`x IN IMAGE f X`];; +searcht 5 [`{a,b} = {c,d}`];; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types SUM_CONST;; +(* May 4, 2013 *) +searcht 5 [`periodic`;`vv (i:num) = ww (i:num)`];; +searcht 5 [name "FORALL";name "IMP"];; +DIVISION;; +searcht 5 [`(i + j) MOD k`];; +searcht 5 [`(a * k + v) MOD k`];; +searcht 5 [`azim_cycle`;`{a,b}`];; +searcht 5 [`CARD {a,b}`];; +searcht 5 [`~(a MOD k = b MOD k)`];; +searcht 5 [`dist(x,x)`];; +searcht 5 [`i MOD k = i`];; +searcht 5 [`azim a b c d = azim a b c e + azim a b e d`];; +searcht 7 [`sum ( a INSERT b)`];; +searcht 5 [`convex_local_fan`;`azim_in_fan`];; +Local_lemmas.PRIOR_TO_LESS_THAN_PI_LEMMA;; +searcht 5 [`azim_in_fan`];; +Localization.azim_in_fan;; +searcht 5 [`rho_node1`];; +searcht 15 [`rho_node1`;name "Localization."];; +searcht 5 [`periodic`;`MOD`];; +searcht 5 [`(a + j) MOD k`];; +searcht 5 [`collinear`;`ball_annulus`];; +searcht 5 [`ball_annulus = x`];; +searcht 5 [`x pow 2 <= y pow 2 `];; +searcht 5 [`IMAGE f X SUBSET Y`];; +searcht 5 [name "EGH"];; +Local_lemmas.EGHNAVX;; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types vv_azim_le;; +(* May 5, 2013 *) +help_grep "SPEC";; +help "GEN";; +searcht 5 [`ITER 0`];; +searcht 5 [`ITER (SUC j)`];; +searcht 5 [`periodic`;`IMAGE`];; +searcht 5 [`CARD (IMAGE f X)`];; + NONPARALLEL_BALL_ANNULUS40_ALT;; +searcht 5 [def "generic"];; +searcht 5 [`generic`];; +searcht 5 [`local_fan`;`convex_local_fan`];; +Appendix.cstab;; +searcht 15 [name "Tame_lemmas";`reflection`;`dist`];; +searcht 15 [name "enclosed";name "Tame_lemmas."];; +searcht 15 [name "quadratic";name "Tame_lemmas."];; +searcht 50 [name "Tame_lemmas."];; +searcht 5 [`enclosed`];; +Collect_geom2.CAYLEYR_5POINTS;; + POW_2_SQRT ;; + +DIST_POS_LE;; +searcht 5 [`muR`];; +Mur.muR;; +searcht 5 [`cayleyR`];; +searcht 5 [`abc_of_quadratic`];; +searcht 5 [`delta`;`delta_x`];; +searcht 3 [`&0 <= delta_y a b c d e f`;`dist`];; +DELTA_Y_POS_4POINTS;; +searcht 50 [`chi_msb`];; +Tame_lemmas.delta_y_pos;; +searcht 5 [`vec 0`;`cross`];; +searcht 5 [`dot`;`cross`;`&0`];; +searcht 5 [`cross`;`ups_x`];; +searcht 5 [`&0 < norm x`];; +searcht 5 [`&0 < x pow 2`];; +searcht 5 [`&0 <= norm x`];; +searcht 5 [`&0 < x dot x`];; +searcht 5 [`chi_msb`;`coplanar`];; +searcht 15 [`chi_msb`;`cross`];; +searcht 5 [`coplanar`;`delta_y`];; +REWRITE_RULE[LET_DEF;LET_END_DEF] enclosed4_lemma;; +searcht 5 [`ups_x`;`collinear`];; +GSYM Collect_geom2.NOT_COL_EQ_UPS_X_POS;; +searcht 5 [`collinear`;`ball_annulus`];; +searcht 5 [`chi_msb`;`coplanar`];; +searcht 15 [`coplanar`;`collinear`];; +searcht 5 [`convex_local_fan`;`pi`];; +Local_lemmas.IN_V_IMP_AZIM_LESS_PI;; +searcht 5 [name "Terminal";`rho_node1`];; +searcht 5 [`wedge_ge`;`aff_ge`];; +searcht 5 [`wedge_ge`;`azim`];; +bb 3;; +vv_azim_le;; +REWRITE_RULE[LET_THM] vv_azim_le;; +searcht 15 [`vv i = vv j`;`periodic`;`MOD`];; +Local_lemmas.WEDGE_GE_EQ_AFF_GE;; +searcht 15 [`aff_ge {a,b} {c,d}`;`%`];; +searcht 5 [`DISJOINT`;`collinear`];; +searcht 5 [`DISJOINT {a,b} {c,d}`];; +searcht 5 [`chi_msb`;`%`];; +searcht 5 [`chi_msb [a;b;c] d = -- chi_msb [a;b;c'] d'`];; +searcht 5 [`azim a b c d = pi`;`aff`;`INTER`];; +searcht 5 [`conv0`;`%`];; +searcht 5 [`chi_msb u d = &0`];; +searcht 5 [`set_of_list [a;b;c]`];; +searcht 15 [`aff {u,v}`];; +searcht 5 [`affine (P hull s)`];; +searcht 5 [`S SUBSET P hull S`];; +searcht 5 [`chi_msb u (a + b)`];; +searcht 5 [`a * b <= &0`];; +searcht 15 [`a * x = a * y`];; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types vv_azim_le;; +(* May 7, 2013 *) +searcht 5 [`azim`;`dihV`];; +Local_lemmas.AZIM_LE_PI_EQ_DIHV;; + type_of `part8`;; +searcht 5 [`drop3`];; +searcht 5 [`part5`];; + type_of `h0`;; +frees (mk_flist terminal_cs);; +map frees terminal_cs;; +searcht 5 [`(a * k + b) MOD k`];; +searcht 50 [name "Zithlqn."];; +searcht 50 [name "Xwitccn.";`scs_lo_v28`];; +searcht 5 [`pi`;`convex_locaL_fan`];; +searcht 5 [name "convex_local"];; +searcht 5 [`azim`;`azim_in_fan`];; +searcht 5 [`azim_cycle {a,b}`];; +searcht 5 [`rho`;`rho_fun`];; +Local_lemmas.AZIM_LE_PI_EQ_DIHV;; +searcht 5 [`&0 <= azim a b c d`];; +searcht 5 [`collinear`;`ball_annulus`];; +searcht 5 [`IMAGE f X SUBSET B`;name "Terminal"];; +periodic_vv_inj;; +searcht 5 [`{a,b,c} = {a,c,b}`];; +UNDISCH;; +UNDISCH terminal_quad_lemma;; +vv_quad_split012;; +searcht 5 [`vv i = vv (i MOD k)`];; +periodic2_mod_reduce;; +bb 5;; +Appendix.cs_adj;; +searcht 5 [`SUC 3 = 4`];; +searcht 5 [`x IN ball_annulus`];; +searcht 5 [`taum a b c d e f = taum a' b' c' d' e' f'`];; +Merge_ineq.tau_x_tau_residual_x;; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types vv_azim_le;; +(* May 7, 2013 *) +searcht 5 [`sqrt8 * sqrt8`];; +searcht 5 [`dist`;`enclosed`];; +searcht 5 [`tauq`;`taum`];; +Appendix.get_main_nonlinear "4680581274 delta top issue";; +searcht 5 [`delta_x4 a b c d e f = delta_x4 a' b' c' d' e' f'`];; +searcht 5 [def "cayleyR"];; +searcht 10 [`cayleyR x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 = y`];; +searcht 5 [`tau3`;`taum`];; +searcht 5 [`tau3 a b c = tau3 a' b' c'`];; +searcht 5 [`dihV a b c d = dihV a b c' d'`];; +bb 5;; +searcht 5 [`INSERT`;`SUBSET`];; +I_THM;; +searcht 5 [`sqrt8`;`DECIMAL`;`pi`];; +searcht 5 [name "safe"];; +searcht 5 [`sin(azim a b c d)`];; +searcht 8 [`dihV`;`azim`];; +searcht 15 [`azim a b c d + azim a b d e`;omit `cyclic_set`];; +searcht 15 [`cyclic_set`];; + open Hales_tactic;; +searcht 5 [`sqrt(y * y)`];; +searcht 5 [`safesqrt x = sqrt x`];; +searcht 5 [`safesqrt x`];; +searcht 5 [`sqrt x * sqrt x `];; +Functional_equation.functional_edge_flat2_x;; +Functional_equation.functional_euler_3flat_x;; +Functional_equation.functional_euler_2flat_x;; +Functional_equation.functional_euler_1flat_x;; +searcht 5 [def "ups_"];; +searcht 10 [`abc_of_quadratic`];; +searcht 5 [`quadratic_root_plus`];; +Sphere.flat_term_x;; +searcht 100 [def "min"];; +searcht 8 [`min_num`];; + +State_manager.neutralize_state();; +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types vv_azim_le;; +(* May 21, 2013 *) +searcht 5 [`(x + y) * (x - y)`];; +searcht 5 [`sqrt x * sqrt x`];; +searcht 5 [`sqrt x = &0`];; +searcht 5 [`&0 <= sqrt x1`];; +searcht 5 [`&0 < sqrt x1`];; +searcht 5 [`a* b <= c * b`];; +searcht 5[ `flat_term x <= &0`];; +searcht 5 [`a <= sqrt y`];; +searcht 15 [`a <= b / c`];; +searcht 50 [`has_real_derivative`;name "MAX"];; +REAL_DERIVATIVE_ZERO_MAXMIN;; +searcht 50 [`has_real_derivative`;` f (y:real) <= f x`];; (* good stuff *) +Counting_spheres.REAL_CONVEX_ON_SECOND_SECANT;; +REAL_CONVEX_ON_SECOND_DERIVATIVE;; +REAL_CONVEX_ON_SECANT_DERIVATIVE;; +searcht 5 [`real_continuous`];; +searcht 5 [def "real_continuous"];; +searcht 5 [`real_continuous`;`real_open`];; +searcht 50 [`real_continuous`;`abs`];; + +print_proof();; +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types vv_azim_le;; +(* May 22, 2013 *) +searcht 5 [`has_real_derivative`;`delta_x`];; +strip_comb `derived_form p f f' x s`;; +Calc_derivative.derived_form_sin;; +help_grep "strip";; +strip_forall;; +GEN_LIST;; +help_grep "GEN";; +GENL;; +searcht 5 [`sqrt x = &0`];; +searcht 5 [`derived_form F`];; +Functional_equation.nonfunctional_taud_D1;; +searcht 5 [`sqrt(x * x)`];; +has_real_derivative;; +searcht 5 [`(f has_real_derivative f') net ==> (g has_real_derivative f') net`];; +snd(chop_list 50 (searcht 150 [`has_real_derivative`]));; +drop;; +Arc_properties.HAS_REAL_DERIVATIVE_LOCAL;; +searcht 5 [`atreal`;`within`;`(:real)`];; +WITHIN_UNIV;; +searcht 5 [`real_open`;`>`];; +derived_form_delta_y;; +searcht 5 [`sqrt x = &0`];; +searcht 5 [`taum`;`delta_y`];; + open Terminal;; +"2314572187";; +searcht 5 [`taud`;`taud_x`];; +Merge_ineq.tau_x_tau_residual_x;; +searcht 5 [`tau_residual_x`;`taum_x`];; +searcht 5 [`const`;`sol0`];; +searcht 5 [`has_real_derivative`;`real_continuous`];; +searcht 5 [`abs (&0)`];; +searcht 5 [`real_open`;`<`];; +searcht 5 [`real_interval`;`real_open`];; +searcht 5 [`real_interval`];; +searcht 5 [`real_interval (a,b)`];; +searcht 5 [`z IN real_interval s`];; +searcht 5 [`is_real_interval(real_interval (a,b))`];; +searcht 5 [`real_interval(a,b) = {c}`];; +searcht 5 [`(\x. -- f x)`;`has_real_derivative`];; +searcht 5 [`atreal x within s`;`real_open`];; +searcht 5 [`real_open(real_interval(a,b))`];; +searcht 5 [`(\x. c) has_real_derivative u`];; +searcht 5 [`has_real_derivative`;name "UNI"];; +REAL_DERIVATIVE_UNIQUE_ATREAL;; + +searcht 15 [`real_open`;`real_continuous_on`];; +searcht 15 [`real_closed`;`real_continuous_on`];; +searcht 15 [`real_closed`;`x <= y`];; +searcht 5 [def "compact"];; +searcht 5 [`real_compact`;`real_closed`];; +REAL_COMPACT_EQ_BOUNDED_CLOSED;; +REAL_OPEN_DIFF;; +REAL_CONTINUOUS_ATTAINS_INF;; +searcht 15 [`real_open`;`PREIMAGE`];; +searcht 50 [`open_in`;`real_continuous_on`];; +searcht 5 [`real_continuous_on`;`real_compact`];; +searcht 500 [`real_open`];; +searcht 15 [`real_continuous`;`has_real_derivative`];; +searcht 5 [`real_continuous_on`;`real_continuous`];; +searcht 5 [`atreal x within (:real)`];; +searcht 5 [`(\x. f x + g x) real_continuous z`];; +searcht 5 [`(\x. c * f x) real_continuous z`];; +searcht 15 [`(\x. g x * f x) real_continuous z`];; +searcht 5 [`(\x. c) real_continuous z`];; +searcht 5 [`(\x. (sqrt (f x))) real_continuous z`];; +searcht 5 [`sqrt`;`real_continuous`];; +searcht 5 [`(f o g) real_continuous z`];; +searcht 5 [`real_continuous`;`SUBSET`];; +searcht 5 [`real_continuous_on`;`SUBSET`];; +searcht 5 [`real_bounded (X)`;`SUBSET`];; +searcht 5 [`real_bounded (real_interval s)`];; +searcht 5 [`real_closed`;`d <= t`];; +searcht 5 [`real_open`;`d < t`];; +searcht 5 [`min`];; +searcht 5 [name "EXISTS";`?f. p ==> Q f`];; +SPEC `t:real` (ASSUME `!(x:real). &3 > &4 * x`);; +SPECL;; +strip_forall;; +help_grep "EXIST";; +help "EXISTS";; + +help_grep "comb";; +help_grep "exist";; +searcht 5 [`x / y = &0`];; +searcht 5 [`&0 <= x / y`];; +searcht 5 [`&0 < x pow n`];; +searcht 5 [name "taum_taum_x"];; + +print_proof();; + +update_database();; +Print_types.print_goal_types();; +Print_types.print_thm_types vv_azim_le;; +(* May 24, 2013 *) +searcht 15 [`mud_126_x_v1`];; +searcht 5 [`delta_x y1 y2 y3 y4 y5 y6 = delta_x a b c d e f`];; +searcht 5 [`taum y1 y2 y3 y4 y5 y6 = taum a b c d e f`];; +searcht 5 [`taud`;`taum`];; +searcht 5 [`flat_term`;`sol0`];; +searcht 5 [`flat_term2_126_x`];; +bb 3;; +searcht 15 [`abc_of_quadratic`;`edge_flat2_x`];; +searcht 50 [`abc_of_quadratic`];; +searcht 15 [`quadratic_root_plus`];; +searcht 5 [`a pow 2 < b pow 2`;`abs`];; +searcht 5 [`flat_term`;`flat_term_x`];; +searcht 5 [name "AFFSIGN_MONO_SHUFFLE"];; +searcht 5 [`taud`;`flat_term_x`];; +searcht 5 [`taud`;`taud_x`];; +UNDISCH taud_minimizer_terminal_pent_cases;; +UNDISCH OWZLKVY4;; +help_grep "REP";; +replicate;; +REPEATC;; +UNDISCH;; +searcht 5 [`taum`;`taud`];; +searcht 5 [`mud_126_x_v1`;`taud`];; + (UNDISCH2 edge2_flatD_x1_delta_lemma3);; + +UNDISCH2 delta_126_x_2h0_le_d;; +searcht 5 [`flat_term`;`taud`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types vv_azim_le;; +bb 3;; +(* May 24, 2013 *) +searcht 5 [`a <= sqrt b`];; +searcht 25 [`a <= c /\ b <= d`;`a * b <= c * d`];; +REAL_LE_MUL2;; +delta_126_135;; +searcht 5 [`&0 <= taud a b c d e f`];; +hd(Ineq.getexact "1008824382");; +hd(Ineq.getexact "8875146520");; +Ineq.getexact "1586903463";; +searcht 5 [`#0.705`];; +searcht 5 [`tau3 v0 v1 v2 + tau3 v0' v1' v2'`];; +searcht 5 [`taud`;`taum`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types vv_azim_le;; +bb 3;; +(* May 27, 2013 *) +searcht 5 [`taum`;`taud`];; +appendix_get_main_nonlinear "6877738680";; +searcht 5 [`taud_x`;`taud`];; +searcht 50 [name "WLOG"];; + +REAL_WLOG_LE;; +Merge_ineq.REAL_WLOG_SIMPLEX_3d;; +searcht 5 [`delta_234_x`];; +searcht 5 [`mud_126_x_v1`];; +searcht 10 [`flat_term2_126_x`];; +searcht 5 [`eulerA`];; +searcht 5 [`ineq`;omit `CONS`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types vv_azim_le;; +bb 3;; +(* May 28, 2013 *) +searcht 5 [`x + y = y + x`;`(a + b) + c = a + b +c `];; +3860.0/. 60.0;; +searcht 5 [`taum`;`taud`];; +searcht 15 [`v ==> (a = sqrt b)`];; +help_grep "CONJ";; +basic_rewrites();; +searcht 5 [name "BETA"];; +searcht 25 [`eulerA_x`];; +searcht 25 [def "euler"];; +searcht 15 [`sol_euler_x`];; +searcht 5 [`dihV`;`sol`];; +searcht 5 [`eulerA_x`;`euler_p`];; +searcht 5 [`sqrt(x pow 2)`];; +searcht 5 [`&0 <= dist(x,y)`];; +searcht 5 [`dist(v2,v3)`;`dot`];; +searcht 15 [`(u + v) dot w`];; +searcht 5 [`x dot y = y dot x`];; + +searcht 5 [`delta_x4`;`dihV`];; +searcht 5 [name "EULER";`euler_p`];; +searcht 5 [`dihV v0 v1 v2 v3 = &0`];; +searcht 5 [`azim v0 v1 v2 v3 = pi`];; +searcht 15 [`delta_x`;`v:real^3`];; +searcht 5 [`&0 < atn2(d,p)`];; +searcht 5[`&0 <= delta_y a b c d e f `;`dist`];; +searcht 15 [`atn2`;`atn`];; +Pent_hex.derived_form_delta_x;; +searcht 5 [`dihV`;`delta_x4`];; +searcht 5 [`atn2 (-- x, -- y)`];; +searcht 5 [`atn x < pi / &2`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types vv_azim_le;; +bb 5;; +(* May 31, 2013 *) +searcht 5 [`coplanar`;`delta_y`];; +searcht 5 [`eulerA_x a b c d e f = eulerA_x a' b' c' d' e' f'`];; +searcht 15 [`delta_x`;`pow `;`delta_x4`];; +searcht 5 [`delta_x`;`dih_x`];; +searcht 5 [`ups_x`;`dot`];; +derived_form_delta_x_wrt_x5;; +searcht 5 [`delta_x a b c d e f = delta_x a b' c' d' e' f'`];; +searcht 5 [name "Terminal";`main_nonlinear_terminal_v6`];; +searcht 5 [`sqrt(&4)`];; +searcht 5 [`sqrt(x) = &0`];; +searcht 5 [`sqrt(x pow 2)`];; +searcht 5 [`&0 < x pow 2`];; +searcht 5[`atn2 (t * x, t * y)`];; +searcht 5 [name "taustar_taum"];; + open Terminal;; +taustar_taum;; +searcht 5 [name "AZIM_DIHV_SAME_STRONG"];; +searcht 5 [name "Lunar_deform"];; +searcht 5 [name "AZIM_EQ_IMP"];; +searcht 5 [`convex_local_fan`];; +List.length Build.build_sequence;; +searcht 50 [def "_eq"];; +searcht 50 [def "continuous"];; +searcht 15 [`real_continuous`];; + +searcht 5 [def "generic"];; +searcht 5 [`generic`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types vv_azim_le;; +Print_types.print_term_types AXJRPNC_concl;; +bb 5;; +(* Jun 17, 2013 *) +searcht 5 [`lunar`];; +searcht 55 [def "BB"];; +searcht 5 [`arcV`;`dihV`];; +searcht 5 [name "XWN"];; +searcht 5 [def "d_fun3"];; +searcht 5 [def "edge2_flatD_x1"];; +searcht 5 [`edge2_flatD_x1`;`quadratic_root_plus`];; +searcht 5 [name "IV"];; +searcht 5 [`?x. f (x:real) = &0 /\ P x`];; +searcht 15 [`real_continuous_on`;`f x = a`];; +Sphere.abc_of_quadratic;; +searcht 5 [`abc_of_quadratic (\z. f z)`];; +searcht 50 [`derived_form`;`?`];; +searcht 15 [`real_continuous`;`has_real_derivative`];; +HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL;; +searcht 5 [`real_continuous_on`;`real_continuous`];; +searcht 5 [`x within (:real)`];; +REAL_IVT_INCREASING;; +searcht 5 [`edge2_flatD_x1 d x2 x3 x4 x5 x6 = x1`];; +searcht 5 [`f real_continuous x within s`;`f real_continuous atreal x`];; +searcht 5 [`delta_x`;`edge2_flatD_x1`];; +searcht 5 [`quadratic_root_plus`;name "work"];; +searcht 5 [`ups_x x1 x2 x3 = ups_x a b c`];; +searcht 5 [`delta_x a b c d e f = delta_x a b' c' d' e' f'`];; +searcht 5 [`delta_x1 a b c d e f = delta_x1 a b' c' d' e' f'`];; +searcht 5 [`delta_y a b c d e f = delta_y a b' c' d' e' f'`];; +searcht 5 [name "WLOG";name "SQ"];; +Terminal.REAL_WLOG_SQUARE_LEMMA;; +Pent_hex.delta_diff;; +searcht 5 [`&0 < ups_x (a*a) (b*b) (c*c)`];; +Merge_ineq.UPS_X_POS;; +Pent_hex.delta_diff;; +searcht 5 [`&0 <= abs(x)`];; +searcht 5 [`abs(a / b)`];; +searcht 5 [`a * x pow 2 + b * x + c`;`quadratic_root_plus`];; +searcht 5 [`&0 <= x pow 2`];; +searcht 5 [`sqrt(x pow 2 ) = abs x`];; +searcht 5 [`x * x < y * y`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types vv_azim_le;; +Print_types.print_term_types AXJRPNC_concl;; +bb 5;; +(* Jun 19, 2013 *) +searcht 5 [`x * x <= y * y`];; +searcht 5 [`x pow 2 <= y pow 2`];; +searcht 5 [`sqrt8 * sqrt8`];; +searcht 5 [`&0 <= ups_x (a*a) (b*b) (c*c)`];; +searcht 5 [`ups_x a b c = ups_x a' b' c'`];; +searcht 50 [`delta_x`;`ups_x`];; +searcht 5 [`xrr`];; +searcht 5 [`derived_form F`];; +searcht 5 [`derived_form b f f' x s = derived_form b' g g' x' s'`];; +searcht 5 [`(f has_real_derivative f' x) s /\ (f has_real_derivative g' x') s'`];; +searcht 5 [`f has_real_derivative f' x s`];; +searcht 5 [def "has_real_derivative"];; +searcht 5 [`has_real_derivative`;name "UNI"];; +searcht 5 [`(atreal x within (:real))`];; +searcht 5 [`re_eqvl`;`?`];; +searcht 50 [`(f has_real_derivative (f x)) s`];; +Vukhacky_tactics.HAS_REAL_DERIVATIVE_CHAIN2;; +searcht 5 [`real_open`;`has_real_derivative`];; +searcht 500 [`derived_form`];; +Arc_properties.HAS_REAL_DERIVATIVE_LOCAL;; +searcht 5 [`re_eqvl a b <=> re_eqvl b a`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types vv_azim_le;; +Print_types.print_term_types AXJRPNC_concl;; +bb 5;; +(* Jun 20, 2013 *) +searcht 5 [`taum`;`rhofn`];; +searcht 5 [`taum_x`];; +searcht 5 [`taum`;`rhazim`];; +searcht 5 [`dih_x a b c d e f = dih_x a' b' c' d' e' f'`];; +searcht 50 [`real_open`];; +searcht 5 [`real_open`;`<`];; +searcht 5 [`real_continuous_on`;`!`;`?`];; +Pent_hex.continuous_preimage_open;; +searcht 5 [`real_continuous`;`has_real_derivative`];; + HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL;; +searcht 5 [`real_continuous`;`real_continuous_on`];; +derived_form_xrr;; +GEN_ALL Calc_derivative.derived_form_sub;; +searcht 15[`ups_x (y1*y1) (y2*y2) (y6*y6)`];; +searcht 15 [`&0 < x * y`];; +searcht 15 [`x * y < &0`];; +searcht 5 [`arclength`;`acs`];; +searcht 5 [`sqrt x = &0`];; +searcht 5 [`(f x - f y) = f' * (x - y)`;`has_real_derivative`];; +searcht 15 [`&0 <= a * b`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types vv_azim_le;; +Print_types.print_term_types AXJRPNC_concl;; +bb 3;; +(* Jun 21, 2013 *) +searcht 5 [`xrr y2 y3 y4 < &16`];; +searcht 5 [` &0 < x pow 2`];; +searcht 5 [`real_closed`;`real_interval`];; +searcht 5 [`&0 < x/y`];; +searcht 5 [`ups_x`;`xrr`];; +searcht 5 [`&0 < x * y`;`\/`];; +searcht 5 [`real_open`;`delta_y`];; +searcht 5 [`taum`;`dih_x`];; +searcht 5 [`x / y = &0`];; +searcht 5 [`sqrt x = &0`];; +searcht 5 [`&0 <= x / y`];; +REAL_MVT_SIMPLE;; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types vv_azim_le;; +Print_types.print_term_types AXJRPNC_concl;; +bb 3;; +(* Jun 22, 2013 *) +searcht 5 [`derived_form`;`(\q. g' (f q) * f' q)`];; +searcht 5 [`&0 < x`;`delta_x`;`delta_y`;`xrr`];; +derived_form_xrr;; +searcht 5 [`real_open`;`real_interval`];; +REAL_MVT_SIMPLE;; +searcht 5 [`(atreal x within s)`;`f has_real_derivative f' atreal x`];; + +HAS_REAL_DERIVATIVE_ATREAL_WITHIN;; +searcht 5 [`(f has_real_derivative f') (atreal x) ==> (f has_real_derivative f') (atreal x within s)`];; +searcht 5 [`derived_form b (g o f)`];; +GSYM Calc_derivative.derived_form;; +derived_form_sum_dih444sub;; +searcht 5 [`real_interval(a,b) SUBSET real_interval[a,b]`];; +searcht 5 [`taum`;`dih_x`];; +searcht 5 [`rho_fun y <= c`];; +searcht 5 [def "rho"];; +searcht 5 [`rho y = x`];; +searcht 5 [`const1`;`sol0/pi`];; +searcht 5 [`&0 < const1`];; +searcht 5 [`xrr y1 y3 y5`;` &16`];; +searcht 5 [`x * x < y * y`];; +searcht 5 [`&0 < ups_x (a*a) (b*b) (c*c)`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types vv_azim_le;; +Print_types.print_term_types t';; +bb 3;; +(* Jun 22, 2013 *) +searcht 5 [`taustar_v39`;`mk_unadorned`];; +searcht 5 [`scs_k_v39`;`mk_unadorned_v39`];; +searcht 5 [`dsv_v39`;`mk_unadorned`];; +Terminal.tau_fun_azim;; +searcht 5 [`dist(x,x)`];; +searcht 5 [`i MOD k = i`];; +searcht 5 [`azim`;`tau_fun`];; +searcht 5 [name "VPW";name "PRIME"];; +searcht 5 [`SUC i MOD k`];; +searcht 15 [`(i + a) MOD k`];; +GSYM Oxl_2012.MOD_INJ1;; +searcht 5 [`ball_annulus`;`norm`];; +Fnjlbxs.in_ball_annulus;; +searcht 5 [`IMAGE`;`SUBSET`];; +searcht 5 [`dist(a,b)+dist(b,c)`];; +searcht 5[`#2.52`;`h0`];; +searcht 5 [`delta_y`;`norm`];; +REWRITE_RULE[LET_THM] Tame_lemmas.delta_y_pos;; +searcht 15 [name "JKQ"];; +searcht 15 [`is_scs_v39`;`mk_unadorned_v39`];; +searcht 50 [`mk_unadorned_v39`;`funlist_v39`];; +Terminal.is_scs_funlist;; +searcht 5 [`funlistA_v39`;`F`];; +searcht 5 [`periodic {}`];; +searcht 5 [`funlist_v39`;`cs_adj`];; +Terminal.periodic2_funlist;; +searcht 5 [`X SUBSET Y`;`CARD`];; +searcht 5 [`{i | i < (k:num)}`];; +searcht 5 [`CARD {}`];; +searcht 5 [`x MOD k = SUC x MOD k`];; +searcht 5 [`d_tame`;`#0.712`];; +searcht 5 [`sol_local`;`azim_in_fan`];; +searcht 5 [`generic`;`circular`;`lunar`];; +searcht 5 [`convex_local_fan`;`local_fan`];; +searcht 15 [`lunar`];; +searcht 15 [`sol_local`];; +searcht 15 [`interior_angle1`;`azim`];; +searcht 5 [def "interior_an"];; +searcht 5 [`interior_angle1`];; +searcht 5 [`azim`;`rho_node1`;`ivs_rho_node1`];; +searcht 5 [`rho_node1`;`i+1`];; +SUM_SUB;; +searcht 5 [`FINITE {i | i < (k:num)}`];; +searcht 5 [`sum X (\x. c)`;`CARD`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;; +Print_types.print_term_types t';; +bb 6;; +(* Jun 24, 2013 *) +Local_lemmas.CVX_LO_IMP_LO;; + Wrgcvdr_cizmrrh.CIZMRRH;; +searcht 5 [`interior_angle1`;`azim_in_fan`];; +Wrgcvdr_cizmrrh.lunar;; +searcht 5 [name "vv_rho_node1"];; +Terminal.EE_vv;; +Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;; +searcht 15 [`azim_in_fan`;`azim`];; +DIVISION;; +searcht 5 [name "SYN"];; +searcht 10 [`dihV`;`azim`];; +GSYM Polar_fan.AZIM_DIHV_SAME_STRONG;; +searcht 5 [`collinear`;`BBs_v39`];; +Appendix.BBs_v39;; +searcht 5 [`periodic`;`f (i MOD k)`];; +searcht 5 [`dih_x`;`delta_x4`];; +searcht 5 [`dih_x a b c d e f < dih_x a' b' c' d' e' f'`];; +searcht 5 [`interior_angle1`;`&0`];; +searcht 5 [`(!i j. i < k /\ j < k /\ v i = v j ==> i = j)`];; +searcht 5 [`azim_in_fan`;`interior_angle1`];; +DIVISION;; +searcht 5 [`a *(k:num) + b `;`MOD`];; +searcht 5 [`&0 < atn2(x,y)`];; +searcht 5 [`atn2(&0,x)`];; +searcht 5 [`dih_y`;`dih_x`];; +searcht 5 [`dihV`;`dih_y`];; +searcht 5 [`periodic`;`MOD`];; +searcht 5 [`dist`;`norm`];; +searcht 5 [`delta_y`;`norm`];; +searcht 5 [`i MOD k = SUC i MOD k`];; +searcht 15 [`(i + a) MOD k`;`~ x`];; +Oxl_2012.MOD_INJ1;; +searcht 5 [name "dec";name "Lp_d"];; +searcht 5 [`delta_x4 a b c d e f = delta_x4 a' b' c' d' e' f'`];; +Wrgcvdr_cizmrrh.CIZMRRH;; +searcht 5 [`scs_generic`];; +Local_lemmas.INTERIOR_ANGLE1_POS;; +GSYM INTERIOR_ANGLE1_AZIM;; +(REWRITE_RULE[LET_THM] (GSYM INTERIOR_ANGLE1_AZIM));; +scs_6T1;; +searcht 5 [`scs_basic_v39`];; +searcht 5 [`mk_unadorned_v39`;`unadorned_v39`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;; +Print_types.print_term_types t';; +bb 11;; +(* Jun 25, 2013 *) +searcht 5 [`cs_adj`;`scs_diag`];; +searcht 5 [`SUC i MOD k`];; +is_scs_6T1;; +searcht 5 [`periodic`];; +Pent_hex.terminal_pent_taum;; +searcht 5 [`eulerA_x`;`dihV`];; +searcht 5 [`azim_in_fan`;`convex_local_fan`];; +azim_in_fan_azim;; +searcht 5 [`generic`;`collinear`];; +Nkezbfc_local.PROPERTIES_GENERIC_LOCAL_FAN;; +searcht 5 [`sol`;`dihV`];; +searcht 5 [`taum`;`sol0`];; +searcht 5 [`taum`;`dih_x`];; +Sphere.taum;; +searcht 5 [`taum y1 y2 y3 y4 y5 y6 = x`];; +Sphere.rhazim;; +searcht 5 [`&0 <= sol_y y1 y2 y3 y4 y5 y6`];; +Sphere.sol_y;; +searcht 5 [`generic`;`azim`;`+`];; +DIH_IMP_EULER_A_POS;; +searcht 5 [`sol_euler_x_div_sqrtdelta`];; +searcht 5 [`&0 < sol x y`];; +searcht 5 [`taum`;`sol_y`];; +searcht 5 [`sol`;`vol`];; +searcht 5 [`convex hull x`;`measurable`];; +searcht 5 [`radial_norm`;`convex hull x`];; +searcht 5 [`&0 <= dih_y y1 y2 y3 y4 y5 y6`];; +searcht 5 [def "sol_euler_x"];; +searcht 5 [`sol_euler_x`];; +Localization.convex_local_fan;; +azim_in_fan_azim;; +searcht 5 [`sol_local`;`azim`];; +Terminal.vv_split_azim_generic;; +searcht 5 [`sum (a INSERT b)`];; +searcht 5 [`FINITE {}`];; +searcht 5 [`FINITE {a,b,c}`];; +searcht 5 [`&0 <= x`; `azim`];; +searcht 15 [`azim`;`dihV`];; +Polar_fan.AZIM_DIHV_SAME_STRONG;; +searcht 5 [`collinear`;`generic`];; +searcht 5 [`IN`;`IMAGE`;`UNIV`];; +searcht 5 [`periodic`;`x+(b:num)`];; +Appendix.tau3;; +`(3 + 4) - 1`;; +searcht 5 [`rho_fun`;`rho`];; +Terminal.tau3_taum_40;; +Pent_hex.terminal_pent_taum;; +searcht 5 [`taum a b c d e f = taum a' b' c' d' e' f'`];; +searcht 5 [`delta_y`;`norm`];; +DIH_IMP_EULER_A_POS;; +searcht 5 [`dist(x, vec 0)`;`norm`];; +searcht 5 [`sol_x`;`dihV`];; +searcht 5 [`dihV a b c d = dihV a b c' d'`];; +searcht 5 [`dihV`;`dih_y`];; +searcht 2 [`dih_y`;`sol_y`];; +searcht 5 [`&0 <= sol_y a b c d e f`];; +searcht 5 [name "VPW"];; +searcht 5 [`norm (x - y) `;`dist`];; +Sphere.packing;; +searcht 5 [`packing`;`IN`];; +IN_ELIM_THM;; +searcht 15 [`(s INSERT b) c`];; +searcht 5 [`periodic`;`MOD`];; +searcht 5 [`periodic`;`sum`];; +Oxl_def.periodic_sum;; +searcht 5 [`sum`;`BIJ`];; +searcht 5 [`sum X f = sum X g`];; +help_grep "ARITH";; +help_grep "NUM";; +Local_lemmas.CVX_LO_IMP_LO;; +DIVISION;; +searcht 25 [`(j + i) MOD k`];; +MOD_ADD_MOD;; +searcht 5 [`i MOD k = i`];; +searcht 15 [`(a + b) MOD k = (a'+ b') MOD k`];; +Polar_fan.AZIM_DIHV_SAME_STRONG;; +searcht 5 [`sqrt(x pow 2)`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;; +Print_types.print_term_types t';; +bb 11;; +(* Jun 26, 2013 *) +searcht 5 [`delta4_squared_y`];; +searcht 5 [`dih_y`;`dih_x`];; +searcht 5 [`x pow 2 < y pow 2`];; +searcht 5 [`&0 <= tan x`];; +searcht 5 [`x * y < x' * y`];; +searcht 15 [`a < x pow 2`];; +searcht 5 [`tan`;`atn`];; +searcht 5 [`atn x < atn y`];; +searcht 5 [`dih_y a b c d e f = dih_y a' b' c' d' e' f'`];; +searcht 5 [`delta_y a b c d e f = delta_y a' b' c' d' e' f'`;`&2`];; +searcht 5 [`taum a b c d e f = taum a' b' c' d' e' f'`];; +searcht 5 [`dih_x a b c d e f < dih_x a' b' c' d' e' f`];; +Tame_inequalities.DIH_X_MONO_LT_4;; +searcht 5 [`delta_y y1 y2 y3 y4 y5 y6 = &0`;`dih_y`];; +Sphere.dih_x;; +searcht 5 [`atn2(&0,x)`];; +searcht 5 [`dih_x`;`pi`];; +Oxlzlez.DIH_X_LT_PI;; +searcht 15 [`delta_x`;`pow`];; +searcht 5 [name "diff";`delta_x`];; +searcht 5 [`delta_x`;`delta_x1`;`pow`];; +searcht 5 [`dihV`;`dih_y`];; +searcht 5 [`cs_diag`;`cs_adj`];; +searcht 15 [`(a+B) MOD n`;omit `5`];; +searcht 5 [`1 MOD 5`];; +searcht 5 [`i < 4`;`\/`];; +searcht 5 [name "funlist";name "expl"];; +searcht 5 [`1 MOD 4`;`2 MOD 4`];; +searcht 5 [`psort 4`];; +searcht 5 [`CARD x <= 2`];; +searcht 5 [`CARD x = 1`];; +searcht 15 [`CARD`;`3`];; +searcht 5 [`CARD X <= CARD Y`];; +searcht 5 [`CARD`;`{i | (i:num) < k}`];; +searcht 5 [`CARD s <= 2`];; +searcht 5 [`CARD {a,b}`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;; +Print_types.print_term_types t';; +bb 25;; +(* Jun 27, 2013 *) +searcht 2 [`delta_y`;`norm`];; +get_main_nonlinear "5405130650";; +searcht 5 [def "deform"];; +searcht 5 [`deformation`];; +searcht 15 [def "continuous"];; + type_of `real_continuous_on`;; +searcht 5 [`continuous_on`;`azim`];; +searcht 5 [`real_continuous`;`dihV`];; +searcht 5 [`continuous_on`;`dist`];; +searcht 5 [`generic`];; +searcht 15 [name "HYPERPL";name "SEP"];; +SEPARATING_HYPERPLANE_CLOSED_POINT;; +REAL_CONTINUOUS_AT_AZIM;; +searcht 5 [`azim`;`real_continuous`];; +searcht 5 [`real_continuous_on`;`real_uniformly_continuous_on`];; + type_of `compact`;; +searcht 15 [`compact`;`closed`];; +searcht 15 [`compact`;`real_interval`];; +searcht 5 [`real_continuous_on`;`dot`];; +searcht 25 [`azim a b c d = pi`];; +searcht 50 [`wedge_ge`;name "Cou"];; +searcht 5 [def "wedge"];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;; +Print_types.print_term_types t';; + let named s = searcht 50 [name s];; +bb 25;; +(* Jun 28, 2013 *) +searcht 50 [`(A:(V)net)`;omit `atreal`;omit `at`];; +searcht 50 [`mk_net`];; +searcht 50 [`real_continuous`;`dist`];; +Local_lemmas1.CON_ATREAL_REAL_CON2_REDO;; +searcht 15 [`continuous`;name "COMPO"];; +BILINEAR_CONTINUOUS_AT_COMPOSE;; +searcht 15 [`continuous`;`h (f x) (g x) (g2 x)`];; +Local_lemmas1.UPS_X_CONTS_FUNC;; +Local_lemmas1.CONTINUOUS_PRESERVE_COLLINEAR;; +searcht 5 [`continuous`;`collinear`];; +searcht 5 [`delta_y`;`coplanar`];; +searcht 50 [`real_continuous`;`<`;`?`];; +searcht 5 [def "generic"];; +searcht 50 [def "wedge"];; +searcht 5 [`wedge`;`azim`];; +searcht 5 [`aff_gt`;`wedge`];; +searcht 5 [`wedge`;`DIFF`];; +searcht 5 [`azim a b c d = &0`];; +searcht 5 [`coplanar`;`cross`];; +Local_lemmas1.AZIM_COND_FOR_COPLANAR;; +Local_lemmas.NOT_COLL_IMP_COPL;; +searcht 5 [`wedge_ge`;`aff_ge`];; +searcht 15 [`collinear`;`cross`];; +Local_lemmas.COLL_IFF_COLL_CROSS;; +searcht 50 [`collinear`;`t % (u:real^A)`];; +COLLINEAR_SPECIAL_SCALE;; +searcht 5 [`azim`;`sin`;`pi`];; +searcht 5 [`sin`;`azim`;`cross`];; +Local_lemmas.SIN_AZIM_MUTUAL_SROSS;; +searcht 5 [`sin`;`pi`;`&0 < sin x`];; +searcht 5 [`azim a b c d <= pi`];; +searcht 5 [`sin pi`];; +searcht 5 [`&0 <= sin (azim a b c d)`];; +searcht 5 [`(a cross b) dot c = (a' cross b') dot c'`];; +searcht 5 [`&0 < x dot x`];; +searcht 5 [`a cross b = vec 0`;`collinear`];; +searcht 5 [`{a,b,c} = {a',b',c'}`];; +searcht 5 [`-- (v cross w)`];; +searcht 15 [`aff_ge {a} {c,d}`;`%`];; +searcht 8 [`DISJOINT`;`collinear`];; +searcht 5 [`v cross w = v`];; +searcht 5 [`collinear {a,b}`];; +searcht 5 [`aff_ge {a} {b,c}`;`%`];; +searcht 5 [`coplanar{a,b,c}`];; +searcht 5[`u IN aff_ge {u} {v,w}`];; +searcht 5[`vec 0 IN aff_lt a b`];; +searcht 50 [`aff_lt {a} {b}`];; +searcht 15 [`coplanar`;`%`];; +searcht 5 [`coplanar`;`cross`];; +searcht 5 [`x dot (-- v)`];; +searcht 5 [`x dot (u + v)`];; +searcht 5 [`x dot (vec 0)`];; +searcht 5 [`(v cross w) dot v`];; +searcht 15 [`coplanar`;`%`;omit `~coplanar s`];; +searcht 5 [`t % x IN wedge a b c d`];; +searcht 5 [`wedge`;`azim`];; +searcht 5 [`azim`;`%`];; +searcht 5 [`aff_ge {a,b} {c,d}`;`%`];; +searcht 5 [name "LDUR"];; +searcht 50 [name "Lunar_de"];; +searcht 5 [`azim a w v w`];; +searcht 20 [`wedge_ge`;`SUBSET`];; +searcht 20 [`wedge`;`afffine hull {a,c}`];; +Local_lemmas.INTERIOR_ANGLE1_POS;; +searcht 50 [name "Counting_";name "SPL"];; +searcht 5 [`dihV`;`azim`];; +searcht 5 [`azim`;`x < &2 * pi`];; +searcht 5 [`sin`;`azim`;`cross`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;; +Print_types.print_term_types t';; +bb 25;; +(* Jun 28, 2013 *) +searcht 15 [`aff_ge {a,b} {c}`;`%`];; +searcht 5 [`DISJOINT`;`collinear`];; +searcht 5 [`collinear`;`%`];; +CROSS_EQ_SELF;; +searcht 5 [`collinear`;`cross`];; +searcht 5 [`v dot v = &0`];; +searcht 5 [`collinear {a,b}`];; +searcht 5 [`collinear {a,b,a}`];; +searcht 5 [`cross`;`azim`];; +searcht 5 [def "re_eqvl"];; +searcht 5 [`re_eqvl`;`?`;`&0`];; +searcht 5 [`re_eqvl a b <=> re_eqvl b a`];; +Local_lemmas.SIN_AZIM_POS_PI_LT;; +searcht 5 [`sin pi`];; +searcht 5 [`&0 < sin x`];; +searcht 5 [`&0 <= azim a b c d`];; +CROSS_LMUL;; +searcht 5 [`x cross x`];; +searcht 5 [`&0 < x dot x`];; +searcht 5 [`collinear`;`cross`];; +searcht 5 [def "cycle"];; +searcht 50 [`azim_cycle`;`azim`];; +Wrgcvdr_cizmrrh.IDENTIFY_AZIM_CYCLE;; +Wrgcvdr_cizmrrh.AZIM_CYCLE_PROPERTIES;; +searcht 15 [`azim a b c d = azim a b c' d'`];; +searcht 5 [`collinear`;`cross`];; +searcht 5 [`DISJOINT`;`collinear`];; +searcht 5 [`(a cross (b cross c))`;`dot`];; +searcht 5 [`a cross b = -- (b cross a)`];; +searcht 5 [`t % (u % v)`];; +searcht 5 [`t % (a + b)`];; +searcht 15 [`azim a b c d= &0`];; +CROSS_EQ_SELF;; +searcht 5 [`(a cross b) dot a`];; +searcht 5 [`azim a b c c`];; +EQ_SYM;; + + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;; +Print_types.print_term_types t';; +bb 7;; +(* Jun 30, 2013 *) +searcht 5 [`aff_ge`;`aff_gt`];; +searcht 5 [`FINITE`;`IMAGE`];; +searcht 5 [`FINITE`;`{i | (i:num) <= m}`];; +searcht 5 [`azim`;name "SHIFT"];; +searcht 5 [`xrr`];; +searcht 5 [`arclength a b c < arclength a' b' c'`];; +searcht 5 [`u IN aff_ge {a,u} {c}`];; +searcht 5 [`collinear`;`cross`];; +Leaf_cell.AZIM_BASE_SHIFT_LE;; +searcht 6 [`azim a b c d + azim a b d e`;omit `cyclic_set`];; +searcht 5 [`&0 <= azim a b c d`];; +searcht 5 [name "LDUR"];; +searcht 5 [`plane`;`coplanar`];; +Trigonometry2.coplanar1;; +searcht 5 [name "GE_2_2"];; +searcht 5 [name "EGH"];; +searcht 5 [`affine hull s`;`aff_gt`];; +searcht 5 [`aff_gt a b SUBSET aff_gt a' b'`];; +searcht 5 [`x IN S ==> x IN g hull S`];; +searcht 5 [`coplanar`;`affine hull s`];; +searcht 5 [`coplanar`;`azim`];; +searcht 5 [`conv0`;`conv`];; +searcht 5 [`conv0 {a,b} SUBSET X`];; +searcht 5 [`conv0`;`%`];; +searcht 5 [`convex`;`aff_gt`];; +searcht 5 [`aff {a,b}`;`%`];; +searcht 10 [`collinear`;`%`];; +searcht 5 [`a % u = a % v`];; +searcht 5 [`a % b % c`];; +Trigonometry2.AFF2_VEC0;;; +searcht 5 [`&1 % v`];; +searcht 5 [`aff_gt`;`conv0`];; +searcht 5 [`aff_gt s t SUBSET aff_gt s' t'`];; + +searcht 5 [`wedge`;`aff_gt`];; +searcht 15 [`collinear`;`cross`];; +searcht 15 [`azim a b c d = &0`];; +searcht 5 [`a IN aff_ge {b,a} s`];; +searcht 5 [`wedge`;`azim`];; +searcht 5[`azim`;`a % c`];; +searcht 10 [`azim`;`&2 * pi`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;; +Print_types.print_term_types t';; +bb 7;; +(* July 1, 2013 *) +searcht 5 [`circular`];; +searcht 5 [def "deformation"];; +searcht 5 [`deformation`;`real_interval`];; +searcht 5 [`deformation`];; +searcht 50 [`wedge_in_fan_gt`];; +searcht 5 [name "AZIM_EQ_IMP"];; + + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;; +Print_types.print_term_types t';; +bb 7;; +(* July 3, 2013 *) +searcht 5 [name "MHAE"];; +searcht 5 [`lunar`;`convex_local_fan`;`IMAGE`;`interior_angle1`];; +searcht 15 [`FINITE`;`FAN`];; +searcht 100 [def "FAN"];; +searcht 5 [`fan3`;`FAN`];; +searcht 50 [`FAN u = y`;`graph`];; +searcht 5 [`graph E`];; +searcht 5 [`local_fan`;`FINITE`];; +searcht 5 [`local_fan`;`convex_local_fan`];; +searcht 5 [`wedge`;`azim`];; +searcht 25 [`a < b /\ b < c`;`&2`];; +searcht 5 [`real_open`;`real_interval`];; +searcht 5 [name "xrr_pos"];; + type_of `real_continuous_on`;; +searcht 5 [`azim`;`&0`;`aff_ge`];; +searcht 5 [`aff_ge`;`coplanar`;`wedge`];; +searcht 5 [`open`;`wedge`];; +searcht 30 [`azim a b c d = pi`];; +searcht 15 [`aff_lt {a,b,c}`];; +searcht 5 [name "LDU"];; +searcht 5 [`coplanar`;`azim`;`&0`];; +searcht 15 [`coplanar`;`collinear`];; +searcht 15 [`affine hull {a,b,c}`;`%`];; +Ckqowsa_4_points.in_affine_hull_lemma;; +searcht 5 [`collinear`;`aff_dim`];; +searcht 5 [def "DIM"];; +searcht 5 [`aff_dim`;`INSERT`];; +searcht 5 [`(a cross b) dot c = (a' cross b') dot c'`];; +searcht 5 [`a cross a`];; +searcht 5 [`&0 < a dot a`];; +searcht 15 [`&0 <= x * y`];; +searcht 5 [`cross`;`collinear`];; +searcht 5 [`azim a b c d = pi`;`coplanar`;`&0`];; +coplanar;; +plane;; +searcht 5 [`S SUBSET affine hull S`];; +searcht 5 [`aff {a,b}`;`%`];; +searcht 5 [`conv0`;`%`];; +searcht 5 [`collinear {vec 0,a,b}`;`%`];; +searcht 5 [`a % v = a % w`];; +searcht 5 [`a % (b + c)`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types CONTINUOUS_AT_LIFT_DOT2;; +Print_types.print_term_types t';; +bb 8;; +(* July 4, 2013 *) +searcht 5 [`&0 <= azim a b c d`];; + NONPLANAR_OPEN;; +searcht 5 [`(\t. c) continuous atz`];; +searcht 5 [`open`;`dot`;`>`];; +searcht 5 [def "open"];; +searcht 5 [`open`;`!`;`?`;`dist`];; +searcht 15 [`dot`;`continuous`];; +searcht 5 [`continuous`;`lift`;`real_continuous`];; +searcht 5 [`lift`;`drop`;`continuous`];; +searcht 5 [`continuous`;`cross`];; +searcht 5 [`real_open`;`real_interval`];; +searcht 5 [`real_open`;`{x | x > c}`];; +searcht 5 [`continuous`;`(-- (v:real^A))`];; +searcht 5 [`azim`;`real_continuous`];; +searcht 5 [`azim a b c d = &0`;`aff_ge`];; +searcht 5 [name "MIN";name "FINITE";omit `dimindex`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types CONTINUOUS_AT_LIFT_DOT2;; +Print_types.print_term_types t';; +bb 5;; + let s = searcht 5;; +RENAME_FREE_VAR (`f:real^3#real^3->real^3#real^3`,"Q") +(* July 4, 2013 *) +s [`local_fan`;`IMAGE`];; +searcht 5 [name "XREC"];; +s [`local_fan`;`convex_local_fan`];; +rename;; +s [`?(x:A#B). P x`];; +SKOLEM_THM;; +s [`local_fan`;`FINITE`];; +searcht 5 [`local_fan`;`~(FF = {})`];; +s [`IMAGE f X = {}`];; +searcht 25 [`local_fan`;`(u,v)`];; +searcht 5 [`x = p1,p2`];; +searcht 8 [`?e. (p ==> q)`];; +searcht 8 [`((?x. p) ==> q)`];; +searcht 5 [`azim_in_fan`;`interior_angle1`];; +Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM;; + let named x = (searcht 3 [name x]);; +searcht 5 [`azim_in_fan`;`azim`];; +Local_lemmas1.AZIM_IN_FAN_RHOND_IVS_RHOND;; +searcht 15 [`rho_node1`];; +searcht 5 [`v,rho_node1 FF v IN FF`];; +searcht 5 [`p1 IN (V:real^3->bool)`;`local_fan`;`(x:real^3#real^3) IN FF`];; +searcht 10 [`rho_node1 FF v = w`];; +searcht 5 [`azim`;`azim_in_fan`];; +Local_lemmas1.AZIM_IN_FAN_RHOND_IVS_RHOND;; +searcht 5 [`rho_node1 FF p1 IN V`];; +searcht 5 [`~collinear s`;`local_fan`];; +searcht 5 [`ivs_rho_node1 FF v = w`];; +searcht 5 [`ivs_rho_node1 FF v,v IN FF`];; +searcht 5 [`collinear`;`ivs_rho_node1`];; +searcht 5 [`FST x,SND x`];; +FST;; +searcht 5 [`&0 < interior_angle1 v f p`];; +searcht 25[`(x,y) IN U`];; +searcht 5 [`FINITE`;`CROSS`];; +searcht 5 [`local_fan`;`~(V = {})`];; +searcht 5 [`V CROSS FF = {}`];; +help_grep "BETA";; +searcht 5 [`local_fan`;`{u,v} IN E`;`(u,v) IN FF`];; +searcht 5 [`wedge_in_fan_ge`;`wedge_ge`];; +searcht 15 [`local_fan`;`x = {u,v}`];; +searcht 5 [`graph`;`FAN`];; +s [`FAN`;`local_fan`];; +searcht 5 [`graph `;`{u,v}`];; +searcht 5 [`graph`;`HAS_SIZE`];; +searcht 5 [`x HAS_SIZE 2`;`{a,b}`];; +searcht 25 [`IMAGE`;`INSERT`];; +searcht 5 [`{u,v} IN (E)`;`local_fan`;`(x:real^3#real^3) IN FF`];; +searcht 5[`{a,b} = {c,d}`];; +Local_lemmas.LOCAL_FAN_IMP_IN_V;; +searcht 5 [`azim`;`azim_in_fan`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types CONTINUOUS_AT_LIFT_DOT2;; +Print_types.print_term_types t';; +bb 8;; +(* July 7, 2013 *) +searcht 5 [`{u,v} IN E`;`(u,v) IN FF`;`local_fan`];; +searcht 5 [`convex_local_fan`;`local_fan`];; +searcht 5 [`local_fan`;`collinear`];; +searcht 5 [`v IN V`;`(u,v) IN FF`;`local_fan`];; +searcht 5 [`~(u = vec 0)`;`local_fan`];; +searcht 5 [`generic`;`collinear`];; +searcht 5 [`collinear`;`wedge`];; +searcht 5 [`collinear`;`cross`];; +searcht 5 [`real_continuous`;`norm`];; +searcht 5 [`norm`;`(x = vec 0)`];; +searcht 5 [`real_continuous_on`;`real_continuous`];; +searcht 15 [`f o g real_continuous net`];; +searcht 5 [`(\t. c) continuous net`];; +searcht 5 [`funlist`];; +searcht 5 [`v cross w = v`];; +searcht 5 [`collinear {a,b}`];; +searcht 5 [`azim`;`wedge`];; +searcht 5 [`azim a b c c `];; +searcht 5 [`cross`;`continuous`];; +searcht 5 [`(\t. f t) = f`];; +searcht 5 [`continuous`;`(\(t:real). -- (f:real->real^A) t)`];; +searcht 5 [`continuous`;`(--):real^A->real^A`];; +searcht 5 [`x IN wedge_ge a b c d`];; +searcht 5 [`wedge_ge`;`wedge_in_fan_ge`];; +searcht 5 [`x IN wedge_ge a x b d`];; +searcht 5 [`wedge_ge`;`azim`];; +searcht 5 [`azim a b c b`];; +NHCXLRV;; +Oxl_2012.CHQSQEY;; +Oxl_2012.MTMLSRF;; +Oxl_2012.LXDEYBO;; +Oxl_2012.UNPNFVW;; +Oxl_2012.DHCVTVE;; +Oxl_2012.PMZTATI;; +Oxl_2012.IPVICGW;; +searcht 5 [`ivs_rho_node1 FF w IN V`];; +searcht 5[`collinear`;`rho_node1`];; +searcht 5 [`collinear`;`local_fan`;`generic`];; +searcht 5 [`wedge a b c d SUBSET wedge_ge a b c d`];; +searcht 5 [name "EGHNAVX"];; +searcht 10 [`local_fan`;`(x:real^3#real^3) IN FF`];; +searcht 5 [`x = a,b`;`FST`;`SND`];; +searcht 5 [`a,b = c,d`];; +searcht 5 [`wedge_ge a b c d`;`wedge a b c d`];; +searcht 5 [`convex_local_fan`;`local_fan`];; +searcht 1 [`ITER`;`rho_node1`;`ivs_rho_node1`];; +searcht 5 [`ITER 1`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types SKOLEM_EPSILON;; +Print_types.print_term_types t';; +bb 5;; +(* July 8, 2013 *) +searcht 5 [name "KOMW"];; +searcht 5 [`x IN P hull s`];; +searcht 5 [`aff_gt s t SUBSET affine hull u`];; +searcht 5 [`ITER i (rho_node1 FF) w = ITER j (rho_node1 FF) w`];; +searcht 5 [`local_fan`;`CARD V = CARD FF`];; +searcht 5 [`ITER i (rho_node1 FF) v IN V`];; +searcht 5 [`ITER (i+j)`];; +searcht 5 [name "XIV"];; +searcht 5 [`azim v0 v1 v2 v1`];; +Local_lemmas.AZIM_SPEC_DEGENERATE;; +searcht 5 [`azim v0 v1 v1 v2`];; +searcht 5 [`azim v0 v1 v2 v3 + azim v0 v1 v3 v2`];; +azim;; +searcht 5 [`v IN wedge_ge a b c v`];; +searcht 10 [`real_continuous`;`?`;`atreal`];; +real_continuous_at;; +searcht 5 [`dihV`;`real_continuous`];; +searcht 5 [`(\t. c) continuous net`];; +GSYM SKOLEM_EPSILON;; +searcht 5 [`?d. (a /\ b d ==> c d)`];; +searcht 5 [`azim`;`a IN aff_ge u v`];; +searcht 5 [`azim a b c d = &0`;`&0 < x`];; +searcht 5 [`SUC i = SUC j`];; +searcht 15 [`azim`;`dihV`];; +searcht 5 [`azim a b c d = &0`];; +searcht 15 [`cyclic_set`;`%`];; +searcht 5 [`t % e = vec 0`];; +searcht 10 [`affine hull s`;`%`];; +searcht 25 [`azim_cycle`;omit `FAN`;omit `azim_in_fan`;omit `local_fan`;omit `convex_local_fan`;omit `wedge_in_fan_gt`;`@`];; +searcht 5 [`azim (vec 0) (t % e)`];; +searcht 15 [`projection`;`%`];; +Sphere.cyclic_set;; +searcht 5 [`azim_cycle {x}`];; +Sphere.azim_cycle;; +searcht 5 [`collinear`;`cyclic_set`];; +Wrgcvdr_cizmrrh.IDENTIFY_AZIM_CYCLE;; +searcht 5 [`azim a (-- b) c d`];; +searcht 15 [`%`;`continuous`];; +searcht 5 [`wedge_in_fan_ge`];; +Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2;; +deformation_rho_node1_equivariant1;; +searcht 5 [`&0 < interior_angle1 u FF v`];; +Local_lemmas.INTERIOR_ANGLE1_POS;; +searcht 5 [`interior_angle1`;`azim`];; +Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM_IVS;; +searcht 5 [`rho_node1`;`ivs_rho_node1`];; +searcht 5 [`ITER (a+b)`];; +XIV_ECAU;; +searcht 5 [`ivs_rho_node1 FF w IN V`];; +searcht 5 [`ITER i (rho_node1 FF) w IN V`];; +ITER;; +searcht 5 [`ITER`;`rho_node1`;`ivs_rho_node1`];; + + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types SKOLEM_EPSILON;; +Print_types.print_term_types t';; +bb 4;; +(* July 10, 2013 *) +searcht 5 [`azim_in_fan`;`azim`];; +searcht 5 [`v,rho_node1 FF v IN FF`];; +PROPERTIES_GENERIC_LOCAL_FAN_ALT;; +searcht 5 [`ITER i f w = ITER j f w`];; +Local_lemmas1.LT_CARD_MONO_LOFA;; +searcht 5[`ITER (CARD V - 1)`];; +searcht 5[`ITER (CARD V)`];; +searcht 5 [`ITER i (ivs_rho_node1 FF) v`;`ITER j (rho_node1 FF) v`];; +searcht 5 [`collinear`;`ivs_rho_node1`];; +searcht 5 [`rho_node1 FF v IN VV`];; +searcht 5[`ITER i (ivs_rho_node1 FF) v IN V`];; +searcht 5 [`ivs_rho_node1 FF (rho_node1 FF w)`];; +searcht 5 [`rho_node1 FF (ivs_rho_node1 FF w)`];; +XIV_ECAU;; +KCZXLLE_SYM;; +searcht 5 [`collinear`;`cross`];; +searcht 15[`coplanar`;`affine hull s`];; +searcht 15[`v2 IN affine hull {a,b,c}`;`%`;`vec 0`];; +searcht 5 [`u1 cross u2 = -- (u2 cross u1)`];; +searcht 15 [`&0 < x * y`];; +searcht 2 [`&0 < x dot x`];; +searcht 5 [`&0 < azim a b c d`;`azm a b c d = &0`];; +searcht 5 [`azim a b c d = &0`;`aff_gt`];; +searcht 5 [`collinear`;`%`];; +searcht 5 [`e dot (e cross f)`];; +searcht 5 [`azim a b c d <= azim a' b' c' d'`;`azim_cycle`];; +searcht 5 [`azim_cycle U a b v IN U`];; +searcht 5 [`aff_gt {a,b} {c}`;`%`];; +searcht 5 [`DISJOINT`;`collinear`];; +Polar_fan.AZIM_CYCLE_BASIC_PROPERTIES;; +searcht 5 [`azim_cycle U o e v = v`];; +searcht 5 [`azim a (-- e)`];; +searcht 8 [`azim a b c d + azim a b d e`;omit `cyclic_set`];; +searcht 5 [`&0 <= azim a b c d`];; +searcht 50 [`azim`;`azim_cycle`];; +Wrgcvdr_cizmrrh.AZIM_CYCLE_PROPERTIES;; +searcht 15 [`s SUBSET affine hull t`];; +searcht 5 [`aff_gt {a,b} {c}`;`%`];; +AFF_GT_SUBSET_AFFINE_HULL;; +searcht 5 [`periodic`;`ITER`];; +searcht 5 [`local_fan`;`CARD FF = CARD V`];; + + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types SKOLEM_EPSILON;; +Print_types.print_term_types t';; +bb 4;; +(* July 12, 2013 *) +searcht 5 [name "A_482"];; +searcht 5 [`MMs_v39`;`BBs_prime_v39`];; +searcht 5 [`BBprime2_v39`;`BBprime_v39`];; +Appendix.BBs_v39;; +searcht 15 [`IMAGE f X SUBSET Y`];; +searcht 5 [`local_fan`;`convex_local_fan`];; +searcht 5 [`&0 < x`;`interior_angle1`];; +searcht 5 [`IMAGE f (:A)`];; +searcht 5 [`interior_angle1`;`azim`];; +searcht 5 [`coplanar`;`azim_in_fan`];; +searcht 5 [`rho_node1`;`is_scs_v39`];; +searcht 5 [`ivs_rho_node1`;`is_scs_v39`];; +searcht 5 [`ivs_rho_node1 FF u IN V`];; +searcht 5 [`rho_node1 FF v = rho_node1 FF w`];; +Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME;; +searcht 5 [`rho_node1 FF (ivs_rho_node1 FF v)`];; +searcht 5 [`generic`;`collinear`];; +searcht 5 [`generic`;`scs_generic`];; +searcht 5 [`is_scs_v39`;`&2 <= dist (v,u)`];; +searcht 10 [`(p + a) MOD k = (p + b) MOD k`];; +searcht 10 [`(a MOD k = a)`];; +searcht 5 [`coplanar`;`azim`];; +searcht 5 [`norm`;`ball_annulus`];; +searcht 5 [`&0`;`delta_y`;`norm`];; +Tame_lemmas.delta_y_pos;; +rr[LET_DEF;LET_END_DEF] Tame_lemmas.delta_y_pos];; +searcht 5 [`coplanar`;`delta_y`];; +searcht 5 [`dist(vec 0,v)`;`norm`];; +GSYM Oxlzlez.coplanar_delta_y;; +searcht 5 [`&0 < x`;`ups_x`;`dist`];; +Localization.deformation;; +searcht 5 [`dist`;`~collinear {a,b,c}`;`x ==> ((u:real^3) = v)`;omit `cos`;omit `radV`];; +searcht 5 [def "eqvl"];; +searcht 5 [`coplanar`;`cross`];; +Local_lemmas.NOT_COLL_IMP_COPL;; +searcht 15 [`coplanar`;`%`];; +Trigonometry2.NONCOPLANAR_3_BASIS;; +searcht 5 [`v1 dot (v1 cross v2)`];; +searcht 5 [`re_eqvl`];; +searcht 5 [`cross`;`collinear`];; +searcht 5 [`a dot a = &0`];; +searcht 5 [`dist`;`norm`];; +NORM_ADD_PYTHAGOREAN;; +searcht 5 [`norm (t % v)`];; +searcht 5 [`(norm x) pow 2`;`dot`];; +searcht 5 [`t pow 2 = &1`];; +searcht 5 [`t2 pow 2 = &0`];; +searcht 5 [`(v1 cross v2) dot (v1 cross v2)`];; +searcht 5 [name "CONTINUOUS_CONTINUOUS_WITHINREAL"];; +Localization.deformation;; +searcht 5 [`dist(a,b)= &0`];; +searcht 5 [`collinear`;`coplanar`];; +searcht 5 [`coplanar`;`~((v:real^A) = w)`];; +searcht 5 [`coplanar`;`delta_y`;`dist`];; +searcht 5 [`x pow 2 = y pow 2`];; +searcht 5 [`&0 <= dist(x,y)`];; +searcht 5 [`continuous`;`coplanar`];; +searcht 5 [`dist(vec 0,v)`];; +mk_simplex_uniq;; +searcht 5 [`cross`;`azim`];; +searcht 5 [`delta_y`;`norm`];; +searcht 5 [`norm`;`dist`];; + Oxlzlez.coplanar_delta_y;; +REAL_CONTINUOUS_SUB;; +REAL_CONTINUOUS_CONST;; +) orelse (mmp REAL_CONTINUOUS_NEG) orelse mmp REAL_CONTINUOUS_ABS) +searcht 5 [`real_abs`;`real_continuous`];; +ETA_AX;; +REAL_CONTINUOUS_ABS;; +searcht 5 [`I`;`real_continuous`];; +searcht 5 [`(\x. x)`;` real_continuous`];; +searcht 15 [`real_continuous`;`?`];; +searcht 5 [`real_continuous`;`delta_x`];; +searcht 5 [name "OPEN";name "REAL_INTERVAL"];; +searcht 5 [`real_continuous`;`pow`];; +DIST_0;; +searcht 5 [`&0 < dist(x,y)`];; +searcht 5 [`x pow 2 = y pow 2`];; +searcht 5 [`&0 <= norm x`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types SKOLEM_EPSILON;; +Print_types.print_term_types t';; +bb 4;; +(* July 12, 2013 *) +searcht 5 [`a dot a`;`~(a = vec 0)`];; +searcht 5 [`collinear {a,b}`];; +searcht 5 [`coplanar`;`cross`];; +searcht 5 [`collinear`;`cross`];; +searcht 15 [`~coplanar {a,b,c,d}`;`%`];; +VECTOR_SUB_RZERO;; +searcht 15 [`coplanar`;`collinear`];; +searcht 5 [`u IN affine hull {a,b,c}`;`%`];; +searcht 5 [`x dot x = &0`];; +searcht 5 [`norm (t % a)`];; +searcht 5 [`norm v1`;`dot`];; +searcht 10 [`a * b = c * b`];; +searcht 5 [`n dot n = &0`];; +searcht 5 [`a pow 2 = b pow 2`];; +searcht 5 [`a % w = b % w`];; +searcht 5 [`a * b = c * b`];; +searcht 5 [`sqrt`;`real_continuous`];; +searcht 5 [`continuous`;`cross`];; +searcht 5 [`lift`;`continuous`];; +searcht 5 [`real_continuous`;`(/)`];; +searcht 5 [`collinear`;`ups_x`];; +mk_planar2_continuous;; +searcht 5 [`norm x = &0`];; +searcht 5 [`&0 < ups_x a b c`;`dist`];; +searcht 5 [`norm`;`dist`];; +searcht 2 [`coplanar`;`~((u:real^3)=v)`];; +mk_planar_unique;; +searcht 5 [`~coplanar s`;`affine hull s`];; +searcht 5 [`affine hull {a,u,v,w}`;`%`];; +searcht 15 [`coplanar`;`%`;omit `~coplanar s`];; +searcht 15 [`coplanar`];; +searcht 20 [`coplanar`;`{a,b,c}`];; +searcht 5 [`collinear`;`aff_dim`];; +searcht 5 [`coplanar`;`aff_dim`];; +searcht 5 [`aff_dim`;`s SUBSET t`];; +searcht 5 [`x IN P hull s`];; +searcht 5 [`affine hull {a,b,c}`;`%`];; +searcht 2 [`&0 < v dot v`];; +searcht 5 [`&0 < t * y <=> &0 < t`];; +searcht 5 [`a % v = a % w`];; +searcht 5 [`ups_x a b c = ups_x a' b' c'`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types SKOLEM_EPSILON;; +Print_types.print_term_types t';; +bb 5;; +(* July 16, 2013 *) + +searcht 5 [`is_scs_v39 s`;`&2 <= dist(a,b)`];; +searcht 5 [`(a + b) MOD k = (a + c) MOD k`];; +searcht 15 [`(a MOD k = b MOD k)`;omit `5`;omit `3`;omit `is_scs_v39`];; +searcht 5 [`a MOD k = a`];; +searcht 5 [`{a,b}={c,d}`];; +searcht 5 [`deformation`;`is_scs_v39`];; +searcht 5 [def "ww_defor"];; +searcht 5 [`convex_local_fan`;`deformation`;name ".ZLZ"];; +frees_of_goal ([],`a b c`);; +searcht 5 [name "SKOLEM_EPSILON"];; +searcht 0 [`periodic`;`{(i:num) | i < k}`];; +searcht 15 [`periodic2`;`0..u`];; +searcht 15 [`periodic2`];; +Oxl_def.periodic_numseg;; +Terminal.periodic2_mod_reduce;; +searcht 15 [`periodic2`];; +SKOLEM_PERIODIC2;; +searcht 5 [`is_scs_v39`;`3`];; +help_grep "conj";; +conjuncts `a /\ b /\ c`;; +REWRITE_CONV [GSYM CONJ_ASSOC] `(a /\ b) /\ c`;; +searcht 5 [name "Terminal";name "IMAGE"];; +searcht 5 [`ball_annulus`;`norm`];; +searcht 2 [`b_spine5`;`DECIMAL`];; +searcht 5 [`dist`;`real_continuous`];; +searcht 5 [`IMAGE f (IMAGE g X)`];; +searcht 5 [`IMAGE f (a INSERT s)`];; +searcht 5 [`generic`;`scs_generic`];; +searcht 50 [`interior_angle1`;`azim`];; +searcht 5 [`deformation`;`interior_angle1`];; +searcht 5 [`azim_in_fan`;`azim`];; +searcht 5 [`azim_in_fan`;`azim`];; +searcht 5 [`azim_in_fan`;`interior_angle1`];; +searcht 5 [`interior_angle1`;`azim`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types SKOLEM_EPSILON;; +Print_types.print_term_types t';; +bb 8;; +(* July 17, 2013 *) +searcht 5 [`deformation`;`local_fan`];; +searcht 5 [`is_scs_v39`;`i + (k-1)`];; +searcht 5 [`convex_local_fan`;`local_fan`];; + Ocbicby.INTERIOR_ANGLE1_AZIM;; +named "azim_in_fan2";; +named "EXISTS_INVERSE_OF_V";; +map named[ "LOFA_IMP_EE_TWO_ELMS"; + "LOFA_CARD_EE_V_1"; + "LOCAL_FAN_RHO_NODE_PROS2";];; +Local_lemmas.azim_in_fan2;; +searcht 5 [`rho_node1`;`vv (SUC i)`];; +searcht 5 [`is_scs_v39`;`(!i j. i < k /\ j < k /\ v i = v j ==> i = j)`];; +searcht 5 [`is_scs_v39`;`&2 <= dist(a,b)`];; +searcht 5 [`i MOD k = i`];; +searcht 5 [`ivs_rho_node1`;`vv (i + (k-1))`];; +searcht 5 [`interior_angle1`;`azim`;`is_scs_v39`];; + Ocbicby.INTERIOR_ANGLE1_AZIM;; +GSYM (REWRITE_RULE[LET_DEF;LET_END_DEF;arith `SUC i = i+1`] Ocbicby.INTERIOR_ANGLE1_AZIM);; +searcht 5 [`cross`;`azim `;`&0 < x`];; +deform_simplex_edge_exists;; +searcht 5 [`{a,b} = {c,d}`];; +searcht 5 [`(\t .t) real_continuous net`];; +searcht 5 [name "periodic2";name "reduce"];; +searcht 5 [`periodic2`;`MOD`];; +searcht 5 [`periodic`;`MOD`];; +searcht 5 [`i MOD k < k`];; +searcht 0 [`(i + k) MOD k`];; +searcht 5 [`(a*b+c) MOD k`];; +searcht 5 [`j MOD k = j`];; +searcht 5 [name "split";name "generic"];; +searcht 15 [`azim a b c d + azim a' b' c' d'`;name "3"];; +searcht 5 [name "tau_fun_azim"];; +searcht 5 [`scs_generic`;`generic`];; +searcht 5 [`azim a b c d < &2 * pi`];; +searcht 5 [`collinear`;`azim`;omit `~collinear s`];; +searcht 5 [`I x = x`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types SKOLEM_EPSILON;; +Print_types.print_term_types t';; +bb 6;; +(* July 18, 2013 *) +searcht 5 [`psort`];; +searcht 5 [`(a,b) = (c,d)`];; +searcht 5 [`(a*b + c) MOD k`];; +searcht 5 [`dist(a,b) + dist(b,c)`];; +searcht 5 [`ball_annulus`;`norm`];; +searcht 5 [name "IMAGE_SUBSET";name "IN"];; +searcht 5 [`(a + b) MOD k`;`(a MOD k + b MOD k) MOD k`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types SKOLEM_EPSILON;; +Print_types.print_term_types t';; +bb 10;; +(* July 19, 2013 *) +searcht 10 [`azim`;`real_continuous`];; +searcht 5 [`generic`;`collinear`];; +searcht 5 [`local_fan`;`convex_local_fan`];; +searcht 5 [`(a + c) MOD k = (a + c') MOD k`];; +searcht 5 [`deformation`;`collinear`];; +searcht 5 [name "continuous_nbd_pos"];; +searcht 5 [`azim`;`aff_ge`];; +searcht 5 [`&0 < azim a b c d`;`~(azim a b c d = &0)`];; +searcht 5 [`azim a b c d = &0`;`coplanar`];; +searcht 5 [`azim`;`convex_local_fan`;`i + k - 1`];; +searcht 5 [`atn x < atn y`];; +searcht 10 [`coplanar`;`collinear`;`( /\ )`];; +searcht 5 [`sin x`;`&0 < x /\ x < pi`];; +searcht 5 [`azim a b c d < &2 * pi`];; +searcht 5 [`re_eqvl`;`sin`];; +searcht 5 [`re_eqvl`;`&0 < x`];; +searcht 15 [`azim`;`dihV`];; +AZIM_DIHV_SAME;; +searcht 5 [`pi / &2 `;`dih_x `];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types CONTINUOUS_LIFT_DOT2 ;; +Print_types.print_term_types t';; +bb 10;; +back_to "CVX_LO_IMP";; +(* July 20, 2013 *) +searcht 5 [`dihV`;`dih_x`];; +searcht 8 [name "REAL_MVT"];; +searcht 5 [`derived_form`;`dih_x`;`delta_x6`];; +HAS_REAL_DERIVATIVE_TRANSFORM_WITHIN;; +searcht 5 [`f'`];; +searcht 5 [`net within (:real)`];; +searcht 5 [`net within s`;`(f has_real_derivative f') (atreal x)`];; +searcht 5 [`net within s`;`f real_continuous (atreal x)`];; +searcht 5 [`(f o g) has_real_derivative f'`];; +searcht 5 [`dih_x`;`delta_x4`];; +searcht 5 [`real_continuous`;`delta_x`];; +searcht 5 [`(\t. -- f t) real_continuous net`];; +REAL_CONTINUOUS_SUB;; +searcht 5 [`(\t. t) real_continuous net`];; +searcht 5 [`dih_x a b c d e f <= dih_x a b c d' e' f'`];; +Tame_inequalities.DIH_X_MONO_LT_4;; +searcht 5 [`delta_x5`;`delta_x6`];; +searcht 5 [`dih_x a b c d e f = dih_x a c b d' e' f'`];; +searcht 5 [`&0 < ups_x a b c`;`collinear`];; +searcht 5 [`pi / &2 < dih_x a b c d e f`;`delta_x4`];; +searcht 5 [`coplanar {a,b,c}`];; +searcht 3 [`&0 < delta_y a b c d e f`;`dist`];; +searcht 5 [`real_min`];; +searcht 5 [`abs`;`real_continuous`];; +dihV_obtuse_mono_a;; +searcht 5 [name "CONTINUOUS_AT_LIFT_DOT2"];; +searcht 5 [`dihV a b c d = dihV a b d c`];; +searcht 15 [`abs`;`real_continuous`];; +searcht 5 [`(\u. u)`;`real_continuous`];; +Searching.searcht 5 [name "CONTINUOUS_LIFT_DOT"];; +g `!net f i. + f continuous net /\ g continuous net + ==> (\x. lift (f x dot g x)) continuous net`;; +searcht 5 [name "SYNQ"];; +Searching.searcht 5 [name "REAL_CONTINUOUS_ATREAL_DIHV_COMPOSE"];; +Searching.searcht 5 [`lift`;`continuous`;`real_continuous`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types CONTINUOUS_LIFT_DOT2 ;; +Print_types.print_term_types t';; +bb 4;; +back_to "kill";; +(* July 22, 2013 *) +searcht 5 [`interior_angle1`;`azim`;`i + k - 1`];; +searcht 5 [`psort k (a,b) = psort k (b,a)`];; +searcht 5 [`psort k (a MOD k,b)`];; +searcht 5 [`(a MOD k) MOD k`];; +searcht 5 [`scs_a_v39`;`MOD`];; +searcht 50 [def "tau"];; +searcht 15 [`taustar_v39`;`tau_fun`];; +searcht 5 [`tau_fun`;`azim`];; +searcht 5 [`BBs_v39`;`periodic`];; +searcht 5 [`dsv_v39`];; +Appendix.is_basic;; +searcht 50 [`is_basic`];; +searcht 5 [`sum (A DIFF B)`];; +searcht 5 [`tau3`;`taum`];; +searcht 5 [`tau3`;`dihV`];; +searcht 5 [`FINITE {i | (i:num) < k}`];; +searcht 5 [`sum A f = sum A g`];; +searcht 5 [`sum {a,b,c} f`];; +searcht 15 [`(a + b) MOD k`;omit `5`];; +MOD_ADD_MOD;; +DIVISION;; +searcht 5 [`0 MOD k`;omit `a MOD 4`];; +searcht 5 [`x MOD k = x`];; +MOD_SHIFT;; +searcht 5 [`(a + c) MOD k = (a + b) MOD k`];; +searcht 5 [`taum`;`tau3`];; +searcht 15 [`azim`;`dihV`];; +searcht 5 [name "FSQ"];; +searcht 5 [`real_interval (a,b)`;`abs t`];; +Zlzthic.real_interval_contains_0_ball;; +searcht 5 [`rho`;`rho_fun`];; +MOD_SHIFT;;s +searcht 5 [`taum a b c d e f = taum a' b' c' d' e' f'`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types CONTINUOUS_LIFT_DOT2 ;; +Print_types.print_term_types t';; +bb 4;; +back_to "kill";; +(* July 23, 2013 *) +searcht 5 [name "deform_simplex_684"];; +searcht 5 [`coplanar`;`cross`;`dot`];; +searcht 5 [`azim`;`cross`;`dot`];; +searcht 5 [`re_eqvl`;`&0 < x`];; +searcht 5 [`re_eqvl`;name "SYM"];; +searcht 5 [def "quadratic"];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types CONTINUOUS_LIFT_DOT2 ;; +Print_types.print_term_types t';; +bb 4;; +back_to "kill";; +(* July 24, 2013 *) +searcht 15 [`quadratic_root_plus`];; +searcht 5 [name "2x2"];; +searcht 25 [`real_sgn`];; +searcht 5 [`real_sgn(x * y)`];; +searcht 5 [`real_sgn x = &1`];; +GSYM REAL_SGN_EQ;; +searcht 5 [`real_sgn`;`abs`];; +searcht 5 [`y / x = &0`];; +searcht 15 [`&0 < x * y`];; +searcht 5 [`re_eqvl`;`&0 <= x`];; +searcht 5 [`sin`;`azim`];; +searcht 5 [`coplanar`;`delta_y`];; +Collect_geom2.POS_EQ_NOT_COPLANANR;; +searcht 5 [`&0 <= delta_y a b c d e f`;`dist`];; +searcht 5 [`delta_x`;`abc_of_quadratic`];; +searcht 5 [`delta_x`;`a * u pow 2 + b * u + c`];; +searcht 5 [`convex`;`real_interval`];; +searcht 5 [`FINITE`;`connected`];; +CONTINUOUS_FINITE_RANGE_CONSTANT;; +Localization.deformation;; +searcht 5 [`convex`;`connected`];; +searcht 5 [`real_interval`;`interval`];; +searcht 5 [`real_interval`;`real_connected`];; +searcht 5 [`real_continuous`;`FINITE`];; +searcht 5 [def "kepler"];; +searcht 5 [`kepler_conjecture`;`saturated`;`packing`];; +searcht 5 [`drop (lift x)`];; +searcht 15 [`f x IN IMAGE f X`];; +searcht 5 [`lift`;`real_interval`];; +searcht 5 [`connected`;`interval`];; +searcht 5 [`continuous_on`;`real_continuous_on`];; +ETA_AX;; +searcht 5 [`IMAGE f (IMAGE g X)`];; +searcht 5 [`drop o lift`];; +searcht 5 [`real_continuous`;`dist`];; +searcht 5 [`real_continuous`;`real_continuous_on`];; +searcht 5 [`real_open`;`real_interval(a,b)`];; +FINITE_SUBSET;; +searcht 5 [`FINITE`;`INSERT`];; +searcht 15 [`IMAGE f X`;`HAS_SIZE`];; +searcht 5 [`azim a b c d = &0`;`cross`];; +searcht 5 [`interior_angle1`;`azim_in_fan`];; +searcht 15 [`azim_in_fan`;`azim`];; +searcht 5 [`interior_angle1`;`BBs_v39`];; +Ocbicby.INTERIOR_ANGLE1_AZIM;; +searcht 5 [`&0 < azim a b c d`;`convex_local_fan`];; +searcht 5 [`5 MOD 5`];; +Appendix.scs_diag;; +searcht 5 [`(a /\ c) \/ (a /\ b)`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas.EGHNAVX;; +Print_types.print_term_types t';; +frees (concl Local_lemmas.EGHNAVX);; +bb 5;; +back_to "azim 0";; +(* July 25, 2013 *) +searcht 5 [name "EGH"];; +searcht 5 [` IMAGE (\i. (v i,v (SUC i))) (:num)`;`rho_node1`];; +searcht 5 [name "FEKT"];; +searcht 5 [`coplanar`;`&0`;`pi`;`azim`];; +type_of `scs_basic_v39`;; +searcht 15 [`CARD`;`is_scs_v39`];; +searcht 5 [`collinear`;`generic`];; +searcht 5 [`scs_generic`;`generic`];; +help "GEN_ALL";; +help "GENL";; +searcht 15 [`(!i. a ==> P i)`;`a ==> (!i. P i)`;name "FORALL"];; +searcht 5 [name "FORALL";name "AND"];; + (GSYM Ocbicby.INTERIOR_ANGLE1_AZIM);; +searcht 5 [`aff_gt {a,b} {c}`;`%`];; +searcht 5 [`i MOD k < k`];; +searcht 5 [name "SHIFT";`(a + b) MOD k = (a + c) MOD k`];; +searcht 5 [`i MOD k = i`];; +searcht 5 [`cross`;`collinear`];; +searcht 5 [`coplanar`;`affine hull s`];; +searcht 5 [`x IN P hull s`];; +searcht 5 [`periodic`;`IMAGE`;`a..b`];; +searcht 5 [`periodic`;`a..b`];; +searcht 5 [`aff_gt s t SUBSET affine hull s'`];; +searcht 5 [`collinear`;`affine hull s`;`SUBSET`];; +AFFINE_HULL_3_GENERATED;; +searcht 5 [`coplanar`;`affine hull s`];; +AFFINE_HULL_3_GENERATED;; +Terminal.vv_split_azim_generic;; +searcht 5 [`&0 <= azim a b c d`];; +Local_lemmas1.AZIM_COND_FOR_COPLANAR;; +searcht 5 [`real_continuous`;`azim a b c d < x`];; +WNWSHJT_ALT;; +searcht 5 [`coplanar`;`collinear`;`/\`];; +searcht 5 [`azim`;name "fan3"];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas1.CON_ATREAL_REAL_CON;; +Print_types.print_term_types t';; +frees (concl Local_lemmas.EGHNAVX);; +bb 3;; +back_to "deform coll";; +(* July 27, 2013 *) +searcht 10 [`dihV`;`azim`;name "STRONG"];; +searcht 5 [`dihV`;`dih_x`];; +searcht 5 [`collinear`;`ups_x`];; +searcht 5 [name "SYN"];; +searcht 5 [def "xrr"];; +searcht 5 [`xrr`;`&1`];; +Appendix.scs_v39;; + +searcht 5 [`dest_scs_v39`];; +searcht 5 [`FST x = FST x'`];; +searcht 5 [`part1`];; +searcht 5 [name "EGH"];; +searcht 5 [`s SUBSET P hull s`];; +searcht 5 [`aff_gt s t SUBSET affine hull t'`];; +searcht 5 [`convex_local_fan`;`interior_angle1`];; +searcht 5 [`azim`;`dot`;`cross`];; +searcht 5 [`re_eqvl`;`&0 < x`;`==>`];; +searcht 5 [`&0 < sin x`;`azim`];; +searcht 5 [`abs`;`real_continuous`];; +a5_assumption_reduction;; +searcht 5 [name "nbd_pos"];; +searcht 5 [`is_scs_v39`;`&2 <= scs_a_v39 s i j`];; +searcht 5 [`dist`;`real_continuous`];; + Local_lemmas1.CON_ATREAL_REAL_CON;; +type_of `t0`;; +searcht 50 [`t0`];; +searcht 50 [`quarter`];; +searcht 50 [`quasi_tri`];; +searcht 15 [`collinear`;`continuous`];; +searcht 15 [`collinear`;`deformation`];; +searcht 5 [`azim`;`dih_y`];; +Cuxvzoz.deform_684_pent_exists;; +searcht 5 [name "FSQK"];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas1.CON_ATREAL_REAL_CON;; +Print_types.print_term_types t';; +frees (concl Local_lemmas.EGHNAVX);; +bb 3;; +back_to "epsilon_hex";; +(* July 27, 2013 *) +searcht 3 [`azim`;`dih_y`];; +searcht 5 [`coplanar`;`azim`;`pi`;`&0`];; +searcht 5 [`&0 < azim a b c d`;`abs t < e`];; +searcht 5 [`deformation`;`subset`];; +searcht 5 [name "WNW"];; +searcht 5 [`dih_y a b c d e f <= dih_y a b c d' e f`];; +Ocbicby.dih_y_mono;; +searcht 5 [`continuous`;`coplanar`];; +azim_dih_y;; +searcht 5 [`&0 < norm x`];; +searcht 5 [`~coplanar s`;`~(x = y)`;`/\ `];; +searcht 5 [`delta_y a b c d e f`;`coplanar`];; +searcht 5 [`delta_y a b c d e f = delta_y a' b' c' d' e' f'`];; +searcht 5 [`&0 <= delta_y a b c d e f`];; +searcht 25 [`sum (a..b)`];; +SUM_4;; +searcht 5 [`sum (0..4)`];; +searcht 5 [`sum (a..b)`;`sum ((SUC n)..b)`];; +searcht 5 [`sum (0..3)`];; +searcht 5 [name "sym";`xrr`];; +searcht 5 [`ball_annulus`;`norm`];; +searcht 5 [`taum`;`tau3`];; +Cuxvzoz.tau3_taum_nonplanar;; +searcht 5 [`tau3`;`azim`];; +Cuxvzoz.tau3_azim;; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas1.CON_ATREAL_REAL_CON;; +Print_types.print_term_types t';; +frees (concl Local_lemmas.EGHNAVX);; +bb 3;; +back_to "COMMENT";; +(* July 29, 2013 *) +searcht 5 [`taum a b c d e f = taum a' b' c' d' e' f'`];; +searcht 5 [`arclength a b c + arclength a' b' c'`];; +searcht 12 [`arcV u v w + arcV u' v' w'`];; +searcht 15 [`arclength`;`aff_gt`];; +searcht 5 [`angle s + angle s'`];; +ANGLES_ADD_AFF_GE;; +searcht 5 [`angle`;`arcV`];; +Nkezbfc_local.PROPERTIES_GENERIC_LOCAL_FAN;; +searcht 5 [`DISJOINT`;`collinear`];; +searcht 5 [`DISJOINT`;name "SYM"];; +Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME;; +Local_lemmas.LUNAR_IMP_HALF_CIRCLE_SUBSET_AFF_GT;; +Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2;; +Planarity.decomposition_planar_by_angle_fan;; +Planarity.POINT_IN_AFF_GE_IMP_IN_EDGE;; +searcht 5 [name "WL_IN_E"];; +searcht 5 [`FAN`;`aff_ge`];; +searcht 5 [`FAN`;`local_fan`];; +searcht 5 [`FAN`;`{a,b} IN E`;`~(a = b)`];; +searcht 5 [`arclength`;`atn`];; +searcht 5 [`xrr`;`arclength`];; +searcht 5 [`acs`;`pi`;`cos`];; +searcht 5 [`cos z < &1`];; +searcht 5 [`cos (z+pi)`];; +searcht 5 [`cos (-- z)`];; +searcht 5 [`sqrt x * sqrt x = x`];; +seracht 5 [`xrr a b c <= d`];; +searcht 5 [`arclength`;`acs`];; +searcht 5 [`(a * a + b * b - c*c)/(&2 * a*b)`;`<=`];; +Oxl_2012.GRHIDFA;; +searcht 5 [`cc_card_v11`;`CARD`];; +searcht 5 [`gg_mcell`;`cc_gg_v11`];; +searcht 5 [`cell_cluster_estimate_v1`];; +searcht 5 [`TSKAJXY_statement`];; +searcht 10 [name "TSKAJXY"];; +searcht 5 [name "Zorn"];; +searcht 5 [`delta4_squared_y`;`x1_delta_y`];; +searcht 15 [`hminus`;`DECIMAL`];; +searcht 5 [`const1`;`pi`];; +searcht 5 [`sol0`;`DECIMAL`];; +Flyspeck_constants.bounds;; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas1.CON_ATREAL_REAL_CON;; +Print_types.print_term_types t';; +frees (concl Local_lemmas.EGHNAVX);; +bb 3;; +back_to "RIGHT_FORALL";; +(* Aug 4, 2013 *) +searcht 5 [`delta_x4`;`dih_x`];; +searcht 5 [`ups_x (a*a)`;`a*b*c`];; +searcht 5 [`&0 < x * y <=> &0 < y`];; +Sphere.delta4_y;; +Sphere.delta_y;; +searcht 5 [`atn2 (x,y)`;`x < y`];; +searcht 5 [`atn x < pi / &2`];; +searcht 5 [`atn (-- x)`];; +DIST_TRIANGLE;; +searcht 5 [`&0 <= delta_y y1 y2 y3 y4 y5 y6`;`dist`];; +searcht 5 [`cos`;`acs`;`pi`];; +searcht 5 [`sqrt x * sqrt x`];; +searcht 5 [`x pow 2 <= y pow 2`];; +searcht 5 [`abs x pow 2`];; +searcht 5 [name "1834"];; +searchl ineq_as_thm [`[(&2,y1,&2*h0);(&2,y2,&2*h0);(&2,y3,&2*h0);(&2,y4,&2*h0);(&2,y5,&2*h0);(&2,y6,&2*h0)]`];; +searcht 5 [`compact`;`real_continuous_on`];; +searcht 5 [`derived_form`;`dih_x`];; +searcht 5 [`taum`;`dih_x`];; +searcht 5 [`taum`;`dih_y`];; +Sphere.taum;; +searcht 5 [`taum`;`rhazim`];; +Sphere.rhazim;; +searcht 5 [`arclength`;`xrr`];; + + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas1.CON_ATREAL_REAL_CON;; +Print_types.print_term_types t';; +frees (concl Local_lemmas.EGHNAVX);; +bb 4;; +back_to "periodic2_mod_reduce";; +(* Aug 4, 2013 *) +searcht 5 [`rho`;`ly`];; +searcht 5 [`sol0`;`const1`];; +searcht 5 [`real_continuous`;`dih_y`];; +searcht 15 [`f o g`;`real_continuous`];; +searcht 5 [`(\t. t) real_continuous net`];; +searcht 5 [`real_continuous`;`has_real_derivative`];; +searcht 5 [`ups_x a b c = ups_x b a c`];; +searcht 5 [`real_compact`;`real_interval [a,b]`];; +searcht 5 [`real_continuous_on`;`real_continuous`];; +searcht 15 [`&0 < ups_x a b c`];; +searcht 5 [`c <= xrr a b d`];; +searcht 5 [`xrr a b c <= d`];; +searcht 5 [`&0 <= taum y1 y2 y3 y4 y5 y6`];; +searcht 5 [`c <= sqrt8`;`h0`];; +searcht 5 [`d_tame i = j`];; +searcht 5 [`scs_arrow_v39`;`scs_6I1`];; +searcht 5 [name "EAPG"];; +searcht 5 [`CONS a b = CONS a' b'`];; +searcht 26 [`s_init_list_v39`;`scs_6I1`];; +searcht 5 [name "periodic2";name "red"];; +searcht 5 [`funlist_v39`;`periodic2`];; +searcht 5 [`(i+k) MOD k`];; +searcht 5 [`{a,b} = {c,d}`];; +searcht 5 [`psort 5 (0,2)`];; +Ocbicby.psort_5;; +searcht 5 [`scs_arrow_v39`;`MMs_v39`];; +searcht 5 [name "OTMT"];; +searcht 5 [`is_scs_v39`;`scs_3T1`];; +searcht 5 [`BBs_v39`;`MMs_v39`];; +searcht 5 [`~(x = {})`;`?`];; +searcht 5 [`scs_basic_v39`;`scs_3T5`];; +searcht 5 [`mk_unadorned_v39`;name "explicit"];; +searcht 5 [`BBs_v39`;`MMs_v39`];; +searcht 5 [`psort 3 (0,1)`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas1.CON_ATREAL_REAL_CON;; +Print_types.print_term_types t';; +frees (concl Local_lemmas.EGHNAVX);; +bb 7;; +back_to "Cuxv";; +(* Aug 6, 2013 *) +searcht 5 [`5 MOD 4`];; +Cuxvzoz.deform_simplex_edge_exists;; +searcht 5 [`coplanar`;`azim`;`pi`;`&0`];; +searcht 5 [name "coplanar_cross_reduction"];; +searcht 20 [`azim`;`cross`;`dot`];; +searcht 15 [`coplanar`;`collinear`;`/\`];; +searcht 15 [`{a,b,c,d} = {a',b',c',d'}`];; +searcht 5 [`p MOD k < k`];; +searcht 5 [`((a MOD k) + b) MOD k`;omit `5`];; +searcht 5 [`(a + b) MOD k = (a + b') MOD k`];; +searcht 5 [`p MOD k MOD k`];; +searcht 5 [`3 MOD 4`];; +searcht 5 [`scs_diag k p q`];; + +searcht 5 [name "SKOLEM_EPSILON"];; +searcht 5 [name "SKOLEM";name "PERIODIC"];; +searcht 5 [`&0 < azim a b c d`;`deformation`];; +searcht 5 [`deformation`;`SUBSET`];; +searcht 5 [name "epsilon_quad"];; +searcht 5 [`collinear`;`ups_x`];; +help "RAND_CONV";; +help "RATOR_CONV";; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas1.CON_ATREAL_REAL_CON;; +Print_types.print_term_types t';; +frees (concl Local_lemmas.EGHNAVX);; +bb 5;; +back_to "STRONG";; +(* Aug 8, 2013 *) +searcht 5 [`convex_local_fan`;`interior_angle1`;`pi`];; +Cuxvzoz.WNWSHJT_ALT;; +UNDISCH Ocbicby.LEMMA_1834976363;; +searcht 50 [`azim`;`+`;`deformation`];; +Localization.deformation;; +searcht 5 [name "WNW"];; +searcht 15 [`~collinear s`;`continuous`];; +searcht 15 [`azim a b c d + azim a b d e`;`pi`;name "fan"];; +searcht 50 [`(azim a b c d) < pi `];; +searcht 5 [`d <= xrr a b c`];; +searcht 5 [`xrr a b c <= d`];; +searcht 5 [`&2 <= dist s`;`BBs_v39`];; +searcht 5 [`sqrt(x pow 2)`];; +searcht 15 [`x <= sqrt y`];; +searcht 5 [`coplanar`;`delta_y`];; +searcht 5 [`coplanar`;`collinear`;`/\`];; +searcht 5 [name "SUM_NUMSEG3"];; +Cuxvzoz.MMs_minimize_tau_fun;; +searcht 5 [`periodic`;`sum`];; +searcht 15 [`sum (a..b)`;`SUC`];; +searcht 5 [`sum (p..p)`];; +searcht 5 [`interior_angle1`;`azim`;`is_scs_v39`];; +REWRITE_RULE[LET_THM] Ocbicby.INTERIOR_ANGLE1_AZIM;; +searcht 5 [`(p + k) MOD k`];; +searcht 5 [name "LEMMA_684"];; +searcht 5 [`(p+k) MOD k`];; +searcht 5 [`i MOD k = i`];; +searcht 5 [`delta4_y`;`dih_y`];; +searcht 5 [`dihV`;`dih_y`];; +searcht 3 [`&0 <= delta_y a b c d e f`;`dist`];; +searcht 5 [`azim`;`dihV`;name "STRONG"];; +searcht 5 [`dihV`;`dih_y`];; +Merge_ineq.DIHV_EQ_DIH_Y;; +searcht 5 [`dih_y a b c d e f <= dih_y a b c d' e f`];; +searcht 5 [`arclength`;`atn`];; +searcht 15 [`sqrt x < y`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas1.CON_ATREAL_REAL_CON;; +Print_types.print_term_types t';; +frees (concl Local_lemmas.EGHNAVX);; +bb 3;; +back_to "edge lengths";; +(* Aug 11, 2013 *) +searcht 5 [`coplanar`;`azim`];; +searcht 3 [`is_scs_v39`;`&0 < azim a b c d`];; +searcht 5 [`&0 < delta_y a b c d e f`;`coplanar`];; +searcht 5 [`dih_y a b c d e f = dih_y a' b' c' d' e' f'`];; +searcht 5 [`x1_delta_y`];; +Trigonometry2.NOT_ZERO_EQ_POW2_LT;; +searcht 5 [`&0 <= delta_y a b c d e f`;`dist`];; +searcht 5 [`hypermap_of_list`];; +searcht 15 [`hypermap_of_list`];; +searcht 5 [name "lemma";name "merge"];; +searcht 5 [name "planar_hypermap"];; +searcht 5 [name "TGJ"];; +searcht 5 [name "samsara"];; +type_of `is_inj_list`;; +searcht 5 [name "ThreeDarts"];; +searcht 5 [name "is_loop"];; +searcht 5 [`x:(A) loop`];; +searcht 5 [name "iso";`iso`];; +searcht 5 [name "Quotient"];; +searcht 15 [name "lemmaNodalFixedPoint"];; +searcht 5 [`is_no_double_joins`];; +Hypermap.cycle;; +searcht 5 [name "dih2k"];; +Hypermap.lemma_mInside;; +Hypermap.lemmaHQYMRTX;; +searcht 50 [def "tame"];; +type_of `bn_cong_iso`;; +searcht 5[name "hypermap_of_list"];; +searcht 15 [`hypermap_of_list`];; +List_hypermap.good_list;; +searcht 5 [`MAP I`];; +searcht 5 [`IMAGE I`];; +searcht 15 [`good_list`;`hypermap_of_list`];; +searcht 5 [name "perm_eq"];; +searcht 15 [`perm_eq`];; +searcht 5 [`dropl 0`];; +searcht 5 [`cat s []`];; +searcht 5 [`acs`;`atn`];; +searcht 5 [`kepler_conjecture`;`packing`];; + + +searcht 5 [name "OEHDBEN"];; +let nd s = searcht 5 [name s];; +map nd ["OEHDBEN";"OTMTOTJ1";"OTMTOTJ3"];; +map nd ["CNICGSF"];; +map nd ["FYSSVEV";"ARDBZYE";"AUEAHEH";"VQFYMZY"];; +map nd ["VQFYMZY"];; +map nd ["BNAWVNH";"RAWZDIB";"MFKLVDK";"RYPDIXT"];; +map nd ["NWDGKXH";"YOBIMPP";"MIQMCSN";"BKOSSGE"];; +searcht 5 [`sin (x + y) = sin x`];; +open Counting_spheres;; +open Tactics_jordan;; +open Ysskqoy;; +open Hales_tactic;; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas1.CON_ATREAL_REAL_CON;; +Print_types.print_term_types t';; +frees (concl Local_lemmas.EGHNAVX);; +bb 3;; +back_to "edge lengths";; +(* Aug 15, 2013 *) + + + +searcht 5 [`delta`;`delta_x`];; +searchd [`delta`];; +searcht 5 [`b_coef`];; +searchd [`d3`];; +searcht 5 [`voronoi_trg`];; +searcht 5 [`voro2`];; +searcht 5 [`voronoi_open`];; +searchd [`cm3_ups_x`];; +searcht 5 [`cm3_ups_x`];; +searcht 5 [`condA`];; +List.length (definitions());; +searchd [`rho_ij`];; +searcht 5 [`rho_ij`;`rho_x`];; +searcht 15 [`chi`];; +searcht 5 [`the`];; +searcht 20 [`SOME x`];; +searcht 5 [`concat`];; +searcht 5 [`filter`;`FILTER`];; +searcht 5 [`filter`;`CONS`];; +searcht 5 [`f (CONS (x:A list) xs) = APPEND x (concat xs)`];; +searcht 5 [`MAP`;`map`];; +type_of `minimal`;; +searcht 50 [def "MIN"];; +searchd [`MIN`];; +searchd [`minn`];; +searcht 50 [`minn`];; +searcht 5 [`set_of_list []`];; +searcht 5 [`POWER`;`ITER`];; +let s1 t = searcht 5 [t];; +s1 `min_num`;; +searcht 5 [`min_num`;`INSERT`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas1.CON_ATREAL_REAL_CON;; +Print_types.print_term_types t';; +frees (concl Local_lemmas.EGHNAVX);; +bb 3;; +back_to "edge lengths";; +(* Aug 15, 2013 *) +Misc_defs_and_lemmas.min_least;; +searcht 5 [`MIN`];; +searcht 5 [`minn x y <= x`];; +searcht 5 [`set_of_list`;`{}`];; +Seq.filter;; +searcht 5 [`dropl (SUC n)`];; +Seq.take;; +SPEC_TAC;; +searcht 5 [`x ++ []`];; +Seq.rot;; +searcht 5 [`sol_euler_x`;`delta_x`];; +searchd [`dih4_x`];; +searcht 50 [`mardih6_x`];; +searcht 50 [`dih4_x`];; +searcht 50 [`domain6`];; +searcht 10 [`gamma3f_x_div_sqrtdelta`];; + +print_proof();; +Print_types.print_goal_types();; +Print_types.print_thm_types Local_lemmas1.CON_ATREAL_REAL_CON;; +Print_types.print_term_types t';; +frees (concl Local_lemmas.EGHNAVX);; +bb 3;; +back_to "edge lengths";; +(* Aug 19, 2013 *) +searcht 10 [`ldih6_x`];; +searchp [`vol3f_x_sqrt2_lmplus`];; +searchp [`arclength_x_123`];; +Nonlin_def.vol3f_x_sqrt2_lmplus;; +Sphere.rhazim_x;; +searcht 5 [name "sq_pow2"];; diff --git a/development/thales/ocaml/leech.ml b/development/thales/ocaml/leech.ml new file mode 100755 index 0000000..7491dc8 --- /dev/null +++ b/development/thales/ocaml/leech.ml @@ -0,0 +1,201 @@ + + + +(* Program to compute the constants in Leech's paper on 13 spheres *) +(* See essay on "THIRTEEN SPHERES" presentation of the mathematics involved. *) +(* code proofread 3/31/2008 *) + +(* assertions and general utilities *) +let assertions = ref true;; +let also_assert x = assertions := x && !assertions ; x;; + +let min_list it = List.fold_right min it (List.nth it 0);; +let max_list it = List.fold_right max it (List.nth it 0);; + +(* constants *) +let pi = 4.0 *. atan(1.0);; +let b = pi /. 3.0;; +let c = 1.42;; (* Approximates Leech's constant: acos (1.0/. 7.0). *) +let d = 1.7;; (* New constant used to estimate areas *) + +(* spherical law of cosines: gamma in terms of c b a *) +let gammaCBA c b a = + acos ((cos c -. cos a *. cos b)/. (sin a *. sin b));; + +(* c in terms of gamma a b *) +let cgammaAB gamma a b = + acos ( cos(gamma) *. sin(a) *. sin(b) +. cos(a) *. cos(b));; + +(* Girard's formula *) +let girard a b c = + a +. b +. c -. pi;; + +(* Area of a spherical triangle in terms of sides *) +let areaSSS a b c = + girard (gammaCBA a b c) (gammaCBA b c a) (gammaCBA c a b);; + +(* Area of a spherical triangle given two sides a b and circumradius r *) +(* There are generally two triangles when two sides and the circumradius are given. + This function returns the minimum of the two areas. + The triangle is discarded (assigning the default area) if the third + side has length less than cmin. *) + +let areaSSC a b r cmin default = + let alpha = gammaCBA a r r in + let beta = gammaCBA b r r in + let s = alpha +. beta in + let gamma = if (s < pi) then s else 2.0 *. pi -. s in + let c = cgammaAB gamma r r in + let area = if (cmin <= c) then (areaSSS a b c) else default in + let gamma2 = abs_float (alpha -. beta) in + let c2 = cgammaAB gamma2 r r in + let area2 = if (cmin <=c2) then (areaSSS a b c2) else default in + min area area2;; + + +(* Area of an equilateral triangle of minimum edge length *) +let delta = areaSSS b b b;; +also_assert(delta -. (3.0 *. acos(1.0/. 3.0) -. pi) < 1.0e-6);; + +(* Excess area on a sphere over 22 minimal triangles *) +let eps_computed = 4.0 *. pi -. 22.0 *. delta;; +let eps = 0.4381;; (* round up to get strict inequalities *) +also_assert (eps > eps_computed);; + +(* Compute minimum area of a triangle under edge length constraints. *) +let triangle_min a0 a1 b0 b1 c0 c1 = + min_list [ + areaSSS a0 b0 c0; + areaSSS a0 b0 c1; + areaSSS a0 b1 c0; + areaSSS a0 b1 c1; + areaSSS a1 b0 c0; + areaSSS a1 b0 c1; + areaSSS a1 b1 c0; + areaSSS a1 b1 c1; + ];; + +(* Calculate the constants in the table of areas in "THIRTEEN SPHERES" *) + +let default = delta +. 2.0*.eps;; (* anything bigger than delta + eps *) +let row1 = min (areaSSC c c b c default ) (areaSSS c c c);; +also_assert ((row1 -. (delta +. eps)) > 0.0 );; + +let row2 = min_list [ + areaSSS b c d; + areaSSS c c d; + areaSSC b c b d default; + areaSSC c c b d default; + areaSSC b d b c default; + areaSSC c d b b default; + ];; +also_assert ((row2 -. (delta +. eps)) > 0.0);; + +let row3 = triangle_min b c c d c d;; +also_assert ((row3 -. (delta +. eps/. 2.0)) > 0.0);; + +let row4 = triangle_min b c b c c d;; +also_assert((row4 -. (delta +. eps/. 4.0)) > 0.0);; + +let row5 = min_list [ + areaSSC b b b d default; + areaSSC c b b d default; + areaSSC c c b d default; + areaSSC d b b b default; + areaSSC d c b b default; + areaSSS b b d; + areaSSS b c d; + areaSSS c c d; + ];; +also_assert(row5 >= delta);; + +let row6 = triangle_min b c b c b c;; +also_assert(abs_float(row6 -. delta) < 1.0e-6);; + +(* compute Dmin in gamma_max table *) + +let b' = 1.15;; +let b'' = 1.251;; +let gammarow1 = min_list [ + areaSSS b b b; + areaSSS b b b'; + areaSSS b c b; + areaSSS b c b'; + areaSSS c c b; + areaSSS c c b'; +];; +also_assert(gammarow1 >= delta);; + +let gammarow2 = min_list [ + areaSSS b b b'; + areaSSS b b b''; + areaSSS b c b'; + areaSSS b c b''; + areaSSS c c b'; + areaSSS c c b''; +];; +also_assert(gammarow2 >= delta +. eps/. 12.0);; + +let gammarow3 = min_list [ + areaSSS b b b''; + areaSSS b b c; + areaSSS b c b''; + areaSSS b c c; + areaSSS c c b''; + areaSSS c c c; +];; +also_assert(gammarow3 >= delta +. eps/. 6.0);; + +(* compute max valence *) +let valence = let min_angle = min_list [ + (gammaCBA b b b); + gammaCBA b b c; + (gammaCBA b c c)] in + 2.0 *. pi /. min_angle;; (* 5.9753... *) +also_assert (valence < 6.0);; + +(* treat the degree six along a long edge as a degree 5 with one a quad *) + +(* check the angles > pi/2 on a quad with diags > 1.7 *) +let angle_bigquad = min_list [ + (gammaCBA d b b); + (gammaCBA d c b); + (gammaCBA d c c)] ;; +also_assert (angle_bigquad > pi/. 2.0);; + + +(* eliminate degree 4 vertices that are not on the oblong quad *) + +(* Some code to find max angle. *) +(* Run through all endpoints and all right angled triangles. *) + +let maxAngle a0 a1 b0 b1 c = + let angle00 = gammaCBA c a0 b0 in + let angle01 = gammaCBA c a0 b1 in + let angle10 = gammaCBA c a1 b0 in + let angle11 = gammaCBA c a1 b1 in + let angleRR = if (a0 <= pi/. 2.0) && (pi/. 2.0 <= a1) && + (b0 <= pi/. 2.0) && (pi/. 2.0 <= b1) then c else angle00 in + let u x = acos ( cos x *. cos c) in + let angleS x m m' = + let u = u x in + if (m <= u) && (u <= m') then gammaCBA c x u else angle00 in + max_list [angle00;angle01;angle10;angle11;angleRR; + (angleS a0 b0 b1);(angleS a1 b0 b1); + (angleS b0 a0 a1);(angleS b1 a0 a1)];; + +let r x = maxAngle b c b c x -. pi/. 2.0;; +r 1.15;; (* -0.21292 *) +r 1.251;; (* -0.0859 *) +r 1.42;; (* 0.13342 *) +also_assert (r 1.15 < -0.21);; +also_assert (r 1.251 < -0.08);; +also_assert (r 1.42 < 0.14);; +gammaCBA 1.15 b b -. pi/.2.0;; +gammaCBA 1.251 b b -. pi/.2.0;; +gammaCBA 1.42 b b -. pi/.2.0;; (* same answers! *) + +(* final assert to see that all the asserted conditions are met *) +let tell_me_it_works = !assertions;; + + diff --git a/development/thales/ocaml/rank_boost.hl b/development/thales/ocaml/rank_boost.hl new file mode 100644 index 0000000..207d7bf --- /dev/null +++ b/development/thales/ocaml/rank_boost.hl @@ -0,0 +1,142 @@ +(* Thomas Hales, June 29, 2011, + implementation of the rank boost algorithm from + "An Efficient Boosting Algorithm for Combining Preferences" + Freund, Iyer, Schapire, and Singer. + + The 'bottom' symbol _|_ is implemented by throwing an exception. + +*) + + +module Rank_boost = struct + +(**********************************************************************) +(* matrix ops *) + +let exp = Pervasives.exp;; + +let abs = Pervasives.abs_float;; + +let infinity = Pervasives.infinity;; + +let neg_infinity = Pervasives.neg_infinity;; + +let nth = List.nth;; + +let scale c = map ( ( *. ) c) ;; + +let outer_col_mul d v = + map (map2 ( *. ) v) d;; + +let outer_row_mul d v = + map2 scale v d;; + +let sum = end_itlist (+.);; + +(* examples *) + +outer_col_mul [[1.0;2.0];[3.0;4.0]] [7.0;11.0];; +outer_row_mul [[1.0;2.0];[3.0;4.0]] [7.0;11.0];; + +(**********************************************************************) +(* boost utilities *) + +let alpha_r r = 0.5 *. log ((1.0 +. r) /. (1.0 -. r));; + +let normalize d = + let total = sum (map sum d) in + map (scale (1.0 /. total)) d;; + +let mk_distrib phi X = + let row y = map (fun x -> max 0.0 (phi y x)) X in + normalize(map row X);; + +(* +let mk_uniform_distribution n = + let row = replicate 1.0 n in + normalize (replicate row n) ;; +*) + +let update_distribution distrib alpha hs = + let h1 = map (fun t -> exp(alpha *. t)) hs in + let h2 = map (fun t -> 1.0 /. t) h1 in + let d =outer_col_mul distrib h2 in + let d = outer_row_mul d h1 in + normalize d;; + +let sort_zipf f zX = + let zf = mapfilter (fun (i,x) -> (i,f x)) zX in + sort (fun (_,f1) (_,f2) -> f1 > f2) zf;; + +let mk_pi distrib = + let row_sums = map sum distrib in + let col_sums = end_itlist (map2 (+.)) distrib in + map2 ( -. ) row_sums col_sums;; + +(* weak_update + might behave slightly incorrectly when the optimal f' is a repeated value of f. + There is no problem, if the ranking f is strict. + + default_q currently doesn't get used in the end. *) + +let weak_update R pi default_q (L,r,theta,q) (i',f') = + let L = L +. nth pi i' in + let q' = match default_q with + Some q' -> q' + | None -> if (abs(L) > abs(L -. R)) then 0.0 else 1.0 in + if abs(L -. q *. R) > abs(r) then (L,L-. q*. R,f',q') else (L,r,theta,q);; + +let weak_learn_one pi default_q zf = + let R = List.fold_left (fun s (i,_) -> s +. nth pi i) 0.0 zf in + List.fold_left (weak_update R pi default_q) (0.0,0.0,Pervasives.infinity,0.0) zf ;; + +let weak_learn_all distrib ranks sfs = + let pi = mk_pi distrib in + let wl = weak_learn_one pi None in + let foldf (r,absr,fx,q,f) (zf,f') = + let (_,r',fx',q') = wl zf in + (if (abs r' > absr) then (r',abs r',fx',q',f') else (r,absr,fx,q,f)) in + let (r,_,theta,q,f) = List.fold_left foldf + (0.0,neg_infinity,0.0,0.0,(fun t ->0.0)) + (zip sfs ranks) in + let alpha = alpha_r r in + (alpha,q,theta,f);; + +let learned_h q theta f x = + try ( if f x >= theta then 1.0 else 0.0) with _ -> q;; + +(* example: *) + +sort_zipf I (zipX [2.0;3.0;4.0]);; +sort_zipf (fun t -> if t < 3.0 then t else failwith "bad") (zipX [7.0;4.0;3.0;2.0;2.5;1.0]);; +mk_pi [[1.0;2.0];[3.0;4.0]];; + +(**********************************************************************) +(* running the boost algorithm T times *) + +(* +X:A = domain +ranks:(A->real) list, (ranking functions) +phi:A -> A-> float, feedback function. +t=number of iterations, typically 40-150 range. paper uses 40+n/10, n=length ranks. +We don't preset theta, we compute it as some value fx. +*) + +let rec rank_boost t ranks wts distrib sfs X = + if (t=List.length wts) then wts + else + let (alpha,q,theta,f)=weak_learn_all distrib ranks sfs in + let h = learned_h q theta f in + let distrib' = update_distribution distrib alpha (map h X) in + rank_boost t ranks ((alpha,q,theta,f)::wts) distrib' sfs X;; + +let calc_wts X phi ranks t = + let distrib = mk_distrib phi X in + let zipX = zip (0--(List.length X - 1)) X in + let sfs = map (fun f -> sort_zipf f zipX) ranks in + rank_boost t ranks [] distrib sfs X;; + +let evalf wts x = List.fold_left + (fun s (alpha,q,theta,f) -> s +. alpha *. learned_h q theta f x) 0.0 wts;; + +end;; diff --git a/development/thales/ocaml/script.ml b/development/thales/ocaml/script.ml new file mode 100644 index 0000000..19e3179 --- /dev/null +++ b/development/thales/ocaml/script.ml @@ -0,0 +1,34 @@ +(* *) + +let scriptfile = ref "";; + + +let outlog = ref "/Users/thomashales/Dropbox/thacklog.hl";; +let errlog = ref "/Users/thomashales/Dropbox/thackerrory.hl";; +let sleep = ref (6);; +let emsg = ref "/";; +let msg = ref ".";; +scriptfile;; + +let doubleout fl s = + let _ = report s in + let _ = Parse_ineq.output_filestring fl s in + ();; + +doubleout !errlog "err";; +doubleout !outlog "ok";; + +let rec loop () = + let _ = try ( loadt (!scriptfile)) + with _ -> (doubleout (!errlog) (!emsg)) in + let _ = Unix.sleep(!sleep) in + let _ = doubleout (!outlog) (!msg) in + loop();; + + +loadt (!scriptfile);; +loop();; + + +Sys.command("date");; + diff --git a/development/thales/ocaml/sphere.ml b/development/thales/ocaml/sphere.ml new file mode 100644 index 0000000..bcb8509 --- /dev/null +++ b/development/thales/ocaml/sphere.ml @@ -0,0 +1,73 @@ +(* extracted from sphere.hl *) + +let sqrt8 = sqrt(8.0);; +let sqrt2 = sqrt(2.0);; +let pi = 4.0*.atan(1.0);; + +let delta_x x1 x2 x3 x4 x5 x6 = + x1*.x4*.(-. x1 +. x2 +. x3 -. x4 +. x5 +. x6) +. + x2*.x5*.(x1 -. x2 +. x3 +. x4 -. x5 +. x6) +. + x3*.x6*.(x1 +. x2 -. x3 +. x4 +. x5 -. x6) + -. x2*.x3*.x4 -. x1*.x3*.x5 -. x1*.x2*.x6 -. x4*.x5*.x6;; + +let delta_y y1 y2 y3 y4 y5 y6 = + delta_x (y1*.y1) (y2*.y2) (y3*.y3) (y4*.y4) (y5*.y5) (y6*.y6);; + +let delta_x4 x1 x2 x3 x4 x5 x6 + = -. x2*. x3 -. x1*. x4 +. x2*. x5 + +. x3*. x6 -. x5*. x6 +. x1*. (-. x1 +. x2 +. x3 -. x4 +. x5 +. x6);; + +let delta_x6 x1 x2 x3 x4 x5 x6 + = -. x1 *. x2 -. x3*.x6 +. x1 *. x4 + +. x2*. x5 -. x4*. x5 +. x3*.(-. x3 +. x1 +. x2 -. x6 +. x4 +. x5);; + +let ups_x x1 x2 x6 = + -. x1*.x1 -. x2*.x2 -. x6*.x6 + +. 2.0 *.x1*.x6 +. 2.0 *.x1*.x2 +. 2.0 *.x2*.x6;; + +let eta_x x1 x2 x3 = + (sqrt ((x1*.x2*.x3)/.(ups_x x1 x2 x3))) + ;; + +let eta_y y1 y2 y3 = + let x1 = y1*.y1 in + let x2 = y2*.y2 in + let x3 = y3*.y3 in + eta_x x1 x2 x3;; + +let atn2 (x,y) = atan(y/. x);; + +let dih_x x1 x2 x3 x4 x5 x6 = + let d_x4 = delta_x4 x1 x2 x3 x4 x5 x6 in + let d = delta_x x1 x2 x3 x4 x5 x6 in + pi/. (2.0) +. atn2( (sqrt ((4.0) *. x1 *. d)),-. d_x4);; + +let dih_y y1 y2 y3 y4 y5 y6 = + let (x1,x2,x3,x4,x5,x6)= (y1*. y1,y2*. y2,y3*. y3,y4*. y4,y5*. y5,y6*. y6) in + dih_x x1 x2 x3 x4 x5 x6;; + +let dih2_y y1 y2 y3 y4 y5 y6 = dih_y y2 y3 y1 y5 y6 y4;; + +let sol_x x1 x2 x3 x4 x5 x6 = + dih_x x1 x2 x3 x4 x5 x6 +. + dih_x x2 x3 x1 x5 x6 x4 +. dih_x x3 x1 x2 x6 x4 x5 -. pi;; + +let sol_y y1 y2 y3 y4 y5 y6 = + dih_y y1 y2 y3 y4 y5 y6 +. + dih_y y2 y3 y1 y5 y6 y4 +. dih_y y3 y1 y2 y6 y4 y5 -. pi;; + +let interp x1 y1 x2 y2 x = y1 +. (x -. x1) *. (y2-. y1)/. (x2-.x1);; + +(* c1 in lp2009.c *) +let const1 = sol_y (2.0) (2.0) (2.0) (2.0) (2.0) (2.0) /. pi;; + +let ly y = interp (2.0) (1.0) (2.52) (0.0) y;; + +let rho y = 1.0 +. const1 -. const1*. ly y;; + +let rhazim y1 y2 y3 y4 y5 y6 = rho y1 *. dih_y y1 y2 y3 y4 y5 y6;; + +let lnazim y1 y2 y3 y4 y5 y6 = ly y1 *. dih_y y1 y2 y3 y4 y5 y6;; + +let taum y1 y2 y3 y4 y5 y6 = sol_y y1 y2 y3 y4 y5 y6 *. (1.0 +. const1) -. const1 *. (lnazim y1 y2 y3 y4 y5 y6 +. lnazim y2 y3 y1 y5 y6 y4 +. lnazim y3 y1 y2 y6 y4 y5);; + diff --git a/development/thales/session/cleanup.hl b/development/thales/session/cleanup.hl new file mode 100644 index 0000000..c9cc2b3 --- /dev/null +++ b/development/thales/session/cleanup.hl @@ -0,0 +1,6 @@ + +let searchd pat = + searchl (map (fun t -> ("",t)) (definitions())) pat;; + +constants();; + diff --git a/development/thales/session/experiment_.hl b/development/thales/session/experiment_.hl new file mode 100644 index 0000000..59daf2c --- /dev/null +++ b/development/thales/session/experiment_.hl @@ -0,0 +1,489 @@ + +(* + + +The main thing that works well is the expanded SIMP_TAC, with custom local constants. +To do: + rehash local simp tac when new theorems are added, rather than have it rebuild with each call. + + +sectioning is + +*) + +(* experiments in revising proof style *) + +open Basics;; + +let section_stack = ref [];; + +let context = ref [];; + +let assumption_list = ref [];; + +let begin_section (s:string) = + section_stack := s:: !section_stack;; + +let get_section() = hd (!section_stack);; + +let end_section (s:string) = + let s1 = hd(!section_stack) in + let _ = (s1 = s) or failwith "section" in + let _ = section_stack := tl !section_stack in + let _ = context := filter (fun (s1,_) -> not(s1 = s)) !context in + ();; + +let declare t = + let _ = context := setify ((get_section(),t) :: !context) in + !context;; + + +(* from Hales_tactic *) + +let retype gls tm = + let varl = filter has_stv (setify(frees tm)) in + let svarl = map (fun t-> (fst(dest_var t),t)) varl in + let fn = fun buff (s,t) -> try (let (_,_,m)= term_match [] t (assoc s gls) in m @ buff) + with _ -> failwith ("not found: "^s) in + let tyassoc = List.fold_left fn [] svarl in + (instantiate ([],[],tyassoc)) tm ;; + +let get_env () = + map (fun (_,t) -> (fst (dest_var t),t)) !context;; + +let declare_as (v,t) = + let v1 = mk_var(v,mk_vartype("?1")) in + let t1 = map (fun t -> (fst (dest_var t),t)) (frees t) in + declare (retype (t1 @ (get_env())) v1);; + +let mk_assumption (s,t) = assumption_list := (get_section(),s,retype (get_env()) t) :: !assumption_list;; + +begin_section "stuff";; + +declare_as ("V",`packing V`);; + +declare `u0:real^3`;; +declare `u1:real^3`;; +declare `v1:real^3`;; +declare `v2:real^3`;; + +mk_assumption ("pV",`packing V`);; +mk_assumption ("sV",`saturated V`);; + +(* Augment simplification theorems. *) + + +let simp_thm_list = ref [];; +let add_simp_thm q = simp_thm_list := q::!simp_thm_list;; +let get_simp_thms () = (!simp_thm_list);; + + +let local_net_of_thm locals rep th = + let tm = concl th in + let lconsts = setify (union locals (freesl (hyp th))) in + let matchable = can o term_match lconsts in + match tm with + Comb(Comb(Const("=",_),(Abs(x,Comb(Var(s,ty) as v,x')) as l)),v') + when x' = x & v' = v & not(x = v) -> + let conv tm = + match tm with + Abs(y,Comb(t,y')) when y = y' & not(free_in y t) -> + INSTANTIATE(term_match [] v t) th + | _ -> failwith "REWR_CONV (ETA_AX special case)" in + enter lconsts (l,(1,conv)) + | Comb(Comb(Const("=",_),l),r) -> + if rep & free_in l r then + let th' = EQT_INTRO th in + enter lconsts (l,(1,REWR_CONV th')) + else if rep & matchable l r & matchable r l then + enter lconsts (l,(1,ORDERED_REWR_CONV term_order th)) + else enter lconsts (l,(1,REWR_CONV th)) + | Comb(Comb(_,t),Comb(Comb(Const("=",_),l),r)) -> + if rep & free_in l r then + let th' = DISCH t (EQT_INTRO(UNDISCH th)) in + enter lconsts (l,(3,IMP_REWR_CONV th')) + else if rep & matchable l r & matchable r l then + enter lconsts (l,(3,ORDERED_IMP_REWR_CONV term_order th)) + else enter lconsts(l,(3,IMP_REWR_CONV th));; + +help_grep "strip";; + +(* ex local var *) + +let post_rewrite = + let ex_local v thm = + EXISTS (mk_exists(v, (concl thm)),v) thm in + let ex_shared v thm = + let a4 = ASSUME (mk_exists (v,hd(hyp thm))) in + let a5 = EXISTS (concl a4,v) thm in + CHOOSE (v,a4) a5 in + let ex_comb local v thm = if (mem v local) then ex_local v thm else ex_shared v thm in + fun locals th -> + if (not (is_imp (concl th))) then th else + let (p,q) = dest_imp (concl th) in + let (evs,p') = strip_exists p in + let a1 = ASSUME p' in + let a2 = List.fold_right (ex_comb locals) evs a1 in + let a3 = DISCH_ALL a2 in + IMP_TRANS a3 th;; + +(* +let ex_local v thm = + EXISTS (mk_exists(v, (concl thm)),v) thm;; +let ex_shared v thm = + let a4 = ASSUME (mk_exists (v,hd(hyp thm))) in + let a5 = EXISTS (concl a4,v) thm in + CHOOSE (v,a4) a5;; +let ex_comb local v thm = if (mem v local) then ex_local v thm else ex_shared v thm;; + +let a0 = hd(mk_rewrites true LEAF_SQRT2 []);; +post_rewrite [x] a0;; + +a2;; +ex_shared x a2;; +ex_local v (ex_shared x a2);; + +let a0 = snd(post_rewrite [`V:real^3->bool`] (hd(mk_rewrites true LEAF_SQRT2 [])));; +let v = `V:real^3->bool`;; +let a1 = fst (EQ_IMP_RULE (REFL a0));; +let a2 = UNDISCH a1;; +let a3 = EXISTS (mk_exists(v, (concl a2)),v) a2;; +(* shared var *) +let x = `ul:(real^3)list`;; +let a4 = ASSUME (mk_exists(x, a0));; +let a5 = EXISTS (concl a4,x) a2;; +let a6 = CHOOSE(x,a4) a5;; + +add_simp_thm LEAF_SQRT2;; +mk_rewrites true LEAF_SQRT2 [];; +add_simp_thm (hd(mk_rewrites true (UNDISCH (SPEC_ALL LEAF_SQRT2)) []));; + +get_simp_thms();; + + (hd (hyp a2)) a2 + let evs'= subtract evs locals in + let p'' = list_mk_exists (evs',p') in + let p''p = (p''-> p) in + IMP_TRANS p''p th;; *) + + +let mk_local_rewrites locals thm sofar = + let rw = mk_rewrites true thm [] in + (map (post_rewrite locals) rw @ sofar);; + +let local_basic_ss = + fun thl -> + let local = map snd !context in + let rewmaker = mk_local_rewrites local in + let cthms = itlist rewmaker thl [] in + let net' = itlist (local_net_of_thm local true) cthms (basic_net()) in + let net'' = itlist net_of_cong (basic_congs()) net' in + Simpset(net'',basic_prover,[],rewmaker);; + +simp_thm_list;; + +let LOCAL_SIMPLIFY_CONV ss = GEN_SIMPLIFY_CONV TOP_DEPTH_SQCONV ss 8;; +let LOCAL_SIMP_CONV thl = LOCAL_SIMPLIFY_CONV (local_basic_ss []) ((get_simp_thms()) @ thl);; +let LOCAL_SIMP_RULE thl = CONV_RULE(LOCAL_SIMP_CONV thl);; +let LOCAL_SIMP_TAC thl = CONV_TAC(LOCAL_SIMP_CONV thl);; +let LOCAL_ASM_SIMP_TAC = ASM LOCAL_SIMP_TAC;; +let LOCAL_STEP_TAC () = RULE_ASSUM_TAC (LOCAL_SIMP_RULE (get_simp_thms())) THEN LOCAL_ASM_SIMP_TAC (get_simp_thms());; + + +(* GENERAL TACTIC KEYED TO TERMS *) + + +let act_list = ref [];; +let add_actionl p q = act_list := (p,q):: !act_list;; +let add_action = unlist add_actionl;; + + +let matchable s t = can(term_match[] s) t;; +let some_matchable s tl = exists (matchable s) tl;; +let all_matchable sl tl = forall (fun s -> some_matchable s tl) sl;; + +let actl pl = + let pl = map (retype (get_env())) pl in + let r = filter (fun (tl,_) -> all_matchable pl tl) !act_list in + let _ = (List.length r > 0) or failwith "act -- no match" in + snd(hd r);; + +let act = unlist actl;; + +let whatl patl = + let patl = map (retype (get_env())) patl in + let matcher u pat = can (find_term (can (term_match[] pat))) (concl u) in + let matches = filter (fun (_,u) -> forall (matcher u) patl) (!thm_list) in + matches;; + +let getl patl = + let w = whatl patl in + let _ = List.length w > 0 or failwith "no patterns" in + hd (map snd w);; + +let get = unlist getl;; + +add_action `&0 < sqrt x` (GMATCH_SIMP_TAC SQRT_POS_LT);; +add_action `&0 <= sqrt x` (GMATCH_SIMP_TAC SQRT_POS_LE);; +add_action `sqrt x <= sqrt y` (GMATCH_SIMP_TAC SQRT_MONO_LE_EQ);; +add_action `sqrt x < sqrt y` (GMATCH_SIMP_TAC SQRT_MONO_LT_EQ);; +add_action `&0 < x * y` (GMATCH_SIMP_TAC REAL_LT_MUL_EQ);; +add_action `x * x <= y * y` (GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE);; +add_action `&0 <= x/y` (GMATCH_SIMP_TAC REAL_LE_DIV);; +add_action `&0 <= x * y` (GMATCH_SIMP_TAC REAL_LE_MUL);; +add_action `&0 <= x * x` (REWRITE_TAC[ REAL_LE_SQUARE]);; +add_action `&0 <= x pow 2` (REWRITE_TAC[ REAL_LE_POW_2]);; +add_action `sqrt x pow 2` (GMATCH_SIMP_TAC SQRT_POW_2);; +add_action `x /z <= y` (GMATCH_SIMP_TAC REAL_LE_LDIV_EQ);; +add_action `&0 <= x pow 2` (REWRITE_TAC[ REAL_LE_POW_2]);; +add_action `x < sqrt y` (GMATCH_SIMP_TAC REAL_LT_RSQRT);; +add_action `x /z <= y/ z` (GMATCH_SIMP_TAC REAL_LE_DIV2_EQ);; +add_action `sqrt(y*y)` (GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx);; +add_action `x * y <= x * z` (GMATCH_SIMP_TAC Real_ext.REAL_LE_LMUL_IMP);; +add_action `x < y/ z` (GMATCH_SIMP_TAC REAL_LT_RDIV_EQ);; +add_action `&0 < x/y` (GMATCH_SIMP_TAC REAL_LT_DIV);; +add_action `sqrt x * sqrt y` (GMATCH_SIMP_TAC (GSYM SQRT_MUL));; +add_action `x * x < y * y` (GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE);; +add_action `x * y < x * z` (GMATCH_SIMP_TAC REAL_LT_LMUL_EQ);; +add_action `x <= y/z` (GMATCH_SIMP_TAC REAL_LE_RDIV_EQ);; +add_action `inv y <= inv x` (GMATCH_SIMP_TAC REAL_LE_INV2);; +add_action `&0 < inv x` (GMATCH_SIMP_TAC REAL_LT_INV);; + +add_thm `(x:A) IN {}` NOT_IN_EMPTY;; +add_thm `&x < &y`( REAL_OF_NUM_LT);; +add_thm `&x <= &y`( REAL_OF_NUM_LE);; +add_thm `&0 <= inv x`(REAL_LE_INV_EQ);; +add_thm `&0 < inv x`(REAL_LT_INV_EQ);; +add_thm `abs(a*b)`(REAL_ABS_MUL);; +add_thm `inv (&0) = &0` REAL_INV_0;; +add_thm `hl [u0:real^A; u1]` Marchal_cells_3.HL_2;; + +add_thm `~(n = 0)` (ARITH_RULE `1 < n ==> ~(n = 0)`);; + +get `a \/ b`;; +getl [`a:bool`;`inv (&0)`];; +get `hl [u0;u1]`;; +get `~(t = 0)`;; +!thm_list;; +get `int_of_num`;; + + + +(* auto matches pattern anywhere and does a sub1 repeatedly at the end of each proof step *) + + +let LIST_PROPS = map (fun t -> prove_by_refinement(t,[ BY(REWRITE_TAC[Bump.EL_EXPLICIT;set_of_list;LENGTH])])) + [ + `!(x:A) y. EL 0 (CONS (x:A) y) = x`; + `!(x:A) y. EL 1 (CONS (x:A) y) = EL 0 y`; + `!(x:A) y. EL 2 (CONS (x:A) y) = EL 1 y`; + `!(x:A) y. EL 3 (CONS (x:A) y) = EL 2 y`; + `!(x:A) y. set_of_list (CONS x y) = x INSERT (set_of_list y)`; + `set_of_list ([]:(A)list) = {}`; + `LENGTH ([]:(A)list) = 0`; + `!x y. LENGTH (CONS (x:A) y) = SUC (LENGTH y)` + ];; + +map add_simp_thm LIST_PROPS;; + +map add_simp_thm + [ + INITIAL_SUBLIST_CONS; + INITIAL_SUBLIST_NIL; + TRUNCATE_SIMPLEX0; + LENGTH_TRUNCATE_SIMPLEX; + TRUNCATE_SIMPLEX_CONS; + CONS_11; + TRUNCATE_SIMPLEX_EXPLICIT; + ];; + +let XIN_BARV = prove_by_refinement( + `!V u k. u IN barV V k <=> barV V k u`, + (* {{{ proof *) + [ +BY(REWRITE_TAC[IN]) + ]);; + (* }}} *) + +add_simp_thm XIN_BARV;; + +let LEAF_BARV = prove_by_refinement( + `!V ul. leaf V ul ==> barV V 2 ul`, + (* {{{ proof *) + [ + BY(MESON_TAC[Leaf_cell.leaf;IN]) + ]);; + (* }}} *) + +add_simp_thm LEAF_BARV;; + +add_simp_thm Sphere.sqrt2;; + + +(* has variable in antecedent problem *) + +let LEAF_SQRT2 = prove_by_refinement( + `!V ul. leaf V ul ==> hl ul < sqrt(&2)`, + (* {{{ proof *) + [ + BY(MESON_TAC[Leaf_cell.leaf;IN;Sphere.sqrt2]) + ]);; + (* }}} *) + +(* + +auto (`EL 0 (CONS (x:A) y)`,EL0_CONS);; +auto (`EL 1 (CONS (x:A) y)`,EL1_CONS);; +auto (`EL 2 (CONS (x:A) y)`,EL2_CONS);; +auto (`EL 3 (CONS (x:A) y)`,EL3_CONS);; +auto (`set_of_list (CONS (x:A) y)`,SET_OF_LIST_CONS);; +auto (`set_of_list []`,SET_OF_LIST_EMPTY);; +auto (`truncate_simplex 0 (CONS x y)`, +auto (`truncate_simplex 1 (CONS x y)`, +auto (`truncate_simplex 2 (CONS x y)`, +auto (`truncate_simplex 3 (CONS x y)`, +auto (`truncate_simplex 0 ul = [EL 0 ul]`, +auto (`HD ul`) +auto (`x IN barV V k`) +assumption `saturated V`;; + +*) + +add_simp_thm (arith `1 < 2`);; +add_simp_thm (LE_REFL);; + +add_simp_thm Fan.th3a;; + +let REUHADY = prove_by_refinement( + `!V u0 u1 v1 v2. + saturated V /\ packing V /\ leaf V [u0;u1;v1] /\ leaf V [u0;u1;v2] /\ + ~(v1 =v2) ==> + sum {X | mcell_set V X /\ {u0,u1} IN edgeX V X /\ X SUBSET wedge_ge u0 u1 v1 v2} + (\t. dihX V t (u0,u1)) = azim u0 u1 v1 v2`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC Reuhady.REUHADY1; + GEXISTL_TAC [`[u0;u1;v1]`;`[u0;u1;v2]`]; + LOCAL_STEP_TAC(); + TYPIFY `hl [u0;u1] < sqrt(&2)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + INTRO_TAC Rogers.XNHPWAB4 [`V`;`[u0;u1;v1]`;`2`]; + LOCAL_STEP_TAC(); + DISCH_THEN (C INTRO_TAC [`1`;`2`]); + LOCAL_STEP_TAC(); + TYPIFY `hl [u0;u1;v1] < sqrt (&2)` ENOUGH_TO_SHOW_TAC; + BY(REAL_ARITH_TAC); + BY(LOCAL_STEP_TAC()); + TYPIFY `~collinear (set_of_list [u0; u1; v1]) /\ ~collinear (set_of_list [u0; u1; v2])` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Leaf_cell.GBEWYFX]); + LOCAL_STEP_TAC(); + ASM_SIMP_TAC[Leaf_cell.WEDGE_GE_ALMOST_DISJOINT]; + TYPIFY `~(u0 = u1)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]); + TYPIFY `u0 IN V /\ u1 IN V` (C SUBGOAL_THEN (unlist ASM_REWRITE_TAC)); + INTRO_TAC Packing3.BARV_SUBSET [`V`;`2`;`[u0;u1;v1]`]; + LOCAL_STEP_TAC(); + BY(SET_TAC[]); + SUBCONJ_TAC; + ASM_SIMP_TAC[Local_lemmas.AZIM_EQ_0_GE_ALT2]; + DISCH_TAC; + INTRO_TAC Leaf_cell.FCHKUGT [`V`;`u0`;`u1`;`v1`;`v2`]; + LOCAL_STEP_TAC(); + REWRITE_TAC[Leaf_cell.cc_A0]; + LOCAL_STEP_TAC(); + MATCH_MP_TAC Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MP_TAC; + GMATCH_SIMP_TAC Collect_geom.IN_AFF_GE_INTERPRET_TO_AFF_GT_AND_AFF; + LOCAL_STEP_TAC(); + REWRITE_TAC[Collect_geom.aff]; + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM (MP_TAC o (MATCH_MP AFFINE_HULL_3_IMP_COLLINEAR)); + BY(ASM_MESON_TAC[]); + DISCH_TAC; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC Leaf_cell.EWYBJUA; + TYPIFY `V` EXISTS_TAC; + BY(LOCAL_STEP_TAC()) + ]);; + (* }}} *) + +let LEAF_RANKING_LEMMA = prove_by_refinement( + `!V ul w0 n. 0 < n /\ packing V /\ saturated V /\ + s_leaf V ul HAS_SIZE n /\ + ~collinear {EL 0 ul,EL 1 ul,w0} ==> + (?f. IMAGE f (:num) = s_leaf V ul /\ + (!i. f (i + n) = f i) /\ + (!i j. i < n /\ j < n /\ i < j ==> azim (EL 0 ul) (EL 1 ul) w0 (f i) < azim (EL 0 ul) (EL 1 ul) w0 (f j)))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `(s:real^3->bool) = s_leaf V ul` TYPED_ABBREV_TAC; + TYPIFY `!x. x IN s ==> ~(collinear {EL 0 ul,EL 1 ul,x})` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[s_leaf_collinear]); + INTRO_TAC STRICT_SORT_FINITE [`\v w. (azim (EL 0 ul) (EL 1 ul) w0 v <= azim (EL 0 ul) (EL 1 ul) w0 w)`;`s`;`n` ]; + BETA_TAC; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ2_TAC; + BY(REAL_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + TYPIFY `azim (EL 0 ul) (EL 1 ul) w0 x = azim (EL 0 ul) (EL 1 ul) w0 y ==> (x = y)` ENOUGH_TO_SHOW_TAC; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + DISCH_TAC; + MATCH_MP_TAC Leaf_cell.FCHKUGT; + GEXISTL_TAC [`V`;`EL 0 ul`;`EL 1 ul`]; + REWRITE_TAC[Leaf_cell.cc_A0]; + REWRITE_TAC[Bump.EL_EXPLICIT]; + FIRST_ASSUM (C INTRO_TAC [`x`]); + FIRST_X_ASSUM (C INTRO_TAC [`y`]); + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `azim` MP_TAC; + ASM_SIMP_TAC[AZIM_EQ_ALT]; + BY(ASM_MESON_TAC[Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ;s_leaf_leaf]); + REPEAT WEAK_STRIP_TAC; + TYPIFY `\i. f (SUC (i MOD n))` EXISTS_TAC; + BETA_TAC; + CONJ2_TAC; + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC MOD_MULT_ADD [`1`;`n`;`i`]; + REWRITE_TAC[arith `1 * n + i = i + n`]; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[]); + REPEAT WEAK_STRIP_TAC; + ASM_SIMP_TAC[MOD_LT]; + FIRST_X_ASSUM (C INTRO_TAC [`SUC i`;`SUC j`]); + REWRITE_TAC[arith `~(a <= b) <=> (b b) /\ (b ==> a)) ==> (a = b)`); + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + TYPIFY `SUC (x' MOD n)` EXISTS_TAC; + ASM_REWRITE_TAC[IN_NUMSEG]; + REWRITE_TAC[arith `1 <= SUC x`]; + REWRITE_TAC[arith `SUC x <= n <=> x < n`]; + BY(ASM_MESON_TAC[DIVISION;arith `~(n=0) <=> (0 < n)`]); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `PRE x'` EXISTS_TAC; + AP_TERM_TAC; + TYPIFY `PRE x' MOD n = PRE x'` (C SUBGOAL_THEN SUBST1_TAC); + MATCH_MP_TAC MOD_LT; + FIRST_X_ASSUM_ST `IN` MP_TAC; + REWRITE_TAC[IN_NUMSEG]; + BY(ARITH_TAC); + FIRST_X_ASSUM_ST `IN` MP_TAC; + REWRITE_TAC[IN_NUMSEG]; + BY(ARITH_TAC) + ]);; + (* }}} *) + diff --git a/development/thales/session/localbuild.hl b/development/thales/session/localbuild.hl new file mode 100644 index 0000000..3a8bea9 --- /dev/null +++ b/development/thales/session/localbuild.hl @@ -0,0 +1,66 @@ +(* Nov 2010 *) + + +(* Desktop init. *) + +let set_load_path() = ( load_path:= + let dir = (Sys.getenv "FLYSPECK_DIR") in + let jdir = Filename.concat dir "../jHOLLight" in + dir::jdir::(!load_path));; + +let general_init() = + let _ = set_load_path() in + needs "strictbuild.hl";; + +general_init();; +(* #load "unix.cma";; (* dynamic loading not supported *) *) + +(* Build.build_all();; *) +flyspeck_needs"build.hl";; +reneeds "strictbuild.hl";; + +(* map reneeds Build.build_sequence;; *) +let _ = set_load_path() in + build_silent();; +build_and_report();; +Debug.silent:=true;; (* don't print debug error messages *) +reset();; + + +new_build_silent();; +new_build_silent();; + +(* searching *) + +let open_search = + let _ = flyspeck_needs "general/tactics.hl" in + let _ = flyspeck_needs "usr/thales/hales_tactic.hl" in + let _ = reneeds "usr/thales/searching.hl" in + let _ = reneeds "usr/thales/init_search.hl" in ();; + +open Searching;; +open Hales_tactic;; + +(* END LOCAL BUILD *) + + + +(* SEARCH *) + +help "ABBREV_TAC";; +help "help";; +help_grep "ASM";; +help_grep "apropos";; +help_flag 'i' "r.*w";; +help_flag 'l' "search";; +help_flag '?' "";; +help_flag 'd' "face";; + +help "apropos_searching";; +help "apropos_types";; + + +(* load misc files *) + + +(* fin *) diff --git a/development/thales/session/scratch.hl b/development/thales/session/scratch.hl new file mode 100644 index 0000000..4b4c983 --- /dev/null +++ b/development/thales/session/scratch.hl @@ -0,0 +1,3831 @@ +#print_length 50;; + +flyspeck_needs "../glpk/minorlp/tame_table.ml";; +let process_exec = Preprocess.exec();; +flyspeck_needs "nonlinear/prep.hl";; + +flyspeck_needs "computational_build.hl";; +Preprocess.prep_file;; + + + + +Tame_table.execute();; + +flyspeck_needs "usr/thales/hales_tactic.hl";; +flyspeck_needs "general/debug.hl";; +flyspeck_needs "volume/vol1.hl";; +flyspeck_needs "hypermap/bauer_nipkow.hl";; +needs "Multivariate/convex.ml";; +rflyspeck_needs "local/polar_fan.hl";; +rflyspeck_needs "local/lp_details.hl";; +flyspeck_needs "local/polar.hl";; +flyspeck_needs "local/localization.hl";; +flyspeck_needs "local/local_lemmas1.hl";; +flyspeck_needs "packing/YSSKQOY.hl";; +flyspeck_needs "packing/counting_spheres.hl";; +rflyspeck_needs "jordan/refinement.hl";; +rflyspeck_needs "jordan/parse_ext_override_interface.hl";; +rflyspeck_needs "jordan/real_ext.hl";; +rflyspeck_needs "jordan/taylor_atn.hl";; +rflyspeck_needs "jordan/parse_ext_override_interface.hl";; +flyspeck_needs "general/print_types.hl";; + +flyspeck_needs "local/RRCWNSJ.hl";; +flyspeck_needs "local/JCYFMRP.hl";; +flyspeck_needs "local/TFITSKC.hl";; +flyspeck_needs "local/CQAOQLR.hl";; +flyspeck_needs "local/JLXFDMJ.hl";; +flyspeck_needs "leg/geomdetail.hl";; +flyspeck_needs "local/local_lemmas1.hl";; + + +flyspeck_needs "local/ARDBZYE.hl";; +flyspeck_needs "local/AUEAHEH.hl";; +flyspeck_needs "local/VASYYAU.hl";; +flyspeck_needs "local/MIQMCSN.hl";; +flyspeck_needs "local/JEJTVGB.hl";; + +flyspeck_needs "local/yxionxl.hl";; +flyspeck_needs "local/ODXLSTCv2.hl";; +flyspeck_needs "local/ZLZTHIC.hl";; +flyspeck_needs "local/lunar_deform.hl";; +Lunar_deform.MHAEYJN;; +flyspeck_needs "local/NUXCOEA.hl";; +flyspeck_needs "packing/Oxl_def.hl";; +flyspeck_needs "packing/Oxl_2012.hl";; + + +let fn = flyspeck_needs;; +fn "local/appendix_main_estimate.hl";; +fn "local/ODXLSTCv2.hl";; +fn "local/IMJXPHR.hl";; +fn "local/NUXCOEA.hl";; +fn "local/FEKTYIY.hl";; +fn "local/AURSIPD.hl";; +fn "local/PPBTYDQ.hl";; +fn "local/AXJRPNC.hl";; +fn "local/YRTAFYH.hl";; +fn "local/WKEIDFT.hl";; +fn "local/hexagons.hl";; + fn "local/OTMTOTJ.hl";; + fn "local/HIJQAHA.hl";; + fn "local/CNICGSF.hl";; +fn "local/BKOSSGE.hl";; +fn "local/IUNBUIG.hl";; +flyspeck_needs "local/JOTSWIX.hl";; + +flyspeck_needs "local/IUNBUIG.hl";; + + +flyspeck_needs "local/";; +Yxionxl2 +flyspeck_needs "general/flyspeck_lib.hl";; +flyspeck_needs "local/Xivphks.hl";; +flyspeck_needs "local/EYYPQDW.hl";; (* 2013-07-08 *) +flyspeck_needs "local/IMJXPHR.hl";; +Imjxphr.ZLZTHICv1_concl;; +Appendix.ZLZTHIC_concl;; +Imjxphr.IMJXPHR;; +State_manager.neutralize_state();; +rflyspeck_needs "nonlinear/lemma.hl";; +rflyspeck_needs "nonlinear/functional_equation.hl";; +Ineq.ineqs:= [];; +rflyspeck_needs "nonlinear/ineq.hl";; +rflyspeck_needs "nonlinear/main_estimate_ineq.hl";; +rflyspeck_needs "nonlinear/parse_ineq.hl";; +rflyspeck_needs "nonlinear/optimize.hl";; +rflyspeck_needs "general/flyspeck_lib.hl";; +rflyspeck_needs "nonlinear/function_list.hl";; +rflyspeck_needs "nonlinear/auto_lib.hl";; +rflyspeck_needs "nonlinear/scripts.hl";; +Scripts.execute_interval_all false;; +Scripts.execute_cfsqp();; +let cfsqp_out = it;; +cfsqp_out;; +Scripts.one_cfsqp "QZECFIC wt0";; +Scripts.cfsqp ["QZECFIC wt0";"QZECFIC wt0 corner";"QZECFIC wt0 sqrt8";"QZECFIC wt1";"QZECFIC wt2 A"];; +Scripts.cfsqp ["IXPOTPA"; "GRKIBMP B V2"; "7796879304"; "8346775862"];; +;; + +List.length !Ineq.ineqs;; + +let idvs = Flyspeck_lib.nub (sort (<) (map (fun t -> t.idv) (!Ineq.ineqs)));; +List.length idvs;; + +flyspeck_needs "nonlinear/calc_derivative.hl";; +flyspeck_needs "nonlinear/merge_ineq.hl";; +rflyspeck_needs "nonlinear/scripts.hl";; +(* Scripts.execute_interval_all true;; (* takes several hours *) *) +Scripts.unfinished_cases();; +let reruns = ["6843920790"; (* "9563139965D" ; *) "6944699408 a reduced"; "6944699408 a"; + "7043724150 a reduced v2"; "7043724150 a"; "8055810915"; "1965189142 34"; + "TSKAJXY-eulerA"];; +map (Auto_lib.testsplit true) ["8055810915"];; + + +Scripts.times;; +Scripts.hour (Scripts.total Scripts.times);; +Scripts.case_splits_execute;; + +let redo (s,cs,t) = + let rg = 0--(t-1) in + let cs' = subtract rg cs in + map (fun c -> (s,c,t)) cs';; + +let redos = List.flatten (map redo incompletes);; + + +(!Prep.prep_ineqs);; + + +map (test_prep_case_split true) redos;; + + +test_prep_case true 1 2 "GRKIBMP A V2";; + +Auto_lib.testsplit true "GRKIBMP A V2";; + +let some_cases = filter (fun (_,t) -> t > 300) Scripts.times;; +let some_cases = filter (fun (_,t) -> t > 120) times;; +total some_cases;; +assoc "3862621143 revised" times;; +assoc "7043724150 a" times;; +assoc "9507202313" times;; + +Scripts.hour (Scripts.total some_cases);; +List.length some_cases;; +783.0 /. 60.0;; + +flyspeck_needs "general/flyspeck_lib.hl";; +flyspeck_needs "../glpk/glpk_link.ml";; +flyspeck_needs "../glpk/minorlp/OXLZLEZ.ml";; + "local/UAGHHBM.hl";; +flyspeck_needs "packing/oxl_def.hl";; +flyspeck_needs "packing/oxl_2012.hl";; +flyspeck_needs "packing/OXLZLEZ.hl";; +Oxlzlez.PACKING_CHAPTER_MAIN_CONCLUSION;; + +Mk_all_ineq.example2;; +Mk_all_ineq.exec();; +rflyspeck_needs "../projects_discrete_geom/bezdek_reid/bezdek_reid.hl";; +let filter_edge_bak = Bezdek_reid.filter_edge;; + +1;; +Bezdek_reid.test_edge;; +Bezdek_reid.test_triplet;; +zip;; +flyspeck_needs "../glpk/glpk_link.ml";; +rflyspeck_needs "../projects_discrete_geom/fejestoth12/lipstick_ft.ml";; +List.length Bezdek_reid.filter_triplet;; +List.length (filter (fun (a,_,_) -> (a =[])) Bezdek_reid.coord_triplet);; +let test = ref "";; + +flyspeck_needs "nonlinear/check_completeness.hl";; + let check_completeness_out = Check_completeness.execute();; + +rflyspeck_needs "nonlinear/types.hl";; +rflyspeck_needs "nonlinear/nonlin_def.hl";; +rflyspeck_needs "nonlinear/ineq.hl";; +rflyspeck_needs "nonlinear/mdtau.hl";; +rflyspeck_needs "nonlinear/main_estimate_ineq.hl";; +rflyspeck_needs "nonlinear/lemma.hl";; (* needs trig1, trig2 *) +rflyspeck_needs "nonlinear/functional_equation.hl";; +rflyspeck_needs "nonlinear/parse_ineq.hl";; +rflyspeck_needs "nonlinear/optimize.hl";; +rflyspeck_needs "nonlinear/function_list.hl";; +rflyspeck_needs "nonlinear/auto_lib.hl";; +rflyspeck_needs "nonlinear/scripts.hl";; +flyspeck_needs "local/XBJRPHC.hl";; + + +(* Formal LP verification *) +needs "../formal_lp/hypermap/verify_all.hl";; +let result = Verify_all.verify_all();; +Verify_all.test_result result;; +List.length result;; +List.length (List.flatten (map fst result));; +List.nth result 77;; +(73386.0 /. 3600.0);; + + +(* + +Issues: + +The zip file unpacked to glpk/binary/lp_certificates/. +I had to move the files to glpk/binary/ + +The directory glpk/binary/ has hiddedn files .DS_Store and .svn +Verify_all.verify_all() tried: +Verifying /Users/thomashales/Desktop/googlecode/flyspeck/text_formalization/../formal_lp/glpk/binary/.DS_Store +and threw an exception. + +*) + + + open Pent_hex;; + open Optimize;; +flyspeck_needs "../development/thales/session/local_defs.hl";; +flyspeck_needs "../development/thales/session/interval_args.hl";; +flyspeck_needs "../development/thales/session/2app.hl";; + +(* Local materials *) +Ineq.ineqs:= [];; +rflyspeck_needs "nonlinear/ineq.hl";; +rflyspeck_needs "nonlinear/main_estimate_ineq.hl";; +List.length !Ineq.ineqs;; +flyspeck_needs "local/appendix_main_estimate.hl";; + + + rflyspeck_needs "local/appendix_main_estimate.hl";; + flyspeck_needs "local/terminal.hl";; + +flyspeck_needs "local/lunar_deform.hl";; + +flyspeck_needs "local/terminal.hl";; +flyspeck_needs "local/pent_hex.hl";; +flyspeck_needs "local/OCBICBY.hl";; +flyspeck_needs "local/YXIONXL2.hl";; +flyspeck_needs "local/XIVPHKS.hl";; +flyspeck_needs "local/ZLZTHIC.hl";; +flyspeck_needs "local/PQCSXWG.hl";; +flyspeck_needs "local/CUXVZOZ.hl";; + open Cuxvzoz;; + +flyspeck_needs "../development/thales/session/work_in_progress.hl";; + + open Work_in_progress;; + + +let strip_id s = + let ss = Str.split (Str.regexp "[],[]") s in + (hd ss,map int_of_string (tl ss));; + +strip_id "abc[0,1,2,3]";; + +0.0659/. 0.042;; + + +module Temp = struct + open Sphere;; + open Ineq;; +add +{ + idv="2485876245b"; + doc="Used in some quad calculations to show that a node + is not straight (both halves are acute)"; + tags=[Flypaper[];Main_estimate;Cfsqp;Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); + (#3.01,y5, &2 * #2.52); + (&2,y6,#3.01) + ] +((delta4_y y1 y2 y3 y4 y5 y6 > &0) \/ (delta_y y1 y2 y3 y4 y5 y6 < &0))`; +};; +end;; + +let ztg4s = map (fun t -> t.idv) (Ineq.getprefix "ZTGIJCF4");; +cfsqp ztg4s;; + +module Test = struct + open Ineq;; + open Sphere;; +add +{ + idv = "test QITNPEA 3848804089"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (#2 ,y4, &2 * hminus); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun - #0.164017 + #0.119482* dih_y y1 y2 y3 y4 y5 y6 > #0.0) \/ (eta_y y1 y2 y6 pow 2 < #1.34 pow 2 )) `; + doc = " + This is an inequality for quarters used to prove the cluster inequality."; + tags=[Marchal;Cfsqp;Clusterlp;Flypaper["OXLZLEZ"];Tex;Xconvert;Branching;Split[0]]; +};; +add +{ + idv = "MMGKNVE"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (&2,y4, &2 * hminus); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun + #0.0539 + - #0.042*dih_y y1 y2 y3 y4 y5 y6 > #0.0) \/ + (eta_y y1 y2 y6 pow 2 < #1.34 pow 2 ))`; + doc = " + This is an inequality for quarters used to prove the cluster inequality."; + tags=[Marchal;Cfsqp;Flypaper["OXLZLEZ"];Clusterlp;Tex;Xconvert;Branching;Split[0]]; +};; +add +{ + idv = "test BIXPCGW 9455898160"; + ineq = all_forall `ineq + [(&2 * hminus, y1, #2.6); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (&2,y4, &2 * hminus); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ( + gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun > &0) `; + doc = " + If $X$ is a quarter, then $\\gamma(X,L)\\ge -0.00569$."; + tags=[Marchal;Flypaper["OXLZLEZ";];Cfsqp;Clusterlp;Tex;Xconvert;Branching;Split[0]]; +};; +add +{ + idv = "test ratio2"; + ineq = all_forall `ineq + [(&2 * hminus, y4, &2 * hplus); + (&2 ,y5, sqrt8); + (&2 ,y6, sqrt8) + ] + ( truncate_gamma3f_x (#0.001) (h0cut y4) (h0cut y5) (h0cut y6) (&2) (&2) (&2) (y4*y4) (y5*y5) (y6*y6) / + (&1* dih_y y4 y5 sqrt2 sqrt2 sqrt2 y6) > &0 \/ + eta_y y4 y5 y6 > sqrt2 - #0.001 + \/ + eta_y y4 y5 y6 < #1.34 + )`; + doc = "test"; + tags=[Marchal;Flypaper["OXLZLEZ";];Cfsqp;Clusterlp;Tex;Xconvert;Branching;Split[0]]; +};; +add +{ + idv = "test gamma23"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (&2,y4, sqrt8); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ( +y_of_x (truncate_gamma3f_x #0.0 (h0cut y1) (&1) (&1)) (&0) (&0) (&0) y1 y2 y6 + +y_of_x (truncate_gamma3f_x #0.0 (h0cut y1) (&1) (&1)) (&0) (&0) (&0) y1 y3 y5 + + (dih_y y1 y2 y3 y4 y5 y6 - + (dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + + dih_y y1 sqrt2 y3 sqrt2 y5 sqrt2)) * #0.008 > &0 \/ + rad2_y y1 y2 y3 y4 y5 y6 < &2 \/ + eta_y y1 y2 y6 > #1.34 \/ + eta_y y1 y3 y5 > #1.34 \/ + dih_y y1 y2 y3 y4 y5 y6 < #1.946 \/ + dih_y y1 y2 y3 y4 y5 y6 > #2.089)`; + doc = "test"; + tags=[Marchal;Flypaper["OXLZLEZ";];Cfsqp;Clusterlp;Tex;Xconvert;Branching;Split[0]]; +};; +add +{ + idv = "test gamma23bis"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus); + (&2,y2, sqrt8); + (&2,y3, &2 * hminus); + (&2,y4, sqrt8); + (&2,y5, &2 * hminus); + (&2,y6, sqrt8) + ] + ( +y_of_x (truncate_gamma3f_x #0.0 (h0cut y1) (&1) (&1)) (&0) (&0) (&0) y1 y3 y5 + + (dih_y y1 y2 y3 y4 y5 y6 - + dih_y y1 sqrt2 y3 sqrt2 y5 sqrt2) * #0.008 > a_spine5 + + b_spine5 * dih_y y1 y2 y3 y4 y5 y6 \/ + rad2_y y1 y2 y3 y4 y5 y6 < &2 \/ + eta_y y1 y2 y6 < #1.34 \/ + eta_y y1 y2 y6 > sqrt2 \/ + eta_y y1 y3 y5 > #1.34 \/ + dih_y y1 y2 y3 y4 y5 y6 > #1.074)`; + doc = "test"; + tags=[Marchal;Flypaper["OXLZLEZ";];Cfsqp;Clusterlp;Tex;Xconvert;Branching;Split[0]]; +};; +end;; + +add +{ + idv = "test"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus); + (&2,y2, sqrt8); + (&2,y3, sqrt8); + (&2,y4, sqrt8); + (&2,y5, sqrt8); + (&2,y6, sqrt8) + ] + ( + dih_y y1 y2 y3 y4 y5 y6 > &0 \/ + rad2_y y1 y2 y3 y4 y5 y6 < &2 \/ + eta_y y1 y2 y6 > sqrt2 \/ + eta_y y1 y3 y5 > sqrt2 )`; + doc = "test"; + tags=[Marchal;Flypaper["OXLZLEZ";];Cfsqp;Clusterlp;Tex;Xconvert;Branching;Split[0]]; +};; + + +type_of theorems;; +follow;; +textchar;; +augment_search_results ["hi"];; +really_expand "?-0";; +help_grep "";; +help_flag "";; +help "apropos_short_order_script";; +suggest();; +String.sub "abcde" 1 (String.length "abcde" - 1);; +expand_suggest "0";; +hd it;; +List.nth !loaded_files 69;; Reload 1--69 +mk_thm;; +flyspeck_needs "general/lib.hl";; +flyspeck_needs "nonlin/kelvin_lattice.hl";; +flyspeck_needs "usr/thales/searching.hl";; +open Searching;; +rflyspeck_needs "usr/thales/init_search.hl";; +reneeds "packing/counting_spheres.hl";; +flyspeck_needs "packing/QZKSYKG.hl";; +flyspeck_needs "packing/DDZUPHJ.hl";; +flyspeck_needs "packing/AJRIPQN.hl";; +flyspeck_needs "packing/QZYZMJC.hl";; +flyspeck_needs "packing/marchal_cells_3.hl";; +flyspeck_needs "packing/GRUTOTI.hl";; +Grutoti.GRUTOTI;; +flyspeck_needs "fan/CFYXFTY.hl";; +flyspeck_needs "packing/counting_spheres.hl";; +open Counting_spheres;; +flyspeck_needs "nonlinear/cleanDeriv.hl";; +flyspeck_needs "nonlinear/cleanDeriv_examples.hl";; +flyspeck_needs "../development/thales/chaff/tmp/vectors_patch.ml";; +flyspeck_needs "../development/thales/chaff/tmp/determinants_patch.ml";; +flyspeck_needs "../development/thales/chaff/tmp/wlog_patch.hl";; +flyspeck_needs "trigonometry/trig2.hl";; +update_database();; +augment_search_results;; +!search_results;; +Counting_spheres.ORDER_AZIM_SUM2PI;; + +let u11111 = ((GOAL_TERM (fun w -> ALL_TAC)):tactic);; +RDISK_R;; + +GOAL_TERM (fun w -> (MP_TAC (ISPECL ( envl w [`p`;`v`;`u0`;`b`]) RCONE_PREP)));; + +INST [(`u:bool`,`A:bool`)] (TAUT ` ((A ==> B) /\ A) ==> B`);; + +let thh = Collect_geom.EQ_POW2_COND;; +let ta1 = TAUT `(a ==> b ==> c) <=> (a /\ b ==> c)`;; +let th2 = REWRITE_RULE[ta1] ( thh);; +let tm1 = snd (strip_forall (concl th2));; +let tm2 = snd (dest_imp tm1);; +let tm3 = fst (dest_eq tm2);; +let force_rewrite th;; + + + +let goalx = `&0 <= sqrt x /\ &0 <= sqrt t ==> &0 <= sqrt u`;; +GMATCH_SIMP_TAC SQRT_POS_LE;; + +let (asl,w) = (top_realgoal());; +let thm = SQRT_POS_LE;; + let thm' = hd (mk_rewrites true thm []);; + let t1 = fst (dest_eq(snd (dest_imp(concl(thm'))))) ;; + let matcher u t = + let m = term_match [] t1 t in + let _ = subset (frees t) (frees u) or failwith "" in + m ;; + let wsub u = find_term (can (matcher u)) u ;; + let w' = wsub w ;; + let vv = + let var1 = mk_var("v",type_of w') in + variant (frees w) var1 ;; + let athm = REWRITE_CONV[ ASSUME (mk_eq (w',vv))] w ;; + let arhs = rhs (concl athm) ;; + let bthm = (ISPECL [mk_abs(vv,arhs);w'] BETA_THM) ;; + let betx = SYM(TRANS bthm (BETA_CONV (rhs (concl bthm)))) ;; + ONCE_REWRITE_TAC[betx] + MATCH_MP_TAC (lift_eq thm') + BETA_TAC + THEN BETA_TAC);; +rt[] + + +let lift_SQRT_POS_LE = GEN_ALL (MATCH_MP lift_imp (SPEC_ALL SQRT_POS_LE));; + +add_rewrite_tag("mycase ",th);; +let xxx n = add_rewrite_stag (List.nth search_result_dump_march7_8am n);; +xxx 0;; +assoc (List.nth search_result_dump_march7_8am 0) !theorems;; + +!rewrite_tags;; +let th = ASSUME (`!p q r. p ==> q ==> (cos r = s) /\ (u ==> sin y > &1)`);; + +let gexp = `!t. (cos x + sqrt (t pow 2) > &0)`;; +let hexp = `!x. (cos x + sqrt (t pow 2) > &0)`;; + + +mk_rewrites;; + + +let matcherx u t = + let m = term_match [] t1 t in + let _ = subset (frees t) (frees u) or failwith "" in + m;; +let mmat u = find_term (can (matcherx u)) u;; +let mx = mmat hexp;; +let mma1 = term_match [] `sqrt x` (mmat hexp);; +let vv = + let var1 = mk_var("v",type_of mx) in + variant (frees hexp) var1;; +let rrx = REWRITE_CONV[ ASSUME (mk_eq (mx,vv))] hexp;; +let rhsx = rhs (concl rrx);; +let bthx = (ISPECL [mk_abs(vv,rhsx);mx] BETA_THM);; +let betx = SYM(TRANS bthx (BETA_CONV (rhs (concl bthx))));; + +term_match [] `sqrt x` mmat;; + +st_of `sin x + cos (asn t)`;; +mk_prover;; +net_of_thm;; +help "term_match";; +help "find_term";; +help "GEN_PART_MATCH";; +help "PART_MATCH";; +help "MATCH_MP";; +`(&0 <= sqrt (t pow 2)) \/ b ==> ~(&0 <= sqrt u)` +mmp lift_SQRT_POS_LE +rt[] +SPEC_ALL (ASSUME `!x. x = x`);; +let lift_SQRT_POS_LE = GEN_ALL (MATCH_MP lift_imp (SPEC_ALL SQRT_POS_LE));; +searcht 5 [`&0 <= sqrt x`];; + +eval_command ~silent:true "let x111 = 1+1+4";; +x111;; +eval_command ~silent:false "mark 4";; +mark 4;; +snd it;; +help_grep "match";; +help "term_match";; +help "PART_MATCH";; +find_term;; +help "find_term";; +List.map hd (split_proof_record [] [] (!proof_record));; +term_match;; +help "term_match";; +searchl;; + +retrieve_search;; +thm_counts;; + + +eval_tactic_lines "st/r\nfxa mpt";; +text_char;; + + +process_to_string "date";; +gax();; + + +last (show_gax());; +List.nth (show_gax()) 2;; + +Clean_deriv.x1_eta2;; +axioms();; +type_of `( %% )`;; +Qzyzmjc.QZYZMJC;; +search [name "FMSWMVO"];; +search [name "IVFICRK"];; +search [name "volume_props"];; +stm_depth "T";; +(* PROJECT BUILD *) +Hashtbl.hash;; + + (* + let (d,hd) = data (get_tm_depth w) in + filter (fun ((d',hd'),_,_) -> (((abs (d-d')< 1+k) && sorted_meet 0 hd hd' ))) thml;; + *) + +List.length (ballpark_theorems (top_realgoal()));; + (ballpark_theorems (top_realgoal()));; +abs_of_float;; +int_abs;; +last [0;1;2;3];; +strip_imp `a`;; +strip_imp `a ==> b==> c`;; +help_grep "dest_";; +type_of `==>`;; +strip_comb;; +help_grep "strip";; +is_comb;; +help "strip_exists";; +strip_comb `a ==> b==> c`;; +help_grep "comb";; +help "strip_ncomb";; +help_grep "strip";; + + +let nearest_thm_to_goal thml (asl,w) = + let tt tl = List.flatten (map (tm_depth o concl) tl) in + let common = tt (map snd asl) in + let thl = map (fun (s,t) -> ((tm_depth o snd o strip_forall o concl )t,s,t) ) thml in + let r = map (fun (tl,s,t) -> (tl,s,t,msd 0.0 common (tm_depth w) tl)) thl in + (sort (fun (_,_,_,a) (_,_,_,b) -> a < b) r);; + +let thml_depth_of_goalmatch thml (asl,w) = + let tt tl = List.flatten (map (tm_depth o concl) tl) in + let w'::rest = List.rev strip_imp o snd o strip_forall w in + let common = tt ((map snd asl) @ rest) in + let thl = map (fun (s,t) -> ((tm_depth o snd o strip_forall o concl )t,s,t) ) thml in + let +;; + + + +nearest_thm_to_goal (ballpark_theorems (top_realgoal())) (top_realgoal());; +let guess = nearest_thm_to_goal (top_realgoal());; +List.length !theorems;; + +top_realgoal;; +help_grep "goal";; +(* *) + +tt;; +hd (!theorems);; +tt;; +strip_forall;; +help_grep "strip";; + +(* jan 3, 2012 chaff *) + + + +(* USEFUL CONSTRUCTS *) + +let report s = + Format.print_string s; Format.print_newline();; + +g `?(x:A) . f A` + +(* generalize *) + +let ( TYPE_VAR :string -> (term -> tactic) -> tactic) = + fun s tm_tactic (asl,g) -> + let (_,r) = dest_comb g in + let (v,_) = dest_abs r in + let (_,ty) = dest_var v in + tm_tactic (mk_var(s,ty)) (asl,g);; + +TYPE_VAR "x" EXISTS_TAC; +;; +Format.print_flush();; +FINITE_EMPTY;; + +searcht 10 [`eulerA_hexall_x`];; + +Sphere.num_combo1;; + +(* +process_to_string "cat qed_log.txt | sed 's/^.*ineq./\"/' | sed 's/., secs.*$/\";/' " + +cat qed_log.txt | sed 's/^.*ineq./"/' | sed 's/., secs.*$/";/' | sort -u | wc + +(* +let _ = Sys.command("cat "^flyspeck_dir^"/../interval_code/qed_log.txt");; +*) +*) + + +let ee () = + let b = (false or (let _ = Sys.command("date") in failwith "h")) in b;; + + +suggest();; + +EXISTSv_TAC "y"; + +dest_binder "?" (`?(x:A). f A`);; + +(* + +let searchl = sortlength_thml o search;; +let take = Lib_ext.take;; +let searcht r = take 0 5 (searchl r);; +let searchtake i j r = take i j (searchl r);; + +*) +term_match;; +INSTANTIATE;; + open Searching;; + +definitions();; +State_manager.neutralize_state();; +let vv = (eval("1+1")) + 3;; +let vv = (eval("REFL `T`"));; +concl vv;; + +prefixes();; +rev(infixes());; +binders();; +unparse_as_infix;; +map (List.nth (infixes())) (95--131);; +unparse_as_binder "!";; +binders();; + + +find_path ((=) `4`) `(sum (3..4) f)`;; (* lrr *) + +let kill_process n = Sys.command (Printf.sprintf "sudo kill -9 %d" n);; + +help_grep "conj";; +help "list_mk_conj";; + end_itlist;; + +FROZEN_REWRITE_TAC [REAL_ARITH `b + d = d - (--b)`];; + +let goal_types = Print_types.print_goal_types;; +Print_types.goal_types();; +Print_types.print_term_types `#2`;; +Print_types.print_thm_types (REFL `1`);; + + + +(* +(* parsing printing *) +let pterm = Print_types.print_term_types;; +let tterm = Print_types.print_thm_types;; + +#install_printer print_qterm;; + + +#install_printer Goal_printer.print_goal_hashed;; +#install_printer Goal_printer.print_goalstack_hashed;; + +#remove_printer Goal_printer.print_goal_hashed;; +#remove_printer Goal_printer.print_goalstack_hashed;; + +#print_length 1000;; +*) + +search[`f (x:A) (g (y:A) z) = f (g x y) z`];; (* min, max, + /\, \/ *, compose, monoidal ops, + APPEND, a - (b + c) = a - b - c /\ a - (b - c) = a - b + c), + p ==> q ==> r <=> p /\ q ==> r);; *) + +find_term ( can (term_match[ `r a (r y z) = r (r x y) z`])) (concl IMP_IMP);; + +filter_pred;; +can (term_match[]);; +type_of;; + +constant_of_regexp "at.*[gn]$";; + +constant_of_regexp "FILTER";; +searcht 15 [`cos`];; +def_of_string "FILTER";; + +def_of_string "fan";; +conjuncts `!a b c. (u /\ v /\ (!c. w /\ r) /\ (!x y. r2 /\ r3))`;; + + +help "dest_forall";; +List.nth !theorems 0;; + +help_grep ".*TAC$";; + +INFINITE_DIFF_FINITE;; +search[`INFINITE`;`DIFF`];; + + +Format.set_max_boxes 100;; +let tt = hol_of_smalllist (1--300);; +string_of_my_term tt;; + + + +let hel i = help (List.nth tacsss i );; + +hel 1;; + +constant_of_regexp "sol";; + +apropos;; +suggest;; + + +(* get all word counts in HOL LIGHT and FLYSPECK *) + +let match_mp_strip = + fun th -> + let tm = concl th in + let avs,bod = strip_forall tm in + let ant,con = dest_imp bod in + let th1 = SPECL avs (ASSUME tm) in + let th2 = UNDISCH th1 in + let evs = filter (fun v -> vfree_in v ant & not (vfree_in v con)) + avs in + let th3 = itlist SIMPLE_CHOOSE evs (DISCH tm th2) in + let tm3 = hd(hyp th3) in + MP (DISCH tm (GEN_ALL (DISCH tm3 (UNDISCH th3)))) th;; + +let mp_short_list = + let u = fst(chop_list 50 (trigger_counts "MATCH_MP_TAC")) in + let sl = map fst !theorems in + let f1 = filter (fun (t,_) -> mem t sl ) u in + let f2 = map (fun (s,n) -> (s,n,assoc s !theorems)) f1 in + filter (fun (_,_,t) -> can match_mp_strip t) f2;; + + +let relevant_match_mp r = + filter (fun (_,_,t) -> can (MATCH_MP_TAC t) r) mp_short_list;; + +let suggest_match_mp () = relevant_match_mp (top_realgoal());; + +mp_short_list;; + +tachy"rep";; + +tcs;; + +grep -r "\bREPEAT\b" . | grep -v svn | sed 's/^.*REPEAT *//' | sed 's/ .*$//g' + + +let recent_search = ref [""];; + +let refcount = ref [("",0)];; + +trigger_counts "MATCH_MP_TAC";; + +EQ_EXT;; +FINITE_SUBSET;; +search[regexp "EQ_SYM"];; +tachy "amt";; +tachy "asmcase";; + +(* to get tacticals as well *) +(* grep "TYPE.*tactic" -i *.doc -l | sed 's/.doc//g' *) + +List.length tactic_list;; +List.length(tachy "");; +subtract tactic_list (tachy "");; +tachy "bool";; + +help "SUBST1_TAC";; + +let typesss ss = + let split = Str.split (Str.regexp "\n") in + let cmd s = process_to_string ("(cd " ^s^ "; grep TYPE "^ss^".doc | sed 's/TYPE[^{]*//g' )") in + List.flatten (map ( split o cmd ) (!helpdirs));; + +typesss "ALL_TAC";; +help "SUBST1_TAC";; + +(* +let MP_TAC_BAK = MP_TAC;; +let MATCH_MP_TAC_BAK = MATCH_MP_TAC;; +*) + + +let mp_theorems = ref[];; +let incr1 thm = (mp_theorems:= thm::!mp_theorems);; + +let MP_TAC_COUNT t = + let _ = incr1 t in MP_TAC_BAK t;; + +let MP_TAC = MP_TAC_COUNT ;; + +let MATCH_MP_TAC_COUNT t = + let _ = incr1 t in MATCH_MP_TAC_BAK t;; + +let MATCH_MP_TAC = MATCH_MP_TAC_COUNT ;; +let MATCH_MP_TAC = MATCH_MP_TAC_BAK ;; + + +reneeds "trigonometry/trig2.hl";; + +let thm_hash = Hashtbl.create 1000;; +map (fun (x,y) -> Hashtbl.add thm_hash y x) (!theorems);; + +let find_name th = + try (Hashtbl.find thm_hash th) with Not_found -> "ANONYMOUS";; + +List.length (search[`x:A`]);; + +List.length (search[`x > (y:real)`]);; (* 111 *) + +List.length (search[`x > &0`]);; (* 67 *) + (search[`x > y`; omit `x > &0`]);; (* complicated thing > simple thing. *) +List.length (search[`x < y`]);; (* 1438 *) + +List.length (search[`x >= &0`]);; (* 11 *) +List.length (search[`x <= (y:real)`]);; (* 1830 *) +List.length (search[`x >= y`; omit `x >= &0`]);; (* 85, complicated thing > simple thing. *) + + +(* IN -- no rhyme or reason. *) +List.length(search[`(IN)`]) (* 3455 *);; +List.length(search[`SETSPEC`]);; (* 1071 *);; +List.length(search[`SETSPEC`;`(IN)`]);; (* 568 *) +dest_comb `{x | T} y`;; +List.length (search[`y IN (GSPEC f)`]);; (* 23 *) + (search[`y IN {u | f}`]);; (* 14 *) +(search[`{u | f} y`]);; (* 3 *) +(searcht 40 [`(IN)`;omit `SETSPEC`]);; + +dest_comb `{x | x > 0}`;; + +List.length (search[`x < y`]);; (* 1438 *) + +(* search, what is the arc cosine called? acs *) + +search[rewrite `inv`;`( / )`];; +searcht 5 [rewrite `inv`;`a*b`];; +search [regexp "[dD]iff"];; +is_rewrite "inv" ("",REAL_INV_MUL);; +heads (snd(dest_thm(REAL_INV_MUL)));; + +Toploop.execute_phrase;; + + +types();; + +constants();; +heads(concl(hd(definitions())));; + + + + +(* experiments *) + +let _ = + let dds = map fst def_assoc in + sort (fun (_,a) (_,b) -> a > b) (map (fun t-> (t,stm_depth t)) dds);; + + + + +let thm_depthnth n = + let (s,th) = List.nth !theorems n in + let d = thm_depth th in (s,d,th);; + + +tm_depth `!a b. (&2 <= a /\ a <= #2.52) /\ &2 <= b /\ b <= #2.52 + ==>( ((\x. -- (&4 + a pow 2 - x pow 2)/(a * sqrt(ups_x (a pow 2) (b pow 2) (&4)))) has_real_derivative + (&32 * a * b /( (sqrt (ups_x (a pow 2) (b pow 2) (&4))) pow 3))) + (atreal b within real_interval [&2,#2.52]))`;; + +let depth_filter n = filter (fun (_,t)-> + let (_,c) = hd (thm_depth t) in (c <= n));; + +searcht 10 [`has_real_derivative`;`real_div`];; +(* now distance between constants *) + +help_grep_flags "rat" "i";; + +help "REAL_RAT_REDUCE_CONV";; +stm_depth "pi";; +stm_depth "cos";; +stm_depth "sin";; +assoc "pi" def_assoc;; + +thm_depthnth 1000;; + +stm_depth "?";; +stm_depth "!";; +stm_depth "hull";; +stm_depth "uniformly_continuous_on";; +stm_depth "real_add";; +stm_depth "treal_add";; +stm_depth "hreal_add";; +stm_depth "nadd_eq";; +stm_depth "dist";; +stm_depth "-";; +stm_depth "PRE";; +stm_depth "_0";; +assoc "_0" def_assoc;; + +dest_const `(+)`;; +s_depth "arclength";; + +c_depth `acs`;; +c_depth `(@)`;; +assoc `T` def_assoc;; + +rho_node;; + +c_of [] `sin(cos (x + y))`;; + +searcht 5 [`a/b + c/d`];; + + +searcht 5 [`x pow n = &0`];; + +help_grep "REAL_RAT";; + +pre_rationalize `-- (v/ u pow 3)/(&1/x + &3 * (-- (u /( v * inv (w)))))`;; + +strip_comb `&1 + &2`;; +dest_comb;; + + + + +REAL_INV_DIV;; + +searcht 5 [`inv`;`a/b`];; +searcht 5 [`a/b + c/d`];; +let (rr,_)=hd[(`(+)`,ratform_add); + (`( * )`,ratform_mul);(`( - )`,ratform_sub); + (`( / )`,ratform_div)];; +type_of rr;; +rationalize `-- (v/ u pow 3)/(&1/x + &3 * (-- (u /( v * inv (w)))))`;; +Calc_derivative.derivative_form `\q. sin(q pow 5)` `t:real` `{}:real->bool`;; +pre_rationalize `inv (w)`;; + +Calc_derivative.derivative_form `(\x. --(&4 + a pow 2 - x pow 2) / (a * sqrt (ups_x (a pow 2) (x pow 2) (&4))))` `b:real` `real_interval [&2,#2.52]`;; + +searcht 5[`x pow 1`];; + +search [name "HAS_REAL";name "COS"];; + +search [`(within)`;`(:real)`];; + +open Calc_derivative;; + + let th1 = + let x = `x:real` in + let s = `{t | t > &0}` in + let tm = `\x. x pow 3 + x * x - x * -- x + x/(x + &1)`in + differentiate tm x s;; + + let th1 = + let x = `x:real` in + let s = `{t | t > &0}` in + let tm = `(\q:real. (q - sin(q pow 3) + q pow 7 + y)/(q pow 2 + q pow 4 *(&33 + &43 * q)) + (q pow 3) * ((q pow 2) / (-- (q pow 3))))` in + differentiate tm x s;; + + let th2 = + let x = `x:real` in + let s = `(:real)` in + let tm = `\q. cos(&1 + q pow 2) * acs (q pow 4) + atn(cos q) + inv (q + &1)` in + differentiate tm x s;; + + let th3 = + let x = `&5` in + let s = `(:real)` in + let tm = `\q. cos(&1 + q pow 2) * acs (q pow 4) + atn(cos q) + inv (q + &1)` in + differentiate tm x s;; + + +(* prove rational identity modulo accumulating assumptions *) + + let equ = `(&1 / u - &1/v) pow 2 = inv u pow 2 - &2 * inv (u * v) + inv v pow 2`;; + let eq0 = MATCH_MP (REAL_ARITH `u - v = &0 ==> (u=v)`);; + +CONV_RULE rc (pre_rationalize `&1 / (x + y) - &1 / (x - y) - (-- &2 * y / (x pow 2 - y pow 2))`);; + let lite_imp = MESON[] `ratform p a ;; + +REAL_FIELD ` ((x - y - (x + y)) * (x pow 2 * &1 pow 2 - &1 pow 2 * y pow 2) - + ((x + y) * (x - y)) * -- &2 * y * &1 pow 2 * &1 pow 2) = &0`;; + +mk_neg;; +mk_binop;; + +searcht 5 [`(a1 pow n / b1 pow n)`];; + +let ratform_tac = + REWRITE_TAC [ratform] THEN + REPEAT STRIP_TAC THENL + [ASM_MESON_TAC[REAL_ENTIRE] ; + REPEAT (FIRST_X_ASSUM (fun t -> MP_TAC t THEN ANTS_TAC THEN + ASM_REWRITE_TAC[])) THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + REPEAT (POP_ASSUM MP_TAC) THEN + CONV_TAC REAL_FIELD];; + + + +let ratform_pow = prove_by_refinement( + `ratform p1 r1 a1 b1 ==> ratform p1 (r1 pow n) (a1 pow n) (b1 pow n)`, + (* {{{ proof *) + [ + REWRITE_TAC[ratform;GSYM REAL_POW_DIV]; + ratform_tac; + ]);; + (* }}} *) + +rational_identity `&1 / (x + y) - &1 / (x - y) = -- &2 * y / (x pow 2 - y pow 2)`;; + + +REAL_FIELD `&2 * x * y - &2 * y * x`;; + + + let mk_derived tm = + let (h1,[f1;f1';r1]) = strip_comb tm in + let (h2,[b2;s1]) = strip_comb r1 in + let (h3,b) = dest_comb b2 in + (f1,SPECL [f1;f1';b;s1] triv) in + + let hooked_deriv hook = + let assumed_rules = map mk_derived hook in + let d_hyp tm = + let r = assoc tm assumed_rules in + let _ = print_thm r in + r in + + let triv = REWRITE_RULE[](REWRITE_CONV[derived_form] + `!f f' x s. derived_form ((f has_real_derivative f') (atreal x within s)) f f' x s` ) in + +differentiate_hook [`(f has_real_derivative (&17)) (atreal x within (:real))`] `\x. ((f:real->real) x) pow 2` `x:real` `(:real)`;; + + differentiate_hook [`(f has_real_derivative f') (atreal x within (:real))`] `f:real->real` `x:real` `(:real)`;; + +let triv = REWRITE_RULE[](REWRITE_CONV[derived_form] + `!f f' x s. derived_form ((f has_real_derivative f') (atreal x within s)) f f' x s` );; + + +mk_derived `(f has_real_derivative (&17)) (atreal x within (:real))`;; +assoc `f:real->real` [it];; +differentiate_hook;; + +`(f has_real_derivative f') (atreal x within (:univ))`;; + + let d_hyp assumed_rules tm = + snd(find (fun (r,s) -> aconv tm r) assumed_rules);; + + +let triv2 = prove_by_refinement( + `f f' x s. derived_form ((f has_real_derivative f') (atreal x)) f f' x (:real)`, + (* {{{ proof *) + [ + REWRITE_TAC[derived_form;WITHINREAL_UNIV]; + ]);; + (* }}} *) + + +(* acceptable forms + `!x s. p ==> (f has_real_derivative f') (atreal x within s)` + `!x s. p ==> (f has_real_derivative f') (atreal x)` + `!x s. derived_form f f' x s`;; +*) + +let thm5 = prove_by_refinement( + `!x s. derived_form (p x /\ (!x s. (derived_form (p x) f (f' x) x s))) f (f' x) x s`, + (* {{{ proof *) + [ + REWRITE_TAC[derived_form]; + MESON_TAC[]; + ]);; + + +let thm4 = prove_by_refinement( + `!x s. derived_form (!x s. (f has_real_derivative f' x) (atreal x within s)) f (f' x) x s`, + (* {{{ proof *) + [ + REWRITE_TAC[derived_form]; + MESON_TAC[]; + ]);; + (* }}} *) + +let thm3 = prove_by_refinement( + `!x s. derived_form (!x. (f has_real_derivative f' x) (atreal x)) f (f' x) x s`, + (* {{{ proof *) + [ + REWRITE_TAC[derived_form]; + MESON_TAC[HAS_REAL_DERIVATIVE_ATREAL_WITHIN]; + ]);; + (* }}} *) + +let thm2 = prove_by_refinement( + `!x s. derived_form (p x /\ (!x. p x ==> (f has_real_derivative f' x) (atreal x) )) f (f' x) x s`, + (* {{{ proof *) + [ + REWRITE_TAC[derived_form]; + MESON_TAC[HAS_REAL_DERIVATIVE_ATREAL_WITHIN]; + ]);; + (* }}} *) + +let thm1 = prove_by_refinement( + `! x s. derived_form (p x /\ (!x s. p x==> (f has_real_derivative f' x) (atreal x within s))) + f (f' x) x s`, + (* {{{ proof *) + [ + REWRITE_TAC[derived_form]; + MESON_TAC[]; + ]);; + (* }}} *) + +let mk_derived = + let form1 = `!x s. p x==> (f has_real_derivative f' x) (atreal x within s)`in + let form2 = `!x. p x ==> (f has_real_derivative f' x) (atreal x)` in + let form3 = `!x. (f has_real_derivative f' x) (atreal x)` in + let form4 = `!x s. (f has_real_derivative f' x) (atreal x within s)` in + let form5 = `!x s. derived_form p f f' x s` in + let fls = [ + (form1,thm1);(form2,thm2);(form3,thm3);(form4,thm4);(form5,thm5)] in + let mm tm (r,s) = + let ins = term_match [] r tm in + INST ((fun (_,a,_) -> a) ins) s in + fun tm -> + tryfind (mm tm) fls;; + + + + +df tm4;; +search [`within`;`atreal`;`has_real_derivative`;name "HAS_REAL"];; +let tm5 = `!x u. derived_form q g g' x u`;; +let tm4 = `!x u. (x > &0) ==> (g has_real_derivative (x pow 2)) (atreal x within u)`;; +if (can (term_match [] form5) tm) then tm else ( failwith "form5");; +MATCH_MP th4 tm4;; +MATCH_MP;; +let ins = (term_match [] form4) tm4 ;; +INST ((fun (_,a,_) -> a) ins) thm4;; + +mk_derived tm5;; + + let mk_derived tm = + let (h1,[f1;f1';r1]) = strip_comb tm in + let (h2,[b2;s1]) = strip_comb r1 in + let (h3,b) = dest_comb b2 in + (f1,SPECL [f1;f1';b;s1] triv) ;; + + + + +MATCH_MP;; + + + + +type_of `has_real_derivative`;; +types_of `derived_form ((f has_real_deriv f') (atreal x within s))`;; + + + +snd(top_realgoal());; +let (h1,[f;f';r]) = strip_comb (snd(top_realgoal()));; +let _ = (h1 = `(has_real_derivative)`) or + failwith "form 'f has_real_derivative f' atreal b within s' expected." ;; +let (h2,[atb;s1]) = strip_comb r;; +let (h3,b) = dest_comb atb;; +1;; +1;; + +BETA_CONV;; + + + +search[`A INTER B = B INTER A`];; + +search[`&0 <= x * x`];; +REAL_ENTIRE;; + +time REAL_RING `a' = &2 * a /\ b' = a*a - &4 * b /\ x2 * y1 = x1 /\ y2 * y1 pow 2 = &1 - b * x1 pow 4 /\ y1 pow 2 = &1 + a * x1 pow 2 + b * x1 pow 4 /\ ~(y1 = &0) ==> y2 pow 2 = &1 - a' * x2 pow 2 + b' * x2 pow 4`;; + +Calc_derivative.differentiate `\t. &1/(cos (a * t pow 2))` `b+ &1` `(:real)`;; + +time Calc_derivative.differentiate `\t. &1/(cos (a * t pow 2))` `b+ &1` `{x | x > &0}`;; + + + + +searcht 5 [`(a,b) = (c,d)`];; +``, + if (NULLSET X) then {} else + (let (k,ul) = cell_params V X in set_of_list (truncate_simplex (k-1) ul))`;; + +LET_TAC;; + +g `!(x). (x = x) \/ (!(x:num). x = x) \/ (!(y:bool). y = y)`;; + +Print_types.print_goal_var_overload();; + +hash_of_term `p /\ q ==> r`;; + +tachy "rt";; + + +eval_goal `a /\ b /\ c /\ d ==> r /\ s`;; +eval_tactic_abbrev "rt/a,[TRUTH]";; + +st/r, +rt/a,[];; + +(!Toploop.parse_toplevel_phrase (Lexing.from_string ("let xx = `&1`;;")));; + +eval_command "let xx = `(x:real) + 2`;;";; + +eval_command "failwith \"hi\" ;;";; +eval_command "assocrx";; + +thm_depth FACET_OF_POLYHEDRON;; +searcht 15 [`norm x = &1`];; + + + let tachit s = + let alpha_num = Str.regexp "[a-z_A-Z]+" in + let _ = Str.string_match alpha_num s 0 or failwith "tachit" in + let m = Str.matched_string s in + let ns = (break_init m s) in + let n = if (String.length n > 0) + el n (tachy m) ;; +tachit "sgth";; +tachy "sgth";; + +Str.regexp;; +String.escaped "/\\ ";; + +Sys.command;; +Sys.command "date";; + + + +(* +let lemma = prove_by_refinement( + `!a b . (!t. a < t ==> b <= t) ==> (!t. a <= t ==> b <= t)`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC ; +DISJ_CASES_TAC (REAL_ARITH `a< t \/ a = t \/ t < a`); +ASM_MESON_TAC []; +HASH_UNDISCH_TAC 1429 ; +DISCH_THEN DISJ_CASES_TAC; +ASM_REWRITE_TAC [REAL_ARITH `b<=t <=> (t < b ==> F)`]; +DISCH_TAC ; +HASH_RULE_TAC 6466 (SPEC `(a + b)/ (&2)`); +ASM_REAL_ARITH_TAC ; +ASM_REAL_ARITH_TAC +] +);; + (* }}} *) +*) +*) +] +);; + (* }}} *) + + +List.length tactic_counts;; + end_itlist (fun (_,t) (_,u) -> ("",t + u)) tactic_counts20;; + +let INFINITE_EXISTS = prove_by_refinement ( +`!S. INFINITE S ==> (?(x:A). x IN S)`, +[ +REWRITE_TAC[INFINITE]; +REPEAT STRIP_TAC; +ASM_MESON_TAC[FINITE_EMPTY;Misc_defs_and_lemmas.EMPTY_EXISTS;]; +]);; +FINITE_EMPTY;; +INFINITE;; +FINITE_EMPTY;; + +let INFINITE_EXISTS = prove_by_refinement ( +`!S. INFINITE S ==> (?(x:A). x IN S)`, +[ +REWRITE_TAC[INFINITE;GSYM Misc_defs_and_lemmas.EMPTY_EXISTS]; +CONV_TAC (CONTRAPOS_CONV); + THEN MESON_TAC[FINITE_EMPTY]; + +]);; + + +(* save. find strange constants *) + +let symbolic_of cnames = + let symbolchar = explode "=-~.,@#$%^&*|\\/?><" in + filter (fun t -> not (intersect (explode t) symbolchar=[])) cnames;; + +let symbolic_constants = symbolic_of (map fst (constants()));; +let symbolic_infixes = symbolic_of (map fst (infixes()));; + + +searcht 5 [name "CHAIN";`has_derivative`];; +apropos();; +help "apropos_derivative";; +Calc_derivative.differentiate;; +Calc_derivative.derived_form;; +Calc_derivative.differentiate `cos` `x:real` `(:real)`;; + +help;; +help "help";; + +type_of `vector`;; + +type_of;; +let types_of = Print_types.print_term_types;; +let type_of_thm = Print_types.print_thm_types;; +let type_of_goal = Print_types.print_goal_types;; +help_grep "type";; + +help "apropos_types";; +types_of `($)`;; +has_derivative;; + +map (fun t -> (t,type_of t)) (frees ` (!(y:real^6). p y ==> (continuous) (lift o f'') (at y within s))`);; + +let arclength2 = prove_by_refinement( + `!h. (&1 <= h /\ h <= h0) ==> arclength (&2) (&2 * h) (&2) = acs(h / &2)`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + MP_TAC (SPECL [`&2`;`&2 * h`;`&2`] Trigonometry1.ACS_ARCLENGTH); + BRANCH_A [ + ANTS_TAC ; + MP_TAC Sphere.h0; + ASM_REAL_ARITH_TAC; + ]; + DISCH_THEN SUBST1_TAC; + AP_TERM_TAC; + UNDISCH_TAC `&1 <= h`; + BY (CONV_TAC REAL_FIELD); + ]);; + (* }}} *) + +let usage_count x = List.length (search [x]);; + +(* marking *) +reset();; +show_marked();; + +let marked = ref [];; +let show_marked() = map (fun t-> (t,assoc t !theorems)) (!marked);; +let mark s = + let th = assoc s (!theorems) in + let _ = marked := s::!marked in + th;; +let resetm() = marked:=[];; + + +term_match [] `s:C` `s:E->G`;; +frees_of_goal();; +`(r:B -> D) ((f:A->B) x) = ((g:C->D) y)`;; +map types_of (gtypl [`f x`;`y`;`f`;`z:D`]);; +filter has_stv (setify (frees `f x`));; +apropos();; +help "apropos_types";; + + +let EZ_SOS_TAC equ = + let lh = lhs equ in + (REWRITE_TAC[REAL_ARITH `(x > y <=> y < x) /\ (x >= y <=> y <= x)`] THEN + ONCE_REWRITE_TAC[REAL_ARITH `(x < y <=> &0 < y - x) /\ (x <= y <=> (&0 <= y - x))`]) THEN +let + fun (asl,w) -> + let eqthm = try (REAL_FIELD eqn ) with _ -> failwith "sos_tac, REAL_FIELD failed" in + let binop = + +rhs;; + +searcht 5 [`x > y <=> x < y`];; + +let equ = `(&1 - t) * (&1 pow 2) + t * (&1 - t) * (&1 pow 2) = (&1 - t pow 2)`;; +let lh = lhs equ;; +let (plus,adden) = strip_comb lh;; +let _ = (plus = `(+)`) or failwith "sum expected";; +help_grep "strip";; +help "strip_comb";; + +g `&1 + &1 = &2`;; +r,[];; + +Str.split (Str.regexp "`") "`how `1` is it`";; +Str.split (Str.regexp "ab") "That is a better choice ab t";; +Str.split (Str.regexp "(\*") "^(* Start comment (* ( *) $";; + +help_grep "dest";; +dest_pair `(a,b)`;; + +map type_of [disjunct (`CARD`,`HAS_SIZE`)];; +search [disjunct (`HAS_SIZE`,`CARD`)];; +type_of `HAS_SIZE`;; +search [disjunct (`&0 < inv x`,`&0 < sqrt u`)];; +search [disjunct (`&0 < sqrt u`,`&0 < inv x`)];; +search [`&0 < sqrt u`];; + +search[disjunct (`INJ`,`(f x = f y) ==> (x = y)`);disjunct(`CARD`,`HAS_SIZE`)];; + +INJ_CARD;; + +mk_rewrites false (ASSUME `!s. s = t`) [];; + +net_of_thm false (ASSUME `s = t`) empty_net;; + +empty_net;; + +p();; +!invariant_under_linear;; + + +let pollack_inconsistency = + let thm1 = prove( `?(n:num). (t < n)`,EXISTS_TAC`t + 1` THEN ARITH_TAC) in + let t = mk_var("n < 0 /\\ 0",`:num`) in + INST [(t,`t:num`)] thm1;; + +(* *) + + let curryl = [Calc_derivative.atn2curry] ;; + let curry = REWRITE_CONV curryl;; + let uncurry = REWRITE_CONV (map GSYM curryl) ;; + +uncurry `\x. atn2 (x,x + &1)`;; + +curry `f`;; +(* +Counting_spheres.... +*) + +!invariant_under_translation;; +searcht 10 [`dihV`;`arcV`];; +searcht 10 [`r f x y = f y x`;omit `#x`];; +VECTOR_ANGLE_ANGLE;; +search[name "ARCV_ANGLE"];; +search[`Arg`;`vector_angle`];; +searcht 10 [`azim`;`Arg`];; +(* from wlog_examples.ml *) + +let TRUONG_1 = prove + (`!u1:real^3 u2 p a b. + ~(u1 = u2) /\ + plane p /\ + {u1,u2} SUBSET p /\ + dist(u1,u2) <= a + b /\ + abs(a - b) < dist(u1,u2) /\ + &0 <= a /\ + &0 <= b + ==> (?d1 d2. + {d1, d2} SUBSET p /\ + &1 / &2 % (d1 + d2) IN affine hull {u1, u2} /\ + dist(d1,u1) = a /\ + dist(d1,u2) = b /\ + dist(d2,u1) = a /\ + dist(d2,u2) = b)`, + (*** First, rotate the plane p to the special case z$3 = &0 ***) + + GEOM_HORIZONTAL_PLANE_TAC `p:real^3->bool` + + +(* bug on loading misc.ml. (next is used as a variable, but later it becomes a constant *) +Debug.Term_of_preterm_error + [("function head", `next`, `:(?2712096)loop->?2712096->?2712096`); + ("function arg", `0`, `:num`)]. +Error in included file /Users/thomashales/Desktop/googlecode/hol_light/Multivariate/misc.ml +- : unit = () + +File "/Users/thomashales/Desktop/googlecode/hol_light/calc_rat.ml", line 515, characters 4-160: +Error: This expression has type + (num -> term) * conv * conv * conv * (term -> thm) * (term -> thm) * + (term -> thm) * (term -> thm) * 'a + but an expression was expected of type + (thm list * thm list * thm list -> positivstellensatz -> thm) -> + thm list * thm list * thm list -> thm + +(* +let backup_proof_record = !proof_record;; +List.length backup_proof_record;; +*) + +(* +let rec clean_proof_record g skip tbs = + function + [] -> (g, EVERY (List.rev tbs)) + | Gax u :: xs -> clean_proof_record [u] skip tbs xs + | Bax::xs -> clean_proof_record g (skip+1) tbs + | Tax (_,_,t)::xs -> if (skip<=0) then clean_proof_record g 0 (t::tbs) xs else + clean_proof_record g (skip-1) tbs xs;; + +let replay (g,t) = + + +let replay_proof gax_no count = + let p1 = List.nth (gax()) gax_no in + let p2 = fst(chop_list count p1) in + let _ = proof_record:= p2 @ !proof_record in + replay();; + +let rotate_proof n = + let (a,b) = chop_list n (gax()) in + List.flatten (b,a);; +*) + + let _ = reneeds "usr/thales/init_search.hl" in ();; + + + +let REAL_LEMMA = prove_by_refinement( + `!t s. (&0 < t ) ==> (?x. &0 < x /\ (&0 < s + t * x))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ASM_CASES_TAC (`&0 < s + t `); + EXISTS_TAC `&1`; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + EXISTS_TAC `&1 - s/t`; + CONJ_TAC; + MATCH_MP_TAC (arith `&0 < (-- a)/b ==> &0 < &1 - a/b`); + MATCH_MP_TAC REAL_LT_DIV; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + SUBGOAL_THEN `s + t * (&1 - s/t) = t` SUBST1_TAC; + Calc_derivative.CALC_ID_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +Topology.th1;; + +let AZIM_ARG4 = prove_by_refinement( + `!x v u w t1 t2 t3. &0 < t3 /\ ~collinear {x , v , u} /\ ~collinear {x,v,w} ==> + azim x v u w = azim x v u (t1 % x + t2 % v + t3 % w)`, + (* {{{ proof *) + [ + st/r + sgth `(?x. &0 < x /\ (&0 < (t1 + t2 + t3 * x)))` mptac + rt[arith `t1 + t2 + t3*x = (t1 + t2) + t3*x`] + mmp REAL_LEMMA + art[] + st + sgth `(t3 % w = (t3 * x') % (&1/x' % (w:real^3)))` subst1 + rt[VECTOR_MUL_ASSOC] + repeat (apthmtac ORELSE aptermtac) + calc + repeat (fxa mptac) then rat + abbrev `s = t1 + t2 + t3 * x'` + sgth `t1 % x + t2 % v + (t3 * x') % (&1/x' % w) = + ]);; + (* }}} *) + +searcht 5 [`a % (b % c)`;`(a * b) % c`];; + + + + EXTREME_POINT_OF_FACE;; + +FACE_OF_EQ;; (* relative interiors of faces are disjoint *) + +QOEPBJD;; + FACE_OF_POLYHEDRON_POLYHEDRON;; + +NEHRQPR;; + POLYHEDRON_COLLINEAR_FACES;; + + + +Graph_control.run(Graph_control.bezdek_reid_properties);; +flyspeck_needs "../glpk/fejesToth_contact/bezdek_reid_problem.ml";; +List.length Bezdek_reid_problem.archive;; +let brp = Bezdek_reid_problem.exec();; +let zbrp = zip Bezdek_reid_problem.archive brp;; +let feas = filter (fun (_,(a,_)) -> not(a = ["PROBLEM HAS NO PRIMAL FEASIBLE SOLUTION"]) && not (a = ["PROBLEM HAS NO FEASIBLE SOLUTION"])) zbrp;; +List.length feas;; +let mk_bb = Bezdek_reid_problem.mk_bb;; +let feas_bb = map (fun (t,_) -> mk_bb t) feas;; + +open Bezdek_reid_problem;; +open Glpk_link;; +let out_bb = map (fun bb -> solve_branch_f model dumpfile "optival" ampl_of_bb bb) feas_bb;; +feas_bb;; + +let bb = "154372608266 14 7 0 1 2 3 4 5 6 3 0 6 5 3 0 5 7 3 7 5 4 3 1 0 8 3 8 0 7 3 7 4 9 3 9 4 3 3 9 3 10 3 10 3 2 3 10 2 11 3 11 2 8 3 2 1 8 5 8 7 9 10 11 ";; +solve_branch_f model dumpfile "optival" ampl_of_bb (mk_bb bb);; + + let svar = mk_var (s,snd(dest_var t));; + + + +let leaf_def = `leaf V u0 u1 = { u | u IN V /\ ~collinear {u0,u1,u} /\ + radV {u0, u1, u2} < sqrt2 }`;; + +let leaf_ordering_def = `leaf_ordering V u0 u1 v f n = + leaf V u0 u1 HAS_SIZE n /\ + (! i j. i < n /\ j < n /\ (f i = f j) ==> (i = j)) /\ + (f n = f 0) /\ + (!i. i < n ==> (f i IN leaf V u0 u1)) /\ + u0 IN V /\ u1 IN V /\ + (!i j. i < j ==> azim u0 u1 v (f i) < azim u0 u1 v (f (i+1)))`;; + +let mcell_group_def = `mcell_group V u0 u1 f i = + {X | X SUBSET wedge u0 u1 (f i) (f (i+1)) /\ + {u0,u1} IN edgeX V X /\ + X IN mcell_set V /\ + ~(NULLSET X) }`;; + +let mcell_group_sum = `!V u0 u1 v f n i. + packing V /\ saturated V /\ + leaf_ordering V u0 u1 v f n /\ + 1 < n /\ i < n ==> + sum (mcell_group V u0 u1 f) (\X. dihX V X (u0,u1)) = azim u0 u1 (f i) (f (i+1))`;; + +let mcell_group_4_type = `!V u0 u1 v f n X. + packing V /\ saturated V /\ + leaf_ordering V u0 u1 v f n /\ + 1 < n /\ + X IN mcell_set V /\ + ~(NULLSET X) /\ + {u0,u1} IN edgeX V X /\ + FST(cell_params V X) = 4 ==> + (?i. i < n /\ + azim u0 u1 (f i) (f (i+1)) < pi /\ + radV {u0,u1,(f i),(f (i+1))} < sqrt2 /\ + X IN mcell_group V u0 u1 f i)`;; + +let mcell_group_23_type = `!V u0 u1 v f n X. + packing V /\ saturated V /\ + leaf_ordering V u0 u1 v f n /\ + 1 < n /\ + X IN mcell_set V /\ + ~(NULLSET X) /\ + {u0,u1} IN edgeX V X /\ + FST(cell_params V X) IN {2,3} ==> + (?i. i < n /\ + ~(azim u0 u1 (f i) (f (i+1)) < pi /\ + radV {u0,u1,(f i),(f (i+1))} < sqrt2) /\ + X IN mcell_group V u0 u1 f i)`;; + +(* consequence of previous 2 *) +let mcell_group_type = `!V u0 u1 v f n X. + packing V /\ saturated V /\ + leaf_ordering V u0 u1 v f n /\ + 1 < n /\ + u0 IN V /\ u1 IN V + X IN mcell_set V /\ + ~(NULLSET X) /\ + {u0,u1} IN edgeX V X ==> + (?i. i < n /\ X IN mcell_group V u0 u1 f i)`;; + +let mcell_group_4_singleton = `!V u0 u1 v f n i. + packing V /\ saturated V /\ + leaf_ordering V u0 u1 v f n /\ + 1 < n /\ i < n /\ + azim u0 u1 (f i) (f (i+1)) < pi /\ + radV {u0,u1,(f i),(f (i+1))} < sqrt2 ==> + mcell_group V u0 u1 f i = { mcell 4 V [u0;u1;(f i);(f (i+1))] }`;; + +(* needed: ? *) + +let mcell_sqrt2_barV = `!V u0 u1 w1 w2. + packing V /\ saturated V /\ + {u0,u1,w1,w2} SUBSET V /\ + ~coplanar {u0,u1,w1,w2} /\ + radV {u0,u1,w1,w2} < sqrt2 ==> + [u0;u1;w1;w2] IN barV V 3`;; + +let mcell_group_3_a = `!V u0 u1 f v n i. + packing V /\ saturated V /\ + leaf_ordering V u0 u1 v f n /\ + 1 < n /\ i < n /\ + (azim u0 u1 (f i) (f (i+1)) >= pi \/ + radV {u0,u1,(f i),(f (i+1))} >= sqrt2) ==> + (?X w. X IN mcell_group V u0 u1 f i /\ + [u0;u1;(f i);w] IN barV V 3 /\ + X = mcell3 V [u0;u1;(f i);w])`;; + +let mcell_group_3_b = `!V u0 u1 v f n i. + packing V /\ saturated V /\ + leaf_ordering V u0 u1 v f n /\ + 1 < n /\ i < n /\ + (azim u0 u1 (f i) (f (i+1)) >= pi \/ + radV {u0,u1,(f i),(f (i+1))} >= sqrt2) ==> + (?X w. X IN mcell_group V u0 u1 f i /\ + [u0;u1;(f i);w] IN barV V 3 /\ + X = mcell3 V [u0;u1;(f i);w])`;; + +(* +need if mcell3 V ul = mcell3 V vl , ul, vl IN barV, NONNULL, and both start with [u0;u1] +the ul = vl. In particular, the two mcells in 3_a and 3_b are distinct, and +the w is uniquely determined by X. +*) + +let mcell_group_3_exhaust = + `!V u0 u1 v f n i X. + packing V /\ saturated V /\ + leaf_ordering V u0 u1 v f n /\ + 1 < n /\ i < n /\ + X IN mcell_group V u0 u1 f i /\ + FST(cell_params V X) = 3 /\ + (?w u. + u IN {(f i),(f (i+1))} /\ + X = mcell3 V [u0;u1;u;w] /\ [u0;u1;u;w] IN barV V 3)`;; + +(* also need formula for 4-cell gamma, 3-cell gamma, 2-cell gamma (as a function of angle) + in terms of the functions that appear in ineq.hl. +*) + + + module More = struct + open Sphere;; + open Ineq;; +add + { + idv = "FWGKMBZ"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus ); + (&2 ,y2,sqrt8 ); + (&2,y3,sqrt8); + (&2,y4,sqrt8); + (&2,y5,sqrt8 ); + (&2,y6,sqrt8 ) + ] + (y_of_x delta_x y1 y2 y3 y4 y5 y6 > &0)`; + doc = " + This is used with rad2_x calculations to bound the denominator. + "; + tags=[Marchal;Flypaper["OXLZLEZ";"Nov2012"];Tex;Cfsqp;Xconvert;Branching]; + };; +add + { + idv = "FHBVYXZ a"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus ); + (&2 ,y2,&2 * hminus ); + (&2,y3,&2 * hminus); + (&2,y4,&2 * hminus); + (&2,y5,&2 * hminus ); + (&2,y6,&2 * hminus ) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun + > &0)\/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2) \/ (eta_y y1 y2 y6 pow 2 < #1.34 pow 2))`; + doc = " + OXLZLEZ.mod 'g_quqya' 'g_quqyb' +%old idv: 1118115412, cc:2bl +If $X$ is any quarter, and $Y$ is a $3$-cell that flanks it, then +\\[ +\\gamma(X,L) + \\gamma(Y,L) \\ge 0. +\\] +Nov2012, changed eta_y y1 y3 y5 to eta_y y1 y2 y6. + "; +(* + &0 * gamma3f y1 y3 y5 sqrt2 lmfun dropped *) + tags=[Marchal;Flypaper["OXLZLEZ";];Tex;Cfsqp;Xconvert;Branching;Split[0]]; + };; + end;; + + + +Auto_lib.testsplit true "FHBVYXZ a";; + map (fun t -> try (Auto_lib.testsplit bool t) with Failure _ -> [()]) cases;; +open Functional_equation;; +string_of_num (num_of `5`;; +dest_numeral `55555555555555`;; +i_mk2 `0`;; + + module More = struct + open Sphere;; + open Ineq;; +add +{ + idv = "QZECFIC wt2 A"; (* was "test ratio" , y4 y5 swapped, nov 2012 *) + ineq = all_forall `ineq + [(sqrt2,y1,sqrt2); + (sqrt2,y2,sqrt2); + (sqrt2,y3,sqrt2); + (&2 * hminus ,y4, sqrt8); + (&2 * hminus, y5, sqrt8); + (&2 ,y6, &2 * hminus) + ] + ( y_of_x (gamma3f_x_div_sqrtdelta (h0cut y4) (h0cut y5) (&1)) y1 y2 y3 y4 y5 y6 / &2 > #0.008 * y_of_x dih4_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 \/ + eta_y y4 y5 y6 pow 2 > &2 + )`; + doc = "gamma3f averages at least 0.008 per azim. + We don't have a wt3 case because eta[2hminus,2hminus,2hminus]>sqrt2."; + tags=[Marchal;Flypaper["OXLZLEZ";"Jun2012"];Cfsqp;Clusterlp;Tex;Xconvert;Branching;Split[3;4]]; +};; +add +{ + idv = "PEMKWKU test1"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus); + (&2 * hminus ,y2, sqrt8); + (&2,y3, &2 * hminus); + (&2 ,y4, sqrt8); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ( + ((y_of_x (gamma23_keep135_x (h0cut y1)) y1 y2 y3 y4 y5 y6) / &2 + > a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6) \/ + y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2 \/ + dih_y y1 y2 y3 y4 y5 y6 > #1.074 \/ + eta_y y1 y2 y6 pow 2 > &2 \/ + eta_y y1 y2 y6 pow 2 < #1.34 pow 2 \/ + eta_y y1 y3 y5 pow 2 > #1.34 pow 2 )`; + doc = "test"; + tags=[Marchal;Flypaper["OXLZLEZ";"Jun2012"];Cfsqp;Clusterlp;Tex;Xconvert;Branching;Split[0]]; +};; +add +{ + idv = "BIXPCGW b test"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, sqrt8); + (&2,y3, sqrt8); + (&2,y4, sqrt8); + (&2,y5, sqrt8); + (&2,y6, sqrt8) + ] + ( (delta4_y y1 y2 y3 y4 y5 y6 > &0) \/ (delta_y y1 y2 y3 y4 y5 y6 > &60) \/ (delta_y y1 y2 y3 y4 y5 y6 < &0))`; + doc = " + NONQXD + If $X$ is a $4$-cell with a critical edge opposite spine, then $\\dih(X) < 2.3$."; + tags=[Marchal;Flypaper["OXLZLEZ";];Cfsqp;Clusterlp;Penalty (500.0,500.0);Tex;Xconvert]; +};; +add +{ + idv = "BIXPCGW 6652007036 a2"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus); + (&2,y2, sqrt8); + (&2,y3, sqrt8); + (&2,y4, sqrt8); + (&2,y5, sqrt8); + (&2,y6, sqrt8) + ] + ((dih_y y1 y2 y3 y4 y5 y6 < #2.8) )`; + doc = " + OXLZLEZ.mod 'azim_c4' QX and QU + If $X$ is a $4$-cell then $\\dih(X) < 2.8$."; + tags=[Marchal;Flypaper["OXLZLEZ";];Cfsqp;Clusterlp;Tex;Xconvert]; +};; +add +{ + idv = "BIXPCGW 7080972881 a2"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2 * hminus,y2, sqrt8); + (&2,y3, sqrt8); + (&2,y4, sqrt8); + (&2,y5, sqrt8); + (&2,y6, sqrt8) + ] + ((dih_y y1 y2 y3 y4 y5 y6 < #2.3) )`; + doc = " + OXLZLEZ.mod 'g_qxd' QXD + If $X$ is a $4$-cell with a critical edge next to the spine, then $\\dih(X) < 2.3$."; + tags=[Marchal;Flypaper["OXLZLEZ";];Cfsqp;Clusterlp;Tex;Xconvert]; +};; +add +{ + idv = "BIXPCGW 1738910218 a2"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, sqrt8); + (&2,y3, sqrt8); + (&2,y4, &2 * hplus); + (&2,y5, sqrt8); + (&2,y6, sqrt8) + ] + ( (dih_y y1 y2 y3 y4 y5 y6 < #2.3) )`; + doc = " + OXLZLEZ.mod 'g_qxd' QXD + If $X$ is a $4$-cell with a critical edge opposite spine, then $\\dih(X) < 2.3$."; + tags=[Marchal;Flypaper["OXLZLEZ";];Cfsqp;Clusterlp;Tex;Xconvert]; +};; +add +{ + idv = "BIXPCGW 7274157868 a"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (&2 * hplus,y4, sqrt8); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun > #0.0057) \/ + (dih_y y1 y2 y3 y4 y5 y6 < #2.3))`; + doc = " + OXLZLEZ.mod 'g_qxd' QXD + If $X$ is a $4$-cell with a single critical edge (the spine), and if $\\dih(X)\\ge 2.3$, + then $\\gamma(X,L) > 0.0057$."; + tags=[Marchal;Flypaper["OXLZLEZ";];Cfsqp;Clusterlp;Tex;Xconvert;Branching;Split[0]]; +};; +add +{ + idv = "GCKBQEA"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus); + (&2,y2, sqrt8); + (&2,y3, sqrt8); + (&2,y4, sqrt8); + (&2,y5, sqrt8); + (&2,y6, sqrt8) + ] + ( + dih_y y1 y2 y3 y4 y5 y6 > #0.606 + )`; + doc = "Min angle on a cell along a spine. + Nov 2012"; + tags=[Marchal;Flypaper["OXLZLEZ";"Nov2012"];Cfsqp;Clusterlp;Tex;Xconvert;Branching]; +};; +add +{ + idv = "JSPEVYT"; + ineq = all_forall `ineq + [ + (&1,y1,&1); + (&1,y2,&1); + (&1,y3,&1); + (&2 * hminus,y4, sqrt8); + (&2 * hminus ,y5, sqrt8); + (&2 ,y6, sqrt8) + ] + (eta_y y4 y5 y6 pow 2 > (#1.34) pow 2 )`; + doc = "eta small implies face small"; + tags=[Marchal;Flypaper["OXLZLEZ";"Nov2012"];Cfsqp;Clusterlp;Tex;Xconvert;Branching]; +};; +add +{ + idv = "IXPOTPA"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (sqrt8,y4, &4 * hminus); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + (let tan2lower = #3.07 in ( // Tan[Pi-2.089]^2 + let tan2upper = #6.45 in ( // Tan[Pi-1.946]^2 + delta_y y1 y2 y3 y4 y5 y6 < &0 \/ + delta4_y y1 y2 y3 y4 y5 y6 > &0 \/ + (&4 * x1_delta_y y1 y2 y3 y4 y5 y6 < tan2lower * delta4_squared_y y1 y2 y3 y4 y5 y6) \/ + (&4 * x1_delta_y y1 y2 y3 y4 y5 y6 > tan2upper * delta4_squared_y y1 y2 y3 y4 y5 y6) \/ + eta_y y1 y2 y6 pow 2 > #1.34 pow 2 \/ + eta_y y1 y3 y5 pow 2 > #1.34 pow 2 \/ + (y_of_x (gamma23_full8_x (h0cut y1)) y1 y2 y3 y4 y5 y6 > &3 * #0.0057))))`; + doc = "Dec 2, 2012. This is the case of TXQTPVC, when y4 >= sqrt8. We can't use monotonicty here, + because of the explicit dih constraints."; + tags=[Marchal;Flypaper["OXLZLEZ";"Nov2012"];Cfsqp;Clusterlp;Tex;Xconvert;Branching;Split[0]]; +};; +add{ + idv = "3287695934"; + doc=""; + tags = [Cfsqp;Tablelp;Xconvert;Tex]; + ineq = all_forall `ineq + [ + (#4.37,y1,&4 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (&2 * h0,y4,&4 * h0); + (#2.0,y5,&2 * h0); + (#2.0,y6,&2 * h0)] + (delta_y y1 y2 y3 y4 y5 y6 < &0)`; +};; +add{ + idv = "4821120729"; + doc=""; + tags = [Cfsqp;Tablelp;Xconvert;Tex]; + ineq = all_forall `ineq + [ + (&2,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.915); + (#2.0,y5,&2 * h0); + (#2.0,y6,&2 * h0)] + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 > &0)`; +};; +add{ + idv = "6762190381"; + doc="This reduces OWZLKVY to the case when delta_y < 200. Added 2013-4-18"; + tags = [Cfsqp;Tablelp;Xconvert;Tex]; + ineq = all_forall `ineq + [ + (&2 ,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (#3.01,y4,#3.915); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0)] + ( + delta_y y1 y2 y3 y4 y5 y6 < &200 \/ taum y1 y2 y3 y4 y5 y6 > &0 )`; +};; +add{ + idv = "8346775862"; + doc="In OWZLKVY the angle at y1 is obtuse. Added 2013-4-18."; + tags = [Cfsqp;Tablelp;Xconvert;Tex]; + ineq = all_forall `ineq + [ + (&2 ,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (#3.01,y4,#3.915); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0)] + ( + delta_y y1 y2 y3 y4 y5 y6 > &200 \/ y_of_x delta_x4 y1 y2 y3 y4 y5 y6 < &0 ) `; +};; +add{ + idv = "8631418063"; + doc="In OWZLKVY the angle at y2,y3 is acute. Added 2013-4-18."; + tags = [Cfsqp;Tablelp;Xconvert;Tex]; + ineq = all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2,y4,&2 * h0); + (#3.01,y5,#3.915); + (&2,y6,&2 * h0)] + (y_of_x delta_x4 y1 y2 y3 y4 y5 y6 > &0)`; +};; +add +{ + idv="5026777310a"; + doc="pentagon case, clipped A-piece triangle. "; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (sqrt8,y4,#3.01); + (sqrt8,y5,#3.01); + (&2,y6,#2.52) + ] +( + ( taum y1 y2 y3 y4 y5 y6 > tame_table_d 4 1 - &2 * #0.11) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + end;; + + + + module More = struct + open Sphere;; + open Ineq;; +add +{ + idv="taum"; + doc="quad case top neg delta. + Solve[Delta[x,2,2,x,2,3.01]==0,x] (*x < 3.166 *) + Added 2013-05-05."; + tags=[Cfsqp;Xconvert]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (#2.25,y3,#2.52); + (#3.01,y4,#3.24); + (&2,y5,&2); + (&2,y6,&2)] +(taum y1 y2 y3 y4 y5 y6 > &0)`; +};; +add +{ + idv="test"; + doc="test ear"; + tags=[Cfsqp;Xconvert;Tex;]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.24); + (&2,y5,&2); + (&2,y6,&2) + ] +( + ( delta_y y1 y2 y3 y4 y5 y6 < &72 \/ taum y1 y2 y3 y4 y5 y6 > #0.038 ) + )`; +};; +add +{ + idv="test2"; + doc="testA "; + tags=[Cfsqp;Xconvert;Tex;]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.24); + (#3.01,y5,#3.24); + (&2,y6,&2) + ] +( + ( taum y1 y2 y3 y4 y5 y6 > &0 ) + )`; +};; +add +{ + idv="test3"; + doc=""; + tags=[Cfsqp;Xconvert;Tex]; + ineq = all_forall `ineq [ + (#2.0,y1,#2.3); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.23607); + (#2.0,y5,&2); + (#2.0,y6,&2); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (#3.01,y9,#3.23607)] +( delta_y y1 y2 y3 y4 y5 y6 > &30 \/ + enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.23607 )`; +};; +add +{ + idv="test4"; + doc=" + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (y_of_x tau_residual_x y1 y2 y3 y4 y5 y6 > #0.027) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + end;; + + +1;; +map Scripts.one_cfsqp ["test4"];; +map (Auto_lib.testsplit true) ["7697147739 delta top issue";"4680581274 delta top issue";];; + +map (Auto_lib.testsplit true) [ + "6762190381"; + "8346775862"; + "8631418063"; + "4821120729";];; + + +let idq_of_string s = hd(Ineq.getexact s);; +idq_of_string "GRKIBMP B";; +Ineq.remove "GRKIBMP B";; +idq_of_string "GRKIBMP test";; +Auto_lib.testsplit true "BIXPCGW 1738910218 a2";; +map (Auto_lib.testsplit true) [ +"QITNPEA1 1 0 9063653052 A"; +"QITNPEA1 1 1 9063653052 A"; +"QITNPEA1 1 2 9063653052 A"; +"QITNPEA1 2 0 9063653052 A"; +"QITNPEA1 2 1 9063653052 A"; +"QITNPEA1 2 2 9063653052 A"; +];; + + +Scripts.one_cfsqp "GRKIBMP A V2";; +let [(s1,tags1,testineq1);(s2,tags2,testineq2)] = Optimize.preprocess_split_idq (hd(Ineq.getexact "GRKIBMP A V2"));; +Auto_lib.execute_interval true tags1 s1 testineq1;; + +Auto_lib.testsplit true "GRKIBMP A V2";; + +Scripts.one_cfsqp "GLFVCVK4 2477216213 y4subcrit";; + + +conflicts `x + 1` `x + &2`;; + +aty;; +help_grep "cart";; +help "CONJ_PAIR";; +Debug.find_subterms;; +help_grep "ty";; +help "bty";; +help_grep "mkty";; +help_grep "mk_";; +help "mk_type";; +mk_type ("prod",[`:num`;`:bool`]);; + +let follow_your_nose_string_list() = + let aslw = top_realgoal() in + let m = filter (fun (p,_,_) -> p aslw) !noses in + let m2 = map (fun ((_,_,a),b) -> ("{"^string_of_int b ^":"^a^"}")) (zip m (0--((List.length m) -1))) in + Flyspeck_lib.join_comma m2;; + +let fynlist k = + let aslw = top_realgoal() in + let m = filter (fun (p,_,_) -> p aslw) !noses in + let (_,t,_) = List.nth m k in + t;; + +String.sub "abcde" 0 4;; + +let string_starts_with u s = (String.length u <= String.length s) && (u = String.sub s 0 (String.length u));; +string_starts_with "ab" "c";; + +help_grep "prior";; +prioritize_real();; +Print_types.print_goal_types();; +bb 10;; + + +(* Sudoku solver *) +open String + +let rec s p= + try + let rec(%)=(mod) and i=index p '0'and + b j= + i<>j & (i/9=j/9||i%9=j%9||i/27=j/27&i%9/3=j%9/3) & p.[i]=p.[j] || j<80 & b(j+1) + in + iter (fun c->p.[i]<-c;b 0||()=s p;()) "948721536"; + p.[i]<-'0' + with + _->print_string p;; + +s(read_line());; + +let longt = filter (fun (_,t) -> (30 < t)) times;; +hour(total longt);; +List.length longt;; +map (fun (s,t) -> (s,float_of_int (t) /. 180.0)) longt;; + +let t = `hello = there`;; + + + + INST_TYPE;; + + type_of (inst [(`:b`,ty_b)] b);; +help_grep "inst";; +inst;; +env;; + +let inxx = ref[];; +let add_inequality idq = (inxx := idq::!inxx);; +flyspeck_needs "nonlinear/prep.hl";; +let inyy = map (fun t -> t.idv) (!inxx);; +index "4717061266" inyy;; +List.length inyy;; +index "GRKIBMP B V2" inyy;; + +Preprocess.exec();; + +mk_rewrites true (ASSUME `!a b. a ==> (b /\ c)`) [];; +SPEC_ALL (REFL `a:bool`);; +30 + 230 + 46 + 9 + 224 + 996 + 5;; +BETA_THM;; +ISPECL;; +Preprocess.preprocess1;; +let funx s = (Optimize.preprocess_split_idq (hd (Ineq.getexact (s))));; +funx "CJFZZDW";; +Flyspeck_lib.output_filestring;; + + let preprocess1 s = + let prep = Optimize.preprocess_split_idq + (hd (Ineq.getexact (s))) in + let v = + Flyspeck_lib.join_lines (map Preprocess.print_one prep) in + let _ = report v in + ((s,map (fun (s,_,_) -> s) prep),v);; + +Preprocess.preprocess1 "GLFVCVK4a 8328676778";; + +g `c ==> b`;; +st/r;; +top_goal();; + +(* generating proves prep ==> ineq.hl *) + +(* follow preprocess_split_idq, step by step *) + + let strip_let_conv = REDEPTH_CONV let_CONV;; (* strip_let_tm *) + + let LET_ELIM_TAC = CONV_TAC (REDEPTH_CONV let_CONV);; + +Optimize.get_split_tags;; + +let PREPROCESS (s,tags,case) = + let is_xconvert = mem Xconvert tags in + let is_branch = mem Branching tags in + let strip_let_case = strip_let_conv case in + let _ = report ("process and exec: "^s) in + let tacl = + [PRELIM_REWRITE_TAC; + MP_TAC (REWRITE_RULE[] NONLIN); + if (is_branch) then (BRANCH_TAC) else (ALL_TAC); + if (is_xconvert) then e (X_OF_Y_TAC) else e(ALL_TAC); + if (is_branch && not(is_xconvert)) then + (SERIES3Q1H_5D_TAC) else (ALL_TAC); + STYLIZE_TAC; + WRAPUP_TAC] in + let _ = g (strip_let_case) in + let _ = e (EVERY tacl) in + let testineq = snd(top_goal()) in + (s,tags,testineq);; + +Optimize.split_h0;; +instantiation;; + +g `c ==> b`;; +st/r +asmcase `a:bool` then (repeat (fxa mp)) +1;; +refine(merge1_goal);; + (top_asl_thm());; + +UNDISCH;; +top_thm();; + +top_thm();; +top_realgoal();; +List.length (!current_goalstack);; +List.nth (!current_goalstack) 0;; +CONJ;; + +let (merge1_goal:refinement) = + fun (meta,sgs,just) -> + if List.length sgs < 2 then (meta,sgs,just) + else + let s0::s1::s2 = sgs in + let _ = fst(s0) = [] or failwith "merge1_goal asl nonempty" in + let _ = fst(s1) = [] or failwith "merge1_goal asl nonempty" in + let sgs' = ([],mk_conj (snd s0, snd s1)) ::s2 in + let just' i ths = + (just i ( (CONJUNCT1 (hd ths)) :: (CONJUNCT2 ( (hd ths))) :: tl ths)) in + (meta,sgs',just');; + +let top_asl_thm() = + let (_,sgs,f)::_ = !current_goalstack in + let t = snd(hd sgs) in + DISCH t (f null_inst [ASSUME t]);; + + +help_grep "conj";; +mk_conj;; +help "ACCEPT_TAC";; +open Nonlinear_lemma;; + gcy_low;; +gcy_low_const;; +gcy_low_hminus;; +gcy_high;; +gcy_high_hplus;; + + let slxx = map (fun t -> t.idv) !Ineq.ineqs;; +hd slxx;; +List.length slxx;; +List.nth sl 442xx;; + +prove_ineq "4528012043";; + +let s = "4528012043";; + let DSPLIT_TAC i = DISCH_TAC THEN (Optimize.SPLIT_H0_TAC i);; + let LET_ELIM_TAC = CONV_TAC (REDEPTH_CONV let_CONV);; + let is_xconvert tags = mem Xconvert tags;; + let is_branch tags = mem Branching tags;; + let NONL = `prepared_nonlinear:bool`;; + let idq = hd(Ineq.getexact s);; + + let (s',tags,ineq) = idq_fields idq;; + let _ = (s = s') or failwith "prove_ineq: wrong ineq";; + try (s,prove(mk_imp(NONL,ineq);; + +g(mk_imp(NONL,ineq));; + + +LET_ELIM_TAC + (EVERY (map DSPLIT_TAC (get_split_tags idq)) );; + EVERY + [ +LET_ELIM_TAC; + PRELIM_REWRITE_TAC;; + + e(if (is_branch tags) then BRANCH_TAC else ALL_TAC);; + e(if (is_xconvert tags) then X_OF_Y_TAC else ALL_TAC);; + e(if (is_branch tags && not(is_xconvert tags)) then SERIES3Q1H_5D_TAC else ALL_TAC);; + e(STYLIZE_TAC);; + e(WRAPUP_TAC);; + REWRITE_TAC (get_all_prep_nonlinear s)])) + with Failure _ -> failwith s;; +List.length !Ineq.ineqs;; +List.length !Prep.prep_ineqs;; + + + module Test = struct + open Hales_tactic;; + open Counting_spheres;; +let FCHANGED_RADIAL_ALT = prove_by_refinement( + `!(p:real^3->bool) f r. + bounded p /\ polyhedron p /\ vec 0 IN interior p /\ f facet_of p ==> + radial r (vec 0) ( fchanged f INTER normball (vec 0) r)`, + (* {{{ proof *) + [ + REWRITE_TAC[ Sphere.radial ]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[ NORMBALL_BALL ]; + REWRITE_TAC[VECTOR_ADD_RID;VECTOR_SUB_RZERO;VECTOR_ADD_LID;VECTOR_SUB_LZERO]; + CONJ_TAC; + BY(SET_TAC[]); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `fchanged` MP_TAC; + REWRITE_TAC[IN_INTER]; + REWRITE_TAC[ Polyhedron.fchanged ]; + REWRITE_TAC[ IN_ELIM_THM ]; + REPEAT WEAK_STRIP_TAC; + CONJ_TAC; + TYPIFY `v1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `t * t'` EXISTS_TAC; + REWRITE_TAC [ VECTOR_MUL_ASSOC ]; + REPEAT (FIRST_X_ASSUM_ST `a > b` MP_TAC); + REWRITE_TAC [arith `a > b <=> b < a`]; + BY(MESON_TAC[ REAL_LT_MUL ]); + INTRO_TAC Counting_spheres.RADIAL_NORMBALL [`(vec 0):real^3`;`r`]; + REWRITE_TAC[ NORMBALL_BALL ]; + REWRITE_TAC[ Sphere.radial ]; + REWRITE_TAC[VECTOR_ADD_RID;VECTOR_SUB_RZERO;VECTOR_ADD_LID;VECTOR_SUB_LZERO]; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[ IN_BALL ]; + REWRITE_TAC[ dist ]; + REWRITE_TAC[VECTOR_ADD_RID;VECTOR_SUB_RZERO;VECTOR_ADD_LID;VECTOR_SUB_LZERO]; + REWRITE_TAC[ NORM_NEG ]; + BY(ASM_MESON_TAC[SUBSET]) +] +);; + (* }}} *) + end;; + +help_grep "stv";; + +dest_imp `a ==> b`;; +REWR_CONV;; +help "IMP_REWR_CONV";; +help "net_of_thm";; +help "mk_rewrites";; +mk_rewrites false ADD_CLAUSES [];; +help "REWRITES_CONV";; +AUGMENT_SIMPSET;; +help "RULE_ASSUM_TAC";; +help "mk_prover";; +help "lookup";; +EQT_ELIM;; +help "EQT_ELIM";; +help "EQ_MP";; +help "TOP_SWEEP_SQCONV";; +help "rand";; + type_of `nsum`;; +help "DISCH";; +help "MP";; +help "GEN_PART_MATCH";; +help_grep "mk_";; +list_mk_exists;; +help_grep "IMP";; +help "IMP_TRANS";; +help_grep "EXIST";; +help "SIMPLE_EXISTS";; +help "CHOOSE";; +help "EXISTS";; +SPEC_ALL;; +help_grep "GEN";; +help "GEN_ALL";; +help_grep "exist";; +help "mk_exists";; +help "IMP";; +help_grep "IMP";; +help "EQ_IMP_RULE";; +help "DISCH";; +help "DISCH_ALL";; +mk_rewrites;; + +(map Merge_ineq.get_pack_nonlinear_non_ox3q1h ["QZECFIC wt0";"QZECFIC wt0 corner";"QZECFIC wt0 sqrt8";"QZECFIC wt1";"QZECFIC wt2 A";"CIHTIUM";"CJFZZDW";]);; + +Flyspeck_constants.calc `atn (sqrt (#3.07)) < pi - #2.089`;; + +Oxl_merge.CELL_CLUSTER_ESTIMATE_PROPS;; + + let smt_timeouts= +["6988401556"; +"7394240696"; +"8248508703"; +"7863247282"; +"3862621143 back"; +"3862621143 side"; +"8519146937"; +"4667071578"; +"5026777310"; +"OMKYNLT 1 2"; +"3296257235"; +"3862621143 front"; +"7761782916"; +"6944699408 a reduced"; +"7726998381"; +"4840774900"; +"MKFKQWU"; +"5451229371"; +"7931207804"; +"4652969746 1"; +"5405130650"; +"6224332984"; +"4240815464 a reduced"; +"3862621143 revised"; +"4491491732"; +"9563139965 f"; +"8082208587"; +"2065952723 A1"; +"9563139965 d"; +"8673686234 b"; +"3603097872"; +"1642527039"; +"1395142356"; +"OMKYNLT 3336871894"];; + + let t1 = map (fun t -> (t,List.length((Ineq.getexact t)))) smt_timeouts;; +filter (fun (_,s) -> (s = 0)) t1;; + +map Scripts.one_cfsqp smt_timeouts;; + + 'ID[4322269127]' + 'ID[5556646409]';; + +(* Analysis of constants for Clarke, Gao, et al. *) +(* moved to function_list.hl *) + + + let tm1 = `domain6 (\x1 x2 x3 x4 x5 x6. + &0 <= x1 /\ &0 <= x2 /\ &0 <= x3 /\ + &0 <= x4 /\ &0 <= x5 /\ &0 <= x6) + dih5_x (rotate5 dih_x)`;; + let thm1 = UNDISCH (MATCH_MP domain6_assum (ASSUME tm1));; + + +!help_path;; +help_path := ["/Users/thomashales/Desktop/googlecode/hol-light/Help"; "$/Help"];; +help "SPEC_ALL";; + + + + + + let cons2 = (map (const_types o test) (0--30));; + let cons2 = (map (const_types o test) (0--100));; + +const_types (test 740);; + + + +Flyspeck_lib.nub cons;; +List.length i1;; + +let has_matan = + let z1 = zip p1 cons in + map fst (filter (fun (_,c) -> mem "matan" c) z1);; +let hss = map (fun t -> t.idv) has_matan;; + +let testcase = "5202826650 a";; + +let testcase = "7796879304";; +let testcases = subtract hss ["7796879304"];; +map (Auto_lib.testsplit true) testcases;; + + let i2 = map (fun t -> t.ineq) (!Ineq.ineqs);; + let ct2 = setify (List.flatten (map cxx i2));; + + let ct3 = setify (ct2 @ ct1);; + + + let p1 = !Prep.prep_ineqs;; + let i1 = map (fun t -> t.ineq) p1;; + let i1 =[ (find (fun t -> (t.idv = "2200527225")) p1).ineq];; + hd i1;; + let h1 = (ASSUME (snd(strip_forall (List.nth i1 0))));; + let test = + let u = REWRITE_RULE + [Nonlin_def.unit6;Sphere.rad2_x;Sphere.y_of_x;Sphere.rho_x;Sphere.delta_x; + Sphere.ineq;Nonlin_def.sqrt_x1;Nonlin_def.sqrt_x2;Nonlin_def.sqrt_x3; + Nonlin_def.sqrt_x4;Nonlin_def.sqrt_x4;Nonlin_def.sqrt_x5;Nonlin_def.sqrt_x6; + Sphere.vol_x;Sphere.gchi1_x;Sphere.gchi;Sphere.gchi2_x;Sphere.gchi3_x; + Sphere.gchi4_x;Sphere.gchi5_x;Sphere.gchi6_x; + Sphere.dih_x;Sphere.dih2_x;Sphere.dih3_x;Sphere.dih4_x;Sphere.dih5_x; + Sphere.dih6_x;Sphere.dih_y;Sphere.dih2_y;Sphere.dih3_y; + Sphere.dih4_y;Sphere.dih5_y;Sphere.dih6_y; + LET_DEF;LET_END_DEF; + Sphere.delta_x4;Sphere.dih_x;Nonlin_def.unit6; + Sphere.delta_y_LC;Sphere.delta_y;Nonlin_def.proj_x2;Nonlin_def.proj_x3; + Mdtau.mdtau_y_LC;Mdtau.mdtau_y;Mdtau.mdtau2uf_y_LC;Mdtau.mdtau2uf_y;Sphere.rho;Sphere.ups_x; + Sphere.ly;Mdtau.dua;Sphere.sol_y;Sphere.interp; + Sphere.rhazim_x;Sphere.rhazim2_x;Sphere.rhazim3_x;Sphere.rhazim;Sphere.const1; + Sphere.rhazim2;Sphere.rhazim3;Sphere.node2_y;Sphere.node3_y; + ] h1 in + (concl u);; +Print_types.print_term_types test;; + + let hs1 r = (ASSUME (snd(strip_forall (List.nth (is1 (List.nth cases r)) 0))));; + let h2 = REWRITE_RULE + [Nonlin_def.unit6;Sphere.rad2_x;Sphere.y_of_x;Sphere.rho_x;Sphere.delta_x; + Sphere.ineq;Nonlin_def.sqrt_x1;Nonlin_def.sqrt_x2;Nonlin_def.sqrt_x3; + Nonlin_def.sqrt_x4;Nonlin_def.sqrt_x4;Nonlin_def.sqrt_x5;Nonlin_def.sqrt_x6; + Sphere.vol_x;Sphere.gchi1_x;Sphere.gchi;Sphere.gchi2_x;Sphere.gchi3_x; + Sphere.gchi4_x;Sphere.gchi5_x;Sphere.gchi6_x; + Sphere.dih_x;Sphere.dih2_x;Sphere.dih3_x;Sphere.dih4_x;Sphere.dih5_x; + Sphere.dih6_x;Sphere.dih_y;Sphere.dih2_y;Sphere.dih3_y; + Sphere.dih4_y;Sphere.dih5_y;Sphere.dih6_y; + LET_DEF;LET_END_DEF; + Sphere.delta_x4;Sphere.dih_x;Nonlin_def.unit6; + Nonlin_def.gamma3f_x_div_sqrtdelta; + Nonlin_def.sub6;Nonlin_def.constant6;Nonlin_def.mul6; + Nonlin_def.scalar6;Nonlin_def.add6;Nonlin_def.mk_456; + Sphere.rotate4;Sphere.rotate5;Sphere.rotate6; + Nonlin_def.uni;Nonlin_def.two6;Nonlin_def.proj_x4;Nonlin_def.proj_x5; + Nonlin_def.proj_x6;Nonlin_def.compose6; + Sphere.sol_euler_x_div_sqrtdelta;Nonlin_def.proj_y4;Nonlin_def.proj_y5; + Nonlin_def.proj_y6; + + ] (hs1 10);; + +List.nth p1 3;; +list_mk_conj;; + +Nonlin_def.unit6;; +Sphere.dih_x;; + + +Sphere.atn2;; + + let cxx i = setify (map fst (Print_types.get_const_types i));; + + let p1 = !Prep.prep_ineqs;; + let i1 = map (fun t -> t.ineq) p1;; + let ct1 = setify (List.flatten (map cxx i1));; + + let i2 = map (fun t -> t.ineq) (!Ineq.ineqs);; + let ct2 = setify (List.flatten (map cxx i2));; + + let ct3 = setify (ct2 @ ct1);; + + +Nonlin_def.safesqrt;; + +List.nth p1 3;; +list_mk_conj;; + +Nonlin_def.unit6;; +Sphere.dih_x;; + + +Sphere.atn2;; + + +ct1;; +List.length ct1;; + +flyspeck_needs "../glpk/sphere.ml";; +flyspeck_needs "nonlinear/check_completeness.hl";; + let check_completeness_out = Check_completeness.execute();; + + +(* bcc lattice revisited *) + + + + +(* BCC LATTICE PROJECT *) + +flyspeck_needs "../projects_discrete_geom/bcc_lattice.hl";; + let ineq_list = ["EIFIOKD-a";"EIFIOKD-b";"EIFIOKD-c";"EIFIOKD1";"EIFIOKD2";"EIFIOKD3";"EIFIOKD4"];; +let testid = "EIFIOKD-a";; + +let uu = (hd(Ineq.getexact testid)).ineq;; + let vv = REWRITE_RULE + [LET_DEF;LET_END_DEF; + Bcc_lattice.selling_surface_nn; + Bcc_lattice.selling_surface_num; + Bcc_lattice.selling_volume2; + Bcc_lattice.bcc_value; + ] (ASSUME uu);; + +Ineq.add { + idv=(testid^"-test"); + ineq = (concl vv); + doc = "BCC"; + tags = []; +};; + +1;; + + let testid2 = testid^"-test";; +Optimize.testsplit false testid2;; +map (Optimize.testsplit true) !testids;; + +(* END BCC *) + +Auto_lib.terms_with_real_arity_ge8;; +report Auto_lib.fn_code;; +Auto_lib.tmpfile;; + Optimize.preprocess_split_idq (hd(Ineq.getexact "test B1-100"));; +Auto_lib.mkfile_code (all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] + (( taum y1 y2 y3 y4 y5 y6 + + y_of_x (mudLs_234_x (sqrt(&15)) (&10) (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + > #0.712) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &15 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &100 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) +)`) "X" [];; + +itlist;; +flyspeck_needs;; +install_functions();; +rflyspeck_needs "nonlinear/scripts.hl";; + + let run s = + let _ = Ineq.add s in + Scripts.one_cfsqp s.idv;; + + rflyspeck_needs "nonlinear/auto_lib.hl";; + + let run2 s = + let _ = Ineq.add s in + Auto_lib.testsplit true s.idv;; + + let run2f s = + let _ = Ineq.add s in + Auto_lib.testsplit false s.idv;; + +for i1=0 to 4 do +for i2=i1 to 4 do +for i3=i2 to 4 do + run2 (make_hex_ear i1 i2 i3) done done done;; + + + let r k = report (string_of_int k);; +r 1;; + +(* +let is_sphere= new_definition`is_sphere x=(?(v:real^3)(r:real). (r> &0)/\ (x={w:real^3 | norm (w-v)= r}))`;; + + +let NULLSET_RULES2 = prove_by_refinement + (`(!P. ((plane P)\/ (is_sphere P) \/ (circular_cone P)) ==> NULLSET P) /\ + (!(s:real^3->bool) t. (NULLSET s /\ NULLSET t) ==> NULLSET (s UNION t))`, + [ + SIMP_TAC[NEGLIGIBLE_UNION] ; + X_GEN_TAC `s:real^3->bool` THEN STRIP_TAC; + MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE ; + SIMP_TAC[COPLANAR; DIMINDEX_3; ARITH] THEN ASM_MESON_TAC[SUBSET_REFL]; + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [is_sphere]) ; + STRIP_TAC THEN ASM_REWRITE_TAC[GSYM dist] ; + ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[NEGLIGIBLE_SPHERE]; + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [circular_cone]) ; + REWRITE_TAC[EXISTS_PAIRED_THM; c_cone] THEN STRIP_TAC ; + ASM_REWRITE_TAC[] ; + MP_TAC(ISPECL [`w + v:real^3`; `v:real^3`; `r:real`] NEGLIGIBLE_RCONE_EQ) ; + ASM_REWRITE_TAC[rcone_eq; rconesgn] ; + REWRITE_TAC[dist; VECTOR_ARITH `(w + v) - v:real^N = w`] ; + ASM_REWRITE_TAC[VECTOR_ARITH `w + v:real^N = v <=> w = vec 0`] + ]);; + +let NULLSET_IS_SPHERE = prove_by_refinement + (`(!P. is_sphere P ==> NULLSET P)`, + [ + X_GEN_TAC `s:real^3->bool` THEN STRIP_TAC; + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [is_sphere]) ; + STRIP_TAC THEN ASM_REWRITE_TAC[GSYM dist] ; + ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[NEGLIGIBLE_SPHERE]; + ]);; +*) +1;; + +add +{ + idv="1347067436"; + doc="old name: local max v4*, WNLKGOQ, 1671775772 (with #0.12->#0.1) 8146670324 + better local max test. + This is the numerator of the 2nd derivative of the function taud. + Case delta > 20."; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.237); + (&2,y5,&2); + (&2,y6,&2) + ] + (y_of_x taud_D1_num_x y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x taud_D1_num_x y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x taud_D2_num_x y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x taud_x y1 y2 y3 y4 y5 y6 > #0.12 \/ + delta_y y1 y2 y3 y4 y5 y6 < &20)`; +};; + +run +{ + idv="test 8723570049"; + doc="local fan/main estimate/terminal pent + y1=2.52, delta>=20, falls into taum>=0.12 case"; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (#2.52,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.237); + (&2,y5,&2); + (&2,y6,&2) + ] +(taud y1 y2 y3 y4 y5 y6 > #0.12 \/ +delta_y y1 y2 y3 y4 y5 y6 < &20 +)`; +};; + + + +Calc_derivative.differentiate `f:real->real` `x:real` `(:real)`;; +Calc_derivative.differentiate `\x. (f (x pow 2)):real` `x:real` `(:real)`;; + + + +run + { +idv = "test 22065952723 A1"; +doc = "This is the case that $a_2 \\le 15.53$. + $a_2$ upper bound changed on 2011-Jan-21. + If larger than 15.53, it must be in a hexagon, and two consecutive straight vertices. + Warning: this is verified by custom code (using cfsqp heuristics) + in the interval arithmetic calculations. + Fixed statement 2013-06-01. + "; +(* was (num_combo1 e1 e2 e3 a2 b2 c2 > &0) *) +tags=[Flypaper["UPONLFY"];Tex]; +ineq = Sphere.all_forall `ineq + [ + (&1 , e1, &1 + sol0/ pi); + (&1 , e2, &1 + sol0/ pi); + (&1 , e3, &1 + sol0/ pi); + ((&2 / h0) pow 2, a2, #15.53); + ((&2 / h0) pow 2, b2, &4 pow 2); + ((&2 / h0) pow 2, c2, &4 pow 2) + ] + ((num1 e1 e2 e3 a2 b2 c2) pow 2 > &0 \/ + num2 e1 e2 e3 a2 b2 c2 < &0)`; +};; + + +time;; +List.length Check_completeness.r_init;; (* 15 *) +List.length Check_completeness.triquad_assumption;; (* 3 *) + + +Check_completeness.terminal_cs;; +List.length Check_completeness.terminal_cs;; +List.nth Check_completeness.terminal_cs 21;; + +run +{ + idv="2900061606"; + doc="triangle 1,2-ac"; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = Sphere.all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#2.52,y5,#2.52); + (#3.01,y6,#3.01) + ] +( + taum y1 y2 y3 y4 y5 y6 > tame_table_d 1 2 + (tame_table_d 2 1 - #0.11) + )`; +};; + +run +{ + idv="testx"; + doc=""; + tags=[Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = Sphere.all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + ups_x (y2*y2) (y3*y3) (y4*y4) * ups_x (y4*y4) (y5*y5) (y6*y6) > &0 + )`; +};; + +(* +June 4, 2013: + +3 long: 4010906068 +2 long: 6833979866 +1 long (out to sqrt8): 5541487347 + +deprecated: +OMKYNLT .... +7645170609;; +*) + +Ineq.getexact "5541487347";; +open Terminal;; + + + + +new_build_silent();; + + + + +let old_then = ( THEN );; +let old_prove = prove;; +let old_prove_by_refinement = prove_by_refinement;; + +old_then;; + +let tactic_counter = ref [3];; + +let new_prove_by_refinement(g,thml) = + let _ = tactic_counter := (List.length thml :: !tactic_counter) in + old_prove_by_refinement (g,thml);; + +let prove_by_refinement = new_prove_by_refinement;; + +rflyspeck_needs "packing/counting_spheres.hl";; +let _ = + let prove_by_refinement = new_prove_by_refinement in + flyspeck_needs "packing/counting_spheres.hl";; + +!tactic_counter;; + +let tlist = (Lib.sort (<) !tactic_counter);; +List.length tlist;; +List.nth (Lib.sort (<) tlist) (188 / 2);; + +end_itlist (+) tlist;; + +(end_itlist (+) ) (snd (chop_list (188 /2) tlist));; + + +let all_forall = Sphere.all_forall;; + + +run2 +{ + idv="8495326405"; + doc=" Main estimate/quad case. + "; + tags=[Flypaper["FHOLLLW"];Cfsqp;Main_estimate;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,&2); + (&2,y2,&2); + (#3.01,y3,&6); + (&2,y4,&2); + (&2 * h0,y5,&2 * h0); + (#3.01,y6,&6) + ] + ( delta_y y1 y2 y3 y4 y5 y6 < &0)`; +};; + + +run +{ + idv="test 8748498390"; + doc=" 0.513 estimate, A-piece triangle. + One diagonal exactly 3.01. Added 2013-06-13"; + tags=[Flypaper["FHOLLLW"];Cfsqp;Main_estimate;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.1); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); + (#2.52,y5,#3.01); + (#3.01,y6,#3.01) + ] + ( taum y1 y2 y3 y4 y5 y6 + #0.12 * (y1 - &2) > #0.403 )`; +};; + +run +{ + idv="test 2445657182"; + doc=" 0.513 estimate. ear. Combine with 8748498390 along diagonal 3.01. + Added 2013-06-13."; + tags=[Flypaper["FHOLLLW"];Cfsqp;Main_estimate;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); + (&2,y5,#2.52); + (#3.01,y6,#3.01) + ] + ( taum y1 y2 y3 y4 y5 y6 > #0.11 + #0.12 * (y1 - &2))`; +};; + +(* + #0.5 * (#3.01 - y6) ;; *) + +run +{ + idv="test 2445657182"; + doc=" 0.513 estimate. ear. Combine with 8748498390 along diagonal 3.01. + Added 2013-06-13."; + tags=[Flypaper["FHOLLLW"];Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&1,y1,&1); + (&2,y2,#2.52); + (&2,y3,#2.52); + (sqrt8,y4,#3.0); + (&2,y5,#2.52); + (&2,y6,#2.52) + ] + ( delta_y (&0) y2 y3 y4 y5 y6 > &0 )`; +};; + +add +{ + idv="test"; + doc= "Used with 5691615370. + Added 2013-06-19."; + tags=[Cfsqp;Xconvert;Tex;Lp_aux "5691615370";Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&3,y1,&4 * h0); + (&2,y2,#2.472); + (&2,y3,#2.472); + (&3,y4,&4 * h0); + (&2,y5,#2.472); + (&2,y6,#2.472) + ] + ( y1 < &4 \/ delta_y y1 y2 y3 y4 y5 y6 < &0 )`; +};; + +add +{ + idv="test"; + doc= ""; + tags=[Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&3,y1,&4 * h0); + (&2,y2,#2.472); + (&2,y3,#2.472); + (&3,y4,&4 * h0); + (&2,y5,#2.472); + (&2,y6,#2.472) + ] + ( delta_y y1 y2 y3 y4 y5 y6 < &200 )`; +};; + + + +let eta2_126 = new_definition `eta2_126 x1 (x2:real) (x3:real) (x4:real) (x5:real) x6 = + (eta_y (sqrt x1) (sqrt x2) (sqrt x6)) pow 2`;; + +Functional_equation.functional_overload();; + +let nonf_ups_126 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. ups_126 x1 x2 x3 x4 x5 x6 = ups_x x1 x2 x6`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.ups_126]; + BY(Functional_equation.F_REWRITE_TAC) + ]);; + (* }}} *) + + +searcht 5 [`BB1`];; + +let t = `V = IMAGE vv (:num)`;; + let (a,b) = dest_eq t ;; + let b' = env (top_realgoal()) b ;; + let a' = tysubst [type_of b',type_of a] a ;; + type_of a';; + type_of b';; + type_of b;; + let t' = mk_eq (a',b') ;; + ABBREV_TAC t' (asl,w);; + +top_goal();; +inst;; + + type_of (inst [`:B`,`:A`] `x:A`);; + +help "inst";; +help "type_subst";; +help "tysubst";; +help "instantiate";; + + let t = + let (a,b) = dest_eq t ;; + let b' = env (asl,w) b ;; + let (a',_) = dest_var a ;; + let t' = mk_eq(mk_var(a',type_of b'),b');; +type_of t';; + +ABBREV_TAC t' (asl,w);; + + + +run +{ + idv="4887115291"; + doc="old name: angles pent* + Local-fan/Main-estimate/Terminal-pent/both-ears-under-20. + "; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.01); + (&2,y5,&2); + (&2,y6,&2) + ] +( #1.75 < dih_y y1 y2 y3 y4 y5 y6 +)`; +};; + +run +{ + idv="6789182745"; + doc="old name: test A* + Local-fan/Main-estimate/Terminal-pent/both-ears-under-20. + "; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = Sphere.all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237) + ] +( + (dih_y y1 y2 y3 y4 y5 y6 < #1.109) + )`; +};; + +run +{ + idv="3405144397-numerical"; + doc="old name: test8* + Local-fan/Main-estimate/terminal-pent/both-ears-under-20. + ear dih inequality when delta < 20"; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (&2,y5,&2); + (#3.01,y6,#3.237) + ] +( + (delta_y y1 y2 y3 y4 y5 y6 > &20) \/ + (dih_y y1 y2 y3 y4 y5 y6 < (#1.75 - #1.109) / &2) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +run +{ + idv="test 3405144397"; + doc="ear dih ineq when delta < 20. + Local-fan/Main-estimate/Terminal-pent/both-ears-under-20. + Adaptation of 9459075374. + (EAR) A bound on the delta of an ear in a pent, + The disjunct (dih_y y1 y2 y3 y4 y5 y6 < #0.3205 = (1.75-1.109)/2) has been 'linearized'. + Tan[0.3205]^2 = (>=) 0.110186 + In more detail, this calc shows that delta > 20 or dih < 0.3205 + By 4887115291, we know that the combined angle at the crowded node of a pent is + at least 1.75. If both ears have delta < 20, then combined angle + is at least 1.109 + 2 * 0.3205 = 1.75, so a cross diag <= 3.01. + Hence wlog one of the two ears has delta >= 20. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(50.0,500.0);]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (&2,y6,#2.52) + ] +(let tan2lower = #0.110186 in + (delta_y y1 y2 y3 y4 y5 y6 > &20) \/ + (&4 * x1_delta_y y1 y2 y3 y4 y5 y6 < tan2lower * delta4_squared_y y1 y2 y3 y4 y5 y6) + )`; +};; + + let all_forall = Sphere.all_forall;; + + +List.length remain;; + + (filter Merge_ineq.is_ox3q1h (!Ineq.ineqs));; + + Merge_ineq.packing_ineq_data;; + +Ysskqoy.pack_ineq_def_a;; + + +Script.unfinished_cases();; +searcht 5 [def "deformation"];; + +g Appendix.NUXCOEAv2_concl;; + +let NUXCOEAv2=prove_by_refinement((Appendix.NUXCOEAv2_concl), +MP_TAC Nuxcoea.NUXCOEA + ASM_REWRITE_TAC[Lunar_deform.MHAEYJN;Zlzthic.ZLZTHIC] +mt[] +st/r +fxa mmp +typ `j` ex +rule (orr[EQ_SYM_EQ]) +art[] +THEN MESON_TAC[]);; + +g Appendix.IMJXPHRv2_concl;; + +let IMJXPHRv2=prove((Appendix.IMJXPHRv2_concl), +MP_TAC Imjxphr.IMJXPHR + ASM_REWRITE_TAC[Lunar_deform.MHAEYJN;Zlzthic.ZLZTHIC] +mt[] + THEN + MESON_TAC[]);; + +g Appendix.ODXLSTCv2_concl;; + +let ODXLSTCv2=prove((Appendix.ODXLSTCv2_concl), +MP_TAC Odxlstcv2.ODXLSTCv2 + ASM_REWRITE_TAC[Lunar_deform.MHAEYJN;Zlzthic.ZLZTHIC] +st/r +fxa (C intro [`s`;`k`;`w`;`l`]) +rt[] +amt[] + +art[] + +rt[] +mt[] + + +THEN MESON_TAC[]);; + +Appendix.NUXCOEAv2_concl;; + +module Test = struct + + open Imjxphr;; + open Nuxcoea;; + +let NUXCOEAv2=prove((Appendix.NUXCOEAv2_concl), +MP_TAC NUXCOEA +THEN ASM_REWRITE_TAC[Lunar_deform.MHAEYJN;Zlzthic.ZLZTHIC] +THEN MESON_TAC[]);; + + +let IMJXPHRv2=prove((Appendix.IMJXPHRv2_concl), +MP_TAC IMJXPHR +THEN ASM_REWRITE_TAC[Lunar_deform.MHAEYJN;Zlzthic.ZLZTHIC] +THEN MESON_TAC[]);; + + +let ODXLSTCv2=prove_by_refinement((Appendix.ODXLSTCv2_concl), +[ + MP_TAC Odxlstcv2.ODXLSTCv2; + ASM_REWRITE_TAC[Lunar_deform.MHAEYJN;Zlzthic.ZLZTHIC]; + REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`s`;`k`;`w`;`l`]); + REWRITE_TAC[]; + BY(ASM_MESON_TAC[]) +]);; + + + end;; + +searcht 5 [`arclength`;`atn`];; + +let arclength222h0 = prove_by_refinement( + `arclength (&2) (&2) (&2 * h0) < pi / &2`, + (* {{{ proof *) + [ + GMATCH_SIMP_TAC Compute_2158872499.ATN_UPS_X_BREAKDOWN1; + CONJ_TAC; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL_EQ); + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `x + y < x <=> y < &0`]; + ONCE_REWRITE_TAC[GSYM ATN_0]; + MATCH_MP_TAC ATN_MONO_LT; + REWRITE_TAC[arith `(x / y < &0 <=> &0 < (-- x)/ y)`]; + GMATCH_SIMP_TAC REAL_LT_DIV; + GMATCH_SIMP_TAC SQRT_POS_LT; + REWRITE_TAC[Sphere.h0]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let arclength_2h0_cstab = prove_by_refinement( + `arclength (&2) (&2) (&2 *h0) + arclength (&2) (&2) cstab < pi`, + (* {{{ proof *) + [ + REPEAT (GMATCH_SIMP_TAC Compute_2158872499.ATN_UPS_X_BREAKDOWN1); + REWRITE_TAC[GSYM CONJ_ASSOC]; + CONJ_TAC; + BY(REWRITE_TAC[Sphere.h0;Sphere.cstab] THEN REAL_ARITH_TAC); + CONJ_TAC; + BY(REWRITE_TAC[Sphere.h0;Sphere.cstab] THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `(pi/ &2 + b) + (pi / &2 + d) < pi <=> b + d < &0`]; + REWRITE_TAC[Sphere.h0;Sphere.cstab]; + MP_TAC (Flyspeck_constants.calc `atn (((&2 * #1.26) * &2 * #1.26 - &2 * &2 - &2 * &2) / sqrt ((&2 + &2 + &2 * #1.26) * (&2 + &2 - &2 * #1.26) * (&2 + &2 * #1.26 - &2) * (&2 * #1.26 + &2 - &2))) + atn (( #3.01 * #3.01 - &2 * &2 - &2 * &2) / sqrt ((&2 + &2 + #3.01) * (&2 + &2 - #3.01) * (&2 + #3.01 - &2) * ( #3.01 + &2 - &2))) < &0`); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +run + { + idv="test 6843920790"; + doc = "In a pentagon with one long edge, we can contract the long edge to 2.52, + or even to 2, using 2 diags. + The constant 2.38 < 3.01/h0."; + tags=[]; + ineq = Sphere.all_forall `ineq + [ + (&1 , e1, &1 + sol0/ pi); + (&1 , e2, &1 + sol0/ pi); + (&1 , e3, &1 + sol0/ pi); + ((&2 / h0) pow 2, a2, #2.52 pow 2); + (#2 pow 2, b2, #15.53); + ((#3.01/ #1.26) pow 2, c2, #15.53) + ] + ((num1 e1 e2 e3 a2 b2 c2 > &0) ) `; + };; + +help_grep "strip";; +let thm = Localization.deformation;; + +let c = fst(dest_const (fst (strip_comb (fst (dest_eq (snd (strip_forall (concl thm))))))));; + +(* TRIAL DEFINITION *) + +let deflist = ref [];; + +let adddef thm = + let c = fst(dest_const (fst (strip_comb (fst (dest_eq (snd (strip_forall (concl thm)))))))) in + let _ = deflist := (c,thm)::!deflist in + c;; + +let getd s = + try assoc s (!deflist) + with _ -> failwith ("definition "^s^" not found");; + +List.length !proof_record;; +hd !proof_record;; + + +bb;; +find;; +index;; + + +Searching.searcht 5 [`!f g x. + f continuous at x /\ g continuous at x + ==> (\x. lift (f x dot g x)) continuous at x`];; +Searching.searcht 5 [`T`];; + +module Xx = struct + open Hales_tactic;; +let REAL_CONTINUOUS_AT_DOT2 = prove_by_refinement( + `!(f:real->real^A) g x. f continuous atreal x /\ g continuous atreal x + ==> (\x. (f x dot g x)) real_continuous atreal x`, + (* {{{ proof *) + [ + REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `lift o (\x. f x dot g x) = (\x. lift (f x dot g x))` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[FUN_EQ_THM;o_DEF]); + INTRO_TAC CONTINUOUS_LIFT_DOT2 [`f o drop`;`g o drop`;`lift x`]; + TYPIFY `(\x. lift ((f o drop) x dot (g o drop) x)) = (\x. lift (f x dot g x)) o drop` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[FUN_EQ_THM;o_DEF]); + BY(ASM_REWRITE_TAC[GSYM Xbjrphc.CONTINUOUS_CONTINUOUS_ATREAL]) + ]);; + (* }}} *) +end;; + +let CONTINUOUS_LIFT_DOT2 = prove + (`!net f:A->real^N g. + f continuous net /\ g continuous net + ==> (\x. lift(f x dot g x)) continuous net`, + REPEAT GEN_TAC THEN DISCH_THEN(MP_TAC o MATCH_MP (MATCH_MP (REWRITE_RULE + [TAUT `p /\ q /\ r ==> s <=> r ==> p /\ q ==> s`] + BILINEAR_CONTINUOUS_COMPOSE) BILINEAR_DOT)) THEN REWRITE_TAC[]);; + +(* +let REAL_CONTINUOUS_AT_DOT2 = prove_by_refinement( + `!(f:real->real^A) g x. f continuous atreal x /\ g continuous atreal x + ==> (\x. (f x dot g x)) real_continuous atreal x`, + (* {{{ proof *) + [ + REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `lift o (\x. f x dot g x) = (\x. lift (f x dot g x))` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[FUN_EQ_THM;o_DEF]); + INTRO_TAC CONTINUOUS_AT_LIFT_DOT2 [`f o drop`;`g o drop`;`lift x`]; + TYPIFY `(\x. lift ((f o drop) x dot (g o drop) x)) = (\x. lift (f x dot g x)) o drop` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[FUN_EQ_THM;o_DEF]); + BY(ASM_REWRITE_TAC[GSYM (* Xbjrphc. *) CONTINUOUS_CONTINUOUS_ATREAL]) + ]);; + (* }}} *) +*) + +module Test = struct + open Hales_tactic;; +let REAL_CONTINUOUS_AT_DOT2 = prove_by_refinement( + `!(f:real->real^A) g x. f continuous atreal x /\ g continuous atreal x + ==> (\x. (f x dot g x)) real_continuous atreal x`, + (* {{{ proof *) + [ + REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `lift o (\x. f x dot g x) = (\x. lift (f x dot g x))` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[FUN_EQ_THM;o_DEF]); + MATCH_MP_TAC CONTINUOUS_LIFT_DOT2; + ASM_REWRITE_TAC[]; + ]);; + (* }}} *) +end;; + + +proof_record := [];; + +String.length " REPEAT GEN_TAC; + ASM_CASES_TAC `~(?x1. a * x1 pow 2 + b * x1 + c = &0)`; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[] THEN REPEAT STRIP_TAC; + ASM_CASES_TAC `!x2. a * x2 pow 2 + b * x2 + c = &0 ==> x2 = x1`; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[NOT_FORALL_THM] THEN REPEAT STRIP_TAC; + GEXISTL_TAC [`x1`;`x2`]; + BY(GEN_TAC THEN ASM_TAC THEN CONV_TAC REAL_RING)";; + +String.length "g/r +asmcs `~(?x1. a * x1 pow 2 + b * x1 + c = &0)` +amt[] +fx mp then rt[] then str/r +asmcs `!x2. a * x2 pow 2 + b * x2 + c = &0 ==> x2 = x1` +amt[] +fx mp then rt[NOT_FORALL_THM] then str/r +exl [`x1`;`x2`] +g then asm then cvc REAL_RING";; + +233.0 /. 414.0;; + + +(* BUGGY BEHAVIOR *) +can (term_match [] `((f:A->B) ((v:num->A) 2))`) `((f:A->B) ((v:num->A) 7))`;; + +can (term_match [] `(f:num->A) 2`) `(f:num->A) 7`;; + +run + { + idv="test"; + doc = ""; + tags=[]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (#3.42,y4,#3.42); + (&2,y5,#3.01); + (&2,y6,&2)] + + ((dih_y y1 y2 y3 y4 y5 y6 > pi / &2) ) `; + };; + +run + { + idv="test"; + doc = ""; + tags=[]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (#3.01,y4,#3.42); + (&2,y5,#3.01); + (#3.01,y6,#3.9)] + + ((delta_y y1 y2 y3 y4 y5 y6 > &0) \/ + arclength y1 y2 y6 > #2.8) `; + };; + +Sphere.h0;; + +let s = "test";; +Ineq.getexact "test";; +let v1 = hd(Ineq.getexact s);; +let v2 = List.length (fst (strip_forall (v1.ineq)));; + +(* analysis of cases with more than 6 variables *) + +let numvars s = + let v1 = hd (Ineq.getexact s) in + List.length (fst (strip_forall (v1.ineq)));; + +let ineqnames = map (fun idq -> idq.idv) (!Ineq.ineqs);; + +filter (fun s -> numvars s > 6) ineqnames;; + +let manyvars = ["9507202313"; "4680581274 delta issue"; "4680581274 a"; "9563139965D"; + "3862621143 revised"; "4240815464 a"; "6944699408 a"; "7043724150 a"];; + +map numvars manyvars;; + + +1;; + +map (fun t -> t.idv) (Ineq.getfield Onlycheckderiv1negative);; + +map (fun t -> t.idv) (filter (fun t -> Optimize.has_cross_diag (t.ineq)) !Prep.prep_ineqs);; + ["7043724150 a"; "6944699408 a"; "4240815464 a"; "3862621143 revised"; + "4680581274"; "4680581274 delta issue"; "7697147739"; + "7697147739 delta issue"; "9507202313"];; +2;; + +Ineq.getexact "4680581274 a";; + +run2 {ineq = + `!y1 y2 y3 y4 y5 y6 y7 y8 y9. + ineq + [ #2.0,y1,&2 * h0; #2.0,y2,&2 * h0; #2.0,y3,&2 * h0; #3.01, + y4, + #3.166; + #2.0, + y5, + &2; #2.0,y6,&2; #2.0,y7,&2 * h0; #2.0,y8,&2; #3.01,y9, #3.01] + (tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > #0.513 \/ + delta_y y1 y2 y3 y4 y5 y6 < &10 \/ + delta4_y y1 y2 y3 y4 y5 y6 > &0 \/ + enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01)`; + idv = "test 4680581274 a"; + doc = + "quad case both diags > 3.01, y9 long.\n 4559601669 gives the gratuitous delta4_y disjunct.\n May 23, changed delta4 constant from -11.2 to 0.\n 2013-05-05, 0.696 -> 0.616."; + tags = + [Flypaper ["FHOLLLW"]; Main_estimate; Cfsqp; Quad_cluster 10000.0; + Xconvert; Tex; Penalty (50., 5000.)]};; + +module Am = Pervasives;; + +let (x0,z0) = ([0.0;0.0;0.0],[1.0;4.0;3.0]);; +let avoid0 = [];; + let w0 = map (fun (xi,zi) -> zi -. xi) (zip x0 z0);; + let avoid_filter = map (fun i -> (mem i avoid0)) (0--(List.length x0 - 1));; + let w' = map (fun (t,b) -> if b then 0.0 else t) (zip w0 avoid_filter);; + let wm = maxlist w' ;; + index wm w';; + +let arclength_lt_1553 = prove_by_refinement( + `&2 * arclength (&2) (&2) (&2 * h0) < arclength (&2) (&2) (sqrt(#15.53))`, + (* {{{ proof *) + [ + REPEAT (GMATCH_SIMP_TAC Compute_2158872499.ATN_UPS_X_BREAKDOWN1); + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL_EQ); + REWRITE_TAC[arith `x + &2 - &2 = x`]; + REWRITE_TAC[Sphere.h0]; + TYPIFY `#3.9 < sqrt (#15.53) /\ sqrt(#15.53) < #3.95` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC REAL_LT_RSQRT; + CONJ_TAC; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC REAL_LT_LSQRT; + BY(REAL_ARITH_TAC); + TYPIFY_GOAL_THEN `&0 < &2 + &2 * #1.26 - &2 /\ &0 < &2 + &2 - &2 * #1.26 /\ &0 < &2 + &2 + &2 * #1.26 /\ &0 < &2 + sqrt #15.53 - &2 /\ &0 < &2 + &2 - sqrt #15.53 /\ &0 < &2 + &2 + sqrt #15.53 /\ &0 < sqrt #15.53 /\ &0 < &2 * #1.26` (unlist REWRITE_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + MP_TAC (Flyspeck_constants.calc `&2 * (pi / &2 + atn (((&2 * #1.26) * &2 * #1.26 - &2 * &2 - &2 * &2) / sqrt ((&2 + &2 + &2 * #1.26) * (&2 + &2 - &2 * #1.26) * (&2 + &2 * #1.26 - &2) * &2 * #1.26))) < pi / &2 + atn ((sqrt #15.53 * sqrt #15.53 - &2 * &2 - &2 * &2) / sqrt ((&2 + &2 + sqrt #15.53) * (&2 + &2 - sqrt #15.53) * (&2 + sqrt #15.53 - &2) * sqrt #15.53))` ); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + + +run + { + idv="testA"; + doc = ""; + tags=[]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2); + (&2,y2,&2); + (&2,y3,&2); + (#3.01,y4,#3.01); + (#3.01,y5,#3.01); + (&2,y6,#2.52)] + ((dih_y y1 y2 y3 y4 y5 y6 > pi / &2) ) `; + };; + + + +run2 + { + idv="test 1348932091"; (* was "testB"; *) + doc = ""; + tags=[Main_estimate;Cfsqp;Tex;Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#2.52,y4,#2.52); + (#3.01,y5,#3.3); + (&2,y6,#2.52)] + ((dih_y y1 y2 y3 y4 y5 y6 < #1.4) ) `; + };; + + +run + { + idv= "test 5557288534"; (* was "testC"; *) + doc = ""; + tags=[Main_estimate;Cfsqp;Tex;Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.01); + (#3.01,y5,#3.3); + (&2,y6,#2.52)] + ((dih_y y1 y2 y3 y4 y5 y6 < #1.7) ) `; + };; + +needs "../formal_lp/hypermap/ineqs/lp_ineqs_proofs-compiled.hl";; +needs "../formal_lp/hypermap/computations/list_hypermap_computations.hl";; + +needs "../formal_lp/hypermap/verify_all.hl";; +Verify_all.init_ineqs();; +let result = Verify_all.verify_file (flyspeck_dir ^"/../formal_lp/glpk/binary/easy_onepass_1.dat");; +hd (fst result);; + +(* +val it : thm = lp_ineqs, lp_main_estimate, + iso (hypermap_of_fan (V,ESTD V)) + (hypermap_of_list + [['0; '1; '2; '3]; ['0; '3; '4; '5]; ['4; '3; '6; '7]; ['6; '3; '2]; ['1; '0; '8; '9]; ['8; '0; '5]; ['2; '1; '10]; ['10; '1; '9]; ['6; '2; '10]; ['5; '4; '11]; ['11; '4; '7]; ['7; '6; '12]; ['12; '6; '10]; ['8; '5; '11]; ['9; '8; '13]; ['13; '8; '11]; ['12; '10; '9]; ['12; '9; '13]; ['13; '11; '7]; ['7; '12; '13]]) + |- contravening V ==> F +*) +type_of `hypermap_of_fan`;; +type_of `hypermap_of_list`;; +result;; +hd(fst result);; +type_of `['0;'1;'2]`;; + +run2f (hd(Ineq.getexact "7550003505 0 1 3"));; + +Print_types.get_const_types;; + + + + +let tab = +[`norm2hh (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + norm2hh_x x1 x2 x3 x4 x5 x6 `; +`rad2_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + rad2_x x1 x2 x3 x4 x5 x6 `; +`delta4_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + delta_x4 x1 x2 x3 x4 x5 x6 `; +`delta4_y (sqrt x7) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x8) (sqrt x9) = + delta_x4 x7 x2 x3 x4 x8 x9 `; +`dih2_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + dih2_x x1 x2 x3 x4 x5 x6 `; +`dih3_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + dih3_x x1 x2 x3 x4 x5 x6 `; +`dih_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + dih_x x1 x2 x3 x4 x5 x6 `; +`dih4_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + dih4_x x1 x2 x3 x4 x5 x6 `; +`dih5_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + dih5_x x1 x2 x3 x4 x5 x6 `; +`dih6_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + dih6_x x1 x2 x3 x4 x5 x6 `; +`delta_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + delta_x x1 x2 x3 x4 x5 x6 `; +`delta_y (sqrt x7) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x8) (sqrt x9) = + delta_x x7 x2 x3 x4 x8 x9`; +`vol_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + vol_x x1 x2 x3 x4 x5 x6 `; +`eta_y (sqrt x1) (sqrt x2) (sqrt x6) pow 2 = eta2_126 x1 x2 x3 x4 x5 x6 `; +`eta_y (sqrt x1) (sqrt x3) (sqrt x5) pow 2 = eta2_135 x1 x2 x3 x4 x5 x6 `; +`eta_y (sqrt x4) (sqrt x5) (sqrt x6) pow 2 = eta2_456 x1 x2 x3 x4 x5 x6 `; +`vol3f (sqrt x1) (sqrt x2) (sqrt x6) sqrt2 lfun = vol3f_x_lfun x1 x2 x3 x4 x5 x6 `; +`vol_y sqrt2 sqrt2 sqrt2 (sqrt x1) (sqrt x2) (sqrt x6) = vol3_x_sqrt x1 x2 x3 x4 x5 x6 `; +`vol3f_sqrt2_lmplus (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + vol3f_x_sqrt2_lmplus x1 x2 x3 x4 x5 x6`; + ];; + +let tab1 = List.nth tab 0;; +fst (strip_comb (fst(dest_eq tab1)));; + + diff --git a/development/thales/session/work_in_progress.hl b/development/thales/session/work_in_progress.hl new file mode 100644 index 0000000..97fb0e9 --- /dev/null +++ b/development/thales/session/work_in_progress.hl @@ -0,0 +1,99 @@ + +module Work_in_progress = struct +end;; + +(* *************************************************************************** *) +(* COMPLETED LEMMAS *) +(* *************************************************************************** *) + +(* *************************************************************************** *) +(* WORK IN PROGRESS *) +(* *************************************************************************** *) + +(* hypermap liason *) + +(* the list bn_Archive is the concatenation of bn_Tri, bn_Quad, bn_Pent, and bn_Hex. + These definitions need to be loaded from the Arch theory (which converts + them from .ML files) *) + + +flyspeck_needs "../tame_archive/tame_archive.hl";; + + + +open Tame_archive;; (* must open because of reflected references *) +open Hypermap;; +open Tame_classification;; + +time Tame_archive.arc3 ();; (* 0.18 secs *) +List.length !Tame_archive.ref3;; (* 9 *) +arc3();; (* build data *) + +let archive3a = new_definition (mk_eq (`archive3a:((num list)list)list`, hol_of_list3 !ref3));; + +let isabelle_graph_class_axiom3 = new_definition + `isabelle_graph_class_axiom3 = (!g. bn_PlaneGraphs g /\ bn_tame g /\ + (!f. bn_Faces g f ==> LENGTH (FST f) = 3) ==> + bn_iso_in (bn_fgraph g) (set_of_list archive3a))`;; + +let isabelle_graph_class_axiom = (* new_definition *) + `tame_graph_classification_theorem = + (!g. bn_PlaneGraphs g /\ bn_tame g ==> bn_iso_in (bn_fgraph g) (set_of_list tame_archive))`;; + +let tame_bn_tame = `!H. tame_hypermap (H:(A)hypermap) + ==> (?g. bn_PlaneGraphs g /\ bn_tame g /\ + iso H (hypermap_of_list (bn_fgraph g)))`;; + +let tame_not_contravening = `isabelle_graph_classification_theorem + ==> (!V. tame_hypermap (hypermap_of_fan (V,ESTD V)) ==> ~contravening V)`;; + +let bn_cong_iso_refl = prove_by_refinement( + `!(g:((A)list)list). bn_cong_iso g g`, + (* {{{ proof *) + [ + REWRITE_TAC[bn_cong_iso]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `I:A->A` EXISTS_TAC; + REWRITE_TAC[bn_is_iso;bn_is_Iso;bn_is_pr_Iso;bn_is_Hom;bn_inj_on;I_THM;MAP_I;IMAGE_I]; + DISJ1_TAC; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let rot_bn_rotate = prove_by_refinement( + `!n s. rot n s = bn_rotate n s`, + (* {{{ proof *) + [ + rt[Seq.rot;bn_rotate;bn_rotate1] + INDUCT_TAC + rt[POWER_0] + rt[Seq.drop0;Seq.take;I_THM;Seq.cats0] +g +rt[POWER;o_THM;bn_rotate1] + ]);; + (* }}} *) + + +let perm_eq_bn_cong_iso = prove_by_refinement( + `!g1 g2. good_list g1 /\ bn_cong_iso g1 g2 ==> perm_eq g1 g2`, + (* {{{ proof *) + [ + rt[Seq.perm_eq;bn_cong_iso] + ]);; + (* }}} *) + + +let bn_cong_iso = prove_by_refinement( + `!g1 g2. good_list g1 /\ bn_cong_iso g1 g2 ==> iso (hypermap_of_list g1) (hypermap_of_list g2)`, + (* {{{ proof *) + [ +g/r + rt[bn_cong_iso;bn_is_iso;bn_is_Iso;bn_is_pr_Iso;bn_is_Hom;bn_inj_on] + rt[bn_congs;iso] +st/r + ]);; + (* }}} *) + + +bn_congs;; + diff --git a/emacs/print-types.ml b/emacs/print-types.ml new file mode 100644 index 0000000..2493f59 --- /dev/null +++ b/emacs/print-types.ml @@ -0,0 +1,58 @@ + +(* + Print the types of the atoms of terms, thms and the goal. +*) +module Print_types + : sig + val goal_types: unit -> unit + val print_thm_types: thm -> unit + val print_term_types: term -> unit + + (* I've elided the common symbols from the list + to avoid clutter. You can add and remove names + of constants from this list with (un)suppress *) + val suppress: string -> unit + val unsuppress: string -> unit + + end = +struct + + let suppressed = ref + ["==>";"?";"!";"/\\";"\\/";",";"~";"APPEND";"CONS";"HD";"LAST"; + "NIL";"=";"real_lt";"real_gt";"real_le";"real_ge";"BIT0";"BIT1";"NUMERAL"; + "real_of_num";"_0";"_1";"real_div";"real_mul";"real_pow";"COND"] + + let suppress s = suppressed := s :: !suppressed + + let unsuppress s = suppressed := List.filter ((!=) s) (!suppressed) + + let rec get_type_list tm = + match tm with + Var(s,t) -> if mem s !suppressed then [] else [(s,t)] + | Const(s,t) -> if mem s !suppressed then [] else [(s,t)] + | Comb (t1,t2) -> get_type_list t1 @ get_type_list t2 + | Abs (t1,t2) -> get_type_list t1 @ get_type_list t2 + + let print_atom_type : string * hol_type -> unit = + fun (s,t) -> + begin + print_string ("(\"" ^ s ^ "\", "); + print_type t; + print_string ")\n" + end + + let setify_types tm = ((sort (<)) o setify o get_type_list) tm + + let print_term_types = List.iter print_atom_type o setify_types + + let print_thm_types tm = print_term_types (concl tm) + + let goal_types() = + let (asms,g) = top_goal() in + let tms = g::asms in + let tm = end_itlist (curry mk_conj) tms in + (print_term_types tm) + +end;; + +open Print_types;; diff --git a/formal_ineqs/arith/arith_cache.hl b/formal_ineqs/arith/arith_cache.hl new file mode 100644 index 0000000..73d67d1 --- /dev/null +++ b/formal_ineqs/arith/arith_cache.hl @@ -0,0 +1,212 @@ +(* =========================================================== *) +(* Cached natural arithmetic *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +(* Dependencies *) +needs "arith_options.hl";; +needs "arith/arith_num.hl";; + + +module Arith_cache = struct + +let cache_size = if !Arith_options.cached then !Arith_options.init_cache_size else 1;; + +(* Hash tables *) +let my_add h key v = + if Hashtbl.length h >= !Arith_options.max_cache_size then + Hashtbl.clear h +(* let _ = Hashtbl.clear h in + print_string "Clearing a nat hash table" *) + else (); + Hashtbl.add h key v;; + +let le_table = Hashtbl.create cache_size and + add_table = Hashtbl.create cache_size and + sub_table = Hashtbl.create cache_size and + sub_le_table = Hashtbl.create cache_size and + mul_table = Hashtbl.create cache_size and + div_table = Hashtbl.create cache_size;; + +(* Counters for collecting stats *) +let suc_counter = ref 0 and + eq0_counter = ref 0 and + pre_counter = ref 0 and + gt0_counter = ref 0 and + lt_counter = ref 0 and + le_counter = ref 0 and + add_counter = ref 0 and + sub_counter = ref 0 and + sub_le_counter = ref 0 and + mul_counter = ref 0 and + div_counter = ref 0 and + even_counter = ref 0 and + odd_counter = ref 0;; + + +(* Clears all cached results *) +let reset_cache () = + let clear = Hashtbl.clear in + clear le_table; + clear add_table; + clear sub_table; + clear sub_le_table; + clear mul_table; + clear div_table;; + + +(* Resets all counters *) +let reset_stat () = + suc_counter := 0; + eq0_counter := 0; + pre_counter := 0; + gt0_counter := 0; + lt_counter := 0; + le_counter := 0; + add_counter := 0; + sub_counter := 0; + sub_le_counter := 0; + mul_counter := 0; + div_counter := 0; + even_counter := 0; + odd_counter := 0;; + +(* Prints stats *) +let print_stat () = + let len = Hashtbl.length in + let suc_pre_str = sprintf "suc = %d\npre = %d\n" !suc_counter !pre_counter in + let cmp0_str = sprintf "eq0 = %d\ngt0 = %d\n" !eq0_counter !gt0_counter in + let lt_str = sprintf "lt = %d\n" !lt_counter in + let even_odd_str = sprintf "even = %d\nodd = %d\n" !even_counter !odd_counter in + let le_str = sprintf "le = %d (le_hash = %d)\n" !le_counter (len le_table) in + let add_str = sprintf "add = %d (add_hash = %d)\n" !add_counter (len add_table) in + let sub_str = sprintf "sub = %d (sub_hash = %d)\n" !sub_counter (len sub_table) in + let sub_le_str = sprintf "sub_le = %d (sub_le_hash = %d)\n" !sub_le_counter (len sub_le_table) in + let mul_str = sprintf "mul = %d (mul_hash = %d)\n" !mul_counter (len mul_table) in + let div_str = sprintf "div = %d (div_hash = %d)\n" !div_counter (len div_table) in + print_string (suc_pre_str ^ cmp0_str ^ lt_str ^ even_odd_str ^ + le_str ^ add_str ^ sub_str ^ sub_le_str ^ mul_str ^ div_str);; + + +(* Note: the standard Hashtbl.hash function works very purely on terms *) +let rec num_tm_hash tm = + if is_comb tm then + let b_tm, n_tm = dest_comb tm in + let str = (fst o dest_const) b_tm in + str ^ num_tm_hash n_tm + else + "";; + +let op_tm_hash tm = + let lhs, tm2 = dest_comb tm in + let tm1 = rand lhs in + num_tm_hash tm1 ^ "x" ^ num_tm_hash tm2;; + + +let tm1_tm2_hash tm1 tm2 = + num_tm_hash tm1 ^ "x" ^ num_tm_hash tm2;; + + +(* SUC *) +let raw_suc_conv_hash tm = + let _ = suc_counter := !suc_counter + 1 in +(* let _ = suc_list := tm :: !suc_list in *) + Arith_hash.raw_suc_conv_hash tm;; + +(* x = 0 *) +let raw_eq0_hash_conv tm = + let _ = eq0_counter := !eq0_counter + 1 in +(* let _ = eq0_list := tm :: !eq0_list in *) + Arith_hash.raw_eq0_hash_conv tm;; + +(* PRE *) +let raw_pre_hash_conv tm = + let _ = pre_counter := !pre_counter + 1 in + Arith_hash.raw_pre_hash_conv tm;; + +(* x > 0 *) +let raw_gt0_hash_conv tm = + let _ = gt0_counter := !gt0_counter + 1 in + Arith_hash.raw_gt0_hash_conv tm;; + +(* x < y *) +let raw_lt_hash_conv tm = + let _ = lt_counter := !lt_counter + 1 in + Arith_hash.raw_lt_hash_conv tm;; + +(* x <= y *) +let raw_le_hash_conv tm = + let _ = le_counter := !le_counter + 1 in + let hash = op_tm_hash tm in + try + Hashtbl.find le_table hash + with Not_found -> + let result = Arith_hash.raw_le_hash_conv tm in + let _ = my_add le_table hash result in + result;; + +(* x + y *) +let raw_add_conv_hash tm = + let _ = add_counter := !add_counter + 1 in + let hash = op_tm_hash tm in + try + Hashtbl.find add_table hash + with Not_found -> + let result = Arith_hash.raw_add_conv_hash tm in + let _ = my_add add_table hash result in + result;; + +(* x - y *) +let raw_sub_hash_conv tm = + let _ = sub_counter := !sub_counter + 1 in + let hash = op_tm_hash tm in + try + Hashtbl.find sub_table hash + with Not_found -> + let result = Arith_hash.raw_sub_hash_conv tm in + let _ = my_add sub_table hash result in + result;; + +let raw_sub_and_le_hash_conv tm1 tm2 = + let _ = sub_le_counter := !sub_le_counter + 1 in + let hash = tm1_tm2_hash tm1 tm2 in + try + Hashtbl.find sub_le_table hash + with Not_found -> + let result = Arith_hash.raw_sub_and_le_hash_conv tm1 tm2 in + let _ = my_add sub_le_table hash result in + result;; + +(* x * y *) +let raw_mul_conv_hash tm = + let _ = mul_counter := !mul_counter + 1 in + let hash = op_tm_hash tm in + try + Hashtbl.find mul_table hash + with Not_found -> + let result = Arith_hash.raw_mul_conv_hash tm in + let _ = my_add mul_table hash result in + result;; + +(* x / y *) +let raw_div_hash_conv tm = + let _ = div_counter := !div_counter + 1 in + let hash = op_tm_hash tm in + try + Hashtbl.find div_table hash + with Not_found -> + let result = Arith_hash.raw_div_hash_conv tm in + let _ = my_add div_table hash result in + result;; + +(* EVEN, ODD *) +let raw_even_hash_conv tm = + let _ = even_counter := !even_counter + 1 in + Arith_hash.raw_even_hash_conv tm;; + +let raw_odd_hash_conv tm = + let _ = odd_counter := !odd_counter + 1 in + Arith_hash.raw_odd_hash_conv tm;; + +end;; diff --git a/formal_ineqs/arith/arith_num.hl b/formal_ineqs/arith/arith_num.hl new file mode 100644 index 0000000..7514ec0 --- /dev/null +++ b/formal_ineqs/arith/arith_num.hl @@ -0,0 +1,1544 @@ +(* =========================================================== *) +(* Formal natural arithmetic with an arbitrary base *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +module type Arith_hash_sig = + sig + val arith_base : int + val num_def : thm + val NUM_THM : thm + val num_const : term + val const_array : term array + val def_array: thm array + val def_thm_array: thm array + val mk_numeral_hash : num -> term + val mk_numeral_array : num -> term + val mk_small_numeral_array : int -> term + val raw_dest_hash : term -> num + val dest_numeral_hash : term -> num + val NUMERAL_TO_NUM_CONV : term -> thm + val NUM_TO_NUMERAL_CONV : term -> thm + (* SUC *) + val raw_suc_conv_hash : term -> thm + val NUM_SUC_HASH_CONV : term -> thm + (* eq0 *) + val raw_eq0_hash_conv : term -> thm + val NUM_EQ0_HASH_CONV : term -> thm + (* PRE *) + val raw_pre_hash_conv : term -> thm + val NUM_PRE_HASH_CONV : term -> thm + (* gt0 *) + val raw_gt0_hash_conv : term -> thm + val NUM_GT0_HASH_CONV : term -> thm + (* eq *) + val raw_eq_hash_conv : term -> thm + val NUM_EQ_HASH_CONV : term -> thm + (* lt, le *) + val raw_lt_hash_conv : term -> thm + val raw_le_hash_conv : term -> thm + val NUM_LT_HASH_CONV : term -> thm + val NUM_LE_HASH_CONV : term -> thm + (* add *) + val raw_add_conv_hash : term -> thm + val NUM_ADD_HASH_CONV : term -> thm + (* sub *) + val raw_sub_hash_conv : term -> thm + val raw_sub_and_le_hash_conv : term -> term -> thm * thm + val NUM_SUB_HASH_CONV : term -> thm + (* mul *) + val raw_mul_conv_hash : term -> thm + val NUM_MULT_HASH_CONV : term -> thm + (* DIV *) + val raw_div_hash_conv : term -> thm + val NUM_DIV_HASH_CONV : term -> thm + (* EVEN, ODD *) + val raw_even_hash_conv : term -> thm + val raw_odd_hash_conv : term -> thm + val NUM_EVEN_HASH_CONV : term -> thm + val NUM_ODD_HASH_CONV : term -> thm +end;; + +(* Dependencies *) +needs "misc/misc.hl";; +needs "misc/vars.hl";; +needs "arith_options.hl";; + +module Arith_hash : Arith_hash_sig = struct + +open Arith_misc;; +open Misc_vars;; + +let arith_base = !Arith_options.base;; +let maximum = arith_base;; + +(******************) + +(* Generate definitions and constants *) + +let fnum_type = `:num->num` and + numeral_const = `NUMERAL` and + bit0_const = `BIT0` and + bit1_const = `BIT1`;; + +(* Names of constants which define "digits" *) +let names_array = Array.init maximum (fun i -> "D"^(string_of_int i));; + +(* Definitions *) +let num_name = "NUM"^(string_of_int arith_base);; +let num_def = new_basic_definition (mk_eq(mk_var(num_name, fnum_type), numeral_const));; +let num_const = mk_const(num_name, []);; +let num_def_sym = SYM num_def;; + +(* |- NUM n = n *) +let NUM_THM = prove(mk_eq(mk_comb(num_const, n_var_num), n_var_num), + REWRITE_TAC[num_def; NUMERAL]);; + +(* |- D_i(n) = i + D_0(n) *) +let mk_bit_definition i = + let lhs = mk_var (names_array.(i), fnum_type) in + let tm1 = mk_binop mul_op_num (mk_small_numeral arith_base) n_var_num in + let tm2 = mk_binop add_op_num tm1 (mk_small_numeral i) in + let rhs = mk_abs (n_var_num, tm2) in + new_basic_definition (mk_eq (lhs, rhs));; + +let def_basic_array = Array.init maximum mk_bit_definition;; +let def_array = Array.init maximum (fun i -> + let basic = def_basic_array.(i) in + let th1 = AP_THM basic n_var_num in + TRANS th1 (BETA (rand (concl th1))));; +let def_table = Hashtbl.create maximum;; +let def_basic_table = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + let _ = Hashtbl.add def_table names_array.(i) def_array.(i) in + Hashtbl.add def_basic_table names_array.(i) def_basic_array.(i) +done;; + + +(* Constants *) +let const_array = Array.init maximum (fun i -> mk_const(names_array.(i),[]));; + +let b0_def = def_array.(0);; +let b0_const = const_array.(0);; +let b0_name = names_array.(0);; + +let max_const = mk_small_numeral maximum;; + + +(* Alternative definition of D_i *) +let ADD_0_n = prove(`_0 + n = n`, + ONCE_REWRITE_TAC[GSYM NUMERAL] THEN + REWRITE_TAC[GSYM ARITH_ADD; ADD_CLAUSES]);; +let ADD_n_0 = prove(`n + _0 = n`, + ONCE_REWRITE_TAC[GSYM NUMERAL] THEN + REWRITE_TAC[GSYM ARITH_ADD; ADD_CLAUSES]);; + +let MUL_n_0 = prove(`n * _0 = 0`, + REWRITE_TAC[NUMERAL] THEN + SUBGOAL_THEN `_0 = 0` MP_TAC THENL [ REWRITE_TAC[NUMERAL]; ALL_TAC ] THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th]) THEN + ARITH_TAC);; + +(* D_i(n) = i + D_0(n) *) +let def_thm i = + let bin = mk_comb(const_array.(i), n_var_num) in + let bi0 = mk_comb(const_array.(i), zero_const) in + let b0n = mk_comb(const_array.(0), n_var_num) in + let rhs = mk_binop add_op_num bi0 b0n in + prove(mk_eq(bin, rhs), REWRITE_TAC[def_array.(i); def_array.(0)] THEN + REWRITE_TAC[MUL_n_0; ADD_CLAUSES] THEN ARITH_TAC);; + +let def_thm_array = Array.init maximum def_thm;; + +let B0_0 = prove(mk_eq(mk_comb(b0_const, zero_const), zero_const), + REWRITE_TAC[b0_def; MUL_n_0; ADD_CLAUSES; NUMERAL]);; + +let B0_EXPLICIT = prove(mk_eq(mk_comb(b0_const, n_var_num), + mk_binop mul_op_num max_const n_var_num), + REWRITE_TAC[b0_def; ADD_CLAUSES]);; + +(******************************) +(* mk_numeral and dest_numeral *) + +(* mk_table *) + +let mk_table = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + Hashtbl.add mk_table (Int i) const_array.(i) +done;; + +(* mk_numeral *) +let max_num = Int maximum;; + +let mk_numeral_hash = + let rec mk_num n = + if (n =/ num_0) then + zero_const + else + let m = mod_num n max_num in + let bit = Hashtbl.find mk_table m in + mk_comb(bit, mk_num(quo_num n max_num)) in + fun n -> if n if n if n < 0 then failwith "mk_small_numeral_array: negative argument" + else mk_comb (num_const, mk_num n);; + +(* dest_table *) +let dest_table_num = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + Hashtbl.add dest_table_num names_array.(i) (Int i) +done;; + + +(* dest_numeral *) +let max_num = Int maximum;; + +let rec raw_dest_hash tm = + if tm = zero_const then + num_0 + else + let l, r = dest_comb tm in + let n = max_num */ raw_dest_hash r in + let cn = fst(dest_const l) in + n +/ (Hashtbl.find dest_table_num cn);; + + +let dest_numeral_hash tm = raw_dest_hash (rand tm);; + + +(******************************) +(* NUMERAL_TO_NUM_CONV: coverts usual HOL numerals into k-bit numerals *) + +let th_num_conv = Array.init maximum (fun i -> (SYM o SPEC_ALL) def_array.(i));; +let mod_op_num = `MOD`;; + +let DIV_BASE = + let h1 = mk_eq(mk_binop div_op_num m_var_num max_const, q_var_num) in + let h2 = mk_eq(mk_binop mod_op_num m_var_num max_const, r_var_num) in + let c = mk_eq(m_var_num, mk_binop add_op_num (mk_binop mul_op_num max_const q_var_num) r_var_num) in + (UNDISCH_ALL o ARITH_RULE) (mk_imp(h1, mk_imp(h2, c)));; + +let ZERO_EQ_ZERO = (EQT_ELIM o REWRITE_CONV[NUMERAL]) `0 = _0`;; +let SYM_ZERO_EQ_ZERO = SYM ZERO_EQ_ZERO;; +let SYM_NUM_THM = SYM NUM_THM;; + +let NUMERAL_TO_NUM_CONV tm = + let rec raw_conv tm = + if (rand tm = zero_const) then + ZERO_EQ_ZERO + else + let th_div = NUM_DIV_CONV (mk_binop div_op_num tm max_const) in + let th_mod = NUM_MOD_CONV (mk_binop mod_op_num tm max_const) in + let q_tm = rand(concl th_div) in + let r_tm = rand(concl th_mod) in + let th0 = INST[tm, m_var_num; q_tm, q_var_num; r_tm, r_var_num] DIV_BASE in + let th1 = MY_PROVE_HYP th_mod (MY_PROVE_HYP th_div th0) in + let r = dest_small_numeral r_tm in + let th2 = INST[q_tm, n_var_num] th_num_conv.(r) in + let th = TRANS th1 th2 in + let ltm, rtm = dest_comb(rand(concl th)) in + let r_th = raw_conv rtm in + TRANS th (AP_TERM ltm r_th) in + + if (fst o dest_const o rator) tm <> "NUMERAL" then + failwith "NUMERAL_TO_NUM_CONV" + else + let th0 = raw_conv tm in + let n_tm = rand(concl th0) in + TRANS th0 (INST[n_tm, n_var_num] SYM_NUM_THM);; + +let replace_numerals = rand o concl o DEPTH_CONV NUMERAL_TO_NUM_CONV;; +let REPLACE_NUMERALS = CONV_RULE (DEPTH_CONV NUMERAL_TO_NUM_CONV);; + +(* NUM_TO_NUMERAL_CONV *) +let NUM_TO_NUMERAL_CONV tm = + let rec raw_conv tm = + if tm = zero_const then + SYM_ZERO_EQ_ZERO + else + let b_tm, n_tm = dest_comb tm in + let n_th = raw_conv n_tm in + let n_tm' = rand(concl n_th) in + let cb = (fst o dest_const) b_tm in + let th0 = Hashtbl.find def_table cb in + let th1 = AP_TERM b_tm n_th in + let th2 = TRANS th1 (INST[n_tm', n_var_num] th0) in + let ltm, rtm = dest_comb(rand(concl th2)) in + let mul_th = NUM_MULT_CONV (rand ltm) in + let add_th0 = AP_THM (AP_TERM add_op_num mul_th) rtm in + let add_th = TRANS add_th0 (NUM_ADD_CONV (rand(concl add_th0))) in + TRANS th2 add_th in + let ltm, rtm = dest_comb tm in + if (fst o dest_const) ltm <> num_name then + failwith "NUM_TO_NUMERAL_CONV" + else + let num_th = INST[rtm, n_var_num] NUM_THM in + let th0 = raw_conv rtm in + TRANS num_th th0;; + +(*************************) +(* SUC_CONV *) + +(* Theorems *) +let SUC_NUM = prove(mk_eq(mk_comb(suc_op_num, mk_comb (num_const, n_var_num)), + mk_comb(num_const, mk_comb (suc_op_num, n_var_num))), + REWRITE_TAC[num_def; NUMERAL]);; + +let SUC_0 = prove(mk_eq(`SUC _0`, mk_comb (const_array.(1), zero_const)), + REWRITE_TAC[def_array.(1); MUL_n_0; ARITH_SUC; NUMERAL; ARITH_ADD]);; + +let suc_th i = + let cflag = (i + 1 >= maximum) in + let suc = if (cflag) then 0 else i + 1 in + let lhs = mk_comb(suc_op_num, (mk_comb (const_array.(i), n_var_num))) in + let rhs = mk_comb(const_array.(suc), + if (cflag) then mk_comb(suc_op_num, n_var_num) else n_var_num) in + let proof = REWRITE_TAC [def_array.(i); def_array.(suc)] THEN ARITH_TAC in + prove(mk_eq(lhs, rhs), proof);; + +let th_suc_array = Array.init maximum suc_th;; +let th_suc_table = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + Hashtbl.add th_suc_table names_array.(i) th_suc_array.(i) +done;; + +let SUC_MAX = th_suc_array.(maximum - 1);; +let bit_max_name = names_array.(maximum - 1);; + +(* Conversion *) +let rec raw_suc_conv_hash tm = + let otm = rand tm in + if (otm = zero_const) then + SUC_0 + else + let btm, ntm = dest_comb otm in + let cn = fst(dest_const btm) in + if (cn = bit_max_name) then + let th = INST [ntm, n_var_num] SUC_MAX in + let ltm, rtm = dest_comb(rand(concl th)) in + TRANS th (AP_TERM ltm (raw_suc_conv_hash rtm)) + else + INST [ntm, n_var_num] (Hashtbl.find th_suc_table cn);; + +let NUM_SUC_HASH_CONV tm = + let ntm = rand (rand tm) in + let th = INST [ntm, n_var_num] SUC_NUM in + let lhs, rhs = dest_eq(concl th) in + if (lhs <> tm) then failwith("NUM_SUC_HASH_CONV") + else + let ltm, rtm = dest_comb rhs in + TRANS th (AP_TERM ltm (raw_suc_conv_hash rtm));; + + +(**************************************) +(* EQ_0_CONV *) +let EQ_0_NUM = prove(mk_eq(mk_eq(mk_comb(num_const, n_var_num), `_0`), `n = _0`), + REWRITE_TAC[num_def; NUMERAL]);; + +let EQ_B0_0 = prove(mk_eq(mk_eq(mk_comb(b0_const, n_var_num), `_0`), `n = _0`), + REWRITE_TAC[b0_def; ADD_CLAUSES; NUMERAL; REWRITE_RULE[NUMERAL] MULT_EQ_0; ARITH_EQ]);; + +let EQ_0_0 = prove(`_0 = _0 <=> T`, REWRITE_TAC[ARITH_EQ]);; + +let eq_0_lemma = REWRITE_RULE[NUMERAL] (ARITH_RULE `a + b = 0 <=> a = 0 /\ b = 0`);; + +let eq_0_i i = + let concl = mk_eq(mk_eq(mk_comb(const_array.(i), n_var_num), zero_const), f_const) in + prove(concl, REWRITE_TAC[def_array.(i); eq_0_lemma; NUMERAL; ARITH_EQ]);; + +let th_eq0_array = Array.init maximum (fun i -> if (i = 0) then EQ_0_0 else eq_0_i i);; + +let th_eq0_table = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + Hashtbl.add th_eq0_table names_array.(i) th_eq0_array.(i) +done;; + +let rec raw_eq0_hash_conv rtm = + if (rtm = zero_const) then + EQ_0_0 + else + let b_tm, n_tm = dest_comb rtm in + let cn = (fst o dest_const) b_tm in + if (cn = b0_name) then + let th0 = INST[n_tm, n_var_num] EQ_B0_0 in + let th1 = raw_eq0_hash_conv n_tm in + TRANS th0 th1 + else + INST[n_tm, n_var_num] (Hashtbl.find th_eq0_table cn);; + +let NUM_EQ0_HASH_CONV rtm = + let n_tm = rand rtm in + let th = INST [n_tm, n_var_num] EQ_0_NUM in + TRANS th (raw_eq0_hash_conv n_tm);; + +(**************************************) +(* PRE_CONV *) + +(* Theorems *) +let PRE_NUM = prove(mk_eq(mk_comb(pre_op_num, mk_comb (num_const, n_var_num)), + mk_comb(num_const, mk_comb (pre_op_num, n_var_num))), + REWRITE_TAC[num_def; NUMERAL]);; + +let PRE_0 = prove(`PRE _0 = _0`, + MP_TAC (CONJUNCT1 PRE) THEN SIMP_TAC[NUMERAL]);; + +let PRE_B1_0 = prove(mk_eq(mk_comb(`PRE`, mk_comb(const_array.(1), `_0`)), `_0`), + REWRITE_TAC[def_array.(1); MUL_n_0; ARITH_ADD; NUMERAL; ARITH_PRE; ARITH_EQ]);; + + +let PRE_B0_n0 = (UNDISCH_ALL o prove)(mk_imp(`n = _0 <=> T`, + mk_eq(mk_comb(`PRE`, mk_comb(b0_const, `n:num`)), `_0`)), + REWRITE_TAC[B0_EXPLICIT] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; MUL_n_0]) THEN + REWRITE_TAC[NUMERAL; ARITH_PRE]);; + +let PRE_B0_n1 = (UNDISCH_ALL o PURE_REWRITE_RULE[NUMERAL] o prove)(mk_imp(`n = 0 <=> F`, + mk_eq(mk_comb(`PRE`, mk_comb(b0_const, `n:num`)), + mk_comb(const_array.(maximum - 1), `PRE n`))), + REWRITE_TAC[B0_EXPLICIT; def_array.(maximum - 1)] THEN ARITH_TAC);; + +let PRE_lemma = (UNDISCH_ALL o PURE_REWRITE_RULE[NUMERAL] o ARITH_RULE) `((n = 0) <=> F) ==> (SUC m = n <=> PRE n = m)`;; + +let pre_th i = + let pre = i - 1 in + let pre_tm = mk_comb(const_array.(pre), n_var_num) in + let suc_tm = mk_comb(suc_op_num, pre_tm) in + let suc_th = raw_suc_conv_hash suc_tm in + let n_tm = rand(concl suc_th) in + let n0_th = raw_eq0_hash_conv n_tm in + let th0 = INST[pre_tm, m_var_num; n_tm, n_var_num] PRE_lemma in + MY_PROVE_HYP n0_th (EQ_MP th0 suc_th);; + + +let th_pre_array = Array.init maximum (fun i -> if i = 0 then REFL `_0` else pre_th i);; + +let th_pre_table = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + Hashtbl.add th_pre_table names_array.(i) th_pre_array.(i) +done;; + +(* Conversion *) +let b1_name = names_array.(1);; +let b1_pre_thm = th_pre_array.(1);; + +let rec raw_pre_hash_conv tm = + let otm = rand tm in + if (otm = zero_const) then + PRE_0 + else + let btm, ntm = dest_comb otm in + let cn = fst(dest_const btm) in + if (cn = b0_name) then + let n_th = raw_eq0_hash_conv ntm in + if (rand(concl n_th) = f_const) then + let th0 = INST[ntm, n_var_num] PRE_B0_n1 in + let th1 = MY_PROVE_HYP n_th th0 in + let ltm, rtm = dest_comb(rand(concl th1)) in + let th2 = raw_pre_hash_conv rtm in + TRANS th1 (AP_TERM ltm th2) + else + let th = INST[ntm, n_var_num] PRE_B0_n0 in + MY_PROVE_HYP n_th th + else + if (cn = b1_name) then + if (ntm = zero_const) then + PRE_B1_0 + else + INST[ntm, n_var_num] b1_pre_thm + else + INST [ntm, n_var_num] (Hashtbl.find th_pre_table cn);; + +let NUM_PRE_HASH_CONV tm = + let ntm = rand (rand tm) in + let th = INST [ntm, n_var_num] PRE_NUM in + let lhs, rhs = dest_eq(concl th) in + if (lhs <> tm) then failwith("NUM_PRE_HASH_CONV") + else + let ltm, rtm = dest_comb rhs in + TRANS th (AP_TERM ltm (raw_pre_hash_conv rtm));; + +(**************************************) +(* GT0_CONV *) + +let gt0_table = Hashtbl.create maximum;; + +let GT0_NUM = (REWRITE_RULE[GSYM num_def] o prove)(`0 < NUMERAL n <=> _0 < n`, REWRITE_TAC[NUMERAL]);; + +let gt0_0 = prove(`_0 < _0 <=> F`, REWRITE_TAC[ARITH_LT]);; +let gt0_b0 = (REWRITE_RULE[NUMERAL] o prove)(mk_eq (mk_binop lt_op_num `0` (mk_comb(b0_const, n_var_num)), `0 < n`), + REWRITE_TAC[b0_def] THEN ARITH_TAC);; + +let gt0_th i = + let bi = const_array.(i) in + let concl = mk_eq (mk_binop lt_op_num zero_num (mk_comb(bi, n_var_num)), t_const) in + let proof = REWRITE_TAC[def_array.(i)] THEN ARITH_TAC in + (PURE_REWRITE_RULE[NUMERAL] o prove)(concl, proof);; + +for i = 1 to maximum - 1 do + Hashtbl.add gt0_table names_array.(i) (gt0_th i) +done;; + +let rec raw_gt0_hash_conv rtm = + if (rtm = zero_const) then + gt0_0 + else + let b_tm, n_tm = dest_comb rtm in + let cn = (fst o dest_const) b_tm in + if (cn = b0_name) then + let th0 = INST[n_tm, n_var_num] gt0_b0 in + let th1 = raw_gt0_hash_conv n_tm in + TRANS th0 th1 + else + INST[n_tm, n_var_num] (Hashtbl.find gt0_table cn);; + +let NUM_GT0_HASH_CONV rtm = + let n_tm = rand rtm in + let th = INST [n_tm, n_var_num] GT0_NUM in + TRANS th (raw_gt0_hash_conv n_tm);; + +(*************************************) +(* EQ *) + +let EQ_NUM = (REWRITE_RULE[SYM num_def] o prove)(`NUMERAL m = NUMERAL n <=> m = n`, REWRITE_TAC[NUMERAL]);; + + +(* EQ tables *) + +(* Generates the theorem |- D_i(m) = D_j(n) <=> F if i <> j and D_i(m) = D_i(n) <=> m = n *) +let gen_bi_eq_bj = + let aux_th = prove(`i < b /\ j < b /\ ~(i = j) ==> ~(b * m + i = b * n + j:num)`, + ONCE_REWRITE_TAC[ARITH_RULE `b * m + i = b * n + j <=> m * b + i = n * b + j:num`] THEN + STRIP_TAC THEN POP_ASSUM MP_TAC THEN + SUBGOAL_THEN `~(b = 0)` ASSUME_TAC THENL [POP_ASSUM MP_TAC THEN ARITH_TAC; ALL_TAC] THEN + REWRITE_TAC[CONTRAPOS_THM] THEN + DISCH_TAC THEN FIRST_ASSUM (MP_TAC o AP_TERM `\x. x DIV b`) THEN REWRITE_TAC[] THEN + FIRST_ASSUM (MP_TAC o MATCH_MP DIV_MULT_ADD) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + SUBGOAL_THEN `i DIV b = 0 /\ j DIV b = 0` (fun th -> REWRITE_TAC[th]) THENL + [ + FIRST_ASSUM (ASSUME_TAC o MATCH_MP DIV_EQ_0) THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[ADD_0] THEN DISCH_TAC THEN + UNDISCH_TAC `m * b + i = n * b + j:num` THEN + ASM_REWRITE_TAC[] THEN ARITH_TAC) in + fun i j -> + let bi_m = mk_comb (const_array.(i), m_var_num) in + let bj_n = mk_comb (const_array.(j), n_var_num) in + let eq_tm = mk_binop eq_op_num bi_m bj_n in + if i = j then + prove (mk_eq (eq_tm, mk_binop eq_op_num m_var_num n_var_num), REWRITE_TAC[def_array.(i)] THEN ARITH_TAC) + else + prove (mk_eq (eq_tm, f_const), REWRITE_TAC[def_array.(i); def_array.(j)] THEN + MATCH_MP_TAC aux_th THEN CONV_TAC NUM_REDUCE_CONV);; + + +let gen_next_eq_thm = + let suc_eq_th = ARITH_RULE `SUC m = SUC n <=> m = n` in + fun th -> + let ltm, n_tm = (dest_comb o lhand o concl) th in + let m_tm = rand ltm in + let th0 = INST[m_tm, m_var_num; n_tm, n_var_num] suc_eq_th in + let suc_m = raw_suc_conv_hash (mk_comb (suc_op_num, m_tm)) in + let suc_n = raw_suc_conv_hash (mk_comb (suc_op_num, n_tm)) in + let th1 = SYM (MK_COMB ((AP_TERM eq_op_num suc_m), suc_n)) in + TRANS (TRANS th1 th0) th;; + + +let th_eq_table = Hashtbl.create (maximum * maximum);; + + +for i = 0 to maximum - 1 do + let sym = INST[n_var_num, m_var_num; m_var_num, n_var_num] o CONV_RULE (LAND_CONV SYM_CONV) in + let th = ref (gen_bi_eq_bj 0 i) in + let name_left = names_array.(0) and + name_right = names_array.(i) in + let _ = Hashtbl.add th_eq_table (name_left ^ name_right) !th in + let _ = if i > 0 then + Hashtbl.add th_eq_table (name_right ^ name_left) (sym !th) + else () in + for k = 1 to maximum - i - 1 do + let x = k and y = i + k in + let name_left = names_array.(x) and + name_right = names_array.(y) in + let _ = th := gen_next_eq_thm (!th) in + let _ = Hashtbl.add th_eq_table (name_left ^ name_right) !th in + if y > x then + Hashtbl.add th_eq_table (name_right ^ name_left) (sym !th) + else + () + done; +done;; + + +(* Conversion *) + +let eq_0_sym = (REWRITE_RULE[NUMERAL] o prove)(`0 = n <=> n = 0`, REWRITE_TAC[EQ_SYM_EQ]);; + +let rec raw_eq_hash_conv tm = + let ltm, rtm = dest_comb tm in + let ltm = rand ltm in + if is_const rtm then + (* n = _0 *) + raw_eq0_hash_conv ltm + else + (* n <> _0 *) + if is_const ltm then + (* m = _0 *) + let th0 = raw_eq0_hash_conv rtm in + let th1 = INST[rtm, n_var_num] eq_0_sym in + TRANS th1 th0 + else + (* m <> _0 *) + let bm_tm, m_tm = dest_comb ltm in + let bn_tm, n_tm = dest_comb rtm in + let cbm = (fst o dest_const) bm_tm in + let cbn = (fst o dest_const) bn_tm in + let th0 = INST[m_tm, m_var_num; n_tm, n_var_num] (Hashtbl.find th_eq_table (cbm^cbn)) in + if cbm <> cbn then + th0 + else + let th1 = raw_eq_hash_conv (rand (concl th0)) in + TRANS th0 th1;; + + +let NUM_EQ_HASH_CONV tm = + let atm, rtm = dest_comb tm in + let ltm = rand atm in + let th = INST [rand ltm, m_var_num; rand rtm, n_var_num] EQ_NUM in + let rtm = rand(concl th) in + TRANS th (raw_eq_hash_conv rtm);; + + + +(*************************************) +(* LT and LE *) + +let LT_NUM = (REWRITE_RULE[SYM num_def] o prove)(`NUMERAL m < NUMERAL n <=> m < n`, REWRITE_TAC[NUMERAL]);; +let LE_NUM = (REWRITE_RULE[SYM num_def] o prove)(`NUMERAL m <= NUMERAL n <=> m <= n`, REWRITE_TAC[NUMERAL]);; + +let LT_n_0 = prove(`n < _0 <=> F`, + SUBGOAL_THEN `_0 = 0` MP_TAC THENL [ REWRITE_TAC[NUMERAL]; ALL_TAC ] THEN + DISCH_THEN (fun th -> PURE_ONCE_REWRITE_TAC[th]) THEN + ARITH_TAC);; + +let LE_0_n = prove(`_0 <= n <=> T`, + SUBGOAL_THEN `_0 = 0` MP_TAC THENL [ REWRITE_TAC[NUMERAL]; ALL_TAC ] THEN + DISCH_THEN (fun th -> PURE_ONCE_REWRITE_TAC[th]) THEN + ARITH_TAC);; + +let SUC_LT_THM = ARITH_RULE `SUC m < SUC n <=> m < n`;; +let SUC_LE_THM = ARITH_RULE `SUC m <= SUC n <=> m <= n`;; + +(* LT tables *) + +(* Generates the theorem |- _0 < bi(n) <=> T (or |- _0 < b0(n) <=> _0 < n) *) +let gen_0_lt_bi i = + let bin = mk_comb (const_array.(i), n_var_num) in + let lt_tm = mk_binop lt_op_num zero_num bin in + if i > 0 then + (PURE_REWRITE_RULE[NUMERAL] o EQT_INTRO o prove)(lt_tm, REWRITE_TAC[def_array.(i)] THEN ARITH_TAC) + else + (PURE_REWRITE_RULE[NUMERAL] o prove)(mk_eq(lt_tm, `0 < n`), REWRITE_TAC[B0_EXPLICIT] THEN ARITH_TAC);; + +let th_lt0_table = Hashtbl.create maximum;; +for i = 0 to maximum - 1 do + let th = gen_0_lt_bi i in + let name = names_array.(i) in + Hashtbl.add th_lt0_table name th +done;; + + +(* Generates the theorem |- bi(m) < bj(n) <=> m <= n (or m < n) *) +let gen_bi_lt_bj i j = + let bim = mk_comb (const_array.(i), m_var_num) in + let bjn = mk_comb (const_array.(j), n_var_num) in + let lt_tm = mk_binop lt_op_num bim bjn in + let rhs = + if i >= j then + mk_binop lt_op_num m_var_num n_var_num + else + mk_binop le_op_num m_var_num n_var_num in + prove(mk_eq(lt_tm, rhs), REWRITE_TAC[def_array.(i); def_array.(j)] THEN ARITH_TAC);; + +(* Given a theorem |- bi(m) < bj(n) <=> P m n, generates the theorem + |- SUC(bi(m)) < SUC(bj(n)) <=> P m n *) +let gen_next_lt_thm th = + let ltm, n_tm = (dest_comb o lhand o concl) th in + let m_tm = rand ltm in + let th0 = INST[m_tm, m_var_num; n_tm, n_var_num] SUC_LT_THM in + let suc_m = raw_suc_conv_hash (mk_comb (suc_op_num, m_tm)) in + let suc_n = raw_suc_conv_hash (mk_comb (suc_op_num, n_tm)) in + let th1 = SYM (MK_COMB ((AP_TERM lt_op_num suc_m), suc_n)) in + TRANS (TRANS th1 th0) th;; + +let th_lt_table = Hashtbl.create (maximum * maximum);; + +for i = 0 to maximum - 1 do + let th = ref (gen_bi_lt_bj 0 i) in + let name_left = names_array.(0) and + name_right = names_array.(i) in + let _ = Hashtbl.add th_lt_table (name_left ^ name_right) !th in + + for k = 1 to maximum - i - 1 do + let x = k and y = i + k in + let name_left = names_array.(x) and + name_right = names_array.(y) in + th := gen_next_lt_thm (!th); + Hashtbl.add th_lt_table (name_left ^ name_right) !th + done; +done;; + +for i = 1 to maximum - 1 do + let th = ref (gen_bi_lt_bj i 0) in + let name_left = names_array.(i) and + name_right = names_array.(0) in + let _ = Hashtbl.add th_lt_table (name_left ^ name_right) !th in + + for k = 1 to maximum - i - 1 do + let x = i + k and y = k in + let name_left = names_array.(x) and + name_right = names_array.(y) in + th := gen_next_lt_thm (!th); + Hashtbl.add th_lt_table (name_left ^ name_right) !th + done; +done;; + +(* LE tables *) + +(* Generates the theorem |- bi(n) <= _0 <=> F (or |- b0(n) <= _0 <=> n <= _0) *) +let gen_bi_le_0 i = + let bin = mk_comb (const_array.(i), n_var_num) in + let lt_tm = mk_binop le_op_num bin zero_num in + if i > 0 then + (PURE_REWRITE_RULE[NUMERAL] o prove)(mk_eq(lt_tm, f_const), REWRITE_TAC[def_array.(i)] THEN ARITH_TAC) + else + (PURE_REWRITE_RULE[NUMERAL] o prove)(mk_eq(lt_tm, `n <= 0`), REWRITE_TAC[B0_EXPLICIT] THEN ARITH_TAC);; + +let th_le0_table = Hashtbl.create maximum;; +for i = 0 to maximum - 1 do + let th = gen_bi_le_0 i in + let name = names_array.(i) in + Hashtbl.add th_le0_table name th +done;; + + +(* Generates the theorem |- bi(m) <= bj(n) <=> m <= n (or m < n) *) +let gen_bi_le_bj i j = + let bim = mk_comb (const_array.(i), m_var_num) in + let bjn = mk_comb (const_array.(j), n_var_num) in + let lt_tm = mk_binop le_op_num bim bjn in + let rhs = + if i > j then + mk_binop lt_op_num m_var_num n_var_num + else + mk_binop le_op_num m_var_num n_var_num in + prove(mk_eq(lt_tm, rhs), REWRITE_TAC[def_array.(i); def_array.(j)] THEN ARITH_TAC);; + +(* Given the theorem |- bi(m) <= bj(n) <=> P m n, generates the theorem + |- SUC(bi(m)) <= SUC(bj(n)) <=> P m n *) +let gen_next_le_thm th = + let ltm, n_tm = (dest_comb o lhand o concl) th in + let m_tm = rand ltm in + let th0 = INST[m_tm, m_var_num; n_tm, n_var_num] SUC_LE_THM in + let suc_m = raw_suc_conv_hash (mk_comb (suc_op_num, m_tm)) in + let suc_n = raw_suc_conv_hash (mk_comb (suc_op_num, n_tm)) in + let th1 = SYM (MK_COMB ((AP_TERM le_op_num suc_m), suc_n)) in + TRANS (TRANS th1 th0) th;; + +let th_le_table = Hashtbl.create (maximum * maximum);; + +for i = 0 to maximum - 1 do + let th = ref (gen_bi_le_bj 0 i) in + let name_left = names_array.(0) and + name_right = names_array.(i) in + let _ = Hashtbl.add th_le_table (name_left ^ name_right) !th in + + for k = 1 to maximum - i - 1 do + let x = k and y = i + k in + let name_left = names_array.(x) and + name_right = names_array.(y) in + th := gen_next_le_thm (!th); + Hashtbl.add th_le_table (name_left ^ name_right) !th + done; +done;; + +for i = 1 to maximum - 1 do + let th = ref (gen_bi_le_bj i 0) in + let name_left = names_array.(i) and + name_right = names_array.(0) in + let _ = Hashtbl.add th_le_table (name_left ^ name_right) !th in + + for k = 1 to maximum - i - 1 do + let x = i + k and y = k in + let name_left = names_array.(x) and + name_right = names_array.(y) in + th := gen_next_le_thm (!th); + Hashtbl.add th_le_table (name_left ^ name_right) !th + done; +done;; + +(* Conversions *) + +let rec raw_lt_hash_conv tm = + let ltm, rtm = dest_comb tm in + let ltm = rand ltm in + if is_const rtm then + (* n < _0 <=> F *) + INST[ltm, n_var_num] LT_n_0 + else + if is_const ltm then + (* _0 < Bi(n) *) + let bn_tm, n_tm = dest_comb rtm in + let cbn = (fst o dest_const) bn_tm in + let th0 = INST[n_tm, n_var_num] (Hashtbl.find th_lt0_table cbn) in + if cbn = b0_name then + let th1 = raw_lt_hash_conv (rand (concl th0)) in + TRANS th0 th1 + else + th0 + else + (* Bi(n) < Bj(m) *) + let bm_tm, m_tm = dest_comb ltm in + let bn_tm, n_tm = dest_comb rtm in + let cbm = (fst o dest_const) bm_tm in + let cbn = (fst o dest_const) bn_tm in + let th0 = INST[m_tm, m_var_num; n_tm, n_var_num] (Hashtbl.find th_lt_table (cbm^cbn)) in + let op = (fst o dest_const o rator o rator o rand o concl) th0 in + let th1 = + if op = "<" then + raw_lt_hash_conv (rand (concl th0)) + else + raw_le_hash_conv (rand (concl th0)) in + TRANS th0 th1 and + + raw_le_hash_conv tm = + let ltm, rtm = dest_comb tm in + let ltm = rand ltm in + if is_const ltm then + (* _0 <= n <=> T *) + INST[rtm, n_var_num] LE_0_n + else + if is_const rtm then + (* Bi(n) <= _0 *) + let bn_tm, n_tm = dest_comb ltm in + let cbn = (fst o dest_const) bn_tm in + let th0 = INST[n_tm, n_var_num] (Hashtbl.find th_le0_table cbn) in + if cbn = b0_name then + let th1 = raw_le_hash_conv (rand (concl th0)) in + TRANS th0 th1 + else + th0 + else + (* Bi(n) <= Bj(m) *) + let bm_tm, m_tm = dest_comb ltm in + let bn_tm, n_tm = dest_comb rtm in + let cbm = (fst o dest_const) bm_tm in + let cbn = (fst o dest_const) bn_tm in + let th0 = INST[m_tm, m_var_num; n_tm, n_var_num] (Hashtbl.find th_le_table (cbm^cbn)) in + let op = (fst o dest_const o rator o rator o rand o concl) th0 in + let th1 = + if op = "<" then + raw_lt_hash_conv (rand (concl th0)) + else + raw_le_hash_conv (rand (concl th0)) in + TRANS th0 th1;; + +let NUM_LT_HASH_CONV tm = + let atm, rtm = dest_comb tm in + let ltm = rand atm in + let th = INST [rand ltm, m_var_num; rand rtm, n_var_num] LT_NUM in + let rtm = rand(concl th) in + TRANS th (raw_lt_hash_conv rtm);; + +let NUM_LE_HASH_CONV tm = + let atm, rtm = dest_comb tm in + let ltm = rand atm in + let th = INST [rand ltm, m_var_num; rand rtm, n_var_num] LE_NUM in + let rtm = rand(concl th) in + TRANS th (raw_le_hash_conv rtm);; + + +(**************************************) +(* ADD_CONV *) + +(* ADD theorems *) + +let ADD_NUM = (REWRITE_RULE[GSYM num_def] o prove) + (`NUMERAL m + NUMERAL n = NUMERAL (m + n)`, REWRITE_TAC[NUMERAL]);; + + +let CADD_0_n = prove(`SUC (_0 + n) = SUC n`, REWRITE_TAC[ADD_0_n]);; +let CADD_n_0 = prove(`SUC (n + _0) = SUC n`, REWRITE_TAC[ADD_n_0]);; + +(* B0 (SUC n) = B0 n + maximum *) +let B0_SUC = prove(mk_eq(mk_comb(b0_const, mk_comb(suc_op_num, n_var_num)), + mk_binop add_op_num max_const (mk_comb(b0_const, n_var_num))), + REWRITE_TAC [B0_EXPLICIT] THEN ARITH_TAC);; + +let B0_ADD = prove(mk_eq(mk_binop add_op_num (mk_comb(b0_const, m_var_num)) (mk_comb(b0_const, n_var_num)), + mk_comb(b0_const, mk_binop add_op_num m_var_num n_var_num)), + REWRITE_TAC[B0_EXPLICIT] THEN ARITH_TAC);; + +let SUC_ADD_RIGHT = prove(`SUC(m + n) = m + SUC n`, ARITH_TAC);; + + +(* Generate all theorems iteratively *) +let th_add_right_next th = + let lhs, rhs = dest_eq(concl th) in + let ltm, rtm = dest_comb rhs in + let cn = fst(dest_const ltm) in + let suc_th = AP_TERM suc_op_num th in + let th_rhs = INST[rtm, n_var_num] (Hashtbl.find th_suc_table cn) in + let ltm, rarg = dest_comb lhs in + let larg = rand ltm in + let th1 = INST[larg, m_var_num; rarg, n_var_num] SUC_ADD_RIGHT in + let cn = fst(dest_const(rator rarg)) in + let th2 = Hashtbl.find th_suc_table cn in + let th_lhs = TRANS th1 (AP_TERM ltm th2) in + TRANS (TRANS (SYM th_lhs) suc_th) th_rhs;; + +let th_add_array = Array.make (maximum * maximum) (REFL zero_const);; + +for i = 0 to maximum - 1 do + let th0 = + if i = 0 then + B0_ADD + else + INST[n_var_num, m_var_num; m_var_num, n_var_num] + (ONCE_REWRITE_RULE[ADD_AC] th_add_array.(i)) in + let _ = th_add_array.(i * maximum) <- th0 in + + for j = 1 to maximum - 1 do + th_add_array.(i * maximum + j) <- th_add_right_next th_add_array.(i * maximum + j - 1) + done; +done;; + +(* SUC (B_i(m) + B_j(n)) = B_p(...) *) +let th_cadd i j = + let add_th = th_add_array.(i * maximum + j) in + let th0 = AP_TERM suc_op_num add_th in + let ltm, rtm = dest_comb(rand(concl th0)) in + let ltm, rtm = dest_comb rtm in + let cn = fst(dest_const ltm) in + let suc_th = INST[rtm, n_var_num] (Hashtbl.find th_suc_table cn) in + TRANS th0 suc_th;; + +let th_cadd_array = Array.make (maximum * maximum) (REFL zero_const);; + +for i = 0 to maximum - 1 do + for j = 0 to maximum - 1 do + th_cadd_array.(i * maximum + j) <- th_cadd i j + done; +done;; + +let th_add_table = Hashtbl.create (maximum * maximum);; + +for i = 0 to maximum - 1 do + for j = 0 to maximum - 1 do + let name = names_array.(i) ^ names_array.(j) in + let th = th_add_array.(i * maximum + j) in + let cflag = (i + j >= maximum) in + Hashtbl.add th_add_table name (th, cflag) + done; +done;; + +let th_cadd_table = Hashtbl.create (maximum * maximum);; + +for i = 0 to maximum - 1 do + for j = 0 to maximum - 1 do + let name = names_array.(i) ^ names_array.(j) in + let th = th_cadd_array.(i * maximum + j) in + let cflag = (i + j + 1 >= maximum) in + Hashtbl.add th_cadd_table name (th, cflag) + done; +done;; + +(* ADD conversion *) +let rec raw_add_conv_hash tm = + let atm,rtm = dest_comb tm in + let ltm = rand atm in + if ltm = zero_const then + INST [rtm,n_var_num] ADD_0_n + else if rtm = zero_const then + INST [ltm,n_var_num] ADD_n_0 + else + let lbit,larg = dest_comb ltm + and rbit,rarg = dest_comb rtm in + let name = fst(dest_const lbit) ^ fst(dest_const rbit) in + let th0, cflag = Hashtbl.find th_add_table name in + let th = INST [larg, m_var_num; rarg, n_var_num] th0 in + let ltm, rtm = dest_comb(rand(concl th)) in + if cflag then + TRANS th (AP_TERM ltm (raw_adc_conv_hash rtm)) + else + TRANS th (AP_TERM ltm (raw_add_conv_hash rtm)) +and raw_adc_conv_hash tm = + let atm,rtm = dest_comb (rand tm) in + let ltm = rand atm in + if ltm = zero_const then + let th = INST [rtm,n_var_num] CADD_0_n in + TRANS th (raw_suc_conv_hash (rand(concl th))) + else if rtm = zero_const then + let th = INST [ltm,n_var_num] CADD_n_0 in + TRANS th (raw_suc_conv_hash (rand(concl th))) + else + let lbit,larg = dest_comb ltm + and rbit,rarg = dest_comb rtm in + let name = fst(dest_const lbit) ^ fst(dest_const rbit) in + let th0, cflag = Hashtbl.find th_cadd_table name in + let th = INST [larg, m_var_num; rarg, n_var_num] th0 in + let ltm, rtm = dest_comb(rand(concl th)) in + if cflag then + TRANS th (AP_TERM ltm (raw_adc_conv_hash rtm)) + else + TRANS th (AP_TERM ltm (raw_add_conv_hash rtm));; + +let NUM_ADD_HASH_CONV tm = + let atm, rtm = dest_comb tm in + let ltm = rand atm in + let th = INST [rand ltm, m_var_num; rand rtm, n_var_num] ADD_NUM in + let ltm, rtm = dest_comb(rand(concl th)) in + TRANS th (AP_TERM ltm (raw_add_conv_hash rtm));; + +(********************************) +(* Subtraction *) + +let SUB_NUM = prove(mk_eq(mk_binop sub_op_num (mk_comb (num_const, m_var_num)) (mk_comb (num_const, n_var_num)), + mk_comb(num_const, mk_binop sub_op_num m_var_num n_var_num)), + REWRITE_TAC[num_def; NUMERAL]);; + +let SUB_lemma1 = (UNDISCH_ALL o ARITH_RULE) `n + t = m ==> m - n = t:num`;; +let SUB_lemma2 = (UNDISCH_ALL o REWRITE_RULE[NUMERAL] o ARITH_RULE) `m + t = n ==> m - n = 0`;; +let LE_lemma = (UNDISCH_ALL o ARITH_RULE) `n + t = m ==> n <= m:num`;; + +let raw_sub_hash_conv tm = + let ltm, n_tm = dest_comb tm in + let m_tm = rand ltm in + let m = raw_dest_hash m_tm in + let n = raw_dest_hash n_tm in + let t = m -/ n in + if t >=/ num_0 then + let t_tm = rand (mk_numeral_array t) in + let th0 = INST[n_tm, n_var_num; t_tm, t_var_num; m_tm, m_var_num] SUB_lemma1 in + let th_add = raw_add_conv_hash (mk_binop add_op_num n_tm t_tm) in + MY_PROVE_HYP th_add th0 + else + let t_tm = rand (mk_numeral_array (Num.abs_num t)) in + let th0 = INST[m_tm, m_var_num; t_tm, t_var_num; n_tm, n_var_num] SUB_lemma2 in + let th_add = raw_add_conv_hash (mk_binop add_op_num m_tm t_tm) in + MY_PROVE_HYP th_add th0;; + +(* Returns either (tm1 - tm2, tm2 <= tm1) or (tm2 - tm1, tm1 <= tm2) *) +let raw_sub_and_le_hash_conv tm1 tm2 = + let m = raw_dest_hash tm1 in + let n = raw_dest_hash tm2 in + let t = m -/ n in + if t >=/ num_0 then + let t_tm = rand (mk_numeral_array t) in + let inst = INST[tm2, n_var_num; t_tm, t_var_num; tm1, m_var_num] in + let th_sub = inst SUB_lemma1 in + let th_le = inst LE_lemma in + let th_add = raw_add_conv_hash (mk_binop add_op_num tm2 t_tm) in + (MY_PROVE_HYP th_add th_sub, MY_PROVE_HYP th_add th_le) + else + let t_tm = rand (mk_numeral_array (Num.abs_num t)) in + let inst = INST[tm2, m_var_num; t_tm, t_var_num; tm1, n_var_num] in + let th_sub = inst SUB_lemma1 in + let th_le = inst LE_lemma in + let th_add = raw_add_conv_hash (mk_binop add_op_num tm1 t_tm) in + (MY_PROVE_HYP th_add th_sub, MY_PROVE_HYP th_add th_le);; + +let NUM_SUB_HASH_CONV tm = + let atm, rtm = dest_comb tm in + let ltm = rand atm in + let th = INST [rand ltm, m_var_num; rand rtm, n_var_num] SUB_NUM in + let ltm, rtm = dest_comb(rand(concl th)) in + TRANS th (AP_TERM ltm (raw_sub_hash_conv rtm));; + + +(********************************) +(* Multiplication *) + +let MUL_NUM = prove(mk_eq(mk_binop mul_op_num (mk_comb(num_const, m_var_num)) (mk_comb(num_const, n_var_num)), + mk_comb(num_const, mk_binop mul_op_num m_var_num n_var_num)), + REWRITE_TAC[num_def; NUMERAL]);; + +let MUL_0_n = prove(`_0 * n = _0`, ONCE_REWRITE_TAC[GSYM NUM_THM] THEN + ONCE_REWRITE_TAC[GSYM MUL_NUM] THEN REWRITE_TAC[num_def] THEN + REWRITE_TAC[MULT_CLAUSES]);; + +let MUL_n_0 = ONCE_REWRITE_RULE[MULT_AC] MUL_0_n;; + +let MUL_1_n, MUL_n_1 = + let one_const = mk_comb (const_array.(1), zero_num) in + let cond = mk_eq(mk_binop mul_op_num one_const n_var_num, n_var_num) in + let th = (REWRITE_RULE[NUMERAL] o prove)(cond, REWRITE_TAC[def_array.(1)] THEN ARITH_TAC) in + th, ONCE_REWRITE_RULE[MULT_AC] th;; + +let MUL_B0_t = prove(mk_eq(mk_binop mul_op_num (mk_comb(b0_const, n_var_num)) t_var_num, + mk_comb(b0_const, mk_binop mul_op_num n_var_num t_var_num)), + REWRITE_TAC[def_array.(0)] THEN ARITH_TAC);; + +let MUL_t_B0 = ONCE_REWRITE_RULE[MULT_AC] MUL_B0_t;; + +let MUL_SUC_RIGHT = prove(`m * SUC(n) = m * n + m`, ARITH_TAC);; + +(* Multiplication table *) +let mul_th_next_right th = + let ltm, rtm = dest_comb(rand(rator(concl th))) in + let mtm = rand ltm in + let th0 = INST[mtm, m_var_num; rtm, n_var_num] MUL_SUC_RIGHT in + let th1 = AP_THM (AP_TERM add_op_num th) mtm in + let sum_th = raw_add_conv_hash (rand(concl th1)) in + let th2 = TRANS (TRANS th0 th1) sum_th in + let cn = fst(dest_const (rator rtm)) in + let th_suc = INST[zero_const, n_var_num] (Hashtbl.find th_suc_table cn) in + let th3 = AP_TERM (mk_comb (mul_op_num, mtm)) th_suc in + TRANS (SYM th3) th2;; + +let mul_array = Array.make (maximum * maximum) (REFL zero_const);; +for i = 1 to maximum - 1 do + let th1 = INST[mk_comb(const_array.(i), zero_const), n_var_num] MUL_n_1 in + let _ = mul_array.(i * maximum + 1) <- th1 in + + for j = 2 to maximum - 1 do + mul_array.(i * maximum + j) <- mul_th_next_right mul_array.(i * maximum + j - 1) + done; +done;; + +let mul_table = Hashtbl.create (maximum * maximum);; +for i = 1 to maximum - 1 do + for j = 1 to maximum - 1 do + Hashtbl.add mul_table (names_array.(i) ^ names_array.(j)) mul_array.(i * maximum + j) + done; +done;; + +(* General multiplication theorem *) +let prod_lemma = + let mul (a,b) = mk_binop mul_op_num a b and + add (a,b) = mk_binop add_op_num a b in + let lhs = mul(add(t_var_num, mk_comb(b0_const, m_var_num)), + add(r_var_num, mk_comb(b0_const, n_var_num))) in + let rhs = add(mul(t_var_num, r_var_num), + mk_comb(b0_const, add(mk_comb(b0_const, mul(m_var_num, n_var_num)), + add(mul(m_var_num, r_var_num), + mul(n_var_num, t_var_num))))) in + prove(mk_eq(lhs, rhs), + REWRITE_TAC[LEFT_ADD_DISTRIB; RIGHT_ADD_DISTRIB] THEN + REWRITE_TAC[MUL_B0_t; MUL_t_B0] THEN + ONCE_REWRITE_TAC[GSYM ADD_ASSOC] THEN + REWRITE_TAC[th_add_array.(0)] THEN + REWRITE_TAC[ADD_AC; MULT_AC]);; + +let ADD_ASSOC' = SPEC_ALL ADD_ASSOC;; + +let dest_op tm = + let ltm, rtm = dest_comb tm in + rand ltm, rtm;; + +(* B_i(m) * B_j(n) = B_p(B_q(m * n) + m * B_j(0) + n * B_i(0)) + where B_p(B_q(0)) = i * j *) +let gen_mul_thm i j = + let bi0 = mk_comb(const_array.(i), zero_const) and + bj0 = mk_comb(const_array.(j), zero_const) in + let def_i = INST[m_var_num, n_var_num] def_thm_array.(i) in + let def_j = def_thm_array.(j) in + let th0 = MK_COMB(AP_TERM mul_op_num def_i, def_j) in + let th1 = TRANS th0 (INST[bi0, t_var_num; bj0, r_var_num] prod_lemma) in + let mul_th = mul_array.(i * maximum + j) in + let larg, rarg = dest_op (rand (concl th1)) in + let th2 = TRANS th1 (AP_THM (AP_TERM add_op_num mul_th) rarg) in + let larg = rand(concl mul_th) in + let b_low, b_high = dest_comb larg in + let rtm = rand(rarg) in + let th_add = INST[b_high, m_var_num; rtm, n_var_num] + (fst(Hashtbl.find th_add_table (fst(dest_const b_low)^b0_name))) in + if i * j < maximum then + let ltm, rtm = dest_op(rand(rand(concl th_add))) in + let add_0 = AP_TERM b_low (INST[rtm, n_var_num] ADD_0_n) in + TRANS th2 (TRANS th_add add_0) + else + let larg, rtm = dest_op (rand(rand(concl th_add))) in + let rarg, rtm = dest_op rtm in + let th_assoc = INST[larg, m_var_num; rarg, n_var_num; rtm, p_var_num] ADD_ASSOC' in + let mn = rand(rarg) in + let b_high = rator b_high in + let th_add2' = INST[zero_const, m_var_num; mn, n_var_num] + (fst(Hashtbl.find th_add_table (fst(dest_const b_high)^b0_name))) in + let add_0 = AP_TERM b_high (INST[mn, n_var_num] ADD_0_n) in + let th_add2 = TRANS th_add2' add_0 in + let th3 = TRANS th_assoc (AP_THM (AP_TERM add_op_num th_add2) rtm) in + let th4 = TRANS th_add (AP_TERM b_low th3) in + TRANS th2 th4;; + +let gen_mul_table = Hashtbl.create (maximum * maximum);; + +for i = 1 to maximum - 1 do + for j = 1 to maximum - 1 do + let name = names_array.(i) ^ names_array.(j) in + Hashtbl.add gen_mul_table name (gen_mul_thm i j) + done; +done;; + +(* B_i(m) * B_j(0) = B_p(B_q(0) + m * B_j(0)) + where i * j = B_p(B_q(0)) *) +let mul1_right_th i j = + let th0 = INST[zero_const, n_var_num] + (Hashtbl.find gen_mul_table (names_array.(i)^names_array.(j))) in + let b_low, rtm = dest_comb(rand(concl th0)) in + let tm1, tm23 = dest_op rtm in + let tm2p, tm3 = dest_comb tm23 in + let tm3_th = INST[rand tm3, n_var_num] MUL_0_n in + let tm2_th = INST[rand(tm2p), n_var_num] ADD_n_0 in + let tm23_th = TRANS (AP_TERM tm2p tm3_th) tm2_th in + let ltm, rtm = dest_comb tm1 in + if (i * j < maximum) then + let tm1_th = TRANS (AP_TERM ltm (INST[m_var_num, n_var_num] MUL_n_0)) B0_0 in + let tm123_th' = TRANS (INST[tm23, n_var_num] ADD_0_n) tm23_th in + let tm123_th = TRANS (AP_THM (AP_TERM add_op_num tm1_th) tm23) tm123_th' in + TRANS th0 (AP_TERM b_low tm123_th) + else + let tm1_th = AP_TERM ltm (INST[m_var_num, n_var_num] MUL_n_0) in + let tm123_th = MK_COMB(AP_TERM add_op_num tm1_th, tm23_th) in + TRANS th0 (AP_TERM b_low tm123_th);; + +(* B_j(0) * B_i(m) = B_p(B_q(0) + B_j(0) * B_i(m) *) +let MULT_AC' = CONJUNCT1 MULT_AC;; + +let mul1_left_th th = + let lhs, rhs = dest_eq(concl th) in + let ltm, rtm = dest_op lhs in + let th_lhs = INST[ltm, n_var_num; rtm, m_var_num] MULT_AC' in + let btm, rtm = dest_comb rhs in + let larg, rarg = dest_op rtm in + if (is_comb larg) then + let ltm, rtm = dest_op rarg in + let th_rhs' = INST[ltm, m_var_num; rtm, n_var_num] MULT_AC' in + let th_rhs = AP_TERM (mk_comb(add_op_num, larg)) th_rhs' in + TRANS th_lhs (TRANS th (AP_TERM btm th_rhs)) + else + let th_rhs = INST[larg, m_var_num; rarg, n_var_num] MULT_AC' in + TRANS th_lhs (TRANS th (AP_TERM btm th_rhs));; + +let mul1_right_th_table = Hashtbl.create (maximum * maximum);; +let mul1_left_th_table = Hashtbl.create (maximum * maximum);; + +for i = 1 to maximum - 1 do + for j = 1 to maximum - 1 do + let name_right = names_array.(i) ^ names_array.(j) in + let name_left = names_array.(j) ^ names_array.(i) in + let th = mul1_right_th i j in + let add_flag = (i * j >= maximum) in + let _ = Hashtbl.add mul1_right_th_table name_right (add_flag, th) in + Hashtbl.add mul1_left_th_table name_left (add_flag, mul1_left_th th) + done; +done;; + + +(******************************************************) +(* Conversions *) + +(* Multiplies arg and (tm = tmname(_0)) *) +let rec raw_mul1_right_hash arg tm tmname = + if arg = zero_const then + INST [tm, n_var_num] MUL_0_n + else + let btm, mtm = dest_comb arg in + let cn = fst(dest_const btm) in + if (cn = b0_name) then + let th = INST[mtm, n_var_num; tm, t_var_num] MUL_B0_t in + TRANS th (AP_TERM b0_const (raw_mul1_right_hash mtm tm tmname)) + else + let name = cn ^ tmname in + if (mtm = zero_const) then + Hashtbl.find mul_table name + else + let add_flag, th' = Hashtbl.find mul1_right_th_table name in + let th = INST[mtm, m_var_num] th' in + if add_flag then + let ltm, rtm = dest_comb(rand(concl th)) in + let lplus, rarg = dest_comb rtm in + let th2 = AP_TERM lplus (raw_mul1_right_hash mtm tm tmname) in + let th_add = raw_add_conv_hash (rand(concl th2)) in + TRANS th (AP_TERM ltm (TRANS th2 th_add)) + else + let ltm = rator(rand(concl th)) in + let th2 = AP_TERM ltm (raw_mul1_right_hash mtm tm tmname) in + TRANS th th2;; + +(* Multiplies (tm = tmname(_0)) and arg *) +let rec raw_mul1_left_hash tm tmname arg = + if arg = zero_const then + INST [tm, n_var_num] MUL_n_0 + else + let btm, mtm = dest_comb arg in + let cn = fst(dest_const btm) in + if (cn = b0_name) then + let th = INST[mtm, n_var_num; tm, t_var_num] MUL_t_B0 in + TRANS th (AP_TERM b0_const (raw_mul1_left_hash tm tmname mtm)) + else + let name = tmname ^ cn in + if (mtm = zero_const) then + Hashtbl.find mul_table name + else + let add_flag, th' = Hashtbl.find mul1_left_th_table name in + let th = INST[mtm, m_var_num] th' in + if add_flag then + let ltm, rtm = dest_comb(rand(concl th)) in + let lplus, rarg = dest_comb rtm in + let th2 = AP_TERM lplus (raw_mul1_left_hash tm tmname mtm) in + let th_add = raw_add_conv_hash (rand(concl th2)) in + TRANS th (AP_TERM ltm (TRANS th2 th_add)) + else + let ltm = rator(rand(concl th)) in + let th2 = AP_TERM ltm (raw_mul1_left_hash tm tmname mtm) in + TRANS th th2;; + +(* Computes B_i(m) * B_j(n) *) +let rec raw_mul_conv_hash tm = + let larg, rarg = dest_comb tm in + let larg = rand larg in + if larg = zero_const then + INST [rarg, n_var_num] MUL_0_n + else if rarg = zero_const then + INST [larg, n_var_num] MUL_n_0 + else + + let lbtm, mtm = dest_comb larg in + let lcn = fst(dest_const lbtm) in + if (lcn = b0_name) then + let th = INST[rarg, t_var_num; mtm, n_var_num] MUL_B0_t in + let ltm, rtm = dest_comb(rand(concl th)) in + TRANS th (AP_TERM ltm (raw_mul_conv_hash rtm)) + else + let rbtm, ntm = dest_comb rarg in + let rcn = fst(dest_const rbtm) in + if (rcn = b0_name) then + let th = INST[larg, t_var_num; ntm, n_var_num] MUL_t_B0 in + let ltm, rtm = dest_comb(rand(concl th)) in + TRANS th (AP_TERM ltm (raw_mul_conv_hash rtm)) + else + + if (ntm = zero_const) then + if (mtm = zero_const) then + Hashtbl.find mul_table (lcn ^ rcn) + else + raw_mul1_right_hash larg (mk_comb(rbtm, zero_const)) rcn + else if (mtm = zero_const) then + raw_mul1_left_hash (mk_comb(lbtm, zero_const)) lcn rarg + else + + let th0 = INST[mtm, m_var_num; ntm, n_var_num] + (Hashtbl.find gen_mul_table (lcn ^ rcn)) in + let b_low, expr = dest_comb(rand(concl th0)) in + let ltm, rsum = dest_comb expr in + let b_high, mul0 = dest_comb (rand ltm) in + let th_mul0 = raw_mul_conv_hash mul0 in + let th_mul1 = raw_mul1_right_hash mtm (mk_comb(rbtm, zero_const)) rcn in + let th_mul2 = raw_mul1_right_hash ntm (mk_comb(lbtm, zero_const)) lcn in + let th_larg = AP_TERM add_op_num (AP_TERM b_high th_mul0) in + let th_rarg = MK_COMB(AP_TERM add_op_num th_mul1, th_mul2) in + + let add_rarg = TRANS th_rarg (raw_add_conv_hash (rand(concl th_rarg))) in + let add_th = MK_COMB (th_larg, add_rarg) in + let add = TRANS add_th (raw_add_conv_hash (rand(concl add_th))) in + + TRANS th0 (AP_TERM b_low add);; + +(* The main multiplication conversion *) +let NUM_MULT_HASH_CONV tm = + let ltm, rtm = dest_comb tm in + let larg, rarg = rand (rand ltm), rand rtm in + let th0 = INST[larg, m_var_num; rarg, n_var_num] MUL_NUM in + if (rand(rator(concl th0)) <> tm) then + failwith "NUM_MULT_HASH_CONV" + else + let rtm = rand(rand(concl th0)) in + let th = raw_mul_conv_hash rtm in + TRANS th0 (AP_TERM num_const th);; + + +(************************************) +(* DIV *) + +let DIV_NUM = prove(mk_eq(mk_binop div_op_num (mk_comb(num_const, m_var_num)) (mk_comb(num_const, n_var_num)), + mk_comb(num_const, mk_binop div_op_num m_var_num n_var_num)), + REWRITE_TAC[num_def; NUMERAL]);; + +let DIV_UNIQ' = (UNDISCH_ALL o + PURE_ONCE_REWRITE_RULE[ARITH_RULE `a < b <=> (a < b:num <=> T)`] o + ONCE_REWRITE_RULE[ARITH_RULE `m = q * n + r <=> q * n + r = m:num`] o + REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL) DIV_UNIQ;; + +(* Computes m DIV n *) +let raw_div_hash_conv tm = + let ltm, n_tm = dest_comb tm in + let m_tm = rand ltm in + let m = raw_dest_hash m_tm in + let n = raw_dest_hash n_tm in + let q = Num.quo_num m n and + r = Num.mod_num m n in + let q_tm = rand (mk_numeral_array q) and + r_tm = rand (mk_numeral_array r) in + + let qn_th = raw_mul_conv_hash (mk_binop mul_op_num q_tm n_tm) in + let qn_tm = rand (concl qn_th) in + let qnr_th = raw_add_conv_hash (mk_binop add_op_num qn_tm r_tm) in + let th1 = TRANS (AP_THM (AP_TERM add_op_num qn_th) r_tm) qnr_th in + let th2 = raw_lt_hash_conv (mk_binop lt_op_num r_tm n_tm) in + let th0 = INST[r_tm, r_var_num; n_tm, n_var_num; m_tm, m_var_num; q_tm, q_var_num] DIV_UNIQ' in + MY_PROVE_HYP th1 (MY_PROVE_HYP th2 th0);; + +(* The main division conversion *) +let NUM_DIV_HASH_CONV tm = + let ltm, rtm = dest_comb tm in + let larg, rarg = rand (rand ltm), rand rtm in + let th0 = INST[larg, m_var_num; rarg, n_var_num] DIV_NUM in + if (rand(rator(concl th0)) <> tm) then + failwith "NUM_DIV_HASH_CONV" + else + let rtm = rand(rand(concl th0)) in + let th = raw_div_hash_conv rtm in + TRANS th0 (AP_TERM num_const th);; + + +(*********************************************) +(* EVEN_CONV, ODD_CONV *) + +let even_const = `EVEN` and + odd_const = `ODD` and + eq_const = `<=>`;; + +let EVEN_NUM = (REWRITE_RULE[GSYM num_def] o prove) + (`EVEN (NUMERAL n) <=> EVEN n`, REWRITE_TAC[NUMERAL]);; + +let ODD_NUM = (REWRITE_RULE[GSYM num_def] o prove) + (`ODD (NUMERAL n) <=> ODD n`, REWRITE_TAC[NUMERAL]);; + +let EVEN_ZERO = prove(`EVEN _0 <=> T`, REWRITE_TAC[ARITH_EVEN]);; +let ODD_ZERO = prove(`ODD _0 <=> F`, REWRITE_TAC[ARITH_ODD]);; + + +let EVEN_B0 = prove(mk_eq(mk_comb(`EVEN`, mk_comb(b0_const, `n:num`)), `T`), + REWRITE_TAC[B0_EXPLICIT; EVEN_MULT] THEN + DISJ1_TAC THEN CONV_TAC NUM_EVEN_CONV);; + + +let ODD_B0 = prove(mk_eq(mk_comb(`ODD`, mk_comb(b0_const, `n:num`)), `F`), + REWRITE_TAC[NOT_ODD; EVEN_B0]);; + +let EVEN_SUC_T = prove(`(EVEN (SUC n) <=> T) <=> (EVEN n <=> F)`, REWRITE_TAC[EVEN]);; +let EVEN_SUC_F = prove(`(EVEN (SUC n) <=> F) <=> (EVEN n <=> T)`, REWRITE_TAC[EVEN]);; + +let ODD_SUC_T = prove(`(ODD (SUC n) <=> T) <=> (ODD n <=> F)`, REWRITE_TAC[ODD]);; +let ODD_SUC_F = prove(`(ODD (SUC n) <=> F) <=> (ODD n <=> T)`, REWRITE_TAC[ODD]);; + +let next_even_th th = + let ltm, rtm = dest_comb(concl th) in + let b_tm = rand(rand ltm) in + let suc_b = raw_suc_conv_hash (mk_comb (suc_op_num, b_tm)) in + let flag = (fst o dest_const) rtm = "T" in + let th0 = SYM (AP_TERM even_const suc_b) in + let th1 = AP_THM (AP_TERM eq_const th0) (if flag then f_const else t_const) in + let th2 = INST[b_tm, n_var_num] (if flag then EVEN_SUC_F else EVEN_SUC_T) in + EQ_MP (SYM (TRANS th1 th2)) th;; + +let next_odd_th th = + let ltm, rtm = dest_comb(concl th) in + let b_tm = rand(rand ltm) in + let suc_b = raw_suc_conv_hash (mk_comb (suc_op_num, b_tm)) in + let flag = (fst o dest_const) rtm = "T" in + let th0 = SYM (AP_TERM odd_const suc_b) in + let th1 = AP_THM (AP_TERM eq_const th0) (if flag then f_const else t_const) in + let th2 = INST[b_tm, n_var_num] (if flag then ODD_SUC_F else ODD_SUC_T) in + EQ_MP (SYM (TRANS th1 th2)) th;; + +let even_thm_table = Hashtbl.create maximum;; + +Hashtbl.add even_thm_table names_array.(0) EVEN_B0;; + +for i = 1 to maximum - 1 do + let th0 = next_even_th (Hashtbl.find even_thm_table names_array.(i - 1)) in + Hashtbl.add even_thm_table names_array.(i) th0 +done;; + +let odd_thm_table = Hashtbl.create maximum;; +Hashtbl.add odd_thm_table names_array.(0) ODD_B0;; + +for i = 1 to maximum - 1 do + let th0 = next_odd_th (Hashtbl.find odd_thm_table names_array.(i - 1)) in + Hashtbl.add odd_thm_table names_array.(i) th0 +done;; + +let raw_even_hash_conv tm = + let ltm, rtm = dest_comb tm in + if ((fst o dest_const) ltm <> "EVEN") then + failwith "raw_even_hash_conv: no EVEN" + else + if (is_const rtm) then + EVEN_ZERO + else + let b_tm, n_tm = dest_comb rtm in + let th0 = Hashtbl.find even_thm_table ((fst o dest_const) b_tm) in + INST[n_tm, n_var_num] th0;; + +let raw_odd_hash_conv tm = + let ltm, rtm = dest_comb tm in + if ((fst o dest_const) ltm <> "ODD") then + failwith "raw_odd_hash_conv: no ODD" + else + if (is_const rtm) then + ODD_ZERO + else + let b_tm, n_tm = dest_comb rtm in + let th0 = Hashtbl.find odd_thm_table ((fst o dest_const) b_tm) in + INST[n_tm, n_var_num] th0;; + +let NUM_EVEN_HASH_CONV tm = + let ltm, rtm = dest_comb tm in + let th0 = INST[rand rtm, n_var_num] EVEN_NUM in + let ltm, rtm = dest_comb(concl th0) in + if (rand ltm <> tm) then + failwith "NUM_EVEN_HASH_CONV" + else + let th1 = raw_even_hash_conv rtm in + TRANS th0 th1;; + +let NUM_ODD_HASH_CONV tm = + let ltm, rtm = dest_comb tm in + let th0 = INST[rand rtm, n_var_num] ODD_NUM in + let ltm, rtm = dest_comb(concl th0) in + if (rand ltm <> tm) then + failwith "NUM_ODD_HASH_CONV" + else + let th1 = raw_odd_hash_conv rtm in + TRANS th0 th1;; + +end;; diff --git a/formal_ineqs/arith/eval_interval.hl b/formal_ineqs/arith/eval_interval.hl new file mode 100644 index 0000000..2871fc0 --- /dev/null +++ b/formal_ineqs/arith/eval_interval.hl @@ -0,0 +1,278 @@ +(* =========================================================== *) +(* Formal interval evaluation of arithmetic expressions *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +needs "arith/more_float.hl";; +needs "arith/float_atn.hl";; +needs "misc/vars.hl";; + + +module Eval_interval = struct + +open Arith_misc;; +open Interval_arith;; +open Arith_float;; +open Float_atn;; +open More_float;; +open Misc_vars;; + +(* Creates an interval approximation of the given decimal term *) +let mk_float_interval_decimal = + let DECIMAL' = SPEC_ALL DECIMAL in + fun pp decimal_tm -> + let n_tm, d_tm = dest_binary "DECIMAL" decimal_tm in + let n, d = dest_numeral n_tm, dest_numeral d_tm in + let n_int, d_int = mk_float_interval_num n, mk_float_interval_num d in + let int = float_interval_div pp n_int d_int in + let eq_th = INST[n_tm, x_var_num; d_tm, y_var_num] DECIMAL' in + norm_interval int eq_th;; + + +(* Unary interval operations *) +let unary_interval_operations = + let table = Hashtbl.create 10 in + let add = Hashtbl.add in + add table `--` (fun pp -> float_interval_neg); + add table `inv` float_interval_inv; + add table `sqrt` float_interval_sqrt; + add table `atn` float_interval_atn; + add table `acs` float_interval_acs; + table;; + + +(* Binary interval operations *) +let binary_interval_operations = + let table = Hashtbl.create 10 in + let add = Hashtbl.add in + add table `+` float_interval_add; + add table `-` float_interval_sub; + add table `*` float_interval_mul; + add table `/` float_interval_div; + table;; + + +(* Interval approximations of constants *) +let interval_constants = + let table = Hashtbl.create 10 in + let add = Hashtbl.add in + add table `pi` (fun pp -> pi_approx_array.(pp)); + table;; + + + +(* Type of an interval function *) +type interval_fun = + | Int_ref of int + | Int_var of term + | Int_const of thm + | Int_decimal_const of term + | Int_named_const of term + | Int_pow of int * interval_fun + | Int_unary of term * interval_fun + | Int_binary of term * interval_fun * interval_fun;; + + +(* Evaluates the given interval function at the point + defined by the given list of variables *) +let eval_interval_fun pp ifun vars refs = + let u_find = Hashtbl.find unary_interval_operations and + b_find = Hashtbl.find binary_interval_operations and + c_find = Hashtbl.find interval_constants in + let rec rec_eval f = + match f with + | Int_ref i -> List.nth refs i + | Int_var tm -> assoc tm vars + | Int_const th -> th + | Int_decimal_const tm -> mk_float_interval_decimal pp tm + | Int_named_const tm -> c_find tm pp + | Int_pow (n,f1) -> float_interval_pow_simple pp n (rec_eval f1) + | Int_unary (tm,f1) -> u_find tm pp (rec_eval f1) + | Int_binary (tm,f1,f2) -> b_find tm pp (rec_eval f1) (rec_eval f2) in + rec_eval ifun;; + + +(* Evaluates all sub-expressions involving constants in the given interval function *) +let eval_constants pp ifun = + let u_find = Hashtbl.find unary_interval_operations and + b_find = Hashtbl.find binary_interval_operations and + c_find = Hashtbl.find interval_constants in + let rec rec_eval f = + match f with + | Int_decimal_const tm -> Int_const (mk_float_interval_decimal pp tm) + | Int_named_const tm -> Int_const (c_find tm pp) + | Int_pow (n,f1) -> + (let f1_val = rec_eval f1 in + match f1_val with + | Int_const th -> Int_const (float_interval_pow_simple pp n th) + | _ -> Int_pow (n,f1_val)) + | Int_unary (tm,f1) -> + (let f1_val = rec_eval f1 in + match f1_val with + | Int_const th -> Int_const (u_find tm pp th) + | _ -> Int_unary (tm, f1_val)) + | Int_binary (tm,f1,f2) -> + (let f1_val, f2_val = rec_eval f1, rec_eval f2 in + match f1_val with + | Int_const th1 -> + (match f2_val with + | Int_const th2 -> Int_const (b_find tm pp th1 th2) + | _ -> Int_binary (tm, f1_val, f2_val)) + | _ -> Int_binary (tm, f1_val, f2_val)) + | _ -> f in + rec_eval ifun;; + + + +(**************************************) + +(* Builds an interval function from the given term *) +let rec build_interval_fun expr_tm = + if is_const expr_tm then + (* Constant *) + Int_named_const expr_tm + else if is_var expr_tm then + (* Variable *) + Int_var expr_tm + else + let ltm, r_tm = dest_comb expr_tm in + (* Unary operations *) + if is_const ltm then + (* & *) + if ltm = amp_op_real then + let n = dest_numeral r_tm in + Int_const (mk_float_interval_num n) + else + let r_fun = build_interval_fun r_tm in + Int_unary (ltm, r_fun) + else + (* Binary operations *) + let op, l_tm = dest_comb ltm in + let name = (fst o dest_const) op in + if name = "DECIMAL" then + (* DECIMAL *) + Int_decimal_const expr_tm + else if name = "real_pow" then + (* pow *) + let n = dest_small_numeral r_tm in + Int_pow (n, build_interval_fun l_tm) + else if name = "$" then + (* $ *) + Int_var expr_tm + else + let lhs = build_interval_fun l_tm and + rhs = build_interval_fun r_tm in + Int_binary (op, lhs, rhs);; + + +(********************************) + +(* Replaces the given subexpression with the given reference index + in all interval functions in the list. + Returns the number of replaces and a new list of interval functions *) +let replace_subexpr expr expr_index f_list = + let rec replace f = + if f = expr then + 1, Int_ref expr_index + else + match f with + | Int_pow (k, f1) -> + let c, f1' = replace f1 in + c, Int_pow (k, f1') + | Int_unary (tm, f1) -> + let c, f1' = replace f1 in + c, Int_unary (tm, f1') + | Int_binary (tm, f1, f2) -> + let c1, f1' = replace f1 in + let c2, f2' = replace f2 in + c1 + c2, Int_binary (tm, f1', f2') + | _ -> 0, f in + let cs, fs = unzip (map replace f_list) in + itlist (+) cs 0, fs;; + + + +let is_leaf f = + match f with + | Int_pow _ -> false + | Int_unary _ -> false + | Int_binary _ -> false + | _ -> true;; + +let find_and_replace_all f_list acc = + let rec find_and_replace f i f_list = + if is_leaf f then + f, (0, f_list) + else + let expr, (c, fs) = + match f with + | Int_pow (k, f1) -> find_and_replace f1 i f_list + | Int_unary (tm, f1) -> find_and_replace f1 i f_list + | Int_binary (tm, f1, f2) -> + let expr, (c1, fs) = find_and_replace f1 i f_list in + if c1 > 1 then expr, (c1, fs) else find_and_replace f2 i f_list + | _ -> f, (0, f_list) in + if c > 1 then expr, (c, fs) else f, replace_subexpr f i f_list in + + let rec iterate fs acc = + let i = length acc in + let expr, (c, fs') = find_and_replace (hd fs) i fs in + if c > 1 then iterate fs' (acc @ [expr]) else fs, acc in + + let rec iterate_all f_list ref_acc f_acc = + match f_list with + | [] -> f_acc, ref_acc + | f :: fs -> + let fs', acc' = iterate f_list ref_acc in + iterate_all (tl fs') acc' (f_acc @ [hd fs']) in + + iterate_all f_list acc [];; + + +let eval_interval_fun_list pp (f_list, refs) vars = + let rec eval_refs refs acc = + match refs with + | [] -> acc + | r :: rs -> + let v = eval_interval_fun pp r vars acc in + eval_refs rs (acc @ [v]) in + let rs = eval_refs refs [] in + map (fun f -> eval_interval_fun pp f vars rs) f_list;; + + +(***************************************) + +(* Approximate the bounds of the given interval with floating point numbers *) +let interval_to_float_interval = + let th = (UNDISCH_ALL o prove)(`interval_arith x (lo, hi) ==> + interval_arith lo (a, y) ==> + interval_arith hi (z, b) + ==> interval_arith x (a, b)`, + REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC) in + fun pp int_th -> + let x_tm, bounds = dest_interval_arith (concl int_th) in + let lo, hi = dest_pair bounds in + let f_lo = build_interval_fun lo and + f_hi = build_interval_fun hi in + let th_lo = eval_interval_fun pp f_lo [] [] and + th_hi = eval_interval_fun pp f_hi [] [] in + let a_tm, y_tm = (dest_pair o rand o concl) th_lo and + z_tm, b_tm = (dest_pair o rand o concl) th_hi in + let th1 = INST[x_tm, x_var_real; lo, lo_var_real; hi, hi_var_real; + a_tm, a_var_real; y_tm, y_var_real; + z_tm, z_var_real; b_tm, b_var_real] th in + (MY_PROVE_HYP int_th o MY_PROVE_HYP th_lo o MY_PROVE_HYP th_hi) th1;; + + +(* Adds a new constant approximation to the table of constants *) +let add_constant_interval int_th = + let c_tm, _ = dest_interval_arith (concl int_th) in + let _ = is_const c_tm or failwith "add_constant_interval: not a constant" in + let th = interval_to_float_interval 20 int_th in + let approx_array = Array.init 20 (fun i -> float_interval_round i th) in + Hashtbl.add interval_constants c_tm (fun pp -> approx_array.(pp));; + + + +end;; diff --git a/formal_ineqs/arith/float.hl b/formal_ineqs/arith/float.hl new file mode 100644 index 0000000..6549185 --- /dev/null +++ b/formal_ineqs/arith/float.hl @@ -0,0 +1,3889 @@ +(* =========================================================== *) +(* Formal floating point arithmetic *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +(* Dependencies *) +needs "arith/nat.hl";; +needs "arith/num_exp_theory.hl";; +needs "arith/float_theory.hl";; +needs "arith/interval_arith.hl";; +needs "misc/vars.hl";; + +(* FLOOR_DIV_DIV *) +needs "Library/floor.ml";; +(* sqrt and its properties *) +needs "Multivariate/vectors.ml";; + +prioritize_real();; + +module type Arith_float_sig = + sig + val mk_num_exp : term -> term -> term + val dest_num_exp : term -> (term * term) + val dest_float : term -> (string * term * term) + val float_lt0 : term -> thm + val float_gt0 : term -> thm + val float_lt : term -> term -> thm + val float_le0 : term -> thm + val float_ge0 : term -> thm + val float_le : term -> term -> thm + val float_min : term -> term -> thm + val float_max : term -> term -> thm + val float_min_max : term -> term -> (thm * thm) + val float_mul_eq : term -> term -> thm + val float_mul_lo : int -> term -> term -> thm + val float_mul_hi : int -> term -> term -> thm + val float_div_lo : int -> term -> term -> thm + val float_div_hi : int -> term -> term -> thm + val float_add_lo : int -> term -> term -> thm + val float_add_hi : int -> term -> term -> thm + val float_sub_lo : int -> term -> term -> thm + val float_sub_hi : int -> term -> term -> thm + val float_sqrt_lo : int -> term -> thm + val float_sqrt_hi : int -> term -> thm + + val reset_stat : unit -> unit + val reset_cache : unit -> unit + val print_stat : unit -> unit + + val dest_float_interval : term -> term * term * term + val mk_float_interval_small_num : int -> thm + val mk_float_interval_num : num -> thm + + val float_lo : int -> term -> thm + val float_hi : int -> term -> thm + + val float_interval_round : int -> thm -> thm + + val float_interval_neg : thm -> thm + val float_interval_mul : int -> thm -> thm -> thm + val float_interval_div : int -> thm -> thm -> thm + val float_interval_add : int -> thm -> thm -> thm + val float_interval_sub : int -> thm -> thm -> thm + val float_interval_sqrt : int -> thm -> thm + + val float_abs : term -> thm + + val FLOAT_TO_NUM_CONV : term -> thm +end;; + + +module Arith_float : Arith_float_sig = struct + +open Big_int;; +open Arith_misc;; +open Arith_nat;; +open Num_exp_theory;; +open Float_theory;; +open Interval_arith;; +open Misc_vars;; + +(* interval *) + +let APPROX_INTERVAL' = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL) APPROX_INTERVAL;; + +let interval_const = `interval_arith` and + num_exp_const = `num_exp`;; + +let b0_const = (fst o dest_comb o lhand o concl) (Arith_hash.def_array.(0));; +let b0_name = (fst o dest_const) b0_const;; +let base_const = mk_small_numeral Arith_hash.arith_base;; + +let NUM_REMOVE = prove(mk_eq(mk_comb(Arith_hash.num_const, n_var_num), n_var_num), + REWRITE_TAC[Arith_hash.num_def; NUMERAL]);; + +(* B0 n = base * n *) +let b0_thm = prove(mk_eq(mk_comb(b0_const, n_var_num), + mk_binop mul_op_num base_const n_var_num), + REWRITE_TAC[Arith_hash.def_array.(0)] THEN + TRY ARITH_TAC THEN + GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [BIT0] THEN + ARITH_TAC);; + +let dest_num_exp tm = + let ltm, e_tm = dest_comb tm in + rand ltm, e_tm;; + +let num_exp_const = `num_exp`;; +let mk_num_exp n_tm e_tm = mk_binop num_exp_const n_tm e_tm;; + +(* float_num s n e -> "s", n, e *) +let dest_float tm = + let ltm, e_tm = dest_comb tm in + let ltm, n_tm = dest_comb ltm in + let float_tm, s_tm = dest_comb ltm in + if (fst o dest_const) float_tm <> "float_num" then + failwith "dest_float: not float" + else + (fst o dest_const) s_tm, n_tm, e_tm;; + + +(************************************) + +let NUM_EXP_EXP' = SPEC_ALL NUM_EXP_EXP;; +let NUM_EXP_0' = (SPEC_ALL o REWRITE_RULE[NUMERAL]) NUM_EXP_0;; +let NUM_EXP_LE' = (UNDISCH_ALL o SPEC_ALL) NUM_EXP_LE;; +let NUM_EXP_LT' = (UNDISCH_ALL o SPEC_ALL) NUM_EXP_LT;; + +(* B0 n = num_exp n bits *) +let normal_lemma1 = prove(mk_eq(mk_comb(b0_const, n_var_num), `num_exp n 1`), + REWRITE_TAC[Arith_hash.def_array.(0); num_exp] THEN + TRY ARITH_TAC THEN + GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [BIT0] THEN + ARITH_TAC);; + +let NORMAL_LEMMA1 = NUMERALS_TO_NUM normal_lemma1;; + +let normal_lemma2 = prove(mk_eq (mk_comb (b0_const, `num_exp n e`), `num_exp n (SUC e)`), + REWRITE_TAC[normal_lemma1; NUM_EXP_EXP] THEN ARITH_TAC);; + +let rec normalize tm = + if (is_comb tm) then + let ltm, rtm = dest_comb tm in + let lname = (fst o dest_const) ltm in + if (lname = b0_name) then + let lth = INST[rtm, n_var_num] NORMAL_LEMMA1 in + let rth, flag = normalize rtm in + if flag then + let ltm, lexp = (dest_comb o snd o dest_eq o concl) lth in + let ltm, rtm = dest_comb ltm in + let rn, rexp = (dest_comb o snd o dest_eq o concl) rth in + let rn = rand rn in + let th1 = AP_THM (AP_TERM ltm rth) lexp in + let th2 = INST[rexp, e1_var_num; lexp, e2_var_num; rn, n_var_num] NUM_EXP_EXP' in + let th3 = TRANS lth (TRANS th1 th2) in + let ltm, rtm = (dest_comb o snd o dest_eq o concl) th3 in + let add_th = raw_add_conv_hash rtm in + let th4 = AP_TERM ltm add_th in + (TRANS th3 th4, true) + else + (lth, true) + else + (REFL tm, false) + else + (REFL tm, false);; + +(* Converts a raw numeral to a num_exp expression *) +let to_num_exp tm = + let x, flag = normalize tm in + if flag then x + else + INST[tm, n_var_num] NUM_EXP_0';; + +(************************************) + +let SYM_NUM_EXP_0' = SYM NUM_EXP_0';; +let NUM_EXP_n0 = prove(`!e. num_exp 0 e = 0`, REWRITE_TAC[num_exp; MULT_CLAUSES]);; +let NUM_EXP_n0' = (REWRITE_RULE[NUMERAL] o SPEC_ALL) NUM_EXP_n0;; + +let NUM_EXP_DENORM = (UNDISCH_ALL o prove) + (mk_imp(`e = _0 <=> F`, mk_eq(`num_exp n e`, mk_comb (b0_const, `num_exp n (PRE e)`))), + REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SYM (REWRITE_CONV[NUMERAL] `0`)] THEN + REWRITE_TAC[num_exp; b0_thm] THEN + REWRITE_TAC[ARITH_RULE (mk_eq(mk_binop mul_op_num base_const `n * a:num`, + mk_binop mul_op_num `n:num` (mk_binop mul_op_num base_const `a:num`)))] THEN + REWRITE_TAC[GSYM EXP] THEN + SIMP_TAC[ARITH_RULE `~(e = 0) ==> SUC (PRE e) = e`]);; + +(* Converts num_exp n e to a numeral by adding e B0's *) +let rec denormalize tm = + let ltm, etm = dest_comb tm in + let ntm = rand ltm in + if (etm = zero_const) then + INST[ntm, n_var_num] SYM_NUM_EXP_0' + else + if ntm = zero_const then + INST[etm, e_var_num] NUM_EXP_n0' + else + let e_th = raw_eq0_hash_conv etm in + let th0' = INST[etm, e_var_num; ntm, n_var_num] NUM_EXP_DENORM in + let th0 = MY_PROVE_HYP e_th th0' in + let b0_tm, rtm = dest_comb(rand(concl th0)) in + let ltm, pre_tm = dest_comb rtm in + let pre_th = raw_pre_hash_conv pre_tm in + let th1 = AP_TERM ltm pre_th in + let th2 = denormalize (rand(concl th1)) in + TRANS th0 (AP_TERM b0_tm (TRANS th1 th2));; + +(***************************************) + +let rec comb_number tm n = + if (is_comb tm) then comb_number ((snd o dest_comb) tm) (n + 1) else n;; + +let make_lo_thm i = + let th_concl = mk_binop `(<=):num->num->bool` + (mk_comb (Arith_hash.const_array.(0), n_var_num)) + (mk_comb (Arith_hash.const_array.(i), n_var_num)) in + prove(th_concl, + REWRITE_TAC[Arith_hash.def_array.(i); Arith_hash.def_array.(0)] THEN + REWRITE_TAC[ARITH_LE; LE_REFL] THEN + ARITH_TAC);; + +let lo_thm_array = Array.init Arith_hash.arith_base make_lo_thm;; +let lo_thm_table = Hashtbl.create Arith_hash.arith_base;; + +for i = 0 to Arith_hash.arith_base - 1 do + Hashtbl.add lo_thm_table Arith_hash.const_array.(i) lo_thm_array.(i); +done;; + +let make_lo_thm2 i = + let th_concl = mk_imp (`n <= m:num`, + mk_binop `(<=):num->num->bool` + (mk_comb (Arith_hash.const_array.(0), n_var_num)) + (mk_comb (Arith_hash.const_array.(i), m_var_num))) in + (UNDISCH_ALL o prove) (th_concl, + REWRITE_TAC[Arith_hash.def_array.(i); Arith_hash.def_array.(0); ARITH_LE] THEN + ARITH_TAC);; + +let lo_thm2_array = Array.init Arith_hash.arith_base make_lo_thm2;; +let lo_thm2_table = Hashtbl.create Arith_hash.arith_base;; + +for i = 0 to Arith_hash.arith_base - 1 do + Hashtbl.add lo_thm2_table Arith_hash.const_array.(i) lo_thm2_array.(i); +done;; + + +let make_hi_thm i = + let th_concl = mk_imp (`n < m:num`, + mk_binop `(<):num->num->bool` + (mk_comb (Arith_hash.const_array.(i), n_var_num)) + (mk_comb (Arith_hash.const_array.(0), m_var_num))) in + (UNDISCH_ALL o prove) (th_concl, + REWRITE_TAC[Arith_hash.def_array.(i); Arith_hash.def_array.(0); ARITH_LT] THEN + ARITH_TAC);; + +let hi_thm_array = Array.init Arith_hash.arith_base make_hi_thm;; +let hi_thm_table = Hashtbl.create Arith_hash.arith_base;; + +for i = 0 to Arith_hash.arith_base - 1 do + Hashtbl.add hi_thm_table Arith_hash.const_array.(i) hi_thm_array.(i); +done;; + +(***************************************) + +let LE_REFL' = SPEC_ALL LE_REFL;; +let LE_TRANS' = (UNDISCH_ALL o SPEC_ALL o REWRITE_RULE[GSYM IMP_IMP]) LE_TRANS;; + +let lo_num_conv p tm = + let n = comb_number tm 0 in + if (n <= p) then + INST[tm, n_var_num] LE_REFL' + else + let rec lo_bound n tm = + let btm, rtm = dest_comb tm in + let th0 = INST[rtm, n_var_num] (Hashtbl.find lo_thm_table btm) in + if n > 1 then + let rth = lo_bound (n - 1) rtm in + let xtm = rand (rator (concl rth)) in + let th1' = INST[xtm, n_var_num; rtm, m_var_num] (Hashtbl.find lo_thm2_table btm) in + let th1 = MY_PROVE_HYP rth th1' in + th1 + else + th0 in + + lo_bound (n - p) tm;; + +let N_LT_SUC = ARITH_RULE `n < SUC n`;; +let LT_IMP_LE' = (UNDISCH_ALL o SPEC_ALL) LT_IMP_LE;; +let N_LT_SUC = ARITH_RULE `n < SUC n`;; +let LT_LE_TRANS = (UNDISCH_ALL o ARITH_RULE) `n < e ==> e <= m ==> n < m:num`;; + +(* Generates a theorem |- n <= m such that m contains at most p non-zero digits *) +let hi_num_conv p tm = + let n = comb_number tm 0 in + if (n <= p) then + INST[tm, n_var_num] LE_REFL' + else + let k = n - p in + + let rec check_b0s n tm = + let btm, rtm = dest_comb tm in + if ((fst o dest_const) btm = b0_name) then + if n > 1 then check_b0s (n - 1) rtm else true + else + false in + + if (check_b0s k tm) then + INST[tm, n_var_num] LE_REFL' + else + let rec hi_bound n tm = + if n > 0 then + let btm, rtm = dest_comb tm in + let r_th = hi_bound (n - 1) rtm in + let xtm = rand (concl r_th) in + let th0 = INST[rtm, n_var_num; xtm, m_var_num] (Hashtbl.find hi_thm_table btm) in + MY_PROVE_HYP r_th th0 + else + let th0 = INST[tm, n_var_num] N_LT_SUC in + let ltm, suc_tm = dest_comb (concl th0) in + let suc_th = raw_suc_conv_hash suc_tm in + EQ_MP (AP_TERM ltm suc_th) th0 in + + let th = hi_bound k tm in + let m_tm, l_tm = dest_comb (concl th) in + MY_PROVE_HYP th (INST[rand m_tm, m_var_num; l_tm, n_var_num] LT_IMP_LE');; + +(* Generates a theorem |- n < m such that m contains at most p non-zero digits *) +let hi_lt_num_conv p tm = + let n = comb_number tm 0 in + if (n <= p) then + let th0 = INST[tm, n_var_num] N_LT_SUC in + let ltm, rtm = dest_comb(concl th0) in + let suc_th = raw_suc_conv_hash rtm in + EQ_MP (AP_TERM ltm suc_th) th0 + else + let k = n - p in + + let rec check_b0s n tm = + let btm, rtm = dest_comb tm in + if ((fst o dest_const) btm = b0_name) then + if n > 1 then check_b0s (n - 1) rtm else true + else + false in + + if (check_b0s k tm) then + let th0 = INST[tm, n_var_num] N_LT_SUC in + let ltm, rtm = dest_comb (concl th0) in + let suc_th = raw_suc_conv_hash rtm in + let suc_tm = rand(concl suc_th) in + let th1 = hi_num_conv p suc_tm in + let th2 = EQ_MP (AP_TERM ltm suc_th) th0 in + let th = INST[tm, n_var_num; suc_tm, e_var_num; rand(concl th1), m_var_num] LT_LE_TRANS in + MY_PROVE_HYP th1 (MY_PROVE_HYP th2 th) + + else + let rec hi_bound n tm = + if n > 0 then + let btm, rtm = dest_comb tm in + let r_th = hi_bound (n - 1) rtm in + let xtm = rand (concl r_th) in + let th0 = INST[rtm, n_var_num; xtm, m_var_num] (Hashtbl.find hi_thm_table btm) in + MY_PROVE_HYP r_th th0 + else + let th0 = INST[tm, n_var_num] N_LT_SUC in + let ltm, suc_tm = dest_comb (concl th0) in + let suc_th = raw_suc_conv_hash suc_tm in + EQ_MP (AP_TERM ltm suc_th) th0 in + hi_bound k tm;; + +(*****************************************) + +let num_exp_lo p tm = + let ltm, e_tm = dest_comb tm in + let n_tm = rand ltm in + let n_th = lo_num_conv p n_tm in + let m_tm = rand (rator (concl n_th)) in + let m_norm, flag = normalize m_tm in + + let th0' = INST[m_tm, m_var_num; n_tm, n_var_num; e_tm, e_var_num] NUM_EXP_LE' in + let th0 = MY_PROVE_HYP n_th th0' in + if flag then + let th1 = AP_THM (AP_TERM (rator ltm) m_norm) e_tm in + let m_tm, me_tm = (dest_comb o rand o concl) m_norm in + let th2 = INST[me_tm, e1_var_num; e_tm, e2_var_num; rand m_tm, n_var_num] NUM_EXP_EXP' in + let th3 = TRANS th1 th2 in + let ltm, rtm = (dest_comb o rand o concl) th3 in + let th_add = raw_add_conv_hash rtm in + let th4 = TRANS th3 (AP_TERM ltm th_add) in + EQ_MP (AP_THM (AP_TERM le_op_num th4) tm) th0 + else + th0;; + +let num_exp_hi p tm = + let ltm, e_tm = dest_comb tm in + let n_tm = rand ltm in + let n_th = hi_num_conv p n_tm in + let m_tm = rand (concl n_th) in + let m_norm, flag = normalize m_tm in + + let th0' = INST[m_tm, n_var_num; n_tm, m_var_num; e_tm, e_var_num] NUM_EXP_LE' in + let th0 = MY_PROVE_HYP n_th th0' in + if flag then + let th1 = AP_THM (AP_TERM (rator ltm) m_norm) e_tm in + let m_tm, me_tm = (dest_comb o rand o concl) m_norm in + let th2 = INST[me_tm, e1_var_num; e_tm, e2_var_num; rand m_tm, n_var_num] NUM_EXP_EXP' in + let th3 = TRANS th1 th2 in + let ltm, rtm = (dest_comb o rand o concl) th3 in + let th_add = raw_add_conv_hash rtm in + let th4 = TRANS th3 (AP_TERM ltm th_add) in + EQ_MP (AP_TERM (rator (concl th0)) th4) th0 + else + th0;; + +let num_exp_hi_lt p tm = + let ltm, e_tm = dest_comb tm in + let n_tm = rand ltm in + let n_th = hi_lt_num_conv p n_tm in + let m_tm = rand (concl n_th) in + let m_norm, flag = normalize m_tm in + + let th0' = INST[m_tm, n_var_num; n_tm, m_var_num; e_tm, e_var_num] NUM_EXP_LT' in + let th0 = MY_PROVE_HYP n_th th0' in + if flag then + let th1 = AP_THM (AP_TERM (rator ltm) m_norm) e_tm in + let m_tm, me_tm = (dest_comb o rand o concl) m_norm in + let th2 = INST[me_tm, e1_var_num; e_tm, e2_var_num; rand m_tm, n_var_num] NUM_EXP_EXP' in + let th3 = TRANS th1 th2 in + let ltm, rtm = (dest_comb o rand o concl) th3 in + let th_add = raw_add_conv_hash rtm in + let th4 = TRANS th3 (AP_TERM ltm th_add) in + EQ_MP (AP_TERM (rator (concl th0)) th4) th0 + else + th0;; + +(***************************************) +(* num_exp_lt, num_exp_le *) + +let transform = UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL;; + +let NUM_EXP_LT1_EQ' = transform NUM_EXP_LT1_EQ and + NUM_EXP_LT2_EQ' = transform NUM_EXP_LT2_EQ;; + +let NUM_EXP_LE1_EQ' = transform NUM_EXP_LE1_EQ and + NUM_EXP_LE2_EQ' = transform NUM_EXP_LE2_EQ;; + +let num_exp_lt tm1 tm2 = + let n1_tm, e1_tm = dest_num_exp tm1 in + let n2_tm, e2_tm = dest_num_exp tm2 in + let sub_th, le_th = raw_sub_and_le_hash_conv e1_tm e2_tm in + let r_tm = rand(concl sub_th) in + if (rand(concl le_th) = e1_tm) then + let x_expr = mk_num_exp n1_tm r_tm in + let x_th = denormalize x_expr in + let x_tm = rand(concl x_th) in + + let th0 = INST[e2_tm, e2_var_num; e1_tm, e1_var_num; + r_tm, r_var_num; x_tm, x_var_num; + n1_tm, n1_var_num; n2_tm, n2_var_num] NUM_EXP_LT1_EQ' in + let th1 = MY_PROVE_HYP x_th (MY_PROVE_HYP sub_th (MY_PROVE_HYP le_th th0)) in + let lt_th = raw_lt_hash_conv (rand(concl th1)) in + TRANS th1 lt_th + else + let x_expr = mk_num_exp n2_tm r_tm in + let x_th = denormalize x_expr in + let x_tm = rand(concl x_th) in + + let th0 = INST[e2_tm, e2_var_num; e1_tm, e1_var_num; + r_tm, r_var_num; x_tm, x_var_num; + n1_tm, n1_var_num; n2_tm, n2_var_num] NUM_EXP_LT2_EQ' in + let th1 = MY_PROVE_HYP x_th (MY_PROVE_HYP sub_th (MY_PROVE_HYP le_th th0)) in + let lt_th = raw_lt_hash_conv (rand(concl th1)) in + TRANS th1 lt_th;; + + +let num_exp_le tm1 tm2 = + let n1_tm, e1_tm = dest_num_exp tm1 in + let n2_tm, e2_tm = dest_num_exp tm2 in + let sub_th, le_th = raw_sub_and_le_hash_conv e1_tm e2_tm in + let r_tm = rand(concl sub_th) in + if (rand(concl le_th) = e1_tm) then + let x_expr = mk_num_exp n1_tm r_tm in + let x_th = denormalize x_expr in + let x_tm = rand(concl x_th) in + + let th0 = INST[e2_tm, e2_var_num; e1_tm, e1_var_num; + r_tm, r_var_num; x_tm, x_var_num; + n1_tm, n1_var_num; n2_tm, n2_var_num] NUM_EXP_LE1_EQ' in + let th1 = MY_PROVE_HYP x_th (MY_PROVE_HYP sub_th (MY_PROVE_HYP le_th th0)) in + let le_th = raw_le_hash_conv (rand(concl th1)) in + TRANS th1 le_th + else + let x_expr = mk_num_exp n2_tm r_tm in + let x_th = denormalize x_expr in + let x_tm = rand(concl x_th) in + + let th0 = INST[e2_tm, e2_var_num; e1_tm, e1_var_num; + r_tm, r_var_num; x_tm, x_var_num; + n1_tm, n1_var_num; n2_tm, n2_var_num] NUM_EXP_LE2_EQ' in + let th1 = MY_PROVE_HYP x_th (MY_PROVE_HYP sub_th (MY_PROVE_HYP le_th th0)) in + let le_th = raw_le_hash_conv (rand(concl th1)) in + TRANS th1 le_th;; + +(***************************************) +(* num_exp_mul *) + +let NUM_EXP_MUL' = SPEC_ALL NUM_EXP_MUL;; + +let num_exp_mul tm1 tm2 = + let n1_tm, e1_tm = dest_comb tm1 in + let n1_tm = rand n1_tm in + let n2_tm, e2_tm = dest_comb tm2 in + let n2_tm = rand n2_tm in + let th0 = INST[n1_tm, n1_var_num; e1_tm, e1_var_num; + n2_tm, n2_var_num; e2_tm, e2_var_num] NUM_EXP_MUL' in + let ltm, tm_add = dest_comb (rand (concl th0)) in + let tm_mul = rand ltm in + let th_mul = raw_mul_conv_hash tm_mul in + let th_add = raw_add_conv_hash tm_add in + TRANS th0 (MK_COMB (AP_TERM (rator ltm) th_mul, th_add));; + + +(**********************************) +(* num_exp_add *) + +let NUM_EXP_ADD' = (UNDISCH_ALL o SPEC_ALL) NUM_EXP_ADD;; +let ADD_COMM = ARITH_RULE `m + n = n + m:num`;; + +let num_exp_add tm1 tm2 = + let n1_tm, e1_tm = dest_comb tm1 in + let n1_tm = rand n1_tm in + let n2_tm, e2_tm = dest_comb tm2 in + let n2_tm = rand n2_tm in + let e_sub, e_le = raw_sub_and_le_hash_conv e1_tm e2_tm in + + let flag = (rand(concl e_le) = e2_tm) in + + let th0' = + if flag then + INST[n1_tm, n1_var_num; e1_tm, e1_var_num; + n2_tm, n2_var_num; e2_tm, e2_var_num] NUM_EXP_ADD' + else + INST[n2_tm, n1_var_num; e2_tm, e1_var_num; + n1_tm, n2_var_num; e1_tm, e2_var_num] NUM_EXP_ADD' in + + let th0 = MY_PROVE_HYP e_le th0' in + let ltm, e0_tm = dest_comb(rand(concl th0)) in + let exp_tm, add_tm = dest_comb ltm in + let ltm, d_tm = dest_comb add_tm in + let th1 = AP_TERM (rator d_tm) e_sub in + let th2 = denormalize (rand(concl th1)) in + let th3 = AP_TERM ltm (TRANS th1 th2) in + let th4 = raw_add_conv_hash (rand(concl th3)) in + let th5 = AP_THM (AP_TERM exp_tm (TRANS th3 th4)) e0_tm in + let th = TRANS th0 th5 in + if flag then th else + TRANS (INST[tm1, m_var_num; tm2, n_var_num] ADD_COMM) th;; + +(****************************************) +(* num_exp_sub *) + +let NUM_EXP_SUB1' = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL) NUM_EXP_SUB1 and + NUM_EXP_SUB2' = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL) NUM_EXP_SUB2 and + NUM_EXP_LE1' = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL) NUM_EXP_LE1 and + NUM_EXP_LE2' = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL) NUM_EXP_LE2;; + +(* Returns two theorems: |- tm1 - tm2 = tm, |- tm2 <= tm1 or + |- tm2 - tm1 = tm, |- tm1 <= tm2 *) +let num_exp_sub tm1 tm2 = + let n1_tm, e1_tm = dest_num_exp tm1 in + let n2_tm, e2_tm = dest_num_exp tm2 in + let e_sub, e_le = raw_sub_and_le_hash_conv e1_tm e2_tm in + + if rand(concl e_le) = e1_tm then + (* e2 <= e1 *) + let e1_sub_e2 = rand(concl e_sub) in + let a0 = mk_num_exp n1_tm e1_sub_e2 in + let b = n2_tm in + let a_th = denormalize a0 in + let a = rand(concl a_th) in + + let th_sub, th_le = raw_sub_and_le_hash_conv a b in + if rand(concl th_le) = a then + (* b <= a *) + let a_sub_b = TRANS (AP_THM (AP_TERM sub_op_num a_th) b) th_sub in + let b_le_a = EQ_MP (SYM (AP_TERM (rator(concl th_le)) a_th)) th_le in + let th0 = AP_THM (AP_TERM num_exp_const a_sub_b) e2_tm in + + let inst = INST[n1_tm, n1_var_num; e1_tm, e1_var_num; + n2_tm, n2_var_num; e2_tm, e2_var_num; e1_sub_e2, r_var_num] in + let th1_sub = inst NUM_EXP_SUB1' in + let th1_le = inst NUM_EXP_LE1' in + let th2_sub = MY_PROVE_HYP e_sub (MY_PROVE_HYP e_le th1_sub) in + let th2_le = MY_PROVE_HYP e_sub (MY_PROVE_HYP b_le_a (MY_PROVE_HYP e_le th1_le)) in + TRANS th2_sub th0, th2_le + + else + (* a <= b *) + let b_sub_a = TRANS (AP_TERM (rator(lhand(concl th_sub))) a_th) th_sub in + let a_le_b = EQ_MP (SYM (AP_THM (AP_TERM le_op_num a_th) b)) th_le in + let th0 = AP_THM (AP_TERM num_exp_const b_sub_a) e2_tm in + let inst = INST[n2_tm, n1_var_num; e2_tm, e1_var_num; + n1_tm, n2_var_num; e1_tm, e2_var_num; e1_sub_e2, r_var_num] in + let th1_sub = inst NUM_EXP_SUB2' in + let th1_le = inst NUM_EXP_LE2' in + let th2_sub = MY_PROVE_HYP e_sub (MY_PROVE_HYP e_le th1_sub) in + let th2_le = MY_PROVE_HYP e_sub (MY_PROVE_HYP a_le_b (MY_PROVE_HYP e_le th1_le)) in + TRANS th2_sub th0, th2_le + + else + (* e1 <= e2 *) + let e2_sub_e1 = rand(concl e_sub) in + let b0 = mk_num_exp n2_tm e2_sub_e1 in + let a = n1_tm in + let b_th = denormalize b0 in + let b = rand(concl b_th) in + + let th_sub, th_le = raw_sub_and_le_hash_conv a b in + if rand(concl th_le) = a then + (* b <= a *) + let a_sub_b = TRANS (AP_TERM (rator(lhand(concl th_sub))) b_th) th_sub in + let b_le_a = EQ_MP (SYM (AP_THM (AP_TERM le_op_num b_th) a)) th_le in + let th0 = AP_THM (AP_TERM num_exp_const a_sub_b) e1_tm in + let inst = INST[n1_tm, n1_var_num; e1_tm, e1_var_num; + n2_tm, n2_var_num; e2_tm, e2_var_num; e2_sub_e1, r_var_num] in + let th1_sub = inst NUM_EXP_SUB2' in + let th1_le = inst NUM_EXP_LE2' in + let th2_sub = MY_PROVE_HYP e_sub (MY_PROVE_HYP e_le th1_sub) in + let th2_le = MY_PROVE_HYP e_sub (MY_PROVE_HYP b_le_a (MY_PROVE_HYP e_le th1_le)) in + TRANS th2_sub th0, th2_le + + else + (* a <= b *) + let b_sub_a = TRANS (AP_THM (AP_TERM sub_op_num b_th) a) th_sub in + let a_le_b = EQ_MP (SYM (AP_TERM (rator(concl th_le)) b_th)) th_le in + let th0 = AP_THM (AP_TERM num_exp_const b_sub_a) e1_tm in + let inst = INST[n2_tm, n1_var_num; e2_tm, e1_var_num; + n1_tm, n2_var_num; e1_tm, e2_var_num; e2_sub_e1, r_var_num] in + let th1_sub = inst NUM_EXP_SUB1' in + let th1_le = inst NUM_EXP_LE1' in + let th2_sub = MY_PROVE_HYP e_sub (MY_PROVE_HYP e_le th1_sub) in + let th2_le = MY_PROVE_HYP e_sub (MY_PROVE_HYP a_le_b (MY_PROVE_HYP e_le th1_le)) in + TRANS th2_sub th0, th2_le;; + + +(*************************************) +(* division *) + +let NUM_EXP_DIV1' = (UNDISCH_ALL o PURE_REWRITE_RULE[NUMERAL] o + PURE_ONCE_REWRITE_RULE[ARITH_RULE `~(x = 0) <=> (x = 0 <=> F)`] o + REWRITE_RULE[GSYM IMP_IMP]) NUM_EXP_DIV1;; +let NUM_EXP_DIV2' = (UNDISCH_ALL o PURE_REWRITE_RULE[NUMERAL] o + PURE_ONCE_REWRITE_RULE[ARITH_RULE `~(x = 0) <=> (x = 0 <=> F)`] o + REWRITE_RULE[GSYM IMP_IMP]) NUM_EXP_DIV2;; + +let num_exp_div tm1 tm2 = + let n1_tm, e1_tm = dest_comb tm1 in + let n1_tm = rand n1_tm in + let n2_tm, e2_tm = dest_comb tm2 in + let n2_tm = rand n2_tm in + let e_sub, e_le = raw_sub_and_le_hash_conv e1_tm e2_tm in + + let inst = INST[n1_tm, n1_var_num; e1_tm, e1_var_num; + n2_tm, n2_var_num; e2_tm, e2_var_num] in + + let n2_not_0 = raw_eq0_hash_conv n2_tm in + if ((fst o dest_const o rand o concl) n2_not_0 = "T") then + failwith "num_exp_div: n2 = 0" + else + if (rand(concl e_le) = e1_tm) then + let th0' = inst NUM_EXP_DIV1' in + let th0 = MY_PROVE_HYP n2_not_0 (MY_PROVE_HYP e_le th0') in + + let ltm, rtm = dest_comb(rand(concl th0)) in + let div_tm, rtm2 = dest_comb ltm in + let num_exp_tm = rator rtm2 in + + let th1 = AP_THM (AP_TERM div_tm (AP_TERM num_exp_tm e_sub)) rtm in + let ltm, rtm = dest_comb(rand(concl th1)) in + let tm1 = rand ltm in + + let th2 = AP_THM (AP_TERM div_tm (denormalize tm1)) rtm in + let th3 = raw_div_hash_conv (rand(concl th2)) in + let th = TRANS th0 (TRANS th1 (TRANS th2 th3)) in + TRANS th (INST[rand(concl th), n_var_num] NUM_EXP_0') + + else + let th0' = inst NUM_EXP_DIV2' in + let th0 = MY_PROVE_HYP n2_not_0 (MY_PROVE_HYP e_le th0') in + + let ltm, rtm = dest_comb(rand(concl th0)) in + let num_exp_tm = rator rtm in + let th1 = AP_TERM ltm (AP_TERM num_exp_tm e_sub) in + + let ltm, rtm = dest_comb(rand(concl th1)) in + let th2 = AP_TERM ltm (denormalize rtm) in + let th3 = raw_div_hash_conv (rand(concl th2)) in + let th = TRANS th0 (TRANS th1 (TRANS th2 th3)) in + TRANS th (INST[rand(concl th), n_var_num] NUM_EXP_0');; + + +(*****************************) +(* Computes a lower bound for (op tm1 tm2) with p significant digits *) +let num_exp_op_lo p op tm1 tm2 = + let op_th = op tm1 tm2 in + let rtm = rand (concl op_th) in + let lo_th = num_exp_lo p rtm in + let ltm = rator (concl lo_th) in + let th0 = AP_TERM ltm op_th in + EQ_MP (SYM th0) lo_th;; + +(* Computes an upper bound for (op tm1 tm2) with p significant digits *) +let num_exp_op_hi p op tm1 tm2 = + let op_th = op tm1 tm2 in + let rtm = rand (concl op_th) in + let hi_th = num_exp_hi p rtm in + let tm = rand (concl hi_th) in + let th0 = AP_THM (AP_TERM le_op_num op_th) tm in + EQ_MP (SYM th0) hi_th;; + +(* Computes a strict upper bound for (op tm1 tm2) with p significant digits *) +let num_exp_op_hi_lt p op tm1 tm2 = + let op_th = op tm1 tm2 in + let rtm = rand (concl op_th) in + let hi_lt_th = num_exp_hi_lt p rtm in + let tm = rand (concl hi_lt_th) in + let th0 = AP_THM (AP_TERM lt_op_num op_th) tm in + EQ_MP (SYM th0) hi_lt_th;; + +(******************************************) +(* float *) + +let mod_plus = new_definition `mod_plus s1 s2 = (~(s1 /\ s2) /\ (s1 \/ s2))`;; + + +(********************) +(* Float operations *) +(********************) + +module Float_ops = struct + + +(**********************************) + +(* FLOAT_LT *) + +let FLOAT_LT_FF = prove(`float_num F n1 e1 < float_num F n2 e2 <=> num_exp n1 e1 < num_exp n2 e2`, + REWRITE_TAC[float; GSYM REAL_OF_NUM_LT; REAL_MUL_LID; real_div] THEN + MATCH_MP_TAC REAL_LT_RMUL_EQ THEN + MATCH_MP_TAC REAL_LT_INV THEN + REWRITE_TAC[REAL_OF_NUM_LT; LT_NZ; NUM_EXP_EQ_0] THEN + ARITH_TAC);; + +let FLOAT_LT_TT = prove(`float_num T n1 e1 < float_num T n2 e2 <=> num_exp n2 e2 < num_exp n1 e1`, + REWRITE_TAC[FLOAT_NEG_T; REAL_ARITH `--a < --b <=> b < a`] THEN + REWRITE_TAC[FLOAT_LT_FF]);; + +let FLOAT_LT_FT = prove(`float_num F n1 e1 < float_num T n2 e2 <=> F`, + MP_TAC (SPECL [`n2:num`; `e2:num`] FLOAT_T_NEG) THEN + MP_TAC (SPECL [`n1:num`; `e1:num`] FLOAT_F_POS) THEN + REAL_ARITH_TAC);; + +let FLOAT_LT_TF_00 = (PURE_REWRITE_RULE[NUMERAL] o prove) + (`float_num T 0 e1 < float_num F 0 e2 <=> F`, + MP_TAC (SPECL [`T`; `0`; `e1:num`] FLOAT_EQ_0) THEN + MP_TAC (SPECL [`F`; `0`; `e2:num`] FLOAT_EQ_0) THEN + REWRITE_TAC[] THEN + REPLICATE_TAC 2 (DISCH_THEN (fun th -> REWRITE_TAC[th])) THEN + REAL_ARITH_TAC);; + +let FLOAT_LT_TF_1 = (UNDISCH_ALL o PURE_REWRITE_RULE[NUMERAL] o prove) + (`(n1 = 0 <=> F) ==> (float_num T n1 e1 < float_num F n2 e2 <=> T)`, + DISCH_TAC THEN + MATCH_MP_TAC (REAL_ARITH `a < &0 /\ &0 <= b ==> (a < b <=> T)`) THEN + REWRITE_TAC[FLOAT_F_POS] THEN + MATCH_MP_TAC (REAL_ARITH `~(a = &0) /\ a <= &0 ==> a < &0`) THEN + ASM_REWRITE_TAC[FLOAT_T_NEG; FLOAT_EQ_0]);; + +let FLOAT_LT_TF_2 = (UNDISCH_ALL o PURE_REWRITE_RULE[NUMERAL] o prove) + (`(n2 = 0 <=> F) ==> (float_num T n1 e1 < float_num F n2 e2 <=> T)`, + DISCH_TAC THEN + MATCH_MP_TAC (REAL_ARITH `a <= &0 /\ &0 < b ==> (a < b <=> T)`) THEN + REWRITE_TAC[FLOAT_T_NEG] THEN + MATCH_MP_TAC (REAL_ARITH `~(a = &0) /\ &0 <= a ==> &0 < a`) THEN + ASM_REWRITE_TAC[FLOAT_F_POS; FLOAT_EQ_0]);; + +let FLOAT_F_LT_0 = prove(`float_num F n e < &0 <=> F`, + MP_TAC (SPEC_ALL FLOAT_F_POS) THEN + REAL_ARITH_TAC);; + +let FLOAT_T_LT_0 = (CONV_RULE (RAND_CONV (REWRITE_CONV[NUMERAL])) o prove) + (`float_num T n e < &0 <=> (0 < n)`, + REWRITE_TAC[REAL_ARITH `a < &0 <=> a <= &0 /\ ~(a = &0)`] THEN + REWRITE_TAC[FLOAT_T_NEG; FLOAT_EQ_0] THEN + ARITH_TAC);; + +let FLOAT_F_GT_0 = (CONV_RULE (RAND_CONV (REWRITE_CONV[NUMERAL])) o prove) + (`&0 < float_num F n e <=> 0 < n`, + REWRITE_TAC[REAL_ARITH `&0 < a <=> &0 <= a /\ ~(a = &0)`] THEN + REWRITE_TAC[FLOAT_F_POS; FLOAT_EQ_0] THEN + ARITH_TAC);; + +let FLOAT_T_GT_0 = prove(`&0 < float_num T n e <=> F`, + MP_TAC (SPEC_ALL FLOAT_T_NEG) THEN + REAL_ARITH_TAC);; + + +(* float_lt0, float_gt0 *) + +let float_lt0 f1 = + let s, n_tm, e_tm = dest_float f1 in + let inst = INST[n_tm, n_var_num; e_tm, e_var_num] in + if s = "F" then + inst FLOAT_F_LT_0 + else + let gt_th = raw_gt0_hash_conv n_tm in + TRANS (inst FLOAT_T_LT_0) gt_th;; + +let float_gt0 f1 = + let s, n_tm, e_tm = dest_float f1 in + let inst = INST[n_tm, n_var_num; e_tm, e_var_num] in + if s = "F" then + let gt_th = raw_gt0_hash_conv n_tm in + TRANS (inst FLOAT_F_GT_0) gt_th + else + inst FLOAT_T_GT_0;; + +(* float_lt *) +let float_lt f1 f2 = + let s1, n1, e1 = dest_float f1 in + let s2, n2, e2 = dest_float f2 in + let inst = INST[n1, n1_var_num; e1, e1_var_num; + n2, n2_var_num; e2, e2_var_num] in + if s1 = "F" then + if s2 = "F" then + (* FF *) + let th0 = inst FLOAT_LT_FF in + let ltm, tm2 = dest_comb (rand (concl th0)) in + let lt_th = num_exp_lt (rand ltm) tm2 in + TRANS th0 lt_th + else + (* FT *) + inst FLOAT_LT_FT + else + if s2 = "F" then + (* TF *) + if (is_const n1 && is_const n2) then + (* n1 = _0 and n2 = _0 *) + inst FLOAT_LT_TF_00 + else + let n1_0 = raw_eq0_hash_conv n1 in + if (fst o dest_const o rand o concl) n1_0 = "F" then + (* n1 <> _0 *) + MY_PROVE_HYP n1_0 (inst FLOAT_LT_TF_1) + else + let n2_0 = raw_eq0_hash_conv n2 in + if (fst o dest_const o rand o concl) n2_0 = "F" then + (* n2 <> _0 *) + MY_PROVE_HYP n2_0 (inst FLOAT_LT_TF_2) + else + failwith "float_lt: D0 _0 exception" + else + (* TT *) + let th0 = inst FLOAT_LT_TT in + let ltm, tm2 = dest_comb (rand (concl th0)) in + let lt_th = num_exp_lt (rand ltm) tm2 in + TRANS th0 lt_th;; + +(**********************************) +(* FLOAT_LE *) + +let FLOAT_LE_FF = prove(`float_num F n1 e1 <= float_num F n2 e2 <=> num_exp n1 e1 <= num_exp n2 e2`, + REWRITE_TAC[float; GSYM REAL_OF_NUM_LE; REAL_MUL_LID; real_div] THEN + MATCH_MP_TAC REAL_LE_RMUL_EQ THEN + MATCH_MP_TAC REAL_LT_INV THEN + REWRITE_TAC[REAL_OF_NUM_LT; LT_NZ; NUM_EXP_EQ_0] THEN + ARITH_TAC);; + +let FLOAT_LE_TT = prove(`float_num T n1 e1 <= float_num T n2 e2 <=> num_exp n2 e2 <= num_exp n1 e1`, + REWRITE_TAC[FLOAT_NEG_T; REAL_ARITH `--a <= --b <=> b <= a`] THEN + REWRITE_TAC[FLOAT_LE_FF]);; + +let FLOAT_LE_TF = prove(`float_num T n1 e1 <= float_num F n2 e2 <=> T`, + MP_TAC (SPECL [`n1:num`; `e1:num`] FLOAT_T_NEG) THEN + MP_TAC (SPECL [`n2:num`; `e2:num`] FLOAT_F_POS) THEN + REAL_ARITH_TAC);; + +let FLOAT_LE_FT = prove(`float_num F n1 e1 <= float_num T n2 e2 <=> n1 = 0 /\ n2 = 0`, + REWRITE_TAC[REAL_LE_LT; FLOAT_LT_FT] THEN EQ_TAC THENL + [ + DISCH_TAC THEN SUBGOAL_THEN `float_num F n1 e1 = &0 /\ float_num T n2 e2 = &0` MP_TAC THENL + [ + MP_TAC (SPECL [`n2:num`; `e2:num`] FLOAT_T_NEG) THEN + MP_TAC (SPECL [`n1:num`; `e1:num`] FLOAT_F_POS) THEN + ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[FLOAT_EQ_0]; + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[float; NUM_EXP_n0; real_div; REAL_MUL_LZERO; REAL_MUL_RZERO] + ]);; + +let FLOAT_LE_FT_00 = (PURE_REWRITE_RULE[NUMERAL] o prove) + (`float_num F 0 e1 <= float_num T 0 e2 <=> T`, REWRITE_TAC[FLOAT_LE_FT]);; + +let FLOAT_LE_FT_1 = (UNDISCH_ALL o PURE_REWRITE_RULE[NUMERAL] o prove) + (`(n1 = 0 <=> F) ==> (float_num F n1 e1 <= float_num T n2 e2 <=> F)`, + DISCH_TAC THEN ASM_REWRITE_TAC[FLOAT_LE_FT]);; + +let FLOAT_LE_FT_2 = (UNDISCH_ALL o PURE_REWRITE_RULE[NUMERAL] o prove) + (`(n2 = 0 <=> F) ==> (float_num F n1 e1 <= float_num T n2 e2 <=> F)`, + DISCH_TAC THEN ASM_REWRITE_TAC[FLOAT_LE_FT]);; + +let FLOAT_F_LE_0 = (CONV_RULE (RAND_CONV (REWRITE_CONV[NUMERAL])) o prove) + (`float_num F n e <= &0 <=> n = 0`, + REWRITE_TAC[GSYM (SPEC `F` FLOAT_EQ_0)] THEN + MP_TAC (SPEC_ALL FLOAT_F_POS) THEN + REAL_ARITH_TAC);; + +let FLOAT_T_LE_0 = prove(`float_num T n e <= &0 <=> T`, REWRITE_TAC[FLOAT_T_NEG]);; + +let FLOAT_F_GE_0 = prove(`&0 <= float_num F n e <=> T`, REWRITE_TAC[FLOAT_F_POS]);; + +let FLOAT_T_GE_0 = (CONV_RULE (RAND_CONV (REWRITE_CONV[NUMERAL])) o prove) + (`&0 <= float_num T n e <=> n = 0`, + REWRITE_TAC[GSYM (SPEC `T` FLOAT_EQ_0)] THEN + MP_TAC (SPEC_ALL FLOAT_T_NEG) THEN + REAL_ARITH_TAC);; + +(* float_le0, float_ge0 *) +let float_le0 f1 = + let s, n_tm, e_tm = dest_float f1 in + let inst = INST[n_tm, n_var_num; e_tm, e_var_num] in + if s = "T" then + inst FLOAT_T_LE_0 + else + let eq_th = raw_eq0_hash_conv n_tm in + TRANS (inst FLOAT_F_LE_0) eq_th;; + +let float_ge0 f1 = + let s, n_tm, e_tm = dest_float f1 in + let inst = INST[n_tm, n_var_num; e_tm, e_var_num] in + if s = "T" then + let eq_th = raw_eq0_hash_conv n_tm in + TRANS (inst FLOAT_T_GE_0) eq_th + else + inst FLOAT_F_GE_0;; + +(* float_le *) +let float_le f1 f2 = + let s1, n1, e1 = dest_float f1 in + let s2, n2, e2 = dest_float f2 in + let inst = INST[n1, n1_var_num; e1, e1_var_num; + n2, n2_var_num; e2, e2_var_num] in + if s2 = "F" then + if s1 = "F" then + (* FF *) + let th0 = inst FLOAT_LE_FF in + let ltm, tm2 = dest_comb (rand (concl th0)) in + let le_th = num_exp_le (rand ltm) tm2 in + TRANS th0 le_th + else + (* TF *) + inst FLOAT_LE_TF + else + if s1 = "F" then + (* FT *) + if (is_const n1 && is_const n2) then + (* n1 = _0 and n2 = _0 *) + inst FLOAT_LE_FT_00 + else + let n1_0 = raw_eq0_hash_conv n1 in + if (fst o dest_const o rand o concl) n1_0 = "F" then + (* n1 <> _0 *) + MY_PROVE_HYP n1_0 (inst FLOAT_LE_FT_1) + else + let n2_0 = raw_eq0_hash_conv n2 in + if (fst o dest_const o rand o concl) n2_0 = "F" then + (* n2 <> _0 *) + MY_PROVE_HYP n2_0 (inst FLOAT_LE_FT_2) + else + failwith "float_lt: D0 _0 exception" + else + (* TT *) + let th0 = inst FLOAT_LE_TT in + let ltm, tm2 = dest_comb (rand (concl th0)) in + let le_th = num_exp_le (rand ltm) tm2 in + TRANS th0 le_th;; + + +(*************************************) +(* float_max, float_min *) + +let FLOAT_MIN_1 = (UNDISCH_ALL o prove)(`(f1 <= f2 <=> T) ==> min f1 f2 = f1`, REAL_ARITH_TAC);; +let FLOAT_MIN_2 = (UNDISCH_ALL o prove)(`(f1 <= f2 <=> F) ==> min f1 f2 = f2`, REAL_ARITH_TAC);; + +let FLOAT_MAX_1 = (UNDISCH_ALL o prove)(`(f1 <= f2 <=> T) ==> max f1 f2 = f2`, REAL_ARITH_TAC);; +let FLOAT_MAX_2 = (UNDISCH_ALL o prove)(`(f1 <= f2 <=> F) ==> max f1 f2 = f1`, REAL_ARITH_TAC);; + +let float_min f1 f2 = + let inst = INST[f1, f1_var_real; f2, f2_var_real] in + let le_th = float_le f1 f2 in + let th0 = + if (fst o dest_const o rand o concl) le_th = "T" then + inst FLOAT_MIN_1 + else + inst FLOAT_MIN_2 in + MY_PROVE_HYP le_th th0;; + +let float_max f1 f2 = + let inst = INST[f1, f1_var_real; f2, f2_var_real] in + let le_th = float_le f1 f2 in + let th0 = + if (fst o dest_const o rand o concl) le_th = "T" then + inst FLOAT_MAX_1 + else + inst FLOAT_MAX_2 in + MY_PROVE_HYP le_th th0;; + +let float_min_max f1 f2 = + let inst = INST[f1, f1_var_real; f2, f2_var_real] in + let le_th = float_le f1 f2 in + let th_min, th_max = + if (fst o dest_const o rand o concl) le_th = "T" then + inst FLOAT_MIN_1, inst FLOAT_MAX_1 + else + inst FLOAT_MIN_2, inst FLOAT_MAX_2 in + MY_PROVE_HYP le_th th_min, MY_PROVE_HYP le_th th_max;; + + +(*************************************) +(* FLOAT_MUL *) + +let FLOAT_MUL = prove(`!s1 s2. min_exp <= e /\ num_exp n1 e1 * num_exp n2 e2 = num_exp n e + ==> float_num s1 n1 e1 * float_num s2 n2 e2 = + float_num (mod_plus s1 s2) n (e - min_exp)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[float] THEN + ONCE_REWRITE_TAC[REAL_ARITH `(a * b / c) * (d * e / f) = (a * d) * (b * e) / c / f`] THEN + + SUBGOAL_THEN `(if s1 then -- &1 else &1) * (if s2 then -- &1 else &1) = if mod_plus s1 s2 then -- &1 else &1` MP_TAC THENL + [ + REWRITE_TAC[mod_plus] THEN + COND_CASES_TAC THEN COND_CASES_TAC THEN + REWRITE_TAC[REAL_ARITH `-- &1 * -- &1 = &1`; REAL_MUL_LID; REAL_MUL_RID]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[real_div] THEN + REWRITE_TAC[GSYM REAL_MUL_ASSOC] THEN + REWRITE_TAC[REAL_EQ_MUL_LCANCEL] THEN + DISJ2_TAC THEN + + MP_TAC (SPECL[`n:num`; `e:num`; `min_exp`] NUM_EXP_SUB_lemma) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[REAL_MUL_ASSOC] THEN + ASM_REWRITE_TAC[REAL_OF_NUM_MUL]);; + +let FLOAT_MUL_FF = prove(`min_exp <= e /\ e - min_exp = r /\ num_exp n1 e1 * num_exp n2 e2 = num_exp n e ==> + float_num F n1 e1 * float_num F n2 e2 = float_num F n r`, + SIMP_TAC[FLOAT_MUL; mod_plus]);; +let FLOAT_MUL_FT = prove(`min_exp <= e /\ e - min_exp = r /\ num_exp n1 e1 * num_exp n2 e2 = num_exp n e ==> + float_num F n1 e1 * float_num T n2 e2 = float_num T n r`, + SIMP_TAC[FLOAT_MUL; mod_plus]);; +let FLOAT_MUL_TF = prove(`min_exp <= e /\ e - min_exp = r /\ num_exp n1 e1 * num_exp n2 e2 = num_exp n e ==> + float_num T n1 e1 * float_num F n2 e2 = float_num T n r`, + SIMP_TAC[FLOAT_MUL; mod_plus]);; +let FLOAT_MUL_TT = prove(`min_exp <= e /\ e - min_exp = r /\ num_exp n1 e1 * num_exp n2 e2 = num_exp n e ==> + float_num T n1 e1 * float_num T n2 e2 = float_num F n r`, + SIMP_TAC[FLOAT_MUL; mod_plus]);; + + +let FLOAT_MUL_0x_hi, FLOAT_MUL_0x_lo, FLOAT_MUL_x0_hi, FLOAT_MUL_x0_lo = + let mul_0x_hi = `(n1 = 0 <=> T) ==> float_num s1 n1 e1 * f2 <= float_num F 0 min_exp` in + let mul_0x_lo = `(n1 = 0 <=> T) ==> float_num F 0 min_exp <= float_num s1 n1 e1 * f2` in + let mul_x0_hi = `(n2 = 0 <=> T) ==> f1 * float_num s2 n2 e2 <= float_num F 0 min_exp` in + let mul_x0_lo = `(n2 = 0 <=> T) ==> float_num F 0 min_exp <= f1 * float_num s2 n2 e2` in + let proof = MP_TAC (GEN_ALL (SPECL [`s:bool`; `0`] FLOAT_EQ_0)) THEN + SIMP_TAC[REAL_MUL_LZERO; REAL_MUL_RZERO; REAL_LE_REFL] in + prove(mul_0x_hi, proof), prove(mul_0x_lo, proof), + prove(mul_x0_hi, proof), prove(mul_x0_lo, proof);; + + +let FLOAT_MUL_FF_hi, FLOAT_MUL_FF_lo = + let ff_hi = `min_exp <= e /\ e - min_exp = r /\ num_exp n1 e1 * num_exp n2 e2 <= num_exp n e + ==> float_num F n1 e1 * float_num F n2 e2 <= float_num F n r` in + let ff_lo = `min_exp <= e /\ e - min_exp = r /\ num_exp n e <= num_exp n1 e1 * num_exp n2 e2 + ==> float_num F n r <= float_num F n1 e1 * float_num F n2 e2` in + let proof = + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[GSYM REAL_OF_NUM_LE; GSYM REAL_OF_NUM_MUL] THEN + DISCH_TAC THEN + MAP_EVERY ABBREV_TAC [`z = &(num_exp n e)`; `x = &(num_exp n1 e1)`; `y = &(num_exp n2 e2)`] THEN + ASM_REWRITE_TAC[float; REAL_MUL_LID] THEN + REWRITE_TAC[REAL_ARITH `a / b * c / d = (a * c) / b / d`] THEN + REWRITE_TAC[real_div] THEN + REWRITE_TAC[REAL_MUL_ASSOC] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + REWRITE_TAC[REAL_LE_INV_EQ; REAL_POS] THEN + + MP_TAC (SPECL [`n:num`; `e:num`; `min_exp`] NUM_EXP_SUB_lemma) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + ASM_REWRITE_TAC[REAL_LE_INV_EQ; REAL_POS] in + prove(ff_hi, proof), prove(ff_lo, proof);; + +let FLOAT_MUL_TT_hi, FLOAT_MUL_TT_lo = + let tt_hi = `min_exp <= e /\ e - min_exp = r /\ num_exp n1 e1 * num_exp n2 e2 <= num_exp n e + ==> float_num T n1 e1 * float_num T n2 e2 <= float_num F n r` in + let tt_lo = `min_exp <= e /\ e - min_exp = r /\ num_exp n e <= num_exp n1 e1 * num_exp n2 e2 + ==> float_num F n r <= float_num T n1 e1 * float_num T n2 e2` in + let proof = + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[REAL_ARITH `--a * --b = a * b`] THEN + REWRITE_TAC[FLOAT_MUL_FF_hi; FLOAT_MUL_FF_lo] in + prove(tt_hi, proof), prove(tt_lo, proof);; + +let FLOAT_MUL_FT_hi, FLOAT_MUL_FT_lo = + let ft_hi = `min_exp <= e /\ e - min_exp = r /\ num_exp n e <= num_exp n1 e1 * num_exp n2 e2 + ==> float_num F n1 e1 * float_num T n2 e2 <= float_num T n r` in + let ft_lo = `min_exp <= e /\ e - min_exp = r /\ num_exp n1 e1 * num_exp n2 e2 <= num_exp n e + ==> float_num T n r <= float_num F n1 e1 * float_num T n2 e2` in + let proof = + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[REAL_ARITH `a * --b <= --c <=> c <= a * b`] THEN + REWRITE_TAC[REAL_ARITH `--c <= a * --b <=> a * b <= c`] THEN + REWRITE_TAC[FLOAT_MUL_FF_hi; FLOAT_MUL_FF_lo] in + prove(ft_hi, proof), prove(ft_lo, proof);; + +let FLOAT_MUL_TF_hi, FLOAT_MUL_TF_lo = + let ft_hi = `min_exp <= e /\ e - min_exp = r /\ num_exp n e <= num_exp n1 e1 * num_exp n2 e2 + ==> float_num T n1 e1 * float_num F n2 e2 <= float_num T n r` in + let ft_lo = `min_exp <= e /\ e - min_exp = r /\ num_exp n1 e1 * num_exp n2 e2 <= num_exp n e + ==> float_num T n r <= float_num T n1 e1 * float_num F n2 e2` in + let proof = + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[REAL_ARITH `--a * b <= --c <=> c <= a * b`] THEN + REWRITE_TAC[REAL_ARITH `--c <= --a * b <=> a * b <= c`] THEN + REWRITE_TAC[FLOAT_MUL_FF_hi; FLOAT_MUL_FF_lo] in + prove(ft_hi, proof), prove(ft_lo, proof);; + + +(*********************************************) +(* float_mul_lo, float_mul_hi *) + +let transform = UNDISCH_ALL o NUMERALS_TO_NUM o PURE_REWRITE_RULE[min_exp_def; GSYM IMP_IMP];; +let FLOAT_MUL_FF_hi' = transform FLOAT_MUL_FF_hi and + FLOAT_MUL_FF_lo' = transform FLOAT_MUL_FF_lo and + FLOAT_MUL_TT_hi' = transform FLOAT_MUL_TT_hi and + FLOAT_MUL_TT_lo' = transform FLOAT_MUL_TT_lo and + FLOAT_MUL_FT_hi' = transform FLOAT_MUL_FT_hi and + FLOAT_MUL_FT_lo' = transform FLOAT_MUL_FT_lo and + FLOAT_MUL_TF_hi' = transform FLOAT_MUL_TF_hi and + FLOAT_MUL_TF_lo' = transform FLOAT_MUL_TF_lo and + FLOAT_MUL_0x_hi' = transform FLOAT_MUL_0x_hi and + FLOAT_MUL_0x_lo' = transform FLOAT_MUL_0x_lo and + FLOAT_MUL_x0_hi' = transform FLOAT_MUL_x0_hi and + FLOAT_MUL_x0_lo' = transform FLOAT_MUL_x0_lo;; + +let FLOAT_MUL_FF' = transform FLOAT_MUL_FF and + FLOAT_MUL_TT' = transform FLOAT_MUL_TT and + FLOAT_MUL_FT' = transform FLOAT_MUL_FT and + FLOAT_MUL_TF' = transform FLOAT_MUL_TF;; + +let float_mul_eq f1 f2 = + let s1, n1, e1 = dest_float f1 and + s2, n2, e2 = dest_float f2 in + let flag = s1 = s2 in + let num_exp1 = mk_num_exp n1 e1 and + num_exp2 = mk_num_exp n2 e2 in + + let mul_th = num_exp_mul num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (rand (concl mul_th)) in + + let sub_th, le_th = raw_sub_and_le_hash_conv e_tm min_exp_num_const in + if (rand(concl le_th) <> e_tm) then + failwith "float_mul_eq: underflow" + else + let r_tm = rand(concl sub_th) in + let inst = INST[e_tm, e_var_num; r_tm, r_var_num; n_tm, n_var_num; + n1, n1_var_num; e1, e1_var_num; n2, n2_var_num; e2, e2_var_num] in + let th0 = inst + (if flag then + if s1 = "F" then FLOAT_MUL_FF' else FLOAT_MUL_TT' + else + if s1 = "F" then FLOAT_MUL_FT' else FLOAT_MUL_TF') in + MY_PROVE_HYP sub_th (MY_PROVE_HYP mul_th (MY_PROVE_HYP le_th th0));; + + +let float_mul_lo pp f1 f2 = + let s1, n1, e1 = dest_float f1 and + s2, n2, e2 = dest_float f2 in + (* Multiplication by zero *) + let n1_eq0_th = raw_eq0_hash_conv n1 in + if (rand o concl) n1_eq0_th = t_const then + (MY_PROVE_HYP n1_eq0_th o + INST[e1, e1_var_num; f2, f2_var_real; n1, n1_var_num; + (if s1 = "T" then t_const else f_const), s1_var_bool]) FLOAT_MUL_0x_lo' + else + let n2_eq0_th = raw_eq0_hash_conv n2 in + if (rand o concl) n2_eq0_th = t_const then + (MY_PROVE_HYP n2_eq0_th o + INST[e2, e2_var_num; f1, f1_var_real; n2, n2_var_num; + (if s2 = "T" then t_const else f_const), s2_var_bool]) FLOAT_MUL_x0_lo' + else + let flag = s1 = s2 in + let num_exp1 = mk_num_exp n1 e1 and + num_exp2 = mk_num_exp n2 e2 in + + let mul_th, n_tm, e_tm = + if flag then + let th = num_exp_op_lo pp num_exp_mul num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (lhand (concl th)) in + th, n_tm, e_tm + else + let th = num_exp_op_hi pp num_exp_mul num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (rand (concl th)) in + th, n_tm, e_tm in + + let sub_th, le_th = raw_sub_and_le_hash_conv e_tm min_exp_num_const in + if (rand(concl le_th) <> e_tm) then + failwith "float_mul_lo: underflow" + else + let r_tm = rand(concl sub_th) in + let inst = INST[e_tm, e_var_num; r_tm, r_var_num; n_tm, n_var_num; + n1, n1_var_num; e1, e1_var_num; n2, n2_var_num; e2, e2_var_num] in + let th0 = inst + (if flag then + if s1 = "F" then FLOAT_MUL_FF_lo' else FLOAT_MUL_TT_lo' + else + if s1 = "F" then FLOAT_MUL_FT_lo' else FLOAT_MUL_TF_lo') in + MY_PROVE_HYP sub_th (MY_PROVE_HYP mul_th (MY_PROVE_HYP le_th th0));; + + +let float_mul_hi pp f1 f2 = + let s1, n1, e1 = dest_float f1 and + s2, n2, e2 = dest_float f2 in + (* Multiplication by zero *) + let n1_eq0_th = raw_eq0_hash_conv n1 in + if (rand o concl) n1_eq0_th = t_const then + (MY_PROVE_HYP n1_eq0_th o + INST[e1, e1_var_num; f2, f2_var_real; n1, n1_var_num; + (if s1 = "T" then t_const else f_const), s1_var_bool]) FLOAT_MUL_0x_hi' + else + let n2_eq0_th = raw_eq0_hash_conv n2 in + if (rand o concl) n2_eq0_th = t_const then + (MY_PROVE_HYP n2_eq0_th o + INST[e2, e2_var_num; f1, f1_var_real; n2, n2_var_num; + (if s2 = "T" then t_const else f_const), s2_var_bool]) FLOAT_MUL_x0_hi' + else + let flag = s1 = s2 in + let num_exp1 = mk_num_exp n1 e1 and + num_exp2 = mk_num_exp n2 e2 in + + let mul_th, n_tm, e_tm = + if flag then + let th = num_exp_op_hi pp num_exp_mul num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (rand (concl th)) in + th, n_tm, e_tm + else + let th = num_exp_op_lo pp num_exp_mul num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (lhand (concl th)) in + th, n_tm, e_tm in + + let sub_th, le_th = raw_sub_and_le_hash_conv e_tm min_exp_num_const in + if (rand(concl le_th) <> e_tm) then + failwith "float_mul_hi: underflow" + else + let r_tm = rand(concl sub_th) in + let inst = INST[e_tm, e_var_num; r_tm, r_var_num; n_tm, n_var_num; + n1, n1_var_num; e1, e1_var_num; n2, n2_var_num; e2, e2_var_num] in + let th0 = inst + (if flag then + if s1 = "F" then FLOAT_MUL_FF_hi' else FLOAT_MUL_TT_hi' + else + if s1 = "F" then FLOAT_MUL_FT_hi' else FLOAT_MUL_TF_hi') in + MY_PROVE_HYP sub_th (MY_PROVE_HYP mul_th (MY_PROVE_HYP le_th th0));; + + + +(*********************************************) +(* FLOAT_DIV *) + +let DIV_lemma = prove(`!x y. ~(y = 0) ==> &(x DIV y) <= &x / &y /\ &x / &y <= &(x DIV y + 1)`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + MP_TAC (SPECL [`y:num`; `x:num`] FLOOR_DIV_DIV) THEN + ASM_REWRITE_TAC[GSYM REAL_OF_NUM_ADD] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + SIMP_TAC[FLOOR; REAL_LT_IMP_LE]);; + +let FLOAT_DIV_FF = prove(`e2 + k <= min_exp + e + e1 /\ ~(n2 = 0) /\ + num_exp n1 k DIV num_exp n2 0 = num_exp n e + ==> float_num F n ((min_exp + e + e1) - (e2 + k)) <= float_num F n1 e1 / float_num F n2 e2`, + MAP_EVERY ABBREV_TAC [`z = num_exp n e`; `x = num_exp n1 k`; `y = num_exp n2 0`] THEN + REPEAT STRIP_TAC THEN + REWRITE_TAC[float; REAL_MUL_LID] THEN + REWRITE_TAC[real_div; REAL_INV_MUL; REAL_INV_INV] THEN + REWRITE_TAC[REAL_ARITH `(a * b) * c * d = (b * d) * (a * c)`] THEN + SUBGOAL_THEN `~(&(num_exp 1 min_exp) = &0)` ASSUME_TAC THENL + [ + REWRITE_TAC[num_exp; REAL_OF_NUM_EQ; MULT_CLAUSES; EXP_EQ_0] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_MUL_LID] THEN + + ASM_SIMP_TAC[NUM_EXP_SUB_lemma] THEN + SUBGOAL_THEN `&(num_exp n1 e1) * inv(&(num_exp n2 e2)) = (&x / &y) * &(num_exp 1 e1) * inv(&(num_exp 1 (e2 + k)))` MP_TAC THENL + [ + EXPAND_TAC "x" THEN EXPAND_TAC "y" THEN + REWRITE_TAC[real_div] THEN + REWRITE_TAC[num_exp; GSYM REAL_OF_NUM_MUL; GSYM REAL_OF_NUM_POW] THEN + REWRITE_TAC[REAL_MUL_LID; REAL_INV_MUL; REAL_INV_1; real_pow; REAL_MUL_RID] THEN + REWRITE_TAC[REAL_POW_ADD; REAL_INV_MUL] THEN + REWRITE_TAC[REAL_ARITH `((a * b) * c) * d * e * f = (b * f) * (a * c * d * e)`] THEN + + SUBGOAL_THEN (mk_comb(`(~)`, mk_eq(mk_binop `pow` (mk_comb (`&`, base_const)) `k:num`, `&0`))) ASSUME_TAC THENL + [ + REWRITE_TAC[REAL_POW_EQ_0] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[REAL_MUL_RINV; REAL_MUL_LID] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ONCE_REWRITE_TAC[REAL_ARITH `(a * b) * c = (a * c) * b`] THEN + REWRITE_TAC[REAL_MUL_ASSOC] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + REWRITE_TAC[REAL_LE_INV_EQ; REAL_POS] THEN + ONCE_REWRITE_TAC[NUM_EXP_SUM1] THEN + REWRITE_TAC[NUM_EXP_SUM] THEN + REWRITE_TAC[GSYM REAL_OF_NUM_MUL] THEN + ASM_REWRITE_TAC[REAL_ARITH `(a * b * c) * d = (d * a) * b * c`] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_MUL_LID] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + REWRITE_TAC[REAL_LE_INV_EQ; REAL_POS] THEN + MP_TAC (SPEC_ALL DIV_lemma) THEN + ANTS_TAC THENL + [ + EXPAND_TAC "y" THEN + REWRITE_TAC[num_exp; MULT_EQ_0; DE_MORGAN_THM] THEN + ASM_REWRITE_TAC[EXP] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[]);; + +let FLOAT_DIV_0x_lo = prove(`(n1 = 0 <=> T) ==> float_num F 0 min_exp <= float_num s1 n1 e1 / f2`, + SIMP_TAC[real_div; FLOAT_MUL_0x_lo]);; + +let FLOAT_DIV_0x_hi = prove(`(n1 = 0 <=> T) ==> float_num s1 n1 e1 / f2 <= float_num F 0 min_exp`, + SIMP_TAC[real_div; FLOAT_MUL_0x_hi]);; + +let FLOAT_DIV_FF_lo = prove(`e2 + k = r1 /\ min_exp + e + e1 = r2 /\ r2 - r1 = r /\ + r1 <= r2 /\ ~(n2 = 0) /\ + num_exp n e <= num_exp n1 k DIV num_exp n2 0 + ==> float_num F n r <= float_num F n1 e1 / float_num F n2 e2`, + MAP_EVERY ABBREV_TAC [`z = num_exp n e`; `x = num_exp n1 k`; `y = num_exp n2 0`] THEN + REPEAT STRIP_TAC THEN + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN + REPLICATE_TAC 3 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + REPEAT STRIP_TAC THEN + REWRITE_TAC[float; REAL_MUL_LID] THEN + REWRITE_TAC[real_div; REAL_INV_MUL; REAL_INV_INV] THEN + REWRITE_TAC[REAL_ARITH `(a * b) * c * d = (b * d) * (a * c)`] THEN + SUBGOAL_THEN `~(&(num_exp 1 min_exp) = &0)` ASSUME_TAC THENL + [ + REWRITE_TAC[num_exp; REAL_OF_NUM_EQ; MULT_CLAUSES; EXP_EQ_0] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_MUL_LID] THEN + + ASM_SIMP_TAC[NUM_EXP_SUB_lemma] THEN + SUBGOAL_THEN `&(num_exp n1 e1) * inv(&(num_exp n2 e2)) = (&x / &y) * &(num_exp 1 e1) * inv(&(num_exp 1 (e2 + k)))` MP_TAC THENL + [ + EXPAND_TAC "x" THEN EXPAND_TAC "y" THEN + REWRITE_TAC[real_div] THEN + REWRITE_TAC[num_exp; GSYM REAL_OF_NUM_MUL; GSYM REAL_OF_NUM_POW] THEN + REWRITE_TAC[REAL_MUL_LID; REAL_INV_MUL; REAL_INV_1; real_pow; REAL_MUL_RID] THEN + REWRITE_TAC[REAL_POW_ADD; REAL_INV_MUL] THEN + REWRITE_TAC[REAL_ARITH `((a * b) * c) * d * e * f = (b * f) * (a * c * d * e)`] THEN + SUBGOAL_THEN + (mk_comb(`(~)`, mk_eq(mk_binop `pow` (mk_comb (`&`, base_const)) `k:num`, `&0`))) ASSUME_TAC THENL + [ + REWRITE_TAC[REAL_POW_EQ_0] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[REAL_MUL_RINV; REAL_MUL_LID] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ONCE_REWRITE_TAC[REAL_ARITH `(a * b) * c = (a * c) * b`] THEN + REWRITE_TAC[REAL_MUL_ASSOC] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + REWRITE_TAC[REAL_LE_INV_EQ; REAL_POS] THEN + ONCE_REWRITE_TAC[NUM_EXP_SUM1] THEN + REWRITE_TAC[NUM_EXP_SUM] THEN + REWRITE_TAC[GSYM REAL_OF_NUM_MUL] THEN + ASM_REWRITE_TAC[REAL_ARITH `(a * b * c) * d = (d * a) * b * c`] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_MUL_LID] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + REWRITE_TAC[REAL_LE_INV_EQ; REAL_POS] THEN + MP_TAC (SPEC_ALL DIV_lemma) THEN + ANTS_TAC THENL + [ + EXPAND_TAC "y" THEN + REWRITE_TAC[num_exp; MULT_EQ_0; DE_MORGAN_THM] THEN + ASM_REWRITE_TAC[EXP] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + STRIP_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `&(x DIV y)` THEN + ASM_REWRITE_TAC[REAL_OF_NUM_LE]);; + +let FLOAT_DIV_FF_hi = prove(`e2 + k = r1 /\ min_exp + e + e1 = r2 /\ r2 - r1 = r /\ + r1 <= r2 /\ ~(n2 = 0) /\ + num_exp n1 k DIV num_exp n2 0 < num_exp n e + ==> float_num F n1 e1 / float_num F n2 e2 <= float_num F n r`, + MAP_EVERY ABBREV_TAC [`z = num_exp n e`; `x = num_exp n1 k`; `y = num_exp n2 0`] THEN + REPEAT STRIP_TAC THEN + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN + REPLICATE_TAC 3 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + REPEAT STRIP_TAC THEN + REWRITE_TAC[float; REAL_MUL_LID] THEN + REWRITE_TAC[real_div; REAL_INV_MUL; REAL_INV_INV] THEN + REWRITE_TAC[REAL_ARITH `(a * b) * c * d = (b * d) * (a * c)`] THEN + SUBGOAL_THEN `~(&(num_exp 1 min_exp) = &0)` ASSUME_TAC THENL + [ + REWRITE_TAC[num_exp; REAL_OF_NUM_EQ; MULT_CLAUSES; EXP_EQ_0] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_MUL_LID] THEN + + ASM_SIMP_TAC[NUM_EXP_SUB_lemma] THEN + SUBGOAL_THEN `&(num_exp n1 e1) * inv(&(num_exp n2 e2)) = (&x / &y) * &(num_exp 1 e1) * inv(&(num_exp 1 (e2 + k)))` MP_TAC THENL + [ + EXPAND_TAC "x" THEN EXPAND_TAC "y" THEN + REWRITE_TAC[real_div] THEN + REWRITE_TAC[num_exp; GSYM REAL_OF_NUM_MUL; GSYM REAL_OF_NUM_POW] THEN + REWRITE_TAC[REAL_MUL_LID; REAL_INV_MUL; REAL_INV_1; real_pow; REAL_MUL_RID] THEN + REWRITE_TAC[REAL_POW_ADD; REAL_INV_MUL] THEN + REWRITE_TAC[REAL_ARITH `((a * b) * c) * d * e * f = (b * f) * (a * c * d * e)`] THEN + SUBGOAL_THEN + (mk_comb(`(~)`, mk_eq(mk_binop `pow` (mk_comb (`&`, base_const)) `k:num`, `&0`))) ASSUME_TAC THENL + [ + REWRITE_TAC[REAL_POW_EQ_0] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[REAL_MUL_RINV; REAL_MUL_LID] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ONCE_REWRITE_TAC[REAL_ARITH `(a * b) * c = (a * c) * b`] THEN + REWRITE_TAC[REAL_MUL_ASSOC] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + REWRITE_TAC[REAL_LE_INV_EQ; REAL_POS] THEN + ONCE_REWRITE_TAC[NUM_EXP_SUM1] THEN + REWRITE_TAC[NUM_EXP_SUM] THEN + REWRITE_TAC[GSYM REAL_OF_NUM_MUL] THEN + ASM_REWRITE_TAC[REAL_ARITH `(a * b * c) * d = (d * a) * b * c`] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_MUL_LID] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + REWRITE_TAC[REAL_LE_INV_EQ; REAL_POS] THEN + MP_TAC (SPEC_ALL DIV_lemma) THEN + ANTS_TAC THENL + [ + EXPAND_TAC "y" THEN + REWRITE_TAC[num_exp; MULT_EQ_0; DE_MORGAN_THM] THEN + ASM_REWRITE_TAC[EXP] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + STRIP_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `&(x DIV y + 1)` THEN + ASM_REWRITE_TAC[REAL_OF_NUM_LE] THEN + UNDISCH_TAC `x DIV y < z` THEN + ARITH_TAC);; + +let FLOAT_DIV_TT_lo = prove(`e2 + k = r1 /\ min_exp + e + e1 = r2 /\ r2 - r1 = r /\ + r1 <= r2 /\ ~(n2 = 0) /\ + num_exp n e <= num_exp n1 k DIV num_exp n2 0 + ==> float_num F n r <= float_num T n1 e1 / float_num T n2 e2`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[real_div; REAL_INV_NEG; REAL_NEG_MUL2] THEN + REWRITE_TAC[GSYM real_div] THEN + REWRITE_TAC[FLOAT_DIV_FF_lo]);; + +let FLOAT_DIV_TT_hi = prove(`e2 + k = r1 /\ min_exp + e + e1 = r2 /\ + r2 - r1 = r /\ r1 <= r2 /\ ~(n2 = 0) /\ + num_exp n1 k DIV num_exp n2 0 < num_exp n e + ==> float_num T n1 e1 / float_num T n2 e2 <= float_num F n r`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[real_div; REAL_INV_NEG; REAL_NEG_MUL2] THEN + REWRITE_TAC[GSYM real_div] THEN + REWRITE_TAC[FLOAT_DIV_FF_hi]);; + + +let FLOAT_DIV_FT_lo = prove(`e2 + k = r1 /\ min_exp + e + e1 = r2 /\ + r2 - r1 = r /\ r1 <= r2 /\ ~(n2 = 0) /\ + num_exp n1 k DIV num_exp n2 0 < num_exp n e + ==> float_num T n r <= float_num F n1 e1 / float_num T n2 e2`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[real_div; REAL_INV_NEG] THEN + REWRITE_TAC[REAL_ARITH `--a <= b * --c <=> b * c <= a`] THEN + REWRITE_TAC[GSYM real_div] THEN + REWRITE_TAC[FLOAT_DIV_FF_hi]);; + +let FLOAT_DIV_FT_hi = prove(`e2 + k = r1 /\ min_exp + e + e1 = r2 /\ + r2 - r1 = r /\ r1 <= r2 /\ ~(n2 = 0) /\ + num_exp n e <= num_exp n1 k DIV num_exp n2 0 + ==> float_num F n1 e1 / float_num T n2 e2 <= float_num T n r`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[real_div; REAL_INV_NEG] THEN + REWRITE_TAC[REAL_ARITH `a * --b <= --c <=> c <= a * b`] THEN + REWRITE_TAC[GSYM real_div] THEN + REWRITE_TAC[FLOAT_DIV_FF_lo]);; + + +let FLOAT_DIV_TF_lo = prove(`e2 + k = r1 /\ min_exp + e + e1 = r2 /\ + r2 - r1 = r /\ r1 <= r2 /\ ~(n2 = 0) /\ + num_exp n1 k DIV num_exp n2 0 < num_exp n e + ==> float_num T n r <= float_num T n1 e1 / float_num F n2 e2`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[real_div; REAL_INV_NEG] THEN + REWRITE_TAC[REAL_ARITH `--a <= --b * c <=> b * c <= a`] THEN + REWRITE_TAC[GSYM real_div] THEN + REWRITE_TAC[FLOAT_DIV_FF_hi]);; + +let FLOAT_DIV_TF_hi = prove(`e2 + k = r1 /\ min_exp + e + e1 = r2 /\ + r2 - r1 = r /\ r1 <= r2 /\ ~(n2 = 0) /\ + num_exp n e <= num_exp n1 k DIV num_exp n2 0 + ==> float_num T n1 e1 / float_num F n2 e2 <= float_num T n r`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[real_div; REAL_INV_NEG] THEN + REWRITE_TAC[REAL_ARITH `--a * b <= --c <=> c <= a * b`] THEN + REWRITE_TAC[GSYM real_div] THEN + REWRITE_TAC[FLOAT_DIV_FF_lo]);; + + +(******************************************) +(* float_div_lo, float_div_hi *) + +let transform = UNDISCH_ALL o PURE_REWRITE_RULE[TAUT `~P <=> (P <=> F)`] o + NUMERALS_TO_NUM o PURE_REWRITE_RULE[GSYM IMP_IMP; min_exp_def];; + +let FLOAT_DIV_FF_hi' = transform FLOAT_DIV_FF_hi and + FLOAT_DIV_FF_lo' = transform FLOAT_DIV_FF_lo and + FLOAT_DIV_TT_hi' = transform FLOAT_DIV_TT_hi and + FLOAT_DIV_TT_lo' = transform FLOAT_DIV_TT_lo and + FLOAT_DIV_FT_hi' = transform FLOAT_DIV_FT_hi and + FLOAT_DIV_FT_lo' = transform FLOAT_DIV_FT_lo and + FLOAT_DIV_TF_hi' = transform FLOAT_DIV_TF_hi and + FLOAT_DIV_TF_lo' = transform FLOAT_DIV_TF_lo and + FLOAT_DIV_0x_hi' = transform FLOAT_DIV_0x_hi and + FLOAT_DIV_0x_lo' = transform FLOAT_DIV_0x_lo;; + +let float_div_lo pp f1 f2 = + let s1, n1, e1 = dest_float f1 and + s2, n2, e2 = dest_float f2 in + let n1_eq0_th = raw_eq0_hash_conv n1 in + if (rand o concl) n1_eq0_th = t_const then + (MY_PROVE_HYP n1_eq0_th o + INST[e1, e1_var_num; f2, f2_var_real; n1, n1_var_num; + (if s1 = "T" then t_const else f_const), s1_var_bool]) FLOAT_DIV_0x_lo' + else + let flag = s1 = s2 in + + let k_tm = rand (mk_small_numeral_array (2 * pp)) in + let num_exp1 = mk_num_exp n1 k_tm and + num_exp2 = mk_num_exp n2 zero_const in + let div_th, n_tm, e_tm = + if flag then + let th = num_exp_op_lo pp num_exp_div num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (lhand(concl th)) in + th, n_tm, e_tm + else + let th = num_exp_op_hi_lt pp num_exp_div num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (rand(concl th)) in + th, n_tm, e_tm in + + let r1_th = raw_add_conv_hash (mk_binop add_op_num e2 k_tm) in + let r1_tm = rand(concl r1_th) in + let e_plus_e1 = raw_add_conv_hash (mk_binop add_op_num e_tm e1) in + let ltm, rtm = dest_comb(concl e_plus_e1) in + let r2_th' = raw_add_conv_hash (mk_binop add_op_num min_exp_num_const rtm) in + let r2_th = TRANS (AP_TERM (mk_comb (add_op_num, min_exp_num_const)) e_plus_e1) r2_th' in + let r2_tm = rand(concl r2_th) in + let sub_th, le_th = raw_sub_and_le_hash_conv r2_tm r1_tm in + if rand(concl le_th) <> r2_tm then + failwith "float_div_lo: underflow" + else + let r_tm = rand(concl sub_th) in + let n2_not_zero = raw_eq0_hash_conv n2 in + let inst = INST[r1_tm, r1_var_num; r2_tm, r2_var_num; + n1, n1_var_num; e1, e1_var_num; + e_tm, e_var_num; k_tm, k_var_num; + n2, n2_var_num; e2, e2_var_num; + n_tm, n_var_num; r_tm, r_var_num] in + let th0 = inst + (if flag then + if s1 = "F" then FLOAT_DIV_FF_lo' else FLOAT_DIV_TT_lo' + else + if s1 = "F" then FLOAT_DIV_FT_lo' else FLOAT_DIV_TF_lo') in + let th1 = MY_PROVE_HYP n2_not_zero (MY_PROVE_HYP div_th (MY_PROVE_HYP le_th th0)) in + MY_PROVE_HYP sub_th (MY_PROVE_HYP r2_th (MY_PROVE_HYP r1_th th1));; + + +let float_div_hi pp f1 f2 = + let s1, n1, e1 = dest_float f1 and + s2, n2, e2 = dest_float f2 in + let n1_eq0_th = raw_eq0_hash_conv n1 in + if (rand o concl) n1_eq0_th = t_const then + (MY_PROVE_HYP n1_eq0_th o + INST[e1, e1_var_num; f2, f2_var_real; n1, n1_var_num; + (if s1 = "T" then t_const else f_const), s1_var_bool]) FLOAT_DIV_0x_hi' + else + let flag = s1 = s2 in + + let k_tm = rand (mk_small_numeral_array (2 * pp)) in + let num_exp1 = mk_num_exp n1 k_tm and + num_exp2 = mk_num_exp n2 zero_const in + let div_th, n_tm, e_tm = + if flag then + let th = num_exp_op_hi_lt pp num_exp_div num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (rand(concl th)) in + th, n_tm, e_tm + else + let th = num_exp_op_lo pp num_exp_div num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (lhand(concl th)) in + th, n_tm, e_tm in + + let r1_th = raw_add_conv_hash (mk_binop add_op_num e2 k_tm) in + let r1_tm = rand(concl r1_th) in + let e_plus_e1 = raw_add_conv_hash (mk_binop add_op_num e_tm e1) in + let ltm, rtm = dest_comb(concl e_plus_e1) in + let r2_th' = raw_add_conv_hash (mk_binop add_op_num min_exp_num_const rtm) in + let r2_th = TRANS (AP_TERM (mk_comb (add_op_num, min_exp_num_const)) e_plus_e1) r2_th' in + let r2_tm = rand(concl r2_th) in + let sub_th, le_th = raw_sub_and_le_hash_conv r2_tm r1_tm in + if rand(concl le_th) <> r2_tm then + failwith "float_div_hi: underflow" + else + let r_tm = rand(concl sub_th) in + let n2_not_zero = raw_eq0_hash_conv n2 in + let inst = INST[r1_tm, r1_var_num; r2_tm, r2_var_num; + n1, n1_var_num; e1, e1_var_num; + e_tm, e_var_num; k_tm, k_var_num; + n2, n2_var_num; e2, e2_var_num; + n_tm, n_var_num; r_tm, r_var_num] in + let th0 = inst + (if flag then + if s1 = "F" then FLOAT_DIV_FF_hi' else FLOAT_DIV_TT_hi' + else + if s1 = "F" then FLOAT_DIV_FT_hi' else FLOAT_DIV_TF_hi') in + let th1 = MY_PROVE_HYP n2_not_zero (MY_PROVE_HYP div_th (MY_PROVE_HYP le_th th0)) in + MY_PROVE_HYP sub_th (MY_PROVE_HYP r2_th (MY_PROVE_HYP r1_th th1));; + + +(***********************************) +(* FLOAT_ADD *) + +let FLOAT_ADD_FF = prove(`num_exp n1 e1 + num_exp n2 e2 = num_exp n e + ==> float_num F n1 e1 + float_num F n2 e2 = float_num F n e`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[float; REAL_MUL_LID] THEN + REWRITE_TAC[REAL_ARITH `a / b + c / b = (a + c) / b`] THEN + ASM_REWRITE_TAC[REAL_OF_NUM_ADD]);; + +let FLOAT_ADD_TT = prove(`num_exp n1 e1 + num_exp n2 e2 = num_exp n e + ==> float_num T n1 e1 + float_num T n2 e2 = float_num T n e`, + REWRITE_TAC[FLOAT_NEG_T; REAL_ARITH `--a + --b = --c <=> a + b = c`] THEN + REWRITE_TAC[FLOAT_ADD_FF]);; + +let FLOAT_ADD_FF_lo = prove(`num_exp n e <= num_exp n1 e1 + num_exp n2 e2 + ==> float_num F n e <= float_num F n1 e1 + float_num F n2 e2`, + REWRITE_TAC[GSYM REAL_OF_NUM_LE; GSYM REAL_OF_NUM_ADD] THEN + REPEAT STRIP_TAC THEN + MAP_EVERY ABBREV_TAC [`z = &(num_exp n e)`; `x = &(num_exp n1 e1)`; `y = &(num_exp n2 e2)`] THEN + ASM_REWRITE_TAC[float; REAL_MUL_LID] THEN + REWRITE_TAC[REAL_ARITH `a / b + c / b = (a + c) / b`] THEN + REWRITE_TAC[real_div] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + ASM_REWRITE_TAC[REAL_LE_INV_EQ; REAL_POS]);; + +let FLOAT_ADD_FF_hi = prove(`num_exp n1 e1 + num_exp n2 e2 <= num_exp n e + ==> float_num F n1 e1 + float_num F n2 e2 <= float_num F n e`, + REWRITE_TAC[GSYM REAL_OF_NUM_LE; GSYM REAL_OF_NUM_ADD] THEN + REPEAT STRIP_TAC THEN + MAP_EVERY ABBREV_TAC [`z = &(num_exp n e)`; `x = &(num_exp n1 e1)`; `y = &(num_exp n2 e2)`] THEN + ASM_REWRITE_TAC[float; REAL_MUL_LID] THEN + REWRITE_TAC[REAL_ARITH `a / b + c / b = (a + c) / b`] THEN + REWRITE_TAC[real_div] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + ASM_REWRITE_TAC[REAL_LE_INV_EQ; REAL_POS]);; + +let FLOAT_ADD_TT_lo = prove(`num_exp n1 e1 + num_exp n2 e2 <= num_exp n e + ==> float_num T n e <= float_num T n1 e1 + float_num T n2 e2`, + REWRITE_TAC[FLOAT_NEG_T; REAL_ARITH `--a <= --b + --c <=> b + c <= a`] THEN + REWRITE_TAC[FLOAT_ADD_FF_hi]);; + +let FLOAT_ADD_TT_hi = prove(`num_exp n e <= num_exp n1 e1 + num_exp n2 e2 + ==> float_num T n1 e1 + float_num T n2 e2 <= float_num T n e`, + REWRITE_TAC[FLOAT_NEG_T; REAL_ARITH `--b + --c <= --a <=> a <= b + c`] THEN + REWRITE_TAC[FLOAT_ADD_FF_lo]);; + +let FLOAT_ADD_FT_F_lo = prove(`num_exp n2 e2 <= num_exp n1 e1 ==> + num_exp n e <= num_exp n1 e1 - num_exp n2 e2 + ==> float_num F n e <= float_num F n1 e1 + float_num T n2 e2`, + MAP_EVERY ABBREV_TAC[`z = num_exp n e`; `x = num_exp n1 e1`; `y = num_exp n2 e2`] THEN + ASM_REWRITE_TAC[FLOAT_NEG_T; float; REAL_MUL_LID] THEN + DISCH_TAC THEN + ASM_SIMP_TAC[GSYM REAL_OF_NUM_LE; GSYM REAL_OF_NUM_SUB] THEN + REWRITE_TAC[num_exp; min_exp_def; MULT_CLAUSES; GSYM REAL_OF_NUM_POW] THEN + REAL_ARITH_TAC);; + +let FLOAT_ADD_FT_T_lo = prove(`num_exp n1 e1 <= num_exp n2 e2 ==> + num_exp n2 e2 - num_exp n1 e1 <= num_exp n e + ==> float_num T n e <= float_num F n1 e1 + float_num T n2 e2`, + MAP_EVERY ABBREV_TAC[`z = num_exp n e`; `x = num_exp n1 e1`; `y = num_exp n2 e2`] THEN + ASM_REWRITE_TAC[FLOAT_NEG_T; float; REAL_MUL_LID] THEN + DISCH_TAC THEN + ASM_SIMP_TAC[GSYM REAL_OF_NUM_LE; GSYM REAL_OF_NUM_SUB] THEN + REWRITE_TAC[num_exp; min_exp_def; MULT_CLAUSES; GSYM REAL_OF_NUM_POW] THEN + REAL_ARITH_TAC);; + +let FLOAT_ADD_FT_F_hi = prove(`num_exp n2 e2 <= num_exp n1 e1 ==> + num_exp n1 e1 - num_exp n2 e2 <= num_exp n e + ==> float_num F n1 e1 + float_num T n2 e2 <= float_num F n e`, + REWRITE_TAC[FLOAT_NEG_T; REAL_ARITH `a + --b <= c <=> --c <= b + --a`] THEN + REWRITE_TAC[GSYM FLOAT_NEG_T; FLOAT_ADD_FT_T_lo]);; + +let FLOAT_ADD_FT_T_hi = prove(`num_exp n1 e1 <= num_exp n2 e2 ==> + num_exp n e <= num_exp n2 e2 - num_exp n1 e1 + ==> float_num F n1 e1 + float_num T n2 e2 <= float_num T n e`, + REWRITE_TAC[FLOAT_NEG_T; REAL_ARITH `a + --b <= --c <=> c <= b + --a`] THEN + REWRITE_TAC[GSYM FLOAT_NEG_T; FLOAT_ADD_FT_F_lo]);; + + +(******************************************) +(* float_add_lo, float_add_hi *) + +let REAL_ADD_COMM = CONJUNCT1 REAL_ADD_AC;; + +let transform = UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o NUMERALS_TO_NUM;; +let FLOAT_ADD_FF_hi' = transform FLOAT_ADD_FF_hi and + FLOAT_ADD_FF_lo' = transform FLOAT_ADD_FF_lo and + FLOAT_ADD_TT_hi' = transform FLOAT_ADD_TT_hi and + FLOAT_ADD_TT_lo' = transform FLOAT_ADD_TT_lo and + FLOAT_ADD_FT_F_lo' = transform FLOAT_ADD_FT_F_lo and + FLOAT_ADD_FT_T_lo' = transform FLOAT_ADD_FT_T_lo and + FLOAT_ADD_FT_F_hi' = transform FLOAT_ADD_FT_F_hi and + FLOAT_ADD_FT_T_hi' = transform FLOAT_ADD_FT_T_hi;; + +let float_add_lo pp f1 f2 = + let s1, n1, e1 = dest_float f1 in + let s2, n2, e2 = dest_float f2 in + if s1 = s2 then + let num_exp1 = mk_num_exp n1 e1 in + let num_exp2 = mk_num_exp n2 e2 in + + if s1 = "F" then + (* F + F *) + let add_th = num_exp_op_lo pp num_exp_add num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (lhand(concl add_th)) in + let th0 = INST[e_tm, e_var_num; n_tm, n_var_num; n1, n1_var_num; + e1, e1_var_num; n2, n2_var_num; e2, e2_var_num] FLOAT_ADD_FF_lo' in + MY_PROVE_HYP add_th th0 + else + (* T + T *) + let add_th = num_exp_op_hi pp num_exp_add num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (rand(concl add_th)) in + let th0 = INST[e_tm, e_var_num; n_tm, n_var_num; n1, n1_var_num; + e1, e1_var_num; n2, n2_var_num; e2, e2_var_num] FLOAT_ADD_TT_lo' in + MY_PROVE_HYP add_th th0 + else + (* F + T or T + F *) + let th0, n1, e1, n2, e2 = + if s1 = "T" then + INST[f2, m_var_real; f1, n_var_real] REAL_ADD_COMM, n2, e2, n1, e1 + else + REFL(mk_binop add_op_real f1 f2), n1, e1, n2, e2 in + + let num_exp1 = mk_num_exp n1 e1 in + let num_exp2 = mk_num_exp n2 e2 in + + let sub_th, le_th = num_exp_sub num_exp1 num_exp2 in + let sub_tm = rand(concl sub_th) in + + if rand(concl le_th) = num_exp1 then + let lo_th = num_exp_lo pp sub_tm in + let n_tm, e_tm = dest_num_exp (lhand(concl lo_th)) in + let lo_sub_th = EQ_MP (AP_TERM (rator(concl lo_th)) (SYM sub_th)) lo_th in + + let th1 = INST[n1, n1_var_num; e1, e1_var_num; n2, n2_var_num; e2, e2_var_num; + n_tm, n_var_num; e_tm, e_var_num] FLOAT_ADD_FT_F_lo' in + let th2 = MY_PROVE_HYP lo_sub_th (MY_PROVE_HYP le_th th1) in + EQ_MP (AP_TERM (rator(concl th2)) th0) th2 + + else + let hi_th = num_exp_hi pp sub_tm in + let n_tm, e_tm = dest_num_exp(rand(concl hi_th)) in + let hi_sub_th = EQ_MP (SYM (AP_THM (AP_TERM le_op_num sub_th) (rand(concl hi_th)))) hi_th in + + let th1 = INST[n1, n1_var_num; e1, e1_var_num; n2, n2_var_num; e2, e2_var_num; + n_tm, n_var_num; e_tm, e_var_num] FLOAT_ADD_FT_T_lo' in + let th2 = MY_PROVE_HYP hi_sub_th (MY_PROVE_HYP le_th th1) in + EQ_MP (AP_TERM (rator(concl th2)) th0) th2;; + + +let float_add_hi pp f1 f2 = + let s1, n1, e1 = dest_float f1 in + let s2, n2, e2 = dest_float f2 in + if s1 = s2 then + let num_exp1 = mk_num_exp n1 e1 in + let num_exp2 = mk_num_exp n2 e2 in + + if s1 = "F" then + (* F + F *) + let add_th = num_exp_op_hi pp num_exp_add num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (rand(concl add_th)) in + let th0 = INST[e_tm, e_var_num; n_tm, n_var_num; n1, n1_var_num; + e1, e1_var_num; n2, n2_var_num; e2, e2_var_num] FLOAT_ADD_FF_hi' in + MY_PROVE_HYP add_th th0 + else + (* T + T *) + let add_th = num_exp_op_lo pp num_exp_add num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (lhand(concl add_th)) in + let th0 = INST[e_tm, e_var_num; n_tm, n_var_num; n1, n1_var_num; + e1, e1_var_num; n2, n2_var_num; e2, e2_var_num] FLOAT_ADD_TT_hi' in + MY_PROVE_HYP add_th th0 + else + (* F + T or T + F *) + let th0, n1, e1, n2, e2 = + if s1 = "T" then + INST[f2, m_var_real; f1, n_var_real] REAL_ADD_COMM, n2, e2, n1, e1 + else + REFL(mk_binop add_op_real f1 f2), n1, e1, n2, e2 in + + let num_exp1 = mk_num_exp n1 e1 in + let num_exp2 = mk_num_exp n2 e2 in + + let sub_th, le_th = num_exp_sub num_exp1 num_exp2 in + let sub_tm = rand(concl sub_th) in + + if rand(concl le_th) = num_exp1 then + let hi_th = num_exp_hi pp sub_tm in + let n_tm, e_tm = dest_num_exp (rand(concl hi_th)) in + let hi_sub_th = EQ_MP (SYM (AP_THM (AP_TERM le_op_num sub_th) (rand(concl hi_th)))) hi_th in + + let th1 = INST[n1, n1_var_num; e1, e1_var_num; n2, n2_var_num; e2, e2_var_num; + n_tm, n_var_num; e_tm, e_var_num] FLOAT_ADD_FT_F_hi' in + let th2 = MY_PROVE_HYP hi_sub_th (MY_PROVE_HYP le_th th1) in + EQ_MP (AP_THM (AP_TERM le_op_real th0) (rand(concl th2))) th2 + + else + let lo_th = num_exp_lo pp sub_tm in + let n_tm, e_tm = dest_num_exp(lhand(concl lo_th)) in + let lo_sub_th = EQ_MP (AP_TERM (rator(concl lo_th)) (SYM sub_th)) lo_th in + + let th1 = INST[n1, n1_var_num; e1, e1_var_num; n2, n2_var_num; e2, e2_var_num; + n_tm, n_var_num; e_tm, e_var_num] FLOAT_ADD_FT_T_hi' in + let th2 = MY_PROVE_HYP lo_sub_th (MY_PROVE_HYP le_th th1) in + EQ_MP (AP_THM (AP_TERM le_op_real th0) (rand(concl th2))) th2;; + + +(******************************************) +(* float_sub_lo, float_sub_hi *) + +let FLOAT_SUB_F_EQ_ADD = (SYM o prove)(`f1 - float_num F n2 e2 = f1 + float_num T n2 e2`, + REWRITE_TAC[FLOAT_NEG_T] THEN REAL_ARITH_TAC);; + +let FLOAT_SUB_T_EQ_ADD = (SYM o prove)(`f1 - float_num T n2 e2 = f1 + float_num F n2 e2`, + REWRITE_TAC[FLOAT_NEG_T] THEN REAL_ARITH_TAC);; + +let float_sub_lo pp f1 f2 = + let s2, n2, e2 = dest_float f2 in + let th0 = + INST[f1, f1_var_real; n2, n2_var_num; e2, e2_var_num] + (if s2 = "F" then FLOAT_SUB_F_EQ_ADD else FLOAT_SUB_T_EQ_ADD) in + let ltm,f2_tm = dest_comb(lhand(concl th0)) in + let f1_tm = rand ltm in + let lo_th = float_add_lo pp f1_tm f2_tm in + EQ_MP (AP_TERM (rator(concl lo_th)) th0) lo_th;; + + +let float_sub_hi pp f1 f2 = + let s2, n2, e2 = dest_float f2 in + let th0 = + INST[f1, f1_var_real; n2, n2_var_num; e2, e2_var_num] + (if s2 = "F" then FLOAT_SUB_F_EQ_ADD else FLOAT_SUB_T_EQ_ADD) in + let ltm, f2_tm = dest_comb(lhand(concl th0)) in + let f1_tm = rand ltm in + let hi_th = float_add_hi pp f1_tm f2_tm in + EQ_MP (AP_THM (AP_TERM le_op_real th0) (rand(concl hi_th))) hi_th;; + + +(*******************************************) +(* FLOAT_SQRT *) + +(* float_num F m e = float_num F (B0 m) (PRE e) *) +let FLOAT_PRE_EXP = prove(mk_imp(`~(e = 0) /\ PRE e = e1`, + mk_eq(`float_num F m e`, + mk_comb(mk_comb(`float_num F`, mk_comb(b0_const, m_var_num)), `e1:num`))), + STRIP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[float; REAL_MUL_LID; real_div; REAL_EQ_MUL_RCANCEL] THEN + DISJ1_TAC THEN + REWRITE_TAC[num_exp; b0_thm; REAL_OF_NUM_EQ] THEN + SUBGOAL_THEN `e = SUC (PRE e)` MP_TAC THENL + [ + POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> CONV_TAC (LAND_CONV (ONCE_REWRITE_CONV[th]))) THEN + REWRITE_TAC[EXP] THEN + ARITH_TAC);; + +let DIV2_EVEN_lemma = prove(`!n. EVEN n ==> 2 * (n DIV 2) = n`, + GEN_TAC THEN + REWRITE_TAC[EVEN_EXISTS] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC (ARITH_RULE `x = y ==> 2 * x = 2 * y`) THEN + MATCH_MP_TAC DIV_MULT THEN + ARITH_TAC);; + +let FLOAT_SQRT_EVEN_lo = prove(`f1 * f1 = f2 /\ f2 <= x /\ + num_exp m (2 * p) = x /\ f1 = num_exp n1 e1 + /\ EVEN e /\ e DIV 2 = e2 /\ + e1 + e2 + (min_exp DIV 2) = r /\ + p <= r /\ r - p = r2 + ==> float_num F n1 r2 <= sqrt (float_num F m e)`, + STRIP_TAC THEN + UNDISCH_TAC `f2 <= x:num` THEN + UNDISCH_TAC `num_exp m (2 * p) = x` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + UNDISCH_TAC `f1 * f1 = f2:num` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + UNDISCH_TAC `e1 + e2 + min_exp DIV 2 = r` THEN + UNDISCH_TAC `e DIV 2 = e2` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REWRITE_TAC[num_exp; float; REAL_MUL_LID; GSYM REAL_OF_NUM_MUL] THEN + REPEAT STRIP_TAC THEN + UNDISCH_TAC `r - p = r2:num` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + + MATCH_MP_TAC REAL_LE_RSQRT THEN + REWRITE_TAC[GSYM REAL_OF_NUM_POW; REAL_POW_DIV] THEN + REWRITE_TAC[REAL_POW_2; real_div; REAL_INV_MUL] THEN + REWRITE_TAC[REAL_MUL_ASSOC] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + CONJ_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `(((a * b) * a) * b) * c = (a * a) * (b * b) * c:real`] THEN + REWRITE_TAC[GSYM REAL_POW_ADD] THEN + REWRITE_TAC[ARITH_RULE `r - p + r - p = 2 * r - 2 * p`] THEN + MP_TAC (SPECL[mk_comb(amp_op_real, base_const); `2 * r`; `2 * p`] REAL_DIV_POW2) THEN + ANTS_TAC THENL [ REAL_ARITH_TAC; ALL_TAC ] THEN + ASM_SIMP_TAC[ARITH_RULE `p <= r ==> 2 * p <= 2 * r`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th; real_div]) THEN + + SUBGOAL_THEN `2 * r = (e1 + e1) + min_exp + e` (fun th -> REWRITE_TAC[th]) THENL + [ + EXPAND_TAC "r" THEN + REWRITE_TAC[ARITH_RULE `2 * (e1 + b + c) = (e1 + e1) + 2 * c + 2 * b`] THEN + MATCH_MP_TAC (ARITH_RULE `b1 = b2 /\ c1 = c2 ==> a + b1 + c1 = a + b2 + c2:num`) THEN + SUBGOAL_THEN `EVEN min_exp` ASSUME_TAC THENL + [ + REWRITE_TAC[min_exp_def] THEN ARITH_TAC; + ALL_TAC + ] THEN + ASM_SIMP_TAC[DIV2_EVEN_lemma]; + ALL_TAC + ] THEN + + REWRITE_TAC[REAL_POW_ADD] THEN + REWRITE_TAC[REAL_ARITH `(n * n) * (((e * e) * x * y) * z) * u = (n * e) * (n * e) * (x * u) * z * y:real`] THEN + SUBGOAL_THEN `~(&(num_exp 1 min_exp) = &0)` MP_TAC THENL + [ + REWRITE_TAC[REAL_OF_NUM_EQ; NUM_EXP_EQ_0] THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[num_exp; REAL_MUL_LID; GSYM REAL_OF_NUM_POW; GSYM REAL_OF_NUM_MUL] THEN + DISCH_THEN (fun th -> SIMP_TAC[th; REAL_MUL_RINV; REAL_MUL_LID]) THEN + FIRST_X_ASSUM (MP_TAC o check(fun th -> (fst o dest_var o lhand o concl) th = "f1")) THEN + REWRITE_TAC[GSYM REAL_OF_NUM_EQ; GSYM REAL_OF_NUM_MUL; GSYM REAL_OF_NUM_POW] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + + REWRITE_TAC[REAL_MUL_ASSOC] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + CONJ_TAC THENL + [ + SUBGOAL_THEN `!x y z. &0 < x /\ y <= z * x ==> y * inv x <= z` MP_TAC THENL + [ + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`y * inv x`; `z:real`; `x:real`] REAL_LE_RMUL_EQ) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th; GSYM REAL_MUL_ASSOC]) THEN + ASM_SIMP_TAC[REAL_ARITH `&0 < x ==> ~(x = &0)`; REAL_MUL_LINV; REAL_MUL_RID]; + ALL_TAC + ] THEN + + DISCH_THEN (MP_TAC o SPECL[`&(num_exp 1 (2 * p))`; `&(f1 * f1)`; `&m`]) THEN + REWRITE_TAC[num_exp; GSYM REAL_OF_NUM_MUL; GSYM REAL_OF_NUM_POW; REAL_MUL_LID] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[REAL_OF_NUM_MUL; REAL_OF_NUM_POW; REAL_OF_NUM_LE] THEN + REWRITE_TAC[REAL_OF_NUM_LT; EXP_LT_0] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_POW_LE THEN + ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_INV THEN + MATCH_MP_TAC REAL_POW_LE THEN + ARITH_TAC);; + + +let FLOAT_SQRT_EVEN_hi = prove(`f1 * f1 = f2 /\ x <= f2 /\ + num_exp m (2 * p) = x /\ f1 = num_exp n1 e1 + /\ EVEN e /\ e DIV 2 = e2 /\ + e1 + e2 + (min_exp DIV 2) = r /\ + p <= r /\ r - p = r2 + ==> sqrt (float_num F m e) <= float_num F n1 r2`, + STRIP_TAC THEN + UNDISCH_TAC `x <= f2:num` THEN + UNDISCH_TAC `num_exp m (2 * p) = x` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + UNDISCH_TAC `f1 * f1 = f2:num` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + UNDISCH_TAC `e1 + e2 + min_exp DIV 2 = r` THEN + UNDISCH_TAC `e DIV 2 = e2` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REWRITE_TAC[num_exp; float; REAL_MUL_LID; GSYM REAL_OF_NUM_MUL] THEN + REPEAT STRIP_TAC THEN + UNDISCH_TAC `r - p = r2:num` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + + MATCH_MP_TAC REAL_LE_LSQRT THEN + REPEAT CONJ_TAC THENL + [ + REWRITE_TAC[REAL_OF_NUM_MUL; real_div] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + REWRITE_TAC[REAL_POS] THEN + MATCH_MP_TAC REAL_LE_INV THEN + REWRITE_TAC[REAL_POS]; + REWRITE_TAC[REAL_OF_NUM_MUL; real_div] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + REWRITE_TAC[REAL_POS] THEN + MATCH_MP_TAC REAL_LE_INV THEN + REWRITE_TAC[REAL_POS]; + ALL_TAC + ] THEN + + REWRITE_TAC[GSYM REAL_OF_NUM_POW; REAL_POW_DIV] THEN + REWRITE_TAC[REAL_POW_2; real_div; REAL_INV_MUL] THEN + REWRITE_TAC[REAL_MUL_ASSOC] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + CONJ_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `(((a * b) * a) * b) * c = (a * a) * (b * b) * c:real`] THEN + REWRITE_TAC[GSYM REAL_POW_ADD] THEN + REWRITE_TAC[ARITH_RULE `r - p + r - p = 2 * r - 2 * p`] THEN + MP_TAC (SPECL[mk_comb(amp_op_real, base_const); `2 * r`; `2 * p`] REAL_DIV_POW2) THEN + ANTS_TAC THENL [ REAL_ARITH_TAC; ALL_TAC ] THEN + ASM_SIMP_TAC[ARITH_RULE `p <= r ==> 2 * p <= 2 * r`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th; real_div]) THEN + + SUBGOAL_THEN `2 * r = (e1 + e1) + min_exp + e` (fun th -> REWRITE_TAC[th]) THENL + [ + EXPAND_TAC "r" THEN + REWRITE_TAC[ARITH_RULE `2 * (e1 + b + c) = (e1 + e1) + 2 * c + 2 * b`] THEN + MATCH_MP_TAC (ARITH_RULE `b1 = b2 /\ c1 = c2 ==> a + b1 + c1 = a + b2 + c2:num`) THEN + SUBGOAL_THEN `EVEN min_exp` ASSUME_TAC THENL + [ + REWRITE_TAC[min_exp_def] THEN ARITH_TAC; + ALL_TAC + ] THEN + ASM_SIMP_TAC[DIV2_EVEN_lemma]; + ALL_TAC + ] THEN + + REWRITE_TAC[REAL_POW_ADD] THEN + REWRITE_TAC[REAL_ARITH `(n * n) * (((e * e) * x * y) * z) * u = (n * e) * (n * e) * (x * u) * z * y:real`] THEN + SUBGOAL_THEN `~(&(num_exp 1 min_exp) = &0)` MP_TAC THENL + [ + REWRITE_TAC[REAL_OF_NUM_EQ; NUM_EXP_EQ_0] THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[num_exp; REAL_MUL_LID; GSYM REAL_OF_NUM_POW; GSYM REAL_OF_NUM_MUL] THEN + DISCH_THEN (fun th -> SIMP_TAC[th; REAL_MUL_RINV; REAL_MUL_LID]) THEN + FIRST_X_ASSUM (MP_TAC o check(fun th -> (fst o dest_var o lhand o concl) th = "f1")) THEN + REWRITE_TAC[GSYM REAL_OF_NUM_EQ; GSYM REAL_OF_NUM_MUL; GSYM REAL_OF_NUM_POW] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + + REWRITE_TAC[REAL_MUL_ASSOC] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + CONJ_TAC THENL + [ + SUBGOAL_THEN `!x y z. &0 < x /\ z * x <= y ==> z <= y * inv x` MP_TAC THENL + [ + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`z:real`; `y * inv x`; `x:real`] REAL_LE_RMUL_EQ) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th; GSYM REAL_MUL_ASSOC]) THEN + ASM_SIMP_TAC[REAL_ARITH `&0 < x ==> ~(x = &0)`; REAL_MUL_LINV; REAL_MUL_RID]; + ALL_TAC + ] THEN + + DISCH_THEN (MP_TAC o SPECL[`&(num_exp 1 (2 * p))`; `&(f1 * f1)`; `&m`]) THEN + REWRITE_TAC[num_exp; GSYM REAL_OF_NUM_MUL; GSYM REAL_OF_NUM_POW; REAL_MUL_LID] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[REAL_OF_NUM_MUL; REAL_OF_NUM_POW; REAL_OF_NUM_LE] THEN + REWRITE_TAC[REAL_OF_NUM_LT; EXP_LT_0] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_POW_LE THEN + ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_INV THEN + MATCH_MP_TAC REAL_POW_LE THEN + ARITH_TAC);; + + +(******************) +let transform = UNDISCH_ALL o + PURE_ONCE_REWRITE_RULE[TAUT `EVEN e <=> (EVEN e <=> T)`] o + NUMERALS_TO_NUM o + CONV_RULE (DEPTH_CONV NUM_DIV_CONV) o + REWRITE_RULE[GSYM IMP_IMP; min_exp_def];; + +let FLOAT_SQRT_EVEN_lo' = transform FLOAT_SQRT_EVEN_lo and + FLOAT_SQRT_EVEN_hi' = transform FLOAT_SQRT_EVEN_hi and + FLOAT_PRE_EXP' = (UNDISCH_ALL o + PURE_ONCE_REWRITE_RULE[TAUT `~(e = _0) <=> ((e = _0) <=> F)`] o + REWRITE_RULE[GSYM IMP_IMP; NUMERAL]) FLOAT_PRE_EXP;; + +let even_const = `EVEN` and + pre_const = `PRE` and + two_num = rand(mk_small_numeral_array 2) and + min_exp_div2 = rand(mk_small_numeral_array (min_exp / 2)) and + f2_var_num = `f2:num` and + f1_var_num = `f1:num` and + p_var_num = `p:num`;; + +(* Returns the list of digits of the given Big_int n in the base b *) +let rec get_big_int_digits b n = + let bb = big_int_of_int b in + if le_big_int n zero_big_int then [] + else + let q, r = quomod_big_int n bb in + r :: get_big_int_digits b q;; + +(* [1;2;3] -> 123 (base = 10) *) +let rec big_int_from_list b list = + let rec proc acc list = + match list with + [] -> acc + | h::t -> proc (add_big_int h (mult_int_big_int b acc)) t in + proc zero_big_int list;; + +(* Returns n first elements of the list *) +let rec take n list = + match list with + x :: xs -> if n > 0 then x :: take (n - 1) xs else [] + | [] -> [];; + +(* Returns an integer number that contains at most pp significant digits + in the given base b *) +let big_int_round_lo base pp n = + let digits = rev (get_big_int_digits base n) in + let n_digits = length digits in + if n_digits <= pp then + n + else + let m = big_int_from_list base (take pp digits) in + mult_big_int (power_int_positive_int base (n_digits - pp)) m;; + +let big_int_round_hi base pp n = + let digits = rev (get_big_int_digits base n) in + let n_digits = length digits in + if n_digits <= pp then n + else + let l1, l2 = chop_list pp digits in + if forall (eq_big_int zero_big_int) l2 then n + else + let m = succ_big_int (big_int_from_list base l1) in + mult_big_int (power_int_positive_int base (n_digits - pp)) m;; + + +(******************) +let rec float_sqrt_lo pp tm = + let s, m_tm, e_tm = dest_float tm in + let p_tm = rand (mk_small_numeral_array pp) in + if s <> "F" then + failwith "float_sqrt_lo: negative argument" + else + let even_th = raw_even_hash_conv (mk_comb (even_const, e_tm)) in + if (fst o dest_const o rand o concl) even_th <> "T" then + (* ODD e *) + let pre_e = raw_pre_hash_conv (mk_comb (pre_const, e_tm)) in + let e_neq_0 = raw_eq0_hash_conv e_tm in + let e1_tm = rand (concl pre_e) in + let th0 = INST[e1_tm, e1_var_num; e_tm, e_var_num; m_tm, m_var_num] FLOAT_PRE_EXP' in + let th1 = MY_PROVE_HYP pre_e (MY_PROVE_HYP e_neq_0 th0) in + let th2 = float_sqrt_lo pp (rand(concl th1)) in + let ltm, rtm = dest_comb (concl th2) in + EQ_MP (SYM (AP_TERM ltm (AP_TERM (rator rtm) th1))) th2 + else + (* EVEN e *) + let p2_tm = mk_binop mul_op_num two_num p_tm in + let p2_th = raw_mul_conv_hash p2_tm in + let f1_1 = AP_TERM (mk_comb(num_exp_const, m_tm)) p2_th in + let f1_2 = TRANS f1_1 (denormalize (rand (concl f1_1))) in + + let x_tm = rand(concl f1_2) in + let x = raw_dest_hash x_tm in + let f1' = Big_int.sqrt_big_int (big_int_of_num x) in + let f1 = num_of_big_int (big_int_round_lo Arith_hash.arith_base pp f1') in + let f1_tm = rand(mk_numeral_array f1) in + let f1_num_exp = to_num_exp f1_tm in + + let n1_tm, e1_tm = dest_num_exp (rand (concl f1_num_exp)) in + let f1f1_eq_f2 = raw_mul_conv_hash (mk_binop mul_op_num f1_tm f1_tm) in + let f2_tm = rand(concl f1f1_eq_f2) in + let f2_le_x = EQT_ELIM (raw_le_hash_conv (mk_binop le_op_num f2_tm x_tm)) in + + let e_div2_eq_e2 = raw_div_hash_conv (mk_binop div_op_num e_tm two_num) in + let e2_tm = rand(concl e_div2_eq_e2) in + let r_th1 = raw_add_conv_hash (mk_binop add_op_num e2_tm min_exp_div2) in + let r_th2 = AP_TERM (mk_comb(add_op_num, e1_tm)) r_th1 in + let r_th = TRANS r_th2 (raw_add_conv_hash (rand (concl r_th2))) in + + let r_tm = rand(concl r_th) in + let r_sub_p, p_le_r = raw_sub_and_le_hash_conv p_tm r_tm in + let r2_tm = rand(concl r_sub_p) in + if (rand(concl p_le_r) <> r_tm) then + failwith "float_sqrt_lo: underflow" + else + let th0 = INST[f2_tm, f2_var_num; x_tm, x_var_num; p_tm, p_var_num; r_tm, r_var_num; + f1_tm, f1_var_num; n1_tm, n1_var_num; e1_tm, e1_var_num; e2_tm, e2_var_num; + e_tm, e_var_num; m_tm, m_var_num; r2_tm, r2_var_num] + FLOAT_SQRT_EVEN_lo' in + MY_PROVE_HYP f1_2 ( + MY_PROVE_HYP e_div2_eq_e2 ( + MY_PROVE_HYP r_sub_p ( + MY_PROVE_HYP r_th ( + MY_PROVE_HYP f1f1_eq_f2 ( + MY_PROVE_HYP f1_num_exp ( + MY_PROVE_HYP even_th ( + MY_PROVE_HYP f2_le_x ( + MY_PROVE_HYP p_le_r th0 + ))))))));; + + +let rec float_sqrt_hi pp tm = + let s, m_tm, e_tm = dest_float tm in + let p_tm = rand (mk_small_numeral_array pp) in + if s <> "F" then + failwith "float_sqrt_lo: negative argument" + else + let even_th = raw_even_hash_conv (mk_comb (even_const, e_tm)) in + if (fst o dest_const o rand o concl) even_th <> "T" then + (* ODD e *) + let pre_e = raw_pre_hash_conv (mk_comb (pre_const, e_tm)) in + let e_neq_0 = raw_eq0_hash_conv e_tm in + let e1_tm = rand (concl pre_e) in + let th0 = INST[e1_tm, e1_var_num; e_tm, e_var_num; m_tm, m_var_num] FLOAT_PRE_EXP' in + let th1 = MY_PROVE_HYP pre_e (MY_PROVE_HYP e_neq_0 th0) in + let th2 = float_sqrt_hi pp (rand(concl th1)) in + let ltm, rtm = dest_comb (concl th2) in + let ltm2, rtm2 = dest_comb ltm in + let th3 = AP_THM (AP_TERM ltm2 (AP_TERM (rator rtm2) th1)) rtm in + EQ_MP (SYM th3) th2 + else + (* EVEN e *) + let p2_tm = mk_binop mul_op_num two_num p_tm in + let p2_th = raw_mul_conv_hash p2_tm in + let f1_1 = AP_TERM (mk_comb(num_exp_const, m_tm)) p2_th in + let f1_2 = TRANS f1_1 (denormalize (rand (concl f1_1))) in + + let x_tm = rand(concl f1_2) in + let x = raw_dest_hash x_tm in + let x' = big_int_of_num x in + let f1' = sqrt_big_int x' in + let f1 = (num_of_big_int o big_int_round_hi Arith_hash.arith_base pp) + (if eq_big_int (mult_big_int f1' f1') x' then f1' else succ_big_int f1') in + + let f1_tm = rand(mk_numeral_array f1) in + let f1_num_exp = to_num_exp f1_tm in + + let n1_tm, e1_tm = dest_num_exp (rand (concl f1_num_exp)) in + let f1f1_eq_f2 = raw_mul_conv_hash (mk_binop mul_op_num f1_tm f1_tm) in + let f2_tm = rand(concl f1f1_eq_f2) in + let x_le_f2 = EQT_ELIM (raw_le_hash_conv (mk_binop le_op_num x_tm f2_tm)) in + + let e_div2_eq_e2 = raw_div_hash_conv (mk_binop div_op_num e_tm two_num) in + let e2_tm = rand(concl e_div2_eq_e2) in + let r_th1 = raw_add_conv_hash (mk_binop add_op_num e2_tm min_exp_div2) in + let r_th2 = AP_TERM (mk_comb(add_op_num, e1_tm)) r_th1 in + let r_th = TRANS r_th2 (raw_add_conv_hash (rand (concl r_th2))) in + + let r_tm = rand(concl r_th) in + let r_sub_p, p_le_r = raw_sub_and_le_hash_conv p_tm r_tm in + let r2_tm = rand(concl r_sub_p) in + if (rand(concl p_le_r) <> r_tm) then + failwith "float_sqrt_lo: underflow" + else + let th0 = INST[f2_tm, f2_var_num; x_tm, x_var_num; p_tm, p_var_num; r_tm, r_var_num; + f1_tm, f1_var_num; n1_tm, n1_var_num; e1_tm, e1_var_num; e2_tm, e2_var_num; + e_tm, e_var_num; m_tm, m_var_num; r2_tm, r2_var_num] + FLOAT_SQRT_EVEN_hi' in + MY_PROVE_HYP f1_2 ( + MY_PROVE_HYP e_div2_eq_e2 ( + MY_PROVE_HYP r_sub_p ( + MY_PROVE_HYP r_th ( + MY_PROVE_HYP f1f1_eq_f2 ( + MY_PROVE_HYP f1_num_exp ( + MY_PROVE_HYP even_th ( + MY_PROVE_HYP x_le_f2 ( + MY_PROVE_HYP p_le_r th0 + ))))))));; + +end;; (* Float_ops module *) + +(************************************) +(* Cached floating point operations *) +(************************************) + +(* Counters for collecting stats *) +let lt0_c = ref 0 and + gt0_c = ref 0 and + lt_c = ref 0 and + le0_c = ref 0 and + ge0_c = ref 0 and + le_c = ref 0 and + min_c = ref 0 and + max_c = ref 0 and + min_max_c = ref 0 and + mul_lo_c = ref 0 and + mul_hi_c = ref 0 and + div_lo_c = ref 0 and + div_hi_c = ref 0 and + add_lo_c = ref 0 and + add_hi_c = ref 0 and + sub_lo_c = ref 0 and + sub_hi_c = ref 0 and + sqrt_lo_c = ref 0 and + sqrt_hi_c = ref 0;; + +(* Hash tables *) +let cache_size = if !Arith_options.float_cached then !Arith_options.init_cache_size else 1;; + +let my_add h key v = + if Hashtbl.length h >= !Arith_options.max_cache_size then + Hashtbl.clear h +(* let _ = Hashtbl.clear h in + print_string "Clearing a float hash table" *) + else + (); + Hashtbl.add h key v;; + +let mul_table = Hashtbl.create cache_size and + div_table = Hashtbl.create cache_size and + add_table = Hashtbl.create cache_size and + sub_table = Hashtbl.create cache_size and + sqrt_table = Hashtbl.create cache_size and + le_table = Hashtbl.create cache_size and + max_table = Hashtbl.create cache_size;; + +let reset_cache () = + Hashtbl.clear mul_table; + Hashtbl.clear div_table; + Hashtbl.clear add_table; + Hashtbl.clear sub_table; + Hashtbl.clear sqrt_table; + Hashtbl.clear le_table; + Hashtbl.clear max_table;; + +let reset_stat () = + lt0_c := 0; + gt0_c := 0; + lt_c := 0; + le0_c := 0; + ge0_c := 0; + le_c := 0; + min_c := 0; + max_c := 0; + min_max_c := 0; + mul_lo_c := 0; + mul_hi_c := 0; + div_lo_c := 0; + div_hi_c := 0; + add_lo_c := 0; + add_hi_c := 0; + sub_lo_c := 0; + sub_hi_c := 0; + sqrt_lo_c := 0; + sqrt_hi_c := 0;; + +let print_stat () = + let len = Hashtbl.length in + let cmp_str1 = sprintf "lt0 = %d\ngt0 = %d\nlt = %d\n" !lt0_c !gt0_c !lt_c and + cmp_str2 = sprintf "le0 = %d\nge0 = %d\n" !le0_c !ge0_c and + cmp_str3 = sprintf "min = %d\nmin_max = %d\n" !min_c !min_max_c and + le_str = sprintf "le = %d (le_hash = %d)\n" !le_c (len le_table) and + max_str = sprintf "max = %d (max_hash = %d)\n" !max_c (len max_table) and + mul_str = sprintf "mul_lo = %d, mul_hi = %d (mul_hash = %d)\n" !mul_lo_c !mul_hi_c (len mul_table) and + div_str = sprintf "div_lo = %d, div_hi = %d (div_hash = %d)\n" !div_lo_c !div_hi_c (len div_table) and + add_str = sprintf "add_lo = %d, add_hi = %d (add_hash = %d)\n" !add_lo_c !add_hi_c (len add_table) and + sub_str = sprintf "sub_lo = %d, sub_hi = %d (sub_hash = %d)\n" !sub_lo_c !sub_hi_c (len sub_table) and + sqrt_str = sprintf "sqrt_lo = %d, sqrt_hi = %d (sqrt_hash = %d)\n" !sqrt_lo_c !sqrt_hi_c (len sqrt_table) in + print_string (cmp_str1 ^ cmp_str2 ^ cmp_str3 ^ + le_str ^ max_str ^ mul_str ^ div_str ^ add_str ^ sub_str ^ sqrt_str);; + + +(* lt0 *) +let float_lt0 = + if !Arith_options.float_cached then + fun tm -> + let _ = lt0_c := !lt0_c + 1 in + Float_ops.float_lt0 tm + else + Float_ops.float_lt0;; + +(* gt0 *) +let float_gt0 = + if !Arith_options.float_cached then + fun tm -> + let _ = gt0_c := !gt0_c + 1 in + Float_ops.float_gt0 tm + else + Float_ops.float_gt0;; + +(* lt *) +let float_lt = + if !Arith_options.float_cached then + fun tm1 tm2 -> + let _ = lt_c := !lt_c + 1 in + Float_ops.float_lt tm1 tm2 + else + Float_ops.float_lt;; + +(* le0 *) +let float_le0 = + if !Arith_options.float_cached then + fun tm -> + let _ = le0_c := !le0_c + 1 in + Float_ops.float_le0 tm + else + Float_ops.float_le0;; + +(* ge0 *) +let float_ge0 = + if !Arith_options.float_cached then + fun tm -> + let _ = ge0_c := !ge0_c + 1 in + Float_ops.float_ge0 tm + else + Float_ops.float_ge0;; + +(* min *) +let float_min = + if !Arith_options.float_cached then + fun tm1 tm2 -> + let _ = min_c := !min_c + 1 in + Float_ops.float_min tm1 tm2 + else + Float_ops.float_min;; + +(* min_max *) +let float_min_max = + if !Arith_options.float_cached then + fun tm1 tm2 -> + let _ = min_max_c := !min_max_c + 1 in + Float_ops.float_min_max tm1 tm2 + else + Float_ops.float_min_max;; + + +(***************) +let float_hash tm = + let s, n_tm, e_tm = dest_float tm in + s ^ (Arith_cache.num_tm_hash n_tm) ^ "e" ^ (Arith_cache.num_tm_hash e_tm);; + +let float_op_hash pp tm1 tm2 = + string_of_int pp ^ float_hash tm1 ^ "x" ^ float_hash tm2;; + +let float_op_hash1 pp tm = + string_of_int pp ^ float_hash tm;; + + +(* le *) +let float_le = + if !Arith_options.float_cached then + fun tm1 tm2 -> + let _ = le_c := !le_c + 1 in + let hash = float_op_hash 0 tm1 tm2 in + try + Hashtbl.find le_table hash + with Not_found -> + let result = Float_ops.float_le tm1 tm2 in + let _ = my_add le_table hash result in + result + else + Float_ops.float_le;; + +(* max *) +let float_max = + if !Arith_options.float_cached then + fun tm1 tm2 -> + let _ = max_c := !max_c + 1 in + let hash = float_op_hash 0 tm1 tm2 in + try + Hashtbl.find max_table hash + with Not_found -> + let result = Float_ops.float_max tm1 tm2 in + let _ = my_add max_table hash result in + result + else + Float_ops.float_max;; + +(* mul_eq *) +let float_mul_eq = Float_ops.float_mul_eq;; + +(* mul_lo *) +let float_mul_lo = + if !Arith_options.float_cached then + fun pp tm1 tm2 -> + let _ = mul_lo_c := !mul_lo_c + 1 in + let hash = "lo" ^ float_op_hash pp tm1 tm2 in + try + Hashtbl.find mul_table hash + with Not_found -> + let result = Float_ops.float_mul_lo pp tm1 tm2 in + let _ = my_add mul_table hash result in + result + else + Float_ops.float_mul_lo;; + +(* mul_hi *) +let float_mul_hi = + if !Arith_options.float_cached then + fun pp tm1 tm2 -> + let _ = mul_hi_c := !mul_hi_c + 1 in + let hash = "hi" ^ float_op_hash pp tm1 tm2 in + try + Hashtbl.find mul_table hash + with Not_found -> + let result = Float_ops.float_mul_hi pp tm1 tm2 in + let _ = my_add mul_table hash result in + result + else + Float_ops.float_mul_hi;; + +(* div_lo *) +let float_div_lo = + if !Arith_options.float_cached then + fun pp tm1 tm2 -> + let _ = div_lo_c := !div_lo_c + 1 in + let hash = "lo" ^ float_op_hash pp tm1 tm2 in + try + Hashtbl.find div_table hash + with Not_found -> + let result = Float_ops.float_div_lo pp tm1 tm2 in + let _ = my_add div_table hash result in + result + else + Float_ops.float_div_lo;; + +(* div_hi *) +let float_div_hi = + if !Arith_options.float_cached then + fun pp tm1 tm2 -> + let _ = div_hi_c := !div_hi_c + 1 in + let hash = "hi" ^ float_op_hash pp tm1 tm2 in + try + Hashtbl.find div_table hash + with Not_found -> + let result = Float_ops.float_div_hi pp tm1 tm2 in + let _ = my_add div_table hash result in + result + else + Float_ops.float_div_hi;; + +(* add_lo *) +let float_add_lo = + if !Arith_options.float_cached then + fun pp tm1 tm2 -> + let _ = add_lo_c := !add_lo_c + 1 in + let hash = "lo" ^ float_op_hash pp tm1 tm2 in + try + Hashtbl.find add_table hash + with Not_found -> + let result = Float_ops.float_add_lo pp tm1 tm2 in + let _ = my_add add_table hash result in + result + else + Float_ops.float_add_lo;; + +(* add_hi *) +let float_add_hi = + if !Arith_options.float_cached then + fun pp tm1 tm2 -> + let _ = add_hi_c := !add_hi_c + 1 in + let hash = "hi" ^ float_op_hash pp tm1 tm2 in + try + Hashtbl.find add_table hash + with Not_found -> + let result = Float_ops.float_add_hi pp tm1 tm2 in + let _ = my_add add_table hash result in + result + else + Float_ops.float_add_hi;; + +(* sub_lo *) +let float_sub_lo = + if !Arith_options.float_cached then + fun pp tm1 tm2 -> + let _ = sub_lo_c := !sub_lo_c + 1 in + let hash = "lo" ^ float_op_hash pp tm1 tm2 in + try + Hashtbl.find sub_table hash + with Not_found -> + let result = Float_ops.float_sub_lo pp tm1 tm2 in + let _ = my_add sub_table hash result in + result + else + Float_ops.float_sub_lo;; + +(* sub_hi *) +let float_sub_hi = + if !Arith_options.float_cached then + fun pp tm1 tm2 -> + let _ = sub_hi_c := !sub_hi_c + 1 in + let hash = "hi" ^ float_op_hash pp tm1 tm2 in + try + Hashtbl.find sub_table hash + with Not_found -> + let result = Float_ops.float_sub_hi pp tm1 tm2 in + let _ = my_add sub_table hash result in + result + else + Float_ops.float_sub_hi;; + +(* sqrt_lo *) +let float_sqrt_lo = + if !Arith_options.float_cached then + fun pp tm -> + let _ = sqrt_lo_c := !sqrt_lo_c + 1 in + let hash = "lo" ^ float_op_hash1 pp tm in + try + Hashtbl.find sqrt_table hash + with Not_found -> + let result = Float_ops.float_sqrt_lo pp tm in + let _ = my_add sqrt_table hash result in + result + else + Float_ops.float_sqrt_lo;; + +(* sqrt_hi *) +let float_sqrt_hi = + if !Arith_options.float_cached then + fun pp tm -> + let _ = sqrt_hi_c := !sqrt_hi_c + 1 in + let hash = "hi" ^ float_op_hash1 pp tm in + try + Hashtbl.find sqrt_table hash + with Not_found -> + let result = Float_ops.float_sqrt_hi pp tm in + let _ = my_add sqrt_table hash result in + result + else + Float_ops.float_sqrt_hi;; + + +(******************************************) +(* float intervals *) + +let FLOAT_OF_NUM' = (SPEC_ALL o REWRITE_RULE[min_exp_def]) FLOAT_OF_NUM;; + +let FLOAT_INTERVAL_OF_NUM = (NUMERALS_TO_NUM o REWRITE_RULE[min_exp_def] o prove)(`interval_arith (&n) (float_num F n min_exp, float_num F n min_exp)`, + REWRITE_TAC[FLOAT_OF_NUM; CONST_INTERVAL]);; + +let FLOAT_F_bound' = (UNDISCH_ALL o SPEC_ALL) FLOAT_F_bound;; + +let FLOAT_T_bound' = (UNDISCH_ALL o SPEC_ALL) FLOAT_T_bound;; + +(* interval_arith x (float_num s1 n1 e1, float_num s2 n2 e2) -> x, float_num s1 n1 e1, float_num s2 n2 e2 *) +let dest_float_interval tm = + let ltm, rtm = dest_comb tm in + let f1, f2 = dest_pair rtm in + rand ltm, f1, f2;; + +let mk_float_interval_small_num n = + let n_tm0 = mk_small_numeral n in + let n_th = NUMERAL_TO_NUM_CONV n_tm0 in + let n_tm = rand(rand(concl n_th)) in + let n_th1 = TRANS n_th (INST[n_tm, n_var_num] NUM_REMOVE) in + let th1 = AP_TERM amp_op_real n_th1 in + let int_th = INST[n_tm, n_var_num] FLOAT_INTERVAL_OF_NUM in + let rtm = rand(concl int_th) in + EQ_MP (SYM (AP_THM (AP_TERM interval_const th1) rtm)) int_th;; + +let mk_float_interval_num n = + let n_tm0 = mk_numeral n in + let n_th = NUMERAL_TO_NUM_CONV n_tm0 in + let n_tm = rand(rand(concl n_th)) in + let n_th1 = TRANS n_th (INST[n_tm, n_var_num] NUM_REMOVE) in + let th1 = AP_TERM amp_op_real n_th1 in + let int_th = INST[n_tm, n_var_num] FLOAT_INTERVAL_OF_NUM in + let rtm = rand(concl int_th) in + EQ_MP (SYM (AP_THM (AP_TERM interval_const th1) rtm)) int_th;; + + +(* Returns the lower bound for the given float *) +let float_lo p tm = + let s, n_tm, e_tm = dest_float tm in + if s = "F" then + let num_exp_tm = mk_num_exp n_tm e_tm in + let th0 = num_exp_lo p num_exp_tm in + let ltm, e1_tm = dest_comb(lhand(concl th0)) in + let n1_tm = rand ltm in + let th1 = INST[n1_tm, n1_var_num; e1_tm, e1_var_num; n_tm, n2_var_num; e_tm, e2_var_num] FLOAT_F_bound' in + MY_PROVE_HYP th0 th1 + else + let num_exp_tm = mk_num_exp n_tm e_tm in + let th0 = num_exp_hi p num_exp_tm in + let ltm, e1_tm = dest_comb(rand(concl th0)) in + let n1_tm = rand ltm in + let th1 = INST[n_tm, n1_var_num; e_tm, e1_var_num; n1_tm, n2_var_num; e1_tm, e2_var_num] FLOAT_T_bound' in + MY_PROVE_HYP th0 th1;; + +(* Returns the upper bound for the given float *) +let float_hi p tm = + let s, n_tm, e_tm = dest_float tm in + if s = "F" then + let num_exp_tm = mk_num_exp n_tm e_tm in + let th0 = num_exp_hi p num_exp_tm in + let ltm, e2_tm = dest_comb(rand(concl th0)) in + let n2_tm = rand ltm in + let th1 = INST[n_tm, n1_var_num; e_tm, e1_var_num; n2_tm, n2_var_num; e2_tm, e2_var_num] FLOAT_F_bound' in + MY_PROVE_HYP th0 th1 + else + let num_exp_tm = mk_num_exp n_tm e_tm in + let th0 = num_exp_lo p num_exp_tm in + let ltm, e1_tm = dest_comb(lhand(concl th0)) in + let n1_tm = rand ltm in + let th1 = INST[n1_tm, n1_var_num; e1_tm, e1_var_num; n_tm, n2_var_num; e_tm, e2_var_num] FLOAT_T_bound' in + MY_PROVE_HYP th0 th1;; + + +(* Approximates the given interval with p-digits floating point numbers *) +let float_interval_round p th = + let x_tm, f1, f2 = dest_float_interval (concl th) in + let lo_th = float_lo p f1 in + let hi_th = float_hi p f2 in + let lo_tm = lhand(concl lo_th) in + let hi_tm = rand(concl hi_th) in + let th0 = INST[x_tm, x_var_real; f1, lo_var_real; f2, hi_var_real; lo_tm, a_var_real; hi_tm, b_var_real] APPROX_INTERVAL' in + MY_PROVE_HYP lo_th (MY_PROVE_HYP hi_th (MY_PROVE_HYP th th0));; + + +(****************************************) +(* float_interval_lt *) + +let FLOAT_INTERVAL_LT = prove(`interval_arith x (lo1, hi1) /\ interval_arith y (lo2, hi2) /\ hi1 < lo2 + ==> x < y`, + REWRITE_TAC[interval_arith] THEN + REAL_ARITH_TAC);; + + +(****************************************) +(* float_interval_neg *) + +let FLOAT_INTERVAL_NEG = prove(`!s1 s2. interval_arith x (float_num s1 n1 e1, float_num s2 n2 e2) + ==> interval_arith (--x) (float_num (~s2) n2 e2, float_num (~s1) n1 e1)`, + REPEAT GEN_TAC THEN + DISCH_THEN (fun th -> MP_TAC (MATCH_MP INTERVAL_NEG th)) THEN + SIMP_TAC[FLOAT_NEG]);; + +let FLOAT_INTERVAL_NEG_FF = (UNDISCH_ALL o REWRITE_RULE[] o SPECL[`F`; `F`]) FLOAT_INTERVAL_NEG;; +let FLOAT_INTERVAL_NEG_FT = (UNDISCH_ALL o REWRITE_RULE[] o SPECL[`F`; `T`]) FLOAT_INTERVAL_NEG;; +let FLOAT_INTERVAL_NEG_TF = (UNDISCH_ALL o REWRITE_RULE[] o SPECL[`T`; `F`]) FLOAT_INTERVAL_NEG;; +let FLOAT_INTERVAL_NEG_TT = (UNDISCH_ALL o REWRITE_RULE[] o SPECL[`T`; `T`]) FLOAT_INTERVAL_NEG;; + +(* |- interval x (float s1 n1 e1, float s2 n2 e2) -> + |- interval (--x) (float ~s2 n2 e2, float ~s1 n1 e1 *) +let float_interval_neg th = + let x_tm, f1, f2 = dest_float_interval (concl th) in + let s1, n1_tm, e1_tm = dest_float f1 in + let s2, n2_tm, e2_tm = dest_float f2 in + let inst = INST[x_tm, x_var_real; n1_tm, n1_var_num; e1_tm, e1_var_num; + n2_tm, n2_var_num; e2_tm, e2_var_num] in + let th0 = + if s1 = "F" then + if s2 = "F" then + inst FLOAT_INTERVAL_NEG_FF + else + inst FLOAT_INTERVAL_NEG_FT + else + if s2 = "F" then + inst FLOAT_INTERVAL_NEG_TF + else + inst FLOAT_INTERVAL_NEG_TT in + MY_PROVE_HYP th th0;; + + +(***********************************************) +(* float_interval_mul *) + +let f1_1_var = `f1_1:real` and + f1_2_var = `f1_2:real` and + f2_1_var = `f2_1:real` and + f2_2_var = `f2_2:real`;; + + +let FLOAT_INTERVAL_FT_IMP_0 = prove(`interval_arith x (float_num F n1 e1, float_num T n2 e2) ==> x = &0`, + REWRITE_TAC[interval_arith] THEN STRIP_TAC THEN + REWRITE_TAC[GSYM REAL_LE_ANTISYM] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THENL [ + EXISTS_TAC `float_num T n2 e2` THEN ASM_REWRITE_TAC[FLOAT_T_NEG]; + EXISTS_TAC `float_num F n1 e1` THEN ASM_REWRITE_TAC[FLOAT_F_POS] + ]);; + +(* FT_xx *) +let FLOAT_INTERVAL_MUL_FT_xx = (UNDISCH_ALL o NUMERALS_TO_NUM o REWRITE_RULE[GSYM IMP_IMP; min_exp_def] o prove)( + `interval_arith x (float_num F n1 e1, float_num T n2 e2) + ==> interval_arith (x * y) (float_num F 0 min_exp, float_num F 0 min_exp)`, + STRIP_TAC THEN + FIRST_X_ASSUM (fun th -> REWRITE_TAC[MATCH_MP FLOAT_INTERVAL_FT_IMP_0 th]) THEN + REWRITE_TAC[REAL_MUL_LZERO; interval_arith] THEN + MP_TAC (GEN_ALL (SPECL [`s:bool`; `0`] FLOAT_EQ_0)) THEN SIMP_TAC[REAL_LE_REFL]);; + + +(* xx_FT *) +let FLOAT_INTERVAL_MUL_xx_FT = (UNDISCH_ALL o NUMERALS_TO_NUM o REWRITE_RULE[GSYM IMP_IMP; min_exp_def] o prove)( + `interval_arith y (float_num F m1 r1, float_num T m2 r2) + ==> interval_arith (x * y) (float_num F 0 min_exp, float_num F 0 min_exp)`, + STRIP_TAC THEN + FIRST_X_ASSUM (fun th -> REWRITE_TAC[MATCH_MP FLOAT_INTERVAL_FT_IMP_0 th]) THEN + REWRITE_TAC[REAL_MUL_RZERO; interval_arith] THEN + MP_TAC (GEN_ALL (SPECL [`s:bool`; `0`] FLOAT_EQ_0)) THEN SIMP_TAC[REAL_LE_REFL]);; + + + +(* FF_FF *) +let FLOAT_INTERVAL_MUL_FF_FF = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (float_num F n1 e1, float_num F n2 e2) /\ + interval_arith y (float_num F m1 r1, float_num F m2 r2) /\ + f1 <= float_num F n1 e1 * float_num F m1 r1 /\ + float_num F n2 e2 * float_num F m2 r2 <= f2 + ==> interval_arith (x * y) (f1, f2)`, + MAP_EVERY ABBREV_TAC [`a = float_num F n1 e1`; `b = float_num F n2 e2`; `c = float_num F m1 r1`; `d = float_num F m2 r2`] THEN + SUBGOAL_THEN `&0 <= a /\ &0 <= b /\ &0 <= c /\ &0 <= d` MP_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["a"; "b"; "c"; "d"] THEN + REWRITE_TAC[FLOAT_F_POS]; + ALL_TAC + ] THEN + REPEAT (POP_ASSUM (fun th -> ALL_TAC)) THEN + REWRITE_TAC[interval_arith] THEN + REPEAT STRIP_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a * c:real` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `b * d:real` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THENL + [ + EXISTS_TAC `a:real` THEN ASM_REWRITE_TAC[]; + EXISTS_TAC `c:real` THEN ASM_REWRITE_TAC[] + ] + ]);; + +(* TT_TT *) +let FLOAT_INTERVAL_MUL_TT_TT = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (float_num T n1 e1, float_num T n2 e2) /\ + interval_arith y (float_num T m1 r1, float_num T m2 r2) /\ + f1 <= float_num T n2 e2 * float_num T m2 r2 /\ + float_num T n1 e1 * float_num T m1 r1 <= f2 + ==> interval_arith (x * y) (f1, f2)`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[interval_arith] THEN + MAP_EVERY ABBREV_TAC [`a = float_num F n1 e1`; `b = float_num F n2 e2`; `c = float_num F m1 r1`; `d = float_num F m2 r2`] THEN + SUBGOAL_THEN `&0 <= a /\ &0 <= b /\ &0 <= c /\ &0 <= d` MP_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["a"; "b"; "c"; "d"] THEN + REWRITE_TAC[FLOAT_F_POS]; + ALL_TAC + ] THEN + REWRITE_TAC[REAL_NEG_MUL2] THEN + REPEAT STRIP_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `b * d:real` THEN + ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[REAL_ARITH `a <= x * y <=> a <= --x * --y`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ONCE_REWRITE_TAC[REAL_ARITH `b <= --x <=> x <= --b`] THEN + ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a * c:real` THEN + ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[REAL_ARITH `x * y <= a <=> --x * --y <= a`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ONCE_REWRITE_TAC[REAL_ARITH `--x <= c <=> --c <= x`] THEN + ASM_REWRITE_TAC[] THEN + ASSUME_TAC (REAL_ARITH `!b x. &0 <= b /\ x <= --b ==> &0 <= --x`) THEN + CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THENL + [ + EXISTS_TAC `b:real` THEN ASM_REWRITE_TAC[]; + EXISTS_TAC `d:real` THEN ASM_REWRITE_TAC[] + ] + ]);; + +(* FF_TT *) +let FLOAT_INTERVAL_MUL_FF_TT = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (float_num F n1 e1, float_num F n2 e2) /\ + interval_arith y (float_num T m1 r1, float_num T m2 r2) /\ + f1 <= float_num F n2 e2 * float_num T m1 r1 /\ + float_num F n1 e1 * float_num T m2 r2 <= f2 + ==> interval_arith (x * y) (f1, f2)`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[interval_arith] THEN + MAP_EVERY ABBREV_TAC [`a = float_num F n1 e1`; `b = float_num F n2 e2`; `c = float_num F m1 r1`; `d = float_num F m2 r2`] THEN + SUBGOAL_THEN `&0 <= a /\ &0 <= b /\ &0 <= c /\ &0 <= d` MP_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["a"; "b"; "c"; "d"] THEN + REWRITE_TAC[FLOAT_F_POS]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `b * --c` THEN + ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[REAL_ARITH `b * --c <= x * y <=> x * --y <= b * c`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ONCE_REWRITE_TAC[REAL_ARITH `--y <= c <=> --c <= y`] THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THENL + [ + EXISTS_TAC `a:real` THEN ASM_REWRITE_TAC[]; + EXISTS_TAC `d:real` THEN + ONCE_REWRITE_TAC[REAL_ARITH `d <= --y <=> y <= --d`] THEN + ASM_REWRITE_TAC[] + ]; + + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a * --d` THEN + ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[REAL_ARITH `x * y <= a * --d <=> a * d <= x * --y`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ONCE_REWRITE_TAC[REAL_ARITH `d <= --y <=> y <= --d`] THEN + ASM_REWRITE_TAC[] + ]);; + +(* TT_FF *) +let FLOAT_INTERVAL_MUL_TT_FF = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (float_num T n1 e1, float_num T n2 e2) /\ + interval_arith y (float_num F m1 r1, float_num F m2 r2) /\ + f1 <= float_num T n1 e1 * float_num F m2 r2 /\ + float_num T n2 e2 * float_num F m1 r1 <= f2 + ==> interval_arith (x * y) (f1, f2)`, + STRIP_TAC THEN + MP_TAC ((GEN_ALL o DISCH_ALL) FLOAT_INTERVAL_MUL_FF_TT) THEN + DISCH_THEN (MP_TAC o SPECL[`n1:num`; `e1:num`; `n2:num`; `e2:num`; `m1:num`; `r1:num`; `m2:num`; `r2:num`]) THEN + DISCH_THEN (MP_TAC o SPECL[`y:real`; `x:real`; `f1:real`; `f2:real`]) THEN + REPEAT (POP_ASSUM MP_TAC) THEN + SIMP_TAC[REAL_MUL_AC]);; + +(* TF_FF *) +let FLOAT_INTERVAL_MUL_TF_FF = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (float_num T n1 e1, float_num F n2 e2) /\ + interval_arith y (float_num F m1 r1, float_num F m2 r2) /\ + f1 <= float_num T n1 e1 * float_num F m2 r2 /\ + float_num F n2 e2 * float_num F m2 r2 <= f2 + ==> interval_arith (x * y) (f1, f2)`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[interval_arith] THEN + MAP_EVERY ABBREV_TAC [`a = float_num F n1 e1`; `b = float_num F n2 e2`; `c = float_num F m1 r1`; `d = float_num F m2 r2`] THEN + STRIP_TAC THEN + SUBGOAL_THEN `&0 <= a /\ &0 <= b /\ &0 <= c /\ &0 <= d` ASSUME_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["a"; "b"; "c"; "d"] THEN + REWRITE_TAC[FLOAT_F_POS]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `&0 <= y` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `c:real` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + DISJ_CASES_TAC (REAL_ARITH `&0 <= x \/ &0 <= --x`) THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `--a * d` THEN + ASM_REWRITE_TAC[REAL_ARITH `--a * d <= &0 <=> &0 <= a * d`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[] + ]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `--a * d` THEN ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[REAL_ARITH `--a * d <= x * y <=> --x * y <= a * d`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ONCE_REWRITE_TAC[REAL_ARITH `--x <= a <=> --a <= x`] THEN ASM_REWRITE_TAC[]; + + DISJ_CASES_TAC (REAL_ARITH `&0 <= --x \/ &0 <= x`) THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + CONJ_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `x * y <= &0 <=> &0 <= --x * y`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b * d` THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[] + ]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b * d` THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN ASM_REWRITE_TAC[] + ]);; + +(* TF_TT *) +let FLOAT_INTERVAL_MUL_TF_TT = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (float_num T n1 e1, float_num F n2 e2) /\ + interval_arith y (float_num T m1 r1, float_num T m2 r2) /\ + f1 <= float_num F n2 e2 * float_num T m1 r1 /\ + float_num T n1 e1 * float_num T m1 r1 <= f2 + ==> interval_arith (x * y) (f1, f2)`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[interval_arith] THEN + MAP_EVERY ABBREV_TAC [`a = float_num F n1 e1`; `b = float_num F n2 e2`; `c = float_num F m1 r1`; `d = float_num F m2 r2`] THEN + STRIP_TAC THEN + SUBGOAL_THEN `&0 <= a /\ &0 <= b /\ &0 <= c /\ &0 <= d` ASSUME_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["a"; "b"; "c"; "d"] THEN + REWRITE_TAC[FLOAT_F_POS]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `&0 <= --y` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `d:real` THEN + ONCE_REWRITE_TAC[REAL_ARITH `d <= --y <=> y <= --d`] THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + DISJ_CASES_TAC (REAL_ARITH `&0 <= --x \/ &0 <= x`) THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b * --c` THEN + ASM_REWRITE_TAC[REAL_ARITH `b * --c <= &0 <=> &0 <= b * c`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[REAL_ARITH `x * y = --x * --y`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[] + ]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b * --c` THEN ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[REAL_ARITH `b * --c <= x * y <=> x * --y <= b * c`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN ONCE_REWRITE_TAC[REAL_ARITH `--y <= c <=> --c <= y`] THEN + ASM_REWRITE_TAC[]; + + DISJ_CASES_TAC (REAL_ARITH `&0 <= x \/ &0 <= --x`) THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + CONJ_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `x * y <= &0 <=> &0 <= x * --y`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `--a * --c` THEN ASM_REWRITE_TAC[REAL_NEG_MUL2] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[] + ]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `--a * --c` THEN ASM_REWRITE_TAC[REAL_NEG_MUL2] THEN + ONCE_REWRITE_TAC[REAL_ARITH `x * y <= a * c <=> --x * --y <= a * c`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN ONCE_REWRITE_TAC[REAL_ARITH `--x <= a <=> --a <= x`] THEN + ASM_REWRITE_TAC[] + ]);; + +(* FF_TF *) +let FLOAT_INTERVAL_MUL_FF_TF = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (float_num F n1 e1, float_num F n2 e2) /\ + interval_arith y (float_num T m1 r1, float_num F m2 r2) /\ + f1 <= float_num F n2 e2 * float_num T m1 r1 /\ + float_num F n2 e2 * float_num F m2 r2 <= f2 + ==> interval_arith (x * y) (f1, f2)`, + STRIP_TAC THEN + MP_TAC ((SPECL [`n1:num`; `e1:num`; `n2:num`; `e2:num`; `m1:num`; `r1:num`; `m2:num`; `r2:num`; `y:real`; `x:real`; `f1:real`; `f2:real`] o GEN_ALL o DISCH_ALL) FLOAT_INTERVAL_MUL_TF_FF) THEN + ASM_REWRITE_TAC[REAL_MUL_SYM] THEN DISCH_THEN MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC);; + +(* TT_TF *) +let FLOAT_INTERVAL_MUL_TT_TF = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (float_num T n1 e1, float_num T n2 e2) /\ + interval_arith y (float_num T m1 r1, float_num F m2 r2) /\ + f1 <= float_num T n1 e1 * float_num F m2 r2 /\ + float_num T n1 e1 * float_num T m1 r1 <= f2 + ==> interval_arith (x * y) (f1, f2)`, + STRIP_TAC THEN + MP_TAC ((SPECL [`n1:num`; `e1:num`; `n2:num`; `e2:num`; `m1:num`; `r1:num`; `m2:num`; `r2:num`; `y:real`; `x:real`; `f1:real`; `f2:real`] o GEN_ALL o DISCH_ALL) FLOAT_INTERVAL_MUL_TF_TT) THEN + ASM_REWRITE_TAC[REAL_MUL_SYM] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[REAL_MUL_SYM]);; + +(* TF_TF *) +let FLOAT_INTERVAL_MUL_TF_TF = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (float_num T n1 e1, float_num F n2 e2) /\ + interval_arith y (float_num T m1 r1, float_num F m2 r2) /\ + f1_1 <= float_num T n1 e1 * float_num F m2 r2 /\ + f1_2 <= float_num F n2 e2 * float_num T m1 r1 /\ + min f1_1 f1_2 = f1 /\ + float_num T n1 e1 * float_num T m1 r1 <= f2_1 /\ + float_num F n2 e2 * float_num F m2 r2 <= f2_2 /\ + max f2_1 f2_2 = f2 + ==> interval_arith (x * y) (f1, f2)`, + REWRITE_TAC[EQ_SYM_EQ; FLOAT_NEG_T] THEN + REWRITE_TAC[interval_arith] THEN + MAP_EVERY ABBREV_TAC [`a = float_num F n1 e1`; `b = float_num F n2 e2`; `c = float_num F m1 r1`; `d = float_num F m2 r2`] THEN + STRIP_TAC THEN + SUBGOAL_THEN `&0 <= a /\ &0 <= b /\ &0 <= c /\ &0 <= d` ASSUME_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["a"; "b"; "c"; "d"] THEN + REWRITE_TAC[FLOAT_F_POS]; + ALL_TAC + ] THEN + + DISJ_CASES_TAC (REAL_ARITH `&0 <= x \/ &0 <= --x`) THENL + [ + DISJ_CASES_TAC (REAL_ARITH `&0 <= y \/ &0 <= --y`) THENL + [ + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `f1_1:real` THEN + ASM_REWRITE_TAC[REAL_MIN_MIN] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `--a * d` THEN + ASM_REWRITE_TAC[REAL_ARITH `--a * d <= &0 <=> &0 <= a * d`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b * d` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_MUL2 THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `f2_2:real` THEN + ASM_REWRITE_TAC[REAL_MAX_MAX]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `f1_2:real` THEN + ASM_REWRITE_TAC[REAL_MIN_MIN] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b * --c` THEN + ONCE_REWRITE_TAC[REAL_ARITH `b * --c <= x * y <=> x * --y <= b * c`] THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN ONCE_REWRITE_TAC[REAL_ARITH `--y <= c <=> --c <= y`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + CONJ_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `x * y <= &0 <=> &0 <= x * --y`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `f2_2:real` THEN + ASM_REWRITE_TAC[REAL_MAX_MAX] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b * d` THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISJ_CASES_TAC (REAL_ARITH `&0 <= y \/ &0 <= --y`) THENL + [ + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `f1_1:real` THEN + ASM_REWRITE_TAC[REAL_MIN_MIN] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `--a * d` THEN + ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[REAL_ARITH `--a * d <= x * y <=> --x * y <= a * d`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN ONCE_REWRITE_TAC[REAL_ARITH `--x <= a <=> --a <= x`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + CONJ_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `x * y <= &0 <=> &0 <= --x * y`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `f2_2:real` THEN + ASM_REWRITE_TAC[REAL_MAX_MAX] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b * d` THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `f1_1:real` THEN + ASM_REWRITE_TAC[REAL_MIN_MIN] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `--a * d` THEN + ASM_REWRITE_TAC[REAL_ARITH `--a * d <= &0 <=> &0 <= a * d`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ONCE_REWRITE_TAC[GSYM REAL_NEG_MUL2] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `--a * --c` THEN + CONJ_TAC THENL + [ + ONCE_REWRITE_TAC[GSYM REAL_NEG_MUL2] THEN REWRITE_TAC[REAL_NEG_NEG] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN ONCE_REWRITE_TAC[REAL_ARITH `--x <= a <=> --a <= x`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `f2_1:real` THEN + ASM_REWRITE_TAC[REAL_MAX_MAX]);; + + +(****************************) +let float_interval_mul = + let mul_ft_xx th1 x y n1 e1 n2 e2 = + let th0 = INST[x, x_var_real; y, y_var_real; + n1, n1_var_num; e1, e1_var_num; + n2, n2_var_num; e2, e2_var_num] FLOAT_INTERVAL_MUL_FT_xx in + MY_PROVE_HYP th1 th0 in + let mul_xx_ft th2 x y m1 r1 m2 r2 = + let th0 = INST[x, x_var_real; y, y_var_real; + m1, m1_var_num; r1, r1_var_num; + m2, m2_var_num; r2, r2_var_num] FLOAT_INTERVAL_MUL_xx_FT in + MY_PROVE_HYP th2 th0 in + + fun pp th1 th2 -> + let x, l_lo, l_hi = dest_float_interval (concl th1) and + y, r_lo, r_hi = dest_float_interval (concl th2) in + let s1, n1, e1 = dest_float l_lo and + s2, n2, e2 = dest_float l_hi and + s3, m1, r1 = dest_float r_lo and + s4, m2, r2 = dest_float r_hi in + + (* Special case 1 *) + if s1 <> s2 && s1 = "F" then + mul_ft_xx th1 x y n1 e1 n2 e2 + else if s3 <> s4 && s3 = "F" then + mul_xx_ft th2 x y m1 r1 m2 r2 + else + (* Special case 2 *) + if s1 <> s2 && s3 <> s4 then + let lo1, lo2 = float_mul_lo pp l_lo r_hi, float_mul_lo pp l_hi r_lo and + hi1, hi2 = float_mul_hi pp l_lo r_lo, float_mul_hi pp l_hi r_hi in + let f1_1 = (lhand o concl) lo1 and + f1_2 = (lhand o concl) lo2 and + f2_1 = (rand o concl) hi1 and + f2_2 = (rand o concl) hi2 in + let min_th = float_min f1_1 f1_2 and + max_th = float_max f2_1 f2_2 in + let f1_tm = (rand o concl) min_th and + f2_tm = (rand o concl) max_th in + let th0 = INST[x, x_var_real; n1, n1_var_num; e1, e1_var_num; + y, y_var_real; n2, n2_var_num; e2, e2_var_num; + m1, m1_var_num; r1, r1_var_num; + m2, m2_var_num; r2, r2_var_num; + f1_tm, f1_var_real; f2_tm, f2_var_real; + f1_1, f1_1_var; f1_2, f1_2_var; + f2_1, f2_1_var; f2_2, f2_2_var] FLOAT_INTERVAL_MUL_TF_TF in + (MY_PROVE_HYP min_th o MY_PROVE_HYP max_th o MY_PROVE_HYP lo1 o MY_PROVE_HYP lo2 o + MY_PROVE_HYP hi1 o MY_PROVE_HYP hi2 o MY_PROVE_HYP th1 o MY_PROVE_HYP th2) th0 + else + let lo_th, hi_th, th0 = + if s1 <> s2 then + if s3 = "F" then + float_mul_lo pp l_lo r_hi, float_mul_hi pp l_hi r_hi, FLOAT_INTERVAL_MUL_TF_FF + else + float_mul_lo pp l_hi r_lo, float_mul_hi pp l_lo r_lo, FLOAT_INTERVAL_MUL_TF_TT + else + if s3 <> s4 then + if s1 = "F" then + float_mul_lo pp l_hi r_lo, float_mul_hi pp l_hi r_hi, FLOAT_INTERVAL_MUL_FF_TF + else + float_mul_lo pp l_lo r_hi, float_mul_hi pp l_lo r_lo, FLOAT_INTERVAL_MUL_TT_TF + else + if s1 = "F" then + if s3 = "F" then + float_mul_lo pp l_lo r_lo, float_mul_hi pp l_hi r_hi, FLOAT_INTERVAL_MUL_FF_FF + else + float_mul_lo pp l_hi r_lo, float_mul_hi pp l_lo r_hi, FLOAT_INTERVAL_MUL_FF_TT + else + if s3 = "F" then + float_mul_lo pp l_lo r_hi, float_mul_hi pp l_hi r_lo, FLOAT_INTERVAL_MUL_TT_FF + else + float_mul_lo pp l_hi r_hi, float_mul_hi pp l_lo r_lo, FLOAT_INTERVAL_MUL_TT_TT in + + let f1_tm = lhand(concl lo_th) and + f2_tm = rand(concl hi_th) in + + let th = INST[x, x_var_real; n1, n1_var_num; e1, e1_var_num; + y, y_var_real; n2, n2_var_num; e2, e2_var_num; + m1, m1_var_num; r1, r1_var_num; + m2, m2_var_num; r2, r2_var_num; + f1_tm, f1_var_real; f2_tm, f2_var_real] th0 in + MY_PROVE_HYP lo_th (MY_PROVE_HYP hi_th (MY_PROVE_HYP th1 (MY_PROVE_HYP th2 th)));; + + +(*************************************) +(* float_interval_div *) + +(* FT_xx *) +let FLOAT_INTERVAL_DIV_FT_xx = prove( + `interval_arith x (float_num F n1 e1, float_num T n2 e2) + ==> interval_arith (x / y) (float_num F 0 min_exp, float_num F 0 min_exp)`, + REWRITE_TAC[real_div] THEN DISCH_THEN (MP_TAC o MATCH_MP FLOAT_INTERVAL_FT_IMP_0) THEN + SIMP_TAC[REAL_MUL_LZERO; interval_arith] THEN + MP_TAC (GEN_ALL (SPECL [`s:bool`; `0`] FLOAT_EQ_0)) THEN SIMP_TAC[REAL_LE_REFL]);; + +(* FF_FF *) +let FLOAT_INTERVAL_DIV_FF_FF = prove( + `~(m1 = 0) /\ + interval_arith x (float_num F n1 e1, float_num F n2 e2) /\ + interval_arith y (float_num F m1 r1, float_num F m2 r2) /\ + f1 <= float_num F n1 e1 / float_num F m2 r2 /\ + float_num F n2 e2 / float_num F m1 r1 <= f2 + ==> interval_arith (x / y) (f1, f2)`, + MAP_EVERY ABBREV_TAC [`a = float_num F n1 e1`; `b = float_num F n2 e2`; `c = float_num F m1 r1`; `d = float_num F m2 r2`] THEN + REWRITE_TAC[real_div] THEN + STRIP_TAC THEN + SUBGOAL_THEN `&0 <= a /\ &0 <= b /\ &0 <= c /\ &0 <= d` MP_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["a"; "b"; "c"; "d"] THEN + REWRITE_TAC[FLOAT_F_POS]; + ALL_TAC + ] THEN + SUBGOAL_THEN `~(c = &0)` ASSUME_TAC THENL + [ + EXPAND_TAC "c" THEN ASM_REWRITE_TAC[FLOAT_EQ_0]; + ALL_TAC + ] THEN + STRIP_TAC THEN + SUBGOAL_THEN `~(d = &0)` MP_TAC THENL + [ + MATCH_MP_TAC (REAL_ARITH `~(c = &0) /\ &0 <= c /\ c <= d ==> ~(d = &0)`) THEN + ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `interval_arith y (c,d)` THEN + REWRITE_TAC[interval_arith] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + REPLICATE_TAC 10 (POP_ASSUM MP_TAC) THEN + REPEAT (POP_ASSUM (fun th -> ALL_TAC)) THEN + REWRITE_TAC[interval_arith] THEN + REPEAT STRIP_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a * inv d` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[REAL_LE_INV_EQ] THEN + MATCH_MP_TAC REAL_LE_INV2 THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LTE_TRANS THEN + EXISTS_TAC `c:real` THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < c <=> ~(c = &0) /\ &0 <= c`]; + + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `b * inv c` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[REAL_LE_INV_EQ] THEN + REPEAT CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a:real` THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `c:real` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_INV2 THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < c <=> ~(c = &0) /\ &0 <= c`] + ]);; + +(* TT_TT *) +let FLOAT_INTERVAL_DIV_TT_TT = prove( + `~(m2 = 0) /\ + interval_arith x (float_num T n1 e1, float_num T n2 e2) /\ + interval_arith y (float_num T m1 r1, float_num T m2 r2) /\ + f1 <= float_num T n2 e2 / float_num T m1 r1 /\ + float_num T n1 e1 / float_num T m2 r2 <= f2 + ==> interval_arith (x / y) (f1,f2)`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[real_div; REAL_INV_NEG; REAL_NEG_MUL2] THEN + GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV)[interval_arith] THEN + REWRITE_TAC[REAL_ARITH `--a <= x /\ x <= --b <=> b <= --x /\ --x <= a`] THEN + GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV)[GSYM interval_arith] THEN + STRIP_TAC THEN + MP_TAC ((SPECL[`n2:num`; `e2:num`; `m1:num`; `r1:num`; `n1:num`; `e1:num`; `m2:num`; `r2:num`; `--x`; `--y`] o GEN_ALL) FLOAT_INTERVAL_DIV_FF_FF) THEN + REWRITE_TAC[real_div; REAL_INV_NEG; REAL_NEG_MUL2] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]);; + +(* FF_TT *) +let FLOAT_INTERVAL_DIV_FF_TT = prove( + `~(m2 = 0) /\ + interval_arith x (float_num F n1 e1, float_num F n2 e2) /\ + interval_arith y (float_num T m1 r1, float_num T m2 r2) /\ + f1 <= float_num F n2 e2 / float_num T m2 r2 /\ + float_num F n1 e1 / float_num T m1 r1 <= f2 + ==> interval_arith (x / y) (f1,f2)`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[real_div; REAL_INV_NEG] THEN + REWRITE_TAC[REAL_ARITH `a * --b <= c <=> --c <= a * b`] THEN + REWRITE_TAC[REAL_ARITH `c <= a * --b <=> a * b <= --c`] THEN + GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV)[interval_arith] THEN + REWRITE_TAC[REAL_ARITH `--a <= x /\ x <= --b <=> b <= --x /\ --x <= a`] THEN + GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV)[GSYM interval_arith] THEN + STRIP_TAC THEN + MP_TAC ((SPECL[`n1:num`; `e1:num`; `m1:num`; `r1:num`; `n2:num`; `e2:num`; `m2:num`; `r2:num`; `x:real`; `--y`; `--f2`; `--f1`] o GEN_ALL) FLOAT_INTERVAL_DIV_FF_FF) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[real_div]; + ALL_TAC + ] THEN + REWRITE_TAC[real_div; REAL_INV_NEG; interval_arith] THEN + REAL_ARITH_TAC);; + +(* TT_FF *) +let FLOAT_INTERVAL_DIV_TT_FF = prove( + `~(m1 = 0) /\ + interval_arith x (float_num T n1 e1, float_num T n2 e2) /\ + interval_arith y (float_num F m1 r1, float_num F m2 r2) /\ + f1 <= float_num T n1 e1 / float_num F m1 r1 /\ + float_num T n2 e2 / float_num F m2 r2 <= f2 + ==> interval_arith (x / y) (f1,f2)`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[real_div; REAL_INV_NEG] THEN + REWRITE_TAC[REAL_ARITH `--a * b <= c <=> --c <= a * b`] THEN + REWRITE_TAC[REAL_ARITH `c <= --a * b <=> a * b <= --c`] THEN + GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV)[interval_arith] THEN + REWRITE_TAC[REAL_ARITH `--a <= x /\ x <= --b <=> b <= --x /\ --x <= a`] THEN + GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV)[GSYM interval_arith] THEN + STRIP_TAC THEN + MP_TAC ((SPECL[`n2:num`; `e2:num`; `m2:num`; `r2:num`; `n1:num`; `e1:num`; `m1:num`; `r1:num`; `--x:real`; `y:real`; `--f2`; `--f1`] o GEN_ALL) FLOAT_INTERVAL_DIV_FF_FF) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[real_div]; + ALL_TAC + ] THEN + REWRITE_TAC[real_div; REAL_INV_NEG; interval_arith] THEN + REAL_ARITH_TAC);; + +let FLOAT_0 = prove(`!s e. float_num s 0 e = &0`, REWRITE_TAC[FLOAT_EQ_0]);; + +(* TF_FF *) +let FLOAT_INTERVAL_DIV_TF_FF = prove( + `~(m1 = 0) /\ + interval_arith x (float_num T n1 e1, float_num F n2 e2) /\ + interval_arith y (float_num F m1 r1, float_num F m2 r2) /\ + f1 <= float_num T n1 e1 / float_num F m1 r1 /\ + float_num F n2 e2 / float_num F m1 r1 <= f2 + ==> interval_arith (x / y) (f1,f2)`, + REWRITE_TAC[FLOAT_NEG_T] THEN STRIP_TAC THEN + MAP_EVERY ABBREV_TAC [`a = float_num F n1 e1`; `b = float_num F n2 e2`; `c = float_num F m1 r1`; `d = float_num F m2 r2`] THEN + SUBGOAL_THEN `&0 <= a /\ &0 <= b /\ &0 <= c /\ &0 <= d` ASSUME_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["a"; "b"; "c"; "d"] THEN REWRITE_TAC[FLOAT_F_POS]; + ALL_TAC + ] THEN + + DISJ_CASES_TAC (REAL_ARITH `&0 <= x \/ x <= &0`) THENL + [ + SUBGOAL_THEN `interval_arith x (float_num F 0 0, b)` ASSUME_TAC THENL + [ + UNDISCH_TAC `interval_arith x (--a, b)` THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[interval_arith; FLOAT_0] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + MP_TAC ((SPEC_ALL o SPECL [`0`; `0`] o GEN_ALL) FLOAT_INTERVAL_DIV_FF_FF) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN MATCH_MP_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + REWRITE_TAC[real_div] THEN CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `--a / c` THEN + ASM_REWRITE_TAC[real_div; ARITH_RULE `--a * b <= &0 <=> &0 <= a * b`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[REAL_LE_INV_EQ]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[REAL_LE_INV_EQ; FLOAT_F_POS]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `interval_arith x (--a, float_num T 0 0)` ASSUME_TAC THENL + [ + UNDISCH_TAC `interval_arith x (--a, b)` THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[interval_arith; FLOAT_0] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + MP_TAC ((INST[`0`, `n2:num`; `0`, `e2:num`]) FLOAT_INTERVAL_DIV_TT_FF) THEN + ASM_REWRITE_TAC[FLOAT_NEG_T] THEN DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[GSYM FLOAT_NEG_T] THEN MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + REWRITE_TAC[real_div] THEN CONJ_TAC THENL + [ + REWRITE_TAC[FLOAT_0; REAL_MUL_LZERO; REAL_LE_REFL]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b / c` THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_DIV THEN ASM_REWRITE_TAC[]);; + +(* TF_TT *) +let FLOAT_INTERVAL_DIV_TF_TT = prove( + `~(m2 = 0) /\ + interval_arith x (float_num T n1 e1, float_num F n2 e2) /\ + interval_arith y (float_num T m1 r1, float_num T m2 r2) /\ + f1 <= float_num F n2 e2 / float_num T m2 r2 /\ + float_num T n1 e1 / float_num T m2 r2 <= f2 + ==> interval_arith (x / y) (f1,f2)`, + REWRITE_TAC[FLOAT_NEG_T] THEN STRIP_TAC THEN + MAP_EVERY ABBREV_TAC [`a = float_num F n1 e1`; `b = float_num F n2 e2`; `c = float_num F m1 r1`; `d = float_num F m2 r2`] THEN + SUBGOAL_THEN `&0 <= a /\ &0 <= b /\ &0 <= c /\ &0 <= d` ASSUME_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["a"; "b"; "c"; "d"] THEN REWRITE_TAC[FLOAT_F_POS]; + ALL_TAC + ] THEN + + DISJ_CASES_TAC (REAL_ARITH `x <= &0 \/ &0 <= x`) THENL + [ + SUBGOAL_THEN `interval_arith x (--a, float_num T 0 0)` ASSUME_TAC THENL + [ + UNDISCH_TAC `interval_arith x (--a, b)` THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[interval_arith; FLOAT_0] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + MP_TAC ((SPEC_ALL o SPECL [`0`; `0`] o GEN_ALL) FLOAT_INTERVAL_DIV_TT_TT) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN MATCH_MP_TAC THEN ASM_REWRITE_TAC[FLOAT_NEG_T] THEN + ASM_REWRITE_TAC[GSYM FLOAT_NEG_T] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + REWRITE_TAC[real_div] THEN CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b / --d` THEN + ASM_REWRITE_TAC[real_div; REAL_INV_NEG; REAL_ARITH `b * --d <= &0 <=> &0 <= b * d`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[REAL_LE_INV_EQ]; + ALL_TAC + ] THEN + + REWRITE_TAC[FLOAT_0; REAL_MUL_LZERO; REAL_LE_REFL]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `interval_arith x (float_num F 0 0, b)` ASSUME_TAC THENL + [ + UNDISCH_TAC `interval_arith x (--a, b)` THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[interval_arith; FLOAT_0] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + MP_TAC ((INST[`0`, `n1:num`; `0`, `e1:num`]) FLOAT_INTERVAL_DIV_FF_TT) THEN + ASM_REWRITE_TAC[FLOAT_NEG_T] THEN DISCH_THEN MATCH_MP_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + REWRITE_TAC[real_div] THEN CONJ_TAC THENL + [ + REWRITE_TAC[FLOAT_0; REAL_MUL_LZERO; REAL_LE_REFL]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `--a / --d` THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[real_div; REAL_INV_NEG; REAL_NEG_MUL2] THEN MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[REAL_LE_INV_EQ]);; + +let transform = UNDISCH_ALL o + PURE_REWRITE_RULE[TAUT `~P <=> (P <=> F)`] o + NUMERALS_TO_NUM o + REWRITE_RULE[GSYM IMP_IMP; min_exp_def];; + +let FLOAT_INTERVAL_DIV_FT_xx' = transform FLOAT_INTERVAL_DIV_FT_xx and + FLOAT_INTERVAL_DIV_FF_FF' = transform FLOAT_INTERVAL_DIV_FF_FF and + FLOAT_INTERVAL_DIV_TT_TT' = transform FLOAT_INTERVAL_DIV_TT_TT and + FLOAT_INTERVAL_DIV_FF_TT' = transform FLOAT_INTERVAL_DIV_FF_TT and + FLOAT_INTERVAL_DIV_TT_FF' = transform FLOAT_INTERVAL_DIV_TT_FF and + FLOAT_INTERVAL_DIV_TF_FF' = transform FLOAT_INTERVAL_DIV_TF_FF and + FLOAT_INTERVAL_DIV_TF_TT' = transform FLOAT_INTERVAL_DIV_TF_TT;; + + +let float_interval_div pp th1 th2 = + let x, l_lo, l_hi = dest_float_interval (concl th1) and + y, r_lo, r_hi = dest_float_interval (concl th2) in + let s1, n1, e1 = dest_float l_lo and + s2, n2, e2 = dest_float l_hi and + s3, m1, r1 = dest_float r_lo and + s4, m2, r2 = dest_float r_hi in + + if s1 <> s2 && s1 = "F" then + let th0 = INST[x, x_var_real; y, y_var_real; + n1, n1_var_num; e1, e1_var_num; + n2, n2_var_num; e2, e2_var_num] FLOAT_INTERVAL_DIV_FT_xx' in + MY_PROVE_HYP th1 th0 + else if s3 <> s4 then + failwith "float_interval_div: division by an interval containing 0" + else + let lo_th, hi_th, th0, zero_th = + if s1 = s2 then + if s1 = "F" then + if s3 = "F" then + float_div_lo pp l_lo r_hi, float_div_hi pp l_hi r_lo, + FLOAT_INTERVAL_DIV_FF_FF', raw_eq0_hash_conv m1 + else + float_div_lo pp l_hi r_hi, float_div_hi pp l_lo r_lo, + FLOAT_INTERVAL_DIV_FF_TT', raw_eq0_hash_conv m2 + else + if s3 = "F" then + float_div_lo pp l_lo r_lo, float_div_hi pp l_hi r_hi, + FLOAT_INTERVAL_DIV_TT_FF', raw_eq0_hash_conv m1 + else + float_div_lo pp l_hi r_lo, float_div_hi pp l_lo r_hi, + FLOAT_INTERVAL_DIV_TT_TT', raw_eq0_hash_conv m2 + else + if s3 = "F" then + float_div_lo pp l_lo r_lo, float_div_hi pp l_hi r_lo, + FLOAT_INTERVAL_DIV_TF_FF', raw_eq0_hash_conv m1 + else + float_div_lo pp l_hi r_hi, float_div_hi pp l_lo r_hi, + FLOAT_INTERVAL_DIV_TF_TT', raw_eq0_hash_conv m2 in + + let f1_tm = lhand(concl lo_th) and + f2_tm = rand(concl hi_th) in + + let th = INST[x, x_var_real; n1, n1_var_num; e1, e1_var_num; + y, y_var_real; n2, n2_var_num; e2, e2_var_num; + m1, m1_var_num; r1, r1_var_num; + m2, m2_var_num; r2, r2_var_num; + f1_tm, f1_var_real; f2_tm, f2_var_real] th0 in + (MY_PROVE_HYP lo_th o MY_PROVE_HYP hi_th o + MY_PROVE_HYP th1 o MY_PROVE_HYP th2 o MY_PROVE_HYP zero_th) th;; + + +(*****************************************) +(* float_interval_add, float_interval_sub *) + +let n1_var_real = `n1:real` and + n2_var_real = `n2:real` and + m1_var_real = `m1:real` and + m2_var_real = `m2:real` and + n_var_real = `n:real` and + m_var_real = `m:real`;; + +let INTERVAL_ADD = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (n1, m1) /\ + interval_arith y (n2, m2) /\ + n <= n1 + n2 /\ m1 + m2 <= m + ==> interval_arith (x + y) (n, m)`, + REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; + +let INTERVAL_SUB = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (n1, m1) /\ + interval_arith y (n2, m2) /\ + n <= n1 - m2 /\ m1 - n2 <= m + ==> interval_arith (x - y) (n, m)`, + REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; + + + let float_interval_add pp th1 th2 = + let x, n1, m1 = dest_float_interval (concl th1) in + let y, n2, m2 = dest_float_interval (concl th2) in + let lo_th = float_add_lo pp n1 n2 in + let hi_th = float_add_hi pp m1 m2 in + let n_tm = lhand (concl lo_th) in + let m_tm = rand (concl hi_th) in + let th0 = INST[x, x_var_real; n1, n1_var_real; m1, m1_var_real; + y, y_var_real; n2, n2_var_real; m2, m2_var_real; + n_tm, n_var_real; m_tm, m_var_real] INTERVAL_ADD in + MY_PROVE_HYP lo_th (MY_PROVE_HYP hi_th (MY_PROVE_HYP th2 (MY_PROVE_HYP th1 th0)));; + +let float_interval_sub pp th1 th2 = + let x, n1, m1 = dest_float_interval (concl th1) in + let y, n2, m2 = dest_float_interval (concl th2) in + let lo_th = float_sub_lo pp n1 m2 in + let hi_th = float_sub_hi pp m1 n2 in + let n_tm = lhand(concl lo_th) in + let m_tm = rand(concl hi_th) in + let th0 = INST[x, x_var_real; n1, n1_var_real; m1, m1_var_real; + y, y_var_real; n2, n2_var_real; m2, m2_var_real; + n_tm, n_var_real; m_tm, m_var_real] INTERVAL_SUB in + MY_PROVE_HYP lo_th (MY_PROVE_HYP hi_th (MY_PROVE_HYP th2 (MY_PROVE_HYP th1 th0)));; + + +(********************************************) +(* FLOAT_ABS *) + +let s_var_bool = `s:bool`;; + +let FLOAT_ABS = prove(`abs (float_num s n e) = float_num F n e`, + BOOL_CASES_TAC `s:bool` THEN + REWRITE_TAC[FLOAT_NEG_T; REAL_ABS_NEG; REAL_ABS_REFL; FLOAT_F_POS]);; + +let float_abs tm = + let ltm, rtm = dest_comb tm in + if ((fst o dest_const) ltm <> "real_abs") then + failwith "float_abs: no abs" + else + let ltm, e_tm = dest_comb rtm in + let ltm, n_tm = dest_comb ltm in + let s_tm = rand ltm in + INST[s_tm, s_var_bool; n_tm, n_var_num; e_tm, e_var_num] FLOAT_ABS;; + + +(*******************************) +(* float_interval_sqrt *) + +let FLOAT_INTERVAL_SQRT = prove(`interval_arith x (float_num F n1 e1, hi) /\ + f1 <= sqrt (float_num F n1 e1) /\ sqrt hi <= f2 + ==> interval_arith (sqrt x) (f1, f2)`, + ABBREV_TAC `lo = float_num F n1 e1` THEN + REWRITE_TAC[interval_arith] THEN + STRIP_TAC THEN + SUBGOAL_THEN `&0 <= lo /\ &0 <= hi` ASSUME_TAC THENL + [ + EXPAND_TAC "lo" THEN + REWRITE_TAC[FLOAT_F_POS] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `x:real` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `lo:real` THEN + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "lo" THEN + REWRITE_TAC[FLOAT_F_POS]; + ALL_TAC + ] THEN + SUBGOAL_THEN `&0 <= x` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `lo:real` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `sqrt lo` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC SQRT_MONO_LE THEN + ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `sqrt hi` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC SQRT_MONO_LE THEN + ASM_REWRITE_TAC[] + ]);; + + +let FLOAT_INTERVAL_SQRT' = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP]) FLOAT_INTERVAL_SQRT;; + +let float_interval_sqrt pp th = + let x_tm, lo_tm, hi_tm = dest_float_interval (concl th) in + let s1, n1_tm, e1_tm = dest_float lo_tm in + if s1 <> "F" then + failwith "float_interval_sqrt: negative low bound" + else + let lo_th = float_sqrt_lo pp lo_tm in + let hi_th = float_sqrt_hi pp hi_tm in + let f1_tm = lhand (concl lo_th) in + let f2_tm = rand (concl hi_th) in + let th0 = INST[x_tm, x_var_real; n1_tm, n1_var_num; e1_tm, e1_var_num; + hi_tm, hi_var_real; f1_tm, f1_var_real; + f2_tm, f2_var_real] FLOAT_INTERVAL_SQRT' in + MY_PROVE_HYP lo_th (MY_PROVE_HYP hi_th (MY_PROVE_HYP th th0));; + + +(******************************************) +(* FLOAT_TO_NUM_CONV *) + +let FLOAT_TO_NUM_CONV tm = + let ltm, e_tm = dest_comb tm in + let f_tm, n_tm = dest_comb ltm in + if (fst o dest_const o rator) f_tm <> "float_num" then + failwith "FLOAT_TO_NUM_CONV" + else + let n_th' = SYM (INST[n_tm, n_var_num] Arith_hash.NUM_THM) in + let e_th' = SYM (INST[e_tm, n_var_num] Arith_hash.NUM_THM) in + let n_th = TRANS n_th' (NUM_TO_NUMERAL_CONV (mk_comb(Arith_hash.num_const, n_tm))) in + let e_th = TRANS e_th' (NUM_TO_NUMERAL_CONV (mk_comb(Arith_hash.num_const, e_tm))) in + let th0 = MK_COMB (AP_TERM f_tm n_th, e_th) in + let tm0 = rand(concl th0) in + let th1 = REWRITE_CONV[float; num_exp; REAL_MUL_LID; GSYM REAL_OF_NUM_MUL; GSYM REAL_OF_NUM_POW; min_exp_def] tm0 in + let th2 = REAL_RAT_REDUCE_CONV (rand(concl th1)) in + TRANS th0 (TRANS th1 th2);; + +end;; + + +(**************************************) +(* Printer for floating-point numbers *) +(**************************************) + +let print_float tm= + try + let s, m_tm, e_tm = Arith_float.dest_float tm in + let m = Arith_hash.raw_dest_hash m_tm and + e = Arith_hash.raw_dest_hash e_tm -/ Num.num_of_int Float_theory.min_exp in + let s_str = if s = "T" then "-" else "" in + let m_str = Num.string_of_num m in + let e_str = if e = num_0 then "" + else "*" ^ string_of_int Arith_hash.arith_base ^ "^" ^ Num.string_of_num e in + let str = "##" ^ s_str ^ m_str ^ e_str in + Format.print_string str + with _ -> failwith "print_float";; + + +install_user_printer ("float_num", print_float);; diff --git a/formal_ineqs/arith/float_atn.hl b/formal_ineqs/arith/float_atn.hl new file mode 100644 index 0000000..da61714 --- /dev/null +++ b/formal_ineqs/arith/float_atn.hl @@ -0,0 +1,582 @@ +(* =========================================================== *) +(* Formal arctangent and arccosine *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +(* Dependencies *) +needs "Multivariate/realanalysis.ml";; + +needs "jordan/refinement.hl";; +open Refinement;; +needs "jordan/parse_ext_override_interface.hl";; +needs "jordan/real_ext.hl";; +prioritize_real();; +needs "jordan/taylor_atn.hl";; + +needs "arith/float.hl";; +needs "list/more_list.hl";; + +module type Float_atn_sig = + sig + val float_interval_pow_simple : int -> int -> thm -> thm + val pi_approx_array : thm array + val pi2_approx_array : thm array + + val float_interval_atn : int -> thm -> thm + val float_interval_acs : int -> thm -> thm +end;; + +module Float_atn : Float_atn_sig = struct + +open Arith_misc;; +open Interval_arith;; +open Float_theory;; +open Arith_float;; +open Taylor_atn;; +open More_list;; + +(******************************) +let x_var_real = `x:real` and + n_var_num = `n:num` and + e_var_num = `e:num` and + a_var_real = `a:real` and + b_var_real = `b:real` and + d_var_real = `d:real` and + hi_var_real = `hi:real` and + lo_var_real = `lo:real`;; + +let add_op_real = `(+):real->real->real` and + sub_op_real = `(-):real->real->real` and + mul_op_real = `( * ):real->real->real` and + div_op_real = `(/):real->real->real` and + neg_op_real = `(--):real->real` and + mul_op_num = `( * ):num->num->num` and + add_op_num = `(+):num->num->num`;; + +(******************************) +(* halfatn and halfatn4 *) + +let float_interval_1 = mk_float_interval_small_num 1;; + +let HALFATN' = (SYM o SPEC_ALL o REWRITE_RULE[REAL_POW_2]) halfatn;; +let HALFATN4' = prove(`halfatn(halfatn(halfatn(halfatn x))) = halfatn4 x`, + REWRITE_TAC[halfatn4; o_THM]);; + +let float_interval_halfatn pp x_th = + let x_tm = (rand o rator o concl) x_th in + let xx_th = float_interval_mul pp x_th x_th in + let one_xx_th = float_interval_add pp float_interval_1 xx_th in + let sqrt_th = float_interval_sqrt pp one_xx_th in + let one_sqrt_th = float_interval_add pp sqrt_th float_interval_1 in + let r_th = float_interval_div pp x_th one_sqrt_th in + let th0 = INST[x_tm, x_var_real] HALFATN' in + let ltm, rtm = dest_comb(concl r_th) in + EQ_MP (AP_THM (AP_TERM (rator ltm) th0) rtm) r_th;; + +let float_interval_halfatn4 pp x_th = + let x_tm = (rand o rator o concl) x_th in + let r_th = float_interval_halfatn pp + (float_interval_halfatn pp + (float_interval_halfatn pp (float_interval_halfatn pp x_th))) in + let th0 = INST[x_tm, x_var_real] HALFATN4' in + let ltm, rtm = dest_comb(concl r_th) in + EQ_MP (AP_THM (AP_TERM (rator ltm) th0) rtm) r_th;; + + +(****************************************) +let rec float_interval_calc pp expr x_th = + if is_var expr then + x_th + else + let ltm, r_tm = dest_comb expr in + if is_comb ltm then + let op, l_tm = dest_comb ltm in + let l_th = float_interval_calc pp l_tm x_th in + let r_th = float_interval_calc pp r_tm x_th in + if op = add_op_real then + float_interval_add pp l_th r_th + else if op = mul_op_real then + float_interval_mul pp l_th r_th + else if op = div_op_real then + float_interval_div pp l_th r_th + else if op = sub_op_real then + float_interval_sub pp l_th r_th + else + failwith ("Unknown operation: " ^ (fst o dest_const) op) + else + if ltm = neg_op_real then + let r_th = float_interval_calc pp r_tm x_th in + float_interval_neg r_th + else + mk_float_interval_num (dest_numeral r_tm);; + + +(*************************************) +(* Polynomial functions *) +let poly_f = new_definition `poly_f cs x = ITLIST (\c s. c + x * s) cs (&0)`;; + +(* Even function *) +let poly_f_even = new_definition `poly_f_even cs x = ITLIST (\c s. c + (x * x) * s) cs (&0)`;; +(* Odd function *) +let poly_f_odd = new_definition `poly_f_odd cs x = x * poly_f_even cs x`;; +let poly_f_odd' = SPECL[`t:(real)list`; `x:real`] poly_f_odd;; + +let NUMERALS_TO_NUM = Arith_nat.NUMERALS_TO_NUM;; + +let POLY_F_EMPTY = (NUMERALS_TO_NUM o prove) (`poly_f [] x = &0`, REWRITE_TAC[poly_f; ITLIST]) and + POLY_F_CONS = prove(`poly_f (CONS h t) x = h + x * poly_f t x`, REWRITE_TAC[poly_f; ITLIST]);; + +let POLY_F_EVEN_EMPTY = (NUMERALS_TO_NUM o prove) (`poly_f_even [] x = &0`, REWRITE_TAC[poly_f_even; ITLIST]) and + POLY_F_EVEN_CONS = prove(`poly_f_even (CONS h t) x = h + (x * x) * poly_f_even t x`, REWRITE_TAC[poly_f_even; ITLIST]);; + +let POLY_F_ODD_EMPTY = (NUMERALS_TO_NUM o prove) (`poly_f_odd [] x = &0`, REWRITE_TAC[poly_f_odd; poly_f_even; ITLIST; REAL_MUL_RZERO]);; + +(* TABLE *) +let rec reverse_table_conv tm = + let ltm, i_tm = dest_comb tm in + if (i_tm = `0`) then + ONCE_REWRITE_CONV[REVERSE_TABLE] tm + else + let i_suc = num_CONV i_tm in + let th1 = ONCE_REWRITE_RULE[REVERSE_TABLE] (AP_TERM ltm i_suc) in + let ltm, rtm = dest_comb (rand(concl th1)) in + let th2 = reverse_table_conv rtm in + TRANS th1 (AP_TERM ltm th2);; + +let atn_co_table = new_definition `atn_co_table n = TABLE + (\k. (if (EVEN k) then &1 else --(&1)) / &(2 * k + 1)) (SUC n)`;; + +(* Returns a theorem |- atn_co_table n = [...] and + a list of interval approximations of the coefficients in the table *) +let mk_atn_co_table pp n = + let table = SPEC (mk_small_numeral n) atn_co_table in + let th = CONV_RULE (DEPTH_CONV NUM_SUC_CONV THENC + REWRITE_CONV[TABLE] THENC + ONCE_DEPTH_CONV reverse_table_conv THENC + REWRITE_CONV[REVERSE; APPEND] THENC + NUM_REDUCE_CONV) table in + let list = (rand o concl) th in + th, map (fun tm -> float_interval_calc pp tm float_interval_1) (dest_list list);; + +let POLY_F_EVEN_ALT = prove(`poly_f_even cs x = poly_f cs (x * x)`, + REWRITE_TAC[poly_f_even; poly_f]);; + +let POLY_F_APPEND = prove(`!x b a. poly_f (APPEND a b) x = poly_f a x + x pow (LENGTH a) * poly_f b x`, + GEN_TAC THEN GEN_TAC THEN + MATCH_MP_TAC list_INDUCT THEN + REPEAT STRIP_TAC THENL + [ + REWRITE_TAC[APPEND; poly_f; ITLIST; LENGTH] THEN + REWRITE_TAC[real_pow; REAL_MUL_LID; REAL_ADD_LID]; + ALL_TAC + ] THEN + + REWRITE_TAC[APPEND; poly_f; ITLIST] THEN + ASM_REWRITE_TAC[GSYM poly_f] THEN + REWRITE_TAC[LENGTH; real_pow] THEN + REAL_ARITH_TAC);; + +let POLY_F_EVEN_APPEND = prove(`!x b a. poly_f_even (APPEND a b) x = poly_f_even a x + x pow (2 * LENGTH a) * poly_f_even b x`, + REWRITE_TAC[POLY_F_EVEN_ALT; POLY_F_APPEND] THEN + REWRITE_TAC[GSYM REAL_POW_2; REAL_POW_POW]);; + +let POLY_F_ODD_APPEND = prove(`!x b a. poly_f_odd (APPEND a b) x = poly_f_odd a x + x pow (2 * LENGTH a) * poly_f_odd b x`, + REPEAT GEN_TAC THEN + REWRITE_TAC[poly_f_odd] THEN + REWRITE_TAC[POLY_F_EVEN_APPEND] THEN + REAL_ARITH_TAC);; + +let ATN_SUM_TABLE = prove(`!x n. sum (0..n) (halfatn4_co x) = poly_f_odd (atn_co_table n) (halfatn4 x)`, + GEN_TAC THEN INDUCT_TAC THENL + [ + REWRITE_TAC[SUM_SING_NUMSEG; atn_co_table; TABLE; REVERSE_TABLE; REVERSE; APPEND] THEN + REWRITE_TAC[ARITH_EVEN] THEN + REWRITE_TAC[poly_f_odd; poly_f_even; ITLIST] THEN + REWRITE_TAC[halfatn4_co; REAL_MUL_RZERO; REAL_ADD_RID] THEN + REWRITE_TAC[MULT_CLAUSES; ARITH_ADD; REAL_POW_1; real_pow] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + REWRITE_TAC[SUM_CLAUSES_NUMSEG; atn_co_table; TABLE; LE_0] THEN + ONCE_REWRITE_TAC[REVERSE_TABLE] THEN + ONCE_REWRITE_TAC[REVERSE] THEN + REWRITE_TAC[GSYM TABLE; GSYM atn_co_table] THEN + ASM_REWRITE_TAC[POLY_F_ODD_APPEND] THEN + REWRITE_TAC[REAL_EQ_ADD_LCANCEL] THEN + REWRITE_TAC[atn_co_table; LENGTH_TABLE; halfatn4_co] THEN + REWRITE_TAC[poly_f_odd; poly_f_even; ITLIST; REAL_MUL_RZERO; REAL_ADD_RID] THEN + REWRITE_TAC[real_div; REAL_MUL_ASSOC] THEN + REWRITE_TAC[REAL_EQ_MUL_RCANCEL] THEN + DISJ1_TAC THEN + REWRITE_TAC[REAL_MUL_AC] THEN + REWRITE_TAC[GSYM real_pow; ARITH_RULE `2 * SUC n + 1 = SUC (2 * SUC n)`] THEN + GEN_REWRITE_TAC LAND_CONV [REAL_MUL_AC] THEN + REWRITE_TAC[REAL_EQ_MUL_RCANCEL] THEN + DISJ1_TAC THEN + REWRITE_TAC[REAL_POW_NEG; real_pow; REAL_POW_ONE; REAL_MUL_RID]);; + +let POLY_F_SING = prove(`poly_f [c] x = c`, + REWRITE_TAC[poly_f; ITLIST; REAL_MUL_RZERO; REAL_ADD_RID]);; + +(********************) +let c_var_real = `c:real` and + cs_var_list = `cs:(real)list` and + h_var_real = `h:real` and + t_var_list = `t:(real)list`;; + +let interval_const = `interval_arith`;; + +let rec float_interval_poly_f pp (cs, l) x_th = + if length l = 0 then + failwith "float_interval_poly_f: an empty coefficient list" + else + let ltm, x_bounds = dest_comb (concl x_th) in + let x_tm = rand ltm in + let first = hd l in + let ltm, first_bounds = dest_comb (concl first) in + let first_tm = rand ltm in + if length l = 1 then + let th0 = INST[first_tm, c_var_real; x_tm, x_var_real] POLY_F_SING in + EQ_MP (SYM (AP_THM (AP_TERM interval_const th0) first_bounds)) first + else + let ltm, t_tm = dest_comb cs in + let h_tm = rand ltm in + + let th0 = INST[h_tm, h_var_real; t_tm, t_var_list; x_tm, x_var_real] POLY_F_CONS in + let r_th = float_interval_poly_f pp (t_tm, tl l) x_th in + let th1 = float_interval_add pp first (float_interval_mul pp x_th r_th) in + let bounds = rand (concl th1) in + EQ_MP (SYM (AP_THM (AP_TERM interval_const th0) bounds)) th1;; + +let float_interval_poly_f_even pp (cs, l) x_th = + let x_tm = (rand o rator o concl) x_th in + let xx_th = float_interval_mul pp x_th x_th in + let th0 = INST[cs, cs_var_list; x_tm, x_var_real] POLY_F_EVEN_ALT in + let th1 = float_interval_poly_f pp (cs, l) xx_th in + let bounds = rand(concl th1) in + EQ_MP (SYM (AP_THM (AP_TERM interval_const th0) bounds)) th1;; + +let float_interval_poly_f_odd pp (cs, l) x_th = + let x_tm = (rand o rator o concl) x_th in + let th0 = INST[cs, t_var_list; x_tm, x_var_real] poly_f_odd' in + let even_th = float_interval_poly_f_even pp (cs, l) x_th in + let th1 = float_interval_mul pp x_th even_th in + let bounds = rand(concl th1) in + EQ_MP (SYM (AP_THM (AP_TERM interval_const th0) bounds)) th1;; + + +let poly_f_odd_const = `poly_f_odd`;; +let ATN_SUM_TABLE' = SPEC_ALL ATN_SUM_TABLE;; +let float_interval_16 = mk_float_interval_small_num 16;; + +(* Computes an interval for &16 * sum(0..n) (halfatn4_co x) *) +let float_interval_atn_sum pp (cs_th, l) x_th = + let n_tm = (rand o lhand o concl) cs_th in + let cs_tm = rand(concl cs_th) in + let halfatn4 = float_interval_halfatn4 pp x_th in + + let poly_th = float_interval_poly_f_odd pp (cs_tm, l) halfatn4 in + let bounds = rand (concl poly_th) in + let halfatn4_tm = (rand o rator o concl) halfatn4 in + let x_tm = rand halfatn4_tm in + + let th1 = AP_THM (AP_TERM interval_const (AP_THM (AP_TERM poly_f_odd_const cs_th) halfatn4_tm)) bounds in + let poly_atn_th = EQ_MP (SYM th1) poly_th in + let bounds = rand (concl poly_atn_th) in + + let th2 = INST[n_tm, n_var_num; x_tm, x_var_real] ATN_SUM_TABLE' in + let th3 = EQ_MP (SYM (AP_THM (AP_TERM interval_const th2) bounds)) poly_atn_th in + float_interval_mul pp float_interval_16 th3;; + + +(******************************) +let bounds_var_pair = `bounds:real#real`;; + +let FLOAT_INTERVAL_INV = prove(`interval_arith (&1 / x) bounds <=> + interval_arith (inv x) bounds`, + REWRITE_TAC[real_div; REAL_MUL_LID]);; + +let float_interval_inv pp x_th = + let x_tm = (rand o rator o concl) x_th in + let r_th = float_interval_div pp float_interval_1 x_th in + let th0 = INST[x_tm, x_var_real; rand(concl r_th), bounds_var_pair] FLOAT_INTERVAL_INV in + EQ_MP th0 r_th;; + +let REAL_POW_SUC = (SPEC_ALL o CONJUNCT2) real_pow;; + +let INTERVAL_REAL_POW_0 = prove(mk_comb(`interval_arith (x pow 0)`, (rand o concl) float_interval_1), + REWRITE_TAC[real_pow; float_interval_1]);; + +let INTERVAL_REAL_POW_1 = prove(`interval_arith x bounds <=> interval_arith (x pow 1) bounds`, + REWRITE_TAC[REAL_POW_1]);; + + +let rec float_interval_pow_simple pp n x_th = + let x_tm = (rand o rator o concl) x_th in + if n = 0 then + INST[x_tm, x_var_real] INTERVAL_REAL_POW_0 + else + if n = 1 then + let bounds = rand(concl x_th) in + let th0 = INST[x_tm, x_var_real; bounds, bounds_var_pair] INTERVAL_REAL_POW_1 in + EQ_MP th0 x_th + else + let n_tm' = mk_small_numeral n in + let n_suc = num_CONV n_tm' in + let n_tm = rand(rand(concl n_suc)) in + let th0 = INST[x_tm, x_var_real; n_tm, n_var_num] REAL_POW_SUC in + let r_th = float_interval_pow_simple pp (n - 1) x_th in + let th1 = float_interval_mul pp x_th r_th in + let bounds = rand (concl th1) in + let th2 = TRANS (AP_TERM (rator(lhand(concl th0))) n_suc) th0 in + EQ_MP (SYM (AP_THM (AP_TERM interval_const th2) bounds)) th1;; + +let float_interval_2 = mk_float_interval_small_num 2 and + six_const = `6` and + five_const = `5`;; + +(* Computes an interval for inv(&2 pow (6 * n + 5)) *) +let compute_eps1 pp n = + let n_tm = mk_small_numeral n in + let n6 = NUM_MULT_CONV (mk_binop mul_op_num six_const n_tm) in + let n65_1 = AP_THM (AP_TERM add_op_num n6) five_const in + let n65_2 = NUM_ADD_CONV (rand (concl n65_1)) in + let n65 = TRANS n65_1 n65_2 in + let pow_th = float_interval_pow_simple pp (6 * n + 5) float_interval_2 in + let ltm, bounds = dest_comb(concl pow_th) in + let pow_tm = (rator o rand) ltm in + let th0 = EQ_MP (SYM (AP_THM (AP_TERM interval_const (AP_TERM pow_tm n65)) bounds)) pow_th in + float_interval_inv pp th0;; + + +(**********************************) +let FLOAT_ATN_LO_HI = prove(`interval_arith (&16 * sum(0..n) (halfatn4_co x)) (a, b) /\ + interval_arith (inv(&2 pow (6*n + 5))) (c,d) /\ + b + d <= hi /\ lo <= a - d + ==> interval_arith (atn x) (lo, hi)`, + REWRITE_TAC[interval_arith] THEN + STRIP_TAC THEN + MP_TAC (SPEC_ALL real_taylor_atn_halfatn4) THEN + MP_TAC (REAL_ARITH `&0 <= abs(&16)`) THEN + REWRITE_TAC[IMP_IMP] THEN + DISCH_THEN (MP_TAC o MATCH_MP REAL_LE_LMUL) THEN + REWRITE_TAC[GSYM REAL_ABS_MUL; REAL_ARITH `a * (b - c) = a * b - a * c:real`] THEN + ONCE_REWRITE_TAC[GSYM atn_halfatn4] THEN + REWRITE_TAC[REAL_ARITH `abs (x - v) <= e <=> v - e <= x /\ x <= v + e`] THEN + REWRITE_TAC[REAL_ABS_NUM] THEN + SUBGOAL_THEN `&16 * inv(&8 pow (2 * n + 3)) = inv(&2 pow (6 * n + 5))` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[GSYM real_div] THEN + SUBGOAL_THEN `&16 = &2 pow 4 /\ &8 = &2 pow 3 /\ ~(&2 = &0)` ASSUME_TAC THENL + [ + REAL_ARITH_TAC; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[REAL_POW_POW] THEN + ASM_SIMP_TAC[REAL_DIV_POW2] THEN + REWRITE_TAC[ARITH_RULE `~(3 * (2 * n + 3) <= 4)`] THEN + REPEAT AP_TERM_TAC THEN + ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[GSYM halfatn4_co] THEN + SUBGOAL_THEN `sum (0..n) (\j. halfatn4_co x j) = sum (0..n) (halfatn4_co x)` (fun th -> REWRITE_TAC[th]) THENL + [ + AP_TERM_TAC THEN + REWRITE_TAC[FUN_EQ_THM]; + ALL_TAC + ] THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC);; + +let FLOAT_ATN_LO_HI' = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP]) FLOAT_ATN_LO_HI;; + +let float_interval_atn_0 pp (cs_th, l) eps1_th x_th = + let sum_th = float_interval_atn_sum pp (cs_th, l) x_th in + let n_tm = (rand o lhand o concl) cs_th in + let x_tm = (rand o rator o concl) x_th in + + let sum_bounds = rand (concl sum_th) in + let a_tm, b_tm = dest_pair sum_bounds in + let c_tm, d_tm = (dest_pair o rand o concl) eps1_th in + + let hi_th = float_add_hi pp b_tm d_tm in + let lo_th = float_sub_lo pp a_tm d_tm in + let hi_tm = rand(concl hi_th) in + let lo_tm = lhand(concl lo_th) in + + let th0 = INST[n_tm, n_var_num; x_tm, x_var_real; + a_tm, a_var_real; b_tm, b_var_real; + c_tm, c_var_real; d_tm, d_var_real; + hi_tm, hi_var_real; lo_tm, lo_var_real] FLOAT_ATN_LO_HI' in + MY_PROVE_HYP lo_th (MY_PROVE_HYP hi_th (MY_PROVE_HYP sum_th (MY_PROVE_HYP eps1_th th0)));; + +(* Fill in lookup tables *) + +(* Computes n such that 2^(-(6n + 5)) <= base^(-(p + 1)) *) +let n_of_p pp = + let x = (float_of_int (pp + 1) *. log (float_of_int Arith_hash.arith_base) /. log (2.0) -. 5.0) /. 6.0 in + let n = (int_of_float o ceil) x in + if n < 1 then 1 else n;; + +let atn_co_array = Array.init 21 (fun i -> mk_atn_co_table (i + 1) (n_of_p i));; +let eps1_array = Array.init 21 (fun i -> compute_eps1 (i + 1) (n_of_p i));; + +let float_interval_atn pp x_th = + float_interval_atn_0 pp atn_co_array.(pp) eps1_array.(pp) x_th;; + +(*****************************************) +(* pi approximation *) + +let pp = 20;; +let x_th = float_interval_1;; +let th1 = float_interval_atn pp x_th;; +let th2 = float_interval_mul pp (mk_float_interval_small_num 4) th1;; +let float_interval_pi = REWRITE_RULE[ATN_1; REAL_ARITH `&4 * pi / &4 = pi`] th2;; +let float_interval_pi2 = float_interval_div pp float_interval_pi float_interval_2;; + + +let pi_approx_array = Array.init 19 (fun i -> float_interval_round i float_interval_pi);; +let pi2_approx_array = Array.init 19 (fun i -> float_interval_round i float_interval_pi2);; + +(********************************************) +(* acs *) + +let TAN_HALF = prove(`!x. ~(cos x = -- &1) ==> tan (x / &2) = sin x / (&1 + cos x)`, + GEN_TAC THEN + ABBREV_TAC `t = x / &2` THEN + SUBGOAL_THEN `x = &2 * t` ASSUME_TAC THENL + [ + EXPAND_TAC "t" THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[SIN_DOUBLE; COS_DOUBLE_COS; REAL_ARITH `&1 + a - &1 = a`] THEN + REWRITE_TAC[REAL_ARITH `a - &1 = -- &1 <=> a = &0`] THEN + REWRITE_TAC[real_div; REAL_INV_MUL; REAL_POW_2] THEN + REWRITE_TAC[REAL_ENTIRE; REAL_ARITH `&2 = &0 <=> F`] THEN + DISCH_TAC THEN + REWRITE_TAC[REAL_ARITH `(&2 * s * c) * i2 * ic * ic = (&2 * i2) * (c * ic) * s * ic`] THEN + ASM_SIMP_TAC[REAL_MUL_RINV; REAL_ARITH `~(&2 = &0)`] THEN + REWRITE_TAC[REAL_MUL_LID; tan; real_div]);; + +let X_EQ_COS_T = prove(`!x. abs x <= &1 ==> ?t. &0 <= t /\ t <= pi /\ x = cos t`, + REWRITE_TAC[REAL_ARITH `abs x <= &1 <=> -- &1 <= x /\ x <= &1`] THEN + REPEAT STRIP_TAC THEN + EXISTS_TAC `acs x` THEN + ASM_SIMP_TAC[ACS_BOUNDS; COS_ACS]);; + +let ACS_ATN_ALT = prove(`!x. -- &1 < x /\ x <= &1 ==> + acs x = &2 * atn (sqrt (&1 - x pow 2) / (&1 + x))`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL X_EQ_COS_T) THEN + ANTS_TAC THENL + [ + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[ACS_COS] THEN + MP_TAC (SPEC `t:real` SIN_COS_SQRT) THEN + ANTS_TAC THENL + [ + ASM_SIMP_TAC[SIN_POS_PI_LE]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MP_TAC (SPEC `t:real` TAN_HALF) THEN + ANTS_TAC THENL + [ + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + UNDISCH_TAC `-- &1 < x` THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[REAL_ARITH `t = &2 * a <=> a = t / &2`] THEN + MATCH_MP_TAC TAN_ATN THEN + REWRITE_TAC[REAL_ARITH `a / &2 < b / &2 <=> a < b`] THEN + REWRITE_TAC[REAL_ARITH `--(a / &2) < b / &2 <=> --a < b`] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LTE_TRANS THEN + EXISTS_TAC `&0` THEN + ASM_REWRITE_TAC[REAL_NEG_LT0; PI_POS]; + SUBGOAL_THEN `t = acs x` MP_TAC THENL + [ + ASM_SIMP_TAC[ACS_COS]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[SYM ACS_NEG_1] THEN + MATCH_MP_TAC ACS_MONO_LT THEN + ASM_REWRITE_TAC[REAL_LE_REFL] + ]);; + +let FLOAT_F_LT = prove(`!n e. &0 < float_num F n e <=> ~(n = 0)`, + REWRITE_TAC[REAL_ARITH `&0 < a <=> &0 <= a /\ ~(a = &0)`] THEN + REWRITE_TAC[FLOAT_F_POS; FLOAT_EQ_0]);; + +let FLOAT_INTERVAL_ACS = prove(`interval_arith (pi / &2 - atn(x / sqrt(&1 - x * x))) bounds /\ + interval_arith (&1 - x * x) (float_num F n e, hi) /\ + ~(n = 0) + ==> interval_arith (acs x) bounds`, + REWRITE_TAC[GSYM REAL_POW_2] THEN + STRIP_TAC THEN + MP_TAC (SPEC_ALL ACS_ATN) THEN + ANTS_TAC THENL + [ + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[interval_arith] THEN + REWRITE_TAC[REAL_ARITH `-- &1 < x /\ x < &1 <=> abs x < abs (&1)`] THEN + REWRITE_TAC[REAL_LT_SQUARE_ABS] THEN + REWRITE_TAC[REAL_ARITH `&1 pow 2 = &1`] THEN + REPEAT STRIP_TAC THEN + REWRITE_TAC[REAL_ARITH `a < &1 <=> &0 < &1 - a`] THEN + + MP_TAC (SPEC_ALL FLOAT_F_LT) THEN + ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `float_num F n e <= &1 - x pow 2` THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> ASM_REWRITE_TAC[th]));; + +let ZERO_EQ_ZERO_CONST = prove(`0 = _0`, REWRITE_TAC[NUMERAL]);; + +let FLOAT_INTERVAL_ACS' = (UNDISCH_ALL o + PURE_ONCE_REWRITE_RULE[TAUT `~P <=> (P <=> F)`] o + REWRITE_RULE[ZERO_EQ_ZERO_CONST; GSYM IMP_IMP]) FLOAT_INTERVAL_ACS;; + +let float_interval_acs_0 pp (cs_th, l) eps1_th x_th = + let int1 = float_interval_sub pp float_interval_1 (float_interval_mul pp x_th x_th) in + let int2 = float_interval_div pp x_th (float_interval_sqrt pp int1) in + let atn_int = float_interval_atn_0 pp (cs_th, l) eps1_th int2 in + let acs_int = float_interval_sub pp pi2_approx_array.(pp + 1) atn_int in + + let x_tm = (rand o rator o concl) x_th in + let bounds = (rand o concl) acs_int in + let int1_bounds = (rand o concl) int1 in + let lo_tm, hi_tm = dest_pair int1_bounds in + let s, n_tm, e_tm = dest_float lo_tm in + if s <> "F" then + failwith "float_interval_acs_0: &1 - x pow 2 < &1 is not satisfied" + else + let n_th = Arith_nat.raw_eq0_hash_conv n_tm in + let th0 = INST[x_tm, x_var_real; bounds, bounds_var_pair; + n_tm, n_var_num; e_tm, e_var_num; + hi_tm, hi_var_real] FLOAT_INTERVAL_ACS' in + MY_PROVE_HYP acs_int (MY_PROVE_HYP int1 (MY_PROVE_HYP n_th th0));; + +let float_interval_acs pp x_th = + float_interval_acs_0 pp atn_co_array.(pp) eps1_array.(pp) x_th;; + +(****************************************) +end;; diff --git a/formal_ineqs/arith/float_theory.hl b/formal_ineqs/arith/float_theory.hl new file mode 100644 index 0000000..da4c46c --- /dev/null +++ b/formal_ineqs/arith/float_theory.hl @@ -0,0 +1,87 @@ +(* =========================================================== *) +(* Theoretical results for floating point arithmetic *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + + +(* Dependencies *) +needs "arith/nat.hl";; +needs "arith/num_exp_theory.hl";; + +module Float_theory = struct + +open Num_exp_theory;; +open Arith_nat;; + +(* Fix the minimal exponent *) +let min_exp = !Arith_options.min_exp;; + +(* The main definition *) +let min_exp_num_const = rand (mk_small_numeral_array min_exp);; +let min_exp_const = mk_small_numeral min_exp;; + +let min_exp_def = new_definition (mk_eq(`min_exp:num`, min_exp_const));; + +let float_tm = `float_num s n e = (if s then (-- &1) else &1) * &(num_exp n e) / &(num_exp 1 min_exp)`;; +let float = new_definition float_tm;; + +let FLOAT_OF_NUM = (GEN_ALL o prove)(`&n = float_num F n min_exp`, + REWRITE_TAC[float; num_exp; REAL_MUL_LID] THEN + REWRITE_TAC[GSYM REAL_OF_NUM_MUL; REAL_MUL_LID; real_div] THEN + SUBGOAL_THEN (mk_comb(`(~)`, mk_eq(mk_comb(`&`, mk_binop `EXP` base_const `min_exp`), `&0`))) ASSUME_TAC THENL + [ + REWRITE_TAC[REAL_OF_NUM_EQ; EXP_EQ_0] THEN ARITH_TAC; + ALL_TAC + ] THEN + ASM_SIMP_TAC[GSYM REAL_MUL_ASSOC; REAL_MUL_RINV; REAL_MUL_RID]);; + +let FLOAT_NEG = prove(`!s n e. --float_num s n e = float_num (~s) n e`, + REWRITE_TAC[float] THEN REAL_ARITH_TAC);; + +let FLOAT_NEG_F = (GSYM o REWRITE_RULE[] o SPEC `T`) FLOAT_NEG;; +let FLOAT_NEG_T = (GSYM o REWRITE_RULE[] o SPEC `F`) FLOAT_NEG;; + +let FLOAT_F_POS = prove(`!n e. &0 <= float_num F n e`, + REPEAT GEN_TAC THEN REWRITE_TAC[float; REAL_MUL_LID; real_div] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + REWRITE_TAC[REAL_POS; REAL_LE_INV_EQ]);; + +let FLOAT_T_NEG = prove(`!n e. float_num T n e <= &0`, + REPEAT GEN_TAC THEN REWRITE_TAC[float; real_div] THEN + REWRITE_TAC[REAL_ARITH `-- &1 * a * b <= &0 <=> &0 <= a * b`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + REWRITE_TAC[REAL_POS; REAL_LE_INV_EQ]);; + +let FLOAT_EQ_0 = prove(`!s n e. float_num s n e = &0 <=> n = 0`, + REPEAT GEN_TAC THEN REWRITE_TAC[float; real_div] THEN + REWRITE_TAC[REAL_ENTIRE] THEN + EQ_TAC THENL + [ + STRIP_TAC THEN POP_ASSUM MP_TAC THENL + [ + COND_CASES_TAC THEN REAL_ARITH_TAC; + REWRITE_TAC[REAL_OF_NUM_EQ; NUM_EXP_EQ_0]; + REWRITE_TAC[REAL_INV_EQ_0; REAL_OF_NUM_EQ; NUM_EXP_EQ_0] THEN + ARITH_TAC + ]; + + DISCH_TAC THEN + DISJ2_TAC THEN DISJ1_TAC THEN + ASM_REWRITE_TAC[REAL_OF_NUM_EQ; NUM_EXP_EQ_0] + ]);; + +let FLOAT_F_bound = (GEN_ALL o prove)(`num_exp n1 e1 <= num_exp n2 e2 + ==> float_num F n1 e1 <= float_num F n2 e2`, + DISCH_TAC THEN + REWRITE_TAC[float; REAL_MUL_LID; real_div] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + ASM_REWRITE_TAC[REAL_OF_NUM_LE; REAL_LE_INV_EQ; REAL_POS]);; + +let FLOAT_T_bound = (GEN_ALL o prove)(`num_exp n1 e1 <= num_exp n2 e2 + ==> float_num T n2 e2 <= float_num T n1 e1`, + REWRITE_TAC[FLOAT_NEG_T; REAL_LE_NEG; FLOAT_F_bound]);; + + + +end;; diff --git a/formal_ineqs/arith/interval_arith.hl b/formal_ineqs/arith/interval_arith.hl new file mode 100644 index 0000000..c314eda --- /dev/null +++ b/formal_ineqs/arith/interval_arith.hl @@ -0,0 +1,59 @@ +(* =========================================================== *) +(* Theoretical results for interval arithmetic *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +needs "misc/vars.hl";; + +module Interval_arith = struct + +(*******************************) +(* The main definition *) +let interval_arith = + new_definition `interval_arith (x:real) (lo, hi) <=> lo <= x /\ x <= hi`;; + +(* Additional definitions *) +let bounded_on = new_definition `bounded_on f s f_bounds <=> + !x. x IN s ==> interval_arith (f x) f_bounds`;; + +let bounded_on_int = new_definition `bounded_on_int f int f_bounds <=> + !x. interval_arith x int ==> interval_arith (f x) f_bounds`;; + +let iabs = new_definition `iabs (x_lo, x_hi) = max x_hi (-- x_lo)`;; +let interval_not_zero = new_definition `interval_not_zero (lo, hi) <=> &0 < lo \/ hi < &0`;; +let interval_pos = new_definition `interval_pos (lo, hi) <=> &0 < lo`;; + + +(********************************) +(* Lemmas *) +let CONST_INTERVAL = prove(`!x. interval_arith x (x,x)`, + REWRITE_TAC[interval_arith; REAL_LE_REFL]);; + +let APPROX_INTERVAL = (GEN_ALL o prove)(`(a <= lo /\ hi <= b) /\ interval_arith x (lo, hi) + ==> interval_arith x (a,b)`, + REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; + +let INTERVAL_NEG = (GEN_ALL o prove)(`interval_arith x (a, b) ==> + interval_arith (--x) (--b, --a)`, + REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; + + +(**************************************) +(* Conversions *) +open Misc_vars;; + +let interval_tm = `interval_arith`;; + +let dest_interval_arith tm = + let lhs, int_tm = dest_comb tm in + rand lhs, int_tm;; + +let mk_interval tm bounds = + mk_comb (mk_comb (interval_tm, tm), bounds);; + +let mk_const_interval = + let lemma = SPEC_ALL CONST_INTERVAL in + fun tm -> INST[tm, x_var_real] lemma;; + +end;; diff --git a/formal_ineqs/arith/more_float.hl b/formal_ineqs/arith/more_float.hl new file mode 100644 index 0000000..0ea63dd --- /dev/null +++ b/formal_ineqs/arith/more_float.hl @@ -0,0 +1,491 @@ +(* =========================================================== *) +(* Additional floating point procedures *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +needs "arith/float.hl";; +needs "misc/vars.hl";; + +module More_float = struct + +open Arith_misc;; +open Float_theory;; +open Interval_arith;; +open Arith_float;; +open Misc_vars;; + +let RULE = UNDISCH_ALL o Arith_nat.NUMERALS_TO_NUM o REWRITE_RULE[FLOAT_OF_NUM; min_exp_def; GSYM IMP_IMP] o SPEC_ALL;; + +(*************************************) +(* More float *) + + +(* Converts a float term to the corresponding rational number *) +let num_of_float_tm tm = + let s, n_tm, e_tm = dest_float tm in + let b = Num.num_of_int Arith_hash.arith_base in + let m = Num.num_of_int Float_theory.min_exp in + let ( * ), (^), (-), (!) = ( */ ), ( **/ ), (-/), Arith_nat.raw_dest_hash in + let r = !n_tm * (b ^ (!e_tm - m)) in + if s = "T" then minus_num r else r;; + +(* Converts a float term to a floating point number *) +(* Note: float_of_num gives a very bad approximation in some cases *) +let float_of_float_tm tm = + (float_of_string o approx_num_exp 30 o num_of_float_tm) tm;; + + +(* Creates a float term with the value (n * base^e) *) +let mk_float = + let float_const = `float_num` in + fun n e -> + let n, s = if n < 0 then -n, `T` else n, `F` in + let n_tm = rand (Arith_nat.mk_small_numeral_array n) in + let e_tm = rand (Arith_nat.mk_small_numeral_array (e + Float_theory.min_exp)) in + mk_comb(mk_comb(mk_comb (float_const, s), n_tm), e_tm);; + + +(* |- ##0 = &0, |- ##1 = &1, |- ##2 = &2, |- ##3 = &3, |- ##4 = &4 *) +let float0_eq = FLOAT_TO_NUM_CONV (mk_float 0 0) and + float1_eq = FLOAT_TO_NUM_CONV (mk_float 1 0) and + float2_eq = FLOAT_TO_NUM_CONV (mk_float 2 0) and + float3_eq = FLOAT_TO_NUM_CONV (mk_float 3 0) and + float4_eq = FLOAT_TO_NUM_CONV (mk_float 4 0);; + +(* |- D_k _0 = k for k = 1, 2, 3 *) +let num1_eq, num2_eq, num3_eq = + let conv = SYM o REWRITE_RULE[Arith_hash.NUM_THM] o Arith_nat.NUMERAL_TO_NUM_CONV in + conv `1`, conv `2`, conv `3`;; + +(*********************) + +let float_F_const = `float_num F`;; + +let mk_float_small n = + let n_tm0 = mk_small_numeral n in + let n_th = Arith_nat.NUMERAL_TO_NUM_CONV n_tm0 in + let n_tm = rand(rand(concl n_th)) in + mk_comb(mk_comb(float_F_const, n_tm), min_exp_num_const);; + +(* Small float constants and intervals *) +let one_float = mk_float_small 1 and + two_float = mk_float_small 2 and + one_interval = mk_float_interval_small_num 1 and + two_interval = mk_float_interval_small_num 2;; +let neg_two_interval = float_interval_neg two_interval;; + +(***********************************) +(* float_eq0 *) + +let FLOAT_EQ_0' = (GEN_REWRITE_RULE (RAND_CONV o RAND_CONV) [NUMERAL] o SPEC_ALL) + FLOAT_EQ_0;; + + +let float_eq0 f_tm = + let lhs, e_tm = dest_comb f_tm in + let lhs2, n_tm = dest_comb lhs in + let th0 = INST[rand lhs2, s_var_bool; n_tm, n_var_num; e_tm, e_var_num] FLOAT_EQ_0' in + let eq_th = Arith_nat.raw_eq0_hash_conv n_tm in + TRANS th0 eq_th;; + + + +(***********************************) +(* float_interval_scale *) + +let float_interval_scale pp c_tm th = + let c_th = mk_const_interval c_tm in + float_interval_mul pp c_th th;; + + +(***********************************) +(* float_interval_lt0 *) + +let FLOAT_INTERVAL_LT0' = (UNDISCH_ALL o prove) + (`interval_arith x (lo, hi) ==> (hi < &0 <=> T) ==> x < &0`, + REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; + +let float_interval_lt0 th = + let x_tm, bounds = dest_interval_arith (concl th) in + let lo_tm, hi_tm = dest_pair bounds in + let lt0_th = float_lt0 hi_tm in + let _ = ((rand o concl) lt0_th = t_const) or failwith "float_interval_lt0: &0 <= hi" in + let th0 = INST[x_tm, x_var_real; lo_tm, lo_var_real; hi_tm, hi_var_real] FLOAT_INTERVAL_LT0' in + (MY_PROVE_HYP th o MY_PROVE_HYP lt0_th) th0;; + + +(**********************************) +(* float_pos *) +let FLOAT_F_POS' = SPEC_ALL FLOAT_F_POS;; + +(* Returns &0 <= float F n e *) +let float_pos tm = + let _, n_tm, e_tm = dest_float tm in + INST[n_tm, n_var_num; e_tm, e_var_num] FLOAT_F_POS';; + + + +(************************************) +(* float_iabs *) + +let FLOAT_NEG_F' = RULE FLOAT_NEG_T;; +let FLOAT_NEG_T' = RULE FLOAT_NEG_F;; + +let float_neg tm = + let sign, n_tm, e_tm = dest_float tm in + if sign = "T" then + INST[n_tm, n_var_num; e_tm, e_var_num] FLOAT_NEG_T' + else + INST[n_tm, n_var_num; e_tm, e_var_num] FLOAT_NEG_F';; + + +let IABS' = RULE iabs;; + + +let float_iabs int_tm = + let lo_tm, hi_tm = dest_pair int_tm in + let neg_lo_th = float_neg lo_tm in + let max_th = SYM (float_max hi_tm ((rand o rator o concl) neg_lo_th)) in + let lhs, rhs = dest_comb (concl max_th) in + let th0 = SYM (EQ_MP (AP_TERM lhs (AP_TERM (rator rhs) neg_lo_th)) max_th) in + let th1 = INST[lo_tm, x_lo_var; hi_tm, x_hi_var] IABS' in + TRANS th1 th0;; + + +let FLOAT_IABS_FF = prove(`iabs (float_num F n1 e1, float_num F n2 e2) = float_num F n2 e2`, + REWRITE_TAC[iabs] THEN + MP_TAC (SPECL [`n1:num`; `e1:num`] FLOAT_F_POS) THEN + MP_TAC (SPECL [`n2:num`; `e2:num`] FLOAT_F_POS) THEN + REAL_ARITH_TAC);; + + +let FLOAT_IABS_TT = prove(`iabs (float_num T n1 e1, float_num T n2 e2) = float_num F n1 e1`, + REWRITE_TAC[iabs; GSYM FLOAT_NEG_F] THEN + MP_TAC (SPECL [`n1:num`; `e1:num`] FLOAT_F_POS) THEN + MP_TAC (SPECL [`n2:num`; `e2:num`] FLOAT_T_NEG) THEN + REAL_ARITH_TAC);; + + +(****************************) +(* interval_not_zero *) + +let INTERVAL_NOT_ZERO1' = (UNDISCH_ALL o prove) + (`(&0 < lo <=> T) ==> interval_not_zero (lo, hi)`, SIMP_TAC[interval_not_zero]);; +let INTERVAL_NOT_ZERO2' = (UNDISCH_ALL o prove) + (`(hi < &0 <=> T) ==> interval_not_zero (lo, hi)`, SIMP_TAC[interval_not_zero]);; + + +let check_interval_not_zero int_tm = + let lo, hi = dest_pair int_tm in + let inst = INST[lo, lo_var_real; hi, hi_var_real] in + let s1, _, _ = dest_float lo in + if s1 = "F" then + let gt_th = float_gt0 lo in + if (fst o dest_const o rand o concl) gt_th <> "T" then + failwith "check_interval_not_zero: &0 < lo <=> F" + else + (MY_PROVE_HYP gt_th o inst) INTERVAL_NOT_ZERO1' + else + let lt_th = float_lt0 hi in + if (fst o dest_const o rand o concl) lt_th <> "T" then + failwith "check_interval_not_zero: hi < &0 <=> F" + else + (MY_PROVE_HYP lt_th o inst) INTERVAL_NOT_ZERO2';; + + + +(*************************************) +(* interval_pos *) + +let INTERVAL_POS' = (UNDISCH_ALL o prove) + (`(&0 < lo <=> T) ==> interval_pos (lo, hi:real)`, SIMP_TAC[interval_pos]);; + + +let check_interval_pos int_tm = + let lo, hi = dest_pair int_tm in + let gt_th = float_gt0 lo in + if (fst o dest_const o rand o concl) gt_th <> "T" then + failwith "check_interval_pos: &0 < lo <=> F" + else + (MY_PROVE_HYP gt_th o INST[lo, lo_var_real; hi, hi_var_real]) INTERVAL_POS';; + + + +(************************************) +(* check_interval_iabs *) + + +(* proves |- iabs int < rhs <=> T *) +let check_interval_iabs int_tm rhs_tm = + let iabs_eq = float_iabs int_tm in + let lt_th = float_lt (rand (concl iabs_eq)) rhs_tm in + if (fst o dest_const o rand o concl) lt_th <> "T" then + failwith "check_interval_iabs: iabs < rhs <=> F" + else + let th0 = AP_THM (AP_TERM lt_op_real iabs_eq) rhs_tm in + TRANS th0 lt_th;; + + + +(****************************) +(* inv *) + +let INV_EQ_DIV_LEMMA = prove(`&1 / x = inv x`, REWRITE_TAC[real_div; REAL_MUL_LID]);; + + +let float_interval_inv pp th = + let x_tm = (rand o rator o concl) th in + let div_th = INST[x_tm, x_var_real] INV_EQ_DIV_LEMMA in + let th0 = float_interval_div pp one_interval th in + let lhs, rhs = dest_comb (concl th0) in + let lhs2, rhs2 = dest_comb lhs in + EQ_MP (AP_THM (AP_TERM lhs2 div_th) rhs) th0;; + + +(* Explicit representation of inv(&2) *) +let float_inv2_th = + let one_float_eq_one = FLOAT_TO_NUM_CONV one_float in + let inv2_eq_lemma = prove(`interval_arith (&2 * x) (&1, &1) ==> inv (&2) = x`, + REWRITE_TAC[interval_arith] THEN CONV_TAC REAL_FIELD) in + let half_tm = (fst o dest_pair o rand o concl) (float_interval_inv 1 two_interval) in + let half_interval = mk_const_interval half_tm in + let mul_th = REWRITE_RULE[one_float_eq_one] (float_interval_mul 2 two_interval half_interval) in + MATCH_MP inv2_eq_lemma mul_th;; + +let float_inv2 = rand (concl float_inv2_th);; +let inv2_interval = mk_const_interval float_inv2;; + + + +(*****************************************) +(* bounded_on_int *) + +let norm_derivative d_th eq_th = + let lhs, rhs = (dest_eq o concl) d_th in + let lhs2, rhs2 = dest_comb lhs in + let th0 = AP_THM (AP_TERM (rator lhs2) eq_th) rhs2 in + TRANS (SYM th0) d_th;; + +let norm_diff d_th eq_th = + let lhs, rhs = (dest_comb o concl) d_th in + let th0 = AP_THM (AP_TERM (rator lhs) eq_th) rhs in + EQ_MP th0 d_th;; + +let norm_interval int_th eq_th = + let lhs, rhs = (dest_comb o concl) int_th in + let th0 = AP_THM (AP_TERM (rator lhs) eq_th) rhs in + EQ_MP (SYM th0) int_th;; + +let norm_second_derivative th eq_th = + let lhs, dd_bounds = dest_comb (concl th) in + let lhs2, int_tm = dest_comb lhs in + let th0 = AP_THM (AP_THM (AP_TERM (rator lhs2) eq_th) int_tm) dd_bounds in + EQ_MP th0 th;; + +let norm_lin_approx th eq_th = + let lhs, df_bounds = dest_comb (concl th) in + let lhs2, f_bounds = dest_comb lhs in + let lhs3, x_tm = dest_comb lhs2 in + let th0 = AP_THM (AP_THM (AP_THM (AP_TERM (rator lhs3) eq_th) x_tm) f_bounds) df_bounds in + EQ_MP th0 th;; + + + +let BOUNDED_ON_INT = (UNDISCH_ALL o prove)(`(!x. interval_arith x int ==> + interval_arith (f x) f_bounds) + ==> bounded_on_int f int f_bounds`, + REWRITE_TAC[bounded_on_int; interval_arith]);; + + +let BOUNDED_ON_INT_DEST = (UNDISCH_ALL o prove)(`bounded_on_int f int f_bounds ==> + (!x. interval_arith x int ==> interval_arith (f x) f_bounds)`, + REWRITE_TAC[bounded_on_int; interval_arith]);; + + +(* Given a theorem (interval_arith x int |- interval_arith (f x) f_bounds), yields + |- bounded_on_int (\x. f x) int f_bounds *) +let mk_bounded_on_int th = + let int_tm = (rand o hd o hyp) th in + let lhs, f_bounds_tm = dest_comb (concl th) in + let lhs2, rhs2 = dest_comb lhs in + let f_tm = mk_abs (x_var_real, rhs2) in + let b_th0 = (SYM o BETA_CONV) (mk_comb (f_tm , x_var_real)) in + let b_th1 = AP_THM (AP_TERM lhs2 b_th0) f_bounds_tm in + let th2 = EQ_MP b_th1 th in + let th3 = DISCH_ALL th2 in + let th4 = GEN x_var_real th3 in + let th_int = INST[int_tm, int_var; f_bounds_tm, f_bounds_var; + f_tm, f_var_fun] BOUNDED_ON_INT in + MY_PROVE_HYP th4 th_int;; + + +let dest_bounded_on_int th = + let lhs, f_bounds = dest_comb (concl th) in + let lhs2, int_tm = dest_comb lhs in + let f_tm = rand lhs2 in + let th0 = INST[f_tm, f_var_fun; int_tm, int_var; f_bounds, f_bounds_var] BOUNDED_ON_INT_DEST in + let th1 = UNDISCH_ALL (SPEC x_var_real (MY_PROVE_HYP th th0)) in + if is_abs f_tm then + let f_tm = (rand o rator o concl) th1 in + let eq_th = BETA_CONV f_tm in + norm_interval th1 (SYM eq_th) + else + th1;; + + +let dest_bounded_on_int_raw th = + let lhs, f_bounds = dest_comb (concl th) in + let lhs2, int_tm = dest_comb lhs in + let f_tm = rand lhs2 in + let th0 = INST[f_tm, f_var_fun; int_tm, int_var; f_bounds, f_bounds_var] BOUNDED_ON_INT_DEST in + UNDISCH_ALL (SPEC x_var_real (MY_PROVE_HYP th th0));; + + +(***********************************) +(* bounded_on_int arithmetic *) + +let bounded_on_int_scale pp c_tm th = + let i_th = dest_bounded_on_int th in + let th0 = float_interval_scale pp c_tm i_th in + mk_bounded_on_int th0;; + + +let bounded_on_int_mul_int pp int_th th = + let i_th = dest_bounded_on_int th in + let th0 = float_interval_mul pp int_th i_th in + mk_bounded_on_int th0;; + + +let bounded_on_int_neg th1 = + let i_th = dest_bounded_on_int th1 in + let th0 = float_interval_neg i_th in + mk_bounded_on_int th0;; + + +let bounded_on_int_add pp th1 th2 = + let i_th1, i_th2 = dest_bounded_on_int th1, dest_bounded_on_int th2 in + let th0 = float_interval_add pp i_th1 i_th2 in + mk_bounded_on_int th0;; + + +let bounded_on_int_sub pp th1 th2 = + let i_th1, i_th2 = dest_bounded_on_int th1, dest_bounded_on_int th2 in + let th0 = float_interval_sub pp i_th1 i_th2 in + mk_bounded_on_int th0;; + + +let bounded_on_int_mul pp th1 th2 = + let i_th1, i_th2 = dest_bounded_on_int th1, dest_bounded_on_int th2 in + let th0 = float_interval_mul pp i_th1 i_th2 in + mk_bounded_on_int th0;; + + +let bounded_on_int_mul_raw pp th1 th2 = + let i_th1, i_th2 = dest_bounded_on_int_raw th1, dest_bounded_on_int_raw th2 in + let th0 = float_interval_mul pp i_th1 i_th2 in + mk_bounded_on_int th0;; + + + +let bounded_on_int_div pp th1 th2 = + let i_th1, i_th2 = dest_bounded_on_int th1, dest_bounded_on_int th2 in + let th0 = float_interval_div pp i_th1 i_th2 in + mk_bounded_on_int th0;; + + +(************************************) +let ADD_INEQ_HI = (RULE o REAL_ARITH) `x1 <= y1 /\ x2 <= y2 /\ y1 + y2 <= y ==> x1 + x2 <= y`;; +let ADD_INEQ_LO = (RULE o REAL_ARITH) `x1 <= y1 /\ x2 <= y2 /\ x <= x1 + x2 ==> x <= y1 + y2`;; +let SUB_INEQ_HI = (RULE o REAL_ARITH) `x1 <= y1 /\ y2 <= x2 /\ y1 - y2 <= y ==> x1 - x2 <= y`;; +let SUB_INEQ_LO = (RULE o REAL_ARITH) `x1 <= y1 /\ y2 <= x2 /\ x <= x1 - x2 ==> x <= y1 - y2`;; +let MUL_INEQ_HI = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove) + (`&0 <= x1 /\ &0 <= x2 /\ x1 <= y1 /\ x2 <= y2 /\ y1 * y2 <= y ==> x1 * x2 <= y`, + DISCH_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `y1 * y2` THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN ASM_REWRITE_TAC[]);; + +let MUL_INEQ_POS_CONST_HI = (UNDISCH_ALL o prove) + (`(&0 <= x <=> T) ==> y1 <= y2 ==> x * y2 <= z ==> x * y1 <= z`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `x * y2` THEN + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LE_LMUL THEN ASM_REWRITE_TAC[]);; + + +let mk_refl_ineq = + let REAL_LE_REFL' = RULE REAL_LE_REFL in + fun tm -> INST[tm, x_var_real] REAL_LE_REFL';; + +let dest_le_op ineq = + let lhs, y_tm = dest_comb ineq in + (rand lhs, y_tm);; + + +let mul_ineq_pos_const_hi pp c_tm ineq = + let y1_tm, y2_tm = dest_le_op (concl ineq) in + let ge0_th = float_ge0 c_tm in + let mul_hi_th = float_mul_hi pp c_tm y2_tm in + let z_tm = (rand o concl) mul_hi_th in + (MY_PROVE_HYP ge0_th o MY_PROVE_HYP ineq o MY_PROVE_HYP mul_hi_th o + INST[c_tm, x_var_real; y1_tm, y1_var_real; y2_tm, y2_var_real; z_tm, z_var_real]) + MUL_INEQ_POS_CONST_HI;; + + +let mul_ineq_hi pp ineq1 ineq2 = + let x1_tm, y1_tm = dest_le_op (concl ineq1) in + let x2_tm, y2_tm = dest_le_op (concl ineq2) in + let x1_pos, x2_pos = float_pos x1_tm, float_pos x2_tm in + let rhs_mul = float_mul_hi pp y1_tm y2_tm in + let y_tm = (rand o concl) rhs_mul in + let th0 = INST[x1_tm, x1_var_real; y1_tm, y1_var_real; + x2_tm, x2_var_real; y2_tm, y2_var_real; + y_tm, y_var_real] MUL_INEQ_HI in + (MY_PROVE_HYP x1_pos o MY_PROVE_HYP x2_pos o MY_PROVE_HYP ineq1 o + MY_PROVE_HYP ineq2 o MY_PROVE_HYP rhs_mul) th0;; + + + +let sub_ineq_hi pp ineq1 ineq2 = + let x1_tm, y1_tm = dest_le_op (concl ineq1) in + let y2_tm, x2_tm = dest_le_op (concl ineq2) in + let rhs_sub = float_sub_hi pp y1_tm y2_tm in + let y_tm = (rand o concl) rhs_sub in + let th0 = INST[x1_tm, x1_var_real; y1_tm, y1_var_real; + x2_tm, x2_var_real; y2_tm, y2_var_real; + y_tm, y_var_real] SUB_INEQ_HI in + MY_PROVE_HYP ineq1 (MY_PROVE_HYP ineq2 (MY_PROVE_HYP rhs_sub th0));; + + +let sub_ineq_lo pp ineq1 ineq2 = + let x1_tm, y1_tm = dest_le_op (concl ineq1) in + let y2_tm, x2_tm = dest_le_op (concl ineq2) in + let lhs_sub = float_sub_lo pp x1_tm x2_tm in + let x_tm = (lhand o concl) lhs_sub in + let th0 = INST[x1_tm, x1_var_real; y1_tm, y1_var_real; + x2_tm, x2_var_real; y2_tm, y2_var_real; + x_tm, x_var_real] SUB_INEQ_LO in + MY_PROVE_HYP ineq1 (MY_PROVE_HYP ineq2 (MY_PROVE_HYP lhs_sub th0));; + + +let add_ineq_hi pp ineq1 ineq2 = + let x1_tm, y1_tm = dest_le_op (concl ineq1) in + let x2_tm, y2_tm = dest_le_op (concl ineq2) in + let rhs_sum = float_add_hi pp y1_tm y2_tm in + let y_tm = (rand o concl) rhs_sum in + let th0 = INST[x1_tm, x1_var_real; y1_tm, y1_var_real; + x2_tm, x2_var_real; y2_tm, y2_var_real; + y_tm, y_var_real] ADD_INEQ_HI in + MY_PROVE_HYP ineq1 (MY_PROVE_HYP ineq2 (MY_PROVE_HYP rhs_sum th0));; + + +let add_ineq_lo pp ineq1 ineq2 = + let x1_tm, y1_tm = dest_le_op (concl ineq1) in + let x2_tm, y2_tm = dest_le_op (concl ineq2) in + let lhs_sum = float_add_lo pp x1_tm x2_tm in + let x_tm = (lhand o concl) lhs_sum in + let th0 = INST[x1_tm, x1_var_real; y1_tm, y1_var_real; + x2_tm, x2_var_real; y2_tm, y2_var_real; + x_tm, x_var_real] ADD_INEQ_LO in + MY_PROVE_HYP ineq1 (MY_PROVE_HYP ineq2 (MY_PROVE_HYP lhs_sum th0));; + + +end;; diff --git a/formal_ineqs/arith/nat.hl b/formal_ineqs/arith/nat.hl new file mode 100644 index 0000000..865448b --- /dev/null +++ b/formal_ineqs/arith/nat.hl @@ -0,0 +1,106 @@ +(* =========================================================== *) +(* Formal natural number arithmetic *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +(* Dependencies *) +needs "arith_options.hl";; +needs "arith/arith_cache.hl";; + +module Arith_nat = struct + +open Arith_options;; + +(* mk *) +let mk_small_numeral_array = Arith_hash.mk_small_numeral_array;; +let mk_numeral_array = Arith_hash.mk_numeral_array;; +let NUMERAL_TO_NUM_CONV = Arith_hash.NUMERAL_TO_NUM_CONV;; +let NUM_TO_NUMERAL_CONV = Arith_hash.NUM_TO_NUMERAL_CONV;; + +(* dest *) +let raw_dest_hash = Arith_hash.raw_dest_hash;; + +(* SUC *) +let raw_suc_conv_hash = + if !cached then Arith_cache.raw_suc_conv_hash else Arith_hash.raw_suc_conv_hash;; + +let NUM_SUC_HASH_CONV = Arith_hash.NUM_SUC_HASH_CONV;; + +(* x = 0 *) +let raw_eq0_hash_conv = + if !cached then Arith_cache.raw_eq0_hash_conv else Arith_hash.raw_eq0_hash_conv;; + +let NUM_EQ0_HASH_CONV = Arith_hash.NUM_EQ0_HASH_CONV;; + +(* PRE *) +let raw_pre_hash_conv = + if !cached then Arith_cache.raw_pre_hash_conv else Arith_hash.raw_pre_hash_conv;; + +let NUM_PRE_HASH_CONV = Arith_hash.NUM_PRE_HASH_CONV;; + +(* x > 0 *) +let raw_gt0_hash_conv = + if !cached then Arith_cache.raw_gt0_hash_conv else Arith_hash.raw_gt0_hash_conv;; + +let NUM_GT0_HASH_CONV = Arith_hash.NUM_GT0_HASH_CONV;; + +(* x = y *) +let raw_eq_hash_conv = Arith_hash.raw_eq_hash_conv;; +let NUM_EQ_HASH_CONV = Arith_hash.NUM_EQ_HASH_CONV;; + +(* x < y, x <= y *) +let raw_lt_hash_conv = + if !cached then Arith_cache.raw_lt_hash_conv else Arith_hash.raw_lt_hash_conv;; + +let raw_le_hash_conv = + if !cached then Arith_cache.raw_le_hash_conv else Arith_hash.raw_le_hash_conv;; + +let NUM_LT_HASH_CONV = Arith_hash.NUM_LT_HASH_CONV;; + +let NUM_LE_HASH_CONV = Arith_hash.NUM_LE_HASH_CONV;; + +(* x + y *) +let raw_add_conv_hash = + if !cached then Arith_cache.raw_add_conv_hash else Arith_hash.raw_add_conv_hash;; + +let NUM_ADD_HASH_CONV = Arith_hash.NUM_ADD_HASH_CONV;; + +(* x - y *) +let raw_sub_hash_conv = + if !cached then Arith_cache.raw_sub_hash_conv else Arith_hash.raw_sub_hash_conv;; + +let raw_sub_and_le_hash_conv = + if !cached then Arith_cache.raw_sub_and_le_hash_conv else Arith_hash.raw_sub_and_le_hash_conv;; + +let NUM_SUB_HASH_CONV = Arith_hash.NUM_SUB_HASH_CONV;; + +(* x * y *) +let raw_mul_conv_hash = + if !cached then Arith_cache.raw_mul_conv_hash else Arith_hash.raw_mul_conv_hash;; + +let NUM_MULT_HASH_CONV = Arith_hash.NUM_MULT_HASH_CONV;; + +(* x / y *) +let raw_div_hash_conv = + if !cached then Arith_cache.raw_div_hash_conv else Arith_hash.raw_div_hash_conv;; + +let NUM_DIV_HASH_CONV = Arith_hash.NUM_DIV_HASH_CONV;; + +(* EVEN, ODD *) +let raw_even_hash_conv = + if !cached then Arith_cache.raw_even_hash_conv else Arith_hash.raw_even_hash_conv;; + +let raw_odd_hash_conv = + if !cached then Arith_cache.raw_odd_hash_conv else Arith_hash.raw_odd_hash_conv;; + +let NUM_EVEN_HASH_CONV = Arith_hash.NUM_EVEN_HASH_CONV;; + +let NUM_ODD_HASH_CONV = Arith_hash.NUM_ODD_HASH_CONV;; + + +let NUMERALS_TO_NUM = + PURE_REWRITE_RULE[Arith_hash.NUM_THM] o CONV_RULE (DEPTH_CONV NUMERAL_TO_NUM_CONV);; + + +end;; diff --git a/formal_ineqs/arith/num_exp_theory.hl b/formal_ineqs/arith/num_exp_theory.hl new file mode 100644 index 0000000..6e7ea1b --- /dev/null +++ b/formal_ineqs/arith/num_exp_theory.hl @@ -0,0 +1,251 @@ +(* =========================================================== *) +(* Exponential representation of natural numbers *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +(* Dependencies *) +needs "arith/nat.hl";; + + +module Num_exp_theory = struct + +let base_const = mk_small_numeral Arith_hash.arith_base;; + +(* num_exp definition *) +let num_exp_tm = mk_eq (`(num_exp:num->num->num) n e`, + mk_binop `( * ):num->num->num` `n:num` (mk_binop `EXP` base_const `e:num`));; +(* let num_exp = new_definition `num_exp n e = n * 2 EXP e`;; *) +let num_exp = new_definition num_exp_tm;; + +(**********************************) +(* Theorems *) + +let NUM_EXP_EXP = prove(`!n e1 e2. num_exp (num_exp n e1) e2 = num_exp n (e1 + e2)`, + REPEAT GEN_TAC THEN + REWRITE_TAC[num_exp; EXP_ADD] THEN + ARITH_TAC);; + +let NUM_EXP_SUM = prove(`!n e1 e2. num_exp n (e1 + e2) = num_exp n e1 * num_exp 1 e2`, + REPEAT GEN_TAC THEN + REWRITE_TAC[num_exp; EXP_ADD] THEN + ARITH_TAC);; + +let NUM_EXP_SUM1 = prove(`!n e1 e2. num_exp n (e1 + e2) = num_exp 1 e1 * num_exp n e2`, + REPEAT GEN_TAC THEN REWRITE_TAC[num_exp; EXP_ADD] THEN ARITH_TAC);; + +let NUM_EXP_0 = prove(`!n. n = num_exp n 0`, + GEN_TAC THEN REWRITE_TAC[num_exp; EXP; MULT_CLAUSES]);; + +let NUM_EXP_LE = prove(`!m n e. m <= n ==> num_exp m e <= num_exp n e`, + SIMP_TAC[num_exp; LE_MULT_RCANCEL]);; + +let NUM_EXP_LT = prove(`!m n e. m < n ==> num_exp m e < num_exp n e`, + SIMP_TAC[num_exp; LT_MULT_RCANCEL; EXP_EQ_0] THEN + ARITH_TAC);; + +let NUM_EXP_EQ_0 = prove(`!n e. num_exp n e = 0 <=> n = 0`, + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[num_exp; MULT_EQ_0; EXP_EQ_0] THEN + ARITH_TAC);; + +let NUM_EXP_MUL = prove(`!n1 e1 n2 e2. num_exp n1 e1 * num_exp n2 e2 = num_exp (n1 * n2) (e1 + e2)`, + REWRITE_TAC[num_exp; EXP_ADD] THEN ARITH_TAC);; + +let NUM_EXP_ADD = prove(`!n1 e1 n2 e2. e1 <= e2 ==> + num_exp n1 e1 + num_exp n2 e2 = num_exp (n1 + num_exp n2 (e2 - e1)) e1`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[num_exp] THEN + REWRITE_TAC[ARITH_RULE `(a + b * c) * d = a * d + b * (c * d):num`] THEN + REWRITE_TAC[GSYM EXP_ADD] THEN + ASM_SIMP_TAC[ARITH_RULE `e1 <= e2 ==> e2 - e1 + e1 = e2:num`]);; + +let NUM_EXP_SUB2 = prove(`!n1 e1 n2 e2 r. e1 <= e2 /\ e2 - e1 = r ==> + num_exp n1 e1 - num_exp n2 e2 = num_exp (n1 - num_exp n2 r) e1`, + REPEAT STRIP_TAC THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[num_exp] THEN + MP_TAC (ARITH_RULE `e1 <= e2 ==> e2 = (e2 - e1) + e1:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [th]) THEN + REWRITE_TAC[EXP_ADD; MULT_ASSOC] THEN + REWRITE_TAC[GSYM RIGHT_SUB_DISTRIB]);; + +let NUM_EXP_SUB1 = prove(`!n1 e1 n2 e2 r. e2 <= e1 /\ e1 - e2 = r ==> + num_exp n1 e1 - num_exp n2 e2 = num_exp (num_exp n1 r - n2) e2`, + REPEAT STRIP_TAC THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[num_exp] THEN + MP_TAC (ARITH_RULE `e2 <= e1 ==> e1 = (e1 - e2) + e2:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [th]) THEN + REWRITE_TAC[EXP_ADD; MULT_ASSOC] THEN + REWRITE_TAC[GSYM RIGHT_SUB_DISTRIB]);; + +(* NUM_EXP_LE *) + +let NUM_EXP_LE1 = prove(`!n1 e1 n2 e2 r. e2 <= e1 /\ e1 - e2 = r /\ n2 <= num_exp n1 r + ==> num_exp n2 e2 <= num_exp n1 e1`, + REPEAT GEN_TAC THEN REWRITE_TAC[num_exp] THEN + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN DISCH_TAC THEN + MP_TAC (ARITH_RULE `e2 <= e1 ==> e1 = (e1 - e2) + e2:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN(fun th -> ONCE_REWRITE_TAC[th]) THEN + REWRITE_TAC[EXP_ADD; MULT_ASSOC] THEN + ASM_REWRITE_TAC[LE_MULT_RCANCEL]);; + +let NUM_EXP_LE2 = prove(`!n1 e1 n2 e2 r. e1 <= e2 /\ e2 - e1 = r /\ num_exp n2 r <= n1 + ==> num_exp n2 e2 <= num_exp n1 e1`, + REPEAT GEN_TAC THEN REWRITE_TAC[num_exp] THEN + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN DISCH_TAC THEN + MP_TAC (ARITH_RULE `e1 <= e2 ==> e2 = (e2 - e1) + e1:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN(fun th -> ONCE_REWRITE_TAC[th]) THEN + REWRITE_TAC[EXP_ADD; MULT_ASSOC] THEN + ASM_REWRITE_TAC[LE_MULT_RCANCEL]);; + +let NUM_EXP_LE1_EQ = prove(`!n1 e1 n2 e2 r x. e2 <= e1 /\ e1 - e2 = r /\ num_exp n1 r = x ==> + (num_exp n1 e1 <= num_exp n2 e2 <=> x <= n2)`, + REPEAT GEN_TAC THEN REWRITE_TAC[num_exp] THEN + STRIP_TAC THEN + REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + MP_TAC (ARITH_RULE `e2 <= e1 ==> e1 = (e1 - e2) + e2:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [th]) THEN + REWRITE_TAC[EXP_ADD; MULT_ASSOC] THEN + ASM_REWRITE_TAC[LE_MULT_RCANCEL; EXP_EQ_0; ARITH_EQ]);; + +let NUM_EXP_LE2_EQ = prove(`!n1 e1 n2 e2 r x. e1 <= e2 /\ e2 - e1 = r /\ num_exp n2 r = x ==> + (num_exp n1 e1 <= num_exp n2 e2 <=> n1 <= x)`, + REPEAT GEN_TAC THEN REWRITE_TAC[num_exp] THEN + STRIP_TAC THEN + REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + MP_TAC (ARITH_RULE `e1 <= e2 ==> e2 = (e2 - e1) + e1:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [th]) THEN + REWRITE_TAC[EXP_ADD; MULT_ASSOC] THEN + ASM_REWRITE_TAC[LE_MULT_RCANCEL; EXP_EQ_0; ARITH_EQ]);; + +(* NUM_EXP_LT *) + +let NUM_EXP_LT1 = prove(`!n1 e1 n2 e2 r. e2 <= e1 /\ e1 - e2 = r /\ n2 < num_exp n1 r + ==> num_exp n2 e2 < num_exp n1 e1`, + REPEAT GEN_TAC THEN REWRITE_TAC[num_exp] THEN + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN DISCH_TAC THEN + MP_TAC (ARITH_RULE `e2 <= e1 ==> e1 = (e1 - e2) + e2:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th]) THEN + REWRITE_TAC[EXP_ADD; MULT_ASSOC] THEN + ASM_REWRITE_TAC[LT_MULT_RCANCEL; EXP_EQ_0; ARITH_EQ]);; + +let NUM_EXP_LT2 = prove(`!n1 e1 n2 e2 r. e1 <= e2 /\ e2 - e1 = r /\ num_exp n2 r < n1 + ==> num_exp n2 e2 < num_exp n1 e1`, + REPEAT GEN_TAC THEN REWRITE_TAC[num_exp] THEN + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN DISCH_TAC THEN + MP_TAC (ARITH_RULE `e1 <= e2 ==> e2 = (e2 - e1) + e1:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th]) THEN + REWRITE_TAC[EXP_ADD; MULT_ASSOC] THEN + ASM_REWRITE_TAC[LT_MULT_RCANCEL; EXP_EQ_0; ARITH_EQ]);; + +let NUM_EXP_LT1_EQ = prove(`!n1 e1 n2 e2 r x. e2 <= e1 /\ e1 - e2 = r /\ num_exp n1 r = x ==> + (num_exp n1 e1 < num_exp n2 e2 <=> x < n2)`, + REPEAT GEN_TAC THEN REWRITE_TAC[num_exp] THEN + STRIP_TAC THEN + REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + MP_TAC (ARITH_RULE `e2 <= e1 ==> e1 = (e1 - e2) + e2:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [th]) THEN + REWRITE_TAC[EXP_ADD; MULT_ASSOC] THEN + ASM_REWRITE_TAC[LT_MULT_RCANCEL; EXP_EQ_0; ARITH_EQ]);; + +let NUM_EXP_LT2_EQ = prove(`!n1 e1 n2 e2 r x. e1 <= e2 /\ e2 - e1 = r /\ num_exp n2 r = x ==> + (num_exp n1 e1 < num_exp n2 e2 <=> n1 < x)`, + REPEAT GEN_TAC THEN REWRITE_TAC[num_exp] THEN + STRIP_TAC THEN + REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + MP_TAC (ARITH_RULE `e1 <= e2 ==> e2 = (e2 - e1) + e1:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [th]) THEN + REWRITE_TAC[EXP_ADD; MULT_ASSOC] THEN + ASM_REWRITE_TAC[LT_MULT_RCANCEL; EXP_EQ_0; ARITH_EQ]);; + +(* NUM_EXP_DIV *) + +let mul_op_num = `( * ):num->num->num`;; + +let NUM_EXP_DIV1 = prove(`~(n2 = 0) /\ e2 <= e1 ==> + num_exp n1 e1 DIV num_exp n2 e2 = num_exp n1 (e1 - e2) DIV n2`, + STRIP_TAC THEN + (*`num_exp n1 e1 = 16 EXP e2 * num_exp n1 (e1 - e2)` MP_TAC THENL*) + SUBGOAL_THEN (mk_eq(`num_exp n1 e1`, mk_binop mul_op_num (mk_binop `EXP` base_const `e2:num`) `num_exp n1 (e1 - e2)`)) MP_TAC THENL + [ + REWRITE_TAC[num_exp] THEN + ONCE_REWRITE_TAC[ARITH_RULE `a * b * c = b * (a * c:num)`] THEN + REWRITE_TAC[GSYM EXP_ADD] THEN + ASM_SIMP_TAC[ARITH_RULE `e2 <= e1 ==> e2 + e1 - e2 = e1:num`]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + SUBGOAL_THEN (mk_eq(`num_exp n2 e2`, mk_binop mul_op_num (mk_binop `EXP` base_const `e2:num`) `n2:num`)) MP_TAC THENL + [ + REWRITE_TAC[num_exp; MULT_AC]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MATCH_MP_TAC DIV_MULT2 THEN + ASM_REWRITE_TAC[MULT_EQ_0; DE_MORGAN_THM; EXP_EQ_0] THEN + ARITH_TAC);; + +let NUM_EXP_DIV2 = prove(`~(n2 = 0) /\ e1 <= e2 ==> + num_exp n1 e1 DIV num_exp n2 e2 = n1 DIV num_exp n2 (e2 - e1)`, + STRIP_TAC THEN + (*`num_exp n2 e2 = 16 EXP e1 * num_exp n2 (e2 - e1)` MP_TAC THENL*) + SUBGOAL_THEN (mk_eq(`num_exp n2 e2`, mk_binop mul_op_num (mk_binop `EXP` base_const `e1:num`) `num_exp n2 (e2 - e1)`)) MP_TAC THENL + [ + REWRITE_TAC[num_exp] THEN + ONCE_REWRITE_TAC[ARITH_RULE `a * b * c = b * (a * c:num)`] THEN + REWRITE_TAC[GSYM EXP_ADD] THEN + ASM_SIMP_TAC[ARITH_RULE `e1 <= e2 ==> e1 + e2 - e1 = e2:num`]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + SUBGOAL_THEN (mk_eq(`num_exp n1 e1`, mk_binop mul_op_num (mk_binop `EXP` base_const `e1:num`) `n1:num`)) MP_TAC THENL + [ + REWRITE_TAC[num_exp; MULT_AC]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MATCH_MP_TAC DIV_MULT2 THEN + ASM_REWRITE_TAC[num_exp; MULT_EQ_0; DE_MORGAN_THM; EXP_EQ_0] THEN + ARITH_TAC);; + + +let EXP_INV_lemma = prove(`!n e1 e2. ~(n = 0) /\ e2 <= e1 ==> &(n EXP (e1 - e2)) = + &(n EXP e1) * inv(&(n EXP e2))`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[GSYM REAL_OF_NUM_POW] THEN + MP_TAC (SPECL [`&n`; `e2:num`; `e1:num`] REAL_POW_SUB) THEN + ASM_REWRITE_TAC[REAL_OF_NUM_EQ; real_div]);; + +let NUM_EXP_SUB_lemma = prove(`!n e1 e2. e2 <= e1 ==> &(num_exp n (e1 - e2)) = + &(num_exp n e1) * inv(&(num_exp 1 e2))`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[num_exp] THEN + REWRITE_TAC[GSYM REAL_OF_NUM_MUL] THEN + MP_TAC (SPECL [base_const; `e1:num`; `e2:num`] EXP_INV_lemma) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REAL_ARITH_TAC);; + + + +end;; diff --git a/formal_ineqs/arith_options.hl b/formal_ineqs/arith_options.hl new file mode 100644 index 0000000..7c3e787 --- /dev/null +++ b/formal_ineqs/arith_options.hl @@ -0,0 +1,25 @@ +(* =========================================================== *) +(* Options of the arithmetic library *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +module Arith_options = struct + +(* Base of arithmetic operations with natural numbers *) +(* The base should be even in order to represent inv(2) exactly *) +let base = ref 100;; +(* If true then results of natural number operations are cached *) +let cached = ref true;; +(* Initial size of the cache *) +let init_cache_size = ref 10000;; +(* Maximal size of the cache *) +let max_cache_size = ref 20000;; + +(* Minimal exponent value for floating point numbers *) +(* (should be even for the square root operation) *) +let min_exp = ref 50;; +(* If true, then arithmetic operations with floating point numbers are cached *) +let float_cached = ref true;; + +end;; diff --git a/formal_ineqs/examples.hl b/formal_ineqs/examples.hl new file mode 100644 index 0000000..84e2494 --- /dev/null +++ b/formal_ineqs/examples.hl @@ -0,0 +1,74 @@ +(* Several simple examples *) + +(* Set up the loading path: +load_path := "path to the formal_ineqs directory" :: !load_path;; +*) + +(* Change default arithmetic options before loading other libraries *) +(* (arithmetic options cannot be changed later) *) +needs "arith_options.hl";; + +(* Set the base of natural number arithmetic to 200 *) +Arith_options.base := 200;; + +(* Load all verification libraries *) +(* Note: the verification library loads Multivariate/realanalysis.ml, + so it is recommended to use a checkpointed version of HOL Light + with preloaded realanalysis.ml *) +needs "verifier/m_verifier_main.hl";; + +(* + Set the level of info/debug printing: + 0 - no info/debug printing + 1 - report important steps (default) + 2 - report everything +*) +needs "verifier_options.hl";; +Verifier_options.info_print_level := 1;; + +(* Open the main verification module *) +open M_verifier_main;; + + +(* Several simple tests *) + +(* default_params: default verification parameters *) +(* 5: precision parameter for floating point arithmetic *) +let test1 () = + verify_ineq default_params 5 `sqrt(pi) < #1.773`;; + +let test2 () = + verify_ineq default_params 11 `#1.230959417 < acs(&1 / &3)`;; + +let test3 () = + verify_ineq default_params 11 `#1.230959418 > acs(&1 / &3)`;; + +(* An approximation of atn *) +let test4 () = + let ineq1 = `&0 <= x /\ x <= &1 ==> atn x - x / (&1 + #0.28 * x * x) < #0.005` in + let ineq2 = `&0 <= x /\ x <= &1 ==> -- #0.005 < atn x - x / (&1 + #0.28 * x * x)` in + [verify_ineq default_params 5 ineq1; + verify_ineq default_params 6 ineq2];; + +(* A polynomial approximation of atn *) +(* Taken from: *) +(* Marc Daumas, David Lester, and César Muñoz, + Verified real number calculations: A library for interval arithmetic, + IEEE Transactions on Computers, Volume 58, Number 2, 2009. *) +let test5 () = + let ineq1 = `-- &1 / &30 <= x /\ x <= &1 / &30 ==> x * (&1 - (x * x) * (&11184811 / &33554432 - (x * x) * (&13421773 / &67108864))) - atn x < #0.1 pow 7` in + let ineq2 = `-- &1 / &30 <= x /\ x <= &1 / &30 ==> -- (#0.1 pow 7) < x * (&1 - (x * x) * (&11184811 / &33554432 - (x * x) * (&13421773 / &67108864))) - atn x` in + [verify_ineq default_params 5 ineq1; + verify_ineq default_params 5 ineq2];; + + +(* Returns a list of theorems with verification information *) +let run_tests () = + [test1(); test2(); test3()] @ test4() @ test5();; + +(* Returns a list of theorems *) +let results () = + map fst (run_tests ());; + + +results();; diff --git a/formal_ineqs/examples_flyspeck.hl b/formal_ineqs/examples_flyspeck.hl new file mode 100644 index 0000000..539be1e --- /dev/null +++ b/formal_ineqs/examples_flyspeck.hl @@ -0,0 +1,326 @@ +(* Some inequalities from the Flyspeck project *) +(* http://code.google.com/p/flyspeck/ *) + +(* Set up the loading path: +load_path := "path to the formal_ineqs directory" :: !load_path;; +*) + +(* Change default arithmetic options before loading other libraries *) +(* (arithmetic options cannot be changed later) *) +needs "arith_options.hl";; + +(* Set the base of natural number arithmetic to 200 *) +Arith_options.base := 200;; + +(* Load all verification libraries *) +(* Note: the verification library loads Multivariate/realanalysis.ml, + so it is recommended to use a checkpointed version of HOL Light + with preloaded realanalysis.ml *) +needs "verifier/m_verifier_main.hl";; + +(* + Set the level of info/debug printing: + 0 - no info/debug printing + 1 - report important steps (default) + 2 - report everything +*) +needs "verifier_options.hl";; +Verifier_options.info_print_level := 1;; + +(* Open the main verification module *) +open M_verifier_main;; + + + + +(************************) +(* Flyspeck definitions *) + + +(* ineq *) +let ineq = define + `(!c. ineq [] c <=> c) + /\ (!a x b xs c. ineq (CONS (a,x,b) xs) c <=> a <= x /\ x <= b ==> ineq xs c)`;; + +(* A modified (only one case is considered, x > 0) definition of atn2 *) +(* Add ' to some definitions to avoid conflicts with original Flyspeck definitions *) +let atn2' = new_definition `atn2'(x,y) = atn(y / x)` + + +(* delta_x *) +let delta_x = new_definition (`delta_x x1 x2 x3 x4 x5 x6 = + x1*x4*(--x1 + x2 + x3 -x4 + x5 + x6) + + x2*x5*(x1 - x2 + x3 + x4 -x5 + x6) + + x3*x6*(x1 + x2 - x3 + x4 + x5 - x6) + -x2*x3*x4 - x1*x3*x5 - x1*x2*x6 -x4*x5*x6`);; + +(* delta_y *) +let delta_y = new_definition `delta_y y1 y2 y3 y4 y5 y6 = + delta_x (y1*y1) (y2*y2) (y3*y3) (y4*y4) (y5*y5) (y6*y6)`;; + +(* delta_x4 *) +let delta_x4= new_definition(`delta_x4 x1 x2 x3 x4 x5 x6 + = -- x2* x3 - x1* x4 + x2* x5 + + x3* x6 - x5* x6 + x1* (-- x1 + x2 + x3 - x4 + x5 + x6)`);; + +(* ups_x *) +let ups_x = new_definition(`ups_x x1 x2 x6 = + --x1*x1 - x2*x2 - x6*x6 + + &2 *x1*x6 + &2 *x1*x2 + &2 *x2*x6`);; + +(* rho_x *) +let rho_x = new_definition(`rho_x x1 x2 x3 x4 x5 x6 = + --x1*x1*x4*x4 - x2*x2*x5*x5 - x3*x3*x6*x6 + + (&2)*x1*x2*x4*x5 + (&2)*x1*x3*x4*x6 + (&2)*x2*x3*x5*x6`);; + +(* rad2_x *) +let rad2_x = new_definition(`rad2_x x1 x2 x3 x4 x5 x6 = + (rho_x x1 x2 x3 x4 x5 x6)/((delta_x x1 x2 x3 x4 x5 x6)*(&4))`);; + +(* dih_x', atn2 replaced with atan2 *) +let dih_x' = new_definition(`dih_x' x1 x2 x3 x4 x5 x6 = + let d_x4 = delta_x4 x1 x2 x3 x4 x5 x6 in + let d = delta_x x1 x2 x3 x4 x5 x6 in + pi/ (&2) + atn2'( (sqrt ((&4) * x1 * d)),-- d_x4)`);; + +(* dih_y *) +let dih_y' = new_definition(`dih_y' y1 y2 y3 y4 y5 y6 = + let (x1,x2,x3,x4,x5,x6)= (y1*y1,y2*y2,y3*y3,y4*y4,y5*y5,y6*y6) in + dih_x' x1 x2 x3 x4 x5 x6`);; + +(* arclength *) +let arclength' = new_definition(`arclength' a b c = + pi/(&2) + (atn2'( (sqrt (ups_x (a*a) (b*b) (c*c))),(c*c - a*a -b*b)))`);; + +(* sol_x *) +let sol_x' = new_definition(`sol_x' x1 x2 x3 x4 x5 x6 = + (dih_x' x1 x2 x3 x4 x5 x6) + + (dih_x' x2 x3 x1 x5 x6 x4) + (dih_x' x3 x1 x2 x6 x4 x5) - pi`);; + +(* sol_y *) +let sol_y' = new_definition(`sol_y' y1 y2 y3 y4 y5 y6 = + (dih_y' y1 y2 y3 y4 y5 y6) + + (dih_y' y2 y3 y1 y5 y6 y4) + (dih_y' y3 y1 y2 y6 y4 y5) - pi`);; + + +(* const1 *) +let const1' = new_definition `const1' = sol_y' (&2) (&2) (&2) (&2) (&2) (&2) / pi`;; + +(* h0 *) +let h0 = new_definition `h0 = #1.26`;; + +(* lfun *) +let lfun = new_definition `lfun h = (h0 - h)/(h0 - &1)`;; + +(* lfun_y1 *) +let lfun_y1 = new_definition `lfun_y1 (y1:real) (y2:real) (y3:real) + (y4:real) (y5:real) (y6:real) = lfun y1`;; + + +(* num1 *) +let num1 = new_definition `num1 e1 e2 e3 a2 b2 c2 = + -- &4*((a2 pow 2) *e1 + &8*(b2 - c2)*(e2 - e3) - + a2*(&16*e1 + ( b2 - &8 )*e2 + (c2 - &8)*e3))`;; + +(* unit6 *) +let unit6 = define `unit6 x1 x2 x3 x4 x5 x6 = &1`;; + +(* arc_hhn *) +let arc_hhn' = new_definition `arc_hhn' = + arclength' (&2 * h0) (&2 * h0) (&2)`;; + +(* arclength_y1 *) +let arclength_y1' = new_definition + `arclength_y1' a b + (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) = + arclength' y1 a b`;; + +(* arclength_x1 *) +let arclength_x1' = new_definition + `arclength_x1' a b x1 x2 x3 x4 x5 x6 = + arclength_y1' a b (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +(* arclength_x_123 *) +let arclength_x_123' = new_definition `arclength_x_123' (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + arclength' (sqrt x1) (sqrt x2) (sqrt x3)`;; + +(* acs_sqrt_x1_d4 *) +let acs_sqrt_x1_d4 = new_definition `acs_sqrt_x1_d4 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + acs (sqrt(x1)/ &4)`;; + +let sqrt_x1 = define `sqrt_x1 x1 x2 x3 x4 x5 x6 = sqrt x1`;; + +let sqrt_x2 = define `sqrt_x2 x1 x2 x3 x4 x5 x6 = sqrt x2`;; + +let sqrt_x3 = define `sqrt_x3 x1 x2 x3 x4 x5 x6 = sqrt x3`;; + +let sqrt_x4 = define `sqrt_x4 x1 x2 x3 x4 x5 x6 = sqrt x4`;; + +let sqrt_x5 = define `sqrt_x5 x1 x2 x3 x4 x5 x6 = sqrt x5`;; + +let sqrt_x6 = define `sqrt_x6 x1 x2 x3 x4 x5 x6 = sqrt x6`;; + + +(* All definitions in one list *) +let flyspeck_defs = [atn2'; delta_x; delta_y; delta_x4; + ups_x; rho_x; dih_x'; dih_y'; arclength'; + sol_x'; sol_y'; const1'; num1; unit6; h0; lfun; lfun_y1; + rad2_x; arc_hhn'; arclength_y1'; arclength_x1'; acs_sqrt_x1_d4; + arclength_x_123'; sqrt_x1; sqrt_x2; sqrt_x3; sqrt_x4; sqrt_x5; sqrt_x6];; + + + +(* A simple function for verifying Flyspeck inequalities *) +let verify_flyspeck_ineq pp ineq_tm = + let conv = REWRITE_CONV ([ineq; IMP_IMP] @ flyspeck_defs) THENC DEPTH_CONV let_CONV in + let eq_th = conv ineq_tm in + let ineq_tm1 = (rand o concl) eq_th in + let th, time = verify_ineq default_params pp ineq_tm1 in + REWRITE_RULE[GSYM eq_th] th, time;; + + +(* Create a hashtable for saving inequalities *) + +type difficulty = Easy | Medium | Hard;; + +type flyspeck_example = +{ + difficulty : difficulty; + id : string; + ineq_tm : term; +};; + +let examples = Hashtbl.create 20;; +let add_example ex = + Hashtbl.add examples ex.id ex;; + +(* 2485876245a *) +add_example {id = "2485876245a"; + difficulty = Easy; + ineq_tm = `ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0,x4, #6.3504; + #3.0 * #3.0, x5, #2.0 * #2.52 * #2.0 * #2.52; #4.0,x6, #6.3504] + (delta_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`};; + + +(* 4559601669b *) +add_example {id = "4559601669b"; + difficulty = Easy; + ineq_tm = `ineq + [ #4.0,x1, #6.3504; #4.0,x2, #4.0; #4.0,x3, #6.3504; + #3.01 * #3.01, x4, #3.01 * #3.01; #4.0, x5, #6.3504; #4.0,x6, #4.0] + (delta_x4 x1 x2 x3 x4 x5 x6 < &0)`};; + + +(* 5512912661 *) +add_example {id = "5512912661"; + difficulty = Easy; + ineq_tm = `ineq [&1,x1,&1 + (pi * const1') / pi; &1,x2,&1 + (pi * const1') / pi; + &1, x3, &1 + (pi * const1') / pi; #2.38 * #2.38, x4, #3.01 * #3.01; + &2 * &2, x5, #2.52 * #2.52; #3.15 / #1.26 * #3.15 / #1.26,x6, #15.53] + (num1 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`};; + + +(* 6843920790 *) +add_example {id = "6843920790"; + difficulty = Easy; + ineq_tm = `ineq [&1,x1,&1 + (pi * const1') / pi; &1,x2,&1 + (pi * const1') / pi; + &1, x3, &1 + (pi * const1') / pi; &2 / #1.26 * &2 / #1.26, x4, #3.01 * #3.01; + #2.38 * #2.38, x5, #15.53; #2.38 * #2.38,x6, #15.53] + (num1 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`};; + + +(* 6096597438a *) +add_example {id = "6096597438a"; + difficulty = Easy; + ineq_tm = `ineq [ #1.0,x1, #1.0; &1,x2,&1; &1,x3,&1; &1,x4,&1; &1,x5,&1; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * #0.591 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0331 * -- &64 + + unit6 x1 x2 x3 x4 x5 x6 * #0.506 * #1.26 * &1 / ( #1.26 + -- &1) + + unit6 x1 x2 x3 x4 x5 x6 * #0.506 * --(&1 / ( #1.26 + -- &1)) + + unit6 x1 x2 x3 x4 x5 x6 * #1.0 < &0)`};; + + +(* 4717061266 *) +add_example {id = "4717061266"; + difficulty = Easy; + ineq_tm = `ineq + [ #4.0,x1, #2.0 * #1.26 * #2.0 * #1.26; #4.0, x2, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, x3, #2.0 * #1.26 * #2.0 * #1.26; #4.0,x4, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, x5, #2.0 * #1.26 * #2.0 * #1.26; #4.0,x6, #2.0 * #1.26 * #2.0 * #1.26] + (delta_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`};; + + +(* SDCCMGA b *) +add_example {id = "SDCCMGA b"; + difficulty = Easy; + ineq_tm = `ineq [ #4.0,x1, #6.3504; &1 * &1,x2,&1 * &1; &1 * &1,x3,&1 * &1; + &1 * &1, x4, &1 * &1; &1 * &1, x5, &1 * &1; &1 * &1,x6,&1 * &1] + (arclength_x1' #2.0 ( #2.0 * #1.26) x1 x2 x3 x4 x5 x6 + + arclength_x1' #2.0 ( #2.0 * #1.26) x1 x2 x3 x4 x5 x6 + + arclength_x1' ( #2.0 * #1.26) #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * --arc_hhn' < &0)`};; + + +(* TSKAJXY-TADIAMB *) +add_example {id = "TSKAJXY-TADIAMB"; + difficulty = Medium; + ineq_tm = `ineq + [ #2.0 * #1.3254 * #2.0 * #1.3254,x1, #8.0; #2.0 * #1.3254 * #2.0 * #1.3254, x2, #8.0; + #4.0,x3, #8.0; #4.0, x4, #8.0; #4.0,x5, #8.0; #4.0,x6, #8.0] + ((unit6 x1 x2 x3 x4 x5 x6 * #2.0) * (delta_x x1 x2 x3 x4 x5 x6 * &4) < rho_x x1 x2 x3 x4 x5 x6)`};; + + +(* 7067938795 *) +add_example {id = "7067938795"; + difficulty = Medium; + ineq_tm = `ineq [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0,x4, #4.0; + #3.01 * #3.01, x5, #3.24 * #3.24; #3.01 * #3.01,x6, #3.24 * #3.24] + (dih_x' x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * pi * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * #0.46 < + &0)`};; + +(* 5490182221 *) +add_example { id = "5490182221"; + difficulty = Medium; + ineq_tm = `ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0,x4, #6.3504; + #4.0, x5, #6.3504; #4.0,x6, #6.3504] + (dih_x' x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #1.893 < &0)`};; + + + +(* 3318775219 *) +add_example { id = "3318775219"; + difficulty = Hard; + ineq_tm = `ineq [&2, y1, #2.52; &2, y2, #2.52; + &2, y3, #2.52; #2.52, y4, sqrt(&8); + &2, y5, #2.52; &2, y6, #2.52] + ( ((dih_y' y1 y2 y3 y4 y5 y6) - #1.629 + + (#0.414 * (y2 + y3 + y5 + y6 - #8.0)) - + (#0.763 * (y4 - #2.52)) - + (#0.315 * (y1 - #2.0))) * (-- &1) < &0)`};; + + +(* Tests *) + +let run_example id = + id, verify_flyspeck_ineq 4 (Hashtbl.find examples id).ineq_tm;; + + + +let test_easy, test_medium, test_hard = + let run keys = map run_example keys in + let get_keys d0 = + let list = Hashtbl.fold (fun k v acc -> (k, v.difficulty) :: acc) examples [] in + (setify o fst o unzip) (filter (fun (_, d) -> d = d0) list) in + (fun () -> run (get_keys Easy)), + (fun () -> run (get_keys Medium)), + (fun () -> run (get_keys Hard));; + + +let easy = test_easy();; +(* let medium = test_medium();; *) +(* let hard = test_hard();; *) diff --git a/formal_ineqs/examples_poly.hl b/formal_ineqs/examples_poly.hl new file mode 100644 index 0000000..c7277cf --- /dev/null +++ b/formal_ineqs/examples_poly.hl @@ -0,0 +1,141 @@ +(* Multivariate polynomial inequalities *) +(* Examples are taken from the paper: + César Muñoz and Anthony Narkawicz, + Formalization of a Representation of Bernstein Polynomials and Applications to Global Optimization, + Journal of Automated Reasoning, DOI: 10.1007/s10817-012-9256-3 + http://shemesh.larc.nasa.gov/people/cam/Bernstein/ *) + + +(* Set up the loading path: +load_path := "path to the formal_ineqs directory" :: !load_path;; +*) + +(* Change default arithmetic options before loading other libraries *) +(* (arithmetic options cannot be changed later) *) +needs "arith_options.hl";; + +(* Set the base of natural number arithmetic to 200 *) +Arith_options.base := 200;; + +(* Load all verification libraries *) +(* Note: the verification library loads Multivariate/realanalysis.ml, + so it is recommended to use a checkpointed version of HOL Light + with preloaded realanalysis.ml *) +needs "verifier/m_verifier_main.hl";; + +(* + Set the level of info/debug printing: + 0 - no info/debug printing + 1 - report important steps (default) + 2 - report everything +*) +needs "verifier_options.hl";; +Verifier_options.info_print_level := 1;; + +(* Open the main verification module *) +open M_verifier_main;; + + +(* Data *) + +(* Polynomials *) +let schwefel_poly = `(x1 - x2 pow 2) pow 2 + (x2 - &1) pow 2 + + (x1 - x3 pow 2) pow 2 + (x3 - &1) pow 2` and + + rd_poly = `-- x1 + &2 * x2 - x3 - #0.835634534 * x2 * (&1 + x2)` and + + caprasse_poly = `-- x1 * x3 pow 3 + &4 * x2 * x3 pow 2 * x4 + + &4 * x1 * x3 * x4 pow 2 + &2 * x2 * x4 pow 3 + &4 * x1 * x3 + &4 * x3 pow 2 - + &10 * x2 * x4 - &10 * x4 pow 2 + &2` and + + lv_poly = `x1 * x2 pow 2 + x1 * x3 pow 2 + x1 * x4 pow 2 - #1.1 * x1 + &1` and + + butcher_poly = `x6 * x2 pow 2 + x5 * x3 pow 2 - x1 * x4 pow 2 + x4 pow 2 - + &1 / &3 * x1 + &4 / &3 * x4` and + + magnetism_poly = `x1 pow 2 + &2 * x2 pow 2 + &2 * x3 pow 2 + &2 * x4 pow 2 + + &2 * x5 pow 2 + &2 * x6 pow 2 + &2 * x7 pow 2 - x1` and + + heart_poly = `-- x1 * x6 pow 3 + &3 * x1 * x6 * x7 pow 2 - x3 * x7 pow 3 + + &3 * x3 * x7 * x6 pow 2 - x2 * x5 pow 3 + &3 * x2 * x5 * x8 pow 2 - x4 * x8 pow 3 + + &3 * x4 * x8 * x5 pow 2 - #0.9563453`;; + +(* Minimal values *) +let schwefel_min = `-- #0.00000000058806` and + rd_min = `-- #36.7126907` and + caprasse_min = `-- #3.1801` and + lv_min = `-- #20.801` and + butcher_min = `-- #1.44` and + magnetism_min = `-- #0.25001` and + heart_min = `-- #1.7435`;; + +(* Domains *) +let schwefel_dom = `[-- &10; -- &10; -- &10]`, `[&10; &10; &10]` and + rd_dom = `[-- &5; -- &5; -- &5]`, `[&5; &5; &5]` and + caprasse_dom = `[-- #0.5; -- #0.5; -- #0.5; -- #0.5]`, `[#0.5; #0.5; #0.5; #0.5]` and + lv_dom = `[-- &2; -- &2; -- &2; -- &2]`, `[&2; &2; &2; &2]` and + butcher_dom = `[-- &1; -- #0.1; -- #0.1; -- &1; -- #0.1; -- #0.1]`, + `[&0; #0.9; #0.5; -- #0.1; -- #0.05; -- #0.03]` and + magnetism_dom = `[-- &1; -- &1; -- &1; -- &1; -- &1; -- &1; -- &1]`, + `[&1; &1; &1; &1; &1; &1; &1]` and + heart_dom = `[-- #0.1; #0.4; -- #0.7; -- #0.7; #0.1; -- #0.1; -- #0.3; -- #1.1]`, + `[#0.4; &1; -- #0.4; #0.4; #0.2; #0.2; #1.1; -- #0.3]`;; + + +let mk_poly_ineq poly_tm min_tm dom = + let n = length (frees poly_tm) in + let xs = map (fun i -> "x"^string_of_int i) (1--n) in + let ineq_tm = mk_binop `(<):real->real->bool` min_tm poly_tm in + let ineq2_tm = M_verifier_main.mk_ineq ineq_tm xs dom in + ineq2_tm;; + +(* Create all inequalities *) +let schwefel_ineq, + rd_ineq, + caprasse_ineq, + lv_ineq, + butcher_ineq, + magnetism_ineq, + heart_ineq = + mk_poly_ineq schwefel_poly schwefel_min schwefel_dom, + mk_poly_ineq rd_poly rd_min rd_dom, + mk_poly_ineq caprasse_poly caprasse_min caprasse_dom, + mk_poly_ineq lv_poly lv_min lv_dom, + mk_poly_ineq butcher_poly butcher_min butcher_dom, + mk_poly_ineq magnetism_poly magnetism_min magnetism_dom, + mk_poly_ineq heart_poly heart_min heart_dom;; + + +(* Tests *) + +let test_schwefel () = + verify_ineq default_params 5 schwefel_ineq;; + +let test_rd () = + verify_ineq default_params 5 rd_ineq;; + +let test_caprasse () = + verify_ineq default_params 5 caprasse_ineq;; + +let test_lv () = + verify_ineq default_params 5 lv_ineq;; + +let test_butcher () = + verify_ineq default_params 5 butcher_ineq;; + +let test_magnetism () = + verify_ineq default_params 5 magnetism_ineq;; + +let test_heart () = + verify_ineq {default_params with eps = 1e-10} 5 heart_ineq;; + + +let run_tests () = + [test_schwefel(); test_rd(); test_caprasse(); test_lv(); + test_butcher(); test_magnetism(); test_heart()];; + +let results () = + map fst (run_tests());; + + +results();; diff --git a/formal_ineqs/informal/informal_arith.hl b/formal_ineqs/informal/informal_arith.hl new file mode 100644 index 0000000..d54211d --- /dev/null +++ b/formal_ineqs/informal/informal_arith.hl @@ -0,0 +1,805 @@ +(* =========================================================== *) +(* Informal arithmetic procedures *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +(* Dependencies *) +needs "misc/misc.hl";; +needs "arith_options.hl";; + + +(* Natural numbers *) + +module type Informal_nat_sig = + sig + type nat + val arith_base : int + val mk_nat : num -> nat + val mk_small_nat : int -> nat + val dest_nat : nat -> num + val eq_nat : nat -> nat -> bool + val suc_nat : nat -> nat + val pre_nat : nat -> nat + val eq0_nat : nat -> bool + val gt0_nat : nat -> bool + val lt_nat : nat -> nat -> bool + val le_nat : nat -> nat -> bool + val add_nat : nat -> nat -> nat + val sub_nat : nat -> nat -> nat + (* If sub_and_le_nat m n = (m - n, true) if n <= m; (n - m, false) if m < n *) + val sub_and_le_nat : nat -> nat -> nat * bool + val mul_nat : nat -> nat -> nat + val div_nat : nat -> nat -> nat + val even_nat : nat -> bool + val odd_nat : nat -> bool + + (* normalize_nat m = (n, e) s.t. m = n * base^e, e >= 0 *) + val normalize_nat : nat -> nat * int + val denormalize_nat : nat * int -> nat + (* hi_nat p m = (n, e) s.t. m <= n * base^e and n contains at most p "digits" *) + val hi_nat : int -> nat -> nat * int + val hi_lt_nat : int -> nat -> nat * int + (* lo_nat p m = (n, e) s.t. n * base^e <= m and n contains at most p "digits" *) + val lo_nat : int -> nat -> nat * int + end;; + + + +module Informal_nat : Informal_nat_sig = struct + +open Arith_misc;; +open Big_int;; + +type nat = big_int;; + +let arith_base = !Arith_options.base;; + +let mk_nat n = + let result = big_int_of_num n in + if sign_big_int result < 0 then zero_big_int else result;; + +let mk_small_nat n = + if n < 0 then zero_big_int else big_int_of_int n;; + +let dest_nat = num_of_big_int;; + +let eq_nat = eq_big_int;; + +let suc_nat = succ_big_int;; + +let pre_nat n = + let result = pred_big_int n in + if sign_big_int result < 0 then zero_big_int else result;; + +let eq0_nat n = sign_big_int n = 0;; + +let gt0_nat n = sign_big_int n > 0;; + +let lt_nat = lt_big_int;; + +let le_nat = le_big_int;; + +let add_nat = add_big_int;; + +let sub_nat m n = + let result = sub_big_int m n in + if sign_big_int result < 0 then zero_big_int else result;; + +let sub_and_le_nat m n = + let result = sub_big_int m n in + if sign_big_int result >= 0 then (result, true) else (abs_big_int result, false);; + +let mul_nat = mult_big_int;; + +let div_nat = div_big_int;; + +let two_big_int = big_int_of_int 2;; + +let even_nat n = sign_big_int (mod_big_int n two_big_int) = 0;; + +let odd_nat n = sign_big_int (mod_big_int n two_big_int) > 0;; + +(*******************************) +(* num_exp *) + +let base_nat = mk_small_nat arith_base;; + +(* normalize_nat m = (n, e) s.t. m = n * base^e, e >= 0 *) +let normalize_nat = + let rec normalize n e = + let q, r = quomod_big_int n base_nat in + if sign_big_int r > 0 then + (n, e) + else + normalize q (succ e) in + fun n -> + if sign_big_int n = 0 then (n, 0) else normalize n 0;; + + +let denormalize_nat (n, e) = + mult_big_int n (power_int_positive_int arith_base e);; + + +let lo_nat pp = + let max = power_int_positive_int arith_base pp in + let rec lo m e = + if lt_big_int m max then + (m, e) + else + let q = div_big_int m base_nat in + lo q (succ e) in + fun m -> + if sign_big_int m = 0 then + (m, 0) + else + let n1, e1 = lo m 0 in + let n, e2 = normalize_nat n1 in + n, e1 + e2;; + + +let hi_nat pp = + if pp <= 0 then failwith "hi_nat: pp <= 0" else + let max = power_int_positive_int arith_base pp in + let rec hi m e = + if lt_big_int m max then + (m, e) + else + let q, r = quomod_big_int m base_nat in + if sign_big_int r = 0 then + hi q (succ e) + else + hi (succ_big_int q) (succ e) in + fun m -> + if sign_big_int m = 0 then + (m, 0) + else + let n1, e1 = hi m 0 in + let n, e2 = normalize_nat n1 in + n, e1 + e2;; + + +let hi_lt_nat pp m = + hi_nat pp (succ_big_int m);; + + +end;; + + + +(* Floating point numbers *) + +module type Informal_float_sig = + sig + type ifloat + val min_exp : int + val mk_float : num -> int -> ifloat + val mk_num_float : num -> ifloat + val mk_small_num_float : int -> ifloat + val dest_float : ifloat -> bool * num * int + val sign_float : ifloat -> bool + (* Compares representations, not numbers themselves *) + val eq_float : ifloat -> ifloat -> bool + val lo_float : int -> ifloat -> ifloat + val hi_float : int -> ifloat -> ifloat + val neg_float : ifloat -> ifloat + val abs_float : ifloat -> ifloat + val lt0_float : ifloat -> bool + val gt0_float : ifloat -> bool + val le0_float : ifloat -> bool + val ge0_float : ifloat -> bool + val lt_float : ifloat -> ifloat -> bool + val le_float : ifloat -> ifloat -> bool + val min_float : ifloat -> ifloat -> ifloat + val max_float : ifloat -> ifloat -> ifloat + val mul_float_eq : ifloat -> ifloat -> ifloat + val mul_float_lo : int -> ifloat -> ifloat -> ifloat + val mul_float_hi : int -> ifloat -> ifloat -> ifloat + val div_float_lo : int -> ifloat -> ifloat -> ifloat + val div_float_hi : int -> ifloat -> ifloat -> ifloat + val add_float_lo : int -> ifloat -> ifloat -> ifloat + val add_float_hi : int -> ifloat -> ifloat -> ifloat + val sub_float_lo : int -> ifloat -> ifloat -> ifloat + val sub_float_hi : int -> ifloat -> ifloat -> ifloat + val sqrt_float_lo : int -> ifloat -> ifloat + val sqrt_float_hi : int -> ifloat -> ifloat + end;; + +module Informal_float : Informal_float_sig = struct + +open Informal_nat;; + +type ifloat = bool * nat * int;; + +let min_exp = !Arith_options.min_exp;; + +(* Creates a non-negative float *) +let mk_float n e : ifloat = false, mk_nat n, e + min_exp;; + +let mk_num_float n = false, mk_nat n, min_exp;; + +let mk_small_num_float n = false, mk_small_nat n, min_exp;; + +let zero_float = mk_small_num_float 0;; + +let dest_float ((s, n, e) : ifloat) = s, dest_nat n, e;; + +let sign_float ((s,_,_) : ifloat) = s;; + +let eq_float (s1,n1,e1) (s2,n2,e2) = s1 = s2 && eq_nat n1 n2 && e1 = e2;; + +let lo_float pp (s,n,e) = + let n1, e1 = if s then hi_nat pp n else lo_nat pp n in + (s, n1, e + e1);; + +let hi_float pp (s,n,e) = + let n1, e1 = if s then lo_nat pp n else hi_nat pp n in + (s, n1, e + e1);; + +(* Auxiliary num_exp functions *) + +let num_exp_add = + let (+) = add_nat in + fun (n1,e1) (n2,e2) -> + if e1 <= e2 then + n1 + denormalize_nat (n2, e2 - e1), e1 + else + n2 + denormalize_nat (n1, e1 - e2), e2;; + + +(* Returns (n,e),true if (n1,e1) >= (n2,e2) and (n,e) = (n1,e1) - (n2,e2) + Returns (n,e),false if (n1,e1) <= (n2,e2) and (n,e) = (n2,e2) - (n1,e1) *) +let num_exp_sub = + let (--) = sub_and_le_nat in + fun (n1,e1) (n2,e2) -> + if e2 <= e1 then + let a = denormalize_nat (n1, e1 - e2) and + b = n2 in + let sub, flag = a -- b in + (sub, e2), flag + else + let a = n1 and + b = denormalize_nat (n2, e2 - e1) in + let sub, flag = a -- b in + (sub, e1), flag;; + + +let num_exp_le = + let (<=/) = le_nat in + fun (n1,e1) (n2,e2) -> + if e1 <= e2 then + n1 <=/ denormalize_nat (n2, e2 - e1) + else + denormalize_nat (n1, e1 - e2) <=/ n2;; + + +let num_exp_lt = + let ( + if e1 <= e2 then + n1 interval + val mk_num_interval : num -> interval + val mk_small_num_interval : int -> interval + val dest_interval : interval -> Informal_float.ifloat * Informal_float.ifloat + val round_interval : int -> interval -> interval + val neg_interval : interval -> interval + val mul_interval : int -> interval -> interval -> interval + val div_interval : int -> interval -> interval -> interval + val add_interval : int -> interval -> interval -> interval + val sub_interval : int -> interval -> interval -> interval + val sqrt_interval : int -> interval -> interval + val inv_interval : int -> interval -> interval + val pow_interval : int -> int -> interval -> interval + (* Computes max(-lo, hi) *) + val abs_interval : interval -> Informal_float.ifloat + end;; + +module Informal_interval : Informal_interval_sig = struct + +open Informal_float;; + + +type interval = ifloat * ifloat;; + +let mk_interval (lo,hi) = + if lt_float hi lo then failwith "mk_interval: hi < lo" else (lo,hi);; + +let mk_num_interval n = + let f = mk_num_float n in (f, f);; + +let mk_small_num_interval n = + let f = mk_small_num_float n in (f, f);; + +let zero_interval = mk_small_num_interval 0;; +let one_interval = mk_small_num_interval 1;; +let two_interval = mk_small_num_interval 2;; + +let dest_interval ((lo,hi) : interval) = (lo,hi);; + +let round_interval pp (lo,hi) = (lo_float pp lo, hi_float pp hi);; + +let neg_interval (lo,hi) = (neg_float hi, neg_float lo);; + +let abs_interval (lo,hi) = max_float hi (neg_float lo);; + +let add_interval pp (lo1,hi1) (lo2,hi2) = + (add_float_lo pp lo1 lo2, add_float_hi pp hi1 hi2);; + +let sub_interval pp (lo1,hi1) (lo2,hi2) = + (sub_float_lo pp lo1 hi2, sub_float_hi pp hi1 lo2);; + +let sqrt_interval pp (lo,hi) = + if sign_float lo then + failwith "sqrt_interval: negative lower bound" + else + (sqrt_float_lo pp lo, sqrt_float_hi pp hi);; + +(* mul *) +let mul_interval pp (l_lo,l_hi) (r_lo,r_hi) = + let s1 = sign_float l_lo and + s2 = sign_float l_hi and + s3 = sign_float r_lo and + s4 = sign_float r_hi in + if s1 <> s2 && not s1 then + zero_interval + else if s3 <> s4 && not s3 then + zero_interval + else + if s1 <> s2 && s3 <> s4 then + let lo1, lo2 = mul_float_lo pp l_lo r_hi, mul_float_lo pp l_hi r_lo and + hi1, hi2 = mul_float_hi pp l_lo r_lo, mul_float_hi pp l_hi r_hi in + (min_float lo1 lo2, max_float hi1 hi2) + else + let lo1, lo2, hi1, hi2 = + if s1 <> s2 then + if not s3 then + l_lo, r_hi, l_hi, r_hi + else + l_hi, r_lo, l_lo, r_lo + else + if s3 <> s4 then + if not s1 then + l_hi, r_lo, l_hi, r_hi + else + l_lo, r_hi, l_lo, r_lo + else + if not s1 then + if not s3 then + l_lo, r_lo, l_hi, r_hi + else + l_hi, r_lo, l_lo, r_hi + else + if not s3 then + l_lo, r_hi, l_hi, r_lo + else + l_hi, r_hi, l_lo, r_lo in + (mul_float_lo pp lo1 lo2, mul_float_hi pp hi1 hi2);; + +(* div *) +let div_interval pp (l_lo,l_hi) (r_lo,r_hi) = + let s1 = sign_float l_lo and + s2 = sign_float l_hi and + s3 = sign_float r_lo and + s4 = sign_float r_hi in + if s1 <> s2 && not s1 then + zero_interval + else if s3 <> s4 then + failwith "div_interval: division by an interval containing 0" + else + let lo1, lo2, hi1, hi2 = + if s1 = s2 then + if not s1 then + if not s3 then + l_lo, r_hi, l_hi, r_lo + else + l_hi, r_hi, l_lo, r_lo + else + if not s3 then + l_lo, r_lo, l_hi, r_hi + else + l_hi, r_lo, l_lo, r_hi + else + if not s3 then + l_lo, r_lo, l_hi, r_lo + else + l_hi, r_hi, l_lo, r_hi in + (div_float_lo pp lo1 lo2, div_float_hi pp hi1 hi2);; + +(* inv *) +let inv_interval pp int = + div_interval pp one_interval int;; + +(* pow *) +let pow_interval pp n int = + let rec pow n = + if n <= 0 then + one_interval + else if n = 1 then + int + else + let i2 = pow (n - 1) in + mul_interval pp int i2 in + pow n;; + + +(* Arith_misc.gen_pow (mul_interval pp) one_interval n;; *) + +end;; + + +(* atn *) +module type Informal_atn_sig = + sig + val atn_interval : int -> Informal_interval.interval -> Informal_interval.interval + val acs_interval : int -> Informal_interval.interval -> Informal_interval.interval + val pi_approx_array : Informal_interval.interval array + val pi2_approx_array : Informal_interval.interval array + end;; + + +module Informal_atn : Informal_atn_sig = struct + +open Informal_float;; +open Informal_interval;; + + +let rec poly_f_interval pp l x = + if length l = 0 then + failwith "poly_f_interval: an empty coefficient list" + else + let first = hd l in + if length l = 1 then + first + else + let r = poly_f_interval pp (tl l) x in + add_interval pp first (mul_interval pp x r);; + + +let poly_f_even_interval pp l x = + let xx = mul_interval pp x x in + poly_f_interval pp l xx;; + + +let poly_f_odd_interval pp l x = + let even = poly_f_even_interval pp l x in + mul_interval pp x even;; + + +let halfatn_interval pp x = + let xx = mul_interval pp x x in + let one_xx = add_interval pp one_interval xx in + let sqrt = sqrt_interval pp one_xx in + let one_sqrt = add_interval pp sqrt one_interval in + div_interval pp x one_sqrt;; + + +let halfatn4_interval pp x = + (halfatn_interval pp o halfatn_interval pp o halfatn_interval pp o halfatn_interval pp) x;; + + +(* Computes an interval for 16 * sum(0..n) (halfatn4_co x) *) +let atn_sum_interval = + let interval_16 = mk_small_num_interval 16 in + fun pp l x -> + let halfatn4 = halfatn4_interval pp x in + let poly = poly_f_odd_interval pp l halfatn4 in + mul_interval pp interval_16 poly;; + + +let atn0_interval pp l eps x = + let sum = atn_sum_interval pp l x in + let a, b = dest_interval sum in + let _, d = dest_interval eps in + let hi = add_float_hi pp b d in + let lo = sub_float_lo pp a d in + mk_interval (lo, hi);; + + +(* Computes an interval for 2 ^ -(6n + 5) *) +let compute_eps1 pp n = + let pow = pow_interval pp (6 * n + 5) two_interval in + inv_interval pp pow;; + + +let mk_atn_co_table pp n = + let get_val k = + let l = if (k land 1) = 0 then one_interval else neg_interval (one_interval) in + let r = mk_small_num_interval (2 * k + 1) in + div_interval pp l r in + map get_val (0--n);; + +(* Lookup tables *) +let n_of_p pp = + let x = (float_of_int (pp + 1) *. log (float_of_int Informal_nat.arith_base) /. log (2.0) -. 5.0) /. 6.0 in + let n = (int_of_float o ceil) x in + if n < 1 then 1 else n;; + +let atn_co_array = Array.init 21 (fun i -> mk_atn_co_table (i + 1) (n_of_p i));; +let eps1_array = Array.init 21 (fun i -> compute_eps1 (i + 1) (n_of_p i));; + + +let atn_interval pp x = + atn0_interval pp atn_co_array.(pp) eps1_array.(pp) x;; + + +(* pi approximation *) +let pi_approx_array, pi2_approx_array = + let pp = 20 in + let x = one_interval in + let r1 = atn_interval pp x in + let r2 = mul_interval pp (mk_small_num_interval 4) r1 in + let float_pi = r2 in + let float_pi2 = div_interval pp float_pi two_interval in + let pi_int0 = mk_small_num_interval 0 in + let pi2_int0 = pi_int0 in + Array.init 19 (fun i -> if i = 0 then pi_int0 else round_interval i float_pi), + Array.init 19 (fun i -> if i = 0 then pi2_int0 else round_interval i float_pi2);; + + +(* acs *) +let acs0_interval pp l eps1 x = + let int1 = sub_interval pp one_interval (mul_interval pp x x) in + let int2 = div_interval pp x (sqrt_interval pp int1) in + let atn_int = atn0_interval pp l eps1 int2 in + sub_interval pp pi2_approx_array.(pp + 1) atn_int;; + + +let acs_interval pp x = + acs0_interval pp atn_co_array.(pp) eps1_array.(pp) x;; + + +end;; + diff --git a/formal_ineqs/informal/informal_eval_interval.hl b/formal_ineqs/informal/informal_eval_interval.hl new file mode 100644 index 0000000..1bb03e9 --- /dev/null +++ b/formal_ineqs/informal/informal_eval_interval.hl @@ -0,0 +1,275 @@ +(* =========================================================== *) +(* Informal interval evaluation of arithmetic expressions *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +needs "informal/informal_arith.hl";; + +module Informal_eval_interval = struct + +open Informal_interval;; +open Informal_float;; +open Informal_atn;; + +(* Creates an interval approximation of the given decimal term *) +let mk_float_interval_decimal pp decimal_tm = + let n_tm, d_tm = dest_binary "DECIMAL" decimal_tm in + let n, d = dest_numeral n_tm, dest_numeral d_tm in + let n_int, d_int = mk_num_interval n, mk_num_interval d in + div_interval pp n_int d_int;; + + +(* Unary interval operations *) +let unary_interval_operations = + let table = Hashtbl.create 10 in + let add = Hashtbl.add in + add table "real_neg" (fun pp -> neg_interval); + add table "real_inv" inv_interval; + add table "sqrt" sqrt_interval; + add table "atn" atn_interval; + add table "acs" acs_interval; + table;; + + +(* Binary interval operations *) +let binary_interval_operations = + let table = Hashtbl.create 10 in + let add = Hashtbl.add in + add table "real_add" add_interval; + add table "real_sub" sub_interval; + add table "real_mul" mul_interval; + add table "real_div" div_interval; + table;; + + +(* Interval approximations of constants *) +let interval_constants = + let table = Hashtbl.create 10 in + let add = Hashtbl.add in + add table "pi" (fun pp -> pi_approx_array.(pp)); + table;; + + + +(* Type of an interval function *) +type interval_fun = + | Int_ref of int + | Int_var of int + | Int_const of interval + | Int_decimal_const of term + | Int_named_const of string + | Int_pow of int * interval_fun + | Int_unary of string * interval_fun + | Int_binary of string * interval_fun * interval_fun;; + + +(* Equality of interval functions *) +let rec eq_ifun ifun1 ifun2 = + match (ifun1, ifun2) with + | (Int_ref r1, Int_ref r2) -> r1 = r2 + | (Int_var v1, Int_var v2) -> v1 = v2 + | (Int_decimal_const tm1, Int_decimal_const tm2) -> tm1 = tm2 + | (Int_named_const name1, Int_named_const name2) -> name1 = name2 + | (Int_pow (n1, f1), Int_pow (n2, f2)) -> n1 = n2 && eq_ifun f1 f2 + | (Int_unary (op1, f1), Int_unary (op2, f2)) -> op1 = op2 && eq_ifun f1 f2 + | (Int_binary (op1, f1, g1), Int_binary (op2, f2, g2)) -> op1 = op2 && eq_ifun f1 f2 && eq_ifun g1 g2 + | (Int_const int1, Int_const int2) -> + let lo1, hi1 = dest_interval int1 and + lo2, hi2 = dest_interval int2 in + eq_float lo1 lo2 && eq_float hi1 hi2 + | _ -> false;; + + +(* Evaluates the given interval function at the point + defined by the given list of variables *) +let eval_interval_fun = + let u_find = Hashtbl.find unary_interval_operations and + b_find = Hashtbl.find binary_interval_operations and + c_find = Hashtbl.find interval_constants in + fun pp ifun vars refs -> + let rec rec_eval f = + match f with + | Int_ref i -> List.nth refs i + | Int_var i -> List.nth vars (i - 1) + | Int_const int -> int + | Int_decimal_const tm -> mk_float_interval_decimal pp tm + | Int_named_const name -> (c_find name) pp + | Int_pow (n,f1) -> pow_interval pp n (rec_eval f1) + | Int_unary (op,f1) -> (u_find op) pp (rec_eval f1) + | Int_binary (op,f1,f2) -> (b_find op) pp (rec_eval f1) (rec_eval f2) in + rec_eval ifun;; + + +(* Evaluates all sub-expressions involving constants in the given interval function *) +let eval_constants = + let u_find = Hashtbl.find unary_interval_operations and + b_find = Hashtbl.find binary_interval_operations and + c_find = Hashtbl.find interval_constants in + fun pp ifun -> + let rec rec_eval f = + match f with + | Int_decimal_const tm -> Int_const (mk_float_interval_decimal pp tm) + | Int_named_const name -> Int_const (c_find name pp) + | Int_pow (n, f1) -> + (let f1_val = rec_eval f1 in + match f1_val with + | Int_const int -> Int_const (pow_interval pp n int) + | _ -> Int_pow (n,f1_val)) + | Int_unary (op, f1) -> + (let f1_val = rec_eval f1 in + match f1_val with + | Int_const int -> Int_const (u_find op pp int) + | _ -> Int_unary (op, f1_val)) + | Int_binary (op, f1, f2) -> + (let f1_val, f2_val = rec_eval f1, rec_eval f2 in + match f1_val with + | Int_const int1 -> + (match f2_val with + | Int_const int2 -> Int_const (b_find op pp int1 int2) + | _ -> Int_binary (op, f1_val, f2_val)) + | _ -> Int_binary (op, f1_val, f2_val)) + | _ -> f in + rec_eval ifun;; + + + +(**************************************) + +(* Builds an interval function from the given term expression *) +let build_interval_fun = + let amp_op_real = `(&):num -> real` in + let rec rec_build expr_tm = + if is_const expr_tm then + (* Constant *) + Int_named_const (fst (dest_const expr_tm)) + else if is_var expr_tm then + (* Variables should be of the form name$i *) + failwith ("Variables should be of the form name$i: " ^ string_of_term expr_tm) + else + let ltm, r_tm = dest_comb expr_tm in + (* Unary operations *) + if is_const ltm then + (* & *) + if ltm = amp_op_real then + let n = dest_numeral r_tm in + Int_const (mk_num_interval n) + else + let r_fun = rec_build r_tm in + Int_unary ((fst o dest_const) ltm, r_fun) + else + (* Binary operations *) + let op, l_tm = dest_comb ltm in + let name = (fst o dest_const) op in + if name = "DECIMAL" then + (* DECIMAL *) + Int_decimal_const expr_tm + else if name = "real_pow" then + (* pow *) + let n = dest_small_numeral r_tm in + Int_pow (n, rec_build l_tm) + else if name = "$" then + (* $ *) + Int_var (dest_small_numeral (rand expr_tm)) + else + let lhs = rec_build l_tm and + rhs = rec_build r_tm in + Int_binary ((fst o dest_const) op, lhs, rhs) in + rec_build;; + + +(* Replaces the given subexpression with the given reference index + for all interval functions in the list. + Returns the number of replaces and a new list of interval functions *) +let replace_subexpr expr expr_index f_list = + let rec replace f = + if eq_ifun f expr then + 1, Int_ref expr_index + else + match f with + | Int_pow (k, f1) -> + let c, f1' = replace f1 in + c, Int_pow (k, f1') + | Int_unary (op, f1) -> + let c, f1' = replace f1 in + c, Int_unary (op, f1') + | Int_binary (op, f1, f2) -> + let c1, f1' = replace f1 in + let c2, f2' = replace f2 in + c1 + c2, Int_binary (op, f1', f2') + | _ -> 0, f in + let cs, fs = unzip (map replace f_list) in + itlist (+) cs 0, fs;; + + + +let is_leaf f = + match f with + | Int_pow _ -> false + | Int_unary _ -> false + | Int_binary _ -> false + | _ -> true;; + +let find_and_replace_all f_list acc = + let rec find_and_replace f i f_list = + if is_leaf f then + f, (0, f_list) + else + let expr, (c, fs) = + match f with + | Int_pow (k, f1) -> find_and_replace f1 i f_list + | Int_unary (op, f1) -> find_and_replace f1 i f_list + | Int_binary (op, f1, f2) -> + let expr, (c1, fs) = find_and_replace f1 i f_list in + if c1 > 1 then expr, (c1, fs) else find_and_replace f2 i f_list + | _ -> f, (0, f_list) in + if c > 1 then expr, (c, fs) else f, replace_subexpr f i f_list in + + let rec iterate fs acc = + let i = length acc in + let expr, (c, fs') = find_and_replace (hd fs) i fs in + if c > 1 then iterate fs' (acc @ [expr]) else fs, acc in + + let rec iterate_all f_list ref_acc f_acc = + match f_list with + | [] -> f_acc, ref_acc + | f :: fs -> + let fs', acc' = iterate f_list ref_acc in + iterate_all (tl fs') acc' (f_acc @ [hd fs']) in + + iterate_all f_list acc [];; + + +let eval_interval_fun_list pp (f_list, refs) vars = + let rec eval_refs refs acc = + match refs with + | [] -> acc + | r :: rs -> + let v = eval_interval_fun pp r vars acc in + eval_refs rs (acc @ [v]) in + let rs = eval_refs refs [] in + map (fun f -> eval_interval_fun pp f vars rs) f_list;; + + +(* Approximate the bounds of the given interval with floating point numbers *) +let interval_to_float_interval pp int_th = + let lo_tm, hi_tm = (dest_pair o rand o concl) int_th in + let f_lo = build_interval_fun lo_tm and + f_hi = build_interval_fun hi_tm in + let int_lo = eval_interval_fun pp f_lo [] [] and + int_hi = eval_interval_fun pp f_hi [] [] in + let a, _ = dest_interval int_lo and + _, b = dest_interval int_hi in + mk_interval (a, b);; + + +(* Adds a new constant approximation to the table of constants *) +let add_constant_interval int_th = + let c_tm = (rand o rator o concl) int_th in + let _ = is_const c_tm or failwith "add_constant_interval: not a constant" in + let interval = interval_to_float_interval 20 int_th in + let approx_array = Array.init 20 (fun i -> round_interval (if i = 0 then 1 else i) interval) in + Hashtbl.add interval_constants (fst (dest_const c_tm)) (fun pp -> approx_array.(pp));; + + +end;; diff --git a/formal_ineqs/informal/informal_m_taylor.hl b/formal_ineqs/informal/informal_m_taylor.hl new file mode 100644 index 0000000..228dabf --- /dev/null +++ b/formal_ineqs/informal/informal_m_taylor.hl @@ -0,0 +1,403 @@ +(* =========================================================== *) +(* Informal taylor intervals *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +(* Dependencies *) +needs "informal/informal_arith.hl";; +needs "informal/informal_eval_interval.hl";; + + +module Informal_taylor = struct + +open Informal_interval;; +open Informal_float;; +open Informal_atn;; +open Informal_eval_interval;; + + +type m_cell_domain = +{ + lo : ifloat list; + hi : ifloat list; + y : ifloat list; + w : ifloat list; +};; + + +type m_taylor_interval = +{ + n : int; + domain : m_cell_domain; + f : interval; + df : interval list; + ddf : interval list list; +};; + + +let float_0 = mk_small_num_float 0 and + float_1 = mk_small_num_float 1 and + float_2 = mk_small_num_float 2;; + +let float_inv2 = div_float_lo 1 float_1 float_2;; + +(* convert_to_float_list *) +let convert_to_float_list pp lo_flag list_tm = + let tms = dest_list list_tm in + let i_funs = map build_interval_fun tms in + let ints = map (fun f -> eval_interval_fun pp f [] []) i_funs in + let extract = (if lo_flag then fst else snd) o dest_interval in + map extract ints;; + + +(* mk_m_center_domain *) +let mk_m_center_domain pp x_list z_list = + let y_list = + let ( * ), (+) = mul_float_eq, add_float_hi pp in + map2 (fun x z -> if eq_float x z then x else float_inv2 * (x + z)) x_list z_list in + + (* test: x <= y <= z *) + let flag1 = itlist2 (fun x y a -> le_float x y && a) x_list y_list true and + flag2 = itlist2 (fun y z a -> le_float y z && a) y_list z_list true in + if not flag1 or not flag2 then + failwith "mk_m_center_domain: ~(x <= y <= z)" + else + let w_list = + let (-) = sub_float_hi pp in + let w1 = map2 (-) y_list x_list in + let w2 = map2 (-) z_list y_list in + map2 max_float w1 w2 in + {lo = x_list; hi = z_list; y = y_list; w = w_list};; + + +(* eval_m_taylor (pp0 for initial evaluation of constants) *) +let eval_m_taylor pp0 f_tm partials partials2 = + let build = eval_constants pp0 o build_interval_fun o snd o dest_abs in + let f = build f_tm in + let n = length partials in + (* Verify that the list of second partial derivatives is correct *) + let _ = map2 (fun i list -> if length list <> i then + failwith "eval_m_taylor: incorrect partials2" else ()) (1--n) partials2 in + let dfs = map (build o rand o concl) partials in + let d2fs = map (build o rand o concl) (List.flatten partials2) in + let f_dfs_list = find_and_replace_all (f :: dfs) [] in + let rec shape_list dd i = + if i >= n then [dd] else + let l1, l2 = chop_list i dd in + l1 :: shape_list l2 (i + 1) in + let d2fs_list = find_and_replace_all d2fs [] in + fun p_lin p_second domain -> + let y_ints = map (fun y -> mk_interval (y, y)) domain.y in + let xz_ints = map mk_interval (zip domain.lo domain.hi) in + let f_dfs_vals = eval_interval_fun_list p_lin f_dfs_list y_ints in + let d2fs_vals = eval_interval_fun_list p_second d2fs_list xz_ints in + {n = n; domain = domain; + f = hd f_dfs_vals; df = tl f_dfs_vals; + ddf = shape_list d2fs_vals 1};; + + +(* mk_eval_functionq *) +let mk_eval_function pp0 f_tm = + let build = eval_constants pp0 o build_interval_fun o snd o dest_abs in + let f = build f_tm in + let f_list = find_and_replace_all [f] [] in + fun pp x_list z_list -> + let xz_ints = map mk_interval (zip x_list z_list) in + let f_val = eval_interval_fun_list pp f_list xz_ints in + hd f_val;; + + +(* error_mul_f2_hi *) +let error_mul_f2_hi pp a int = mul_float_hi pp a (abs_interval int);; + + +(* eval_m_taylor_error *) +(* sum_{i = 1}^n (w_i * (f_ii * w_i + 2 * sum_{j = 1}^{i - 1} w_j * f_ij)) *) +let eval_m_taylor_error pp ti = + let w = ti.domain.w in + let ns = 1--ti.n in + let ( * ), ( + ) = mul_float_hi pp, add_float_hi pp in + let mul_wdd = map2 (fun list i -> Arith_misc.my_map2 (error_mul_f2_hi pp) w list) ti.ddf ns in + let sums1 = map (end_itlist ( + ) o butlast) (tl mul_wdd) in + let sums2 = (hd o hd) mul_wdd :: map2 (fun list t1 -> last list + float_2 * t1) (tl mul_wdd) sums1 in + let sums = map2 ( * ) w sums2 in + end_itlist ( + ) sums;; + + +(* eval_m_taylor_upper_bound *) +let eval_m_taylor_upper_bound pp ti = + let f_hi = (snd o dest_interval) ti.f in + let error = eval_m_taylor_error pp ti in + let ( * ), ( + ) = mul_float_hi pp, add_float_hi pp in + let sum2 = + let mul_wd = map2 (error_mul_f2_hi pp) ti.domain.w ti.df in + end_itlist ( + ) mul_wd in + let a = sum2 + float_inv2 * error in + f_hi + a;; + +(* eval_m_taylor_lower_bound *) +let eval_m_taylor_lower_bound pp ti = + let f_lo = (fst o dest_interval) ti.f in + let error = eval_m_taylor_error pp ti in + let ( * ), ( + ), ( - ) = mul_float_hi pp, add_float_hi pp, sub_float_lo pp in + let sum2 = + let mul_wd = map2 (error_mul_f2_hi pp) ti.domain.w ti.df in + end_itlist ( + ) mul_wd in + let a = sum2 + float_inv2 * error in + f_lo - a;; + + +(* eval_m_taylor_bound *) +let eval_m_taylor_bound pp ti = + let f_lo, f_hi = dest_interval ti.f in + let error = eval_m_taylor_error pp ti in + let ( * ), ( + ), ( - ) = mul_float_hi pp, add_float_hi pp, sub_float_lo pp in + let sum2 = + let mul_wd = map2 (error_mul_f2_hi pp) ti.domain.w ti.df in + end_itlist ( + ) mul_wd in + let a = sum2 + float_inv2 * error in + let hi = f_hi + a in + let lo = f_lo - a in + mk_interval (lo, hi);; + + +(* eval_m_taylor_partial_upper *) +let eval_m_taylor_partial_upper pp i ti = + let df_hi = (snd o dest_interval o List.nth ti.df) (i - 1) in + let dd_list = map (fun j -> if j <= i then + List.nth (List.nth ti.ddf (i - 1)) (j - 1) + else + List.nth (List.nth ti.ddf (j - 1)) (i - 1)) (1--ti.n) in + let sum2 = + let mul_dd = map2 (error_mul_f2_hi pp) ti.domain.w dd_list in + end_itlist (add_float_hi pp) mul_dd in + add_float_hi pp df_hi sum2;; + + +(* eval_m_taylor_partial_lower *) +let eval_m_taylor_partial_lower pp i ti = + let df_lo = (fst o dest_interval o List.nth ti.df) (i - 1) in + let dd_list = map (fun j -> if j <= i then + List.nth (List.nth ti.ddf (i - 1)) (j - 1) + else + List.nth (List.nth ti.ddf (j - 1)) (i - 1)) (1--ti.n) in + let sum2 = + let mul_dd = map2 (error_mul_f2_hi pp) ti.domain.w dd_list in + end_itlist (add_float_hi pp) mul_dd in + sub_float_lo pp df_lo sum2;; + + +(* eval_m_taylor_partial_bound *) +let eval_m_taylor_partial_bound pp i ti = + let df_lo, df_hi = (dest_interval o List.nth ti.df) (i - 1) in + let dd_list = map (fun j -> if j <= i then + List.nth (List.nth ti.ddf (i - 1)) (j - 1) + else + List.nth (List.nth ti.ddf (j - 1)) (i - 1)) (1--ti.n) in + let sum2 = + let mul_dd = map2 (error_mul_f2_hi pp) ti.domain.w dd_list in + end_itlist (add_float_hi pp) mul_dd in + let lo = sub_float_lo pp df_lo sum2 in + let hi = add_float_hi pp df_hi sum2 in + mk_interval (lo, hi);; + + +(* add *) +let eval_m_taylor_add p_lin p_second taylor1 taylor2 = + let ( + ), ( ++ ) = add_interval p_lin, add_interval p_second in + { + n = taylor1.n; + domain = taylor1.domain; + f = taylor1.f + taylor2.f; + df = map2 (+) taylor1.df taylor2.df; + ddf = map2 (map2 (++)) taylor1.ddf taylor2.ddf + };; + + +(* sub *) +let eval_m_taylor_sub p_lin p_second taylor1 taylor2 = + let ( - ), ( -- ) = sub_interval p_lin, sub_interval p_second in + { + n = taylor1.n; + domain = taylor1.domain; + f = taylor1.f - taylor2.f; + df = map2 (-) taylor1.df taylor2.df; + ddf = map2 (map2 (--)) taylor1.ddf taylor2.ddf + };; + + +(* mul *) +let eval_m_taylor_mul p_lin p_second ti1 ti2 = + let n = ti1.n in + let ns = 1--n in + let bounds = mul_interval p_lin ti1.f ti2.f in + let df = map2 (fun d1 d2 -> + let ( * ), ( + ) = mul_interval p_lin, add_interval p_lin in + d1 * ti2.f + ti1.f * d2) ti1.df ti2.df in + let d1_bounds = map (fun i -> eval_m_taylor_partial_bound p_second i ti1) ns in + let d2_bounds = map (fun i -> eval_m_taylor_partial_bound p_second i ti2) ns in + let f1_bound = eval_m_taylor_bound p_second ti1 in + let f2_bound = eval_m_taylor_bound p_second ti2 in + let ddf = + let ( * ), ( + ) = mul_interval p_second, add_interval p_second in + map2 (fun (list1, list2) i -> + let di1 = List.nth d1_bounds (i - 1) in + let di2 = List.nth d2_bounds (i - 1) in + map2 (fun (dd1, dd2) j -> + let dj1 = List.nth d1_bounds (j - 1) in + let dj2 = List.nth d2_bounds (j - 1) in + (dd1 * f2_bound + di1 * dj2) + (dj1 * di2 + f1_bound * dd2)) + (zip list1 list2) (1--i)) (zip ti1.ddf ti2.ddf) ns in + { + n = n; + domain = ti1.domain; + f = bounds; + df = df; + ddf = ddf; + };; + +(* neg *) +let eval_m_taylor_neg taylor1 = + let neg = neg_interval in + { + n = taylor1.n; + domain = taylor1.domain; + f = neg taylor1.f; + df = map neg taylor1.df; + ddf = map (map neg) taylor1.ddf; + };; + +(* inv *) +let eval_m_taylor_inv p_lin p_second ti = + let n = ti.n in + let ns = 1--n in + let f1_bound = eval_m_taylor_bound p_second ti in + let bounds = inv_interval p_lin ti.f in + let u_bounds = + let neg, inv, ( * ) = neg_interval, inv_interval p_lin, mul_interval p_lin in + neg (inv (ti.f * ti.f)) in + let df = + let ( * ) = mul_interval p_lin in + map (fun d -> u_bounds * d) ti.df in + let d1_bounds = map (fun i -> eval_m_taylor_partial_bound p_second i ti) ns in + let d1, d2 = + let inv, ( * ) = inv_interval p_second, mul_interval p_second in + let ff = f1_bound * f1_bound in + inv ff, two_interval * inv (f1_bound * ff) in + let ddf = + let ( * ), ( - ) = mul_interval p_second, sub_interval p_second in + map2 (fun dd_list di1 -> + Arith_misc.my_map2 (fun dd dj1 -> + (d2 * dj1) * di1 - d1 * dd) dd_list d1_bounds) ti.ddf d1_bounds in + { + n = n; + domain = ti.domain; + f = bounds; + df = df; + ddf = ddf; + };; + + +(* sqrt *) +let eval_m_taylor_sqrt p_lin p_second ti = + let n = ti.n in + let ns = 1--n in + let f1_bound = eval_m_taylor_bound p_second ti in + let bounds = sqrt_interval p_lin ti.f in + let u_bounds = + let inv, ( * ) = inv_interval p_lin, mul_interval p_lin in + inv (two_interval * bounds) in + let df = + let ( * ) = mul_interval p_lin in + map (fun d -> u_bounds * d) ti.df in + let d1_bounds = map (fun i -> eval_m_taylor_partial_bound p_second i ti) ns in + let d1, d2 = + let neg, sqrt, inv, ( * ) = neg_interval, sqrt_interval p_second, + inv_interval p_second, mul_interval p_second in + let two_sqrt_f = two_interval * sqrt f1_bound in + inv two_sqrt_f, neg (inv (two_sqrt_f * (two_interval * f1_bound))) in + let ddf = + let ( * ), ( + ) = mul_interval p_second, add_interval p_second in + map2 (fun dd_list di1 -> + Arith_misc.my_map2 (fun dd dj1 -> + (d2 * dj1) * di1 + d1 * dd) dd_list d1_bounds) ti.ddf d1_bounds in + { + n = n; + domain = ti.domain; + f = bounds; + df = df; + ddf = ddf; + };; + + +(* atn *) +let eval_m_taylor_atn = + let neg_two_interval = neg_interval two_interval in + fun p_lin p_second ti -> + let n = ti.n in + let ns = 1--n in + let f1_bound = eval_m_taylor_bound p_second ti in + let bounds = atn_interval p_lin ti.f in + let u_bounds = + let inv, ( + ), ( * ) = inv_interval p_lin, add_interval p_lin, mul_interval p_lin in + inv (one_interval + ti.f * ti.f) in + let df = + let ( * ) = mul_interval p_lin in + map (fun d -> u_bounds * d) ti.df in + let d1_bounds = map (fun i -> eval_m_taylor_partial_bound p_second i ti) ns in + let d1, d2 = + let neg, inv, ( + ), ( * ) = neg_interval, inv_interval p_second, + add_interval p_second, mul_interval p_second in + let pow2 = pow_interval p_second 2 in + let inv_one_ff = inv (one_interval + f1_bound * f1_bound) in + inv_one_ff, (neg_two_interval * f1_bound) * pow2 inv_one_ff in + let ddf = + let ( * ), ( + ) = mul_interval p_second, add_interval p_second in + map2 (fun dd_list di1 -> + Arith_misc.my_map2 (fun dd dj1 -> + (d2 * dj1) * di1 + d1 * dd) dd_list d1_bounds) ti.ddf d1_bounds in + { + n = n; + domain = ti.domain; + f = bounds; + df = df; + ddf = ddf; + };; + + +(* acs *) +let eval_m_taylor_acs p_lin p_second ti = + let n = ti.n in + let ns = 1--n in + let f1_bound = eval_m_taylor_bound p_second ti in + let bounds = acs_interval p_lin ti.f in + let u_bounds = + let inv, sqrt, neg = inv_interval p_lin, sqrt_interval p_lin, neg_interval in + let ( * ), ( - ) = mul_interval p_lin, sub_interval p_lin in + neg (inv (sqrt (one_interval - ti.f * ti.f))) in + let df = + let ( * ) = mul_interval p_lin in + map (fun d -> u_bounds * d) ti.df in + let d1_bounds = map (fun i -> eval_m_taylor_partial_bound p_second i ti) ns in + let d1, d2 = + let neg, sqrt, inv = neg_interval, sqrt_interval p_second, inv_interval p_second in + let ( - ), ( * ), ( / ) = sub_interval p_second, mul_interval p_second, div_interval p_second in + let pow3 = pow_interval p_second 3 in + let ff_1 = one_interval - f1_bound * f1_bound in + inv (sqrt ff_1), neg (f1_bound / sqrt (pow3 ff_1)) in + let ddf = + let ( * ), ( - ) = mul_interval p_second, sub_interval p_second in + map2 (fun dd_list di1 -> + Arith_misc.my_map2 (fun dd dj1 -> + (d2 * dj1) * di1 - d1 * dd) dd_list d1_bounds) ti.ddf d1_bounds in + { + n = n; + domain = ti.domain; + f = bounds; + df = df; + ddf = ddf; + };; + + +end;; diff --git a/formal_ineqs/informal/informal_m_verifier.hl b/formal_ineqs/informal/informal_m_verifier.hl new file mode 100644 index 0000000..b14459f --- /dev/null +++ b/formal_ineqs/informal/informal_m_verifier.hl @@ -0,0 +1,317 @@ +(* =========================================================== *) +(* Informal verification procedures *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +(* Dependencies *) +needs "informal/informal_m_taylor.hl";; +needs "verifier/interval_m/recurse.hl";; +needs "verifier_options.hl";; + +module Informal_verifier = struct + +open Informal_float;; +open Informal_interval;; +open Informal_taylor;; +open Recurse;; +open Verifier_options;; + + +type verification_funs = +{ + (* p_lin -> p_second -> dom -> ti *) + taylor : int -> int -> m_cell_domain -> m_taylor_interval; + (* pp -> xx -> zz -> interval *) + f : int -> ifloat list -> ifloat list -> interval; + (* j -> pp -> xx -> zz -> interval *) + df : int -> int -> ifloat list -> ifloat list -> interval; + (* i j -> pp -> xx -> zz -> interval *) + ddf : int -> int -> int -> ifloat list -> ifloat list -> interval; +};; + + +(* m_subset_interval *) +let m_subset_interval a b c d = + let prove_le l1 l2 = itlist2 (fun x y r -> le_float x y && r) l1 l2 true in + prove_le a c && prove_le d b;; + +(* m_taylor_cell_pass *) +let m_taylor_cell_pass pp ti = + let upper = eval_m_taylor_upper_bound pp ti in + lt0_float upper;; + +(* m_taylor_cell_pass0 *) +let m_taylor_cell_pass0 int = + (lt0_float o snd o dest_interval) int;; + +(* m_cell_pass_subdomain *) +let m_cell_pass_subdomain domain2 pass_domain = + let a, b = pass_domain.lo, pass_domain. hi in + let c, d = domain2.lo, domain2.hi in + m_subset_interval a b c d;; + +(* m_incr_pass *) +let m_incr_pass pp j ti = + let partial_bound = eval_m_taylor_partial_lower pp j ti in + ge0_float partial_bound;; + +(* m_decr_pass *) +let m_decr_pass pp j ti = + let partial_bound = eval_m_taylor_partial_upper pp j ti in + le0_float partial_bound;; + +(* m_mono_pass_gen *) +let m_mono_pass_gen decr_flag bound = + (if decr_flag then le0_float else ge0_float) bound;; + +(* m_convex_pass *) +let m_convex_pass int = + (ge0_float o fst o dest_interval) int;; + + +(* mk_verification_functions *) +let mk_verification_functions_poly pp0 f partials partials2 = + let n = length partials in + let taylor = eval_m_taylor pp0 f partials partials2 in + let eval0 = mk_eval_function pp0 f in + let eval1 = map (fun i -> mk_eval_function pp0 ((rand o concl o List.nth partials) (i - 1))) (1--n) in + let eval2 = map (fun i -> + map (fun j -> + let d2 = List.nth (List.nth partials2 (i - 1)) (j - 1) in + mk_eval_function pp0 ((rand o concl) d2)) (1--i)) (1--n) in + { + taylor = taylor; + f = eval0; + df = (fun i -> List.nth eval1 (i - 1)); + ddf = (fun i j -> List.nth (List.nth eval2 (j - 1)) (i - 1)); + };; + + +(* split_domain *) +let split_domain pp j domain = + let n = length domain.w in + let t = List.nth domain.y (j - 1) in + let vv = map (fun i -> if i = j then t else List.nth domain.hi (i - 1)) (1--n) in + let uu = map (fun i -> if i = j then t else List.nth domain.lo (i - 1)) (1--n) in + mk_m_center_domain pp domain.lo vv, mk_m_center_domain pp uu domain.hi;; + + +(* restrict_domain *) +let restrict_domain j left_flag domain = + let replace list j v = map (fun i -> if i = j then v else List.nth list (i - 1)) (1--length list) in + let t = List.nth (if left_flag then domain.lo else domain.hi) (j - 1) in + let lo = if left_flag then domain.lo else replace domain.lo j t in + let hi = if left_flag then replace domain.hi j t else domain.hi in + let w = replace domain.w j float_0 in + let y = replace domain.y j t in + {lo = lo; hi = hi; w = w; y = y};; + + +(*****************************) +(* aux list functions *) + +(* Merges lists of indices. Input lists must be sorted *) +let merge_indices l1 l2 = uniq (merge (<) l1 l2);; + +(* Returns all elements at the given indices *) +let take_all l inds = map (List.nth l) inds;; + + +(*****************************) +(* m_verify_raw *) + +(* Constructs a p_result_tree from the given result_tree *) +let m_verify_raw (report_start, total_size) p_split p_min p_max fs_list certificate domain0 ref_list = + let r_size = result_size certificate in + let r_size2 = float_of_int (if total_size > 0 then total_size else (if r_size > 0 then r_size else 1)) in + let k = ref 0 in + let kk = ref report_start in + let last_report = ref (int_of_float (float_of_int !kk /. r_size2 *. 100.0)) in + let ps = p_min -- p_max in + + (* finds an optimal precision value *) + let rec find_p p_fun p_list = + match p_list with + | [] -> failwith "find_p: no good p found" + | p :: ps -> + let flag = (try p_fun p with Failure _ -> false | Division_by_zero -> false) in + if flag then + let _ = if !info_print_level >= 2 then report (sprintf "p = %d" p) else () in p + else find_p p_fun ps in + + (* pass_test *) + let pass_test domain (j,f0_flag) pp = + let fs = List.nth fs_list j in + if f0_flag then + m_taylor_cell_pass0 (fs.f pp domain.lo domain.hi) + else + m_taylor_cell_pass pp (fs.taylor pp pp domain) in + + (* glue_test *) + let glue_test domain i convex_flag inds pp = + let fss = take_all fs_list inds in + if convex_flag then + forall (fun fs -> m_convex_pass (fs.ddf (i + 1) (i + 1) pp domain.lo domain.hi)) fss + else + true in + + (* mono_test *) + let mono_test mono domain domains inds pp = + let fss = take_all fs_list inds in + let xx, zz = domain.lo, domain.hi in + let taylors = map (fun fs -> fs.taylor pp pp domain) fss in + let gen_mono m = + if m.df0_flag then + if m.decr_flag then + map (fun fs -> (snd o dest_interval) (fs.df m.variable pp xx zz)) fss + else + map (fun fs -> (fst o dest_interval) (fs.df m.variable pp xx zz)) fss + else + if m.decr_flag then + map (eval_m_taylor_partial_upper pp m.variable) taylors + else + map (eval_m_taylor_partial_lower pp m.variable) taylors in + let monos = map gen_mono mono in + rev_itlist (fun (m, bounds) pass -> + let flag = m.decr_flag in + forall (m_mono_pass_gen flag) bounds && pass) (rev (zip mono monos)) true in + + (* mk_domains *) + let rec mk_domains mono dom0 acc = + match mono with + | [] -> rev acc + | m :: ms -> + let j, flag = m.variable, m.decr_flag in + let dom = restrict_domain j flag dom0 in + mk_domains ms dom (dom :: acc) in + + (* rec_verify *) + let rec rec_verify domain certificate = + match certificate with + | Result_mono (mono, r1) -> + let _ = + if !info_print_level >= 2 then + let mono_strs = + map (fun m -> sprintf "%s%d (%b)" (if m.decr_flag then "-" else "") + m.variable m.df0_flag) mono in + report (sprintf "Mono: [%s]" (String.concat ";" mono_strs)) + else () in + let domains = mk_domains mono domain [] in + let tree1, inds = rec_verify (last domains) r1 in + (try + let pp = find_p (mono_test mono domain domains inds) ps in + P_result_mono ({pp = pp}, mono, tree1), inds + with Failure _ -> failwith "mono: failed") + + | Result_pass (j, f0_flag) -> + let _ = k := !k + 1; kk := !kk + 1 in + let _ = + if !info_print_level >= 2 then + report (sprintf "Verifying: %d/%d (f0_flag = %b)" !k r_size f0_flag) + else () in + let _ = !info_print_level <> 1 or + (let r = int_of_float (float_of_int !kk /. r_size2 *. 100.0) in + let _ = if r <> !last_report then (last_report := r; report0 (sprintf "%d " r)) else () in true) in + + (try + let pp = find_p (pass_test domain (j, f0_flag)) ps in + P_result_pass ({pp = pp}, j, f0_flag), [j] + with Failure _ -> failwith "pass: failed") + + | Result_glue (i, convex_flag, r1, r2) -> + let domain1, domain2 = + if convex_flag then + let d1 = restrict_domain (i + 1) true domain in + let d2 = restrict_domain (i + 1) false domain in + d1, d2 + else + split_domain p_split (i + 1) domain in + let tree1, inds1 = rec_verify domain1 r1 in + let tree2, inds2 = rec_verify domain2 r2 in + let inds = merge_indices inds1 inds2 in + (try + let pp = find_p (glue_test domain i convex_flag inds) ps in + P_result_glue ({pp = pp}, i, convex_flag, tree1, tree2), inds + with Failure _ -> failwith "glue: failed") + + | Result_pass_ref i -> + let _ = if !info_print_level >= 2 then report (sprintf "Ref: %d" i) else () in + let pass_flag, inds = + if i > 0 then + let _, inds = List.nth ref_list (i - 1) in + true, inds + else + let pass_domain, inds = List.nth ref_list (-i - 1) in + m_cell_pass_subdomain domain pass_domain, inds in + if not pass_flag then + failwith "ref: failed" + else + P_result_ref i, inds + + | _ -> failwith "False result" in + + rec_verify domain0 certificate;; + + + +(*****************) + +(* m_verify_raw0 *) +let m_verify_raw0 p_split p_min p_max fs_list certificate xx zz = + m_verify_raw (0, 0) p_split p_min p_max fs_list certificate (mk_m_center_domain p_split xx zz) [];; + + +(* m_verify_list *) +let m_verify_list p_split p_min p_max fs_list certificate_list xx zz = + let domain_hash = Hashtbl.create (length certificate_list * 10) in + let mem, find, add = Hashtbl.mem domain_hash, + Hashtbl.find domain_hash, Hashtbl.add domain_hash in + + let get_m_cell_domain pp domain0 path = + let rec get_rec domain path hash = + match path with + | [] -> domain + | (s, j) :: ps -> + let hash' = hash^s^(string_of_int j) in + if mem hash' then + get_rec (find hash') ps hash' + else + if s = "l" or s = "r" then + let domain1, domain2 = split_domain pp j domain in + let hash1 = hash^"l"^(string_of_int j) and + hash2 = hash^"r"^(string_of_int j) in + let _ = add hash1 domain1; add hash2 domain2 in + if s = "l" then + get_rec domain1 ps hash' + else + get_rec domain2 ps hash' + else + let l_flag = (s = "ml") in + let domain' = restrict_domain j l_flag domain in + let _ = add hash' domain' in + get_rec domain' ps hash' in + get_rec domain0 path "" in + + let domain0 = mk_m_center_domain p_split xx zz in + let size = length certificate_list in + let k = ref 0 in + let kk = ref 0 in + let total_size = end_itlist (+) (map (result_size o snd) certificate_list) in + + let rec rec_verify certificate_list dom_list tree_list = + match certificate_list with + | [] -> rev tree_list + | (path, certificate) :: cs -> + let _ = k := !k + 1 in + let _ = !info_print_level < 2 or (report (sprintf "List: %d/%d" !k size); true) in + let domain = get_m_cell_domain p_split domain0 path in + let tree, inds = m_verify_raw (!kk, total_size) p_split p_min p_max fs_list certificate domain dom_list in + let _ = kk := !kk + result_size certificate in + rec_verify cs (dom_list @ [domain, inds]) ((path, tree) :: tree_list) in + rec_verify certificate_list [] [];; + +end;; + + + diff --git a/formal_ineqs/jordan/parse_ext_override_interface.hl b/formal_ineqs/jordan/parse_ext_override_interface.hl new file mode 100644 index 0000000..1ccb7d4 --- /dev/null +++ b/formal_ineqs/jordan/parse_ext_override_interface.hl @@ -0,0 +1,213 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Jordan *) +(* Copied from HOL Light jordan directory *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-08 *) +(* ========================================================================== *) + +module Parse_ext_override_interface = struct + +(* + + As a new user of HOL-light, I have had a difficult time distinguishing + between the different uses of overloaded operators such as + (+), ( * ), (abs) (&), and so forth. + + Their interpretation is context dependent, according to which of + prioritize_num, prioritize_int, and prioritize_real was most + recently called. + + This file removes all ambiguities in notation. + Following the usage of CAML, we append a dot to operations on real + numbers so that addition is (+.), etc. + + In the same way, we remove ambiguities between natural numbers and + integers by appending a character. We have chosen to use + the character `|` for natural number operations + and the character `:` for integer operations. + + The character `&` continues to denote the embedding of + natural numbers into the integers or reals. + + HOL-light parsing does not permit an operator mixing alphanumeric + characters with symbols. Thus, we were not able to use (abs.) + and (abs:) for the absolute value. Instead we adapt the usual notation + |x| for absolute value and write it in prefix notation ||: and + ||. for the integer and real absolute value functions respectively. + + In deference to HOL-light notation, we use ** for the exponential + function. There are three versions: ( **| ), ( **: ), and ( **. ). + +*) + +(* natural number operations *) + + + +let unambiguous_interface() = +parse_as_infix("+|",(16,"right")); +parse_as_infix("-|",(18,"left")); +parse_as_infix("*|",(20,"right")); +parse_as_infix("**|",(24,"left")); (* EXP *) +parse_as_infix("/|",(22,"right")); (* DIV *) +parse_as_infix("%|",(22,"left")); (* MOD *) +parse_as_infix("<|",(12,"right")); +parse_as_infix("<=|",(12,"right")); +parse_as_infix(">|",(12,"right")); +parse_as_infix(">=|",(12,"right")); +override_interface("+|",`(+):num->(num->num)`); +override_interface("-|",`(-):num->(num->num)`); +override_interface("*|",`( * ):num->(num->num)`); +override_interface("**|",`(EXP):num->(num->num)`); +override_interface("/|",`(DIV):num->(num->num)`); +override_interface("%|",`(MOD):num->(num->num)`); +override_interface("<|",`(<):num->(num->bool)`); +override_interface("<=|",`(<=):num->(num->bool)`); +override_interface(">|",`(>):num->(num->bool)`); +override_interface(">=|",`(>=):num->(num->bool)`); +(* integer operations *) +parse_as_infix("+:",(16,"right")); +parse_as_infix("-:",(18,"left")); +parse_as_infix("*:",(20,"right")); +parse_as_infix("**:",(24,"left")); +parse_as_infix("<:",(12,"right")); +parse_as_infix("<=:",(12,"right")); +parse_as_infix(">:",(12,"right")); +parse_as_infix(">=:",(12,"right")); +override_interface("+:",`int_add:int->int->int`); +override_interface("-:",`int_sub:int->int->int`); +override_interface("*:",`int_mul:int->int->int`); +override_interface("**:",`int_pow:int->num->int`); +(* boolean *) +override_interface("<:",`int_lt:int->int->bool`); +override_interface("<=:",`int_le:int->int->bool`); +override_interface(">:",`int_gt:int->int->bool`); +override_interface(">=:",`int_ge:int->int->bool`); +(* unary *) +override_interface("--:",`int_neg:int->int`); +override_interface("&:",`int_of_num:num->int`); +override_interface("||:",`int_abs:int->int`); +(* real number operations *) +parse_as_infix("+.",(16,"right")); +parse_as_infix("-.",(18,"left")); +parse_as_infix("*.",(20,"right")); +parse_as_infix("**.",(24,"left")); +parse_as_infix("<.",(12,"right")); +parse_as_infix("<=.",(12,"right")); +parse_as_infix(">.",(12,"right")); +parse_as_infix(">=.",(12,"right")); +override_interface("+.",`real_add:real->real->real`); +override_interface("-.",`real_sub:real->real->real`); +override_interface("*.",`real_mul:real->real->real`); +override_interface("**.",`real_pow:real->num->real`); +(* boolean *) +override_interface("<.",`real_lt:real->real->bool`); +override_interface("<=.",`real_le:real->real->bool`); +override_interface(">.",`real_gt:real->real->bool`); +override_interface(">=.",`real_ge:real->real->bool`); +(* unary *) +override_interface("--.",`real_neg:real->real`); +override_interface("&.",`real_of_num:num->real`); +override_interface("||.",`real_abs:real->real`);; + +let ambiguous_interface() = +reduce_interface("+|",`(+):num->(num->num)`); +reduce_interface("-|",`(-):num->(num->num)`); +reduce_interface("*|",`( * ):num->(num->num)`); +reduce_interface("**|",`(EXP):num->(num->num)`); +reduce_interface("/|",`(DIV):num->(num->num)`); +reduce_interface("%|",`(MOD):num->(num->num)`); +reduce_interface("<|",`(<):num->(num->bool)`); +reduce_interface("<=|",`(<=):num->(num->bool)`); +reduce_interface(">|",`(>):num->(num->bool)`); +reduce_interface(">=|",`(>=):num->(num->bool)`); +(* integer operations *) +reduce_interface("+:",`int_add:int->int->int`); +reduce_interface("-:",`int_sub:int->int->int`); +reduce_interface("*:",`int_mul:int->int->int`); +reduce_interface("**:",`int_pow:int->num->int`); +(* boolean *) +reduce_interface("<:",`int_lt:int->int->bool`); +reduce_interface("<=:",`int_le:int->int->bool`); +reduce_interface(">:",`int_gt:int->int->bool`); +reduce_interface(">=:",`int_ge:int->int->bool`); +(* unary *) +reduce_interface("--:",`int_neg:int->int`); +reduce_interface("&:",`int_of_num:num->int`); +reduce_interface("||:",`int_abs:int->int`); +(* real *) +reduce_interface("+.",`real_add:real->real->real`); +reduce_interface("-.",`real_sub:real->real->real`); +reduce_interface("*.",`real_mul:real->real->real`); +reduce_interface("**.",`real_pow:real->num->real`); +(* boolean *) +reduce_interface("<.",`real_lt:real->real->bool`); +reduce_interface("<=.",`real_le:real->real->bool`); +reduce_interface(">.",`real_gt:real->real->bool`); +reduce_interface(">=.",`real_ge:real->real->bool`); +(* unary *) +reduce_interface("--.",`real_neg:real->real`); +reduce_interface("&.",`real_of_num:num->real`); +reduce_interface("||.",`real_abs:real->real`);; + +(* add to Harrison's priorities the functions pop_priority and get_priority *) + +let prioritize_int,prioritize_num,prioritize_real,pop_priority,get_priority = + let v = ref ([]:string list) in + let prioritize_int() = + v:= "int"::!v; + overload_interface ("+",`int_add:int->int->int`); + overload_interface ("-",`int_sub:int->int->int`); + overload_interface ("*",`int_mul:int->int->int`); + overload_interface ("<",`int_lt:int->int->bool`); + overload_interface ("<=",`int_le:int->int->bool`); + overload_interface (">",`int_gt:int->int->bool`); + overload_interface (">=",`int_ge:int->int->bool`); + overload_interface ("--",`int_neg:int->int`); + overload_interface ("pow",`int_pow:int->num->int`); + overload_interface ("abs",`int_abs:int->int`); + override_interface ("&",`int_of_num:num->int`) and + prioritize_num() = + v:= "num"::!v; + overload_interface ("+",`(+):num->num->num`); + overload_interface ("-",`(-):num->num->num`); + overload_interface ("*",`(*):num->num->num`); + overload_interface ("<",`(<):num->num->bool`); + overload_interface ("<=",`(<=):num->num->bool`); + overload_interface (">",`(>):num->num->bool`); + overload_interface (">=",`(>=):num->num->bool`) and + prioritize_real() = + v:= "real"::!v; + overload_interface ("+",`real_add:real->real->real`); + overload_interface ("-",`real_sub:real->real->real`); + overload_interface ("*",`real_mul:real->real->real`); + overload_interface ("/",`real_div:real->real->real`); + overload_interface ("<",`real_lt:real->real->bool`); + overload_interface ("<=",`real_le:real->real->bool`); + overload_interface (">",`real_gt:real->real->bool`); + overload_interface (">=",`real_ge:real->real->bool`); + overload_interface ("--",`real_neg:real->real`); + overload_interface ("pow",`real_pow:real->num->real`); + overload_interface ("inv",`real_inv:real->real`); + overload_interface ("abs",`real_abs:real->real`); + override_interface ("&",`real_of_num:num->real`) and + pop_priority() = + if (length !v <= 1) then (print_string "priority unchanged\n") else + let (a::b::c) = !v in + v:= (b::c); + print_string ("priority is now "^b^"\n"); + match a with + "num" -> prioritize_num() | + "int" -> prioritize_int() | + "real"-> prioritize_real()| + _ -> () and + get_priority() = + if (!v=[]) then "unknown" else + let (a::b) = !v in a + in + prioritize_int,prioritize_num,prioritize_real,pop_priority,get_priority;; + + +end;; diff --git a/formal_ineqs/jordan/real_ext.hl b/formal_ineqs/jordan/real_ext.hl new file mode 100644 index 0000000..243a654 --- /dev/null +++ b/formal_ineqs/jordan/real_ext.hl @@ -0,0 +1,303 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Jordan *) +(* Copied from HOL Light jordan directory *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-08 *) +(* ========================================================================== *) + +module Real_ext = struct + +open Parse_ext_override_interface;; +(* open Tactics_jordan;; *) + + + +(* ------------------------------------------------------------------ *) +(* Theorems that construct and propagate equality and inequality *) +(* ------------------------------------------------------------------ *) + +(* ------------------------------------------------------------------ *) +(* Propagation of =EQUAL= *) +(* ------------------------------------------------------------------ *) + +unambiguous_interface();; +prioritize_num();; + +let REAL_LE = REAL_OF_NUM_LE;; + +let pow = real_pow;; + + +let REAL_INV2 = prove( + `(inv(&. 2)*(&. 2) = (&.1)) /\ ((&. 2)*inv(&. 2) = (&.1))`, + SUBGOAL_THEN `~((&.2) = (&.0))` MP_TAC +THENL[ + REAL_ARITH_TAC; + SIMP_TAC[REAL_MUL_RINV;REAL_MUL_LINV]]);; + + + + +let REAL_MUL_LTIMES = prove (`!x a b. (x*.a = x*.b) ==> (~(x=(&.0))) ==> (a =b)`, + MESON_TAC[REAL_EQ_MUL_LCANCEL]);; + +let REAL_MUL_RTIMES = prove (`!x a b. (a*.x = b*.x) ==> (~(x=(&.0))) ==> (a =b)`, + MESON_TAC[REAL_EQ_MUL_RCANCEL]);; + +let REAL_PROP_EQ_LMUL = REAL_MUL_LTIMES;; +let REAL_PROP_EQ_RMUL = REAL_MUL_RTIMES;; + +let REAL_PROP_EQ_LMUL_' = REAL_EQ_MUL_LCANCEL (* |- !x y z. (x * y = x * z) = (x = &0) \/ (y = z) *);; +let REAL_PROP_EQ_RMUL_' = REAL_EQ_MUL_LCANCEL (* |- !x y z. (x * z = y * z) = (x = y) \/ (z = &0) *);; +(* see also minor variations REAL_LT_LMUL_EQ, REAL_LT_RMUL_EQ *) + +let REAL_PROP_EQ_SQRT = SQRT_INJ;; (* |- !x y. &0 <= x /\ &0 <= y ==> ((sqrt x = sqrt y) = x = y) *) + +(* ------------------------------------------------------------------ *) +(* Construction of <=. *) +(* ------------------------------------------------------------------ *) +let REAL_MK_LE_SQUARE = REAL_LE_POW_2 ;; (* |- !x. &0 <= x pow 2 *) + +(* ------------------------------------------------------------------ *) +(* Propagation of <=. *) +(* ------------------------------------------------------------------ *) + +let REAL_MUL_LTIMES_LE = prove (`!x a b. (x*.a <=. x*.b) ==> (&.0 < x) ==> (a <=. b)`, + MESON_TAC[REAL_LE_LMUL_EQ]);; + (* virtually identical to REAL_LE_LCANCEL_IMP, REAL_LE_LMUL_EQ *) + +let REAL_MUL_RTIMES_LE = prove (`!x a b. (a*.x <=. b*.x) ==> (&.0 < x) ==> (a <=. b)`, + MESON_TAC[REAL_LE_RMUL_EQ]);; + (* virtually identical to REAL_LE_RCANCEL_IMP, REAL_LE_RMUL_EQ *) + +let REAL_PROP_LE_LCANCEL = REAL_MUL_LTIMES_LE;; +let REAL_PROP_LE_RCANCEL = REAL_MUL_RTIMES_LE;; +let REAL_PROP_LE_LMUL = REAL_LE_LMUL (* |- !x y z. &0 <= x /\ y <= z ==> x * y <= x * z *);; +let REAL_PROP_LE_RMUL = REAL_LE_RMUL (* |- !x y z. x <= y /\ &0 <= z ==> x * z <= y * z *);; +let REAL_PROP_LE_LRMUL = REAL_LE_MUL2;; (* |- !w x y z. &0 <= w /\ w <= x /\ &0 <= y /\ y <= z ==> w * y <= x * z *) +let REAL_PROP_LE_POW = REAL_POW_LE2;; (* 2010-07-08 thales: POW_LE;; *) (* |- !n x y. &0 <= x /\ x <= y ==> x pow n <= y pow n *) +let REAL_PROP_LE_SQRT = SQRT_MONO_LE_EQ;; (* |- !x y. &0 <= x /\ &0 <= y ==> (sqrt x <= sqrt y = x <= y) *) + +(* ------------------------------------------------------------------ *) +(* Construction of LT *) +(* ------------------------------------------------------------------ *) + +let REAL_MK_LT_SQUARE = REAL_LT_SQUARE;; (* |- !x. &0 < x * x = ~(x = &0) *) + +(* ------------------------------------------------------------------ *) +(* Propagation of LT *) +(* ------------------------------------------------------------------ *) + +let REAL_PROP_LT_LCANCEL = REAL_LT_LCANCEL_IMP (* |- !x y z. &0 < x /\ x * y < x * z ==> y < z *);; +let REAL_PROP_LT_RCANCEL = REAL_LT_RCANCEL_IMP (* |- !x y z. &0 < z /\ x * z < y * z ==> x < y *);; +let REAL_PROP_LT_LMUL = REAL_LT_LMUL (* |- !x y z. &0 < x /\ y < z ==> x * y < x * z *);; +let REAL_PROP_LT_RMUL = REAL_LT_RMUL (* |- !x y z. x < y /\ &0 < z ==> x * z < y * z *);; +(* minor variation REAL_LT_LMUL_IMP, REAL_LT_RMUL_IMP *) + +let REAL_PROP_LT_LRMUL= REAL_LT_MUL2;; (* |- !w x y z. &0 <= w /\ w < x /\ &0 <= y /\ y < z ==> w * y < x * z *) +let REAL_PROP_LT_SQRT = SQRT_MONO_LT_EQ;; (* |- !x y. &0 <= x /\ &0 <= y ==> (sqrt x < sqrt y = x < y) *) + +(* ------------------------------------------------------------------ *) +(* Constructors of Non-negative *) +(* ------------------------------------------------------------------ *) + +let REAL_MK_NN_SQUARE = REAL_LE_SQUARE;; (* |- !x. &0 <= x * x *) +let REAL_MK_NN_ABS = REAL_ABS_POS;; (* 2010 *) (* |- !x. &0 <= abs x *) + +(* moved here from float.hl *) + +(* from 778 *) + + +let REAL_LE_LMUL_LOCAL = prove( + `!x y z. &0 < x ==> ((x * y) <= (x * z) <=> y <= z)`, + REPEAT GEN_TAC THEN DISCH_TAC THEN ONCE_REWRITE_TAC[GSYM REAL_NOT_LT] THEN + AP_TERM_TAC THEN MATCH_MP_TAC REAL_LT_LMUL_EQ THEN ASM_REWRITE_TAC[]);; + + +let ABS_TRIANGLE = prove( + `!x y. abs(x + y) <= abs(x) + abs(y)`, + REPEAT GEN_TAC THEN REWRITE_TAC[real_abs] THEN + REPEAT COND_CASES_TAC THEN + REWRITE_TAC[REAL_NEG_ADD; REAL_LE_REFL; REAL_LE_LADD; REAL_LE_RADD] THEN + ASM_REWRITE_TAC[GSYM REAL_NEG_ADD; REAL_LE_NEGL; REAL_LE_NEGR] THEN + RULE_ASSUM_TAC(REWRITE_RULE[REAL_NOT_LE]) THEN + TRY(MATCH_MP_TAC REAL_LT_IMP_LE) THEN TRY(FIRST_ASSUM ACCEPT_TAC) THEN + TRY(UNDISCH_TAC `(x + y) < &0`) THEN SUBST1_TAC(SYM(SPEC `&0` REAL_ADD_LID)) + THEN REWRITE_TAC[REAL_NOT_LT] THEN + MAP_FIRST MATCH_MP_TAC [REAL_LT_ADD2; REAL_LE_ADD2] THEN + ASM_REWRITE_TAC[]);; + +let REAL_LE_LMUL_IMP = prove( + `!x y z. &0 <= x /\ y <= z ==> (x * y) <= (x * z)`, + REPEAT GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN + DISCH_THEN(DISJ_CASES_TAC o REWRITE_RULE[REAL_LE_LT]) THENL + [FIRST_ASSUM(fun th -> ASM_REWRITE_TAC[MATCH_MP REAL_LE_LMUL_LOCAL th]); + FIRST_ASSUM(SUBST1_TAC o SYM) THEN REWRITE_TAC[REAL_MUL_LZERO] THEN + MATCH_ACCEPT_TAC REAL_LE_REFL]);; + + +(* from ? *) + +let ABS_POS = prove( + `!x. &0 <= abs(x)`, + GEN_TAC THEN ASM_CASES_TAC `&0 <= x` THENL + [ALL_TAC; + MP_TAC(SPEC `x:real` REAL_LE_NEGTOTAL) THEN ASM_REWRITE_TAC[] THEN + DISCH_TAC] THEN + ASM_REWRITE_TAC[real_abs]);; + + +let REAL_PROP_LE_LABS = prove( + `!x y z. (y <=. z) ==> ((abs x)* y <=. (abs x) *z)`,(SIMP_TAC[REAL_LE_LMUL_IMP;ABS_POS]));; + +let REAL_LE_RMUL_IMP = prove( + `!x y z. &0 <= x /\ y <= z ==> (y * x) <= (z * x)`, + ONCE_REWRITE_TAC[REAL_MUL_SYM] THEN MATCH_ACCEPT_TAC REAL_LE_LMUL_IMP);; + + +(* ------------------------------------------------------------------ *) +(* Propagation of Non-negative *) +(* ------------------------------------------------------------------ *) + +let REAL_PROP_NN_POS = prove(`! x y. x<. y ==> x <= y`,MESON_TAC[REAL_LT_LE]);; +let REAL_PROP_NN_ADD2 = REAL_LE_ADD (* |- !x y. &0 <= x /\ &0 <= y ==> &0 <= x + y *);; +let REAL_PROP_NN_DOUBLE = REAL_LE_DOUBLE (* |- !x. &0 <= x + x <=> &0 <= x *);; +let REAL_PROP_NN_RCANCEL= prove(`!x y. &.0 <. x /\ (&.0) <=. y*.x ==> ((&.0) <=. y)`, + MESON_TAC[REAL_PROP_LE_RCANCEL;REAL_MUL_LZERO]);; +let REAL_PROP_NN_LCANCEL= prove(`!x y. &.0 <. x /\ (&.0) <=. x*.y ==> ((&.0) <=. y)`, + MESON_TAC[REAL_PROP_LE_LCANCEL;REAL_MUL_RZERO]);; +let REAL_PROP_NN_MUL2 = REAL_LE_MUL (* |- !x y. &0 <= x /\ &0 <= y ==> &0 <= x * y *);; +let REAL_PROP_NN_POW = REAL_POW_LE (* |- !x n. &0 <= x ==> &0 <= x pow n *);; +let REAL_PROP_NN_SQUARE = REAL_LE_POW_2;; (* |- !x. &0 <= x pow 2 *) +let REAL_PROP_NN_SQRT = SQRT_POS_LE;; (* |- !x. &0 <= x ==> &0 <= sqrt x *) +let REAL_PROP_NN_INV = REAL_LE_INV_EQ (* |- !x. &0 <= inv x = &0 <= x *);; +let REAL_PROP_NN_SIN = SIN_POS_PI_LE;; (* |- !x. &0 <= x /\ x <= pi ==> &0 <= sin x *) +let REAL_PROP_NN_ATN = ATN_POS_LE;; (* |- &0 <= atn x = &0 <= x *) + + +(* ------------------------------------------------------------------ *) +(* Constructor of POS *) +(* ------------------------------------------------------------------ *) + +let REAL_MK_POS_ABS = REAL_ABS_NZ (* |- !x. ~(x = &0) = &0 < abs x *);; +let REAL_MK_POS_EXP = REAL_EXP_POS_LT;; (* |- !x. &0 < exp x *) + +(* let REAL_MK_POS_LN = LN_POS_LT;; (* |- !x. &1 < x ==> &0 < ln x *) *) + +let REAL_MK_POS_PI = PI_POS;; (* |- &0 < pi *) + + +(* ------------------------------------------------------------------ *) +(* Propagation of POS *) +(* ------------------------------------------------------------------ *) + +let REAL_PROP_POS_ADD2 = REAL_LT_ADD (* |- !x y. &0 < x /\ &0 < y ==> &0 < x + y *);; +let REAL_PROP_POS_LADD = REAL_LET_ADD (* |- !x y. &0 <= x /\ &0 < y ==> &0 < x + y *);; +let REAL_PROP_POS_RADD = REAL_LTE_ADD (* |- !x y. &0 < x /\ &0 <= y ==> &0 < x + y *);; +let REAL_PROP_POS_LMUL = REAL_LT_MUL_EQ;; (* REAL_LT_LMUL_0;; *) (* |- !x y. &0 < x ==> (&0 < x * y = &0 < y) *) +let REAL_PROP_POS_RMUL = REAL_LT_MUL_EQ;; (* REAL_LT_RMUL_0;; *) (* |- !x y. &0 < y ==> (&0 < x * y = &0 < x) *) +let REAL_PROP_POS_MUL2 = REAL_LT_MUL (* |- !x y. &0 < x /\ &0 < y ==> &0 < x * y *);; +let REAL_PROP_POS_SQRT = SQRT_POS_LT;; (* |- !x. &0 < x ==> &0 < sqrt x *) +let REAL_PROP_POS_POW = REAL_POW_LT (* |- !x n. &0 < x ==> &0 < x pow n *);; +let REAL_PROP_POS_INV = REAL_LT_INV (* |- !x. &0 < x ==> &0 < inv x *);; +let REAL_PROP_POS_SIN = SIN_POS_PI;; (* |- !x. &0 < x /\ x < pi ==> &0 < sin x *) +let REAL_PROP_POS_TAN = TAN_POS_PI2;; (* |- !x. &0 < x /\ x < pi / &2 ==> &0 < tan x *) +let REAL_PROP_POS_ATN = ATN_POS_LT;; (* |- &0 < atn x = &0 < x *) + +(* ------------------------------------------------------------------ *) +(* Construction of NZ *) +(* ------------------------------------------------------------------ *) + +(* renamed from REAL_MK_NZ_OF_POS *) +let REAL_MK_NZ_POS = REAL_POS_NZ (* |- !x. &0 < x ==> ~(x = &0) *);; +let REAL_MK_NZ_EXP = REAL_EXP_NZ;; (* |- !x. ~(exp x = &0) *) + +(* ------------------------------------------------------------------ *) +(* Propagation of NZ *) +(* ------------------------------------------------------------------ *) + +(* renamed from REAL_ABS_NZ, moved from float.ml *) +let REAL_PROP_NZ_ABS = prove(`!x. (~(x = (&.0))) ==> (~(abs(x) = (&.0)))`, + REWRITE_TAC[REAL_ABS_ZERO]);; +let REAL_PROP_NZ_POW = REAL_POW_NZ (* |- !x n. ~(x = &0) ==> ~(x pow n = &0) *);; + +(* +let REAL_PROP_NZ_INV = REAL_INV_NZ;; (* |- !x. ~(x = &0) ==> ~(inv x = &0) *) +*) + +(* ------------------------------------------------------------------ *) +(* Propagation of ZERO *) +(* ------------------------------------------------------------------ *) + +let REAL_PROP_ZERO_ABS = REAL_ABS_ZERO (* |- !x. (abs x = &0) = x = &0); *);; +(* let REAL_PROP_ZERO_NEG = REAL_NEG_EQ_0 ;; (* |- !x. (--x = &0) = x = &0 *) *) +let REAL_PROP_ZERO_INV = REAL_INV_EQ_0 (* |- !x. (inv x = &0) = x = &0 *);; +(* let REAL_PROP_ZERO_NEG = REAL_NEG_EQ0;; (* |- !x. (--x = &0) = x = &0 *) *) +(* let REAL_PROP_ZERO_SUMSQ = REAL_SUMSQ;; (* |- !x y. (x * x + y * y = &0) = (x = &0) /\ (y = &0) *) *) +let REAL_PROP_ZERO_POW = REAL_POW_EQ_0;; (* |- !x n. (x pow n = &0) = (x = &0) /\ ~(n = 0) *) +let REAL_PROP_ZERO_SQRT = SQRT_EQ_0;; (* |- !x. &0 <= x ==> (x / sqrt x = sqrt x) *) + +(* ------------------------------------------------------------------ *) +(* Special values of functions *) +(* ------------------------------------------------------------------ *) + +let REAL_SV_LADD_0 = REAL_ADD_LID (* |- !x. &0 + x = x); *);; +let REAL_SV_INV_0 = REAL_INV_0 (* |- inv (&0) = &0 *);; +let REAL_SV_RMUL_0 = REAL_MUL_RZERO (* |- !x. x * &0 = &0 *);; +let REAL_SV_LMUL_0 = REAL_MUL_LZERO (* |- !x. &0 * x = &0 *);; +let REAL_SV_NEG_0 = REAL_NEG_0 (* |- -- &0 = &0 *);; +let REAL_SV_ABS_0 = REAL_ABS_0 (* |- abs (&0) = &0 *);; +let REAL_SV_EXP_0 = REAL_EXP_0;; (* |- exp (&0) = &1 *) +(* let REAL_SV_LN_1 = LN_1;; (* |- ln (&1) = &0 *) *) +let REAL_SV_SQRT_0 = SQRT_0;; (* |- sqrt (&0) = &0 *) +let REAL_SV_TAN_0 = TAN_0;; (* |- tan (&0) = &0 *) +let REAL_SV_TAN_PI = TAN_PI;; (* |- tan pi = &0 *) + +(* ------------------------------------------------------------------ *) +(* A tactic that multiplies a real on the left *) +(* ------------------------------------------------------------------ *) + +(** +#g `a:real = b:real`;; +#e (REAL_LMUL_TAC `c:real`);; +it : goalstack = 2 subgoals (2 total) +`~(c = &0)` + +`c * a = c * b` + + 0 [`~(c = &0)`] +# +**) +(* ------------------------------------------------------------------ *) + + + +let REAL_LMUL_TAC t = + let REAL_MUL_LTIMES = + prove ((`!x a b. + (((~(x=(&0)) ==> (x*a = x*b)) /\ ~(x=(&0))) ==> (a = b))`), + MESON_TAC[REAL_EQ_MUL_LCANCEL]) in + (MATCH_MP_TAC (SPEC t REAL_MUL_LTIMES)) + THEN CONJ_TAC + THENL [DISCH_TAC; ALL_TAC];; + +(* ------------------------------------------------------------------ *) +(* Right multiply by a real *) +(* ------------------------------------------------------------------ *) + +let REAL_RMUL_TAC t = + let REAL_MUL_RTIMES = + prove (`!x a b. + ((~(x=(&0))==>(a*x = b*x)) /\ ~(x=(&0))) ==> (a = b)`, + MESON_TAC[REAL_EQ_MUL_RCANCEL]) in + (MATCH_MP_TAC (SPEC t REAL_MUL_RTIMES)) + THEN CONJ_TAC + THENL [DISCH_TAC; ALL_TAC];; + + +pop_priority();; + +end;; diff --git a/formal_ineqs/jordan/refinement.hl b/formal_ineqs/jordan/refinement.hl new file mode 100644 index 0000000..f0304d1 --- /dev/null +++ b/formal_ineqs/jordan/refinement.hl @@ -0,0 +1,79 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Jordan *) +(* Copied from HOL Light jordan directory *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-08 *) +(* ========================================================================== *) + + + +module Refinement = struct + +(* ------------------------------------------------------------------ *) +(* This bundles an interactive session into a proof. *) +(* Later split off into general/prove_by_refinement *) +(* ------------------------------------------------------------------ *) + +(* +let labels_flag = ref false;; (* if true add labels to assumptions *) +*) + +let LABEL_ALL_TAC:tactic = + let mk_label avoid = + let rec mk_one_label i avoid = + let label = "Z-"^(string_of_int i) in + if not(mem label avoid) then label else mk_one_label (i+1) avoid in + mk_one_label 0 avoid in + let update_label i asl = + let rec f_at_i f j = + function [] -> [] + | a::b -> if (j=0) then (f a)::b else a::(f_at_i f (j-1) b) in + let avoid = map fst asl in + let current = el i avoid in + let new_label = mk_label avoid in + if (String.length current > 0) then asl else + f_at_i (fun (_,y) -> (new_label,y) ) i asl in + fun (asl,w) -> + let aslp = ref asl in + (for i=0 to ((length asl)-1) do (aslp := update_label i !aslp) done; + (ALL_TAC (!aslp,w)));; + +(* global_var *) +let enhance flag every tac = + if flag then (tac THEN every) THEN LABEL_ALL_TAC + else tac;; + +let (e_enhance :bool ->tactic->tactic ->goalstack) = + fun flag every tac -> refine(by(VALID (enhance flag every tac)));; + +(* +let e_bak = e;; +let every = ALL_TAC;; +let e = e_enhance true every;; +*) + +let has_stv t = + let typ = (type_vars_in_term t) in + can (find (fun ty -> (is_vartype ty) && ((dest_vartype ty).[0] = '?'))) typ;; + +let enhanced_prove_by_refinement flag every (t,(tacl:tactic list)) = + if (length (frees t) > 0) + then failwith "prove_by_refinement: free vars" else + if (has_stv t) + then failwith "prove_by_refinement: has stv" else + let gstate = mk_goalstate ([],t) in + let _,sgs,just = rev_itlist + (fun tac gs -> by (enhance flag every tac) gs) + tacl gstate in + let th = if sgs = [] then just null_inst [] + else failwith "BY_REFINEMENT_PROOF: Unsolved goals" in + let t' = concl th in + if t' = t then th else + try EQ_MP (ALPHA t' t) th + with Failure _ -> failwith "prove_by_refinement: generated wrong theorem";; + +let prove_by_refinement = enhanced_prove_by_refinement false ALL_TAC;; + +end;; diff --git a/formal_ineqs/jordan/taylor_atn.hl b/formal_ineqs/jordan/taylor_atn.hl new file mode 100644 index 0000000..7673c28 --- /dev/null +++ b/formal_ineqs/jordan/taylor_atn.hl @@ -0,0 +1,917 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Lemma: Taylor Series for atn function *) +(* Chapter: Nonlinear Inequalities *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-14 *) +(* ========================================================================== *) + + +(* +This file gives the half-angle identity for atan + atn (2 x) = 2 atn (...) + +It gives a general formula for the nth derivative of catn + +It gives the complex Taylor polynomial of catn at Cx(&0). + +It gives the real Taylor polynomial of atn at (&0) +*) + +module Taylor_atn = + (* sig + val halfatn:thm + val halfatn_bounds_abs:thm + val halfatn_bounds:thm + val halfatn_half :thm + val abs_pass_through:thm + val atn_abs:thm + val atn_half_range:thm + end = *) +struct + + +let FORCE_EQ = REPEAT (CHANGED_TAC (AP_TERM_TAC ORELSE AP_THM_TAC ORELSE BINOP_TAC)) ;; + +let FORCE_MATCH = (MATCH_MP_TAC (TAUT `(a = b) ==> (a ==> b)`)) THEN FORCE_EQ ;; + +let FORCE_MATCH_MP_TAC th = + MP_TAC th THEN ANTS_TAC THENL[ALL_TAC;FORCE_MATCH + ];; + +(* first we develop the half-angle identity for the atn function *) + +let halfatn = new_definition `halfatn x = x / (sqrt(&1 + x pow 2) + &1)`;; + +let pos1 = prove( + `!x. &0 < &1 + x pow 2 `, + MESON_TAC[REAL_LE_POW_2;REAL_ARITH `&0 <= t ==> &0 < &1 + t`]; +);; + +let ssqrt = new_definition `!x. ssqrt x = (if x < &0 then &0 else sqrt x)`;; + +let halfsqrt_ssqrt = prove_by_refinement( + `!x. sqrt(&1+ x pow 2) = ssqrt(&1 + x pow 2)`, + (* {{{ proof *) + [ + REWRITE_TAC[ssqrt;]; + MESON_TAC[pos1;REAL_ARITH `&0 < x ==> ~(x < &0)`]; + ]);; + (* }}} *) + +let pos2 = prove ( + `!x. &0 < sqrt(&1 + x pow 2) + &1`, +(* {{{ proof *) + MESON_TAC[pos1;REAL_ARITH `(&0 <= t ==> &0 < t + &1) /\ (&0 < t ==> &0 <= t)`;SQRT_POS_LE;] +(* }}} *));; + +let halfatn_bounds_abs = prove_by_refinement( + `!x. abs(halfatn x) < &1 `, +(* {{{ proof *) +[ +REWRITE_TAC[halfatn;REAL_ABS_DIV]; +GEN_TAC; +ASSUME_TAC (ISPEC `x:real` pos2); +ASM_SIMP_TAC[REAL_ARITH `(&0 < x ==> abs(x) = x)/\ (&1 * t = t)`;REAL_LT_LDIV_EQ]; +(* *) +REWRITE_TAC[GSYM POW_2_SQRT_ABS]; +MATCH_MP_TAC REAL_LET_TRANS; +EXISTS_TAC `sqrt(&1 + x pow 2)`; +CONJ_TAC; +MATCH_MP_TAC SQRT_MONO_LE; +REWRITE_TAC[REAL_LE_POW_2]; +ARITH_TAC; +ARITH_TAC; +] +(* }}} *));; + +let halfatn_bounds = prove( + `!x. -- &1 < halfatn x /\ halfatn x < &1 `, + REWRITE_TAC[REAL_BOUNDS_LT;halfatn_bounds_abs]);; + +let halfatn_half = prove_by_refinement( + `!x t. (abs (x) < t ==> abs(halfatn x) < t / &2) `, +(* {{{ proof *) +[ +REWRITE_TAC[halfatn;REAL_ABS_DIV]; +REPEAT STRIP_TAC; +ASSUME_TAC (ISPEC `x:real` pos2); +ASM_SIMP_TAC[REAL_ARITH `&0 < x ==> &0 < abs(x)`;REAL_LT_LDIV_EQ]; +MATCH_MP_TAC REAL_LTE_TRANS; +EXISTS_TAC `t:real`; +ASM_REWRITE_TAC[REAL_ARITH `(t / &2 * x = t * (x / &2)) /\ (t <= t * x/ &2 <=> t * &2 <= t * x)`]; +MATCH_MP_TAC REAL_LE_LMUL; +CONJ_TAC; +UNDISCH_TAC `abs x < t`; +REAL_ARITH_TAC; +ASM_SIMP_TAC [REAL_ARITH `&0 < x ==> (abs(x) = x)`]; +REWRITE_TAC[REAL_ARITH `(&2 <= x + &1) = (&1 <= x)`]; +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC `sqrt(&1)`; +CONJ_TAC; +REWRITE_TAC[SQRT_1;REAL_ARITH `&1 <= &1`]; +MATCH_MP_TAC SQRT_MONO_LE; +CONJ_TAC; +ARITH_TAC; +MATCH_MP_TAC (REAL_ARITH `&0 <= x ==> &1 <= &1 + x`); +REWRITE_TAC[REAL_LE_POW_2]; +] +(* }}} *));; + +let abs_pass_through = prove_by_refinement ( + `(!x f. (f (-- x) = -- f x) /\ (!y. &0 <= y ==> &0 <= f y) + ==> (abs (f x) = f (abs x)))`, +(* {{{ proof *) + [ + REPEAT STRIP_TAC; + DISJ_CASES_TAC (REAL_ARITH `&0 <= x \/ &0 <= --x`); + POP_ASSUM MP_TAC; + POP_ASSUM MP_TAC; + MESON_TAC[REAL_ARITH `&0 <= x ==> abs(x ) = x`]; + REPEAT (POP_ASSUM MP_TAC); + MESON_TAC[REAL_ARITH `&0 <= --x ==> abs(x) = -- x`; REAL_ARITH `abs( -- x ) = abs(x)`]; + ] +(* }}} *));; + +let atn_abs = prove_by_refinement( + `!x. abs(atn x) = atn (abs x) `, +(* {{{ proof *) +[ +GEN_TAC; +MATCH_MP_TAC abs_pass_through; +REWRITE_TAC[ATN_NEG;ATN_POS_LE]; +] +(* }}} *));; + +let atn_half_range = prove_by_refinement ( + `!x. abs(atn (halfatn x)) < pi / &4 `, +(* {{{ proof *) +[ +REWRITE_TAC[GSYM ATN_1;atn_abs;ATN_MONO_LT_EQ]; +GEN_TAC; +REWRITE_TAC [halfatn_bounds;GSYM REAL_BOUNDS_LT]; +] +(* }}} *));; + +let tan_one_one = prove_by_refinement( + `!x y. (abs(x) < pi/ &2 /\ (abs y < pi / &2 ) /\ (tan x = tan y) ==> (x = y))`, +(* {{{ proof *) +[ +REPEAT STRIP_TAC; +DISJ_CASES_TAC (REAL_ARITH `x < y \/ y < x \/ x = (y:real)`); +REPEAT (POP_ASSUM MP_TAC); +REWRITE_TAC[GSYM REAL_BOUNDS_LT]; +MESON_TAC[TAN_MONO_LT_EQ;REAL_ARITH `(x:real ~(x = y)`]; +POP_ASSUM DISJ_CASES_TAC; +REPEAT (POP_ASSUM MP_TAC); +REWRITE_TAC[GSYM REAL_BOUNDS_LT]; +MESON_TAC[TAN_MONO_LT_EQ;REAL_ARITH `(x:real ~(x = y)`]; +ASM_REWRITE_TAC[]; +] +(* }}} *));; + +let abs_lemma = prove( + `!f x. (?n. x = f n) \/ (?n. x = -- f n) <=> (?n. abs(x) = abs(f n))`, + ASM_MESON_TAC[REAL_ARITH `!x y. abs(x) = abs(y) <=> (x = y)\/ (x = -- y)`]);; + +let cos_nz = prove_by_refinement ( + `!x. (abs(x) < pi / &2) ==> ~(cos x = &0) `, +(* {{{ proof *) + +[ +GEN_TAC; +REWRITE_TAC[COS_ZERO_PI;abs_lemma]; +ONCE_REWRITE_TAC[TAUT `(a ==> ~b) <=> (b ==> ~a)`]; +ONCE_REWRITE_TAC[REAL_ARITH `~(x < y) <=> (y <= x)`]; +REPEAT STRIP_TAC; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC`(&n + &1/ &2) * pi `; +REWRITE_TAC[REAL_ARITH `x <= abs(x)`]; +MP_TAC PI_POS; +MP_TAC (REAL_ARITH `&1/ &2 <= (&n + &1/ &2)`); +REWRITE_TAC[REAL_ARITH `pi / &2 = (&1 / &2) * pi`]; +ASM_SIMP_TAC[REAL_ARITH `&0 < x ==> &0 <= x`;Real_ext.REAL_LE_RMUL_IMP]; +] + +(* }}} *));; + +let cos_2nz = prove_by_refinement( + `!x. (abs(x) < pi / &4) ==> ~(cos (&2 * x) = &0) `, +(* {{{ proof *) + [ + STRIP_TAC THEN STRIP_TAC; + MATCH_MP_TAC cos_nz; + REWRITE_TAC[REAL_ABS_MUL;REAL_ARITH `abs(&2)= &2 /\ (&2 * x < pi/ &2 <=> x < pi/ &4)`]; + ASM_REWRITE_TAC[]; + ] +(* }}} *));; + +let halfatn_double =prove_by_refinement( + `!x. ~(cos (atn (halfatn x)) = &0) /\ ~(cos(&2 * atn (halfatn x)) = &0) `, +(* {{{ proof *) +[ +REPLICATE_TAC 2 (STRIP_TAC); +MATCH_MP_TAC cos_nz; +MATCH_MP_TAC REAL_LTE_TRANS; +EXISTS_TAC `pi/ &4`; +REWRITE_TAC[atn_half_range]; +MP_TAC PI_POS; +REAL_ARITH_TAC; +MATCH_MP_TAC cos_2nz; +REWRITE_TAC[atn_half_range]; +] +(* }}} *));; + +let REAL_DIV_MUL2z = REAL_FIELD + `!x y z. (&0 < x) ==> (y /z = (x pow 2 * y) / (x pow 2* z)) `;; + +let atn_half = prove_by_refinement ( + `!x. atn x = &2 * atn (halfatn x) `, +(* {{{ proof *) +[ +GEN_TAC; +MATCH_MP_TAC tan_one_one; +MATCH_MP_TAC (TAUT `a /\ b /\ (a /\ b ==> c) ==> a /\ b /\ c`); +REPEAT CONJ_TAC; +REWRITE_TAC[GSYM REAL_BOUNDS_LT;ATN_BOUNDS]; +(* *) +REWRITE_TAC[REAL_ABS_MUL;REAL_ARITH `abs (&2) = &2`;REAL_ARITH `&2 * x < y / &2 <=> x < y / &4`;atn_half_range]; +(* *) +REPEAT STRIP_TAC; +ASSUME_TAC (ISPEC `x:real` halfatn_double); +ASM_SIMP_TAC[TAN_DOUBLE;ATN_TAN]; +REWRITE_TAC[halfatn]; +ASSUME_TAC (ISPEC `x:real` pos2); +ABBREV_TAC `t = sqrt(&1 + x pow 2) + &1`; +MP_TAC (ISPECL [`t:real`;`&2 * x / t`;`&1 - (x / t) pow 2`] REAL_DIV_MUL2z); +ASM_REWRITE_TAC[]; +DISCH_THEN (fun t-> REWRITE_TAC[t]); +ASM_SIMP_TAC[REAL_FIELD `&0 < t ==> t pow 2 * &2 * x / t = t * &2 * x`]; +ASM_SIMP_TAC[REAL_FIELD `&0 < t ==> t pow 2 * (&1 - (x / t) pow 2) = t pow 2 - x pow 2`]; +EXPAND_TAC "t"; +REWRITE_TAC[REAL_FIELD `(a + &1) pow 2 = a pow 2 + &2 * a + &1`]; +ASM_SIMP_TAC[pos1;REAL_ARITH `!x. &0 < x ==> &0 <= x`;SQRT_POW_2]; +ASM_REWRITE_TAC[REAL_ARITH `((&1 + v) + &2 * u + &1) - v = (u + &1) * &2`]; +UNDISCH_TAC `&0 < t`; +CONV_TAC REAL_FIELD; +] +(* }}} *));; + +(* complex taylor for atn *) + +prioritize_complex();; + +let id1 = COMPLEX_RING `inv (Cx (&1) + z pow 2) = (inv (Cx (&2))) * ( ( inv (Cx (&1) + z pow 2) * (Cx (&1) - ii *z)) + (inv (Cx (&1) + z pow 2)) * ( (Cx (&1) + ii * z)))`;; + +let id2 = SIMPLE_COMPLEX_ARITH ` (Cx (&1) + ii * z) * (Cx (&1) - ii * z) = (Cx (&1) - ii * ii * z * z)`;; + +let id3 = prove_by_refinement (`!u a. a - ii * ii * u = a + u`, +(* {{{ proof *) +[ +REWRITE_TAC[ii]; +SIMPLE_COMPLEX_ARITH_TAC; +] +(* }}} *));; + +let id4 = prove_by_refinement (`!z. (Cx (&1) + z pow 2) = (Cx (&1) + ii*z) * (Cx (&1) - ii*z)`, +(* {{{ proof *) +[ +REWRITE_TAC[id2;id3;COMPLEX_POW_2]; +] +(* }}} *));; + + +let tactic_list = [SUBGOAL_THEN `(Re (z) = &0) /\ (abs(Im (z)) = &1)` ASSUME_TAC ; +POP_ASSUM MP_TAC ; +ASM_REWRITE_TAC[] ; +REWRITE_TAC[REAL_ARITH `abs(x) = &1 <=> (x = &1 \/ x = -- &1)`;ii] ; +SIMPLE_COMPLEX_ARITH_TAC ; +ASM_MESON_TAC[]];; + +let idz = prove_by_refinement( + `!z a. (Re z = &0 ==> abs(Im z) < &1) /\ ((a = ii \/ a = --ii)) ==> + ~(Cx (&1) + a * z = Cx (&0))`, + (* {{{ proof *) + [ +ASSUME_TAC (REAL_ARITH `~(&1 < &1)`); +REPEAT STRIP_TAC; +] @ (tactic_list @ tactic_list));; + (* }}} *) + + +let id4a = prove_by_refinement (`!z. (Re z = &0 ==> abs(Im z) < &1) + ==>( inv(Cx (&1) + ii* z) * (Cx (&1) + ii*z) = Cx (&1))`, +(* {{{ proof *) +[ +REPEAT STRIP_TAC; +MATCH_MP_TAC COMPLEX_MUL_LINV; +MATCH_MP_TAC idz; +ASM_REWRITE_TAC[]; +] +(* }}} *));; + +let id4b = prove_by_refinement (`!z. (Re z = &0 ==> abs(Im z) < &1) + ==>( inv(Cx (&1) - ii* z) * (Cx (&1) - ii*z) = Cx (&1))`, +(* {{{ proof *) +[ +REPEAT STRIP_TAC; +MATCH_MP_TAC COMPLEX_MUL_LINV; +REWRITE_TAC[SIMPLE_COMPLEX_ARITH `a - ii * z = a + (-- ii) * z`]; +MATCH_MP_TAC idz; +ASM_REWRITE_TAC[]; +] +(* }}} *));; + +let id5 = prove_by_refinement (`!z. (Re z = &0 ==> abs(Im z) < &1) ==> ( inv (Cx (&1) + z pow 2) = (inv (Cx (&2))) * ( inv (Cx (&1) + ii * z) + inv (Cx (&1) - ii * z)))`, +(* {{{ proof *) +[ +REPEAT STRIP_TAC; +ONCE_REWRITE_TAC[id1]; +REWRITE_TAC[id4;COMPLEX_INV_MUL]; +REWRITE_TAC[SIMPLE_COMPLEX_ARITH `((a*b)*c + (e*f)*g = (a:complex)*(b*c) + f * (e *g))`]; +ASM_SIMP_TAC[id4a;id4b]; +REWRITE_TAC[COMPLEX_MUL_RID]; +] +(* }}} *));; + +let taylor_coeff_catn = new_definition `taylor_coeff_catn n (z:complex) = + if (n=0) then catn z else Cx (& (FACT (n-1))) * + (inv(Cx (&2))) * ( ( (-- ii) pow (n - 1) * ((inv (Cx (&1) + ii * z)) pow n)) + + ( ii pow (n - 1) * ((inv (Cx (&1) - ii * z)) pow n)))`;; + +let taylor_coeff_catn0 = prove_by_refinement ( + `taylor_coeff_catn 0 = catn `, +(* {{{ proof *) + [ + ONCE_REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[taylor_coeff_catn]; + ] +(* }}} *));; + +let taylor_coeff_catn1 = prove_by_refinement ( + `!z. (Re z = &0 ==> abs(Im z) < &1) ==> + (catn has_complex_derivative (taylor_coeff_catn 1 z)) (at z)`, +(* {{{ proof *) + [ + REPEAT STRIP_TAC; + SUBGOAL_THEN `taylor_coeff_catn 1 z = inv (Cx (&1) + z pow 2)` ASSUME_TAC; + REWRITE_TAC[taylor_coeff_catn;ARITH_RULE `~(1=0) /\ (1-1 = 0) /\ (FACT 0 =1)`;COMPLEX_POW_1;complex_pow;COMPLEX_MUL_LID]; + ASM_SIMP_TAC[id5]; + (* *) + ASM_SIMP_TAC[HAS_COMPLEX_DERIVATIVE_CATN;]; + ] +(* }}} *));; + +let taylor_coeff_catn_pos = prove_by_refinement( + `!n. (n > 0) ==> (taylor_coeff_catn n = (\z. + Cx (& (FACT (n-1))) * + (inv(Cx (&2))) * ( ( (-- ii) pow (n - 1) * ((inv (Cx (&1) + ii * z)) pow n)) + + ( ii pow (n - 1) * ((inv (Cx (&1) - ii * z)) pow n))) ))`, +(* {{{ proof *) + [ + REPEAT STRIP_TAC; + ONCE_REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[taylor_coeff_catn]; + ASM_SIMP_TAC[ARITH_RULE `n > 0 ==> ~(n=0)`]; + ] +(* }}} *));; + +let taylor_series_inv_pow = prove_by_refinement( + `!n a z. ~(Cx (&1) + a * z = Cx(&0)) ==> + (((\z. (inv (Cx (&1) + a * z)) pow n) has_complex_derivative + (-- Cx(&n) * a * (inv (Cx(&1) + a * z)) pow (n+1))) (at z))`, + (* {{{ proof *) + + [ + REPEAT STRIP_TAC; + DISJ_CASES_TAC (ARITH_RULE `(n=0) \/ (n > 0)`); + ASM_REWRITE_TAC[ARITH_RULE `0+1=1`;complex_pow;COMPLEX_POW_1;SIMPLE_COMPLEX_ARITH `-- Cx (&0) * u = Cx(&0)`;HAS_COMPLEX_DERIVATIVE_CONST]; + ASM_SIMP_TAC[ARITH_RULE `(n>0) ==> (n+1 = 2 + (n-1))`;]; + REWRITE_TAC[COMPLEX_POW_ADD]; + ONCE_REWRITE_TAC[SIMPLE_COMPLEX_ARITH `-- r * s * t * u = r * u * ( -- s * t)`]; + MATCH_MP_TAC HAS_COMPLEX_DERIVATIVE_POW_AT; + REWRITE_TAC[COMPLEX_POW_INV;GSYM complex_div]; + MATCH_MP_TAC HAS_COMPLEX_DERIVATIVE_INV_AT; + ASM_REWRITE_TAC[]; + CONV_TAC (PATH_CONV "lr" (ONCE_REWRITE_CONV[SIMPLE_COMPLEX_ARITH `a = Cx(&0) + a * Cx (&1)` ])); + MATCH_MP_TAC HAS_COMPLEX_DERIVATIVE_ADD; + REWRITE_TAC[HAS_COMPLEX_DERIVATIVE_CONST]; + MATCH_MP_TAC HAS_COMPLEX_DERIVATIVE_LMUL_AT; + REWRITE_TAC[HAS_COMPLEX_DERIVATIVE_ID]; + ]);; + + (* }}} *) + +let factorial_lemma = prove_by_refinement( + `!n. (n>0) ==> (FACT n = n * FACT (n-1))`, + (* {{{ proof *) + [ +REPEAT STRIP_TAC; +DISJ_CASES_TAC (ISPEC `n:num` num_CASES); +ASM_MESON_TAC[ARITH_RULE `(n>0) ==> ~(n=0)`]; +ASM_MESON_TAC[FACT;ARITH_RULE `SUC n - 1 = n`]; + ]);; + (* }}} *) + +let taylor_coeff_catn_deriv = prove_by_refinement( + `!z n. (Re z = &0 ==> abs(Im z) < &1) ==> + ((taylor_coeff_catn n) has_complex_derivative + (taylor_coeff_catn (n+1) z)) (at z)`, +(* {{{ proof *) +[ +REPEAT STRIP_TAC; +DISJ_CASES_TAC (ARITH_RULE `(n = 0) \/ (n >0)`); +ASM_SIMP_TAC[ taylor_coeff_catn0;taylor_coeff_catn1;ARITH_RULE `0+1=1`]; +REWRITE_TAC[taylor_coeff_catn;ARITH_RULE `(n+1)-1 = n`]; +ASM_SIMP_TAC[ARITH_RULE `(n>0) ==> ~(n+1=0)`]; +ASM_SIMP_TAC[taylor_coeff_catn_pos;factorial_lemma]; +(* fact finding *) +SUBGOAL_THEN `!u. Cx (&(n * FACT (n-1))) * u = Cx (&n) * (Cx (&(FACT (n-1))) * u)` MP_TAC; +REWRITE_TAC[CX_MUL;GSYM REAL_OF_NUM_MUL]; +SIMPLE_COMPLEX_ARITH_TAC; +DISCH_THEN (fun t-> REWRITE_TAC[t]); +ONCE_REWRITE_TAC[SIMPLE_COMPLEX_ARITH `(a:complex) * b * c * d = b * c * a * d`]; +ONCE_REWRITE_TAC[SIMPLE_COMPLEX_ARITH `(a:complex) * b * u = (a*b)*u`]; +MATCH_MP_TAC HAS_COMPLEX_DERIVATIVE_LMUL_AT; +REWRITE_TAC[COMPLEX_ADD_LDISTRIB]; +MATCH_MP_TAC HAS_COMPLEX_DERIVATIVE_ADD; +REWRITE_TAC[SIMPLE_COMPLEX_ARITH `a - ii * z = a + (-- ii) * z`]; +SUBGOAL_THEN `!a b r. a * b pow n * r = b pow (n-1) * ( -- a * ( -- b) * r)` MP_TAC; +REPEAT STRIP_TAC; +MP_TAC(ARITH_RULE `n>0 ==> n = (n-1) + 1`); +ASM_REWRITE_TAC[]; +DISCH_THEN (fun t -> CONV_TAC (PATH_CONV "lr" (ONCE_REWRITE_CONV[t]))); +REWRITE_TAC[COMPLEX_POW_ADD;COMPLEX_POW_1]; +SIMPLE_COMPLEX_ARITH_TAC; +DISCH_THEN (fun t->REWRITE_TAC[t]); +CONJ_TAC THEN (MATCH_MP_TAC HAS_COMPLEX_DERIVATIVE_LMUL_AT) ; +(* highly parallel branches *) +REWRITE_TAC[SIMPLE_COMPLEX_ARITH `-- --ii = ii`]; +MATCH_MP_TAC taylor_series_inv_pow; +STRIP_TAC; +ASM_MESON_TAC[idz]; +(* *) +MATCH_MP_TAC taylor_series_inv_pow; +STRIP_TAC; +ASM_MESON_TAC[idz]; +] +(* }}} *));; + +let ipows2 = prove_by_refinement( + `!n. (--ii ) pow (n + 2) = -- ((-- ii) pow n)`, + (* {{{ proof *) + [ + GEN_TAC; + REWRITE_TAC[COMPLEX_POW_ADD;COMPLEX_POW_2;]; + MATCH_MP_TAC (SIMPLE_COMPLEX_ARITH `(a * a = -- Cx(&1) ) ==> r * a * a = -- r`); + REWRITE_TAC[ii]; + SIMPLE_COMPLEX_ARITH_TAC; + ]);; + (* }}} *) + +let ipowsc2 = prove_by_refinement( + `!n. (ii ) pow (n + 2) = -- ((ii) pow n)`, + (* {{{ proof *) + [ + GEN_TAC; + REWRITE_TAC[COMPLEX_POW_ADD;COMPLEX_POW_2;]; + MATCH_MP_TAC (SIMPLE_COMPLEX_ARITH `(a * a = -- Cx(&1) ) ==> r * a * a = -- r`); + REWRITE_TAC[ii]; + SIMPLE_COMPLEX_ARITH_TAC; + ]);; + (* }}} *) + + +let taylor_coeff0 = prove_by_refinement( + `!n. (taylor_coeff_catn n (Cx (&0)) = if (EVEN n) then (Cx (&0)) else + Cx (&(FACT (n-1)) * (-- &1) pow ((n - 1) DIV 2)))`, + (* {{{ proof *) + [ + GEN_TAC; + DISJ_CASES_TAC (ISPEC `n:num` EVEN_OR_ODD); + DISJ_CASES_TAC (ARITH_RULE `(n=0) \/ (n >0)`); + ASM_REWRITE_TAC[taylor_coeff_catn;GSYM CX_ATN;ATN_0]; + (* *) + ASM_SIMP_TAC[taylor_coeff_catn_pos]; + REWRITE_TAC[SIMPLE_COMPLEX_ARITH `a + b * Cx(&0) = a /\ a - b * Cx(&0) =a`]; + REWRITE_TAC[SIMPLE_COMPLEX_ARITH `inv(Cx (&1)) = Cx (&1) /\ a * Cx(&1) = a`;COMPLEX_POW_ONE]; + MATCH_MP_TAC (SIMPLE_COMPLEX_ARITH `c = Cx(&0) ==> a*b*c = Cx(&0)`); + SUBGOAL_THEN ( `EVEN n ==> (?k. (n - 1) = 2 * k + 1)`) MP_TAC; + REWRITE_TAC[EVEN_EXISTS]; + REPEAT STRIP_TAC; + EXISTS_TAC `m-1`; + REPEAT (POP_ASSUM MP_TAC); + ARITH_TAC; + ASM_REWRITE_TAC[]; + REPEAT STRIP_TAC; + ASM_REWRITE_TAC[]; + SPEC_TAC (`k:num`,`k:num`); + INDUCT_TAC; + REWRITE_TAC[ARITH_RULE `2* 0 + 1 = 1`;COMPLEX_POW_1]; + SIMPLE_COMPLEX_ARITH_TAC; + ASM_REWRITE_TAC[ipows2;ipowsc2;ARITH_RULE `2* SUC k' + 1 = (2 * k' + 1) + 2`;SIMPLE_COMPLEX_ARITH `--a + --b = --(a+b) /\ -- Cx(&0) = Cx(&0) `]; + (* ODD *) + ASM_REWRITE_TAC[GSYM NOT_ODD]; + SUBGOAL_THEN (`ODD n ==> (?k. n = 2 * k + 1)`) MP_TAC; + REWRITE_TAC[ODD_EXISTS]; + REPEAT STRIP_TAC; + EXISTS_TAC `m:num`; + ASM_REWRITE_TAC[]; + ARITH_TAC; + ASM_REWRITE_TAC[]; + REPEAT STRIP_TAC; + SUBGOAL_THEN `n > 0` ASSUME_TAC; + POP_ASSUM MP_TAC; + ARITH_TAC; + ASM_SIMP_TAC[taylor_coeff_catn_pos]; + REWRITE_TAC[SIMPLE_COMPLEX_ARITH `a + b * Cx (&0) = a /\ a - b * Cx (&0) = a /\ inv (Cx (&1)) = Cx (&1) /\ a * Cx (&1) = a`;COMPLEX_POW_ONE;ARITH_RULE `(2 * k + 1 ) - 1 = 2 * k`;CX_MUL]; + MATCH_MP_TAC (SIMPLE_COMPLEX_ARITH `(b = c) ==> (a*b = a*c)`); + SPEC_TAC (`k:num`,`k:num`); + INDUCT_TAC; + REWRITE_TAC[ARITH_RULE `2 * 0 =0 /\ 0 DIV 2 = 0`;complex_pow;real_pow]; + SIMPLE_COMPLEX_ARITH_TAC; + REWRITE_TAC[ARITH_RULE `2 * SUC k' = 2 * k' + 2 /\ (2 * SUC k) DIV 2 = ((2 * k) DIV 2) + 1`;SIMPLE_COMPLEX_ARITH `a * (-- b + -- c) = -- (a * (b+c))`;ipows2;ipowsc2;COMPLEX_POW_ADD;REAL_POW_ADD;CX_MUL;REAL_POW_1]; + ASM_REWRITE_TAC[]; + SIMPLE_COMPLEX_ARITH_TAC; + ]);; + (* }}} *) + +let term_bound = prove_by_refinement( + `!a n z. Im (z) = &0 ==> + norm((Cx(a)* ii) pow n * ((inv (Cx (&1) - Cx(a)* ii * z)) pow (n+1))) + <= (abs a) pow n `, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[COMPLEX_NORM_MUL;COMPLEX_NORM_II;COMPLEX_NORM_CX;COMPLEX_NORM_POW;COMPLEX_NORM_INV;REAL_ARITH `a * &1 = a`]; + MATCH_MP_TAC (MESON[REAL_LE_LMUL;REAL_ARITH `x = x* &1`] ( `!x y. &0 <= x /\ y <= &1 ==> x *y <= x`)) ; + CONJ_TAC; + MATCH_MP_TAC REAL_POW_LE; + REWRITE_TAC[REAL_ABS_POS]; + MATCH_MP_TAC (MESON[REAL_POW_LE2;REAL_POW_ONE] `!x. &0 <= x /\ x <= &1 ==> x pow n <= &1`); + REWRITE_TAC[REAL_LE_INV_EQ;NORM_POS_LE]; + MATCH_MP_TAC (MESON[REAL_LE_INV2;REAL_INV_1;REAL_ARITH `&0 < &1`] `&1 <= x ==> inv (x) <= &1`); + SUBGOAL_THEN `Im z = &0 ==> Cx(&1) - Cx a * ii * z = complex(&1, -- a * Re(z))` MP_TAC; + REWRITE_TAC[ii]; + SIMPLE_COMPLEX_ARITH_TAC; + ASM_REWRITE_TAC[]; + DISCH_THEN (fun t -> REWRITE_TAC[t]); + (* *) + MATCH_MP_TAC (MESON[REAL_ABS_REFL;REAL_LE_SQUARE_ABS;REAL_ARITH `&0 <= &1 /\ &1 pow 2 = &1`;NORM_POS_LE] `&1 <= norm x pow 2 ==> &1 <= norm x`); + REWRITE_TAC[COMPLEX_SQNORM;RE;IM]; + MESON_TAC[REAL_LE_POW_2;REAL_ARITH `&1 pow 2 = &1 /\ (&0 <= t ==> &1 <= &1 + t)`]; + ]);; + (* }}} *) + +let taylor_error_bound = prove_by_refinement( + `!n z. Im(z) = &0 ==> norm(taylor_coeff_catn (n+1) z) <= &(FACT n)`, + (* {{{ proof *) + + [ + REPEAT STRIP_TAC; + SIMP_TAC[taylor_coeff_catn_pos;ARITH_RULE `(n+1)>0 /\ ((n+1)-1 = n)`]; + REWRITE_TAC[COMPLEX_NORM_MUL;COMPLEX_NORM_NUM;COMPLEX_NORM_INV]; + REWRITE_TAC[COMPLEX_NORM_NUM]; + MATCH_MP_TAC (MESON[REAL_LE_LMUL;REAL_ARITH `x = x* &1`] ( `!x y. &0 <= x /\ y <= &1 ==> x *y <= x`)) ; + CONJ_TAC; + REWRITE_TAC[REAL_OF_NUM_LE]; + ARITH_TAC; +MATCH_MP_TAC (REAL_ARITH `x <= &1 + &1 ==> inv (&2)* x <= &1`); +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC `norm (--ii pow n * inv (Cx (&1) + ii * z) pow (n + 1)) + norm ( ii pow n * inv (Cx (&1) - ii * z) pow (n + 1))`; +REWRITE_TAC[NORM_TRIANGLE]; +MATCH_MP_TAC REAL_LE_ADD2; +(* *) +CONJ_TAC; +(* FORCE_MATCH_MP_TAC *) +FORCE_MATCH_MP_TAC (ISPECL [`-- &1`;`n:num`;`z:complex`] term_bound); +ASM_REWRITE_TAC[]; +ONCE_REWRITE_TAC[FUN_EQ_THM]; +SIMPLE_COMPLEX_ARITH_TAC; +SIMPLE_COMPLEX_ARITH_TAC; +REWRITE_TAC[REAL_ABS_NEG;REAL_ABS_NUM;REAL_POW_ONE]; +(* second *) +ONCE_REWRITE_TAC[SIMPLE_COMPLEX_ARITH `ii * z = Cx(&1) * ii * z`]; +FORCE_MATCH_MP_TAC (ISPECL [` &1`;`n:num`;`z:complex`] term_bound); +ASM_REWRITE_TAC[]; +SIMPLE_COMPLEX_ARITH_TAC; +REWRITE_TAC[REAL_ABS_NEG;REAL_ABS_NUM;REAL_POW_ONE]; + ]);; + + (* }}} *) + +let complex_taylor_catn = prove_by_refinement( + ` !n s. (s = {z | Im (z) = &0 }) ==> (!z. + (Cx(&0)) IN s /\ z IN s + ==> norm + (catn z - + vsum (0..n) + (\i. taylor_coeff_catn i (Cx(&0)) * (z) pow i / Cx (&(FACT i)))) <= + norm (z) pow (n + 1) )`, + (* {{{ proof *) + + [ + GEN_TAC THEN GEN_TAC; + DISCH_TAC; + MP_TAC (SPECL[`taylor_coeff_catn`;`n:num`;`s:complex->bool`;`&(FACT n)`] COMPLEX_TAYLOR); + ASM_REWRITE_TAC[IN_ELIM_THM]; + ANTS_TAC; + REPEAT (CONJ_TAC THEN (REPEAT STRIP_TAC)); + REWRITE_TAC[convex;IN_ELIM_THM;IM_ADD;IM_CMUL]; + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]; + REAL_ARITH_TAC; + MATCH_MP_TAC HAS_COMPLEX_DERIVATIVE_AT_WITHIN; + MATCH_MP_TAC taylor_coeff_catn_deriv; + ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; + (* *) + MATCH_MP_TAC taylor_error_bound; + ASM_REWRITE_TAC[]; + DISCH_THEN (MP_TAC o (ISPEC `Cx (&0)`)); + REWRITE_TAC[taylor_coeff_catn0;SIMPLE_COMPLEX_ARITH `z - Cx (&0) = z /\ Im (Cx (&0)) = &0`]; + DISCH_THEN (fun t-> REPEAT STRIP_TAC THEN MP_TAC t) ; + DISCH_THEN (MP_TAC o (ISPEC `z:complex`)); + DISCH_THEN FORCE_MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_DIV_LMUL; + REWRITE_TAC[REAL_OF_NUM_EQ]; + MESON_TAC[ FACT_LT;ARITH_RULE `0 < x ==> ~(x =0)`]; + ]);; + + (* }}} *) + +let real_axis = prove_by_refinement( (* not needed *) + `!z. (Im z = &0 <=> (?x. z = Cx(x)))`, + (* {{{ proof *) + [ + GEN_TAC; + EQ_TAC; + DISCH_TAC; + EXISTS_TAC `(Re z)`; + POP_ASSUM MP_TAC; + SIMPLE_COMPLEX_ARITH_TAC; + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[IM_CX]; + ]);; + (* }}} *) + +let THREAD_IF = prove_by_refinement( + `!x y z f. (f:A->B) (if x then y else z) = if x then f y else f z`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + BOOL_CASES_TAC `x:bool` THEN REWRITE_TAC[]; + ]);; + (* }}} *) + + +let real_taylor_atn_ver1 = prove_by_refinement( + `!n x. abs(atn x - sum (0..n) (\i. if EVEN i then &0 else ( -- &1 pow ((i-1) DIV 2) * x pow i / &i ))) <= abs(x) pow (n+1)`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + MP_TAC (ISPECL [`n:num`;`{ z | Im(z) = &0 }`] complex_taylor_catn); + REWRITE_TAC[]; + DISCH_THEN (fun t -> MP_TAC (ISPEC `Cx (x)` t)); + REWRITE_TAC[VSUM_CX_NUMSEG;COMPLEX_NORM_CX;GSYM CX_SUB;GSYM CX_POW;IN_ELIM_THM;GSYM CX_MUL;GSYM CX_DIV;GSYM CX_ATN;IM_CX;taylor_coeff0;GSYM THREAD_IF]; + FORCE_MATCH; + ONCE_REWRITE_TAC[FUN_EQ_THM]; + X_GEN_TAC `i:num`; + BETA_TAC; + DISJ_CASES_TAC (TAUT `EVEN i \/ ~(EVEN i)`) THEN ASM_REWRITE_TAC[]; + REAL_ARITH_TAC; + POP_ASSUM MP_TAC; + REWRITE_TAC[NOT_EVEN;ODD_EXISTS]; + REPEAT STRIP_TAC; + ASM_REWRITE_TAC[ARITH_RULE `SUC x - 1 = x`;FACT;GSYM REAL_OF_NUM_MUL ]; + ONCE_REWRITE_TAC[REAL_FIELD `((a:real) * b) * c/(d*a) = (b * c/d) * (a/a)`]; + MATCH_MP_TAC (REAL_FIELD `x = &1 ==> (y * x = y)`); + MATCH_MP_TAC REAL_DIV_REFL; + REWRITE_TAC[REAL_OF_NUM_EQ]; + MESON_TAC[FACT_LT;ARITH_RULE `0 < x ==> ~(x = 0)`]; + ]);; + (* }}} *) + +let sum_odd = prove_by_refinement( + `!(g:num->real) n. sum { i | ODD i /\ i IN 0.. 2 * n + 2 } g = sum (0.. n) (\i. g (2 * i +1))`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + FORCE_MATCH_MP_TAC (ISPECL [`\i. (2 * i + 1)`; `g:num->real`;`(0..n)`] SUM_IMAGE); + BETA_TAC; + ARITH_TAC; + REWRITE_TAC[IMAGE;numseg;IN_ELIM_THM;ODD_EXISTS]; + ONCE_REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[IN_ELIM_THM]; + GEN_TAC; + EQ_TAC; + REPEAT STRIP_TAC; + EXISTS_TAC `x':num`; + POP_ASSUM MP_TAC; + ARITH_TAC; + REPEAT (POP_ASSUM MP_TAC); + ARITH_TAC; + REPEAT (POP_ASSUM MP_TAC); + ARITH_TAC; + REPEAT STRIP_TAC; + EXISTS_TAC `m:num`; + REPEAT (POP_ASSUM MP_TAC); + ARITH_TAC; + ONCE_REWRITE_TAC[FUN_EQ_THM;]; + REWRITE_TAC[o_THM]] + (* }}} *) +);; + +let sum_even = prove_by_refinement( + `!g n. sum {i | ODD i /\ i IN 0..n } (\i. if EVEN i then &0 else g i) = sum (0..n) (\i. if EVEN i then &0 else g i)`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + ONCE_REWRITE_TAC [MESON[] `x = y <=> y = x`]; + FORCE_MATCH_MP_TAC (ISPECL [`(\i. if EVEN i then &0 else (g i))`;`{i | ODD i /\ i IN 0..n}`;`(0..n)`] SUM_SUPERSET); + REPEAT STRIP_TAC; + SET_TAC[]; + REPEAT (POP_ASSUM MP_TAC); + REWRITE_TAC[IN_ELIM_THM;numseg]; + MESON_TAC[NOT_ODD]; + REWRITE_TAC[]; + ]);; + (* }}} *) + +let real_taylor_atn = prove_by_refinement( + `!n x. abs(atn x - sum (0..n) (\j. (-- &1 pow j) * x pow (2 * j + 1)/ &(2 * j+ 1))) <= abs(x) pow (2 * n + 3)`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + MP_TAC (ISPECL [`2*n + 2`;`x:real`] real_taylor_atn_ver1); + REWRITE_TAC[ARITH_RULE `(2*n + 2) +1 = 2 *n + 3`]; + REWRITE_TAC[GSYM sum_even]; + REWRITE_TAC[sum_odd]; + SUBGOAL_THEN `!i. ~(EVEN (2 *i + 1))` MP_TAC; + MP_TAC NOT_EVEN; + REWRITE_TAC[EVEN_EXISTS;ODD_EXISTS;ARITH_RULE `!m. SUC (m) = m+1`]; + MESON_TAC[]; + DISCH_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[ARITH_RULE `((2 * i + 1) - 1) DIV 2 = i`]; + ]);; + (* }}} *) + +let halfatn4 = new_definition `halfatn4 = halfatn o halfatn o halfatn o halfatn`;; + +let real_taylor_atn_halfatn4 = prove_by_refinement( + `!n x. abs (atn(halfatn4 x) - sum (0..n) (\j. (-- &1 pow j) * halfatn4 x pow (2 * j + 1)/ &(2 * j+ 1))) <= inv (&8 pow (2 * n + 3))`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + MATCH_MP_TAC REAL_LE_TRANS; + EXISTS_TAC `abs(halfatn4 x) pow (2 * n + 3)`; + REWRITE_TAC[real_taylor_atn;REAL_INV_POW]; + MATCH_MP_TAC Real_ext.REAL_PROP_LE_POW; + REWRITE_TAC[REAL_ABS_POS;halfatn4;o_THM]; + MATCH_MP_TAC (REAL_ARITH `x < y ==> x <= y`); + MP_TAC (ISPEC `x:real` halfatn_bounds_abs); + REPLICATE_TAC 3( DISCH_THEN (fun t-> MP_TAC (MATCH_MP halfatn_half t))); + FORCE_MATCH; + CONV_TAC REAL_FIELD; + ]);; + (* }}} *) + +let atn_halfatn4 = prove_by_refinement( + `!x. atn x = &16 * atn(halfatn4 x)`, + (* {{{ proof *) + [ + ONCE_REWRITE_TAC[REAL_ARITH `&16 * x = &2 * &2 * &2 * &2 * x`]; + REWRITE_TAC[halfatn4;o_THM;GSYM atn_half]; + ]);; + (* }}} *) + +let real_taylor_atn_halfatn4_a = prove_by_refinement( + `!n x. abs (atn x - &16 * sum (0..n) (\j. (-- &1 pow j) * halfatn4 x pow (2 * j + 1)/ &(2 * j+ 1))) <= inv (&2 pow (6 * n + 5 ))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + ONCE_REWRITE_TAC [atn_halfatn4]; + REWRITE_TAC[REAL_ARITH `abs (&16 * x - &16 * y) <= z <=> abs(x - y) <= z *inv (&2 pow 4)`]; + MP_TAC (ISPECL [`n:num`;`x:real`] real_taylor_atn_halfatn4); + FORCE_MATCH; + REWRITE_TAC[GSYM REAL_INV_MUL;GSYM REAL_POW_ADD;REAL_ARITH `&8 = &2 pow 3`;REAL_POW_POW]; + REPEAT AP_TERM_TAC; + ARITH_TAC; + ]);; + (* }}} *) + +let halfatn4_co = new_definition `halfatn4_co x j = (-- &1 pow j) * halfatn4 x pow (2 * j + 1)/ &(2 * j+ 1)`;; + +let atn_bounds_anti = prove_by_refinement( + `!x y. x <= y ==> abs(atn x - atn y) <= abs(x - y)`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + MP_TAC (ISPECL [`atn`;`(\t. inv(&1 + t pow 2))`;`x:real`;`y:real`] REAL_MVT_VERY_SIMPLE); + REWRITE_TAC[real_interval;IN_ELIM_THM]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT STRIP_TAC; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_ATREAL_WITHIN; + REWRITE_TAC[HAS_REAL_DERIVATIVE_ATN]; + REPEAT STRIP_TAC; + ONCE_REWRITE_TAC[REAL_ARITH `abs(y - x) = abs(x-y)`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[REAL_ABS_MUL]; + FORCE_MATCH_MP_TAC (ISPECL [`abs(inv (&1 + x' pow 2))`;`&1`;`abs(y-x)`] REAL_LE_RMUL); + REWRITE_TAC[REAL_ABS_POS;REAL_ABS_INV]; + FORCE_MATCH_MP_TAC (ISPECL [`&1`;`abs(&1 + x' pow 2)`] REAL_LE_INV2); + CONJ_TAC THEN TRY(REAL_ARITH_TAC); + MP_TAC (ISPEC `x':real` pos1); + SIMP_TAC [REAL_ARITH `(&0 < x ==> (abs x = x)) /\ (&1 <= &1 + u <=> &0 <= u)`;REAL_LE_POW_2]; + REAL_ARITH_TAC; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +prioritize_real();; + +let atn_bounds = prove_by_refinement( + `!x y. abs(atn x - atn y) <= abs(x-y)`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + DISJ_CASES_TAC (REAL_ARITH `x<= y \/ y <= x`); + ASM_SIMP_TAC[atn_bounds_anti]; + ONCE_REWRITE_TAC[REAL_ARITH `abs(x -y) = abs(y-x)`]; + ASM_SIMP_TAC[atn_bounds_anti]; + ]);; + (* }}} *) + + +(* +let real_taylor_atn_approx = prove_by_refinement( + `!n x u v eps1 eps2 eps3 eps. + abs(x - u ) <= eps1 /\ + inv (&2 pow (6 * n + 5)) <= eps2 /\ + abs(&16 *sum (0..n) (halfatn4_co u) - v )<= eps3 /\ + (eps1 + eps2 + eps3 <= eps) ==> + abs(atn(x) - v) <= eps`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + MATCH_MP_TAC REAL_LE_TRANS; + EXISTS_TAC `(eps1:real) + eps2 + eps3`; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_TRANS; + ABBREV_TAC `r = &16 * sum(0..n) (halfatn4_co u)`; + EXISTS_TAC` abs(atn x - atn u) +abs(atn u - r) + abs(r - v)`; + CONJ_TAC; + CONV_TAC (PATH_CONV "l" (ONCE_REWRITE_CONV[REAL_ARITH `atn x - v = (atn x - atn u) + (atn u - r) + (r - v)`])); + MATCH_MP_TAC REAL_LE_TRANS; + EXISTS_TAC `abs(atn x - atn u) + abs(atn u - r + r - v)`; + REWRITE_TAC[REAL_ABS_TRIANGLE;REAL_ARITH `(x:real) + y <= x + z <=> y <= z`]; + MATCH_MP_TAC (REAL_ARITH `a1 <= b1 /\ a2 <= b2 /\ a3 <= b3 ==> a1 + a2 + a3 <= b1 + b2 + b3`); + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC REAL_LE_TRANS; + EXISTS_TAC `abs(x - u)`; + ASM_REWRITE_TAC[atn_bounds]; + MATCH_MP_TAC REAL_LE_TRANS; + EXISTS_TAC `inv(&2 pow (6 * n + 5))`; + ASM_REWRITE_TAC[]; + EXPAND_TAC "r"; + MP_TAC (ISPECL [`n:num`;`u:real`] real_taylor_atn_halfatn4_a); + FORCE_MATCH; + REWRITE_TAC[FUN_EQ_THM;halfatn4_co]; + ]);; + (* }}} *) +*) + +let real_taylor_atn_approx = prove_by_refinement( + `!n x v eps1 eps2 eps. + inv (&2 pow (6 * n + 5)) <= eps1 /\ + abs(&16 *sum (0..n) (halfatn4_co x) - v )<= eps2 /\ + (eps1 + eps2 <= eps) ==> + abs(atn(x) - v) <= eps`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + MATCH_MP_TAC REAL_LE_TRANS; + EXISTS_TAC `( eps1:real) + eps2`; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_TRANS; + ABBREV_TAC `r = &16 * sum(0..n) (halfatn4_co x)`; + EXISTS_TAC`abs(atn x - r) + abs(r - v)`; + CONJ_TAC; + MESON_TAC[REAL_ABS_TRIANGLE;REAL_ARITH `atn x - v = (atn x - r) + r - v`]; + MATCH_MP_TAC (REAL_ARITH `a1 <= b1 /\ a2 <= b2 ==> a1 + a2 <= b1 + b2`); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_TRANS; + EXISTS_TAC `inv(&2 pow (6 * n + 5))`; + ASM_REWRITE_TAC[]; + EXPAND_TAC "r"; + MP_TAC (ISPECL [`n:num`;`x:real`] real_taylor_atn_halfatn4_a); + FORCE_MATCH; + REWRITE_TAC[FUN_EQ_THM;halfatn4_co]; + ]);; + (* }}} *) + + +end;; diff --git a/formal_ineqs/lib/ssrbool-compiled.hl b/formal_ineqs/lib/ssrbool-compiled.hl new file mode 100644 index 0000000..e7e2a72 --- /dev/null +++ b/formal_ineqs/lib/ssrbool-compiled.hl @@ -0,0 +1,759 @@ +needs "lib/ssrfun-compiled.hl";; + +(* Section ApplyIff *) +begin_section "ApplyIff";; +(add_section_var (mk_var ("P", (`:bool`))); add_section_var (mk_var ("Q", (`:bool`))));; +(add_section_hyp "eqPQ" (`P <=> Q`));; + +(* Lemma iffLR *) +let iffLR = section_proof [] +`P ==> Q` +[ + (done_tac); +];; + +(* Lemma iffRL *) +let iffRL = section_proof [] +`Q ==> P` +[ + (done_tac); +];; + +(* Lemma iffLRn *) +let iffLRn = section_proof [] +`~P ==> ~Q` +[ + (done_tac); +];; + +(* Lemma iffRLn *) +let iffRLn = section_proof [] +`~Q ==> ~P` +[ + (done_tac); +];; + +(* Finalization of the section ApplyIff *) +let iffLR = finalize_theorem iffLR;; +let iffRL = finalize_theorem iffRL;; +let iffLRn = finalize_theorem iffLRn;; +let iffRLn = finalize_theorem iffRLn;; +end_section "ApplyIff";; + +(* Lemma is_true_true *) +let is_true_true = section_proof [] +`T` +[ + (done_tac); +];; + +(* Lemma not_false_is_true *) +let not_false_is_true = section_proof [] +`~F` +[ + (done_tac); +];; +let isT = is_true_true;; +let notF = not_false_is_true;; + +(* Lemma negbT *) +let negbT = section_proof ["b"] +`(b = F) ==> ~b` +[ + (done_tac); +];; + +(* Lemma negbTE *) +let negbTE = section_proof ["b"] +`~b ==> b = F` +[ + (done_tac); +];; + +(* Lemma negbF *) +let negbF = section_proof ["b"] +`b ==> ~b = F` +[ + (done_tac); +];; + +(* Lemma negbFE *) +let negbFE = section_proof ["b"] +`~b = F ==> b` +[ + (done_tac); +];; + +(* Lemma negbK *) +let negbK = section_proof ["b"] +`~ ~b = b` +[ + (done_tac); +];; + +(* Lemma negbNE *) +let negbNE = section_proof ["b"] +`~ ~ b ==> b` +[ + (done_tac); +];; + +(* Lemma negb_inj *) +let negb_inj = section_proof ["b1";"b2"] +`~b1 = ~b2 ==> b1 = b2` +[ + ((((use_arg_then "b1") (disch_tac [])) THEN (clear_assumption "b1") THEN case) THEN (((use_arg_then "b2") (disch_tac [])) THEN (clear_assumption "b2") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma negbLR *) +let negbLR = section_proof ["b";"c"] +`b = ~c ==> ~b = c` +[ + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "negbK")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma negbRL *) +let negbRL = section_proof ["b";"c"] +`~b = c ==> b = ~c` +[ + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "negbK")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma contra *) +let contra = section_proof ["c";"b"] +`(c ==> b) ==> ~b ==> ~c` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac))); +];; +let contraNN = contra;; + +(* Lemma contraL *) +let contraL = section_proof ["c";"b"] +`(c ==> ~b) ==> b ==> ~c` +[ + (BETA_TAC THEN (move ["h"])); + ((((fun arg_tac -> (use_arg_then "contra") (fun fst_arg -> (use_arg_then "h") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then "negbK")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma contraR *) +let contraR = section_proof ["c";"b"] +`(~c ==> b) ==> ~b ==> c` +[ + (BETA_TAC THEN (move ["h"])); + ((((fun arg_tac -> (use_arg_then "contra") (fun fst_arg -> (use_arg_then "h") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then "negbK")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma contraLR *) +let contraLR = section_proof ["c";"b"] +`(~c ==> ~b) ==> b ==> c` +[ + (BETA_TAC THEN (move ["h"])); + ((((fun arg_tac -> (use_arg_then "contra") (fun fst_arg -> (use_arg_then "h") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then "negbK")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma contraT *) +let contraT = section_proof ["b"] +`(~b ==> F) ==> b` +[ + (done_tac); +];; + +(* Lemma wlog_neg *) +let wlog_neg = section_proof ["b"] +`(~b ==> b) ==> b` +[ + (((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)); +];; + +(* Lemma contraFT *) +let contraFT = section_proof ["c";"b"] +`(~c ==> b) ==> b = F ==> c` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac))); +];; + +(* Lemma contraFN *) +let contraFN = section_proof ["c";"b"] +`(c ==> b) ==> b = F ==> ~c` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac))); +];; + +(* Lemma contraTF *) +let contraTF = section_proof ["c";"b"] +`(c ==> ~b) ==> b ==> c = F` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac))); +];; + +(* Lemma contraNF *) +let contraNF = section_proof ["c";"b"] +`(c ==> b) ==> ~b ==> c = F` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac))); +];; + +(* Lemma contraFF *) +let contraFF = section_proof ["c";"b"] +`(c ==> b) ==> b = F ==> c = F` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac))); +];; +let isSome = define `isSome NONE = F /\ (!x. isSome (SOME x) = T)`;; + +(* Section BoolIf *) +begin_section "BoolIf";; +(add_section_var (mk_var ("vT", (`:A`))); add_section_var (mk_var ("vF", (`:A`))));; +(add_section_var (mk_var ("f", (`:A -> B`))));; +(add_section_var (mk_var ("b", (`:bool`))));; + +(* Lemma if_same *) +let if_same = section_proof [] +`(if b then vT else vT) = vT` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma if_neg *) +let if_neg = section_proof [] +`(if ~b then vT else vF) = if b then vF else vT` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma fun_if *) +let fun_if = section_proof [] +`f (if b then vT else vF) = if b then f vT else f vF` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma if_arg *) +let if_arg = section_proof ["fT";"fF";"x"] +`(if b then (fT:A->B) else fF) x = if b then fT x else fF x` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Finalization of the section BoolIf *) +let if_same = finalize_theorem if_same;; +let if_neg = finalize_theorem if_neg;; +let fun_if = finalize_theorem fun_if;; +let if_arg = finalize_theorem if_arg;; +end_section "BoolIf";; + +(* Lemma andTb *) +let andTb = section_proof ["b"] +`(T /\ b) = b` +[ + (done_tac); +];; + +(* Lemma andFb *) +let andFb = section_proof ["b"] +`(F /\ b) = F` +[ + (done_tac); +];; + +(* Lemma andbT *) +let andbT = section_proof ["b"] +`(b /\ T) = b` +[ + (done_tac); +];; + +(* Lemma andbF *) +let andbF = section_proof ["b"] +`(b /\ F) = F` +[ + (done_tac); +];; + +(* Lemma andbb *) +let andbb = section_proof ["b"] +`(b /\ b) = b` +[ + (done_tac); +];; + +(* Lemma andbC *) +let andbC = section_proof ["b";"c"] +`(b /\ c) = (c /\ b)` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andbA *) +let andbA = section_proof ["b";"c";"p"] +`b /\ (c /\ p) <=> (b /\ c) /\ p` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andbCA *) +let andbCA = section_proof ["b";"c";"p"] +`b /\ (c /\ p) <=> c /\ (b /\ p)` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andbAC *) +let andbAC = section_proof ["b";"c";"p"] +`(b /\ c) /\ p <=> (b /\ p) /\ c` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orTb *) +let orTb = section_proof ["b"] +`T \/ b <=> T` +[ + (done_tac); +];; + +(* Lemma orFb *) +let orFb = section_proof ["b"] +`F \/ b <=> b` +[ + (done_tac); +];; + +(* Lemma orbT *) +let orbT = section_proof ["b"] +`b \/ T <=> T` +[ + (done_tac); +];; + +(* Lemma orbF *) +let orbF = section_proof ["b"] +`b \/ F <=> b` +[ + (done_tac); +];; + +(* Lemma orbb *) +let orbb = section_proof ["b"] +`b \/ b <=> b` +[ + (done_tac); +];; + +(* Lemma orbC *) +let orbC = section_proof ["b";"c"] +`b \/ c <=> c \/ b` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orbA *) +let orbA = section_proof ["b";"c";"p"] +`b \/ (c \/ p) <=> (b \/ c) \/ p` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orbCA *) +let orbCA = section_proof ["b";"c";"p"] +`b \/ (c \/ p) <=> c \/ (b \/ p)` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orbAC *) +let orbAC = section_proof ["b";"c";"p"] +`(b \/ c) \/ p <=> (b \/ p) \/ c` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andbN *) +let andbN = section_proof ["b"] +`b /\ ~b <=> F` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andNb *) +let andNb = section_proof ["b"] +`~b /\ b <=> F` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orbN *) +let orbN = section_proof ["b"] +`b \/ ~b` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orNb *) +let orNb = section_proof ["b"] +`~b \/ b` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andb_orl *) +let andb_orl = section_proof ["b";"c";"p"] +`(b \/ c) /\ p <=> (b /\ p) \/ (c /\ p)` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andb_orr *) +let andb_orr = section_proof ["b";"c";"p"] +`b /\ (c \/ p) <=> (b /\ c) \/ (b /\ p)` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orb_andl *) +let orb_andl = section_proof ["b";"c";"p"] +`(b /\ c) \/ p <=> (b \/ p) /\ (c \/ p)` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orb_andr *) +let orb_andr = section_proof ["b";"c";"p"] +`b \/ (c /\ p) <=> (b \/ c) /\ (b \/ p)` +[ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andb_idl *) +let andb_idl = section_proof ["a";"b"] +`(b ==> a) ==> (a /\ b <=> b)` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case) THEN (((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andb_idr *) +let andb_idr = section_proof ["a";"b"] +`(a ==> b) ==> (a /\ b <=> a)` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case) THEN (((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andb_id2l *) +let andb_id2l = section_proof ["a";"b";"c"] +`(a ==> (b <=> c)) ==> (a /\ b <=> a /\ c)` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andb_id2r *) +let andb_id2r = section_proof ["a";"b";"c"] +`(b ==> (a <=> c)) ==> (a /\ b <=> c /\ b)` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case) THEN (((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orb_idl *) +let orb_idl = section_proof ["a";"b"] +`(a ==> b) ==> (a \/ b <=> b)` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orbb_idr *) +let orbb_idr = section_proof ["a";"b"] +`(b ==> a) ==> (a \/ b <=> a)` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orb_id2l *) +let orb_id2l = section_proof ["a";"b";"c"] +`(~ a ==> (b <=> c)) ==> (a \/ b <=> a \/ c)` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orb_id2r *) +let orb_id2r = section_proof ["a";"b";"c"] +`(~ b ==> (a <=> c)) ==> (a \/ b <=> c \/ b)` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case) THEN (((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma negb_and *) +let negb_and = section_proof ["a";"b"] +`~ (a /\ b) <=> ~ a \/ ~ b` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma negb_or *) +let negb_or = section_proof ["a";"b"] +`~ (a \/ b) <=> ~ a /\ ~ b` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andbK *) +let andbK = section_proof ["a";"b"] +`((a /\ b) \/ a) = a` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andKb *) +let andKb = section_proof ["a";"b"] +`a \/ b /\ a <=> a` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orbK *) +let orbK = section_proof ["a";"b"] +`(a \/ b) /\ a <=> a` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orKb *) +let orKb = section_proof ["a";"b"] +`a /\ (b \/ a) <=> a` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma implybT *) +let implybT = section_proof ["b"] +`b ==> T` +[ + (done_tac); +];; + +(* Lemma implybF *) +let implybF = section_proof ["b"] +`(b ==> F) <=> ~ b` +[ + (done_tac); +];; + +(* Lemma implyFb *) +let implyFb = section_proof ["b"] +`F ==> b` +[ + (done_tac); +];; + +(* Lemma implyTb *) +let implyTb = section_proof ["b"] +`(T ==> b) <=> b` +[ + (done_tac); +];; + +(* Lemma implybb *) +let implybb = section_proof ["b"] +`b ==> b` +[ + (done_tac); +];; + +(* Lemma negb_imply *) +let negb_imply = section_proof ["a";"b"] +`~ (a ==> b) <=> a /\ ~ b` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma implybE *) +let implybE = section_proof ["a";"b"] +`(a ==> b) <=> ~ a \/ b` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma implyNb *) +let implyNb = section_proof ["a";"b"] +`(~ a ==> b) <=> a \/ b` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma implybN *) +let implybN = section_proof ["a";"b"] +`(a ==> ~ b) <=> (b ==> ~ a)` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma implybNN *) +let implybNN = section_proof ["a";"b"] +`(~ a ==> ~ b) <=> b ==> a` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma implyb_idl *) +let implyb_idl = section_proof ["a";"b"] +`(~ a ==> b) ==> ((a ==> b) <=> b)` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma implyb_idr *) +let implyb_idr = section_proof ["a";"b"] +`(b ==> ~ a) ==> ((a ==> b) <=> ~ a)` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma implyb_id2l *) +let implyb_id2l = section_proof ["a";"b";"c"] +`(a ==> (b <=> c)) ==> ((a ==> b) <=> (a ==> c))` +[ + ((((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; +let XOR_DEF = new_definition `XOR p q = if p then ~q else q`;; +overload_interface("+", `XOR`);; + +(* Lemma addFb *) +let addFb = section_proof ["b"] +`F + b <=> b` +[ + ((((use_arg_then "XOR_DEF")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma addbF *) +let addbF = section_proof ["b"] +`b + F <=> b` +[ + ((((use_arg_then "XOR_DEF")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma addbb *) +let addbb = section_proof ["b"] +`b + b <=> F` +[ + ((((use_arg_then "XOR_DEF")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma addbC *) +let addbC = section_proof ["b";"c"] +`b + c <=> c + b` +[ + ((repeat_tactic 1 9 (((use_arg_then "XOR_DEF")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma addbA *) +let addbA = section_proof ["a";"b";"c"] +`a + (b + c) <=> (a + b) + c` +[ + ((repeat_tactic 1 9 (((use_arg_then "XOR_DEF")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case) THEN (((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac))); +];; + +(* Lemma addbCA *) +let addbCA = section_proof ["a";"b";"c"] +`(a + b) + c <=> (a + c) + b` +[ + ((repeat_tactic 1 9 (((use_arg_then "XOR_DEF")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case) THEN (((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac))); +];; + +(* Lemma addbAC *) +let addbAC = section_proof ["a";"b";"c"] +`a + (b + c) <=> b + (a + c)` +[ + ((repeat_tactic 1 9 (((use_arg_then "XOR_DEF")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case) THEN (((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac))); +];; + +(* Lemma andb_addl *) +let andb_addl = section_proof ["a";"b";"c"] +`(a + b) /\ c <=> (a /\ c) + (b /\ c)` +[ + ((repeat_tactic 1 9 (((use_arg_then "XOR_DEF")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case) THEN (((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac))); +];; + +(* Lemma andb_addr *) +let andb_addr = section_proof ["a";"b";"c"] +`a /\ (b + c) <=> (a /\ b) + (a /\ c)` +[ + ((repeat_tactic 1 9 (((use_arg_then "XOR_DEF")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case) THEN (((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac))); +];; + +(* Lemma addKb *) +let addKb = section_proof ["x";"y"] +`x + (x + y) <=> y` +[ + ((repeat_tactic 1 9 (((use_arg_then "XOR_DEF")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "x") (disch_tac [])) THEN (clear_assumption "x") THEN case) THEN (((use_arg_then "y") (disch_tac [])) THEN (clear_assumption "y") THEN case THEN (simp_tac))); +];; + +(* Lemma addbK *) +let addbK = section_proof ["x";"y"] +`(y + x) + x <=> y` +[ + ((repeat_tactic 1 9 (((use_arg_then "XOR_DEF")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "x") (disch_tac [])) THEN (clear_assumption "x") THEN case) THEN (((use_arg_then "y") (disch_tac [])) THEN (clear_assumption "y") THEN case THEN (simp_tac))); +];; + +(* Lemma addIb *) +let addIb = section_proof ["x";"y1";"y2"] +`(y1 + x <=> y2 + x) ==> (y1 = y2)` +[ + ((repeat_tactic 1 9 (((use_arg_then "XOR_DEF")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "y1") (disch_tac [])) THEN (clear_assumption "y1") THEN case) THEN (((use_arg_then "y2") (disch_tac [])) THEN (clear_assumption "y2") THEN case) THEN (((use_arg_then "x") (disch_tac [])) THEN (clear_assumption "x") THEN case THEN (simp_tac))); +];; + +(* Lemma addbI *) +let addbI = section_proof ["x";"y1";"y2"] +`(x + y1 <=> x + y2) ==> (y1 = y2)` +[ + ((repeat_tactic 1 9 (((use_arg_then "XOR_DEF")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "x") (disch_tac [])) THEN (clear_assumption "x") THEN case) THEN (((use_arg_then "y1") (disch_tac [])) THEN (clear_assumption "y1") THEN case) THEN (((use_arg_then "y2") (disch_tac [])) THEN (clear_assumption "y2") THEN case THEN (simp_tac))); +];; + +(* Lemma addTb *) +let addTb = section_proof ["b"] +`T + b <=> ~b` +[ + (((((use_arg_then "XOR_DEF")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (done_tac)); +];; + +(* Lemma addbT *) +let addbT = section_proof ["b"] +`b + T <=> ~ b` +[ + ((((use_arg_then "XOR_DEF")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma addbN *) +let addbN = section_proof ["a";"b"] +`a + ~ b <=> ~ (a + b)` +[ + ((repeat_tactic 1 9 (((use_arg_then "XOR_DEF")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case) THEN (((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac))); +];; + +(* Lemma addNb *) +let addNb = section_proof ["a";"b"] +`~ a + b <=> ~ (a + b)` +[ + ((repeat_tactic 1 9 (((use_arg_then "XOR_DEF")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "a") (disch_tac [])) THEN (clear_assumption "a") THEN case) THEN (((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac))); +];; +let subpred = new_definition `subpred p1 p2 <=> (!x. p1 x ==> p2 x)`;; +let subrel = new_definition `subrel r1 r2 <=> (!x y. r1 x y ==> r2 x y)`;; +let pred0 = new_definition `pred0 = (\x. F)`;; +let predT = new_definition `predT = (\x. T)`;; +let predI = new_definition `predI p1 p2 = (\x. p1 x /\ p2 x)`;; +let predU = new_definition `predU p1 p2 = (\x. p1 x \/ p2 x)`;; +let predC = new_definition `predC p = (\x. ~p x)`;; +let predD = new_definition `predD p1 p2 = (\x. ~p2 x /\ p1 x)`;; +let preim = new_definition `preim f (d:A->bool) = (\x. d (f x))`;; +let relU = new_definition `relU r1 r2 = (\x y. r1 x y \/ r2 x y)`;; + +(* Lemma subrelUl *) +let subrelUl = section_proof ["r1";"r2"] +`subrel r1 (relU r1 r2)` +[ + (((((use_arg_then "relU")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "subrel")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma subrelUr *) +let subrelUr = section_proof ["r1";"r2"] +`subrel r2 (relU r1 r2)` +[ + (((((use_arg_then "relU")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "subrel")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; diff --git a/formal_ineqs/lib/ssreflect/sections.hl b/formal_ineqs/lib/ssreflect/sections.hl new file mode 100644 index 0000000..4ab867b --- /dev/null +++ b/formal_ineqs/lib/ssreflect/sections.hl @@ -0,0 +1,273 @@ +(* =========================================================== *) +(* SSReflect/HOL Light support library *) +(* See http://code.google.com/p/flyspeck/downloads/list *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +(* Basic commands for working with the goal stack *) +let revert_proof_step = b;; +let begin_goal = g;; + +(* A flag for fast proof loading (using mk_thm) *) +let fast_load_flag = ref false;; + +(* Section variables, hypotheses (with labels), and implicit types *) +type section_info = term list * (string * term) list * (string * hol_type) list;; + +let empty_section : section_info = ([], [], []);; + +let section_stack = ref ([] : (string * section_info) list);; + + +(* Begins a new section *) +let begin_section name = + let sections = !section_stack in + if can (C assoc sections) name then + failwith ("Section " ^ name ^ " is already active") + else + let sections = (name, empty_section) :: sections in + section_stack := sections;; + + +(* Ends the active section *) +let end_section name = + let sections = !section_stack in + if sections = [] then + failwith "end_section: No open sections" + else + let last_name, _ = hd sections in + if Pervasives.compare last_name name <> 0 then + failwith ("The last open section is " ^ last_name) + else + section_stack := tl sections;; + +(* Returns all section variables in the current section *) +let current_section_vars () = + if !section_stack = [] then [] + else + let (_, (vars, _, _)) = hd !section_stack in + vars;; + +(* Returns all hypotheses in the current section *) +let current_section_hyps () = + if !section_stack = [] then [] + else + let (_, (_, hyps, _)) = hd !section_stack in + hyps;; + + +(* Returns all section variables from all sections *) +let section_vars () : term list = + let vars = map (fun (_, (v, _, _)) -> v) !section_stack in + List.concat vars;; + + +(* Returns all implicit types from all sections *) +let section_types () : (string * hol_type) list = + let types = map (fun (_, (_, _, t)) -> t) !section_stack in + List.concat types;; + + + +(* Returns all hypotheses from all sections *) +let section_hyps () : (string * term) list = + let hyps = map (fun (_, (_, h, _)) -> h) !section_stack in + List.concat hyps;; + + +(* Adds the given variable to the active section *) +let add_section_var var = + let sections = !section_stack in + if sections = [] then + failwith "add_section_var: No open sections" + else + let name, (vars, hyps, types) = hd sections in + let s_var = section_vars() in + let var_name, _ = dest_var var in + if can (C assoc (map dest_var s_var)) var_name then + failwith ("A variable with the name "^var_name^" is already defined") + else + section_stack := (name, (var :: vars, hyps, types)) :: tl sections;; + +(* Adds the given implicit type to the active section *) +let add_section_type tm = + let sections = !section_stack in + if sections = [] then + failwith "add_section_type: No open sections" + else + let name, (vars, hyps, types) = hd sections in + let s_types = section_types() in + let var_name, ty = dest_var tm in + if can (C assoc s_types) var_name then + failwith ("An implicit type for the variable "^var_name^" is already defined") + else + section_stack := (name, (vars, hyps, (var_name, ty) :: types)) :: tl sections;; + + + +(* Removes the given variable from the active section *) +let remove_section_var var_name = + let sections = !section_stack in + let name, (vars, hyps, types) = hd sections in + let ty = assoc var_name (map dest_var vars) in + let var = mk_var (var_name, ty) in + let new_vars = subtract vars [var] in + section_stack := (name, (new_vars, hyps, types)) :: tl sections;; + + +(* Removes the given implicit type from the active section *) +let remove_section_type type_name = + let sections = !section_stack in + let name, (vars, hyps, types) = hd sections in + let ty = assoc type_name types in + let new_types = subtract types [type_name, ty] in + section_stack := (name, (vars, hyps, new_types)) :: tl sections;; + + + + +(* Instantiates types of section variables in the term *) +let inst_section_vars tm = + let s_vars = map dest_var (section_vars()) in + let find_var (name, ty) = + try (assoc name s_vars, ty) + with Failure _ -> (bool_ty, bool_ty) in + let inst_var (name, ty) tm = + let ty_dst, ty_src = find_var (name, ty) in + try (inst (type_match ty_src ty_dst []) tm) + with Failure _ -> + failwith ("Section variable " ^ name ^ + " has type " ^ string_of_type ty_dst) in + let f_vars = map dest_var (frees tm) in + itlist inst_var f_vars tm;; + + +(* Instantiates implicit types in the given term *) +(* (free variables and top generalized variables are considered in the term) *) +let inst_section_types tm = + let s_types = section_types() in + let find_type tm = + let name, ty = dest_var tm in + try (assoc name s_types, ty) with Failure _ -> (bool_ty, bool_ty) in + let f_vars = frees tm in + let g_vars, _ = strip_forall tm in + let ty_dst, ty_src = unzip (map find_type (g_vars @ f_vars)) in + let ty_inst = itlist2 type_match ty_src ty_dst [] in + inst ty_inst tm;; + + +(* Checks if the term contains any free variables + which are not section variables *) +let check_section_term tm = + let f_vars = frees tm in + if !section_stack = [] then + if f_vars <> [] then + let str = String.concat ", " (map string_of_term f_vars) in + failwith ("Free variables: " ^ str) + else () + else + let s_vars = section_vars() in + let vars = subtract f_vars s_vars in + if vars <> [] then + let str = String.concat ", " (map string_of_term vars) in + failwith ("Free variables: " ^ str) + else ();; + + + + +(* Adds the given hypothesis (term) to the active section *) +let add_section_hyp label hyp = + let sections = !section_stack in + if sections = [] then + failwith "add_section_hyp: No open sections" + else + let hyp0 = inst_section_vars hyp in + let hyp1 = inst_section_types hyp0 in + let name, (vars, hyps, types) = hd sections in + let hyp_names = map fst (section_hyps()) in + if can (find (fun x -> Pervasives.compare label x = 0)) hyp_names then + failwith ("A hypothesis with the name "^label^" is already defined") + else + check_section_term hyp1; + section_stack := (name, (vars, (label, hyp1) :: hyps, types)) :: tl sections;; + + +(* Removes the given assumption from the active section *) +let remove_section_hyp label = + let sections = !section_stack in + let name, (vars, hyps, types) = hd sections in + let hyp = assoc label hyps in + let new_hyps = subtract hyps [(label, hyp)] in + section_stack := (name, (vars, new_hyps, types)) :: tl sections;; + + + +(* Prepares a goal term *) +let prepare_goal_term tm = + if !section_stack = [] then (check_section_term tm; tm) + else + let tm0 = inst_section_vars tm in + let tm1 = inst_section_types tm0 in + let s_hyps = map snd (section_hyps()) in + let r = itlist (curry mk_imp) s_hyps tm1 in + check_section_term r; r;; + + +(* Prepares a goal term and an initial tactic *) +let prepare_section_proof names tm = + let f_vars = map dest_var (frees tm) in + let find var_name = + try assoc var_name f_vars with Failure _ -> failwith ("Unused variable: "^var_name) in + let g_vars = map (fun name -> mk_var (name, find name)) names in + let g_tm = list_mk_forall (g_vars, tm) in + let tm0 = prepare_goal_term g_tm in + let n_hyps = map fst (section_hyps()) in + let gen_tac = REPLICATE_TAC (length g_vars) GEN_TAC in + let disch_tac = itlist (fun name tac -> DISCH_THEN (LABEL_TAC name) THEN tac) n_hyps ALL_TAC in + tm0, disch_tac THEN gen_tac;; + + +(* Starts a proof of the goal using section hypotheses *) +let start_section_proof names tm = + let tm0, tac0 = prepare_section_proof names tm in + let _ = set_goal([], tm0) in + refine (by (VALID tac0));; + + +(* Returns the final theorem *) +let end_section_proof () = + let th = top_thm() in + let hyps = section_hyps() in + itlist (fun _ th -> UNDISCH th) hyps th;; + +(* Proofs a lemma using section hypotheses and variables *) +let section_proof names tm tac_list = + let tm0, tac0 = prepare_section_proof names tm in + let gstate = mk_goalstate ([], tm0) in + let tac_list1 = + if !fast_load_flag then + [fun g -> ACCEPT_TAC(mk_thm([], snd g)) g] + else + tac_list in + let _, sgs, just = rev_itlist by (tac0 :: tac_list1) gstate in + let th0 = + if sgs = [] then just null_inst [] + else failwith "section_proof: unsolved goals" in + let hyps = section_hyps() in + itlist (fun _ th -> UNDISCH th) hyps th0;; + + + +(* Discharges all assumptions and generalize all section variables *) +let finalize_theorem th = + let hyps = map snd (current_section_hyps()) in + let th_hyps = hyp th in + let hyps0 = intersect hyps th_hyps in + let s_vars = current_section_vars() in + let th1 = rev_itlist (fun hyp th -> DISCH hyp th) hyps0 th in + let f_vars = frees (concl th1) in + let vars = intersect f_vars s_vars in + itlist (fun var th -> GEN var th) vars th1;; + diff --git a/formal_ineqs/lib/ssreflect/ssreflect.hl b/formal_ineqs/lib/ssreflect/ssreflect.hl new file mode 100644 index 0000000..648ada6 --- /dev/null +++ b/formal_ineqs/lib/ssreflect/ssreflect.hl @@ -0,0 +1,1032 @@ +(* =========================================================== *) +(* SSReflect/HOL Light support library *) +(* See http://code.google.com/p/flyspeck/downloads/list *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +(* A special definition for introducing equalities with the construction move eq: a => b *) +let ssreflect_eq_def = new_definition `!v P. ssreflect_eq (v:A) (P:bool) = P`;; + + +(* Generalizes given variables in a term *) +let gen_variables binders tm = + if type_of tm <> bool_ty then + if length binders = 0 then tm + else + failwith "gen_variables: bool term is required" + else + let f_vars = map dest_var (frees tm) in + let find_type name = assoc name f_vars in + let gen_variable var_name tm = + let var = + try mk_var (var_name, find_type var_name) + with Failure _ -> + failwith ("gen_variables: variable "^var_name + ^" is not free in the term "^(string_of_term tm)) in + mk_forall (var, tm) in + itlist gen_variable binders tm;; + + +(* Combined type of theorems and terms *) +type arg_type = Arg_theorem of thm | Arg_term of term | Arg_type of hol_type;; + +let get_arg_thm arg = + match arg with + | Arg_theorem th -> th + | _ -> failwith "A theorem expected";; + +let get_arg_term arg = + match arg with + | Arg_term tm -> tm + | _ -> failwith "A term expected";; + +let get_arg_type arg = + match arg with + | Arg_type ty -> ty + | _ -> failwith "A type expected";; + + +(* Converts a theorem tactic into a tactic which accepts thm_term arguments *) +let thm_tac (ttac : thm_tactic) = ttac o get_arg_thm;; +let term_tac (ttac : term -> tactic) = ttac o get_arg_term;; +let type_tac (ttac : hol_type -> tactic) arg = ttac o get_arg_type;; + + +let conv_thm_tac (ttac : thm_tactic->tactic) (arg_tac : arg_type->tactic) = + ttac (fun th -> arg_tac (Arg_theorem th));; + + + +(* Based on the code from tactics.ml *) +(* Applies the second tactic to either the first subgoal or + the last subgoal *) +let (THENL_FIRST),(THENL_LAST) = + let propagate_empty i [] = [] + and propagate_thm th i [] = INSTANTIATE_ALL i th in + let compose_justs n just1 just2 i ths = + let ths1,ths2 = chop_list n ths in + (just1 i ths1)::(just2 i ths2) in + let rec seqapply l1 l2 = match (l1,l2) with + ([],[]) -> null_meta,[],propagate_empty + | ((tac:tactic)::tacs),((goal:goal)::goals) -> + let ((mvs1,insts1),gls1,just1) = tac goal in + let goals' = map (inst_goal insts1) goals in + let ((mvs2,insts2),gls2,just2) = seqapply tacs goals' in + ((union mvs1 mvs2,compose_insts insts1 insts2), + gls1@gls2,compose_justs (length gls1) just1 just2) + | _,_ -> failwith "seqapply: Length mismatch" in + let justsequence just1 just2 insts2 i ths = + just1 (compose_insts insts2 i) (just2 i ths) in + let tacsequence ((mvs1,insts1),gls1,just1) tacl = + let ((mvs2,insts2),gls2,just2) = seqapply tacl gls1 in + let jst = justsequence just1 just2 insts2 in + let just = if gls2 = [] then propagate_thm (jst null_inst []) else jst in + ((union mvs1 mvs2,compose_insts insts1 insts2),gls2,just) in + let (thenl_first: tactic -> tactic -> tactic) = + fun tac1 tac2 g -> + let _,gls,_ as gstate = tac1 g in + if gls = [] then failwith "No subgoals" + else + let tac_list = tac2 :: (replicate ALL_TAC (length gls - 1)) in + tacsequence gstate tac_list + and (thenl_last: tactic -> tactic -> tactic) = + fun tac1 tac2 g -> + let _,gls,_ as gstate = tac1 g in + if gls = [] then failwith "No subgoals" + else + let tac_list = (replicate ALL_TAC (length gls - 1)) @ [tac2] in + tacsequence gstate tac_list in + thenl_first, thenl_last;; + + +(* Rotates the goalstack *) +let (THENL_ROT: int -> tactic -> tactic) = + fun n tac g -> + let gstate = tac g in + rotate n gstate;; + + +(* Repeats the given tactic exactly n times and then repeats the same tactic at most m times *) +let repeat_tactic n m tac = + let rec replicate_at_most m tac = + if m <= 0 then ALL_TAC else (tac THEN replicate_at_most (m - 1) tac) ORELSE ALL_TAC in + REPLICATE_TAC n tac THEN replicate_at_most m tac;; + + + +(* Returns all free variables in the goal *) +let get_context_vars (g : goal) = + let list, g_tm = g in + let tms = g_tm :: map (concl o snd) list in + let f_vars = setify (flat (map frees tms)) in + map (fun v -> ((fst o dest_var) v, v)) f_vars;; + + +(* Clears the given assumption *) +let clear_assumption name = + TRY (REMOVE_THEN name (fun th -> ALL_TAC));; + + +(* DISCH_THEN (LABEL_TAC name) for assumptions and X_GEN_TAC name for variables *) +let move labels = + (* Automatically introduces an assumption for a top-level ssreflect_eq *) + let move_eq (g:goal) = + let g_tm = snd g in + let tac = + try + let eq_tm = (rator o fst o dest_imp) g_tm in + if (fst o dest_const o rator) eq_tm = "ssreflect_eq" then + let label = (fst o dest_var o rand) eq_tm in + DISCH_THEN (LABEL_TAC label o PURE_ONCE_REWRITE_RULE[ssreflect_eq_def]) + else + ALL_TAC + with Failure _ -> ALL_TAC in + tac g in + + let move1 name (g:goal) = + let g_tm = snd g in + let tac = + if is_forall g_tm then + let tm0, g_tm1 = dest_forall g_tm in + let tm = mk_var (name, type_of tm0) in + if name = "_" then + GEN_TAC + else + X_GEN_TAC tm + else + if is_imp g_tm then + if name = "_" then + DISCH_THEN (fun th -> ALL_TAC) + else + DISCH_THEN (LABEL_TAC name) + else + failwith "move: not (!) or (==>)" in + tac g in + fun g -> + let tac = itlist + (fun name tac -> move_eq THEN move1 name THEN tac) labels ALL_TAC in + tac g;; + + +(* Localization tactical *) +let in_tac a_list in_goal tac (g:goal) = + let goal_tm = snd g in + let tmp_goal_name = "$_goal_$" in + let tmp_goal_var = mk_var (tmp_goal_name, bool_ty) in + let tmp_goal = mk_eq (tmp_goal_var, goal_tm) in + let tmp_goal_sym = mk_eq (goal_tm, tmp_goal_var) in + let disch_tac = + rev_itlist (fun name tac -> REMOVE_THEN name MP_TAC THEN tac) a_list ALL_TAC in + let intro_tac = move a_list in + let hide_goal, unfold_goal = + if in_goal then + ALL_TAC, ALL_TAC + else + ABBREV_TAC tmp_goal, + EXPAND_TAC tmp_goal_name THEN + UNDISCH_TAC tmp_goal_sym THEN DISCH_THEN (fun th -> ALL_TAC) + in + (hide_goal THEN disch_tac THEN tac THEN TRY intro_tac THEN unfold_goal) g;; + + + +(* Finds a subterm in the given term which matches against the given + pattern; local_consts is a list of variable which must be fixed in + the pattern. + This function returns the path to the first matched subterm *) +let match_subterm local_consts pat tm = + let rec find tm path = + try + let inst = term_match local_consts pat tm in + if instantiate inst pat = tm then path else failwith "Bad instantiation" + with x -> + try + match tm with + | Abs(_, b_tm) -> find b_tm (path^"b") + | Comb(l_tm, r_tm) -> + try find l_tm (path^"l") + with Failure _ -> find r_tm (path^"r") + | _ -> failwith "match_subterm: no match" + with x -> + failwith ("match_subterm: no match: "^string_of_term pat) in + find tm "";; + + + +(* Returns paths to all subterms satisfying p *) +let find_all_paths p tm = + let rec find_path p tm path = + let paths = + match tm with + | Abs(_, b_tm) -> + find_path p b_tm (path ^ "b") + | Comb(l_tm, r_tm) -> + (find_path p l_tm (path ^ "l")) @ (find_path p r_tm (path ^ "r")) + | _ -> [] in + if p tm then path :: paths else paths in + find_path p tm "";; + + +(* Instantiates types of the given context variables in the given term.*) +let inst_context_vars vars tm_vars tm = + let find_type var = + let name, ty = dest_var var in + try + (ty, type_of (assoc name vars)) + with Failure _ -> + failwith (name^" is free in the term `"^(string_of_term tm)^"` and in the context") in + let ty_src, ty_dst = unzip (map find_type tm_vars) in + let ty_inst = itlist2 type_match ty_src ty_dst [] in + inst ty_inst tm;; + + +(* Instantiates types of all free variables in the term using the context *) +let inst_all_free_vars tm (g : goal) = + let context_vars = get_context_vars g in + let f_vars = frees tm in + inst_context_vars context_vars f_vars tm;; + + +(* Finds a subterm corresponding to the given pattern. + Before matching, the term types are instantiated in the given context. *) +let match_subterm_in_context pat tm (g : goal) = + let context_vars = get_context_vars g in + let f0_vars = filter (fun tm -> ((fst o dest_var) tm).[0] <> '_') (frees pat) in + let pattern = inst_context_vars context_vars f0_vars pat in + let f1_vars = filter (fun tm -> ((fst o dest_var) tm).[0] <> '_') (frees pattern) in + match_subterm f1_vars pattern tm;; + + +(*************************) +(* Rewriting *) +(*************************) + +(* Breaks conjunctions and does other misc stuff *) +let rec break_conjuncts th : thm list = + (* Convert P ==> (!x. Q x) to !x. P ==> Q x and P ==> Q ==> R to P /\ Q ==> R *) + let th0 = PURE_REWRITE_RULE[GSYM RIGHT_FORALL_IMP_THM; IMP_IMP] th in + let th1 = SPEC_ALL th0 in + (* Break top level conjunctions *) + let th_list = CONJUNCTS th1 in + if length th_list > 1 then + List.concat (map break_conjuncts th_list) + else + let th_tm = concl th1 in + (* Deal with assumptions *) + if is_imp th_tm then + let a_tm = lhand th_tm in + let th_list = break_conjuncts (UNDISCH th1) in + map (DISCH a_tm) th_list + else + if is_eq th_tm then [th1] + else + if is_neg th_tm then + [PURE_ONCE_REWRITE_RULE[TAUT `~P <=> (P <=> F)`] th1] + else + [EQT_INTRO th1];; + + +(* Finds an instantination for the given term inside another term *) +let rec find_term_inst local_consts tm src_tm path = + try (term_match local_consts tm src_tm, true, path) + with Failure _ -> + match src_tm with + | Comb(l_tm, r_tm) -> + let r_inst, flag, s = find_term_inst local_consts tm l_tm (path ^ "l") in + if flag then (r_inst, flag, s) + else + find_term_inst local_consts tm r_tm (path ^ "r") + | Abs(_, b_tm) -> + find_term_inst local_consts tm b_tm (path ^ "b") + | _ -> (([],[],[]), false, path);; + + + +(* Rewrites the subterm at the given path using the given equation theorem *) +let path_rewrite path th tm = + let rec build path tm = + let n = String.length path in + if n = 0 then + th + else + let ch = path.[0] in + let path' = String.sub path 1 (n - 1) in + if ch = 'l' then + let lhs, rhs = dest_comb tm in + let th0 = build path' lhs in + AP_THM th0 rhs + else if ch = 'r' then + let lhs, rhs = dest_comb tm in + let th0 = build path' rhs in + AP_TERM lhs th0 + else if ch = 'b' then + let var, body = dest_abs tm in + let th0 = build path' body in + try ABS var th0 + with Failure _ -> failwith ("ABS failed: (" ^ string_of_term var ^ ", " ^ string_of_thm th0) + else + failwith ("Bad path symbol: "^path) in + let res = build path tm in + let lhs = (lhand o concl) res in + if not (aconv lhs tm) then failwith ("path_rewrite: incorrect result [required: "^ + (string_of_term tm)^"; obtained: "^ + (string_of_term lhs)) + else + res;; + + +let new_rewrite occ pat th g = + let goal_tm = snd g in + (* Free variables in the given theorem will not be matched *) + let local_consts = frees (concl th) in + (* Apply the pattern *) + let goal_subterm_path = + if pat = [] then "" else match_subterm_in_context (hd pat) goal_tm g in + let goal_subterm = follow_path goal_subterm_path goal_tm in + + (* Local rewrite function *) + let rewrite th = + let concl_th = concl th in + let cond_flag = is_imp concl_th in + let match_fun = lhs o (if cond_flag then rand else I) in + + (* Match the theorem *) + let lhs_tm = match_fun concl_th in + let ii, flag, path = find_term_inst local_consts lhs_tm goal_subterm goal_subterm_path in + if not flag then + failwith (string_of_term lhs_tm ^ " does not match any subterm in the goal") + else + let matched_th = INSTANTIATE ii th in + let matched_tm = (match_fun o concl) matched_th in + + (* Find all matched subterms *) + let paths = find_all_paths (fun x -> aconv x matched_tm) goal_tm in + let paths = if occ = [] then paths else + map (fun i -> List.nth paths (i - 1)) occ in + + (* Find all free variables in the matched theorem which do not correspond to free variables in + the matched subterm *) + let tm_frees = frees matched_tm in + let mth_frees = frees (concl matched_th) in + let vars = subtract mth_frees (union local_consts tm_frees) in + if vars = [] then + (* Construct the tactic for rewriting *) + let r_tac = fun th -> MAP_EVERY (fun path -> CONV_TAC (path_rewrite path th)) paths in + if cond_flag then + MP_TAC matched_th THEN ANTS_TAC THENL [ALL_TAC; DISCH_THEN r_tac] + else + r_tac matched_th + else + let rec gen_vars vars th = + match vars with + | v :: vs -> gen_vars vs (GEN v th) + | [] -> th in + let th2 = gen_vars vars matched_th in + MP_TAC th2 THEN PURE_REWRITE_TAC[LEFT_IMP_FORALL_THM] in + + (* Try to rewrite with all given theorems *) + let th_list = break_conjuncts th in + let rec my_first th_list = + if length th_list = 1 then + rewrite (hd th_list) g + else + try rewrite (hd th_list) g + with Failure _ -> my_first (tl th_list) in + my_first th_list;; + + +(* +let th = ARITH_RULE `!n. n * 0 <= 1`;; +let tm = `m * 0 <= 1 <=> T`;; +g tm;; +e(new_rewrite [] [] th);; + +let th = CONJ REAL_MUL_RINV REAL_MUL_LINV;; +let tm = `inv (x - y) * (x - y) + &1 = &1 + inv (x - y) * (x - y) + x * inv x`;; +let tm0 = `!x. inv (x - y) * (x - y) = &1`;; + + +g tm0;; +e(new_rewrite [] [] (th));; +e(new_rewrite [] [] (GSYM th));; +e(new_rewrite [] [`_ + &1`] th);; + +g(`x < 2`);; +e(new_rewrite [] [] (ARITH_RULE `!x. x > 2 ==> (!n. n = 2 ==> ~(x < n))`));; + +*) + + +(* Rewrite tactic for usual and conditional theorems *) +let rewrite occ pat th g = + let rec match_theorem ffun th tm str = + try (PART_MATCH ffun th tm, true, str) + with Failure _ -> + match tm with + | Comb(l_tm, r_tm) -> + let r_th, flag, s = match_theorem ffun th l_tm (str ^ "l") in + if flag then (r_th, flag, s) + else + match_theorem ffun th r_tm (str ^ "r") + | Abs(_, b_tm) -> + match_theorem ffun th b_tm (str ^ "b") + | _ -> (th, false, str) in + (* Initialize auxiliary variables *) + let goal_tm = snd g in + let th0 = PURE_REWRITE_RULE[IMP_IMP] th in + let concl_th = concl (SPEC_ALL th0) in + let cond_flag = is_imp concl_th in + let eq_tm = if cond_flag then rand concl_th else concl_th in + let match_fun = (if is_eq eq_tm then lhand else I) o (if cond_flag then rand else I) in + + (* Apply the pattern *) + let goal_subterm_path = + if pat = [] then "" else match_subterm_in_context (hd pat) goal_tm g in + let goal_subterm = follow_path goal_subterm_path goal_tm in + + (* Match the theorem *) + let matched_th, flag, path = match_theorem match_fun th0 goal_subterm goal_subterm_path in + if not flag then + failwith "lhs does not match any term in the goal" + else + let matched_tm = (match_fun o concl) matched_th in + (* Find all matched subterms *) + let paths = find_all_paths (fun x -> x = matched_tm) goal_tm in + let paths = if occ = [] then paths else + map (fun i -> List.nth paths (i - 1)) occ in + (* Find all free variables in the matched theorem which do not correspond to free variables in + the matched subterm *) + let tm_frees = frees matched_tm in + let th_frees = frees (concl th0) in + let mth_frees = frees (concl matched_th) in + let vars = subtract mth_frees (union th_frees tm_frees) in + if vars = [] then + let r_tac = fun th -> MAP_EVERY (fun path -> GEN_REWRITE_TAC (PATH_CONV path) [th]) paths in + if cond_flag then + (MP_TAC matched_th THEN ANTS_TAC THENL [ALL_TAC; DISCH_THEN r_tac]) g + else + (r_tac matched_th) g + else + let rec gen_vars vars th = + match vars with + | v :: vs -> gen_vars vs (GEN v th) + | [] -> th in + let th2 = gen_vars vars matched_th in + (MP_TAC th2 THEN REWRITE_TAC[LEFT_IMP_FORALL_THM]) g;; + + + + +(* Analogue of the "done" tactic in SSReflect *) +let done_tac = ASM_REWRITE_TAC[] THEN FAIL_TAC "done: not all subgoals are proved";; + +(* Simplification: /= *) +let simp_tac = SIMP_TAC[];; + + +(* Linear arithmetic simplification *) +let arith_tac = FIRST [ARITH_TAC; REAL_ARITH_TAC; INT_ARITH_TAC];; + + +(* split *) +let split_tac = FIRST [CONJ_TAC; EQ_TAC];; + + + +(* Creates an abbreviation for the given term with the given name *) +let set_tac name tm (g : goal) = + let goal_tm = snd g in + let tm0 = + try + follow_path (match_subterm_in_context tm goal_tm g) goal_tm + with Failure _ -> tm in + let tm1 = inst_all_free_vars tm0 g in + let abbrev_tm = mk_eq (mk_var (name, type_of tm1), tm1) in + (ABBREV_TAC abbrev_tm THEN POP_ASSUM (LABEL_TAC (name ^ "_def"))) g;; + +(* Generates a fresh name for the given term *) +(* taking into account names of the provided variables *) +let generate_fresh_name names tm = + let rec find_name prefix n = + let name = prefix ^ (if n = 0 then "" else string_of_int n) in + if can (find (fun str -> str = name)) names then + find_name prefix (n + 1) + else + name in + let prefix = if is_var tm then (fst o dest_var) tm else "x" in + find_name prefix 0;; + + +(* Returns a variable which name does not conflict with names of given vars *) +let get_fresh_var var vars = + let names = map (fst o dest_var) vars in + mk_var (generate_fresh_name names var, type_of var);; + + +(* Matches all wild cards in the term and *) +(* instantinates all type variables in the given context *) +let prepare_term tm (g : goal) = + let goal_tm = snd g in + let tm0 = + try follow_path (match_subterm_in_context tm goal_tm g) goal_tm + with Failure _ -> tm in + inst_all_free_vars tm0 g;; + +(* Discharges a term by generalizing all occurences of this term first *) +let disch_tm_tac occs tm (g : goal) = + let tm0 = prepare_term tm g in + let name = generate_fresh_name ((fst o unzip) (get_context_vars g)) tm in + let new_tm = mk_var (name, type_of tm0) in + let new_tm1 = + if occs = [] && is_var tm then + mk_var ((fst o dest_var) tm, type_of tm0) + else new_tm in + let abbrev_tm = mk_eq (new_tm, tm0) in + (ABBREV_TAC abbrev_tm THEN + EXPAND_TAC name THEN + POP_ASSUM (fun th -> TRY (new_rewrite occs [] th)) THEN + SPEC_TAC (new_tm, new_tm1)) g;; + + +(* Discharges a theorem or a term *) +let disch_tac occs arg = + match arg with + | Arg_theorem th -> MP_TAC th + | Arg_term tm -> disch_tm_tac occs tm + | _ -> failwith "disch_tac: a type cannot be discharged";; + + + +(* process_thm *) +let process_thm = + let conj_imp = TAUT `(A /\ B ==> C) ==> (A ==> B ==> C)` in + let dummy_tm = `F` in + fun local_consts -> + let rec process th = + let ctm = concl th in + (* forall *) + if is_forall ctm then + let (var_tm, _) = dest_forall ctm in + let var = get_fresh_var var_tm (thm_frees th @ local_consts) in + let th1 = SPEC var th in + let list, th0 = process th1 in + ("spec", var) :: list, th0 + (* P ==> Q *) + else if is_imp ctm then + let ant_tm, _ = dest_imp ctm in + (* P /\ R ==> Q *) + if is_conj ant_tm then + let th1 = MATCH_MP conj_imp th in + let list, th0 = process th1 in + ("conj", dummy_tm) :: list, th0 + (* P ==> Q *) + else + let th1 = UNDISCH th in + let list, th0 = process th1 in + ("undisch", ant_tm) :: list, th0 + else + [], th in + process;; + + + +(* reconstruct_thm *) +let reconstruct_thm = + let imp_conj = TAUT `(A ==> B ==> C) ==> (A /\ B ==> C)` in + let triv_ths = TAUT `((T ==> A) <=> A) /\ ((T /\ A) = A) /\ ((A /\ T) = A)` in + let rec reconstruct list th = + match list with + | [] -> th + | cmd :: t -> + let th1 = + match cmd with + | ("spec", (_ as tm)) -> GEN tm th + | ("conj", _) -> MATCH_MP imp_conj th + | ("undisch", (_ as tm)) -> DISCH tm th + | _ -> failwith ("Unknown command: " ^ fst cmd) in + reconstruct t th1 in + + fun (cmd_list, th) -> + let th1 = reconstruct (rev cmd_list) th in + PURE_REWRITE_RULE[triv_ths] th1;; + + +(* spec_var_th *) +let spec_var_th th n tm = + let cmd, th0 = process_thm (frees tm) th in + let ty = type_of tm in + let rec spec n list head = + match list with + | ("spec", (_ as var_tm)) :: t -> + (try + let ty_ii = type_match (type_of var_tm) ty [] in + if n <= 1 then + let th1 = reconstruct_thm (list, th0) in + let th2 = ISPEC tm th1 in + let tail, th0 = process_thm [] th2 in + let head1 = map (fun s, tm -> s, inst ty_ii tm) head in + head1 @ tail, th0 + else + spec (n - 1) t (head @ [hd list]) + with Failure _ -> + spec n t (head @ [hd list])) + | h :: t -> spec n t (head @ [h]) + | [] -> failwith ("spec_var_th") in + reconstruct_thm (spec n cmd []);; + + +(* match_mp_th *) +let match_mp_th ith n th = + let lconsts = thm_frees ith in + let cmd, th0 = process_thm (thm_frees th) ith in + let tm = concl th in + let rec rec_match n list head = + match list with + | ("undisch", (_ as tm0)) :: t -> + (try + let ii = term_match lconsts tm0 tm in + if n <= 1 then + let th1 = INSTANTIATE_ALL ii th0 in + let th2 = PROVE_HYP th th1 in + let list0 = head @ (("undisch", `T`) :: t) in + let f_vars = frees tm0 in + let list1 = filter + (fun s, tm -> not (s = "spec" && mem tm f_vars)) list0 in + let list = map (fun s, tm -> s, instantiate ii tm) list1 in + list, th2 + else + rec_match (n - 1) t (head @ [hd list]) + with Failure _ -> + rec_match n t (head @ [hd list])) + | h :: t -> rec_match n t (head @ [h]) + | [] -> failwith "match_mp_th: no match" in + let r = rec_match n cmd [] in + reconstruct_thm r;; + +(* Introduces a subgoal *) +let have_gen_tac binders then_tac tm (g : goal) = +(* let tm0 = inst_all_free_vars tm g in *) + let tm1 = gen_variables binders tm in + let tm2 = prepare_term tm1 g in + (THENL_FIRST (SUBGOAL_THEN tm2 (fun th -> MP_TAC th THEN then_tac)) + (move binders)) g;; + + +let have_tac then_tac tm (g : goal) = +(* let tm0 = inst_all_free_vars tm g in *) + let tm0 = prepare_term tm g in + (SUBGOAL_THEN tm0 (fun th -> MP_TAC th THEN then_tac)) g;; + + + +(* 'wlog' tactic *) +let wlog_tac then_tac vars tm (g : goal) = +(* let tm0 = inst_all_free_vars tm g in *) + let tm0 = prepare_term tm g in + let vars0 = map (fun tm -> inst_all_free_vars tm g) vars in + let g_tm = snd g in + let imp = list_mk_forall (vars0, mk_imp (tm0, g_tm)) in + (THENL_ROT 1 (SUBGOAL_THEN imp (fun th -> MP_TAC th THEN then_tac) THENL + [REPLICATE_TAC (length vars) GEN_TAC; ALL_TAC])) g;; + + +(* Provides a witness for an existential goal *) +let exists_tac tm (g : goal) = + let tm0 = inst_all_free_vars tm g in + let target_ty = (type_of o fst o dest_exists o snd) g in + let inst_ty = type_match (type_of tm0) target_ty [] in + let tm1 = inst inst_ty tm0 in + (EXISTS_TAC tm1) g;; + +(* Instantiates the first type variable in the given theorem *) +let inst_first_type th ty = + let ty_vars = type_vars_in_term (concl th) in + if ty_vars = [] then + failwith "inst_first_type: no type variables in the theorem" + else + INST_TYPE [(ty, hd ty_vars)] th;; + + +(* The first argument must be a theorem, the second argument is arbitrary *) +let combine_args arg1 arg2 = + let th1 = get_arg_thm arg1 in + let th0 = + match arg2 with + | Arg_theorem th2 -> + (try MATCH_MP th1 th2 with Failure _ -> match_mp_th th1 1 th2) + | Arg_term tm2 -> + (try ISPEC tm2 th1 with Failure _ -> spec_var_th th1 1 tm2) + | Arg_type ty2 -> inst_first_type th1 ty2 in + Arg_theorem th0;; + + +let use_arg_then_result = ref TRUTH;; + +let use_arg_then id (arg_tac:arg_type->tactic) (g:goal) = + let list = fst g in + let arg = + try + let assumption = assoc id list in + Arg_theorem assumption + with Failure _ -> + try + let vars = get_context_vars g in + let var = assoc id vars in + Arg_term var + with Failure _ -> + let lexbuf = + Lexing.from_string ("use_arg_then_result := " ^ id ^ ";;") in + let ast = (!Toploop.parse_toplevel_phrase) lexbuf in + let _ = + try + Toploop.execute_phrase false Format.std_formatter ast + with _ -> failwith ("Bad identifier: " ^ id) in + Arg_theorem !use_arg_then_result in + arg_tac arg g;; + + +let combine_args_then (tac:arg_type->tactic) arg1 arg2 (g:goal) = + let th1 = get_arg_thm arg1 in + let th0 = + match arg2 with + | Arg_theorem th2 -> + (try MATCH_MP th1 th2 with Failure _ -> match_mp_th th1 1 th2) + | Arg_term tm2 -> + let tm0 = prepare_term tm2 g in + (try ISPEC tm0 th1 with Failure _ -> spec_var_th th1 1 tm0) + | Arg_type ty2 -> inst_first_type th1 ty2 in + tac (Arg_theorem th0) g;; + + + + +(* Specializes a variable and applies the next tactic *) +let ispec_then tm (tac : thm_tactic) th (g : goal) = + let tm0 = prepare_term tm g in + let th0 = try ISPEC tm0 th with Failure _ -> spec_var_th th 1 tm0 in + tac th0 g;; + + +let ISPEC_THEN tm (tac : thm_tactic) th (g : goal) = + let tm0 = inst_all_free_vars tm g in + tac (ISPEC tm0 th) g;; + + + +let USE_THM_THEN th (tac : thm_tactic) = + tac th;; + + +let MATCH_MP_THEN th2 (tac : thm_tactic) th1 = + tac (MATCH_MP th1 th2);; + +let match_mp_then th2 (tac : thm_tactic) th1 = + let th0 = try MATCH_MP th1 th2 with Failure _ -> match_mp_th th1 1 th2 in + tac th0;; + + +let GSYM_THEN (tac : thm -> tactic) th = + tac (GSYM th);; + + +let gsym_then (tac:arg_type->tactic) arg = + tac (Arg_theorem (GSYM (get_arg_thm arg)));; + + +(* The 'apply' tactic *) +let apply_tac th g = + let rec try_match th = + try MATCH_MP_TAC th g with Failure _ -> + let th0 = PURE_ONCE_REWRITE_RULE[IMP_IMP] th in + if th = th0 then failwith "apply_tac: no match" + else + try_match th0 in + + try MATCH_ACCEPT_TAC th g with Failure _ -> + try_match th;; + +(*let apply_tac th = + FIRST [MATCH_ACCEPT_TAC th; MATCH_MP_TAC th];; *) + + +(* The 'exact' tactic *) +(* TODO: do [done | by move => top; apply top], here apply top + works as ACCEPT_TAC with matching (rewriting) in some cases *) +let exact_tac = FIRST [done_tac; DISCH_THEN (fun th -> apply_tac th) THEN done_tac];; + + + +(* Specializes the theorem using the given set of variables *) +let spec0 names vars = + let find name = + try (assoc name vars, true) + with Failure _ -> (parse_term name, false) in + let find_type var = + let name, ty = dest_var var in + let t, flag = find name in + if flag then + (ty, type_of t) + else + (`:bool`, `:bool`) in + let inst_term tm = + let ty_src, ty_dst = unzip (map find_type (frees tm)) in + let ty_inst = itlist2 type_match ty_src ty_dst [] in + inst ty_inst tm in + let list = map find names in + let tm_list = map (fun tm, flag -> if flag then tm else inst_term tm) list in + ISPECL tm_list;; + + +let spec names = spec0 names (get_context_vars (top_realgoal()));; + + +let spec_mp names th g = MP_TAC (spec0 names (get_context_vars g) th) g;; + + +(* Case theorems *) +let bool_cases = ONCE_REWRITE_RULE[CONJ_ACI] bool_INDUCT;; +let list_cases = prove(`!P. P [] /\ (!(h:A) t. P (CONS h t)) ==> (!l. P l)`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC `l:(A)list` list_CASES) THEN DISCH_THEN DISJ_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (CHOOSE_THEN MP_TAC) THEN DISCH_THEN (CHOOSE_THEN MP_TAC) THEN + DISCH_THEN (fun th -> ASM_REWRITE_TAC[th]));; +let pair_cases = pair_INDUCT;; +let num_cases = prove(`!P. P 0 /\ (!n. P (SUC n)) ==> (!m. P m)`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC `m:num` num_CASES) THEN DISCH_THEN DISJ_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (CHOOSE_THEN (fun th -> ASM_REWRITE_TAC[th])));; +let option_cases = option_INDUCT;; + + +let cases_table = Hashtbl.create 10;; +Hashtbl.add cases_table "bool" bool_cases;; +Hashtbl.add cases_table "list" list_cases;; +Hashtbl.add cases_table "prod" pair_cases;; +Hashtbl.add cases_table "num" num_cases;; +Hashtbl.add cases_table "option" option_cases;; + + +(* Induction theorems *) +let bool_elim = bool_cases;; +let list_elim = list_INDUCT;; +let pair_elim = pair_INDUCT;; +let num_elim = num_INDUCTION;; +let option_elim = option_INDUCT;; + +let elim_table = Hashtbl.create 10;; +Hashtbl.add elim_table "bool" bool_elim;; +Hashtbl.add elim_table "list" list_elim;; +Hashtbl.add elim_table "prod" pair_elim;; +Hashtbl.add elim_table "num" num_elim;; +Hashtbl.add elim_table "option" option_elim;; + + + +(* case: works only for (A /\ B) -> C; (A \/ B) -> C; (?x. P) -> Q; !(n:num). P; !(l:list(A)). P *) +let case (g:goal) = + let goal_tm = snd g in + if not (is_imp goal_tm) then + (* !a. P *) + if is_forall goal_tm then + let var, _ = dest_forall goal_tm in + let ty_name = (fst o dest_type o type_of) var in + let case_th = Hashtbl.find cases_table ty_name in + (MATCH_MP_TAC case_th THEN REPEAT CONJ_TAC) g + else + failwith "case: not imp or forall" + else + let tm = lhand goal_tm in + (* A /\ B *) + if is_conj tm then + (DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN POP_ASSUM MP_TAC) g + (* A \/ B *) + else if is_disj tm then + (DISCH_THEN DISJ_CASES_TAC THEN POP_ASSUM MP_TAC) g + (* ?x. P *) + else if is_exists tm then + (ONCE_REWRITE_TAC[GSYM LEFT_FORALL_IMP_THM]) g + else + failwith "case: not implemented";; + + + +(* elim: works only for num and list *) +let elim (g:goal) = + let goal_tm = snd g in + (* !a. P *) + if is_forall goal_tm then + let var, _ = dest_forall goal_tm in + let ty_name = (fst o dest_type o type_of) var in + let induct_th = Hashtbl.find elim_table ty_name in + (MATCH_MP_TAC induct_th THEN REPEAT CONJ_TAC) g + else + failwith "elim: not forall";; + + + +(* Instantiates the first type variable in the given theorem *) +let INST_FIRST_TYPE_THEN ty (then_tac:thm_tactic) th = + let ty_vars = type_vars_in_term (concl th) in + if ty_vars = [] then + failwith "inst_first_type: no type variables in the theorem" + else + then_tac (INST_TYPE [(ty, hd ty_vars)] th);; + + +(* Replaces all occurrences of distinct '_' with unique variables *) +let transform_pattern pat_tm = + let names = ref (map (fst o dest_var) (frees pat_tm)) in + let rec transform tm = + match tm with + | Abs(x_tm, b_tm) -> + let _ = names := (fst o dest_var) x_tm :: !names in + mk_abs (x_tm, transform b_tm) + | Comb(l_tm, r_tm) -> + mk_comb (transform l_tm, transform r_tm) + | Var ("_", ty) -> + let name = generate_fresh_name !names tm in + let _ = names := name :: !names in + mk_var (name, ty) + | _ -> tm in + transform pat_tm;; + + +let wild_frees tm = + filter (fun tm -> ((fst o dest_var) tm).[0] = '_') (frees tm);; + +let nwild_frees tm = + filter (fun tm -> ((fst o dest_var) tm).[0] <> '_') (frees tm);; + + +(* congr_tac *) +let congr_tac pat_tm goal = + let goal_tm = snd goal in + let context_vars = get_context_vars goal in + let pat = transform_pattern pat_tm in + let f0_vars = nwild_frees pat in + let pattern = inst_context_vars context_vars f0_vars pat in + let const_pat = nwild_frees pattern in + let wild_pat = wild_frees pattern in + + let lhs, rhs = dest_eq goal_tm in + let lm, rm = + term_match const_pat pattern lhs, term_match const_pat pattern rhs in + let eq_tms = map + (fun tm -> mk_eq (instantiate lm tm, instantiate rm tm)) wild_pat in + let eq_tm = itlist (curry mk_imp) eq_tms goal_tm in + let eq_thm = EQT_ELIM (SIMP_CONV[] eq_tm) in + (apply_tac eq_thm THEN REPEAT CONJ_TAC) goal;; + + +(* Eliminates the first antecedent of a goal *) +let elim_fst_ants_tac = + let gen_elim_thm tm = + let vars, tm1 = strip_forall tm in + let ants_tm, concl_tm = dest_imp tm1 in + let th1 = ASSUME (itlist (curry mk_forall) vars concl_tm) in + let th2 = DISCH ants_tm (SPECL vars th1) in + DISCH_ALL (itlist GEN vars th2) in + fun (g:goal) -> + let goal_tm = snd g in + let elim_th = gen_elim_thm goal_tm in + MATCH_MP_TAC elim_th g;; + + +(* If a goal has the form ssreflect_eq ==> P then the equality is introduced as + an assumption. + If a goal has the form !x. ssreflect_eq ==> P then the equality is eliminated *) +let process_fst_eq_tac (g:goal) = + let vars, g_tm = strip_forall (snd g) in + let tac = + try + let eq_tm = (rator o fst o dest_imp) g_tm in + let label = (fst o dest_var o rand) eq_tm in + if (fst o dest_const o rator) eq_tm = "ssreflect_eq" then + if length vars = 0 then + DISCH_THEN (LABEL_TAC label o PURE_ONCE_REWRITE_RULE[ssreflect_eq_def]) + else + elim_fst_ants_tac + else + ALL_TAC + with Failure _ -> ALL_TAC in + tac g;; + + +(* Discharges a term by generalizing all occurences of this term first *) +let disch_tm_eq_tac eq_name occs tm (g : goal) = + let tm0 = prepare_term tm g in + let name = generate_fresh_name ((fst o unzip) (get_context_vars g)) tm in + let eq_var = mk_var (eq_name, aty) in + let new_tm = mk_var (name, type_of tm0) in + let abbrev_tm = mk_eq (new_tm, tm0) in + (ABBREV_TAC abbrev_tm THEN + EXPAND_TAC name THEN + FIRST_ASSUM (fun th -> TRY (new_rewrite occs [] th)) THEN + POP_ASSUM (MP_TAC o PURE_ONCE_REWRITE_RULE[GSYM (SPEC eq_var ssreflect_eq_def)]) THEN + SPEC_TAC (new_tm, new_tm)) g;; + + +(* Discharges a term and generates an equality *) +let disch_eq_tac eq_name occs arg = + disch_tm_eq_tac eq_name occs (get_arg_term arg);; diff --git a/formal_ineqs/lib/ssrfun-compiled.hl b/formal_ineqs/lib/ssrfun-compiled.hl new file mode 100644 index 0000000..2fbd1d0 --- /dev/null +++ b/formal_ineqs/lib/ssrfun-compiled.hl @@ -0,0 +1,304 @@ +let oapp = define `!f x y. oapp f x (SOME y) = f y /\ oapp f x NONE = x`;; +let odflt = new_definition `odflt = oapp I`;; +let obind = new_definition `obind f = oapp f NONE`;; +let omap = new_definition `omap f = obind (\x. SOME (f x))`;; +let pcomp = new_definition `pcomp f g x = obind f (g x)`;; + +(* Lemma odflt_alt *) +let odflt_alt = section_proof ["x"] `(!y. odflt x (SOME y) = y) /\ odflt x NONE = x` [ + (((((use_arg_then "odflt")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "oapp")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "I_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma obind_alt *) +let obind_alt = section_proof ["f"] `obind f NONE = NONE /\ (!x. obind f (SOME x) = f x)` [ + (((((use_arg_then "obind")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "oapp")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma omap_alt *) +let omap_alt = section_proof ["f"] `omap f NONE = NONE /\ (!x. omap f (SOME x) = SOME (f x))` [ + (((((use_arg_then "omap")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "obind")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "oapp")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma eq_sym *) +let eq_sym = section_proof ["x";"y"] `x = y ==> y = x` [ + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eq_trans *) +let eq_trans = section_proof ["x";"y";"z"] `x = y ==> y = z ==> x = z` [ + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma f_equal *) +let f_equal = section_proof ["f";"x";"y"] `x = y ==> f x = f y` [ + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma f_equal2 *) +let f_equal2 = section_proof ["f";"x1";"y1";"x2";"y2"] `x1 = y1 ==> x2 = y2 ==> f x1 x2 = f y1 y2` [ + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +let erefl = eq_sym;; +let esym = eq_sym;; +let etrans = eq_trans;; +let congr1 = f_equal;; +let congr2 = f_equal2;; + +(* Lemma eq_ext *) +let eq_ext = section_proof ["f";"g"] `(!x. f x = g x) <=> f = g` [ + (((THENL) (split_tac) [(DISCH_THEN (fun snd_th -> (use_arg_then "EQ_EXT") (thm_tac (match_mp_then snd_th MP_TAC)))); (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))]) THEN (done_tac)); +];; + +(* Section Injections *) +begin_section "Injections";; +(add_section_var (mk_var ("f", (`:A -> R`))));; +let injective = new_definition `injective f <=> (!x1 x2. f x1 = f x2 ==> x1 = x2)`;; +let cancel = new_definition `cancel f g <=> !x. g (f x) = x`;; +let pcancel = new_definition `pcancel f g <=> !x. g (f x) = SOME x`;; +let ocancel = new_definition `ocancel g h <=> !x. oapp h x (g x) = x`;; + +(* Lemma can_pcan *) +let can_pcan = section_proof ["g"] `cancel f g ==> pcancel f (\y. SOME (g y))` [ + (((((use_arg_then "cancel")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "pcancel")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma pcan_inj *) +let pcan_inj = section_proof ["g"] `pcancel f g ==> injective f` [ + (((((use_arg_then "pcancel")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "injective")(thm_tac (new_rewrite [] []))))) THEN (move ["can"]) THEN (move ["x1"]) THEN (move ["x2"]) THEN (move ["f_eq"])); + ((((fun arg_tac -> (use_arg_then "can") (fun fst_arg -> (use_arg_then "x2") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then "can") (fun fst_arg -> (use_arg_then "x1") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then "f_eq")(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (injectivity "option")))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma can_inj *) +let can_inj = section_proof ["g"] `cancel f g ==> injective f` [ + (((((use_arg_then "cancel")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "injective")(thm_tac (new_rewrite [] []))))) THEN (move ["can"]) THEN (move ["x1"]) THEN (move ["x2"]) THEN (move ["f_eq"])); + (((((fun arg_tac -> (use_arg_then "can") (fun fst_arg -> (use_arg_then "x1") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then "can") (fun fst_arg -> (use_arg_then "x2") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "f_eq")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma canLR *) +let canLR = section_proof ["g";"x";"y"] `cancel f g ==> x = f y ==> g x = y` [ + (((((use_arg_then "cancel")(thm_tac (new_rewrite [] [])))) THEN (move ["can"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma canRL *) +let canRL = section_proof ["g";"x";"y"] `cancel f g ==> f x = y ==> x = g y` [ + (((((use_arg_then "cancel")(thm_tac (new_rewrite [] [])))) THEN (move ["can"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section Injections *) +let can_pcan = finalize_theorem can_pcan;; +let pcan_inj = finalize_theorem pcan_inj;; +let can_inj = finalize_theorem can_inj;; +let canLR = finalize_theorem canLR;; +let canRL = finalize_theorem canRL;; +end_section "Injections";; + +(* Lemma some_inj *) +let some_inj = section_proof [] `injective SOME` [ + (((((use_arg_then "injective")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (injectivity "option")))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section InjectionsTheory *) +begin_section "InjectionsTheory";; +(add_section_var (mk_var ("f", (`:B -> A`))); add_section_var (mk_var ("g", (`:B -> A`))));; +(add_section_var (mk_var ("h", (`:C -> B`))));; + +(* Lemma inj_id *) +let inj_id = section_proof [] `injective I` [ + (((((use_arg_then "injective")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "I_THM")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma inj_can_sym *) +let inj_can_sym = section_proof ["f'"] `cancel f f' ==> injective f' ==> cancel f' f` [ + (((repeat_tactic 2 0 (((use_arg_then "cancel")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "injective")(thm_tac (new_rewrite [] []))))) THEN (move ["can1"]) THEN (move ["inj"]) THEN (move ["x"])); + ((((use_arg_then "inj") (disch_tac [])) THEN (clear_assumption "inj") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "can1")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma inj_comp *) +let inj_comp = section_proof [] `injective f ==> injective h ==> injective (f o h)` [ + (((repeat_tactic 3 0 (((use_arg_then "injective")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 2 0 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))))) THEN (move ["inj_f"]) THEN (move ["inj_h"]) THEN (move ["x1"]) THEN (move ["x2"])); + ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then "inj_f") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "inj_h") (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Lemma can_comp *) +let can_comp = section_proof ["f'";"h'"] `cancel f f' ==> cancel h h' ==> cancel (f o h) (h' o f')` [ + ((((repeat_tactic 3 0 (((use_arg_then "cancel")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 2 0 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))))) THEN (move ["f_can"]) THEN (move ["h_can"]) THEN (move ["x"])) THEN (done_tac)); +];; + +(* Lemma pcan_pcomp *) +let pcan_pcomp = section_proof ["f'";"h'"] `pcancel f f' ==> pcancel h h' ==> pcancel (f o h) (pcomp h' f')` [ + ((((repeat_tactic 3 0 (((use_arg_then "pcancel")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "pcomp")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then "obind")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "oapp")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eq_inj *) +let eq_inj = section_proof [] `injective f ==> (!x. f x = g x) ==> injective g` [ + (((((use_arg_then "eq_ext")(thm_tac (new_rewrite [] [])))) THEN (move ["inj"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma eq_can *) +let eq_can = section_proof ["f'";"g'"] `cancel f f' ==> (!x. f x = g x) ==> (!x. f' x = g' x) ==> cancel g g'` [ + (((repeat_tactic 1 9 (((use_arg_then "eq_ext")(thm_tac (new_rewrite [] []))))) THEN (move ["can"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma inj_can_eq *) +let inj_can_eq = section_proof ["f'"] `cancel f f' ==> injective f' ==> cancel g f' ==> f = g` [ + ((((repeat_tactic 2 0 (((use_arg_then "cancel")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "injective")(thm_tac (new_rewrite [] []))))) THEN (move ["f_can"]) THEN (move ["inj"]) THEN (move ["g_can"])) THEN ((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["x"]))); + ((((use_arg_then "inj") (disch_tac [])) THEN (clear_assumption "inj") THEN (DISCH_THEN apply_tac)) THEN (done_tac)); +];; + +(* Finalization of the section InjectionsTheory *) +let inj_id = finalize_theorem inj_id;; +let inj_can_sym = finalize_theorem inj_can_sym;; +let inj_comp = finalize_theorem inj_comp;; +let can_comp = finalize_theorem can_comp;; +let pcan_pcomp = finalize_theorem pcan_pcomp;; +let eq_inj = finalize_theorem eq_inj;; +let eq_can = finalize_theorem eq_can;; +let inj_can_eq = finalize_theorem inj_can_eq;; +end_section "InjectionsTheory";; + +(* Section Bijections *) +begin_section "Bijections";; +(add_section_var (mk_var ("f", (`:B -> A`))));; +let bijective = new_definition `bijective f <=> ?g. cancel f g /\ cancel g f`;; +(add_section_hyp "bijf" (`bijective f`));; + +(* Lemma bij_inj *) +let bij_inj = section_proof [] `injective f` [ + ((((use_arg_then "bijf") (disch_tac [])) THEN (clear_assumption "bijf") THEN BETA_TAC) THEN ((((use_arg_then "bijective")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["g"])) THEN (case THEN ((DISCH_THEN (fun snd_th -> (use_arg_then "can_inj") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac)); +];; + +(* Lemma bij_can_sym *) +let bij_can_sym = section_proof ["f'"] `cancel f' f <=> cancel f f'` [ + ((THENL_FIRST) (split_tac) (((DISCH_THEN (fun snd_th -> (use_arg_then "inj_can_sym") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "bij_inj") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN (done_tac))); + ((((use_arg_then "bijf") (disch_tac [])) THEN (clear_assumption "bijf") THEN BETA_TAC) THEN ((((use_arg_then "bijective")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["g"])) THEN (case THEN ALL_TAC)) THEN ((repeat_tactic 1 9 (((use_arg_then "cancel")(thm_tac (new_rewrite [] []))))) THEN (move ["gf"]) THEN (move ["fg"]) THEN (move ["f'f"]) THEN (move ["x"]))); + (((((fun arg_tac -> (use_arg_then "fg") (fun fst_arg -> (use_arg_then "x") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "f'f")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma bij_can_eq *) +let bij_can_eq = section_proof ["f'";"f''"] `cancel f f' ==> cancel f f'' ==> f' = f''` [ + (((((fun arg_tac -> (use_arg_then "bij_can_sym") (fun fst_arg -> (use_arg_then "f''") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "bij_can_sym")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["can1"]) THEN (move ["can2"])); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "inj_can_eq") (fun fst_arg -> (use_arg_then "can1") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "bij_inj") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "can2") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (done_tac)); +];; + +(* Finalization of the section Bijections *) +let bij_inj = finalize_theorem bij_inj;; +let bij_can_sym = finalize_theorem bij_can_sym;; +let bij_can_eq = finalize_theorem bij_can_eq;; +end_section "Bijections";; + +(* Section BijectionsTheory *) +begin_section "BijectionsTheory";; +(add_section_var (mk_var ("f", (`:BB -> AA`))));; +(add_section_var (mk_var ("h", (`:CC -> BB`))));; + +(* Lemma eq_bij *) +let eq_bij = section_proof [] `bijective f ==> !g. (!x. f x = g x) ==> bijective g` [ + (((((use_arg_then "eq_ext")(thm_tac (new_rewrite [] [])))) THEN (move ["bij"]) THEN (move ["g"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma bij_comp *) +let bij_comp = section_proof [] `bijective f ==> bijective h ==> bijective (f o h)` [ + ((repeat_tactic 3 0 (((use_arg_then "bijective")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["g"])) THEN (case THEN ((move ["can_fg"]) THEN (move ["can_gf"]))) THEN (case THEN ((move ["r"]) THEN (case THEN ((move ["can_hr"]) THEN (move ["can_rh"])))))); + (((fun arg_tac -> arg_tac (Arg_term (`r o g`))) (term_tac exists_tac)) THEN (split_tac)); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "can_comp") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "h") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "g") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "r") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "can_fg") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC) THEN (DISCH_THEN apply_tac) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "can_comp") (fun fst_arg -> (use_arg_then "r") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "g") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "h") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "can_rh") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC) THEN (DISCH_THEN apply_tac) THEN (done_tac)); +];; + +(* Lemma bij_can_bij *) +let bij_can_bij = section_proof [] `bijective f ==> !f'. cancel f f' ==> bijective f'` [ + (((DISCH_THEN (fun snd_th -> (use_arg_then "bij_can_sym") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["can_sym"]) THEN (move ["f'"]) THEN (move ["can_ff'"])) THEN (((use_arg_then "bijective")(thm_tac (new_rewrite [] []))))); + (((use_arg_then "f") (term_tac exists_tac)) THEN (((use_arg_then "can_sym")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section BijectionsTheory *) +let eq_bij = finalize_theorem eq_bij;; +let bij_comp = finalize_theorem bij_comp;; +let bij_can_bij = finalize_theorem bij_can_bij;; +end_section "BijectionsTheory";; + +(* Section Involutions *) +begin_section "Involutions";; +(add_section_var (mk_var ("f", (`:A -> A`))));; +let involutive = new_definition `involutive f <=> cancel f f`;; +(add_section_hyp "Hf" (`involutive f`));; + +(* Lemma inv_inj *) +let inv_inj = section_proof [] `injective f` [ + ((((use_arg_then "Hf") (disch_tac [])) THEN (clear_assumption "Hf") THEN BETA_TAC) THEN ((((use_arg_then "involutive")(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "can_inj") (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Lemma inv_bij *) +let inv_bij = section_proof [] `bijective f` [ + ((((use_arg_then "bijective")(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then "f") (term_tac exists_tac)) THEN (((use_arg_then "Hf") (disch_tac [])) THEN (clear_assumption "Hf") THEN BETA_TAC) THEN (((use_arg_then "involutive")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section Involutions *) +let inv_inj = finalize_theorem inv_inj;; +let inv_bij = finalize_theorem inv_bij;; +end_section "Involutions";; + +(* Section OperationProperties *) +begin_section "OperationProperties";; + +(* Section SopTisR *) +begin_section "SopTisR";; +let left_inverse = new_definition `left_inverse e inv op = !x. op (inv x) x = e`;; +let right_inverse = new_definition `right_inverse e inv op = !x. op x (inv x) = e`;; +let left_injective = new_definition `left_injective op = !x. injective (\y. op y x)`;; +let right_injective = new_definition `right_injective op = !y. injective (op y)`;; + +(* Finalization of the section SopTisR *) +end_section "SopTisR";; + +(* Section SopTisS *) +begin_section "SopTisS";; +let right_id = new_definition `right_id e op = !x. op x e = x`;; +let left_zero = new_definition `left_zero z op = !x. op z x = z`;; +let right_commutative = new_definition + `right_commutative op = !x y z. op (op x y) z = op (op x z) y`;; +let left_distributive = new_definition + `left_distributive op add = !x y z. op (add x y) z = add (op x z) (op y z)`;; +let right_loop = new_definition + `right_loop inv op = !y. cancel (\x. op x y) (\x. op x (inv y))`;; +let rev_right_loop = new_definition + `rev_right_loop inv op = !y. cancel (\x. op x (inv y)) (\x. op x y)`;; + +(* Finalization of the section SopTisS *) +end_section "SopTisS";; + +(* Section SopTisT *) +begin_section "SopTisT";; +let left_id = new_definition `left_id e op = !x. op e x = x`;; +let right_zero = new_definition `right_zero z op = !x. op x z = z`;; +let left_commutative = new_definition + `left_commutative op = !x y z. op x (op y z) = op y (op x z)`;; +let right_distributive = new_definition + `right_distributive op add = !x y z. op x (add y z) = add (op x y) (op x z)`;; +let left_loop = new_definition + `left_loop inv op = !x. cancel (op x) (op (inv x))`;; +let rev_left_loop = new_definition + `rev_left_loop inv op = !x. cancel (op (inv x)) (op x)`;; + +(* Finalization of the section SopTisT *) +end_section "SopTisT";; + +(* Section SopSisT *) +begin_section "SopSisT";; +let self_inverse = new_definition `self_inverse e op = !x. op x x = e`;; +let commutative = new_definition `commutative op = !x y. op x y = op y x`;; + +(* Finalization of the section SopSisT *) +end_section "SopSisT";; + +(* Section SopSisS *) +begin_section "SopSisS";; +let idempotent = new_definition `idempotent op = !x. op x x = x`;; +let associative = new_definition `associative op = !x y z. op x (op y z) = op (op x y) z`;; + +(* Finalization of the section SopSisS *) +end_section "SopSisS";; + +(* Finalization of the section OperationProperties *) +end_section "OperationProperties";; diff --git a/formal_ineqs/lib/ssrnat-compiled.hl b/formal_ineqs/lib/ssrnat-compiled.hl new file mode 100644 index 0000000..3839b5c --- /dev/null +++ b/formal_ineqs/lib/ssrnat-compiled.hl @@ -0,0 +1,1634 @@ +needs "lib/ssrbool-compiled.hl";; +prioritize_num();; + +(* Lemma succnK *) +let succnK = section_proof ["n"] `SUC n - 1 = n` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma succn_inj *) +let succn_inj = section_proof ["n";"m"] `SUC n = SUC m ==> n = m` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma eqSS *) +let eqSS = section_proof ["m";"n"] `(SUC m = SUC n) = (m = n)` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma add0n *) +let add0n = section_proof ["n"] `0 + n = n` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma addSn *) +let addSn = section_proof ["m";"n"] `SUC m + n = SUC (m + n)` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma add1n *) +let add1n = section_proof ["n"] `1 + n = SUC n` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma addn0 *) +let addn0 = section_proof ["n"] `n + 0 = n` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma addnS *) +let addnS = section_proof ["m";"n"] `m + SUC n = SUC (m + n)` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma addSnnS *) +let addSnnS = section_proof ["m";"n"] `SUC m + n = m + SUC n` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma addnCA *) +let addnCA = section_proof ["m";"n";"p"] `m + (n + p) = n + (m + p)` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma addnC *) +let addnC = section_proof ["m";"n"] `m + n = n + m` [ + (((((fun arg_tac -> (use_arg_then "addn0") (fun fst_arg -> (use_arg_then "n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then "addnCA")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addn0")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma addn1 *) +let addn1 = section_proof ["n"] `n + 1 = SUC n` [ + (((((use_arg_then "addnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "add1n")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma addnA *) +let addnA = section_proof ["n";"m";"p"] `n + (m + p) = (n + m) + p` [ + (((((use_arg_then "addnC")(thm_tac (new_rewrite [] [(`m + p`)])))) THEN (((use_arg_then "addnCA")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addnC")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma addnAC *) +let addnAC = section_proof ["m";"n";"p"] `(n + m) + p = (n + p) + m` [ + (((repeat_tactic 1 9 (((use_arg_then "addnA")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "addnC")(thm_tac (new_rewrite [] [(`p + m`)]))))) THEN (done_tac)); +];; + +(* Lemma addn_eq0 *) +let addn_eq0 = section_proof ["m";"n"] `(m + n = 0) <=> (m = 0) /\ (n = 0)` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma eqn_addl *) +let eqn_addl = section_proof ["p";"m";"n"] `(p + m = p + n) <=> (m = n)` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma eqn_addr *) +let eqn_addr = section_proof ["p";"m";"n"] `(m + p = n + p) = (m = n)` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma addnI *) +let addnI = section_proof ["m";"n1";"n2"] `m + n1 = m + n2 ==> n1 = n2` [ + ((BETA_TAC THEN (move ["Heq"])) THEN (((fun arg_tac -> (use_arg_then "eqn_addl") (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma addIn *) +let addIn = section_proof ["m";"n1";"n2"] `n1 + m = n2 + m ==> n1 = n2` [ + ((repeat_tactic 1 9 (((use_arg_then "addnC")(gsym_then (thm_tac (new_rewrite [] [(`_1 + m`)])))))) THEN (move ["Heq"])); + ((((fun arg_tac -> (use_arg_then "addnI") (fun fst_arg -> (use_arg_then "Heq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (done_tac)); +];; + +(* Lemma sub0n *) +let sub0n = section_proof ["n"] `0 - n = 0` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma subn0 *) +let subn0 = section_proof ["n"] `n - 0 = n` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma subnn *) +let subnn = section_proof [] `!n. n - n = 0` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma subSS *) +let subSS = section_proof [] `!n m. SUC m - SUC n = m - n` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma subn_add2l *) +let subn_add2l = section_proof [] `!p m n. (p + m) - (p + n) = m - n` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma subn_add2r *) +let subn_add2r = section_proof [] `!p m n. (m + p) - (n + p) = m - n` [ + (BETA_TAC THEN (move ["p"]) THEN (move ["m"]) THEN (move ["n"])); + (((repeat_tactic 1 9 (((use_arg_then "addnC")(gsym_then (thm_tac (new_rewrite [] [(`_1 + p`)])))))) THEN (((use_arg_then "subn_add2l")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma addKn *) +let addKn = section_proof ["n"] `!x. (n + x) - n = x` [ + ((BETA_TAC THEN (move ["m"])) THEN ((((use_arg_then "addn0")(gsym_then (thm_tac (new_rewrite [2] [(`n`)]))))) THEN (((use_arg_then "subn_add2l")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "subn0")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma addnK *) +let addnK = section_proof [] `!n x. (x + n) - n = x` [ + ((BETA_TAC THEN (move ["n"]) THEN (move ["m"])) THEN ((((fun arg_tac -> (use_arg_then "addnC") (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addKn")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma subSnn *) +let subSnn = section_proof ["n"] `SUC n - n = 1` [ + (((((use_arg_then "add1n")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "addnK")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma subn_sub *) +let subn_sub = section_proof ["m";"n";"p"] `(n - m) - p = n - (m + p)` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma subnAC *) +let subnAC = section_proof [] `!m n p. (m - n) - p = (m - p) - n` [ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["p"])) THEN ((repeat_tactic 1 9 (((use_arg_then "subn_sub")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "addnC")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma predn_sub *) +let predn_sub = section_proof [] `!m n. (m - n) - 1 = m - SUC n` [ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n"])) THEN ((((use_arg_then "subn_sub")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addn1")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma predn_subS *) +let predn_subS = section_proof [] `!m n. (SUC m - n) - 1 = m - n` [ + (((((use_arg_then "predn_sub")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "subSS")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltnS *) +let ltnS = section_proof [] `!m n. (m < SUC n) = (m <= n)` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma leq0n *) +let leq0n = section_proof [] `!n. 0 <= n` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma ltn0Sn *) +let ltn0Sn = section_proof [] `!n. 0 < SUC n` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma ltn0 *) +let ltn0 = section_proof [] `!n. n < 0 <=> F` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma leqnn *) +let leqnn = section_proof [] `!n. n <= n` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma ltnSn *) +let ltnSn = section_proof [] `!n. n < SUC n` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma eq_leq *) +let eq_leq = section_proof [] `!m n. m = n ==> m <= n` [ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leqnn")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma leqnSn *) +let leqnSn = section_proof [] `!n. n <= SUC n` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma leq_pred *) +let leq_pred = section_proof [] `!n. n - 1 <= n` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma leqSpred *) +let leqSpred = section_proof [] `!n. n <= SUC (n - 1)` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma ltn_predK *) +let ltn_predK = section_proof [] `!m n. m < n ==> SUC (n - 1) = n` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma prednK *) +let prednK = section_proof [] `!n. 0 < n ==> SUC (n - 1) = n` [ + ((BETA_TAC THEN (move ["n"]) THEN (move ["H"])) THEN (((fun arg_tac -> (use_arg_then "ltn_predK") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac))); +];; + +(* Lemma leqNgt *) +let leqNgt = section_proof [] `!m n. (m <= n) <=> ~(n < m)` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma ltnNge *) +let ltnNge = section_proof [] `!m n. (m < n) = ~(n <= m)` [ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n"])) THEN (((use_arg_then "leqNgt")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma ltnn *) +let ltnn = section_proof [] `!n. n < n <=> F` [ + ((BETA_TAC THEN (move ["n"])) THEN ((((use_arg_then "ltnNge")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leqnn")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leqn0 *) +let leqn0 = section_proof [] `!n. (n <= 0) = (n = 0)` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma lt0n *) +let lt0n = section_proof [] `!n. (0 < n) = ~(n = 0)` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma lt0n_neq0 *) +let lt0n_neq0 = section_proof [] `!n. 0 < n ==> ~(n = 0)` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma eqn0Ngt *) +let eqn0Ngt = section_proof [] `!n. (n = 0) = ~(0 < n)` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma neq0_lt0n *) +let neq0_lt0n = section_proof [] `!n. (n = 0) = F ==> 0 < n` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma eqn_leq *) +let eqn_leq = section_proof [] `!m n. (m = n) = (m <= n /\ n <= m)` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma anti_leq *) +let anti_leq = section_proof [] `!m n. m <= n /\ n <= m ==> m = n` [ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n"])) THEN (((use_arg_then "eqn_leq")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma neq_ltn *) +let neq_ltn = section_proof [] `!m n. ~(m = n) <=> (m < n) \/ (n < m)` [ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"])); + (((((use_arg_then "eqn_leq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "negb_and")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "orbC")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "ltnNge")(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); +];; + +(* Lemma leq_eqVlt *) +let leq_eqVlt = section_proof ["m";"n"] `(m <= n) <=> (m = n) \/ (m < n)` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma eq_sym *) +let eq_sym = section_proof [] `!x y:A. x = y <=> y = x` [ + ((((use_arg_then "EQ_SYM_EQ") (disch_tac [])) THEN (clear_assumption "EQ_SYM_EQ") THEN BETA_TAC) THEN (done_tac)); +];; + +(* Lemma ltn_neqAle *) +let ltn_neqAle = section_proof [] `!m n. (m < n) <=> ~(m = n) /\ (m <= n)` [ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"])); + (((((use_arg_then "ltnNge")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leq_eqVlt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "negb_or")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leqNgt")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "eq_sym")(thm_tac (new_rewrite [] [(`n = m`)]))))) THEN (done_tac)); +];; + +(* Lemma leq_trans *) +let leq_trans = section_proof [] `!n m p. m <= n ==> n <= p ==> m <= p` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma ltE *) +let ltE = section_proof [] `!n m. n < m <=> SUC n <= m` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma leqSS *) +let leqSS = section_proof [] `!n m. SUC n <= SUC m <=> n <= m` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma leq_ltn_trans *) +let leq_ltn_trans = section_proof [] `!n m p. m <= n ==> n < p ==> m < p` [ + (BETA_TAC THEN (move ["n"]) THEN (move ["m"]) THEN (move ["p"]) THEN (move ["Hmn"])); + (((repeat_tactic 1 9 (((use_arg_then "ltE")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leq_trans") (disch_tac [])) THEN (clear_assumption "leq_trans") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "leqSS")(thm_tac (new_rewrite [] [])))) THEN (done_tac)) THEN (done_tac)); +];; + +(* Lemma ltn_leq_trans *) +let ltn_leq_trans = section_proof ["n";"m";"p"] `m < n ==> n <= p ==> m < p` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma ltnW *) +let ltnW = section_proof [] `!m n. m < n ==> m <= n` [ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n"])) THEN (((use_arg_then "ltE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leq_trans") (disch_tac [])) THEN (clear_assumption "leq_trans") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "leqnSn")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma leqW *) +let leqW = section_proof [] `!m n. m <= n ==> m <= SUC n` [ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["le_mn"])) THEN (((use_arg_then "ltnW") (disch_tac [])) THEN (clear_assumption "ltnW") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then "ltE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leqSS")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltn_trans *) +let ltn_trans = section_proof [] `!n m p. m < n ==> n < p ==> m < p` [ + (BETA_TAC THEN (move ["n"]) THEN (move ["m"]) THEN (move ["p"]) THEN (move ["lt_mn"])); + (((DISCH_THEN (fun snd_th -> (use_arg_then "ltnW") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then "ltE")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "leq_trans") (disch_tac [])) THEN (clear_assumption "leq_trans") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "ltE")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma geqE *) +let geqE = section_proof [] `!m n. m >= n <=> n <= m` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma gtE *) +let gtE = section_proof ["m";"n"] `m > n <=> n < m` [ + (arith_tac); +];; + +(* Lemma leq_total *) +let leq_total = section_proof ["m";"n"] `(m <= n) \/ (n <= m)` [ + ((((((use_arg_then "implyNb")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ltnNge")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["lt_nm"])) THEN (((use_arg_then "ltnW") (disch_tac [])) THEN (clear_assumption "ltnW") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma leqP *) +let leqP = section_proof ["m";"n"] `m <= n \/ n < m` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma ltnP *) +let ltnP = section_proof ["m";"n"] `m < n \/ n <= m` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma posnP *) +let posnP = section_proof ["n"] `n = 0 \/ 0 < n` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma ltngtP *) +let ltngtP = section_proof ["m";"n"] `m < n \/ n < m \/ m = n` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma leq_add2l *) +let leq_add2l = section_proof [] `!p m n. (p + m <= p + n) = (m <= n)` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma ltn_add2l *) +let ltn_add2l = section_proof [] `!p m n. (p + m < p + n) = (m < n)` [ + (BETA_TAC THEN (move ["p"]) THEN (move ["m"]) THEN (move ["n"])); + (((repeat_tactic 1 9 (((use_arg_then "ltE")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "addnS")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leq_add2l")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_add2r *) +let leq_add2r = section_proof ["p";"m";"n"] `(m + p <= n + p) = (m <= n)` [ + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then "addnC") (fun fst_arg -> (use_arg_then "p") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "leq_add2l")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltn_add2r *) +let ltn_add2r = section_proof [] `!p m n. (m + p < n + p) = (m < n)` [ + (BETA_TAC THEN (move ["p"]) THEN (move ["m"]) THEN (move ["n"])); + (((repeat_tactic 1 9 (((use_arg_then "ltE")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "addSn")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leq_add2r")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_add *) +let leq_add = section_proof [] `!m1 m2 n1 n2. m1 <= n1 ==> m2 <= n2 ==> m1 + m2 <= n1 + n2` [ + (BETA_TAC THEN (move ["m1"]) THEN (move ["m2"]) THEN (move ["n1"]) THEN (move ["n2"]) THEN (move ["le_mn1"]) THEN (move ["le_mn2"])); + (((((fun arg_tac -> (use_arg_then "leq_trans") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m1 + n2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leq_add2l")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leq_add2r")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_addr *) +let leq_addr = section_proof [] `!m n. n <= n + m` [ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"])); + (((((use_arg_then "addn0")(gsym_then (thm_tac (new_rewrite [1] [(`n`)]))))) THEN (((use_arg_then "leq_add2l")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leq0n")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_addl *) +let leq_addl = section_proof [] `!m n. n <= m + n` [ + (((((use_arg_then "addnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leq_addr")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltn_addr *) +let ltn_addr = section_proof ["m";"n";"p"] `m < n ==> m < n + p` [ + ((repeat_tactic 1 9 (((use_arg_then "ltE")(thm_tac (new_rewrite [] []))))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then "leq_trans") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leq_addr")(thm_tac (new_rewrite [] []))))); +];; + +(* Lemma ltn_addl *) +let ltn_addl = section_proof [] `!m n p. m < n ==> m < p + n` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma addn_gt0 *) +let addn_gt0 = section_proof [] `!m n. (0 < m + n) <=> (0 < m) \/ (0 < n)` [ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"])); + (((repeat_tactic 1 9 (((use_arg_then "lt0n")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "negb_and")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "addn_eq0")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma subn_gt0 *) +let subn_gt0 = section_proof ["m";"n"] `(0 < n - m) = (m < n)` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma subn_eq0 *) +let subn_eq0 = section_proof [] `!m n. (m - n = 0) = (m <= n)` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma leqE *) +let leqE = section_proof [] `!m n. m <= n <=> m - n = 0` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma leq_sub_add *) +let leq_sub_add = section_proof [] `!m n p. (m - n <= p) = (m <= n + p)` [ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["p"])); + (((((use_arg_then "subn_eq0")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "subn_sub")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leqE")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma leq_subr *) +let leq_subr = section_proof [] `!m n. n - m <= n` [ + (((((use_arg_then "leq_sub_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leq_addl")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma subnKC *) +let subnKC = section_proof [] `!m n. m <= n ==> m + (n - m) = n` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma subnK *) +let subnK = section_proof [] `!m n. m <= n ==> (n - m) + m = n` [ + ((((use_arg_then "addnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "subnKC") (disch_tac [])) THEN (clear_assumption "subnKC") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma addn_subA *) +let addn_subA = section_proof [] `!m n p. p <= n ==> m + (n - p) = (m + n) - p` [ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["p"]) THEN (move ["le_pn"])); + (((((fun arg_tac -> (use_arg_then "subnK") (fun fst_arg -> (use_arg_then "le_pn") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then "addnA")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addnK")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma subn_subA *) +let subn_subA = section_proof [] `!m n p. p <= n ==> m - (n - p) = (m + p) - n` [ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["p"]) THEN (move ["le_pn"])); + (((((fun arg_tac -> (use_arg_then "subnK") (fun fst_arg -> (use_arg_then "le_pn") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then "subn_add2r")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma subKn *) +let subKn = section_proof [] `!m n. m <= n ==> n - (n - m) = m` [ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"])); + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then "subn_subA") (fun fst_arg -> (use_arg_then "n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "addKn")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma leq_subS *) +let leq_subS = section_proof [] `!m n. m <= n ==> SUC n - m = SUC (n - m)` [ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"])); + ((((use_arg_then "add1n")(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then "addn_subA") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))))); + ((((use_arg_then "add1n")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma ltn_subS *) +let ltn_subS = section_proof [] `!m n. m < n ==> n - m = SUC (n - SUC m)` [ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["lt_mn"])) THEN ((((use_arg_then "leq_subS")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "subSS")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "ltE")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma leq_sub2r *) +let leq_sub2r = section_proof [] `!p m n. m <= n ==> m - p <= n - p` [ + (BETA_TAC THEN (move ["p"]) THEN (move ["m"]) THEN (move ["n"]) THEN (move ["le_mn"])); + (((((use_arg_then "leq_sub_add")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "leq_trans") (fun fst_arg -> (use_arg_then "le_mn") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leq_sub_add")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leqnn")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_sub2l *) +let leq_sub2l = section_proof [] `!p m n. m <= n ==> p - n <= p - m` [ + ((BETA_TAC THEN (move ["p"]) THEN (move ["m"]) THEN (move ["n"])) THEN ((((fun arg_tac -> (use_arg_then "leq_add2r") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`p - m`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leq_sub_add")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "leq_trans") (disch_tac [])) THEN (clear_assumption "leq_trans") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then "leq_sub_add")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leqnn")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_sub2 *) +let leq_sub2 = section_proof [] `!m1 m2 n1 n2. m1 <= m2 ==> n2 <= n1 ==> m1 - n1 <= m2 - n2` [ + (BETA_TAC THEN (move ["m1"]) THEN (move ["m2"]) THEN (move ["n1"]) THEN (move ["n2"])); + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then "leq_sub2r") (fun fst_arg -> (use_arg_then "n1") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["le_m12"])) THEN ((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then "leq_sub2l") (fun fst_arg -> (use_arg_then "m2") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then "leq_trans") (disch_tac [])) THEN (clear_assumption "leq_trans") THEN (exact_tac))); +];; + +(* Lemma ltn_sub2r *) +let ltn_sub2r = section_proof [] `!p m n. p < n ==> m < n ==> m - p < n - p` [ + (BETA_TAC THEN (move ["p"]) THEN (move ["m"]) THEN (move ["n"])); + (((DISCH_THEN (fun snd_th -> (use_arg_then "ltn_subS") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((repeat_tactic 1 9 (((use_arg_then "ltE")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leqSS")(thm_tac (new_rewrite [] [])))))); + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then "leq_sub2r") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SUC p`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then "subSS")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma ltn_sub2l *) +let ltn_sub2l = section_proof [] `!p m n. m < p ==> m < n ==> p - n < p - m` [ + (BETA_TAC THEN (move ["p"]) THEN (move ["m"]) THEN (move ["n"])); + (((DISCH_THEN (fun snd_th -> (use_arg_then "ltn_subS") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((repeat_tactic 1 9 (((use_arg_then "ltE")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leqSS")(thm_tac (new_rewrite [] [])))))); + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then "leq_sub2l") (fun fst_arg -> (use_arg_then "p") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (done_tac)); +];; + +(* Lemma ltn_add_sub *) +let ltn_add_sub = section_proof [] `!m n p. (m + n < p) = (n < p - m)` [ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["p"])); + (((repeat_tactic 1 9 (((use_arg_then "ltnNge")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leq_sub_add")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +let maxn = new_definition `maxn m n = if m < n then n else m`;; +let minn = new_definition `minn m n = if m < n then m else n`;; + +(* Lemma max0n *) +let max0n = section_proof [] `!n. maxn 0 n = n` [ + ((((use_arg_then "maxn")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma maxn0 *) +let maxn0 = section_proof [] `!n. maxn n 0 = n` [ + ((((use_arg_then "maxn")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma maxnC *) +let maxnC = section_proof [] `!m n. maxn m n = maxn n m` [ + ((repeat_tactic 1 9 (((use_arg_then "maxn")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma maxnl *) +let maxnl = section_proof [] `!m n. n <= m ==> maxn m n = m` [ + ((((use_arg_then "maxn")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma maxnr *) +let maxnr = section_proof [] `!m n. m <= n ==> maxn m n = n` [ + ((((use_arg_then "maxn")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma add_sub_maxn *) +let add_sub_maxn = section_proof [] `!m n. m + (n - m) = maxn m n` [ + ((((use_arg_then "maxn")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma maxnAC *) +let maxnAC = section_proof [] `!m n p. maxn (maxn m n) p = maxn (maxn m p) n` [ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["p"])); + (((repeat_tactic 1 9 (((use_arg_then "add_sub_maxn")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then "addnA")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then "subn_sub")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then "add_sub_maxn")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "maxnC")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma maxnA *) +let maxnA = section_proof [] `!m n p. maxn m (maxn n p) = maxn (maxn m n) p` [ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["p"])); + (((repeat_tactic 1 9 (((use_arg_then "maxnC")(thm_tac (new_rewrite [] [(`maxn m _1`)]))))) THEN (((use_arg_then "maxnAC")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma maxnCA *) +let maxnCA = section_proof [] `!m n p. maxn m (maxn n p) = maxn n (maxn m p)` [ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["p"])) THEN ((repeat_tactic 1 9 (((use_arg_then "maxnA")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "maxnC")(thm_tac (new_rewrite [] [(`maxn m _1`)]))))) THEN (done_tac)); +];; + +(* Lemma eqn_maxr *) +let eqn_maxr = section_proof [] `!m n. (maxn m n = n) = (m <= n)` [ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"])); + (((((use_arg_then "maxnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addn0")(gsym_then (thm_tac (new_rewrite [2] [(`n`)]))))) THEN (((use_arg_then "add_sub_maxn")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "eqn_addl")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leqE")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eqn_maxl *) +let eqn_maxl = section_proof [] `!m n. (maxn m n = m) = (n <= m)` [ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"])); + (((((use_arg_then "addn0")(gsym_then (thm_tac (new_rewrite [2] [(`m`)]))))) THEN (((use_arg_then "add_sub_maxn")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "eqn_addl")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leqE")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma maxnn *) +let maxnn = section_proof [] `!n. maxn n n = n` [ + (BETA_TAC THEN (move ["n"])); + (((((use_arg_then "maxnl")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "leqnn")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_maxr *) +let leq_maxr = section_proof ["m";"n1";"n2"] `(m <= maxn n1 n2) <=> (m <= n1) \/ (m <= n2)` [ + ((fun arg_tac -> arg_tac (Arg_term (`n2 <= n1`))) (term_tac (wlog_tac (move ["le_n21"])[`n1`; `n2`]))); + (((THENL_LAST) (((fun arg_tac -> (fun arg_tac -> (use_arg_then "leq_total") (fun fst_arg -> (use_arg_then "n2") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "n1") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["le_n12"])) ((((use_arg_then "maxnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "orbC")(thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "le_n21")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (BETA_TAC THEN (move ["le_n21"])); + (((((use_arg_then "maxn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ltnNge")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "le_n21")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m <= n1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac))); + ((((use_arg_then "contra") (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac)) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then "leq_trans") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "n1") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN (done_tac)); +];; + +(* Lemma leq_maxl *) +let leq_maxl = section_proof ["m";"n1";"n2"] `(maxn n1 n2 <= m) <=> (n1 <= m) /\ (n2 <= m)` [ + (((((use_arg_then "leqNgt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ltE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leq_maxr")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "negb_or")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "ltE")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then "leqNgt")(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); +];; + +(* Lemma addn_maxl *) +let addn_maxl = section_proof [] `!m1 m2 n. (maxn m1 m2) + n = maxn (m1 + n) (m2 + n)` [ + ((BETA_TAC THEN (move ["m1"]) THEN (move ["m2"]) THEN (move ["n"])) THEN ((repeat_tactic 1 9 (((use_arg_then "add_sub_maxn")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "subn_add2r")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addnAC")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma addn_maxr *) +let addn_maxr = section_proof [] `!m n1 n2. m + maxn n1 n2 = maxn (m + n1) (m + n2)` [ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n1"]) THEN (move ["n2"])) THEN ((repeat_tactic 1 9 (((use_arg_then "addnC")(thm_tac (new_rewrite [] [(`m + _1`)]))))) THEN (((use_arg_then "addn_maxl")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma min0n *) +let min0n = section_proof ["n"] `minn 0 n = 0` [ + ((((use_arg_then "minn")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma minn0 *) +let minn0 = section_proof ["n"] `minn n 0 = 0` [ + ((((use_arg_then "minn")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma minnC *) +let minnC = section_proof ["m";"n"] `minn m n = minn n m` [ + ((repeat_tactic 1 9 (((use_arg_then "minn")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma minnr *) +let minnr = section_proof ["m";"n"] `n <= m ==> minn m n = n` [ + ((((use_arg_then "minn")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma minnl *) +let minnl = section_proof ["m";"n"] `m <= n ==> minn m n = m` [ + (((DISCH_THEN (fun snd_th -> (use_arg_then "minnr") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then "minnC")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma addn_min_max *) +let addn_min_max = section_proof ["m";"n"] `minn m n + maxn m n = m + n` [ + (((((use_arg_then "minn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "maxn")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma minn_to_maxn *) +let minn_to_maxn = section_proof ["m";"n"] `minn m n = (m + n) - maxn m n` [ + (((((use_arg_then "addn_min_max")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "addnK")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sub_sub_minn *) +let sub_sub_minn = section_proof ["m";"n"] `m - (m - n) = minn m n` [ + (((((use_arg_then "minnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "minn_to_maxn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "add_sub_maxn")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "subn_add2l")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma minnCA *) +let minnCA = section_proof [] `!m1 m2 m3. minn m1 (minn m2 m3) = minn m2 (minn m1 m3)` [ + ((BETA_TAC THEN (move ["m1"]) THEN (move ["m2"]) THEN (move ["m3"])) THEN (repeat_tactic 1 9 (((use_arg_then "minn_to_maxn")(thm_tac (new_rewrite [] [(`minn _1 (minn _2 _3)`)])))))); + ((((fun arg_tac -> (use_arg_then "subn_add2r") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`maxn m2 m3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then "subn_add2r") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`maxn m1 m3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [(`(m2 + _1) - _2`)]))))) THEN (repeat_tactic 1 9 (((use_arg_then "addnA")(gsym_then (thm_tac (new_rewrite [] []))))))); + (((repeat_tactic 1 9 (((use_arg_then "addn_maxl")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "addn_min_max")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "addn_maxr")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "addnCA")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "maxnAC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addnC")(thm_tac (new_rewrite [] [(`m2 + m1`)]))))) THEN (done_tac)); +];; + +(* Lemma minnA *) +let minnA = section_proof [] `!m1 m2 m3. minn m1 (minn m2 m3) = minn (minn m1 m2) m3` [ + (BETA_TAC THEN (move ["m1"]) THEN (move ["m2"]) THEN (move ["m3"])); + (((((use_arg_then "minnC")(thm_tac (new_rewrite [] [(`minn m2 _1`)])))) THEN (((use_arg_then "minnCA")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "minnC")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma minnAC *) +let minnAC = section_proof ["m1";"m2";"m3"] `minn (minn m1 m2) m3 = minn (minn m1 m3) m2` [ + (((((use_arg_then "minnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "minnCA")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "minnA")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eqn_minr *) +let eqn_minr = section_proof ["m";"n"] `(minn m n = n) = (n <= m)` [ + (((fun arg_tac -> (use_arg_then "eqn_addr") (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))); + (((((use_arg_then "addn_min_max")(gsym_then (thm_tac (new_rewrite [] [(`n + m`)]))))) THEN (((use_arg_then "minnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "eqn_addl")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "eq_sym")(thm_tac (new_rewrite [] [(`m = _1`)])))) THEN (((use_arg_then "maxnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "eqn_maxl")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eqn_minl *) +let eqn_minl = section_proof ["m";"n"] `(minn m n = m) = (m <= n)` [ + (((((fun arg_tac -> (use_arg_then "eqn_addr") (fun fst_arg -> (use_arg_then "n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "eq_sym")(thm_tac (new_rewrite [] [(`_1 = m + n`)])))) THEN (((use_arg_then "addn_min_max")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "eqn_addl")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "eqn_maxr")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma minnn *) +let minnn = section_proof ["n"] `minn n n = n` [ + (((((use_arg_then "minnr")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "leqnn")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_minr *) +let leq_minr = section_proof ["m";"n1";"n2"] `(m <= minn n1 n2) <=> (m <= n1) /\ (m <= n2)` [ + ((((use_arg_then "minn")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma leq_minl *) +let leq_minl = section_proof ["m";"n1";"n2"] `(minn n1 n2 <= m) <=> (n1 <= m) \/ (n2 <= m)` [ + (((((use_arg_then "leqNgt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ltE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leq_minr")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "ltE")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "negb_and")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "leqNgt")(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); +];; + +(* Lemma addn_minl *) +let addn_minl = section_proof [] `!m1 m2 n. (minn m1 m2) + n = minn (m1 + n) (m2 + n)` [ + ((BETA_TAC THEN (move ["m1"]) THEN (move ["m2"]) THEN (move ["n"])) THEN ((repeat_tactic 1 9 (((use_arg_then "minn_to_maxn")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "addn_maxl")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "addnA")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "subn_add2r")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addnAC")(thm_tac (new_rewrite [] [])))))); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then "addnC") (fun fst_arg -> (use_arg_then "n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [(`_1 + n`)])))))) THEN (((use_arg_then "addn_subA")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "addn_min_max")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leq_addl")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma addn_minr *) +let addn_minr = section_proof [] `!m n1 n2. m + minn n1 n2 = minn (m + n1) (m + n2)` [ + (BETA_TAC THEN (move ["m"]) THEN (move ["n1"]) THEN (move ["n2"])); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then "addnC") (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [(`m + _1`)]))))) THEN (((use_arg_then "addn_minl")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma maxnK *) +let maxnK = section_proof ["m";"n"] `minn (maxn m n) m = m` [ + (((((use_arg_then "minnr")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "leq_maxr")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leqnn")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma maxKn *) +let maxKn = section_proof ["m";"n"] `minn n (maxn m n) = n` [ + (((((use_arg_then "minnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "maxnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "maxnK")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma minnK *) +let minnK = section_proof ["m";"n"] `maxn (minn m n) m = m` [ + (((((use_arg_then "maxnr")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "leq_minl")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leqnn")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma minKn *) +let minKn = section_proof ["m";"n"] `maxn n (minn m n) = n` [ + (((((use_arg_then "minnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "maxnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "minnK")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma maxn_minl *) +let maxn_minl = section_proof ["m1";"m2";"n"] `maxn (minn m1 m2) n = minn (maxn m1 n) (maxn m2 n)` [ + (((repeat_tactic 1 9 (((use_arg_then "maxn")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "minn")(thm_tac (new_rewrite [] [])))))) THEN (arith_tac)); +];; + +(* Lemma maxn_minr *) +let maxn_minr = section_proof ["m";"n1";"n2"] `maxn m (minn n1 n2) = minn (maxn m n1) (maxn m n2)` [ + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then "maxnC") (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [(`maxn m _1`)]))))) THEN (((use_arg_then "maxn_minl")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma minn_maxl *) +let minn_maxl = section_proof [] `!m1 m2 n. minn (maxn m1 m2) n = maxn (minn m1 n) (minn m2 n)` [ + ((BETA_TAC THEN (move ["m1"]) THEN (move ["m2"]) THEN (move ["n"])) THEN ((((use_arg_then "maxn_minr")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "maxn_minl")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "minnA")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "maxnn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "maxnC")(thm_tac (new_rewrite [] [(`maxn _1 n`)])))) THEN (repeat_tactic 1 9 (((use_arg_then "maxnK")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma minn_maxr *) +let minn_maxr = section_proof [] `!m n1 n2. minn m (maxn n1 n2) = maxn (minn m n1) (minn m n2)` [ + (BETA_TAC THEN (move ["m"]) THEN (move ["n1"]) THEN (move ["n2"])); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then "minnC") (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [(`minn m _1`)]))))) THEN (((use_arg_then "minn_maxl")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Iteration *) +begin_section "Iteration";; +(add_section_var (mk_var ("m", (`:num`))); add_section_var (mk_var ("n", (`:num`))));; +(add_section_var (mk_var ("x", (`:A`))); add_section_var (mk_var ("y", (`:A`))));; +let iter = define `iter (SUC n) f (x:A) = f (iter n f x) /\ iter 0 f x = x`;; +let iteri = define `iteri (SUC n) f (x:A) = f n (iteri n f x) /\ iteri 0 f x = x`;; + +(* Lemma iterSr *) +let iterSr = section_proof ["n";"f";"x"] `iter (SUC n) f (x : A) = iter n f (f x)` [ + ((((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN elim) THEN ((repeat_tactic 1 9 (((use_arg_then "iter")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (move ["n"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma iterS *) +let iterS = section_proof ["n";"f";"x"] `iter (SUC n) f (x:A) = f (iter n f x)` [ + ((((use_arg_then "iter")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma iter_add *) +let iter_add = section_proof ["n";"m";"f";"x"] `iter (n + m) f (x:A) = iter n f (iter m f x)` [ + ((((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN elim) THEN (((repeat_tactic 1 9 (((use_arg_then "iter")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then "add0n")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then "addSn")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (move ["n"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "iterS")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma iteriS *) +let iteriS = section_proof ["n";"f";"x"] `iteri (SUC n) f x = f n (iteri n f (x:A))` [ + ((((use_arg_then "iteri")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Finalization of the section Iteration *) +let iterSr = finalize_theorem iterSr;; +let iterS = finalize_theorem iterS;; +let iter_add = finalize_theorem iter_add;; +let iteriS = finalize_theorem iteriS;; +end_section "Iteration";; + +(* Lemma mul0n *) +let mul0n = section_proof ["n"] `0 * n = 0` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma muln0 *) +let muln0 = section_proof ["n"] `n * 0 = 0` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma mul1n *) +let mul1n = section_proof ["n"] `1 * n = n` [ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma mulSn *) +let mulSn = section_proof ["m";"n"] `SUC m * n = n + m * n` [ + (arith_tac); +];; + +(* Lemma mulSnr *) +let mulSnr = section_proof ["m";"n"] `SUC m * n = m * n + n` [ + (arith_tac); +];; + +(* Lemma mulnS *) +let mulnS = section_proof ["m";"n"] `m * SUC n = m + m * n` [ + ((((use_arg_then "m") (disch_tac [])) THEN (clear_assumption "m") THEN elim) THEN (((repeat_tactic 0 10 (((use_arg_then "mul0n")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "addn0")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["m"]))); + ((((repeat_tactic 1 9 (((use_arg_then "mulSn")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "addSn")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "addnCA")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mulnSr *) +let mulnSr = section_proof ["m";"n"] `m * SUC n = m * n + m` [ + (((((use_arg_then "addnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "mulnS")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma muln1 *) +let muln1 = section_proof ["n"] `n * 1 = n` [ + (((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `1 = SUC 0`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "mulnSr")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "muln0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "add0n")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mulnC *) +let mulnC = section_proof [] `!m n. m * n = n * m` [ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"])); + (((THENL) (((use_arg_then "m") (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; (move ["m"])]) THEN (((repeat_tactic 0 10 (((use_arg_then "muln0")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "mulnS")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "mul0n")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "mulSn")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma muln_addl *) +let muln_addl = section_proof ["m1";"m2";"n"] `(m1 + m2) * n = m1 * n + m2 * n` [ + ((THENL_FIRST) ((THENL) (((use_arg_then "m1") (disch_tac [])) THEN (clear_assumption "m1") THEN elim) [ALL_TAC; ((move ["m1"]) THEN (move ["IHm"]))]) (((((use_arg_then "mul0n")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "add0n")(thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + (((((use_arg_then "mulSn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addnA")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "IHm")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "mulSn")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "addSn")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma muln_addr *) +let muln_addr = section_proof ["m";"n1";"n2"] `m * (n1 + n2) = m * n1 + m * n2` [ + (((repeat_tactic 1 9 (((use_arg_then "mulnC")(thm_tac (new_rewrite [] [(`m * _1`)]))))) THEN (((use_arg_then "muln_addl")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma muln_subl *) +let muln_subl = section_proof [] `!m n p. (m - n) * p = m * p - n * p` [ + ((THENL_FIRST) (BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN ((THENL) case [ALL_TAC; (move ["n'"])])) (((repeat_tactic 1 9 (((use_arg_then "muln0")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "subn0")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then "m") (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; ((move ["m"]) THEN (move ["IHm"]))]) THEN ((THENL) case [ALL_TAC; (move ["n"])])) THEN ((repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then "mul0n")(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then "sub0n")(fun tmp_arg1 -> (use_arg_then "subn0")(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "mulSn")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "subn_add2l")(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then "IHm")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "subSS")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma muln_subr *) +let muln_subr = section_proof [] `!m n p. m * (n - p) = m * n - m * p` [ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["p"])) THEN ((repeat_tactic 1 9 (((use_arg_then "mulnC")(thm_tac (new_rewrite [] [(`m * _1`)]))))) THEN (((use_arg_then "muln_subl")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mulnA *) +let mulnA = section_proof [] `!m n p. m * (n * p) = (m * n) * p` [ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["p"])); + ((THENL_FIRST) ((THENL) (((use_arg_then "m") (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; (move ["m"])]) ((repeat_tactic 1 9 (((use_arg_then "mul0n")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((repeat_tactic 1 9 (((use_arg_then "mulSn")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "muln_addl")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mulnCA *) +let mulnCA = section_proof ["m";"n1";"n2"] `m * (n1 * n2) = n1 * (m * n2)` [ + (((repeat_tactic 1 9 (((use_arg_then "mulnA")(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then "mulnC") (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [(`m * _1`)]))))) THEN (done_tac)); +];; + +(* Lemma mulnAC *) +let mulnAC = section_proof ["m";"n";"p"] `(n * m) * p = (n * p) * m` [ + (((repeat_tactic 1 9 (((use_arg_then "mulnA")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "mulnC")(thm_tac (new_rewrite [] [(`p * _1`)]))))) THEN (done_tac)); +];; + +(* Lemma muln_eq0 *) +let muln_eq0 = section_proof ["m";"n"] `(m * n = 0) <=> (m = 0) \/ (n = 0)` [ + ((((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then "m") (disch_tac [])) THEN (clear_assumption "m") THEN case) [ALL_TAC; (move ["m"])]) THEN ((THENL) case [ALL_TAC; (move ["n"])])) THEN ((repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then "muln0")(fun tmp_arg1 -> (use_arg_then "mul0n")(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (arith_tac)); +];; + +(* Lemma eqn_mul1 *) +let eqn_mul1 = section_proof ["m";"n"] `(m * n = 1) <=> (m = 1) /\ (n = 1)` [ + ((((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then "m") (disch_tac [])) THEN (clear_assumption "m") THEN case) [ALL_TAC; ((THENL) case [ALL_TAC; (move ["m"])])]) THEN ((THENL) case [ALL_TAC; ((THENL) case [ALL_TAC; (move ["n"])])])) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma muln_gt0 *) +let muln_gt0 = section_proof ["m";"n"] `(0 < m * n) <=> (0 < m) /\ (0 < n)` [ + ((((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then "m") (disch_tac [])) THEN (clear_assumption "m") THEN case) [ALL_TAC; (move ["m"])]) THEN ((THENL) case [ALL_TAC; (move ["n"])])) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma leq_pmull *) +let leq_pmull = section_proof ["m";"n"] `0 < n ==> m <= n * m` [ + (((DISCH_THEN (fun snd_th -> (use_arg_then "prednK") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then "mulSn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leq_addr")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_pmulr *) +let leq_pmulr = section_proof ["m";"n"] `0 < n ==> m <= m * n` [ + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then "leq_pmull") (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then "mulnC")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma leq_mul2l *) +let leq_mul2l = section_proof ["m";"n1";"n2"] `(m * n1 <= m * n2) <=> (m = 0) \/ (n1 <= n2)` [ + (((((use_arg_then "leqE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "muln_subr")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "muln_eq0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leqE")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma leq_mul2r *) +let leq_mul2r = section_proof ["m";"n1";"n2"] `(n1 * m <= n2 * m) <=> (m = 0) \/ (n1 <= n2)` [ + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then "mulnC") (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [(`_1 * m`)])))))) THEN (((use_arg_then "leq_mul2l")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_mul *) +let leq_mul = section_proof ["m1";"m2";"n1";"n2"] `m1 <= n1 ==> m2 <= n2 ==> m1 * m2 <= n1 * n2` [ + (BETA_TAC THEN (move ["le_mn1"]) THEN (move ["le_mn2"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "leq_trans") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m1 * n2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m1 * m2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n1 * n2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((THENL_FIRST) (ANTS_TAC) (((((use_arg_then "leq_mul2l")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "le_mn2")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (DISCH_THEN apply_tac); + (((((use_arg_then "leq_mul2r")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "le_mn1")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eqn_mul2l *) +let eqn_mul2l = section_proof ["m";"n1";"n2"] `(m * n1 = m * n2) <=> (m = 0) \/ (n1 = n2)` [ + (((((use_arg_then "eqn_leq")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "leq_mul2l")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "orb_andr")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "eqn_leq")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma eqn_mul2r *) +let eqn_mul2r = section_proof ["m";"n1";"n2"] `(n1 * m = n2 * m) <=> (m = 0) \/ (n1 = n2)` [ + (((((use_arg_then "eqn_leq")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "leq_mul2r")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "orb_andr")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "eqn_leq")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma leq_pmul2l *) +let leq_pmul2l = section_proof ["m";"n1";"n2"] `0 < m ==> ((m * n1 <= m * n2) <=> (n1 <= n2))` [ + (((DISCH_THEN (fun snd_th -> (use_arg_then "prednK") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "leq_mul2l")(thm_tac (new_rewrite [] [])))) THEN ((((use_arg_then "NOT_SUC")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "orFb")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma leq_pmul2r *) +let leq_pmul2r = section_proof ["m";"n1";"n2"] `0 < m ==> ((n1 * m <= n2 * m) <=> (n1 <= n2))` [ + (((DISCH_THEN (fun snd_th -> (use_arg_then "prednK") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "leq_mul2r")(thm_tac (new_rewrite [] [])))) THEN ((((use_arg_then "NOT_SUC")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "orFb")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma eqn_pmul2l *) +let eqn_pmul2l = section_proof ["m";"n1";"n2"] `0 < m ==> ((m * n1 = m * n2) <=> (n1 = n2))` [ + (((DISCH_THEN (fun snd_th -> (use_arg_then "prednK") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "eqn_mul2l")(thm_tac (new_rewrite [] [])))) THEN ((((use_arg_then "NOT_SUC")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "orFb")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma eqn_pmul2r *) +let eqn_pmul2r = section_proof ["m";"n1";"n2"] `0 < m ==> ((n1 * m = n2 * m) <=> (n1 = n2))` [ + (((DISCH_THEN (fun snd_th -> (use_arg_then "prednK") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "eqn_mul2r")(thm_tac (new_rewrite [] [])))) THEN ((((use_arg_then "NOT_SUC")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "orFb")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma ltn_mul2l *) +let ltn_mul2l = section_proof ["m";"n1";"n2"] `(m * n1 < m * n2) <=> (0 < m) /\ (n1 < n2)` [ + (((((use_arg_then "lt0n")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "ltnNge")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leq_mul2l")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "negb_or")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltn_mul2r *) +let ltn_mul2r = section_proof ["m";"n1";"n2"] `(n1 * m < n2 * m) <=> (0 < m) /\ (n1 < n2)` [ + (((((use_arg_then "lt0n")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "ltnNge")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leq_mul2r")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "negb_or")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltn_pmul2l *) +let ltn_pmul2l = section_proof ["m";"n1";"n2"] `0 < m ==> ((m * n1 < m * n2) <=> (n1 < n2))` [ + (((DISCH_THEN (fun snd_th -> (use_arg_then "prednK") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then "ltn_mul2l")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "LT_0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltn_pmul2r *) +let ltn_pmul2r = section_proof ["m";"n1";"n2"] `0 < m ==> (n1 * m < n2 * m <=> n1 < n2)` [ + (((DISCH_THEN (fun snd_th -> (use_arg_then "prednK") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then "ltn_mul2r")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "LT_0")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltn_Pmull *) +let ltn_Pmull = section_proof ["m";"n"] `1 < n ==> 0 < m ==> m < n * m` [ + ((BETA_TAC THEN (move ["lt1n"]) THEN (move ["m_gt0"])) THEN ((((use_arg_then "mul1n")(gsym_then (thm_tac (new_rewrite [1] [(`m`)]))))) THEN (((use_arg_then "ltn_pmul2r")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltn_Pmulr *) +let ltn_Pmulr = section_proof ["m";"n"] `1 < n ==> 0 < m ==> m < m * n` [ + ((BETA_TAC THEN (move ["lt1n"]) THEN (move ["m_gt0"])) THEN ((((use_arg_then "mulnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ltn_Pmull")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltn_mul *) +let ltn_mul = section_proof ["m1";"m2";"n1";"n2"] `m1 < n1 ==> m2 < n2 ==> m1 * m2 < n1 * n2` [ + (BETA_TAC THEN (move ["lt_mn1"]) THEN (move ["lt_mn2"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "leq_ltn_trans") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m1 * n2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m1 * m2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n1 * n2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (ANTS_TAC); + (((((use_arg_then "leq_mul2l")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "orbC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ltnW")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (DISCH_THEN apply_tac); + ((((use_arg_then "ltn_pmul2r")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then "lt_mn2") (disch_tac [])) THEN (clear_assumption "lt_mn2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma maxn_mulr *) +let maxn_mulr = section_proof ["m";"n1";"n2"] `m * maxn n1 n2 = maxn (m * n1) (m * n2)` [ + ((THENL_FIRST) ((THENL) (((use_arg_then "m") (disch_tac [])) THEN (clear_assumption "m") THEN case) [ALL_TAC; (move ["n"])]) (((repeat_tactic 1 9 (((use_arg_then "mul0n")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "maxnn")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((repeat_tactic 1 9 (((use_arg_then "maxn")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "fun_if")(thm_tac (new_rewrite [] [(`SUC n * _1`)])))) THEN (((use_arg_then "ltn_pmul2l")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "LT_0")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma maxn_mull *) +let maxn_mull = section_proof ["m1";"m2";"n"] `maxn m1 m2 * n = maxn (m1 * n) (m2 * n)` [ + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then "mulnC") (fun fst_arg -> (use_arg_then "n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [(`_1 * n`)])))))) THEN (((use_arg_then "maxn_mulr")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma minn_mulr *) +let minn_mulr = section_proof ["m";"n1";"n2"] `m * minn n1 n2 = minn (m * n1) (m * n2)` [ + ((THENL_FIRST) ((THENL) (((use_arg_then "m") (disch_tac [])) THEN (clear_assumption "m") THEN case) [ALL_TAC; (move ["n"])]) (((repeat_tactic 1 9 (((use_arg_then "mul0n")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "minn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "if_same")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then "minn")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "fun_if")(thm_tac (new_rewrite [] [(`SUC n * _1`)])))) THEN (((use_arg_then "ltn_pmul2l")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "LT_0")(thm_tac (new_rewrite [] []))))); +];; + +(* Lemma minn_mull *) +let minn_mull = section_proof ["m1";"m2";"n"] `minn m1 m2 * n = minn (m1 * n) (m2 * n)` [ + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then "mulnC") (fun fst_arg -> (use_arg_then "n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [(`_1 * n`)])))))) THEN (((use_arg_then "minn_mulr")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +parse_as_infix("^", (24, "left"));; +override_interface("^", `EXP`);; + +(* Lemma expn0 *) +let expn0 = section_proof ["m"] `m ^ 0 = 1` [ + ((((use_arg_then "EXP")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma expn1 *) +let expn1 = section_proof ["m"] `m ^ 1 = m` [ + ((((use_arg_then "EXP_1")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma expnS *) +let expnS = section_proof ["m";"n"] `m ^ SUC n = m * m ^ n` [ + ((((use_arg_then "EXP")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma expnSr *) +let expnSr = section_proof ["m";"n"] `m ^ SUC n = m ^ n * m` [ + (((((use_arg_then "mulnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "expnS")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma exp0n *) +let exp0n = section_proof ["n"] `0 < n ==> 0 ^ n = 0` [ + ((THENL_FIRST) ((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN case) [ALL_TAC; (move ["n"])]) ((((use_arg_then "LT_REFL")(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((((use_arg_then "EXP")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "mul0n")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma exp1n *) +let exp1n = section_proof ["n"] `1 ^ n = 1` [ + (((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN elim) [(((use_arg_then "expn0")(thm_tac (new_rewrite [] [])))); ((((use_arg_then "expnS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "mul1n")(thm_tac (new_rewrite [] [])))))]) THEN (done_tac)); +];; + +(* Lemma expn_add *) +let expn_add = section_proof ["m";"n1";"n2"] `m ^ (n1 + n2) = m ^ n1 * m ^ n2` [ + (((THENL) (((use_arg_then "n1") (disch_tac [])) THEN (clear_assumption "n1") THEN elim) [ALL_TAC; ((move ["n1"]) THEN (move ["IHn"]))]) THEN ((repeat_tactic 0 10 (((use_arg_then "expn0")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "mul1n")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "add0n")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "addSn")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "expnS")(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "IHn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "mulnA")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma expn_mull *) +let expn_mull = section_proof ["m1";"m2";"n"] `(m1 * m2) ^ n = m1 ^ n * m2 ^ n` [ + ((THENL_FIRST) ((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) (((repeat_tactic 1 9 (((use_arg_then "expn0")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "muln1")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((repeat_tactic 1 9 (((use_arg_then "expnS")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "IHn")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "mulnA")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "mulnCA")(thm_tac (new_rewrite [] [(`m2 * _1`)]))))) THEN (done_tac)); +];; + +(* Lemma expn_mulr *) +let expn_mulr = section_proof ["m";"n1";"n2"] `m ^ (n1 * n2) = (m ^ n1) ^ n2` [ + ((THENL_FIRST) ((THENL) (((use_arg_then "n1") (disch_tac [])) THEN (clear_assumption "n1") THEN elim) [ALL_TAC; ((move ["n1"]) THEN (move ["IHn"]))]) (((repeat_tactic 1 9 (((use_arg_then "expn0")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "mul0n")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "expn0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "exp1n")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then "mulSn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "expn_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "expnS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "expn_mull")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IHn")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma expn_gt0 *) +let expn_gt0 = section_proof ["m";"n"] `(0 < m ^ n) <=> (0 < m) \/ (n = 0)` [ + ((THENL_FIRST) (((THENL) (((use_arg_then "m") (disch_tac [])) THEN (clear_assumption "m") THEN case) [ALL_TAC; (move ["m"])]) THEN ((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))])) ((((use_arg_then "expn0")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then "expnS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "mul0n")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then "expn0")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then "expnS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "mulSn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addn_gt0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IHn")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma expn_eq0 *) +let expn_eq0 = section_proof ["m";"e"] `(m ^ e = 0) <=> (m = 0) /\ (0 < e)` [ + (((repeat_tactic 1 9 (((use_arg_then "eqn0Ngt")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "expn_gt0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "negb_or")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "lt0n")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma ltn_expl *) +let ltn_expl = section_proof ["m";"n"] `1 < m ==> n < m ^ n` [ + ((THENL_FIRST) ((BETA_TAC THEN (move ["m_gt1"])) THEN ((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; (move ["n"])])) ((((use_arg_then "expn0")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then "ltnW") (fun fst_arg -> (use_arg_then "m_gt1") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then "ONE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ltE")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then "leq_pmul2l") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC)); + (((repeat_tactic 1 9 (((use_arg_then "ltE")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "expnS")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "leq_trans") (disch_tac [])) THEN (clear_assumption "leq_trans") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "ltE")(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then "ltn_Pmull") (fun fst_arg -> (use_arg_then "m_gt1") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma leq_exp2l *) +let leq_exp2l = section_proof ["m";"n1";"n2"] `1 < m ==> (m ^ n1 <= m ^ n2 <=> n1 <= n2)` [ + ((THENL_ROT (-1)) ((BETA_TAC THEN (move ["m_gt1"])) THEN ((THENL) (((use_arg_then "n2") (disch_tac [])) THEN (clear_assumption "n2") THEN ((use_arg_then "n1") (disch_tac [])) THEN (clear_assumption "n1") THEN elim) [ALL_TAC; ((move ["n1"]) THEN (move ["IHn"]))]) THEN (BETA_TAC THEN ((THENL) case [ALL_TAC; (move ["q"])])) THEN ((repeat_tactic 0 10 (((use_arg_then "leqnn")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))))); + (((repeat_tactic 1 9 (((use_arg_then "expnS")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leq_pmul2l")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "leqSS")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "ltE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ltnW")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ONE")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then "expn0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ONE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ltE")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "expn_gt0")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "m_gt1") (disch_tac [])) THEN (clear_assumption "m_gt1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then "leqNgt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "expn0")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "m_gt1") (disch_tac [])) THEN (clear_assumption "m_gt1") THEN BETA_TAC) THEN ((((use_arg_then "ltE")(thm_tac (new_rewrite [] [])))) THEN (move ["m_gt1"]))); + ((((use_arg_then "ltE")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "leq_trans") (fun fst_arg -> (use_arg_then "m_gt1") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "ltE")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then "ltn0")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "expnS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leq_pmulr")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "expn_gt0")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "m_gt1") (disch_tac [])) THEN (clear_assumption "m_gt1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma ltn_exp2l *) +let ltn_exp2l = section_proof ["m";"n1";"n2"] `1 < m ==> (m ^ n1 < m ^ n2 <=> n1 < n2)` [ + ((BETA_TAC THEN (move ["m_gt1"])) THEN ((repeat_tactic 1 9 (((use_arg_then "ltnNge")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leq_exp2l")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eqn_exp2l *) +let eqn_exp2l = section_proof ["m";"n1";"n2"] `1 < m ==> (m ^ n1 = m ^ n2 <=> n1 = n2)` [ + ((BETA_TAC THEN (move ["m_gt1"])) THEN ((repeat_tactic 1 9 (((use_arg_then "eqn_leq")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "leq_exp2l")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma expnI *) +let expnI = section_proof ["m"] `1 < m ==> !e1 e2. m ^ e1 = m ^ e2 ==> e1 = e2` [ + ((BETA_TAC THEN (move ["m_gt1"]) THEN (move ["e1"]) THEN (move ["e2"])) THEN (((use_arg_then "eqn_exp2l")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma leq_pexp2l *) +let leq_pexp2l = section_proof ["m";"n1";"n2"] `0 < m ==> n1 <= n2 ==> m ^ n1 <= m ^ n2` [ + (((THENL) (((THENL) (((use_arg_then "m") (disch_tac [])) THEN (clear_assumption "m") THEN case) [ALL_TAC; ((THENL) case [ALL_TAC; (move ["m"])])]) THEN ((repeat_tactic 0 10 (((use_arg_then "ltn0")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))) [((((use_arg_then "ONE")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "exp1n")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leqnn")(thm_tac (new_rewrite [] []))))); ((((use_arg_then "leq_exp2l")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))]) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma ltn_pexp2l *) +let ltn_pexp2l = section_proof ["m";"n1";"n2"] `0 < m ==> m ^ n1 < m ^ n2 ==> n1 < n2` [ + (((THENL) (((THENL) (((use_arg_then "m") (disch_tac [])) THEN (clear_assumption "m") THEN case) [ALL_TAC; ((THENL) case [ALL_TAC; (move ["m"])])]) THEN ((repeat_tactic 0 10 (((use_arg_then "ltn0")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))) [((((use_arg_then "ONE")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "exp1n")(thm_tac (new_rewrite [] [])))))); (((use_arg_then "ltn_exp2l")(thm_tac (new_rewrite [] []))))]) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma ltn_exp2r *) +let ltn_exp2r = section_proof ["m";"n";"e"] `0 < e ==> (m ^ e < n ^ e <=> m < n)` [ + ((BETA_TAC THEN (move ["e_gt0"])) THEN ((THENL) (split_tac) [ALL_TAC; (move ["ltmn"])])); + ((repeat_tactic 1 9 (((use_arg_then "ltnNge")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "contra") (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (move ["lemn"]))); + (((THENL) (((use_arg_then "e") (disch_tac [])) THEN (clear_assumption "e") THEN elim) [ALL_TAC; ((move ["e'"]) THEN (move ["IHe"]))]) THEN ((repeat_tactic 0 10 (((use_arg_then "expn0")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "leqnn")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "expnS")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leq_mul")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) (((use_arg_then "e_gt0") (disch_tac [])) THEN (clear_assumption "e_gt0") THEN ((use_arg_then "e") (disch_tac [])) THEN (clear_assumption "e") THEN elim) ((((use_arg_then "ltnn")(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((THENL_FIRST) (BETA_TAC THEN ((THENL) case [ALL_TAC; ((move ["e"]) THEN (move ["IHe"]))])) (((((use_arg_then "ONE")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "expn1")(thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + (((repeat_tactic 1 9 (((use_arg_then "expnS")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ltn_mul")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "expnS")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "IHe")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (arith_tac)); +];; + +(* Lemma leq_exp2r *) +let leq_exp2r = section_proof ["m";"n";"e"] `0 < e ==> (m ^ e <= n ^ e <=> m <= n)` [ + ((BETA_TAC THEN (move ["e_gt0"])) THEN ((((use_arg_then "leqNgt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ltn_exp2r")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "leqNgt")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma eqn_exp2r *) +let eqn_exp2r = section_proof ["m";"n";"e"] `0 < e ==> (m ^ e = n ^ e <=> m = n)` [ + ((BETA_TAC THEN (move ["e_gt0"])) THEN ((repeat_tactic 1 9 (((use_arg_then "eqn_leq")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "leq_exp2r")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma expIn *) +let expIn = section_proof ["e"] `0 < e ==> !m n. m ^ e = n ^ e ==> m = n` [ + ((BETA_TAC THEN (move ["e_gt0"]) THEN (move ["m"]) THEN (move ["n"])) THEN (((use_arg_then "eqn_exp2r")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma fact0 *) +let fact0 = section_proof [] `FACT 0 = 1` [ + ((((use_arg_then "FACT")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma factS *) +let factS = section_proof ["n"] `FACT (SUC n) = (SUC n) * FACT n` [ + ((((use_arg_then "FACT")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma fact_gt0 *) +let fact_gt0 = section_proof ["n"] `0 < FACT n` [ + (((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; (move ["n"])]) THEN ((((use_arg_then "FACT")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 0 10 (((use_arg_then "muln_gt0")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))) THEN (arith_tac) THEN (done_tac)); +];; +let odd = new_basic_definition `odd = ODD`;; + +(* Lemma odd0 *) +let odd0 = section_proof [] `odd 0 = F` [ + ((((use_arg_then "odd")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 2 0 (((use_arg_then "ODD")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma oddS *) +let oddS = section_proof ["n"] `odd (SUC n) = ~odd n` [ + (((((use_arg_then "odd")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "ODD")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma odd1 *) +let odd1 = section_proof [] `odd 1 = T` [ + (((((use_arg_then "ONE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "oddS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "odd0")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma odd_add *) +let odd_add = section_proof ["m";"n"] `odd (m + n) = odd m + odd n` [ + ((THENL_FIRST) ((THENL) (((use_arg_then "m") (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; ((move ["m"]) THEN (move ["IHn"]))]) (((((use_arg_then "add0n")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "odd0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addFb")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then "addSn")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "oddS")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "IHn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addTb")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "addbA")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addTb")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma odd_sub *) +let odd_sub = section_proof ["m";"n"] `n <= m ==> odd (m - n) = odd m + odd n` [ + ((BETA_TAC THEN (move ["le_nm"])) THEN (((fun arg_tac -> (use_arg_then "addIb") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`odd n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then "odd_add")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "subnK")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "addbK")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma odd_opp *) +let odd_opp = section_proof ["i";"m"] `odd m = F ==> i < m ==> odd (m - i) = odd i` [ + (BETA_TAC THEN (move ["oddm"]) THEN (move ["lt_im"])); + (((((fun arg_tac -> (use_arg_then "odd_sub") (fun fst_arg -> (fun arg_tac -> (use_arg_then "ltnW") (fun fst_arg -> (use_arg_then "lt_im") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "oddm")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addFb")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma odd_mul *) +let odd_mul = section_proof ["m";"n"] `odd (m * n) <=> odd m /\ odd n` [ + ((THENL_FIRST) ((THENL) (((use_arg_then "m") (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; ((move ["m"]) THEN (move ["IHm"]))]) (((((use_arg_then "mul0n")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "odd0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andFb")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then "mulSn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "odd_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "oddS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addTb")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "andb_addl")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IHm")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma odd_exp *) +let odd_exp = section_proof ["m";"n"] `odd (m ^ n) <=> (n = 0) \/ odd m` [ + ((THENL_FIRST) ((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) (((((use_arg_then "expn0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "odd1")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then "expnS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "odd_mul")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IHn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "orbC")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `SUC n = 0 <=> F`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "orFb")(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`odd m`))) (term_tac (set_tac "b"))); + (((use_arg_then "IHn") (disch_tac [])) THEN (clear_assumption "IHn") THEN ((use_arg_then "b_def") (disch_tac [])) THEN (clear_assumption "b_def") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"])); + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; +let double = define `double 0 = 0 /\ (!n. double (SUC n) = SUC (SUC (double n)))`;; + +(* Lemma double0 *) +let double0 = section_proof [] `double 0 = 0` [ + ((((use_arg_then "double")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma doubleS *) +let doubleS = section_proof ["n"] `double (SUC n) = SUC (SUC (double n))` [ + ((((use_arg_then "double")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma addnn *) +let addnn = section_proof ["n"] `n + n = double n` [ + ((THENL_FIRST) ((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) (((((use_arg_then "addn0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "double0")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then "addnS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addSn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IHn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "doubleS")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mul2n *) +let mul2n = section_proof ["m"] `2 * m = double m` [ + (((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `2 = SUC 1`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "mulSn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "mul1n")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addnn")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma muln2 *) +let muln2 = section_proof ["m"] `m * 2 = double m` [ + (((((use_arg_then "mulnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "mul2n")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma double_add *) +let double_add = section_proof ["m";"n"] `double (m + n) = double m + double n` [ + (((repeat_tactic 1 9 (((use_arg_then "addnn")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then "addnA")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((fun arg_tac -> (use_arg_then "addnCA") (fun fst_arg -> (use_arg_then "n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [(`n + _1`)]))))) THEN (done_tac)); +];; + +(* Lemma double_sub *) +let double_sub = section_proof ["m";"n"] `double (m - n) = double m - double n` [ + ((((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then "m") (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; ((move ["m"]) THEN (move ["IHm"]))]) THEN ((THENL) case [ALL_TAC; (move ["n"])])) THEN ((repeat_tactic 0 10 (((use_arg_then "sub0n")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "subn0")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "double0")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "subn0")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "sub0n")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((repeat_tactic 1 9 (((use_arg_then "doubleS")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "subSS")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "IHm")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_double *) +let leq_double = section_proof ["m";"n"] `(double m <= double n <=> m <= n)` [ + (((repeat_tactic 1 9 (((use_arg_then "leqE")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "double_sub")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((THENL) (((fun arg_tac -> arg_tac (Arg_term (`m - n`))) (disch_tac [])) THEN case) [ALL_TAC; (move ["n"])]) THEN (((use_arg_then "double")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma ltn_double *) +let ltn_double = section_proof ["m";"n"] `(double m < double n) = (m < n)` [ + (((repeat_tactic 2 0 (((use_arg_then "ltnNge")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leq_double")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltn_Sdouble *) +let ltn_Sdouble = section_proof ["m";"n"] `(SUC (double m) < double n) = (m < n)` [ + ((repeat_tactic 1 9 (((use_arg_then "muln2")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma leq_Sdouble *) +let leq_Sdouble = section_proof ["m";"n"] `(double m <= SUC (double n)) = (m <= n)` [ + (((((use_arg_then "leqNgt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ltn_Sdouble")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leqNgt")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma odd_double *) +let odd_double = section_proof ["n"] `odd (double n) = F` [ + (((((use_arg_then "addnn")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "odd_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addbb")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma double_gt0 *) +let double_gt0 = section_proof ["n"] `(0 < double n) = (0 < n)` [ + (((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN case) [ALL_TAC; (move ["n"])]) THEN ((repeat_tactic 0 10 (((use_arg_then "double0")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "doubleS")(thm_tac (new_rewrite [] []))))) THEN (arith_tac)); +];; + +(* Lemma double_eq0 *) +let double_eq0 = section_proof ["n"] `(double n = 0) = (n = 0)` [ + (((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN case) [ALL_TAC; (move ["n"])]) THEN ((repeat_tactic 0 10 (((use_arg_then "double0")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "doubleS")(thm_tac (new_rewrite [] []))))) THEN (arith_tac)); +];; + +(* Lemma double_mull *) +let double_mull = section_proof ["m";"n"] `double (m * n) = double m * n` [ + (((repeat_tactic 1 9 (((use_arg_then "mul2n")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "mulnA")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma double_mulr *) +let double_mulr = section_proof ["m";"n"] `double (m * n) = m * double n` [ + (((repeat_tactic 1 9 (((use_arg_then "muln2")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "mulnA")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +let half_def = define `HALF 0 = (0, 0) /\ + !n. HALF (SUC n) = (SND (HALF n), SUC (FST (HALF n)))`;; +let half = new_basic_definition `half = FST o HALF`;; +let uphalf = new_basic_definition `uphalf = SND o HALF`;; + +(* Lemma half0 *) +let half0 = section_proof [] `half 0 = 0` [ + (((((use_arg_then "half")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "o_DEF")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then "half_def")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma uphalf0 *) +let uphalf0 = section_proof [] `uphalf 0 = 0` [ + (((((use_arg_then "uphalf")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "o_DEF")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then "half_def")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma halfS *) +let halfS = section_proof ["n"] `half (SUC n) = uphalf n` [ + (((((use_arg_then "half")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "uphalf")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "o_DEF")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then "half_def")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma uphalfS *) +let uphalfS = section_proof ["n"] `uphalf (SUC n) = SUC (half n)` [ + (((((use_arg_then "half")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "uphalf")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "o_DEF")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then "half_def")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma doubleK *) +let doubleK = section_proof ["x"] `half (double x) = x` [ + ((THENL_FIRST) ((THENL) (((use_arg_then "x") (disch_tac [])) THEN (clear_assumption "x") THEN elim) [ALL_TAC; (move ["n"])]) (((((use_arg_then "double0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "half0")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((((use_arg_then "doubleS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "halfS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "uphalfS")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +let half_double = doubleK;; + +(* Lemma double_inj *) +let double_inj = section_proof [] `!m n. double m = double n ==> m = n` [ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"])); + ((((((use_arg_then "doubleK")(gsym_then (thm_tac (new_rewrite [2] [(`m`)]))))) THEN (((use_arg_then "doubleK")(gsym_then (thm_tac (new_rewrite [2] [(`n`)])))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma uphalf_double *) +let uphalf_double = section_proof ["n"] `uphalf (double n) = n` [ + ((THENL_FIRST) ((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; (move ["n"])]) (((((use_arg_then "double0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "uphalf0")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((((use_arg_then "doubleS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "uphalfS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "halfS")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma uphalf_half *) +let uphalf_half = section_proof ["n"] `uphalf n = (if odd n then 1 else 0) + half n` [ + ((THENL_FIRST) ((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) (((((use_arg_then "uphalf0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "half0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "odd0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addn0")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then "halfS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IHn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addnA")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "oddS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "uphalfS")(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> arg_tac (Arg_term (`odd n`))) (disch_tac [])) THEN case THEN (simp_tac)) THEN ((((fun arg_tac ->(use_arg_then "add0n")(fun tmp_arg1 -> (use_arg_then "addn0")(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "add1n")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma odd_double_half *) +let odd_double_half = section_proof ["n"] `(if odd n then 1 else 0) + double (half n) = n` [ + ((THENL_FIRST) ((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) (((((use_arg_then "odd0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "half0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "double0")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "addn0")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then "IHn")(gsym_then (thm_tac (new_rewrite [3] []))))) THEN (((use_arg_then "halfS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "uphalf_half")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "double_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "oddS")(thm_tac (new_rewrite [] []))))); + (((use_arg_then "IHn") (disch_tac [])) THEN (clear_assumption "IHn") THEN BETA_TAC THEN (move ["_"])); + ((((fun arg_tac -> arg_tac (Arg_term (`odd n`))) (disch_tac [])) THEN case THEN (simp_tac)) THEN ((repeat_tactic 0 10 (((use_arg_then "double0")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "add0n")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "add1n")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "ONE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "doubleS")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "addSn")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "double0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "add0n")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma half_bit_double *) +let half_bit_double = section_proof ["n";"b"] `half ((if b then 1 else 0) + double n) = n` [ + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN ((simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then "add0n")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "add1n")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "halfS")(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac ->(use_arg_then "half_double")(fun tmp_arg1 -> (use_arg_then "uphalf_double")(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma half_add *) +let half_add = section_proof ["m";"n"] `half (m + n) = (if odd m /\ odd n then 1 else 0) + (half m + half n)` [ + ((((use_arg_then "odd_double_half")(gsym_then (thm_tac (new_rewrite [1] [(`n`)]))))) THEN (((use_arg_then "addnCA")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "odd_double_half")(gsym_then (thm_tac (new_rewrite [1] [(`m`)]))))) THEN (((use_arg_then "addnA")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "double_add")(gsym_then (thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 2 0 ((((fun arg_tac -> arg_tac (Arg_term (`odd _`))) (disch_tac [])) THEN case))) THEN ((simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then "add0n")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "half_double")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "add1n")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "halfS")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "uphalfS")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "uphalf_double")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((((use_arg_then "half_double")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma half_leq *) +let half_leq = section_proof ["m";"n"] `m <= n ==> half m <= half n` [ + (((DISCH_THEN (fun snd_th -> (use_arg_then "subnK") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then "half_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addnA")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leq_addl")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma half_gt0 *) +let half_gt0 = section_proof ["n"] `(0 < half n) = (1 < n)` [ + (((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN case) [ALL_TAC; (case THEN ALL_TAC)]) THEN ((repeat_tactic 0 10 (((use_arg_then "halfS")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "uphalfS")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "uphalf0")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "half0")(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma mulnn *) +let mulnn = section_proof ["m"] `m * m = m ^ 2` [ + (((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `2 = SUC (SUC 0)`)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "expnS")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "expn0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "muln1")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sqrn_add *) +let sqrn_add = section_proof ["m";"n"] `(m + n) ^ 2 = (m ^ 2 + n ^ 2) + 2 * (m * n)` [ + ((repeat_tactic 1 9 (((use_arg_then "mulnn")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "mul2n")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "muln_addr")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "muln_addl")(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then "mulnC") (fun fst_arg -> (use_arg_then "n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "addnA")(gsym_then (thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "EQ_ADD_LCANCEL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addnA")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addnn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addnC")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sqrn_sub *) +let sqrn_sub = section_proof ["m";"n"] `n <= m ==> (m - n) ^ 2 = (m ^ 2 + n ^ 2) - 2 * (m * n)` [ + ((DISCH_THEN (fun snd_th -> (use_arg_then "subnK") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["def_m"])); + ((((use_arg_then "def_m")(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then "sqrn_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addnA")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "addnAC")(thm_tac (new_rewrite [] []))))); + (((repeat_tactic 2 0 (((use_arg_then "addnA")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "addnn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "mul2n")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "muln_addr")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "mulnn")(gsym_then (thm_tac (new_rewrite [] [(`n EXP 2`)]))))) THEN (((use_arg_then "muln_addl")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "def_m")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addnK")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sqrn_add_sub *) +let sqrn_add_sub = section_proof ["m";"n"] `n <= m ==> (m + n) ^ 2 - 4 * (m * n) = (m - n) ^ 2` [ + ((BETA_TAC THEN (move ["le_nm"])) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `4 = 2 * 2`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "mulnA")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "mul2n")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addnn")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "subn_sub")(gsym_then (thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "sqrn_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addnK")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "sqrn_sub")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma subn_sqr *) +let subn_sqr = section_proof ["m";"n"] `m ^ 2 - n ^ 2 = (m - n) * (m + n)` [ + (((((use_arg_then "muln_subl")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "muln_addr")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "addnC")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "mulnC") (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "subn_add2l")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "mulnn")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma ltn_sqr *) +let ltn_sqr = section_proof ["m";"n"] `(m ^ 2 < n ^ 2) = (m < n)` [ + (((((use_arg_then "ltn_exp2r")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma leq_sqr *) +let leq_sqr = section_proof ["m";"n"] `(m ^ 2 <= n ^ 2) = (m <= n)` [ + (((((use_arg_then "leq_exp2r")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma sqrn_gt0 *) +let sqrn_gt0 = section_proof ["n"] `(0 < n ^ 2) = (0 < n)` [ + ((THENL_FIRST) ((((fun arg_tac -> (use_arg_then "ltn_sqr") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then "exp0n")(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eqn_sqr *) +let eqn_sqr = section_proof ["m";"n"] `(m ^ 2 = n ^ 2) = (m = n)` [ + (((((use_arg_then "eqn_exp2r")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma sqrn_inj *) +let sqrn_inj = section_proof ["m";"n"] `m ^ 2 = n ^ 2 ==> m = n` [ + (BETA_TAC THEN (move ["eq"])); + (((fun arg_tac -> (use_arg_then "expIn") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `0 < 2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["inj"])); + ((((fun arg_tac -> (use_arg_then "inj") (fun fst_arg -> (use_arg_then "eq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; +let leqif = new_definition `!m n c. leqif m n c <=> (m <= n /\ ((m = n) <=> c))`;; + +(* Lemma leqifP *) +let leqifP = section_proof ["m";"n";"c"] `leqif m n c <=> if c then m = n else m < n` [ + ((THENL_FIRST) (((((use_arg_then "ltn_neqAle")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leqif")(thm_tac (new_rewrite [] []))))) THEN (split_tac)) ((((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac))); + ((((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (((use_arg_then "leqnn")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma leqif_imp_le *) +let leqif_imp_le = section_proof ["m";"n";"c"] `leqif m n c ==> m <= n` [ + (((((use_arg_then "leqif")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma leqif_imp_eq *) +let leqif_imp_eq = section_proof ["m";"n";"c"] `leqif m n c ==> (m = n <=> c)` [ + (((((use_arg_then "leqif")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma leqif_refl *) +let leqif_refl = section_proof ["m";"c"] `(leqif m m c) <=> c` [ + (((((use_arg_then "leqif")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leqnn")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leqif_trans *) +let leqif_trans = section_proof ["m1";"m2";"m3";"c1";"c2"] `leqif m1 m2 c1 ==> leqif m2 m3 c2 ==> leqif m1 m3 (c1 /\ c2)` [ + (repeat_tactic 1 9 (((use_arg_then "leqifP")(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((((use_arg_then "c1") (disch_tac [])) THEN (clear_assumption "c1") THEN case) THEN (((use_arg_then "c2") (disch_tac [])) THEN (clear_assumption "c2") THEN case THEN (simp_tac) THEN (move ["lt12"]))) ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then "ltE")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leq_trans") (disch_tac [])) THEN (clear_assumption "leq_trans") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "leqSS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ltnW") (disch_tac [])) THEN (clear_assumption "ltnW") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma monotone_leqif *) +let monotone_leqif = section_proof ["f"] `(!m n. f m <= f n <=> m <= n) ==> + !m n c. (leqif (f m) (f n) c) <=> (leqif m n c)` [ + (BETA_TAC THEN (move ["f_mono"]) THEN (move ["m"]) THEN (move ["n"]) THEN (move ["c"])); + (((repeat_tactic 1 9 (((use_arg_then "leqifP")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "eqn_leq")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "ltnNge")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "f_mono")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma leqif_geq *) +let leqif_geq = section_proof ["m";"n"] `m <= n ==> leqif m n (n <= m)` [ + ((BETA_TAC THEN (move ["lemn"])) THEN (((use_arg_then "leqif")(thm_tac (new_rewrite [] [])))) THEN ((split_tac) THEN ((TRY done_tac))) THEN (((use_arg_then "eqn_leq")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "lemn")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma leqif_eq *) +let leqif_eq = section_proof ["m";"n"] `m <= n ==> leqif m n (m = n)` [ + ((((use_arg_then "leqif")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma geq_leqif *) +let geq_leqif = section_proof ["a";"b";"C"] `leqif a b C ==> ((b <= a) <=> C)` [ + ((((use_arg_then "leqif")(thm_tac (new_rewrite [] [])))) THEN (case THEN (move ["le_ab"])) THEN (((use_arg_then "eqn_leq")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "le_ab")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma ltn_leqif *) +let ltn_leqif = section_proof ["a";"b";"C"] `leqif a b C ==> (a < b <=> ~ C)` [ + (BETA_TAC THEN (move ["le_ab"])); + (((((use_arg_then "ltnNge")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "geq_leqif") (fun fst_arg -> (use_arg_then "le_ab") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leqif_add *) +let leqif_add = section_proof ["m1";"n1";"c1";"m2";"n2";"c2"] `leqif m1 n1 c1 ==> leqif m2 n2 c2 ==> leqif (m1 + m2) (n1 + n2) (c1 /\ c2)` [ + ((((fun arg_tac -> (use_arg_then "monotone_leqif") (fun fst_arg -> (fun arg_tac -> (use_arg_then "leq_add2r") (fun fst_arg -> (use_arg_then "m2") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["le1"])); + (((fun arg_tac -> (use_arg_then "monotone_leqif") (fun fst_arg -> (fun arg_tac -> (use_arg_then "leq_add2l") (fun fst_arg -> (use_arg_then "n1") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))); + (((use_arg_then "leqif_trans") (disch_tac [])) THEN (clear_assumption "leqif_trans") THEN (exact_tac)); +];; + +(* Lemma leqif_mul *) +let leqif_mul = section_proof ["m1";"n1";"c1";"m2";"n2";"c2"] `leqif m1 n1 c1 ==> leqif m2 n2 c2 ==> + leqif (m1 * m2) (n1 * n2) (n1 * n2 = 0 \/ (c1 /\ c2))` [ + (BETA_TAC THEN (move ["le1"]) THEN (move ["le2"])); + ((THENL) (((fun arg_tac -> (use_arg_then "posnP") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n1 * n2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(move ["n12_0"]); ALL_TAC]); + ((((use_arg_then "n12_0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "le2") (disch_tac [])) THEN (clear_assumption "le2") THEN ((use_arg_then "le1") (disch_tac [])) THEN (clear_assumption "le1") THEN ((use_arg_then "n12_0") (disch_tac [])) THEN (clear_assumption "n12_0") THEN BETA_TAC) THEN (((use_arg_then "muln_eq0")(thm_tac (new_rewrite [] []))))); + ((case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((THENL) (((use_arg_then "m2") (disch_tac [])) THEN (clear_assumption "m2") THEN ((use_arg_then "m1") (disch_tac [])) THEN (clear_assumption "m1") THEN case) [ALL_TAC; (move ["m"])]) THEN ((THENL) case [ALL_TAC; (move ["m'"])]) THEN ((repeat_tactic 1 9 (((use_arg_then "leqif")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "muln0")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "mul0n")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "leqnn")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (arith_tac)); + ((((use_arg_then "muln_gt0")(thm_tac (new_rewrite [] [])))) THEN (BETA_TAC THEN (case THEN ((move ["n1_gt0"]) THEN (move ["n2_gt0"]))))); + (((fun arg_tac -> (use_arg_then "posnP") (fun fst_arg -> (use_arg_then "m2") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN ((THENL) case [(move ["m2_0"]); (move ["m2_gt0"])])); + ((((use_arg_then "leqifP")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "le2") (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then "leqif")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["_"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))))))); + (((((use_arg_then "andbC")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "eqn_leq")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "leqNgt")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "m2_0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "muln0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "muln_gt0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "n1_gt0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "n2_gt0")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "n1_gt0") (disch_tac [])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "leq_pmul2l") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then "monotone_leqif") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["Mn1"]))); + (((use_arg_then "le2") (disch_tac [])) THEN (clear_assumption "le2") THEN ((use_arg_then "Mn1") (disch_tac [])) THEN (clear_assumption "Mn1") THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "m2_gt0") (disch_tac [])) THEN (clear_assumption "m2_gt0") THEN (DISCH_THEN (fun snd_th -> (use_arg_then "leq_pmul2r") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then "monotone_leqif") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["Mm2"]))); + (((use_arg_then "le1") (disch_tac [])) THEN (clear_assumption "le1") THEN ((use_arg_then "Mm2") (disch_tac [])) THEN (clear_assumption "Mm2") THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))); + (BETA_TAC THEN (move ["leq1"]) THEN (move ["leq2"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "leqif_trans") (fun fst_arg -> (use_arg_then "leq1") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "leq2") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then "leqifP")(thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> arg_tac (Arg_term (`c1 /\ c2`))) (disch_tac [])) THEN case THEN (simp_tac)); + (((((use_arg_then "eqn_leq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leqNgt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "muln_gt0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "n1_gt0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "n2_gt0")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nat_Cauchy *) +let nat_Cauchy = section_proof ["m";"n"] `leqif (2 * (m * n)) (m ^ 2 + n ^ 2) (m = n)` [ + ((fun arg_tac -> arg_tac (Arg_term (`n <= m`))) (term_tac (wlog_tac (move ["le_nm"])[`m`; `n`]))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "leqP") (fun fst_arg -> (use_arg_then "n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN ((TRY done_tac))) THEN (((((use_arg_then "eq_sym")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "mulnC")(thm_tac (new_rewrite [] [(`m * _1`)]))))) THEN (move ["mn"]))); + ((((use_arg_then "le_nm") (disch_tac [])) THEN (clear_assumption "le_nm") THEN (DISCH_THEN apply_tac)) THEN (((fun arg_tac -> (use_arg_then "ltnW") (fun fst_arg -> (use_arg_then "mn") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (done_tac)); + (BETA_TAC THEN (move ["le_nm"])); + (((use_arg_then "leqifP")(thm_tac (new_rewrite [] [])))); + ((THENL_FIRST) ((THENL) (((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m = n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (move ["ne_mn"])]) (((((use_arg_then "mulnn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addnn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "mul2n")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then "ne_mn")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN ((((use_arg_then "subn_gt0")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "sqrn_sub")(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "sqrn_gt0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "subn_gt0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ltn_neqAle")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "eq_sym")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nat_AGM2 *) +let nat_AGM2 = section_proof ["m";"n"] `leqif (4 * (m * n)) ((m + n) ^ 2) (m = n)` [ + ((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `4 = 2 * 2`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "mulnA")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "mul2n")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addnn")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "sqrn_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leqifP")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "ltn_add2r")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "eqn_addr")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ltn_neqAle")(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> (use_arg_then "leqif_imp_eq") (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "nat_Cauchy") (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "leqif_imp_le") (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "nat_Cauchy") (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "if_same")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +let distn = new_definition `!m n. distn m n = (m - n) + (n - m)`;; + +(* Lemma distnC *) +let distnC = section_proof ["m";"n"] `distn m n = distn n m` [ + (((repeat_tactic 1 9 (((use_arg_then "distn")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "addnC")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma distn_add2l *) +let distn_add2l = section_proof ["d";"m";"n"] `distn (d + m) (d + n) = distn m n` [ + (((repeat_tactic 1 9 (((use_arg_then "distn")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "subn_add2l")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma distn_add2r *) +let distn_add2r = section_proof ["d";"m";"n"] `distn (m + d) (n + d) = distn m n` [ + (((repeat_tactic 1 9 (((use_arg_then "distn")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "subn_add2r")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma distnEr *) +let distnEr = section_proof ["m";"n"] `m <= n ==> distn m n = n - m` [ + (BETA_TAC THEN (move ["le_m_n"])); + (((((use_arg_then "distn")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then "EQ_IMP") (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "leqE") (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "le_m_n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "add0n")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma distnEl *) +let distnEl = section_proof ["m";"n"] `n <= m ==> distn m n = m - n` [ + ((BETA_TAC THEN (move ["le_n_m"])) THEN ((((use_arg_then "distnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "distnEr")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dist0n *) +let dist0n = section_proof ["n"] `distn 0 n = n` [ + (((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN case) [ALL_TAC; (move ["m"])]) THEN ((((use_arg_then "distn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "sub0n")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "subn0")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "add0n")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma distn0 *) +let distn0 = section_proof ["n"] `distn n 0 = n` [ + (((((use_arg_then "distnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "dist0n")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma distnn *) +let distnn = section_proof ["m"] `distn m m = 0` [ + (((repeat_tactic 1 9 (((use_arg_then "distn")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "subnn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addn0")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma distn_eq0 *) +let distn_eq0 = section_proof ["m";"n"] `(distn m n = 0) <=> (m = n)` [ + (((((use_arg_then "distn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "addn_eq0")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "subn_eq0")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "eqn_leq")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma distnS *) +let distnS = section_proof ["m"] `distn m (SUC m) = 1` [ + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "distn_add2r") (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then "add0n")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "add1n")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "dist0n")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma distSn *) +let distSn = section_proof ["m"] `distn (SUC m) m = 1` [ + (((((use_arg_then "distnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "distnS")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma distn_eq1 *) +let distn_eq1 = section_proof ["m";"n"] `(distn m n = 1) <=> (if m < n then SUC m = n else m = SUC n)` [ + ((THENL) (((fun arg_tac -> (fun arg_tac -> (use_arg_then "ltnP") (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(move ["lt_mn"]); (move ["le_mn"])]); + (((((use_arg_then "eq_sym")(thm_tac (new_rewrite [] [(`_ = 1`)])))) THEN (((fun arg_tac -> (use_arg_then "eqn_addr") (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "distnEr")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "subnK")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "add1n")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "ltnW")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((fun arg_tac -> (use_arg_then "eqn_addr") (fun fst_arg -> (use_arg_then "n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "distnEl")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "subnK")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "add1n")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ltnNge")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "le_mn")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma leqif_add_distn *) +let leqif_add_distn = section_proof ["m";"n";"p"] `leqif (distn m p) (distn m n + distn n p) ((m <= n /\ n <= p) \/ (p <= n /\ n <= m))` [ + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`!m p. m <= p ==> leqif (distn m p) (distn m n + distn n p) (m <= n /\ n <= p \/ p <= n /\ n <= m)`))) (term_tac (have_gen_tac [](move ["IH"]))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "leq_total") (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "p") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN ((TRY done_tac))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then "IH") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC)); + (((((use_arg_then "addnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "orbC")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "distnC") (fun fst_arg -> (use_arg_then "n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [(`distn n _`)])))) THEN (repeat_tactic 1 9 (((use_arg_then "distnC")(thm_tac (new_rewrite [] [(`distn p _`)])))))) THEN (done_tac)); + (BETA_TAC THEN (move ["m"]) THEN (move ["p"]) THEN (move ["le_mp"])); + ((((use_arg_then "distnEr")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((THENL) (((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m <= n /\ n <= p`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [((case THEN ((move ["le_mn"]) THEN (move ["le_np"]))) THEN ((simp_tac THEN TRY done_tac))); ALL_TAC]); + (((repeat_tactic 1 9 (((use_arg_then "distnEr")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "addnC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leqifP")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((fun arg_tac -> (use_arg_then "eqn_addr") (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "addnA")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "subnK")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then "negb_and")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "ltnNge")(gsym_then (thm_tac (new_rewrite [] []))))))) THEN ALL_TAC THEN ((THENL) case [(move ["lt_nm"]); (move ["lt_pn"])])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then "ltn_leq_trans") (fun fst_arg -> (use_arg_then "lt_nm") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "le_mp") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["lt_np"])); + (((((use_arg_then "leqifP")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "leqNgt")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "lt_nm")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "lt_np")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "ltn_addl")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "distnEr")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "ltnW")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "ltn_sub2l")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then "leq_ltn_trans") (fun fst_arg -> (use_arg_then "le_mp") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "lt_pn") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["lt_mn"])); + (((((use_arg_then "leqifP")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "leqNgt")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "lt_mn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "lt_pn")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "ltn_addr")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "distnEr")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "ltn_sub2r")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "ltnW")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_add_distn *) +let leq_add_distn = section_proof ["m";"n";"p"] `distn m p <= distn m n + distn n p` [ + ((((fun arg_tac -> (use_arg_then "leqif_imp_le") (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "leqif_add_distn") (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "p") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (done_tac)); +];; + +(* Lemma sqrn_distn *) +let sqrn_distn = section_proof ["m";"n"] `(distn m n) ^ 2 + 2 * (m * n) = m ^ 2 + n ^ 2` [ + ((fun arg_tac -> arg_tac (Arg_term (`n <= m`))) (term_tac (wlog_tac (move ["le_nm"])[`m`; `n`]))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then "leq_total") (fun fst_arg -> (use_arg_then "n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (DISCH_THEN (fun snd_th -> (use_arg_then "le_nm") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then "addnC") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n EXP 2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "mulnC") (fun fst_arg -> (use_arg_then "n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "distnC")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["le_nm"])) THEN ((((use_arg_then "distnEl")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "sqrn_sub")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "subnK")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then "leqif_imp_le") (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "nat_Cauchy") (fun fst_arg -> (use_arg_then "m") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; diff --git a/formal_ineqs/list/list_conversions.hl b/formal_ineqs/list/list_conversions.hl new file mode 100644 index 0000000..7870742 --- /dev/null +++ b/formal_ineqs/list/list_conversions.hl @@ -0,0 +1,523 @@ +(* =========================================================== *) +(* Efficient formal list conversions *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +needs "arith/nat.hl";; +needs "misc/vars.hl";; + +module type List_conversions_sig = + sig + val eval_hd : term -> thm + val hd_conv : term -> thm + val eval_el : term -> term -> thm + val el_conv : term -> thm + val fst_conv : term -> thm + val snd_conv : term -> thm + val eval_length : term -> thm + val length_conv : term -> thm + val eval_zip : term -> term -> thm + val all_conv_univ : (term -> thm) -> term -> thm + val all2_conv_univ : (term -> thm) -> term -> thm + val eval_mem_univ : (term -> thm) -> term -> term -> thm + val mem_conv_univ : (term -> thm) -> term -> thm + val filter_conv_univ : (term -> thm) -> term -> thm + val map_conv_univ : (term -> thm) -> term -> thm + val get_all : thm -> thm list + val select_all : thm -> int list -> thm list + val set_of_list_conv : term -> thm + end;; + + +module List_conversions : List_conversions_sig = struct + +open Arith_nat;; +open Arith_misc;; +open Misc_vars;; + + +let MY_RULE = UNDISCH_ALL o PURE_REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL;; +let MY_RULE_NUM = UNDISCH_ALL o NUMERALS_TO_NUM o PURE_REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL;; + +(******************************) + +(* HD conversions *) + +let HD_A_CONS = prove(`HD (CONS (h:A) t) = h`, REWRITE_TAC[HD]);; + +(* Takes a term `[a;...]` and returns the theorem |- HD [a;...] = a *) +let eval_hd list_tm = + let ltm, t_tm = dest_comb list_tm in + let h_tm = rand ltm in + let list_ty = type_of t_tm and + ty = type_of h_tm in + let h_var = mk_var("h", ty) and + t_var = mk_var("t", list_ty) in + (INST[h_tm, h_var; t_tm, t_var] o INST_TYPE[ty, aty]) HD_A_CONS;; + +(* Takes a term `HD [a;...]` and returns the theorem |- HD [a;...] = a *) +let hd_conv hd_tm = + if (fst o dest_const o rator) hd_tm <> "HD" then failwith "hd_conv" + else eval_hd (rand hd_tm);; + + +(*********************************) +(* EL conversion *) + +let EL_0' = (MY_RULE_NUM o prove)(`EL 0 (CONS (h:A) t) = h`, REWRITE_TAC[EL; HD]);; +let EL_n' = (MY_RULE_NUM o prove)(`0 < n /\ PRE n = m ==> EL n (CONS (h:A) t) = EL m t`, + STRIP_TAC THEN SUBGOAL_THEN `n = SUC m` ASSUME_TAC THENL + [ REPEAT (POP_ASSUM MP_TAC) THEN ARITH_TAC; ALL_TAC ] THEN ASM_REWRITE_TAC[EL; TL]);; + + +(* Takes a raw numeral term and a list term and returns the theorem |- EL n [...] = x *) +let eval_el n_tm list_tm = + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let inst_t = INST_TYPE[ty, aty] in + let el_0, el_n = inst_t EL_0', inst_t EL_n' in + let h_var, t_var = mk_var("h", ty), mk_var("t", list_ty) in + + let rec el_conv_raw = fun n_tm list_tm -> + let h_tm, t_tm = dest_cons list_tm in + let inst0 = INST[h_tm, h_var; t_tm, t_var] in + if n_tm = zero_const then + inst0 el_0 + else + let n_gt0 = (EQT_ELIM o raw_gt0_hash_conv) n_tm in + let pre_n = raw_pre_hash_conv (mk_comb (pre_op_num, n_tm)) in + let m_tm = (rand o concl) pre_n in + let th0 = (MY_PROVE_HYP pre_n o MY_PROVE_HYP n_gt0 o + INST[n_tm, n_var_num; m_tm, m_var_num] o inst0) el_n in + let th1 = el_conv_raw m_tm t_tm in + TRANS th0 th1 in + el_conv_raw n_tm list_tm;; + + + +(* Takes a term `EL n [...]` and returns the theorem |- EL n [...] = x *) +(* Note: n must be a raw numeral term Dx (Dy ... _0) *) +let el_conv el_tm = + let ltm, list_tm = dest_comb el_tm in + let el, n_tm = dest_comb ltm in + if (fst o dest_const) el <> "EL" then failwith "el_conv" + else eval_el n_tm list_tm;; + + + +(*******************************) +(* FST, SND conversions *) + +let FST' = ISPECL[`x:A`; `y:B`] FST;; +let SND' = ISPECL[`x:A`; `y:B`] SND;; + +let fst_conv tm = + let x_tm, y_tm = dest_pair (rand tm) in + let x_ty, y_ty = type_of x_tm, type_of y_tm in + let x_var, y_var = mk_var("x", x_ty), mk_var("y", y_ty) in + (INST[x_tm, x_var; y_tm, y_var] o INST_TYPE[x_ty, aty; y_ty, bty]) FST';; + +let snd_conv tm = + let x_tm, y_tm = dest_pair (rand tm) in + let x_ty, y_ty = type_of x_tm, type_of y_tm in + let x_var, y_var = mk_var("x", x_ty), mk_var("y", y_ty) in + (INST[x_tm, x_var; y_tm, y_var] o INST_TYPE[x_ty, aty; y_ty, bty]) SND';; + + + +(******************************) +(* LENGTH conversions *) + +let LENGTH_0' = (MY_RULE_NUM o prove) (`LENGTH ([]:(A)list) = 0`, REWRITE_TAC[LENGTH]) and + LENGTH_CONS' = prove(`LENGTH (CONS (h:A) t) = SUC (LENGTH t)`, REWRITE_TAC[LENGTH]);; + +(* Takes a term `[...]` and returns the theorem |- LENGTH [...] = n *) +let eval_length list_tm = + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let inst_t = INST_TYPE[ty, aty] in + let length_empty, length_cons = inst_t LENGTH_0', inst_t LENGTH_CONS' in + let h_var, t_var = mk_var("h", ty), mk_var("t", list_ty) in + + let rec length_conv_raw = fun list_tm -> + if (is_comb list_tm) then + let ltm, t_tm = dest_comb list_tm in + let h_tm = rand ltm in + let th0 = INST[h_tm, h_var; t_tm, t_var] length_cons in + let th1' = length_conv_raw t_tm in + let th1 = AP_TERM suc_op_num th1' in + let th2 = raw_suc_conv_hash (rand(concl th1)) in + TRANS (TRANS th0 th1) th2 + else + length_empty in + length_conv_raw list_tm;; + + +(* Takes a term `LENGTH [...]` and returns the theorem |- LENGTH [...] = n *) +let length_conv length_tm = + if (fst o dest_const o rator) length_tm <> "LENGTH" then failwith "length_conv" + else eval_length (rand length_tm);; + + + +(************************) +(* eval_zip *) + +let ZIP_0' = prove(`ZIP ([]:(A)list) ([]:(B)list) = []`, REWRITE_TAC[ZIP]) and + ZIP_CONS' = prove(`ZIP (CONS (h1:A) t1) (CONS (h2:B) t2) = CONS (h1, h2) (ZIP t1 t2)`, + REWRITE_TAC[ZIP]);; + +let eval_zip list1_tm list2_tm = + let list1_ty = type_of list1_tm and + list2_ty = type_of list2_tm in + let ty1 = (hd o snd o dest_type) list1_ty and + ty2 = (hd o snd o dest_type) list2_ty in + let inst_t = INST_TYPE[ty1, aty; ty2, bty] in + let zip0, zip_cons = inst_t ZIP_0', inst_t ZIP_CONS' in + let h1_var, t1_var = mk_var("h1", ty1), mk_var("t1", list1_ty) and + h2_var, t2_var = mk_var("h2", ty2), mk_var("t2", list2_ty) in + + let rec zip_conv_rec = fun list1_tm list2_tm -> + if (is_comb list1_tm) then + let ltm1, t1_tm = dest_comb list1_tm and + ltm2, t2_tm = dest_comb list2_tm in + let h1_tm, h2_tm = rand ltm1, rand ltm2 in + let th0 = INST[h1_tm, h1_var; t1_tm, t1_var; h2_tm, h2_var; t2_tm, t2_var] zip_cons in + let cons_tm = (rator o rand o concl) th0 in + let th1' = zip_conv_rec t1_tm t2_tm in + let th1 = AP_TERM cons_tm th1' in + TRANS th0 th1 + else + zip0 in + zip_conv_rec list1_tm list2_tm;; + + +(******************) +(* ALL conversion *) +(******************) + +let ALL_0' = prove(`ALL P ([]:(A)list) <=> T`, REWRITE_TAC[ALL]) and + ALL_CONS_T' = (MY_RULE o prove)(`(P h <=> T) /\ (ALL P t <=> T) ==> (ALL P (CONS (h:A) t) <=> T)`, + REWRITE_TAC[ALL]) and + ALL_CONS_F2' = (MY_RULE o prove)(`(ALL P t <=> F) ==> (ALL P (CONS (h:A) t) <=> F)`, + SIMP_TAC[ALL]) and + ALL_CONS_F1' = (MY_RULE o prove)(`(P h <=> F) ==> (ALL P (CONS (h:A) t) <=> F)`, + SIMP_TAC[ALL]);; + + +(* Note: p_conv should return theorems of the form |- P a <=> T *) +let all_conv_univ p_conv tm = + let ltm, list_tm = dest_comb tm in + let p_tm = rand ltm in + + let list_ty = type_of list_tm and + p_ty = type_of p_tm in + let ty = (hd o snd o dest_type) list_ty in + let inst_t = INST_TYPE[ty, aty] in + + let all_0, all_t, all_f1, all_f2 = inst_t ALL_0', inst_t ALL_CONS_T', + inst_t ALL_CONS_F1', inst_t ALL_CONS_F2' in + let h_var, t_var = mk_var("h", ty), mk_var("t", list_ty) and + p_var = mk_var("P", p_ty) in + + let rec all_conv_rec = fun list_tm -> + if is_comb list_tm then + let ltm, t_tm = dest_comb list_tm in + let h_tm = rand ltm in + let p_th = p_conv (mk_comb (p_tm, h_tm)) in + let inst = INST[h_tm, h_var; t_tm, t_var; p_tm, p_var] in + if (rand o concl) p_th = t_const then + let all_th = all_conv_rec t_tm in + if (rand o concl) all_th = t_const then + (MY_PROVE_HYP all_th o MY_PROVE_HYP p_th o inst) all_t + else + (MY_PROVE_HYP all_th o inst) all_f2 + else + (MY_PROVE_HYP p_th o inst) all_f1 + else + INST[p_tm, p_var] all_0 in + all_conv_rec list_tm;; + + + +(*******************) +(* ALL2 conversion *) +(*******************) + +let ALL2_0' = prove(`ALL2 P ([]:(A)list) ([]:(B)list) <=> T`, REWRITE_TAC[ALL2]) and + ALL2_CONS_T' = (MY_RULE o prove)(`(P h1 h2 <=> T) /\ (ALL2 P t1 t2 <=> T) ==> + (ALL2 P (CONS (h1:A) t1) (CONS (h2:B) t2) <=> T)`, + REWRITE_TAC[ALL2]) and + ALL2_CONS_F2' = (MY_RULE o prove)(`(ALL2 P t1 t2 <=> F) ==> + (ALL2 P (CONS (h1:A) t1) (CONS (h2:B) t2) <=> F)`, + SIMP_TAC[ALL2]) and + ALL2_CONS_F1' = (MY_RULE o prove)(`(P h1 h2 <=> F) ==> + (ALL2 P (CONS (h1:A) t1) (CONS (h2:B) t2) <=> F)`, + SIMP_TAC[ALL2]);; + + +(* Note: p_conv should return theorems of the form |- P a b <=> T *) +let all2_conv_univ p_conv tm = + let ltm, list2_tm = dest_comb tm in + let ltm2, list1_tm = dest_comb ltm in + let p_tm = rand ltm2 in + + let list1_ty = type_of list1_tm and + list2_ty = type_of list2_tm and + p_ty = type_of p_tm in + let ty1 = (hd o snd o dest_type) list1_ty and + ty2 = (hd o snd o dest_type) list2_ty in + let inst_t = INST_TYPE[ty1, aty; ty2, bty] in + + let all2_0, all2_t, all2_f1, all2_f2 = inst_t ALL2_0', inst_t ALL2_CONS_T', + inst_t ALL2_CONS_F1', inst_t ALL2_CONS_F2' in + let h1_var, t1_var = mk_var("h1", ty1), mk_var("t1", list1_ty) and + h2_var, t2_var = mk_var("h2", ty2), mk_var("t2", list2_ty) and + p_var = mk_var("P", p_ty) in + + let rec all2_conv_rec = fun list1_tm list2_tm -> + if is_comb list1_tm then + let ltm1, t1_tm = dest_comb list1_tm and + ltm2, t2_tm = dest_comb list2_tm in + let h1_tm, h2_tm = rand ltm1, rand ltm2 in + let p_th = p_conv (mk_binop p_tm h1_tm h2_tm) in + let inst = INST[h1_tm, h1_var; t1_tm, t1_var; h2_tm, h2_var; t2_tm, t2_var; p_tm, p_var] in + if (rand o concl) p_th = t_const then + let all2_th = all2_conv_rec t1_tm t2_tm in + if (rand o concl) all2_th = t_const then + (MY_PROVE_HYP all2_th o MY_PROVE_HYP p_th o inst) all2_t + else + (MY_PROVE_HYP all2_th o inst) all2_f2 + else + (MY_PROVE_HYP p_th o inst) all2_f1 + else + if is_comb list2_tm then failwith ("all2_conv_univ: l1 = []; l2 = "^string_of_term list2_tm) else + INST[p_tm, p_var] all2_0 in + all2_conv_rec list1_tm list2_tm;; + + + +(******************************) +(* MEM conversions *) + +let MEM_A_EMPTY = prove(`MEM (x:A) [] <=> F`, REWRITE_TAC[MEM]) and + MEM_A_HD = MY_RULE (prove(`(x = h <=> T) ==> (MEM (x:A) (CONS h t) <=> T)`,SIMP_TAC[MEM])) and + MEM_A_TL = MY_RULE (prove(`(x = h <=> F) ==> (MEM (x:A) (CONS h t) <=> MEM x t)`, SIMP_TAC[MEM]));; + + +let rec eval_mem_univ eq_conv x_tm list_tm = + let ty = type_of x_tm in + let inst_t = INST_TYPE[ty, aty] in + let mem_empty, mem_hd, mem_tl = inst_t MEM_A_EMPTY, inst_t MEM_A_HD, inst_t MEM_A_TL in + let x_var, h_var = mk_var("x", ty), mk_var("h", ty) and + t_var = mk_var("t", mk_type("list", [ty])) in + + let rec mem_conv_raw list_tm = + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let eq_th = eq_conv (mk_eq(x_tm, h_tm)) in + if (rand(concl eq_th) = t_const) then + let th0' = INST[x_tm, x_var; h_tm, h_var; t_tm, t_var] mem_hd in + MY_PROVE_HYP eq_th th0' + else + let th0' = INST[x_tm, x_var; h_tm, h_var; t_tm, t_var] mem_tl in + let th0 = MY_PROVE_HYP eq_th th0' in + let th1 = mem_conv_raw t_tm in + TRANS th0 th1 + else + INST[x_tm, x_var] mem_empty in + + mem_conv_raw list_tm;; + + +let mem_conv_univ eq_conv mem_tm = + let ltm, list_tm = dest_comb mem_tm in + let c_tm, x_tm = dest_comb ltm in + if (fst o dest_const) c_tm <> "MEM" then failwith "mem_conv_univ" else + eval_mem_univ eq_conv x_tm list_tm;; + + + +(**********************************) +(* FILTER conversions *) + +let FILTER_A_EMPTY = prove(`FILTER (P:A->bool) [] = []`, REWRITE_TAC[FILTER]) and + FILTER_A_HD = (MY_RULE o prove)(`(P h <=> T) ==> FILTER (P:A->bool) (CONS h t) = CONS h (FILTER P t)`, + SIMP_TAC[FILTER]) and + FILTER_A_TL = (MY_RULE o prove)(`(P h <=> F) ==> FILTER (P:A->bool) (CONS h t) = FILTER P t`, + SIMP_TAC[FILTER]);; + + +let filter_conv_univ p_conv tm = + let ltm, list_tm = dest_comb tm in + let p_tm = rand ltm in + let p_ty = type_of p_tm in + let ty = (hd o snd o dest_type) p_ty in + let inst_t = INST_TYPE[ty, aty] in + let filter_empty, filter_hd, filter_tl = + inst_t FILTER_A_EMPTY, inst_t FILTER_A_HD, inst_t FILTER_A_TL in + let p_var = mk_var("P", p_ty) in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", mk_type("list",[ty])) in + + let rec filter_conv_raw = fun list_tm -> + if (is_comb list_tm) then + let ltm, t_tm = dest_comb list_tm in + let h_tm = rand ltm in + let p_th = p_conv (mk_comb(p_tm, h_tm)) in + if (rand(concl p_th) = t_const) then + let th0' = INST[p_tm, p_var; h_tm, h_var; t_tm, t_var] filter_hd in + let th0 = MY_PROVE_HYP p_th th0' in + let ltm = rator(rand(concl th0)) in + let th1 = filter_conv_raw t_tm in + TRANS th0 (AP_TERM ltm th1) + else + let th0' = INST[p_tm, p_var; h_tm, h_var; t_tm, t_var] filter_tl in + let th0 = MY_PROVE_HYP p_th th0' in + let th1 = filter_conv_raw t_tm in + TRANS th0 th1 + else + INST[p_tm, p_var] filter_empty in + filter_conv_raw list_tm;; + + + +(***************************) +(* MAP conversions *) + +let MAP_AB_EMPTY = prove(`MAP (f:A->B) [] = []`, REWRITE_TAC[MAP]) and + MAP_AB_CONS = prove(`MAP (f:A->B) (CONS h t) = CONS (f h) (MAP f t)`, REWRITE_TAC[MAP]);; + + +let map_conv_univ f_conv tm = + let ltm, list_tm = dest_comb tm in + let ftm = rand ltm in + let ftm_ty = type_of ftm in + let f_var = mk_var("f", ftm_ty) in + let [a_type; b_type] = snd(dest_type ftm_ty) in + let h_var = mk_var("h", a_type) in + let t_var = mk_var("t", mk_type("list", [a_type])) in + let inst_t = INST[ftm, f_var] o INST_TYPE[a_type, aty; b_type, bty] in + let map_empty, map_cons = + inst_t MAP_AB_EMPTY, inst_t MAP_AB_CONS in + + let rec map_conv_raw list_tm = + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let th0 = INST[h_tm, h_var; t_tm, t_var] map_cons in + let ltm, rtm = dest_comb (rand(concl th0)) in + let cons_tm, f_h_tm = dest_comb ltm in + let f_h_th = f_conv f_h_tm in + let map_t_th = map_conv_raw t_tm in + TRANS th0 (MK_COMB (AP_TERM cons_tm f_h_th, map_t_th)) + else + map_empty in + + map_conv_raw list_tm;; + + +(*****************************************) +(* ALL rules *) + +let ALL_A_HD = UNDISCH_ALL(prove(`ALL (P:A->bool) (CONS h t) ==> P h`, SIMP_TAC[ALL])) and + ALL_A_TL = UNDISCH_ALL(prove(`ALL (P:A->bool) (CONS h t) ==> ALL P t`, SIMP_TAC[ALL]));; + + +(* Given a theorem `ALL P list` returns the list of theorems (P x1),...,(P xn) *) +let get_all th = + let ltm, list_tm = dest_comb (concl th) in + let p_tm = rand ltm in + let list_ty = type_of list_tm in + let p_ty = type_of p_tm in + let ty = (hd o snd o dest_type) list_ty in + let p_var = mk_var("P", p_ty) in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", list_ty) in + + let inst_t = INST[p_tm, p_var] o INST_TYPE[ty, aty] in + let all_hd, all_tl = inst_t ALL_A_HD, inst_t ALL_A_TL in + + let rec get_all_raw all_th list_tm = + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let inst_t = INST[h_tm, h_var; t_tm, t_var] in + let th_tl = MY_PROVE_HYP all_th (inst_t all_tl) in + let th_hd = MY_PROVE_HYP all_th (inst_t all_hd) in + th_hd :: get_all_raw th_tl t_tm + else + [] in + get_all_raw th list_tm;; + + + +(* Given a theorem `ALL P list`, returns (P x_i1),..., (P x_in) + where i1,...,in are given indices. + The list of indices should be sorted *) +let select_all th indices = + let ltm, list_tm = dest_comb (concl th) in + let p_tm = rand ltm in + let list_ty = type_of list_tm in + let p_ty = type_of p_tm in + let ty = (hd o snd o dest_type) list_ty in + let p_var = mk_var("P", p_ty) in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", list_ty) in + + let inst_t = INST[p_tm, p_var] o INST_TYPE[ty, aty] in + let all_hd, all_tl = inst_t ALL_A_HD, inst_t ALL_A_TL in + + let rec get_all_raw all_th list_tm indices n = + match indices with + [] -> [] + | i::is -> + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let inst_t = INST[h_tm, h_var; t_tm, t_var] in + let th_tl = MY_PROVE_HYP all_th (inst_t all_tl) in + + if (i - n = 0) then + let th_hd = MY_PROVE_HYP all_th (inst_t all_hd) in + th_hd :: get_all_raw th_tl t_tm is (n + 1) + else + get_all_raw th_tl t_tm (i::is) (n + 1) in + get_all_raw th list_tm indices 0;; + + +(*****************************************) +(* set_of_list conversions *) + +let SET_OF_LIST_A_EMPTY = prove(`set_of_list ([]:(A)list) = {}`, REWRITE_TAC[set_of_list]) and + SET_OF_LIST_A_H = prove(`set_of_list [h:A] = {h}`, REWRITE_TAC[set_of_list]) and + SET_OF_LIST_A_CONS = prove(`set_of_list (CONS (h:A) t) = h INSERT set_of_list t`, REWRITE_TAC[set_of_list]);; + + +let set_of_list_conv tm = + let list_tm = rand tm in + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", list_ty) in + let inst_t = INST_TYPE[ty, aty] in + let set_of_list_h, set_of_list_cons = inst_t SET_OF_LIST_A_H, inst_t SET_OF_LIST_A_CONS in + + let rec set_of_list_conv_raw = fun h_tm t_tm -> + if (is_comb t_tm) then + let h_tm', t_tm' = dest_comb t_tm in + let th0 = INST[h_tm, h_var; t_tm, t_var] set_of_list_cons in + let ltm, rtm = dest_comb(rand(concl th0)) in + TRANS th0 (AP_TERM ltm (set_of_list_conv_raw (rand h_tm') t_tm')) + else + INST[h_tm, h_var] set_of_list_h in + + if (is_comb list_tm) then + let h_tm, t_tm = dest_comb list_tm in + set_of_list_conv_raw (rand h_tm) t_tm + else + inst_t SET_OF_LIST_A_EMPTY;; + + +end;; diff --git a/formal_ineqs/list/list_float.hl b/formal_ineqs/list/list_float.hl new file mode 100644 index 0000000..b191cb7 --- /dev/null +++ b/formal_ineqs/list/list_float.hl @@ -0,0 +1,202 @@ +(* =========================================================== *) +(* Special list conversions *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +needs "arith/more_float.hl";; +needs "list/list_conversions.hl";; +needs "misc/vars.hl";; + + +module type List_float_sig = sig + val list_sum : thm + val list_sum2 : thm + val error_mul_f2 : thm + val error_mul_f1 : thm + val list_sum_conv : (term -> thm) -> term -> thm + val list_sum2_le_conv : int -> (int -> term -> term -> thm) -> term -> thm + val error_mul_f2_le_conv : int -> term -> term -> thm + val error_mul_f2_le_conv2 : int -> term -> term -> thm + val error_mul_f1_le_conv : term -> int -> term -> term -> thm +end;; + + +module List_float : List_float_sig = struct + +open Arith_misc;; +open Arith_nat;; +open Arith_float;; +open More_float;; +open Float_theory;; +open List_conversions;; +open Misc_vars;; + +let MY_RULE_FLOAT = UNDISCH_ALL o NUMERALS_TO_NUM o + PURE_REWRITE_RULE[FLOAT_OF_NUM; min_exp_def; GSYM IMP_IMP] o SPEC_ALL;; + + +(****************************) +(* new definitions *) + +let list_sum = new_definition `list_sum list f = ITLIST (\t1 t2. f t1 + t2) list (&0)`;; +let list_sum2 = new_definition `list_sum2 f l1 l2 = ITLIST2 (\a b c. f a b + c) l1 l2 (&0)`;; + +let error_mul_f2 = new_definition `error_mul_f2 a int = a * iabs int`;; +let error_mul_f1 = new_definition `error_mul_f1 w x list = x * list_sum2 error_mul_f2 w list`;; + +(*************************************) +(* list_sum conversions *) + +let LIST_SUM_A_EMPTY = prove(`list_sum [] (f:A->real) = &0`, REWRITE_TAC[list_sum; ITLIST]) and + LIST_SUM_A_H = prove(`list_sum [h:A] f = f h`, REWRITE_TAC[list_sum; ITLIST; REAL_ADD_RID]) and + LIST_SUM_A_CONS = prove(`list_sum (CONS (h:A) t) f = f h + list_sum t f`, REWRITE_TAC[list_sum; ITLIST]);; + + +let list_sum_conv f_conv tm = + let ltm, f_tm = dest_comb tm in + let list_tm = rand ltm in + let list_ty = type_of list_tm in + let f_ty = type_of f_tm in + let ty = (hd o snd o dest_type) list_ty in + let f_var = mk_var("f", f_ty) and + h_var = mk_var("h", ty) and + t_var = mk_var("t", list_ty) in + let inst_t = INST[f_tm, f_var] o INST_TYPE[ty, aty] in + let list_sum_h = inst_t LIST_SUM_A_H and + list_sum_cons = inst_t LIST_SUM_A_CONS in + + let rec list_sum_conv_raw = fun h_tm t_tm -> + if (is_comb t_tm) then + let h_tm', t_tm' = dest_comb t_tm in + let th0 = INST[h_tm, h_var; t_tm, t_var] list_sum_cons in + let ltm, rtm = dest_comb(rand(concl th0)) in + let plus_op, fh_tm = dest_comb ltm in + let f_th = f_conv fh_tm in + let th1 = list_sum_conv_raw (rand h_tm') t_tm' in + let th2 = MK_COMB(AP_TERM plus_op f_th, th1) in + TRANS th0 th2 + else + let th0 = INST[h_tm, h_var] list_sum_h in + let f_th = f_conv (rand(concl th0)) in + TRANS th0 f_th in + + if (is_comb list_tm) then + let h_tm, t_tm = dest_comb list_tm in + list_sum_conv_raw (rand h_tm) t_tm + else + inst_t LIST_SUM_A_EMPTY;; + + + +(*************************************) +(* list_sum2 evaluation *) + +let LIST_SUM2_0_LE' = (MY_RULE_FLOAT o prove)(`list_sum2 (f:A->B->real) [] [] <= &0`, + REWRITE_TAC[list_sum2; ITLIST2; REAL_LE_REFL]);; +let LIST_SUM2_1_LE' = (MY_RULE_FLOAT o prove)(`f h1 h2 <= x ==> list_sum2 (f:A->B->real) [h1] [h2] <= x`, + REWRITE_TAC[list_sum2; ITLIST2; REAL_ADD_RID]);; +let LIST_SUM2_LE' = (MY_RULE_FLOAT o prove)(`f h1 h2 <= x /\ list_sum2 f t1 t2 <= y /\ x + y <= z ==> + list_sum2 (f:A->B->real) (CONS h1 t1) (CONS h2 t2) <= z`, + REWRITE_TAC[list_sum2; ITLIST2] THEN STRIP_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `x + y:real` THEN + ASM_SIMP_TAC[REAL_LE_ADD2]);; + + +let list_sum2_le_conv pp f_le_conv tm = + let ltm, list2_tm = dest_comb tm in + let ltm2, list1_tm = dest_comb ltm in + let f_tm = rand ltm2 in + let list1_ty = type_of list1_tm and + list2_ty = type_of list2_tm and + f_ty = type_of f_tm in + let ty1 = (hd o snd o dest_type) list1_ty and + ty2 = (hd o snd o dest_type) list2_ty in + let f_var = mk_var ("f", f_ty) and + h1_var, t1_var = mk_var ("h1", ty1), mk_var ("t1", list1_ty) and + h2_var, t2_var = mk_var ("h2", ty2), mk_var ("t2", list2_ty) in + let inst_t = INST[f_tm, f_var] o INST_TYPE[ty1, aty; ty2, bty] in + let list2_0, list2_1, list2_le = inst_t LIST_SUM2_0_LE', inst_t LIST_SUM2_1_LE', inst_t LIST_SUM2_LE' in + + let rec rec_conv = fun list1_tm list2_tm -> + if (is_comb list1_tm) then + let h1_tm, t1_tm = dest_cons list1_tm and + h2_tm, t2_tm = dest_cons list2_tm in + let f_le_th = f_le_conv pp h1_tm h2_tm in + let x_tm = (rand o concl) f_le_th in + let inst0 = INST[h1_tm, h1_var; h2_tm, h2_var; x_tm, x_var_real] in + if is_comb t1_tm then + let sum2_t_th = rec_conv t1_tm t2_tm in + let y_tm = (rand o concl) sum2_t_th in + let xy_th = float_add_hi pp x_tm y_tm in + let z_tm = (rand o concl) xy_th in + (MY_PROVE_HYP xy_th o MY_PROVE_HYP sum2_t_th o MY_PROVE_HYP f_le_th o + INST[y_tm, y_var_real; z_tm, z_var_real; t1_tm, t1_var; t2_tm, t2_var] o + inst0) list2_le + else + if is_comb t2_tm then failwith ("sum2_le_conv: t1 = []; t2 = "^string_of_term t2_tm) else + (MY_PROVE_HYP f_le_th o inst0) list2_1 + else + if is_comb list2_tm then failwith ("sum2_le_conv: list1 = []; list2 = "^string_of_term list2_tm) else + list2_0 in + + rec_conv list1_tm list2_tm;; + + + +(**************************) +(* \a b c. a * iabs b + c *) + +let ERROR_MUL_F2' = (SYM o MY_RULE_FLOAT) error_mul_f2;; + + +(* |- x = a, |- P x y -> P a y *) +let rewrite_lhs eq_th th = + let ltm, rhs = dest_comb (concl th) in + let th0 = AP_THM (AP_TERM (rator ltm) eq_th) rhs in + EQ_MP th0 th;; + +let error_mul_f2_le_conv pp tm1 tm2 = + let eq_th = INST[tm1, a_var_real; tm2, int_var] ERROR_MUL_F2' in + let iabs_th = float_iabs tm2 in + let iabs_tm = (rand o concl) iabs_th in + let mul_th = float_mul_hi pp tm1 iabs_tm in + let th0 = AP_TERM (mk_comb (mul_op_real, tm1)) iabs_th in + let th1 = AP_THM (AP_TERM le_op_real th0) (rand (concl mul_th)) in + let le_th = EQ_MP (SYM th1) mul_th in + rewrite_lhs eq_th le_th;; + +let ERROR_MUL_F2_LEMMA' = (MY_RULE_FLOAT o prove)(`iabs int = x /\ a * x <= y ==> error_mul_f2 a int <= y`, + REWRITE_TAC[error_mul_f2] THEN STRIP_TAC THEN ASM_REWRITE_TAC[]);; + +let error_mul_f2_le_conv2 pp tm1 tm2 = + let iabs_th = float_iabs tm2 in + let x_tm = (rand o concl) iabs_th in + let mul_th = float_mul_hi pp tm1 x_tm in + let y_tm = (rand o concl) mul_th in + (MY_PROVE_HYP iabs_th o MY_PROVE_HYP mul_th o + INST[tm2, int_var; tm1, a_var_real; x_tm, x_var_real; y_tm, y_var_real]) ERROR_MUL_F2_LEMMA';; + + + +(**************************) +(* \a b c. a * iabs b + c *) + +let ERROR_MUL_F1_LEMMA' = (MY_RULE_FLOAT o prove)(`x * list_sum2 error_mul_f2 w list <= z ==> + error_mul_f1 w x list <= z`, REWRITE_TAC[error_mul_f1]);; + +let list_sum2_error2_const = `list_sum2 error_mul_f2` and + w_var_list = `w:(real)list` and + list_var = `list:(real#real)list`;; + +let error_mul_f1_le_conv w_tm pp x_tm list_tm = + (* TODO: if x = 0 then do not need to compute the sum *) + let sum2_tm = mk_binop list_sum2_error2_const w_tm list_tm in + let sum2_le_th = list_sum2_le_conv pp error_mul_f2_le_conv2 sum2_tm in + let ineq_th = mul_ineq_pos_const_hi pp x_tm sum2_le_th in + let z_tm = (rand o concl) ineq_th in + (MY_PROVE_HYP ineq_th o + INST[x_tm, x_var_real; z_tm, z_var_real; w_tm, w_var_list; list_tm, list_var]) ERROR_MUL_F1_LEMMA';; + + +end;; diff --git a/formal_ineqs/list/more_list.hl b/formal_ineqs/list/more_list.hl new file mode 100644 index 0000000..861fd34 --- /dev/null +++ b/formal_ineqs/list/more_list.hl @@ -0,0 +1,128 @@ +(* =========================================================== *) +(* Additional list definitions and theorems *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +module More_list = struct + +(* definitions *) +let REVERSE_TABLE = define `(REVERSE_TABLE (f:num->A) 0 = []) /\ + (REVERSE_TABLE f (SUC i) = CONS (f i) ( REVERSE_TABLE f i))`;; + +let TABLE = new_definition `!(f:num->A) k. TABLE f k = REVERSE (REVERSE_TABLE f k)`;; + +let l_seq = new_definition `l_seq n m = TABLE (\i. n + i) ((m + 1) - n)`;; + +(* lemmas *) +let LENGTH_REVERSE_TABLE = prove(`!(f:num->A) n. LENGTH (REVERSE_TABLE f n) = n`, + GEN_TAC THEN INDUCT_TAC THEN ASM_REWRITE_TAC[REVERSE_TABLE; LENGTH]);; + +let LENGTH_REVERSE = prove(`!(l:(A)list). LENGTH (REVERSE l) = LENGTH l`, + MATCH_MP_TAC list_INDUCT THEN REWRITE_TAC[REVERSE] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[LENGTH_APPEND; LENGTH] THEN + ARITH_TAC);; + +let LENGTH_TABLE = prove(`!(f:num->A) n. LENGTH (TABLE f n) = n`, + REWRITE_TAC[TABLE; LENGTH_REVERSE; LENGTH_REVERSE_TABLE]);; + +let EL_TABLE = prove(`!(f:num->A) n i. i < n ==> EL i (TABLE f n) = f i`, + REPEAT GEN_TAC THEN SPEC_TAC (`n:num`, `n:num`) THEN + INDUCT_TAC THENL [ ARITH_TAC; ALL_TAC ] THEN + REWRITE_TAC[TABLE; REVERSE_TABLE; REVERSE; EL_APPEND] THEN + REWRITE_TAC[GSYM TABLE; LENGTH_TABLE] THEN + DISCH_TAC THEN COND_CASES_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + SUBGOAL_THEN `i = n:num` (fun th -> REWRITE_TAC[th]) THENL + [ + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[ARITH_RULE `n - n = 0`; EL; HD]);; + +let LIST_EL_EQ = prove(`!ul vl:(A)list. ul = vl <=> + (LENGTH ul = LENGTH vl /\ (!j. j < LENGTH ul ==> EL j ul = EL j vl))`, + REPEAT STRIP_TAC THEN + EQ_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + SPEC_TAC (`vl:(A)list`, `vl:(A)list`) THEN SPEC_TAC (`ul:(A)list`, `ul:(A)list`) THEN + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN SIMP_TAC[LENGTH_EQ_NIL; EQ_SYM_EQ; LENGTH; ARITH_RULE `~(0 = SUC a)`] THEN + POP_ASSUM (fun th -> ALL_TAC) THEN + REWRITE_TAC[ARITH_RULE `SUC a = SUC b <=> a = b`] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `t':(A)list`) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL + [ + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `SUC j`) THEN + ASM_REWRITE_TAC[ARITH_RULE `SUC a < SUC b <=> a < b`; EL; TL]; + ALL_TAC + ] THEN + DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `0`) THEN + ASM_SIMP_TAC[ARITH_RULE `0 < SUC a`; EL; HD]);; + + +let LENGTH_L_SEQ = prove(`LENGTH (l_seq n m) = (m + 1) - n`, REWRITE_TAC[l_seq; LENGTH_TABLE]);; + +let EL_L_SEQ = prove(`!i m n. i < (m + 1) - n ==> EL i (l_seq n m) = n + i`, + REWRITE_TAC[l_seq] THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC EL_TABLE THEN ASM_REWRITE_TAC[]);; + +let L_SEQ_NIL = prove(`!n m. l_seq n m = [] <=> (m < n)`, + GEN_TAC THEN GEN_TAC THEN REWRITE_TAC[GSYM LENGTH_EQ_NIL; LENGTH_L_SEQ] THEN ARITH_TAC);; + +let L_SEQ_NN = prove(`!n. l_seq n n = [n]`, + GEN_TAC THEN REWRITE_TAC[l_seq; ARITH_RULE `(n + 1) - n = 1`; ONE; TABLE; REVERSE_TABLE; REVERSE] THEN + REWRITE_TAC[APPEND; ADD_0]);; + +let L_SEQ_CONS = prove(`!n m. n <= m ==> l_seq n m = CONS n (l_seq (n + 1) m)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[LIST_EL_EQ; LENGTH_L_SEQ; LENGTH] THEN CONJ_TAC THENL + [ + ASM_ARITH_TAC; + ALL_TAC + ] THEN + INDUCT_TAC THENL + [ + ASM_SIMP_TAC[EL_L_SEQ] THEN ASM_REWRITE_TAC[EL; HD] THEN ARITH_TAC; + DISCH_TAC THEN + ASM_SIMP_TAC[EL_L_SEQ] THEN ASM_REWRITE_TAC[EL; TL] THEN + MP_TAC (SPECL [`j:num`; `m:num`; `n + 1`] EL_L_SEQ) THEN ANTS_TAC THENL + [ + ASM_ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN ARITH_TAC + ]);; + + +let LENGTH_BUTLAST = prove(`!l. LENGTH (BUTLAST l) = LENGTH l - 1`, + MATCH_MP_TAC list_INDUCT THEN REWRITE_TAC[BUTLAST; LENGTH; ARITH] THEN REPEAT STRIP_TAC THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[LENGTH; ARITH] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM LENGTH_EQ_NIL] THEN + ARITH_TAC);; + +let EL_BUTLAST = prove(`!(l:(A)list) i. i < LENGTH l - 1 ==> EL i (BUTLAST l) = EL i l`, + MATCH_MP_TAC list_INDUCT THEN REWRITE_TAC[BUTLAST; LENGTH] THEN REPEAT STRIP_TAC THEN + COND_CASES_TAC THENL + [ + UNDISCH_TAC `i < SUC (LENGTH (a1:(A)list)) - 1` THEN + ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[EL_CONS] THEN COND_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i - 1`) THEN + ANTS_TAC THENL + [ + ASM_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[]);; + +end;; diff --git a/formal_ineqs/misc/misc.hl b/formal_ineqs/misc/misc.hl new file mode 100644 index 0000000..6433936 --- /dev/null +++ b/formal_ineqs/misc/misc.hl @@ -0,0 +1,63 @@ +(* =========================================================== *) +(* Miscellaneous functions *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +#load "unix.cma";; + +module Arith_misc = struct + +(* A little faster version of PROVE_HYP *) +let MY_PROVE_HYP hyp th = EQ_MP (DEDUCT_ANTISYM_RULE hyp th) hyp;; + +(* A faster version of BETA_RULE *) +let MY_BETA_RULE th = + let rec beta tm = + let op, arg = dest_comb tm in + if is_comb op then + let op_th = AP_THM (beta op) arg in + let beta_th = BETA_CONV (rand (concl op_th)) in + TRANS op_th beta_th + else + BETA_CONV tm in + EQ_MP (beta (concl th)) th;; + + +(* Applies f to arg n times and returns the total execution time *) +let test n f arg = + let start = Unix.gettimeofday() in + for i = 1 to n do + let _ = f arg in () + done; + Unix.gettimeofday() -. start;; + +(* Generates a power function for the given binary operation *) +let gen_pow op id n x = + let ( * ) = op in + let rec pow n = + if n <= 0 then id + else if n = 1 then x + else if n land 1 = 1 then + x * pow (n - 1) + else + let t = pow (n lsr 1) in + t * t in + pow n;; + +let rec shape_list n list = + if length list <= n then [list] + else + let l1, l2 = chop_list n list in + l1 :: shape_list n l2;; + +(* map2 which works for lists of any size (no requirement |l1| = |l2|) *) +let rec my_map2 f l1 l2 = + match l1 with + | [] -> [] + | (h1::t1) -> + (match l2 with + | [] -> [] + | (h2::t2) -> (f h1 h2) :: my_map2 f t1 t2);; + +end;; diff --git a/formal_ineqs/misc/vars.hl b/formal_ineqs/misc/vars.hl new file mode 100644 index 0000000..4855b5b --- /dev/null +++ b/formal_ineqs/misc/vars.hl @@ -0,0 +1,148 @@ +(* =========================================================== *) +(* Commonly used variables and constants *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +module Misc_vars = struct + +(* bool variables *) +let s_var_bool = `s:bool` and + s1_var_bool = `s1:bool` and + s2_var_bool = `s2:bool`;; + +(* num variables *) +let n_var_num = `n:num` and + m_var_num = `m:num` and + t_var_num = `t:num` and + p_var_num = `p:num` and + q_var_num = `q:num` and + k_var_num = `k:num` and + e_var_num = `e:num` and + e1_var_num = `e1:num` and + e2_var_num = `e2:num` and + r_var_num = `r:num` and + r1_var_num = `r1:num` and + r2_var_num = `r2:num` and + n1_var_num = `n1:num` and + n2_var_num = `n2:num` and + m1_var_num = `m1:num` and + m2_var_num = `m2:num` and + x_var_num = `x:num` and + y_var_num = `y:num` and + i_var_num = `i:num` and + j_var_num = `j:num`;; + +(* real variables *) +let x_var_real = `x : real` and + y_var_real = `y : real` and + z_var_real = `z : real` and + w_var_real = `w : real` and + a_var_real = `a : real` and + b_var_real = `b : real` and + m_var_real = `m : real` and + n_var_real = `n : real` and + x1_var_real = `x1 : real` and + x2_var_real = `x2 : real` and + y1_var_real = `y1 : real` and + y2_var_real = `y2 : real` and + f1_var_real = `f1 : real` and + f2_var_real = `f2 : real` and + f_var_fun = `f : real->real` and + g_var_fun = `g : real->real` and + f1_var_fun = `f1 : real->real` and + f2_var_fun = `f2 : real->real` and + int_var = `int : real#real` and + f_bounds_var = `f_bounds : real#real` and + df_bounds_var = `df_bounds : real#real` and + dd_bounds_var = `dd_bounds : real#real` and + x_lo_var = `x_lo : real` and + x_hi_var = `x_hi : real` and + lo_var_real = `lo : real` and + hi_var_real = `hi : real` and + dd_var_real = `dd : real` and + df_lo_var = `df_lo : real` and + df_hi_var = `df_hi : real` and + df_var_real = `df : real` and + f_lo_var = `f_lo : real` and + f_hi_var = `f_hi : real` and + w1_var_real = `w1 : real` and + w2_var_real = `w2 : real` and + t_var_real = `t : real` and + g_bounds_var = `g_bounds : real#real` and + dg_bounds_var = `dg_bounds : real#real` and + bounds_var = `bounds : real#real` and + d_bounds_var = `d_bounds : real#real` and + x0_var_real = `x0 : real` and + z0_var_real = `z0 : real` and + w0_var_real = `w0 : real` and + error_var = `error : real` and + d_bounds_list_var = `d_bounds_list : (real#real)list` and + dd_bounds_list_var = `dd_bounds_list : ((real#real)list)list` and + df_bounds_list_var = `df_bounds_list : (real#real)list` and + dd_list_var = `dd_list : (real#real)list` and + x_var_real_list = `x:(real)list` and + y_var_real_list = `y:(real)list` and + z_var_real_list = `z:(real)list` and + w_var_real_list = `w:(real)list` and + yw_var = `yw : (real#real)list` and + xz_var = `xz : (real#real)list` and + xz_pair_var = `xz : real#real` and + yw_pair_var = `yw : real#real` and + list_var_real_pair = `list : (real#real)list`;; + +(* bool constants *) +let t_const = `T` and + f_const = `F`;; + +(* num constants *) +let zero_const = `_0` and + zero_num = `0`;; + +(* num operations *) +let add_op_num = `(+) : num->num->num` and + sub_op_num = `(-) : num->num->num` and + mul_op_num = `( * ) : num->num->num` and + eq_op_num = `(=) : num->num->bool` and + le_op_num = `(<=) : num->num->bool` and + lt_op_num = `(<) : num->num->bool` and + div_op_num = `(DIV): num->num->num` and + pre_op_num = `PRE: num->num` and + suc_op_num = `SUC : num->num`;; + + +(* real constants *) +let real_empty_list = `[]:(real)list`;; + +(* real operations *) +let add_op_real = `(+) : real->real->real` and + mul_op_real = `( * ) : real->real->real` and + sub_op_real = `(-) : real->real->real` and + div_op_real = `(/) :real->real->real` and + inv_op_real = `inv : real->real` and + neg_op_real = `(--) : real->real` and + eq_op_real = `(=) : real->real->bool` and + lt_op_real = `(<) : real->real->bool` and + le_op_real = `(<=):real->real->bool` and + ge_op_real = `(>=):real->real->bool` and + amp_op_real = `(&) : num->real` and + pow_op_real = `(pow) : real->num->real`;; + +(* types *) +let real_ty = `:real` and + real_list_ty = `:(real)list` and + real_pair_ty = `:real#real` and + real_pair_list_ty = `:(real#real)list` and + num_type = `:num` and + nty = `:N`;; + + +(* Simple operations *) +let mk_real_list tms = mk_list (tms, real_ty);; + +let mk_names n prefix = map (fun i -> prefix^(string_of_int i)) (1--n);; + +let mk_real_vars n prefix = map (C (curry mk_var) real_ty) (mk_names n prefix);; + + +end;; diff --git a/formal_ineqs/taylor/m_taylor.hl b/formal_ineqs/taylor/m_taylor.hl new file mode 100644 index 0000000..d58f453 --- /dev/null +++ b/formal_ineqs/taylor/m_taylor.hl @@ -0,0 +1,1487 @@ +(* =========================================================== *) +(* Formal taylor intervals *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +needs "arith/more_float.hl";; +needs "arith/float_atn.hl";; +needs "arith/eval_interval.hl";; +needs "list/list_conversions.hl";; +needs "list/list_float.hl";; +needs "list/more_list.hl";; +needs "misc/vars.hl";; + +needs "lib/ssreflect/ssreflect.hl";; +needs "lib/ssreflect/sections.hl";; +needs "taylor/theory/taylor_interval-compiled.hl";; +needs "taylor/theory/multivariate_taylor-compiled.hl";; + + +module M_taylor = struct + +open Arith_misc;; +open Arith_float;; +open More_float;; +open Float_theory;; +open Eval_interval;; +open List_conversions;; +open List_float;; +open More_list;; +open Interval_arith;; +open Misc_vars;; + +let MY_RULE = UNDISCH_ALL o PURE_REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL;; +let MY_RULE_NUM = UNDISCH_ALL o Arith_nat.NUMERALS_TO_NUM o PURE_REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL;; +let MY_RULE_FLOAT = UNDISCH_ALL o Arith_nat.NUMERALS_TO_NUM o + PURE_REWRITE_RULE[FLOAT_OF_NUM; min_exp_def; GSYM IMP_IMP] o SPEC_ALL;; + + + +let max_dim = 8;; + +let inst_first_type_var ty th = + let ty_vars = type_vars_in_term (concl th) in + if ty_vars = [] then + failwith "inst_first_type: no type variables in the theorem" + else + INST_TYPE [ty, hd ty_vars] th;; + + +let float0 = mk_float 0 0 and + interval0 = mk_float_interval_small_num 0;; + + +let has_size_array = Array.init (max_dim + 1) + (fun i -> match i with + | 0 -> TRUTH + | 1 -> HAS_SIZE_1 + | _ -> define_finite_type i);; + +let dimindex_array = Array.init (max_dim + 1) + (fun i -> if i < 1 then TRUTH else MATCH_MP DIMINDEX_UNIQUE has_size_array.(i));; + +let n_type_array = Array.init (max_dim + 1) + (fun i -> if i < 1 then bool_ty else + let dimindex_th = dimindex_array.(i) in + (hd o snd o dest_type o snd o dest_const o rand o lhand o concl) dimindex_th);; + +let n_vector_type_array = Array.init (max_dim + 1) + (fun i -> if i < 1 then bool_ty else mk_type ("cart", [real_ty; n_type_array.(i)]));; + + +let x_var_names = Array.init (max_dim + 1) (fun i -> "x"^(string_of_int i)) and + y_var_names = Array.init (max_dim + 1) (fun i -> "y"^(string_of_int i)) and + z_var_names = Array.init (max_dim + 1) (fun i -> "z"^(string_of_int i)) and + w_var_names = Array.init (max_dim + 1) (fun i -> "w"^(string_of_int i));; + +let x_vars_array = Array.init (max_dim + 1) (fun i -> mk_var(x_var_names.(i), real_ty)) and + y_vars_array = Array.init (max_dim + 1) (fun i -> mk_var(y_var_names.(i), real_ty)) and + z_vars_array = Array.init (max_dim + 1) (fun i -> mk_var(z_var_names.(i), real_ty)) and + w_vars_array = Array.init (max_dim + 1) (fun i -> mk_var(w_var_names.(i), real_ty));; + +let df_vars_array = Array.init (max_dim + 1) (fun i -> mk_var ("df"^(string_of_int i), real_pair_ty));; +let dd_vars_array = Array.init (max_dim + 1) (fun i -> + Array.init (max_dim + 1) (fun j -> mk_var ("dd"^(string_of_int i)^(string_of_int j), real_pair_ty)));; + +let dest_vector = dest_list o rand;; + +let mk_vector list_tm = + let n = (length o dest_list) list_tm in + let ty = (hd o snd o dest_type o type_of) list_tm in + let vec = mk_const ("vector", [ty, aty; n_type_array.(n), nty]) in + mk_comb (vec, list_tm);; + +let mk_vector_list list = + mk_vector (mk_list (list, type_of (hd list)));; + +let el_thms_array = + let el_tm = `EL : num->(A)list->A` in + let gen0 n = + let e_list = mk_list (map (fun i -> mk_var ("e"^(string_of_int i), aty)) (1--n), aty) in + let el0_th = REWRITE_CONV[EL; HD] (mk_binop el_tm `0` e_list) in + Array.create n el0_th in + let array = Array.init (max_dim + 1) gen0 in + let gen_i n i = + let e_list = (rand o lhand o concl) array.(n).(i) in + let prev_thm = array.(n - 1).(i - 1) in + let i_tm = mk_small_numeral i in + let prev_i = num_CONV i_tm in + let el_th = REWRITE_CONV[prev_i; EL; HD; TL; prev_thm] (mk_binop el_tm i_tm e_list) in + array.(n).(i) <- el_th in + let _ = map (fun n -> map (fun i -> gen_i n i) (1--(n - 1))) (2--max_dim) in + array;; + + +let VECTOR_COMPONENT = prove(`!l i. i IN 1..dimindex (:N) ==> + (vector l:A^N)$i = EL (i - 1) l`, +REWRITE_TAC[IN_NUMSEG] THEN REPEAT GEN_TAC THEN DISCH_TAC THEN REWRITE_TAC[vector] THEN + MATCH_MP_TAC LAMBDA_BETA THEN ASM_REWRITE_TAC[]);; + +let gen_comp_thm n i = + let i_tm = mk_small_numeral i and + x_list = mk_list (map (fun i -> mk_var("x"^(string_of_int i), aty)) (1--n), aty) in + let th0 = (ISPECL [x_list; i_tm] o inst_first_type_var (n_type_array.(n))) VECTOR_COMPONENT in + let th1 = (CONV_RULE NUM_REDUCE_CONV o REWRITE_RULE[IN_NUMSEG; dimindex_array.(n)]) th0 in + REWRITE_RULE[el_thms_array.(n).(i - 1)] th1;; + +let comp_thms_array = Array.init (max_dim + 1) + (fun n -> Array.init (n + 1) + (fun i -> if i < 1 or n < 1 then TRUTH else gen_comp_thm n i));; + + +(************************************) +(* m_cell_domain *) + +let ALL2_ALL_ZIP = prove(`!(P:A->B->bool) l1 l2. LENGTH l1 = LENGTH l2 ==> + (ALL2 P l1 l2 <=> ALL (\p. P (FST p) (SND p)) (ZIP l1 l2))`, + GEN_TAC THEN LIST_INDUCT_TAC THENL + [ + GEN_TAC THEN REWRITE_TAC[LENGTH; EQ_SYM_EQ; LENGTH_EQ_NIL] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[ZIP; ALL2; ALL]; + ALL_TAC + ] THEN + + LIST_INDUCT_TAC THEN REWRITE_TAC[LENGTH] THENL [ARITH_TAC; ALL_TAC] THEN + REWRITE_TAC[eqSS] THEN DISCH_TAC THEN + REWRITE_TAC[ALL2; ZIP; ALL] THEN + FIRST_X_ASSUM (new_rewrite [] []) THEN ASM_REWRITE_TAC[]);; + +let EL_ZIP = prove(`!(l1:(A)list) (l2:(B)list) i. LENGTH l1 = LENGTH l2 /\ i < LENGTH l1 ==> + EL i (ZIP l1 l2) = (EL i l1, EL i l2)`, + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[ZIP; LENGTH] THEN TRY ARITH_TAC THEN + case THEN REWRITE_TAC[EL; HD; TL] THEN GEN_TAC THEN + REWRITE_TAC[eqSS; ARITH_RULE `SUC n < SUC x <=> n < x`] THEN STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]);; + +let LENGTH_ZIP = prove(`!l1 l2. LENGTH l1 = LENGTH l2 ==> LENGTH (ZIP l1 l2) = LENGTH l1`, + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[ZIP; LENGTH] THEN TRY ARITH_TAC THEN + REWRITE_TAC[eqSS] THEN DISCH_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]);; + + + +let test_domain_xi = new_definition + `test_domain_xi xz yw <=> FST xz <= FST yw /\ FST yw <= SND xz /\ + FST yw - FST xz <= SND yw /\ SND xz - FST yw <= SND yw`;; + + +let MK_CELL_DOMAIN = prove(`!xz (yw:(real#real)list) x z y w. + LENGTH x = dimindex (:N) /\ LENGTH z = dimindex (:N) /\ + LENGTH y = dimindex (:N) /\ LENGTH w = dimindex (:N) /\ + ZIP y w = yw /\ ZIP x z = xz /\ + ALL2 test_domain_xi xz yw ==> + m_cell_domain (vector x, vector z:real^N) (vector y) (vector w)`, + REPEAT GEN_TAC THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN + SUBGOAL_THEN `LENGTH (xz:(real#real)list) = dimindex (:N) /\ LENGTH (yw:(real#real)list) = dimindex (:N)` ASSUME_TAC THENL + [ + EXPAND_TAC "yw" THEN EXPAND_TAC "xz" THEN + REPEAT (new_rewrite [] [] LENGTH_ZIP) THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + rewrite [] [] ALL2_ALL_ZIP THEN ASM_REWRITE_TAC[m_cell_domain; GSYM ALL_EL] THEN DISCH_TAC THEN + REWRITE_TAC[m_cell_domain] THEN GEN_TAC THEN DISCH_TAC THEN + REPEAT (new_rewrite [] [] VECTOR_COMPONENT) THEN ASM_REWRITE_TAC[] THEN + ABBREV_TAC `j = i - 1` THEN + SUBGOAL_THEN `j < dimindex (:N)` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `j:num`) THEN REWRITE_TAC[test_domain_xi] THEN + rewrite [] [] LENGTH_ZIP THEN ASM_REWRITE_TAC[] THEN + rewrite [] [] EL_ZIP THEN ASM_REWRITE_TAC[] THEN + EXPAND_TAC "xz" THEN EXPAND_TAC "yw" THEN + REPEAT (new_rewrite [] [] EL_ZIP) THEN ASM_REWRITE_TAC[] THEN + ARITH_TAC);; + + + +(* array of theorems *) +let mk_m_domain_array = + let mk_m_domain n = + let dimindex_th = dimindex_array.(n) in + let n_ty = (hd o snd o dest_type o snd o dest_const o rand o lhand o concl) dimindex_th in + let nty = `:N` in + (UNDISCH_ALL o REWRITE_RULE[float0_eq] o DISCH_ALL o RULE o + REWRITE_RULE[dimindex_th] o INST_TYPE[n_ty, nty]) MK_CELL_DOMAIN in + Array.init (max_dim + 1) (fun i -> if i < 1 then TRUTH else mk_m_domain i);; + + +let TEST_DOMAIN_XI' = (EQT_INTRO o RULE o prove)(`xz = (x,z) /\ yw = (y,w) /\ + x <= y /\ y <= z /\ y - x <= w1 /\ z - y <= w2 /\ w1 <= w /\ w2 <= w ==> test_domain_xi xz yw`, + SIMP_TAC[test_domain_xi] THEN REAL_ARITH_TAC);; + + +let eval_test_domain_xi pp test_domain_tm = + let ltm, yw = dest_comb test_domain_tm in + let xz = rand ltm in + let x, z = dest_pair xz and + y, w = dest_pair yw in + let (<=) = (fun t1 t2 -> EQT_ELIM (float_le t1 t2)) and + (-) = float_sub_hi pp in + let x_le_y = x <= y and + y_le_z = y <= z and + yx_le_w1 = y - x and + zy_le_w2 = z - y in + let w1 = (rand o concl) yx_le_w1 and + w2 = (rand o concl) zy_le_w2 in + let w1_le_w = w1 <= w and + w2_le_w = w2 <= w in + (MY_PROVE_HYP (REFL xz) o MY_PROVE_HYP (REFL yw) o + MY_PROVE_HYP x_le_y o MY_PROVE_HYP y_le_z o + MY_PROVE_HYP yx_le_w1 o MY_PROVE_HYP zy_le_w2 o + MY_PROVE_HYP w1_le_w o MY_PROVE_HYP w2_le_w o + INST[x, x_var_real; y, y_var_real; z, z_var_real; w, w_var_real; + w1, w1_var_real; w2, w2_var_real; + xz, xz_pair_var; yw, yw_pair_var]) TEST_DOMAIN_XI';; + + +(* mk_m_center_domain *) +let mk_m_center_domain n pp x_list_tm z_list_tm = + let x_list = dest_list x_list_tm and + z_list = dest_list z_list_tm in + let y_list = + let ( * ) = (fun t1 t2 -> (rand o concl) (float_mul_eq t1 t2)) and + (+) = (fun t1 t2 -> (rand o concl) (float_add_hi pp t1 t2)) in + map2 (fun x y -> if x = y then x else float_inv2 * (x + y)) x_list z_list in + + let w_list = + let (-) = (fun t1 t2 -> (rand o concl) (float_sub_hi pp t1 t2)) and + max = (fun t1 t2 -> (rand o concl) (float_max t1 t2)) in + let w1 = map2 (-) y_list x_list and + w2 = map2 (-) z_list y_list in + map2 max w1 w2 in + + let y_list_tm = mk_list (y_list, real_ty) and + w_list_tm = mk_list (w_list, real_ty) in + + let yw_zip_th = eval_zip y_list_tm w_list_tm and + xz_zip_th = eval_zip x_list_tm z_list_tm in + + let yw_list_tm = (rand o concl) yw_zip_th and + xz_list_tm = (rand o concl) xz_zip_th in + + let len_x_th = eval_length x_list_tm and + len_z_th = eval_length z_list_tm and + len_y_th = eval_length y_list_tm and + len_w_th = eval_length w_list_tm in + let th0 = (MY_PROVE_HYP len_x_th o MY_PROVE_HYP len_z_th o + MY_PROVE_HYP len_y_th o MY_PROVE_HYP len_w_th o + MY_PROVE_HYP yw_zip_th o MY_PROVE_HYP xz_zip_th o + INST[x_list_tm, x_var_real_list; z_list_tm, z_var_real_list; + y_list_tm, y_var_real_list; w_list_tm, w_var_real_list; + yw_list_tm, yw_var; xz_list_tm, xz_var]) mk_m_domain_array.(n) in + let all_th = (EQT_ELIM o all2_conv_univ (eval_test_domain_xi pp) o hd o hyp) th0 in + MY_PROVE_HYP all_th th0;; + + + +(***********************) + +let MK_M_TAYLOR_INTERVAL' = (RULE o MATCH_MP iffRL o SPEC_ALL) m_taylor_interval;; + + +let get_types_and_vars n = + let ty = n_type_array.(n) and + xty = n_vector_type_array.(n) in + let x_var = mk_var ("x", xty) and + f_var = mk_var ("f", mk_fun_ty xty real_ty) and + y_var = mk_var ("y", xty) and + w_var = mk_var ("w", xty) and + domain_var = mk_var ("domain", mk_type ("prod", [xty; xty])) in + ty, xty, x_var, f_var, y_var, w_var, domain_var;; + + + +let dest_m_cell_domain domain_tm = + let lhs, w_tm = dest_comb domain_tm in + let lhs2, y_tm = dest_comb lhs in + rand lhs2, y_tm, w_tm;; + + +(**************************************************) + +(* Given a variable of the type `:real^N`, returns the number N *) +let get_dim = int_of_string o fst o dest_type o hd o tl o snd o dest_type o type_of;; + + +(**********************) +(* eval_m_taylor_poly *) + +let partial_pow = prove(`!i f n (y:real^N). lift o f differentiable at y ==> + partial i (\x. f x pow n) y = &n * f y pow (n - 1) * partial i f y`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `(\x:real^N. f x pow n) = (\t. t pow n) o f` (fun th -> REWRITE_TAC[th]) THENL + [ + ONCE_REWRITE_TAC[GSYM eq_ext] THEN REWRITE_TAC[o_THM]; + ALL_TAC + ] THEN + new_rewrite [] [] partial_uni_compose THENL + [ + ASM_REWRITE_TAC[] THEN + new_rewrite [] [] REAL_DIFFERENTIABLE_POW_ATREAL THEN REWRITE_TAC[REAL_DIFFERENTIABLE_ID]; + ALL_TAC + ] THEN + new_rewrite [] [] derivative_pow THEN REWRITE_TAC[REAL_DIFFERENTIABLE_ID; derivative_x] THEN + REAL_ARITH_TAC);; + + +let nth_diff2_pow = prove(`!n y. nth_diff_strong 2 (\x. x pow n) y`, + REWRITE_TAC[nth_diff_strong2_eq] THEN REPEAT GEN_TAC THEN + EXISTS_TAC `(:real)` THEN REWRITE_TAC[REAL_OPEN_UNIV; IN_UNIV] THEN GEN_TAC THEN + new_rewrite [] [] REAL_DIFFERENTIABLE_POW_ATREAL THEN REWRITE_TAC[REAL_DIFFERENTIABLE_ID] THEN + MATCH_MP_TAC differentiable_local THEN + EXISTS_TAC `\x. &n * x pow (n - 1)` THEN EXISTS_TAC `(:real)` THEN + REWRITE_TAC[REAL_OPEN_UNIV; IN_UNIV] THEN + new_rewrite [] [] REAL_DIFFERENTIABLE_MUL_ATREAL THEN REWRITE_TAC[REAL_DIFFERENTIABLE_CONST] THENL + [ + new_rewrite [] [] REAL_DIFFERENTIABLE_POW_ATREAL THEN REWRITE_TAC[REAL_DIFFERENTIABLE_ID]; + ALL_TAC + ] THEN + GEN_TAC THEN new_rewrite [] [] derivative_pow THEN REWRITE_TAC[REAL_DIFFERENTIABLE_ID] THEN + REWRITE_TAC[derivative_x; REAL_MUL_RID]);; + + +let diff2c_pow = prove(`!f n (x:real^N). diff2c f x ==> diff2c (\x. f x pow n) x`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `(\x:real^N. f x pow n) = (\t. t pow n) o f` (fun th -> REWRITE_TAC[th]) THENL + [ + ONCE_REWRITE_TAC[GSYM eq_ext] THEN REWRITE_TAC[o_THM]; + ALL_TAC + ] THEN + apply_tac diff2c_uni_compose THEN ASM_REWRITE_TAC[nth_diff2_pow] THEN + REWRITE_TAC[nth_derivative2] THEN + SUBGOAL_THEN `!n. derivative (\t. t pow n) = (\t. &n * t pow (n - 1))` ASSUME_TAC THENL + [ + GEN_TAC THEN REWRITE_TAC[FUN_EQ_THM] THEN GEN_TAC THEN + new_rewrite [] [] derivative_pow THEN REWRITE_TAC[REAL_DIFFERENTIABLE_ID] THEN + REWRITE_TAC[derivative_x; REAL_MUL_RID]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `!n. derivative (\t. &n * t pow (n - 1)) = (\t. &n * derivative (\t. t pow (n - 1)) t)` ASSUME_TAC THENL + [ + GEN_TAC THEN REWRITE_TAC[FUN_EQ_THM] THEN GEN_TAC THEN + new_rewrite [] [] derivative_scale THEN REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_DIFFERENTIABLE_POW_ATREAL THEN REWRITE_TAC[REAL_DIFFERENTIABLE_ID]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + REPEAT (MATCH_MP_TAC REAL_CONTINUOUS_LMUL) THEN + MATCH_MP_TAC REAL_CONTINUOUS_POW THEN + REWRITE_TAC[REAL_CONTINUOUS_AT_ID]);; + + +let diff2c_domain_pow = prove(`!f n domain. diff2c_domain domain f ==> + diff2c_domain domain (\x. f x pow n)`, + REWRITE_TAC[diff2c_domain] THEN REPEAT STRIP_TAC THEN ASM_SIMP_TAC[diff2c_pow]);; + + +let diff2c_domain_tm = `diff2c_domain domain`;; + +let rec gen_diff2c_domain_poly poly_tm = + let x_var, expr = dest_abs poly_tm in + let n = (int_of_string o fst o dest_type o hd o tl o snd o dest_type o type_of) x_var in + let diff2c_tm = mk_icomb (diff2c_domain_tm, poly_tm) in + if frees expr = [] then + (* const *) + (SPEC_ALL o ISPEC expr o inst_first_type_var (n_type_array.(n))) diff2c_domain_const + else + let lhs, r_tm = dest_comb expr in + if lhs = neg_op_real then + (* -- *) + let r_th = gen_diff2c_domain_poly (mk_abs (x_var, r_tm)) in + prove(diff2c_tm, MATCH_MP_TAC diff2c_domain_neg THEN REWRITE_TAC[r_th]) + else + let op, l_tm = dest_comb lhs in + let name = (fst o dest_const) op in + if name = "$" then + (* x$k *) + let dim_th = dimindex_array.(n) in + prove(diff2c_tm, MATCH_MP_TAC diff2c_domain_x THEN + REWRITE_TAC[IN_NUMSEG; dim_th] THEN ARITH_TAC) + else + let l_th = gen_diff2c_domain_poly (mk_abs (x_var, l_tm)) in + if name = "real_pow" then + (* f pow n *) + prove(diff2c_tm, MATCH_MP_TAC diff2c_domain_pow THEN REWRITE_TAC[l_th]) + else + let r_th = gen_diff2c_domain_poly (mk_abs (x_var, r_tm)) in + prove(diff2c_tm, + MAP_FIRST apply_tac [diff2c_domain_add; diff2c_domain_sub; diff2c_domain_mul] THEN + REWRITE_TAC[l_th; r_th]);; + + +let gen_diff2c_poly = + let th_imp = prove(`!f. (!domain. diff2c_domain domain f) ==> !x:real^N. diff2c f x`, + REWRITE_TAC[diff2c_domain] THEN REPEAT STRIP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + EXISTS_TAC `(x:real^N, x:real^N)` THEN + REWRITE_TAC[INTERVAL_SING; IN_SING]) in + fun poly_tm -> + (MATCH_MP th_imp o GEN_ALL o gen_diff2c_domain_poly) poly_tm;; + + +let gen_diff_poly = + let th_imp = prove(`!f. (!domain. diff2c_domain domain f) ==> !x:real^N. lift o f differentiable at x`, + REWRITE_TAC[diff2c_domain; diff2c; diff2] THEN REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`x:real^N, x:real^N`; `x:real^N`]) THEN + REWRITE_TAC[INTERVAL_SING; IN_SING] THEN case THEN REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:real^N`) THEN ASM_SIMP_TAC[]) in + fun poly_tm -> + (MATCH_MP th_imp o GEN_ALL o gen_diff2c_domain_poly) poly_tm;; + + +let in_tm = `IN`;; + +let add_to_hash tbl max_size key value = + let _ = if Hashtbl.length tbl >= max_size then Hashtbl.clear tbl else () in + Hashtbl.add tbl key value;; + +(* Formally computes partial derivatives of a polynomial *) +let gen_partial_poly = + let max_hash = 1000 in + let hash = Hashtbl.create max_hash in + fun i poly_tm -> + let key = (i, poly_tm) in + try Hashtbl.find hash (i, poly_tm) + with Not_found -> + let i_tm = mk_small_numeral i in + let rec gen_rec poly_tm = + let x_var, expr = dest_abs poly_tm in + let n = (int_of_string o fst o dest_type o hd o tl o snd o dest_type o type_of) x_var in + if frees expr = [] then + (* const *) + (SPECL [i_tm; expr] o inst_first_type_var (n_type_array.(n))) partial_const + else + let lhs, r_tm = dest_comb expr in + if lhs = neg_op_real then + (* -- *) + let r_poly = mk_abs (x_var, r_tm) in + let r_diff = (SPEC_ALL o gen_diff_poly) r_poly and + r_partial = gen_rec r_poly in + let th0 = SPEC i_tm (MATCH_MP partial_neg r_diff) in + REWRITE_RULE[r_partial] th0 + else + let op, l_tm = dest_comb lhs in + let name = (fst o dest_const) op in + if name = "$" then + (* comp *) + let dim_th = dimindex_array.(n) in + let dim_tm = (lhand o concl) dim_th in + let i_eq_k = NUM_EQ_CONV (mk_eq (i_tm, r_tm)) in + let int_tm = mk_binop `..` `1` dim_tm in + let k_in_dim = prove(mk_comb (mk_icomb(in_tm, r_tm), int_tm), + REWRITE_TAC[IN_NUMSEG; dim_th] THEN ARITH_TAC) in + (REWRITE_RULE[i_eq_k] o MATCH_MP (SPECL [r_tm; i_tm] partial_x)) k_in_dim + else + let l_poly = mk_abs (x_var, l_tm) in + let l_partial = gen_rec l_poly in + let l_diff = (SPEC_ALL o gen_diff_poly) l_poly in + if name = "real_pow" then + (* f pow n *) + let th0 = SPECL [i_tm; r_tm] (MATCH_MP partial_pow l_diff) in + REWRITE_RULE[l_partial] th0 + else + let r_poly = mk_abs (x_var, r_tm) in + let r_partial = gen_rec r_poly in + let r_diff = (SPEC_ALL o gen_diff_poly) r_poly in + let imp_th = assoc op [add_op_real, partial_add; + sub_op_real, partial_sub; + mul_op_real, partial_mul] in + let th0 = SPEC i_tm (MATCH_MP (MATCH_MP imp_th l_diff) r_diff) in + REWRITE_RULE[l_partial; r_partial] th0 in + + let th1 = gen_rec poly_tm in + let th2 = ((NUM_REDUCE_CONV THENC REWRITE_CONV[DECIMAL] THENC REAL_POLY_CONV) o rand o concl) th1 in + let th3 = (REWRITE_RULE[ETA_AX] o ONCE_REWRITE_RULE[eq_ext] o GEN_ALL) (TRANS th1 th2) in + let _ = add_to_hash hash max_hash key th3 in + th3;; + + +let gen_partial2_poly i j poly_tm = + let partial_j = gen_partial_poly j poly_tm in + let partial_ij = gen_partial_poly i (rand (concl partial_j)) in + let pi = (rator o lhand o concl) partial_ij in + REWRITE_RULE[GSYM partial2] (TRANS (AP_TERM pi partial_j) partial_ij);; + + +(********************************************) + +let eval_diff2_poly diff2_domain_th = + fun xx zz -> + let domain_tm = mk_pair (xx, zz) in + INST[domain_tm, mk_var ("domain", type_of domain_tm)] diff2_domain_th;; + + +(*****************************) +(* m_lin_approx *) + +let CONST_INTERVAL' = RULE CONST_INTERVAL;; + +let dest_lin_approx approx_tm = + let lhs, df_bounds = dest_comb approx_tm in + let lhs2, f_bounds = dest_comb lhs in + let lhs3, x_tm = dest_comb lhs2 in + let f_tm = rand lhs3 in + f_tm, x_tm, f_bounds, df_bounds;; + +let gen_lin_approx_eq_thm n = + let ty = n_type_array.(n) in + let df_vars = map (fun i -> df_vars_array.(i)) (1--n) in + let df_bounds_list = mk_list (df_vars, real_pair_ty) in + let th0 = (SPECL[f_bounds_var; df_bounds_list] o inst_first_type_var ty) m_lin_approx in + let th1 = (CONV_RULE NUM_REDUCE_CONV o REWRITE_RULE[all_n]) th0 in + th1;; + + +let gen_lin_approx_poly_thm poly_tm diff_th partials = + let x_var, _ = dest_abs poly_tm in + let n = get_dim x_var in + let lin_eq = (REWRITE_RULE partials o SPECL [poly_tm]) (gen_lin_approx_eq_thm n) in + let x_vec = mk_vector_list (map (fun i -> x_vars_array.(i)) (1--n)) in + let th1 = (REWRITE_RULE (Array.to_list comp_thms_array.(n)) o SPEC x_vec o REWRITE_RULE[diff_th]) lin_eq in + th1;; + + +let gen_lin_approx_poly_thm0 poly_tm = + let x_var, _ = dest_abs poly_tm in + let n = get_dim x_var in + let partials = map (fun i -> gen_partial_poly i poly_tm) (1--n) in + let diff_th = gen_diff_poly poly_tm in + gen_lin_approx_poly_thm poly_tm diff_th partials;; + + +let eval_lin_approx pp0 lin_approx_th = + let poly_tm, _, _, _ = (dest_lin_approx o lhand o concl) lin_approx_th in + let x_var, _ = dest_abs poly_tm in + let n = get_dim x_var in + let th0 = lin_approx_th in + let th1 = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o MATCH_MP iffRL) th0 in + let build_eval int_hyp = + let expr, b_var = dest_binary "interval_arith" int_hyp in + (eval_constants pp0 o build_interval_fun) expr, b_var in + let int_fs = map build_eval (hyp th1) in + + let rec split_rules i_list = + match i_list with + | [] -> ([], []) + | ((i_fun, var_tm) :: es) -> + let th_list, i_list' = split_rules es in + match i_fun with + | Int_const th -> (var_tm, th) :: th_list, i_list' + | Int_var v -> (var_tm, INST[v, x_var_real] CONST_INTERVAL') :: th_list, i_list' + | _ -> th_list, (var_tm, i_fun) :: i_list' in + + let const_th_list, i_list0 = split_rules int_fs in + let th2 = itlist (fun (var_tm, th) th0 -> + let b_tm = rand (concl th) in + (MY_PROVE_HYP th o INST[b_tm, var_tm]) th0) const_th_list th1 in + let v_list, i_list' = unzip i_list0 in + let i_list = find_and_replace_all i_list' [] in + fun pp vector_tm -> + let x_vals = dest_vector vector_tm in + if length x_vals <> n then failwith (sprintf "Wrong vector size; expected size: %d" n) + else + let x_ints = map mk_const_interval x_vals in + let vars = map (fun i -> x_vars_array.(i)) (1--n) in + let th3 = INST (zip x_vals vars) th2 in + let i_vals = eval_interval_fun_list pp i_list (zip vars x_ints) in + itlist2 (fun var_tm th th0 -> + let b_tm = rand (concl th) in + (MY_PROVE_HYP th o INST[b_tm, var_tm]) th0) v_list i_vals th3;; + + +let eval_lin_approx_poly0 pp0 poly_tm = + eval_lin_approx pp0 (gen_lin_approx_poly_thm0 poly_tm);; + + + +(*************************************) + +(* 1 <= i /\ i <= n <=> i = 1 \/ i = 2 \/ ... \/ i = n *) +let i_int_array = + let i_tm = `i:num` in + let i_th0 = prove(`1 <= i /\ i <= SUC n <=> (1 <= i /\ i <= n) \/ i = SUC n`, ARITH_TAC) in + let th1 = prove(`1 <= i /\ i <= 1 <=> i = 1`, ARITH_TAC) in + let array = Array.create (max_dim + 1) th1 in + let prove_next n = + let n_tm = mk_small_numeral n in + let prev_n = num_CONV n_tm in + let tm = mk_conj (`1 <= i`, mk_binop le_op_num i_tm n_tm) in + let th = REWRITE_CONV[prev_n; i_th0; array.(n - 1)] tm in + array.(n) <- REWRITE_RULE[SYM prev_n; GSYM DISJ_ASSOC] th in + let _ = map prove_next (2--max_dim) in + array;; + + +(* (!i. 1 <= i /\ i <= n ==> P i) <=> P 1 /\ P 2 /\ ... /\ P n *) +let gen_in_interval = + let th0 = prove(`(!i:num. (i = k \/ Q i) ==> P i) <=> (P k /\ (!i. Q i ==> P i))`, MESON_TAC[]) in + let th1 = prove(`(!i:num. (i = k ==> P i)) <=> P k`, MESON_TAC[]) in + fun n -> + let n_tm = mk_small_numeral n and + i_tm = `i:num` in + let lhs1 = mk_conj (`1 <= i`, mk_binop le_op_num i_tm n_tm) in + let lhs = mk_forall (i_tm, mk_imp (lhs1, `(P:num->bool) i`)) in + REWRITE_CONV[i_int_array.(n); th0; th1] lhs;; + + +let gen_second_bounded_eq_thm n = + let ty, _, x_var, _, _, _, domain_var = get_types_and_vars n in + let dd_vars = map (fun i -> map (fun j -> dd_vars_array.(j).(i)) (1--i)) (1--n) in + let dd_bounds_list = mk_list (map (fun l -> mk_list (l, real_pair_ty)) dd_vars, real_pair_list_ty) in + let th0 = (SPECL[domain_var; dd_bounds_list] o inst_first_type_var ty) second_bounded in + let th1 = (CONV_RULE NUM_REDUCE_CONV o REWRITE_RULE[all_n]) th0 in + th1;; + + +let gen_second_bounded_poly_thm poly_tm partials2 = + let x_var, _ = dest_abs poly_tm in + let n = get_dim x_var in + let partials2' = List.flatten partials2 in + let second_th = (REWRITE_RULE partials2' o SPECL [poly_tm]) (gen_second_bounded_eq_thm n) in + second_th;; + + +let gen_second_bounded_poly_thm0 poly_tm = + let x_var, _ = dest_abs poly_tm in + let n = get_dim x_var in + let partials = map (fun i -> gen_partial_poly i poly_tm) (1--n) in + let get_partial i eq_th = + let partial_i = gen_partial_poly i (rand (concl eq_th)) in + let pi = (rator o lhand o concl) partial_i in + REWRITE_RULE[GSYM partial2] (TRANS (AP_TERM pi eq_th) partial_i) in + let partials2 = map (fun th, i -> map (fun j -> get_partial j th) (1--i)) (zip partials (1--n)) in + gen_second_bounded_poly_thm poly_tm partials2;; + +(* let eq_th = TAUT `(P ==> Q /\ R) <=> ((P ==> Q) /\ (P ==> R))` in + REWRITE_RULE[eq_th; FORALL_AND_THM; GSYM m_bounded_on_int] second_th;;*) + + +(* eval_second_bounded *) +let eval_second_bounded pp0 second_bounded_th = + let poly_tm = (lhand o rator o lhand o concl) second_bounded_th in + let th0 = second_bounded_th in + let n = (get_dim o fst o dest_abs) poly_tm in + let x_vector = mk_vector_list (map (fun i -> x_vars_array.(i)) (1--n)) and + z_vector = mk_vector_list (map (fun i -> z_vars_array.(i)) (1--n)) in + let _, _, _, _, _, _, domain_var = get_types_and_vars n in + + let th1 = INST[mk_pair (x_vector, z_vector), domain_var] th0 in + let th2 = REWRITE_RULE[IN_INTERVAL; dimindex_array.(n)] th1 in + let th3 = REWRITE_RULE[gen_in_interval n; GSYM interval_arith] th2 in + let th4 = (REWRITE_RULE[CONJ_ACI] o REWRITE_RULE (Array.to_list comp_thms_array.(n))) th3 in + let final_th0 = (UNDISCH_ALL o MATCH_MP iffRL) th4 in + + let x_var, h_tm = (dest_forall o hd o hyp) final_th0 in + let _, h2 = dest_imp h_tm in + let concl_ints = striplist dest_conj h2 in + + let i_funs = map (fun int -> + let expr, var = dest_interval_arith int in + (eval_constants pp0 o build_interval_fun) expr, var) concl_ints in + + let rec split_rules i_list = + match i_list with + | [] -> ([], []) + | ((i_fun, var_tm) :: es) -> + let th_list, i_list' = split_rules es in + match i_fun with + | Int_const th -> (var_tm, th) :: th_list, i_list' +(* | Int_var v -> (var_tm, INST[v, x_var_real] CONST_INTERVAL') :: th_list, i_list' *) + | _ -> th_list, (var_tm, i_fun) :: i_list' in + + let const_th_list, i_list0 = split_rules i_funs in + let th5 = itlist (fun (var_tm, th) th0 -> + let b_tm = rand (concl th) in + (REWRITE_RULE[th] o INST[b_tm, var_tm]) th0) const_th_list (SYM th4) in + let final_th = REWRITE_RULE[GSYM IMP_IMP] th5 in + let v_list, i_list' = unzip i_list0 in + let i_list = find_and_replace_all i_list' [] in + + fun pp x_vector_tm z_vector_tm -> + let x_vals = dest_vector x_vector_tm and + z_vals = dest_vector z_vector_tm in + if length x_vals <> n or length z_vals <> n then + failwith (sprintf "Wrong vector size; expected size: %d" n) + else + let x_vars = map (fun i -> x_vars_array.(i)) (1--n) and + z_vars = map (fun i -> z_vars_array.(i)) (1--n) in + + let inst_th = (INST (zip x_vals x_vars) o INST (zip z_vals z_vars)) final_th in + if (not o is_eq) (concl inst_th) then inst_th + else + let x_var, lhs = (dest_forall o lhand o concl) inst_th in + let hs = (butlast o striplist dest_imp) lhs in + let vars = map (rand o rator) hs in + let int_vars = zip vars (map ASSUME hs) in + + let dd_ints = eval_interval_fun_list pp i_list int_vars in + let inst_dd = map2 (fun var th -> (rand o concl) th, var) v_list dd_ints in + let inst_th2 = INST inst_dd inst_th in + + let conj_th = end_itlist CONJ dd_ints in + let lhs_th = GEN x_var (itlist DISCH hs conj_th) in + EQ_MP inst_th2 lhs_th;; + + + +let eval_second_bounded_poly0 pp0 poly_tm = + eval_second_bounded pp0 (gen_second_bounded_poly_thm0 poly_tm);; + + + +(*************************************) +(* eval_m_taylor *) + +let eval_m_taylor pp0 diff2c_th lin_th second_th = + let poly_tm = (rand o concl) diff2c_th in + let n = (get_dim o fst o dest_abs) poly_tm in + let eval_lin = eval_lin_approx pp0 lin_th and + eval_second = eval_second_bounded pp0 second_th in + + let ty, _, x_var, f_var, y_var, w_var, domain_var = get_types_and_vars n in + let th0 = (SPEC_ALL o inst_first_type_var ty) m_taylor_interval in + let th1 = INST[poly_tm, f_var] th0 in + let th2 = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o MATCH_MP iffRL o REWRITE_RULE[diff2c_th]) th1 in + + fun p_lin p_second domain_th -> + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let x_tm, z_tm = dest_pair domain_tm in + + let lin_th = eval_lin p_lin y_tm and + second_th = eval_second p_second x_tm z_tm in + + let _, _, f_bounds, df_bounds_list = dest_lin_approx (concl lin_th) in + let dd_bounds_list = (rand o concl) second_th in + let df_var = mk_var ("d_bounds_list", type_of df_bounds_list) and + dd_var = mk_var ("dd_bounds_list", type_of dd_bounds_list) in + + (MY_PROVE_HYP domain_th o MY_PROVE_HYP lin_th o MY_PROVE_HYP second_th o + INST[domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + f_bounds, f_bounds_var; df_bounds_list, df_var; dd_bounds_list, dd_var]) th2;; + + +let eval_m_taylor_poly0 pp0 poly_tm = + let diff2_th = gen_diff2c_domain_poly poly_tm in + let x_var, _ = dest_abs poly_tm in + let n = get_dim x_var in + let partials = map (fun i -> gen_partial_poly i poly_tm) (1--n) in + let get_partial i eq_th = + let partial_i = gen_partial_poly i (rand (concl eq_th)) in + let pi = (rator o lhand o concl) partial_i in + REWRITE_RULE[GSYM partial2] (TRANS (AP_TERM pi eq_th) partial_i) in + let partials2 = map2 (fun th i -> map (fun j -> get_partial j th) (1--i)) partials (1--n) in + let second_th = gen_second_bounded_poly_thm poly_tm partials2 in + let diff_th = gen_diff_poly poly_tm in + let lin_th = gen_lin_approx_poly_thm poly_tm diff_th partials in + eval_m_taylor pp0 diff2_th lin_th second_th;; + + + +(******************************************) +(* mk_eval_function *) + +let mk_eval_function_eq pp0 eq_th = + let expr_tm = (rand o concl) eq_th in + let tm0 = `!x:real^N. x IN interval [domain] ==> interval_arith (f x) f_bounds` in + let n = (get_dim o fst o dest_abs) expr_tm in + let x_vector = mk_vector_list (map (fun i -> x_vars_array.(i)) (1--n)) and + z_vector = mk_vector_list (map (fun i -> z_vars_array.(i)) (1--n)) in + let ty, _, _, _, _, _, domain_var = get_types_and_vars n and + f_var = mk_var ("f", type_of expr_tm) in + let th1 = (REWRITE_CONV[IN_INTERVAL] o subst[mk_pair(x_vector,z_vector), domain_var] o inst[ty, nty]) tm0 in + let th2 = REWRITE_RULE [dimindex_array.(n)] th1 in + let th3 = REWRITE_RULE [gen_in_interval n; GSYM interval_arith] th2 in + let th4 = (REWRITE_RULE[GSYM IMP_IMP; CONJ_ACI] o REWRITE_RULE (Array.to_list comp_thms_array.(n))) th3 in + let final_th0 = (CONV_RULE ((RAND_CONV o ONCE_DEPTH_CONV) BETA_CONV) o INST[expr_tm, f_var]) th4 in + let x_var, h_tm = (dest_forall o rand o concl) final_th0 in + let f_tm = (fst o dest_interval_arith o last o striplist dest_imp) h_tm in + let i_fun = (eval_constants pp0 o build_interval_fun) f_tm in + let i_list = find_and_replace_all [i_fun] [] in + let final_th = (PURE_REWRITE_RULE[SYM eq_th] o SYM) final_th0 in + fun pp x_vector_tm z_vector_tm -> + let x_vals = dest_vector x_vector_tm and + z_vals = dest_vector z_vector_tm in + if length x_vals <> n or length z_vals <> n then + failwith (sprintf "Wrong vector size; expected size: %d" n) + else + let x_vars = map (fun i -> x_vars_array.(i)) (1--n) and + z_vars = map (fun i -> z_vars_array.(i)) (1--n) in + + let inst_th = (INST (zip x_vals x_vars) o INST (zip z_vals z_vars)) final_th in + let x_var, lhs = (dest_forall o lhand o concl) inst_th in + let hs = (butlast o striplist dest_imp) lhs in + let vars = map (rand o rator) hs in + let int_vars = zip vars (map ASSUME hs) in + let eval_th = hd (eval_interval_fun_list pp i_list int_vars) in + let f_bounds = (rand o concl) eval_th in + let inst_th2 = INST[f_bounds, f_bounds_var] inst_th in + let lhs_th = GEN x_var (itlist DISCH hs eval_th) in + EQ_MP inst_th2 lhs_th;; + + +let mk_eval_function pp0 expr_tm = mk_eval_function_eq pp0 (REFL expr_tm);; + + + +(********************************) +(* m_taylor_error *) + +(* Sum of the list elements *) +let ITLIST2_EQ_SUM = prove(`!(f:A->B->real) l1 l2. LENGTH l1 <= LENGTH l2 ==> + ITLIST2 (\x y z. f x y + z) l1 l2 (&0) = + sum (1..(LENGTH l1)) (\i. f (EL (i - 1) l1) (EL (i - 1) l2))`, + GEN_TAC THEN + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[LENGTH; ITLIST2_DEF] THEN TRY ARITH_TAC THENL + [ + REWRITE_TAC[SUM_CLAUSES_NUMSEG; ARITH]; + REWRITE_TAC[SUM_CLAUSES_NUMSEG; ARITH]; + ALL_TAC + ] THEN + REWRITE_TAC[leqSS] THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `t':(B)list`) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[TL; th]) THEN + REWRITE_TAC[GSYM add1n] THEN + new_rewrite [] [] SUM_ADD_SPLIT THEN REWRITE_TAC[ARITH] THEN + REWRITE_TAC[TWO; add1n; SUM_SING_NUMSEG; subnn; EL; HD] THEN + REWRITE_TAC[GSYM addn1; SUM_OFFSET; REAL_EQ_ADD_LCANCEL] THEN + MATCH_MP_TAC SUM_EQ THEN move ["i"] THEN REWRITE_TAC[IN_NUMSEG] THEN DISCH_TAC THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= i ==> (i + 1) - 1 = SUC (i - 1)`; EL; TL]);; + + +let interval_arith_abs_le = prove(`!x int y. interval_arith x int ==> iabs int <= y ==> abs x <= y`, + GEN_TAC THEN case THEN REWRITE_TAC[interval_arith; IABS'] THEN REAL_ARITH_TAC);; + + +let ALL_N_ALL2 = prove(`!P (l:(A)list) i0. + (all_n i0 l P <=> if l = [] then T else ALL2 P (l_seq i0 ((i0 + LENGTH l) - 1)) l)`, + GEN_TAC THEN LIST_INDUCT_TAC THEN GEN_TAC THEN REWRITE_TAC[all_n; NOT_CONS_NIL] THEN + new_rewrite [] [] L_SEQ_CONS THEN REWRITE_TAC[LENGTH; ALL2] THEN TRY ARITH_TAC THEN + FIRST_X_ASSUM (new_rewrite [] []) THEN TRY ARITH_TAC THEN + REWRITE_TAC[addSn; addnS; addn1] THEN + SPEC_TAC (`t:(A)list`, `t:(A)list`) THEN case THEN SIMP_TAC[NOT_CONS_NIL] THEN + REWRITE_TAC[LENGTH; addn0] THEN + MP_TAC (SPECL [`SUC i0`; `SUC i0 - 1`] L_SEQ_NIL) THEN + REWRITE_TAC[ARITH_RULE `SUC i0 - 1 < SUC i0`] THEN DISCH_THEN (fun th -> REWRITE_TAC[th; ALL2]));; + + +let ALL_N_EL = prove(`!P (l:(A)list) i0. all_n i0 l P <=> (!i. i < LENGTH l ==> P (i0 + i) (EL i l))`, + REPEAT GEN_TAC THEN REWRITE_TAC[ALL_N_ALL2] THEN + SPEC_TAC (`l:(A)list`, `l:(A)list`) THEN case THEN SIMP_TAC[NOT_CONS_NIL; LENGTH; ltn0] THEN + REPEAT GEN_TAC THEN + new_rewrite [] [] ALL2_ALL_ZIP THENL + [ + REWRITE_TAC[LENGTH_L_SEQ; LENGTH] THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[GSYM ALL_EL] THEN + new_rewrite [] [] LENGTH_ZIP THENL + [ + REWRITE_TAC[LENGTH_L_SEQ; LENGTH] THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[LENGTH_L_SEQ; ARITH_RULE `((i0 + SUC a) - 1 + 1) - i0 = SUC a`] THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[] THEN + new_rewrite [] [] EL_ZIP THENL + [ + REWRITE_TAC[LENGTH_L_SEQ; LENGTH] THEN ASM_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[] THEN new_rewrite [] [] EL_L_SEQ THEN ASM_ARITH_TAC; + ALL_TAC + ] THEN + new_rewrite [] [] EL_ZIP THENL + [ + REWRITE_TAC[LENGTH_L_SEQ; LENGTH] THEN ASM_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[] THEN new_rewrite [] [] EL_L_SEQ THEN TRY ASM_ARITH_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]);; + + +let M_TAYLOR_ERROR_ITLIST2 = prove(`!f domain y w dd_bounds_list error. + m_cell_domain domain y (vector w) ==> + diff2c_domain domain f ==> + second_bounded (f:real^N->real) domain dd_bounds_list ==> + LENGTH w = dimindex (:N) ==> + LENGTH dd_bounds_list = dimindex (:N) ==> + all_n 1 dd_bounds_list (\i list. LENGTH list = i) ==> + ITLIST2 (\list x z. x * (x * iabs (LAST list) + + &2 * ITLIST2 (\a b c. b * iabs a + c) (BUTLAST list) w (&0)) + z) + dd_bounds_list w (&0) <= error ==> + m_taylor_error f domain (vector w) error`, + REPEAT GEN_TAC THEN REWRITE_TAC[second_bounded] THEN + set_tac "s" `ITLIST2 _1 _2 _3 _4` THEN + move ["domain"; "d2f"; "second"; "lw"; "ldd"; "ldd_all"; "s_le"] THEN + ASM_SIMP_TAC[m_taylor_error_eq] THEN move ["x"; "x_in"] THEN + SUBGOAL_THEN `!i. i IN 1..dimindex (:N) ==> &0 <= EL (i - 1) w` (LABEL_TAC "w_ge0") THENL + [ + GEN_TAC THEN DISCH_TAC THEN REMOVE_THEN "domain" MP_TAC THEN new_rewrite [] [] pair_eq THEN + REWRITE_TAC[m_cell_domain] THEN + DISCH_THEN (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[VECTOR_COMPONENT] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `s:real` THEN ASM_REWRITE_TAC[] THEN + EXPAND_TAC "s" THEN + new_rewrite [] [] ITLIST2_EQ_SUM THEN ASM_REWRITE_TAC[LE_REFL] THEN + MATCH_MP_TAC SUM_LE THEN REWRITE_TAC[FINITE_NUMSEG] THEN + move ["i"; "i_in"] THEN ASM_SIMP_TAC[VECTOR_COMPONENT] THEN + USE_THEN "i_in" (ASSUME_TAC o REWRITE_RULE[IN_NUMSEG]) THEN + MATCH_MP_TAC REAL_LE_LMUL THEN ASM_SIMP_TAC[] THEN + SUBGOAL_THEN `LENGTH (EL (i - 1) dd_bounds_list:(real#real)list) = i` (LABEL_TAC "len_i") THENL + [ + REMOVE_THEN "ldd_all" MP_TAC THEN + REWRITE_TAC[ALL_N_EL] THEN DISCH_THEN (MP_TAC o SPEC `i - 1`) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + new_rewrite [] [] ITLIST2_EQ_SUM THEN ASM_REWRITE_TAC[] THENL + [ + REWRITE_TAC[LENGTH_BUTLAST] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_ADD2 THEN CONJ_TAC THENL + [ + new_rewrite [] [] LAST_EL THENL + [ + ASM_REWRITE_TAC[GSYM LENGTH_EQ_NIL] THEN + REMOVE_THEN "i_in" MP_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_LMUL THEN ASM_SIMP_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:real^N`) THEN ASM_REWRITE_TAC[ALL_N_EL] THEN + DISCH_THEN (MP_TAC o SPEC `i - 1`) THEN + ANTS_TAC THENL + [ + REMOVE_THEN "i_in" MP_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (MP_TAC o SPEC `i - 1`) THEN ANTS_TAC THENL + [ + UNDISCH_TAC `1 <= i /\ i <= dimindex (:N)` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC; + ALL_TAC + ] THEN + SUBGOAL_THEN `1 + i - 1 = i /\ 1 + i - 1 = i` (fun th -> REWRITE_TAC[th]) THENL + [ + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[partial2] THEN + DISCH_THEN (MP_TAC o MATCH_MP interval_arith_abs_le) THEN + DISCH_THEN MATCH_MP_TAC THEN REWRITE_TAC[REAL_LE_REFL]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_LMUL THEN CONJ_TAC THENL [ REAL_ARITH_TAC; ALL_TAC ] THEN + ASM_REWRITE_TAC[LENGTH_BUTLAST] THEN + MATCH_MP_TAC SUM_LE THEN REWRITE_TAC[FINITE_NUMSEG] THEN + move ["j"; "j_in"] THEN + SUBGOAL_THEN `j IN 1..dimindex (:N)` (LABEL_TAC "j_in2") THENL + [ + REMOVE_THEN "i_in" MP_TAC THEN REMOVE_THEN "j_in" MP_TAC THEN + REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + ASM_SIMP_TAC[VECTOR_COMPONENT] THEN + USE_THEN "j_in" (ASSUME_TAC o REWRITE_RULE[IN_NUMSEG]) THEN + MATCH_MP_TAC REAL_LE_LMUL THEN ASM_SIMP_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:real^N`) THEN ASM_REWRITE_TAC[ALL_N_EL] THEN + DISCH_THEN (MP_TAC o SPEC `i - 1`) THEN ANTS_TAC THENL + [ + REMOVE_THEN "i_in" MP_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (MP_TAC o SPEC `j - 1`) THEN ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + SUBGOAL_THEN `1 + j - 1 = j /\ 1 + i - 1 = i` (fun th -> REWRITE_TAC[th]) THENL + [ + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[partial2] THEN + DISCH_THEN (MP_TAC o MATCH_MP interval_arith_abs_le) THEN + DISCH_THEN MATCH_MP_TAC THEN + new_rewrite [] [] EL_BUTLAST THENL + [ + ASM_REWRITE_TAC[] THEN REMOVE_THEN "j_in" MP_TAC THEN REMOVE_THEN "i_in" MP_TAC THEN + REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[REAL_LE_REFL]);; + + +let M_TAYLOR_ERROR_ITLIST2_ALT = prove(`!f domain y w f_lo f_hi d_bounds_list dd_bounds_list error. + m_taylor_interval f domain y (vector w:real^N) (f_lo, f_hi) d_bounds_list dd_bounds_list ==> + LENGTH w = dimindex (:N) ==> + LENGTH dd_bounds_list = dimindex (:N) ==> + all_n 1 dd_bounds_list (\i list. LENGTH list = i) ==> + ITLIST2 (\list x z. x * (x * iabs (LAST list) + + &2 * ITLIST2 (\a b c. b * iabs a + c) (BUTLAST list) w (&0)) + z) + dd_bounds_list w (&0) <= error ==> + m_taylor_error f domain (vector w) error`, + REWRITE_TAC[m_taylor_interval] THEN REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL M_TAYLOR_ERROR_ITLIST2) THEN ASM_REWRITE_TAC[]);; + + + +(****************************) + +let M_TAYLOR_INTERVAL' = MY_RULE m_taylor_interval;; + +let dest_m_taylor m_taylor_tm = + let ltm1, dd_bounds_list = dest_comb m_taylor_tm in + let ltm2, d_bounds_list = dest_comb ltm1 in + let ltm3, f_bounds = dest_comb ltm2 in + let ltm4, w = dest_comb ltm3 in + let ltm5, y = dest_comb ltm4 in + let ltm6, domain = dest_comb ltm5 in + rand ltm6, domain, y, w, f_bounds, d_bounds_list, dd_bounds_list;; + +let dest_m_taylor_thms n = + let ty, xty, x_var, f_var, y_var, w_var, domain_var = get_types_and_vars n in + fun m_taylor_th -> + let f, domain, y, w, f_bounds, d_bounds_list, dd_bounds_list = dest_m_taylor (concl m_taylor_th) in + let th0 = (INST[f, f_var; domain, domain_var; y, y_var; w, w_var; f_bounds, f_bounds_var; + d_bounds_list, d_bounds_list_var; dd_bounds_list, dd_bounds_list_var] o + inst_first_type_var ty) M_TAYLOR_INTERVAL' in + let th1 = EQ_MP th0 m_taylor_th in + let [domain_th; d2_th; lin_th; second_th] = CONJUNCTS th1 in + domain_th, d2_th, lin_th, second_th;; + + + +(**********************) + +(* bound *) +let M_TAYLOR_BOUND' = + prove(`m_taylor_interval f domain y (vector w:real^N) (f_lo, f_hi) d_bounds_list dd_bounds_list /\ + m_taylor_error f domain (vector w) error /\ + ITLIST2 (\a b c. b * iabs a + c) d_bounds_list w (&0) <= b /\ + b + inv(&2) * error <= a /\ + lo <= f_lo - a /\ + f_hi + a <= hi /\ + LENGTH w = dimindex (:N) /\ LENGTH d_bounds_list = dimindex (:N) ==> + (!x. x IN interval [domain] ==> interval_arith (f x) (lo, hi))`, + REWRITE_TAC[GSYM m_bounded_on_int; m_taylor_interval; m_lin_approx; ALL_N_EL] THEN + set_tac "s" `ITLIST2 _1 _2 _3 _4` THEN STRIP_TAC THEN + SUBGOAL_THEN `diff2_domain domain (f:real^N->real)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + SIMP_TAC[diff2_domain; diff2c_domain; diff2c]; + ALL_TAC + ] THEN + apply_tac m_taylor_bounds THEN + MAP_EVERY EXISTS_TAC [`y:real^N`; `vector w:real^N`; `error:real`; `f_lo:real`; `f_hi:real`; `a:real`] THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b + inv (&2) * error` THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[real_div; REAL_MUL_AC] THEN + MATCH_MP_TAC REAL_LE_ADD2 THEN REWRITE_TAC[REAL_LE_REFL] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `s:real` THEN ASM_REWRITE_TAC[] THEN + EXPAND_TAC "s" THEN new_rewrite [] [] ITLIST2_EQ_SUM THEN ASM_REWRITE_TAC[LE_REFL] THEN + MATCH_MP_TAC SUM_LE THEN REWRITE_TAC[FINITE_NUMSEG] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN ASM_SIMP_TAC[VECTOR_COMPONENT; REAL_LE_REFL; REAL_ABS_POS] THEN + CONJ_TAC THENL + [ + UNDISCH_TAC `m_cell_domain domain (y:real^N) (vector w)` THEN + new_rewrite [] [] pair_eq THEN REWRITE_TAC[m_cell_domain] THEN + DISCH_THEN (MP_TAC o SPEC `x:num`) THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[VECTOR_COMPONENT] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x - 1`) THEN + ANTS_TAC THENL + [ + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (MP_TAC o MATCH_MP interval_arith_abs_le) THEN + SUBGOAL_THEN `1 + x - 1 = x` (fun th -> REWRITE_TAC[th]) THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN MATCH_MP_TAC THEN REWRITE_TAC[REAL_LE_REFL]);; + + +(* upper *) +let M_TAYLOR_UPPER_BOUND' = prove(`m_taylor_interval f domain y (vector w) (f_lo, f_hi) + d_bounds_list dd_bounds_list /\ + m_taylor_error f domain (vector w:real^N) error /\ + ITLIST2 (\a b c. b * iabs a + c) d_bounds_list w (&0) <= b /\ + b + inv(&2) * error <= a /\ + f_hi + a <= hi /\ + LENGTH w = dimindex (:N) /\ LENGTH d_bounds_list = dimindex (:N) ==> + (!p. p IN interval [domain] ==> f p <= hi)`, + STRIP_TAC THEN + MP_TAC (INST[`f_lo - a:real`, `lo:real`] M_TAYLOR_BOUND') THEN + ASM_SIMP_TAC[interval_arith; REAL_LE_REFL]);; + + +(* lower *) +let M_TAYLOR_LOWER_BOUND' = prove(`m_taylor_interval f domain y (vector w:real^N) (f_lo, f_hi) + d_bounds_list dd_bounds_list /\ + m_taylor_error f domain (vector w) error /\ + ITLIST2 (\a b c. b * iabs a + c) d_bounds_list w (&0) <= b /\ + b + inv(&2) * error <= a /\ + lo <= f_lo - a /\ + LENGTH w = dimindex (:N) /\ LENGTH d_bounds_list = dimindex (:N) ==> + (!p. p IN interval [domain] ==> lo <= f p)`, + STRIP_TAC THEN + MP_TAC (INST[`f_hi + a:real`, `hi:real`] M_TAYLOR_BOUND') THEN + ASM_SIMP_TAC[interval_arith; REAL_LE_REFL]);; + + + +(* arrays *) +let gen_taylor_bound_th bound_th n = + let th0 = (DISCH_ALL o MY_RULE o REWRITE_RULE[MY_RULE M_TAYLOR_ERROR_ITLIST2_ALT]) bound_th in + let ns = 1--n in + let mk_list_hd l = mk_list (l, type_of (hd l)) in + let w_list = mk_list_hd (map (fun i -> w_vars_array.(i)) ns) in + let d_bounds_list = mk_list_hd (map (fun i -> df_vars_array.(i)) ns) in + let dd_bounds_list = mk_list_hd (map (fun i -> mk_list_hd (map (fun j -> dd_vars_array.(i).(j)) (1--i))) ns) in + let th1 = (INST[w_list, w_var_real_list; d_bounds_list, d_bounds_list_var; + dd_bounds_list, dd_bounds_list_var] o INST_TYPE[n_type_array.(n), nty]) th0 in + let th2 = REWRITE_RULE[LAST; NOT_CONS_NIL; BUTLAST; all_n; ITLIST2_DEF; LENGTH; ARITH; dimindex_array.(n)] th1 in + let th3 = REWRITE_RULE[HD; TL; REAL_MUL_RZERO; REAL_ADD_RID; GSYM error_mul_f2] th2 in + (MY_RULE o REWRITE_RULE[float_inv2_th; SYM float2_eq]) th3;; + + +let m_taylor_upper_array = Array.init (max_dim + 1) + (fun i -> if i < 1 then TRUTH else gen_taylor_bound_th M_TAYLOR_UPPER_BOUND' i);; + +let m_taylor_lower_array = Array.init (max_dim + 1) + (fun i -> if i < 1 then TRUTH else gen_taylor_bound_th M_TAYLOR_LOWER_BOUND' i);; + +let m_taylor_bound_array = Array.init (max_dim + 1) + (fun i -> if i < 1 then TRUTH else gen_taylor_bound_th M_TAYLOR_BOUND' i);; + + +(***************************) +(* eval_m_taylor_bounds0 *) + +let eval_m_taylor_bounds0 mode n pp m_taylor_th = + let bound_th = + if mode = "upper" then + m_taylor_upper_array.(n) + else if mode = "bound" then + m_taylor_bound_array.(n) + else + m_taylor_lower_array.(n) in + + let f_tm, domain_tm, y_tm, w_tm, f_bounds, d_bounds_list, dd_bounds_list = dest_m_taylor (concl m_taylor_th) in + let f_lo, f_hi = dest_pair f_bounds and + ws = dest_list (rand w_tm) and + dfs = dest_list d_bounds_list and + dds = map dest_list (dest_list dd_bounds_list) in + let ns = 1--n in + let df_vars = map (fun i -> df_vars_array.(i)) ns and + dd_vars = map (fun i -> map (fun j -> dd_vars_array.(i).(j)) (1--i)) ns and + w_vars = map (fun i -> w_vars_array.(i)) ns and + y_var = mk_var ("y", type_of y_tm) and + f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + (* sum of first partials *) + let d_th = + let mul_wd = map2 (error_mul_f2_le_conv2 pp) ws dfs in + end_itlist (add_ineq_hi pp) mul_wd in + + let b_tm = (rand o concl) d_th in + + (* sum of second partials *) + let dd_th = + let ( * ), ( + ) = mul_ineq_pos_const_hi pp, add_ineq_hi pp in + let mul_wdd = map2 (fun list i -> my_map2 (error_mul_f2_le_conv2 pp) ws list) dds ns in + let sums1 = map (end_itlist ( + ) o butlast) (tl mul_wdd) in + let sums2 = (hd o hd) mul_wdd :: map2 (fun list th1 -> last list + two_float * th1) (tl mul_wdd) sums1 in + let sums = map2 ( * ) ws sums2 in + end_itlist ( + ) sums in + + let error_tm = (rand o concl) dd_th in + + (* additional inequalities *) + let ineq1_th = + let ( * ), ( + ) = float_mul_hi pp, add_ineq_hi pp in + mk_refl_ineq b_tm + float_inv2 * error_tm in + + let a_tm = (rand o concl) ineq1_th in + + let prove_ineq2, bounds_inst = + if mode = "upper" then + let ineq2 = float_add_hi pp f_hi a_tm in + MY_PROVE_HYP ineq2, [(rand o concl) ineq2, hi_var_real] + else if mode = "bound" then + let ineq2 = float_add_hi pp f_hi a_tm in + let ineq3 = float_sub_lo pp f_lo a_tm in + MY_PROVE_HYP ineq2 o MY_PROVE_HYP ineq3, + [(rand o concl) ineq2, hi_var_real; (lhand o concl) ineq3, lo_var_real] + else + let ineq2 = float_sub_lo pp f_lo a_tm in + MY_PROVE_HYP ineq2, [(lhand o concl) ineq2, lo_var_real] in + + (* final step *) + let inst_list = + let inst1 = zip dfs df_vars in + let inst2 = zip (List.flatten dds) (List.flatten dd_vars) in + let inst3 = zip ws w_vars in + inst1 @ inst2 @ inst3 in + + (MY_PROVE_HYP m_taylor_th o MY_PROVE_HYP dd_th o MY_PROVE_HYP d_th o + MY_PROVE_HYP ineq1_th o prove_ineq2 o + INST ([f_hi, f_hi_var; f_lo, f_lo_var; error_tm, error_var; + a_tm, a_var_real; b_tm, b_var_real; + y_tm, y_var; domain_tm, domain_var; + f_tm, f_var] @ bounds_inst @ inst_list)) bound_th;; + + +(* upper *) +let eval_m_taylor_upper_bound = eval_m_taylor_bounds0 "upper";; + +(* lower *) +let eval_m_taylor_lower_bound = eval_m_taylor_bounds0 "lower";; + +(* bound *) +let eval_m_taylor_bound = eval_m_taylor_bounds0 "bound";; + + + + +(******************************) +(* taylor_upper_partial_bound *) +(* taylor_lower_partial_bound *) + + +(* bound *) +let M_TAYLOR_PARTIAL_BOUND' = + prove(`m_taylor_interval f domain (y:real^N) (vector w) f_bounds d_bounds_list dd_bounds_list /\ + i IN 1..dimindex (:N) /\ + EL (i - 1) d_bounds_list = (df_lo, df_hi) /\ + (!x. x IN interval [domain] ==> all_n 1 dd_list + (\j int. interval_arith (if j <= i then partial2 j i f x else partial2 i j f x) int)) /\ + LENGTH dd_list = dimindex (:N) /\ + LENGTH d_bounds_list = dimindex (:N) /\ + LENGTH w = dimindex (:N) /\ + ITLIST2 (\a b c. b * iabs a + c) dd_list w (&0) <= error /\ + df_hi + error <= hi ==> + lo <= df_lo - error ==> + (!x. x IN interval [domain] ==> interval_arith (partial i f x) (lo, hi))`, + REWRITE_TAC[m_taylor_interval; m_lin_approx; ALL_N_EL; GSYM m_bounded_on_int] THEN + set_tac "s" `ITLIST2 _1 _2 _3 _4` THEN REPEAT STRIP_TAC THEN + SUBGOAL_THEN `1 <= i /\ i <= dimindex (:N)` (LABEL_TAC "i_in") THENL + [ + ASM_REWRITE_TAC[GSYM IN_NUMSEG]; + ALL_TAC + ] THEN + SUBGOAL_THEN `diff2_domain domain (f:real^N->real)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + SIMP_TAC[diff2_domain; diff2c_domain; diff2c]; + ALL_TAC + ] THEN + REWRITE_TAC[ETA_AX] THEN apply_tac m_taylor_partial_bounds THEN + MAP_EVERY EXISTS_TAC [`y:real^N`; `vector w:real^N`; `error:real`; `df_lo:real`; `df_hi:real`] THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i - 1`) THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= i /\ i <= n ==> i - 1 < n`] THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= i ==> 1 + i - 1 = i`; interval_arith] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + REWRITE_TAC[m_taylor_partial_error] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `s:real` THEN ASM_REWRITE_TAC[] THEN + EXPAND_TAC "s" THEN new_rewrite [] [] ITLIST2_EQ_SUM THEN ASM_REWRITE_TAC[LE_REFL] THEN + MATCH_MP_TAC SUM_LE THEN REWRITE_TAC[FINITE_NUMSEG] THEN + move ["j"; "j_in"] THEN + ASM_SIMP_TAC[VECTOR_COMPONENT] THEN + MATCH_MP_TAC REAL_LE_LMUL THEN CONJ_TAC THENL + [ + UNDISCH_TAC `m_cell_domain domain (y:real^N) (vector w)` THEN + new_rewrite [] [] pair_eq THEN REWRITE_TAC[m_cell_domain] THEN + DISCH_THEN (MP_TAC o SPEC `j:num`) THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[VECTOR_COMPONENT] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:real^N`) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `j - 1`) THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN DISCH_TAC THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= j /\ j <= n ==> j - 1 < n`] THEN + ASM_SIMP_TAC[ARITH_RULE `!i. 1 <= i ==> 1 + i - 1 = i`; GSYM partial2] THEN + DISCH_THEN (MP_TAC o MATCH_MP interval_arith_abs_le) THEN + COND_CASES_TAC THEN TRY (DISCH_THEN MATCH_MP_TAC THEN REWRITE_TAC[REAL_LE_REFL]) THEN + new_rewrite [] [] mixed_second_partials THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + ASM_SIMP_TAC[diff2c_domain]; + ALL_TAC + ] THEN + DISCH_THEN MATCH_MP_TAC THEN REWRITE_TAC[REAL_LE_REFL]);; + + +(* upper *) +let M_TAYLOR_PARTIAL_UPPER' = + prove(`m_taylor_interval f domain (y:real^N) (vector w) f_bounds d_bounds_list dd_bounds_list /\ + i IN 1..dimindex (:N) /\ + EL (i - 1) d_bounds_list = (df_lo, df_hi) /\ + (!x. x IN interval [domain] ==> all_n 1 dd_list + (\j int. interval_arith (if j <= i then partial2 j i f x else partial2 i j f x) int)) /\ + LENGTH dd_list = dimindex (:N) /\ + LENGTH d_bounds_list = dimindex (:N) /\ + LENGTH w = dimindex (:N) /\ + ITLIST2 (\a b c. b * iabs a + c) dd_list w (&0) <= error /\ + df_hi + error <= hi ==> + (!x. x IN interval [domain] ==> partial i f x <= hi)`, + REPEAT STRIP_TAC THEN + MP_TAC (INST[`df_lo - error`, `lo:real`] M_TAYLOR_PARTIAL_BOUND') THEN ASM_REWRITE_TAC[REAL_LE_REFL] THEN + ASM_SIMP_TAC[interval_arith]);; + + +(* lower *) +let M_TAYLOR_PARTIAL_LOWER' = + prove(`m_taylor_interval f domain (y:real^N) (vector w) f_bounds d_bounds_list dd_bounds_list /\ + i IN 1..dimindex (:N) /\ + EL (i - 1) d_bounds_list = (df_lo, df_hi) /\ + (!x. x IN interval [domain] ==> all_n 1 dd_list + (\j int. interval_arith (if j <= i then partial2 j i f x else partial2 i j f x) int)) /\ + LENGTH dd_list = dimindex (:N) /\ + LENGTH d_bounds_list = dimindex (:N) /\ + LENGTH w = dimindex (:N) /\ + ITLIST2 (\a b c. b * iabs a + c) dd_list w (&0) <= error /\ + lo <= df_lo - error ==> + (!x. x IN interval [domain] ==> lo <= partial i f x)`, + REPEAT STRIP_TAC THEN + MP_TAC (INST[`df_hi + error`, `hi:real`] M_TAYLOR_PARTIAL_BOUND') THEN ASM_REWRITE_TAC[REAL_LE_REFL] THEN + ASM_SIMP_TAC[interval_arith]);; + + + + +(* arrays *) +let gen_taylor_partial_bound_th = + let imp_and_eq = TAUT `((P ==> Q) /\ (P ==> R)) <=> (P ==> Q /\ R)` in + let mk_list_hd l = mk_list (l, type_of (hd l)) in + let dd_list_var = `dd_list : (real#real)list` in + fun bound_th n i -> + let ns = 1--n in + let i_tm = mk_small_numeral i in + let w_list = mk_list_hd (map (fun i -> w_vars_array.(i)) ns) in + let d_bounds_list = mk_list_hd (map (fun i -> df_vars_array.(i)) ns) in + let dd_bounds_list = mk_list_hd + (map (fun i -> mk_list_hd (map (fun j -> dd_vars_array.(i).(j)) (1--i))) ns) in + let dd_list = mk_list_hd + (map (fun j -> if j <= i then dd_vars_array.(i).(j) else dd_vars_array.(j).(i)) ns) in + + let th1 = (INST[w_list, w_var_real_list; d_bounds_list, d_bounds_list_var; dd_list, dd_list_var; i_tm, `i:num`; + dd_bounds_list, dd_bounds_list_var] o INST_TYPE[n_type_array.(n), nty]) bound_th in + let th2 = REWRITE_RULE[REAL_ADD_RID; HD; TL; ITLIST2_DEF; LENGTH; ARITH; dimindex_array.(n)] th1 in + let th3 = REWRITE_RULE[IN_NUMSEG; ARITH; el_thms_array.(n).(i - 1)] th2 in + let th4 = (REWRITE_RULE[] o INST[`df_lo:real, df_hi:real`, df_vars_array.(i)]) th3 in + let th5 = (MY_RULE o REWRITE_RULE[GSYM imp_and_eq; GSYM AND_FORALL_THM; all_n; ARITH]) th4 in + + let m_taylor_hyp = find (can dest_m_taylor) (hyp th5) in + let t_th0 = (REWRITE_RULE[ARITH; all_n; second_bounded; m_taylor_interval] o ASSUME) m_taylor_hyp in + let t_th1 = REWRITE_RULE[GSYM imp_and_eq; GSYM AND_FORALL_THM] t_th0 in + (MY_RULE_NUM o REWRITE_RULE[GSYM error_mul_f2; t_th1] o DISCH_ALL) th5;; + + +(* The (n, i)-th element is the theorem |- i IN 1..dimindex (:n) *) +let i_in_array = Array.init (max_dim + 1) + (fun i -> Array.init (i + 1) + (fun j -> + if j < 1 then TRUTH else + let j_tm = mk_small_numeral j in + let tm0 = `j IN 1..dimindex (:N)` in + let tm1 = (subst [j_tm, `j:num`] o inst [n_type_array.(i), nty]) tm0 in + prove(tm1, REWRITE_TAC[dimindex_array.(i); IN_NUMSEG] THEN ARITH_TAC)));; + +let m_taylor_partial_upper_array, m_taylor_partial_lower_array, m_taylor_partial_bound_array = + let gen_array bound_th = Array.init (max_dim + 1) + (fun i -> Array.init (i + 1) + (fun j -> if j < 1 then TRUTH else gen_taylor_partial_bound_th bound_th i j)) in + gen_array M_TAYLOR_PARTIAL_UPPER', gen_array M_TAYLOR_PARTIAL_LOWER', gen_array M_TAYLOR_PARTIAL_BOUND';; + + +(***************************) + + +let eval_m_taylor_partial_bounds0 mode n pp i m_taylor_th = + let bound_th = + if mode = "upper" then + m_taylor_partial_upper_array.(n).(i) + else if mode = "bound" then + m_taylor_partial_bound_array.(n).(i) + else + m_taylor_partial_lower_array.(n).(i) in + + let f_tm, domain_tm, y_tm, w_tm, f_bounds, d_bounds_list, dd_bounds_list = dest_m_taylor (concl m_taylor_th) in + let ws = dest_list (rand w_tm) and + dfs = dest_list d_bounds_list and + dds = map dest_list (dest_list dd_bounds_list) in + let ns = 1--n in + let df_lo, df_hi = dest_pair (List.nth dfs (i - 1)) and + df_vars = map (fun i -> df_vars_array.(i)) ns and + dd_vars = map (fun i -> map (fun j -> dd_vars_array.(i).(j)) (1--i)) ns and + w_vars = map (fun i -> w_vars_array.(i)) ns and + y_var = mk_var ("y", type_of y_tm) and + f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + (* sum of second partials *) + let dd_list = map + (fun j -> if j <= i then List.nth (List.nth dds (i-1)) (j-1) else List.nth (List.nth dds (j-1)) (i-1)) ns in + + let dd_th = + let mul_dd = map2 (error_mul_f2_le_conv2 pp) ws dd_list in + end_itlist (add_ineq_hi pp) mul_dd in + + let error_tm = (rand o concl) dd_th in + + (* additional inequalities *) + let prove_ineq, bounds_inst = + if mode = "upper" then + let ineq2 = float_add_hi pp df_hi error_tm in + MY_PROVE_HYP ineq2, [(rand o concl) ineq2, hi_var_real] + else if mode = "bound" then + let ineq2 = float_add_hi pp df_hi error_tm in + let ineq3 = float_sub_lo pp df_lo error_tm in + MY_PROVE_HYP ineq2 o MY_PROVE_HYP ineq3, + [(rand o concl) ineq2, hi_var_real; (lhand o concl) ineq3, lo_var_real] + else + let ineq2 = float_sub_lo pp df_lo error_tm in + MY_PROVE_HYP ineq2, [(lhand o concl) ineq2, lo_var_real] in + + (* final step *) + let inst_list = + let inst1 = zip dfs df_vars in + let inst2 = zip (List.flatten dds) (List.flatten dd_vars) in + let inst3 = zip ws w_vars in + inst1 @ inst2 @ inst3 in + + (MY_PROVE_HYP m_taylor_th o MY_PROVE_HYP dd_th o prove_ineq o + INST ([df_hi, df_hi_var; df_lo, df_lo_var; error_tm, error_var; + y_tm, y_var; domain_tm, domain_var; f_bounds, f_bounds_var; + f_tm, f_var] @ bounds_inst @ inst_list)) bound_th;; + + +(* upper *) +let eval_m_taylor_partial_upper = eval_m_taylor_partial_bounds0 "upper";; + +(* lower *) +let eval_m_taylor_partial_lower = eval_m_taylor_partial_bounds0 "lower";; + +(* bound *) +let eval_m_taylor_partial_bound = eval_m_taylor_partial_bounds0 "bound";; + + + +end;; diff --git a/formal_ineqs/taylor/m_taylor_arith.hl b/formal_ineqs/taylor/m_taylor_arith.hl new file mode 100644 index 0000000..e6b1375 --- /dev/null +++ b/formal_ineqs/taylor/m_taylor_arith.hl @@ -0,0 +1,1604 @@ +(* =========================================================== *) +(* Formal arithmetic of taylor intervals *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +needs "taylor/m_taylor.hl";; +needs "misc/vars.hl";; + +module M_taylor_arith = struct + +open Arith_misc;; +open Arith_nat;; +open Arith_float;; +open More_float;; +open Float_atn;; +open Float_theory;; +open M_taylor;; +open Misc_vars;; + + +let sqrt_tm = `sqrt` and + atn_tm = `atn` and + acs_tm = `acs`;; + + +(*************************************) + +let binary_beta_gen_eq f1_tm f2_tm x_var op_tm = + let beta_tm1, beta_tm2 = mk_comb (f1_tm, x_var), mk_comb (f2_tm, x_var) in + let beta_th1 = if is_abs f1_tm then BETA beta_tm1 else REFL beta_tm1 and + beta_th2 = if is_abs f2_tm then BETA beta_tm2 else REFL beta_tm2 in + ABS x_var (MK_COMB (AP_TERM op_tm beta_th1, beta_th2));; + + +let unary_beta_gen_eq f_tm x_var op_tm = + let beta_tm = mk_comb (f_tm, x_var) in + let beta_th = if is_abs f_tm then BETA beta_tm else REFL beta_tm in + ABS x_var (AP_TERM op_tm beta_th);; + + + +let m_taylor_interval_norm th eq_th = + let lhs1, d2f = dest_comb (concl th) in + let lhs2, d1f = dest_comb lhs1 in + let lhs3, d0f = dest_comb lhs2 in + let lhs4, w = dest_comb lhs3 in + let lhs5, y = dest_comb lhs4 in + let lhs6, domain = dest_comb lhs5 in + let m_taylor = rator lhs6 in + let th0 = AP_TERM m_taylor eq_th in + let th1 = AP_THM (AP_THM (AP_THM (AP_THM (AP_THM (AP_THM th0 domain) y) w) d0f) d1f) d2f in + EQ_MP th1 th;; + + + + +(*****************************************) +(* dest_m_lin_approx *) + + +let MK_M_LIN_APPROX' = (RULE o MATCH_MP EQ_IMP o SYM o SPEC_ALL) m_lin_approx;; +let DEST_M_LIN_APPROX' = MY_RULE_NUM m_lin_approx;; + + + +let m_lin_approx_components n m_lin_th = + let f_tm, x_tm, f_bounds, d_bounds_list = dest_lin_approx (concl m_lin_th) in + let ty = n_type_array.(n) in + let f_var = mk_var ("f", type_of f_tm) in + let x_var = mk_var ("x", type_of x_tm) in + let th0 = (INST[f_tm, f_var; x_tm, x_var; f_bounds, f_bounds_var; + d_bounds_list, df_bounds_list_var] o inst_first_type_var ty) DEST_M_LIN_APPROX' in + let th1 = EQ_MP th0 m_lin_th in + let [r1; r2; r3] = CONJUNCTS th1 in + r1, r2, r3;; + + +(********************************) +(* all_n manipulations *) + +let ALL_N_EMPTY' = prove(`all_n n [] (s:num->A->bool)`, REWRITE_TAC[all_n]);; +let ALL_N_CONS_IMP' = (MY_RULE o prove)(`SUC n = m /\ s n (x:A) ==> + (all_n m t s <=> all_n n (CONS x t) s)`, SIMP_TAC[all_n]);; +let ALL_N_CONS_EQ' = (MY_RULE o prove)(`SUC n = m ==> + (all_n n (CONS x t) s <=> (s n (x:A) /\ all_n m t s))`, SIMP_TAC[all_n]);; + +let dest_all_n all_n_tm = + let ltm, s_tm = dest_comb all_n_tm in + let ltm2, list_tm = dest_comb ltm in + rand ltm2, list_tm, s_tm;; + + +(* Splits `|- all_n n list s` into separate components. + Also returns the list of SUC n = m theorems *) +let all_n_components all_n_th = + let n_tm, list_tm, s_tm = dest_all_n (concl all_n_th) in + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let s_var = mk_var ("s", type_of s_tm) and + x_var = mk_var ("x", ty) and + t_var = mk_var ("t", list_ty) in + let all_n_cons_th = (INST[s_tm, s_var] o INST_TYPE[ty, aty]) ALL_N_CONS_EQ' in + + let rec get_components n_tm list_tm all_n_th = + if is_const list_tm then [], [] + else + let x_tm, t_tm = dest_cons list_tm in + let suc_th = raw_suc_conv_hash (mk_comb (suc_op_num, n_tm)) in + let m_tm = rand (concl suc_th) in + let th0 = INST[n_tm, n_var_num; m_tm, m_var_num; x_tm, x_var; t_tm, t_var] all_n_cons_th in + let th1 = MY_PROVE_HYP suc_th th0 in + let th2 = EQ_MP th1 all_n_th in + let snx_th, all_m_th = CONJUNCT1 th2, CONJUNCT2 th2 in + let comps, suc_list = get_components m_tm t_tm all_m_th in + snx_th :: comps, suc_th :: suc_list in + get_components n_tm list_tm all_n_th;; + + +(* Builds all_n from the given theorems and SUC n = m results *) +let build_all_n ths suc_ths = + (* The list ths should be not empty *) + let tm0 = (concl o hd) ths in + let lhs, rhs = dest_comb tm0 in + let s_tm = rator lhs in + let ty = type_of rhs in + let list_ty = mk_type ("list", [ty]) in + let s_var = mk_var ("s", type_of s_tm) and + x_var = mk_var ("x", ty) and + t_var = mk_var ("t", list_ty) in + let m_tm = (rand o concl o hd) suc_ths in + + let empty_th = (INST[s_tm, s_var; m_tm, n_var_num] o INST_TYPE[ty, aty]) ALL_N_EMPTY' in + let cons_th = (INST[s_tm, s_var] o INST_TYPE[ty, aty]) ALL_N_CONS_IMP' in + + let build suc_th s_th th = + let t_tm = (rand o rator o concl) th in + let x_tm = rand (concl s_th) in + let lhs, m_tm = dest_eq (concl suc_th) in + let n_tm = rand lhs in + let th' = INST[n_tm, n_var_num; m_tm, m_var_num; x_tm, x_var; t_tm, t_var] cons_th in + EQ_MP (MY_PROVE_HYP s_th (MY_PROVE_HYP suc_th th')) th in + + rev_itlist2 build suc_ths ths empty_th;; + + +(*************************) + +(* Generates |- s D1 a1 /\ ... /\ s D_m a_m <=> all_n D1 [a1; ... ; a_m] s *) +let gen_all_n_th m = + let a_vars = map (fun i -> mk_var ("a"^string_of_int i, aty)) (1--m) in + let list_tm = mk_list (a_vars, aty) in + let all_tm = mk_comb (mk_binop `all_n : num -> (A)list -> (num -> A -> bool) -> bool` `1` list_tm, + `s : num -> A -> bool`) in + (SYM o MY_RULE_NUM o CONV_RULE NUM_REDUCE_CONV) (REWRITE_CONV[all_n] all_tm);; + +let all_n_array = Array.init (max_dim + 1) (fun i -> if i = 0 then TRUTH else gen_all_n_th i);; + +(***) + +let build2 ths = + let n = length ths in + let th0 = rev_itlist CONJ (tl ths) (hd ths) in + let tm0 = (concl o hd) ths in + let lhs, rhs = dest_comb tm0 in + let a_tms = rev (map (rand o concl) ths) in + let s_tm = rator lhs in + let ty = type_of rhs in + let s_var = mk_var ("s", type_of s_tm) and + a_vars0 = map (fun i -> mk_var ("a"^string_of_int i, ty)) (1--n) in + + let th1 = (INST[s_tm, s_var] o INST (zip a_tms a_vars0) o INST_TYPE[ty, aty]) all_n_array.(n) in + EQ_MP th1 th0;; + + + + +(************************) + + +(* Constructs all_n n (map s list1) *) +let eval_all_n all_n1_th beta_flag s = + let ths1', suc_ths = all_n_components all_n1_th in + let ths1 = if beta_flag then map MY_BETA_RULE ths1' else ths1' in + let ths1, suc_ths = List.rev ths1, List.rev suc_ths in + let ths = map s ths1 in +(* build_all_n ths suc_ths;; *) + build2 ths;; + + + +(* Constructs all_n n (map2 s list1 list2) *) +let eval_all_n2 all_n1_th all_n2_th beta_flag s = + let ths1', suc_ths = all_n_components all_n1_th in + let ths2', _ = all_n_components all_n2_th in + let ths1, ths2 = + if beta_flag then map MY_BETA_RULE ths1', map MY_BETA_RULE ths2' else ths1', ths2' in + + let ths1, ths2, suc_ths = List.rev ths1, List.rev ths2, List.rev suc_ths in + let ths = map2 s ths1 ths2 in +(* build_all_n ths suc_ths;; *) + build2 ths;; + + + +(***************************************) +(* eval_m_taylor_add *) + + +let SECOND_BOUNDED' = MY_RULE_NUM second_bounded;; + +let dest_second_bounded tm = + let ltm, dd = dest_comb tm in + let ltm2, domain = dest_comb ltm in + rand ltm2, domain, dd;; + +let second_bounded_components n th = + let f_tm, domain_tm, dd_tm = dest_second_bounded (concl th) in + let x_var = mk_var ("x", n_vector_type_array.(n)) in + let th0 = (INST[f_tm, mk_var ("f", type_of f_tm); + domain_tm, mk_var ("domain", type_of domain_tm); + dd_tm, dd_bounds_list_var] o inst_first_type_var n_type_array.(n)) SECOND_BOUNDED' in + UNDISCH (SPEC x_var (EQ_MP th0 th));; + + + + +let MK_M_TAYLOR_ADD' = (MY_RULE_NUM o prove) + (`m_cell_domain domain (y:real^N) w ==> + diff2c_domain domain f ==> + diff2c_domain domain g ==> + interval_arith (f y + g y) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (partial i f y + partial i g y) int) ==> + (!x. x IN interval [domain] ==> all_n 1 dd_bounds_list (\i list_i. all_n 1 list_i + (\j int. interval_arith (partial2 j i f x + partial2 j i g x) int))) ==> + m_taylor_interval (\x. f x + g x) domain y w bounds d_bounds_list dd_bounds_list`, + REWRITE_TAC[m_taylor_interval; m_lin_approx; second_bounded] THEN + REPEAT DISCH_TAC THEN + SUBGOAL_THEN `lift o f differentiable at (y:real^N) /\ lift o g differentiable at y` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + UNDISCH_TAC `diff2c_domain domain (g:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN STRIP_TAC THEN STRIP_TAC THEN + REPEAT (new_rewrite [] [] diff2_imp_diff) THEN REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC y_in_domain THEN EXISTS_TAC `w:real^N` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + new_rewrite [] [] diff2c_domain_add THEN ASM_REWRITE_TAC[]; + REWRITE_TAC[f_lift_add] THEN + new_rewrite [] [] DIFFERENTIABLE_ADD THEN + ASM_REWRITE_TAC[ETA_AX]; + ASM_SIMP_TAC[partial_add]; + ALL_TAC + ] THEN + + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + UNDISCH_TAC `diff2c_domain domain (g:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN + REPEAT (DISCH_THEN (MP_TAC o SPEC `x:real^N` o CONJUNCT1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC) THEN + ASM_SIMP_TAC[second_partial_add]);; + + +(*************************) + + +let add_partial_lemma' = prove(`interval_arith (partial i f (x:real^N) + partial i g x) int <=> + (\i int. interval_arith (partial i f x + partial i g x) int) i int`, + REWRITE_TAC[]);; + +let add_second_lemma' = prove(`interval_arith (partial2 j i f (x:real^N) + partial2 j i g x) int <=> + (\j int. interval_arith (partial2 j i f x + partial2 j i g x) int) j int`, + REWRITE_TAC[]);; + +let add_second_lemma'' = (NUMERALS_TO_NUM o prove)(`all_n 1 list + (\j int. interval_arith (partial2 j i f (x:real^N) + partial2 j i g x) int) <=> + (\i list. all_n 1 list + (\j int. interval_arith (partial2 j i f x + partial2 j i g x) int)) i list`, + REWRITE_TAC[]);; + + + + +let eval_m_taylor_add n p_lin p_second taylor1_th taylor2_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let _, diff2_f2_th, lin2_th, second2_th = dest_m_taylor_thms n taylor2_th in + let f1_tm = (rand o concl) diff2_f1_th and + f2_tm = (rand o concl) diff2_f2_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let ty = type_of y_tm in + + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + g_var = mk_var ("g", type_of f2_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th and + _, bounds2_th, df2_th = m_lin_approx_components n lin2_th in + + let bounds_th = float_interval_add p_lin bounds1_th bounds2_th in + let bounds_tm = (rand o concl) bounds_th in + + let add_lemma0 = (INST[f1_tm, f_var; f2_tm, g_var; y_tm, x_var] o + INST_TYPE[n_type_array.(n), nty]) add_partial_lemma' in + + let add th1 th2 = + let add_th = float_interval_add p_lin th1 th2 in + let int_tm = rand (concl add_th) and + i_tm = (rand o rator o rator o lhand) (concl th1) in + let th0 = INST[i_tm, i_var_num; int_tm, int_var] add_lemma0 in + EQ_MP th0 add_th in + + let df_th = eval_all_n2 df1_th df2_th true add in + let d_bounds_list = (rand o rator o concl) df_th in + + + let dd1 = second_bounded_components n second1_th in + let dd2 = second_bounded_components n second2_th in + + let add_second_lemma0 = (INST[f1_tm, f_var; f2_tm, g_var] o + INST_TYPE[n_type_array.(n), nty]) add_second_lemma' in + + let add_second_lemma1 = (INST[f1_tm, f_var; f2_tm, g_var] o + INST_TYPE[n_type_array.(n), nty]) add_second_lemma'' in + + + let add_second2 th1 th2 = + let i_tm = (rand o rator o concl) th1 in + let th1, th2 = MY_BETA_RULE th1, MY_BETA_RULE th2 in + let lemma = INST[i_tm, i_var_num] add_second_lemma0 in + let add_second th1 th2 = + let add_th = float_interval_add p_second th1 th2 in + let int_tm = rand (concl add_th) and + j_tm = (rand o rator o rator o rator o lhand) (concl th1) in + let th0 = INST[j_tm, j_var_num; int_tm, int_var] lemma in + EQ_MP th0 add_th in + let add_th = eval_all_n2 th1 th2 true add_second in + let list_tm = (rand o rator o concl) add_th in + let lemma1 = INST[i_tm, i_var_num; list_tm, list_var_real_pair] add_second_lemma1 in + EQ_MP lemma1 add_th in + + + let dd_th0 = eval_all_n2 dd1 dd2 false add_second2 in + let dd_list = (rand o rator o concl) dd_th0 in + let dd_th = GEN x_var (DISCH_ALL dd_th0) in + + let th = (MY_PROVE_HYP dd_th o MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP diff2_f2_th o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP df_th o MY_PROVE_HYP domain_th o + INST[f1_tm, f_var; f2_tm, g_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var; d_bounds_list, d_bounds_list_var; + dd_list, dd_bounds_list_var] o + INST_TYPE[n_type_array.(n), nty]) MK_M_TAYLOR_ADD' in + let eq_th = binary_beta_gen_eq f1_tm f2_tm x_var add_op_real in + m_taylor_interval_norm th eq_th;; + + + +(***************************************) +(* eval_m_taylor_sub *) + + +let MK_M_TAYLOR_SUB' = (MY_RULE_NUM o prove) + (`m_cell_domain domain (y:real^N) w ==> + diff2c_domain domain f ==> + diff2c_domain domain g ==> + interval_arith (f y - g y) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (partial i f y - partial i g y) int) ==> + (!x. x IN interval [domain] ==> all_n 1 dd_bounds_list (\i list_i. all_n 1 list_i + (\j int. interval_arith (partial2 j i f x - partial2 j i g x) int))) ==> + m_taylor_interval (\x. f x - g x) domain y w bounds d_bounds_list dd_bounds_list`, + REWRITE_TAC[m_taylor_interval; m_lin_approx; second_bounded] THEN + REPEAT DISCH_TAC THEN + SUBGOAL_THEN `lift o f differentiable at (y:real^N) /\ lift o g differentiable at y` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + UNDISCH_TAC `diff2c_domain domain (g:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN STRIP_TAC THEN STRIP_TAC THEN + REPEAT (new_rewrite [] [] diff2_imp_diff) THEN REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC y_in_domain THEN EXISTS_TAC `w:real^N` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + new_rewrite [] [] diff2c_domain_sub THEN ASM_REWRITE_TAC[]; + REWRITE_TAC[f_lift_sub] THEN + new_rewrite [] [] DIFFERENTIABLE_SUB THEN + ASM_REWRITE_TAC[ETA_AX]; + ASM_SIMP_TAC[partial_sub]; + ALL_TAC + ] THEN + + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + UNDISCH_TAC `diff2c_domain domain (g:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN + REPEAT (DISCH_THEN (MP_TAC o SPEC `x:real^N` o CONJUNCT1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC) THEN + ASM_SIMP_TAC[second_partial_sub]);; + + +(*************************) + + +let sub_partial_lemma' = prove(`interval_arith (partial i f (x:real^N) - partial i g x) int <=> + (\i int. interval_arith (partial i f x - partial i g x) int) i int`, + REWRITE_TAC[]);; + +let sub_second_lemma' = prove(`interval_arith (partial2 j i f (x:real^N) - partial2 j i g x) int <=> + (\j int. interval_arith (partial2 j i f x - partial2 j i g x) int) j int`, + REWRITE_TAC[]);; + +let sub_second_lemma'' = (NUMERALS_TO_NUM o prove)(`all_n 1 list + (\j int. interval_arith (partial2 j i f (x:real^N) - partial2 j i g x) int) <=> + (\i list. all_n 1 list + (\j int. interval_arith (partial2 j i f x - partial2 j i g x) int)) i list`, + REWRITE_TAC[]);; + + + + +let eval_m_taylor_sub n p_lin p_second taylor1_th taylor2_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let _, diff2_f2_th, lin2_th, second2_th = dest_m_taylor_thms n taylor2_th in + let f1_tm = (rand o concl) diff2_f1_th and + f2_tm = (rand o concl) diff2_f2_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let ty = type_of y_tm in + + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + g_var = mk_var ("g", type_of f2_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th and + _, bounds2_th, df2_th = m_lin_approx_components n lin2_th in + + let bounds_th = float_interval_sub p_lin bounds1_th bounds2_th in + let bounds_tm = (rand o concl) bounds_th in + + let sub_lemma0 = (INST[f1_tm, f_var; f2_tm, g_var; y_tm, x_var] o + INST_TYPE[n_type_array.(n), nty]) sub_partial_lemma' in + + let sub th1 th2 = + let sub_th = float_interval_sub p_lin th1 th2 in + let int_tm = rand (concl sub_th) and + i_tm = (rand o rator o rator o lhand) (concl th1) in + let th0 = INST[i_tm, i_var_num; int_tm, int_var] sub_lemma0 in + EQ_MP th0 sub_th in + + let df_th = eval_all_n2 df1_th df2_th true sub in + let d_bounds_list = (rand o rator o concl) df_th in + + + let dd1 = second_bounded_components n second1_th in + let dd2 = second_bounded_components n second2_th in + + let sub_second_lemma0 = (INST[f1_tm, f_var; f2_tm, g_var] o + INST_TYPE[n_type_array.(n), nty]) sub_second_lemma' in + + let sub_second_lemma1 = (INST[f1_tm, f_var; f2_tm, g_var] o + INST_TYPE[n_type_array.(n), nty]) sub_second_lemma'' in + + + let sub_second2 th1 th2 = + let i_tm = (rand o rator o concl) th1 in + let th1, th2 = MY_BETA_RULE th1, MY_BETA_RULE th2 in + let lemma = INST[i_tm, i_var_num] sub_second_lemma0 in + let sub_second th1 th2 = + let sub_th = float_interval_sub p_second th1 th2 in + let int_tm = rand (concl sub_th) and + j_tm = (rand o rator o rator o rator o lhand) (concl th1) in + let th0 = INST[j_tm, j_var_num; int_tm, int_var] lemma in + EQ_MP th0 sub_th in + let sub_th = eval_all_n2 th1 th2 true sub_second in + let list_tm = (rand o rator o concl) sub_th in + let lemma1 = INST[i_tm, i_var_num; list_tm, list_var_real_pair] sub_second_lemma1 in + EQ_MP lemma1 sub_th in + + + let dd_th0 = eval_all_n2 dd1 dd2 false sub_second2 in + let dd_list = (rand o rator o concl) dd_th0 in + let dd_th = GEN x_var (DISCH_ALL dd_th0) in + + let th = (MY_PROVE_HYP dd_th o MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP diff2_f2_th o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP df_th o MY_PROVE_HYP domain_th o + INST[f1_tm, f_var; f2_tm, g_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var; d_bounds_list, d_bounds_list_var; + dd_list, dd_bounds_list_var] o + INST_TYPE[n_type_array.(n), nty]) MK_M_TAYLOR_SUB' in + let eq_th = binary_beta_gen_eq f1_tm f2_tm x_var sub_op_real in + m_taylor_interval_norm th eq_th;; + + +(*******************************************************) + + +(***************************************) +(* eval_m_taylor_mul *) + + +let MK_M_TAYLOR_MUL' = (MY_RULE_NUM o prove) + (`m_cell_domain domain (y:real^N) w ==> + diff2c_domain domain f ==> + diff2c_domain domain g ==> + interval_arith (f y * g y) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (partial i f y * g y + f y * partial i g y) int) ==> + (!x. x IN interval [domain] ==> all_n 1 dd_bounds_list (\i list_i. all_n 1 list_i + (\j int. interval_arith ((partial2 j i f x * g x + partial i f x * partial j g x) + + partial j f x * partial i g x + f x * partial2 j i g x) int))) ==> + m_taylor_interval (\x. f x * g x) domain y w bounds d_bounds_list dd_bounds_list`, + REWRITE_TAC[m_taylor_interval; m_lin_approx; second_bounded] THEN + REPEAT DISCH_TAC THEN + SUBGOAL_THEN `lift o f differentiable at (y:real^N) /\ lift o g differentiable at y` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + UNDISCH_TAC `diff2c_domain domain (g:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN STRIP_TAC THEN STRIP_TAC THEN + REPEAT (new_rewrite [] [] diff2_imp_diff) THEN REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC y_in_domain THEN EXISTS_TAC `w:real^N` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + new_rewrite [] [] diff2c_domain_mul THEN ASM_REWRITE_TAC[]; + new_rewrite [] [] differentiable_mul THEN ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[partial_mul]; + ALL_TAC + ] THEN + + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + UNDISCH_TAC `diff2c_domain domain (g:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN + REPEAT (DISCH_THEN (MP_TAC o SPEC `x:real^N` o CONJUNCT1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC) THEN + ASM_SIMP_TAC[second_partial_mul]);; + + +(*************************) + + +let mul_partial_lemma' = + prove(`interval_arith (partial i f (y:real^N) * g y + f y * partial i g y) int <=> + (\i int. interval_arith (partial i f y * g y + f y * partial i g y) int) i int`, + REWRITE_TAC[]);; + +let mul_second_lemma' = + prove(`interval_arith ((partial2 j i f x * g (x:real^N) + partial i f x * partial j g x) + + partial j f x * partial i g x + f x * partial2 j i g x) int <=> + (\j int. interval_arith ((partial2 j i f x * g x + partial i f x * partial j g x) + + partial j f x * partial i g x + f x * partial2 j i g x) int) j int`, + REWRITE_TAC[]);; + + +let mul_second_lemma'' = (NUMERALS_TO_NUM o prove) + (`all_n 1 list (\j int. interval_arith ((partial2 j i f x * g x + partial i f x * partial j g x) + + partial j f x * partial i g x + f (x:real^N) * partial2 j i g x) int) <=> + (\i list. all_n 1 list + (\j int. interval_arith ((partial2 j i f x * g x + partial i f x * partial j g x) + + partial j f x * partial i g x + f x * partial2 j i g x) int)) i list`, + REWRITE_TAC[]);; + + + + +let eval_m_taylor_mul n p_lin p_second taylor1_th taylor2_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th and + _, diff2_f2_th, lin2_th, second2_th = dest_m_taylor_thms n taylor2_th in + let f1_tm = (rand o concl) diff2_f1_th and + f2_tm = (rand o concl) diff2_f2_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let ty = type_of y_tm in + + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + g_var = mk_var ("g", type_of f2_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th and + _, bounds2_th, df2_th = m_lin_approx_components n lin2_th in + + let bounds_th = float_interval_mul p_lin bounds1_th bounds2_th in + let bounds_tm = (rand o concl) bounds_th in + + let mul_lemma0 = (INST[f1_tm, f_var; f2_tm, g_var; y_tm, y_var] o + INST_TYPE[n_type_array.(n), nty]) mul_partial_lemma' in + + let mul th1 th2 = + let mul_th = + let ( * ), ( + ) = float_interval_mul p_lin, float_interval_add p_lin in + th1 * bounds2_th + bounds1_th * th2 in + let int_tm = rand (concl mul_th) in + let i_tm = (rand o rator o rator o lhand) (concl th1) in + let th0 = INST[i_tm, i_var_num; int_tm, int_var] mul_lemma0 in + EQ_MP th0 mul_th in + + let df_th = eval_all_n2 df1_th df2_th true mul in + let d_bounds_list = (rand o rator o concl) df_th in + + + let dd1 = second_bounded_components n second1_th in + let dd2 = second_bounded_components n second2_th in + + let mul_second_lemma0 = (INST[f1_tm, f_var; f2_tm, g_var] o + INST_TYPE[n_type_array.(n), nty]) mul_second_lemma' in + + let mul_second_lemma1 = (INST[f1_tm, f_var; f2_tm, g_var] o + INST_TYPE[n_type_array.(n), nty]) mul_second_lemma'' in + + let undisch = UNDISCH o SPEC x_var in + + let d1_bounds = map (fun i -> + let th0 = eval_m_taylor_partial_bound n p_second i taylor1_th in + undisch th0) (1--n) in + + let d2_bounds = map (fun i -> + let th0 = eval_m_taylor_partial_bound n p_second i taylor2_th in + undisch th0) (1--n) in + + let f1_bound = undisch (eval_m_taylor_bound n p_second taylor1_th) and + f2_bound = undisch (eval_m_taylor_bound n p_second taylor2_th) in + + let mul_second2 th1 th2 = + let i_tm = (rand o rator o concl) th1 in + let i_int = (Num.int_of_num o raw_dest_hash) i_tm in + let di1 = List.nth d1_bounds (i_int - 1) and + di2 = List.nth d2_bounds (i_int - 1) in + let th1, th2 = MY_BETA_RULE th1, MY_BETA_RULE th2 in + let lemma = INST[i_tm, i_var_num] mul_second_lemma0 in + let mul_second th1 th2 = + let j_tm = (rand o rator o rator o rator o lhand) (concl th1) in + let j_int = (Num.int_of_num o raw_dest_hash) j_tm in + let dj1 = List.nth d1_bounds (j_int - 1) and + dj2 = List.nth d2_bounds (j_int - 1) in + + let mul_th = + let ( * ), ( + ) = float_interval_mul p_second, float_interval_add p_second in + (th1 * f2_bound + di1 * dj2) + (dj1 * di2 + f1_bound * th2) in + + let int_tm = rand (concl mul_th) in + let th0 = INST[j_tm, j_var_num; int_tm, int_var] lemma in + EQ_MP th0 mul_th in + + let mul_th = eval_all_n2 th1 th2 true mul_second in + let list_tm = (rand o rator o concl) mul_th in + let lemma1 = INST[i_tm, i_var_num; list_tm, list_var_real_pair] mul_second_lemma1 in + EQ_MP lemma1 mul_th in + + + let dd_th0 = eval_all_n2 dd1 dd2 false mul_second2 in + let dd_list = (rand o rator o concl) dd_th0 in + let dd_th = GEN x_var (DISCH_ALL dd_th0) in + + let th = (MY_PROVE_HYP dd_th o MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP diff2_f2_th o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP df_th o MY_PROVE_HYP domain_th o + INST[f1_tm, f_var; f2_tm, g_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var; d_bounds_list, d_bounds_list_var; + dd_list, dd_bounds_list_var] o + INST_TYPE[n_type_array.(n), nty]) MK_M_TAYLOR_MUL' in + let eq_th = binary_beta_gen_eq f1_tm f2_tm x_var mul_op_real in + m_taylor_interval_norm th eq_th;; + + + + + + +(*******************************************************) + +(* neg, inv, sqrt, atn, acs *) + + + +let partial_uni_compose' = + REWRITE_RULE[SWAP_FORALL_THM; GSYM RIGHT_IMP_FORALL_THM] partial_uni_compose;; +let second_partial_uni_compose' = + REWRITE_RULE[SWAP_FORALL_THM; GSYM RIGHT_IMP_FORALL_THM] second_partial_uni_compose;; + + +(* neg *) +let MK_M_TAYLOR_NEG' = (MY_RULE_FLOAT o prove) + (`m_cell_domain domain (y:real^N) w ==> + diff2c_domain domain f ==> + interval_arith (-- (f y)) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (-- partial i f y) int) ==> + (!x. x IN interval [domain] ==> all_n 1 dd_bounds_list (\i list_i. all_n 1 list_i + (\j int. interval_arith (-- partial2 j i f x) int))) ==> + m_taylor_interval (\x. -- (f x)) domain y w bounds d_bounds_list dd_bounds_list`, + REWRITE_TAC[m_taylor_interval; m_lin_approx; second_bounded] THEN + REPEAT DISCH_TAC THEN + SUBGOAL_THEN `lift o f differentiable at (y:real^N)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN STRIP_TAC THEN + REPEAT (new_rewrite [] [] diff2_imp_diff) THEN REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC y_in_domain THEN EXISTS_TAC `w:real^N` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + new_rewrite [] [] diff2c_domain_neg THEN ASM_REWRITE_TAC[]; + REWRITE_TAC[f_lift_neg] THEN + new_rewrite [] [] DIFFERENTIABLE_NEG THEN + ASM_REWRITE_TAC[ETA_AX]; + ASM_SIMP_TAC[partial_neg]; + ALL_TAC + ] THEN + + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN + DISCH_THEN (MP_TAC o SPEC `x:real^N` o CONJUNCT1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_SIMP_TAC[second_partial_neg]);; + + +(* inv *) +let MK_M_TAYLOR_INV' = (UNDISCH_ALL o PURE_REWRITE_RULE[float2_eq] o DISCH_ALL o + MY_RULE_FLOAT o prove) + (`m_cell_domain domain (y:real^N) w ==> + (!x. x IN interval [domain] ==> interval_arith (f x) f_bounds) ==> + interval_not_zero f_bounds ==> + diff2c_domain domain f ==> + interval_arith (inv (f y)) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (--inv (f y * f y) * partial i f y) int) ==> + (!x. x IN interval [domain] ==> all_n 1 dd_bounds_list (\i list_i. all_n 1 list_i + (\j int. interval_arith (((&2 * inv (f x * f x * f x)) * partial j f x) * partial i f x - + inv (f x * f x) * partial2 j i f x) int))) ==> + m_taylor_interval (\x. inv (f x)) domain y w bounds d_bounds_list dd_bounds_list`, + REWRITE_TAC[m_taylor_interval; m_lin_approx; second_bounded; ETA_AX] THEN + REPEAT DISCH_TAC THEN + SUBGOAL_THEN `lift o f differentiable at (y:real^N)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN STRIP_TAC THEN + new_rewrite [] [] diff2_imp_diff THEN REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC y_in_domain THEN EXISTS_TAC `w:real^N` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!x:real^N. x IN interval [domain] ==> ~(f x = &0)` ASSUME_TAC THENL + [ + GEN_TAC THEN DISCH_TAC THEN + apply_tac interval_arith_not_zero THEN + EXISTS_TAC `f_bounds:real#real` THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `~(f (y:real^N) = &0)` ASSUME_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC y_in_domain THEN EXISTS_TAC `w:real^N` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain] THEN REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[GSYM o_THM] THEN REWRITE_TAC[ETA_AX] THEN + apply_tac diff2c_inv_compose THEN CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + new_rewrite [] [`inv _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + apply_tac diff_uni_compose THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_DIFFERENTIABLE_AT_INV THEN ASM_REWRITE_TAC[]; + new_rewrite [] [`inv _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + MP_TAC (ISPECL [`y:real^N`; `f:real^N->real`] partial_uni_compose') THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `inv`) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC REAL_DIFFERENTIABLE_AT_INV THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[derivative_inv]; + ALL_TAC + ] THEN + + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN + DISCH_THEN (MP_TAC o SPEC `x:real^N` o CONJUNCT1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (ISPECL [`x:real^N`; `f:real^N->real`] second_partial_uni_compose') THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `inv`) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC diff2_inv THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + new_rewrite [] [`inv _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + ASM_SIMP_TAC[second_derivative_inv; derivative_inv; REAL_MUL_LNEG; GSYM real_sub] THEN + ASM_SIMP_TAC[REAL_ARITH `a pow 3 = a * a * a`]);; + + +(* sqrt *) +let MK_M_TAYLOR_SQRT' = (UNDISCH_ALL o PURE_REWRITE_RULE[float2_eq; float4_eq] o + DISCH_ALL o MY_RULE_FLOAT o prove) + (`m_cell_domain domain (y:real^N) w ==> + (!x. x IN interval [domain] ==> interval_arith (f x) f_bounds) ==> + interval_pos f_bounds ==> + diff2c_domain domain f ==> + interval_arith (sqrt (f y)) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (inv (&2 * sqrt (f y)) * partial i f y) int) ==> + (!x. x IN interval [domain] ==> all_n 1 dd_bounds_list (\i list_i. all_n 1 list_i + (\j int. interval_arith ((--inv ((&2 * sqrt (f x)) * (&2 * f x)) * partial j f x) * partial i f x + + inv (&2 * sqrt (f x)) * partial2 j i f x) int))) ==> + m_taylor_interval (\x. sqrt (f x)) domain y w bounds d_bounds_list dd_bounds_list`, + REWRITE_TAC[m_taylor_interval; m_lin_approx; second_bounded; ETA_AX] THEN + REPEAT DISCH_TAC THEN + SUBGOAL_THEN `lift o f differentiable at (y:real^N)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN STRIP_TAC THEN + new_rewrite [] [] diff2_imp_diff THEN REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC y_in_domain THEN EXISTS_TAC `w:real^N` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!x:real^N. x IN interval [domain] ==> &0 < f x` ASSUME_TAC THENL + [ + GEN_TAC THEN DISCH_TAC THEN + apply_tac interval_arith_pos THEN + EXISTS_TAC `f_bounds:real#real` THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `&0 < f (y:real^N)` ASSUME_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC y_in_domain THEN EXISTS_TAC `w:real^N` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain] THEN REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[GSYM o_THM] THEN REWRITE_TAC[ETA_AX] THEN + apply_tac diff2c_sqrt_compose THEN CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + new_rewrite [] [`sqrt _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + apply_tac diff_uni_compose THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_DIFFERENTIABLE_AT_SQRT THEN ASM_REWRITE_TAC[]; + new_rewrite [] [`sqrt _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + MP_TAC (ISPECL [`y:real^N`; `f:real^N->real`] partial_uni_compose') THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `sqrt`) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC REAL_DIFFERENTIABLE_AT_SQRT THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[derivative_sqrt]; + ALL_TAC + ] THEN + + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN + DISCH_THEN (MP_TAC o SPEC `x:real^N` o CONJUNCT1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (ISPECL [`x:real^N`; `f:real^N->real`] second_partial_uni_compose') THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `sqrt`) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC diff2_sqrt THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + new_rewrite [] [`sqrt _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + ASM_SIMP_TAC[second_derivative_sqrt; derivative_sqrt] THEN DISCH_THEN (fun th -> ALL_TAC) THEN + REWRITE_TAC[REAL_ARITH `a pow 3 = a * a pow 2`] THEN + new_rewrite [] [] SQRT_MUL THENL + [ + REWRITE_TAC[REAL_LE_POW_2] THEN + MATCH_MP_TAC REAL_LT_IMP_LE THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + new_rewrite [] [] POW_2_SQRT THENL + [ + MATCH_MP_TAC REAL_LT_IMP_LE THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[REAL_ARITH `&4 * a * b = (&2 * a) * (&2 * b)`]);; + + + +(* atn *) +let MK_M_TAYLOR_ATN' = (UNDISCH_ALL o PURE_REWRITE_RULE[float1_eq; float2_eq; num2_eq] o DISCH_ALL o + MY_RULE_FLOAT o prove) + (`m_cell_domain domain (y:real^N) w ==> + diff2c_domain domain f ==> + interval_arith (atn (f y)) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (inv (&1 + f y * f y) * partial i f y) int) ==> + (!x. x IN interval [domain] ==> all_n 1 dd_bounds_list (\i list_i. all_n 1 list_i + (\j int. interval_arith ((((-- &2 * f x) * inv (&1 + f x * f x) pow 2) * partial j f x) + * partial i f x + inv (&1 + f x * f x) * partial2 j i f x) int))) ==> + m_taylor_interval (\x. atn (f x)) domain y w bounds d_bounds_list dd_bounds_list`, + REWRITE_TAC[m_taylor_interval; m_lin_approx; second_bounded; ETA_AX] THEN + REPEAT DISCH_TAC THEN + SUBGOAL_THEN `lift o f differentiable at (y:real^N)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN STRIP_TAC THEN + new_rewrite [] [] diff2_imp_diff THEN REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC y_in_domain THEN EXISTS_TAC `w:real^N` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain] THEN REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[GSYM o_THM] THEN REWRITE_TAC[ETA_AX] THEN + apply_tac diff2c_atn_compose THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + new_rewrite [] [`atn _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + apply_tac diff_uni_compose THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[REAL_DIFFERENTIABLE_AT_ATN]; + new_rewrite [] [`atn _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + MP_TAC (ISPECL [`y:real^N`; `f:real^N->real`] partial_uni_compose') THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `atn`) THEN REWRITE_TAC[REAL_DIFFERENTIABLE_AT_ATN] THEN + ASM_SIMP_TAC[derivative_atn]; + ALL_TAC + ] THEN + + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN + DISCH_THEN (MP_TAC o SPEC `x:real^N` o CONJUNCT1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (ISPECL [`x:real^N`; `f:real^N->real`] second_partial_uni_compose') THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `atn`) THEN + REWRITE_TAC[diff2_atn] THEN + new_rewrite [] [`atn _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + ASM_SIMP_TAC[nth_derivative2; second_derivative_atn; derivative_atn] THEN + new_rewrite [] [`f x pow 2`] REAL_POW_2 THEN + ASM_SIMP_TAC[]);; + + +(* acs *) +let iabs_lemma = GEN_REWRITE_RULE (RAND_CONV o RAND_CONV) [GSYM float1_eq] (REFL `iabs f_bounds < &1`);; + +let MK_M_TAYLOR_ACS' = (UNDISCH_ALL o PURE_ONCE_REWRITE_RULE[iabs_lemma] o + PURE_REWRITE_RULE[float1_eq; num3_eq] o DISCH_ALL o + MY_RULE_FLOAT o prove) + (`m_cell_domain domain (y:real^N) w ==> + (!x. x IN interval [domain] ==> interval_arith (f x) f_bounds) ==> + iabs f_bounds < &1 ==> + diff2c_domain domain f ==> + interval_arith (acs (f y)) bounds ==> + all_n 1 d_bounds_list + (\i int. interval_arith (--inv (sqrt (&1 - f y * f y)) * partial i f y) int) ==> + (!x. x IN interval [domain] ==> all_n 1 dd_bounds_list (\i list_i. all_n 1 list_i + (\j int. interval_arith ((--(f x / sqrt ((&1 - f x * f x) pow 3)) * partial j f x) * partial i f x - + inv (sqrt (&1 - f x * f x)) * partial2 j i f x) int))) ==> + m_taylor_interval (\x. acs (f x)) domain y w bounds d_bounds_list dd_bounds_list`, + REWRITE_TAC[m_taylor_interval; m_lin_approx; second_bounded; ETA_AX] THEN + REPEAT DISCH_TAC THEN + SUBGOAL_THEN `lift o f differentiable at (y:real^N)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN STRIP_TAC THEN + new_rewrite [] [] diff2_imp_diff THEN REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC y_in_domain THEN EXISTS_TAC `w:real^N` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!x:real^N. x IN interval [domain] ==> abs (f x) < &1` ASSUME_TAC THENL + [ + GEN_TAC THEN DISCH_TAC THEN + apply_tac interval_arith_abs THEN + EXISTS_TAC `f_bounds:real#real` THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `abs (f (y:real^N)) < &1` ASSUME_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC y_in_domain THEN EXISTS_TAC `w:real^N` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain] THEN REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[GSYM o_THM] THEN REWRITE_TAC[ETA_AX] THEN + apply_tac diff2c_acs_compose THEN CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + new_rewrite [] [`acs _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + apply_tac diff_uni_compose THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_DIFFERENTIABLE_AT_ACS THEN ASM_REWRITE_TAC[]; + new_rewrite [] [`acs _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + MP_TAC (ISPECL [`y:real^N`; `f:real^N->real`] partial_uni_compose') THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `acs`) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC REAL_DIFFERENTIABLE_AT_ACS THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[derivative_acs]; + ALL_TAC + ] THEN + + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN + DISCH_THEN (MP_TAC o SPEC `x:real^N` o CONJUNCT1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (ISPECL [`x:real^N`; `f:real^N->real`] second_partial_uni_compose') THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `acs`) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC diff2_acs THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + new_rewrite [] [`acs _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + ASM_SIMP_TAC[second_derivative_acs; derivative_acs; REAL_MUL_LNEG; GSYM real_sub] THEN + ASM_SIMP_TAC[GSYM REAL_MUL_LNEG]);; + + + +(*************************) + +(***************************************) +(* eval_m_taylor_inv *) + + +let inv_partial_lemma' = + prove(`interval_arith (--inv (f y * f y) * partial i f (y:real^N)) int <=> + (\i int. interval_arith (--inv (f y * f y) * partial i f y) int) i int`, + REWRITE_TAC[]);; + +let inv_second_lemma' = + prove(`interval_arith (((&2 * inv (f x * f x * f x)) * partial j f x) * partial i f (x:real^N) - + inv (f x * f x) * partial2 j i f x) int <=> + (\j int. interval_arith (((&2 * inv (f x * f x * f x)) * partial j f x) * partial i f x - + inv (f x * f x) * partial2 j i f x) int) j int`, + REWRITE_TAC[]);; + + +let inv_second_lemma'' = (PURE_REWRITE_RULE[GSYM num1_eq] o prove) + (`all_n 1 list + (\j int. interval_arith (((&2 * inv (f x * f x * f x)) * partial j f x) * partial i f (x:real^N) - + inv (f x * f x) * partial2 j i f x) int) <=> + (\i list. all_n 1 list + (\j int. interval_arith (((&2 * inv (f x * f x * f x)) * partial j f x) * partial i f x - + inv (f x * f x) * partial2 j i f x) int)) i list`, + REWRITE_TAC[]);; + + + + +let eval_m_taylor_inv n p_lin p_second taylor1_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let f1_tm = (rand o concl) diff2_f1_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let ty = type_of y_tm in + + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let undisch = UNDISCH o SPEC x_var in + + let f1_bound0 = eval_m_taylor_bound n p_second taylor1_th in + let f1_bound = undisch f1_bound0 in + let f_bounds_tm = (rand o concl) f1_bound in + + (* cond *) + let cond_th = check_interval_not_zero f_bounds_tm in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th in + + let bounds_th = float_interval_inv p_lin bounds1_th in + let bounds_tm = (rand o concl) bounds_th in + + (* partial_lemma' *) + let u_lemma0 = (INST[f1_tm, f_var; y_tm, y_var] o + INST_TYPE[n_type_array.(n), nty]) inv_partial_lemma' in + + let u_bounds = + let neg, inv, ( * ) = float_interval_neg, float_interval_inv p_lin, float_interval_mul p_lin in + neg (inv (bounds1_th * bounds1_th)) in + + + let u_lin th1 = + (* partial *) + let u_th = + let ( * ) = float_interval_mul p_lin in + u_bounds * th1 in + let int_tm = rand (concl u_th) in + let i_tm = (rand o rator o rator o lhand) (concl th1) in + let th0 = INST[i_tm, i_var_num; int_tm, int_var] u_lemma0 in + EQ_MP th0 u_th in + + let df_th = eval_all_n df1_th true u_lin in + let d_bounds_list = (rand o rator o concl) df_th in + + + let dd1 = second_bounded_components n second1_th in + + (* second_lemma', second_lemma'' *) + let u_second_lemma0 = (INST[f1_tm, f_var] o + INST_TYPE[n_type_array.(n), nty]) inv_second_lemma' in + + let u_second_lemma1 = (INST[f1_tm, f_var] o + INST_TYPE[n_type_array.(n), nty]) inv_second_lemma'' in + + + let d1_bounds = map (fun i -> + let th0 = eval_m_taylor_partial_bound n p_second i taylor1_th in + undisch th0) (1--n) in + + (* u'(f x), u''(f x) *) + let d1_th0, d2_th0 = + let inv, ( * ) = float_interval_inv p_second, float_interval_mul p_second in + let ff = f1_bound * f1_bound in + inv ff, + two_interval * inv (f1_bound * ff) in + + + let u_second2 th1 = + let i_tm = (rand o rator o concl) th1 in + let i_int = (Num.int_of_num o raw_dest_hash) i_tm in + let di1 = List.nth d1_bounds (i_int - 1) in + let th1 = MY_BETA_RULE th1 in + let lemma = INST[i_tm, i_var_num] u_second_lemma0 in + let u_second th1 = + let j_tm = (rand o rator o rator o rator o lhand) (concl th1) in + let j_int = (Num.int_of_num o raw_dest_hash) j_tm in + let dj1 = List.nth d1_bounds (j_int - 1) in + + (* partial2 *) + let u_th = + let ( * ), ( - ) = float_interval_mul p_second, float_interval_sub p_second in + (d2_th0 * dj1) * di1 - d1_th0 * th1 in + + let int_tm = rand (concl u_th) in + let th0 = INST[j_tm, j_var_num; int_tm, int_var] lemma in + EQ_MP th0 u_th in + + let u_th = eval_all_n th1 true u_second in + let list_tm = (rand o rator o concl) u_th in + let lemma1 = INST[i_tm, i_var_num; list_tm, list_var_real_pair] u_second_lemma1 in + EQ_MP lemma1 u_th in + + let dd_th0 = eval_all_n dd1 false u_second2 in + let dd_list = (rand o rator o concl) dd_th0 in + let dd_th = GEN x_var (DISCH_ALL dd_th0) in + + let th = (MY_PROVE_HYP dd_th o MY_PROVE_HYP diff2_f1_th o + MY_PROVE_HYP cond_th o MY_PROVE_HYP f1_bound0 o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP df_th o MY_PROVE_HYP domain_th o + INST[f1_tm, f_var; f_bounds_tm, f_bounds_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var; d_bounds_list, d_bounds_list_var; + dd_list, dd_bounds_list_var] o + INST_TYPE[n_type_array.(n), nty]) MK_M_TAYLOR_INV' in + let eq_th = unary_beta_gen_eq f1_tm x_var inv_op_real in + m_taylor_interval_norm th eq_th;; + + +(***************************************) +(* eval_m_taylor_sqrt *) + +let sqrt_partial_lemma' = + prove(`interval_arith (inv (&2 * sqrt (f y)) * partial i f (y:real^N)) int <=> + (\i int. interval_arith (inv (&2 * sqrt (f y)) * partial i f y) int) i int`, + REWRITE_TAC[]);; + + +let sqrt_second_lemma' = + prove(`interval_arith ((--inv ((&2 * sqrt (f x)) * (&2 * f x)) * partial j f x) * partial i f (x:real^N) + + inv (&2 * sqrt (f x)) * partial2 j i f x) int <=> + (\j int. interval_arith ((--inv ((&2 * sqrt (f x))*(&2 * f x)) * partial j f x) * partial i f x + + inv (&2 * sqrt (f x)) * partial2 j i f x) int) j int`, + REWRITE_TAC[]);; + + +let sqrt_second_lemma'' = (PURE_REWRITE_RULE[GSYM num1_eq] o prove) + (`all_n 1 list + (\j int. interval_arith ((--inv ((&2 * sqrt (f x)) * (&2 * f x)) * partial j f x) * partial i f x + + inv (&2 * sqrt (f x)) * partial2 j i f (x:real^N)) int) <=> + (\i list. all_n 1 list + (\j int. interval_arith ((--inv ((&2 * sqrt (f x)) * (&2 * f x)) * partial j f x) * partial i f x + + inv (&2 * sqrt (f x)) * partial2 j i f (x:real^N)) int)) i list`, + REWRITE_TAC[]);; + + +let eval_m_taylor_sqrt n p_lin p_second taylor1_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let f1_tm = (rand o concl) diff2_f1_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let ty = type_of y_tm in + + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let undisch = UNDISCH o SPEC x_var in + + let f1_bound0 = eval_m_taylor_bound n p_second taylor1_th in + let f1_bound = undisch f1_bound0 in + let f_bounds_tm = (rand o concl) f1_bound in + + (* cond *) + let cond_th = check_interval_pos f_bounds_tm in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th in + + let bounds_th = float_interval_sqrt p_lin bounds1_th in + let bounds_tm = (rand o concl) bounds_th in + + (* partial_lemma' *) + let u_lemma0 = (INST[f1_tm, f_var; y_tm, y_var] o + INST_TYPE[n_type_array.(n), nty]) sqrt_partial_lemma' in + + let u_bounds = + let inv, ( * ) = float_interval_inv p_lin, float_interval_mul p_lin in + inv (two_interval * bounds_th) in + + let u_lin th1 = + (* partial *) + let u_th = + let ( * ) = float_interval_mul p_lin in + u_bounds * th1 in + let int_tm = rand (concl u_th) in + let i_tm = (rand o rator o rator o lhand) (concl th1) in + let th0 = INST[i_tm, i_var_num; int_tm, int_var] u_lemma0 in + EQ_MP th0 u_th in + + let df_th = eval_all_n df1_th true u_lin in + let d_bounds_list = (rand o rator o concl) df_th in + + + let dd1 = second_bounded_components n second1_th in + + (* second_lemma', second_lemma'' *) + let u_second_lemma0 = (INST[f1_tm, f_var] o + INST_TYPE[n_type_array.(n), nty]) sqrt_second_lemma' in + + let u_second_lemma1 = (INST[f1_tm, f_var] o + INST_TYPE[n_type_array.(n), nty]) sqrt_second_lemma'' in + + let d1_bounds = map (fun i -> + let th0 = eval_m_taylor_partial_bound n p_second i taylor1_th in + undisch th0) (1--n) in + + (* u'(f x), u''(f x) *) + let d1_th0, d2_th0 = + let neg, sqrt, inv, ( * ) = float_interval_neg, float_interval_sqrt p_second, + float_interval_inv p_second, float_interval_mul p_second in + let two_sqrt_f = two_interval * sqrt f1_bound in + inv two_sqrt_f, + neg (inv (two_sqrt_f * (two_interval * f1_bound))) in + + let u_second2 th1 = + let i_tm = (rand o rator o concl) th1 in + let i_int = (Num.int_of_num o raw_dest_hash) i_tm in + let di1 = List.nth d1_bounds (i_int - 1) in + let th1 = MY_BETA_RULE th1 in + let lemma = INST[i_tm, i_var_num] u_second_lemma0 in + let u_second th1 = + let j_tm = (rand o rator o rator o rator o lhand) (concl th1) in + let j_int = (Num.int_of_num o raw_dest_hash) j_tm in + let dj1 = List.nth d1_bounds (j_int - 1) in + + (* partial2 *) + let u_th = + let ( * ), ( + ) = float_interval_mul p_second, float_interval_add p_second in + (d2_th0 * dj1) * di1 + d1_th0 * th1 in + + let int_tm = rand (concl u_th) in + let th0 = INST[j_tm, j_var_num; int_tm, int_var] lemma in + EQ_MP th0 u_th in + + let u_th = eval_all_n th1 true u_second in + let list_tm = (rand o rator o concl) u_th in + let lemma1 = INST[i_tm, i_var_num; list_tm, list_var_real_pair] u_second_lemma1 in + EQ_MP lemma1 u_th in + + let dd_th0 = eval_all_n dd1 false u_second2 in + let dd_list = (rand o rator o concl) dd_th0 in + let dd_th = GEN x_var (DISCH_ALL dd_th0) in + + let th = (MY_PROVE_HYP dd_th o MY_PROVE_HYP diff2_f1_th o + MY_PROVE_HYP cond_th o MY_PROVE_HYP f1_bound0 o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP df_th o MY_PROVE_HYP domain_th o + INST[f1_tm, f_var; f_bounds_tm, f_bounds_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var; d_bounds_list, d_bounds_list_var; + dd_list, dd_bounds_list_var] o + INST_TYPE[n_type_array.(n), nty]) MK_M_TAYLOR_SQRT' in + let eq_th = unary_beta_gen_eq f1_tm x_var sqrt_tm in + m_taylor_interval_norm th eq_th;; + + + +(***************************************) +(* eval_m_taylor_atn *) + +let atn_partial_lemma' = + prove(`interval_arith (inv (&1 + f y * f y) * partial i f (y:real^N)) int <=> + (\i int. interval_arith (inv (&1 + f y * f y) * partial i f y) int) i int`, + REWRITE_TAC[]);; + + +let atn_second_lemma' = + prove(`interval_arith ((((-- &2 * f x) * inv (&1 + f x * f x) pow 2) * partial j f (x:real^N)) + * partial i f x + inv (&1 + f x * f x) * partial2 j i f x) int <=> + (\j int. interval_arith ((((-- &2 * f x) * inv (&1 + f x * f x) pow 2) * partial j f x) + * partial i f x + inv (&1 + f x * f x) * partial2 j i f x) int) j int`, + REWRITE_TAC[]);; + + +let atn_second_lemma'' = (PURE_REWRITE_RULE[float1_eq; float2_eq; num2_eq] o NUMERALS_TO_NUM o + PURE_REWRITE_RULE[FLOAT_OF_NUM; min_exp_def] o prove) + (`all_n 1 list + (\j int. interval_arith ((((-- &2 * f x) * inv (&1 + f x * f x) pow 2) * partial j f (x:real^N)) + * partial i f x + inv (&1 + f x * f x) * partial2 j i f x) int) <=> + (\i list. all_n 1 list + (\j int. interval_arith ((((-- &2 * f x) * inv (&1 + f x * f x) pow 2) * partial j f x) + * partial i f x + inv (&1 + f x * f x) * partial2 j i f x) int)) i list`, + REWRITE_TAC[]);; + + + +let eval_m_taylor_atn n p_lin p_second taylor1_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let f1_tm = (rand o concl) diff2_f1_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let ty = type_of y_tm in + + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let undisch = UNDISCH o SPEC x_var in + + let f1_bound0 = eval_m_taylor_bound n p_second taylor1_th in + let f1_bound = undisch f1_bound0 in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th in + + let bounds_th = float_interval_atn p_lin bounds1_th in + let bounds_tm = (rand o concl) bounds_th in + + (* partial_lemma' *) + let u_lemma0 = (INST[f1_tm, f_var; y_tm, y_var] o + INST_TYPE[n_type_array.(n), nty]) atn_partial_lemma' in + + let u_bounds = + let inv, ( + ), ( * ) = float_interval_inv p_lin, float_interval_add p_lin, float_interval_mul p_lin in + inv (one_interval + bounds1_th * bounds1_th) in + + let u_lin th1 = + (* partial *) + let u_th = + let ( * ) = float_interval_mul p_lin in + u_bounds * th1 in + let int_tm = rand (concl u_th) in + let i_tm = (rand o rator o rator o lhand) (concl th1) in + let th0 = INST[i_tm, i_var_num; int_tm, int_var] u_lemma0 in + EQ_MP th0 u_th in + + let df_th = eval_all_n df1_th true u_lin in + let d_bounds_list = (rand o rator o concl) df_th in + + + let dd1 = second_bounded_components n second1_th in + + (* second_lemma', second_lemma'' *) + let u_second_lemma0 = (INST[f1_tm, f_var] o + INST_TYPE[n_type_array.(n), nty]) atn_second_lemma' in + + let u_second_lemma1 = (INST[f1_tm, f_var] o + INST_TYPE[n_type_array.(n), nty]) atn_second_lemma'' in + + let d1_bounds = map (fun i -> + let th0 = eval_m_taylor_partial_bound n p_second i taylor1_th in + undisch th0) (1--n) in + + + (* u'(f x), u''(f x) *) + let d1_th0, d2_th0 = + let neg, inv, ( + ), ( * ), pow2 = float_interval_neg, float_interval_inv p_second, + float_interval_add p_second, float_interval_mul p_second, float_interval_pow_simple p_second 2 in + let inv_one_ff = inv (one_interval + f1_bound * f1_bound) in + inv_one_ff, + (neg_two_interval * f1_bound) * pow2 inv_one_ff in + + let u_second2 th1 = + let i_tm = (rand o rator o concl) th1 in + let i_int = (Num.int_of_num o raw_dest_hash) i_tm in + let di1 = List.nth d1_bounds (i_int - 1) in + let th1 = MY_BETA_RULE th1 in + let lemma = INST[i_tm, i_var_num] u_second_lemma0 in + let u_second th1 = + let j_tm = (rand o rator o rator o rator o lhand) (concl th1) in + let j_int = (Num.int_of_num o raw_dest_hash) j_tm in + let dj1 = List.nth d1_bounds (j_int - 1) in + + (* partial2 *) + let u_th = + let ( * ), ( + ) = float_interval_mul p_second, float_interval_add p_second in + (d2_th0 * dj1) * di1 + d1_th0 * th1 in + + let int_tm = rand (concl u_th) in + let th0 = INST[j_tm, j_var_num; int_tm, int_var] lemma in + EQ_MP th0 u_th in + + let u_th = eval_all_n th1 true u_second in + let list_tm = (rand o rator o concl) u_th in + let lemma1 = INST[i_tm, i_var_num; list_tm, list_var_real_pair] u_second_lemma1 in + EQ_MP lemma1 u_th in + + let dd_th0 = eval_all_n dd1 false u_second2 in + let dd_list = (rand o rator o concl) dd_th0 in + let dd_th = GEN x_var (DISCH_ALL dd_th0) in + + let th = (MY_PROVE_HYP dd_th o MY_PROVE_HYP diff2_f1_th o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP df_th o MY_PROVE_HYP domain_th o + INST[f1_tm, f_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var; d_bounds_list, d_bounds_list_var; + dd_list, dd_bounds_list_var] o + INST_TYPE[n_type_array.(n), nty]) MK_M_TAYLOR_ATN' in + let eq_th = unary_beta_gen_eq f1_tm x_var atn_tm in + m_taylor_interval_norm th eq_th;; + + + +(***************************************) +(* eval_m_taylor_acs *) + +let acs_partial_lemma' = + prove(`interval_arith (--inv (sqrt (&1 - f y * f y)) * partial i f (y:real^N)) int <=> + (\i int. interval_arith (--inv (sqrt (&1 - f y * f y)) * partial i f y) int) i int`, + REWRITE_TAC[]);; + + +let acs_second_lemma' = + prove(`interval_arith ((--(f x / sqrt ((&1 - f x * f x) pow 3)) * partial j f x) * partial i f (x:real^N) - inv (sqrt (&1 - f x * f x)) * partial2 j i f x) int <=> + + (\j int. interval_arith ((--(f x / sqrt ((&1 - f x * f x) pow 3)) * partial j f x) * partial i f (x:real^N) - inv (sqrt (&1 - f x * f x)) * partial2 j i f x) int) j int`, + REWRITE_TAC[]);; + + +let acs_second_lemma'' = (PURE_REWRITE_RULE[float1_eq; float2_eq; num3_eq; num2_eq] o NUMERALS_TO_NUM o + PURE_REWRITE_RULE[FLOAT_OF_NUM; min_exp_def] o prove) + (`all_n 1 list + (\j int. interval_arith ((--(f x / sqrt ((&1 - f x * f x) pow 3)) * partial j f x) * partial i f (x:real^N) - inv (sqrt (&1 - f x * f x)) * partial2 j i f x) int) <=> + (\i list. all_n 1 list + (\j int. interval_arith ((--(f x / sqrt ((&1 - f x * f x) pow 3)) * partial j f x) * partial i f (x:real^N) - inv (sqrt (&1 - f x * f x)) * partial2 j i f x) int)) i list`, + REWRITE_TAC[]);; + + +let eval_m_taylor_acs n p_lin p_second taylor1_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let f1_tm = (rand o concl) diff2_f1_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let ty = type_of y_tm in + + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let undisch = UNDISCH o SPEC x_var in + + let f1_bound0 = eval_m_taylor_bound n p_second taylor1_th in + let f1_bound = undisch f1_bound0 in + let f_bounds_tm = (rand o concl) f1_bound in + + (* cond *) + let cond_th = EQT_ELIM (check_interval_iabs f_bounds_tm one_float) in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th in + + let bounds_th = float_interval_acs p_lin bounds1_th in + let bounds_tm = (rand o concl) bounds_th in + + (* partial_lemma' *) + let u_lemma0 = (INST[f1_tm, f_var; y_tm, y_var] o + INST_TYPE[n_type_array.(n), nty]) acs_partial_lemma' in + + let u_bounds = + let inv, sqrt, neg = float_interval_inv p_lin, float_interval_sqrt p_lin, float_interval_neg in + let ( * ), (-) = float_interval_mul p_lin, float_interval_sub p_lin in + neg (inv (sqrt (one_interval - bounds1_th * bounds1_th))) in + + let u_lin th1 = + (* partial *) + let u_th = + let ( * ) = float_interval_mul p_lin in + u_bounds * th1 in + let int_tm = rand (concl u_th) in + let i_tm = (rand o rator o rator o lhand) (concl th1) in + let th0 = INST[i_tm, i_var_num; int_tm, int_var] u_lemma0 in + EQ_MP th0 u_th in + + let df_th = eval_all_n df1_th true u_lin in + let d_bounds_list = (rand o rator o concl) df_th in + + + let dd1 = second_bounded_components n second1_th in + + (* second_lemma', second_lemma'' *) + let u_second_lemma0 = (INST[f1_tm, f_var] o + INST_TYPE[n_type_array.(n), nty]) acs_second_lemma' in + + let u_second_lemma1 = (INST[f1_tm, f_var] o + INST_TYPE[n_type_array.(n), nty]) acs_second_lemma'' in + + let d1_bounds = map (fun i -> + let th0 = eval_m_taylor_partial_bound n p_second i taylor1_th in + undisch th0) (1--n) in + + (* u'(f x), u''(f x) *) + let d1_th0, d2_th0 = + let neg, sqrt, inv = float_interval_neg, float_interval_sqrt p_second, float_interval_inv p_second in + let (-), ( * ), (/) = float_interval_sub p_second, float_interval_mul p_second, float_interval_div p_second in + let pow3 = float_interval_pow_simple p_second 3 in + let ff_1 = one_interval - f1_bound * f1_bound in + inv (sqrt ff_1), + neg (f1_bound / sqrt (pow3 ff_1)) in + + let u_second2 th1 = + let i_tm = (rand o rator o concl) th1 in + let i_int = (Num.int_of_num o raw_dest_hash) i_tm in + let di1 = List.nth d1_bounds (i_int - 1) in + let th1 = MY_BETA_RULE th1 in + let lemma = INST[i_tm, i_var_num] u_second_lemma0 in + let u_second th1 = + let j_tm = (rand o rator o rator o rator o lhand) (concl th1) in + let j_int = (Num.int_of_num o raw_dest_hash) j_tm in + let dj1 = List.nth d1_bounds (j_int - 1) in + + (* partial2 *) + let u_th = + let ( * ), ( - ) = float_interval_mul p_second, float_interval_sub p_second in + (d2_th0 * dj1) * di1 - d1_th0 * th1 in + + let int_tm = rand (concl u_th) in + let th0 = INST[j_tm, j_var_num; int_tm, int_var] lemma in + EQ_MP th0 u_th in + + let u_th = eval_all_n th1 true u_second in + let list_tm = (rand o rator o concl) u_th in + let lemma1 = INST[i_tm, i_var_num; list_tm, list_var_real_pair] u_second_lemma1 in + EQ_MP lemma1 u_th in + + let dd_th0 = eval_all_n dd1 false u_second2 in + let dd_list = (rand o rator o concl) dd_th0 in + let dd_th = GEN x_var (DISCH_ALL dd_th0) in + + let th = (MY_PROVE_HYP dd_th o MY_PROVE_HYP diff2_f1_th o + MY_PROVE_HYP cond_th o MY_PROVE_HYP f1_bound0 o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP df_th o MY_PROVE_HYP domain_th o + INST[f1_tm, f_var; f_bounds_tm, f_bounds_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var; d_bounds_list, d_bounds_list_var; + dd_list, dd_bounds_list_var] o + INST_TYPE[n_type_array.(n), nty]) MK_M_TAYLOR_ACS' in + let eq_th = unary_beta_gen_eq f1_tm x_var acs_tm in + m_taylor_interval_norm th eq_th;; + + + +end;; diff --git a/formal_ineqs/taylor/m_taylor_arith2.hl b/formal_ineqs/taylor/m_taylor_arith2.hl new file mode 100644 index 0000000..d4d891d --- /dev/null +++ b/formal_ineqs/taylor/m_taylor_arith2.hl @@ -0,0 +1,682 @@ +(* =========================================================== *) +(* Formal arithmetic of taylor intervals 2 *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +needs "taylor/m_taylor_arith.hl";; + + +module M_taylor_arith2 = struct + +open Arith_misc;; +open Arith_nat;; +open Arith_float;; +open More_float;; +open Float_atn;; +open Float_theory;; +open M_taylor;; +open M_taylor_arith;; +open Misc_vars;; + + + +(**************************************) +let mk_vars n name ty = map (fun i -> mk_var (name^string_of_int i, ty)) (1--n);; + + +let all_n_components2 n all_n_th = + let th0 = SYM (all_n_array.(n)) in + let _, list_tm, s_tm = dest_all_n (concl all_n_th) in + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let s_var = mk_var ("s", type_of s_tm) and + a_vars = mk_vars n "a" ty in + + let list_tms = dest_list list_tm in + let th1 = (INST ([s_tm, s_var] @ zip list_tms a_vars) o INST_TYPE[ty, aty]) th0 in + CONJUNCTS (EQ_MP th1 all_n_th);; + + + +(***************************************) + +let gen_taylor_arith_thm arith_th final_rule n = + let num1_th = (SYM o REWRITE_RULE[Arith_hash.NUM_THM] o NUMERAL_TO_NUM_CONV) `1` in + let th0 = (REWRITE_RULE[num1_th] o DISCH_ALL o INST_TYPE[n_type_array.(n), nty]) arith_th in + let pty = `:real#real` in + let dfs = mk_vars n "df" pty in + let ddfs' = map (fun i -> map (fun j -> dd_vars_array.(i).(j)) (1--i)) (1--n) in + let ddfs = map (fun list -> mk_list (list, pty)) ddfs' in + let d_bounds_list = mk_list (dfs, pty) in + let dd_bounds_list = mk_list (ddfs, type_of (hd ddfs)) in + let th1 = INST[d_bounds_list, d_bounds_list_var; dd_bounds_list, dd_bounds_list_var] th0 in + let th2 = (CONV_RULE NUM_REDUCE_CONV o REWRITE_RULE[all_n]) th1 in + (UNDISCH_ALL o final_rule o REWRITE_RULE[GSYM CONJ_ASSOC] o + NUMERALS_TO_NUM o PURE_REWRITE_RULE[FLOAT_OF_NUM; min_exp_def]) th2;; + + +let gen_add_thm = gen_taylor_arith_thm MK_M_TAYLOR_ADD' (CONV_RULE ALL_CONV);; +let gen_sub_thm = gen_taylor_arith_thm MK_M_TAYLOR_SUB' (CONV_RULE ALL_CONV);; +let gen_mul_thm = gen_taylor_arith_thm MK_M_TAYLOR_MUL' (CONV_RULE ALL_CONV);; +let gen_neg_thm = gen_taylor_arith_thm MK_M_TAYLOR_NEG' (CONV_RULE ALL_CONV);; +let gen_inv_thm = gen_taylor_arith_thm MK_M_TAYLOR_INV' (REWRITE_RULE[float2_eq]);; +let gen_sqrt_thm = gen_taylor_arith_thm MK_M_TAYLOR_SQRT' (REWRITE_RULE[float2_eq]);; + +let gen_atn_thm = + let pow2_th = (SYM o REWRITE_CONV[SYM num2_eq]) `x pow 2` in + gen_taylor_arith_thm MK_M_TAYLOR_ATN' (REWRITE_RULE[float2_eq; float1_eq; pow2_th]);; + +let gen_acs_thm = + let iabs_lemma = REWRITE_CONV[SYM float1_eq] `iabs f_bounds < &1` in + let pow3_lemma = (SYM o REWRITE_CONV[SYM num3_eq]) `x pow 3` in + gen_taylor_arith_thm MK_M_TAYLOR_ACS' (REWRITE_RULE[iabs_lemma] o REWRITE_RULE[float1_eq; pow3_lemma]);; + + +let add_ths_array, + sub_ths_array, + mul_ths_array, + neg_ths_array, + inv_ths_array, + sqrt_ths_array, + atn_ths_array, + acs_ths_array = + let gen = fun f -> Array.init (max_dim + 1) (fun i -> if i = 0 then TRUTH else f i) in + gen gen_add_thm, + gen gen_sub_thm, + gen gen_mul_thm, + gen gen_neg_thm, + gen gen_inv_thm, + gen gen_sqrt_thm, + gen gen_atn_thm, + gen gen_acs_thm;; + + +(*********************) +(* add *) + +let eval_m_taylor_add2 n p_lin p_second taylor1_th taylor2_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let _, diff2_f2_th, lin2_th, second2_th = dest_m_taylor_thms n taylor2_th in + let f1_tm = (rand o concl) diff2_f1_th and + f2_tm = (rand o concl) diff2_f2_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let ty = type_of y_tm in + + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + g_var = mk_var ("g", type_of f2_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th and + _, bounds2_th, df2_th = m_lin_approx_components n lin2_th in + + let bounds_th = float_interval_add p_lin bounds1_th bounds2_th in + let bounds_tm = (rand o concl) bounds_th in + + let df_ths = + let df1_ths = map MY_BETA_RULE (all_n_components2 n df1_th) in + let df2_ths = map MY_BETA_RULE (all_n_components2 n df2_th) in + map2 (float_interval_add p_lin) df1_ths df2_ths in + + let df_th = end_itlist CONJ df_ths in + + let dd_ths = + let dd1' = all_n_components2 n (second_bounded_components n second1_th) in + let dd2' = all_n_components2 n (second_bounded_components n second2_th) in + let dd1 = map2 (fun i -> map MY_BETA_RULE o all_n_components2 i o MY_BETA_RULE) (1--n) dd1' in + let dd2 = map2 (fun i -> map MY_BETA_RULE o all_n_components2 i o MY_BETA_RULE) (1--n) dd2' in + map2 (map2 (float_interval_add p_second)) dd1 dd2 in + + let dd_th = (GEN x_var o DISCH_ALL o end_itlist CONJ) (List.flatten dd_ths) in + + let df_vars = map (fun i -> df_vars_array.(i)) (1--n) in + let dd_vars = map (fun i -> map (fun j -> dd_vars_array.(i).(j)) (1--i)) (1--n) in + + let dfs = map (rand o concl) df_ths in + let dds = map (map (rand o concl)) dd_ths in + let inst_list = union (zip dfs df_vars) (zip (List.flatten dds) (List.flatten dd_vars)) in + + let th = (MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP diff2_f2_th o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP domain_th o + MY_PROVE_HYP df_th o MY_PROVE_HYP dd_th o + INST([f1_tm, f_var; f2_tm, g_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var] @ inst_list)) add_ths_array.(n) in + let eq_th = binary_beta_gen_eq f1_tm f2_tm x_var add_op_real in + m_taylor_interval_norm th eq_th;; + + +(*********************) +(* sub *) + +let eval_m_taylor_sub2 n p_lin p_second taylor1_th taylor2_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let _, diff2_f2_th, lin2_th, second2_th = dest_m_taylor_thms n taylor2_th in + let f1_tm = (rand o concl) diff2_f1_th and + f2_tm = (rand o concl) diff2_f2_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let ty = type_of y_tm in + + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + g_var = mk_var ("g", type_of f2_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th and + _, bounds2_th, df2_th = m_lin_approx_components n lin2_th in + + let bounds_th = float_interval_sub p_lin bounds1_th bounds2_th in + let bounds_tm = (rand o concl) bounds_th in + + let df_ths = + let df1_ths = map MY_BETA_RULE (all_n_components2 n df1_th) in + let df2_ths = map MY_BETA_RULE (all_n_components2 n df2_th) in + map2 (float_interval_sub p_lin) df1_ths df2_ths in + + let df_th = end_itlist CONJ df_ths in + + let dd_ths = + let dd1' = all_n_components2 n (second_bounded_components n second1_th) in + let dd2' = all_n_components2 n (second_bounded_components n second2_th) in + let dd1 = map2 (fun i -> map MY_BETA_RULE o all_n_components2 i o MY_BETA_RULE) (1--n) dd1' in + let dd2 = map2 (fun i -> map MY_BETA_RULE o all_n_components2 i o MY_BETA_RULE) (1--n) dd2' in + map2 (map2 (float_interval_sub p_second)) dd1 dd2 in + + let dd_th = (GEN x_var o DISCH_ALL o end_itlist CONJ) (List.flatten dd_ths) in + + let df_vars = map (fun i -> df_vars_array.(i)) (1--n) in + let dd_vars = map (fun i -> map (fun j -> dd_vars_array.(i).(j)) (1--i)) (1--n) in + + let dfs = map (rand o concl) df_ths in + let dds = map (map (rand o concl)) dd_ths in + let inst_list = union (zip dfs df_vars) (zip (List.flatten dds) (List.flatten dd_vars)) in + + let th = (MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP diff2_f2_th o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP domain_th o + MY_PROVE_HYP df_th o MY_PROVE_HYP dd_th o + INST([f1_tm, f_var; f2_tm, g_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var] @ inst_list)) sub_ths_array.(n) in + let eq_th = binary_beta_gen_eq f1_tm f2_tm x_var sub_op_real in + m_taylor_interval_norm th eq_th;; + + +(*********************) +(* mul *) + +let eval_m_taylor_mul2 n p_lin p_second taylor1_th taylor2_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let _, diff2_f2_th, lin2_th, second2_th = dest_m_taylor_thms n taylor2_th in + let f1_tm = (rand o concl) diff2_f1_th and + f2_tm = (rand o concl) diff2_f2_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let ty = type_of y_tm in + + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + g_var = mk_var ("g", type_of f2_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let undisch = UNDISCH o SPEC x_var in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th and + _, bounds2_th, df2_th = m_lin_approx_components n lin2_th in + + let bounds_th = float_interval_mul p_lin bounds1_th bounds2_th in + let bounds_tm = (rand o concl) bounds_th in + + (* first partials *) + let df_ths = + let df1_ths = map MY_BETA_RULE (all_n_components2 n df1_th) in + let df2_ths = map MY_BETA_RULE (all_n_components2 n df2_th) in + let ( * ), ( + ) = float_interval_mul p_lin, float_interval_add p_lin in + map2 (fun d1 d2 -> d1 * bounds2_th + bounds1_th * d2) df1_ths df2_ths in + + let df_th = end_itlist CONJ df_ths in + + (* second partials *) + let d1_bounds = map (fun i -> + undisch (eval_m_taylor_partial_bound n p_second i taylor1_th)) (1--n) in + let d2_bounds = map (fun i -> + undisch (eval_m_taylor_partial_bound n p_second i taylor2_th)) (1--n) in + let f1_bound = undisch (eval_m_taylor_bound n p_second taylor1_th) in + let f2_bound = undisch (eval_m_taylor_bound n p_second taylor2_th) in + + let dd_ths = + let ns = 1--n in + let dd1' = all_n_components2 n (second_bounded_components n second1_th) in + let dd2' = all_n_components2 n (second_bounded_components n second2_th) in + let dd1 = map2 (fun i -> map MY_BETA_RULE o all_n_components2 i o MY_BETA_RULE) ns dd1' in + let dd2 = map2 (fun i -> map MY_BETA_RULE o all_n_components2 i o MY_BETA_RULE) ns dd2' in + let ( * ), ( + ) = float_interval_mul p_second, float_interval_add p_second in + map2 (fun (dd1_list, dd2_list) i -> + let di1 = List.nth d1_bounds (i - 1) in + let di2 = List.nth d2_bounds (i - 1) in + map2 (fun (dd1, dd2) j -> + let dj1 = List.nth d1_bounds (j - 1) in + let dj2 = List.nth d2_bounds (j - 1) in + (dd1 * f2_bound + di1 * dj2) + (dj1 * di2 + f1_bound * dd2)) + (zip dd1_list dd2_list) (1--i)) (zip dd1 dd2) ns in + + let dd_th = (GEN x_var o DISCH_ALL o end_itlist CONJ) (List.flatten dd_ths) in + + let df_vars = map (fun i -> df_vars_array.(i)) (1--n) in + let dd_vars = map (fun i -> map (fun j -> dd_vars_array.(i).(j)) (1--i)) (1--n) in + + let dfs = map (rand o concl) df_ths in + let dds = map (map (rand o concl)) dd_ths in + let inst_list = union (zip dfs df_vars) (zip (List.flatten dds) (List.flatten dd_vars)) in + + let th = (MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP diff2_f2_th o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP domain_th o + MY_PROVE_HYP df_th o MY_PROVE_HYP dd_th o + INST([f1_tm, f_var; f2_tm, g_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var] @ inst_list)) mul_ths_array.(n) in + let eq_th = binary_beta_gen_eq f1_tm f2_tm x_var mul_op_real in + m_taylor_interval_norm th eq_th;; + + +(*********************) +(* neg *) + +let eval_m_taylor_neg2 n taylor1_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let f1_tm = (rand o concl) diff2_f1_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let ty = type_of y_tm in + + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th in + + let bounds_th = float_interval_neg bounds1_th in + let bounds_tm = (rand o concl) bounds_th in + + let df_ths = + let df1_ths = map MY_BETA_RULE (all_n_components2 n df1_th) in + map (float_interval_neg) df1_ths in + + let df_th = end_itlist CONJ df_ths in + + let dd_ths = + let dd1' = all_n_components2 n (second_bounded_components n second1_th) in + let dd1 = map2 (fun i -> map MY_BETA_RULE o all_n_components2 i o MY_BETA_RULE) (1--n) dd1' in + map (map float_interval_neg) dd1 in + + let dd_th = (GEN x_var o DISCH_ALL o end_itlist CONJ) (List.flatten dd_ths) in + + let df_vars = map (fun i -> df_vars_array.(i)) (1--n) in + let dd_vars = map (fun i -> map (fun j -> dd_vars_array.(i).(j)) (1--i)) (1--n) in + + let dfs = map (rand o concl) df_ths in + let dds = map (map (rand o concl)) dd_ths in + let inst_list = union (zip dfs df_vars) (zip (List.flatten dds) (List.flatten dd_vars)) in + + let th = (MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP bounds_th o + MY_PROVE_HYP domain_th o MY_PROVE_HYP df_th o MY_PROVE_HYP dd_th o + INST([f1_tm, f_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var] @ inst_list)) neg_ths_array.(n) in + let eq_th = unary_beta_gen_eq f1_tm x_var neg_op_real in + m_taylor_interval_norm th eq_th;; + + +(******************************) +(* inv *) + +let eval_m_taylor_inv2 n p_lin p_second taylor1_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let f1_tm = (rand o concl) diff2_f1_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + + let ty = type_of y_tm in + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let undisch = UNDISCH o SPEC x_var in + + let f1_bound0 = eval_m_taylor_bound n p_second taylor1_th in + let f1_bound = undisch f1_bound0 in + let f_bounds_tm = (rand o concl) f1_bound in + + (* cond *) + let cond_th = check_interval_not_zero f_bounds_tm in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th in + + let bounds_th = float_interval_inv p_lin bounds1_th in + let bounds_tm = (rand o concl) bounds_th in + + (* first partials *) + let u_bounds = + let neg, inv, ( * ) = float_interval_neg, float_interval_inv p_lin, float_interval_mul p_lin in + neg (inv (bounds1_th * bounds1_th)) in + + let df1_ths' = all_n_components2 n df1_th in + let df1_ths = map MY_BETA_RULE df1_ths' in + + let df_ths = + let ( * ) = float_interval_mul p_lin in + map (fun th1 -> u_bounds * th1) df1_ths in + + let df_th = end_itlist CONJ df_ths in + + (* second partials *) + let dd_ths = + let dd1 = all_n_components2 n (second_bounded_components n second1_th) in + map2 (fun i -> map MY_BETA_RULE o all_n_components2 i o MY_BETA_RULE) (1--n) dd1 in + + let d1_bounds = map (fun i -> + let th0 = eval_m_taylor_partial_bound n p_second i taylor1_th in + undisch th0) (1--n) in + + (* u'(f x), u''(f x) *) + let d1_th0, d2_th0 = + let inv, ( * ) = float_interval_inv p_second, float_interval_mul p_second in + let ff = f1_bound * f1_bound in + inv ff, + two_interval * inv (f1_bound * ff) in + + let dd_ths = + let ( * ), ( - ) = float_interval_mul p_second, float_interval_sub p_second in + map2 (fun dd_list di1 -> + my_map2 (fun dd dj1 -> + (d2_th0 * dj1) * di1 - d1_th0 * dd) dd_list d1_bounds) dd_ths d1_bounds in + + let dd_th = (GEN x_var o DISCH_ALL o end_itlist CONJ) (List.flatten dd_ths) in + + (***) + let df_vars = map (fun i -> df_vars_array.(i)) (1--n) in + let dd_vars = map (fun i -> map (fun j -> dd_vars_array.(i).(j)) (1--i)) (1--n) in + + let dfs = map (rand o concl) df_ths in + let dds = map (map (rand o concl)) dd_ths in + + let inst_list = union (zip dfs df_vars) (zip (List.flatten dds) (List.flatten dd_vars)) in + + let th1 = (MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP cond_th o MY_PROVE_HYP f1_bound0 o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP domain_th o + MY_PROVE_HYP dd_th o MY_PROVE_HYP df_th o + INST([f1_tm, f_var; f_bounds_tm, f_bounds_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var] @ inst_list)) inv_ths_array.(n) in + let eq_th = unary_beta_gen_eq f1_tm x_var inv_op_real in + m_taylor_interval_norm th1 eq_th;; + + + +(******************************) +(* sqrt *) + +let eval_m_taylor_sqrt2 n p_lin p_second taylor1_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let f1_tm = (rand o concl) diff2_f1_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + + let ty = type_of y_tm in + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let undisch = UNDISCH o SPEC x_var in + + let f1_bound0 = eval_m_taylor_bound n p_second taylor1_th in + let f1_bound = undisch f1_bound0 in + let f_bounds_tm = (rand o concl) f1_bound in + + (* cond *) + let cond_th = check_interval_pos f_bounds_tm in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th in + + let bounds_th = float_interval_sqrt p_lin bounds1_th in + let bounds_tm = (rand o concl) bounds_th in + + (* first partials *) + let u_bounds = + let inv, ( * ) = float_interval_inv p_lin, float_interval_mul p_lin in + inv (two_interval * bounds_th) in + + let df1_ths' = all_n_components2 n df1_th in + let df1_ths = map MY_BETA_RULE df1_ths' in + + let df_ths = + let ( * ) = float_interval_mul p_lin in + map (fun th1 -> u_bounds * th1) df1_ths in + + let df_th = end_itlist CONJ df_ths in + + (* second partials *) + let dd_ths = + let dd1 = all_n_components2 n (second_bounded_components n second1_th) in + map2 (fun i -> map MY_BETA_RULE o all_n_components2 i o MY_BETA_RULE) (1--n) dd1 in + + let d1_bounds = map (fun i -> + let th0 = eval_m_taylor_partial_bound n p_second i taylor1_th in + undisch th0) (1--n) in + + (* u'(f x), u''(f x) *) + let d1_th0, d2_th0 = + let neg, sqrt, inv, ( * ) = float_interval_neg, float_interval_sqrt p_second, + float_interval_inv p_second, float_interval_mul p_second in + let two_sqrt_f = two_interval * sqrt f1_bound in + inv two_sqrt_f, neg (inv (two_sqrt_f * (two_interval * f1_bound))) in + + let dd_ths = + let ( * ), ( + ) = float_interval_mul p_second, float_interval_add p_second in + map2 (fun dd_list di1 -> + my_map2 (fun dd dj1 -> + (d2_th0 * dj1) * di1 + d1_th0 * dd) dd_list d1_bounds) dd_ths d1_bounds in + + let dd_th = (GEN x_var o DISCH_ALL o end_itlist CONJ) (List.flatten dd_ths) in + + (***) + let df_vars = map (fun i -> df_vars_array.(i)) (1--n) in + let dd_vars = map (fun i -> map (fun j -> dd_vars_array.(i).(j)) (1--i)) (1--n) in + + let dfs = map (rand o concl) df_ths in + let dds = map (map (rand o concl)) dd_ths in + + let inst_list = union (zip dfs df_vars) (zip (List.flatten dds) (List.flatten dd_vars)) in + + let th1 = (MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP cond_th o MY_PROVE_HYP f1_bound0 o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP domain_th o + MY_PROVE_HYP dd_th o MY_PROVE_HYP df_th o + INST([f1_tm, f_var; f_bounds_tm, f_bounds_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var] @ inst_list)) sqrt_ths_array.(n) in + let eq_th = unary_beta_gen_eq f1_tm x_var sqrt_tm in + m_taylor_interval_norm th1 eq_th;; + + + +(******************************) +(* atn *) + +let eval_m_taylor_atn2 n p_lin p_second taylor1_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let f1_tm = (rand o concl) diff2_f1_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + + let ty = type_of y_tm in + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let undisch = UNDISCH o SPEC x_var in + + let f1_bound0 = eval_m_taylor_bound n p_second taylor1_th in + let f1_bound = undisch f1_bound0 in + let f_bounds_tm = (rand o concl) f1_bound in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th in + + let bounds_th = float_interval_atn p_lin bounds1_th in + let bounds_tm = (rand o concl) bounds_th in + + (* first partials *) + let u_bounds = + let inv, ( + ), ( * ) = float_interval_inv p_lin, + float_interval_add p_lin, float_interval_mul p_lin in + inv (one_interval + bounds1_th * bounds1_th) in + + let df1_ths' = all_n_components2 n df1_th in + let df1_ths = map MY_BETA_RULE df1_ths' in + + let df_ths = + let ( * ) = float_interval_mul p_lin in + map (fun th1 -> u_bounds * th1) df1_ths in + + let df_th = end_itlist CONJ df_ths in + + (* second partials *) + let dd_ths = + let dd1 = all_n_components2 n (second_bounded_components n second1_th) in + map2 (fun i -> map MY_BETA_RULE o all_n_components2 i o MY_BETA_RULE) (1--n) dd1 in + + let d1_bounds = map (fun i -> + let th0 = eval_m_taylor_partial_bound n p_second i taylor1_th in + undisch th0) (1--n) in + + (* u'(f x), u''(f x) *) + let d1_th0, d2_th0 = + let neg, inv, ( + ), ( * ), pow2 = float_interval_neg, float_interval_inv p_second, + float_interval_add p_second, float_interval_mul p_second, float_interval_pow_simple p_second 2 in + let inv_one_ff = inv (one_interval + f1_bound * f1_bound) in + inv_one_ff, (neg_two_interval * f1_bound) * pow2 inv_one_ff in + + let dd_ths = + let ( * ), ( + ) = float_interval_mul p_second, float_interval_add p_second in + map2 (fun dd_list di1 -> + my_map2 (fun dd dj1 -> + (d2_th0 * dj1) * di1 + d1_th0 * dd) dd_list d1_bounds) dd_ths d1_bounds in + + let dd_th = (GEN x_var o DISCH_ALL o end_itlist CONJ) (List.flatten dd_ths) in + + (***) + let df_vars = map (fun i -> df_vars_array.(i)) (1--n) in + let dd_vars = map (fun i -> map (fun j -> dd_vars_array.(i).(j)) (1--i)) (1--n) in + + let dfs = map (rand o concl) df_ths in + let dds = map (map (rand o concl)) dd_ths in + + let inst_list = union (zip dfs df_vars) (zip (List.flatten dds) (List.flatten dd_vars)) in + + let th1 = (MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP f1_bound0 o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP domain_th o + MY_PROVE_HYP dd_th o MY_PROVE_HYP df_th o + INST([f1_tm, f_var; f_bounds_tm, f_bounds_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var] @ inst_list)) atn_ths_array.(n) in + let eq_th = unary_beta_gen_eq f1_tm x_var atn_tm in + m_taylor_interval_norm th1 eq_th;; + + +(******************************) +(* acs *) + +let eval_m_taylor_acs2 n p_lin p_second taylor1_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let f1_tm = (rand o concl) diff2_f1_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + + let ty = type_of y_tm in + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let undisch = UNDISCH o SPEC x_var in + + let f1_bound0 = eval_m_taylor_bound n p_second taylor1_th in + let f1_bound = undisch f1_bound0 in + let f_bounds_tm = (rand o concl) f1_bound in + + (* cond *) + let cond_th = EQT_ELIM (check_interval_iabs f_bounds_tm one_float) in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th in + + let bounds_th = float_interval_acs p_lin bounds1_th in + let bounds_tm = (rand o concl) bounds_th in + + (* first partials *) + let u_bounds = + let inv, sqrt, neg = float_interval_inv p_lin, float_interval_sqrt p_lin, float_interval_neg in + let ( * ), ( - ) = float_interval_mul p_lin, float_interval_sub p_lin in + neg (inv (sqrt (one_interval - bounds1_th * bounds1_th))) in + + let df1_ths' = all_n_components2 n df1_th in + let df1_ths = map MY_BETA_RULE df1_ths' in + + let df_ths = + let ( * ) = float_interval_mul p_lin in + map (fun th1 -> u_bounds * th1) df1_ths in + + let df_th = end_itlist CONJ df_ths in + + (* second partials *) + let dd_ths = + let dd1 = all_n_components2 n (second_bounded_components n second1_th) in + map2 (fun i -> map MY_BETA_RULE o all_n_components2 i o MY_BETA_RULE) (1--n) dd1 in + + let d1_bounds = map (fun i -> + let th0 = eval_m_taylor_partial_bound n p_second i taylor1_th in + undisch th0) (1--n) in + + (* u'(f x), u''(f x) *) + let d1_th0, d2_th0 = + let neg, sqrt, inv = float_interval_neg, float_interval_sqrt p_second, float_interval_inv p_second in + let ( - ), ( * ), ( / ), pow3 = float_interval_sub p_second, float_interval_mul p_second, + float_interval_div p_second, float_interval_pow_simple p_second 3 in + let ff_1 = one_interval - f1_bound * f1_bound in + inv (sqrt ff_1), neg (f1_bound / sqrt (pow3 ff_1)) in + + let dd_ths = + let ( * ), ( - ) = float_interval_mul p_second, float_interval_sub p_second in + map2 (fun dd_list di1 -> + my_map2 (fun dd dj1 -> + (d2_th0 * dj1) * di1 - d1_th0 * dd) dd_list d1_bounds) dd_ths d1_bounds in + + let dd_th = (GEN x_var o DISCH_ALL o end_itlist CONJ) (List.flatten dd_ths) in + + (***) + let df_vars = map (fun i -> df_vars_array.(i)) (1--n) in + let dd_vars = map (fun i -> map (fun j -> dd_vars_array.(i).(j)) (1--i)) (1--n) in + + let dfs = map (rand o concl) df_ths in + let dds = map (map (rand o concl)) dd_ths in + + let inst_list = union (zip dfs df_vars) (zip (List.flatten dds) (List.flatten dd_vars)) in + + let th1 = (MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP cond_th o MY_PROVE_HYP f1_bound0 o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP domain_th o + MY_PROVE_HYP dd_th o MY_PROVE_HYP df_th o + INST([f1_tm, f_var; f_bounds_tm, f_bounds_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var] @ inst_list)) acs_ths_array.(n) in + let eq_th = unary_beta_gen_eq f1_tm x_var acs_tm in + m_taylor_interval_norm th1 eq_th;; + + +end;; diff --git a/formal_ineqs/taylor/theory/multivariate_taylor-compiled.hl b/formal_ineqs/taylor/theory/multivariate_taylor-compiled.hl new file mode 100644 index 0000000..9ebbed5 --- /dev/null +++ b/formal_ineqs/taylor/theory/multivariate_taylor-compiled.hl @@ -0,0 +1,2917 @@ +needs "lib/ssrbool-compiled.hl";; +needs "lib/ssrnat-compiled.hl";; +needs "taylor/theory/taylor_interval-compiled.hl";; +prioritize_overload `:real^N`;; +prioritize_real();; +let partial = new_definition `partial i f x = derivative (f o (\t. (x:real^N) + t % basis i)) (&0)`;; +let all_n = define `(all_n n [] s <=> T) /\ (all_n n (CONS h t) s <=> s n h /\ all_n (SUC n) t s)`;; +let m_lin_approx = new_definition `m_lin_approx (f:real^N->real) x f_bounds df_bounds_list <=> + (lift o f) differentiable at x /\ + interval_arith (f x) f_bounds /\ + all_n 1 df_bounds_list (\i int. interval_arith (partial i f x) int)`;; + +(* Section Misc *) +begin_section "Misc";; + +(* Lemma f_lift_neg *) +let f_lift_neg = section_proof ["f"] +`lift o (\x. --f x) = (\x. --(lift o f) x)` +[ + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "LIFT_NEG")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma f_lift_scale *) +let f_lift_scale = section_proof ["f";"c"] +`lift o (\x. c * f x) = (\x. c % (lift o f) x)` +[ + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "LIFT_CMUL")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma f_lift_add *) +let f_lift_add = section_proof ["f";"g"] +`lift o (\x. f x + g x) = (\x. (lift o f) x + (lift o g) x)` +[ + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "LIFT_ADD")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma f_lift_sub *) +let f_lift_sub = section_proof ["f";"g"] +`lift o (\x. f x - g x) = (\x. (lift o f) x - (lift o g) x)` +[ + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "LIFT_SUB")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma f_binary_drop *) +let f_binary_drop = section_proof ["op";"f";"g"] +`(\t. op (f t) (g t)) o drop = (\x. op (f (drop x)) (g (drop x)))` +[ + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma f_unary_drop *) +let f_unary_drop = section_proof ["op";"f"] +`(\t. op (f t)) o drop = (\x. op (f (drop x)))` +[ + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Section MoreFrechet *) +begin_section "MoreFrechet";; +(add_section_var (mk_var ("f", (`:real^N -> real^M`))); add_section_var (mk_var ("g", (`:real^N -> real^M`))));; +(add_section_var (mk_var ("x", (`:real^N`))); add_section_var (mk_var ("y", (`:real^N`))));; + +(* Lemma frechet_compose *) +let frechet_compose = section_proof ["f";"g";"x"] +`f differentiable at (g x) ==> + g differentiable at x ==> + frechet_derivative (f o g) (at x) = frechet_derivative f (at (g x)) o frechet_derivative g (at x)` +[ + ((BETA_TAC THEN (move ["df"]) THEN (move ["dg"])) THEN (((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then "FRECHET_DERIVATIVE_AT") (thm_tac apply_tac))); + (((use_arg_then "DIFF_CHAIN_AT") (thm_tac apply_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "FRECHET_DERIVATIVE_WORKS")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma frechet_const *) +let frechet_const = section_proof ["z"] +`frechet_derivative (\x. y) (at z) = (\x. vec 0)` +[ + ((((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then "FRECHET_DERIVATIVE_AT") (thm_tac apply_tac)) THEN (((use_arg_then "HAS_DERIVATIVE_CONST")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma frechet_id *) +let frechet_id = section_proof [] +`frechet_derivative (\x. x) (at y) = (\x. x)` +[ + ((((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then "FRECHET_DERIVATIVE_AT") (thm_tac apply_tac)) THEN (((use_arg_then "HAS_DERIVATIVE_ID")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma frechet_vmul *) +let frechet_vmul = section_proof ["z"] +`frechet_derivative (\x. drop x % y) (at z) = (\x. drop x % y)` +[ + ((((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then "FRECHET_DERIVATIVE_AT") (thm_tac apply_tac)) THEN ((use_arg_then "HAS_DERIVATIVE_VMUL_DROP") (thm_tac apply_tac))); + (((use_arg_then "HAS_DERIVATIVE_ID")(thm_tac (new_rewrite [] [])))); +];; +(add_section_hyp "df" (`f differentiable at x`));; + +(* Lemma frechet_neg *) +let frechet_neg = section_proof [] +`frechet_derivative (\x. --f x) (at x) = (\y. --frechet_derivative f (at x) y)` +[ + ((((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then "FRECHET_DERIVATIVE_AT") (thm_tac apply_tac)) THEN ((use_arg_then "HAS_DERIVATIVE_NEG") (thm_tac apply_tac))); + ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "FRECHET_DERIVATIVE_WORKS")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma frechet_scale *) +let frechet_scale = section_proof ["c"] +`frechet_derivative (\x. c % f x) (at x) = (\y. c % frechet_derivative f (at x) y)` +[ + ((((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then "FRECHET_DERIVATIVE_AT") (thm_tac apply_tac)) THEN ((use_arg_then "HAS_DERIVATIVE_CMUL") (thm_tac apply_tac))); + ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "FRECHET_DERIVATIVE_WORKS")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(add_section_hyp "dg" (`g differentiable at x`));; + +(* Lemma frechet_add *) +let frechet_add = section_proof [] +`frechet_derivative (\x. f x + g x) (at x) = + (\y. frechet_derivative f (at x) y + frechet_derivative g (at x) y)` +[ + ((((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then "FRECHET_DERIVATIVE_AT") (thm_tac apply_tac)) THEN ((use_arg_then "HAS_DERIVATIVE_ADD") (thm_tac apply_tac))); + ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then "FRECHET_DERIVATIVE_WORKS")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma frechet_sub *) +let frechet_sub = section_proof [] +`frechet_derivative (\x. f x - g x) (at x) = + (\y. frechet_derivative f (at x) y - frechet_derivative g (at x) y)` +[ + ((((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then "FRECHET_DERIVATIVE_AT") (thm_tac apply_tac)) THEN ((use_arg_then "HAS_DERIVATIVE_SUB") (thm_tac apply_tac))); + ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then "FRECHET_DERIVATIVE_WORKS")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section MoreFrechet *) +let frechet_compose = finalize_theorem frechet_compose;; +let frechet_const = finalize_theorem frechet_const;; +let frechet_id = finalize_theorem frechet_id;; +let frechet_vmul = finalize_theorem frechet_vmul;; +let frechet_neg = finalize_theorem frechet_neg;; +let frechet_scale = finalize_theorem frechet_scale;; +let frechet_add = finalize_theorem frechet_add;; +let frechet_sub = finalize_theorem frechet_sub;; +end_section "MoreFrechet";; + +(* Lemma differentiable_compose_at *) +let differentiable_compose_at = section_proof ["f";"g";"x"] +`f differentiable at (g x) ==> + g differentiable at x ==> + (f o g) differentiable at x` +[ + ((BETA_TAC THEN (move ["df"]) THEN (move ["dg"])) THEN (((use_arg_then "FRECHET_DERIVATIVE_WORKS")(thm_tac (new_rewrite [] []))))); + (((((use_arg_then "frechet_compose")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((use_arg_then "DIFF_CHAIN_AT") (thm_tac apply_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "FRECHET_DERIVATIVE_WORKS")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma jacobian_compose *) +let jacobian_compose = section_proof ["f";"g";"x"] +`f differentiable at (g x) ==> + g differentiable at x ==> + jacobian (f o g) (at x) = jacobian f (at (g x)) ** jacobian g (at x)` +[ + (BETA_TAC THEN (move ["df"]) THEN (move ["dg"])); + (((repeat_tactic 1 9 (((use_arg_then "jacobian")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "frechet_compose")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "MATRIX_COMPOSE")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "LINEAR_FRECHET_DERIVATIVE")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma frechet_eq_jacobian *) +let frechet_eq_jacobian = section_proof ["f";"x"] +`f differentiable at x ==> + frechet_derivative f (at x) = (\h. jacobian f (at x) ** h)` +[ + (BETA_TAC THEN (move ["df"])); + (((((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "FRECHET_DERIVATIVE_AT")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "JACOBIAN_WORKS")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Section Product *) +begin_section "Product";; + +(* Lemma REAL_LET_MUL2 *) +let REAL_LET_MUL2 = section_proof ["w";"x";"y";"z"] +`&0 < w /\ w <= x /\ &0 <= y /\ y < z ==> w * y < x * z` +[ + (BETA_TAC THEN (move ["ineq"])); + ((THENL) (((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`w = x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(move ["w_eq_x"]); (move ["wnx"])]); + (((((use_arg_then "w_eq_x")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LT_LMUL")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "REAL_LT_MUL2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "wnx") (disch_tac [])) THEN (clear_assumption "wnx") THEN ((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma has_derivative_x12 *) +let has_derivative_x12 = section_proof ["y"] +`(lift o (\x:real^2. x$1 * x$2) has_derivative lift o (\x. y$2 * x$1 + y$1 * x$2)) (at y)` +[ + ((((use_arg_then "has_derivative_at")(thm_tac (new_rewrite [] [])))) THEN (split_tac)); + ((((use_arg_then "linear")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "VECTOR_ADD_COMPONENT")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "VECTOR_MUL_COMPONENT")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "LIFT_ADD")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "LIFT_CMUL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "LIFT_ADD")(thm_tac (new_rewrite [] [])))))); + ((VECTOR_ARITH_TAC) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "LIFT_ADD")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "LIFT_SUB")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "LIFT_CMUL")(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then "LIM_AT")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "dist")(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_RZERO)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "NORM_LIFT")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "VECTOR_SUB_COMPONENT")(thm_tac (new_rewrite [] [])))))) THEN (move ["e"]) THEN (move ["e0"])); + (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `(x:real^2)$1 * x$2 - ((y:real^2)$1 * y$2 + y$2 * (x$1 - y$1) + y$1 * (x$2 - y$2)) = + (x$2 - y$2) * (x$1 - y$1)`)))(thm_tac (new_rewrite [] [])))); + (((use_arg_then "e") (term_tac exists_tac)) THEN (((((use_arg_then "e0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN ((move ["norm0"]) THEN (move ["norm_e"]))))); + ((repeat_tactic 1 9 (((use_arg_then "REAL_ABS_MUL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_ABS_INV")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ABS_NORM")(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((use_arg_then "VECTOR_SUB_COMPONENT")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`x - y:real^2`))) (term_tac (set_tac "p")))); + ((fun arg_tac -> (use_arg_then "NORM_BOUND_COMPONENT_LT") (fun fst_arg -> (use_arg_then "norm_e") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["ineq"]))); + ((((use_arg_then "REAL_LTE_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LTE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`inv (infnorm p) * infnorm p * e`))) (term_tac exists_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < infnorm p`))) (term_tac (have_gen_tac [](move ["infnorm_0"])))) (((((use_arg_then "INFNORM_POS_LT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "NORM_POS_LT")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((THENL_ROT (-1)) (split_tac)); + (((((use_arg_then "REAL_MUL_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_LINV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_MUL_LID")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "INFNORM_EQ_0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "NORM_POS_LT")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then "REAL_LET_MUL2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LT_INV")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_LE_INV2")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "INFNORM_LE_NORM")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "REAL_LE_MUL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_ABS_POS")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`infnorm p = abs (p$1) \/ infnorm p = abs (p$2)`))) (term_tac (have_gen_tac []ALL_TAC))); + ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL INFNORM_2)))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + (((THENL_FIRST) (case THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) (((use_arg_then "REAL_MUL_SYM")(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then "REAL_LT_LMUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ineq")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "DIMINDEX_2")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma lambda_eq_vsum *) +let lambda_eq_vsum = section_proof ["f"] +`(\x:A. lambda i. f i x) = + (\x. vsum (1..dimindex (:N)) (\i. f i x % (basis i:real^N)))` +[ + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["x"])); + (((((use_arg_then "CART_EQ")(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["ineq"])) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "VSUM_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)))); + (((fun arg_tac -> arg_tac (Arg_term (`1.. _`))) (term_tac (set_tac "A"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`A DIFF {i}`))) (term_tac (set_tac "B")))); + ((fun arg_tac -> arg_tac (Arg_term (`DISJOINT B {i} /\ A = B UNION {i}`))) (term_tac (have_gen_tac [](move ["cond"])))); + ((((use_arg_then "DISJOINT")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "EXTENSION")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "B_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "A_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_DIFF")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_SING")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "NOT_IN_EMPTY")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((THENL_FIRST) ((split_tac) THEN (move ["x"])) (((repeat_tactic 1 9 (((use_arg_then "negb_and")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "negbK")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "orbA")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "EXCLUDED_MIDDLE")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then "IN_UNION")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_DIFF")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_SING")(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x = i`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((simp_tac) THEN (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "cond")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUM_UNION")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "cond")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "B_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_DIFF")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "A_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_SING")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then "SUM_SING")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "VECTOR_MUL_COMPONENT")(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then "BASIS_COMPONENT") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); + (((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b. a = b + a * &1 <=> b = &0`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUM_EQ_0")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["j"])); + ((((((use_arg_then "IN_DIFF")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_SING")(thm_tac (new_rewrite [] []))))) THEN (move ["ineq_j"]) THEN (simp_tac)) THEN ((((use_arg_then "BASIS_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then "EQ_SYM_EQ") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then "ineq_j")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "REAL_MUL_RZERO")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma has_derivative_lambda *) +let has_derivative_lambda = section_proof ["f";"f'";"y"] +`(!i. i IN 1..dimindex (:M) ==> (lift o (f i) has_derivative lift o (f' i)) (at (y:real^N))) ==> + (((\x. lambda i. f i x):real^N->real^M) has_derivative (\x. lambda i. f' i x) ) (at y)` +[ + ((BETA_TAC THEN (move ["df"])) THEN (repeat_tactic 1 9 (((use_arg_then "lambda_eq_vsum")(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then "HAS_DERIVATIVE_VSUM") (thm_tac apply_tac))); + (((((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!f. (\x:real^N. f i x % (basis i:real^M)) = (\x. drop ((lift o f i) x) % basis i)`))) (term_tac (have_gen_tac [](move ["eq"])))); + ((BETA_TAC THEN (move ["g"])) THEN ((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((fun arg_tac -> (use_arg_then "eq") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "eq") (fun fst_arg -> (use_arg_then "f'") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_DERIVATIVE_VMUL_DROP)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma vector2_eq_lambda *) +let vector2_eq_lambda = section_proof ["x";"y"] +`(vector [x; y]:real^2) = (lambda i. if i = 1 then x else y)` +[ + ((((((use_arg_then "CART_EQ")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIMINDEX_2")(thm_tac (new_rewrite [] []))))) THEN (move ["i"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `1 <= i /\ i <= 2 <=> i = 1 \/ i = 2`)))(thm_tac (new_rewrite [] []))))); + ((case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [1; 3] []))))) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_2)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then "DIMINDEX_2")(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma has_derivative_vector2 *) +let has_derivative_vector2 = section_proof ["f";"g";"f'";"g'";"y"] +`(lift o f has_derivative lift o f') (at y) ==> + (lift o g has_derivative lift o g') (at y) ==> + ((\x. vector [f x; g x]:real^2) has_derivative (\x. vector [f' x; g' x]:real^2)) (at y)` +[ + ((BETA_TAC THEN (move ["df"]) THEN (move ["dg"])) THEN (repeat_tactic 1 9 (((use_arg_then "vector2_eq_lambda")(thm_tac (new_rewrite [] [])))))); + (((use_arg_then "has_derivative_lambda") (thm_tac apply_tac)) THEN (((((use_arg_then "DIMINDEX_2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]))); + ((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `1 <= i /\ i <= 2 <=> i = 1 \/ i = 2`)))(thm_tac (new_rewrite [] [])))) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [2; 4] [])))) THEN (simp_tac)) THEN ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `~(2 = 1)`)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma has_derivative_mul *) +let has_derivative_mul = section_proof ["f";"g";"f'";"g'";"y"] +`(lift o f has_derivative lift o f') (at y) ==> + (lift o g has_derivative lift o g') (at y) ==> + (lift o (\x. f x * g x) has_derivative lift o (\x. f' x * g y + f y * g' x)) (at y)` +[ + (BETA_TAC THEN (move ["df"]) THEN (move ["dg"])); + ((fun arg_tac -> arg_tac (Arg_term (`lift o (\x. f x * g x) = (lift o (\p. p$1 * p$2)) o (\x. vector [f x; g x]:real^2)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["x"])) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_2)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`vector [f y; g y]:real^2`))) (term_tac (set_tac "q"))); + ((fun arg_tac -> arg_tac (Arg_term (`lift o (\x. f' x * g y + f y * g' x) = + (lift o (\x:real^2. q$2 * x$1 + q$1 * x$2)) o (\x. vector [f' x; g' x])`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "q_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_2)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_MUL_SYM")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "DIFF_CHAIN_AT") (thm_tac apply_tac)) THEN (simp_tac)) THEN ((((use_arg_then "q_def")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "has_derivative_x12")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "has_derivative_vector2")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma f_eq_lift_drop *) +let f_eq_lift_drop = section_proof ["f"] +`f = lift o (drop o f)` +[ + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma differentiable_mul *) +let differentiable_mul = section_proof ["f";"g";"y"] +`lift o f differentiable (at y) ==> + lift o g differentiable (at y) ==> + lift o (\x. f x * g x) differentiable (at y)` +[ + ((repeat_tactic 2 0 (((use_arg_then "differentiable")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["f'"])) THEN (move ["df"]) THEN (case THEN (move ["g'"])) THEN (move ["dg"])); + ((((use_arg_then "dg") (disch_tac [])) THEN (clear_assumption "dg") THEN ((use_arg_then "df") (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC) THEN (((((fun arg_tac -> (use_arg_then "f_eq_lift_drop") (fun fst_arg -> (use_arg_then "f'") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "f_eq_lift_drop") (fun fst_arg -> (use_arg_then "g'") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (move ["df"]) THEN (move ["dg"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then "has_derivative_mul") (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "dg") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((use_arg_then "HAS_DERIVATIVE_IMP_DIFFERENTIABLE") (thm_tac apply_tac)) THEN (done_tac)); +];; + +(* Lemma frechet_mul *) +let frechet_mul = section_proof ["f";"g";"y"] +`lift o f differentiable at y ==> + lift o g differentiable at y ==> + frechet_derivative (lift o (\x. f x * g x)) (at y) = + (\x. g y % frechet_derivative (lift o f) (at y) x + + f y % frechet_derivative (lift o g) (at y) x)` +[ + (((repeat_tactic 1 9 (((use_arg_then "FRECHET_DERIVATIVE_WORKS")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "f_eq_lift_drop")(thm_tac (new_rewrite [] [(`frechet_derivative _1 _2`)]))))) THEN (move ["df"])); + ((((use_arg_then "f_eq_lift_drop")(thm_tac (new_rewrite [] [(`frechet_derivative _1 _2`)])))) THEN (move ["dg"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then "has_derivative_mul") (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "dg") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then "FRECHET_DERIVATIVE_AT") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] [])))))) THEN (move ["x"])); + (((((use_arg_then "LIFT_ADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_SYM")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "LIFT_CMUL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section Product *) +let REAL_LET_MUL2 = finalize_theorem REAL_LET_MUL2;; +let has_derivative_x12 = finalize_theorem has_derivative_x12;; +let lambda_eq_vsum = finalize_theorem lambda_eq_vsum;; +let has_derivative_lambda = finalize_theorem has_derivative_lambda;; +let vector2_eq_lambda = finalize_theorem vector2_eq_lambda;; +let has_derivative_vector2 = finalize_theorem has_derivative_vector2;; +let has_derivative_mul = finalize_theorem has_derivative_mul;; +let f_eq_lift_drop = finalize_theorem f_eq_lift_drop;; +let differentiable_mul = finalize_theorem differentiable_mul;; +let frechet_mul = finalize_theorem frechet_mul;; +end_section "Product";; + +(* Finalization of the section Misc *) +let f_lift_neg = finalize_theorem f_lift_neg;; +let f_lift_scale = finalize_theorem f_lift_scale;; +let f_lift_add = finalize_theorem f_lift_add;; +let f_lift_sub = finalize_theorem f_lift_sub;; +let f_binary_drop = finalize_theorem f_binary_drop;; +let f_unary_drop = finalize_theorem f_unary_drop;; +let frechet_compose = finalize_theorem frechet_compose;; +let frechet_const = finalize_theorem frechet_const;; +let frechet_id = finalize_theorem frechet_id;; +let frechet_vmul = finalize_theorem frechet_vmul;; +let frechet_neg = finalize_theorem frechet_neg;; +let frechet_scale = finalize_theorem frechet_scale;; +let frechet_add = finalize_theorem frechet_add;; +let frechet_sub = finalize_theorem frechet_sub;; +let differentiable_compose_at = finalize_theorem differentiable_compose_at;; +let jacobian_compose = finalize_theorem jacobian_compose;; +let frechet_eq_jacobian = finalize_theorem frechet_eq_jacobian;; +let REAL_LET_MUL2 = finalize_theorem REAL_LET_MUL2;; +let has_derivative_x12 = finalize_theorem has_derivative_x12;; +let lambda_eq_vsum = finalize_theorem lambda_eq_vsum;; +let has_derivative_lambda = finalize_theorem has_derivative_lambda;; +let vector2_eq_lambda = finalize_theorem vector2_eq_lambda;; +let has_derivative_vector2 = finalize_theorem has_derivative_vector2;; +let has_derivative_mul = finalize_theorem has_derivative_mul;; +let f_eq_lift_drop = finalize_theorem f_eq_lift_drop;; +let differentiable_mul = finalize_theorem differentiable_mul;; +let frechet_mul = finalize_theorem frechet_mul;; +end_section "Misc";; + +(* Section Partial *) +begin_section "Partial";; + +(* Lemma real_derivative_compose_frechet *) +let real_derivative_compose_frechet = section_proof ["f";"h";"t"] +`(lift o f) differentiable at (h t) ==> + (h o drop) differentiable at (lift t) ==> + ((f o h) has_real_derivative (drop o (frechet_derivative (lift o f) (at (h t)) o + frechet_derivative (h o drop) (at (lift t))) o lift) (&1)) (atreal t)` +[ + (BETA_TAC THEN (move ["diff_f"]) THEN (move ["diff_h"])); + ((((use_arg_then "diff_h") (disch_tac [])) THEN ((use_arg_then "diff_f") (disch_tac [])) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then "FRECHET_DERIVATIVE_WORKS")(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`frechet_derivative _1 _2`))) (term_tac (set_tac "f'"))); + ((fun arg_tac -> arg_tac (Arg_term (`frechet_derivative _1 _2`))) (term_tac (set_tac "h'"))); + (BETA_TAC THEN (move ["df"]) THEN (move ["dh"])); + (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_REAL_FRECHET_DERIVATIVE_AT)))(thm_tac (new_rewrite [] [])))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`lift o (f o h) o drop = (lift o f) o (h o drop)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((repeat_tactic 1 9 (((use_arg_then "o_ASSOC")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`(\x. (drop o (f' o h') o lift) (&1) % x) = f' o h'`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + (((((use_arg_then "DIFF_CHAIN_AT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "dh")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))))) THEN (move ["x"]) THEN (simp_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`linear f' /\ linear h'`))) (term_tac (have_gen_tac [](move ["lin"])))); + (((((use_arg_then "h'_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "f'_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "LINEAR_FRECHET_DERIVATIVE")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`x = drop x % lift (&1)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [2] []))))))); + (((((use_arg_then "DROP_EQ")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "DROP_CMUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then "LINEAR_CMUL")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "DROP_EQ")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "DROP_CMUL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_MUL_SYM")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma real_derivative_compose_jacobian *) +let real_derivative_compose_jacobian = section_proof ["f";"h";"t"] +`(lift o f) differentiable at (h t) ==> + (h o drop) differentiable at (lift t) ==> + ((f o h) has_real_derivative (jacobian (lift o f) (at (h t)) ** + jacobian (h o drop) (at (lift t)))$1$1) (atreal t)` +[ + (BETA_TAC THEN (move ["df"]) THEN (move ["dh"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then "real_derivative_compose_frechet") (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "dh") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((repeat_tactic 1 9 (((use_arg_then "frechet_eq_jacobian")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((((use_arg_then "MATRIX_VECTOR_MUL_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "matrix_vector_mul")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DROP_LAMBDA")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIMINDEX_1")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUM_SING_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((((use_arg_then "LIFT_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff_imp_real_diff *) +let diff_imp_real_diff = section_proof ["f";"h";"t"] +`(lift o f) differentiable at (h t) ==> + (h o drop) differentiable at (lift t) ==> + (f o h) real_differentiable atreal t` +[ + (BETA_TAC THEN (move ["diff_f"]) THEN (move ["diff_h"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then "real_derivative_compose_frechet") (fun fst_arg -> (use_arg_then "diff_f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "diff_h") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((fun arg_tac -> arg_tac (Arg_term (`(drop o _ o lift) (&1)`))) (term_tac (set_tac "fh'"))); + (((((use_arg_then "real_differentiable")(thm_tac (new_rewrite [] [])))) THEN (move ["dfh"])) THEN ((use_arg_then "fh'") (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma diff_direction *) +let diff_direction = section_proof ["y";"e";"net"] +`((\t. y + t % e) o drop) differentiable net` +[ + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`(\t. y + t % e) o drop = (\x. y + drop x % e)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then "DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))); + ((use_arg_then "HAS_DERIVATIVE_IMP_DIFFERENTIABLE") (thm_tac apply_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`\x. drop x % e`))) (term_tac exists_tac)) THEN ((use_arg_then "HAS_DERIVATIVE_VMUL_DROP") (thm_tac apply_tac)) THEN (((use_arg_then "HAS_DERIVATIVE_ID")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma frechet_direction *) +let frechet_direction = section_proof ["y";"e";"t"] +`frechet_derivative ((\t. y + t % e) o drop) (at (lift t)) = (\x. drop x % e)` +[ + ((((use_arg_then "f_unary_drop")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "frechet_add")(thm_tac (new_rewrite [] []))))); + (((((use_arg_then "DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then "HAS_DERIVATIVE_IMP_DIFFERENTIABLE") (thm_tac apply_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`\x. drop x % e`))) (term_tac exists_tac)) THEN ((use_arg_then "HAS_DERIVATIVE_VMUL_DROP") (thm_tac apply_tac)) THEN (((use_arg_then "HAS_DERIVATIVE_ID")(thm_tac (new_rewrite [] []))))); + (((((use_arg_then "frechet_vmul")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "frechet_const")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_ADD_LID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma real_dir_derivative_frechet *) +let real_dir_derivative_frechet = section_proof ["f";"y";"e";"t"] +`(lift o f) differentiable at (y + t % e) ==> + ((f o (\t. y + t % e)) has_real_derivative + (drop (frechet_derivative (lift o f) (at (y + t % e)) e))) (atreal t)` +[ + (BETA_TAC THEN (move ["df"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "real_derivative_compose_frechet") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`\t. y + t % e`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "t") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff_direction")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "frechet_direction")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_MUL_LID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma real_dir_derivative_jacobian *) +let real_dir_derivative_jacobian = section_proof ["f";"y";"e";"t"] +`(lift o f) differentiable at (y + t % e) ==> + ((f o (\t. y + t % e)) has_real_derivative + drop (jacobian (lift o f) (at (y + t % e)) ** e)) (atreal t)` +[ + (BETA_TAC THEN (move ["df"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "real_dir_derivative_frechet") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "e") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((use_arg_then "frechet_eq_jacobian")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma partial_eq_frechet *) +let partial_eq_frechet = section_proof ["f";"y";"i"] +`(lift o f) differentiable at (y:real^N) ==> + partial i f y = drop (frechet_derivative (lift o f) (at y) (basis i))` +[ + ((BETA_TAC THEN (move ["df"])) THEN (((use_arg_then "partial")(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "real_dir_derivative_frechet") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "y") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`basis i:real^N`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "derivative_unique") (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Lemma partial_eq_jacobian *) +let partial_eq_jacobian = section_proof ["f";"y";"i"] +`(lift o f) differentiable at y ==> + partial i f y = drop (jacobian (lift o f) (at y) ** basis i)` +[ + (BETA_TAC THEN (move ["df"])); + ((((use_arg_then "df") (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then "partial_eq_frechet")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "JACOBIAN_WORKS")(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "FRECHET_DERIVATIVE_AT") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma partial_eq_jacobian_column *) +let partial_eq_jacobian_column = section_proof ["f";"y";"i"] +`(lift o (f:real^N->real)) differentiable at y ==> + i IN 1..dimindex (:N) ==> + partial i f y = drop (column i (jacobian (lift o f) (at y)))` +[ + ((((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (move ["df"]) THEN (move ["ineq"])); + (((((use_arg_then "partial_eq_jacobian")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "MATRIX_VECTOR_MUL_BASIS")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma partial_eq_jacobian_entry *) +let partial_eq_jacobian_entry = section_proof ["f";"y";"i"] +`(lift o (f:real^N->real)) differentiable at y ==> + i IN 1..dimindex (:N) ==> + partial i f y = (jacobian (lift o f) (at y))$1$i` +[ + ((BETA_TAC THEN (move ["df"]) THEN (move ["ineq"])) THEN ((((use_arg_then "partial_eq_jacobian_column")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "column")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DROP_LAMBDA")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(add_section_var (mk_var ("y", (`:real^N`))));; +(add_section_var (mk_var ("i", (`:num`))));; + +(* Lemma partial_eq0 *) +let partial_eq0 = section_proof ["f"] +`~(i IN 1..dimindex (:N)) ==> + partial i f y = &0` +[ + ((BETA_TAC THEN (move ["ineq"])) THEN (((use_arg_then "partial")(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`basis i = (vec 0):real^N`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then "BASIS_EQ_0")(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then "VECTOR_MUL_RZERO")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "VECTOR_ADD_RID")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); + ((fun arg_tac -> arg_tac (Arg_term (`derivative (f o (\t. y)) = derivative (\t. f y)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((AP_TERM_TAC) THEN ((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "derivative_const")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma derivative_compose *) +let derivative_compose = section_proof ["f";"g";"x"] +`f real_differentiable atreal (g x) ==> + g real_differentiable atreal x ==> + derivative (f o g) x = derivative f (g x) * derivative g x` +[ + (BETA_TAC THEN (move ["df"]) THEN (move ["dg"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`f o g = \x. f (g x)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then "derivative_composition")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_MUL_SYM")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma projection_has_derivative *) +let projection_has_derivative = section_proof ["i";"net"] +`i IN 1..dimindex (:N) ==> + (lift o (\x:real^N. x$i) has_derivative lift o (\x. x$i)) net` +[ + ((((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (move ["ineq"])); + ((fun arg_tac -> arg_tac (Arg_term (`lift o (\x:real^N. x$i) = (\x. x$i % vec 1)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"])) THEN ((((use_arg_then "DROP_EQ")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DROP_CMUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DROP_VEC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_DERIVATIVE_VMUL_COMPONENT)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "HAS_DERIVATIVE_ID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma projection_diff *) +let projection_diff = section_proof ["i";"net"] +`i IN 1..dimindex (:N) ==> + (lift o (\x:real^N. x$i)) differentiable net` +[ + ((((use_arg_then "differentiable")(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "projection_has_derivative") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "net") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["h"])); + (((fun arg_tac -> arg_tac (Arg_term (`lift o \x:real^N. x$i`))) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma frechet_projection *) +let frechet_projection = section_proof ["i";"x"] +`i IN 1..dimindex (:N) ==> + frechet_derivative (lift o (\x:real^N. x$i)) (at x) = lift o (\x:real^N. x$i)` +[ + ((BETA_TAC THEN (move ["ineq"])) THEN (((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then "FRECHET_DERIVATIVE_AT") (thm_tac apply_tac))); + ((((use_arg_then "projection_has_derivative")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma has_derivative_vector_frechet *) +let has_derivative_vector_frechet = section_proof ["h";"t";"i"] +`i IN 1..dimindex (:N) ==> + (h o drop) differentiable at (lift t) ==> + ((\s. (h:real->real^N) s$i) has_real_derivative + (frechet_derivative (h o drop) (at (lift t)) (lift (&1)))$i) (atreal t)` +[ + (BETA_TAC THEN (move ["ineq"]) THEN (move ["dh"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`(\s. h s$i) = (\x. x$i) o h`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "real_derivative_compose_frechet") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`\x:real^N. x$i`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "h") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "t") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((use_arg_then "dh")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "projection_diff")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`(drop o _ o lift) (&1)`))) (term_tac (set_tac "lhs"))); + ((fun arg_tac -> arg_tac (Arg_term (`(frechet_derivative _1 _2 _3)$i`))) (term_tac (set_tac "rhs"))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`lhs = rhs`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((done_tac) THEN (done_tac))); + (((((use_arg_then "lhs_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "frechet_projection")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "rhs_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma has_derivative_vector_jacobian *) +let has_derivative_vector_jacobian = section_proof ["h";"t";"i"] +`i IN 1..dimindex (:N) ==> + (h o drop) differentiable at (lift t) ==> + ((\s. (h:real->real^N) s$i) has_real_derivative (jacobian (h o drop) (at (lift t)))$i$1) (atreal t)` +[ + (BETA_TAC THEN (move ["ineq"]) THEN (move ["dh"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then "has_derivative_vector_frechet") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "dh") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((fun arg_tac -> arg_tac (Arg_term (`(frechet_derivative _1 _2 _3)$i`))) (term_tac (set_tac "lhs"))); + ((fun arg_tac -> arg_tac (Arg_term (`jacobian _1 _2$i$1`))) (term_tac (set_tac "rhs"))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`lhs = rhs`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((done_tac) THEN (done_tac))); + ((((use_arg_then "lhs_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "frechet_eq_jacobian")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`lift (&1) = basis 1`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "DROP_EQ")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "basis")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DROP_LAMBDA")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then "MATRIX_VECTOR_MUL_BASIS")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "DIMINDEX_GE_1")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "leqnn")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "column")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "IN_NUMSEG")(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); +];; + +(* Lemma derivative_vector_jacobian *) +let derivative_vector_jacobian = section_proof ["h";"t";"i"] +`i IN 1..dimindex (:N) ==> + ((h:real->real^N) o drop) differentiable at (lift t) ==> + derivative (\s. h s$i) t = jacobian (h o drop) (at (lift t))$i$1` +[ + ((BETA_TAC THEN (move ["ineq"]) THEN (move ["dh"])) THEN ((use_arg_then "derivative_unique") (thm_tac apply_tac)) THEN (((use_arg_then "has_derivative_vector_jacobian")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma real_derivative_compose_partial *) +let real_derivative_compose_partial = section_proof ["f";"h";"t"] +`(lift o (f:real^N -> real)) differentiable at (h t) ==> + (h o drop) differentiable at (lift t) ==> + ((f o h) has_real_derivative + sum (1..dimindex (:N)) (\i. partial i f (h t) * derivative (\s. h s$i) t)) (atreal t)` +[ + (BETA_TAC THEN (move ["df"]) THEN (move ["dh"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then "real_derivative_compose_jacobian") (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "dh") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((fun arg_tac -> arg_tac (Arg_term (`_$1$1`))) (term_tac (set_tac "lhs"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`sum _ _2`))) (term_tac (set_tac "rhs")))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`lhs = rhs`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((done_tac) THEN (done_tac))); + (((use_arg_then "lhs_def")(gsym_then (thm_tac (new_rewrite [] []))))); + ((((use_arg_then "matrix_mul")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "DIMINDEX_GE_1")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "leqnn")(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))); + ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "DIMINDEX_GE_1")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "leqnn")(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then "rhs_def")(gsym_then (thm_tac (new_rewrite [] [])))))); + (((use_arg_then "SUM_EQ") (thm_tac apply_tac)) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac)); + (((((use_arg_then "partial_eq_jacobian_entry")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_EQ_MUL_LCANCEL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "derivative_vector_jacobian")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma real_dir_derivative_partial *) +let real_dir_derivative_partial = section_proof ["f";"e";"t"] +`(lift o f) differentiable at (y + t % e) ==> + ((f o (\t. y + t % e)) has_real_derivative + sum (1..dimindex (:N)) (\i. e$i * (partial i f o (\t. y + t % e)) t)) (atreal t)` +[ + (BETA_TAC THEN (move ["df"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "real_dir_derivative_jacobian") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "y") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "e") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((use_arg_then "matrix_vector_mul")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DROP_LAMBDA")(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "lhs"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "rhs")))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`lhs = rhs`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((done_tac) THEN (done_tac))); + (((((use_arg_then "lhs_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "rhs_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "SUM_EQ") (thm_tac apply_tac)) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac))); + (((((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "partial_eq_jacobian_entry")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then "REAL_MUL_SYM")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(add_section_var (mk_var ("f", (`:real^N -> real`))); add_section_var (mk_var ("g", (`:real^N -> real`))));; +(add_section_hyp "df" (`(lift o f) differentiable at y`));; + +(* Lemma partial_uni_compose *) +let partial_uni_compose = section_proof ["u"] +`u real_differentiable atreal (f y) ==> + partial i (u o f) y = derivative u (f y) * partial i f y` +[ + ((BETA_TAC THEN (move ["du"])) THEN ((repeat_tactic 1 9 (((use_arg_then "partial")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_ASSOC")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "derivative_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + (((((use_arg_then "diff_imp_real_diff")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff_direction")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma partial_neg *) +let partial_neg = section_proof [] +`partial i (\x. --f x) y = --partial i f y` +[ + (((repeat_tactic 1 9 (((use_arg_then "partial_eq_frechet")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "f_lift_neg")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_NEG")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then "frechet_neg")(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac)) THEN (((use_arg_then "DROP_NEG")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma partial_scale *) +let partial_scale = section_proof ["c"] +`partial i (\x. c * f x) y = c * partial i f y` +[ + (((repeat_tactic 1 9 (((use_arg_then "partial_eq_frechet")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "f_lift_scale")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_CMUL")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then "frechet_scale")(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac)))); + ((((use_arg_then "DROP_CMUL")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; +(add_section_hyp "dg" (`(lift o g) differentiable at y`));; + +(* Lemma partial_add *) +let partial_add = section_proof [] +`partial i (\x. f x + g x) y = partial i f y + partial i g y` +[ + (((repeat_tactic 1 9 (((use_arg_then "partial_eq_frechet")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "f_lift_add")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then "frechet_add")(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac)))); + ((((use_arg_then "DROP_ADD")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma partial_sub *) +let partial_sub = section_proof [] +`partial i (\x. f x - g x) y = partial i f y - partial i g y` +[ + (((repeat_tactic 1 9 (((use_arg_then "partial_eq_frechet")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "f_lift_sub")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_SUB")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then "frechet_sub")(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac)))); + ((((use_arg_then "DROP_SUB")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma partial_mul *) +let partial_mul = section_proof [] +`partial i (\x. f x * g x) y = partial i f y * g y + f y * partial i g y` +[ + ((repeat_tactic 1 9 (((use_arg_then "partial")(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`\t. y + t % basis i`))) (term_tac (set_tac "h")))); + ((fun arg_tac -> arg_tac (Arg_term (`(\x. f x * g x) o h = (\t. (f o h) t * (g o h) t)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL_ROT (-1)) (((use_arg_then "derivative_mul")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "h_def")(gsym_then (thm_tac (new_rewrite [1; 4] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "o_THM") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then "o_THM") (fun fst_arg -> (use_arg_then "g") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "REAL_ADD_SYM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`h (&0) = y`))) (term_tac (have_gen_tac [](move ["h0"])))) (((((use_arg_then "h_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`(h o drop) differentiable at (lift (&0))`))) (term_tac (have_gen_tac [](move ["dh"])))) (((((use_arg_then "h_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "diff_direction")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 1 9 (((use_arg_then "diff_imp_real_diff")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "h0")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section Partial *) +let real_derivative_compose_frechet = finalize_theorem real_derivative_compose_frechet;; +let real_derivative_compose_jacobian = finalize_theorem real_derivative_compose_jacobian;; +let diff_imp_real_diff = finalize_theorem diff_imp_real_diff;; +let diff_direction = finalize_theorem diff_direction;; +let frechet_direction = finalize_theorem frechet_direction;; +let real_dir_derivative_frechet = finalize_theorem real_dir_derivative_frechet;; +let real_dir_derivative_jacobian = finalize_theorem real_dir_derivative_jacobian;; +let partial_eq_frechet = finalize_theorem partial_eq_frechet;; +let partial_eq_jacobian = finalize_theorem partial_eq_jacobian;; +let partial_eq_jacobian_column = finalize_theorem partial_eq_jacobian_column;; +let partial_eq_jacobian_entry = finalize_theorem partial_eq_jacobian_entry;; +let partial_eq0 = finalize_theorem partial_eq0;; +let derivative_compose = finalize_theorem derivative_compose;; +let projection_has_derivative = finalize_theorem projection_has_derivative;; +let projection_diff = finalize_theorem projection_diff;; +let frechet_projection = finalize_theorem frechet_projection;; +let has_derivative_vector_frechet = finalize_theorem has_derivative_vector_frechet;; +let has_derivative_vector_jacobian = finalize_theorem has_derivative_vector_jacobian;; +let derivative_vector_jacobian = finalize_theorem derivative_vector_jacobian;; +let real_derivative_compose_partial = finalize_theorem real_derivative_compose_partial;; +let real_dir_derivative_partial = finalize_theorem real_dir_derivative_partial;; +let partial_uni_compose = finalize_theorem partial_uni_compose;; +let partial_neg = finalize_theorem partial_neg;; +let partial_scale = finalize_theorem partial_scale;; +let partial_add = finalize_theorem partial_add;; +let partial_sub = finalize_theorem partial_sub;; +let partial_mul = finalize_theorem partial_mul;; +end_section "Partial";; + +(* Section PartialMonotone *) +begin_section "PartialMonotone";; + +(* Lemma derivative_translation *) +let derivative_translation = section_proof ["f";"x"] +`f real_differentiable atreal x ==> + derivative f x = derivative (f o (\t. x + t)) (&0)` +[ + (BETA_TAC THEN (move ["diff_f"])); + ((((use_arg_then "derivative_compose")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_ADD_RID")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "diff_f")(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then "REAL_DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then "derivative_add")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then "derivative_const")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "derivative_x")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac)); +];; +(add_section_type (mk_var ("f", (`:real^N->real`))));; + +(* Lemma partial_increasing_left *) +let partial_increasing_left = section_proof ["f";"j";"u";"x";"z";"lo"] +`(!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = z$i) ==> + u$j = x$j ==> + (!y. y IN interval [x,z] ==> (lift o f) differentiable at y) ==> + (!y. y IN interval [x,z] ==> &0 <= partial j f y) ==> + (!y. y IN interval [x,u] ==> lo <= f y) ==> + (!y. y IN interval [x,z] ==> lo <= f y)` +[ + (((((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] [])))))) THEN (move ["uz_eq"]) THEN (move ["ux_eq"]) THEN (move ["diff_f"]) THEN (move ["partial_pos"]) THEN (move ["f_bound"]) THEN (move ["y"]) THEN (move ["y_in"])); + ((((use_arg_then "partial_pos") (disch_tac [])) THEN (clear_assumption "partial_pos") THEN ((use_arg_then "diff_f") (disch_tac [])) THEN (clear_assumption "diff_f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["diff_f"]) THEN (move ["partial_pos"]))); + ((fun arg_tac -> arg_tac (Arg_term (`(lambda i. if i = j then x$j else y$i):real^N`))) (term_tac (set_tac "y'"))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`f y' <= f y`))) (term_tac (have_gen_tac []ALL_TAC)))); + ((((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "f_bound") (disch_tac [])) THEN (clear_assumption "f_bound") THEN (DISCH_THEN apply_tac) THEN (move ["i"]) THEN (move ["i_in"]))); + ((((use_arg_then "y'_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); + ((THENL_FIRST) (((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i = j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ij"])) (((((use_arg_then "ux_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then "uz_eq")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "y_in")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`j IN 1..dimindex (:N)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case)) THEN ((((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (move ["j_in"]))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`y' = y`))) (term_tac (have_gen_tac []ALL_TAC)))) ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then "CART_EQ")(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["i_in"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(i = j)`))) (term_tac (have_gen_tac [](move ["inj"])))) ((((use_arg_then "i_in") (disch_tac [])) THEN (clear_assumption "i_in") THEN ((use_arg_then "j_in") (disch_tac [])) THEN (clear_assumption "j_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then "y'_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`f o (\t. y' + t % basis j)`))) (term_tac (set_tac "g"))); + ((fun arg_tac -> arg_tac (Arg_term (`f y' = g (&0)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`f y = g (y$j - x$j)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (AP_TERM_TAC)); + ((((use_arg_then "CART_EQ")(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["i_in"])); + ((((use_arg_then "VECTOR_ADD_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_MUL_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "BASIS_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i = j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ij"])) THEN ((((use_arg_then "y'_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((arith_tac) THEN (done_tac)); + (((simp_tac) THEN (((use_arg_then "ij")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`real_interval [&0, y$j - x$j]`))) (term_tac (set_tac "s"))); + ((fun arg_tac -> arg_tac (Arg_term (`!t. t IN s ==> y' + t % basis j IN interval [x,z]`))) (term_tac (have_gen_tac [](move ["in_s"])))); + (((((use_arg_then "s_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] []))))) THEN (move ["t"]) THEN (move ["t_ineq"]) THEN (move ["i"]) THEN (move ["i_ineq"])); + ((repeat_tactic 1 9 (((use_arg_then "VECTOR_ADD_COMPONENT")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "VECTOR_MUL_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "BASIS_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then "y'_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); + ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i = j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ij"]))); + (((((use_arg_then "REAL_MUL_RZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "y_in")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then "t_ineq") (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((fun arg_tac -> (use_arg_then "y_in") (fun fst_arg -> (use_arg_then "i_ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then "ij")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!t. t IN s ==> (g has_real_derivative (partial j f (y' + t % basis j))) (atreal t within s)`))) (term_tac (have_gen_tac [](move ["ds"])))); + ((BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "in_s") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["p_in"])) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_ATREAL_WITHIN") (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_ATREAL_WITHIN") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "partial")(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`f o _`))) (term_tac (set_tac "h"))); + ((fun arg_tac -> arg_tac (Arg_term (`h = g o (\t'. t + t')`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "h_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["r"])) THEN ((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_RDISTRIB)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_ASSOC)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then "derivative_translation")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "diff_imp_real_diff")(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then "diff_f")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then "diff_direction")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 <= y$j - x$j`))) (term_tac (have_gen_tac [](move ["pos"])))) ((((fun arg_tac -> (use_arg_then "y_in") (fun fst_arg -> (use_arg_then "j_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "HAS_REAL_DERIVATIVE_INCREASING_IMP") (fun fst_arg -> (use_arg_then "g") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`\t. partial j f (y' + t % basis j)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "s") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y$j - x$j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then "s_def")(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then "IS_REALINTERVAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((((use_arg_then "ds")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then "s_def")(gsym_then (thm_tac (new_rewrite [2; 3] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "pos")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "in_s") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "partial_pos") (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Lemma partial_decreasing_left *) +let partial_decreasing_left = section_proof ["f";"j";"u";"x";"z";"hi"] +`(!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = z$i) ==> + u$j = x$j ==> + (!y. y IN interval [x,z] ==> (lift o f) differentiable at y) ==> + (!y. y IN interval [x,z] ==> partial j f y <= &0) ==> + (!y. y IN interval [x,u] ==> f y <= hi) ==> + (!y. y IN interval [x,z] ==> f y <= hi)` +[ + (BETA_TAC THEN (move ["u_eq_i"]) THEN (move ["u_eq_j"]) THEN (move ["diff_f"]) THEN (move ["partial_f"]) THEN (move ["f_bound"]) THEN (move ["y"]) THEN (move ["y_in"])); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "partial_increasing_left") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(\p. -- f p)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "j") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "u") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "x") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "z") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`--hi`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "u_eq_i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "u_eq_j") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((THENL_FIRST) (ANTS_TAC) ((BETA_TAC THEN (move ["p"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "diff_f") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "DIFFERENTIABLE_NEG") (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then "f_lift_neg")(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (ANTS_TAC); + ((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])) THEN ((((use_arg_then "partial_neg")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "diff_f")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_NEG_GE0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "partial_f")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) (ANTS_TAC) ((BETA_TAC THEN (move ["p"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "f_bound") (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (arith_tac) THEN (done_tac))); + ((((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "y_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma partial_translation *) +let partial_translation = section_proof ["f";"i";"p";"y"] +`lift o f differentiable at (p + y) ==> + partial i (f o (\x. p + x)) y = partial i f (p + y)` +[ + (BETA_TAC THEN (move ["diff"])); + ((fun arg_tac -> arg_tac (Arg_term (`!net. (\x. p + x) differentiable net`))) (term_tac (have_gen_tac [](move ["diff_p"])))); + ((BETA_TAC THEN (move ["net"])) THEN ((((use_arg_then "DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "partial_eq_frechet")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 1 (((use_arg_then "o_ASSOC")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_CHAIN_AT")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then "frechet_compose")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "frechet_add")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then "frechet_const")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "frechet_id")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_ADD_LID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "I_DEF")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "I_O_ID")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "partial_eq_frechet")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma partial_rev_translation *) +let partial_rev_translation = section_proof ["f";"i";"p";"y"] +`lift o f differentiable at (p - y) ==> + partial i (f o (\x. p - x)) y = --partial i f (p - y)` +[ + (BETA_TAC THEN (move ["diff"])); + ((fun arg_tac -> arg_tac (Arg_term (`!net. (\x. p - x) differentiable net`))) (term_tac (have_gen_tac [](move ["diff_p"])))); + ((BETA_TAC THEN (move ["net"])) THEN ((((use_arg_then "DIFFERENTIABLE_SUB")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "partial_eq_frechet")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 1 (((use_arg_then "o_ASSOC")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_CHAIN_AT")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then "frechet_compose")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "frechet_sub")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then "frechet_const")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "frechet_id")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_LZERO)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "partial_eq_frechet")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + (((((use_arg_then "LINEAR_NEG")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "LINEAR_FRECHET_DERIVATIVE")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "DROP_NEG")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma partial_increasing_right *) +let partial_increasing_right = section_proof ["f";"j";"u";"x";"z";"hi"] +`(!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = x$i) ==> + u$j = z$j ==> + (!y. y IN interval [x,z] ==> (lift o f) differentiable at y) ==> + (!y. y IN interval [x,z] ==> &0 <= partial j f y) ==> + (!y. y IN interval [u,z] ==> f y <= hi) ==> + (!y. y IN interval [x,z] ==> f y <= hi)` +[ + (BETA_TAC THEN (move ["u_eq_i"]) THEN (move ["u_eq_j"]) THEN (move ["diff_f"]) THEN (move ["partial_f"]) THEN (move ["f_bound"]) THEN (move ["y"]) THEN (move ["y_in"])); + (((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`j IN 1..dimindex (:N)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case)) THEN ((((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (move ["j_in"]))); + ((((use_arg_then "f_bound") (disch_tac [])) THEN (clear_assumption "f_bound") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "y_in") (disch_tac [])) THEN (clear_assumption "y_in") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] []))))) THEN (move ["y_ineq"]) THEN (move ["i"]) THEN (move ["i_in"]))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(i = j)`))) (term_tac (have_gen_tac [](move ["inj"])))) ((((use_arg_then "i_in") (disch_tac [])) THEN (clear_assumption "i_in") THEN ((use_arg_then "j_in") (disch_tac [])) THEN (clear_assumption "j_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then "u_eq_i")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "y_ineq")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "partial_decreasing_left") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f o (\p:real^N. x + (z - p))`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "j") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x + (z - u):real^N`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "x") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "z") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "hi") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (ANTS_TAC); + ((BETA_TAC THEN (move ["i"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "u_eq_i") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["eq1"]) THEN (move ["inj"])) THEN ((((use_arg_then "VECTOR_ADD_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_SUB_COMPONENT")(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then "eq1")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) (ANTS_TAC) (((((use_arg_then "VECTOR_ADD_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_SUB_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "u_eq_j")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`!p. p IN interval [x,z] ==> x + (z - p) IN interval [x,z]`))) (term_tac (have_gen_tac [](move ["Hp"])))); + ((BETA_TAC THEN (move ["p"])) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] []))))) THEN (move ["p_in"]) THEN (move ["i"]) THEN (move ["ineq"]))); + ((((fun arg_tac -> (use_arg_then "p_in") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then "VECTOR_ADD_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_SUB_COMPONENT")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!y. _ y`))) (term_tac (set_tac "dP"))); + ((fun arg_tac -> arg_tac (Arg_term (`dP`))) (term_tac (have_gen_tac [](move ["P"])))); + ((((use_arg_then "dP_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (BETA_TAC THEN (move ["p"]) THEN (move ["p_in"]))); + (((((use_arg_then "o_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_CHAIN_AT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_SUB")(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "diff_f")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then "Hp")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "P") (disch_tac [])) THEN (clear_assumption "P") THEN BETA_TAC THEN (simp_tac)) THEN ((((use_arg_then "dP_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["diff"]))); + (ANTS_TAC); + (BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])); + ((fun arg_tac -> arg_tac (Arg_theorem (VECTOR_ARITH `!x z p. x + z - p = (x + z) - p:real^N`))) (fun arg -> thm_tac MP_TAC arg THEN (move ["assoc"]))); + ((((use_arg_then "assoc")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "partial_rev_translation")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "assoc")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "diff_f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "Hp")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then "REAL_NEG_LE0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "partial_f")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "Hp")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (ANTS_TAC); + ((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])) THEN ((((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "f_bound")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "p_in") (disch_tac [])) THEN (clear_assumption "p_in") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] []))))) THEN (move ["ineq"]) THEN (move ["i"]) THEN (move ["i_ineq"]))); + ((((fun arg_tac -> (use_arg_then "ineq") (fun fst_arg -> (use_arg_then "i_ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "VECTOR_ADD_COMPONENT")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "VECTOR_SUB_COMPONENT")(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); + ((((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x + z - y:real^N`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC) THEN ((((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((((fun arg_tac -> arg_tac (Arg_theorem (VECTOR_ARITH `!x z y:real^N. x + z - (x + z - y) = y`)))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then "Hp")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section PartialMonotone *) +let derivative_translation = finalize_theorem derivative_translation;; +let partial_increasing_left = finalize_theorem partial_increasing_left;; +let partial_decreasing_left = finalize_theorem partial_decreasing_left;; +let partial_translation = finalize_theorem partial_translation;; +let partial_rev_translation = finalize_theorem partial_rev_translation;; +let partial_increasing_right = finalize_theorem partial_increasing_right;; +end_section "PartialMonotone";; + +(* Section Taylor *) +begin_section "Taylor";; + +(* Lemma real_taylor2_bound *) +let real_taylor2_bound = section_proof ["f";"dd_bound"] +`nth_diff_strong_int 2 (&0, &1) f ==> + (!t. interval_arith t (&0, &1) ==> abs (nth_derivative 2 f t) <= dd_bound) ==> + abs (f (&1) - (f (&0) + derivative f (&0))) <= dd_bound / &2` +[ + (((((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_diff_strong2_eq_alt")(thm_tac (new_rewrite [] []))))) THEN (move ["df"]) THEN (move ["dd"])); + ((fun arg_tac -> arg_tac (Arg_term (`\i. if i = 0 then f else if i = 1 then derivative f else nth_derivative 2 f`))) (term_tac (set_tac "R"))); + ((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `0 + 1 = 1 /\ ~(1 = 0) /\ 1 + 1 = 2 /\ ~(2 = 1) /\ ~(2 = 0)`))) (fun arg -> thm_tac MP_TAC arg THEN (move ["arithH"]))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "REAL_TAYLOR") (fun fst_arg -> (use_arg_then "R") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`real_interval [&0, &1]`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "dd_bound") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)); + (((((use_arg_then "IS_REALINTERVAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((BETA_TAC THEN (move ["i"]) THEN (move ["x"])) THEN ((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `i <= 1 <=> i = 0 \/ i = 1`)))(thm_tac (new_rewrite [] [])))))); + (BETA_TAC THEN (case THEN ALL_TAC) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "df") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["s"])) THEN (move ["d_f"])); + ((case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then "R_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "arithH")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ((use_arg_then "HAS_REAL_DERIVATIVE_ATREAL_WITHIN") (thm_tac apply_tac)) THEN (((use_arg_then "d_f")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((BETA_TAC THEN (move ["x"])) THEN (((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "arithH")(thm_tac (new_rewrite [] []))))) THEN (move ["ineq"]))); + ((((fun arg_tac -> (use_arg_then "df") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (move ["d_f"])) THEN ((((use_arg_then "R_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "arithH")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "dd")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> (fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_01")(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((((use_arg_then "REAL_SUB_RZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ABS_1")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_POW_ONE")(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `FACT (1 + 1) = 2`)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "real_div")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_LID")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "ONE")(thm_tac (new_rewrite [2] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL SUM_CLAUSES_NUMSEG)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUM_SING_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ONE")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `0 <= 1`)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `FACT 0 = 1 /\ FACT 1 = 1`)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_INV_1")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then "R_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "arithH")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma real_taylor1_bound *) +let real_taylor1_bound = section_proof ["f";"d_bound"] +`(!t. interval_arith t (&0, &1) ==> f real_differentiable atreal t /\ + abs (derivative f t) <= d_bound) ==> + abs (f (&1) - f (&0)) <= d_bound` +[ + (BETA_TAC THEN (move ["df"])); + ((fun arg_tac -> arg_tac (Arg_term (`\i. if i = 0 then f else derivative f`))) (term_tac (set_tac "R"))); + ((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `0 + 1 = 1 /\ ~(1 = 0)`))) (fun arg -> thm_tac MP_TAC arg THEN (move ["arithH"]))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "REAL_TAYLOR") (fun fst_arg -> (use_arg_then "R") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`real_interval [&0, &1]`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "d_bound") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)); + (((((use_arg_then "IS_REALINTERVAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((BETA_TAC THEN (move ["i"]) THEN (move ["x"])) THEN ((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "leqn0")(thm_tac (new_rewrite [] [])))))); + (BETA_TAC THEN (case THEN ALL_TAC) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "df") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN ((move ["diff_f"]) THEN (move ["df_bound"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((use_arg_then "R_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "arithH")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ((use_arg_then "HAS_REAL_DERIVATIVE_ATREAL_WITHIN") (thm_tac apply_tac)) THEN (((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((BETA_TAC THEN (move ["x"])) THEN (((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "arithH")(thm_tac (new_rewrite [] []))))) THEN (move ["ineq"]))); + ((((fun arg_tac -> (use_arg_then "df") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (move ["d_f"])) THEN ((((use_arg_then "R_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "arithH")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> (fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_01")(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((((use_arg_then "SUM_SING_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "REAL_SUB_RZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "arithH")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ABS_1")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_POW_ONE")(thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `FACT 1 = 1 /\ FACT 0 = 1`)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_DIV_1")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then "R_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "arithH")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; +let m_taylor_error = new_definition `m_taylor_error f domain (w:real^N) error <=> + !x:real^N. x IN interval [domain] ==> sum (1..dimindex (:N)) (\i. w$i * sum (1..dimindex (:N)) + (\j. w$j * abs (partial j (partial i f) x))) <= error`;; +let m_taylor_partial_error = new_definition `m_taylor_partial_error f i domain (w:real^N) error <=> + (!x:real^N. x IN interval[domain] ==> + sum (1..dimindex (:N)) (\j. w$j * abs (partial j (partial i f) x)) <= error)`;; + +(* Lemma taylor_error_eq_sum_partial_errors *) +let taylor_error_eq_sum_partial_errors = section_proof ["f";"domain";"w";"p_error";"error"] +`(!i. i IN 1..dimindex (:N) ==> m_taylor_partial_error f i domain w (p_error i) /\ &0 <= w$i) ==> + sum (1..dimindex (:N)) (\i. w$i * p_error i) <= error ==> + m_taylor_error f domain (w:real^N) error` +[ + (((((use_arg_then "m_taylor_partial_error")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "m_taylor_error")(thm_tac (new_rewrite [] []))))) THEN (move ["partialH"]) THEN (move ["ineq"]) THEN (move ["p"]) THEN (move ["p_in"])); + (((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((use_arg_then "SUM_LE") (thm_tac apply_tac)) THEN (((((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac))); + (((((use_arg_then "REAL_LE_LMUL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then "partialH") (fun fst_arg -> (use_arg_then "i_ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; +let partial2 = new_definition `partial2 j i f = partial j (partial i f)`;; +let diff2 = new_definition `diff2 f x <=> + ?s. open s /\ x IN s /\ (!y. y IN s ==> (lift o f) differentiable at y /\ + (!i. (lift o partial i f) differentiable at y))`;; +let diff2c = new_definition `diff2c f x <=> diff2 f x /\ + (!i j. (lift o partial2 j i f) continuous at x)`;; + +(* Lemma diff2c_imp_diff2 *) +let diff2c_imp_diff2 = section_proof ["f";"x"] +`diff2c f x ==> diff2 f x` +[ + (((((use_arg_then "diff2c")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma diff2_eq_diff2_on_open *) +let diff2_eq_diff2_on_open = section_proof ["f";"x"] +`diff2 f x <=> + ?s. open s /\ x IN s /\ (!y. y IN s ==> diff2 f y)` +[ + ((repeat_tactic 1 9 (((use_arg_then "diff2")(thm_tac (new_rewrite [] []))))) THEN ((split_tac) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]))); + (((use_arg_then "s") (term_tac exists_tac)) THEN (((((use_arg_then "open_s")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (move ["ys"])) THEN ((use_arg_then "s") (term_tac exists_tac)) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then "df") (fun fst_arg -> (use_arg_then "xs") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["df2"])) THEN (((use_arg_then "df") (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC THEN (move ["_"]))); + (((use_arg_then "t") (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma diff2_imp_real_diff *) +let diff2_imp_real_diff = section_proof ["f";"x";"e";"t"] +`diff2 f (x + t % e) ==> + f o (\t. x + t % e) real_differentiable atreal t` +[ + ((((use_arg_then "diff2")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])); + (((use_arg_then "diff_imp_real_diff") (thm_tac apply_tac)) THEN ((simp_tac) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "diff_direction")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_dir_derivative *) +let diff2_dir_derivative = section_proof ["f";"x";"e";"t"] +`diff2 f (x + t % e:real^N) ==> + derivative (f o (\t. x + t % e)) t = + sum (1..dimindex (:N)) (\i. e$i * (partial i f o (\t. x + t % e)) t)` +[ + ((((use_arg_then "diff2")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])); + ((((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then "real_dir_derivative_partial")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_partial_real_diff *) +let diff2_partial_real_diff = section_proof ["f";"i";"x";"e";"t"] +`diff2 f (x + t % e:real^N) ==> + partial i f o (\t. x + t % e) real_differentiable atreal t` +[ + ((((use_arg_then "diff2")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])); + (((((use_arg_then "diff_imp_real_diff")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "diff_direction")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma in_trans *) +let in_trans = section_proof ["x";"s";"t"] +`t SUBSET s ==> x IN t ==> x IN s` +[ + ((((use_arg_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (move ["sub"]) THEN (move ["xt"])); + (((use_arg_then "sub") (disch_tac [])) THEN (clear_assumption "sub") THEN (exact_tac)); +];; + +(* Lemma open_contains_open_interval *) +let open_contains_open_interval = section_proof ["e";"s";"x"] +`open s ==> x IN s ==> + ?a b. &0 IN real_interval (a, b) /\ IMAGE (\t. x + t % e) (real_interval (a, b)) SUBSET s` +[ + ((((use_arg_then "OPEN_CONTAINS_BALL")(thm_tac (new_rewrite [] [])))) THEN (move ["open_s"])); + (((DISCH_THEN (fun snd_th -> (use_arg_then "open_s") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["ball_s"])) THEN (((use_arg_then "open_s") (disch_tac [])) THEN (clear_assumption "open_s") THEN BETA_TAC THEN (move ["_"]))); + ((THENL) (((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`norm e = &0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [ALL_TAC; (move ["n0"])]); + (((((use_arg_then "NORM_EQ_0")(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_term (`--d`))) (term_tac exists_tac)) THEN ((use_arg_then "d") (term_tac exists_tac)))); + ((THENL_FIRST) (split_tac) ((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((((use_arg_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_IMAGE")(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (case THEN (move ["t"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_MUL_RZERO)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] [])))))); + (((((fun arg_tac -> (use_arg_then "in_trans") (fun fst_arg -> (use_arg_then "ball_s") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "CENTRE_IN_BALL")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`((d / &2) * inv(norm e)) % e`))) (term_tac (set_tac "y"))); + ((fun arg_tac -> arg_tac (Arg_term (`norm y = d / &2`))) (term_tac (have_gen_tac [](move ["norm_y"])))); + ((((use_arg_then "y_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "VECTOR_MUL_ASSOC")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "NORM_MUL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_ABS_INV")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ABS_NORM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_LINV")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((fun arg_tac -> arg_tac (Arg_term (`-- (d / &2 * inv (norm e))`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`d / &2 * inv (norm e)`))) (term_tac exists_tac))) THEN (split_tac)); + ((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_NEG_LT0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbb")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LT_MUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LT_INV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "NORM_POS_LT")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "NORM_EQ_0")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + ((((use_arg_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((use_arg_then "SUBSET_TRANS") (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`ball (x, d)`))) (term_tac exists_tac)) THEN (((((use_arg_then "ball_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_IMAGE")(thm_tac (new_rewrite [] []))))) THEN (move ["p"]) THEN (case THEN (move ["t"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["t_in"]) THEN (simp_tac))); + ((((use_arg_then "IN_BALL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "dist")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_SUB_RADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "NORM_NEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "NORM_MUL")(thm_tac (new_rewrite [] []))))); + ((THENL_LAST) ((((use_arg_then "REAL_LET_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`d / &2`))) (term_tac exists_tac)) THEN (split_tac)) ((((use_arg_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then "REAL_MUL_RID") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`d / &2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then "REAL_MUL_LINV") (fun fst_arg -> (use_arg_then "n0") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_MUL_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_RMUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "NORM_POS_LE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "t_in") (disch_tac [])) THEN (clear_assumption "t_in") THEN BETA_TAC) THEN (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma diff2_dir *) +let diff2_dir = section_proof ["f";"x";"e";"t"] +`diff2 f (x + t % e:real^N) ==> + nth_diff_strong 2 (f o (\t. x + t % e)) t` +[ + (((((use_arg_then "diff2_eq_diff2_on_open")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_diff_strong2_eq")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "open_contains_open_interval") (fun fst_arg -> (use_arg_then "e") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "open_s") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "xs") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN (move ["in0"])) THEN (move ["sub"])); + (((fun arg_tac -> arg_tac (Arg_term (`real_interval (a + t, b + t)`))) (term_tac exists_tac)) THEN ((((use_arg_then "REAL_OPEN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((((use_arg_then "in0") (disch_tac [])) THEN (clear_assumption "in0") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + (BETA_TAC THEN (move ["p"]) THEN (move ["p_int"])); + ((fun arg_tac -> arg_tac (Arg_term (`x + p % e IN s`))) (term_tac (have_gen_tac [](move ["xp_in"])))); + ((((use_arg_then "sub") (disch_tac [])) THEN (clear_assumption "sub") THEN BETA_TAC) THEN (((use_arg_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN ((((use_arg_then "IN_IMAGE")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`p - t`))) (term_tac exists_tac))); + (((THENL) (split_tac) [(VECTOR_ARITH_TAC); ((((use_arg_then "p_int") (disch_tac [])) THEN (clear_assumption "p_int") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (arith_tac))]) THEN (done_tac)); + ((((use_arg_then "diff2_imp_real_diff")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))); + ((use_arg_then "differentiable_local") (thm_tac apply_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`\t. sum (1..dimindex(:N)) (\i. e$i * (partial i f o (\t. x + t % e)) t)`))) (term_tac exists_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`min (p - (a + t)) (b + t - p)`))) (term_tac (set_tac "d"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < d`))) (term_tac (have_gen_tac [](move ["d0"])))) ((((use_arg_then "p_int") (disch_tac [])) THEN (clear_assumption "p_int") THEN BETA_TAC) THEN ((((use_arg_then "d_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`real_interval (p - d, p + d)`))) (term_tac exists_tac)) THEN (split_tac)); + ((((use_arg_then "differentiable_sum_numseg")(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac)); + (((((use_arg_then "REAL_DIFFERENTIABLE_MUL_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); + (((((use_arg_then "diff2_partial_real_diff")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then "REAL_OPEN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((BETA_TAC THEN (move ["y"]) THEN (move ["y_in"])) THEN ((((use_arg_then "diff2_dir_derivative")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "sub") (disch_tac [])) THEN (clear_assumption "sub") THEN BETA_TAC) THEN (((use_arg_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN ((((use_arg_then "IN_IMAGE")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`y - t`))) (term_tac exists_tac))); + ((THENL_FIRST) (split_tac) ((VECTOR_ARITH_TAC) THEN (done_tac))); + ((((use_arg_then "p_int") (disch_tac [])) THEN (clear_assumption "p_int") THEN ((use_arg_then "d_def") (disch_tac [])) THEN (clear_assumption "d_def") THEN ((use_arg_then "y_in") (disch_tac [])) THEN (clear_assumption "y_in") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma diff2_dir_derivative2 *) +let diff2_dir_derivative2 = section_proof ["f";"x";"e";"t"] +`diff2 f (x + t % e:real^N) ==> + nth_derivative 2 (f o (\t. x + t % e)) t = + sum (1..dimindex (:N)) (\i. sum (1..dimindex (:N)) + (\j. e$i * e$j * (partial j (partial i f) o (\t. x + t % e)) t))` +[ + ((((use_arg_then "diff2_eq_diff2_on_open")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])); + ((((use_arg_then "nth_derivative2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac))); + (((use_arg_then "HAS_REAL_DERIVATIVE_LOCAL") (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`\t. sum (1..dimindex(:N)) (\i. e$i * (partial i f o (\t. x + t % e)) t)`))) (term_tac exists_tac)) THEN (split_tac)); + (((use_arg_then "HAS_REAL_DERIVATIVE_SUM") (thm_tac apply_tac)) THEN (((((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac))); + (((((use_arg_then "SUM_LMUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_LMUL_ATREAL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); + (((use_arg_then "real_dir_derivative_partial")(thm_tac (new_rewrite [] [])))); + ((((fun arg_tac -> (use_arg_then "df") (fun fst_arg -> (use_arg_then "xs") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then "diff2")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["r"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xr"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "open_contains_open_interval") (fun fst_arg -> (use_arg_then "e") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "open_s") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "xs") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN (move ["in0"])) THEN (move ["sub"])); + (((fun arg_tac -> arg_tac (Arg_term (`real_interval (a + t, b + t)`))) (term_tac exists_tac)) THEN ((((use_arg_then "REAL_OPEN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((((use_arg_then "in0") (disch_tac [])) THEN (clear_assumption "in0") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])) THEN ((((use_arg_then "diff2_dir_derivative")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "sub") (disch_tac [])) THEN (clear_assumption "sub") THEN BETA_TAC) THEN (((use_arg_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN ((((use_arg_then "IN_IMAGE")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`p - t`))) (term_tac exists_tac))); + ((THENL_FIRST) (split_tac) ((VECTOR_ARITH_TAC) THEN (done_tac))); + ((((use_arg_then "p_in") (disch_tac [])) THEN (clear_assumption "p_in") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma diff2_has_derivative_partial *) +let diff2_has_derivative_partial = section_proof ["f";"i";"x";"e";"t"] +`diff2 f (x + t % e:real^N) ==> + (partial i f o (\t. x + t % e) has_real_derivative + sum (1..dimindex (:N)) (\j. e$j * (partial j (partial i f) o (\t. x + t % e)) t)) (atreal t)` +[ + ((((use_arg_then "diff2")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])); + (((((use_arg_then "real_dir_derivative_partial")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_derivative_partial *) +let diff2_derivative_partial = section_proof ["f";"i";"x";"e";"t"] +`diff2 f (x + t % e:real^N) ==> + derivative (partial i f o (\t. x + t % e)) t = + sum (1..dimindex (:N)) (\j. e$j * (partial j (partial i f) o (\t. x + t % e)) t)` +[ + ((BETA_TAC THEN (move ["df"])) THEN (((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "diff2_has_derivative_partial") (disch_tac [])) THEN (clear_assumption "diff2_has_derivative_partial") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma diff2_real_diff_partial *) +let diff2_real_diff_partial = section_proof ["f";"i";"x";"e";"t"] +`diff2 f (x + t % e:real^N) ==> + partial i f o (\t. x + t % e) real_differentiable atreal t` +[ + (BETA_TAC THEN (move ["df2"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "diff2_has_derivative_partial") (fun fst_arg -> (use_arg_then "df2") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s")))); + (((((use_arg_then "real_differentiable")(thm_tac (new_rewrite [] [])))) THEN (move ["df"])) THEN ((use_arg_then "s") (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma partial_const *) +let partial_const = section_proof ["i";"c"] +`partial i (\x:real^N. c) = (\x. &0)` +[ + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "partial")(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (simp_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`(\x. c) o (\t. x + t % basis i) = (\x. c)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + ((((use_arg_then "derivative_const")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma partial_eq0_alt *) +let partial_eq0_alt = section_proof ["i";"f"] +`~(i IN 1..dimindex (:N)) ==> partial i f = (\x:real^N. &0)` +[ + ((BETA_TAC THEN (move ["ih"])) THEN ((((use_arg_then "FUN_EQ_THM")(thm_tac (new_rewrite [] [])))) THEN (move ["x"])) THEN (((use_arg_then "partial_eq0")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma real_mvt0 *) +let real_mvt0 = section_proof [] +`!f f' a. (!x. abs x <= abs a ==> (f has_real_derivative f' x) (atreal x)) ==> + (?t. abs t <= abs a /\ f a - f (&0) = f' t * a)` +[ + (BETA_TAC THEN (move ["f"]) THEN (move ["f'"]) THEN (move ["a"]) THEN (move ["h"])); + (((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0 <= a`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["a_ineq"])); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "REAL_MVT_VERY_SIMPLE") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "f'") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "a") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then "a_ineq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))))) THEN (ANTS_TAC)); + (BETA_TAC THEN (move ["x"]) THEN (move ["x_ineq"])); + (((((use_arg_then "HAS_REAL_DERIVATIVE_ATREAL_WITHIN")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "h")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "x_ineq") (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["t_ineq"])) THEN (move ["eq"])); + (((use_arg_then "t") (term_tac exists_tac)) THEN (((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "t_ineq") (disch_tac [])) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "REAL_MVT_VERY_SIMPLE") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "f'") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "a") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (ANTS_TAC)); + ((THENL_FIRST) (split_tac) ((((use_arg_then "a_ineq") (disch_tac [])) THEN (clear_assumption "a_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((BETA_TAC THEN (move ["x"]) THEN (move ["x_ineq"])) THEN ((((use_arg_then "HAS_REAL_DERIVATIVE_ATREAL_WITHIN")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "h")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "x_ineq") (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["t_ineq"])) THEN (move ["eq"])); + (((use_arg_then "t") (term_tac exists_tac)) THEN ((((use_arg_then "REAL_NEG_SUB")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_NEG_RMUL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "t_ineq") (disch_tac [])) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma mixed_second_partials *) +let mixed_second_partials = section_proof ["f";"x";"i";"j"] +`diff2c f x ==> partial2 i j f x = partial2 j i f (x:real^N)` +[ + (((((use_arg_then "diff2c")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "partial2")(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN ((move ["d2f"]) THEN (move ["pc"])))); + ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i IN 1..dimindex (:N)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["ih"]))); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then "partial_eq0_alt") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "partial_const")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`j IN 1..dimindex (:N)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["jh"]))); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then "partial_eq0_alt") (fun fst_arg -> (use_arg_then "j") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "partial_const")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "jh") (disch_tac [])) THEN (clear_assumption "jh") THEN ((use_arg_then "ih") (disch_tac [])) THEN (clear_assumption "ih") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (move ["ih"]) THEN (move ["jh"]))); + ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then "diff2_eq_diff2_on_open")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["d2f"]))); + ((fun arg_tac -> arg_tac (Arg_term (`\h k. f ((x + k % basis j) + h % basis i) - f (x + k % basis j)`))) (term_tac (set_tac "F1"))); + ((fun arg_tac -> arg_tac (Arg_term (`\k h. f ((x + h % basis i) + k % basis j) - f (x + h % basis i)`))) (term_tac (set_tac "F2"))); + ((fun arg_tac -> arg_tac (Arg_term (`\h k. F1 h k - F1 h (&0)`))) (term_tac (set_tac "G"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`!h k. (x + k % basis j) + h % basis i = (x + h % basis i) + k % basis j`))) (term_tac (have_gen_tac [](move ["v_eq"])))) ((VECTOR_ARITH_TAC) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`G = \h k. F2 k h - F2 k (&0)`))) (term_tac (have_gen_tac [](move ["G_eq"])))); + ((repeat_tactic 2 0 (((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["h"]) THEN (move ["k"])); + (((((use_arg_then "G_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "F2_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "F1_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "v_eq")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`?r. &0 < r /\ (!h k. abs h <= r /\ abs k <= r ==> (x + h % basis i) + k % basis j IN s)`))) (term_tac (have_gen_tac [](case THEN ((move ["r"]) THEN (case THEN ((move ["r0"]) THEN (move ["rs"])))))))); + ((((use_arg_then "open_s") (disch_tac [])) THEN (clear_assumption "open_s") THEN BETA_TAC) THEN (((((use_arg_then "OPEN_CONTAINS_BALL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_BALL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "dist")(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "xs") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (case THEN (move ["e"])) THEN (case THEN ((move ["e0"]) THEN (move ["de"]))))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`e / &3`))) (term_tac exists_tac)) THEN (split_tac)) ((((use_arg_then "e0") (disch_tac [])) THEN (clear_assumption "e0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])); + ((((use_arg_then "de")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_ASSOC)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "VECTOR_SUB_RADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "NORM_NEG")(thm_tac (new_rewrite [] []))))); + ((THENL_LAST) ((((use_arg_then "REAL_LET_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`e / &3 + e / &3`))) (term_tac exists_tac)) THEN (split_tac)) ((((use_arg_then "e0") (disch_tac [])) THEN (clear_assumption "e0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_LAST) ((((use_arg_then "REAL_LE_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`abs h + abs k`))) (term_tac exists_tac)) THEN (split_tac)) ((((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then "NORM_TRIANGLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`h % basis i:real^N`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`k % basis j:real^N`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((repeat_tactic 1 9 (((use_arg_then "NORM_MUL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "NORM_BASIS")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(!h. abs h <= r ==> x + h % basis i IN s) /\ (!k. abs k <= r ==> x + k % basis j IN s)`))) (term_tac (have_gen_tac [](move ["in_s"])))); + ((THENL) (split_tac) [((move ["h"]) THEN (move ["h_ineq"])); ((move ["k"]) THEN (move ["k_ineq"]))]); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "rs") (fun fst_arg -> (use_arg_then "h") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "h_ineq")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "r0") (disch_tac [])) THEN (clear_assumption "r0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "rs") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "k") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "k_ineq")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "r0") (disch_tac [])) THEN (clear_assumption "r0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!h. F1 h = (\k. (f o (\k. (x + h % basis i) + k % basis j)) k - (f o (\k. x + k % basis j)) k)`))) (term_tac (have_gen_tac [](move ["F1h"])))); + (((((use_arg_then "F1_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "v_eq")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!h. abs h <= r ==> !k. abs k <= r ==> (F1 h) real_differentiable atreal k`))) (term_tac (have_gen_tac [](move ["dF1"])))); + (BETA_TAC THEN (move ["h"]) THEN (move ["h_ineq"]) THEN (move ["k"]) THEN (move ["k_ineq"])); + (((((use_arg_then "F1h")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_SUB")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); + (((repeat_tactic 1 9 (((use_arg_then "diff2_imp_real_diff")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "rs")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "in_s")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==> + derivative (F1 h) k = partial j f ((x + h % basis i) + k % basis j) - partial j f (x + k % basis j)`))) (term_tac (have_gen_tac [](move ["F1_der"])))); + ((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])) THEN ((((use_arg_then "F1h")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "derivative_sub")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((use_arg_then "diff2_imp_real_diff")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "rs")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "in_s")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then "derivative_translation")(thm_tac (new_rewrite [] [(`derivative (f o (\k. x + k % basis j)) k`)])))) THEN (repeat_tactic 0 1 (((use_arg_then "derivative_translation")(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 0 10 (((use_arg_then "diff2_imp_real_diff")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "rs")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "in_s")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((fun arg_tac -> arg_tac (Arg_term (`!y e. (f o (\k. y + k % e)) o (\t. k + t) = f o (\t. (y + k % e) + t % e)`))) (term_tac (have_gen_tac [](move ["eq"])))); + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_RDISTRIB)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_ASSOC)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then "eq")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "partial")(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==> + (?t1. G h k = k * derivative (F1 h) t1 /\ abs t1 <= abs k)`))) (term_tac (have_gen_tac [](move ["Gh"])))); + ((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])) THEN ((((use_arg_then "G_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "real_mvt0") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`F1 h`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative (F1 h)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "k") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (ANTS_TAC); + ((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN ((((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "dF1")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "t_ineq") (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["t1"])) THEN (case THEN (move ["t1_ineq"])) THEN (move ["eq"])); + (((use_arg_then "t1") (term_tac exists_tac)) THEN (((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then "t1_ineq") (disch_tac [])) THEN (clear_assumption "t1_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==> + (?t1 t2. G h k = h * k * partial i (partial j f) (x + t1 % basis j + t2 % basis i) + /\ abs t1 <= abs k /\ abs t2 <= abs h)`))) (term_tac (have_gen_tac [](move ["Ghk"])))); + (BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "Gh") (fun fst_arg -> (use_arg_then "h") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "k") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then "ineq")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["t1"])) THEN (case THEN ((move ["eq"]) THEN (move ["t1k"]))))); + ((THENL) ((((use_arg_then "eq") (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN (((use_arg_then "F1_der")(thm_tac (new_rewrite [] []))))) [((((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then "t1k") (disch_tac [])) THEN (clear_assumption "t1k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); (BETA_TAC THEN (move ["eq"]))]); + ((fun arg_tac -> arg_tac (Arg_term (`partial j f o (\h. (x + t1 % basis j) + h % basis i)`))) (term_tac (set_tac "g"))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "real_mvt0") (fun fst_arg -> (use_arg_then "g") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative g`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "h") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (ANTS_TAC); + ((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN (((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "diff2_partial_real_diff")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "v_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "rs")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then "t_ineq") (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((use_arg_then "t1k") (disch_tac [])) THEN (clear_assumption "t1k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["t2"])) THEN (case THEN (move ["t2_ineq"])) THEN (move ["g_eq"])); + ((THENL_LAST) ((((use_arg_then "t1") (term_tac exists_tac)) THEN ((use_arg_then "t2") (term_tac exists_tac))) THEN (((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then "t2_ineq") (disch_tac [])) THEN (clear_assumption "t2_ineq") THEN ((use_arg_then "t1k") (disch_tac [])) THEN (clear_assumption "t1k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`_1 - _2`))) (term_tac (set_tac "p"))); + ((fun arg_tac -> arg_tac (Arg_term (`p = g h - g (&0)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "p_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "v_eq")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "g_eq")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. k * a * h = h * k * a`)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_ASSOC")(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then "REAL_EQ_MUL_LCANCEL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISJ2_TAC)); + (((use_arg_then "derivative_translation")(thm_tac (new_rewrite [] [])))); + (((((use_arg_then "diff2_partial_real_diff")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "v_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "rs")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then "t2_ineq") (disch_tac [])) THEN (clear_assumption "t2_ineq") THEN ((use_arg_then "t1k") (disch_tac [])) THEN (clear_assumption "t1k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then "partial")(thm_tac (new_rewrite [] [])))) THEN (AP_THM_TAC) THEN (AP_TERM_TAC)); + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_RDISTRIB)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_ASSOC)))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); + (((use_arg_then "F1_def") (disch_tac [])) THEN (clear_assumption "F1_def") THEN ((use_arg_then "G_def") (disch_tac [])) THEN (clear_assumption "G_def") THEN ((use_arg_then "F1h") (disch_tac [])) THEN (clear_assumption "F1h") THEN ((use_arg_then "dF1") (disch_tac [])) THEN (clear_assumption "dF1") THEN ((use_arg_then "F1_der") (disch_tac [])) THEN (clear_assumption "F1_der") THEN ((use_arg_then "Gh") (disch_tac [])) THEN (clear_assumption "Gh") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"])); + ((fun arg_tac -> arg_tac (Arg_term (`!k. F2 k = (\h. (f o (\h. (x + k % basis j) + h % basis i)) h - (f o (\h. x + h % basis i)) h)`))) (term_tac (have_gen_tac [](move ["F2h"])))); + (((((use_arg_then "F2_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "v_eq")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!k. abs k <= r ==> !h. abs h <= r ==> (F2 k) real_differentiable atreal h`))) (term_tac (have_gen_tac [](move ["dF2"])))); + (BETA_TAC THEN (move ["k"]) THEN (move ["k_ineq"]) THEN (move ["h"]) THEN (move ["h_ineq"])); + (((((use_arg_then "F2h")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_SUB")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); + (((repeat_tactic 1 9 (((use_arg_then "diff2_imp_real_diff")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "v_eq")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "rs")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "in_s")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==> + derivative (F2 k) h = partial i f ((x + k % basis j) + h % basis i) - partial i f (x + h % basis i)`))) (term_tac (have_gen_tac [](move ["F2_der"])))); + ((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])) THEN ((((use_arg_then "F2h")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "derivative_sub")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((use_arg_then "diff2_imp_real_diff")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "v_eq")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "rs")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "in_s")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then "v_eq")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "derivative_translation")(thm_tac (new_rewrite [] [(`derivative (f o (\h. x + h % basis i)) h`)])))) THEN (repeat_tactic 0 1 (((use_arg_then "derivative_translation")(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 0 10 (((use_arg_then "diff2_imp_real_diff")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "v_eq")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "rs")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "in_s")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "v_eq")(gsym_then (thm_tac (new_rewrite [] []))))))); + ((fun arg_tac -> arg_tac (Arg_term (`!y e. (f o (\h. y + h % e)) o (\t. h + t) = f o (\t. (y + h % e) + t % e)`))) (term_tac (have_gen_tac [](move ["eq"])))); + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_RDISTRIB)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_ASSOC)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then "eq")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "partial")(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==> + (?t3. G h k = h * derivative (F2 k) t3 /\ abs t3 <= abs h)`))) (term_tac (have_gen_tac [](move ["Gk"])))); + ((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])) THEN ((((use_arg_then "G_eq")(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "real_mvt0") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`F2 k`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative (F2 k)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "h") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (ANTS_TAC); + ((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN ((((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "dF2")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "t_ineq") (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["t3"])) THEN (case THEN (move ["t3_ineq"])) THEN (move ["eq"])); + (((use_arg_then "t3") (term_tac exists_tac)) THEN (((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then "t3_ineq") (disch_tac [])) THEN (clear_assumption "t3_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!h k. abs h <= r /\ abs k <= r ==> + (?t3 t4. G h k = h * k * partial j (partial i f) (x + t4 % basis j + t3 % basis i) + /\ abs t3 <= abs h /\ abs t4 <= abs k)`))) (term_tac (have_gen_tac [](move ["Gkh"])))); + (BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "Gk") (fun fst_arg -> (use_arg_then "h") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "k") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then "ineq")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["t3"])) THEN (case THEN ((move ["eq"]) THEN (move ["t3h"]))))); + ((THENL) ((((use_arg_then "eq") (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN (((use_arg_then "F2_der")(thm_tac (new_rewrite [] []))))) [((((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then "t3h") (disch_tac [])) THEN (clear_assumption "t3h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); (BETA_TAC THEN (move ["eq"]))]); + ((fun arg_tac -> arg_tac (Arg_term (`partial i f o (\k. (x + t3 % basis i) + k % basis j)`))) (term_tac (set_tac "g"))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "real_mvt0") (fun fst_arg -> (use_arg_then "g") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative g`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "k") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (ANTS_TAC); + ((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN (((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "diff2_partial_real_diff")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "rs")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then "t_ineq") (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((use_arg_then "t3h") (disch_tac [])) THEN (clear_assumption "t3h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["t4"])) THEN (case THEN (move ["t4_ineq"])) THEN (move ["g_eq"])); + ((THENL_LAST) ((((use_arg_then "t3") (term_tac exists_tac)) THEN ((use_arg_then "t4") (term_tac exists_tac))) THEN (((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then "t4_ineq") (disch_tac [])) THEN (clear_assumption "t4_ineq") THEN ((use_arg_then "t3h") (disch_tac [])) THEN (clear_assumption "t3h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`_1 - _2`))) (term_tac (set_tac "p"))); + ((fun arg_tac -> arg_tac (Arg_term (`p = g k - g (&0)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "p_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "v_eq")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "g_eq")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. h * a * k = h * k * a`)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_ASSOC")(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then "REAL_EQ_MUL_LCANCEL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISJ2_TAC)); + (((use_arg_then "derivative_translation")(thm_tac (new_rewrite [] [])))); + (((((use_arg_then "diff2_partial_real_diff")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "rs")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then "t4_ineq") (disch_tac [])) THEN (clear_assumption "t4_ineq") THEN ((use_arg_then "t3h") (disch_tac [])) THEN (clear_assumption "t3h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then "partial")(thm_tac (new_rewrite [] [])))) THEN (AP_THM_TAC) THEN (AP_TERM_TAC)); + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_RDISTRIB)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_ASSOC)))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (move ["y"])); + ((AP_TERM_TAC) THEN (VECTOR_ARITH_TAC) THEN (done_tac)); + (((use_arg_then "F2_def") (disch_tac [])) THEN (clear_assumption "F2_def") THEN ((use_arg_then "G_eq") (disch_tac [])) THEN (clear_assumption "G_eq") THEN ((use_arg_then "F2h") (disch_tac [])) THEN (clear_assumption "F2h") THEN ((use_arg_then "dF2") (disch_tac [])) THEN (clear_assumption "dF2") THEN ((use_arg_then "F2_der") (disch_tac [])) THEN (clear_assumption "F2_der") THEN ((use_arg_then "Gk") (disch_tac [])) THEN (clear_assumption "Gk") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"])); + ((fun arg_tac -> arg_tac (Arg_term (`(vec 0:real^2) limit_point_of {y | &0 < y$1 /\ &0 < y$2}`))) (term_tac (have_gen_tac [](move ["lim0"])))); + (((((use_arg_then "limit_point_of")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "OPEN_CONTAINS_BALL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_BALL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "dist")(thm_tac (new_rewrite [] []))))) THEN (move ["t"]) THEN (case THEN (move ["v0t"]))); + (((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "v0t") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC THEN (case THEN (move ["e"])) THEN (case THEN (move ["e0"])) THEN (move ["in_t"])); + ((fun arg_tac -> arg_tac (Arg_term (`e / &2 % (vec 1:real^2)`))) (term_tac (set_tac "y"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`!i. y$i = e / (&2)`))) (term_tac (have_gen_tac [](move ["yc"])))) (((((use_arg_then "y_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "VECTOR_MUL_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VEC_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < e / (&2)`))) (term_tac (have_gen_tac [](move ["ineq"])))) (((((use_arg_then "REAL_LT_DIV")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "e0")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`infnorm y = e / &2`))) (term_tac (have_gen_tac [](move ["inf_y"])))); + (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL INFNORM_2)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "yc")(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL (CONJUNCT2 REAL_MAX_ACI))))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ABS_REFL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_LT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ineq")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) (((use_arg_then "y") (term_tac exists_tac)) THEN (split_tac)) (((((use_arg_then "INFNORM_EQ_0")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "inf_y")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) (split_tac) (((((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then "y") (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then "yc")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ineq")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then "in_t")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LET_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`e * inv(&2) * sqrt(&2)`))) (term_tac exists_tac)) THEN (split_tac)); + ((((use_arg_then "REAL_LE_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`infnorm y * sqrt (&2)`))) (term_tac exists_tac)) THEN (split_tac)); + (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_MUL_AC)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "NORM_SUB")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_RZERO)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIMINDEX_2")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "NORM_LE_INFNORM")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then "inf_y")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "real_div")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_ASSOC")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then "REAL_MUL_RID") (fun fst_arg -> (use_arg_then "e") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then "REAL_LT_LMUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "e0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> (use_arg_then "REAL_MUL_LINV") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_LT_LMUL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_LT_INV")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (TRY ((arith_tac)))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&2 = sqrt (&2 * &2)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [2] []))))))) (((((use_arg_then "REAL_POW_2")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "POW_2_SQRT_ABS")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then "SQRT_MONO_LT")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`((\y:real^2. lift (G (y$1) (y$2) / (y$1 * y$2))) --> lift (partial j (partial i f) x)) + (at (vec 0) within {y | &0 < y$1 /\ &0 < y$2})`))) (term_tac (have_gen_tac [](move ["lim_ji"])))); + ((((use_arg_then "LIM_WITHIN")(thm_tac (new_rewrite [] [])))) THEN (move ["e"]) THEN (move ["e_gt0"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "pc") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "j") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL continuous_at)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "dist")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "e_gt0") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["e_ineq"]))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`min r (d / &2)`))) (term_tac exists_tac)) THEN (((use_arg_then "REAL_LT_MIN")(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((((use_arg_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN ((use_arg_then "r0") (disch_tac [])) THEN (clear_assumption "r0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_RZERO)))(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (move ["ineq"])); + ((fun arg_tac -> arg_tac (Arg_term (`&0 < abs (y$1) /\ &0 < abs (y$2)`))) (term_tac (have_gen_tac [](move ["y0"])))); + ((((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (((((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["z"])) THEN (case THEN (move ["z_ineq"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["_"]))); + ((((use_arg_then "z_ineq") (disch_tac [])) THEN (clear_assumption "z_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`abs (y$1) <= r /\ abs (y$2) <= r /\ abs (y$1) < d / &2 /\ abs (y$2) < d / &2`))) (term_tac (have_gen_tac [](move ["yr"])))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`infnorm y < min r (d / &2)`))) (term_tac (have_gen_tac []ALL_TAC)))) ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL INFNORM_2)))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then "REAL_LET_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`norm y`))) (term_tac exists_tac)) THEN (((use_arg_then "INFNORM_LE_NORM")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then "Gkh") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y$1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y$2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((repeat_tactic 1 9 (((use_arg_then "yr")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["t1"])) THEN (case THEN (move ["t2"])) THEN (case THEN (move ["G_eq"])) THEN (move ["t_ineq"])); + ((((use_arg_then "G_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_MUL_AC)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "real_div")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_ASSOC")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_MUL_RINV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "REAL_ENTIRE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "y0") (disch_tac [])) THEN (clear_assumption "y0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then "e_ineq") (disch_tac [])) THEN (clear_assumption "e_ineq") THEN (DISCH_THEN apply_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_SUB)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "REAL_LET_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`norm (t2 % basis j:real^N) + norm (t1 % basis i:real^N)`))) (term_tac exists_tac))); + ((((use_arg_then "NORM_TRIANGLE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "NORM_MUL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "NORM_BASIS")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "yr") (disch_tac [])) THEN (clear_assumption "yr") THEN ((use_arg_then "t_ineq") (disch_tac [])) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`((\y:real^2. lift (G (y$1) (y$2) / (y$1 * y$2))) --> lift (partial i (partial j f) x)) + (at (vec 0) within {y | &0 < y$1 /\ &0 < y$2})`))) (term_tac (have_gen_tac [](move ["lim_ij"])))); + ((((use_arg_then "LIM_WITHIN")(thm_tac (new_rewrite [] [])))) THEN (move ["e"]) THEN (move ["e_gt0"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "pc") (fun fst_arg -> (use_arg_then "j") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL continuous_at)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "dist")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "e_gt0") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["e_ineq"]))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`min r (d / &2)`))) (term_tac exists_tac)) THEN (((use_arg_then "REAL_LT_MIN")(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((((use_arg_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN ((use_arg_then "r0") (disch_tac [])) THEN (clear_assumption "r0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_RZERO)))(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (move ["ineq"])); + ((fun arg_tac -> arg_tac (Arg_term (`&0 < abs (y$1) /\ &0 < abs (y$2)`))) (term_tac (have_gen_tac [](move ["y0"])))); + ((((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (((((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["z"])) THEN (case THEN (move ["z_ineq"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["_"]))); + ((((use_arg_then "z_ineq") (disch_tac [])) THEN (clear_assumption "z_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`abs (y$1) <= r /\ abs (y$2) <= r /\ abs (y$1) < d / &2 /\ abs (y$2) < d / &2`))) (term_tac (have_gen_tac [](move ["yr"])))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`infnorm y < min r (d / &2)`))) (term_tac (have_gen_tac []ALL_TAC)))) ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL INFNORM_2)))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then "REAL_LET_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`norm y`))) (term_tac exists_tac)) THEN (((use_arg_then "INFNORM_LE_NORM")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then "Ghk") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y$1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y$2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((repeat_tactic 1 9 (((use_arg_then "yr")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["t1"])) THEN (case THEN (move ["t2"])) THEN (case THEN (move ["G_eq"])) THEN (move ["t_ineq"])); + ((((use_arg_then "G_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_MUL_AC)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "real_div")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_ASSOC")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_MUL_RINV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "REAL_ENTIRE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "y0") (disch_tac [])) THEN (clear_assumption "y0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then "e_ineq") (disch_tac [])) THEN (clear_assumption "e_ineq") THEN (DISCH_THEN apply_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_SUB)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "REAL_LET_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`norm (t1 % basis j:real^N) + norm (t2 % basis i:real^N)`))) (term_tac exists_tac))); + ((((use_arg_then "NORM_TRIANGLE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "NORM_MUL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "NORM_BASIS")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "yr") (disch_tac [])) THEN (clear_assumption "yr") THEN ((use_arg_then "t_ineq") (disch_tac [])) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then "LIFT_EQ")(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> (use_arg_then "LIM_UNIQUE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`at (vec 0:real^2) within {y:real^2 | &0 < y$1 /\ &0 < y$2}`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`\y:real^2. lift (G (y$1) (y$2) / (y$1 * y$2))`))) (term_tac exists_tac)); + (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL TRIVIAL_LIMIT_WITHIN)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "negbK")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "lim0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +let m_cell_domain = new_definition `m_cell_domain (x:real^N, z:real^N) (y:real^N) (w:real^N) <=> + !i. i IN 1..dimindex (:N) ==> x$i <= y$i /\ y$i <= z$i /\ max (y$i - x$i) (z$i - y$i) <= w$i`;; +let m_bounded_on_int = new_definition `m_bounded_on_int (f:real^N->real) domain f_bounds <=> + !x. x IN interval [domain] ==> interval_arith (f x) f_bounds`;; +let diff2_domain = new_definition `diff2_domain domain f <=> + !x. x IN interval [domain] ==> diff2 f x`;; +let diff2c_domain = new_definition `diff2c_domain domain f <=> + !x. x IN interval [domain] ==> diff2c f x`;; + +(* Lemma diff2c_domain_alt *) +let diff2c_domain_alt = section_proof ["f";"domain"] +`diff2c_domain domain f <=> diff2_domain domain f /\ + (!x. x IN interval [domain] ==> !i j. (lift o partial2 j i f) continuous at x)` +[ + (((((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2c")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [(move ["h1"]); ((case THEN ((move ["h1"]) THEN (move ["h2"]))) THEN (move ["x"]) THEN (move ["h3"]))])); + (((split_tac) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "h1") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (simp_tac)) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then "h1") (fun fst_arg -> (use_arg_then "h3") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then "h2") (fun fst_arg -> (use_arg_then "h3") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma y_in_domain *) +let y_in_domain = section_proof ["domain";"y";"w"] +`m_cell_domain domain y w ==> y IN interval [domain]` +[ + ((((use_arg_then "domain") (disch_tac [])) THEN (clear_assumption "domain") THEN case THEN (move ["x"]) THEN (move ["z"])) THEN (((((use_arg_then "m_cell_domain")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (move ["ineqs"]) THEN (move ["i"]))); + (((DISCH_THEN (fun snd_th -> (use_arg_then "ineqs") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma domain_width *) +let domain_width = section_proof ["p";"domain";"y";"w"] +`m_cell_domain domain y (w:real^N) ==> + p IN interval [domain] ==> + !i. i IN 1..dimindex (:N) ==> abs (p$i - y$i) <= w$i` +[ + ((((use_arg_then "domain") (disch_tac [])) THEN (clear_assumption "domain") THEN case THEN (move ["x"]) THEN (move ["z"])) THEN ((((use_arg_then "m_cell_domain")(thm_tac (new_rewrite [] [])))) THEN (move ["ineqs"]) THEN (move ["p_in"]) THEN (move ["i"]) THEN (move ["i_in"]))); + ((((fun arg_tac -> (use_arg_then "ineqs") (fun fst_arg -> (use_arg_then "i_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then "p_in") (disch_tac [])) THEN (clear_assumption "p_in") THEN BETA_TAC) THEN (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_NUMSEG")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "i_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma sum_swap1 *) +let sum_swap1 = section_proof ["g";"n"] +`sum (1..n) (\i. sum (i + 1..n) (\j. g i j)) = + sum (1..n) (\i. sum (1..i - 1) (\j. g j i))` +[ + ((repeat_tactic 1 9 (((use_arg_then "SUM_SUM_PRODUCT")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`{i, j | (1 <= i /\ i <= n) /\ i + 1 <= j /\ j <= n}`))) (term_tac (set_tac "s1"))); + ((fun arg_tac -> arg_tac (Arg_term (`{i, j | (1 <= i /\ i <= n) /\ 1 <= j /\ j <= i - 1}`))) (term_tac (set_tac "s2"))); + ((fun arg_tac -> arg_tac (Arg_term (`\(i,j):num#num. j, i`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`s1 = IMAGE f s2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((((use_arg_then "s1_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "s2_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "f_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "EXTENSION")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_IMAGE")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["p"])) THEN (split_tac)); + (BETA_TAC THEN (case THEN (move ["i"])) THEN (case THEN (move ["j"])) THEN (case THEN (move ["ineq"])) THEN (move ["p_eq"])); + (((fun arg_tac -> arg_tac (Arg_term (`j, i`))) (term_tac exists_tac)) THEN ((((use_arg_then "p_eq")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then "j") (term_tac exists_tac)) THEN ((use_arg_then "i") (term_tac exists_tac))) THEN (((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["p1"])) THEN (case THEN (move ["p_eq"])) THEN (case THEN (move ["i"])) THEN (case THEN (move ["j"])) THEN (case THEN (move ["ineq"])) THEN (move ["p1_eq"])); + ((((use_arg_then "j") (term_tac exists_tac)) THEN ((use_arg_then "i") (term_tac exists_tac))) THEN ((((use_arg_then "p_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "p1_eq")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(\(i,j). g j i) = (\(i,j). g i j) o f`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN case THEN (done_tac)); + (((use_arg_then "SUM_IMAGE") (thm_tac apply_tac)) THEN (case THEN (move ["i1"]) THEN (move ["j1"])) THEN (case THEN (move ["i2"]) THEN (move ["j2"]))); + ((((((use_arg_then "f_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "PAIR_EQ")(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac)); +];; + +(* Lemma m_taylor_error_eq *) +let m_taylor_error_eq = section_proof ["f";"domain";"w";"error"] +`diff2c_domain domain f ==> + (m_taylor_error f domain (w:real^N) error <=> + (!x. x IN interval [domain] ==> + sum (1..dimindex (:N)) (\i. w$i * (w$i * abs (partial2 i i f x) + + &2 * sum (1..i - 1) (\j. w$j * abs (partial2 j i f x)))) <= error))` +[ + (((((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "m_taylor_error")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"])); + ((fun arg_tac -> arg_tac (Arg_term (`!g1 g2. (!x. x IN interval [domain] ==> g1 x = g2 x) ==> + ((!x. x IN interval [domain] ==> g1 x <= error) <=> (!x. x IN interval [domain] ==> g2 x <= error))`))) (term_tac (have_gen_tac [](move ["eq"])))); + ((BETA_TAC THEN (move ["g1"]) THEN (move ["g2"]) THEN (move ["eq"])) THEN ((split_tac) THEN (move ["cond"]) THEN (move ["x"]) THEN (move ["Px"]))); + (((((use_arg_then "eq")(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "cond")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "cond")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then "eq") (disch_tac [])) THEN (clear_assumption "eq") THEN (DISCH_THEN apply_tac) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "d2f") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["d2fx"])); + ((fun arg_tac -> arg_tac (Arg_term (`\i j. w$i * w$j * abs (partial2 j i f x)`))) (term_tac (set_tac "g"))); + ((fun arg_tac -> arg_tac (Arg_term (`dimindex (:N)`))) (term_tac (set_tac "n"))); + ((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s1"))); + ((fun arg_tac -> arg_tac (Arg_term (`s1 = sum (1..n) (\i. sum (1..n) (\j. g i j))`))) (term_tac (have_gen_tac [](move ["s1_eq"])))); + ((((use_arg_then "s1_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "SUM_EQ") (thm_tac apply_tac)) THEN (move ["i"]) THEN (simp_tac) THEN (move ["i_in"]))); + (((((use_arg_then "SUM_LMUL")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "partial2")(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then "SUM_EQ") (thm_tac apply_tac)) THEN (done_tac)); + ((((use_arg_then "REAL_MUL_2")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_ADD_LDISTRIB")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "SUM_LMUL")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_ADD_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUM_ADD_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s2"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`s2 = sum (1..n) (\i. g i i + sum (1..i - 1) (\j. g i j))`))) (term_tac (have_gen_tac [](move ["s2_eq"])))) (((((use_arg_then "s2_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s3"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`s3 = sum (1..n) (\i. sum (1..i - 1) (\j. g i j))`))) (term_tac (have_gen_tac [](move ["s3_eq"])))) (((((use_arg_then "s3_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + (((use_arg_then "s3_def") (disch_tac [])) THEN (clear_assumption "s3_def") THEN ((use_arg_then "s2_def") (disch_tac [])) THEN (clear_assumption "s2_def") THEN ((use_arg_then "s1_def") (disch_tac [])) THEN (clear_assumption "s1_def") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"])); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`s3 = sum (1..n) (\i. sum (i + 1..n) (\j. g i j))`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + (((((use_arg_then "s2_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUM_ADD_NUMSEG")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "s1_eq")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "SUM_EQ") (thm_tac apply_tac)) THEN (move ["i"]) THEN (simp_tac)) THEN ((((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (move ["i_ineq"]))); + (((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c. (a + b) + c = (a + c) + b`)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then "SUM_SING_NUMSEG") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`g i`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); + ((THENL_FIRST) ((((use_arg_then "SUM_COMBINE_R")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "i_ineq")(thm_tac (new_rewrite [] [])))))) ((arith_tac) THEN (done_tac))); + (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_ADD_AC)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUM_COMBINE_L")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then "i_ineq") (disch_tac [])) THEN (clear_assumption "i_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then "s3_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "sum_swap1")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "SUM_EQ") (thm_tac apply_tac)) THEN (move ["i"]) THEN (move ["_"]) THEN (simp_tac)) THEN (((use_arg_then "SUM_EQ") (thm_tac apply_tac)) THEN (move ["j"]) THEN (move ["_"]) THEN (simp_tac))); + (((((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c. a * b * c = b * a * c`)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_EQ_MUL_LCANCEL")(thm_tac (new_rewrite [] [])))))) THEN (DISJ2_TAC) THEN (DISJ2_TAC)); + ((((use_arg_then "mixed_second_partials")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma diff2_derivative2_bound *) +let diff2_derivative2_bound = section_proof ["domain";"y";"w";"p";"f";"dd_bound"] +`m_cell_domain domain y (w:real^N) ==> + p IN interval [domain] ==> + diff2_domain domain f ==> + m_taylor_error f domain w dd_bound ==> + (!t. interval_arith t (&0, &1) ==> + abs (nth_derivative 2 (f o (\t. y + t % (p - y))) t) <= dd_bound)` +[ + (((((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "m_taylor_error")(thm_tac (new_rewrite [] []))))) THEN (move ["domainH"]) THEN (move ["p_in"]) THEN (move ["df"]) THEN (move ["boundedH"]) THEN (move ["t"]) THEN (move ["t_in"])); + ((fun arg_tac -> arg_tac (Arg_term (`y + t % (p - y) IN interval [domain]`))) (term_tac (have_gen_tac [](move ["pt_in"])))); + ((((fun arg_tac -> arg_tac (Arg_theorem (VECTOR_ARITH `y + t % (p - y) = (&1 - t) % y + t % p:real^N`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_CONVEX_SET")(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> (use_arg_then "y_in_domain") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "p_in")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "t_in")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "pair_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "CONVEX_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "diff2_dir_derivative2")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((fun arg_tac -> (use_arg_then "boundedH") (fun fst_arg -> (use_arg_then "pt_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC)); + (((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s1"))) THEN (((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s2"))) THEN (move ["i1"]))); + ((((use_arg_then "REAL_LE_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then "s1") (term_tac exists_tac)) THEN ((((use_arg_then "i1")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "s1_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "s2_def")(gsym_then (thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "SUM_ABS_LE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac)); + (((((use_arg_then "SUM_LMUL")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "SUM_ABS_LE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["j"]) THEN (move ["j_ineq"]) THEN (simp_tac)); + (((repeat_tactic 1 9 (((use_arg_then "REAL_ABS_MUL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_LE_MUL2")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_LE_MUL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_ABS_POS")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "VECTOR_SUB_COMPONENT")(thm_tac (new_rewrite [] []))))) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "domain_width") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "p_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma m_taylor_error_lemma *) +let m_taylor_error_lemma = section_proof ["domain";"y";"w";"p";"f";"dd_bound"] +`m_cell_domain domain y (w:real^N) ==> + p IN interval [domain] ==> + diff2_domain domain f ==> + m_taylor_error f domain w dd_bound ==> + abs (f p - (f y + sum (1..dimindex (:N)) (\i. (p - y)$i * partial i f y))) <= dd_bound / &2` +[ + ((((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))) THEN (BETA_TAC THEN (move ["domainH"]) THEN (move ["p_in"]) THEN (move ["df"]) THEN (move ["taylor_error"]))); + ((fun arg_tac -> arg_tac (Arg_term (`!t. interval_arith t (&0, &1) ==> y + t % (p - y) IN interval [domain]`))) (term_tac (have_gen_tac [](move ["pt_in"])))); + ((BETA_TAC THEN (move ["t"]) THEN (move ["t_in"])) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (VECTOR_ARITH `y + t % (p - y) = (&1 - t) % y + t % p:real^N`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_CONVEX_SET")(thm_tac (new_rewrite [] [])))))); + (((((fun arg_tac -> (use_arg_then "y_in_domain") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "p_in")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "t_in")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "pair_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "CONVEX_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then "real_taylor2_bound") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f o (\t. y + t % (p - y))`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "dd_bound") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((THENL_FIRST) (ANTS_TAC) (((((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] [])))) THEN (move ["t"]) THEN (move ["t_in"])) THEN ((((use_arg_then "diff2_dir")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "pt_in")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((THENL_FIRST) (ANTS_TAC) ((((fun arg_tac -> (use_arg_then "diff2_derivative2_bound") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_MUL_LID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_ADD2)))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((((use_arg_then "diff2_dir_derivative")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "pt_in")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma m_taylor_upper_bound *) +let m_taylor_upper_bound = section_proof ["domain";"y";"w";"f";"dd_bound";"hi";"hi_bound"] +`m_cell_domain domain y (w:real^N) ==> + diff2_domain domain f ==> + m_taylor_error f domain w dd_bound ==> + f y <= hi ==> + hi + sum(1..dimindex (:N)) (\i. w$i * abs (partial i f y)) + dd_bound / &2 <= hi_bound ==> + !p. p IN interval [domain] ==> f p <= hi_bound` +[ + (BETA_TAC THEN (move ["domainH"]) THEN (move ["df"]) THEN (move ["errorH"]) THEN (move ["f_bound"]) THEN (move ["total_bound"]) THEN (move ["p"]) THEN (move ["p_in"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "m_taylor_error_lemma") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "p_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "errorH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((DISCH_THEN (fun snd_th -> (fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!x y e. abs (x - y) <= e ==> x <= y + e`))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC); + (((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s"))) THEN (move ["ineq"])); + ((((use_arg_then "REAL_LE_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`(f y + s) + dd_bound / &2`))) (term_tac exists_tac)) THEN ((((use_arg_then "ineq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + (((use_arg_then "total_bound") (disch_tac [])) THEN (clear_assumption "total_bound") THEN ((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then "REAL_ADD_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_RADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_ADD2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_bound")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "REAL_LE_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`abs s`))) (term_tac exists_tac)) THEN ((((use_arg_then "REAL_ABS_LE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then "s_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "SUM_ABS_LE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac)); + (((((use_arg_then "REAL_ABS_MUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_MUL2")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_ABS_POS")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_SUB_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "domain_width") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma m_taylor_lower_bound *) +let m_taylor_lower_bound = section_proof ["domain";"y";"w";"f";"dd_bound";"lo";"lo_bound"] +`m_cell_domain domain y (w:real^N) ==> + diff2_domain domain f ==> + m_taylor_error f domain w dd_bound ==> + lo <= f y ==> + lo_bound <= lo - (sum(1..dimindex (:N)) (\i. w$i * abs (partial i f y)) + dd_bound / &2) ==> + !p. p IN interval [domain] ==> lo_bound <= f p` +[ + (BETA_TAC THEN (move ["domainH"]) THEN (move ["df"]) THEN (move ["errorH"]) THEN (move ["f_bound"]) THEN (move ["total_bound"]) THEN (move ["p"]) THEN (move ["p_in"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "m_taylor_error_lemma") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "p_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "errorH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((DISCH_THEN (fun snd_th -> (fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!x y e. abs (x - y) <= e ==> y - e <= x`))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC); + (((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s"))) THEN (move ["ineq"])); + ((((use_arg_then "REAL_LE_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`(f y + s) - dd_bound / &2`))) (term_tac exists_tac)) THEN ((((use_arg_then "ineq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (fun fst_arg -> (use_arg_then "total_bound") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((repeat_tactic 1 9 (((use_arg_then "real_sub")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_NEG_ADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ADD_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_RADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_ADD2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_bound")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))); + ((THENL_LAST) ((((use_arg_then "REAL_LE_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`--abs s`))) (term_tac exists_tac)) THEN (((use_arg_then "REAL_LE_NEG")(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + (((((use_arg_then "s_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "SUM_ABS_LE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac)); + (((((use_arg_then "REAL_ABS_MUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_MUL2")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_ABS_POS")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_SUB_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "domain_width") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma m_taylor_bounds *) +let m_taylor_bounds = section_proof ["domain";"y";"w";"f";"dd_bound";"lo";"hi";"err_bound";"lo_bound";"hi_bound"] +`m_cell_domain domain y (w:real^N) ==> + diff2_domain domain f ==> + m_taylor_error f domain w dd_bound ==> + interval_arith (f y) (lo, hi) ==> + sum(1..dimindex (:N)) (\i. w$i * abs(partial i f y)) + dd_bound / &2 <= err_bound ==> + lo_bound <= lo - err_bound ==> + hi + err_bound <= hi_bound ==> + m_bounded_on_int f domain (lo_bound, hi_bound)` +[ + (((((use_arg_then "m_bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))))) THEN (move ["domainH"]) THEN (move ["df"]) THEN (move ["errorH"]) THEN (case THEN ((move ["f_lo"]) THEN (move ["f_hi"]))) THEN (move ["err"]) THEN (move ["lo_ineq"]) THEN (move ["hi_ineq"]) THEN (move ["p"]) THEN (move ["p_in"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "m_taylor_lower_bound") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "errorH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "f_lo") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "lo_bound") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((use_arg_then "p_in")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`lo - err_bound`))) (term_tac exists_tac))); + (((((use_arg_then "lo_ineq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "real_sub")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_ADD2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_NEG")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "m_taylor_upper_bound") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "errorH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "f_hi") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "hi_bound") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then "p_in")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`hi + err_bound`))) (term_tac exists_tac))); + (((((use_arg_then "hi_ineq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_LADD")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_derivative_partial_bound *) +let diff2_derivative_partial_bound = section_proof ["domain";"y";"w";"p";"f";"i";"d_bound"] +`m_cell_domain domain y (w:real^N) ==> + p IN interval [domain] ==> + diff2_domain domain f ==> + m_taylor_partial_error f i domain w d_bound ==> + (!t. interval_arith t (&0, &1) ==> + abs (derivative (partial i f o (\t. y + t % (p - y))) t) <= d_bound)` +[ + (((((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "m_taylor_partial_error")(thm_tac (new_rewrite [] []))))) THEN (move ["domainH"]) THEN (move ["p_in"]) THEN (move ["df"]) THEN (move ["boundedH"]) THEN (move ["t"]) THEN (move ["t_in"])); + ((fun arg_tac -> arg_tac (Arg_term (`y + t % (p - y) IN interval [domain]`))) (term_tac (have_gen_tac [](move ["pt_in"])))); + ((((fun arg_tac -> arg_tac (Arg_theorem (VECTOR_ARITH `y + t % (p - y) = (&1 - t) % y + t % p:real^N`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_CONVEX_SET")(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> (use_arg_then "y_in_domain") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "p_in")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "t_in")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "pair_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "CONVEX_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "diff2_derivative_partial")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((fun arg_tac -> (use_arg_then "boundedH") (fun fst_arg -> (use_arg_then "pt_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((((use_arg_then "SUM_ABS_LE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["j"]) THEN (move ["j_ineq"]) THEN (simp_tac)); + ((((use_arg_then "REAL_ABS_MUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "REAL_LE_MUL2")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_ABS_POS")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_SUB_COMPONENT")(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then "domain_width") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma m_taylor_partial_error_lemma *) +let m_taylor_partial_error_lemma = section_proof ["domain";"y";"w";"p";"f";"i";"dd_bound"] +`m_cell_domain domain y (w:real^N) ==> + p IN interval [domain] ==> + diff2_domain domain f ==> + m_taylor_partial_error f i domain w dd_bound ==> + abs (partial i f p - partial i f y) <= dd_bound` +[ + ((((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))) THEN (BETA_TAC THEN (move ["domainH"]) THEN (move ["p_in"]) THEN (move ["df"]) THEN (move ["partial_error"]))); + ((fun arg_tac -> arg_tac (Arg_term (`!t. interval_arith t (&0, &1) ==> y + t % (p - y) IN interval [domain]`))) (term_tac (have_gen_tac [](move ["pt_in"])))); + ((BETA_TAC THEN (move ["t"]) THEN (move ["t_in"])) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (VECTOR_ARITH `y + t % (p - y) = (&1 - t) % y + t % p:real^N`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_CONVEX_SET")(thm_tac (new_rewrite [] [])))))); + (((((fun arg_tac -> (use_arg_then "y_in_domain") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "p_in")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "t_in")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "pair_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "CONVEX_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then "real_taylor1_bound") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`partial i f o (\t. y + t % (p - y))`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "dd_bound") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (ANTS_TAC); + ((BETA_TAC THEN (move ["t"]) THEN (move ["t_in"])) THEN ((((use_arg_then "diff2_real_diff_partial")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "pt_in")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then "diff2_derivative_partial_bound") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_MUL_LID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_ADD2)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma m_taylor_upper_partial_bound *) +let m_taylor_upper_partial_bound = section_proof ["domain";"y";"w";"f";"i";"dd_bound";"hi";"hi_bound"] +`m_cell_domain domain y (w:real^N) ==> + diff2_domain domain f ==> + m_taylor_partial_error f i domain w dd_bound ==> + partial i f y <= hi ==> + hi + dd_bound <= hi_bound ==> + !p. p IN interval [domain] ==> partial i f p <= hi_bound` +[ + (BETA_TAC THEN (move ["domainH"]) THEN (move ["df"]) THEN (move ["errorH"]) THEN (move ["df_bound"]) THEN (move ["total_bound"]) THEN (move ["p"]) THEN (move ["p_in"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "m_taylor_partial_error_lemma") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "p_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "errorH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((DISCH_THEN (fun snd_th -> (fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!x y e. abs (x - y) <= e ==> x <= y + e`))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["ineq"])); + (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((use_arg_then "total_bound") (disch_tac [])) THEN (clear_assumption "total_bound") THEN ((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((((use_arg_then "REAL_LE_ADD2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma m_taylor_lower_partial_bound *) +let m_taylor_lower_partial_bound = section_proof ["domain";"y";"w";"f";"i";"dd_bound";"lo";"lo_bound"] +`m_cell_domain domain y (w:real^N) ==> + diff2_domain domain f ==> + m_taylor_partial_error f i domain w dd_bound ==> + lo <= partial i f y ==> + lo_bound <= lo - dd_bound ==> + !p. p IN interval [domain] ==> lo_bound <= partial i f p` +[ + (BETA_TAC THEN (move ["domainH"]) THEN (move ["df"]) THEN (move ["errorH"]) THEN (move ["df_bound"]) THEN (move ["total_bound"]) THEN (move ["p"]) THEN (move ["p_in"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "m_taylor_partial_error_lemma") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "p_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "errorH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((DISCH_THEN (fun snd_th -> (fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!x y e. abs (x - y) <= e ==> y - e <= x`))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["ineq"])); + (((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (fun fst_arg -> (use_arg_then "total_bound") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((repeat_tactic 1 9 (((use_arg_then "real_sub")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_ADD2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma m_taylor_partial_bounds *) +let m_taylor_partial_bounds = section_proof ["domain";"y";"w";"f";"i";"dd_bound";"lo";"hi";"lo_bound";"hi_bound"] +`m_cell_domain domain y (w:real^N) ==> + diff2_domain domain f ==> + m_taylor_partial_error f i domain w dd_bound ==> + interval_arith (partial i f y) (lo, hi) ==> + lo_bound <= lo - dd_bound ==> + hi + dd_bound <= hi_bound ==> + m_bounded_on_int (partial i f) domain (lo_bound, hi_bound)` +[ + (((((use_arg_then "m_bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))))) THEN (move ["domainH"]) THEN (move ["df"]) THEN (move ["errorH"]) THEN (case THEN ((move ["df_lo"]) THEN (move ["df_hi"]))) THEN (move ["lo_ineq"]) THEN (move ["hi_ineq"]) THEN (move ["p"]) THEN (move ["p_in"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "m_taylor_lower_partial_bound") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "errorH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df_lo") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "lo_bound") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "m_taylor_upper_partial_bound") (fun fst_arg -> (use_arg_then "domainH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "errorH") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df_hi") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "hi_bound") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Taylor *) +let real_taylor2_bound = finalize_theorem real_taylor2_bound;; +let real_taylor1_bound = finalize_theorem real_taylor1_bound;; +let taylor_error_eq_sum_partial_errors = finalize_theorem taylor_error_eq_sum_partial_errors;; +let diff2c_imp_diff2 = finalize_theorem diff2c_imp_diff2;; +let diff2_eq_diff2_on_open = finalize_theorem diff2_eq_diff2_on_open;; +let diff2_imp_real_diff = finalize_theorem diff2_imp_real_diff;; +let diff2_dir_derivative = finalize_theorem diff2_dir_derivative;; +let diff2_partial_real_diff = finalize_theorem diff2_partial_real_diff;; +let in_trans = finalize_theorem in_trans;; +let open_contains_open_interval = finalize_theorem open_contains_open_interval;; +let diff2_dir = finalize_theorem diff2_dir;; +let diff2_dir_derivative2 = finalize_theorem diff2_dir_derivative2;; +let diff2_has_derivative_partial = finalize_theorem diff2_has_derivative_partial;; +let diff2_derivative_partial = finalize_theorem diff2_derivative_partial;; +let diff2_real_diff_partial = finalize_theorem diff2_real_diff_partial;; +let partial_const = finalize_theorem partial_const;; +let partial_eq0_alt = finalize_theorem partial_eq0_alt;; +let real_mvt0 = finalize_theorem real_mvt0;; +let mixed_second_partials = finalize_theorem mixed_second_partials;; +let diff2c_domain_alt = finalize_theorem diff2c_domain_alt;; +let y_in_domain = finalize_theorem y_in_domain;; +let domain_width = finalize_theorem domain_width;; +let sum_swap1 = finalize_theorem sum_swap1;; +let m_taylor_error_eq = finalize_theorem m_taylor_error_eq;; +let diff2_derivative2_bound = finalize_theorem diff2_derivative2_bound;; +let m_taylor_error_lemma = finalize_theorem m_taylor_error_lemma;; +let m_taylor_upper_bound = finalize_theorem m_taylor_upper_bound;; +let m_taylor_lower_bound = finalize_theorem m_taylor_lower_bound;; +let m_taylor_bounds = finalize_theorem m_taylor_bounds;; +let diff2_derivative_partial_bound = finalize_theorem diff2_derivative_partial_bound;; +let m_taylor_partial_error_lemma = finalize_theorem m_taylor_partial_error_lemma;; +let m_taylor_upper_partial_bound = finalize_theorem m_taylor_upper_partial_bound;; +let m_taylor_lower_partial_bound = finalize_theorem m_taylor_lower_partial_bound;; +let m_taylor_partial_bounds = finalize_theorem m_taylor_partial_bounds;; +end_section "Taylor";; + +(* Section Diff2Arith *) +begin_section "Diff2Arith";; +(add_section_var (mk_var ("f", (`:real^N -> real`))); add_section_var (mk_var ("g", (`:real^N -> real`))));; +(add_section_var (mk_var ("x", (`:real^N`))));; +(add_section_var (mk_var ("domain", (`:real^N#real^N`))));; + +(* Lemma differentiable_local_at *) +let differentiable_local_at = section_proof ["s";"f";"g";"x"] +`f differentiable at x ==> open s ==> x IN s ==> (!y. y IN s ==> g y = f y) ==> + g differentiable at x` +[ + ((((use_arg_then "OPEN_CONTAINS_BALL")(thm_tac (new_rewrite [] [])))) THEN (move ["df"]) THEN (move ["open_s"]) THEN (move ["xs"]) THEN (move ["eq"])); + ((((fun arg_tac -> (use_arg_then "open_s") (fun fst_arg -> (use_arg_then "xs") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"]))) THEN (((((use_arg_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_BALL")(thm_tac (new_rewrite [] []))))) THEN (move ["in_ball"]))); + ((((fun arg_tac -> (use_arg_then "DIFFERENTIABLE_TRANSFORM_AT") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))))); + (((use_arg_then "d") (term_tac exists_tac)) THEN (((((use_arg_then "d0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["z"]) THEN (move ["dzx"])) THEN ((((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "in_ball")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIST_SYM")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Point *) +begin_section "Point";; + +(* Lemma diff2_scale *) +let diff2_scale = section_proof ["f";"c"] +`diff2 f x ==> diff2 (\x. c * f x) x` +[ + ((repeat_tactic 1 9 (((use_arg_then "diff2")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])); + (((use_arg_then "s") (term_tac exists_tac)) THEN (((((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (move ["zs"]))); + ((THENL_FIRST) ((((use_arg_then "f_lift_scale")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_CMUL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((BETA_TAC THEN (move ["i"])) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then "differentiable_local_at") (fun fst_arg -> (use_arg_then "s") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`lift o (\x. c * partial i f x)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + ((THENL_FIRST) ((((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "zs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_lift_scale")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_CMUL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) ((repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((BETA_TAC THEN (move ["y"]) THEN (move ["ys"])) THEN ((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "partial_scale")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "LIFT_CMUL")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_neg *) +let diff2_neg = section_proof ["f"] +`diff2 f x ==> diff2 (\x. --f x) x` +[ + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "diff2_scale") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`--(&1)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then "REAL_NEG_MINUS1")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Composite *) +begin_section "Composite";; + +(* Lemma has_derivative_uni_compose *) +let has_derivative_uni_compose = section_proof ["u";"f";"u'";"f'";"x"] +`(lift o f has_derivative f') (at x) ==> + (u has_real_derivative u') (atreal (f x)) ==> + (lift o u o f has_derivative (\x. u' % f' x)) (at x)` +[ + (BETA_TAC THEN (move ["df"]) THEN (move ["du"])); + ((fun arg_tac -> arg_tac (Arg_term (`lift o u o f = (lift o u o drop) o (lift o f)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`(\x. u' % f' x) = (\x. u' % x) o f'`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac))); + (((((use_arg_then "DIFF_CHAIN_AT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_REAL_FRECHET_DERIVATIVE_AT)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma diff_uni_compose *) +let diff_uni_compose = section_proof ["u";"f";"x"] +`lift o f differentiable at x ==> + u real_differentiable atreal (f x) ==> + lift o u o f differentiable at x` +[ + (((repeat_tactic 1 9 (((use_arg_then "differentiable")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "real_differentiable")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["f'"])) THEN (move ["df"]) THEN (case THEN (move ["u'"])) THEN (move ["du"])); + (((fun arg_tac -> arg_tac (Arg_term (`\x. u' % f' x`))) (term_tac exists_tac)) THEN ((use_arg_then "has_derivative_uni_compose") (thm_tac apply_tac)) THEN (done_tac)); +];; + +(* Lemma diff2_uni_compose *) +let diff2_uni_compose = section_proof ["u";"f"] +`diff2 f x ==> nth_diff_strong 2 u (f x) ==> diff2 (u o f) x` +[ + (((repeat_tactic 1 9 (((use_arg_then "diff2")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "nth_diff_strong2_eq")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["fxt"])) THEN (move ["du"])); + ((fun arg_tac -> arg_tac (Arg_term (`{z | z IN s /\ (lift o f) z IN (IMAGE lift t)}`))) (term_tac (set_tac "r"))); + ((fun arg_tac -> arg_tac (Arg_term (`open r`))) (term_tac (have_gen_tac [](move ["open_r"])))); + ((((use_arg_then "r_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "CONTINUOUS_OPEN_PREIMAGE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_OPEN")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "open_t")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))))); + (((use_arg_then "DIFFERENTIABLE_IMP_CONTINUOUS_ON") (thm_tac apply_tac)) THEN ((((use_arg_then "differentiable_on")(thm_tac (new_rewrite [] [])))) THEN (move ["y"]) THEN (move ["ys"])) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); + (((((use_arg_then "DIFFERENTIABLE_AT_WITHIN")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) (((use_arg_then "r") (term_tac exists_tac)) THEN ((((use_arg_then "open_r")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "r_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "LIFT_IN_IMAGE_LIFT")(thm_tac (new_rewrite [] []))))) THEN (split_tac)) (((use_arg_then "x") (term_tac exists_tac)) THEN (done_tac))); + (BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["z"])) THEN (case THEN ((case THEN (move ["zs"])) THEN (move ["fzt"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((use_arg_then "diff_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "du")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"])); + (((use_arg_then "differentiable_local_at") (thm_tac apply_tac)) THEN (((use_arg_then "r") (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`lift o (\y. derivative u (f y) * partial i f y)`))) (term_tac exists_tac)))); + ((((use_arg_then "open_r")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "differentiable_mul")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then "o_THM") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative u`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((((use_arg_then "diff_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "du")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) (((((use_arg_then "r_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "LIFT_IN_IMAGE_LIFT")(thm_tac (new_rewrite [] [])))))) THEN (split_tac)) (((use_arg_then "z") (term_tac exists_tac)) THEN (done_tac))); + (BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["p"])) THEN (case THEN ((case THEN (move ["ps"])) THEN (move ["fpt"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((use_arg_then "partial_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "du")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma diff2_inv_compose *) +let diff2_inv_compose = section_proof [] +`~(f x = &0) ==> diff2 f x ==> diff2 (inv o f) x` +[ + ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then "diff2_inv") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then "diff2_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma diff2_sqrt_compose *) +let diff2_sqrt_compose = section_proof [] +`&0 < f x ==> diff2 f x ==> diff2 (sqrt o f) x` +[ + ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then "diff2_sqrt") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then "diff2_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma diff2_atn_compose *) +let diff2_atn_compose = section_proof [] +`diff2 f x ==> diff2 (atn o f) x` +[ + ((BETA_TAC THEN (move ["df"])) THEN ((((use_arg_then "diff2_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_atn")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_acs_compose *) +let diff2_acs_compose = section_proof [] +`abs (f x) < &1 ==> diff2 f x ==> diff2 (acs o f) x` +[ + ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then "diff2_acs") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["du"]) THEN (move ["df"])) THEN (((use_arg_then "diff2_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section Composite *) +let has_derivative_uni_compose = finalize_theorem has_derivative_uni_compose;; +let diff_uni_compose = finalize_theorem diff_uni_compose;; +let diff2_uni_compose = finalize_theorem diff2_uni_compose;; +let diff2_inv_compose = finalize_theorem diff2_inv_compose;; +let diff2_sqrt_compose = finalize_theorem diff2_sqrt_compose;; +let diff2_atn_compose = finalize_theorem diff2_atn_compose;; +let diff2_acs_compose = finalize_theorem diff2_acs_compose;; +end_section "Composite";; + +(* Lemma diff2_add *) +let diff2_add = section_proof ["f";"g"] +`diff2 f x ==> diff2 g x ==> diff2 (\x. f x + g x) x` +[ + ((repeat_tactic 1 9 (((use_arg_then "diff2")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["ys"])) THEN (move ["dg"])); + (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN (((((use_arg_then "OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ys")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (case THEN ((move ["zs"]) THEN (move ["zt"]))))); + ((((use_arg_then "f_lift_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "dg")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["i"])) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then "differentiable_local_at") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`lift o (\x. partial i f x + partial i g x)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + ((((use_arg_then "OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "zt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "zs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_lift_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "dg")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))) THEN ((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "partial_add")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "LIFT_ADD")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_sub *) +let diff2_sub = section_proof ["f";"g"] +`diff2 f x ==> diff2 g x ==> diff2 (\x. f x - g x) x` +[ + ((BETA_TAC THEN (move ["d2f"]) THEN (move ["d2g"])) THEN ((((use_arg_then "real_sub")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_add")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "diff2_neg")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_mul *) +let diff2_mul = section_proof ["f";"g"] +`diff2 f x ==> diff2 g x ==> diff2 (\x. f x * g x) x` +[ + ((repeat_tactic 1 9 (((use_arg_then "diff2")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["ys"])) THEN (move ["dg"])); + (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN (((((use_arg_then "OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ys")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (case THEN ((move ["zs"]) THEN (move ["zt"]))))); + (((((use_arg_then "differentiable_mul")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then "differentiable_local_at") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`lift o (\x. partial i f x * g x + f x * partial i g x)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then "OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "zt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "zs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_lift_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (repeat_tactic 1 9 (((use_arg_then "differentiable_mul")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))) THEN ((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "partial_mul")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "LIFT_ADD")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Point *) +let diff2_scale = finalize_theorem diff2_scale;; +let diff2_neg = finalize_theorem diff2_neg;; +let has_derivative_uni_compose = finalize_theorem has_derivative_uni_compose;; +let diff_uni_compose = finalize_theorem diff_uni_compose;; +let diff2_uni_compose = finalize_theorem diff2_uni_compose;; +let diff2_inv_compose = finalize_theorem diff2_inv_compose;; +let diff2_sqrt_compose = finalize_theorem diff2_sqrt_compose;; +let diff2_atn_compose = finalize_theorem diff2_atn_compose;; +let diff2_acs_compose = finalize_theorem diff2_acs_compose;; +let diff2_add = finalize_theorem diff2_add;; +let diff2_sub = finalize_theorem diff2_sub;; +let diff2_mul = finalize_theorem diff2_mul;; +end_section "Point";; + +(* Section Domain *) +begin_section "Domain";; +(add_section_hyp "d2f" (`diff2_domain domain f`));; + +(* Lemma diff2_domain_scale *) +let diff2_domain_scale = section_proof ["c"] +`diff2_domain domain (\x. c * f x)` +[ + ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2_scale")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_domain_neg *) +let diff2_domain_neg = section_proof [] +`diff2_domain domain (\x. --f x)` +[ + ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2_neg")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(add_section_var (mk_var ("bounds", (`:real#real`))));; + +(* Lemma diff2_domain_inv_compose *) +let diff2_domain_inv_compose = section_proof [] +`m_bounded_on_int f domain bounds ==> + interval_not_zero bounds ==> diff2_domain domain (inv o f)` +[ + ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then "m_bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); + (((((use_arg_then "diff2_inv_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "interval_arith_not_zero") (fun fst_arg -> (fun arg_tac -> (use_arg_then "ineq") (fun fst_arg -> (use_arg_then "x_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_domain_sqrt_compose *) +let diff2_domain_sqrt_compose = section_proof [] +`m_bounded_on_int f domain bounds ==> + interval_pos bounds ==> diff2_domain domain (sqrt o f)` +[ + ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then "m_bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); + (((((use_arg_then "diff2_sqrt_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "interval_arith_pos") (fun fst_arg -> (fun arg_tac -> (use_arg_then "ineq") (fun fst_arg -> (use_arg_then "x_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_domain_atn_compose *) +let diff2_domain_atn_compose = section_proof [] +`diff2_domain domain (atn o f)` +[ + ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2_atn_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_domain_acs_compose *) +let diff2_domain_acs_compose = section_proof [] +`m_bounded_on_int f domain bounds ==> + iabs bounds < &1 ==> diff2_domain domain (acs o f)` +[ + ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then "m_bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); + (((((use_arg_then "diff2_acs_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "interval_arith_abs") (fun fst_arg -> (fun arg_tac -> (use_arg_then "ineq") (fun fst_arg -> (use_arg_then "x_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(add_section_hyp "d2g" (`diff2_domain domain g`));; + +(* Lemma diff2_domain_add *) +let diff2_domain_add = section_proof [] +`diff2_domain domain (\x. f x + g x)` +[ + ((((use_arg_then "d2g") (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2g")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma diff2_domain_sub *) +let diff2_domain_sub = section_proof [] +`diff2_domain domain (\x. f x - g x)` +[ + ((((use_arg_then "d2g") (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2_sub")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2g")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma diff2_domain_mul *) +let diff2_domain_mul = section_proof [] +`diff2_domain domain (\x. f x * g x)` +[ + ((((use_arg_then "d2g") (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2_mul")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2g")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section Domain *) +let diff2_domain_scale = finalize_theorem diff2_domain_scale;; +let diff2_domain_neg = finalize_theorem diff2_domain_neg;; +let diff2_domain_inv_compose = finalize_theorem diff2_domain_inv_compose;; +let diff2_domain_sqrt_compose = finalize_theorem diff2_domain_sqrt_compose;; +let diff2_domain_atn_compose = finalize_theorem diff2_domain_atn_compose;; +let diff2_domain_acs_compose = finalize_theorem diff2_domain_acs_compose;; +let diff2_domain_add = finalize_theorem diff2_domain_add;; +let diff2_domain_sub = finalize_theorem diff2_domain_sub;; +let diff2_domain_mul = finalize_theorem diff2_domain_mul;; +end_section "Domain";; + +(* Section SecondPartial *) +begin_section "SecondPartial";; + +(* Lemma diff2_imp_diff *) +let diff2_imp_diff = section_proof ["f";"x"] +`diff2 f x ==> (lift o f) differentiable at x` +[ + (((((use_arg_then "diff2")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_imp_partial_diff *) +let diff2_imp_partial_diff = section_proof ["f";"i";"x"] +`diff2 f x ==> (lift o partial i f) differentiable at x` +[ + (((((use_arg_then "diff2")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma partial_local *) +let partial_local = section_proof ["s";"f";"g";"i";"x"] +`(lift o f) differentiable at x ==> + open s ==> x IN s ==> (!y:real^N. y IN s ==> f y = g y) ==> + partial i f x = partial i g x` +[ + ((BETA_TAC THEN (move ["df"]) THEN (move ["open_s"]) THEN (move ["xs"]) THEN (move ["eq"])) THEN (repeat_tactic 1 9 (((use_arg_then "partial")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_LOCAL") (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`g o (\t. x + t % basis i)`))) (term_tac exists_tac)) THEN (split_tac)); + ((((use_arg_then "has_derivative_alt") (disch_tac [])) THEN (clear_assumption "has_derivative_alt") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then "diff_imp_real_diff") (thm_tac apply_tac)) THEN ((((use_arg_then "diff_direction")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then "differentiable_local_at") (fun fst_arg -> (use_arg_then "s") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`lift o f`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac)); + (((simp_tac) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (move ["ys"])); + (((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "eq")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "open_contains_open_interval") (fun fst_arg -> (use_arg_then "open_s") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "xs") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`basis i:real^N`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN (move ["ab0"]))) THEN ((((use_arg_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (move ["sub"]))); + (((fun arg_tac -> arg_tac (Arg_term (`real_interval (a, b)`))) (term_tac exists_tac)) THEN (((((use_arg_then "ab0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_OPEN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (move ["y_in"]))); + (((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "sub")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_IMAGE")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then "y") (term_tac exists_tac)) THEN (done_tac)); +];; +(add_section_var (mk_var ("i", (`:num`))); add_section_var (mk_var ("j", (`:num`))));; + +(* Lemma second_partial_scale *) +let second_partial_scale = section_proof ["f";"c"] +`diff2 f x ==> partial2 i j (\x. c * f x) x = c * partial2 i j f x` +[ + ((BETA_TAC THEN (move ["d2f"])) THEN ((repeat_tactic 1 9 (((use_arg_then "partial2")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "partial_scale")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "diff2_imp_partial_diff")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then "diff2")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]))); + (((use_arg_then "partial_local") (thm_tac apply_tac)) THEN ((use_arg_then "s") (term_tac exists_tac)) THEN ((((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_lift_scale")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_CMUL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))))); + ((repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((BETA_TAC THEN (move ["y"]) THEN (move ["ys"])) THEN ((((use_arg_then "partial_scale")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma second_partial_neg *) +let second_partial_neg = section_proof ["f"] +`diff2 f x ==> partial2 i j (\x. --f x) x = --partial2 i j f x` +[ + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "second_partial_scale") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`--(&1)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_NEG_MINUS1")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma second_partial_add *) +let second_partial_add = section_proof ["f";"g"] +`diff2 f x ==> diff2 g x ==> + partial2 i j (\x. f x + g x) x = partial2 i j f x + partial2 i j g x` +[ + ((repeat_tactic 1 9 (((use_arg_then "diff2")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["ys"])) THEN (move ["dg"])); + (((repeat_tactic 1 9 (((use_arg_then "partial2")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "partial_add")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then "partial_local") (thm_tac apply_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN ((((use_arg_then "OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ys")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "f_lift_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["z"]) THEN (case THEN ((move ["zs"]) THEN (move ["zt"])))) THEN ((((use_arg_then "partial_add")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma second_partial_sub *) +let second_partial_sub = section_proof ["f";"g"] +`diff2 f x ==> diff2 g x ==> + partial2 i j (\x. f x - g x) x = partial2 i j f x - partial2 i j g x` +[ + ((BETA_TAC THEN (move ["d2f"]) THEN (move ["d2g"])) THEN ((((use_arg_then "real_sub")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "second_partial_add")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "diff2_neg")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "second_partial_neg")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "real_sub")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma second_partial_mul *) +let second_partial_mul = section_proof ["f";"g"] +`diff2 f x ==> diff2 g x ==> + partial2 i j (\x. f x * g x) x = (partial2 i j f x * g x + partial j f x * partial i g x) + + (partial i f x * partial j g x + f x * partial2 i j g x)` +[ + ((repeat_tactic 1 9 (((use_arg_then "diff2")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["ys"])) THEN (move ["dg"])); + ((repeat_tactic 1 9 (((use_arg_then "partial2")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "partial_mul")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then "partial_add")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 1 (((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 (((use_arg_then "differentiable_mul")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((use_arg_then "partial_local") (thm_tac apply_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN ((((use_arg_then "OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ys")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "f_lift_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (repeat_tactic 1 9 (((use_arg_then "differentiable_mul")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["z"]) THEN (case THEN ((move ["zs"]) THEN (move ["zt"])))) THEN ((((use_arg_then "partial_mul")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma second_partial_uni_compose *) +let second_partial_uni_compose = section_proof ["f";"u"] +`diff2 f x ==> nth_diff_strong 2 u (f x) ==> + partial2 i j (u o f) x = (nth_derivative 2 u (f x) * partial i f x) * partial j f x + + derivative u (f x) * partial2 i j f x` +[ + (((repeat_tactic 1 9 (((use_arg_then "diff2")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "nth_diff_strong2_eq")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["fxt"])) THEN (move ["du"])); + ((fun arg_tac -> arg_tac (Arg_term (`{z | z IN s /\ (lift o f) z IN (IMAGE lift t)}`))) (term_tac (set_tac "r"))); + ((fun arg_tac -> arg_tac (Arg_term (`open r`))) (term_tac (have_gen_tac [](move ["open_r"])))); + ((((use_arg_then "r_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "CONTINUOUS_OPEN_PREIMAGE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_OPEN")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "open_t")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))))); + (((use_arg_then "DIFFERENTIABLE_IMP_CONTINUOUS_ON") (thm_tac apply_tac)) THEN ((((use_arg_then "differentiable_on")(thm_tac (new_rewrite [] [])))) THEN (move ["y"]) THEN (move ["ys"])) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); + (((((use_arg_then "DIFFERENTIABLE_AT_WITHIN")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then "partial2")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "nth_derivative2")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "partial_uni_compose")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "du")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then "o_THM") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative u`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "partial_mul")(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then "diff_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "du")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((use_arg_then "partial_local") (thm_tac apply_tac)) THEN ((use_arg_then "r") (term_tac exists_tac)) THEN ((((use_arg_then "open_r")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))))); + ((THENL_ROT (-1)) (((((use_arg_then "r_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "LIFT_IN_IMAGE_LIFT")(thm_tac (new_rewrite [] []))))) THEN (split_tac))); + ((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["z"])) THEN (case THEN ((case THEN (move ["zs"])) THEN (move ["fpz"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then "partial_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "du")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_LAST) (split_tac) (((use_arg_then "x") (term_tac exists_tac)) THEN (done_tac))); + (((use_arg_then "differentiable_local_at") (thm_tac apply_tac)) THEN (((use_arg_then "r") (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`lift o (\y. derivative u (f y) * partial j f y)`))) (term_tac exists_tac)))); + ((((use_arg_then "open_r")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "differentiable_mul")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then "o_THM") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative u`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((((use_arg_then "diff_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "du")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) (((((use_arg_then "r_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "LIFT_IN_IMAGE_LIFT")(thm_tac (new_rewrite [] [])))))) THEN (split_tac)) (((use_arg_then "x") (term_tac exists_tac)) THEN (done_tac))); + ((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["p"])) THEN (case THEN ((case THEN (move ["ps"])) THEN (move ["fpt"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then "partial_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "du")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section SecondPartial *) +let diff2_imp_diff = finalize_theorem diff2_imp_diff;; +let diff2_imp_partial_diff = finalize_theorem diff2_imp_partial_diff;; +let partial_local = finalize_theorem partial_local;; +let second_partial_scale = finalize_theorem second_partial_scale;; +let second_partial_neg = finalize_theorem second_partial_neg;; +let second_partial_add = finalize_theorem second_partial_add;; +let second_partial_sub = finalize_theorem second_partial_sub;; +let second_partial_mul = finalize_theorem second_partial_mul;; +let second_partial_uni_compose = finalize_theorem second_partial_uni_compose;; +end_section "SecondPartial";; + +(* Finalization of the section Diff2Arith *) +let differentiable_local_at = finalize_theorem differentiable_local_at;; +let diff2_scale = finalize_theorem diff2_scale;; +let diff2_neg = finalize_theorem diff2_neg;; +let has_derivative_uni_compose = finalize_theorem has_derivative_uni_compose;; +let diff_uni_compose = finalize_theorem diff_uni_compose;; +let diff2_uni_compose = finalize_theorem diff2_uni_compose;; +let diff2_inv_compose = finalize_theorem diff2_inv_compose;; +let diff2_sqrt_compose = finalize_theorem diff2_sqrt_compose;; +let diff2_atn_compose = finalize_theorem diff2_atn_compose;; +let diff2_acs_compose = finalize_theorem diff2_acs_compose;; +let diff2_add = finalize_theorem diff2_add;; +let diff2_sub = finalize_theorem diff2_sub;; +let diff2_mul = finalize_theorem diff2_mul;; +let diff2_domain_scale = finalize_theorem diff2_domain_scale;; +let diff2_domain_neg = finalize_theorem diff2_domain_neg;; +let diff2_domain_inv_compose = finalize_theorem diff2_domain_inv_compose;; +let diff2_domain_sqrt_compose = finalize_theorem diff2_domain_sqrt_compose;; +let diff2_domain_atn_compose = finalize_theorem diff2_domain_atn_compose;; +let diff2_domain_acs_compose = finalize_theorem diff2_domain_acs_compose;; +let diff2_domain_add = finalize_theorem diff2_domain_add;; +let diff2_domain_sub = finalize_theorem diff2_domain_sub;; +let diff2_domain_mul = finalize_theorem diff2_domain_mul;; +let diff2_imp_diff = finalize_theorem diff2_imp_diff;; +let diff2_imp_partial_diff = finalize_theorem diff2_imp_partial_diff;; +let partial_local = finalize_theorem partial_local;; +let second_partial_scale = finalize_theorem second_partial_scale;; +let second_partial_neg = finalize_theorem second_partial_neg;; +let second_partial_add = finalize_theorem second_partial_add;; +let second_partial_sub = finalize_theorem second_partial_sub;; +let second_partial_mul = finalize_theorem second_partial_mul;; +let second_partial_uni_compose = finalize_theorem second_partial_uni_compose;; +end_section "Diff2Arith";; + +(* Section Diff2c *) +begin_section "Diff2c";; + +(* Lemma real_cont_at_local *) +let real_cont_at_local = section_proof ["f";"g";"x";"s"] +`g real_continuous at x ==> open s ==> x IN s ==> + (!y. y IN s ==> f y = g y) ==> f real_continuous at x` +[ + ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL real_continuous_at)))(thm_tac (new_rewrite [] []))))) THEN (move ["g_cont"]) THEN (move ["open_s"]) THEN (move ["xs"]) THEN (move ["f_eq_g"]) THEN (move ["e"]) THEN (move ["e_gt0"])); + (((fun arg_tac -> (use_arg_then "OPEN_CONTAINS_BALL") (fun fst_arg -> (use_arg_then "s") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "ball")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUBSET")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + (((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "xs") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC THEN (case THEN (move ["d0"])) THEN (case THEN (move ["d0_gt0"])) THEN (move ["sub_s"])); + (((fun arg_tac -> (use_arg_then "g_cont") (fun fst_arg -> (use_arg_then "e_gt0") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["d1"])) THEN (case THEN (move ["d1_gt0"])) THEN (move ["dist_cond"])); + ((fun arg_tac -> arg_tac (Arg_term (`min d0 d1`))) (term_tac exists_tac)); + (((repeat_tactic 1 9 (((use_arg_then "REAL_LT_MIN")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "d1_gt0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d0_gt0")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["y"]) THEN (case THEN ((move ["yd0"]) THEN (move ["yd1"])))); + ((repeat_tactic 1 9 (((use_arg_then "f_eq_g")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then "sub_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIST_SYM")(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then "y") (term_tac exists_tac)) THEN (done_tac)); + (((use_arg_then "dist_cond") (disch_tac [])) THEN (clear_assumption "dist_cond") THEN (exact_tac)); +];; + +(* Lemma real_cont_atreal_local *) +let real_cont_atreal_local = section_proof ["v";"u";"t";"x"] +`v real_continuous atreal x ==> real_open t ==> x IN t ==> + (!y. y IN t ==> u y = v y) ==> u real_continuous atreal x` +[ + (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS_ATREAL)))(thm_tac (new_rewrite [] []))))); + (((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "REAL_OPEN")(thm_tac (new_rewrite [] []))))) THEN (move ["vc"]) THEN (move ["open_t"]) THEN (move ["xt"]) THEN (move ["v_eq_u"])); + ((use_arg_then "real_cont_at_local") (thm_tac apply_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`v o drop`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`IMAGE lift t`))) (term_tac exists_tac))); + ((((((use_arg_then "open_t")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "vc")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "LIFT_IN_IMAGE_LIFT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xt")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "IN_IMAGE_LIFT_DROP")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "v_eq_u") (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; +(add_section_type (mk_var ("f", (`:real^N -> real`))); add_section_type (mk_var ("g", (`:real^N -> real`))));; +(add_section_var (mk_var ("x", (`:real^N`))));; +(add_section_var (mk_var ("domain", (`:real^N#real^N`))));; + +(* Section Point *) +begin_section "Point";; + +(* Lemma diff2c_scale *) +let diff2c_scale = section_proof ["f";"c"] +`diff2c f x ==> diff2c (\x. c * f x) x` +[ + (((repeat_tactic 1 9 (((use_arg_then "diff2c")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["d2f"]) THEN (move ["p2c"])))) THEN (((((use_arg_then "diff2_scale")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["j"]))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "p2c") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "j") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["p2ij"]))); + ((use_arg_then "real_cont_at_local") (thm_tac apply_tac)); + ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then "diff2_eq_diff2_on_open")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["d2s"]))); + (((fun arg_tac -> arg_tac (Arg_term (`(\x. c * partial2 j i f x)`))) (term_tac exists_tac)) THEN ((use_arg_then "s") (term_tac exists_tac))); + ((THENL_FIRST) (((use_arg_then "REAL_CONTINUOUS_LMUL")(thm_tac (new_rewrite [] [])))) ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac))); + (((((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "d2s") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["d2y"])); + ((((use_arg_then "second_partial_scale")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma diff2c_neg *) +let diff2c_neg = section_proof ["f"] +`diff2c f x ==> diff2c (\x. --f x) x` +[ + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "diff2c_scale") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`--(&1)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then "REAL_NEG_MINUS1")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Composite *) +begin_section "Composite";; + +(* Lemma nth_diff_strong_eq_on_open *) +let nth_diff_strong_eq_on_open = section_proof ["n";"u";"x"] +`nth_diff_strong n u x ==> + ?s. real_open s /\ x IN s /\ (!y. y IN s ==> nth_diff_strong n u y)` +[ + ((repeat_tactic 1 9 (((use_arg_then "nth_diff_strong")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["dt"])); + (((use_arg_then "t") (term_tac exists_tac)) THEN (((((use_arg_then "xt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "open_t")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["y"]) THEN (move ["yt"]))); + (((use_arg_then "t") (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma diff2_imp_cont *) +let diff2_imp_cont = section_proof ["f";"x"] +`diff2 f x ==> f real_continuous at x` +[ + ((((use_arg_then "diff2")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])); + (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_IMP_CONTINUOUS_AT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_imp_partial_cont *) +let diff2_imp_partial_cont = section_proof ["f";"i";"x"] +`diff2 f x ==> (partial i f) real_continuous at x` +[ + ((((use_arg_then "diff2")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])); + (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_IMP_CONTINUOUS_AT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2c_uni_compose *) +let diff2c_uni_compose = section_proof ["u";"f";"x"] +`diff2c f x ==> nth_diff_strong 2 u (f x) ==> + (nth_derivative 2 u) real_continuous atreal (f x) ==> diff2c (u o f) x` +[ + ((repeat_tactic 1 9 (((use_arg_then "diff2c")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d2f"])) THEN (move ["p2c"]) THEN (move ["d2u"]) THEN (move ["u2c"])); + (((((use_arg_then "diff2_uni_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2u")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["j"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "p2c") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "j") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["p2ij"]))); + ((use_arg_then "real_cont_at_local") (thm_tac apply_tac)); + ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then "diff2_eq_diff2_on_open")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["d2s"]))); + (((fun arg_tac -> (use_arg_then "nth_diff_strong_eq_on_open") (fun fst_arg -> (use_arg_then "d2u") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["fxt"])) THEN (move ["d2t"])); + ((fun arg_tac -> arg_tac (Arg_term (`{z | z IN s /\ (lift o f) z IN (IMAGE lift t)}`))) (term_tac (set_tac "r"))); + ((fun arg_tac -> arg_tac (Arg_term (`open r`))) (term_tac (have_gen_tac [](move ["open_r"])))); + ((((use_arg_then "r_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "CONTINUOUS_OPEN_PREIMAGE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_OPEN")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "open_t")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))))); + (((use_arg_then "DIFFERENTIABLE_IMP_CONTINUOUS_ON") (thm_tac apply_tac)) THEN ((((use_arg_then "differentiable_on")(thm_tac (new_rewrite [] [])))) THEN (move ["y"]) THEN (move ["ys"])) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); + (((use_arg_then "DIFFERENTIABLE_AT_WITHIN")(thm_tac (new_rewrite [] [])))); + ((((fun arg_tac -> (use_arg_then "d2s") (fun fst_arg -> (use_arg_then "ys") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then "diff2")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s'"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["ys'"])))); + ((((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "ys'") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC THEN (simp_tac)) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`(\x. (nth_derivative 2 u (f x) * partial j f x) * partial i f x + derivative u (f x) * partial2 j i f x)`))) (term_tac exists_tac)) THEN ((use_arg_then "r") (term_tac exists_tac))); + ((THENL_ROT (-1)) (((((use_arg_then "open_r")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "r_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "LIFT_IN_IMAGE_LIFT")(thm_tac (new_rewrite [] []))))) THEN (split_tac))); + (BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["z"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["zs"])) THEN (move ["fzt"]) THEN (move ["yz"])); + (((((use_arg_then "second_partial_uni_compose")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "yz")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2s")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "d2t")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_LAST) (split_tac) (((use_arg_then "x") (term_tac exists_tac)) THEN (done_tac))); + (((((use_arg_then "REAL_CONTINUOUS_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_CONTINUOUS_MUL")(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then "diff2_imp_partial_cont")(fun tmp_arg1 -> (use_arg_then "d2s")(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "o_THM")(gsym_then (thm_tac (new_rewrite [] [(`nth_derivative 2 u _1`)])))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); + (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(thm_tac (new_rewrite [] [])))); + ((((use_arg_then "o_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "CONTINUOUS_REAL_CONTINUOUS_AT_COMPOSE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_imp_cont")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2s")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_CONTINUOUS_ATREAL_WITHINREAL")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then "p2ij")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "o_THM")(gsym_then (thm_tac (new_rewrite [] [(`derivative u _`)])))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); + (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(thm_tac (new_rewrite [] [])))); + ((((use_arg_then "o_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "CONTINUOUS_REAL_CONTINUOUS_AT_COMPOSE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_imp_cont")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2s")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_CONTINUOUS_ATREAL_WITHINREAL")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "nth_derivative1")(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((use_arg_then "nth_derivative_continuous") (thm_tac apply_tac))); + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`2`))) (term_tac exists_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then "d2t") (fun fst_arg -> (use_arg_then "fxt") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then "nth_diff_strong")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_differentiable_on")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["t'"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["fxt'"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma real_open_delete *) +let real_open_delete = section_proof ["s";"x"] +`real_open s ==> real_open (s DELETE x)` +[ + ((repeat_tactic 1 9 (((use_arg_then "REAL_OPEN")(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "OPEN_DELETE") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`lift x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))); + (((((use_arg_then "IMAGE_DELETE_INJ")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "LIFT_EQ")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma diff2c_inv_compose *) +let diff2c_inv_compose = section_proof ["f"] +`~(f x = &0) ==> diff2c f x ==> diff2c (inv o f) x` +[ + ((BETA_TAC THEN (move ["fn0"]) THEN (move ["d2f"])) THEN (((use_arg_then "diff2c_uni_compose")(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then "diff2_inv") (fun fst_arg -> (use_arg_then "fn0") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((use_arg_then "real_cont_atreal_local") (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`\x. &2 * inv (x pow 3)`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`UNIV DELETE (&0)`))) (term_tac exists_tac))); + ((THENL_ROT (-1)) (((((use_arg_then "real_open_delete")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_OPEN_UNIV")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "IN_DELETE")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_UNIV")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "fn0")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac))); + ((BETA_TAC THEN (move ["y"]) THEN (move ["yn0"])) THEN (((use_arg_then "second_derivative_inv")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then "REAL_CONTINUOUS_LMUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_INV_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_POW")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_CONTINUOUS_AT_ID")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "REAL_POW_NZ")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma diff2c_sqrt_compose *) +let diff2c_sqrt_compose = section_proof ["f"] +`&0 < f x ==> diff2c f x ==> diff2c (sqrt o f) x` +[ + ((BETA_TAC THEN (move ["fn0"]) THEN (move ["d2f"])) THEN (((use_arg_then "diff2c_uni_compose")(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then "diff2_sqrt") (fun fst_arg -> (use_arg_then "fn0") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((use_arg_then "real_cont_atreal_local") (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`\x. -- inv (&4 * sqrt (x pow 3))`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`{x | x > &0}`))) (term_tac exists_tac))); + ((THENL_ROT (-1)) (((((use_arg_then "REAL_OPEN_HALFSPACE_GT")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "real_gt")(thm_tac (new_rewrite [] [])))))) THEN (split_tac))); + ((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["z"])) THEN (case THEN (move ["z0"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "second_derivative_sqrt")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((THENL_LAST) (split_tac) (((fun arg_tac -> arg_tac (Arg_term (`f x`))) (term_tac exists_tac)) THEN (done_tac))); + ((THENL_ROT (-1)) ((((use_arg_then "REAL_CONTINUOUS_NEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_INV_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_LMUL")(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) (((((use_arg_then "REAL_ENTIRE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "negb_or")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((((use_arg_then "SQRT_EQ_0")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_POW_NZ")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_POS_NZ")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_POW_LE")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "fn0") (disch_tac [])) THEN (clear_assumption "fn0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(\x. sqrt (x pow 3)) = (sqrt o (\x. x pow 3))`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "FUN_EQ_THM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "REAL_CONTINUOUS_ATREAL_COMPOSE")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "REAL_CONTINUOUS_POW")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_CONTINUOUS_AT_ID")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))); + (((((use_arg_then "REAL_CONTINUOUS_AT_SQRT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_POW_LT")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2c_atn_compose *) +let diff2c_atn_compose = section_proof ["f"] +`diff2c f x ==> diff2c (atn o f) x` +[ + ((BETA_TAC THEN (move ["d2f"])) THEN (((use_arg_then "diff2c_uni_compose")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "diff2_atn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "nth_derivative2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "second_derivative_atn")(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((use_arg_then "REAL_CONTINUOUS_MUL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_CONTINUOUS_CONST")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_CONTINUOUS_AT_ID")(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))); + ((((use_arg_then "REAL_CONTINUOUS_POW")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_INV_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then "REAL_CONTINUOUS_CONST")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_POW")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_CONTINUOUS_AT_ID")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((use_arg_then "REAL_RNEG_UNIQ")(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> (use_arg_then "REAL_LE_POW_2") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma diff2c_acs_compose *) +let diff2c_acs_compose = section_proof ["f"] +`abs (f x) < &1 ==> diff2c f x ==> diff2c (acs o f) x` +[ + ((BETA_TAC THEN (move ["fn1"]) THEN (move ["d2f"])) THEN (((use_arg_then "diff2c_uni_compose")(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then "diff2_acs") (fun fst_arg -> (use_arg_then "fn1") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((use_arg_then "real_cont_atreal_local") (disch_tac [])) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`\x. --(x / sqrt ((&1 - x * x) pow 3))`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`{x | x < &1} INTER {x | x > -- &1}`))) (term_tac exists_tac))); + ((((use_arg_then "REAL_OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_OPEN_HALFSPACE_GT")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_OPEN_HALFSPACE_LT")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((THENL_ROT (-1)) (((repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "real_gt")(thm_tac (new_rewrite [] [])))))) THEN (split_tac))); + ((BETA_TAC THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["a"])) THEN (case THEN (move ["a1"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (case THEN (move ["b"])) THEN (case THEN (move ["b1"])) THEN (move ["ab"])) THEN ((((use_arg_then "second_derivative_acs")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((((use_arg_then "a1") (disch_tac [])) THEN (clear_assumption "a1") THEN ((use_arg_then "b1") (disch_tac [])) THEN (clear_assumption "b1") THEN ((use_arg_then "ab") (disch_tac [])) THEN (clear_assumption "ab") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_LAST) (split_tac) ((split_tac) THEN ((fun arg_tac -> arg_tac (Arg_term (`f x`))) (term_tac exists_tac)) THEN (((use_arg_then "fn1") (disch_tac [])) THEN (clear_assumption "fn1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((use_arg_then "REAL_CONTINUOUS_NEG")(thm_tac (new_rewrite [] [])))); + ((use_arg_then "REAL_CONTINUOUS_DIV_ATREAL") (thm_tac apply_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`&0 < (&1 - f x * f x) pow 3`))) (term_tac (have_gen_tac [](move ["h"])))); + (((use_arg_then "REAL_POW_LT")(thm_tac (new_rewrite [] [])))); + ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. &1 - a * a = (&1 - a) * (&1 + a)`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LT_MUL")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "fn1") (disch_tac [])) THEN (clear_assumption "fn1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_ROT (-1)) (((((use_arg_then "REAL_CONTINUOUS_AT_ID")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac))); + (((((use_arg_then "SQRT_EQ_0")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_LE_LT")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_LT_IMP_NZ")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(\x. sqrt ((&1 - x * x) pow 3)) = sqrt o (\x. (&1 - x * x) pow 3)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "FUN_EQ_THM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "REAL_CONTINUOUS_ATREAL_COMPOSE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_AT_SQRT")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); + ((((use_arg_then "REAL_CONTINUOUS_POW")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_SUB")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_CONST")(thm_tac (new_rewrite [] []))))); + (((((use_arg_then "REAL_CONTINUOUS_MUL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_CONTINUOUS_AT_ID")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section Composite *) +let nth_diff_strong_eq_on_open = finalize_theorem nth_diff_strong_eq_on_open;; +let diff2_imp_cont = finalize_theorem diff2_imp_cont;; +let diff2_imp_partial_cont = finalize_theorem diff2_imp_partial_cont;; +let diff2c_uni_compose = finalize_theorem diff2c_uni_compose;; +let real_open_delete = finalize_theorem real_open_delete;; +let diff2c_inv_compose = finalize_theorem diff2c_inv_compose;; +let diff2c_sqrt_compose = finalize_theorem diff2c_sqrt_compose;; +let diff2c_atn_compose = finalize_theorem diff2c_atn_compose;; +let diff2c_acs_compose = finalize_theorem diff2c_acs_compose;; +end_section "Composite";; + +(* Lemma diff2c_add *) +let diff2c_add = section_proof ["f";"g"] +`diff2c f x ==> diff2c g x ==> diff2c (\x. f x + g x) x` +[ + (((repeat_tactic 1 9 (((use_arg_then "diff2c")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["d2f"]) THEN (move ["p2f"]))) THEN (case THEN ((move ["d2g"]) THEN (move ["p2g"])))) THEN (((((use_arg_then "diff2_add")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["j"]))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "p2g") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "j") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then "p2f") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "j") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["p2fij"]) THEN (move ["p2gij"]))); + ((use_arg_then "real_cont_at_local") (thm_tac apply_tac)); + ((((use_arg_then "d2g") (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then "diff2_eq_diff2_on_open")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["d2f"]))); + ((((use_arg_then "diff2_eq_diff2_on_open")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["d2g"])); + (((fun arg_tac -> arg_tac (Arg_term (`(\x. partial2 j i f x + partial2 j i g x)`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac))); + ((THENL_FIRST) ((repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then "REAL_CONTINUOUS_ADD")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac))); + ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))) THEN ((((use_arg_then "second_partial_add")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2g")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma diff2c_sub *) +let diff2c_sub = section_proof ["f";"g"] +`diff2c f x ==> diff2c g x ==> diff2c (\x. f x - g x) x` +[ + ((BETA_TAC THEN (move ["d2f"]) THEN (move ["d2g"])) THEN ((((use_arg_then "real_sub")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2c_add")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "diff2c_neg")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2c_mul *) +let diff2c_mul = section_proof ["f";"g"] +`diff2c f x ==> diff2c g x ==> diff2c (\x. f x * g x) x` +[ + (((repeat_tactic 1 9 (((use_arg_then "diff2c")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["d2f"]) THEN (move ["p2f"]))) THEN (case THEN ((move ["d2g"]) THEN (move ["p2g"])))) THEN (((((use_arg_then "diff2_mul")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["j"]))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "p2g") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "j") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then "p2f") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "j") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["p2fij"]) THEN (move ["p2gij"]))); + ((use_arg_then "real_cont_at_local") (thm_tac apply_tac)); + ((((use_arg_then "d2g") (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((use_arg_then "diff2_eq_diff2_on_open")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["d2f"]))); + ((((use_arg_then "diff2_eq_diff2_on_open")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["d2g"])); + (((fun arg_tac -> arg_tac (Arg_term (`(\x. (partial2 j i f x * g x + partial i f x * partial j g x) + + partial j f x * partial i g x + f x * partial2 j i g x)`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac))); + ((THENL_ROT (-1)) (((repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))) THEN (split_tac))); + ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))) THEN ((((use_arg_then "second_partial_mul")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2g")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then "REAL_CONTINUOUS_ADD")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_CONTINUOUS_MUL")(thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))) THEN ((repeat_tactic 0 10 (((use_arg_then "p2gij")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "p2fij")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then "diff2_imp_partial_cont")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "diff2_imp_cont")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "d2g")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section Point *) +let diff2c_scale = finalize_theorem diff2c_scale;; +let diff2c_neg = finalize_theorem diff2c_neg;; +let nth_diff_strong_eq_on_open = finalize_theorem nth_diff_strong_eq_on_open;; +let diff2_imp_cont = finalize_theorem diff2_imp_cont;; +let diff2_imp_partial_cont = finalize_theorem diff2_imp_partial_cont;; +let diff2c_uni_compose = finalize_theorem diff2c_uni_compose;; +let real_open_delete = finalize_theorem real_open_delete;; +let diff2c_inv_compose = finalize_theorem diff2c_inv_compose;; +let diff2c_sqrt_compose = finalize_theorem diff2c_sqrt_compose;; +let diff2c_atn_compose = finalize_theorem diff2c_atn_compose;; +let diff2c_acs_compose = finalize_theorem diff2c_acs_compose;; +let diff2c_add = finalize_theorem diff2c_add;; +let diff2c_sub = finalize_theorem diff2c_sub;; +let diff2c_mul = finalize_theorem diff2c_mul;; +end_section "Point";; + +(* Section Domain *) +begin_section "Domain";; +(add_section_var (mk_var ("f", (`:real^N -> real`))); add_section_var (mk_var ("g", (`:real^N -> real`))));; +(add_section_hyp "d2f" (`diff2c_domain domain f`));; + +(* Lemma diff2c_domain_scale *) +let diff2c_domain_scale = section_proof ["c"] +`diff2c_domain domain (\x. c * f x)` +[ + ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2c_scale")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2c_domain_neg *) +let diff2c_domain_neg = section_proof [] +`diff2c_domain domain (\x. --f x)` +[ + ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2c_neg")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(add_section_var (mk_var ("bounds", (`:real#real`))));; + +(* Lemma diff2c_domain_inv_compose *) +let diff2c_domain_inv_compose = section_proof [] +`m_bounded_on_int f domain bounds ==> + interval_not_zero bounds ==> diff2c_domain domain (inv o f)` +[ + ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then "m_bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); + (((((use_arg_then "diff2c_inv_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "interval_arith_not_zero") (fun fst_arg -> (fun arg_tac -> (use_arg_then "ineq") (fun fst_arg -> (use_arg_then "x_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2c_domain_sqrt_compose *) +let diff2c_domain_sqrt_compose = section_proof [] +`m_bounded_on_int f domain bounds ==> + interval_pos bounds ==> diff2c_domain domain (sqrt o f)` +[ + ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then "m_bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); + (((((use_arg_then "diff2c_sqrt_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "interval_arith_pos") (fun fst_arg -> (fun arg_tac -> (use_arg_then "ineq") (fun fst_arg -> (use_arg_then "x_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2c_domain_atn_compose *) +let diff2c_domain_atn_compose = section_proof [] +`diff2c_domain domain (atn o f)` +[ + ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2c_atn_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2c_domain_acs_compose *) +let diff2c_domain_acs_compose = section_proof [] +`m_bounded_on_int f domain bounds ==> + iabs bounds < &1 ==> diff2c_domain domain (acs o f)` +[ + ((((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((((use_arg_then "m_bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] [])))))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))); + (((((use_arg_then "diff2c_acs_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "interval_arith_abs") (fun fst_arg -> (fun arg_tac -> (use_arg_then "ineq") (fun fst_arg -> (use_arg_then "x_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(add_section_hyp "d2g" (`diff2c_domain domain g`));; + +(* Lemma diff2c_domain_add *) +let diff2c_domain_add = section_proof [] +`diff2c_domain domain (\x. f x + g x)` +[ + ((((use_arg_then "d2g") (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2c_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2g")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma diff2c_domain_sub *) +let diff2c_domain_sub = section_proof [] +`diff2c_domain domain (\x. f x - g x)` +[ + ((((use_arg_then "d2g") (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2c_sub")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2g")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma diff2c_domain_mul *) +let diff2c_domain_mul = section_proof [] +`diff2c_domain domain (\x. f x * g x)` +[ + ((((use_arg_then "d2g") (disch_tac [])) THEN (clear_assumption "d2g") THEN ((use_arg_then "d2f") (disch_tac [])) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] []))))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then "diff2c_mul")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d2f")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "d2g")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section Domain *) +let diff2c_domain_scale = finalize_theorem diff2c_domain_scale;; +let diff2c_domain_neg = finalize_theorem diff2c_domain_neg;; +let diff2c_domain_inv_compose = finalize_theorem diff2c_domain_inv_compose;; +let diff2c_domain_sqrt_compose = finalize_theorem diff2c_domain_sqrt_compose;; +let diff2c_domain_atn_compose = finalize_theorem diff2c_domain_atn_compose;; +let diff2c_domain_acs_compose = finalize_theorem diff2c_domain_acs_compose;; +let diff2c_domain_add = finalize_theorem diff2c_domain_add;; +let diff2c_domain_sub = finalize_theorem diff2c_domain_sub;; +let diff2c_domain_mul = finalize_theorem diff2c_domain_mul;; +end_section "Domain";; + +(* Finalization of the section Diff2c *) +let real_cont_at_local = finalize_theorem real_cont_at_local;; +let real_cont_atreal_local = finalize_theorem real_cont_atreal_local;; +let diff2c_scale = finalize_theorem diff2c_scale;; +let diff2c_neg = finalize_theorem diff2c_neg;; +let nth_diff_strong_eq_on_open = finalize_theorem nth_diff_strong_eq_on_open;; +let diff2_imp_cont = finalize_theorem diff2_imp_cont;; +let diff2_imp_partial_cont = finalize_theorem diff2_imp_partial_cont;; +let diff2c_uni_compose = finalize_theorem diff2c_uni_compose;; +let real_open_delete = finalize_theorem real_open_delete;; +let diff2c_inv_compose = finalize_theorem diff2c_inv_compose;; +let diff2c_sqrt_compose = finalize_theorem diff2c_sqrt_compose;; +let diff2c_atn_compose = finalize_theorem diff2c_atn_compose;; +let diff2c_acs_compose = finalize_theorem diff2c_acs_compose;; +let diff2c_add = finalize_theorem diff2c_add;; +let diff2c_sub = finalize_theorem diff2c_sub;; +let diff2c_mul = finalize_theorem diff2c_mul;; +let diff2c_domain_scale = finalize_theorem diff2c_domain_scale;; +let diff2c_domain_neg = finalize_theorem diff2c_domain_neg;; +let diff2c_domain_inv_compose = finalize_theorem diff2c_domain_inv_compose;; +let diff2c_domain_sqrt_compose = finalize_theorem diff2c_domain_sqrt_compose;; +let diff2c_domain_atn_compose = finalize_theorem diff2c_domain_atn_compose;; +let diff2c_domain_acs_compose = finalize_theorem diff2c_domain_acs_compose;; +let diff2c_domain_add = finalize_theorem diff2c_domain_add;; +let diff2c_domain_sub = finalize_theorem diff2c_domain_sub;; +let diff2c_domain_mul = finalize_theorem diff2c_domain_mul;; +end_section "Diff2c";; + +(* Section M_LinApprox *) +begin_section "M_LinApprox";; +(add_section_var (mk_var ("f", (`:real^N -> real`))); add_section_var (mk_var ("g", (`:real^N -> real`))));; +(add_section_var (mk_var ("bounds", (`:real#real`))));; +(add_section_var (mk_var ("d_bounds_list", (`:(real#real)list`))));; +(add_section_var (mk_var ("x", (`:real^N`))));; + +(* Lemma m_lin_approx_neg *) +let m_lin_approx_neg = section_proof [] +`(lift o f) differentiable at x ==> + interval_arith (--f x) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (--partial i f x) int) ==> + m_lin_approx (\x. --f x) x bounds d_bounds_list` +[ + (BETA_TAC THEN (move ["df"]) THEN (move ["b"]) THEN (move ["db"])); + ((THENL_FIRST) ((((use_arg_then "m_lin_approx")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "b")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_lift_neg")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_NEG")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac))); + ((ASM_SIMP_TAC[partial_neg]) THEN (done_tac)); +];; + +(* Lemma m_lin_approx_scale *) +let m_lin_approx_scale = section_proof ["c"] +`(lift o f) differentiable at x ==> + interval_arith (c * f x) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (c * partial i f x) int) ==> + m_lin_approx (\x. c * f x) x bounds d_bounds_list` +[ + (BETA_TAC THEN (move ["df"]) THEN (move ["bH"]) THEN (move ["dbH"])); + ((THENL_FIRST) ((((use_arg_then "m_lin_approx")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "bH")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_lift_scale")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_CMUL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac))); + ((ASM_SIMP_TAC[partial_scale]) THEN (done_tac)); +];; + +(* Lemma m_lin_approx_add *) +let m_lin_approx_add = section_proof [] +`(lift o f) differentiable at x ==> + (lift o g) differentiable at x ==> + interval_arith (f x + g x) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (partial i f x + partial i g x) int) ==> + m_lin_approx (\x. f x + g x) x bounds d_bounds_list` +[ + (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["bH"]) THEN (move ["dbH"])); + ((THENL_FIRST) ((((use_arg_then "m_lin_approx")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "bH")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_lift_add")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac))); + ((ASM_SIMP_TAC[partial_add]) THEN (done_tac)); +];; + +(* Lemma m_lin_approx_sub *) +let m_lin_approx_sub = section_proof [] +`(lift o f) differentiable at x ==> + (lift o g) differentiable at x ==> + interval_arith (f x - g x) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (partial i f x - partial i g x) int) ==> + m_lin_approx (\x. f x - g x) x bounds d_bounds_list` +[ + (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["bH"]) THEN (move ["dbH"])); + ((THENL_FIRST) ((((use_arg_then "m_lin_approx")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "bH")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f_lift_sub")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "DIFFERENTIABLE_SUB")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac))); + ((ASM_SIMP_TAC[partial_sub]) THEN (done_tac)); +];; + +(* Lemma m_lin_approx_mul *) +let m_lin_approx_mul = section_proof [] +`(lift o f) differentiable at x ==> + (lift o g) differentiable at x ==> + interval_arith (f x * g x) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (partial i f x * g x + f x * partial i g x) int) ==> + m_lin_approx (\x. f x * g x) x bounds d_bounds_list` +[ + (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["bH"]) THEN (move ["dbH"])); + ((((use_arg_then "m_lin_approx")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "bH")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "differentiable_mul")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + ((ASM_SIMP_TAC[partial_mul]) THEN (done_tac)); +];; + +(* Finalization of the section M_LinApprox *) +let m_lin_approx_neg = finalize_theorem m_lin_approx_neg;; +let m_lin_approx_scale = finalize_theorem m_lin_approx_scale;; +let m_lin_approx_add = finalize_theorem m_lin_approx_add;; +let m_lin_approx_sub = finalize_theorem m_lin_approx_sub;; +let m_lin_approx_mul = finalize_theorem m_lin_approx_mul;; +end_section "M_LinApprox";; +let second_bounded = new_definition `second_bounded f domain dd_bounds_list <=> + !x. x IN interval [domain] ==> all_n 1 dd_bounds_list + (\i list_i. all_n 1 list_i (\j int. interval_arith (partial2 j i f x) int))`;; +let m_taylor_interval = + new_definition `m_taylor_interval f domain y w f_bounds d_bounds_list dd_bounds_list <=> + m_cell_domain domain y w /\ + diff2c_domain domain f /\ + m_lin_approx f y f_bounds d_bounds_list /\ + second_bounded f domain dd_bounds_list`;; + +(* Section M_TaylorIntervalArith *) +begin_section "M_TaylorIntervalArith";; +(add_section_var (mk_var ("f", (`:real^N -> real`))); add_section_var (mk_var ("g", (`:real^N -> real`))));; +(add_section_var (mk_var ("x", (`:real^N`))); add_section_var (mk_var ("z", (`:real^N`))); add_section_var (mk_var ("y", (`:real^N`))); add_section_var (mk_var ("w", (`:real^N`))));; +(add_section_var (mk_var ("domain", (`:real^N#real^N`))));; +(add_section_var (mk_var ("f_bounds", (`:real#real`))); add_section_var (mk_var ("g_bounds", (`:real#real`))); add_section_var (mk_var ("bounds", (`:real#real`))));; +(add_section_var (mk_var ("df_bounds_list", (`:(real#real)list`))); add_section_var (mk_var ("dg_bounds_list", (`:(real#real)list`))); add_section_var (mk_var ("d_bounds_list", (`:(real#real)list`))));; +(add_section_var (mk_var ("ddf_bounds_list", (`:((real#real)list)list`))); add_section_var (mk_var ("ddg_bounds_list", (`:((real#real)list)list`))); add_section_var (mk_var ("dd_bounds_list", (`:((real#real)list)list`))));; +(add_section_hyp "domainH" (`m_cell_domain domain y w`));; +(add_section_hyp "d2f" (`diff2c_domain domain f`));; + +(* Lemma m_taylor_inv_compose *) +let m_taylor_inv_compose = section_proof [] +`m_bounded_on_int f domain f_bounds ==> interval_not_zero f_bounds ==> + m_lin_approx (inv o f) y bounds d_bounds_list ==> + second_bounded (inv o f) domain dd_bounds_list ==> + m_taylor_interval (inv o f) domain y w bounds d_bounds_list dd_bounds_list` +[ + ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then "m_taylor_interval")(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "diff2c_domain_inv_compose") (fun fst_arg -> (use_arg_then "d2f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "bf") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma m_taylor_sqrt_compose *) +let m_taylor_sqrt_compose = section_proof [] +`m_bounded_on_int f domain f_bounds ==> interval_pos f_bounds ==> + m_lin_approx (sqrt o f) y bounds d_bounds_list ==> + second_bounded (sqrt o f) domain dd_bounds_list ==> + m_taylor_interval (sqrt o f) domain y w bounds d_bounds_list dd_bounds_list` +[ + ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then "m_taylor_interval")(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "diff2c_domain_sqrt_compose") (fun fst_arg -> (use_arg_then "d2f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "bf") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma m_taylor_atn_compose *) +let m_taylor_atn_compose = section_proof [] +`m_lin_approx (atn o f) y bounds d_bounds_list ==> + second_bounded (atn o f) domain dd_bounds_list ==> + m_taylor_interval (atn o f) domain y w bounds d_bounds_list dd_bounds_list` +[ + ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then "m_taylor_interval")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2c_domain_atn_compose")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma m_taylor_acs_compose *) +let m_taylor_acs_compose = section_proof [] +`m_bounded_on_int f domain f_bounds ==> iabs f_bounds < &1 ==> + m_lin_approx (acs o f) y bounds d_bounds_list ==> + second_bounded (acs o f) domain dd_bounds_list ==> + m_taylor_interval (acs o f) domain y w bounds d_bounds_list dd_bounds_list` +[ + ((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN (((use_arg_then "m_taylor_interval")(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "diff2c_domain_acs_compose") (fun fst_arg -> (use_arg_then "d2f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "bf") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma m_taylor_neg *) +let m_taylor_neg = section_proof [] +`m_lin_approx (\x. --f x) y bounds d_bounds_list ==> + second_bounded (\x. --f x) domain dd_bounds_list ==> + m_taylor_interval (\x. --f x) domain y w bounds d_bounds_list dd_bounds_list` +[ + ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then "m_taylor_interval")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2c_domain_neg")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma m_taylor_scale *) +let m_taylor_scale = section_proof ["c"] +`m_lin_approx (\x. c * f x) y bounds d_bounds_list ==> + second_bounded (\x. c * f x) domain dd_bounds_list ==> + m_taylor_interval (\x. c * f x) domain y w bounds d_bounds_list dd_bounds_list` +[ + ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then "m_taylor_interval")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2c_domain_scale")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(add_section_hyp "d2g" (`diff2c_domain domain g`));; + +(* Lemma m_taylor_add *) +let m_taylor_add = section_proof [] +`m_lin_approx (\x. f x + g x) y bounds d_bounds_list ==> + second_bounded (\x. f x + g x) domain dd_bounds_list ==> + m_taylor_interval (\x. f x + g x) domain y w bounds d_bounds_list dd_bounds_list` +[ + ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then "m_taylor_interval")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2c_domain_add")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma m_taylor_sub *) +let m_taylor_sub = section_proof [] +`m_lin_approx (\x. f x - g x) y bounds d_bounds_list ==> + second_bounded (\x. f x - g x) domain dd_bounds_list ==> + m_taylor_interval (\x. f x - g x) domain y w bounds d_bounds_list dd_bounds_list` +[ + ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then "m_taylor_interval")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2c_domain_sub")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma m_taylor_mul *) +let m_taylor_mul = section_proof [] +`m_lin_approx (\x. f x * g x) y bounds d_bounds_list ==> + second_bounded (\x. f x * g x) domain dd_bounds_list ==> + m_taylor_interval (\x. f x * g x) domain y w bounds d_bounds_list dd_bounds_list` +[ + ((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN ((((use_arg_then "m_taylor_interval")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2c_domain_mul")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section M_TaylorIntervalArith *) +let m_taylor_inv_compose = finalize_theorem m_taylor_inv_compose;; +let m_taylor_sqrt_compose = finalize_theorem m_taylor_sqrt_compose;; +let m_taylor_atn_compose = finalize_theorem m_taylor_atn_compose;; +let m_taylor_acs_compose = finalize_theorem m_taylor_acs_compose;; +let m_taylor_neg = finalize_theorem m_taylor_neg;; +let m_taylor_scale = finalize_theorem m_taylor_scale;; +let m_taylor_add = finalize_theorem m_taylor_add;; +let m_taylor_sub = finalize_theorem m_taylor_sub;; +let m_taylor_mul = finalize_theorem m_taylor_mul;; +end_section "M_TaylorIntervalArith";; + +(* Section PartialConvex *) +begin_section "PartialConvex";; +(add_section_type (mk_var ("f", (`:real^N->real`))));; + +(* Lemma REAL_LE_DIV_1 *) +let REAL_LE_DIV_1 = section_proof ["a";"b"] +`&0 < b ==> (a / b <= &1 <=> a <= b)` +[ + ((BETA_TAC THEN (move ["b_gt"])) THEN ((((use_arg_then "REAL_LE_LDIV_EQ")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_MUL_LID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma partial_convex_max *) +let partial_convex_max = section_proof ["f";"j";"x";"z";"u";"v";"hi"] +`(!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = z$i /\ v$i = x$i) ==> + u$j = x$j ==> v$j = z$j ==> + diff2_domain (x,z) f ==> + (!y. y IN interval [x,z] ==> &0 <= partial2 j j f y) ==> + (!y. y IN interval [x,u] ==> f y <= hi) ==> + (!y. y IN interval [v,z] ==> f y <= hi) ==> + (!y. y IN interval [x,z] ==> f y <= hi)` +[ + ((((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (move ["uv_eq"]) THEN (move ["ux_eq"]) THEN (move ["vz_eq"])); + ((((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))) THEN (move ["diff2_f"]) THEN (move ["partial2_pos"]) THEN (move ["bound1"]) THEN (move ["bound2"]) THEN (move ["y"]) THEN (move ["y_in"])); + ((fun arg_tac -> arg_tac (Arg_term (`(lambda i. if i = j then x$j else y$i):real^N`))) (term_tac (set_tac "y1"))); + ((fun arg_tac -> arg_tac (Arg_term (`(lambda i. if i = j then z$j else y$i):real^N`))) (term_tac (set_tac "y2"))); + ((((use_arg_then "y_in") (disch_tac [])) THEN (clear_assumption "y_in") THEN BETA_TAC) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] [])))) THEN (move ["y_in"]))); + ((fun arg_tac -> arg_tac (Arg_term (`y1 IN interval [x,u] /\ y2 IN interval [v,z]`))) (term_tac (have_gen_tac [](case THEN ((move ["y1_in"]) THEN (move ["y2_in"])))))); + ((((use_arg_then "y1_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "y2_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] [])))))); + (((split_tac) THEN (move ["i"]) THEN (move ["i_ineq"])) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i = j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ij"])) THEN ((repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then "ux_eq")(fun tmp_arg1 -> (use_arg_then "vz_eq")(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN ((((use_arg_then "uv_eq")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "y_in")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`j IN 1..dimindex (:N)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case)) THEN ((((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (move ["j_in"]))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`y1 = y`))) (term_tac (have_gen_tac []ALL_TAC)))) ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "bound1") (disch_tac [])) THEN (clear_assumption "bound1") THEN (DISCH_THEN apply_tac)) THEN (done_tac))); + ((((use_arg_then "CART_EQ")(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["i_in"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(i = j)`))) (term_tac (have_gen_tac [](move ["inj"])))) ((((use_arg_then "i_in") (disch_tac [])) THEN (clear_assumption "i_in") THEN ((use_arg_then "j_in") (disch_tac [])) THEN (clear_assumption "j_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then "y1_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`f y <= max (f y1) (f y2)`))) (term_tac (have_gen_tac []ALL_TAC)))); + (BETA_TAC THEN (move ["cond"])); + (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))) (fun fst_arg -> (use_arg_then "cond") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((((fun arg_tac -> (use_arg_then "bound2") (fun fst_arg -> (use_arg_then "y2_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then "bound1") (fun fst_arg -> (use_arg_then "y1_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`f o (\t. y1 + t % basis j)`))) (term_tac (set_tac "g"))); + ((fun arg_tac -> arg_tac (Arg_term (`f y1 = g (&0)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_ADD_RID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`y = y1 + (y$j - x$j) % basis j /\ y2 = y1 + (z$j - x$j) % basis j`))) (term_tac (have_gen_tac [](move ["y_eq"])))); + ((repeat_tactic 1 9 (((use_arg_then "CART_EQ")(thm_tac (new_rewrite [] []))))) THEN ((split_tac) THEN (move ["i"]) THEN (move ["i_in"])) THEN ((((use_arg_then "VECTOR_ADD_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_MUL_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "BASIS_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i = j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ij"])) THEN ((repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then "y1_def")(fun tmp_arg1 -> (use_arg_then "y2_def")(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_SUB_ADD2")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then "ij")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then "ij")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`f y = g (y$j - x$j)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) (((((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "y_eq")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`f y2 = g (z$j - x$j)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) (((((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "y_eq")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + (((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`z$j = x$j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["zx_j"])); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`y$j = x$j`))) (term_tac (have_gen_tac []ALL_TAC)))) ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then "zx_j")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_SUB_REFL")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then "y_in") (fun fst_arg -> (use_arg_then "j_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then "zx_j")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(y$j - x$j) / (z$j - x$j)`))) (term_tac (set_tac "t"))); + ((fun arg_tac -> arg_tac (Arg_term (`&0 < z$j - x$j`))) (term_tac (have_gen_tac [](move ["zx_pos"])))); + ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b. &0 < a - b <=> ~(a = b) /\ b <= a`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "zx_j")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then "REAL_LE_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`y$j`))) (term_tac exists_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "y_in")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`&0 <= t /\ t <= &1 /\ y$j - x$j = (&1 - t) * &0 + t * (z$j - x$j)`))) (term_tac (have_gen_tac [](move ["t_props"])))); + ((((use_arg_then "t_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_DIV_1")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_MUL_RZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ADD_LID")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "real_div")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_MUL_ASSOC)))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "REAL_MUL_LINV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_SUB_0")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((repeat_tactic 1 9 (((use_arg_then "real_sub")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_RADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "y_in")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "real_sub")(gsym_then (thm_tac (new_rewrite [] []))))))); + ((THENL_FIRST) ((((use_arg_then "REAL_LE_MUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_INV")(thm_tac (new_rewrite [] []))))) ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. &0 < a ==> &0 <= a`)))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((((use_arg_then "REAL_SUB_LE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "y_in")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "t_props")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONVEX_LOWER))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`real_interval [&0, z$j - x$j]`))) (term_tac exists_tac)); + ((((use_arg_then "REAL_SUB_ADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_SUB_LE")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "t_props")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. &0 < a ==> &0 <= a`)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`real_interval _`))) (term_tac (set_tac "s"))) THEN (((use_arg_then "t_props") (disch_tac [])) THEN (clear_assumption "t_props") THEN ((use_arg_then "t_def") (disch_tac [])) THEN (clear_assumption "t_def") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]))); + ((fun arg_tac -> arg_tac (Arg_term (`!t. t IN s ==> y1 + t % basis j IN interval [x,z]`))) (term_tac (have_gen_tac [](move ["in_s"])))); + (((((use_arg_then "s_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IN_INTERVAL)))(thm_tac (new_rewrite [] []))))) THEN (move ["t"]) THEN (move ["t_ineq"]) THEN (move ["i"]) THEN (move ["i_ineq"])); + ((repeat_tactic 1 9 (((use_arg_then "VECTOR_ADD_COMPONENT")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "VECTOR_MUL_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "BASIS_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then "y1_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL LAMBDA_BETA)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); + ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i = j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ij"]))); + (((((use_arg_then "REAL_MUL_RZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "y_in")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then "t_ineq") (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((fun arg_tac -> (use_arg_then "y_in") (fun fst_arg -> (use_arg_then "i_ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then "ij")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!t. t IN s ==> nth_diff_strong 2 g t`))) (term_tac (have_gen_tac [](move ["diff2_g"])))); + ((BETA_TAC THEN (move ["t"]) THEN (move ["ts"])) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then "diff2_dir")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_f")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "in_s")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!t. t IN s ==> derivative g t = partial j f (y1 + t % basis j)`))) (term_tac (have_gen_tac [](move ["dg"])))); + ((BETA_TAC THEN (move ["t"]) THEN (move ["ts"])) THEN (((use_arg_then "partial")(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then "in_s") (fun fst_arg -> (use_arg_then "ts") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["p_in"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`f o _`))) (term_tac (set_tac "h")))); + ((fun arg_tac -> arg_tac (Arg_term (`h = g o (\t'. t + t')`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "h_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["r"])) THEN ((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_RDISTRIB)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_ADD_ASSOC)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "derivative_translation")(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then "diff2_g") (fun fst_arg -> (use_arg_then "ts") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then "nth_diff_strong2_eq")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["e"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["te"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!t. t IN s ==> nth_derivative 2 g t = partial2 j j f (y1 + t % basis j)`))) (term_tac (have_gen_tac [](move ["d2g"])))); + ((BETA_TAC THEN (move ["t"]) THEN (move ["ts"])) THEN ((((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "diff2_dir_derivative2")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "diff2_f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "in_s")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((fun arg_tac -> arg_tac (Arg_term (`1..dimindex (:N) = ((1..dimindex (:N)) DELETE j) UNION {j}`))) (term_tac (have_gen_tac [](move ["s_eq"])))); + ((((((use_arg_then "EXTENSION")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_UNION")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_SING")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_DELETE")(thm_tac (new_rewrite [] []))))) THEN (move ["i"])) THEN (split_tac)); + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "orNb")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((case THEN (simp_tac)) THEN (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`DISJOINT ((1..dimindex (:N)) DELETE j) {j}`))) (term_tac (have_gen_tac [](move ["disj"])))); + (((((use_arg_then "DISJOINT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "EXTENSION")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_SING")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "NOT_IN_EMPTY")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_DELETE")(thm_tac (new_rewrite [] []))))) THEN (move ["i"])); + (((((use_arg_then "andbA")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "andNb")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbF")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "s_eq")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "SUM_UNION")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_DELETE")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_SING")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "SUM_SING")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then "SUM_EQ_0")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "IN_DELETE")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_ADD_LID")(thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (move ["i"]) THEN (move ["i_in"])) THEN (((use_arg_then "SUM_EQ_0") (thm_tac apply_tac)) THEN (move ["k"]) THEN (move ["k_in"]) THEN (simp_tac))); + (((((use_arg_then "BASIS_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "IN_NUMSEG")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then "i_in")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "REAL_MUL_LZERO")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "s_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUM_UNION")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_DELETE")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_SING")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "SUM_SING")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then "SUM_EQ_0")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "IN_DELETE")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_ADD_LID")(thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (move ["i"]) THEN (move ["i_in"]) THEN (simp_tac)) THEN (((use_arg_then "REAL_ENTIRE")(thm_tac (new_rewrite [] [])))) THEN (DISJ2_TAC)); + (((((use_arg_then "BASIS_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "IN_NUMSEG")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then "i_in")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "REAL_MUL_LZERO")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then "BASIS_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "j_in")(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_LID")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "partial2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "REAL_CONVEX_ON_SECOND_DERIVATIVE") (fun fst_arg -> (use_arg_then "g") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative g`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`nth_derivative 2 g`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "s") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((THENL_ROT (-1)) (((((use_arg_then "s_def")(gsym_then (thm_tac (new_rewrite [1; 2] []))))) THEN (((use_arg_then "IS_REALINTERVAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "NOT_EXISTS_THM")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (move ["t"]) THEN (move ["ts"])) THEN ((((use_arg_then "d2g")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "partial2_pos")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "in_s")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (split_tac); + ((BETA_TAC THEN (move ["t"])) THEN (((use_arg_then "contraT") (disch_tac [])) THEN (clear_assumption "contraT") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then "negbK")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "EXTENSION")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_SING")(thm_tac (new_rewrite [] []))))) THEN (move ["eq"]))); + ((((use_arg_then "zx_pos") (disch_tac [])) THEN (clear_assumption "zx_pos") THEN ((fun arg_tac -> (use_arg_then "eq") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`z$j - x$j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then "eq") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))))); + ((arith_tac) THEN (done_tac)); + ((split_tac) THEN (move ["t"]) THEN (move ["ts"])); + ((((fun arg_tac -> (use_arg_then "diff2_g") (fun fst_arg -> (use_arg_then "ts") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then "nth_diff_strong2_eq_alt")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["e"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["te"])) THEN (move ["H"]))); + (((((use_arg_then "HAS_REAL_DERIVATIVE_ATREAL_WITHIN")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "H")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then "diff2_g") (fun fst_arg -> (use_arg_then "ts") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then "nth_diff_strong2_eq_alt")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["e"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["te"])) THEN (move ["H"]))); + (((((use_arg_then "HAS_REAL_DERIVATIVE_ATREAL_WITHIN")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "H")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section PartialConvex *) +let REAL_LE_DIV_1 = finalize_theorem REAL_LE_DIV_1;; +let partial_convex_max = finalize_theorem partial_convex_max;; +end_section "PartialConvex";; + +(* Section ElementaryFunctions *) +begin_section "ElementaryFunctions";; + +(* Lemma f_lift_const *) +let f_lift_const = section_proof ["c"] +`lift o (\x. c) = (\x. lift c)` +[ + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma f_lift_unary *) +let f_lift_unary = section_proof ["f"] +`lift o (\x. f x) = (\x. lift (f x))` +[ + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_const *) +let diff2_const = section_proof ["c";"x"] +`diff2 (\x:real^N. c) x` +[ + ((((use_arg_then "diff2")(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`(:real^N)`))) (term_tac exists_tac)) THEN (((((use_arg_then "OPEN_UNIV")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_UNIV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (move ["_"]))); + (((((use_arg_then "partial_const")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "f_lift_const")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma diff2_domain_const *) +let diff2_domain_const = section_proof ["c";"domain"] +`diff2_domain domain (\x:real^N. c)` +[ + (((((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_const")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma partial2_const *) +let partial2_const = section_proof ["i";"j";"c"] +`partial2 i j (\x:real^N. c) = (\x. &0)` +[ + (((((use_arg_then "partial2")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "partial_const")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma diff2c_const *) +let diff2c_const = section_proof ["c";"x"] +`diff2c (\x:real^N. c) x` +[ + (((((use_arg_then "diff2c")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_const")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "partial2_const")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_CONTINUOUS_CONST")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2c_domain_const *) +let diff2c_domain_const = section_proof ["c";"domain"] +`diff2c_domain domain (\x:real^N. c)` +[ + (((((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2c_const")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma partial_x_lemma *) +let partial_x_lemma = section_proof ["k";"i"] +`partial i (\x:real^N. x$k) = (\x. (basis i:real^N)$k)` +[ + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "partial")(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (simp_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(\x. x$k) o (\t. x + t % basis i) = (\t. x$k + t * (basis i:real^N)$k)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "VECTOR_ADD_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "VECTOR_MUL_COMPONENT")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "derivative_add")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_MUL_ATREAL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then "REAL_DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "derivative_const")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "derivative_mul")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then "derivative_x")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "derivative_const")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma partial_x *) +let partial_x = section_proof ["k";"i"] +`k IN 1..dimindex (:N) ==> + partial i (\x:real^N. x$k) = (\x. if i = k then &1 else &0)` +[ + ((BETA_TAC THEN (move ["k_ineq"])) THEN ((((use_arg_then "partial_x_lemma")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "BASIS_COMPONENT")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "IN_NUMSEG")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma partial2_x *) +let partial2_x = section_proof ["k";"i";"j"] +`partial2 i j (\x:real^N. x$k) = (\x. &0)` +[ + (((((use_arg_then "partial2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "partial_x_lemma")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "partial_const")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_x *) +let diff2_x = section_proof ["k";"x"] +`k IN 1..dimindex (:N) ==> diff2 (\x:real^N. x$k) x` +[ + ((BETA_TAC THEN (move ["k_ineq"])) THEN (((use_arg_then "diff2")(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`(:real^N)`))) (term_tac exists_tac)) THEN (((((use_arg_then "OPEN_UNIV")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_UNIV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (move ["_"]))); + (((((use_arg_then "projection_diff")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "partial_x_lemma")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "f_lift_unary")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_domain_x *) +let diff2_domain_x = section_proof ["k";"domain"] +`k IN 1..dimindex (:N) ==> diff2_domain domain (\x:real^N. x$k)` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then "diff2_x") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then "diff2_domain")(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2c_x *) +let diff2c_x = section_proof ["k";"x"] +`k IN 1..dimindex (:N) ==> diff2c (\x:real^N. x$k) x` +[ + ((BETA_TAC THEN (move ["k_ineq"])) THEN ((((use_arg_then "diff2c")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_x")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "partial2_x")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_CONST")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2c_domain_x *) +let diff2c_domain_x = section_proof ["k";"domain"] +`k IN 1..dimindex (:N) ==> diff2c_domain domain (\x:real^N. x$k)` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then "diff2c_x") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then "diff2c_domain")(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section ElementaryFunctions *) +let f_lift_const = finalize_theorem f_lift_const;; +let f_lift_unary = finalize_theorem f_lift_unary;; +let diff2_const = finalize_theorem diff2_const;; +let diff2_domain_const = finalize_theorem diff2_domain_const;; +let partial2_const = finalize_theorem partial2_const;; +let diff2c_const = finalize_theorem diff2c_const;; +let diff2c_domain_const = finalize_theorem diff2c_domain_const;; +let partial_x_lemma = finalize_theorem partial_x_lemma;; +let partial_x = finalize_theorem partial_x;; +let partial2_x = finalize_theorem partial2_x;; +let diff2_x = finalize_theorem diff2_x;; +let diff2_domain_x = finalize_theorem diff2_domain_x;; +let diff2c_x = finalize_theorem diff2c_x;; +let diff2c_domain_x = finalize_theorem diff2c_domain_x;; +end_section "ElementaryFunctions";; diff --git a/formal_ineqs/taylor/theory/taylor_interval-compiled.hl b/formal_ineqs/taylor/theory/taylor_interval-compiled.hl new file mode 100644 index 0000000..c3527d1 --- /dev/null +++ b/formal_ineqs/taylor/theory/taylor_interval-compiled.hl @@ -0,0 +1,2464 @@ +needs "lib/ssrbool-compiled.hl";; +needs "lib/ssrnat-compiled.hl";; +needs "arith/interval_arith.hl";; +needs "Multivariate/realanalysis.ml";; +open Interval_arith;; +prioritize_real();; +let derivative = new_definition `derivative f = \y. @d. (f has_real_derivative d) (atreal y)`;; +let nth_derivative = new_definition `nth_derivative n f = iter n derivative f`;; +let nth_differentiable = define `(nth_differentiable 0 f x <=> f real_continuous atreal x) /\ + (nth_differentiable (SUC n) f x <=> nth_differentiable n f x /\ + nth_derivative n f real_differentiable atreal x)`;; +let nth_differentiable_on = new_definition `nth_differentiable_on n s f <=> + !x. x IN s ==> nth_differentiable n f x`;; +let nth_differentiable_on_int = new_definition `nth_differentiable_on_int n int f <=> + !x. interval_arith x int ==> nth_differentiable n f x`;; +let nth_diff_weak = new_definition `nth_diff_weak n f x <=> f real_continuous atreal x /\ + ?F. F 0 = f /\ !i. i < n ==> (F i has_real_derivative F (SUC i) x) (atreal x)`;; +let nth_diff_strong = new_definition `nth_diff_strong n f x <=> + ?s. real_open s /\ x IN s /\ nth_differentiable_on n s f`;; +let nth_diff_strong_int = new_definition `nth_diff_strong_int n int f <=> + !x. interval_arith x int ==> nth_diff_strong n f x`;; + +(* Section NthDerivatives *) +begin_section "NthDerivatives";; + +(* Lemma has_derivative_cond *) +let has_derivative_cond = section_proof ["f";"x"] +`(?d. (f has_real_derivative d) (atreal x)) ==> + (f has_real_derivative (derivative f x)) (atreal x)` +[ + (BETA_TAC THEN (case THEN (move ["d"])) THEN (move ["df"])); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`derivative f x = d`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) (exact_tac)); + (((((use_arg_then "derivative")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then "SELECT_UNIQUE") (thm_tac apply_tac)) THEN (simp_tac) THEN (move ["y"])) THEN ((THENL) (split_tac) [(move ["df2"]); ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "REAL_DERIVATIVE_UNIQUE_ATREAL") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "x") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (done_tac)); +];; + +(* Lemma has_derivative_alt *) +let has_derivative_alt = section_proof ["f";"x"] +`f real_differentiable atreal x ==> + (f has_real_derivative (derivative f x)) (atreal x)` +[ + (((((use_arg_then "real_differentiable")(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "has_derivative_cond") (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Lemma derivative_unique *) +let derivative_unique = section_proof ["f";"f'";"x"] +`(f has_real_derivative f') (atreal x) ==> derivative f x = f'` +[ + ((BETA_TAC THEN (move ["df"])) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then "REAL_DERIVATIVE_UNIQUE_ATREAL") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "x") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + (((((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "has_derivative_cond")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((use_arg_then "f'") (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma derivative_unique_on *) +let derivative_unique_on = section_proof ["s";"f";"f'"] +`(!x. x IN s ==> (f has_real_derivative f' x) (atreal x)) ==> + (!x. x IN s ==> f' x = derivative f x)` +[ + (BETA_TAC THEN (move ["df"]) THEN (move ["x"]) THEN (move ["xs"])); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then "derivative_unique") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f' x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma has_derivative_lemma *) +let has_derivative_lemma = section_proof ["f";"f'";"x"] +`f real_differentiable atreal x /\ + derivative f x = f' ==> + (f has_real_derivative f') (atreal x)` +[ + ((BETA_TAC THEN (case THEN ((move ["diff"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))))) THEN (((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma nth_derivative0 *) +let nth_derivative0 = section_proof ["f"] +`nth_derivative 0 f = f` +[ + (((((use_arg_then "nth_derivative")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL iter)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_derivativeS *) +let nth_derivativeS = section_proof ["n";"f"] +`nth_derivative (SUC n) f = derivative (nth_derivative n f)` +[ + (((repeat_tactic 1 9 (((use_arg_then "nth_derivative")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "iterS")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_Sderivative *) +let nth_Sderivative = section_proof ["n";"f"] +`nth_derivative (SUC n) f = nth_derivative n (derivative f)` +[ + (((((use_arg_then "nth_derivative")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "iterSr")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_derivative")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma nth_derivative1 *) +let nth_derivative1 = section_proof ["f"] +`nth_derivative 1 f = derivative f` +[ + (((((use_arg_then "ONE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_derivativeS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_derivative0")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_derivative2 *) +let nth_derivative2 = section_proof ["f"] +`nth_derivative 2 f = derivative (derivative f)` +[ + (((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `2 = SUC(SUC 0)`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_derivative")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "iterS")(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL iter)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_derivative_add *) +let nth_derivative_add = section_proof ["n";"m";"f"] +`nth_derivative n (nth_derivative m f) = nth_derivative (n + m) f` +[ + (((repeat_tactic 1 9 (((use_arg_then "nth_derivative")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "iter_add")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_diff_continuous *) +let nth_diff_continuous = section_proof ["n";"f";"x"] +`nth_differentiable n f x ==> + f real_continuous atreal x` +[ + (((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((((use_arg_then "nth_differentiable")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((BETA_TAC THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then "IHn") (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma nth_differentiable_cond *) +let nth_differentiable_cond = section_proof ["n";"f";"x"] +`nth_differentiable n f x ==> + !i. i < n ==> (nth_derivative i f has_real_derivative (nth_derivative (SUC i) f x)) (atreal x)` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) ((((use_arg_then "ltn0")(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then "nth_differentiable")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((DISCH_THEN (fun snd_th -> (use_arg_then "IHn") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["df_n"]) THEN (move ["dfn"]))) THEN (move ["i"])); + (((((use_arg_then "ltE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leqSS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leq_eqVlt")(thm_tac (new_rewrite [] []))))) THEN ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); ((DISCH_THEN (fun snd_th -> (use_arg_then "df_n") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN ((TRY done_tac)))])); + (((((use_arg_then "nth_derivativeS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_differentiable_on_cond *) +let nth_differentiable_on_cond = section_proof ["n";"s";"f"] +`nth_differentiable_on n s f ==> + !x. x IN s ==> + !i. i < n ==> (nth_derivative i f has_real_derivative (nth_derivative (SUC i) f x)) (atreal x)` +[ + ((((use_arg_then "nth_differentiable_on")(thm_tac (new_rewrite [] [])))) THEN (move ["cond"]) THEN (move ["x"])); + (((DISCH_THEN (fun snd_th -> (use_arg_then "cond") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then "nth_differentiable_cond") (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Lemma nth_differentiable_eq *) +let nth_differentiable_eq = section_proof ["n";"f";"x"] +`nth_differentiable n f x <=> + f real_continuous atreal x /\ + !i. i < n ==> (nth_derivative i f has_real_derivative (nth_derivative (SUC i) f x)) (atreal x)` +[ + ((THENL) (split_tac) [(move ["dn_f"]); (case THEN (move ["f_cont"]))]); + (((((fun arg_tac -> (use_arg_then "nth_diff_continuous") (fun fst_arg -> (use_arg_then "dn_f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "nth_differentiable_cond") (disch_tac [])) THEN (clear_assumption "nth_differentiable_cond") THEN (exact_tac)) THEN (done_tac)); + (((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN (((((use_arg_then "nth_differentiable")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "ltE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leqSS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leq_eqVlt")(thm_tac (new_rewrite [] []))))) THEN (move ["cond"]))); + ((THENL_FIRST) ((((use_arg_then "IHn")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) ((BETA_TAC THEN (move ["i"]) THEN (move ["i_lt_n"])) THEN (((use_arg_then "cond") (disch_tac [])) THEN (clear_assumption "cond") THEN (DISCH_THEN apply_tac)) THEN (done_tac))); + ((((use_arg_then "real_differentiable")(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`nth_derivative (SUC n) f x`))) (term_tac exists_tac))); + (((use_arg_then "cond") (disch_tac [])) THEN (clear_assumption "cond") THEN (exact_tac)); +];; + +(* Lemma nth_differentiable_on_int2 *) +let nth_differentiable_on_int2 = section_proof ["f";"int"] +`nth_differentiable_on_int 2 int f ==> + ?f' f''. f' = derivative f /\ f'' = nth_derivative 2 f /\ + !x. interval_arith x int ==> (f has_real_derivative f' x) (atreal x) /\ + (f' has_real_derivative f'' x) (atreal x)` +[ + ((((use_arg_then "nth_differentiable_on_int")(thm_tac (new_rewrite [] [])))) THEN (move ["h"])); + ((((fun arg_tac -> arg_tac (Arg_term (`derivative f`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`nth_derivative 2 f`))) (term_tac exists_tac))) THEN (simp_tac) THEN (move ["x"]) THEN (move ["ineq"])); + ((((use_arg_then "nth_derivative1")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then "nth_derivative0") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then "ONE")(thm_tac (new_rewrite [1] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `2 = SUC 1`)))(thm_tac (new_rewrite [] []))))); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then "nth_differentiable_cond") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "h")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma nth_mth_diff *) +let nth_mth_diff = section_proof ["n";"m";"f";"x"] +`n <= m ==> nth_differentiable m f x ==> nth_differentiable n f x` +[ + ((BETA_TAC THEN (move ["n_le_m"])) THEN ((repeat_tactic 1 9 (((use_arg_then "nth_differentiable_eq")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["cond"])))) THEN ((((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["i_lt"]))); + ((((use_arg_then "cond") (disch_tac [])) THEN (clear_assumption "cond") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "n_le_m") (disch_tac [])) THEN (clear_assumption "n_le_m") THEN ((use_arg_then "ltn_leq_trans") (disch_tac [])) THEN (clear_assumption "ltn_leq_trans") THEN (DISCH_THEN apply_tac)) THEN (done_tac)); +];; + +(* Lemma nth_differentiable1 *) +let nth_differentiable1 = section_proof ["f";"x"] +`nth_differentiable 1 f x <=> f real_differentiable atreal x` +[ + (((((use_arg_then "ONE")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL nth_differentiable)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "nth_derivative0")(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (move ["df"])])); + ((((use_arg_then "REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma nth_diff_imp_diff *) +let nth_diff_imp_diff = section_proof ["n";"f";"x"] +`0 < n ==> nth_differentiable n f x ==> + f real_differentiable atreal x` +[ + ((((((use_arg_then "ltE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ONE")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["ineq"]) THEN (move ["df"])) THEN (((use_arg_then "nth_differentiable1")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "nth_mth_diff") (disch_tac [])) THEN (clear_assumption "nth_mth_diff") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then "n") (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma nth_derivative_continuous *) +let nth_derivative_continuous = section_proof ["n";"f";"x";"i"] +`nth_differentiable n f x ==> i < n ==> + nth_derivative i f real_continuous atreal x` +[ + ((((use_arg_then "nth_differentiable_eq")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (move ["df"])); + (((DISCH_THEN (fun snd_th -> (use_arg_then "df") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["cond"])) THEN (((use_arg_then "REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL") (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL") THEN (DISCH_THEN apply_tac))); + ((((use_arg_then "real_differentiable")(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`nth_derivative (SUC i) f x`))) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma ith_derivative_differentiable *) +let ith_derivative_differentiable = section_proof ["i";"n";"f";"x"] +`nth_differentiable n f x ==> i < n ==> + nth_differentiable (n - i) (nth_derivative i f) x` +[ + (BETA_TAC THEN (move ["dnf"])); + ((((use_arg_then "dnf") (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "nth_differentiable_eq")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (move ["cond"]) THEN (move ["i_lt_n"]))); + (((((fun arg_tac -> (use_arg_then "nth_derivative_continuous") (fun fst_arg -> (use_arg_then "dnf") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["j"]) THEN (move ["j_lt_ni"])); + (((repeat_tactic 1 9 (((use_arg_then "nth_derivative_add")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "addSn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "cond")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "j_lt_ni") (disch_tac [])) THEN (clear_assumption "j_lt_ni") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma nth_diff_strong_imp_diff *) +let nth_diff_strong_imp_diff = section_proof ["n";"f";"x"] +`nth_diff_strong n f x ==> nth_differentiable n f x` +[ + (((((use_arg_then "nth_diff_strong")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xs"]))) THEN ((((use_arg_then "nth_differentiable_on")(thm_tac (new_rewrite [] [])))) THEN (move ["h"]))); + (((use_arg_then "h") (disch_tac [])) THEN (clear_assumption "h") THEN (exact_tac)); +];; + +(* Section DerivativeArith *) +begin_section "DerivativeArith";; + +(* Section ElementaryDerivatives *) +begin_section "ElementaryDerivatives";; + +(* Lemma derivative_x *) +let derivative_x = section_proof [] +`derivative (\x. x) = (\x. &1)` +[ + ((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (simp_tac)); + ((((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_ID")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma derivative_const *) +let derivative_const = section_proof ["c"] +`derivative (\x. c) = (\x. &0)` +[ + ((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (simp_tac)); + ((((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_CONST")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma derivative_inv *) +let derivative_inv = section_proof ["x"] +`~(x = &0) ==> derivative inv x = -- inv (x * x)` +[ + (BETA_TAC THEN (move ["xn0"])); + ((((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then "REAL_POW_2")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_INV_BASIC")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma derivative_atn *) +let derivative_atn = section_proof [] +`derivative atn = (\x. inv (&1 + x * x))` +[ + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_POW_2")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["x"]) THEN (simp_tac)); + ((((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_ATN")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma derivative_exp *) +let derivative_exp = section_proof [] +`derivative exp = exp` +[ + ((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (simp_tac)); + ((((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_EXP")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma derivative_acs *) +let derivative_acs = section_proof ["x"] +`abs x < &1 ==> derivative acs x = --inv(sqrt(&1 - x * x))` +[ + (BETA_TAC THEN (move ["x_ineq"])); + ((((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then "REAL_POW_2")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_ACS")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma derivative_sqrt *) +let derivative_sqrt = section_proof ["x"] +`&0 < x ==> derivative sqrt x = inv (&2 * sqrt x)` +[ + (BETA_TAC THEN (move ["xg0"])); + ((((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_SQRT")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma derivative_composition *) +let derivative_composition = section_proof ["f";"g";"x"] +`f real_differentiable atreal x ==> + g real_differentiable atreal (f x) ==> + derivative (\x. g (f x)) x = derivative f x * derivative g (f x)` +[ + ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then "has_derivative_alt") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["df"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "has_derivative_alt") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["dg"])) THEN (((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac))); + ((THENL_FIRST) (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_REAL_DERIVATIVE_CHAIN))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative g`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`\y. y = f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "g") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)) ((BETA_TAC THEN (move ["y"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((BETA_TAC THEN (case THEN (move ["_"]))) THEN (DISCH_THEN apply_tac) THEN (done_tac)); +];; + +(* Section ElementaryCompose *) +begin_section "ElementaryCompose";; + +(* Lemma REAL_DIFFERENTIABLE_AT_INV *) +let REAL_DIFFERENTIABLE_AT_INV = section_proof ["x"] +`~(x = &0) ==> inv real_differentiable atreal x` +[ + (BETA_TAC THEN (move ["xn0"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then "REAL_DIFFERENTIABLE_INV_ATREAL") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(\x. x:real)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "x") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((simp_tac) THEN (((use_arg_then "REAL_DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xn0")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; +(add_section_var (mk_var ("f", (`:real->real`))));; +(add_section_var (mk_var ("x", (`:real`))));; +(add_section_hyp "df" (`f real_differentiable atreal x`));; + +(* Lemma derivative_compose_atn *) +let derivative_compose_atn = section_proof [] +`(\x. atn (f x)) real_differentiable atreal x /\ + derivative (\x. atn (f x)) x = derivative f x / (&1 + f x * f x)` +[ + (split_tac); + ((((fun arg_tac -> (use_arg_then "o_THM") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`atn`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (DISCH_THEN apply_tac))); + (((((use_arg_then "REAL_DIFFERENTIABLE_AT_ATN")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "derivative_composition")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_AT_ATN")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then "derivative_atn")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "real_div")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma derivative_compose_exp *) +let derivative_compose_exp = section_proof [] +`(\x. exp (f x)) real_differentiable atreal x /\ + derivative (\x. exp (f x)) x = exp (f x) * derivative f x` +[ + (split_tac); + ((((fun arg_tac -> (use_arg_then "o_THM") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`exp`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (DISCH_THEN apply_tac))); + (((((use_arg_then "REAL_DIFFERENTIABLE_AT_EXP")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "derivative_composition")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_AT_EXP")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then "derivative_exp")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_SYM")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma derivative_compose_inv *) +let derivative_compose_inv = section_proof [] +`~(f x = &0) ==> + (\x. inv (f x)) real_differentiable atreal x /\ + derivative (\x. inv (f x)) x = -- inv (f x * f x) * derivative f x` +[ + ((THENL_FIRST) ((BETA_TAC THEN (move ["fn0"])) THEN (split_tac)) ((((use_arg_then "REAL_DIFFERENTIABLE_INV_ATREAL") (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_INV_ATREAL") THEN (DISCH_THEN apply_tac)) THEN (done_tac))); + (((((use_arg_then "derivative_composition")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "derivative_inv")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_MUL_SYM")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_AT_INV")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma derivative_compose_sqrt *) +let derivative_compose_sqrt = section_proof [] +`&0 < f x ==> + (\x. sqrt (f x)) real_differentiable atreal x /\ + derivative (\x. sqrt (f x)) x = derivative f x / (&2 * sqrt (f x))` +[ + ((BETA_TAC THEN (move ["f_pos"])) THEN (split_tac)); + ((((fun arg_tac -> (use_arg_then "o_THM") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sqrt`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (DISCH_THEN apply_tac))); + (((((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_AT_SQRT") (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_AT_SQRT") THEN (DISCH_THEN apply_tac)) THEN (done_tac)); + ((((use_arg_then "derivative_composition")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_AT_SQRT")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then "derivative_sqrt")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "real_div")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma derivative_compose_acs *) +let derivative_compose_acs = section_proof [] +`abs (f x) < &1 ==> + (\x. acs (f x)) real_differentiable atreal x /\ + derivative (\x. acs (f x)) x = -- (derivative f x / sqrt (&1 - f x * f x))` +[ + ((BETA_TAC THEN (move ["f_abs"])) THEN (split_tac)); + ((((fun arg_tac -> (use_arg_then "o_THM") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`acs`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (DISCH_THEN apply_tac))); + (((((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_AT_ACS")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "derivative_composition")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_AT_ACS")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then "derivative_acs")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_MUL_RNEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "real_div")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section ElementaryCompose *) +let REAL_DIFFERENTIABLE_AT_INV = finalize_theorem REAL_DIFFERENTIABLE_AT_INV;; +let derivative_compose_atn = finalize_theorem derivative_compose_atn;; +let derivative_compose_exp = finalize_theorem derivative_compose_exp;; +let derivative_compose_inv = finalize_theorem derivative_compose_inv;; +let derivative_compose_sqrt = finalize_theorem derivative_compose_sqrt;; +let derivative_compose_acs = finalize_theorem derivative_compose_acs;; +end_section "ElementaryCompose";; + +(* Finalization of the section ElementaryDerivatives *) +let derivative_x = finalize_theorem derivative_x;; +let derivative_const = finalize_theorem derivative_const;; +let derivative_inv = finalize_theorem derivative_inv;; +let derivative_atn = finalize_theorem derivative_atn;; +let derivative_exp = finalize_theorem derivative_exp;; +let derivative_acs = finalize_theorem derivative_acs;; +let derivative_sqrt = finalize_theorem derivative_sqrt;; +let derivative_composition = finalize_theorem derivative_composition;; +let REAL_DIFFERENTIABLE_AT_INV = finalize_theorem REAL_DIFFERENTIABLE_AT_INV;; +let derivative_compose_atn = finalize_theorem derivative_compose_atn;; +let derivative_compose_exp = finalize_theorem derivative_compose_exp;; +let derivative_compose_inv = finalize_theorem derivative_compose_inv;; +let derivative_compose_sqrt = finalize_theorem derivative_compose_sqrt;; +let derivative_compose_acs = finalize_theorem derivative_compose_acs;; +end_section "ElementaryDerivatives";; +(add_section_var (mk_var ("f", (`:real -> real`))); add_section_var (mk_var ("g", (`:real -> real`))));; +(add_section_var (mk_var ("x", (`:real`))); add_section_var (mk_var ("c", (`:real`))));; +(add_section_hyp "df" (`f real_differentiable atreal x`));; + +(* Lemma derivative_scale *) +let derivative_scale = section_proof [] +`derivative (\x. c * f x) x = c * derivative f x` +[ + ((((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then "HAS_REAL_DERIVATIVE_LMUL_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma derivative_neg *) +let derivative_neg = section_proof [] +`derivative (\x. -- f x) x = -- derivative f x` +[ + ((((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then "HAS_REAL_DERIVATIVE_NEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma derivative_pow *) +let derivative_pow = section_proof ["n"] +`derivative (\x. f x pow n) x = &n * f x pow (n - 1) * derivative f x` +[ + ((((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then "HAS_REAL_DERIVATIVE_POW_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(add_section_hyp "dg" (`g real_differentiable atreal x`));; + +(* Lemma derivative_add *) +let derivative_add = section_proof [] +`derivative (\x. f x + g x) x = derivative f x + derivative g x` +[ + ((((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then "HAS_REAL_DERIVATIVE_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma derivative_mul *) +let derivative_mul = section_proof [] +`derivative (\x. f x * g x) x = f x * derivative g x + derivative f x * g x` +[ + ((((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then "HAS_REAL_DERIVATIVE_MUL_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma derivative_sub *) +let derivative_sub = section_proof [] +`derivative (\x. f x - g x) x = derivative f x - derivative g x` +[ + ((((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then "HAS_REAL_DERIVATIVE_SUB")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma derivative_div *) +let derivative_div = section_proof [] +`~(g x = &0) ==> + derivative (\x. f x / g x) x = (derivative f x * g x - f x * derivative g x) / (g x * g x)` +[ + ((BETA_TAC THEN (move ["gn0"])) THEN (((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then "REAL_POW_2")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_DIV_ATREAL")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((repeat_tactic 1 9 (((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section DerivativeArith *) +let derivative_x = finalize_theorem derivative_x;; +let derivative_const = finalize_theorem derivative_const;; +let derivative_inv = finalize_theorem derivative_inv;; +let derivative_atn = finalize_theorem derivative_atn;; +let derivative_exp = finalize_theorem derivative_exp;; +let derivative_acs = finalize_theorem derivative_acs;; +let derivative_sqrt = finalize_theorem derivative_sqrt;; +let derivative_composition = finalize_theorem derivative_composition;; +let REAL_DIFFERENTIABLE_AT_INV = finalize_theorem REAL_DIFFERENTIABLE_AT_INV;; +let derivative_compose_atn = finalize_theorem derivative_compose_atn;; +let derivative_compose_exp = finalize_theorem derivative_compose_exp;; +let derivative_compose_inv = finalize_theorem derivative_compose_inv;; +let derivative_compose_sqrt = finalize_theorem derivative_compose_sqrt;; +let derivative_compose_acs = finalize_theorem derivative_compose_acs;; +let derivative_scale = finalize_theorem derivative_scale;; +let derivative_neg = finalize_theorem derivative_neg;; +let derivative_pow = finalize_theorem derivative_pow;; +let derivative_add = finalize_theorem derivative_add;; +let derivative_mul = finalize_theorem derivative_mul;; +let derivative_sub = finalize_theorem derivative_sub;; +let derivative_div = finalize_theorem derivative_div;; +end_section "DerivativeArith";; + +(* Section MoreDerivativeArith *) +begin_section "MoreDerivativeArith";; + +(* Lemma differentiable_sum_numseg *) +let differentiable_sum_numseg = section_proof ["G";"n";"m";"x"] +`(!i. i IN n..m ==> G i real_differentiable atreal x) ==> + (\x. sum (n..m) (\i. G i x)) real_differentiable atreal x` +[ + ((((THENL) (((use_arg_then "m") (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; ((move ["m"]) THEN (move ["IHm"]))]) THEN (move ["dG"])) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL SUM_CLAUSES_NUMSEG)))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n = 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["n_eq_0"])) THEN ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_CONST")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then "dG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "n_eq_0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "leqnn")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n <= SUC m`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["n_le_Sm"]))); + ((((use_arg_then "IHm") (disch_tac [])) THEN (clear_assumption "IHm") THEN (DISCH_THEN apply_tac) THEN (move ["i"]) THEN (move ["i_in"])) THEN (((use_arg_then "dG") (disch_tac [])) THEN (clear_assumption "dG") THEN (DISCH_THEN apply_tac))); + ((((use_arg_then "i_in") (disch_tac [])) THEN (clear_assumption "i_in") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then "REAL_DIFFERENTIABLE_ADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((use_arg_then "dG")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "IHm")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "n_le_Sm")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "leqnn")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((BETA_TAC THEN (move ["i"]) THEN (move ["ineq"])) THEN (((use_arg_then "dG") (disch_tac [])) THEN (clear_assumption "dG") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma derivative_sum_numseg *) +let derivative_sum_numseg = section_proof ["G";"n";"m";"x"] +`(!i. i IN n..m ==> G i real_differentiable atreal x) ==> + derivative (\x. sum (n..m) (\i. G i x)) x = sum (n..m) (\i. derivative (G i) x)` +[ + ((((THENL) (((use_arg_then "m") (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; ((move ["m"]) THEN (move ["IHm"]))]) THEN (move ["dG"])) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL SUM_CLAUSES_NUMSEG)))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> arg_tac (Arg_term (`n = 0`))) (disch_tac [])) THEN case THEN (simp_tac)) THEN ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then "derivative_const")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); + ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then "EXCLUDED_MIDDLE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n <= SUC m`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["n_le_Sm"]))); + ((((use_arg_then "IHm") (disch_tac [])) THEN (clear_assumption "IHm") THEN (DISCH_THEN apply_tac) THEN (move ["i"]) THEN (move ["i_in"])) THEN (((use_arg_then "dG") (disch_tac [])) THEN (clear_assumption "dG") THEN (DISCH_THEN apply_tac))); + ((((use_arg_then "i_in") (disch_tac [])) THEN (clear_assumption "i_in") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + (((use_arg_then "IHm")(gsym_then (thm_tac (new_rewrite [] []))))); + ((BETA_TAC THEN (move ["i"]) THEN (move ["i_in"])) THEN (((use_arg_then "dG") (disch_tac [])) THEN (clear_assumption "dG") THEN (DISCH_THEN apply_tac))); + ((((use_arg_then "i_in") (disch_tac [])) THEN (clear_assumption "i_in") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (arith_tac)); + ((((use_arg_then "derivative_add")(thm_tac (new_rewrite [] [])))) THEN ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then "dG")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "leqnn")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "differentiable_sum_numseg")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_in"])); + ((((use_arg_then "dG") (disch_tac [])) THEN (clear_assumption "dG") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "i_in") (disch_tac [])) THEN (clear_assumption "i_in") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section MoreDerivativeArith *) +let differentiable_sum_numseg = finalize_theorem differentiable_sum_numseg;; +let derivative_sum_numseg = finalize_theorem derivative_sum_numseg;; +end_section "MoreDerivativeArith";; + +(* Lemma HAS_REAL_DERIVATIVE_LOCAL *) +let HAS_REAL_DERIVATIVE_LOCAL = section_proof ["f";"g";"x";"g'"] +`(g has_real_derivative g') (atreal x) /\ + (?s. real_open s /\ x IN s /\ (!y. y IN s ==> f y = g y)) + ==> (f has_real_derivative g') (atreal x)` +[ + (BETA_TAC THEN (case THEN (move ["dg"])) THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["f_eq_g"])); + ((((use_arg_then "dg") (disch_tac [])) THEN (clear_assumption "dg") THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then "HAS_REAL_DERIVATIVE_WITHIN_REAL_OPEN") (fun fst_arg -> (use_arg_then "open_s") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))) THEN (move ["dg"]))); + (((fun arg_tac -> (use_arg_then "HAS_REAL_DERIVATIVE_TRANSFORM_WITHIN") (fun fst_arg -> (use_arg_then "dg") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`&1`))) (term_tac exists_tac)) THEN (((((use_arg_then "REAL_LT_01")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "f_eq_g") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma differentiable_local *) +let differentiable_local = section_proof ["f";"g";"x";"s"] +`g real_differentiable atreal x /\ real_open s /\ x IN s /\ + (!y. y IN s ==> f y = g y) ==> f real_differentiable atreal x` +[ + ((repeat_tactic 1 9 (((use_arg_then "real_differentiable")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["f'"])) THEN (move ["dg"]) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["eq"])); + (((use_arg_then "f'") (term_tac exists_tac)) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_LOCAL") (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac))); + (((use_arg_then "g") (term_tac exists_tac)) THEN ((((use_arg_then "dg")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then "s") (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Section NthDerivativeArith *) +begin_section "NthDerivativeArith";; +(add_section_var (mk_var ("f", (`:real->real`))); add_section_var (mk_var ("g", (`:real->real`))));; +(add_section_var (mk_var ("int", (`:real#real`))));; +(add_section_var (mk_var ("n", (`:num`))));; +(add_section_hyp "df" (`nth_diff_strong_int n int f`));; + +(* Lemma nth_derivative_scale_strong *) +let nth_derivative_scale_strong = section_proof ["c";"i";"x"] +`interval_arith x int ==> i <= n ==> + ?s. real_open s /\ x IN s /\ + !y. y IN s ==> nth_derivative i (\y. c * f y) y = c * nth_derivative i f y` +[ + ((((use_arg_then "df") (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC) THEN (((((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_diff_strong")(thm_tac (new_rewrite [] []))))) THEN (move ["df"]))); + (((DISCH_THEN (fun snd_th -> (use_arg_then "df") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"]))) THEN (((((use_arg_then "nth_differentiable_on")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_differentiable_eq")(thm_tac (new_rewrite [] []))))) THEN (move ["diff"]))); + ((THENL_FIRST) ((THENL) (((use_arg_then "i") (disch_tac [])) THEN (clear_assumption "i") THEN elim) [(move ["_"]); ((move ["i"]) THEN (move ["IHi"]))]) ((repeat_tactic 1 9 (((use_arg_then "nth_derivative0")(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then "s") (term_tac exists_tac)) THEN (done_tac))); + (((((use_arg_then "nth_derivativeS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ltE")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["i_lt_n"])); + ((((fun arg_tac -> (use_arg_then "IHi") (fun fst_arg -> (fun arg_tac -> (use_arg_then "ltnW") (fun fst_arg -> (use_arg_then "i_lt_n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["eq"])) THEN (((use_arg_then "IHi") (disch_tac [])) THEN (clear_assumption "IHi") THEN BETA_TAC THEN (move ["_"]))); + (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN (((((use_arg_then "REAL_OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"]))))); + (((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)); + (((use_arg_then "HAS_REAL_DERIVATIVE_LOCAL") (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`\y. c * nth_derivative i f y`))) (term_tac exists_tac)); + ((((use_arg_then "HAS_REAL_DERIVATIVE_LMUL_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((fun arg_tac -> (use_arg_then "diff") (fun fst_arg -> (use_arg_then "ys") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN (((((use_arg_then "REAL_OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "yt")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "ys")(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (move ["z_in"]) THEN (simp_tac))); + ((((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma nth_derivative_scale_strong_all *) +let nth_derivative_scale_strong_all = section_proof ["c";"x"] +`interval_arith x int ==> + ?s. real_open s /\ x IN s /\ + !i y. i <= n /\ y IN s ==> nth_derivative i (\y. c * f y) y = c * nth_derivative i f y` +[ + (BETA_TAC THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then "nth_derivative_scale_strong") (fun fst_arg -> (use_arg_then "c") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["h"])); + ((fun arg_tac -> arg_tac (Arg_term (`\i s. real_open s /\ x IN s /\ + (!y. y IN s ==> nth_derivative i (\y. c * f y) y = c * nth_derivative i f y)`))) (term_tac (set_tac "P"))); + ((fun arg_tac -> arg_tac (Arg_term (`!i. i <= n:num ==> P i ((@) (P i))`))) (term_tac (have_gen_tac [](move ["sel_P"])))); + ((BETA_TAC THEN (move ["i"]) THEN (move ["i_le_n"])) THEN ((use_arg_then "SELECT_AX") (thm_tac apply_tac))); + (((fun arg_tac -> (use_arg_then "h") (fun fst_arg -> (use_arg_then "i_le_n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (move ["cond"])); + (((use_arg_then "s") (term_tac exists_tac)) THEN ((((use_arg_then "P_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`INTERS (IMAGE (\i. (@) (P i)) (0..n))`))) (term_tac (set_tac "S"))); + ((use_arg_then "S") (term_tac exists_tac)); + ((((use_arg_then "S_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_OPEN_INTERS")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_IMAGE")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "IN_IMAGE")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then "IN_NUMSEG_0")(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "sel_P") (thm_tac (match_mp_then snd_th MP_TAC)))))); + (((((use_arg_then "P_def")(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then "IN_INTERS")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_IMAGE")(thm_tac (new_rewrite [] [])))))) THEN (split_tac)); + ((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then "IN_NUMSEG_0")(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "sel_P") (thm_tac (match_mp_then snd_th MP_TAC)))))); + (((((use_arg_then "P_def")(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN (done_tac)); + (BETA_TAC THEN (move ["i"]) THEN (move ["y"]) THEN (case THEN (move ["i_le_n"]))); + ((((fun arg_tac -> (use_arg_then "sel_P") (fun fst_arg -> (use_arg_then "i_le_n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then "P_def")(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["y_in"]) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(@) (P i)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)))); + ((THENL_FIRST) (ANTS_TAC) (((use_arg_then "i") (term_tac exists_tac)) THEN (((use_arg_then "IN_NUMSEG_0")(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((use_arg_then "y_in") (disch_tac [])) THEN (clear_assumption "y_in") THEN (exact_tac)); +];; + +(* Lemma nth_derivative_scale *) +let nth_derivative_scale = section_proof ["c";"i";"x"] +`interval_arith x int ==> i <= n ==> + nth_derivative i (\x. c * f x) x = c * nth_derivative i f x` +[ + (BETA_TAC THEN (move ["ineq"]) THEN (move ["i_le_n"])); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "nth_derivative_scale_strong") (fun fst_arg -> (use_arg_then "c") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "i_le_n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xs"])) THEN (move ["h"])); + (((use_arg_then "h") (disch_tac [])) THEN (clear_assumption "h") THEN (exact_tac)); +];; + +(* Lemma nth_diff_scale *) +let nth_diff_scale = section_proof ["c"] +`nth_diff_strong_int n int (\x. c * f x)` +[ + ((((use_arg_then "df") (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_differentiable_on")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_differentiable_eq")(thm_tac (new_rewrite [] []))))))); + (BETA_TAC THEN (move ["df"]) THEN (move ["x"]) THEN (move ["ineq"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then "nth_derivative_scale_strong_all") (fun fst_arg -> (use_arg_then "c") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["diff"])); + (((fun arg_tac -> (use_arg_then "df") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["diff2"])); + (((fun arg_tac -> arg_tac (Arg_term (`s INTER t`))) (term_tac exists_tac)) THEN (((((use_arg_then "REAL_OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "xt")(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"]))))); + (((((use_arg_then "REAL_CONTINUOUS_LMUL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "diff2")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_lt_n"])); + ((((use_arg_then "diff")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "ys")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "ltE")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + (((use_arg_then "HAS_REAL_DERIVATIVE_LOCAL") (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(\y. c * nth_derivative i f y)`))) (term_tac exists_tac)); + ((THENL_FIRST) ((((use_arg_then "HAS_REAL_DERIVATIVE_LMUL_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((fun arg_tac -> (use_arg_then "diff2") (fun fst_arg -> (use_arg_then "yt") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((use_arg_then "s") (term_tac exists_tac)) THEN (((((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ys")(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (move ["zs"]) THEN (simp_tac))); + ((((use_arg_then "diff") (disch_tac [])) THEN (clear_assumption "diff") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "ltnW")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; +(add_section_hyp "dg" (`nth_diff_strong_int n int g`));; + +(* Lemma nth_derivative_add_strong *) +let nth_derivative_add_strong = section_proof ["i";"x"] +`interval_arith x int ==> i <= n ==> + ?s. real_open s /\ x IN s /\ + !y. y IN s ==> nth_derivative i (\y. f y + g y) y = nth_derivative i f y + nth_derivative i g y` +[ + ((((use_arg_then "dg") (disch_tac [])) THEN (clear_assumption "dg") THEN ((use_arg_then "df") (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong")(thm_tac (new_rewrite [] [])))))) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["ineq"]))); + ((((fun arg_tac -> (use_arg_then "df") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["sf"])) THEN (case THEN (move ["open_sf"])) THEN (case THEN (move ["xsf"]))) THEN (((use_arg_then "df") (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC THEN (move ["_"]))); + ((((fun arg_tac -> (use_arg_then "dg") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["sg"])) THEN (case THEN (move ["open_sg"])) THEN (case THEN (move ["xsg"]))) THEN (((use_arg_then "dg") (disch_tac [])) THEN (clear_assumption "dg") THEN BETA_TAC THEN (move ["_"]))); + (((repeat_tactic 1 9 (((use_arg_then "nth_differentiable_on")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_differentiable_eq")(thm_tac (new_rewrite [] [])))))) THEN (move ["diff_g"]) THEN (move ["diff_f"])); + ((THENL_FIRST) ((THENL) (((use_arg_then "i") (disch_tac [])) THEN (clear_assumption "i") THEN elim) [(move ["_"]); ((move ["i"]) THEN (move ["IHi"]))]) ((repeat_tactic 1 9 (((use_arg_then "nth_derivative0")(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then "sf") (term_tac exists_tac)) THEN (done_tac))); + (((((use_arg_then "nth_derivativeS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ltE")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["i_lt_n"])); + ((((fun arg_tac -> (use_arg_then "IHi") (fun fst_arg -> (fun arg_tac -> (use_arg_then "ltnW") (fun fst_arg -> (use_arg_then "i_lt_n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["eq"])) THEN (((use_arg_then "IHi") (disch_tac [])) THEN (clear_assumption "IHi") THEN BETA_TAC THEN (move ["_"]))); + ((fun arg_tac -> arg_tac (Arg_term (`sf INTER sg INTER t`))) (term_tac exists_tac)); + (((repeat_tactic 1 9 (((use_arg_then "REAL_OPEN_INTER")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xsf")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xsg")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (case THEN (move ["ysf"])) THEN (case THEN ((move ["ysg"]) THEN (move ["yt"])))); + (((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)); + (((use_arg_then "HAS_REAL_DERIVATIVE_LOCAL") (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(\y. nth_derivative i f y + nth_derivative i g y)`))) (term_tac exists_tac)); + ((((use_arg_then "HAS_REAL_DERIVATIVE_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((fun arg_tac -> (use_arg_then "diff_f") (fun fst_arg -> (use_arg_then "ysf") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then "diff_g") (fun fst_arg -> (use_arg_then "ysg") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`sf INTER sg INTER t`))) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then "REAL_OPEN_INTER")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "yt")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "ysf")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "ysg")(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))))); + ((BETA_TAC THEN (move ["z"]) THEN (move ["z_in"]) THEN (simp_tac)) THEN (((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma nth_derivative_add_strong_all *) +let nth_derivative_add_strong_all = section_proof ["x"] +`interval_arith x int ==> + ?s. real_open s /\ x IN s /\ + !i y. i <= n /\ y IN s ==> + nth_derivative i (\y. f y + g y) y = nth_derivative i f y + nth_derivative i g y` +[ + (BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then "nth_derivative_add_strong") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["h"])); + ((fun arg_tac -> arg_tac (Arg_term (`\i s. real_open s /\ x IN s /\ + (!y. y IN s ==> nth_derivative i (\y. f y + g y) y = nth_derivative i f y + nth_derivative i g y)`))) (term_tac (set_tac "P"))); + ((fun arg_tac -> arg_tac (Arg_term (`!i. i <= n:num ==> P i ((@) (P i))`))) (term_tac (have_gen_tac [](move ["sel_P"])))); + ((BETA_TAC THEN (move ["i"]) THEN (move ["i_le_n"])) THEN ((use_arg_then "SELECT_AX") (thm_tac apply_tac))); + (((fun arg_tac -> (use_arg_then "h") (fun fst_arg -> (use_arg_then "i_le_n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (move ["cond"])); + (((use_arg_then "s") (term_tac exists_tac)) THEN ((((use_arg_then "P_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`INTERS (IMAGE (\i. (@) (P i)) (0..n))`))) (term_tac (set_tac "S"))); + ((use_arg_then "S") (term_tac exists_tac)); + ((((use_arg_then "S_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_OPEN_INTERS")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_IMAGE")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "IN_IMAGE")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then "IN_NUMSEG_0")(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "sel_P") (thm_tac (match_mp_then snd_th MP_TAC)))))); + (((((use_arg_then "P_def")(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then "IN_INTERS")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_IMAGE")(thm_tac (new_rewrite [] [])))))) THEN (split_tac)); + ((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then "IN_NUMSEG_0")(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "sel_P") (thm_tac (match_mp_then snd_th MP_TAC)))))); + (((((use_arg_then "P_def")(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN (done_tac)); + (BETA_TAC THEN (move ["i"]) THEN (move ["y"]) THEN (case THEN (move ["i_le_n"]))); + ((((fun arg_tac -> (use_arg_then "sel_P") (fun fst_arg -> (use_arg_then "i_le_n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then "P_def")(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["y_in"]) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(@) (P i)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)))); + ((THENL_FIRST) (ANTS_TAC) (((use_arg_then "i") (term_tac exists_tac)) THEN (((use_arg_then "IN_NUMSEG_0")(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((use_arg_then "y_in") (disch_tac [])) THEN (clear_assumption "y_in") THEN (exact_tac)); +];; + +(* Lemma nth_derivative_add *) +let nth_derivative_add = section_proof ["i";"x"] +`interval_arith x int ==> i <= n ==> + nth_derivative i (\x. f x + g x) x = nth_derivative i f x + nth_derivative i g x` +[ + (BETA_TAC THEN (move ["ineq"]) THEN (move ["i_le_n"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then "nth_derivative_add_strong") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "i_le_n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xs"])) THEN (move ["h"])); + (((use_arg_then "h") (disch_tac [])) THEN (clear_assumption "h") THEN (exact_tac)); +];; + +(* Lemma nth_diff_add *) +let nth_diff_add = section_proof [] +`nth_diff_strong_int n int (\x. f x + g x)` +[ + (((use_arg_then "dg") (disch_tac [])) THEN ((use_arg_then "df") (disch_tac [])) THEN BETA_TAC); + ((repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_differentiable_on")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_differentiable_eq")(thm_tac (new_rewrite [] [])))))); + (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["x"]) THEN (move ["ineq"])); + ((fun arg_tac -> (use_arg_then "nth_derivative_add_strong_all") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["diff"])); + (((fun arg_tac -> (use_arg_then "df") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["tf"])) THEN (case THEN (move ["open_tf"])) THEN (case THEN (move ["xtf"])) THEN (move ["diff_f"])); + (((fun arg_tac -> (use_arg_then "dg") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["tg"])) THEN (case THEN (move ["open_tg"])) THEN (case THEN (move ["xtg"])) THEN (move ["diff_g"])); + (((fun arg_tac -> arg_tac (Arg_term (`s INTER tf INTER tg`))) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then "REAL_OPEN_INTER")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "xtf")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "xtg")(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))))); + (BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (case THEN ((move ["ytf"]) THEN (move ["ytg"])))))); + (((((use_arg_then "REAL_CONTINUOUS_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "diff_f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "diff_g")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_lt_n"])); + ((((use_arg_then "diff")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "ys")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "ltE")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + (((use_arg_then "HAS_REAL_DERIVATIVE_LOCAL") (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(\y. nth_derivative i f y + nth_derivative i g y)`))) (term_tac exists_tac)); + ((THENL_FIRST) ((((use_arg_then "HAS_REAL_DERIVATIVE_ADD")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((fun arg_tac -> (use_arg_then "diff_f") (fun fst_arg -> (use_arg_then "ytf") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then "diff_g") (fun fst_arg -> (use_arg_then "ytg") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((use_arg_then "s") (term_tac exists_tac)) THEN (((((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ys")(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (move ["zs"]) THEN (simp_tac))); + ((((use_arg_then "diff") (disch_tac [])) THEN (clear_assumption "diff") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "ltnW")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma nth_derivative_sub_strong *) +let nth_derivative_sub_strong = section_proof ["i";"x"] +`interval_arith x int ==> i <= n ==> + ?s. real_open s /\ x IN s /\ + !y. y IN s ==> nth_derivative i (\y. f y - g y) y = nth_derivative i f y - nth_derivative i g y` +[ + ((((use_arg_then "dg") (disch_tac [])) THEN (clear_assumption "dg") THEN ((use_arg_then "df") (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong")(thm_tac (new_rewrite [] [])))))) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["ineq"]))); + ((((fun arg_tac -> (use_arg_then "df") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["sf"])) THEN (case THEN (move ["open_sf"])) THEN (case THEN (move ["xsf"]))) THEN (((use_arg_then "df") (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC THEN (move ["_"]))); + ((((fun arg_tac -> (use_arg_then "dg") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["sg"])) THEN (case THEN (move ["open_sg"])) THEN (case THEN (move ["xsg"]))) THEN (((use_arg_then "dg") (disch_tac [])) THEN (clear_assumption "dg") THEN BETA_TAC THEN (move ["_"]))); + (((repeat_tactic 1 9 (((use_arg_then "nth_differentiable_on")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_differentiable_eq")(thm_tac (new_rewrite [] [])))))) THEN (move ["diff_g"]) THEN (move ["diff_f"])); + ((THENL_FIRST) ((THENL) (((use_arg_then "i") (disch_tac [])) THEN (clear_assumption "i") THEN elim) [(move ["_"]); ((move ["i"]) THEN (move ["IHi"]))]) ((repeat_tactic 1 9 (((use_arg_then "nth_derivative0")(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then "sf") (term_tac exists_tac)) THEN (done_tac))); + (((((use_arg_then "nth_derivativeS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ltE")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["i_lt_n"])); + ((((fun arg_tac -> (use_arg_then "IHi") (fun fst_arg -> (fun arg_tac -> (use_arg_then "ltnW") (fun fst_arg -> (use_arg_then "i_lt_n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["eq"])) THEN (((use_arg_then "IHi") (disch_tac [])) THEN (clear_assumption "IHi") THEN BETA_TAC THEN (move ["_"]))); + ((fun arg_tac -> arg_tac (Arg_term (`sf INTER sg INTER t`))) (term_tac exists_tac)); + (((repeat_tactic 1 9 (((use_arg_then "REAL_OPEN_INTER")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xsf")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xsg")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (case THEN (move ["ysf"])) THEN (case THEN ((move ["ysg"]) THEN (move ["yt"])))); + (((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)); + (((use_arg_then "HAS_REAL_DERIVATIVE_LOCAL") (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(\y. nth_derivative i f y - nth_derivative i g y)`))) (term_tac exists_tac)); + ((((use_arg_then "HAS_REAL_DERIVATIVE_SUB")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((fun arg_tac -> (use_arg_then "diff_f") (fun fst_arg -> (use_arg_then "ysf") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then "diff_g") (fun fst_arg -> (use_arg_then "ysg") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`sf INTER sg INTER t`))) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then "REAL_OPEN_INTER")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "yt")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "ysf")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "ysg")(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))))); + ((BETA_TAC THEN (move ["z"]) THEN (move ["z_in"]) THEN (simp_tac)) THEN (((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma nth_derivative_sub_strong_all *) +let nth_derivative_sub_strong_all = section_proof ["x"] +`interval_arith x int ==> + ?s. real_open s /\ x IN s /\ + !i y. i <= n /\ y IN s ==> + nth_derivative i (\y. f y - g y) y = nth_derivative i f y - nth_derivative i g y` +[ + (BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then "nth_derivative_sub_strong") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["h"])); + ((fun arg_tac -> arg_tac (Arg_term (`\i s. real_open s /\ x IN s /\ + (!y. y IN s ==> nth_derivative i (\y. f y - g y) y = nth_derivative i f y - nth_derivative i g y)`))) (term_tac (set_tac "P"))); + ((fun arg_tac -> arg_tac (Arg_term (`!i. i <= n:num ==> P i ((@) (P i))`))) (term_tac (have_gen_tac [](move ["sel_P"])))); + ((BETA_TAC THEN (move ["i"]) THEN (move ["i_le_n"])) THEN ((use_arg_then "SELECT_AX") (thm_tac apply_tac))); + (((fun arg_tac -> (use_arg_then "h") (fun fst_arg -> (use_arg_then "i_le_n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (move ["cond"])); + (((use_arg_then "s") (term_tac exists_tac)) THEN ((((use_arg_then "P_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`INTERS (IMAGE (\i. (@) (P i)) (0..n))`))) (term_tac (set_tac "S"))); + ((use_arg_then "S") (term_tac exists_tac)); + ((((use_arg_then "S_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_OPEN_INTERS")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_IMAGE")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "IN_IMAGE")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then "IN_NUMSEG_0")(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "sel_P") (thm_tac (match_mp_then snd_th MP_TAC)))))); + (((((use_arg_then "P_def")(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then "IN_INTERS")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_IMAGE")(thm_tac (new_rewrite [] [])))))) THEN (split_tac)); + ((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then "IN_NUMSEG_0")(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "sel_P") (thm_tac (match_mp_then snd_th MP_TAC)))))); + (((((use_arg_then "P_def")(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN (done_tac)); + (BETA_TAC THEN (move ["i"]) THEN (move ["y"]) THEN (case THEN (move ["i_le_n"]))); + ((((fun arg_tac -> (use_arg_then "sel_P") (fun fst_arg -> (use_arg_then "i_le_n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then "P_def")(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["y_in"]) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(@) (P i)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)))); + ((THENL_FIRST) (ANTS_TAC) (((use_arg_then "i") (term_tac exists_tac)) THEN (((use_arg_then "IN_NUMSEG_0")(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((use_arg_then "y_in") (disch_tac [])) THEN (clear_assumption "y_in") THEN (exact_tac)); +];; + +(* Lemma nth_derivative_sub *) +let nth_derivative_sub = section_proof ["i";"x"] +`interval_arith x int ==> i <= n ==> + nth_derivative i (\x. f x - g x) x = nth_derivative i f x - nth_derivative i g x` +[ + (BETA_TAC THEN (move ["ineq"]) THEN (move ["i_le_n"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then "nth_derivative_sub_strong") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "i_le_n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xs"])) THEN (move ["h"])); + (((use_arg_then "h") (disch_tac [])) THEN (clear_assumption "h") THEN (exact_tac)); +];; + +(* Lemma nth_diff_sub *) +let nth_diff_sub = section_proof [] +`nth_diff_strong_int n int (\x. f x - g x)` +[ + (((use_arg_then "dg") (disch_tac [])) THEN ((use_arg_then "df") (disch_tac [])) THEN BETA_TAC); + ((repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_differentiable_on")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_differentiable_eq")(thm_tac (new_rewrite [] [])))))); + (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["x"]) THEN (move ["ineq"])); + ((fun arg_tac -> (use_arg_then "nth_derivative_sub_strong_all") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["diff"])); + (((fun arg_tac -> (use_arg_then "df") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["tf"])) THEN (case THEN (move ["open_tf"])) THEN (case THEN (move ["xtf"])) THEN (move ["diff_f"])); + (((fun arg_tac -> (use_arg_then "dg") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["tg"])) THEN (case THEN (move ["open_tg"])) THEN (case THEN (move ["xtg"])) THEN (move ["diff_g"])); + (((fun arg_tac -> arg_tac (Arg_term (`s INTER tf INTER tg`))) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then "REAL_OPEN_INTER")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "xtf")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "xtg")(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))))); + (BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (case THEN ((move ["ytf"]) THEN (move ["ytg"])))))); + (((((use_arg_then "REAL_CONTINUOUS_SUB")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "diff_f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "diff_g")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_lt_n"])); + ((((use_arg_then "diff")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "ys")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "ltE")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + (((use_arg_then "HAS_REAL_DERIVATIVE_LOCAL") (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(\y. nth_derivative i f y - nth_derivative i g y)`))) (term_tac exists_tac)); + ((THENL_FIRST) ((((use_arg_then "HAS_REAL_DERIVATIVE_SUB")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((fun arg_tac -> (use_arg_then "diff_f") (fun fst_arg -> (use_arg_then "ytf") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then "diff_g") (fun fst_arg -> (use_arg_then "ytg") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((use_arg_then "s") (term_tac exists_tac)) THEN (((((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ys")(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (move ["zs"]) THEN (simp_tac))); + ((((use_arg_then "diff") (disch_tac [])) THEN (clear_assumption "diff") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "ltnW")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma nth_derivative_mul_strong *) +let nth_derivative_mul_strong = section_proof ["i";"x"] +`interval_arith x int ==> i <= n ==> + ?s. real_open s /\ x IN s /\ + !y. y IN s ==> nth_derivative i (\y. f y * g y) y = + sum (0..i) (\k. &(binom (i, k)) * nth_derivative k f y * nth_derivative (i - k) g y)` +[ + ((((use_arg_then "dg") (disch_tac [])) THEN (clear_assumption "dg") THEN ((use_arg_then "df") (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong")(thm_tac (new_rewrite [] [])))))) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["ineq"]))); + ((((fun arg_tac -> (use_arg_then "df") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["sf"])) THEN (case THEN (move ["open_sf"])) THEN (case THEN (move ["xsf"]))) THEN (((use_arg_then "df") (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC THEN (move ["_"]))); + ((((fun arg_tac -> (use_arg_then "dg") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["sg"])) THEN (case THEN (move ["open_sg"])) THEN (case THEN (move ["xsg"]))) THEN (((use_arg_then "dg") (disch_tac [])) THEN (clear_assumption "dg") THEN BETA_TAC THEN (move ["_"]))); + (((repeat_tactic 1 9 (((use_arg_then "nth_differentiable_on")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_differentiable_eq")(thm_tac (new_rewrite [] [])))))) THEN (move ["diff_g"]) THEN (move ["diff_f"])); + ((THENL) (((use_arg_then "i") (disch_tac [])) THEN (clear_assumption "i") THEN elim) [(move ["_"]); ((move ["i"]) THEN (move ["IHi"]))]); + (((use_arg_then "sf") (term_tac exists_tac)) THEN (((((use_arg_then "open_sf")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xsf")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_derivative0")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "SUM_SING_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (move ["_"]) THEN (simp_tac))); + (((((use_arg_then "subn0")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_derivative0")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "binom")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_LID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then "nth_derivativeS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ltE")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["i_lt_n"])); + ((((fun arg_tac -> (use_arg_then "IHi") (fun fst_arg -> (fun arg_tac -> (use_arg_then "ltnW") (fun fst_arg -> (use_arg_then "i_lt_n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["eq"])) THEN (((use_arg_then "IHi") (disch_tac [])) THEN (clear_assumption "IHi") THEN BETA_TAC THEN (move ["_"]))); + ((fun arg_tac -> arg_tac (Arg_term (`sf INTER sg INTER t`))) (term_tac exists_tac)); + (((repeat_tactic 1 9 (((use_arg_then "REAL_OPEN_INTER")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xsf")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xsg")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (case THEN (move ["ysf"])) THEN (case THEN ((move ["ysg"]) THEN (move ["yt"])))); + (((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)); + (((use_arg_then "HAS_REAL_DERIVATIVE_LOCAL") (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`\y. sum (0..i) (\k. &(binom (i, k)) * nth_derivative k f y * nth_derivative (i - k) g y)`))) (term_tac exists_tac)); + ((THENL_ROT (-1)) (split_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`sf INTER sg INTER t`))) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then "REAL_OPEN_INTER")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "yt")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "ysf")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "ysg")(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))))); + ((BETA_TAC THEN (move ["z"]) THEN (move ["z_in"]) THEN (simp_tac)) THEN (((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((use_arg_then "has_derivative_lemma") (disch_tac [])) THEN (clear_assumption "has_derivative_lemma") THEN (DISCH_THEN apply_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!k. k IN 0..i ==> + nth_derivative k f real_differentiable atreal y /\ + nth_derivative (i - k) g real_differentiable atreal y`))) (term_tac (have_gen_tac [](move ["diff_cond"])))); + (((((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (move ["k"]) THEN (move ["ineq"]) THEN (simp_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "real_differentiable")(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`nth_derivative (SUC k) f y`))) (term_tac exists_tac)) THEN (((fun arg_tac -> (use_arg_then "diff_f") (fun fst_arg -> (use_arg_then "ysf") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "i_lt_n") (disch_tac [])) THEN (clear_assumption "i_lt_n") THEN ((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`nth_derivative (SUC (i - k)) g y`))) (term_tac exists_tac)) THEN (((fun arg_tac -> (use_arg_then "diff_g") (fun fst_arg -> (use_arg_then "ysg") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "i_lt_n") (disch_tac [])) THEN (clear_assumption "i_lt_n") THEN ((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!k. k IN 0..i ==> + (\y. &(binom (i, k)) * nth_derivative k f y * nth_derivative (i - k) g y) + real_differentiable atreal y`))) (term_tac (have_gen_tac [](move ["diff_cond2"])))); + (BETA_TAC THEN (move ["k"]) THEN (move ["k_in"]) THEN (simp_tac)); + (((repeat_tactic 1 9 (((use_arg_then "REAL_DIFFERENTIABLE_MUL_ATREAL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 1 9 (((use_arg_then "diff_cond")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (done_tac)); + (((((use_arg_then "differentiable_sum_numseg")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "derivative_sum_numseg")(thm_tac (new_rewrite [] [])))))) THEN ((simp_tac) THEN (((use_arg_then "diff_cond2")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((fun arg_tac -> arg_tac (Arg_term (`sum (0..i) _`))) (term_tac (set_tac "lhs"))); + ((fun arg_tac -> arg_tac (Arg_term (`sum (0 + 1..i + 1) (\k. &(binom (i, k - 1)) * nth_derivative k f y * nth_derivative (SUC i - k) g y)`))) (term_tac (set_tac "sum1"))); + ((fun arg_tac -> arg_tac (Arg_term (`sum (0..i + 1) (\k. &(binom (i, k)) * nth_derivative k f y * nth_derivative (SUC i - k) g y)`))) (term_tac (set_tac "sum2"))); + ((fun arg_tac -> arg_tac (Arg_term (`lhs = sum1 + sum2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((use_arg_then "sum1_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "SUM_OFFSET")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "addn1")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "succnK")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "subSS")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "sum2_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "addn1")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL SUM_CLAUSES_NUMSEG)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `0 <= SUC i`)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`binom(i, SUC i) = 0`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then "BINOM_EQ_0")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then "REAL_MUL_LZERO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ADD_RID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUM_ADD_NUMSEG")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "lhs_def")(gsym_then (thm_tac (new_rewrite [] [])))))); + (((use_arg_then "SUM_EQ") (thm_tac apply_tac)) THEN (move ["k"]) THEN (move ["k_in"]) THEN (simp_tac)); + (((((use_arg_then "derivative_scale")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_MUL_ATREAL")(thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((use_arg_then "diff_cond")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then "REAL_ADD_LDISTRIB")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_EQ_MUL_LCANCEL")(thm_tac (new_rewrite [] []))))) THEN (DISJ2_TAC)); + ((((use_arg_then "derivative_mul")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((repeat_tactic 0 10 (((use_arg_then "diff_cond")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((((use_arg_then "REAL_ADD_SYM")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_derivativeS")(gsym_then (thm_tac (new_rewrite [] []))))))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`SUC (i - k) = SUC i - k`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((done_tac) THEN (done_tac))); + ((((use_arg_then "k_in") (disch_tac [])) THEN (clear_assumption "k_in") THEN BETA_TAC) THEN (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then "REAL_ADD_SYM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUM_CLAUSES_LEFT")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "sum2_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 1 (((use_arg_then "SUM_CLAUSES_LEFT")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (TRY ((arith_tac)))); + ((repeat_tactic 1 9 (((use_arg_then "binom")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_LID")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_ADD_ASSOC")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_EQ_ADD_LCANCEL")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "sum1_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "SUM_ADD_NUMSEG")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then "addn1") (fun fst_arg -> (use_arg_then "i") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + (((use_arg_then "SUM_EQ") (thm_tac apply_tac)) THEN (move ["k"]) THEN (move ["k_in"]) THEN (simp_tac)); + (((((use_arg_then "REAL_ADD_RDISTRIB")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_EQ_MUL_RCANCEL")(thm_tac (new_rewrite [] []))))) THEN (DISJ1_TAC)); + ((THENL_FIRST) (((THENL) (((use_arg_then "k_in") (disch_tac [])) THEN (clear_assumption "k_in") THEN ((use_arg_then "k") (disch_tac [])) THEN (clear_assumption "k") THEN case) [ALL_TAC; (move ["k"])]) THEN (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then "binom")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ONE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "subSS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "subn0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_OF_NUM_ADD")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_derivative_mul_strong_all *) +let nth_derivative_mul_strong_all = section_proof ["x"] +`interval_arith x int ==> + ?s. real_open s /\ x IN s /\ + !i y. i <= n /\ y IN s ==> + nth_derivative i (\y. f y * g y) y = + sum (0..i) (\k. &(binom (i, k)) * nth_derivative k f y * nth_derivative (i - k) g y)` +[ + (BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then "nth_derivative_mul_strong") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["h"])); + ((fun arg_tac -> arg_tac (Arg_term (`\i s. real_open s /\ x IN s /\ + (!y. y IN s ==> nth_derivative i (\y. f y * g y) y = + sum (0..i) (\k. &(binom (i, k)) * nth_derivative k f y * nth_derivative (i - k) g y))`))) (term_tac (set_tac "P"))); + ((fun arg_tac -> arg_tac (Arg_term (`!i. i <= n:num ==> P i ((@) (P i))`))) (term_tac (have_gen_tac [](move ["sel_P"])))); + ((BETA_TAC THEN (move ["i"]) THEN (move ["i_le_n"])) THEN ((use_arg_then "SELECT_AX") (thm_tac apply_tac))); + (((fun arg_tac -> (use_arg_then "h") (fun fst_arg -> (use_arg_then "i_le_n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (move ["cond"])); + (((use_arg_then "s") (term_tac exists_tac)) THEN ((((use_arg_then "P_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`INTERS (IMAGE (\i. (@) (P i)) (0..n))`))) (term_tac (set_tac "S"))); + ((use_arg_then "S") (term_tac exists_tac)); + ((((use_arg_then "S_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_OPEN_INTERS")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_IMAGE")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "FINITE_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "IN_IMAGE")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then "IN_NUMSEG_0")(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "sel_P") (thm_tac (match_mp_then snd_th MP_TAC)))))); + (((((use_arg_then "P_def")(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then "IN_INTERS")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_IMAGE")(thm_tac (new_rewrite [] [])))))) THEN (split_tac)); + ((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then "IN_NUMSEG_0")(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "sel_P") (thm_tac (match_mp_then snd_th MP_TAC)))))); + (((((use_arg_then "P_def")(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN (done_tac)); + (BETA_TAC THEN (move ["i"]) THEN (move ["y"]) THEN (case THEN (move ["i_le_n"]))); + ((((fun arg_tac -> (use_arg_then "sel_P") (fun fst_arg -> (use_arg_then "i_le_n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then "P_def")(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["y_in"]) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(@) (P i)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)))); + ((THENL_FIRST) (ANTS_TAC) (((use_arg_then "i") (term_tac exists_tac)) THEN (((use_arg_then "IN_NUMSEG_0")(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((use_arg_then "y_in") (disch_tac [])) THEN (clear_assumption "y_in") THEN (exact_tac)); +];; + +(* Lemma nth_derivative_mul *) +let nth_derivative_mul = section_proof ["i";"x"] +`interval_arith x int ==> i <= n ==> + nth_derivative i (\x. f x * g x) x = + sum (0..i) (\k. &(binom (i, k)) * nth_derivative k f x * nth_derivative (i - k) g x)` +[ + (BETA_TAC THEN (move ["ineq"]) THEN (move ["i_le_n"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then "nth_derivative_mul_strong") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "i_le_n") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xs"])) THEN (move ["h"])); + (((use_arg_then "h") (disch_tac [])) THEN (clear_assumption "h") THEN (exact_tac)); +];; + +(* Lemma nth_diff_mul *) +let nth_diff_mul = section_proof [] +`nth_diff_strong_int n int (\x. f x * g x)` +[ + (((use_arg_then "dg") (disch_tac [])) THEN ((use_arg_then "df") (disch_tac [])) THEN BETA_TAC); + ((repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_differentiable_on")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_differentiable_eq")(thm_tac (new_rewrite [] [])))))); + (BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["x"]) THEN (move ["ineq"])); + ((fun arg_tac -> (use_arg_then "nth_derivative_mul_strong_all") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["diff"])); + (((fun arg_tac -> (use_arg_then "df") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["tf"])) THEN (case THEN (move ["open_tf"])) THEN (case THEN (move ["xtf"])) THEN (move ["diff_f"])); + (((fun arg_tac -> (use_arg_then "dg") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["tg"])) THEN (case THEN (move ["open_tg"])) THEN (case THEN (move ["xtg"])) THEN (move ["diff_g"])); + (((fun arg_tac -> arg_tac (Arg_term (`s INTER tf INTER tg`))) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then "REAL_OPEN_INTER")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "xtf")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "xtg")(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))))); + (BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (case THEN ((move ["ytf"]) THEN (move ["ytg"])))))); + (((((use_arg_then "REAL_CONTINUOUS_MUL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "diff_f")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "diff_g")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_lt_n"])); + ((((use_arg_then "nth_derivativeS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "has_derivative_alt")(thm_tac (new_rewrite [] []))))); + (((use_arg_then "differentiable_local") (disch_tac [])) THEN (clear_assumption "differentiable_local") THEN (DISCH_THEN apply_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`\y. sum (0..i) (\k. &(binom(i, k)) * nth_derivative k f y * nth_derivative (i - k) g y)`))) (term_tac exists_tac)) THEN ((use_arg_then "s") (term_tac exists_tac))); + ((THENL_LAST) (((((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ys")(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (split_tac)) ((BETA_TAC THEN (move ["z"]) THEN (move ["zs"])) THEN ((((use_arg_then "diff")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "ltnW")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then "differentiable_sum_numseg")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_NUMSEG")(thm_tac (new_rewrite [] []))))) THEN (move ["k"]) THEN (move ["k_in"]) THEN (simp_tac)); + (((repeat_tactic 1 9 (((use_arg_then "REAL_DIFFERENTIABLE_MUL_ATREAL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); + ((repeat_tactic 1 9 (((use_arg_then "real_differentiable")(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`nth_derivative (SUC k) f y`))) (term_tac exists_tac)) THEN (((fun arg_tac -> (use_arg_then "diff_f") (fun fst_arg -> (use_arg_then "ytf") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "i_lt_n") (disch_tac [])) THEN (clear_assumption "i_lt_n") THEN ((use_arg_then "k_in") (disch_tac [])) THEN (clear_assumption "k_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`nth_derivative (SUC (i - k)) g y`))) (term_tac exists_tac)) THEN (((fun arg_tac -> (use_arg_then "diff_g") (fun fst_arg -> (use_arg_then "ytg") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "i_lt_n") (disch_tac [])) THEN (clear_assumption "i_lt_n") THEN ((use_arg_then "k_in") (disch_tac [])) THEN (clear_assumption "k_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section NthDerivativeArith *) +let nth_derivative_scale_strong = finalize_theorem nth_derivative_scale_strong;; +let nth_derivative_scale_strong_all = finalize_theorem nth_derivative_scale_strong_all;; +let nth_derivative_scale = finalize_theorem nth_derivative_scale;; +let nth_diff_scale = finalize_theorem nth_diff_scale;; +let nth_derivative_add_strong = finalize_theorem nth_derivative_add_strong;; +let nth_derivative_add_strong_all = finalize_theorem nth_derivative_add_strong_all;; +let nth_derivative_add = finalize_theorem nth_derivative_add;; +let nth_diff_add = finalize_theorem nth_diff_add;; +let nth_derivative_sub_strong = finalize_theorem nth_derivative_sub_strong;; +let nth_derivative_sub_strong_all = finalize_theorem nth_derivative_sub_strong_all;; +let nth_derivative_sub = finalize_theorem nth_derivative_sub;; +let nth_diff_sub = finalize_theorem nth_diff_sub;; +let nth_derivative_mul_strong = finalize_theorem nth_derivative_mul_strong;; +let nth_derivative_mul_strong_all = finalize_theorem nth_derivative_mul_strong_all;; +let nth_derivative_mul = finalize_theorem nth_derivative_mul;; +let nth_diff_mul = finalize_theorem nth_diff_mul;; +end_section "NthDerivativeArith";; + +(* Finalization of the section NthDerivatives *) +let has_derivative_cond = finalize_theorem has_derivative_cond;; +let has_derivative_alt = finalize_theorem has_derivative_alt;; +let derivative_unique = finalize_theorem derivative_unique;; +let derivative_unique_on = finalize_theorem derivative_unique_on;; +let has_derivative_lemma = finalize_theorem has_derivative_lemma;; +let nth_derivative0 = finalize_theorem nth_derivative0;; +let nth_derivativeS = finalize_theorem nth_derivativeS;; +let nth_Sderivative = finalize_theorem nth_Sderivative;; +let nth_derivative1 = finalize_theorem nth_derivative1;; +let nth_derivative2 = finalize_theorem nth_derivative2;; +let nth_derivative_add = finalize_theorem nth_derivative_add;; +let nth_diff_continuous = finalize_theorem nth_diff_continuous;; +let nth_differentiable_cond = finalize_theorem nth_differentiable_cond;; +let nth_differentiable_on_cond = finalize_theorem nth_differentiable_on_cond;; +let nth_differentiable_eq = finalize_theorem nth_differentiable_eq;; +let nth_differentiable_on_int2 = finalize_theorem nth_differentiable_on_int2;; +let nth_mth_diff = finalize_theorem nth_mth_diff;; +let nth_differentiable1 = finalize_theorem nth_differentiable1;; +let nth_diff_imp_diff = finalize_theorem nth_diff_imp_diff;; +let nth_derivative_continuous = finalize_theorem nth_derivative_continuous;; +let ith_derivative_differentiable = finalize_theorem ith_derivative_differentiable;; +let nth_diff_strong_imp_diff = finalize_theorem nth_diff_strong_imp_diff;; +let derivative_x = finalize_theorem derivative_x;; +let derivative_const = finalize_theorem derivative_const;; +let derivative_inv = finalize_theorem derivative_inv;; +let derivative_atn = finalize_theorem derivative_atn;; +let derivative_exp = finalize_theorem derivative_exp;; +let derivative_acs = finalize_theorem derivative_acs;; +let derivative_sqrt = finalize_theorem derivative_sqrt;; +let derivative_composition = finalize_theorem derivative_composition;; +let REAL_DIFFERENTIABLE_AT_INV = finalize_theorem REAL_DIFFERENTIABLE_AT_INV;; +let derivative_compose_atn = finalize_theorem derivative_compose_atn;; +let derivative_compose_exp = finalize_theorem derivative_compose_exp;; +let derivative_compose_inv = finalize_theorem derivative_compose_inv;; +let derivative_compose_sqrt = finalize_theorem derivative_compose_sqrt;; +let derivative_compose_acs = finalize_theorem derivative_compose_acs;; +let derivative_scale = finalize_theorem derivative_scale;; +let derivative_neg = finalize_theorem derivative_neg;; +let derivative_pow = finalize_theorem derivative_pow;; +let derivative_add = finalize_theorem derivative_add;; +let derivative_mul = finalize_theorem derivative_mul;; +let derivative_sub = finalize_theorem derivative_sub;; +let derivative_div = finalize_theorem derivative_div;; +let differentiable_sum_numseg = finalize_theorem differentiable_sum_numseg;; +let derivative_sum_numseg = finalize_theorem derivative_sum_numseg;; +let HAS_REAL_DERIVATIVE_LOCAL = finalize_theorem HAS_REAL_DERIVATIVE_LOCAL;; +let differentiable_local = finalize_theorem differentiable_local;; +let nth_derivative_scale_strong = finalize_theorem nth_derivative_scale_strong;; +let nth_derivative_scale_strong_all = finalize_theorem nth_derivative_scale_strong_all;; +let nth_derivative_scale = finalize_theorem nth_derivative_scale;; +let nth_diff_scale = finalize_theorem nth_diff_scale;; +let nth_derivative_add_strong = finalize_theorem nth_derivative_add_strong;; +let nth_derivative_add_strong_all = finalize_theorem nth_derivative_add_strong_all;; +let nth_derivative_add = finalize_theorem nth_derivative_add;; +let nth_diff_add = finalize_theorem nth_diff_add;; +let nth_derivative_sub_strong = finalize_theorem nth_derivative_sub_strong;; +let nth_derivative_sub_strong_all = finalize_theorem nth_derivative_sub_strong_all;; +let nth_derivative_sub = finalize_theorem nth_derivative_sub;; +let nth_diff_sub = finalize_theorem nth_diff_sub;; +let nth_derivative_mul_strong = finalize_theorem nth_derivative_mul_strong;; +let nth_derivative_mul_strong_all = finalize_theorem nth_derivative_mul_strong_all;; +let nth_derivative_mul = finalize_theorem nth_derivative_mul;; +let nth_diff_mul = finalize_theorem nth_diff_mul;; +end_section "NthDerivatives";; +let lin_approx = new_definition `lin_approx f x f_bounds df_bounds <=> + interval_arith (f x) f_bounds /\ + (?f'. (f has_real_derivative f') (atreal x) /\ interval_arith f' df_bounds)`;; +let has_bounded_second_derivative = new_definition `has_bounded_second_derivative f int dd_bounds <=> + nth_diff_strong_int 2 int f /\ + bounded_on_int (nth_derivative 2 f) int dd_bounds`;; +let taylor_interval = new_definition + `taylor_interval f x y z w f_bounds df_bounds ddf_bounds <=> + x <= y /\ y <= z /\ y - x <= w /\ z - y <= w /\ + lin_approx f y f_bounds df_bounds /\ + has_bounded_second_derivative f (x, z) ddf_bounds`;; + +(* Lemma nth_diff_strong_imp_diff_int *) +let nth_diff_strong_imp_diff_int = section_proof ["n";"int";"f"] +`nth_diff_strong_int n int f ==> + nth_differentiable_on_int n int f` +[ + ((((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_differentiable_on_int")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_diff_strong")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_differentiable_on")(thm_tac (new_rewrite [] []))))); + (BETA_TAC THEN (move ["h"]) THEN (move ["x"]) THEN (move ["ineq"])); + ((((fun arg_tac -> (use_arg_then "h") (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xs"]))) THEN (exact_tac) THEN (done_tac)); +];; + +(* Lemma has_bounded_second_derivative_old *) +let has_bounded_second_derivative_old = section_proof ["f";"int";"dd_bounds"] +`has_bounded_second_derivative f int dd_bounds ==> + ?f' f''. (!x. interval_arith x int ==> (f has_real_derivative f' x) (atreal x) /\ + (f' has_real_derivative f'' x) (atreal x) /\ interval_arith (f'' x) dd_bounds)` +[ + ((((use_arg_then "has_bounded_second_derivative")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then "nth_diff_strong_imp_diff_int") (thm_tac (match_mp_then snd_th MP_TAC)))))); + ((DISCH_THEN (fun snd_th -> (use_arg_then "nth_differentiable_on_int2") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["f'"])) THEN (case THEN (move ["f''"]))); + ((BETA_TAC THEN (case THEN (move ["eq1"])) THEN (case THEN (move ["eq2"])) THEN (move ["h"]) THEN (move ["b"])) THEN ((((use_arg_then "f'") (term_tac exists_tac)) THEN ((use_arg_then "f''") (term_tac exists_tac))) THEN (move ["x"]) THEN (move ["ineq"]))); + ((((use_arg_then "b") (disch_tac [])) THEN (clear_assumption "b") THEN BETA_TAC) THEN (((((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "eq2")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["b"]))); + (((repeat_tactic 1 9 (((use_arg_then "h")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "b")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma exists_and_left *) +let exists_and_left = section_proof ["P";"Q"] +`(?x. P x /\ Q x) ==> (?x. P x)` +[ + (BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN ((move ["Px"]) THEN (move ["_"])))); + (((use_arg_then "x") (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma lim_ineq *) +let lim_ineq = section_proof ["a";"b"] +`(!e. &0 < e ==> a <= b + e) <=> (a <= b)` +[ + ((THENL_ROT (-1)) ((THENL) (split_tac) [ALL_TAC; ((move ["ineq"]) THEN (move ["e"]) THEN (move ["e0"]))])); + (((((fun arg_tac -> (use_arg_then "REAL_ADD_RID") (fun fst_arg -> (use_arg_then "a") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_ADD2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ineq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LT_IMP_LE")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "contraLR") (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then "NOT_FORALL_THM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "NOT_IMP")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_NOT_LE")(thm_tac (new_rewrite [] [])))))) THEN (move ["ba"]))); + (((fun arg_tac -> arg_tac (Arg_term (`(a - b) / &2`))) (term_tac exists_tac)) THEN (((use_arg_then "ba") (disch_tac [])) THEN (clear_assumption "ba") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma continuous_leq *) +let continuous_leq = section_proof ["f";"c";"a"] +`(?b. a < b /\ !x. x IN real_interval (a, b) ==> f x <= c) /\ + f real_continuous atreal a ==> f a <= c` +[ + (BETA_TAC THEN (case THEN ((case THEN (move ["b"])) THEN (case THEN (move ["ab"])) THEN (move ["ineq"])))); + (((((use_arg_then "REAL_CONTINUOUS_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REALLIM_ATREAL")(thm_tac (new_rewrite [] []))))) THEN (move ["f_cont"])); + ((((use_arg_then "lim_ineq")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["e"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "f_cont") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["cond"])); + ((fun arg_tac -> arg_tac (Arg_term (`a + min (b - a) d / &2`))) (term_tac (set_tac "r"))); + ((THENL_FIRST) ((((fun arg_tac -> (use_arg_then "cond") (fun fst_arg -> (use_arg_then "r") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)) ((((use_arg_then "ab") (disch_tac [])) THEN (clear_assumption "ab") THEN ((use_arg_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN ((use_arg_then "r_def") (disch_tac [])) THEN (clear_assumption "r_def") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_LAST) ((((fun arg_tac -> (use_arg_then "ineq") (fun fst_arg -> (use_arg_then "r") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)) ((arith_tac) THEN (done_tac))); + ((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ab") (disch_tac [])) THEN (clear_assumption "ab") THEN ((use_arg_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN ((use_arg_then "r_def") (disch_tac [])) THEN (clear_assumption "r_def") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma continuous_reflection *) +let continuous_reflection = section_proof ["f";"x"] +`f real_continuous atreal x <=> + (\x. f (--x)) real_continuous atreal (--x)` +[ + (((repeat_tactic 1 9 (((use_arg_then "REAL_CONTINUOUS_ATREAL")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "REALLIM_ATREAL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_NEG_NEG")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((split_tac) THEN (move ["h"]) THEN (move ["e"]) THEN (move ["e0"]))); + (((fun arg_tac -> (use_arg_then "h") (fun fst_arg -> (use_arg_then "e0") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["cond"])); + (((use_arg_then "d") (term_tac exists_tac)) THEN (((((use_arg_then "d0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (move ["ineqs"])) THEN (((use_arg_then "cond") (disch_tac [])) THEN (clear_assumption "cond") THEN (DISCH_THEN apply_tac))); + ((((use_arg_then "ineqs") (disch_tac [])) THEN (clear_assumption "ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((fun arg_tac -> (use_arg_then "h") (fun fst_arg -> (use_arg_then "e0") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["cond"])); + (((use_arg_then "d") (term_tac exists_tac)) THEN (((((use_arg_then "d0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (move ["ineqs"]))); + ((((fun arg_tac -> (use_arg_then "cond") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`--y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then "REAL_NEG_NEG")(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN (((use_arg_then "ineqs") (disch_tac [])) THEN (clear_assumption "ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma continuous_leq_segment *) +let continuous_leq_segment = section_proof ["f";"c";"a";"b"] +`a < b ==> f real_continuous atreal a ==> f real_continuous atreal b ==> + (!x. x IN real_interval (a, b) ==> f x <= c) ==> + (!x. x IN real_interval [a, b] ==> f x <= c)` +[ + (BETA_TAC THEN (move ["ab"]) THEN (move ["f_cont_a"]) THEN (move ["f_cont_b"]) THEN (move ["ineq"]) THEN (move ["x"])); + ((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 2 0 (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b. a <= b <=> (a = b \/ a < b)`)))(thm_tac (new_rewrite [] [])))))); + (case THEN ((THENL) case [((((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["_"])); (move ["ax"])])); + ((((use_arg_then "continuous_leq") (disch_tac [])) THEN (clear_assumption "continuous_leq") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then "f_cont_a")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then "b") (term_tac exists_tac)) THEN (done_tac)); + ((THENL_LAST) ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (move ["xb"])]) ((((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`\x. f (--x)`))) (term_tac (set_tac "g"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`!x. f x = g (--x)`))) (term_tac (have_gen_tac [](move ["fg"])))) (((((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "REAL_NEG_NEG")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then "fg")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "continuous_leq") (disch_tac [])) THEN (clear_assumption "continuous_leq") THEN (DISCH_THEN apply_tac)) THEN (split_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`--a`))) (term_tac exists_tac)) THEN (((((use_arg_then "REAL_LT_NEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ab")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (move ["y"]))); + ((((fun arg_tac -> (use_arg_then "ineq") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`--y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "fg")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_NEG_NEG")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then "g_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "continuous_reflection")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma pair_eq *) +let pair_eq = section_proof ["p"] +`p = (FST p, SND p)` +[ + (done_tac); +];; + +(* Section Taylor *) +begin_section "Taylor";; + +(* Lemma iabs_alt *) +let iabs_alt = section_proof ["lo";"hi";"a"] +`interval_arith a (lo, hi) ==> iabs (lo, hi) = max (abs lo) (abs hi)` +[ + (((((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "iabs")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma iabs_pos *) +let iabs_pos = section_proof ["lo";"hi";"a"] +`interval_arith a (lo, hi) ==> &0 <= iabs (lo, hi)` +[ + (((((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "iabs")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; +(add_section_var (mk_var ("f", (`:real -> real`))));; +(add_section_var (mk_var ("x", (`:real`))); add_section_var (mk_var ("y", (`:real`))); add_section_var (mk_var ("z", (`:real`))); add_section_var (mk_var ("w", (`:real`))));; +(add_section_var (mk_var ("f_bounds", (`:real#real`))); add_section_var (mk_var ("df_bounds", (`:real#real`))); add_section_var (mk_var ("ddf_bounds", (`:real#real`))));; +(add_section_var (mk_var ("dd_bound", (`:real`))));; +(add_section_hyp "dd_bound_eq" (`dd_bound = iabs ddf_bounds`));; +(add_section_hyp "tif" (`taylor_interval f x y z w f_bounds df_bounds ddf_bounds`));; + +(* Lemma f_continuous *) +let f_continuous = section_proof [] +`!t. t IN real_interval [x, z] ==> f real_continuous atreal t` +[ + (((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["t"]) THEN (move ["t_in"])); + (((use_arg_then "HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL") (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL") THEN (DISCH_THEN apply_tac)); + ((((use_arg_then "tif") (disch_tac [])) THEN (clear_assumption "tif") THEN BETA_TAC) THEN (((((use_arg_then "taylor_interval")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andbA")(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "has_bounded_second_derivative_old") (thm_tac (match_mp_then snd_th MP_TAC)))))); + (BETA_TAC THEN (case THEN (move ["f'"])) THEN (case THEN (move ["f''"])) THEN (move ["df"])); + (((fun arg_tac -> arg_tac (Arg_term (`f' t`))) (term_tac exists_tac)) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma taylor_error *) +let taylor_error = section_proof ["t"] +`x <= t /\ t <= z ==> + abs (f t - f y) <= w * iabs df_bounds + w * w * dd_bound / &2` +[ + (BETA_TAC THEN (move ["t_ineqs"])); + (((use_arg_then "tif") (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (((((use_arg_then "taylor_interval")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andbA")(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["domain_ineqs"])) THEN (move ["lin_app"]))); + ((DISCH_THEN (fun snd_th -> (use_arg_then "has_bounded_second_derivative_old") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["f'"])) THEN (case THEN (move ["f''"])) THEN (move ["df"])); + ((fun arg_tac -> arg_tac (Arg_term (`abs (t - y) <= w`))) (term_tac (have_gen_tac [](move ["abs_ty"])))); + ((((use_arg_then "t_ineqs") (disch_tac [])) THEN (clear_assumption "t_ineqs") THEN ((use_arg_then "domain_ineqs") (disch_tac [])) THEN (clear_assumption "domain_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`interval_arith y (x, z)`))) (term_tac (have_gen_tac [](move ["y_in"])))) ((((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`&0 <= dd_bound /\ !p. p IN real_interval [x, z] ==> abs (f'' p) <= dd_bound`))) (term_tac (have_gen_tac [](move ["dd_prop"])))); + ((((use_arg_then "dd_bound_eq")(thm_tac (new_rewrite [] [])))) THEN (split_tac)); + ((((fun arg_tac -> (use_arg_then "df") (fun fst_arg -> (use_arg_then "y_in") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then "pair_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "iabs")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (BETA_TAC THEN (move ["p"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "df") (thm_tac (match_mp_then snd_th MP_TAC))))) THEN ((((use_arg_then "pair_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "iabs")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`abs (f t - (f y + f' y * (t - y) pow 1)) <= dd_bound * abs (t - y) pow (1 + 1) / &2`))) (term_tac (have_gen_tac []ALL_TAC)))); + (((fun arg_tac -> arg_tac (Arg_term (`f' y * _`))) (term_tac (set_tac "b1"))) THEN (((fun arg_tac -> arg_tac (Arg_term (`dd_bound * _`))) (term_tac (set_tac "b2"))) THEN (move ["ineq1"]))); + ((((use_arg_then "REAL_LE_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`abs (f t - (f y + b1)) + abs b1`))) (term_tac exists_tac)) THEN (split_tac)); + (((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b. a - b = (a - (b + b1)) + b1`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ABS_TRIANGLE")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "REAL_ADD_SYM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_ADD2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "b1_def")(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then "REAL_POW_1")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ABS_MUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_SYM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_MUL2")(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((use_arg_then "REAL_ABS_POS")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "abs_ty")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "pair_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "iabs")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "lin_app") (disch_tac [])) THEN (clear_assumption "lin_app") THEN BETA_TAC) THEN ((((use_arg_then "lin_approx")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["ff"])) THEN (case THEN (move ["df'"])))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`ff = f' y`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) (((((use_arg_then "pair_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "REAL_DERIVATIVE_UNIQUE_ATREAL") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "y") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then "df'")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then "b2") (term_tac exists_tac))); + ((((use_arg_then "ineq1")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "b2_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "real_div")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_ASSOC")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_MUL2")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `1 + 1 = 2`)))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_INV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_LE_MUL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dd_prop")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_LE_POW_2")(thm_tac (new_rewrite [] [])))))) THEN (TRY ((arith_tac)))); + ((((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andbT")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_MUL_SYM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_POW_2")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_MUL2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "dd_prop")(thm_tac (new_rewrite [] []))))); + (((((use_arg_then "REAL_LE_POW_2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andbT")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_SQUARE_ABS")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_ABS_ABS")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "abs_ty") (disch_tac [])) THEN (clear_assumption "abs_ty") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`\i. if i = 0 then f else if i = 1 then f' else if i = 2 then f'' else I`))) (term_tac (set_tac "Df"))); + ((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `0 + 1 = 1 /\ ~(1 = 0) /\ 1 + 1 = 2 /\ + ~(2 = 1) /\ ~(2 = 1) /\ ~(2 = 0)`))) (fun arg -> thm_tac MP_TAC arg THEN (move ["arith"]))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "REAL_TAYLOR") (fun fst_arg -> (use_arg_then "Df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`real_interval [x, z]`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "dd_bound") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (ANTS_TAC); + (((((use_arg_then "IS_REALINTERVAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(gsym_then (thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (move ["i"]) THEN (move ["p"]) THEN (case THEN (move ["p_in"]))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `i <= 1 <=> i = 0 \/ i = 1`)))(thm_tac (new_rewrite [] []))))); + ((case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then "Df_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ((use_arg_then "HAS_REAL_DERIVATIVE_ATREAL_WITHIN") (thm_tac apply_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then "arith")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])) THEN ((((use_arg_then "Df_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + (((repeat_tactic 1 9 (((use_arg_then "arith")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "dd_prop")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN ((fun arg_tac -> (fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "y") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "t") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN ((repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "domain_ineqs")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "t_ineqs")(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + ((((use_arg_then "ONE")(thm_tac (new_rewrite [1] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL SUM_CLAUSES_NUMSEG)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUM_SING_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "Df_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "ONE")(gsym_then (thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `0 <= 1 /\ ~(1 = 0)`)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL real_pow)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "FACT")(thm_tac (new_rewrite [] []))))); + (((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `FACT 1 = 1 /\ FACT (1 + 1) = 2`)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_DIV_1")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma taylor_upper_bound *) +let taylor_upper_bound = section_proof [] +`!t. x <= t /\ t <= z ==> + f t <= SND f_bounds + (w * iabs df_bounds + w * w * dd_bound / &2)` +[ + (((fun arg_tac -> (use_arg_then "pair_eq") (fun fst_arg -> (use_arg_then "f_bounds") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["eq"])); + (BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "taylor_error") (thm_tac (match_mp_then snd_th MP_TAC))))); + ((((use_arg_then "tif") (disch_tac [])) THEN (clear_assumption "tif") THEN BETA_TAC) THEN (((((use_arg_then "taylor_interval")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andbA")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "lin_approx")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["_"])) THEN (case THEN (move ["f_int"])) THEN (move ["_"]) THEN (move ["_"]))); + ((((use_arg_then "f_int") (disch_tac [])) THEN (clear_assumption "f_int") THEN BETA_TAC) THEN ((((use_arg_then "eq")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma taylor_lower_bound *) +let taylor_lower_bound = section_proof [] +`!t. x <= t /\ t <= z ==> + FST f_bounds - (w * iabs df_bounds + w * w * dd_bound / &2) <= f t` +[ + ((fun arg_tac -> (use_arg_then "pair_eq") (fun fst_arg -> (use_arg_then "f_bounds") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["eq"]))); + (BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "taylor_error") (thm_tac (match_mp_then snd_th MP_TAC))))); + ((((use_arg_then "tif") (disch_tac [])) THEN (clear_assumption "tif") THEN BETA_TAC) THEN (((((use_arg_then "eq")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "taylor_interval")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andbA")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "lin_approx")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["_"])) THEN (case THEN (move ["f_int"])) THEN (move ["_"]) THEN (move ["_"]))); + ((((use_arg_then "f_int") (disch_tac [])) THEN (clear_assumption "f_int") THEN BETA_TAC) THEN (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))) THEN (arith_tac)); +];; + +(* Lemma taylor_derivative_error *) +let taylor_derivative_error = section_proof [] +`!t. x <= t /\ t <= z ==> + abs (derivative f t - derivative f y) <= w * dd_bound` +[ + (BETA_TAC THEN (move ["t"]) THEN (move ["t_ineqs"])); + (((use_arg_then "tif") (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (((((use_arg_then "taylor_interval")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andbA")(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["domain_ineqs"])) THEN (move ["_"]))); + ((DISCH_THEN (fun snd_th -> (use_arg_then "has_bounded_second_derivative_old") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["f'"])) THEN (case THEN (move ["f''"])) THEN (move ["df"])); + ((fun arg_tac -> arg_tac (Arg_term (`abs (t - y) <= w`))) (term_tac (have_gen_tac [](move ["abs_ty"])))); + ((((use_arg_then "t_ineqs") (disch_tac [])) THEN (clear_assumption "t_ineqs") THEN ((use_arg_then "domain_ineqs") (disch_tac [])) THEN (clear_assumption "domain_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!p. x <= p /\ p <= z ==> derivative f p = f' p`))) (term_tac (have_gen_tac [](move ["der_eq"])))); + (((((use_arg_then "IN_REAL_INTERVAL")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "EQ_SYM_EQ")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "derivative_unique_on") (disch_tac [])) THEN (clear_assumption "derivative_unique_on") THEN (DISCH_THEN apply_tac))); + ((((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["p"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "df") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (simp_tac)) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then "der_eq")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`&0 <= dd_bound /\ !p. p IN real_interval [x, z] ==> abs (f'' p) <= dd_bound`))) (term_tac (have_gen_tac [](move ["dd_prop"])))); + (((((use_arg_then "dd_bound_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (split_tac)); + ((((fun arg_tac -> (use_arg_then "df") (fun fst_arg -> (use_arg_then "y") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((fun arg_tac -> (use_arg_then "pair_eq") (fun fst_arg -> (use_arg_then "ddf_bounds") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "iabs")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "domain_ineqs")(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); + ((BETA_TAC THEN (move ["p"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "df") (thm_tac (match_mp_then snd_th MP_TAC))))) THEN ((((use_arg_then "pair_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "iabs")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`\i. if i = 0 then f' else if i = 1 then f'' else I`))) (term_tac (set_tac "Df"))); + ((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `0 + 1 = 1 /\ ~(1 = 0) /\ 1 + 1 = 2 /\ + ~(2 = 1) /\ ~(2 = 1) /\ ~(2 = 0)`))) (fun arg -> thm_tac MP_TAC arg THEN (move ["arith"]))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "REAL_TAYLOR") (fun fst_arg -> (use_arg_then "Df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`real_interval [x, z]`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "dd_bound") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (ANTS_TAC); + (((((use_arg_then "IS_REALINTERVAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((BETA_TAC THEN (move ["i"]) THEN (move ["p"]) THEN (case THEN (move ["p_in"]))) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `i <= 0 <=> i = 0`)))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then "Df_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "arith")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_ATREAL_WITHIN") (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_ATREAL_WITHIN") THEN (DISCH_THEN apply_tac))); + (((((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_REAL_INTERVAL")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])) THEN ((((use_arg_then "Df_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + (((repeat_tactic 1 9 (((use_arg_then "arith")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "dd_prop")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN ((fun arg_tac -> (fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "y") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "t") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN ((repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "domain_ineqs")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "t_ineqs")(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + ((((use_arg_then "ONE")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "SUM_SING_NUMSEG")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "Df_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "ONE")(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL real_pow)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "arith")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "FACT")(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `FACT 1 = 1`)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_DIV_1")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "REAL_POW_1")(thm_tac (new_rewrite [] [])))) THEN (move ["ineq"])); + ((((use_arg_then "REAL_LE_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`dd_bound * abs (t - y)`))) (term_tac exists_tac))); + (((((use_arg_then "ineq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_SYM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_RMUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "dd_prop")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "abs_ty")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma derivative_interval *) +let derivative_interval = section_proof [] +`FST df_bounds <= derivative f y /\ derivative f y <= SND df_bounds` +[ + ((fun arg_tac -> (use_arg_then "pair_eq") (fun fst_arg -> (use_arg_then "df_bounds") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["eq"]))); + ((((use_arg_then "tif") (disch_tac [])) THEN (clear_assumption "tif") THEN BETA_TAC) THEN (((((use_arg_then "taylor_interval")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "lin_approx")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andbA")(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["ineqs"])) THEN (case THEN (move ["g"])) THEN (case THEN ((move ["fg"]) THEN (move ["g_int"]))) THEN (move ["_"]))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`derivative f y = g`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((((use_arg_then "g_int") (disch_tac [])) THEN (clear_assumption "g_int") THEN BETA_TAC) THEN ((((use_arg_then "eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then "REAL_DERIVATIVE_UNIQUE_ATREAL") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "y") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((((use_arg_then "fg")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "has_derivative_cond")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((use_arg_then "g") (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma taylor_derivative_upper_bound *) +let taylor_derivative_upper_bound = section_proof [] +`!t. x <= t /\ t <= z ==> + derivative f t <= SND df_bounds + w * dd_bound` +[ + ((BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "taylor_derivative_error") (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then "derivative_interval") (disch_tac [])) THEN (clear_assumption "derivative_interval") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma taylor_derivative_lower_bound *) +let taylor_derivative_lower_bound = section_proof [] +`!t. x <= t /\ t <= z ==> + FST df_bounds - w * dd_bound <= derivative f t` +[ + ((BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "taylor_derivative_error") (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then "derivative_interval") (disch_tac [])) THEN (clear_assumption "derivative_interval") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section Taylor *) +let iabs_alt = finalize_theorem iabs_alt;; +let iabs_pos = finalize_theorem iabs_pos;; +let f_continuous = finalize_theorem f_continuous;; +let taylor_error = finalize_theorem taylor_error;; +let taylor_upper_bound = finalize_theorem taylor_upper_bound;; +let taylor_lower_bound = finalize_theorem taylor_lower_bound;; +let taylor_derivative_error = finalize_theorem taylor_derivative_error;; +let derivative_interval = finalize_theorem derivative_interval;; +let taylor_derivative_upper_bound = finalize_theorem taylor_derivative_upper_bound;; +let taylor_derivative_lower_bound = finalize_theorem taylor_derivative_lower_bound;; +end_section "Taylor";; + +(* Section LinearApproximation *) +begin_section "LinearApproximation";; +(add_section_var (mk_var ("f", (`:real->real`))));; +(add_section_var (mk_var ("f_bounds", (`:real#real`))); add_section_var (mk_var ("df_bounds", (`:real#real`))));; +(add_section_var (mk_var ("x", (`:real`))));; + +(* Lemma lin_approx_eq *) +let lin_approx_eq = section_proof [] +`lin_approx f x f_bounds df_bounds <=> + (f real_differentiable atreal x /\ interval_arith (f x) f_bounds /\ + interval_arith (derivative f x) df_bounds)` +[ + (((((use_arg_then "lin_approx")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "real_differentiable")(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [(case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (case THEN (move ["f'"])) THEN (case THEN ((move ["df'"]) THEN (move ["int_f'"]))))); ((case THEN ((case THEN (move ["f'"])) THEN (move ["df"]))) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["df_int"]))))])); + ((THENL_FIRST) (split_tac) (((use_arg_then "f'") (term_tac exists_tac)) THEN (done_tac))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "derivative_unique") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "f'") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then "f'") (term_tac exists_tac)) THEN ((((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "derivative_unique") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "f'") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "x") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; +(add_section_hyp "approx_f" (`lin_approx f x f_bounds df_bounds`));; + +(* Lemma lin_approx_imp_f_interval *) +let lin_approx_imp_f_interval = section_proof [] +`interval_arith (f x) f_bounds` +[ + ((((use_arg_then "approx_f") (disch_tac [])) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN ((((use_arg_then "lin_approx_eq")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma lin_approx_imp_df_interval *) +let lin_approx_imp_df_interval = section_proof [] +`interval_arith (derivative f x) df_bounds` +[ + ((((use_arg_then "approx_f") (disch_tac [])) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN ((((use_arg_then "lin_approx_eq")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma lin_approx_imp_f_diff *) +let lin_approx_imp_f_diff = section_proof [] +`f real_differentiable atreal x` +[ + ((((use_arg_then "approx_f") (disch_tac [])) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN ((((use_arg_then "lin_approx_eq")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Finalization of the section LinearApproximation *) +let lin_approx_eq = finalize_theorem lin_approx_eq;; +let lin_approx_imp_f_interval = finalize_theorem lin_approx_imp_f_interval;; +let lin_approx_imp_df_interval = finalize_theorem lin_approx_imp_df_interval;; +let lin_approx_imp_f_diff = finalize_theorem lin_approx_imp_f_diff;; +end_section "LinearApproximation";; + +(* Section MoreLinearApproximation *) +begin_section "MoreLinearApproximation";; +(add_section_var (mk_var ("f", (`:real->real`))); add_section_var (mk_var ("g", (`:real->real`))));; +(add_section_var (mk_var ("x", (`:real`))));; +(add_section_var (mk_var ("f_bounds", (`:real#real`))); add_section_var (mk_var ("df_bounds", (`:real#real`))));; +(add_section_var (mk_var ("g_bounds", (`:real#real`))); add_section_var (mk_var ("dg_bounds", (`:real#real`))));; + +(* Lemma interval_arith_not_zero *) +let interval_arith_not_zero = section_proof ["x";"int"] +`interval_arith x int ==> interval_not_zero int ==> + ~(x = &0)` +[ + (((((fun arg_tac -> (use_arg_then "PAIR") (fun fst_arg -> (use_arg_then "int") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_not_zero")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma interval_arith_pos *) +let interval_arith_pos = section_proof ["x";"int"] +`interval_arith x int ==> interval_pos int ==> &0 < x` +[ + ((((use_arg_then "int") (disch_tac [])) THEN (clear_assumption "int") THEN case) THEN ((((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_pos")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma interval_arith_abs *) +let interval_arith_abs = section_proof ["x";"int";"y"] +`interval_arith x int ==> iabs int < y ==> abs x < y` +[ + (((((fun arg_tac -> (use_arg_then "PAIR") (fun fst_arg -> (use_arg_then "int") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "iabs")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma lin_approx_x *) +let lin_approx_x = section_proof [] +`lin_approx (\x. x) x (x, x) (&1, &1)` +[ + (((((use_arg_then "lin_approx_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "derivative_x")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "REAL_DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma lin_approx_const *) +let lin_approx_const = section_proof ["c"] +`lin_approx (\x. c) x (c, c) (&0, &0)` +[ + ((((use_arg_then "lin_approx_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "derivative_const")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "REAL_DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section LinearApproxUnivariateComposition *) +begin_section "LinearApproxUnivariateComposition";; +(add_section_hyp "approx_f" (`lin_approx f x f_bounds df_bounds`));; + +(* Lemma lin_approx_compose_atn *) +let lin_approx_compose_atn = section_proof [] +`(\x. atn (f x)) real_differentiable atreal x /\ + derivative (\x. atn (f x)) x = derivative f x / (&1 + f x * f x)` +[ + ((((use_arg_then "derivative_compose_atn") (disch_tac [])) THEN (clear_assumption "derivative_compose_atn") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "approx_f") (disch_tac [])) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN ((((use_arg_then "lin_approx_eq")(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma lin_approx_compose_exp *) +let lin_approx_compose_exp = section_proof [] +`(\x. exp (f x)) real_differentiable atreal x /\ + derivative (\x. exp (f x)) x = exp (f x) * derivative f x` +[ + ((((use_arg_then "derivative_compose_exp") (disch_tac [])) THEN (clear_assumption "derivative_compose_exp") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "approx_f") (disch_tac [])) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN ((((use_arg_then "lin_approx_eq")(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma lin_approx_compose_inv *) +let lin_approx_compose_inv = section_proof [] +`interval_not_zero f_bounds ==> + (\x. inv (f x)) real_differentiable atreal x /\ + derivative (\x. inv (f x)) x = -- inv (f x * f x) * derivative f x` +[ + ((((use_arg_then "approx_f") (disch_tac [])) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN ((((use_arg_then "lin_approx_eq")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["df"]) THEN (move ["h"]))) THEN (move ["f0"]))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(f x = &0)`))) (term_tac (have_gen_tac [](move ["fn0"])))) ((((use_arg_then "interval_arith_not_zero") (disch_tac [])) THEN (clear_assumption "interval_arith_not_zero") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then "f_bounds") (term_tac exists_tac)) THEN (done_tac))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then "derivative_compose_inv") (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "fn0") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +];; + +(* Lemma lin_approx_compose_sqrt *) +let lin_approx_compose_sqrt = section_proof [] +`interval_pos f_bounds ==> + (\x. sqrt (f x)) real_differentiable atreal x /\ + derivative (\x. sqrt (f x)) x = derivative f x / (&2 * sqrt (f x))` +[ + ((((use_arg_then "approx_f") (disch_tac [])) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN ((((use_arg_then "lin_approx_eq")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["df"]) THEN (move ["h"]))) THEN (move ["f_ineq"]))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < f x`))) (term_tac (have_gen_tac [](move ["f_pos"])))) ((((use_arg_then "interval_arith_pos") (disch_tac [])) THEN (clear_assumption "interval_arith_pos") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then "f_bounds") (term_tac exists_tac)) THEN (done_tac))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then "derivative_compose_sqrt") (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "f_pos") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +];; + +(* Lemma lin_approx_compose_acs *) +let lin_approx_compose_acs = section_proof [] +`iabs f_bounds < &1 ==> + (\x. acs (f x)) real_differentiable atreal x /\ + derivative (\x. acs (f x)) x = -- (derivative f x / sqrt (&1 - f x * f x))` +[ + ((((use_arg_then "approx_f") (disch_tac [])) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN ((((use_arg_then "lin_approx_eq")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["df"]) THEN (move ["h"]))) THEN (move ["f_ineq"]))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`abs (f x) < &1`))) (term_tac (have_gen_tac [](move ["f_abs"])))) ((((use_arg_then "interval_arith_abs") (disch_tac [])) THEN (clear_assumption "interval_arith_abs") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then "f_bounds") (term_tac exists_tac)) THEN (done_tac))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then "derivative_compose_acs") (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "f_abs") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +];; + +(* Finalization of the section LinearApproxUnivariateComposition *) +let lin_approx_compose_atn = finalize_theorem lin_approx_compose_atn;; +let lin_approx_compose_exp = finalize_theorem lin_approx_compose_exp;; +let lin_approx_compose_inv = finalize_theorem lin_approx_compose_inv;; +let lin_approx_compose_sqrt = finalize_theorem lin_approx_compose_sqrt;; +let lin_approx_compose_acs = finalize_theorem lin_approx_compose_acs;; +end_section "LinearApproxUnivariateComposition";; +(add_section_hyp "approx_f" (`lin_approx f x f_bounds df_bounds`));; +(add_section_hyp "approx_g" (`lin_approx g x g_bounds dg_bounds`));; + +(* Lemma lin_approx_imp_add_diff *) +let lin_approx_imp_add_diff = section_proof [] +`(\x. f x + g x) real_differentiable atreal x` +[ + (((use_arg_then "REAL_DIFFERENTIABLE_ADD") (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_ADD") THEN (DISCH_THEN apply_tac)); + (((((fun arg_tac -> (use_arg_then "lin_approx_imp_f_diff") (fun fst_arg -> (use_arg_then "approx_f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "lin_approx_imp_f_diff") (fun fst_arg -> (use_arg_then "approx_g") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma lin_approx_imp_sub_diff *) +let lin_approx_imp_sub_diff = section_proof [] +`(\x. f x - g x) real_differentiable atreal x` +[ + (((use_arg_then "REAL_DIFFERENTIABLE_SUB") (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_SUB") THEN (DISCH_THEN apply_tac)); + (((((fun arg_tac -> (use_arg_then "lin_approx_imp_f_diff") (fun fst_arg -> (use_arg_then "approx_f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "lin_approx_imp_f_diff") (fun fst_arg -> (use_arg_then "approx_g") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma lin_approx_imp_mul_diff *) +let lin_approx_imp_mul_diff = section_proof [] +`(\x. f x * g x) real_differentiable atreal x` +[ + (((use_arg_then "REAL_DIFFERENTIABLE_MUL_ATREAL") (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_MUL_ATREAL") THEN (DISCH_THEN apply_tac)); + (((((fun arg_tac -> (use_arg_then "lin_approx_imp_f_diff") (fun fst_arg -> (use_arg_then "approx_f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "lin_approx_imp_f_diff") (fun fst_arg -> (use_arg_then "approx_g") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma lin_approx_imp_div_diff *) +let lin_approx_imp_div_diff = section_proof [] +`interval_not_zero g_bounds ==> (\x. f x / g x) real_differentiable atreal x` +[ + ((BETA_TAC THEN (move ["gn0"])) THEN (((use_arg_then "REAL_DIFFERENTIABLE_DIV_ATREAL") (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_DIV_ATREAL") THEN (DISCH_THEN apply_tac))); + ((((fun arg_tac -> (use_arg_then "lin_approx_imp_f_diff") (fun fst_arg -> (use_arg_then "approx_f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then "lin_approx_imp_f_diff") (fun fst_arg -> (use_arg_then "approx_g") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "interval_arith_not_zero") (disch_tac [])) THEN (clear_assumption "interval_arith_not_zero") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then "g_bounds") (term_tac exists_tac))); + ((((use_arg_then "approx_g") (disch_tac [])) THEN (clear_assumption "approx_g") THEN BETA_TAC) THEN ((((use_arg_then "lin_approx_eq")(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section MoreLinearApproximation *) +let interval_arith_not_zero = finalize_theorem interval_arith_not_zero;; +let interval_arith_pos = finalize_theorem interval_arith_pos;; +let interval_arith_abs = finalize_theorem interval_arith_abs;; +let lin_approx_x = finalize_theorem lin_approx_x;; +let lin_approx_const = finalize_theorem lin_approx_const;; +let lin_approx_compose_atn = finalize_theorem lin_approx_compose_atn;; +let lin_approx_compose_exp = finalize_theorem lin_approx_compose_exp;; +let lin_approx_compose_inv = finalize_theorem lin_approx_compose_inv;; +let lin_approx_compose_sqrt = finalize_theorem lin_approx_compose_sqrt;; +let lin_approx_compose_acs = finalize_theorem lin_approx_compose_acs;; +let lin_approx_imp_add_diff = finalize_theorem lin_approx_imp_add_diff;; +let lin_approx_imp_sub_diff = finalize_theorem lin_approx_imp_sub_diff;; +let lin_approx_imp_mul_diff = finalize_theorem lin_approx_imp_mul_diff;; +let lin_approx_imp_div_diff = finalize_theorem lin_approx_imp_div_diff;; +end_section "MoreLinearApproximation";; + +(* Section LinearApproxArith *) +begin_section "LinearApproxArith";; +(add_section_var (mk_var ("f1", (`:real->real`))); add_section_var (mk_var ("f2", (`:real->real`))));; +(add_section_var (mk_var ("f1_bounds", (`:real#real`))); add_section_var (mk_var ("f2_bounds", (`:real#real`))));; +(add_section_var (mk_var ("df1_lo", (`:real`))); add_section_var (mk_var ("df1_hi", (`:real`))); add_section_var (mk_var ("df2_lo", (`:real`))); add_section_var (mk_var ("df2_hi", (`:real`))));; +(add_section_var (mk_var ("f_bounds", (`:real#real`))));; +(add_section_var (mk_var ("df_lo", (`:real`))); add_section_var (mk_var ("df_hi", (`:real`))));; +(add_section_var (mk_var ("x", (`:real`))));; +(add_section_hyp "approx1" (`lin_approx f1 x f1_bounds (df1_lo, df1_hi)`));; + +(* Lemma lin_approx_scale *) +let lin_approx_scale = section_proof ["c"] +`&0 <= c ==> interval_arith (c * f1 x) f_bounds /\ + df_lo <= c * df1_lo /\ c * df1_hi <= df_hi ==> + lin_approx (\x. c * f1 x) x f_bounds (df_lo, df_hi)` +[ + (((((use_arg_then "pair_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] []))))) THEN (move ["c0"]) THEN (move ["ineqs"])); + (((((use_arg_then "lin_approx")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)); + ((((use_arg_then "pair_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ineqs") (disch_tac [])) THEN (clear_assumption "ineqs") THEN ((use_arg_then "approx1") (disch_tac [])) THEN (clear_assumption "approx1") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "lin_approx")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then "approx1") (disch_tac [])) THEN (clear_assumption "approx1") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "lin_approx")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["int_f1"])) THEN (case THEN (move ["f1'"])) THEN (case THEN ((move ["df1"]) THEN (move ["int_f1'"]))))); + (((fun arg_tac -> arg_tac (Arg_term (`c * f1'`))) (term_tac exists_tac)) THEN ((((use_arg_then "HAS_REAL_DERIVATIVE_LMUL_ATREAL")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "int_f1'") (disch_tac [])) THEN (clear_assumption "int_f1'") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] []))))) THEN (move ["ineqs2"])) THEN (split_tac) THEN (((use_arg_then "REAL_LE_TRANS") (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`c * df1_lo`))) (term_tac exists_tac)) THEN ((((use_arg_then "ineqs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_LMUL")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`c * df1_hi`))) (term_tac exists_tac)) THEN ((((use_arg_then "ineqs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_LMUL")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(add_section_hyp "approx2" (`lin_approx f2 x f2_bounds (df2_lo, df2_hi)`));; + +(* Lemma lin_approx_add *) +let lin_approx_add = section_proof [] +`interval_arith (f1 x + f2 x) f_bounds /\ + df_lo <= df1_lo + df2_lo /\ df1_hi + df2_hi <= df_hi ==> + lin_approx (\x. f1 x + f2 x) x f_bounds (df_lo, df_hi)` +[ + (((((use_arg_then "pair_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] []))))) THEN (move ["ineqs"])); + (((((use_arg_then "lin_approx")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)); + ((((use_arg_then "pair_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ineqs") (disch_tac [])) THEN (clear_assumption "ineqs") THEN ((use_arg_then "approx2") (disch_tac [])) THEN (clear_assumption "approx2") THEN ((use_arg_then "approx1") (disch_tac [])) THEN (clear_assumption "approx1") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "lin_approx")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then "approx2") (disch_tac [])) THEN (clear_assumption "approx2") THEN ((use_arg_then "approx1") (disch_tac [])) THEN (clear_assumption "approx1") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "lin_approx")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["int_f1"])) THEN (case THEN (move ["f1'"])) THEN (case THEN ((move ["df1"]) THEN (move ["int_f1'"]))))); + (BETA_TAC THEN (case THEN (move ["int_f2"])) THEN (case THEN (move ["f2'"])) THEN (case THEN ((move ["df2"]) THEN (move ["int_f2'"])))); + (((fun arg_tac -> arg_tac (Arg_term (`f1' + f2':real`))) (term_tac exists_tac)) THEN ((((use_arg_then "HAS_REAL_DERIVATIVE_ADD")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "int_f2'") (disch_tac [])) THEN (clear_assumption "int_f2'") THEN ((use_arg_then "int_f1'") (disch_tac [])) THEN (clear_assumption "int_f1'") THEN ((use_arg_then "ineqs") (disch_tac [])) THEN (clear_assumption "ineqs") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section LinearApproxArith *) +let lin_approx_scale = finalize_theorem lin_approx_scale;; +let lin_approx_add = finalize_theorem lin_approx_add;; +end_section "LinearApproxArith";; + +(* Section SecondDerivativeBound *) +begin_section "SecondDerivativeBound";; +(add_section_var (mk_var ("f1", (`:real->real`))); add_section_var (mk_var ("f2", (`:real->real`))));; +(add_section_var (mk_var ("int", (`:real#real`))));; +(add_section_var (mk_var ("dd1", (`:real#real`))); add_section_var (mk_var ("dd2", (`:real#real`))));; + +(* Lemma nth_diff_strong2_eq_alt *) +let nth_diff_strong2_eq_alt = section_proof ["f";"x"] +`nth_diff_strong 2 f x <=> ?s. real_open s /\ x IN s /\ + !y. y IN s ==> (f has_real_derivative derivative f y) (atreal y) /\ + (derivative f has_real_derivative nth_derivative 2 f y) (atreal y)` +[ + ((((use_arg_then "nth_diff_strong")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_differentiable_on")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_differentiable_eq")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `i < 2 <=> i = 0 \/ i = 1`)))(thm_tac (new_rewrite [] []))))); + ((split_tac) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])); + (((use_arg_then "s") (term_tac exists_tac)) THEN (((((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "df") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["_"])) THEN (move ["h"]))); + ((((fun arg_tac -> (use_arg_then "h") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then "h") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (simp_tac)) THEN (((((use_arg_then "ONE")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "nth_derivative1")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_derivative0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "TWO")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then "s") (term_tac exists_tac)) THEN (((((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "df") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["h"]))); + ((((use_arg_then "REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "real_differentiable")(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`derivative f y`))) (term_tac exists_tac)) THEN (done_tac)); + ((BETA_TAC THEN (move ["i"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((repeat_tactic 0 10 (((use_arg_then "ONE")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then "TWO")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then "nth_derivative0")(fun tmp_arg1 -> (use_arg_then "nth_derivative1")(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma nth_diff_strong2_eq *) +let nth_diff_strong2_eq = section_proof ["f";"x"] +`nth_diff_strong 2 f x <=> ?s. real_open s /\ x IN s /\ + !y. y IN s ==> f real_differentiable atreal y /\ derivative f real_differentiable atreal y` +[ + ((((use_arg_then "nth_diff_strong")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_differentiable_on")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "TWO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ONE")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL nth_differentiable)))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "ONE")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "nth_derivative0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_derivative1")(thm_tac (new_rewrite [] []))))); + ((split_tac) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])); + (((use_arg_then "s") (term_tac exists_tac)) THEN (((((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "df") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["h"])) THEN (done_tac)); + (((use_arg_then "s") (term_tac exists_tac)) THEN (((((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then "df") (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["h"]))); + (((repeat_tactic 1 9 (((use_arg_then "h")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma lin_approx_compose *) +let lin_approx_compose = section_proof ["f";"g";"y";"g_bounds";"f_bounds";"d_bounds"] +`nth_diff_strong_int 2 g_bounds f ==> + g real_differentiable atreal y ==> + interval_arith (g y) g_bounds ==> + bounded_on_int f g_bounds f_bounds ==> + interval_arith (derivative g y * derivative f (g y)) d_bounds ==> + lin_approx (\x. f (g x)) y f_bounds d_bounds` +[ + (((((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_diff_strong2_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] []))))) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["g_int"]) THEN (move ["f_int"]) THEN (move ["dfg_int"])); + ((fun arg_tac -> arg_tac (Arg_term (`f real_differentiable atreal (g y)`))) (term_tac (have_gen_tac [](move ["dfgy"])))); + ((((fun arg_tac -> (use_arg_then "df") (fun fst_arg -> (use_arg_then "g_int") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["ys"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "lin_approx_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "derivative_composition")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "dfg_int")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "f_int")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then "o_THM") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") (disch_tac [])) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma second_derivative_atn_eq *) +let second_derivative_atn_eq = section_proof ["x"] +`((\x. inv (&1 + x pow 2)) has_real_derivative + (-- &2 * x) * inv (&1 + x pow 2) pow 2) (atreal x)` +[ + (((((use_arg_then "REAL_POW_INV")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "real_div")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_NEG_LMUL")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_INV_ATREAL")(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((((fun arg_tac -> (use_arg_then "REAL_ADD_LID") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&2 * x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_ADD")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_CONST")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "REAL_POW_2")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `&2 * x = x * &1 + &1 * x`)))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then "HAS_REAL_DERIVATIVE_MUL_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_ID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then "REAL_POS_NZ")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_ADD_SYM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LT_ADD1")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_POW_2")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma second_derivative_atn *) +let second_derivative_atn = section_proof [] +`derivative (derivative atn) = (\x. (-- &2 * x) * inv (&1 + x pow 2) pow 2)` +[ + ((((((use_arg_then "derivative_atn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["x"]) THEN (simp_tac)) THEN (((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac))); + (((((use_arg_then "REAL_POW_2")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "second_derivative_atn_eq")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_atn *) +let diff2_atn = section_proof ["x"] +`nth_diff_strong 2 atn x` +[ + ((((use_arg_then "nth_diff_strong2_eq_alt")(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`(:real)`))) (term_tac exists_tac))); + (((((use_arg_then "IN_UNIV")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_OPEN_UNIV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "IN_UNIV")(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (simp_tac)); + ((((use_arg_then "derivative_atn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_POW_2")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_ATN")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))); + (((((use_arg_then "nth_derivative2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "second_derivative_atn")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "second_derivative_atn_eq")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma second_derivative_inv *) +let second_derivative_inv = section_proof ["x"] +`~(x = &0) ==> nth_derivative 2 inv x = &2 * inv (x pow 3)` +[ + ((((use_arg_then "nth_derivative2")(thm_tac (new_rewrite [] [])))) THEN (move ["xn0"])); + ((((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_LOCAL") (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`(\x. -- inv (x * x))`))) (term_tac exists_tac)) THEN (split_tac)); + (((fun arg_tac -> arg_tac (Arg_theorem ((DISCH_ALL o REAL_DIFF_CONV) `((\x. -- inv(x * x)) has_real_derivative f) (atreal x)`))) (disch_tac [])) THEN BETA_TAC); + ((((use_arg_then "REAL_ENTIRE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xn0")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "real_div")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_LNEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_NEG_NEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_LID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_2")(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `(x * x) pow 2 = x * x pow 3`)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_INV_MUL")(thm_tac (new_rewrite [] [])))))); + (((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. (&2 * x) * inv x * a = &2 * (x * inv x) * a`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_RINV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_MUL_LID")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`real_interval (x - abs x, x + abs x)`))) (term_tac exists_tac)); + (((((use_arg_then "REAL_OPEN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))))) THEN ((THENL) (split_tac) [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))])); + ((((use_arg_then "xn0") (disch_tac [])) THEN (clear_assumption "xn0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then "derivative_inv")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); + ((((use_arg_then "xn0") (disch_tac [])) THEN (clear_assumption "xn0") THEN ((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma diff2_inv *) +let diff2_inv = section_proof ["x"] +`~(x = &0) ==> nth_diff_strong 2 inv x` +[ + ((((use_arg_then "nth_diff_strong2_eq")(thm_tac (new_rewrite [] [])))) THEN (move ["xn0"])); + ((fun arg_tac -> arg_tac (Arg_term (`real_interval (x - abs x, x + abs x)`))) (term_tac exists_tac)); + (((((use_arg_then "REAL_OPEN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))))) THEN ((THENL) (split_tac) [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))])); + ((((use_arg_then "xn0") (disch_tac [])) THEN (clear_assumption "xn0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((((use_arg_then "REAL_DIFFERENTIABLE_AT_INV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) ((((use_arg_then "xn0") (disch_tac [])) THEN (clear_assumption "xn0") THEN ((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then "differentiable_local") (disch_tac [])) THEN (clear_assumption "differentiable_local") THEN (DISCH_THEN apply_tac)) THEN (((fun arg_tac -> arg_tac (Arg_term (`\x. --inv (x * x)`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`real_interval (y - abs y, y + abs y)`))) (term_tac exists_tac)))); + (((((use_arg_then "REAL_OPEN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((((use_arg_then "REAL_DIFFERENTIABLE_NEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_INV_ATREAL")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "REAL_DIFFERENTIABLE_MUL_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_ENTIRE")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "xn0") (disch_tac [])) THEN (clear_assumption "xn0") THEN ((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL) (split_tac) [ALL_TAC; ((move ["z"]) THEN (move ["ineq2"]))]); + ((((use_arg_then "xn0") (disch_tac [])) THEN (clear_assumption "xn0") THEN ((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then "derivative_inv")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then "xn0") (disch_tac [])) THEN (clear_assumption "xn0") THEN ((use_arg_then "ineq2") (disch_tac [])) THEN (clear_assumption "ineq2") THEN ((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma SQRT_POW *) +let SQRT_POW = section_proof ["x";"n"] +`&0 <= x ==> sqrt x pow n = sqrt (x pow n)` +[ + ((BETA_TAC THEN (move ["ineq"])) THEN ((THENL) (((use_arg_then "n") (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL real_pow)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "SQRT_1")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then "IHn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SQRT_MUL")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_POW_LE")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma second_derivative_sqrt *) +let second_derivative_sqrt = section_proof ["x"] +`&0 < x ==> nth_derivative 2 sqrt x = -- inv(&4 * sqrt (x pow 3))` +[ + ((((use_arg_then "nth_derivative2")(thm_tac (new_rewrite [] [])))) THEN (move ["x_pos"])); + ((((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_LOCAL") (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`(\x. inv (&2 * sqrt x))`))) (term_tac exists_tac)) THEN (split_tac)); + (((fun arg_tac -> arg_tac (Arg_theorem ((DISCH_ALL o REAL_DIFF_CONV) `((\x. inv(&2 * sqrt x)) has_real_derivative f) (atreal x)`))) (disch_tac [])) THEN BETA_TAC); + ((fun arg_tac -> arg_tac (Arg_term (`~(&2 * sqrt x = &0)`))) (term_tac (have_gen_tac [](move ["ineq"])))); + (((((use_arg_then "REAL_ENTIRE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "negb_or")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SQRT_EQ_0")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_LT_IMP_LE")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (((use_arg_then "x_pos") (disch_tac [])) THEN (clear_assumption "x_pos") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then "x_pos")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ineq")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "real_div")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_INV_POW")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_LID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_LNEG")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_MUL_ASSOC")(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL real_pow)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_INV_POW")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_POW_MUL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_INV_MUL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "SQRT_POW")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_LT_IMP_LE")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then "REAL_MUL_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL real_pow)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_LNEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_INV_MUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_ASSOC")(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((((use_arg_then "REAL_MUL_RINV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_MUL_LID")(thm_tac (new_rewrite [] [])))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then "REAL_MUL_LNEG")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `&2 pow 2 = &4`)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `SUC 2 = 3`)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`real_interval (&0, x + &1)`))) (term_tac exists_tac)); + (((((use_arg_then "REAL_OPEN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))))) THEN ((THENL) (split_tac) [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))])); + ((((use_arg_then "x_pos") (disch_tac [])) THEN (clear_assumption "x_pos") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then "derivative_sqrt")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma diff2_sqrt *) +let diff2_sqrt = section_proof ["x"] +`&0 < x ==> nth_diff_strong 2 sqrt x` +[ + ((((use_arg_then "nth_diff_strong2_eq")(thm_tac (new_rewrite [] [])))) THEN (move ["x_pos"])); + ((fun arg_tac -> arg_tac (Arg_term (`real_interval (&0, x + &1)`))) (term_tac exists_tac)); + (((((use_arg_then "REAL_OPEN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))))) THEN ((THENL) (split_tac) [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))])); + ((((use_arg_then "x_pos") (disch_tac [])) THEN (clear_assumption "x_pos") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((((use_arg_then "REAL_DIFFERENTIABLE_AT_SQRT")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) ((((use_arg_then "x_pos") (disch_tac [])) THEN (clear_assumption "x_pos") THEN ((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then "differentiable_local") (disch_tac [])) THEN (clear_assumption "differentiable_local") THEN (DISCH_THEN apply_tac)) THEN (((fun arg_tac -> arg_tac (Arg_term (`\x. inv (&2 * sqrt x)`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`real_interval (&0, y + &1)`))) (term_tac exists_tac)))); + (((((use_arg_then "REAL_OPEN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((((use_arg_then "REAL_DIFFERENTIABLE_INV_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_MUL_ATREAL")(thm_tac (new_rewrite [] []))))); + (((((use_arg_then "REAL_DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_AT_SQRT")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then "REAL_ENTIRE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SQRT_EQ_0")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_LT_IMP_LE")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((THENL) (split_tac) [ALL_TAC; ((move ["z"]) THEN (move ["ineq2"]))]) ((((use_arg_then "x_pos") (disch_tac [])) THEN (clear_assumption "x_pos") THEN ((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then "derivative_sqrt")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma real_powS *) +let real_powS = section_proof ["x";"n"] +`x pow (SUC n) = x * x pow n` +[ + ((((use_arg_then "real_pow")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma second_derivative_acs *) +let second_derivative_acs = section_proof ["x"] +`abs x < &1 ==> + nth_derivative 2 acs x = --(x / sqrt ((&1 - x * x) pow 3))` +[ + ((((use_arg_then "nth_derivative2")(thm_tac (new_rewrite [] [])))) THEN (move ["x_ineq"])); + ((((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_LOCAL") (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`\x. --inv (sqrt (&1 - x * x))`))) (term_tac exists_tac)) THEN (split_tac)); + (((fun arg_tac -> arg_tac (Arg_theorem ((DISCH_ALL o REAL_DIFF_CONV) `((\x. --inv (sqrt (&1 - x * x))) has_real_derivative f) (atreal x)`))) (disch_tac [])) THEN BETA_TAC); + ((fun arg_tac -> arg_tac (Arg_term (`&0 < &1 - x * x /\ ~(sqrt(&1 - x * x) = &0)`))) (term_tac (have_gen_tac [](move ["ineqs"])))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`&0 < &1 - x * x`))) (term_tac (have_gen_tac [](move ["h"]))))); + (((((use_arg_then "SQRT_EQ_0")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_LT_IMP_LE")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (((use_arg_then "h") (disch_tac [])) THEN (clear_assumption "h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `&1 - x * x = (&1 - x) * (&1 + x)`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LT_MUL")(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "x_ineq") (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then "ineqs")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "real_div")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_INV_MUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_SUB_LZERO")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_LNEG")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_NEG_NEG")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_ASSOC")(gsym_then (thm_tac (new_rewrite [] []))))))); + ((((use_arg_then "REAL_INV_MUL")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "real_powS")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "SQRT_POW")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_LT_IMP_LE")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then "REAL_MUL_LID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_2")(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. (&2 * x) * inv (&2) * a = (&2 * inv (&2)) * x * a`)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `SUC 2 = 3`)))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then "REAL_MUL_RINV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_MUL_LID")(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`&1 - abs x`))) (term_tac (set_tac "e"))); + ((fun arg_tac -> arg_tac (Arg_term (`real_interval (x - e, x + e)`))) (term_tac exists_tac)); + (((((use_arg_then "REAL_OPEN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))))) THEN ((THENL) (split_tac) [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))])); + ((((use_arg_then "e_def") (disch_tac [])) THEN (clear_assumption "e_def") THEN ((use_arg_then "x_ineq") (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then "derivative_acs")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); + ((((use_arg_then "e_def") (disch_tac [])) THEN (clear_assumption "e_def") THEN ((use_arg_then "x_ineq") (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma diff2_acs *) +let diff2_acs = section_proof ["x"] +`abs x < &1 ==> nth_diff_strong 2 acs x` +[ + ((((use_arg_then "nth_diff_strong2_eq")(thm_tac (new_rewrite [] [])))) THEN (move ["x_ineq"])); + ((fun arg_tac -> arg_tac (Arg_term (`&1 - abs x`))) (term_tac (set_tac "e"))); + ((fun arg_tac -> arg_tac (Arg_term (`real_interval (x - e, x + e)`))) (term_tac exists_tac)); + (((((use_arg_then "REAL_OPEN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))))) THEN ((THENL) (split_tac) [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))])); + ((((use_arg_then "e_def") (disch_tac [])) THEN (clear_assumption "e_def") THEN ((use_arg_then "x_ineq") (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((((use_arg_then "REAL_DIFFERENTIABLE_AT_ACS")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) ((((use_arg_then "e_def") (disch_tac [])) THEN (clear_assumption "e_def") THEN ((use_arg_then "x_ineq") (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`&1 - abs y`))) (term_tac (set_tac "e2"))); + ((((use_arg_then "differentiable_local") (disch_tac [])) THEN (clear_assumption "differentiable_local") THEN (DISCH_THEN apply_tac)) THEN (((fun arg_tac -> arg_tac (Arg_term (`\x. --inv (sqrt (&1 - x * x))`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`real_interval (y - e2, y + e2)`))) (term_tac exists_tac)))); + (((((use_arg_then "REAL_OPEN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((((use_arg_then "REAL_DIFFERENTIABLE_NEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_INV_ATREAL")(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`&0 < &1 - y * y`))) (term_tac (have_gen_tac [](move ["gt0"])))); + (((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `&1 - y * y = (&1 - y) * (&1 + y)`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LT_MUL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "e_def") (disch_tac [])) THEN (clear_assumption "e_def") THEN ((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then "SQRT_EQ_0")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_LT_IMP_LE")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_LT_IMP_NZ")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`(\x. sqrt (&1 - x * x)) = sqrt o (\x. &1 - x * x)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "o_THM")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); + ((((use_arg_then "REAL_DIFFERENTIABLE_COMPOSE_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_AT_SQRT")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then "REAL_DIFFERENTIABLE_SUB")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_DIFFERENTIABLE_CONST")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_DIFFERENTIABLE_MUL_ATREAL")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then "REAL_DIFFERENTIABLE_ID")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((THENL) (split_tac) [ALL_TAC; ((move ["z"]) THEN (move ["ineq2"]))]); + ((((use_arg_then "e2_def") (disch_tac [])) THEN (clear_assumption "e2_def") THEN ((use_arg_then "e_def") (disch_tac [])) THEN (clear_assumption "e_def") THEN ((use_arg_then "x_ineq") (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then "derivative_acs")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); + ((((use_arg_then "ineq2") (disch_tac [])) THEN (clear_assumption "ineq2") THEN ((use_arg_then "e2_def") (disch_tac [])) THEN (clear_assumption "e2_def") THEN ((use_arg_then "e_def") (disch_tac [])) THEN (clear_assumption "e_def") THEN ((use_arg_then "ineq") (disch_tac [])) THEN (clear_assumption "ineq") THEN ((use_arg_then "x_ineq") (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Section SecondDerivativeCompose *) +begin_section "SecondDerivativeCompose";; + +(* Lemma REAL_CONTINUOUS_OPEN_PREIMAGE *) +let REAL_CONTINUOUS_OPEN_PREIMAGE = section_proof ["f";"s";"t"] +`f real_continuous_on s ==> real_open s ==> real_open t ==> + real_open {x | x IN s /\ f x IN t}` +[ + (BETA_TAC THEN (move ["f_cont"]) THEN (move ["open_s"]) THEN (move ["open_t"])); + (((use_arg_then "REAL_OPEN")(thm_tac (new_rewrite [] [])))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`IMAGE lift {x | x IN s /\ f x IN t} = + {x | x IN (IMAGE lift s) /\ (lift o f o drop) x IN (IMAGE lift t)}`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + (((((use_arg_then "CONTINUOUS_OPEN_PREIMAGE")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_OPEN")(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "REAL_CONTINUOUS_ON")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((((use_arg_then "EXTENSION")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "IN_IMAGE_LIFT_DROP")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_IMAGE_LIFT_DROP")(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (simp_tac)) THEN (split_tac)); + ((BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN (move ["x_in"])) THEN (move ["x_eq"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`lift x`))) (term_tac exists_tac))); + (((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "x_in")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "x_eq")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then "o_THM")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "LIFT_DROP")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN (move ["x_in"])) THEN (move ["x_eq"])); + (((fun arg_tac -> arg_tac (Arg_term (`drop x`))) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma second_derivative_compose *) +let second_derivative_compose = section_proof ["f";"g";"x"] +`nth_diff_strong 2 g x ==> nth_diff_strong 2 f (g x) ==> + nth_derivative 2 (\x. f (g x)) x = + nth_derivative 2 f (g x) * (derivative g x) pow 2 + derivative f (g x) * nth_derivative 2 g x` +[ + (BETA_TAC THEN (move ["dg"]) THEN (move ["df"])); + ((((use_arg_then "nth_derivative2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "derivative_unique") (disch_tac [])) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_LOCAL") (disch_tac [])) THEN (clear_assumption "HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac))); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`\x. derivative f (g x) * derivative g x`))) (term_tac exists_tac)) THEN (split_tac))); + ((((use_arg_then "dg") (disch_tac [])) THEN ((use_arg_then "df") (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "nth_diff_strong2_eq")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["gxs"])) THEN (move ["d_f"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["d_g"]))); + ((fun arg_tac -> arg_tac (Arg_term (`{z | z IN t /\ g z IN s}`))) (term_tac (set_tac "s'"))); + ((fun arg_tac -> arg_tac (Arg_term (`real_open s'`))) (term_tac (have_gen_tac [](move ["open_s'"])))); + ((((use_arg_then "s'_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_CONTINUOUS_OPEN_PREIMAGE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "open_t")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then "REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["y"]) THEN (move ["yt"])); + (((((use_arg_then "REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "d_g")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`t INTER s'`))) (term_tac exists_tac)) THEN ((((use_arg_then "REAL_OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + (((((use_arg_then "s'_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then "x") (term_tac exists_tac)) THEN (done_tac)); + ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["yt"]) THEN (move ["ys'"])))) THEN ((((use_arg_then "derivative_composition")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_MUL_SYM")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then "d_g")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "d_f")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then "ys'") (disch_tac [])) THEN (clear_assumption "ys'") THEN BETA_TAC) THEN (((((use_arg_then "s'_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["z"])) THEN (simp_tac)) THEN (done_tac)); + ((((use_arg_then "dg") (disch_tac [])) THEN (clear_assumption "dg") THEN ((use_arg_then "df") (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "nth_diff_strong2_eq_alt")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (move ["d_f"]) THEN (case THEN (move ["_"])) THEN (move ["d_g"]))); + ((THENL_ROT (-1)) (((((use_arg_then "REAL_ADD_SYM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_POW_2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_MUL_ATREAL")(thm_tac (new_rewrite [] []))))) THEN (split_tac))); + ((((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "d_g")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then "o_THM") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative f`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then "REAL_DIFF_CHAIN_ATREAL")(thm_tac (new_rewrite [] []))))); + (((((use_arg_then "d_g")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "d_f")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_compose *) +let diff2_compose = section_proof ["f";"g";"x"] +`nth_diff_strong 2 g x ==> nth_diff_strong 2 f (g x) ==> + nth_diff_strong 2 (\x. f (g x)) x` +[ + ((repeat_tactic 1 9 (((use_arg_then "nth_diff_strong2_eq")(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["dg"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["gxt"])) THEN (move ["df"])); + ((fun arg_tac -> arg_tac (Arg_term (`{z | z IN s /\ g z IN t}`))) (term_tac (set_tac "s'"))); + ((fun arg_tac -> arg_tac (Arg_term (`real_open s'`))) (term_tac (have_gen_tac [](move ["open_s'"])))); + ((((use_arg_then "s'_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_CONTINUOUS_OPEN_PREIMAGE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "open_t")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "open_s")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andbT")(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then "REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["y"]) THEN (move ["yt"])); + (((((use_arg_then "REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "dg")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`s INTER s'`))) (term_tac exists_tac)) THEN ((((use_arg_then "REAL_OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + (((((use_arg_then "s'_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "x") (term_tac exists_tac)) THEN (simp_tac)) THEN (done_tac)); + (BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["ys'"])))); + ((((fun arg_tac -> (use_arg_then "o_THM") (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((use_arg_then "REAL_DIFFERENTIABLE_COMPOSE_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((((use_arg_then "ys'") (disch_tac [])) THEN (clear_assumption "ys'") THEN BETA_TAC) THEN (((use_arg_then "s'_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["z"])) THEN (simp_tac)) THEN (done_tac)); + (((use_arg_then "differentiable_local") (disch_tac [])) THEN (clear_assumption "differentiable_local") THEN (DISCH_THEN apply_tac)); + ((THENL_ROT (-1)) ((((fun arg_tac -> arg_tac (Arg_term (`\x. derivative g x * derivative f (g x)`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`s INTER s'`))) (term_tac exists_tac))) THEN (split_tac))); + (((((use_arg_then "REAL_OPEN_INTER")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then "IN_INTER")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ys")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "ys'")(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["z"]) THEN (move ["z_in"])); + ((((use_arg_then "derivative_composition")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "dg")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then "z_in") (disch_tac [])) THEN (clear_assumption "z_in") THEN BETA_TAC) THEN (((use_arg_then "s'_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (simp_tac)) THEN (done_tac)); + ((((use_arg_then "REAL_DIFFERENTIABLE_MUL_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((use_arg_then "dg")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then "o_THM") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`derivative f`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "ETA_AX")(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((use_arg_then "REAL_DIFFERENTIABLE_COMPOSE_ATREAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "dg")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((((use_arg_then "ys'") (disch_tac [])) THEN (clear_assumption "ys'") THEN BETA_TAC) THEN (((use_arg_then "s'_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then "IN_ELIM_THM")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["z"])) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma continuous_not0_exists_open *) +let continuous_not0_exists_open = section_proof ["f";"x"] +`~(f x = &0) ==> f real_continuous atreal x ==> + ?s. real_open s /\ x IN s /\ !y. y IN s ==> ~(f y = &0)` +[ + ((((use_arg_then "real_continuous_atreal")(thm_tac (new_rewrite [] [])))) THEN (move ["fn0"]) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`abs (f x)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))); + ((THENL_FIRST) (ANTS_TAC) ((((use_arg_then "fn0") (disch_tac [])) THEN (clear_assumption "fn0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["ineq"])); + ((fun arg_tac -> arg_tac (Arg_term (`real_interval (x - d, x + d)`))) (term_tac exists_tac)); + ((THENL_FIRST) (((((use_arg_then "REAL_OPEN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [ALL_TAC; (move ["y"])])) ((((use_arg_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then "fn0") (disch_tac [])) THEN (clear_assumption "fn0") THEN ((use_arg_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN ((fun arg_tac -> (use_arg_then "ineq") (fun fst_arg -> (use_arg_then "y") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma continuous_gt_exists_open *) +let continuous_gt_exists_open = section_proof ["a";"f";"x"] +`a < f x ==> f real_continuous atreal x ==> + ?s. real_open s /\ x IN s /\ !y. y IN s ==> a < f y` +[ + ((BETA_TAC THEN (move ["f_ineq"])) THEN ((((use_arg_then "real_continuous_atreal")(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f x - a`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)))); + ((THENL_FIRST) (ANTS_TAC) ((((use_arg_then "f_ineq") (disch_tac [])) THEN (clear_assumption "f_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["ineq"])); + ((fun arg_tac -> arg_tac (Arg_term (`real_interval (x - d, x + d)`))) (term_tac exists_tac)); + ((THENL_FIRST) (((((use_arg_then "REAL_OPEN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [ALL_TAC; (move ["y"])])) ((((use_arg_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then "f_ineq") (disch_tac [])) THEN (clear_assumption "f_ineq") THEN ((use_arg_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN ((fun arg_tac -> (use_arg_then "ineq") (fun fst_arg -> (use_arg_then "y") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma continuous_lt_exists_open *) +let continuous_lt_exists_open = section_proof ["a";"f";"x"] +`f x < a ==> f real_continuous atreal x ==> + ?s. real_open s /\ x IN s /\ !y. y IN s ==> f y < a` +[ + ((BETA_TAC THEN (move ["f_ineq"])) THEN ((((use_arg_then "real_continuous_atreal")(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`a - f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)))); + ((THENL_FIRST) (ANTS_TAC) ((((use_arg_then "f_ineq") (disch_tac [])) THEN (clear_assumption "f_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["ineq"])); + ((fun arg_tac -> arg_tac (Arg_term (`real_interval (x - d, x + d)`))) (term_tac exists_tac)); + ((THENL_FIRST) (((((use_arg_then "REAL_OPEN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [ALL_TAC; (move ["y"])])) ((((use_arg_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then "f_ineq") (disch_tac [])) THEN (clear_assumption "f_ineq") THEN ((use_arg_then "d0") (disch_tac [])) THEN (clear_assumption "d0") THEN ((fun arg_tac -> (use_arg_then "ineq") (fun fst_arg -> (use_arg_then "y") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; +(add_section_var (mk_var ("f", (`:real->real`))));; +(add_section_var (mk_var ("x", (`:real`))));; +(add_section_hyp "df" (`nth_diff_strong 2 f x`));; + +(* Lemma second_derivative_compose_atn *) +let second_derivative_compose_atn = section_proof [] +`nth_derivative 2 (\x. atn (f x)) x = + (nth_derivative 2 f x * (&1 + f x * f x) - &2 * f x * derivative f x pow 2) / (&1 + f x * f x) pow 2` +[ + ((((use_arg_then "second_derivative_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "diff2_atn")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "nth_derivative2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "second_derivative_atn")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "derivative_atn")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then "REAL_ADD_SYM")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_LNEG")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "real_sub")(gsym_then (thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> arg_tac (Arg_term (`_1 * _2`))) (term_tac (set_tac "lhs1"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`_1 * _2`))) (term_tac (set_tac "lhs2")))); + ((((use_arg_then "real_div")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_INV_POW")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_SUB_RDISTRIB")(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`_1 * _2`))) (term_tac (set_tac "rhs1"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`_1 * _2`))) (term_tac (set_tac "rhs2")))); + (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `lhs1 = rhs1 /\ lhs2 = rhs2 ==> lhs1 - lhs2 = rhs1 - rhs2`))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((((use_arg_then "lhs2_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "rhs2_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_ASSOC")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "REAL_MUL_SYM")(thm_tac (new_rewrite [] [(`_1 * _2 pow 2`)])))) THEN (((use_arg_then "REAL_POW_2")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((split_tac) THEN ((TRY done_tac)))); + ((((use_arg_then "rhs1_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_POW_2")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_ASSOC")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c d. a * b * c * d = a * (b * c) * d`)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then "REAL_MUL_RINV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "lhs1_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_MUL_LID")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_MUL_SYM")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then "REAL_LE_SQUARE") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma second_derivative_compose_inv *) +let second_derivative_compose_inv = section_proof [] +`~(f x = &0) ==> + nth_derivative 2 (\x. inv (f x)) x = + (&2 * derivative f x pow 2 - nth_derivative 2 f x * f x) / (f x pow 3)` +[ + (BETA_TAC THEN (move ["fn0"])); + ((((use_arg_then "second_derivative_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "diff2_inv")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "second_derivative_inv")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "derivative_inv")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then "REAL_MUL_LNEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "real_sub")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "real_div")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_SUB_RDISTRIB")(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c d. a = c /\ b = d ==> a - b = c - d`))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((((use_arg_then "REAL_INV_POW")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `3 = SUC 2`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "real_powS")(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c d. (a * b) * c * d = a * (b * c) * d`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_RINV")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_MUL_LID")(thm_tac (new_rewrite [] []))))); + (((((use_arg_then "REAL_INV_MUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_POW_2")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_MUL_SYM")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma second_derivative_compose_sqrt *) +let second_derivative_compose_sqrt = section_proof [] +`&0 < f x ==> + nth_derivative 2 (\x. sqrt (f x)) x = + (&2 * nth_derivative 2 f x * f x - derivative f x pow 2) / (&4 * sqrt (f x pow 3))` +[ + (BETA_TAC THEN (move ["f_pos"])); + ((((use_arg_then "second_derivative_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "diff2_sqrt")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "second_derivative_sqrt")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "derivative_sqrt")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then "REAL_MUL_LNEG")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ADD_SYM")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "real_sub")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "real_div")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_SUB_RDISTRIB")(thm_tac (new_rewrite [] []))))); + ((THENL_LAST) ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c d. a = c /\ b = d ==> a - b = c - d`))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`sqrt (f x pow 3) = sqrt (f x) * f x`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "SQRT_POW")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_LT_IMP_LE")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `3 = SUC 2`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "real_powS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SQRT_POW_2")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_LT_IMP_LE")(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (repeat_tactic 1 9 (((use_arg_then "REAL_INV_MUL")(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c d. (&2 * a * b) * inv (&4) * c * d = (inv (&2) * c) * a * (b * d)`)))(thm_tac (new_rewrite [] [])))); + (((((use_arg_then "REAL_MUL_RINV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_POS_NZ")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma second_derivative_compose_acs *) +let second_derivative_compose_acs = section_proof [] +`abs (f x) < &1 ==> + nth_derivative 2 (\x. acs (f x)) x = + -- ((nth_derivative 2 f x * (&1 - f x * f x) + f x * derivative f x pow 2) / + sqrt ((&1 - f x * f x) pow 3))` +[ + (BETA_TAC THEN (move ["f_ineq"])); + ((((use_arg_then "second_derivative_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "diff2_acs")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "second_derivative_acs")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "derivative_acs")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((use_arg_then "REAL_MUL_LNEG")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_NEG_ADD")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_EQ_NEG2")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "real_div")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_ADD_RDISTRIB")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_ADD_SYM")(thm_tac (new_rewrite [] []))))); + ((THENL_LAST) ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c d. a = c /\ b = d ==> a + b = c + d`))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`&1 - f x * f x`))) (term_tac (set_tac "y"))); + ((fun arg_tac -> arg_tac (Arg_term (`&0 <= y /\ &0 < y /\ ~(y = &0)`))) (term_tac (have_gen_tac [](move ["y_ineq"])))); + ((((use_arg_then "y_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a. &1 - a * a = (&1 - a) * (&1 + a)`)))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then "REAL_ENTIRE")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_MUL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_LT_MUL")(thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "f_ineq") (disch_tac [])) THEN (clear_assumption "f_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`sqrt (y pow 3) = sqrt y * y`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "SQRT_POW")(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `3 = SUC 2`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "real_powS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SQRT_POW_2")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "REAL_INV_MUL")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c d. (a * b) * c * d = c * a * (b * d)`)))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then "REAL_MUL_RINV")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_MUL_RID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_compose_atn *) +let diff2_compose_atn = section_proof [] +`nth_diff_strong 2 (\x. atn (f x)) x` +[ + (((((use_arg_then "diff2_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_atn")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_compose_inv *) +let diff2_compose_inv = section_proof [] +`~(f x = &0) ==> nth_diff_strong 2 (\x. inv (f x)) x` +[ + ((BETA_TAC THEN (move ["fn0"])) THEN ((((use_arg_then "diff2_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_inv")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_compose_sqrt *) +let diff2_compose_sqrt = section_proof [] +`&0 < f x ==> nth_diff_strong 2 (\x. sqrt (f x)) x` +[ + ((BETA_TAC THEN (move ["f_pos"])) THEN ((((use_arg_then "diff2_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_sqrt")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_compose_acs *) +let diff2_compose_acs = section_proof [] +`abs (f x) < &1 ==> nth_diff_strong 2 (\x. acs (f x)) x` +[ + ((BETA_TAC THEN (move ["f_abs"])) THEN ((((use_arg_then "diff2_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_acs")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section SecondDerivativeCompose *) +let REAL_CONTINUOUS_OPEN_PREIMAGE = finalize_theorem REAL_CONTINUOUS_OPEN_PREIMAGE;; +let second_derivative_compose = finalize_theorem second_derivative_compose;; +let diff2_compose = finalize_theorem diff2_compose;; +let continuous_not0_exists_open = finalize_theorem continuous_not0_exists_open;; +let continuous_gt_exists_open = finalize_theorem continuous_gt_exists_open;; +let continuous_lt_exists_open = finalize_theorem continuous_lt_exists_open;; +let second_derivative_compose_atn = finalize_theorem second_derivative_compose_atn;; +let second_derivative_compose_inv = finalize_theorem second_derivative_compose_inv;; +let second_derivative_compose_sqrt = finalize_theorem second_derivative_compose_sqrt;; +let second_derivative_compose_acs = finalize_theorem second_derivative_compose_acs;; +let diff2_compose_atn = finalize_theorem diff2_compose_atn;; +let diff2_compose_inv = finalize_theorem diff2_compose_inv;; +let diff2_compose_sqrt = finalize_theorem diff2_compose_sqrt;; +let diff2_compose_acs = finalize_theorem diff2_compose_acs;; +end_section "SecondDerivativeCompose";; + +(* Lemma second_derivative_mul *) +let second_derivative_mul = section_proof ["f";"g";"x"] +`nth_diff_strong 2 f x ==> + nth_diff_strong 2 g x ==> + nth_derivative 2 (\x. f x * g x) x = + f x * nth_derivative 2 g x + &2 * derivative f x * derivative g x + nth_derivative 2 f x * g x` +[ + ((BETA_TAC THEN (move ["df0"]) THEN (move ["dg0"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`(x,x)`))) (term_tac (set_tac "int")))); + ((fun arg_tac -> arg_tac (Arg_term (`interval_arith x int /\ nth_diff_strong_int 2 int f /\ nth_diff_strong_int 2 int g`))) (term_tac (have_gen_tac [](case THEN ((move ["ineq"]) THEN (case THEN ((move ["df"]) THEN (move ["dg"])))))))); + ((repeat_tactic 1 9 (((use_arg_then "int_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "CONST_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))); + (((split_tac) THEN (move ["y"])) THEN (((((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_ANTISYM")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "nth_derivative_mul") (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "dg") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((((use_arg_then "leqnn")(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((((use_arg_then "TWO")(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then "ONE")(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL SUM_CLAUSES_NUMSEG)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `!n. 0 <= SUC n`)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "ONE")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "TWO")(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "subnn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "subn0")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `2 - 1 = 1`)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_derivative0")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_derivative1")(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then "binom")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "BINOM_1")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "BINOM_REFL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_MUL_LID")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_ADD_ASSOC")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma second_derivative_div *) +let second_derivative_div = section_proof ["f";"g";"x"] +`~(g x = &0) ==> + nth_diff_strong 2 f x ==> + nth_diff_strong 2 g x ==> + nth_derivative 2 (\x. f x / g x) x = + ((nth_derivative 2 f x * g x - f x * nth_derivative 2 g x) * g x - + &2 * derivative g x * (derivative f x * g x - f x * derivative g x)) / (g x pow 3)` +[ + (BETA_TAC THEN (move ["gn0"]) THEN (move ["diff_f"]) THEN (move ["diff_g"])); + (((fun arg_tac -> arg_tac (Arg_term (`derivative g x`))) (term_tac (set_tac "dg"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`derivative f x`))) (term_tac (set_tac "df")))); + (((fun arg_tac -> arg_tac (Arg_term (`nth_derivative 2 g x`))) (term_tac (set_tac "ddg"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`nth_derivative 2 f x`))) (term_tac (set_tac "ddf")))); + ((repeat_tactic 1 9 (((use_arg_then "real_div")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "second_derivative_mul")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "second_derivative_compose_inv")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "diff2_compose_inv")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((use_arg_then "derivative_compose_inv")(thm_tac (new_rewrite [] [])))); + ((((use_arg_then "diff_g") (disch_tac [])) THEN (clear_assumption "diff_g") THEN BETA_TAC) THEN ((((use_arg_then "nth_diff_strong2_eq")(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (done_tac)); + ((((use_arg_then "ddf_def")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ddg_def")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df_def")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "dg_def")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "real_div")(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`_1 + _2`))) (term_tac (set_tac "lhs"))); + (((fun arg_tac -> arg_tac (Arg_theorem (REAL_RING `!f g x. ((ddf * g x - f x * ddg) * g x - &2 * dg * (df * g x - f x * dg)) * + inv (g x pow 3) = + f x * (&2 * dg pow 2 - ddg * g x) * inv (g x pow 3) + + &2 * df * --(g x * inv (g x pow 3)) * dg + + ddf * (g x * g x * inv (g x pow 3))`)))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> arg_tac (Arg_term (`g x * inv (g x pow 3) = inv (g x pow 2)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `3 = SUC 2`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "real_powS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_INV_MUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_RINV")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_MUL_LID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`g x * inv (g x pow 2) = inv (g x)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then "TWO")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "real_powS")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_INV_MUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_ASSOC")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_MUL_RINV")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "REAL_MUL_LID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_POW_1")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((fun arg_tac -> (use_arg_then "REAL_POW_2") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`g x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "lhs_def")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma diff2_div *) +let diff2_div = section_proof ["f";"g";"x"] +`~(g x = &0) ==> nth_diff_strong 2 f x ==> nth_diff_strong 2 g x ==> + nth_diff_strong 2 (\x. f x / g x) x` +[ + ((BETA_TAC THEN (move ["gn0"]) THEN (move ["df0"]) THEN (move ["dg0"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`(x,x)`))) (term_tac (set_tac "int")))); + ((fun arg_tac -> arg_tac (Arg_term (`interval_arith x int /\ nth_diff_strong_int 2 int f /\ nth_diff_strong_int 2 int g`))) (term_tac (have_gen_tac [](case THEN ((move ["ineq"]) THEN (case THEN ((move ["df"]) THEN (move ["dg"])))))))); + ((repeat_tactic 1 9 (((use_arg_then "int_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "CONST_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))); + (((split_tac) THEN (move ["y"])) THEN (((((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_ANTISYM")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "nth_diff_mul") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "int") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`\x. inv (g x)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "real_div")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((split_tac) THEN ((TRY done_tac)) THEN (move ["y"]))); + (((((use_arg_then "int_def")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_ANTISYM")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "diff2_compose_inv")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma second_derivative_scale *) +let second_derivative_scale = section_proof ["f";"c";"x"] +`nth_diff_strong 2 f x ==> + nth_derivative 2 (\x. c * f x) x = c * nth_derivative 2 f x` +[ + ((BETA_TAC THEN (move ["df0"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`(x,x)`))) (term_tac (set_tac "int")))); + ((fun arg_tac -> arg_tac (Arg_term (`interval_arith x int /\ nth_diff_strong_int 2 int f`))) (term_tac (have_gen_tac [](case THEN ((move ["ineq"]) THEN (move ["df"])))))); + ((repeat_tactic 1 9 (((use_arg_then "int_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "CONST_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))); + ((BETA_TAC THEN (move ["y"])) THEN (((((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_ANTISYM")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "nth_derivative_scale") (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "c") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((((use_arg_then "leqnn")(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma second_derivative_add *) +let second_derivative_add = section_proof ["f";"g";"x"] +`nth_diff_strong 2 f x ==> + nth_diff_strong 2 g x ==> + nth_derivative 2 (\x. f x + g x) x = nth_derivative 2 f x + nth_derivative 2 g x` +[ + ((BETA_TAC THEN (move ["df0"]) THEN (move ["dg0"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`(x,x)`))) (term_tac (set_tac "int")))); + ((fun arg_tac -> arg_tac (Arg_term (`interval_arith x int /\ nth_diff_strong_int 2 int f /\ nth_diff_strong_int 2 int g`))) (term_tac (have_gen_tac [](case THEN ((move ["ineq"]) THEN (case THEN ((move ["df"]) THEN (move ["dg"])))))))); + ((repeat_tactic 1 9 (((use_arg_then "int_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "CONST_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))); + (((split_tac) THEN (move ["y"])) THEN (((((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_ANTISYM")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "nth_derivative_add") (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "dg") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((((use_arg_then "leqnn")(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma second_derivative_sub *) +let second_derivative_sub = section_proof ["f";"g";"x"] +`nth_diff_strong 2 f x ==> + nth_diff_strong 2 g x ==> + nth_derivative 2 (\x. f x - g x) x = nth_derivative 2 f x - nth_derivative 2 g x` +[ + ((BETA_TAC THEN (move ["df0"]) THEN (move ["dg0"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`(x,x)`))) (term_tac (set_tac "int")))); + ((fun arg_tac -> arg_tac (Arg_term (`interval_arith x int /\ nth_diff_strong_int 2 int f /\ nth_diff_strong_int 2 int g`))) (term_tac (have_gen_tac [](case THEN ((move ["ineq"]) THEN (case THEN ((move ["df"]) THEN (move ["dg"])))))))); + ((repeat_tactic 1 9 (((use_arg_then "int_def")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "CONST_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))); + (((split_tac) THEN (move ["y"])) THEN (((((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_LE_ANTISYM")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "nth_derivative_sub") (fun fst_arg -> (use_arg_then "df") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "dg") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((((use_arg_then "leqnn")(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma second_derivative_compose_bounds *) +let second_derivative_compose_bounds = section_proof ["f";"g";"int";"g_bounds";"dd_bounds"] +`nth_diff_strong_int 2 int g ==> + bounded_on_int g int g_bounds ==> + nth_diff_strong_int 2 g_bounds f ==> + bounded_on_int (\x. nth_derivative 2 f (g x) * derivative g x pow 2 + + derivative f (g x) * nth_derivative 2 g x) int dd_bounds ==> + has_bounded_second_derivative (\x. f (g x)) int dd_bounds` +[ + ((((use_arg_then "has_bounded_second_derivative")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((BETA_TAC THEN (move ["dg"]) THEN (move ["g_bounded"]) THEN (move ["df"]) THEN (move ["bounded"])) THEN ((split_tac) THEN (move ["x"]) THEN (move ["ineq"]))); + (((((use_arg_then "diff2_compose")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "dg")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "g_bounded")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then "second_derivative_compose")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "g_bounded")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "bounded")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma second_derivative_atn_bounds *) +let second_derivative_atn_bounds = section_proof ["dd_bounds"] +`bounded_on_int (\x. (-- &2 * x) * inv(&1 + x pow 2) pow 2) int dd_bounds ==> + has_bounded_second_derivative atn int dd_bounds` +[ + (((((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "has_bounded_second_derivative")(thm_tac (new_rewrite [] []))))) THEN (move ["ineq"])); + ((THENL_LAST) (split_tac) (((((use_arg_then "nth_derivative2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "second_derivative_atn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "diff2_atn")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma second_derivative_compose_atn_bounds *) +let second_derivative_compose_atn_bounds = section_proof ["f";"dd_bounds"] +`nth_diff_strong_int 2 int f ==> + bounded_on_int (\x. (nth_derivative 2 f x * (&1 + f x * f x) - &2 * f x * derivative f x pow 2) / + (&1 + f x * f x) pow 2) int dd_bounds ==> + has_bounded_second_derivative (\x. atn (f x)) int dd_bounds` +[ + ((((((use_arg_then "has_bounded_second_derivative")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["df"]) THEN (move ["bounded"])) THEN ((split_tac) THEN (move ["x"]) THEN (move ["ineq"]))); + (((((use_arg_then "diff2_compose_atn")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then "second_derivative_compose_atn")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "bounded")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma second_derivative_inv_bounds *) +let second_derivative_inv_bounds = section_proof ["dd_bounds"] +`interval_not_zero int ==> + bounded_on_int (\x. &2 * inv (x pow 3)) int dd_bounds ==> + has_bounded_second_derivative inv int dd_bounds` +[ + ((((((use_arg_then "has_bounded_second_derivative")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["int0"]) THEN (move ["bounded"])) THEN ((split_tac) THEN (move ["x"]) THEN (move ["ineq"]))); + (((((use_arg_then "diff2_inv")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then "interval_arith_not_zero") (fun fst_arg -> (use_arg_then "x") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "int") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then "second_derivative_inv")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (fun arg_tac -> (use_arg_then "interval_arith_not_zero") (fun fst_arg -> (use_arg_then "x") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "int") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "bounded")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma second_derivative_compose_inv_bounds *) +let second_derivative_compose_inv_bounds = section_proof ["f";"f_bounds";"dd_bounds"] +`bounded_on_int f int f_bounds ==> interval_not_zero f_bounds ==> + nth_diff_strong_int 2 int f ==> + bounded_on_int (\x. (&2 * derivative f x pow 2 - nth_derivative 2 f x * f x) / f x pow 3) + int dd_bounds ==> + has_bounded_second_derivative (\x. inv (f x)) int dd_bounds` +[ + (((((use_arg_then "has_bounded_second_derivative")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["f_bounded"]) THEN (move ["f0"]) THEN (move ["df"]) THEN (move ["bounded"])); + ((fun arg_tac -> arg_tac (Arg_term (`!x. interval_arith x int ==> ~(f x = &0)`))) (term_tac (have_gen_tac [](move ["fn0"])))); + ((BETA_TAC THEN (move ["x"]) THEN (move ["ineq"])) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "interval_arith_not_zero") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "f_bounds") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "f_bounded")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((split_tac) THEN (move ["x"]) THEN (move ["ineq"])); + (((((use_arg_then "diff2_compose_inv")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "fn0")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then "second_derivative_compose_inv")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "fn0")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "bounded")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma second_derivative_sqrt_bounds *) +let second_derivative_sqrt_bounds = section_proof ["dd_bounds"] +`interval_pos int ==> + bounded_on_int (\x. --inv (&4 * sqrt (x pow 3))) int dd_bounds ==> + has_bounded_second_derivative sqrt int dd_bounds` +[ + (((((use_arg_then "has_bounded_second_derivative")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["int_pos"]) THEN (move ["bounded"])); + ((split_tac) THEN (move ["x"]) THEN (move ["ineq"])); + (((((use_arg_then "diff2_sqrt")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then "interval_arith_pos") (fun fst_arg -> (use_arg_then "x") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "int") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then "second_derivative_sqrt")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (fun arg_tac -> (use_arg_then "interval_arith_pos") (fun fst_arg -> (use_arg_then "x") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "int") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "bounded")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma second_derivative_compose_sqrt_bounds *) +let second_derivative_compose_sqrt_bounds = section_proof ["f";"f_bounds";"dd_bounds"] +`bounded_on_int f int f_bounds ==> interval_pos f_bounds ==> + nth_diff_strong_int 2 int f ==> + bounded_on_int (\x. (&2 * nth_derivative 2 f x * f x - derivative f x pow 2) / + (&4 * sqrt (f x pow 3))) + int dd_bounds ==> + has_bounded_second_derivative (\x. sqrt (f x)) int dd_bounds` +[ + (((((use_arg_then "has_bounded_second_derivative")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["f_bounded"]) THEN (move ["f_int"]) THEN (move ["df"]) THEN (move ["bounded"])); + ((fun arg_tac -> arg_tac (Arg_term (`!x. interval_arith x int ==> &0 < f x`))) (term_tac (have_gen_tac [](move ["f_pos"])))); + ((BETA_TAC THEN (move ["x"]) THEN (move ["ineq"])) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "interval_arith_pos") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "f_bounds") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "f_bounded")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((split_tac) THEN (move ["x"]) THEN (move ["ineq"])); + (((((use_arg_then "diff2_compose_sqrt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "f_pos")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then "second_derivative_compose_sqrt")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "f_pos")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "bounded")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma second_derivative_acs_bounds *) +let second_derivative_acs_bounds = section_proof ["dd_bounds"] +`iabs int < &1 ==> + bounded_on_int (\x. --(x / sqrt ((&1 - x * x) pow 3))) int dd_bounds ==> + has_bounded_second_derivative acs int dd_bounds` +[ + (((((use_arg_then "has_bounded_second_derivative")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["int_abs"]) THEN (move ["bounded"])); + ((split_tac) THEN (move ["x"]) THEN (move ["ineq"])); + (((((use_arg_then "diff2_acs")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then "interval_arith_abs") (fun fst_arg -> (use_arg_then "x") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "int") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then "second_derivative_acs")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (fun arg_tac -> (use_arg_then "interval_arith_abs") (fun fst_arg -> (use_arg_then "x") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "int") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "bounded")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma second_derivative_compose_acs_bounds *) +let second_derivative_compose_acs_bounds = section_proof ["f";"f_bounds";"dd_bounds"] +`bounded_on_int f int f_bounds ==> iabs f_bounds < &1 ==> + nth_diff_strong_int 2 int f ==> + bounded_on_int (\x. --((nth_derivative 2 f x * (&1 - f x * f x) + f x * derivative f x pow 2) / + sqrt ((&1 - f x * f x) pow 3))) int dd_bounds ==> + has_bounded_second_derivative (\x. acs (f x)) int dd_bounds` +[ + (((((use_arg_then "has_bounded_second_derivative")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["f_bounded"]) THEN (move ["f_abs"]) THEN (move ["df"]) THEN (move ["bounded"])); + ((fun arg_tac -> arg_tac (Arg_term (`!x. interval_arith x int ==> abs (f x) < &1`))) (term_tac (have_gen_tac [](move ["fabs"])))); + ((BETA_TAC THEN (move ["x"]) THEN (move ["ineq"])) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "interval_arith_abs") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "f_bounds") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "f_bounded")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((split_tac) THEN (move ["x"]) THEN (move ["ineq"])); + (((((use_arg_then "diff2_compose_acs")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "fabs")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then "second_derivative_compose_acs")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "fabs")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "bounded")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma second_derivative_scale_bounds *) +let second_derivative_scale_bounds = section_proof ["c";"f";"dd_bounds"] +`nth_diff_strong_int 2 int f ==> + bounded_on_int (\x. c * nth_derivative 2 f x) int dd_bounds ==> + has_bounded_second_derivative (\x. c * f x) int dd_bounds` +[ + (((((use_arg_then "has_bounded_second_derivative")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] [])))))) THEN (simp_tac) THEN (move ["df"]) THEN (move ["b"])); + (((((use_arg_then "nth_diff_scale")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["ineq"])); + ((((use_arg_then "second_derivative_scale")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "b")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then "df") (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC) THEN (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] [])))) THEN (exact_tac) THEN (done_tac)); +];; + +(* Lemma second_derivative_add_bounds *) +let second_derivative_add_bounds = section_proof ["f";"g";"dd_bounds"] +`nth_diff_strong_int 2 int f ==> + nth_diff_strong_int 2 int g ==> + bounded_on_int (\x. nth_derivative 2 f x + nth_derivative 2 g x) int dd_bounds ==> + has_bounded_second_derivative (\x. f x + g x) int dd_bounds` +[ + (((((use_arg_then "has_bounded_second_derivative")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] [])))))) THEN (simp_tac) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["b"])); + (((((use_arg_then "nth_diff_add")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["ineq"])); + ((((use_arg_then "second_derivative_add")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "b")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then "dg") (disch_tac [])) THEN (clear_assumption "dg") THEN ((use_arg_then "df") (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma second_derivative_sub_bounds *) +let second_derivative_sub_bounds = section_proof ["f";"g";"dd_bounds"] +`nth_diff_strong_int 2 int f ==> + nth_diff_strong_int 2 int g ==> + bounded_on_int (\x. nth_derivative 2 f x - nth_derivative 2 g x) int dd_bounds ==> + has_bounded_second_derivative (\x. f x - g x) int dd_bounds` +[ + (((((use_arg_then "has_bounded_second_derivative")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] [])))))) THEN (simp_tac) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["b"])); + (((((use_arg_then "nth_diff_sub")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["ineq"])); + ((((use_arg_then "second_derivative_sub")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "b")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then "dg") (disch_tac [])) THEN (clear_assumption "dg") THEN ((use_arg_then "df") (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma second_derivative_mul_bounds *) +let second_derivative_mul_bounds = section_proof ["f";"g";"dd_bounds"] +`nth_diff_strong_int 2 int f ==> + nth_diff_strong_int 2 int g ==> + bounded_on_int (\x. f x * nth_derivative 2 g x + &2 * derivative f x * derivative g x + + nth_derivative 2 f x * g x) int dd_bounds ==> + has_bounded_second_derivative (\x. f x * g x) int dd_bounds` +[ + (((((use_arg_then "has_bounded_second_derivative")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] [])))))) THEN (simp_tac) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["b"])); + (((((use_arg_then "nth_diff_mul")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["ineq"])); + ((((use_arg_then "second_derivative_mul")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "b")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then "dg") (disch_tac [])) THEN (clear_assumption "dg") THEN ((use_arg_then "df") (disch_tac [])) THEN (clear_assumption "df") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma second_derivative_div_bounds *) +let second_derivative_div_bounds = section_proof ["f";"g";"g_bounds";"dd_bounds"] +`bounded_on_int g int g_bounds ==> interval_not_zero g_bounds ==> + nth_diff_strong_int 2 int f ==> + nth_diff_strong_int 2 int g ==> + bounded_on_int (\x. ((nth_derivative 2 f x * g x - f x * nth_derivative 2 g x) * g x - + &2 * derivative g x * (derivative f x * g x - f x * derivative g x)) / g x pow 3) int dd_bounds ==> + has_bounded_second_derivative (\x. f x / g x) int dd_bounds` +[ + (((((use_arg_then "has_bounded_second_derivative")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] [])))))) THEN (move ["bg"]) THEN (move ["gn0"]) THEN (simp_tac) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["b"])); + ((fun arg_tac -> arg_tac (Arg_term (`!x. interval_arith x int ==> ~(g x = &0)`))) (term_tac (have_gen_tac [](move ["g0"])))); + ((BETA_TAC THEN (move ["x"]) THEN (move ["ineq"])) THEN (((use_arg_then "interval_arith_not_zero") (disch_tac [])) THEN (clear_assumption "interval_arith_not_zero") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`g_bounds`))) (term_tac exists_tac)) THEN (((use_arg_then "bg")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((THENL_FIRST) ((split_tac) THEN (move ["x"]) THEN (move ["ineq"])) (((((use_arg_then "diff2_div")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "g0")(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + (((((use_arg_then "second_derivative_div")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "g0")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "df")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then "dg")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then "b")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section SecondDerivativeBound *) +let nth_diff_strong2_eq_alt = finalize_theorem nth_diff_strong2_eq_alt;; +let nth_diff_strong2_eq = finalize_theorem nth_diff_strong2_eq;; +let lin_approx_compose = finalize_theorem lin_approx_compose;; +let second_derivative_atn_eq = finalize_theorem second_derivative_atn_eq;; +let second_derivative_atn = finalize_theorem second_derivative_atn;; +let diff2_atn = finalize_theorem diff2_atn;; +let second_derivative_inv = finalize_theorem second_derivative_inv;; +let diff2_inv = finalize_theorem diff2_inv;; +let SQRT_POW = finalize_theorem SQRT_POW;; +let second_derivative_sqrt = finalize_theorem second_derivative_sqrt;; +let diff2_sqrt = finalize_theorem diff2_sqrt;; +let real_powS = finalize_theorem real_powS;; +let second_derivative_acs = finalize_theorem second_derivative_acs;; +let diff2_acs = finalize_theorem diff2_acs;; +let REAL_CONTINUOUS_OPEN_PREIMAGE = finalize_theorem REAL_CONTINUOUS_OPEN_PREIMAGE;; +let second_derivative_compose = finalize_theorem second_derivative_compose;; +let diff2_compose = finalize_theorem diff2_compose;; +let continuous_not0_exists_open = finalize_theorem continuous_not0_exists_open;; +let continuous_gt_exists_open = finalize_theorem continuous_gt_exists_open;; +let continuous_lt_exists_open = finalize_theorem continuous_lt_exists_open;; +let second_derivative_compose_atn = finalize_theorem second_derivative_compose_atn;; +let second_derivative_compose_inv = finalize_theorem second_derivative_compose_inv;; +let second_derivative_compose_sqrt = finalize_theorem second_derivative_compose_sqrt;; +let second_derivative_compose_acs = finalize_theorem second_derivative_compose_acs;; +let diff2_compose_atn = finalize_theorem diff2_compose_atn;; +let diff2_compose_inv = finalize_theorem diff2_compose_inv;; +let diff2_compose_sqrt = finalize_theorem diff2_compose_sqrt;; +let diff2_compose_acs = finalize_theorem diff2_compose_acs;; +let second_derivative_mul = finalize_theorem second_derivative_mul;; +let second_derivative_div = finalize_theorem second_derivative_div;; +let diff2_div = finalize_theorem diff2_div;; +let second_derivative_scale = finalize_theorem second_derivative_scale;; +let second_derivative_add = finalize_theorem second_derivative_add;; +let second_derivative_sub = finalize_theorem second_derivative_sub;; +let second_derivative_compose_bounds = finalize_theorem second_derivative_compose_bounds;; +let second_derivative_atn_bounds = finalize_theorem second_derivative_atn_bounds;; +let second_derivative_compose_atn_bounds = finalize_theorem second_derivative_compose_atn_bounds;; +let second_derivative_inv_bounds = finalize_theorem second_derivative_inv_bounds;; +let second_derivative_compose_inv_bounds = finalize_theorem second_derivative_compose_inv_bounds;; +let second_derivative_sqrt_bounds = finalize_theorem second_derivative_sqrt_bounds;; +let second_derivative_compose_sqrt_bounds = finalize_theorem second_derivative_compose_sqrt_bounds;; +let second_derivative_acs_bounds = finalize_theorem second_derivative_acs_bounds;; +let second_derivative_compose_acs_bounds = finalize_theorem second_derivative_compose_acs_bounds;; +let second_derivative_scale_bounds = finalize_theorem second_derivative_scale_bounds;; +let second_derivative_add_bounds = finalize_theorem second_derivative_add_bounds;; +let second_derivative_sub_bounds = finalize_theorem second_derivative_sub_bounds;; +let second_derivative_mul_bounds = finalize_theorem second_derivative_mul_bounds;; +let second_derivative_div_bounds = finalize_theorem second_derivative_div_bounds;; +end_section "SecondDerivativeBound";; + +(* Section TaylorArith *) +begin_section "TaylorArith";; +let cell_domain = new_definition `cell_domain x y z w <=> + x <= y /\ y <= z /\ y - x <= w /\ z - y <= w`;; + +(* Lemma taylor_x *) +let taylor_x = section_proof ["x";"y";"z";"w"] +`cell_domain x y z w ==> + taylor_interval (\x. x) x y z w (y, y) (&1, &1) (&0, &0)` +[ + ((((use_arg_then "cell_domain")(thm_tac (new_rewrite [] [])))) THEN (move ["ineqs"])); + ((((use_arg_then "taylor_interval")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "ineqs")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "lin_approx_x")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + (((use_arg_then "has_bounded_second_derivative")(thm_tac (new_rewrite [] [])))); + (((((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_diff_strong")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_differentiable_on")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_differentiable_eq")(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((BETA_TAC THEN (move ["p"]) THEN (move ["_"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`(:real)`))) (term_tac exists_tac)) THEN (((((use_arg_then "REAL_OPEN_UNIV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_UNIV")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["q"]) THEN (simp_tac))); + (((((use_arg_then "REAL_CONTINUOUS_AT_ID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"])); + ((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `i < 2 <=> i = 0 \/ i = 1`)))(thm_tac (new_rewrite [] [])))) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then "nth_derivative0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ONE")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "nth_derivative1")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "derivative_x")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_ID")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "nth_derivative1")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "TWO")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "nth_derivative2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "derivative_x")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "derivative_const")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then "HAS_REAL_DERIVATIVE_CONST")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then "nth_derivative2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "derivative_x")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "derivative_const")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((repeat_tactic 1 9 (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma taylor_const *) +let taylor_const = section_proof ["c";"x";"y";"z";"w"] +`cell_domain x y z w ==> + taylor_interval (\x. c) x y z w (c, c) (&0, &0) (&0, &0)` +[ + ((((use_arg_then "cell_domain")(thm_tac (new_rewrite [] [])))) THEN (move ["ineqs"])); + ((((use_arg_then "taylor_interval")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "ineqs")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "lin_approx_const")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))); + (((use_arg_then "has_bounded_second_derivative")(thm_tac (new_rewrite [] [])))); + (((((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_diff_strong")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_differentiable_on")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "nth_differentiable_eq")(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((BETA_TAC THEN (move ["p"]) THEN (move ["_"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`(:real)`))) (term_tac exists_tac)) THEN (((((use_arg_then "REAL_OPEN_UNIV")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_UNIV")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "andTb")(thm_tac (new_rewrite [] [])))))) THEN (move ["q"]) THEN (simp_tac))); + (((((use_arg_then "REAL_CONTINUOUS_CONST")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andTb")(thm_tac (new_rewrite [] []))))) THEN (move ["i"])); + ((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `i < 2 <=> i = 0 \/ i = 1`)))(thm_tac (new_rewrite [] [])))) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then "nth_derivative0")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "ONE")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "nth_derivative1")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "derivative_const")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_CONST")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then "nth_derivative1")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "TWO")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "nth_derivative2")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "derivative_const")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "HAS_REAL_DERIVATIVE_CONST")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then "nth_derivative2")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "derivative_const")(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((repeat_tactic 1 9 (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(add_section_var (mk_var ("f", (`:real->real`))));; +(add_section_var (mk_var ("x", (`:real`))); add_section_var (mk_var ("y", (`:real`))); add_section_var (mk_var ("z", (`:real`))); add_section_var (mk_var ("w", (`:real`))));; +(add_section_var (mk_var ("f_bounds", (`:real#real`))); add_section_var (mk_var ("df_bounds", (`:real#real`))); add_section_var (mk_var ("dd_bounds", (`:real#real`))));; +(add_section_var (mk_var ("f_lo", (`:real`))); add_section_var (mk_var ("f_hi", (`:real`))); add_section_var (mk_var ("df_lo", (`:real`))); add_section_var (mk_var ("df_hi", (`:real`))));; + +(* Lemma taylor_f_bounds *) +let taylor_f_bounds = section_proof ["df";"dd";"lo";"hi";"t"] +`taylor_interval f x y z w (f_lo, f_hi) df_bounds dd_bounds ==> + iabs df_bounds = df ==> + iabs dd_bounds = dd ==> + w * (df + w * dd * inv(&2)) <= t ==> + f_hi + t <= hi ==> lo <= f_lo - t ==> + bounded_on_int f (x, z) (lo, hi)` +[ + (BETA_TAC THEN (move ["taylor_f"]) THEN (move ["iabs_df"]) THEN (move ["iabs_dd"]) THEN (move ["t_ineq"]) THEN (move ["hi_ineq"]) THEN (move ["lo_ineq"])); + (((((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))))) THEN (move ["p"]) THEN (move ["ineq"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then "taylor_upper_bound") (fun fst_arg -> (fun arg_tac -> (use_arg_then "EQ_SYM") (fun fst_arg -> (use_arg_then "iabs_dd") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "taylor_f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then "taylor_lower_bound") (fun fst_arg -> (fun arg_tac -> (use_arg_then "EQ_SYM") (fun fst_arg -> (use_arg_then "iabs_dd") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "taylor_f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "real_div")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "iabs_df")(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (move ["ineq1"]) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (move ["ineq2"])); + ((((use_arg_then "t_ineq") (disch_tac [])) THEN (clear_assumption "t_ineq") THEN ((use_arg_then "hi_ineq") (disch_tac [])) THEN (clear_assumption "hi_ineq") THEN ((use_arg_then "lo_ineq") (disch_tac [])) THEN (clear_assumption "lo_ineq") THEN ((use_arg_then "ineq2") (disch_tac [])) THEN (clear_assumption "ineq2") THEN ((use_arg_then "ineq1") (disch_tac [])) THEN (clear_assumption "ineq1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma taylor_df_bounds *) +let taylor_df_bounds = section_proof ["dd";"lo";"hi"] +`taylor_interval f x y z w f_bounds (df_lo, df_hi) dd_bounds ==> + iabs dd_bounds = dd ==> + df_hi + w * dd <= hi ==> + lo <= df_lo - w * dd ==> + bounded_on_int (derivative f) (x, z) (lo, hi)` +[ + (BETA_TAC THEN (move ["taylor_f"]) THEN (move ["iabs_dd"]) THEN (move ["hi_ineq"]) THEN (move ["lo_ineq"])); + (((((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "interval_arith")(thm_tac (new_rewrite [] [])))))) THEN (move ["p"]) THEN (move ["ineq"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "taylor_derivative_lower_bound") (fun fst_arg -> (fun arg_tac -> (use_arg_then "EQ_SYM") (fun fst_arg -> (use_arg_then "iabs_dd") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "taylor_f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then "taylor_derivative_upper_bound") (fun fst_arg -> (fun arg_tac -> (use_arg_then "EQ_SYM") (fun fst_arg -> (use_arg_then "iabs_dd") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "taylor_f") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "ineq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((use_arg_then "hi_ineq") (disch_tac [])) THEN (clear_assumption "hi_ineq") THEN ((use_arg_then "lo_ineq") (disch_tac [])) THEN (clear_assumption "lo_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma bounded_on_int_compose *) +let bounded_on_int_compose = section_proof ["g";"int";"g_bounds"] +`bounded_on_int g int g_bounds ==> + bounded_on_int f g_bounds f_bounds ==> + bounded_on_int (\x. f (g x)) int f_bounds` +[ + ((repeat_tactic 1 9 (((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] []))))) THEN (move ["g_bounded"]) THEN (move ["f_bounded"]) THEN (move ["x"]) THEN (move ["ineq"]) THEN (simp_tac)); + (((((use_arg_then "f_bounded")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "g_bounded")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma bounded_on_int_imp_interval_arith *) +let bounded_on_int_imp_interval_arith = section_proof ["int"] +`bounded_on_int f int f_bounds ==> + interval_arith y int ==> interval_arith (f y) f_bounds` +[ + ((((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] [])))) THEN (move ["bounded_f"]) THEN (move ["int_y"])); + ((((use_arg_then "bounded_f")(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma taylor_interval_narrow *) +let taylor_interval_narrow = section_proof ["x0";"z0";"w0"] +`taylor_interval f x y z w f_bounds df_bounds dd_bounds ==> + cell_domain x0 y z0 w0 ==> + x <= x0 ==> z0 <= z ==> + taylor_interval f x0 y z0 w0 f_bounds df_bounds dd_bounds` +[ + (((repeat_tactic 1 9 (((use_arg_then "taylor_interval")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "cell_domain")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "andbA")(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN ((case THEN ((move ["ineq"]) THEN (move ["lin"]))) THEN (move ["dd"]))) THEN (move ["c"]) THEN (move ["i1"]) THEN (move ["i2"])); + ((THENL_FIRST) (((((use_arg_then "lin")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "andbT")(thm_tac (new_rewrite [] []))))) THEN (split_tac)) ((((use_arg_then "i2") (disch_tac [])) THEN (clear_assumption "i2") THEN ((use_arg_then "i1") (disch_tac [])) THEN (clear_assumption "i1") THEN ((use_arg_then "c") (disch_tac [])) THEN (clear_assumption "c") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then "dd") (disch_tac [])) THEN (clear_assumption "dd") THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then "has_bounded_second_derivative")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "nth_diff_strong_int")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "bounded_on_int")(thm_tac (new_rewrite [] [])))))) THEN (move ["df"]))); + ((split_tac) THEN (move ["p"]) THEN (move ["int_p"])); + ((((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "i2") (disch_tac [])) THEN (clear_assumption "i2") THEN ((use_arg_then "i1") (disch_tac [])) THEN (clear_assumption "i1") THEN ((use_arg_then "int_p") (disch_tac [])) THEN (clear_assumption "int_p") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL interval_arith)))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then "df")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "i2") (disch_tac [])) THEN (clear_assumption "i2") THEN ((use_arg_then "i1") (disch_tac [])) THEN (clear_assumption "i1") THEN ((use_arg_then "int_p") (disch_tac [])) THEN (clear_assumption "int_p") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL interval_arith)))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section TaylorArith *) +let taylor_x = finalize_theorem taylor_x;; +let taylor_const = finalize_theorem taylor_const;; +let taylor_f_bounds = finalize_theorem taylor_f_bounds;; +let taylor_df_bounds = finalize_theorem taylor_df_bounds;; +let bounded_on_int_compose = finalize_theorem bounded_on_int_compose;; +let bounded_on_int_imp_interval_arith = finalize_theorem bounded_on_int_imp_interval_arith;; +let taylor_interval_narrow = finalize_theorem taylor_interval_narrow;; +end_section "TaylorArith";; diff --git a/formal_ineqs/verifier/interval_m/interval.ml b/formal_ineqs/verifier/interval_m/interval.ml new file mode 100644 index 0000000..3eff22d --- /dev/null +++ b/formal_ineqs/verifier/interval_m/interval.ml @@ -0,0 +1,173 @@ +(* =========================================================== *) +(* OCaml interval arithmetic *) +(* Author: Thomas C. Hales *) +(* Date: 2011-08-21 *) +(* =========================================================== *) + +(* port of interval.cc, + +This file gives a simple implementation of interval arithmetic, +together with the basic arithmetic operations on intervals. + +It has been incompletely implemented. + +For now, I am not implementing directed roundings. +However, McLaughlin implemented directed rounding several years ago: +See http://perso.ens-lyon.fr/nathalie.revol/mpfi.html + ~/Library/McLaughlinOCAML/ocaml/src/extensions/ocaml-mpfi/ + + *) + +needs "verifier/interval_m/types.ml";; + +module Interval = struct + +open Interval_types;; + +let mk_interval (a,b) = { lo = a; hi = b; };; + +let string_of_interval x = Printf.sprintf "[%f;%f]" x.lo x.hi;; + +(* let izero = mk_interval(0.0,0.0);; *) +let zero = mk_interval(0.0,0.0);; +let one = mk_interval(1.0,1.0);; +let two = mk_interval(2.0,2.0);; +let four = mk_interval(4.0,4.0);; + +let is_zero x =(x.lo=0.0)&&(x.hi=0.0);; + +let pos x = if (x.lo >= 0.0) then x else + mk_interval(0.0, if (x.hi < 0.0) then 0.0 else x.hi );; + +let imax (x,y) = let t=max x.hi y.hi in mk_interval(t,t);; + +let imin (x,y) = let t = min x.lo y.lo in mk_interval(t,t);; + +let imin3(x,y,z) = imin(x,imin(y,z));; + +let imax3(x,y,z) = imax(x,imax(y,z));; + +let imax4(w,x,y,z) = imax(imax(w,x),imax(y,z));; + +let sup x = x.hi;; + +let inf x = x.lo;; + +let iabs x = max x.hi (~-. (x.lo));; + +let ilt x y = (x.hi < y.lo);; + +let igt x y = (x.lo > y.hi);; + +let ieq x y = (x.lo = y.lo && x.hi = y.hi);; + +(* need rounding modes -- BUG *) + + +(* start of bug section *) + +let up() = ( (* bug *) );; +let down() = ( (* bug *) );; +let nearest() = ( (* bug *) );; +let upadd x y = ( x +. y);; (* bug *) +let upmul x y = (x *. y);; +let updiv x y = (x /. y);; +let upsub x y = (x -. y);; +let downadd x y = (x +. y);; +let downmul x y = (x *. y);; +let downdiv x y = (x /. y);; +let downsub x y = (x -. y);; + +(* end of bug section *) + +let interval_of_string = + let dbl_min =1.0e-300 in + fun (s1,s2) -> + let ( - ) = (down(); downsub) in + let lo = float_of_string s1 - dbl_min in + let ( + ) = (up(); upadd) in + let hi = float_of_string s2 + dbl_min in + mk_interval(lo,hi);; + +let interval_of_single s = interval_of_string (s,s);; + +let ineg x = mk_interval(~-. (x.hi), ~-. (x.lo));; + +let iadd x y = mk_interval((down(); downadd x.lo y.lo), (up(); upadd x.hi y.hi));; + +let slowcases x y = + if (x.lo >= 0.0) then + (if (y.lo >= 0.0) then (x.lo,y.lo,x.hi,y.hi) + else if (y.hi <= 0.0) then (x.hi,y.lo,x.lo,y.hi ) else (x.hi,y.lo,x.hi,y.hi)) + else if (x.hi <= 0.0) then + (if (y.hi <= 0.0) then (x.hi,y.hi,x.lo,y.lo) + else if (y.lo >= 0.0) then (x.lo,y.hi,x.hi,y.lo) else (x.lo,y.hi,x.lo,y.lo)) + else + (if (y.lo >=0.0) then (x.lo,y.hi,x.hi,y.hi) + else if (y.hi <=0.0) then (x.hi,y.lo,x.lo,y.lo) + else (let lo = (down(); min (downmul x.hi y.lo) (downmul x.lo y.hi)) in + let hi = (up(); max (upmul x.hi y.hi) (upmul x.lo y.lo)) in (lo,1.0,hi,1.0)));; + +let slowmul x y = + let (xlo,ylo,xhi,yhi) = slowcases x y in + mk_interval((down(); downmul xlo ylo),(up(); upmul xhi yhi));; + +let _ = + let test_slowmul x y = + let all = [x.lo *. y.lo; x.hi *. y.lo; x.lo *. y.hi; x.hi *. y.hi] in + let m = end_itlist min all in + let M = end_itlist max all in + ( mk_interval(m,M) = slowmul x y) in + let xs = map mk_interval [(~-. 7.0, ~-. 5.0);(~-. 3.0,9.0);(11.0,13.0)] in + let ys = map mk_interval [(~-. 16.0, ~-. 14.0);(~-. 10.0,12.0); (18.0,22.0)] in + let test i j = test_slowmul (List.nth xs i) (List.nth ys j) or + failwith (Printf.sprintf "%d %d" i j) in + for i=0 to 2 do + for j= 0 to 2 do + let _ = test i j in (); + done; done;; + +let imul x y = if (x.lo > 0.0 && y.lo > 0.0) then + mk_interval((down(); downmul x.lo y.lo, (up(); upmul x.hi y.hi))) else slowmul x y;; + +let isub x y = mk_interval((down();downsub x.lo y.hi),(up(); upsub x.hi y.lo));; + +let isqrt = + let sqrt = Pervasives.sqrt in + fun x -> mk_interval( + (if (x.lo <= 0.0) then 0.0 else (down(); sqrt(x.lo))), + (if (x.hi <= 0.0) then 0.0 else (up(); sqrt(x.hi))));; + +let iatan x = + let _ = nearest() in + mk_interval((down(); atan x.lo),(up(); atan x.hi));; + +let iacos x = + let _ = nearest() in + mk_interval((down(); acos x.hi),(up(); acos x.lo));; + +let combine x y = mk_interval(inf(imin(x,y)),sup(imax(x,y)));; + +let rand01 = + let random_int_seed = 81757 in + let _ = Random.init(random_int_seed) in + fun _ -> Random.float(1.0);; + +let bounded_from_zero = + let dbl_epsilon = 1.0e-8 in + fun x-> (x.hi < ~-. dbl_epsilon or x.lo > dbl_epsilon);; + +let idiv x y = if (bounded_from_zero y) then + imul x (mk_interval((down(); downdiv 1.0 y.hi),(up(); updiv 1.0 y.lo))) + else raise Unstable;; + +(* overload arithmetic ops *) + +(* +let (+) = iadd;; +let (-) = isub;; +let (/) = idiv;; +let (~-) = ineg;; +*) + +end;; diff --git a/formal_ineqs/verifier/interval_m/line_interval.ml b/formal_ineqs/verifier/interval_m/line_interval.ml new file mode 100644 index 0000000..922833b --- /dev/null +++ b/formal_ineqs/verifier/interval_m/line_interval.ml @@ -0,0 +1,114 @@ +(* =========================================================== *) +(* OCaml linear approximation of functions *) +(* Author: Thomas C. Hales *) +(* Date: 2011-08-21 *) +(* =========================================================== *) + +(* port of lineInterval.cc. + Only the top section has been translated. The rest should be + automatically generated from HOL Light specs. + + This impements basic operations on the type line, + such as addition and scalar multiplication. + + *) + +needs "verifier/interval_m/interval.ml";; + +module Line_interval = struct + +open Interval_types;; +open List;; +open Interval;; + + +(* general utilities *) + let iter8 = 0--7;; + + let table f = map f iter8;; + + let table2 f = map (fun i -> map (fun j-> f i j) iter8) iter8;; + + let rth m x i = if (i >=0) && (i < m) then List.nth x i else + failwith (Printf.sprintf "index %d not in 0..%d" i (m-1));; + + let mth x i = if (i >=0) && (i < 8) then List.nth x i else + failwith (Printf.sprintf "index %d not in 0..8" i );; + + let mth2 a i j = mth (mth a i) j;; + + let maxl xs = end_itlist max xs;; + + let minl xs = end_itlist min xs;; + +(* line interval proper *) + +let partial line i = mth line.df i ;; + +let mk_line(f1,df1) = { f = f1; df =df1};; + +let line_zero = + let z = zero in + mk_line(z,replicate z 8);; + +let line_unit = + mk_line(one,replicate zero 8);; + +let lmul = + let ( * ) = imul in + let ( + ) = iadd in + fun a b -> mk_line ( a.f * b.f, map (fun i -> a.f * mth b.df i + b.f * mth a.df i) iter8);; + +let smul = + let ( * ) = imul in + fun a b -> mk_line ( a.f * b, map (fun x -> x * b) a.df);; + +let ldiv = + let one = mk_interval(1.0,1.0) in + let ( * ) = imul in + let ( - ) = isub in + let ( / ) = idiv in + fun b a -> + let r = one/a.f in + let f = b.f * r in + let r2 = r * r in + mk_line ( f, map (fun i -> ((mth b.df i) * a.f - (mth a.df i) * b.f)* r2) iter8);; + +let ladd = + let ( + ) = iadd in + fun b a -> + mk_line(b.f + a.f, map (fun i -> mth b.df i + mth a.df i) iter8);; + +let lsub = + let ( - ) = isub in + fun b a -> + mk_line(b.f - a.f, map (fun i -> mth b.df i - mth a.df i) iter8);; + +let lneg = + let ineg = ineg in + fun a -> + mk_line(ineg a.f, map ineg a.df);; + +let lsqrt = + let one = mk_interval(1.0,1.0) in + let two = mk_interval(2.0,2.0) in + let ( * ) = imul in + let ( / ) = idiv in + fun a -> + let f = isqrt a.f in + let rs = one / (two * f) in + mk_line(f, map (fun i -> mth a.df i * rs) iter8);; + +let latan = (* arctan (a/b) *) + let one = mk_interval(1.0,1.0) in + let ( * ) = imul in + let ( + ) = iadd in + let ( - ) = isub in + let ( / ) = idiv in + fun a b -> + let f = iatan (a.f/b.f) in + let rden = one/ (a.f * a.f + b.f * b.f) in + mk_line(f, map (fun i -> rden * (mth a.df i * b.f - mth b.df i * a.f)) iter8);; + + + end;; diff --git a/formal_ineqs/verifier/interval_m/recurse.hl b/formal_ineqs/verifier/interval_m/recurse.hl new file mode 100644 index 0000000..ccd7bd8 --- /dev/null +++ b/formal_ineqs/verifier/interval_m/recurse.hl @@ -0,0 +1,411 @@ +(* =========================================================== *) +(* OCaml verification procedure *) +(* Authors: Thomas C. Hales, Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +(* port of recurse.cc *) + +(* +This is the code that verifies a disjunct of nonlinear inequalities. +The are given as a list (tf:tfunction list). If tf = [f1;....;fk], then +the list represents the inequality (f1 < 0 \/ f2 < 0 .... fk < 0). + +The end user should only need to define a cell option, +and then call recursive_verifier, which recursively bisects the domain +until a partition of the domain is found on which verifier_cell gives +a pass on each piece of the partition. + +*) + +needs "verifier/interval_m/taylor.ml";; +needs "verifier/interval_m/report.ml";; +needs "verifier_options.hl";; + +module Recurse = struct + +open Interval_types;; +open Interval;; +open Univariate;; +open Line_interval;; +open Taylor;; +open Verifier_options;; +open List;; + +(* needs "verifier/interval_m/work1.hl";; *) + +type cellOption = { + only_check_deriv1_negative : bool; + is_using_dihmax : bool; + is_using_bigface126 : bool; + width_cutoff : float; + allow_sharp : bool; + allow_derivatives : bool; + mutable iteration_count : int; + iteration_limit : int; + recursion_depth : int; + mono_pass : bool; + convex_flag : bool; + raw_int_flag : bool; + eps : float; +};; + + +(* cell verification is complex, and we use exceptions to + exit as soon as the status has been determined. *) + +type mono_status = { + variable : int; + decr_flag : bool; + df0_flag : bool; + ti_flag : bool; +};; + +type fun_type = { + tf : tfunction; + index : int; +};; + +(* +let tfs0 = [{tf = tf1; index = 0;}; + {tf = tf2; index = 1;}];; +*) + +let all_indices = map (fun (_, f) -> f.index);; + +type cell_status = + | Cell_pass of mono_status list list * (int * bool) + | Cell_pass_mono of mono_status list list * (int list * mono_status) + | Cell_counterexample + | Cell_inconclusive_ti of (taylor_interval * fun_type) list * (mono_status list list * float list * float list * float list * float list) + | Cell_inconclusive of fun_type list * (mono_status list list * float list * float list * float list * float list);; + +exception Return of cell_status;; + +type result_tree = + | Result_false of (float list * float list) + (* function number, raw flag *) + | Result_pass of (int * bool) + | Result_pass_mono of mono_status + | Result_pass_ref of int + | Result_mono of mono_status list * result_tree + (* variable, convex_flag, r1, r2 *) + | Result_glue of (int * bool * result_tree * result_tree);; + +type p_status = { + pp : int; +};; + +type p_result_tree = + | P_result_pass of p_status * int * bool + | P_result_mono of p_status * mono_status list * p_result_tree + | P_result_glue of p_status * int * bool * p_result_tree * p_result_tree + | P_result_ref of int;; + +let rec result_size r = + match r with + | Result_false _ -> failwith "False result detected" + | Result_mono (_,r1) -> result_size r1 + | Result_glue (_, _, r1, r2) -> result_size r1 + result_size r2 + | Result_pass_mono _ -> 1 + | Result_pass _ -> 1 + | _ -> 0;; + +let rec p_result_size r = + match r with + | P_result_pass _ -> 1 + | P_result_mono (_, _, r1) -> p_result_size r1 + | P_result_glue (_, _, _, r1, r2) -> p_result_size r1 + p_result_size r2 + | _ -> 0;; + + +let return c = raise (Return c);; + + +(* error checking and reporting functions *) + +let string_of_domain x = + let n = mth in + Printf.sprintf "{%f, %f, %f, %f, %f, %f, %f, %f}" (n x 0) (n x 1) (n x 2) (n x 3) (n x 4) (n x 5) (n x 6) (n x 7);; + +let string3 (x,z,s) = (string_of_domain x ^"\n"^ string_of_domain z ^ "\n" ^ s);; + +let boolify _ = true;; + +let report_current = boolify o Report.report_timed o string3;; + +let report_error = boolify o Report.report_error o string3;; + +let report_fatal = boolify o Report.report_fatal o string3;; + +(* let t = [0.1;0.2;0.3;0.4;0.5;0.6] in report_error (t,t,"ok");; *) + +let periodic_count = + let end_count = ref 0 in + fun () -> + let _ = end_count := !end_count + 1 in + (0 = ( !end_count mod 1000));; + +let check_limit opt depth = + let _ = opt.iteration_count <- opt.iteration_count + 1 in + ( opt.iteration_count < opt.iteration_limit or opt.iteration_limit = 0 ) && + (depth < opt.recursion_depth);; + +let sgn x = if (x.lo > 0.0) then 1 else if (x.hi < 0.0) then -1 else 0;; + +let rec same_sgn x y = (x = []) or (sgn (hd x) = sgn (hd y) && same_sgn (tl x) (tl y));; + + +let dummy_taylor = make_taylor_interval ((mk_line (one, [])), [], []);; + +(* computes taylor intervals for all functions *) +let rec set_targets (x,z,x0,z0,tfs,tis,opt,mono,maxwidth,has_unstable) = + if (tfs = []) then + let _ = not(has_unstable) or return (Cell_inconclusive (map snd tis, (mono,x,z,x0,z0))) in + List.rev tis + else + let tf = (hd tfs).tf and + index = (hd tfs).index in + let target0 = + if opt.raw_int_flag then + try evalf0 tf 0 x z with Unstable -> one + else + one in + let _ = target0.hi >= ~-.(opt.eps) or return (Cell_pass (mono, (index, true))) in + try + let target = evalf tf x z in + let _ = upper_bound target >= ~-.(opt.eps) or return (Cell_pass (mono, (index, false))) in + set_targets(x,z,x0,z0,tl tfs,(target,hd tfs)::tis,opt,mono,maxwidth,has_unstable) + with Unstable -> + if (2.0 *. maxwidth > opt.width_cutoff) then + set_targets(x,z,x0,z0,tl tfs,(dummy_taylor, hd tfs)::tis,opt,mono,maxwidth,true) (* proclaim unstable *) + else + set_targets(x,z,x0,z0,tl tfs,tis,opt,mono,maxwidth,has_unstable) (* drop silently *) +;; + +(* +let tis = set_targets (xx, zz, xx, zz, tfs0, [], opt0, [], 1.0, false);; +let ti = fst (nth tis 0);; +lower_bound ti;; +*) + +let rec delete_false acc tis = + if (tis=[]) then List.rev acc + else if (lower_bound (fst (hd tis)) > 0.0) then delete_false acc (tl tis) + else delete_false (hd tis::acc) (tl tis);; + + +(* has_monotone *) +let rec has_monotone opt tis domain0 x z x0 z0 is found = match is with + | [] -> (x,z,x0,z0,List.rev found) + | j::js when (mth x j >= mth z j) -> + has_monotone opt tis domain0 x z x0 z0 js found + | j::js -> + let df_ints = + if opt.raw_int_flag then + map (fun (ti, f) -> + (try + evalf0 f.tf (j + 1) (fst domain0) (snd domain0) + with Unstable -> mk_interval (-1.0,1.0))) + tis + else + [mk_interval (-1.0, 1.0)] in + let allpos_df0 = List.fold_left (fun a i -> a && i.lo >= opt.eps) true df_ints and + allneg_df0 = List.fold_left (fun a i -> a && i.hi < ~-.(opt.eps)) true df_ints in + let allpos_ti = List.fold_left (fun a ti -> a && lower_partial (fst ti) j >= opt.eps) true tis and + allneg_ti = List.fold_left (fun a ti -> a && upper_partial (fst ti) j < ~-.(opt.eps)) true tis in + + if (allpos_df0 or allpos_ti) then + let status = + {variable = j + 1; decr_flag = false; df0_flag = allpos_df0; ti_flag = allpos_ti} in + if opt.mono_pass && mth z j < mth z0 j then + return (Cell_pass_mono ([], (all_indices tis, status))) + else + let setj u = table (fun i -> (if i=j then mth z j else mth u i)) in + has_monotone opt tis domain0 (setj x) (setj z) + (setj x0) (setj z0) js (status :: found) + else if (allneg_df0 or allneg_ti) then + let status = + {variable = j + 1; decr_flag = true; df0_flag = allneg_df0; ti_flag = allneg_ti} in + if opt.mono_pass && mth x j > mth x0 j then + return (Cell_pass_mono ([], (all_indices tis, status))) + else + let setj u = table (fun i -> (if i=j then mth x j else mth u i)) in + has_monotone opt tis domain0 (setj x) (setj z) + (setj x0) (setj z0) js (status :: found) + else has_monotone opt tis domain0 x z x0 z0 js found;; + +(* loop as long as monotonicity keeps making progress. *) + +let rec going_strong(x,z,x0,z0,tfs,opt,mono) = + let (y,w) = center_form (x,z) in + let maxwidth = maxl w in + let tis = set_targets (x,z,x0,z0,tfs,[],opt,mono,maxwidth,false) in + let epsilon_width = 1.0e-8 in + let _ = (maxwidth >= epsilon_width) or return Cell_counterexample in + let tis = delete_false [] tis in + let _ = (List.length tis > 0) or return Cell_counterexample in + let (x0,z0) = if (length tis < length tfs) then (x,z) else (x0,z0) in + let (x,z,x0,z0,strong) = + if (opt.allow_derivatives) then + try + has_monotone opt tis (x,z) x z x0 z0 iter8 [] + with Return (Cell_pass_mono (_, i_status)) -> + return (Cell_pass_mono (mono, i_status)) + else (x,z,x0,z0,[]) in + if (strong <> []) then + going_strong(x,z,x0,z0,map snd tis,opt,mono @ [strong]) + else + (tis,x,z,x0,z0,maxwidth,mono);; + +(* +let xx = [0.0; -1.0] @ pad;; +let zz = [1.0; 0.0] @ pad;; +let _, x,z,x0,z0,_,mono = going_strong (xx,zz,xx,zz,tfs0,opt0,[]);; + +let tis = set_targets (xx,zz,xx,zz,tfs0,[],opt0,[],1.0,false);; + +let j = 0 and + opt = opt0 and + domain0 = (xx,zz);; + +evalf0 tf1 1 xx zz;; + +let df_ints = + if opt.raw_int_flag then + map (fun (ti, f) -> + (try + evalf0 f.tf (j + 1) (fst domain0) (snd domain0) + with Unstable -> mk_interval (-1.0,1.0))) + tis + else + [mk_interval (-1.0, 1.0)];; + let allpos_df0 = List.fold_left (fun a i -> a && i.lo >= opt.eps) true df_ints and + allneg_df0 = List.fold_left (fun a i -> a && i.hi < ~-.(opt.eps)) true df_ints in + let allpos_ti = List.fold_left (fun a ti -> a && lower_partial (fst ti) j >= opt.eps) true tis and + allneg_ti = List.fold_left (fun a ti -> a && upper_partial (fst ti) j < ~-.(opt.eps)) true tis in +*) + + +(* +This procedure is mostly guided by heuristics that don't require formal +verification. In particular, no justification is required for tossing out inequalities +(since they appear as disjuncts, we can choose which one to prove). + +Formal verification is required whenever a Cell_passes is issued, +and whenever the domain (x,z) is restricted. + +The record (x0,z0) of the current outer boundary must be restricted to (x,z) +whenever an inequality is tossed out. +*) + +let rec verify_cell (x,z,x0,z0,tfs,opt) = + try ( + let _ = not(periodic_count () && !info_print_level >= 2) or report_current (x,z,"periodic report") in + let (tis,x,z,x0,z0,maxwidth,mono) = going_strong(x,z,x0,z0,tfs,opt,[]) in + if opt.convex_flag then + Cell_inconclusive_ti (tis, (mono,x,z,x0,z0)) + else + Cell_inconclusive (map snd tis, (mono,x,z,x0,z0)) + ) + with Return c -> c;; + +let recursive_verifier (x,z,x0,z0,tfs,opt) = + let w_init, indices = unzip (filter (fun p -> fst p > 1e-8) (zip (map2 (-.) z x) (1--length x))) in + let ws = map2 (-.) z x in + let total_vol = itlist ( *. ) w_init 1.0 in + let verified_vol = ref 0.0 in + let last_report = ref 0 in + let compute_vol x z w = + let rec compute i indices x z w = + match indices with + | [] -> 1.0 + | (r :: t) when r = i -> + let l = hd z -. hd x in + (if l > 1e-8 then l else hd w) *. compute (i + 1) t (tl x) (tl z) (tl w) + | _ -> compute (i + 1) indices (tl x) (tl z) (tl w) in + compute 1 indices x z w in + let update_verified_vol x z w = + if !info_print_level > 0 then + let _ = verified_vol := !verified_vol +. compute_vol x z w in + let verified = int_of_float (!verified_vol /. total_vol *. 100.5) in + if verified > !last_report then + let _ = last_report := verified in report0 (sprintf "%d " !last_report) else () + else () in + + let add_mono mono r1 = + itlist (fun m r -> Result_mono (m, r)) mono r1 in + + let rec rec_verifier (depth,x,z,x0,z0,w0,tfs) = + let split_and_verify tfs j x z x0 z0 convex_flag = + let ( ++ ), ( / ) = up(); upadd, updiv in + let yj = (mth x j ++ mth z j) / 2.0 in + let delta b v = table (fun i-> if (i = j && b) then yj else mth v i) in + let x1, z1 = + if convex_flag then + x, table (fun i -> if i = j then mth x i else mth z i) + else + delta false x, delta true z in + let x2, z2 = + if convex_flag then + table (fun i -> if i = j then mth z i else mth x i), z + else + delta true x, delta false z in + let w1 = table (fun i -> if i = j then mth w0 i / 2.0 else mth w0 i) in + let r1 = rec_verifier(depth+1,x1,z1,x0,z0,w1,tfs) in + match r1 with + | Result_false t -> Result_false t + | _ -> + (let r2 = rec_verifier(depth+1,x2,z2,x0,z0,w1,tfs) in + match r2 with + | Result_false t -> Result_false t + | _ -> Result_glue (j, convex_flag, r1, r2)) in + + let _ = check_limit opt depth or report_fatal(x,z,Printf.sprintf "depth %d" depth) in + match verify_cell(x,z,x0,z0,tfs,opt) with + | Cell_counterexample -> Result_false (x,z) + | Cell_pass (mono, (i, f0_flag)) -> + let _ = update_verified_vol x z w0 in + add_mono mono (Result_pass (i, f0_flag)) + | Cell_pass_mono (mono, (is, status)) -> + let _ = update_verified_vol x z w0 in + add_mono mono (Result_pass_mono status) +(* +(* TODO: convexity *) + | Cell_inconclusive_ti (tis, (mono,x,z,x0,z0)) -> + let dds = map (fun i -> mth (mth ti.dd i) i, i) iter8 in + let convex_dds = filter (fun dd, i -> dd.lo >= opt.eps && mth x i < mth z i) dds in + let convex_i = map snd convex_dds in + let w2 = List.map2 upsub z x in + let convex_flag, ws, ws_i = + if convex_dds = [] then + false, w2, iter8 + else + true, map (mth w2) convex_i, convex_i in + let maxwidth2 = maxl ws in + let j_wide = try( find (fun i -> mth w2 i = maxwidth2) ws_i) with + | _ -> failwith "recursive_verifier find" in + add_mono mono (split_and_verify tfs j_wide x z x0 z0 convex_flag) +*) + | Cell_inconclusive_ti _ -> failwith "Convexity is not supported" + | Cell_inconclusive (tfs, (mono,x,z,x0,z0)) -> + let w2 = List.map2 upsub z x in + let maxwidth2 = maxl w2 in + let j_wide = try( find (fun i -> mth w2 i = maxwidth2) iter8) with + | _ -> failwith "recursive_verifier find" in + add_mono mono (split_and_verify tfs j_wide x z x0 z0 false) in + + rec_verifier (0,x,z,x0,z0,ws,tfs);; + +(* +let _, tf3, _ = mk_verification_functions_poly 3 `\x:real^2. --(&1 - x$1 * x$1 - x$2 * x$2)`;; +let tfs1 = [{tf = tf3; index = 0;}];; +let xx = [-0.75; -0.7] @ pad and + zz = [0.75; 0.7] @ pad;; + + +verify_cell (xx,zz,xx,zz,tfs1,opt0);; +recursive_verifier (xx,zz,xx,zz,tfs1,opt0);; +*) + +end;; diff --git a/formal_ineqs/verifier/interval_m/recurse.ml b/formal_ineqs/verifier/interval_m/recurse.ml new file mode 100644 index 0000000..ea5b9de --- /dev/null +++ b/formal_ineqs/verifier/interval_m/recurse.ml @@ -0,0 +1,315 @@ +(* =========================================================== *) +(* OCaml verification procedure *) +(* Authors: Thomas C. Hales, Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +(* port of recurse.cc *) + +(* +This is the code that verifies a disjunct of nonlinear inequalities. +The are given as a list (tf:tfunction list). If tf = [f1;....;fk], then +the list represents the inequality (f1 < 0 \/ f2 < 0 .... fk < 0). + +The end user should only need to define a cell option, +and then call recursive_verifier, which recursively bisects the domain +until a partition of the domain is found on which verifier_cell gives +a pass on each piece of the partition. + +*) + +needs "verifier/interval_m/taylor.ml";; +needs "verifier/interval_m/report.ml";; +needs "verifier_options.hl";; + +module Recurse = struct + +open Interval_types;; +open Interval;; +open Univariate;; +open Line_interval;; +open Taylor;; +open Verifier_options;; +open List;; + +type cellOption = { + only_check_deriv1_negative : bool; + is_using_dihmax : bool; + is_using_bigface126 : bool; + width_cutoff : float; + allow_sharp : bool; + allow_derivatives : bool; + mutable iteration_count : int; + iteration_limit : int; + recursion_depth : int; + mono_pass : bool; + convex_flag : bool; + raw_int_flag : bool; + eps : float; +};; + +(* cell verification is complex, and we use exceptions to + exit as soon as the status has been determined. *) + +type mono_status = { + variable : int; + decr_flag : bool; + df0_flag : bool; + ti_flag : bool; +};; + + +type cell_status = + | Cell_pass of mono_status list list * bool + | Cell_pass_mono of mono_status list list * mono_status + | Cell_counterexample + | Cell_inconclusive_ti of (mono_status list list * taylor_interval * float list * float list * float list * float list) + | Cell_inconclusive of (mono_status list list * float list * float list * float list * float list);; + +exception Return of cell_status;; + +type result_tree = + | Result_false of (float list * float list) + | Result_pass of (bool * float list * float list) + | Result_pass_mono of mono_status + | Result_pass_ref of int + | Result_mono of mono_status list * result_tree + (* variable, convex_flag, r1, r2 *) + | Result_glue of (int * bool * result_tree * result_tree);; + +type p_status = { + pp : int; +};; + +type p_result_tree = + | P_result_pass of p_status * bool + | P_result_mono of p_status * mono_status list * p_result_tree + | P_result_glue of p_status * int * bool * p_result_tree * p_result_tree + | P_result_ref of int;; + +let rec result_size r = + match r with + | Result_false _ -> failwith "False result detected" + | Result_mono (_,r1) -> result_size r1 + | Result_glue (_, _, r1, r2) -> result_size r1 + result_size r2 + | Result_pass_mono _ -> 1 + | Result_pass _ -> 1 + | _ -> 0;; + +let rec p_result_size r = + match r with + | P_result_pass _ -> 1 + | P_result_mono (_, _, r1) -> p_result_size r1 + | P_result_glue (_, _, _, r1, r2) -> p_result_size r1 + p_result_size r2 + | _ -> 0;; + + +let return c = raise (Return c);; + + +(* error checking and reporting functions *) + +let string_of_domain x = + let n = mth in + Printf.sprintf "{%f, %f, %f, %f, %f, %f, %f, %f}" (n x 0) (n x 1) (n x 2) (n x 3) (n x 4) (n x 5) (n x 6) (n x 7);; + +let string3 (x,z,s) = (string_of_domain x ^"\n"^ string_of_domain z ^ "\n" ^ s);; + +let boolify _ = true;; + +let report_current = boolify o Report.report_timed o string3;; + +let report_error = boolify o Report.report_error o string3;; + +let report_fatal = boolify o Report.report_fatal o string3;; + +(* let t = [0.1;0.2;0.3;0.4;0.5;0.6] in report_error (t,t,"ok");; *) + +let periodic_count = + let end_count = ref 0 in + fun () -> + let _ = end_count := !end_count + 1 in + (0 = ( !end_count mod 1000));; + +let check_limit opt depth = + let _ = opt.iteration_count <- opt.iteration_count + 1 in + ( opt.iteration_count < opt.iteration_limit or opt.iteration_limit = 0 ) && + (depth < opt.recursion_depth);; + +let sgn x = if (x.lo > 0.0) then 1 else if (x.hi < 0.0) then -1 else 0;; + +let rec same_sgn x y = (x = []) or (sgn (hd x) = sgn (hd y) && same_sgn (tl x) (tl y));; + + +(* has_monotone *) + +let rec has_monotone opt tf ti domain0 x z x0 z0 is found = match is with + | [] -> (x,z,x0,z0,List.rev found) + | j::js when (mth x j >= mth z j) -> + has_monotone opt tf ti domain0 x z x0 z0 js found + | j::js -> + let df_int = + if opt.raw_int_flag then + try evalf0 tf (j + 1) (fst domain0) (snd domain0) + with Unstable -> mk_interval (-1.0,1.0) + else + mk_interval (-1.0, 1.0) in + let allpos_df0, allpos_ti = df_int.lo >= opt.eps, lower_partial ti j >= opt.eps in + let allneg_df0, allneg_ti = df_int.hi < ~-.(opt.eps), upper_partial ti j < ~-.(opt.eps) in + if (allpos_df0 or allpos_ti) then + let status = + {variable = j + 1; decr_flag = false; df0_flag = allpos_df0; ti_flag = allpos_ti} in + if opt.mono_pass && mth z j < mth z0 j then return (Cell_pass_mono ([], status)) + else + let setj u = table (fun i -> (if i=j then mth z j else mth u i)) in + has_monotone opt tf ti domain0 (setj x) (setj z) + (setj x0) (setj z0) js (status :: found) + else if (allneg_df0 or allneg_ti) then + let status = + {variable = j + 1; decr_flag = true; df0_flag = allneg_df0; ti_flag = allneg_ti} in + if opt.mono_pass && mth x j > mth x0 j then return (Cell_pass_mono ([], status)) + else + let setj u = table (fun i -> (if i=j then mth x j else mth u i)) in + has_monotone opt tf ti domain0 (setj x) (setj z) + (setj x0) (setj z0) js (status :: found) + else has_monotone opt tf ti domain0 x z x0 z0 js found;; + +(* loop as long as monotonicity keeps making progress. *) + +let rec going_strong(x,z,x0,z0,tf,opt,mono) = + let (y,w) = center_form (x,z) in + let maxwidth = maxl w in + let target0 = + if opt.raw_int_flag then + try evalf0 tf 0 x z with Unstable -> one + else + one in + let _ = target0.hi >= ~-.(opt.eps) or return (Cell_pass (mono, true)) in + let target = + try evalf tf x z with Unstable -> return (Cell_inconclusive (mono,x,z,x0,z0)) in + let _ = upper_bound target >= ~-.(opt.eps) or return (Cell_pass (mono, false)) in + let _ = lower_bound target < 0.0 or return Cell_counterexample in + let epsilon_width = 1.0e-8 in + let _ = (maxwidth >= epsilon_width) or return Cell_counterexample in + let (x,z,x0,z0,strong) = + if (opt.allow_derivatives) then + try + has_monotone opt tf target (x,z) x z x0 z0 iter8 [] + with Return (Cell_pass_mono (_, status)) -> return (Cell_pass_mono (mono, status)) + else (x,z,x0,z0,[]) in + if (strong <> []) then + going_strong(x,z,x0,z0,tf,opt,mono @ [strong]) + else + (target,x,z,x0,z0,maxwidth,mono);; + + +(* +This procedure is mostly guided by heuristics that don't require formal +verification. In particular, no justification is required for tossing out inequalities +(since they appear as disjuncts, we can choose which one to prove). + +Formal verification is required whenever a Cell_passes is issued, +and whenever the domain (x,z) is restricted. + +The record (x0,z0) of the current outer boundary must be restricted to (x,z) +whenever an inequality is tossed out. +*) + +let rec verify_cell (x,z,x0,z0,tf,opt) = + try ( + let _ = not(periodic_count () && !info_print_level >= 2) or report_current (x,z,"periodic report") in + let (ti,x,z,x0,z0,maxwidth,mono) = going_strong(x,z,x0,z0,tf,opt,[]) in + if opt.convex_flag then + Cell_inconclusive_ti (mono,ti,x,z,x0,z0) + else + Cell_inconclusive (mono,x,z,x0,z0) + ) + with Return c -> c;; + +let recursive_verifier (x,z,x0,z0,tf,opt) = + let w_init, indices = unzip (filter (fun p -> fst p > 1e-8) (zip (map2 (-.) z x) (1--length x))) in + let ws = map2 (-.) z x in + let total_vol = itlist ( *. ) w_init 1.0 in + let verified_vol = ref 0.0 in + let last_report = ref 0 in + let compute_vol x z w = + let rec compute i indices x z w = + match indices with + | [] -> 1.0 + | (r :: t) when r = i -> + let l = hd z -. hd x in + (if l > 1e-8 then l else hd w) *. compute (i + 1) t (tl x) (tl z) (tl w) + | _ -> compute (i + 1) indices (tl x) (tl z) (tl w) in + compute 1 indices x z w in + let update_verified_vol x z w = + if !info_print_level > 0 then + let _ = verified_vol := !verified_vol +. compute_vol x z w in + let verified = int_of_float (!verified_vol /. total_vol *. 100.5) in + if verified > !last_report then + let _ = last_report := verified in report0 (sprintf "%d " !last_report) else () + else () in + + let rec rec_verifier (depth,x,z,x0,z0,w0,tf) = + let _ = check_limit opt depth or report_fatal(x,z,Printf.sprintf "depth %d" depth) in + let split_and_verify j x z x0 z0 convex_flag = + let ( ++ ), ( / ) = up(); upadd, updiv in + let yj = (mth x j ++ mth z j) / 2.0 in + let delta b v = table (fun i-> if (i = j && b) then yj else mth v i) in + let x1, z1 = + if convex_flag then + x, table (fun i -> if i = j then mth x i else mth z i) + else + delta false x, delta true z in + let x2, z2 = + if convex_flag then + table (fun i -> if i = j then mth z i else mth x i), z + else + delta true x, delta false z in + let w1 = table (fun i -> if i = j then mth w0 i / 2.0 else mth w0 i) in + let r1 = rec_verifier(depth+1,x1,z1,x0,z0,w1,tf) in + match r1 with + | Result_false t -> Result_false t + | _ -> + (let r2 = rec_verifier(depth+1,x2,z2,x0,z0,w1,tf) in + match r2 with + | Result_false t -> Result_false t + | _ -> Result_glue (j, convex_flag, r1, r2)) in + + let add_mono mono r1 = + itlist (fun m r -> Result_mono (m, r)) mono r1 in + + match verify_cell(x,z,x0,z0,tf,opt) with + | Cell_counterexample -> Result_false (x,z) + | Cell_pass (mono, f0_flag) -> + let _ = update_verified_vol x z w0 in + add_mono mono (Result_pass (f0_flag,x,z)) + | Cell_pass_mono (mono, status) -> + let _ = update_verified_vol x z w0 in + add_mono mono (Result_pass_mono status) + | Cell_inconclusive_ti(mono,ti,x,z,x0,z0) -> + let dds = map (fun i -> mth (mth ti.dd i) i, i) iter8 in + let convex_dds = filter (fun dd, i -> dd.lo >= opt.eps && mth x i < mth z i) dds in + let convex_i = map snd convex_dds in + let w2 = List.map2 upsub z x in + let convex_flag, ws, ws_i = + if convex_dds = [] then + false, w2, iter8 + else + true, map (mth w2) convex_i, convex_i in + let maxwidth2 = maxl ws in + let j_wide = try( find (fun i -> mth w2 i = maxwidth2) ws_i) with + | _ -> failwith "recursive_verifier find" in + add_mono mono (split_and_verify j_wide x z x0 z0 convex_flag) + + | Cell_inconclusive(mono,x,z,x0,z0) -> + let w2 = List.map2 upsub z x in + let maxwidth2 = maxl w2 in + let j_wide = try( find (fun i -> mth w2 i = maxwidth2) iter8) with + | _ -> failwith "recursive_verifier find" in + add_mono mono (split_and_verify j_wide x z x0 z0 false) in + + rec_verifier (0,x,z,x0,z0,ws,tf);; + + + + end;; diff --git a/formal_ineqs/verifier/interval_m/recurse0.ml b/formal_ineqs/verifier/interval_m/recurse0.ml new file mode 100644 index 0000000..a512049 --- /dev/null +++ b/formal_ineqs/verifier/interval_m/recurse0.ml @@ -0,0 +1,152 @@ +(* ============================================================= *) +(* OCaml verification procedure (basic interval arithmetic only) *) +(* Authors: Thomas C. Hales, Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* ============================================================= *) + +(* Recursive verification of inequalities using the basic interval arithmetic only *) + +needs "verifier/interval_m/recurse.ml";; + +module Recurse0 = struct + +open Interval_types;; +open Interval;; +open Univariate;; +open Line_interval;; +open Taylor;; +open Recurse;; + + + +(* has_monotone *) + +let rec has_monotone0 opt tf domain0 x z x0 z0 is found = match is with + | [] -> (x,z,x0,z0,List.rev found) + | j::js when (mth x j >= mth z j) -> + has_monotone0 opt tf domain0 x z x0 z0 js found + | j::js -> + let df_int = try evalf0 tf (j + 1) (fst domain0) (snd domain0) with Unstable -> mk_interval (-1.0,1.0) in + let allpos_df0 = df_int.lo >= opt.eps in + let allneg_df0 = df_int.hi < ~-.(opt.eps) in + if allpos_df0 then + let status = + {variable = j + 1; decr_flag = false; df0_flag = allpos_df0; ti_flag = false} in + if opt.mono_pass && mth z j < mth z0 j then return (Cell_pass_mono ([], status)) + else + let setj u = table (fun i -> (if i=j then mth z j else mth u i)) in + has_monotone0 opt tf domain0 (setj x) (setj z) + (setj x0) (setj z0) js (status :: found) + else if allneg_df0 then + let status = + {variable = j + 1; decr_flag = true; df0_flag = allneg_df0; ti_flag = false} in + if opt.mono_pass && mth x j > mth x0 j then return (Cell_pass_mono ([], status)) + else + let setj u = table (fun i -> (if i=j then mth x j else mth u i)) in + has_monotone0 opt tf domain0 (setj x) (setj z) + (setj x0) (setj z0) js (status :: found) + else has_monotone0 opt tf domain0 x z x0 z0 js found;; + +(* loop as long as monotonicity keeps making progress. *) + +let rec going_strong0(x,z,x0,z0,tf,opt,mono) = + let (y,w) = center_form (x,z) in + let maxwidth = maxl w in + let target0 = try evalf0 tf 0 x z with Unstable -> return (Cell_inconclusive (mono,x,z,x0,z0)) in + let _ = target0.hi >= ~-.(opt.eps) or return (Cell_pass (mono, true)) in + let epsilon_width = 1.0e-8 in + let _ = (maxwidth >= epsilon_width) or return Cell_counterexample in + let (x,z,x0,z0,strong) = + if (opt.allow_derivatives) then + try + has_monotone0 opt tf (x,z) x z x0 z0 iter8 [] + with Return (Cell_pass_mono (_, status)) -> return (Cell_pass_mono (mono, status)) + else (x,z,x0,z0,[]) in + if (strong <> []) then + going_strong0(x,z,x0,z0,tf,opt,mono @ [strong]) + else + (x,z,x0,z0,maxwidth,mono);; + + +(* +This procedure is mostly guided by heuristics that don't require formal +verification. In particular, no justification is required for tossing out inequalities +(since they appear as disjuncts, we can choose which one to prove). + +Formal verification is required whenever a Cell_passes is issued, +and whenever the domain (x,z) is restricted. + +The record (x0,z0) of the current outer boundary must be restricted to (x,z) +whenever an inequality is tossed out. +*) + +let rec verify_cell0 (x,z,x0,z0,tf,opt) = + try ( + let _ = not(periodic_count ()) or report_current (x,z,"periodic report") in + let (x,z,x0,z0,maxwidth,mono) = going_strong0(x,z,x0,z0,tf,opt,[]) in + if opt.convex_flag then + let ti = try evalf tf x z with Unstable -> return (Cell_inconclusive (mono,x,z,x0,z0)) in + Cell_inconclusive_ti (mono,ti,x,z,x0,z0) + else + Cell_inconclusive (mono,x,z,x0,z0) + ) + with Return c -> c;; + +let rec recursive_verifier0 (depth,x,z,x0,z0,tf,opt) = + let _ = check_limit opt depth or report_fatal(x,z,Printf.sprintf "depth %d" depth) in + let split_and_verify j x z x0 z0 convex_flag = + let ( ++ ), ( / ) = up(); upadd, updiv in + let yj = (mth x j ++ mth z j) / 2.0 in + let delta b v = table (fun i-> if (i = j && b) then yj else mth v i) in + let x1, z1 = + if convex_flag then + x, table (fun i -> if i = j then mth x i else mth z i) + else + delta false x, delta true z in + let x2, z2 = + if convex_flag then + table (fun i -> if i = j then mth z i else mth x i), z + else + delta true x, delta false z in + let r1 = recursive_verifier0(depth+1,x1,z1,x0,z0,tf,opt) in + match r1 with + | Result_false t -> Result_false t + | _ -> + (let r2 = recursive_verifier0(depth+1,x2,z2,x0,z0,tf,opt) in + match r2 with + | Result_false t -> Result_false t + | _ -> Result_glue (j, convex_flag, r1, r2)) in + + let add_mono mono r1 = + itlist (fun m r -> Result_mono (m, r)) mono r1 in + + + match verify_cell0(x,z,x0,z0,tf,opt) with + | Cell_counterexample -> Result_false (x,z) + | Cell_pass (mono, f0_flag) -> add_mono mono (Result_pass (f0_flag,x,z)) + | Cell_pass_mono (mono, status) -> add_mono mono (Result_pass_mono status) + | Cell_inconclusive_ti(mono,ti,x,z,x0,z0) -> + let dds = map (fun i -> mth (mth ti.dd i) i, i) iter8 in + let convex_dds = filter (fun dd, i -> dd.lo >= opt.eps && mth x i < mth z i) dds in + let convex_i = map snd convex_dds in + let w2 = List.map2 upsub z x in + let convex_flag, ws, ws_i = + if convex_dds = [] then + false, w2, iter8 + else + true, map (mth w2) convex_i, convex_i in + let maxwidth2 = maxl ws in + let j_wide = try( find (fun i -> mth w2 i = maxwidth2) ws_i) with + | _ -> failwith "recursive_verifier find" in + add_mono mono (split_and_verify j_wide x z x0 z0 convex_flag) + + | Cell_inconclusive(mono,x,z,x0,z0) -> + let w2 = List.map2 upsub z x in + let maxwidth2 = maxl w2 in + let j_wide = try( find (fun i -> mth w2 i = maxwidth2) iter8) with + | _ -> failwith "recursive_verifier find" in + add_mono mono (split_and_verify j_wide x z x0 z0 false);; + + + + end;; diff --git a/formal_ineqs/verifier/interval_m/report.ml b/formal_ineqs/verifier/interval_m/report.ml new file mode 100644 index 0000000..5ef51f5 --- /dev/null +++ b/formal_ineqs/verifier/interval_m/report.ml @@ -0,0 +1,50 @@ +(* =========================================================== *) +(* Report functions *) +(* Author: Thomas C. Hales *) +(* Date: 2011-08-21 *) +(* =========================================================== *) + +(* port of error.cc + basic procedures to print messages to the standard output + and to count errors. + +*) + +needs "verifier/interval_m/types.ml";; + +module Report = struct + +open Interval_types;; + +let time_string () = Printf.sprintf "time(%.0f)" (Sys.time());; + +let (get_error_count,reset_error_count,inc_error_count) = + let error_count = ref 0 in + ((fun _ -> !error_count),(fun _ -> error_count := 0), + (fun _ -> error_count:= !error_count + 1));; + +let (get_corner_count,reset_corner_count,inc_corner_count) = + let corner_count = ref 0 in + ((fun _ -> !corner_count),(fun _ -> corner_count := 0), + (fun _ -> corner_count:= !corner_count + 1));; + +let diagnostic_string () = + let d = get_error_count() in + if (d>0) then Printf.sprintf "(errors %d)" (get_error_count()) else "(no errors)";; + +let report s = + Format.print_string s; Format.print_newline(); Format.print_flush();; + +let report_timed s = report (s^" "^(time_string()));; + +let report_error = + let error_max = 25 in (* was 200, recurse.cc had a separate counter limit at 25 *) + fun s -> + let ec = get_error_count() in + (inc_error_count(); report_timed (Printf.sprintf "error(%d) --\n%s" ec s); + Pervasives.ignore(get_error_count() < error_max or raise Fatal));; + +let report_fatal s = + ( inc_error_count(); report_timed ("error --\n"^s); raise Fatal);; + +end;; diff --git a/formal_ineqs/verifier/interval_m/taylor.ml b/formal_ineqs/verifier/interval_m/taylor.ml new file mode 100644 index 0000000..460a0c1 --- /dev/null +++ b/formal_ineqs/verifier/interval_m/taylor.ml @@ -0,0 +1,376 @@ +(* =========================================================== *) +(* OCaml taylor intervals *) +(* Author: Thomas C. Hales *) +(* Date: 2011-08-21 *) +(* Modified: Alexey Solovyev, 2012-10-27 *) +(* =========================================================== *) + +(* port of taylor functions, taylor interval *) + +(* +The first part of the file implements basic operations on type taylor_interval. + +Then a type tfunction is defined that represents a twice continuously +differentiable function of six variables. It can be evaluated, which +is the taylor_interval data associated with it. + +Sometimes a tfunction f is used to represent an inequality f < 0. +(See recurse.hl. +*) + +needs "verifier/interval_m/line_interval.ml";; +needs "verifier/interval_m/univariate.ml";; + +module Taylor = struct + +open Interval_types;; +open Interval;; +open Univariate;; +open Line_interval;; + + +(* general utilities *) + +let m8_sum = + let ( + ) = iadd in + fun dd1 dd2 -> + let r8_sum (x,y) = table (fun i -> mth x i + mth y i) in + map r8_sum (zip dd1 dd2);; + +let center_form(x,z) = + let ( + ) , ( - ), ( / ) = up(); upadd,upsub,updiv in + let y = table (fun i -> if (mth x i=mth z i) then mth x i else (mth x i + mth z i)/ 2.0) in + let w = table (fun i -> max (mth z i - mth y i) (mth y i - mth x i)) in + let _ = (minl w >= 0.0) or failwith "centerform" in + (y,w);; + +(* start with taylor interval operations *) + +let make_taylor_interval (l1,w1,dd1) = {l = l1; w = w1; dd=dd1;};; + +let ti_add (ti1,ti2) = + let _ = (ti1.w = ti2.w) or failwith ("width mismatch in ti") in + make_taylor_interval( ladd ti1.l ti2.l,ti1.w, m8_sum ti1.dd ti2.dd);; + +let ti_scale (ti,t) = + make_taylor_interval( smul ti.l t,ti.w, table2 (fun i j -> imul (mth2 ti.dd i j) t));; + + + +let taylor_error ti = + let ( + ), ( * ) , ( / )= up(); upadd, upmul, updiv in + let dot_abs_row r = List.fold_left2 (fun a b c -> a + b * iabs c) 0.0 ti.w r in + let dots = map dot_abs_row (ti.dd) in + (List.fold_left2 (fun a b c -> a + b * c) 0.0 ti.w dots) / 2.0;; +(* (end_itlist ( + ) p) / 2.0 ;; *) + +let upper_bound ti = + let e = taylor_error ti in + let ( + ), ( * ) = up(); upadd, upmul in + let t = ti.l.f.hi + e in + t + List.fold_left2 (fun a b c -> a + b * iabs c) 0.0 ti.w ti.l.df;; + +let lower_bound ti = + let e = taylor_error ti in + let ( + ), ( * ),(- ) = down(); downadd,downmul,downsub in + let t = ti.l.f.lo - e in + t + List.fold_left2 (fun a b c -> a + ( ~-. b) * iabs c) 0.0 ti.w ti.l.df;; + +let upper_partial ti i = + let ( + ), ( * ) = up(); upadd,upmul in + let err = List.fold_left2 (fun a b c -> a + b*(max c.hi (~-. (c.lo)))) + 0.0 ti.w (mth ti.dd i) in + err + Interval.sup ( mth ti.l.df i);; + +let lower_partial ti i = + let ( + ), ( * ), ( - ) = down();downadd,downmul,downsub in + let err = List.fold_left2 (fun a b c -> a + b * min c.lo (~-. (c.hi))) + 0.0 ti.w (mth ti.dd i) in + Interval.inf ( mth ti.l.df i) + err;; + + +let ti_mul (ti1,ti2) = + let _ = (ti1.w = ti2.w) or failwith ("ti_mul: width mismatch in ti") in + let line = lmul ti1.l ti2.l in + let f1_int = + let lo, hi = lower_bound ti1, upper_bound ti1 in mk_interval (lo, hi) in + let f2_int = + let lo, hi = lower_bound ti2, upper_bound ti2 in mk_interval (lo, hi) in + let d1_ints = table (fun i -> mk_interval (lower_partial ti1 i, upper_partial ti1 i)) in + let d2_ints = table (fun i -> mk_interval (lower_partial ti2 i, upper_partial ti2 i)) in + let dd = table2 (fun i j -> + let ( + ), ( * ) = iadd, imul in + mth2 ti1.dd i j * f2_int + mth d1_ints i * mth d2_ints j + + mth d1_ints j * mth d2_ints i + f1_int * mth2 ti2.dd i j) in + make_taylor_interval(line, ti1.w, dd);; + + + +(* primitive A *) + +type primitiveA = { + f_df : int -> float list -> float list -> interval; + hfn : float list -> line; + second : float list -> float list -> interval list list; +};; + +let make_primitiveA (f,h1,s1) = {f_df = f; hfn = h1; second = s1; };; + +let unitA = + let zero2 = table2 (fun i j -> zero) in + make_primitiveA ( + (fun i x z -> if i = 0 then one else zero), + (fun y -> line_unit), + (fun x z -> zero2) +);; + +let evalf4A pA w x y z = + make_taylor_interval( + pA.hfn y, + w, + pA.second x z + );; + +let line_estimateA pA y = pA.hfn y;; + +(* primitive U *) + +type primitiveU = { + slot: int; + uv: univariate; +};; + +let mk_primitiveU s1 uv1 = + let _ = (s1 < 8) or failwith (Printf.sprintf "slot %d" s1) in + { slot = s1; uv = uv1; };; + +let line_estimateU p y = + let y0 = mth y p.slot in + let t = mk_interval(y0,y0) in + let d = table (fun i -> if (i=p.slot) then eval p.uv t 1 else zero) in + mk_line ( eval p.uv t 0, d );; + +let evalf4U = + let row0 = table (fun i -> zero) in + fun p w x y z -> + let t = mk_interval(mth x p.slot,mth z p.slot) in + let row_slot = table (fun i -> if (i=p.slot) then eval p.uv t 2 else zero) in + let dd = table (fun i -> if (i=p.slot) then row_slot else row0) in + make_taylor_interval( + line_estimateU p y, + w, + dd + );; + +type tfunction = + | Prim_a of primitiveA + | Uni of primitiveU + | Plus of tfunction * tfunction + | Product of tfunction * tfunction + | Scale of tfunction * interval + | Uni_compose of univariate * tfunction + | Composite of tfunction * (* F(g1,g2,g3,g4,g5,g6,g7,g8) *) + tfunction *tfunction *tfunction * + tfunction *tfunction *tfunction * + tfunction *tfunction;; + +let unit = Prim_a unitA;; + +let x1 = Uni (mk_primitiveU 0 ux1);; +let x2 = Uni (mk_primitiveU 1 ux1);; +let x3 = Uni (mk_primitiveU 2 ux1);; +let x4 = Uni (mk_primitiveU 3 ux1);; +let x5 = Uni (mk_primitiveU 4 ux1);; +let x6 = Uni (mk_primitiveU 5 ux1);; + + +let x1x2 = + let tab2 = table2 (fun i j -> if (i+j=1) then one else zero) in + Prim_a (make_primitiveA( + (fun i x z -> + let x1 = mk_interval (mth x 0, mth z 0) in + let x2 = mk_interval (mth x 1, mth z 1) in + if i = 0 then imul x1 x2 + else if i = 1 then x2 + else if i = 2 then x1 + else zero), + (fun y -> + let u1 = mth y 0 in + let u2 = mth y 1 in + let x1 = mk_interval(u1,u1) in + let x2 = mk_interval(u2,u2) in + mk_line( + imul x1 x2, + table (fun i -> if i=0 then x2 else if i=1 then x1 else zero) + )), + (fun x z -> tab2)));; + +let tf_product tf1 tf2 = Composite(x1x2,tf1,tf2,unit,unit,unit,unit,unit,unit);; + + +(* This is one of the most difficult functions in the interval code. + It uses the chain rule to compute the second partial derivatives with + respect to x(i) x(j), of a function composition + + F(x1,...,x6) = f(g1(x1,...x6),g2(x1,...x6),...,g6(x1,...x6)). + + (F i j) = sum {k m} (f k m) (gk i) (gm j) + sum {r} (f r) (gr i j). + + Fast performance of this function is very important, especially + when many of the functions g* are constant. + There is a bit of imperative programming here, in computing the sums. + + Note that ( + ) and ( * ) have different types in various subsections. +*) + +let eval_composite = + let rest = () in + let sparse_table h f = filter h (List.flatten (table2 f)) in + fun hdr p1 p2 p3 p4 p5 p6 p7 p8 w -> + let p = [p1;p2;p3;p4;p5;p6;p7;p8] in + (* wide and narrow ranges of p *) + let (aw,bw) = map (lower_bound) p, map (upper_bound) p in + let (a,b) = map (fun p -> p.l.f.lo) p, map (fun p -> p.l.f.hi) p in + (* wide and narrow widths from a to b *) + let (u,wu,wf) = + let ( + ),( - ),( / ) = up();upadd,upsub,updiv in + let u = table (fun i -> (mth a i + mth b i) / 2.0) in + let wu = table (fun i -> max (mth bw i - mth u i) (mth u i - mth aw i)) in + let wf = table (fun i -> max (mth b i - mth u i) (mth u i - mth a i)) in + (u,wu,wf) in + let (fu:taylor_interval) = hdr wu aw u bw in + let fpy = + let t = make_taylor_interval(fu.l,wf,fu.dd) in + mk_line ( + mk_interval(lower_bound t, upper_bound t), + table (fun i -> mk_interval(lower_partial t i,upper_partial t i)) ) in + (* use chain rule imperatively to compute narrow first derivative *) + let df_tmp = Array.create 8 zero in + let ( + ) = iadd in + let ( * ) = imul in + let _ = for j=0 to 7 do + let dfj = mth fpy.df j in + if is_zero dfj then rest + else for i=0 to 7 do + let r = mth (mth p j).l.df i in + if (is_zero r) then rest else df_tmp.(i) <- df_tmp.(i) + dfj * r; + done; + done in + let lin = mk_line ( fpy.f, Array.to_list df_tmp ) in + (* second derivative init *) + let fW_partial = table (fun i -> mk_interval(lower_partial fu i,upper_partial fu i)) in + let pW_partial = sparse_table (fun (_,_,z) ->not (is_zero z)) + (fun k i -> (k,i,(mk_interval(lower_partial (mth p k) i,upper_partial (mth p k) i)))) in + (* chain rule 4-nested loop!, but flattened with sparse table *) + let dcw = Array.make_matrix 8 8 zero in + let _ = for i=0 to 7 do for j=0 to 7 do for k=0 to 7 do + if (is_zero (mth2 (mth p k).dd i j)) then rest + else dcw.(i).(j) <- dcw.(i).(j) + mth fW_partial k * mth2 ((mth p k).dd) i j ; + done; done; done in + let len = List.length pW_partial in + let _ = for ki = 0 to len-1 do + let (k,i,rki) = List.nth pW_partial ki in + for mj=0 to len-1 do + let (m,j,rmj) = List.nth pW_partial mj in +(* Report.report (Printf.sprintf "k i m j rki rmj fuddkm = %d %d %d %d %f %f %f" k i m j rki.lo rmj.lo (mth2 fu.dd k m).lo); *) + dcw.(i).(j) <- dcw.(i).(j) + mth2 fu.dd k m * rki * rmj; (* innermost loop *) + done; done in + let dcw_list = map Array.to_list (Array.to_list dcw) in + make_taylor_interval(lin,w,dcw_list);; + +let rec evalf4 tf w x y z = match tf with + | Prim_a p -> evalf4A p w x y z + | Uni p -> evalf4U p w x y z + | Plus (tf1,tf2) -> ti_add(evalf4 tf1 w x y z, evalf4 tf2 w x y z) + | Product (tf1,tf2) -> ti_mul(evalf4 tf1 w x y z, evalf4 tf2 w x y z) + | Composite(h,g1,g2,g3,g4,g5,g6,g7,g8) -> + let [p1;p2;p3;p4;p5;p6;p7;p8] = map (fun t-> evalf4 t w x y z) [g1;g2;g3;g4;g5;g6;g7;g8] in + eval_composite (evalf4 h) p1 p2 p3 p4 p5 p6 p7 p8 w + | Scale (tf,t) -> ti_scale ((evalf4 tf w x y z),t) + | Uni_compose (uf,tf) -> + let ti = evalf4 tf w x y z in + let fy = ti.l.f in + let u_fy = uf.u fy in + let du_fy = uf.du fy in + let line = + let ( * ) = imul in + mk_line (u_fy, table (fun i -> du_fy * mth ti.l.df i)) in + let fx = mk_interval (lower_bound ti, upper_bound ti) in + let dfx = table (fun i -> mk_interval (lower_partial ti i, upper_partial ti i)) in + let du_fx = uf.du fx in + let ddu_fx = uf.ddu fx in + let dd = table2 (fun i j -> + let ( + ), ( * ) = iadd, imul in + (ddu_fx * mth dfx j) * mth dfx i + du_fx * mth2 ti.dd j i) in + make_taylor_interval(line, w, dd);; + + + +(* evalf4 (Composite(Uni (mk_primitiveU 0 uf),tf,unit,unit,unit,unit,unit,unit,unit)) w x y z;; *) + +let evalf tf x z = + let (y,w) = center_form (x,z) in + evalf4 tf w x y z;; + + +(* Evaluates a function (i = 0) and its first derivatives (i = 1, 2, ...) at the given interval *) +let rec evalf0 tf i x z = match tf with + | Prim_a p -> p.f_df i x z + | Uni p -> + let int = mk_interval (mth x p.slot, mth z p.slot) in + if i = 0 then eval p.uv int 0 + else if i = p.slot + 1 then eval p.uv int 1 + else zero + | Plus (tf1, tf2) -> iadd (evalf0 tf1 i x z) (evalf0 tf2 i x z) + | Product (tf1, tf2) -> + let itf1, itf2 = evalf0 tf1 0 x z, evalf0 tf2 0 x z in + if i = 0 then imul itf1 itf2 + else + let i_df1, i_df2 = evalf0 tf1 i x z, evalf0 tf2 i x z in + iadd (imul i_df1 itf2) (imul itf1 i_df2) + | Scale (tf, t) -> imul (evalf0 tf i x z) t + | Uni_compose (uf, tf) -> + let itf = evalf0 tf 0 x z in + if i = 0 then eval uf itf 0 + else + let i_df = evalf0 tf i x z in + imul (eval uf itf 1) i_df + | Composite (h,g1,g2,g3,g4,g5,g6,g7,g8) -> + let gs = [g1;g2;g3;g4;g5;g6;g7;g8] in + let ps = map (fun t -> let int = evalf0 t 0 x z in int.lo, int.hi) gs in + let x', z' = unzip ps in + if i = 0 then evalf0 h 0 x' z' + else + let dhs = table (fun j -> evalf0 h (j + 1) x' z') in + let dgs = map (fun t -> evalf0 t i x z) gs in + let ( + ), ( * ) = iadd, imul in + itlist2 (fun a b c -> a * b + c) dhs dgs zero;; + + +(* +let line_estimate_composite = + let ( + ) = iadd in + let ( * ) = imul in + fun h p1 p2 p3 p4 p5 p6 p7 p8 -> + let p = [p1;p2;p3;p4;p5;p6;p7;p8] in + let (a,b) = map (fun p -> p.f.lo) p, map (fun p -> p.f.hi) p in + let fN = evalf h a b in + let fN_partial = table (fun i -> mk_interval(lower_partial fN i,upper_partial fN i)) in + let pN_partial =table2(fun i j-> (mth (mth p i).df j)) in + let cN_partial2 = table2 (fun i j -> mth fN_partial j * mth2 pN_partial j i) in + let cN_partial = map (end_itlist ( + )) cN_partial2 in + mk_line ( fN.l.f, cN_partial );; + +let rec line_estimate tf y = match tf with + | Prim_a p -> line_estimateA p y + | Uni p -> line_estimateU p y + | Plus (p,q) -> ladd (line_estimate p y) (line_estimate q y) + | Scale (p,t) -> smul (line_estimate p y) t + | Uni_compose (uf,tf) -> + line_estimate (Composite(Uni { slot=0; uv=uf; },tf,unit,unit,unit,unit,unit,unit,unit)) y + | Composite(h,g1,g2,g3,g4,g5,g6,g7,g8) -> + let [p1;p2;p3;p4;p5;p6;p7;p8] = map (fun t-> line_estimate t y) [g1;g2;g3;g4;g5;g6;g7;g8] in + line_estimate_composite h p1 p2 p3 p4 p5 p6 p7 p8;; +*) + +end;; diff --git a/formal_ineqs/verifier/interval_m/types.ml b/formal_ineqs/verifier/interval_m/types.ml new file mode 100644 index 0000000..783126a --- /dev/null +++ b/formal_ineqs/verifier/interval_m/types.ml @@ -0,0 +1,52 @@ +(* =========================================================== *) +(* Declaration of types and exceptions *) +(* Author: Thomas C. Hales *) +(* Date: 2011-08-21 *) +(* =========================================================== *) + +module Interval_types = struct + +exception Unstable;; (* generally thrown when there is a divide by zero *) + +exception Fatal;; (* generally indicates an uncorrected bug *) + +(* represents a closed interval [lo,hi] of the real line *) + +type interval = { + lo : float; + hi : float; +};; + +(* represents a function u:real->real, its derivative du, and 2nd derivative *) + +type univariate = { + u : interval -> interval; + du : interval -> interval; + ddu : interval -> interval; +};; + +(* represents the value f of function of six variables at some point y. + and the value df of its six partial derivatives, evaluated at the same point y. + The length of the list df should always be 8. +*) + +type line = { + f : interval; + df : (interval) list; +};; + +(* + represents approximation data for a function f on a rectangular domain [x,z]. + l gives the value and partial derivatives of f at some point y in the domain. + dd gives interval bounds on the second derivatives over the entire domain. + w i is an upper bound on widths (z i - y i) and (y i - x i). +*) + +type taylor_interval = { + l : line; + w : float list; + dd : interval list list; +};; + + +end;; diff --git a/formal_ineqs/verifier/interval_m/univariate.ml b/formal_ineqs/verifier/interval_m/univariate.ml new file mode 100644 index 0000000..7bfb171 --- /dev/null +++ b/formal_ineqs/verifier/interval_m/univariate.ml @@ -0,0 +1,107 @@ +(* =========================================================== *) +(* OCaml univariate functions *) +(* Author: Thomas C. Hales *) +(* Date: 2011-08-21 *) +(* =========================================================== *) + +(* port of univariate.cc + a univariate represents a function u:real->real. + its first derivative du:real->real + and its second derivative ddu;real->real. + + For example, if the function is x |-> x, + its derivative is x |-> 1, + and second derivative is x |-> 0, + which is implemented as ux1. + + We give a few other examples, sqrt, 1/x, atan. + + *) + +needs "verifier/interval_m/interval.ml";; + +module Univariate = struct + +open Interval_types;; +open Interval;; + +let eval uni x = function + | 0 -> uni.u x + | 1 -> uni.du x + | _ -> uni.ddu x;; + +let mk_univariate (u1,du1,ddu1) = { u = u1; du = du1; ddu = ddu1; };; + +let raise_zero x = bounded_from_zero x or raise Unstable ;; + +(* here are a couple of examples *) + +let ux1 = + mk_univariate( + (fun x -> x), + (fun x -> one), + (fun x-> zero) + );; + +let usqrt = + let ( / ) = idiv in + let ( * ) = imul in + mk_univariate( + isqrt, + + (fun x -> + let _ = raise_zero x in + one / (two * isqrt x)), + + (fun x -> + let _ = raise_zero x in + ineg (one / ((two * isqrt x) * (two * x)))) +);; + +let uinv = + let ( / ) = idiv in + let ( * ) = imul in + mk_univariate( + (fun x -> + let _ = raise_zero x in + one / x), + + (fun x -> + let _ = raise_zero x in + ineg (one / ( x * x))), + + (fun x -> + let _ = raise_zero x in + two / ( x * (x * x))) + );; + +let uatan = + let ( / ) = idiv in + let ( * ) = imul in + let ( + ) = iadd in + mk_univariate( + iatan, + + (fun x -> + one / (one + x * x)), + + (fun x -> + let t = one / (one + x * x) in + (ineg two * x) * (t * t)) + );; + + +let uacos = + let ( / ) = idiv in + let ( * ) = imul in + let ( - ) = isub in + mk_univariate( + iacos, + (fun x -> + ineg (one / isqrt (one - x * x))), + (fun x -> + let t = one - x * x in + ineg (x / isqrt (t * t * t))) + );; + +end;; diff --git a/formal_ineqs/verifier/interval_m/verifier.hl b/formal_ineqs/verifier/interval_m/verifier.hl new file mode 100644 index 0000000..24d69e1 --- /dev/null +++ b/formal_ineqs/verifier/interval_m/verifier.hl @@ -0,0 +1,327 @@ +(* =========================================================== *) +(* OCaml verification and result transformation functions *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +needs "verifier/interval_m/recurse.hl";; +(*needs "verifier/interval_m/recurse0.ml";;*) + +module Verifier = struct + +open Interval_types;; +open Interval;; +open Univariate;; +open Line_interval;; +open Taylor;; +open Recurse;; + + +type certificate_stats = +{ + pass : int; + pass_raw : int; + pass_mono : int; + mono : int; + glue : int; + glue_convex : int; +};; + + +let dummy_stats = +{ + pass = 0; pass_raw = 0; pass_mono = 0; + mono = 0; glue = 0; glue_convex = 0; +};; + + +(**********************************) +type run_test_options = { + min_flag : bool; + min_max : float; + allow_d : bool; + allow_convex_flag : bool; + mono_pass_flag : bool; + raw_interval_flag : bool; + epsilon : float; +};; + +let run_test_opt0 = { + min_flag = false; + min_max = 0.0; + allow_d = true; + allow_convex_flag = false; + mono_pass_flag = false; + raw_interval_flag = false; + epsilon = 0.0; +};; + + +let run_test fs x z opt0 = + let pad = replicate 0.0 (8 - length x) in + let xx = x @ pad and zz = z @ pad in + let mone = mk_interval(-1.0,-1.0) in + let neg_fs = map (fun f -> Scale(f, mone)) fs in + let ffs = if opt0.min_flag then + map (fun neg_f -> Plus(neg_f, Scale(unit,mk_interval(opt0.min_max, opt0.min_max)))) neg_fs + else + map (fun f -> Plus(f, Scale(unit, ineg (mk_interval(opt0.min_max, opt0.min_max))))) fs in + let opt = { + only_check_deriv1_negative = false; + is_using_dihmax =false; + is_using_bigface126 =false; + width_cutoff =0.05; + allow_sharp =false; + allow_derivatives = opt0.allow_d; + iteration_count = 0; + iteration_limit = 0; + recursion_depth = 200; + mono_pass = opt0.mono_pass_flag; + convex_flag = opt0.allow_convex_flag; + raw_int_flag = opt0.raw_interval_flag; + eps = opt0.epsilon; + } in + let tfs = map2 (fun f i -> {tf = f; index = i}) ffs (0--(length ffs - 1)) in + recursive_verifier(xx,zz,xx,zz,tfs,opt);; + +(* A verification procedure which uses raw interval arithmetic only *) +(* +open Recurse0;; + +let run_test0 f x z min_flag min_max allow_d convex_flag mono_pass_flag eps = + let pad = replicate 0.0 (8 - length x) in + let xx = x @ pad and zz = z @ pad in + let mone = mk_interval(-1.0,-1.0) in + let neg_f = Scale(f, mone) in + let ff = if min_flag then + Plus(neg_f, Scale(unit,mk_interval(min_max, min_max))) + else + Plus(f, Scale(unit, ineg (mk_interval(min_max, min_max)))) in + let opt = { + only_check_deriv1_negative = false; + is_using_dihmax =false; + is_using_bigface126 =false; + width_cutoff =0.05; + allow_sharp =false; + allow_derivatives =allow_d; + iteration_count =0; + iteration_limit =0; + recursion_depth =200; + mono_pass = mono_pass_flag; + convex_flag = convex_flag; + raw_int_flag = true; + eps = eps; + } in + recursive_verifier0(0,xx,zz,xx,zz,ff,opt);; +*) + + +(****************************************) + +let domain_str x z = + let s1 = map string_of_float x and + s2 = map string_of_float z in + sprintf "[%s], [%s]" (String.concat "; " s1) (String.concat "; " s2);; + +let path_str p = + String.concat "," (map (fun s, j -> sprintf "%s(%d)" s j) p);; + + +(* get_results0 *) +(* This function finds all subtrees of the given solution tree which can be + veified immediately (no Result_pass_mono). These subtrees are added to + the accumulator. Paths to the roots of all subtrees are also saved in + the accumulator. The third returned value is a solution tree where all + found subtrees are replaced with Result_pass_ref j, with j = #of the corresponding + subtree in the accumulator (1-based) *) + + +let get_results0 path r acc = + let dummy_tree = Result_false ([], []) in + let is_ref r = match r with Result_pass_ref _ -> true | _ -> false in + + let rec get_rec path r acc = + match r with + | Result_mono (mono, r1) -> + let get_m m = (if m.decr_flag then "ml" else "mr"), m.variable in + let path' = rev_itlist (fun m l -> get_m m :: l) mono path in + let flag, acc', tree = get_rec path' r1 acc in + if flag then true, acc', dummy_tree + else false, acc', Result_mono (mono, tree) + | Result_glue (j, convex_flag, r1, r2) -> + let s1, s2 = if convex_flag then "ml", "mr" else "l", "r" in + let p1, p2 = ((s1, j + 1) :: path), ((s2, j + 1) :: path) in + let flag1, acc1, tree1 = get_rec p1 r1 acc in + let flag2, acc', tree2 = get_rec p2 r2 acc1 in + let n = (length acc' + 1) in + if flag1 then + if flag2 then + true, acc', dummy_tree + else if is_ref r1 then + false, acc', Result_glue (j, convex_flag, r1, tree2) + else + false, acc' @ [rev p1, r1], Result_glue (j, convex_flag, Result_pass_ref n, tree2) + else + if flag2 then + if is_ref r2 then + false, acc', Result_glue (j, convex_flag, tree1, r2) + else + false, acc' @ [rev p2, r2], Result_glue (j, convex_flag, tree1, Result_pass_ref n) + else + false, acc', Result_glue (j, convex_flag, tree1, tree2) + + | Result_pass_mono _ -> false, acc, r + | _ -> true, acc, dummy_tree in + + get_rec path r acc;; + + + + +(* transform_result *) + + +let transform_result x z r = + (* get_domain *) + (* Subdivides the given domain (x,z) according to the given path *) + let domain_hash = Hashtbl.create 1000 in + let find_hash, mem_hash, add_hash = + Hashtbl.find domain_hash, Hashtbl.mem domain_hash, Hashtbl.add domain_hash in + + let get_domain path = + let n = length x in + let table f = map f (0--(n - 1)) in + let rec rec_domain (x, z) path hash = + match path with + | [] -> x, z + | (s, j) :: ps -> + let hash' = hash^s^(string_of_int j) in + if mem_hash hash' then + rec_domain (find_hash hash') ps hash' + else + let j = j - 1 in + let domain' = + if s = "l" or s = "r" then + let ( ++ ), ( / ) = up(); upadd, updiv in + let yj = (mth x j ++ mth z j) / 2.0 in + let delta b v = table (fun i -> if i = j && b then yj else mth v i) in + if s = "l" then + delta false x, delta true z + else + delta true x, delta false z + else + if s = "ml" then + x, table (fun i -> if i = j then mth x i else mth z i) + else + table (fun i -> if i = j then mth z i else mth x i), z in + let _ = add_hash hash' domain' in + rec_domain domain' ps hash' in + rec_domain (x,z) path "" in + + (* sub_domain *) + (* Verifies if interval [x',z'] SUBSET interval [x,z] *) + let sub_domain (x',z') (x,z) = + let le a b = itlist2 (fun a b c -> c & (a <= b)) a b true in + le x x' & le z' z in + + (* transform_pass_mono *) + (* Replaces all (Result_pass_mono m) with (Result_mono [m] (Result_ref j)) where + j is the reference to the corresponding domain *) + let transform_pass_mono x z domains r = + let domains_i = zip domains (1--length domains) in + + let find_domain x' z' = + try find (fun d, _ -> sub_domain (x', z') d) domains_i with Failure _ -> (x,z), -1 in + + let get_m m = (if m.decr_flag then "ml" else "mr"), m.variable in + + let rec rec_transform path r = + match r with + | Result_mono (mono, r1) -> + let path' = rev_itlist (fun m l -> get_m m :: l) mono path in + Result_mono (mono, rec_transform path' r1) + | Result_glue (j, convex_flag, r1, r2) -> + let s1, s2 = if convex_flag then "ml", "mr" else "l", "r" in + let p1, p2 = ((s1, j + 1) :: path), ((s2, j + 1) :: path) in + let t1 = rec_transform p1 r1 in + let t2 = rec_transform p2 r2 in + Result_glue (j, convex_flag, t1, t2) + | Result_pass_mono m -> + let path' = rev (get_m m :: path) in + let x', z' = get_domain path' in + let _, i = find_domain x' z' in + (* let _ = report (sprintf "p = %s, d = %s, found: %d" + (domain_str x' z') (path_str path') i) in *) + if i >= 0 then Result_mono ([m], Result_pass_ref (-i)) else r + | _ -> r in + + rec_transform [] r in + + let rec transform acc r = + let flag, rs, r' = get_results0 [] r acc in + if flag then (rs @ [[], r]) + else + let domains = map (fun p, _ -> get_domain p) rs in + let r_next = transform_pass_mono x z domains r' in + let _ = r_next <> r' or failwith "transform_result: deadlock" in + transform rs r_next in + transform [] r;; + + +(* Computes result statistics *) + +let result_stats result = + let pass = ref 0 and + mono = ref 0 and + glue = ref 0 and + pass_mono = ref 0 and + pass_raw = ref 0 and + glue_convex = ref 0 in + + let rec count r = + match r with + | Result_false _ -> failwith "False result" + | Result_pass (_, flag) -> + pass := !pass + 1; + if flag then pass_raw := !pass_raw + 1 else () + | Result_pass_mono _ -> pass_mono := !pass_mono + 1 + | Result_pass_ref _ -> () + | Result_mono (_, r1) -> mono := !mono + 1; count r1 + | Result_glue (_, flag, r1, r2) -> + glue := !glue + 1; + if flag then glue_convex := !glue_convex + 1 else (); + count r1; count r2 in + + let _ = count result in + {pass = !pass; pass_raw = !pass_raw; pass_mono = !pass_mono; + mono = !mono; glue = !glue; glue_convex = !glue_convex};; + + +let report_stats stats = + let s = sprintf "pass = %d (pass_raw = %d)\nmono = %d\nglue = %d (glue_convex = %d)\npass_mono = %d" + stats.pass stats.pass_raw stats.mono stats.glue stats.glue_convex stats.pass_mono in + report s;; + + +let result_p_stats glue_flag p_result = + let p_table = Hashtbl.create 10 in + let add1 p = + let c = if Hashtbl.mem p_table p then Hashtbl.find p_table p else 0 in + Hashtbl.replace p_table p (succ c) in + + let rec count r = + match r with + | P_result_ref _ -> () + | P_result_pass (pp, _, _) -> add1 pp.pp + | P_result_mono (pp, _, r1) -> add1 pp.pp; count r1 + | P_result_glue (pp, _, _, r1, r2) -> + if glue_flag then add1 pp.pp else (); + count r1; count r2 in + + let _ = count p_result in + let s = Hashtbl.fold + (fun p c s -> (sprintf "p = %d: %d\n" p c) ^ s) p_table "" in + report s;; + + +end;; diff --git a/formal_ineqs/verifier/interval_m/verifier.ml b/formal_ineqs/verifier/interval_m/verifier.ml new file mode 100644 index 0000000..3e1fff4 --- /dev/null +++ b/formal_ineqs/verifier/interval_m/verifier.ml @@ -0,0 +1,305 @@ +(* =========================================================== *) +(* OCaml verification and result transformation functions *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +needs "verifier/interval_m/recurse.ml";; +needs "verifier/interval_m/recurse0.ml";; + +module Verifier = struct + +open Interval_types;; +open Interval;; +open Univariate;; +open Line_interval;; +open Taylor;; +open Recurse;; + + +type certificate_stats = +{ + pass : int; + pass_raw : int; + pass_mono : int; + mono : int; + glue : int; + glue_convex : int; +};; + + +let dummy_stats = +{ + pass = 0; pass_raw = 0; pass_mono = 0; + mono = 0; glue = 0; glue_convex = 0; +};; + + +(**********************************) +let run_test f x z min_flag min_max allow_d convex_flag mono_pass_flag raw_int_flag eps = + let pad = replicate 0.0 (8 - length x) in + let xx = x @ pad and zz = z @ pad in + let mone = mk_interval(-1.0,-1.0) in + let neg_f = Scale(f, mone) in + let ff = if min_flag then + Plus(neg_f, Scale(unit,mk_interval(min_max, min_max))) + else + Plus(f, Scale(unit, ineg (mk_interval(min_max, min_max)))) in + let opt = { + only_check_deriv1_negative = false; + is_using_dihmax =false; + is_using_bigface126 =false; + width_cutoff =0.05; + allow_sharp =false; + allow_derivatives =allow_d; + iteration_count =0; + iteration_limit =0; + recursion_depth =200; + mono_pass = mono_pass_flag; + convex_flag = convex_flag; + raw_int_flag = raw_int_flag; + eps = eps; + } in + recursive_verifier(xx,zz,xx,zz,ff,opt);; + + +(* A verification procedure which uses raw interval arithmetic only *) +(* +open Recurse0;; + +let run_test0 f x z min_flag min_max allow_d convex_flag mono_pass_flag eps = + let pad = replicate 0.0 (8 - length x) in + let xx = x @ pad and zz = z @ pad in + let mone = mk_interval(-1.0,-1.0) in + let neg_f = Scale(f, mone) in + let ff = if min_flag then + Plus(neg_f, Scale(unit,mk_interval(min_max, min_max))) + else + Plus(f, Scale(unit, ineg (mk_interval(min_max, min_max)))) in + let opt = { + only_check_deriv1_negative = false; + is_using_dihmax =false; + is_using_bigface126 =false; + width_cutoff =0.05; + allow_sharp =false; + allow_derivatives =allow_d; + iteration_count =0; + iteration_limit =0; + recursion_depth =200; + mono_pass = mono_pass_flag; + convex_flag = convex_flag; + raw_int_flag = true; + eps = eps; + } in + recursive_verifier0(0,xx,zz,xx,zz,ff,opt);; +*) + + +(****************************************) + +let domain_str x z = + let s1 = map string_of_float x and + s2 = map string_of_float z in + sprintf "[%s], [%s]" (String.concat "; " s1) (String.concat "; " s2);; + +let path_str p = + String.concat "," (map (fun s, j -> sprintf "%s(%d)" s j) p);; + + +(* get_results0 *) +(* This function finds all subtrees of the given solution tree which can be + veified immediately (no Result_pass_mono). These subtrees are added to + the accumulator. Paths to the roots of all subtrees are also saved in + the accumulator. The third returned value is a solution tree where all + found subtrees are replaced with Result_pass_ref j, with j = #of the corresponding + subtree in the accumulator (1-based) *) + + +let get_results0 path r acc = + let dummy_tree = Result_false ([], []) in + let is_ref r = match r with Result_pass_ref _ -> true | _ -> false in + + let rec get_rec path r acc = + match r with + | Result_mono (mono, r1) -> + let get_m m = (if m.decr_flag then "ml" else "mr"), m.variable in + let path' = rev_itlist (fun m l -> get_m m :: l) mono path in + let flag, acc', tree = get_rec path' r1 acc in + if flag then true, acc', dummy_tree + else false, acc', Result_mono (mono, tree) + | Result_glue (j, convex_flag, r1, r2) -> + let s1, s2 = if convex_flag then "ml", "mr" else "l", "r" in + let p1, p2 = ((s1, j + 1) :: path), ((s2, j + 1) :: path) in + let flag1, acc1, tree1 = get_rec p1 r1 acc in + let flag2, acc', tree2 = get_rec p2 r2 acc1 in + let n = (length acc' + 1) in + if flag1 then + if flag2 then + true, acc', dummy_tree + else if is_ref r1 then + false, acc', Result_glue (j, convex_flag, r1, tree2) + else + false, acc' @ [rev p1, r1], Result_glue (j, convex_flag, Result_pass_ref n, tree2) + else + if flag2 then + if is_ref r2 then + false, acc', Result_glue (j, convex_flag, tree1, r2) + else + false, acc' @ [rev p2, r2], Result_glue (j, convex_flag, tree1, Result_pass_ref n) + else + false, acc', Result_glue (j, convex_flag, tree1, tree2) + + | Result_pass_mono _ -> false, acc, r + | _ -> true, acc, dummy_tree in + + get_rec path r acc;; + + + + +(* transform_result *) + + +let transform_result x z r = + (* get_domain *) + (* Subdivides the given domain (x,z) according to the given path *) + let domain_hash = Hashtbl.create 1000 in + let find_hash, mem_hash, add_hash = + Hashtbl.find domain_hash, Hashtbl.mem domain_hash, Hashtbl.add domain_hash in + + let get_domain path = + let n = length x in + let table f = map f (0--(n - 1)) in + let rec rec_domain (x, z) path hash = + match path with + | [] -> x, z + | (s, j) :: ps -> + let hash' = hash^s^(string_of_int j) in + if mem_hash hash' then + rec_domain (find_hash hash') ps hash' + else + let j = j - 1 in + let domain' = + if s = "l" or s = "r" then + let ( ++ ), ( / ) = up(); upadd, updiv in + let yj = (mth x j ++ mth z j) / 2.0 in + let delta b v = table (fun i -> if i = j && b then yj else mth v i) in + if s = "l" then + delta false x, delta true z + else + delta true x, delta false z + else + if s = "ml" then + x, table (fun i -> if i = j then mth x i else mth z i) + else + table (fun i -> if i = j then mth z i else mth x i), z in + let _ = add_hash hash' domain' in + rec_domain domain' ps hash' in + rec_domain (x,z) path "" in + + (* sub_domain *) + (* Verifies if interval [x',z'] SUBSET interval [x,z] *) + let sub_domain (x',z') (x,z) = + let le a b = itlist2 (fun a b c -> c & (a <= b)) a b true in + le x x' & le z' z in + + (* transform_pass_mono *) + (* Replaces all (Result_pass_mono m) with (Result_mono [m] (Result_ref j)) where + j is the reference to the corresponding domain *) + let transform_pass_mono x z domains r = + let domains_i = zip domains (1--length domains) in + + let find_domain x' z' = + try find (fun d, _ -> sub_domain (x', z') d) domains_i with Failure _ -> (x,z), -1 in + + let get_m m = (if m.decr_flag then "ml" else "mr"), m.variable in + + let rec rec_transform path r = + match r with + | Result_mono (mono, r1) -> + let path' = rev_itlist (fun m l -> get_m m :: l) mono path in + Result_mono (mono, rec_transform path' r1) + | Result_glue (j, convex_flag, r1, r2) -> + let s1, s2 = if convex_flag then "ml", "mr" else "l", "r" in + let p1, p2 = ((s1, j + 1) :: path), ((s2, j + 1) :: path) in + let t1 = rec_transform p1 r1 in + let t2 = rec_transform p2 r2 in + Result_glue (j, convex_flag, t1, t2) + | Result_pass_mono m -> + let path' = rev (get_m m :: path) in + let x', z' = get_domain path' in + let _, i = find_domain x' z' in + (* let _ = report (sprintf "p = %s, d = %s, found: %d" + (domain_str x' z') (path_str path') i) in *) + if i >= 0 then Result_mono ([m], Result_pass_ref (-i)) else r + | _ -> r in + + rec_transform [] r in + + let rec transform acc r = + let flag, rs, r' = get_results0 [] r acc in + if flag then (rs @ [[], r]) + else + let domains = map (fun p, _ -> get_domain p) rs in + let r_next = transform_pass_mono x z domains r' in + let _ = r_next <> r' or failwith "transform_result: deadlock" in + transform rs r_next in + transform [] r;; + + +(* Computes result statistics *) + +let result_stats result = + let pass = ref 0 and + mono = ref 0 and + glue = ref 0 and + pass_mono = ref 0 and + pass_raw = ref 0 and + glue_convex = ref 0 in + + let rec count r = + match r with + | Result_false _ -> failwith "False result" + | Result_pass (flag, _, _) -> + pass := !pass + 1; + if flag then pass_raw := !pass_raw + 1 else () + | Result_pass_mono _ -> pass_mono := !pass_mono + 1 + | Result_mono (_, r1) -> mono := !mono + 1; count r1 + | Result_glue (_, flag, r1, r2) -> + glue := !glue + 1; + if flag then glue_convex := !glue_convex + 1 else (); + count r1; count r2 in + + let _ = count result in + {pass = !pass; pass_raw = !pass_raw; pass_mono = !pass_mono; + mono = !mono; glue = !glue; glue_convex = !glue_convex};; + + +let report_stats stats = + let s = sprintf "pass = %d (pass_raw = %d)\nmono = %d\nglue = %d (glue_convex = %d)\npass_mono = %d" + stats.pass stats.pass_raw stats.mono stats.glue stats.glue_convex stats.pass_mono in + report s;; + + +let result_p_stats glue_flag p_result = + let p_table = Hashtbl.create 10 in + let add1 p = + let c = if Hashtbl.mem p_table p then Hashtbl.find p_table p else 0 in + Hashtbl.replace p_table p (succ c) in + + let rec count r = + match r with + | P_result_ref _ -> () + | P_result_pass (pp, _) -> add1 pp.pp + | P_result_mono (pp, _, r1) -> add1 pp.pp; count r1 + | P_result_glue (pp, _, _, r1, r2) -> + if glue_flag then add1 pp.pp else (); + count r1; count r2 in + + let _ = count p_result in + let s = Hashtbl.fold + (fun p c s -> (sprintf "p = %d: %d\n" p c) ^ s) p_table "" in + report s;; + + +end;; diff --git a/formal_ineqs/verifier/m_verifier.hl b/formal_ineqs/verifier/m_verifier.hl new file mode 100644 index 0000000..88398aa --- /dev/null +++ b/formal_ineqs/verifier/m_verifier.hl @@ -0,0 +1,1610 @@ +(* =========================================================== *) +(* Formal verification functions *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +needs "taylor/m_taylor.hl";; +(* needs "verifier/interval_m/verifier.ml";; *) +needs "verifier/interval_m/verifier.hl";; +needs "misc/vars.hl";; +needs "verifier_options.hl";; +needs "verifier/m_verifier_build.hl";; + +(* module M_verifier = struct *) + +open Arith_misc;; +open Arith_float;; +open M_taylor;; +open Misc_vars;; +open Verifier_options;; +open M_verifier_build;; + + +let mk_real_vars n name = map (fun i -> mk_var (sprintf "%s%d" name i, real_ty)) (1--n);; + +(*************************************) + +let BOUNDED_INTERVAL_ARITH_IMP_HI' = (MY_RULE o prove) + (`(!x. x IN interval [domain] ==> interval_arith (f x) (lo, hi)) ==> + (!x. x IN interval [domain] ==> f x <= hi)`, SIMP_TAC[interval_arith]);; + +let BOUNDED_INTERVAL_ARITH_IMP_LO' = (MY_RULE o prove) + (`(!x. x IN interval [domain] ==> interval_arith (f x) (lo, hi)) ==> + (!x. x IN interval [domain] ==> lo <= f x)`, SIMP_TAC[interval_arith]);; + + +let eval_interval_arith_hi n bound_th = + let tm0 = (snd o dest_forall o concl) bound_th in + let int_tm, concl_tm = dest_comb tm0 in + let domain_tm = (rand o rator o rand o rand o rand) int_tm in + let ltm, bounds_tm = dest_interval_arith concl_tm in + let f_tm, (lo_tm, hi_tm) = rator ltm, dest_pair bounds_tm in + let f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + (MY_PROVE_HYP bound_th o + INST[f_tm, f_var; domain_tm, domain_var; hi_tm, hi_var_real; lo_tm, lo_var_real] o + inst_first_type_var n_type_array.(n)) BOUNDED_INTERVAL_ARITH_IMP_HI';; + + +let eval_interval_arith_lo n bound_th = + let tm0 = (snd o dest_forall o concl) bound_th in + let int_tm, concl_tm = dest_comb tm0 in + let domain_tm = (rand o rator o rand o rand o rand) int_tm in + let ltm, bounds_tm = dest_interval_arith concl_tm in + let f_tm, (lo_tm, hi_tm) = rator ltm, dest_pair bounds_tm in + let f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + (MY_PROVE_HYP bound_th o + INST[f_tm, f_var; domain_tm, domain_var; hi_tm, hi_var_real; lo_tm, lo_var_real] o + inst_first_type_var n_type_array.(n)) BOUNDED_INTERVAL_ARITH_IMP_LO';; + + + +(*************************************) +(* subdomains *) + +let eval_subset_trans = + let SUBSET_TRANS' = MY_RULE SUBSET_TRANS in + fun st_th tu_th -> + let ltm, t_tm = dest_comb (concl st_th) in + let s_tm = rand ltm and + u_tm = rand (concl tu_th) in + let ty = (hd o snd o dest_type o type_of) s_tm and + s_var = mk_var ("s", type_of s_tm) and + t_var = mk_var ("t", type_of t_tm) and + u_var = mk_var ("u", type_of u_tm) in + (MY_PROVE_HYP st_th o MY_PROVE_HYP tu_th o + INST[s_tm, s_var; t_tm, t_var; u_tm, u_var] o inst_first_type_var ty) SUBSET_TRANS';; + +let eval_subset_refl = + let SUBSET_REFL' = MY_RULE SUBSET_REFL in + fun s_tm -> + let ty = (hd o snd o dest_type o type_of) s_tm and + s_var = mk_var ("s", type_of s_tm) in + (INST[s_tm, s_var] o inst_first_type_var ty) SUBSET_REFL';; + + + +let SUBSET_INTERVAL_IMP = prove(`!a b c d. (!i. i IN 1..dimindex (:N) ==> a$i <= c$i /\ d$i <= b$i) ==> + interval [c:real^N,d] SUBSET interval [a,b]`, + SIMP_TAC[SUBSET_INTERVAL; GSYM IN_NUMSEG]);; + + +let gen_subset_interval_lemma n = + let a_vars = mk_real_vars n "a" and + b_vars = mk_real_vars n "b" and + c_vars = mk_real_vars n "c" and + d_vars = mk_real_vars n "d" in + + let a_tm = mk_vector_list a_vars and + b_tm = mk_vector_list b_vars and + c_tm = mk_vector_list c_vars and + d_tm = mk_vector_list d_vars in + + let th0 = (SPEC_ALL o ISPECL [a_tm; b_tm; c_tm; d_tm]) SUBSET_INTERVAL_IMP in + let th1 = REWRITE_RULE[dimindex_array.(n); IN_NUMSEG; gen_in_interval n; ARITH] th0 in + let th2 = REWRITE_RULE (Array.to_list comp_thms_array.(n)) th1 in + MY_RULE th2;; + + +let subset_interval_thms_array = Array.init (max_dim + 1) + (fun n -> if n < 1 then TRUTH else gen_subset_interval_lemma n);; + + + +let m_subset_interval n a_tm b_tm c_tm d_tm = + let a_vars = mk_real_vars n "a" and + b_vars = mk_real_vars n "b" and + c_vars = mk_real_vars n "c" and + d_vars = mk_real_vars n "d" in + + let a_s = dest_vector a_tm and + b_s = dest_vector b_tm and + c_s = dest_vector c_tm and + d_s = dest_vector d_tm in + + let th0 = (INST (zip a_s a_vars) o INST (zip b_s b_vars) o + INST (zip c_s c_vars) o INST (zip d_s d_vars)) subset_interval_thms_array.(n) in + let prove_le tm = + let ltm, rtm = dest_binop le_op_real tm in + EQT_ELIM (float_le ltm rtm) in + let hyp_ths = map prove_le (hyp th0) in + itlist (fun hyp_th th -> MY_PROVE_HYP hyp_th th) hyp_ths th0;; + + +(*************************************) + +let M_RESTRICT_RIGHT_LEMMA = prove(`!j x z y w u y' w'. m_cell_domain (x:real^N,z) y w /\ + (!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> + u$i = x$i /\ y'$i = y$i /\ w'$i = w$i) /\ + u$j = z$j /\ y'$j = z$j /\ w'$j = &0 ==> + m_cell_domain (u,z) y' w' /\ interval [u,z] SUBSET interval [x,z]`, + REWRITE_TAC[m_cell_domain; SUBSET_INTERVAL; GSYM IN_NUMSEG] THEN REPEAT GEN_TAC THEN STRIP_TAC THEN + CONJ_TAC THENL + [ + GEN_TAC THEN DISCH_TAC THEN + ASM_CASES_TAC `i = j:num` THENL + [ + ASM_REWRITE_TAC[REAL_LE_REFL; REAL_SUB_REFL; real_max]; + ALL_TAC + ] THEN + REPEAT (FIRST_ASSUM (new_rewrite [] []) THEN ASM_REWRITE_TAC[]); + ALL_TAC + ] THEN + DISCH_TAC THEN GEN_TAC THEN DISCH_TAC THEN + ASM_CASES_TAC `i = j:num` THENL + [ + ASM_REWRITE_TAC[REAL_LE_REFL] THEN + REPEAT (FIRST_X_ASSUM (MP_TAC o SPEC `j:num`)) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + REPEAT (FIRST_ASSUM (new_rewrite [] [])) THEN ASM_REWRITE_TAC[REAL_LE_REFL]);; + + + +let M_RESTRICT_LEFT_LEMMA = prove(`!j x z y w u y' w'. m_cell_domain (x:real^N,z) y w /\ + (!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> + u$i = z$i /\ y'$i = y$i /\ w'$i = w$i) /\ + u$j = x$j /\ y'$j = x$j /\ w'$j = &0 ==> + m_cell_domain (x,u) y' w' /\ interval [x,u] SUBSET interval [x,z]`, + REWRITE_TAC[m_cell_domain; SUBSET_INTERVAL; GSYM IN_NUMSEG] THEN REPEAT GEN_TAC THEN STRIP_TAC THEN + CONJ_TAC THENL + [ + GEN_TAC THEN DISCH_TAC THEN + ASM_CASES_TAC `i = j:num` THENL + [ + ASM_REWRITE_TAC[REAL_LE_REFL; REAL_SUB_REFL; real_max]; + ALL_TAC + ] THEN + REPEAT (FIRST_ASSUM (new_rewrite [] []) THEN ASM_REWRITE_TAC[]); + ALL_TAC + ] THEN + DISCH_TAC THEN GEN_TAC THEN DISCH_TAC THEN + ASM_CASES_TAC `i = j:num` THENL + [ + ASM_REWRITE_TAC[REAL_LE_REFL] THEN + REPEAT (FIRST_X_ASSUM (MP_TAC o SPEC `j:num`)) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + REPEAT (FIRST_ASSUM (new_rewrite [] [])) THEN ASM_REWRITE_TAC[REAL_LE_REFL]);; + + +let gen_restrict_lemma n j left_flag = + let xs = mk_real_vars n "x" and + zs = mk_real_vars n "z" and + ys = mk_real_vars n "y" and + ws = mk_real_vars n "w" and + j_tm = mk_small_numeral j in + let a, b = if left_flag then zs, xs else xs, zs in + let x_tm = mk_vector_list xs and + z_tm = mk_vector_list zs and + y_tm = mk_vector_list ys and + w_tm = mk_vector_list ws and + u_tm = mk_vector_list (map (fun i -> List.nth (if i = j then b else a) (i - 1)) (1--n)) and + y'_tm = mk_vector_list (map (fun i -> List.nth (if i = j then b else ys) (i - 1)) (1--n)) and + w'_tm = mk_vector_list (map (fun i -> if i = j then `&0` else List.nth ws (i - 1)) (1--n)) in + + let th0 = (SPEC_ALL o ISPECL [j_tm; x_tm; z_tm; y_tm; w_tm; u_tm; y'_tm; w'_tm]) + (if left_flag then M_RESTRICT_LEFT_LEMMA else M_RESTRICT_RIGHT_LEMMA) in + let th1 = REWRITE_RULE[dimindex_array.(n); IN_NUMSEG; gen_in_interval n; ARITH] th0 in + let th2 = REWRITE_RULE (Array.to_list comp_thms_array.(n)) th1 in + MY_RULE_FLOAT th2;; + + +let left_restrict_thms_array = Array.init (max_dim + 1) + (fun n -> Array.init (n + 1) + (fun j -> if j < 1 then TRUTH else gen_restrict_lemma n j true));; + + +let right_restrict_thms_array = Array.init (max_dim + 1) + (fun n -> Array.init (n + 1) + (fun j -> if j < 1 then TRUTH else gen_restrict_lemma n j false));; + + + + +(******************************) +(* m_cell_pass *) + +let m_cell_pass = new_definition `m_cell_pass f domain <=> (!x. x IN interval [domain] ==> f x < &0)`;; + +let m_cell_list_pass = new_definition `m_cell_list_pass fs domain <=> + (!x:real^N. x IN interval [domain] ==> ITLIST (\f r. f x < &0 \/ r) fs F)`;; + +let dest_m_cell_pass pass_tm = + let ltm, domain = dest_comb pass_tm in + rand ltm, domain;; + +let dest_m_cell_list_pass pass_tm = + let ltm, domain = dest_comb pass_tm in + dest_list (rand ltm), domain;; + + +(*********************************) + +let M_CELL_PASS_EQ_LIST_PASS1 = prove(`m_cell_pass f domain <=> m_cell_list_pass [f] domain`, + REWRITE_TAC[m_cell_pass; m_cell_list_pass; ITLIST]);; + +let M_CELL_PASS_IMP_LIST_PASS1 = prove(`m_cell_pass f domain ==> m_cell_list_pass [f] domain`, + REWRITE_TAC[M_CELL_PASS_EQ_LIST_PASS1]);; + +let M_CELL_PASS_LEMMA = prove(`(!x. x IN interval [domain] ==> f x <= hi) /\ (hi < &0 <=> T) ==> + m_cell_pass f domain`, + REWRITE_TAC[m_cell_pass] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `hi:real` THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]);; + +let M_CELL_LIST_PASS1_LEMMA = prove(`(!x. x IN interval [domain] ==> f x <= hi) /\ (hi < &0 <=> T) ==> + m_cell_list_pass [f] domain`, + DISCH_THEN (MP_TAC o MATCH_MP M_CELL_PASS_LEMMA) THEN + REWRITE_TAC[M_CELL_PASS_EQ_LIST_PASS1]);; + + +let M_CELL_PASS_LEMMA' = MY_RULE M_CELL_PASS_LEMMA and + M_CELL_LIST_PASS1_LEMMA' = MY_RULE M_CELL_LIST_PASS1_LEMMA;; + +let M_CELL_PASS_INTERVAL_LEMMA' = (MY_RULE o prove) + (`(!x. x IN interval [domain] ==> interval_arith (f x) (lo, hi)) /\ hi < &0 ==> m_cell_pass f domain`, + REWRITE_TAC[interval_arith] THEN STRIP_TAC THEN MATCH_MP_TAC M_CELL_PASS_LEMMA THEN + ASM_SIMP_TAC[]);; + +let M_CELL_LIST_PASS1_INTERVAL_LEMMA' = (MY_RULE o prove) + (`(!x. x IN interval [domain] ==> interval_arith (f x) (lo, hi)) /\ hi < &0 ==> m_cell_list_pass [f] domain`, + REWRITE_TAC[interval_arith] THEN STRIP_TAC THEN MATCH_MP_TAC M_CELL_LIST_PASS1_LEMMA THEN + ASM_SIMP_TAC[]);; + + +(* m_cell_pass with taylor_interval *) +let m_taylor_cell_pass n pp m_taylor_th = + let upper_th = eval_m_taylor_upper_bound n pp m_taylor_th in + let tm0 = (snd o dest_forall o concl) upper_th in + let int_tm, concl_tm = dest_comb tm0 in + let domain_tm = (rand o rator o rand o rand o rand) int_tm in + let ltm, hi_tm = dest_comb concl_tm in + let f_tm = (rator o rand) ltm in + let f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let hi_lt0_th = float_lt0 hi_tm in + if (fst o dest_const o rand o concl) hi_lt0_th = "F" then + failwith "m_taylor_cell_pass: hi < &0 <=> F" + else + (MY_PROVE_HYP upper_th o MY_PROVE_HYP hi_lt0_th o + INST[f_tm, f_var; domain_tm, domain_var; hi_tm, hi_var_real] o + inst_first_type_var n_type_array.(n)) M_CELL_PASS_LEMMA';; + +let m_taylor_cell_list_pass n pp m_taylor_th = + let upper_th = eval_m_taylor_upper_bound n pp m_taylor_th in + let tm0 = (snd o dest_forall o concl) upper_th in + let int_tm, concl_tm = dest_comb tm0 in + let domain_tm = (rand o rator o rand o rand o rand) int_tm in + let ltm, hi_tm = dest_comb concl_tm in + let f_tm = (rator o rand) ltm in + let f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let hi_lt0_th = float_lt0 hi_tm in + if (fst o dest_const o rand o concl) hi_lt0_th = "F" then + failwith "m_taylor_cell_list_pass: hi < &0 <=> F" + else + (MY_PROVE_HYP upper_th o MY_PROVE_HYP hi_lt0_th o + INST[f_tm, f_var; domain_tm, domain_var; hi_tm, hi_var_real] o + inst_first_type_var n_type_array.(n)) M_CELL_LIST_PASS1_LEMMA';; + + +(* m_cell_pass with a raw interval *) +let m_taylor_cell_pass0 n bound_th = + let tm0 = (snd o dest_forall o concl) bound_th in + let int_tm, concl_tm = dest_comb tm0 in + let domain_tm = (rand o rator o rand o rand o rand) int_tm in + let ltm, bounds_tm = dest_interval_arith concl_tm in + let f_tm, (lo_tm, hi_tm) = rator ltm, dest_pair bounds_tm in + let f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + let hi_lt0_th = try EQT_ELIM (float_lt0 hi_tm) with Failure _ -> failwith "m_taylor_cell_pass0" in + (MY_PROVE_HYP bound_th o MY_PROVE_HYP hi_lt0_th o + INST[f_tm, f_var; domain_tm, domain_var; hi_tm, hi_var_real; lo_tm, lo_var_real] o + inst_first_type_var n_type_array.(n)) M_CELL_PASS_INTERVAL_LEMMA';; + +let m_taylor_cell_list_pass0 n bound_th = + let tm0 = (snd o dest_forall o concl) bound_th in + let int_tm, concl_tm = dest_comb tm0 in + let domain_tm = (rand o rator o rand o rand o rand) int_tm in + let ltm, bounds_tm = dest_interval_arith concl_tm in + let f_tm, (lo_tm, hi_tm) = rator ltm, dest_pair bounds_tm in + let f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + let hi_lt0_th = try EQT_ELIM (float_lt0 hi_tm) with Failure _ -> failwith "m_taylor_cell_list_pass0" in + (MY_PROVE_HYP bound_th o MY_PROVE_HYP hi_lt0_th o + INST[f_tm, f_var; domain_tm, domain_var; hi_tm, hi_var_real; lo_tm, lo_var_real] o + inst_first_type_var n_type_array.(n)) M_CELL_LIST_PASS1_INTERVAL_LEMMA';; + + + +(**********************) + +let M_CELL_PASS_SUBDOMAIN' = (MY_RULE o prove)(`interval [domain2] SUBSET interval [domain] /\ + m_cell_pass f domain ==> m_cell_pass f domain2`, + REWRITE_TAC[m_cell_pass; SUBSET] THEN REPEAT STRIP_TAC THEN ASM_SIMP_TAC[]);; + +let M_CELL_LIST_PASS_SUBDOMAIN' = (MY_RULE o prove)(`interval [domain2] SUBSET interval [domain] /\ + m_cell_list_pass fs domain ==> m_cell_list_pass fs domain2`, + REWRITE_TAC[m_cell_list_pass; SUBSET] THEN REPEAT STRIP_TAC THEN ASM_SIMP_TAC[]);; + + +let m_cell_pass_subdomain domain2_tm pass_th = + let f_tm, domain_tm = dest_m_cell_pass (concl pass_th) in + let f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) and + domain2_var = mk_var ("domain2", type_of domain2_tm) in + let a, b = dest_pair domain_tm and + c, d = dest_pair domain2_tm in + let n = get_dim a in + let sub_th = m_subset_interval n a b c d in + (MY_PROVE_HYP sub_th o MY_PROVE_HYP pass_th o + INST[domain_tm, domain_var; domain2_tm, domain2_var; f_tm, f_var] o + inst_first_type_var n_type_array.(n)) M_CELL_PASS_SUBDOMAIN';; + + +let m_cell_list_pass_subdomain domain2_tm pass_th = + let fs_tm, domain_tm = dest_m_cell_pass (concl pass_th) in + let fs_var = mk_var ("fs", type_of fs_tm) and + domain_var = mk_var ("domain", type_of domain_tm) and + domain2_var = mk_var ("domain2", type_of domain2_tm) in + let a, b = dest_pair domain_tm and + c, d = dest_pair domain2_tm in + let n = get_dim a in + let sub_th = m_subset_interval n a b c d in + (MY_PROVE_HYP sub_th o MY_PROVE_HYP pass_th o + INST[domain_tm, domain_var; domain2_tm, domain2_var; fs_tm, fs_var] o + inst_first_type_var n_type_array.(n)) M_CELL_LIST_PASS_SUBDOMAIN';; + + + + + +(******************************) + +let GLUE_LEMMA = prove(`!j x z v u P Q. + (!i. 1 <= i /\ i <= dimindex (:N) ==> ~(i = j) ==> + u$i = x$i /\ v$i = z$i) ==> + v$j = u$j ==> + (!p. p IN interval [x,v] ==> P p) ==> + (!p. p IN interval [u,z] ==> Q p) ==> + (!p. p IN interval [x,z:real^N] ==> P p \/ Q p)`, + REWRITE_TAC[IN_INTERVAL] THEN REPEAT GEN_TAC THEN + move ["eq1"; "eq_vu"; "cell1"; "cell2"; "y"; "ineq"] THEN + ASM_CASES_TAC `(y:real^N)$j <= (v:real^N)$j` THENL + [ + DISJ1_TAC THEN REMOVE_THEN "cell1" MATCH_MP_TAC THEN GEN_TAC THEN DISCH_TAC THEN + USE_THEN "ineq" (new_rewrite [] []) THEN ASM_REWRITE_TAC[] THEN + ASM_CASES_TAC `i = j:num` THENL + [ + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN SIMP_TAC[]; + ALL_TAC + ] THEN + USE_THEN "eq1" (new_rewrite [] []) THEN ASM_REWRITE_TAC[] THEN + USE_THEN "ineq" (new_rewrite [] []) THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + POP_ASSUM (ASSUME_TAC o MATCH_MP (REAL_ARITH `~(a <= b) ==> b <= a:real`)) THEN + DISJ2_TAC THEN REMOVE_THEN "cell2" MATCH_MP_TAC THEN GEN_TAC THEN DISCH_TAC THEN + USE_THEN "ineq" (new_rewrite [] []) THEN ASM_REWRITE_TAC[] THEN + ASM_CASES_TAC `i = j:num` THENL + [ + ASM_REWRITE_TAC[] THEN USE_THEN "eq_vu" (fun th -> REWRITE_TAC[SYM th]) THEN + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN SIMP_TAC[]; + ALL_TAC + ] THEN + USE_THEN "eq1" (new_rewrite [] []) THEN ASM_REWRITE_TAC[] THEN + USE_THEN "ineq" (new_rewrite [] []) THEN ASM_REWRITE_TAC[]);; + +let M_CELL_PASS_GLUE_LEMMA = prove(`!j x z v u f. + (!i. 1 <= i /\ i <= dimindex (:N) ==> ~(i = j) ==> + u$i = x$i /\ v$i = z$i) ==> + v$j = u$j ==> + m_cell_pass f (x,v) ==> + m_cell_pass f (u,z) ==> + m_cell_pass f (x,z:real^N)`, + REPEAT GEN_TAC THEN REWRITE_TAC[m_cell_pass] THEN + DISCH_THEN (MP_TAC o MATCH_MP GLUE_LEMMA) THEN + DISCH_THEN (MP_TAC o SPECL [`\x:real^N. f x < &0`; `\x:real^N. f x < &0`]) THEN + REWRITE_TAC[]);; + +let ITLIST_DISJ_APPEND = prove(`!P l1 l2. ITLIST (\a r. P a \/ r) (APPEND l1 l2) F + <=> ITLIST (\a r. P a \/ r) l1 F \/ ITLIST (\a r. P a \/ r) l2 F`, + GEN_TAC THEN LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[APPEND; ITLIST; APPEND_NIL] THEN + ASM_REWRITE_TAC[ITLIST; DISJ_ACI]);; + +let M_CELL_LIST_PASS_GLUE_LEMMA = prove(`!j x z v u fs1 fs2. + (!i. 1 <= i /\ i <= dimindex (:N) ==> ~(i = j) ==> + u$i = x$i /\ v$i = z$i) ==> + v$j = u$j ==> + m_cell_list_pass fs1 (x,v) ==> + m_cell_list_pass fs2 (u,z) ==> + m_cell_list_pass (APPEND fs1 fs2) (x,z:real^N)`, + REPEAT GEN_TAC THEN REWRITE_TAC[m_cell_list_pass; ITLIST_DISJ_APPEND] THEN + apply_tac GLUE_LEMMA);; + + +let gen_glue_lemma n j = + let mk_vars name = map (fun i -> mk_var (sprintf "%s%d" name i, real_ty)) (1--n) in + let xs = mk_vars "x" and + zs = mk_vars "z" and + t_var = mk_var ("t", real_ty) and + j_tm = mk_small_numeral j in + let x_tm = mk_vector_list xs and + z_tm = mk_vector_list zs and + v_tm = mk_vector_list (map (fun i -> if i = j then t_var else List.nth zs (i - 1)) (1--n)) and + u_tm = mk_vector_list (map (fun i -> if i = j then t_var else List.nth xs (i - 1)) (1--n)) in + let gen_th lemma = + let th0 = (SPEC_ALL o ISPECL [j_tm; x_tm; z_tm; v_tm; u_tm]) lemma in + let th1 = REWRITE_RULE[dimindex_array.(n); gen_in_interval n; ARITH] th0 in + let th2 = REWRITE_RULE (Array.to_list comp_thms_array.(n)) th1 in + MY_RULE th2 in + gen_th M_CELL_PASS_GLUE_LEMMA, gen_th M_CELL_LIST_PASS_GLUE_LEMMA;; + + +let glue_thms_array = Array.init (max_dim + 1) + (fun n -> Array.init (n + 1) + (fun j -> if j < 1 then TRUTH, TRUTH else gen_glue_lemma n j));; + + +(***************************************) +(* m_cell_list_pass reduction *) + +let CELL_LIST_PASS_ACC_INTRO = prove(`m_cell_list_pass fs1 domain <=> m_cell_list_pass (APPEND fs1 []) domain`, + REWRITE_TAC[APPEND_NIL]);; + +let CELL_LIST_PASS_ACC_ELIM = SYM CELL_LIST_PASS_ACC_INTRO;; + +let CELL_LIST_PASS_ACC_REV = prove(`m_cell_list_pass (APPEND acc (CONS h fs2)) domain + <=> m_cell_list_pass (APPEND (CONS h acc) fs2) domain`, + REWRITE_TAC[m_cell_list_pass; ITLIST_DISJ_APPEND; ITLIST; DISJ_ACI]);; + +let CELL_LIST_PASS_NIL1 = prove(`m_cell_list_pass (APPEND (APPEND [] fs2) acc) domain + <=> m_cell_list_pass (APPEND fs2 acc) domain`, + REWRITE_TAC[APPEND]);; + +let CELL_LIST_PASS_NIL2 = prove(`m_cell_list_pass (APPEND (APPEND fs1 []) acc) domain + <=> m_cell_list_pass (APPEND fs1 acc) domain`, + REWRITE_TAC[APPEND_NIL]);; + +let CELL_LIST_PASS_SAME_HD = prove(`m_cell_list_pass (APPEND (APPEND (CONS h fs1) (CONS h fs2)) acc) domain + <=> m_cell_list_pass (APPEND (APPEND fs1 fs2) (CONS h acc)) domain`, + REWRITE_TAC[m_cell_list_pass; ITLIST_DISJ_APPEND; ITLIST; DISJ_ACI]);; + +let CELL_LIST_PASS_MOVE1 = prove(`m_cell_list_pass (APPEND (APPEND (CONS h fs1) fs2) acc) domain + <=> m_cell_list_pass (APPEND (APPEND fs1 fs2) (CONS h acc)) domain`, + REWRITE_TAC[m_cell_list_pass; ITLIST_DISJ_APPEND; ITLIST; DISJ_ACI]);; + +let CELL_LIST_PASS_MOVE2 = prove(`m_cell_list_pass (APPEND (APPEND fs1 (CONS h fs2)) acc) domain + <=> m_cell_list_pass (APPEND (APPEND fs1 fs2) (CONS h acc)) domain`, + REWRITE_TAC[m_cell_list_pass; ITLIST_DISJ_APPEND; ITLIST; DISJ_ACI]);; + +(* pass_th should be in the form |- m_cell_list_pass (APPEND fs1 fs2) dom *) +let merge_m_cell_list_pass n pass_th = + let append_tm, dom_tm = dest_m_cell_pass (concl pass_th) in + let list_ty = type_of append_tm in + let dom_var = mk_var ("domain", type_of dom_tm) and + fs1_var = mk_var ("fs1", list_ty) and + fs2_var = mk_var ("fs2", list_ty) and + acc_var = mk_var ("acc", list_ty) and + h_var = mk_var ("h", (hd o snd o dest_type) list_ty) in + let acc_intro, acc_elim, acc_rev, pass_nil1, pass_nil2, same_hd, pass_move1, pass_move2 = + let r = inst_first_type_var n_type_array.(n) in + r CELL_LIST_PASS_ACC_INTRO, + r CELL_LIST_PASS_ACC_ELIM, + r CELL_LIST_PASS_ACC_REV, + r CELL_LIST_PASS_NIL1, + r CELL_LIST_PASS_NIL2, + r CELL_LIST_PASS_SAME_HD, + r CELL_LIST_PASS_MOVE1, + r CELL_LIST_PASS_MOVE2 in + + (* Reverses the result list to preserve ordering *) + let rec rev_acc th = + let ltm, s_tm = (dest_comb o rand o rator o concl) th in + let acc_tm = rand ltm in + if is_comb s_tm then + let h_tm, fs2_tm = dest_binary "CONS" s_tm in + let th1 = INST[h_tm, h_var; fs2_tm, fs2_var; acc_tm, acc_var; dom_tm, dom_var] acc_rev in + let th2 = EQ_MP th1 th in + rev_acc th2 + else + let th1 = INST[acc_tm, fs1_var; dom_tm, dom_var] acc_elim in + EQ_MP th1 th in + + (* Computes a merged list *) + let rec merge_append th = + let ltm, acc_tm = (dest_comb o rand o rator o concl) th in + let fs1_tm, fs2_tm = dest_binary "APPEND" (rand ltm) in + if not (is_comb fs1_tm) then + let th1 = INST[fs2_tm, fs2_var; acc_tm, acc_var; dom_tm, dom_var] pass_nil1 in + EQ_MP th1 th + else if not (is_comb fs2_tm) then + let th1 = INST[fs1_tm, fs1_var; acc_tm, acc_var; dom_tm, dom_var] pass_nil2 in + EQ_MP th1 th + else + let h1_tm, t1_tm = dest_binary "CONS" fs1_tm and + h2_tm, t2_tm = dest_binary "CONS" fs2_tm in + let th1 = + match (compare h1_tm h2_tm) with + | -1 -> INST[h1_tm, h_var; t1_tm, fs1_var; fs2_tm, fs2_var; acc_tm, acc_var; dom_tm, dom_var] pass_move1 + | 1 -> INST[h2_tm, h_var; t2_tm, fs2_var; fs1_tm, fs1_var; acc_tm, acc_var; dom_tm, dom_var] pass_move2 + | _ -> INST[h1_tm, h_var; t1_tm, fs1_var; t2_tm, fs2_var; acc_tm, acc_var; dom_tm, dom_var] same_hd in + let th2 = EQ_MP th1 th in + merge_append th2 in + + let th0 = EQ_MP (INST[append_tm, fs1_var; dom_tm, dom_var] acc_intro) pass_th in + let th1 = merge_append th0 in + rev_acc th1;; + +(* +compare `\x:real^2. x$1` `\x:real^2. x$1 + x$2`;; + +let test_th = ASSUME `m_cell_list_pass (APPEND [\x:real^2. x$1; \x:real^2. x$1 + x$2] [\x:real^2. x$1 + x$2; \x:real^2. x$1 * x$2]) dom`;; +merge_m_cell_list_pass 2 test_th;; + + +(rand o rator o concl) test_th;; +test 1000 (merge_m_cell_list_pass 2) test_th;; + +*) + +(***************************************) + +let M_CELL_SUP = prove(`!f x z. lift o f continuous_on interval [x,z:real^N] /\ m_cell_pass f (x,z) ==> + ?a. a < &0 /\ !y. y IN interval [x,z] ==> f y <= a`, + REWRITE_TAC[m_cell_pass] THEN REPEAT STRIP_TAC THEN + ASM_CASES_TAC `interval [x:real^N,z] = {}` THENL + [ + EXISTS_TAC `-- &1` THEN ASM_REWRITE_TAC[NOT_IN_EMPTY] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + MP_TAC (SPECL [`f:real^N->real`; `interval [x,z:real^N]`] CONTINUOUS_ATTAINS_SUP) THEN + ASM_REWRITE_TAC[COMPACT_INTERVAL] THEN + DISCH_THEN (X_CHOOSE_THEN `y:real^N` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `(f:real^N->real) y` THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]);; + + +let DIFF2_DOMAIN_IMP_CONTINUOUS_ON = prove(`!(f:real^N->real) domain. diff2_domain domain f ==> + lift o f continuous_on interval [domain]`, + REWRITE_TAC[diff2_domain] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC CONTINUOUS_AT_IMP_CONTINUOUS_ON THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC DIFFERENTIABLE_IMP_CONTINUOUS_AT THEN + MATCH_MP_TAC diff2_imp_diff THEN + ASM_SIMP_TAC[]);; + + + +let M_CELL_INCREASING_PASS_LEMMA = prove(`!j x z u domain lo f. + interval [x,z] SUBSET interval [domain] ==> + diff2c_domain domain f ==> + (!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = x$i) ==> + u$j = z$j ==> + &0 <= lo ==> + (!y. y IN interval [domain] ==> lo <= partial j f y) ==> + m_cell_pass f (u,z) ==> + m_cell_pass f (x,z:real^N)`, + REWRITE_TAC[SUBSET] THEN REPEAT STRIP_TAC THEN REWRITE_TAC[m_cell_pass] THEN + X_GEN_TAC `y:real^N` THEN + ASM_CASES_TAC `~(!i. i IN 1..dimindex (:N) ==> (x:real^N)$i <= (z:real^N)$i)` THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[NOT_FORALL_THM; NOT_IMP; IN_INTERVAL; GSYM IN_NUMSEG] THEN + DISCH_THEN (CHOOSE_THEN STRIP_ASSUME_TAC) THEN + DISCH_THEN (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[negbK] THEN DISCH_TAC THEN + SUBGOAL_THEN `diff2_domain domain (f:real^N->real)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + SIMP_TAC[diff2_domain; diff2c_domain; diff2c]; + ALL_TAC + ] THEN + MP_TAC (SPECL [`f:real^N->real`; `u:real^N`; `z:real^N`] M_CELL_SUP) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC DIFF2_DOMAIN_IMP_CONTINUOUS_ON THEN + UNDISCH_TAC `diff2_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2_domain] THEN REPEAT STRIP_TAC THEN + REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[IN_INTERVAL] THEN DISCH_TAC THEN GEN_TAC THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[IN_NUMSEG] THEN + ASM_CASES_TAC `i = j:num` THENL [ ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; ALL_TAC] THEN + FIRST_X_ASSUM (new_rewrite [] []) THEN ASM_REWRITE_TAC[IN_NUMSEG]; + ALL_TAC + ] THEN + DISCH_THEN (CHOOSE_THEN STRIP_ASSUME_TAC) THEN DISCH_TAC THEN + MP_TAC (SPECL [`f:real^N->real`; `j:num`; `u:real^N`; `x:real^N`; `z:real^N`; `a:real`] partial_increasing_right) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL + [ + REPEAT STRIP_TAC THEN + MATCH_MP_TAC diff2_imp_diff THEN + UNDISCH_TAC `diff2_domain domain (f:real^N->real)` THEN REWRITE_TAC[diff2_domain] THEN + DISCH_THEN MATCH_MP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ANTS_TAC THENL + [ + REPEAT STRIP_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `lo:real` THEN ASM_REWRITE_TAC[] THEN + REPEAT (FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + ALL_TAC + ] THEN + DISCH_TAC THEN MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `a:real` THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]);; + + + +let M_CELL_DECREASING_PASS_LEMMA = prove(`!j x z u domain hi f. + interval [x,z] SUBSET interval [domain] ==> + diff2c_domain domain f ==> + (!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = z$i) ==> + u$j = x$j ==> + hi <= &0 ==> + (!y. y IN interval [domain] ==> partial j f y <= hi) ==> + m_cell_pass f (x,u) ==> + m_cell_pass f (x,z:real^N)`, + REWRITE_TAC[SUBSET] THEN REPEAT STRIP_TAC THEN REWRITE_TAC[m_cell_pass] THEN X_GEN_TAC `y:real^N` THEN + ASM_CASES_TAC `~(!i. i IN 1..dimindex (:N) ==> (x:real^N)$i <= (z:real^N)$i)` THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[NOT_FORALL_THM; NOT_IMP; IN_INTERVAL; GSYM IN_NUMSEG] THEN + DISCH_THEN (CHOOSE_THEN STRIP_ASSUME_TAC) THEN + DISCH_THEN (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[negbK] THEN DISCH_TAC THEN + SUBGOAL_THEN `diff2_domain domain (f:real^N->real)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + SIMP_TAC[diff2_domain; diff2c_domain; diff2c]; + ALL_TAC + ] THEN + MP_TAC (SPECL [`f:real^N->real`; `x:real^N`; `u:real^N`] M_CELL_SUP) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC DIFF2_DOMAIN_IMP_CONTINUOUS_ON THEN + UNDISCH_TAC `diff2_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2_domain] THEN REPEAT STRIP_TAC THEN + REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[IN_INTERVAL] THEN DISCH_TAC THEN GEN_TAC THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[IN_NUMSEG] THEN + ASM_CASES_TAC `i = j:num` THENL [ ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; ALL_TAC] THEN + FIRST_X_ASSUM (new_rewrite [] []) THEN ASM_REWRITE_TAC[IN_NUMSEG]; + ALL_TAC + ] THEN + DISCH_THEN (CHOOSE_THEN STRIP_ASSUME_TAC) THEN DISCH_TAC THEN + MP_TAC (SPECL [`f:real^N->real`; `j:num`; `u:real^N`; `x:real^N`; `z:real^N`; `a:real`] partial_decreasing_left) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL + [ + REPEAT STRIP_TAC THEN + MATCH_MP_TAC diff2_imp_diff THEN + UNDISCH_TAC `diff2_domain domain (f:real^N->real)` THEN REWRITE_TAC[diff2_domain] THEN + DISCH_THEN MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ANTS_TAC THENL + [ + REPEAT STRIP_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `hi:real` THEN ASM_REWRITE_TAC[] THEN + REPEAT (FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + ALL_TAC + ] THEN + DISCH_TAC THEN MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `a:real` THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]);; + + + +let M_CELL_CONVEX_PASS_LEMMA = prove(`!j x z u v lo f. + diff2c_domain (x,z) f ==> + (!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = z$i /\ v$i = x$i) ==> + u$j = x$j ==> v$j = z$j ==> + &0 <= lo ==> + (!y. y IN interval [x,z] ==> lo <= partial2 j j f y) ==> + m_cell_pass f (x,u) ==> + m_cell_pass f (v,z) ==> + m_cell_pass f (x:real^N,z)`, + REPEAT STRIP_TAC THEN REWRITE_TAC[m_cell_pass] THEN + X_GEN_TAC `y:real^N` THEN DISCH_TAC THEN + SUBGOAL_THEN `!i. i IN 1..dimindex (:N) ==> (x:real^N)$i <= (z:real^N)$i` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[IN_INTERVAL] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `(y:real^N)$i` THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[GSYM IN_NUMSEG]; + ALL_TAC + ] THEN + SUBGOAL_THEN `diff2_domain (x,z) (f:real^N->real)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain (x,z) (f:real^N->real)` THEN + SIMP_TAC[diff2_domain; diff2c_domain; diff2c]; + ALL_TAC + ] THEN + MP_TAC (SPECL [`f:real^N->real`; `v:real^N`; `z:real^N`] M_CELL_SUP) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC DIFF2_DOMAIN_IMP_CONTINUOUS_ON THEN + UNDISCH_TAC `diff2_domain (x,z) (f:real^N->real)` THEN + REWRITE_TAC[diff2_domain] THEN REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[IN_INTERVAL] THEN DISCH_TAC THEN GEN_TAC THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[IN_NUMSEG] THEN + ASM_CASES_TAC `i = j:num` THENL [ ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; ALL_TAC] THEN + FIRST_X_ASSUM (new_rewrite [] []) THEN ASM_REWRITE_TAC[IN_NUMSEG]; + ALL_TAC + ] THEN + DISCH_THEN (CHOOSE_THEN STRIP_ASSUME_TAC) THEN + + MP_TAC (SPECL [`f:real^N->real`; `x:real^N`; `u:real^N`] M_CELL_SUP) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC DIFF2_DOMAIN_IMP_CONTINUOUS_ON THEN + UNDISCH_TAC `diff2_domain (x,z) (f:real^N->real)` THEN + REWRITE_TAC[diff2_domain] THEN REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[IN_INTERVAL] THEN DISCH_TAC THEN GEN_TAC THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[IN_NUMSEG] THEN + ASM_CASES_TAC `i = j:num` THENL [ ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; ALL_TAC] THEN + FIRST_X_ASSUM (new_rewrite [] []) THEN ASM_REWRITE_TAC[IN_NUMSEG]; + ALL_TAC + ] THEN + DISCH_THEN (CHOOSE_THEN STRIP_ASSUME_TAC) THEN + + MP_TAC (SPECL [`f:real^N->real`; `j:num`; `x:real^N`; `z:real^N`; `u:real^N`; `v:real^N`; `max a a'`] partial_convex_max) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL + [ + REPEAT STRIP_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `lo:real` THEN ASM_REWRITE_TAC[] THEN + REPEAT (FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + ALL_TAC + ] THEN + ANTS_TAC THENL + [ + REPEAT STRIP_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a':real` THEN + ASM_SIMP_TAC[] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + ANTS_TAC THENL + [ + REPEAT STRIP_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a:real` THEN + ASM_SIMP_TAC[] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_TAC THEN MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `max a a'` THEN + ASM_SIMP_TAC[] THEN + ASM_REAL_ARITH_TAC);; + + + +(*********************) + +let ZERO_EQ_ZERO_CONST = prove(`0 = _0`, REWRITE_TAC[NUMERAL]);; + +let gen_increasing_lemma n j = + let mk_vars name = map (fun i -> mk_var (sprintf "%s%d" name i, real_ty)) (1--n) in + let xs = mk_vars "x" and + zs = mk_vars "z" and + j_tm = mk_small_numeral j in + let x_tm = mk_vector_list xs and + z_tm = mk_vector_list zs and + u_tm = mk_vector_list (map (fun i -> List.nth (if i = j then zs else xs) (i - 1)) (1--n)) in + let th0 = (SPEC_ALL o ISPECL [j_tm; x_tm; z_tm; u_tm]) M_CELL_INCREASING_PASS_LEMMA in + let th1 = REWRITE_RULE[dimindex_array.(n); IN_NUMSEG; gen_in_interval n; ARITH] th0 in + let th2 = REWRITE_RULE (Array.to_list comp_thms_array.(n)) th1 in + let th3 = MY_RULE_NUM th2 in + (UNDISCH_ALL o ONCE_REWRITE_RULE[GSYM ZERO_EQ_ZERO_CONST] o DISCH (last (hyp th3))) th3;; + + +let gen_mono_lemma0 th = + let h2 = List.nth (hyp th) 1 in + let domain_tm = (lhand o rand o lhand) h2 in + let domain_var = mk_var ("domain", type_of domain_tm) in + (UNDISCH_ALL o REWRITE_RULE[SUBSET_REFL] o DISCH_ALL o INST[domain_tm, domain_var]) th;; + +let incr_gen_thms_array = Array.init (max_dim + 1) + (fun n -> Array.init (n + 1) + (fun j -> if j < 1 then TRUTH else gen_increasing_lemma n j));; + +let incr_thms_array = Array.init (max_dim + 1) + (fun n -> Array.init (n + 1) + (fun j -> if j < 1 then TRUTH else gen_mono_lemma0 incr_gen_thms_array.(n).(j)));; + + + +let gen_decreasing_lemma n j = + let mk_vars name = map (fun i -> mk_var (sprintf "%s%d" name i, real_ty)) (1--n) in + let xs = mk_vars "x" and + zs = mk_vars "z" and + j_tm = mk_small_numeral j in + let x_tm = mk_vector_list xs and + z_tm = mk_vector_list zs and + u_tm = mk_vector_list (map (fun i -> List.nth (if i = j then xs else zs) (i - 1)) (1--n)) in + let th0 = (SPEC_ALL o ISPECL [j_tm; x_tm; z_tm; u_tm]) M_CELL_DECREASING_PASS_LEMMA in + let th1 = REWRITE_RULE[dimindex_array.(n); IN_NUMSEG; gen_in_interval n; ARITH] th0 in + let th2 = REWRITE_RULE (Array.to_list comp_thms_array.(n)) th1 in + let th3 = MY_RULE_NUM th2 in + (UNDISCH_ALL o ONCE_REWRITE_RULE[GSYM ZERO_EQ_ZERO_CONST] o DISCH (last (hyp th3))) th3;; + + +let decr_gen_thms_array = Array.init (max_dim + 1) + (fun n -> Array.init (n + 1) + (fun j -> if j < 1 then TRUTH else gen_decreasing_lemma n j));; + +let decr_thms_array = Array.init (max_dim + 1) + (fun n -> Array.init (n + 1) + (fun j -> if j < 1 then TRUTH else gen_mono_lemma0 decr_gen_thms_array.(n).(j)));; + + +(****************************************) + +let gen_convex_max_lemma n j = + let xs = mk_real_vars n "x" and + zs = mk_real_vars n "z" and + j_tm = mk_small_numeral j in + let x_tm = mk_vector_list xs and + z_tm = mk_vector_list zs and + u_tm = mk_vector_list (map (fun i -> List.nth (if i = j then xs else zs) (i - 1)) (1--n)) and + v_tm = mk_vector_list (map (fun i -> List.nth (if i = j then zs else xs) (i - 1)) (1--n)) in + let th0 = (SPEC_ALL o ISPECL [j_tm; x_tm; z_tm; u_tm; v_tm]) M_CELL_CONVEX_PASS_LEMMA in + let th1 = REWRITE_RULE[dimindex_array.(n); IN_NUMSEG; gen_in_interval n; ARITH] th0 in + let th2 = REWRITE_RULE (Array.to_list comp_thms_array.(n)) th1 in + let th3 = MY_RULE_NUM th2 in + (UNDISCH_ALL o ONCE_REWRITE_RULE[GSYM ZERO_EQ_ZERO_CONST] o DISCH (last (hyp th3))) th3;; + + +let convex_thms_array = Array.init (max_dim + 1) + (fun n -> Array.init (n + 1) + (fun j -> if j < 1 then TRUTH else gen_convex_max_lemma n j));; + + + +(******************************************) + +let m_glue_cells n j pass_th1 pass_th2 = + let f_tm, domain1 = dest_m_cell_pass (concl pass_th1) and + domain2 = rand (concl pass_th2) in + let x1, z1 = dest_pair domain1 and + x2, z2 = dest_pair domain2 in + + let x1s = dest_vector x1 and + x2s = dest_vector x2 and + z2s = dest_vector z2 in + + let x_vars = map (fun i -> x_vars_array.(i)) (1--n) and + z_vars = map (fun i -> z_vars_array.(i)) (1--n) and + f_var = mk_var ("f", type_of f_tm) and + t_tm = List.nth x2s (j - 1) in + + let th0 = (INST[t_tm, t_var_real; f_tm, f_var] o + INST (zip z2s z_vars) o INST (zip x1s x_vars)) (fst glue_thms_array.(n).(j)) in + (MY_PROVE_HYP pass_th1 o MY_PROVE_HYP pass_th2) th0;; + + +let m_glue_cells_list n j pass_th1 pass_th2 = + let fs1_tm, domain1 = dest_m_cell_pass (concl pass_th1) and + fs2_tm, domain2 = dest_m_cell_pass (concl pass_th2) in + let x1, z1 = dest_pair domain1 and + x2, z2 = dest_pair domain2 in + + let x1s = dest_vector x1 and + x2s = dest_vector x2 and + z2s = dest_vector z2 in + + let x_vars = map (fun i -> x_vars_array.(i)) (1--n) and + z_vars = map (fun i -> z_vars_array.(i)) (1--n) and + fs1_var = mk_var ("fs1", type_of fs1_tm) and + fs2_var = mk_var ("fs2", type_of fs2_tm) and + t_tm = List.nth x2s (j - 1) in + + let th0 = (INST[t_tm, t_var_real; fs1_tm, fs1_var; fs2_tm, fs2_var] o + INST (zip z2s z_vars) o INST (zip x1s x_vars)) (snd glue_thms_array.(n).(j)) in + (MY_PROVE_HYP pass_th1 o MY_PROVE_HYP pass_th2) th0;; + + +(**********************) + +let m_mono_pass_gen n j decr_flag diff2_th partial_mono_th sub_th pass_th = + let f_tm, domain0 = dest_m_cell_pass (concl pass_th) and + domain = (rand o rator o concl) diff2_th and + xv, zv = (dest_pair o lhand o rand o lhand o concl) sub_th and + bound_tm = ((if decr_flag then rand else lhand) o rand o snd o dest_forall o concl) partial_mono_th in + + let xs = dest_vector xv and + zs = dest_vector zv in + + let x_vars = map (fun i -> x_vars_array.(i)) (1--n) and + z_vars = map (fun i -> z_vars_array.(i)) (1--n) and + domain_var = mk_var ("domain", type_of domain) and + f_var = mk_var ("f", type_of f_tm) and + bound_var = mk_var ((if decr_flag then "hi" else "lo"), real_ty) in + + let le_th0 = (if decr_flag then float_le0 else float_ge0) bound_tm in + let le_th = try EQT_ELIM le_th0 with Failure _ -> + failwith (sprintf "m_mono_pass_gen: j = %d, th = %s" j (string_of_thm le_th0)) in + + let th0 = (INST[f_tm, f_var; bound_tm, bound_var; domain, domain_var] o + INST (zip xs x_vars) o INST (zip zs z_vars)) + (if decr_flag then decr_gen_thms_array.(n).(j) else incr_gen_thms_array.(n).(j)) in + (MY_PROVE_HYP le_th o MY_PROVE_HYP pass_th o MY_PROVE_HYP diff2_th o + MY_PROVE_HYP sub_th o MY_PROVE_HYP partial_mono_th) th0;; + + + +(* m_incr_pass *) +let m_incr_pass n pp j m_taylor_th pass_th0 = + let _, diff2_th, _, _ = dest_m_taylor_thms n m_taylor_th in + let partial_bound = eval_m_taylor_partial_lower n pp j m_taylor_th in + + let f_tm, domain0 = dest_m_cell_pass (concl pass_th0) and + domain = (rand o rator o concl) diff2_th and + lo_tm = (lhand o rand o snd o dest_forall o concl) partial_bound in + let lo_ge0_th = EQT_ELIM (float_ge0 lo_tm) in + + let x_tm, z_tm = dest_pair domain in + let xs = dest_vector x_tm and + zs = dest_vector z_tm in + + let x_vars = map (fun i -> x_vars_array.(i)) (1--n) and + z_vars = map (fun i -> z_vars_array.(i)) (1--n) and + f_var = mk_var ("f", type_of f_tm) in + let th0 = (INST[f_tm, f_var; lo_tm, lo_var_real] o + INST (zip zs z_vars) o INST (zip xs x_vars)) incr_thms_array.(n).(j) in + (MY_PROVE_HYP lo_ge0_th o MY_PROVE_HYP pass_th0 o + MY_PROVE_HYP diff2_th o MY_PROVE_HYP partial_bound) th0;; + + +(* m_decr_pass *) +let m_decr_pass n pp j m_taylor_th pass_th0 = + let _, diff2_th, _, _ = dest_m_taylor_thms n m_taylor_th in + let partial_bound = eval_m_taylor_partial_upper n pp j m_taylor_th in + + let f_tm, domain0 = dest_m_cell_pass (concl pass_th0) and + domain = (rand o rator o concl) diff2_th and + hi_tm = (rand o rand o snd o dest_forall o concl) partial_bound in + let hi_le0_th = EQT_ELIM (float_le0 hi_tm) in + + let x_tm, z_tm = dest_pair domain in + let xs = dest_vector x_tm and + zs = dest_vector z_tm in + + let x_vars = map (fun i -> x_vars_array.(i)) (1--n) and + z_vars = map (fun i -> z_vars_array.(i)) (1--n) and + f_var = mk_var ("f", type_of f_tm) in + let th0 = (INST[f_tm, f_var; hi_tm, hi_var_real] o + INST (zip zs z_vars) o INST (zip xs x_vars)) decr_thms_array.(n).(j) in + (MY_PROVE_HYP hi_le0_th o MY_PROVE_HYP pass_th0 o + MY_PROVE_HYP diff2_th o MY_PROVE_HYP partial_bound) th0;; + +(*************************) + +(* m_convex_pass *) +let m_convex_pass n j diff2_th partial2_bound_th pass1_th pass2_th = + let f_tm, domain1 = dest_m_cell_pass (concl pass1_th) and + _, domain2 = dest_m_cell_pass (concl pass2_th) in + let x_tm, _ = dest_pair domain1 and + _, z_tm = dest_pair domain2 and + bound_tm = (lhand o rand o snd o dest_forall o concl) partial2_bound_th in + + let xs = dest_vector x_tm and + zs = dest_vector z_tm in + + let x_vars = map (fun i -> x_vars_array.(i)) (1--n) and + z_vars = map (fun i -> z_vars_array.(i)) (1--n) and + f_var = mk_var ("f", type_of f_tm) in + + let le_th0 = float_ge0 bound_tm in + let le_th = + try EQT_ELIM le_th0 with Failure _ -> failwith ("m_convex_pass: "^string_of_thm le_th0) in + + let th0 = (INST[f_tm, f_var; bound_tm, lo_var_real] o + INST (zip xs x_vars) o INST (zip zs z_vars)) convex_thms_array.(n).(j) in + (MY_PROVE_HYP le_th o MY_PROVE_HYP pass1_th o MY_PROVE_HYP pass2_th o + MY_PROVE_HYP diff2_th o MY_PROVE_HYP partial2_bound_th) th0;; + + + + +(***********************) + +(* split_domain *) + +let split_domain n pp j domain_th = + let domain_tm, y_tm, _ = dest_m_cell_domain (concl domain_th) in + let x_tm, z_tm = dest_pair domain_tm in + let xs = dest_vector x_tm and + zs = dest_vector z_tm and + t = List.nth (dest_vector y_tm) (j - 1) in + + let vv = map (fun i -> if i = j then t else List.nth zs (i - 1)) (1--n) and + uu = map (fun i -> if i = j then t else List.nth xs (i - 1)) (1--n) in + + let domain1_th = mk_m_center_domain n pp (rand x_tm) (mk_list (vv, real_ty)) and + domain2_th = mk_m_center_domain n pp (mk_list (uu, real_ty)) (rand z_tm) in + domain1_th, domain2_th;; + + +(* restrict_domain *) + +let restrict_domain n j left_flag domain_th = + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let x_tm, z_tm = dest_pair domain_tm in + let xs = dest_vector x_tm and + zs = dest_vector z_tm and + ys = dest_vector y_tm and + ws = dest_vector w_tm in + + let th0 = (INST (zip xs (mk_real_vars n "x")) o INST (zip zs (mk_real_vars n "z")) o + INST (zip ys (mk_real_vars n "y")) o INST (zip ws (mk_real_vars n "w"))) + (if left_flag then left_restrict_thms_array.(n).(j) else right_restrict_thms_array.(n).(j)) in + let ths = CONJUNCTS (MY_PROVE_HYP domain_th th0) in + hd ths, hd (tl ths);; + + + + +(****************************************) + +open Verifier;; +open Recurse;; + +let m_verify_raw (report_start, total_size) n pp fs certificate domain_th0 th_list = + let r_size = result_size certificate in + let r_size2 = float_of_int (if total_size > 0 then total_size else (if r_size > 0 then r_size else 1)) in + let k = ref 0 in + let kk = ref report_start in + let last_report = ref (int_of_float (float_of_int !kk /. r_size2 *. 100.0)) in + + let rec rec_verify = + let rec apply_trans sub_ths th0 acc = + match sub_ths with + | [] -> rev acc + | th :: ths -> + let th' = eval_subset_trans th th0 in + apply_trans ths th' (th' :: acc) in + + let rec mk_domains mono th0 acc = + match mono with + | [] -> rev acc + | m :: ms -> + let j, flag = m.variable, m.decr_flag in + let ths = restrict_domain n j flag th0 in + mk_domains ms (fst ths) (ths :: acc) in + + let verify_mono mono domain_th certificate = + let domain, _, _ = (dest_m_cell_domain o concl) domain_th in + let xx, zz = dest_pair domain in + let df0_flags = itlist (fun m b -> m.df0_flag & b) mono true in + let _ = !info_print_level < 2 or (report (sprintf "df0_flags = %b" df0_flags); true) in + let taylor_th, diff2_th = + if df0_flags then + TRUTH, fs.diff2_f xx zz + else + let t_th = fs.taylor pp pp domain_th in + let _, d_th, _, _ = dest_m_taylor_thms n t_th in + t_th, d_th in + + let domain_ths = mk_domains mono domain_th [] in +(* let domains = domain_th :: map fst (butlast domain_ths) in *) + +(* let gen_mono (m, domain_th) = *) + let gen_mono m = + if m.df0_flag then + if m.decr_flag then + eval_interval_arith_hi n (fs.df m.variable pp xx zz) + else + eval_interval_arith_lo n (fs.df m.variable pp xx zz) + else + if m.decr_flag then + eval_m_taylor_partial_upper n pp m.variable taylor_th + else + eval_m_taylor_partial_lower n pp m.variable taylor_th in + +(* let mono_ths = map gen_mono (zip mono domains) in *) + let mono_ths = map gen_mono mono in + let pass_th0 = rec_verify ((fst o last) domain_ths) certificate in + let sub_th0 = (eval_subset_refl o rand o concl o snd o hd) domain_ths in + let sub_ths = apply_trans (sub_th0 :: map snd (butlast domain_ths)) sub_th0 [] in + let th = rev_itlist (fun ((m, mono_th), sub_th) pass_th -> + let j, flag = m.variable, m.decr_flag in + m_mono_pass_gen n j flag diff2_th mono_th sub_th pass_th) + (rev (zip (zip mono mono_ths) sub_ths)) pass_th0 in + if hyp th <> [] then failwith ("hyp <> []: "^string_of_thm th) else th in + + + + fun domain_th certificate -> + match certificate with + | Result_mono (mono, r1) -> + let _ = !info_print_level < 2 or + (let mono_strs = + map (fun m -> sprintf "%s%d (%b)" (if m.decr_flag then "-" else "") + m.variable m.df0_flag) mono in + report (sprintf "Mono: [%s]" (String.concat ";" mono_strs)); true) in + verify_mono mono domain_th r1 + + | Result_pass (_, f0_flag) -> + let _ = k := !k + 1 in + let _ = !info_print_level < 2 or + (report (sprintf "Verifying: %d/%d (f0_flag = %b)" !k r_size f0_flag); true) in + let _ = !info_print_level < 1 or + (let r = int_of_float (float_of_int !kk /. r_size2 *. 100.0) in + let _ = if r <> !last_report then (last_report := r; report0 (sprintf "%d " r)) else () in true) in + if f0_flag then + let domain, _, _ = (dest_m_cell_domain o concl) domain_th in + let xx, zz = dest_pair domain in + m_taylor_cell_pass0 n (fs.f pp xx zz) + else + let taylor_th = fs.taylor pp pp domain_th in + m_taylor_cell_pass n pp taylor_th + + | Result_glue (i, convex_flag, r1, r2) -> + let domain1_th, domain2_th = + if convex_flag then + let d1, _ = restrict_domain n (i + 1) true domain_th in + let d2, _ = restrict_domain n (i + 1) false domain_th in + d1, d2 + else + split_domain n pp (i + 1) domain_th in + let th1 = rec_verify domain1_th r1 in + let th2 = rec_verify domain2_th r2 in + if convex_flag then + let _ = !info_print_level < 2 or (report (sprintf "GlueConvex: %d" (i + 1)); true) in + let domain, _, _ = (dest_m_cell_domain o concl) domain_th in + let xx, zz = dest_pair domain in + let diff2_th = fs.diff2_f xx zz in + let partial2_th = fs.ddf (i + 1) (i + 1) pp xx zz in + let lo_partial2_th = eval_interval_arith_lo n partial2_th in + m_convex_pass n (i + 1) diff2_th lo_partial2_th th1 th2 + else + m_glue_cells n (i + 1) th1 th2 + + | Result_pass_ref i -> + let _ = !info_print_level < 2 or (report (sprintf "Ref: %d" i); true) in + if i > 0 then + List.nth th_list (i - 1) + else + let domain, _, _ = (dest_m_cell_domain o concl) domain_th in + let pass_th = List.nth th_list (-i - 1) in + m_cell_pass_subdomain domain pass_th + + | _ -> failwith "False result" in + + rec_verify domain_th0 certificate;; + + +(*****************) + + +let m_verify_raw0 n pp fs certificate xx zz = + m_verify_raw (0, 0) n pp fs certificate (mk_m_center_domain n pp xx zz) [];; + + + +let m_verify_list n pp fs certificate_list xx zz = + let domain_hash = Hashtbl.create (length certificate_list * 10) in + let mem, find, add = Hashtbl.mem domain_hash, + Hashtbl.find domain_hash, Hashtbl.add domain_hash in + + let get_m_cell_domain n pp domain0 path = + let rec get_rec domain_th path hash = + match path with + | [] -> domain_th + | (s, j) :: ps -> + let hash' = hash^s^(string_of_int j) in + if mem hash' then + get_rec (find hash') ps hash' + else + if s = "l" or s = "r" then + let domain1_th, domain2_th = split_domain n pp j domain_th in + let hash1 = hash^"l"^(string_of_int j) and + hash2 = hash^"r"^(string_of_int j) in + let _ = add hash1 domain1_th; add hash2 domain2_th in + if s = "l" then + get_rec domain1_th ps hash' + else + get_rec domain2_th ps hash' + else + let l_flag = (s = "ml") in + let domain_th', _ = restrict_domain n j l_flag domain_th in + let _ = add hash' domain_th' in + get_rec domain_th' ps hash' in + get_rec domain0 path "" in + + let domain_th0 = mk_m_center_domain n pp xx zz in + let size = length certificate_list in + let k = ref 0 in + let kk = ref 0 in + let total_size = end_itlist (+) (map (result_size o snd) certificate_list) in + + let rec rec_verify certificate_list th_list = + match certificate_list with + | [] -> last th_list + | (path, certificate) :: cs -> + let _ = k := !k + 1 in + let _ = !info_print_level < 2 or (report (sprintf "List: %d/%d" !k size); true) in + let domain_th = get_m_cell_domain n pp domain_th0 path in + let th = m_verify_raw (!kk, total_size) n pp fs certificate domain_th th_list in + let _ = kk := !kk + result_size certificate in + rec_verify cs (th_list @ [th]) in + rec_verify certificate_list [];; + + +(***************************) +(* Verification based on a p_result_tree *) + +let m_p_verify_raw (report_start, total_size) n p_split fs certificate domain_th0 th_list = + let r_size = p_result_size certificate in + let r_size2 = float_of_int (if total_size > 0 then total_size else (if r_size > 0 then r_size else 1)) in + let k = ref 0 in + let kk = ref report_start in + let last_report = ref (int_of_float (float_of_int !kk /. r_size2 *. 100.0)) in + + let rec rec_verify = + let rec apply_trans sub_ths th0 acc = + match sub_ths with + | [] -> rev acc + | th :: ths -> + let th' = eval_subset_trans th th0 in + apply_trans ths th' (th' :: acc) in + + let rec mk_domains mono th0 acc = + match mono with + | [] -> rev acc + | m :: ms -> + let j, flag = m.variable, m.decr_flag in + let ths = restrict_domain n j flag th0 in + mk_domains ms (fst ths) (ths :: acc) in + + let verify_mono p_stat mono domain_th certificate = + let domain, _, _ = (dest_m_cell_domain o concl) domain_th in + let xx, zz = dest_pair domain in + let df0_flags = itlist (fun m b -> m.df0_flag & b) mono true in + let _ = !info_print_level < 2 or (report (sprintf "df0_flags = %b" df0_flags); true) in + let taylor_th, diff2_th = + if df0_flags then + TRUTH, fs.diff2_f xx zz + else + let t_th = fs.taylor p_stat.pp p_stat.pp domain_th in + let _, d_th, _, _ = dest_m_taylor_thms n t_th in + t_th, d_th in + + let domain_ths = mk_domains mono domain_th [] in + let gen_mono m = + if m.df0_flag then + if m.decr_flag then + eval_interval_arith_hi n (fs.df m.variable p_stat.pp xx zz) + else + eval_interval_arith_lo n (fs.df m.variable p_stat.pp xx zz) + else + if m.decr_flag then + eval_m_taylor_partial_upper n p_stat.pp m.variable taylor_th + else + eval_m_taylor_partial_lower n p_stat.pp m.variable taylor_th in + let mono_ths = map gen_mono mono in + let pass_th0 = rec_verify ((fst o last) domain_ths) certificate in + let sub_th0 = (eval_subset_refl o rand o concl o snd o hd) domain_ths in + let sub_ths = apply_trans (sub_th0 :: map snd (butlast domain_ths)) sub_th0 [] in + let th = rev_itlist (fun ((m, mono_th), sub_th) pass_th -> + let j, flag = m.variable, m.decr_flag in + m_mono_pass_gen n j flag diff2_th mono_th sub_th pass_th) + (rev (zip (zip mono mono_ths) sub_ths)) pass_th0 in + if hyp th <> [] then failwith ("hyp <> []: "^string_of_thm th) else th in + + + + fun domain_th certificate -> + match certificate with + | P_result_mono (p_stat, mono, r1) -> + let _ = !info_print_level < 2 or + (let mono_strs = + map (fun m -> sprintf "%s%d (%b)" (if m.decr_flag then "-" else "") + m.variable m.df0_flag) mono in + report (sprintf "Mono: [%s]" (String.concat ";" mono_strs)); true) in + verify_mono p_stat mono domain_th r1 + + | P_result_pass (p_stat, _, f0_flag) -> + let _ = k := !k + 1; kk := !kk + 1 in + let _ = !info_print_level < 2 or + (report (sprintf "Verifying: %d/%d (f0_flag = %b)" !k r_size f0_flag); true) in + let _ = !info_print_level <> 1 or + (let r = int_of_float (float_of_int !kk /. r_size2 *. 100.0) in + let _ = if r <> !last_report then (last_report := r; report0 (sprintf "%d " r)) else () in true) in + if f0_flag then + let domain, _, _ = (dest_m_cell_domain o concl) domain_th in + let xx, zz = dest_pair domain in + m_taylor_cell_pass0 n (fs.f p_stat.pp xx zz) + else + let taylor_th = fs.taylor p_stat.pp p_stat.pp domain_th in + m_taylor_cell_pass n p_stat.pp taylor_th + + | P_result_glue (p_stat, i, convex_flag, r1, r2) -> + let domain1_th, domain2_th = + if convex_flag then + let d1, _ = restrict_domain n (i + 1) true domain_th in + let d2, _ = restrict_domain n (i + 1) false domain_th in + d1, d2 + else + split_domain n p_split (i + 1) domain_th in + let th1 = rec_verify domain1_th r1 in + let th2 = rec_verify domain2_th r2 in + if convex_flag then + let _ = !info_print_level < 2 or (report (sprintf "GlueConvex: %d" (i + 1)); true) in + let domain, _, _ = (dest_m_cell_domain o concl) domain_th in + let xx, zz = dest_pair domain in + let diff2_th = fs.diff2_f xx zz in + let partial2_th = fs.ddf (i + 1) (i + 1) p_stat.pp xx zz in + let lo_partial2_th = eval_interval_arith_lo n partial2_th in + m_convex_pass n (i + 1) diff2_th lo_partial2_th th1 th2 + else + m_glue_cells n (i + 1) th1 th2 + + | P_result_ref i -> + let _ = !info_print_level < 2 or (report (sprintf "Ref: %d" i); true) in + if i > 0 then + List.nth th_list (i - 1) + else + let domain, _, _ = (dest_m_cell_domain o concl) domain_th in + let pass_th = List.nth th_list (-i - 1) in + m_cell_pass_subdomain domain pass_th in + + rec_verify domain_th0 certificate;; + +(*****************) + +let m_p_verify_raw0 n p_split fs certificate xx zz = + m_p_verify_raw (0, 0) n p_split fs certificate (mk_m_center_domain n p_split xx zz) [];; + + + +let m_p_verify_list n p_split fs certificate_list xx zz = + let domain_hash = Hashtbl.create (length certificate_list * 10) in + let mem, find, add = Hashtbl.mem domain_hash, + Hashtbl.find domain_hash, Hashtbl.add domain_hash in + + let get_m_cell_domain n pp domain0 path = + let rec get_rec domain_th path hash = + match path with + | [] -> domain_th + | (s, j) :: ps -> + let hash' = hash^s^(string_of_int j) in + if mem hash' then + get_rec (find hash') ps hash' + else + if s = "l" or s = "r" then + let domain1_th, domain2_th = split_domain n pp j domain_th in + let hash1 = hash^"l"^(string_of_int j) and + hash2 = hash^"r"^(string_of_int j) in + let _ = add hash1 domain1_th; add hash2 domain2_th in + if s = "l" then + get_rec domain1_th ps hash' + else + get_rec domain2_th ps hash' + else + let l_flag = (s = "ml") in + let domain_th', _ = restrict_domain n j l_flag domain_th in + let _ = add hash' domain_th' in + get_rec domain_th' ps hash' in + get_rec domain0 path "" in + + let domain_th0 = mk_m_center_domain n p_split xx zz in + let size = length certificate_list in + let k = ref 0 in + let kk = ref 0 in + let total_size = end_itlist (+) (map (p_result_size o snd) certificate_list) in + + let rec rec_verify certificate_list th_list = + match certificate_list with + | [] -> last th_list + | (path, certificate) :: cs -> + let _ = k := !k + 1 in + let _ = !info_print_level < 2 or (report (sprintf "List: %d/%d" !k size); true) in + let domain_th = get_m_cell_domain n p_split domain_th0 path in + let th = m_p_verify_raw (!kk, total_size) n p_split fs certificate domain_th th_list in + let _ = kk := !kk + p_result_size certificate in + rec_verify cs (th_list @ [th]) in + rec_verify certificate_list [];; + + +(*************************************) +(* disjunctions *) + + +let m_verify_list_raw (report_start, total_size) n pp fs_list certificate domain_th0 th_list = + let r_size = result_size certificate in + let r_size2 = float_of_int (if total_size > 0 then total_size else (if r_size > 0 then r_size else 1)) in + let k = ref 0 in + let kk = ref report_start in + let last_report = ref (int_of_float (float_of_int !kk /. r_size2 *. 100.0)) in + + let rec rec_verify = + let rec apply_trans sub_ths th0 acc = + match sub_ths with + | [] -> rev acc + | th :: ths -> + let th' = eval_subset_trans th th0 in + apply_trans ths th' (th' :: acc) in + + let rec mk_domains mono th0 acc = + match mono with + | [] -> rev acc + | m :: ms -> + let j, flag = m.variable, m.decr_flag in + let ths = restrict_domain n j flag th0 in + mk_domains ms (fst ths) (ths :: acc) in +(* + let verify_mono mono domain_th certificate = + let domain, _, _ = (dest_m_cell_domain o concl) domain_th in + let xx, zz = dest_pair domain in + let df0_flags = itlist (fun m b -> m.df0_flag & b) mono true in + let _ = !info_print_level < 2 or (report (sprintf "df0_flags = %b" df0_flags); true) in + let taylor_th, diff2_th = + if df0_flags then + TRUTH, fs.diff2_f xx zz + else + let t_th = fs.taylor pp pp domain_th in + let _, d_th, _, _ = dest_m_taylor_thms n t_th in + t_th, d_th in + + let domain_ths = mk_domains mono domain_th [] in +(* let domains = domain_th :: map fst (butlast domain_ths) in *) + +(* let gen_mono (m, domain_th) = *) + let gen_mono m = + if m.df0_flag then + if m.decr_flag then + eval_interval_arith_hi n (fs.df m.variable pp xx zz) + else + eval_interval_arith_lo n (fs.df m.variable pp xx zz) + else + if m.decr_flag then + eval_m_taylor_partial_upper n pp m.variable taylor_th + else + eval_m_taylor_partial_lower n pp m.variable taylor_th in + +(* let mono_ths = map gen_mono (zip mono domains) in *) + let mono_ths = map gen_mono mono in + let pass_th0 = rec_verify ((fst o last) domain_ths) certificate in + let sub_th0 = (eval_subset_refl o rand o concl o snd o hd) domain_ths in + let sub_ths = apply_trans (sub_th0 :: map snd (butlast domain_ths)) sub_th0 [] in + let th = rev_itlist (fun ((m, mono_th), sub_th) pass_th -> + let j, flag = m.variable, m.decr_flag in + m_mono_pass_gen n j flag diff2_th mono_th sub_th pass_th) + (rev (zip (zip mono mono_ths) sub_ths)) pass_th0 in + if hyp th <> [] then failwith ("hyp <> []: "^string_of_thm th) else th in +*) + + + fun domain_th certificate -> + match certificate with + | Result_mono (mono, r1) -> + failwith "Mono: not implemented" + (* + let _ = !info_print_level < 2 or + (let mono_strs = + map (fun m -> sprintf "%s%d (%b)" (if m.decr_flag then "-" else "") + m.variable m.df0_flag) mono in + report (sprintf "Mono: [%s]" (String.concat ";" mono_strs)); true) in + verify_mono mono domain_th r1 + *) + + | Result_pass (j, f0_flag) -> + let _ = k := !k + 1 in + let _ = !info_print_level < 2 or + (report (sprintf "Verifying: %d/%d (f0_flag = %b)" !k r_size f0_flag); true) in + let _ = !info_print_level < 1 or + (let r = int_of_float (float_of_int !kk /. r_size2 *. 100.0) in + let _ = if r <> !last_report then (last_report := r; report0 (sprintf "%d " r)) else () in true) in + let fs = List.nth fs_list j in + if f0_flag then + let domain, _, _ = (dest_m_cell_domain o concl) domain_th in + let xx, zz = dest_pair domain in + m_taylor_cell_list_pass0 n (fs.f pp xx zz) + else + let taylor_th = fs.taylor pp pp domain_th in + m_taylor_cell_list_pass n pp taylor_th + + | Result_glue (i, convex_flag, r1, r2) -> + let domain1_th, domain2_th = + if convex_flag then + let d1, _ = restrict_domain n (i + 1) true domain_th in + let d2, _ = restrict_domain n (i + 1) false domain_th in + d1, d2 + else + split_domain n pp (i + 1) domain_th in + let th1 = rec_verify domain1_th r1 in + let th2 = rec_verify domain2_th r2 in + if convex_flag then + failwith "convexity: not implemented" + (* + let _ = !info_print_level < 2 or (report (sprintf "GlueConvex: %d" (i + 1)); true) in + let domain, _, _ = (dest_m_cell_domain o concl) domain_th in + let xx, zz = dest_pair domain in + let diff2_th = fs.diff2_f xx zz in + let partial2_th = fs.ddf (i + 1) (i + 1) pp xx zz in + let lo_partial2_th = eval_interval_arith_lo n partial2_th in + m_convex_pass n (i + 1) diff2_th lo_partial2_th th1 th2 + *) + else + let th0 = m_glue_cells_list n (i + 1) th1 th2 in + merge_m_cell_list_pass n th0 + + | Result_pass_ref i -> + let _ = !info_print_level < 2 or (report (sprintf "Ref: %d" i); true) in + if i > 0 then + List.nth th_list (i - 1) + else + let domain, _, _ = (dest_m_cell_domain o concl) domain_th in + let pass_th = List.nth th_list (-i - 1) in + m_cell_list_pass_subdomain domain pass_th + + | _ -> failwith "False result" in + + rec_verify domain_th0 certificate;; + + +(*****************) + + +let m_verify_list_raw0 n pp fs_list certificate xx zz = + m_verify_list_raw (0, 0) n pp fs_list certificate (mk_m_center_domain n pp xx zz) [];; + + + + +(* end;; *) + +m_verify_list_raw0 2 pp [formal_f1; formal_f2] cert xx_float_tm zz_float_tm;; diff --git a/formal_ineqs/verifier/m_verifier_build.hl b/formal_ineqs/verifier/m_verifier_build.hl new file mode 100644 index 0000000..d5dd080 --- /dev/null +++ b/formal_ineqs/verifier/m_verifier_build.hl @@ -0,0 +1,214 @@ +(* =========================================================== *) +(* Auxiliary formal verification functions *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +needs "arith/eval_interval.hl";; +needs "arith/more_float.hl";; +needs "taylor/m_taylor.hl";; +needs "verifier/interval_m/taylor.ml";; +needs "informal/informal_m_verifier.hl";; +needs "verifier_options.hl";; +needs "misc/vars.hl";; + +module M_verifier_build = struct + +open More_float;; +open Eval_interval;; +open M_taylor;; + +open Interval_types;; +open Interval;; +open Line_interval;; +open Taylor;; + +open Misc_vars;; +open Verifier_options;; + +type verification_funs = +{ + (* p_lin -> p_second -> domain_th -> taylor_th *) + taylor : int -> int -> thm -> thm; + (* pp -> lo -> hi -> interval_th *) + f : int -> term -> term -> thm; + (* i -> pp -> lo -> hi -> interval_th *) + df : int -> int -> term -> term -> thm; + (* i -> j -> pp -> lo -> hi -> interval_th *) + ddf : int -> int -> int -> term -> term -> thm; + (* lo -> hi -> diff2_th *) + diff2_f : term -> term -> thm; +};; + +(****************************) +(* Interval polynomial functions for the native OCaml arithmetic *) + +type int_poly_fun = + | F_int_var of int + | F_int_const of interval + | F_int_pow of int * int_poly_fun + | F_int_neg of int_poly_fun + | F_int_add of int_poly_fun * int_poly_fun + | F_int_sub of int_poly_fun * int_poly_fun + | F_int_mul of int_poly_fun * int_poly_fun;; + + +let ipow = Arith_misc.gen_pow imul Interval.one;; + + +let eval_int_poly_fun i_fun = + fun x -> + let rec eval_rec f = + match f with + | F_int_var i -> List.nth x (i - 1) + | F_int_const int -> int + | F_int_neg f1 -> ineg (eval_rec f1) + | F_int_pow (n,f1) -> ipow n (eval_rec f1) + | F_int_add (f1,f2) -> iadd (eval_rec f1) (eval_rec f2) + | F_int_sub (f1,f2) -> isub (eval_rec f1) (eval_rec f2) + | F_int_mul (f1,f2) -> imul (eval_rec f1) (eval_rec f2) in + eval_rec i_fun;; + +(****************************) +(* Automatic conversion of formal interval polynomials into functions (polynomials) *) +(* TODO: take Int_ref into account *) + +let rec build_poly_fun i_fun = + match i_fun with + | Int_var tm -> + (try F_int_var (dest_small_numeral (rand tm)) + with Failure _ -> + let name = (fst o dest_var) tm in + F_int_var (int_of_string (String.sub name 1 (String.length name - 1)))) + | Int_const th -> + let f1, f2 = (dest_pair o rand o concl) th in + let int = mk_interval (float_of_float_tm f1, float_of_float_tm f2) in + F_int_const int + | Int_pow (n, f) -> F_int_pow (n, build_poly_fun f) + | Int_unary (op, f) -> + let f' = build_poly_fun f in + if op = neg_op_real then F_int_neg f' else failwith ("Unsupported operator: "^string_of_term op) + | Int_binary (op, f1, f2) -> + let f1', f2' = build_poly_fun f1, build_poly_fun f2 in + if op = add_op_real then F_int_add (f1',f2') + else if op = sub_op_real then F_int_sub (f1',f2') + else if op = mul_op_real then F_int_mul (f1',f2') + else failwith ("Unsupported operator: "^string_of_term op) + | _ -> failwith "Unsupported function";; + + +let build_polyL pp lin_th = + let funs = map (fst o dest_interval_arith) ((striplist dest_conj o rand o concl) lin_th) in + let i_funs = map (eval_constants pp o build_interval_fun) funs in + let fs = map build_poly_fun i_funs @ (replicate (F_int_const zero) (8 - length funs + 1)) in + let eval_fs = map eval_int_poly_fun fs in + let f, df = hd eval_fs, tl eval_fs in + (fun i x z -> + let vars = map2 (curry mk_interval) x z in + if i = 0 then f vars else (List.nth df (i - 1)) vars), + (fun x -> + let vars = map (fun x -> mk_interval (x,x)) x in + mk_line (f vars, map (fun df -> df vars) df));; + +let build_polyL0 pp poly_tm = + let lin_th = gen_lin_approx_poly_thm0 poly_tm in + build_polyL pp lin_th;; + +let build_polyDD pp second_th = + let poly_tm = (lhand o rator o lhand o concl) second_th in + let n = (get_dim o fst o dest_abs) poly_tm in + let ns = 1--n in + let funs = (striplist dest_conj o rand o snd o dest_forall o rand o concl) second_th in + let i_funs = map (eval_constants pp o build_interval_fun o fst o dest_interval_arith) funs in + let fs0 = map build_poly_fun i_funs in + let pad1 = replicate zero (8 - n) and + pad2 = replicate zero 8 in + let pad3 = replicate pad2 (8 - n) in + let get_el dd i j = + let i', j' = if j <= i then i, j else j, i in + let index = (i' - 1) * i' / 2 + (j' - 1) in + List.nth dd index in + let eval_fs = map eval_int_poly_fun fs0 in + fun x z -> + let ints = map2 (curry mk_interval) x z in + let vals = map (fun f -> f ints) eval_fs in + map (fun i -> map (fun j -> get_el vals i j) ns @ pad1) ns @ pad3;; + + +let build_polyDD0 pp poly_tm = + let second_th = gen_second_bounded_poly_thm0 poly_tm in + build_polyDD pp second_th;; + + +(******) + +let build_poly_taylor pp lin_th second_th = + let f_df, lin = build_polyL pp lin_th and + dd = build_polyDD pp second_th in + Prim_a (make_primitiveA (f_df, lin, dd));; + +let build_poly_taylor0 pp poly_tm = + build_poly_taylor pp (gen_lin_approx_poly_thm0 poly_tm) (gen_second_bounded_poly_thm0 poly_tm);; + + +(**********************************) +(* mk_verification_functions *) + +let mk_verification_functions_poly pp0 poly_tm = + let x_tm, body_tm = dest_abs poly_tm in + let new_f = poly_tm in + let n = get_dim x_tm in + + let _ = !info_print_level = 0 or (report0 (sprintf "Computing partial derivatives (%d)..." n); true) in + let partials = map (fun i -> + let _ = !info_print_level = 0 or (report0 (sprintf " %d" i); true) in + gen_partial_poly i new_f) (1--n) in + let get_partial i eq_th = + let partial_i = gen_partial_poly i (rand (concl eq_th)) in + let pi = (rator o lhand o concl) partial_i in + REWRITE_RULE[GSYM partial2] (TRANS (AP_TERM pi eq_th) partial_i) in + let partials2 = map (fun j -> + let th = List.nth partials (j - 1) in + map (fun i -> + let _ = !info_print_level = 0 or (report0 (sprintf " %d,%d" j i); true) in + get_partial i th) (1--j)) (1--n) in + + let _ = !info_print_level = 0 or (report0 " done\n"; true) in + + let diff_th = gen_diff_poly new_f in + let lin_th = gen_lin_approx_poly_thm new_f diff_th partials in + let diff2_th = gen_diff2c_domain_poly new_f in + let second_th = gen_second_bounded_poly_thm new_f partials2 in + + let replace_numeral i th = + let num_eq = (REWRITE_RULE[Arith_hash.NUM_THM] o Arith_nat.NUMERAL_TO_NUM_CONV) + (mk_small_numeral i) in + GEN_REWRITE_RULE (LAND_CONV o RATOR_CONV o DEPTH_CONV) [num_eq] th in + + let eval0 = mk_eval_function pp0 new_f in + let eval1 = map (fun i -> + let d_th = List.nth partials (i - 1) in + let eq_th = replace_numeral i d_th in + mk_eval_function_eq pp0 eq_th) (1--n) in + + let eval2 = map (fun i -> + map (fun j -> + let d2_th = List.nth (List.nth partials2 (i - 1)) (j - 1) in + let eq_th' = replace_numeral i d2_th in + let eq_th = replace_numeral j eq_th' in + mk_eval_function_eq pp0 eq_th) (1--i)) (1--n) in + + let diff2_f = eval_diff2_poly diff2_th in + let eval_f = eval_m_taylor pp0 diff2_th lin_th second_th in + let taylor_f = build_poly_taylor pp0 lin_th second_th in + {taylor = eval_f; + f = eval0; + df = (fun i -> List.nth eval1 (i - 1)); + ddf = (fun i j -> List.nth (List.nth eval2 (j - 1)) (i - 1)); + diff2_f = diff2_f; + }, taylor_f, Informal_verifier.mk_verification_functions_poly pp0 new_f partials partials2;; + + + + +end;; diff --git a/formal_ineqs/verifier/m_verifier_main.hl b/formal_ineqs/verifier/m_verifier_main.hl new file mode 100644 index 0000000..81a07df --- /dev/null +++ b/formal_ineqs/verifier/m_verifier_main.hl @@ -0,0 +1,463 @@ +(* =========================================================== *) +(* Main formal verification functions *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +needs "verifier/interval_m/verifier.ml";; +needs "verifier/m_verifier.hl";; +needs "verifier/m_verifier_build.hl";; +needs "taylor/m_taylor_arith2.hl";; +needs "misc/vars.hl";; + +#load "unix.cma";; + +module M_verifier_main = struct + +open Arith_misc;; +open Interval_arith;; +open Eval_interval;; +open More_float;; +open M_verifier;; +open M_verifier_build;; +open M_taylor;; +open M_taylor_arith2;; +open Taylor;; +open Misc_vars;; +open Verifier_options;; + + + +(* Parameters *) +type verification_parameters = +{ + (* If true, then monotonicity properties can be used *) + (* to reduce the dimension of a problem *) + allow_derivatives : bool; + (* If true, then convexity can be used *) + (* to reduce the dimension of a problem *) + convex_flag : bool; + (* If true, then verification on internal subdomains can be skipped *) + (* for a monotone function *) + mono_pass_flag : bool; + (* If true, then raw interval arithmetic can be used *) + (* (without Taylor approximations) *) + raw_intervals_flag : bool; + (* If true, then an informal procedure is used to determine *) + (* the optimal precision for the formal verification *) + adaptive_precision : bool; + (* This parameter might be used in cases when the certificate search *) + (* procedure returns a wrong result due to rounding errors *) + (* (this parameter will be eliminated when the search procedure is corrected) *) + eps : float; +};; + +let default_params = +{ + allow_derivatives = true; + convex_flag = true; + mono_pass_flag = true; + raw_intervals_flag = true; + adaptive_precision = true; + eps = 0.0; +};; + + +type verification_stats = +{ + total_time : float; + formal_verification_time : float; + certificate : Verifier.certificate_stats; +};; + + +(********************************) + +(* Adds a constant approximation to the table of known constants *) +let add_constant_interval int_th = + Eval_interval.add_constant_interval int_th; + Informal_eval_interval.add_constant_interval int_th;; + + +(* Tests if an expression has only given binary and unary operations *) +let test_expression bin_ops unary_ops = + let rec test = + (* Tests if the expression is in the form `a$i` *) + let test_vector tm = + let var, index = dest_binary "$" tm in + dest_var var, dest_small_numeral index in + (* Tests if the expression is a valid binary operation *) + let test_binary tm = + try + let lhs, rhs = dest_comb tm in + let op, lhs = dest_comb lhs in + let c, _ = dest_const op in + if mem c bin_ops then (test lhs && test rhs) else false + with Failure _ -> false in + (* Tests if the expression is a valid unary operation *) + let test_unary tm = + try + let lhs, rhs = dest_comb tm in + let c, _ = dest_const lhs in + if mem c unary_ops then test rhs else false + with Failure _ -> false in + + fun tm -> + frees tm = [] or + can dest_var tm or + can test_vector tm or + test_unary tm or + test_binary tm in + test;; + + +(* Tests if the given expression is a polynomial expression *) +let is_poly = + let bin_ops = ["real_add"; "real_mul"; "real_sub"; "real_pow"] in + let unary_ops = ["real_neg"] in + test_expression bin_ops unary_ops;; + + +(**********************************) + +(* Creates basic verification functions *) +let rec mk_funs = + (* add *) + let mk_add n (f1, tf1, ti1) (f2, tf2, ti2) = + (fun p1 p2 x -> + let a = f1 p1 p2 x and + b = f2 p1 p2 x in + eval_m_taylor_add2 n p1 p2 a b), + Plus (tf1, tf2), + (fun p1 p2 x -> + let a = ti1 p1 p2 x and + b = ti2 p1 p2 x in + Informal_taylor.eval_m_taylor_add p1 p2 a b) in + (* sub *) + let mk_sub n (f1, tf1, ti1) (f2, tf2, ti2) = + let neg_one = Interval.mk_interval(-1.0, -1.0) in + (fun p1 p2 x -> + let a = f1 p1 p2 x and + b = f2 p1 p2 x in + eval_m_taylor_sub2 n p1 p2 a b), + Plus (tf1, Scale(tf2, neg_one)), + (fun p1 p2 x -> + let a = ti1 p1 p2 x and + b = ti2 p1 p2 x in + Informal_taylor.eval_m_taylor_sub p1 p2 a b) in + (* mul *) + let mk_mul n (f1, tf1, ti1) (f2, tf2, ti2) = + (fun p1 p2 x -> + let a = f1 p1 p2 x and + b = f2 p1 p2 x in + eval_m_taylor_mul2 n p1 p2 a b), + Product (tf1, tf2), + (fun p1 p2 x -> + let a = ti1 p1 p2 x and + b = ti2 p1 p2 x in + Informal_taylor.eval_m_taylor_mul p1 p2 a b) in + (* neg *) + let mk_neg n (f1, tf1, ti1) = + (fun p1 p2 x -> + let a = f1 p1 p2 x in + eval_m_taylor_neg2 n a), + Scale (tf1, Interval.mk_interval (-1.0, -1.0)), + (fun p1 p2 x -> + let a = ti1 p1 p2 x in + Informal_taylor.eval_m_taylor_neg a) in + (* sqrt *) + let mk_sqrt n (f1, tf1, ti1) = + (fun p1 p2 x -> + let a = f1 p1 p2 x in + eval_m_taylor_sqrt2 n p1 p2 a), + Uni_compose (Univariate.usqrt, tf1), + (fun p1 p2 x -> + let a = ti1 p1 p2 x in + Informal_taylor.eval_m_taylor_sqrt p1 p2 a) in + (* inv *) + let mk_inv n (f1, tf1, ti1) = + (fun p1 p2 x -> + let a = f1 p1 p2 x in + eval_m_taylor_inv2 n p1 p2 a), + Uni_compose (Univariate.uinv, tf1), + (fun p1 p2 x -> + let a = ti1 p1 p2 x in + Informal_taylor.eval_m_taylor_inv p1 p2 a) in + (* atn *) + let mk_atn n (f1, tf1, ti1) = + (fun p1 p2 x -> + let a = f1 p1 p2 x in + eval_m_taylor_atn2 n p1 p2 a), + Uni_compose (Univariate.uatan, tf1), + (fun p1 p2 x -> + let a = ti1 p1 p2 x in + Informal_taylor.eval_m_taylor_atn p1 p2 a) in + (* acs *) + let mk_acs n (f1, tf1, ti1) = + (fun p1 p2 x -> + let a = f1 p1 p2 x in + eval_m_taylor_acs2 n p1 p2 a), + Uni_compose (Univariate.uacos, tf1), + (fun p1 p2 x -> + let a = ti1 p1 p2 x in + Informal_taylor.eval_m_taylor_acs p1 p2 a) in + (* binary operations *) + let bin_ops = + ["real_add", mk_add; + "real_sub", mk_sub; + "real_mul", mk_mul] in + (* unary operations *) + let unary_ops = + ["real_neg", mk_neg; + "sqrt", mk_sqrt; + "atn", mk_atn; + "acs", mk_acs; + "real_inv", mk_inv] in + (* makes a binary operation *) + let mk_bin n pp x_var tm = + let lhs, rhs = dest_comb tm in + let op, lhs = dest_comb lhs in + let mk_f = assoc ((fst o dest_const) op) bin_ops in + let l_funs = mk_funs n pp (mk_abs(x_var, lhs)) and + r_funs = mk_funs n pp (mk_abs(x_var, rhs)) in + mk_f n l_funs r_funs in + (* makes an unary operation *) + let mk_unary n pp x_var tm = + let op, rhs = dest_comb tm in + let mk_f = assoc ((fst o dest_const) op) unary_ops in + let funs = mk_funs n pp (mk_abs(x_var, rhs)) in + mk_f n funs in + (* the main function *) + fun n pp fun_tm -> + let x_var, body_tm = dest_abs fun_tm in + if is_poly body_tm then + let eval_fs, tf, ti = mk_verification_functions_poly pp fun_tm in + eval_fs.taylor, tf, ti.Informal_verifier.taylor + else + try mk_bin n pp x_var body_tm with Failure _ -> + mk_unary n pp x_var body_tm;; + + +(* Prepares verification functions *) +(* fun_tm must be in the form `\x. f x` *) +let mk_verification_functions = + let dummy_f pp lo hi = failwith "dummy f" and + dummy_df i pp lo hi = failwith "dummy df" and + dummy_ddf i j pp lo hi = failwith "dummy ddf" and + dummy_diff2 lo hi = failwith "dummy diff2" in + fun params pp fun_tm -> + let x_var, body_tm = dest_abs fun_tm in + if is_poly body_tm then + mk_verification_functions_poly pp fun_tm + else + let n = get_dim x_var in + let eval_taylor, tf, eval_ti = mk_funs n pp fun_tm in + let _ = params := {!params with raw_intervals_flag = false; convex_flag = false} in + {taylor = eval_taylor; + f = dummy_f; df = dummy_df; ddf = dummy_ddf; diff2_f = dummy_diff2}, tf, + {Informal_verifier.taylor = eval_ti; + Informal_verifier.f = dummy_f; + Informal_verifier.df = dummy_df; + Informal_verifier.ddf = dummy_ddf};; + + +(********************************) + +let convert_to_float_list pp lo_flag list_tm = + let tms = dest_list list_tm in + let i_funs = map build_interval_fun tms in + let ints = map (fun f -> eval_interval_fun pp f [] []) i_funs in + let extract = (if lo_flag then fst else snd) o dest_pair o rand o concl in + mk_list (map extract ints, real_ty);; + + +(* Creates a theorem |- interval[xx_tm, zz_tm] SUBSET interval[float(xx_tm), float(zz_tm)] + and two lists: float(xx_tm) and float(zz_tm) *) +let mk_float_domain pp (xx_tm, zz_tm) = + let xx_list = dest_list xx_tm and + zz_list = dest_list zz_tm in + let n = length xx_list in + let get_intervals tms = + let i_funs = map build_interval_fun tms in + map (fun f -> eval_interval_fun pp f [] []) i_funs in + let xx_ints = get_intervals xx_list and + zz_ints = get_intervals zz_list in + let xx_ineqs = map (CONJUNCT1 o ONCE_REWRITE_RULE[interval_arith]) xx_ints and + zz_ineqs = map (CONJUNCT2 o ONCE_REWRITE_RULE[interval_arith]) zz_ints in + let a_vals = map (lhand o concl) xx_ineqs and + b_vals = map (rand o concl) zz_ineqs in + let a_vars = mk_real_vars n "a" and + b_vars = mk_real_vars n "b" and + c_vars = mk_real_vars n "c" and + d_vars = mk_real_vars n "d" in + let th0 = (INST (zip xx_list c_vars) o INST (zip zz_list d_vars) o + INST (zip a_vals a_vars) o INST (zip b_vals b_vars)) + subset_interval_thms_array.(n) in + itlist MY_PROVE_HYP (xx_ineqs @ zz_ineqs) th0, + (mk_list (a_vals, real_ty), mk_list (b_vals, real_ty));; + + + +(* Given a term a < b, returns the theorem |- a - b < &0 <=> a < b *) +(* Also, deals with > and / *) +(* A user can provide additional rewrite theorems *) +let mk_standard_ineq = + let lemma = REAL_ARITH `a < b <=> a - b < &0` in + fun thms tm -> + let th0 = (REWRITE_CONV([real_gt; real_div] @ thms) THENC DEPTH_CONV let_CONV) tm in + let rhs = rand (concl th0) in + let th1 = (ONCE_REWRITE_CONV[lemma] THENC PURE_REWRITE_CONV[REAL_NEG_0; REAL_SUB_RZERO; REAL_SUB_LZERO]) rhs in + TRANS th0 th1;; + + +(* Converts a term in the form `x + y` into the term `\x:real^2. x$1 + x$2` *) +let expr_to_vector_fun = + let comp_op = `$` in + fun expr_tm -> + let vars = List.sort Pervasives.compare (frees expr_tm) in + let n = length vars in + let x_var = mk_var ("x", n_vector_type_array.(if n = 0 then 1 else n)) in + let x_tm = mk_icomb (comp_op, x_var) in + let vars2 = map (fun i -> mk_comb (x_tm, mk_small_numeral i)) (1--n) in + mk_abs (x_var, subst (zip vars2 vars) expr_tm), + (if n = 0 then mk_vector_list [x_var] else mk_vector_list vars);; + + +(* Given an inequality `P x y`, variable names and the corresponding bounds, + yields `(x0 <= x /\ x <= x1) /\ (y0 <= y /\ y <= y1) ==> P x y` *) +let mk_ineq ineq_tm names dom_tm = + let lo_list = dest_list (fst dom_tm) and + hi_list = dest_list (snd dom_tm) in + let vars = map (fun name -> mk_var (name, real_ty)) names in + let lo_ineqs = map2 (fun tm1 tm2 -> mk_binop le_op_real tm1 tm2) lo_list vars and + hi_ineqs = map2 (fun tm1 tm2 -> mk_binop le_op_real tm1 tm2) vars hi_list in + let ineqs = map2 (fun tm1 tm2 -> mk_conj (tm1, tm2)) lo_ineqs hi_ineqs in + let cond = end_itlist (curry mk_conj) ineqs in + mk_imp (cond, ineq_tm);; + + +(* Reverts the effect of mk_ineq function *) +let dest_ineq ineq_tm = + if frees ineq_tm = [] then + ineq_tm, [], (real_empty_list, real_empty_list) + else + let tm0 = (rand o concl o PURE_REWRITE_CONV[IMP_IMP; GSYM CONJ_ASSOC]) ineq_tm in + let cond, ineq = dest_imp tm0 in + let conds = striplist dest_conj cond in + let ineqs = ref [] in + let decode_ineq tm = + let lhs, rhs = dest_binop le_op_real tm in + let lo_flag = (frees lhs = []) in + let name = (fst o dest_var) (if lo_flag then rhs else lhs) in + let val_ref = + try assoc name !ineqs + with Failure _ -> + let val_ref = ref (x_var_real, x_var_real) in + ineqs := ((name, val_ref) :: !ineqs); val_ref in + val_ref := if lo_flag then (lhs, snd !val_ref) else (fst !val_ref, rhs) in + let _ = map (fun tm -> + (try decode_ineq tm with Failure _ -> + failwith ("Bad variable bound inequality: "^string_of_term tm))) conds in + let names, bounds0 = unzip !ineqs in + let lo, hi = unzip (map (fun r -> !r) bounds0) in + let test_bounds bounds bound_name = + let _ = map2 (fun tm name -> if frees tm <> [] then + failwith (bound_name^" bound is not defined for "^name) else ()) + bounds names in () in + let _ = test_bounds hi "Upper"; test_bounds lo "Lower" in + ineq, names, (mk_real_list lo, mk_real_list hi);; + +(*********************************) + +(* Normalizes a verification result *) +let normalize_result norm_flag v1 eq_th1 domain_sub_th pass_thm = + let th0 = REWRITE_RULE[m_cell_pass] pass_thm in + let n = (get_dim o fst o dest_forall o concl) th0 in + let th1 = SPEC v1 th0 in + let comp_thms = end_itlist CONJ (Array.to_list comp_thms_array.(n)) in + let th2 = REWRITE_RULE[comp_thms] th1 in + let th3 = (UNDISCH_ALL o REWRITE_RULE[GSYM eq_th1]) th2 in + let dom_th = (UNDISCH_ALL o SPEC v1 o REWRITE_RULE[SUBSET]) domain_sub_th in + let th4 = (DISCH_ALL o MY_PROVE_HYP dom_th) th3 in + let th5 = REWRITE_RULE[IN_INTERVAL; dimindex_array.(n); gen_in_interval n; comp_thms] th4 in + if norm_flag then GEN_ALL th5 else th4;; + + +(* Verifies the given inequality *) +(* Returns the final theorem and verification statistics *) +let verify_ineq0 params0 norm_flag pp ineq_tm var_names (lo_tm, hi_tm) rewrite_thms = + let total_start = Unix.gettimeofday() in + let eq_th1 = mk_standard_ineq rewrite_thms ineq_tm in + let ineq_tm1 = (lhand o rand o concl) eq_th1 in + if frees ineq_tm1 = [] then + let i_fun = build_interval_fun ineq_tm1 in + let th0 = eval_interval_fun pp i_fun [] [] in + let th1 = float_interval_lt0 th0 in + let total = Unix.gettimeofday() -. total_start in + REWRITE_RULE[GSYM eq_th1] th1, + {total_time = total; formal_verification_time = total; certificate = Verifier.dummy_stats} + else + let fun_tm, v1 = expr_to_vector_fun ineq_tm1 in + let vars = map (fst o dest_var) (dest_vector v1) in + let lo_list = dest_list lo_tm and + hi_list = dest_list hi_tm in + let bounds0 = zip var_names (zip lo_list hi_list) in + let bounds = itlist (fun name list -> assoc name bounds0 :: list) vars [] in + let xx, zz = unzip bounds in + let xx, zz = mk_real_list xx, mk_real_list zz in + + let domain_sub_th, (xx1, zz1) = mk_float_domain pp (xx, zz) in + let n = (get_dim o fst o dest_abs) fun_tm in + let xx2 = Informal_taylor.convert_to_float_list pp true xx and + zz2 = Informal_taylor.convert_to_float_list pp false zz in + let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1) in + + let params = ref params0 in + let eval_fs, tf, ti = mk_verification_functions params pp fun_tm in + + let _ = !info_print_level < 1 or (report0 "Constructing a solution certificate... "; true) in + let certificate = Verifier.run_test tf xx_float zz_float false 0.0 + !params.allow_derivatives !params.convex_flag !params.mono_pass_flag + !params.raw_intervals_flag !params.eps in + let stats = Verifier.result_stats certificate in + let _ = !info_print_level < 1 or (report0 " done\n"; true) in + let _ = !info_print_level < 1 or (Verifier.report_stats stats; true) in + + let c1 = Verifier.transform_result xx_float zz_float certificate in + let start, finish, result = + if !params.adaptive_precision then + let _ = !info_print_level < 1 or (report0 "Informal verification... "; true) in + let c1p = Informal_verifier.m_verify_list pp 1 pp ti c1 xx2 zz2 in + let _ = !info_print_level < 1 or (report0 " done\n"; true) in + + let _ = !info_print_level < 1 or (report0 "Formal verification... "; true) in + let start = Unix.gettimeofday() in + let result = m_p_verify_list n pp eval_fs c1p xx1 zz1 in + let finish = Unix.gettimeofday() in + let _ = !info_print_level < 1 or (report0 " done\n"; true) in + start, finish, result + else + let _ = !info_print_level < 1 or (report0 "Formal verification... "; true) in + let start = Unix.gettimeofday() in + let result = m_verify_list n pp eval_fs c1 xx1 zz1 in + let finish = Unix.gettimeofday() in + let _ = !info_print_level < 1 or (report0 " done\n"; true) in + start, finish, result in + normalize_result norm_flag v1 eq_th1 domain_sub_th result, + {total_time = finish -. total_start; formal_verification_time = finish -. start; certificate = stats};; + + +(* A simple verification function which accepts + a list of rewrite theorems which are applied to the inequality + before verification *) +let verify_ineq_and_rewrite rewrite_thms params pp ineq_tm = + let ineq, vars, bounds = dest_ineq ineq_tm in + verify_ineq0 params true pp ineq vars bounds rewrite_thms;; + + +(* The simplest verification function *) +let verify_ineq = verify_ineq_and_rewrite [];; + + +end;; diff --git a/formal_ineqs/verifier_options.hl b/formal_ineqs/verifier_options.hl new file mode 100644 index 0000000..ad99b45 --- /dev/null +++ b/formal_ineqs/verifier_options.hl @@ -0,0 +1,18 @@ +(* =========================================================== *) +(* Options of the verification library *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +module Verifier_options = struct + +let report0 s = + Format.print_string s; Format.print_flush();; + +(* Debug/info printing level: + 0 - no debug/info printing + 1 - print important messages only + 2 - print all information *) +let info_print_level = ref 1;; + +end;; diff --git a/formal_lp/glpk/build_certificates.hl b/formal_lp/glpk/build_certificates.hl new file mode 100644 index 0000000..b814fb0 --- /dev/null +++ b/formal_lp/glpk/build_certificates.hl @@ -0,0 +1,394 @@ +needs "../formal_lp/hypermap/main/lp_certificate.hl";; +needs "../formal_lp/glpk/lp_binary_certificate.hl";; +needs "../formal_lp/hypermap/computations/informal_computations.hl";; +needs "../glpk/tame_archive/lpproc.ml";; +needs "../glpk/tame_archive/hard_lp.ml";; + + +module Build_certificates = struct + + +(* Temporary directory where certificates are computed *) +let tmp_dir = ref (flyspeck_dir ^ "/../formal_lp/glpk/tmp");; +(* Output directory for certificates *) +let output_dir = ref (flyspeck_dir ^ "/../formal_lp/glpk/binary");; +(* Path to LP_HL.exe *) +let lp_hl_dir = ref (flyspeck_dir ^ "/../formal_lp/LP-HL/LP-HL/bin/Release");; +(* Main model file *) +let model2_path = ref (tame_dir ^ "/model2.mod");; + + + +open Glpk_link;; +open Lp_informal_computations;; +open Lpproc;; +open Hard_lp;; +open List;; +open Lp_certificate;; +open Lp_binary_certificate;; + + +let mem_stat () = + let stat = Gc.stat() in + let word = float_of_int (Sys.word_size / 8) in + let free = float_of_int stat.Gc.free_words *. word /. 1024.0 in + let total = float_of_int stat.Gc.heap_words *. word /. 1024.0 in + let allocated = total -. free in + let str = sprintf "allocated = %f (free = %f; total_size = %f; %f)\n" + allocated free total (free /. total) in + print_string str;; + + +let run_command dir com = + let cur_dir = Sys.getcwd() in + let _ = Sys.chdir dir in + let result = Sys.command com in + let _ = Sys.chdir cur_dir in + result;; + + +let make_models include_main = + let _ = make_model() in + let sed1 = "s/maximize objective:.*/maximize objective: sum{i in node} ln[i];/" and + sed2 = "s/lnsum_def:.*//" and + sed3 = "s/main:.*//" in + let _ = if include_main then () else + let cmd = sprintf "sed -e '%s' %s > %s" sed3 model !model2_path in + let cmd2 = sprintf "cp %s %s" !model2_path model in + let _ = run_command tame_dir cmd in + let _ = run_command tame_dir cmd2 in + () in + let cmds = [sed1; sed2] in + let str1 = itlist (fun cmd str -> sprintf "-e '%s' %s" cmd str) cmds "" in + let cmd = sprintf "sed %s %s > %s" str1 model !model2_path in + let _ = run_command tame_dir cmd in + ();; + + +let ampl_of_bb' fname bb = + let out = open_out fname in + let _ = ampl_of_bb out bb in + close_out out;; + + +let save_string fname str = + let out = open_out fname in + let _ = Printf.fprintf out "%s" str in + close_out out;; + + +let find_index p list = fst (find (fun _,x -> p x) (Glpk_link.enumerate list));; + +let find_face_index fs f = + let rots = Glpk_link.rotation [f] in + let rec find fs = + match fs with + | [] -> failwith "find_face_index" + | h :: t -> + let eq = fold_right (or) (map ((=) h) rots) false in + if eq then 0 else find t + 1 in + find fs;; + + +let build_permutation fs0 fs = map (fun f -> find_face_index fs f) fs0;; + + +let save_info out_dir name infeasible hyp_list bb = + let f2 = faces bb in + let perm = build_permutation hyp_list f2 in + let _ = ampl_of_bb' (sprintf "%s/%s_pars.txt" out_dir name) bb in + let perm_str = unsplit ", " string_of_int perm in + let hyp_str = unsplit ";" (unsplit "," string_of_int) hyp_list in + let p = sprintf in + let lines = [ + p "name: %s" name; + p "infeasible: %b" infeasible; + p "hypermap: %s" hyp_str; + p "faces: %s" perm_str; + ] in + save_string (out_dir ^ "/flyspeck-" ^ name ^ ".txt") (join_lines lines);; + + +let clean_out_dir = + let permanent_files = [ + "000.txt"; + "string_archive.txt"; + ] in + fun out_dir -> + let files = Array.to_list (Sys.readdir out_dir) in + let files' = filter (fun name -> not (mem name permanent_files)) files in + let _ = map (fun name -> Sys.remove (sprintf "%s/%s" out_dir name)) files' in + ();; + +(************************************) + +(* Builds a terminal case from the given hypermap *) +let build_terminal_case = + let create_infeasible_solution out_name = + let sed1_cmd = sprintf "sed -f %s/../sed_add_slack.sed %s.lp > %s_slack.lp" !tmp_dir out_name out_name and + sed2_cmd = sprintf "sed -f %s/../sed_build_objective.sed %s.lp > /dev/null" !tmp_dir out_name and + sed3_cmd = sprintf "sed -f %s/../sed_replace_objective.sed %s_slack.lp > %s_slack2.lp" !tmp_dir out_name out_name in + let _ = run_command !tmp_dir sed1_cmd and + _ = run_command !tmp_dir sed2_cmd and + _ = run_command !tmp_dir sed3_cmd in + let solve_com2 = sprintf "glpsol --cpxlp %s_slack2.lp -w %s.txt" out_name out_name in + run_command !tmp_dir solve_com2 in + + fun hyp_list infeasible bb -> + let error_glpsol = sprintf "build_terminal_case: glpsol failed for %s" bb.hypermap_id in + let _ = clean_out_dir !tmp_dir in + let out_name = "out" in + (* Create info and parameter files *) + let _ = save_info !tmp_dir out_name infeasible hyp_list bb in + let data_file = sprintf "%s_pars.txt" out_name in + (* Create .lp file and solve a feasible problem *) + let solve_com = sprintf "glpsol -m %s -d %s -w %s.txt --wcpxlp %s.lp > /dev/null" !model2_path data_file out_name out_name in + let result = run_command !tmp_dir solve_com in + let _ = result = 0 or failwith error_glpsol in + (* Solve an infeasible problem *) + let result = if infeasible then create_infeasible_solution out_name else 0 in + let _ = result = 0 or failwith error_glpsol in + (* Run LP-HL.exe *) + let com = sprintf "mono %s/LP-HL.exe %s" !lp_hl_dir (sprintf "flyspeck-%s.txt" out_name) in + let result = run_command !tmp_dir com in + let _ = result = 0 or failwith (sprintf "LP-HL.exe failed for %s" bb.hypermap_id) in + (* Create a certificate *) + let terminal = read_binary_terminal (sprintf "%s/%s_out.bin" !tmp_dir out_name) in + terminal;; + + +(*************************************) + +(* If true, then terminal cases are not constructed *) +let test_mode = ref false;; +let print_progress = ref false;; + + +let reset_build_counters, next_build_case, next_terminal_case, report_build_progress = + let cases = ref 0 and + terminals = ref 0 in + (fun () -> cases := 0; terminals := 0), + (fun () -> cases := !cases + 1), + (fun () -> terminals := !terminals + 1), + (fun () -> if !print_progress then report (sprintf "cases = %d; terminals = %d" !cases !terminals) else ());; + + +let set_face_numerics_info bb = + let opp xs = nub (xs @ map (C opposite_edge bb) xs) in + let edge_of_small = opp (rotation bb.std3_small) in + let short_edge = opp bb.d_edge_200_225 in + let long_edge = opp bb.d_edge_225_252 in + let _ = (intersect edge_of_small long_edge = []) or failwith "set_face_numerics" in + let shortadds = subtract (edge_of_small @ short_edge) bb.d_edge_200_225 in + let shortfields = (map (fun t-> ("e_200_225",t)) shortadds) in + let longadds = subtract long_edge bb.d_edge_225_252 in + let longfields = (map (fun t-> ("e_225_252",t)) longadds) in + let r = filter (fun t -> mem t (std_faces bb) & (length t = 3) ) + (nub (map (C face_of_dart bb) long_edge)) in + let _ = (intersect (rotation bb.std3_small) r =[]) or failwith "set_face_numerics" in + let bigfields = map (fun t -> ("bt",t)) (subtract r bb.std3_big) in + let fields = shortfields @ longfields @ bigfields in + if fields=[] then bb, [] else + let new_bb = modify_bb bb false fields [] in + (* Don't need to add symmetric inequalities and short edges for small triangles: *) + (* it is done at other steps. Add new big triangles only. *) + let new_big_faces = subtract r bb.std3_big in + let long_edge_faces = zip (map (C face_of_dart bb) long_edge) long_edge in + let darts = map (C assoc long_edge_faces) new_big_faces in + let info_list = map (fun d -> {split_type = "add_big"; split_face = d}) darts in + new_bb, info_list;; + + +let set_node_numerics_info bb = + if not(card_node bb = 13) then bb, [] else + let n_high = length bb.node_236_252 in + let n_mid = length bb.node_218_236 in + let n_highish = length (highish bb) in + if (n_high =0 ) & (n_mid +n_highish < 2) then bb, [] else + let _ = (n_mid * 18 + n_highish * 18 + n_high *36 <= 52) or failwith "set_node_numerics" in + let node_new_low = subtract (node_list bb) (unions [bb.node_200_218 ;bb.node_218_236; bb.node_236_252;bb.node_218_252]) in + let vfields_low = map (fun t -> ("200_218",t)) node_new_low in + let vfields_mid = map(fun t->("218_236",t)) (highish bb) in + let vfields = vfields_low @ vfields_mid in + if vfields = [] then bb, [] else + let new_bb = modify_bb bb false [] vfields in + let info = + if n_high > 0 then + {split_type = "high"; split_face = bb.node_236_252} + else + {split_type = "mid"; split_face = bb.node_218_236 @ highish bb} in + new_bb, [info];; + + +let rec build hard_flag (hyp_list, bb0) = + let _ = next_build_case() in + let _ = report_build_progress() in + + let bb, info_list = if not hard_flag then bb0, [] + else + let bb1, list1 = set_face_numerics_info bb0 in + let bb2, list2 = set_node_numerics_info bb1 in + bb2, list1 @ list2 in + + let f_hint = if hard_flag then add_hints_include_flat else (fun t -> ()) in + let result = solve_f f_hint bb in + let certificate = + if not (is_feas result) then + let _ = next_terminal_case() in + let infeasible = + match result.lpvalue with + | Lp_infeasible -> true + | _ -> false in + (* terminal case *) + let terminal = + if !test_mode then + empty_terminal + else + build_terminal_case hyp_list infeasible bb in + Lp_terminal terminal + else + (* split case *) + let n = length (hd bb.std_faces_not_super) in + if n = 3 then + if hard_flag then + split3_hard hyp_list bb + else + split3 hard_flag hyp_list bb + else if n = 4 then + split4 hard_flag hyp_list bb + else if n = 5 then + split5 hard_flag hyp_list bb + else if n = 6 then + split6 hard_flag hyp_list bb + else + failwith (sprintf "build: incorrect face size - %d" n) in + itlist (fun info c -> Lp_split (info, [c])) info_list certificate + +(* split3 - hard cases *) +and split3_hard hyp_list bb = + let _ = assert (bb.hints <> []) in + let bbs, split_type, list = + match hd (bb.hints) with + | Triangle_split d -> switch_std3 d bb, "tri", face_of_dart d bb + | Edge_split d -> switch_edge d bb, "edge", d + | High_low i -> switch_node bb i, (if mem i (highish bb) then "236" else "218"), [i] in + let _ = map clear_hint bbs in + let case_args = zip [hyp_list; hyp_list] bbs in + let cases = map (build true) case_args in + let info = {split_type = split_type; split_face = list} in + Lp_split (info, cases) + +(* split3 *) +and split3 hard_flag hyp_list bb = + let split_face = hd (std_tri_prebranch bb) in + let _ = assert (length split_face = 3) in + let bbs = switch3 bb in + let case_args = zip [hyp_list; hyp_list] bbs in + let cases = map (build hard_flag) case_args in + let info = {split_type = "tri"; split_face = split_face} in + Lp_split (info, cases) + +(* split4 *) +and split4 hard_flag hyp_list bb = + let split_face = hd bb.std_faces_not_super in + let _ = assert (length split_face = 4) in + let bbs = switch4 bb in + let dart13 = nth split_face 1, nth split_face 2 and + dart24 = nth split_face 0, nth split_face 1 in + let split13 = split_list hyp_list dart13 and + split24 = split_list hyp_list dart24 in + let case_args = zip [split13; split24; split13; split24; hyp_list] bbs in + let cases = map (build hard_flag) case_args in + let info = {split_type = "quad"; split_face = split_face} in + Lp_split (info, cases) + +(* split5 *) +and split5 hard_flag hyp_list bb = + let split_face = hd bb.std_faces_not_super in + let _ = assert (length split_face = 5) in + let bbs = switch5 bb in + let darts = rotateL 1 (list_pairs split_face) in + let splits_one = map (split_list hyp_list) darts in + let splits_two = map2 split_list splits_one (rotateL 2 darts) in + let case_args = zip (hyp_list :: (splits_one @ splits_two)) bbs in + let cases = map (build hard_flag) case_args in + let info = {split_type = "pent"; split_face = split_face} in + Lp_split (info, cases) + +(* split6 *) +and split6 hard_flag hyp_list bb = + let split_face = hd bb.std_faces_not_super in + let _ = assert (length split_face = 6) in + let bbs = switch6 bb in + let darts = Glpk_link.rotateL 1 (list_pairs split_face) in + let splits = map (split_list hyp_list) darts in + let case_args = zip (hyp_list :: splits) bbs in + let cases = map (build hard_flag) case_args in + let info = {split_type = "hex"; split_face = split_face} in + Lp_split (info, cases);; + + +(* Moves all hex faces to std56_flat_free *) +(* This operation can be done on all hypermaps since branching on hexes is not required: *) +(* there are no inequalities for std56_flat_free INTER std6 *) +let modify_hex_cases bb = + let faces6 = filter (fun f -> length f = 6) bb.std_faces_not_super in + itlist (fun fc bb -> modify_bb bb true ["flat_free", fc] []) faces6 bb;; + + +(* Builds an lp certificate *) +let build_certificate modify_hex bb = + let _ = reset_build_counters() in + let bb = if modify_hex then modify_hex_cases bb else bb in + let hyp_list = (snd o convert_to_list) bb.string_rep in + let hard_flag = bb.hints <> [] in + let root = build hard_flag (hyp_list, bb) in + let _ = report_build_progress() in + let certificate = {hypermap_string = bb.string_rep; root_case = root} in + certificate;; + + + + +(************************) + +(* Builds and saves certificates for all given cases *) +let build_and_save_all = + let counter = ref 0 and + total = ref 0 in + let buf = ref [] and + file_counter = ref 0 and + buf_terminals = ref 0 in + + let save_buf name_prefix = + if length !buf > 0 then + let _ = file_counter := !file_counter + 1 in + let fname = sprintf "%s/%s_%d.dat" !output_dir name_prefix !file_counter in + let _ = write_lp_certificates fname !buf in + buf := []; + buf_terminals := 0 + else + () in + + let process name_prefix max modify_hex bb = + let _ = counter := !counter + 1 in + let _ = report (sprintf "%d/%d" !counter !total) in + let certificate = build_certificate modify_hex bb in + let _ = buf := certificate :: !buf in + let _ = buf_terminals := !buf_terminals + count_terminals certificate.root_case in + if !buf_terminals >= max then + save_buf name_prefix + else + () in + + fun name_prefix max modify_hex bbs -> + let _ = total := length bbs and + _ = counter := 0 and + _ = file_counter := 0 and + _ = buf := [] and + _ = buf_terminals := 0 in + let _ = map (process name_prefix max modify_hex) bbs in + save_buf name_prefix;; + + +end;; diff --git a/formal_lp/glpk/build_main.hl b/formal_lp/glpk/build_main.hl new file mode 100644 index 0000000..d7aa77e --- /dev/null +++ b/formal_lp/glpk/build_main.hl @@ -0,0 +1,95 @@ +#load "unix.cma";; + +(* +Unix.putenv "FLYSPECK_DIR" "/mnt/Repository/text_formalization";; +*) + +(* The FLYSPECK_DIR environment variable must be set *) +let flyspeck_dir = + try Sys.getenv "FLYSPECK_DIR" with Not_found -> failwith "FLYSPECK_DIR must be set";; + +let hollight_dir = + (try Sys.getenv "HOLLIGHT_DIR" with Not_found -> Sys.getcwd());; + +let add_to_load_path path = + if mem path !load_path then () + else load_path := path :: !load_path;; + +add_to_load_path flyspeck_dir;; + +(* From strictbuild.hl (required by flyspeck_lib.hl) *) +let process_to_string unixstring = + let p = Unix.open_process_in unixstring + and b = Buffer.create 64 in + let rec read () = Buffer.add_channel b p 1; read () in + try read () with End_of_file -> (let _ = Unix.close_process_in p in Buffer.contents b);; + +needs "general/lib.hl";; +needs "general/flyspeck_lib.hl";; + +needs "../glpk/tame_archive/lpproc.ml";; +needs "../glpk/sphere.ml";; +needs "../glpk/tame_archive/hard_lp.ml";; + +needs "../formal_lp/glpk/build_certificates.hl";; + +module Lp_build_main = struct + +open List;; +open Lpproc;; +open Hard_lp;; +open Build_certificates;; + +type lp_bbs = { + (* All easy lp's *) + easy : branchnbound list; + (* Hard lp's *) + hard : branchnbound list; +};; + +let get_lp_bbs () = + let tame = Glpk_link.strip_archive (!archiveraw) in + let all_bbs = map mk_bb tame in + let hard_bbs, easy_bbs = partition (fun bb -> mem bb.hypermap_id Lpproc.hardid) all_bbs in + {easy = easy_bbs; hard = map resolve_with_hints_include_flat hard_bbs};; + + +let build_all_easy max = + let _ = make_models false in + let bbs = get_lp_bbs() in + let _ = report "Building easy lp certificates" in + build_and_save_all "easy" max true bbs.easy;; + + +let build_all_hard max = + let _ = make_models false in + let bbs = get_lp_bbs() in + let _ = report "Building hard lp certificates" in + build_and_save_all "hard" max true bbs.hard;; + + +let build_all max = + let _ = build_all_easy max in + (* Save each hard lp certificate in a separate file: max = 1 *) + let _ = build_all_hard 1 in + ();; + + +end;; + + +(* +open Build_certificates;; +open Lp_build_main;; +open Hard_lp;; +make_models false;; +let bbs = get_lp_bbs();; + +let bb = List.nth bbs.hard 1;; +test_mode := true;; + +let cert = build_certificate true bb;; +Lp_certificate.certificate_info cert;; + +allpass_hint_include_flat 20000 [bb];; +*) diff --git a/formal_lp/glpk/ex1/bb1_out.hl b/formal_lp/glpk/ex1/bb1_out.hl new file mode 100644 index 0000000..a2f7750 --- /dev/null +++ b/formal_lp/glpk/ex1/bb1_out.hl @@ -0,0 +1,82 @@ +hypermap_string := "156588677070 21 6 0 1 2 3 4 5 4 0 5 6 7 3 6 5 4 3 1 0 8 3 8 0 7 3 6 4 9 3 9 4 10 3 10 4 3 3 10 3 11 3 11 3 12 3 12 3 2 3 12 2 1 3 12 1 13 3 13 1 8 3 7 6 9 3 8 7 14 3 14 7 9 3 14 9 10 4 14 10 11 13 3 11 12 13 3 13 8 14 ";; +precision := 3;; +(***************) +(* Constraints *) +(***************) +constraints := [ +("azim_sum", [1; 9; 14; ], [176L; 14L; 533L; ]); +("azim_sum_neg", [0; 4; 6; 8; 10; 11; ], [46L; 207L; 46L; 18L; 71L; 71L; ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [945L; 1108L; 1258L; 1258L; 845L; 1258L; 899L; 1108L; 1108L; 1186L; 1082L; 894L; 1108L; 1108L; 1108L; ]); +("sol_sum3", [2; 9; 10; 11; ], [46L; 71L; 21L; 21L; ]); +("tau_sum6_neg", [0; ], [1258L; ]); +("tau_sum4_neg", [1; 18; ], [899L; 1108L; ]); +("tau_sum3_neg", [2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 19; 20; ], [899L; 1108L; 1108L; 899L; 1108L; 1186L; 1082L; 894L; 845L; 845L; 894L; 1108L; 899L; 1108L; 1108L; 1108L; 894L; 1108L; ]); +("ln_def_neg", [0; 1; 2; 3; 5; 7; 8; 9; 10; 12; 13; 14; ], [41L; 222L; 387L; 387L; 387L; 222L; 222L; 308L; 193L; 222L; 222L; 222L; ]); +("ln_def", [4; 6; 11; ], [68L; 9L; 14L; ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [5935L; 6965L; 7906L; 7906L; 5309L; 7906L; 5647L; 6965L; 6965L; 7452L; 6800L; 5618L; 6965L; 6965L; 6965L; ]); +("edge_sym_neg", [12; 14; 15; 18; 21; 23; 24; 27; 29; 32; 45; 54; 60; ], [48L; 177L; 205L; 259L; 207L; 37L; 210L; 166L; 163L; 86L; 206L; 17L; 28L; ]); +("edge_sym", [20; 33; 36; 39; 41; 42; 48; ], [107L; 37L; 256L; 171L; 91L; 25L; 51L; ]); +("y1_def_neg", [10; 11; 13; 14; 15; 17; 18; 20; 21; 22; 23; 24; 25; 26; 27; 28; 29; 30; 31; 32; 33; 34; 35; 38; 39; 40; 42; 44; 45; 46; 48; 50; 51; 52; 54; 56; 62; 64; 65; 67; ], [7L; 73L; 90L; 41L; 200L; 41L; 200L; 155L; 248L; 191L; 90L; 50L; 3L; 43L; 257L; 66L; 106L; 160L; 228L; 165L; 11L; 3L; 12L; 5L; 150L; 16L; 118L; 66L; 188L; 118L; 188L; 103L; 46L; 26L; 69L; 11L; 71L; 99L; 103L; 46L; ]); +("y1_def", [19; 36; 47; 63; ], [23L; 46L; 23L; 35L; ]); +("y2_def_neg", [10; 11; 15; 18; 19; 21; 22; 27; 30; 31; 33; 34; 36; 38; 40; 45; 47; 48; 50; 54; 56; 63; 64; 65; ], [7L; 29L; 200L; 200L; 7L; 63L; 202L; 187L; 206L; 47L; 11L; 3L; 14L; 126L; 62L; 188L; 7L; 95L; 103L; 81L; 23L; 11L; 99L; 103L; ]); +("y2_def", [13; 14; 17; 20; 23; 24; 25; 26; 28; 29; 32; 35; 39; 42; 44; 46; 51; 52; 62; 67; ], [54L; 64L; 64L; 94L; 54L; 33L; 5L; 26L; 43L; 64L; 100L; 7L; 86L; 72L; 40L; 71L; 71L; 41L; 43L; 71L; ]); +("y3_def_neg", [10; 11; 15; 18; 19; 21; 22; 27; 30; 31; 33; 34; 36; 38; 40; 45; 47; 48; 50; 54; 56; 63; 64; 65; ], [7L; 29L; 200L; 200L; 7L; 63L; 202L; 187L; 206L; 47L; 11L; 3L; 14L; 126L; 62L; 188L; 7L; 95L; 103L; 81L; 23L; 11L; 99L; 103L; ]); +("y3_def", [13; 14; 17; 20; 23; 24; 25; 26; 28; 29; 32; 35; 39; 42; 44; 46; 51; 52; 62; 67; ], [54L; 64L; 64L; 94L; 54L; 33L; 5L; 26L; 43L; 64L; 100L; 7L; 86L; 72L; 40L; 71L; 71L; 41L; 43L; 71L; ]); +("y4_def_neg", [11; 13; 14; 15; 17; 18; 20; 21; 22; 23; 24; 25; 26; 27; 28; 29; 30; 31; 32; 35; 39; 42; 44; 45; 46; 48; 50; 51; 52; 54; 62; 64; 65; 67; ], [63L; 103L; 121L; 139L; 121L; 139L; 177L; 224L; 125L; 103L; 63L; 10L; 49L; 198L; 81L; 121L; 81L; 209L; 188L; 14L; 160L; 135L; 75L; 131L; 134L; 157L; 71L; 134L; 76L; 41L; 80L; 69L; 71L; 134L; ]); +("y4_def", [10; 19; 33; 34; 36; 38; 40; 47; 63; ], [15L; 35L; 23L; 7L; 72L; 76L; 19L; 35L; 55L; ]); +("y5_def_neg", [11; 15; 18; 19; 21; 22; 27; 30; 31; 36; 38; 40; 45; 47; 48; 50; 54; 56; 61; 63; 64; 65; ], [15L; 139L; 139L; 7L; 22L; 141L; 122L; 146L; 11L; 14L; 96L; 46L; 131L; 7L; 55L; 71L; 57L; 17L; 28L; 11L; 69L; 71L; ]); +("y5_def", [10; 13; 14; 17; 20; 23; 24; 25; 26; 28; 29; 32; 33; 34; 35; 39; 42; 44; 46; 51; 52; 62; 67; ], [15L; 54L; 64L; 64L; 94L; 54L; 33L; 5L; 26L; 43L; 64L; 100L; 23L; 7L; 7L; 96L; 72L; 40L; 71L; 71L; 41L; 43L; 71L; ]); +("y6_def_neg", [11; 15; 18; 19; 21; 22; 27; 31; 38; 40; 45; 48; 50; 54; 64; ], [15L; 139L; 139L; 7L; 22L; 99L; 122L; 11L; 96L; 46L; 131L; 55L; 71L; 57L; 69L; ]); +("y6_def", [10; 13; 14; 16; 17; 20; 23; 24; 25; 26; 28; 29; 30; 32; 33; 34; 35; 36; 39; 42; 44; 46; 47; 49; 51; 52; 53; 55; 56; 62; 63; 65; 67; ], [15L; 75L; 64L; 252L; 139L; 94L; 54L; 33L; 208L; 132L; 183L; 64L; 78L; 100L; 23L; 7L; 7L; 263L; 96L; 72L; 335L; 164L; 396L; 465L; 71L; 41L; 82L; 33L; 210L; 43L; 124L; 340L; 71L; ]); +("y8_def_neg", [58; ], [28L; ]); +("RHA", [6; 7; 9; 12; 20; 21; 32; 34; 35; 37; 39; 41; 42; 44; 46; 48; 57; 59; 62; 64; ], [210L; 46L; 210L; 359L; 101L; 18L; 89L; 49L; 393L; 49L; 169L; 364L; 17L; 40L; 14L; 113L; 77L; 77L; 71L; 214L; ]); +("RHB", [0; 2; 60; ], [150L; 413L; 26L; ]); +("tau4", [0; 4; ], [12L; 60L; ]); +("tau6", [0; ], [1258L; ]); +("ineq107", [1; 3; 10; 11; 13; 14; 16; 17; 18; 19; 21; 22; 25; 29; 32; 34; 36; 38; 48; ], [46L; 150L; 259L; 192L; 150L; 77L; 72L; 72L; 104L; 176L; 188L; 275L; 20L; 244L; 197L; 110L; 196L; 97L; 118L; ]); +("ineq108", [9; 12; 20; 26; 28; 30; 37; 44; 46; 49; ], [46L; 18L; 71L; 93L; 185L; 71L; 46L; 18L; 18L; 71L; ]); +("ineq109", [4; 7; 14; 15; 18; 41; 42; 53; ], [176L; 176L; 14L; 14L; 14L; 196L; 112L; 196L; ]); +("ineq110", [0; 23; 24; 29; ], [46L; 71L; 21L; 21L; ]); +("ineq112", [1; 5; 8; 11; 12; 17; 20; 21; 28; 30; 35; 38; 40; 44; 46; 50; 51; ], [251L; 1108L; 1108L; 738L; 1108L; 1186L; 1082L; 639L; 541L; 286L; 1045L; 725L; 570L; 435L; 111L; 552L; 570L; ]); +("ineq113", [26; ], [182L; ]); +("ineq115", [2; 10; 22; 25; 29; 31; 32; 34; 36; 38; 41; 42; 45; 47; 50; 53; ], [647L; 161L; 255L; 663L; 304L; 582L; 27L; 64L; 22L; 152L; 538L; 673L; 851L; 147L; 342L; 538L; ]); +("ineq119", [2; 6; ], [101L; 224L; ]); +("ineq120", [0; 3; 4; 5; ], [509L; 277L; 704L; 121L; ]); +];; + +(***************) +(* Variables *) +(***************) +target_variables := [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [2375L; 3125L; 3450L; 3450L; 2925L; 3450L; 2775L; 3125L; 3125L; 3900L; 3000L; 2850L; 3125L; 3125L; 3125L; ]); +];; + +(*************************) + +variable_bounds := [ +("azim_hi", [0; 2; 5; 8; 12; 34; 35; 36; 37; 38; 39; 41; 44; 48; 52; 57; 58; 59; 60; 64; ], [400L; 692688L; 46000L; 247L; 22L; 1000L; 1038L; 726L; 1000L; 1000L; 304L; 332L; 64L; 152L; 298L; 1022L; 632L; 718L; 104L; 92L; ]); +("azim_lo", [6; 9; 20; 32; 42; 46; 51; 55; 67; ], [178L; 34L; 214L; 370L; 98L; 228L; 212L; 274L; 212L; ]); +("rhazim_hi", [5; 6; 9; 20; 21; 46; 48; 62; ], [314000L; 1000L; 1000L; 1000L; 1000L; 1000L; 1000L; 1000L; ]); +("rhazim_lo", [5; 24; 57; 59; ], [1000L; 1000L; 1000L; 1000L; ]); +("rho_lo", [1; 2; 3; 5; 7; 8; 10; 11; 12; 13; 14; ], [2328L; 728L; 728L; 728L; 2328L; 2328L; 712L; 104L; 2328L; 2328L; 2328L; ]); +("rho_hi", [0; 4; 6; 9; ], [3380L; 980L; 2316L; 824L; ]); +("tau_hi", [12; 13; 17; 18; ], [1000L; 1000L; 1000L; 1000L; ]); +("tau_lo", [2; ], [1000L; ]); +("y1_lo", [14; 17; 20; 21; 25; 26; 34; 42; 45; 48; 51; 52; 54; 64; 67; ], [360L; 360L; 400L; 40L; 290L; 200L; 171L; 200L; 100L; 700L; 60L; 320L; 300L; 360L; 60L; ]); +("y1_hi", [10; 11; 15; 18; 22; 24; 27; 28; 29; 30; 31; 33; 36; 38; 39; 40; 46; 50; 56; 62; 63; 65; ], [54L; 220L; 560L; 560L; 560L; 510L; 320L; 310L; 400L; 740L; 180L; 279L; 500L; 120L; 429L; 20L; 400L; 400L; 20L; 200L; 500L; 400L; ]); +("y2_hi", [10; 11; 13; 14; 15; 17; 18; 19; 20; 21; 23; 24; 25; 26; 29; 30; 31; 32; 33; 35; 38; 44; 46; 47; 50; 51; 56; 63; 65; 67; ], [54L; 564L; 600L; 64L; 560L; 64L; 560L; 8L; 276L; 48L; 600L; 124L; 96L; 208L; 64L; 448L; 412L; 100L; 279L; 280L; 500L; 40L; 344L; 8L; 400L; 344L; 284L; 208L; 400L; 344L; ]); +("y2_lo", [22; 27; 28; 34; 36; 39; 40; 42; 45; 48; 52; 54; 62; 64; ], [176L; 272L; 48L; 171L; 136L; 355L; 272L; 292L; 100L; 192L; 232L; 36L; 48L; 360L; ]); +("y3_hi", [10; 11; 13; 14; 15; 17; 18; 19; 20; 21; 23; 24; 25; 26; 29; 30; 31; 32; 33; 35; 38; 44; 46; 47; 50; 51; 56; 63; 65; 67; ], [54L; 564L; 600L; 64L; 560L; 64L; 560L; 8L; 276L; 48L; 600L; 124L; 96L; 208L; 64L; 448L; 412L; 100L; 279L; 280L; 500L; 40L; 344L; 8L; 400L; 344L; 284L; 208L; 400L; 344L; ]); +("y3_lo", [22; 27; 28; 34; 36; 39; 40; 42; 45; 48; 52; 54; 62; 64; ], [176L; 272L; 48L; 171L; 136L; 355L; 272L; 292L; 100L; 192L; 232L; 36L; 48L; 360L; ]); +("y4_hi", [11; 13; 14; 15; 17; 18; 19; 21; 22; 23; 24; 25; 27; 28; 29; 30; 31; 33; 35; 40; 42; 45; 47; 54; 56; ], [115L; 250L; 440L; 500L; 440L; 500L; 558L; 230L; 414L; 250L; 665L; 410L; 430L; 170L; 440L; 633L; 345L; 4L; 300L; 133L; 55L; 375L; 558L; 539L; 39L; ]); +("y4_lo", [10; 20; 26; 32; 34; 36; 38; 39; 44; 46; 48; 50; 51; 52; 62; 63; 65; 67; ], [96L; 415L; 320L; 375L; 196L; 111L; 620L; 336L; 350L; 260L; 70L; 250L; 260L; 720L; 830L; 117L; 250L; 260L; ]); +("y5_hi", [11; 13; 14; 15; 17; 18; 19; 20; 23; 24; 25; 26; 29; 32; 33; 35; 38; 44; 45; 46; 47; 51; 56; 63; 67; ], [369L; 600L; 64L; 500L; 64L; 500L; 8L; 276L; 600L; 124L; 96L; 208L; 64L; 100L; 4L; 280L; 255L; 40L; 375L; 344L; 8L; 344L; 389L; 208L; 344L; ]); +("y5_lo", [10; 21; 22; 27; 28; 30; 31; 34; 36; 39; 40; 42; 48; 50; 52; 54; 62; 65; ], [96L; 362L; 236L; 42L; 48L; 42L; 443L; 196L; 136L; 380L; 542L; 292L; 317L; 250L; 232L; 111L; 48L; 250L; ]); +("y6_hi", [11; 14; 15; 17; 18; 19; 20; 22; 23; 24; 25; 29; 32; 33; 35; 38; 44; 45; 47; 51; 56; 63; 67; ], [369L; 64L; 500L; 64L; 500L; 8L; 276L; 764L; 600L; 124L; 96L; 64L; 100L; 4L; 280L; 255L; 40L; 375L; 8L; 344L; 389L; 208L; 344L; ]); +("y6_lo", [10; 13; 16; 17; 21; 22; 25; 26; 27; 28; 30; 31; 34; 36; 39; 40; 42; 44; 46; 47; 48; 49; 50; 52; 53; 54; 55; 56; 62; 63; 65; ], [96L; 20400L; 252000L; 75000L; 362L; 43000L; 203000L; 105792L; 42L; 140048L; 224042L; 443L; 196L; 277136L; 380L; 542L; 292L; 295000L; 92656L; 403000L; 317L; 465000L; 250L; 232L; 82000L; 111L; 33000L; 227000L; 48L; 135000L; 411250L; ]); +("y8_hi", [58; ], [28000L; ]); +("ye_lo", [14; 15; 18; 19; 22; 23; 24; 25; 31; 33; 40; 44; 55; ], [1000L; 1000L; 1000L; 185000L; 1000L; 1000L; 1000L; 1000L; 51000L; 214000L; 10000L; 1000L; 1000L; ]); +("ye_hi", [21; 33; 39; 42; 49; 54; 64; ], [1000L; 1000L; 1000L; 1000L; 1000L; 1000L; 1000L; ]); +("yn_lo", [0; 1; 2; 3; 5; 6; 7; 8; 9; 10; 13; 14; ], [1116L; 872L; 412L; 2412L; 1412L; 307L; 872L; 872L; 408L; 1668L; 2872L; 872L; ]); +("yn_hi", [4; 11; 12; ], [236L; 78L; 128L; ]); +];; diff --git a/formal_lp/glpk/ex2/bb2_1_out.hl b/formal_lp/glpk/ex2/bb2_1_out.hl new file mode 100644 index 0000000..59f3902 --- /dev/null +++ b/formal_lp/glpk/ex2/bb2_1_out.hl @@ -0,0 +1,81 @@ +hypermap_string := "21943083135 21 4 0 1 2 3 3 0 3 4 3 4 3 5 3 5 3 2 3 5 2 6 3 6 2 7 3 7 2 1 3 7 1 8 3 8 1 9 3 9 1 0 3 9 0 10 3 10 0 4 3 10 4 11 3 11 4 5 3 11 5 6 3 11 6 12 3 12 6 7 3 12 7 8 3 12 8 9 3 12 9 10 3 10 11 12 ";; +precision := 3;; +(***************) +(* Constraints *) +(***************) +constraints := [ +("azim_sum", [2; 4; 5; 6; 10; 11; 12; ], [266L; 52L; 52L; 107L; 107L; 100L; 487L; ]); +("azim_sum_neg", [7; 8; 9; ], [16L; 60L; 16L; ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [390L; 985L; 1150L; 985L; 499L; 499L; 768L; 872L; 856L; 872L; 768L; 747L; 869L; ]); +("sol_sum3_neg", [5; 6; 11; 12; 13; 14; 15; 16; 17; 20; 21; ], [699L; 131L; 131L; 699L; 52L; 52L; 52L; 179L; 107L; 107L; 179L; ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; ], [985L; 390L; 390L; 390L; 390L; 176L; 744L; 872L; 856L; 856L; 872L; 744L; 176L; 499L; 499L; 499L; 696L; 768L; 856L; 856L; 768L; 696L; ]); +("ln_def_neg", [1; 2; 3; ], [86L; 268L; 86L; ]); +("ln_def", [0; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [570L; 449L; 449L; 153L; 39L; 56L; 39L; 153L; 177L; 42L; ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [2452L; 6191L; 7227L; 6191L; 3138L; 3138L; 4827L; 5477L; 5377L; 5477L; 4827L; 4691L; 5458L; ]); +("edge_sym", [6; 7; 8; 11; 13; 14; 16; 19; 22; 28; 31; 44; 49; 56; 59; ], [186L; 13L; 186L; 28L; 186L; 186L; 113L; 21L; 68L; 55L; 68L; 97L; 6L; 5L; 24L; ]); +("edge_sym_neg", [2; 10; 17; 23; 32; 34; 38; 40; 48; 52; 53; 55; 58; 61; 62; 63; ], [472L; 13L; 186L; 66L; 21L; 113L; 186L; 235L; 104L; 24L; 24L; 5L; 5L; 24L; 6L; 104L; ]); +("y1_def", [5; 15; 21; 26; 27; 30; 38; 44; 48; 49; 53; 56; 58; 61; 64; 65; ], [695L; 428L; 8L; 30L; 30L; 8L; 428L; 20L; 3L; 68L; 50L; 15L; 15L; 50L; 3L; 9L; ]); +("y1_def_neg", [1; 6; 9; 11; 14; 20; 22; 23; 25; 28; 31; 32; 33; 39; 40; 42; 45; 47; 50; ], [384L; 307L; 23L; 23L; 307L; 27L; 68L; 81L; 15L; 15L; 54L; 95L; 27L; 154L; 5L; 160L; 5L; 154L; 60L; ]); +("y2_def", [1; 6; 9; 11; 14; 15; 20; 22; 23; 25; 28; 31; 32; 33; 38; 39; 42; 44; 47; 49; 50; 53; 61; 65; ], [60L; 186L; 14L; 14L; 186L; 216L; 96L; 41L; 7L; 9L; 9L; 33L; 15L; 96L; 216L; 138L; 107L; 20L; 138L; 68L; 36L; 38L; 38L; 104L; ]); +("y2_def_neg", [5; 21; 26; 27; 30; 40; 45; 48; 56; 58; 64; ], [167L; 2L; 9L; 9L; 2L; 5L; 5L; 1L; 5L; 5L; 1L; ]); +("y3_def", [1; 6; 9; 11; 14; 15; 20; 22; 23; 25; 28; 31; 32; 33; 38; 39; 42; 44; 47; 49; 50; 53; 61; 65; ], [60L; 186L; 14L; 14L; 186L; 216L; 96L; 41L; 7L; 9L; 9L; 33L; 15L; 96L; 216L; 138L; 107L; 20L; 138L; 68L; 36L; 38L; 38L; 104L; ]); +("y3_def_neg", [5; 21; 26; 27; 30; 40; 45; 48; 56; 58; 64; ], [167L; 2L; 9L; 9L; 2L; 5L; 5L; 1L; 5L; 5L; 1L; ]); +("y4_def_neg", [1; 9; 11; 20; 22; 23; 25; 31; 32; 33; 39; 40; 42; 47; 49; 50; 53; 61; 65; ], [472L; 27L; 27L; 113L; 78L; 60L; 17L; 41L; 86L; 113L; 232L; 4L; 18L; 94L; 35L; 68L; 6L; 6L; 103L; ]); +("y4_def", [5; 6; 14; 15; 19; 21; 26; 27; 28; 30; 34; 38; 41; 44; 45; 48; 55; 56; 58; 64; ], [472L; 13L; 13L; 113L; 3L; 12L; 57L; 46L; 14L; 12L; 3L; 113L; 82L; 128L; 79L; 5L; 9L; 24L; 24L; 5L; ]); +("y5_def_neg", [1; 5; 15; 21; 26; 27; 30; 38; 40; 44; 45; 48; 49; 53; 56; 58; 61; 64; ], [68L; 186L; 186L; 2L; 9L; 9L; 2L; 186L; 4L; 10L; 4L; 1L; 35L; 24L; 5L; 5L; 24L; 1L; ]); +("y5_def", [6; 9; 11; 14; 20; 22; 23; 25; 28; 31; 32; 33; 39; 42; 47; 50; 65; ], [186L; 14L; 14L; 186L; 21L; 41L; 15L; 9L; 9L; 33L; 23L; 21L; 108L; 107L; 108L; 36L; 1L; ]); +("y6_def_neg", [1; 5; 15; 21; 27; 30; 38; 40; 44; 45; 48; 49; 53; 56; 58; 61; 64; ], [68L; 186L; 186L; 2L; 9L; 2L; 186L; 4L; 10L; 4L; 1L; 35L; 24L; 5L; 5L; 24L; 1L; ]); +("y6_def", [6; 9; 11; 14; 20; 22; 23; 25; 26; 28; 31; 32; 33; 39; 42; 47; 50; 65; ], [186L; 14L; 14L; 186L; 21L; 41L; 15L; 9L; 22L; 9L; 33L; 23L; 21L; 108L; 107L; 108L; 36L; 1L; ]); +("rhazim2c", [5; ], [595L; ]); +("rhazim3c", [5; ], [595L; ]); +("RHA", [6; 8; 9; 11; 12; 14; 15; 16; 17; 18; 19; 23; 24; 25; 28; 29; 31; 34; 35; 36; 37; 38; 41; 45; 48; 49; 50; 51; 53; 54; 55; 57; 59; 60; 61; 63; 64; 65; ], [83L; 109L; 70L; 70L; 109L; 83L; 323L; 809L; 592L; 24L; 241L; 188L; 16L; 270L; 270L; 16L; 188L; 241L; 24L; 592L; 809L; 323L; 247L; 247L; 51L; 72L; 74L; 100L; 103L; 13L; 16L; 13L; 16L; 100L; 103L; 72L; 51L; 74L; ]); +("yy15", [1; ], [71L; ]); +("ineq97", [5; ], [595L; ]); +("ineq98", [1; ], [165L; ]); +("ineq101", [1; ], [266L; ]); +("ineq102", [1; 5; ], [985L; 390L; ]); +("ineq107", [6; 9; 11; 14; 20; 22; 23; 25; 28; 31; 32; 33; 39; 42; 47; 50; 65; ], [512L; 39L; 39L; 512L; 128L; 114L; 91L; 25L; 25L; 91L; 114L; 128L; 269L; 247L; 269L; 99L; 99L; ]); +("ineq108", [15; 21; 26; 27; 30; 38; 48; 53; 56; 58; 61; 64; ], [324L; 16L; 60L; 60L; 16L; 324L; 6L; 19L; 31L; 31L; 19L; 6L; ]); +("ineq109", [39; 42; 47; ], [55L; 48L; 55L; ]); +("ineq111", [15; 20; 33; 38; 39; 44; 47; 49; 53; 61; 65; ], [699L; 131L; 131L; 699L; 52L; 52L; 52L; 179L; 107L; 107L; 179L; ]); +("ineq112", [23; 32; 40; 45; ], [146L; 146L; 28L; 28L; ]); +("ineq113", [56; 58; ], [57L; 57L; ]); +("ineq114", [20; 33; 48; 64; ], [568L; 568L; 86L; 86L; ]); +("ineq115", [6; 8; 9; 11; 12; 14; 16; 19; 23; 25; 28; 31; 34; 37; 41; 45; 50; 51; 54; 57; 60; 65; ], [133L; 257L; 195L; 195L; 257L; 133L; 176L; 176L; 725L; 856L; 856L; 725L; 176L; 176L; 471L; 471L; 610L; 768L; 799L; 799L; 768L; 610L; ]); +("ineq30", [5; ], [595L; ]); +];; + +(***************) +(* Variables *) +(***************) +target_variables := [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [900L; 2575L; 3275L; 2575L; 1850L; 1850L; 2275L; 2525L; 3025L; 2525L; 2275L; 2075L; 2850L; ]); +];; + +(*************************) + +variable_bounds := [ +("azim_hi", [6; 9; 11; 14; 16; 19; 34; 37; 51; 53; 54; 56; 57; 58; 60; 61; ], [258L; 70L; 70L; 258L; 176L; 176L; 176L; 176L; 768L; 1000L; 174L; 101L; 174L; 101L; 768L; 1000L; ]); +("azim_lo", [8; 12; 20; 23; 25; 28; 31; 33; 41; 45; 48; 50; 64; 65; ], [118L; 118L; 112L; 150L; 144L; 144L; 150L; 112L; 154L; 154L; 274L; 140L; 274L; 140L; ]); +("rhazim_hi", [22; 23; 25; 28; 31; 32; ], [1000L; 1000L; 1000L; 1000L; 1000L; 1000L; ]); +("rhazim_lo", [41; 42; 45; 51; 53; 60; 61; ], [1000L; 1000L; 1000L; 1000L; 1000L; 1000L; 1000L; ]); +("rho_lo", [0; 1; 2; 3; 4; 5; 6; 10; ], [1240L; 1260L; 400L; 1260L; 2284L; 2284L; 888L; 888L; ]); +("rho_hi", [7; 8; 9; 11; 12; ], [2648L; 2104L; 2648L; 3148L; 2796L; ]); +("tau_lo", [7; 10; 14; ], [1000L; 1000L; 499000L; ]); +("y1_lo", [1; 6; 9; 11; 14; 15; 20; 22; 31; 33; 38; 39; 40; 44; 45; 47; 65; ], [280L; 200L; 400L; 400L; 200L; 380L; 20L; 400L; 600L; 20L; 380L; 565L; 40L; 240L; 40L; 565L; 380L; ]); +("y1_hi", [5; 23; 32; 42; 49; 50; 53; 56; 58; 61; ], [630L; 120L; 320L; 520L; 20L; 600L; 160L; 500L; 500L; 160L; ]); +("y2_hi", [6; 9; 11; 14; 15; 20; 22; 25; 28; 31; 32; 33; 38; 42; 48; 49; 50; 56; 58; 64; 65; ], [368L; 196L; 196L; 368L; 372L; 372L; 496L; 100L; 100L; 124L; 216L; 372L; 372L; 380L; 88L; 20L; 36L; 288L; 288L; 88L; 56L; ]); +("y2_lo", [1; 5; 21; 23; 26; 27; 30; 39; 40; 44; 45; 47; 53; 61; ], [286L; 420L; 432L; 156L; 120L; 120L; 432L; 304L; 40L; 240L; 40L; 304L; 228L; 228L; ]); +("y3_hi", [6; 9; 11; 14; 15; 20; 22; 25; 28; 31; 32; 33; 38; 42; 48; 49; 50; 56; 58; 64; 65; ], [368L; 196L; 196L; 368L; 372L; 372L; 496L; 100L; 100L; 124L; 216L; 372L; 372L; 380L; 88L; 20L; 36L; 288L; 288L; 88L; 56L; ]); +("y3_lo", [1; 5; 21; 23; 26; 27; 30; 39; 40; 44; 45; 47; 53; 61; ], [286L; 420L; 432L; 156L; 120L; 120L; 432L; 304L; 40L; 240L; 40L; 304L; 228L; 228L; ]); +("y4_lo", [5; 6; 14; 19; 20; 22; 23; 25; 26; 28; 31; 32; 33; 34; 39; 41; 42; 44; 45; 47; 48; 49; 53; 55; 56; 58; 61; 64; ], [360L; 363720L; 363720L; 3000L; 356L; 90L; 21000L; 125L; 10620L; 31125L; 21335L; 10340L; 356L; 3000L; 132L; 82000L; 184075L; 138192L; 82500L; 138132L; 362L; 84L; 285L; 9000L; 37L; 37L; 285L; 362L; ]); +("y4_hi", [1; 9; 11; 15; 21; 23; 27; 30; 38; 40; 50; 65; ], [177L; 285L; 285L; 448L; 368L; 415L; 380L; 368L; 448L; 500L; 185L; 101L; ]); +("y5_hi", [6; 9; 11; 14; 22; 25; 28; 31; 32; 40; 42; 45; 48; 50; 53; 56; 58; 61; 64; ], [368L; 196L; 196L; 368L; 496L; 100L; 100L; 124L; 246L; 500L; 380L; 500L; 88L; 36L; 140L; 288L; 288L; 140L; 88L; ]); +("y5_lo", [1; 5; 15; 20; 21; 23; 26; 27; 30; 33; 38; 39; 44; 47; 49; 65; ], [236L; 277325L; 252L; 84L; 432L; 126L; 120L; 120L; 432L; 84L; 252L; 256L; 192L; 256L; 84L; 48L; ]); +("y6_hi", [6; 9; 11; 14; 22; 25; 28; 31; 32; 40; 42; 45; 48; 50; 53; 56; 58; 61; 64; ], [368L; 196L; 196L; 368L; 496L; 100L; 100L; 124L; 246L; 500L; 380L; 500L; 88L; 36L; 140L; 288L; 288L; 140L; 88L; ]); +("y6_lo", [1; 5; 15; 20; 21; 23; 26; 27; 30; 33; 38; 39; 44; 47; 49; 65; ], [236L; 277325L; 252L; 84L; 432L; 126L; 31120L; 120L; 432L; 84L; 252L; 256L; 192L; 256L; 84L; 48L; ]); +("ye_hi", [23; 32; 46; ], [1000L; 1000L; 1000L; ]); +("ye_lo", [40; 45; 56; ], [1000L; 1000L; 1000L; ]); +("yn_lo", [0; 3; 6; 7; 9; 10; 11; ], [1110L; 536L; 219L; 997L; 997L; 219L; 371L; ]); +("yn_hi", [1; 2; 4; 5; 8; 12; ], [464L; 632L; 1573L; 1573L; 312L; 234L; ]); +];; diff --git a/formal_lp/glpk/ex2/bb2_2_out.hl b/formal_lp/glpk/ex2/bb2_2_out.hl new file mode 100644 index 0000000..c4dbed7 --- /dev/null +++ b/formal_lp/glpk/ex2/bb2_2_out.hl @@ -0,0 +1,82 @@ +hypermap_string := "21943083135 21 4 0 1 2 3 3 0 3 4 3 4 3 5 3 5 3 2 3 5 2 6 3 6 2 7 3 7 2 1 3 7 1 8 3 8 1 9 3 9 1 0 3 9 0 10 3 10 0 4 3 10 4 11 3 11 4 5 3 11 5 6 3 11 6 12 3 12 6 7 3 12 7 8 3 12 8 9 3 12 9 10 3 10 11 12 ";; +precision := 4;; +(***************) +(* Constraints *) +(***************) +constraints := [ +("azim_sum", [1; 2; 3; 6; 7; 9; 10; 11; 12; ], [2144L; 4068L; 2144L; 59L; 28L; 28L; 59L; 166L; 5671L; ]); +("azim_sum_neg", [4; 5; 8; ], [700L; 700L; 8L; ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [8339L; 9014L; 10644L; 9014L; 7223L; 7223L; 9014L; 9014L; 9014L; 9014L; 9014L; 8913L; 9014L; ]); +("sol_sum3_neg", [5; 6; 7; 10; 11; 12; 16; 17; 20; 21; ], [1850L; 28L; 1100L; 1100L; 28L; 1850L; 658L; 28L; 28L; 658L; ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; ], [8339L; 8339L; 7223L; 5703L; 7223L; 7223L; 8229L; 9014L; 9014L; 9014L; 9014L; 8229L; 7223L; 6523L; 6523L; 6523L; 8421L; 9014L; 9014L; 9014L; 9014L; 8421L; ]); +("ln_def", [0; 1; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [806L; 61L; 61L; 2036L; 2036L; 61L; 61L; 61L; 61L; 61L; 173L; 61L; ]); +("ln_def_neg", [2; ], [1736L; ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [52396L; 56638L; 66881L; 56638L; 45381L; 45381L; 56638L; 56638L; 56638L; 56638L; 56638L; 56002L; 56638L; ]); +("edge_sym_neg", [7; 8; 11; 14; 17; 23; 32; 34; 38; 40; 48; 49; 53; 55; 56; 58; 63; ], [2867L; 422L; 2113L; 422L; 597L; 379L; 379L; 830L; 597L; 701L; 372L; 6L; 27L; 10L; 10L; 10L; 372L; ]); +("edge_sym", [6; 10; 13; 16; 19; 22; 28; 31; 44; 52; 59; 61; 62; ], [1396L; 653L; 1396L; 830L; 379L; 613L; 37L; 613L; 701L; 6L; 27L; 6L; 6L; ]); +("y1_def", [1; 5; 8; 12; 15; 17; 21; 26; 27; 30; 38; 49; 50; 53; 56; 58; 62; 63; 64; ], [1834L; 1834L; 350L; 350L; 771L; 703L; 954L; 4L; 4L; 954L; 1474L; 3L; 36L; 10L; 4L; 4L; 3L; 3L; 250L; ]); +("y1_def_neg", [6; 7; 10; 11; 13; 14; 20; 24; 25; 28; 29; 33; 34; 39; 42; 47; 52; 54; 55; 57; 59; 65; ], [1464L; 1829L; 1582L; 442L; 670L; 2624L; 873L; 6L; 33L; 33L; 6L; 461L; 412L; 614L; 1156L; 614L; 7L; 6L; 6L; 6L; 6L; 214L; ]); +("y2_def_neg", [1; 7; 8; 11; 12; 15; 20; 26; 27; 34; 49; 56; 58; 63; ], [1900L; 753L; 106L; 442L; 106L; 234L; 116L; 1L; 1L; 412L; 1L; 1L; 1L; 1L; ]); +("y2_def", [5; 6; 10; 13; 14; 17; 21; 24; 25; 28; 29; 30; 33; 38; 39; 42; 47; 50; 52; 53; 54; 55; 57; 59; 62; 64; 65; ], [2468L; 1254L; 959L; 406L; 95L; 703L; 255L; 10L; 20L; 20L; 10L; 255L; 296L; 469L; 372L; 701L; 372L; 373L; 11L; 10L; 10L; 10L; 10L; 10L; 22L; 250L; 123L; ]); +("y3_def_neg", [5; 7; 8; 11; 12; 15; 20; 26; 27; 34; 49; 56; 58; 63; ], [1900L; 753L; 106L; 442L; 106L; 234L; 116L; 1L; 1L; 412L; 1L; 1L; 1L; 1L; ]); +("y3_def", [1; 6; 10; 13; 14; 17; 21; 24; 25; 28; 29; 30; 33; 38; 39; 42; 47; 50; 52; 53; 54; 55; 57; 59; 62; 64; 65; ], [2468L; 1254L; 959L; 406L; 95L; 703L; 255L; 10L; 20L; 20L; 10L; 255L; 296L; 469L; 372L; 701L; 372L; 373L; 11L; 10L; 10L; 10L; 10L; 10L; 22L; 250L; 123L; ]); +("y4_def", [8; 11; 12; 15; 17; 18; 21; 25; 26; 27; 28; 30; 32; 35; 36; 38; 41; 42; 45; 49; 56; 58; 59; 63; ], [541L; 1907L; 541L; 1192L; 656L; 384L; 613L; 1L; 348L; 7L; 1L; 613L; 342L; 384L; 1019L; 830L; 225L; 2113L; 225L; 5L; 7L; 7L; 1L; 5L; ]); +("y4_def_neg", [6; 7; 10; 13; 14; 20; 24; 29; 33; 34; 39; 47; 50; 52; 53; 54; 55; 57; 62; 64; 65; ], [2361L; 1570L; 1806L; 765L; 953L; 830L; 19L; 19L; 543L; 286L; 701L; 701L; 371L; 21L; 5L; 19L; 19L; 19L; 27L; 129L; 242L; ]); +("y5_def_neg", [1; 5; 7; 8; 11; 12; 15; 17; 20; 21; 26; 27; 30; 34; 38; 49; 50; 53; 56; 58; 63; 64; ], [1396L; 613L; 399L; 106L; 307L; 106L; 234L; 363L; 6L; 379L; 1L; 1L; 379L; 286L; 597L; 1L; 5L; 5L; 1L; 1L; 1L; 129L; ]); +("y5_def", [6; 10; 13; 14; 24; 25; 28; 29; 33; 39; 42; 47; 52; 54; 55; 57; 59; 62; 65; ], [1254L; 959L; 406L; 449L; 10L; 20L; 20L; 10L; 280L; 372L; 701L; 372L; 11L; 10L; 10L; 10L; 10L; 6L; 124L; ]); +("y6_def_neg", [1; 5; 7; 8; 11; 12; 15; 17; 20; 21; 26; 27; 30; 34; 38; 49; 50; 53; 56; 58; 63; 64; ], [613L; 1396L; 399L; 106L; 307L; 106L; 234L; 363L; 6L; 379L; 1L; 1L; 379L; 286L; 597L; 1L; 5L; 5L; 1L; 1L; 1L; 129L; ]); +("y6_def", [6; 10; 13; 14; 24; 25; 28; 29; 33; 39; 42; 47; 52; 54; 55; 57; 59; 62; 65; ], [1254L; 959L; 406L; 449L; 10L; 20L; 20L; 10L; 280L; 372L; 701L; 372L; 11L; 10L; 10L; 10L; 10L; 6L; 124L; ]); +("azim2c", [1; ], [4068L; ]); +("azim3c", [5; ], [4068L; ]); +("rhazim2c", [1; ], [2305L; ]); +("rhazim3c", [5; ], [2305L; ]); +("RHA", [1; 5; 9; 11; 16; 17; 18; 19; 23; 25; 28; 31; 34; 35; 36; 37; 39; 40; 41; 42; 43; 44; 45; 46; 47; 48; 49; 50; 63; 64; 65; ], [675L; 675L; 1520L; 1520L; 1792L; 1792L; 785L; 785L; 1630L; 1575L; 1575L; 1630L; 785L; 785L; 1792L; 1792L; 1468L; 700L; 2390L; 464L; 700L; 700L; 2390L; 700L; 1468L; 492L; 593L; 243L; 593L; 492L; 243L; ]); +("ineq97", [1; ], [2305L; ]); +("ineq99", [1; ], [4068L; ]); +("ineq101", [1; 5; ], [2819L; 2819L; ]); +("ineq102", [1; 5; ], [8339L; 8339L; ]); +("ineq107", [6; 7; 10; 13; 14; 20; 25; 28; 33; 39; 42; 47; 50; 65; ], [1792L; 1116L; 2636L; 1116L; 1792L; 785L; 56L; 56L; 785L; 1023L; 1926L; 1023L; 349L; 349L; ]); +("ineq108", [8; 12; 15; 21; 26; 27; 30; 38; 49; 56; 58; 63; ], [700L; 700L; 1542L; 1072L; 8L; 8L; 1072L; 1542L; 6L; 8L; 8L; 6L; ]); +("ineq109", [6; 14; 24; 29; 52; 54; 55; 57; 59; 62; ], [1656L; 1656L; 28L; 28L; 31L; 28L; 28L; 28L; 28L; 31L; ]); +("ineq111", [17; 20; 21; 30; 33; 38; 50; 53; 62; 64; ], [1850L; 28L; 1100L; 1100L; 28L; 1850L; 658L; 28L; 28L; 658L; ]); +("ineq112", [7; 11; 14; 20; 34; 50; 65; ], [6442L; 2453L; 6442L; 2290L; 2290L; 25L; 25L; ]); +("ineq114", [15; 38; ], [3891L; 3891L; ]); +("ineq115", [6; 9; 11; 14; 16; 18; 19; 22; 23; 25; 28; 31; 32; 34; 35; 37; 39; 41; 42; 45; 47; 50; 51; 54; 57; 60; 65; ], [780L; 1310L; 1310L; 780L; 3331L; 1304L; 4635L; 1668L; 7346L; 9014L; 9014L; 7346L; 1668L; 4635L; 1304L; 3331L; 2439L; 4084L; 1007L; 4084L; 2439L; 8396L; 9014L; 9014L; 9014L; 9014L; 8396L; ]); +("ineq30", [5; ], [2305L; ]); +("ineq31", [5; ], [4068L; ]); +];; + +(***************) +(* Variables *) +(***************) +target_variables := [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [37416L; 46948L; 50726L; 46948L; 41726L; 41726L; 46948L; 46948L; 46948L; 46948L; 46948L; 42492L; 46948L; ]); +];; + +(*************************) + +variable_bounds := [ +("azim_hi", [6; 9; 11; 14; 15; 18; 19; 22; 23; 31; 32; 34; 35; 38; 41; 42; 45; ], [2800L; 600L; 600L; 2800L; 2310L; 3040L; 5100L; 1680L; 5960L; 5960L; 1680L; 5100L; 3040L; 2310L; 5840L; 3820L; 5840L; ]); +("azim_lo", [16; 17; 25; 28; 36; 37; 39; 47; 50; 51; 54; 57; 60; 65; ], [7940L; 10000L; 2360L; 2360L; 10000L; 7940L; 1860L; 1860L; 1040L; 2360L; 2360L; 2360L; 2360L; 1040L; ]); +("rhazim_hi", [6; 14; 16; 17; 25; 28; 36; 37; ], [10000L; 10000L; 10000L; 10000L; 10000L; 10000L; 10000L; 10000L; ]); +("rhazim_lo", [50; 65; ], [10000L; 10000L; ]); +("rho_lo", [0; 1; 2; 3; 6; 7; 8; 9; 10; 12; ], [3952L; 12352L; 26192L; 12352L; 12352L; 12352L; 12352L; 12352L; 12352L; 12352L; ]); +("rho_hi", [4; 5; 11; ], [25536L; 25536L; 1616L; ]); +("tau_lo", [2; 3; 4; 5; 12; 14; ], [10000L; 6300000L; 10000L; 10000L; 10000L; 55160000L; ]); +("y1_lo", [1; 5; 6; 7; 24; 25; 28; 29; 34; 52; 54; 55; 57; 59; ], [5020L; 5020L; 3600L; 1600L; 5800L; 6000L; 6000L; 5800L; 2000L; 2850L; 5800L; 5800L; 5800L; 5800L; ]); +("y1_hi", [10; 11; 13; 14; 20; 33; 39; 42; 47; 50; 53; 62; 64; 65; ], [4000L; 4600L; 4000L; 800L; 4400L; 6400L; 2000L; 4000L; 2000L; 1400L; 6400L; 3550L; 400L; 1000L; ]); +("y2_hi", [1; 6; 10; 11; 13; 14; 20; 21; 24; 25; 28; 29; 30; 33; 39; 47; 49; 52; 53; 54; 55; 57; 59; 63; 64; ], [2920L; 7272L; 2404L; 4600L; 1124L; 1672L; 1015L; 560L; 1892L; 3784L; 3784L; 1892L; 560L; 3015L; 2697L; 2697L; 880L; 2809L; 6400L; 1892L; 1892L; 1892L; 1892L; 880L; 400L; ]); +("y2_lo", [5; 7; 8; 12; 15; 26; 27; 34; 38; 42; 50; 56; 58; 62; 65; ], [4880L; 4476L; 4000L; 4000L; 3840L; 2160L; 2160L; 2000L; 3840L; 1286L; 4589L; 2160L; 2160L; 791L; 4989L; ]); +("y3_lo", [1; 7; 8; 12; 15; 26; 27; 34; 38; 42; 50; 56; 58; 62; 65; ], [4880L; 4476L; 4000L; 4000L; 3840L; 2160L; 2160L; 2000L; 3840L; 1286L; 4589L; 2160L; 2160L; 791L; 4989L; ]); +("y3_hi", [5; 6; 10; 11; 13; 14; 20; 21; 24; 25; 28; 29; 30; 33; 39; 47; 49; 52; 53; 54; 55; 57; 59; 63; 64; ], [2920L; 7272L; 2404L; 4600L; 1124L; 1672L; 1015L; 560L; 1892L; 3784L; 3784L; 1892L; 560L; 3015L; 2697L; 2697L; 880L; 2809L; 6400L; 1892L; 1892L; 1892L; 1892L; 880L; 400L; ]); +("y4_lo", [1; 5; 6; 11; 14; 15; 17; 18; 24; 25; 26; 27; 28; 29; 32; 33; 34; 35; 36; 38; 41; 42; 45; 49; 50; 52; 53; 54; 55; 56; 57; 58; 59; 63; 65; ], [690L; 690L; 8800L; 22140000L; 22141300L; 340L; 10190000L; 3840000L; 1800L; 393600L; 3420000L; 8160L; 393600L; 1800L; 3420000L; 2130L; 2500L; 3840000L; 10190000L; 6340L; 2250000L; 34323100L; 2250000L; 3620L; 1580L; 2350L; 4880L; 1800L; 1800L; 8160L; 1800L; 8160L; 201800L; 3620L; 1900L; ]); +("y4_hi", [7; 8; 10; 11; 12; 13; 17; 20; 21; 26; 30; 39; 47; 62; 64; ], [2900L; 1000L; 3400L; 3750L; 1000L; 5400L; 4000L; 5370L; 560L; 1840L; 560L; 2450L; 2450L; 2770L; 320L; ]); +("y5_hi", [1; 6; 10; 11; 13; 14; 17; 21; 24; 25; 28; 29; 30; 33; 38; 39; 47; 49; 52; 54; 55; 57; 59; 63; 64; ], [2210L; 7272L; 2404L; 3750L; 1124L; 4772L; 4000L; 4560L; 1892L; 3784L; 3784L; 1892L; 4560L; 1735L; 160L; 2697L; 2697L; 880L; 2809L; 1892L; 1892L; 1892L; 1892L; 880L; 320L; ]); +("y5_lo", [1; 5; 7; 8; 12; 15; 20; 26; 27; 34; 42; 50; 53; 56; 58; 62; 65; ], [38670000L; 3360L; 1376L; 4000L; 4000L; 3840L; 765L; 2160L; 2160L; 2500L; 1286L; 919L; 4880L; 2160L; 2160L; 2071L; 1239L; ]); +("y6_lo", [1; 5; 7; 8; 12; 15; 20; 26; 27; 34; 42; 50; 53; 56; 58; 62; 65; ], [3360L; 38670000L; 1376L; 4000L; 4000L; 3840L; 765L; 2160L; 2160L; 2500L; 1286L; 919L; 4880L; 2160L; 2160L; 2071L; 1239L; ]); +("y6_hi", [5; 6; 10; 11; 13; 14; 17; 21; 24; 25; 28; 29; 30; 33; 38; 39; 47; 49; 52; 54; 55; 57; 59; 63; 64; ], [2210L; 7272L; 2404L; 3750L; 1124L; 4772L; 4000L; 4560L; 1892L; 3784L; 3784L; 1892L; 4560L; 1735L; 160L; 2697L; 2697L; 880L; 2809L; 1892L; 1892L; 1892L; 1892L; 880L; 320L; ]); +("ye_hi", [7; 34; 53; ], [10000L; 10000L; 10000L; ]); +("ye_lo", [9; 10; 16; 19; 24; 33; ], [10000L; 10000L; 10000L; 10000L; 10000L; 10000L; ]); +("yn_hi", [0; 1; 2; 3; 6; 7; 9; 10; 12; ], [620L; 6970L; 5016L; 16970L; 6970L; 6970L; 16970L; 6970L; 16970L; ]); +("yn_lo", [4; 5; 8; 11; ], [2280L; 2280L; 13030L; 6790L; ]); +];; diff --git a/formal_lp/glpk/ex2/bb2_3_out.hl b/formal_lp/glpk/ex2/bb2_3_out.hl new file mode 100644 index 0000000..bcb12fa --- /dev/null +++ b/formal_lp/glpk/ex2/bb2_3_out.hl @@ -0,0 +1,83 @@ +hypermap_string := "21943083135 21 4 0 1 2 3 3 0 3 4 3 4 3 5 3 5 3 2 3 5 2 6 3 6 2 7 3 7 2 1 3 7 1 8 3 8 1 9 3 9 1 0 3 9 0 10 3 10 0 4 3 10 4 11 3 11 4 5 3 11 5 6 3 11 6 12 3 12 6 7 3 12 7 8 3 12 8 9 3 12 9 10 3 10 11 12 ";; +precision := 3;; +(***************) +(* Constraints *) +(***************) +constraints := [ +("azim_sum", [1; 2; 3; 6; 10; 11; 12; ], [196L; 366L; 198L; 26L; 31L; 83L; 479L; ]); +("azim_sum_neg", [4; 5; 7; 8; 9; ], [56L; 65L; 39L; 83L; 35L; ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [631L; 937L; 937L; 937L; 738L; 747L; 836L; 870L; 830L; 866L; 833L; 801L; 906L; ]); +("sol_sum3_neg", [5; 6; 7; 10; 11; 12; 13; 15; 16; 17; 19; 20; 21; ], [302L; 56L; 55L; 62L; 61L; 200L; 278L; 120L; 83L; 26L; 1L; 31L; 83L; ]); +("sol_sum3", [8; 9; ], [24L; 23L; ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; ], [937L; 631L; 631L; 631L; 631L; 560L; 806L; 870L; 830L; 830L; 866L; 803L; 664L; 422L; 682L; 554L; 801L; 836L; 830L; 830L; 833L; 801L; ]); +("ln_def_neg", [1; 2; 3; ], [33L; 33L; 33L; ]); +("ln_def", [0; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [304L; 186L; 176L; 78L; 41L; 85L; 45L; 81L; 117L; 1L; ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [3966L; 5886L; 5886L; 5886L; 4637L; 4696L; 5253L; 5464L; 5215L; 5440L; 5235L; 5032L; 5695L; ]); +("edge_sym_neg", [2; 7; 11; 17; 23; 32; 34; 38; 40; 48; 49; 52; 53; 55; 58; 61; 63; ], [494L; 109L; 59L; 28L; 54L; 12L; 55L; 2L; 74L; 20L; 20L; 10L; 10L; 37L; 37L; 11L; 19L; ]); +("edge_sym", [6; 8; 10; 13; 14; 16; 19; 22; 25; 28; 31; 44; 50; 59; 62; ], [297L; 58L; 239L; 343L; 82L; 55L; 10L; 78L; 2L; 54L; 77L; 74L; 1L; 11L; 19L; ]); +("y1_def", [5; 15; 16; 19; 21; 26; 27; 30; 36; 38; 40; 41; 46; 49; 50; 52; 53; 56; 58; 61; 63; 65; ], [347L; 74L; 115L; 19L; 68L; 30L; 30L; 72L; 76L; 61L; 9L; 106L; 44L; 11L; 32L; 10L; 16L; 42L; 42L; 28L; 10L; 32L; ]); +("y1_def_neg", [1; 2; 3; 6; 9; 12; 14; 20; 22; 25; 28; 32; 33; 39; 42; 47; 54; 57; ], [279L; 79L; 79L; 95L; 84L; 43L; 183L; 37L; 25L; 4L; 3L; 24L; 15L; 98L; 91L; 80L; 21L; 21L; ]); +("y2_def_neg", [5; 9; 12; 15; 25; 26; 27; 28; 38; 40; 49; 53; 56; 58; 63; ], [93L; 84L; 43L; 22L; 4L; 9L; 9L; 3L; 19L; 3L; 3L; 5L; 13L; 13L; 3L; ]); +("y2_def", [0; 1; 4; 6; 14; 16; 19; 20; 21; 22; 30; 32; 33; 36; 39; 41; 42; 46; 47; 50; 52; 54; 57; 61; 65; ], [98L; 116L; 98L; 58L; 111L; 115L; 19L; 22L; 7L; 15L; 9L; 15L; 46L; 76L; 60L; 106L; 74L; 48L; 48L; 32L; 10L; 13L; 13L; 7L; 32L; ]); +("y3_def_neg", [9; 12; 15; 25; 26; 27; 28; 38; 40; 49; 53; 56; 58; 63; ], [84L; 43L; 22L; 4L; 9L; 9L; 3L; 19L; 3L; 3L; 5L; 13L; 13L; 3L; ]); +("y3_def", [1; 2; 3; 5; 6; 14; 16; 19; 20; 21; 22; 30; 32; 33; 36; 39; 41; 42; 46; 47; 50; 52; 54; 57; 61; 65; ], [116L; 98L; 98L; 10L; 58L; 111L; 115L; 19L; 22L; 7L; 15L; 9L; 15L; 46L; 76L; 60L; 106L; 74L; 48L; 48L; 32L; 10L; 13L; 13L; 7L; 32L; ]); +("y4_def", [5; 8; 9; 11; 12; 15; 21; 24; 25; 26; 27; 28; 30; 35; 37; 38; 40; 42; 49; 53; 56; 58; 61; 63; ], [494L; 240L; 239L; 167L; 232L; 114L; 62L; 3L; 8L; 46L; 47L; 46L; 62L; 1L; 55L; 94L; 14L; 59L; 17L; 25L; 64L; 65L; 19L; 16L; ]); +("y4_def_neg", [1; 6; 14; 16; 19; 20; 22; 32; 33; 36; 39; 41; 46; 47; 50; 52; 54; 57; 65; ], [494L; 109L; 209L; 5L; 12L; 42L; 29L; 27L; 55L; 39L; 16L; 54L; 29L; 53L; 16L; 5L; 25L; 24L; 16L; ]); +("y5_def_neg", [1; 5; 9; 12; 15; 16; 19; 21; 26; 27; 30; 36; 38; 40; 41; 46; 49; 50; 52; 53; 56; 58; 61; 63; 65; ], [175L; 441L; 59L; 30L; 22L; 59L; 12L; 25L; 9L; 9L; 27L; 39L; 19L; 3L; 54L; 21L; 3L; 16L; 5L; 5L; 13L; 13L; 11L; 3L; 16L; ]); +("y5_def", [2; 3; 6; 14; 20; 22; 25; 28; 32; 33; 39; 42; 47; 54; 57; ], [98L; 98L; 58L; 111L; 22L; 15L; 8L; 7L; 15L; 11L; 60L; 74L; 48L; 13L; 13L; ]); +("y6_def_neg", [1; 5; 9; 12; 15; 16; 19; 21; 27; 30; 36; 38; 40; 41; 46; 49; 50; 52; 53; 56; 58; 61; 63; 65; ], [175L; 395L; 59L; 30L; 22L; 59L; 12L; 25L; 9L; 27L; 39L; 19L; 3L; 54L; 21L; 3L; 16L; 5L; 5L; 13L; 13L; 11L; 3L; 16L; ]); +("y6_def", [0; 4; 6; 14; 20; 22; 25; 26; 28; 32; 33; 39; 42; 47; 54; 57; ], [98L; 98L; 58L; 111L; 22L; 15L; 8L; 30L; 7L; 15L; 11L; 60L; 74L; 48L; 13L; 13L; ]); +("azim2c", [5; ], [306L; ]); +("azim3c", [5; ], [306L; ]); +("RHA", [3; 4; 6; 8; 9; 11; 12; 15; 16; 17; 18; 19; 20; 22; 23; 24; 25; 28; 29; 31; 32; 34; 35; 36; 37; 38; 39; 40; 41; 43; 44; 45; 46; 47; 49; 50; 51; 53; 54; 55; 57; 59; 60; 61; 63; 65; ], [306L; 306L; 147L; 107L; 107L; 116L; 116L; 188L; 377L; 276L; 30L; 131L; 2L; 25L; 67L; 39L; 107L; 107L; 36L; 71L; 31L; 134L; 31L; 169L; 273L; 74L; 247L; 316L; 379L; 56L; 65L; 246L; 193L; 149L; 35L; 106L; 70L; 33L; 41L; 39L; 42L; 36L; 73L; 33L; 32L; 106L; ]); +("yy10", [54; 59; ], [68L; 67L; ]); +("crossdiag", [2; 3; ], [196L; 198L; ]); +("ineq82", [1; ], [366L; ]); +("ineq84", [5; ], [306L; ]); +("ineq85", [1; 5; ], [937L; 631L; ]); +("ineq107", [6; 14; 20; 22; 32; 33; 39; 42; 47; 54; 57; ], [159L; 306L; 62L; 42L; 40L; 63L; 164L; 119L; 133L; 36L; 35L; ]); +("ineq108", [15; 21; 26; 27; 30; 38; 40; 49; 53; 56; 58; 61; 63; ], [147L; 95L; 60L; 60L; 96L; 122L; 18L; 22L; 32L; 83L; 84L; 33L; 20L; ]); +("ineq109", [42; 46; ], [83L; 8L; ]); +("ineq110", [25; 28; ], [24L; 23L; ]); +("ineq111", [16; 19; 21; 30; 33; 36; 41; 46; 50; 52; 59; 61; 65; ], [302L; 56L; 55L; 62L; 61L; 200L; 278L; 120L; 83L; 26L; 1L; 31L; 83L; ]); +("ineq112", [9; 12; 19; ], [469L; 236L; 12L; ]); +("ineq114", [15; 20; 33; 38; ], [127L; 362L; 371L; 232L; ]); +("ineq115", [6; 8; 9; 11; 12; 14; 16; 19; 22; 23; 24; 25; 28; 29; 31; 32; 34; 37; 41; 45; 47; 50; 51; 54; 57; 60; 65; ], [550L; 81L; 81L; 81L; 81L; 314L; 433L; 433L; 266L; 604L; 38L; 792L; 792L; 38L; 599L; 267L; 432L; 432L; 294L; 335L; 88L; 801L; 836L; 830L; 830L; 833L; 801L; ]); +("ineq6", [5; ], [306L; ]); +];; + +(***************) +(* Variables *) +(***************) +target_variables := [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [1950L; 2950L; 2950L; 2950L; 2525L; 2200L; 2725L; 2800L; 2375L; 3000L; 2875L; 2400L; 2375L; ]); +];; + +(*************************) + +variable_bounds := [ +("azim_lo", [6; 8; 9; 11; 12; 15; 20; 21; 24; 25; 26; 28; 29; 31; 33; 34; 35; 37; 38; 50; 54; 57; 65; ], [700L; 294L; 294L; 294L; 294L; 893L; 758L; 1000L; 212L; 1208L; 1000L; 208L; 212L; 26L; 89L; 568L; 1000L; 568L; 88L; 574L; 420L; 420L; 574L; ]); +("azim_hi", [14; 16; 19; 22; 23; 30; 32; 41; 45; 47; 51; 60; ], [564L; 58L; 58L; 516L; 104L; 1000L; 142L; 44L; 710L; 88L; 336L; 458L; ]); +("rhazim_hi", [15; 35; 50; 54; 57; 65; ], [1000L; 1000L; 1000L; 1000L; 1000L; 1000L; ]); +("rhazim_lo", [24; 45; 53; 55; ], [1000L; 1000L; 1000L; 1000L; ]); +("rho_hi", [1; 2; 3; 4; 6; 7; 8; 9; 11; ], [2108L; 2108L; 2108L; 592L; 424L; 3080L; 720L; 1944L; 1484L; ]); +("rho_lo", [0; 5; 10; 12; ], [796L; 1852L; 428L; 1696L; ]); +("tau_lo", [13; 14; 15; ], [128000L; 682000L; 132000L; ]); +("tau_hi", [6; 15; ], [1000L; 1000L; ]); +("y1_lo", [3; 6; 9; 14; 15; 16; 20; 22; 28; 30; 39; 41; 46; 50; 52; 54; 56; 65; ], [200L; 400L; 420L; 600L; 500L; 240L; 200L; 200L; 473L; 440L; 400L; 360L; 280L; 460L; 120L; 600L; 500L; 460L; ]); +("y1_hi", [1; 2; 5; 12; 19; 21; 25; 33; 42; 47; 59; 61; ], [483L; 600L; 1303L; 520L; 120L; 400L; 376L; 380L; 95L; 200L; 380L; 280L; ]); +("y2_hi", [0; 1; 5; 12; 14; 19; 20; 22; 25; 33; 38; 40; 46; 47; 53; 54; 56; 58; 59; ], [406L; 312L; 788L; 520L; 384L; 120L; 568L; 288L; 376L; 112L; 456L; 264L; 512L; 412L; 136L; 104L; 384L; 232L; 380L; ]); +("y2_lo", [4; 6; 9; 15; 16; 21; 26; 27; 28; 30; 32; 39; 41; 42; 49; 50; 52; 57; 61; 63; 65; ], [588L; 124L; 420L; 344L; 240L; 540L; 120L; 120L; 473L; 32L; 440L; 304L; 360L; 472L; 344L; 460L; 120L; 260L; 236L; 40L; 460L; ]); +("y3_hi", [1; 3; 5; 12; 14; 19; 20; 22; 25; 33; 38; 40; 46; 47; 53; 54; 56; 58; 59; ], [312L; 406L; 910L; 520L; 384L; 120L; 568L; 288L; 376L; 112L; 456L; 264L; 512L; 412L; 136L; 104L; 384L; 232L; 380L; ]); +("y3_lo", [2; 6; 9; 15; 16; 21; 26; 27; 28; 30; 32; 39; 41; 42; 49; 50; 52; 57; 61; 63; 65; ], [588L; 124L; 420L; 344L; 240L; 540L; 120L; 120L; 473L; 32L; 440L; 304L; 360L; 472L; 344L; 460L; 120L; 260L; 236L; 40L; 460L; ]); +("y4_hi", [1; 5; 6; 9; 21; 22; 26; 28; 30; 38; 49; 54; 56; 57; 61; ], [401L; 335L; 85L; 375L; 655L; 230L; 380L; 452L; 56L; 306L; 6L; 340L; 159L; 25L; 433L; ]); +("y4_lo", [8; 9; 11; 12; 14; 15; 16; 19; 20; 24; 25; 27; 28; 32; 33; 35; 36; 37; 39; 40; 41; 42; 47; 50; 52; 53; 58; 59; 63; 65; ], [240000L; 298000L; 167000L; 261500L; 610L; 369L; 54192L; 476L; 470L; 3000L; 224L; 620L; 39000L; 400L; 111L; 1000L; 200L; 55000L; 96340L; 86L; 488L; 197370L; 38105L; 268L; 96L; 264L; 68L; 196L; 540L; 268L; ]); +("y5_hi", [3; 5; 9; 12; 14; 20; 22; 28; 30; 38; 40; 46; 47; 53; 54; 56; 58; ], [406L; 465L; 375L; 500L; 384L; 568L; 288L; 452L; 256L; 456L; 264L; 392L; 412L; 136L; 104L; 384L; 232L; ]); +("y5_lo", [1; 2; 6; 15; 16; 19; 21; 25; 26; 27; 32; 33; 36; 39; 41; 42; 49; 50; 52; 57; 59; 61; 63; 65; ], [95L; 588L; 124L; 344L; 192L; 476L; 220L; 224L; 120L; 120L; 440L; 24L; 200L; 304L; 488L; 472L; 344L; 268L; 96L; 260L; 196L; 92L; 40L; 268L; ]); +("y6_hi", [0; 9; 12; 14; 20; 22; 28; 30; 38; 40; 46; 47; 53; 54; 56; 58; ], [406L; 375L; 500L; 384L; 568L; 288L; 452L; 256L; 456L; 264L; 392L; 412L; 136L; 104L; 384L; 232L; ]); +("y6_lo", [1; 4; 5; 6; 15; 16; 19; 21; 25; 26; 27; 32; 33; 36; 39; 41; 42; 49; 50; 52; 57; 59; 61; 63; 65; ], [95L; 588L; 247L; 124L; 344L; 192L; 476L; 220L; 224L; 39120L; 120L; 440L; 24L; 200L; 304L; 488L; 472L; 344L; 268L; 96L; 260L; 196L; 92L; 40L; 268L; ]); +("ye_hi", [1; 6; 15; 17; 18; 26; 39; 40; 41; 48; 49; 64; ], [1000L; 1000L; 1000L; 1000L; 1000L; 1000L; 1000L; 1000L; 1000L; 1000L; 1000L; 1000L; ]); +("ye_lo", [9; 14; 22; 38; 46; 47; 54; 55; ], [1000L; 1000L; 1000L; 1000L; 1000L; 1000L; 1000L; 1000L; ]); +("yn_hi", [0; 1; 2; 3; 4; 5; 6; 9; 10; 11; 12; ], [408L; 492L; 1492L; 492L; 2322L; 552L; 6L; 1465L; 1237L; 1009L; 77L; ]); +("yn_lo", [7; 8; ], [843L; 455L; ]); +];; diff --git a/formal_lp/glpk/ex2/bb2_4_out.hl b/formal_lp/glpk/ex2/bb2_4_out.hl new file mode 100644 index 0000000..f6b8a30 --- /dev/null +++ b/formal_lp/glpk/ex2/bb2_4_out.hl @@ -0,0 +1,79 @@ +hypermap_string := "21943083135 21 4 0 1 2 3 3 0 3 4 3 4 3 5 3 5 3 2 3 5 2 6 3 6 2 7 3 7 2 1 3 7 1 8 3 8 1 9 3 9 1 0 3 9 0 10 3 10 0 4 3 10 4 11 3 11 4 5 3 11 5 6 3 11 6 12 3 12 6 7 3 12 7 8 3 12 8 9 3 12 9 10 3 10 11 12 ";; +precision := 4;; +(***************) +(* Constraints *) +(***************) +constraints := [ +("azim_sum", [1; 2; 3; 6; 10; 11; 12; ], [3597L; 3408L; 3597L; 776L; 776L; 1497L; 5524L; ]); +("azim_sum_neg", [4; 5; 8; ], [477L; 477L; 1021L; ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [8550L; 9227L; 8550L; 9227L; 8696L; 8696L; 8421L; 8421L; 8421L; 8421L; 8421L; 7863L; 8595L; ]); +("sol_sum3_neg", [5; 6; 7; 10; 11; 12; 13; 14; 15; 16; 17; 20; 21; ], [776L; 776L; 1335L; 1335L; 776L; 776L; 1715L; 997L; 1715L; 1334L; 427L; 427L; 1334L; ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; ], [8550L; 8550L; 8550L; 8219L; 8550L; 8421L; 8421L; 8421L; 8421L; 8421L; 8421L; 8421L; 8421L; 6949L; 7863L; 6949L; 7863L; 8421L; 8421L; 8421L; 8421L; 7863L; ]); +("ln_def_neg", [1; 3; ], [174L; 174L; ]); +("ln_def", [0; 2; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [573L; 573L; 412L; 412L; 715L; 715L; 715L; 715L; 715L; 1331L; 523L; ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [53721L; 57977L; 53721L; 57977L; 54638L; 54638L; 52910L; 52910L; 52910L; 52910L; 52910L; 49404L; 54004L; ]); +("edge_sym_neg", [7; 8; 11; 14; 17; 19; 23; 32; 34; 38; 40; 48; 49; 50; 52; 53; 55; 58; 61; 63; ], [266L; 266L; 1254L; 266L; 197L; 167L; 464L; 464L; 78L; 197L; 769L; 202L; 373L; 202L; 21L; 945L; 447L; 447L; 21L; 202L; ]); +("edge_sym", [3; 6; 10; 13; 16; 22; 25; 28; 31; 44; 59; 62; ], [209L; 41L; 266L; 2902L; 78L; 770L; 480L; 464L; 770L; 385L; 388L; 373L; ]); +("y1_def", [8; 12; 15; 17; 18; 20; 21; 22; 26; 30; 33; 35; 37; 38; 40; 41; 43; 44; 46; 47; 50; 51; 53; 56; 58; 60; 61; 65; ], [166L; 166L; 149L; 295L; 295L; 48L; 667L; 507L; 511L; 1175L; 48L; 295L; 295L; 149L; 223L; 652L; 320L; 699L; 223L; 332L; 507L; 162L; 213L; 511L; 511L; 162L; 213L; 507L; ]); +("y1_def_neg", [1; 2; 5; 6; 9; 10; 14; 24; 25; 27; 28; 39; 42; 48; 52; 54; 57; 62; 64; ], [1016L; 167L; 1016L; 310L; 1479L; 199L; 310L; 536L; 77L; 25L; 77L; 319L; 118L; 38L; 82L; 100L; 164L; 82L; 38L; ]); +("y2_def", [1; 4; 5; 10; 17; 18; 22; 25; 28; 30; 35; 37; 39; 41; 42; 44; 47; 48; 50; 51; 52; 54; 57; 60; 62; 64; 65; ], [1099L; 208L; 1750L; 121L; 295L; 295L; 507L; 47L; 47L; 304L; 295L; 295L; 194L; 652L; 182L; 281L; 845L; 59L; 507L; 162L; 127L; 155L; 155L; 162L; 127L; 59L; 507L; ]); +("y2_def_neg", [6; 8; 9; 12; 14; 15; 20; 21; 24; 26; 27; 33; 38; 40; 43; 46; 53; 56; 58; 61; ], [310L; 50L; 1479L; 50L; 310L; 45L; 15L; 203L; 536L; 155L; 691L; 15L; 45L; 68L; 97L; 68L; 65L; 155L; 155L; 65L; ]); +("y3_def", [1; 2; 5; 10; 17; 18; 22; 25; 28; 30; 35; 37; 39; 41; 42; 44; 47; 48; 50; 51; 52; 54; 57; 60; 62; 64; 65; ], [1750L; 208L; 1099L; 121L; 295L; 295L; 507L; 47L; 47L; 304L; 295L; 295L; 194L; 652L; 182L; 281L; 845L; 59L; 507L; 162L; 127L; 155L; 155L; 162L; 127L; 59L; 507L; ]); +("y3_def_neg", [6; 8; 9; 12; 14; 15; 20; 21; 24; 26; 27; 33; 38; 40; 43; 46; 53; 56; 58; 61; ], [310L; 50L; 1479L; 50L; 310L; 45L; 15L; 203L; 536L; 155L; 691L; 15L; 45L; 68L; 97L; 68L; 65L; 155L; 155L; 65L; ]); +("y4_def_neg", [1; 6; 10; 14; 18; 22; 37; 39; 47; 48; 50; 51; 52; 54; 57; 60; 62; 64; 65; ], [209L; 215L; 227L; 215L; 152L; 262L; 152L; 365L; 317L; 112L; 261L; 84L; 239L; 292L; 292L; 84L; 239L; 112L; 261L; ]); +("y4_def", [5; 8; 9; 11; 12; 15; 17; 19; 20; 21; 23; 24; 25; 26; 27; 28; 30; 33; 34; 35; 36; 38; 40; 41; 42; 43; 44; 45; 46; 53; 56; 58; 61; 63; ], [209L; 256L; 145L; 1172L; 3118L; 230L; 311L; 188L; 74L; 1032L; 631L; 589L; 975L; 789L; 417L; 975L; 770L; 74L; 188L; 479L; 463L; 230L; 344L; 71L; 1644L; 495L; 684L; 407L; 344L; 330L; 789L; 789L; 330L; 404L; ]); +("y5_def_neg", [1; 5; 6; 8; 9; 12; 14; 15; 17; 18; 20; 21; 22; 24; 26; 27; 30; 33; 35; 37; 38; 40; 41; 43; 44; 46; 47; 50; 51; 53; 56; 58; 60; 61; 65; ], [41L; 978L; 215L; 50L; 1027L; 50L; 215L; 45L; 152L; 152L; 15L; 203L; 262L; 372L; 155L; 527L; 464L; 15L; 152L; 152L; 45L; 68L; 336L; 97L; 293L; 68L; 142L; 261L; 84L; 65L; 155L; 155L; 84L; 65L; 261L; ]); +("y5_def", [2; 10; 25; 28; 39; 42; 48; 52; 54; 57; 62; 64; ], [208L; 121L; 47L; 47L; 194L; 182L; 59L; 127L; 155L; 155L; 127L; 59L; ]); +("y6_def_neg", [1; 5; 6; 8; 9; 12; 14; 15; 17; 18; 20; 21; 22; 24; 26; 27; 30; 33; 35; 37; 38; 40; 41; 43; 44; 46; 47; 50; 51; 53; 56; 58; 60; 61; 65; ], [978L; 2902L; 215L; 50L; 1027L; 50L; 215L; 45L; 152L; 152L; 15L; 203L; 262L; 372L; 155L; 527L; 464L; 15L; 152L; 152L; 45L; 68L; 336L; 97L; 293L; 68L; 142L; 261L; 84L; 65L; 155L; 155L; 84L; 65L; 261L; ]); +("y6_def", [4; 10; 25; 28; 39; 42; 48; 52; 54; 57; 62; 64; ], [208L; 121L; 47L; 47L; 194L; 182L; 59L; 127L; 155L; 155L; 127L; 59L; ]); +("azim2c", [1; ], [2991L; ]); +("azim3c", [5; ], [2991L; ]); +("RHA", [1; 5; 6; 8; 9; 11; 12; 14; 15; 16; 19; 22; 23; 31; 32; 34; 37; 38; 39; 40; 41; 43; 44; 45; 46; 47; 49; 50; 51; 54; 60; 63; 65; ], [677L; 677L; 677L; 146L; 477L; 477L; 146L; 677L; 275L; 806L; 806L; 806L; 129L; 129L; 806L; 806L; 806L; 275L; 939L; 1747L; 914L; 833L; 833L; 914L; 1747L; 939L; 558L; 732L; 174L; 174L; 174L; 558L; 732L; ]); +("yy10", [53; 59; ], [557L; 557L; ]); +("crossdiag", [2; ], [418L; ]); +("ineq38", [1; ], [2991L; ]); +("ineq82", [1; 5; ], [4274L; 4274L; ]); +("ineq85", [1; 5; ], [8550L; 8550L; ]); +("ineq107", [10; 25; 28; 39; 47; 57; ], [331L; 129L; 129L; 532L; 532L; 174L; ]); +("ineq108", [8; 12; 15; 20; 21; 26; 27; 30; 33; 38; 40; 43; 44; 46; 53; 56; 58; 61; ], [331L; 331L; 298L; 96L; 1335L; 1021L; 1021L; 1335L; 96L; 298L; 446L; 641L; 641L; 446L; 427L; 1021L; 1021L; 427L; ]); +("ineq109", [42; 48; 52; 54; 57; 62; 64; ], [500L; 163L; 349L; 427L; 253L; 349L; 163L; ]); +("ineq111", [17; 18; 22; 30; 35; 37; 41; 44; 47; 50; 51; 60; 65; ], [776L; 776L; 1335L; 1335L; 776L; 776L; 1715L; 997L; 1715L; 1334L; 427L; 427L; 1334L; ]); +("ineq112", [6; 9; 14; 24; 27; ], [1722L; 8219L; 1722L; 2976L; 2976L; ]); +("ineq114", [15; 20; 33; 38; ], [2626L; 2626L; 2626L; 2626L; ]); +("ineq115", [6; 14; 16; 19; 22; 23; 25; 28; 31; 32; 34; 37; 41; 45; 50; 51; 54; 57; 60; 65; ], [6828L; 6828L; 5795L; 5795L; 4902L; 3519L; 5445L; 5445L; 3519L; 4902L; 5795L; 5795L; 1111L; 1111L; 7863L; 8421L; 8421L; 8421L; 8421L; 7863L; ]); +("ineq6", [5; ], [2991L; ]); +];; + +(***************) +(* Variables *) +(***************) +target_variables := [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [43366L; 48342L; 43366L; 48342L; 44948L; 44948L; 45860L; 45860L; 45860L; 45860L; 45860L; 35384L; 46984L; ]); +];; + +(*************************) + +variable_bounds := [ +("azim_hi", [2; 4; 6; 14; 16; 19; 22; 23; 25; 28; 31; 32; 34; 37; 50; 51; 54; 57; 60; 65; ], [10000L; 10000L; 3280L; 3280L; 6700L; 6700L; 6520L; 8940L; 5700L; 5700L; 8940L; 6520L; 6700L; 6700L; 2380L; 5460L; 5460L; 5460L; 5460L; 2380L; ]); +("azim_lo", [15; 20; 33; 38; 40; 41; 45; 46; ], [1340L; 1340L; 1340L; 1340L; 10000L; 5140L; 5140L; 10000L; ]); +("rhazim_lo", [39; 47; ], [10000L; 10000L; ]); +("rho_lo", [1; 3; ], [19136L; 19136L; ]); +("rho_hi", [0; 2; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [3600L; 3600L; 7072L; 7072L; 8272L; 8272L; 8272L; 8272L; 8272L; 8016L; 1040L; ]); +("tau_lo", [13; 14; 15; ], [58380000L; 78630000L; 58380000L; ]); +("y1_hi", [1; 5; 6; 10; 14; 21; 22; 24; 42; 43; 44; 47; 51; 53; 57; 60; 61; ], [11592L; 11592L; 400L; 4000L; 400L; 5000L; 3000L; 3200L; 5000L; 5000L; 3600L; 5000L; 2600L; 5000L; 1450L; 2600L; 5000L; ]); +("y1_lo", [2; 8; 9; 12; 17; 18; 25; 26; 27; 28; 30; 35; 37; 39; 41; 48; 50; 52; 54; 56; 58; 62; 64; 65; ], [2000L; 5000L; 4200L; 5000L; 1200L; 1200L; 4000L; 5000L; 1800L; 4000L; 2000L; 1200L; 1200L; 2000L; 3000L; 3050L; 800L; 150L; 3450L; 5000L; 5000L; 150L; 3050L; 800L; ]); +("y2_hi", [1; 5; 6; 14; 20; 21; 22; 24; 27; 30; 33; 40; 44; 46; 47; 48; 51; 52; 53; 54; 57; 60; 61; 62; 64; ], [2869L; 10258L; 400L; 400L; 4080L; 800L; 3000L; 3200L; 1280L; 3800L; 4080L; 2080L; 4280L; 2080L; 2948L; 3157L; 2600L; 11L; 960L; 3853L; 3853L; 2600L; 960L; 11L; 3157L; ]); +("y2_lo", [4; 8; 9; 10; 12; 15; 17; 18; 25; 26; 28; 35; 37; 38; 39; 41; 42; 43; 50; 56; 58; 65; ], [2958L; 3120L; 4200L; 5491L; 3120L; 2960L; 1200L; 1200L; 569L; 1920L; 569L; 1200L; 1200L; 2960L; 4052L; 3000L; 500L; 4320L; 800L; 1920L; 1920L; 800L; ]); +("y3_hi", [1; 5; 6; 14; 20; 21; 22; 24; 27; 30; 33; 40; 44; 46; 47; 48; 51; 52; 53; 54; 57; 60; 61; 62; 64; ], [10258L; 2869L; 400L; 400L; 4080L; 800L; 3000L; 3200L; 1280L; 3800L; 4080L; 2080L; 4280L; 2080L; 2948L; 3157L; 2600L; 11L; 960L; 3853L; 3853L; 2600L; 960L; 11L; 3157L; ]); +("y3_lo", [2; 8; 9; 10; 12; 15; 17; 18; 25; 26; 28; 35; 37; 38; 39; 41; 42; 43; 50; 56; 58; 65; ], [2958L; 3120L; 4200L; 5491L; 3120L; 2960L; 1200L; 1200L; 569L; 1920L; 569L; 1200L; 1200L; 2960L; 4052L; 3000L; 500L; 4320L; 800L; 1920L; 1920L; 800L; ]); +("y4_hi", [1; 5; 10; 15; 20; 22; 26; 27; 30; 33; 38; 39; 40; 42; 43; 44; 46; 47; 48; 51; 53; 56; 58; 60; 61; 64; ], [7787L; 7787L; 2650L; 3540L; 2080L; 3400L; 2330L; 2330L; 2950L; 2080L; 3540L; 5800L; 7580L; 5000L; 4930L; 810L; 7580L; 4400L; 3450L; 3080L; 710L; 2330L; 2330L; 3080L; 710L; 3450L; ]); +("y4_lo", [6; 8; 9; 11; 12; 14; 17; 18; 19; 21; 23; 24; 25; 28; 34; 35; 36; 37; 41; 42; 44; 45; 47; 50; 52; 54; 57; 62; 63; 65; ], [2500L; 1370L; 11723750L; 11720000L; 28621370L; 2500L; 4630960L; 960L; 1880000L; 450L; 6310000L; 9610000L; 10633650L; 10633650L; 1880000L; 6310960L; 4630000L; 960L; 4071400L; 19870000L; 3840000L; 4070000L; 3840000L; 4640L; 650L; 4950L; 4950L; 650L; 4040000L; 4640L; ]); +("y5_lo", [1; 2; 6; 8; 9; 10; 12; 14; 15; 17; 18; 25; 26; 27; 28; 30; 35; 37; 38; 39; 41; 42; 43; 47; 50; 56; 58; 65; ], [28613777L; 2958L; 2500L; 3120L; 3750L; 5491L; 3120L; 2500L; 2960L; 960L; 960L; 569L; 1920L; 1920L; 569L; 5800L; 960L; 960L; 2960L; 4052L; 1400L; 500L; 4320L; 5452L; 4640L; 1920L; 1920L; 4640L; ]); +("y5_hi", [5; 20; 21; 22; 33; 40; 44; 46; 48; 51; 52; 53; 54; 57; 60; 61; 62; 64; ], [3308L; 4080L; 800L; 3400L; 4080L; 2080L; 1560L; 2080L; 3157L; 3080L; 11L; 960L; 3853L; 3853L; 3080L; 960L; 11L; 3157L; ]); +("y6_hi", [1; 20; 21; 22; 33; 40; 44; 46; 48; 51; 52; 53; 54; 57; 60; 61; 62; 64; ], [3308L; 4080L; 800L; 3400L; 4080L; 2080L; 1560L; 2080L; 3157L; 3080L; 11L; 960L; 3853L; 3853L; 3080L; 960L; 11L; 3157L; ]); +("y6_lo", [4; 5; 6; 8; 9; 10; 12; 14; 15; 17; 18; 25; 26; 27; 28; 30; 35; 37; 38; 39; 41; 42; 43; 47; 50; 56; 58; 65; ], [2958L; 3777L; 2500L; 3120L; 3750L; 5491L; 3120L; 2500L; 2960L; 960L; 960L; 569L; 1920L; 1920L; 569L; 5800L; 960L; 960L; 2960L; 4052L; 1400L; 500L; 4320L; 5452L; 4640L; 1920L; 1920L; 4640L; ]); +("ye_lo", [21; 23; 44; 52; 54; 59; 61; ], [10000L; 10000L; 10000L; 10000L; 10000L; 10000L; 10000L; ]); +("ye_hi", [7; 8; 12; 13; 14; 25; 26; 29; ], [10000L; 10000L; 10000L; 10000L; 10000L; 10000L; 10000L; 10000L; ]); +("yn_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 12; ], [1210L; 6194L; 11210L; 6194L; 17240L; 17240L; 550L; 550L; 10550L; 10550L; 10550L; 2710L; ]); +("yn_lo", [11; ], [5130L; ]); +];; diff --git a/formal_lp/glpk/ex2/bb2_5_out.hl b/formal_lp/glpk/ex2/bb2_5_out.hl new file mode 100644 index 0000000..2f15e30 --- /dev/null +++ b/formal_lp/glpk/ex2/bb2_5_out.hl @@ -0,0 +1,76 @@ +hypermap_string := "21943083135 21 4 0 1 2 3 3 0 3 4 3 4 3 5 3 5 3 2 3 5 2 6 3 6 2 7 3 7 2 1 3 7 1 8 3 8 1 9 3 9 1 0 3 9 0 10 3 10 0 4 3 10 4 11 3 11 4 5 3 11 5 6 3 11 6 12 3 12 6 7 3 12 7 8 3 12 8 9 3 12 9 10 3 10 11 12 ";; +precision := 4;; +(***************) +(* Constraints *) +(***************) +constraints := [ +("azim_sum", [1; 3; 4; 5; 6; 7; 9; 10; 11; 12; ], [2879L; 1902L; 1916L; 1916L; 6317L; 1761L; 1761L; 6317L; 6317L; 7559L; ]); +("azim_sum_neg", [8; ], [1191L; ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [7411L; 7411L; 7411L; 8388L; 7411L; 7411L; 5777L; 5777L; 5777L; 5777L; 5777L; 5873L; 5777L; ]); +("sol_sum3_neg", [4; 5; 6; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; ], [4513L; 3607L; 1761L; 1761L; 3607L; 4513L; 3550L; 1916L; 3550L; 6317L; 3943L; 1761L; 1761L; 3943L; 6317L; ]); +("tau_sum3_neg", [1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; ], [7411L; 7411L; 7411L; 5777L; 5777L; 5650L; 5777L; 5777L; 5650L; 5777L; 5777L; 5777L; 5873L; 5777L; 5777L; 5777L; 5777L; 5777L; 5777L; 5777L; ]); +("tau_sum4_neg", [0; ], [7411L; ]); +("ln_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [1829L; 856L; 1829L; 751L; 1829L; 1829L; 3630L; 3630L; 3630L; 3630L; 3630L; 3525L; 3630L; ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [46565L; 46565L; 46565L; 52705L; 46565L; 46565L; 36298L; 36298L; 36298L; 36298L; 36298L; 36898L; 36298L; ]); +("edge_sym_neg", [4; 8; 9; 11; 14; 15; 20; 21; 23; 29; 30; 36; 38; 42; 46; 47; 48; 50; 51; 53; 56; 59; 61; ], [1664L; 346L; 77L; 1664L; 720L; 917L; 1664L; 919L; 183L; 473L; 340L; 917L; 372L; 284L; 1677L; 1778L; 1677L; 240L; 2731L; 2288L; 2288L; 240L; 37L; ]); +("edge_sym", [5; 6; 12; 17; 26; 32; 57; 60; ], [346L; 346L; 346L; 340L; 919L; 720L; 2731L; 1778L; ]); +("y1_def", [13; 17; 18; 20; 24; 25; 30; 31; 33; 35; 36; 39; 44; 48; 49; 51; 54; 56; 59; 62; ], [1821L; 1371L; 923L; 539L; 458L; 596L; 338L; 923L; 1371L; 1715L; 107L; 933L; 1349L; 1718L; 1498L; 1091L; 2145L; 2145L; 2589L; 2343L; ]); +("y1_def_neg", [0; 2; 6; 7; 8; 9; 10; 19; 21; 23; 26; 27; 28; 37; 40; 41; 42; 43; 45; 46; 50; 52; 55; 60; 63; ], [1555L; 1555L; 956L; 60L; 379L; 60L; 956L; 76L; 348L; 155L; 155L; 138L; 424L; 92L; 428L; 306L; 923L; 416L; 92L; 57L; 558L; 513L; 513L; 558L; 683L; ]); +("y2_def", [0; 2; 6; 7; 9; 10; 13; 17; 19; 20; 23; 26; 30; 33; 35; 37; 39; 40; 41; 42; 43; 44; 45; 46; 48; 49; 50; 52; 54; 55; 56; 59; 60; 62; ], [1664L; 1664L; 191L; 93L; 93L; 191L; 1683L; 1371L; 46L; 870L; 94L; 94L; 870L; 1371L; 1715L; 142L; 1940L; 663L; 1177L; 560L; 591L; 1349L; 142L; 35L; 1718L; 1498L; 864L; 794L; 220L; 794L; 220L; 1167L; 864L; 2435L; ]); +("y2_def_neg", [8; 18; 21; 24; 25; 27; 28; 31; 36; 51; 63; ], [379L; 281L; 348L; 319L; 181L; 138L; 302L; 281L; 32L; 332L; 683L; ]); +("y3_def", [0; 2; 6; 7; 9; 10; 13; 17; 19; 20; 23; 26; 30; 33; 35; 37; 39; 40; 41; 42; 43; 44; 45; 46; 48; 49; 50; 52; 54; 55; 56; 59; 60; 62; ], [1664L; 1664L; 191L; 93L; 93L; 191L; 1683L; 1371L; 46L; 870L; 94L; 94L; 870L; 1371L; 1715L; 142L; 1940L; 663L; 1177L; 560L; 591L; 1349L; 142L; 35L; 1718L; 1498L; 864L; 794L; 220L; 794L; 220L; 1167L; 864L; 2435L; ]); +("y3_def_neg", [8; 18; 21; 24; 25; 27; 28; 31; 36; 51; 63; ], [379L; 281L; 348L; 319L; 181L; 138L; 302L; 281L; 32L; 332L; 683L; ]); +("y4_def_neg", [6; 7; 8; 9; 10; 13; 17; 19; 20; 21; 23; 26; 27; 28; 30; 33; 35; 37; 39; 40; 41; 42; 43; 44; 45; 46; 48; 49; 50; 52; 55; 60; 62; 63; ], [1664L; 175L; 263L; 175L; 1664L; 720L; 707L; 87L; 723L; 242L; 177L; 177L; 96L; 329L; 723L; 707L; 885L; 267L; 1808L; 1247L; 1506L; 1054L; 1112L; 696L; 267L; 65L; 1712L; 773L; 1626L; 1494L; 1494L; 1626L; 1304L; 474L; ]); +("y4_def", [18; 24; 25; 31; 36; 51; 54; 56; 59; ], [1427L; 825L; 921L; 1427L; 165L; 1686L; 1937L; 1937L; 914L; ]); +("y5_def_neg", [1; 8; 13; 17; 18; 20; 21; 24; 25; 27; 28; 30; 31; 33; 35; 36; 39; 44; 48; 49; 51; 54; 56; 59; 62; 63; ], [1191L; 263L; 917L; 707L; 281L; 144L; 242L; 277L; 181L; 96L; 196L; 144L; 281L; 707L; 885L; 32L; 105L; 696L; 1712L; 773L; 332L; 794L; 794L; 1104L; 1203L; 474L; ]); +("y5_def", [0; 2; 6; 7; 9; 10; 19; 23; 26; 37; 40; 41; 42; 43; 45; 46; 50; 52; 55; 60; ], [1664L; 1664L; 346L; 93L; 93L; 346L; 46L; 94L; 94L; 142L; 663L; 108L; 560L; 591L; 142L; 35L; 864L; 794L; 794L; 864L; ]); +("y6_def_neg", [8; 13; 17; 18; 20; 21; 28; 30; 35; 36; 39; 48; 49; 51; 54; 56; 59; 63; ], [263L; 346L; 707L; 281L; 144L; 242L; 196L; 144L; 313L; 32L; 105L; 1712L; 773L; 332L; 794L; 794L; 1104L; 474L; ]); +("y6_def", [0; 2; 6; 7; 9; 10; 19; 23; 24; 25; 26; 27; 31; 33; 37; 40; 41; 42; 43; 44; 45; 46; 50; 52; 55; 60; 61; 62; ], [1664L; 1664L; 346L; 93L; 93L; 346L; 46L; 94L; 2465L; 185L; 94L; 2646L; 1047L; 521L; 2725L; 1318L; 765L; 560L; 1246L; 1887L; 1783L; 35L; 864L; 794L; 794L; 864L; 1641L; 2152L; ]); +("y8_def_neg", [2; ], [1191L; ]); +("RHA", [0; 4; 13; 14; 17; 20; 21; 23; 26; 29; 30; 32; 35; 36; 38; 44; ], [977L; 977L; 1634L; 1634L; 1634L; 1761L; 1761L; 1376L; 1376L; 1761L; 2186L; 2611L; 2611L; 1634L; 1634L; 1634L; ]); +("yy10", [20; ], [1191L; ]); +("ineq104", [0; 2; ], [2879L; 2879L; ]); +("ineq107", [15; 19; 22; 24; 26; 35; 37; 38; 39; 42; 58; ], [127L; 258L; 258L; 127L; 552L; 96L; 1538L; 1538L; 96L; 96L; 96L; ]); +("ineq108", [9; 14; 20; 21; 27; 32; 47; 50; 52; 55; ], [213L; 1846L; 1191L; 1191L; 1846L; 213L; 2182L; 2952L; 2952L; 2182L; ]); +("ineq109", [2; 3; 5; 6; 16; 33; 35; 36; 39; 41; 46; 48; 51; 56; ], [1916L; 256L; 256L; 1916L; 552L; 390L; 1528L; 1821L; 1528L; 390L; 2374L; 2182L; 2182L; 2374L; ]); +("ineq111", [9; 13; 16; 26; 29; 31; 35; 37; 40; 44; 45; 50; 52; 55; 58; ], [4513L; 3607L; 1761L; 1761L; 3607L; 4513L; 3550L; 1916L; 3550L; 6317L; 3943L; 1761L; 1761L; 3943L; 6317L; ]); +("ineq112", [2; 4; 6; 17; 20; 23; 24; 37; 44; 59; ], [2812L; 2108L; 2812L; 1934L; 766L; 766L; 1934L; 614L; 3793L; 3793L; ]); +("ineq114", [9; 32; ], [2895L; 2895L; ]); +("ineq115", [0; 3; 5; 8; 11; 12; 13; 16; 18; 19; 22; 23; 26; 28; 29; 30; 33; 35; 36; 39; 41; 44; 45; 48; 51; 54; 59; ], [4599L; 2652L; 2652L; 4599L; 2882L; 4329L; 1448L; 3716L; 2813L; 2198L; 2198L; 2813L; 3716L; 1448L; 4329L; 2882L; 3797L; 1980L; 4121L; 1980L; 3797L; 1984L; 5777L; 5777L; 5777L; 5777L; 1984L; ]); +("ineq118", [3; ], [7411L; ]); +];; + +(***************) +(* Variables *) +(***************) +target_variables := [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [34990L; 9764990L; 34990L; 45430L; 34990L; 34990L; 33308L; 33308L; 33308L; 33308L; 33308L; 30908L; 33308L; ]); +];; + +(*************************) + +variable_bounds := [ +("azim_hi", [7; 9; 13; 15; 17; 32; 34; 36; 39; 43; 49; 52; 55; 58; ], [1520L; 1520L; 1950L; 1320L; 4480L; 4480L; 1320L; 1950L; 4800L; 4800L; 4020L; 4020L; 4020L; 4020L; ]); +("azim_lo", [4; 12; 16; 20; 22; 23; 26; 27; 30; 33; 37; 40; 45; 48; 63; ], [260L; 260L; 460L; 7840L; 620L; 520L; 520L; 620L; 7840L; 460L; 780L; 2540L; 780L; 160L; 160L; ]); +("rho_lo", [0; 1; 2; 3; 4; 5; ], [2048L; 2048L; 2048L; 15184L; 2048L; 2048L; ]); +("rho_hi", [6; 7; 8; 9; 10; 11; 12; ], [464L; 464L; 464L; 464L; 464L; 32336L; 464L; ]); +("tau_lo", [13; ], [11380000L; ]); +("tau_hi", [2; ], [10000L; ]); +("y1_hi", [0; 2; 13; 20; 23; 26; 27; 37; 40; 41; 42; 45; 49; 50; 52; 54; 55; 56; 59; 60; 63; ], [3400L; 3400L; 4400L; 4600L; 2000L; 2000L; 1200L; 3500L; 650L; 7600L; 2000L; 3500L; 3400L; 1100L; 2300L; 1800L; 2300L; 1800L; 3400L; 1100L; 2600L; ]); +("y1_lo", [6; 7; 8; 9; 10; 17; 19; 21; 24; 25; 28; 30; 33; 35; 36; 39; 43; 46; 48; 62; ], [4200L; 1600L; 4400L; 1600L; 4200L; 3400L; 2000L; 1200L; 3800L; 5000L; 3200L; 200L; 3400L; 600L; 5000L; 6800L; 6800L; 6000L; 2800L; 1400L; ]); +("y2_hi", [0; 2; 6; 7; 9; 10; 18; 19; 20; 24; 27; 28; 30; 31; 41; 49; 51; 52; 54; 55; 56; 62; 63; ], [620L; 620L; 724L; 1584L; 1584L; 724L; 4080L; 2153L; 528L; 880L; 1200L; 953L; 528L; 4080L; 2382L; 3400L; 3360L; 298L; 4760L; 298L; 4760L; 3944L; 2600L; ]); +("y2_lo", [8; 13; 17; 21; 23; 25; 26; 33; 35; 36; 37; 39; 40; 42; 43; 45; 46; 48; 50; 59; 60; ], [4400L; 4360L; 3400L; 1200L; 1138L; 320L; 1138L; 3400L; 600L; 3760L; 790L; 264L; 3381L; 3218L; 264L; 790L; 656L; 2800L; 1014L; 3240L; 1014L; ]); +("y3_hi", [0; 2; 6; 7; 9; 10; 18; 19; 20; 24; 27; 28; 30; 31; 41; 49; 51; 52; 54; 55; 56; 62; 63; ], [620L; 620L; 724L; 1584L; 1584L; 724L; 4080L; 2153L; 528L; 880L; 1200L; 953L; 528L; 4080L; 2382L; 3400L; 3360L; 298L; 4760L; 298L; 4760L; 3944L; 2600L; ]); +("y3_lo", [8; 13; 17; 21; 23; 25; 26; 33; 35; 36; 37; 39; 40; 42; 43; 45; 46; 48; 50; 59; 60; ], [4400L; 4360L; 3400L; 1200L; 1138L; 320L; 1138L; 3400L; 600L; 3760L; 790L; 264L; 3381L; 3218L; 264L; 790L; 656L; 2800L; 1014L; 3240L; 1014L; ]); +("y4_hi", [6; 10; 13; 17; 19; 21; 23; 26; 27; 28; 33; 35; 41; 42; 44; 49; 51; 62; ], [400L; 400L; 1010L; 280L; 50L; 2500L; 2700L; 2700L; 2500L; 2550L; 280L; 4520L; 1840L; 4700L; 2000L; 1720L; 6860L; 1080L; ]); +("y4_lo", [7; 8; 9; 18; 20; 24; 25; 30; 31; 36; 37; 39; 40; 43; 45; 46; 48; 50; 52; 54; 55; 56; 59; 60; 63; ], [3600L; 5000L; 3600L; 420L; 2760L; 1070L; 3570L; 2760L; 420L; 3510L; 1500L; 2400L; 3850L; 4400L; 1500L; 7600L; 2570L; 1900L; 6700L; 2600L; 6700L; 2600L; 1420L; 1900L; 1250L; ]); +("y5_hi", [0; 2; 7; 9; 13; 17; 18; 19; 21; 24; 27; 28; 31; 33; 35; 39; 44; 49; 51; 52; 54; 55; 56; ], [620L; 620L; 1584L; 1584L; 760L; 280L; 4080L; 2153L; 2500L; 2180L; 2500L; 4653L; 4080L; 280L; 4520L; 1736L; 2000L; 1720L; 3360L; 298L; 1400L; 298L; 1400L; ]); +("y5_lo", [6; 8; 10; 20; 23; 25; 26; 30; 36; 37; 40; 41; 42; 43; 45; 46; 48; 50; 59; 60; 62; 63; ], [2676L; 5000L; 2676L; 2832L; 1138L; 320L; 1138L; 2832L; 3760L; 790L; 3381L; 6078L; 3218L; 264L; 790L; 656L; 2570L; 1014L; 4920L; 1014L; 1976L; 1250L; ]); +("y6_hi", [0; 2; 7; 9; 13; 17; 18; 19; 21; 24; 27; 28; 33; 39; 40; 43; 44; 49; 51; 52; 54; 55; 56; ], [620L; 620L; 1584L; 1584L; 760L; 280L; 4080L; 2153L; 2500L; 2180L; 2500L; 4653L; 280L; 1736L; 6619L; 9736L; 2000L; 1720L; 3360L; 298L; 1400L; 298L; 1400L; ]); +("y6_lo", [6; 8; 10; 13; 20; 23; 24; 25; 26; 27; 30; 31; 33; 35; 36; 37; 40; 41; 42; 43; 44; 45; 46; 48; 50; 59; 60; 61; 62; 63; ], [2676L; 5000L; 2676L; 5710000L; 2832L; 1138L; 27420000L; 3660320L; 1138L; 27420000L; 2832L; 13275920L; 12280000L; 5715480L; 3760L; 25830790L; 6560000L; 6576078L; 3218L; 6560000L; 25830000L; 16410790L; 656L; 2570L; 1014L; 4920L; 1014L; 16410000L; 33551976L; 1250L; ]); +("y8_hi", [2; ], [11910000L; ]); +("ye_hi", [7; 8; 35; 41; 42; 45; 47; 58; 61; 62; ], [10000L; 10000L; 10000L; 10000L; 10000L; 10000L; 10000L; 10000L; 10000L; 10000L; ]); +("ye_lo", [17; 18; 43; 49; 50; ], [13280000L; 12280000L; 10000L; 10000L; 10000L; ]); +("yn_hi", [3; 4; 5; 6; 7; 8; 9; 10; 11; ], [8270L; 18330L; 8330L; 15100L; 15100L; 15100L; 15100L; 15100L; 14250L; ]); +("yn_lo", [0; 1; 2; 12; ], [1670L; 880L; 11670L; 4900L; ]); +];; diff --git a/formal_lp/glpk/feasible.hl b/formal_lp/glpk/feasible.hl new file mode 100644 index 0000000..dca41cb --- /dev/null +++ b/formal_lp/glpk/feasible.hl @@ -0,0 +1,479 @@ +let feasible_ids = [ +"161847242261"; +"21943083135"; +"125666511797"; +"79927135476"; +"241602698874"; +"92991475035"; +"223930428697"; +"247295606871"; +"234511714565"; +"222443277122"; +"74389574015"; +"77163246273"; +"62728797023"; +"29383777015"; +"17829919176"; +"111586841555"; +"105156525934"; +"108947910402"; +"146445562730"; +"251818921426"; +"152319053093"; +"92865666145"; +"180896555538"; +"145411049077"; +"39599353438"; +"53589559927"; +"90297313372"; +"142655941184"; +"85480334995"; +"120808430889"; +"65974205892"; +"151513077997"; +"212518403727"; +"67080561369"; +"10477128631"; +"249851725458"; +"100872450991"; +"44420845129"; +"232587358497"; +"167303348603"; +"245046698600"; +"214859643337"; +"36621172094"; +"51378360149"; +"57874684911"; +"62672478742"; +"238019115164"; +"94647732523"; +"233072019024"; +"197221015797"; +"178295012702"; +"213347386471"; +"86369567240"; +"181537581203"; +"88089363170"; +"199733572812"; +"154005963125"; +"46026013883"; +"229367313231"; +"68285849590"; +"201558987883"; +"234875406416"; +"95653008789"; +"235206442572"; +"69982909226"; +"14335870163"; +"100536039457"; +"34082929980"; +"82871836190"; +"148654087307"; +"50803004532"; +"11791965047"; +"161675749680"; +"159869415516"; +"32794566830"; +"215182233720"; +"249744728362"; +"114241299799"; +"218943750503"; +"138200609784"; +"57080496645"; +"167828282169"; +"84689232090"; +"10356760764"; +"199640295300"; +"247130363001"; +"220796296707"; +"32345090522"; +"213523389128"; +"119559217589"; +"203083441532"; +"151900278591"; +"153414258587"; +"206180970700"; +"155697230122"; +"163902294554"; +"155838748228"; +"45659588418"; +"223336279535"; +"189718207466"; +"39102870782"; +"73142613316"; +"2457515115"; +"143863701704"; +"129674608883"; +"34469525277"; +"205120383991"; +"99094226829"; +"208444469082"; +"107159450824"; +"21241242399"; +"93267179362"; +"189365423706"; +"34552395227"; +"177867469382"; +"247802476816"; +"87864610237"; +"31118340219"; +"15293900842"; +"43458636485"; +"125634241970"; +"165331052876"; +"66514811350"; +"51222125776"; +"29635262505"; +"128654189196"; +"215237018681"; +"10327436083"; +"204869251998"; +"159707215674"; +"242652038506"; +"33133237057"; +"113586916220"; +"89689083992"; +"229186714352"; +"150834109178"; +"176438347451"; +"113535394513"; +"65887846355"; +"125288625342"; +"182459094914"; +"221642761094"; +"85185357759"; +"61113718086"; +"43203292310"; +"187762845014"; +"164769867395"; +"152735971380"; +"12055501106"; +"86506100695"; +"240612114340"; +"67870640924"; +"213340346296"; +"20942233668"; +"208474118447"; +"131926538004"; +"212497062222"; +"16606835581"; +"44311028148"; +"205031032033"; +"162594631030"; +"63780392795"; +"85838002161"; +"20525292626"; +"225385567504"; +"157797184794"; +"211931583471"; +"150534658862"; +"157114107233"; +"30389300048"; +"248989633715"; +"227049081516"; +"103049949196"; +"17584252653"; +"201829675557"; +"64553506434"; +"143898391447"; +"2757485004"; +"24522692989"; +"206983657748"; +"91185198256"; +"107096839627"; +"108156489459"; +"81829394513"; +"26407840449"; +"59408556784"; +"179189825656"; +"11799365755"; +"75583744203"; +"48166165766"; +"102273823769"; +"74135224952"; +"169975399370"; +"162326456513"; +"245621749109"; +"16986736888"; +"171328238335"; +"158495418174"; +"47656451975"; +"118374966151"; +"194475628294"; +"141508359990"; +"59534542075"; +"126416502686"; +"99420618891"; +"43294392725"; +"5877308286"; +"77253061528"; +"135058926737"; +"105582821738"; +"109941103541"; +"71594162946"; +"58211170094"; +"71524073242"; +"76214963351"; +"185374424990"; +"175918863322"; +"100414090850"; +"142637803518"; +"163349701747"; +"113712638052"; +"23873735141"; +"32035687009"; +"15608692641"; +"164470574315"; +"62586200165"; +"120890775388"; +"98304487583"; +"93707188364"; +"170730591020"; +"189690818984"; +"133668458800"; +"235921453124"; +"131728773107"; +"82072133889"; +"43345982389"; +"53434030211"; +"36949233439"; +"229539714292"; +"158968829505"; +"182115367206"; +"145414627149"; +"74262159663"; +"121444100512"; +"158802651414"; +"30633095151"; +"232135951716"; +"28186909322"; +"240922261950"; +"220280950581"; +"25843054493"; +"222331490807"; +"133663871154"; +"111261201750"; +"205814967193"; +"40124106623"; +"47926490793"; +"217305234403"; +"247152672618"; +"217482711620"; +"77454901584"; +"29390367462"; +"46122798260"; +"87297599446"; +"193481247960"; +"204182643999"; +"149861801684"; +"243834939443"; +"9290908173"; +"186286977681"; +"77177675465"; +"45199786119"; +"183222769731"; +"175709173491"; +"131061498271"; +"181446331627"; +"194852290699"; +"215863975889"; +"187425312349"; +"111714420987"; +"43229898957"; +"151854702353"; +"12455295246"; +"70856127867"; +"155151082767"; +"78273763440"; +"38251440127"; +"184451503950"; +"11078540113"; +"204675168024"; +"95136066519"; +"153662214806"; +"26494148998"; +"204094963109"; +"225248006752"; +"142282162558"; +"44952706223"; +"149036738197"; +"197948745319"; +"68126966034"; +"153129252928"; +"42914567770"; +"233312933979"; +"117491489162"; +"228609753490"; +"224222535931"; +"43362603887"; +"116921636014"; +"50329387098"; +"169780381606"; +"14777252572"; +"157383450592"; +"129049243019"; +"226586736615"; +"213323591175"; +"167319765423"; +"200518010919"; +"220582972141"; +"184497806055"; +"96213649901"; +"63037087515"; +"33029157920"; +"3334037814"; +"66478346114"; +"99747768328"; +"150404678030"; +"71361914409"; +"225201709398"; +"248886505843"; +"27794260922"; +"245967563371"; +"19940774062"; +"47321147294"; +"154341430216"; +"23052108091"; +"218756368829"; +"46519712146"; +"205697921664"; +"93406012484"; +"226556732647"; +"224599395263"; +"62238031819"; +"195512614336"; +"191026754154"; +"230775057853"; +"57290919651"; +"87168897512"; +"128782498396"; +"250379175175"; +"41053160057"; +"239569210813"; +"46867563516"; +"13396135145"; +"22579094342"; +"24966962583"; +"138654057097"; +"163183959839"; +"174247163045"; +"26415177157"; +"145974217847"; +"179848114045"; +"103206272348"; +"227441642446"; +"230073298386"; +"238539288825"; +"211486284142"; +"212351474126"; +"113860448491"; +"126700205719"; +"195966920830"; +"52701588192"; +"28006928060"; +"147297845306"; +"34970074286"; +"105615380550"; +"83055791901"; +"216661698775"; +"100126458338"; +"180552190171"; +"118191535532"; +"186270808093"; +"95386456814"; +"250904883332"; +"128394227052"; +"19111335170"; +"139176081955"; +"18909647056"; +"96407516938"; +"144158557955"; +"155449324866"; +"224680018300"; +"60661713932"; +"182169930819"; +"121582585038"; +"182613472538"; +"190313802481"; +"194949625104"; +"135129025736"; +"127770925589"; +"75641658977"; +"199200608215"; +"207249637395"; +"170782427215"; +"34372176123"; +"136128967410"; +"116080884798"; +"210113251810"; +"98261023404"; +"104351773923"; +"15806819252"; +"202154465934"; +"169371400957"; +"109537739131"; +"70023342545"; +"93657835054"; +"120074519419"; +"8332565827"; +"251696495407"; +"240902736110"; +"224962478003"; +"24362730064"; +"135218534957"; +"144731567951"; +"209433473083"; +"34010128493"; +"120279245231"; +"142041399641"; +"103699420180"; +"245450642887"; +"50386106164"; +"33461137352"; +"103572230249"; +"207710175290"; +"131863321179"; +"227748973039"; +"135113768992"; +"153393823657"; +"96944212495"; +"118841024802"; +"150397346479"; +"211566906925"; +"80894294056"; +"99616756837"; +"119368198530"; +"201843411127"; +"9883991306"; +"67978455430"; +"26351628975"; +"177139074557"; +"119822794938"; +"225780368738"; +"108021470283"; +"167623491354"; +"231915053919"; +"164118962304"; +"161169406084"; +"211202410018"; +"10294641528"; +"103773894310"; +"223795397921"; +"21830948200"; +"115126142634"; +"159155890289"; +"169726202209"; +"149438122187"; +"238138683456"; +"75330736899"; +"124346922881"; +"12052651595"; +"218088675456"; +"195199855441"; +"131235168653"; +"125251448736"; +"178064838768"; +"62059307362"; +"206134563629"; +"149435261210"; +];; \ No newline at end of file diff --git a/formal_lp/glpk/lp_binary_certificate.hl b/formal_lp/glpk/lp_binary_certificate.hl new file mode 100644 index 0000000..5b46ee5 --- /dev/null +++ b/formal_lp/glpk/lp_binary_certificate.hl @@ -0,0 +1,65 @@ +needs "../formal_lp/hypermap/main/lp_certificate.hl";; + +module Lp_binary_certificate = struct + +open Lp_certificate;; + +let read_string in_channel = + let n = input_byte in_channel in + let str = String.create n in + let _ = really_input in_channel str 0 n in + str;; + +let read_int16 in_channel = + let b1 = input_byte in_channel in + let b2 = input_byte in_channel in + (b2 lsl 8) lor b1;; + +let read_int32 in_channel = + let w1 = read_int16 in_channel in + let w2 = read_int16 in_channel in + (w2 lsl 16) lor w1;; + + +let read_int64 in_channel = + let w1 = Int64.of_int (read_int16 in_channel) in + let w2 = Int64.shift_left (Int64.of_int (read_int16 in_channel)) 16 in + let w3 = Int64.shift_left (Int64.of_int (read_int16 in_channel)) 32 in + let w4 = Int64.shift_left (Int64.of_int (read_int16 in_channel)) 48 in + Int64.logor w1 (Int64.logor w2 (Int64.logor w3 w4));; + + +let read_constraint in_channel = + let name = read_string in_channel in + let n_els = read_int32 in_channel in + let indices = map (fun _ -> read_int16 in_channel) (1--n_els) in + let coefficients = map (fun _ -> read_int64 in_channel) (1--n_els) in + name, indices, coefficients;; + + +let read_constraint_list in_channel = + let count = read_int32 in_channel in + map (fun _ -> read_constraint in_channel) (1--count);; + + +let read_binary_terminal fname = + let in_channel = open_in_bin fname in + try + let precision = input_byte in_channel in + let infeasible = if (input_byte in_channel <> 0) then true else false in + let constraints = read_constraint_list in_channel in + let target_vars = read_constraint_list in_channel in + let vars = read_constraint_list in_channel in + let _ = close_in in_channel in + { + precision = precision; + infeasible = infeasible; + constraints = constraints; + target_variables = target_vars; + variable_bounds = vars; + } + with _ -> + let _ = close_in in_channel in + failwith "read_binary_terminal: failed";; + +end;; diff --git a/formal_lp/glpk/onepass.hl b/formal_lp/glpk/onepass.hl new file mode 100644 index 0000000..b3aa45d --- /dev/null +++ b/formal_lp/glpk/onepass.hl @@ -0,0 +1,278 @@ +let onepass_ids = [ +"21943083135"; +"125666511797"; +"223930428697"; +"247295606871"; +"234511714565"; +"222443277122"; +"77163246273"; +"29383777015"; +"17829919176"; +"105156525934"; +"108947910402"; +"152319053093"; +"145411049077"; +"90297313372"; +"142655941184"; +"151513077997"; +"212518403727"; +"67080561369"; +"10477128631"; +"249851725458"; +"44420845129"; +"232587358497"; +"214859643337"; +"36621172094"; +"51378360149"; +"62672478742"; +"238019115164"; +"178295012702"; +"86369567240"; +"46026013883"; +"68285849590"; +"234875406416"; +"235206442572"; +"14335870163"; +"100536039457"; +"11791965047"; +"161675749680"; +"32794566830"; +"114241299799"; +"218943750503"; +"138200609784"; +"167828282169"; +"84689232090"; +"220796296707"; +"213523389128"; +"119559217589"; +"151900278591"; +"153414258587"; +"206180970700"; +"155838748228"; +"45659588418"; +"143863701704"; +"129674608883"; +"21241242399"; +"93267179362"; +"177867469382"; +"31118340219"; +"15293900842"; +"125634241970"; +"165331052876"; +"51222125776"; +"215237018681"; +"204869251998"; +"33133237057"; +"113586916220"; +"182459094914"; +"221642761094"; +"61113718086"; +"187762845014"; +"164769867395"; +"12055501106"; +"240612114340"; +"67870640924"; +"20942233668"; +"208474118447"; +"131926538004"; +"44311028148"; +"205031032033"; +"162594631030"; +"63780392795"; +"157797184794"; +"150534658862"; +"248989633715"; +"17584252653"; +"64553506434"; +"143898391447"; +"2757485004"; +"24522692989"; +"206983657748"; +"75583744203"; +"169975399370"; +"162326456513"; +"16986736888"; +"158495418174"; +"118374966151"; +"194475628294"; +"141508359990"; +"99420618891"; +"43294392725"; +"77253061528"; +"135058926737"; +"105582821738"; +"109941103541"; +"71594162946"; +"58211170094"; +"185374424990"; +"175918863322"; +"100414090850"; +"142637803518"; +"23873735141"; +"32035687009"; +"15608692641"; +"62586200165"; +"120890775388"; +"98304487583"; +"93707188364"; +"189690818984"; +"133668458800"; +"235921453124"; +"131728773107"; +"82072133889"; +"43345982389"; +"53434030211"; +"36949233439"; +"229539714292"; +"182115367206"; +"145414627149"; +"74262159663"; +"158802651414"; +"30633095151"; +"232135951716"; +"28186909322"; +"220280950581"; +"222331490807"; +"133663871154"; +"111261201750"; +"205814967193"; +"40124106623"; +"217305234403"; +"247152672618"; +"77454901584"; +"29390367462"; +"46122798260"; +"193481247960"; +"204182643999"; +"149861801684"; +"186286977681"; +"77177675465"; +"45199786119"; +"183222769731"; +"181446331627"; +"194852290699"; +"187425312349"; +"111714420987"; +"43229898957"; +"151854702353"; +"12455295246"; +"70856127867"; +"155151082767"; +"78273763440"; +"38251440127"; +"184451503950"; +"204094963109"; +"225248006752"; +"142282162558"; +"197948745319"; +"68126966034"; +"153129252928"; +"42914567770"; +"233312933979"; +"117491489162"; +"228609753490"; +"224222535931"; +"116921636014"; +"226586736615"; +"213323591175"; +"167319765423"; +"200518010919"; +"220582972141"; +"184497806055"; +"96213649901"; +"63037087515"; +"33029157920"; +"3334037814"; +"66478346114"; +"225201709398"; +"248886505843"; +"27794260922"; +"245967563371"; +"19940774062"; +"47321147294"; +"154341430216"; +"23052108091"; +"46519712146"; +"205697921664"; +"62238031819"; +"230775057853"; +"57290919651"; +"87168897512"; +"128782498396"; +"46867563516"; +"22579094342"; +"24966962583"; +"138654057097"; +"163183959839"; +"174247163045"; +"145974217847"; +"179848114045"; +"227441642446"; +"230073298386"; +"211486284142"; +"212351474126"; +"126700205719"; +"195966920830"; +"52701588192"; +"147297845306"; +"105615380550"; +"118191535532"; +"186270808093"; +"250904883332"; +"139176081955"; +"96407516938"; +"144158557955"; +"224680018300"; +"182169930819"; +"121582585038"; +"194949625104"; +"199200608215"; +"207249637395"; +"170782427215"; +"34372176123"; +"136128967410"; +"116080884798"; +"210113251810"; +"104351773923"; +"15806819252"; +"202154465934"; +"169371400957"; +"70023342545"; +"120074519419"; +"8332565827"; +"251696495407"; +"224962478003"; +"135218534957"; +"144731567951"; +"209433473083"; +"142041399641"; +"103699420180"; +"245450642887"; +"33461137352"; +"103572230249"; +"131863321179"; +"227748973039"; +"135113768992"; +"153393823657"; +"96944212495"; +"118841024802"; +"150397346479"; +"211566906925"; +"80894294056"; +"99616756837"; +"201843411127"; +"26351628975"; +"177139074557"; +"119822794938"; +"225780368738"; +"108021470283"; +"231915053919"; +"164118962304"; +"161169406084"; +"211202410018"; +"103773894310"; +"21830948200"; +"115126142634"; +"159155890289"; +"169726202209"; +];; \ No newline at end of file diff --git a/formal_lp/glpk/test_hard.hl b/formal_lp/glpk/test_hard.hl new file mode 100644 index 0000000..df2d1f3 --- /dev/null +++ b/formal_lp/glpk/test_hard.hl @@ -0,0 +1,76 @@ +needs "../formal_lp/glpk/build_certificates.hl";; + +open List;; +open Glpk_link;; +open Lpproc;; +open Lp_certificate;; +open Lp_informal_computations;; +open Build_certificates;; +open Hard_lp;; + +let hard_bbs = hard_bb();; + +test_mode := false;; + +test_mode := true;; +print_progress := true;; + +let bb = nth hard_bbs 8;; +map length (faces bb);; +let cert = build_certificate true bb;; +certificate_info cert;; +build_test_split cert.root_case;; + +write_lp_certificates (sprintf "%s/hard8.dat" !output_dir) [cert];; +certificate_info cert;; +build_test_split cert.root_case;; + + + +let rec correct bb cert = + match cert with + | Lp_terminal _ -> cert + | Lp_split (info, cs) -> + (match info.split_type with + | "add_big" -> + let opp xs = nub (xs @ map (C opposite_edge bb) xs) in + let long_edge = opp bb.d_edge_225_252 in + let long_edge_faces = zip (map (C face_of_dart bb) long_edge) long_edge in + let dart = assoc info.split_face long_edge_faces in + let cases = map (correct bb) cs in + Lp_split ({info with split_face = dart}, cases) + | "edge" -> + let bb1 = modify_bb bb false ["e_225_252", info.split_face] [] in + let cases = map2 correct [bb1; bb] cs in + Lp_split (info, cases) + | _ -> + let cases = map (correct bb) cs in + Lp_split (info, cases));; + + + +let rec get_infos name = function + | Lp_terminal _ -> [] + | Lp_split (info, cs) -> + let list = flatten (map (get_infos name) cs) in + if info.split_type = name then info :: list else list;; + + +let c = hd (read_lp_certificates (sprintf "%s/hard1.dat" !output_dir));; +certificate_info c;; +build_test_split c.root_case;; +let add_big1 = get_infos "add_big" c.root_case;; + +let bb = nth hard_bbs 0;; +let c2_root = correct bb c.root_case;; +let c2 = {c with root_case = c2_root};; + +certificate_info c;; +certificate_info c2;; + +build_test_split c2.root_case;; +let add_big2 = get_infos "add_big" c2.root_case;; + +write_lp_certificates (sprintf "%s/hard0.dat" !output_dir) [c2];; + +let c = diff --git a/formal_lp/hypermap/arith_link.hl b/formal_lp/hypermap/arith_link.hl new file mode 100644 index 0000000..a161125 --- /dev/null +++ b/formal_lp/hypermap/arith_link.hl @@ -0,0 +1,12 @@ +let add_to_load_path path = + if mem path !load_path then () + else load_path := path :: !load_path;; + +let formal_ineqs_dir = flyspeck_dir ^ "/../formal_ineqs";; +add_to_load_path formal_ineqs_dir;; + +needs "arith_options.hl";; +Arith_options.base := 100;; +Arith_options.cached := false;; + +needs "arith/nat.hl";; diff --git a/formal_lp/hypermap/computations/informal_computations.hl b/formal_lp/hypermap/computations/informal_computations.hl new file mode 100644 index 0000000..d44e7bc --- /dev/null +++ b/formal_lp/hypermap/computations/informal_computations.hl @@ -0,0 +1,45 @@ +module Lp_informal_computations = struct + +let take n = fst o chop_list n;; +let drop n = snd o chop_list n;; + +let rec rotateL i xs = + if i=0 then xs + else match xs with + | x::xss -> rotateL ((i-1) mod length xs) (xss @ [x]) + | [] -> [];; + +let rotateR i = rotateL (-i);; + +let list_pairs list = + let h = hd list in + let rec pairs list = + match list with + | [] -> [] + | [h1] -> [h1, h] + | h1 :: h2 :: t -> (h1,h2) :: pairs (h2 :: t) in + pairs list;; + + +let split_list list dart = + let split_face f = + if length f <= 3 then + [f] + else + let t3, _ = chop_list 3 f in + let _, d2 = chop_list 2 f in + [t3; hd t3 :: d2] in + + let rec split list = + match list with + | [] -> [] + | f :: t -> + let pairs = list_pairs f in + if mem dart pairs then + let i = index dart pairs in + split_face (rotateR 1 (rotateL i f)) @ t + else + f :: split t in + split list;; + +end;; diff --git a/formal_lp/hypermap/computations/list_conversions2.hl b/formal_lp/hypermap/computations/list_conversions2.hl new file mode 100644 index 0000000..37af413 --- /dev/null +++ b/formal_lp/hypermap/computations/list_conversions2.hl @@ -0,0 +1,1065 @@ +(* =========================================================== *) +(* Efficient formal list conversions *) +(* Author: Alexey Solovyev *) +(* Date: 2012-10-27 *) +(* =========================================================== *) + +needs "../formal_lp/hypermap/arith_link.hl";; +needs "misc/vars.hl";; +needs "Examples/seq-compiled.hl";; + +module type List_conversions_sig = + sig + (* pair *) + val eval_pair_eq_univ : (term -> thm) * (term -> thm) -> term -> term -> thm + val pair_eq_conv_univ : (term -> thm) * (term -> thm) -> term -> thm + val eval_pair_eq_num : term -> term -> thm + val pair_eq_conv_num : term -> thm + (* HD *) + val eval_hd : term -> thm + val hd_conv : term -> thm + (* EL *) + val eval_el : term -> term -> thm + val el_conv : term -> thm + (* FST, SND *) + val fst_conv : term -> thm + val snd_conv : term -> thm + (* LENGTH *) + val eval_length : term -> thm + val length_conv : term -> thm + (* ZIP *) + val eval_zip : term -> term -> thm + (* ALL *) + val all_conv_univ : (term -> thm) -> term -> thm + (* ALL2 *) + val all2_conv_univ : (term -> thm) -> term -> thm + (* MEM *) + val eval_mem_univ : (term -> thm) -> term -> term -> thm + val mem_conv_univ : (term -> thm) -> term -> thm + (* FILTER *) + val filter_conv_univ : (term -> thm) -> term -> thm + (* MAP *) + val map_conv_univ : (term -> thm) -> term -> thm + (* ALL theorems *) + val get_all : thm -> thm list + val select_all : thm -> int list -> thm list + (* set_of_list *) + val eval_set_of_list : term -> thm + val set_of_list_conv : term -> thm + (* flatten *) + val eval_flatten : term -> thm + val flatten_conv : term -> thm + (* uniq *) + val eval_uniq_univ : (term -> thm) -> term -> thm + val uniq_conv_univ : (term -> thm) -> term -> thm + (* undup *) + val eval_undup_univ : (term -> thm) -> term -> thm + val undup_conv_univ : (term -> thm) -> term -> thm + (* cat *) + val eval_cat : term -> term -> thm + val cat_conv : term -> thm + (* BUTLAST, LAST *) + val eval_butlast_last : term -> thm * thm + (* take, drop *) + val eval_take : term -> term -> thm + val eval_drop : term -> term -> thm + val eval_take_drop : term -> term -> thm * thm + (* rot *) + val eval_rot : term -> term -> thm + val eval_rot1 : term -> thm + val eval_rotr1 : term -> thm + (* index *) + val eval_index_univ : (term -> thm) -> term -> term -> thm + val index_conv_univ : (term -> thm) -> term -> thm + end;; + + +module List_conversions : List_conversions_sig = struct + +open Arith_nat;; +open Arith_misc;; +open Misc_vars;; +open Seq;; + + +let MY_RULE = UNDISCH_ALL o PURE_REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL;; +let MY_RULE_NUM = UNDISCH_ALL o NUMERALS_TO_NUM o PURE_REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL;; +let TO_NUM = REWRITE_RULE[Arith_hash.NUM_THM] o DEPTH_CONV NUMERAL_TO_NUM_CONV;; +let to_num = rand o concl o TO_NUM;; + + + +(***********************************************) +(* pair_eq_conv *) + +let PAIR_EQ_TT = (MY_RULE o prove)(`(n = x <=> T) /\ (m = y <=> T) ==> (n:A,m:B = x,y <=> T)`, SIMP_TAC[PAIR_EQ]) and + PAIR_NEQ_FST = (MY_RULE o prove)(`(n = x <=> F) ==> (n:A,m:B = x,y <=> F)`, SIMP_TAC[PAIR_EQ]) and + PAIR_NEQ_SND = (MY_RULE o prove)(`(m = y <=> F) ==> (n:A,m:B = x,y <=> F)`, SIMP_TAC[PAIR_EQ]);; + + +let eval_pair_eq_univ (eq1_f, eq2_f) p1_tm p2_tm = + if (p1_tm = p2_tm) then + EQT_INTRO (REFL p1_tm) + else + let n_tm, m_tm = dest_pair p1_tm in + let x_tm, y_tm = dest_pair p2_tm in + let ty1 = type_of n_tm and + ty2 = type_of m_tm in + let n_var, m_var = mk_var("n", ty1), mk_var("m", ty2) and + x_var, y_var = mk_var("x", ty1), mk_var("y", ty2) in + let inst_t = INST_TYPE[ty1, aty; ty2, bty] in + let inst = INST[n_tm, n_var; m_tm, m_var; x_tm, x_var; y_tm, y_var] in + let fst_th = eq1_f (mk_eq (n_tm, x_tm)) in + if (rand(concl fst_th) = f_const) then + MY_PROVE_HYP fst_th ((inst o inst_t) PAIR_NEQ_FST) + else + let snd_th = eq2_f (mk_eq (m_tm, y_tm)) in + if (rand(concl snd_th) = f_const) then + MY_PROVE_HYP snd_th ((inst o inst_t) PAIR_NEQ_SND) + else + let th0 = (inst o inst_t) PAIR_EQ_TT in + MY_PROVE_HYP fst_th (MY_PROVE_HYP snd_th th0);; + + +let pair_eq_conv_univ (eq1_f, eq2_f) eq_tm = + let lhs, rhs = dest_eq eq_tm in + eval_pair_eq_univ (eq1_f, eq2_f) lhs rhs;; + + +let eval_pair_eq_num = + let inst_t = INST_TYPE[num_type, aty; num_type, bty] in + let pair_eq, pair_neq_fst, pair_neq_snd = + inst_t PAIR_EQ_TT, inst_t PAIR_NEQ_FST, inst_t PAIR_NEQ_SND in + fun p1_tm p2_tm -> + if (p1_tm = p2_tm) then + EQT_INTRO (REFL p1_tm) + else + let n_tm, m_tm = dest_pair p1_tm in + let x_tm, y_tm = dest_pair p2_tm in + let inst = INST[n_tm, n_var_num; m_tm, m_var_num; x_tm, x_var_num; y_tm, y_var_num] in + let fst_th = raw_eq_hash_conv (mk_eq (n_tm, x_tm)) in + if (rand(concl fst_th) = f_const) then + MY_PROVE_HYP fst_th (inst pair_neq_fst) + else + let snd_th = raw_eq_hash_conv (mk_eq (m_tm, y_tm)) in + if (rand(concl snd_th) = f_const) then + MY_PROVE_HYP snd_th (inst pair_neq_snd) + else + let th0 = inst pair_eq in + MY_PROVE_HYP fst_th (MY_PROVE_HYP snd_th th0);; + + +let pair_eq_conv_num eq_tm = + let lhs, rhs = dest_eq eq_tm in + eval_pair_eq_num lhs rhs;; + + + +(******************************) + +(* HD conversions *) + +let HD_A_CONS = prove(`HD (CONS (h:A) t) = h`, REWRITE_TAC[HD]);; + +(* Takes a term `[a;...]` and returns the theorem |- HD [a;...] = a *) +let eval_hd list_tm = + let ltm, t_tm = dest_comb list_tm in + let h_tm = rand ltm in + let list_ty = type_of t_tm and + ty = type_of h_tm in + let h_var = mk_var("h", ty) and + t_var = mk_var("t", list_ty) in + (INST[h_tm, h_var; t_tm, t_var] o INST_TYPE[ty, aty]) HD_A_CONS;; + +(* Takes a term `HD [a;...]` and returns the theorem |- HD [a;...] = a *) +let hd_conv hd_tm = + if (fst o dest_const o rator) hd_tm <> "HD" then failwith "hd_conv" + else eval_hd (rand hd_tm);; + + + +(*********************************) +(* EL conversion *) + +let EL_0' = (MY_RULE_NUM o prove)(`EL 0 (CONS (h:A) t) = h`, REWRITE_TAC[EL; HD]);; +let EL_n' = (MY_RULE_NUM o prove)(`0 < n /\ PRE n = m ==> EL n (CONS (h:A) t) = EL m t`, + STRIP_TAC THEN SUBGOAL_THEN `n = SUC m` ASSUME_TAC THENL + [ REPEAT (POP_ASSUM MP_TAC) THEN ARITH_TAC; ALL_TAC ] THEN ASM_REWRITE_TAC[EL; TL]);; + + +(* Takes a raw numeral term and a list term and returns the theorem |- EL n [...] = x *) +let eval_el n_tm list_tm = + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let inst_t = INST_TYPE[ty, aty] in + let el_0, el_n = inst_t EL_0', inst_t EL_n' in + let h_var, t_var = mk_var("h", ty), mk_var("t", list_ty) in + + let rec el_conv_raw = fun n_tm list_tm -> + let h_tm, t_tm = dest_cons list_tm in + let inst0 = INST[h_tm, h_var; t_tm, t_var] in + if n_tm = zero_const then + inst0 el_0 + else + let n_gt0 = (EQT_ELIM o raw_gt0_hash_conv) n_tm in + let pre_n = raw_pre_hash_conv (mk_comb (pre_op_num, n_tm)) in + let m_tm = (rand o concl) pre_n in + let th0 = (MY_PROVE_HYP pre_n o MY_PROVE_HYP n_gt0 o + INST[n_tm, n_var_num; m_tm, m_var_num] o inst0) el_n in + let th1 = el_conv_raw m_tm t_tm in + TRANS th0 th1 in + el_conv_raw n_tm list_tm;; + + + +(* Takes a term `EL n [...]` and returns the theorem |- EL n [...] = x *) +(* Note: n must be a raw numeral term Dx (Dy ... _0) *) +let el_conv el_tm = + let ltm, list_tm = dest_comb el_tm in + let el, n_tm = dest_comb ltm in + if (fst o dest_const) el <> "EL" then failwith "el_conv" + else eval_el n_tm list_tm;; + + + +(*******************************) +(* FST, SND conversions *) + +let FST' = ISPECL[`x:A`; `y:B`] FST;; +let SND' = ISPECL[`x:A`; `y:B`] SND;; + +let fst_conv tm = + let x_tm, y_tm = dest_pair (rand tm) in + let x_ty, y_ty = type_of x_tm, type_of y_tm in + let x_var, y_var = mk_var("x", x_ty), mk_var("y", y_ty) in + (INST[x_tm, x_var; y_tm, y_var] o INST_TYPE[x_ty, aty; y_ty, bty]) FST';; + +let snd_conv tm = + let x_tm, y_tm = dest_pair (rand tm) in + let x_ty, y_ty = type_of x_tm, type_of y_tm in + let x_var, y_var = mk_var("x", x_ty), mk_var("y", y_ty) in + (INST[x_tm, x_var; y_tm, y_var] o INST_TYPE[x_ty, aty; y_ty, bty]) SND';; + + + +(******************************) +(* LENGTH conversions *) + +let LENGTH_0' = (MY_RULE_NUM o prove) (`LENGTH ([]:(A)list) = 0`, REWRITE_TAC[LENGTH]) and + LENGTH_CONS' = prove(`LENGTH (CONS (h:A) t) = SUC (LENGTH t)`, REWRITE_TAC[LENGTH]);; + +(* Takes a term `[...]` and returns the theorem |- LENGTH [...] = n *) +let eval_length list_tm = + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let inst_t = INST_TYPE[ty, aty] in + let length_empty, length_cons = inst_t LENGTH_0', inst_t LENGTH_CONS' in + let h_var, t_var = mk_var("h", ty), mk_var("t", list_ty) in + + let rec length_conv_raw = fun list_tm -> + if (is_comb list_tm) then + let ltm, t_tm = dest_comb list_tm in + let h_tm = rand ltm in + let th0 = INST[h_tm, h_var; t_tm, t_var] length_cons in + let th1' = length_conv_raw t_tm in + let th1 = AP_TERM suc_op_num th1' in + let th2 = raw_suc_conv_hash (rand(concl th1)) in + TRANS (TRANS th0 th1) th2 + else + length_empty in + length_conv_raw list_tm;; + + +(* Takes a term `LENGTH [...]` and returns the theorem |- LENGTH [...] = n *) +let length_conv length_tm = + if (fst o dest_const o rator) length_tm <> "LENGTH" then failwith "length_conv" + else eval_length (rand length_tm);; + + + + +(************************) +(* eval_zip *) + +let ZIP_0' = prove(`ZIP ([]:(A)list) ([]:(B)list) = []`, REWRITE_TAC[ZIP]) and + ZIP_CONS' = prove(`ZIP (CONS (h1:A) t1) (CONS (h2:B) t2) = CONS (h1, h2) (ZIP t1 t2)`, + REWRITE_TAC[ZIP]);; + +let eval_zip list1_tm list2_tm = + let list1_ty = type_of list1_tm and + list2_ty = type_of list2_tm in + let ty1 = (hd o snd o dest_type) list1_ty and + ty2 = (hd o snd o dest_type) list2_ty in + let inst_t = INST_TYPE[ty1, aty; ty2, bty] in + let zip0, zip_cons = inst_t ZIP_0', inst_t ZIP_CONS' in + let h1_var, t1_var = mk_var("h1", ty1), mk_var("t1", list1_ty) and + h2_var, t2_var = mk_var("h2", ty2), mk_var("t2", list2_ty) in + + let rec zip_conv_rec = fun list1_tm list2_tm -> + if (is_comb list1_tm) then + let ltm1, t1_tm = dest_comb list1_tm and + ltm2, t2_tm = dest_comb list2_tm in + let h1_tm, h2_tm = rand ltm1, rand ltm2 in + let th0 = INST[h1_tm, h1_var; t1_tm, t1_var; h2_tm, h2_var; t2_tm, t2_var] zip_cons in + let cons_tm = (rator o rand o concl) th0 in + let th1' = zip_conv_rec t1_tm t2_tm in + let th1 = AP_TERM cons_tm th1' in + TRANS th0 th1 + else + zip0 in + zip_conv_rec list1_tm list2_tm;; + + +(******************) +(* ALL conversion *) +(******************) + +let ALL_0' = prove(`ALL P ([]:(A)list) <=> T`, REWRITE_TAC[ALL]) and + ALL_CONS_T' = (MY_RULE o prove)(`(P h <=> T) /\ (ALL P t <=> T) ==> (ALL P (CONS (h:A) t) <=> T)`, + REWRITE_TAC[ALL]) and + ALL_CONS_F2' = (MY_RULE o prove)(`(ALL P t <=> F) ==> (ALL P (CONS (h:A) t) <=> F)`, + SIMP_TAC[ALL]) and + ALL_CONS_F1' = (MY_RULE o prove)(`(P h <=> F) ==> (ALL P (CONS (h:A) t) <=> F)`, + SIMP_TAC[ALL]);; + + +(* Note: p_conv should return theorems of the form |- P a <=> T *) +let all_conv_univ p_conv tm = + let ltm, list_tm = dest_comb tm in + let p_tm = rand ltm in + + let list_ty = type_of list_tm and + p_ty = type_of p_tm in + let ty = (hd o snd o dest_type) list_ty in + let inst_t = INST_TYPE[ty, aty] in + + let all_0, all_t, all_f1, all_f2 = inst_t ALL_0', inst_t ALL_CONS_T', + inst_t ALL_CONS_F1', inst_t ALL_CONS_F2' in + let h_var, t_var = mk_var("h", ty), mk_var("t", list_ty) and + p_var = mk_var("P", p_ty) in + + let rec all_conv_rec = fun list_tm -> + if is_comb list_tm then + let ltm, t_tm = dest_comb list_tm in + let h_tm = rand ltm in + let p_th = p_conv (mk_comb (p_tm, h_tm)) in + let inst = INST[h_tm, h_var; t_tm, t_var; p_tm, p_var] in + if (rand o concl) p_th = t_const then + let all_th = all_conv_rec t_tm in + if (rand o concl) all_th = t_const then + (MY_PROVE_HYP all_th o MY_PROVE_HYP p_th o inst) all_t + else + (MY_PROVE_HYP all_th o inst) all_f2 + else + (MY_PROVE_HYP p_th o inst) all_f1 + else + INST[p_tm, p_var] all_0 in + all_conv_rec list_tm;; + + + +(*******************) +(* ALL2 conversion *) +(*******************) + +let ALL2_0' = prove(`ALL2 P ([]:(A)list) ([]:(B)list) <=> T`, REWRITE_TAC[ALL2]) and + ALL2_CONS_T' = (MY_RULE o prove)(`(P h1 h2 <=> T) /\ (ALL2 P t1 t2 <=> T) ==> + (ALL2 P (CONS (h1:A) t1) (CONS (h2:B) t2) <=> T)`, + REWRITE_TAC[ALL2]) and + ALL2_CONS_F2' = (MY_RULE o prove)(`(ALL2 P t1 t2 <=> F) ==> + (ALL2 P (CONS (h1:A) t1) (CONS (h2:B) t2) <=> F)`, + SIMP_TAC[ALL2]) and + ALL2_CONS_F1' = (MY_RULE o prove)(`(P h1 h2 <=> F) ==> + (ALL2 P (CONS (h1:A) t1) (CONS (h2:B) t2) <=> F)`, + SIMP_TAC[ALL2]);; + + +(* Note: p_conv should return theorems of the form |- P a b <=> T *) +let all2_conv_univ p_conv tm = + let ltm, list2_tm = dest_comb tm in + let ltm2, list1_tm = dest_comb ltm in + let p_tm = rand ltm2 in + + let list1_ty = type_of list1_tm and + list2_ty = type_of list2_tm and + p_ty = type_of p_tm in + let ty1 = (hd o snd o dest_type) list1_ty and + ty2 = (hd o snd o dest_type) list2_ty in + let inst_t = INST_TYPE[ty1, aty; ty2, bty] in + + let all2_0, all2_t, all2_f1, all2_f2 = inst_t ALL2_0', inst_t ALL2_CONS_T', + inst_t ALL2_CONS_F1', inst_t ALL2_CONS_F2' in + let h1_var, t1_var = mk_var("h1", ty1), mk_var("t1", list1_ty) and + h2_var, t2_var = mk_var("h2", ty2), mk_var("t2", list2_ty) and + p_var = mk_var("P", p_ty) in + + let rec all2_conv_rec = fun list1_tm list2_tm -> + if is_comb list1_tm then + let ltm1, t1_tm = dest_comb list1_tm and + ltm2, t2_tm = dest_comb list2_tm in + let h1_tm, h2_tm = rand ltm1, rand ltm2 in + let p_th = p_conv (mk_binop p_tm h1_tm h2_tm) in + let inst = INST[h1_tm, h1_var; t1_tm, t1_var; h2_tm, h2_var; t2_tm, t2_var; p_tm, p_var] in + if (rand o concl) p_th = t_const then + let all2_th = all2_conv_rec t1_tm t2_tm in + if (rand o concl) all2_th = t_const then + (MY_PROVE_HYP all2_th o MY_PROVE_HYP p_th o inst) all2_t + else + (MY_PROVE_HYP all2_th o inst) all2_f2 + else + (MY_PROVE_HYP p_th o inst) all2_f1 + else + if is_comb list2_tm then failwith ("all2_conv_univ: l1 = []; l2 = "^string_of_term list2_tm) else + INST[p_tm, p_var] all2_0 in + all2_conv_rec list1_tm list2_tm;; + + + +(******************************) +(* MEM conversions *) + +let MEM_A_EMPTY = prove(`MEM (x:A) [] <=> F`, REWRITE_TAC[MEM]) and + MEM_A_HD = (MY_RULE o prove) (`(x = h <=> T) ==> (MEM (x:A) (CONS h t) <=> T)`, SIMP_TAC[MEM]) and + MEM_A_TL = (MY_RULE o prove) (`(x = h <=> F) ==> (MEM (x:A) (CONS h t) <=> MEM x t)`, SIMP_TAC[MEM]);; + + +let rec eval_mem_univ eq_conv x_tm list_tm = + let ty = type_of x_tm in + let inst_t = INST_TYPE[ty, aty] in + let mem_empty, mem_hd, mem_tl = inst_t MEM_A_EMPTY, inst_t MEM_A_HD, inst_t MEM_A_TL in + let x_var, h_var = mk_var("x", ty), mk_var("h", ty) and + t_var = mk_var("t", mk_type("list", [ty])) in + + let rec mem_conv_raw list_tm = + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let eq_th = eq_conv (mk_eq(x_tm, h_tm)) in + if (rand(concl eq_th) = t_const) then + let th0' = INST[x_tm, x_var; h_tm, h_var; t_tm, t_var] mem_hd in + MY_PROVE_HYP eq_th th0' + else + let th0' = INST[x_tm, x_var; h_tm, h_var; t_tm, t_var] mem_tl in + let th0 = MY_PROVE_HYP eq_th th0' in + let th1 = mem_conv_raw t_tm in + TRANS th0 th1 + else + INST[x_tm, x_var] mem_empty in + + mem_conv_raw list_tm;; + + +let mem_conv_univ eq_conv mem_tm = + let ltm, list_tm = dest_comb mem_tm in + let c_tm, x_tm = dest_comb ltm in + if (fst o dest_const) c_tm <> "MEM" then failwith "mem_conv_univ" else + eval_mem_univ eq_conv x_tm list_tm;; + + + +(**********************************) +(* FILTER conversions *) + +let FILTER_A_EMPTY = prove(`FILTER (P:A->bool) [] = []`, REWRITE_TAC[FILTER]) and + FILTER_A_HD = (MY_RULE o prove) (`(P h <=> T) ==> FILTER (P:A->bool) (CONS h t) = CONS h (FILTER P t)`, + SIMP_TAC[FILTER]) and + FILTER_A_TL = (MY_RULE o prove) (`(P h <=> F) ==> FILTER (P:A->bool) (CONS h t) = FILTER P t`, + SIMP_TAC[FILTER]);; + + +let filter_conv_univ p_conv tm = + let ltm, list_tm = dest_comb tm in + let p_tm = rand ltm in + let p_ty = type_of p_tm in + let ty = (hd o snd o dest_type) p_ty in + let inst_t = INST_TYPE[ty, aty] in + let filter_empty, filter_hd, filter_tl = + inst_t FILTER_A_EMPTY, inst_t FILTER_A_HD, inst_t FILTER_A_TL in + let p_var = mk_var("P", p_ty) in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", mk_type("list",[ty])) in + + let rec filter_conv_raw = fun list_tm -> + if (is_comb list_tm) then + let ltm, t_tm = dest_comb list_tm in + let h_tm = rand ltm in + let p_th = p_conv (mk_comb(p_tm, h_tm)) in + if (rand(concl p_th) = t_const) then + let th0' = INST[p_tm, p_var; h_tm, h_var; t_tm, t_var] filter_hd in + let th0 = MY_PROVE_HYP p_th th0' in + let ltm = rator(rand(concl th0)) in + let th1 = filter_conv_raw t_tm in + TRANS th0 (AP_TERM ltm th1) + else + let th0' = INST[p_tm, p_var; h_tm, h_var; t_tm, t_var] filter_tl in + let th0 = MY_PROVE_HYP p_th th0' in + let th1 = filter_conv_raw t_tm in + TRANS th0 th1 + else + INST[p_tm, p_var] filter_empty in + filter_conv_raw list_tm;; + + +(***************************) +(* MAP conversions *) + +let MAP_AB_EMPTY = prove(`MAP (f:A->B) [] = []`, REWRITE_TAC[MAP]) and + MAP_AB_CONS = prove(`MAP (f:A->B) (CONS h t) = CONS (f h) (MAP f t)`, REWRITE_TAC[MAP]);; + + +let map_conv_univ f_conv tm = + let ltm, list_tm = dest_comb tm in + let ftm = rand ltm in + let ftm_ty = type_of ftm in + let f_var = mk_var("f", ftm_ty) in + let [a_type; b_type] = snd(dest_type ftm_ty) in + let h_var = mk_var("h", a_type) in + let t_var = mk_var("t", mk_type("list", [a_type])) in + let inst_t = INST[ftm, f_var] o INST_TYPE[a_type, aty; b_type, bty] in + let map_empty, map_cons = + inst_t MAP_AB_EMPTY, inst_t MAP_AB_CONS in + + let rec map_conv_raw list_tm = + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let th0 = INST[h_tm, h_var; t_tm, t_var] map_cons in + let ltm, rtm = dest_comb (rand(concl th0)) in + let cons_tm, f_h_tm = dest_comb ltm in + let f_h_th = f_conv f_h_tm in + let map_t_th = map_conv_raw t_tm in + TRANS th0 (MK_COMB (AP_TERM cons_tm f_h_th, map_t_th)) + else + map_empty in + + map_conv_raw list_tm;; + + +(*****************************************) +(* ALL rules *) + +let ALL_A_HD = (MY_RULE o prove) (`ALL (P:A->bool) (CONS h t) ==> P h`, SIMP_TAC[ALL]) and + ALL_A_TL = (MY_RULE o prove) (`ALL (P:A->bool) (CONS h t) ==> ALL P t`, SIMP_TAC[ALL]);; + + +(* Given a theorem `ALL P list` returns the list of theorems (P x1),...,(P xn) *) +let get_all th = + let ltm, list_tm = dest_comb (concl th) in + let p_tm = rand ltm in + let list_ty = type_of list_tm in + let p_ty = type_of p_tm in + let ty = (hd o snd o dest_type) list_ty in + let p_var = mk_var("P", p_ty) in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", list_ty) in + + let inst_t = INST[p_tm, p_var] o INST_TYPE[ty, aty] in + let all_hd, all_tl = inst_t ALL_A_HD, inst_t ALL_A_TL in + + let rec get_all_raw all_th list_tm = + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let inst_t = INST[h_tm, h_var; t_tm, t_var] in + let th_tl = MY_PROVE_HYP all_th (inst_t all_tl) in + let th_hd = MY_PROVE_HYP all_th (inst_t all_hd) in + th_hd :: get_all_raw th_tl t_tm + else + [] in + get_all_raw th list_tm;; + + + +(* Given a theorem `ALL P list`, returns (P x_i1),..., (P x_in) + where i1,...,in are given indices. + The list of indices should be sorted *) +let select_all th indices = + let ltm, list_tm = dest_comb (concl th) in + let p_tm = rand ltm in + let list_ty = type_of list_tm in + let p_ty = type_of p_tm in + let ty = (hd o snd o dest_type) list_ty in + let p_var = mk_var("P", p_ty) in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", list_ty) in + + let inst_t = INST[p_tm, p_var] o INST_TYPE[ty, aty] in + let all_hd, all_tl = inst_t ALL_A_HD, inst_t ALL_A_TL in + + let rec get_all_raw all_th list_tm indices n = + match indices with + [] -> [] + | i::is -> + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let inst_t = INST[h_tm, h_var; t_tm, t_var] in + let th_tl = MY_PROVE_HYP all_th (inst_t all_tl) in + + if (i - n = 0) then + let th_hd = MY_PROVE_HYP all_th (inst_t all_hd) in + th_hd :: get_all_raw th_tl t_tm is (n + 1) + else + get_all_raw th_tl t_tm (i::is) (n + 1) in + get_all_raw th list_tm indices 0;; + + +(*****************************************) +(* set_of_list conversions *) + +let SET_OF_LIST_A_EMPTY = prove(`set_of_list ([]:(A)list) = {}`, REWRITE_TAC[set_of_list]) and + SET_OF_LIST_A_H = prove(`set_of_list [h:A] = {h}`, REWRITE_TAC[set_of_list]) and + SET_OF_LIST_A_CONS = prove(`set_of_list (CONS (h:A) t) = h INSERT set_of_list t`, REWRITE_TAC[set_of_list]);; + + +let eval_set_of_list list_tm = + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", list_ty) in + let inst_t = INST_TYPE[ty, aty] in + let set_of_list_h, set_of_list_cons = inst_t SET_OF_LIST_A_H, inst_t SET_OF_LIST_A_CONS in + + let rec set_of_list_conv_raw = fun h_tm t_tm -> + if (is_comb t_tm) then + let h_tm', t_tm' = dest_comb t_tm in + let th0 = INST[h_tm, h_var; t_tm, t_var] set_of_list_cons in + let ltm, rtm = dest_comb(rand(concl th0)) in + TRANS th0 (AP_TERM ltm (set_of_list_conv_raw (rand h_tm') t_tm')) + else + INST[h_tm, h_var] set_of_list_h in + + if (is_comb list_tm) then + let h_tm, t_tm = dest_comb list_tm in + set_of_list_conv_raw (rand h_tm) t_tm + else + inst_t SET_OF_LIST_A_EMPTY;; + +let set_of_list_conv tm = + if (fst o dest_const o rator) tm <> "set_of_list" then failwith "set_of_list_conv" + else eval_set_of_list (rand tm);; + + +(*****************************************) +(* flatten conversions *) + +let flatten_empty = prove(`flatten ([]:((A)list)list) = []`, REWRITE_TAC[flatten; foldr; cat]) and + flatten_cons_empty = prove(`flatten (CONS ([]:(A)list) tt) = flatten tt`, REWRITE_TAC[flatten; foldr; cat]) and + flatten_cons_cons = prove(`flatten (CONS (CONS (h:A) t) tt) = CONS h (flatten (CONS t tt))`, REWRITE_TAC[flatten; foldr; cat]);; + + +(* Works for any list of lists *) +let eval_flatten list_list_tm = + let list_list_ty = type_of list_list_tm in + let list_ty = (hd o snd o dest_type) list_list_ty in + let ty = (hd o snd o dest_type) list_ty in + let inst_t = INST_TYPE[ty, aty] in + let flatten_empty, flatten_cons_empty, flatten_cons_cons = + inst_t flatten_empty, inst_t flatten_cons_empty, inst_t flatten_cons_cons in + let tt_var = mk_var("tt", list_list_ty) in + let t_var = mk_var("t", list_ty) in + let h_var = mk_var("h", ty) in + + let rec flatten_conv_raw list_list_tm = + if (is_comb list_list_tm) then + let hh_tm', tt_tm = dest_comb list_list_tm in + let hh_tm = rand hh_tm' in + if (is_comb hh_tm) then + let h_tm', t_tm = dest_comb hh_tm in + let h_tm = rand h_tm' in + let th0 = INST[h_tm, h_var; t_tm, t_var; tt_tm, tt_var] flatten_cons_cons in + let ltm, rtm = dest_comb(rand(concl th0)) in + let th1 = AP_TERM ltm (flatten_conv_raw (rand rtm)) in + TRANS th0 th1 + else + let th0 = INST[tt_tm, tt_var] flatten_cons_empty in + let th1 = flatten_conv_raw tt_tm in + TRANS th0 th1 + else + flatten_empty in + + flatten_conv_raw list_list_tm;; + + +let flatten_conv flatten_tm = + if (fst o dest_const o rator) flatten_tm <> "flatten" then failwith "flatten_conv" + else eval_flatten (rand flatten_tm);; + + +(********************************) +(* uniq conversion *) + +let uniq_empty = prove(`uniq ([]:(A)list) <=> T`, REWRITE_TAC[uniq]) and + uniq_cons_F = (MY_RULE o prove) (`(MEM (h:A) t <=> F) ==> (uniq (CONS h t) <=> uniq t)`, SIMP_TAC[uniq]) and + uniq_cons_T = (MY_RULE o prove) (`(MEM (h:A) t <=> T) ==> (uniq (CONS h t) <=> F)`, SIMP_TAC[uniq]);; + + +let eval_uniq_univ eq_conv list_tm = + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", list_ty) in + let inst_t = INST_TYPE[ty, aty] in + let uniq_empty, uniq_cons_F, uniq_cons_T = + inst_t uniq_empty, inst_t uniq_cons_F, inst_t uniq_cons_T in + let rec uniq_rec list_tm = + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let inst = INST[h_tm, h_var; t_tm, t_var] in + let mem_th = eval_mem_univ eq_conv h_tm t_tm in + if (rand (concl mem_th) = t_const) then + MY_PROVE_HYP mem_th (inst uniq_cons_T) + else + let th0 = MY_PROVE_HYP mem_th (inst uniq_cons_F) in + let th1 = uniq_rec t_tm in + TRANS th0 th1 + else + uniq_empty in + uniq_rec list_tm;; + + +let uniq_conv_univ eq_conv tm = + if (fst o dest_const o rator) tm <> "uniq" then failwith "uniq_conv" + else eval_uniq_univ eq_conv (rand tm);; + + +(**********************************) +(* undup conversion *) + +let undup_empty = prove(`undup ([]:(num)list) = []`, REWRITE_TAC[undup]) and + undup_mem_T = (MY_RULE o prove) (`(MEM (h:A) t <=> T) ==> undup (CONS h t) = undup t`, SIMP_TAC[undup]) and + undup_mem_F = (MY_RULE o prove) (`(MEM (h:A) t <=> F) ==> undup (CONS h t) = CONS h (undup t)`, SIMP_TAC[undup]);; + + +let eval_undup_univ eq_conv list_tm = + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", list_ty) in + let inst_t = INST_TYPE[ty, aty] in + let empty, mem_T, mem_F = + inst_t undup_empty, inst_t undup_mem_T, inst_t undup_mem_F in + + let rec undup_rec list_tm = + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let inst = INST[h_tm, h_var; t_tm, t_var] in + let mem_th = eval_mem_univ eq_conv h_tm t_tm in + if (rand(concl mem_th) = t_const) then + let th0 = MY_PROVE_HYP mem_th (inst mem_T) in + let th1 = undup_rec t_tm in + TRANS th0 th1 + else + let th0 = MY_PROVE_HYP mem_th (inst mem_F) in + let ltm, rtm = dest_comb (rand(concl th0)) in + let th1 = undup_rec (rand rtm) in + TRANS th0 (AP_TERM ltm th1) + else + empty in + + undup_rec list_tm;; + + +let undup_conv_univ eq_conv tm = + if (fst o dest_const o rator) tm <> "undup" then failwith "undup_conv" + else eval_undup_univ eq_conv (rand tm);; + + +(**********************************) +(* cat conversion *) + +let cat_empty' = prove(`cat [] (s:(A)list) = s`, REWRITE_TAC[cat]) and + cat_cons' = prove(`cat (CONS (h:A) t) s = CONS h (cat t s)`, REWRITE_TAC[cat]);; + + +let eval_cat list1_tm list2_tm = + let list_ty = type_of list1_tm in + let ty = (hd o snd o dest_type) list_ty in + let h_var = mk_var("h", ty) and + t_var = mk_var("t", list_ty) and + s_var = mk_var("s", list_ty) in + let inst_t = INST_TYPE[ty, aty] in + let empty, cons = inst_t cat_empty', inst_t cat_cons' in + let rec cat_rec list_tm = + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let inst = INST[h_tm, h_var; t_tm, t_var; list2_tm, s_var] in + let th0 = inst cons in + let ltm = rator (rand (concl th0)) in + let th1 = cat_rec t_tm in + TRANS th0 (AP_TERM ltm th1) + else + INST[list2_tm, s_var] empty in + + cat_rec list1_tm;; + + +let cat_conv tm = + let ltm, list2_tm = dest_comb tm in + let cat, list1_tm = dest_comb ltm in + if (fst o dest_const) cat <> "cat" then failwith "cat_conv" + else eval_cat list1_tm list2_tm;; + + +(**********************************) +(* BUTLAST and LAST conversions *) + +let last1' = prove(`LAST [h:A] = h`, REWRITE_TAC[LAST]) and + last_cons2' = prove(`LAST (CONS (h:A) (CONS h2 s)) = LAST (CONS h2 s)`, REWRITE_TAC[LAST; NOT_CONS_NIL]) and + butlast1' = prove(`BUTLAST [h:A] = []`, REWRITE_TAC[BUTLAST]) and + butlast_cons2' = prove(`BUTLAST (CONS (h:A) (CONS h2 s)) = CONS h (BUTLAST (CONS h2 s))`, + REWRITE_TAC[BUTLAST; NOT_CONS_NIL]);; + + +let eval_butlast_last list_tm = + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let inst_t = INST_TYPE[ty, aty] in + let last1, last2 = inst_t last1', inst_t last_cons2' in + let butlast1, butlast2 = inst_t butlast1', inst_t butlast_cons2' in + let h_var, h2_var, s_var = mk_var("h", ty), mk_var("h2", ty), mk_var("s", list_ty) in + + let rec butlast_last_rec list_tm = + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + if is_comb t_tm then + let h_tm', s_tm = dest_comb t_tm in + let h2_tm = rand h_tm' in + let inst = INST[h_tm, h_var; h2_tm, h2_var; s_tm, s_var] in + let butlast_th0 = inst butlast2 in + let last_th0 = inst last2 in + let butlast_th1, last_th1 = butlast_last_rec t_tm in + let ltm = (rator o rand o concl) butlast_th0 in + TRANS butlast_th0 (AP_TERM ltm butlast_th1), TRANS last_th0 last_th1 + else + let inst = INST[h_tm, h_var; t_tm, s_var] in + inst butlast1, inst last1 in + + butlast_last_rec list_tm;; + + + +(**********************************) +(* take and drop conversions *) + +let take0' = (MY_RULE_NUM o prove)(`take 0 (s:(A)list) = []`, REWRITE_TAC[take]) and + take_nil' = prove(`take n ([]:(A)list) = []`, REWRITE_TAC[take]) and + take_pre' = (MY_RULE_NUM o prove)(`!n. (0 < n <=> T) /\ PRE n = m ==> take n (CONS (h:A) s) = CONS h (take m s)`, + INDUCT_TAC THEN SIMP_TAC[take; PRE] THEN ARITH_TAC);; + + +let eval_take n_tm list_tm = + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let inst_t = INST_TYPE[ty, aty] in + let take0, take_nil, take_pre = inst_t take0', inst_t take_nil', inst_t take_pre' in + let h_var, s_var = mk_var("h", ty), mk_var("s", list_ty) in + + let rec take_rec n_tm list_tm = + if is_comb list_tm then + if n_tm = zero_const then + INST[list_tm, s_var] take0 + else + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let n_gt0 = raw_gt0_hash_conv n_tm in + let pre_n = raw_pre_hash_conv (mk_comb (pre_op_num, n_tm)) in + let m_tm = (rand o concl) pre_n in + let inst = INST[h_tm, h_var; t_tm, s_var; m_tm, m_var_num; n_tm, n_var_num] in + let th0 = (MY_PROVE_HYP pre_n o MY_PROVE_HYP n_gt0 o inst) take_pre in + let ltm = (rator o rand o concl) th0 in + let th1 = take_rec m_tm t_tm in + TRANS th0 (AP_TERM ltm th1) + else + INST[n_tm, n_var_num] take_nil in + + take_rec n_tm list_tm;; + + +(* drop *) +let drop0' = (MY_RULE_NUM o prove)(`dropl 0 (s:(A)list) = s`, REWRITE_TAC[drop]) and + drop_nil' = prove(`dropl n ([]:(A)list) = []`, REWRITE_TAC[drop]) and + drop_pre' = (MY_RULE_NUM o prove)(`!n. (0 < n <=> T) /\ PRE n = m ==> dropl n (CONS (h:A) s) = dropl m s`, + INDUCT_TAC THEN SIMP_TAC[drop; PRE] THEN ARITH_TAC);; + + +let eval_drop n_tm list_tm = + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let inst_t = INST_TYPE[ty, aty] in + let drop0, drop_nil, drop_pre = inst_t drop0', inst_t drop_nil', inst_t drop_pre' in + let h_var, s_var = mk_var("h", ty), mk_var("s", list_ty) in + + let rec drop_rec n_tm list_tm = + if is_comb list_tm then + if n_tm = zero_const then + INST[list_tm, s_var] drop0 + else + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let n_gt0 = raw_gt0_hash_conv n_tm in + let pre_n = raw_pre_hash_conv (mk_comb (pre_op_num, n_tm)) in + let m_tm = (rand o concl) pre_n in + let inst = INST[h_tm, h_var; t_tm, s_var; m_tm, m_var_num; n_tm, n_var_num] in + let th0 = (MY_PROVE_HYP pre_n o MY_PROVE_HYP n_gt0 o inst) drop_pre in + let th1 = drop_rec m_tm t_tm in + TRANS th0 th1 + else + INST[n_tm, n_var_num] drop_nil in + + drop_rec n_tm list_tm;; + + +(* take_drop *) + +let eval_take_drop n_tm list_tm = + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let inst_t = INST_TYPE[ty, aty] in + let drop0, drop_nil, drop_pre = inst_t drop0', inst_t drop_nil', inst_t drop_pre' in + let take0, take_nil, take_pre = inst_t take0', inst_t take_nil', inst_t take_pre' in + let h_var, s_var = mk_var("h", ty), mk_var("s", list_ty) in + + let rec take_drop_rec n_tm list_tm = + if is_comb list_tm then + if n_tm = zero_const then + let inst = INST[list_tm, s_var] in + inst take0, inst drop0 + else + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let n_gt0 = raw_gt0_hash_conv n_tm in + let pre_n = raw_pre_hash_conv (mk_comb (pre_op_num, n_tm)) in + let m_tm = (rand o concl) pre_n in + let inst = INST[h_tm, h_var; t_tm, s_var; m_tm, m_var_num; n_tm, n_var_num] in + let drop_th0 = (MY_PROVE_HYP pre_n o MY_PROVE_HYP n_gt0 o inst) drop_pre in + let take_th0 = (MY_PROVE_HYP pre_n o MY_PROVE_HYP n_gt0 o inst) take_pre in + let take_th1, drop_th1 = take_drop_rec m_tm t_tm in + let take_ltm = (rator o rand o concl) take_th0 in + TRANS take_th0 (AP_TERM take_ltm take_th1), TRANS drop_th0 drop_th1 + else + let inst = INST[n_tm, n_var_num] in + inst take_nil, inst drop_nil in + + take_drop_rec n_tm list_tm;; + + +(**************************) +(* rot *) + +let rot' = prove(`rot n (s:(A)list) = cat (dropl n s) (take n s)`, REWRITE_TAC[rot]);; + +let eval_rot n_tm list_tm = + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let s_var = mk_var("s", list_ty) in + let inst_t = INST_TYPE[ty, aty] in + let take_th, drop_th = eval_take_drop n_tm list_tm in + let cat_th = eval_cat (rand (concl drop_th)) (rand (concl take_th)) in + let cat_tm = (rator o rator o lhand o concl) cat_th in + let th0 = (INST[n_tm, n_var_num; list_tm, s_var] o inst_t) rot' in + let th1 = MK_COMB (AP_TERM cat_tm drop_th, take_th) in + TRANS (TRANS th0 th1) cat_th;; + + +(*******************************) +(* shift_left = rot 1 *) + +let shift_left_empty' = prove(`rot 1 [] = ([]:(A)list)`, REWRITE_TAC[rot; take; drop; cat]) and + shift_left_cons' = prove(`rot 1 (CONS (h:A) s) = cat s [h]`, REWRITE_TAC[rot1_cons; GSYM cats1]);; + + +let eval_rot1 list_tm = + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let inst_t = INST_TYPE[ty, aty] in + let h_var, s_var = mk_var("h", ty), mk_var("s", list_ty) in + if is_comb list_tm then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let th0 = (INST[h_tm, h_var; t_tm, s_var] o inst_t) shift_left_cons' in + let h_list = (rand o rand o concl) th0 in + let th1 = eval_cat t_tm h_list in + TRANS th0 th1 + else + inst_t shift_left_empty';; + + +(* shift_right = rotr 1 *) +let shift_right_empty' = prove(`rotr 1 [] = ([]:(A)list)`, REWRITE_TAC[rotr; rot; take; drop; cat]) and + shift_right_cons' = prove(`rotr 1 (CONS (h:A) s) = CONS (LAST (CONS h s)) (BUTLAST (CONS h s))`, + MP_TAC (ISPECL [`h:A`; `s:(A)list`] lastI) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; rotr1_rcons]) THEN + REWRITE_TAC[GSYM lastI] THEN SPEC_TAC (`h:A`, `h:A`) THEN + SPEC_TAC (`s:(A)list`, `s:(A)list`) THEN + LIST_INDUCT_TAC THEN REWRITE_TAC[last; belast; last1'; butlast1'] THEN GEN_TAC THEN + REWRITE_TAC[last_cons2'; butlast_cons2'] THEN + POP_ASSUM (MP_TAC o SPEC `h:A`) THEN + REWRITE_TAC[injectivity "list"]);; + + +let eval_rotr1 list_tm = + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let inst_t = INST_TYPE[ty, aty] in + let h_var, s_var = mk_var("h", ty), mk_var("s", list_ty) in + if is_comb list_tm then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let th0 = (INST[h_tm, h_var; t_tm, s_var] o inst_t) shift_right_cons' in + let butlast_th, last_th = eval_butlast_last list_tm in + let cons_tm = (rator o rator o rand o concl) th0 in + TRANS th0 (MK_COMB (AP_TERM cons_tm last_th, butlast_th)) + else + inst_t shift_right_empty';; + + + +(******************************) +(* index conversions *) + +let index_empty = (MY_RULE_NUM o prove)(`indexl (x:A) [] = 0`, REWRITE_TAC[index; find]) and + index_cons_eq = (MY_RULE_NUM o prove)(`(x = h <=> T) ==> indexl (x:A) (CONS h t) = 0`, + SIMP_TAC[index; find; pred1]) and + index_cons_neq = (MY_RULE o prove)(`(x = h <=> F) ==> indexl (x:A) (CONS h t) = SUC (indexl x t)`, + SIMP_TAC[index; find; pred1]);; + + +let rec eval_index_univ eq_conv x_tm list_tm = + let ty = type_of x_tm in + let inst_t = INST_TYPE[ty, aty] in + let index_empty, index_eq, index_neq = + inst_t index_empty, inst_t index_cons_eq, inst_t index_cons_neq in + let x_var, h_var = mk_var("x", ty), mk_var("h", ty) and + t_var = mk_var("t", mk_type("list", [ty])) in + + let rec index_rec list_tm = + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let eq_th = eq_conv (mk_eq(x_tm, h_tm)) in + if (rand(concl eq_th) = t_const) then + let th0 = INST[x_tm, x_var; h_tm, h_var; t_tm, t_var] index_eq in + MY_PROVE_HYP eq_th th0 + else + let th0 = INST[x_tm, x_var; h_tm, h_var; t_tm, t_var] index_neq in + let th1 = MY_PROVE_HYP eq_th th0 in + let th2 = AP_TERM suc_op_num (index_rec t_tm) in + let suc_th = raw_suc_conv_hash (rand (concl th2)) in + TRANS th1 (TRANS th2 suc_th) + else + INST[x_tm, x_var] index_empty in + + index_rec list_tm;; + + +let index_conv_univ eq_conv mem_tm = + let ltm, list_tm = dest_comb mem_tm in + let c_tm, x_tm = dest_comb ltm in + if (fst o dest_const) c_tm <> "indexl" then failwith "index_conv_univ" else + eval_index_univ eq_conv x_tm list_tm;; + + +end;; diff --git a/formal_lp/hypermap/computations/list_hypermap_computations.hl b/formal_lp/hypermap/computations/list_hypermap_computations.hl new file mode 100644 index 0000000..8ba23be --- /dev/null +++ b/formal_lp/hypermap/computations/list_hypermap_computations.hl @@ -0,0 +1,912 @@ +(* Explicit computations for hypermap_of_list *) + +#load "str.cma";; + +needs "../formal_lp/hypermap/ssreflect/list_hypermap_iso-compiled.hl";; +needs "../formal_lp/hypermap/computations/list_conversions2.hl";; +needs "../formal_lp/hypermap/computations/more_theory-compiled.hl";; + +module List_hypermap_computations = struct + +open Str;; +open List;; +open Misc_vars;; +open Arith_misc;; +open Arith_nat;; +open More_list_hypermap;; +open List_hypermap;; +open List_conversions;; +open List_hypermap_iso;; + + +let MY_RULE = UNDISCH_ALL o PURE_REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL;; +let MY_RULE_NUM = UNDISCH_ALL o NUMERALS_TO_NUM o PURE_REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL;; +let TO_NUM = REWRITE_RULE[Arith_hash.NUM_THM] o DEPTH_CONV NUMERAL_TO_NUM_CONV;; +let to_num = rand o concl o TO_NUM;; + + +(* Constants and variables *) +let hd_var_num = `hd:num` and + h_var_num = `h:num` and + h1_var_num = `h1:num` and + h2_var_num = `h2:num` and + t_var = `t:(num)list` and + x_var_pair = `x:num#num` and + d_var_pair = `d:num#num` and + h1_var_pair = `h1:num#num` and + h2_var_pair = `h2:num#num` and + acc_var = `acc:(num#num)list` and + f_var_fun = `f:num#num->num#num` and + l_cap_var = `L:((num)list)list` and + ll_var = `ll:((num)list)list` and + list_var = `list:(num#num)list` and + t_var_numnum_list = `t:(num#num)list` and + t_var_num_list = `t:(num)list` and + t_var_list_list = `t:((num)list)list` and + h_var_list = `h:(num)list` and + r_var_list = `r:(num)list` and + s1_var_list = `s1:(num)list` and + s2_var_list = `s2:(num)list`;; + +let num_list_type = `:(num)list`;; +let num_list_list_type = `:((num)list)list`;; + +let mem_const = `MEM:(num#num)->(num#num)list->bool` and + flatten_const = `flatten:((num#num)list)list -> (num#num)list`;; + + +let hypermap_of_list_const = `hypermap_of_list:((num)list)list->(num#num)hypermap` and + list_of_darts_const = `list_of_darts:((num)list)list->(num#num)list` and + list_of_edges_const = `list_of_edges:((num)list)list->((num#num)#(num#num))list` and + list_of_faces_const = `list_of_faces:((num)list)list->((num#num)list)list` and + list_of_nodes_const = `list_of_nodes:((num)list)list->((num#num)list)list` and + list_of_elements_const = `list_of_elements:((num)list)list->(num)list` and + good_list_const = `good_list:((num)list)list->bool` and + good_list_nodes_const = `good_list_nodes:((num)list)list->bool`;; + + +let num_pair_hash tm = + let ltm, rtm = dest_pair tm in + Arith_cache.num_tm_hash ltm ^ "," ^ Arith_cache.num_tm_hash rtm;; + + + +let build_term_rewrite tm lhs = + let rec build_rewrite tm = + if tm = lhs then + (fun th -> th), true + else + match tm with + | Comb (l_tm, r_tm) -> + let l_f, l_flag = build_rewrite l_tm and + r_f, r_flag = build_rewrite r_tm in + if l_flag then + if r_flag then + (fun th -> MK_COMB (l_f th, r_f th)), true + else + (fun th -> AP_THM (l_f th) r_tm), true + else + if r_flag then + (fun th -> AP_TERM l_tm (r_f th)), true + else + I, false + | Abs (var_tm, b_tm) -> + let b_f, b_flag = build_rewrite b_tm in + if b_flag then + (fun th -> ABS var_tm (b_f th)), true + else + I, false + | _ -> I, false in + let f, flag = build_rewrite tm in + if flag then f else (fun th -> REFL tm);; + + +(* eq_th = |- lhs = rhs; rewrites exact occurrences of lhs in tm and returns |- tm = tm[lhs/rhs] *) +let term_rewrite tm eq_th = + let lhs, _ = dest_eq (concl eq_th) in + build_term_rewrite tm lhs eq_th;; + + +(* +let tm = `(x + 2) * 2 = 0 /\ (\y. (x + 2) * y) 3 = 2` and + th = ARITH_RULE `x + 2 = 1 * 2 + x`;; + +let f = build_term_rewrite tm `x + 2`;; + +term_rewrite tm th;; +f th;; +PURE_REWRITE_CONV[th] tm;; + +(* 0.304 *) +test 10000 (term_rewrite tm) th;; +(* 0.216 *) +test 10000 f th;; +(* 2.808 *) +test 10000 (PURE_REWRITE_CONV[th]) tm;; +*) + + + +(* example of java style string from hypermap generator. *) +let pentstring = "13_150834109178 18 3 0 1 2 3 3 2 7 3 3 0 2 4 5 4 0 3 4 6 1 0 4 3 7 2 8 3 8 2 1 4 8 1 6 9 3 9 6 10 3 10 6 4 3 10 4 5 4 5 3 7 11 3 10 5 11 3 11 7 12 3 12 7 8 3 12 8 9 3 9 10 11 3 11 12 9 ";; +let test_string = "149438122187 18 6 0 1 2 3 4 5 4 0 5 6 7 3 6 5 4 3 6 4 8 3 8 4 3 3 8 3 9 3 9 3 2 3 9 2 10 3 10 2 11 3 11 2 1 3 11 1 0 3 11 0 7 3 10 11 7 3 10 7 12 3 12 7 6 3 12 6 8 3 12 8 9 3 9 10 12 ";; + +(* conversion to list. e.g. convert_to_list pentstring *) + +let convert_to_list = + let split_sp= Str.split (regexp " +") in + let strip_ = global_replace (regexp "_") "" in + let rec movelist n (x,a) = + if n = 0 then (x,a) else + match x with + | [] -> failwith "convert_to_list" + | y::ys -> movelist (n-1) (ys, y::a) in + let getone (x,a) = match x with + | [] -> ([],a) + | y::ys -> let (u,v) = movelist y (ys,[]) in (u,v::a) in + let rec getall (x,a) = + if (x=[]) then (x,a) else getall (getone (x,a)) in + fun s -> + let h::ss = (split_sp (strip_ s)) in + let _::ns = map int_of_string ss in + let (_,a) = getall (ns,[]) in + (h,rev (map rev a));; + + +let create_hol_list ll = + let s1 = map (map mk_small_numeral) ll in + let s2 = map (fun l -> mk_list (l, num_type)) s1 in + mk_list (s2, num_list_type);; + +let create_hol_list_str = + create_hol_list o snd o convert_to_list;; + +let test_list0 = create_hol_list_str test_string;; +let test_list = to_num test_list0;; + + +let print_num tm = + try + let n = raw_dest_hash tm in + let str = "'" ^ Num.string_of_num n in + Format.print_string str + with _ -> failwith "print_num";; + +install_user_printer ("num", print_num);; + + +(********************************************) + +let eval_mem_num_pair = eval_mem_univ pair_eq_conv_num;; +let mem_num_pair_conv = mem_conv_univ pair_eq_conv_num;; + + +(*************************************) +(* list_sum conversions *) + +let LIST_SUM_A_EMPTY = prove(`list_sum [] (f:A->real) = &0`, REWRITE_TAC[Seq2.list_sum_nil]) and + LIST_SUM_A_H = prove(`list_sum [h:A] f = f h`, REWRITE_TAC[Seq2.list_sum_cons; Seq2.list_sum_nil; REAL_ADD_RID]) and + LIST_SUM_A_CONS = prove(`list_sum (CONS (h:A) t) f = f h + list_sum t f`, REWRITE_TAC[Seq2.list_sum_cons]);; + + +let list_sum_conv f_conv tm = + let ltm, f_tm = dest_comb tm in + let list_tm = rand ltm in + let list_ty = type_of list_tm in + let f_ty = type_of f_tm in + let ty = (hd o snd o dest_type) list_ty in + let f_var = mk_var("f", f_ty) and + h_var = mk_var("h", ty) and + t_var = mk_var("t", list_ty) in + let inst_t = INST[f_tm, f_var] o INST_TYPE[ty, aty] in + let list_sum_h = inst_t LIST_SUM_A_H and + list_sum_cons = inst_t LIST_SUM_A_CONS in + + let rec list_sum_conv_raw = fun h_tm t_tm -> + if (is_comb t_tm) then + let h_tm', t_tm' = dest_comb t_tm in + let th0 = INST[h_tm, h_var; t_tm, t_var] list_sum_cons in + let ltm, rtm = dest_comb(rand(concl th0)) in + let plus_op, fh_tm = dest_comb ltm in + let f_th = f_conv fh_tm in + let th1 = list_sum_conv_raw (rand h_tm') t_tm' in + let th2 = MK_COMB(AP_TERM plus_op f_th, th1) in + TRANS th0 th2 + else + let th0 = INST[h_tm, h_var] list_sum_h in + let f_th = f_conv (rand(concl th0)) in + TRANS th0 f_th in + + if (is_comb list_tm) then + let h_tm, t_tm = dest_comb list_tm in + list_sum_conv_raw (rand h_tm) t_tm + else + inst_t LIST_SUM_A_EMPTY;; + + +(*********************************) +(* e_list conversions *) + +let eval_e_list_num = + let th0 = prove(`e_list (x:num,y:num) = y,x`, REWRITE_TAC[e_list]) in + fun d_tm -> + let ltm, y_tm = dest_comb d_tm in + let x_tm = rand ltm in + INST[x_tm, x_var_num; y_tm, y_var_num] th0;; + + +let e_list_conv_num tm = + let ltm, d_tm = dest_comb tm in + if ((fst o dest_const) ltm <> "e_list") then + failwith "e_list_conv_num: e_list expected" + else + eval_e_list_num d_tm;; + + +(*********************************) +(* list_pairs_conv *) +let RULE tm = prove(tm, REWRITE_TAC[list_pairs2]);; +let list_pairs2_0 = RULE `list_pairs2 [] (hd:num) = []` and + list_pairs2_1 = RULE `list_pairs2 [h1] (hd:num) = [h1,hd]` and + list_pairs2_2 = RULE `list_pairs2 (h1 :: h2 :: t) (hd:num) = (h1,h2) :: list_pairs2 (h2 :: t) hd`;; + +let RULE tm = prove(tm, REWRITE_TAC[list_pairs_eq_list_pairs2; list_pairs2_0; HD]);; +let list_pairs_empty = RULE `list_pairs ([]:(num)list) = []` and + list_pairs_cons = RULE `list_pairs ((h:num) :: t) = list_pairs2 (h :: t) h`;; + + +let list_pairs2_conv tm = + let ltm, hd_tm = dest_comb tm in + let rec list_pairs2_rec list = + if (is_comb list) then + let h_tm', t1_tm = dest_comb list in + let h1_tm = rand h_tm' in + if (is_comb t1_tm) then + let h_tm', t2_tm = dest_comb t1_tm in + let h2_tm = rand h_tm' in + let th0 = INST[h1_tm, h1_var_num; h2_tm, h2_var_num; t2_tm, t_var; hd_tm, hd_var_num] list_pairs2_2 in + let ltm = rator (rand (concl th0)) in + let th1 = list_pairs2_rec t1_tm in + TRANS th0 (AP_TERM ltm th1) + else + INST[h1_tm, h1_var_num; hd_tm, hd_var_num] list_pairs2_1 + else + INST[hd_tm, hd_var_num] list_pairs2_0 in + list_pairs2_rec (rand ltm);; + + +let eval_list_pairs list_tm = + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let th0 = INST[h_tm, h_var_num; t_tm, t_var] list_pairs_cons in + let th1 = list_pairs2_conv (rand (concl th0)) in + TRANS th0 th1 + else + list_pairs_empty;; + + +let list_pairs_conv = eval_list_pairs o rand;; + + + +(***********************************************) +(* list_of_faces_conv *) + +let LIST_OF_FACES_REWRITE_CONV = REWRITE_CONV[list_of_faces; MAP; list_pairs_eq_list_pairs2; list_pairs2; HD];; + +(* applies the given operation to the rhs of eq_th and returns op (lhs) = op (rhs) *) +let apply_op eq_th op = + let op_rhs = op (rand (concl eq_th)) in + let op_tm = (rator o lhand o concl) op_rhs in + TRANS (AP_TERM op_tm eq_th) op_rhs;; + + +let eval_list_of_faces = + let eq_th = prove(`list_of_faces (L:((num)list)list) = MAP list_pairs L`, REWRITE_TAC[list_of_faces]) in + fun tm -> + let th0 = INST[tm, l_cap_var] eq_th in + let rtm = (rand o concl) th0 in + let th1 = map_conv_univ list_pairs_conv rtm in + TRANS th0 th1;; + + +let filter_FILTER = prove(`filter = FILTER`, + REWRITE_TAC[FUN_EQ_THM] THEN GEN_TAC THEN + LIST_INDUCT_TAC THEN ASM_REWRITE_TAC[Seq.filter; FILTER]);; + +let eval_list_of_faces3, eval_list_of_faces4, eval_list_of_faces5, eval_list_of_faces6 = + let eq3_th = (MY_RULE_NUM o prove) + (`list_of_faces3 (L:((num)list)list) = FILTER (\f. LENGTH f = 3) (list_of_faces L)`, + REWRITE_TAC[list_of_faces3; filter_FILTER]) in + let eq4_th = (MY_RULE_NUM o prove) + (`list_of_faces4 (L:((num)list)list) = FILTER (\f. LENGTH f = 4) (list_of_faces L)`, + REWRITE_TAC[list_of_faces4; filter_FILTER]) in + let eq5_th = (MY_RULE_NUM o prove) + (`list_of_faces5 (L:((num)list)list) = FILTER (\f. LENGTH f = 5) (list_of_faces L)`, + REWRITE_TAC[list_of_faces5; filter_FILTER]) in + let eq6_th = (MY_RULE_NUM o prove) + (`list_of_faces6 (L:((num)list)list) = FILTER (\f. LENGTH f = 6) (list_of_faces L)`, + REWRITE_TAC[list_of_faces6; filter_FILTER]) in + let op3_tm = (rator o rand o concl) eq3_th in + let op4_tm = (rator o rand o concl) eq4_th in + let op5_tm = (rator o rand o concl) eq5_th in + let op6_tm = (rator o rand o concl) eq6_th in + let eval eq_th op_tm list_tm faces_th = + let th0 = INST[list_tm, l_cap_var] eq_th in + let th1 = AP_TERM op_tm faces_th in + let th2 = filter_conv_univ (BETA_CONV THENC LAND_CONV length_conv THENC raw_eq_hash_conv) (rand (concl th1)) in + TRANS th0 (TRANS th1 th2) in + (eval eq3_th op3_tm), + (eval eq4_th op4_tm), + (eval eq5_th op5_tm), + (eval eq6_th op6_tm);; + + +let eval_faces_of_list0 = + let th0 = ISPEC l_cap_var faces_of_list in + let op_tm = `MAP set_of_list : ((num#num)list)list->(num#num->bool)list` in + fun list_tm faces_th -> + let th1 = INST[list_tm, l_cap_var] th0 in + let th2 = AP_TERM op_tm faces_th in + let th3 = map_conv_univ set_of_list_conv ((rand o concl) th2) in + TRANS th1 (TRANS th2 th3);; + + +(* +let y = mk_comb (list_of_darts_const, test_list);; +test 100 LIST_OF_FACES_REWRITE_CONV y;; (* 0.224 *) +test 100 eval_list_of_faces test_list;; (* 0.104 *) +*) + +(*********************************) +(* list_of_darts *) + +let eval_list_of_darts0, eval_list_of_darts3, eval_list_of_darts4, + eval_list_of_darts5, eval_list_of_darts6 = + let eq0_th = prove(`list_of_darts (L:((num)list)list) = flatten (list_of_faces L)`, REWRITE_TAC[list_of_darts_alt]) in + let eq3_th = prove(`list_of_darts3 (L:((num)list)list) = flatten (list_of_faces3 L)`, REWRITE_TAC[list_of_darts3]) in + let eq4_th = prove(`list_of_darts4 (L:((num)list)list) = flatten (list_of_faces4 L)`, REWRITE_TAC[list_of_darts4]) in + let eq5_th = prove(`list_of_darts5 (L:((num)list)list) = flatten (list_of_faces5 L)`, REWRITE_TAC[list_of_darts5]) in + let eq6_th = prove(`list_of_darts6 (L:((num)list)list) = flatten (list_of_faces6 L)`, REWRITE_TAC[list_of_darts6]) in + let eval eq_th list_tm faces_th = + let th0 = INST[list_tm, l_cap_var] eq_th in + TRANS th0 (apply_op faces_th eval_flatten) in + (eval eq0_th), (eval eq3_th), (eval eq4_th), (eval eq5_th), (eval eq6_th);; + + +let eval_list_of_darts tm = + eval_list_of_darts0 tm (eval_list_of_faces tm);; + + +(* +test 100 eval_list_of_darts test_list;; (* 0.204 *) +*) + + +(************************************) +(* list_of_elements *) +let eval_list_of_elements = + let eq_th = prove(`list_of_elements (L:((num)list)list) = undup (flatten L)`, REWRITE_TAC[list_of_elements]) in + fun tm -> + let th0 = INST[tm, l_cap_var] eq_th in + TRANS th0 (apply_op (eval_flatten tm) (eval_undup_univ raw_eq_hash_conv));; + + +(* +test 100 eval_list_of_elements test_list;; (* 1.432 *) +*) + + +(******************************) +(* GOOD_LIST_CONV *) + +let GOOD_LIST_COND3_EMPTY = prove(`ALL (\d:num#num. MEM (SND d,FST d) list) [] <=> T`, REWRITE_TAC[ALL]) and + GOOD_LIST_COND3_CONS_T = (UNDISCH_ALL o prove)(`(MEM (y,x) list <=> T) ==> + (ALL (\d:num#num. MEM (SND d,FST d) list) (CONS (x,y) t) <=> + ALL (\d:num#num. MEM (SND d,FST d) list) t)`, SIMP_TAC[ALL]) and + GOOD_LIST_COND3_CONS_F = (UNDISCH_ALL o prove)(`(MEM (y,x) list <=> F) ==> + (ALL (\d:num#num. MEM (SND d,FST d) list) (CONS (x,y) t) <=> F)`, + SIMP_TAC[ALL]);; + + + +let rec good_list_cond3_conv tm = + let ltm, list_tm = dest_comb tm in + let f_tm = rand ltm in + let list2_tm = (rand o snd o dest_abs) f_tm in + if (is_comb list_tm) then + let h_tm, t_tm = dest_comb list_tm in + let x_tm, y_tm = dest_pair (rand h_tm) in + let inst = INST[list2_tm, list_var; x_tm, x_var_num; y_tm, y_var_num; t_tm, t_var_numnum_list] in + let mem_th = mem_num_pair_conv (mk_binop mem_const (mk_pair (y_tm, x_tm)) list2_tm) in + if (rand(concl mem_th) = t_const) then + let th0 = MY_PROVE_HYP mem_th (inst GOOD_LIST_COND3_CONS_T) in + let th1 = good_list_cond3_conv (rand (concl th0)) in + TRANS th0 th1 + else + MY_PROVE_HYP mem_th (inst GOOD_LIST_COND3_CONS_F) + else + INST[list2_tm, list_var] GOOD_LIST_COND3_EMPTY;; + + +let good_list_cond2_conv = + let th_T = prove(`(\l. ~(l = [])) ((h:num) :: t) <=> T`, REWRITE_TAC[NOT_CONS_NIL]) and + th_F = prove(`(\l. ~(l = [])) ([]:(num)list) <=> F`, REWRITE_TAC[]) in + let test_f tm = + let list_tm = rand tm in + if is_comb list_tm then + let h_tm', t_tm = dest_comb list_tm in + INST[rand h_tm', h_var_num; t_tm, t_var_num_list] th_T + else + th_F in + fun tm -> + all_conv_univ test_f tm;; + + + +let eval_good_list0 = + let good_th = (MY_RULE o prove)(`list_of_darts L = (list:(num#num)list) + /\ (uniq list <=> T) + /\ (ALL (\l. ~(l = [])) L <=> T) + /\ (ALL (\d. MEM (SND d,FST d) list) list <=> T) + ==> good_list L`, + SIMP_TAC[good_list; ALL_MEM; Seq2.ALL_all]) in + let cond2_tm = `ALL (\l:(num)list. ~(l = []))` in + let cond3_tm = `ALL (\d:num#num. MEM (SND d, FST d) list) list` in + fun tm darts_th -> + let darts_tm = (rand o concl) darts_th in + let th0 = INST[tm, l_cap_var; darts_tm, list_var] good_th in + let uniq_th = (eval_uniq_univ pair_eq_conv_num) darts_tm in + let cond2_th = good_list_cond2_conv (mk_comb (cond2_tm, tm)) in + let cond3_th = good_list_cond3_conv (subst[darts_tm, list_var] cond3_tm) in + (MY_PROVE_HYP darts_th o MY_PROVE_HYP uniq_th o MY_PROVE_HYP cond2_th o MY_PROVE_HYP cond3_th) th0;; + + +(* +let darts = eval_list_of_darts test_list;; +test 10 (eval_good_list0 test_list) darts;; (* 1.376 *) +*) + + +(*********************************) +(* split_list_hyp *) + +let one_eq = TO_NUM `1` and + two_tm = to_num `2` and + three_tm = to_num `3` and + three_lt_tm = to_num `(<) 3`;; + + +let split_list_hyp_empty = prove(`split_list_hyp [] (d:num#num) = []`, REWRITE_TAC[split_list_hyp]);; +let split_list_hyp_cons_F = (MY_RULE o prove)(`list_pairs h = list /\ (MEM d list <=> F) + ==> split_list_hyp (h :: t) d = h :: split_list_hyp t (d:num#num)`, SIMP_TAC[split_list_hyp]);; +let split_list_hyp_cons_T = (UNDISCH_ALL o PURE_ONCE_REWRITE_RULE[GSYM one_eq] o DISCH_ALL o MY_RULE_NUM o prove) + (`list_pairs h = list /\ (MEM (d:num#num) list <=> T) /\ (3 < LENGTH h <=> T) + /\ indexl d list = i /\ rotr 1 (rot i h) = r /\ take 3 r = s1 /\ dropl 2 r = s2 /\ HD r = h1 + ==> split_list_hyp (h :: t) d = s1 :: (h1 :: s2) :: t`, + SIMP_TAC[split_list_hyp; split_list_face] THEN + STRIP_TAC THEN REPLICATE_TAC 3 (POP_ASSUM (fun th -> ALL_TAC)) THEN + POP_ASSUM (fun th -> REWRITE_TAC[GSYM th]) THEN + REWRITE_TAC[Seq.size_rotr; Seq.size_rot; Seq.size] THEN + ASM_REWRITE_TAC[ARITH_RULE `a <= 3 <=> ~(3 < a)`] THEN + REWRITE_TAC[Seq.cat]);; + + +let rec eval_split_list_hyp tm d_tm = + if not (is_comb tm) then + INST[d_tm, d_var_pair] split_list_hyp_empty + else + let h_tm', t_tm = dest_comb tm in + let h_tm = rand h_tm' in + let pairs_th = eval_list_pairs h_tm in + let list_tm = (rand o concl) pairs_th in + let mem_th = eval_mem_num_pair d_tm list_tm in + if (rand (concl mem_th) = f_const) then + let th0 = (MY_PROVE_HYP pairs_th o MY_PROVE_HYP mem_th o + INST[d_tm, d_var_pair; t_tm, t_var_list_list; h_tm, h_var_list; list_tm, list_var]) + split_list_hyp_cons_F in + let ltm = (rator o rand o concl) th0 in + let th1 = eval_split_list_hyp t_tm d_tm in + TRANS th0 (AP_TERM ltm th1) + else + let size_th = eval_length h_tm in + let size_lt0 = AP_TERM three_lt_tm size_th in + let size_lt1 = raw_lt_hash_conv ((rand o concl) size_lt0) in + if (rand (concl size_lt1) = f_const) then + failwith "eval_split_list_hyp: size (face) <= 3" + else + let size_lt_th = TRANS size_lt0 size_lt1 in + let i_th = eval_index_univ pair_eq_conv_num d_tm list_tm in + let i_tm = (rand o concl) i_th in + let r_th = apply_op (eval_rot i_tm h_tm) eval_rotr1 in + let r_tm = (rand o concl) r_th in + let hd_th = eval_hd r_tm in + let h1_tm = (rand o concl) hd_th in + let take_th = eval_take three_tm r_tm in + let s1_tm = (rand o concl) take_th in + let drop_th = eval_drop two_tm r_tm in + let s2_tm = (rand o concl) drop_th in + (MY_PROVE_HYP i_th o MY_PROVE_HYP hd_th o MY_PROVE_HYP pairs_th o + MY_PROVE_HYP take_th o MY_PROVE_HYP r_th o MY_PROVE_HYP drop_th o + MY_PROVE_HYP mem_th o MY_PROVE_HYP size_lt_th o + INST[h_tm, h_var_list; list_tm, list_var; h1_tm, h1_var_num; + d_tm, d_var_pair; r_tm, r_var_list; i_tm, i_var_num; t_tm, t_var_list_list; + s1_tm, s1_var_list; s2_tm, s2_var_list]) + split_list_hyp_cons_T;; + + +(* +let tm = test_list;; +let d_tm = to_num `7,0`;; + +(* 0.152 *) +test 100 (eval_split_list_hyp tm) d_tm;; +*) + + +(*********************************) +(* list_of_nodes *) + +let filter_nodes_empty = prove(`filter (\d:num#num. FST d = x) [] = []`, REWRITE_TAC[Seq.filter]);; +let filter_nodes_cons_eq = (MY_RULE o prove)(`(n = x <=> T) ==> filter (\d:num#num. FST d = x) (CONS (n,m) t) = + CONS (n,m) (filter (\d. FST d = x) t)`, SIMP_TAC[Seq.filter]);; +let filter_nodes_cons_neq = (MY_RULE o prove)(`(n = x <=> F) ==> filter (\d:num#num. FST d = x) (CONS (n,m) t) = + filter (\d. FST d = x) t`, SIMP_TAC[Seq.filter]);; + +let rec eval_filter_nodes x_tm list_tm = + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let n_tm, m_tm = dest_pair h_tm in + let inst = INST[n_tm, n_var_num; m_tm, m_var_num; t_tm, t_var_numnum_list; x_tm, x_var_num] in + let eq_th = raw_eq_hash_conv (mk_eq (n_tm, x_tm)) in + if (rand (concl eq_th) = t_const) then + let th0 = MY_PROVE_HYP eq_th (inst filter_nodes_cons_eq) in + let ltm = (rator o rand o concl) th0 in + let th1 = eval_filter_nodes x_tm t_tm in + TRANS th0 (AP_TERM ltm th1) + else + let th0 = MY_PROVE_HYP eq_th (inst filter_nodes_cons_neq) in + let th1 = eval_filter_nodes x_tm t_tm in + TRANS th0 th1 + else + INST[x_tm, x_var_num] filter_nodes_empty;; + + +let filter_nodes_conv filter_tm = + let ltm, list_tm = dest_comb filter_tm in + let x_tm = (rand o snd o dest_abs o rand) ltm in + eval_filter_nodes x_tm list_tm;; + + +(* +let x_tm = to_num `11`;; +let list_tm = (rand o concl o eval_list_of_darts) test_list;; + +(* 10: 0.396 *) +test 100 (eval_filter_nodes x_tm) list_tm;; +*) + + +let eval_list_of_nodes0 = + let th0 = (MY_RULE o prove)(`list_of_darts L = list /\ list_of_elements L = (s1:(num)list) + ==> list_of_nodes L = MAP (\x. filter (\d. FST d = x) list) s1`, SIMP_TAC[list_of_nodes]) in + fun tm darts_th elements_th -> + let list_tm = (rand o concl) darts_th in + let s1_tm = (rand o concl) elements_th in + let th1 = (MY_PROVE_HYP darts_th o MY_PROVE_HYP elements_th o + INST[list_tm, list_var; s1_tm, s1_var_list; tm, l_cap_var]) th0 in + let rtm = rand (concl th1) in + let map_th = map_conv_univ (BETA_CONV THENC filter_nodes_conv) rtm in + TRANS th1 map_th;; + + +let eval_nodes_of_list0 = + let th0 = ISPEC l_cap_var nodes_of_list in + let op_tm = `MAP set_of_list : ((num#num)list)list->(num#num->bool)list` in + fun list_tm nodes_th -> + let th1 = INST[list_tm, l_cap_var] th0 in + let th2 = AP_TERM op_tm nodes_th in + let th3 = map_conv_univ set_of_list_conv ((rand o concl) th2) in + TRANS th1 (TRANS th2 th3);; + + + +let eval_list_of_nodes tm = + eval_list_of_nodes0 tm (eval_list_of_darts tm) (eval_list_of_elements tm);; + + +(* +let darts_th = eval_list_of_darts test_list;; +let elements_th = eval_list_of_elements test_list;; +(* 10: 0.528 *) +test 10 (eval_list_of_nodes0 test_list darts_th) elements_th;; +*) + + +let build_table_of_nodes hyp_list nodes_th = + let table_of_nodes = Hashtbl.create 100 in + let th0 = (UNDISCH_ALL o ISPEC hyp_list) nodes_hypermap_of_list_all in + let all_tm = rator (concl th0) in + let th1 = EQ_MP (AP_TERM all_tm nodes_th) th0 in + let th1_list = get_all th1 in + let build1 th = + let th = MY_BETA_RULE th in + let list_tm = dest_list(rand(concl th)) in + let ths = get_all th in + let r = CONV_RULE (BETA_CONV THENC RAND_CONV set_of_list_conv) in + map (fun tm, th -> Hashtbl.add table_of_nodes (num_pair_hash tm) (r th)) (zip list_tm ths) in + let _ = map build1 th1_list in + table_of_nodes;; + + +(* +let nodes_th = eval_list_of_nodes test_list;; +(* 10: 0.156 *) +test 10 (build_table_of_nodes test_list) nodes_th;; +*) + +(***************************) +(* table of faces *) + +let build_table_of_faces hyp_list good_list_th faces_th = + let table_of_faces = Hashtbl.create 100 and + table_of_find_face = Hashtbl.create 100 in + let th0 = (MY_PROVE_HYP good_list_th o UNDISCH_ALL o ISPEC hyp_list) faces_hypermap_of_list_all in + let all_tm = rator (concl th0) in + let th1 = EQ_MP (AP_TERM all_tm faces_th) th0 in + let th1_list = get_all th1 in + let build1 th = + let th = MY_BETA_RULE th in + let list_tm = dest_list(rand(concl th)) in + let ths = get_all th in + map (fun tm, th -> + let th1, th2 = (CONJ_PAIR o CONV_RULE BETA_CONV) th in + let th1_2 = CONV_RULE (RAND_CONV set_of_list_conv) th1 in + let hash = num_pair_hash tm in + Hashtbl.add table_of_faces hash th1_2; + Hashtbl.add table_of_find_face hash th2) (zip list_tm ths) in + let _ = map build1 th1_list in + table_of_faces, table_of_find_face;; + +(* +let faces_th = eval_list_of_faces test_list;; +let darts_th = eval_list_of_darts0 test_list faces_th;; +let good_list_th = eval_good_list0 test_list darts_th;; +let table1, table2 = build_table_of_faces test_list good_th faces_th;; +Hashtbl.find table1 "D7,D2D1";; +Hashtbl.find table2 "D7,D2D1";; +(* 10: 0.241 *) +test 10 (build_table_of_faces test_list good_th) faces_th;; +*) + + +(*****************************) +(* f_list_ext tables *) + +let list_to_pair list = hd list, hd(tl list);; + +let F_LIST_EXT_SINGLE, INV_F_LIST_EXT_SINGLE = (list_to_pair o CONJUNCTS o MY_RULE o prove) + (`f_list_ext_table L [h1] (x:num#num) + ==> f_list_ext L h1 = x /\ + inverse (f_list_ext L) x = h1`, SIMP_TAC[f_list_ext_table]);; + +let F_LIST_EXT_CONS, INV_F_LIST_EXT_CONS = (list_to_pair o CONJUNCTS o MY_RULE o prove) + (`f_list_ext_table L (h1 :: h2 :: t) (x:num#num) + ==> f_list_ext L h1 = h2 /\ + inverse (f_list_ext L) h2 = h1`, SIMP_TAC[f_list_ext_table]);; + +let F_LIST_EXT_TABLE_CONS = (MY_RULE o prove) + (`f_list_ext_table L (h1 :: t) (x:num#num) ==> f_list_ext_table L t x`, + DISJ_CASES_TAC (ISPEC `t:(num#num)list` list_CASES) THENL + [ + ASM_REWRITE_TAC[f_list_ext_table]; + POP_ASSUM STRIP_ASSUME_TAC THEN + ASM_SIMP_TAC[f_list_ext_table] + ]);; + + +let f_list_ext_table_all th = + let ltm, x_tm = dest_comb(concl th) in + let ltm, list_tm = dest_comb ltm in + let l_tm = rand ltm in + let inst_t = INST[x_tm, x_var_pair] in + let f_single, inv_f_single = inst_t F_LIST_EXT_SINGLE, inst_t INV_F_LIST_EXT_SINGLE in + let f_cons, inv_f_cons = inst_t F_LIST_EXT_CONS, inst_t INV_F_LIST_EXT_CONS in + let f_table = inst_t F_LIST_EXT_TABLE_CONS in + + let rec f_list_raw f_table_th h1_tm t1_tm = + if (is_comb t1_tm) then + let h2_tm', t2_tm = dest_comb t1_tm in + let h2_tm = rand h2_tm' in + let inst_t = MY_PROVE_HYP f_table_th o + INST[l_tm, l_cap_var; h1_tm, h1_var_pair; h2_tm, h2_var_pair; t2_tm, t_var_numnum_list] in + + let f_th, inv_f_th = inst_t f_cons, inst_t inv_f_cons in + let th0 = (MY_PROVE_HYP f_table_th o INST[l_tm, l_cap_var; h1_tm, h1_var_pair; t1_tm, t_var_numnum_list]) f_table in + let f_list, inv_f_list = f_list_raw th0 h2_tm t2_tm in + (h1_tm, f_th) :: f_list, (h2_tm, inv_f_th) :: inv_f_list + + else + let inst_t = MY_PROVE_HYP f_table_th o INST[l_tm, l_cap_var; h1_tm, h1_var_pair] in + let f_th, inv_f_th = inst_t f_single, inst_t inv_f_single in + [h1_tm, f_th], [x_tm, inv_f_th] in + + if (is_comb list_tm) then + let h1_tm, t1_tm = dest_comb list_tm in + f_list_raw th (rand h1_tm) t1_tm + else + [], [];; + + +let build_f_list_ext_table = + let th0' = (UNDISCH_ALL o ISPEC l_cap_var) f_list_ext_table_list_of_faces in + fun hol_list good_list_th faces_th -> + let f_table, inv_f_table = Hashtbl.create 100, Hashtbl.create 100 in + let th0 = (MY_PROVE_HYP good_list_th o INST[hol_list, l_cap_var]) th0' in + let all_tm = rator (concl th0) in + let th1 = EQ_MP (AP_TERM all_tm faces_th) th0 in + let th1_list = get_all th1 in + + let step th = + let th = MY_BETA_RULE th in + let ltm, rtm = dest_comb(concl th) in + let first_th = hd_conv rtm in + let f_table_th = EQ_MP (AP_TERM ltm first_th) th in + let f_list, inv_f_list = f_list_ext_table_all f_table_th in + let _ = map (fun tm, th -> Hashtbl.add f_table (num_pair_hash tm) th) f_list in + let _ = map (fun tm, th -> Hashtbl.add inv_f_table (num_pair_hash tm) th) inv_f_list in + () in + + let _ = map step th1_list in + f_table, inv_f_table;; + + +(* +let faces_th = eval_list_of_faces test_list;; +let darts_th = eval_list_of_darts0 test_list faces_th;; +let good_th = eval_good_list0 test_list darts_th;; +let ft, ift = build_f_list_ext_table test_list good_th faces_th;; +Hashtbl.find ft "D7,D2D1";; +Hashtbl.find ift "D7,D2D1";; +(* 10: 0.056 *) +test 10 (build_f_list_ext_table test_list good_th) faces_th;; +*) + + +(**************************************) +(* compute_all *) + +let compute_all hyp_list good_th_opt = + let thm_table = Hashtbl.create 10 in + let fun_table = Hashtbl.create 10 in + let faces_th = eval_list_of_faces hyp_list in + let darts_th = eval_list_of_darts0 hyp_list faces_th in + let good_th = + match good_th_opt with + | Some th -> th + | None -> eval_good_list0 hyp_list darts_th in + let add = fun str thm -> Hashtbl.add thm_table str thm in + let add_fun = fun str table -> Hashtbl.add fun_table str table in + let _ = + add "good_list" good_th; + add "list_of_darts" darts_th; + add "list_of_faces" faces_th in + + let rec hyp_set name = + try Hashtbl.find thm_table name + with Not_found -> + (match name with + | "list_of_darts3" -> + let faces3_th = eval_list_of_faces3 hyp_list faces_th in + let darts3_th = eval_list_of_darts3 hyp_list faces3_th in + let _ = add "list_of_darts3" darts3_th in + darts3_th + | "list_of_darts4" -> + let faces4_th = eval_list_of_faces4 hyp_list faces_th in + let darts4_th = eval_list_of_darts4 hyp_list faces4_th in + let _ = add "list_of_darts4" darts4_th in + darts4_th + | "list_of_darts5" -> + let faces5_th = eval_list_of_faces5 hyp_list faces_th in + let darts5_th = eval_list_of_darts5 hyp_list faces5_th in + let _ = add "list_of_darts5" darts5_th in + darts5_th + | "list_of_darts6" -> + let faces6_th = eval_list_of_faces6 hyp_list faces_th in + let darts6_th = eval_list_of_darts6 hyp_list faces6_th in + let _ = add "list_of_darts6" darts6_th in + darts6_th + | "list_of_elements" -> + let elements_th = eval_list_of_elements hyp_list in + let _ = add "list_of_elements" elements_th in + elements_th + | "list_of_nodes" -> + let nodes_th = eval_list_of_nodes0 hyp_list darts_th (hyp_set "list_of_elements") in + let _ = add "list_of_nodes" nodes_th in + nodes_th + | "nodes_of_list" -> + let set_nodes_th = eval_nodes_of_list0 hyp_list (hyp_set "list_of_nodes") in + let _ = add "nodes_of_list" set_nodes_th in + set_nodes_th + | "faces_of_list" -> + let set_faces_th = eval_faces_of_list0 hyp_list (hyp_set "list_of_faces") in + let _ = add "faces_of_list" set_faces_th in + set_faces_th + | _ -> failwith ("Bad hypermap set: " ^ name)) in + + let hyp_fun name dart_tm = + let table = + try Hashtbl.find fun_table name + with Not_found -> + (match name with + | "face" -> + let table_of_faces, table_of_find_face = build_table_of_faces hyp_list good_th faces_th in + let _ = add_fun "face" table_of_faces in + let _ = add_fun "find_face" table_of_find_face in + table_of_faces + | "find_face" -> + let table_of_faces, table_of_find_face = build_table_of_faces hyp_list good_th faces_th in + let _ = add_fun "face" table_of_faces in + let _ = add_fun "find_face" table_of_find_face in + table_of_find_face + | "node" -> + let table_of_nodes = build_table_of_nodes hyp_list (hyp_set "list_of_nodes") in + let _ = add_fun "node" table_of_nodes in + table_of_nodes + | "f_list_ext" | "inverse" -> + let f_table, inv_f_table = build_f_list_ext_table hyp_list good_th faces_th in + let _ = add_fun "f_list_ext" f_table in + let _ = add_fun "inverse" inv_f_table in + if name = "inverse" then inv_f_table else f_table + | _ -> failwith ("Bad hypermap function: " ^ name)) in + try Hashtbl.find table (num_pair_hash dart_tm) + with Not_found -> failwith ("Bad dart index: " ^ num_pair_hash dart_tm) in + + hyp_set, hyp_fun;; + + +let add_eq eq1_th eq2_th = + let th0 = MK_COMB (AP_TERM add_op_num eq1_th, eq2_th) in + let r_th = raw_add_conv_hash (rand (concl th0)) in + TRANS th0 r_th;; + +let mul_eq eq1_th eq2_th = + let th0 = MK_COMB (AP_TERM mul_op_num eq1_th, eq2_th) in + let r_th = raw_mul_conv_hash (rand (concl th0)) in + TRANS th0 r_th;; + +let eq_eq eq1_th eq2_th = + let th0 = MK_COMB (AP_TERM eq_op_num eq1_th, eq2_th) in + let r_th = raw_eq_hash_conv (rand (concl th0)) in + TRANS th0 r_th;; + + +let eval_good_list_nodes_condition0 = + let two = to_num `2` and + four = to_num `4` in + fun elements_th darts_th faces_th -> + let length_darts = apply_op darts_th eval_length and + length_faces = apply_op faces_th eval_length and + length_elements = apply_op elements_th eval_length in + (* 2 * (sizel (list_of_elements L) + sizel (list_of_faces L)) = sizel (list_of_darts L) + 4 *) + let (+), ( * ), (!), (==) = add_eq, mul_eq, REFL, eq_eq in + (!two * (length_elements + length_faces)) == (length_darts + !four);; + +let eval_good_list_nodes_condition hyp_set = + eval_good_list_nodes_condition0 (hyp_set "list_of_elements") (hyp_set "list_of_darts") (hyp_set "list_of_faces");; + + +end;; + +(* +open List_hypermap_computations;; + +let t1, t2 = compute_all test_list None;; +(* 10: 2.635 *) +test 10 (compute_all test_list) None;; + +num_pair_hash (to_num `1,0`);; +t2 "node" (to_num `0,1`);; +*) diff --git a/formal_lp/hypermap/computations/more_theory-compiled.hl b/formal_lp/hypermap/computations/more_theory-compiled.hl new file mode 100644 index 0000000..fdac99c --- /dev/null +++ b/formal_lp/hypermap/computations/more_theory-compiled.hl @@ -0,0 +1,294 @@ +needs "../formal_lp/hypermap/ssreflect/list_hypermap-compiled.hl";; +needs "../formal_lp/hypermap/ssreflect/list_hypermap_iso-compiled.hl";; + +(* Module More_list_hypermap*) +module More_list_hypermap = struct + +open Ssrbool;; +open Ssrnat;; +open Seq;; +open Sphere;; +open List_hypermap;; +open Hypermap;; +open Hypermap_and_fan;; +open Hypermap_iso;; +open Tame_general;; +let list_pairs2 = (GEN_ALL o define) + `list_pairs2 [] (hd:A) = [] /\ + list_pairs2 [h] hd = [h,hd] /\ + list_pairs2 (h1 :: (h2 :: t)) hd = (h1,h2) :: (list_pairs2 (h2 :: t) hd)`;; + +(* Lemma size_list_pairs2 *) +let size_list_pairs2 = Sections.section_proof ["x";"s"] +`sizel (list_pairs2 s x) = sizel s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN ((THENL) case [ALL_TAC; ((move ["h2"]) THEN (move ["t"]))]) THEN (move ["Ih"]))]) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("list_pairs2", [list_pairs2]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("size_nil", [size_nil]))(fun tmp_arg1 -> (use_arg_then2 ("size_cons", [size_cons]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_list_pairs2 *) +let nth_list_pairs2 = Sections.section_proof ["x0";"x";"s";"i"] +`i < sizel s + ==> nth (x0,x0) (list_pairs2 s x) i = + nth x0 s i, if i = sizel s - 1 then x else nth x0 s (i + 1)` +[ + (((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN ((THENL) case [ALL_TAC; ((move ["h2"]) THEN (move ["t"]))]) THEN (move ["Ih"]))]) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("list_pairs2", [list_pairs2]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("size_nil", [size_nil]))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("size_cons", [size_cons]))(fun tmp_arg1 -> (use_arg_then2 ("ltn0", [ltn0]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (BETA_TAC THEN (move ["i"]) THEN (move ["i_lt"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`i = 0`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("subnn", [subnn]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL_FIRST) ((THENL) case [ALL_TAC; (move ["i"])]) (((((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_SUC", [NOT_SUC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + (((((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqSS", [eqSS]))(thm_tac (new_rewrite [] []))))) THEN (move ["i_lt"])); + (((((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addSn", [addSn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_pairs_eq_list_pairs2 *) +let list_pairs_eq_list_pairs2 = Sections.section_proof ["s"] +`list_pairs s = list_pairs2 s (HD s)` +[ + ((fun arg_tac -> (use_arg_then2 ("eq_from_nth", [eq_from_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`HD s,HD s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac)); + (((((use_arg_then2 ("size_list_pairs", [size_list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_list_pairs2", [size_list_pairs2]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["i"]) THEN (move ["i_lt"])); + ((((use_arg_then2 ("nth_list_pairs", [nth_list_pairs]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("nth_list_pairs2", [nth_list_pairs2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`i = _`))) (disch_tac [])) THEN case THEN (simp_tac)); + (((((use_arg_then2 ("nth0", [nth0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Seq2.head_HD", [Seq2.head_HD]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma node_hypermap_of_list_explicit *) +let node_hypermap_of_list_explicit = Sections.section_proof ["L";"n";"d"] +`good_list_nodes L /\ + MEM n (list_of_nodes L) /\ MEM d n + ==> node (hypermap_of_list L) d = set_of_list n` +[ + ((((use_arg_then2 ("good_list_nodes", [good_list_nodes]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["eq"])) THEN (case THEN (move ["mem_n"])) THEN (move ["mem_d"])); + ((fun arg_tac -> arg_tac (Arg_term (`set_of_list n IN node_set (hypermap_of_list L)`))) (term_tac (have_gen_tac []ALL_TAC))); + (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nodes_of_list", [nodes_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM_MAP", [MEM_MAP]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("n", [])) (term_tac exists_tac)) THEN (done_tac)); + ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_node_representation", [lemma_node_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN (move ["_"])) THEN (move ["eq2"])); + (((((use_arg_then2 ("eq2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("lemma_node_identity", [lemma_node_identity])) (thm_tac apply_tac))); + (((((use_arg_then2 ("eq2", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nodes_hypermap_of_list_all *) +let nodes_hypermap_of_list_all = Sections.section_proof ["L"] +`good_list_nodes L + ==> ALL (\n. ALL (\d. node (hypermap_of_list L) d = set_of_list n) n) (list_of_nodes L)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("ALL_MEM", [ALL_MEM]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("node_hypermap_of_list_explicit", [node_hypermap_of_list_explicit])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["eq"]) THEN (move ["n"]) THEN (move ["mem_n"]) THEN (simp_tac) THEN (move ["d"]) THEN (move ["mem_d"])); + ((((fun arg_tac -> (use_arg_then2 ("eq", [])) (fun fst_arg -> (use_arg_then2 ("mem_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma face_hypermap_of_list_explicit *) +let face_hypermap_of_list_explicit = Sections.section_proof ["L";"f";"d"] +`good_list L /\ + MEM f (list_of_faces L) /\ MEM d f + ==> face (hypermap_of_list L) d = set_of_list f` +[ + ((BETA_TAC THEN (case THEN (move ["goodL"])) THEN (case THEN (move ["mem_f"])) THEN (move ["mem_d"])) THEN (((use_arg_then2 ("goodL", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["uniqL"])) THEN (move ["_"]))); + ((fun arg_tac -> arg_tac (Arg_term (`MEM d (list_of_darts L)`))) (term_tac (have_gen_tac [](move ["mem_d2"])))); + (((((use_arg_then2 ("list_of_darts_alt", [list_of_darts_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Seq2.mem_flatten", [Seq2.mem_flatten]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("f", [])) (term_tac exists_tac)) THEN (done_tac)); + (((((use_arg_then2 ("face_of_list", [face_of_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((congr_tac (`_1 _2`)) THEN (simp_tac))); + ((((use_arg_then2 ("find_face_eq", [find_face_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma faces_hypermap_of_list_all *) +let faces_hypermap_of_list_all = Sections.section_proof ["L"] +`good_list L + ==> ALL (\f. ALL (\d. face (hypermap_of_list L) d = set_of_list f + /\ find_face L d = f) f) (list_of_faces L)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("ALL_MEM", [ALL_MEM]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["goodL"]) THEN (move ["f"]) THEN (move ["mem_f"]) THEN (simp_tac) THEN (move ["d"]) THEN (move ["mem_d"])); + ((((fun arg_tac -> (use_arg_then2 ("face_hypermap_of_list_explicit", [face_hypermap_of_list_explicit])) (fun fst_arg -> (use_arg_then2 ("mem_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("find_face_eq", [find_face_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("goodL", [])) (disch_tac [])) THEN (clear_assumption "goodL") THEN BETA_TAC) THEN ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN (move ["goodL"])) THEN ((((use_arg_then2 ("goodL", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("list_of_darts_alt", [list_of_darts_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Seq2.mem_flatten", [Seq2.mem_flatten]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("f", [])) (term_tac exists_tac)) THEN (done_tac)); +];; +let f_list_ext_table = (GEN_ALL o define) + `(f_list_ext_table L [] (first:A#A) <=> T) + /\ (f_list_ext_table L (CONS h1 (CONS h2 t)) first + <=> f_list_ext L h1 = h2 + /\ inverse (f_list_ext L) h2 = h1 + /\ f_list_ext_table L (CONS h2 t) first) + /\ (f_list_ext_table L [h1] first + <=> f_list_ext L h1 = first + /\ inverse (f_list_ext L) first = h1)`;; + +(* Lemma f_list_ext_table_list_of_faces *) +let f_list_ext_table_list_of_faces = Sections.section_proof ["L"] +`good_list L + ==> ALL (\f. f_list_ext_table L f (HD f)) (list_of_faces L)` +[ + ((BETA_TAC THEN (move ["goodL"])) THEN (((use_arg_then2 ("goodL", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["uniqL"])) THEN (move ["_"]))); + (((((use_arg_then2 ("Seq2.ALL_all", [Seq2.ALL_all]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["f"]) THEN (simp_tac) THEN (move ["mem_f"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mem_face_lemma", [mem_face_lemma])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("mem_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["d"]) THEN (case THEN ((move ["mem_d"]) THEN (move ["f_eq"]))))))); + ((fun arg_tac -> arg_tac (Arg_term (`0 < sizel f`))) (term_tac (have_gen_tac [](move ["f_size"])))); + ((THENL_LAST) ((THENL) (((use_arg_then2 ("f_eq", [])) (disch_tac [])) THEN (clear_assumption "f_eq") THEN ((use_arg_then2 ("f", [])) (disch_tac [])) THEN (clear_assumption "f") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]))]) (((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("gtS0", [gtS0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_face_empty", [find_face_empty]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`f = s1 ++ [x] ++ s2 /\ f_list_ext_table L s2 (HD f) + ==> f_list_ext_table L (x :: s2) (HD f)`))) (term_tac (have_gen_tac ["s2"; "s1"; "x"](move ["h"])))); + (BETA_TAC THEN (case THEN (move ["f_eq_cat"]))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`MEM x f`))) (term_tac (have_gen_tac [](move ["mem_xf"])))) (((((use_arg_then2 ("f_eq_cat", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_seq1", [mem_seq1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`find_face L x = f`))) (term_tac (have_gen_tac [](move ["fx_eq"])))); + ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mem_find_face_imp_faces_eq", [mem_find_face_imp_faces_eq])) (fun fst_arg -> (use_arg_then2 ("uniqL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`MEM x (list_of_darts L)`))) (term_tac (have_gen_tac [](move ["mem_x"])))); + (((use_arg_then2 ("dart_in_darts", [dart_in_darts])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`find_pair_list L d`))) (term_tac exists_tac))); + (((((use_arg_then2 ("find_face_alt", [find_face_alt]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_find_pair_list", [mem_find_pair_list]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((THENL) (((use_arg_then2 ("f_eq_cat", [])) (disch_tac [])) THEN (clear_assumption "f_eq_cat") THEN ((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN case) [ALL_TAC; ((move ["h2"]) THEN (move ["t"]))]) THEN (move ["f_eq_cat"]) THEN (move ["Ih"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("f_list_ext_table", [f_list_ext_table]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`f_list_ext L x = (HD f)`))) (term_tac (have_gen_tac [](move ["eq"]))))); + (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`inverse _`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_list_ext_inverse_works", [f_list_ext_inverse_works]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("f_list_ext", [f_list_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_x", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("f_list", [f_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fx_eq", []))(thm_tac (new_rewrite [] []))))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`x = last (HD f) f`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + (((((use_arg_then2 ("Seq2.next_el_last", [Seq2.next_el_last]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_size", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("uniq_find_face", [uniq_find_face]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("f_eq_cat", []))(thm_tac (new_rewrite [2] [])))) THEN (((use_arg_then2 ("cats0", [cats0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cats1", [cats1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("last_rcons", [last_rcons]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`f_list_ext L x = h2`))) (term_tac (have_gen_tac [](move ["eq"]))))); + (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`inverse _`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_list_ext_inverse_works", [f_list_ext_inverse_works]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("f_list_ext", [f_list_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_list", [f_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_x", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((fun arg_tac -> (use_arg_then2 ("Seq2.next_el_rot_eq", [Seq2.next_el_rot_eq])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sizel s1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uniq_find_face", [uniq_find_face]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fx_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq_cat", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("drop_size_cat", [drop_size_cat]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("cat1s", [cat1s]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Seq2.next_el_hd_cons2", [Seq2.next_el_hd_cons2]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`\k. ?s1 x s2. f = s1 ++ [x] ++ s2 /\ sizel s1 = k /\ f_list_ext_table L s2 (HD f)`))) (term_tac (set_tac "P"))); + ((fun arg_tac -> arg_tac (Arg_term (`?n. P n`))) (term_tac (have_gen_tac []ALL_TAC))); + (((fun arg_tac -> arg_tac (Arg_term (`sizel f - 1`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("P_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`butlast f`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`last (HD f) f`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`[]`))) (term_tac exists_tac))); + (((((use_arg_then2 ("f_list_ext_table", [f_list_ext_table]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Seq2.size_butlast", [Seq2.size_butlast]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cats0", [cats0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Seq2.cat_butlast_last", [Seq2.cat_butlast_last]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("MINIMAL", [MINIMAL]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["Pk"])) THEN (move ["Pm"])); + ((fun arg_tac -> arg_tac (Arg_term (`(minimal) P`))) (term_tac (set_tac "k"))); + ((((use_arg_then2 ("Pk", [])) (disch_tac [])) THEN (clear_assumption "Pk") THEN BETA_TAC) THEN (((((use_arg_then2 ("P_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["s1"])) THEN (case THEN (move ["x"])) THEN (case THEN (move ["s2"])) THEN (case THEN (move ["f_eq"])) THEN (case THEN (move ["size_s1"])) THEN (move ["h_s2"]))); + (((fun arg_tac -> arg_tac (Arg_term (`k = 0`))) (disch_eq_tac "k_eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((use_arg_then2 ("size_s1", [])) (disch_tac [])) THEN (clear_assumption "size_s1") THEN BETA_TAC) THEN (((((use_arg_then2 ("k_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_eq0", [size_eq0]))(thm_tac (new_rewrite [] []))))) THEN (move ["s1_eq"]))); + (((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("s1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat1s", [cat1s]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("f_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`P (k - 1)`))) (term_tac (have_gen_tac []ALL_TAC)))) (((((use_arg_then2 ("Pm", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("k_eq", [])) (disch_tac [])) THEN (clear_assumption "k_eq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("P_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`butlast s1`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`last (HD f) s1`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`x :: s2`))) (term_tac exists_tac))); + ((((use_arg_then2 ("Seq2.size_butlast", [Seq2.size_butlast]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_s1", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("f_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); + ((((use_arg_then2 ("catA", [catA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Seq2.cat_butlast_last", [Seq2.cat_butlast_last]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("cat1s", [cat1s]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_s1", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("k_eq", [])) (disch_tac [])) THEN (clear_assumption "k_eq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Section Contravening *) +Sections.begin_section "Contravening";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("L", (`:((num)list)list`))));; +(Sections.add_section_var (mk_var ("h", (`:num->real^3`))));; +(Sections.add_section_var (mk_var ("g", (`:num#num->real^3#real^3`))));; + +(* Lemma mem_list_of_darts_imp_mem_list_of_elements *) +let mem_list_of_darts_imp_mem_list_of_elements = Sections.section_proof ["a";"b"] +`MEM (a,b) (list_of_darts L) + ==> MEM a (list_of_elements L) /\ MEM b (list_of_elements L)` +[ + ((((use_arg_then2 ("mem_list_of_darts", [mem_list_of_darts]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["l"])) THEN (case THEN (move ["mem_l"])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("mem_list_pairs", [mem_list_pairs])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["mem_ab"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("list_of_elements", [list_of_elements]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mem_undup", [mem_undup]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("Seq2.mem_flatten", [Seq2.mem_flatten]))(thm_tac (new_rewrite [] [])))))); + ((split_tac) THEN ((use_arg_then2 ("l", [])) (term_tac exists_tac)) THEN (done_tac)); +];; +(Sections.add_section_hyp "contrV" (`contravening V`));; + +(* Let fanV *) +Sections.add_section_lemma "fanV" (Sections.section_proof [] +`FAN (vec 0,V,ESTD V)` +[ + ((((use_arg_then2 ("CONTRAVENING_FAN", [CONTRAVENING_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Section Norm *) +Sections.begin_section "Norm";; +(Sections.add_section_hyp "bij_h" (`BIJ h (elements_of_list L) V`));; + +(* Lemma contravening_norm_le *) +let contravening_norm_le = Sections.section_proof [] +`ALL (\x. norm (h x) <= #2.52) (list_of_elements L)` +[ + ((((use_arg_then2 ("bij_h", [])) (disch_tac [])) THEN (clear_assumption "bij_h") THEN BETA_TAC) THEN ((((use_arg_then2 ("ALL_MEM", [ALL_MEM]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("elements_of_list", [elements_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))))); + (BETA_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["x_in"])) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("x_in", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["inV"])); + (((((use_arg_then2 ("Trigonometry1.DIST_L_ZERO", [Trigonometry1.DIST_L_ZERO]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("CONTRAVENING_DIST", [CONTRAVENING_DIST])) (fun fst_arg -> (use_arg_then2 ("contrV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma contravening_norm_ge *) +let contravening_norm_ge = Sections.section_proof [] +`ALL (\x. &2 <= norm (h x)) (list_of_elements L)` +[ + ((((use_arg_then2 ("bij_h", [])) (disch_tac [])) THEN (clear_assumption "bij_h") THEN BETA_TAC) THEN ((((use_arg_then2 ("ALL_MEM", [ALL_MEM]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("elements_of_list", [elements_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["x_in"])) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("x_in", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["inV"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `&2 = #2.0`)))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("Trigonometry1.DIST_L_ZERO", [Trigonometry1.DIST_L_ZERO]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("CONTRAVENING_DIST", [CONTRAVENING_DIST])) (fun fst_arg -> (use_arg_then2 ("contrV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Norm *) +let contravening_norm_le = Sections.finalize_theorem contravening_norm_le;; +let contravening_norm_ge = Sections.finalize_theorem contravening_norm_ge;; +Sections.end_section "Norm";; + +(* Lemma contravening_dart_eq_dart1 *) +let contravening_dart_eq_dart1 = Sections.section_proof [] +`dart_of_fan (V,ESTD V) = dart1_of_fan (V,ESTD V)` +[ + ((((fun arg_tac -> (use_arg_then2 ("Add_triangle.fully_surrounded_dart_of_fan_eq", [Add_triangle.fully_surrounded_dart_of_fan_eq])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("CONTRAVENING_IMP_FULLY_SURROUNDED", [CONTRAVENING_IMP_FULLY_SURROUNDED]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; +(Sections.add_section_hyp "goodL" (`good_list L`));; +(Sections.add_section_hyp "iso_g" (`hyp_iso g (hypermap_of_list L, hypermap_of_fan (V,ESTD V))`));; + +(* Let mem_dartsL *) +Sections.add_section_lemma "mem_dartsL" (Sections.section_proof ["d"] +`MEM d (list_of_darts L) <=> d IN dart (hypermap_of_list L)` +[ + (((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; + +(* Let in_dartsH *) +Sections.add_section_lemma "in_dartsH" (Sections.section_proof ["x"] +`x IN dart (hypermap_of_fan (V,ESTD V)) <=> x IN dart_of_fan (V,ESTD V)` +[ + ((((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Lemma contravening_dist_dart_ge *) +let contravening_dist_dart_ge = Sections.section_proof [] +`ALL (\d. &2 <= dist (g d)) (list_of_darts L)` +[ + (((((use_arg_then2 ("ALL_MEM", [ALL_MEM]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_dartsL", []))(thm_tac (new_rewrite [] []))))) THEN (move ["d"]) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("iso_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (simp_tac)); + (((((use_arg_then2 ("in_dartsH", []))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("CONTRAVENING_DART_DIST", [CONTRAVENING_DART_DIST])) (fun fst_arg -> (use_arg_then2 ("contrV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma contravening_dist_dart_le *) +let contravening_dist_dart_le = Sections.section_proof [] +`ALL (\d. dist (g d) <= #2.52) (list_of_darts L)` +[ + (((((use_arg_then2 ("ALL_MEM", [ALL_MEM]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_dartsL", []))(thm_tac (new_rewrite [] []))))) THEN (move ["d"]) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("iso_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (simp_tac)); + (((((use_arg_then2 ("in_dartsH", []))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("CONTRAVENING_DART_DIST", [CONTRAVENING_DART_DIST])) (fun fst_arg -> (use_arg_then2 ("contrV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (arith_tac) THEN (done_tac)); +];; +(Sections.add_section_hyp "bij_h" (`BIJ h (elements_of_list L) V`));; +(Sections.add_section_hyp "g_eq" (`g = \d. h (FST d), h (SND d)`));; + +(* Lemma contravening_dist_not_dart *) +let contravening_dist_not_dart = Sections.section_proof ["s"] +`ALL (\d. MEM (FST d) (list_of_elements L) /\ MEM (SND d) (list_of_elements L) + /\ (FST d = SND d <=> F)) s + /\ ALL (\d. MEM d (list_of_darts L) <=> F) s + ==> ALL (\d. #2.52 <= dist (g d)) s` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("ALL_MEM", [ALL_MEM]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (simp_tac) THEN (case THEN (move ["h1"])) THEN (move ["h2"]) THEN (case THEN ((move ["a"]) THEN (move ["b"]))) THEN (move ["mem_ds"])); + ((fun arg_tac -> arg_tac (Arg_term (`h a IN V /\ h b IN V /\ ~(h a = h b)`))) (term_tac (have_gen_tac [](move ["hab_in"])))); + ((((use_arg_then2 ("bij_h", [])) (disch_tac [])) THEN (clear_assumption "bij_h") THEN BETA_TAC) THEN (((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["x_in"])) THEN (move ["h_inj"]) THEN (move ["_"]))); + (((fun arg_tac -> (use_arg_then2 ("h1", [])) (fun fst_arg -> (use_arg_then2 ("mem_ds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (simp_tac) THEN (move ["h1"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("x_in", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("elements_of_list", [elements_of_list]))(fun tmp_arg1 -> (use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("implybF", [implybF]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("h_inj", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN ((((use_arg_then2 ("elements_of_list", [elements_of_list]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("h1", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`~(g (a,b) IN dart_of_fan (V,ESTD V))`))) (term_tac (have_gen_tac [](move ["mem_gd"]))))); + ((((use_arg_then2 ("mem_gd", [])) (disch_tac [])) THEN (clear_assumption "mem_gd") THEN ((use_arg_then2 ("contraR", [contraR])) (disch_tac [])) THEN (clear_assumption "contraR") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("g_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (move ["ineq"]))); + ((((use_arg_then2 ("contravening_dart_eq_dart1", [contravening_dart_eq_dart1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Add_triangle.inE_eq_in_dart1", [Add_triangle.inE_eq_in_dart1]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("IN_ESTD", [IN_ESTD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("hab_in", []))(thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("ineq", [ineq])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((fun arg_tac -> (use_arg_then2 ("h2", [])) (fun fst_arg -> (use_arg_then2 ("mem_ds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (move ["g_in"])); + ((((fun arg_tac -> (use_arg_then2 ("hyp_iso_surj", [hyp_iso_surj])) (fun fst_arg -> (use_arg_then2 ("iso_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("in_dartsH", []))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("g_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC THEN (case THEN (case THEN ((move ["a'"]) THEN (move ["b'"]))))) THEN ((((use_arg_then2 ("mem_dartsL", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["ab'_in"])))); + (((((use_arg_then2 ("g_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["eq_a"]) THEN (move ["eq_b"])))); + ((((use_arg_then2 ("bij_h", [])) (disch_tac [])) THEN (clear_assumption "bij_h") THEN BETA_TAC) THEN (((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("elements_of_list", [elements_of_list]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["_"])) THEN (move ["inj"]) THEN (move ["_"]))); + (((fun arg_tac -> (use_arg_then2 ("h1", [])) (fun fst_arg -> (use_arg_then2 ("mem_ds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (simp_tac) THEN (move ["mem_ab"])); + (((fun arg_tac -> (use_arg_then2 ("mem_list_of_darts_imp_mem_list_of_elements", [mem_list_of_darts_imp_mem_list_of_elements])) (fun fst_arg -> (use_arg_then2 ("ab'_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["mem_ab'"])); + ((((fun arg_tac -> (use_arg_then2 ("inj", [])) (fun fst_arg -> (use_arg_then2 ("eq_a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then2 ("inj", [])) (fun fst_arg -> (use_arg_then2 ("eq_b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section Contravening *) +let mem_list_of_darts_imp_mem_list_of_elements = Sections.finalize_theorem mem_list_of_darts_imp_mem_list_of_elements;; +let contravening_norm_le = Sections.finalize_theorem contravening_norm_le;; +let contravening_norm_ge = Sections.finalize_theorem contravening_norm_ge;; +let contravening_dart_eq_dart1 = Sections.finalize_theorem contravening_dart_eq_dart1;; +let contravening_dist_dart_ge = Sections.finalize_theorem contravening_dist_dart_ge;; +let contravening_dist_dart_le = Sections.finalize_theorem contravening_dist_dart_le;; +let contravening_dist_not_dart = Sections.finalize_theorem contravening_dist_not_dart;; +Sections.end_section "Contravening";; + +(* Close the module *) +end;; diff --git a/formal_lp/hypermap/ineqs/lp_approx_ineqs.hl b/formal_lp/hypermap/ineqs/lp_approx_ineqs.hl new file mode 100644 index 0000000..4281d37 --- /dev/null +++ b/formal_lp/hypermap/ineqs/lp_approx_ineqs.hl @@ -0,0 +1,292 @@ +needs "../formal_lp/ineqs/constants_approx.hl";; + +module Lp_approx_ineqs = struct + +open Constants_approx;; + +(* Integral approximation of inequalities and equalities *) +let mk_decimal = + let decimal_const = `DECIMAL` and + neg_op_real = `(--):real->real` in + fun (n,m) -> + let tm = mk_comb(mk_comb(decimal_const, mk_numeral (abs_num n)), mk_numeral m) in + if (n real->bool` in + fun tm precision -> + let n = rat_of_term tm in + let m = Int 10 **/ (Int precision) in + let n1 = n */ m in + let low, high = floor_num n1, ceiling_num n1 in + let l_tm, h_tm = + if precision = 0 then + term_of_rat low, term_of_rat high + else + mk_decimal (low, m), mk_decimal (high, m) in + let l_th = EQT_ELIM (REAL_RAT_LE_CONV (mk_binop le_op_real l_tm tm)) in + let h_th = EQT_ELIM (REAL_RAT_LE_CONV (mk_binop le_op_real tm h_tm)) in + l_th, h_th;; + + +(* Splits a sum into two parts: with and without free variables *) +let split_sum_conv = + let sum_th0 = REAL_ARITH `x = x + &0 + &0` and + sum_th1 = REAL_ARITH `(x + y) + b + c = y + (x + b) + c:real` and + sum_th2 = REAL_ARITH `(x + y) + b + c = y + b + (x + c):real` and + sum_th1' = REAL_ARITH `x + b + c = (x + b) + c:real` and + sum_th2' = REAL_ARITH `x + b + c = b + (x + c):real` in + let x_var_real = `x:real` and + y_var_real = `y:real` and + b_var_real = `b:real` and + c_var_real = `c:real` and + add_op_real = `(+):real->real->real` in + let rec split_sum_raw_conv tm = + let xy_tm, bc_tm = dest_binop add_op_real tm in + let b_tm, c_tm = dest_binop add_op_real bc_tm in + if (is_binop add_op_real xy_tm) then + let x_tm, y_tm = dest_binop add_op_real xy_tm in + let inst_th = INST[x_tm, x_var_real; y_tm, y_var_real; b_tm, b_var_real; c_tm, c_var_real] in + let th1 = if (frees x_tm <> []) then inst_th sum_th1 else inst_th sum_th2 in + let th2 = split_sum_raw_conv (rand(concl th1)) in + TRANS th1 th2 + else + let inst_th = INST[xy_tm, x_var_real; b_tm, b_var_real; c_tm, c_var_real] in + if (frees xy_tm <> []) then inst_th sum_th1' else inst_th sum_th2' in + + fun tm -> + let th0 = INST[tm, x_var_real] sum_th0 in + let th1 = split_sum_raw_conv (rand(concl th0)) in + TRANS th0 th1;; + + + +let rearrange_mul_conv = + let mul_op_real = `( * ):real->real->real` in + let rec dest_mul tm = + if (is_binop mul_op_real tm) then + let lhs, rhs = dest_binop mul_op_real tm in + let cs, vars = dest_mul rhs in + if (frees lhs = []) then + lhs::cs, vars + else + cs, lhs::vars + else + if (frees tm = []) then + [tm], [] + else + [], [tm] in + let mk_mul list = + if (list = []) then failwith "rearrange_mul: empty list" + else itlist (fun l r -> mk_binop mul_op_real l r) (tl list) (hd list) in + + fun tm -> + let cs, vars = dest_mul tm in + let cs_mul, vars_mul = mk_mul cs, mk_mul vars in + let t = mk_eq(tm, mk_binop mul_op_real cs_mul vars_mul) in + EQT_ELIM (REWRITE_CONV[REAL_MUL_AC] t);; + + + +(* Moves everything with free variables on the left and performs basic reductions *) +let ineq_rewrite_conv = + let le_add_th = REAL_ARITH `x + y <= b + c <=> x - b <= c - y:real` in + REWRITE_CONV[real_ge; real_div; DECIMAL] THENC + LAND_CONV REAL_POLY_CONV THENC RAND_CONV REAL_POLY_CONV THENC + LAND_CONV split_sum_conv THENC RAND_CONV split_sum_conv THENC + ONCE_REWRITE_CONV[le_add_th] THENC + LAND_CONV REAL_POLY_CONV THENC RAND_CONV REAL_POLY_CONV THENC + REWRITE_CONV[GSYM real_div] THENC + ONCE_DEPTH_CONV rearrange_mul_conv;; + + +(* Approximation *) + +let le_mul1_th = REAL_ARITH `!x. &1 * x <= x`;; +let ge_mul1_th = REAL_ARITH `!x. x <= &1 * x`;; +let INTERVAL_LO = prove(`interval_arith x (a,b) ==> a <= x`, SIMP_TAC[interval_arith]);; +let INTERVAL_HI = prove(`interval_arith x (a,b) ==> x <= b`, SIMP_TAC[interval_arith]);; + +let add_op_real = `(+):real->real->real`;; + +let rec low_approx tm precision = + let low_approx1 tm precision = + if (is_binop mul_op_real tm && frees tm <> []) then + let c, var = dest_binop mul_op_real tm in + let interval_th = approx_interval (create_interval c) precision in + let l_th = MATCH_MP INTERVAL_LO interval_th in + let a, b = dest_binop le_op_real (concl l_th) in + (PROVE_HYP l_th o UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o SPECL[a; b; var]) REAL_LE_RMUL + else + if (frees tm = []) then + MATCH_MP INTERVAL_LO (approx_interval (create_interval tm) precision) + else + SPEC tm le_mul1_th in + + if (is_binop add_op_real tm && frees tm <> []) then + let lhs, rhs = dest_binop add_op_real tm in + let l_th = low_approx1 lhs precision in + let r_th = low_approx rhs precision in + MATCH_MP REAL_LE_ADD2 (CONJ l_th r_th) + else + low_approx1 tm precision;; + + +let rec hi_approx tm precision = + let hi_approx1 tm precision = + if (is_binop mul_op_real tm && frees tm <> []) then + let c, var = dest_binop mul_op_real tm in + let interval_th = approx_interval (create_interval c) precision in + let h_th = MATCH_MP INTERVAL_HI interval_th in + let a, b = dest_binop le_op_real (concl h_th) in + (PROVE_HYP h_th o UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o SPECL[a; b; var]) REAL_LE_RMUL + else + if (frees tm = []) then + MATCH_MP INTERVAL_HI (approx_interval (create_interval tm) precision) + else + SPEC tm ge_mul1_th in + + if (is_binop add_op_real tm && frees tm <> []) then + let lhs, rhs = dest_binop add_op_real tm in + let l_th = hi_approx1 lhs precision in + let r_th = hi_approx rhs precision in + MATCH_MP REAL_LE_ADD2 (CONJ l_th r_th) + else + hi_approx1 tm precision;; + + + +let approx_le_ineq precision tm = + let lhs, rhs = dest_binop le_op_real tm in + let lhs_th = low_approx lhs precision in + let rhs_th = hi_approx rhs precision in + let ll, lr = dest_binop le_op_real (concl lhs_th) in + let rl, rr = dest_binop le_op_real (concl rhs_th) in + + let th0 = ASSUME tm in + let th1 = SPECL[ll; lr; rhs] REAL_LE_TRANS in + let th2 = SPECL[ll; rhs; rr] REAL_LE_TRANS in + let s1 = MATCH_MP th1 (CONJ lhs_th th0) in + MATCH_MP th2 (CONJ s1 rhs_th);; + + +let integer_approx_le_ineq precision ineq = + let lhs, rhs = dest_binop le_op_real ineq in + let m = (Int 10 **/ Int precision) in + let m_num, m_real = mk_numeral m, term_of_rat m in + let m_pos = SPEC m_num REAL_POS in + let mul_th = SPECL[m_real; lhs; rhs] REAL_LE_LMUL in + let th0 = MATCH_MP mul_th (CONJ m_pos (ASSUME ineq)) in + let th1 = (CONV_RULE ineq_rewrite_conv) th0 in + let approx = approx_le_ineq 0 (concl th1) in + PROVE_HYP th1 approx;; + + +let create_approximations precision_list ineq = + let ineq_th = ineq_rewrite_conv ineq in + let rhs = rand(concl ineq_th) in + let th0 = CONV_RULE (LAND_CONV (REWRITE_CONV[DECIMAL] THENC REAL_POLY_CONV)) + (approx_le_ineq 8 rhs) in + + let int_approx p = + let th1 = integer_approx_le_ineq p (concl th0) in + let th2 = PROVE_HYP th0 th1 in + let th3 = DISCH rhs th2 in + REWRITE_RULE[GSYM ineq_th] th3 in + + map int_approx precision_list;; + +(**********************************) + + +(* +let tm = `(&34/ &13 + pi/sol0)* x + &2 + -- &14 / &3 * z <= pi + rho218 + z * sol0 - u / &1000`;; +create_approximations [3;4;5] tm;; +*) + + +(*************************) + +(* Additional step for generalizing hypotheses *) + +let LIST_SUM_LMUL = prove(`!(f:A->real) c n. list_sum n (\x. c * f x) = c * list_sum n f`, + REWRITE_TAC[Seq2.list_sum_lmul]);; +let le_hyp_gen = prove(`!f y. (!x. &0 <= f x) ==> &0 <= f y`, SIMP_TAC[]);; +let le_list_sum_hyp_gen = prove(`!(f:A->real) n. (!x. &0 <= f x) ==> &0 <= list_sum n f`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC Seq2.list_sum_ge0 THEN ASM_REWRITE_TAC[]);; + + +let generalize_hyp th = + let gen_hyp tm = + let fn, arg = dest_comb (rand tm) in + if (is_comb fn && is_const (rator fn) && (fst o dest_const o rator) fn = "list_sum") then + let f, n = arg, rand fn in + UNDISCH_ALL (ISPECL[f; n] le_list_sum_hyp_gen) + else + UNDISCH_ALL (ISPECL[fn; arg] le_hyp_gen) in + + let hyp_ths = map gen_hyp (hyp th) in + itlist PROVE_HYP hyp_ths th;; + + +(* +let tm = `list_sum n (\x. s x * r) + &1 / &3 * (azim_dart (V,E) o g) x <= pi`;; +let ths = create_approximations [3] tm;; +map generalize_hyp ths;; +*) + + +(*******************************) + + +let generate_ineqs = + let imp_th = TAUT `(A ==> B) ==> ((P ==> A) ==> (P ==> B))` in + let and_imp_th = TAUT `(A ==> B /\ C) <=> ((A ==> B) /\ (A ==> C))` in + let p_bool = `P:bool` in + let strip_imp = splitlist dest_imp in + let list_mk_imp = itlist (curry mk_imp) in + + let create_approxs pos_ths original_th precision_list = + let var, ineq' = (dest_abs o rand o rator o concl) original_th in + let cond_tms, ineq = strip_imp ineq' in + let final_step = fun approx_th -> + let p_tm', q_tm' = dest_imp (concl approx_th) in + let p_tm, q_tm = mk_abs(var, list_mk_imp cond_tms p_tm'), mk_abs(var, list_mk_imp cond_tms q_tm') in + let list_tm = (rand o concl) original_th in + let mono_th = BETA_RULE (ISPECL[p_tm; q_tm; list_tm] (GEN_ALL MONO_ALL)) in + let approx_th2 = itlist (fun p_tm th -> MATCH_MP (INST [p_tm, p_bool] imp_th) th) cond_tms approx_th in + let s1 = MATCH_MP mono_th (GEN var approx_th2) in + MATCH_MP s1 original_th in + + let approx_ths0 = map generalize_hyp (create_approximations precision_list ineq) in + let approx_ths1 = map (itlist PROVE_HYP pos_ths) approx_ths0 in + let approx_ths = map (REWRITE_RULE[GSYM LIST_SUM_LMUL]) approx_ths1 in + map final_step approx_ths in + + fun pos_ths precision_list ineq_th -> + let _, ineq = (strip_imp o snd o dest_abs o rand o rator o concl) ineq_th in + if (is_eq ineq) then + let eq_th = PURE_REWRITE_RULE[GSYM REAL_LE_ANTISYM; and_imp_th; GSYM AND_ALL] ineq_th in + let ths1 = create_approxs pos_ths (CONJUNCT1 eq_th) precision_list in + let ths2 = create_approxs pos_ths (CONJUNCT2 eq_th) precision_list in + ths1, ths2 + else + create_approxs pos_ths ineq_th precision_list, [];; + + + +(* +generate_ineqs [] [3;4] (ASSUME `ALL (\n. list_sum n (\x. f x) - &1 <= pi) s`);; +*) + +end;; + + diff --git a/formal_lp/hypermap/ineqs/lp_body_ineqs.hl b/formal_lp/hypermap/ineqs/lp_body_ineqs.hl new file mode 100644 index 0000000..8ab6c05 --- /dev/null +++ b/formal_lp/hypermap/ineqs/lp_body_ineqs.hl @@ -0,0 +1,244 @@ +needs "../formal_lp/hypermap/ineqs/lp_ineqs_proofs-compiled.hl";; +needs "../formal_lp/hypermap/ineqs/lp_ineqs_proofs2-compiled.hl";; +needs "../formal_lp/hypermap/ineqs/lp_main_estimate-compiled.hl";; +needs "../formal_lp/hypermap/ineqs/lp_ineqs.hl";; +needs "../formal_lp/hypermap/ineqs/lp_body_ineqs_data.hl";; + +module Lp_body_ineqs = struct + +open Lp_ineqs_proofs;; +open Lp_ineqs_proofs2;; +open Lp_main_estimate;; +open Sphere;; +open Tame_general;; +open Lp_ineqs;; + +let special_list = + let r = add_lp_hyp true in + [ + "ineq71", (r ineq71, TRUTH); + "ineq72", (r ineq72, TRUTH); + "ineq73", (r ineq73, TRUTH); + "ineq74", (r ineq74, TRUTH); + "ineq77", (r ineq77, r ineq77_std); + "ineq89", (r ineq89, r ineq89_std); + "ineq90", (r ineq90, r ineq90_std); + "ineq104", (r ineq104, r ineq104_std); + "ineq105", (r ineq105, r ineq105_std); + "ineq106", (r ineq106, r ineq106_std); + "ineq118", (r ineq_tau4_diag3, r ineq_tau4_diag3_std); + "ineq119", (r ineq119, r ineq119_std); + "ineq120", (r ineq120, r ineq120_std); + "ineq121", (r ineq121, r ineq121_std); + "ineq122", (r ineq122, r ineq122_std); + ];; + +(**********************) + +let DECIMAL_EQ = ARITH_RULE `#2.0 = &2 /\ #2.00 = &2 /\ #2 = &2 /\ #3.0 = &3`;; + +let REAL_GT_IMP_GE = ARITH_RULE `a > b ==> a >= b:real`;; + +let dih2_y_eq_dih3_y = prove(`dih2_y y1 y2 y3 y4 y5 y6 = dih3_y y1 y3 y2 y4 y6 y5`, + REWRITE_TAC[dih2_y; dih3_y]);; + +let dih3_y_eq_dih2_y = prove(`dih3_y y1 y2 y3 y4 y5 y6 = dih2_y y1 y3 y2 y4 y6 y5`, + REWRITE_TAC[dih2_y; dih3_y]);; + +let rhazim2_eq_rhazim3 = prove(`rhazim2 y1 y2 y3 y4 y5 y6 = rhazim3 y1 y3 y2 y4 y6 y5`, + REWRITE_TAC[rhazim2; rhazim3; node2_y; node3_y; rhazim; Nonlinear_lemma.dih_y_sym]);; + + +let rhazim3_eq_rhazim2 = prove(`rhazim3 y1 y2 y3 y4 y5 y6 = rhazim2 y1 y3 y2 y4 y6 y5`, + REWRITE_TAC[rhazim2; rhazim3; node2_y; node3_y; rhazim; Nonlinear_lemma.dih_y_sym]);; + + +let inst_list = [ + `y1_fan d`, `y1:real`; + `y2_fan d`, `y2:real`; + `y3_fan (V,E) d`, `y3:real`; + `y4'_fan (V,E) d`, `y4:real`; + `y5_fan (V,E) d`, `y5:real`; + `y6_fan d`, `y6:real`; + `y7_fan (V,E) d`, `y7:real`; + `y8_fan (V,E) d`, `y8:real`; + `y9_fan (V,E) d`, `y9:real`; +];; + + +let inst_sym_list = [ + `y1_fan d`, `y1:real`; + `y3_fan (V,E) d`, `y2:real`; + `y2_fan d`, `y3:real`; + `y4'_fan (V,E) d`, `y4:real`; + `y6_fan d`, `y5:real`; + `y5_fan (V,E) d`, `y6:real`; +];; + + +let r = UNDISCH o SPEC_ALL o add_lp_hyp true;; +let eq_ths = map r [ + GSYM azim_fan_eq_dih_y; + GSYM rhazim_fan_eq_rhazim; +];; + +let eq3_ths = map r [ + y4'_eq_y4; + GSYM dart3_azim2_fan_eq_dih2_y; + GSYM dart3_azim3_fan_eq_dih3_y; + GSYM dart3_rhazim2_fan_eq_rhazim2; + GSYM dart3_rhazim3_fan_eq_rhazim3; + GSYM dart3_sol_fan_eq_sol; + GSYM dart3_tau_fan_eq_taum; +] @ eq_ths;; + +let eq4_ths = map r [ + GSYM dart4_tau_fan_eq_tauq; +] @ eq_ths;; + + +let bounds_gen_ths = map r [ + y1_lo; y2_lo; y3_lo; y4_lo; y5_lo; y6_lo; y8_lo; y9_lo; + y1_hi; y2_hi; y3_hi; + y4'_lo; y7_lo; y7_hi; +];; + +let bounds_std_ths = map r [ + y4_hi_std; y5_hi_std; y6_hi_std; y8_hi_std; y9_hi_std; + y4_hi_std2; y5_hi_std2; y6_hi_std2; +];; + +let mk_darts_k_subset_th k = + let eq_th = add_lp_hyp false Hypermap_and_fan.COMPONENTS_HYPERMAP_OF_FAN in + (UNDISCH_ALL o REWRITE_RULE[eq_th] o SPEC_ALL o ISPECL[`hypermap_of_fan (V,E)`; mk_small_numeral k]) + Lp_gen_theory.darts_k_subset;; + +type lp_data = { + d_in_tm : term; + eq_ths : thm list; + in_th : thm; +};; + +let mk_lp_data (tm, eq_ths, in_th) = + {d_in_tm = tm; eq_ths = eq_ths; in_th = in_th};; + +let lp_data = [ + "dart", mk_lp_data (`(d:real^3#real^3) IN dart_of_fan (V,E)`, eq_ths, TRUTH); + "dart3", mk_lp_data (`(d:real^3#real^3) IN darts_k 3 (hypermap_of_fan (V,E))`, eq3_ths, mk_darts_k_subset_th 3); + "dart4", mk_lp_data (`(d:real^3#real^3) IN darts_k 4 (hypermap_of_fan (V,E))`, eq4_ths, mk_darts_k_subset_th 4); +];; + + + +let normalize_ineq = + let normalize th = + if is_binary "real_gt" (concl th) then + MATCH_MP REAL_GT_IMP_GE th + else if is_binary "real_lt" (concl th) then + MATCH_MP REAL_LT_IMP_LE th + else + th in + fun th -> + if is_imp (concl th) then + let p_tm, _ = dest_imp (concl th) in + let th2 = normalize (UNDISCH th) in + DISCH p_tm th2 + else + normalize th;; + +let finalize_th data th = + let th1 = PROVE_HYP data.in_th th in + let th2 = normalize_ineq th1 in + let th3 = (PURE_REWRITE_RULE[GSYM IMP_IMP] o GEN `d:real^3#real^3` o DISCH data.d_in_tm) th2 in + add_lp_ineqs_hyp th3;; + + +(* set name, (set definitional theorem, corresponding lp set, generate std flag *) +let ineq_sets = [ + "apex_std3_hll", (Ineq.apex_std3_hll, "dart3", true); + "apex_flat_h", (Ineq.apex_flat_h, "dart3", false); + "apex_flat_l", (Ineq.apex_flat_l, "dart3", false); + "apex_flat_hll", (Ineq.apex_flat_hll, "dart3", false); + "apex_flat", (Ineq.apex_flat, "dart3", false); + "apex_std3_lhh", (Ineq.apex_std3_lhh, "dart3", true); + "apex_sup_flat", (Ineq.apex_sup_flat, "dart3", false); + "dart_mll_n", (Ineq.dart_mll_n, "dart3", true); + "dart_mll_w", (Ineq.dart_mll_w, "dart3", true); + "apex_std3_lll_wxx", (Ineq.apex_std3_lll_wxx, "dart3", true); + "apex_std3_lll_xww", (Ineq.apex_std3_lll_xww, "dart3", true); + "apex_std3_small_hll", (Ineq.apex_std3_small_hll, "dart3", true); + "dart_std3_mini", (Ineq.dart_std3_mini, "dart3", true); + "dart_std3_lw", (Ineq.dart_std3_lw, "dart3", true); + "dart_std3", (Ineq.dart_std3, "dart3", true); + "dart_Hll_w", (Ineq.dart_Hll_w, "dart3", true); + "dart_Hll_n", (Ineq.dart_Hll_n, "dart3", true); + "apexfA", (Ineq.apexfA, "dart3", false); + "apexffA", (Ineq.apexffA, "dart3", false); + "apex_A", (Ineq.apex_A, "dart3", false); + "dart_std3_big_200_218", (Ineq.dart_std3_big_200_218, "dart3", true); + "dart_std3_big", (REWRITE_RULE[GSYM Ineq.dart_std3_big] Ineq.dart_std3, "dart3", true); + "dart_std3_small", (Ineq.dart_std3_small, "dart3", true); + "dart4_diag3", (Ineq.dart4_diag3, "dart4", true); + "dartY", (Ineq.dartY, "dart", false); + "dartX", (Ineq.dartX, "dart", false); +];; + + +let gen_body_ineq_ths sym_flag ineq_id set_name = + let ineq_domain_th, lp_set, std_flag = assoc set_name ineq_sets in + let data = assoc lp_set lp_data in + + let ineq = (hd o Ineq.getexact) ineq_id in + let th0 = (SPEC_ALL o ASSUME) (ineq.ineq) in + let th1 = + if sym_flag then + let t1 = INST inst_sym_list th0 in + ONCE_REWRITE_RULE[Nonlinear_lemma.dih_y_sym; dih2_y_eq_dih3_y; dih3_y_eq_dih2_y; rhazim2_eq_rhazim3; rhazim3_eq_rhazim2] t1 + else + INST inst_list th0 in + + let th2 = REWRITE_RULE data.eq_ths th1 in + let th3 = REWRITE_RULE[ALL; INEQ_ALT; ineq_domain_th; DECIMAL_EQ] th2 in + + let gen_th1 = REWRITE_RULE bounds_gen_ths th3 in + let gen_th = finalize_th data gen_th1 in + let std_th = + if std_flag then + let std_th1 = REWRITE_RULE bounds_std_ths gen_th1 in + finalize_th data std_th1 + else + TRUTH in + gen_th, std_th;; + + + + +(*********************) + + +let add_body_ineqs () = + let test (name, _, _) = true in + let data = filter test Lp_body_ineqs_data.data in + let sym_data = filter test Lp_body_ineqs_data.sym_data in + + let report s = + Format.print_string s; Format.print_newline(); Format.print_flush() in + let counter = ref 0 and + total = length data + length sym_data in + + let add sym_flag (lp_name, ineq_id, set_name) = + let _ = counter := !counter + 1 in + let _ = report (sprintf "Adding %s (%d / %d)" lp_name !counter total) in + let gen_th, std_th = + try assoc lp_name special_list + with Failure _ -> gen_body_ineq_ths sym_flag ineq_id set_name in + let _ = add_lp_ineq_th (lp_name, false, gen_th) in + let _ = if std_th <> TRUTH then add_lp_ineq_th (lp_name, true, std_th) else () in + () in + + let _ = map (add false) data in + let _ = map (add true) sym_data in + ();; + +end;; + diff --git a/formal_lp/hypermap/ineqs/lp_body_ineqs_data.hl b/formal_lp/hypermap/ineqs/lp_body_ineqs_data.hl new file mode 100644 index 0000000..d4ec595 --- /dev/null +++ b/formal_lp/hypermap/ineqs/lp_body_ineqs_data.hl @@ -0,0 +1,132 @@ +module Lp_body_ineqs_data = struct + +let data = [ + "ineq32", "3137600529", "apex_flat_h"; + "ineq33", "6284721194", "apex_std3_hll"; + "ineq34", "9185711902", "apex_std3_hll"; + "ineq35", "6725783616", "apex_flat"; + "ineq36", "1248932983", "apex_std3_lhh"; + "ineq37", "1836408787", "apex_std3_lhh"; + "ineq38", "5943578801", "apex_sup_flat"; + "ineq39", "2763799127", "apex_sup_flat"; + "ineq40", "4306175952", "dart_mll_n"; + "ineq41", "2923748598", "dart_mll_n"; + "ineq42", "6410081357", "apex_std3_lll_wxx"; + "ineq43", "7316455966", "apex_std3_lll_wxx"; + "ineq44", "3425739813", "apex_flat"; + "ineq45", "5756588587", "apex_std3_lll_wxx"; + "ineq46", "4222324842", "apex_std3_lll_xww"; + "ineq47", "9641946727", "apex_flat_l"; + "ineq48", "2390583444", "dart_std3_mini"; + "ineq49", "7291663656", "apex_flat"; + "ineq50", "6987934000", "dart_mll_w"; + "ineq51", "7819193535", "dart_std3_lw"; + "ineq52", "8384511215", "apex_flat"; + "ineq53", "4750199435", "apex_flat"; + "ineq54", "1894886027", "dart_Hll_w"; + "ineq55", "5835568093", "dart_Hll_n"; + "ineq56", "4002562507", "dart_mll_n"; + "ineq57", "7409690040", "dart_mll_w"; + "ineq58", "9925287433", "dart_Hll_w"; + "ineq59", "4841020453", "dart_Hll_n"; + "ineq60", "3139693500", "dart_mll_n"; + "ineq61", "3872614111", "dart_mll_w"; + "ineq62", "4041673283", "apex_std3_small_hll"; + "ineq63", "1284543870", "apex_std3_small_hll"; + "ineq64", "6619134733", "apex_std3_small_hll"; + "ineq65", "8657368829", "apex_std3_small_hll"; + "ineq66", "7743522046", "apex_std3_hll"; + "ineq67", "5298513205", "apex_std3_hll"; + "ineq68", "3636849632", "apex_std3_hll"; + "ineq69", "6836427086", "apex_std3_hll"; + "ineq70", "2151506422", "apex_std3_hll"; + "ineq71", "181212899 5", "apexff5"; + "ineq72", "181212899 4", "apexf5"; + "ineq73", "181212899 3", "apexff4"; + "ineq74", "181212899 2", "apexf4"; + "ineq75", "181212899 1", "apexfA"; + "ineq76", "181212899 0", "apexffA"; + "ineq77", "8611785756", "dart_std3_big_200_218"; + "ineq78", "8282573160", "apex_flat_hll"; + "ineq79", "4491491732", "dart_std3_mini"; + "ineq80", "1550635295", "dart_std3_mini"; + "ineq81", "9229542852", "dart_std3_mini"; + "ineq82", "1085358243", "apex_sup_flat"; + "ineq83", "3566713650", "apex_sup_flat"; + "ineq84", "7718591733", "apex_sup_flat"; + "ineq85", "7863247282", "apex_sup_flat"; + "ineq86", "1642527039", "apex_sup_flat"; + "ineq87", "4840774900", "apex_sup_flat"; + "ineq88", "5451229371", "apex_sup_flat"; + "ineq89", "6224332984", "dart_std3_big"; + "ineq90", "7761782916", "dart_std3_big"; + "ineq91", "9291937879", "dart_std3_small"; + "ineq92", "9225295803", "dart_std3_small"; + "ineq93", "7931207804", "apex_A"; + "ineq94", "2563100177", "apex_A"; + "ineq95", "5760733457", "apex_A"; + "ineq96", "8082208587", "apex_A"; + "ineq97", "9756015945", "apex_flat"; + "ineq98", "9251360200", "apex_flat"; + "ineq99", "5000076558", "apex_flat"; + "ineq100", "9922699028", "apex_flat"; + "ineq101", "3318775219", "apex_flat"; + "ineq102", "8248508703", "apex_flat"; + "ineq103", "6988401556", "apex_flat"; + "ineq104", "9995621667", "dart4_diag3"; + "ineq105", "9414951439", "dartY"; + "ineq106", "3020140039", "dartX"; + "ineq107", "5957966880", "dart_std3"; + "ineq108", "3526497018", "dart_std3"; + "ineq109", "4047599236", "dart_std3"; + "ineq110", "7726998381", "dart_std3"; + "ineq111", "7394240696", "dart_std3"; + "ineq112", "1395142356", "dart_std3"; + "ineq113", "4667071578", "dart_std3"; + "ineq114", "8519146937", "dart_std3"; + "ineq115", "3296257235", "dart_std3"; + "ineq116", "5490182221", "dart_std3"; + "ineq117", "5735387903", "dart_std3"; + "ineq118", "9563139965D", "dart4_diag3_b"; + "ineq119", "3862621143 revised", "dart_std4"; + "ineq120", "4240815464 a", "dart_std4"; + "ineq121", "6944699408 a", "dart_std4"; + "ineq122", "7043724150 a", "dart_std4"; +];; + +let sym_data = [ + "ineq0", "3137600529", "apex_flat_h"; + "ineq1", "6284721194", "apex_std3_hll"; + "ineq2", "9185711902", "apex_std3_hll"; + "ineq3", "6725783616", "apex_flat"; + "ineq4", "1248932983", "apex_std3_lhh"; + "ineq5", "1836408787", "apex_std3_lhh"; + "ineq6", "5943578801", "apex_sup_flat"; + "ineq7", "2763799127", "apex_sup_flat"; + "ineq8", "4306175952", "dart_mll_n"; + "ineq9", "2923748598", "dart_mll_n"; + "ineq10", "6410081357", "apex_std3_lll_wxx"; + "ineq11", "7316455966", "apex_std3_lll_wxx"; + "ineq12", "3425739813", "apex_flat"; + "ineq13", "5756588587", "apex_std3_lll_wxx"; + "ineq14", "4222324842", "apex_std3_lll_xww"; + "ineq15", "9641946727", "apex_flat_l"; + "ineq16", "2390583444", "dart_std3_mini"; + "ineq17", "7291663656", "apex_flat"; + "ineq18", "6987934000", "dart_mll_w"; + "ineq19", "7819193535", "dart_std3_lw"; + "ineq20", "8384511215", "apex_flat"; + "ineq21", "4750199435", "apex_flat"; + "ineq22", "1894886027", "dart_Hll_w"; + "ineq23", "5835568093", "dart_Hll_n"; + "ineq24", "4002562507", "dart_mll_n"; + "ineq25", "7409690040", "dart_mll_w"; + "ineq26", "4041673283", "apex_std3_small_hll"; + "ineq27", "1284543870", "apex_std3_small_hll"; + "ineq28", "7743522046", "apex_std3_hll"; + "ineq29", "5298513205", "apex_std3_hll"; + "ineq30", "9756015945", "apex_flat"; + "ineq31", "5000076558", "apex_flat"; +];; + +end;; diff --git a/formal_lp/hypermap/ineqs/lp_gen_ineqs.hl b/formal_lp/hypermap/ineqs/lp_gen_ineqs.hl new file mode 100644 index 0000000..cd77ced --- /dev/null +++ b/formal_lp/hypermap/ineqs/lp_gen_ineqs.hl @@ -0,0 +1,235 @@ +needs "../formal_lp/hypermap/ineqs/lp_ineqs_defs.hl";; +needs "../formal_lp/hypermap/ineqs/lp_gen_theory-compiled.hl";; + +module Lp_gen_ineqs = struct + + +open Lp_ineqs_def;; +open Hypermap_and_fan;; +open Hypermap_iso;; +open List_hypermap;; +open Lp_gen_theory;; + + +(* mod-file variables and definitions *) + +let var_inst_list = + let sets = + [ + "dart", `:real^3#real^3`; + "face", `:real^3#real^3->bool`; + "node", `:real^3`; + ] in + let mk_mod name set = mk_var (name, mk_fun_ty (assoc set sets) `:real`) in + [ + `hypermap_of_fan (V,E)`, `H:(real^3#real^3)hypermap`; + `FST:real^3#real^3->real^3`, `node_mod:real^3#real^3->real^3`; + `azim_dart (V,E)`, mk_mod "azim_mod" "dart"; + `azim2_fan (V,E)`, mk_mod "azim2_mod" "dart"; + `azim3_fan (V,E)`, mk_mod "azim3_mod" "dart"; + `rhazim_fan (V,E)`, mk_mod "rhazim_mod" "dart"; + `rhazim2_fan (V,E)`, mk_mod "rhazim2_mod" "dart"; + `rhazim3_fan (V,E)`, mk_mod "rhazim3_mod" "dart"; + `ln_fan`, mk_mod "ln_mod" "node"; + `yn_fan`, mk_mod "yn_mod" "node"; + `rho_fan`, mk_mod "rho_mod" "node"; + `ye_fan`, mk_mod "ye_mod" "dart"; + `y1_fan`, mk_mod "y1_mod" "dart"; + `y2_fan`, mk_mod "y2_mod" "dart"; + `y3_fan (V,E)`, mk_mod "y3_mod" "dart"; + `y4_fan (V,E)`, mk_mod "y4_mod" "dart"; + `y5_fan (V,E)`, mk_mod "y5_mod" "dart"; + `y6_fan`, mk_mod "y6_mod" "dart"; + `y8_fan (V,E)`, mk_mod "y8_mod" "dart"; + `y9_fan (V,E)`, mk_mod "y9_mod" "dart"; + `y4'_fan (V,E)`, mk_mod "y4'_mod" "dart"; + `sol_fan (V,E)`, mk_mod "sol_mod" "face"; + `tau_fan (V,E)`, mk_mod "tau_mod" "face"; + ];; + + +(*****************) + + + +(* For a term in the form `!x. x IN set H ==> P x` returns a theorem + hyp_iso g (G,H), !x. x IN set H ==> P x |- !y. y IN set G ==> P (g y) *) +let get_iso_thm = + let iso_list0 = + [ + `darts_k 6 (H:(A)hypermap)`, spec_var_th iso_darts_k_trans 0 `6`; + `darts_k 5 (H:(A)hypermap)`, spec_var_th iso_darts_k_trans 0 `5`; + `darts_k 4 (H:(A)hypermap)`, spec_var_th iso_darts_k_trans 0 `4`; + `darts_k 3 (H:(A)hypermap)`, spec_var_th iso_darts_k_trans 0 `3`; + `dart (H:(A)hypermap)`, iso_dart_trans; + `face_set (H:(A)hypermap)`, iso_face_trans; + `node_set (H:(A)hypermap)`, iso_node_trans; + `V:C->bool`, bij_trans; + ] in + let cty = `:C` in + fun ineq -> + let x_tm, tm = dest_forall ineq in + let x_ty = + try (fst o dest_fun_ty o type_of) x_tm with Failure _ -> type_of x_tm in + let ty_list = [x_ty, aty; x_ty, cty] in + let iso_list = map (fun tm, th -> inst ty_list tm, INST_TYPE ty_list th) iso_list0 in + let set, p_tm' = dest_binary "==>" tm in + let set_th = assoc (rand set) iso_list in + let p_tm = mk_abs (x_tm, p_tm') in + let p_var = mk_var ("P", type_of (rand set)) in + let th1 = (SPEC_ALL o ONCE_REWRITE_RULE[RIGHT_IMP_FORALL_THM] o REWRITE_RULE[IMP_IMP]) set_th in + BETA_RULE (INST[p_tm, p_var] th1), ty_list;; + + +(* For an inequality term returns an isomorphism theorem *) +let build_iso_th = + let th_rule th = (UNDISCH_ALL o SPEC_ALL o REWRITE_RULE[RIGHT_IMP_FORALL_THM]) th in + let ths0 = [ + th_rule components_iso_image; + th_rule hyp_iso_comm_special; + th_rule hyp_iso_inv_comm; + th_rule card_face_iso; + th_rule card_face_dart_iso; + th_rule sum_node_iso; + th_rule sum_face_iso; + ] in + let sub_ths0 = [ + `d IN darts_k 3 (G:(B)hypermap)`, (INST[`3`, `k:num`] o th_rule) darts_k_subset; + `d IN darts_k 4 (G:(B)hypermap)`, (INST[`4`, `k:num`] o th_rule) darts_k_subset; + `d IN darts_k 5 (G:(B)hypermap)`, (INST[`5`, `k:num`] o th_rule) darts_k_subset; + `d IN darts_k 6 (G:(B)hypermap)`, (INST[`6`, `k:num`] o th_rule) darts_k_subset; + ] in + + fun ineq -> + let iso_trans_th, ty_list = get_iso_thm ineq in + let th0 = UNDISCH_ALL (PURE_REWRITE_RULE[GSYM IMP_IMP] iso_trans_th) in + let gen_var, rtm = dest_forall(concl th0) in + let ths = map (INST_TYPE ty_list) ths0 and + sub_ths = map (fun tm, th -> inst ty_list tm, INST_TYPE ty_list th) sub_ths0 in + let ants = lhand rtm in + let th1 = UNDISCH (SPEC_ALL th0) in + (* General isomorphism rewrites *) + let th2 = PURE_REWRITE_RULE ths th1 in + let th3 = + try + let sub_th = assoc ants sub_ths in + PROVE_HYP sub_th th2 + with Failure _ -> th2 in + GEN gen_var (DISCH ants th3);; + + +let build_list_th = + let th_rule = (UNDISCH_ALL o INST_TYPE [`:num`, aty; `:num`, `:D`; `:real^3`, `:C`] o + SPEC_ALL o REWRITE_RULE[GSYM IMP_IMP; RIGHT_IMP_FORALL_THM]) in + (* |- !d. d IN set_of_list s ==> P d <=> !d. MEM d s ==> P d *) + let ths_all = map th_rule + [ + sum_node_list_all; + sum_face_list_all; + dart_list_all; + dart3_list_all; + dart4_list_all; + dart5_list_all; + dart6_list_all; + elements_list_all; + ] in + + let ths_more = + [ + th_rule card_face_eq_length_find_face; + th_rule card_set_of_list_face; + th_rule card_set_of_list_node; + th_rule fst_choice_of_list_node; + UNDISCH_ALL (ISPEC `L:((num)list)list` components_hypermap_of_list); + th_rule e_list_ext_eq_e_list; + th_rule fst_iso_trans; + ] in + + let ths_mem = + [ + `MEM (d:num#num) (list_of_darts3 L)`, th_rule list_of_darts3_subset; + `MEM (d:num#num) (list_of_darts4 L)`, th_rule list_of_darts4_subset; + `MEM (d:num#num) (list_of_darts5 L)`, th_rule list_of_darts5_subset; + `MEM (d:num#num) (list_of_darts6 L)`, th_rule list_of_darts6_subset; + ] in + + fun iso_th -> + (* G -> hypermap_of_list (L:((num)list)list) *) + let s1 = INST_TYPE [`:real^3#real^3`, aty; `:num#num`, bty; `:real^3`, `:C`; `:num`, `:D`] iso_th in + let s2 = INST[`hypermap_of_list (L:((num)list)list)`, `G:(num#num)hypermap`; `elements_of_list L:num->bool`, `R:num->bool`] s1 in + (* Convert conditions in the form !d. d IN set_of_list s to !d. MEM d s *) + let s3 = PURE_REWRITE_RULE ths_all s2 in + let gen_var2, rtm = dest_forall (concl s3) in + let ants2 = lhand rtm in + let s4 = UNDISCH (SPEC_ALL s3) in + (* Instantiate all variables *) + let s5 = INST var_inst_list s4 in + (* Additional rewrites *) + let s6 = PURE_REWRITE_RULE ths_more s5 in + let s7 = + try + let mem_th = assoc ants2 ths_mem in + PROVE_HYP mem_th s6 + with Failure _ -> s6 in + let s8 = GEN gen_var2 (DISCH ants2 s7) in + let s9 = PURE_REWRITE_RULE list_var_rewrites s8 in + let s10 = PURE_REWRITE_RULE[ALL_MEM] s9 in + (* Rewrite the main inequality hypothesis with the COMPONENTS_HYPERMAP_OF_FAN theorem *) + let gen_hyp = find is_forall (hyp s10) in + let eq_th = REWRITE_CONV[UNDISCH_ALL (ISPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`] COMPONENTS_HYPERMAP_OF_FAN)] gen_hyp in + let imp_th = if (rand (concl eq_th) = `T`) then EQT_ELIM eq_th else UNDISCH (MATCH_MP EQ_IMP (SYM eq_th)) in + PROVE_HYP imp_th s10;; + + +let generate_ineq ineq_tm = + let th1 = build_iso_th ineq_tm in + build_list_th th1;; + + + +end;; + + +(* +open Lp_gen_ineqs;; + +let test_ineq1 = `!d. d IN dart (H:(A)hypermap) ==> rhazim3_mod d <= pi + sol0`;; +let test_ineq2 = `!f. f IN face_set (H:(A)hypermap) ==> sol_mod f <= &4 * pi`;; +let test_ineq3 = `!f. f IN face_set (H:(A)hypermap) ==> (CARD f = 5 ==> + sum f azim_mod = sol_mod f + &3 * pi)`;; +let test_ineq4 = `!n. n IN node_set (H:(A)hypermap) ==> sum n azim_mod = &2 * pi`;; +let test_ineq5 = `!x. x IN (V:C->bool) ==> ln_mod x = (#2.52 - yn_mod x) / #0.52`;; +let edge_sym = `!d. d IN dart (H:(A)hypermap) ==> ye_mod d = ye_mod (edge_map H d):real`;; +let y1_def = `!d. d IN dart (H:(A)hypermap) ==> y1_mod d = yn_mod (node_mod d:C):real`;; +let y2_def = `!d. d IN dart (H:(A)hypermap) ==> y2_mod d = yn_mod (node_mod (face_map H d):C):real`;; +let y8_def = `!d. d IN dart (H:(A)hypermap) ==> y8_mod d = y5_mod (inverse (face_map H) d):real`;; +let rhazim_sum = `!n. n IN node_set (H:(A)hypermap) ==> sum n rhazim_mod = &2 * pi * rho_mod (node_mod (CHOICE n):C)`;; +let test_ineq6 = `!d. d IN darts_k 4 (H:(A)hypermap) ==> + (((tau_mod (face H d)) + ((#4.72 * (azim_mod d)) - #6.248)) - #0.0) >= #0.0`;; +let test_ineq7 = `!d. d IN dart (H:(A)hypermap) ==> CARD (face H d) = 3 ==> y4_mod d = y8_mod d:real`;; +let test_ineq8 = `!d. d IN dart (H:(A)hypermap) ==> &2 <= y4'_mod d`;; +let test_ineq9 = `!d. d IN darts_k 3 (H:(A)hypermap) ==> y4_mod d = ye_mod (face_map H d):real`;; +let test_ineq10 = `!d. d IN darts_k 3 (H:(A)hypermap) ==> ye_mod d = ye_mod (edge_map H d):real`;; +let test_ineq11 = `!d. d IN darts_k 5 (H:(A)hypermap) ==> tau_mod (face H d) >= #0.4819`;; +let test_ineq12 = `!d. d IN dart (H:(A)hypermap) ==> 3 < CARD (face H d) ==> #2.52 <= y4_mod d`;; + +generate_ineq test_ineq1;; +generate_ineq test_ineq2;; +generate_ineq test_ineq3;; +generate_ineq test_ineq4;; +generate_ineq test_ineq5;; +generate_ineq test_ineq6;; +generate_ineq test_ineq7;; +generate_ineq test_ineq8;; +generate_ineq test_ineq9;; +generate_ineq test_ineq10;; +generate_ineq test_ineq11;; +generate_ineq test_ineq12;; + +generate_ineq edge_sym;; +generate_ineq y1_def;; +generate_ineq y2_def;; +generate_ineq y8_def;; +generate_ineq rhazim_sum;; +*) + diff --git a/formal_lp/hypermap/ineqs/lp_gen_theory-compiled.hl b/formal_lp/hypermap/ineqs/lp_gen_theory-compiled.hl new file mode 100644 index 0000000..5a0cfb9 --- /dev/null +++ b/formal_lp/hypermap/ineqs/lp_gen_theory-compiled.hl @@ -0,0 +1,497 @@ +needs "../formal_lp/hypermap/ssreflect/list_hypermap-compiled.hl";; + +(* Module Lp_gen_theory*) +module Lp_gen_theory = struct + +open Ssrbool;; +open Ssrnat;; +open Seq;; +open Seq2;; +open Fan_defs;; +open Hypermap;; +open Hypermap_and_fan;; +open Hypermap_iso;; +open List_hypermap;; +let list_dart_pairs = new_definition + `list_dart_pairs L = allpairs (\x y. (x,y)) (list_of_darts L) (list_of_darts L)`;; + +(* Lemma mem_list_dart_pairs *) +let mem_list_dart_pairs = Sections.section_proof ["L";"p"] +`MEM p (list_dart_pairs L) + <=> MEM (FST p) (list_of_darts L) /\ MEM (SND p) (list_of_darts L)` +[ + (((((use_arg_then2 ("list_dart_pairs", [list_dart_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("allpairsP", [allpairsP]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)); + ((BETA_TAC THEN (case THEN (move ["p'"])) THEN (case THEN (move ["mem1"])) THEN (case THEN (move ["mem2"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["h"])) THEN ((use_arg_then2 ("p", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma set_of_list_list_dart_pairs *) +let set_of_list_list_dart_pairs = Sections.section_proof ["L"] +`set_of_list (list_dart_pairs L) = (darts_of_list L) CROSS (darts_of_list L)` +[ + ((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["x"]) THEN (move ["y"])))); + (((((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_CROSS", [IN_CROSS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_list_dart_pairs", [mem_list_dart_pairs]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ALL_list_dart_pairs_split *) +let ALL_list_dart_pairs_split = Sections.section_proof ["L";"P"] +`ALL P (list_dart_pairs L) + <=> ALL (\d1. ALL (\d2. P (d1, d2)) (list_of_darts L)) (list_of_darts L)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("ALL_MEM", [ALL_MEM]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (simp_tac) THEN (((use_arg_then2 ("mem_list_dart_pairs", [mem_list_dart_pairs]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((BETA_TAC THEN (move ["h"]) THEN (move ["d1"]) THEN (move ["mem_d1"]) THEN (move ["d2"]) THEN (move ["mem_d2"])) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((BETA_TAC THEN (move ["h"]) THEN (case THEN ((move ["d1"]) THEN (move ["d2"]))) THEN (simp_tac) THEN (move ["mem_ds"])) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Section IsoLemmas *) +Sections.begin_section "IsoLemmas";; +(Sections.add_section_var (mk_var ("G", (`:(B)hypermap`))));; +(Sections.add_section_var (mk_var ("H", (`:(A)hypermap`))));; +(Sections.add_section_var (mk_var ("g", (`:B->A`))));; + +(* Lemma darts_k_subset *) +let darts_k_subset = Sections.section_proof ["k";"d"] +`d IN darts_k k G ==> d IN dart G` +[ + ((((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma face_set_k_subset *) +let face_set_k_subset = Sections.section_proof ["k";"f"] +`f IN face_set_k k G ==> f IN face_set G` +[ + ((((((use_arg_then2 ("face_set_k", [face_set_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(Sections.add_section_hyp "g_iso" (`hyp_iso g (G,H)`));; + +(* Lemma components_iso_image *) +let components_iso_image = Sections.section_proof ["d"] +`d IN dart G ==> + node H (g d) = IMAGE g (node G d) + /\ face H (g d) = IMAGE g (face G d)` +[ + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("iso_components", [iso_components])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma components_iso_image_face_map *) +let components_iso_image_face_map = Sections.section_proof ["d"] +`d IN dart G + ==> node H (g (face_map G d)) = IMAGE g (node G (face_map G d)) + /\ face H (g (face_map G d)) = IMAGE g (face G (face_map G d)) + /\ node H (g (inverse (face_map G) d)) = IMAGE g (node G (inverse (face_map G) d)) + /\ face H (g (inverse (face_map G) d)) = IMAGE g (face G (inverse (face_map G) d))` +[ + ((BETA_TAC THEN (move ["d_in"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("components_iso_image", [components_iso_image]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac ->(use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(fun tmp_arg1 -> (use_arg_then2 ("lemma_dart_inveriant_under_inverse_maps", [lemma_dart_inveriant_under_inverse_maps]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma hyp_iso_comm_special *) +let hyp_iso_comm_special = Sections.section_proof ["d"] +`d IN dart G + ==> face_map H (g d) = g (face_map G d) + /\ node_map H (g d) = g (node_map G d) + /\ edge_map H (g d) = g (edge_map G d) + /\ (!k. (face_map H POWER k) (g d) = g ((face_map G POWER k) d))` +[ + ((BETA_TAC THEN (move ["d_in"])) THEN ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("hyp_iso_comm", [hyp_iso_comm])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)))); + ((THENL_FIRST) ((THENL) elim [ALL_TAC; ((move ["k"]) THEN (move ["Ih"]))]) (((repeat_tactic 1 9 (((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("COM_POWER", [COM_POWER]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_comm", [hyp_iso_comm])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("lemma_dart_invariant_power_face", [lemma_dart_invariant_power_face]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma hyp_iso_inv_comm *) +let hyp_iso_inv_comm = Sections.section_proof ["d"] +`d IN dart G + ==> inverse (face_map H) (g d) = g (inverse (face_map G) d) + /\ inverse (node_map H) (g d) = g (inverse (node_map G) d)` +[ + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_inverse_comm", [hyp_iso_inverse_comm])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma card_face_iso *) +let card_face_iso = Sections.section_proof ["f"] +`f IN face_set G ==> CARD (IMAGE g f) = CARD f` +[ + ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d_in"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> (use_arg_then2 ("iso_components", [iso_components])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_card_components", [hyp_iso_card_components])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma card_face_dart_iso *) +let card_face_dart_iso = Sections.section_proof ["d"] +`d IN dart G ==> CARD (IMAGE g (face G d)) = CARD (face G d)` +[ + ((BETA_TAC THEN (move ["d_in"])) THEN ((((use_arg_then2 ("card_face_iso", [card_face_iso]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma hyp_iso_face_set_k *) +let hyp_iso_face_set_k = Sections.section_proof ["k"] +`face_set_k k H = IMAGE (IMAGE g) (face_set_k k G)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("face_set_k", [face_set_k]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))))) THEN (move ["f"])); + ((((fun arg_tac -> (use_arg_then2 ("iso_face_set", [iso_face_set])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))); + ((THENL) (split_tac) [((case THEN ALL_TAC) THEN (case THEN (move ["f'"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["f'_in"]) THEN (move ["card_f'"])); ((case THEN (move ["f'"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["h"]))]); + (((use_arg_then2 ("f'", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("card_face_iso", [card_face_iso]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("card_face_iso", [card_face_iso]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("f'", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma hyp_iso_darts_k_eq *) +let hyp_iso_darts_k_eq = Sections.section_proof ["k"] +`darts_k k H = IMAGE g (darts_k k G)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("darts_k_union_face_set_k", [darts_k_union_face_set_k]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IMAGE_UNIONS", [IMAGE_UNIONS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hyp_iso_face_set_k", [hyp_iso_face_set_k]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma hyp_iso_darts_k *) +let hyp_iso_darts_k = Sections.section_proof ["k";"d"] +`d IN darts_k k G ==> g d IN darts_k k H` +[ + ((((((use_arg_then2 ("hyp_iso_darts_k_eq", [hyp_iso_darts_k_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (move ["d_in"])) THEN ((use_arg_then2 ("d", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma sum_node_iso *) +let sum_node_iso = Sections.section_proof ["r";"n"] +`n IN node_set G ==> sum (IMAGE g n) r = sum n (r o g)` +[ + ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_node_representation", [lemma_node_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d_in"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("lemma_node_subset", [lemma_node_subset])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["x_in"]))); + ((((((use_arg_then2 ("SUM_IMAGE", [SUM_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("x_in", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (move ["xG"]) THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("x_in", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (move ["yG"]) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sum_face_iso *) +let sum_face_iso = Sections.section_proof ["r";"f"] +`f IN face_set G ==> sum (IMAGE g f) r = sum f (r o g)` +[ + ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d_in"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("lemma_face_subset", [lemma_face_subset])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["x_in"]))); + ((((((use_arg_then2 ("SUM_IMAGE", [SUM_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("x_in", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (move ["xG"]) THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("x_in", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (move ["yG"]) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma iso_dart_trans *) +let iso_dart_trans = Sections.section_proof ["P"] +`(!d. d IN dart H ==> P d) ==> (!d. d IN dart G ==> P (g d))` +[ + ((BETA_TAC THEN (move ["h"]) THEN (move ["d"]) THEN (move ["d_in"])) THEN ((((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma iso_darts_k_trans *) +let iso_darts_k_trans = Sections.section_proof ["k";"P"] +`(!d. d IN darts_k k H ==> P d) + ==> (!d. d IN darts_k k G ==> P (g d))` +[ + ((BETA_TAC THEN (move ["h"]) THEN (move ["d"]) THEN (move ["d_in"])) THEN ((((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hyp_iso_darts_k", [hyp_iso_darts_k]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma iso_dart_pairs_trans *) +let iso_dart_pairs_trans = Sections.section_proof ["P"] +`(!p. p IN dart H CROSS dart H ==> P p) + ==> (!p. p IN dart G CROSS dart G ==> P (g (FST p), g (SND p)))` +[ + ((BETA_TAC THEN (move ["h"]) THEN (case THEN ((move ["x"]) THEN (move ["y"])))) THEN ((((use_arg_then2 ("IN_CROSS", [IN_CROSS]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["x_in"]) THEN (move ["y_in"]))) THEN (simp_tac))); + (((((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_CROSS", [IN_CROSS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma iso_face_trans *) +let iso_face_trans = Sections.section_proof ["P"] +`(!f. f IN face_set H ==> P f) + ==> (!f. f IN face_set G ==> P (IMAGE g f))` +[ + ((((((fun arg_tac -> (use_arg_then2 ("iso_face_set", [iso_face_set])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (move ["h"]) THEN (move ["f"]) THEN (move ["f_in"])) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("f", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma iso_node_trans *) +let iso_node_trans = Sections.section_proof ["P"] +`(!n. n IN node_set H ==> P n) + ==> (!n. n IN node_set G ==> P (IMAGE g n))` +[ + ((((((fun arg_tac -> (use_arg_then2 ("iso_node_set", [iso_node_set])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (move ["h"]) THEN (move ["n"]) THEN (move ["n_in"])) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("n", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma iso_face_k_trans *) +let iso_face_k_trans = Sections.section_proof ["k";"P"] +`(!f. f IN face_set_k k H ==> P f) + ==> (!f. f IN face_set_k k G ==> P (IMAGE g f))` +[ + ((((((use_arg_then2 ("hyp_iso_face_set_k", [hyp_iso_face_set_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (move ["h"]) THEN (move ["f"]) THEN (move ["f_in"])) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("f", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Finalization of the section IsoLemmas *) +let darts_k_subset = Sections.finalize_theorem darts_k_subset;; +let face_set_k_subset = Sections.finalize_theorem face_set_k_subset;; +let components_iso_image = Sections.finalize_theorem components_iso_image;; +let components_iso_image_face_map = Sections.finalize_theorem components_iso_image_face_map;; +let hyp_iso_comm_special = Sections.finalize_theorem hyp_iso_comm_special;; +let hyp_iso_inv_comm = Sections.finalize_theorem hyp_iso_inv_comm;; +let card_face_iso = Sections.finalize_theorem card_face_iso;; +let card_face_dart_iso = Sections.finalize_theorem card_face_dart_iso;; +let hyp_iso_face_set_k = Sections.finalize_theorem hyp_iso_face_set_k;; +let hyp_iso_darts_k_eq = Sections.finalize_theorem hyp_iso_darts_k_eq;; +let hyp_iso_darts_k = Sections.finalize_theorem hyp_iso_darts_k;; +let sum_node_iso = Sections.finalize_theorem sum_node_iso;; +let sum_face_iso = Sections.finalize_theorem sum_face_iso;; +let iso_dart_trans = Sections.finalize_theorem iso_dart_trans;; +let iso_darts_k_trans = Sections.finalize_theorem iso_darts_k_trans;; +let iso_dart_pairs_trans = Sections.finalize_theorem iso_dart_pairs_trans;; +let iso_face_trans = Sections.finalize_theorem iso_face_trans;; +let iso_node_trans = Sections.finalize_theorem iso_node_trans;; +let iso_face_k_trans = Sections.finalize_theorem iso_face_k_trans;; +Sections.end_section "IsoLemmas";; + +(* Section BijLemmas *) +Sections.begin_section "BijLemmas";; +(Sections.add_section_var (mk_var ("h", (`:D->C`))));; + +(* Lemma bij_trans *) +let bij_trans = Sections.section_proof ["R";"V"] +`BIJ h R V + ==> !P. (!x. x IN V ==> P x) ==> (!x. x IN R ==> P (h x))` +[ + ((((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] []))))) THEN (move ["bij_h"]) THEN (move ["p"]) THEN (move ["h"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bij_h", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fst_iso_trans *) +let fst_iso_trans = Sections.section_proof ["g"] +`(!d. g d = h (FST d), h (SND d)) + ==> (!d. FST (g d) = h (FST d))` +[ + ((BETA_TAC THEN (move ["g_eq"]) THEN (move ["d"])) THEN ((((use_arg_then2 ("g_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section BijLemmas *) +let bij_trans = Sections.finalize_theorem bij_trans;; +let fst_iso_trans = Sections.finalize_theorem fst_iso_trans;; +Sections.end_section "BijLemmas";; + +(* Lemma list_sum_set_of_list_gen *) +let list_sum_set_of_list_gen = Sections.section_proof ["s"] +`uniq s ==> list_sum s = sum (set_of_list s)` +[ + ((BETA_TAC THEN (move ["uniq_s"])) THEN ((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (move ["f"])) THEN (((use_arg_then2 ("list_sum_set_of_list", [list_sum_set_of_list]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Section ListLemmas *) +Sections.begin_section "ListLemmas";; +(Sections.add_section_var (mk_var ("L", (`:((A)list)list`))));; + +(* Lemma list_of_faces3_subset *) +let list_of_faces3_subset = Sections.section_proof ["f"] +`MEM f (list_of_faces3 L) ==> MEM f (list_of_faces L)` +[ + ((((((use_arg_then2 ("list_of_faces3", [list_of_faces3]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_of_faces4_subset *) +let list_of_faces4_subset = Sections.section_proof ["f"] +`MEM f (list_of_faces4 L) ==> MEM f (list_of_faces L)` +[ + ((((((use_arg_then2 ("list_of_faces4", [list_of_faces4]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_of_faces5_subset *) +let list_of_faces5_subset = Sections.section_proof ["f"] +`MEM f (list_of_faces5 L) ==> MEM f (list_of_faces L)` +[ + ((((((use_arg_then2 ("list_of_faces5", [list_of_faces5]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_of_faces6_subset *) +let list_of_faces6_subset = Sections.section_proof ["f"] +`MEM f (list_of_faces6 L) ==> MEM f (list_of_faces L)` +[ + ((((((use_arg_then2 ("list_of_faces6", [list_of_faces6]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_of_darts3_subset *) +let list_of_darts3_subset = Sections.section_proof ["d"] +`MEM d (list_of_darts3 L) ==> MEM d (list_of_darts L)` +[ + ((((use_arg_then2 ("list_of_darts3", [list_of_darts3]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_darts_alt", [list_of_darts_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_faces3", [list_of_faces3]))(thm_tac (new_rewrite [] []))))); + ((((repeat_tactic 1 9 (((use_arg_then2 ("mem_flatten", [mem_flatten]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["l"])) THEN (move ["h"])) THEN ((use_arg_then2 ("l", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma list_of_darts4_subset *) +let list_of_darts4_subset = Sections.section_proof ["d"] +`MEM d (list_of_darts4 L) ==> MEM d (list_of_darts L)` +[ + ((((use_arg_then2 ("list_of_darts4", [list_of_darts4]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_darts_alt", [list_of_darts_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_faces4", [list_of_faces4]))(thm_tac (new_rewrite [] []))))); + ((((repeat_tactic 1 9 (((use_arg_then2 ("mem_flatten", [mem_flatten]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["l"])) THEN (move ["h"])) THEN ((use_arg_then2 ("l", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma list_of_darts5_subset *) +let list_of_darts5_subset = Sections.section_proof ["d"] +`MEM d (list_of_darts5 L) ==> MEM d (list_of_darts L)` +[ + ((((use_arg_then2 ("list_of_darts5", [list_of_darts5]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_darts_alt", [list_of_darts_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_faces5", [list_of_faces5]))(thm_tac (new_rewrite [] []))))); + ((((repeat_tactic 1 9 (((use_arg_then2 ("mem_flatten", [mem_flatten]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["l"])) THEN (move ["h"])) THEN ((use_arg_then2 ("l", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma list_of_darts6_subset *) +let list_of_darts6_subset = Sections.section_proof ["d"] +`MEM d (list_of_darts6 L) ==> MEM d (list_of_darts L)` +[ + ((((use_arg_then2 ("list_of_darts6", [list_of_darts6]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_darts_alt", [list_of_darts_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_faces6", [list_of_faces6]))(thm_tac (new_rewrite [] []))))); + ((((repeat_tactic 1 9 (((use_arg_then2 ("mem_flatten", [mem_flatten]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["l"])) THEN (move ["h"])) THEN ((use_arg_then2 ("l", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma list_of_dart_pairs_subset *) +let list_of_dart_pairs_subset = Sections.section_proof ["p"] +`MEM p (list_dart_pairs L) + ==> MEM (FST p) (list_of_darts L) /\ MEM (SND p) (list_of_darts L)` +[ + ((((((use_arg_then2 ("list_dart_pairs", [list_dart_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("allpairsP", [allpairsP]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["p'"])) THEN (case THEN (move ["mem1"])) THEN (case THEN (move ["mem2"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma e_list_ext_eq_e_list *) +let e_list_ext_eq_e_list = Sections.section_proof ["d"] +`MEM d (list_of_darts L) ==> e_list_ext L d = e_list d` +[ + ((((((use_arg_then2 ("e_list_ext", [e_list_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fst_choice_of_list_node *) +let fst_choice_of_list_node = Sections.section_proof ["g";"h";"n"] +`MEM n (list_of_nodes L) + /\ (!d. g d = h (FST d), h (SND d):C) + ==> FST (CHOICE (IMAGE g (set_of_list n))) = FST (g (HD n))` +[ + (BETA_TAC THEN (case THEN (move ["mem_n"])) THEN (move ["g_eq"])); + ((fun arg_tac -> arg_tac (Arg_term (`CHOICE _`))) (term_tac (set_tac "x"))); + ((fun arg_tac -> arg_tac (Arg_term (`HD n`))) (term_tac (set_tac "y"))); + ((fun arg_tac -> arg_tac (Arg_term (`x IN IMAGE g (set_of_list n)`))) (term_tac (have_gen_tac []ALL_TAC))); + (((((use_arg_then2 ("x_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("CHOICE_DEF", [CHOICE_DEF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IMAGE_EQ_EMPTY", [IMAGE_EQ_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SET_OF_LIST_EQ_EMPTY", [SET_OF_LIST_EQ_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("node_of_list_not_nil", [node_of_list_not_nil])) (fun fst_arg -> (use_arg_then2 ("mem_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["mem_d"])); + ((fun arg_tac -> arg_tac (Arg_term (`MEM y n`))) (term_tac (have_gen_tac [](move ["mem_y"])))); + (((use_arg_then2 ("y_def", []))(gsym_then (thm_tac (new_rewrite [] []))))); + ((((THENL) (((fun arg_tac -> (use_arg_then2 ("node_of_list_not_nil", [node_of_list_not_nil])) (fun fst_arg -> (use_arg_then2 ("mem_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]))]) THEN ((TRY done_tac))) THEN ((((use_arg_then2 ("HD", [HD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("mem_n", [])) (disch_tac [])) THEN (clear_assumption "mem_n") THEN BETA_TAC) THEN (((((use_arg_then2 ("list_of_nodes", [list_of_nodes]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("map_MAP", [map_MAP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mapP", [mapP]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["_"])) THEN (simp_tac) THEN (move ["n_eq"]))); + ((((use_arg_then2 ("mem_d", [])) (disch_tac [])) THEN (clear_assumption "mem_d") THEN ((use_arg_then2 ("mem_y", [])) (disch_tac [])) THEN (clear_assumption "mem_y") THEN BETA_TAC) THEN (((((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("g_eq", []))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["_"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(Sections.add_section_hyp "goodL" (`good_list L`));; + +(* Lemma card_set_of_list_node *) +let card_set_of_list_node = Sections.section_proof ["n"] +`MEM n (list_of_nodes L) ==> CARD (set_of_list n) = LENGTH n` +[ + ((BETA_TAC THEN (move ["mem_n"])) THEN ((((use_arg_then2 ("card_set_of_list_uniq", [card_set_of_list_uniq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("uniq_node", [uniq_node])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("Seq.size", [Seq.size]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma card_set_of_list_face *) +let card_set_of_list_face = Sections.section_proof ["f"] +`MEM f (list_of_faces L) ==> CARD (set_of_list f) = LENGTH f` +[ + ((BETA_TAC THEN (move ["mem_n"])) THEN ((((use_arg_then2 ("card_set_of_list_uniq", [card_set_of_list_uniq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("uniq_face", [uniq_face])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("Seq.size", [Seq.size]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma card_face_eq_length_find_face *) +let card_face_eq_length_find_face = Sections.section_proof ["d"] +`MEM d (list_of_darts L) + ==> CARD (face (hypermap_of_list L) d) = LENGTH (find_face L d)` +[ + ((BETA_TAC THEN (move ["mem_d"])) THEN ((((use_arg_then2 ("face_of_list", [face_of_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("card_set_of_list_uniq", [card_set_of_list_uniq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("Seq.size", [Seq.size]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("goodL", [])) (disch_tac [])) THEN (clear_assumption "goodL") THEN BETA_TAC) THEN ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN (move ["goodL"])) THEN (((use_arg_then2 ("uniq_find_face", [uniq_find_face]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma dart_list_all *) +let dart_list_all = Sections.section_proof ["P"] +`(!d. d IN dart (hypermap_of_list L) ==> P d) + <=> (!d. MEM d (list_of_darts L) ==> P d)` +[ + (((((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dart3_list_all *) +let dart3_list_all = Sections.section_proof ["P"] +`(!d. d IN darts_k 3 (hypermap_of_list L) ==> P d) + <=> (!d. MEM d (list_of_darts3 L) ==> P d)` +[ + (((((use_arg_then2 ("darts3_eq_list_of_darts3", [darts3_eq_list_of_darts3]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dart4_list_all *) +let dart4_list_all = Sections.section_proof ["P"] +`(!d. d IN darts_k 4 (hypermap_of_list L) ==> P d) + <=> (!d. MEM d (list_of_darts4 L) ==> P d)` +[ + (((((use_arg_then2 ("darts4_eq_list_of_darts4", [darts4_eq_list_of_darts4]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dart5_list_all *) +let dart5_list_all = Sections.section_proof ["P"] +`(!d. d IN darts_k 5 (hypermap_of_list L) ==> P d) + <=> (!d. MEM d (list_of_darts5 L) ==> P d)` +[ + (((((use_arg_then2 ("darts5_eq_list_of_darts5", [darts5_eq_list_of_darts5]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dart6_list_all *) +let dart6_list_all = Sections.section_proof ["P"] +`(!d. d IN darts_k 6 (hypermap_of_list L) ==> P d) + <=> (!d. MEM d (list_of_darts6 L) ==> P d)` +[ + (((((use_arg_then2 ("darts6_eq_list_of_darts6", [darts6_eq_list_of_darts6]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dart_pairs_list_all *) +let dart_pairs_list_all = Sections.section_proof ["P"] +`(!p. p IN dart (hypermap_of_list L) CROSS dart (hypermap_of_list L) ==> P p) + <=> (!p. MEM p (list_dart_pairs L) ==> P p)` +[ + (((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_of_list_list_dart_pairs", [set_of_list_list_dart_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma elements_list_all *) +let elements_list_all = Sections.section_proof ["P"] +`(!x. x IN elements_of_list L ==> P x) + <=> (!x. MEM x (list_of_elements L) ==> P x)` +[ + (((((use_arg_then2 ("elements_of_list", [elements_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sum_node_list_all *) +let sum_node_list_all = Sections.section_proof ["P"] +`good_list_nodes L + ==> ((!n. n IN node_set (hypermap_of_list L) ==> P n (sum n)) + <=> (!n. MEM n (list_of_nodes L) ==> P (set_of_list n) (list_sum n)))` +[ + (((((use_arg_then2 ("good_list_nodes", [good_list_nodes]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nodes_of_list", [nodes_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("map_MAP", [map_MAP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mapP", [mapP]))(thm_tac (new_rewrite [] [])))))); + ((THENL) (split_tac) [((move ["h"]) THEN (move ["n"]) THEN (move ["mem_n"])); ((move ["h"]) THEN (move ["t"]) THEN (case THEN (move ["n"])) THEN (case THEN (move ["mem_n"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))]); + (((((use_arg_then2 ("list_sum_set_of_list_gen", [list_sum_set_of_list_gen]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("uniq_node", [uniq_node])) (fun fst_arg -> (use_arg_then2 ("mem_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("n", [])) (term_tac exists_tac)) THEN (done_tac)); + (((((use_arg_then2 ("list_sum_set_of_list_gen", [list_sum_set_of_list_gen]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("uniq_node", [uniq_node])) (fun fst_arg -> (use_arg_then2 ("mem_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sum_face_list_all *) +let sum_face_list_all = Sections.section_proof ["P"] +`(!f. f IN face_set (hypermap_of_list L) ==> P f (sum f)) + <=> (!f. MEM f (list_of_faces L) ==> P (set_of_list f) (list_sum f))` +[ + ((((use_arg_then2 ("face_set_eq_list", [face_set_eq_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("faces_of_list", [faces_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("map_MAP", [map_MAP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mapP", [mapP]))(thm_tac (new_rewrite [] []))))); + ((THENL) (split_tac) [((move ["h"]) THEN (move ["f"]) THEN (move ["mem_f"])); ((move ["h"]) THEN (move ["t"]) THEN (case THEN (move ["f"])) THEN (case THEN (move ["mem_f"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))]); + (((((use_arg_then2 ("list_sum_set_of_list_gen", [list_sum_set_of_list_gen]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("uniq_face", [uniq_face])) (fun fst_arg -> (use_arg_then2 ("mem_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("f", [])) (term_tac exists_tac)) THEN (done_tac)); + (((((use_arg_then2 ("list_sum_set_of_list_gen", [list_sum_set_of_list_gen]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("uniq_face", [uniq_face])) (fun fst_arg -> (use_arg_then2 ("mem_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section ListLemmas *) +let list_of_faces3_subset = Sections.finalize_theorem list_of_faces3_subset;; +let list_of_faces4_subset = Sections.finalize_theorem list_of_faces4_subset;; +let list_of_faces5_subset = Sections.finalize_theorem list_of_faces5_subset;; +let list_of_faces6_subset = Sections.finalize_theorem list_of_faces6_subset;; +let list_of_darts3_subset = Sections.finalize_theorem list_of_darts3_subset;; +let list_of_darts4_subset = Sections.finalize_theorem list_of_darts4_subset;; +let list_of_darts5_subset = Sections.finalize_theorem list_of_darts5_subset;; +let list_of_darts6_subset = Sections.finalize_theorem list_of_darts6_subset;; +let list_of_dart_pairs_subset = Sections.finalize_theorem list_of_dart_pairs_subset;; +let e_list_ext_eq_e_list = Sections.finalize_theorem e_list_ext_eq_e_list;; +let fst_choice_of_list_node = Sections.finalize_theorem fst_choice_of_list_node;; +let card_set_of_list_node = Sections.finalize_theorem card_set_of_list_node;; +let card_set_of_list_face = Sections.finalize_theorem card_set_of_list_face;; +let card_face_eq_length_find_face = Sections.finalize_theorem card_face_eq_length_find_face;; +let dart_list_all = Sections.finalize_theorem dart_list_all;; +let dart3_list_all = Sections.finalize_theorem dart3_list_all;; +let dart4_list_all = Sections.finalize_theorem dart4_list_all;; +let dart5_list_all = Sections.finalize_theorem dart5_list_all;; +let dart6_list_all = Sections.finalize_theorem dart6_list_all;; +let dart_pairs_list_all = Sections.finalize_theorem dart_pairs_list_all;; +let elements_list_all = Sections.finalize_theorem elements_list_all;; +let sum_node_list_all = Sections.finalize_theorem sum_node_list_all;; +let sum_face_list_all = Sections.finalize_theorem sum_face_list_all;; +Sections.end_section "ListLemmas";; + +(* Close the module *) +end;; diff --git a/formal_lp/hypermap/ineqs/lp_head_ineqs.hl b/formal_lp/hypermap/ineqs/lp_head_ineqs.hl new file mode 100644 index 0000000..b9dd52d --- /dev/null +++ b/formal_lp/hypermap/ineqs/lp_head_ineqs.hl @@ -0,0 +1,406 @@ +needs "../formal_lp/hypermap/ineqs/lp_ineqs.hl";; + + +module Lp_head_ineqs = struct + +open Lp_ineqs;; + +let add_head_ineqs () = + let _ = map add_lp_ineq_str + [ + "azim_lo", false, + "!d. d IN dart H ==> &0 <= azim_mod d", + Some Lp_ineqs_proofs.azim_lo; + + "azim_hi", false, + "!d. d IN dart H ==> azim_mod d <= pi", + Some Lp_ineqs_proofs.azim_hi; + + "azim2_lo", false, + "!d. d IN dart H ==> &0 <= azim2_mod d", + Some Lp_ineqs_proofs.azim2_lo; + + "azim2_hi", false, + "!d. d IN dart H ==> azim2_mod d <= pi", + Some Lp_ineqs_proofs.azim2_hi; + + "azim3_lo", false, + "!d. d IN dart H ==> &0 <= azim3_mod d", + Some Lp_ineqs_proofs.azim3_lo; + + "azim3_hi", false, + "!d. d IN dart H ==> azim3_mod d <= pi", + Some Lp_ineqs_proofs.azim3_hi; + + "rhazim_lo", false, + "!d. d IN dart H ==> &0 <= rhazim_mod d", + Some Lp_ineqs_proofs.rhazim_lo; + + "rhazim_hi", false, + "!d. d IN dart H ==> rhazim_mod d <= pi + sol0", + Some Lp_ineqs_proofs.rhazim_hi; + + "rhazim2_lo", false, + "!d. d IN dart H ==> &0 <= rhazim2_mod d", + Some Lp_ineqs_proofs.rhazim2_lo; + + "rhazim2_hi", false, + "!d. d IN dart H ==> rhazim2_mod d <= pi + sol0", + Some Lp_ineqs_proofs.rhazim2_hi; + + "rhazim3_lo", false, + "!d. d IN dart H ==> &0 <= rhazim3_mod d", + Some Lp_ineqs_proofs.rhazim3_lo; + + "rhazim3_hi", false, + "!d. d IN dart H ==> rhazim3_mod d <= pi + sol0", + Some Lp_ineqs_proofs.rhazim3_hi; + + "ln_lo", false, + "!x. x IN V ==> &0 <= ln_mod x", + Some Lp_ineqs_proofs.ln_lo; + + "ln_hi", false, + "!x. x IN V ==> ln_mod x <= &1", + Some Lp_ineqs_proofs.ln_hi; + + "rho_lo", false, + "!x. x IN V ==> &1 <= rho_mod x", + Some Lp_ineqs_proofs.rho_lo; + + "rho_hi", false, + "!x. x IN V ==> rho_mod x <= &1 + sol0 / pi", + Some Lp_ineqs_proofs.rho_hi; + + "yn_lo", false, + "!x. x IN V ==> &2 <= yn_mod x", + Some Lp_ineqs_proofs.yn_lo; + + "yn_hi", false, + "!x. x IN V ==> yn_mod x <= #2.52", + Some Lp_ineqs_proofs.yn_hi; + + "ye_lo", false, + "!d. d IN dart H ==> &2 <= ye_mod d", + Some Lp_ineqs_proofs.ye_lo; + + "ye_hi", false, + "!d. d IN dart H ==> ye_mod d <= &3 ==> ye_mod d <= &3", + None; + + "ye_hi", true, + "!d. d IN dart H ==> ye_mod d <= &3", + Some Lp_ineqs_proofs.ye_hi_std; + + "y1_lo", false, + "!d. d IN dart H ==> &2 <= y1_mod d", + Some Lp_ineqs_proofs.y1_lo; + + "y1_hi", false, + "!d. d IN dart H ==> y1_mod d <= #2.52", + Some Lp_ineqs_proofs.y1_hi; + + "y2_lo", false, + "!d. d IN dart H ==> &2 <= y2_mod d", + Some Lp_ineqs_proofs.y2_lo; + + "y2_hi", false, + "!d. d IN dart H ==> y2_mod d <= #2.52", + Some Lp_ineqs_proofs.y2_hi; + + "y3_lo", false, + "!d. d IN dart H ==> &2 <= y3_mod d", + Some Lp_ineqs_proofs.y3_lo; + + "y3_hi", false, + "!d. d IN dart H ==> y3_mod d <= #2.52", + Some Lp_ineqs_proofs.y3_hi; + + "y4_lo", false, + "!d. d IN dart H ==> &2 <= y4_mod d", + Some Lp_ineqs_proofs.y4_lo; + + "y5_lo", false, + "!d. d IN dart H ==> &2 <= y5_mod d", + Some Lp_ineqs_proofs.y5_lo; + + "y6_lo", false, + "!d. d IN dart H ==> &2 <= y6_mod d", + Some Lp_ineqs_proofs.y6_lo; + + "y8_lo", false, + "!d. d IN dart H ==> &2 <= y8_mod d", + Some Lp_ineqs_proofs.y8_lo; + + "y9_lo", false, + "!d. d IN dart H ==> &2 <= y9_mod d", + Some Lp_ineqs_proofs.y9_lo; + + "y4_hi", false, + "!d. d IN dart H ==> y4_mod d <= &3 ==> y4_mod d <= &3", + None; + + "y5_hi", false, + "!d. d IN dart H ==> y5_mod d <= &3==> y5_mod d <= &3", + None; + + "y6_hi", false, + "!d. d IN dart H ==> y6_mod d <= &3==> y6_mod d <= &3", + None; + + "y8_hi", false, + "!d. d IN dart H ==> y8_mod d <= #2.52==> y8_mod d <= #2.52", + None; + + "y9_hi", false, + "!d. d IN dart H ==> y9_mod d <= #2.52==> y9_mod d <= #2.52", + None; + + "y4_hi", true, + "!d. d IN dart H ==> y4_mod d <= &3", + Some Lp_ineqs_proofs.y4_hi_std; + + "y5_hi", true, + "!d. d IN dart H ==> y5_mod d <= &3", + Some Lp_ineqs_proofs.y5_hi_std; + + "y6_hi", true, + "!d. d IN dart H ==> y6_mod d <= &3", + Some Lp_ineqs_proofs.y6_hi_std; + + "y8_hi", true, + "!d. d IN dart H ==> y8_mod d <= #2.52", + Some Lp_ineqs_proofs.y8_hi_std; + + "y9_hi", true, + "!d. d IN dart H ==> y9_mod d <= #2.52", + Some Lp_ineqs_proofs.y9_hi_std; + + "sol_lo", false, + "!f. f IN face_set H ==> &0 <= sol_mod f", + Some Lp_ineqs_proofs.sol_lo; + + "sol_hi", false, + "!f. f IN face_set H ==> sol_mod f <= &4 * pi", + Some Lp_ineqs_proofs.sol_hi; + + "tau_lo", false, + "!f. f IN face_set H ==> &0 <= tau_mod f", + Some Lp_ineqs_proofs.tau_lo; + + "tau_hi", false, + "!f. f IN face_set H ==> tau_mod f <= tgt", + Some Lp_ineqs_proofs.tau_hi; + + "azim_sum", false, + "!n. n IN node_set H ==> sum n azim_mod = &2 * pi", + Some Lp_ineqs_proofs.azim_sum; + + "rhazim_sum", false, + "!n. n IN node_set H ==> sum n rhazim_mod = &2 * pi * rho_mod (node_mod (CHOICE n))", + Some Lp_ineqs_proofs.rhazim_sum; + + "sol_sum3", false, + "!f. f IN face_set H ==> (CARD f = 3 ==> sum f azim_mod = sol_mod f + pi)", + Some Lp_ineqs_proofs.sol_sum3; + + "sol_sum4", false, + "!f. f IN face_set H ==> (CARD f = 4 ==> sum f azim_mod = sol_mod f + &2 * pi)", + Some Lp_ineqs_proofs.sol_sum4; + + "sol_sum5", false, + "!f. f IN face_set H ==> (CARD f = 5 ==> sum f azim_mod = sol_mod f + &3 * pi)", + Some Lp_ineqs_proofs.sol_sum5; + + "sol_sum6", false, + "!f. f IN face_set H ==> (CARD f = 6 ==> sum f azim_mod = sol_mod f + &4 * pi)", + Some Lp_ineqs_proofs.sol_sum6; + + "tau_sum3", false, + "!f. f IN face_set H ==> (CARD f = 3 ==> sum f rhazim_mod = tau_mod f + (pi + sol0))", + Some Lp_ineqs_proofs.tau_sum3; + + "tau_sum4", false, + "!f. f IN face_set H ==> (CARD f = 4 ==> sum f rhazim_mod = tau_mod f + &2 * (pi + sol0))", + Some Lp_ineqs_proofs.tau_sum4; + + "tau_sum5", false, + "!f. f IN face_set H ==> (CARD f = 5 ==> sum f rhazim_mod = tau_mod f + &3 * (pi + sol0))", + Some Lp_ineqs_proofs.tau_sum5; + + "tau_sum6", false, + "!f. f IN face_set H ==> (CARD f = 6 ==> sum f rhazim_mod = tau_mod f + &4 * (pi + sol0))", + Some Lp_ineqs_proofs.tau_sum6; + + "ln_def", false, + "!x. x IN V ==> ln_mod x = (#2.52 - yn_mod x) / #0.52", + Some Lp_ineqs_proofs.ln_def; + "rho_def", false, + "!x. x IN V ==> rho_mod x = (&1 + sol0 / pi) - ln_mod x * sol0 / pi", + Some Lp_ineqs_proofs.rho_def; + "edge_sym", false, + "!d. d IN dart H ==> ye_mod d = ye_mod (edge_map H d):real", + Some Lp_ineqs_proofs.edge_sym; + + "y1_def", false, + "!d. d IN dart H ==> y1_mod d = yn_mod (node_mod d):real", + Some Lp_ineqs_proofs.y1_def; + + "y2_def", false, + "!d. d IN dart H ==> y2_mod d = yn_mod (node_mod (face_map H d)):real", + Some Lp_ineqs_proofs.y2_def; + + "y3_def", false, + "!d. d IN dart H ==> y3_mod d = yn_mod (node_mod (inverse (face_map H) d)):real", + Some Lp_ineqs_proofs.y3_def; + + "y4_def", false, + "!d. d IN dart H ==> y4_mod d = ye_mod (face_map H d):real", + Some Lp_ineqs_proofs.y4_def; + + "y5_def", false, + "!d. d IN dart H ==> y5_mod d = ye_mod (inverse (face_map H) d):real", + Some Lp_ineqs_proofs.y5_def; + + "y6_def", false, + "!d. d IN dart H ==> y6_mod d = ye_mod d:real", + Some Lp_ineqs_proofs.y6_def; + + "y8_def", false, + "!d. d IN dart H ==> y8_mod d = y5_mod (inverse (face_map H) d):real", + Some Lp_ineqs_proofs.y8_def; + + "y9_def", false, + "!d. d IN dart H ==> y9_mod d = ye_mod (face_map H d):real", + Some Lp_ineqs_proofs.y9_def; + + "azim2c", false, + "!d. d IN dart H ==> azim2_mod d = azim_mod (face_map H d):real", + Some Lp_ineqs_proofs.azim2c; + + "azim3c", false, + "!d. d IN dart H ==> azim3_mod d = azim_mod (inverse (face_map H) d):real", + Some Lp_ineqs_proofs.azim3c; + + "rhazim2c", false, + "!d. d IN dart H ==> rhazim2_mod d = rhazim_mod (face_map H d):real", + Some Lp_ineqs_proofs.rhazim2c; + + "rhazim3c", false, + "!d. d IN dart H ==> rhazim3_mod d = rhazim_mod (inverse (face_map H) d):real", + Some Lp_ineqs_proofs.rhazim3c; + + "RHA", false, + "!d. d IN dart H ==> rhazim_mod d >= azim_mod d:real", + Some Lp_ineqs_proofs.RHA; + + "RHB", false, + "!d. d IN dart H ==> rhazim_mod d <= azim_mod d * (&1 + sol0 / pi)", + Some Lp_ineqs_proofs.RHB; + + "RHBLO", false, + "!d. d IN dart H ==> yn_mod (node_mod d) <= #2.18 ==> rhazim_mod d <= azim_mod d * rho218", + Some Lp_ineqs_proofs.RHBLO; + + "RHBHI", false, + "!d. d IN dart H ==> #2.18 <= yn_mod (node_mod d) ==> rhazim_mod d >= azim_mod d * rho218", + Some Lp_ineqs_proofs.RHBHI; + + "yy1", false, + "!d. d IN darts_k 3 H ==> #6.25 <= y4_mod d + y5_mod d + y6_mod d ==> #6.25 <= y4_mod d + y5_mod d + y6_mod d", + None; + + "yy2", false, + "!d. d IN darts_k 3 H ==> y4_mod d + y5_mod d + y6_mod d <= #6.25 ==> y4_mod d + y5_mod d + y6_mod d <= #6.25", + None; + + "yy3", false, + "!x. x IN V ==> #2.18 <= yn_mod x ==> #2.18 <= yn_mod x", + None; + + "yy4", false, + "!x. x IN V ==> yn_mod x <= #2.18 ==> yn_mod x <= #2.18", + None; + + "yy5", false, + "!x. x IN V ==> #2.36 <= yn_mod x ==> #2.36 <= yn_mod x", + None; + + "yy6", false, + "!x. x IN V ==> yn_mod x <= #2.36 ==> yn_mod x <= #2.36", + None; + + "yy7", false, + "!x. x IN V ==> #2.18 <= yn_mod x ==> #2.18 <= yn_mod x", + None; + + "yy8", false, + "!d. d IN dart H ==> #2.25 <= ye_mod d ==> #2.25 <= ye_mod d", + None; + + "yy9", false, + "!d. d IN dart H ==> ye_mod d <= #2.25 ==> ye_mod d <= #2.25", + None; + + "yy10", false, + "!d. d IN dart H ==> ye_mod d <= #2.52 ==> ye_mod d <= #2.52", + None; + + "yy10", true, + "!d. d IN dart H ==> ye_mod d <= #2.52", + Some Lp_ineqs_proofs.yy10_std; + + "yy11", false, + "!d. d IN darts_k 3 H ==> #2.52 <= y4_mod d ==> #2.52 <= y4_mod d", + None; + + "yy12", false, + "!d. d IN darts_k 3 H ==> sqrt8 <= y4_mod d ==> sqrt8 <= y4_mod d", + None; + + "yy13", false, + "!d. d IN darts_k 3 H ==> y5_mod d <= #2.52 ==> y5_mod d <= #2.52", + None; + + "yy14", false, + "!d. d IN darts_k 3 H ==> y6_mod d <= #2.52 ==> y6_mod d <= #2.52", + None; + + "yy15", false, + "!d. d IN darts_k 3 H ==> y4_mod d <= sqrt8 ==> y4_mod d <= sqrt8", + None; + ] in + (* The main inequality *) + let main_ineq = + let th1 = (add_lp_hyp false o UNDISCH_ALL o SPEC_ALL) Lp_ineqs_proofs.lnsum_ineq in + (* Add an artificial ALL statement *) + (REWRITE_RULE[ALL_MEM] o GEN `v:num` o DISCH `MEM (v:num) (list_of_elements L)`) th1 in + let _ = add_lp_list_ineq ("main", false, main_ineq) in + + (* Main estimate inequalities *) + let _ = map add_lp_ineq_th + [ + "tau3", false, Lp_main_estimate.ineq_tau3; + "tau4", false, Lp_main_estimate.ineq_tau4; + "tau5", false, Lp_main_estimate.ineq_tau5; + "tau6", false, Lp_main_estimate.ineq_tau6; + "tau4", true, Lp_main_estimate.ineq_tau4_std; + "tau5", true, Lp_main_estimate.ineq_tau5_std; + "tau6", true, Lp_main_estimate.ineq_tau6_std; + "tauB5h", false, Lp_main_estimate.ineq_tau5_pro; + "tauB4h", false, Lp_main_estimate.ineq_tau4_pro; + "tau5h", false, Lp_main_estimate.ineq_tau5_diags; + "tau5h", true, Lp_main_estimate.ineq_tau5_diags_std; + ] in + let crossdiag_ineq = (add_lp_hyp true o UNDISCH_ALL o SPEC_ALL o REWRITE_RULE[GSYM IMP_IMP]) Lp_ineqs_proofs2.crossdiag_list in + let _ = add_lp_list_ineq ("crossdiag", false, crossdiag_ineq) in + + let _ = add_lp_ineq_th ("perimZ", false, Lp_ineqs_proofs2.perimZ) in + let _ = add_lp_ineq_th ("perimZ", true, Lp_ineqs_proofs2.perimZ_std) in + + let yapex_sup_flat = (add_lp_hyp true o UNDISCH_ALL o SPEC_ALL o REWRITE_RULE[GSYM IMP_IMP] o Hypermap_and_fan.let_RULE) + Lp_ineqs_proofs2.yapex_sup_flat_list in + let _ = add_lp_list_ineq ("yapex_sup_flat", false, yapex_sup_flat) in + ();; + +end;; diff --git a/formal_lp/hypermap/ineqs/lp_ineqs.hl b/formal_lp/hypermap/ineqs/lp_ineqs.hl new file mode 100644 index 0000000..4af72e0 --- /dev/null +++ b/formal_lp/hypermap/ineqs/lp_ineqs.hl @@ -0,0 +1,314 @@ +needs "../formal_lp/hypermap/ineqs/lp_gen_ineqs.hl";; +needs "../formal_lp/hypermap/ineqs/lp_approx_ineqs.hl";; +needs "../formal_lp/hypermap/ineqs/lp_ineqs_defs.hl";; +needs "../formal_lp/hypermap/ineqs/lp_ineqs_proofs-compiled.hl";; +needs "../formal_lp/hypermap/ineqs/lp_ineqs_proofs2-compiled.hl";; +needs "../formal_lp/hypermap/ineqs/lp_main_estimate-compiled.hl";; +needs "../formal_lp/hypermap/arith_link.hl";; + +module Lp_ineqs = struct + +open Lp_ineqs_proofs;; + +type raw_lp_ineq = { + name : string; + tm : term; + proof: thm option; + std_only: bool; +};; + + +type lp_ineq = { + ineq_th : thm; + pair_flag : bool; +};; + + +let raw_ineq_list, add_raw_ineq, find_raw_ineq = + let table = ref [] in + (fun () -> !table), + (fun name std tm th -> + table := {name = name; tm = tm; proof = th; std_only = std} :: !table), + (fun std_flag name -> find (fun x -> x.name = name && x.std_only = std_flag) !table);; + + +(* Combine all nonlinear inequalities related to linear programs into one definition *) +let lp_ineqs_def = + let check_lp_tags = + let rec check tags = + match tags with + | Lp :: _ -> true + | Tablelp :: _ -> true + | Lp_aux _ :: _ -> true + | h :: t -> check t + | [] -> false in + fun ineq -> check ineq.tags in + let ineq_ids = ["6170936724"] in + let lp_ineqs = filter (fun ineq -> check_lp_tags ineq or mem ineq.idv ineq_ids) !Ineq.ineqs in + let lp_tms = setify (map (fun t -> t.ineq) lp_ineqs) in + let lp_tm = end_itlist (curry mk_conj) lp_tms in + new_definition (mk_eq (`lp_ineqs:bool`, lp_tm));; + + +let add_lp_ineqs_hyp = + let imp_th = (UNDISCH o MATCH_MP EQ_IMP) lp_ineqs_def in + let ths = CONJUNCTS imp_th in + fun th -> + itlist PROVE_HYP ths th;; + + +(* Replaces all general hypotheses with lp_cond *) +let add_lp_hyp = + let lp_fan_ths = (CONJUNCTS o UNDISCH_ALL o MATCH_MP EQ_IMP o SPEC_ALL) Lp_ineqs_proofs.lp_fan in + let lp_cond_ths = (CONJUNCTS o UNDISCH_ALL o MATCH_MP EQ_IMP o SPEC_ALL o INST_TYPE[`:num`, aty]) Lp_ineqs_proofs.lp_cond in + let lp_main_estimate_ths = (CONJUNCTS o UNDISCH_ALL o MATCH_MP EQ_IMP o SPEC_ALL) Lp_main_estimate.lp_main_estimate in + fun lp_ineq_flag th -> + let th' = (UNDISCH_ALL o SPEC_ALL) th in + let th0 = if (not lp_ineq_flag) or is_forall (concl th') or is_binary "ALL" (concl th') then th' else th in + let th1 = itlist PROVE_HYP lp_fan_ths th0 in + let th2 = itlist PROVE_HYP lp_cond_ths th1 in + let th3 = itlist PROVE_HYP lp_main_estimate_ths th2 in + add_lp_ineqs_hyp th3;; + + +let parse_lp_ineq s type_hints = + let hints = map (fun var, ty -> var, pretype_of_type ty) type_hints in + let ptm, l = (parse_preterm o lex o explode) s in + if l = [] then + (term_of_preterm o retypecheck hints) ptm + else + failwith "Unparsed input following term";; + + +let add_lp_ineq_str (name, std_flag, s_tm, th) = + let tm = parse_lp_ineq s_tm ["H", `:(A)hypermap`; "V", `:C->bool`; "node_mod", `:A->C`] in + let proof = match th with + | None -> None + | Some th -> Some (PURE_REWRITE_RULE[GSYM IMP_IMP] (add_lp_hyp true th)) in + add_raw_ineq name std_flag tm proof;; + + +let mk_lp_ineq = + let subst_list = [ + `dart (H:(real^3#real^3)hypermap)`, `dart_of_fan (V:real^3->bool,E)`; + `H:(real^3#real^3)hypermap`, `hypermap_of_fan (V:real^3->bool,E)`; + `face_map (H:(real^3#real^3)hypermap)`, `f_fan_pair_ext (V:real^3->bool,E)`; + `azim_mod:real^3#real^3->real`, `azim_dart (V:real^3->bool,E)`; + `azim2_mod:real^3#real^3->real`, `azim2_fan (V:real^3->bool,E)`; + `azim3_mod:real^3#real^3->real`, `azim3_fan (V:real^3->bool,E)`; + `rhazim_mod:real^3#real^3->real`, `rhazim_fan (V:real^3->bool,E)`; + `rhazim2_mod:real^3#real^3->real`, `rhazim2_fan (V:real^3->bool,E)`; + `rhazim3_mod:real^3#real^3->real`, `rhazim3_fan (V:real^3->bool,E)`; + `sol_mod:(real^3#real^3->bool)->real`, `sol_fan (V:real^3->bool,E)`; + `tau_mod:(real^3#real^3->bool)->real`, `tau_fan (V:real^3->bool,E)`; + `y1_mod:real^3#real^3->real`, `y1_fan`; + `y2_mod:real^3#real^3->real`, `y2_fan`; + `y3_mod:real^3#real^3->real`, `y3_fan (V,E)`; + `y4_mod:real^3#real^3->real`, `y4_fan (V,E)`; + `y5_mod:real^3#real^3->real`, `y5_fan (V,E)`; + `y6_mod:real^3#real^3->real`, `y6_fan`; + `y7_mod:real^3#real^3->real`, `y7_fan (V,E)`; + `y8_mod:real^3#real^3->real`, `y8_fan (V,E)`; + `y9_mod:real^3#real^3->real`, `y9_fan (V,E)`; + `y4'_mod:real^3#real^3->real`, `y4'_fan (V,E)`; + `ye_mod:real^3#real^3->real`, `ye_fan`; + `yn_mod:real^3->real`, `yn_fan`; + ] in + fun ineq_th -> + let proof = PURE_REWRITE_RULE[GSYM IMP_IMP] (add_lp_hyp true ineq_th) in + let tm0 = concl proof in + let tm1 = subst subst_list tm0 in + tm1, proof;; + + +let add_lp_ineq_th (name, std_flag, ineq_th) = + let tm1, proof = mk_lp_ineq ineq_th in + add_raw_ineq name std_flag tm1 (Some proof);; + +let gen_raw_ineq_data_str name std_flag str = + let tm = parse_lp_ineq str ["H", `:(A)hypermap`; "V", `:C->bool`; "node_mod", `:A->C`] in + {name = name; tm = tm; proof = None; std_only = std_flag};; + +let gen_raw_ineq_data name std_flag ineq_th = + let tm1, proof = mk_lp_ineq ineq_th in + {name = name; tm = tm1; proof = Some proof; std_only = std_flag};; + +(******************************) + + +(* Generates a general form of an inequality *) +let generate_ineq0 ineq = + let th0 = Lp_gen_ineqs.generate_ineq ineq.tm in + let th1 = add_lp_hyp true th0 in + let proof = + match ineq.proof with + | Some th -> th + | None -> TRUTH in + PROVE_HYP proof th1;; + + +let generate_ineq1 = + let power_th = prove(`!f (x:A). (f POWER 2) x = f (f x) /\ (f POWER 3) x = f (f (f x))`, + REWRITE_TAC[Hypermap.POWER_2; Hypermap.THREE; Hypermap.POWER; o_THM]) in + + let mk_list_th th = + let tm, proof = mk_lp_ineq th in + generate_ineq0 {name = "tmp"; std_only = false; tm = tm; proof = Some proof} in + + let strip_ALL th = + let ltm, set_tm = dest_comb (concl th) in + let p_tm = rand ltm in + let var_tm, _ = dest_abs p_tm in + let th1 = (BETA_RULE o SPEC var_tm o PURE_REWRITE_RULE[GSYM ALL_MEM]) th in + let mem_tm = (fst o dest_imp o concl) th1 in + UNDISCH th1, (var_tm, mem_tm) in + + let th_rule = (UNDISCH_ALL o INST_TYPE [`:num`, aty; `:num`, `:D`; `:real^3`, `:C`] o + SPEC_ALL o REWRITE_RULE[GSYM IMP_IMP; RIGHT_IMP_FORALL_THM]) in + + let def_ths = + let defs = + map (fst o strip_ALL o mk_list_th) + [y1_def; y2_def; y3_def; y4_def; y5_def; y6_def; y9_def] in + let r = (fst o strip_ALL o add_lp_hyp true o REWRITE_RULE[GSYM IMP_IMP]) in + let extra_defs = map r + [ + y8_list_def; y4'_list_def; y4'_list_f_def; + y4'_list_inv_f_def; y4'_list_ff_def; y4'_list_fff_def; + ] in + extra_defs @ defs in + + let mem_ths = + [ + `MEM (d:num#num) (list_of_darts3 L)`, th_rule Lp_gen_theory.list_of_darts3_subset; + `MEM (d:num#num) (list_of_darts4 L)`, th_rule Lp_gen_theory.list_of_darts4_subset; + `MEM (d:num#num) (list_of_darts5 L)`, th_rule Lp_gen_theory.list_of_darts5_subset; + `MEM (d:num#num) (list_of_darts6 L)`, th_rule Lp_gen_theory.list_of_darts6_subset; + ] in + + let rec simplify tm = + if is_imp tm then + let ltm, q_tm = dest_comb tm in + let imp_tm, p_tm = dest_comb ltm in + let p_tm, q_tm = dest_imp tm in + let p_th = (PURE_REWRITE_CONV def_ths THENC PURE_REWRITE_CONV[power_th]) p_tm in + let q_th = simplify q_tm in + MK_COMB (AP_TERM imp_tm p_th, q_th) + else + REFL tm in + + fun simplify_all_flag ineq -> + let th1 = generate_ineq0 ineq in + let th2, (var_tm, mem_tm) = strip_ALL th1 in + let eq_th = + if simplify_all_flag then + (PURE_REWRITE_CONV def_ths THENC PURE_REWRITE_CONV[power_th]) (concl th2) + else + simplify (concl th2) in + let th3 = EQ_MP eq_th th2 in + let th4 = + try + let mem_th = assoc mem_tm mem_ths in + PROVE_HYP mem_th th3 + with Failure _ -> th3 in + let th5 = (GEN var_tm o DISCH mem_tm) th4 in + PURE_REWRITE_RULE[ALL_MEM] th5;; + +let generate_ineq = generate_ineq1 false;; + +let add_lp_list_ineq, find_ineq = + let ineq_table = Array.init 8 (fun i -> Hashtbl.create 10) in + let std_ineq_table = Array.init 8 (fun i -> Hashtbl.create 10) in + let add std_flag i pair_flag name ineq_th = + let table = if std_flag then std_ineq_table.(i) else ineq_table.(i) in + Hashtbl.add table name {ineq_th = ineq_th; pair_flag = pair_flag} in + let DECIMAL_INT = prove(`!n. DECIMAL n 1 = &n`, REWRITE_TAC[DECIMAL; REAL_DIV_1]) in + + let pos_thms = + let inst = INST[`V:real^3->bool,E:(real^3->bool)->bool`, `fan:(real^3->bool)#((real^3->bool)->bool)`] in + map inst Lp_ineqs_def.list_var_pos in + + let rec rewrite_num_conv real_flag tm = + match tm with + | Var _ -> REFL tm + | Const _ -> REFL tm + | Abs (v_tm, b_tm) -> + ABS v_tm (rewrite_num_conv real_flag b_tm) + | Comb (Const ("NUMERAL", _), _) -> + Arith_nat.NUMERAL_TO_NUM_CONV tm + | Comb (Const ("real_of_num", _) as ltm, rtm) -> + if real_flag then + AP_TERM ltm (rewrite_num_conv real_flag rtm) + else + REFL tm + | Comb (Comb (Const ("DECIMAL", _), _), _) -> + REFL tm + | Comb (ltm, rtm) -> + MK_COMB (rewrite_num_conv real_flag ltm, rewrite_num_conv real_flag rtm) in + + let rewrite_num ineq_th = + let th1 = PURE_REWRITE_RULE[DECIMAL_INT] ineq_th in + let imp_flag = (is_imp o snd o dest_abs o lhand o concl) th1 in + if imp_flag then + let th2 = PURE_REWRITE_RULE[IMP_IMP] th1 in + let th3 = CONV_RULE ((LAND_CONV o ABS_CONV o RAND_CONV) (rewrite_num_conv true)) th2 in + let th4 = CONV_RULE ((LAND_CONV o ABS_CONV o LAND_CONV) (rewrite_num_conv false)) th3 in + PURE_REWRITE_RULE[GSYM IMP_IMP] th4 + else + CONV_RULE (rewrite_num_conv true) th1 in + + (* add_lp_list_ineq *) + (fun (name, std_only, list_ineq_th) -> + let approx_ths, neg_approx_ths = Lp_approx_ineqs.generate_ineqs pos_thms [3;4;5;6;7] list_ineq_th in + let set_name = (fst o dest_const o rator o rand o concl o hd) approx_ths in + let pair_flag, approx_ths, neg_approx_ths = + if set_name = "list_dart_pairs" then + let r = PURE_REWRITE_RULE[Lp_gen_theory.ALL_list_dart_pairs_split; BETA_THM; FST; SND] in + true, map r approx_ths, map r neg_approx_ths + else + false, approx_ths, neg_approx_ths in + let approx_ths = zip (3--7) approx_ths in + let neg_approx_ths = if (neg_approx_ths = []) then [] else zip (3--7) neg_approx_ths in + + let r = rewrite_num in + if std_only then + let _ = map (fun (i, t) -> add true i pair_flag name (r t)) approx_ths in + let _ = map (fun (i, t) -> add true i pair_flag (name^"_neg") (r t)) neg_approx_ths in + () + else + let _ = map (fun (i, t) -> add false i pair_flag name (r t)) approx_ths in + let _ = map (fun (i, t) -> add false i pair_flag (name^"_neg") (r t)) neg_approx_ths in + ()), + + (* find_ineq *) + (fun std_flag precision name -> + if std_flag then + try + Hashtbl.find std_ineq_table.(precision) name + with Not_found -> Hashtbl.find ineq_table.(precision) name + else + Hashtbl.find ineq_table.(precision) name);; + + +(* Generates all list inequalities from raw inequalities *) +let process_raw_ineqs = + let report s = + Format.print_string s; Format.print_newline(); Format.print_flush() in + let counter = ref 0 and + total = ref 0 in + + let process_ineq ineq = + let _ = counter := !counter + 1 in + let _ = report (sprintf "Processing: %s (%d / %d)" ineq.name !counter !total) in + let th = generate_ineq ineq in + add_lp_list_ineq (ineq.name, ineq.std_only, th) in + + fun () -> + let ineqs = raw_ineq_list() in + let _ = counter := 0 in + let _ = total := length ineqs in + let _ = map process_ineq (raw_ineq_list()) in + ();; + +end;; + diff --git a/formal_lp/hypermap/ineqs/lp_ineqs_defs.hl b/formal_lp/hypermap/ineqs/lp_ineqs_defs.hl new file mode 100644 index 0000000..e03b961 --- /dev/null +++ b/formal_lp/hypermap/ineqs/lp_ineqs_defs.hl @@ -0,0 +1,137 @@ +module Lp_ineqs_def = struct + +open Sphere;; +open Fan_defs;; + +(* Definitions of all fan variables *) + +let azim2_fan = new_definition `azim2_fan (V,E) (x:real^3#real^3) = azim_dart (V,E) (f_fan_pair_ext (V,E) x)`;; +let azim3_fan = new_definition `azim3_fan (V,E) (x:real^3#real^3) = azim_dart (V,E) (inverse (f_fan_pair_ext (V,E)) x)`;; + +let yn_fan = new_definition `yn_fan (v:real^3) = norm v`;; +let ln_fan = new_definition `ln_fan (v:real^3) = lmfun (yn_fan v / &2)`;; +let rho_fan = new_definition `rho_fan (v:real^3) = abs (&1 + const1 * (&1 - ln_fan v))`;; +let ye_fan = new_definition `ye_fan (x:real^3#real^3) = dist x`;; + +let y1_fan = new_definition `y1_fan (x:real^3#real^3) = norm (FST x)`;; +let y2_fan = new_definition `y2_fan (x:real^3#real^3) = norm (SND x)`;; +let y3_fan = new_definition `y3_fan (V,E) (x:real^3#real^3) = norm (FST (inverse (f_fan_pair_ext (V,E)) x))`;; +let y4_fan = new_definition `y4_fan (V,E) (x:real^3#real^3) = dist (f_fan_pair_ext (V,E) x)`;; +let y5_fan = new_definition `y5_fan (V,E) (x:real^3#real^3) = dist (inverse (f_fan_pair_ext (V,E)) x)`;; +let y6_fan = new_definition `y6_fan (x:real^3#real^3) = dist x`;; +let y8_fan = new_definition `y8_fan (V,E) (x:real^3#real^3) = y5_fan (V,E) (inverse (f_fan_pair_ext (V,E)) x)`;; +let y9_fan = new_definition `y9_fan (V,E) (x:real^3#real^3) = dist (f_fan_pair_ext (V,E) x)`;; + +let rhazim_fan = new_definition `rhazim_fan (V,E) (x:real^3#real^3) = abs (&1 + const1 * (&1 - lmfun (h_dart x))) * azim_dart (V,E) x`;; +let rhazim2_fan = new_definition `rhazim2_fan (V,E) (x:real^3#real^3) = rhazim_fan (V,E) (f_fan_pair_ext (V,E) x)`;; +let rhazim3_fan = new_definition `rhazim3_fan (V,E) (x:real^3#real^3) = rhazim_fan (V,E) (inverse (f_fan_pair_ext (V,E)) x)`;; + +(* All variables must be positive without any side conditions *) +let sol_fan = new_definition `sol_fan (V,E) f = abs (sum f (\x. azim_dart (V,E) x - pi) + &2 * pi)`;; +let tau_fan = new_definition `tau_fan (V,E) f = abs (tauVEF (V,E,f))`;; + +(* A diagonal *) +let y4'_fan = new_definition `y4'_fan (V,E) (x:real^3#real^3) = dist (SND x, FST (inverse (f_fan_pair_ext (V,E)) x))`;; +let y7_fan = new_definition + `y7_fan (V,E) (x:real^3#real^3) = norm (FST ((inverse (f_fan_pair_ext (V,E)) POWER 2) x))`;; + +let fan_defs = +[ + azim2_fan; azim3_fan; yn_fan; ln_fan; ye_fan; + rho_fan; sol_fan; tau_fan; rhazim_fan; rhazim2_fan; rhazim3_fan; + y1_fan; y2_fan; y3_fan; y4_fan; y5_fan; y6_fan; y8_fan; y9_fan; y4'_fan; +] + + +(* Variables for lists *) +(* g - an isomorphism from hypermap_of_list to hypermap_of_fan *) +(* fan = (V,E) - a fan *) +(* g x = h (FST x), h (SND x) *) + +let list_defs = map new_definition + [ + `azim_list (g,fan) = (azim_dart fan o g):num#num->real`; + `azim2_list (g,fan) = (azim2_fan fan o g):num#num->real`; + `azim3_list (g,fan) = (azim3_fan fan o g):num#num->real`; + `yn_list h = (yn_fan o h):num->real`; + `ln_list h = (ln_fan o h):num->real`; + `rho_list h = (rho_fan o h):num->real`; + `rhazim_list (g,fan) = (rhazim_fan fan o g):num#num->real`; + `rhazim2_list (g,fan) = (rhazim2_fan fan o g):num#num->real`; + `rhazim3_list (g,fan) = (rhazim3_fan fan o g):num#num->real`; + `(ye_list g):(num#num->real) = ye_fan o g`; + `(sol_list (g,fan)):(num#num->bool)->real = sol_fan fan o IMAGE g`; + `(tau_list (g,fan)):(num#num->bool)->real = tau_fan fan o IMAGE g`; + `(y1_list g):(num#num->real) = y1_fan o g`; + `(y2_list g):(num#num->real) = y2_fan o g`; + `(y3_list (g,fan)):(num#num->real) = y3_fan fan o g`; + `(y4_list (g,fan)):(num#num->real) = y4_fan fan o g`; + `(y5_list (g,fan)):(num#num->real) = y5_fan fan o g`; + `(y6_list g):(num#num->real) = y6_fan o g`; + `(y8_list (g,fan)):(num#num->real) = y8_fan fan o g`; + `(y9_list (g,fan)):(num#num->real) = y9_fan fan o g`; + `(y4'_list (g,fan)):(num#num->real) = y4'_fan fan o g`; + ];; + + +let list_defs2 = map (REWRITE_RULE[FUN_EQ_THM; o_THM]) list_defs;; + +let list_defs_th = end_itlist CONJ list_defs;; + +let list_var_rewrites = + map GSYM list_defs @ map GSYM list_defs2;; + + +(* All variables are nonnegative *) + +let AZIM_DART_POS = prove(`&0 <= azim_dart (V,E) x`, + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[azim_dart] THEN + COND_CASES_TAC THENL + [ + MP_TAC PI_APPROX_32 THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[azim_fan] THEN + COND_CASES_TAC THEN REWRITE_TAC[azim] THEN + MP_TAC PI_APPROX_32 THEN REAL_ARITH_TAC);; + + +let DIST_POS = prove(`!x:(real^3#real^3). &0 <= dist x`, + GEN_TAC THEN MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[dist; NORM_POS_LE]);; + + +let list_var_pos = map (fun tm -> prove(tm, + GEN_TAC THEN REWRITE_TAC list_defs2 THEN + MP_TAC (ISPEC `fan:(real^3->bool)#((real^3->bool)->bool)` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN ASM_REWRITE_TAC fan_defs THEN + TRY (MATCH_MP_TAC REAL_LE_MUL) THEN + REWRITE_TAC[AZIM_DART_POS; REAL_ABS_POS; NORM_POS_LE; DIST_POS; Fnjlbxs.lmfun_ge0])) +[ + `!x. &0 <= azim_list (g,fan) x`; + `!x. &0 <= azim2_list (g,fan) x`; + `!x. &0 <= azim3_list (g,fan) x`; + `!x. &0 <= rhazim_list (g,fan) x`; + `!x. &0 <= rhazim2_list (g,fan) x`; + `!x. &0 <= rhazim3_list (g,fan) x`; + `!v. &0 <= yn_list h v`; + `!v. &0 <= ln_list h v`; + `!v. &0 <= rho_list h v`; + `!f. &0 <= sol_list (g,fan) f`; + `!f. &0 <= tau_list (g,fan) f`; + `!x. &0 <= ye_list g x`; + `!x. &0 <= y1_list g x`; + `!x. &0 <= y2_list g x`; + `!x. &0 <= y3_list (g,fan) x`; + `!x. &0 <= y4_list (g,fan) x`; + `!x. &0 <= y5_list (g,fan) x`; + `!x. &0 <= y6_list g x`; + `!x. &0 <= y8_list (g,fan) x`; + `!x. &0 <= y9_list (g,fan) x`; + `!x. &0 <= y4'_list (g,fan) x`; +];; + + +end;; diff --git a/formal_lp/hypermap/ineqs/lp_ineqs_proofs-compiled.hl b/formal_lp/hypermap/ineqs/lp_ineqs_proofs-compiled.hl new file mode 100644 index 0000000..fb823af --- /dev/null +++ b/formal_lp/hypermap/ineqs/lp_ineqs_proofs-compiled.hl @@ -0,0 +1,3592 @@ +needs "../formal_lp/hypermap/ssreflect/list_hypermap_iso-compiled.hl";; +needs "../formal_lp/hypermap/ineqs/lp_ineqs_defs.hl";; +needs "../formal_lp/ineqs/constants_approx.hl";; +needs "tame/ssreflect/tame_lemmas-compiled.hl";; + +(* Module Lp_ineqs_proofs*) +module Lp_ineqs_proofs = struct + +let lp_fan = new_definition `lp_fan (V,E) <=> FAN (vec 0,V,E) + /\ fully_surrounded (V,E) + /\ (!v w. v IN V /\ w IN V /\ ~(v = w) /\ ~({v,w} IN E) ==> #2.52 <= dist (v,w)) + /\ V SUBSET ball_annulus + /\ packing V`;; +let lp_cond = new_definition `lp_cond (L:((A)list)list,g,h) (V,E) + <=> lp_fan (V,E) + /\ good_list L + /\ good_list_nodes L + /\ hyp_iso g (hypermap_of_list L, hypermap_of_fan (V,E)) + /\ BIJ h (elements_of_list L) V + /\ (!d. g d = h (FST d), h (SND d)) + /\ (!x. x IN elements_of_list L <=> h x IN V)`;; +let lp_tau = new_definition `lp_tau (V,E) <=> + (!f. f IN face_set (hypermap_of_fan (V,E)) ==> &0 <= tauVEF (V,E,f))`;; +let add_diag = new_definition `add_diag (V,E) (v,w) + = if (v,w) IN dart1_of_fan (V,E) then + {w, sigma_fan (vec 0) V E v w} INSERT E + else E`;; +let add_diag_list = new_definition + `add_diag_list (g,V,E) diags = foldr (\d E'. add_diag (V,E') (g d)) E diags`;; +let split_list_list = new_definition + `split_list_list L ds = foldr (\d L. split_list_hyp L d) L ds`;; +open Ssrbool;; +open Ssrnat;; +open Seq;; +open Seq2;; +open Sphere;; +open Fan_defs;; +open Hypermap;; +open Hypermap_and_fan;; +open Pack_defs;; +open Tame_defs;; +open Hypermap_iso;; +open Add_triangle;; +open List_hypermap;; +open List_hypermap_iso;; +open Tame_general;; +open Tame_lemmas;; +open Constants_approx;; +open Lp_ineqs_def;; + +(* Lemma const1_gt0 *) +let const1_gt0 = Sections.section_proof [] +`&0 < const1` +[ + (((((use_arg_then2 ("sol0_over_pi_EQ_const1", [sol0_over_pi_EQ_const1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_MUL", [REAL_LT_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sol0_POS", [sol0_POS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_INV", [REAL_LT_INV]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("PI_POS", [PI_POS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma const1_ge0 *) +let const1_ge0 = Sections.section_proof [] +`&0 <= const1` +[ + (((((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("const1_gt0", [const1_gt0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma tau_fan_eq_tauVEF *) +let tau_fan_eq_tauVEF = Sections.section_proof ["V";"E";"f"] +`lp_tau (V,E) /\ f IN face_set (hypermap_of_fan (V,E)) + ==> tau_fan (V,E) f = tauVEF (V,E,f)` +[ + (((((use_arg_then2 ("lp_tau", [lp_tau]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["tau_h"]))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("tau_h", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC)); + (((((use_arg_then2 ("tau_fan", [tau_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_REFL", [REAL_ABS_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma face_map_in_darts_k *) +let face_map_in_darts_k = Sections.section_proof ["H";"k";"d"] +`d IN darts_k k H + ==> face_map H d IN darts_k k H /\ inverse (face_map H) d IN darts_k k H` +[ + (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN ((move ["d_in"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))))); + ((((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("lemma_dart_inveriant_under_inverse_maps", [lemma_dart_inveriant_under_inverse_maps]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); + ((split_tac) THEN (congr_tac (`CARD _`)) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (thm_tac apply_tac))); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face", [lemma_in_face]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_power_inverse_in_face", [lemma_power_inverse_in_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("face_refl", [face_refl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma f_fan_pair_ext_in_darts_k *) +let f_fan_pair_ext_in_darts_k = Sections.section_proof ["V";"E";"k";"d"] +`FAN (vec 0,V,E) + /\ d IN darts_k k (hypermap_of_fan (V,E)) + ==> f_fan_pair_ext (V,E) d IN darts_k k (hypermap_of_fan (V,E)) + /\ inverse (f_fan_pair_ext (V,E)) d IN darts_k k (hypermap_of_fan (V,E))` +[ + (BETA_TAC THEN (case THEN ((move ["fanV"]) THEN (move ["d_in"])))); + (((((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("face_map_in_darts_k", [face_map_in_darts_k]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Section FunctionPair *) +Sections.begin_section "FunctionPair";; + +(* Lemma res_inv_subset *) +let res_inv_subset = Sections.section_proof ["f";"s";"s'";"t";"x"] +`s' SUBSET s /\ BIJ f s t /\ x IN IMAGE f s' + ==> res_inv f s' x = res_inv f s x` +[ + (((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["s'_sub"])) THEN (case THEN (move ["bij_f"])) THEN (case THEN (move ["y"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["y_in"])); + ((((fun arg_tac -> (use_arg_then2 ("res_inv_bij", [res_inv_bij])) (fun fst_arg -> (use_arg_then2 ("bij_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("s'_sub", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("res_inv_left", [res_inv_left])) (fun fst_arg -> (use_arg_then2 ("y_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["a"]) THEN (move ["b"]) THEN (move ["h"])); + ((((use_arg_then2 ("bij_f", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN ((move ["_"]) THEN (move ["f_inj"]))) THEN (move ["_"]))); + ((((use_arg_then2 ("f_inj", [])) (disch_tac [])) THEN (clear_assumption "f_inj") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("s'_sub", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; +(Sections.add_section_var (mk_var ("h1", (`:A->B`))));; +(Sections.add_section_var (mk_var ("h2", (`:C->D`))));; +(Sections.add_section_var (mk_var ("g", (`:A#C -> B#D`))));; +(Sections.add_section_hyp "g_eq" (`!x. g x = h1 (FST x), h2 (SND x)`));; + +(* Lemma INJ_pair *) +let INJ_pair = Sections.section_proof ["s1";"t1";"s2";"t2"] +`INJ h1 s1 t1 /\ INJ h2 s2 t2 + ==> INJ g (s1 CROSS s2) (t1 CROSS t2)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (case THEN ((move ["h1_in"]) THEN (move ["h1_inj"])))) THEN (case THEN ((move ["h2_in"]) THEN (move ["h2_inj"])))); + (((THENL) (split_tac) [(case THEN ((move ["a"]) THEN (move ["b"]))); ((case THEN ((move ["a"]) THEN (move ["b"]))) THEN (case THEN ((move ["c"]) THEN (move ["d"]))))]) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("g_eq", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_CROSS", [IN_CROSS]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))))); + ((BETA_TAC THEN (move ["ab_in"])) THEN ((((use_arg_then2 ("h1_in", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("h2_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (case THEN (move ["ab_in"])) THEN (case THEN (move ["cd_in"])) THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("h1_inj", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("h2_inj", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma SURJ_pair *) +let SURJ_pair = Sections.section_proof ["s1";"t1";"s2";"t2"] +`SURJ h1 s1 t1 /\ SURJ h2 s2 t2 + ==> SURJ g (s1 CROSS s2) (t1 CROSS t2)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (case THEN ((move ["h1_in"]) THEN (move ["h1_surj"])))) THEN (case THEN ((move ["h2_in"]) THEN (move ["h2_surj"])))); + (((split_tac) THEN ALL_TAC THEN (case THEN ((move ["a"]) THEN (move ["b"])))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("g_eq", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_CROSS", [IN_CROSS]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))))); + ((BETA_TAC THEN (move ["ab_in"])) THEN ((((use_arg_then2 ("h1_in", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("h2_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("h1_surj", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (case THEN (move ["y1"])) THEN (move ["y1_eq"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("h2_surj", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["y2"])) THEN (move ["y2_eq"])); + (((fun arg_tac -> arg_tac (Arg_term (`y1,y2`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("IN_CROSS", [IN_CROSS]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y1_eq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y2_eq", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma BIJ_pair *) +let BIJ_pair = Sections.section_proof ["s1";"t1";"s2";"t2"] +`BIJ h1 s1 t1 /\ BIJ h2 s2 t2 + ==> BIJ g (s1 CROSS s2) (t1 CROSS t2)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] []))))) THEN (move ["h"])) THEN ((((use_arg_then2 ("INJ_pair", [INJ_pair]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SURJ_pair", [SURJ_pair]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma res_inv_pair *) +let res_inv_pair = Sections.section_proof ["s1";"t1";"s2";"t2"] +`BIJ h1 s1 t1 /\ BIJ h2 s2 t2 + ==> (!a b. a IN t1 /\ b IN t2 + ==> res_inv g (s1 CROSS s2) (a,b) = res_inv h1 s1 a, res_inv h2 s2 b)` +[ + (BETA_TAC THEN (case THEN ((move ["bij_h1"]) THEN (move ["bij_h2"]))) THEN (move ["a"]) THEN (move ["b"]) THEN (case THEN ((move ["a_in"]) THEN (move ["b_in"])))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("BIJ_pair", [BIJ_pair])) (fun fst_arg -> (use_arg_then2 ("bij_h1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bij_h2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["bij_g"]))); + ((((use_arg_then2 ("bij_g", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN ((move ["g_in"]) THEN (move ["g_inj"]))) THEN (move ["_"]))); + (((use_arg_then2 ("g_inj", [])) (disch_tac [])) THEN (clear_assumption "g_inj") THEN (DISCH_THEN apply_tac)); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("res_inv_bij", [res_inv_bij])) (fun fst_arg -> (use_arg_then2 ("bij_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_CROSS", [IN_CROSS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("g_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("res_inv_bij", [res_inv_bij])) (fun fst_arg -> (use_arg_then2 ("bij_h1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("res_inv_bij", [res_inv_bij])) (fun fst_arg -> (use_arg_then2 ("bij_h2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section FunctionPair *) +let res_inv_subset = Sections.finalize_theorem res_inv_subset;; +let INJ_pair = Sections.finalize_theorem INJ_pair;; +let SURJ_pair = Sections.finalize_theorem SURJ_pair;; +let BIJ_pair = Sections.finalize_theorem BIJ_pair;; +let res_inv_pair = Sections.finalize_theorem res_inv_pair;; +Sections.end_section "FunctionPair";; + +(* Lemma darts_of_list_subset *) +let darts_of_list_subset = Sections.section_proof ["L";"v";"w"] +`v,w IN darts_of_list L ==> v IN elements_of_list L /\ w IN elements_of_list L` +[ + ((((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("elements_of_list", [elements_of_list]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("mem_list_of_darts", [mem_list_of_darts]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["l"])) THEN (case THEN (move ["mem_l"])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("mem_list_pairs", [mem_list_pairs])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["mem_vw"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("list_of_elements", [list_of_elements]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mem_undup", [mem_undup]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mem_flatten", [mem_flatten]))(thm_tac (new_rewrite [] [])))))); + ((split_tac) THEN ((use_arg_then2 ("l", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Section Lp_cond *) +Sections.begin_section "Lp_cond";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_var (mk_var ("L", (`:((A)list)list`))));; + +(* Lemma lp_cond_lemma *) +let lp_cond_lemma = Sections.section_proof ["f"] +`lp_fan (V,E) /\ good_list L /\ good_list_nodes L + /\ hyp_iso f (hypermap_of_fan (V,E), hypermap_of_list L) + ==> ?g h. lp_cond (L, g, h) (V,E) + /\ (!x. h x = if x IN elements_of_list L then + res_inv (fan_list_nodes_iso (f,V,E)) V x else vec 0)` +[ + (((((use_arg_then2 ("lp_cond", [lp_cond]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag_dist"])) THEN (case THEN ((move ["subV"]) THEN (move ["packV"]))) THEN (case THEN (move ["goodL"])) THEN (case THEN (move ["good_nodes"])) THEN (move ["iso_f"])); + ((((use_arg_then2 ("fanV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_surr", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("packV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("goodL", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("good_nodes", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`fan_list_iso (f, V, E)`))) (term_tac (set_tac "f'"))); + ((fun arg_tac -> arg_tac (Arg_term (`fan_list_nodes_iso (f, V, E)`))) (term_tac (set_tac "h'"))); + ((fun arg_tac -> arg_tac (Arg_term (`f' d = h' (FST d), h' (SND d)`))) (term_tac (have_gen_tac ["d"](move ["f'_eq"])))); + ((((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"])) THEN ((((use_arg_then2 ("f'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fan_list_iso", [fan_list_iso]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h'_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartV"]) THEN (move ["_"]))))); + ((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartL"]) THEN (move ["_"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`hyp_iso f' (hypermap_of_fan (V,E), hypermap_of_list L)`))) (term_tac (have_gen_tac [](move ["iso_f'"])))); + ((((fun arg_tac -> (use_arg_then2 ("hyp_iso_ext", [hyp_iso_ext])) (fun fst_arg -> (use_arg_then2 ("iso_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("dartV", []))(thm_tac (new_rewrite [] [])))) THEN (move ["d"]) THEN (move ["d_in"]))); + (((((use_arg_then2 ("f'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_eq_fan_list_iso", [hyp_iso_eq_fan_list_iso])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("iso_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`BIJ h' V (elements_of_list L)`))) (term_tac (have_gen_tac [](move ["bij_h'"])))); + (((((use_arg_then2 ("h'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fan_list_nodes_iso_BIJ", [fan_list_nodes_iso_BIJ])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("iso_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`\x. if x IN elements_of_list L then res_inv h' V x else vec 0`))) (term_tac (set_tac "h"))); + ((fun arg_tac -> arg_tac (Arg_term (`\d. h (FST d), h (SND d)`))) (term_tac (set_tac "g"))); + (((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("h", [])) (term_tac exists_tac))); + ((THENL_LAST) (split_tac) ((BETA_TAC THEN (move ["x"])) THEN ((((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac))); + ((THENL_FIRST) (split_tac) (((((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (move ["v"]) THEN (move ["w"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("diag_dist", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac))); + ((THENL_ROT (-1)) (split_tac)); + (((((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (split_tac)); + ((((fun arg_tac -> (use_arg_then2 ("bij_ext", [bij_ext])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("bij_res_inv", [bij_res_inv])) (fun fst_arg -> (use_arg_then2 ("bij_h'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("x_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["x"])); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`x IN _`))) (disch_eq_tac "x_in" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((fun arg_tac -> (use_arg_then2 ("res_inv_bij", [res_inv_bij])) (fun fst_arg -> (use_arg_then2 ("bij_h'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("subV", [])) (disch_tac [])) THEN (clear_assumption "subV") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_FORALL_THM", [NOT_FORALL_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IMP", [NOT_IMP]))(thm_tac (new_rewrite [] []))))) THEN (move ["v0"]))); + (((fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("Ckqowsa_3_points.in_ball_annulus", [Ckqowsa_3_points.in_ball_annulus]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> (use_arg_then2 ("hyp_iso_ext", [hyp_iso_ext])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_inv", [hyp_iso_inv])) (fun fst_arg -> (use_arg_then2 ("iso_f'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((((use_arg_then2 ("dartL", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN ((move ["v"]) THEN (move ["w"]))) THEN (move ["vw_in"]) THEN (simp_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("BIJ_pair", [BIJ_pair])) (fun fst_arg -> (use_arg_then2 ("bij_h'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bij_h'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f'_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["bij_f'"]))); + ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("res_inv_subset", [res_inv_subset])) (fun fst_arg -> (use_arg_then2 ("bij_f'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (use_arg_then2 ("darts_of_list_subset", [darts_of_list_subset])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["vw_in2"]))); + (((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("res_inv_pair", [res_inv_pair])) (fun fst_arg -> (use_arg_then2 ("f'_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bij_h'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bij_h'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("vw_in2", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("iso_dart", [iso_dart])) (fun fst_arg -> (use_arg_then2 ("iso_f'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartL", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))); + ((BETA_TAC THEN (case THEN ((move ["a"]) THEN (move ["b"]))) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("IN_CROSS", [IN_CROSS]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma lp_fan_trans1 *) +let lp_fan_trans1 = Sections.section_proof ["d"] +`lp_fan (V,E) ==> lp_fan (V, add_diag (V,E) d)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"])); + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"])); + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart1_of_fan (V,E)`))) (disch_eq_tac "vw_in1" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) (((((use_arg_then2 ("add_diag", [add_diag]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("packV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subV", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["dart1_eq"]))); + ((fun arg_tac -> arg_tac (Arg_term (`V, add_diag (V,E) (v,w) = split_fan_face (V,E) (v,w)`))) (term_tac (have_gen_tac [](move ["add_eq"])))); + (((((use_arg_then2 ("add_diag", [add_diag]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("vw_in1", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["vw_in"]))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["fan2"]) THEN (case THEN (move ["_"])) THEN (move ["f_surr2"]))))); + ((((use_arg_then2 ("add_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fan2", [fan2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_surr2", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + (BETA_TAC THEN (move ["a"]) THEN (move ["b"])); + (((((use_arg_then2 ("add_diag", [add_diag]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] []))))) THEN (move ["cond"])); + ((((use_arg_then2 ("diag", [])) (disch_tac [])) THEN (clear_assumption "diag") THEN (DISCH_THEN apply_tac)) THEN (done_tac)); +];; + +(* Lemma lp_cond_trans1 *) +let lp_cond_trans1 = Sections.section_proof ["g";"h";"d"] +`lp_cond (L,g,h) (V,E) + ==> lp_cond (split_list_hyp L d,g,h) (V, add_diag (V,E) (g d))` +[ + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("lp_cond", [lp_cond]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["fan_cond"])) THEN (case THEN (move ["goodL"])) THEN (case THEN (move ["good_nodes"])) THEN (case THEN (move ["iso_g"])) THEN (case THEN (move ["bij_h"])) THEN (case THEN (move ["g_eq"])) THEN (move ["h_cond"])); + ((((use_arg_then2 ("lp_fan_trans1", [lp_fan_trans1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("fan_cond", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag_dist"])) THEN (case THEN ((move ["subV"]) THEN (move ["packV"]))))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["dart1_eq"]))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartV"]) THEN (move ["_"]))))); + ((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartL"]) THEN (move ["_"]))))); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`v,w IN darts_of_list L`))) (disch_eq_tac "vw_in" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + ((((use_arg_then2 ("d_not_in_dart_split_eq", [d_not_in_dart_split_eq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("darts_of_list", [darts_of_list]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`add_diag (V,E) (g (v,w)) = E`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((ALL_TAC) THEN (done_tac))); + ((((use_arg_then2 ("g_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("add_diag", [add_diag]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`~(h v, h w IN dart_of_fan (V,E))`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((ALL_TAC) THEN (done_tac))); + (((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN (clear_assumption "vw_in") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (move ["hvw_in"])); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`res_inv g (darts_of_list L) (h v, h w) = v,w`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))))))); + (((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_inv", [hyp_iso_inv])) (fun fst_arg -> (use_arg_then2 ("iso_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((((use_arg_then2 ("dartV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartL", []))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("hvw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["hvw_inV"]))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`v IN elements_of_list L /\ w IN elements_of_list L`))) (term_tac (have_gen_tac [](move ["vw_in"])))) ((repeat_tactic 1 9 (((use_arg_then2 ("h_cond", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("BIJ_pair", [BIJ_pair])) (fun fst_arg -> (use_arg_then2 ("bij_h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bij_h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("g_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["bij_g"]))); + ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("res_inv_subset", [res_inv_subset])) (fun fst_arg -> (use_arg_then2 ("bij_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("res_inv_pair", [res_inv_pair])) (fun fst_arg -> (use_arg_then2 ("bij_h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bij_h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("g_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("res_inv_bij", [res_inv_bij])) (fun fst_arg -> (use_arg_then2 ("bij_h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("dartL", []))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("iso_dart", [iso_dart])) (fun fst_arg -> (use_arg_then2 ("iso_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hvw_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))); + ((BETA_TAC THEN (case THEN ((move ["a"]) THEN (move ["b"]))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("darts_of_list_subset", [darts_of_list_subset])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("IN_CROSS", [IN_CROSS]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`elements_of_list (split_list_hyp L (v,w)) = elements_of_list L`))) (term_tac (have_gen_tac [](move ["els_eq"])))); + (((repeat_tactic 1 9 (((use_arg_then2 ("elements_of_list", [elements_of_list]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("perm_eq_set_of_list_eq", [perm_eq_set_of_list_eq])) (thm_tac apply_tac))); + ((((use_arg_then2 ("list_of_elements_split", [list_of_elements_split]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> (use_arg_then2 ("hyp_iso_inv", [hyp_iso_inv])) (fun fst_arg -> (use_arg_then2 ("iso_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["iso_inv_g"]))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("iso_imp_good_list_split", [iso_imp_good_list_split])) (fun fst_arg -> (use_arg_then2 ("iso_inv_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("good_nodes", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["good_split"]))); + ((((use_arg_then2 ("good_split", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("iso_imp_good_list_nodes_split", [iso_imp_good_list_nodes_split])) (fun fst_arg -> (use_arg_then2 ("iso_inv_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("els_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h_cond", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bij_h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("g_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("g_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`g (v,w) = h v, h w`))) (term_tac (have_gen_tac [](move ["hvw_eq"])))) ((ALL_TAC) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`h v, h w IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["hvw_in"])))); + (((((use_arg_then2 ("hvw_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartV", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("iso_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartL", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`V, add_diag (V,E) (h v,h w) = split_fan_face (V,E) (h v,h w)`))) (term_tac (have_gen_tac [](move ["add_eq"])))); + (((((use_arg_then2 ("add_diag", [add_diag]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hvw_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("add_eq", []))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("hvw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["fan2"]) THEN (case THEN (move ["_"])) THEN (move ["f_surr2"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`fan_list_iso (res_inv g (dart (hypermap_of_list L)), V, E)`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`hyp_iso f (hypermap_of_fan (V,E), hypermap_of_list L)`))) (term_tac (have_gen_tac [](move ["iso_f"])))); + (((fun arg_tac -> (use_arg_then2 ("hyp_iso_ext", [hyp_iso_ext])) (fun fst_arg -> (use_arg_then2 ("iso_inv_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac) THEN (move ["d"]) THEN (move ["d_in"])); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hyp_iso_eq_fan_list_iso", [hyp_iso_eq_fan_list_iso]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dartV", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`fan_list_nodes_iso (res_inv g (dart (hypermap_of_list L)),V,E)`))) (term_tac (set_tac "h'"))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("BIJ_pair", [BIJ_pair])) (fun fst_arg -> (use_arg_then2 ("bij_h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bij_h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("g_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["bij_g"]))); + ((fun arg_tac -> arg_tac (Arg_term (`x IN elements_of_list L ==> h' (h x) = x`))) (term_tac (have_gen_tac ["x"](move ["h'_eq"])))); + (((((use_arg_then2 ("h_cond", []))(thm_tac (new_rewrite [] [])))) THEN (move ["x_in"])) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DART_EXISTS", [DART_EXISTS])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("E", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["hy"])) THEN (move ["hxy_in"]))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_eq_fan_list_iso", [hyp_iso_eq_fan_list_iso])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("iso_inv_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("hxy_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("fan_list_iso", [fan_list_iso]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("res_inv_subset", [res_inv_subset])) (fun fst_arg -> (use_arg_then2 ("bij_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("iso_dart", [iso_dart])) (fun fst_arg -> (use_arg_then2 ("iso_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hxy_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartL", []))(thm_tac (new_rewrite [] []))))); + ((case THEN (move ["a"]) THEN (move ["b"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("darts_of_list_subset", [darts_of_list_subset])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("IN_CROSS", [IN_CROSS]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("res_inv_pair", [res_inv_pair])) (fun fst_arg -> (use_arg_then2 ("bij_h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bij_h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("g_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("hxy_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((((fun arg_tac -> (use_arg_then2 ("res_inv_bij", [res_inv_bij])) (fun fst_arg -> (use_arg_then2 ("bij_h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`f (h v, h w) = v,w`))) (term_tac (have_gen_tac [](move ["fh_eq"])))); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fan_list_iso", [fan_list_iso]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h'_def", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("h'_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("darts_of_list_subset", [darts_of_list_subset])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("split_list_hyp_iso", [split_list_hyp_iso])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("iso_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("good_nodes", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("hvw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("fan_list_iso_invariant", [fan_list_iso_invariant]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fh_eq", []))(thm_tac (new_rewrite [] []))))) THEN (move ["iso2_f"])); + (((fun arg_tac -> (use_arg_then2 ("hyp_iso_ext", [hyp_iso_ext])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_inv", [hyp_iso_inv])) (fun fst_arg -> (use_arg_then2 ("iso2_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac) THEN (case THEN ((move ["a"]) THEN (move ["b"]))) THEN (move ["ab_in"])); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fan_list_nodes_iso_BIJ", [fan_list_nodes_iso_BIJ])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("iso_inv_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("good_nodes", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("h'_def", []))(thm_tac (new_rewrite [] [])))) THEN (move ["bij_h'"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("BIJ_pair", [BIJ_pair])) (fun fst_arg -> (use_arg_then2 ("bij_h'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bij_h'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)); + ((case THEN (move ["x"]) THEN (move ["y"])) THEN ((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fan_list_iso", [fan_list_iso]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h'_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["bij_f'"])) THEN (((fun arg_tac -> (use_arg_then2 ("res_inv_subset", [res_inv_subset])) (fun fst_arg -> (use_arg_then2 ("bij_f'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> (use_arg_then2 ("iso_dart", [iso_dart])) (fun fst_arg -> (use_arg_then2 ("iso2_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ab_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["x"]) THEN (move ["y"])))); + ((in_tac ["fan2"] true (((use_arg_then2 ("add_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_CROSS", [IN_CROSS]))(thm_tac (new_rewrite [] [])))))); + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (done_tac)); + ((((use_arg_then2 ("ab_in", [])) (disch_tac [])) THEN (clear_assumption "ab_in") THEN BETA_TAC) THEN (((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("good_split", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`v,w`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("darts_of_list_subset", [darts_of_list_subset])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then2 ("els_eq", []))(thm_tac (new_rewrite [] [])))) THEN (move ["ab_in2"]))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("res_inv_pair", [res_inv_pair])) (fun fst_arg -> (use_arg_then2 ("bij_h'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bij_h'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))); + (((repeat_tactic 1 9 (((use_arg_then2 ("ab_in2", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))) THEN (case THEN (move ["x"]) THEN (move ["y"])) THEN ((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fan_list_iso", [fan_list_iso]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h'_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`h a IN V /\ h b IN V`))) (term_tac (have_gen_tac [](move ["hab_inV"])))); + ((((use_arg_then2 ("bij_h", [])) (disch_tac [])) THEN (clear_assumption "bij_h") THEN BETA_TAC) THEN (((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["h_in"])) THEN (move ["_"]) THEN (move ["_"])) THEN (repeat_tactic 1 9 (((use_arg_then2 ("h_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((fun arg_tac -> (use_arg_then2 ("h'_eq", [])) (fun fst_arg -> (use_arg_then2 ("a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("h'_eq", [])) (fun fst_arg -> (use_arg_then2 ("b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("res_inv_bij", [res_inv_bij])) (fun fst_arg -> (use_arg_then2 ("bij_h'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section Lp_cond *) +let lp_cond_lemma = Sections.finalize_theorem lp_cond_lemma;; +let lp_fan_trans1 = Sections.finalize_theorem lp_fan_trans1;; +let lp_cond_trans1 = Sections.finalize_theorem lp_cond_trans1;; +Sections.end_section "Lp_cond";; + +(* Lemma lp_cond_trans *) +let lp_cond_trans = Sections.section_proof ["L";"V";"E";"g";"h";"ds"] +`lp_cond (L,g,h) (V,E) + ==> lp_cond (split_list_list L ds, g, h) (V, add_diag_list (g,V,E) ds)` +[ + (BETA_TAC THEN (move ["cond"])); + (((THENL) (((use_arg_then2 ("ds", [])) (disch_tac [])) THEN (clear_assumption "ds") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((((use_arg_then2 ("split_list_list", [split_list_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add_diag_list", [add_diag_list]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("foldr", [foldr]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("split_list_list", [split_list_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("add_diag_list", [add_diag_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("lp_cond_trans1", [lp_cond_trans1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma bij_in *) +let bij_in = Sections.section_proof ["f";"s";"t"] +`BIJ f s t ==> (!x. x IN s ==> f x IN t)` +[ + ((((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["bij_in"])) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("bij_in", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Lemma list_sum_neg *) +let list_sum_neg = Sections.section_proof ["s";"f"] +`list_sum s (\x. --(f x)) = --(list_sum s f)` +[ + (((((use_arg_then2 ("REAL_NEG_MINUS1", [REAL_NEG_MINUS1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_sum_lmul", [list_sum_lmul]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NEG_MINUS1", [REAL_NEG_MINUS1]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma list_sum_sub *) +let list_sum_sub = Sections.section_proof ["s";"f1";"f2"] +`list_sum s (\x. f1 x - f2 x) = list_sum s f1 - list_sum s f2` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("list_sum_add", [list_sum_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_sum_neg", [list_sum_neg]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_sum_filter *) +let list_sum_filter = Sections.section_proof ["s";"a";"f"] +`list_sum (filter a s) f = list_sum s (\x. if a x then f x else &0)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((((use_arg_then2 ("filter", [filter]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("list_sum_nil", [list_sum_nil]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("list_sum_cons", [list_sum_cons]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("Ih", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`a h`))) (disch_eq_tac "ah" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("list_sum_cons", [list_sum_cons]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("REAL_ADD_LID", [REAL_ADD_LID]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Section Contravening *) +Sections.begin_section "Contravening";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_hyp "cV" (`contravening V`));; + +(* Let fanV *) +Sections.add_section_lemma "fanV" (Sections.section_proof [] +`FAN (vec 0,V,ESTD V)` +[ + ((((use_arg_then2 ("CONTRAVENING_FAN", [CONTRAVENING_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Lemma contravening_lp_fan *) +let contravening_lp_fan = Sections.section_proof [] +`lp_fan (V,ESTD V)` +[ + ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fanV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CONTRAVENING_IMP_FULLY_SURROUNDED", [CONTRAVENING_IMP_FULLY_SURROUNDED]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((in_tac ["cV"] false (((use_arg_then2 ("contravening", [contravening]))(thm_tac (new_rewrite [] []))))) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("cV", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["v"]) THEN (move ["w"]) THEN (case THEN (move ["vV"])) THEN (case THEN (move ["wV"])) THEN (case THEN (move ["vw_neq"])))); + ((((use_arg_then2 ("contraR", [contraR])) (disch_tac [])) THEN (clear_assumption "contraR") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("IN_ESTD", [IN_ESTD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("wV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_neq", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma contravening_lp_cond *) +let contravening_lp_cond = Sections.section_proof ["L";"f"] +`good_list L /\ good_list_nodes L + /\ hyp_iso f (hypermap_of_fan (V,ESTD V), hypermap_of_list L) + ==> ?g h. lp_cond (L, g, h) (V, ESTD V)` +[ + (BETA_TAC THEN (case THEN (move ["goodL"])) THEN (case THEN (move ["good_nodes"])) THEN (move ["iso_f"])); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("lp_cond_lemma", [lp_cond_lemma])) (fun fst_arg -> (use_arg_then2 ("contravening_lp_fan", [contravening_lp_fan])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("good_nodes", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("iso_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["g"]) THEN (case THEN (move ["h"])) THEN (case THEN (move ["cond"])) THEN (move ["_"]))))); + ((((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("h", [])) (term_tac exists_tac))) THEN (done_tac)); +];; + +(* Lemma contravening_lp_cond_alt *) +let contravening_lp_cond_alt = Sections.section_proof ["L"] +`good_list L + /\ 2 * (sizel (list_of_elements L) + sizel (list_of_faces L)) = sizel (list_of_darts L) + 4 + /\ (iso) (hypermap_of_fan (V,ESTD V)) (hypermap_of_list L) + ==> ?g h. lp_cond (L, g, h) (V, ESTD V)` +[ + (BETA_TAC THEN (case THEN (move ["goodL"])) THEN (case THEN (move ["eq"])) THEN (move ["iso"])); + ((fun arg_tac -> (use_arg_then2 ("iso_imp_hyp_iso", [iso_imp_hyp_iso])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["f"]) THEN (move ["iso_f"]))))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("contravening_lp_cond", [contravening_lp_cond])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("iso_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((((fun arg_tac -> (use_arg_then2 ("good_list_nodes_size_condition", [good_list_nodes_size_condition])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("iso_planar", [iso_planar])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("iso_connected", [iso_connected])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("iso_edge_nondegenerate", [iso_edge_nondegenerate])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("Jgtdebu.JGTDEBU5", [Jgtdebu.JGTDEBU5]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("Jgtdebu.JGTDEBU3", [Jgtdebu.JGTDEBU3]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("Jgtdebu.JGTDEBU1", [Jgtdebu.JGTDEBU1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Bij *) +Sections.begin_section "Bij";; +(Sections.add_section_var (mk_var ("h", (`:num->real^3`))));; +(Sections.add_section_var (mk_var ("L", (`:((num)list)list`))));; +(Sections.add_section_hyp "bij_h" (`BIJ h (elements_of_list L) V`));; + +(* Lemma lnsum_ineq *) +let lnsum_ineq = Sections.section_proof [] +`&12 <= list_sum (list_of_elements L) (ln_list h)` +[ + ((((use_arg_then2 ("cV", [])) (disch_tac [])) THEN (clear_assumption "cV") THEN BETA_TAC) THEN ((((use_arg_then2 ("contravening", [contravening]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["ineq"])) THEN (move ["_"]))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`list_sum (list_of_elements L) (ln_list h) = scriptL V`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((((use_arg_then2 ("ineq", [ineq])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("list_sum_set_of_list", [list_sum_set_of_list]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uniq_list_of_elements", [uniq_list_of_elements]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("elements_of_list", [elements_of_list]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("scriptL", [scriptL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_defs_th", [list_defs_th]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("Basics.BIJ_SUM", [Basics.BIJ_SUM])) (fun fst_arg -> (use_arg_then2 ("bij_h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["v"]) THEN (move ["vV"]) THEN (simp_tac)) THEN ((((use_arg_then2 ("ln_fan", [ln_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yn_fan", [yn_fan]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Let cardV_eq *) +Sections.add_section_lemma "cardV_eq" (Sections.section_proof [] +`CARD V = LENGTH (list_of_elements L)` +[ + ((((use_arg_then2 ("Seq.size", [Seq.size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_set_of_list_uniq", [card_set_of_list_uniq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uniq_list_of_elements", [uniq_list_of_elements]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("elements_of_list", [elements_of_list]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((fun arg_tac -> (use_arg_then2 ("bij_card_eq", [bij_card_eq])) (fun fst_arg -> (use_arg_then2 ("bij_h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("elements_of_list", [elements_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_SET_OF_LIST", [FINITE_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; + +(* Let y_ineqs *) +Sections.add_section_lemma "y_ineqs" (Sections.section_proof ["y"] +`MEM y (list_of_elements L) ==> &2 <= norm (h y) /\ norm (h y) <= &2 * h0` +[ + (((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("elements_of_list", [elements_of_list]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["y_in"])); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`h y IN ball_annulus`))) (term_tac (have_gen_tac []ALL_TAC)))) (((((use_arg_then2 ("Fnjlbxs.in_ball_annulus", [Fnjlbxs.in_ball_annulus]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac))); + ((((use_arg_then2 ("cV", [])) (disch_tac [])) THEN (clear_assumption "cV") THEN BETA_TAC) THEN (((((use_arg_then2 ("contravening", [contravening]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("bij_in", [bij_in])) (fun fst_arg -> (use_arg_then2 ("bij_h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Lemma lnsum13_ineq *) +let lnsum13_ineq = Sections.section_proof [] +`sizel (list_of_elements L) = 13 ==> + list_sum (list_of_elements L) (\y. yn_list h y - &2) <= #0.52` +[ + ((((use_arg_then2 ("cV", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("contravening", [contravening]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["in_ba"])) THEN (move ["_"]) THEN (move ["size_eq"]))); + ((fun arg_tac -> arg_tac (Arg_term (`list_sum (list_of_elements L) (ln_list h) + = inv (h0 - &1) * list_sum (list_of_elements L) (\y. h0 - yn_list h y / &2)`))) (term_tac (have_gen_tac [](move ["eq"])))); + ((((use_arg_then2 ("list_sum_lmul", [list_sum_lmul]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("real_div", [real_div]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lfun", [lfun]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((use_arg_then2 ("list_sum_eq", [list_sum_eq])) (thm_tac apply_tac)) THEN (move ["y"]) THEN (move ["mem_y"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("list_defs_th", [list_defs_th]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ln_fan", [ln_fan]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("yn_fan", [yn_fan]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Nonlinear_lemma.lmfun_lfun", [Nonlinear_lemma.lmfun_lfun]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("y_ineqs", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("lnsum_ineq", [lnsum_ineq])) (disch_tac [])) THEN (clear_assumption "lnsum_ineq") THEN BETA_TAC) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("list_sum_sub", [list_sum_sub]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_sum_rmul", [list_sum_rmul]))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("list_sum_const", [list_sum_const])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`h0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("list_sum_const", [list_sum_const])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma lnsum13_high_strict *) +let lnsum13_high_strict = Sections.section_proof ["i"] +`MEM i (list_of_elements L) + /\ sizel (list_of_elements L) = 13 /\ #2.36 <= yn_list h i + ==> !j. MEM j (list_of_elements L) /\ ~(j = i) ==> yn_list h j < #2.18` +[ + (BETA_TAC THEN (case THEN (move ["mem_i"])) THEN (case THEN (move ["size13"])) THEN (move ["ineq"]) THEN (move ["j"]) THEN (case THEN (move ["mem_j"])) THEN (move ["j_neq_i"])); + ((fun arg_tac -> arg_tac (Arg_term (`delete1 i (delete1 j (list_of_elements L))`))) (term_tac (set_tac "s"))); + ((fun arg_tac -> arg_tac (Arg_term (`list_sum s (\y. yn_list h y - &2) + = list_sum (list_of_elements L) (\y. yn_list h y - &2) - (yn_list h i + yn_list h j - &4)`))) (term_tac (have_gen_tac []ALL_TAC))); + ((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("list_sum_delete1", [list_sum_delete1]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_j", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("mem_delete1_uniq", [mem_delete1_uniq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uniq_list_of_elements", [uniq_list_of_elements]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("j_neq_i", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("mem_i", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`&0 <= list_sum s (\y. yn_list h y - &2)`))) (term_tac (have_gen_tac []ALL_TAC))); + (((((use_arg_then2 ("list_sum_ge0", [list_sum_ge0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_defs_th", [list_defs_th]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yn_fan", [yn_fan]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["mem_x"]) THEN (simp_tac)); + (((((use_arg_then2 ("REAL_SUB_LE", [REAL_SUB_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_ineqs", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mem_delete1", [mem_delete1])) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mem_delete1", [mem_delete1])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("ineq", [ineq])) (disch_tac [])) THEN (clear_assumption "ineq") THEN ((fun arg_tac -> (use_arg_then2 ("lnsum13_ineq", [lnsum13_ineq])) (fun fst_arg -> (use_arg_then2 ("size13", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma lnsum13_high *) +let lnsum13_high = Sections.section_proof ["i"] +`MEM i (list_of_elements L) + /\ sizel (list_of_elements L) = 13 /\ #2.36 <= yn_list h i + ==> ALL (\j. ~(j = i) ==> yn_list h j <= #2.18) (list_of_elements L)` +[ + ((((use_arg_then2 ("ALL_MEM", [ALL_MEM]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["mem_i"])) THEN (case THEN (move ["size13"])) THEN (move ["ineq"]) THEN (move ["j"]) THEN (simp_tac) THEN (move ["mem_j"]) THEN (move ["j_neq_i"])); + (((((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("lnsum13_high_strict", [lnsum13_high_strict])) (fun fst_arg -> (use_arg_then2 ("mem_i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma lnsum13_mid *) +let lnsum13_mid = Sections.section_proof ["i";"j"] +`MEM i (list_of_elements L) /\ MEM j (list_of_elements L) /\ ~(i = j) + /\ sizel (list_of_elements L) = 13 + /\ #2.18 <= yn_list h i /\ #2.18 <= yn_list h j + ==> ALL (\k. ~(k = i) /\ ~(k = j) ==> yn_list h k <= #2.18) (list_of_elements L) + /\ yn_list h i <= #2.36 /\ yn_list h j <= #2.36` +[ + ((THENL_ROT (-1)) (((((use_arg_then2 ("ALL_MEM", [ALL_MEM]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["mem_i"])) THEN (case THEN (move ["mem_j"])) THEN (case THEN (move ["i_neq_j"])) THEN (case THEN (move ["size13"])) THEN (move ["ineqs"]) THEN (simp_tac)) THEN (split_tac))); + ((((use_arg_then2 ("i_neq_j", [])) (disch_tac [])) THEN (clear_assumption "i_neq_j") THEN ((use_arg_then2 ("contraR", [contraR])) (disch_tac [])) THEN (clear_assumption "contraR") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_NOT_LE", [REAL_NOT_LE]))(thm_tac (new_rewrite [] []))))) THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lnsum13_high_strict", [lnsum13_high_strict])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN ((ANTS_TAC) THEN ((TRY done_tac)))); + ((BETA_TAC THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("mem_j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN (((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((BETA_TAC THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("mem_i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN (((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (BETA_TAC THEN (move ["k"]) THEN (move ["mem_k"]) THEN (move ["k_neq"])); + ((fun arg_tac -> arg_tac (Arg_term (`delete1 k (delete1 i (delete1 j (list_of_elements L)))`))) (term_tac (set_tac "s"))); + ((fun arg_tac -> arg_tac (Arg_term (`list_sum s (\y. yn_list h y - &2) + = list_sum (list_of_elements L) (\y. yn_list h y - &2) + - (yn_list h k + yn_list h i + yn_list h j - &6)`))) (term_tac (have_gen_tac []ALL_TAC))); + ((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("list_sum_delete1", [list_sum_delete1]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_j", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("mem_delete1_uniq", [mem_delete1_uniq]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uniq_delete1", [uniq_delete1]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uniq_list_of_elements", [uniq_list_of_elements]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("i_neq_j", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_i", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("k_neq", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_k", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`&0 <= list_sum s (\y. yn_list h y - &2)`))) (term_tac (have_gen_tac []ALL_TAC))); + (((((use_arg_then2 ("list_sum_ge0", [list_sum_ge0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_defs_th", [list_defs_th]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yn_fan", [yn_fan]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["mem_x"]) THEN (simp_tac)); + (((((use_arg_then2 ("REAL_SUB_LE", [REAL_SUB_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_ineqs", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mem_delete1", [mem_delete1])) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mem_delete1", [mem_delete1])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mem_delete1", [mem_delete1])) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN ((fun arg_tac -> (use_arg_then2 ("lnsum13_ineq", [lnsum13_ineq])) (fun fst_arg -> (use_arg_then2 ("size13", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section Bij *) +let lnsum_ineq = Sections.finalize_theorem lnsum_ineq;; +let lnsum13_ineq = Sections.finalize_theorem lnsum13_ineq;; +let lnsum13_high_strict = Sections.finalize_theorem lnsum13_high_strict;; +let lnsum13_high = Sections.finalize_theorem lnsum13_high;; +let lnsum13_mid = Sections.finalize_theorem lnsum13_mid;; +Sections.end_section "Bij";; + +(* Finalization of the section Contravening *) +let contravening_lp_fan = Sections.finalize_theorem contravening_lp_fan;; +let contravening_lp_cond = Sections.finalize_theorem contravening_lp_cond;; +let contravening_lp_cond_alt = Sections.finalize_theorem contravening_lp_cond_alt;; +let lnsum_ineq = Sections.finalize_theorem lnsum_ineq;; +let lnsum13_ineq = Sections.finalize_theorem lnsum13_ineq;; +let lnsum13_high_strict = Sections.finalize_theorem lnsum13_high_strict;; +let lnsum13_high = Sections.finalize_theorem lnsum13_high;; +let lnsum13_mid = Sections.finalize_theorem lnsum13_mid;; +Sections.end_section "Contravening";; + +(* Lemma hyp_iso_comm_power *) +let hyp_iso_comm_power = Sections.section_proof ["H";"G";"g";"d"] +`hyp_iso g (G, H) /\ d IN dart G + ==> (!k. (face_map H POWER k) (g d) = g ((face_map G POWER k) d))` +[ + (BETA_TAC THEN (case THEN ((move ["iso_g"]) THEN (move ["d_in"])))); + ((THENL_FIRST) ((THENL) elim [ALL_TAC; ((move ["k"]) THEN (move ["Ih"]))]) (((repeat_tactic 1 9 (((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("COM_POWER", [COM_POWER]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_comm", [hyp_iso_comm])) (fun fst_arg -> (use_arg_then2 ("iso_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("lemma_dart_invariant_power_face", [lemma_dart_invariant_power_face]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section ExtraDefs *) +Sections.begin_section "ExtraDefs";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_var (mk_var ("L", (`:((num)list)list`))));; +(Sections.add_section_var (mk_var ("g", (`:(num#num -> real^3#real^3)`))));; +(Sections.add_section_hyp "fanV" (`FAN (vec 0,V,E)`));; +(Sections.add_section_hyp "goodL" (`good_list L`));; +(Sections.add_section_hyp "iso_g" (`hyp_iso g (hypermap_of_list L, hypermap_of_fan (V,E))`));; + +(* Lemma y8_list_def *) +let y8_list_def = Sections.section_proof [] +`ALL (\d. y8_list (g,V,E) d + = ye_list g (inverse (f_list_ext L) (inverse (f_list_ext L) d))) (list_of_darts L)` +[ + (((((use_arg_then2 ("ALL_MEM", [ALL_MEM]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["d"]) THEN (move ["mem_d"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("list_defs_th", [list_defs_th]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartL"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["faceL"]))))); + ((((use_arg_then2 ("mem_d", [])) (disch_tac [])) THEN (clear_assumption "mem_d") THEN BETA_TAC) THEN (((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartL", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["d_in"]))); + ((((use_arg_then2 ("faceL", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("hyp_iso_inverse_comm", [hyp_iso_inverse_comm])) (fun fst_arg -> (use_arg_then2 ("iso_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_dart_inveriant_under_inverse_maps", [lemma_dart_inveriant_under_inverse_maps]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y8_fan", [y8_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ye_fan", [ye_fan]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(Sections.add_section_var (mk_var ("h", (`:num -> real^3`))));; +(Sections.add_section_hyp "g_eq" (`!x. g x = h (FST x), h (SND x)`));; + +(* Lemma y4'_list_def *) +let y4'_list_def = Sections.section_proof [] +`ALL (\d. y4'_list (g,V,E) d + = ye_list g (SND d, FST (inverse (f_list_ext L) d))) (list_of_darts L)` +[ + (((((use_arg_then2 ("ALL_MEM", [ALL_MEM]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("list_defs_th", [list_defs_th]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y4'_fan", [y4'_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ye_fan", [ye_fan]))(thm_tac (new_rewrite [] []))))) THEN (move ["d"]) THEN (move ["mem_d"])); + ((((fun arg_tac -> (use_arg_then2 ("pair_expand", [pair_expand])) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [3] [])))) THEN (((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartL"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["faceL"]))))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["faceH"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`d IN dart (hypermap_of_list L)`))) (term_tac (have_gen_tac [](move ["d_in"])))); + (((((use_arg_then2 ("dartL", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then2 ("g_eq", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("g_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("faceH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_inverse_comm", [hyp_iso_inverse_comm])) (fun fst_arg -> (use_arg_then2 ("iso_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y4'_list_f_def *) +let y4'_list_f_def = Sections.section_proof [] +`ALL (\d. y4'_list (g,V,E) (f_list_ext L d) + = ye_list g (SND (f_list_ext L d), FST d)) (list_of_darts L)` +[ + (((use_arg_then2 ("y4'_list_def", [y4'_list_def])) (disch_tac [])) THEN (clear_assumption "y4'_list_def") THEN BETA_TAC); + ((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartL"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["faceL"]))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("ALL_MEM", [ALL_MEM]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (simp_tac)) THEN (move ["eq1"]) THEN (move ["d"]) THEN (move ["mem_d"])); + ((fun arg_tac -> arg_tac (Arg_term (`d IN dart (hypermap_of_list L)`))) (term_tac (have_gen_tac [](move ["d_in"])))); + (((((use_arg_then2 ("dartL", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("eq1", []))(thm_tac (new_rewrite [] [])))); + (((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartL", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("faceL", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("faceL", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES", [PERMUTES_INVERSES])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`darts_of_list L`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dartL", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hypermap_lemma", [hypermap_lemma]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y4'_list_inv_f_def *) +let y4'_list_inv_f_def = Sections.section_proof [] +`ALL (\d. y4'_list (g,V,E) (inverse (f_list_ext L) d) + = ye_list g (FST d, FST ((inverse (f_list_ext L) POWER 2) d))) (list_of_darts L)` +[ + (((use_arg_then2 ("y4'_list_def", [y4'_list_def])) (disch_tac [])) THEN (clear_assumption "y4'_list_def") THEN BETA_TAC); + ((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartL"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["faceL"]))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("ALL_MEM", [ALL_MEM]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (simp_tac)) THEN (move ["eq1"]) THEN (move ["d"]) THEN (move ["mem_d"])); + ((fun arg_tac -> arg_tac (Arg_term (`d IN dart (hypermap_of_list L)`))) (term_tac (have_gen_tac [](move ["d_in"])))); + (((((use_arg_then2 ("dartL", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("eq1", []))(thm_tac (new_rewrite [] [])))); + (((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartL", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("faceL", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_dart_inveriant_under_inverse_maps", [lemma_dart_inveriant_under_inverse_maps]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("goodL", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["uniqL"])) THEN (move ["_"]))); + (((((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN ((congr_tac (`ye_list g (_1, _2)`)) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("f_list_ext_inverse", [f_list_ext_inverse]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartL", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("mem_d", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dart_in_face", [dart_in_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_face_alt", [find_face_alt]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("pair_expand", [pair_expand])) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))); + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("prev_el_list_pairs_general", [prev_el_list_pairs_general])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["z"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y4'_list_ff_def *) +let y4'_list_ff_def = Sections.section_proof [] +`ALL (\d. y4'_list (g,V,E) ((f_list_ext L POWER 2) d) + = ye_list g (SND ((f_list_ext L POWER 2) d), SND d)) (list_of_darts L)` +[ + ((((use_arg_then2 ("ALL_MEM", [ALL_MEM]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["d"]) THEN (move ["mem_d"]) THEN (simp_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("list_defs_th", [list_defs_th]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`g (SND ((f_list_ext L POWER 2) d), SND d) = SND (g ((f_list_ext L POWER 2) d)), SND (g d)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("g_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartL"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["faceL"]))))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["faceH"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`d IN dart (hypermap_of_list L)`))) (term_tac (have_gen_tac [](move ["d_in"])))); + (((((use_arg_then2 ("dartL", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("faceL", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_comm_power", [hyp_iso_comm_power])) (fun fst_arg -> (use_arg_then2 ("iso_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("faceH", []))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("y4'_fan", [y4'_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ye_fan", [ye_fan]))(thm_tac (new_rewrite [] []))))) THEN ((congr_tac (`dist (_1, _2)`)) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`inverse _`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES_o", [PERMUTES_INVERSES_o])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))); + (((fun arg_tac -> arg_tac (Arg_term (`g d IN _`))) (disch_eq_tac "gd_in1" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((((fun arg_tac -> (use_arg_then2 ("pair_expand", [pair_expand])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`g d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("iso_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart_of_fan_eq", [dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("gd_in1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orFb", [orFb]))(thm_tac (new_rewrite [] [])))))); + ((((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((fun arg_tac -> (use_arg_then2 ("pair_expand", [pair_expand])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`g d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["v"])) THEN (case THEN (move ["_"])) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac)); +];; + +(* Lemma y4'_list_fff_def *) +let y4'_list_fff_def = Sections.section_proof [] +`ALL (\d. y4'_list (g,V,E) ((f_list_ext L POWER 3) d) + = ye_list g (SND ((f_list_ext L POWER 3) d), SND (f_list_ext L d))) (list_of_darts L)` +[ + (((use_arg_then2 ("y4'_list_ff_def", [y4'_list_ff_def])) (disch_tac [])) THEN (clear_assumption "y4'_list_ff_def") THEN BETA_TAC); + ((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartL"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["faceL"]))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("ALL_MEM", [ALL_MEM]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (simp_tac)) THEN (move ["eq1"]) THEN (move ["d"]) THEN (move ["mem_d"])); + ((fun arg_tac -> arg_tac (Arg_term (`d IN dart (hypermap_of_list L)`))) (term_tac (have_gen_tac [](move ["d_in"])))); + (((((use_arg_then2 ("dartL", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("THREE", [THREE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER", [POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq1", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartL", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("faceL", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section ExtraDefs *) +let y8_list_def = Sections.finalize_theorem y8_list_def;; +let y4'_list_def = Sections.finalize_theorem y4'_list_def;; +let y4'_list_f_def = Sections.finalize_theorem y4'_list_f_def;; +let y4'_list_inv_f_def = Sections.finalize_theorem y4'_list_inv_f_def;; +let y4'_list_ff_def = Sections.finalize_theorem y4'_list_ff_def;; +let y4'_list_fff_def = Sections.finalize_theorem y4'_list_fff_def;; +Sections.end_section "ExtraDefs";; + +(* Section ExtraFan *) +Sections.begin_section "ExtraFan";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_hyp "fanV" (`FAN (vec 0,V,E)`));; + +(* Let dartH *) +Sections.add_section_lemma "dartH" (Sections.section_proof [] +`dart (hypermap_of_fan (V,E)) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Lemma f_fan_pair_ext_power_inverse *) +let f_fan_pair_ext_power_inverse = Sections.section_proof ["k";"d"] +`d IN dart_of_fan (V,E) + /\ k < CARD (face (hypermap_of_fan (V,E)) d) + ==> (f_fan_pair_ext (V,E) POWER k) d + = (inverse (f_fan_pair_ext (V,E)) POWER (CARD (face (hypermap_of_fan (V,E)) d) - k)) d` +[ + (BETA_TAC THEN (case THEN ((move ["d_in"]) THEN (move ["k_lt"])))); + ((fun arg_tac -> arg_tac (Arg_term (`CARD _`))) (term_tac (set_tac "n"))); + (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FINITE_ORBIT_MAP_INVERSE", [FINITE_ORBIT_MAP_INVERSE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dart_of_fan (V,E)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))); + (((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("face_map_and_darts", [face_map_and_darts]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("face", [face]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`n - (n - k) = k:num`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((ALL_TAC) THEN (done_tac))); + ((((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma f_fan_pair_ext_power_in_dart *) +let f_fan_pair_ext_power_in_dart = Sections.section_proof ["k";"d"] +`d IN dart_of_fan (V,E) + ==> (f_fan_pair_ext (V,E) POWER k) d IN dart_of_fan (V,E)` +[ + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["d_in"])); + ((((use_arg_then2 ("lemma_dart_invariant_power_face", [lemma_dart_invariant_power_face]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma f_fan_pair_ext_power_inj *) +let f_fan_pair_ext_power_inj = Sections.section_proof ["k1";"k2";"d"] +`d IN dart_of_fan (V,E) + /\ k1 < CARD (face (hypermap_of_fan (V,E)) d) /\ k2 < CARD (face (hypermap_of_fan (V,E)) d) + ==> ((f_fan_pair_ext (V,E) POWER k1) d = (f_fan_pair_ext (V,E) POWER k2) d + <=> k1 = k2)` +[ + ((fun arg_tac -> arg_tac (Arg_term (`CARD _`))) (term_tac (set_tac "n"))); + (BETA_TAC THEN (case THEN (move ["d_in"])) THEN (case THEN (move ["k1_lt"])) THEN (move ["k2_lt"])); + ((THENL_LAST) (split_tac) ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("ORBIT_MAP_INJ", [ORBIT_MAP_INJ])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (DISCH_THEN apply_tac) THEN ((use_arg_then2 ("n", [])) (term_tac exists_tac))); + (((((fun arg_tac -> (use_arg_then2 ("FINITE_DART_OF_FAN", [FINITE_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("face", [face]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma f_fan_pair_ext_in_dart1 *) +let f_fan_pair_ext_in_dart1 = Sections.section_proof ["d"] +`d IN dart1_of_fan (V,E) ==> + f_fan_pair_ext (V,E) d IN dart1_of_fan (V,E)` +[ + ((BETA_TAC THEN (move ["d_in"])) THEN ((((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("E_N_F_IN_DART1_OF_FAN", [E_N_F_IN_DART1_OF_FAN]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma f_fan_pair_ext_power_in_dart1 *) +let f_fan_pair_ext_power_in_dart1 = Sections.section_proof ["k";"d"] +`d IN dart1_of_fan (V,E) + ==> (f_fan_pair_ext (V,E) POWER k) d IN dart1_of_fan (V,E)` +[ + (BETA_TAC THEN (move ["d_in"])); + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("k", [])) (disch_tac [])) THEN (clear_assumption "k") THEN elim) [ALL_TAC; ((move ["k"]) THEN (move ["Ih"]))]) (((((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("COM_POWER", [COM_POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair_ext_in_dart1", [f_fan_pair_ext_in_dart1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma f_fan_pair_ext_in_dart *) +let f_fan_pair_ext_in_dart = Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) + ==> f_fan_pair_ext (V,E) d IN dart_of_fan (V,E)` +[ + ((BETA_TAC THEN (move ["d_in"])) THEN ((((use_arg_then2 ("POWER_1", [POWER_1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair_ext_power_in_dart", [f_fan_pair_ext_power_in_dart]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma inv_f_fan_pair_ext_power_in_dart1 *) +let inv_f_fan_pair_ext_power_in_dart1 = Sections.section_proof ["k";"d"] +`d IN dart1_of_fan (V,E) + ==> (inverse (f_fan_pair_ext (V,E)) POWER k) d IN dart1_of_fan (V,E)` +[ + (BETA_TAC THEN (move ["d_in"])); + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("k", [])) (disch_tac [])) THEN (clear_assumption "k") THEN elim) [ALL_TAC; ((move ["k"]) THEN (move ["Ih"]))]) (((((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("COM_POWER", [COM_POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INVERSE_F_IN_DART1_OF_FAN", [INVERSE_F_IN_DART1_OF_FAN]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma face_eq_power *) +let face_eq_power = Sections.section_proof ["k";"d"] +`d IN darts_k k (hypermap_of_fan (V,E)) + ==> face (hypermap_of_fan (V,E)) d = {(f_fan_pair_ext (V,E) POWER i) d | i < k}` +[ + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["hypV"]))); + (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("face", [face]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("hypV", []))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["card_f"])); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FINITE_ORBIT_MAP", [FINITE_ORBIT_MAP])) (fun fst_arg -> (use_arg_then2 ("card_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("finite_dart1", [finite_dart1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma face4_eq *) +let face4_eq = Sections.section_proof ["v";"w"] +`let w' = sigma_fan (vec 0) V E v w in + let u = sigma_fan (vec 0) V E w' v in + v,w IN darts_k 4 (hypermap_of_fan (V,E)) + ==> (f_fan_pair_ext (V,E) (v,w) = (w,u) + /\ (f_fan_pair_ext (V,E) POWER 2) (v,w) = (u,w') + /\ (f_fan_pair_ext (V,E) POWER 3) (v,w) = (w',v) + /\ f_fan_pair_ext (V,E) (w,u) = (u,w') + /\ f_fan_pair_ext (V,E) (u,w') = (w',v) + /\ f_fan_pair_ext (V,E) (w',v) = (v,w)) + /\ (v,w IN dart1_of_fan (V,E) /\ w,u IN dart1_of_fan (V,E) + /\ u,w' IN dart1_of_fan (V,E) /\ w',v IN dart1_of_fan (V,E)) + /\ face (hypermap_of_fan (V,E)) (v,w) = {(v,w), (w,u), (u,w'), (w',v)}` +[ + (repeat_tactic 1 9 ((CONV_TAC let_CONV))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E w' v`))) (term_tac (set_tac "u"))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["hypV"]))); + ((BETA_TAC THEN (move ["vw_in4"])) THEN (((use_arg_then2 ("vw_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hypV", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"]))); + ((fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (move ["inv_eq"])); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["vw_in1"])))); + (((((use_arg_then2 ("CARD_FACE_GT_1", [CARD_FACE_GT_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fanV", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`w',v IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["w'v_in1"])))); + (((((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`f_fan_pair_ext (V,E)`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`(inverse f POWER 2) (v,w) = (u,w')`))) (term_tac (have_gen_tac [](move ["eq0"])))); + ((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'v_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("u_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`2 < 4 /\ 4 - 2 = 2 /\ 3 < 4 /\ 4 - 3 = 1`))) (term_tac (have_gen_tac [](move ["ineqs"])))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`(f POWER 2) (v,w) = u,w'`))) (term_tac (have_gen_tac [](move ["eq2"])))) ((((use_arg_then2 ("inv_eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`f (v,w) = w,u`))) (term_tac (have_gen_tac [](move ["eq1"])))); + ((((use_arg_then2 ("pair_expand", [pair_expand]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("eq2", [])) (disch_tac [])) THEN (clear_assumption "eq2") THEN BETA_TAC) THEN ((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair_ext_in_dart1", [f_fan_pair_ext_in_dart1]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)))); + ((((((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("pair_expand", [pair_expand])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(f POWER 3) (v,w) = w',v`))) (term_tac (have_gen_tac [](move ["eq3"])))); + ((((use_arg_then2 ("inv_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ineqs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("eq1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq3", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("eq1", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq2", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq3", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("THREE", [THREE]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("POWER", [POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((((use_arg_then2 ("inv_eq", []))(thm_tac (new_rewrite [1] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ineqs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [1; 2] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES", [PERMUTES_INVERSES])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair_ext_in_dart1", [f_fan_pair_ext_in_dart1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("f_fan_pair_ext_power_in_dart1", [f_fan_pair_ext_power_in_dart1]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("face_eq_power", [face_eq_power])) (fun fst_arg -> (use_arg_then2 ("vw_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (gen_FINITE_SET 4)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma face5_eq *) +let face5_eq = Sections.section_proof ["v";"w"] +`let w' = sigma_fan (vec 0) V E v w in + let u = sigma_fan (vec 0) V E w' v in + let z = sigma_fan (vec 0) V E u w' in + v,w IN darts_k 5 (hypermap_of_fan (V,E)) + ==> (f_fan_pair_ext (V,E) (v,w) = (w,z) + /\ (f_fan_pair_ext (V,E) POWER 2) (v,w) = (z,u) + /\ (f_fan_pair_ext (V,E) POWER 3) (v,w) = (u,w') + /\ (f_fan_pair_ext (V,E) POWER 4) (v,w) = (w',v) + /\ f_fan_pair_ext (V,E) (w,z) = (z,u) + /\ f_fan_pair_ext (V,E) (z,u) = (u,w') + /\ f_fan_pair_ext (V,E) (u,w') = (w',v) + /\ f_fan_pair_ext (V,E) (w',v) = (v,w) + /\ inverse (f_fan_pair_ext (V,E)) (v,w) = (w',v)) + /\ (v,w IN dart1_of_fan (V,E) /\ w,z IN dart1_of_fan (V,E) /\ z,u IN dart1_of_fan (V,E) + /\ u,w' IN dart1_of_fan (V,E) /\ w',v IN dart1_of_fan (V,E)) + /\ face (hypermap_of_fan (V,E)) (v,w) = {(v,w), (w,z), (z,u), (u,w'), (w',v)}` +[ + (repeat_tactic 1 9 ((CONV_TAC let_CONV))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E w' v`))) (term_tac (set_tac "u"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E u w'`))) (term_tac (set_tac "z"))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["hypV"]))); + ((BETA_TAC THEN (move ["vw_in5"])) THEN (((use_arg_then2 ("vw_in5", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hypV", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"]))); + ((fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (move ["inv_eq"])); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["vw_in1"])))); + (((((use_arg_then2 ("CARD_FACE_GT_1", [CARD_FACE_GT_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fanV", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`f_fan_pair_ext (V,E)`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`(inverse f) (v,w) = (w',v)`))) (term_tac (have_gen_tac [](move ["eq_inv1"])))); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(inverse f POWER 2) (v,w) = (u,w')`))) (term_tac (have_gen_tac [](move ["eq_inv2"])))); + ((((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_inv1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_inv1", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("INVERSE_F_IN_DART1_OF_FAN", [INVERSE_F_IN_DART1_OF_FAN]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(inverse f POWER 3) (v,w) = (z,u)`))) (term_tac (have_gen_tac [](move ["eq_inv3"])))); + ((((use_arg_then2 ("THREE", [THREE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("COM_POWER", [COM_POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_inv2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_inv2", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("inv_f_fan_pair_ext_power_in_dart1", [inv_f_fan_pair_ext_power_in_dart1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`2 < 5 /\ 5 - 2 = 3 /\ 3 < 5 /\ 5 - 3 = 2 /\ 4 < 5 /\ 5 - 4 = 1`))) (term_tac (have_gen_tac [](move ["ineqs"])))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`(f POWER 2) (v,w) = z,u`))) (term_tac (have_gen_tac [](move ["eq2"])))) ((((use_arg_then2 ("inv_eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`(f POWER 3) (v,w) = u,w'`))) (term_tac (have_gen_tac [](move ["eq3"])))) ((((use_arg_then2 ("inv_eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`(f POWER 4) (v,w) = w',v`))) (term_tac (have_gen_tac [](move ["eq4"])))) (((((use_arg_then2 ("inv_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ineqs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`f (v,w) = w,z`))) (term_tac (have_gen_tac [](move ["eq1"])))); + ((((use_arg_then2 ("pair_expand", [pair_expand]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("eq2", [])) (disch_tac [])) THEN (clear_assumption "eq2") THEN BETA_TAC) THEN ((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair_ext_in_dart1", [f_fan_pair_ext_in_dart1]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)))); + ((((((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("pair_expand", [pair_expand])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("eq1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq3", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq4", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_inv1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)); + ((((use_arg_then2 ("eq1", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq2", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq3", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq4", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("THREE", [THREE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER", [POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`4 = SUC 3`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("THREE", [THREE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("POWER", [POWER]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + (((((use_arg_then2 ("eq_inv1", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES", [PERMUTES_INVERSES])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("eq1", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq2", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq3", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq4", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair_ext_in_dart1", [f_fan_pair_ext_in_dart1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("f_fan_pair_ext_power_in_dart1", [f_fan_pair_ext_power_in_dart1]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + (((((fun arg_tac -> (use_arg_then2 ("face_eq_power", [face_eq_power])) (fun fst_arg -> (use_arg_then2 ("vw_in5", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (gen_FINITE_SET 5)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma face_last_dart *) +let face_last_dart = Sections.section_proof ["v";"w"] +`v,w IN dart1_of_fan (V,E) + ==> (f_fan_pair_ext (V,E) POWER (CARD (face (hypermap_of_fan (V,E)) (v,w)) - 1)) (v,w) + = sigma_fan (vec 0) V E v w, v` +[ + (BETA_TAC THEN (move ["vw_in1"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["vw_in"])))) (((((use_arg_then2 ("dart_of_fan_eq", [dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FACE_NOT_EMPTY", [FACE_NOT_EMPTY])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan (V,E)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`v,w`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["ineq"]))); + ((THENL_FIRST) (((fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) ((((use_arg_then2 ("ineq", [ineq])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("subKn", [subKn]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section ExtraFan *) +let f_fan_pair_ext_power_inverse = Sections.finalize_theorem f_fan_pair_ext_power_inverse;; +let f_fan_pair_ext_power_in_dart = Sections.finalize_theorem f_fan_pair_ext_power_in_dart;; +let f_fan_pair_ext_power_inj = Sections.finalize_theorem f_fan_pair_ext_power_inj;; +let f_fan_pair_ext_in_dart1 = Sections.finalize_theorem f_fan_pair_ext_in_dart1;; +let f_fan_pair_ext_power_in_dart1 = Sections.finalize_theorem f_fan_pair_ext_power_in_dart1;; +let f_fan_pair_ext_in_dart = Sections.finalize_theorem f_fan_pair_ext_in_dart;; +let inv_f_fan_pair_ext_power_in_dart1 = Sections.finalize_theorem inv_f_fan_pair_ext_power_in_dart1;; +let face_eq_power = Sections.finalize_theorem face_eq_power;; +let face4_eq = Sections.finalize_theorem face4_eq;; +let face5_eq = Sections.finalize_theorem face5_eq;; +let face_last_dart = Sections.finalize_theorem face_last_dart;; +Sections.end_section "ExtraFan";; + +(* Section FanAddDiag *) +Sections.begin_section "FanAddDiag";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_hyp "fanV" (`FAN (vec 0,V,E)`));; + +(* Let dartH *) +Sections.add_section_lemma "dartH" (Sections.section_proof [] +`dart (hypermap_of_fan (V,E)) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let in_dart_inV *) +Sections.add_section_lemma "in_dart_inV" (Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) ==> FST d IN V /\ SND d IN V` +[ + (((((use_arg_then2 ("pair_expand", [pair_expand]))(thm_tac (new_rewrite [1] [])))) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +]);; + +(* Lemma add_diag_eq_E *) +let add_diag_eq_E = Sections.section_proof ["d"] +`CARD (face (hypermap_of_fan (V,E)) d) = 3 + ==> add_diag (V,E) d = E` +[ + ((((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["card_eq"])) THEN (((use_arg_then2 ("add_diag", [add_diag]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`v,w IN _`))) (disch_eq_tac "vw_in1" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["vw_in"])))) (((((use_arg_then2 ("dart_of_fan_eq", [dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("split_fan_face_eq", [split_fan_face_eq])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"]))) THEN (done_tac)); +];; + +(* Finalization of the section FanAddDiag *) +let add_diag_eq_E = Sections.finalize_theorem add_diag_eq_E;; +Sections.end_section "FanAddDiag";; + +(* Section FullySurroundedAddDiag *) +Sections.begin_section "FullySurroundedAddDiag";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_hyp "fanV" (`FAN (vec 0,V,E)`));; + +(* Let dartH *) +Sections.add_section_lemma "dartH" (Sections.section_proof [] +`dart (hypermap_of_fan (V,E)) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; +(Sections.add_section_hyp "f_surr" (`fully_surrounded (V,E)`));; + +(* Let dart1_eq *) +Sections.add_section_lemma "dart1_eq" (Sections.section_proof [] +`dart1_of_fan (V,E) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Lemma pack_dist *) +let pack_dist = Sections.section_proof ["x"] +`packing V /\ x IN dart_of_fan (V,E) ==> &2 <= dist x` +[ + ((((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (case THEN (move ["packV"]))) THEN ((((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["vw_in"]))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("iffLR", [iffLR])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("Fnjlbxs.packing", [Fnjlbxs.packing])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("packV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN", [PAIR_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ", [PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma split_fan_face_eq_add_diag *) +let split_fan_face_eq_add_diag = Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) + ==> split_fan_face (V,E) d = V, add_diag (V,E) d` +[ + ((((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"])) THEN ((((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add_diag", [add_diag]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma faces_add_diag *) +let faces_add_diag = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + ==> let H2 = hypermap_of_fan (V, add_diag (V,E) (v,w)) in + let H = hypermap_of_fan (V,E) in + let w' = sigma_fan (vec 0) V E v w in + face_set H2 = {face H2 (v,w), face H2 (w',w)} + UNION (face_set H DELETE (face H (v,w)))` +[ + ((BETA_TAC THEN (move ["vw_in"])) THEN (repeat_tactic 1 9 ((CONV_TAC let_CONV)))); + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (move ["f"])); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_card_face_alt", [fully_surrounded_card_face_alt])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["card_f"])); + ((((use_arg_then2 ("split_fan_face_eq_add_diag", [split_fan_face_eq_add_diag]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("split_fan_face_eq", [split_fan_face_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`w',w IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["w'w_in"])))); + (((((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair3", [f_fan_pair3]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((THENL) (split_tac) [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); ALL_TAC]) (((((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbC", [orbC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbA", [orbA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orNb", [orNb]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((THENL) case [ALL_TAC; (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))]) THEN ((TRY done_tac))) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE face_split_fan_face_explicit))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("face_split_fan_face", [face_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("split_fan_face_eq_add_diag", [split_fan_face_eq_add_diag]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] []))))); + (BETA_TAC THEN (case THEN (move ["fan2"])) THEN (case THEN (move ["dart2"])) THEN (move ["f_surr2"]) THEN (move ["fs_eq"]) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["f2_vw"]) THEN (move ["f2_w'w"]))) THEN (move ["_"])); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH2"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["fH2"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H2"))); + ((THENL_ROT (-1)) (split_tac)); + ((THENL_FIRST) case ((case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartH2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((BETA_TAC THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (case THEN (move ["d"]))) THEN ((((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["f_neq"]))); + ((THENL_LAST) (((fun arg_tac -> (use_arg_then2 ("fs_eq", [])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) (((((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartH2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("f_neq", [])) (disch_tac [])) THEN (clear_assumption "f_neq") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["d"]))); + (((((use_arg_then2 ("dartH2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in_cond"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((THENL_ROT (-1)) ((THENL) (((use_arg_then2 ("d_in_cond", [])) (disch_tac [])) THEN (clear_assumption "d_in_cond") THEN case) [(move ["d_in"]); ALL_TAC])); + ((case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (DISJ1_TAC) THEN (DISJ1_TAC)); + ((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("f2_vw", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`d IN face (hypermap_of_fan (V,E)) (v,w)`))) (disch_eq_tac "d_in_f" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + ((DISJ2_TAC) THEN ((((use_arg_then2 ("fs_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("d_in_f", [])) (disch_tac [])) THEN (clear_assumption "d_in_f") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_different_faces", [lemma_different_faces])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`d = v,w \/ d = w',v`))) (disch_eq_tac "d_eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + ((DISJ1_TAC) THEN (DISJ2_TAC) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (thm_tac apply_tac))); + (((((use_arg_then2 ("f2_w'w", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((DISJ1_TAC) THEN (DISJ1_TAC) THEN (((use_arg_then2 ("d_eq", [])) (disch_tac [])) THEN (clear_assumption "d_eq") THEN case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("f2_vw", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma f_fan_pair_ext_power_add_diag *) +let f_fan_pair_ext_power_add_diag = Sections.section_proof ["v";"w";"k"] +`let f = face (hypermap_of_fan (V,E)) (v,w) in + let w' = sigma_fan (vec 0) V E v w in + v,w IN dart_of_fan (V,E) /\ 3 < CARD f + /\ 1 <= k /\ k <= CARD f - 2 + ==> (f_fan_pair_ext (V, add_diag (V,E) (v,w)) POWER k) (w',w) + = (f_fan_pair_ext (V,E) POWER k) (v,w)` +[ + (repeat_tactic 1 9 ((CONV_TAC let_CONV))); + ((fun arg_tac -> arg_tac (Arg_term (`face _ (v,w)`))) (term_tac (set_tac "f"))); + (BETA_TAC THEN (case THEN (move ["vw_in"])) THEN (case THEN (move ["card_f"])) THEN (move ["k_ineqs"])); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((THENL_FIRST) (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_split_fan_face))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)) ((((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((((use_arg_then2 ("split_fan_face_eq_add_diag", [split_fan_face_eq_add_diag]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (BETA_TAC THEN (move ["f_eqs"]) THEN (case THEN (move ["fan2"])) THEN (case THEN (move ["dart2"])) THEN (move ["f_surr2"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("f_fan_pair_power", [f_fan_pair_power]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("k_ineqs", [])) (disch_tac [])) THEN (clear_assumption "k_ineqs") THEN ((use_arg_then2 ("k", [])) (disch_tac [])) THEN (clear_assumption "k") THEN elim) [ALL_TAC; ((move ["k"]) THEN (move ["Ih"]))]) ((arith_tac) THEN (done_tac))); + ((BETA_TAC THEN (move ["k_ineqs"])) THEN ((THENL) (((fun arg_tac -> (use_arg_then2 ("posnP", [posnP])) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (move ["k_gt0"])])); + (((((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_eqs", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((repeat_tactic 1 9 (((use_arg_then2 ("COM_POWER", [COM_POWER]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] []))))) ((((use_arg_then2 ("k_ineqs", [])) (disch_tac [])) THEN (clear_assumption "k_ineqs") THEN ((use_arg_then2 ("k_gt0", [])) (disch_tac [])) THEN (clear_assumption "k_gt0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("f_eqs", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_fan_pair_power", [f_fan_pair_power]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair_ext_power_in_dart", [f_fan_pair_ext_power_in_dart]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("orTb", [orTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_diag_not_in_dart", [fully_surrounded_diag_not_in_dart])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)) ((((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (move ["ww'_n_in"])); + (split_tac); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`v,w = (f_fan_pair_ext (V,E) POWER 0) (v,w)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [2] []))))))) (((((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inj", [f_fan_pair_ext_power_inj])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("LT_NZ", [LT_NZ]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("k_ineqs", [])) (disch_tac [])) THEN (clear_assumption "k_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) (split_tac) ((((use_arg_then2 ("ww'_n_in", [])) (disch_tac [])) THEN (clear_assumption "ww'_n_in") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("f_fan_pair_ext_power_in_dart", [f_fan_pair_ext_power_in_dart]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (split_tac); + ((((use_arg_then2 ("ww'_n_in", [])) (disch_tac [])) THEN (clear_assumption "ww'_n_in") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("dart_switch", [dart_switch]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("f_fan_pair_ext_power_in_dart", [f_fan_pair_ext_power_in_dart]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E w' v, w' = (inverse (f_fan_pair_ext (V,E)) POWER 2) (v,w)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("dart_switch", [dart_switch]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`2 = CARD f - (CARD f - 2)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("k_ineqs", [])) (disch_tac [])) THEN (clear_assumption "k_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("k_ineqs", [])) (disch_tac [])) THEN (clear_assumption "k_ineqs") THEN BETA_TAC) THEN (arith_tac)); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inj", [f_fan_pair_ext_power_inj])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("k_ineqs", [])) (disch_tac [])) THEN (clear_assumption "k_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma inverse_f_fan_pair_ext_add_diag *) +let inverse_f_fan_pair_ext_add_diag = Sections.section_proof ["v";"w"] +`let f = face (hypermap_of_fan (V,E)) (v,w) in + let w' = sigma_fan (vec 0) V E v w in + v,w IN dart_of_fan (V,E) /\ 3 < CARD f + ==> inverse (f_fan_pair_ext (V, add_diag (V,E) (v,w))) (w',w) + = (inverse (f_fan_pair_ext (V,E)) POWER 2) (v,w)` +[ + (repeat_tactic 1 9 ((CONV_TAC let_CONV))); + (BETA_TAC THEN (case THEN ((move ["vw_in"]) THEN (move ["card_f"])))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE face_split_fan_face_explicit))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("split_fan_face_eq_add_diag", [split_fan_face_eq_add_diag]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`face (hypermap_of_fan (V,E)) (v,w)`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H2"))); + (BETA_TAC THEN (case THEN (move ["_"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["_"])) THEN (move ["card2_w'w"]) THEN (move ["_"]) THEN (case THEN (move ["fan2"])) THEN (case THEN (move ["dart2"])) THEN (move ["f_surr2"])); + (((use_arg_then2 ("POWER_1", [POWER_1]))(gsym_then (thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`1 = CARD (face H2 (w',w)) - (CARD f - 2)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("card2_w'w", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", [])) (disch_tac [])) THEN (clear_assumption "card_f") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`2 = CARD f - (CARD f - 2)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("card_f", [])) (disch_tac [])) THEN (clear_assumption "card_f") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("H2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("H2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card2_w'w", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then2 ("card_f", [])) (disch_tac [])) THEN (clear_assumption "card_f") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) (((use_arg_then2 ("subKn", [subKn]))(thm_tac (new_rewrite [] [])))) ((((use_arg_then2 ("card_f", [])) (disch_tac [])) THEN (clear_assumption "card_f") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", [])) (disch_tac [])) THEN (clear_assumption "card_f") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_fan_pair_ext_power_add_diag))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", [])) (disch_tac [])) THEN (clear_assumption "card_f") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma azim_dart_eq_dihV *) +let azim_dart_eq_dihV = Sections.section_proof ["v";"w"] +`(v,w) IN dart_of_fan (V,E) + ==> azim_dart (V,E) (v,w) = dihV (vec 0) v w (sigma_fan (vec 0) V E v w)` +[ + ((BETA_TAC THEN (move ["vw_in"])) THEN (((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["vw_in1"]))); + ((((use_arg_then2 ("fully_surrounded_azim_dart_eq_azim", [fully_surrounded_azim_dart_eq_azim]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("AZIM_DIVH", [AZIM_DIVH]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("DART1_NOT_COLLINEAR", [DART1_NOT_COLLINEAR])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("fully_surrounded_azim_dart_eq_azim", [fully_surrounded_azim_dart_eq_azim]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("f_surr", [])) (disch_tac [])) THEN (clear_assumption "f_surr") THEN BETA_TAC) THEN ((((use_arg_then2 ("fully_surrounded", [fully_surrounded]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section FullySurroundedAddDiag *) +let pack_dist = Sections.finalize_theorem pack_dist;; +let split_fan_face_eq_add_diag = Sections.finalize_theorem split_fan_face_eq_add_diag;; +let faces_add_diag = Sections.finalize_theorem faces_add_diag;; +let f_fan_pair_ext_power_add_diag = Sections.finalize_theorem f_fan_pair_ext_power_add_diag;; +let inverse_f_fan_pair_ext_add_diag = Sections.finalize_theorem inverse_f_fan_pair_ext_add_diag;; +let azim_dart_eq_dihV = Sections.finalize_theorem azim_dart_eq_dihV;; +Sections.end_section "FullySurroundedAddDiag";; + +(* Section Fan *) +Sections.begin_section "Fan";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_hyp "fanV" (`FAN (vec 0,V,E)`));; +(Sections.add_section_hyp "f_surr" (`fully_surrounded (V,E)`));; + +(* Lemma fan_sol_pos *) +let fan_sol_pos = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + ==> &0 <= sol (vec 0) (dart_leads_into (vec 0) V E v w)` +[ + (BETA_TAC THEN (move ["vw_in"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_imp_conforming", [fully_surrounded_imp_conforming])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("Conforming.conforming_fan", [Conforming.conforming_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["c_angle"])) THEN (move ["_"]))); + ((((use_arg_then2 ("c_angle", [])) (disch_tac [])) THEN (clear_assumption "c_angle") THEN BETA_TAC) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE Conforming.conforming_solid_angle_fan)))(thm_tac (new_rewrite [] [])))) THEN (move ["c_angle"]))); + ((fun arg_tac -> (use_arg_then2 ("fan_hypermaps_iso_explicit2", [fan_hypermaps_iso_explicit2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["iso"]))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (move ["_"]))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart (hypermap_of_fan (V,E))`))) (term_tac (have_gen_tac [](move ["vw_in2"])))) ((((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("iso_components", [iso_components])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["_"]) THEN (case THEN (move ["f_eq"])) THEN (move ["_"]))))); + ((((use_arg_then2 ("f_eq", [])) (disch_tac [])) THEN (clear_assumption "f_eq") THEN BETA_TAC) THEN ((fun arg_tac -> arg_tac (Arg_term (`face _1 _2`))) (term_tac (set_tac "f1"))) THEN (BETA_TAC THEN (move ["f1_eq"]))); + ((((fun arg_tac -> (use_arg_then2 ("c_angle", [])) (fun fst_arg -> (use_arg_then2 ("f1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)); + (((((use_arg_then2 ("f1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("f1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart_leads_into_eq1", [dart_leads_into_eq1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (BETA_TAC THEN (case THEN (move ["r1"])) THEN (case THEN (move ["r2"])) THEN (move ["_"])); + ((((use_arg_then2 ("r2", [])) (disch_tac [])) THEN (clear_assumption "r2") THEN BETA_TAC) THEN ((((use_arg_then2 ("Sphere.eventually_radial", [Sphere.eventually_radial]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["r"])) THEN (case THEN (move ["r_gt0"])) THEN (move ["rad"]))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Vol1.sol_spec", [Vol1.sol_spec])) (fun fst_arg -> (use_arg_then2 ("r_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("rad", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INTER_COMM", [INTER_COMM]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("r1", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((THENL_LAST) ((((use_arg_then2 ("REAL_LE_MUL", [REAL_LE_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_DIV", [REAL_LE_DIV]))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) (((use_arg_then2 ("REAL_POW_LE", [REAL_POW_LE]))(thm_tac (new_rewrite [] [])))) ((((use_arg_then2 ("r_gt0", [])) (disch_tac [])) THEN (clear_assumption "r_gt0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("real_ge", [real_ge]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Vol1.VOLUME_PROPS_MEASURABLE", [Vol1.VOLUME_PROPS_MEASURABLE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sol_fan_eq *) +let sol_fan_eq = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + ==> sol_fan (V,E) (face (hypermap_of_fan (V,E)) (v, w)) + = sol (vec 0) (dart_leads_into (vec 0) V E v w)` +[ + (((((use_arg_then2 ("sol_fan", [sol_fan]))(thm_tac (new_rewrite [] [])))) THEN (move ["vw_in"])) THEN ((((use_arg_then2 ("fully_surrounded_sol", [fully_surrounded_sol]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_ADD_SYM", [REAL_ADD_SYM]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("REAL_ABS_REFL", [REAL_ABS_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fully_surrounded_sol", [fully_surrounded_sol]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fan_sol_pos", [fan_sol_pos]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(Sections.add_section_hyp "packV" (`packing V`));; +(Sections.add_section_hyp "subV" (`V SUBSET ball_annulus`));; + +(* Let dart1_eq *) +Sections.add_section_lemma "dart1_eq" (Sections.section_proof [] +`dart1_of_fan (V,E) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let dartH *) +Sections.add_section_lemma "dartH" (Sections.section_proof [] +`dart (hypermap_of_fan (V,E)) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let fH *) +Sections.add_section_lemma "fH" (Sections.section_proof [] +`face_map (hypermap_of_fan (V,E)) = f_fan_pair_ext (V,E)` +[ + ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let nH *) +Sections.add_section_lemma "nH" (Sections.section_proof [] +`node_map (hypermap_of_fan (V,E)) = n_fan_pair_ext (V,E)` +[ + ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let norm_v *) +Sections.add_section_lemma "norm_v" (Sections.section_proof ["v"] +`v IN V ==> &2 <= norm v /\ norm v <= #2.52` +[ + ((in_tac ["subV"] false (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("subV", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC)); + (((((use_arg_then2 ("Fnjlbxs.in_ball_annulus", [Fnjlbxs.in_ball_annulus]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +]);; + +(* Let pack_dist *) +Sections.add_section_lemma "pack_dist" (Sections.section_proof ["x"] +`x IN dart_of_fan (V,E) ==> &2 <= dist x` +[ + ((((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN case THEN (move ["v"]) THEN (move ["w"])) THEN ((((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["vw_in"]))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("iffLR", [iffLR])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("Fnjlbxs.packing", [Fnjlbxs.packing])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("packV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN", [PAIR_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ", [PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; + +(* Lemma rho_pos *) +let rho_pos = Sections.section_proof ["v"] +`v IN V ==> &0 <= &1 + const1 * (&1 - ln_fan v)` +[ + ((THENL_LAST) ((BETA_TAC THEN (move ["vV"])) THEN ((((use_arg_then2 ("REAL_LE_ADD", [REAL_LE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_MUL", [REAL_LE_MUL]))(thm_tac (new_rewrite [] [])))))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("const1_ge0", [const1_ge0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ln_fan", [ln_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lmfun", [lmfun]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yn_fan", [yn_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("norm_v", [])) (fun fst_arg -> (use_arg_then2 ("vV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Section V *) +Sections.begin_section "V";; +(Sections.add_section_var (mk_var ("v", (`:real^3`))));; +(Sections.add_section_hyp "vV" (`v IN V`));; + +(* Lemma ln_def *) +let ln_def = Sections.section_proof [] +`ln_fan v = (#2.52 - yn_fan v) / #0.52` +[ + ((((use_arg_then2 ("ln_fan", [ln_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yn_fan", [yn_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lmfun", [lmfun]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("norm_v", [])) (fun fst_arg -> (use_arg_then2 ("vV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma rho_def *) +let rho_def = Sections.section_proof [] +`rho_fan v = (&1 + sol0 / pi) - ln_fan v * sol0 / pi` +[ + ((((use_arg_then2 ("rho_fan", [rho_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sol0_over_pi_EQ_const1", [sol0_over_pi_EQ_const1]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`&0 <= &1 + const1 * (&1 - ln_fan v)`))) (term_tac (have_gen_tac []ALL_TAC)))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("rho_pos", [rho_pos]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma ln_lo *) +let ln_lo = Sections.section_proof [] +`&0 <= ln_fan v` +[ + (((((use_arg_then2 ("ln_fan", [ln_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Fnjlbxs.lmfun_ge0", [Fnjlbxs.lmfun_ge0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ln_hi *) +let ln_hi = Sections.section_proof [] +`ln_fan v <= &1` +[ + (((((use_arg_then2 ("ln_fan", [ln_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yn_fan", [yn_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lmfun", [lmfun]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("norm_v", [])) (fun fst_arg -> (use_arg_then2 ("vV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma yn_lo *) +let yn_lo = Sections.section_proof [] +`&2 <= yn_fan v` +[ + (((((use_arg_then2 ("yn_fan", [yn_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("norm_v", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma yn_hi *) +let yn_hi = Sections.section_proof [] +`yn_fan v <= #2.52` +[ + (((((use_arg_then2 ("yn_fan", [yn_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("norm_v", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rho_lo *) +let rho_lo = Sections.section_proof [] +`&1 <= rho_fan v` +[ + (((use_arg_then2 ("rho_fan", [rho_fan]))(thm_tac (new_rewrite [] [])))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`&0 <= const1 * (&1 - ln_fan v)`))) (term_tac (have_gen_tac []ALL_TAC)))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("REAL_LE_MUL", [REAL_LE_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("const1_ge0", [const1_ge0]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ln_hi", [ln_hi])) (disch_tac [])) THEN (clear_assumption "ln_hi") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma rho_hi *) +let rho_hi = Sections.section_proof [] +`rho_fan v <= &1 + sol0 / pi` +[ + (((use_arg_then2 ("rho_fan", [rho_fan]))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> arg_tac (Arg_term (`&1 + _`))) (term_tac (set_tac "x"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`abs x = x`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) (((((use_arg_then2 ("REAL_ABS_REFL", [REAL_ABS_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rho_pos", [rho_pos]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("x_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_LADD", [REAL_LE_LADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sol0_over_pi_EQ_const1", [sol0_over_pi_EQ_const1]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`const1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then2 ("REAL_LE_MUL2", [REAL_LE_MUL2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("const1_ge0", [const1_ge0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("ln_fan", [ln_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yn_fan", [yn_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lmfun", [lmfun]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("norm_v", [])) (fun fst_arg -> (use_arg_then2 ("vV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section V *) +let ln_def = Sections.finalize_theorem ln_def;; +let rho_def = Sections.finalize_theorem rho_def;; +let ln_lo = Sections.finalize_theorem ln_lo;; +let ln_hi = Sections.finalize_theorem ln_hi;; +let yn_lo = Sections.finalize_theorem yn_lo;; +let yn_hi = Sections.finalize_theorem yn_hi;; +let rho_lo = Sections.finalize_theorem rho_lo;; +let rho_hi = Sections.finalize_theorem rho_hi;; +Sections.end_section "V";; + +(* Section Dart *) +Sections.begin_section "Dart";; +(Sections.add_section_var (mk_var ("d", (`:real^3#real^3`))));; +(Sections.add_section_hyp "d_in" (`d IN dart_of_fan (V,E)`));; + +(* Lemma edge_sym *) +let edge_sym = Sections.section_proof [] +`ye_fan d = ye_fan (e_fan_pair_ext (V,E) d)` +[ + (((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"])); + (((((use_arg_then2 ("e_fan_pair_ext", [e_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("e_fan_pair", [e_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ye_fan", [ye_fan]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y1_def *) +let y1_def = Sections.section_proof [] +`y1_fan d = yn_fan (FST d)` +[ + (((((use_arg_then2 ("y1_fan", [y1_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yn_fan", [yn_fan]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y2_def *) +let y2_def = Sections.section_proof [] +`y2_fan d = yn_fan (FST (f_fan_pair_ext (V,E) d))` +[ + (((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["d_in"])); + (((((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y2_fan", [y2_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yn_fan", [yn_fan]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y3_def *) +let y3_def = Sections.section_proof [] +`y3_fan (V,E) d = yn_fan (FST (inverse (f_fan_pair_ext (V,E)) d))` +[ + (((((use_arg_then2 ("y3_fan", [y3_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yn_fan", [yn_fan]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y4_def *) +let y4_def = Sections.section_proof [] +`y4_fan (V,E) d = ye_fan (f_fan_pair_ext (V,E) d)` +[ + (((((use_arg_then2 ("y4_fan", [y4_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ye_fan", [ye_fan]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y5_def *) +let y5_def = Sections.section_proof [] +`y5_fan (V,E) d = ye_fan (inverse (f_fan_pair_ext (V,E)) d)` +[ + (((((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ye_fan", [ye_fan]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y6_def *) +let y6_def = Sections.section_proof [] +`y6_fan d = ye_fan d` +[ + (((((use_arg_then2 ("y6_fan", [y6_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ye_fan", [ye_fan]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y8_def *) +let y8_def = Sections.section_proof [] +`y8_fan (V,E) d = y5_fan (V,E) (inverse (f_fan_pair_ext (V,E)) d)` +[ + ((((use_arg_then2 ("y8_fan", [y8_fan]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma y9_def *) +let y9_def = Sections.section_proof [] +`y9_fan (V,E) d = ye_fan (f_fan_pair_ext (V,E) d)` +[ + (((((use_arg_then2 ("y9_fan", [y9_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ye_fan", [ye_fan]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma azim_lo *) +let azim_lo = Sections.section_proof [] +`&0 <= azim_dart (V,E) d` +[ + ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL AZIM_DART_POS)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma azim_hi *) +let azim_hi = Sections.section_proof [] +`azim_dart (V,E) d <= pi` +[ + ((((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_surr", [])) (disch_tac [])) THEN (clear_assumption "f_surr") THEN BETA_TAC) THEN ((((use_arg_then2 ("fully_surrounded", [fully_surrounded]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rhazim_lo *) +let rhazim_lo = Sections.section_proof [] +`&0 <= rhazim_fan (V,E) d` +[ + (((((use_arg_then2 ("rhazim_fan", [rhazim_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_MUL", [REAL_LE_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_POS", [REAL_ABS_POS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("azim_lo", [azim_lo]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rhazim_hi *) +let rhazim_hi = Sections.section_proof [] +`rhazim_fan (V,E) d <= pi + sol0` +[ + ((((use_arg_then2 ("rhazim_fan", [rhazim_fan]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`pi + sol0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("REAL_MUL_LINV", [REAL_MUL_LINV])) (fun fst_arg -> (use_arg_then2 ("PI_NZ", [PI_NZ])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [3] []))))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_MUL2", [REAL_LE_MUL2]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("azim_hi", [azim_hi]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_POS", [REAL_ABS_POS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("azim_lo", [azim_lo]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("REAL_ADD_RDISTRIB", [REAL_ADD_RDISTRIB]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("REAL_MUL_RINV", [REAL_MUL_RINV])) (fun fst_arg -> (use_arg_then2 ("PI_NZ", [PI_NZ])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_div", [real_div]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`lmfun (h_dart d) = ln_fan (FST d)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) (((((use_arg_then2 ("ln_fan", [ln_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h_dart", [h_dart]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yn_fan", [yn_fan]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`abs _`))) (term_tac (set_tac "x"))); + ((fun arg_tac -> arg_tac (Arg_term (`FST d IN V`))) (term_tac (have_gen_tac [](move ["fst_in"])))); + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["d_in"]) THEN (simp_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`x = &1 + const1 * (&1 - ln_fan (FST d))`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("x_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_ABS_REFL", [REAL_ABS_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rho_pos", [rho_pos]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("REAL_LE_LADD", [REAL_LE_LADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sol0_over_pi_EQ_const1", [sol0_over_pi_EQ_const1]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`const1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] [])))))); + ((((use_arg_then2 ("REAL_LE_MUL2", [REAL_LE_MUL2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("const1_ge0", [const1_ge0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("ln_fan", [ln_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yn_fan", [yn_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lmfun", [lmfun]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("norm_v", [])) (fun fst_arg -> (use_arg_then2 ("fst_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma ye_lo *) +let ye_lo = Sections.section_proof [] +`&2 <= ye_fan d` +[ + (((((use_arg_then2 ("ye_fan", [ye_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pack_dist", [pack_dist]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Let d_inV *) +Sections.add_section_lemma "d_inV" (Sections.section_proof [] +`FST d IN V /\ SND d IN V` +[ + ((((fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; + +(* Lemma y1_lo *) +let y1_lo = Sections.section_proof [] +`&2 <= y1_fan d` +[ + (((((use_arg_then2 ("y1_fan", [y1_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("norm_v", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y2_lo *) +let y2_lo = Sections.section_proof [] +`&2 <= y2_fan d` +[ + (((((use_arg_then2 ("y2_fan", [y2_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("norm_v", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y1_hi *) +let y1_hi = Sections.section_proof [] +`y1_fan d <= #2.52` +[ + (((((use_arg_then2 ("y1_fan", [y1_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("norm_v", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y2_hi *) +let y2_hi = Sections.section_proof [] +`y2_fan d <= #2.52` +[ + (((((use_arg_then2 ("y2_fan", [y2_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("norm_v", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y6_lo *) +let y6_lo = Sections.section_proof [] +`&2 <= y6_fan d` +[ + (((((use_arg_then2 ("y6_fan", [y6_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pack_dist", [pack_dist]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Dart *) +let edge_sym = Sections.finalize_theorem edge_sym;; +let y1_def = Sections.finalize_theorem y1_def;; +let y2_def = Sections.finalize_theorem y2_def;; +let y3_def = Sections.finalize_theorem y3_def;; +let y4_def = Sections.finalize_theorem y4_def;; +let y5_def = Sections.finalize_theorem y5_def;; +let y6_def = Sections.finalize_theorem y6_def;; +let y8_def = Sections.finalize_theorem y8_def;; +let y9_def = Sections.finalize_theorem y9_def;; +let azim_lo = Sections.finalize_theorem azim_lo;; +let azim_hi = Sections.finalize_theorem azim_hi;; +let rhazim_lo = Sections.finalize_theorem rhazim_lo;; +let rhazim_hi = Sections.finalize_theorem rhazim_hi;; +let ye_lo = Sections.finalize_theorem ye_lo;; +let y1_lo = Sections.finalize_theorem y1_lo;; +let y2_lo = Sections.finalize_theorem y2_lo;; +let y1_hi = Sections.finalize_theorem y1_hi;; +let y2_hi = Sections.finalize_theorem y2_hi;; +let y6_lo = Sections.finalize_theorem y6_lo;; +Sections.end_section "Dart";; + +(* Section Dart3 *) +Sections.begin_section "Dart3";; +(Sections.add_section_var (mk_var ("d", (`:real^3#real^3`))));; +(Sections.add_section_hyp "d_in" (`d IN darts_k 3 (hypermap_of_fan (V,E))`));; + +(* Let card_f *) +Sections.add_section_lemma "card_f" (Sections.section_proof [] +`CARD (face (hypermap_of_fan (V,E)) d) = 3` +[ + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; + +(* Let d_in_dart *) +Sections.add_section_lemma "d_in_dart" (Sections.section_proof [] +`d IN dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; + +(* Lemma y4'_eq_y4 *) +let y4'_eq_y4 = Sections.section_proof [] +`y4'_fan (V,E) d = y4_fan (V,E) d` +[ + (((use_arg_then2 ("d_in_dart", [])) (disch_tac [])) THEN (clear_assumption "d_in_dart") THEN ((use_arg_then2 ("card_f", [])) (disch_tac [])) THEN (clear_assumption "card_f") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["card_f"]) THEN (move ["vw_in"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["vw_in1"])))) ((((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("y4'_fan", [y4'_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y4_fan", [y4_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((fun arg_tac -> (use_arg_then2 ("f_fan_pair3", [f_fan_pair3])) (fun fst_arg -> (use_arg_then2 ("card_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Dart3 *) +let y4'_eq_y4 = Sections.finalize_theorem y4'_eq_y4;; +Sections.end_section "Dart3";; + +(* Let fd_in *) +Sections.add_section_lemma "fd_in" (Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) ==> f_fan_pair_ext (V,E) d IN dart_of_fan (V,E)` +[ + ((((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fH", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["d_in"])) THEN (((use_arg_then2 ("Hypermap.lemma_dart_invariant", [Hypermap.lemma_dart_invariant]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let ifd_in *) +Sections.add_section_lemma "ifd_in" (Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) ==> inverse (f_fan_pair_ext (V,E)) d IN dart_of_fan (V,E)` +[ + ((((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fH", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["d_in"])) THEN (((use_arg_then2 ("Hypermap.lemma_dart_inveriant_under_inverse_maps", [Hypermap.lemma_dart_inveriant_under_inverse_maps]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let in_dart_inV *) +Sections.add_section_lemma "in_dart_inV" (Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) ==> FST d IN V /\ SND d IN V` +[ + ((((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +]);; + +(* Section StdDart *) +Sections.begin_section "StdDart";; +(Sections.add_section_hyp "std" (`E = ESTD V`));; + +(* Let in_std *) +Sections.add_section_lemma "in_std" (Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) ==> dist d <= #2.52 /\ dist d <= &3` +[ + ((((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"])) THEN ((((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("std", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ESTD", [IN_ESTD]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +]);; + +(* Section Inner *) +Sections.begin_section "Inner";; +(Sections.add_section_var (mk_var ("d", (`:real^3#real^3`))));; +(Sections.add_section_hyp "d_in" (`d IN dart_of_fan (V,E)`));; + +(* Lemma ye_hi_std *) +let ye_hi_std = Sections.section_proof [] +`ye_fan d <= &3` +[ + (((((use_arg_then2 ("ye_fan", [ye_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_std", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y4_hi_std *) +let y4_hi_std = Sections.section_proof [] +`y4_fan (V,E) d <= &3` +[ + (((((use_arg_then2 ("y4_fan", [y4_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_std", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fd_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y5_hi_std *) +let y5_hi_std = Sections.section_proof [] +`y5_fan (V,E) d <= &3` +[ + (((((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_std", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ifd_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y6_hi_std *) +let y6_hi_std = Sections.section_proof [] +`y6_fan d <= &3` +[ + (((((use_arg_then2 ("y6_fan", [y6_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_std", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y8_hi_std *) +let y8_hi_std = Sections.section_proof [] +`y8_fan (V,E) d <= #2.52` +[ + (((((use_arg_then2 ("y8_fan", [y8_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_std", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ifd_in", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma y9_hi_std *) +let y9_hi_std = Sections.section_proof [] +`y9_fan (V,E) d <= #2.52` +[ + (((((use_arg_then2 ("y9_fan", [y9_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_std", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fd_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ye_hi_std2 *) +let ye_hi_std2 = Sections.section_proof [] +`ye_fan d <= &3` +[ + (((((use_arg_then2 ("ye_fan", [ye_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_std", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y4_hi_std2 *) +let y4_hi_std2 = Sections.section_proof [] +`y4_fan (V,E) d <= #2.52` +[ + (((((use_arg_then2 ("y4_fan", [y4_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_std", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fd_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y5_hi_std2 *) +let y5_hi_std2 = Sections.section_proof [] +`y5_fan (V,E) d <= #2.52` +[ + (((((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_std", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ifd_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y6_hi_std2 *) +let y6_hi_std2 = Sections.section_proof [] +`y6_fan d <= #2.52` +[ + (((((use_arg_then2 ("y6_fan", [y6_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_std", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma yy10_std *) +let yy10_std = Sections.section_proof [] +`ye_fan d <= #2.52` +[ + (((((use_arg_then2 ("ye_fan", [ye_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_std", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Inner *) +let ye_hi_std = Sections.finalize_theorem ye_hi_std;; +let y4_hi_std = Sections.finalize_theorem y4_hi_std;; +let y5_hi_std = Sections.finalize_theorem y5_hi_std;; +let y6_hi_std = Sections.finalize_theorem y6_hi_std;; +let y8_hi_std = Sections.finalize_theorem y8_hi_std;; +let y9_hi_std = Sections.finalize_theorem y9_hi_std;; +let ye_hi_std2 = Sections.finalize_theorem ye_hi_std2;; +let y4_hi_std2 = Sections.finalize_theorem y4_hi_std2;; +let y5_hi_std2 = Sections.finalize_theorem y5_hi_std2;; +let y6_hi_std2 = Sections.finalize_theorem y6_hi_std2;; +let yy10_std = Sections.finalize_theorem yy10_std;; +Sections.end_section "Inner";; + +(* Finalization of the section StdDart *) +let ye_hi_std = Sections.finalize_theorem ye_hi_std;; +let y4_hi_std = Sections.finalize_theorem y4_hi_std;; +let y5_hi_std = Sections.finalize_theorem y5_hi_std;; +let y6_hi_std = Sections.finalize_theorem y6_hi_std;; +let y8_hi_std = Sections.finalize_theorem y8_hi_std;; +let y9_hi_std = Sections.finalize_theorem y9_hi_std;; +let ye_hi_std2 = Sections.finalize_theorem ye_hi_std2;; +let y4_hi_std2 = Sections.finalize_theorem y4_hi_std2;; +let y5_hi_std2 = Sections.finalize_theorem y5_hi_std2;; +let y6_hi_std2 = Sections.finalize_theorem y6_hi_std2;; +let yy10_std = Sections.finalize_theorem yy10_std;; +Sections.end_section "StdDart";; + +(* Section DartMore *) +Sections.begin_section "DartMore";; +(Sections.add_section_var (mk_var ("d", (`:real^3#real^3`))));; +(Sections.add_section_hyp "d_in" (`d IN dart_of_fan (V,E)`));; + +(* Lemma azim2_lo *) +let azim2_lo = Sections.section_proof [] +`&0 <= azim2_fan (V,E) d` +[ + (((((use_arg_then2 ("azim2_fan", [azim2_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("azim_lo", [azim_lo]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fd_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma azim2_hi *) +let azim2_hi = Sections.section_proof [] +`azim2_fan (V,E) d <= pi` +[ + (((((use_arg_then2 ("azim2_fan", [azim2_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("azim_hi", [azim_hi]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fd_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma azim3_lo *) +let azim3_lo = Sections.section_proof [] +`&0 <= azim3_fan (V,E) d` +[ + (((((use_arg_then2 ("azim3_fan", [azim3_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("azim_lo", [azim_lo]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ifd_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma azim3_hi *) +let azim3_hi = Sections.section_proof [] +`azim3_fan (V,E) d <= pi` +[ + (((((use_arg_then2 ("azim3_fan", [azim3_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("azim_hi", [azim_hi]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ifd_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rhazim2_lo *) +let rhazim2_lo = Sections.section_proof [] +`&0 <= rhazim2_fan (V,E) d` +[ + (((((use_arg_then2 ("rhazim2_fan", [rhazim2_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rhazim_lo", [rhazim_lo]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fd_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rhazim2_hi *) +let rhazim2_hi = Sections.section_proof [] +`rhazim2_fan (V,E) d <= pi + sol0` +[ + (((((use_arg_then2 ("rhazim2_fan", [rhazim2_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rhazim_hi", [rhazim_hi]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fd_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rhazim3_lo *) +let rhazim3_lo = Sections.section_proof [] +`&0 <= rhazim3_fan (V,E) d` +[ + (((((use_arg_then2 ("rhazim3_fan", [rhazim3_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rhazim_lo", [rhazim_lo]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ifd_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rhazim3_hi *) +let rhazim3_hi = Sections.section_proof [] +`rhazim3_fan (V,E) d <= pi + sol0` +[ + (((((use_arg_then2 ("rhazim3_fan", [rhazim3_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rhazim_hi", [rhazim_hi]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ifd_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y3_lo *) +let y3_lo = Sections.section_proof [] +`&2 <= y3_fan (V,E) d` +[ + (((((use_arg_then2 ("y3_fan", [y3_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("norm_v", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_dart_inV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ifd_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y3_hi *) +let y3_hi = Sections.section_proof [] +`y3_fan (V,E) d <= #2.52` +[ + (((((use_arg_then2 ("y3_fan", [y3_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("norm_v", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_dart_inV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ifd_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y4_lo *) +let y4_lo = Sections.section_proof [] +`&2 <= y4_fan (V,E) d` +[ + (((((use_arg_then2 ("y4_fan", [y4_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pack_dist", [pack_dist]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fd_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y5_lo *) +let y5_lo = Sections.section_proof [] +`&2 <= y5_fan (V,E) d` +[ + (((((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pack_dist", [pack_dist]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ifd_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y7_lo *) +let y7_lo = Sections.section_proof [] +`&2 <= y7_fan (V,E) d` +[ + ((((use_arg_then2 ("y7_fan", [y7_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("TWO", [TWO]))(thm_tac (new_rewrite [2] [])))) THEN (((use_arg_then2 ("POWER", [POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("norm_v", []))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("in_dart_inV", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ifd_in", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ifd_in", [])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma y7_hi *) +let y7_hi = Sections.section_proof [] +`y7_fan (V,E) d <= #2.52` +[ + ((((use_arg_then2 ("y7_fan", [y7_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("TWO", [TWO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER", [POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("norm_v", []))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("in_dart_inV", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ifd_in", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ifd_in", [])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma y8_lo *) +let y8_lo = Sections.section_proof [] +`&2 <= y8_fan (V,E) d` +[ + (((((use_arg_then2 ("y8_fan", [y8_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pack_dist", [pack_dist]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ifd_in", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma y9_lo *) +let y9_lo = Sections.section_proof [] +`&2 <= y9_fan (V,E) d` +[ + (((((use_arg_then2 ("y9_fan", [y9_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pack_dist", [pack_dist]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fd_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y4'_lo *) +let y4'_lo = Sections.section_proof [] +`&2 <= y4'_fan (V,E) d` +[ + (((use_arg_then2 ("packV", [])) (disch_tac [])) THEN (clear_assumption "packV") THEN BETA_TAC); + (((((use_arg_then2 ("Ckqowsa.packing", [Ckqowsa.packing]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y4'_fan", [y4'_fan]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN apply_tac)); + ((((fun arg_tac -> (use_arg_then2 ("in_dart_inV", [])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("in_dart_inV", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ifd_in", [])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"])); + ((((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("sigma_fan_not_fixed", [sigma_fan_not_fixed]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma azim2c *) +let azim2c = Sections.section_proof [] +`azim2_fan (V,E) d = azim_dart (V,E) (f_fan_pair_ext (V,E) d)` +[ + ((((use_arg_then2 ("azim2_fan", [azim2_fan]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma azim3c *) +let azim3c = Sections.section_proof [] +`azim3_fan (V,E) d = azim_dart (V,E) (inverse (f_fan_pair_ext (V,E)) d)` +[ + ((((use_arg_then2 ("azim3_fan", [azim3_fan]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma rhazim2c *) +let rhazim2c = Sections.section_proof [] +`rhazim2_fan (V,E) d = rhazim_fan (V,E) (f_fan_pair_ext (V,E) d)` +[ + ((((use_arg_then2 ("rhazim2_fan", [rhazim2_fan]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma rhazim3c *) +let rhazim3c = Sections.section_proof [] +`rhazim3_fan (V,E) d = rhazim_fan (V,E) (inverse (f_fan_pair_ext (V,E)) d)` +[ + ((((use_arg_then2 ("rhazim3_fan", [rhazim3_fan]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma RHA *) +let RHA = Sections.section_proof [] +`rhazim_fan (V,E) d >= azim_dart (V,E) d` +[ + ((((use_arg_then2 ("rhazim_fan", [rhazim_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h_dart", [h_dart]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yn_fan", [yn_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ln_fan", [ln_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rho_fan", [rho_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("real_ge", [real_ge]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`azim_dart _ d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("REAL_LE_RMUL", [REAL_LE_RMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("azim_lo", [azim_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("rho_lo", [rho_lo]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_dart_inV", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma RHB *) +let RHB = Sections.section_proof [] +`rhazim_fan (V,E) d <= azim_dart (V,E) d * (&1 + sol0 / pi)` +[ + ((((use_arg_then2 ("rhazim_fan", [rhazim_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h_dart", [h_dart]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yn_fan", [yn_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ln_fan", [ln_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rho_fan", [rho_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("REAL_LE_LMUL", [REAL_LE_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("azim_lo", [azim_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("rho_hi", [rho_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("in_dart_inV", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma RHBLO *) +let RHBLO = Sections.section_proof [] +`yn_fan (FST d) <= #2.18 ==> rhazim_fan (V,E) d <= azim_dart (V,E) d * rho218` +[ + ((BETA_TAC THEN (move ["ineq"])) THEN ((((use_arg_then2 ("rhazim_fan", [rhazim_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h_dart", [h_dart]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yn_fan", [yn_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ln_fan", [ln_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rho_fan", [rho_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("REAL_LE_LMUL", [REAL_LE_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("azim_lo", [azim_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rho_def", [rho_def]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_dart_inV", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("ln_def", [ln_def]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_dart_inV", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("rho218", [rho218]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Nonlinear_lemma.rho_alt", [Nonlinear_lemma.rho_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sol0_over_pi_EQ_const1", [sol0_over_pi_EQ_const1]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_LADD", [REAL_LE_LADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_sub", [real_sub]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`const1 - x / #0.52 * const1 <= const1 * y / #0.52 + <=> const1 * #0.52 <= const1 * (x + y)`))) (term_tac (have_gen_tac ["x"; "y"](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("REAL_LE_LMUL", [REAL_LE_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("const1_ge0", [const1_ge0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ineq", [ineq])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma RHBHI *) +let RHBHI = Sections.section_proof [] +`#2.18 <= yn_fan (FST d) ==> rhazim_fan (V,E) d >= azim_dart (V,E) d * rho218` +[ + ((BETA_TAC THEN (move ["ineq"])) THEN ((((use_arg_then2 ("rhazim_fan", [rhazim_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h_dart", [h_dart]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yn_fan", [yn_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ln_fan", [ln_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rho_fan", [rho_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("real_ge", [real_ge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_LMUL", [REAL_LE_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("azim_lo", [azim_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rho_def", [rho_def]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_dart_inV", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("ln_def", [ln_def]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_dart_inV", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("rho218", [rho218]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Nonlinear_lemma.rho_alt", [Nonlinear_lemma.rho_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sol0_over_pi_EQ_const1", [sol0_over_pi_EQ_const1]))(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_LADD", [REAL_LE_LADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(gsym_then (thm_tac (new_rewrite [] []))))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`const1 * y / #0.52 <= const1 - x / #0.52 * const1 + <=> const1 * #0.52 >= const1 * (x + y)`))) (term_tac (have_gen_tac ["x"; "y"](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("real_ge", [real_ge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_LMUL", [REAL_LE_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("const1_ge0", [const1_ge0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ineq", [ineq])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section DartMore *) +let azim2_lo = Sections.finalize_theorem azim2_lo;; +let azim2_hi = Sections.finalize_theorem azim2_hi;; +let azim3_lo = Sections.finalize_theorem azim3_lo;; +let azim3_hi = Sections.finalize_theorem azim3_hi;; +let rhazim2_lo = Sections.finalize_theorem rhazim2_lo;; +let rhazim2_hi = Sections.finalize_theorem rhazim2_hi;; +let rhazim3_lo = Sections.finalize_theorem rhazim3_lo;; +let rhazim3_hi = Sections.finalize_theorem rhazim3_hi;; +let y3_lo = Sections.finalize_theorem y3_lo;; +let y3_hi = Sections.finalize_theorem y3_hi;; +let y4_lo = Sections.finalize_theorem y4_lo;; +let y5_lo = Sections.finalize_theorem y5_lo;; +let y7_lo = Sections.finalize_theorem y7_lo;; +let y7_hi = Sections.finalize_theorem y7_hi;; +let y8_lo = Sections.finalize_theorem y8_lo;; +let y9_lo = Sections.finalize_theorem y9_lo;; +let y4'_lo = Sections.finalize_theorem y4'_lo;; +let azim2c = Sections.finalize_theorem azim2c;; +let azim3c = Sections.finalize_theorem azim3c;; +let rhazim2c = Sections.finalize_theorem rhazim2c;; +let rhazim3c = Sections.finalize_theorem rhazim3c;; +let RHA = Sections.finalize_theorem RHA;; +let RHB = Sections.finalize_theorem RHB;; +let RHBLO = Sections.finalize_theorem RHBLO;; +let RHBHI = Sections.finalize_theorem RHBHI;; +Sections.end_section "DartMore";; + +(* Section Node *) +Sections.begin_section "Node";; +(Sections.add_section_var (mk_var ("n", (`:real^3#real^3->bool`))));; +(Sections.add_section_hyp "n_in" (`n IN node_set (hypermap_of_fan (V,E))`));; + +(* Let n_repr *) +Sections.add_section_lemma "n_repr" (Sections.section_proof [] +`?v w. v,w IN dart_of_fan (V,E) /\ n = node (hypermap_of_fan (V,E)) (v,w)` +[ + (((use_arg_then2 ("n_in", [])) (disch_tac [])) THEN (clear_assumption "n_in") THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_node_representation", [lemma_node_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (case THEN ((move ["v"]) THEN (move ["w"])))) THEN (move ["h"])); + ((((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("w", [])) (term_tac exists_tac))) THEN (((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; + +(* Lemma azim_sum *) +let azim_sum = Sections.section_proof [] +`sum n (azim_dart (V,E)) = &2 * pi` +[ + (((use_arg_then2 ("n_repr", [])) (disch_tac [])) THEN (clear_assumption "n_repr") THEN BETA_TAC THEN (case THEN (move ["v"])) THEN (case THEN (move ["w"])) THEN (case THEN (move ["vw_in"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("SUM_AZIM_DART", [SUM_AZIM_DART]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma rhazim_sum *) +let rhazim_sum = Sections.section_proof [] +`sum n (rhazim_fan (V,E)) = &2 * pi * rho_fan (FST (CHOICE n))` +[ + ((((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("azim_sum", [azim_sum]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_RMUL", [SUM_RMUL]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["d"]) THEN (move ["d_in"]) THEN (simp_tac)) THEN ((((use_arg_then2 ("rhazim_fan", [rhazim_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_EQ_MUL_LCANCEL", [REAL_EQ_MUL_LCANCEL]))(thm_tac (new_rewrite [] []))))) THEN (DISJ2_TAC)); + (((((use_arg_then2 ("h_dart", [h_dart]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yn_fan", [yn_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ln_fan", [ln_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rho_fan", [rho_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (congr_tac (`rho_fan _`))); + (((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN ((use_arg_then2 ("n_repr", [])) (disch_tac [])) THEN (clear_assumption "n_repr") THEN BETA_TAC THEN (case THEN (move ["v"])) THEN (case THEN (move ["w"])) THEN (case THEN (move ["vw_in"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["d_in"])); + ((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("fst_node_hypermap_of_fan", [fst_node_hypermap_of_fan])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + ((((fun arg_tac -> (use_arg_then2 ("lemma_node_identity", [lemma_node_identity])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CHOICE_DEF", [CHOICE_DEF]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("d", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("node_refl", [node_refl]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section Node *) +let azim_sum = Sections.finalize_theorem azim_sum;; +let rhazim_sum = Sections.finalize_theorem rhazim_sum;; +Sections.end_section "Node";; + +(* Section Face *) +Sections.begin_section "Face";; +(Sections.add_section_var (mk_var ("f", (`:real^3#real^3->bool`))));; +(Sections.add_section_hyp "f_in" (`f IN face_set (hypermap_of_fan (V,E))`));; + +(* Let f_repr *) +Sections.add_section_lemma "f_repr" (Sections.section_proof [] +`?v w. v,w IN dart_of_fan (V,E) /\ f = face (hypermap_of_fan (V,E)) (v,w)` +[ + (((use_arg_then2 ("f_in", [])) (disch_tac [])) THEN (clear_assumption "f_in") THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (case THEN ((move ["v"]) THEN (move ["w"])))) THEN (move ["h"])); + ((((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("w", [])) (term_tac exists_tac))) THEN (((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; + +(* Let confV *) +Sections.add_section_lemma "confV" (Sections.section_proof [] +`conforming_fan (vec 0,V,E)` +[ + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_imp_conforming", [fully_surrounded_imp_conforming])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Lemma sol_lo *) +let sol_lo = Sections.section_proof [] +`&0 <= sol_fan (V,E) f` +[ + (((((use_arg_then2 ("sol_fan", [sol_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_POS", [REAL_ABS_POS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma tau_lo *) +let tau_lo = Sections.section_proof [] +`&0 <= tau_fan (V,E) f` +[ + (((((use_arg_then2 ("tau_fan", [tau_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_POS", [REAL_ABS_POS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sol_hi *) +let sol_hi = Sections.section_proof [] +`sol_fan (V,E) f <= &4 * pi` +[ + ((use_arg_then2 ("f_repr", [])) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["v"]) THEN (case THEN (move ["w"])) THEN (case THEN (move ["vw_in"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + ((((use_arg_then2 ("sol_fan_eq", [sol_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> (use_arg_then2 ("fan_hypermaps_iso_explicit2", [fan_hypermaps_iso_explicit2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["iso"]))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (move ["_"]))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart (hypermap_of_fan (V,E))`))) (term_tac (have_gen_tac [](move ["vw_in2"])))) ((((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("iso_components", [iso_components])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["_"]) THEN (case THEN (move ["f_eq"])) THEN (move ["_"]))))); + ((((use_arg_then2 ("dart_leads_into_eq1", [dart_leads_into_eq1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Conforming.SUM_SOL_IN_FACE_SET_EQ_4PI", [Conforming.SUM_SOL_IN_FACE_SET_EQ_4PI])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("confV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((THENL_ROT (-1)) (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("REAL_EQ_IMP_LE", [REAL_EQ_IMP_LE])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("SUM_POS_BOUND", [SUM_POS_BOUND])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (ANTS_TAC))); + ((((use_arg_then2 ("f_eq", [])) (disch_tac [])) THEN (clear_assumption "f_eq") THEN BETA_TAC) THEN ((fun arg_tac -> arg_tac (Arg_term (`face _1 _2`))) (term_tac (set_tac "f1"))) THEN (BETA_TAC THEN (move ["f_eq"]))); + (((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("f1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("f1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("FINITE_HYPERMAP_ORBITS", [FINITE_HYPERMAP_ORBITS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (BETA_TAC THEN (move ["f1"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["d"])) THEN (case THEN (move ["d_in"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ext_contracted", [ext_contracted])) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("hypermap_of_fan_rep_alt", [hypermap_of_fan_rep_alt])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`contracted_dart d IN dart (hypermap_of_fan (V,E))`))) (term_tac (have_gen_tac [](move ["cd_in"])))); + ((((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("fan_hypermaps_iso_explicit", [fan_hypermaps_iso_explicit])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("iso_components", [iso_components])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("pair_expand", [pair_expand])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`contracted_dart d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart_leads_into_eq1", [dart_leads_into_eq1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("fan_sol_pos", [fan_sol_pos]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma sol_sum *) +let sol_sum = Sections.section_proof [] +`sum f (azim_dart (V,E)) = sol_fan (V,E) f + &(CARD f - 2) * pi` +[ + ((use_arg_then2 ("f_repr", [])) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["v"]) THEN (case THEN (move ["w"])) THEN (case THEN (move ["vw_in"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + ((((use_arg_then2 ("sol_fan_eq", [sol_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fully_surrounded_sol", [fully_surrounded_sol]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("SUM_SUB", [SUM_SUB]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FACE_FINITE", [FACE_FINITE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("SUM_CONST", [SUM_CONST])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`pi`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FACE_FINITE", [FACE_FINITE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("ETA_AX", [ETA_AX])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`azim_dart (V,E)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((THENL_LAST) (((use_arg_then2 ("REAL_OF_NUM_SUB", [REAL_OF_NUM_SUB]))(gsym_then (thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FULLY_SURROUNDED_IMP_CARD_FACE_GE_3", [FULLY_SURROUNDED_IMP_CARD_FACE_GE_3])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma sol_sum3 *) +let sol_sum3 = Sections.section_proof [] +`CARD f = 3 ==> sum f (azim_dart (V,E)) = sol_fan (V,E) f + pi` +[ + (((((use_arg_then2 ("sol_sum", [sol_sum]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma sol_sum4 *) +let sol_sum4 = Sections.section_proof [] +`CARD f = 4 ==> sum f (azim_dart (V,E)) = sol_fan (V,E) f + &2 * pi` +[ + (((((use_arg_then2 ("sol_sum", [sol_sum]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma sol_sum5 *) +let sol_sum5 = Sections.section_proof [] +`CARD f = 5 ==> sum f (azim_dart (V,E)) = sol_fan (V,E) f + &3 * pi` +[ + (((((use_arg_then2 ("sol_sum", [sol_sum]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma sol_sum6 *) +let sol_sum6 = Sections.section_proof [] +`CARD f = 6 ==> sum f (azim_dart (V,E)) = sol_fan (V,E) f + &4 * pi` +[ + (((((use_arg_then2 ("sol_sum", [sol_sum]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section Face *) +let sol_lo = Sections.finalize_theorem sol_lo;; +let tau_lo = Sections.finalize_theorem tau_lo;; +let sol_hi = Sections.finalize_theorem sol_hi;; +let sol_sum = Sections.finalize_theorem sol_sum;; +let sol_sum3 = Sections.finalize_theorem sol_sum3;; +let sol_sum4 = Sections.finalize_theorem sol_sum4;; +let sol_sum5 = Sections.finalize_theorem sol_sum5;; +let sol_sum6 = Sections.finalize_theorem sol_sum6;; +Sections.end_section "Face";; + +(* Section FaceTau *) +Sections.begin_section "FaceTau";; +(Sections.add_section_hyp "tau_h" (`lp_tau (V,E)`));; + +(* Section Inner *) +Sections.begin_section "Inner";; +(Sections.add_section_var (mk_var ("f", (`:real^3#real^3->bool`))));; +(Sections.add_section_hyp "f_in" (`f IN face_set (hypermap_of_fan (V,E))`));; + +(* Lemma tau_sum *) +let tau_sum = Sections.section_proof [] +`sum f (rhazim_fan (V,E)) = tau_fan (V,E) f + &(CARD f - 2) * (pi + sol0)` +[ + ((((use_arg_then2 ("tau_fan_eq_tauVEF", [tau_fan_eq_tauVEF]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (fun fst_arg -> (use_arg_then2 ("f_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (case THEN ((move ["v"]) THEN (move ["w"])))) THEN (case THEN ALL_TAC)) THEN ((((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] [])))) THEN (move ["vw_in"]) THEN (move ["f_eq"]))); + ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [2] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE tauVEF_alt3)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((use_arg_then2 ("REAL_OF_NUM_SUB", [REAL_OF_NUM_SUB]))(gsym_then (thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FULLY_SURROUNDED_IMP_CARD_FACE_GE_3", [FULLY_SURROUNDED_IMP_CARD_FACE_GE_3])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`FINITE f`))) (term_tac (have_gen_tac [](move ["fin_f"])))) (((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FACE_FINITE", [FACE_FINITE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("SUM_SUB", [SUM_SUB]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("SUM_CONST", [SUM_CONST])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`pi`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("SUM_CONST", [SUM_CONST])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sol0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("REAL_ADD_RID", [REAL_ADD_RID]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((THENL_LAST) (congr_tac (`_1 + _2:real`)) ((arith_tac) THEN (done_tac))); + (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["d"]) THEN (move ["d_in_f"])); + ((fun arg_tac -> arg_tac (Arg_term (`d IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["d_in"])))); + (((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("IN_TRANS", [IN_TRANS])) (fun fst_arg -> (use_arg_then2 ("d_in_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lemma_face_subset", [lemma_face_subset]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("rhazim_fan", [rhazim_fan]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("h_dart", [h_dart]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("yn_fan", [yn_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ln_fan", [ln_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("rho_fan", [rho_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(gsym_then (thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("rho_def", [rho_def]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_dart_inV", [])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma tau_sum3 *) +let tau_sum3 = Sections.section_proof [] +`CARD f = 3 ==> + sum f (rhazim_fan (V,E)) = tau_fan (V,E) f + (pi + sol0)` +[ + (((((use_arg_then2 ("tau_sum", [tau_sum]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma tau_sum4 *) +let tau_sum4 = Sections.section_proof [] +`CARD f = 4 ==> + sum f (rhazim_fan (V,E)) = tau_fan (V,E) f + &2 * (pi + sol0)` +[ + (((((use_arg_then2 ("tau_sum", [tau_sum]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma tau_sum5 *) +let tau_sum5 = Sections.section_proof [] +`CARD f = 5 ==> + sum f (rhazim_fan (V,E)) = tau_fan (V,E) f + &3 * (pi + sol0)` +[ + (((((use_arg_then2 ("tau_sum", [tau_sum]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma tau_sum6 *) +let tau_sum6 = Sections.section_proof [] +`CARD f = 6 ==> + sum f (rhazim_fan (V,E)) = tau_fan (V,E) f + &4 * (pi + sol0)` +[ + (((((use_arg_then2 ("tau_sum", [tau_sum]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section Inner *) +let tau_sum = Sections.finalize_theorem tau_sum;; +let tau_sum3 = Sections.finalize_theorem tau_sum3;; +let tau_sum4 = Sections.finalize_theorem tau_sum4;; +let tau_sum5 = Sections.finalize_theorem tau_sum5;; +let tau_sum6 = Sections.finalize_theorem tau_sum6;; +Sections.end_section "Inner";; +(Sections.add_section_hyp "contrV" (`contravening V`));; + +(* Section Inner *) +Sections.begin_section "Inner";; +(Sections.add_section_var (mk_var ("f", (`:real^3#real^3->bool`))));; +(Sections.add_section_hyp "f_in" (`f IN face_set (hypermap_of_fan (V,E))`));; + +(* Let tgt_ineq *) +Sections.add_section_lemma "tgt_ineq" (Sections.section_proof [] +`&4 * pi - &20 * sol0 <= tgt` +[ + ((fun arg_tac -> arg_tac (Arg_theorem (create_interval `&4 * pi - &20 * sol0`))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("interval_arith", [interval_arith]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("tgt", [tgt]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +]);; + +(* Lemma tauVEF_hi *) +let tauVEF_hi = Sections.section_proof [] +`tauVEF (V,E,f) <= tgt` +[ + ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`&4 * pi - &20 * sol0`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("tgt_ineq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sum_tauVEF_upper_bound", [sum_tauVEF_upper_bound])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)); + ((((use_arg_then2 ("contrV", [])) (disch_tac [])) THEN (clear_assumption "contrV") THEN BETA_TAC) THEN (((((use_arg_then2 ("contravening", [contravening]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_LE", [REAL_LT_LE]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("SUM_POS_BOUND", [SUM_POS_BOUND])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("f_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_HYPERMAP_ORBITS", [FINITE_HYPERMAP_ORBITS]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["f2"]) THEN (move ["f2_in"])); + ((((use_arg_then2 ("tau_h", [])) (disch_tac [])) THEN (clear_assumption "tau_h") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_tau", [lp_tau]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma tau_hi *) +let tau_hi = Sections.section_proof [] +`tau_fan (V,E) f <= tgt` +[ + (((((use_arg_then2 ("tau_fan_eq_tauVEF", [tau_fan_eq_tauVEF]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("tauVEF_hi", [tauVEF_hi]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Inner *) +let tauVEF_hi = Sections.finalize_theorem tauVEF_hi;; +let tau_hi = Sections.finalize_theorem tau_hi;; +Sections.end_section "Inner";; + +(* Finalization of the section FaceTau *) +let tau_sum = Sections.finalize_theorem tau_sum;; +let tau_sum3 = Sections.finalize_theorem tau_sum3;; +let tau_sum4 = Sections.finalize_theorem tau_sum4;; +let tau_sum5 = Sections.finalize_theorem tau_sum5;; +let tau_sum6 = Sections.finalize_theorem tau_sum6;; +let tauVEF_hi = Sections.finalize_theorem tauVEF_hi;; +let tau_hi = Sections.finalize_theorem tau_hi;; +Sections.end_section "FaceTau";; + +(* Section Nonlinear *) +Sections.begin_section "Nonlinear";; + +(* Section V *) +Sections.begin_section "V";; +(Sections.add_section_var (mk_var ("v", (`:real^3`))));; +(Sections.add_section_hyp "vV" (`v IN V`));; + +(* Lemma ln_fan_ly *) +let ln_fan_ly = Sections.section_proof [] +`ln_fan v = ly (norm v)` +[ + ((((use_arg_then2 ("ln_fan", [ln_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yn_fan", [yn_fan]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`v = FST (v,v)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((ALL_TAC) THEN (done_tac))); + ((((use_arg_then2 ("h_dart", [h_dart]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ly_EQ_lmfun", [ly_EQ_lmfun]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("norm_v", [])) (fun fst_arg -> (use_arg_then2 ("vV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma rho_fan_eq_rho *) +let rho_fan_eq_rho = Sections.section_proof [] +`rho_fan v = rho (norm v)` +[ + ((((use_arg_then2 ("rho_fan", [rho_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Sphere.rho", [Sphere.rho]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ln_fan_ly", [ln_fan_ly]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`&1 + _`))) (term_tac (set_tac "x"))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`abs x = x`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((((use_arg_then2 ("x_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("REAL_ABS_REFL", [REAL_ABS_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rho_pos", [rho_pos]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section V *) +let ln_fan_ly = Sections.finalize_theorem ln_fan_ly;; +let rho_fan_eq_rho = Sections.finalize_theorem rho_fan_eq_rho;; +Sections.end_section "V";; + +(* Section Y *) +Sections.begin_section "Y";; + +(* Lemma ys_eq *) +let ys_eq = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + ==> y1_fan (v,w) = norm v + /\ y2_fan (v,w) = norm w + /\ y3_fan (V,E) (v,w) = norm (sigma_fan (vec 0) V E v w) + /\ y4'_fan (V,E) (v,w) = dist (w, sigma_fan (vec 0) V E v w) + /\ y5_fan (V,E) (v,w) = dist (v, sigma_fan (vec 0) V E v w) + /\ y6_fan (v,w) = dist (v,w)` +[ + (BETA_TAC THEN (move ["vw_in"])); + ((((use_arg_then2 ("y1_fan", [y1_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y2_fan", [y2_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y3_fan", [y3_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y4'_fan", [y4'_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y6_fan", [y6_fan]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma inverse_f_fan_pair_ext_power2 *) +let inverse_f_fan_pair_ext_power2 = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + ==> let w' = sigma_fan (vec 0) V E v w in + let u = sigma_fan (vec 0) V E w' v in + (inverse (f_fan_pair_ext (V,E)) POWER 2) (v,w) = u,w'` +[ + ((BETA_TAC THEN (move ["vw_in"])) THEN (repeat_tactic 1 9 ((CONV_TAC let_CONV)))); + ((((use_arg_then2 ("TWO", [TWO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER", [POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("dart_switch", [dart_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y78_eq *) +let y78_eq = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + ==> let w' = sigma_fan (vec 0) V E v w in + let u = sigma_fan (vec 0) V E w' v in + y8_fan (V,E) (v,w) = dist (w',u) /\ + y7_fan (V,E) (v,w) = norm u` +[ + ((BETA_TAC THEN (move ["vw_in"])) THEN (repeat_tactic 1 9 ((CONV_TAC let_CONV)))); + ((((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE inverse_f_fan_pair_ext_power2)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("y8_fan", [y8_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("TWO", [TWO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER", [POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((((use_arg_then2 ("y7_fan", [y7_fan]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE inverse_f_fan_pair_ext_power2)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma y9_eq *) +let y9_eq = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) /\ CARD (face (hypermap_of_fan (V,E)) (v,w)) = 4 + ==> let w' = sigma_fan (vec 0) V E v w in + let u = sigma_fan (vec 0) V E w' v in + y9_fan (V,E) (v,w) = dist (w,u)` +[ + ((BETA_TAC THEN (case THEN ((move ["vw_in"]) THEN (move ["card_f"])))) THEN (repeat_tactic 1 9 ((CONV_TAC let_CONV)))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w1"))); + ((((use_arg_then2 ("y9_fan", [y9_fan]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE face4_eq)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("w1_def", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ys_eq_alt *) +let ys_eq_alt = Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) + ==> y1_fan d = norm (FST d) + /\ y2_fan d = norm (SND d) + /\ y3_fan (V,E) d = norm (sigma_fan (vec 0) V E (FST d) (SND d)) + /\ y4'_fan (V,E) d = dist (SND d, sigma_fan (vec 0) V E (FST d) (SND d)) + /\ y5_fan (V,E) d = dist (FST d, sigma_fan (vec 0) V E (FST d) (SND d)) + /\ y6_fan d = dist d` +[ + ((((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (simp_tac) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("ys_eq", [ys_eq])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Finalization of the section Y *) +let ys_eq = Sections.finalize_theorem ys_eq;; +let inverse_f_fan_pair_ext_power2 = Sections.finalize_theorem inverse_f_fan_pair_ext_power2;; +let y78_eq = Sections.finalize_theorem y78_eq;; +let y9_eq = Sections.finalize_theorem y9_eq;; +let ys_eq_alt = Sections.finalize_theorem ys_eq_alt;; +Sections.end_section "Y";; + +(* Section Dart *) +Sections.begin_section "Dart";; +(Sections.add_section_var (mk_var ("d", (`:real^3#real^3`))));; +(Sections.add_section_hyp "d_in" (`d IN dart_of_fan (V,E)`));; + +(* Lemma azim_fan_eq_dih_y *) +let azim_fan_eq_dih_y = Sections.section_proof [] +`azim_dart (V,E) d + = dih_y (y1_fan d) (y2_fan d) (y3_fan (V,E) d) (y4'_fan (V,E) d) (y5_fan (V,E) d) (y6_fan d)` +[ + (((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"])); + (((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE fully_surrounded_azim_eq_dih_y)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ys_eq", [ys_eq]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma rhazim_fan_eq_rhazim *) +let rhazim_fan_eq_rhazim = Sections.section_proof [] +`rhazim_fan (V,E) d + = rhazim (y1_fan d) (y2_fan d) (y3_fan (V,E) d) (y4'_fan (V,E) d) (y5_fan (V,E) d) (y6_fan d)` +[ + ((((use_arg_then2 ("Sphere.rhazim", [Sphere.rhazim]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rhazim_fan", [rhazim_fan]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("h_dart", [h_dart]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yn_fan", [yn_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ln_fan", [ln_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rho_fan", [rho_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y1_fan", [y1_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rho_fan_eq_rho", [rho_fan_eq_rho]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("in_dart_inV", [])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma delta_y_not_neg *) +let delta_y_not_neg = Sections.section_proof [] +`~(delta_y (y1_fan d) (y2_fan d) (y3_fan (V,E) d) (y4'_fan (V,E) d) (y5_fan (V,E) d) (y6_fan d) + < &0)` +[ + (((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"])); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE delta_y_pos))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E v w`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("REAL_NOT_LT", [REAL_NOT_LT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ys_eq", [ys_eq]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section Dart *) +let azim_fan_eq_dih_y = Sections.finalize_theorem azim_fan_eq_dih_y;; +let rhazim_fan_eq_rhazim = Sections.finalize_theorem rhazim_fan_eq_rhazim;; +let delta_y_not_neg = Sections.finalize_theorem delta_y_not_neg;; +Sections.end_section "Dart";; + +(* Section Dart3 *) +Sections.begin_section "Dart3";; +(Sections.add_section_var (mk_var ("d", (`:real^3#real^3`))));; +(Sections.add_section_hyp "d_in" (`d IN darts_k 3 (hypermap_of_fan (V,E))`));; + +(* Let card_f *) +Sections.add_section_lemma "card_f" (Sections.section_proof [] +`CARD (face (hypermap_of_fan (V,E)) d) = 3` +[ + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; + +(* Let d_in_dart *) +Sections.add_section_lemma "d_in_dart" (Sections.section_proof [] +`d IN dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; + +(* Lemma dart3_yf_eq *) +let dart3_yf_eq = Sections.section_proof [] +`y1_fan (f_fan_pair_ext (V,E) d) = y2_fan d + /\ y2_fan (f_fan_pair_ext (V,E) d) = y3_fan (V,E) d + /\ y3_fan (V,E) (f_fan_pair_ext (V,E) d) = y1_fan d + /\ y4_fan (V,E) (f_fan_pair_ext (V,E) d) = y5_fan (V,E) d + /\ y5_fan (V,E) (f_fan_pair_ext (V,E) d) = y6_fan d + /\ y6_fan (f_fan_pair_ext (V,E) d) = y4_fan (V,E) d` +[ + ((repeat_tactic 12 0 (((fun arg_tac ->(use_arg_then2 ("y1_fan", [y1_fan]))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("y2_fan", [y2_fan]))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("y3_fan", [y3_fan]))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("y4_fan", [y4_fan]))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("y5_fan", [y5_fan]))(fun tmp_arg1 -> (use_arg_then2 ("y6_fan", [y6_fan]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES", [PERMUTES_INVERSES])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((use_arg_then2 ("card_f", [])) (disch_tac [])) THEN (clear_assumption "card_f") THEN ((use_arg_then2 ("d_in_dart", [])) (disch_tac [])) THEN (clear_assumption "d_in_dart") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"]) THEN (move ["card_f"])); + ((((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["vw_in1"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair3", [f_fan_pair3])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["eq"]))); + (((((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma dart3_y_invf_eq *) +let dart3_y_invf_eq = Sections.section_proof [] +`y1_fan (inverse (f_fan_pair_ext (V,E)) d) = y3_fan (V,E) d + /\ y2_fan (inverse (f_fan_pair_ext (V,E)) d) = y1_fan d + /\ y3_fan (V,E) (inverse (f_fan_pair_ext (V,E)) d) = y2_fan d + /\ y4_fan (V,E) (inverse (f_fan_pair_ext (V,E)) d) = y6_fan d + /\ y5_fan (V,E) (inverse (f_fan_pair_ext (V,E)) d) = y4_fan (V,E) d + /\ y6_fan (inverse (f_fan_pair_ext (V,E)) d) = y5_fan (V,E) d` +[ + ((repeat_tactic 12 0 (((fun arg_tac ->(use_arg_then2 ("y1_fan", [y1_fan]))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("y2_fan", [y2_fan]))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("y3_fan", [y3_fan]))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("y4_fan", [y4_fan]))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("y5_fan", [y5_fan]))(fun tmp_arg1 -> (use_arg_then2 ("y6_fan", [y6_fan]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES", [PERMUTES_INVERSES])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((use_arg_then2 ("card_f", [])) (disch_tac [])) THEN (clear_assumption "card_f") THEN ((use_arg_then2 ("d_in_dart", [])) (disch_tac [])) THEN (clear_assumption "d_in_dart") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"]) THEN (move ["card_f"])); + ((((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["vw_in1"]))); + ((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE inverse_f_fan_pair_ext_power2))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("TWO", [TWO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER", [POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE TRIANGULAR_FACE)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((fun arg_tac -> (use_arg_then2 ("f_fan_pair3", [f_fan_pair3])) (fun fst_arg -> (use_arg_then2 ("card_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dart3_azim_fan_eq_dih_y *) +let dart3_azim_fan_eq_dih_y = Sections.section_proof [] +`azim_dart (V,E) d + = dih_y (y1_fan d) (y2_fan d) (y3_fan (V,E) d) (y4_fan (V,E) d) (y5_fan (V,E) d) (y6_fan d)` +[ + (((((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4'_eq_y4", [y4'_eq_y4]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dart3_rhazim_fan_eq_rhazim *) +let dart3_rhazim_fan_eq_rhazim = Sections.section_proof [] +`rhazim_fan (V,E) d + = rhazim (y1_fan d) (y2_fan d) (y3_fan (V,E) d) (y4_fan (V,E) d) (y5_fan (V,E) d) (y6_fan d)` +[ + (((((use_arg_then2 ("rhazim_fan_eq_rhazim", [rhazim_fan_eq_rhazim]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4'_eq_y4", [y4'_eq_y4]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dart3_sol_fan_eq_sol *) +let dart3_sol_fan_eq_sol = Sections.section_proof [] +`sol_fan (V,E) (face (hypermap_of_fan (V,E)) d) + = sol_y (y1_fan d) (y2_fan d) (y3_fan (V,E) d) (y4_fan (V,E) d) (y5_fan (V,E) d) (y6_fan d)` +[ + ((((use_arg_then2 ("y4'_eq_y4", [y4'_eq_y4]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((use_arg_then2 ("card_f", [])) (disch_tac [])) THEN (clear_assumption "card_f") THEN ((use_arg_then2 ("d_in_dart", [])) (disch_tac [])) THEN (clear_assumption "d_in_dart") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"]) THEN (move ["card_f"])); + (((((use_arg_then2 ("sol_fan_eq", [sol_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE fully_surrounded_sol_eq_sol_y)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ys_eq", [ys_eq]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section Dart3 *) +let dart3_yf_eq = Sections.finalize_theorem dart3_yf_eq;; +let dart3_y_invf_eq = Sections.finalize_theorem dart3_y_invf_eq;; +let dart3_azim_fan_eq_dih_y = Sections.finalize_theorem dart3_azim_fan_eq_dih_y;; +let dart3_rhazim_fan_eq_rhazim = Sections.finalize_theorem dart3_rhazim_fan_eq_rhazim;; +let dart3_sol_fan_eq_sol = Sections.finalize_theorem dart3_sol_fan_eq_sol;; +Sections.end_section "Dart3";; + +(* Section Dart3_more *) +Sections.begin_section "Dart3_more";; +(Sections.add_section_var (mk_var ("d", (`:real^3#real^3`))));; +(Sections.add_section_hyp "d_in" (`d IN darts_k 3 (hypermap_of_fan (V,E))`));; + +(* Lemma dart3_azim2_fan_eq_dih2_y *) +let dart3_azim2_fan_eq_dih2_y = Sections.section_proof [] +`azim2_fan (V,E) d + = dih2_y (y1_fan d) (y2_fan d) (y3_fan (V,E) d) (y4_fan (V,E) d) (y5_fan (V,E) d) (y6_fan d)` +[ + ((((use_arg_then2 ("dih2_y", [dih2_y]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("azim2_fan", [azim2_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart3_azim_fan_eq_dih_y", [dart3_azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_fan_pair_ext_in_darts_k", [f_fan_pair_ext_in_darts_k]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("dart3_yf_eq", [dart3_yf_eq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("Nonlinear_lemma.dih_y_sym", [Nonlinear_lemma.dih_y_sym]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dart3_azim3_fan_eq_dih3_y *) +let dart3_azim3_fan_eq_dih3_y = Sections.section_proof [] +`azim3_fan (V,E) d + = dih3_y (y1_fan d) (y2_fan d) (y3_fan (V,E) d) (y4_fan (V,E) d) (y5_fan (V,E) d) (y6_fan d)` +[ + ((((use_arg_then2 ("dih3_y", [dih3_y]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("azim3_fan", [azim3_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart3_azim_fan_eq_dih_y", [dart3_azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_fan_pair_ext_in_darts_k", [f_fan_pair_ext_in_darts_k]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("dart3_y_invf_eq", [dart3_y_invf_eq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dart3_rhazim2_fan_eq_rhazim2 *) +let dart3_rhazim2_fan_eq_rhazim2 = Sections.section_proof [] +`rhazim2_fan (V,E) d + = rhazim2 (y1_fan d) (y2_fan d) (y3_fan (V,E) d) (y4_fan (V,E) d) (y5_fan (V,E) d) (y6_fan d)` +[ + ((((use_arg_then2 ("rhazim2", [rhazim2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rhazim2_fan", [rhazim2_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart3_rhazim_fan_eq_rhazim", [dart3_rhazim_fan_eq_rhazim]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_fan_pair_ext_in_darts_k", [f_fan_pair_ext_in_darts_k]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("node2_y", [node2_y]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("dart3_yf_eq", [dart3_yf_eq]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma dart3_rhazim3_fan_eq_rhazim3 *) +let dart3_rhazim3_fan_eq_rhazim3 = Sections.section_proof [] +`rhazim3_fan (V,E) d + = rhazim3 (y1_fan d) (y2_fan d) (y3_fan (V,E) d) (y4_fan (V,E) d) (y5_fan (V,E) d) (y6_fan d)` +[ + ((((use_arg_then2 ("rhazim3", [rhazim3]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rhazim3_fan", [rhazim3_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart3_rhazim_fan_eq_rhazim", [dart3_rhazim_fan_eq_rhazim]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_fan_pair_ext_in_darts_k", [f_fan_pair_ext_in_darts_k]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("node3_y", [node3_y]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("dart3_y_invf_eq", [dart3_y_invf_eq]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section Dart3_more *) +let dart3_azim2_fan_eq_dih2_y = Sections.finalize_theorem dart3_azim2_fan_eq_dih2_y;; +let dart3_azim3_fan_eq_dih3_y = Sections.finalize_theorem dart3_azim3_fan_eq_dih3_y;; +let dart3_rhazim2_fan_eq_rhazim2 = Sections.finalize_theorem dart3_rhazim2_fan_eq_rhazim2;; +let dart3_rhazim3_fan_eq_rhazim3 = Sections.finalize_theorem dart3_rhazim3_fan_eq_rhazim3;; +Sections.end_section "Dart3_more";; + +(* Lemma dart4_f_fan_pair_ext_power2 *) +let dart4_f_fan_pair_ext_power2 = Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) /\ + CARD (face (hypermap_of_fan (V,E)) d) = 4 + ==> (f_fan_pair_ext (V,E) POWER 2) d = (inverse (f_fan_pair_ext (V,E)) POWER 2) d` +[ + (BETA_TAC THEN (case THEN ((move ["d_in"]) THEN (move ["card_f"])))); + ((((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`2 = 4 - 2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [2] []))))))) ((arith_tac) THEN (done_tac))); + (((use_arg_then2 ("FINITE_ORBIT_MAP_INVERSE", [FINITE_ORBIT_MAP_INVERSE])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`dart (hypermap_of_fan (V,E))`))) (term_tac exists_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("face_map_and_darts", [face_map_and_darts]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("face", [face]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Section Dart4 *) +Sections.begin_section "Dart4";; +(Sections.add_section_var (mk_var ("d", (`:real^3#real^3`))));; +(Sections.add_section_hyp "d_in" (`d IN darts_k 4 (hypermap_of_fan (V,E))`));; + +(* Let card_f *) +Sections.add_section_lemma "card_f" (Sections.section_proof [] +`CARD (face (hypermap_of_fan (V,E)) d) = 4` +[ + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; + +(* Let d_in_dart *) +Sections.add_section_lemma "d_in_dart" (Sections.section_proof [] +`d IN dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; + +(* Lemma dart4_yf_eq *) +let dart4_yf_eq = Sections.section_proof [] +`y1_fan (f_fan_pair_ext (V,E) d) = y2_fan d + /\ y2_fan (f_fan_pair_ext (V,E) d) = y7_fan (V,E) d + /\ y3_fan (V,E) (f_fan_pair_ext (V,E) d) = y1_fan d + /\ y5_fan (V,E) (f_fan_pair_ext (V,E) d) = y6_fan d + /\ y6_fan (f_fan_pair_ext (V,E) d) = y9_fan (V,E) d + /\ y7_fan (V,E) (f_fan_pair_ext (V,E) d) = y3_fan (V,E) d + /\ y8_fan (V,E) (f_fan_pair_ext (V,E) d) = y5_fan (V,E) d + /\ y9_fan (V,E) (f_fan_pair_ext (V,E) d) = y8_fan (V,E) d` +[ + (((use_arg_then2 ("card_f", [])) (disch_tac [])) THEN (clear_assumption "card_f") THEN ((use_arg_then2 ("d_in_dart", [])) (disch_tac [])) THEN (clear_assumption "d_in_dart") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"]) THEN (move ["card_f"])); + ((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES", [PERMUTES_INVERSES])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["inv_f_f"]))); + ((repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("y1_fan", [y1_fan]))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("y3_fan", [y3_fan]))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("y5_fan", [y5_fan]))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("y6_fan", [y6_fan]))(fun tmp_arg1 -> (use_arg_then2 ("y9_fan", [y9_fan]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y2_def", [y2_def]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("fd_in", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inv_f_f", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("yn_fan", [yn_fan]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("y8_fan", [y8_fan]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y7_fan", [y7_fan]))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f_fan_pair_ext (V,E)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("dart4_f_fan_pair_ext_power2", [dart4_f_fan_pair_ext_power2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inv_f_f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dart4_y_invf_eq *) +let dart4_y_invf_eq = Sections.section_proof [] +`y1_fan (inverse (f_fan_pair_ext (V,E)) d) = y3_fan (V,E) d + /\ y2_fan (inverse (f_fan_pair_ext (V,E)) d) = y1_fan d + /\ y3_fan (V,E) (inverse (f_fan_pair_ext (V,E)) d) = y7_fan (V,E) d + /\ y5_fan (V,E) (inverse (f_fan_pair_ext (V,E)) d) = y8_fan (V,E) d + /\ y6_fan (inverse (f_fan_pair_ext (V,E)) d) = y5_fan (V,E) d + /\ y7_fan (V,E) (inverse (f_fan_pair_ext (V,E)) d) = y2_fan d + /\ y8_fan (V,E) (inverse (f_fan_pair_ext (V,E)) d) = y9_fan (V,E) d + /\ y9_fan (V,E) (inverse (f_fan_pair_ext (V,E)) d) = y6_fan d` +[ + (((use_arg_then2 ("card_f", [])) (disch_tac [])) THEN (clear_assumption "card_f") THEN ((use_arg_then2 ("d_in_dart", [])) (disch_tac [])) THEN (clear_assumption "d_in_dart") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"]) THEN (move ["card_f"])); + ((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES", [PERMUTES_INVERSES])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["inv_f_f"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("y1_fan", [y1_fan]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y2_fan", [y2_fan]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y3_fan", [y3_fan]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y8_fan", [y8_fan]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y6_fan", [y6_fan]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y7_fan", [y7_fan]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y9_fan", [y9_fan]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inv_f_f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [1] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`inverse _`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`f_fan_pair_ext _`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`(inverse f POWER 2) (inverse f x) = inverse f ((inverse f POWER 2) x)`))) (term_tac (have_gen_tac ["x"](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("COM_POWER_FUNCTION", [COM_POWER_FUNCTION]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`inverse f POWER 2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("POWER", [POWER]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart4_f_fan_pair_ext_power2", [dart4_f_fan_pair_ext_power2]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inv_f_f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dart4_cross_eq_y4' *) +let dart4_cross_eq_y4' = Sections.section_proof [] +`y4'_fan (V,E) (f_fan_pair_ext (V,E) d) + = y4'_fan (V,E) (inverse (f_fan_pair_ext (V,E)) d)` +[ + ((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES", [PERMUTES_INVERSES])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["inv_f_f"]))); + (((use_arg_then2 ("card_f", [])) (disch_tac [])) THEN (clear_assumption "card_f") THEN ((use_arg_then2 ("d_in_dart", [])) (disch_tac [])) THEN (clear_assumption "d_in_dart") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"]) THEN (move ["card_f"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("y4'_fan", [y4'_fan]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inv_f_f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] []))))) THEN (congr_tac (`dist _`)) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (split_tac)); + (((((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`inverse _`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart4_f_fan_pair_ext_power2", [dart4_f_fan_pair_ext_power2]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("POWER_1", [POWER_1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f_fan_pair_ext (V,E)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("f_fan_pair_power", [f_fan_pair_power]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma dart4_cross_eq_enclosed *) +let dart4_cross_eq_enclosed = Sections.section_proof [] +`y4'_fan (V,E) (f_fan_pair_ext (V,E) d) + = enclosed (y1_fan d) (y5_fan (V,E) d) (y6_fan d) (y4'_fan (V,E) d) + (y2_fan d) (y3_fan (V,E) d) (y7_fan (V,E) d) (y8_fan (V,E) d) (y9_fan (V,E) d)` +[ + (((use_arg_then2 ("dart4_cross_eq_y4'", [dart4_cross_eq_y4']))(thm_tac (new_rewrite [] [])))); + (((use_arg_then2 ("card_f", [])) (disch_tac [])) THEN (clear_assumption "card_f") THEN ((use_arg_then2 ("d_in_dart", [])) (disch_tac [])) THEN (clear_assumption "d_in_dart") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"]) THEN (move ["card_f"])); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE fully_surrounded_enclosed))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((repeat_tactic 1 9 (((use_arg_then2 ("ys_eq", [ys_eq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE y78_eq)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE y9_eq)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E w' v`))) (term_tac (set_tac "u"))); + (BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("y4'_fan", [y4'_fan]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`inverse _`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [(`FST _`)]))))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE inverse_f_fan_pair_ext_power2)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("u_def", []))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Dart4 *) +let dart4_yf_eq = Sections.finalize_theorem dart4_yf_eq;; +let dart4_y_invf_eq = Sections.finalize_theorem dart4_y_invf_eq;; +let dart4_cross_eq_y4' = Sections.finalize_theorem dart4_cross_eq_y4';; +let dart4_cross_eq_enclosed = Sections.finalize_theorem dart4_cross_eq_enclosed;; +Sections.end_section "Dart4";; + +(* Section Tau *) +Sections.begin_section "Tau";; + +(* Lemma dart3_tauVEF_eq_taum *) +let dart3_tauVEF_eq_taum = Sections.section_proof ["d"] +`d IN darts_k 3 (hypermap_of_fan (V,E)) + ==> tauVEF (V,E,face (hypermap_of_fan (V,E)) d) + = taum (y1_fan d) (y2_fan d) (y3_fan (V,E) d) (y4_fan (V,E) d) (y5_fan (V,E) d) (y6_fan d)` +[ + ((BETA_TAC THEN (move ["d_in3"])) THEN ((((use_arg_then2 ("y4'_eq_y4", [y4'_eq_y4]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((fun arg_tac -> arg_tac (Arg_term (`d IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac []ALL_TAC))); + ((((use_arg_then2 ("d_in3", [])) (disch_tac [])) THEN (clear_assumption "d_in3") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("d_in3", [])) (disch_tac [])) THEN (clear_assumption "d_in3") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in3"]) THEN (move ["vw_in"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE fully_surrounded_tau_eq_taum))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)); + ((((use_arg_then2 ("vw_in3", [])) (disch_tac [])) THEN (clear_assumption "vw_in3") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("ys_eq", [ys_eq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dart4_tauVEF_eq_tauq *) +let dart4_tauVEF_eq_tauq = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> tauVEF (V,E,face (hypermap_of_fan (V,E)) d) + = tauq (y1_fan d) (y2_fan d) (y3_fan (V,E) d) (y4'_fan (V,E) d) + (y5_fan (V,E) d) (y6_fan d) (y7_fan (V,E) d) (y8_fan (V,E) d) (y9_fan (V,E) d)` +[ + (BETA_TAC THEN (move ["d_in4"])); + ((((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] [])))))); + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"])); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE fully_surrounded_tau_eq_tauq))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((repeat_tactic 1 9 (((use_arg_then2 ("ys_eq", [ys_eq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE y78_eq)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE y9_eq)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(Sections.add_section_hyp "tau_h" (`lp_tau (V,E)`));; + +(* Lemma dart3_tau_fan_eq_taum *) +let dart3_tau_fan_eq_taum = Sections.section_proof ["d"] +`d IN darts_k 3 (hypermap_of_fan (V,E)) + ==> tau_fan (V,E) (face (hypermap_of_fan (V,E)) d) + = taum (y1_fan d) (y2_fan d) (y3_fan (V,E) d) (y4_fan (V,E) d) (y5_fan (V,E) d) (y6_fan d)` +[ + ((BETA_TAC THEN (move ["d_in3"])) THEN (((use_arg_then2 ("d_in3", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["card_f"]))); + (((((use_arg_then2 ("tau_fan_eq_tauVEF", [tau_fan_eq_tauVEF]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart3_tauVEF_eq_taum", [dart3_tauVEF_eq_taum]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dart4_tau_fan_eq_tauq *) +let dart4_tau_fan_eq_tauq = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> tau_fan (V,E) (face (hypermap_of_fan (V,E)) d) + = tauq (y1_fan d) (y2_fan d) (y3_fan (V,E) d) (y4'_fan (V,E) d) + (y5_fan (V,E) d) (y6_fan d) (y7_fan (V,E) d) (y8_fan (V,E) d) (y9_fan (V,E) d)` +[ + ((BETA_TAC THEN (move ["d_in4"])) THEN (((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["card_f"]))); + (((((use_arg_then2 ("tau_fan_eq_tauVEF", [tau_fan_eq_tauVEF]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart4_tauVEF_eq_tauq", [dart4_tauVEF_eq_tauq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Tau *) +let dart3_tauVEF_eq_taum = Sections.finalize_theorem dart3_tauVEF_eq_taum;; +let dart4_tauVEF_eq_tauq = Sections.finalize_theorem dart4_tauVEF_eq_tauq;; +let dart3_tau_fan_eq_taum = Sections.finalize_theorem dart3_tau_fan_eq_taum;; +let dart4_tau_fan_eq_tauq = Sections.finalize_theorem dart4_tau_fan_eq_tauq;; +Sections.end_section "Tau";; + +(* Finalization of the section Nonlinear *) +let ln_fan_ly = Sections.finalize_theorem ln_fan_ly;; +let rho_fan_eq_rho = Sections.finalize_theorem rho_fan_eq_rho;; +let ys_eq = Sections.finalize_theorem ys_eq;; +let inverse_f_fan_pair_ext_power2 = Sections.finalize_theorem inverse_f_fan_pair_ext_power2;; +let y78_eq = Sections.finalize_theorem y78_eq;; +let y9_eq = Sections.finalize_theorem y9_eq;; +let ys_eq_alt = Sections.finalize_theorem ys_eq_alt;; +let azim_fan_eq_dih_y = Sections.finalize_theorem azim_fan_eq_dih_y;; +let rhazim_fan_eq_rhazim = Sections.finalize_theorem rhazim_fan_eq_rhazim;; +let delta_y_not_neg = Sections.finalize_theorem delta_y_not_neg;; +let dart3_yf_eq = Sections.finalize_theorem dart3_yf_eq;; +let dart3_y_invf_eq = Sections.finalize_theorem dart3_y_invf_eq;; +let dart3_azim_fan_eq_dih_y = Sections.finalize_theorem dart3_azim_fan_eq_dih_y;; +let dart3_rhazim_fan_eq_rhazim = Sections.finalize_theorem dart3_rhazim_fan_eq_rhazim;; +let dart3_sol_fan_eq_sol = Sections.finalize_theorem dart3_sol_fan_eq_sol;; +let dart3_azim2_fan_eq_dih2_y = Sections.finalize_theorem dart3_azim2_fan_eq_dih2_y;; +let dart3_azim3_fan_eq_dih3_y = Sections.finalize_theorem dart3_azim3_fan_eq_dih3_y;; +let dart3_rhazim2_fan_eq_rhazim2 = Sections.finalize_theorem dart3_rhazim2_fan_eq_rhazim2;; +let dart3_rhazim3_fan_eq_rhazim3 = Sections.finalize_theorem dart3_rhazim3_fan_eq_rhazim3;; +let dart4_f_fan_pair_ext_power2 = Sections.finalize_theorem dart4_f_fan_pair_ext_power2;; +let dart4_yf_eq = Sections.finalize_theorem dart4_yf_eq;; +let dart4_y_invf_eq = Sections.finalize_theorem dart4_y_invf_eq;; +let dart4_cross_eq_y4' = Sections.finalize_theorem dart4_cross_eq_y4';; +let dart4_cross_eq_enclosed = Sections.finalize_theorem dart4_cross_eq_enclosed;; +let dart3_tauVEF_eq_taum = Sections.finalize_theorem dart3_tauVEF_eq_taum;; +let dart4_tauVEF_eq_tauq = Sections.finalize_theorem dart4_tauVEF_eq_tauq;; +let dart3_tau_fan_eq_taum = Sections.finalize_theorem dart3_tau_fan_eq_taum;; +let dart4_tau_fan_eq_tauq = Sections.finalize_theorem dart4_tau_fan_eq_tauq;; +Sections.end_section "Nonlinear";; + +(* Finalization of the section Fan *) +let fan_sol_pos = Sections.finalize_theorem fan_sol_pos;; +let sol_fan_eq = Sections.finalize_theorem sol_fan_eq;; +let rho_pos = Sections.finalize_theorem rho_pos;; +let ln_def = Sections.finalize_theorem ln_def;; +let rho_def = Sections.finalize_theorem rho_def;; +let ln_lo = Sections.finalize_theorem ln_lo;; +let ln_hi = Sections.finalize_theorem ln_hi;; +let yn_lo = Sections.finalize_theorem yn_lo;; +let yn_hi = Sections.finalize_theorem yn_hi;; +let rho_lo = Sections.finalize_theorem rho_lo;; +let rho_hi = Sections.finalize_theorem rho_hi;; +let edge_sym = Sections.finalize_theorem edge_sym;; +let y1_def = Sections.finalize_theorem y1_def;; +let y2_def = Sections.finalize_theorem y2_def;; +let y3_def = Sections.finalize_theorem y3_def;; +let y4_def = Sections.finalize_theorem y4_def;; +let y5_def = Sections.finalize_theorem y5_def;; +let y6_def = Sections.finalize_theorem y6_def;; +let y8_def = Sections.finalize_theorem y8_def;; +let y9_def = Sections.finalize_theorem y9_def;; +let azim_lo = Sections.finalize_theorem azim_lo;; +let azim_hi = Sections.finalize_theorem azim_hi;; +let rhazim_lo = Sections.finalize_theorem rhazim_lo;; +let rhazim_hi = Sections.finalize_theorem rhazim_hi;; +let ye_lo = Sections.finalize_theorem ye_lo;; +let y1_lo = Sections.finalize_theorem y1_lo;; +let y2_lo = Sections.finalize_theorem y2_lo;; +let y1_hi = Sections.finalize_theorem y1_hi;; +let y2_hi = Sections.finalize_theorem y2_hi;; +let y6_lo = Sections.finalize_theorem y6_lo;; +let y4'_eq_y4 = Sections.finalize_theorem y4'_eq_y4;; +let ye_hi_std = Sections.finalize_theorem ye_hi_std;; +let y4_hi_std = Sections.finalize_theorem y4_hi_std;; +let y5_hi_std = Sections.finalize_theorem y5_hi_std;; +let y6_hi_std = Sections.finalize_theorem y6_hi_std;; +let y8_hi_std = Sections.finalize_theorem y8_hi_std;; +let y9_hi_std = Sections.finalize_theorem y9_hi_std;; +let ye_hi_std2 = Sections.finalize_theorem ye_hi_std2;; +let y4_hi_std2 = Sections.finalize_theorem y4_hi_std2;; +let y5_hi_std2 = Sections.finalize_theorem y5_hi_std2;; +let y6_hi_std2 = Sections.finalize_theorem y6_hi_std2;; +let yy10_std = Sections.finalize_theorem yy10_std;; +let azim2_lo = Sections.finalize_theorem azim2_lo;; +let azim2_hi = Sections.finalize_theorem azim2_hi;; +let azim3_lo = Sections.finalize_theorem azim3_lo;; +let azim3_hi = Sections.finalize_theorem azim3_hi;; +let rhazim2_lo = Sections.finalize_theorem rhazim2_lo;; +let rhazim2_hi = Sections.finalize_theorem rhazim2_hi;; +let rhazim3_lo = Sections.finalize_theorem rhazim3_lo;; +let rhazim3_hi = Sections.finalize_theorem rhazim3_hi;; +let y3_lo = Sections.finalize_theorem y3_lo;; +let y3_hi = Sections.finalize_theorem y3_hi;; +let y4_lo = Sections.finalize_theorem y4_lo;; +let y5_lo = Sections.finalize_theorem y5_lo;; +let y7_lo = Sections.finalize_theorem y7_lo;; +let y7_hi = Sections.finalize_theorem y7_hi;; +let y8_lo = Sections.finalize_theorem y8_lo;; +let y9_lo = Sections.finalize_theorem y9_lo;; +let y4'_lo = Sections.finalize_theorem y4'_lo;; +let azim2c = Sections.finalize_theorem azim2c;; +let azim3c = Sections.finalize_theorem azim3c;; +let rhazim2c = Sections.finalize_theorem rhazim2c;; +let rhazim3c = Sections.finalize_theorem rhazim3c;; +let RHA = Sections.finalize_theorem RHA;; +let RHB = Sections.finalize_theorem RHB;; +let RHBLO = Sections.finalize_theorem RHBLO;; +let RHBHI = Sections.finalize_theorem RHBHI;; +let azim_sum = Sections.finalize_theorem azim_sum;; +let rhazim_sum = Sections.finalize_theorem rhazim_sum;; +let sol_lo = Sections.finalize_theorem sol_lo;; +let tau_lo = Sections.finalize_theorem tau_lo;; +let sol_hi = Sections.finalize_theorem sol_hi;; +let sol_sum = Sections.finalize_theorem sol_sum;; +let sol_sum3 = Sections.finalize_theorem sol_sum3;; +let sol_sum4 = Sections.finalize_theorem sol_sum4;; +let sol_sum5 = Sections.finalize_theorem sol_sum5;; +let sol_sum6 = Sections.finalize_theorem sol_sum6;; +let tau_sum = Sections.finalize_theorem tau_sum;; +let tau_sum3 = Sections.finalize_theorem tau_sum3;; +let tau_sum4 = Sections.finalize_theorem tau_sum4;; +let tau_sum5 = Sections.finalize_theorem tau_sum5;; +let tau_sum6 = Sections.finalize_theorem tau_sum6;; +let tauVEF_hi = Sections.finalize_theorem tauVEF_hi;; +let tau_hi = Sections.finalize_theorem tau_hi;; +let ln_fan_ly = Sections.finalize_theorem ln_fan_ly;; +let rho_fan_eq_rho = Sections.finalize_theorem rho_fan_eq_rho;; +let ys_eq = Sections.finalize_theorem ys_eq;; +let inverse_f_fan_pair_ext_power2 = Sections.finalize_theorem inverse_f_fan_pair_ext_power2;; +let y78_eq = Sections.finalize_theorem y78_eq;; +let y9_eq = Sections.finalize_theorem y9_eq;; +let ys_eq_alt = Sections.finalize_theorem ys_eq_alt;; +let azim_fan_eq_dih_y = Sections.finalize_theorem azim_fan_eq_dih_y;; +let rhazim_fan_eq_rhazim = Sections.finalize_theorem rhazim_fan_eq_rhazim;; +let delta_y_not_neg = Sections.finalize_theorem delta_y_not_neg;; +let dart3_yf_eq = Sections.finalize_theorem dart3_yf_eq;; +let dart3_y_invf_eq = Sections.finalize_theorem dart3_y_invf_eq;; +let dart3_azim_fan_eq_dih_y = Sections.finalize_theorem dart3_azim_fan_eq_dih_y;; +let dart3_rhazim_fan_eq_rhazim = Sections.finalize_theorem dart3_rhazim_fan_eq_rhazim;; +let dart3_sol_fan_eq_sol = Sections.finalize_theorem dart3_sol_fan_eq_sol;; +let dart3_azim2_fan_eq_dih2_y = Sections.finalize_theorem dart3_azim2_fan_eq_dih2_y;; +let dart3_azim3_fan_eq_dih3_y = Sections.finalize_theorem dart3_azim3_fan_eq_dih3_y;; +let dart3_rhazim2_fan_eq_rhazim2 = Sections.finalize_theorem dart3_rhazim2_fan_eq_rhazim2;; +let dart3_rhazim3_fan_eq_rhazim3 = Sections.finalize_theorem dart3_rhazim3_fan_eq_rhazim3;; +let dart4_f_fan_pair_ext_power2 = Sections.finalize_theorem dart4_f_fan_pair_ext_power2;; +let dart4_yf_eq = Sections.finalize_theorem dart4_yf_eq;; +let dart4_y_invf_eq = Sections.finalize_theorem dart4_y_invf_eq;; +let dart4_cross_eq_y4' = Sections.finalize_theorem dart4_cross_eq_y4';; +let dart4_cross_eq_enclosed = Sections.finalize_theorem dart4_cross_eq_enclosed;; +let dart3_tauVEF_eq_taum = Sections.finalize_theorem dart3_tauVEF_eq_taum;; +let dart4_tauVEF_eq_tauq = Sections.finalize_theorem dart4_tauVEF_eq_tauq;; +let dart3_tau_fan_eq_taum = Sections.finalize_theorem dart3_tau_fan_eq_taum;; +let dart4_tau_fan_eq_tauq = Sections.finalize_theorem dart4_tau_fan_eq_tauq;; +Sections.end_section "Fan";; + +(* Section Sym *) +Sections.begin_section "Sym";; +(Sections.add_section_var (mk_var ("y1", (`:real`))); Sections.add_section_var (mk_var ("y2", (`:real`))); Sections.add_section_var (mk_var ("y3", (`:real`))); Sections.add_section_var (mk_var ("y4", (`:real`))); Sections.add_section_var (mk_var ("y5", (`:real`))); Sections.add_section_var (mk_var ("y6", (`:real`))));; + +(* Lemma sol_y_sym_reflect *) +let sol_y_sym_reflect = Sections.section_proof [] +`sol_y y1 y2 y3 y4 y5 y6 = sol_y y1 y3 y2 y4 y6 y5` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("sol_y", [sol_y]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("Nonlinear_lemma.dih_y_sym", [Nonlinear_lemma.dih_y_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_EQ_ADD_LCANCEL", [REAL_EQ_ADD_LCANCEL]))(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_EQ_ADD_RCANCEL", [REAL_EQ_ADD_RCANCEL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_SYM", [REAL_ADD_SYM]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("Nonlinear_lemma.dih_y_sym", [Nonlinear_lemma.dih_y_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_EQ_ADD_LCANCEL", [REAL_EQ_ADD_LCANCEL]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("Nonlinear_lemma.dih_y_sym", [Nonlinear_lemma.dih_y_sym]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma taum_sym_reflect *) +let taum_sym_reflect = Sections.section_proof [] +`taum y1 y2 y3 y4 y5 y6 = taum y1 y3 y2 y4 y6 y5` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("taum", [taum]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("sol_y_sym_reflect", [sol_y_sym_reflect]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_EQ_ADD_LCANCEL", [REAL_EQ_ADD_LCANCEL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("lnazim", [lnazim]))(thm_tac (new_rewrite [] [])))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_LNEG", [REAL_MUL_LNEG]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("REAL_EQ_MUL_LCANCEL", [REAL_EQ_MUL_LCANCEL]))(thm_tac (new_rewrite [] []))))) THEN (DISJ2_TAC)); + ((((use_arg_then2 ("Nonlinear_lemma.dih_y_sym", [Nonlinear_lemma.dih_y_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_EQ_ADD_LCANCEL", [REAL_EQ_ADD_LCANCEL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_SYM", [REAL_ADD_SYM]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("Nonlinear_lemma.dih_y_sym", [Nonlinear_lemma.dih_y_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_EQ_ADD_LCANCEL", [REAL_EQ_ADD_LCANCEL]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("Nonlinear_lemma.dih_y_sym", [Nonlinear_lemma.dih_y_sym]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section Sym *) +let sol_y_sym_reflect = Sections.finalize_theorem sol_y_sym_reflect;; +let taum_sym_reflect = Sections.finalize_theorem taum_sym_reflect;; +Sections.end_section "Sym";; + +(* Section NonlinearSplit *) +Sections.begin_section "NonlinearSplit";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_hyp "fanV" (`FAN (vec 0,V,E)`));; +(Sections.add_section_hyp "f_surr" (`fully_surrounded (V,E)`));; +(Sections.add_section_hyp "packV" (`packing V`));; +(Sections.add_section_hyp "subV" (`V SUBSET ball_annulus`));; + +(* Let dart1_eq *) +Sections.add_section_lemma "dart1_eq" (Sections.section_proof [] +`dart1_of_fan (V,E) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let dartH *) +Sections.add_section_lemma "dartH" (Sections.section_proof [] +`dart (hypermap_of_fan (V,E)) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let fH *) +Sections.add_section_lemma "fH" (Sections.section_proof [] +`face_map (hypermap_of_fan (V,E)) = f_fan_pair_ext (V,E)` +[ + ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let nH *) +Sections.add_section_lemma "nH" (Sections.section_proof [] +`node_map (hypermap_of_fan (V,E)) = n_fan_pair_ext (V,E)` +[ + ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Section Dart *) +Sections.begin_section "Dart";; +(Sections.add_section_var (mk_var ("d", (`:real^3#real^3`))));; +(Sections.add_section_hyp "d_in" (`d IN dart_of_fan (V,E)`));; + +(* Let split_eq *) +Sections.add_section_lemma "split_eq" (Sections.section_proof [] +`split_fan_face (V,E) d = V, add_diag (V,E) d` +[ + (((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"])); + (((((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add_diag", [add_diag]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; + +(* Lemma add_diag_sigma_eq *) +let add_diag_sigma_eq = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + /\ ~(v = SND d) /\ ~(v = sigma_fan (vec 0) V E (FST d) (SND d)) + ==> sigma_fan (vec 0) V (add_diag (V,E) d) v w = sigma_fan (vec 0) V E v w` +[ + (((use_arg_then2 ("split_eq", [])) (disch_tac [])) THEN (clear_assumption "split_eq") THEN ((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["a"]) THEN (move ["b"]) THEN (move ["ab_in"]) THEN (move ["split_eq"]) THEN (simp_tac) THEN (case THEN ((move ["vw_in"]) THEN (move ["neq"])))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("n_split_fan_face_eq1", [n_split_fan_face_eq1])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ab_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`v,w`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)); + (((((fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("ab_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("neq", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("split_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("n_fan_pair", [n_fan_pair]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma inverse_f_ext_d_split_eq *) +let inverse_f_ext_d_split_eq = Sections.section_proof [] +`inverse (f_fan_pair_ext (V,add_diag (V,E) d)) d + = inverse (f_fan_pair_ext (V,E)) d` +[ + (((use_arg_then2 ("add_diag_sigma_eq", [add_diag_sigma_eq])) (disch_tac [])) THEN (clear_assumption "add_diag_sigma_eq") THEN ((use_arg_then2 ("split_eq", [])) (disch_tac [])) THEN (clear_assumption "split_eq") THEN ((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (simp_tac) THEN (move ["vw_in"]) THEN (move ["split_eq"]) THEN (move ["sigma_eq"])); + ((((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["vw_in1"]))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["fan2"]) THEN (case THEN (move ["dart2_eq"])) THEN (move ["f_surr2"]))))); + (in_tac ["fan2"; "f_surr2"; "dart2_eq"] false (((use_arg_then2 ("split_eq", []))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSE_EQ", [PERMUTES_INVERSE_EQ])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))); + ((((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["vw'_in1"]))); + ((((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart_switch", [dart_switch]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("dart2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw'_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("sigma_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ", [PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("f_fan_pair_last", [f_fan_pair_last])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("dart2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ys_split_eq *) +let ys_split_eq = Sections.section_proof [] +`y3_fan (V,add_diag (V,E) d) d = y3_fan (V,E) d + /\ y4'_fan (V,add_diag (V,E) d) d = y4'_fan (V,E) d + /\ y5_fan (V,add_diag (V,E) d) d = y5_fan (V,E) d` +[ + (((repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("y3_fan", [y3_fan]))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("y4'_fan", [y4'_fan]))(fun tmp_arg1 -> (use_arg_then2 ("y5_fan", [y5_fan]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inverse_f_ext_d_split_eq", [inverse_f_ext_d_split_eq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ys_split_eq2 *) +let ys_split_eq2 = Sections.section_proof ["v";"w"] +`let f = face (hypermap_of_fan (V,E)) (v,w) in + let w' = sigma_fan (vec 0) V E v w in + v,w IN dart_of_fan (V,E) /\ 3 < CARD f + ==> y1_fan (w',w) = y3_fan (V,E) (v,w) + /\ y2_fan (w',w) = y2_fan (v,w) + /\ y3_fan (V, add_diag (V,E) (v,w)) (w',w) = y7_fan (V,E) (v,w) + /\ y5_fan (V, add_diag (V,E) (v,w)) (w',w) = y8_fan (V,E) (v,w) + /\ y6_fan (w',w) = y4'_fan (V,E) (v,w) + /\ y9_fan (V, add_diag (V,E) (v,w)) (w',w) = y9_fan (V,E) (v,w)` +[ + (repeat_tactic 1 9 ((CONV_TAC let_CONV))); + (BETA_TAC THEN (case THEN ((move ["vw_in"]) THEN (move ["card_f"])))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("ys_eq", [ys_eq])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y1_fan", [y1_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y2_fan", [y2_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y6_fan", [y6_fan]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("y3_fan", [y3_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE inverse_f_fan_pair_ext_add_diag)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("y7_fan", [y7_fan]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("y8_fan", [y8_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("y9_fan", [y9_fan]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_fan_pair_ext_power_add_diag)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("fanV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_surr", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_f", [])) (disch_tac [])) THEN (clear_assumption "card_f") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section Dart *) +let add_diag_sigma_eq = Sections.finalize_theorem add_diag_sigma_eq;; +let inverse_f_ext_d_split_eq = Sections.finalize_theorem inverse_f_ext_d_split_eq;; +let ys_split_eq = Sections.finalize_theorem ys_split_eq;; +let ys_split_eq2 = Sections.finalize_theorem ys_split_eq2;; +Sections.end_section "Dart";; + +(* Section Split4 *) +Sections.begin_section "Split4";; +(Sections.add_section_var (mk_var ("d", (`:real^3#real^3`))));; +(Sections.add_section_hyp "d_in" (`d IN darts_k 4 (hypermap_of_fan (V,E))`));; + +(* Let card_f *) +Sections.add_section_lemma "card_f" (Sections.section_proof [] +`CARD (face (hypermap_of_fan (V,E)) d) = 4` +[ + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; + +(* Let d_in_dart *) +Sections.add_section_lemma "d_in_dart" (Sections.section_proof [] +`d IN dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; + +(* Lemma dart4_azim2_eq_sum *) +let dart4_azim2_eq_sum = Sections.section_proof [] +`azim2_fan (V,E) d + = dih_y (y2_fan d) (y3_fan (V,E) d) (y1_fan d) + (y5_fan (V,E) d) (y6_fan d) (y4'_fan (V,E) d) + + dih_y (y2_fan d) (y7_fan (V,E) d) (y3_fan (V,E) d) + (y8_fan (V,E) d) (y4'_fan (V,E) d) (y9_fan (V,E) d)` +[ + (((use_arg_then2 ("card_f", [])) (disch_tac [])) THEN (clear_assumption "card_f") THEN ((use_arg_then2 ("d_in_dart", [])) (disch_tac [])) THEN (clear_assumption "d_in_dart") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"]) THEN (move ["card_f"])); + ((((use_arg_then2 ("azim2_fan", [azim2_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`3 < CARD (face (hypermap_of_fan (V,E)) (v,w))`))) (term_tac (have_gen_tac [](move ["card_gt3"])))); + ((((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE azim_split_fan_face_add))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_gt3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> arg_tac (Arg_term (`split_fan_face (V,E) (v,w) = V, add_diag (V,E) (v,w)`))) (term_tac (have_gen_tac [](move ["split_eq"])))); + (((((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add_diag", [add_diag]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("split_eq", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fan2"])) THEN (case THEN (move ["dart2"])) THEN (move ["f_surr2"])); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`w,w' IN dart_of_fan (V,add_diag (V,E) (v,w))`))) (term_tac (have_gen_tac [](move ["ww'_in"])))); + (((((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (congr_tac (`_1 + _2:real`)); + ((((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("ys_eq", [ys_eq])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("ys_eq", [ys_eq])) (fun fst_arg -> (use_arg_then2 ("ww'_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V (add_diag (V,E) (v,w)) w w' = v`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE n_split_fan_face))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_gt3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"]))); + ((((((use_arg_then2 ("split_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_fan_pair", [n_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((case THEN (move ["_"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`f_fan_pair (V,E) (v,w)`))) (term_tac (set_tac "d2"))); + ((fun arg_tac -> arg_tac (Arg_term (`d2 IN dart_of_fan (V,add_diag (V,E) (v,w))`))) (term_tac (have_gen_tac [](move ["d2_in"])))); + ((((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("POWER_1", [POWER_1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f_fan_pair (V,E)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("f_fan_pair_power", [f_fan_pair_power]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq])) (fun fst_arg -> (use_arg_then2 ("f_surr2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["dart2_1"]))); + ((fun arg_tac -> arg_tac (Arg_term (`d2 = f_fan_pair_ext (V,add_diag (V,E) (v,w)) (w',w)`))) (term_tac (have_gen_tac [](move ["d2_eq"])))); + ((((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_split_fan_face))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("split_eq", []))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart2_1", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart_switch", [dart_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ww'_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`w', w IN dart_of_fan (V,add_diag (V,E) (v,w))`))) (term_tac (have_gen_tac [](move ["w'w_in"])))); + (((((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`w',w IN darts_k 3 (hypermap_of_fan (V,add_diag (V,E) (v,w)))`))) (term_tac (have_gen_tac [](move ["w'w_in3"])))); + ((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'w_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE face_split_fan_face_explicit))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_gt3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("split_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H2")))); + (((((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`d2 IN darts_k 3 (hypermap_of_fan (V,add_diag (V,E) (v,w)))`))) (term_tac (have_gen_tac [](move ["d2_in3"])))); + (((((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair_ext_in_darts_k", [f_fan_pair_ext_in_darts_k]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("y4'_eq_y4", [y4'_eq_y4]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("dart3_yf_eq", [dart3_yf_eq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4'_eq_y4", [y4'_eq_y4]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("ys_eq", [ys_eq])) (fun fst_arg -> (use_arg_then2 ("w'w_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("ys_eq", [ys_eq])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE y78_eq))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE y9_eq)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E w' v`))) (term_tac (set_tac "u"))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V (add_diag (V,E) (v,w)) w' w = u`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE n_split_fan_face))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_gt3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["eq"])) THEN (move ["_"])); + ((((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN (((((use_arg_then2 ("split_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("n_fan_pair", [n_fan_pair]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("u_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"]))) THEN (done_tac)); +];; + +(* Lemma tauq_cross_split *) +let tauq_cross_split = Sections.section_proof [] +`tauq (y1_fan d) (y2_fan d) (y3_fan (V,E) d) (y4'_fan (V,E) d) + (y5_fan (V,E) d) (y6_fan d) (y7_fan (V,E) d) (y8_fan (V,E) d) (y9_fan (V,E) d) + = taum (y1_fan d) (y3_fan (V,E) d) (y7_fan (V,E) d) + (y8_fan (V,E) d) (y4'_fan (V,E) (f_fan_pair_ext (V,E) d)) (y5_fan (V,E) d) + + taum (y1_fan d) (y2_fan d) (y7_fan (V,E) d) + (y9_fan (V,E) d) (y4'_fan (V,E) (f_fan_pair_ext (V,E) d)) (y6_fan d)` +[ + ((((use_arg_then2 ("dart4_tauVEF_eq_tauq", [dart4_tauVEF_eq_tauq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((fun arg_tac -> (use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f_fan_pair_ext (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("fH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("face", [face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("lemma_orbit_power", [lemma_orbit_power])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dart_of_fan (V,E)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("orbit_reflect", [orbit_reflect]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("face_map_and_darts", [face_map_and_darts]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("dart4_tauVEF_eq_tauq", [dart4_tauVEF_eq_tauq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_fan_pair_ext_in_darts_k", [f_fan_pair_ext_in_darts_k]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("dart4_yf_eq", [dart4_yf_eq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("tauq", [tauq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_SYM", [REAL_ADD_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("taum_sym", [taum_sym]))(thm_tac (new_rewrite [] []))))) THEN (congr_tac (`_1 + _2:real`))); + ((((use_arg_then2 ("taum_sym_reflect", [taum_sym_reflect]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((use_arg_then2 ("taum_sym", [taum_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("taum_sym_reflect", [taum_sym_reflect]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Split4 *) +let dart4_azim2_eq_sum = Sections.finalize_theorem dart4_azim2_eq_sum;; +let tauq_cross_split = Sections.finalize_theorem tauq_cross_split;; +Sections.end_section "Split4";; + +(* Section MoreSplit4 *) +Sections.begin_section "MoreSplit4";; +(Sections.add_section_var (mk_var ("d", (`:real^3#real^3`))));; +(Sections.add_section_hyp "d_in" (`d IN darts_k 4 (hypermap_of_fan (V,E))`));; + +(* Lemma dart4_azim_cross_split *) +let dart4_azim_cross_split = Sections.section_proof [] +`azim_dart (V,E) d + = dih_y (y1_fan d) (y3_fan (V,E) d) (y7_fan (V,E) d) + (y8_fan (V,E) d) (y4'_fan (V,E) (f_fan_pair_ext (V,E) d)) (y5_fan (V,E) d) + + dih_y (y1_fan d) (y2_fan d) (y7_fan (V,E) d) + (y9_fan (V,E) d) (y4'_fan (V,E) (f_fan_pair_ext (V,E) d)) (y6_fan d)` +[ + ((fun arg_tac -> arg_tac (Arg_term (`azim_dart (V,E) d = azim2_fan (V,E) (inverse (f_fan_pair_ext (V,E)) d)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("azim2_fan", [azim2_fan]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES", [PERMUTES_INVERSES])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("dart4_azim2_eq_sum", [dart4_azim2_eq_sum]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_fan_pair_ext_in_darts_k", [f_fan_pair_ext_in_darts_k]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("dart4_y_invf_eq", [dart4_y_invf_eq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart4_cross_eq_y4'", [dart4_cross_eq_y4']))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("Nonlinear_lemma.dih_y_sym", [Nonlinear_lemma.dih_y_sym]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section MoreSplit4 *) +let dart4_azim_cross_split = Sections.finalize_theorem dart4_azim_cross_split;; +Sections.end_section "MoreSplit4";; + +(* Finalization of the section NonlinearSplit *) +let add_diag_sigma_eq = Sections.finalize_theorem add_diag_sigma_eq;; +let inverse_f_ext_d_split_eq = Sections.finalize_theorem inverse_f_ext_d_split_eq;; +let ys_split_eq = Sections.finalize_theorem ys_split_eq;; +let ys_split_eq2 = Sections.finalize_theorem ys_split_eq2;; +let dart4_azim2_eq_sum = Sections.finalize_theorem dart4_azim2_eq_sum;; +let tauq_cross_split = Sections.finalize_theorem tauq_cross_split;; +let dart4_azim_cross_split = Sections.finalize_theorem dart4_azim_cross_split;; +Sections.end_section "NonlinearSplit";; + +(* Section QuadIneqs *) +Sections.begin_section "QuadIneqs";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_hyp "h_fan" (`lp_fan (V,E)`));; + +(* Lemma y4'_lo_2h0 *) +let y4'_lo_2h0 = Sections.section_proof ["k";"d"] +`3 < k /\ d IN darts_k k (hypermap_of_fan (V,E)) + ==> #2.52 <= y4'_fan (V,E) d` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag_dist"])) THEN (move ["_"]))); + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"])); + (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["k_gt"])) THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"])); + ((((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["vw_in1"]))); + ((((use_arg_then2 ("y4'_fan", [y4'_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("diag_dist", []))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sigma_fan_inV", [sigma_fan_inV]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sigma_fan_not_fixed", [sigma_fan_not_fixed]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))); + ((((use_arg_then2 ("fully_surrounded_diag_not_in_dart", [fully_surrounded_diag_not_in_dart]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma dart4_y4'_lo *) +let dart4_y4'_lo = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> #2.52 <= y4'_fan (V,E) d` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("y4'_lo_2h0", [y4'_lo_2h0])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (DISCH_THEN apply_tac)) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma y4'_hi *) +let y4'_hi = Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) + ==> y4'_fan (V,E) d <= &4 * h0` +[ + (in_tac ["h_fan"] false ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))))); + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"])); + ((((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["vw_in1"]))); + ((((use_arg_then2 ("y4'_fan", [y4'_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + (((use_arg_then2 ("DIST_TRIANGLE_LE", [DIST_TRIANGLE_LE])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (term_tac exists_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DIST_0", [DIST_0]))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&4 * h0 = &2 * h0 + &2 * h0`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("REAL_LE_ADD2", [REAL_LE_ADD2]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("iffLR", [iffLR])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("Fnjlbxs.in_ball_annulus", [Fnjlbxs.in_ball_annulus])) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("iffLR", [iffLR])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("Fnjlbxs.in_ball_annulus", [Fnjlbxs.in_ball_annulus])) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("h_fan", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("h_fan", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sigma_fan_inV", [sigma_fan_inV]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Y4_hi_bound *) +Sections.begin_section "Y4_hi_bound";; +(Sections.add_section_hyp "ineq" ((hd (Ineq.getexact "3287695934")).ineq));; + +(* Lemma dart4_y4'_hi *) +let dart4_y4'_hi = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + ==> y4'_fan (V,E) d <= #4.37` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (move ["h_fan2"]))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["fH"]))))); + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in4"])); + ((((use_arg_then2 ("vw_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"]) THEN (move ["bounds"]))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_LE_TOTAL", [REAL_LE_TOTAL])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y4'_fan (V,E) (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`#4.37`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN ((TRY done_tac)) THEN (move ["y4_bound"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq", [ineq])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y4'_fan (V,E) (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y9_fan (V,E) (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y4'_fan (V,E) (f_fan_pair_ext (V,E) (v,w))`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y8_fan (V,E) (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ALL", [ALL]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (ANTS_TAC)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&2 * h0 = #2.52`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#2.0 = &2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("y4_bound", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y4'_hi", [y4'_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y9_lo", [y9_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y5_lo", [y5_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y8_lo", [y8_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("dart4_y4'_lo", [dart4_y4'_lo]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_fan_pair_ext_in_darts_k", [f_fan_pair_ext_in_darts_k]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y4'_hi", [y4'_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("ys_eq", [ys_eq])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE y78_eq))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE y9_eq))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E w' v`))) (term_tac (set_tac "u"))); + ((((use_arg_then2 ("dart4_cross_eq_y4'", [dart4_cross_eq_y4']))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("y4'_fan", [y4'_fan]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`inverse _`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [(`FST _`)]))))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE inverse_f_fan_pair_ext_power2)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("u_def", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("delta_y", [delta_y]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("DELTA_EQ_DELTA_X", [DELTA_EQ_DELTA_X]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Collect_geom.DELTA_POS_4POINTS", [Collect_geom.DELTA_POS_4POINTS])) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("u", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((arith_tac) THEN (done_tac)); +];; + +(* Section Std *) +Sections.begin_section "Std";; +(Sections.add_section_hyp "std" (`E = ESTD V`));; + +(* Lemma dart4_y4'_hi_std *) +let dart4_y4'_hi_std = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> y4'_fan (V,E) d <= #4.37` +[ + ((BETA_TAC THEN (move ["d_in4"])) THEN (((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["d_in"]) THEN (move ["_"]))))); + (((fun arg_tac -> (use_arg_then2 ("dart4_y4'_hi", [dart4_y4'_hi])) (fun fst_arg -> (use_arg_then2 ("d_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((in_tac ["h_fan"] false (((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] []))))) THEN (in_tac ["d_in"] false ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))))); + (((((use_arg_then2 ("y5_hi_std2", [y5_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("std", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y8_hi_std", [y8_hi_std]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_hi_std", [y9_hi_std]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Std *) +let dart4_y4'_hi_std = Sections.finalize_theorem dart4_y4'_hi_std;; +Sections.end_section "Std";; + +(* Finalization of the section Y4_hi_bound *) +let dart4_y4'_hi = Sections.finalize_theorem dart4_y4'_hi;; +let dart4_y4'_hi_std = Sections.finalize_theorem dart4_y4'_hi_std;; +Sections.end_section "Y4_hi_bound";; + +(* Lemma dart4_delta_y_not_neg2 *) +let dart4_delta_y_not_neg2 = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> ~(delta_y (y7_fan (V,E) d) (y2_fan d) (y3_fan (V,E) d) + (y4'_fan (V,E) d) (y8_fan (V,E) d) (y9_fan (V,E) d) < &0)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["_"])) THEN (case THEN ((move ["subV"]) THEN (move ["packV"]))) THEN (move ["d_in4"]))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["fH"]))))); + ((((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["d_in"]) THEN (move ["_"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`f_fan_pair_ext (V,E)`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`f (f d) IN dart_of_fan (V,E) /\ f d IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](case THEN ((move ["ffd_in"]) THEN (move ["fd_in"])))))); + ((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_dart_invariant_power_face", [lemma_dart_invariant_power_face]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`f d IN darts_k 4 (hypermap_of_fan (V,E))`))) (term_tac (have_gen_tac [](move ["fd_in4"])))); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair_ext_in_darts_k", [f_fan_pair_ext_in_darts_k]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("delta_y_not_neg", [delta_y_not_neg])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("packV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ffd_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [1; 3; 5; 7; 9; 11] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("dart4_yf_eq", [dart4_yf_eq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart4_cross_eq_y4'", [dart4_cross_eq_y4']))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES", [PERMUTES_INVERSES])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("dart4_yf_eq", [dart4_yf_eq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((fun arg_tac -> arg_tac (Arg_theorem ((GEN_ALL o CONJUNCT2 o SPEC_ALL) Merge_ineq.delta_y_sym)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Section Ineq119 *) +Sections.begin_section "Ineq119";; +(Sections.add_section_hyp "h_main" ((hd (Ineq.getexact "3862621143 revised")).ineq));; +(Sections.add_section_hyp "h_reduced" ((hd (Ineq.getexact "3862621143 side")).ineq));; +(Sections.add_section_hyp "h_front" ((hd (Ineq.getexact "3862621143 front")).ineq));; +(Sections.add_section_hyp "h_back" ((hd (Ineq.getexact "3862621143 back")).ineq));; +(Sections.add_section_hyp "h_back2" ((hd (Ineq.getexact "6988401556")).ineq));; +(Sections.add_section_hyp "h_y4" ((hd (Ineq.getexact "3287695934")).ineq));; + +(* Lemma ineq119_tauVEF *) +let ineq119_tauVEF = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) ==> + y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + ==> tauVEF (V,E,face (hypermap_of_fan (V,E)) d) - #0.453 * azim_dart (V,E) d + #0.777 >= &0` +[ + ((BETA_TAC THEN (move ["d_in4"]) THEN (move ["bounds"])) THEN (((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (move ["h_fan2"]))); + ((fun arg_tac -> arg_tac (Arg_term (`d IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["d_in"])))); + ((((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN (clear_assumption "d_in4") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("dart4_tauVEF_eq_tauq", [dart4_tauVEF_eq_tauq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("real_ge", [real_ge]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`#2.0 = &2 /\ &2 * h0 = #2.52 /\ #0.0 = &0 /\ tame_table_d 2 1 = #0.103`))) (term_tac (have_gen_tac [](move ["eqs"])))); + (((((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("tame_table_d", [tame_table_d]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + (in_tac ["h_main"; "h_reduced"; "h_front"; "h_back"; "h_back2"] false ((((use_arg_then2 ("Ineq.dart_std4", [Ineq.dart_std4]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ineq.apex_flat", [Ineq.apex_flat]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] []))))))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("h_main", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y1_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y2_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y3_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y4'_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y7_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y8_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y9_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)); + ((repeat_tactic 1 9 (((use_arg_then2 ("ALL", [ALL]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y3_lo", [y3_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y5_lo", [y5_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y3_hi", [y3_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_hi", [y7_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y7_lo", [y7_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y8_lo", [y8_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y9_lo", [y9_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart4_y4'_lo", [dart4_y4'_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("dart4_y4'_hi", [dart4_y4'_hi])) (fun fst_arg -> (use_arg_then2 ("h_y4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((THENL_FIRST) case (((((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (done_tac))); + ((((use_arg_then2 ("delta_y_not_neg", [delta_y_not_neg]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart4_delta_y_not_neg2", [dart4_delta_y_not_neg2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("orFb", [orFb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbF", [orbF]))(thm_tac (new_rewrite [] []))))); + case; + (((((use_arg_then2 ("dart4_cross_eq_enclosed", [dart4_cross_eq_enclosed]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["cross_le"])); + ((((use_arg_then2 ("tauq_cross_split", [tauq_cross_split]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart4_azim_cross_split", [dart4_azim_cross_split]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`y4'_fan _1 _2`))) (term_tac (set_tac "c_diag"))); + ((fun arg_tac -> arg_tac (Arg_term (`taum _1 _2 _3 _4 _5 _6`))) (term_tac (set_tac "t1"))); + ((fun arg_tac -> arg_tac (Arg_term (`taum _1 _2 _3 _4 _5 _6`))) (term_tac (set_tac "t2"))); + ((fun arg_tac -> arg_tac (Arg_term (`dih_y _1 _2 _3 _4 _5 _6`))) (term_tac (set_tac "a1"))); + ((fun arg_tac -> arg_tac (Arg_term (`dih_y _1 _2 _3 _4 _5 _6`))) (term_tac (set_tac "a2"))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`&0 < t1 - #0.453 * a1 + #0.777 / &2 /\ &0 < t2 - #0.453 * a2 + #0.777 / &2`))) (term_tac (have_gen_tac []ALL_TAC)))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("t1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("t2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a2_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((split_tac) THEN (((use_arg_then2 ("h_reduced", [])) (disch_tac [])) THEN (clear_assumption "h_reduced") THEN (DISCH_THEN apply_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ALL", [ALL]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("cross_le", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y3_lo", [y3_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y5_lo", [y5_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_lo", [y7_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_hi", [y7_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y8_lo", [y8_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y3_hi", [y3_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("c_diag_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart4_y4'_lo", [dart4_y4'_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("f_fan_pair_ext_in_darts_k", [f_fan_pair_ext_in_darts_k]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_lo", [y7_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_hi", [y7_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_lo", [y9_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("c_diag_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart4_y4'_lo", [dart4_y4'_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("f_fan_pair_ext_in_darts_k", [f_fan_pair_ext_in_darts_k]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["diag_le"])); + (((use_arg_then2 ("h_y4", [])) (disch_tac [])) THEN (clear_assumption "h_y4") THEN ((use_arg_then2 ("h_main", [])) (disch_tac [])) THEN (clear_assumption "h_main") THEN ((use_arg_then2 ("h_reduced", [])) (disch_tac [])) THEN (clear_assumption "h_reduced") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"])); + ((((use_arg_then2 ("tauq", [tauq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`taum _1 _2 _3 _4 _5 _6`))) (term_tac (set_tac "t1"))); + ((fun arg_tac -> arg_tac (Arg_term (`taum _1 _2 _3 _4 _5 _6`))) (term_tac (set_tac "t2"))); + ((fun arg_tac -> arg_tac (Arg_term (`dih_y _1 _2 _3 _4 _5 _6`))) (term_tac (set_tac "a"))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`&0 < t1 + #0.103 - #0.453 * a + #0.777 /\ #0.103 < t2`))) (term_tac (have_gen_tac []ALL_TAC)))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("t1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("t2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (split_tac)); + ((((use_arg_then2 ("h_front", [])) (disch_tac [])) THEN (clear_assumption "h_front") THEN (DISCH_THEN apply_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ALL", [ALL]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("diag_le", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y3_hi", [y3_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart4_y4'_lo", [dart4_y4'_lo]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`y4'_fan (V,E) d <= sqrt8`))) (disch_eq_tac "y4'_ineq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((use_arg_then2 ("h_back2", [])) (disch_tac [])) THEN (clear_assumption "h_back2") THEN (DISCH_THEN apply_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ALL", [ALL]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y4'_ineq", []))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("y7_lo", [y7_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_hi", [y7_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y8_lo", [y8_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_lo", [y9_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart4_y4'_lo", [dart4_y4'_lo]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("y4'_ineq", [])) (disch_tac [])) THEN (clear_assumption "y4'_ineq") THEN BETA_TAC) THEN ((((use_arg_then2 ("REAL_NOT_LE", [REAL_NOT_LE]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["y4'_ineq"]))); + ((((use_arg_then2 ("h_back", [])) (disch_tac [])) THEN (clear_assumption "h_back") THEN (DISCH_THEN apply_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ALL", [ALL]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y4'_ineq", []))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("y7_lo", [y7_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_hi", [y7_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y8_lo", [y8_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_lo", [y9_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("diag_le", [])) (disch_tac [])) THEN (clear_assumption "diag_le") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; +(Sections.add_section_hyp "h_tau" (`lp_tau (V,E)`));; + +(* Section Inner *) +Sections.begin_section "Inner";; + +(* Lemma ineq119 *) +let ineq119 = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) ==> + y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + ==> tau_fan (V,E) (face (hypermap_of_fan (V,E)) d) - #0.453 * azim_dart (V,E) d + #0.777 >= &0` +[ + ((BETA_TAC THEN (move ["d_in4"]) THEN (move ["bounds"])) THEN (((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + (((((use_arg_then2 ("tau_fan_eq_tauVEF", [tau_fan_eq_tauVEF]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ineq119_tauVEF", [ineq119_tauVEF]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Std *) +Sections.begin_section "Std";; +(Sections.add_section_hyp "std" (`E = ESTD V`));; + +(* Lemma ineq119_std *) +let ineq119_std = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> tau_fan (V,E) (face (hypermap_of_fan (V,E)) d) - #0.453 * azim_dart (V,E) d + #0.777 >= &0` +[ + ((BETA_TAC THEN (move ["d_in4"])) THEN (((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["d_in"]) THEN (move ["_"]))))); + (((fun arg_tac -> (use_arg_then2 ("ineq119", [ineq119])) (fun fst_arg -> (use_arg_then2 ("d_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((in_tac ["h_fan"] false (((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] []))))) THEN (in_tac ["d_in"] false ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))))); + (((((use_arg_then2 ("y5_hi_std2", [y5_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("std", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y8_hi_std", [y8_hi_std]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_hi_std", [y9_hi_std]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Std *) +let ineq119_std = Sections.finalize_theorem ineq119_std;; +Sections.end_section "Std";; + +(* Finalization of the section Inner *) +let ineq119 = Sections.finalize_theorem ineq119;; +let ineq119_std = Sections.finalize_theorem ineq119_std;; +Sections.end_section "Inner";; + +(* Finalization of the section Ineq119 *) +let ineq119_tauVEF = Sections.finalize_theorem ineq119_tauVEF;; +let ineq119 = Sections.finalize_theorem ineq119;; +let ineq119_std = Sections.finalize_theorem ineq119_std;; +Sections.end_section "Ineq119";; + +(* Section Ineq120 *) +Sections.begin_section "Ineq120";; +(Sections.add_section_hyp "h_120" ((hd (Ineq.getexact "4240815464 a")).ineq));; +(Sections.add_section_hyp "h_120r" ((hd (Ineq.getexact "4240815464 a reduced")).ineq));; +(Sections.add_section_hyp "h_y4" ((hd (Ineq.getexact "3287695934")).ineq));; + +(* Lemma ineq120_tauVEF *) +let ineq120_tauVEF = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) ==> + y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + ==> tauVEF (V,E,face (hypermap_of_fan (V,E)) d) + #0.7573 * azim_dart (V,E) d - #1.433 >= &0` +[ + ((BETA_TAC THEN (move ["d_in4"]) THEN (move ["bounds"])) THEN (((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (move ["h_fan2"]))); + ((fun arg_tac -> arg_tac (Arg_term (`d IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["d_in"])))); + ((((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN (clear_assumption "d_in4") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("dart4_tauVEF_eq_tauq", [dart4_tauVEF_eq_tauq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("real_ge", [real_ge]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#2.0 = &2 /\ &2 * h0 = #2.52 /\ #0.0 = &0`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + (in_tac ["h_120"; "h_120r"] false ((((use_arg_then2 ("Ineq.dart_std4", [Ineq.dart_std4]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] []))))))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("h_120", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y1_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y2_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y3_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y4'_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y7_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y8_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y9_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)); + ((repeat_tactic 1 9 (((use_arg_then2 ("ALL", [ALL]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y3_lo", [y3_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y5_lo", [y5_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y3_hi", [y3_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_hi", [y7_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y7_lo", [y7_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y8_lo", [y8_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y9_lo", [y9_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart4_y4'_lo", [dart4_y4'_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("dart4_y4'_hi", [dart4_y4'_hi])) (fun fst_arg -> (use_arg_then2 ("h_y4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((THENL_FIRST) case (((((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (done_tac))); + ((((use_arg_then2 ("delta_y_not_neg", [delta_y_not_neg]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart4_delta_y_not_neg2", [dart4_delta_y_not_neg2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("orbF", [orbF]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("dart4_cross_eq_enclosed", [dart4_cross_eq_enclosed]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["cross_le"])); + ((((use_arg_then2 ("tauq_cross_split", [tauq_cross_split]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart4_azim_cross_split", [dart4_azim_cross_split]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`y4'_fan _1 _2`))) (term_tac (set_tac "c_diag"))); + ((fun arg_tac -> arg_tac (Arg_term (`taum _1 _2 _3 _4 _5 _6`))) (term_tac (set_tac "t1"))); + ((fun arg_tac -> arg_tac (Arg_term (`taum _1 _2 _3 _4 _5 _6`))) (term_tac (set_tac "t2"))); + ((fun arg_tac -> arg_tac (Arg_term (`dih_y _1 _2 _3 _4 _5 _6`))) (term_tac (set_tac "a1"))); + ((fun arg_tac -> arg_tac (Arg_term (`dih_y _1 _2 _3 _4 _5 _6`))) (term_tac (set_tac "a2"))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`&0 < t1 + #0.7573 * a1 - #1.433 / &2 /\ &0 < t2 + #0.7573 * a2 - #1.433 / &2`))) (term_tac (have_gen_tac []ALL_TAC)))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("t1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("t2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a2_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((split_tac) THEN (((use_arg_then2 ("h_120r", [])) (disch_tac [])) THEN (clear_assumption "h_120r") THEN (DISCH_THEN apply_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ALL", [ALL]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("cross_le", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y3_lo", [y3_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y5_lo", [y5_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_lo", [y7_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_hi", [y7_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y8_lo", [y8_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y3_hi", [y3_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("c_diag_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart4_y4'_lo", [dart4_y4'_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("f_fan_pair_ext_in_darts_k", [f_fan_pair_ext_in_darts_k]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_lo", [y7_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_hi", [y7_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_lo", [y9_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("c_diag_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart4_y4'_lo", [dart4_y4'_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("f_fan_pair_ext_in_darts_k", [f_fan_pair_ext_in_darts_k]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; +(Sections.add_section_hyp "h_tau" (`lp_tau (V,E)`));; + +(* Section Inner *) +Sections.begin_section "Inner";; + +(* Lemma ineq120 *) +let ineq120 = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) ==> + y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + ==> tau_fan (V,E) (face (hypermap_of_fan (V,E)) d) + #0.7573 * azim_dart (V,E) d - #1.433 >= &0` +[ + ((BETA_TAC THEN (move ["d_in4"]) THEN (move ["bounds"])) THEN (((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + (((((use_arg_then2 ("tau_fan_eq_tauVEF", [tau_fan_eq_tauVEF]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ineq120_tauVEF", [ineq120_tauVEF]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Std *) +Sections.begin_section "Std";; +(Sections.add_section_hyp "std" (`E = ESTD V`));; + +(* Lemma ineq120_std *) +let ineq120_std = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> tau_fan (V,E) (face (hypermap_of_fan (V,E)) d) + #0.7573 * azim_dart (V,E) d - #1.433 >= &0` +[ + ((BETA_TAC THEN (move ["d_in4"])) THEN (((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["d_in"]) THEN (move ["_"]))))); + (((fun arg_tac -> (use_arg_then2 ("ineq120", [ineq120])) (fun fst_arg -> (use_arg_then2 ("d_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((in_tac ["h_fan"] false (((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] []))))) THEN (in_tac ["d_in"] false ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))))); + (((((use_arg_then2 ("y5_hi_std2", [y5_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("std", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y8_hi_std", [y8_hi_std]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_hi_std", [y9_hi_std]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Std *) +let ineq120_std = Sections.finalize_theorem ineq120_std;; +Sections.end_section "Std";; + +(* Finalization of the section Inner *) +let ineq120 = Sections.finalize_theorem ineq120;; +let ineq120_std = Sections.finalize_theorem ineq120_std;; +Sections.end_section "Inner";; + +(* Finalization of the section Ineq120 *) +let ineq120_tauVEF = Sections.finalize_theorem ineq120_tauVEF;; +let ineq120 = Sections.finalize_theorem ineq120;; +let ineq120_std = Sections.finalize_theorem ineq120_std;; +Sections.end_section "Ineq120";; + +(* Section Ineq121 *) +Sections.begin_section "Ineq121";; +(Sections.add_section_hyp "h_121" ((hd (Ineq.getexact "6944699408 a")).ineq));; +(Sections.add_section_hyp "h_121r" ((hd (Ineq.getexact "6944699408 a reduced")).ineq));; +(Sections.add_section_hyp "h_y4" ((hd (Ineq.getexact "3287695934")).ineq));; + +(* Lemma ineq121_tauVEF *) +let ineq121_tauVEF = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) ==> + y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + ==> tauVEF (V,E,face (hypermap_of_fan (V,E)) d) + #0.972 * azim_dart (V,E) d - #1.707 >= &0` +[ + ((BETA_TAC THEN (move ["d_in4"]) THEN (move ["bounds"])) THEN (((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (move ["h_fan2"]))); + ((fun arg_tac -> arg_tac (Arg_term (`d IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["d_in"])))); + ((((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN (clear_assumption "d_in4") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("dart4_tauVEF_eq_tauq", [dart4_tauVEF_eq_tauq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("real_ge", [real_ge]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#2.0 = &2 /\ &2 * h0 = #2.52 /\ #0.0 = &0`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + (in_tac ["h_121"; "h_121r"] false ((((use_arg_then2 ("Ineq.dart_std4", [Ineq.dart_std4]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] []))))))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("h_121", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y1_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y2_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y3_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y4'_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y7_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y8_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y9_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)); + ((repeat_tactic 1 9 (((use_arg_then2 ("ALL", [ALL]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y3_lo", [y3_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y5_lo", [y5_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y3_hi", [y3_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_hi", [y7_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y7_lo", [y7_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y8_lo", [y8_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y9_lo", [y9_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart4_y4'_lo", [dart4_y4'_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("dart4_y4'_hi", [dart4_y4'_hi])) (fun fst_arg -> (use_arg_then2 ("h_y4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((THENL_FIRST) case (((((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (done_tac))); + (((((use_arg_then2 ("dart4_cross_eq_enclosed", [dart4_cross_eq_enclosed]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["cross_le"])); + ((((use_arg_then2 ("tauq_cross_split", [tauq_cross_split]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart4_azim_cross_split", [dart4_azim_cross_split]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`y4'_fan _1 _2`))) (term_tac (set_tac "c_diag"))); + ((fun arg_tac -> arg_tac (Arg_term (`taum _1 _2 _3 _4 _5 _6`))) (term_tac (set_tac "t1"))); + ((fun arg_tac -> arg_tac (Arg_term (`taum _1 _2 _3 _4 _5 _6`))) (term_tac (set_tac "t2"))); + ((fun arg_tac -> arg_tac (Arg_term (`dih_y _1 _2 _3 _4 _5 _6`))) (term_tac (set_tac "a1"))); + ((fun arg_tac -> arg_tac (Arg_term (`dih_y _1 _2 _3 _4 _5 _6`))) (term_tac (set_tac "a2"))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`&0 < t1 + #0.972 * a1 - #1.707 / &2 /\ &0 < t2 + #0.972 * a2 - #1.707 / &2`))) (term_tac (have_gen_tac []ALL_TAC)))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("t1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("t2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a2_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((split_tac) THEN (((use_arg_then2 ("h_121r", [])) (disch_tac [])) THEN (clear_assumption "h_121r") THEN (DISCH_THEN apply_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ALL", [ALL]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("cross_le", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y3_lo", [y3_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y5_lo", [y5_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_lo", [y7_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_hi", [y7_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y8_lo", [y8_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y3_hi", [y3_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("c_diag_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart4_y4'_lo", [dart4_y4'_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("f_fan_pair_ext_in_darts_k", [f_fan_pair_ext_in_darts_k]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_lo", [y7_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_hi", [y7_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_lo", [y9_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("c_diag_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart4_y4'_lo", [dart4_y4'_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("f_fan_pair_ext_in_darts_k", [f_fan_pair_ext_in_darts_k]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; +(Sections.add_section_hyp "h_tau" (`lp_tau (V,E)`));; + +(* Section Inner *) +Sections.begin_section "Inner";; + +(* Lemma ineq121 *) +let ineq121 = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) ==> + y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + ==> tau_fan (V,E) (face (hypermap_of_fan (V,E)) d) + #0.972 * azim_dart (V,E) d - #1.707 >= &0` +[ + ((BETA_TAC THEN (move ["d_in4"]) THEN (move ["bounds"])) THEN (((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + (((((use_arg_then2 ("tau_fan_eq_tauVEF", [tau_fan_eq_tauVEF]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ineq121_tauVEF", [ineq121_tauVEF]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Std *) +Sections.begin_section "Std";; +(Sections.add_section_hyp "std" (`E = ESTD V`));; + +(* Lemma ineq121_std *) +let ineq121_std = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> tau_fan (V,E) (face (hypermap_of_fan (V,E)) d) + #0.972 * azim_dart (V,E) d - #1.707 >= &0` +[ + ((BETA_TAC THEN (move ["d_in4"])) THEN (((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["d_in"]) THEN (move ["_"]))))); + (((fun arg_tac -> (use_arg_then2 ("ineq121", [ineq121])) (fun fst_arg -> (use_arg_then2 ("d_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((in_tac ["h_fan"] false (((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] []))))) THEN (in_tac ["d_in"] false ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))))); + (((((use_arg_then2 ("y5_hi_std2", [y5_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("std", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y8_hi_std", [y8_hi_std]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_hi_std", [y9_hi_std]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Std *) +let ineq121_std = Sections.finalize_theorem ineq121_std;; +Sections.end_section "Std";; + +(* Finalization of the section Inner *) +let ineq121 = Sections.finalize_theorem ineq121;; +let ineq121_std = Sections.finalize_theorem ineq121_std;; +Sections.end_section "Inner";; + +(* Finalization of the section Ineq121 *) +let ineq121_tauVEF = Sections.finalize_theorem ineq121_tauVEF;; +let ineq121 = Sections.finalize_theorem ineq121;; +let ineq121_std = Sections.finalize_theorem ineq121_std;; +Sections.end_section "Ineq121";; + +(* Section Ineq122 *) +Sections.begin_section "Ineq122";; +(Sections.add_section_hyp "h_main" ((hd (Ineq.getexact "7043724150 a")).ineq));; +(Sections.add_section_hyp "h_reduced" ((hd (Ineq.getexact "7043724150 a reduced v2")).ineq));; +(Sections.add_section_hyp "h_y4" ((hd (Ineq.getexact "3287695934")).ineq));; + +(* Lemma ineq122_tauVEF *) +let ineq122_tauVEF = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) ==> + y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + ==> tauVEF (V,E,face (hypermap_of_fan (V,E)) d) + #4.72 * azim_dart (V,E) d - #6.248 >= &0` +[ + ((BETA_TAC THEN (move ["d_in4"]) THEN (move ["bounds"])) THEN (((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (move ["h_fan2"]))); + ((fun arg_tac -> arg_tac (Arg_term (`d IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["d_in"])))); + ((((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN (clear_assumption "d_in4") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("dart4_tauVEF_eq_tauq", [dart4_tauVEF_eq_tauq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("real_ge", [real_ge]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#2.0 = &2 /\ &2 * h0 = #2.52 /\ #0.0 = &0`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + (in_tac ["h_main"; "h_reduced"] false ((((use_arg_then2 ("Ineq.dart_std4", [Ineq.dart_std4]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] []))))))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("h_main", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y1_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y2_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y3_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y4'_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y7_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y8_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y9_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)); + ((repeat_tactic 1 9 (((use_arg_then2 ("ALL", [ALL]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y3_lo", [y3_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y5_lo", [y5_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y3_hi", [y3_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_hi", [y7_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y7_lo", [y7_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y8_lo", [y8_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y9_lo", [y9_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart4_y4'_lo", [dart4_y4'_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("dart4_y4'_hi", [dart4_y4'_hi])) (fun fst_arg -> (use_arg_then2 ("h_y4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((THENL_FIRST) case (((((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (done_tac))); + (((((use_arg_then2 ("dart4_cross_eq_enclosed", [dart4_cross_eq_enclosed]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["cross_le"])); + ((((use_arg_then2 ("tauq_cross_split", [tauq_cross_split]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart4_azim_cross_split", [dart4_azim_cross_split]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`y4'_fan _1 _2`))) (term_tac (set_tac "c_diag"))); + ((fun arg_tac -> arg_tac (Arg_term (`taum _1 _2 _3 _4 _5 _6`))) (term_tac (set_tac "t1"))); + ((fun arg_tac -> arg_tac (Arg_term (`taum _1 _2 _3 _4 _5 _6`))) (term_tac (set_tac "t2"))); + ((fun arg_tac -> arg_tac (Arg_term (`dih_y _1 _2 _3 _4 _5 _6`))) (term_tac (set_tac "a1"))); + ((fun arg_tac -> arg_tac (Arg_term (`dih_y _1 _2 _3 _4 _5 _6`))) (term_tac (set_tac "a2"))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`&0 < t1 + #4.72 * a1 - #6.248 / &2 /\ &0 < t2 + #4.72 * a2 - #6.248 / &2`))) (term_tac (have_gen_tac []ALL_TAC)))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("t1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("t2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a2_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((split_tac) THEN (((use_arg_then2 ("h_reduced", [])) (disch_tac [])) THEN (clear_assumption "h_reduced") THEN (DISCH_THEN apply_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ALL", [ALL]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("cross_le", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y3_lo", [y3_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y5_lo", [y5_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_lo", [y7_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_hi", [y7_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y8_lo", [y8_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y3_hi", [y3_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("c_diag_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart4_y4'_lo", [dart4_y4'_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("f_fan_pair_ext_in_darts_k", [f_fan_pair_ext_in_darts_k]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_lo", [y7_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_hi", [y7_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_lo", [y9_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("c_diag_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart4_y4'_lo", [dart4_y4'_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("f_fan_pair_ext_in_darts_k", [f_fan_pair_ext_in_darts_k]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; +(Sections.add_section_hyp "h_tau" (`lp_tau (V,E)`));; + +(* Section Inner *) +Sections.begin_section "Inner";; + +(* Lemma ineq122 *) +let ineq122 = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) ==> + y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + ==> tau_fan (V,E) (face (hypermap_of_fan (V,E)) d) + #4.72 * azim_dart (V,E) d - #6.248 >= &0` +[ + ((BETA_TAC THEN (move ["d_in4"]) THEN (move ["bounds"])) THEN (((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + (((((use_arg_then2 ("tau_fan_eq_tauVEF", [tau_fan_eq_tauVEF]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ineq122_tauVEF", [ineq122_tauVEF]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Std *) +Sections.begin_section "Std";; +(Sections.add_section_hyp "std" (`E = ESTD V`));; + +(* Lemma ineq122_std *) +let ineq122_std = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> tau_fan (V,E) (face (hypermap_of_fan (V,E)) d) + #4.72 * azim_dart (V,E) d - #6.248 >= &0` +[ + ((BETA_TAC THEN (move ["d_in4"])) THEN (((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["d_in"]) THEN (move ["_"]))))); + (((fun arg_tac -> (use_arg_then2 ("ineq122", [ineq122])) (fun fst_arg -> (use_arg_then2 ("d_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((in_tac ["h_fan"] false (((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] []))))) THEN (in_tac ["d_in"] false ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))))); + (((((use_arg_then2 ("y5_hi_std2", [y5_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("std", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y8_hi_std", [y8_hi_std]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_hi_std", [y9_hi_std]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Std *) +let ineq122_std = Sections.finalize_theorem ineq122_std;; +Sections.end_section "Std";; + +(* Finalization of the section Inner *) +let ineq122 = Sections.finalize_theorem ineq122;; +let ineq122_std = Sections.finalize_theorem ineq122_std;; +Sections.end_section "Inner";; + +(* Finalization of the section Ineq122 *) +let ineq122_tauVEF = Sections.finalize_theorem ineq122_tauVEF;; +let ineq122 = Sections.finalize_theorem ineq122;; +let ineq122_std = Sections.finalize_theorem ineq122_std;; +Sections.end_section "Ineq122";; + +(* Finalization of the section QuadIneqs *) +let y4'_lo_2h0 = Sections.finalize_theorem y4'_lo_2h0;; +let dart4_y4'_lo = Sections.finalize_theorem dart4_y4'_lo;; +let y4'_hi = Sections.finalize_theorem y4'_hi;; +let dart4_y4'_hi = Sections.finalize_theorem dart4_y4'_hi;; +let dart4_y4'_hi_std = Sections.finalize_theorem dart4_y4'_hi_std;; +let dart4_delta_y_not_neg2 = Sections.finalize_theorem dart4_delta_y_not_neg2;; +let ineq119_tauVEF = Sections.finalize_theorem ineq119_tauVEF;; +let ineq119 = Sections.finalize_theorem ineq119;; +let ineq119_std = Sections.finalize_theorem ineq119_std;; +let ineq120_tauVEF = Sections.finalize_theorem ineq120_tauVEF;; +let ineq120 = Sections.finalize_theorem ineq120;; +let ineq120_std = Sections.finalize_theorem ineq120_std;; +let ineq121_tauVEF = Sections.finalize_theorem ineq121_tauVEF;; +let ineq121 = Sections.finalize_theorem ineq121;; +let ineq121_std = Sections.finalize_theorem ineq121_std;; +let ineq122_tauVEF = Sections.finalize_theorem ineq122_tauVEF;; +let ineq122 = Sections.finalize_theorem ineq122;; +let ineq122_std = Sections.finalize_theorem ineq122_std;; +Sections.end_section "QuadIneqs";; + +(* Close the module *) +end;; diff --git a/formal_lp/hypermap/ineqs/lp_ineqs_proofs2-compiled.hl b/formal_lp/hypermap/ineqs/lp_ineqs_proofs2-compiled.hl new file mode 100644 index 0000000..644c243 --- /dev/null +++ b/formal_lp/hypermap/ineqs/lp_ineqs_proofs2-compiled.hl @@ -0,0 +1,1396 @@ +needs "local/lp_details.hl";; +needs "../formal_lp/hypermap/ineqs/lp_ineqs_proofs-compiled.hl";; +needs "../formal_lp/ineqs/delta_ineq.hl";; + +(* Module Lp_ineqs_proofs2*) +module Lp_ineqs_proofs2 = struct + +open Ssrbool;; +open Ssrnat;; +open Sphere;; +open Fan_defs;; +open Hypermap;; +open Lp_ineqs_proofs;; +open Hypermap_and_fan;; +open Tame_general;; +open Lp_ineqs_def;; +open Add_triangle;; +open Hypermap_iso;; +open List_hypermap;; + +(* Section Misc *) +Sections.begin_section "Misc";; + +(* Lemma azim_dart_eq_azim *) +let azim_dart_eq_azim = Sections.section_proof ["V";"E";"v";"w"] +`FAN (vec 0,V,E) + /\ v,w IN dart1_of_fan (V,E) /\ CARD (set_of_edge v V E) > 1 + ==> azim_dart (V,E) (v,w) = azim (vec 0) v w (sigma_fan (vec 0) V E v w)` +[ + (BETA_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["vw_in1"])) THEN (move ["card_gt1"])); + (((((use_arg_then2 ("azim_dart_eq_azim_fan", [azim_dart_eq_azim_fan]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dart_of_fan_eq", [dart_of_fan_eq]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("azim_fan", [azim_fan]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sigma_fan_same *) +let sigma_fan_same = Sections.section_proof ["V";"E";"V2";"E2";"v"] +`set_of_edge v V E = set_of_edge v V2 E2 + ==> sigma_fan (vec 0) V E v = sigma_fan (vec 0) V2 E2 v` +[ + ((BETA_TAC THEN (move ["eq"])) THEN ((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (move ["w"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("sigma_fan", [sigma_fan]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sigma_fan_delete_eq *) +let sigma_fan_delete_eq = Sections.section_proof ["V";"E";"v";"w";"x"] +`~(x = v) /\ ~(x = w) + ==> sigma_fan (vec 0) V (E DELETE {v,w}) x = sigma_fan (vec 0) V E x` +[ + ((BETA_TAC THEN (move ["x_neq"])) THEN ((use_arg_then2 ("sigma_fan_same", [sigma_fan_same])) (thm_tac apply_tac))); + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_of_edge", [set_of_edge]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"])); + ((THENL) (split_tac) [((case THEN ALL_TAC) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["_"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); ((case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))]); + (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Geomdetail.PAIR_EQ_EXPAND)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("x_neq", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma atn2_acs_lemma *) +let atn2_acs_lemma = Sections.section_proof ["a";"b"] +`~(a = &0) /\ b * b <= a + ==> pi / &2 + atn2 (sqrt (a - b * b), --b) = acs (b / sqrt (a))` +[ + (BETA_TAC THEN (move ["ineqs"])); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`b * b = a`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + ((((use_arg_then2 ("Tame_inequalities.ATN2_ACS_LEMMA", [Tame_inequalities.ATN2_ACS_LEMMA]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN ((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_SUB_REFL", [REAL_SUB_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SQRT_0", [SQRT_0]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (use_arg_then2 ("Merge_ineq.atn2_0", [Merge_ineq.atn2_0])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`--b`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["eq1"]) THEN (case THEN (move ["eq2"])) THEN (move ["_"]))))); + (((fun arg_tac -> arg_tac (Arg_term (`b < &0`))) (disch_eq_tac "b_ineq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < --b /\ ~(b = &0)`))) (term_tac (have_gen_tac [](move ["b_ineq2"])))) ((((use_arg_then2 ("b_ineq", [])) (disch_tac [])) THEN (clear_assumption "b_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`b * b = (--b) * (--b)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("Nonlinear_lemma.sqrtxx", [Nonlinear_lemma.sqrtxx]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("real_div", [real_div])) (fun fst_arg -> (use_arg_then2 ("b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_INV_NEG", [REAL_INV_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RNEG", [REAL_MUL_RNEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RINV", [REAL_MUL_RINV]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("ACS_NEG_1", [ACS_NEG_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq1", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`--b < &0 /\ ~(b = &0) /\ &0 <= b`))) (term_tac (have_gen_tac [](move ["b_ineq2"])))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`~(b = &0)`))) (term_tac (have_gen_tac []ALL_TAC)))) ((((use_arg_then2 ("b_ineq", [])) (disch_tac [])) THEN (clear_assumption "b_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("implybF", [implybF]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["eq0"])) THEN (((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN ((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN (((((use_arg_then2 ("eq0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LZERO", [REAL_MUL_LZERO]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("Nonlinear_lemma.sqrtxx", [Nonlinear_lemma.sqrtxx]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("REAL_DIV_REFL", [REAL_DIV_REFL]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ACS_1", [ACS_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq2", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_ADD_RINV", [REAL_ADD_RINV]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dih_x_eq *) +let dih_x_eq = Sections.section_proof ["x1";"x2";"x3";"x4";"x5";"x6"] +`let v1 = ups_x x1 x2 x6 in + let v2 = ups_x x1 x3 x5 in + let d4 = delta_x4 x1 x2 x3 x4 x5 x6 in + &0 < v1 /\ &0 < v2 /\ &0 <= delta_x x1 x2 x3 x4 x5 x6 /\ &0 <= x1 + ==> dih_x x1 x2 x3 x4 x5 x6 = acs (d4 / sqrt (v1 * v2))` +[ + ((repeat_tactic 1 9 ((CONV_TAC let_CONV))) THEN (BETA_TAC THEN (move ["ineqs"]))); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE Sphere.dih_x)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE Tame_inequalities.DELTA_X_AND_DELTA_X4)))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("atn2_acs_lemma", [atn2_acs_lemma]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (split_tac)); + ((((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`a <= b <=> &0 <= b - a`))) (term_tac (have_gen_tac ["a"; "b"](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE Tame_inequalities.DELTA_X_AND_DELTA_X4)))(gsym_then (thm_tac (new_rewrite [] []))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_MUL", [REAL_LE_MUL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma dih_x_mono_le4 *) +let dih_x_mono_le4 = Sections.section_proof ["x1";"x2";"x3";"x5";"x6";"a";"b"] +`a <= b /\ &0 <= x1 + /\ &0 < ups_x x1 x2 x6 /\ &0 < ups_x x1 x3 x5 + /\ &0 <= delta_x x1 x2 x3 a x5 x6 + /\ &0 <= delta_x x1 x2 x3 b x5 x6 + ==> dih_x x1 x2 x3 a x5 x6 <= dih_x x1 x2 x3 b x5 x6` +[ + (BETA_TAC THEN (case THEN (move ["a_le_b"])) THEN (case THEN (move ["x1_ge0"])) THEN (case THEN (move ["ups1"])) THEN (case THEN (move ["ups2"])) THEN (case THEN (move ["delta_a"])) THEN (move ["delta_b"])); + ((THENL_ROT (-1)) ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE dih_x_eq)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ACS_MONO_LE_EQ", [ACS_MONO_LE_EQ]))(thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_RMUL", [REAL_LE_RMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_INV", [REAL_LE_INV]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("SQRT_POS_LE", [SQRT_POS_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_MUL", [REAL_LE_MUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`a = b`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("Tame_inequalities.DELTA_X4_MONO_LE_4", [Tame_inequalities.DELTA_X4_MONO_LE_4]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x1_ge0", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a_le_b", [])) (disch_tac [])) THEN (clear_assumption "a_le_b") THEN ((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`&0 < x /\ &0 < y ==> (abs (z / sqrt (x * y)) <= &1 <=> &0 <= x * y - z * z)`))) (term_tac (have_gen_tac ["x"; "y"; "z"](move ["aux"])))); + ((BETA_TAC THEN (move ["ineqs"])) THEN ((((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_MUL", [REAL_ABS_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_INV", [REAL_ABS_INV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_div", [real_div]))(gsym_then (thm_tac (new_rewrite [] []))))))); + ((fun arg_tac -> arg_tac (Arg_term (`&0 < x * y /\ &0 <= x * y`))) (term_tac (have_gen_tac [](move ["xy_ineqs"])))); + (((((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_MUL", [REAL_LT_MUL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("Packing3.REAL_DIV_LE_1", [Packing3.REAL_DIV_LE_1]))(thm_tac (new_rewrite [] [])))); + (((((use_arg_then2 ("REAL_ABS_NZ", [REAL_ABS_NZ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SQRT_EQ_0", [SQRT_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("xy_ineqs", [])) (disch_tac [])) THEN (clear_assumption "xy_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then2 ("REAL_LE_SQUARE_ABS", [REAL_LE_SQUARE_ABS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SQRT_POW_2", [SQRT_POW_2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("aux", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE Tame_inequalities.DELTA_X_AND_DELTA_X4)))(gsym_then (thm_tac (new_rewrite [] []))))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_MUL", [REAL_LE_MUL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma dih_y_mono_le4 *) +let dih_y_mono_le4 = Sections.section_proof ["y1";"y2";"y3";"y5";"y6";"a";"b"] +`&0 <= a /\ a <= b + /\ &0 < ups_x (y1 * y1) (y2 * y2) (y6 * y6) + /\ &0 < ups_x (y1 * y1) (y3 * y3) (y5 * y5) + /\ &0 <= delta_y y1 y2 y3 a y5 y6 + /\ &0 <= delta_y y1 y2 y3 b y5 y6 + ==> dih_y y1 y2 y3 a y5 y6 <= dih_y y1 y2 y3 b y5 y6` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("delta_y", [delta_y]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE dih_y)))(thm_tac (new_rewrite [] [])))))) THEN (move ["ineqs"])); + ((((use_arg_then2 ("dih_x_mono_le4", [dih_x_mono_le4]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_SQUARE", [REAL_LE_SQUARE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ineqs", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + (((repeat_tactic 1 9 (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("REAL_LE_SQUARE_ABS", [REAL_LE_SQUARE_ABS]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section Misc *) +let azim_dart_eq_azim = Sections.finalize_theorem azim_dart_eq_azim;; +let sigma_fan_same = Sections.finalize_theorem sigma_fan_same;; +let sigma_fan_delete_eq = Sections.finalize_theorem sigma_fan_delete_eq;; +let atn2_acs_lemma = Sections.finalize_theorem atn2_acs_lemma;; +let dih_x_eq = Sections.finalize_theorem dih_x_eq;; +let dih_x_mono_le4 = Sections.finalize_theorem dih_x_mono_le4;; +let dih_y_mono_le4 = Sections.finalize_theorem dih_y_mono_le4;; +Sections.end_section "Misc";; + +(* Section Fan *) +Sections.begin_section "Fan";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_hyp "fanV" (`FAN (vec 0,V,E)`));; + +(* Lemma ys_fan_eq *) +let ys_fan_eq = Sections.section_proof ["v";"w"] +`v,w IN dart1_of_fan (V,E) + ==> y1_fan (v,w) = norm v + /\ y2_fan (v,w) = norm w + /\ y3_fan (V,E) (v,w) = norm (sigma_fan (vec 0) V E v w) + /\ y4'_fan (V,E) (v,w) = dist (w, sigma_fan (vec 0) V E v w) + /\ y5_fan (V,E) (v,w) = dist (v, sigma_fan (vec 0) V E v w) + /\ y6_fan (v,w) = dist (v,w)` +[ + (BETA_TAC THEN (move ["vw_in1"])); + ((((use_arg_then2 ("y1_fan", [y1_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y2_fan", [y2_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y3_fan", [y3_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y4'_fan", [y4'_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y6_fan", [y6_fan]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fan_delta_y_pos *) +let fan_delta_y_pos = Sections.section_proof ["d"] +`d IN dart1_of_fan (V,E) + ==> &0 <= delta_y (y1_fan d) (y2_fan d) (y3_fan (V,E) d) + (y4'_fan (V,E) d) (y5_fan (V,E) d) (y6_fan d)` +[ + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("ys_fan_eq", [ys_fan_eq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE Tame_lemmas.delta_y_pos)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fan_delta_y_pos2 *) +let fan_delta_y_pos2 = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> &0 <= delta_y (y4'_fan (V,E) d) (y9_fan (V,E) d) (y6_fan d) + (y4'_fan (V,E) (f_fan_pair_ext (V,E) d)) (y5_fan (V,E) d) (y8_fan (V,E) d)` +[ + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["hypV"]))); + ((((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"])) THEN (BETA_TAC THEN (move ["vw_in4"]))); + ((((use_arg_then2 ("vw_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hypV", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"]))); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["vw_in1"])))); + (((((use_arg_then2 ("CARD_FACE_GT_1", [CARD_FACE_GT_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fanV", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("ys_fan_eq", [ys_fan_eq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4'_fan", [y4'_fan]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES", [PERMUTES_INVERSES])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE face4_eq))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["f_eq"]) THEN (case THEN (move ["darts_in"])) THEN (move ["_"]))))); + ((((use_arg_then2 ("y8_fan", [y8_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y9_fan", [y9_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("darts_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E w' v`))) (term_tac (set_tac "u"))); + ((((use_arg_then2 ("delta_y", [delta_y]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("DELTA_EQ_DELTA_X", [DELTA_EQ_DELTA_X]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Collect_geom.DELTA_POS_4POINTS", [Collect_geom.DELTA_POS_4POINTS])) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("u", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("u", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fan_ups_x_pos *) +let fan_ups_x_pos = Sections.section_proof ["d"] +`d IN dart1_of_fan (V,E) + ==> &0 < ups_x (y1_fan d * y1_fan d) (y2_fan d * y2_fan d) (y6_fan d * y6_fan d) + /\ &0 < ups_x (y1_fan d * y1_fan d) (y3_fan (V,E) d * y3_fan (V,E) d) + (y5_fan (V,E) d * y5_fan (V,E) d)` +[ + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in1"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ys_fan_eq", [ys_fan_eq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("Trigonometry1.DIST_L_ZERO", [Trigonometry1.DIST_L_ZERO]))(gsym_then (thm_tac (new_rewrite [] []))))))); + (repeat_tactic 1 9 (((use_arg_then2 ("Collect_geom2.NOT_COL_EQ_UPS_X_POS", [Collect_geom2.NOT_COL_EQ_UPS_X_POS]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DART1_NOT_COLLINEAR_2", [DART1_NOT_COLLINEAR_2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +];; + +(* Lemma dih_y_le_azim_dart *) +let dih_y_le_azim_dart = Sections.section_proof ["d"] +`d IN dart1_of_fan (V,E) + ==> dih_y (y1_fan d) (y2_fan d) (y3_fan (V,E) d) + (y4'_fan (V,E) d) (y5_fan (V,E) d) (y6_fan d) + <= azim_dart (V,E) d` +[ + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in1"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["vw_in"])))) (((((use_arg_then2 ("dart_of_fan_eq", [dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("ys_fan_eq", [ys_fan_eq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("Trigonometry1.DIST_L_ZERO", [Trigonometry1.DIST_L_ZERO]))(gsym_then (thm_tac (new_rewrite [] []))))))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE DIHV_EQ_DIH_Y)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("DART1_NOT_COLLINEAR", [DART1_NOT_COLLINEAR])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("azim_dart_eq_azim_fan", [azim_dart_eq_azim_fan]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("azim_fan", [azim_fan]))(thm_tac (new_rewrite [] []))))); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`_ > 1`))) (disch_eq_tac "card_gt" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`pi`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("DIHV_RANGE", [DIHV_RANGE]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("PI_POS", [PI_POS])) (disch_tac [])) THEN (clear_assumption "PI_POS") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("AZIM_DIVH", [AZIM_DIVH]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("DART1_NOT_COLLINEAR", [DART1_NOT_COLLINEAR])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`_ < pi`))) (disch_eq_tac "ineq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DIHV_RANGE", [DIHV_RANGE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma azim_sum_sigma_fan *) +let azim_sum_sigma_fan = Sections.section_proof ["v";"w"] +`v,w IN dart1_of_fan (V,E) + ==> let w' = sigma_fan (vec 0) V E w v in + (!x. x IN set_of_edge w V E /\ ~(x = v) + ==> azim (vec 0) w v x = azim (vec 0) w v w' + azim (vec 0) w w' x)` +[ + ((BETA_TAC THEN (move ["vw_in1"])) THEN (CONV_TAC let_CONV) THEN (BETA_TAC THEN (move ["x"]) THEN (case THEN ((move ["x_in"]) THEN (move ["x_neq_v"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E w v`))) (term_tac (set_tac "w'"))); + (((fun arg_tac -> arg_tac (Arg_term (`w' = x`))) (disch_eq_tac "w'_eq_x" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((((use_arg_then2 ("w'_eq_x", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("AZIM_REFL", [AZIM_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_RID", [REAL_ADD_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("Fan.sum5_azim_fan", [Fan.sum5_azim_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [2] [])))))); + ((((use_arg_then2 ("vw_in1", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (move ["wv_in1"]))); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DART1_NOT_COLLINEAR_2", [DART1_NOT_COLLINEAR_2])) (fun fst_arg -> (use_arg_then2 ("wv_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("DART1_NOT_COLLINEAR", [DART1_NOT_COLLINEAR])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("x_in", [])) (disch_tac [])) THEN (clear_assumption "x_in") THEN BETA_TAC) THEN (((((use_arg_then2 ("set_of_edge", [set_of_edge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`w' = v`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((THENL_ROT (-1)) ((((use_arg_then2 ("Counting_spheres.AZIM_COMP_LE", [Counting_spheres.AZIM_COMP_LE]))(thm_tac (new_rewrite [] [])))) THEN (split_tac))); + ((((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Topology.MONO_AZIM_SIGMA_FAN", [Topology.MONO_AZIM_SIGMA_FAN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_eq_x", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fanV", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("x_in", [])) (disch_tac [])) THEN (clear_assumption "x_in") THEN ((use_arg_then2 ("vw_in1", [])) (disch_tac [])) THEN (clear_assumption "vw_in1") THEN BETA_TAC) THEN ((((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_of_edge", [set_of_edge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))))); + (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Collect_geom.PER_SET2)))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("x_neq_v", [])) (disch_tac [])) THEN (clear_assumption "x_neq_v") THEN ((use_arg_then2 ("contraR", [contraR])) (disch_tac [])) THEN (clear_assumption "contraR") THEN (DISCH_THEN apply_tac) THEN (move ["ineq"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Fan.UNIQUE_AZIM_0_POINT_FAN", [Fan.UNIQUE_AZIM_0_POINT_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("x_in", [])) (disch_tac [])) THEN (clear_assumption "x_in") THEN ((use_arg_then2 ("vw_in1", [])) (disch_tac [])) THEN (clear_assumption "vw_in1") THEN BETA_TAC) THEN (((((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_of_edge", [set_of_edge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Counting_spheres.AZIM_NN", [Counting_spheres.AZIM_NN])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("ineq", [ineq])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma fan_delete_edge *) +let fan_delete_edge = Sections.section_proof ["e"] +`FAN (vec 0, V, E DELETE e)` +[ + (((((use_arg_then2 ("Topology.CTVTAQA", [Topology.CTVTAQA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DELETE_SUBSET", [DELETE_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma set_of_edge_delete_eq *) +let set_of_edge_delete_eq = Sections.section_proof ["v";"w"] +`set_of_edge v V (E DELETE {v,w}) = set_of_edge v V E DELETE w` +[ + ((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_of_edge", [set_of_edge]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Geomdetail.PAIR_EQ_EXPAND)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))) THEN (move ["x"])) THEN ((THENL) (split_tac) [((case THEN ALL_TAC) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); ((case THEN ALL_TAC) THEN (case THEN (move ["vxE"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))])); + ((((use_arg_then2 ("vxE", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("vxE", []))(thm_tac (new_rewrite [2] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ", [PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma set_of_edge_delete_eq2 *) +let set_of_edge_delete_eq2 = Sections.section_proof ["v";"w"] +`v,w IN dart1_of_fan (V,E) + ==> set_of_edge v V E = w INSERT (set_of_edge v V (E DELETE {v,w}))` +[ + ((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN", [PAIR_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["h"])); + (((((use_arg_then2 ("set_of_edge_delete_eq", [set_of_edge_delete_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INSERT_DELETE", [INSERT_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma card_set_of_edge_delete *) +let card_set_of_edge_delete = Sections.section_proof ["v";"w"] +`v,w IN dart1_of_fan (V,E) + ==> CARD (set_of_edge v V E) = CARD (set_of_edge v V (E DELETE {v,w})) + 1` +[ + (BETA_TAC THEN (move ["vw_in1"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN", [PAIR_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["h"]))); + ((((fun arg_tac -> (use_arg_then2 ("set_of_edge_delete_eq2", [set_of_edge_delete_eq2])) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CARD_CLAUSES", [CARD_CLAUSES]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("finite_set_of_edge", [finite_set_of_edge]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("fan_delete_edge", [fan_delete_edge]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("set_of_edge_delete_eq", [set_of_edge_delete_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("addn1", [addn1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sigma_fan_delete1 *) +let sigma_fan_delete1 = Sections.section_proof ["v";"w"] +`v,w IN dart1_of_fan (V,E) /\ CARD (set_of_edge w V E) > 1 + ==> let w' = sigma_fan (vec 0) V E w v in + let E2 = E DELETE {w,w'} in + sigma_fan (vec 0) V E2 w v = sigma_fan (vec 0) V E w w' + /\ (!x. x IN set_of_edge w V E2 /\ ~(x = v) + ==> sigma_fan (vec 0) V E2 w x = sigma_fan (vec 0) V E w x)` +[ + ((BETA_TAC THEN (case THEN ((move ["vw_in1"]) THEN (move ["card_gt1"])))) THEN (repeat_tactic 1 9 ((CONV_TAC let_CONV)))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E w v`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> (use_arg_then2 ("fan_delete_edge", [fan_delete_edge])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`{w,w'}`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["fan2"]))); + ((fun arg_tac -> arg_tac (Arg_term (`E DELETE _`))) (term_tac (set_tac "E2"))); + ((fun arg_tac -> arg_tac (Arg_term (`~(set_of_edge w V E = {x})`))) (term_tac (have_gen_tac ["x"](move ["neq_sing"])))); + ((((use_arg_then2 ("card_gt1", [])) (disch_tac [])) THEN (clear_assumption "card_gt1") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("CARD_SINGLETON", [CARD_SINGLETON]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN", [PAIR_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["_"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["v_in"]))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Fan.SIGMA_FAN", [Fan.SIGMA_FAN])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("neq_sing", [])) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["w'_in"])) THEN (case THEN (move ["w'_neq_v"])) THEN (move ["azim_le"])); + ((fun arg_tac -> arg_tac (Arg_term (`~(w' IN set_of_edge w V E2)`))) (term_tac (have_gen_tac [](move ["w'_not_in"])))); + (((((use_arg_then2 ("set_of_edge", [set_of_edge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("E2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`set_of_edge w V E2 = {v}`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbN", [andbN]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("sigma_fan", [sigma_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Fan.UNIQUE_SIGMA_FAN", [Fan.UNIQUE_SIGMA_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w'_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("w'_neq_v", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("neq_sing", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`set_of_edge w V E = {w',v}`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("E2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_of_edge_delete_eq", [set_of_edge_delete_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INSERT_DELETE", [INSERT_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["u"])) THEN (((((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))]) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`v IN set_of_edge w V E2`))) (term_tac (have_gen_tac [](move ["v_in2"])))) (((((use_arg_then2 ("E2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_of_edge_delete_eq", [set_of_edge_delete_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (split_tac); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Fan.UNIQUE_SIGMA_FAN", [Fan.UNIQUE_SIGMA_FAN])) (fun fst_arg -> (use_arg_then2 ("eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("E2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_of_edge_delete_eq", [set_of_edge_delete_eq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("v_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_neq_v", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Fan.SIGMA_FAN", [Fan.SIGMA_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("neq_sing", [])) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w'_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["h"]))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E w w'`))) (term_tac (set_tac "w2"))); + ((fun arg_tac -> arg_tac (Arg_term (`~(w2 = v)`))) (term_tac (have_gen_tac [](move ["w2_neq_v"])))); + ((fun arg_tac -> arg_tac (Arg_term (`w2 = power_map_points sigma_fan (vec 0) V E w v 2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("SIGMA_FAN_POWER", [SIGMA_FAN_POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w2_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("Topology.key_lemma_cyclic_fan", [Topology.key_lemma_cyclic_fan]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fanV", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((THENL_FIRST) (split_tac) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("w'_in", [])) (disch_tac [])) THEN (clear_assumption "w'_in") THEN BETA_TAC) THEN (((((use_arg_then2 ("set_of_edge", [set_of_edge]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["ww'_in1"])) THEN (move ["_"]))); + ((((fun arg_tac -> (use_arg_then2 ("set_of_edge_delete_eq2", [set_of_edge_delete_eq2])) (fun fst_arg -> (use_arg_then2 ("ww'_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CARD_CLAUSES", [CARD_CLAUSES]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("finite_set_of_edge", [finite_set_of_edge]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("E2_def", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("w'_not_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("TWO", [TWO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LT_SUC", [LT_SUC]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN ((use_arg_then2 ("contraR", [contraR])) (disch_tac [])) THEN (clear_assumption "contraR") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("NOT_LT", [NOT_LT]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`a <= 1 <=> a = 0 \/ a = 1`))) (term_tac (have_gen_tac ["a"](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((THENL_LAST) (((THENL) case [ALL_TAC; ((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("set_one_point", [set_one_point])) (fun fst_arg -> (use_arg_then2 ("v_in2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))]) THEN ((TRY done_tac))) ((((use_arg_then2 ("finite_set_of_edge", [finite_set_of_edge]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((((use_arg_then2 ("CARD_EQ_0", [CARD_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("finite_set_of_edge", [finite_set_of_edge]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["eq"])) THEN (((use_arg_then2 ("v_in2", [])) (disch_tac [])) THEN (clear_assumption "v_in2") THEN BETA_TAC) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w2_neq_v", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["u"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["u_in"])) THEN (move ["u_neq_w'"]) THEN (move ["u_neq_v"])); + ((((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE azim_sum_sigma_fan))) (fun fst_arg -> (use_arg_then2 ("u_neq_v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE azim_sum_sigma_fan))) (fun fst_arg -> (use_arg_then2 ("w2_neq_v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_LADD", [REAL_LE_LADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (move ["x"]) THEN (case THEN (move ["x_in"])) THEN (move ["x_neq_v"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Fan.UNIQUE_SIGMA_FAN", [Fan.UNIQUE_SIGMA_FAN])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (split_tac)); + ((((use_arg_then2 ("x_neq_v", [])) (disch_tac [])) THEN (clear_assumption "x_neq_v") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (move ["eq2"])) THEN (((use_arg_then2 ("v_in2", [])) (disch_tac [])) THEN (clear_assumption "v_in2") THEN BETA_TAC) THEN (((((use_arg_then2 ("eq2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E w x`))) (term_tac (set_tac "u"))); + ((fun arg_tac -> arg_tac (Arg_term (`~(u = w')`))) (term_tac (have_gen_tac [](move ["u_neq_w'"])))); + (((((use_arg_then2 ("u_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("x_neq_v", [])) (disch_tac [])) THEN (clear_assumption "x_neq_v") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("Fan.MONO_SIGMA_FAN", [Fan.MONO_SIGMA_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("x_in", [])) (disch_tac [])) THEN (clear_assumption "x_in") THEN ((use_arg_then2 ("vw_in1", [])) (disch_tac [])) THEN (clear_assumption "vw_in1") THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("E2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_of_edge_delete_eq", [set_of_edge_delete_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(gsym_then (thm_tac (new_rewrite [] []))))))); + ((((((use_arg_then2 ("set_of_edge", [set_of_edge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Fan.SIGMA_FAN", [Fan.SIGMA_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("neq_sing", [])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)); + ((((use_arg_then2 ("x_in", [])) (disch_tac [])) THEN (clear_assumption "x_in") THEN BETA_TAC) THEN (((((use_arg_then2 ("E2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_of_edge_delete_eq", [set_of_edge_delete_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("u_def", []))(thm_tac (new_rewrite [] [])))) THEN (move ["h"])) THEN ((((use_arg_then2 ("E2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_of_edge_delete_eq", [set_of_edge_delete_eq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("u_neq_w'", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((BETA_TAC THEN (move ["w2"]) THEN (move ["w2_cond"])) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma azim_dart_sum_delete *) +let azim_dart_sum_delete = Sections.section_proof ["v";"w"] +`v,w IN dart1_of_fan (V,E) /\ CARD (set_of_edge w V E) > 1 + ==> azim_dart (V, E DELETE {w, sigma_fan (vec 0) V E w v}) (w,v) + = azim_dart (V,E) (w,v) + azim_dart (V,E) (w, sigma_fan (vec 0) V E w v)` +[ + (BETA_TAC THEN (case THEN ((move ["vw_in1"]) THEN (move ["card_gt1"])))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E w v`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> (use_arg_then2 ("fan_delete_edge", [fan_delete_edge])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`{w,w'}`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["fan2"]))); + ((fun arg_tac -> arg_tac (Arg_term (`E DELETE _`))) (term_tac (set_tac "E2"))); + ((((use_arg_then2 ("vw_in1", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (move ["wv_in1"]))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("wv_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (move ["w'w_in1"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN", [PAIR_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["_"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["w_in"])) THEN (move ["v_in"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`~(set_of_edge w V E = {x})`))) (term_tac (have_gen_tac ["x"](move ["neq_sing"])))); + ((((use_arg_then2 ("card_gt1", [])) (disch_tac [])) THEN (clear_assumption "card_gt1") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("CARD_SINGLETON", [CARD_SINGLETON]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Fan.SIGMA_FAN", [Fan.SIGMA_FAN])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("neq_sing", [])) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["w'_in"])) THEN (case THEN (move ["w'_neq_v"])) THEN (move ["_"])); + ((fun arg_tac -> arg_tac (Arg_term (`CARD (set_of_edge w V E2) >= 1`))) (term_tac (have_gen_tac [](move ["card_ge1"])))); + ((((use_arg_then2 ("GE", [GE]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("CARD_ATLEAST_1", [CARD_ATLEAST_1])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("v", [])) (term_tac exists_tac))); + (((((use_arg_then2 ("finite_set_of_edge", [finite_set_of_edge]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("E2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_of_edge_delete_eq", [set_of_edge_delete_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("azim_dart_eq_azim_fan", [azim_dart_eq_azim_fan]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dart_of_fan_eq", [dart_of_fan_eq]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("fan2", [fan2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (DISJ1_TAC)); + ((((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("E2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("wv_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Geomdetail.PAIR_EQ_EXPAND)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("w'_neq_v", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + (((((fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ", [PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ])) (fun fst_arg -> (use_arg_then2 ("w'w_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ", [PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ])) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("azim_fan", [azim_fan]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_gt1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] []))))); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`CARD _ > 1`))) (disch_eq_tac "card_ineq2" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E w w' = v`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Local_lemmas1.AZIM_POS_IMP_SUM_2PI)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("azim_dart_eq_azim", [azim_dart_eq_azim]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("Hypermap_and_fan.AZIM_DART_POS", [Hypermap_and_fan.AZIM_DART_POS]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("dart_of_fan_eq", [dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E w w' = power_map_points sigma_fan (vec 0) V E w v 2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("SIGMA_FAN_POWER", [SIGMA_FAN_POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("Topology.ORDER_POWER_SIGMA_FAN", [Topology.ORDER_POWER_SIGMA_FAN]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("wv_in1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fanV", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((fun arg_tac -> (use_arg_then2 ("card_set_of_edge_delete", [card_set_of_edge_delete])) (fun fst_arg -> (use_arg_then2 ("w'w_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("E2_def", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("card_ge1", [])) (disch_tac [])) THEN (clear_assumption "card_ge1") THEN ((use_arg_then2 ("card_ineq2", [])) (disch_tac [])) THEN (clear_assumption "card_ineq2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("E2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE sigma_fan_delete1)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE azim_sum_sigma_fan)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Fan.SIGMA_FAN", [Fan.SIGMA_FAN])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("neq_sing", [])) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w'_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E w w' = power_map_points sigma_fan (vec 0) V E w v 2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("SIGMA_FAN_POWER", [SIGMA_FAN_POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Topology.key_lemma_cyclic_fan", [Topology.key_lemma_cyclic_fan]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fanV", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("wv_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((THENL_FIRST) (split_tac) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("w'_in", [])) (disch_tac [])) THEN (clear_assumption "w'_in") THEN BETA_TAC) THEN (((((use_arg_then2 ("set_of_edge", [set_of_edge]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["ww'_in1"])) THEN (move ["_"]))); + ((((fun arg_tac -> (use_arg_then2 ("set_of_edge_delete_eq2", [set_of_edge_delete_eq2])) (fun fst_arg -> (use_arg_then2 ("ww'_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CARD_CLAUSES", [CARD_CLAUSES]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("finite_set_of_edge", [finite_set_of_edge]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("E2_def", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("E2_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("set_of_edge_delete_eq", [set_of_edge_delete_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("card_ineq2", [])) (disch_tac [])) THEN (clear_assumption "card_ineq2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section Fan *) +let ys_fan_eq = Sections.finalize_theorem ys_fan_eq;; +let fan_delta_y_pos = Sections.finalize_theorem fan_delta_y_pos;; +let fan_delta_y_pos2 = Sections.finalize_theorem fan_delta_y_pos2;; +let fan_ups_x_pos = Sections.finalize_theorem fan_ups_x_pos;; +let dih_y_le_azim_dart = Sections.finalize_theorem dih_y_le_azim_dart;; +let azim_sum_sigma_fan = Sections.finalize_theorem azim_sum_sigma_fan;; +let fan_delete_edge = Sections.finalize_theorem fan_delete_edge;; +let set_of_edge_delete_eq = Sections.finalize_theorem set_of_edge_delete_eq;; +let set_of_edge_delete_eq2 = Sections.finalize_theorem set_of_edge_delete_eq2;; +let card_set_of_edge_delete = Sections.finalize_theorem card_set_of_edge_delete;; +let sigma_fan_delete1 = Sections.finalize_theorem sigma_fan_delete1;; +let azim_dart_sum_delete = Sections.finalize_theorem azim_dart_sum_delete;; +Sections.end_section "Fan";; + +(* Section FullySurrounded *) +Sections.begin_section "FullySurrounded";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_hyp "fanV" (`FAN (vec 0,V,E)`));; +(Sections.add_section_hyp "f_surr" (`fully_surrounded (V,E)`));; + +(* Let dartH *) +Sections.add_section_lemma "dartH" (Sections.section_proof [] +`dart (hypermap_of_fan (V,E)) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let dart1_eq *) +Sections.add_section_lemma "dart1_eq" (Sections.section_proof [] +`dart1_of_fan (V,E) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Section Pack *) +Sections.begin_section "Pack";; +(Sections.add_section_hyp "subV" (`V SUBSET ball_annulus`));; +(Sections.add_section_hyp "packV" (`packing V`));; + +(* Section PerimZ *) +Sections.begin_section "PerimZ";; +(Sections.add_section_hyp "h_fan" (`lp_fan (V,E)`));; +(Sections.add_section_hyp "ineq1" ((hd (Ineq.getexact "5584033259")).ineq));; +(Sections.add_section_hyp "ineq2" ((hd (Ineq.getexact "6170936724")).ineq));; +(Sections.add_section_hyp "ineq3" ((hd (Ineq.getexact "5691615370")).ineq));; + +(* Lemma perimZ *) +let perimZ = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> &3 <= y4'_fan (V,E) d /\ &3 <= y4'_fan (V,E) (f_fan_pair_ext (V,E) d) + /\ y5_fan (V,E) d <= #2.52 /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 /\ y9_fan (V,E) d <= #2.52 + ==> #8.472 <= y5_fan (V,E) (inverse (f_fan_pair_ext (V,E)) d) + + y6_fan (inverse (f_fan_pair_ext (V,E)) d) + + y5_fan (V,E) (f_fan_pair_ext (V,E) d) + + y6_fan (f_fan_pair_ext (V,E) d)` +[ + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in4"]) THEN (move ["bounds"])); + ((((use_arg_then2 ("vw_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["_"]))); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("dart4_y_invf_eq", [dart4_y_invf_eq])) (fun fst_arg -> (use_arg_then2 ("vw_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("dart4_yf_eq", [dart4_yf_eq])) (fun fst_arg -> (use_arg_then2 ("vw_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Lp_details.LEMMA_5691615370", [Lp_details.LEMMA_5691615370])) (fun fst_arg -> (use_arg_then2 ("ineq1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y4'_fan (V,E) (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y9_fan (V,E) (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y4'_fan (V,E) (f_fan_pair_ext (V,E) (v,w))`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y8_fan (V,E) (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (ANTS_TAC)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#3.0 = &3`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y9_lo", [y9_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y8_lo", [y8_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("y4'_hi", [y4'_hi]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("h_fan", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair_ext_power_in_dart", [f_fan_pair_ext_power_in_dart]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_LAST) case ((arith_tac) THEN (done_tac))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fan_delta_y_pos2", [fan_delta_y_pos2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Section Std *) +Sections.begin_section "Std";; +(Sections.add_section_hyp "std" (`E = ESTD V`));; + +(* Lemma perimZ_std *) +let perimZ_std = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> &3 <= y4'_fan (V,E) d /\ &3 <= y4'_fan (V,E) (f_fan_pair_ext (V,E) d) + ==> #8.472 <= y5_fan (V,E) (inverse (f_fan_pair_ext (V,E)) d) + + y6_fan (inverse (f_fan_pair_ext (V,E)) d) + + y5_fan (V,E) (f_fan_pair_ext (V,E) d) + + y6_fan (f_fan_pair_ext (V,E) d)` +[ + ((BETA_TAC THEN (move ["d_in4"]) THEN (move ["bounds"])) THEN (((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + (((((fun arg_tac -> (use_arg_then2 ("perimZ", [perimZ])) (fun fst_arg -> (use_arg_then2 ("d_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y5_hi_std2", [y5_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y8_hi_std", [y8_hi_std]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_hi_std", [y9_hi_std]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Std *) +let perimZ_std = Sections.finalize_theorem perimZ_std;; +Sections.end_section "Std";; + +(* Finalization of the section PerimZ *) +let perimZ = Sections.finalize_theorem perimZ;; +let perimZ_std = Sections.finalize_theorem perimZ_std;; +Sections.end_section "PerimZ";; + +(* Section Yapex_sup_flat *) +Sections.begin_section "Yapex_sup_flat";; +(Sections.add_section_hyp "ineq1" ((hd (Ineq.getexact "6170936724")).ineq));; +(Sections.add_section_hyp "ineq_a" ((hd (Ineq.getexact "8673686234 a")).ineq));; +(Sections.add_section_hyp "ineq_b" ((hd (Ineq.getexact "8673686234 b")).ineq));; +(Sections.add_section_hyp "ineq_c" ((hd (Ineq.getexact "8673686234 c")).ineq));; + +(* Lemma yapex_sup_flat_fan *) +let yapex_sup_flat_fan = Sections.section_proof ["d"] +`let d2 = + inverse (f_fan_pair_ext (V,E)) (e_fan_pair_ext (V,E) (f_fan_pair_ext (V,E) d)) in + d IN darts_k 3 (hypermap_of_fan (V,E)) + /\ CARD (face (hypermap_of_fan (V,E)) d2) = 3 + /\ y6_fan d <= #2.52 /\ y5_fan (V,E) d <= #2.52 + /\ y6_fan d2 <= #2.52 /\ y5_fan (V,E) d2 <= #2.52 + /\ y4_fan (V,E) d <= ye_fan (FST d, FST d2) + /\ sqrt8 <= y4_fan (V,E) d /\ y4_fan (V,E) d <= &3 + ==> y5_fan (V,E) d + y6_fan d + y5_fan (V,E) d2 + y6_fan d2 - #7.99 + >= #2.75 * (y4_fan (V,E) d - sqrt8)` +[ + ((repeat_tactic 1 9 ((CONV_TAC let_CONV))) THEN (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (case THEN (move ["vw_in3"])) THEN (case THEN (move ["card_f2"])) THEN (move ["bounds"]))); + ((fun arg_tac -> arg_tac (Arg_term (`inverse _1 _2`))) (term_tac (set_tac "d2"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E w' w`))) (term_tac (set_tac "u"))); + ((((use_arg_then2 ("vw_in3", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"]))); + ((((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["vw_in1"]))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair3", [f_fan_pair3])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (move ["f_eq1"])); + ((fun arg_tac -> arg_tac (Arg_term (`d2 = u,w'`))) (term_tac (have_gen_tac [](move ["d2_eq"])))); + ((((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("f_eq1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_fan_pair_ext", [e_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("e_fan_pair", [e_fan_pair]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("u_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`d2 IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["d2_in1"])))); + ((((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("INVERSE_F_IN_DART1_OF_FAN", [INVERSE_F_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("d2_in1", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (move ["d2_in"]))); + ((fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) d2 = dist (w, u)`))) (term_tac (have_gen_tac [](move ["y5_eq2"])))); + ((((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pair_expand", [pair_expand]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [2] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d2_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("d2_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (congr_tac (`dist (_1, u)`))); + ((fun arg_tac -> arg_tac (Arg_term (`inverse (f_fan_pair_ext (V,E)) d2 = (f_fan_pair_ext (V,E) POWER 2) d2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_fan_pair_ext_power_inverse))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f2", []))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d2_in1", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`3 - 2 = 1`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES", [PERMUTES_INVERSES])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("f_eq1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_fan_pair_ext", [e_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("e_fan_pair", [e_fan_pair]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Lp_details.LEMMA_8673686234", [Lp_details.LEMMA_8673686234])) (fun fst_arg -> (use_arg_then2 ("ineq1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq_a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq_b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq_c", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y4_fan (V,E) (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) d2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`ye_fan (v,u)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan d2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (ANTS_TAC)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#3.0 = &3 /\ &2 * h0 = #2.52`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d2_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + ((THENL) (split_tac) [(((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)); ((((use_arg_then2 ("ye_fan", [ye_fan]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("DIST_TRIANGLE_LE", [DIST_TRIANGLE_LE])) (thm_tac apply_tac)))]); + (((fun arg_tac -> arg_tac (Arg_term (`y4_fan (V,E) (v,w)`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("bounds", [])) (disch_tac [])) THEN (clear_assumption "bounds") THEN BETA_TAC) THEN (((((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] [])))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (term_tac exists_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DIST_0", [DIST_0]))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`v IN ball_annulus /\ u IN ball_annulus`))) (term_tac (have_gen_tac []ALL_TAC)))) ((repeat_tactic 1 9 (((use_arg_then2 ("Fnjlbxs.in_ball_annulus", [Fnjlbxs.in_ball_annulus]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("subV", [])) (disch_tac [])) THEN (clear_assumption "subV") THEN BETA_TAC) THEN ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["subV"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("subV", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("d2_in", [])) (disch_tac [])) THEN (clear_assumption "d2_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) case ((arith_tac) THEN (done_tac))); + ((THENL_LAST) case ((((use_arg_then2 ("real_lt", [real_lt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bounds", [])) (disch_tac [])) THEN (clear_assumption "bounds") THEN BETA_TAC) THEN (((((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] [])))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac) THEN (move ["_"])) THEN (((use_arg_then2 ("REAL_NOT_LT", [REAL_NOT_LT]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("delta_y", [delta_y]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("DELTA_EQ_DELTA_X", [DELTA_EQ_DELTA_X]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y5_eq2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ye_fan", [ye_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y6_fan", [y6_fan]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("y4_fan", [y4_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("f_eq1", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("u", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("Collect_geom.DELTA_POS_4POINTS", [Collect_geom.DELTA_POS_4POINTS]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; +(Sections.add_section_var (mk_var ("g", (`:num#num -> real^3#real^3`))));; +(Sections.add_section_var (mk_var ("h", (`:num -> real^3`))));; +(Sections.add_section_var (mk_var ("L", (`:((num)list)list`))));; +(Sections.add_section_hyp "goodL" (`good_list L`));; +(Sections.add_section_hyp "g_iso" (`hyp_iso g (hypermap_of_list L, hypermap_of_fan (V,E))`));; +(Sections.add_section_hyp "g_eq" (`!d. g d = h (FST d), h (SND d)`));; + +(* Lemma yapex_sup_flat_list *) +let yapex_sup_flat_list = Sections.section_proof [] +`ALL (\d. let d2 = inverse (f_list_ext L) (e_list (f_list_ext L d)) in + LENGTH (find_face L d2) = 3 + /\ ye_list g d <= #2.52 /\ ye_list g (inverse (f_list_ext L) d) <= #2.52 + /\ ye_list g d2 <= #2.52 /\ ye_list g (f_list_ext L (e_list (f_list_ext L d))) <= #2.52 + /\ ye_list g (f_list_ext L d) <= ye_list g (FST d, FST d2) + /\ sqrt8 <= ye_list g (f_list_ext L d) /\ ye_list g (f_list_ext L d) <= &3 + ==> y5_list (g,V,E) d + y6_list g d + y5_list (g,V,E) d2 + y6_list g d2 - #7.99 + >= #2.75 * (y4_list (g,V,E) d - sqrt8)) (list_of_darts3 L)` +[ + (((((use_arg_then2 ("ALL_MEM", [ALL_MEM]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["d"]) THEN (move ["mem_d"]) THEN (simp_tac)) THEN (CONV_TAC let_CONV) THEN (BETA_TAC THEN (case THEN (move ["size_f"])) THEN (move ["cond"]))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["hypH"]))); + ((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["hypL"]))); + ((((use_arg_then2 ("mem_d", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("darts3_eq_list_of_darts3", [darts3_eq_list_of_darts3]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["d_in"]) THEN (move ["card_f"])))); + ((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE yapex_sup_flat_fan))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`g d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> arg_tac (Arg_term (`inverse (f_list_ext L) _`))) (term_tac (set_tac "d2"))); + ((fun arg_tac -> arg_tac (Arg_term (`f_list_ext L d`))) (term_tac (set_tac "d'"))); + ((fun arg_tac -> arg_tac (Arg_term (`d' IN darts_of_list L`))) (term_tac (have_gen_tac [](move ["d'_in"])))); + (((((use_arg_then2 ("d'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("hypL", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`e_list_ext L d' = e_list d'`))) (term_tac (have_gen_tac [](move ["e_list_eq"])))) (((((use_arg_then2 ("e_list_ext", [e_list_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hypL", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`d2 IN dart (hypermap_of_list L)`))) (term_tac (have_gen_tac [](move ["d2_in"])))); + (((((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("e_list_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("hypL", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("lemma_dart_inveriant_under_inverse_maps", [lemma_dart_inveriant_under_inverse_maps]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`inverse _1 _2`))) (term_tac (set_tac "x2"))); + ((fun arg_tac -> arg_tac (Arg_term (`x2 = g d2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("x2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("hypH", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("hyp_iso_comm", [hyp_iso_comm])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("hyp_iso_inverse_comm", [hyp_iso_inverse_comm])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((use_arg_then2 ("x2_def", [])) (disch_tac [])) THEN (clear_assumption "x2_def") THEN BETA_TAC THEN (move ["_"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("list_defs_th", [list_defs_th]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN (DISCH_THEN apply_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`CARD (face (hypermap_of_fan (V,E)) (g d2)) = 3`))) (term_tac (have_gen_tac [](move ["card_f2"])))); + ((((fun arg_tac -> (use_arg_then2 ("hyp_iso_card_components", [hyp_iso_card_components])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("card_face_of_list", [card_face_of_list]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("Seq.size", [Seq.size]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hypL", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("card_f2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_card_components", [hyp_iso_card_components])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("cond", [])) (disch_tac [])) THEN (clear_assumption "cond") THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("list_defs_th", [list_defs_th]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (move ["cond"]))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) (g d2) = ye_fan (g (f_list_ext L (e_list d')))`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("y6_fan", [y6_fan]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y4_fan", [y4_fan]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ye_fan", [ye_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("hypH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_inverse_comm", [hyp_iso_inverse_comm])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("hypL", []))(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("cond", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_comm", [hyp_iso_comm])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("hypL", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d'_def", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cond", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`FST (g d), FST (g d2) = g (FST d, FST d2)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((ALL_TAC) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("g_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> arg_tac (Arg_term (`inverse (f_fan_pair_ext (V,E)) (g d2) = (f_fan_pair_ext (V,E) POWER 2) (g d2)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f2", []))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("hypH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`3 - 2 = 1`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("hypH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_comm_power", [hyp_iso_comm_power])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hypL", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES", [PERMUTES_INVERSES])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`darts_of_list L`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("hypL", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("face_map_and_darts", [face_map_and_darts]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ye_fan", [ye_fan]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Yapex_sup_flat *) +let yapex_sup_flat_fan = Sections.finalize_theorem yapex_sup_flat_fan;; +let yapex_sup_flat_list = Sections.finalize_theorem yapex_sup_flat_list;; +Sections.end_section "Yapex_sup_flat";; + +(* Section Std3_small *) +Sections.begin_section "Std3_small";; + +(* Lemma extra_ineqs_std3_small *) +let extra_ineqs_std3_small = Sections.section_proof ["d"] +`d IN darts_k 3 (hypermap_of_fan (V,E)) + ==> y4_fan (V,E) d + y5_fan (V,E) d + y6_fan d <= #6.25 + ==> y4_fan (V,E) d <= #2.25 /\ y5_fan (V,E) d <= #2.25 /\ y6_fan d <= #2.25` +[ + (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"])); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`&2 <= y4_fan (V,E) d /\ &2 <= y5_fan (V,E) d /\ &2 <= y6_fan d`))) (term_tac (have_gen_tac []ALL_TAC)))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("y4_lo", [y4_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Std3_small *) +let extra_ineqs_std3_small = Sections.finalize_theorem extra_ineqs_std3_small;; +Sections.end_section "Std3_small";; + +(* Section Std3_big *) +Sections.begin_section "Std3_big";; + +(* Lemma extra_ineq_std3_big *) +let extra_ineq_std3_big = Sections.section_proof ["d"] +`d IN darts_k 3 (hypermap_of_fan (V,E)) + ==> #2.25 <= ye_fan d + ==> #6.25 <= y4_fan (V,E) d + y5_fan (V,E) d + y6_fan d` +[ + (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"])); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`&2 <= y4_fan (V,E) d /\ &2 <= y5_fan (V,E) d /\ &2 <= y6_fan d`))) (term_tac (have_gen_tac []ALL_TAC)))); + (((((use_arg_then2 ("y6_fan", [y6_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ye_fan", [ye_fan]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then2 ("y4_lo", [y4_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Ineq77 *) +Sections.begin_section "Ineq77";; +(Sections.add_section_hyp "ineq" ((hd (Ineq.getexact "8611785756")).ineq));; + +(* Lemma ineq77 *) +let ineq77 = Sections.section_proof ["d"] +`d IN darts_k 3 (hypermap_of_fan (V,E)) + ==> y1_fan d <= #2.18 /\ y2_fan d <= #2.18 /\ y3_fan (V,E) d <= #2.18 + /\ y4_fan (V,E) d <= #2.52 /\ y5_fan (V,E) d <= #2.52 /\ y6_fan d <= #2.52 + /\ #6.25 <= y4_fan (V,E) d + y5_fan (V,E) d + y6_fan d + ==> (sol_fan (V,E) (face (hypermap_of_fan (V,E)) d) - #0.589) + + #0.24 * (y1_fan d + y2_fan d + y3_fan (V,E) d - #6.0) + - #0.16 * (y4_fan (V,E) d + y5_fan (V,E) d + y6_fan d - #6.25) >= &0` +[ + ((BETA_TAC THEN (move ["d_in3"]) THEN (move ["bounds"])) THEN ((((use_arg_then2 ("real_ge", [real_ge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`dart1_of_fan (V,E) = dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["dart1_eq"])))); + ((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("d_in3", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + ((((use_arg_then2 ("dart3_sol_fan_eq_sol", [dart3_sol_fan_eq_sol]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq", [ineq])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y1_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y2_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y3_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y4_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#0.0 = &0 /\ #2.0 = &2 /\ #8.0 = &8 /\ #3.0 = &3`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("Ineq.dart_std3_big_200_218", [Ineq.dart_std3_big_200_218]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (ANTS_TAC)); + (((repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4_lo", [y4_lo]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("real_lt", [real_lt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Std *) +Sections.begin_section "Std";; +(Sections.add_section_hyp "std" (`E = ESTD V`));; + +(* Lemma ineq77_std *) +let ineq77_std = Sections.section_proof ["d"] +`d IN darts_k 3 (hypermap_of_fan (V,E)) + ==> y1_fan d <= #2.18 /\ y2_fan d <= #2.18 /\ y3_fan (V,E) d <= #2.18 + /\ #6.25 <= y4_fan (V,E) d + y5_fan (V,E) d + y6_fan d + ==> (sol_fan (V,E) (face (hypermap_of_fan (V,E)) d) - #0.589) + + #0.24 * (y1_fan d + y2_fan d + y3_fan (V,E) d - #6.0) + - #0.16 * (y4_fan (V,E) d + y5_fan (V,E) d + y6_fan d - #6.25) >= &0` +[ + ((BETA_TAC THEN (move ["d_in3"]) THEN (move ["bounds"])) THEN (((fun arg_tac -> (use_arg_then2 ("ineq77", [ineq77])) (fun fst_arg -> (use_arg_then2 ("d_in3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + ((((use_arg_then2 ("d_in3", [])) (disch_tac [])) THEN (clear_assumption "d_in3") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + (((repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y4_hi_std2", [y4_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_hi_std2", [y5_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Std *) +let ineq77_std = Sections.finalize_theorem ineq77_std;; +Sections.end_section "Std";; + +(* Finalization of the section Ineq77 *) +let ineq77 = Sections.finalize_theorem ineq77;; +let ineq77_std = Sections.finalize_theorem ineq77_std;; +Sections.end_section "Ineq77";; + +(* Section Ineq89 *) +Sections.begin_section "Ineq89";; +(Sections.add_section_hyp "ineq" ((hd (Ineq.getexact "6224332984")).ineq));; + +(* Lemma ineq89 *) +let ineq89 = Sections.section_proof ["d"] +`d IN darts_k 3 (hypermap_of_fan (V,E)) + ==> y4_fan (V,E) d <= #2.52 /\ y5_fan (V,E) d <= #2.52 /\ y6_fan d <= #2.52 + /\ #6.25 <= y4_fan (V,E) d + y5_fan (V,E) d + y6_fan d + ==> (sol_fan (V,E) (face (hypermap_of_fan (V,E)) d) - #0.589) + + #0.39 * (y1_fan d + y2_fan d + y3_fan (V,E) d - #6.0) + - #0.235 * (y4_fan (V,E) d + y5_fan (V,E) d + y6_fan d - #6.25) >= &0` +[ + ((BETA_TAC THEN (move ["d_in3"]) THEN (move ["bounds"])) THEN ((((use_arg_then2 ("real_ge", [real_ge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`dart1_of_fan (V,E) = dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["dart1_eq"])))); + ((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("d_in3", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + ((((use_arg_then2 ("dart3_sol_fan_eq_sol", [dart3_sol_fan_eq_sol]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq", [ineq])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y1_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y2_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y3_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y4_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#0.0 = &0 /\ #2.0 = &2 /\ #8.0 = &8 /\ #3.0 = &3`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("Ineq.dart_std3_big", [Ineq.dart_std3_big]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ineq.dart_std3", [Ineq.dart_std3]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (ANTS_TAC)); + ((repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4_lo", [y4_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("real_lt", [real_lt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Std *) +Sections.begin_section "Std";; +(Sections.add_section_hyp "std" (`E = ESTD V`));; + +(* Lemma ineq89_std *) +let ineq89_std = Sections.section_proof ["d"] +`d IN darts_k 3 (hypermap_of_fan (V,E)) + ==> #6.25 <= y4_fan (V,E) d + y5_fan (V,E) d + y6_fan d + ==> (sol_fan (V,E) (face (hypermap_of_fan (V,E)) d) - #0.589) + + #0.39 * (y1_fan d + y2_fan d + y3_fan (V,E) d - #6.0) + - #0.235 * (y4_fan (V,E) d + y5_fan (V,E) d + y6_fan d - #6.25) >= &0` +[ + ((BETA_TAC THEN (move ["d_in3"]) THEN (move ["bounds"])) THEN (((fun arg_tac -> (use_arg_then2 ("ineq89", [ineq89])) (fun fst_arg -> (use_arg_then2 ("d_in3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + ((((use_arg_then2 ("d_in3", [])) (disch_tac [])) THEN (clear_assumption "d_in3") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + (((repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y4_hi_std2", [y4_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_hi_std2", [y5_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Std *) +let ineq89_std = Sections.finalize_theorem ineq89_std;; +Sections.end_section "Std";; + +(* Finalization of the section Ineq89 *) +let ineq89 = Sections.finalize_theorem ineq89;; +let ineq89_std = Sections.finalize_theorem ineq89_std;; +Sections.end_section "Ineq89";; + +(* Section Ineq90 *) +Sections.begin_section "Ineq90";; +(Sections.add_section_hyp "h_tau" (`lp_tau (V,E)`));; +(Sections.add_section_hyp "ineq" ((hd (Ineq.getexact "7761782916")).ineq));; + +(* Lemma ineq90 *) +let ineq90 = Sections.section_proof ["d"] +`d IN darts_k 3 (hypermap_of_fan (V,E)) + ==> y4_fan (V,E) d <= #2.52 /\ y5_fan (V,E) d <= #2.52 /\ y6_fan d <= #2.52 + /\ #6.25 <= y4_fan (V,E) d + y5_fan (V,E) d + y6_fan d + ==> (tau_fan (V,E) (face (hypermap_of_fan (V,E)) d) - #0.05) + - #0.137 * (y1_fan d + y2_fan d + y3_fan (V,E) d - #6.0) + - #0.17 * (y4_fan (V,E) d + y5_fan (V,E) d + y6_fan d - #6.25) >= &0` +[ + ((BETA_TAC THEN (move ["d_in3"]) THEN (move ["bounds"])) THEN ((((use_arg_then2 ("real_ge", [real_ge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`dart1_of_fan (V,E) = dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["dart1_eq"])))); + ((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("d_in3", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + ((((use_arg_then2 ("dart3_tau_fan_eq_taum", [dart3_tau_fan_eq_taum]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq", [ineq])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y1_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y2_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y3_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y4_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#2.0 = &2 /\ #0.0 = &0`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("Ineq.dart_std3_big", [Ineq.dart_std3_big]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ineq.dart_std3", [Ineq.dart_std3]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (ANTS_TAC)); + ((repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4_lo", [y4_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("real_lt", [real_lt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Std *) +Sections.begin_section "Std";; +(Sections.add_section_hyp "std" (`E = ESTD V`));; + +(* Lemma ineq90_std *) +let ineq90_std = Sections.section_proof ["d"] +`d IN darts_k 3 (hypermap_of_fan (V,E)) + ==> #6.25 <= y4_fan (V,E) d + y5_fan (V,E) d + y6_fan d + ==> (tau_fan (V,E) (face (hypermap_of_fan (V,E)) d) - #0.05) + - #0.137 * (y1_fan d + y2_fan d + y3_fan (V,E) d - #6.0) + - #0.17 * (y4_fan (V,E) d + y5_fan (V,E) d + y6_fan d - #6.25) >= &0` +[ + ((BETA_TAC THEN (move ["d_in3"]) THEN (move ["bounds"])) THEN (((fun arg_tac -> (use_arg_then2 ("ineq90", [ineq90])) (fun fst_arg -> (use_arg_then2 ("d_in3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + ((((use_arg_then2 ("d_in3", [])) (disch_tac [])) THEN (clear_assumption "d_in3") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + (((repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y4_hi_std2", [y4_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_hi_std2", [y5_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Std *) +let ineq90_std = Sections.finalize_theorem ineq90_std;; +Sections.end_section "Std";; + +(* Finalization of the section Ineq90 *) +let ineq90 = Sections.finalize_theorem ineq90;; +let ineq90_std = Sections.finalize_theorem ineq90_std;; +Sections.end_section "Ineq90";; + +(* Finalization of the section Std3_big *) +let extra_ineq_std3_big = Sections.finalize_theorem extra_ineq_std3_big;; +let ineq77 = Sections.finalize_theorem ineq77;; +let ineq77_std = Sections.finalize_theorem ineq77_std;; +let ineq89 = Sections.finalize_theorem ineq89;; +let ineq89_std = Sections.finalize_theorem ineq89_std;; +let ineq90 = Sections.finalize_theorem ineq90;; +let ineq90_std = Sections.finalize_theorem ineq90_std;; +Sections.end_section "Std3_big";; + +(* Section Ineq71 *) +Sections.begin_section "Ineq71";; +(Sections.add_section_hyp "h_fan" (`lp_fan (V,E)`));; +(Sections.add_section_hyp "ineq" ((hd (Ineq.getexact "181212899 5")).ineq));; + +(* Lemma ineq71 *) +let ineq71 = Sections.section_proof ["d"] +`d IN darts_k 5 (hypermap_of_fan (V,E)) + ==> #2.52 <= y5_fan (V,E) d /\ y5_fan (V,E) d <= sqrt8 + /\ y6_fan d <= #2.52 + ==> (azim_dart (V,E) d - #1.448) + - #0.266 * (y1_fan d - &2) + #0.295 * (y3_fan (V,E) d - &2) + + #0.57 * (y2_fan d - &2) - #0.745 * (#2.52 - #2.52) + + #0.268 * (y6_fan d - &2) + #0.385 * (y5_fan (V,E) d - #2.52) >= &0` +[ + ((BETA_TAC THEN (move ["d_in5"]) THEN (move ["bounds"])) THEN ((((use_arg_then2 ("real_ge", [real_ge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`dart1_of_fan (V,E) = dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["dart1_eq"])))); + ((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("d_in5", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + ((((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`#0.295 * _1 + _2`))) (term_tac (set_tac "s2"))); + ((fun arg_tac -> arg_tac (Arg_term (`_1 * _2`))) (term_tac (set_tac "s1"))); + (((use_arg_then2 ("REAL_LTE_TRANS", [REAL_LTE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LTE_TRANS") THEN (DISCH_THEN apply_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(dih_y (y1_fan d) (y2_fan d) (y3_fan (V,E) d) (#2.52) + (y5_fan (V,E) d) (y6_fan d) - #1.448) - s1 + s2`))) (term_tac exists_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#0.0 = &0 /\ #2.0 = &2 /\ #8.0 = &8 /\ #3.0 = &3`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((arith_tac) THEN (done_tac))); + (split_tac); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq", [ineq])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y1_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y2_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y3_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`#2.52`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("Ineq.apexff5", [Ineq.apexff5]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("s1_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN apply_tac)); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_RADD", [REAL_LE_RADD]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dih_y_mono_le4", [dih_y_mono_le4]))(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("fan_ups_x_pos", [fan_ups_x_pos])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fan_delta_y_pos", [fan_delta_y_pos]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((THENL_FIRST) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("y4'_lo_2h0", [y4'_lo_2h0])) (fun fst_arg -> (use_arg_then2 ("d_in5", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((split_tac) THEN (simp_tac)) ((arith_tac) THEN (done_tac))); + (((use_arg_then2 ("Delta_ineq.delta_y_pos_apex", [Delta_ineq.delta_y_pos_apex]))(thm_tac (new_rewrite [] [])))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x <= sqrt8 ==> x <= &3`))) (term_tac (have_gen_tac ["x"](move ["ineq1"])))) ((((use_arg_then2 ("Flyspeck_constants.bounds", [Flyspeck_constants.bounds])) (disch_tac [])) THEN (clear_assumption "Flyspeck_constants.bounds") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x <= #2.52 ==> x <= &3`))) (term_tac (have_gen_tac ["x"](move ["ineq2"])))) ((arith_tac) THEN (done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("ineq1", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ineq2", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section Ineq71 *) +let ineq71 = Sections.finalize_theorem ineq71;; +Sections.end_section "Ineq71";; + +(* Section Ineq72 *) +Sections.begin_section "Ineq72";; +(Sections.add_section_hyp "h_fan" (`lp_fan (V,E)`));; +(Sections.add_section_hyp "ineq" ((hd (Ineq.getexact "181212899 4")).ineq));; + +(* Lemma ineq72 *) +let ineq72 = Sections.section_proof ["d"] +`d IN darts_k 5 (hypermap_of_fan (V,E)) + ==> #2.52 <= y6_fan d /\ y6_fan d <= sqrt8 + /\ y5_fan (V,E) d <= #2.52 + ==> (azim_dart (V,E) d - #1.448) + - #0.266 * (y1_fan d - &2) + #0.295 * (y2_fan d - &2) + + #0.57 * (y3_fan (V,E) d - &2) - #0.745 * (#2.52 - #2.52) + + #0.268 * (y5_fan (V,E) d - &2) + #0.385 * (y6_fan d - #2.52) >= &0` +[ + ((BETA_TAC THEN (move ["d_in5"]) THEN (move ["bounds"])) THEN ((((use_arg_then2 ("real_ge", [real_ge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`dart1_of_fan (V,E) = dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["dart1_eq"])))); + ((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("d_in5", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + ((((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`#0.295 * _1 + _2`))) (term_tac (set_tac "s2"))); + ((fun arg_tac -> arg_tac (Arg_term (`_1 * _2`))) (term_tac (set_tac "s1"))); + (((use_arg_then2 ("REAL_LTE_TRANS", [REAL_LTE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LTE_TRANS") THEN (DISCH_THEN apply_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(dih_y (y1_fan d) (y2_fan d) (y3_fan (V,E) d) (#2.52) + (y5_fan (V,E) d) (y6_fan d) - #1.448) - s1 + s2`))) (term_tac exists_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#0.0 = &0 /\ #2.0 = &2 /\ #8.0 = &8 /\ #3.0 = &3`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((arith_tac) THEN (done_tac))); + (split_tac); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq", [ineq])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y1_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y2_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y3_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`#2.52`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("Ineq.apexf5", [Ineq.apexf5]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("s1_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN apply_tac)); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y5_lo", [y5_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_RADD", [REAL_LE_RADD]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dih_y_mono_le4", [dih_y_mono_le4]))(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("fan_ups_x_pos", [fan_ups_x_pos])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fan_delta_y_pos", [fan_delta_y_pos]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((THENL_FIRST) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("y4'_lo_2h0", [y4'_lo_2h0])) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in5", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((split_tac) THEN (simp_tac)) ((((use_arg_then2 ("Flyspeck_constants.bounds", [Flyspeck_constants.bounds])) (disch_tac [])) THEN (clear_assumption "Flyspeck_constants.bounds") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((use_arg_then2 ("Delta_ineq.delta_y_pos_apex", [Delta_ineq.delta_y_pos_apex]))(thm_tac (new_rewrite [] [])))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x <= sqrt8 ==> x <= &3`))) (term_tac (have_gen_tac ["x"](move ["ineq1"])))) ((((use_arg_then2 ("Flyspeck_constants.bounds", [Flyspeck_constants.bounds])) (disch_tac [])) THEN (clear_assumption "Flyspeck_constants.bounds") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x <= #2.52 ==> x <= &3`))) (term_tac (have_gen_tac ["x"](move ["ineq2"])))) ((arith_tac) THEN (done_tac))); + ((THENL_LAST) ((((fun arg_tac -> (use_arg_then2 ("ineq2", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ineq1", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("Flyspeck_constants.bounds", [Flyspeck_constants.bounds])) (disch_tac [])) THEN (clear_assumption "Flyspeck_constants.bounds") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section Ineq72 *) +let ineq72 = Sections.finalize_theorem ineq72;; +Sections.end_section "Ineq72";; + +(* Section Ineq73 *) +Sections.begin_section "Ineq73";; +(Sections.add_section_hyp "ineq" ((hd (Ineq.getexact "181212899 3")).ineq));; + +(* Lemma ineq73 *) +let ineq73 = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> #2.52 <= y5_fan (V,E) d /\ y5_fan (V,E) d <= sqrt8 + /\ y6_fan d <= #2.52 + /\ sqrt8 <= y4'_fan (V,E) d + ==> (azim_dart (V,E) d - #1.448) + - #0.266 * (y1_fan d - &2) + #0.295 * (y3_fan (V,E) d - &2) + + #0.57 * (y2_fan d - &2) - #0.745 * (sqrt8 - #2.52) + + #0.268 * (y6_fan d - &2) + #0.385 * (y5_fan (V,E) d - #2.52) >= &0` +[ + ((BETA_TAC THEN (move ["d_in4"]) THEN (move ["bounds"])) THEN ((((use_arg_then2 ("real_ge", [real_ge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`dart1_of_fan (V,E) = dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["dart1_eq"])))); + ((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + ((((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`#0.295 * _1 + _2`))) (term_tac (set_tac "s2"))); + ((fun arg_tac -> arg_tac (Arg_term (`_1 * _2`))) (term_tac (set_tac "s1"))); + (((use_arg_then2 ("REAL_LTE_TRANS", [REAL_LTE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LTE_TRANS") THEN (DISCH_THEN apply_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(dih_y (y1_fan d) (y2_fan d) (y3_fan (V,E) d) (sqrt8) + (y5_fan (V,E) d) (y6_fan d) - #1.448) - s1 + s2`))) (term_tac exists_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#0.0 = &0 /\ #2.0 = &2 /\ #8.0 = &8 /\ #3.0 = &3`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((arith_tac) THEN (done_tac))); + (split_tac); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq", [ineq])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y1_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y2_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y3_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sqrt8`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("Ineq.apexff4", [Ineq.apexff4]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("s1_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN apply_tac)); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_RADD", [REAL_LE_RADD]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dih_y_mono_le4", [dih_y_mono_le4]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("fan_ups_x_pos", [fan_ups_x_pos])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fan_delta_y_pos", [fan_delta_y_pos]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((THENL_FIRST) ((split_tac) THEN (simp_tac)) ((((use_arg_then2 ("Flyspeck_constants.bounds", [Flyspeck_constants.bounds])) (disch_tac [])) THEN (clear_assumption "Flyspeck_constants.bounds") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((use_arg_then2 ("Delta_ineq.delta_y_pos_apex", [Delta_ineq.delta_y_pos_apex]))(thm_tac (new_rewrite [] [])))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x <= sqrt8 ==> x <= &3`))) (term_tac (have_gen_tac ["x"](move ["ineq1"])))) ((((use_arg_then2 ("Flyspeck_constants.bounds", [Flyspeck_constants.bounds])) (disch_tac [])) THEN (clear_assumption "Flyspeck_constants.bounds") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x <= #2.52 ==> x <= &3`))) (term_tac (have_gen_tac ["x"](move ["ineq2"])))) ((arith_tac) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("ineq2", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ineq1", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("Flyspeck_constants.bounds", [Flyspeck_constants.bounds])) (disch_tac [])) THEN (clear_assumption "Flyspeck_constants.bounds") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section Ineq73 *) +let ineq73 = Sections.finalize_theorem ineq73;; +Sections.end_section "Ineq73";; + +(* Section Ineq74 *) +Sections.begin_section "Ineq74";; +(Sections.add_section_hyp "ineq" ((hd (Ineq.getexact "181212899 2")).ineq));; + +(* Lemma ineq74 *) +let ineq74 = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> #2.52 <= y6_fan d /\ y6_fan d <= sqrt8 + /\ y5_fan (V,E) d <= #2.52 + /\ sqrt8 <= y4'_fan (V,E) d + ==> (azim_dart (V,E) d - #1.448) + - #0.266 * (y1_fan d - &2) + #0.295 * (y2_fan d - &2) + + #0.57 * (y3_fan (V,E) d - &2) - #0.745 * (sqrt8 - #2.52) + + #0.268 * (y5_fan (V,E) d - &2) + #0.385 * (y6_fan d - #2.52) >= &0` +[ + ((BETA_TAC THEN (move ["d_in4"]) THEN (move ["bounds"])) THEN ((((use_arg_then2 ("real_ge", [real_ge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`dart1_of_fan (V,E) = dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["dart1_eq"])))); + ((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + ((((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`#0.295 * _1 + _2`))) (term_tac (set_tac "s2"))); + ((fun arg_tac -> arg_tac (Arg_term (`_1 * _2`))) (term_tac (set_tac "s1"))); + (((use_arg_then2 ("REAL_LTE_TRANS", [REAL_LTE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LTE_TRANS") THEN (DISCH_THEN apply_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(dih_y (y1_fan d) (y2_fan d) (y3_fan (V,E) d) (sqrt8) + (y5_fan (V,E) d) (y6_fan d) - #1.448) - s1 + s2`))) (term_tac exists_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#0.0 = &0 /\ #2.0 = &2 /\ #8.0 = &8 /\ #3.0 = &3`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((arith_tac) THEN (done_tac))); + (split_tac); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq", [ineq])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y1_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y2_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y3_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sqrt8`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("Ineq.apexf4", [Ineq.apexf4]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("s1_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN apply_tac)); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y5_lo", [y5_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_RADD", [REAL_LE_RADD]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dih_y_mono_le4", [dih_y_mono_le4]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("fan_ups_x_pos", [fan_ups_x_pos])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fan_delta_y_pos", [fan_delta_y_pos]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((THENL_FIRST) ((split_tac) THEN (simp_tac)) ((((use_arg_then2 ("Flyspeck_constants.bounds", [Flyspeck_constants.bounds])) (disch_tac [])) THEN (clear_assumption "Flyspeck_constants.bounds") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((use_arg_then2 ("Delta_ineq.delta_y_pos_apex", [Delta_ineq.delta_y_pos_apex]))(thm_tac (new_rewrite [] [])))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x <= sqrt8 ==> x <= &3`))) (term_tac (have_gen_tac ["x"](move ["ineq1"])))) ((((use_arg_then2 ("Flyspeck_constants.bounds", [Flyspeck_constants.bounds])) (disch_tac [])) THEN (clear_assumption "Flyspeck_constants.bounds") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x <= #2.52 ==> x <= &3`))) (term_tac (have_gen_tac ["x"](move ["ineq2"])))) ((arith_tac) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("ineq2", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ineq1", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("Flyspeck_constants.bounds", [Flyspeck_constants.bounds])) (disch_tac [])) THEN (clear_assumption "Flyspeck_constants.bounds") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section Ineq74 *) +let ineq74 = Sections.finalize_theorem ineq74;; +Sections.end_section "Ineq74";; + +(* Section Ineq104 *) +Sections.begin_section "Ineq104";; +(Sections.add_section_hyp "ineq" ((hd (Ineq.getexact "9995621667")).ineq));; + +(* Lemma ineq104 *) +let ineq104 = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> &3 <= y4'_fan (V,E) d /\ y5_fan (V,E) d <= #2.52 /\ y6_fan d <= #2.52 + ==> (azim_dart (V,E) d - #2.09) + + #0.578 * (y2_fan d + y3_fan (V,E) d + y5_fan (V,E) d + y6_fan d - &8) + - #0.54 * (y1_fan d - &2) >= &0` +[ + ((BETA_TAC THEN (move ["d_in4"]) THEN (move ["bounds"])) THEN ((((use_arg_then2 ("real_ge", [real_ge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`dart1_of_fan (V,E) = dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["dart1_eq"])))); + ((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + ((((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`_1 * _2 - _3`))) (term_tac (set_tac "s"))); + (((use_arg_then2 ("REAL_LTE_TRANS", [REAL_LTE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LTE_TRANS") THEN (DISCH_THEN apply_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(dih_y (y1_fan d) (y2_fan d) (y3_fan (V,E) d) (&3) + (y5_fan (V,E) d) (y6_fan d) - #2.09) + s`))) (term_tac exists_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#0.0 = &0 /\ #2.0 = &2 /\ #8.0 = &8 /\ #3.0 = &3`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((arith_tac) THEN (done_tac))); + (split_tac); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq", [ineq])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y1_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y2_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y3_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("Ineq.dart4_diag3", [Ineq.dart4_diag3]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("s_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN apply_tac)); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_RADD", [REAL_LE_RADD]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dih_y_mono_le4", [dih_y_mono_le4]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("fan_ups_x_pos", [fan_ups_x_pos])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fan_delta_y_pos", [fan_delta_y_pos]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((THENL_FIRST) ((split_tac) THEN (simp_tac)) ((arith_tac) THEN (done_tac))); + (((use_arg_then2 ("Delta_ineq.delta_y_pos_apex", [Delta_ineq.delta_y_pos_apex]))(thm_tac (new_rewrite [] [])))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x <= #2.52 ==> x <= &3`))) (term_tac (have_gen_tac ["x"](move ["ineq2"])))) ((arith_tac) THEN (done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("ineq2", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Section Std *) +Sections.begin_section "Std";; +(Sections.add_section_hyp "std" (`E = ESTD V`));; + +(* Lemma ineq104_std *) +let ineq104_std = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> &3 <= y4'_fan (V,E) d + ==> (azim_dart (V,E) d - #2.09) + + #0.578 * (y2_fan d + y3_fan (V,E) d + y5_fan (V,E) d + y6_fan d - &8) + - #0.54 * (y1_fan d - &2) >= &0` +[ + ((BETA_TAC THEN (move ["d_in4"]) THEN (move ["bounds"])) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq104", [ineq104])) (fun fst_arg -> (use_arg_then2 ("d_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + ((((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN (clear_assumption "d_in4") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + (((((use_arg_then2 ("y5_hi_std2", [y5_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Std *) +let ineq104_std = Sections.finalize_theorem ineq104_std;; +Sections.end_section "Std";; + +(* Finalization of the section Ineq104 *) +let ineq104 = Sections.finalize_theorem ineq104;; +let ineq104_std = Sections.finalize_theorem ineq104_std;; +Sections.end_section "Ineq104";; + +(* Section Ineq105 *) +Sections.begin_section "Ineq105";; +(Sections.add_section_hyp "ineq" ((hd (Ineq.getexact "9414951439")).ineq));; + +(* Lemma ineq105 *) +let ineq105 = Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) + ==> sqrt8 <= y4'_fan (V,E) d /\ y5_fan (V,E) d <= #2.52 /\ y6_fan d <= #2.52 + ==> (azim_dart (V,E) d - #1.91) + + #0.458 * (y2_fan d + y3_fan (V,E) d + y5_fan (V,E) d + y6_fan d - &8) + - #0.342 * (y1_fan d - &2) >= &0` +[ + ((BETA_TAC THEN (move ["d_in"]) THEN (move ["bounds"])) THEN ((((use_arg_then2 ("real_ge", [real_ge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`_1 * _2 - _3`))) (term_tac (set_tac "s"))); + (((use_arg_then2 ("REAL_LTE_TRANS", [REAL_LTE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LTE_TRANS") THEN (DISCH_THEN apply_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(dih_y (y1_fan d) (y2_fan d) (y3_fan (V,E) d) sqrt8 + (y5_fan (V,E) d) (y6_fan d) - #1.91) + s`))) (term_tac exists_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#0.0 = &0 /\ #2.0 = &2 /\ #8.0 = &8`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((arith_tac) THEN (done_tac))); + (split_tac); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq", [ineq])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y1_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y2_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y3_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sqrt8`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("Ineq.dartY", [Ineq.dartY]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("s_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN apply_tac)); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_RADD", [REAL_LE_RADD]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dih_y_mono_le4", [dih_y_mono_le4]))(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("fan_ups_x_pos", [fan_ups_x_pos])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fan_delta_y_pos", [fan_delta_y_pos]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((split_tac) THEN (simp_tac)) ((((use_arg_then2 ("Flyspeck_constants.bounds", [Flyspeck_constants.bounds])) (disch_tac [])) THEN (clear_assumption "Flyspeck_constants.bounds") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((use_arg_then2 ("Delta_ineq.delta_y_pos_apex", [Delta_ineq.delta_y_pos_apex]))(thm_tac (new_rewrite [] [])))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x <= #2.52 ==> x <= &3`))) (term_tac (have_gen_tac ["x"](move ["ineq2"])))) ((arith_tac) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("ineq2", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("ineq2", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("Flyspeck_constants.bounds", [Flyspeck_constants.bounds])) (disch_tac [])) THEN (clear_assumption "Flyspeck_constants.bounds") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Section Std *) +Sections.begin_section "Std";; +(Sections.add_section_hyp "std" (`E = ESTD V`));; + +(* Lemma ineq105_std *) +let ineq105_std = Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) + ==> sqrt8 <= y4'_fan (V,E) d + ==> (azim_dart (V,E) d - #1.91) + + #0.458 * (y2_fan d + y3_fan (V,E) d + y5_fan (V,E) d + y6_fan d - &8) + - #0.342 * (y1_fan d - &2) >= &0` +[ + ((BETA_TAC THEN (move ["d_in"]) THEN (move ["bounds"])) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq105", [ineq105])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + (((((use_arg_then2 ("y5_hi_std2", [y5_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Std *) +let ineq105_std = Sections.finalize_theorem ineq105_std;; +Sections.end_section "Std";; + +(* Finalization of the section Ineq105 *) +let ineq105 = Sections.finalize_theorem ineq105;; +let ineq105_std = Sections.finalize_theorem ineq105_std;; +Sections.end_section "Ineq105";; + +(* Section Ineq106 *) +Sections.begin_section "Ineq106";; +(Sections.add_section_hyp "h_fan" (`lp_fan (V,E)`));; +(Sections.add_section_hyp "ineq" ((hd (Ineq.getexact "3020140039")).ineq));; + +(* Lemma ineq106 *) +let ineq106 = Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) + ==> 3 < CARD (face (hypermap_of_fan (V,E)) d) + /\ y5_fan (V,E) d <= #2.52 /\ y6_fan d <= #2.52 + ==> (azim_dart (V,E) d - #1.629) + + #0.402 * (y2_fan d + y3_fan (V,E) d + y5_fan (V,E) d + y6_fan d - &8) + - #0.315 * (y1_fan d - &2) >= &0` +[ + ((BETA_TAC THEN (move ["d_in"]) THEN (case THEN (move ["card_gt"])) THEN (move ["bounds"])) THEN ((((use_arg_then2 ("real_ge", [real_ge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`?k. d IN darts_k k (hypermap_of_fan (V,E)) /\ 3 < k`))) (term_tac (have_gen_tac [](case THEN ((move ["k"]) THEN (case THEN (move ["d_in_k"])) THEN (move ["k_gt"])))))); + ((fun arg_tac -> arg_tac (Arg_term (`CARD (face (hypermap_of_fan (V,E)) d)`))) (term_tac exists_tac)); + (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`_1 * _2 - _3`))) (term_tac (set_tac "s"))); + (((use_arg_then2 ("REAL_LTE_TRANS", [REAL_LTE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LTE_TRANS") THEN (DISCH_THEN apply_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(dih_y (y1_fan d) (y2_fan d) (y3_fan (V,E) d) (#2.52) + (y5_fan (V,E) d) (y6_fan d) - #1.629) + s`))) (term_tac exists_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#0.0 = &0 /\ #2.0 = &2 /\ #8.0 = &8`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((arith_tac) THEN (done_tac))); + (split_tac); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq", [ineq])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y1_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y2_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y3_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`#2.52`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("Ineq.dartX", [Ineq.dartX]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("s_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN apply_tac)); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_RADD", [REAL_LE_RADD]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dih_y_mono_le4", [dih_y_mono_le4]))(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("fan_ups_x_pos", [fan_ups_x_pos])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fan_delta_y_pos", [fan_delta_y_pos]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y4'_lo_2h0", [y4'_lo_2h0])) (fun fst_arg -> (use_arg_then2 ("k_gt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((THENL_FIRST) ((split_tac) THEN (simp_tac)) ((arith_tac) THEN (done_tac))); + (((use_arg_then2 ("Delta_ineq.delta_y_pos_apex", [Delta_ineq.delta_y_pos_apex]))(thm_tac (new_rewrite [] [])))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x <= #2.52 ==> x <= &3`))) (term_tac (have_gen_tac ["x"](move ["ineq2"])))) ((arith_tac) THEN (done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("ineq2", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Section Std *) +Sections.begin_section "Std";; +(Sections.add_section_hyp "std" (`E = ESTD V`));; + +(* Lemma ineq106_std *) +let ineq106_std = Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) + ==> 3 < CARD (face (hypermap_of_fan (V,E)) d) + ==> (azim_dart (V,E) d - #1.629) + + #0.402 * (y2_fan d + y3_fan (V,E) d + y5_fan (V,E) d + y6_fan d - &8) + - #0.315 * (y1_fan d - &2) >= &0` +[ + ((BETA_TAC THEN (move ["d_in"]) THEN (move ["card_gt"])) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq106", [ineq106])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_gt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + (((((use_arg_then2 ("y5_hi_std2", [y5_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Std *) +let ineq106_std = Sections.finalize_theorem ineq106_std;; +Sections.end_section "Std";; + +(* Finalization of the section Ineq106 *) +let ineq106 = Sections.finalize_theorem ineq106;; +let ineq106_std = Sections.finalize_theorem ineq106_std;; +Sections.end_section "Ineq106";; + +(* Section Crossdiag *) +Sections.begin_section "Crossdiag";; +(Sections.add_section_hyp "ineq" ((hd (Ineq.getexact "1085358243")).ineq));; + +(* Lemma crossdiag_fan *) +let crossdiag_fan = Sections.section_proof ["d"] +`let d2 = f_fan_pair_ext (V,E) (e_fan_pair_ext (V,E) d) in + let d' = inverse (f_fan_pair_ext (V,E)) d in + d IN darts_k 3 (hypermap_of_fan (V,E)) + /\ ye_fan d <= ye_fan (FST d', SND d2) + /\ sqrt8 <= ye_fan d /\ ye_fan d <= &3 + /\ y5_fan (V,E) d <= #2.52 /\ y6_fan d2 <= #2.52 + ==> (azim_dart (V,E) d + azim_dart (V,E) d2) - #1.903 + - #0.4 * (y1_fan d - &2) + + #0.49688 * (y2_fan d2 + y3_fan (V,E) d + y5_fan (V,E) d + y6_fan d2 - &8) + - (y4_fan (V,E) d' - sqrt8) >= &0` +[ + ((repeat_tactic 1 9 ((CONV_TAC let_CONV))) THEN (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["w"]) THEN (move ["w'"]) THEN (case THEN (move ["ww'_in3"])) THEN (case THEN (move ["diag_le"])) THEN (case THEN (move ["diag_lo"])) THEN (case THEN (move ["diag_hi"])) THEN (move ["bounds"]))); + ((fun arg_tac -> arg_tac (Arg_term (`f_fan_pair_ext _1 _2`))) (term_tac (set_tac "d2"))); + ((fun arg_tac -> arg_tac (Arg_term (`inverse _1 _2`))) (term_tac (set_tac "d'"))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (case THEN (move ["eH"])) THEN (case THEN (move ["nH"])) THEN (move ["fH"]))))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fan_delete_edge", [fan_delete_edge])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`{w,w'}`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["fan2"]))); + ((((use_arg_then2 ("ww'_in3", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("List_hypermap.darts_k", [List_hypermap.darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["ww'_in"])) THEN (move ["card3"]))); + ((fun arg_tac -> arg_tac (Arg_term (`SND d2`))) (term_tac (set_tac "v"))); + ((fun arg_tac -> arg_tac (Arg_term (`E DELETE {w,w'}`))) (term_tac (set_tac "E2"))); + ((fun arg_tac -> arg_tac (Arg_term (`d2 = w,v`))) (term_tac (have_gen_tac [](move ["d2_eq"])))); + ((((use_arg_then2 ("pair_expand", [pair_expand]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("v_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("e_fan_pair_ext", [e_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ww'_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("e_fan_pair", [e_fan_pair]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ww'_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`d2 IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["d2_in1"])))); + (((((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E w v = w'`))) (term_tac (have_gen_tac [](move ["w'_eq"])))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`n_fan_pair_ext (V,E) d2 = (w,w')`))) (term_tac (have_gen_tac []ALL_TAC)))); + ((((((use_arg_then2 ("n_fan_pair_ext", [n_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_fan_pair", [n_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"]))) THEN (done_tac)); + ((((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`face_map _`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`node_map _`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("hypermap_cyclic", [hypermap_cyclic]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`d2 IN dart1_of_fan (V,E2)`))) (term_tac (have_gen_tac [](move ["d2_in2"])))); + ((((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("E2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d2_in1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Geomdetail.PAIR_EQ_EXPAND)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("d2_in1", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ", [PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + (((((use_arg_then2 ("w'_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sigma_fan_not_fixed", [sigma_fan_not_fixed]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("d2_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("REAL_ADD_SYM", [REAL_ADD_SYM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`azim_dart _1 _2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_eq", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("azim_dart_sum_delete", [azim_dart_sum_delete]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d2_in1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fully_surrounded_card_set_of_edge1", [fully_surrounded_card_set_of_edge1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("ww'_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`if y4'_fan (V,E2) d2 <= &3 then y4'_fan (V,E2) d2 else &3`))) (term_tac (set_tac "r"))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq", [ineq])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y1_fan d2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y2_fan d2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y3_fan (V,E2) d2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("r", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,E2) d2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan d2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ineq.apex_sup_flat", [Ineq.apex_sup_flat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`_1 - #1.903 - _2 + _3`))) (term_tac (set_tac "s"))); + (((use_arg_then2 ("ineq", [ineq])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC THEN (move ["_"]) THEN (move ["ineq"])); + (((((use_arg_then2 ("w'_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("E2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_ge", [real_ge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LTE_TRANS", [REAL_LTE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LTE_TRANS") THEN (DISCH_THEN apply_tac))); + ((use_arg_then2 ("s", [])) (term_tac exists_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`y1_fan d2 = y1_fan (w,w') /\ y3_fan (V,E2) d2 = y3_fan (V,E) (w,w') + /\ y5_fan (V,E2) d2 = y5_fan (V,E) (w,w')`))) (term_tac (have_gen_tac [](move ["y_eqs"])))); + ((((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("ys_fan_eq", [ys_fan_eq])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("d2_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("ys_fan_eq", [ys_fan_eq])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d2_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("E2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w'_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE sigma_fan_delete1)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fully_surrounded_card_set_of_edge1", [fully_surrounded_card_set_of_edge1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ww'_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`y4_fan (V,E) d' = ye_fan (w,w') /\ y4'_fan (V,E2) d2 = ye_fan (FST d', v)`))) (term_tac (have_gen_tac [](move ["y4_eqs"])))); + ((((use_arg_then2 ("y4_fan", [y4_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES", [PERMUTES_INVERSES])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ye_fan", [ye_fan]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("y4'_fan", [y4'_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ww'_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("d2_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d2_in2", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("ye_fan", [ye_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("E2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w'_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE sigma_fan_delete1)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fully_surrounded_card_set_of_edge1", [fully_surrounded_card_set_of_edge1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ww'_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`y4_fan (V,E) d' <= r`))) (term_tac (have_gen_tac [](move ["r_ineq"])))); + ((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_term (`_ <= &3`))) (disch_eq_tac "ineq1" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y4_eqs", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("d2_in1", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (move ["d2_in"]))); + ((fun arg_tac -> arg_tac (Arg_term (`r <= &3 /\ sqrt8 <= r /\ &2 <= r`))) (term_tac (have_gen_tac [](move ["r_ineqs"])))); + ((THENL_FIRST) (split_tac) ((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`sqrt8 <= r`))) (term_tac (have_gen_tac []ALL_TAC)))) ((((use_arg_then2 ("Flyspeck_constants.bounds", [Flyspeck_constants.bounds])) (disch_tac [])) THEN (clear_assumption "Flyspeck_constants.bounds") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`y4_fan (V,E) d'`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("r_ineq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y4_eqs", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (split_tac); + ((((use_arg_then2 ("ineq", [ineq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `#2.0 = &2 /\ #3.0 = &3`)))(thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("y_eqs", []))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("ww'_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("ww'_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d2_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d2_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d2_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("r_ineqs", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_ADD2", [REAL_LE_ADD2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_eqs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 11 0 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_RADD", [REAL_LE_RADD]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_LADD", [REAL_LE_LADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((THENL_LAST) (split_tac) (((((use_arg_then2 ("REAL_LE_NEG", [REAL_LE_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_RADD", [REAL_LE_RADD]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("dih_y_le_azim_dart", [dih_y_le_azim_dart])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d2_in2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((fun arg_tac -> arg_tac (Arg_term (`dih_y _1 _2 _3 _4 _5 _6`))) (term_tac (set_tac "y"))); + ((BETA_TAC THEN (move ["ineq_y"])) THEN (((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then2 ("y", [])) (term_tac exists_tac))); + ((((use_arg_then2 ("ineq_y", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_eqs", []))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) ((((use_arg_then2 ("dih_y_mono_le4", [dih_y_mono_le4]))(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((((use_arg_then2 ("r_ineqs", [])) (disch_tac [])) THEN (clear_assumption "r_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) (split_tac) ((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("y_eqs", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("fan_ups_x_pos", [fan_ups_x_pos])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fan_delta_y_pos", [fan_delta_y_pos]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("Delta_ineq.delta_y_pos_apex", [Delta_ineq.delta_y_pos_apex]))(thm_tac (new_rewrite [] [])))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d2_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d2_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d2_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d2_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("y_eqs", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d2_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("r_ineqs", []))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x <= #2.52 ==> x <= &3`))) (term_tac (have_gen_tac ["x"](move ["ineq2"])))) ((arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("ineq2", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(Sections.add_section_var (mk_var ("g", (`:num#num -> real^3#real^3`))));; +(Sections.add_section_var (mk_var ("h", (`:num -> real^3`))));; +(Sections.add_section_var (mk_var ("L", (`:((num)list)list`))));; +(Sections.add_section_hyp "goodL" (`good_list L`));; +(Sections.add_section_hyp "g_iso" (`hyp_iso g (hypermap_of_list L, hypermap_of_fan (V,E))`));; +(Sections.add_section_hyp "g_eq" (`!d. g d = h (FST d), h (SND d)`));; + +(* Lemma crossdiag_list *) +let crossdiag_list = Sections.section_proof [] +`ALL (\d. + ye_list g d <= ye_list g (FST (inverse (f_list_ext L) d), SND (f_list_ext L (e_list d))) + /\ sqrt8 <= ye_list g d /\ ye_list g d <= &3 + /\ ye_list g (inverse (f_list_ext L) d) <= #2.52 + /\ ye_list g (f_list_ext L (e_list d)) <= #2.52 + ==> (azim_list (g,V,E) d + azim_list (g,V,E) (f_list_ext L (e_list d))) - #1.903 + - #0.4 * (y1_list g d - &2) + + #0.49688 * (y2_list g (f_list_ext L (e_list d)) + y3_list (g,V,E) d + + y5_list (g,V,E) d + y6_list g (f_list_ext L (e_list d)) - &8) + - (y4_list (g,V,E) (inverse (f_list_ext L) d) - sqrt8) >= &0) + (list_of_darts3 L)` +[ + ((((use_arg_then2 ("ALL_MEM", [ALL_MEM]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["d"]) THEN (move ["mem_d"]) THEN (simp_tac) THEN (move ["cond"])); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["hypH"]))); + ((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["hypL"]))); + ((((use_arg_then2 ("mem_d", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("darts3_eq_list_of_darts3", [darts3_eq_list_of_darts3]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["d_in"]) THEN (move ["card_f"])))); + ((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE crossdiag_fan))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`g d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> arg_tac (Arg_term (`f_list_ext L _`))) (term_tac (set_tac "d2"))); + ((fun arg_tac -> arg_tac (Arg_term (`inverse _ d`))) (term_tac (set_tac "d'"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`e_list_ext L d = e_list d`))) (term_tac (have_gen_tac [](move ["e_list_eq"])))) (((((use_arg_then2 ("e_list_ext", [e_list_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hypL", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`d2 IN dart (hypermap_of_list L)`))) (term_tac (have_gen_tac [](move ["d2_in"])))); + (((((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("e_list_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("hypL", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`f_fan_pair_ext (V,E) (e_fan_pair_ext (V,E) (g d)) = g d2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("hypH", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("hyp_iso_comm", [hyp_iso_comm])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("hypH", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("hyp_iso_inverse_comm", [hyp_iso_inverse_comm])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("hypL", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d'_def", []))(thm_tac (new_rewrite [] []))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("list_defs_th", [list_defs_th]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_card_components", [hyp_iso_card_components])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("cond", [])) (disch_tac [])) THEN (clear_assumption "cond") THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("list_defs_th", [list_defs_th]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["c1"])) THEN (move ["cond"]))); + ((((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y6_fan", [y6_fan]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ye_fan", [ye_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("hypH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_inverse_comm", [hyp_iso_inverse_comm])) (fun fst_arg -> (use_arg_then2 ("g_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("hypL", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d'_def", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cond", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((((use_arg_then2 ("c1", [])) (disch_tac [])) THEN (clear_assumption "c1") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("g_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Crossdiag *) +let crossdiag_fan = Sections.finalize_theorem crossdiag_fan;; +let crossdiag_list = Sections.finalize_theorem crossdiag_list;; +Sections.end_section "Crossdiag";; + +(* Finalization of the section Pack *) +let perimZ = Sections.finalize_theorem perimZ;; +let perimZ_std = Sections.finalize_theorem perimZ_std;; +let yapex_sup_flat_fan = Sections.finalize_theorem yapex_sup_flat_fan;; +let yapex_sup_flat_list = Sections.finalize_theorem yapex_sup_flat_list;; +let extra_ineqs_std3_small = Sections.finalize_theorem extra_ineqs_std3_small;; +let extra_ineq_std3_big = Sections.finalize_theorem extra_ineq_std3_big;; +let ineq77 = Sections.finalize_theorem ineq77;; +let ineq77_std = Sections.finalize_theorem ineq77_std;; +let ineq89 = Sections.finalize_theorem ineq89;; +let ineq89_std = Sections.finalize_theorem ineq89_std;; +let ineq90 = Sections.finalize_theorem ineq90;; +let ineq90_std = Sections.finalize_theorem ineq90_std;; +let ineq71 = Sections.finalize_theorem ineq71;; +let ineq72 = Sections.finalize_theorem ineq72;; +let ineq73 = Sections.finalize_theorem ineq73;; +let ineq74 = Sections.finalize_theorem ineq74;; +let ineq104 = Sections.finalize_theorem ineq104;; +let ineq104_std = Sections.finalize_theorem ineq104_std;; +let ineq105 = Sections.finalize_theorem ineq105;; +let ineq105_std = Sections.finalize_theorem ineq105_std;; +let ineq106 = Sections.finalize_theorem ineq106;; +let ineq106_std = Sections.finalize_theorem ineq106_std;; +let crossdiag_fan = Sections.finalize_theorem crossdiag_fan;; +let crossdiag_list = Sections.finalize_theorem crossdiag_list;; +Sections.end_section "Pack";; + +(* Finalization of the section FullySurrounded *) +let perimZ = Sections.finalize_theorem perimZ;; +let perimZ_std = Sections.finalize_theorem perimZ_std;; +let yapex_sup_flat_fan = Sections.finalize_theorem yapex_sup_flat_fan;; +let yapex_sup_flat_list = Sections.finalize_theorem yapex_sup_flat_list;; +let extra_ineqs_std3_small = Sections.finalize_theorem extra_ineqs_std3_small;; +let extra_ineq_std3_big = Sections.finalize_theorem extra_ineq_std3_big;; +let ineq77 = Sections.finalize_theorem ineq77;; +let ineq77_std = Sections.finalize_theorem ineq77_std;; +let ineq89 = Sections.finalize_theorem ineq89;; +let ineq89_std = Sections.finalize_theorem ineq89_std;; +let ineq90 = Sections.finalize_theorem ineq90;; +let ineq90_std = Sections.finalize_theorem ineq90_std;; +let ineq71 = Sections.finalize_theorem ineq71;; +let ineq72 = Sections.finalize_theorem ineq72;; +let ineq73 = Sections.finalize_theorem ineq73;; +let ineq74 = Sections.finalize_theorem ineq74;; +let ineq104 = Sections.finalize_theorem ineq104;; +let ineq104_std = Sections.finalize_theorem ineq104_std;; +let ineq105 = Sections.finalize_theorem ineq105;; +let ineq105_std = Sections.finalize_theorem ineq105_std;; +let ineq106 = Sections.finalize_theorem ineq106;; +let ineq106_std = Sections.finalize_theorem ineq106_std;; +let crossdiag_fan = Sections.finalize_theorem crossdiag_fan;; +let crossdiag_list = Sections.finalize_theorem crossdiag_list;; +Sections.end_section "FullySurrounded";; + +(* Close the module *) +end;; diff --git a/formal_lp/hypermap/ineqs/lp_main_estimate-compiled.hl b/formal_lp/hypermap/ineqs/lp_main_estimate-compiled.hl new file mode 100644 index 0000000..99e455a --- /dev/null +++ b/formal_lp/hypermap/ineqs/lp_main_estimate-compiled.hl @@ -0,0 +1,2179 @@ +needs "../formal_lp/hypermap/ineqs/lp_ineqs_proofs-compiled.hl";; +needs "local/RNSYJXM-compiled.hl";; +needs "local/polar_fan.hl";; + +(* Module Lp_main_estimate*) +module Lp_main_estimate = struct + +open Sphere;; +open Localization;; +open Tame_defs;; +open Ssrbool;; +open Ssrnat;; +open Lp_ineqs_def;; +open Lp_ineqs_proofs;; +open Hypermap_and_fan;; +open Fan_defs;; +open Hypermap;; +open Add_triangle;; +open Tame_general;; +open Hypermap_iso;; +open Rnsyjxm;; +open List_hypermap;; +let rho_fun = new_definition + `rho_fun y = &1 + (inv (&2 * h0 - &2)) * (inv pi) * sol0 * (y - &2)`;; +let tau_fun = new_definition + `tau_fun V E f = sum (f) (\e. rho_fun(norm(FST e)) * (azim_in_fan e E)) + - (pi + sol0) * &(CARD f -2)`;; +let tau3 = new_definition `tau3 (v1:real^3) v2 v3 = + rho (norm v1) * dihV (vec 0) v1 v2 v3 + rho(norm v2) * dihV (vec 0) v2 v3 v1 + + rho(norm v3) * dihV (vec 0) v3 v1 v2 - (pi + sol0)`;; +let JEJTVGB_std_concl = + `!V E FF. + convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + 4 <= CARD V /\ CARD V <= 6 /\ + (!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> &2 * h0 <= dist(v,w)) /\ + (!v w. {v,w} IN E ==> &2 <= dist(v,w) /\ dist(v,w) <= &2 * h0) ==> + d_tame (CARD V) <= tau_fun V E FF`;; +let JEJTVGB_std3_concl = + `!v1 v2 v3. + &2 <= norm v1 /\ + &2 <= norm v2 /\ + &2 <= norm v3 /\ + norm v1 <= &2 * h0 /\ + norm v2 <= &2 * h0 /\ + norm v3 <= &2 * h0 /\ + &2 <= dist(v1,v2) /\ + &2 <= dist(v1,v3) /\ + &2 <= dist(v2,v3) /\ + dist(v1,v2) <= &2 * h0 /\ + dist(v1,v3) <= &2 * h0 /\ + dist(v2,v3) <= &2 * h0 ==> + &0 <= tau3 v1 v2 v3`;; +let JEJTVGB_pent_diag_concl = + `!V E FF. + convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + CARD V = 5 /\ + (!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> sqrt8 <= dist(v,w)) /\ + (!v w. {v,w} IN E ==> &2 <= dist(v,w) /\ dist(v,w) <= &2 * h0) ==> + #0.616 <= tau_fun V E FF`;; +let JEJTVGB_pent_pro_concl = + `!V E FF. + convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + CARD V = 5 /\ + (!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> &2 * h0 <= dist(v,w)) /\ + (?v0 w0. + (!v w. {v,w} IN E /\ ~({v,w} = {v0,w0}) ==> &2 <= dist(v,w) /\ dist(v,w) <= &2 * h0) /\ + {v0,w0} IN E /\ + &2 *h0 <= dist(v0,w0) /\ dist(v0,w0) <= sqrt8) + ==> + #0.616 <= tau_fun V E FF`;; +let JEJTVGB_quad_pro_concl = + `!V E FF. + convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + CARD V = 4 /\ + (!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> sqrt8 <= dist(v,w)) /\ + (?v0 w0. + (!v w. {v,w} IN E /\ ~({v,w} = {v0,w0}) ==> &2 <= dist(v,w) /\ dist(v,w) <= &2 * h0) /\ + {v0,w0} IN E /\ + &2 *h0 <= dist(v0,w0) /\ dist(v0,w0) <= sqrt8) + ==> + #0.477 <= tau_fun V E FF`;; +let JEJTVGB_quad_diag_concl = + `!V E FF. + convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + CARD V = 4 /\ + (!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> &3 <= dist(v,w)) /\ + (!v w. {v,w} IN E ==> &2 <= dist(v,w) /\ dist(v,w) <= &2 * h0) ==> + #0.467 <= tau_fun V E FF`;; +let JEJTVGB_concl = + let co = [JEJTVGB_std_concl;JEJTVGB_std3_concl;JEJTVGB_pent_diag_concl;JEJTVGB_pent_pro_concl; + JEJTVGB_quad_pro_concl;JEJTVGB_quad_diag_concl] in + list_mk_conj co;; +let lp_main_estimate = new_definition (mk_eq (`lp_main_estimate:bool`,JEJTVGB_concl));; + +(* Section Misc *) +Sections.begin_section "Misc";; +(Sections.add_section_type (mk_var ("f", (`:real^3#real^3->bool`))));; + +(* Lemma rho_rho_fun *) +let rho_rho_fun = Sections.section_proof ["y"] +`rho_fun y = rho y` +[ + ((((use_arg_then2 ("Sphere.rho", [Sphere.rho]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rho_fun", [rho_fun]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Sphere.const1", [Sphere.const1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Sphere.ly", [Sphere.ly]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Sphere.interp", [Sphere.interp]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("Nonlinear_lemma.sol0_EQ_sol_y", [Nonlinear_lemma.sol0_EQ_sol_y]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Sphere.h0", [Sphere.h0]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("PI_POS", [PI_POS])) (disch_tac [])) THEN (clear_assumption "PI_POS") THEN BETA_TAC) THEN (CONV_TAC REAL_FIELD) THEN (done_tac)); +];; + +(* Lemma packing_v_prime *) +let packing_v_prime = Sections.section_proof ["V";"f"] +`packing V ==> packing (v_prime V f)` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("Rdwkarc.PACKING_SUBSET", [Rdwkarc.PACKING_SUBSET])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("V_PRIME_SUBSET_V", [V_PRIME_SUBSET_V]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma v_prime_subset *) +let v_prime_subset = Sections.section_proof ["V";"X";"f"] +`V SUBSET X ==> v_prime V f SUBSET X` +[ + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("SUBSET_TRANS", [SUBSET_TRANS])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`v_prime V f`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("V_PRIME_SUBSET_V", [V_PRIME_SUBSET_V]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma in_e_prime *) +let in_e_prime = Sections.section_proof ["E";"f";"v";"w"] +`{v,w} IN e_prime E f <=> {v,w} IN E /\ (v,w IN f \/ w,v IN f)` +[ + ((((use_arg_then2 ("e_prime", [e_prime]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((THENL_ROT (-1)) ((THENL) (split_tac) [((case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN (move ["ab_in"]))); (case THEN (move ["vw_inE"]))])); + (((THENL) (case THEN (move ["in_f"])) [(((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("w", [])) (term_tac exists_tac))); ((((use_arg_then2 ("w", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("v", [])) (term_tac exists_tac))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Collect_geom.PER_SET2)))(thm_tac (new_rewrite [] [])))))]) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Geomdetail.PAIR_EQ_EXPAND)))(thm_tac (new_rewrite [] [])))); + ((case THEN ALL_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Collect_geom.PER_SET2)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma set_vv_eq_v *) +let set_vv_eq_v = Sections.section_proof ["v"] +`{v,v} = {v}` +[ + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Misc *) +let rho_rho_fun = Sections.finalize_theorem rho_rho_fun;; +let packing_v_prime = Sections.finalize_theorem packing_v_prime;; +let v_prime_subset = Sections.finalize_theorem v_prime_subset;; +let in_e_prime = Sections.finalize_theorem in_e_prime;; +let set_vv_eq_v = Sections.finalize_theorem set_vv_eq_v;; +Sections.end_section "Misc";; + +(* Section Fan *) +Sections.begin_section "Fan";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_hyp "fanV" (`FAN (vec 0,V,E)`));; + +(* Let dartH *) +Sections.add_section_lemma "dartH" (Sections.section_proof [] +`dart (hypermap_of_fan (V,E)) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let in_dart_inV *) +Sections.add_section_lemma "in_dart_inV" (Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) ==> FST d IN V /\ SND d IN V` +[ + (((((use_arg_then2 ("pair_expand", [pair_expand]))(thm_tac (new_rewrite [1] [])))) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +]);; + +(* Lemma fan_aff_gt_1_2_not_empty *) +let fan_aff_gt_1_2_not_empty = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + ==> ~(aff_gt {vec 0} {v,w} = {})` +[ + (BETA_TAC THEN (move ["vw_in"])); + ((fun arg_tac -> arg_tac (Arg_term (`~(v = vec 0) /\ ~(w = vec 0)`))) (term_tac (have_gen_tac [](move ["n0"])))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["inV"]))); + ((((use_arg_then2 ("fanV", [])) (disch_tac [])) THEN (clear_assumption "fanV") THEN BETA_TAC) THEN (((((use_arg_then2 ("FAN", [FAN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fan2", [fan2]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["n0V"])) THEN (move ["_"]))); + ((split_tac) THEN (((use_arg_then2 ("n0V", [])) (disch_tac [])) THEN (clear_assumption "n0V") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN (clear_assumption "vw_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("dart_of_fan_eq", [dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN ((THENL) case [(move ["vw_in1"]); ALL_TAC])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Planarity.POINT_IN_CLOSURE_AFF_GT_1_2", [Planarity.POINT_IN_CLOSURE_AFF_GT_1_2])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ", [PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ])) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("n0", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (simp_tac)); + ((((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("CLOSURE_EMPTY", [CLOSURE_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN (move ["_"])) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("set_vv_eq_v", [set_vv_eq_v]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("AFF_GT_1_1", [AFF_GT_1_1]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Local_lemmas.DISJOINT_DOUBLE_SING)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("n0", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`#0.5 % v`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`#0.5`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`#0.5`))) (term_tac exists_tac))); + ((THENL_FIRST) ((((use_arg_then2 ("andbA", [andbA]))(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((VECTOR_ARITH_TAC) THEN (done_tac)); +];; + +(* Lemma tau_fun_local *) +let tau_fun_local = Sections.section_proof ["f"] +`f IN face_set (hypermap_of_fan (V,E)) + ==> tau_fun (v_prime V f) (e_prime E f) f = tau_fun V E f` +[ + ((BETA_TAC THEN (move ["f_in"])) THEN (((use_arg_then2 ("f_in", [])) (disch_tac [])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (case THEN ((move ["v"]) THEN (move ["w"])))) THEN (case THEN (move ["vw_in"])) THEN (move ["f_eq"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("tau_fun", [tau_fun]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_EQ_ADD_RCANCEL", [REAL_EQ_ADD_RCANCEL]))(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["d"]) THEN (move ["d_in"]) THEN (simp_tac)); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Lvducxu.AZIM_IN_FAN_EQ_IZIM_E_PRIME))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`v,w`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("hypermap_HYP_elim", [hypermap_HYP_elim]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma v_prime_eq *) +let v_prime_eq = Sections.section_proof ["d";"k"] +`d IN darts_k k (hypermap_of_fan (V,E)) + ==> v_prime V (face (hypermap_of_fan (V,E)) d) + = {FST ((f_fan_pair_ext (V,E) POWER i) d) | i < k}` +[ + ((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (move ["d_in_k"]) THEN (move ["x"])); + ((((use_arg_then2 ("d_in_k", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["card_f"]))); + ((((use_arg_then2 ("v_prime", [v_prime]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("face_eq_power", [face_eq_power])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in_k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((THENL) (split_tac) [((case THEN (move ["xV"])) THEN (case THEN (move ["w"])) THEN (case THEN (move ["i"])) THEN (case THEN (move ["i_lt"])) THEN (move ["xw_eq"])); ((case THEN (move ["i"])) THEN (case THEN (move ["i_lt"])) THEN (move ["x_eq"]))]); + (((use_arg_then2 ("i", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("xw_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_in_dart", [f_fan_pair_ext_power_in_dart])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("pair_expand", [pair_expand]))(thm_tac (new_rewrite [1] [])))) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC))))); + ((((use_arg_then2 ("x_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`SND ((f_fan_pair_ext (V,E) POWER i) d)`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("i", [])) (term_tac exists_tac))); + (((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma v_prime4_eq *) +let v_prime4_eq = Sections.section_proof ["v";"w"] +`let w' = sigma_fan (vec 0) V E v w in + let u = sigma_fan (vec 0) V E w' v in + v,w IN darts_k 4 (hypermap_of_fan (V,E)) + ==> v_prime V (face (hypermap_of_fan (V,E)) (v,w)) + = {v, w, u, w'}` +[ + ((repeat_tactic 1 9 ((CONV_TAC let_CONV))) THEN (BETA_TAC THEN (move ["vw_in4"]))); + ((((fun arg_tac -> (use_arg_then2 ("v_prime_eq", [v_prime_eq])) (fun fst_arg -> (use_arg_then2 ("vw_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (gen_FINITE_SET 4)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE face4_eq))) (fun fst_arg -> (use_arg_then2 ("vw_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma v_prime5_eq *) +let v_prime5_eq = Sections.section_proof ["v";"w"] +`let w' = sigma_fan (vec 0) V E v w in + let u = sigma_fan (vec 0) V E w' v in + let z = sigma_fan (vec 0) V E u w' in + v,w IN darts_k 5 (hypermap_of_fan (V,E)) + ==> v_prime V (face (hypermap_of_fan (V,E)) (v,w)) + = {v, w, z, u, w'}` +[ + ((repeat_tactic 1 9 ((CONV_TAC let_CONV))) THEN (BETA_TAC THEN (move ["vw_in5"]))); + ((((fun arg_tac -> (use_arg_then2 ("v_prime_eq", [v_prime_eq])) (fun fst_arg -> (use_arg_then2 ("vw_in5", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (gen_FINITE_SET 5)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE face5_eq))) (fun fst_arg -> (use_arg_then2 ("vw_in5", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma quad_diags_imp *) +let quad_diags_imp = Sections.section_proof ["v";"w";"a";"b"] +`let f = face (hypermap_of_fan (V,E)) (v,w) in + let w' = sigma_fan (vec 0) V E v w in + let u = sigma_fan (vec 0) V E w' v in + v,w IN darts_k 4 (hypermap_of_fan (V,E)) + /\ ~(a = b) /\ a IN v_prime V f /\ b IN v_prime V f + /\ ~({a,b} IN e_prime E f) + ==> ((a,b) = (w, w') \/ (a,b) = (w',w)) \/ ((a,b) = (v,u) \/ (a,b) = (u,v))` +[ + ((repeat_tactic 1 9 ((CONV_TAC let_CONV))) THEN (BETA_TAC THEN (case THEN (move ["vw_in4"])) THEN (case THEN (move ["a_neq_b"])))); + ((((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE v_prime4_eq))) (fun fst_arg -> (use_arg_then2 ("vw_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("IN_SING", [IN_SING]))(fun tmp_arg1 -> (use_arg_then2 ("IN_INSERT", [IN_INSERT]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_e_prime", [in_e_prime]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE face4_eq))) (fun fst_arg -> (use_arg_then2 ("vw_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["f_eqs"]) THEN (case THEN (move ["in_darts"])) THEN (move ["face_eq"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`face _ (v,w)`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E w' v`))) (term_tac (set_tac "u"))); + (BETA_TAC THEN (case THEN (move ["a_conds"])) THEN (case THEN (move ["b_conds"]))); + (((use_arg_then2 ("a_neq_b", [])) (disch_tac [])) THEN (clear_assumption "a_neq_b") THEN ((use_arg_then2 ("b_conds", [])) (disch_tac [])) THEN (clear_assumption "b_conds") THEN ((use_arg_then2 ("a_conds", [])) (disch_tac [])) THEN (clear_assumption "a_conds") THEN BETA_TAC); + ((((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("face_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("IN_SING", [IN_SING]))(fun tmp_arg1 -> (use_arg_then2 ("IN_INSERT", [IN_INSERT]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 (case)) THEN (BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (case)) THEN (BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma pent_diags_imp *) +let pent_diags_imp = Sections.section_proof ["v";"w";"a";"b"] +`let f = face (hypermap_of_fan (V,E)) (v,w) in + let w' = sigma_fan (vec 0) V E v w in + let u = sigma_fan (vec 0) V E w' v in + let z = sigma_fan (vec 0) V E u w' in + v,w IN darts_k 5 (hypermap_of_fan (V,E)) + /\ ~(a = b) /\ a IN v_prime V f /\ b IN v_prime V f + /\ ~({a,b} IN e_prime E f) + ==> ((a,b) = (w, w') \/ (a,b) = (w',w)) + \/ ((a,b) = (z,v) \/ (a,b) = (v,z)) + \/ ((a,b) = (u,w) \/ (a,b) = (w,u)) + \/ ((a,b) = (w',z) \/ (a,b) = (z,w')) + \/ ((a,b) = (v,u) \/ (a,b) = (u,v))` +[ + ((repeat_tactic 1 9 ((CONV_TAC let_CONV))) THEN (BETA_TAC THEN (case THEN (move ["vw_in5"])) THEN (case THEN (move ["a_neq_b"])))); + ((((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE v_prime5_eq))) (fun fst_arg -> (use_arg_then2 ("vw_in5", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("IN_SING", [IN_SING]))(fun tmp_arg1 -> (use_arg_then2 ("IN_INSERT", [IN_INSERT]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_e_prime", [in_e_prime]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE face5_eq))) (fun fst_arg -> (use_arg_then2 ("vw_in5", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["f_eqs"]) THEN (case THEN (move ["in_darts"])) THEN (move ["face_eq"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`face _ (v,w)`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E w' v`))) (term_tac (set_tac "u"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E u w'`))) (term_tac (set_tac "z"))); + (BETA_TAC THEN (case THEN (move ["a_conds"])) THEN (case THEN (move ["b_conds"]))); + (((use_arg_then2 ("a_neq_b", [])) (disch_tac [])) THEN (clear_assumption "a_neq_b") THEN ((use_arg_then2 ("b_conds", [])) (disch_tac [])) THEN (clear_assumption "b_conds") THEN ((use_arg_then2 ("a_conds", [])) (disch_tac [])) THEN (clear_assumption "a_conds") THEN BETA_TAC); + ((((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("face_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("IN_SING", [IN_SING]))(fun tmp_arg1 -> (use_arg_then2 ("IN_INSERT", [IN_INSERT]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 (case)) THEN (BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (case)) THEN (BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma e_fan_pair_eq_f_fan_pair *) +let e_fan_pair_eq_f_fan_pair = Sections.section_proof ["v";"w"] +`simple_hypermap (hypermap_of_fan (V,E)) + /\ v, w IN dart_of_fan (V,E) + /\ w, v IN face (hypermap_of_fan (V,E)) (v,w) + ==> f_fan_pair_ext (V,E) (v,w) = (w,v)` +[ + (BETA_TAC THEN (case THEN (move ["simpleH"])) THEN (case THEN (move ["vw_in"])) THEN (move ["wv_in_f"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("HYPERMAP_OF_FAN_FACE_NODE_INJ", [HYPERMAP_OF_FAN_FACE_NODE_INJ])) (fun fst_arg -> (use_arg_then2 ("simpleH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`face (hypermap_of_fan (V,E)) (v,w)`))) (term_tac exists_tac)); + ((((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("wv_in_f", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("POWER_1", [POWER_1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`face_map _`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face", [lemma_in_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN (clear_assumption "vw_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("dart_of_fan_eq", [dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`v,w IN _1`))) (disch_eq_tac "vw_in1" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (case THEN (move ["u"]))) THEN ((((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac)); +];; + +(* Lemma linear_face_simple_hyp *) +let linear_face_simple_hyp = Sections.section_proof ["v";"w"] +`simple_hypermap (hypermap_of_fan (V,E)) + /\ v,w IN dart_of_fan (V,E) + /\ w,v IN face (hypermap_of_fan (V,E)) (v,w) + ==> CARD (face (hypermap_of_fan (V,E)) (v,w)) <= 2` +[ + (BETA_TAC THEN (case THEN (move ["simpleH"])) THEN (case THEN (move ["vw_in"])) THEN (move ["wv_in_f"])); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["_"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["fH"]))))); + ((THENL_FIRST) (((((use_arg_then2 ("face", [face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_orbit_le", [card_orbit_le]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_fan_pair_eq_f_fan_pair", [e_fan_pair_eq_f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("e_fan_pair_eq_f_fan_pair", [e_fan_pair_eq_f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("simpleH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("in_face_imp_in_dart", [in_face_imp_in_dart])) (fun fst_arg -> (use_arg_then2 ("wv_in_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (fun fst_arg -> (use_arg_then2 ("wv_in_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("face_refl", [face_refl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section BallAnnulus *) +Sections.begin_section "BallAnnulus";; +(Sections.add_section_hyp "subV" (`V SUBSET ball_annulus`));; + +(* Let norm_inV *) +Sections.add_section_lemma "norm_inV" (Sections.section_proof ["v"] +`v IN V ==> &2 <= norm v /\ norm v <= &2 * h0` +[ + ((in_tac ["subV"] false (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("subV", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then2 ("Fnjlbxs.in_ball_annulus", [Fnjlbxs.in_ball_annulus]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Lemma tau_fun_eq_tauVEF *) +let tau_fun_eq_tauVEF = Sections.section_proof ["f"] +`f IN face_set (hypermap_of_fan (V,E)) /\ 2 <= CARD f + ==> tau_fun V E f = tauVEF (V,E,f)` +[ + (((((use_arg_then2 ("tau_fun", [tau_fun]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("tauVEF", [tauVEF]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["f_in"]) THEN (move ["card_f"])))); + ((((use_arg_then2 ("REAL_OF_NUM_SUB", [REAL_OF_NUM_SUB]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RNEG", [REAL_MUL_RNEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_NEG_SUB", [REAL_NEG_SUB]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_EQ_ADD_RCANCEL", [REAL_EQ_ADD_RCANCEL]))(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["d"]) THEN (move ["d_in_f"]) THEN (simp_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`d IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["d_in"])))) (((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("in_face_imp_in_dart_alt", [in_face_imp_in_dart_alt])) (fun fst_arg -> (use_arg_then2 ("d_in_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("rho_rho_fun", [rho_rho_fun]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("azim_in_fan_eq_azim_dart", [azim_in_fan_eq_azim_dart])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("Sphere.rho", [Sphere.rho]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ly_EQ_lmfun", [ly_EQ_lmfun]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("norm_inV", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_dart_inV", [])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("sol0_over_pi_EQ_const1", [sol0_over_pi_EQ_const1]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section BallAnnulus *) +let tau_fun_eq_tauVEF = Sections.finalize_theorem tau_fun_eq_tauVEF;; +Sections.end_section "BallAnnulus";; + +(* Finalization of the section Fan *) +let fan_aff_gt_1_2_not_empty = Sections.finalize_theorem fan_aff_gt_1_2_not_empty;; +let tau_fun_local = Sections.finalize_theorem tau_fun_local;; +let v_prime_eq = Sections.finalize_theorem v_prime_eq;; +let v_prime4_eq = Sections.finalize_theorem v_prime4_eq;; +let v_prime5_eq = Sections.finalize_theorem v_prime5_eq;; +let quad_diags_imp = Sections.finalize_theorem quad_diags_imp;; +let pent_diags_imp = Sections.finalize_theorem pent_diags_imp;; +let e_fan_pair_eq_f_fan_pair = Sections.finalize_theorem e_fan_pair_eq_f_fan_pair;; +let linear_face_simple_hyp = Sections.finalize_theorem linear_face_simple_hyp;; +let tau_fun_eq_tauVEF = Sections.finalize_theorem tau_fun_eq_tauVEF;; +Sections.end_section "Fan";; + +(* Section FullySurrounded *) +Sections.begin_section "FullySurrounded";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_hyp "fanV" (`FAN (vec 0,V,E)`));; +(Sections.add_section_hyp "f_surr" (`fully_surrounded (V,E)`));; + +(* Let dartH *) +Sections.add_section_lemma "dartH" (Sections.section_proof [] +`dart (hypermap_of_fan (V,E)) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let dart1_eq *) +Sections.add_section_lemma "dart1_eq" (Sections.section_proof [] +`dart1_of_fan (V,E) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Lemma f_surr_in_e_prime *) +let f_surr_in_e_prime = Sections.section_proof ["f";"v";"w"] +`f IN face_set (hypermap_of_fan (V,E)) + ==> ({v,w} IN e_prime E f <=> (v,w IN f \/ w,v IN f))` +[ + (((((use_arg_then2 ("in_e_prime", [in_e_prime]))(thm_tac (new_rewrite [] [])))) THEN (move ["f_in"])) THEN (((THENL) (split_tac) [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); ALL_TAC]) THEN ((TRY done_tac)))); + ((((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] []))))); + ((BETA_TAC THEN (move ["h"])) THEN ((((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + (((use_arg_then2 ("f_in", [])) (disch_tac [])) THEN (clear_assumption "f_in") THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d_in"])) THEN (move ["f_eq"])); + (((THENL) (((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN case) [(ALL_TAC); (((use_arg_then2 ("dart_switch", [dart_switch]))(thm_tac (new_rewrite [] []))))]) THEN (((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("in_face_imp_in_dart", [in_face_imp_in_dart])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (DISCH_THEN apply_tac) THEN (done_tac)); +];; + +(* Lemma diag_not_in_dart *) +let diag_not_in_dart = Sections.section_proof ["a";"b";"f"] +`f IN face_set (hypermap_of_fan (V,E)) + /\ a IN v_prime V f /\ b IN v_prime V f /\ + ~(a,b IN f) /\ ~(b,a IN f) + ==> ~(a,b IN dart_of_fan (V,E))` +[ + (BETA_TAC THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (case THEN (case THEN ((move ["v"]) THEN (move ["w"]))))); + ((((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["f_eq"])); + (((((use_arg_then2 ("v_prime", [v_prime]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["a_in"])) THEN (case THEN (move ["b_in"])) THEN (move ["not_in_f"])); + ((fun arg_tac -> (use_arg_then2 ("fan_hypermaps_iso_explicit2", [fan_hypermaps_iso_explicit2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> arg_tac (Arg_term (`ext_dart _`))) (term_tac (set_tac "h"))); + ((((use_arg_then2 ("implybF", [implybF]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["h_iso"]) THEN (move ["ab_in"])); + ((fun arg_tac -> arg_tac (Arg_term (`~(aff_gt {vec 0} {a,b} INTER xfan (vec 0,V,E) = {})`))) (term_tac (have_gen_tac []ALL_TAC))); + ((((use_arg_then2 ("Vol1.subset_inter", [Vol1.subset_inter]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("fan_aff_gt_1_2_not_empty", [fan_aff_gt_1_2_not_empty])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((fun arg_tac -> (use_arg_then2 ("SUBSET_TRANS", [SUBSET_TRANS])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("AFF_GT_SUBSET_AFF_GE", [AFF_GT_SUBSET_AFF_GE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`{vec 0}`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`{a,b}`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac)); + (((((use_arg_then2 ("Planarity.AFF_GE_SUBSET_XFAN", [Planarity.AFF_GE_SUBSET_XFAN]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("implybF", [implybF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] []))))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`aff_gt {vec 0} {a,b} SUBSET dart_leads_into (vec 0) V E v w`))) (term_tac (have_gen_tac []ALL_TAC)))); + ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("SUBSET_TRANS", [SUBSET_TRANS])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`yfan (vec 0,V,E)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))); + ((((use_arg_then2 ("Planarity.topological_component_subset_yfan", [Planarity.topological_component_subset_yfan]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((use_arg_then2 ("Topology.dart_leads_into_fan_in_topological_component_yfan", [Topology.dart_leads_into_fan_in_topological_component_yfan]))(thm_tac (new_rewrite [] [])))); + (((((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("yfan", [yfan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["h"]) THEN (move ["x"])); + ((((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> arg_tac (Arg_term (`x IN _`))) (disch_eq_tac "x_in" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN (((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN (exact_tac)) THEN (done_tac)); + (((use_arg_then2 ("a_in", [])) (disch_tac [])) THEN (clear_assumption "a_in") THEN ((use_arg_then2 ("b_in", [])) (disch_tac [])) THEN (clear_assumption "b_in") THEN BETA_TAC THEN (case THEN (move ["bV"])) THEN (case THEN (move ["b'"])) THEN (move ["bb'_in_f"]) THEN (case THEN (move ["aV"])) THEN (case THEN (move ["a'"])) THEN (move ["aa'_in_f"])); + ((fun arg_tac -> arg_tac (Arg_term (`a,a' IN dart_of_fan (V,E) /\ b,b' IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](case THEN ((move ["aa'_in"]) THEN (move ["bb'_in"])))))); + ((((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN (clear_assumption "vw_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["vw_in"]))); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("in_face_imp_in_dart", [in_face_imp_in_dart])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_imp_conforming", [fully_surrounded_imp_conforming])) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((use_arg_then2 ("Conforming.conforming_fan", [Conforming.conforming_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Conforming.conforming_diagonal_fan", [Conforming.conforming_diagonal_fan]))(thm_tac (new_rewrite [] []))))); + ((BETA_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`IMAGE h f`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`h (a,a')`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`h (b,b')`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN (ANTS_TAC)); + ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("iso_components", [iso_components])) (fun fst_arg -> (use_arg_then2 ("h_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("h_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (split_tac) (((fun arg_tac -> arg_tac (Arg_term (`a,a'`))) (term_tac exists_tac)) THEN (done_tac))); + ((THENL_FIRST) (split_tac) (((fun arg_tac -> arg_tac (Arg_term (`b,b'`))) (term_tac exists_tac)) THEN (done_tac))); + ((((use_arg_then2 ("ab_in", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ", [PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))))); + ((((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (fun fst_arg -> (use_arg_then2 ("h_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN ((((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["_"]))); + ((((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [2; 4] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("fan_map_ext", [fan_map_ext]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("h_def", []))(thm_tac (new_rewrite [] []))))); + case; + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (fun fst_arg -> (use_arg_then2 ("h_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (ANTS_TAC)); + (((((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("aa'_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("E_N_F_IN_DART1_OF_FAN", [E_N_F_IN_DART1_OF_FAN]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["eq"])) THEN (move ["_"])); + ((((use_arg_then2 ("not_in_f", [])) (disch_tac [])) THEN (clear_assumption "not_in_f") THEN ((use_arg_then2 ("bb'_in_f", [])) (disch_tac [])) THEN (clear_assumption "bb'_in_f") THEN BETA_TAC) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + case; + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (fun fst_arg -> (use_arg_then2 ("h_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (ANTS_TAC)); + (((((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bb'_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("E_N_F_IN_DART1_OF_FAN", [E_N_F_IN_DART1_OF_FAN]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["eq"])) THEN (move ["_"])); + ((((use_arg_then2 ("not_in_f", [])) (disch_tac [])) THEN (clear_assumption "not_in_f") THEN ((use_arg_then2 ("aa'_in_f", [])) (disch_tac [])) THEN (clear_assumption "aa'_in_f") THEN BETA_TAC) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ext_dart", [ext_dart]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("Fan.pr2", [Fan.pr2]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Tame_lemmas.dart_leads_into_eq1", [Tame_lemmas.dart_leads_into_eq1]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma tauVEF_add_diag_eq *) +let tauVEF_add_diag_eq = Sections.section_proof ["d";"f"] +`d IN dart_of_fan (V,E) + /\ f IN face_set (hypermap_of_fan (V, add_diag (V,E) d)) + /\ f IN face_set (hypermap_of_fan (V,E)) + ==> tauVEF (V, add_diag (V,E) d, f) = tauVEF (V, E, f)` +[ + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (case THEN (move ["vw_in"])) THEN (case THEN (move ["f_in2"])) THEN (move ["f_in"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_card_face_alt", [fully_surrounded_card_face_alt])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["card_f"])); + ((((use_arg_then2 ("add_diag_eq_E", [add_diag_eq_E]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("add_diag", [add_diag]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("tau_split_fan_face_eq", [tau_split_fan_face_eq])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("implybF", [implybF]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["f_eq"])); + ((((use_arg_then2 ("f_in2", [])) (disch_tac [])) THEN (clear_assumption "f_in2") THEN BETA_TAC) THEN ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE faces_add_diag)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE face_split_fan_face_explicit))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("split_fan_face_eq_add_diag", [split_fan_face_eq_add_diag]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ALL_TAC THEN (case THEN (move ["fs_eq"])) THEN (case THEN (move ["_"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["n_in"]) THEN (move ["_"])); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((THENL_ROT (-1)) (((repeat_tactic 1 9 (((use_arg_then2 ("fs_eq", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] []))))) THEN (split_tac))); + ((((use_arg_then2 ("n_in", [])) (disch_tac [])) THEN (clear_assumption "n_in") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`~(w,w' IN face (hypermap_of_fan (V,E)) (v,w))`))) (term_tac (have_gen_tac []ALL_TAC))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_diag_not_in_dart", [fully_surrounded_diag_not_in_dart])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("in_face_imp_in_dart", [in_face_imp_in_dart])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma tau3_eq_tau_fun *) +let tau3_eq_tau_fun = Sections.section_proof ["v";"w"] +`(v,w) IN dart_of_fan (V,E) + /\ CARD (face (hypermap_of_fan (V,E)) (v,w)) = 3 + ==> tau3 (sigma_fan (vec 0) V E v w) v w + = tau_fun V E (face (hypermap_of_fan (V,E)) (v,w))` +[ + (BETA_TAC THEN (case THEN ((move ["vw_in"]) THEN (move ["card3"])))); + ((((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["vw_in1"]))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE TRIANGULAR_FACE))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (move ["f_eq"])); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((((use_arg_then2 ("tau_fun", [tau_fun]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card3", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`~(v = w) /\ ~(w = w')`))) (term_tac (have_gen_tac [](move ["neqs"])))); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ", [PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair3", [f_fan_pair3]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("SUM_CLAUSES", [SUM_CLAUSES]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("FINITE_INSERT", [FINITE_INSERT]))(fun tmp_arg1 -> (use_arg_then2 ("FINITE_EMPTY", [FINITE_EMPTY]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("IN_INSERT", [IN_INSERT]))(fun tmp_arg1 -> (use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("neqs", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("neqs", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x * &(3 - 2) = x`))) (term_tac (have_gen_tac ["x"](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`w,w' IN dart_of_fan (V,E) /\ w',v IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["in_dart"])))); + (((((use_arg_then2 ("dart_of_fan_eq", [dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair3", [f_fan_pair3]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))) THEN (DISJ1_TAC)); + (((((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("rho_rho_fun", [rho_rho_fun]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("azim_in_fan_eq_azim_dart", [azim_in_fan_eq_azim_dart])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("tau3", [tau3]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("azim_dart_eq_dihV", [azim_dart_eq_dihV]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] []))))); + ((arith_tac) THEN (done_tac)); +];; + +(* Section BallAnnulus *) +Sections.begin_section "BallAnnulus";; +(Sections.add_section_hyp "subV" (`V SUBSET ball_annulus`));; + +(* Lemma f_surr_tau_fun_eq_tauVEF *) +let f_surr_tau_fun_eq_tauVEF = Sections.section_proof ["f"] +`f IN face_set (hypermap_of_fan (V,E)) + ==> tau_fun V E f = tauVEF (V,E,f)` +[ + ((BETA_TAC THEN (move ["f_in"])) THEN ((((fun arg_tac -> (use_arg_then2 ("tau_fun_eq_tauVEF", [tau_fun_eq_tauVEF])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("subV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_in", []))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("f_in", [])) (disch_tac [])) THEN (clear_assumption "f_in") THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["x"]))) THEN ((((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["x_in"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FULLY_SURROUNDED_IMP_CARD_FACE_GE_3", [FULLY_SURROUNDED_IMP_CARD_FACE_GE_3])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma f_surr_tau_fun_eq_tauVEF_alt *) +let f_surr_tau_fun_eq_tauVEF_alt = Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) + ==> tau_fun V E (face (hypermap_of_fan (V,E)) d) + = tauVEF (V,E,face (hypermap_of_fan (V,E)) d)` +[ + ((((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("f_surr_tau_fun_eq_tauVEF", [f_surr_tau_fun_eq_tauVEF])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Lemma f_surr_tau3_eq_tauVEF *) +let f_surr_tau3_eq_tauVEF = Sections.section_proof ["v";"w"] +`(v,w) IN dart_of_fan (V,E) + /\ CARD (face (hypermap_of_fan (V,E)) (v,w)) = 3 + ==> tau3 (sigma_fan (vec 0) V E v w) v w + = tauVEF (V, E, face (hypermap_of_fan (V,E)) (v,w))` +[ + ((BETA_TAC THEN (move ["h"])) THEN ((((use_arg_then2 ("tau3_eq_tau_fun", [tau3_eq_tau_fun]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_surr_tau_fun_eq_tauVEF_alt", [f_surr_tau_fun_eq_tauVEF_alt]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section BallAnnulus *) +let f_surr_tau_fun_eq_tauVEF = Sections.finalize_theorem f_surr_tau_fun_eq_tauVEF;; +let f_surr_tau_fun_eq_tauVEF_alt = Sections.finalize_theorem f_surr_tau_fun_eq_tauVEF_alt;; +let f_surr_tau3_eq_tauVEF = Sections.finalize_theorem f_surr_tau3_eq_tauVEF;; +Sections.end_section "BallAnnulus";; + +(* Finalization of the section FullySurrounded *) +let f_surr_in_e_prime = Sections.finalize_theorem f_surr_in_e_prime;; +let diag_not_in_dart = Sections.finalize_theorem diag_not_in_dart;; +let tauVEF_add_diag_eq = Sections.finalize_theorem tauVEF_add_diag_eq;; +let tau3_eq_tau_fun = Sections.finalize_theorem tau3_eq_tau_fun;; +let f_surr_tau_fun_eq_tauVEF = Sections.finalize_theorem f_surr_tau_fun_eq_tauVEF;; +let f_surr_tau_fun_eq_tauVEF_alt = Sections.finalize_theorem f_surr_tau_fun_eq_tauVEF_alt;; +let f_surr_tau3_eq_tauVEF = Sections.finalize_theorem f_surr_tau3_eq_tauVEF;; +Sections.end_section "FullySurrounded";; + +(* Section MainEstimate *) +Sections.begin_section "MainEstimate";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_hyp "h_fan" (`lp_fan (V,E)`));; + +(* Let dart1_eq *) +Sections.add_section_lemma "dart1_eq" (Sections.section_proof [] +`dart1_of_fan (V,E) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (move ["h"])) THEN (((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Lemma local_diag *) +let local_diag = Sections.section_proof ["f";"v";"w"] +`f IN face_set (hypermap_of_fan (V,E)) + /\ ~(v = w) /\ v IN v_prime V f /\ w IN v_prime V f + /\ ~({v,w} IN e_prime E f) ==> &2 * h0 <= dist (v,w)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (move ["_"]))); + (((((use_arg_then2 ("in_e_prime", [in_e_prime]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["f_in"])) THEN (case THEN (move ["v_n_w"])) THEN (case THEN (move ["v_in"])) THEN (case THEN (move ["w_in"])) THEN (move ["h"])); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`~({v,w} IN E)`))) (term_tac (have_gen_tac [](move ["nE"]))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&2 * h0 = #2.52`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("diag", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nE", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("v_n_w", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("w_in", [])) (disch_tac [])) THEN (clear_assumption "w_in") THEN ((use_arg_then2 ("v_in", [])) (disch_tac [])) THEN (clear_assumption "v_in") THEN BETA_TAC) THEN (((((use_arg_then2 ("v_prime", [v_prime]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN case THEN ((TRY done_tac)) THEN (move ["not_in_f"])); + ((((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("diag_not_in_dart", [diag_not_in_dart])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +];; + +(* Lemma local_std *) +let local_std = Sections.section_proof ["f";"d"] +`f = face (hypermap_of_fan (V,E)) d /\ d IN dart_of_fan (V,E) + ==> ((!v w. {v,w} IN e_prime E f ==> &2 <= dist(v,w) /\ dist(v,w) <= &2 * h0) + <=> (!k. k < CARD f ==> dist ((f_fan_pair_ext (V,E) POWER k) d) <= #2.52))` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["packV"]) THEN (case THEN ((move ["f_eq"]) THEN (move ["d_in"]))))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["fH"]))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&2 * h0 = #2.52`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`f IN face_set (hypermap_of_fan (V,E))`))) (term_tac (have_gen_tac [](move ["f_in"])))); + (((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`x IN f <=> ?k. k < CARD f /\ x = (f_fan_pair_ext (V,E) POWER k) d`))) (term_tac (have_gen_tac ["x"](move ["x_in_f"])))); + ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("face", [face]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FINITE_ORBIT_MAP", [FINITE_ORBIT_MAP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dart_of_fan (V,E)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`CARD f`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("face_map_and_darts", [face_map_and_darts]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("face", [face]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("fH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL) (split_tac) [((move ["h"]) THEN (move ["k"]) THEN (move ["k_lt"])); ((move ["h"]) THEN (move ["v"]) THEN (move ["w"]))]); + ((fun arg_tac -> arg_tac (Arg_term (`(_1 POWER k) d`))) (term_tac (set_tac "x"))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`FST x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SND x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_surr_in_e_prime", [f_surr_in_e_prime])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISJ1_TAC)); + ((((use_arg_then2 ("x_in_f", []))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("k", [])) (term_tac exists_tac)) THEN (done_tac)); + (((((fun arg_tac -> (use_arg_then2 ("f_surr_in_e_prime", [f_surr_in_e_prime])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["h_vw"])); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["vw_in"])))); + (((THENL) (((use_arg_then2 ("h_vw", [])) (disch_tac [])) THEN (clear_assumption "h_vw") THEN case) [(ALL_TAC); (((use_arg_then2 ("dart_switch", [dart_switch]))(thm_tac (new_rewrite [] []))))]) THEN (((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("in_face_imp_in_dart", [in_face_imp_in_dart])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (DISCH_THEN apply_tac) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("pack_dist", [pack_dist])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((THENL) (((use_arg_then2 ("h_vw", [])) (disch_tac [])) THEN (clear_assumption "h_vw") THEN case) [(ALL_TAC); (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] []))))]) THEN ((((use_arg_then2 ("x_in_f", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["k"])) THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("h", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (move ["ineq"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma local_pro *) +let local_pro = Sections.section_proof ["f";"d"] +`f = face (hypermap_of_fan (V,E)) d /\ d IN dart_of_fan (V,E) + ==> ((?v0 w0. (!v w. {v,w} IN e_prime E f /\ ~({v,w} = {v0,w0}) + ==> &2 <= dist(v,w) /\ dist(v,w) <= &2 * h0) + /\ {v0,w0} IN e_prime E f /\ &2 *h0 <= dist(v0,w0) /\ dist(v0,w0) <= sqrt8) + <=> (?k0. (!k. k < CARD f /\ ~(k = k0) ==> dist ((f_fan_pair_ext (V,E) POWER k) d) <= #2.52) + /\ k0 < CARD f /\ #2.52 <= dist ((f_fan_pair_ext (V,E) POWER k0) d) + /\ dist ((f_fan_pair_ext (V,E) POWER k0) d) <= sqrt8))` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["packV"]) THEN (case THEN ((move ["f_eq"]) THEN (move ["d_in"]))))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["fH"]))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&2 * h0 = #2.52`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`f IN face_set (hypermap_of_fan (V,E))`))) (term_tac (have_gen_tac [](move ["f_in"])))); + (((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`x IN f <=> ?k. k < CARD f /\ x = (f_fan_pair_ext (V,E) POWER k) d`))) (term_tac (have_gen_tac ["x"](move ["x_in_f"])))); + ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("face", [face]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FINITE_ORBIT_MAP", [FINITE_ORBIT_MAP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dart_of_fan (V,E)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`CARD f`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("face_map_and_darts", [face_map_and_darts]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("face", [face]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("fH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_ROT (-1)) ((THENL) (split_tac) [((case THEN (move ["v0"])) THEN (case THEN (move ["w0"])) THEN (case THEN (move ["h_all"])) THEN (case THEN (move ["v0w0_inE"])) THEN (move ["dist0"])); ((case THEN (move ["k0"])) THEN (case THEN (move ["h_all"])) THEN (case THEN (move ["k0_lt"])))])); + ((fun arg_tac -> arg_tac (Arg_term (`(_1 POWER k0) d`))) (term_tac (set_tac "x"))); + ((BETA_TAC THEN (move ["dist_x"])) THEN (((fun arg_tac -> arg_tac (Arg_term (`FST x`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`SND x`))) (term_tac exists_tac))) THEN ((((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("dist_x", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))))); + ((THENL_LAST) (split_tac) (((((fun arg_tac -> (use_arg_then2 ("f_surr_in_e_prime", [f_surr_in_e_prime])) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("x_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face", [lemma_in_face]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("in_e_prime", [in_e_prime]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] []))))) THEN (move ["v"]) THEN (move ["w"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["vw_in"])) THEN (move ["vw_in_f"]) THEN (move ["neq"])); + ((((fun arg_tac -> (use_arg_then2 ("pack_dist", [pack_dist])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((THENL) (((use_arg_then2 ("vw_in_f", [])) (disch_tac [])) THEN (clear_assumption "vw_in_f") THEN case) [(ALL_TAC); (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] []))))]) THEN ((((use_arg_then2 ("x_in_f", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["k"])) THEN (case THEN (move ["k_lt"])) THEN (move ["vw_eq"])) THEN (((use_arg_then2 ("vw_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("h_all", [])) (fun fst_arg -> (use_arg_then2 ("k_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("neq", [])) (disch_tac [])) THEN (clear_assumption "neq") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (move ["k_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Geomdetail.PAIR_EQ_EXPAND)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_eq", [])) (disch_tac [])) THEN (clear_assumption "vw_eq") THEN BETA_TAC) THEN (((((use_arg_then2 ("k_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x_def", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("pair_expand", [pair_expand])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`?k0. k0 < CARD f /\ (v0,w0 = (f_fan_pair_ext (V,E) POWER k0) d + \/ w0,v0 = (f_fan_pair_ext (V,E) POWER k0) d)`))) (term_tac (have_gen_tac [](case THEN ((move ["k0"]) THEN (case THEN (move ["k0_lt"])) THEN (move ["v0w0_eq"])))))); + ((((use_arg_then2 ("v0w0_inE", [])) (disch_tac [])) THEN (clear_assumption "v0w0_inE") THEN BETA_TAC) THEN ((((use_arg_then2 ("in_e_prime", [in_e_prime]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("x_in_f", []))(thm_tac (new_rewrite [] []))))))); + ((BETA_TAC THEN (case THEN (move ["_"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["k0"])) THEN (move ["h"])) THEN ((use_arg_then2 ("k0", [])) (term_tac exists_tac)) THEN (done_tac)); + (((use_arg_then2 ("k0", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("k0_lt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((THENL_LAST) ((THENL) (split_tac) [((move ["k"]) THEN (case THEN (move ["k_lt"])) THEN (move ["k_neq"])); ALL_TAC]) ((((use_arg_then2 ("v0w0_eq", [])) (disch_tac [])) THEN (clear_assumption "v0w0_eq") THEN BETA_TAC THEN (case THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))))) THEN ((repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("w0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("dist0", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`(_1 POWER k) d`))) (term_tac (set_tac "x"))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("h_all", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`FST x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SND x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_surr_in_e_prime", [f_surr_in_e_prime])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) (split_tac) ((DISJ1_TAC) THEN ((((use_arg_then2 ("x_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face", [lemma_in_face]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("k_neq", [])) (disch_tac [])) THEN (clear_assumption "k_neq") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Geomdetail.PAIR_EQ_EXPAND)))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FULLY_SURROUNDED_IMP_CARD_FACE_GE_3", [FULLY_SURROUNDED_IMP_CARD_FACE_GE_3])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["card_f_ge3"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_simple_hypermap", [fully_surrounded_simple_hypermap])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["simpleH"]))); + ((((use_arg_then2 ("v0w0_eq", [])) (disch_tac [])) THEN (clear_assumption "v0w0_eq") THEN BETA_TAC THEN (case THEN (move ["eq"])) THEN (case THEN ALL_TAC)) THEN ((((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("x_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("eq", []))(fun tmp_arg1 -> (use_arg_then2 ("f_fan_pair_ext_power_inj", [f_fan_pair_ext_power_inj]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))) THEN (move ["eq2"])) THEN ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`CARD f <= 2`))) (term_tac (have_gen_tac []ALL_TAC)))) ((((use_arg_then2 ("card_f_ge3", [])) (disch_tac [])) THEN (clear_assumption "card_f_ge3") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))); + ((fun arg_tac -> arg_tac (Arg_term (`f = face (hypermap_of_fan (V,E)) (v0,w0)`))) (term_tac (have_gen_tac [](move ["f_eq2"])))); + ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face", [lemma_in_face]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("f_eq2", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("linear_face_simple_hyp", [linear_face_simple_hyp])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("simpleH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq2", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq2", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face", [lemma_in_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair_ext_power_in_dart", [f_fan_pair_ext_power_in_dart]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`f = face (hypermap_of_fan (V,E)) (w0,v0)`))) (term_tac (have_gen_tac [](move ["f_eq2"])))); + ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face", [lemma_in_face]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("f_eq2", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("linear_face_simple_hyp", [linear_face_simple_hyp])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("simpleH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq2", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq2", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face", [lemma_in_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair_ext_power_in_dart", [f_fan_pair_ext_power_in_dart]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Face3 *) +Sections.begin_section "Face3";; +(Sections.add_section_hyp "ineq" (JEJTVGB_std3_concl));; + +(* Lemma ineq_tau3_tauVEF *) +let ineq_tau3_tauVEF = Sections.section_proof ["d"] +`d IN darts_k 3 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y4_fan (V,E) d <= #2.52 + ==> &0 <= tauVEF (V,E,face (hypermap_of_fan (V,E)) d)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (move ["_"]))))); + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in3"])); + ((((use_arg_then2 ("vw_in3", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"]) THEN (move ["bounds"]))); + ((((use_arg_then2 ("f_surr_tau3_eq_tauVEF", [f_surr_tau3_eq_tauVEF]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ineq", [ineq]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&2 * h0 = #2.52`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("ys_eq", [ys_eq])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4'_eq_y4", [y4'_eq_y4]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y3_lo", [y3_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y3_hi", [y3_hi])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("y4_lo", [y4_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y5_lo", [y5_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ineq_tau3 *) +let ineq_tau3 = Sections.section_proof ["d"] +`d IN darts_k 3 (hypermap_of_fan (V,E)) + ==> &0 <= tau_fan (V,E) (face (hypermap_of_fan (V,E)) d)` +[ + (((((use_arg_then2 ("tau_fan", [tau_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_POS", [REAL_ABS_POS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Std *) +Sections.begin_section "Std";; +(Sections.add_section_hyp "std" (`E = ESTD V`));; + +(* Lemma ineq_tau3_tauVEF_std *) +let ineq_tau3_tauVEF_std = Sections.section_proof ["d"] +`d IN darts_k 3 (hypermap_of_fan (V,E)) + ==> &0 <= tauVEF (V,E,face (hypermap_of_fan (V,E)) d)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((BETA_TAC THEN (move ["d_in3"])) THEN (((fun arg_tac -> (use_arg_then2 ("ineq_tau3_tauVEF", [ineq_tau3_tauVEF])) (fun fst_arg -> (use_arg_then2 ("d_in3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + ((((use_arg_then2 ("d_in3", [])) (disch_tac [])) THEN (clear_assumption "d_in3") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + (((((use_arg_then2 ("y5_hi_std2", [y5_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4_hi_std2", [y4_hi_std2]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Std *) +let ineq_tau3_tauVEF_std = Sections.finalize_theorem ineq_tau3_tauVEF_std;; +Sections.end_section "Std";; + +(* Finalization of the section Face3 *) +let ineq_tau3_tauVEF = Sections.finalize_theorem ineq_tau3_tauVEF;; +let ineq_tau3 = Sections.finalize_theorem ineq_tau3;; +let ineq_tau3_tauVEF_std = Sections.finalize_theorem ineq_tau3_tauVEF_std;; +Sections.end_section "Face3";; + +(* Section Face4 *) +Sections.begin_section "Face4";; +(Sections.add_section_hyp "ineq" (JEJTVGB_std_concl));; + +(* Lemma ineq_tau4_tauVEF *) +let ineq_tau4_tauVEF = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + ==> #0.206 <= tauVEF (V,E,face (hypermap_of_fan (V,E)) d)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (move ["_"]))))); + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in4"])); + ((((use_arg_then2 ("vw_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"]) THEN (move ["bounds"]))); + ((((use_arg_then2 ("f_surr_tau_fun_eq_tauVEF", [f_surr_tau_fun_eq_tauVEF]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_surr_localization_convex_local))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["c_local"]))); + ((fun arg_tac -> arg_tac (Arg_term (`face _ (v,w)`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`f IN face_set (hypermap_of_fan (V,E))`))) (term_tac (have_gen_tac [](move ["f_in"])))); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("c_local", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("convex_local_fan", [convex_local_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["local"])) THEN (move ["_"]))); + (((fun arg_tac -> (use_arg_then2 ("ineq", [ineq])) (fun fst_arg -> (use_arg_then2 ("c_local", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ))) (fun fst_arg -> (use_arg_then2 ("local", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_tame", [d_tame]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(4 = 3)`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("tau_fun_local", [tau_fun_local]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("packing_v_prime", [packing_v_prime]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("v_prime_subset", [v_prime_subset]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) (split_tac) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((THENL) (split_tac) [((move ["a"]) THEN (move ["b"]) THEN (move ["h"])); ALL_TAC]) ((((fun arg_tac -> (use_arg_then2 ("local_diag", [local_diag])) (fun fst_arg -> (use_arg_then2 ("f_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("local_std", [local_std])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) THEN (move ["k"]) THEN (move ["k_lt"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`k = 0 \/ k = 1 \/ k = 2 \/ k = 3`))) (term_tac (have_gen_tac []ALL_TAC))) ((((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (case)) THEN (BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y6_fan", [y6_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y9_fan", [y9_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`4 - 2 = 2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y8_fan", [y8_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`4 - 3 = 1`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma ineq_tau4 *) +let ineq_tau4 = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + ==> #0.206 <= tau_fan (V,E) (face (hypermap_of_fan (V,E)) d)` +[ + (BETA_TAC THEN (move ["d_in4"]) THEN (move ["bounds"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq_tau4_tauVEF", [ineq_tau4_tauVEF])) (fun fst_arg -> (use_arg_then2 ("d_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("tau_fan", [tau_fan]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Section Std *) +Sections.begin_section "Std";; +(Sections.add_section_hyp "std" (`E = ESTD V`));; + +(* Lemma ineq_tau4_tauVEF_std *) +let ineq_tau4_tauVEF_std = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> #0.206 <= tauVEF (V,E,face (hypermap_of_fan (V,E)) d)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((BETA_TAC THEN (move ["d_in4"])) THEN (((fun arg_tac -> (use_arg_then2 ("ineq_tau4_tauVEF", [ineq_tau4_tauVEF])) (fun fst_arg -> (use_arg_then2 ("d_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + ((((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN (clear_assumption "d_in4") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + (((((use_arg_then2 ("y5_hi_std2", [y5_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y8_hi_std", [y8_hi_std]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_hi_std", [y9_hi_std]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ineq_tau4_std *) +let ineq_tau4_std = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> #0.206 <= tau_fan (V,E) (face (hypermap_of_fan (V,E)) d)` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("ineq_tau4_tauVEF_std", [ineq_tau4_tauVEF_std])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then2 ("tau_fan", [tau_fan]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section Std *) +let ineq_tau4_tauVEF_std = Sections.finalize_theorem ineq_tau4_tauVEF_std;; +let ineq_tau4_std = Sections.finalize_theorem ineq_tau4_std;; +Sections.end_section "Std";; + +(* Finalization of the section Face4 *) +let ineq_tau4_tauVEF = Sections.finalize_theorem ineq_tau4_tauVEF;; +let ineq_tau4 = Sections.finalize_theorem ineq_tau4;; +let ineq_tau4_tauVEF_std = Sections.finalize_theorem ineq_tau4_tauVEF_std;; +let ineq_tau4_std = Sections.finalize_theorem ineq_tau4_std;; +Sections.end_section "Face4";; + +(* Section Face5 *) +Sections.begin_section "Face5";; +(Sections.add_section_hyp "ineq" (JEJTVGB_std_concl));; + +(* Lemma ineq_tau5_tauVEF *) +let ineq_tau5_tauVEF = Sections.section_proof ["d"] +`d IN darts_k 5 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + /\ ye_fan ((f_fan_pair_ext (V,E) POWER 2) d) <= #2.52 + ==> #0.4819 <= tauVEF (V,E,face (hypermap_of_fan (V,E)) d)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (move ["_"]))))); + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in_k"])); + ((((use_arg_then2 ("vw_in_k", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"]) THEN (move ["bounds"]))); + ((((use_arg_then2 ("f_surr_tau_fun_eq_tauVEF", [f_surr_tau_fun_eq_tauVEF]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_surr_localization_convex_local))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["c_local"]))); + ((fun arg_tac -> arg_tac (Arg_term (`face _ (v,w)`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`f IN face_set (hypermap_of_fan (V,E))`))) (term_tac (have_gen_tac [](move ["f_in"])))); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("c_local", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("convex_local_fan", [convex_local_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["local"])) THEN (move ["_"]))); + (((fun arg_tac -> (use_arg_then2 ("ineq", [ineq])) (fun fst_arg -> (use_arg_then2 ("c_local", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ))) (fun fst_arg -> (use_arg_then2 ("local", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_tame", [d_tame]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(5 = 3)`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(5 = 4)`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("tau_fun_local", [tau_fun_local]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("packing_v_prime", [packing_v_prime]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("v_prime_subset", [v_prime_subset]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) (split_tac) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) (split_tac) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((THENL) (split_tac) [((move ["a"]) THEN (move ["b"]) THEN (move ["h"])); ALL_TAC]) ((((fun arg_tac -> (use_arg_then2 ("local_diag", [local_diag])) (fun fst_arg -> (use_arg_then2 ("f_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("local_std", [local_std])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) THEN (move ["k"]) THEN (move ["k_lt"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`k = 0 \/ k = 1 \/ k = 2 \/ k = 3 \/ k = 4`))) (term_tac (have_gen_tac []ALL_TAC))) ((((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (case)) THEN (BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y6_fan", [y6_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y9_fan", [y9_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("ye_fan", [ye_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`5 - 3 = 2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y8_fan", [y8_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`5 - 4 = 1`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma ineq_tau5 *) +let ineq_tau5 = Sections.section_proof ["d"] +`d IN darts_k 5 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + /\ ye_fan ((f_fan_pair_ext (V,E) POWER 2) d) <= #2.52 + ==> #0.4819 <= tau_fan (V,E) (face (hypermap_of_fan (V,E)) d)` +[ + (BETA_TAC THEN (move ["d_in"]) THEN (move ["bounds"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq_tau5_tauVEF", [ineq_tau5_tauVEF])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("tau_fan", [tau_fan]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Section Std *) +Sections.begin_section "Std";; +(Sections.add_section_hyp "std" (`E = ESTD V`));; + +(* Lemma ineq_tau5_tauVEF_std *) +let ineq_tau5_tauVEF_std = Sections.section_proof ["d"] +`d IN darts_k 5 (hypermap_of_fan (V,E)) + ==> #0.4819 <= tauVEF (V,E,face (hypermap_of_fan (V,E)) d)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((BETA_TAC THEN (move ["d_in5"])) THEN (((fun arg_tac -> (use_arg_then2 ("ineq_tau5_tauVEF", [ineq_tau5_tauVEF])) (fun fst_arg -> (use_arg_then2 ("d_in5", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + ((((use_arg_then2 ("d_in5", [])) (disch_tac [])) THEN (clear_assumption "d_in5") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + ((((use_arg_then2 ("y5_hi_std2", [y5_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y8_hi_std", [y8_hi_std]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_hi_std", [y9_hi_std]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y6_def", [y6_def]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_fan_pair_ext_power_in_dart", [f_fan_pair_ext_power_in_dart]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma ineq_tau5_std *) +let ineq_tau5_std = Sections.section_proof ["d"] +`d IN darts_k 5 (hypermap_of_fan (V,E)) + ==> #0.4819 <= tau_fan (V,E) (face (hypermap_of_fan (V,E)) d)` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("ineq_tau5_tauVEF_std", [ineq_tau5_tauVEF_std])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then2 ("tau_fan", [tau_fan]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section Std *) +let ineq_tau5_tauVEF_std = Sections.finalize_theorem ineq_tau5_tauVEF_std;; +let ineq_tau5_std = Sections.finalize_theorem ineq_tau5_std;; +Sections.end_section "Std";; + +(* Finalization of the section Face5 *) +let ineq_tau5_tauVEF = Sections.finalize_theorem ineq_tau5_tauVEF;; +let ineq_tau5 = Sections.finalize_theorem ineq_tau5;; +let ineq_tau5_tauVEF_std = Sections.finalize_theorem ineq_tau5_tauVEF_std;; +let ineq_tau5_std = Sections.finalize_theorem ineq_tau5_std;; +Sections.end_section "Face5";; + +(* Section Face6 *) +Sections.begin_section "Face6";; +(Sections.add_section_hyp "ineq" (JEJTVGB_std_concl));; + +(* Lemma ineq_tau6_tauVEF *) +let ineq_tau6_tauVEF = Sections.section_proof ["d"] +`d IN darts_k 6 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + /\ ye_fan ((f_fan_pair_ext (V,E) POWER 2) d) <= #2.52 + /\ ye_fan ((f_fan_pair_ext (V,E) POWER 3) d) <= #2.52 + ==> #0.712 <= tauVEF (V,E,face (hypermap_of_fan (V,E)) d)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (move ["_"]))))); + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in_k"])); + ((((use_arg_then2 ("vw_in_k", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"]) THEN (move ["bounds"]))); + ((((use_arg_then2 ("f_surr_tau_fun_eq_tauVEF", [f_surr_tau_fun_eq_tauVEF]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_surr_localization_convex_local))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["c_local"]))); + ((fun arg_tac -> arg_tac (Arg_term (`face _ (v,w)`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`f IN face_set (hypermap_of_fan (V,E))`))) (term_tac (have_gen_tac [](move ["f_in"])))); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("c_local", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("convex_local_fan", [convex_local_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["local"])) THEN (move ["_"]))); + (((fun arg_tac -> (use_arg_then2 ("ineq", [ineq])) (fun fst_arg -> (use_arg_then2 ("c_local", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ))) (fun fst_arg -> (use_arg_then2 ("local", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_tame", [d_tame]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(6 = 3) /\ ~(6 = 4) /\ ~(6 = 5)`))) (term_tac (have_gen_tac [](move ["neqs"])))) ((arith_tac) THEN (done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("neqs", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("tau_fun_local", [tau_fun_local]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("packing_v_prime", [packing_v_prime]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("v_prime_subset", [v_prime_subset]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) (split_tac) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((THENL) (split_tac) [((move ["a"]) THEN (move ["b"]) THEN (move ["h"])); ALL_TAC]) ((((fun arg_tac -> (use_arg_then2 ("local_diag", [local_diag])) (fun fst_arg -> (use_arg_then2 ("f_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("local_std", [local_std])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) THEN (move ["k"]) THEN (move ["k_lt"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`k = 0 \/ k = 1 \/ k = 2 \/ k = 3 \/ k = 4 \/ k = 5`))) (term_tac (have_gen_tac []ALL_TAC))) ((((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (case)) THEN (BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y6_fan", [y6_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y9_fan", [y9_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("ye_fan", [ye_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("ye_fan", [ye_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`6 - 4 = 2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y8_fan", [y8_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`6 - 5 = 1`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma ineq_tau6 *) +let ineq_tau6 = Sections.section_proof ["d"] +`d IN darts_k 6 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + /\ ye_fan ((f_fan_pair_ext (V,E) POWER 2) d) <= #2.52 + /\ ye_fan ((f_fan_pair_ext (V,E) POWER 3) d) <= #2.52 + ==> #0.712 <= tau_fan (V,E) (face (hypermap_of_fan (V,E)) d)` +[ + (BETA_TAC THEN (move ["d_in"]) THEN (move ["bounds"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq_tau6_tauVEF", [ineq_tau6_tauVEF])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("tau_fan", [tau_fan]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Section Std *) +Sections.begin_section "Std";; +(Sections.add_section_hyp "std" (`E = ESTD V`));; + +(* Lemma ineq_tau6_tauVEF_std *) +let ineq_tau6_tauVEF_std = Sections.section_proof ["d"] +`d IN darts_k 6 (hypermap_of_fan (V,E)) + ==> #0.712 <= tauVEF (V,E,face (hypermap_of_fan (V,E)) d)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((BETA_TAC THEN (move ["d_in6"])) THEN (((fun arg_tac -> (use_arg_then2 ("ineq_tau6_tauVEF", [ineq_tau6_tauVEF])) (fun fst_arg -> (use_arg_then2 ("d_in6", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + ((((use_arg_then2 ("d_in6", [])) (disch_tac [])) THEN (clear_assumption "d_in6") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + ((((use_arg_then2 ("y5_hi_std2", [y5_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y8_hi_std", [y8_hi_std]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_hi_std", [y9_hi_std]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("y6_def", [y6_def]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_fan_pair_ext_power_in_dart", [f_fan_pair_ext_power_in_dart]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y6_def", [y6_def]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_fan_pair_ext_power_in_dart", [f_fan_pair_ext_power_in_dart]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma ineq_tau6_std *) +let ineq_tau6_std = Sections.section_proof ["d"] +`d IN darts_k 6 (hypermap_of_fan (V,E)) + ==> #0.712 <= tau_fan (V,E) (face (hypermap_of_fan (V,E)) d)` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("ineq_tau6_tauVEF_std", [ineq_tau6_tauVEF_std])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then2 ("tau_fan", [tau_fan]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section Std *) +let ineq_tau6_tauVEF_std = Sections.finalize_theorem ineq_tau6_tauVEF_std;; +let ineq_tau6_std = Sections.finalize_theorem ineq_tau6_std;; +Sections.end_section "Std";; + +(* Finalization of the section Face6 *) +let ineq_tau6_tauVEF = Sections.finalize_theorem ineq_tau6_tauVEF;; +let ineq_tau6 = Sections.finalize_theorem ineq_tau6;; +let ineq_tau6_tauVEF_std = Sections.finalize_theorem ineq_tau6_tauVEF_std;; +let ineq_tau6_std = Sections.finalize_theorem ineq_tau6_std;; +Sections.end_section "Face6";; + +(* Section Face5_pro *) +Sections.begin_section "Face5_pro";; +(Sections.add_section_hyp "ineq" (JEJTVGB_pent_pro_concl));; + +(* Lemma ineq_tau5_pro_tauVEF_aux *) +let ineq_tau5_pro_tauVEF_aux = Sections.section_proof ["d"] +`d IN darts_k 5 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + /\ ye_fan ((f_fan_pair_ext (V,E) POWER 2) d) <= #2.52 + /\ #2.52 <= y6_fan d /\ y6_fan d <= sqrt8 + ==> #0.616 <= tauVEF (V,E,face (hypermap_of_fan (V,E)) d)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (move ["_"]))))); + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in_k"])); + ((((use_arg_then2 ("vw_in_k", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"]) THEN (move ["bounds"]))); + ((((use_arg_then2 ("f_surr_tau_fun_eq_tauVEF", [f_surr_tau_fun_eq_tauVEF]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_surr_localization_convex_local))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["c_local"]))); + ((fun arg_tac -> arg_tac (Arg_term (`face _ (v,w)`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`f IN face_set (hypermap_of_fan (V,E))`))) (term_tac (have_gen_tac [](move ["f_in"])))); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("c_local", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("convex_local_fan", [convex_local_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["local"])) THEN (move ["_"]))); + (((fun arg_tac -> (use_arg_then2 ("ineq", [ineq])) (fun fst_arg -> (use_arg_then2 ("c_local", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ))) (fun fst_arg -> (use_arg_then2 ("local", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((((use_arg_then2 ("tau_fun_local", [tau_fun_local]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("packing_v_prime", [packing_v_prime]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("v_prime_subset", [v_prime_subset]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) ((THENL) (split_tac) [((move ["a"]) THEN (move ["b"]) THEN (move ["h"])); ALL_TAC]) ((((fun arg_tac -> (use_arg_then2 ("local_diag", [local_diag])) (fun fst_arg -> (use_arg_then2 ("f_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((THENL_ROT (-1)) (((((fun arg_tac -> (use_arg_then2 ("local_pro", [local_pro])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`0`))) (term_tac exists_tac)) THEN (split_tac))); + (((((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y6_fan", [y6_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); + (BETA_TAC THEN (move ["k"]) THEN (move ["k_ineq"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`k = 1 \/ k = 2 \/ k = 3 \/ k = 4`))) (term_tac (have_gen_tac []ALL_TAC))) ((((use_arg_then2 ("k_ineq", [])) (disch_tac [])) THEN (clear_assumption "k_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (case)) THEN (BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y9_fan", [y9_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("ye_fan", [ye_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`5 - 3 = 2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y8_fan", [y8_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`5 - 4 = 1`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma ineq_tau5_pro_tauVEF *) +let ineq_tau5_pro_tauVEF = Sections.section_proof ["d"] +`d IN darts_k 5 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ ye_fan ((f_fan_pair_ext (V,E) POWER 2) d) <= #2.52 + /\ #2.52 <= y9_fan (V,E) d /\ y9_fan (V,E) d <= sqrt8 + ==> #0.616 <= tauVEF (V,E,face (hypermap_of_fan (V,E)) d)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (move ["_"]))))); + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in_k"])); + ((((use_arg_then2 ("vw_in_k", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"]) THEN (move ["bounds"]))); + ((((use_arg_then2 ("f_surr_tau_fun_eq_tauVEF", [f_surr_tau_fun_eq_tauVEF]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_surr_localization_convex_local))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["c_local"]))); + ((fun arg_tac -> arg_tac (Arg_term (`face _ (v,w)`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`f IN face_set (hypermap_of_fan (V,E))`))) (term_tac (have_gen_tac [](move ["f_in"])))); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("c_local", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("convex_local_fan", [convex_local_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["local"])) THEN (move ["_"]))); + (((fun arg_tac -> (use_arg_then2 ("ineq", [ineq])) (fun fst_arg -> (use_arg_then2 ("c_local", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ))) (fun fst_arg -> (use_arg_then2 ("local", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((((use_arg_then2 ("tau_fun_local", [tau_fun_local]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("packing_v_prime", [packing_v_prime]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("v_prime_subset", [v_prime_subset]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) ((THENL) (split_tac) [((move ["a"]) THEN (move ["b"]) THEN (move ["h"])); ALL_TAC]) ((((fun arg_tac -> (use_arg_then2 ("local_diag", [local_diag])) (fun fst_arg -> (use_arg_then2 ("f_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((THENL_ROT (-1)) (((((fun arg_tac -> (use_arg_then2 ("local_pro", [local_pro])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`1`))) (term_tac exists_tac)) THEN (split_tac))); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y9_fan", [y9_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); + (BETA_TAC THEN (move ["k"]) THEN (move ["k_ineq"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`k = 0 \/ k = 2 \/ k = 3 \/ k = 4`))) (term_tac (have_gen_tac []ALL_TAC))) ((((use_arg_then2 ("k_ineq", [])) (disch_tac [])) THEN (clear_assumption "k_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (case)) THEN (BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y6_fan", [y6_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("ye_fan", [ye_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`5 - 3 = 2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y8_fan", [y8_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`5 - 4 = 1`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma ineq_tau5_pro *) +let ineq_tau5_pro = Sections.section_proof ["d"] +`d IN darts_k 5 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ ye_fan ((f_fan_pair_ext (V,E) POWER 2) d) <= #2.52 + /\ #2.52 <= y9_fan (V,E) d /\ y9_fan (V,E) d <= sqrt8 + ==> #0.616 <= tau_fan (V,E) (face (hypermap_of_fan (V,E)) d)` +[ + (BETA_TAC THEN (move ["d_in"]) THEN (move ["bounds"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq_tau5_pro_tauVEF", [ineq_tau5_pro_tauVEF])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("tau_fan", [tau_fan]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section Face5_pro *) +let ineq_tau5_pro_tauVEF_aux = Sections.finalize_theorem ineq_tau5_pro_tauVEF_aux;; +let ineq_tau5_pro_tauVEF = Sections.finalize_theorem ineq_tau5_pro_tauVEF;; +let ineq_tau5_pro = Sections.finalize_theorem ineq_tau5_pro;; +Sections.end_section "Face5_pro";; + +(* Section Face4_pro *) +Sections.begin_section "Face4_pro";; +(Sections.add_section_hyp "ineq" (JEJTVGB_quad_pro_concl));; + +(* Lemma ineq_tau4_pro_tauVEF_aux *) +let ineq_tau4_pro_tauVEF_aux = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + /\ #2.52 <= y6_fan d /\ y6_fan d <= sqrt8 + /\ sqrt8 <= y4'_fan (V,E) d + /\ sqrt8 <= y4'_fan (V,E) (f_fan_pair_ext (V,E) d) + ==> #0.477 <= tauVEF (V,E,face (hypermap_of_fan (V,E)) d)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (move ["_"]))))); + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in4"])); + ((((use_arg_then2 ("vw_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"]) THEN (move ["bounds"]))); + ((((use_arg_then2 ("f_surr_tau_fun_eq_tauVEF", [f_surr_tau_fun_eq_tauVEF]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_surr_localization_convex_local))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["c_local"]))); + ((fun arg_tac -> arg_tac (Arg_term (`face _ (v,w)`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`f IN face_set (hypermap_of_fan (V,E))`))) (term_tac (have_gen_tac [](move ["f_in"])))); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("c_local", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("convex_local_fan", [convex_local_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["local"])) THEN (move ["_"]))); + (((fun arg_tac -> (use_arg_then2 ("ineq", [ineq])) (fun fst_arg -> (use_arg_then2 ("c_local", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ))) (fun fst_arg -> (use_arg_then2 ("local", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((((use_arg_then2 ("tau_fun_local", [tau_fun_local]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("packing_v_prime", [packing_v_prime]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("v_prime_subset", [v_prime_subset]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((THENL) (split_tac) [((move ["a"]) THEN (move ["b"]) THEN (case THEN (move ["a_neq_b"])) THEN (case THEN (move ["a_in"])) THEN (case THEN (move ["b_in"])) THEN (move ["ab_not_in"])); ALL_TAC]); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE quad_diags_imp))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("a_neq_b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("a_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("b_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ab_not_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E w' v`))) (term_tac (set_tac "u"))); + (((use_arg_then2 ("bounds", [])) (disch_tac [])) THEN (clear_assumption "bounds") THEN BETA_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("y4'_fan", [y4'_fan]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES", [PERMUTES_INVERSES])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE face4_eq))) (fun fst_arg -> (use_arg_then2 ("vw_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SND", [SND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("u_def", []))(thm_tac (new_rewrite [] []))))) THEN (move ["diag_ineqs"])); + (case THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("local_pro", [local_pro])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`0`))) (term_tac exists_tac)) THEN (split_tac))); + (((((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y6_fan", [y6_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); + (BETA_TAC THEN (move ["k"]) THEN (move ["k_ineqs"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`k = 1 \/ k = 2 \/ k = 3`))) (term_tac (have_gen_tac []ALL_TAC))) ((((use_arg_then2 ("k_ineqs", [])) (disch_tac [])) THEN (clear_assumption "k_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (case)) THEN (BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y9_fan", [y9_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`4 - 2 = 2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y8_fan", [y8_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`4 - 3 = 1`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma ineq_tau4_pro_tauVEF *) +let ineq_tau4_pro_tauVEF = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ #2.52 <= y9_fan (V,E) d /\ y9_fan (V,E) d <= sqrt8 + /\ sqrt8 <= y4'_fan (V,E) d + /\ sqrt8 <= y4'_fan (V,E) (f_fan_pair_ext (V,E) d) + ==> #0.477 <= tauVEF (V,E,face (hypermap_of_fan (V,E)) d)` +[ + (BETA_TAC THEN (move ["d_in4"]) THEN (move ["bounds"])); + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((fun arg_tac -> arg_tac (Arg_term (`face (hypermap_of_fan (V,E)) d = face (hypermap_of_fan (V,E)) (f_fan_pair_ext (V,E) d)`))) (term_tac (have_gen_tac [](move ["f_eq"])))); + (((use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (thm_tac apply_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face", [lemma_in_face]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("ineq_tau4_pro_tauVEF_aux", [ineq_tau4_pro_tauVEF_aux])) (thm_tac apply_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("dart4_yf_eq", [dart4_yf_eq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`_1 IN _2`))) (term_tac (have_gen_tac [](move ["in4"]))))); + (((((use_arg_then2 ("dart4_cross_eq_y4'", [dart4_cross_eq_y4']))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES", [PERMUTES_INVERSES])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN (clear_assumption "d_in4") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["card_f"]))); + ((((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma ineq_tau4_pro *) +let ineq_tau4_pro = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ #2.52 <= y9_fan (V,E) d /\ y9_fan (V,E) d <= sqrt8 + /\ sqrt8 <= y4'_fan (V,E) d + /\ sqrt8 <= y4'_fan (V,E) (f_fan_pair_ext (V,E) d) + ==> #0.477 <= tau_fan (V,E) (face (hypermap_of_fan (V,E)) d)` +[ + (BETA_TAC THEN (move ["d_in4"]) THEN (move ["bounds"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq_tau4_pro_tauVEF", [ineq_tau4_pro_tauVEF])) (fun fst_arg -> (use_arg_then2 ("d_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("tau_fan", [tau_fan]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section Face4_pro *) +let ineq_tau4_pro_tauVEF_aux = Sections.finalize_theorem ineq_tau4_pro_tauVEF_aux;; +let ineq_tau4_pro_tauVEF = Sections.finalize_theorem ineq_tau4_pro_tauVEF;; +let ineq_tau4_pro = Sections.finalize_theorem ineq_tau4_pro;; +Sections.end_section "Face4_pro";; + +(* Section Face4_diag3 *) +Sections.begin_section "Face4_diag3";; +(Sections.add_section_hyp "ineq" (JEJTVGB_quad_diag_concl));; + +(* Lemma ineq_tau4_diag3_tauVEF *) +let ineq_tau4_diag3_tauVEF = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + /\ &3 <= y4'_fan (V,E) d + /\ &3 <= y4'_fan (V,E) (f_fan_pair_ext (V,E) d) + ==> #0.467 <= tauVEF (V,E,face (hypermap_of_fan (V,E)) d)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (move ["_"]))))); + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in4"])); + ((((use_arg_then2 ("vw_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"]) THEN (move ["bounds"]))); + ((((use_arg_then2 ("f_surr_tau_fun_eq_tauVEF", [f_surr_tau_fun_eq_tauVEF]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_surr_localization_convex_local))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["c_local"]))); + ((fun arg_tac -> arg_tac (Arg_term (`face _ (v,w)`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`f IN face_set (hypermap_of_fan (V,E))`))) (term_tac (have_gen_tac [](move ["f_in"])))); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("c_local", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("convex_local_fan", [convex_local_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["local"])) THEN (move ["_"]))); + (((fun arg_tac -> (use_arg_then2 ("ineq", [ineq])) (fun fst_arg -> (use_arg_then2 ("c_local", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ))) (fun fst_arg -> (use_arg_then2 ("local", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((((use_arg_then2 ("tau_fun_local", [tau_fun_local]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("packing_v_prime", [packing_v_prime]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("v_prime_subset", [v_prime_subset]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((THENL) (split_tac) [((move ["a"]) THEN (move ["b"]) THEN (case THEN (move ["a_neq_b"])) THEN (case THEN (move ["a_in"])) THEN (case THEN (move ["b_in"])) THEN (move ["ab_not_in"])); ALL_TAC]); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE quad_diags_imp))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("a_neq_b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("a_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("b_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ab_not_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E w' v`))) (term_tac (set_tac "u"))); + (((use_arg_then2 ("bounds", [])) (disch_tac [])) THEN (clear_assumption "bounds") THEN BETA_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("y4'_fan", [y4'_fan]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES", [PERMUTES_INVERSES])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE face4_eq))) (fun fst_arg -> (use_arg_then2 ("vw_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SND", [SND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("u_def", []))(thm_tac (new_rewrite [] []))))) THEN (move ["diag_ineqs"])); + (case THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((fun arg_tac -> (use_arg_then2 ("local_std", [local_std])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) THEN (move ["k"]) THEN (move ["k_lt"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`k = 0 \/ k = 1 \/ k = 2 \/ k = 3`))) (term_tac (have_gen_tac []ALL_TAC))) ((((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (case)) THEN (BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y6_fan", [y6_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y9_fan", [y9_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`4 - 2 = 2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y8_fan", [y8_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`4 - 3 = 1`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma ineq_tau4_diag3 *) +let ineq_tau4_diag3 = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + /\ &3 <= y4'_fan (V,E) d + /\ &3 <= y4'_fan (V,E) (f_fan_pair_ext (V,E) d) + ==> #0.467 <= tau_fan (V,E) (face (hypermap_of_fan (V,E)) d)` +[ + (BETA_TAC THEN (move ["d_in4"]) THEN (move ["bounds"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq_tau4_diag3_tauVEF", [ineq_tau4_diag3_tauVEF])) (fun fst_arg -> (use_arg_then2 ("d_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("tau_fan", [tau_fan]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Section Std *) +Sections.begin_section "Std";; +(Sections.add_section_hyp "std" (`E = ESTD V`));; + +(* Lemma ineq_tau4_diag3_std *) +let ineq_tau4_diag3_std = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> &3 <= y4'_fan (V,E) d + /\ &3 <= y4'_fan (V,E) (f_fan_pair_ext (V,E) d) + ==> #0.467 <= tau_fan (V,E) (face (hypermap_of_fan (V,E)) d)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((BETA_TAC THEN (move ["d_in4"]) THEN (move ["bounds"])) THEN (((fun arg_tac -> (use_arg_then2 ("ineq_tau4_diag3", [ineq_tau4_diag3])) (fun fst_arg -> (use_arg_then2 ("d_in4", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + ((((use_arg_then2 ("d_in4", [])) (disch_tac [])) THEN (clear_assumption "d_in4") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + (((((use_arg_then2 ("y5_hi_std2", [y5_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y8_hi_std", [y8_hi_std]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_hi_std", [y9_hi_std]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Std *) +let ineq_tau4_diag3_std = Sections.finalize_theorem ineq_tau4_diag3_std;; +Sections.end_section "Std";; + +(* Finalization of the section Face4_diag3 *) +let ineq_tau4_diag3_tauVEF = Sections.finalize_theorem ineq_tau4_diag3_tauVEF;; +let ineq_tau4_diag3 = Sections.finalize_theorem ineq_tau4_diag3;; +let ineq_tau4_diag3_std = Sections.finalize_theorem ineq_tau4_diag3_std;; +Sections.end_section "Face4_diag3";; + +(* Section Face5_diags *) +Sections.begin_section "Face5_diags";; +(Sections.add_section_hyp "ineq" (JEJTVGB_pent_diag_concl));; + +(* Lemma ineq_tau5_diags_tauVEF *) +let ineq_tau5_diags_tauVEF = Sections.section_proof ["d"] +`d IN darts_k 5 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + /\ ye_fan ((f_fan_pair_ext (V,E) POWER 2) d) <= #2.52 + /\ sqrt8 <= y4'_fan (V,E) d + /\ sqrt8 <= y4'_fan (V,E) (f_fan_pair_ext (V,E) d) + /\ sqrt8 <= y4'_fan (V,E) ((f_fan_pair_ext (V,E) POWER 2) d) + /\ sqrt8 <= y4'_fan (V,E) ((f_fan_pair_ext (V,E) POWER 3) d) + /\ sqrt8 <= y4'_fan (V,E) (inverse (f_fan_pair_ext (V,E)) d) + ==> #0.616 <= tauVEF (V,E,face (hypermap_of_fan (V,E)) d)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (move ["_"]))))); + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in5"])); + ((((use_arg_then2 ("vw_in5", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"]) THEN (move ["bounds"]))); + ((((use_arg_then2 ("f_surr_tau_fun_eq_tauVEF", [f_surr_tau_fun_eq_tauVEF]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_surr_localization_convex_local))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["c_local"]))); + ((fun arg_tac -> arg_tac (Arg_term (`face _ (v,w)`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`f IN face_set (hypermap_of_fan (V,E))`))) (term_tac (have_gen_tac [](move ["f_in"])))); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("c_local", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("convex_local_fan", [convex_local_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["local"])) THEN (move ["_"]))); + (((fun arg_tac -> (use_arg_then2 ("ineq", [ineq])) (fun fst_arg -> (use_arg_then2 ("c_local", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ))) (fun fst_arg -> (use_arg_then2 ("local", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((((use_arg_then2 ("tau_fun_local", [tau_fun_local]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("packing_v_prime", [packing_v_prime]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("v_prime_subset", [v_prime_subset]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((THENL_ROT (-1)) ((THENL) (split_tac) [((move ["a"]) THEN (move ["b"]) THEN (case THEN (move ["a_neq_b"])) THEN (case THEN (move ["a_in"])) THEN (case THEN (move ["b_in"])) THEN (move ["ab_not_in"])); ALL_TAC])); + (((((fun arg_tac -> (use_arg_then2 ("local_std", [local_std])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) THEN (move ["k"]) THEN (move ["k_lt"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`k = 0 \/ k = 1 \/ k = 2 \/ k = 3 \/ k = 4`))) (term_tac (have_gen_tac []ALL_TAC))) ((((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (case)) THEN (BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y6_fan", [y6_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y9_fan", [y9_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("ye_fan", [ye_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`5 - 3 = 2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y8_fan", [y8_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`5 - 4 = 1`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE pent_diags_imp))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in5", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("a_neq_b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("a_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("b_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ab_not_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E w' v`))) (term_tac (set_tac "u"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E u w'`))) (term_tac (set_tac "z"))); + (((use_arg_then2 ("bounds", [])) (disch_tac [])) THEN (clear_assumption "bounds") THEN BETA_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"]))); + ((fun arg_tac -> arg_tac (Arg_term (`inverse (f_fan_pair_ext (V,E)) (v,w) = (f_fan_pair_ext (V,E) POWER 4) (v,w)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`5 - 4 = 1`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES", [PERMUTES_INVERSES])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["inv_f_f"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("y4'_fan", [y4'_fan]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("THREE", [THREE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER", [POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inv_f_f", []))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`4 = SUC 3`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [2] []))))))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("COM_POWER", [COM_POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inv_f_f", []))(thm_tac (new_rewrite [] []))))); + (((repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE face5_eq))) (fun fst_arg -> (use_arg_then2 ("vw_in5", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("u_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("z_def", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["diag_ineqs"])); + ((repeat_tactic 1 9 (case)) THEN (BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma ineq_tau5_diags *) +let ineq_tau5_diags = Sections.section_proof ["d"] +`d IN darts_k 5 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + /\ ye_fan ((f_fan_pair_ext (V,E) POWER 2) d) <= #2.52 + /\ sqrt8 <= y4'_fan (V,E) d + /\ sqrt8 <= y4'_fan (V,E) (f_fan_pair_ext (V,E) d) + /\ sqrt8 <= y4'_fan (V,E) ((f_fan_pair_ext (V,E) POWER 2) d) + /\ sqrt8 <= y4'_fan (V,E) ((f_fan_pair_ext (V,E) POWER 3) d) + /\ sqrt8 <= y4'_fan (V,E) (inverse (f_fan_pair_ext (V,E)) d) + ==> #0.616 <= tau_fan (V,E) (face (hypermap_of_fan (V,E)) d)` +[ + (BETA_TAC THEN (move ["d_in"]) THEN (move ["bounds"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq_tau5_diags_tauVEF", [ineq_tau5_diags_tauVEF])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bounds", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("tau_fan", [tau_fan]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Section Std *) +Sections.begin_section "Std";; +(Sections.add_section_hyp "std" (`E = ESTD V`));; + +(* Lemma ineq_tau5_diags_std *) +let ineq_tau5_diags_std = Sections.section_proof ["d"] +`d IN darts_k 5 (hypermap_of_fan (V,E)) + ==> sqrt8 <= y4'_fan (V,E) d + /\ sqrt8 <= y4'_fan (V,E) (f_fan_pair_ext (V,E) d) + /\ sqrt8 <= y4'_fan (V,E) ((f_fan_pair_ext (V,E) POWER 2) d) + /\ sqrt8 <= y4'_fan (V,E) ((f_fan_pair_ext (V,E) POWER 3) d) + /\ sqrt8 <= y4'_fan (V,E) (inverse (f_fan_pair_ext (V,E)) d) + ==> #0.616 <= tau_fan (V,E) (face (hypermap_of_fan (V,E)) d)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((BETA_TAC THEN (move ["d_in5"]) THEN (move ["bounds"])) THEN (((fun arg_tac -> (use_arg_then2 ("ineq_tau5_diags", [ineq_tau5_diags])) (fun fst_arg -> (use_arg_then2 ("d_in5", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + ((((use_arg_then2 ("d_in5", [])) (disch_tac [])) THEN (clear_assumption "d_in5") THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["_"]))); + ((((use_arg_then2 ("y5_hi_std2", [y5_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y8_hi_std", [y8_hi_std]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_hi_std", [y9_hi_std]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("y6_def", [y6_def]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_fan_pair_ext_power_in_dart", [f_fan_pair_ext_power_in_dart]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section Std *) +let ineq_tau5_diags_std = Sections.finalize_theorem ineq_tau5_diags_std;; +Sections.end_section "Std";; + +(* Finalization of the section Face5_diags *) +let ineq_tau5_diags_tauVEF = Sections.finalize_theorem ineq_tau5_diags_tauVEF;; +let ineq_tau5_diags = Sections.finalize_theorem ineq_tau5_diags;; +let ineq_tau5_diags_std = Sections.finalize_theorem ineq_tau5_diags_std;; +Sections.end_section "Face5_diags";; + +(* Finalization of the section MainEstimate *) +let local_diag = Sections.finalize_theorem local_diag;; +let local_std = Sections.finalize_theorem local_std;; +let local_pro = Sections.finalize_theorem local_pro;; +let ineq_tau3_tauVEF = Sections.finalize_theorem ineq_tau3_tauVEF;; +let ineq_tau3 = Sections.finalize_theorem ineq_tau3;; +let ineq_tau3_tauVEF_std = Sections.finalize_theorem ineq_tau3_tauVEF_std;; +let ineq_tau4_tauVEF = Sections.finalize_theorem ineq_tau4_tauVEF;; +let ineq_tau4 = Sections.finalize_theorem ineq_tau4;; +let ineq_tau4_tauVEF_std = Sections.finalize_theorem ineq_tau4_tauVEF_std;; +let ineq_tau4_std = Sections.finalize_theorem ineq_tau4_std;; +let ineq_tau5_tauVEF = Sections.finalize_theorem ineq_tau5_tauVEF;; +let ineq_tau5 = Sections.finalize_theorem ineq_tau5;; +let ineq_tau5_tauVEF_std = Sections.finalize_theorem ineq_tau5_tauVEF_std;; +let ineq_tau5_std = Sections.finalize_theorem ineq_tau5_std;; +let ineq_tau6_tauVEF = Sections.finalize_theorem ineq_tau6_tauVEF;; +let ineq_tau6 = Sections.finalize_theorem ineq_tau6;; +let ineq_tau6_tauVEF_std = Sections.finalize_theorem ineq_tau6_tauVEF_std;; +let ineq_tau6_std = Sections.finalize_theorem ineq_tau6_std;; +let ineq_tau5_pro_tauVEF_aux = Sections.finalize_theorem ineq_tau5_pro_tauVEF_aux;; +let ineq_tau5_pro_tauVEF = Sections.finalize_theorem ineq_tau5_pro_tauVEF;; +let ineq_tau5_pro = Sections.finalize_theorem ineq_tau5_pro;; +let ineq_tau4_pro_tauVEF_aux = Sections.finalize_theorem ineq_tau4_pro_tauVEF_aux;; +let ineq_tau4_pro_tauVEF = Sections.finalize_theorem ineq_tau4_pro_tauVEF;; +let ineq_tau4_pro = Sections.finalize_theorem ineq_tau4_pro;; +let ineq_tau4_diag3_tauVEF = Sections.finalize_theorem ineq_tau4_diag3_tauVEF;; +let ineq_tau4_diag3 = Sections.finalize_theorem ineq_tau4_diag3;; +let ineq_tau4_diag3_std = Sections.finalize_theorem ineq_tau4_diag3_std;; +let ineq_tau5_diags_tauVEF = Sections.finalize_theorem ineq_tau5_diags_tauVEF;; +let ineq_tau5_diags = Sections.finalize_theorem ineq_tau5_diags;; +let ineq_tau5_diags_std = Sections.finalize_theorem ineq_tau5_diags_std;; +Sections.end_section "MainEstimate";; + +(* Section PerimeterBound *) +Sections.begin_section "PerimeterBound";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_hyp "fanV" (`FAN (vec 0,V,E)`));; +(Sections.add_section_hyp "f_surr" (`fully_surrounded (V,E)`));; + +(* Let dartH *) +Sections.add_section_lemma "dartH" (Sections.section_proof [] +`dart (hypermap_of_fan (V,E)) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Section OneFace *) +Sections.begin_section "OneFace";; +(Sections.add_section_var (mk_var ("f", (`:real^3#real^3->bool`))));; +(Sections.add_section_hyp "f_in" (`f IN face_set (hypermap_of_fan (V,E))`));; + +(* Let local *) +Sections.add_section_lemma "local" (Sections.section_proof [] +`local_fan (v_prime V f, e_prime E f, f)` +[ + (((use_arg_then2 ("f_in", [])) (disch_tac [])) THEN (clear_assumption "f_in") THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d_in"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_surr_localization))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +]);; + +(* Lemma face_eq_image_rho_node1 *) +let face_eq_image_rho_node1 = Sections.section_proof [] +`f = IMAGE (\v. v, rho_node1 f v) (v_prime V f)` +[ + ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN ((move ["a"]) THEN (move ["b"])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))); + ((THENL_ROT (-1)) ((THENL) (split_tac) [(move ["ab_in"]); ((case THEN (move ["x"])) THEN (case THEN (move ["ab_eq"])) THEN (move ["in_v_prime"]))])); + (((repeat_tactic 1 9 (((use_arg_then2 ("ab_eq", []))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("Local_lemmas.LOCAL_FAN_RHO_NODE_PROS", [Local_lemmas.LOCAL_FAN_RHO_NODE_PROS])) (fun fst_arg -> (use_arg_then2 ("local", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((use_arg_then2 ("a", [])) (term_tac exists_tac)); + ((((use_arg_then2 ("v_prime", [v_prime]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Local_lemmas.DETER_RHO_NODE))) (fun fst_arg -> (use_arg_then2 ("local", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ab_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((THENL_LAST) (split_tac) (((use_arg_then2 ("b", [])) (term_tac exists_tac)) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`a,b IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac []ALL_TAC))); + (((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("in_face_imp_in_dart_alt", [in_face_imp_in_dart_alt])) (fun fst_arg -> (use_arg_then2 ("f_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sum_face_rho_node1 *) +let sum_face_rho_node1 = Sections.section_proof ["h"] +`sum f h = sum (v_prime V f) (\v. h (v, rho_node1 f v))` +[ + ((((use_arg_then2 ("face_eq_image_rho_node1", [face_eq_image_rho_node1]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("SUM_IMAGE", [SUM_IMAGE]))(thm_tac (new_rewrite [] []))))); + ((BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (simp_tac) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"]))) THEN ((((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`h o (\v. v, rho_node1 f v) = \v. h (v, rho_node1 f v)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((ALL_TAC) THEN (done_tac))); + (((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section OneFace *) +let face_eq_image_rho_node1 = Sections.finalize_theorem face_eq_image_rho_node1;; +let sum_face_rho_node1 = Sections.finalize_theorem sum_face_rho_node1;; +Sections.end_section "OneFace";; + +(* Lemma fully_surrounded_perimeter_bound *) +let fully_surrounded_perimeter_bound = Sections.section_proof [] +`perimeterbound (V,E)` +[ + (((((use_arg_then2 ("perimeterbound", [perimeterbound]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("face_set_of_fan", [face_set_of_fan]))(thm_tac (new_rewrite [] []))))) THEN (move ["f"]) THEN (move ["f_in"])); + (((use_arg_then2 ("f_in", [])) (disch_tac [])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d_in"])) THEN (move ["f_eq"])); + ((((use_arg_then2 ("sum_face_rho_node1", [sum_face_rho_node1]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("Polar_fan.FAN_PERIMETER", [Polar_fan.FAN_PERIMETER])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`e_prime E f`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_surr_localization))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("Polar_fan.WSEWPCH", [Polar_fan.WSEWPCH]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_surr_localization_convex_local)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section PerimeterBound *) +let face_eq_image_rho_node1 = Sections.finalize_theorem face_eq_image_rho_node1;; +let sum_face_rho_node1 = Sections.finalize_theorem sum_face_rho_node1;; +let fully_surrounded_perimeter_bound = Sections.finalize_theorem fully_surrounded_perimeter_bound;; +Sections.end_section "PerimeterBound";; + +(* Section ExtraPentSplit *) +Sections.begin_section "ExtraPentSplit";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_hyp "h_fan" (`lp_fan (V,E)`));; + +(* Let dart1_eq *) +Sections.add_section_lemma "dart1_eq" (Sections.section_proof [] +`dart1_of_fan (V,E) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (move ["h"])) THEN (((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let dartH *) +Sections.add_section_lemma "dartH" (Sections.section_proof [] +`dart (hypermap_of_fan (V,E)) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (move ["h"])) THEN (((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let split_eq *) +Sections.add_section_lemma "split_eq" (Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) ==> split_fan_face (V,E) d = V, add_diag (V,E) d` +[ + ((((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"])) THEN ((((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add_diag", [add_diag]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; +(Sections.add_section_hyp "ineq_apex_flat" ((hd (Ineq.getexact "6988401556")).ineq));; +(Sections.add_section_hyp "ineq_apex_A" ((hd (Ineq.getexact "8082208587")).ineq));; + +(* Lemma ineq_tau4_extra *) +let ineq_tau4_extra = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ #2.52 <= y6_fan d /\ y6_fan d <= sqrt8 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + /\ y4'_fan (V,E) d <= sqrt8 + ==> &0 <= tauVEF (V,E,face (hypermap_of_fan (V,E)) d)` +[ + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in4"]) THEN (move ["bounds"])); + ((((use_arg_then2 ("vw_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"]))); + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((((use_arg_then2 ("dart4_tauVEF_eq_tauq", [dart4_tauVEF_eq_tauq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("tauq", [tauq]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("taum_sym_reflect", [taum_sym_reflect]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Tame_lemmas.taum_sym", [Tame_lemmas.taum_sym]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#2.0 = &2 /\ &2 * h0 = #2.52`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + (in_tac ["ineq_apex_flat"; "ineq_apex_A"] false ((repeat_tactic 1 9 (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("Ineq.apex_flat", [Ineq.apex_flat]))(fun tmp_arg1 -> (use_arg_then2 ("Ineq.apex_A", [Ineq.apex_A]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("REAL_LE_ADD", [REAL_LE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (split_tac) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_TRANS", [REAL_LT_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LT_TRANS") THEN (DISCH_THEN apply_tac))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`#0.2759`))) (term_tac exists_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("ineq_apex_A", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart4_y4'_lo", [dart4_y4'_lo]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`#0.103`))) (term_tac exists_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("ineq_apex_flat", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("y7_lo", [y7_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_hi", [y7_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y8_lo", [y8_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_lo", [y9_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart4_y4'_lo", [dart4_y4'_lo]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma lp_tau_split4_extra *) +let lp_tau_split4_extra = Sections.section_proof ["d"] +`lp_tau (V,E) /\ d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ #2.52 <= y6_fan d /\ y6_fan d <= sqrt8 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + /\ y4'_fan (V,E) d <= sqrt8 + ==> lp_tau (V, add_diag (V,E) d)` +[ + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (case THEN (move ["h_tau"])) THEN (move ["vw_in4"]) THEN (move ["bounds"])); + ((((use_arg_then2 ("vw_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"]))); + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((((use_arg_then2 ("lp_tau", [lp_tau]))(thm_tac (new_rewrite [] [])))) THEN (move ["f"]) THEN (move ["f_in2"])); + ((((use_arg_then2 ("f_in2", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE faces_add_diag)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((THENL_ROT (-1)) ((THENL) case [(move ["f_eqs"]); ((case THEN (move ["f_in"])) THEN (move ["_"]))])); + (((((use_arg_then2 ("tauVEF_add_diag_eq", [tauVEF_add_diag_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("h_tau", [])) (disch_tac [])) THEN (clear_assumption "h_tau") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_tau", [lp_tau]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`3 < CARD (face (hypermap_of_fan (V,E)) (v,w))`))) (term_tac (have_gen_tac [](move ["card_f_gt3"])))) ((((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE face_split_fan_face_explicit))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f_gt3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("split_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`4 - 1 = 3`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H2"))); + (((use_arg_then2 ("f_in2", [])) (disch_tac [])) THEN (clear_assumption "f_in2") THEN BETA_TAC THEN (move ["_"]) THEN (case THEN (move ["fan2"])) THEN (case THEN (move ["dart2"])) THEN (move ["f_surr2"]) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["f2_vw"]) THEN (move ["f2_w'w"]))) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["card2_vw"]) THEN (move ["card2_w'w"]))) THEN (move ["_"])); + ((((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("H2_def", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["dartH2"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["fH2"]))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#2.0 = &2 /\ &2 * h0 = #2.52`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + (in_tac ["ineq_apex_flat"; "ineq_apex_A"] false ((repeat_tactic 1 9 (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("Ineq.apex_flat", [Ineq.apex_flat]))(fun tmp_arg1 -> (use_arg_then2 ("Ineq.apex_A", [Ineq.apex_A]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))))); + (((use_arg_then2 ("f_eqs", [])) (disch_tac [])) THEN (clear_assumption "f_eqs") THEN case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("REAL_LT_TRANS", [REAL_LT_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`#0.2759`))) (term_tac exists_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN darts_k 3 H2`))) (term_tac (have_gen_tac [](move ["vw_in2_3"])))); + (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("face_face_map_eq", [face_face_map_eq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("H2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart3_tauVEF_eq_taum", [dart3_tauVEF_eq_taum]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("face_map_in_darts_k", [face_map_in_darts_k]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("H2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fH2", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("dart3_yf_eq", [dart3_yf_eq])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4'_eq_y4", [y4'_eq_y4]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ys_split_eq", [ys_split_eq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("ineq_apex_A", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart4_y4'_lo", [dart4_y4'_lo]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("REAL_LT_TRANS", [REAL_LT_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`#0.103`))) (term_tac exists_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`w',w IN darts_k 3 H2`))) (term_tac (have_gen_tac [](move ["w'w_in2_3"])))); + (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("w'w_in2_3", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH2", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["w'w_in2"])) THEN (move ["_"]))); + ((((use_arg_then2 ("H2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart3_tauVEF_eq_taum", [dart3_tauVEF_eq_taum]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4_def", [y4_def]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_def", [y9_def]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE ys_split_eq2))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("Tame_lemmas.taum_sym", [Tame_lemmas.taum_sym]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("ineq_apex_flat", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("y7_lo", [y7_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_hi", [y7_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y8_lo", [y8_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_lo", [y9_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart4_y4'_lo", [dart4_y4'_lo]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section ExtraPentSplit *) +let ineq_tau4_extra = Sections.finalize_theorem ineq_tau4_extra;; +let lp_tau_split4_extra = Sections.finalize_theorem lp_tau_split4_extra;; +Sections.end_section "ExtraPentSplit";; + +(* Section LpTau *) +Sections.begin_section "LpTau";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; + +(* Section Contravening *) +Sections.begin_section "Contravening";; +(Sections.add_section_hyp "main_estimate" (`lp_main_estimate`));; +(Sections.add_section_hyp "contrV" (`contravening V`));; + +(* Let h_fan *) +Sections.add_section_lemma "h_fan" (Sections.section_proof [] +`lp_fan (V,ESTD V)` +[ + ((((use_arg_then2 ("contravening_lp_fan", [contravening_lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let p_bound *) +Sections.add_section_lemma "p_bound" (Sections.section_proof [] +`perimeterbound (V,ESTD V)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (move ["h"]))); + ((((use_arg_then2 ("fully_surrounded_perimeter_bound", [fully_surrounded_perimeter_bound]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Lemma contravening_lp_tau *) +let contravening_lp_tau = Sections.section_proof [] +`lp_tau (V,ESTD V)` +[ + (((use_arg_then2 ("lp_tau", [lp_tau]))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Crttxat_tame.CRTTXAT", [Crttxat_tame.CRTTXAT])) (fun fst_arg -> (use_arg_then2 ("contrV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p_bound", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("Jgtdebu.JGTDEBU4", [Jgtdebu.JGTDEBU4])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("tame_9a", [tame_9a]))(thm_tac (new_rewrite [] [])))) THEN (move ["card_f_ineq"])); + (BETA_TAC THEN (move ["f"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["d"])) THEN (case THEN (move ["d_in"])) THEN (move ["f_eq"])); + ((fun arg_tac -> arg_tac (Arg_term (`CARD f = 3 \/ CARD f = 4 \/ CARD f = 5 \/ CARD f = 6`))) (term_tac (have_gen_tac []ALL_TAC))); + ((((fun arg_tac -> (use_arg_then2 ("card_f_ineq", [])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((repeat_tactic 1 9 (case)) THEN (BETA_TAC THEN (move ["card_f"]))); + ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("ineq_tau3_tauVEF_std", [ineq_tau3_tauVEF_std])) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("main_estimate", [])) (disch_tac [])) THEN (clear_assumption "main_estimate") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_main_estimate", [lp_main_estimate]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); + ((THENL_FIRST) ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`#0.206`))) (term_tac exists_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("ineq_tau4_tauVEF_std", [ineq_tau4_tauVEF_std])) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("main_estimate", [])) (disch_tac [])) THEN (clear_assumption "main_estimate") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_main_estimate", [lp_main_estimate]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); + ((THENL_FIRST) ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`#0.4819`))) (term_tac exists_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("ineq_tau5_tauVEF_std", [ineq_tau5_tauVEF_std])) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("main_estimate", [])) (disch_tac [])) THEN (clear_assumption "main_estimate") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_main_estimate", [lp_main_estimate]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); + ((THENL_FIRST) ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`#0.712`))) (term_tac exists_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("ineq_tau6_tauVEF_std", [ineq_tau6_tauVEF_std])) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("main_estimate", [])) (disch_tac [])) THEN (clear_assumption "main_estimate") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_main_estimate", [lp_main_estimate]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Finalization of the section Contravening *) +let contravening_lp_tau = Sections.finalize_theorem contravening_lp_tau;; +Sections.end_section "Contravening";; + +(* Section Split *) +Sections.begin_section "Split";; +(Sections.add_section_hyp "h_fan" (`lp_fan (V,E)`));; + +(* Let dart1_eq *) +Sections.add_section_lemma "dart1_eq" (Sections.section_proof [] +`dart1_of_fan (V,E) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (move ["h"])) THEN (((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let dartH *) +Sections.add_section_lemma "dartH" (Sections.section_proof [] +`dart (hypermap_of_fan (V,E)) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (move ["h"])) THEN (((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let split_eq *) +Sections.add_section_lemma "split_eq" (Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) ==> split_fan_face (V,E) d = V, add_diag (V,E) d` +[ + ((((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"])) THEN ((((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add_diag", [add_diag]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; + +(* Section Split4 *) +Sections.begin_section "Split4";; +(Sections.add_section_hyp "h_tau" (`lp_tau (V,E)`));; + +(* Section Apex_flat *) +Sections.begin_section "Apex_flat";; +(Sections.add_section_hyp "ineq103" ((hd (Ineq.getexact "6988401556")).ineq));; + +(* Lemma lp_tau_split4_apex_flat *) +let lp_tau_split4_apex_flat = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + /\ y4'_fan (V,E) d <= sqrt8 + ==> lp_tau (V, add_diag (V,E) d)` +[ + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in4"]) THEN (move ["bounds"])); + ((((use_arg_then2 ("vw_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"]))); + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((((use_arg_then2 ("lp_tau", [lp_tau]))(thm_tac (new_rewrite [] [])))) THEN (move ["f"]) THEN (move ["f_in2"])); + ((((use_arg_then2 ("f_in2", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE faces_add_diag)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((THENL_ROT (-1)) ((THENL) case [(move ["f_eqs"]); ((case THEN (move ["f_in"])) THEN (move ["_"]))])); + (((((use_arg_then2 ("tauVEF_add_diag_eq", [tauVEF_add_diag_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("h_tau", [])) (disch_tac [])) THEN (clear_assumption "h_tau") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_tau", [lp_tau]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`3 < CARD (face (hypermap_of_fan (V,E)) (v,w))`))) (term_tac (have_gen_tac [](move ["card_f_gt3"])))) ((((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE face_split_fan_face_explicit))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f_gt3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("split_fan_face_eq_add_diag", [split_fan_face_eq_add_diag]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`4 - 1 = 3`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H2"))); + (((use_arg_then2 ("f_in2", [])) (disch_tac [])) THEN (clear_assumption "f_in2") THEN BETA_TAC THEN (move ["_"]) THEN (case THEN (move ["fan2"])) THEN (case THEN (move ["dart2"])) THEN (move ["f_surr2"]) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["f2_vw"]) THEN (move ["f2_w'w"]))) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["card2_vw"]) THEN (move ["card2_w'w"]))) THEN (move ["_"])); + ((((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("H2_def", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["dartH2"])) THEN (move ["_"]))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#2.0 = &2 /\ &2 * h0 = #2.52`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + (in_tac ["ineq103"] false ((((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ineq.apex_flat", [Ineq.apex_flat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))))); + ((THENL_FIRST) ((((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("REAL_LT_TRANS", [REAL_LT_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`#0.103`))) (term_tac exists_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + (((use_arg_then2 ("f_eqs", [])) (disch_tac [])) THEN (clear_assumption "f_eqs") THEN case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN darts_k 3 H2`))) (term_tac (have_gen_tac [](move ["vw_in2_3"])))); + (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("H2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart3_tauVEF_eq_taum", [dart3_tauVEF_eq_taum]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4'_eq_y4", [y4'_eq_y4]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ys_split_eq", [ys_split_eq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("ineq103", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart4_y4'_lo", [dart4_y4'_lo]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`w',w IN darts_k 3 H2`))) (term_tac (have_gen_tac [](move ["w'w_in2_3"])))); + (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("w'w_in2_3", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH2", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["w'w_in2"])) THEN (move ["_"]))); + ((((use_arg_then2 ("H2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart3_tauVEF_eq_taum", [dart3_tauVEF_eq_taum]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4_def", [y4_def]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_def", [y9_def]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE ys_split_eq2))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("Tame_lemmas.taum_sym", [Tame_lemmas.taum_sym]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("ineq103", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("y7_lo", [y7_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_hi", [y7_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y8_lo", [y8_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_lo", [y9_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart4_y4'_lo", [dart4_y4'_lo]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Apex_flat *) +let lp_tau_split4_apex_flat = Sections.finalize_theorem lp_tau_split4_apex_flat;; +Sections.end_section "Apex_flat";; + +(* Section Apex_sup_flat *) +Sections.begin_section "Apex_sup_flat";; +(Sections.add_section_hyp "ineq86" ((hd (Ineq.getexact "1642527039")).ineq));; + +(* Let ineq_tau *) +Sections.add_section_lemma "ineq_tau" (Sections.section_proof ["y1";"y2";"y3";"y4";"y5";"y6"] +`ineq (apex_sup_flat y1 y2 y3 y4 y5 y6) + (&0 <= taum y1 y2 y3 y4 y5 y6)` +[ + ((in_tac ["ineq86"] true ((repeat_tactic 1 9 (((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac))) THEN (BETA_TAC THEN (move ["ys_all"]))); + ((((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_TRANS", [REAL_LT_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LT_TRANS") THEN (DISCH_THEN apply_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`#0.128 + #0.053 * ((y5 + y6 - &4) - #2.75 / &2 * (y4 - sqrt8))`))) (term_tac exists_tac)) THEN (split_tac)); + ((((use_arg_then2 ("ys_all", [])) (disch_tac [])) THEN (clear_assumption "ys_all") THEN BETA_TAC) THEN ((((use_arg_then2 ("Ineq.apex_sup_flat", [Ineq.apex_sup_flat]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + ((((use_arg_then2 ("Flyspeck_constants.bounds", [Flyspeck_constants.bounds])) (disch_tac [])) THEN (clear_assumption "Flyspeck_constants.bounds") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`a + c < b <=> &0 < (b - a) - c`))) (term_tac (have_gen_tac ["a"; "b"; "c"](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("real_gt", [real_gt]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ineq86", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; + +(* Lemma lp_tau_split4_apex_sup_flat *) +let lp_tau_split4_apex_sup_flat = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + /\ sqrt8 <= y4'_fan (V,E) d + /\ y4'_fan (V,E) d <= &3 + ==> lp_tau (V, add_diag (V,E) d)` +[ + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in4"]) THEN (move ["bounds"])); + ((((use_arg_then2 ("vw_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"]))); + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((((use_arg_then2 ("lp_tau", [lp_tau]))(thm_tac (new_rewrite [] [])))) THEN (move ["f"]) THEN (move ["f_in2"])); + ((((use_arg_then2 ("f_in2", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE faces_add_diag)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((THENL_ROT (-1)) ((THENL) case [(move ["f_eqs"]); ((case THEN (move ["f_in"])) THEN (move ["_"]))])); + (((((use_arg_then2 ("tauVEF_add_diag_eq", [tauVEF_add_diag_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("h_tau", [])) (disch_tac [])) THEN (clear_assumption "h_tau") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_tau", [lp_tau]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`3 < CARD (face (hypermap_of_fan (V,E)) (v,w))`))) (term_tac (have_gen_tac [](move ["card_f_gt3"])))) ((((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE face_split_fan_face_explicit))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f_gt3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("split_fan_face_eq_add_diag", [split_fan_face_eq_add_diag]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`4 - 1 = 3`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H2"))); + (((use_arg_then2 ("f_in2", [])) (disch_tac [])) THEN (clear_assumption "f_in2") THEN BETA_TAC THEN (move ["_"]) THEN (case THEN (move ["fan2"])) THEN (case THEN (move ["dart2"])) THEN (move ["f_surr2"]) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["f2_vw"]) THEN (move ["f2_w'w"]))) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["card2_vw"]) THEN (move ["card2_w'w"]))) THEN (move ["_"])); + ((((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("H2_def", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["dartH2"])) THEN (move ["_"]))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#2.0 = &2 /\ #3.0 = &3`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((arith_tac) THEN (done_tac))); + (in_tac ["ineq_tau"] false ((((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ineq.apex_sup_flat", [Ineq.apex_sup_flat]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))))); + (((use_arg_then2 ("f_eqs", [])) (disch_tac [])) THEN (clear_assumption "f_eqs") THEN case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN darts_k 3 H2`))) (term_tac (have_gen_tac [](move ["vw_in2_3"])))); + (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("H2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart3_tauVEF_eq_taum", [dart3_tauVEF_eq_taum]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4'_eq_y4", [y4'_eq_y4]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ys_split_eq", [ys_split_eq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("ineq_tau", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`w',w IN darts_k 3 H2`))) (term_tac (have_gen_tac [](move ["w'w_in2_3"])))); + (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("w'w_in2_3", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH2", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["w'w_in2"])) THEN (move ["_"]))); + ((((use_arg_then2 ("H2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart3_tauVEF_eq_taum", [dart3_tauVEF_eq_taum]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4_def", [y4_def]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_def", [y9_def]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE ys_split_eq2))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("Tame_lemmas.taum_sym", [Tame_lemmas.taum_sym]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("ineq_tau", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("y7_lo", [y7_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y7_hi", [y7_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y8_lo", [y8_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_lo", [y9_lo]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Apex_sup_flat *) +let lp_tau_split4_apex_sup_flat = Sections.finalize_theorem lp_tau_split4_apex_sup_flat;; +Sections.end_section "Apex_sup_flat";; +(Sections.add_section_hyp "ineq103" ((hd (Ineq.getexact "6988401556")).ineq));; +(Sections.add_section_hyp "ineq86" ((hd (Ineq.getexact "1642527039")).ineq));; + +(* Lemma lp_tau_split4 *) +let lp_tau_split4 = Sections.section_proof ["d"] +`d IN darts_k 4 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + /\ y4'_fan (V,E) d <= &3 + ==> lp_tau (V, add_diag (V,E) d)` +[ + (BETA_TAC THEN (move ["d_in4"]) THEN (move ["bounds"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_LE_TOTAL", [REAL_LE_TOTAL])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y4'_fan (V,E) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sqrt8`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["y4'_ineq"])); + ((((use_arg_then2 ("lp_tau_split4_apex_flat", [lp_tau_split4_apex_flat]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("lp_tau_split4_apex_sup_flat", [lp_tau_split4_apex_sup_flat]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section Split4 *) +let lp_tau_split4_apex_flat = Sections.finalize_theorem lp_tau_split4_apex_flat;; +let lp_tau_split4_apex_sup_flat = Sections.finalize_theorem lp_tau_split4_apex_sup_flat;; +let lp_tau_split4 = Sections.finalize_theorem lp_tau_split4;; +Sections.end_section "Split4";; + +(* Section Split5 *) +Sections.begin_section "Split5";; +(Sections.add_section_hyp "h_tau" (`lp_tau (V,E)`));; + +(* Section One_diag *) +Sections.begin_section "One_diag";; +(Sections.add_section_hyp "quad_pro" (JEJTVGB_quad_pro_concl));; +(Sections.add_section_hyp "ineq103" ((hd (Ineq.getexact "6988401556")).ineq));; + +(* Lemma lp_tau_split5_one_diag *) +let lp_tau_split5_one_diag = Sections.section_proof ["d"] +`d IN darts_k 5 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + /\ ye_fan ((f_fan_pair_ext (V,E) POWER 2) d) <= #2.52 + /\ y4'_fan (V,E) d <= sqrt8 + /\ sqrt8 <= y4'_fan (V,E) ((f_fan_pair_ext (V,E) POWER 2) d) + /\ sqrt8 <= y4'_fan (V,E) ((f_fan_pair_ext (V,E) POWER 3) d) + ==> lp_tau (V, add_diag (V,E) d)` +[ + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in5"]) THEN (move ["bounds"])); + ((((use_arg_then2 ("vw_in5", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"]))); + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((((use_arg_then2 ("lp_tau", [lp_tau]))(thm_tac (new_rewrite [] [])))) THEN (move ["f"]) THEN (move ["f_in2"])); + ((((use_arg_then2 ("f_in2", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE faces_add_diag)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((THENL_ROT (-1)) ((THENL) case [(move ["f_eqs"]); ((case THEN (move ["f_in"])) THEN (move ["_"]))])); + (((((use_arg_then2 ("tauVEF_add_diag_eq", [tauVEF_add_diag_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("h_tau", [])) (disch_tac [])) THEN (clear_assumption "h_tau") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_tau", [lp_tau]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`3 < CARD (face (hypermap_of_fan (V,E)) (v,w))`))) (term_tac (have_gen_tac [](move ["card_f_gt3"])))) ((((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE face_split_fan_face_explicit))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f_gt3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_split_fan_face))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f_gt3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("split_fan_face_eq_add_diag", [split_fan_face_eq_add_diag]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`5 - 1 = 4`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H2"))); + (((use_arg_then2 ("f_in2", [])) (disch_tac [])) THEN (clear_assumption "f_in2") THEN BETA_TAC THEN (move ["_"]) THEN (move ["f2_eqs"]) THEN (case THEN (move ["fan2"])) THEN (case THEN (move ["dart2"])) THEN (move ["f_surr2"]) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["f2_vw"]) THEN (move ["f2_w'w"]))) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["card2_vw"]) THEN (move ["card2_w'w"]))) THEN (move ["_"])); + ((((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("H2_def", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["dartH2"])) THEN (move ["_"]))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#2.0 = &2 /\ &2 * h0 = #2.52`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + (in_tac ["ineq103"] false ((((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ineq.apex_flat", [Ineq.apex_flat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))))); + (((use_arg_then2 ("f_eqs", [])) (disch_tac [])) THEN (clear_assumption "f_eqs") THEN case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("REAL_LT_TRANS", [REAL_LT_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`#0.103`))) (term_tac exists_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN darts_k 3 H2`))) (term_tac (have_gen_tac [](move ["vw_in2_3"])))); + (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("H2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart3_tauVEF_eq_taum", [dart3_tauVEF_eq_taum]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4'_eq_y4", [y4'_eq_y4]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ys_split_eq", [ys_split_eq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("ineq103", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("y4'_lo_2h0", [y4'_lo_2h0])) (fun fst_arg -> (use_arg_then2 ("vw_in5", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`w',w IN darts_k 4 H2`))) (term_tac (have_gen_tac [](move ["w'w_in2_5"])))); + (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`#0.477`))) (term_tac exists_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("H2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("ineq_tau4_pro_tauVEF_aux", [ineq_tau4_pro_tauVEF_aux])) (fun fst_arg -> (use_arg_then2 ("quad_pro", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'w_in2_5", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lp_fan_trans1", [lp_fan_trans1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE ys_split_eq2))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("y4'_lo_2h0", [y4'_lo_2h0])) (fun fst_arg -> (use_arg_then2 ("vw_in5", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) ((arith_tac) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["dart1_2_eq"]))); + ((fun arg_tac -> arg_tac (Arg_term (`w', w IN dart_of_fan (V, add_diag (V,E) (v,w))`))) (term_tac (have_gen_tac [](move ["w'w_in2"])))); + (((((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (split_tac); + ((((use_arg_then2 ("y8_fan", [y8_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ye_fan", [ye_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`inverse _`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`2 = CARD (face H2 (w',w)) - 2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [1] []))))))) ((((use_arg_then2 ("card2_w'w", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("H2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("fan2", [fan2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card2_w'w", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'w_in2", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_fan_pair_ext_power_add_diag))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))))) THEN (TRY ((arith_tac)))); + ((repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_ROT (-1)) (split_tac)); + ((((use_arg_then2 ("y4'_fan", [y4'_fan]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES", [PERMUTES_INVERSES])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("POWER_1", [POWER_1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair_power", [f_fan_pair_power]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dart1_2_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f2_eqs", []))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`sqrt8 <= y4'_fan (V,E) ((f_fan_pair_ext (V,E) POWER 3) (v,w))`))) (term_tac (have_gen_tac []ALL_TAC))) ((ALL_TAC) THEN (done_tac))); + (((use_arg_then2 ("y4'_fan", [y4'_fan]))(thm_tac (new_rewrite [] [])))); + (((fun arg_tac -> arg_tac (Arg_term (`SND _`))) (term_tac (set_tac "x1"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`FST _`))) (term_tac (set_tac "x2")))); + ((fun arg_tac -> arg_tac (Arg_term (`x1 = w'`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("x1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`5 - 3 = 2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE inverse_f_fan_pair_ext_power2)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`x2 = SND (f_fan_pair (V,E) (v,w))`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("x2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("THREE", [THREE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("COM_POWER", [COM_POWER]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`inverse _`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES_o", [PERMUTES_INVERSES_o])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("f_fan_pair_power", [f_fan_pair_power]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((use_arg_then2 ("y4'_fan", [y4'_fan]))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> arg_tac (Arg_term (`inverse _1 _2`))) (term_tac (set_tac "x1"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E w' v`))) (term_tac (set_tac "u"))); + ((fun arg_tac -> arg_tac (Arg_term (`u,w' IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["uw'_in"])))); + ((((use_arg_then2 ("u_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE inverse_f_fan_pair_ext_power2)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`2 = CARD (face (hypermap_of_fan (V,E)) (v,w)) - 3`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("lemma_dart_invariant_power_face", [lemma_dart_invariant_power_face]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`x1 = u, w'`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("x1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSE_EQ", [PERMUTES_INVERSE_EQ])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`u,w' IN dart1_of_fan (V,add_diag (V,E) (v,w))`))) (term_tac (have_gen_tac [](move ["uw'_in2"]))))); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair_power", [f_fan_pair_power]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f2_eqs", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("dart1_2_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`sqrt8 <= y4'_fan (V,E) ((f_fan_pair_ext (V,E) POWER 2) (v,w))`))) (term_tac (have_gen_tac []ALL_TAC))) ((ALL_TAC) THEN (done_tac))); + (((use_arg_then2 ("y4'_fan", [y4'_fan]))(thm_tac (new_rewrite [] [])))); + (((fun arg_tac -> arg_tac (Arg_term (`SND _`))) (term_tac (set_tac "x2"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`FST _`))) (term_tac (set_tac "x3")))); + ((fun arg_tac -> arg_tac (Arg_term (`x3 = w`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("x3_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`inverse _`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES_o", [PERMUTES_INVERSES_o])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`x2 = u`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((THENL_FIRST) ((((use_arg_then2 ("x2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`5 - 2 = 3`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("THREE", [THREE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("COM_POWER", [COM_POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE inverse_f_fan_pair_ext_power2)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("u_def", []))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("uw'_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section One_diag *) +let lp_tau_split5_one_diag = Sections.finalize_theorem lp_tau_split5_one_diag;; +Sections.end_section "One_diag";; + +(* Section Two_diags *) +Sections.begin_section "Two_diags";; +(Sections.add_section_hyp "ineq_apex_flat" ((hd (Ineq.getexact "6988401556")).ineq));; +(Sections.add_section_hyp "ineq_apex_A" ((hd (Ineq.getexact "8082208587")).ineq));; + +(* Lemma lp_tau_split5_two_diags *) +let lp_tau_split5_two_diags = Sections.section_proof ["d"] +`d IN darts_k 5 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + /\ ye_fan ((f_fan_pair_ext (V,E) POWER 2) d) <= #2.52 + /\ y4'_fan (V,E) d <= sqrt8 + /\ y4'_fan (V,E) ((f_fan_pair_ext (V,E) POWER 2) d) <= sqrt8 + ==> lp_tau (V, add_diag (V, (add_diag (V,E) d)) ((f_fan_pair_ext (V,E) POWER 2) d))` +[ + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in5"]) THEN (move ["bounds"])); + ((((use_arg_then2 ("vw_in5", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"]))); + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("lp_fan_trans1", [lp_fan_trans1])) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`v,w`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["h_fan2"]))); + ((fun arg_tac -> arg_tac (Arg_term (`add_diag (V,E) (v,w)`))) (term_tac (set_tac "E2"))); + ((fun arg_tac -> arg_tac (Arg_term (`(_1 POWER 2) (v,w)`))) (term_tac (set_tac "d2"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`3 < CARD (face (hypermap_of_fan (V,E)) (v,w))`))) (term_tac (have_gen_tac [](move ["card_f_gt3"])))) ((((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE face_split_fan_face_explicit))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f_gt3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_split_fan_face))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f_gt3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("split_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("E2_def", []))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`5 - 1 = 4`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H2"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + (BETA_TAC THEN (move ["f2_eqs"]) THEN (case THEN (move ["fan2"])) THEN (case THEN (move ["dart2"])) THEN (move ["f_surr2"]) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["f2_vw"]) THEN (move ["f2_w'w"]))) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["card2_vw"]) THEN (move ["card2_w'w"]))) THEN (move ["_"])); + ((fun arg_tac -> arg_tac (Arg_term (`d2 = (f_fan_pair_ext (V,E2) POWER 2) (w',w)`))) (term_tac (have_gen_tac [](move ["d2_eq"])))); + ((((use_arg_then2 ("E2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_fan_pair_ext_power_add_diag)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fanV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_surr", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("H2_def", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["dartH2"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["fH2"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["dart1_2_eq"]))); + ((fun arg_tac -> arg_tac (Arg_term (`w',w IN darts_k 4 H2`))) (term_tac (have_gen_tac [](move ["w'w_in4"])))); + (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card2_w'w", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("w'w_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH2", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["w'w_in2"])) THEN (move ["card_w'w"]))); + ((fun arg_tac -> arg_tac (Arg_term (`d2 IN darts_k 4 H2`))) (term_tac (have_gen_tac [](move ["d2_in4"])))); + (((((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fH2", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("face_map_in_darts_k", [face_map_in_darts_k]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("d2_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH2", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["d2_in2"])) THEN (move ["_"]))); + ((fun arg_tac -> arg_tac (Arg_term (`FST (inverse (f_fan_pair_ext (V,E2)) d2) = w`))) (term_tac (have_gen_tac [](move ["eq1"])))); + ((((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`inverse _`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES_o", [PERMUTES_INVERSES_o])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_2_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w'w_in2", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E2 w' w = SND d2`))) (term_tac (have_gen_tac [](move ["eq2"])))); + ((THENL_FIRST) ((((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart4_f_fan_pair_ext_power2", [dart4_f_fan_pair_ext_power2]))(thm_tac (new_rewrite [] []))))) (((((use_arg_then2 ("H2_def", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (done_tac))); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE inverse_f_fan_pair_ext_power2)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`add_diag (V,E2) d2 = add_diag (V,E2) (w',w)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((fun arg_tac -> (use_arg_then2 ("pair_expand", [pair_expand])) (fun fst_arg -> (use_arg_then2 ("d2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("add_diag", [add_diag]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart1_2_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d2_in2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'w_in2", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E2 (FST d2) (SND d2) = FST (inverse (f_fan_pair_ext (V,E2)) d2)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_2_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d2_in2", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((fun arg_tac -> (use_arg_then2 ("pair_expand", [pair_expand])) (fun fst_arg -> (use_arg_then2 ("d2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [3] [])))) THEN (done_tac)); + (((((use_arg_then2 ("eq1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq2", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Collect_geom.PER_SET2)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("lp_tau_split4_extra", [lp_tau_split4_extra])) (fun fst_arg -> (use_arg_then2 ("h_fan2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq_apex_flat", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq_apex_A", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("H2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'w_in4", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("E2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE ys_split_eq2))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("E2_def", []))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("y4'_lo_2h0", [y4'_lo_2h0])) (fun fst_arg -> (use_arg_then2 ("vw_in5", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) ((arith_tac) THEN (done_tac))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`y8_fan (V,E2) (w',w) <= #2.52 /\ y4'_fan (V,E2) (w',w) <= sqrt8`))) (term_tac (have_gen_tac [](move ["ineqs"]))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("ineqs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("E2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lp_tau", [lp_tau]))(thm_tac (new_rewrite [] []))))) THEN (move ["f"]) THEN (move ["f_in2"])); + ((((use_arg_then2 ("f_in2", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE faces_add_diag)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("E2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H2_def", []))(thm_tac (new_rewrite [] []))))); + ((THENL_ROT (-1)) ((THENL) case [(move ["f_eqs"]); ((case THEN (move ["f_in"])) THEN (move ["_"]))])); + (((((use_arg_then2 ("E2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("tauVEF_add_diag_eq", [tauVEF_add_diag_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("h_tau", [])) (disch_tac [])) THEN (clear_assumption "h_tau") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_tau", [lp_tau]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#2.0 = &2 /\ &2 * h0 = #2.52`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + (((use_arg_then2 ("f_eqs", [])) (disch_tac [])) THEN (clear_assumption "f_eqs") THEN case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (in_tac ["ineq_apex_flat"] false ((((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ineq.apex_flat", [Ineq.apex_flat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))))); + ((THENL_FIRST) ((((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("REAL_LT_TRANS", [REAL_LT_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`#0.103`))) (term_tac exists_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN darts_k 3 H2`))) (term_tac (have_gen_tac [](move ["vw_in2_3"])))); + (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("H2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("E2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart3_tauVEF_eq_taum", [dart3_tauVEF_eq_taum]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4'_eq_y4", [y4'_eq_y4]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ys_split_eq", [ys_split_eq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("ineq_apex_flat", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("y4'_lo_2h0", [y4'_lo_2h0])) (fun fst_arg -> (use_arg_then2 ("vw_in5", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("H2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq_tau4_extra", [ineq_tau4_extra])) (fun fst_arg -> (use_arg_then2 ("h_fan2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq_apex_flat", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq_apex_A", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("H2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'w_in4", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("E2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE ys_split_eq2))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("E2_def", []))(thm_tac (new_rewrite [] []))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("ineqs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("y4'_lo_2h0", [y4'_lo_2h0])) (fun fst_arg -> (use_arg_then2 ("vw_in5", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + (split_tac); + ((((use_arg_then2 ("y8_fan", [y8_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ye_fan", [ye_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`inverse _`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`2 = CARD (face H2 (w',w)) - 2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [1] []))))))) ((((use_arg_then2 ("card2_w'w", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("H2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("fan2", [fan2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card2_w'w", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'w_in2", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("E2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_fan_pair_ext_power_add_diag))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then2 ("d2_def", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`y4'_fan (V,E) d2 <= sqrt8`))) (term_tac (have_gen_tac []ALL_TAC))) ((ALL_TAC) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("y4'_fan", [y4'_fan]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`inverse _`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES_o", [PERMUTES_INVERSES_o])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_2_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w'w_in2", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("eq2", []))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Two_diags *) +let lp_tau_split5_two_diags = Sections.finalize_theorem lp_tau_split5_two_diags;; +Sections.end_section "Two_diags";; + +(* Finalization of the section Split5 *) +let lp_tau_split5_one_diag = Sections.finalize_theorem lp_tau_split5_one_diag;; +let lp_tau_split5_two_diags = Sections.finalize_theorem lp_tau_split5_two_diags;; +Sections.end_section "Split5";; + +(* Section Split6 *) +Sections.begin_section "Split6";; +(Sections.add_section_hyp "h_tau" (`lp_tau (V,E)`));; +(Sections.add_section_hyp "pent_pro" (JEJTVGB_pent_pro_concl));; +(Sections.add_section_hyp "ineq103" ((hd (Ineq.getexact "6988401556")).ineq));; + +(* Lemma lp_tau_split6 *) +let lp_tau_split6 = Sections.section_proof ["d"] +`d IN darts_k 6 (hypermap_of_fan (V,E)) + ==> y5_fan (V,E) d <= #2.52 + /\ y6_fan d <= #2.52 + /\ y8_fan (V,E) d <= #2.52 + /\ y9_fan (V,E) d <= #2.52 + /\ ye_fan ((f_fan_pair_ext (V,E) POWER 2) d) <= #2.52 + /\ ye_fan ((f_fan_pair_ext (V,E) POWER 3) d) <= #2.52 + /\ y4'_fan (V,E) d <= sqrt8 + ==> lp_tau (V, add_diag (V,E) d)` +[ + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in6"]) THEN (move ["bounds"])); + ((((use_arg_then2 ("vw_in6", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"]))); + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["diag"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((((use_arg_then2 ("lp_tau", [lp_tau]))(thm_tac (new_rewrite [] [])))) THEN (move ["f"]) THEN (move ["f_in2"])); + ((((use_arg_then2 ("f_in2", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE faces_add_diag)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((THENL_ROT (-1)) ((THENL) case [(move ["f_eqs"]); ((case THEN (move ["f_in"])) THEN (move ["_"]))])); + (((((use_arg_then2 ("tauVEF_add_diag_eq", [tauVEF_add_diag_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("h_tau", [])) (disch_tac [])) THEN (clear_assumption "h_tau") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_tau", [lp_tau]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`3 < CARD (face (hypermap_of_fan (V,E)) (v,w))`))) (term_tac (have_gen_tac [](move ["card_f_gt3"])))) ((((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE face_split_fan_face_explicit))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f_gt3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("split_fan_face_eq_add_diag", [split_fan_face_eq_add_diag]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`6 - 1 = 5`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H2"))); + (((use_arg_then2 ("f_in2", [])) (disch_tac [])) THEN (clear_assumption "f_in2") THEN BETA_TAC THEN (move ["_"]) THEN (case THEN (move ["fan2"])) THEN (case THEN (move ["dart2"])) THEN (move ["f_surr2"]) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["f2_vw"]) THEN (move ["f2_w'w"]))) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["card2_vw"]) THEN (move ["card2_w'w"]))) THEN (move ["_"])); + ((((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("H2_def", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["dartH2"])) THEN (move ["_"]))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#2.0 = &2 /\ &2 * h0 = #2.52`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + (in_tac ["ineq103"] false ((((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ineq.apex_flat", [Ineq.apex_flat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))))); + (((use_arg_then2 ("f_eqs", [])) (disch_tac [])) THEN (clear_assumption "f_eqs") THEN case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("REAL_LT_TRANS", [REAL_LT_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`#0.103`))) (term_tac exists_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN darts_k 3 H2`))) (term_tac (have_gen_tac [](move ["vw_in2_3"])))); + (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("H2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart3_tauVEF_eq_taum", [dart3_tauVEF_eq_taum]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4'_eq_y4", [y4'_eq_y4]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ys_split_eq", [ys_split_eq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("ineq103", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("y4'_lo_2h0", [y4'_lo_2h0])) (fun fst_arg -> (use_arg_then2 ("vw_in6", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`w',w IN darts_k 5 H2`))) (term_tac (have_gen_tac [](move ["w'w_in2_5"])))); + (((((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`#0.616`))) (term_tac exists_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("H2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("ineq_tau5_pro_tauVEF_aux", [ineq_tau5_pro_tauVEF_aux])) (fun fst_arg -> (use_arg_then2 ("pent_pro", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'w_in2_5", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lp_fan_trans1", [lp_fan_trans1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE ys_split_eq2))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("y4'_lo_2h0", [y4'_lo_2h0])) (fun fst_arg -> (use_arg_then2 ("vw_in6", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("y8_fan", [y8_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y5_fan", [y5_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ye_fan", [ye_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`inverse _`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("POWER_2", [POWER_2]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`2 = CARD (face H2 (w',w)) - 3`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [1] []))))))) ((((use_arg_then2 ("card2_w'w", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("H2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair_ext_power_inverse", [f_fan_pair_ext_power_inverse]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("fan2", [fan2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card2_w'w", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_fan_pair_ext_power_add_diag))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))))) THEN (TRY ((arith_tac)))); + ((repeat_tactic 1 9 (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Split6 *) +let lp_tau_split6 = Sections.finalize_theorem lp_tau_split6;; +Sections.end_section "Split6";; + +(* Finalization of the section Split *) +let lp_tau_split4_apex_flat = Sections.finalize_theorem lp_tau_split4_apex_flat;; +let lp_tau_split4_apex_sup_flat = Sections.finalize_theorem lp_tau_split4_apex_sup_flat;; +let lp_tau_split4 = Sections.finalize_theorem lp_tau_split4;; +let lp_tau_split5_one_diag = Sections.finalize_theorem lp_tau_split5_one_diag;; +let lp_tau_split5_two_diags = Sections.finalize_theorem lp_tau_split5_two_diags;; +let lp_tau_split6 = Sections.finalize_theorem lp_tau_split6;; +Sections.end_section "Split";; + +(* Finalization of the section LpTau *) +let contravening_lp_tau = Sections.finalize_theorem contravening_lp_tau;; +let lp_tau_split4_apex_flat = Sections.finalize_theorem lp_tau_split4_apex_flat;; +let lp_tau_split4_apex_sup_flat = Sections.finalize_theorem lp_tau_split4_apex_sup_flat;; +let lp_tau_split4 = Sections.finalize_theorem lp_tau_split4;; +let lp_tau_split5_one_diag = Sections.finalize_theorem lp_tau_split5_one_diag;; +let lp_tau_split5_two_diags = Sections.finalize_theorem lp_tau_split5_two_diags;; +let lp_tau_split6 = Sections.finalize_theorem lp_tau_split6;; +Sections.end_section "LpTau";; + +(* Close the module *) +end;; diff --git a/formal_lp/hypermap/main/lp_certificate.hl b/formal_lp/hypermap/main/lp_certificate.hl new file mode 100644 index 0000000..4288bce --- /dev/null +++ b/formal_lp/hypermap/main/lp_certificate.hl @@ -0,0 +1,114 @@ +module Lp_certificate = struct + +(* inequality id, indices of inequalities, coefficients *) +type constraint_type = string * int list * int64 list;; + +type terminal_case = { + precision : int; + infeasible: bool; + constraints : constraint_type list; + target_variables : constraint_type list; + variable_bounds : constraint_type list; +};; + +(* For testing *) +let empty_terminal = { + precision = 0; + infeasible = false; + constraints = []; + target_variables = []; + variable_bounds = []; +};; + +type split_case = { + split_type : string; + split_face : int list; +};; + +type lp_certificate_case = + Lp_terminal of terminal_case + | Lp_split of split_case * lp_certificate_case list;; + +type lp_certificate = { + hypermap_string : string; + root_case : lp_certificate_case; +};; + +type lp_certificate_info = { + terminals : int; + infeasibles: int; + precision_table: (int * int)list; + split_table: (string * int)list; +};; + +(* Counts the number of terminal cases *) +let rec count_terminals lp_case = + match lp_case with + | Lp_terminal _ -> 1 + | Lp_split (_, cs) -> itlist (+) (map count_terminals cs) 0;; + + +let case_info lp_case = + let terminals = ref 0 and + infs = ref 0 and + precision = Hashtbl.create 5 and + split = Hashtbl.create 10 in + let add_precision p = + try + let n = Hashtbl.find precision p in + Hashtbl.replace precision p (n + 1) + with Not_found -> + Hashtbl.add precision p 1 in + let add_split name = + try + let n = Hashtbl.find split name in + Hashtbl.replace split name (n + 1) + with Not_found -> + Hashtbl.add split name 1 in + let rec count case = + match case with + | Lp_terminal t -> + let _ = terminals := !terminals + 1 in + let _ = infs := !infs + if t.infeasible then 1 else 0 in + add_precision t.precision + | Lp_split (info, cs) -> + let _ = add_split info.split_type in + let _ = map count cs in + () in + let _ = count lp_case in + { + terminals = !terminals; infeasibles = !infs; + precision_table = Hashtbl.fold (fun key v list -> (key,v) :: list) precision []; + split_table = Hashtbl.fold (fun key v list -> (key,v) :: list) split []; + };; + + +let certificate_info cert = case_info cert.root_case;; + + +(* Writes a certificate into a binary file *) +let write_lp_certificates fname (certificates : lp_certificate list) = + let out = open_out_bin fname in + let _ = Marshal.to_channel out certificates [] in + close_out out;; + +(* Reads a certificate from a binary file *) +let read_lp_certificates fname = + let input = open_in_bin fname in + let certificates = (Marshal.from_channel input : lp_certificate list) in + let _ = close_in input in + certificates;; + +(******************) +(* Test functions *) +(******************) + +type test_split = Dummy | Info of string * int list * (test_split list);; + +let rec build_test_split case = + match case with + | Lp_terminal _ -> Dummy + | Lp_split (info, cs) -> + Info (info.split_type, info.split_face, map build_test_split cs);; + +end;; diff --git a/formal_lp/hypermap/main/prove_flyspeck_lp.hl b/formal_lp/hypermap/main/prove_flyspeck_lp.hl new file mode 100644 index 0000000..85508bb --- /dev/null +++ b/formal_lp/hypermap/main/prove_flyspeck_lp.hl @@ -0,0 +1,1066 @@ +needs "../formal_lp/hypermap/ineqs/lp_ineqs.hl";; +needs "../formal_lp/hypermap/ineqs/lp_head_ineqs.hl";; +needs "../formal_lp/hypermap/ineqs/lp_body_ineqs.hl";; +needs "../formal_lp/hypermap/main/lp_certificate.hl";; +needs "../formal_lp/hypermap/computations/list_hypermap_computations.hl";; +needs "../formal_lp/hypermap/computations/informal_computations.hl";; +needs "../formal_lp/more_arith/prove_lp.hl";; + + +module Flyspeck_lp = struct + +open List;; +open Arith_misc;; +open Linear_function;; +open Prove_lp;; +open Arith_nat;; +open Misc_vars;; +open List_hypermap_computations;; +open List_conversions;; +open Lp_approx_ineqs;; +open Lp_ineqs;; +open Lp_certificate;; +open Lp_informal_computations;; +open Lp_ineqs_proofs;; +open Lp_main_estimate;; + + +let init_ineqs() = + let _ = Lp_head_ineqs.add_head_ineqs() in + let _ = Lp_body_ineqs.add_body_ineqs() in + Lp_ineqs.process_raw_ineqs();; + + +(* Prepare theorems for the final inequality: &12 <= scriptL V *) +let to_lin_f_ineq ineq_th = + let lhs, rhs = dest_binop le_op_real (concl ineq_th) in + let lhs_th = LIN_F_CONV lhs in + EQ_MP (AP_THM (AP_TERM le_op_real lhs_th) rhs) ineq_th;; + +let FINAL_INEQ = (MY_RULE_NUM o prove)(`lin_f [] <= -- &n <=> n = 0`, + REWRITE_TAC[LIN_F_EMPTY; REAL_NEG_GE0; REAL_OF_NUM_LE; LE]);; + +let lnsum_ineqs = + let DECIMAL_INT = prove(`!n. DECIMAL n 1 = &n`, REWRITE_TAC[DECIMAL; REAL_DIV_1]) in + let ineq_th = (add_lp_hyp false o UNDISCH_ALL o SPEC_ALL) Lp_ineqs_proofs.lnsum_ineq in + let ineq_tm = concl ineq_th in + let ths1 = create_approximations [9;12;15;18;21] ineq_tm in + let ths2 = map generalize_hyp ths1 in + let ths3 = map (itlist PROVE_HYP Lp_ineqs_def.list_var_pos) ths2 in + let ths4 = map (C MP ineq_th) ths3 in + let r = CONV_RULE(REWRITE_CONV[DECIMAL_INT; GSYM LIST_SUM_LMUL] THENC DEPTH_CONV Arith_nat.NUMERAL_TO_NUM_CONV) in + let ths5 = map r ths4 in + zip (3--7) ths5;; + + + +(* Performs the following conversions: + (a + ... + c) + d = a + ... + c + d *) +let plus_assoc_conv = + let REAL_ADD_ASSOC' = (SYM o SPEC_ALL) REAL_ADD_ASSOC in + let rec plus_conv tm = + if (is_binop add_op_real tm) then + let lhs, rhs = dest_binop add_op_real tm in + if (is_binop add_op_real lhs) then + let x_tm, y_tm = dest_binop add_op_real lhs in + let th0 = INST[x_tm, x_var_real; y_tm, y_var_real; rhs, z_var_real] REAL_ADD_ASSOC' in + let ltm, rtm = dest_comb(rand(concl th0)) in + TRANS th0 (AP_TERM ltm (plus_conv rtm)) + else + REFL tm + else + REFL tm + in plus_conv;; + + +(**********************) + +let convert_ineq hyp_fun = + let rec rewrite_lhs tm = + let rewrite_one tm = + if (is_binop mul_op_real tm) then + let mul_tm, var_tm = dest_comb tm in + let var_f, arg = dest_comb var_tm in + + let rec convert_arg arg = + if (is_comb arg) then + let ltm, sub_arg' = dest_comb arg in + let const_name = (fst o dest_const) (if (is_const ltm) then ltm else rator ltm) in + (* Str.first_chars const_name 1 = "D" is a hack *) + if (Str.first_chars const_name 1 = "D" or const_name = "_0" + or const_name = "," or const_name = "CONS" or const_name = "INSERT") then + REFL arg + else + try + let sub_arg_th = convert_arg sub_arg' in + let th0 = AP_TERM ltm sub_arg_th in + let rtm = rand(concl th0) in + let th1 = + if (const_name = "set_of_list") then + set_of_list_conv rtm + else if (const_name = "FST") then + fst_conv rtm + else if (const_name = "SND") then + snd_conv rtm + else if (const_name = "HD") then + hd_conv rtm + else if (const_name = "e_list") then + e_list_conv_num rtm + else + hyp_fun const_name (rand rtm) in + TRANS th0 th1 + with _ -> + failwith ("convert_arg: "^const_name) + else + REFL arg in + + let arg_th = convert_arg arg in + AP_TERM mul_tm (AP_TERM var_f arg_th) + + else + (* tm should be list_sum *) + list_sum_conv BETA_CONV tm in + + if (is_binop add_op_real tm) then + let lhs, rhs = dest_binop add_op_real tm in + let lhs_th = rewrite_one lhs in + let rhs_th = rewrite_lhs rhs in + let th1 = MK_COMB(AP_TERM add_op_real lhs_th, rhs_th) in + if (is_binop add_op_real (rand(concl lhs_th))) then + let th2 = plus_assoc_conv (rand(concl th1)) in + TRANS th1 th2 + else + th1 + else + rewrite_one tm in + + fun ineq_tm -> + if not (is_binary "real_le" ineq_tm) then + REFL ineq_tm + else + let ltm, rtm = dest_comb ineq_tm in + let op_tm, l_tm = dest_comb ltm in + let lhs_eq_th = rewrite_lhs l_tm in + AP_THM (AP_TERM op_tm lhs_eq_th) rtm;; + + +let convert_tm = + let num_str = (fst o dest_const) Arith_hash.num_const in + let rec convert hyp_fun tm = + if (is_comb tm) then + let ltm, rtm = dest_comb tm in + let op_tm = if is_comb ltm then rator ltm else ltm in + if is_const op_tm then + let const_name = (fst o dest_const) op_tm in + if const_name = "real_of_num" or const_name = "DECIMAL" then + REFL tm + else if const_name = "real_add" then + let th1 = convert hyp_fun (rand ltm) and + th2 = convert hyp_fun rtm in + MK_COMB (AP_TERM op_tm th1, th2) + else if const_name = "ye_list" then + if is_pair rtm then + let ltm', b_tm = dest_comb rtm in + let pair_op, a_tm = dest_comb ltm' in + let a_th = convert hyp_fun a_tm and + b_th = convert hyp_fun b_tm in + AP_TERM ltm (MK_COMB (AP_TERM pair_op a_th, b_th)) + else + let rtm_th = convert hyp_fun rtm in + AP_TERM ltm rtm_th + else + let rtm_th = convert hyp_fun rtm in + let th0 = AP_TERM ltm rtm_th in + let arg = rand (concl th0) in + let th1 = + if const_name = num_str then + INST[rand arg, n_var_num] Arith_hash.NUM_THM + else + match const_name with + | "set_of_list" -> set_of_list_conv arg + | "FST" -> fst_conv arg + | "SND" -> snd_conv arg + | "HD" -> hd_conv arg + | "e_list" -> e_list_conv_num arg + | "LENGTH" -> length_conv arg + | _ -> + (try hyp_fun const_name (rand arg) + with Failure _ -> REFL arg) in + TRANS th0 th1 + else + REFL tm + else + REFL tm in + convert;; + + +let convert_condition hyp_fun tm = + if is_comb tm then + let ltm, rtm = dest_comb tm in + let r_th = convert_tm hyp_fun rtm in + if is_comb ltm then + let op_tm, larg = dest_comb ltm in + let l_th = convert_tm hyp_fun larg in + MK_COMB (AP_TERM op_tm l_th, r_th) + else + AP_TERM ltm r_th + else + convert_tm hyp_fun tm;; + + + +let rec simplify_ineq_tm hyp_fun tm = + if is_imp tm then + let ltm, q_tm = dest_comb tm in + let imp_tm, p_tm = dest_comb ltm in + let p_eq_th = convert_condition hyp_fun p_tm in + let q_eq_th = simplify_ineq_tm hyp_fun q_tm in + MK_COMB (AP_TERM imp_tm p_eq_th, q_eq_th) + else + convert_ineq hyp_fun tm;; + + +let simplify_ineq hyp_fun ineq_th = + let eq_th = simplify_ineq_tm hyp_fun (concl ineq_th) in + EQ_MP eq_th ineq_th;; + +let prove_conditions = + let neq_elim_th = prove(`(s <=> F) <=> ~s`, REWRITE_TAC[]) in + let rec prove_rec ineq_th = + let concl_tm = concl ineq_th in + if is_imp concl_tm then + let p_tm = lhand concl_tm in + let flag, p_th = + (* (trivial) equality *) + if is_eq p_tm then + let ltm, rtm = dest_eq p_tm in + if ltm = rtm then + true, REFL ltm + else + false, TRUTH + (* n < m:num *) + else if is_binary "<" p_tm then + true, EQT_ELIM (raw_lt_hash_conv p_tm) + (* ~(n = m) *) + else if is_neg p_tm then + let s_tm = rand p_tm in + let th0 = raw_eq_hash_conv s_tm in + let elim_th = INST[s_tm, s_var_bool] neq_elim_th in + true, EQ_MP elim_th th0 + else + false, TRUTH in + let th1 = + if flag then + MP ineq_th p_th + else + UNDISCH ineq_th in + prove_rec th1 + else + ineq_th in + prove_rec;; + + +let get_ineqs (hyp_list_tm, hyp_set, hyp_fun) std_flag precision name indices = + let ineq0_th = (find_ineq std_flag precision name).ineq_th in + let ineq1_th = INST[hyp_list_tm, l_cap_var] ineq0_th in + let all_tm, set_tm = dest_comb (concl ineq1_th) in + let set_eq_th = hyp_set ((fst o dest_const o rator) set_tm) in + let ineq2_th = EQ_MP (AP_TERM all_tm set_eq_th) ineq1_th in + let ineq0_ths = select_all ineq2_th indices in + let ineq1_ths' = map MY_BETA_RULE ineq0_ths in + (* A special treatment of the "main" inequality *) + let ineq1_ths = if name = "main" then + map (fun th -> EQ_MP (term_rewrite (concl th) (hyp_set "list_of_elements")) th) ineq1_ths' + else ineq1_ths' in + let ineq2_ths = map (simplify_ineq hyp_fun) ineq1_ths in + let ineq3_ths = map prove_conditions ineq2_ths in + ineq3_ths;; + + +(****************************) + +let int_zero_tm = mk_comb (amp_op_real, (rand o concl o NUMERAL_TO_NUM_CONV) `0`);; +let int_neg_zero_tm = mk_comb (neg_op_real, int_zero_tm);; +let var_table = Hashtbl.create 1000;; + + +let prove_flyspeck_lp_step1 hyp_list_tm hyp_set hyp_fun std_flag precision infeasible constraints target_variables variable_bounds = + let precision_constant = Int 10 **/ (Int precision) in + +(* This function generates all inequalities with the given name and indices, + multiplies these inequalities by given coefficients, and finds the sum of + the generated inequalities *) + let sum_step = fun (name, indices, c) -> + try + let ineqs = get_ineqs (hyp_list_tm, hyp_set, hyp_fun) std_flag precision name indices in + let s1 = map transform_le_ineq (zip ineqs c) in + List.fold_left add_step' dummy s1 + with + | Failure str -> failwith (sprintf "Problem: %s (%s)" name str) + | _ -> failwith ("Problem: "^name) in + + let _ = Hashtbl.clear var_table in + let add_to_var_table (name, indices, c) = + let ineqs = get_ineqs (hyp_list_tm, hyp_set, hyp_fun) std_flag precision name indices in + let m_ineqs = map2 (fun th m -> MY_PROVE_HYP th (var1_le_transform (concl th, m))) ineqs c in + let _ = map ( + fun th -> + let var = (rand o lhand o concl) th in + if Hashtbl.mem var_table var then + let ineq1 = Hashtbl.find var_table var in + let ineq = add_le_ineqs th ineq1 in + let c_tm = (lhand o lhand o concl) ineq in + if c_tm = int_zero_tm or c_tm = int_neg_zero_tm then + Hashtbl.remove var_table var + else + Hashtbl.replace var_table var ineq + else + Hashtbl.add var_table var th) m_ineqs in + () in + + let get_first_var ineq_th = + try + (rand o lhand o rand o lhand o concl) ineq_th + with Failure _ -> a_var_real in + let ineqs1 = map sum_step constraints in + let ineqs2 = List.sort (fun ineq1 ineq2 -> + let var1 = get_first_var ineq1 and + var2 = get_first_var ineq2 in + compare var1 var2) ineqs1 in + let s1' = List.fold_right add_step' ineqs2 dummy in + let s1 = mul_step s1' (mk_real_int precision_constant) in + let r1 = if infeasible then s1 else + let ineq_th0 = assoc precision lnsum_ineqs in + let ineq_th1 = (INST[hyp_list_tm, l_cap_var]) ineq_th0 in + let ineq_th2 = EQ_MP (term_rewrite (concl ineq_th1) (hyp_set "list_of_elements")) ineq_th1 in + let ineq_th3 = simplify_ineq hyp_fun ineq_th2 in + let ineq_th4 = to_lin_f_ineq ineq_th3 in + add_step' ineq_th4 s1 in + let _ = map add_to_var_table variable_bounds and + _ = map add_to_var_table target_variables in + let list1 = Hashtbl.fold (fun tm ineq list -> (tm, ineq) :: list) var_table [] in + let list2 = List.sort (fun (tm1, _) (tm2, _) -> compare tm1 tm2) list1 in + let var_list = map snd list2 in + let result = List.fold_left add_cancel_step r1 var_list in + let n_tm = (rand o rand o rand o concl) result in + let r_eq_th = INST[n_tm, n_var_num] FINAL_INEQ in + let not_zero_th = NUM_EQ0_HASH_CONV n_tm in + EQ_MP not_zero_th (EQ_MP r_eq_th result);; + +(* +let prove_flyspeck_lp_step1 hyp_list_tm hyp_set hyp_fun std_flag precision infeasible constraints target_variables variable_bounds = + let precision_constant = Int 10 **/ (Int precision) in + let sum_step = fun (name, indices, c) -> + try + let ineqs = get_ineqs (hyp_list_tm, hyp_set, hyp_fun) std_flag precision name indices in + let s1 = map transform_le_ineq (zip ineqs c) in + List.fold_left add_step' dummy s1 + with + | Failure str -> failwith (sprintf "Problem: %s (%s)" name str) + | _ -> failwith ("Problem: "^name) in + + let s1' = List.fold_left add_step' dummy (map sum_step constraints) in + let s1 = mul_step s1' (mk_real_int precision_constant) in + let s2 = List.fold_left add_step' dummy (map sum_step target_variables) in + let s3 = List.fold_left add_step' dummy (map sum_step variable_bounds) in + let s4 = add_step' (add_step' s1 s2) s3 in + + let result = if infeasible then s4 else + let ineq_th0 = assoc precision lnsum_ineqs in + let ineq_th1 = (INST[hyp_list_tm, l_cap_var]) ineq_th0 in + let ineq_th2 = EQ_MP (term_rewrite (concl ineq_th1) (hyp_set "list_of_elements")) ineq_th1 in + let ineq_th3 = simplify_ineq hyp_fun ineq_th2 in + let ineq_th4 = to_lin_f_ineq ineq_th3 in + add_step' ineq_th4 s4 in + + let n_tm = (rand o rand o rand o concl) result in + let r_eq_th = INST[n_tm, n_var_num] FINAL_INEQ in + let not_zero_th = NUM_EQ0_HASH_CONV n_tm in + EQ_MP not_zero_th (EQ_MP r_eq_th result);; +*) + + +(*************************) + +(* Replaces the given term tm with a variable named var_name in the given theorem th *) +(* A new assumption tm = var_name is added *) +let ABBREV_RULE var_name tm th = + let var_tm = mk_var (var_name, type_of tm) in + let eq_th = ASSUME (mk_eq (tm, var_tm)) in + (UNDISCH_ALL o PURE_REWRITE_RULE[eq_th] o DISCH_ALL) th;; + +(* Transforms a theorem |- ?x. P x into (@x. P x) = x |- P x *) +let SELECT_AND_ABBREV_RULE = + let P = `P:A->bool` in + let pth = prove + (`(?) (P:A->bool) ==> P((@) P)`, + SIMP_TAC[SELECT_AX; ETA_AX]) in + fun th -> + try + let abs = rand (concl th) in + let var, b_tm = dest_abs abs in + let name, ty = dest_var var in + let select_tm = mk_binder "@" (var, b_tm) in + let th0 = CONV_RULE BETA_CONV (MP (PINST [ty,aty] [abs,P] pth) th) in + ABBREV_RULE name select_tm th0 + with Failure _ -> failwith "SELECT_AND_ABBREV_RULE";; + +(* Transforms a theorem tm = var_name, G |- P into G[tm/var_name] |- P[tm/var_name] *) +let EXPAND_RULE var_name th = + let hyp_tm = find (fun tm -> is_eq tm && is_var (rand tm) && name_of (rand tm) = var_name) (hyp th) in + let l_tm, var_tm = dest_eq hyp_tm in + let th1 = INST[l_tm, var_tm] th in + PROVE_HYP (REFL l_tm) th1;; + +(* Transforms a theorem tm = var_name, G |- P into tm = var_name, G |- P[tm/var_name] *) +let EXPAND_CONCL_RULE var_name th = + let hyp_tm = find (fun tm -> is_eq tm && is_var (rand tm) && name_of (rand tm) = var_name) (hyp th) in + let eq_th = SYM (ASSUME hyp_tm) in + PURE_REWRITE_RULE[eq_th] th;; + +(*************************) +(* Auxiliary definitions *) +(*************************) + +let report s = + Format.print_string s; Format.print_newline(); Format.print_flush();; + +let e_cap_var = `E:(real^3->bool)->bool` and + l_cap_var = `L:((num)list)list` and + estd_v = `ESTD V` and + contravening_v = `contravening V` and + d_var_pair = `d:num#num` and + diag_vars = map (fun i -> mk_var ("diag" ^ string_of_int i, `:num#num`)) (0--6) and + a_vars = map (fun i -> mk_var ("a" ^ string_of_int i, `:real`)) (0--6);; + +let mk_raw_num = rand o Arith_nat.mk_small_numeral_array;; +let mk_dart face i1 i2 = mk_pair (mk_raw_num (nth face i1), mk_raw_num (nth face i2));; +let mk_all_darts face = map mk_pair (list_pairs (map mk_raw_num face));; + +(* Given a list of pairs [x1,y1; ...; xn,yn] and an element x, *) +(* finds all y's such that (x,y) is in the list *) +let rec assoc_all a list = + match list with + | [] -> [] + | (k,v) :: t -> if k = a then v :: assoc_all a t else assoc_all a t;; + +(* Combines theorems |- A ==> C, |- B ==> C and yields |- A \/ B ==> C *) +let combine_cases = + let combine_th = TAUT `(A ==> C) /\ (B ==> C) ==> (A \/ B ==> C)` in + fun case1_th case2_th -> + MATCH_MP combine_th (CONJ case1_th case2_th);; + +let dest_ye_list tm = + let lhs, rhs = dest_comb tm in + let c_tm = rator lhs in + if (fst o dest_const) c_tm <> "ye_list" then + failwith "dest_ye_list: not ye_list" + else + dest_pair rhs;; + +(* Given |- ALL (\x. P x) (hypermap_set), *) +(* returns |- P x1, ..., |- P xn for all elements x in hypermap_set *) +let get_all_ineqs hyp_set0 all_ineq_th = + let all_tm, set_tm = dest_comb (concl all_ineq_th) in + let set_eq_th = hyp_set0 ((fst o dest_const o rator) set_tm) in + let ineq1_th = EQ_MP (AP_TERM all_tm set_eq_th) all_ineq_th in + map MY_BETA_RULE (get_all ineq1_th);; + +(* Generates a list inequality from a fan inequality. *) +(* If simplify_all_flag is true then the conclusion of *) +(* the generated inequality is simplified (yi's are transformed into ye). *) +let gen_list_ineq simplify_all_flag th = + let th0 = add_lp_hyp true th in + let tm1, proof_th = mk_lp_ineq th0 in + let raw_data = {name = "tmp"; tm = tm1; proof = Some proof_th; std_only = false} in + generate_ineq1 simplify_all_flag raw_data;; + +(******************) +(* Special lemmas *) +(******************) + +(* Quad split cases *) +let split4_lemma = (INST[`ye_list (g:num#num->real^3#real^3) diag1`, `a:real`; + `ye_list (g:num#num->real^3#real^3) diag2`, `b:real`] o prove) +(`(a <= b /\ a <= sqrt8) + \/ (b <= a /\ b <= sqrt8) + \/ (a <= b /\ sqrt8 <= a /\ a <= &3) + \/ (b <= a /\ sqrt8 <= b /\ b <= &3) + \/ (&3 <= a /\ &3 <= b)`, + MP_TAC Flyspeck_constants.bounds THEN ARITH_TAC);; + +(* Pent split cases *) +let split5_lemma = + let inst = zip (map (fun d -> mk_comb (`ye_list (g:num#num->real^3#real^3)`, d)) diag_vars) a_vars in + (INST inst o prove)(`(sqrt8 <= a1 /\ sqrt8 <= a2 /\ sqrt8 <= a3 /\ sqrt8 <= a4 /\ sqrt8 <= a5) + \/ (a1 <= sqrt8 /\ sqrt8 <= a3 /\ sqrt8 <= a4) + \/ (a2 <= sqrt8 /\ sqrt8 <= a4 /\ sqrt8 <= a5) + \/ (a3 <= sqrt8 /\ sqrt8 <= a5 /\ sqrt8 <= a1) + \/ (a4 <= sqrt8 /\ sqrt8 <= a1 /\ sqrt8 <= a2) + \/ (a5 <= sqrt8 /\ sqrt8 <= a2 /\ sqrt8 <= a3) + \/ (a1 <= sqrt8 /\ a3 <= sqrt8) + \/ (a2 <= sqrt8 /\ a4 <= sqrt8) + \/ (a3 <= sqrt8 /\ a5 <= sqrt8) + \/ (a4 <= sqrt8 /\ a1 <= sqrt8) + \/ (a5 <= sqrt8 /\ a2 <= sqrt8)`, + MAP_EVERY DISJ_CASES_TAC (map (fun tm -> SPECL[tm; `sqrt8`] REAL_LE_TOTAL) (take 5 (drop 1 a_vars))) THEN + ASM_REWRITE_TAC[]);; + +(* Hex split cases *) +let split6_lemma = + let inst = zip (map (fun d -> mk_comb (`ye_list (g:num#num->real^3#real^3)`, d)) diag_vars) a_vars in + (INST inst o prove)(`(sqrt8 <= a1 /\ sqrt8 <= a2 /\ sqrt8 <= a3 /\ sqrt8 <= a4 /\ sqrt8 <= a5 /\ sqrt8 <= a6) + \/ a1 <= sqrt8 + \/ a2 <= sqrt8 + \/ a3 <= sqrt8 + \/ a4 <= sqrt8 + \/ a5 <= sqrt8 + \/ a6 <= sqrt8`, ARITH_TAC);; + +(* Node and edge split lemmas *) +let split218_lemma = SPECL [`#2.18`; `yn_list (h:num->real^3) i`] REAL_LE_TOTAL;; +let split236_lemma = SPECL [`yn_list (h:num->real^3) i`; `#2.36`] REAL_LE_TOTAL;; +let split225_lemma = SPECL [`#2.25`; `ye_list (g:num#num->real^3#real^3) d`] REAL_LE_TOTAL;; + +(* lp_cond ==> good_list *) +let lp_cond_imp_good_list = prove(`lp_cond (L, g, h:num->real^3) (V,E) ==> good_list L`, SIMP_TAC[lp_cond]);; + +(* ESTD V = ESTD V *) +let estd_refl = REFL estd_v;; + +(* ye_list g d <= &3 for a standard fan *) +let ye_hi_3 = generate_ineq (gen_raw_ineq_data "tmp" true ye_hi_std);; + +(* ye_list g d <= #2.52 for a standard fan *) +let ye_hi_2h0 = generate_ineq (gen_raw_ineq_data "tmp" true yy10_std);; + +(* ye_list g (a,b) = ye_list g (b,a) *) +let ye_sym0 = (add_lp_hyp false o prove)(`(!d. g d = h (FST d), h (SND d)) + ==> ye_list (g:num#num->real^3#real^3) (n,m) = ye_list g (m,n)`, + DISCH_TAC THEN ASM_REWRITE_TAC Lp_ineqs_def.list_defs2 THEN + REWRITE_TAC[Lp_ineqs_def.ye_fan; DIST_SYM]);; + +(* #2.52 <= ye_list g d for diagonals *) +let diag4_lo = gen_list_ineq true dart4_y4'_lo and + diag5_lo = (gen_list_ineq true o CONV_RULE NUM_REDUCE_CONV o SPEC `5` o add_lp_hyp false) y4'_lo_2h0 and + diag6_lo = (gen_list_ineq true o CONV_RULE NUM_REDUCE_CONV o SPEC `6` o add_lp_hyp false) y4'_lo_2h0;; + +let diag5_lo_sym = PURE_ONCE_REWRITE_RULE[ye_sym0] diag5_lo and + diag6_lo_sym = PURE_ONCE_REWRITE_RULE[ye_sym0] diag6_lo;; + +(* lp_tau for different cases *) +let tau_split4, tau_split5_one, tau_split5_two, tau_split6 = + let r = SPEC `d:num#num` o REWRITE_RULE[GSYM ALL_MEM] o gen_list_ineq true in + r lp_tau_split4, r lp_tau_split5_one_diag, r lp_tau_split5_two_diags, r lp_tau_split6;; + + +(*****************************************) + +(* Generates extra inequalities for a given inequality. *) +(* For instance, |- a <= sqrt8 yields |- a <= &3 *) +let gen_extra_ineqs = + let tm_3 = `&3` and + tm_sqrt8 = `sqrt8` and + tm_218 = `#2.18` and + tm_236 = `#2.36` in + + let r tm = prove(tm, MP_TAC Flyspeck_constants.bounds THEN ARITH_TAC) in + let l_ths_list = [ + tm_3, r `&3 <= a ==> sqrt8 <= a`; + tm_236, r `#2.36 <= a ==> #2.18 <= a`; + ] in + let r_ths_list = [ + tm_sqrt8, r `a <= sqrt8 ==> a <= &3`; + tm_218, r `a <= #2.18 ==> a <= #2.36`; + ] in + let a_var_real = `a:real` in + fun ineq_th -> + let lhs, rhs = dest_binary "real_le" (concl ineq_th) in + let l_ths = map (fun th -> MP (INST[rhs, a_var_real] th) ineq_th) (assoc_all lhs l_ths_list) and + r_ths = map (fun th -> MP (INST[lhs, a_var_real] th) ineq_th) (assoc_all rhs r_ths_list) in + l_ths @ r_ths;; + + +(* Generates ye-symmetric inequalities. *) +(* Example: |- ye (a,b) <= c yields |- ye (b,a) <= c *) +(* Accepts inequalities in the form: *) +(* |- ye d <= c, |- c <= ye d, and |- ye d1 <= ye d2 *) +(* This function does not return the original inequality *) +let gen_ye_sym_ineqs ye_sym_th ineq_th = + let sym_eqs tm = + try + let n_tm, m_tm = dest_ye_list tm in + [REFL tm; INST[n_tm, n_var_num; m_tm, m_var_num] ye_sym_th] + with Failure _ -> + [REFL tm] in + let ltm, rhs = dest_comb (concl ineq_th) in + let op_tm, lhs = dest_comb ltm in + let l_eqs = sym_eqs lhs and + r_eqs = sym_eqs rhs in + tl (allpairs (fun l_eq r_eq -> EQ_MP (MK_COMB (AP_TERM op_tm l_eq, r_eq)) ineq_th) l_eqs r_eqs);; + + +(* Generates all extra inequalities (including ye-symmetric inequalities) *) +let gen_all_extra_cases ye_sym_th case_tms = + let case_ths = map ASSUME case_tms in + let extra = List.flatten (map gen_extra_ineqs case_ths) in + let sym = gen_ye_sym_ineqs ye_sym_th in + extra @ List.flatten (map sym (case_ths @ extra));; + +(* Computes lp_cond and lp_tau for a contravening packing *) +let contravening_conditions hyp_list_tm hyp_set = + let th0 = (MY_RULE_NUM o REWRITE_RULE[Seq.size]) Lp_ineqs_proofs.contravening_lp_cond_alt in + let th1 = (UNDISCH_ALL o ISPEC hyp_list_tm o REWRITE_RULE[GSYM IMP_IMP]) th0 in + let good_list_nodes_th = EQT_ELIM (eval_good_list_nodes_condition hyp_set) in + let lp_cond_th = (MY_PROVE_HYP (hyp_set "good_list") o MY_PROVE_HYP good_list_nodes_th) th1 in + let lp_cond_th' = (SELECT_AND_ABBREV_RULE o SELECT_AND_ABBREV_RULE o ABBREV_RULE "L" hyp_list_tm) lp_cond_th in + let lp_tau_th = (UNDISCH_ALL o SPEC_ALL) Lp_main_estimate.contravening_lp_tau in + lp_cond_th', lp_tau_th;; + + +(*******************************) +(* Verification test functions *) +(*******************************) + +(* Returns all terminal cases and corresponding hypermap lists *) +(* for a given hypermap list and lp_certificate_case *) +let rec terminal_cases (hyp_list, case) = + match case with + | Lp_terminal terminal -> [(hyp_list, terminal)] + | Lp_split (info, cs) -> + (match info.split_type with + (* Triangles, edges, nodes *) + | "tri" | "edge" | "236" | "218" -> + let case_args = zip [hyp_list; hyp_list] cs in + flatten (map terminal_cases case_args) + + (* Special cases *) + | "high" | "mid" | "add_big" -> + let case_args = zip [hyp_list] cs in + flatten (map terminal_cases case_args) + + (* Quad *) + | "quad" -> + let split_face = info.split_face in + let dart13 = nth split_face 1, nth split_face 2 and + dart24 = nth split_face 0, nth split_face 1 in + let split13 = split_list hyp_list dart13 and + split24 = split_list hyp_list dart24 in + let case_args = zip [split13; split24; split13; split24; hyp_list] cs in + flatten (map terminal_cases case_args) + + (* Pent *) + | "pent" -> + let split_face = info.split_face in + let darts = rotateL 1 (list_pairs split_face) in + let splits_one = map (split_list hyp_list) darts in + let splits_two = map2 split_list splits_one (rotateL 2 darts) in + let case_args = zip (hyp_list :: (splits_one @ splits_two)) cs in + flatten (map terminal_cases case_args) + + (* Hex *) + | "hex" -> + let split_face = info.split_face in + let darts = rotateL 1 (list_pairs split_face) in + let splits = map (split_list hyp_list) darts in + let case_args = zip (hyp_list :: splits) cs in + flatten (map terminal_cases case_args) + + | s -> failwith ("cases: unknown split type: " ^ s));; + +(* Returns all terminal cases and corresponding hypermap lists for lp_certificate *) +let get_terminal_cases certificate = + let hyp_list = (snd o convert_to_list) certificate.hypermap_string in + let hyp_list0_tm = (to_num o create_hol_list) hyp_list in + let hyp_set0, hyp_fun0 = compute_all hyp_list0_tm None in + let lp_cond0, lp_tau0 = contravening_conditions hyp_list0_tm hyp_set0 in + let ye_ineqs_3, ye_ineqs_2h0, diag4_ineqs = + let r = get_all_ineqs hyp_set0 o EXPAND_CONCL_RULE "L" o + MY_PROVE_HYP lp_tau0 o MY_PROVE_HYP lp_cond0 o MY_PROVE_HYP estd_refl o INST[estd_v, e_cap_var] in + r ye_hi_3, r ye_hi_2h0, r diag4_lo in + let diag4_ths = map (fun th -> EQ_MP (convert_tm hyp_fun0 (concl th)) th) diag4_ineqs in + let base_ineqs = ye_ineqs_3 @ ye_ineqs_2h0 @ diag4_ths in + base_ineqs, terminal_cases (hyp_list, certificate.root_case);; + +(* Tests (verifies) a terminal case *) +let test_terminal (hyp_list, terminal) = + let hyp_list_tm = (to_num o create_hol_list) hyp_list in + let hyp_set, hyp_fun = compute_all hyp_list_tm None in + let r = (fun name, ind, v -> name, ind, map mk_real_int64 v) in + let c = map r terminal.constraints and + tv = map r terminal.target_variables and + vb = map r terminal.variable_bounds in + prove_flyspeck_lp_step1 hyp_list_tm hyp_set hyp_fun false terminal.precision terminal.infeasible c tv vb;; + + +(*******************************) +(* Main verification functions *) +(*******************************) + +type lp_verification_arg = { + (* Hypermap data *) + hyp_data : ((string->thm) * (string->term->thm))list; + + ye_sym_th : thm; + + (* Theorems *) + lp_cond_th : thm; + lp_tau_th : thm; + + (* Terms *) + hyp_list_tm : term; + e_tm : term; +};; + + +(* Computes a splitted hypermap list (L2), a new E term (E2), lp_cond (L2,g,h) (V,E2) *) +let split_lp_conditions hyp_list_tm lp_cond_th d_tm = + let split_eq_th = eval_split_list_hyp hyp_list_tm d_tm in + let split_tm = (rand o concl) split_eq_th in + let lp_cond2_th = (PURE_REWRITE_RULE[split_eq_th] o SPEC d_tm o MATCH_MP lp_cond_trans1) lp_cond_th in + let e2_tm = (rand o rand o concl) lp_cond2_th in + (split_tm, e2_tm), lp_cond2_th;; + +(* Computes lp_tau (V,E2) *) +let get_tau_split_th tau_trans_th (hyp_set, hyp_fun) arg d_tm = + let set_name = (fst o dest_const o rator o rand o lhand o concl) tau_trans_th in + let set_th = hyp_set set_name in + let mem_th = EQT_ELIM (apply_op set_th (eval_mem_num_pair d_tm)) in + let th0 = INST[arg.hyp_list_tm, l_cap_var; d_tm, d_var_pair; arg.e_tm, e_cap_var] tau_trans_th in + (UNDISCH_ALL o MY_PROVE_HYP arg.lp_cond_th o MY_PROVE_HYP arg.lp_tau_th o simplify_ineq hyp_fun o MP th0) mem_th;; + +(* Eliminates extra assumptions and discharges case assumptions *) +let get_final_case_th ye_sym_th cases_tm case_th = + let case_tms = striplist dest_conj cases_tm in + let case_th2 = itlist MY_PROVE_HYP (gen_all_extra_cases ye_sym_th case_tms) case_th in + PURE_REWRITE_RULE[IMP_IMP; GSYM CONJ_ASSOC] (itlist DISCH case_tms case_th2);; + +(* Returns terms and inequalities for the triangle splitting case: *) +(* split_th = |- #6.25 <= a + b + c \/ a + b + c <= #6.25 *) +(* big_tm = `#6.25 <= a + b + c`, small_tm = `a + b + c <= #6.25 *) +(* sym_big_ineqs = [|- #6.25 <= b + c + a; |- #6.25 <= c + a + b] *) +(* sym_small_ineqs = [|- b + c + a <= #6.25; |- c + a + b <= #6.25; *) +(* |- a <= #2.52; |- b <= #2.25; |- c <= #2.25; *) +(* |- e(a) <= #2.52; |- e(b) <= #2.52; |- e(c) <= #2.52] *) +(* Here, a = ye_list g (i1,i2), b = ye_list g (i2,i3), c = ye_list g (i3,i1) *) +(* for split_face = [i1; i2; i3] *) +let gen_triangle_ineqs = + let ye_tm = `ye_list (g:num#num->real^3#real^3)` and + c625 = `#6.25` in + let sym_big = (SPEC c625 o ARITH_RULE) `!c. c <= x + y + z ==> c <= y + z + x /\ c <= z + x + y` and + sym_small = (SPEC c625 o ARITH_RULE) `!c. x + y + z <= c ==> y + z + x <= c /\ z + x + y <= c` and + split3_lemma = SPECL[c625; `x:real`] REAL_LE_TOTAL and + small_extra = (SPEC `d:num#num` o REWRITE_RULE[GSYM ALL_MEM] o gen_list_ineq true) Lp_ineqs_proofs2.extra_ineqs_std3_small in + fun (hyp_set, hyp_fun) arg split_face -> + let dart_tms = mk_all_darts split_face in + let ye_tms = map (curry mk_comb ye_tm) dart_tms in + let sum_tm = end_itlist (fun tm1 tm2 -> mk_comb (mk_comb (add_op_real, tm1), tm2)) ye_tms in + let inst_list = zip ye_tms [x_var_real; y_var_real; z_var_real] in + let big_tm = mk_comb (mk_comb (le_op_real, c625), sum_tm) and + small_tm = mk_comb (mk_comb (le_op_real, sum_tm), c625) and + split3_th = INST[sum_tm, x_var_real] split3_lemma in + let sym_small_ineqs = (CONJUNCTS o MP (INST inst_list sym_small) o ASSUME) small_tm and + sym_big_ineqs = (CONJUNCTS o MP (INST inst_list sym_big) o ASSUME) big_tm in + let extra_small_ineqs = + let set_th = hyp_set "list_of_darts3" in + let mem_th = EQT_ELIM (apply_op set_th (eval_mem_num_pair (hd dart_tms))) in + let th0 = INST[arg.hyp_list_tm, l_cap_var; hd dart_tms, d_var_pair; arg.e_tm, e_cap_var] small_extra in + let extra0 = (CONJUNCTS o UNDISCH_ALL o MY_PROVE_HYP arg.lp_cond_th o simplify_ineq hyp_fun o MP th0) mem_th in + map (CONV_RULE (convert_condition hyp_fun)) extra0 in + let extra_sym = flatten (map (gen_ye_sym_ineqs arg.ye_sym_th) extra_small_ineqs) in + split3_th, (big_tm, small_tm), (sym_big_ineqs, sym_small_ineqs @ extra_small_ineqs @ extra_sym);; + + +(* Generate |- 6.25 <= a + b + c and symmetric inequalities when 2.25 <= a *) +let gen_add_big_ineqs = + let c625 = `#6.25` in + let sym_big = (SPEC c625 o ARITH_RULE) `!c. c <= x + y + z ==> c <= y + z + x /\ c <= z + x + y` in + let big_extra = (SPEC `d:num#num` o REWRITE_RULE[GSYM ALL_MEM] o gen_list_ineq true) Lp_ineqs_proofs2.extra_ineq_std3_big in + fun (hyp_set, hyp_fun) arg split_face -> + let d_tm = mk_dart split_face 0 1 in + let set_th = hyp_set "list_of_darts3" in + let mem_th = EQT_ELIM (apply_op set_th (eval_mem_num_pair d_tm)) in + let th0 = INST[arg.hyp_list_tm, l_cap_var; d_tm, d_var_pair; arg.e_tm, e_cap_var] big_extra in + let big_th = (CONV_RULE (convert_condition hyp_fun) o MY_PROVE_HYP arg.lp_cond_th o UNDISCH o MP th0) mem_th in + let x_tm, yz_tms = dest_binary "real_add" (rand (concl big_th)) in + let y_tm, z_tm = dest_binary "real_add" yz_tms in + let inst_list = zip [x_tm; y_tm; z_tm] [x_var_real; y_var_real; z_var_real] in + big_th :: CONJUNCTS (MP (INST inst_list sym_big) big_th);; + + +(* Generates extra inequalities in the case when 2.18 <= yn(i) and 2.18 <= yn(j) for ~(i = j) *) +let gen_mid_ineqs = + let eq13 = (REWRITE_RULE[Arith_hash.NUM_THM] o NUMERAL_TO_NUM_CONV) `13` in + let lnsum13_mid_lemma = (REWRITE_RULE[GSYM IMP_IMP; eq13; Seq.size] o + SPEC_ALL o add_lp_hyp false o UNDISCH_ALL o SPEC_ALL) Lp_ineqs_proofs.lnsum13_mid in + fun (hyp_set, hyp_fun) arg split_face -> + let i_tm = mk_raw_num (nth split_face 0) in + let j_tm = mk_raw_num (nth split_face 1) in + let th0 = (MY_PROVE_HYP arg.lp_cond_th o + INST[arg.e_tm, e_cap_var; arg.hyp_list_tm, l_cap_var; i_tm, i_var_num; j_tm, j_var_num]) lnsum13_mid_lemma in + let els_eq_th = hyp_set "list_of_elements" in + let els_tm = rand (concl els_eq_th) in + let indices = + let list = dest_list els_tm in + let i_ind = index i_tm list and + j_ind = index j_tm list in + subtract (0--(length list - 1)) [i_ind; j_ind] in + let th1 = EQ_MP (term_rewrite (concl th0) els_eq_th) th0 in + let th2 = (prove_conditions o simplify_ineq hyp_fun) th1 in + let mem_i = EQT_ELIM (eval_mem_univ raw_eq_hash_conv i_tm els_tm) and + mem_j = EQT_ELIM (eval_mem_univ raw_eq_hash_conv j_tm els_tm) in + let ths = CONJUNCTS (MY_PROVE_HYP mem_i (MY_PROVE_HYP mem_j th2)) in + let lo_th = nth ths 0 and + hi_th1 = nth ths 1 and + hi_th2 = nth ths 2 in + let lo_ineqs1 = select_all lo_th indices in + let lo_ineqs2 = map (prove_conditions o MY_BETA_RULE) lo_ineqs1 in + let ineqs = hi_th1 :: hi_th2 :: lo_ineqs2 in + ineqs @ flatten (map gen_extra_ineqs ineqs);; + + +(* Generates extra inequalities in the case when 2.36 <= yn(i) *) +let gen_high_ineqs = + let eq13 = (REWRITE_RULE[Arith_hash.NUM_THM] o NUMERAL_TO_NUM_CONV) `13` in + let lnsum13_high_lemma = (REWRITE_RULE[GSYM IMP_IMP; eq13; Seq.size] o + SPEC_ALL o add_lp_hyp false o UNDISCH_ALL o SPEC_ALL) Lp_ineqs_proofs.lnsum13_high in + fun (hyp_set, hyp_fun) arg split_face -> + let i_tm = mk_raw_num (nth split_face 0) in + let th0 = (MY_PROVE_HYP arg.lp_cond_th o + INST[arg.e_tm, e_cap_var; arg.hyp_list_tm, l_cap_var; i_tm, i_var_num]) lnsum13_high_lemma in + let els_eq_th = hyp_set "list_of_elements" in + let els_tm = rand (concl els_eq_th) in + let indices = + let list = dest_list els_tm in + let i_ind = index i_tm list in + subtract (0--(length list - 1)) [i_ind] in + let th1 = EQ_MP (term_rewrite (concl th0) els_eq_th) th0 in + let th2 = (prove_conditions o simplify_ineq hyp_fun) th1 in + let mem_i = EQT_ELIM (eval_mem_univ raw_eq_hash_conv i_tm els_tm) in + let lo_th = MY_PROVE_HYP mem_i th2 in + let lo_ineqs1 = select_all lo_th indices in + let ineqs = map (prove_conditions o MY_BETA_RULE) lo_ineqs1 in + ineqs @ flatten (map gen_extra_ineqs ineqs);; + + +let set_report, reset_progress, next_terminal, report_progress = + let t = ref 0 in + let flag = ref true in + (fun b -> flag := b), + (fun () -> t := 0), + (fun () -> t := !t + 1), + (fun () -> if !flag then (Format.print_string (sprintf "%d " !t); Format.print_flush()) else ());; + + +let compute_hypermap arg = + if arg.hyp_data = [] then + let good_th = MATCH_MP lp_cond_imp_good_list arg.lp_cond_th in + let hyp_data = compute_all arg.hyp_list_tm (Some good_th) in + {arg with hyp_data = [hyp_data]}, hyp_data + else + arg, hd arg.hyp_data;; + + +(* Verifies an lp_certificate_case *) +let rec verify_lp_case base_ineqs std_flag (arg, case) = + match case with + (* Terminal case *) + | Lp_terminal terminal -> + let _ = next_terminal() in + let hyp_set, hyp_fun = snd (compute_hypermap arg) in + let r = (fun name, ind, v -> name, ind, map mk_real_int64 v) in + let c = map r terminal.constraints and + tv = map r terminal.target_variables and + vb = map r terminal.variable_bounds in + let th0 = prove_flyspeck_lp_step1 arg.hyp_list_tm hyp_set hyp_fun std_flag terminal.precision terminal.infeasible c tv vb in + let _ = report_progress() in + let th1 = (MY_PROVE_HYP arg.lp_tau_th o INST[arg.e_tm, e_cap_var]) th0 in + let th2 = if std_flag then MY_PROVE_HYP estd_refl th1 else itlist MY_PROVE_HYP base_ineqs th1 in + (MY_PROVE_HYP arg.lp_cond_th) th2 + | Lp_split (info, cs) -> + (match info.split_type with + | "tri" -> + verify_split3 base_ineqs std_flag arg info cs + | "quad" -> + verify_split4 base_ineqs std_flag arg info cs + | "pent" -> + verify_split5 base_ineqs std_flag arg info cs + | "hex" -> + verify_split6 base_ineqs std_flag arg info cs + | "edge" -> + verify_edge base_ineqs std_flag arg info cs + | "218" -> + verify_218 base_ineqs std_flag arg info cs + | "236" -> + verify_236 base_ineqs std_flag arg info cs + | "mid" -> + verify_mid base_ineqs std_flag arg info cs + | "high" -> + verify_high base_ineqs std_flag arg info cs + | "add_big" -> + verify_add_big base_ineqs std_flag arg info cs + | s -> failwith ("verify_lp_case: unknown case " ^ s)) + +(* Adds a new big triangle if one of its edges is >= #2.25 *) +and verify_add_big base_ineqs std_flag arg info cs = + let arg, hyp_data = compute_hypermap arg in + let case = verify_lp_case base_ineqs std_flag (arg, hd cs) in + let ineqs = gen_add_big_ineqs hyp_data arg info.split_face in + itlist MY_PROVE_HYP ineqs case + +(* Adds additional node inequalities *) +and verify_mid base_ineqs std_flag arg info cs = + let arg, hyp_data = compute_hypermap arg in + let case = verify_lp_case base_ineqs std_flag (arg, hd cs) in + let ineqs = gen_mid_ineqs hyp_data arg info.split_face in + itlist MY_PROVE_HYP ineqs case + +(* Adds additional node inequalities *) +and verify_high base_ineqs std_flag arg info cs = + let arg, hyp_data = compute_hypermap arg in + let case = verify_lp_case base_ineqs std_flag (arg, hd cs) in + let ineqs = gen_high_ineqs hyp_data arg info.split_face in + itlist MY_PROVE_HYP ineqs case + +(* Nodes: 2.18 <= yn(i) \/ yn(i) <= 2.18 *) +and verify_218 base_ineqs std_flag arg info cs = + let cases = map (curry (verify_lp_case base_ineqs std_flag) arg) cs in + let split_th = INST[mk_raw_num (hd info.split_face), i_var_num] split218_lemma in + let split_cases = striplist dest_disj (concl split_th) in + let final_cases = map2 (get_final_case_th arg.ye_sym_th) split_cases cases in + let final_th = MP (end_itlist combine_cases final_cases) split_th in + final_th + +(* Nodes: yn(i) <= 2.36 \/ 2.36 <= yn(i) *) +and verify_236 base_ineqs std_flag arg info cs = + let cases = map (curry (verify_lp_case base_ineqs std_flag) arg) cs in + let split_th = INST[mk_raw_num (hd info.split_face), i_var_num] split236_lemma in + let split_cases = striplist dest_disj (concl split_th) in + let final_cases = map2 (get_final_case_th arg.ye_sym_th) split_cases cases in + let final_th = MP (end_itlist combine_cases final_cases) split_th in + final_th + +(* Edges: 2.25 <= ye(d) \/ ye(d) <= 2.25 *) +and verify_edge base_ineqs std_flag arg info cs = + let cases = map (curry (verify_lp_case base_ineqs std_flag) arg) cs in + let split_th = INST[mk_dart info.split_face 0 1, d_var_pair] split225_lemma in + let split_cases = striplist dest_disj (concl split_th) in + let final_cases = map2 (get_final_case_th arg.ye_sym_th) split_cases cases in + let final_th = MP (end_itlist combine_cases final_cases) split_th in + final_th + +(* Triangle *) +and verify_split3 base_ineqs std_flag arg info cs = + let arg, hyp_data = compute_hypermap arg in + (* Prove all subcases *) + let case1_th = verify_lp_case base_ineqs std_flag (arg, nth cs 0) and + case2_th = verify_lp_case base_ineqs std_flag (arg, nth cs 1) in + (* Combine subcases *) + let split_th, (case1_tm, case2_tm), (case1_ineqs, case2_ineqs) = gen_triangle_ineqs hyp_data arg info.split_face in + let th1 = DISCH case1_tm (itlist MY_PROVE_HYP case1_ineqs case1_th) and + th2 = DISCH case2_tm (itlist MY_PROVE_HYP case2_ineqs case2_th) in + let final_th = MP (combine_cases th1 th2) split_th in + final_th + +(* Quad *) +and verify_split4 base_ineqs std_flag arg info cs = + let d13_tm = mk_dart info.split_face 1 2 and + d24_tm = mk_dart info.split_face 0 1 and + diag1_tm = mk_dart info.split_face 0 2 and + diag2_tm = mk_dart info.split_face 1 3 in + (* compute lp_cond *) + let (split13_tm, e13), lp_cond13 = split_lp_conditions arg.hyp_list_tm arg.lp_cond_th d13_tm and + (split24_tm, e24), lp_cond24 = split_lp_conditions arg.hyp_list_tm arg.lp_cond_th d24_tm in + (* compute lp_tau *) + let arg, hyp_data = compute_hypermap arg in + let tau13 = get_tau_split_th tau_split4 hyp_data arg d13_tm and + tau24 = get_tau_split_th tau_split4 hyp_data arg d24_tm in + (* Prove all subcases *) + let arg13 = {arg with hyp_data = []; lp_cond_th = lp_cond13; lp_tau_th = tau13; hyp_list_tm = split13_tm; e_tm = e13} and + arg24 = {arg with hyp_data = []; lp_cond_th = lp_cond24; lp_tau_th = tau24; hyp_list_tm = split24_tm; e_tm = e24} in + let args = zip [arg13; arg24; arg13; arg24; arg] cs in + let cases = map2 (verify_lp_case base_ineqs) [false; false; false; false; std_flag] args in + (* Combine subcases *) + let split_th = INST[diag1_tm, nth diag_vars 1; diag2_tm, nth diag_vars 2] split4_lemma in + let split_cases = striplist dest_disj (concl split_th) in + let final_cases = map2 (get_final_case_th arg.ye_sym_th) split_cases cases in + let final_th = MP (end_itlist combine_cases final_cases) split_th in + final_th + +(* Pent *) +and verify_split5 base_ineqs std_flag arg info cs = + let dart_tms = rotateL 1 (mk_all_darts info.split_face) in + let lp_conds_one = map (split_lp_conditions arg.hyp_list_tm arg.lp_cond_th) dart_tms in + let lp_conds_two = map2 (fun ((list1, _), cond1) d_tm -> split_lp_conditions list1 cond1 d_tm) lp_conds_one (rotateL 2 dart_tms) in + (* compute lp_tau_th *) + let arg, (hyp_set, hyp_fun) = compute_hypermap arg in + let tau_ths_one = map (get_tau_split_th tau_split5_one (hyp_set, hyp_fun) arg) dart_tms in + let tau_ths_two = + let ths = map (get_tau_split_th tau_split5_two (hyp_set, hyp_fun) arg) dart_tms in + map ((CONV_RULE o RAND_CONV o RAND_CONV o RAND_CONV o RAND_CONV) (convert_tm hyp_fun)) ths in + (* Prove all subcases *) + let args = arg :: map2 (fun ((split_tm, e_tm), lp_cond_th) tau_th -> + {arg with hyp_data = []; lp_cond_th = lp_cond_th; lp_tau_th = tau_th; + hyp_list_tm = split_tm; e_tm = e_tm}) + (lp_conds_one @ lp_conds_two) (tau_ths_one @ tau_ths_two) in + let std_flags = std_flag :: replicate false 10 in + let cases = map2 (verify_lp_case base_ineqs) std_flags (zip args cs) in + (* Combine subcases *) + let split_face_tms = map mk_raw_num info.split_face in + let diag_tms = map mk_pair (zip split_face_tms (rotateL 2 split_face_tms)) in + let split_th = INST (zip diag_tms (take 5 (drop 1 diag_vars))) split5_lemma in + let split_cases = striplist dest_disj (concl split_th) in + let final_cases = map2 (get_final_case_th arg.ye_sym_th) split_cases cases in + let final_th = MP (end_itlist combine_cases final_cases) split_th in + final_th + +(* Hex *) +and verify_split6 base_ineqs std_flag arg info cs = + let _ = report "Warning: hex splitting case" in + let dart_tms = rotateL 1 (mk_all_darts info.split_face) in + let lp_conds = map (split_lp_conditions arg.hyp_list_tm arg.lp_cond_th) dart_tms in + (* compute lp_tau_th *) + let arg, hyp_data = compute_hypermap arg in + let lp_tau_ths = map (get_tau_split_th tau_split6 hyp_data arg) dart_tms in + (* Prove all subcases *) + let args = arg :: map2 (fun ((split_tm, e_tm), lp_cond_th) tau_th -> + {arg with hyp_data = []; lp_cond_th = lp_cond_th; lp_tau_th = tau_th; + hyp_list_tm = split_tm; e_tm = e_tm}) lp_conds lp_tau_ths in + let std_flags = std_flag :: replicate false 6 in + let cases = map2 (verify_lp_case base_ineqs) std_flags (zip args cs) in + (* Combine subcases *) + let split_face_tms = map mk_raw_num info.split_face in + let diag_tms = map mk_pair (zip split_face_tms (rotateL 2 split_face_tms)) in + let split_th = INST (zip diag_tms (take 6 (drop 1 diag_vars))) split6_lemma in + let split_cases = striplist dest_disj (concl split_th) in + let final_cases = map2 (get_final_case_th arg.ye_sym_th) split_cases cases in + let final_th = MP (end_itlist combine_cases final_cases) split_th in + final_th;; + + +(* Verifies an lp_certificate *) +let verify_lp_certificate certificate = + let n = count_terminals certificate.root_case in + let hyp_list = (snd o convert_to_list) certificate.hypermap_string in + let hyp_list0_tm = (to_num o create_hol_list) hyp_list in + let hyp_set0, hyp_fun0 = compute_all hyp_list0_tm None in + let lp_cond0, lp_tau0 = contravening_conditions hyp_list0_tm hyp_set0 in + let ye_sym_th = (MY_PROVE_HYP lp_cond0 o INST[estd_v, e_cap_var]) ye_sym0 in + let base_ineqs = + if n == 1 then [] else + let r = get_all_ineqs hyp_set0 o EXPAND_CONCL_RULE "L" o + MY_PROVE_HYP lp_tau0 o MY_PROVE_HYP lp_cond0 o MY_PROVE_HYP estd_refl o INST[estd_v, e_cap_var] in + let r2 = (map (fun th -> EQ_MP (convert_tm hyp_fun0 (concl th)) th)) o r in + (r ye_hi_3) @ (r ye_hi_2h0) @ (r2 diag4_lo) @ (r2 diag5_lo) @ (r2 diag5_lo_sym) @ (r2 diag6_lo) @ (r2 diag6_lo_sym) in + let arg = {hyp_data = [hyp_set0, hyp_fun0]; ye_sym_th = ye_sym_th; + lp_cond_th = EXPAND_CONCL_RULE "L" lp_cond0; lp_tau_th = lp_tau0; + hyp_list_tm = hyp_list0_tm; e_tm = estd_v} in + + let _ = reset_progress(); Format.print_string (sprintf "terminals = %d: " n); Format.print_flush() in + + let final_th = verify_lp_case base_ineqs true (arg, certificate.root_case) in + let _ = Format.print_newline() in + (DISCH contravening_v o EXPAND_RULE "L" o EXPAND_RULE "g" o EXPAND_RULE "h") final_th;; + + +end;; diff --git a/formal_lp/hypermap/main/test6.hl b/formal_lp/hypermap/main/test6.hl new file mode 100644 index 0000000..ef0308e --- /dev/null +++ b/formal_lp/hypermap/main/test6.hl @@ -0,0 +1,68 @@ +needs "../formal_lp/hypermap/main/prove_flyspeck_lp.hl";; + + +open Flyspeck_lp;; +open Lp_ineqs;; +open Lp_certificate;; +open List_hypermap_computations;; +open List;; +open Lp_informal_computations;; +open Prove_lp;; +open Arith_misc;; +open List_conversions;; +open Lp_main_estimate;; +open Lp_ineqs_proofs;; +open Misc_vars;; + +init_ineqs();; + + +(**************************) + +let cert3_file = "/mnt/Repository/formal_lp/glpk/binary/c3.dat";; +let c3 = hd (read_lp_certificates cert3_file);; + +let cert4_file = "/mnt/Repository/formal_lp/glpk/binary/c4.dat";; +let c4 = hd (read_lp_certificates cert4_file);; + +let cert5_file = "/mnt/Repository/formal_lp/glpk/binary/c5.dat";; +let c5 = hd (read_lp_certificates cert5_file);; + +let binary_dir = "/mnt/Repository/formal_lp/glpk/binary";; +let files = map (fun i -> sprintf "%s/c5_%d.dat" binary_dir i) (0--4);; +let cs = map (hd o read_lp_certificates) files;; + +let cert = nth cs 4;; +case_info cert.root_case;; +convert_to_list cert.hypermap_string;; +verify_lp_certificate cert;; + + +let cert = c3;; +let hyp_list = (to_num o create_hol_list o snd o convert_to_list) cert.hypermap_string;; +let base_ineqs, cs = get_terminal_cases cert;; +length cs;; + + +let th1 = test_terminal (nth cs 4);; +let th2 = INST[`E2:(real^3->bool)->bool`, e_cap_var] th1;; +let th3 = itlist MY_PROVE_HYP base_ineqs th2;; +let th4 = ABBREV_RULE "L" hyp_list th3;; + +(****************) + +verify_lp_certificate c3;; +verify_lp_certificate c4;; +verify_lp_certificate c5;; + +(* 100: 10.671 *) +test 1 (verify_lp_case base_ineqs true) (arg, c4.root_case);; + +(* 100: 85.464 *) +test 1 verify_lp_certificate c3;; +(* 100: 10.851 *) +test 1 verify_lp_certificate c4;; +(* 100: 24.318 *) +test 1 verify_lp_certificate c5;; +(* 100: 31.674 *) +test 1 verify_lp_certificate c6;; diff --git a/formal_lp/hypermap/main/test_ex2_complete.hl b/formal_lp/hypermap/main/test_ex2_complete.hl new file mode 100644 index 0000000..79754e1 --- /dev/null +++ b/formal_lp/hypermap/main/test_ex2_complete.hl @@ -0,0 +1,266 @@ +needs "../formal_lp/hypermap/main/prove_flyspeck_lp.hl";; + +open Arith_misc;; +open Linear_function;; +open Prove_lp;; +open Arith_nat;; +open Misc_vars;; +open List_hypermap_computations;; +open List_conversions;; +open Lp_approx_ineqs;; +open Lp_ineqs;; +open Lp_ineqs_proofs;; +open Lp_main_estimate;; +open Flyspeck_lp;; + + +let split4_lemma = prove(`(a <= b /\ a <= sqrt8) + \/ (b <= a /\ b <= sqrt8) + \/ (a <= b /\ sqrt8 <= a /\ a <= &3) + \/ (b <= a /\ sqrt8 <= b /\ b <= &3) + \/ (&3 <= a /\ &3 <= b)`, + MP_TAC Flyspeck_constants.bounds THEN ARITH_TAC);; + + +let split4_lemma' = INST[`ye_list (g:num#num->real^3#real^3) d1`, `a:real`; + `ye_list (g:num#num->real^3#real^3) d2`, `b:real`] split4_lemma;; + +let d1_var = `d1:num#num` and + d2_var = `d2:num#num`;; + + +let rec assoc_all a list = + match list with + | [] -> [] + | (k,v) :: t -> if k = a then v :: assoc_all a t else assoc_all a t;; + + +let gen_extra_ineqs = + let tm_3 = `&3` and + tm_sqrt8 = `sqrt8` in + let r tm = prove(tm, MP_TAC Flyspeck_constants.bounds THEN ARITH_TAC) in + let l_ths_list = [ + tm_3, r `&3 <= a ==> sqrt8 <= a`; + ] in + let r_ths_list = [ + tm_sqrt8, r `a <= sqrt8 ==> a <= &3`; + ] in + let a_var_real = `a:real` in + fun ineq_th -> + let lhs, rhs = dest_binary "real_le" (concl ineq_th) in + let l_ths = map (fun th -> MP (INST[rhs, a_var_real] th) ineq_th) (assoc_all lhs l_ths_list) and + r_ths = map (fun th -> MP (INST[lhs, a_var_real] th) ineq_th) (assoc_all rhs r_ths_list) in + l_ths @ r_ths;; + + +let dest_ye_list tm = + let lhs, rhs = dest_comb tm in + let c_tm = rator lhs in + if (fst o dest_const) c_tm <> "ye_list" then + failwith "dest_ye_list: not ye_list" + else + dest_pair rhs;; + +let gen_ye_sym_ineqs ye_sym_th ineq_th = + let sym_eqs tm = + try + let n_tm, m_tm = dest_ye_list tm in + [REFL tm; INST[n_tm, n_var_num; m_tm, m_var_num] ye_sym_th] + with Failure _ -> + [REFL tm] in + let ltm, rhs = dest_comb (concl ineq_th) in + let op_tm, lhs = dest_comb ltm in + let l_eqs = sym_eqs lhs and + r_eqs = sym_eqs rhs in + tl (allpairs (fun l_eq r_eq -> EQ_MP (MK_COMB (AP_TERM op_tm l_eq, r_eq)) ineq_th) l_eqs r_eqs);; + + +let gen_all_extra_cases ye_sym_th case_tms = + let case_ths = map ASSUME case_tms in + let extra = List.flatten (map gen_extra_ineqs case_ths) in + let sym = gen_ye_sym_ineqs ye_sym_th in + extra @ List.flatten (map sym (case_ths @ extra));; + + +let e_cap_var = `E:(real^3->bool)->bool`;; +let lp_cond_imp_good_list = prove(`lp_cond (L, g, h:num->real^3) (V,E) ==> good_list L`, SIMP_TAC[lp_cond]);; +let ye_sym0 = (add_lp_hyp false o prove)(`(!d. g d = h (FST d), h (SND d)) + ==> ye_list (g:num#num->real^3#real^3) (n,m) = ye_list g (m,n)`, + DISCH_TAC THEN ASM_REWRITE_TAC Lp_ineqs_def.list_defs2 THEN + REWRITE_TAC[Lp_ineqs_def.ye_fan; DIST_SYM]);; + +let gen_list_ineq simplify_all_flag th = + let th0 = add_lp_hyp true th in + let tm1, proof_th = mk_lp_ineq th0 in + let raw_data = {name = "tmp"; tm = tm1; proof = Some proof_th; std_only = false} in + generate_ineq1 simplify_all_flag raw_data;; + +let tau_split4 = gen_list_ineq false lp_tau_split4;; +let diag4_lo = gen_list_ineq true dart4_y4'_lo;; + + + +let get_all_ineqs hyp_set0 all_ineq_th = + let all_tm, set_tm = dest_comb (concl all_ineq_th) in + let set_eq_th = hyp_set0 ((fst o dest_const o rator) set_tm) in + let ineq1_th = EQ_MP (AP_TERM all_tm set_eq_th) all_ineq_th in + map MY_BETA_RULE (get_all ineq1_th);; + + +let contravening_conditions hyp_list_tm hyp_set = + let th0 = (MY_RULE_NUM o REWRITE_RULE[Seq.size]) contravening_lp_cond_alt in + let th1 = (UNDISCH_ALL o ISPEC hyp_list_tm o REWRITE_RULE[GSYM IMP_IMP]) th0 in + let good_list_nodes_th = EQT_ELIM (eval_good_list_nodes_condition hyp_set) in + let lp_cond_th = (MY_PROVE_HYP (hyp_set "good_list") o MY_PROVE_HYP good_list_nodes_th) th1 in + let lp_cond_th' = (SELECT_AND_ABBREV_RULE o SELECT_AND_ABBREV_RULE o ABBREV_RULE "L" hyp_list_tm) lp_cond_th in + let lp_tau_th = (UNDISCH_ALL o SPEC_ALL) contravening_lp_tau in + lp_cond_th', lp_tau_th;; + + +let split_conditions hyp_list_tm d_tm lp_cond0_th = + let split_eq_th = (ABBREV_RULE "L" hyp_list_tm) (eval_split_list_hyp hyp_list_tm d_tm) in + let split_tm = (rand o concl) split_eq_th in + let lp_cond2_th = (PURE_REWRITE_RULE[split_eq_th] o SPEC d_tm o MATCH_MP lp_cond_trans1) lp_cond0_th in + let e2_tm = (rand o rand o concl) lp_cond2_th in + let lp_cond2_th' = (ABBREV_RULE "L2" split_tm) lp_cond2_th in +(* +let good2_th = MATCH_MP lp_cond_imp_good_list lp_cond2_th;; +let hyp2_set, hyp2_fun = compute_all split_tm (Some good2_th);; +*) + let hyp2_set, hyp2_fun = compute_all split_tm None in + lp_cond2_th', split_eq_th, split_tm, e2_tm, (hyp2_set, hyp2_fun);; + + +(******************************) +(* Load data *) +loadt "../formal_lp/glpk/ex2/bb2_1_out.hl";; +let p1, c1, t1, v1 = precision, constraints, target_variables, variable_bounds;; + +loadt "../formal_lp/glpk/ex2/bb2_2_out.hl";; +let p2, c2, t2, v2 = precision, constraints, target_variables, variable_bounds;; + +loadt "../formal_lp/glpk/ex2/bb2_3_out.hl";; +let p3, c3, t3, v3 = precision, constraints, target_variables, variable_bounds;; + +loadt "../formal_lp/glpk/ex2/bb2_4_out.hl";; +let p4, c4, t4, v4 = precision, constraints, target_variables, variable_bounds;; + +loadt "../formal_lp/glpk/ex2/bb2_5_out.hl";; +let p5, c5, t5, v5 = precision, constraints, target_variables, variable_bounds;; + + +(******************************) +(* Compute preliminary data *) +let hyp_list0_tm = (to_num o create_hol_list_str) hypermap_string;; +let hyp_set0, hyp_fun0 = compute_all hyp_list0_tm None;; + +let d13 = to_num `1,2` and + d24 = to_num `0,1`;; + +let lp_cond0, lp_tau0 = contravening_conditions hyp_list0_tm hyp_set0;; +let ye_sym_th = (MY_PROVE_HYP lp_cond0 o INST[`ESTD V`, e_cap_var]) ye_sym0;; + +let ye_hi_3 = generate_ineq (find_raw_ineq true "ye_hi");; +let ye_hi_2h0 = generate_ineq (find_raw_ineq true "yy10");; + +let ye_ineqs_3, ye_ineqs_2h0, diag4_ineqs, tau_ths = + let estd_refl = REFL `ESTD V` in + let r = get_all_ineqs hyp_set0 o EXPAND_CONCL_RULE "L" o + MY_PROVE_HYP lp_tau0 o MY_PROVE_HYP lp_cond0 o MY_PROVE_HYP estd_refl o INST[`ESTD V`, e_cap_var] in + r ye_hi_3, r ye_hi_2h0, r diag4_lo, r tau_split4;; + + +let diag4_ths = map (fun th -> EQ_MP (convert_tm hyp_fun0 (concl th)) th) diag4_ineqs;; +let tau_ths2 = map (UNDISCH_ALL o simplify_ineq hyp_fun0) ((fst o chop_list 2) tau_ths);; +let tau_split13 = List.nth tau_ths2 1;; +let tau_split24 = List.nth tau_ths2 0;; + +let base_ineqs = ye_ineqs_3 @ ye_ineqs_2h0 @ diag4_ths;; + + +(******************************) +(* case 1 *) +let lp_cond1, split1_eq, hyp_list1_tm, e1_tm, (hyp1_set, hyp1_fun) = split_conditions hyp_list0_tm d13 lp_cond0;; + +let lp1_th0 = prove_flyspeck_lp_step1 hyp_list1_tm hyp1_set hyp1_fun false p1 c1 t1 v1;; +let lp1_th1 = (MY_PROVE_HYP tau_split13 o INST[e1_tm, e_cap_var]) lp1_th0;; +let lp1_th2 = itlist MY_PROVE_HYP base_ineqs lp1_th1;; + +let case1_th = (EXPAND_RULE "L2" o MY_PROVE_HYP lp_cond1 o INST[e1_tm, e_cap_var] o ABBREV_RULE "L2" hyp_list1_tm) lp1_th2;; + + +(******************************) +(* case 2 *) +let lp_cond2, split2_eq, hyp_list2_tm, e2_tm, (hyp2_set, hyp2_fun) = split_conditions hyp_list0_tm d24 lp_cond0;; + +let lp2_th0 = prove_flyspeck_lp_step1 hyp_list2_tm hyp2_set hyp2_fun false p2 c2 t2 v2;; +let lp2_th1 = (MY_PROVE_HYP tau_split24 o INST[e2_tm, e_cap_var]) lp2_th0;; +let lp2_th2 = itlist MY_PROVE_HYP base_ineqs lp2_th1;; + +let case2_th = (EXPAND_RULE "L2" o MY_PROVE_HYP lp_cond2 o INST[e2_tm, e_cap_var] o ABBREV_RULE "L2" hyp_list2_tm) lp2_th2;; + + +(******************************) +(* case 3 *) +let lp_cond3, split3_eq, hyp_list3_tm, e3_tm, (hyp3_set, hyp3_fun) = split_conditions hyp_list0_tm d13 lp_cond0;; + +let lp3_th0 = prove_flyspeck_lp_step1 hyp_list3_tm hyp3_set hyp3_fun false p3 c3 t3 v3;; +let lp3_th1 = (MY_PROVE_HYP tau_split13 o INST[e3_tm, e_cap_var]) lp3_th0;; +let lp3_th2 = itlist MY_PROVE_HYP base_ineqs lp3_th1;; + +let case3_th = (EXPAND_RULE "L2" o MY_PROVE_HYP lp_cond3 o INST[e2_tm, e_cap_var] o ABBREV_RULE "L2" hyp_list3_tm) lp3_th2;; + + +(******************************) +(* case 4 *) +let lp_cond4, split4_eq, hyp_list4_tm, e4_tm, (hyp4_set, hyp4_fun) = split_conditions hyp_list0_tm d24 lp_cond0;; + +let lp4_th0 = prove_flyspeck_lp_step1 hyp_list4_tm hyp4_set hyp4_fun false p4 c4 t4 v4;; +let lp4_th1 = (MY_PROVE_HYP tau_split24 o INST[e2_tm, e_cap_var]) lp4_th0;; +let lp4_th2 = itlist MY_PROVE_HYP base_ineqs lp4_th1;; + +let case4_th = (EXPAND_RULE "L2" o MY_PROVE_HYP lp_cond4 o INST[e4_tm, e_cap_var] o ABBREV_RULE "L2" hyp_list4_tm) lp4_th2;; + + +(******************************) +(* case 5 *) +let lp5_th0 = prove_flyspeck_lp_step1 hyp_list0_tm hyp_set0 hyp_fun0 true p5 c5 t5 v5;; +let lp5_th1 = (MY_PROVE_HYP (REFL `ESTD V`) o INST [`ESTD V`, e_cap_var]) lp5_th0;; +let lp5_th2 = (MY_PROVE_HYP lp_tau0 o MY_PROVE_HYP lp_cond0 o ABBREV_RULE "L" hyp_list0_tm) lp5_th1;; + +let case5_th = lp5_th2;; + + +(******************************) +(* combine all cases *) + +let diag2 = to_num `1,3`;; +let diag1 = to_num `0,2`;; + +let split_th = INST[diag1, d1_var; diag2, d2_var] split4_lemma';; +let split_cases = striplist dest_disj (concl split_th);; + +let case1_tms = striplist dest_conj (List.nth split_cases 0);; +map concl (gen_all_extra_cases ye_sym_th case1_tms);; +let case1_th2 = itlist MY_PROVE_HYP (gen_all_extra_cases ye_sym_th case1_tms) case1_th;; +let case1_th_final = PURE_ONCE_REWRITE_RULE[IMP_IMP] (itlist DISCH case1_tms case1_th2);; + +let get_final_case_th ye_sym_th n case_th cases = + let case_tms = striplist dest_conj (List.nth cases n) in + let case_th2 = itlist MY_PROVE_HYP (gen_all_extra_cases ye_sym_th case_tms) case_th in + PURE_REWRITE_RULE[IMP_IMP; GSYM CONJ_ASSOC] (itlist DISCH case_tms case_th2);; + +let case1_th_final = get_final_case_th ye_sym_th 0 case1_th split_cases;; +let case2_th_final = get_final_case_th ye_sym_th 1 case2_th split_cases;; +let case3_th_final = get_final_case_th ye_sym_th 2 case3_th split_cases;; +let case4_th_final = get_final_case_th ye_sym_th 3 case4_th split_cases;; +let case5_th_final = get_final_case_th ye_sym_th 4 case5_th split_cases;; + +let combine_cases = + let combine_th = TAUT `(A ==> C) /\ (B ==> C) ==> (A \/ B ==> C)` in + fun case1_th case2_th -> + MATCH_MP combine_th (CONJ case1_th case2_th);; + + +let final' = itlist combine_cases [case1_th_final; case2_th_final; case3_th_final; case4_th_final] case5_th_final;; +let final = (DISCH `contravening V` o EXPAND_RULE "g" o EXPAND_RULE "h" o EXPAND_RULE "L") (MP final' split_th);; diff --git a/formal_lp/hypermap/main/test_hard.hl b/formal_lp/hypermap/main/test_hard.hl new file mode 100644 index 0000000..c811fb6 --- /dev/null +++ b/formal_lp/hypermap/main/test_hard.hl @@ -0,0 +1,574 @@ +needs "../formal_lp/hypermap/main/prove_flyspeck_lp.hl";; + +open List;; +open Arith_misc;; +open Linear_function;; +open Prove_lp;; +open Arith_nat;; +open Misc_vars;; +open List_hypermap_computations;; +open List_conversions;; +open Lp_approx_ineqs;; +open Lp_ineqs;; +open Lp_certificate;; +open Lp_informal_computations;; +open Lp_ineqs_proofs;; +open Lp_main_estimate;; +open Flyspeck_lp;; + + +let dir = "/mnt/Repository/formal_lp/glpk/binary";; + +let get_files_with_prefix dir prefix = + let files = Array.to_list (Sys.readdir dir) in + let n = String.length prefix in + let files1 = filter (fun f -> String.length f >= n) files in + let files2 = filter (fun f -> String.sub f 0 n = prefix) files1 in + map (fun f -> sprintf "%s/%s" dir f) files2;; + + + +exception Debug_exception of (lp_verification_arg * split_case * lp_certificate_case list * thm list);; + +(***************************) + +(* Generate |- 6.25 <= a + b + c and symmetric inequalities when 2.25 <= a *) +let gen_add_big_ineqs = + let c625 = `#6.25` in + let sym_big = (SPEC c625 o ARITH_RULE) `!c. c <= x + y + z ==> c <= y + z + x /\ c <= z + x + y` in + let big_extra = (SPEC `d:num#num` o REWRITE_RULE[GSYM ALL_MEM] o gen_list_ineq true) Lp_ineqs_proofs2.extra_ineq_std3_big in + fun (hyp_set, hyp_fun) arg split_face -> + let d_tm = mk_dart split_face 0 1 in + let set_th = hyp_set "list_of_darts3" in + let mem_th = EQT_ELIM (apply_op set_th (eval_mem_num_pair d_tm)) in + let th0 = INST[arg.hyp_list_tm, l_cap_var; d_tm, d_var_pair; arg.e_tm, e_cap_var] big_extra in + let big_th = (CONV_RULE (convert_condition hyp_fun) o MY_PROVE_HYP arg.lp_cond_th o UNDISCH o MP th0) mem_th in + let x_tm, yz_tms = dest_binary "real_add" (rand (concl big_th)) in + let y_tm, z_tm = dest_binary "real_add" yz_tms in + let inst_list = zip [x_tm; y_tm; z_tm] [x_var_real; y_var_real; z_var_real] in + big_th :: CONJUNCTS (MP (INST inst_list sym_big) big_th);; + + +(* Generates extra inequalities in the case when 2.18 <= yn(i) and 2.18 <= yn(j) for ~(i = j) *) +let gen_mid_ineqs = + let eq13 = (REWRITE_RULE[Arith_hash.NUM_THM] o NUMERAL_TO_NUM_CONV) `13` in + let lnsum13_mid_lemma = (REWRITE_RULE[GSYM IMP_IMP; eq13; Seq.size] o + SPEC_ALL o add_lp_hyp false o UNDISCH_ALL o SPEC_ALL) Lp_ineqs_proofs.lnsum13_mid in + fun (hyp_set, hyp_fun) arg split_face -> + let i_tm = mk_raw_num (nth split_face 0) in + let j_tm = mk_raw_num (nth split_face 1) in + let th0 = (MY_PROVE_HYP arg.lp_cond_th o + INST[arg.e_tm, e_cap_var; arg.hyp_list_tm, l_cap_var; i_tm, i_var_num; j_tm, j_var_num]) lnsum13_mid_lemma in + let els_eq_th = hyp_set "list_of_elements" in + let els_tm = rand (concl els_eq_th) in + let indices = + let list = dest_list els_tm in + let i_ind = index i_tm list and + j_ind = index j_tm list in + subtract (0--(length list - 1)) [i_ind; j_ind] in + let th1 = EQ_MP (term_rewrite (concl th0) els_eq_th) th0 in + let th2 = (prove_conditions o simplify_ineq hyp_fun) th1 in + let mem_i = EQT_ELIM (eval_mem_univ raw_eq_hash_conv i_tm els_tm) and + mem_j = EQT_ELIM (eval_mem_univ raw_eq_hash_conv j_tm els_tm) in + let ths = CONJUNCTS (MY_PROVE_HYP mem_i (MY_PROVE_HYP mem_j th2)) in + let lo_th = nth ths 0 and + hi_th1 = nth ths 1 and + hi_th2 = nth ths 2 in + let lo_ineqs1 = select_all lo_th indices in + let lo_ineqs2 = map (prove_conditions o MY_BETA_RULE) lo_ineqs1 in + let ineqs = hi_th1 :: hi_th2 :: lo_ineqs2 in + ineqs @ flatten (map gen_extra_ineqs ineqs);; + + +(* Generates extra inequalities in the case when 2.36 <= yn(i) *) +let gen_high_ineqs = + let eq13 = (REWRITE_RULE[Arith_hash.NUM_THM] o NUMERAL_TO_NUM_CONV) `13` in + let lnsum13_high_lemma = (REWRITE_RULE[GSYM IMP_IMP; eq13; Seq.size] o + SPEC_ALL o add_lp_hyp false o UNDISCH_ALL o SPEC_ALL) Lp_ineqs_proofs.lnsum13_high in + fun (hyp_set, hyp_fun) arg split_face -> + let i_tm = mk_raw_num (nth split_face 0) in + let th0 = (MY_PROVE_HYP arg.lp_cond_th o + INST[arg.e_tm, e_cap_var; arg.hyp_list_tm, l_cap_var; i_tm, i_var_num]) lnsum13_high_lemma in + let els_eq_th = hyp_set "list_of_elements" in + let els_tm = rand (concl els_eq_th) in + let indices = + let list = dest_list els_tm in + let i_ind = index i_tm list in + subtract (0--(length list - 1)) [i_ind] in + let th1 = EQ_MP (term_rewrite (concl th0) els_eq_th) th0 in + let th2 = (prove_conditions o simplify_ineq hyp_fun) th1 in + let mem_i = EQT_ELIM (eval_mem_univ raw_eq_hash_conv i_tm els_tm) in + let lo_th = MY_PROVE_HYP mem_i th2 in + let lo_ineqs1 = select_all lo_th indices in + let ineqs = map (prove_conditions o MY_BETA_RULE) lo_ineqs1 in + ineqs @ flatten (map gen_extra_ineqs ineqs);; + + +let set_report, reset_progress, next_terminal, report_progress = + let t = ref 0 in + let flag = ref true in + (fun b -> flag := b), + (fun () -> t := 0), + (fun () -> t := !t + 1), + (fun () -> if !flag then (Format.print_string (sprintf "%d " !t); Format.print_flush()) else ());; + + +let compute_hypermap arg = + if arg.hyp_data = [] then + let good_th = MATCH_MP lp_cond_imp_good_list arg.lp_cond_th in + let hyp_data = compute_all arg.hyp_list_tm (Some good_th) in + {arg with hyp_data = [hyp_data]}, hyp_data + else + arg, hd arg.hyp_data;; + + +(* Verifies an lp_certificate_case *) +let rec verify_lp_case base_ineqs std_flag (arg, case) = + match case with + (* Terminal case *) + | Lp_terminal terminal -> + let _ = next_terminal() in + let hyp_set, hyp_fun = snd (compute_hypermap arg) in + let r = (fun name, ind, v -> name, ind, map mk_real_int64 v) in + let c = map r terminal.constraints and + tv = map r terminal.target_variables and + vb = map r terminal.variable_bounds in + let th0 = prove_flyspeck_lp_step1 arg.hyp_list_tm hyp_set hyp_fun std_flag terminal.precision terminal.infeasible c tv vb in + let _ = report_progress() in + let th1 = (MY_PROVE_HYP arg.lp_tau_th o INST[arg.e_tm, e_cap_var]) th0 in + let th2 = if std_flag then MY_PROVE_HYP estd_refl th1 else itlist MY_PROVE_HYP base_ineqs th1 in + (MY_PROVE_HYP arg.lp_cond_th) th2 + | Lp_split (info, cs) -> + (match info.split_type with + | "tri" -> + verify_split3 base_ineqs std_flag arg info cs + | "quad" -> + verify_split4 base_ineqs std_flag arg info cs + | "pent" -> + verify_split5 base_ineqs std_flag arg info cs + | "hex" -> + verify_split6 base_ineqs std_flag arg info cs + | "edge" -> + verify_edge base_ineqs std_flag arg info cs + | "218" -> + verify_218 base_ineqs std_flag arg info cs + | "236" -> + verify_236 base_ineqs std_flag arg info cs + | "mid" -> + verify_mid base_ineqs std_flag arg info cs + | "high" -> + verify_high base_ineqs std_flag arg info cs + | "add_big" -> + verify_add_big base_ineqs std_flag arg info cs + | s -> failwith ("verify_lp_case: unknown case " ^ s)) + +(* Adds a new big triangle if one of its edges is >= #2.25 *) +and verify_add_big base_ineqs std_flag arg info cs = + let arg, hyp_data = compute_hypermap arg in + let case = verify_lp_case base_ineqs std_flag (arg, hd cs) in + let ineqs = gen_add_big_ineqs hyp_data arg info.split_face in + itlist MY_PROVE_HYP ineqs case + +(* Adds additional node inequalities *) +and verify_mid base_ineqs std_flag arg info cs = + let arg, hyp_data = compute_hypermap arg in + let case = verify_lp_case base_ineqs std_flag (arg, hd cs) in + let ineqs = gen_mid_ineqs hyp_data arg info.split_face in + itlist MY_PROVE_HYP ineqs case + +(* Adds additional node inequalities *) +and verify_high base_ineqs std_flag arg info cs = + let arg, hyp_data = compute_hypermap arg in + let case = verify_lp_case base_ineqs std_flag (arg, hd cs) in + let ineqs = gen_high_ineqs hyp_data arg info.split_face in + itlist MY_PROVE_HYP ineqs case + +(* Nodes: 2.18 <= yn(i) \/ yn(i) <= 2.18 *) +and verify_218 base_ineqs std_flag arg info cs = + let cases = map (curry (verify_lp_case base_ineqs std_flag) arg) cs in + let split_th = INST[mk_raw_num (hd info.split_face), i_var_num] split218_lemma in + let split_cases = striplist dest_disj (concl split_th) in + let final_cases = map2 (get_final_case_th arg.ye_sym_th) split_cases cases in + let final_th = MP (end_itlist combine_cases final_cases) split_th in + final_th + +(* Nodes: yn(i) <= 2.36 \/ 2.36 <= yn(i) *) +and verify_236 base_ineqs std_flag arg info cs = + let cases = map (curry (verify_lp_case base_ineqs std_flag) arg) cs in + let split_th = INST[mk_raw_num (hd info.split_face), i_var_num] split236_lemma in + let split_cases = striplist dest_disj (concl split_th) in + let final_cases = map2 (get_final_case_th arg.ye_sym_th) split_cases cases in + let final_th = MP (end_itlist combine_cases final_cases) split_th in + final_th + +(* Edges: 2.25 <= ye(d) \/ ye(d) <= 2.25 *) +and verify_edge base_ineqs std_flag arg info cs = + let cases = map (curry (verify_lp_case base_ineqs std_flag) arg) cs in + let split_th = INST[mk_dart info.split_face 0 1, d_var_pair] split225_lemma in + let split_cases = striplist dest_disj (concl split_th) in + let final_cases = map2 (get_final_case_th arg.ye_sym_th) split_cases cases in + let final_th = MP (end_itlist combine_cases final_cases) split_th in + final_th + +(* Triangle *) +and verify_split3 base_ineqs std_flag arg info cs = + let arg, hyp_data = compute_hypermap arg in + (* Prove all subcases *) + let case1_th = verify_lp_case base_ineqs std_flag (arg, nth cs 0) and + case2_th = verify_lp_case base_ineqs std_flag (arg, nth cs 1) in + (* Combine subcases *) + let split_th, (case1_tm, case2_tm), (case1_ineqs, case2_ineqs) = gen_triangle_ineqs hyp_data arg info.split_face in + let th1 = DISCH case1_tm (itlist MY_PROVE_HYP case1_ineqs case1_th) and + th2 = DISCH case2_tm (itlist MY_PROVE_HYP case2_ineqs case2_th) in + let final_th = MP (combine_cases th1 th2) split_th in + final_th + +(* Quad *) +and verify_split4 base_ineqs std_flag arg info cs = + let d13_tm = mk_dart info.split_face 1 2 and + d24_tm = mk_dart info.split_face 0 1 and + diag1_tm = mk_dart info.split_face 0 2 and + diag2_tm = mk_dart info.split_face 1 3 in + (* compute lp_cond *) + let (split13_tm, e13), lp_cond13 = split_lp_conditions arg.hyp_list_tm arg.lp_cond_th d13_tm and + (split24_tm, e24), lp_cond24 = split_lp_conditions arg.hyp_list_tm arg.lp_cond_th d24_tm in + (* compute lp_tau *) + let arg, hyp_data = compute_hypermap arg in + let tau13 = get_tau_split_th tau_split4 hyp_data arg d13_tm and + tau24 = get_tau_split_th tau_split4 hyp_data arg d24_tm in + (* Prove all subcases *) + let arg13 = {arg with hyp_data = []; lp_cond_th = lp_cond13; lp_tau_th = tau13; hyp_list_tm = split13_tm; e_tm = e13} and + arg24 = {arg with hyp_data = []; lp_cond_th = lp_cond24; lp_tau_th = tau24; hyp_list_tm = split24_tm; e_tm = e24} in + let args = zip [arg13; arg24; arg13; arg24; arg] cs in + let cases = map2 (verify_lp_case base_ineqs) [false; false; false; false; std_flag] args in + (* Combine subcases *) + let split_th = INST[diag1_tm, nth diag_vars 1; diag2_tm, nth diag_vars 2] split4_lemma in + let split_cases = striplist dest_disj (concl split_th) in + let final_cases = map2 (get_final_case_th arg.ye_sym_th) split_cases cases in + let final_th = MP (end_itlist combine_cases final_cases) split_th in + final_th + +(* Pent *) +and verify_split5 base_ineqs std_flag arg info cs = + let dart_tms = rotateL 1 (mk_all_darts info.split_face) in + let lp_conds_one = map (split_lp_conditions arg.hyp_list_tm arg.lp_cond_th) dart_tms in + let lp_conds_two = map2 (fun ((list1, _), cond1) d_tm -> split_lp_conditions list1 cond1 d_tm) lp_conds_one (rotateL 2 dart_tms) in + (* compute lp_tau_th *) + let arg, (hyp_set, hyp_fun) = compute_hypermap arg in + let tau_ths_one = map (get_tau_split_th tau_split5_one (hyp_set, hyp_fun) arg) dart_tms in + let tau_ths_two = + let ths = map (get_tau_split_th tau_split5_two (hyp_set, hyp_fun) arg) dart_tms in + map ((CONV_RULE o RAND_CONV o RAND_CONV o RAND_CONV o RAND_CONV) (convert_tm hyp_fun)) ths in + (* Prove all subcases *) + let args = arg :: map2 (fun ((split_tm, e_tm), lp_cond_th) tau_th -> + {arg with hyp_data = []; lp_cond_th = lp_cond_th; lp_tau_th = tau_th; + hyp_list_tm = split_tm; e_tm = e_tm}) + (lp_conds_one @ lp_conds_two) (tau_ths_one @ tau_ths_two) in + let std_flags = std_flag :: replicate false 10 in + let cases = map2 (verify_lp_case base_ineqs) std_flags (zip args cs) in + (* Combine subcases *) + let split_face_tms = map mk_raw_num info.split_face in + let diag_tms = map mk_pair (zip split_face_tms (rotateL 2 split_face_tms)) in + let split_th = INST (zip diag_tms (take 5 (drop 1 diag_vars))) split5_lemma in + let split_cases = striplist dest_disj (concl split_th) in + let final_cases = map2 (get_final_case_th arg.ye_sym_th) split_cases cases in + let final_th = MP (end_itlist combine_cases final_cases) split_th in + final_th + +(* Hex *) +and verify_split6 base_ineqs std_flag arg info cs = + let _ = report "Warning: hex splitting case" in + let dart_tms = rotateL 1 (mk_all_darts info.split_face) in + let lp_conds = map (split_lp_conditions arg.hyp_list_tm arg.lp_cond_th) dart_tms in + (* compute lp_tau_th *) + let arg, hyp_data = compute_hypermap arg in + let lp_tau_ths = map (get_tau_split_th tau_split6 hyp_data arg) dart_tms in + (* Prove all subcases *) + let args = arg :: map2 (fun ((split_tm, e_tm), lp_cond_th) tau_th -> + {arg with hyp_data = []; lp_cond_th = lp_cond_th; lp_tau_th = tau_th; + hyp_list_tm = split_tm; e_tm = e_tm}) lp_conds lp_tau_ths in + let std_flags = std_flag :: replicate false 6 in + let cases = map2 (verify_lp_case base_ineqs) std_flags (zip args cs) in + (* Combine subcases *) + let split_face_tms = map mk_raw_num info.split_face in + let diag_tms = map mk_pair (zip split_face_tms (rotateL 2 split_face_tms)) in + let split_th = INST (zip diag_tms (take 6 (drop 1 diag_vars))) split6_lemma in + let split_cases = striplist dest_disj (concl split_th) in + let final_cases = map2 (get_final_case_th arg.ye_sym_th) split_cases cases in + let final_th = MP (end_itlist combine_cases final_cases) split_th in + final_th;; + + +(* Verifies an lp_certificate *) +let verify_lp_certificate certificate = + let n = count_terminals certificate.root_case in + let hyp_list = (snd o convert_to_list) certificate.hypermap_string in + let hyp_list0_tm = (to_num o create_hol_list) hyp_list in + let hyp_set0, hyp_fun0 = compute_all hyp_list0_tm None in + let lp_cond0, lp_tau0 = contravening_conditions hyp_list0_tm hyp_set0 in + let ye_sym_th = (MY_PROVE_HYP lp_cond0 o INST[estd_v, e_cap_var]) ye_sym0 in + let base_ineqs = + if n == 1 then [] else + let r = get_all_ineqs hyp_set0 o EXPAND_CONCL_RULE "L" o + MY_PROVE_HYP lp_tau0 o MY_PROVE_HYP lp_cond0 o MY_PROVE_HYP estd_refl o INST[estd_v, e_cap_var] in + let r2 = (map (fun th -> EQ_MP (convert_tm hyp_fun0 (concl th)) th)) o r in + (r ye_hi_3) @ (r ye_hi_2h0) @ (r2 diag4_lo) @ (r2 diag5_lo) @ (r2 diag5_lo_sym) @ (r2 diag6_lo) @ (r2 diag6_lo_sym) in + let arg = {hyp_data = [hyp_set0, hyp_fun0]; ye_sym_th = ye_sym_th; + lp_cond_th = EXPAND_CONCL_RULE "L" lp_cond0; lp_tau_th = lp_tau0; + hyp_list_tm = hyp_list0_tm; e_tm = estd_v} in + + let _ = reset_progress(); Format.print_string (sprintf "terminals = %d: " n); Format.print_flush() in + + let final_th = verify_lp_case base_ineqs true (arg, certificate.root_case) in + (DISCH contravening_v o EXPAND_RULE "L" o EXPAND_RULE "g" o EXPAND_RULE "h") final_th;; + + +let get_debug certificate = + let n = count_terminals certificate.root_case in + let hyp_list = (snd o convert_to_list) certificate.hypermap_string in + let hyp_list0_tm = (to_num o create_hol_list) hyp_list in + let hyp_set0, hyp_fun0 = compute_all hyp_list0_tm None in + let lp_cond0, lp_tau0 = contravening_conditions hyp_list0_tm hyp_set0 in + let ye_sym_th = (MY_PROVE_HYP lp_cond0 o INST[estd_v, e_cap_var]) ye_sym0 in + let base_ineqs = + if n == 1 then [] else + let r = get_all_ineqs hyp_set0 o EXPAND_CONCL_RULE "L" o + MY_PROVE_HYP lp_tau0 o MY_PROVE_HYP lp_cond0 o MY_PROVE_HYP estd_refl o INST[estd_v, e_cap_var] in + let r2 = (map (fun th -> EQ_MP (convert_tm hyp_fun0 (concl th)) th)) o r in + (r ye_hi_3) @ (r ye_hi_2h0) @ (r2 diag4_lo) @ (r2 diag5_lo) @ (r2 diag5_lo_sym) @ (r2 diag6_lo) @ (r2 diag6_lo_sym) in + let arg = {hyp_data = [hyp_set0, hyp_fun0]; ye_sym_th = ye_sym_th; + lp_cond_th = EXPAND_CONCL_RULE "L" lp_cond0; lp_tau_th = lp_tau0; + hyp_list_tm = hyp_list0_tm; e_tm = estd_v} in + try + let _ = reset_progress(); Format.print_string (sprintf "terminals = %d: " n); Format.print_flush() in + let final_th = verify_lp_case base_ineqs true (arg, certificate.root_case) in + arg, {split_type = "?"; split_face = []}, [], [(DISCH contravening_v o EXPAND_RULE "L" o EXPAND_RULE "g" o EXPAND_RULE "h") final_th] + with Debug_exception (arg, info, cs, thm) -> + arg, info, cs, thm;; + + +(*************************) + + +let cert = (C nth 5 o read_lp_certificates o hd o get_files_with_prefix dir) "not_onepass2_15";; +certificate_info cert;; +let n = count_terminals cert.root_case;; +let _, _, cs_d = match (build_test_split cert.root_case) with Info (str, f, cs) -> str, f, cs;; +nth cs_d 0;; +nth cs_d 1;; + + + +index;; +let base_ineqs, ts = get_terminal_cases cert;; +let t7 = find_all (fun _, t -> t.precision = 7) ts;; +let ind = map (C index ts) t7;; + + +let test_t k = + let _ = Format.print_string (sprintf "%d " k); Format.print_flush() in + let t = nth ts k in + let th1 = itlist MY_PROVE_HYP base_ineqs (test_terminal t) in + filter (is_binary "real_le") (hyp th1);; + +test_t 299;; + +let rr = map test_t ind;; + +let t = nth ts 34;; +test_terminal t;; +test_t 0;; + +let rr = map test_t (0--(n - 1));; +setify (flatten rr);; + +let test_one f arg = + let start = Unix.gettimeofday() in + let result = f arg in + let finish = Unix.gettimeofday() in + result, finish -. start;; + +test_one verify_lp_certificate cert;; + +(**************************) + + + +let arg, info, cs, cases = get_debug cert;; +info;; +nth cases 0;; +nth cases 1;; + + +let hyp_set, hyp_fun = + let good_th = MATCH_MP lp_cond_imp_good_list arg.lp_cond_th in + compute_all arg.hyp_list_tm (Some good_th);; + + + +itlist MY_PROVE_HYP big_ths (hd cases);; +hd cases;; + + +(****************************) + +let mem_stat () = + let stat = Gc.stat() in + let word = float_of_int (Sys.word_size / 8) in + let free = float_of_int stat.Gc.free_words *. word /. 1024.0 in + let total = float_of_int stat.Gc.heap_words *. word /. 1024.0 in + let allocated = total -. free in + let str = sprintf "allocated = %f (free = %f; total_size = %f; %f)\n" + allocated free total (free /. total) in + print_string str;; + +mem_stat();; +Gc.compact();; +let cert = (hd o read_lp_certificates o hd o get_files_with_prefix dir) "hard6";; +certificate_info cert;; + +let test_one f arg = + let start = Unix.gettimeofday() in + let result = f arg in + let finish = Unix.gettimeofday() in + result, finish -. start;; + +let result, time = test_one verify_lp_certificate cert;; + + +let get_all_names cert = + let ts = map snd (snd (get_terminal_cases cert)) in + let get_names t = map (fun name, _, _ -> name) t.constraints in + let names = flatten (map get_names ts) in + setify names;; + + +let cert = (hd o read_lp_certificates o hd o get_files_with_prefix dir) "not_onepass1__2";; +certificate_info cert;; +verify_lp_certificate cert;; + +mem "yapex_sup_flat" (get_all_names cert);; + + +(******************************) + + +let hyp_list, terminal = nth ts 4;; +let hyp_list_tm = (to_num o create_hol_list) hyp_list;; +let hyp_set, hyp_fun = compute_all hyp_list_tm None;; + + +let r = (fun name, ind, v -> name, ind, map mk_real_int64 v);; +let constraints = map r terminal.constraints and + target_variables = map r terminal.target_variables and + variable_bounds = map r terminal.variable_bounds;; + +let std_flag = true and + precision = terminal.precision and + infeasible = terminal.infeasible;; + +prove_flyspeck_lp_step1 hyp_list_tm hyp_set hyp_fun std_flag precision infeasible constraints target_variables variable_bounds;; + +let precision_constant = Int 10 **/ (Int precision);; + +let sum_step = fun (name, indices, c) -> + try + let ineqs = get_ineqs (hyp_list_tm, hyp_set, hyp_fun) std_flag precision name indices in + let s1 = map transform_le_ineq (zip ineqs c) in + List.fold_left add_step' dummy s1 + with + | Failure str -> failwith (sprintf "Problem: %s (%s)" name str) + | _ -> failwith ("Problem: "^name);; + +let var_table = Hashtbl.create 1000;; +let add_to_var_table (name, indices, c) = + let ineqs = get_ineqs (hyp_list_tm, hyp_set, hyp_fun) std_flag precision name indices in + let m_ineqs = map2 (fun th m -> MY_PROVE_HYP th (var1_le_transform (concl th, m))) ineqs c in + let _ = map ( + fun th -> + let var = (rand o lhand o concl) th in + if Hashtbl.mem var_table var then + let ineq1 = Hashtbl.find var_table var in + let ineq = add_le_ineqs th ineq1 in + let c_tm = (lhand o lhand o concl) ineq in + if c_tm = int_zero_tm then + Hashtbl.remove var_table var + else + Hashtbl.replace var_table var ineq + else + Hashtbl.add var_table var th) m_ineqs in + ();; + +let get_first_var ineq_th = + try + (rand o lhand o rand o lhand o concl) ineq_th + with Failure _ -> a_var_real;; +let ineqs1 = map sum_step constraints;; +let ineqs2 = List.sort (fun ineq1 ineq2 -> + let var1 = get_first_var ineq1 and + var2 = get_first_var ineq2 in + compare var1 var2) ineqs1;; +let s1' = List.fold_right add_step' ineqs2 dummy;; +let s1 = mul_step s1' (mk_real_int precision_constant);; +let r1 = if infeasible then s1 else + let ineq_th0 = assoc precision lnsum_ineqs in + let ineq_th1 = (INST[hyp_list_tm, l_cap_var]) ineq_th0 in + let ineq_th2 = EQ_MP (term_rewrite (concl ineq_th1) (hyp_set "list_of_elements")) ineq_th1 in + let ineq_th3 = simplify_ineq hyp_fun ineq_th2 in + let ineq_th4 = to_lin_f_ineq ineq_th3 in + add_step' ineq_th4 s1;; +let _ = map add_to_var_table variable_bounds and + _ = map add_to_var_table target_variables;; +let list1 = Hashtbl.fold (fun tm ineq list -> (tm, ineq) :: list) var_table [];; +let list2 = List.sort (fun (tm1, _) (tm2, _) -> compare tm1 tm2) list1;; +let var_list = map snd list2;; + +let l = take 294 var_list;; +let l1 = take 293 var_list;; +let l2 = take 1 (drop 293 var_list);; + + + +List.fold_left add_cancel_step r1 l;; + +let result = List.fold_left add_cancel_step r1 var_list;; + let n_tm = (rand o rand o rand o concl) result in + let r_eq_th = INST[n_tm, n_var_num] FINAL_INEQ in + let not_zero_th = NUM_EQ0_HASH_CONV n_tm in + EQ_MP not_zero_th (EQ_MP r_eq_th result);; + + + + +(**************************) + + +let precision_constant = Int 10 **/ (Int precision);; +let sum_step (name, indices, c) = + try + let ineqs = get_ineqs (hyp_list_tm, hyp_set, hyp_fun) std_flag precision name indices in + let s1 = map transform_le_ineq (zip ineqs c) in + List.fold_left add_step' dummy s1 + with + | Failure str -> failwith (sprintf "Problem: %s (%s)" name str) + | _ -> failwith ("Problem: "^name);; + +let s1' = List.fold_left add_step' dummy (map sum_step constraints);; +let s1 = mul_step s1' (mk_real_int precision_constant);; +let s2 = List.fold_left add_step' dummy (map sum_step target_variables);; +let s3 = List.fold_left add_step' dummy (map sum_step variable_bounds);; +let s4 = add_step' s1 (add_step' s2 s3);; + +let ineq_th0 = assoc precision lnsum_ineqs;; +let ineq_th1 = (INST[hyp_list_tm, l_cap_var]) ineq_th0;; +let ineq_th2 = EQ_MP (term_rewrite (concl ineq_th1) (hyp_set "list_of_elements")) ineq_th1;; +let ineq_th3 = simplify_ineq hyp_fun ineq_th2;; +let ineq_th4 = to_lin_f_ineq ineq_th3;; + +let result = add_step' ineq_th4 s4;; + +let n_tm = (rand o rand o rand o concl) result;; +let r_eq_th = INST[n_tm, n_var_num] FINAL_INEQ;; +let not_zero_th = NUM_EQ0_HASH_CONV n_tm;; +EQ_MP not_zero_th (EQ_MP r_eq_th result);; + diff --git a/formal_lp/hypermap/ssreflect/add_triangle-compiled.hl b/formal_lp/hypermap/ssreflect/add_triangle-compiled.hl new file mode 100644 index 0000000..ea5ad81 --- /dev/null +++ b/formal_lp/hypermap/ssreflect/add_triangle-compiled.hl @@ -0,0 +1,1477 @@ +needs "fan/hypermap_iso-compiled.hl";; +needs "tame/tame_defs.hl";; + +(* Module Add_triangle*) +module Add_triangle = struct + +open Ssrbool;; +open Ssrnat;; +open Fan_defs;; +open Hypermap_and_fan;; +open Conforming;; +open Hypermap;; +open Hypermap_iso;; +let split_fan_face = new_definition + `split_fan_face (V,E) (v,w) = (V, {w, sigma_fan (vec 0) V E v w} INSERT E)`;; + +(* Lemma BIJ_IMAGE *) +let BIJ_IMAGE = Sections.section_proof ["f";"s";"t"] +`BIJ f s t ==> t = IMAGE f s` +[ + (((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (move ["h"])) THEN ((use_arg_then2 ("Misc_defs_and_lemmas.SURJ_IMAGE", [Misc_defs_and_lemmas.SURJ_IMAGE])) (thm_tac apply_tac)) THEN (done_tac)); +];; +let FACE_NODE_EDGE_ORBIT_INVERSE = + prove(`face (H:(A) hypermap) x = orbit_map ( inverse (face_map H )) x /\ + node H x = orbit_map (inverse ( node_map H)) x /\ + edge H x = orbit_map (inverse ( edge_map H )) x `, + MP_TAC (SPEC_ALL hypermap_lemma) THEN + SIMP_TAC[face;node;edge] THEN + MESON_TAC[lemma_card_inverse_map_eq]);; +let SING_UNION_EQ_INSERT = prove(`!s x:A. {x} UNION s = x INSERT s`, SET_TAC[]);; + +(* Section FanMisc *) +Sections.begin_section "FanMisc";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; + +(* Lemma orbit_map_le3 *) +let orbit_map_le3 = Sections.section_proof ["f";"x"] +`f (f (f x)) = x ==> orbit_map f x = {x, f x, f (f x)}` +[ + (BETA_TAC THEN (move ["fff_eq"])); + ((fun arg_tac -> arg_tac (Arg_term (`(f POWER 3) x = x`))) (term_tac (have_gen_tac [](move ["power_eq"])))); + (((((use_arg_then2 ("THREE", [THREE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("TWO", [TWO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("POWER", [POWER]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) (((fun arg_tac -> (use_arg_then2 ("orbit_cyclic", [orbit_cyclic])) (fun fst_arg -> (use_arg_then2 ("power_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["y"])); + ((THENL) (split_tac) [((case THEN (move ["k"])) THEN (case THEN (move ["k_lt"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); ALL_TAC]); + (((THENL) (((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN ((use_arg_then2 ("k", [])) (disch_tac [])) THEN (clear_assumption "k") THEN case) [ALL_TAC; ((THENL) case [ALL_TAC; ((THENL) case [ALL_TAC; (move ["k"])])])]) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("POWER", [POWER]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("o_THM", [o_THM]))(fun tmp_arg1 -> (use_arg_then2 ("I_THM", [I_THM]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); + (((THENL) ((repeat_tactic 1 9 (case)) THEN (BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) [((fun arg_tac -> arg_tac (Arg_term (`0`))) (term_tac exists_tac)); ((fun arg_tac -> arg_tac (Arg_term (`SUC 0`))) (term_tac exists_tac)); ((fun arg_tac -> arg_tac (Arg_term (`SUC (SUC 0)`))) (term_tac exists_tac))]) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("POWER", [POWER]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("o_THM", [o_THM]))(fun tmp_arg1 -> (use_arg_then2 ("I_THM", [I_THM]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma power_res *) +let power_res = Sections.section_proof ["f";"s";"i";"x"] +`x IN s /\ (!y. y IN s ==> f y IN s) + ==> (res f s POWER i) x = (f POWER i) x` +[ + (BETA_TAC THEN (case THEN ((move ["xs"]) THEN (move ["f_in_s"])))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ORBIT_SUBSET_LEMMA", [ORBIT_SUBSET_LEMMA])) (fun fst_arg -> (use_arg_then2 ("xs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_in_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["orbit_s"]))); + (((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN elim) [ALL_TAC; ((move ["i"]) THEN (move ["Ih"]))]) THEN ((repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("POWER_0", [POWER_0]))(fun tmp_arg1 -> (use_arg_then2 ("COM_POWER", [COM_POWER]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`_ IN s`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((ALL_TAC) THEN (done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("IN_TRANS", [IN_TRANS])) (fun fst_arg -> (use_arg_then2 ("orbit_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lemma_in_orbit", [lemma_in_orbit]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma contracted_ext *) +let contracted_ext = Sections.section_proof ["d"] +`contracted_dart (ext_dart (V,E) d) = d` +[ + ((((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"])) THEN ((((use_arg_then2 ("ext_dart", [ext_dart]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("contracted_dart", [contracted_dart]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma in_dart1_in_dart *) +let in_dart1_in_dart = Sections.section_proof ["d"] +`d IN dart1_of_fan (V,E) ==> d IN dart_of_fan (V,E)` +[ + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DART1_OF_FAN_SUBSET_DART_OF_FAN", [DART1_OF_FAN_SUBSET_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("E", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (exact_tac) THEN (done_tac)); +];; + +(* Lemma in_d1_in_d *) +let in_d1_in_d = Sections.section_proof ["d"] +`d IN d1_fan (vec 0,V,E) ==> d IN d_fan (vec 0,V,E)` +[ + ((BETA_TAC THEN (move ["d_in"])) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Fan.subset_d_fan", [Fan.subset_d_fan])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("E", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC)); + (((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma inE_eq_in_dart1 *) +let inE_eq_in_dart1 = Sections.section_proof ["v";"w"] +`{v,w} IN E <=> v,w IN dart1_of_fan (V,E)` +[ + (((((use_arg_then2 ("dart1_of_fan", [dart1_of_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((THENL) (split_tac) [(move ["inE"]); ((case THEN (move ["v'"])) THEN (case THEN (move ["w'"])) THEN (case THEN (move ["inE"])))])); + ((((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("w", [])) (term_tac exists_tac))) THEN (done_tac)); + (((((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac)); +];; + +(* Lemma inE_imp_in_dart *) +let inE_imp_in_dart = Sections.section_proof ["v";"w"] +`{v,w} IN E ==> v,w IN dart_of_fan (V,E)` +[ + (((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(thm_tac (new_rewrite [] [])))); + ((((fun arg_tac -> arg_tac (Arg_term (`(v,w)`))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("SUBSET", [SUBSET]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("DART1_OF_FAN_SUBSET_DART_OF_FAN", [DART1_OF_FAN_SUBSET_DART_OF_FAN]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dart1_switch *) +let dart1_switch = Sections.section_proof ["v";"w"] +`v,w IN dart1_of_fan (V,E) <=> w,v IN dart1_of_fan (V,E)` +[ + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`!v w. v,w IN dart1_of_fan (V,E) ==> w,v IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["h"]))))); + (((split_tac) THEN (move ["c"])) THEN (((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN (exact_tac)) THEN (done_tac)); + ((BETA_TAC THEN (move ["v"]) THEN (move ["w"])) THEN ((((use_arg_then2 ("dart1_of_fan", [dart1_of_fan]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))))); + (BETA_TAC THEN (case THEN (move ["v'"])) THEN (case THEN (move ["w'"])) THEN (case THEN (move ["h"])) THEN (move ["eq"])); + ((((use_arg_then2 ("w'", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("v'", [])) (term_tac exists_tac))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Collect_geom.PER_SET2)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma dart_switch *) +let dart_switch = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) <=> w,v IN dart_of_fan (V,E)` +[ + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`!v w. v,w IN dart_of_fan (V,E) ==> w,v IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["h"]))))); + (((split_tac) THEN (move ["c"])) THEN (((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN (exact_tac)) THEN (done_tac)); + ((BETA_TAC THEN (move ["v"]) THEN (move ["w"])) THEN ((((use_arg_then2 ("dart_of_fan", [dart_of_fan]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))))); + ((THENL) case [((case THEN (move ["v'"])) THEN (case THEN (move ["h"])) THEN (move ["eq"])); ((case THEN (move ["v'"])) THEN (case THEN (move ["w'"])) THEN (case THEN (move ["h"])) THEN (move ["eq"]))]); + ((DISJ1_TAC) THEN ((use_arg_then2 ("v'", [])) (term_tac exists_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((DISJ2_TAC) THEN (((use_arg_then2 ("w'", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("v'", [])) (term_tac exists_tac))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Collect_geom.PER_SET2)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; +(Sections.add_section_hyp "fanV" (`FAN (vec 0, V, E)`));; + +(* Lemma finite_dart1 *) +let finite_dart1 = Sections.section_proof [] +`FINITE (dart1_of_fan (V,E))` +[ + (((fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DART1_OF_FAN_SUBSET_DART_OF_FAN", [DART1_OF_FAN_SUBSET_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("E", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((((fun arg_tac -> (use_arg_then2 ("FINITE_DART_OF_FAN", [FINITE_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma f_fan_pair_power *) +let f_fan_pair_power = Sections.section_proof ["d";"i"] +`d IN dart1_of_fan (V,E) + ==> (f_fan_pair (V,E) POWER i) d = (f_fan_pair_ext (V,E) POWER i) d` +[ + (BETA_TAC THEN (move ["d_in"])); + (((((use_arg_then2 ("F_FAN_PAIR_EXT", [F_FAN_PAIR_EXT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("power_res", [power_res]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("d_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["y"]) THEN (move ["y_in"])); + ((((use_arg_then2 ("E_N_F_IN_DART1_OF_FAN", [E_N_F_IN_DART1_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma fst_node_hypermap_of_fan *) +let fst_node_hypermap_of_fan = Sections.section_proof ["x";"y"] +`x IN node (hypermap_of_fan (V,E)) y + ==> FST x = FST y` +[ + (BETA_TAC THEN (move ["x_in"])); + (((fun arg_tac -> (use_arg_then2 ("FAN_NODE_EQ_lemma", [FAN_NODE_EQ_lemma])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("Hypermap.lemma_node_identity", [Hypermap.lemma_node_identity])) (thm_tac apply_tac)) THEN (done_tac)); +];; + +(* Lemma fan_node_eq_fst *) +let fan_node_eq_fst = Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) + ==> node (hypermap_of_fan (V,E)) d = {x | x IN dart_of_fan (V,E) /\ FST x = FST d}` +[ + ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (move ["d_in"]) THEN (move ["y"])) THEN ((THENL) (split_tac) [(move ["y_in"]); (case THEN ((move ["y_in"]) THEN (move ["fst_eq"])))])); + ((((fun arg_tac -> (use_arg_then2 ("fst_node_hypermap_of_fan", [fst_node_hypermap_of_fan])) (fun fst_arg -> (use_arg_then2 ("y_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("IN_TRANS", [IN_TRANS])) (fun fst_arg -> (use_arg_then2 ("y_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("NODE_SUBSET_DART_OF_FAN", [NODE_SUBSET_DART_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((fun arg_tac -> (use_arg_then2 ("HYPERMAP_OF_FAN_NODE_EQ", [HYPERMAP_OF_FAN_NODE_EQ])) (fun fst_arg -> (use_arg_then2 ("fst_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("node_refl", [node_refl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma finite_set_of_edge *) +let finite_set_of_edge = Sections.section_proof ["v"] +`FINITE (set_of_edge v V E)` +[ + (((use_arg_then2 ("Fan.remark_finite_fan1", [Fan.remark_finite_fan1]))(thm_tac (new_rewrite [] [])))); + ((in_tac ["fanV"] false ((((use_arg_then2 ("FAN", [FAN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fan1", [fan1]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma azim_dart1_eq_azim_fan *) +let azim_dart1_eq_azim_fan = Sections.section_proof ["v";"w"] +`v,w IN dart1_of_fan (V,E) + ==> azim_dart (V,E) (v,w) = azim_fan (vec 0) V E v w` +[ + ((((use_arg_then2 ("azim_dart", [azim_dart]))(thm_tac (new_rewrite [] [])))) THEN (move ["vw_in"])); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ", [PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma azim_dart_eq_azim_fan *) +let azim_dart_eq_azim_fan = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + ==> azim_dart (V,E) (v,w) = azim_fan (vec 0) V E v w` +[ + (((((use_arg_then2 ("Hypermap_iso.dart_of_fan_eq", [Hypermap_iso.dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN ((THENL) case [(move ["vw_in"]); ALL_TAC])); + ((((use_arg_then2 ("azim_dart1_eq_azim_fan", [azim_dart1_eq_azim_fan]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["y"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["yV"])) THEN (move ["h"])) THEN ((((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (move ["eq"]))); + (((repeat_tactic 1 9 (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("azim_dart", [azim_dart]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("azim_fan", [azim_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CARD_CLAUSES", [CARD_CLAUSES]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma azim_dart1_eq_azim *) +let azim_dart1_eq_azim = Sections.section_proof ["v";"w"] +`v,w IN dart1_of_fan (V,E) /\ CARD (set_of_edge v V E) > 1 + ==> azim_dart (V,E) (v,w) = azim (vec 0) v w (sigma_fan (vec 0) V E v w)` +[ + (BETA_TAC THEN (case THEN ((move ["vw_in"]) THEN (move ["c_gt1"])))); + (((((use_arg_then2 ("azim_dart1_eq_azim_fan", [azim_dart1_eq_azim_fan]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("azim_fan", [azim_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("c_gt1", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fully_surrounded_dart_of_fan_eq *) +let fully_surrounded_dart_of_fan_eq = Sections.section_proof [] +`fully_surrounded (V,E) ==> dart_of_fan (V,E) = dart1_of_fan (V,E)` +[ + (((((use_arg_then2 ("FULLY_SURROUNDED", [FULLY_SURROUNDED]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SUBSET_ANTISYM_EQ", [SUBSET_ANTISYM_EQ]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["h"])); + ((((use_arg_then2 ("DART1_OF_FAN_SUBSET_DART_OF_FAN", [DART1_OF_FAN_SUBSET_DART_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))); + ((case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["in_dart"])) THEN (((use_arg_then2 ("SURROUNDED_IMP_IN_DART1_OF_FAN", [SURROUNDED_IMP_IN_DART1_OF_FAN])) (disch_tac [])) THEN (clear_assumption "SURROUNDED_IMP_IN_DART1_OF_FAN") THEN (DISCH_THEN apply_tac))); + (((((use_arg_then2 ("fanV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_dart", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("in_dart", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fully_surrounded_card_set_of_edge *) +let fully_surrounded_card_set_of_edge = Sections.section_proof ["v"] +`fully_surrounded (V,E) /\ v IN V ==> CARD (set_of_edge v V E) >= 3` +[ + (((((use_arg_then2 ("FULLY_SURROUNDED", [FULLY_SURROUNDED]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ALL_TAC THEN (case THEN ((move ["h"]) THEN (move ["vV"])))); + (((use_arg_then2 ("SURROUNDED_IMP_CARD_SET_OF_EDGE_GE_3", [SURROUNDED_IMP_CARD_SET_OF_EDGE_GE_3])) (disch_tac [])) THEN (clear_assumption "SURROUNDED_IMP_CARD_SET_OF_EDGE_GE_3") THEN (DISCH_THEN apply_tac)); + (((((use_arg_then2 ("fanV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fully_surrounded_card_set_of_edge1 *) +let fully_surrounded_card_set_of_edge1 = Sections.section_proof ["v"] +`fully_surrounded (V,E) /\ v IN V ==> CARD (set_of_edge v V E) > 1` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("fully_surrounded_card_set_of_edge", [fully_surrounded_card_set_of_edge])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma fully_surrounded_azim_dart_eq_azim *) +let fully_surrounded_azim_dart_eq_azim = Sections.section_proof ["v";"w"] +`fully_surrounded (V,E) /\ (v,w) IN dart_of_fan (V,E) + ==> azim_dart (V,E) (v,w) = azim (vec 0) v w (sigma_fan (vec 0) V E v w)` +[ + (BETA_TAC THEN (case THEN ((move ["f_surr"]) THEN (move ["vw_in"])))); + ((((use_arg_then2 ("azim_dart1_eq_azim", [azim_dart1_eq_azim]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("fully_surrounded_card_set_of_edge1", [fully_surrounded_card_set_of_edge1]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma azim_gt0_card_set_of_edge *) +let azim_gt0_card_set_of_edge = Sections.section_proof ["v";"w"] +`{v,w} IN E /\ &0 < azim (vec 0) v w (sigma_fan (vec 0) V E v w) + ==> CARD (set_of_edge v V E) > 1` +[ + ((((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["vw_in"]))); + ((((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("REAL_NOT_LT", [REAL_NOT_LT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("GT", [GT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_LT", [NOT_LT]))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `!x. x <= 1 <=> x = 0 \/ x = 1`)))(thm_tac (new_rewrite [] [])))) THEN case); + (((((use_arg_then2 ("CARD_EQ_0", [CARD_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("finite_set_of_edge", [finite_set_of_edge]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["h"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN", [PAIR_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["c1"])) THEN (((use_arg_then2 ("sigma_fan", [sigma_fan]))(thm_tac (new_rewrite [] []))))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`set_of_edge v V E = {w}`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac)))))); + (((((use_arg_then2 ("AZIM_REFL", [AZIM_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((use_arg_then2 ("Hypermap.set_one_point", [Hypermap.set_one_point])) (thm_tac apply_tac)); + (((((use_arg_then2 ("finite_set_of_edge", [finite_set_of_edge]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN", [PAIR_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fully_surrounded_imp_fan80 *) +let fully_surrounded_imp_fan80 = Sections.section_proof [] +`fully_surrounded (V,E) ==> fan80 (vec 0,V,E)` +[ + ((((use_arg_then2 ("Planarity.fan80", [Planarity.fan80]))(thm_tac (new_rewrite [] [])))) THEN (move ["h"]) THEN (move ["v"]) THEN (move ["u"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("inE_imp_in_dart", [inE_imp_in_dart])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["vu_in"])); + ((((use_arg_then2 ("fully_surrounded_azim_dart_eq_azim", [fully_surrounded_azim_dart_eq_azim]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("AZIM_DART_POS", [AZIM_DART_POS]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((in_tac ["h"] false (((use_arg_then2 ("fully_surrounded", [fully_surrounded]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma sigma_fan_inV *) +let sigma_fan_inV = Sections.section_proof ["v";"w"] +`v,w IN dart1_of_fan (V,E) + ==> sigma_fan (vec 0) V E v w IN V` +[ + ((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN", [PAIR_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["h"])); + (((use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`set_of_edge v V E`))) (term_tac exists_tac))); + (((((use_arg_then2 ("Fan.sigma_fan_in_set_of_edge", [Fan.sigma_fan_in_set_of_edge]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("Planarity.set_of_edge_subset_edges", [Planarity.set_of_edge_subset_edges]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sigma_fan_not_fixed *) +let sigma_fan_not_fixed = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) /\ fully_surrounded (V,E) + ==> ~(sigma_fan (vec 0) V E v w = w)` +[ + (BETA_TAC THEN (case THEN ((move ["vw_in"]) THEN (move ["f_surr"])))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Fan.SIGMA_FAN", [Fan.SIGMA_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN", [PAIR_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_card_set_of_edge1", [fully_surrounded_card_set_of_edge1])) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("Hypermap.CARD_SINGLETON", [Hypermap.CARD_SINGLETON]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Section Hypermap1 *) +Sections.begin_section "Hypermap1";; + +(* Lemma inv_e_fan_pair_ext *) +let inv_e_fan_pair_ext = Sections.section_proof [] +`inverse (e_fan_pair_ext (V,E)) = e_fan_pair_ext (V,E)` +[ + ((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["a"]) THEN (move ["b"])))); + ((((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSE_EQ", [PERMUTES_INVERSE_EQ])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dart_of_fan (V,E)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("E_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [E_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`a,b IN dart1_of_fan (V,E)`))) (disch_eq_tac "ab_in" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((repeat_tactic 1 9 (((use_arg_then2 ("e_fan_pair_ext", [e_fan_pair_ext]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ab_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("e_fan_pair", [e_fan_pair]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then2 ("e_fan_pair_ext", [e_fan_pair_ext]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ab_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("ab_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma bij_ext_dart *) +let bij_ext_dart = Sections.section_proof [] +`BIJ (ext_dart (V,E)) (dart_of_fan (V,E)) (d_fan (vec 0,V,E))` +[ + (((fun arg_tac -> (use_arg_then2 ("bij_ext", [bij_ext])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`res_inv contracted_dart (d_fan (vec 0,V,E))`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac)) THEN (split_tac)); + ((BETA_TAC THEN (move ["x"]) THEN (move ["x_in"])) THEN (((use_arg_then2 ("ext_dart_eq_inv_contracted_dart", [ext_dart_eq_inv_contracted_dart]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((use_arg_then2 ("bij_res_inv", [bij_res_inv])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("bij_contracted_dart", [bij_contracted_dart]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma d_fan_eq_image *) +let d_fan_eq_image = Sections.section_proof [] +`d_fan (vec 0,V,E) = IMAGE (ext_dart (V,E)) (dart_of_fan (V,E))` +[ + ((((fun arg_tac -> (use_arg_then2 ("BIJ_IMAGE", [BIJ_IMAGE])) (fun fst_arg -> (use_arg_then2 ("bij_ext_dart", [bij_ext_dart])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma contracted_in_dart *) +let contracted_in_dart = Sections.section_proof ["d"] +`d IN d_fan (vec 0,V,E) + ==> contracted_dart d IN dart_of_fan (V,E)` +[ + (((((use_arg_then2 ("d_fan_eq_image", [d_fan_eq_image]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["x_in"])); + ((((use_arg_then2 ("contracted_ext", [contracted_ext]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma ext_contracted *) +let ext_contracted = Sections.section_proof ["d"] +`d IN d_fan (vec 0,V,E) + ==> ext_dart (V,E) (contracted_dart d) = d` +[ + (BETA_TAC THEN (move ["d_in"])); + ((((fun arg_tac -> (use_arg_then2 ("ext_dart_eq_inv_contracted_dart", [ext_dart_eq_inv_contracted_dart])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("contracted_in_dart", [contracted_in_dart]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("res_inv_left", [res_inv_left]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("d_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN (move ["x_in"])) THEN (case THEN (move ["y_in"])) THEN (move ["eq"])); + (((fun arg_tac -> (use_arg_then2 ("bij_contracted_dart", [bij_contracted_dart])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["_"])) THEN ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ext_dart_eq_inv_contracted_dart1 *) +let ext_dart_eq_inv_contracted_dart1 = Sections.section_proof ["d"] +`d IN dart1_of_fan (V,E) + ==> ext_dart (V,E) d = res_inv contracted_dart (d1_fan (vec 0,V,E)) d` +[ + ((((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"])) THEN ((((use_arg_then2 ("ext_dart", [ext_dart]))(thm_tac (new_rewrite [] [])))) THEN (move ["vw_in"]))); + ((fun arg_tac -> arg_tac (Arg_term (`extension_sigma_fan _ V E v w`))) (term_tac (set_tac "w1"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`(v,w) = contracted_dart (vec 0:real^3,v,w,w1:real^3)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("contracted_dart", [contracted_dart]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((((use_arg_then2 ("res_inv_left", [res_inv_left]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((THENL) (split_tac) [((move ["x"]) THEN (move ["y"]) THEN (move ["h"])); ALL_TAC])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("bij_contracted_dart1", [bij_contracted_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("E", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["_"])) THEN (move ["h2"]) THEN (move ["_"])) THEN (((use_arg_then2 ("h2", [])) (disch_tac [])) THEN (clear_assumption "h2") THEN (DISCH_THEN apply_tac)) THEN (done_tac)); + ((((use_arg_then2 ("w1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("extension_sigma_fan", [extension_sigma_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Fan.d1_fan", [Fan.d1_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`w IN set_of_edge v V E`))) (disch_eq_tac "w_in" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("w", [])) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E v w`))) (term_tac exists_tac))) THEN (simp_tac)); + ((((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("w_in", [])) (disch_tac [])) THEN (clear_assumption "w_in") THEN BETA_TAC) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN", [PAIR_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma bij_ext_dart1 *) +let bij_ext_dart1 = Sections.section_proof [] +`BIJ (ext_dart (V,E)) (dart1_of_fan (V,E)) (d1_fan (vec 0,V,E))` +[ + (((fun arg_tac -> (use_arg_then2 ("bij_ext", [bij_ext])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`res_inv contracted_dart (d1_fan (vec 0,V,E))`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac)) THEN (split_tac)); + ((BETA_TAC THEN (move ["x"]) THEN (move ["x_in"])) THEN (((use_arg_then2 ("ext_dart_eq_inv_contracted_dart1", [ext_dart_eq_inv_contracted_dart1]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((use_arg_then2 ("bij_res_inv", [bij_res_inv])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("bij_contracted_dart1", [bij_contracted_dart1]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma d1_fan_eq_image *) +let d1_fan_eq_image = Sections.section_proof [] +`d1_fan (vec 0,V,E) = IMAGE (ext_dart (V,E)) (dart1_of_fan (V,E))` +[ + ((((fun arg_tac -> (use_arg_then2 ("BIJ_IMAGE", [BIJ_IMAGE])) (fun fst_arg -> (use_arg_then2 ("bij_ext_dart1", [bij_ext_dart1])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma contracted_in_dart1 *) +let contracted_in_dart1 = Sections.section_proof ["d"] +`d IN d1_fan (vec 0,V,E) + ==> contracted_dart d IN dart1_of_fan (V,E)` +[ + (((((use_arg_then2 ("d1_fan_eq_image", [d1_fan_eq_image]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["x_in"])); + ((((use_arg_then2 ("contracted_ext", [contracted_ext]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma dart_of_fan_eq_image *) +let dart_of_fan_eq_image = Sections.section_proof [] +`dart_of_fan (V,E) = IMAGE contracted_dart (d_fan (vec 0,V,E))` +[ + ((((fun arg_tac -> (use_arg_then2 ("BIJ_IMAGE", [BIJ_IMAGE])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("bij_contracted_dart", [bij_contracted_dart])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma ext_in_dart *) +let ext_in_dart = Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) + ==> ext_dart (V,E) d IN d_fan (vec 0,V,E)` +[ + (((((use_arg_then2 ("dart_of_fan_eq_image", [dart_of_fan_eq_image]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["x_in"])); + ((((use_arg_then2 ("ext_contracted", [ext_contracted]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma ext_in_dart1 *) +let ext_in_dart1 = Sections.section_proof ["d"] +`d IN dart1_of_fan (V,E) + ==> ext_dart (V,E) d IN d1_fan (vec 0,V,E)` +[ + (((((use_arg_then2 ("dart1_of_fan_eq_image", [dart1_of_fan_eq_image]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["x_in"])); + (((((use_arg_then2 ("ext_contracted", [ext_contracted]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("in_d1_in_d", [in_d1_in_d]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Dart1 *) +Sections.begin_section "Dart1";; + +(* Lemma fan_hypermap_map2 *) +let fan_hypermap_map2 = Sections.section_proof ["d"] +`d IN d1_fan (vec 0,V,E) + ==> face_map (hypermap1_of_fanx (vec 0,V,E)) d = f1_fan (vec 0) V E d /\ + node_map (hypermap1_of_fanx (vec 0,V,E)) d = n_fan (vec 0) V E d /\ + edge_map (hypermap1_of_fanx (vec 0,V,E)) d = e_fan (vec 0) V E d` +[ + ((BETA_TAC THEN (move ["d_in"])) THEN ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("hypermap_of_fan_rep_alt", [hypermap_of_fan_rep_alt])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (done_tac)); +];; + +(* Lemma fan_hypermap_map1 *) +let fan_hypermap_map1 = Sections.section_proof ["d"] +`d IN dart1_of_fan (V,E) ==> + face_map (hypermap_of_fan (V,E)) d = f_fan_pair (V,E) d /\ + node_map (hypermap_of_fan (V,E)) d = n_fan_pair (V,E) d /\ + edge_map (hypermap_of_fan (V,E)) d = e_fan_pair (V,E) d` +[ + ((BETA_TAC THEN (move ["d_in"])) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_fan_pair_ext", [n_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_fan_pair_ext", [e_fan_pair_ext]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma f_fan_pair_eq_inv_n_o_e *) +let f_fan_pair_eq_inv_n_o_e = Sections.section_proof ["d"] +`d IN dart1_of_fan (V,E) + ==> f_fan_pair (V,E) d = inverse (n_fan_pair_ext (V,E)) (e_fan_pair (V,E) d)` +[ + (BETA_TAC THEN (move ["d_in"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`f_fan_pair (V,E) d = f_fan_pair_ext (V,E) d`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL PERMUTES_INVERSE_INVERSE))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dart_of_fan (V,E)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((THENL_ROT (-1)) ((((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT", [INVERSE_F_FAN_PAIR_EXT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("PERMUTATION_INVERSE_COMPOSE", [PERMUTATION_INVERSE_COMPOSE]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("inv_e_fan_pair_ext", [inv_e_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_fan_pair_ext", [e_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (repeat_tactic 1 9 (((use_arg_then2 ("PERMUTATION_PERMUTES", [PERMUTATION_PERMUTES]))(thm_tac (new_rewrite [] []))))); + ((split_tac) THEN ((fun arg_tac -> arg_tac (Arg_term (`dart_of_fan (V,E)`))) (term_tac exists_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("FINITE_DART_OF_FAN", [FINITE_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac ->(use_arg_then2 ("E_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [E_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN]))(fun tmp_arg1 -> (use_arg_then2 ("N_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [N_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma fan_map_contracted *) +let fan_map_contracted = Sections.section_proof ["d"] +`d IN d1_fan (vec 0,V,E) ==> + f_fan_pair (V,E) (contracted_dart d) = contracted_dart (f1_fan (vec 0) V E d) /\ + n_fan_pair (V,E) (contracted_dart d) = contracted_dart (n_fan (vec 0) V E d) /\ + e_fan_pair (V,E) (contracted_dart d) = contracted_dart (e_fan (vec 0) V E d)` +[ + (BETA_TAC THEN (move ["d_in"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_comm", [hyp_iso_comm])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("fan_hypermaps_iso_explicit", [fan_hypermaps_iso_explicit])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)); + (((((fun arg_tac -> (use_arg_then2 ("hypermap_of_fan_rep_alt", [hypermap_of_fan_rep_alt])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_d1_in_d", [in_d1_in_d]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then2 ("fan_hypermap_map2", [fan_hypermap_map2]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("fan_hypermap_map1", [fan_hypermap_map1]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("contracted_in_dart1", [contracted_in_dart1]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))) THEN (done_tac)); +];; + +(* Lemma fan_map_ext *) +let fan_map_ext = Sections.section_proof ["d"] +`d IN dart1_of_fan (V,E) ==> + f1_fan (vec 0) V E (ext_dart (V,E) d) = ext_dart (V,E) (f_fan_pair (V,E) d) /\ + n_fan (vec 0) V E (ext_dart (V,E) d) = ext_dart (V,E) (n_fan_pair (V,E) d) /\ + e_fan (vec 0) V E (ext_dart (V,E) d) = ext_dart (V,E) (e_fan_pair (V,E) d)` +[ + (BETA_TAC THEN (move ["d_in"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_comm", [hyp_iso_comm])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("fan_hypermaps_iso_explicit2", [fan_hypermaps_iso_explicit2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)); + (((((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_dart1_in_dart", [in_dart1_in_dart]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then2 ("fan_hypermap_map1", [fan_hypermap_map1]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("fan_hypermap_map2", [fan_hypermap_map2]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ext_in_dart1", [ext_in_dart1]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))) THEN (done_tac)); +];; + +(* Finalization of the section Dart1 *) +let fan_hypermap_map2 = Sections.finalize_theorem fan_hypermap_map2;; +let fan_hypermap_map1 = Sections.finalize_theorem fan_hypermap_map1;; +let f_fan_pair_eq_inv_n_o_e = Sections.finalize_theorem f_fan_pair_eq_inv_n_o_e;; +let fan_map_contracted = Sections.finalize_theorem fan_map_contracted;; +let fan_map_ext = Sections.finalize_theorem fan_map_ext;; +Sections.end_section "Dart1";; + +(* Finalization of the section Hypermap1 *) +let inv_e_fan_pair_ext = Sections.finalize_theorem inv_e_fan_pair_ext;; +let bij_ext_dart = Sections.finalize_theorem bij_ext_dart;; +let d_fan_eq_image = Sections.finalize_theorem d_fan_eq_image;; +let contracted_in_dart = Sections.finalize_theorem contracted_in_dart;; +let ext_contracted = Sections.finalize_theorem ext_contracted;; +let ext_dart_eq_inv_contracted_dart1 = Sections.finalize_theorem ext_dart_eq_inv_contracted_dart1;; +let bij_ext_dart1 = Sections.finalize_theorem bij_ext_dart1;; +let d1_fan_eq_image = Sections.finalize_theorem d1_fan_eq_image;; +let contracted_in_dart1 = Sections.finalize_theorem contracted_in_dart1;; +let dart_of_fan_eq_image = Sections.finalize_theorem dart_of_fan_eq_image;; +let ext_in_dart = Sections.finalize_theorem ext_in_dart;; +let ext_in_dart1 = Sections.finalize_theorem ext_in_dart1;; +let fan_hypermap_map2 = Sections.finalize_theorem fan_hypermap_map2;; +let fan_hypermap_map1 = Sections.finalize_theorem fan_hypermap_map1;; +let f_fan_pair_eq_inv_n_o_e = Sections.finalize_theorem f_fan_pair_eq_inv_n_o_e;; +let fan_map_contracted = Sections.finalize_theorem fan_map_contracted;; +let fan_map_ext = Sections.finalize_theorem fan_map_ext;; +Sections.end_section "Hypermap1";; + +(* Finalization of the section FanMisc *) +let orbit_map_le3 = Sections.finalize_theorem orbit_map_le3;; +let power_res = Sections.finalize_theorem power_res;; +let contracted_ext = Sections.finalize_theorem contracted_ext;; +let in_dart1_in_dart = Sections.finalize_theorem in_dart1_in_dart;; +let in_d1_in_d = Sections.finalize_theorem in_d1_in_d;; +let inE_eq_in_dart1 = Sections.finalize_theorem inE_eq_in_dart1;; +let inE_imp_in_dart = Sections.finalize_theorem inE_imp_in_dart;; +let dart1_switch = Sections.finalize_theorem dart1_switch;; +let dart_switch = Sections.finalize_theorem dart_switch;; +let finite_dart1 = Sections.finalize_theorem finite_dart1;; +let f_fan_pair_power = Sections.finalize_theorem f_fan_pair_power;; +let fst_node_hypermap_of_fan = Sections.finalize_theorem fst_node_hypermap_of_fan;; +let fan_node_eq_fst = Sections.finalize_theorem fan_node_eq_fst;; +let finite_set_of_edge = Sections.finalize_theorem finite_set_of_edge;; +let azim_dart1_eq_azim_fan = Sections.finalize_theorem azim_dart1_eq_azim_fan;; +let azim_dart_eq_azim_fan = Sections.finalize_theorem azim_dart_eq_azim_fan;; +let azim_dart1_eq_azim = Sections.finalize_theorem azim_dart1_eq_azim;; +let fully_surrounded_dart_of_fan_eq = Sections.finalize_theorem fully_surrounded_dart_of_fan_eq;; +let fully_surrounded_card_set_of_edge = Sections.finalize_theorem fully_surrounded_card_set_of_edge;; +let fully_surrounded_card_set_of_edge1 = Sections.finalize_theorem fully_surrounded_card_set_of_edge1;; +let fully_surrounded_azim_dart_eq_azim = Sections.finalize_theorem fully_surrounded_azim_dart_eq_azim;; +let azim_gt0_card_set_of_edge = Sections.finalize_theorem azim_gt0_card_set_of_edge;; +let fully_surrounded_imp_fan80 = Sections.finalize_theorem fully_surrounded_imp_fan80;; +let sigma_fan_inV = Sections.finalize_theorem sigma_fan_inV;; +let sigma_fan_not_fixed = Sections.finalize_theorem sigma_fan_not_fixed;; +let inv_e_fan_pair_ext = Sections.finalize_theorem inv_e_fan_pair_ext;; +let bij_ext_dart = Sections.finalize_theorem bij_ext_dart;; +let d_fan_eq_image = Sections.finalize_theorem d_fan_eq_image;; +let contracted_in_dart = Sections.finalize_theorem contracted_in_dart;; +let ext_contracted = Sections.finalize_theorem ext_contracted;; +let ext_dart_eq_inv_contracted_dart1 = Sections.finalize_theorem ext_dart_eq_inv_contracted_dart1;; +let bij_ext_dart1 = Sections.finalize_theorem bij_ext_dart1;; +let d1_fan_eq_image = Sections.finalize_theorem d1_fan_eq_image;; +let contracted_in_dart1 = Sections.finalize_theorem contracted_in_dart1;; +let dart_of_fan_eq_image = Sections.finalize_theorem dart_of_fan_eq_image;; +let ext_in_dart = Sections.finalize_theorem ext_in_dart;; +let ext_in_dart1 = Sections.finalize_theorem ext_in_dart1;; +let fan_hypermap_map2 = Sections.finalize_theorem fan_hypermap_map2;; +let fan_hypermap_map1 = Sections.finalize_theorem fan_hypermap_map1;; +let f_fan_pair_eq_inv_n_o_e = Sections.finalize_theorem f_fan_pair_eq_inv_n_o_e;; +let fan_map_contracted = Sections.finalize_theorem fan_map_contracted;; +let fan_map_ext = Sections.finalize_theorem fan_map_ext;; +Sections.end_section "FanMisc";; + +(* Lemma pair_expand *) +let pair_expand = Sections.section_proof ["p"] +`p = FST p,SND p` +[ + ((ALL_TAC) THEN (done_tac)); +];; + +(* Section AddTriangle *) +Sections.begin_section "AddTriangle";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_hyp "fanV" (`FAN (vec 0, V, E)`));; + +(* Lemma split_fan_face_eq *) +let split_fan_face_eq = Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) + /\ CARD (face (hypermap_of_fan (V,E)) d) = 3 + ==> split_fan_face (V,E) d = (V,E)` +[ + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (case THEN ((move ["d_in"]) THEN (move ["card3"])))); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["d_in1"])))); + ((((use_arg_then2 ("CARD_FACE_GT_1", [CARD_FACE_GT_1])) (disch_tac [])) THEN (clear_assumption "CARD_FACE_GT_1") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("card3", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fanV", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE TRIANGULAR_FACE))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["f_eq"]) THEN (move ["_"]))))); + ((((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ABSORPTION", [ABSORPTION]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + (((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(thm_tac (new_rewrite [] [])))); + (((use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`face (hypermap_of_fan (V,E)) (v,w)`))) (term_tac exists_tac))); + (((((use_arg_then2 ("FACE_SUBSET_DART1_OF_FAN", [FACE_SUBSET_DART1_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 2 0 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma sigma_in_dart1 *) +let sigma_in_dart1 = Sections.section_proof ["v";"w"] +`v,w IN dart1_of_fan (V,E) + ==> (v, sigma_fan (vec 0) V E v w) IN dart1_of_fan (V,E)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("Fan.properties_of_set_of_edge_fan", [Fan.properties_of_set_of_edge_fan])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> (use_arg_then2 ("Fan.sigma_fan_in_set_of_edge", [Fan.sigma_fan_in_set_of_edge])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +];; + +(* Lemma in_face_lemma *) +let in_face_lemma = Sections.section_proof ["v";"w"] +`v,w IN dart1_of_fan (V,E) + ==> v,w IN face (hypermap_of_fan (V,E)) (v,w) + /\ sigma_fan (vec 0) V E v w, v IN face (hypermap_of_fan (V,E)) (v,w) + /\ f_fan_pair (V,E) (v,w) IN face (hypermap_of_fan (V,E)) (v,w)` +[ + (BETA_TAC THEN (move ["vw_in"])); + ((((use_arg_then2 ("Hypermap.face_refl", [Hypermap.face_refl]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE FACE_LAST_POINT))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("fan_hypermap_map1", [fan_hypermap_map1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Hypermap.lemma_in_face", [Hypermap.lemma_in_face]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma f_fan_pair_last *) +let f_fan_pair_last = Sections.section_proof ["v";"w"] +`v,w IN dart1_of_fan (V,E) + ==> f_fan_pair (V,E) (sigma_fan (vec 0) V E v w,v) = (v,w)` +[ + ((BETA_TAC THEN (move ["vw_in"])) THEN ((((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Fan_misc.INVERSE_SIGMA_FAN_EQ_INVERSE1_SIGMA_FAN", [Fan_misc.INVERSE_SIGMA_FAN_EQ_INVERSE1_SIGMA_FAN]))(gsym_then (thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((fun arg_tac -> (use_arg_then2 ("Fan.INVERSE1_SIGMA_FAN", [Fan.INVERSE1_SIGMA_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma f_fan_pair3 *) +let f_fan_pair3 = Sections.section_proof ["v";"w"] +`v,w IN dart1_of_fan (V,E) + /\ CARD (face (hypermap_of_fan (V,E)) (v,w)) = 3 + ==> f_fan_pair (V,E) (v,w) = (w, sigma_fan (vec 0) V E v w) + /\ f_fan_pair (V,E) (w, sigma_fan (vec 0) V E v w) = (sigma_fan (vec 0) V E v w, v) + /\ f_fan_pair (V,E) (sigma_fan (vec 0) V E v w, v) = (v,w) /\ + w, sigma_fan (vec 0) V E v w IN dart1_of_fan (V,E)` +[ + (BETA_TAC THEN (case THEN ((move ["vw_in"]) THEN (move ["card3"])))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE TRIANGULAR_FACE))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w1"))); + (BETA_TAC THEN (case THEN (move ["f_eq"])) THEN (case THEN ((move ["eq1"]) THEN (move ["eq2"])))); + ((fun arg_tac -> arg_tac (Arg_term (`w,w1 IN dart1_of_fan (V,E) /\ w1,v IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["in_dart"])))); + (((repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("IN_FACE_IMP_IN_DART1_OF_FAN", [IN_FACE_IMP_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("in_dart", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`{w,w1} IN E /\ {w1,v} IN E /\ {v,w} IN E /\ {w,v} IN E /\ {v,w1} IN E /\ {w1,w} IN E`))) (term_tac (have_gen_tac [](move ["inE"])))); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_dart", []))(thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((split_tac) THEN ((TRY done_tac))))) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("Fan_misc.INVERSE_SIGMA_FAN_EQ_INVERSE1_SIGMA_FAN", [Fan_misc.INVERSE_SIGMA_FAN_EQ_INVERSE1_SIGMA_FAN]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("eq1", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("eq2", []))(gsym_then (thm_tac (new_rewrite [3] []))))) THEN (((use_arg_then2 ("w1_def", []))(gsym_then (thm_tac (new_rewrite [5] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("Fan.INVERSE1_SIGMA_FAN", [Fan.INVERSE1_SIGMA_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; +(Sections.add_section_hyp "f_surr" (`fully_surrounded (V,E)`));; + +(* Let dart1_eq *) +Sections.add_section_lemma "dart1_eq" (Sections.section_proof [] +`dart_of_fan (V,E) = dart1_of_fan (V,E)` +[ + ((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Lemma fully_surrounded_card_face_alt *) +let fully_surrounded_card_face_alt = Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) + ==> CARD (face (hypermap_of_fan (V,E)) d) = 3 \/ + 3 < CARD (face (hypermap_of_fan (V,E)) d)` +[ + (BETA_TAC THEN (move ["d_in"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FULLY_SURROUNDED_IMP_CARD_FACE_GE_3", [FULLY_SURROUNDED_IMP_CARD_FACE_GE_3])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((((use_arg_then2 ("GE", [GE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_eqVlt", [leq_eqVlt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fully_surrounded_imp_conforming *) +let fully_surrounded_imp_conforming = Sections.section_proof [] +`conforming_fan (vec 0,V,E)` +[ + (((fun arg_tac -> (use_arg_then2 ("PIIJBJK", [PIIJBJK])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((((use_arg_then2 ("fully_surrounded_imp_fan80", [fully_surrounded_imp_fan80]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (move ["v"]) THEN (move ["vV"])); + ((((use_arg_then2 ("fully_surrounded_card_set_of_edge1", [fully_surrounded_card_set_of_edge1]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma fully_surrounded_diag_not_in_dart *) +let fully_surrounded_diag_not_in_dart = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + /\ 3 < CARD (face (hypermap_of_fan (V,E)) (v,w)) + ==> ~((w, sigma_fan (vec 0) V E v w) IN dart_of_fan (V,E))` +[ + (((use_arg_then2 ("v", [])) (disch_tac [])) THEN (clear_assumption "v") THEN BETA_TAC THEN (move ["u"])); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E u w`))) (term_tac (set_tac "v"))); + ((((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(gsym_then (thm_tac (new_rewrite [] []))))))); + ((BETA_TAC THEN (case THEN (move ["uw_in"]))) THEN (((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (move ["wv_in"]))); + ((((use_arg_then2 ("NOT_LT", [NOT_LT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL FACE_NODE_EDGE_ORBIT_INVERSE)))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (((use_arg_then2 ("Hypermap.card_orbit_le", [Hypermap.card_orbit_le])) (thm_tac apply_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `3 = SUC 2`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER", [POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Hypermap.POWER_2", [Hypermap.POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`{v, u} IN E`))) (term_tac (have_gen_tac [](move ["vu_in"])))); + (((((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("v_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Planarity.PROPERTIES_TRIANGLE_FAN", [Planarity.PROPERTIES_TRIANGLE_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v_def", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)); + ((((use_arg_then2 ("wv_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("uw_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vu_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fully_surrounded_imp_fan80", [fully_surrounded_imp_fan80]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); + ((BETA_TAC THEN (move ["x"]) THEN (move ["xV"])) THEN (((use_arg_then2 ("fully_surrounded_card_set_of_edge1", [fully_surrounded_card_set_of_edge1]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (BETA_TAC THEN (move ["eq"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("uw_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("v_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("vu_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((repeat_tactic 1 9 (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("wv_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma aux_lemma *) +let aux_lemma = Sections.section_proof ["v";"w"] +`let f = face (hypermap_of_fan (V,E)) (v,w) and + h = ext_dart (V,E) and + w1 = sigma_fan (vec 0) V E v w and + d2 = f_fan_pair (V,E) (v,w) in + v,w IN dart_of_fan (V,E) /\ 3 < CARD f + ==> IMAGE h f IN face_set (hypermap1_of_fanx (vec 0,V,E)) + /\ CARD (IMAGE h f) > 3 + /\ {h (w1,v), h (v,w), h d2} SUBSET (IMAGE h f) + /\ f1_fan (vec 0) V E (h (w1,v)) = h (v,w) + /\ f1_fan (vec 0) V E (h (v,w)) = h d2 + /\ ~(f1_fan (vec 0) V E (h d2) = h (w1,v)) + /\ pr2 (h (w1,v)) = w1 /\ pr2 (h (v,w)) = v /\ pr2 (h d2) = w + /\ pr3 (h (w1,v)) = v /\ pr3 (h (v,w)) = w + /\ {w1,v} IN E /\ {v,w} IN E /\ ~({w, w1} IN E) /\ ~(w1 = w)` +[ + ((CONV_TAC let_CONV) THEN (BETA_TAC THEN (case THEN ((move ["vw_in0"]) THEN (move ["card_gt3"]))))); + ((((use_arg_then2 ("vw_in0", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["vw_in"]))); + ((fun arg_tac -> (use_arg_then2 ("fan_hypermaps_iso_explicit2", [fan_hypermaps_iso_explicit2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H"))); + ((fun arg_tac -> arg_tac (Arg_term (`face H _2`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`ext_dart _`))) (term_tac (set_tac "h"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w1"))); + ((fun arg_tac -> arg_tac (Arg_term (`f_fan_pair _1 _2`))) (term_tac (set_tac "d2"))); + (BETA_TAC THEN (move ["iso"])); + ((fun arg_tac -> arg_tac (Arg_term (`dart H = dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["dart_eq"])))); + (((((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (use_arg_then2 ("in_face_lemma", [in_face_lemma])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["in_face"]))); + (in_tac ["in_face"] false ((((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w1_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2_def", []))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart H /\ w1,v IN dart H /\ d2 IN dart H`))) (term_tac (have_gen_tac [](move ["in_dart"])))); + (((split_tac) THEN ((TRY done_tac))) THEN (split_tac) THEN ((use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("f", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("in_face", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Hypermap.lemma_face_subset", [Hypermap.lemma_face_subset]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (done_tac)); + ((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("iso_components", [iso_components])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("Hypermap.lemma_in_face_set", [Hypermap.lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dart_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("CARD_IMAGE_INJ", [CARD_IMAGE_INJ]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("GT", [GT]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Hypermap.FACE_FINITE", [Hypermap.FACE_FINITE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["y"]) THEN (move ["h1"])); + ((((fun arg_tac -> (use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("h1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((split_tac) THEN ((use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`face H (v,w)`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("h1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Hypermap.lemma_face_subset", [Hypermap.lemma_face_subset]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("card_gt3", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + (((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbF", [orbF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"])); + (((THENL) (((THENL) case [ALL_TAC; (case THEN ALL_TAC)]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) [((fun arg_tac -> arg_tac (Arg_term (`w1,v`))) (term_tac exists_tac)); ((fun arg_tac -> arg_tac (Arg_term (`v,w`))) (term_tac exists_tac)); ((use_arg_then2 ("d2", [])) (term_tac exists_tac))]) THEN (done_tac)); + ((((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("fan_map_ext", [fan_map_ext]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dart_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_dart", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`f_fan_pair (V,E) (w1,v) = v,w`))) (term_tac (have_gen_tac [](move ["eq"])))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`{v,w1} IN E`))) (term_tac (have_gen_tac [](move ["in1"])))) (((((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Fan_misc.INVERSE_SIGMA_FAN_EQ_INVERSE1_SIGMA_FAN", [Fan_misc.INVERSE_SIGMA_FAN_EQ_INVERSE1_SIGMA_FAN]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("w1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("Fan.INVERSE1_SIGMA_FAN", [Fan.INVERSE1_SIGMA_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL_ROT (-1)) (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac))); + ((((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ext_dart", [ext_dart]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("Fan.pr2", [Fan.pr2]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("Fan.pr3", [Fan.pr3]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((((use_arg_then2 ("dart_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w1_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((fun arg_tac -> (use_arg_then2 ("fully_surrounded_diag_not_in_dart", [fully_surrounded_diag_not_in_dart])) (fun fst_arg -> (use_arg_then2 ("vw_in0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sigma_fan_not_fixed", [sigma_fan_not_fixed]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("card_gt3", [])) (disch_tac [])) THEN (clear_assumption "card_gt3") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("NOT_LT", [NOT_LT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h_def", []))(thm_tac (new_rewrite [] [])))))); + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((THENL) (ANTS_TAC) [ALL_TAC; (move ["eq2"])])); + (((((use_arg_then2 ("in_dart", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("E_N_F_IN_DART1_OF_FAN", [E_N_F_IN_DART1_OF_FAN]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("face", [face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Hypermap.card_orbit_le", [Hypermap.card_orbit_le]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `3 = SUC 2`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER", [POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Hypermap.POWER_2", [Hypermap.POWER_2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("fan_hypermap_map1", [fan_hypermap_map1])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("E_N_F_IN_DART1_OF_FAN", [E_N_F_IN_DART1_OF_FAN]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("eq2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma fan_split_fan_face *) +let fan_split_fan_face = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + ==> FAN (vec 0, split_fan_face (V,E) (v,w)) + /\ dart_of_fan (split_fan_face (V,E) (v,w)) = dart1_of_fan (V,E) + UNION {(sigma_fan (vec 0) V E v w, w), (w, sigma_fan (vec 0) V E v w)} + /\ fully_surrounded (split_fan_face (V,E) (v,w))` +[ + ((BETA_TAC THEN (move ["vw_in"])) THEN (((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["vw_in1"]))); + (((fun arg_tac -> (use_arg_then2 ("fully_surrounded_card_face_alt", [fully_surrounded_card_face_alt])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["card_f"])); + ((((use_arg_then2 ("split_fan_face_eq", [split_fan_face_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fanV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_surr", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("UNION_COMM", [UNION_COMM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET_UNION_ABSORPTION", [SUBSET_UNION_ABSORPTION]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE TRIANGULAR_FACE))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["f_eq"]))); + (((THENL) (BETA_TAC THEN (move ["x"]) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) [(((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))); (ALL_TAC)]) THEN ((use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`face (hypermap_of_fan (V,E)) (v,w)`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("FACE_SUBSET_DART1_OF_FAN", [FACE_SUBSET_DART1_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE aux_lemma))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H"))); + ((fun arg_tac -> arg_tac (Arg_term (`face H _2`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`ext_dart _`))) (term_tac (set_tac "h"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w1"))); + ((fun arg_tac -> arg_tac (Arg_term (`f_fan_pair _1 _2`))) (term_tac (set_tac "d2"))); + ((fun arg_tac -> arg_tac (Arg_term (`{w,w1} INSERT E`))) (term_tac (set_tac "E1"))); + (BETA_TAC THEN (case THEN (move ["h1"])) THEN (case THEN (move ["h2"])) THEN (case THEN (move ["h3"])) THEN (move ["h4"])); + ((fun arg_tac -> arg_tac (Arg_term (`E1 = E UNION {{w1,w}}`))) (term_tac (have_gen_tac [](move ["eq"])))); + (((((use_arg_then2 ("E1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("UNION_COMM", [UNION_COMM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SING_UNION_EQ_INSERT", [SING_UNION_EQ_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Collect_geom.PER_SET2)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("STEP3_REDUCE_FAN", [STEP3_REDUCE_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`{w,w1} INSERT E`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)); + (((((use_arg_then2 ("fully_surrounded_imp_fan80", [fully_surrounded_imp_fan80]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (repeat_tactic 0 15 (((split_tac) THEN ((TRY done_tac)))))); + ((BETA_TAC THEN (move ["x"]) THEN (move ["xV"])) THEN (((fun arg_tac -> (use_arg_then2 ("fully_surrounded_card_set_of_edge1", [fully_surrounded_card_set_of_edge1])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((use_arg_then2 ("E1_def", []))(thm_tac (new_rewrite [] [])))) THEN (move ["fan2"])) THEN ((((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w1_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("E1_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fan2", [fan2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DART_FANADD_EQ_DART_FAN_ADD_2DART", [DART_FANADD_EQ_DART_FAN_ADD_2DART])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("E1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)); + (((((use_arg_then2 ("fully_surrounded_imp_fan80", [fully_surrounded_imp_fan80]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (repeat_tactic 0 15 (((split_tac) THEN ((TRY done_tac)))))); + ((BETA_TAC THEN (move ["x"]) THEN (move ["xV"])) THEN (((fun arg_tac -> (use_arg_then2 ("fully_surrounded_card_set_of_edge1", [fully_surrounded_card_set_of_edge1])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`pr23`))) (term_tac (set_tac "cc"))); + ((fun arg_tac -> arg_tac (Arg_term (`cc = contracted_dart`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cc_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("pr23", [pr23]))(thm_tac (new_rewrite [] []))))); + ((case THEN (move ["x1"])) THEN (case THEN (move ["x2"])) THEN (case THEN (move ["x3"]) THEN (move ["x4"]))); + ((((use_arg_then2 ("Fan_defs.contracted_dart", [Fan_defs.contracted_dart]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then2 ("hypermap_of_fan_rep_alt", [hypermap_of_fan_rep_alt]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("dart_of_fan_eq_image", [dart_of_fan_eq_image]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] []))))) THEN (move ["dart_eq"])); + ((((use_arg_then2 ("dart_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`face (hypermap_of_fan (V,E1)) (w1,w)`))) (term_tac (set_tac "ds1"))); + ((fun arg_tac -> arg_tac (Arg_term (`face (hypermap_of_fan (V,E1)) (w,w1)`))) (term_tac (set_tac "ds2"))); + ((fun arg_tac -> (use_arg_then2 ("fan_hypermaps_iso_explicit2", [fan_hypermaps_iso_explicit2])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((fun arg_tac -> arg_tac (Arg_term (`ext_dart _`))) (term_tac (set_tac "h2"))) THEN (move ["iso2"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FAN80_FANADD", [FAN80_FANADD])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`{w,w1} INSERT E`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`IMAGE h2 ds1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`IMAGE h2 ds2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0:real^3,w,w1,v`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0:real^3,w1,v,w`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0:real^3,v,w,w1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)); + (((((use_arg_then2 ("fully_surrounded_imp_fan80", [fully_surrounded_imp_fan80]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (repeat_tactic 0 12 (((split_tac) THEN ((TRY done_tac)))))); + ((BETA_TAC THEN (move ["x"]) THEN (move ["xV"])) THEN (((fun arg_tac -> (use_arg_then2 ("fully_surrounded_card_set_of_edge1", [fully_surrounded_card_set_of_edge1])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("E1_def", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ext_dart", [ext_dart]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("Fan.pr3", [Fan.pr3]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((((use_arg_then2 ("ds1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ds2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("iso_components", [iso_components])) (fun fst_arg -> (use_arg_then2 ("iso2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dart_eq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("h2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ext_dart", [ext_dart]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("extension_sigma_fan", [extension_sigma_fan]))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`w IN set_of_edge w1 V E1 /\ w1 IN set_of_edge w V E1`))) (term_tac (have_gen_tac [](move ["w_in"]))))) ((repeat_tactic 1 9 (((use_arg_then2 ("w_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("set_of_edge", [set_of_edge]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Collect_geom.PER_SET2)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("w1_def", []))(gsym_then (thm_tac (new_rewrite [3] []))))) THEN (((use_arg_then2 ("sigma_fan_inV", [sigma_fan_inV]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN", [PAIR_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbb", [andbb]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("E1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("Planarity.fan80", [Planarity.fan80]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fully_surrounded", [fully_surrounded]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("E1_def", []))(thm_tac (new_rewrite [] []))))) THEN (move ["f80"]) THEN (case THEN ALL_TAC) THEN (move ["x"]) THEN (move ["y"]) THEN (move ["xy_in"])); + ((fun arg_tac -> arg_tac (Arg_term (`{x,y} IN E1`))) (term_tac (have_gen_tac [](move ["xy_inE"])))); + ((((use_arg_then2 ("xy_in", [])) (disch_tac [])) THEN (clear_assumption "xy_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("dart_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("E1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); ALL_TAC]) THEN ((TRY done_tac))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))))); + ((case THEN ALL_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Collect_geom.PER_SET2)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("azim_dart1_eq_azim", [azim_dart1_eq_azim]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f80", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fan2", [fan2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("xy_inE", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL add_edge_imp_card_set_edge_ge1_fan))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Fan_misc.FAN_IN_SET_OF_EDGE", [Fan_misc.FAN_IN_SET_OF_EDGE])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("xy_inE", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["a"]) THEN (move ["aV"])); + ((((fun arg_tac -> (use_arg_then2 ("fully_surrounded_card_set_of_edge1", [fully_surrounded_card_set_of_edge1])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma node_split_fan *) +let node_split_fan = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + ==> let H = hypermap_of_fan (V,E) and + H2 = hypermap_of_fan (split_fan_face (V,E) (v,w)) and + w' = sigma_fan (vec 0) V E v w in + (!d. d IN dart_of_fan (V,E) + ==> (FST d = w ==> node H2 d = (w,w') INSERT node H d) + /\ (FST d = w' ==> node H2 d = (w',w) INSERT node H d) + /\ (~(FST d = w) /\ ~(FST d = w') ==> node H2 d = node H d))` +[ + ((BETA_TAC THEN (move ["vw_in"])) THEN ((CONV_TAC let_CONV) THEN (move ["d"]) THEN (move ["d_in"]))); + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN ((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (move ["vw_in1"]) THEN (move ["d_in1"]))); + ((fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sigma_fan_not_fixed", [sigma_fan_not_fixed])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["w'_neq"]))); + (((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`_ INSERT E`))) (term_tac (set_tac "E2"))); + (BETA_TAC THEN (case THEN (move ["fan2"])) THEN (case THEN (move ["dart_eq"])) THEN (move ["_"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("fan_node_eq_fst", [fan_node_eq_fst]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dart_eq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] []))))); + ((THENL) (split_tac) [((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["x"])); ALL_TAC]); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`x = w,w'`))) (disch_eq_tac "x_eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`FST x = w`))) (disch_eq_tac "fst_x_eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`~(x = w',w)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((ALL_TAC) THEN (done_tac))); + (((((use_arg_then2 ("pair_expand", [pair_expand]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fst_x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_neq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL) (split_tac) [((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["x"])); ALL_TAC]); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`x = w',w`))) (disch_eq_tac "x_eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`FST x = w'`))) (disch_eq_tac "fst_x_eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`~(x = w,w')`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((ALL_TAC) THEN (done_tac))); + (((((use_arg_then2 ("pair_expand", [pair_expand]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fst_x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_neq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (case THEN ((move ["dw_neq"]) THEN (move ["dw'_neq"]))) THEN (move ["x"])); + (((use_arg_then2 ("andb_id2r", [andb_id2r])) (disch_tac [])) THEN (clear_assumption "andb_id2r") THEN (DISCH_THEN apply_tac) THEN (move ["fst_eq"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(x = w',w)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) (((((use_arg_then2 ("pair_expand", [pair_expand]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fst_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dw'_neq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`~(x = w,w')`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((ALL_TAC) THEN (done_tac))); + (((((use_arg_then2 ("pair_expand", [pair_expand]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fst_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dw_neq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma n_split_fan_face *) +let n_split_fan_face = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + /\ 3 < CARD (face (hypermap_of_fan (V,E)) (v,w)) + ==> (let w1 = sigma_fan (vec 0) V E v w and + d2 = f_fan_pair (V,E) (v,w) and + n = n_fan_pair (split_fan_face (V,E) (v,w)) in + n (w1,w) = n_fan_pair (V,E) (w1,v) /\ + n (w1,v) = w1,w /\ + n d2 = w,w1 /\ + n (w,w1) = w,v /\ + (!d. d IN dart_of_fan (split_fan_face (V,E) (v,w)) /\ + ~(d = w1,w \/ d = w1,v \/ d = d2 \/ d = w,w1) + ==> n d = n_fan_pair (V,E) d))` +[ + (BETA_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_gt3"])); + ((((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["vw_in1"]))); + (CONV_TAC let_CONV); + ((fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w1"))); + ((fun arg_tac -> arg_tac (Arg_term (`f_fan_pair _1 _2`))) (term_tac (set_tac "d2"))); + ((fun arg_tac -> arg_tac (Arg_term (`_ INSERT E`))) (term_tac (set_tac "E1"))); + ((fun arg_tac -> arg_tac (Arg_term (`E1 = E UNION {{w1,w}}`))) (term_tac (have_gen_tac [](move ["E1_eq"])))); + (((((use_arg_then2 ("E1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Collect_geom.PER_SET2)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("UNION_COMM", [UNION_COMM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SING_UNION_EQ_INSERT", [SING_UNION_EQ_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["f1_fan"])) THEN (case THEN (move ["dart1"])) THEN (move ["f_surr1"])); + ((fun arg_tac -> arg_tac (Arg_term (`{w1,v} IN E /\ {v,w} IN E /\ ~({w,w1} IN E) /\ {w,v} IN E`))) (term_tac (have_gen_tac [](case THEN ((move ["e1"]) THEN (case THEN (move ["e2"])) THEN (case THEN (move ["e3"])) THEN (move ["e4"])))))); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fully_surrounded_diag_not_in_dart", [fully_surrounded_diag_not_in_dart]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart_switch", [dart_switch]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`d2 = w,inverse1_sigma_fan (vec 0) V E w v`))) (term_tac (have_gen_tac [](move ["d2_eq"])))); + ((((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("Fan_misc.INVERSE_SIGMA_FAN_EQ_INVERSE1_SIGMA_FAN", [Fan_misc.INVERSE_SIGMA_FAN_EQ_INVERSE1_SIGMA_FAN]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_imp_fan80", [fully_surrounded_imp_fan80])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["f80"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_card_set_of_edge1", [fully_surrounded_card_set_of_edge1])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["gt1"]))); + (split_tac); + ((repeat_tactic 1 9 (((use_arg_then2 ("n_fan_pair", [n_fan_pair]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("SIGMA_FAN_OF_FANADD_AT_POINT1", [SIGMA_FAN_OF_FANADD_AT_POINT1])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f1_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f80", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("gt1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (split_tac); + ((((use_arg_then2 ("n_fan_pair", [n_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("SIGMA_FAN_OF_FANADD_AT_POINT2", [SIGMA_FAN_OF_FANADD_AT_POINT2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f1_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f80", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("gt1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (split_tac); + ((((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_fan_pair", [n_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("SIGMA_FAN_OF_FANADD_AT_POINT6", [SIGMA_FAN_OF_FANADD_AT_POINT6])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f1_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f80", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("gt1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("E_N_F_IN_DART1_OF_FAN", [E_N_F_IN_DART1_OF_FAN]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (split_tac); + ((((use_arg_then2 ("n_fan_pair", [n_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("SIGMA_FAN_OF_FANADD_AT_POINT3", [SIGMA_FAN_OF_FANADD_AT_POINT3])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f1_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f80", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("gt1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((use_arg_then2 ("dart1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d"]) THEN (case THEN ALL_TAC) THEN (move ["d_in"]) THEN (move ["d_neq"])); + ((THENL_LAST) ((THENL) (((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN case) [(move ["d_in"]); ALL_TAC]) (((((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((use_arg_then2 ("d_neq", [])) (disch_tac [])) THEN (clear_assumption "d_neq") THEN ((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN BETA_TAC THEN (case THEN ALL_TAC) THEN (move ["x"]) THEN (move ["y"]) THEN (move ["d_in"]) THEN (case THEN (move ["eq1"])) THEN (case THEN (move ["eq2"])) THEN (case THEN (move ["eq3"])) THEN (move ["eq4"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("n_fan_pair", [n_fan_pair]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`x IN {w,w1}`))) (disch_eq_tac "h1" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("SIGMA_FAN_OF_FANADD1", [SIGMA_FAN_OF_FANADD1])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f1_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("gt1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Collect_geom.PER_SET2)))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("E1_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(~(v = y) /\ x = w1) \/ (~(y = SND d2) /\ x = w)`))) (term_tac (have_gen_tac []ALL_TAC))); + ((((use_arg_then2 ("h1", [])) (disch_tac [])) THEN (clear_assumption "h1") THEN BETA_TAC) THEN ((((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (case THEN (move ["x_eq"]))); + ((DISJ2_TAC) THEN ((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then2 ("eq3", [])) (disch_tac [])) THEN (clear_assumption "eq3") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("SND", [SND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((DISJ1_TAC) THEN ((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then2 ("eq2", [])) (disch_tac [])) THEN (clear_assumption "eq2") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (case THEN (move ["xy_eq"])); + ((((use_arg_then2 ("xy_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("SIGMA_FAN_OF_FANADD_AT_POINT4", [SIGMA_FAN_OF_FANADD_AT_POINT4])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f1_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f80", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("gt1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("xy_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("xy_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("SIGMA_FAN_OF_FANADD_AT_POINT5", [SIGMA_FAN_OF_FANADD_AT_POINT5])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f1_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f80", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("gt1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("xy_eq", []))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((split_tac) THEN ((TRY done_tac)))))); + ((((use_arg_then2 ("xy_eq", [])) (disch_tac [])) THEN (clear_assumption "xy_eq") THEN BETA_TAC) THEN (((((use_arg_then2 ("d2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SND", [SND]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma inv_n_split_fan_face *) +let inv_n_split_fan_face = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + /\ 3 < CARD (face (hypermap_of_fan (V,E)) (v,w)) + ==> (let w1 = sigma_fan (vec 0) V E v w and + d2 = f_fan_pair (V,E) (v,w) and + n = inverse (n_fan_pair_ext (split_fan_face (V,E) (v,w))) in + n (n_fan_pair (V,E) (w1,v)) = w1,w + /\ n (w1,w) = w1,v + /\ n (w,w1) = d2 + /\ n (w,v) = w,w1 + /\ (!d. ~(d = n_fan_pair (V,E) (w1,v) \/ d = w1,w \/ d = w,w1 \/ d = w,v) + ==> n d = inverse (n_fan_pair_ext (V,E)) d))` +[ + (BETA_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"])); + ((((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["vw_in1"]))); + (CONV_TAC let_CONV); + ((fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w1"))); + ((fun arg_tac -> arg_tac (Arg_term (`f_fan_pair _1 _2`))) (term_tac (set_tac "d2"))); + ((fun arg_tac -> arg_tac (Arg_term (`_ INSERT E`))) (term_tac (set_tac "E1"))); + (BETA_TAC THEN (case THEN (move ["fan1"])) THEN (case THEN (move ["dart1"])) THEN (move ["f_surr1"])); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSE_EQ", [PERMUTES_INVERSE_EQ])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dart_of_fan (V,E1)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("N_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [N_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`w1,v IN dart1_of_fan (V,E) /\ d2 IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["in_dart"])))); + ((((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("E_N_F_IN_DART1_OF_FAN", [E_N_F_IN_DART1_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("w1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`w1,w IN dart1_of_fan (V,E1) /\ w1,v IN dart1_of_fan (V,E1) + /\ d2 IN dart1_of_fan (V,E1) /\ w,w1 IN dart1_of_fan (V,E1)`))) (term_tac (have_gen_tac [](move ["in_dart1"])))); + (((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart1", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_dart", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("n_fan_pair_ext", [n_fan_pair_ext]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_dart1", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE n_split_fan_face))) (fun fst_arg -> (use_arg_then2 ("card_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("d2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w1_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("E1_def", []))(thm_tac (new_rewrite [] []))))) THEN (move ["eq"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d"]) THEN (move ["d_neq"])); + ((((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSE_EQ", [PERMUTES_INVERSE_EQ])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dart_of_fan (V,E1)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("N_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [N_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`d IN dart1_of_fan (V,E)`))) (disch_eq_tac "d_in" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`inverse (n_fan_pair_ext (V,E)) d = d`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSE_EQ", [PERMUTES_INVERSE_EQ])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dart_of_fan (V,E)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("N_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [N_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("n_fan_pair_ext", [n_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("n_fan_pair_ext", [n_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart1", []))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("d_neq", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`inverse _ d`))) (term_tac (set_tac "y"))); + ((fun arg_tac -> arg_tac (Arg_term (`y IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["y_in"])))); + ((((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("Hypermap.lemma_dart_inveriant_under_inverse_maps", [Hypermap.lemma_dart_inveriant_under_inverse_maps]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`n_fan_pair (V,E) y = n_fan_pair_ext (V,E) y`))) (term_tac (have_gen_tac [](move ["ny_eq"])))) (((((use_arg_then2 ("n_fan_pair_ext", [n_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`d = n_fan_pair (V,E) y`))) (term_tac (have_gen_tac [](move ["d_eq"])))); + ((((use_arg_then2 ("ny_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES", [PERMUTES_INVERSES])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dart_of_fan (V,E)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("N_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [N_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("n_fan_pair_ext", [n_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("dart1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("d_neq", [])) (disch_tac [])) THEN (clear_assumption "d_neq") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d_eq", []))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`~(w1,w IN dart1_of_fan (V,E)) /\ ~(w,w1 IN dart1_of_fan (V,E))`))) (term_tac (have_gen_tac [](move ["not_in"])))); + (((((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbb", [andbb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fully_surrounded_diag_not_in_dart", [fully_surrounded_diag_not_in_dart]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((THENL) case [(move ["y_eq"]); ALL_TAC]) ((((use_arg_then2 ("y_in", [])) (disch_tac [])) THEN (clear_assumption "y_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("not_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); ALL_TAC]) THEN ((TRY done_tac))); + ((THENL_LAST) ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (move ["y_eq"])]) ((((use_arg_then2 ("y_in", [])) (disch_tac [])) THEN (clear_assumption "y_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("not_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (repeat_tactic 1 9 ((DISJ2_TAC))); + ((((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_fan_pair", [n_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((use_arg_then2 ("Fan_misc.INVERSE_SIGMA_FAN_EQ_INVERSE1_SIGMA_FAN", [Fan_misc.INVERSE_SIGMA_FAN_EQ_INVERSE1_SIGMA_FAN]))(gsym_then (thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("fanV", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((fun arg_tac -> (use_arg_then2 ("Fan.INVERSE1_SIGMA_FAN", [Fan.INVERSE1_SIGMA_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma n_split_fan_face_eq1 *) +let n_split_fan_face_eq1 = Sections.section_proof ["v";"w";"d"] +`v,w IN dart_of_fan (V,E) + /\ d IN dart_of_fan (split_fan_face (V,E) (v,w)) + /\ ~(FST d = sigma_fan (vec 0) V E v w) /\ ~(FST d = w) + ==> n_fan_pair (split_fan_face (V,E) (v,w)) d = n_fan_pair (V,E) d` +[ + ((((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["x"]) THEN (move ["y"])) THEN ((((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (case THEN (move ["xy_in"])) THEN (move ["neq"]))); + (((fun arg_tac -> (use_arg_then2 ("fully_surrounded_card_face_alt", [fully_surrounded_card_face_alt])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["card_f"])); + ((((use_arg_then2 ("split_fan_face_eq", [split_fan_face_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE n_split_fan_face))) (fun fst_arg -> (use_arg_then2 ("card_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["_"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["eq"]))))); + (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("neq", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma n_split_fan_face_eq2 *) +let n_split_fan_face_eq2 = Sections.section_proof ["v";"w";"d"] +`v,w IN dart_of_fan (V,E) + /\ d IN dart_of_fan (V,E) + /\ ~(d IN face (hypermap_of_fan (V,E)) (v,w)) + ==> n_fan_pair (split_fan_face (V,E) (v,w)) d = n_fan_pair (V,E) d` +[ + (BETA_TAC THEN (case THEN (move ["vw_in"])) THEN (case THEN (move ["d_in"])) THEN (move ["neq"])); + ((((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["vw_in1"]))); + (((fun arg_tac -> (use_arg_then2 ("fully_surrounded_card_face_alt", [fully_surrounded_card_face_alt])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["card_f"])); + ((((use_arg_then2 ("split_fan_face_eq", [split_fan_face_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE n_split_fan_face))) (fun fst_arg -> (use_arg_then2 ("card_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("d_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((THENL_FIRST) (split_tac) ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("dart_switch", [dart_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fully_surrounded_diag_not_in_dart", [fully_surrounded_diag_not_in_dart]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((THENL_FIRST) (split_tac) ((((use_arg_then2 ("neq", [])) (disch_tac [])) THEN (clear_assumption "neq") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE FACE_LAST_POINT))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (split_tac); + ((((use_arg_then2 ("neq", [])) (disch_tac [])) THEN (clear_assumption "neq") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("fan_hypermap_map1", [fan_hypermap_map1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((((fun arg_tac -> (use_arg_then2 ("POWER_1", [POWER_1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`face_map _`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Hypermap.lemma_in_face", [Hypermap.lemma_in_face]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fully_surrounded_diag_not_in_dart", [fully_surrounded_diag_not_in_dart]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma f_split_fan_face *) +let f_split_fan_face = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + /\ 3 < CARD (face (hypermap_of_fan (V,E)) (v,w)) + ==> (let w1 = sigma_fan (vec 0) V E v w and + d2 = f_fan_pair (V,E) (v,w) and + f = f_fan_pair (split_fan_face (V,E) (v,w)) in + f (v,w) = w,w1 /\ + f (w,w1) = w1,v /\ + f (w1,w) = d2 /\ + f (sigma_fan (vec 0) V E w1 v,w1) = w1,w /\ + (!d. d IN dart_of_fan (split_fan_face (V,E) (v,w)) /\ + ~(d = v,w \/ d = w,w1 \/ d = w1,w \/ d = sigma_fan (vec 0) V E w1 v,w1) + ==> f d = f_fan_pair (V,E) d))` +[ + (BETA_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["card_f"])); + ((((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["vw_in1"]))); + (CONV_TAC let_CONV); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE inv_n_split_fan_face))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> arg_tac (Arg_term (`inverse _`))) (term_tac (set_tac "n"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E v w`))) (term_tac (set_tac "w1"))); + ((fun arg_tac -> arg_tac (Arg_term (`f_fan_pair _ (v,w)`))) (term_tac (set_tac "d2"))); + ((fun arg_tac -> arg_tac (Arg_term (`_ INSERT E`))) (term_tac (set_tac "E1"))); + (BETA_TAC THEN (case THEN (move ["fan1"])) THEN (case THEN (move ["dart1"])) THEN (move ["f_surr1"]) THEN (move ["n_eq"])); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart1_of_fan (V,E1) /\ w,w1 IN dart1_of_fan (V,E1) /\ + w1,w IN dart1_of_fan (V,E1) /\ sigma_fan (vec 0) V E w1 v,w1 IN dart1_of_fan (V,E1)`))) (term_tac (have_gen_tac [](move ["in_dart1"])))); + ((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart1", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((DISJ1_TAC) THEN ((((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("f_fan_pair_eq_inv_n_o_e", [f_fan_pair_eq_inv_n_o_e]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("e_fan_pair", [e_fan_pair]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n_fan_pair", [n_fan_pair]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))))); + (BETA_TAC THEN (case THEN ((move ["x"]) THEN (move ["y"]))) THEN (case THEN (move ["xy_in"])) THEN (move ["xy_neq"])); + ((((use_arg_then2 ("f_fan_pair_eq_inv_n_o_e", [f_fan_pair_eq_inv_n_o_e]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`x,y IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["xy_in1"])))); + ((((use_arg_then2 ("xy_in", [])) (disch_tac [])) THEN (clear_assumption "xy_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("xy_neq", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("f_fan_pair_eq_inv_n_o_e", [f_fan_pair_eq_inv_n_o_e]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("e_fan_pair", [e_fan_pair]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("n_fan_pair", [n_fan_pair]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("xy_neq", [])) (disch_tac [])) THEN (clear_assumption "xy_neq") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("negb_or", [negb_or]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac))); + (repeat_tactic 1 9 ((case THEN (simp_tac)))); +];; + +(* Lemma f_split_fan_face_eq *) +let f_split_fan_face_eq = Sections.section_proof ["v";"w";"d"] +`v,w IN dart_of_fan (V,E) + /\ d IN dart_of_fan (V,E) + /\ ~(d IN face (hypermap_of_fan (V,E)) (v,w)) + ==> f_fan_pair (split_fan_face (V,E) (v,w)) d = f_fan_pair (V,E) d` +[ + (BETA_TAC THEN (case THEN (move ["vw_in"])) THEN (case THEN (move ["d_in"])) THEN (move ["neq"])); + ((((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["vw_in1"]))); + (((fun arg_tac -> (use_arg_then2 ("fully_surrounded_card_face_alt", [fully_surrounded_card_face_alt])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["card_f"])); + ((((use_arg_then2 ("split_fan_face_eq", [split_fan_face_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_split_fan_face))) (fun fst_arg -> (use_arg_then2 ("card_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("d_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((THENL_FIRST) (split_tac) ((((use_arg_then2 ("neq", [])) (disch_tac [])) THEN (clear_assumption "neq") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Hypermap.face_refl", [Hypermap.face_refl]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((THENL_FIRST) (split_tac) ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fully_surrounded_diag_not_in_dart", [fully_surrounded_diag_not_in_dart]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((THENL_FIRST) (split_tac) ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("dart_switch", [dart_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fully_surrounded_diag_not_in_dart", [fully_surrounded_diag_not_in_dart]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((use_arg_then2 ("neq", [])) (disch_tac [])) THEN (clear_assumption "neq") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E v w`))) (term_tac (set_tac "w1"))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE FACE_LAST_POINT))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("w1_def", []))(thm_tac (new_rewrite [] [])))) THEN (move ["w1v_in"])); + (((fun arg_tac -> (use_arg_then2 ("Hypermap.lemma_face_identity", [Hypermap.lemma_face_identity])) (fun fst_arg -> (use_arg_then2 ("w1v_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE FACE_LAST_POINT)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fanV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("w1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma face_split_fan_face *) +let face_split_fan_face = Sections.section_proof ["v";"w";"d"] +`v,w IN dart_of_fan (V,E) + /\ d IN dart_of_fan (V,E) /\ ~(d IN face (hypermap_of_fan (V,E)) (v,w)) + ==> face (hypermap_of_fan (split_fan_face (V,E) (v,w))) d + = face (hypermap_of_fan (V,E)) d` +[ + (BETA_TAC THEN (case THEN (move ["vw_in"])) THEN (case THEN (move ["d_in"])) THEN (move ["d_n_in"])); + ((((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN ((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["d_in1"]) THEN (move ["vw_in1"]))); + ((fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["fan1"]) THEN (case THEN (move ["dart1"])) THEN (move ["f_surr1"]))))); + ((fun arg_tac -> (use_arg_then2 ("f_split_fan_face_eq", [f_split_fan_face_eq])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["f_eq"]))); + (in_tac ["f_surr1"; "dart1"; "fan1"; "f_eq"] true (((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w1"))); + ((fun arg_tac -> arg_tac (Arg_term (`_ INSERT E`))) (term_tac (set_tac "E1"))); + ((repeat_tactic 1 9 (((use_arg_then2 ("face", [face]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("orbit_map", [orbit_map]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`face_map _`))) (term_tac (set_tac "f1"))); + ((fun arg_tac -> arg_tac (Arg_term (`face_map _`))) (term_tac (set_tac "f"))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`(f1 POWER n) d = (f POWER n) d /\ (f POWER n) d IN dart1_of_fan (V,E) + /\ ~((f POWER n) d IN face (hypermap_of_fan (V,E)) (v,w))`))) (term_tac (have_gen_tac ["n"](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((ALL_TAC) THEN (done_tac))); + ((((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) THEN (((repeat_tactic 0 10 (((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["n"]) THEN (case THEN (move ["eq"])) THEN (case THEN (move ["in1"])) THEN (move ["n_in"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("Fan.POWER_RIGHT", [Fan.POWER_RIGHT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`(f POWER n) d IN dart1_of_fan (V,E1)`))) (term_tac (have_gen_tac [](move ["fn_in1"])))); + (((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("f1_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("fan_hypermap_map1", [fan_hypermap_map1]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then2 ("n_in", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("fan_hypermap_map1", [fan_hypermap_map1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("E_N_F_IN_DART1_OF_FAN", [E_N_F_IN_DART1_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> (use_arg_then2 ("Hypermap.lemma_different_faces", [Hypermap.lemma_different_faces])) (fun fst_arg -> (use_arg_then2 ("n_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac)); + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("Hypermap.lemma_face_identity", [Hypermap.lemma_face_identity])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("Hypermap.lemma_face_identity", [Hypermap.lemma_face_identity])) (thm_tac apply_tac))); + (((((fun arg_tac -> (use_arg_then2 ("POWER_1", [POWER_1])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("Hypermap.lemma_in_face", [Hypermap.lemma_in_face]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma face_split_fan_face_explicit *) +let face_split_fan_face_explicit = Sections.section_proof ["v";"w"] +`let w' = sigma_fan (vec 0) V E v w and + H = hypermap_of_fan (V,E) and + H2 = hypermap_of_fan (split_fan_face (V,E) (v,w)) in + v,w IN dart_of_fan (V,E) /\ 3 < CARD (face H (v,w)) + ==> (face H2 (v,w) = {(v,w), (w,w'), (w',v)} /\ + face H2 (w',w) = (w',w) INSERT (face H (v,w) DIFF {(v,w), (w',v)})) + /\ (CARD (face H2 (v,w)) = 3 /\ CARD (face H2 (w',w)) = CARD (face H (v,w)) - 1) + /\ ((v,w) IN face H (v,w) /\ (w',v) IN face H (v,w) /\ ~(w',w IN face H (v,w))) + /\ (~(w' = w) /\ ~(v = w) /\ ~(v = w'))` +[ + ((CONV_TAC let_CONV) THEN (BETA_TAC THEN (case THEN ((move ["vw_in"]) THEN (move ["card_gt3"]))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_split_fan_face))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_gt3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["fH"]))))); + (((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`_ INSERT E`))) (term_tac (set_tac "E2"))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan (V,E)`))) (term_tac (set_tac "H"))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H2"))); + (BETA_TAC THEN (case THEN (move ["fan2"])) THEN (case THEN (move ["dart2_eq"])) THEN (move ["f_surr2"]) THEN (move ["f_eq"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq])) (fun fst_arg -> (use_arg_then2 ("f_surr2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["dart2_eq1"]))); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart1_of_fan (V,E) /\ w',v IN dart1_of_fan (V,E) + /\ v,w' IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["all_in1"])))); + ((in_tac ["vw_in"] false (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("dart1_switch", [dart1_switch])) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart1_of_fan (V,E2) /\ w,w' IN dart1_of_fan (V,E2) + /\ w',w IN dart1_of_fan (V,E2) /\ w',v IN dart1_of_fan (V,E2)`))) (term_tac (have_gen_tac [](move ["all_in2"])))); + (((((use_arg_then2 ("dart2_eq1", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("all_in1", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`~(w' = w) /\ ~(v = w) /\ ~(v = w')`))) (term_tac (have_gen_tac [](move ["neqs"])))); + ((repeat_tactic 1 9 ((split_tac))) THEN (((fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ", [PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`face H2 (v,w) = _`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))))); + ((THENL_ROT (-1)) ((((use_arg_then2 ("face", [face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbit_map_le3", [orbit_map_le3]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("fan_hypermap_map1", [fan_hypermap_map1]))(fun tmp_arg1 -> (use_arg_then2 ("f_eq", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair_last", [f_fan_pair_last]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("dart2_eq1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("all_in2", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("CARD_CLAUSES", [CARD_CLAUSES]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("FINITE_INSERT", [FINITE_INSERT]))(fun tmp_arg1 -> (use_arg_then2 ("FINITE_EMPTY", [FINITE_EMPTY]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("neqs", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("neqs", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("TWO", [TWO]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("THREE", [THREE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FACE_FINITE", [FACE_FINITE])) (fun fst_arg -> (use_arg_then2 ("H", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`v,w`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("card_gt3", [])) (disch_tac [])) THEN (clear_assumption "card_gt3") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("face", [face]))(thm_tac (new_rewrite [] []))))) THEN (move ["k_gt3"]) THEN (move ["finA"]))); + ((fun arg_tac -> arg_tac (Arg_term (`face_map H`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`face_map H2`))) (term_tac (set_tac "f2"))); + ((fun arg_tac -> arg_tac (Arg_term (`CARD (orbit_map f (v,w))`))) (term_tac (set_tac "k"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E w' v`))) (term_tac (set_tac "w2"))); + ((fun arg_tac -> arg_tac (Arg_term (`(f POWER i) (v,w) = (f_fan_pair (V,E) POWER i) (v,w) + /\ (f2 POWER i) (w',w) = (f_fan_pair (V,E2) POWER i) (w',w)`))) (term_tac (have_gen_tac ["i"](move ["f_pow_eq"])))); + (((((use_arg_then2 ("fH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("H2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("f_fan_pair_power", [f_fan_pair_power]))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); + ((fun arg_tac -> (use_arg_then2 ("finite_dart1", [finite_dart1])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["fin1"]))); + ((fun arg_tac -> arg_tac (Arg_term (`f permutes (dart1_of_fan (V,E))`))) (term_tac (have_gen_tac [](move ["f_perm"])))); + (((((use_arg_then2 ("fH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(f POWER (k - 2)) (v,w) = w2,w' + /\ (f POWER (k - 1)) (v,w) = w',v + /\ (f POWER 0) (v,w) = v,w`))) (term_tac (have_gen_tac [](move ["f_eqs"])))); + ((repeat_tactic 1 9 (((use_arg_then2 ("f_pow_eq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("f_fan_pair_power", [f_fan_pair_power]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FINITE_ORBIT_MAP_INVERSE", [FINITE_ORBIT_MAP_INVERSE])) (fun fst_arg -> (use_arg_then2 ("fin1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (TRY ((((((use_arg_then2 ("fH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("k_def", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("k_gt3", [])) (disch_tac [])) THEN (clear_assumption "k_gt3") THEN BETA_TAC) THEN (arith_tac))))); + ((((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("TWO", [TWO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER", [POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("all_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("all_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("w2_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`i < k ==> ((f POWER i) (v,w) = (w',v) <=> i = k - 1) + /\ ((f POWER i) (v,w) = (w2,w') <=> i = k - 2) + /\ ((f POWER i) (v,w) = (v,w) <=> i = 0)`))) (term_tac (have_gen_tac ["i"](move ["inj_f"])))); + ((BETA_TAC THEN (move ["i_lt"])) THEN (repeat_tactic 1 9 ((split_tac))) THEN (TRY ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))))) THEN ((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eqs", []))(gsym_then (thm_tac (new_rewrite [1] [])))))) THEN ((DISCH_THEN (fun snd_th -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ORBIT_MAP_INJ", [ORBIT_MAP_INJ])) (fun fst_arg -> (use_arg_then2 ("f_perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("k_def", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fin1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("k_gt3", [])) (disch_tac [])) THEN (clear_assumption "k_gt3") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> (use_arg_then2 ("fully_surrounded_diag_not_in_dart", [fully_surrounded_diag_not_in_dart])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("face", [face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("k_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("k_gt3", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (move ["w'w_not_in"])); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`_1 = _2`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac)))))); + ((((use_arg_then2 ("CARD_CLAUSES", [CARD_CLAUSES]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_DIFF", [FINITE_DIFF]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`~(w',w IN orbit_map f (v,w))`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))))); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("face", [face]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("w'w_not_in", [])) (disch_tac [])) THEN (clear_assumption "w'w_not_in") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("dart_switch", [dart_switch]))(thm_tac (new_rewrite [] []))))); + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_face_subset", [lemma_face_subset]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`v,w IN _1 /\ _2`))) (term_tac (have_gen_tac [](move ["inH"])))) (((repeat_tactic 2 0 (((use_arg_then2 ("f_eqs", []))(gsym_then (thm_tac (new_rewrite [1] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("lemma_in_orbit", [lemma_in_orbit]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((THENL_FIRST) (((fun arg_tac -> (use_arg_then2 ("CARD_DIFF", [CARD_DIFF])) (fun fst_arg -> (use_arg_then2 ("finA", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) ((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("CARD_CLAUSES", [CARD_CLAUSES]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("FINITE_INSERT", [FINITE_INSERT]))(fun tmp_arg1 -> (use_arg_then2 ("FINITE_EMPTY", [FINITE_EMPTY]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inH", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("neqs", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("k_def", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("k_gt3", [])) (disch_tac [])) THEN (clear_assumption "k_gt3") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`d IN dart1_of_fan (V,E) /\ ~(d = v,w) /\ ~(d = w2,w') + ==> f_fan_pair (V,E2) d = f_fan_pair (V,E) d`))) (term_tac (have_gen_tac ["d"](move ["f_eq'"])))); + (BETA_TAC THEN (case THEN (move ["d_in"])) THEN (move ["d_neqs"])); + ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("d_neqs", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("negb_or", [negb_or]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((THENL) ((((use_arg_then2 ("w'w_not_in", [])) (disch_tac [])) THEN (clear_assumption "w'w_not_in") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac)) THEN case) [(ALL_TAC); (((use_arg_then2 ("dart_switch", [dart_switch]))(thm_tac (new_rewrite [] []))))]) THEN (BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`1 <= i /\ i < k - 1 ==> (f POWER i) (v,w) = (f2 POWER i) (w',w)`))) (term_tac (have_gen_tac ["i"](move ["eq"])))); + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN elim) [ALL_TAC; (((THENL) case [ALL_TAC; (move ["i"])]) THEN (move ["Ih"]) THEN (move ["i_ineqs"]))]) ((arith_tac) THEN (done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("f_pow_eq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("POWER", [POWER]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((((use_arg_then2 ("Ih", [])) (disch_tac [])) THEN (clear_assumption "Ih") THEN BETA_TAC) THEN (ANTS_TAC)) ((((use_arg_then2 ("i_ineqs", [])) (disch_tac [])) THEN (clear_assumption "i_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((BETA_TAC THEN (move ["eq1"])) THEN ((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("COM_POWER", [COM_POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq1", []))(gsym_then (thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("f2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("H2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`(f POWER SUC i) (v,w) IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["f_pow_in"])))); + (((((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_dart_invariant_power_face", [lemma_dart_invariant_power_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("dart2_eq1", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_pow_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((THENL_LAST) (((use_arg_then2 ("f_eq'", []))(thm_tac (new_rewrite [] [])))) (((repeat_tactic 1 9 (((use_arg_then2 ("f_pow_eq", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("COM_POWER", [COM_POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("f_pow_in", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inj_f", []))(thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("k_gt3", [])) (disch_tac [])) THEN (clear_assumption "k_gt3") THEN ((use_arg_then2 ("i_ineqs", [])) (disch_tac [])) THEN (clear_assumption "i_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`orbit_map f (v,w) DIFF {(v,w), (w',v)} = + {(f POWER i) (v,w) | 1 <= i /\ i < k - 1}`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FINITE_ORBIT_MAP", [FINITE_ORBIT_MAP])) (fun fst_arg -> (use_arg_then2 ("f_perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("k_def", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] []))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])); + ((THENL) (split_tac) [((case THEN ALL_TAC) THEN (case THEN (move ["j"])) THEN (case THEN ((move ["j_lt"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); ((case THEN (move ["i"])) THEN (case THEN (move ["i_ineqs"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))]); + ((((repeat_tactic 1 9 (((use_arg_then2 ("inj_f", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["j_ineqs"])) THEN (((use_arg_then2 ("j", [])) (term_tac exists_tac)) THEN (simp_tac)) THEN (((use_arg_then2 ("j_ineqs", [])) (disch_tac [])) THEN (clear_assumption "j_ineqs") THEN ((use_arg_then2 ("j_lt", [])) (disch_tac [])) THEN (clear_assumption "j_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`i < k:num`))) (term_tac (have_gen_tac [](move ["i_lt"])))) ((((use_arg_then2 ("i_ineqs", [])) (disch_tac [])) THEN (clear_assumption "i_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) (((repeat_tactic 1 9 (((use_arg_then2 ("inj_f", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (split_tac)) (((use_arg_then2 ("i", [])) (term_tac exists_tac)) THEN (done_tac))); + ((((use_arg_then2 ("i_ineqs", [])) (disch_tac [])) THEN (clear_assumption "i_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("orbit_cyclic", [orbit_cyclic])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`k - 1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["x"])); + ((THENL) (split_tac) [((case THEN (move ["j"])) THEN (case THEN ((move ["j_lt"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); ALL_TAC]); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`j = 0`))) (disch_eq_tac "j0" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) (((((use_arg_then2 ("j0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((DISJ2_TAC) THEN ((use_arg_then2 ("j", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("j_lt", [])) (disch_tac [])) THEN (clear_assumption "j_lt") THEN ((use_arg_then2 ("j0", [])) (disch_tac [])) THEN (clear_assumption "j0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); ((case THEN (move ["i"])) THEN (case THEN ((move ["i_ineqs"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))]); + (((fun arg_tac -> arg_tac (Arg_term (`0`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("k_gt3", [])) (disch_tac [])) THEN (clear_assumption "k_gt3") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((use_arg_then2 ("i", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("i_ineqs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) (split_tac) ((((use_arg_then2 ("k_gt3", [])) (disch_tac [])) THEN (clear_assumption "k_gt3") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`k - 1 = SUC (k - 2)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("k_gt3", [])) (disch_tac [])) THEN (clear_assumption "k_gt3") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((((use_arg_then2 ("COM_POWER", [COM_POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) ((((use_arg_then2 ("k_gt3", [])) (disch_tac [])) THEN (clear_assumption "k_gt3") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("f_eqs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("H2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] []))))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`w2,w' IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["w2_in"]))))); + (((((use_arg_then2 ("dart2_eq1", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w2_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("f_eqs", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_dart_invariant_power_face", [lemma_dart_invariant_power_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma azim_split_fan_face_eq *) +let azim_split_fan_face_eq = Sections.section_proof ["v";"w";"d"] +`v,w IN dart_of_fan (V,E) /\ d IN dart_of_fan (V,E) + /\ ~(d = sigma_fan (vec 0) V E v w, v) + /\ ~(d = f_fan_pair (V,E) (v,w)) + ==> azim_dart (split_fan_face (V,E) (v,w)) d = azim_dart (V,E) d` +[ + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["a"]) THEN (move ["b"])); + (BETA_TAC THEN (case THEN (move ["vw_in"])) THEN (case THEN (move ["d_in"])) THEN (move ["d_n_in"])); + ((((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN ((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["d_in1"]) THEN (move ["vw_in1"]))); + (((fun arg_tac -> (use_arg_then2 ("fully_surrounded_card_face_alt", [fully_surrounded_card_face_alt])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["card_f"])); + ((((use_arg_then2 ("split_fan_face_eq", [split_fan_face_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SING_UNION_EQ_INSERT", [SING_UNION_EQ_INSERT]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Collect_geom.PER_SET2)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("UNION_COMM", [UNION_COMM]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`E UNION _`))) (term_tac (set_tac "E1"))); + (BETA_TAC THEN (case THEN (move ["fan1"])) THEN (case THEN (move ["dart1"])) THEN (move ["f_surr1"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("azim_dart_eq_azim_fan", [azim_dart_eq_azim_fan]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dart1", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE aux_lemma))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (use_arg_then2 ("fan_hypermaps_iso_explicit2", [fan_hypermaps_iso_explicit2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (use_arg_then2 ("fan_hypermaps_iso_explicit2", [fan_hypermaps_iso_explicit2])) (fun fst_arg -> (use_arg_then2 ("fan1", [fan1])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H2"))); + ((fun arg_tac -> arg_tac (Arg_term (`ext_dart _`))) (term_tac (set_tac "h2"))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap1_of_fanx _`))) (term_tac (set_tac "G2"))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H"))); + ((fun arg_tac -> arg_tac (Arg_term (`ext_dart _`))) (term_tac (set_tac "h"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w1"))); + (BETA_TAC THEN (move ["iso2"]) THEN (move ["iso"]) THEN (case THEN (move ["h1"])) THEN (case THEN (move ["h2"])) THEN (case THEN (move ["h3"])) THEN (move ["h4"])); + ((fun arg_tac -> arg_tac (Arg_term (`face G2 (h2 (w1,w))`))) (term_tac (set_tac "ds1"))); + ((fun arg_tac -> arg_tac (Arg_term (`face G2 (h2 (w,w1))`))) (term_tac (set_tac "ds2"))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_imp_fan80", [fully_surrounded_imp_fan80])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["f80"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_card_set_of_edge1", [fully_surrounded_card_set_of_edge1])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["gt1"]))); + ((fun arg_tac -> arg_tac (Arg_term (`w IN set_of_edge w1 V E1 /\ w1 IN set_of_edge w V E1`))) (term_tac (have_gen_tac [](move ["w_in"])))); + ((fun arg_tac -> arg_tac (Arg_term (`w,w1 IN dart1_of_fan (V,E1) /\ w1,w IN dart1_of_fan (V,E1)`))) (term_tac (have_gen_tac [](move ["in1"])))); + (((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart1", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN", [PAIR_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan1", [fan1])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`w1,v IN dart_of_fan (V,E) /\ f_fan_pair (V,E) (v,w) IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["in_dart"])))); + ((((use_arg_then2 ("w1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("E_N_F_IN_DART1_OF_FAN", [E_N_F_IN_DART1_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`dart H = dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["dart_eq"])))); + (((((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`a,b IN face H (v,w)`))) (disch_eq_tac "d_in_face" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((THENL_ROT (-1)) (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("azim_fanadd_eq_ds", [azim_fanadd_eq_ds])) (fun fst_arg -> (use_arg_then2 ("gt1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f80", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("E1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ds1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ds2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0:real^3,w,w1,v`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0:real^3,w1,v,w`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0:real^3,v,w,w1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`h (a,b)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC))); + (((repeat_tactic 1 9 (((use_arg_then2 ("tran", [tran]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ext_dart", [ext_dart]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("Fan.pr2", [Fan.pr2]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("Fan.pr3", [Fan.pr3]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((repeat_tactic 11 0 (((use_arg_then2 ("h4", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("w1_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("E1_def", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("ds2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ds1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("G2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ext_dart", [ext_dart]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("extension_sigma_fan", [extension_sigma_fan]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("w_in", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((THENL_FIRST) ((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (split_tac)) (((fun arg_tac -> arg_tac (Arg_term (`a,b`))) (term_tac exists_tac)) THEN (done_tac))); + ((((use_arg_then2 ("d_n_in", [])) (disch_tac [])) THEN (clear_assumption "d_n_in") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negb_or", [negb_or]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac))); + ((fun arg_tac -> (use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["inj"]))); + (case THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("inj", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then2 ("dart_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_ROT (-1)) (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("azim_fanadd_eq", [azim_fanadd_eq])) (fun fst_arg -> (use_arg_then2 ("gt1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f80", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("E1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ds1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ds2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0:real^3,w,w1,v`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0:real^3,w1,v,w`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0:real^3,v,w,w1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`h (a,b)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`IMAGE h (face H (a,b))`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC))); + (((repeat_tactic 1 9 (((use_arg_then2 ("tran", [tran]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ext_dart", [ext_dart]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("Fan.pr2", [Fan.pr2]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("Fan.pr3", [Fan.pr3]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((repeat_tactic 11 0 (((use_arg_then2 ("h4", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("w1_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("E1_def", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("ds2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ds1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("G2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ext_dart", [ext_dart]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("extension_sigma_fan", [extension_sigma_fan]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("w_in", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((THENL_LAST) (split_tac) ((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`a,b`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("Hypermap.face_refl", [Hypermap.face_refl]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("iso_components", [iso_components])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dart_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("Hypermap.lemma_in_face_set", [Hypermap.lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dart_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("d_in_face", [])) (disch_tac [])) THEN (clear_assumption "d_in_face") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac)); + ((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("image_inj_gen", [image_inj_gen])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC); + (((repeat_tactic 1 9 (((use_arg_then2 ("Hypermap.lemma_face_subset", [Hypermap.lemma_face_subset]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dart_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("Hypermap.face_refl", [Hypermap.face_refl]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma azim_split_fan_face_not_in_face *) +let azim_split_fan_face_not_in_face = Sections.section_proof ["v";"w";"d"] +`v,w IN dart_of_fan (V,E) /\ + d IN dart_of_fan (V,E) /\ + ~(d IN face (hypermap_of_fan (V,E)) (v,w)) + ==> azim_dart (split_fan_face (V,E) (v,w)) d = azim_dart (V,E) d` +[ + (BETA_TAC THEN (case THEN (move ["vw_in"])) THEN (case THEN (move ["d_in"])) THEN (move ["d_n_in"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("azim_split_fan_face_eq", [azim_split_fan_face_eq])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("negb_or", [negb_or]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d_n_in", [])) (disch_tac [])) THEN (clear_assumption "d_n_in") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac))); + ((case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("in_face_lemma", [in_face_lemma]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma azim_split_fan_face_add *) +let azim_split_fan_face_add = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) /\ 3 < CARD (face (hypermap_of_fan (V,E)) (v,w)) + ==> let w' = sigma_fan (vec 0) V E v w in + let d2 = f_fan_pair (V,E) (v,w) in + let F2 = split_fan_face (V,E) (v,w) in + azim_dart (V,E) d2 = azim_dart F2 (w,w') + azim_dart F2 d2 + /\ azim_dart (V,E) (w',v) = azim_dart F2 (w',w) + azim_dart F2 (w',v)` +[ + ((BETA_TAC THEN (case THEN ((move ["vw_in"]) THEN (move ["card_gt3"])))) THEN (((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (move ["vw_in1"]))); + (repeat_tactic 1 9 ((CONV_TAC let_CONV))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_diag_not_in_dart", [fully_surrounded_diag_not_in_dart])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_gt3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["ww'_n_in"]))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sigma_fan_not_fixed", [sigma_fan_not_fixed])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["w'_neq"]))); + ((fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> arg_tac (Arg_term (`_ INSERT E`))) (term_tac (set_tac "E2"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`f_fan_pair _1 _2`))) (term_tac (set_tac "d2"))); + (BETA_TAC THEN (case THEN (move ["fan2"])) THEN (case THEN (move ["dart_eq"])) THEN (move ["_"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`split_fan_face (V,E) (v,w) = (V,E2)`))) (term_tac (have_gen_tac [](move ["split_eq"])))) ((((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (move ["_"]))))); + (split_tac); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`FST d2 = w`))) (term_tac (have_gen_tac [](move ["fst_d2"])))) (((((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`d2 IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["d2_in"])))); + (((((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fan_hypermap_map1", [fan_hypermap_map1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`d2 IN dart_of_fan (V,E2)`))) (term_tac (have_gen_tac [](move ["d2_in2"])))); + (((((use_arg_then2 ("dart_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("SUM_AZIM_DART", [SUM_AZIM_DART])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d2_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sumVE"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("SUM_AZIM_DART", [SUM_AZIM_DART])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d2_in2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sumVE2"]))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE node_split_fan))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d2_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["eq"]) THEN (move ["_"]))))); + ((((fun arg_tac -> (use_arg_then2 ("eq", [])) (fun fst_arg -> (use_arg_then2 ("fst_d2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC THEN (move ["_"])) THEN (((((use_arg_then2 ("split_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] []))))) THEN (move ["n2_eq"]))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan (V,E)`))) (term_tac (set_tac "H"))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan (V,E2)`))) (term_tac (set_tac "H2"))); + ((fun arg_tac -> arg_tac (Arg_term (`~(w,w' IN node H d2)`))) (term_tac (have_gen_tac [](move ["ww'_node"])))); + (((use_arg_then2 ("ww'_n_in", [])) (disch_tac [])) THEN (clear_assumption "ww'_n_in") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("NODE_SUBSET_DART_OF_FAN", [NODE_SUBSET_DART_OF_FAN]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("sumVE", [])) (disch_tac [])) THEN (clear_assumption "sumVE") THEN BETA_TAC) THEN ((((use_arg_then2 ("sumVE2", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n2_eq", []))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) (in_tac ["ww'_node"] true (((fun arg_tac -> (use_arg_then2 ("INSERT_DELETE", [INSERT_DELETE])) (fun fst_arg -> (use_arg_then2 ("d2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) (((((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("node_refl", [node_refl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("SUM_CLAUSES", [SUM_CLAUSES]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_INSERT", [FINITE_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_DELETE", [FINITE_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("NODE_FINITE", [NODE_FINITE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("ww'_node", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s1"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s2")))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`s1 = s2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((((use_arg_then2 ("REAL_EQ_ADD_RCANCEL", [REAL_EQ_ADD_RCANCEL]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((((use_arg_then2 ("s1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("s2_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (move ["x"]) THEN (move ["x_in"]))); + ((fun arg_tac -> arg_tac (Arg_term (`x IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["x_in_dart"])))); + (((use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`node H d2`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("x_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_node_subset", [lemma_node_subset]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("split_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("azim_split_fan_face_eq", [azim_split_fan_face_eq])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x_in_dart", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("d2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pair_expand", [pair_expand]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`FST x = FST d2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) (((((use_arg_then2 ("fst_d2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_neq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("fst_node_hypermap_of_fan", [fst_node_hypermap_of_fan])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`w',v IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["w'v_in"])))); + (((((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`w',v IN dart_of_fan (V,E2)`))) (term_tac (have_gen_tac [](move ["w'v_in2"])))); + (((((use_arg_then2 ("dart_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("SUM_AZIM_DART", [SUM_AZIM_DART])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w'v_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sumVE"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("SUM_AZIM_DART", [SUM_AZIM_DART])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w'v_in2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sumVE2"]))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE node_split_fan))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w'v_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["_"]) THEN (case THEN ((move ["eq"]) THEN (move ["_"]))))))); + ((((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN (((((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("split_eq", []))(thm_tac (new_rewrite [] []))))) THEN (move ["n2_eq"]))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan (V,E)`))) (term_tac (set_tac "H"))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan (V,E2)`))) (term_tac (set_tac "H2"))); + ((fun arg_tac -> arg_tac (Arg_term (`~(w',w IN node H (w',v))`))) (term_tac (have_gen_tac [](move ["w'w_node"])))); + ((((use_arg_then2 ("ww'_n_in", [])) (disch_tac [])) THEN (clear_assumption "ww'_n_in") THEN BETA_TAC) THEN (((use_arg_then2 ("dart_switch", [dart_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("NODE_SUBSET_DART_OF_FAN", [NODE_SUBSET_DART_OF_FAN]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("sumVE", [])) (disch_tac [])) THEN (clear_assumption "sumVE") THEN BETA_TAC) THEN ((((use_arg_then2 ("sumVE2", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n2_eq", []))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) (in_tac ["w'w_node"] true (((fun arg_tac -> (use_arg_then2 ("INSERT_DELETE", [INSERT_DELETE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`w',v`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) (((((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("node_refl", [node_refl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("SUM_CLAUSES", [SUM_CLAUSES]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_INSERT", [FINITE_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_DELETE", [FINITE_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("NODE_FINITE", [NODE_FINITE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("w'w_node", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s1"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s2")))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`s1 = s2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((((use_arg_then2 ("REAL_EQ_ADD_RCANCEL", [REAL_EQ_ADD_RCANCEL]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((((use_arg_then2 ("s1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("s2_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (move ["x"]) THEN (move ["x_in"]))); + ((fun arg_tac -> arg_tac (Arg_term (`x IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["x_in_dart"])))); + (((use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`node H (w',v)`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("x_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_node_subset", [lemma_node_subset]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("split_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("azim_split_fan_face_eq", [azim_split_fan_face_eq])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x_in_dart", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pair_expand", [pair_expand]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`FST x = FST (w',v)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) (((simp_tac) THEN (((use_arg_then2 ("w'_neq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("fst_node_hypermap_of_fan", [fst_node_hypermap_of_fan])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma tau_split_fan_face_eq *) +let tau_split_fan_face_eq = Sections.section_proof ["v";"w";"f"] +`v,w IN dart_of_fan (V,E) /\ + f IN face_set (hypermap_of_fan (V,E)) DELETE face (hypermap_of_fan (V,E)) (v,w) + ==> tauVEF (V, {w,sigma_fan (vec 0) V E v w} INSERT E, f) = tauVEF (V, E, f)` +[ + ((((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (case THEN (move ["f_in"])) THEN (move ["f_n_in"])); + ((fun arg_tac -> arg_tac (Arg_term (`dart (hypermap_of_fan (V,E)) = dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["dart_eq"])))); + ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("Tame_defs.tauVEF", [Tame_defs.tauVEF]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("split_fan_face", [split_fan_face]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_EQ_ADD_RCANCEL", [REAL_EQ_ADD_RCANCEL]))(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["d"]) THEN (move ["d_in"]) THEN (simp_tac)); + ((((use_arg_then2 ("REAL_EQ_MUL_RCANCEL", [REAL_EQ_MUL_RCANCEL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("azim_split_fan_face_not_in_face", [azim_split_fan_face_not_in_face]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((fun arg_tac -> (use_arg_then2 ("Hypermap.lemma_face_representation", [Hypermap.lemma_face_representation])) (fun fst_arg -> (use_arg_then2 ("f_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["y"])) THEN (case THEN (move ["y_in"])) THEN (move ["f_eq"])); + (((((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + (((use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("f", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("d_in", []))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Hypermap.lemma_face_subset", [Hypermap.lemma_face_subset]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("f_n_in", [])) (disch_tac [])) THEN (clear_assumption "f_n_in") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac)) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("Hypermap.lemma_face_identity", [Hypermap.lemma_face_identity])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("Hypermap.lemma_face_identity", [Hypermap.lemma_face_identity])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Lemma tau_split_fan_face_add *) +let tau_split_fan_face_add = Sections.section_proof ["v";"w"] +`let w' = sigma_fan (vec 0) V E v w in + let H = hypermap_of_fan (V,E) in + let H2 = hypermap_of_fan (V, {w,w'} INSERT E) in + v,w IN dart_of_fan (V,E) /\ 3 < CARD (face H (v,w)) + ==> tauVEF (V, E, face H (v,w)) + = tauVEF (V, {w,w'} INSERT E, face H2 (v,w)) + + tauVEF (V, {w,w'} INSERT E, face H2 (w',w))` +[ + ((repeat_tactic 1 9 ((CONV_TAC let_CONV))) THEN (BETA_TAC THEN (case THEN ((move ["vw_in"]) THEN (move ["card_gt3"]))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE face_split_fan_face_explicit))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_gt3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE azim_split_fan_face_add))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_gt3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["fH"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`_ INSERT E`))) (term_tac (set_tac "E2"))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan (V,E)`))) (term_tac (set_tac "H"))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan (V,E2)`))) (term_tac (set_tac "H2"))); + ((fun arg_tac -> arg_tac (Arg_term (`f_fan_pair (V,E) (v,w)`))) (term_tac (set_tac "d2"))); + (BETA_TAC THEN (move ["azim_add"]) THEN (case THEN (move ["faces_eq"])) THEN (case THEN (move ["cards_eq"])) THEN (case THEN (move ["in_face"])) THEN (move ["neqs"])); + ((fun arg_tac -> arg_tac (Arg_term (`d2 IN face H (v,w)`))) (term_tac (have_gen_tac [](move ["d2_in_face"])))); + (((((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("POWER_1", [POWER_1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair_power", [f_fan_pair_power]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face", [lemma_in_face]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`d2 IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["d2_in"])))); + (((((fun arg_tac -> (use_arg_then2 ("IN_TRANS", [IN_TRANS])) (fun fst_arg -> (use_arg_then2 ("d2_in_face", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_face_subset", [lemma_face_subset]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (repeat_tactic 1 9 (((use_arg_then2 ("Tame_defs.tauVEF", [Tame_defs.tauVEF]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`\x. _ x`))) (term_tac (set_tac "a"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`\x. _ x`))) (term_tac (set_tac "a2")))); + (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `!a b c d x. (a + x * b) + c + x * d = (a + c) + x * (b + d):real`)))(thm_tac (new_rewrite [] [])))); + ((THENL_ROT (-1)) ((congr_tac (`_1 + _2 * _3:real`)) THEN ((TRY done_tac)))); + (((repeat_tactic 1 9 (((use_arg_then2 ("cards_eq", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_OF_NUM_SUB", [REAL_OF_NUM_SUB]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("card_gt3", [])) (disch_tac [])) THEN (clear_assumption "card_gt3") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (repeat_tactic 1 9 (((use_arg_then2 ("faces_eq", []))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`face H (v,w) = (v,w) INSERT (w',v) INSERT (face H (v,w) DIFF {(v,w), (w',v)})`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [1] []))))))); + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`x = v,w`))) (disch_eq_tac "eq1" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("eq1", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((fun arg_tac -> arg_tac (Arg_term (`x = w',v`))) (disch_eq_tac "eq2" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN (((use_arg_then2 ("eq2", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("SUM_SING", [SUM_SING]))(fun tmp_arg1 -> (use_arg_then2 ("SUM_CLAUSES", [SUM_CLAUSES]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("FINITE_INSERT", [FINITE_INSERT]))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("FINITE_EMPTY", [FINITE_EMPTY]))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("FINITE_DIFF", [FINITE_DIFF]))(fun tmp_arg1 -> (use_arg_then2 ("FACE_FINITE", [FACE_FINITE]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((repeat_tactic 0 20 (((fun arg_tac ->(use_arg_then2 ("IN_SING", [IN_SING]))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("IN_INSERT", [IN_INSERT]))(fun tmp_arg1 -> (use_arg_then2 ("IN_DIFF", [IN_DIFF]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_face", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("neqs", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("neqs", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("INSERT_DELETE", [INSERT_DELETE])) (fun fst_arg -> (use_arg_then2 ("d2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`_1 DIFF _2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2_in_face", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("neqs", []))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("SUM_CLAUSES", [SUM_CLAUSES]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("FINITE_DELETE", [FINITE_DELETE]))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("FINITE_DIFF", [FINITE_DIFF]))(fun tmp_arg1 -> (use_arg_then2 ("FACE_FINITE", [FACE_FINITE]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`split_fan_face (V,E) (v,w) = (V,E2)`))) (term_tac (have_gen_tac [](move ["split_eq"])))); + (((((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("E2_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_ROT (-1)) ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(thm_tac (new_rewrite [] []))))) THEN (congr_tac (`_1 + _2:real`)))); + (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))))); + (BETA_TAC THEN (move ["d"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["d_in_face"])) THEN (move ["d_neqs"]) THEN (move ["d_neq"])); + (((((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_EQ_MUL_RCANCEL", [REAL_EQ_MUL_RCANCEL]))(thm_tac (new_rewrite [] []))))) THEN (DISJ1_TAC)); + ((((use_arg_then2 ("split_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("azim_split_fan_face_eq", [azim_split_fan_face_eq])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_neqs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_neq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((((fun arg_tac -> (use_arg_then2 ("IN_TRANS", [IN_TRANS])) (fun fst_arg -> (use_arg_then2 ("d_in_face", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_face_subset", [lemma_face_subset]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (congr_tac (`_1 + _2:real`))); + (((((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_EQ_MUL_RCANCEL", [REAL_EQ_MUL_RCANCEL]))(thm_tac (new_rewrite [] []))))) THEN (DISJ1_TAC)); + ((((use_arg_then2 ("split_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("azim_split_fan_face_eq", [azim_split_fan_face_eq])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("neqs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("neqs", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [2; 4] []))))) THEN (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("Tame_defs.h_dart", [Tame_defs.h_dart]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> arg_tac (Arg_term (`&1 + _2`))) (term_tac (set_tac "x"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`&1 + _2`))) (term_tac (set_tac "y")))); + ((repeat_tactic 1 9 (((use_arg_then2 ("azim_add", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section AddTriangle *) +let split_fan_face_eq = Sections.finalize_theorem split_fan_face_eq;; +let sigma_in_dart1 = Sections.finalize_theorem sigma_in_dart1;; +let in_face_lemma = Sections.finalize_theorem in_face_lemma;; +let f_fan_pair_last = Sections.finalize_theorem f_fan_pair_last;; +let f_fan_pair3 = Sections.finalize_theorem f_fan_pair3;; +let fully_surrounded_card_face_alt = Sections.finalize_theorem fully_surrounded_card_face_alt;; +let fully_surrounded_imp_conforming = Sections.finalize_theorem fully_surrounded_imp_conforming;; +let fully_surrounded_diag_not_in_dart = Sections.finalize_theorem fully_surrounded_diag_not_in_dart;; +let aux_lemma = Sections.finalize_theorem aux_lemma;; +let fan_split_fan_face = Sections.finalize_theorem fan_split_fan_face;; +let node_split_fan = Sections.finalize_theorem node_split_fan;; +let n_split_fan_face = Sections.finalize_theorem n_split_fan_face;; +let inv_n_split_fan_face = Sections.finalize_theorem inv_n_split_fan_face;; +let n_split_fan_face_eq1 = Sections.finalize_theorem n_split_fan_face_eq1;; +let n_split_fan_face_eq2 = Sections.finalize_theorem n_split_fan_face_eq2;; +let f_split_fan_face = Sections.finalize_theorem f_split_fan_face;; +let f_split_fan_face_eq = Sections.finalize_theorem f_split_fan_face_eq;; +let face_split_fan_face = Sections.finalize_theorem face_split_fan_face;; +let face_split_fan_face_explicit = Sections.finalize_theorem face_split_fan_face_explicit;; +let azim_split_fan_face_eq = Sections.finalize_theorem azim_split_fan_face_eq;; +let azim_split_fan_face_not_in_face = Sections.finalize_theorem azim_split_fan_face_not_in_face;; +let azim_split_fan_face_add = Sections.finalize_theorem azim_split_fan_face_add;; +let tau_split_fan_face_eq = Sections.finalize_theorem tau_split_fan_face_eq;; +let tau_split_fan_face_add = Sections.finalize_theorem tau_split_fan_face_add;; +Sections.end_section "AddTriangle";; + +(* Close the module *) +end;; diff --git a/formal_lp/hypermap/ssreflect/list_hypermap-compiled.hl b/formal_lp/hypermap/ssreflect/list_hypermap-compiled.hl new file mode 100644 index 0000000..41dffa1 --- /dev/null +++ b/formal_lp/hypermap/ssreflect/list_hypermap-compiled.hl @@ -0,0 +1,1293 @@ +needs "tame/ssreflect/seq2-compiled.hl";; +needs "hypermap/hypermap.hl";; +needs "fan/HypermapAndFan.hl";; +needs "fan/hypermap_iso-compiled.hl";; + +(* Module List_hypermap*) +module List_hypermap = struct + +open Ssrbool;; +open Ssrnat;; +open Seq;; +open Seq2;; +open Hypermap;; +open Hypermap_and_fan;; +parse_as_infix ("::", (12, "right"));; +override_interface ("::", `CONS`);; +make_overloadable "++" `:A -> A -> A`;; +overload_interface ("++", `cat`);; +let darts_k = new_definition `darts_k k H = {d:A | d IN dart H /\ CARD (face H d) = k}`;; +let face_set_k = + new_definition `face_set_k k (H:(A)hypermap) = {f | f IN face_set H /\ CARD f = k}`;; +let list_pairs = new_definition `list_pairs list = zip list (rot 1 list)`;; +let list_of_darts = new_definition + `list_of_darts L = foldr (\list all. (list_pairs list) ++ all) [] L`;; +let darts_of_list = new_definition `darts_of_list L = set_of_list (list_of_darts L)`;; +let list_of_faces = new_definition `list_of_faces L = MAP list_pairs L`;; +let faces_of_list = new_definition `faces_of_list L = MAP set_of_list (list_of_faces L)`;; +let list_of_elements = new_definition `list_of_elements L = undup (flatten L)`;; +let elements_of_list = new_definition `elements_of_list L = set_of_list (list_of_elements L)`;; +let list_of_nodes = new_definition + `list_of_nodes L = MAP (\x. filter (\d. FST d = x) (list_of_darts L)) (list_of_elements L)`;; +let nodes_of_list = new_definition `nodes_of_list L = MAP set_of_list (list_of_nodes L)`;; +let list_of_faces3 = new_definition `list_of_faces3 (L:((A)list)list) = + filter (\f. LENGTH f = 3) (list_of_faces L)`;; +let list_of_faces4 = new_definition `list_of_faces4 (L:((A)list)list) = + filter (\f. LENGTH f = 4) (list_of_faces L)`;; +let list_of_faces5 = new_definition `list_of_faces5 (L:((A)list)list) = + filter (\f. LENGTH f = 5) (list_of_faces L)`;; +let list_of_faces6 = new_definition `list_of_faces6 (L:((A)list)list) = + filter (\f. LENGTH f = 6) (list_of_faces L)`;; +let list_of_darts3 = new_definition `list_of_darts3 (L:((A)list)list) = + flatten (list_of_faces3 L)`;; +let list_of_darts4 = new_definition `list_of_darts4 (L:((A)list)list) = + flatten (list_of_faces4 L)`;; +let list_of_darts5 = new_definition `list_of_darts5 (L:((A)list)list) = + flatten (list_of_faces5 L)`;; +let list_of_darts6 = new_definition `list_of_darts6 (L:((A)list)list) = + flatten (list_of_faces6 L)`;; +let find_list = (GEN_ALL o define) `find_list [] x = [] + /\ find_list (CONS h t) x = if (MEM x h) then h else find_list t x`;; +let find_pair_list = (GEN_ALL o define) `find_pair_list [] d = [] + /\ find_pair_list (CONS h t) d = if (MEM d (list_pairs h)) then h else find_pair_list t d`;; +let find_face = new_definition `find_face L d = find_list (list_of_faces L) d`;; +let f_list = new_definition `f_list L d = next_el (find_face L d) d`;; +let e_list = new_definition `e_list d = (SND d, FST d)`;; +let n_list = new_definition `n_list L d = e_list (prev_el (find_face L d) d)`;; +let f_list_ext = new_definition `f_list_ext L = res (f_list L) (darts_of_list L)`;; +let e_list_ext = new_definition `e_list_ext L = res (e_list) (darts_of_list L)`;; +let n_list_ext = new_definition `n_list_ext L = res (n_list L) (darts_of_list L)`;; +let hypermap_of_list = new_definition + `hypermap_of_list (L:((A)list)list) = + hypermap (darts_of_list L, e_list_ext L, n_list_ext L, f_list_ext L)`;; +let good_list = new_definition `good_list L <=> + uniq (list_of_darts L) /\ + all (\l. ~(l = [])) L /\ + (!d. MEM d (list_of_darts L) ==> MEM (SND d, FST d) (list_of_darts L))`;; +let good_list_nodes = new_definition `good_list_nodes L <=> + node_set (hypermap_of_list L) = set_of_list (nodes_of_list L)`;; + +(* Lemma list_pairs_empty *) +let list_pairs_empty = Sections.section_proof ["s"] +`list_pairs s = [] <=> s = []` +[ + (((((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size_eq0", [size_eq0]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("size1_zip", [size1_zip]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_of_darts_alt *) +let list_of_darts_alt = Sections.section_proof ["L"] +`list_of_darts L = flatten (list_of_faces L)` +[ + ((((use_arg_then2 ("list_of_darts", [list_of_darts]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("flatten", [flatten]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_faces", [list_of_faces]))(thm_tac (new_rewrite [] []))))); + (((THENL) (((use_arg_then2 ("L", [])) (disch_tac [])) THEN (clear_assumption "L") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((((use_arg_then2 ("MAP", [MAP]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("foldr", [foldr]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma find_face_alt *) +let find_face_alt = Sections.section_proof ["L";"d"] +`find_face L d = list_pairs (find_pair_list L d)` +[ + ((((use_arg_then2 ("find_face", [find_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_faces", [list_of_faces]))(thm_tac (new_rewrite [] []))))); + ((THENL) (((use_arg_then2 ("L", [])) (disch_tac [])) THEN (clear_assumption "L") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]); + (((((use_arg_then2 ("MAP", [MAP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_list", [find_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_pair_list", [find_pair_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("zip", [zip]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("MAP", [MAP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_pair_list", [find_pair_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_list", [find_list]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> arg_tac (Arg_term (`MEM d _`))) (disch_eq_tac "mem_d" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma mem_find_list *) +let mem_find_list = Sections.section_proof ["x";"L"] +`MEM x (flatten L) ==> MEM (find_list L x) L` +[ + ((((use_arg_then2 ("mem_flatten", [mem_flatten]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["l"]))); + (((THENL) (((use_arg_then2 ("L", [])) (disch_tac [])) THEN (clear_assumption "L") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("find_list", [find_list]))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) (BETA_TAC THEN (case THEN (((THENL) case [(((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))); (move ["lt"])]) THEN (move ["xl"])))) (((((use_arg_then2 ("xl", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((fun arg_tac -> arg_tac (Arg_term (`MEM x h`))) (disch_eq_tac "xh" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN ((((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_find_face *) +let mem_find_face = Sections.section_proof ["d";"L"] +`MEM d (list_of_darts L) + ==> MEM (find_face L d) (list_of_faces L)` +[ + ((((use_arg_then2 ("list_of_darts_alt", [list_of_darts_alt]))(thm_tac (new_rewrite [] [])))) THEN (move ["h"])); + (((((use_arg_then2 ("find_face", [find_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_find_list", [mem_find_list]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma find_list_empty *) +let find_list_empty = Sections.section_proof ["d";"L"] +`find_list L d = [] <=> ~(MEM d (flatten L))` +[ + ((((use_arg_then2 ("mem_flatten", [mem_flatten]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_EXISTS_THM", [NOT_EXISTS_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))); + (((THENL) (((use_arg_then2 ("L", [])) (disch_tac [])) THEN (clear_assumption "L") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_list", [find_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + (((fun arg_tac -> arg_tac (Arg_term (`MEM d h`))) (disch_eq_tac "dh" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(h = [])`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))))) ((((use_arg_then2 ("dh", [])) (disch_tac [])) THEN (clear_assumption "dh") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((((use_arg_then2 ("NOT_FORALL_THM", [NOT_FORALL_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] [])))))) THEN ((use_arg_then2 ("h", [])) (term_tac exists_tac)) THEN (done_tac)); + ((((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN ((split_tac) THEN (move ["h1"]) THEN (move ["x"]))); + ((((fun arg_tac -> arg_tac (Arg_term (`x = h`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN (((fun arg_tac ->(use_arg_then2 ("eq", []))(fun tmp_arg1 -> (use_arg_then2 ("h1", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("h1", [])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac)) THEN ((((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma mem_find_list_nonempty *) +let mem_find_list_nonempty = Sections.section_proof ["x";"L"] +`all (\l. ~(l = [])) L + ==> (MEM x (flatten L) <=> MEM (find_list L x) L)` +[ + (((((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["h1"])); + ((THENL_FIRST) ((THENL) (split_tac) [ALL_TAC; (move ["h2"])]) (((use_arg_then2 ("mem_find_list", [mem_find_list])) (thm_tac apply_tac)) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("h1", [])) (fun fst_arg -> (use_arg_then2 ("h2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("find_list_empty", [find_list_empty]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_find_face_nonempty *) +let mem_find_face_nonempty = Sections.section_proof ["d";"L"] +`all (\l. ~(l = [])) L + ==> (MEM d (list_of_darts L) <=> MEM (find_face L d) (list_of_faces L))` +[ + (BETA_TAC THEN (move ["h1"])); + ((((use_arg_then2 ("find_face", [find_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_find_list_nonempty", [mem_find_list_nonempty]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("list_of_darts_alt", [list_of_darts_alt]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((in_tac ["h1"] true ((repeat_tactic 1 9 (((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (simp_tac))) THEN ((((use_arg_then2 ("list_of_faces", [list_of_faces]))(thm_tac (new_rewrite [] [])))) THEN (move ["s"]))); + ((((use_arg_then2 ("MEM_MAP", [MEM_MAP]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["l"])) THEN (case THEN (move ["l_L"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_pairs_empty", [list_pairs_empty]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h1", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma e_list_ext_involution *) +let e_list_ext_involution = Sections.section_proof ["L"] +`good_list L ==> e_list_ext L o e_list_ext L = I` +[ + (((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_list_ext", [e_list_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["h_uniq"])) THEN (case THEN (move ["all_n"])) THEN (move ["mem_snd"]) THEN (case THEN ((move ["x"]) THEN (move ["y"])))); + ((repeat_tactic 1 9 (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("e_list", [e_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SND", [SND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> arg_tac (Arg_term (`MEM (x,y) _`))) (disch_eq_tac "xy_in" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((fun arg_tac -> (use_arg_then2 ("mem_snd", [])) (fun fst_arg -> (use_arg_then2 ("xy_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (simp_tac)) THEN (((use_arg_then2 ("e_list", [e_list]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("xy_in", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; +let INVERSE_EXISTS_IMP_BIJECTIVE = prove(`!(f:A->B) g. f o g = I /\ g o f = I ==> (!y. ?!x. f x = y)`, + REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM] THEN + REPEAT STRIP_TAC THEN REWRITE_TAC[EXISTS_UNIQUE] THEN + EXISTS_TAC `(g:B->A) y` THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + POP_ASSUM (MP_TAC o AP_TERM `g:B->A`) THEN + ASM_REWRITE_TAC[]);; + +(* Lemma e_list_ext_permutes_darts *) +let e_list_ext_permutes_darts = Sections.section_proof ["L"] +`good_list L + ==> (e_list_ext L) permutes (darts_of_list L)` +[ + (((((use_arg_then2 ("permutes", [permutes]))(thm_tac (new_rewrite [] [])))) THEN (move ["good_l"])) THEN (split_tac)); + ((BETA_TAC THEN (move ["x"]) THEN (move ["x_n"])) THEN ((((use_arg_then2 ("e_list_ext", [e_list_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x_n", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((use_arg_then2 ("INVERSE_EXISTS_IMP_BIJECTIVE", [INVERSE_EXISTS_IMP_BIJECTIVE])) (thm_tac apply_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`e_list_ext L`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("e_list_ext_involution", [e_list_ext_involution]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma dart_in_darts *) +let dart_in_darts = Sections.section_proof ["d";"l";"L"] +`MEM d (list_pairs l) /\ MEM l L + ==> MEM d (list_of_darts L)` +[ + (((((use_arg_then2 ("list_of_darts_alt", [list_of_darts_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_flatten", [mem_flatten]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_faces", [list_of_faces]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM_MAP", [MEM_MAP]))(thm_tac (new_rewrite [] []))))) THEN (move ["h"])); + (((fun arg_tac -> arg_tac (Arg_term (`list_pairs l`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("l", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma mem_find_pair_list *) +let mem_find_pair_list = Sections.section_proof ["d";"L"] +`MEM d (list_of_darts L) ==> MEM (find_pair_list L d) L` +[ + (((THENL) (((use_arg_then2 ("L", [])) (disch_tac [])) THEN (clear_assumption "L") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((((use_arg_then2 ("list_of_darts", [list_of_darts]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("foldr", [foldr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("find_pair_list", [find_pair_list]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`MEM d (list_pairs h)`))) (disch_eq_tac "mem_d" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_d", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orFb", [orFb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_darts", [list_of_darts]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("Ih", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dart_in_find_pair_list *) +let dart_in_find_pair_list = Sections.section_proof ["d";"L"] +`MEM d (list_of_darts L) <=> MEM d (list_pairs (find_pair_list L d))` +[ + (((THENL) (((use_arg_then2 ("L", [])) (disch_tac [])) THEN (clear_assumption "L") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((((use_arg_then2 ("list_of_darts", [list_of_darts]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_pair_list", [find_pair_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("foldr", [foldr]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("zip", [zip]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> arg_tac (Arg_term (`MEM d (list_pairs h)`))) (disch_eq_tac "mem_d" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN ((((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_d", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("orFb", [orFb]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("list_of_darts", [list_of_darts]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dart_in_face *) +let dart_in_face = Sections.section_proof ["d";"L"] +`MEM d (list_of_darts L) <=> MEM d (find_face L d)` +[ + (((((use_arg_then2 ("find_face_alt", [find_face_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart_in_find_pair_list", [dart_in_find_pair_list]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma uniq_imp_unique_list *) +let uniq_imp_unique_list = Sections.section_proof ["l1";"l2";"d";"L"] +`uniq (list_of_darts L) /\ MEM l1 L /\ MEM l2 L + /\ MEM d (list_pairs l1) /\ MEM d (list_pairs l2) + ==> l1 = l2` +[ + (((THENL) (((use_arg_then2 ("L", [])) (disch_tac [])) THEN (clear_assumption "L") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("list_of_darts", [list_of_darts]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("foldr", [foldr]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("list_of_darts", [list_of_darts]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("cat_uniq", [cat_uniq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hasP", [hasP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("NOT_EXISTS_THM", [NOT_EXISTS_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))); + (BETA_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["uniq_h"])) THEN (case THEN (move ["not_mem"])) THEN (move ["uniq_t"]) THEN (case THEN (move ["h1"])) THEN (case THEN (move ["h2"])) THEN (case THEN (move ["d_l1"])) THEN (move ["d_l2"])); + ((THENL_LAST) (((use_arg_then2 ("h2", [])) (disch_tac [])) THEN (clear_assumption "h2") THEN ((use_arg_then2 ("h1", [])) (disch_tac [])) THEN (clear_assumption "h1") THEN case THEN (move ["h1"]) THEN (case THEN ALL_TAC) THEN (move ["h2"]) THEN ((TRY done_tac))) (((use_arg_then2 ("Ih", [])) (disch_tac [])) THEN (clear_assumption "Ih") THEN (exact_tac))); + ((((fun arg_tac -> (use_arg_then2 ("not_mem", [])) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("h1", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d_l1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((((fun arg_tac -> (use_arg_then2 ("dart_in_darts", [dart_in_darts])) (fun fst_arg -> (use_arg_then2 ("d_l2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("not_mem", [])) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("h2", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d_l2", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((((fun arg_tac -> (use_arg_then2 ("dart_in_darts", [dart_in_darts])) (fun fst_arg -> (use_arg_then2 ("d_l1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma find_pair_list_unique *) +let find_pair_list_unique = Sections.section_proof ["l";"d";"L"] +`uniq (list_of_darts L) /\ MEM l L /\ MEM d (list_pairs l) + ==> l = find_pair_list L d` +[ + (BETA_TAC THEN (case THEN (move ["uniq_darts"])) THEN (case THEN (move ["l_L"])) THEN (move ["mem_d"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("uniq_imp_unique_list", [uniq_imp_unique_list])) (fun fst_arg -> (use_arg_then2 ("uniq_darts", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("mem_d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((((use_arg_then2 ("l_L", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_face_alt", [find_face_alt]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_find_pair_list", [mem_find_pair_list]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("dart_in_darts", [dart_in_darts])) (fun fst_arg -> (use_arg_then2 ("mem_d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma uniq_find_face *) +let uniq_find_face = Sections.section_proof ["d";"L"] +`uniq (list_of_darts L) ==> uniq (find_face L d)` +[ + (((THENL) (((use_arg_then2 ("L", [])) (disch_tac [])) THEN (clear_assumption "L") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((((use_arg_then2 ("list_of_darts", [list_of_darts]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("foldr", [foldr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_face", [find_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_faces", [list_of_faces]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MAP", [MAP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_list", [find_list]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)))); + (((((use_arg_then2 ("list_of_darts", [list_of_darts]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("list_of_faces", [list_of_faces]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("find_face", [find_face]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("cat_uniq", [cat_uniq]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["uniq_h"])) THEN (case THEN (move ["_"])) THEN (move ["uniq_t"])); + ((((fun arg_tac -> arg_tac (Arg_term (`MEM d _`))) (disch_tac [])) THEN case THEN ((simp_tac THEN TRY done_tac))) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma size_list_pairs *) +let size_list_pairs = Sections.section_proof ["l"] +`sizel (list_pairs l) = sizel l` +[ + (((((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size1_zip", [size1_zip]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_list_pairs *) +let mem_list_pairs = Sections.section_proof ["x";"y";"l"] +`MEM (x,y) (list_pairs l) ==> MEM x l /\ MEM y l` +[ + (((((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("mem_zip", [mem_zip])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("mem_rot", [mem_rot]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma mem_f_list *) +let mem_f_list = Sections.section_proof ["d";"L"] +`MEM d (list_of_darts L) ==> MEM (f_list L d) (find_face L d)` +[ + ((BETA_TAC THEN (move ["mem_d"])) THEN ((((use_arg_then2 ("f_list", [f_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_next_el", [mem_next_el]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma nth_list_pairs *) +let nth_list_pairs = Sections.section_proof ["x0";"i";"s"] +`i < sizel s + ==> nth (x0, x0) (list_pairs s) i + = (nth x0 s i, nth x0 s (if i = sizel s - 1 then 0 else i + 1))` +[ + ((BETA_TAC THEN (move ["i_lt"])) THEN ((((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_zip", [nth_zip]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("nth_shift_left", [nth_shift_left]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fun_if", [fun_if]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma uniq_list_pairs *) +let uniq_list_pairs = Sections.section_proof ["s"] +`uniq s ==> uniq (list_pairs s)` +[ + ((fun arg_tac -> arg_tac (Arg_term (`HD s`))) (term_tac (set_tac "x0"))); + (((((fun arg_tac -> (use_arg_then2 ("uniq_nthP", [uniq_nthP])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("uniq_nthP", [uniq_nthP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x0, x0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_list_pairs", [size_list_pairs]))(thm_tac (new_rewrite [] []))))) THEN (move ["h"]) THEN (move ["i"]) THEN (move ["j"]) THEN (case THEN (move ["i_lt_j"])) THEN (move ["j_lt"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("i_lt_j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("nth_list_pairs", [nth_list_pairs]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((((use_arg_then2 ("j_lt", [])) (disch_tac [])) THEN (clear_assumption "j_lt") THEN ((use_arg_then2 ("i_lt_j", [])) (disch_tac [])) THEN (clear_assumption "i_lt_j") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma mem_list_pairs_explicit *) +let mem_list_pairs_explicit = Sections.section_proof ["x";"y";"s"] +`uniq s /\ MEM (x,y) (list_pairs s) + ==> y = next_el s x` +[ + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nthP", [nthP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x,y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x,x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_list_pairs", [size_list_pairs]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["uniq_s"])) THEN (case THEN (move ["i"]))); + (((((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_zip", [nth_zip]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["i_lt"])) THEN (case THEN (move ["x_eq"])) THEN (move ["y_eq"])); + ((THENL_FIRST) (((fun arg_tac -> (use_arg_then2 ("next_el_alt", [next_el_alt])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nthP", [nthP])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("i", [])) (term_tac exists_tac)) THEN (done_tac))); + (((((use_arg_then2 ("y_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("x_eq", []))(gsym_then (thm_tac (new_rewrite [3] []))))) THEN (((use_arg_then2 ("index_uniq", [index_uniq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma index_fst_snd *) +let index_fst_snd = Sections.section_proof ["x0";"i";"x";"y";"s"] +`uniq s /\ i < sizel s /\ nth (x0,x0) (list_pairs s) i = (x,y) + ==> indexl x s = i /\ indexl y s = if (i = sizel s - 1) then 0 else i + 1` +[ + (BETA_TAC THEN (case THEN (move ["uniq_s"])) THEN (case THEN (move ["i_lt"])) THEN (simp_tac)); + (((((use_arg_then2 ("nth_list_pairs", [nth_list_pairs]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("index_uniq", [index_uniq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("uniq_s", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma next_el_list_pairs *) +let next_el_list_pairs = Sections.section_proof ["x";"y";"s"] +`uniq s /\ MEM (x,y) (list_pairs s) + ==> next_el (list_pairs s) (x,y) = (y, next_el s y)` +[ + (BETA_TAC THEN (case THEN ((move ["uniq_s"]) THEN (move ["mem_d"])))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`MEM y s`))) (term_tac (have_gen_tac [](move ["ys"])))) ((((fun arg_tac -> (use_arg_then2 ("mem_list_pairs", [mem_list_pairs])) (fun fst_arg -> (use_arg_then2 ("mem_d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("next_el_alt", [next_el_alt])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x,x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("next_el_alt", [next_el_alt])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`indexl _1 _2`))) (term_tac (set_tac "i"))); + ((fun arg_tac -> arg_tac (Arg_term (`nth (x,x) (list_pairs s) i = x,y`))) (term_tac (have_gen_tac [](move ["nth_i"])))); + (((((use_arg_then2 ("i_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_index", [nth_index]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`i < sizel s`))) (term_tac (have_gen_tac [](move ["i_lt"])))); + (((((use_arg_then2 ("i_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_list_pairs", [size_list_pairs]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("nth_shift_left", [nth_shift_left]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_list_pairs", [size_list_pairs]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("index_fst_snd", [index_fst_snd])) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`i = sizel s - 1`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((THENL_FIRST) (((use_arg_then2 ("nth_list_pairs", [nth_list_pairs]))(thm_tac (new_rewrite [] [])))) ((((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (split_tac)); + (((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_index", [nth_index])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("index_fst_snd", [index_fst_snd])) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> arg_tac (Arg_term (`0 = sizel s - 1`))) (disch_eq_tac "eq2" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN (((use_arg_then2 ("eq2", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) (((use_arg_then2 ("nth_list_pairs", [nth_list_pairs]))(thm_tac (new_rewrite [] [])))) ((((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (split_tac)); + (((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_index", [nth_index])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("index_fst_snd", [index_fst_snd])) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> arg_tac (Arg_term (`i + 1 = _`))) (disch_eq_tac "eq2" [])) THEN case THEN (process_fst_eq_tac)) THEN (done_tac)); +];; + +(* Lemma prev_el_list_pairs *) +let prev_el_list_pairs = Sections.section_proof ["x";"y";"s"] +`uniq s /\ MEM (x,y) (list_pairs s) + ==> prev_el (list_pairs s) (x,y) = (prev_el s x, x)` +[ + (BETA_TAC THEN (case THEN ((move ["uniq_s"]) THEN (move ["mem_d"])))); + ((fun arg_tac -> arg_tac (Arg_term (`prev_el _1 _2`))) (term_tac (set_tac "t"))); + ((fun arg_tac -> arg_tac (Arg_term (`MEM t (list_pairs s)`))) (term_tac (have_gen_tac [](move ["mem_t"])))); + (((((use_arg_then2 ("t_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_prev_el", [mem_prev_el]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("t_def", [])) (disch_tac [])) THEN (clear_assumption "t_def") THEN ((use_arg_then2 ("mem_t", [])) (disch_tac [])) THEN (clear_assumption "mem_t") THEN ((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN case THEN (move ["a"]) THEN (move ["b"]) THEN (move ["mem_t"]) THEN (move ["t_def"])); + ((fun arg_tac -> arg_tac (Arg_term (`b = next_el s a`))) (term_tac (have_gen_tac []ALL_TAC))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mem_list_pairs_explicit", [mem_list_pairs_explicit])) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("mem_t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("congr1", [congr1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`prev_el s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC); + (((((use_arg_then2 ("prev_next_id", [prev_next_id]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("mem_list_pairs", [mem_list_pairs])) (fun fst_arg -> (use_arg_then2 ("mem_t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`b = x`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))))))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("congr1", [congr1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`next_el (list_pairs s)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("t_def", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((((use_arg_then2 ("next_prev_id", [next_prev_id]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uniq_list_pairs", [uniq_list_pairs]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("next_el_list_pairs", [next_el_list_pairs]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma f_list_inverse *) +let f_list_inverse = Sections.section_proof ["d";"L"] +`uniq (list_of_darts L) /\ MEM d (list_of_darts L) + ==> f_list L (prev_el (find_face L d) d) = d + /\ prev_el (find_face L (f_list L d)) (f_list L d) = d` +[ + ((BETA_TAC THEN (case THEN ((move ["uniq_s"]) THEN (move ["mem_d"])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("f_list", [f_list]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`find_face L d`))) (term_tac (set_tac "f"))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`find_face L (prev_el f d) = f`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + (((((use_arg_then2 ("next_prev_id", [next_prev_id]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("uniq_find_face", [uniq_find_face]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("find_face_alt", [find_face_alt]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))) THEN ((congr_tac (`_1 _2`)) THEN ((TRY done_tac)))); + (((fun arg_tac -> (use_arg_then2 ("find_pair_list_unique", [find_pair_list_unique])) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("mem_find_pair_list", [mem_find_pair_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("find_face_alt", [find_face_alt]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_prev_el", [mem_prev_el]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`find_face L d`))) (term_tac (set_tac "f"))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`find_face L (next_el f d) = f`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + (((((use_arg_then2 ("prev_next_id", [prev_next_id]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("uniq_find_face", [uniq_find_face]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("find_face_alt", [find_face_alt]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))) THEN ((congr_tac (`_1 _2`)) THEN ((TRY done_tac)))); + (((fun arg_tac -> (use_arg_then2 ("find_pair_list_unique", [find_pair_list_unique])) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("mem_find_pair_list", [mem_find_pair_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("find_face_alt", [find_face_alt]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_next_el", [mem_next_el]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma find_face_f_list *) +let find_face_f_list = Sections.section_proof ["d";"L"] +`uniq (list_of_darts L) /\ MEM d (list_of_darts L) + ==> find_face L (f_list L d) = find_face L d` +[ + (BETA_TAC THEN (case THEN ((move ["uniq_s"]) THEN (move ["mem_d"])))); + (((repeat_tactic 1 9 (((use_arg_then2 ("find_face_alt", [find_face_alt]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))) THEN ((congr_tac (`_1 _2`)) THEN ((TRY done_tac)))); + (((fun arg_tac -> (use_arg_then2 ("find_pair_list_unique", [find_pair_list_unique])) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((((use_arg_then2 ("mem_find_pair_list", [mem_find_pair_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("find_face_alt", [find_face_alt]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_f_list", [mem_f_list]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma f_list_ext_permutes_darts *) +let f_list_ext_permutes_darts = Sections.section_proof ["L"] +`uniq (list_of_darts L) + ==> (f_list_ext L) permutes (darts_of_list L)` +[ + (BETA_TAC THEN (move ["uniq_s"])); + ((((use_arg_then2 ("f_list_ext", [f_list_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Hypermap_and_fan.RES_PERMUTES", [Hypermap_and_fan.RES_PERMUTES]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))))); + ((THENL) (split_tac) [((move ["d"]) THEN (move ["mem_d"])); ALL_TAC]); + (((((use_arg_then2 ("dart_in_face", [dart_in_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_face_f_list", [find_face_f_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mem_f_list", [mem_f_list]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_ROT (-1)) ((THENL) (split_tac) [((move ["d"]) THEN (move ["mem_d"])); ((move ["d1"]) THEN (move ["d2"]) THEN (case THEN (move ["mem_d1"])) THEN (case THEN (move ["mem_d2"])) THEN (move ["eq"]))])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_list_inverse", [f_list_inverse])) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("mem_d1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["_"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))))))); + (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_list_inverse", [f_list_inverse])) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("mem_d2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`prev_el (find_face L d) d`))) (term_tac exists_tac)); + ((((use_arg_then2 ("f_list_inverse", [f_list_inverse]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("dart_in_face", [dart_in_face]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`find_face L d`))) (term_tac (set_tac "f"))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`find_face L (prev_el f d) = f`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + (((((use_arg_then2 ("mem_prev_el", [mem_prev_el]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("find_face_alt", [find_face_alt]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))) THEN ((congr_tac (`_1 _2`)) THEN ((TRY done_tac)))); + (((fun arg_tac -> (use_arg_then2 ("find_pair_list_unique", [find_pair_list_unique])) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("mem_find_pair_list", [mem_find_pair_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("find_face_alt", [find_face_alt]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_prev_el", [mem_prev_el]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma find_face_empty *) +let find_face_empty = Sections.section_proof ["d";"L"] +`find_face L d = [] <=> ~MEM d (list_of_darts L)` +[ + (((((use_arg_then2 ("find_face", [find_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_list_empty", [find_list_empty]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_darts_alt", [list_of_darts_alt]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_find_face_imp_faces_eq *) +let mem_find_face_imp_faces_eq = Sections.section_proof ["d1";"d2";"L"] +`uniq (list_of_darts L) /\ MEM d1 (find_face L d2) + ==> find_face L d1 = find_face L d2` +[ + (BETA_TAC THEN (case THEN ((move ["uniq_s"]) THEN (move ["mem_d1"])))); + (((repeat_tactic 1 9 (((use_arg_then2 ("find_face_alt", [find_face_alt]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))) THEN ((congr_tac (`_1 _2`)) THEN ((TRY done_tac)))); + (((fun arg_tac -> (use_arg_then2 ("find_pair_list_unique", [find_pair_list_unique])) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("find_face_alt", [find_face_alt]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_d1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_find_pair_list", [mem_find_pair_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((use_arg_then2 ("mem_d1", [])) (disch_tac [])) THEN (clear_assumption "mem_d1") THEN ((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac)); + (((((use_arg_then2 ("find_face_empty", [find_face_empty]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma mem_find_face_imp_mem_darts *) +let mem_find_face_imp_mem_darts = Sections.section_proof ["d";"y";"L"] +`MEM d (find_face L y) ==> MEM d (list_of_darts L)` +[ + (((THENL) (((use_arg_then2 ("L", [])) (disch_tac [])) THEN (clear_assumption "L") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((((use_arg_then2 ("find_face", [find_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_darts", [list_of_darts]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("foldr", [foldr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_faces", [list_of_faces]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MAP", [MAP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_list", [find_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("list_of_darts", [list_of_darts]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`MEM y _`))) (disch_eq_tac "mem_y" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((((use_arg_then2 ("list_of_faces", [list_of_faces]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("find_face", [find_face]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("Ih", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma f_list_ext_inverse *) +let f_list_ext_inverse = Sections.section_proof ["L"] +`uniq (list_of_darts L) + ==> inverse (f_list_ext L) = res (\d. prev_el (find_face L d) d) (darts_of_list L)` +[ + ((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (move ["uniq_s"]) THEN (move ["d"])); + (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSE_EQ", [PERMUTES_INVERSE_EQ])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("f_list_ext_permutes_darts", [f_list_ext_permutes_darts])) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))); + ((((use_arg_then2 ("f_list_ext", [f_list_ext]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))))); + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`MEM d _`))) (disch_eq_tac "mem_d" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("mem_d", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`MEM _1 _2`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac)))))) ((((use_arg_then2 ("f_list_inverse", [f_list_inverse]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((use_arg_then2 ("mem_find_face_imp_mem_darts", [mem_find_face_imp_mem_darts])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("d", [])) (term_tac exists_tac))); + (((((use_arg_then2 ("mem_prev_el", [mem_prev_el]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma f_list_ext_inverse_works *) +let f_list_ext_inverse_works = Sections.section_proof ["L"] +`uniq (list_of_darts L) + ==> f_list_ext L o inverse (f_list_ext L) = I + /\ inverse (f_list_ext L) o f_list_ext L = I` +[ + (BETA_TAC THEN (move ["uniq_s"])); + (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES_o", [PERMUTES_INVERSES_o])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("f_list_ext_permutes_darts", [f_list_ext_permutes_darts])) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +];; + +(* Lemma n_eq_e_fi *) +let n_eq_e_fi = Sections.section_proof ["L"] +`uniq (list_of_darts L) + ==> n_list_ext L = e_list_ext L o inverse (f_list_ext L)` +[ + (BETA_TAC THEN (move ["uniq_s"])); + (((((use_arg_then2 ("f_list_ext_inverse", [f_list_ext_inverse]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_list_ext", [n_list_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_list_ext", [e_list_ext]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["d"])); + ((((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))))); + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`MEM d _`))) (disch_eq_tac "mem_d" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("mem_d", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`MEM _1 _2`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac)))))) ((((use_arg_then2 ("n_list", [n_list]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((use_arg_then2 ("mem_find_face_imp_mem_darts", [mem_find_face_imp_mem_darts])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("d", [])) (term_tac exists_tac))); + (((((use_arg_then2 ("mem_prev_el", [mem_prev_el]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma n_list_ext_permutes_darts *) +let n_list_ext_permutes_darts = Sections.section_proof ["L"] +`good_list L + ==> (n_list_ext L) permutes (darts_of_list L)` +[ + ((BETA_TAC THEN (move ["good_s"])) THEN (((use_arg_then2 ("good_s", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["uniq_s"])) THEN (move ["_"]))); + ((((use_arg_then2 ("n_eq_e_fi", [n_eq_e_fi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("PERMUTES_COMPOSE", [PERMUTES_COMPOSE]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("e_list_ext_permutes_darts", [e_list_ext_permutes_darts]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("PERMUTES_INVERSE", [PERMUTES_INVERSE]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((fun arg_tac -> (use_arg_then2 ("f_list_ext_permutes_darts", [f_list_ext_permutes_darts])) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +];; + +(* Lemma e_n_f_id *) +let e_n_f_id = Sections.section_proof ["L"] +`good_list L + ==> e_list_ext L o n_list_ext L o f_list_ext L = I` +[ + ((BETA_TAC THEN (move ["good_s"])) THEN (((use_arg_then2 ("good_s", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["uniq_s"])) THEN (move ["_"]))); + (((((use_arg_then2 ("n_eq_e_fi", [n_eq_e_fi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("e_list_ext_involution", [e_list_ext_involution]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("I_O_ID", [I_O_ID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_list_ext_inverse_works", [f_list_ext_inverse_works]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma tuple_hypermap_of_list *) +let tuple_hypermap_of_list = Sections.section_proof ["L"] +`good_list L + ==> tuple_hypermap (hypermap_of_list L) = + darts_of_list L, e_list_ext L, n_list_ext L, f_list_ext L` +[ + ((BETA_TAC THEN (move ["good_s"])) THEN (((use_arg_then2 ("good_s", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["uniq_s"])) THEN (move ["_"]))); + ((((use_arg_then2 ("hypermap_of_list", [hypermap_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (CONJUNCT2 hypermap_tybij)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((((use_arg_then2 ("e_list_ext_permutes_darts", [e_list_ext_permutes_darts]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("n_list_ext_permutes_darts", [n_list_ext_permutes_darts]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_list_ext_permutes_darts", [f_list_ext_permutes_darts]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("e_n_f_id", [e_n_f_id]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_SET_OF_LIST", [FINITE_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma f_list_ext_orbit *) +let f_list_ext_orbit = Sections.section_proof ["L";"x"] +`MEM x (list_of_darts L) /\ uniq (list_of_darts L) + ==> orbit_map (f_list_ext L) x = set_of_list (find_face L x)` +[ + (BETA_TAC THEN (case THEN ((move ["mem_x"]) THEN (move ["uniq_l"])))); + ((((use_arg_then2 ("f_list_ext", [f_list_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ORBIT_MAP_RES", [ORBIT_MAP_RES]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("f_list_ext", [f_list_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_list_ext_permutes_darts", [f_list_ext_permutes_darts]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`MEM x (find_face L x)`))) (term_tac (have_gen_tac [](move ["x_in_face"])))) ((((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`orbit_map (f_list L) x = orbit_map (next_el (find_face L x)) x`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + (((((use_arg_then2 ("next_el_orbit", [next_el_orbit]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("uniq_find_face", [uniq_find_face]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`(f_list L POWER n) x = (next_el (find_face L x) POWER n) x`))) (term_tac (have_gen_tac ["n"](move ["eq"]))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("orbit_map", [orbit_map]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["Ih"]))]) ((repeat_tactic 1 9 (((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("COM_POWER", [COM_POWER]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_list", [f_list]))(thm_tac (new_rewrite [] []))))); + ((congr_tac (`next_el _1 _2`)) THEN ((TRY done_tac))); + (((fun arg_tac -> (use_arg_then2 ("mem_find_face_imp_faces_eq", [mem_find_face_imp_faces_eq])) (fun fst_arg -> (use_arg_then2 ("uniq_l", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((((fun arg_tac -> (use_arg_then2 ("next_el_power", [next_el_power])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uniq_find_face", [uniq_find_face]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("mem_nth", [mem_nth]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIVISION", [DIVISION]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("x_in_face", [])) (disch_tac [])) THEN (clear_assumption "x_in_face") THEN BETA_TAC) THEN (((use_arg_then2 ("index_mem", [index_mem]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma uniq_flatten *) +let uniq_flatten = Sections.section_proof ["L"] +`uniq (flatten L) /\ all (\l. ~(l = [])) L ==> uniq L` +[ + (((THENL) (((use_arg_then2 ("L", [])) (disch_tac [])) THEN (clear_assumption "L") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((((use_arg_then2 ("uniq", [uniq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("flatten", [flatten]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("all", [all]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("foldr", [foldr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat_uniq", [cat_uniq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("flatten", [flatten]))(gsym_then (thm_tac (new_rewrite [] []))))))); + (BETA_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["uniq_h"])) THEN (case THEN (move ["not_has"])) THEN (move ["uniq_t"]) THEN (case THEN (move ["h_n0"])) THEN (move ["all_t"])); + ((((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("not_has", [])) (disch_tac [])) THEN (clear_assumption "not_has") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("hasP", [hasP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["ht"]))); + ((((use_arg_then2 ("h_n0", [])) (disch_tac [])) THEN (clear_assumption "h_n0") THEN BETA_TAC) THEN (((((use_arg_then2 ("size_eq0", [size_eq0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lt0n", [lt0n]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("has_predT", [has_predT]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hasP", [hasP]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN (move ["xh"])) THEN (move ["_"]))); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("xh", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("mem_flatten", [mem_flatten]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("h", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma flatten_filter_empty *) +let flatten_filter_empty = Sections.section_proof ["L"] +`flatten (filter (\l. ~(l = [])) L) = flatten L` +[ + (((THENL) (((use_arg_then2 ("L", [])) (disch_tac [])) THEN (clear_assumption "L") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((((use_arg_then2 ("flatten", [flatten]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("filter", [filter]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("foldr", [foldr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("flatten", [flatten]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`h = []`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("flatten", [flatten]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("foldr", [foldr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("flatten", [flatten]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma uniq_sublist_unique *) +let uniq_sublist_unique = Sections.section_proof ["l1";"l2";"L";"x"] +`uniq (flatten L) /\ MEM l1 L /\ MEM l2 L + /\ MEM x l1 /\ MEM x l2 + ==> l1 = l2` +[ + (((THENL) (((use_arg_then2 ("L", [])) (disch_tac [])) THEN (clear_assumption "L") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("flatten_cons", [flatten_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat_uniq", [cat_uniq]))(thm_tac (new_rewrite [] [])))))); + (BETA_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["uniq_h"])) THEN (case THEN (move ["not_has"])) THEN (move ["uniq_t"]) THEN (case THEN (move ["c1"])) THEN (case THEN (move ["c2"])) THEN (case THEN (move ["x_l1"])) THEN (move ["x_l2"])); + ((THENL_LAST) (((THENL) (((use_arg_then2 ("c2", [])) (disch_tac [])) THEN (clear_assumption "c2") THEN ((use_arg_then2 ("c1", [])) (disch_tac [])) THEN (clear_assumption "c1") THEN case) [(move ["eq1"]); (move ["l1t"])]) THEN ((THENL) case [(move ["eq2"]); (move ["l2t"])]) THEN ((TRY done_tac))) ((((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("not_has", [])) (disch_tac [])) THEN (clear_assumption "not_has") THEN ((use_arg_then2 ("contraR", [contraR])) (disch_tac [])) THEN (clear_assumption "contraR") THEN (DISCH_THEN apply_tac) THEN (move ["_"])) THEN ((((use_arg_then2 ("hasP", [hasP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("mem_flatten", [mem_flatten]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq1", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("x_l1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("l2", [])) (term_tac exists_tac)) THEN (done_tac)); + ((((use_arg_then2 ("not_has", [])) (disch_tac [])) THEN (clear_assumption "not_has") THEN ((use_arg_then2 ("contraR", [contraR])) (disch_tac [])) THEN (clear_assumption "contraR") THEN (DISCH_THEN apply_tac) THEN (move ["_"])) THEN ((((use_arg_then2 ("hasP", [hasP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("mem_flatten", [mem_flatten]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq2", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("x_l2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("l1", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma uniq_face_unique *) +let uniq_face_unique = Sections.section_proof ["f1";"f2";"d";"L"] +`uniq (list_of_darts L) + /\ MEM f1 (list_of_faces L) /\ MEM f2 (list_of_faces L) /\ MEM d f1 /\ MEM d f2 + ==> f1 = f2` +[ + (BETA_TAC THEN (case THEN (move ["uniq_l"])) THEN (case THEN (move ["mem_f1"])) THEN (case THEN (move ["mem_f2"])) THEN (case THEN (move ["mem_d1"])) THEN (move ["mem_d2"])); + ((use_arg_then2 ("uniq_sublist_unique", [uniq_sublist_unique])) (thm_tac apply_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`list_of_faces L`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("d", [])) (term_tac exists_tac))); + ((((use_arg_then2 ("list_of_darts_alt", [list_of_darts_alt]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_face_lemma *) +let mem_face_lemma = Sections.section_proof ["f";"L"] +`good_list L /\ MEM f (list_of_faces L) + ==> ?d. MEM d (list_of_darts L) /\ f = find_face L d` +[ + ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["uniq_s"])) THEN (case THEN (move ["all_n0"])) THEN (move ["_"]) THEN (move ["mem_f"])); + ((fun arg_tac -> arg_tac (Arg_term (`HD f`))) (term_tac exists_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`~(f = [])`))) (term_tac (have_gen_tac [](move ["f_n0"])))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`all (\l. ~(l = [])) (list_of_faces L)`))) (term_tac (have_gen_tac []ALL_TAC)))); + ((((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("allPn", [allPn]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["f_eq"])) THEN ((use_arg_then2 ("f", [])) (term_tac exists_tac)) THEN (done_tac)); + (((((use_arg_then2 ("list_of_faces", [list_of_faces]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("map_MAP", [map_MAP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("all_map", [all_map]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("preim", [preim]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["x"]) THEN (move ["x_L"]) THEN (simp_tac)); + (((use_arg_then2 ("list_pairs_empty", [list_pairs_empty]))(thm_tac (new_rewrite [] [])))); + ((((use_arg_then2 ("all_n0", [])) (disch_tac [])) THEN (clear_assumption "all_n0") THEN BETA_TAC) THEN ((((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("x_L", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`MEM (HD f) f`))) (term_tac (have_gen_tac [](move ["mem_hd"])))); + ((((use_arg_then2 ("f_n0", [])) (disch_tac [])) THEN (clear_assumption "f_n0") THEN ((use_arg_then2 ("f", [])) (disch_tac [])) THEN (clear_assumption "f") THEN case THEN ((TRY done_tac)) THEN (move ["h"]) THEN (move ["t"])) THEN ((((use_arg_then2 ("HD", [HD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("dart_in_face", [dart_in_face]))(thm_tac (new_rewrite [] [])))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`find_face L (HD f) = f`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((ALL_TAC) THEN (done_tac))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("uniq_face_unique", [uniq_face_unique])) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`HD f`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`MEM (HD f) (list_of_darts L)`))) (term_tac (have_gen_tac [](move ["mem_hd2"]))))); + (((((use_arg_then2 ("mem_find_face", [mem_find_face]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("list_of_darts_alt", [list_of_darts_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_flatten", [mem_flatten]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("f", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma face_set_eq_list *) +let face_set_eq_list = Sections.section_proof ["L"] +`good_list L + ==> face_set (hypermap_of_list L) = set_of_list (faces_of_list L)` +[ + ((BETA_TAC THEN (move ["good_s"])) THEN (((use_arg_then2 ("good_s", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["uniq_s"])) THEN (case THEN (move ["all_n0"])) THEN (move ["_"]))); + ((((use_arg_then2 ("face_set", [face_set]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("face_map", [face_map]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart", [dart]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("tuple_hypermap_of_list", [tuple_hypermap_of_list]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); + (((((use_arg_then2 ("set_of_orbits", [set_of_orbits]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["f"])); + ((((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))); + ((THENL) (split_tac) [((case THEN (move ["d"])) THEN (case THEN (move ["mem_d"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); ALL_TAC]); + ((((use_arg_then2 ("f_list_ext_orbit", [f_list_ext_orbit]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("faces_of_list", [faces_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM_MAP", [MEM_MAP]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`find_face L d`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("mem_find_face", [mem_find_face]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((use_arg_then2 ("faces_of_list", [faces_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM_MAP", [MEM_MAP]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["ff"])) THEN (case THEN (move ["mem_ff"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mem_face_lemma", [mem_face_lemma])) (fun fst_arg -> (use_arg_then2 ("good_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("mem_ff", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["d"]) THEN (case THEN (move ["mem_d"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + (((use_arg_then2 ("d", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("f_list_ext_orbit", [f_list_ext_orbit]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma components_hypermap_of_list *) +let components_hypermap_of_list = Sections.section_proof ["L"] +`good_list L + ==> dart (hypermap_of_list L) = darts_of_list L + /\ edge_map (hypermap_of_list L) = e_list_ext L + /\ node_map (hypermap_of_list L) = n_list_ext L + /\ face_map (hypermap_of_list L) = f_list_ext L` +[ + (BETA_TAC THEN (move ["good_s"])); + ((((use_arg_then2 ("dart", [dart]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("edge_map", [edge_map]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("node_map", [node_map]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("face_map", [face_map]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("tuple_hypermap_of_list", [tuple_hypermap_of_list]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma node_of_list_lemma *) +let node_of_list_lemma = Sections.section_proof ["x";"L"] +`set_of_list (filter (\d. FST d = x) (list_of_darts L)) + = {(x, y) | y | (x, y) IN darts_of_list L}` +[ + (((((use_arg_then2 ("set_of_list_filter", [set_of_list_filter]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["d"])); + ((THENL) (split_tac) [((case THEN (move ["y"])) THEN (move ["h"])); ((case THEN (move ["y"])) THEN (move ["h"]))]); + (((fun arg_tac -> arg_tac (Arg_term (`SND d`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("PAIR", [PAIR]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("d", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma image_lemma *) +let image_lemma = Sections.section_proof ["f";"s"] +`{f x | x IN s} = IMAGE f s` +[ + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("andbC", [andbC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma set_nodes_of_list *) +let set_nodes_of_list = Sections.section_proof ["L"] +`set_of_list (nodes_of_list L) + = {{(x, y) | y | (x, y) IN darts_of_list L} | x | x IN elements_of_list L}` +[ + ((((use_arg_then2 ("nodes_of_list", [nodes_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_nodes", [list_of_nodes]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("SET_OF_LIST_MAP", [SET_OF_LIST_MAP]))(thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("image_lemma", [image_lemma]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("elements_of_list", [elements_of_list]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["y"])); + ((THENL) (split_tac) [((case THEN (move ["n"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["i"])) THEN (move ["h"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); ((case THEN (move ["i"])) THEN (move ["h"]))]); + (((use_arg_then2 ("i", [])) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("node_of_list_lemma", [node_of_list_lemma]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`filter (\d. FST d = i) (list_of_darts L)`))) (term_tac exists_tac)); + ((((use_arg_then2 ("node_of_list_lemma", [node_of_list_lemma]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + (((use_arg_then2 ("i", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma good_list_node *) +let good_list_node = Sections.section_proof ["L";"d"] +`good_list L /\ good_list_nodes L /\ d IN darts_of_list L + ==> node (hypermap_of_list L) d = {(FST d, y) | y | (FST d, y) IN darts_of_list L}` +[ + ((((use_arg_then2 ("good_list_nodes", [good_list_nodes]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("node_set", [node_set]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_of_orbits", [set_of_orbits]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("node", [node]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("set_nodes_of_list", [set_nodes_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["good_s"])) THEN (case THEN (move ["eq"])) THEN (move ["d_in"])); + (((fun arg_tac -> (use_arg_then2 ("eq", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`node (hypermap_of_list L) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((fun arg_tac -> arg_tac (Arg_term (`?x. _ x`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))))); + (((use_arg_then2 ("d", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN (move ["x_in"])) THEN (move ["eq"])) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`x = FST d`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((ALL_TAC) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("node_refl", [node_refl])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`hypermap_of_list L`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["y"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma prev_el_list_pairs_general *) +let prev_el_list_pairs_general = Sections.section_proof ["x";"y";"s"] +`MEM (x,y) (list_pairs s) + ==> ?z. prev_el (list_pairs s) (x,y) = (z,x) /\ MEM (z,x) (list_pairs s)` +[ + (BETA_TAC THEN (move ["mem_xy"])); + ((fun arg_tac -> arg_tac (Arg_term (`FST (prev_el (list_pairs s) (x,y))`))) (term_tac (set_tac "z"))); + ((use_arg_then2 ("z", [])) (term_tac exists_tac)); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`_1 = _2`))) (term_tac (have_gen_tac [](move ["eq"]))))) (((((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_prev_el", [mem_prev_el]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`SND (prev_el (list_pairs s) (x,y)) = x`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [2] []))))))))) (((((use_arg_then2 ("z_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("PAIR", [PAIR]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("prev_el_alt", [prev_el_alt])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x,x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`indexl (x,y) _`))) (term_tac (set_tac "k"))); + ((fun arg_tac -> arg_tac (Arg_term (`sizel s`))) (term_tac (set_tac "n"))); + ((fun arg_tac -> arg_tac (Arg_term (`k < n:num`))) (term_tac (have_gen_tac [](move ["k_lt"])))); + (((((use_arg_then2 ("k_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_list_pairs", [size_list_pairs]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`nth x s k = x`))) (term_tac (have_gen_tac [](move ["nth_s"])))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_index", [nth_index])) (fun fst_arg -> (use_arg_then2 ("mem_xy", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x,x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((((use_arg_then2 ("k_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_zip", [nth_zip]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("nth_shift_right", [nth_shift_right]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_list_pairs", [size_list_pairs]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`k = 0`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((THENL_LAST) ((((use_arg_then2 ("nth_zip", [nth_zip]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SND", [SND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_shift_left", [nth_shift_left]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) (((((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_s", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((((use_arg_then2 ("nth_zip", [nth_zip]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SND", [SND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_shift_left", [nth_shift_left]))(thm_tac (new_rewrite [] []))))) ((((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) (((use_arg_then2 ("subnK", [subnK]))(thm_tac (new_rewrite [] [])))) ((((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("nth_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN ((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma n_list_ext_fst *) +let n_list_ext_fst = Sections.section_proof ["x";"y";"L"] +`good_list L /\ (x,y) IN darts_of_list L + ==> ?z. n_list_ext L (x,y) = (x,z) /\ (x,z) IN darts_of_list L` +[ + (BETA_TAC THEN (case THEN ((move ["good_s"]) THEN (move ["xy_in"])))); + ((((use_arg_then2 ("xy_in", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart_in_face", [dart_in_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_face_alt", [find_face_alt]))(thm_tac (new_rewrite [] []))))) THEN (move ["mem_xy"]))); + ((fun arg_tac -> (use_arg_then2 ("prev_el_list_pairs_general", [prev_el_list_pairs_general])) (fun fst_arg -> (use_arg_then2 ("mem_xy", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["z"]) THEN (case THEN ((move ["eq"]) THEN (move ["mem_zx"]))))))); + ((use_arg_then2 ("z", [])) (term_tac exists_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`_1 = _2`))) (term_tac (have_gen_tac [](move ["n_eq"])))); + (((((use_arg_then2 ("n_list_ext", [n_list_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_list", [n_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xy_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("find_face_alt", [find_face_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_list", [e_list]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("n_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_ext_power_in_darts *) +let list_ext_power_in_darts = Sections.section_proof ["d";"L";"n"] +`good_list L /\ d IN darts_of_list L + ==> (e_list_ext L POWER n) d IN darts_of_list L /\ + (n_list_ext L POWER n) d IN darts_of_list L /\ + (f_list_ext L POWER n) d IN darts_of_list L` +[ + ((BETA_TAC THEN (case THEN (move ["good_s"]))) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))) THEN (move ["d_in"]))); + ((((use_arg_then2 ("lemma_dart_invariant_power_node", [lemma_dart_invariant_power_node]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("lemma_dart_invariant_power_face", [lemma_dart_invariant_power_face]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + (((use_arg_then2 ("Hypermap_iso.IN_TRANS", [Hypermap_iso.IN_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`edge (hypermap_of_list L) d`))) (term_tac exists_tac))); + (((((use_arg_then2 ("lemma_edge_subset", [lemma_edge_subset]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("lemma_in_edge2", [lemma_in_edge2]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fst_n_list_ext_power *) +let fst_n_list_ext_power = Sections.section_proof ["x";"y";"L";"n"] +`good_list L /\ x,y IN darts_of_list L + ==> FST ((n_list_ext L POWER n) (x,y)) = x` +[ + (BETA_TAC THEN (case THEN ((move ["good_s"]) THEN (move ["xy_in"])))); + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["Ih"]))]) (((((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`(n_list_ext L POWER n) (x,y)`))) (term_tac (set_tac "d"))); + ((((use_arg_then2 ("COM_POWER", [COM_POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_def", []))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("n_list_ext_fst", [n_list_ext_fst])) (fun fst_arg -> (use_arg_then2 ("good_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`FST d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SND d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("PAIR", [PAIR]))(thm_tac (new_rewrite [] [])))) THEN (ANTS_TAC)); + (((((use_arg_then2 ("d_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("list_ext_power_in_darts", [list_ext_power_in_darts]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (case THEN (move ["z"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_list_pairs_exists *) +let mem_list_pairs_exists = Sections.section_proof ["x";"l"] +`MEM x l <=> ?y. MEM (x,y) (list_pairs l)` +[ + ((THENL) (split_tac) [(move ["mem_x"]); ((case THEN (move ["y"])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("mem_list_pairs", [mem_list_pairs])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (simp_tac))]); + ((fun arg_tac -> arg_tac (Arg_term (`next_el l x`))) (term_tac exists_tac)); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nthP", [nthP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x,next_el l x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x,x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`indexl x l`))) (term_tac exists_tac)); + ((((use_arg_then2 ("size_list_pairs", [size_list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_x", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("nth_list_pairs", [nth_list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("nth_index", [nth_index]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("next_el", [next_el]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth0", [nth0]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> arg_tac (Arg_term (`indexl x l = _`))) (disch_tac [])) THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma mem_list_of_darts *) +let mem_list_of_darts = Sections.section_proof ["d";"L"] +`MEM d (list_of_darts L) + <=> ?l. MEM l L /\ MEM d (list_pairs l)` +[ + ((THENL_LAST) ((THENL) (split_tac) [ALL_TAC; ((case THEN (move ["l"])) THEN (case THEN ((move ["mem_l"]) THEN (move ["mem_d"]))))]) (((use_arg_then2 ("dart_in_darts", [dart_in_darts])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("l", [])) (term_tac exists_tac)) THEN (done_tac))); + (((THENL) (((use_arg_then2 ("L", [])) (disch_tac [])) THEN (clear_assumption "L") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((((use_arg_then2 ("list_of_darts", [list_of_darts]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("foldr", [foldr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("list_of_darts", [list_of_darts]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (case THEN (move ["mem_d"])) (((use_arg_then2 ("h", [])) (term_tac exists_tac)) THEN (done_tac))); + (((fun arg_tac -> (use_arg_then2 ("Ih", [])) (fun fst_arg -> (use_arg_then2 ("mem_d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["l"])) THEN (case THEN (move ["mem_l"])) THEN (move ["mem_d2"])); + (((use_arg_then2 ("l", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma mem_list_of_elements *) +let mem_list_of_elements = Sections.section_proof ["x";"L"] +`MEM x (list_of_elements L) + <=> ?y. MEM (x,y) (list_of_darts L)` +[ + ((((use_arg_then2 ("list_of_elements", [list_of_elements]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_undup", [mem_undup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_flatten", [mem_flatten]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_list_of_darts", [mem_list_of_darts]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("SWAP_EXISTS_THM", [SWAP_EXISTS_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("RIGHT_EXISTS_AND_THM", [RIGHT_EXISTS_AND_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); + ((((use_arg_then2 ("mem_list_pairs_exists", [mem_list_pairs_exists]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma uniq_node *) +let uniq_node = Sections.section_proof ["L";"n"] +`good_list L /\ MEM n (list_of_nodes L) ==> uniq n` +[ + (((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_nodes", [list_of_nodes]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM_MAP", [MEM_MAP]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["uniq_s"])) THEN (move ["_"]) THEN (case THEN (move ["d"])) THEN (case THEN (move ["mem_d"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("filter_uniq", [filter_uniq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma uniq_face *) +let uniq_face = Sections.section_proof ["L";"f"] +`good_list L /\ MEM f (list_of_faces L) ==> uniq f` +[ + ((BETA_TAC THEN (case THEN ((move ["good_s"]) THEN (move ["mem_f"])))) THEN (((use_arg_then2 ("good_s", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN (move ["h"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mem_face_lemma", [mem_face_lemma])) (fun fst_arg -> (use_arg_then2 ("mem_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("good_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["d"]) THEN (case THEN (move ["mem_d"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + ((((use_arg_then2 ("uniq_find_face", [uniq_find_face]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma list_of_darts_nil *) +let list_of_darts_nil = Sections.section_proof [] +`list_of_darts [] = []` +[ + (((((use_arg_then2 ("list_of_darts", [list_of_darts]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL foldr)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_of_darts_cons *) +let list_of_darts_cons = Sections.section_proof ["h";"t"] +`list_of_darts (h :: t) = list_pairs h ++ list_of_darts t` +[ + (((((use_arg_then2 ("list_of_darts", [list_of_darts]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL foldr)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("list_of_darts", [list_of_darts]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma list_of_darts_cat *) +let list_of_darts_cat = Sections.section_proof ["s1";"s2"] +`list_of_darts (s1 ++ s2) = list_of_darts s1 ++ list_of_darts s2` +[ + (((THENL) (((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("list_of_darts_nil", [list_of_darts_nil]))(fun tmp_arg1 -> (use_arg_then2 ("list_of_darts_cons", [list_of_darts_cons]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("catA", [catA]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma good_list_uniq *) +let good_list_uniq = Sections.section_proof ["L"] +`good_list L ==> uniq L` +[ + ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["uniqL"])) THEN (case THEN (move ["allL"])) THEN (move ["_"])); + (((THENL) (((use_arg_then2 ("uniqL", [])) (disch_tac [])) THEN (clear_assumption "uniqL") THEN ((use_arg_then2 ("allL", [])) (disch_tac [])) THEN (clear_assumption "allL") THEN ((use_arg_then2 ("L", [])) (disch_tac [])) THEN (clear_assumption "L") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL uniq)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("all", [all]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("list_of_darts_cons", [list_of_darts_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat_uniq", [cat_uniq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hasPn", [hasPn]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["h_neq"])) THEN (move ["all_t"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["mem_h"])) THEN (move ["uniq_t"])); + ((((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`?d. MEM d (list_pairs h)`))) (term_tac (have_gen_tac [](case THEN ((move ["d"]) THEN (move ["mem_d"])))))); + ((THENL_LAST) (((THENL) (((fun arg_tac -> arg_tac (Arg_term (`list_pairs h`))) (disch_eq_tac "eq" [])) THEN case) [ALL_TAC; ((move ["h'"]) THEN (move ["t'"]))]) THEN (process_fst_eq_tac)) (((use_arg_then2 ("h'", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN ((((use_arg_then2 ("size_eq0", [size_eq0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_list_pairs", [size_list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_eq0", [size_eq0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h_neq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("mem_h", [])) (disch_tac [])) THEN (clear_assumption "mem_h") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("NOT_FORALL_THM", [NOT_FORALL_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_imply", [negb_imply]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] []))))) THEN (move ["mem_h"]))); + (((use_arg_then2 ("d", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("mem_d", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("mem_list_of_darts", [mem_list_of_darts]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("h", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma list_pairs_inj *) +let list_pairs_inj = Sections.section_proof ["s1";"s2"] +`list_pairs s1 = list_pairs s2 ==> s1 = s2` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("congr1", [congr1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`unzip1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("unzip1_zip", [unzip1_zip]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma uniq_list_of_faces *) +let uniq_list_of_faces = Sections.section_proof ["L"] +`good_list L ==> uniq (list_of_faces L)` +[ + ((((use_arg_then2 ("list_of_faces", [list_of_faces]))(thm_tac (new_rewrite [] [])))) THEN (move ["goodL"])); + ((((((use_arg_then2 ("map_MAP", [map_MAP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("map_inj_uniq", [map_inj_uniq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("good_list_uniq", [good_list_uniq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["x"]) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("list_pairs_inj", [list_pairs_inj])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Lemma uniq_faces_of_list *) +let uniq_faces_of_list = Sections.section_proof ["L"] +`good_list L ==> uniq (faces_of_list L)` +[ + ((((use_arg_then2 ("faces_of_list", [faces_of_list]))(thm_tac (new_rewrite [] [])))) THEN (move ["goodL"])); + (((((use_arg_then2 ("map_MAP", [map_MAP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("map_inj_in_uniq", [map_inj_in_uniq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uniq_list_of_faces", [uniq_list_of_faces]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["f1"]) THEN (move ["f2"]) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["mem1"]) THEN (move ["mem2"]))) THEN (move ["eq"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mem_face_lemma", [mem_face_lemma])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("mem1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN (move ["d"])))); + ((((use_arg_then2 ("dart_in_face", [dart_in_face]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["mem_d"])) THEN (move ["f1_eq"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("uniq_face_unique", [uniq_face_unique])) (fun fst_arg -> (use_arg_then2 ("mem1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("mem2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((THENL_FIRST) (((((use_arg_then2 ("f1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_d", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)) ((((use_arg_then2 ("goodL", [])) (disch_tac [])) THEN (clear_assumption "goodL") THEN BETA_TAC) THEN ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f1_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma card_faces_of_list *) +let card_faces_of_list = Sections.section_proof ["L"] +`good_list L + ==> CARD (face_set (hypermap_of_list L)) = sizel (list_of_faces L)` +[ + ((BETA_TAC THEN (move ["goodL"])) THEN ((((use_arg_then2 ("face_set_eq_list", [face_set_eq_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("card_set_of_list_uniq", [card_set_of_list_uniq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uniq_faces_of_list", [uniq_faces_of_list]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("faces_of_list", [faces_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("map_MAP", [map_MAP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_map", [size_map]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma card_darts_of_list *) +let card_darts_of_list = Sections.section_proof ["L"] +`good_list L + ==> CARD (dart (hypermap_of_list L)) = sizel (list_of_darts L)` +[ + (BETA_TAC THEN (move ["goodL"])); + ((((use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_set_of_list_uniq", [card_set_of_list_uniq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("goodL", [])) (disch_tac [])) THEN (clear_assumption "goodL") THEN BETA_TAC) THEN ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma uniq_list_of_elements *) +let uniq_list_of_elements = Sections.section_proof ["L"] +`uniq (list_of_elements L)` +[ + (((((use_arg_then2 ("list_of_elements", [list_of_elements]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("undup_uniq", [undup_uniq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma uniq_list_of_nodes *) +let uniq_list_of_nodes = Sections.section_proof ["L"] +`uniq (list_of_nodes L)` +[ + (((((use_arg_then2 ("list_of_nodes", [list_of_nodes]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("map_MAP", [map_MAP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("map_inj_in_uniq", [map_inj_in_uniq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uniq_list_of_elements", [uniq_list_of_elements]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))) THEN (move ["a"]) THEN (move ["b"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("mem_list_of_elements", [mem_list_of_elements]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["c"]) THEN (move ["mem_a"]))) THEN (case THEN ((move ["d"]) THEN (move ["mem_b"])))); + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("congr1", [congr1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`MEM (a,c)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("EQ_IMP", [EQ_IMP])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("mem_a", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_not_nil *) +let mem_not_nil = Sections.section_proof ["s"] +`~(s = []) <=> (?x. MEM x s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]))]) THEN ((((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("NOT_CONS_NIL", [NOT_CONS_NIL]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("h", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma node_of_list_not_nil *) +let node_of_list_not_nil = Sections.section_proof ["L";"n"] +`MEM n (list_of_nodes L) ==> ~(n = [])` +[ + (((((use_arg_then2 ("list_of_nodes", [list_of_nodes]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("map_MAP", [map_MAP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mapP", [mapP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_list_of_elements", [mem_list_of_elements]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["a"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["b"])) THEN (move ["mem_ab"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("mem_not_nil", [mem_not_nil]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`a,b`))) (term_tac exists_tac))); + (((((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("mem_ab", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nodes_of_list_eq *) +let nodes_of_list_eq = Sections.section_proof ["L";"n1";"n2";"a"] +`MEM n1 (list_of_nodes L) /\ MEM n2 (list_of_nodes L) /\ + MEM a n1 /\ MEM a n2 ==> n1 = n2` +[ + ((((use_arg_then2 ("list_of_nodes", [list_of_nodes]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("map_MAP", [map_MAP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mapP", [mapP]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("mem_list_of_elements", [mem_list_of_elements]))(thm_tac (new_rewrite [] []))))); + (BETA_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["x"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["y"])) THEN (move ["mem_xy"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (case THEN ALL_TAC) THEN (case THEN (move ["u"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["v"])) THEN (move ["mem_uv"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((((repeat_tactic 1 9 (((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma uniq_nodes_of_list *) +let uniq_nodes_of_list = Sections.section_proof ["L"] +`uniq (nodes_of_list L)` +[ + (((((use_arg_then2 ("nodes_of_list", [nodes_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("map_MAP", [map_MAP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("map_inj_in_uniq", [map_inj_in_uniq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uniq_list_of_nodes", [uniq_list_of_nodes]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["n1"]) THEN (move ["n2"]) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["mem1"]) THEN (move ["mem2"]))) THEN (move ["eq"])); + ((fun arg_tac -> arg_tac (Arg_term (`?d. d IN set_of_list n1`))) (term_tac (have_gen_tac [](case THEN ((move ["d"]) THEN (move ["d_in"])))))); + (((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_not_nil", [mem_not_nil]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("node_of_list_not_nil", [node_of_list_not_nil])) (fun fst_arg -> (use_arg_then2 ("mem1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nodes_of_list_eq", [nodes_of_list_eq])) (fun fst_arg -> (use_arg_then2 ("mem1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("mem2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then2 ("d", [])) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma size_list_of_nodes *) +let size_list_of_nodes = Sections.section_proof ["L"] +`sizel (list_of_nodes L) = sizel (list_of_elements L)` +[ + (((((use_arg_then2 ("list_of_nodes", [list_of_nodes]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("map_MAP", [map_MAP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_map", [size_map]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma card_nodes_of_list *) +let card_nodes_of_list = Sections.section_proof ["L"] +`CARD (set_of_list (nodes_of_list L)) = sizel (list_of_elements L)` +[ + ((((use_arg_then2 ("card_set_of_list_uniq", [card_set_of_list_uniq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uniq_nodes_of_list", [uniq_nodes_of_list]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("nodes_of_list", [nodes_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("map_MAP", [map_MAP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_map", [size_map]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_list_of_nodes", [size_list_of_nodes]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma surj_delete *) +let surj_delete = Sections.section_proof ["f";"s";"t";"a";"b"] +`SURJ f s t /\ f a = f b /\ a IN s /\ b IN s /\ ~(a = b) + ==> SURJ f (s DELETE a) t` +[ + ((((repeat_tactic 1 9 (((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN ((move ["f_in"]) THEN (move ["f_surj"]))) THEN (case THEN (move ["eq"])) THEN (case THEN (move ["a_in"])) THEN (case THEN (move ["b_in"])) THEN (move ["neq"])) THEN (split_tac)); + ((BETA_TAC THEN (move ["x"]) THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("f_in", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("f_surj", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["y"])) THEN (case THEN (move ["y_in"])) THEN (move ["f_eq"])); + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`y = a`))) (disch_eq_tac "y_eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) (((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (done_tac))); + (((use_arg_then2 ("b", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("b_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("neq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fst_node_hypermap_of_list *) +let fst_node_hypermap_of_list = Sections.section_proof ["L";"d"] +`good_list L + ==> (!x. x IN node (hypermap_of_list L) d ==> FST x = FST d)` +[ + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN BETA_TAC THEN (case THEN ((move ["a"]) THEN (move ["b"]))) THEN (move ["goodL"]) THEN (move ["x"])); + ((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["hypL"]))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_list L`))) (term_tac (set_tac "H"))); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`a,b IN darts_of_list L`))) (disch_eq_tac "ab_in" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + ((((((use_arg_then2 ("lemma_node_exception", [lemma_node_exception]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("hypL", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("node", [node]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbit_map", [orbit_map]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["k"])) THEN (case THEN (move ["_"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("hypL", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fst_n_list_ext_power", [fst_n_list_ext_power]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fst_choice_node_hypermap_of_list *) +let fst_choice_node_hypermap_of_list = Sections.section_proof ["L";"d"] +`good_list L + ==> FST (CHOICE (node (hypermap_of_list L) d)) = FST d` +[ + ((BETA_TAC THEN (move ["goodL"])) THEN (((fun arg_tac -> (use_arg_then2 ("fst_node_hypermap_of_list", [fst_node_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + ((((use_arg_then2 ("CHOICE_DEF", [CHOICE_DEF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((use_arg_then2 ("d", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("node_refl", [node_refl]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma surj_fst_nodes_hypermap_of_list *) +let surj_fst_nodes_hypermap_of_list = Sections.section_proof ["L"] +`good_list L + ==> SURJ (\n. FST (CHOICE n)) (node_set (hypermap_of_list L)) (elements_of_list L)` +[ + (((((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("elements_of_list", [elements_of_list]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))))) THEN (move ["goodL"])); + ((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["hypL"]))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_list L`))) (term_tac (set_tac "H"))); + (((THENL) (split_tac) [((move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_node_representation", [lemma_node_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["d"])) THEN (case THEN (move ["d_in"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); (move ["a"])]) THEN (simp_tac)); + ((((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fst_choice_node_hypermap_of_list", [fst_choice_node_hypermap_of_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mem_list_of_elements", [mem_list_of_elements]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`SND d`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hypL", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("mem_list_of_elements", [mem_list_of_elements]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["b"]))); + (((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hypL", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["ab_in"])); + ((fun arg_tac -> arg_tac (Arg_term (`node H (a,b)`))) (term_tac exists_tac)); + ((((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("fst_choice_node_hypermap_of_list", [fst_choice_node_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("lemma_in_node_set", [lemma_in_node_set]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma good_list_nodes_condition *) +let good_list_nodes_condition = Sections.section_proof ["L"] +`good_list L + ==> (good_list_nodes L <=> CARD (node_set (hypermap_of_list L)) = sizel (list_of_elements L))` +[ + ((THENL_FIRST) (((((use_arg_then2 ("good_list_nodes", [good_list_nodes]))(thm_tac (new_rewrite [] [])))) THEN (move ["goodL"])) THEN ((split_tac) THEN (move ["eq"]))) (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_nodes_of_list", [card_nodes_of_list]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("SUBSET_CARD_EQ", [SUBSET_CARD_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("card_nodes_of_list", [card_nodes_of_list]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("FINITE_SET_OF_LIST", [FINITE_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (move ["n"])); + ((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["hypL"]))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_list L`))) (term_tac (set_tac "H"))); + ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_node_representation", [lemma_node_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["r"])) THEN (case THEN (move ["r_in"])) THEN (move ["n_eq"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`MEM r (list_of_darts L)`))) (term_tac (have_gen_tac [](move ["mem_r"])))) (((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hypL", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nodes_of_list", [nodes_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("map_MAP", [map_MAP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mapP", [mapP]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`filter (\y. FST y = FST r) (list_of_darts L)`))) (term_tac exists_tac)) THEN (split_tac)); + ((((use_arg_then2 ("list_of_nodes", [list_of_nodes]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("map_MAP", [map_MAP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mapP", [mapP]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> arg_tac (Arg_term (`FST r`))) (term_tac exists_tac)) THEN (simp_tac)) THEN (((use_arg_then2 ("mem_list_of_elements", [mem_list_of_elements]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`SND r`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`set_of_list _`))) (term_tac (set_tac "s"))); + (((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN ((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac) THEN (move ["neq"])); + ((fun arg_tac -> arg_tac (Arg_term (`n PSUBSET s`))) (term_tac (have_gen_tac []ALL_TAC))); + (((((use_arg_then2 ("PSUBSET", [PSUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("neq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["x"]) THEN (move ["x_in"])); + ((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hypL", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fst_node_hypermap_of_list", [fst_node_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((use_arg_then2 ("Hypermap_iso.IN_TRANS", [Hypermap_iso.IN_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`node H r`))) (term_tac exists_tac))); + (((((use_arg_then2 ("lemma_node_subset", [lemma_node_subset]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("PSUBSET_ALT", [PSUBSET_ALT]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["a"])) THEN (case THEN (move ["a_in"])) THEN (move ["a_n_in"])); + ((fun arg_tac -> arg_tac (Arg_term (`~(sizel (list_of_elements L) = 0)`))) (term_tac (have_gen_tac [](move ["size_gt0"])))); + ((((use_arg_then2 ("size_eq0", [size_eq0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_not_nil", [mem_not_nil]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`FST r`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("mem_list_of_elements", [mem_list_of_elements]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`SND r`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`sizel (list_of_elements L) <= CARD (node_set H DELETE n) `))) (term_tac (have_gen_tac []ALL_TAC)))); + ((((use_arg_then2 ("CARD_DELETE", [CARD_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_HYPERMAP_ORBITS", [FINITE_HYPERMAP_ORBITS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lemma_in_node_set", [lemma_in_node_set]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("r_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("size_gt0", [])) (disch_tac [])) THEN (clear_assumption "size_gt0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("card_set_of_list_uniq", [card_set_of_list_uniq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uniq_list_of_elements", [uniq_list_of_elements]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("elements_of_list", [elements_of_list]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> (use_arg_then2 ("Hypermap_iso.surj_imp_card_le", [Hypermap_iso.surj_imp_card_le])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`\x. FST (CHOICE x)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac)); + ((((use_arg_then2 ("FINITE_DELETE", [FINITE_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_HYPERMAP_ORBITS", [FINITE_HYPERMAP_ORBITS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("surj_delete", [surj_delete])) (thm_tac apply_tac)) THEN (((fun arg_tac -> arg_tac (Arg_term (`node H a`))) (term_tac exists_tac)) THEN (simp_tac))); + ((((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [1; 2] []))))) THEN (((use_arg_then2 ("surj_fst_nodes_hypermap_of_list", [surj_fst_nodes_hypermap_of_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fst_choice_node_hypermap_of_list", [fst_choice_node_hypermap_of_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`a IN dart H`))) (term_tac (have_gen_tac [](move ["a_in2"])))); + ((((use_arg_then2 ("hypL", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("a_in", [])) (disch_tac [])) THEN (clear_assumption "a_in") THEN BETA_TAC) THEN (((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("lemma_in_node_set", [lemma_in_node_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("a_in2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("r_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("fst_choice_node_hypermap_of_list", [fst_choice_node_hypermap_of_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("lemma_different_nodes", [lemma_different_nodes]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("n_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((simp_tac THEN TRY done_tac))); + ((((use_arg_then2 ("a_in", [])) (disch_tac [])) THEN (clear_assumption "a_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma plain_hypermap_of_list *) +let plain_hypermap_of_list = Sections.section_proof ["L"] +`good_list L ==> plain_hypermap (hypermap_of_list L)` +[ + ((BETA_TAC THEN (move ["goodL"])) THEN ((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["hypL"])))); + (((((use_arg_then2 ("plain_hypermap", [plain_hypermap]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hypL", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_list_ext_involution", [e_list_ext_involution]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma edge_CARD_dart *) +let edge_CARD_dart = Sections.section_proof ["H"] +`plain_hypermap H /\ is_edge_nondegenerate H + ==> CARD (dart H) = 2 * number_of_edges H` +[ + (((((use_arg_then2 ("plain_hypermap", [plain_hypermap]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("is_edge_nondegenerate", [is_edge_nondegenerate]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["plain"]) THEN (move ["edge_nd"])))); + ((((use_arg_then2 ("number_of_edges", [number_of_edges]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("edge_set", [edge_set]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("lemma_card_eq", [lemma_card_eq])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`edge_map H`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("number_of_orbits", [number_of_orbits]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("edge_map_and_darts", [edge_map_and_darts]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["x"]) THEN (move ["x_in"])); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL lemma_orbit_of_size_2))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dart H`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("edge_map_and_darts", [edge_map_and_darts]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("edge_nd", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`edge_map H`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("plain", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma good_list_nodes_size_condition *) +let good_list_nodes_size_condition = Sections.section_proof ["L"] +`good_list L /\ planar_hypermap (hypermap_of_list L) + /\ connected_hypermap (hypermap_of_list L) /\ is_edge_nondegenerate (hypermap_of_list L) + ==> (good_list_nodes L <=> + 2 * (sizel (list_of_elements L) + sizel (list_of_faces L)) = + sizel (list_of_darts L) + 4)` +[ + (BETA_TAC THEN (case THEN (move ["goodL"])) THEN (case THEN (move ["planarL"])) THEN (case THEN (move ["connL"])) THEN (move ["nondL"])); + ((((use_arg_then2 ("good_list_nodes_condition", [good_list_nodes_condition]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_list L`))) (term_tac (set_tac "H"))); + ((THENL_FIRST) ((((use_arg_then2 ("number_of_nodes", [number_of_nodes]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("eqn_pmul2l", [eqn_pmul2l])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("planarL", [])) (disch_tac [])) THEN (clear_assumption "planarL") THEN ((use_arg_then2 ("connL", [])) (disch_tac [])) THEN (clear_assumption "connL") THEN BETA_TAC) THEN (((((use_arg_then2 ("planar_hypermap", [planar_hypermap]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("connected_hypermap", [connected_hypermap]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) (((fun arg_tac -> (use_arg_then2 ("eqn_pmul2l", [eqn_pmul2l])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("muln_addr", [muln_addr]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("edge_CARD_dart", [edge_CARD_dart]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("plain_hypermap_of_list", [plain_hypermap_of_list]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("card_faces_of_list", [card_faces_of_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("number_of_faces", [number_of_faces]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("card_darts_of_list", [card_darts_of_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] []))))); + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma face_of_list *) +let face_of_list = Sections.section_proof ["L";"d"] +`good_list L /\ MEM d (list_of_darts L) + ==> face (hypermap_of_list L) d = set_of_list (find_face L d)` +[ + (BETA_TAC THEN (case THEN ((move ["good_s"]) THEN (move ["mem_d"])))); + ((fun arg_tac -> (use_arg_then2 ("face_set_eq_list", [face_set_eq_list])) (fun fst_arg -> (use_arg_then2 ("good_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("face_set", [face_set]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_of_orbits", [set_of_orbits]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("face", [face]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`face (hypermap_of_list L) d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`face _1 d IN _2`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))))) (((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("d", [])) (term_tac exists_tac)) THEN (done_tac))); + (((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("faces_of_list", [faces_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM_MAP", [MEM_MAP]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["f"])) THEN (case THEN (move ["mem_f"])) THEN (move ["face_eq"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mem_face_lemma", [mem_face_lemma])) (fun fst_arg -> (use_arg_then2 ("good_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("mem_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["d2"]) THEN (case THEN (move ["mem_d2"])) THEN (move ["f_eq"]))))); + (((((use_arg_then2 ("face_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((congr_tac (`_1 _2`)) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))); + ((use_arg_then2 ("mem_find_face_imp_faces_eq", [mem_find_face_imp_faces_eq])) (thm_tac apply_tac)); + ((((use_arg_then2 ("good_s", [])) (disch_tac [])) THEN (clear_assumption "good_s") THEN BETA_TAC) THEN ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + (((((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("face_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("face_refl", [face_refl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma card_face_of_list *) +let card_face_of_list = Sections.section_proof ["L";"d"] +`good_list L /\ MEM d (list_of_darts L) + ==> CARD (face (hypermap_of_list L) d) = sizel (find_face L d)` +[ + (BETA_TAC THEN (case THEN ((move ["good_s"]) THEN (move ["mem_d"])))); + ((((use_arg_then2 ("face_of_list", [face_of_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("card_set_of_list_uniq", [card_set_of_list_uniq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("uniq_find_face", [uniq_find_face]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("good_s", [])) (disch_tac [])) THEN (clear_assumption "good_s") THEN BETA_TAC) THEN ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_of_faces_k *) +let list_of_faces_k = Sections.section_proof ["L";"k"] +`good_list L + ==> face_set_k k (hypermap_of_list L) = + set_of_list (MAP set_of_list (filter (\f. sizel f = k) (list_of_faces L)))` +[ + ((BETA_TAC THEN (move ["good_s"])) THEN (((use_arg_then2 ("good_s", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["uniq_s"])) THEN (move ["_"]))); + ((((use_arg_then2 ("face_set_k", [face_set_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("face_set", [face_set]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_of_orbits", [set_of_orbits]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("face", [face]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("MEM_MAP", [MEM_MAP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] []))))) THEN (move ["f"]) THEN (simp_tac)); + ((THENL) (split_tac) [((case THEN (move ["g"])) THEN (case THEN ALL_TAC) THEN (case THEN ALL_TAC) THEN (case THEN (move ["d"])) THEN (case THEN (move ["mem_d"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["card_eq"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); ((case THEN (move ["g"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["size_g"])) THEN (move ["mem_g"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))]); + ((fun arg_tac -> arg_tac (Arg_term (`find_face L d`))) (term_tac exists_tac)); + (((((use_arg_then2 ("mem_find_face", [mem_find_face]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("face_of_list", [face_of_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("card_face_of_list", [card_face_of_list]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mem_face_lemma", [mem_face_lemma])) (fun fst_arg -> (use_arg_then2 ("good_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("mem_g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["d"]) THEN (case THEN (move ["mem_d"])) THEN (move ["g_eq"]))))); + ((((fun arg_tac -> arg_tac (Arg_term (`set_of_list g`))) (term_tac exists_tac)) THEN (simp_tac)) THEN (split_tac)); + (((use_arg_then2 ("d", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("face_of_list", [face_of_list]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((use_arg_then2 ("card_set_of_list_uniq", [card_set_of_list_uniq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("g_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("uniq_find_face", [uniq_find_face]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma darts_k_union_face_set_k *) +let darts_k_union_face_set_k = Sections.section_proof ["H";"k"] +`darts_k k H = UNIONS (face_set_k k H)` +[ + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNIONS", [IN_UNIONS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_k", [darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("face_set_k", [face_set_k]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("Hypermap_iso.inE", [Hypermap_iso.inE]))(thm_tac (new_rewrite [] [])))))) THEN (move ["d"])); + ((THENL) (split_tac) [(move ["h"]); ((case THEN (move ["t"])) THEN (case THEN ALL_TAC) THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (case THEN (move ["x"])) THEN (case THEN (move ["x_in"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["card_eq"]) THEN (move ["d_in"]))]); + (((fun arg_tac -> arg_tac (Arg_term (`face H d`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("face_refl", [face_refl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`face H x = face H d`))) (term_tac (have_gen_tac [](move ["eq"]))))); + (((((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((fun arg_tac -> (use_arg_then2 ("Hypermap_iso.IN_TRANS", [Hypermap_iso.IN_TRANS])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lemma_face_subset", [lemma_face_subset]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> (use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +];; + +(* Lemma set_of_list_flatten_map *) +let set_of_list_flatten_map = Sections.section_proof ["s"] +`set_of_list (flatten s) + = UNIONS (set_of_list (map set_of_list s))` +[ + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNIONS", [IN_UNIONS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_flatten", [mem_flatten]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mapP", [mapP]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])); + ((THENL) (split_tac) [((case THEN (move ["l"])) THEN (move ["h"])); ((case THEN (move ["t"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["l2"])) THEN (case THEN (move ["mem_l2"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))]); + (((fun arg_tac -> arg_tac (Arg_term (`set_of_list l`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("l", [])) (term_tac exists_tac)) THEN (done_tac)); + (((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (move ["mem_x"])) THEN ((use_arg_then2 ("l2", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma list_of_darts_k *) +let list_of_darts_k = Sections.section_proof ["L";"k"] +`good_list L + ==> darts_k k (hypermap_of_list L) + = set_of_list (flatten (filter (\f. sizel f = k) (list_of_faces L)))` +[ + ((BETA_TAC THEN (move ["goodL"])) THEN (((use_arg_then2 ("darts_k_union_face_set_k", [darts_k_union_face_set_k]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("list_of_faces_k", [list_of_faces_k]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("map_MAP", [map_MAP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_of_list_flatten_map", [set_of_list_flatten_map]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma darts3_eq_list_of_darts3 *) +let darts3_eq_list_of_darts3 = Sections.section_proof ["L"] +`good_list L + ==> darts_k 3 (hypermap_of_list L) = set_of_list (list_of_darts3 L)` +[ + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("list_of_darts_k", [list_of_darts_k])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("list_of_darts3", [list_of_darts3]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_faces3", [list_of_faces3]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Seq.size", [Seq.size]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma darts4_eq_list_of_darts4 *) +let darts4_eq_list_of_darts4 = Sections.section_proof ["L"] +`good_list L + ==> darts_k 4 (hypermap_of_list L) = set_of_list (list_of_darts4 L)` +[ + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("list_of_darts_k", [list_of_darts_k])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`4`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("list_of_darts4", [list_of_darts4]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_faces4", [list_of_faces4]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Seq.size", [Seq.size]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma darts5_eq_list_of_darts5 *) +let darts5_eq_list_of_darts5 = Sections.section_proof ["L"] +`good_list L + ==> darts_k 5 (hypermap_of_list L) = set_of_list (list_of_darts5 L)` +[ + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("list_of_darts_k", [list_of_darts_k])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`5`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("list_of_darts5", [list_of_darts5]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_faces5", [list_of_faces5]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Seq.size", [Seq.size]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma darts6_eq_list_of_darts6 *) +let darts6_eq_list_of_darts6 = Sections.section_proof ["L"] +`good_list L + ==> darts_k 6 (hypermap_of_list L) = set_of_list (list_of_darts6 L)` +[ + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("list_of_darts_k", [list_of_darts_k])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`6`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("list_of_darts6", [list_of_darts6]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_faces6", [list_of_faces6]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Seq.size", [Seq.size]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rot_list_pairs *) +let rot_list_pairs = Sections.section_proof ["s";"n"] +`rot n (list_pairs s) = list_pairs (rot n s)` +[ + (((((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot_zip", [rot_zip]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("rot_rot", [rot_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_pairs", [list_pairs]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma rotr_list_pairs *) +let rotr_list_pairs = Sections.section_proof ["s";"n"] +`rotr n (list_pairs s) = list_pairs (rotr n s)` +[ + (((((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot_list_pairs", [rot_list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_list_pairs", [size_list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rotr", [rotr]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma list_pairs_rot *) +let list_pairs_rot = Sections.section_proof ["s";"n"] +`perm_eq (list_pairs (rot n s)) (list_pairs s)` +[ + (((((use_arg_then2 ("rot_list_pairs", [rot_list_pairs]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("perm_eq_rot", [perm_eq_rot]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma find_pair_list_empty *) +let find_pair_list_empty = Sections.section_proof ["L";"d"] +`find_pair_list L d = [] <=> ~(MEM d (list_of_darts L))` +[ + (((THENL) (((use_arg_then2 ("L", [])) (disch_tac [])) THEN (clear_assumption "L") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((((use_arg_then2 ("find_pair_list", [find_pair_list]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("list_of_darts_nil", [list_of_darts_nil]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("list_of_darts_cons", [list_of_darts_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] []))))); + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`MEM d _`))) (disch_eq_tac "mem_d" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("implybF", [implybF]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["h_eq"])); + ((((use_arg_then2 ("mem_d", [])) (disch_tac [])) THEN (clear_assumption "mem_d") THEN BETA_TAC) THEN ((((use_arg_then2 ("h_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("zip", [zip]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_of_darts_perm *) +let list_of_darts_perm = Sections.section_proof ["L1";"L2"] +`perm_eq L1 L2 ==> perm_eq (list_of_darts L1) (list_of_darts L2)` +[ + ((BETA_TAC THEN (move ["perm"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("list_of_darts_alt", [list_of_darts_alt]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("list_of_faces", [list_of_faces]))(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("perm_eq_flatten", [perm_eq_flatten]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("map_MAP", [map_MAP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("perm_eq_map", [perm_eq_map]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma good_list_perm *) +let good_list_perm = Sections.section_proof ["L1";"L2"] +`perm_eq L1 L2 /\ good_list L1 ==> good_list L2` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["perm"])) THEN (case THEN (move ["uniq1"])) THEN (case THEN (move ["all1"])) THEN (move ["sym1"])); + ((fun arg_tac -> (use_arg_then2 ("list_of_darts_perm", [list_of_darts_perm])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["perm_darts"]))); + ((((fun arg_tac -> (use_arg_then2 ("perm_eq_uniq", [perm_eq_uniq])) (fun fst_arg -> (use_arg_then2 ("perm_darts", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("uniq1", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("all_perm_eq", [all_perm_eq])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("all1", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (move ["d"])) THEN ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (use_arg_then2 ("perm_darts", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("sym1", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Lemma find_face_cons *) +let find_face_cons = Sections.section_proof ["h";"t";"d"] +`find_face (h :: t) d = if MEM d (list_pairs h) then (list_pairs h) else find_face t d` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("find_face", [find_face]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("list_of_faces", [list_of_faces]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("MAP", [MAP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_list", [find_list]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma find_face_eq *) +let find_face_eq = Sections.section_proof ["L";"d";"f"] +`uniq (list_of_darts L) /\ MEM d (list_of_darts L) + ==> (find_face L d = f <=> MEM f (list_of_faces L) /\ MEM d f)` +[ + ((BETA_TAC THEN (case THEN ((move ["uniqL"]) THEN (move ["mem_d"])))) THEN ((THENL) (split_tac) [(((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))); ALL_TAC])); + (((((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_find_face", [mem_find_face]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("list_of_faces", [list_of_faces]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("map_MAP", [map_MAP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mapP", [mapP]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["s"])) THEN (case THEN (move ["mem_s"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("find_pair_list_unique", [find_pair_list_unique])) (fun fst_arg -> (use_arg_then2 ("uniqL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["eq"])); + (((((use_arg_then2 ("find_face_alt", [find_face_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Close the module *) +end;; diff --git a/formal_lp/hypermap/ssreflect/list_hypermap_iso-compiled.hl b/formal_lp/hypermap/ssreflect/list_hypermap_iso-compiled.hl new file mode 100644 index 0000000..da41e1e --- /dev/null +++ b/formal_lp/hypermap/ssreflect/list_hypermap_iso-compiled.hl @@ -0,0 +1,1027 @@ +needs "../formal_lp/hypermap/ssreflect/list_hypermap-compiled.hl";; +needs "../formal_lp/hypermap/ssreflect/add_triangle-compiled.hl";; + +(* Module List_hypermap_iso*) +module List_hypermap_iso = struct + +parse_as_infix ("::", (12, "right"));; +override_interface ("::", `CONS`);; +make_overloadable "++" `:A -> A -> A`;; +overload_interface ("++", `cat`);; +let split_list_face = new_definition + `split_list_face f = if sizel f <= 3 then [f] else [take 3 f; HD f :: dropl 2 f]`;; +let split_list_hyp = (GEN_ALL o define) + `split_list_hyp [] d = [] /\ + split_list_hyp (f :: t) d = + if MEM d (list_pairs f) then + split_list_face (rotr 1 (rot (indexl d (list_pairs f)) f)) ++ t + else + f :: split_list_hyp t d`;; +let list_hyp_diag = new_definition `list_hyp_diag L d = (SND d, FST (prev_el (find_face L d) d))`;; +let fan_list_nodes_iso = new_definition `fan_list_nodes_iso (f, (V,E)) x + = FST (f (x, if set_of_edge x V E = {} then x else CHOICE (set_of_edge x V E)))`;; +let fan_list_iso = new_definition `fan_list_iso (f, (V,E)) (v,w) = + fan_list_nodes_iso (f, (V,E)) v, fan_list_nodes_iso (f, (V,E)) w`;; +open Ssrbool;; +open Ssrnat;; +open Seq;; +open Seq2;; +open Hypermap;; +open Hypermap_and_fan;; +open Fan_defs;; +open List_hypermap;; +open Add_triangle;; +open Hypermap_iso;; + +(* Section MoreFan *) +Sections.begin_section "MoreFan";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; + +(* Lemma fan_imp_finite_set *) +let fan_imp_finite_set = Sections.section_proof ["V";"E"] +`FAN (vec 0,V,E) ==> FINITE V` +[ + ((((((use_arg_then2 ("FAN", [FAN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fan1", [fan1]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma e_fan_pair_ext_explicit *) +let e_fan_pair_ext_explicit = Sections.section_proof ["v";"w"] +`(v,w) IN dart_of_fan (V,E) + ==> e_fan_pair_ext (V,E) (v,w) = (w,v)` +[ + ((((use_arg_then2 ("dart_of_fan_eq", [dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_fan_pair_ext", [e_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`v,w IN _`))) (disch_eq_tac "vw_in" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("e_fan_pair", [e_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((BETA_TAC THEN (case THEN (move ["z"])) THEN (case THEN (move ["_"]))) THEN ((((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac)); +];; + +(* Lemma fan_number_of_nodes *) +let fan_number_of_nodes = Sections.section_proof ["V";"E"] +`FAN (vec 0,V,E) + ==> number_of_nodes (hypermap_of_fan (V,E)) = CARD V` +[ + ((((use_arg_then2 ("number_of_nodes", [number_of_nodes]))(thm_tac (new_rewrite [] [])))) THEN (move ["fanV"])); + (((fun arg_tac -> (use_arg_then2 ("NODE_SET_AS_IMAGE", [NODE_SET_AS_IMAGE])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["f"])) THEN (case THEN (move ["inj"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((((((use_arg_then2 ("CARD_IMAGE_INJ", [CARD_IMAGE_INJ]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("fan_imp_finite_set", [fan_imp_finite_set])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("inj", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Finalization of the section MoreFan *) +let fan_imp_finite_set = Sections.finalize_theorem fan_imp_finite_set;; +let e_fan_pair_ext_explicit = Sections.finalize_theorem e_fan_pair_ext_explicit;; +let fan_number_of_nodes = Sections.finalize_theorem fan_number_of_nodes;; +Sections.end_section "MoreFan";; + +(* Section SplitListHyp *) +Sections.begin_section "SplitListHyp";; +(Sections.add_section_type (mk_var ("d", (`:A#A`))));; + +(* Lemma split_list_hyp_alt *) +let split_list_hyp_alt = Sections.section_proof ["L";"d"] +`MEM d (list_of_darts L) + ==> (let f = find_pair_list L d and + n = indexl (find_pair_list L d) L in + split_list_hyp L d = take n L ++ + (split_list_face (rotr 1 (rot (indexl d (list_pairs f)) f))) ++ dropl (n + 1) L)` +[ + ((BETA_TAC THEN (move ["mem_d"])) THEN (CONV_TAC let_CONV) THEN (((use_arg_then2 ("mem_d", [])) (disch_tac [])) THEN (clear_assumption "mem_d") THEN BETA_TAC)); + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("L", [])) (disch_tac [])) THEN (clear_assumption "L") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) (((((use_arg_then2 ("list_of_darts_nil", [list_of_darts_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("list_of_darts_cons", [list_of_darts_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_pair_list", [find_pair_list]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`MEM d _`))) (disch_eq_tac "mem_d" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((use_arg_then2 ("Seq.index_head", [Seq.index_head]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("take", [take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("drop1", [drop1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("behead", [behead]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("split_list_hyp", [split_list_hyp]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_d", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (move ["mem_dt"])); + ((((use_arg_then2 ("split_list_hyp", [split_list_hyp]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_d", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`indexl _1 _2`))) (term_tac (set_tac "n"))); + ((fun arg_tac -> arg_tac (Arg_term (`indexl _1 (CONS h t)`))) (term_tac (set_tac "m"))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`m = SUC n`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) (((((use_arg_then2 ("take", [take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addSn", [addSn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("drop", [drop]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("m_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index_cons", [index_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`_ = h`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((use_arg_then2 ("mem_dt", [])) (disch_tac [])) THEN (clear_assumption "mem_dt") THEN BETA_TAC) THEN ((((use_arg_then2 ("dart_in_find_pair_list", [dart_in_find_pair_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_d", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma d_not_in_dart_split_eq *) +let d_not_in_dart_split_eq = Sections.section_proof ["L";"d"] +`~(MEM d (list_of_darts L)) ==> split_list_hyp L d = L` +[ + ((((use_arg_then2 ("mem_list_of_darts", [mem_list_of_darts]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_EXISTS_THM", [NOT_EXISTS_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))); + (((THENL) (((use_arg_then2 ("L", [])) (disch_tac [])) THEN (clear_assumption "L") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN (((((use_arg_then2 ("split_list_hyp", [split_list_hyp]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["mem_d"]))); + ((((fun arg_tac -> (use_arg_then2 ("mem_d", [])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL MEM)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["x"]))); + ((((fun arg_tac -> (use_arg_then2 ("mem_d", [])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL MEM)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))))); + ((case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_eq_cat_find_pair_list *) +let list_eq_cat_find_pair_list = Sections.section_proof ["L";"d"] +`MEM d (list_of_darts L) + ==> (let f = find_pair_list L d and + n = indexl (find_pair_list L d) L in + L = take n L ++ [f] ++ dropl (n + 1) L)` +[ + ((BETA_TAC THEN (move ["mem_d"])) THEN (CONV_TAC let_CONV) THEN (((use_arg_then2 ("mem_d", [])) (disch_tac [])) THEN (clear_assumption "mem_d") THEN BETA_TAC)); + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("L", [])) (disch_tac [])) THEN (clear_assumption "L") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) (((((use_arg_then2 ("list_of_darts_nil", [list_of_darts_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("list_of_darts_cons", [list_of_darts_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_pair_list", [find_pair_list]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`MEM d _`))) (disch_eq_tac "mem_d" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((((use_arg_then2 ("Seq.index_head", [Seq.index_head]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("take", [take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("drop1", [drop1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("behead", [behead]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat1s", [cat1s]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["mem_dt"])) THEN ((((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [1] [])))) THEN ((TRY done_tac)))); + ((fun arg_tac -> arg_tac (Arg_term (`indexl _1 _2`))) (term_tac (set_tac "n"))); + ((fun arg_tac -> arg_tac (Arg_term (`indexl _1 (CONS h t)`))) (term_tac (set_tac "m"))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`m = SUC n`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) (((((use_arg_then2 ("take", [take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addSn", [addSn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("drop", [drop]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((((use_arg_then2 ("m_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index_cons", [index_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`_ = h`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((use_arg_then2 ("mem_dt", [])) (disch_tac [])) THEN (clear_assumption "mem_dt") THEN BETA_TAC) THEN ((((use_arg_then2 ("dart_in_find_pair_list", [dart_in_find_pair_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_d", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_eq_cat_list_diag *) +let list_eq_cat_list_diag = Sections.section_proof ["f";"d"] +`MEM d (list_pairs f) /\ 2 <= sizel f + ==> (let k = indexl d (list_pairs f) and + y = FST (prev_el (list_pairs f) d) in + rot k f = [FST d] ++ belast (SND d) (dropl 2 (rot k f)) ++ [y])` +[ + ((BETA_TAC THEN (case THEN ((move ["mem_d"]) THEN (move ["f_size"])))) THEN (CONV_TAC let_CONV)); + ((fun arg_tac -> arg_tac (Arg_term (`indexl d _`))) (term_tac (set_tac "k"))); + ((fun arg_tac -> arg_tac (Arg_term (`FST (_1 _2 d)`))) (term_tac (set_tac "y"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`k < sizel f`))) (term_tac (have_gen_tac [](move ["k_lt"])))) (((((use_arg_then2 ("size_list_pairs", [size_list_pairs]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("k_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("eq_from_nth", [eq_from_nth])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size_cat", [size_cat]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size1", [size1]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_belast", [size_belast]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) ((THENL) (split_tac) [ALL_TAC; (move ["i"])]) ((((use_arg_then2 ("f_size", [])) (disch_tac [])) THEN (clear_assumption "f_size") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`2 <= sizel f /\ 1 < sizel f /\ 0 < sizel f /\ k <= sizel f /\ 0 < sizel f - 1 /\ 1 <= sizel f`))) (term_tac (have_gen_tac [](move ["size_ineqs"])))); + ((((use_arg_then2 ("f_size", [])) (disch_tac [])) THEN (clear_assumption "f_size") THEN ((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN case) [(move ["_"]); (move ["i"])]); + ((((use_arg_then2 ("nth_rot", [nth_rot]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("addn0", [addn0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MOD_LT", [MOD_LT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("cat1s", [cat1s]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_index", [nth_index])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y,y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("mem_d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((((use_arg_then2 ("k_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_zip", [nth_zip]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("pair_expand", [pair_expand])) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`sizel f = 2`))) (disch_eq_tac "size_eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((((use_arg_then2 ("drop_oversize", [drop_oversize]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("belast", [belast]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] []))))) THEN (move ["i_lt"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`i = 0`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_rot", [nth_rot]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("y_def", []))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("prev_el_alt", [prev_el_alt])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y,y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("k_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] []))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("nth_rot", [nth_rot]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_list_pairs", [size_list_pairs]))(thm_tac (new_rewrite [] [])))))) THEN (TRY (((((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN ((use_arg_then2 ("size_ineqs", [])) (disch_tac [])) THEN (clear_assumption "size_ineqs") THEN BETA_TAC) THEN (arith_tac))))); + ((((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_zip", [nth_zip]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] []))))); + (((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`2 - 1 + k = k + 1`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`0 < sizel f - 2 /\ 2 < sizel f`))) (term_tac (have_gen_tac [](move ["size_ineqs2"])))) ((((use_arg_then2 ("f_size", [])) (disch_tac [])) THEN (clear_assumption "f_size") THEN ((use_arg_then2 ("size_eq", [])) (disch_tac [])) THEN (clear_assumption "size_eq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN case) [(move ["_"]); (move ["i"])]); + ((((use_arg_then2 ("cat1s", [cat1s]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_rot", [nth_rot]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("nth_cat", [nth_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_belast", [size_belast]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_ineqs2", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("nth0", [nth0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("head_belast", [head_belast]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_index", [nth_index])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y,y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("mem_d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((((use_arg_then2 ("k_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_zip", [nth_zip]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("pair_expand", [pair_expand])) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_rot", [nth_rot]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["i_lt"])) THEN ((((use_arg_then2 ("cat1s", [cat1s]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> arg_tac (Arg_term (`SUC i < sizel f - 2`))) (disch_eq_tac "i_lt2" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((fun arg_tac -> (use_arg_then2 ("cat_take_drop", [cat_take_drop])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("nth_cat", [nth_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_take", [size_take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_ineqs2", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`SUC (SUC i) < 2 <=> F`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`SUC (SUC i) - 2 = i`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("nth_cat", [nth_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_belast", [size_belast]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_lt2", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((((use_arg_then2 ("nth_belast", [nth_belast]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("eqS0", [eqS0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`SUC i = sizel f - 2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN ((use_arg_then2 ("i_lt2", [])) (disch_tac [])) THEN (clear_assumption "i_lt2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("nth_cat", [nth_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_belast", [size_belast]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("subnn", [subnn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("y_def", []))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("prev_el_alt", [prev_el_alt])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y,y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("k_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] []))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("nth_rot", [nth_rot]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_list_pairs", [size_list_pairs]))(thm_tac (new_rewrite [] [])))))) THEN (TRY (((((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN ((use_arg_then2 ("size_ineqs", [])) (disch_tac [])) THEN (clear_assumption "size_ineqs") THEN BETA_TAC) THEN (arith_tac))))); + ((((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_zip", [nth_zip]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] []))))); + (((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`k + SUC (sizel f - 2) = sizel f - 1 + k`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("f_size", [])) (disch_tac [])) THEN (clear_assumption "f_size") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))) THEN (done_tac)); +];; + +(* Lemma split_list_explicit *) +let split_list_explicit = Sections.section_proof ["L";"d"] +`let f = find_pair_list L d in + (let y = FST (prev_el (list_pairs f) d) and + k = indexl d (list_pairs f) in + 3 < sizel f + ==> split_list_face (rotr 1 (rot k f)) + = [[y; FST d; SND d]; [y; SND d] ++ dropl 3 (rotr 1 (rot k f))] + /\ perm_eq (list_of_darts (split_list_face (rotr 1 (rot k f)))) + ([list_hyp_diag L d; e_list (list_hyp_diag L d)] ++ list_pairs f))` +[ + (repeat_tactic 1 9 ((CONV_TAC let_CONV))); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`MEM d (list_of_darts L)`))) (disch_eq_tac "mem_d" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + ((((use_arg_then2 ("mem_d", [])) (disch_tac [])) THEN (clear_assumption "mem_d") THEN BETA_TAC) THEN ((((use_arg_then2 ("find_pair_list_empty", [find_pair_list_empty]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + (BETA_TAC THEN (move ["f_size"])); + ((fun arg_tac -> arg_tac (Arg_term (`find_pair_list L d`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`FST _`))) (term_tac (set_tac "y"))); + ((fun arg_tac -> arg_tac (Arg_term (`indexl d _`))) (term_tac (set_tac "k"))); + ((fun arg_tac -> arg_tac (Arg_term (`rotr 1 _`))) (term_tac (set_tac "f'"))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE list_eq_cat_list_diag))) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("dart_in_find_pair_list", [dart_in_find_pair_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_d", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_size", [])) (disch_tac [])) THEN (clear_assumption "f_size") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then2 ("list_hyp_diag", [list_hyp_diag]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_list", [e_list]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("find_face_alt", [find_face_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("k_def", []))(thm_tac (new_rewrite [] []))))) THEN (move ["rot_eq"])); + ((((use_arg_then2 ("rot_eq", [])) (disch_tac [])) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("congr1", [congr1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`rotr 1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((((use_arg_then2 ("catA", [catA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cats1", [cats1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rotr1_rcons", [rotr1_rcons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat1s", [cat1s]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("catA", [catA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat1s", [cat1s]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] []))))) THEN (move ["f'_eq"]))); + ((fun arg_tac -> arg_tac (Arg_term (`belast (SND d) (dropl 2 (rot k f)) = SND d :: dropl 3 f'`))) (term_tac (have_gen_tac [](move ["eqX"])))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`1 <= sizel (dropl 2 (rot k f))`))) (term_tac (have_gen_tac []ALL_TAC))) (((((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_size", [])) (disch_tac [])) THEN (clear_assumption "f_size") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((((use_arg_then2 ("f'_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((THENL) (((fun arg_tac -> arg_tac (Arg_term (`dropl 2 (rot k f)`))) (disch_tac [])) THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]))])) ((((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("belast", [belast]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("cat1s", [cat1s])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SND d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("catA", [catA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cats1", [cats1]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("rcons", [rcons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("drop_size_cat", [drop_size_cat]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`_1 = _2`))) (term_tac (have_gen_tac [](move ["h1"])))); + ((((use_arg_then2 ("split_list_face", [split_list_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f'_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("size_rotr", [size_rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_size", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (congr_tac (`[_1; _2]`)); + (((((use_arg_then2 ("f'_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eqX", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("cat1s", [cat1s])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SND d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("catA", [catA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cats1", [cats1]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("rcons", [rcons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("take_size_cat", [take_size_cat]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((((use_arg_then2 ("f'_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eqX", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("drop_size_cat", [drop_size_cat]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("size_cons", [size_cons]))(fun tmp_arg1 -> (use_arg_then2 ("size_nil", [size_nil]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))))) ((arith_tac) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("cat1s", [cat1s])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("catA", [catA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("cat1s", [cat1s]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HD", [HD]))(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> (use_arg_then2 ("cat1s", [cat1s])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SND d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then2 ("catA", [catA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("drop_size_cat", [drop_size_cat]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("h1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("list_of_darts_cons", [list_of_darts_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("list_of_darts_nil", [list_of_darts_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cats0", [cats0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 2 0 (((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("rot1_cons", [rot1_cons]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("rcons", [rcons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("cat1s", [cat1s]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rcons", [rcons]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("zip", [zip]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("perm_catC", [perm_catC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat1s", [cat1s]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("perm_catC", [perm_catC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat1s", [cat1s]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("cat1s", [cat1s])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`FST d,SND d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("catA", [catA]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("perm_catC", [perm_catC]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("catA", [catA]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((fun arg_tac -> (use_arg_then2 ("cat1s", [cat1s])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SND d,y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("catA", [catA]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("perm_catC", [perm_catC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_cat2l", [perm_cat2l]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> (use_arg_then2 ("perm_eq_trans", [perm_eq_trans])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`list_pairs (rot k f)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("list_pairs_rot", [list_pairs_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqX", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat1s", [cat1s]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot1_cons", [rot1_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rcons", [rcons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("zip", [zip]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rcons_cat", [rcons_cat]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("rcons", [rcons]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("perm_catC", [perm_catC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat1s", [cat1s]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_cons", [perm_cons]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("cat1s", [cat1s])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`[FST d]`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("cat1s", [cat1s]))(gsym_then (thm_tac (new_rewrite [] [(`SND d :: _1 ++ [y]`)]))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("catA", [catA]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("zip_cat", [zip_cat]))(thm_tac (new_rewrite [] []))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("size_cat", [size_cat]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("cat1s", [cat1s]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cats1", [cats1]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("zip", [zip]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("cats1", [cats1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("perm_eq_refl", [perm_eq_refl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma darts_of_list_split *) +let darts_of_list_split = Sections.section_proof ["L";"d"] +`3 < sizel (find_pair_list L d) + ==> perm_eq (list_of_darts (split_list_hyp L d)) + ([list_hyp_diag L d; e_list (list_hyp_diag L d)] ++ list_of_darts L)` +[ + ((BETA_TAC THEN (move ["f_size"])) THEN (((use_arg_then2 ("perm_eq_sym", [perm_eq_sym]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`MEM d (list_of_darts L)`))) (term_tac (have_gen_tac [](move ["mem_d"])))); + ((((use_arg_then2 ("f_size", [])) (disch_tac [])) THEN (clear_assumption "f_size") THEN ((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("find_pair_list_empty", [find_pair_list_empty]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE split_list_hyp_alt)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE list_eq_cat_find_pair_list))) (fun fst_arg -> (use_arg_then2 ("L", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [3] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE split_list_explicit))) (fun fst_arg -> (use_arg_then2 ("f_size", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["split_eq"]) THEN (move ["darts_perm"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`find_pair_list L d`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`indexl f L`))) (term_tac (set_tac "n"))); + ((fun arg_tac -> arg_tac (Arg_term (`rotr 1 _`))) (term_tac (set_tac "f'"))); + ((repeat_tactic 1 9 (((use_arg_then2 ("list_of_darts_cat", [list_of_darts_cat]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("perm_catCA", [perm_catCA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_cat2l", [perm_cat2l]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("catA", [catA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_cat2r", [perm_cat2r]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("perm_eq_sym", [perm_eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_darts_cons", [list_of_darts_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_darts_nil", [list_of_darts_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cats0", [cats0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_perm", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma darts_of_list_split_same *) +let darts_of_list_split_same = Sections.section_proof ["L";"d"] +`sizel (find_pair_list L d) <= 3 + ==> perm_eq (list_of_darts (split_list_hyp L d)) (list_of_darts L)` +[ + ((BETA_TAC THEN (move ["f_size"])) THEN (((use_arg_then2 ("perm_eq_sym", [perm_eq_sym]))(thm_tac (new_rewrite [] []))))); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`MEM d (list_of_darts L)`))) (disch_eq_tac "mem_d" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + (((((use_arg_then2 ("d_not_in_dart_split_eq", [d_not_in_dart_split_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("perm_eq_refl", [perm_eq_refl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE split_list_hyp_alt)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE list_eq_cat_find_pair_list))) (fun fst_arg -> (use_arg_then2 ("L", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [1] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`find_pair_list L d`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`indexl f L`))) (term_tac (set_tac "n"))); + ((fun arg_tac -> arg_tac (Arg_term (`rotr 1 _`))) (term_tac (set_tac "f'"))); + ((repeat_tactic 1 9 (((use_arg_then2 ("list_of_darts_cat", [list_of_darts_cat]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("perm_cat2l", [perm_cat2l]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_cat2r", [perm_cat2r]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("split_list_face", [split_list_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_rotr", [size_rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_size", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`indexl d _`))) (term_tac (set_tac "k"))); + ((repeat_tactic 1 9 (((use_arg_then2 ("list_of_darts", [list_of_darts]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL foldr)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cats0", [cats0]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("rot_list_pairs", [rot_list_pairs]))(gsym_then (thm_tac (new_rewrite [] []))))))); + (((fun arg_tac -> (use_arg_then2 ("perm_eq_trans", [perm_eq_trans])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`rot k _`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("perm_eq_rot", [perm_eq_rot]))(fun tmp_arg1 -> (use_arg_then2 ("perm_eq_sym", [perm_eq_sym]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_of_elements_split *) +let list_of_elements_split = Sections.section_proof ["L";"d"] +`perm_eq (list_of_elements L) (list_of_elements (split_list_hyp L d))` +[ + (((use_arg_then2 ("uniq_perm_eq", [uniq_perm_eq])) (thm_tac apply_tac)) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("uniq_list_of_elements", [uniq_list_of_elements]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["i"]))); + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`MEM d (list_of_darts L)`))) (disch_eq_tac "mem_d" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("d_not_in_dart_split_eq", [d_not_in_dart_split_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE split_list_hyp_alt)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE list_eq_cat_find_pair_list))) (fun fst_arg -> (use_arg_then2 ("mem_d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [1] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`find_pair_list L d`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`indexl f L`))) (term_tac (set_tac "n"))); + ((repeat_tactic 1 9 (((use_arg_then2 ("list_of_elements", [list_of_elements]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("flatten_cat", [flatten_cat]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mem_undup", [mem_undup]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("orb_id2l", [orb_id2l])) (disch_tac [])) THEN (clear_assumption "orb_id2l") THEN (DISCH_THEN apply_tac) THEN (move ["_"])) THEN (((use_arg_then2 ("orb_id2r", [orb_id2r])) (disch_tac [])) THEN (clear_assumption "orb_id2r") THEN (DISCH_THEN apply_tac) THEN (move ["_"]))); + ((((use_arg_then2 ("flatten_cons", [flatten_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("flatten0", [flatten0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cats0", [cats0]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("split_list_face", [split_list_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rotr", [size_rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> arg_tac (Arg_term (`_ <= 3`))) (disch_eq_tac "f_size" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("flatten_cons", [flatten_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("flatten0", [flatten0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cats0", [cats0]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("mem_rotr", [mem_rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_rot", [mem_rot]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`rotr 1 _`))) (term_tac (set_tac "s"))); + ((fun arg_tac -> arg_tac (Arg_term (`?k. s = rot k f`))) (term_tac (have_gen_tac [](case THEN ((move ["k"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))))); + ((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("rot_rot_eq_rot", [rot_rot_eq_rot])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sizel f - 1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`indexl d (list_pairs f)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["k"]) THEN (move ["eq"]))))); + (((use_arg_then2 ("k", [])) (term_tac exists_tac)) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`3 < sizel f /\ 2 < 3`))) (term_tac (have_gen_tac [](move ["ineqs"])))) ((((use_arg_then2 ("f_size", [])) (disch_tac [])) THEN (clear_assumption "f_size") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mem_rot", [mem_rot])) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((((fun arg_tac -> (use_arg_then2 ("cat_take_drop", [cat_take_drop])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))); + ((case THEN (simp_tac) THEN (move ["mem_i"])) THEN (DISJ2_TAC) THEN (DISJ2_TAC)); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("cat_take_drop", [cat_take_drop])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`rot k f`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("drop_cat", [drop_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_take", [size_take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ineqs", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("ineqs", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_i", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))) THEN (((THENL) case [(DISCH_THEN (fun snd_th -> (use_arg_then2 ("mem_take", [mem_take])) (thm_tac (match_mp_then snd_th MP_TAC)))); ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (DISCH_THEN (fun snd_th -> (use_arg_then2 ("mem_drop", [mem_drop])) (thm_tac (match_mp_then snd_th MP_TAC))))])]) THEN ((TRY done_tac)))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`0 < sizel (rot k f)`))) (term_tac (have_gen_tac []ALL_TAC))) ((((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((THENL) (((fun arg_tac -> arg_tac (Arg_term (`rot k f`))) (disch_tac [])) THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]))]) THEN ((repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("size_nil", [size_nil]))(fun tmp_arg1 -> (use_arg_then2 ("ltn0", [ltn0]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HD)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_list_hyp_diag *) +let mem_list_hyp_diag = Sections.section_proof ["L";"d"] +`MEM d (list_of_darts L) /\ + (sizel (find_pair_list L d) = 1 \/ sizel (find_pair_list L d) = 3) + ==> MEM (list_hyp_diag L d) (find_face L d)` +[ + ((BETA_TAC THEN (case THEN ((move ["mem_d"]) THEN (move ["size_eq"])))) THEN ((((use_arg_then2 ("list_hyp_diag", [list_hyp_diag]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_face_alt", [find_face_alt]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`find_pair_list L d`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`indexl d (list_pairs f)`))) (term_tac (set_tac "k"))); + ((fun arg_tac -> arg_tac (Arg_term (`FST _`))) (term_tac (set_tac "y"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`MEM d (list_pairs f)`))) (term_tac (have_gen_tac [](move ["mem_d2"])))) (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart_in_find_pair_list", [dart_in_find_pair_list]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`k < sizel f`))) (term_tac (have_gen_tac [](move ["k_lt"])))) (((((use_arg_then2 ("size_list_pairs", [size_list_pairs]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("k_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((use_arg_then2 ("size_eq", [])) (disch_tac [])) THEN (clear_assumption "size_eq") THEN case THEN (move ["size_eq"])); + ((((use_arg_then2 ("size_eq", [])) (disch_tac [])) THEN (clear_assumption "size_eq") THEN BETA_TAC) THEN ((((use_arg_then2 ("size1_eq", [size1_eq]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (move ["f_eq"]))); + ((((use_arg_then2 ("mem_d2", [])) (disch_tac [])) THEN (clear_assumption "mem_d2") THEN BETA_TAC) THEN (((((use_arg_then2 ("y_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot1_cons", [rot1_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rcons", [rcons]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("zip", [zip]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_seq1", [mem_seq1]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("SND", [SND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("prev_el", [prev_el]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("Seq.index_head", [Seq.index_head]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("last", [last]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("list_pairs_rot", [list_pairs_rot])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`2 <= sizel f`))) (term_tac (have_gen_tac [](move ["size_ineq"])))) ((((use_arg_then2 ("size_eq", [])) (disch_tac [])) THEN (clear_assumption "size_eq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE list_eq_cat_list_diag))) (fun fst_arg -> (use_arg_then2 ("mem_d2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("size_ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("k_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_def", []))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`dropl 2 _`))) (term_tac (set_tac "l"))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`belast (SND d) l = [SND d]`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot1_cons", [rot1_cons]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("rcons", [rcons]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("zip", [zip]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`sizel l = 1`))) (term_tac (have_gen_tac []ALL_TAC))) (((((use_arg_then2 ("l_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("size1_eq", [size1_eq]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("belast", [belast]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma good_list_split *) +let good_list_split = Sections.section_proof ["L";"d"] +`good_list L /\ + (sizel (find_pair_list L d) <= 3 \/ + ~(MEM (list_hyp_diag L d) (list_of_darts L)) + /\ ~(FST (list_hyp_diag L d) = SND (list_hyp_diag L d))) + ==> good_list (split_list_hyp L d)` +[ + (BETA_TAC THEN (case THEN ((move ["goodL"]) THEN (move ["hyp"])))); + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`MEM d (list_of_darts L)`))) (disch_eq_tac "mem_d" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("d_not_in_dart_split_eq", [d_not_in_dart_split_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE split_list_hyp_alt))) (fun fst_arg -> (use_arg_then2 ("mem_d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE list_eq_cat_find_pair_list))) (fun fst_arg -> (use_arg_then2 ("mem_d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> arg_tac (Arg_term (`find_pair_list L d`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`indexl f L`))) (term_tac (set_tac "n"))); + ((fun arg_tac -> arg_tac (Arg_term (`rotr 1 _`))) (term_tac (set_tac "f'"))); + ((((use_arg_then2 ("goodL", [])) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["uniqL"])) THEN (case THEN (move ["allL"])) THEN (move ["symL"]) THEN (move ["L_eq"]) THEN (move ["split_eq"]))); + (((fun arg_tac -> arg_tac (Arg_term (`sizel (find_pair_list L d) <= 3`))) (disch_eq_tac "f_size" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE darts_of_list_split_same))) (fun fst_arg -> (use_arg_then2 ("f_size", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["perm_darts"]))); + ((THENL_ROT (-1)) (((((fun arg_tac -> (use_arg_then2 ("perm_eq_uniq", [perm_eq_uniq])) (fun fst_arg -> (use_arg_then2 ("perm_darts", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("uniqL", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac))); + ((BETA_TAC THEN (move ["y"])) THEN ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (use_arg_then2 ("perm_darts", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("symL", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); + ((((use_arg_then2 ("split_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("split_list_face", [split_list_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f'_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("size_rotr", [size_rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_size", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("allL", [])) (disch_tac [])) THEN (clear_assumption "allL") THEN BETA_TAC) THEN (((((use_arg_then2 ("L_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("all_cat", [all_cat]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("all", [all]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["f_neq"])) THEN (move ["_"]))); + (((((use_arg_then2 ("size_eq0", [size_eq0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_rotr", [size_rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_eq0", [size_eq0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("hyp", [])) (disch_tac [])) THEN (clear_assumption "hyp") THEN BETA_TAC) THEN (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_size", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["n_mem"])) THEN (move ["neq"]))); + (in_tac ["f_size"] false (((use_arg_then2 ("NOT_LE", [NOT_LE]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE darts_of_list_split))) (fun fst_arg -> (use_arg_then2 ("f_size", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["perm_darts"]))); + (split_tac); + ((THENL_ROT (-1)) (((((fun arg_tac -> (use_arg_then2 ("perm_eq_uniq", [perm_eq_uniq])) (fun fst_arg -> (use_arg_then2 ("perm_darts", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL uniq)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("uniqL", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (split_tac))); + ((((use_arg_then2 ("n_mem", [])) (disch_tac [])) THEN (clear_assumption "n_mem") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("symL", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN ((((use_arg_then2 ("e_list", [e_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SND", [SND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("n_mem", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbF", [orbF]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("neq", [])) (disch_tac [])) THEN (clear_assumption "neq") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("e_list", [e_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pair_expand", [pair_expand]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (split_tac); + ((((use_arg_then2 ("allL", [])) (disch_tac [])) THEN (clear_assumption "allL") THEN BETA_TAC) THEN ((((use_arg_then2 ("L_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("split_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("all_cat", [all_cat]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("split_list_face", [split_list_face]))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`3 < sizel f'`))) (term_tac (have_gen_tac [](move ["f'_size"])))) (((((use_arg_then2 ("f'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_rotr", [size_rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_size", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f'_size", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("all", [all]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["_"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("size_eq0", [size_eq0]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("size_take", [size_take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f'_size", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((BETA_TAC THEN (move ["y"])) THEN ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (use_arg_then2 ("perm_darts", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("e_list", [e_list]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`list_hyp_diag L d`))) (term_tac (set_tac "h"))); + ((THENL_LAST) case (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("symL", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma hypermap_of_list_perm *) +let hypermap_of_list_perm = Sections.section_proof ["L1";"L2"] +`perm_eq L1 L2 /\ good_list L1 + ==> hypermap_of_list L1 = hypermap_of_list L2` +[ + (BETA_TAC THEN (case THEN ((move ["perm"]) THEN (move ["good1"])))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("good_list_perm", [good_list_perm])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("good1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["good2"]))); + ((fun arg_tac -> (use_arg_then2 ("list_of_darts_perm", [list_of_darts_perm])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["perm_darts"]))); + ((fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (use_arg_then2 ("perm_darts", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["mem_eq"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("hypermap_of_list", [hypermap_of_list]))(thm_tac (new_rewrite [] []))))) THEN (congr_tac (`hypermap _`))); + ((repeat_tactic 1 9 (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("perm_eq_set_of_list_eq", [perm_eq_set_of_list_eq])) (fun fst_arg -> (use_arg_then2 ("perm_darts", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(!d. MEM d (list_of_darts L1) ==> f1 d = f2 d) + ==> res f1 (darts_of_list L1) = res f2 (darts_of_list L2)`))) (term_tac (have_gen_tac ["f1"; "f2"](move ["res_eq"])))); + ((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (move ["eq"]) THEN (move ["d"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> arg_tac (Arg_term (`MEM d _`))) (disch_eq_tac "mem_d" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((THENL_FIRST) (split_tac) ((repeat_tactic 1 9 (((use_arg_then2 ("e_list_ext", [e_list_ext]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("res_eq", [])) (disch_tac [])) THEN (clear_assumption "res_eq") THEN (DISCH_THEN apply_tac) THEN (move ["d"]) THEN (move ["mem_d"])) THEN (repeat_tactic 1 9 (((use_arg_then2 ("e_list", [e_list]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`MEM d (list_of_darts L1) ==> find_face L2 d = find_face L1 d`))) (term_tac (have_gen_tac ["d"](move ["face_eq"])))); + ((BETA_TAC THEN (move ["mem_d"])) THEN (repeat_tactic 1 9 (((use_arg_then2 ("find_face_alt", [find_face_alt]))(thm_tac (new_rewrite [] []))))) THEN (congr_tac (`list_pairs _`))); + ((((use_arg_then2 ("good1", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["uniq1"])) THEN (move ["_"]))); + (((fun arg_tac -> (use_arg_then2 ("find_pair_list_unique", [find_pair_list_unique])) (fun fst_arg -> (use_arg_then2 ("uniq1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("find_face_alt", [find_face_alt]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_d", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_find_pair_list", [mem_find_pair_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((split_tac) THEN (repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("n_list_ext", [n_list_ext]))(fun tmp_arg1 -> (use_arg_then2 ("f_list_ext", [f_list_ext]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("res_eq", [])) (disch_tac [])) THEN (clear_assumption "res_eq") THEN (DISCH_THEN apply_tac) THEN (move ["d"]) THEN (move ["mem_d"]))); + (((repeat_tactic 1 9 (((use_arg_then2 ("n_list", [n_list]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("face_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("e_list", [e_list]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then2 ("f_list", [f_list]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("face_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma find_face_rot *) +let find_face_rot = Sections.section_proof ["L1";"L2";"d"] +`ALL2 (\f1 f2. ?n. f2 = rot n f1) L1 L2 + ==> ?n. find_face L2 d = rot n (find_face L1 d)` +[ + ((((THENL) (((use_arg_then2 ("L2", [])) (disch_tac [])) THEN (clear_assumption "L2") THEN ((use_arg_then2 ("L1", [])) (disch_tac [])) THEN (clear_assumption "L1") THEN elim) [ALL_TAC; ((move ["h1"]) THEN (move ["t1"]) THEN (move ["Ih"]))]) THEN ((THENL) case [ALL_TAC; ((move ["h2"]) THEN (move ["t2"]))])) THEN ((((use_arg_then2 ("ALL2", [ALL2]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)))); + (((((use_arg_then2 ("find_face", [find_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_of_faces", [list_of_faces]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MAP", [MAP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_list", [find_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot_nil", [rot_nil]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["n"])) THEN (move ["h2_eq"]) THEN (move ["all2"])) THEN (repeat_tactic 1 9 (((use_arg_then2 ("find_face_cons", [find_face_cons]))(thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> arg_tac (Arg_term (`MEM d (list_pairs h1)`))) (disch_eq_tac "mem_d" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((use_arg_then2 ("n", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("h2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("list_pairs_rot", [list_pairs_rot])) (fun fst_arg -> (use_arg_then2 ("h1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_d", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("rot_list_pairs", [rot_list_pairs]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("Ih", [])) (fun fst_arg -> (use_arg_then2 ("all2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["m"])) THEN (move ["eq"])) THEN ((use_arg_then2 ("m", [])) (term_tac exists_tac))); + (((((use_arg_then2 ("h2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("list_pairs_rot", [list_pairs_rot])) (fun fst_arg -> (use_arg_then2 ("h1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_d", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rot_list_of_darts_perm *) +let rot_list_of_darts_perm = Sections.section_proof ["L1";"L2"] +`ALL2 (\f1 f2. ?n. f2 = rot n f1) L1 L2 + ==> perm_eq (list_of_darts L1) (list_of_darts L2)` +[ + ((((THENL) (((use_arg_then2 ("L2", [])) (disch_tac [])) THEN (clear_assumption "L2") THEN ((use_arg_then2 ("L1", [])) (disch_tac [])) THEN (clear_assumption "L1") THEN elim) [ALL_TAC; ((move ["h1"]) THEN (move ["t1"]) THEN (move ["Ih"]))]) THEN ((THENL) case [ALL_TAC; ((move ["h2"]) THEN (move ["t2"]))])) THEN ((((use_arg_then2 ("ALL2", [ALL2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("list_of_darts_nil", [list_of_darts_nil]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("perm_eq_refl", [perm_eq_refl]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)))); + (BETA_TAC THEN (case THEN ALL_TAC) THEN (case THEN ((move ["n"]) THEN (move ["h2_eq"]))) THEN (move ["all2"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("list_of_darts_cons", [list_of_darts_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("perm_eq_cat", [perm_eq_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("h2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_eq_sym", [perm_eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_pairs_rot", [list_pairs_rot]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rot_hypermap_of_list_eq *) +let rot_hypermap_of_list_eq = Sections.section_proof ["L1";"L2"] +`ALL2 (\f1 f2. ?n. f2 = rot n f1) L1 L2 /\ uniq (list_of_darts L1) + ==> hypermap_of_list L2 = hypermap_of_list L1` +[ + (BETA_TAC THEN (case THEN ((move ["all2"]) THEN (move ["uniq1"])))); + ((repeat_tactic 1 9 (((use_arg_then2 ("hypermap_of_list", [hypermap_of_list]))(thm_tac (new_rewrite [] []))))) THEN (congr_tac (`hypermap _`))); + ((fun arg_tac -> (use_arg_then2 ("rot_list_of_darts_perm", [rot_list_of_darts_perm])) (fun fst_arg -> (use_arg_then2 ("all2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["perm_darts"]))); + ((fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (use_arg_then2 ("perm_darts", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["mem_eq"]))); + ((fun arg_tac -> (use_arg_then2 ("find_face_rot", [find_face_rot])) (fun fst_arg -> (use_arg_then2 ("all2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["face_eq"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("perm_eq_set_of_list_eq", [perm_eq_set_of_list_eq])) (fun fst_arg -> (use_arg_then2 ("perm_darts", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(!d. MEM d (list_of_darts L1) ==> f1 d = f2 d) + ==> res f2 (darts_of_list L2) = res f1 (darts_of_list L1)`))) (term_tac (have_gen_tac ["f1"; "f2"](move ["res_eq"])))); + ((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (move ["eq"]) THEN (move ["y"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> arg_tac (Arg_term (`MEM y _`))) (disch_eq_tac "mem_y" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((THENL_FIRST) (split_tac) ((repeat_tactic 1 9 (((use_arg_then2 ("e_list_ext", [e_list_ext]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("res_eq", [])) (disch_tac [])) THEN (clear_assumption "res_eq") THEN (DISCH_THEN apply_tac) THEN (move ["y"]) THEN (move ["mem_y"])) THEN (repeat_tactic 1 9 (((use_arg_then2 ("e_list", [e_list]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (split_tac); + ((repeat_tactic 1 9 (((use_arg_then2 ("n_list_ext", [n_list_ext]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("res_eq", [])) (disch_tac [])) THEN (clear_assumption "res_eq") THEN (DISCH_THEN apply_tac) THEN (move ["d"]) THEN (move ["mem_d"]))); + (((fun arg_tac -> (use_arg_then2 ("face_eq", [])) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["n"])) THEN (move ["f_eq"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("n_list", [n_list]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("prev_el_rot_eq", [prev_el_rot_eq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("e_list", [e_list]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("uniq_find_face", [uniq_find_face]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("f_list_ext", [f_list_ext]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("res_eq", [])) (disch_tac [])) THEN (clear_assumption "res_eq") THEN (DISCH_THEN apply_tac) THEN (move ["d"]) THEN (move ["mem_d"]))); + (((fun arg_tac -> (use_arg_then2 ("face_eq", [])) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["n"])) THEN (move ["f_eq"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("f_list", [f_list]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("next_el_rot_eq", [next_el_rot_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("uniq_find_face", [uniq_find_face]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma hypermap_of_split_list_eq3 *) +let hypermap_of_split_list_eq3 = Sections.section_proof ["L";"d"] +`sizel (find_face L d) <= 3 /\ uniq (list_of_darts L) + ==> hypermap_of_list (split_list_hyp L d) = hypermap_of_list L` +[ + (BETA_TAC THEN (case THEN ((move ["f_size"]) THEN (move ["uniq_darts"])))); + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`MEM d (list_of_darts L)`))) (disch_eq_tac "mem_d" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("d_not_in_dart_split_eq", [d_not_in_dart_split_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`!s:((A)list)list. ALL2 (\f1 f2. ?n. f2 = rot n f1) s s`))) (term_tac (have_gen_tac [](move ["all2_refl"])))); + (((THENL) elim [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((((use_arg_then2 ("ALL2", [ALL2]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`0`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("rot0", [rot0]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((fun arg_tac -> (use_arg_then2 ("rot_hypermap_of_list_eq", [rot_hypermap_of_list_eq])) (fun fst_arg -> (use_arg_then2 ("uniq_darts", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE split_list_hyp_alt)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE list_eq_cat_find_pair_list))) (fun fst_arg -> (use_arg_then2 ("L", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [1] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("f_size", [])) (disch_tac [])) THEN (clear_assumption "f_size") THEN BETA_TAC) THEN ((((use_arg_then2 ("find_face_alt", [find_face_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_list_pairs", [size_list_pairs]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`find_pair_list L d`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`indexl f L`))) (term_tac (set_tac "n"))); + (BETA_TAC THEN (move ["f_size"])); + ((((use_arg_then2 ("split_list_face", [split_list_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rotr", [size_rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_size", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("ALL2_cat", [ALL2_cat]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("all2_refl", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ALL2", [ALL2]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`sizel _ - 1`))) (term_tac (set_tac "i"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`indexl d _`))) (term_tac (set_tac "j")))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("rot_rot_eq_rot", [rot_rot_eq_rot])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["k"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("k", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma f_split_list *) +let f_split_list = Sections.section_proof ["L";"d"] +`let L2 = split_list_hyp L d and g = list_hyp_diag L d and f = find_face L d in + good_list L /\ 3 < sizel f + /\ ~(MEM g (list_of_darts L)) + /\ ~(FST g = SND g) + ==> f_list L2 d = g + /\ f_list L2 g = prev_el f d + /\ f_list L2 (e_list g) = f_list L d + /\ f_list L2 (prev_el f (prev_el f d)) = e_list g + /\ (!x. MEM x (list_of_darts L2) + /\ ~(x = d \/ x = g \/ x = e_list g \/ x = prev_el f (prev_el f d)) + ==> f_list L2 x = f_list L x)` +[ + (CONV_TAC let_CONV); + (BETA_TAC THEN (case THEN (move ["goodL"])) THEN (case THEN (move ["f_size"])) THEN (case THEN (move ["g_n_mem"])) THEN (move ["g_neq"])); + ((fun arg_tac -> arg_tac (Arg_term (`3 < sizel (find_pair_list L d)`))) (term_tac (have_gen_tac [](move ["size_gt3"])))); + ((((use_arg_then2 ("f_size", [])) (disch_tac [])) THEN (clear_assumption "f_size") THEN BETA_TAC) THEN ((((use_arg_then2 ("find_face_alt", [find_face_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_list_pairs", [size_list_pairs]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`MEM d (list_of_darts L)`))) (term_tac (have_gen_tac [](move ["mem_d"])))); + ((((use_arg_then2 ("size_gt3", [])) (disch_tac [])) THEN (clear_assumption "size_gt3") THEN ((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("find_pair_list_empty", [find_pair_list_empty]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> (use_arg_then2 ("darts_of_list_split", [darts_of_list_split])) (fun fst_arg -> (use_arg_then2 ("size_gt3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE split_list_hyp_alt))) (fun fst_arg -> (use_arg_then2 ("mem_d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE split_list_explicit))) (fun fst_arg -> (use_arg_then2 ("size_gt3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("good_list_split", [good_list_split])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((THENL) (ANTS_TAC) [((TRY done_tac)); (move ["goodL2"])])); + (repeat_tactic 1 9 (((use_arg_then2 ("find_face_alt", [find_face_alt]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`find_pair_list L d`))) (term_tac (set_tac "s"))); + ((fun arg_tac -> arg_tac (Arg_term (`indexl s _`))) (term_tac (set_tac "n"))); + ((fun arg_tac -> arg_tac (Arg_term (`indexl d _`))) (term_tac (set_tac "k"))); + ((fun arg_tac -> arg_tac (Arg_term (`rotr 1 _`))) (term_tac (set_tac "s'"))); + ((fun arg_tac -> arg_tac (Arg_term (`split_list_hyp L d`))) (term_tac (set_tac "L2"))); + ((fun arg_tac -> arg_tac (Arg_term (`list_hyp_diag L d`))) (term_tac (set_tac "g"))); + ((fun arg_tac -> arg_tac (Arg_term (`find_face L d`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`FST _ :: _2`))) (term_tac (set_tac "s1"))); + ((fun arg_tac -> arg_tac (Arg_term (`cat _1 _2`))) (term_tac (set_tac "s2"))); + (BETA_TAC THEN (case THEN ((move ["split_s'_eq"]) THEN (move ["darts_s'"]))) THEN (move ["L2_eq"]) THEN (move ["dartsL2"])); + ((((use_arg_then2 ("goodL2", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["uniqL2"])) THEN (move ["_"]))); + ((((use_arg_then2 ("goodL", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["uniqL"])) THEN (move ["_"]))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`list_pairs s = f`))) (term_tac (have_gen_tac [](move ["fs_eq"])))) (((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("find_face_alt", [find_face_alt]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`list_pairs s1 = [prev_el f d; d; g]`))) (term_tac (have_gen_tac [](move ["s1_pairs_eq"])))); + ((((use_arg_then2 ("s1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot1_cons", [rot1_cons]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("rcons", [rcons]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("zip", [zip]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then2 ("list_hyp_diag", [list_hyp_diag]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("g_def", []))(thm_tac (new_rewrite [] []))))) THEN (congr_tac (`[_; d; g]`))); + ((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pair_expand", [pair_expand]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("prev_el_list_pairs_general", [prev_el_list_pairs_general])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`FST d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SND d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)); + (((((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fs_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fs_eq", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["z"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`uniq f`))) (term_tac (have_gen_tac [](move ["uniq_f"])))) (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("uniq_find_face", [uniq_find_face]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`MEM s1 L2 /\ MEM s2 L2`))) (term_tac (have_gen_tac [](move ["s12_mem"])))); + (((((use_arg_then2 ("L2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("split_s'_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`MEM (list_pairs s1) (list_of_faces L2) /\ MEM (list_pairs s2) (list_of_faces L2)`))) (term_tac (have_gen_tac [](move ["s12_pairs_mem"])))); + (((THENL) (((((use_arg_then2 ("list_of_faces", [list_of_faces]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("map_MAP", [map_MAP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mapP", [mapP]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac)) [((use_arg_then2 ("s1", [])) (term_tac exists_tac)); ((use_arg_then2 ("s2", [])) (term_tac exists_tac))]) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`uniq (list_pairs s1) /\ uniq (list_pairs s2)`))) (term_tac (have_gen_tac [](move ["s12_pairs_uniq"])))); + ((split_tac) THEN (((fun arg_tac -> (use_arg_then2 ("uniq_face", [uniq_face])) (fun fst_arg -> (use_arg_then2 ("goodL2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`next_el f x = next_el (list_pairs s') x`))) (term_tac (have_gen_tac ["x"](move ["next_el_fs'"])))); + ((((use_arg_then2 ("s'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rotr_list_pairs", [rotr_list_pairs]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rot_list_pairs", [rot_list_pairs]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("next_el_rotr_eq", [next_el_rotr_eq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("rot_uniq", [rot_uniq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("next_el_rot_eq", [next_el_rot_eq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`prev_el f x = prev_el (list_pairs s') x`))) (term_tac (have_gen_tac ["x"](move ["prev_el_fs'"])))); + ((((use_arg_then2 ("s'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rotr_list_pairs", [rotr_list_pairs]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rot_list_pairs", [rot_list_pairs]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("prev_el_rotr_eq", [prev_el_rotr_eq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("rot_uniq", [rot_uniq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("prev_el_rot_eq", [prev_el_rot_eq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`MEM x f ==> MEM x (list_of_darts L)`))) (term_tac (have_gen_tac ["x"](move ["mem_f_darts"])))); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("mem_find_face_imp_mem_darts", [mem_find_face_imp_mem_darts])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`MEM d f`))) (term_tac (have_gen_tac [](move ["mem_df"])))) (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`perm_eq (list_pairs s') f`))) (term_tac (have_gen_tac [](move ["p_eq_f_s'"])))); + ((((use_arg_then2 ("s'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fs_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rotr_list_pairs", [rotr_list_pairs]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rot_list_pairs", [rot_list_pairs]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`sizel _ - 1`))) (term_tac (set_tac "r"))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("rot_rot_eq_rot", [rot_rot_eq_rot])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`list_pairs s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("r", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["i"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + ((((use_arg_then2 ("perm_eq_rot", [perm_eq_rot]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`sizel s' = sizel s`))) (term_tac (have_gen_tac [](move ["size_s'"])))) (((((use_arg_then2 ("s'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_rotr", [size_rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`s' = s1 ++ dropl 3 s'`))) (term_tac (have_gen_tac [](move ["s'_eq1"])))); + ((((use_arg_then2 ("split_s'_eq", [])) (disch_tac [])) THEN (clear_assumption "split_s'_eq") THEN BETA_TAC) THEN ((((use_arg_then2 ("split_list_face", [split_list_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_s'", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_gt3", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("cat_take_drop", [cat_take_drop])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [4] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (injectivity "list")))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`list_pairs s' = prev_el f d :: d :: dropl 2 (list_pairs s')`))) (term_tac (have_gen_tac [](move ["s'_pairs_eq"])))); + (((((fun arg_tac -> (use_arg_then2 ("cat_take_drop", [cat_take_drop])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("cat1s", [cat1s]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("cat1s", [cat1s])) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("catA", [catA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat1s", [cat1s]))(thm_tac (new_rewrite [] []))))) THEN ((congr_tac (`_1 ++ _2`)) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("s'_eq1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot1_cons", [rot1_cons]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("rcons", [rcons]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("zip", [zip]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("TWO", [TWO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("take", [take]))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("prev_el_list_pairs_general", [prev_el_list_pairs_general])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`FST d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SND d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)); + (((((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fs_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((BETA_TAC THEN (case THEN (move ["z"]))) THEN (((((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fs_eq", []))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`list_pairs s2 = e_list g :: dropl 2 (list_pairs s')`))) (term_tac (have_gen_tac [](move ["s2_pairs_eq"])))); + ((((use_arg_then2 ("s'_eq1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("s2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("list_pairs", [list_pairs]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("rot1_cons", [rot1_cons]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("rcons", [rcons]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("zip", [zip]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("TWO", [TWO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("drop", [drop]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("g_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("list_hyp_diag", [list_hyp_diag]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_list", [e_list]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`0 < sizel (dropl 2 (list_pairs s')) /\ 1 < sizel (dropl 2 (list_pairs s')) + /\ 0 < sizel (list_pairs s') /\ 2 < sizel (list_pairs s')`))) (term_tac (have_gen_tac [](move ["size_uneqs"])))); + (((((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_list_pairs", [size_list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_s'", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_gt3", [])) (disch_tac [])) THEN (clear_assumption "size_gt3") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`sizel (list_pairs s2) = sizel (list_pairs s') - 1 /\ 0 < sizel (list_pairs s2)`))) (term_tac (have_gen_tac [](move ["size_ineqs_s2"])))); + (((((use_arg_then2 ("s2_pairs_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_list_pairs", [size_list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_s'", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_gt3", [])) (disch_tac [])) THEN (clear_assumption "size_gt3") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`last d (list_pairs s') = prev_el f (prev_el f d)`))) (term_tac (have_gen_tac [](move ["last_s'"])))); + (((((use_arg_then2 ("prev_el_hd", [prev_el_hd]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("s'_pairs_eq", []))(thm_tac (new_rewrite [2] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HD)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("prev_el_fs'", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mem_prev_el", [mem_prev_el]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`last d (list_pairs s2) = prev_el f (prev_el f d)`))) (term_tac (have_gen_tac [](move ["last_s2"])))); + (((((use_arg_then2 ("last_s'", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("s2_pairs_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("last", [last]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("last_drop", [last_drop]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((use_arg_then2 ("last_eq", [last_eq])) (thm_tac apply_tac)) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`MEM x (list_of_darts L2) <=> x = g \/ x = e_list g \/ MEM x (list_of_darts L)`))) (term_tac (have_gen_tac ["x"](move ["memL2"])))); + (((((fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (use_arg_then2 ("dartsL2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("orbF", [orbF]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("orbA", [orbA]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`find_face L2 d = list_pairs s1 /\ find_face L2 g = list_pairs s1 + /\ find_face L2 (prev_el f d) = list_pairs s1`))) (term_tac (have_gen_tac [](move ["find_s1"])))); + ((repeat_tactic 1 9 (((use_arg_then2 ("find_face_eq", [find_face_eq]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("uniqL2", []))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("memL2", []))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("mem_d", []))(fun tmp_arg1 -> (use_arg_then2 ("s12_pairs_mem", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mem_f_darts", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mem_prev_el", [mem_prev_el]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("s1_pairs_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`find_face L2 (e_list g) = list_pairs s2 + /\ find_face L2 (prev_el f (prev_el f d)) = list_pairs s2`))) (term_tac (have_gen_tac [](move ["find_s2"])))); + ((repeat_tactic 1 9 (((use_arg_then2 ("find_face_eq", [find_face_eq]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("uniqL2", []))(fun tmp_arg1 -> (use_arg_then2 ("memL2", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mem_f_darts", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mem_prev_el", [mem_prev_el]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("s12_pairs_mem", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s2_pairs_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("last_s'", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("last_drop", [last_drop])) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("last_eq", [last_eq])) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`e_list g`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mem_last", [mem_last]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("f_list", [f_list]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("find_s1", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("find_s2", []))(thm_tac (new_rewrite [] [])))))); + (split_tac); + (((((fun arg_tac -> (use_arg_then2 ("next_el_rot_eq", [next_el_rot_eq])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("s1_pairs_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot1_cons", [rot1_cons]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("rcons", [rcons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("next_el_hd_cons2", [next_el_hd_cons2]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (split_tac); + ((((fun arg_tac -> (use_arg_then2 ("next_el_rotr_eq", [next_el_rotr_eq])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("s1_pairs_eq", []))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("cat1s", [cat1s]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("cat1s", [cat1s])) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("catA", [catA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cats1", [cats1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rotr1_rcons", [rotr1_rcons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat1s", [cat1s]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("next_el_hd_cons2", [next_el_hd_cons2]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (split_tac); + ((((use_arg_then2 ("s2_pairs_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("next_el_hd_cons", [next_el_hd_cons]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("next_el_fs'", []))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("next_el_rot_eq", [next_el_rot_eq])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("perm_eq_uniq", [perm_eq_uniq])) (fun fst_arg -> (use_arg_then2 ("p_eq_f_s'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("s'_pairs_eq", []))(thm_tac (new_rewrite [2] [])))) THEN (((use_arg_then2 ("rot1_cons", [rot1_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rcons", [rcons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("next_el_hd_cons", [next_el_hd_cons]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_rcons", [size_rcons]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("gtS0", [gtS0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("headI", [headI]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HD", [HD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("head_HD", [head_HD]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (split_tac); + (((((use_arg_then2 ("last_s2", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("next_el_last", [next_el_last]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("s2_pairs_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HD", [HD]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN (move ["mem_x"])) THEN (move ["x_neq"])); + ((((use_arg_then2 ("mem_x", [])) (disch_tac [])) THEN (clear_assumption "mem_x") THEN BETA_TAC) THEN (((((use_arg_then2 ("memL2", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("x_neq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("orFb", [orFb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["mem_x"]))); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`MEM x f`))) (disch_eq_tac "mem_x_f" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + (congr_tac (`next_el _ x`)); + ((((use_arg_then2 ("find_face_eq", [find_face_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_x", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE list_eq_cat_find_pair_list))) (fun fst_arg -> (use_arg_then2 ("mem_d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("s_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] []))))) THEN (move ["L_eq"])); + ((((fun arg_tac -> (use_arg_then2 ("mem_find_face", [mem_find_face])) (fun fst_arg -> (use_arg_then2 ("mem_x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("L_eq", []))(thm_tac (new_rewrite [2] [])))) THEN (((use_arg_then2 ("L2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("list_of_faces", [list_of_faces]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("map_MAP", [map_MAP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mapP", [mapP]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] []))))))); + ((BETA_TAC THEN (case THEN (move ["l"])) THEN (case THEN (move ["mem_l"])) THEN (move ["eq"])) THEN ((use_arg_then2 ("l", [])) (term_tac exists_tac))); + ((((THENL) (((use_arg_then2 ("mem_l", [])) (disch_tac [])) THEN (clear_assumption "mem_l") THEN case) [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); ((THENL) case [ALL_TAC; (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))])]) THEN ((TRY done_tac))) THEN ((((use_arg_then2 ("mem_seq1", [mem_seq1]))(thm_tac (new_rewrite [] [])))) THEN (move ["l_eq"]))); + ((((use_arg_then2 ("mem_x_f", [])) (disch_tac [])) THEN (clear_assumption "mem_x_f") THEN ((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN (((((use_arg_then2 ("l_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fs_eq", []))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`find_face L x = f`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("find_face_alt", [find_face_alt]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))) THEN ((congr_tac (`_1 _2`)) THEN ((TRY done_tac)))); + ((((fun arg_tac -> (use_arg_then2 ("find_pair_list_unique", [find_pair_list_unique])) (fun fst_arg -> (use_arg_then2 ("uniqL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("mem_find_pair_list", [mem_find_pair_list]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`x = prev_el f d`))) (disch_eq_tac "x_eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_s1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s1_pairs_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("next_el_hd_cons2", [next_el_hd_cons2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("next_prev_id", [next_prev_id]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`MEM x (list_pairs s2)`))) (term_tac (have_gen_tac [](move ["mem_x_s2"])))); + ((((fun arg_tac -> (use_arg_then2 ("iffRL", [iffRL])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (use_arg_then2 ("darts_s'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_x_f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((((use_arg_then2 ("split_s'_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("list_of_darts_cons", [list_of_darts_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("list_of_darts_nil", [list_of_darts_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cats0", [cats0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] []))))); + ((case THEN ((TRY done_tac))) THEN ((((use_arg_then2 ("s1_pairs_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`find_face L2 x = list_pairs s2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) (((((use_arg_then2 ("find_face_eq", [find_face_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("s12_pairs_mem", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("next_el_fs'", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("next_el", [next_el]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`indexl x _`))) (term_tac (set_tac "i"))); + ((fun arg_tac -> arg_tac (Arg_term (`1 <= i /\ i < sizel (list_pairs s2) - 1`))) (term_tac (have_gen_tac [](move ["i_ineqs"])))); + ((((use_arg_then2 ("mem_x_s2", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("index_mem", [index_mem]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("i_def", []))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`~(i = 0) /\ ~(i = sizel (list_pairs s2) - 1)`))) (term_tac (have_gen_tac []ALL_TAC)))) ((arith_tac) THEN (done_tac))); + ((((fun arg_tac ->(use_arg_then2 ("x_eq", []))(fun tmp_arg1 -> (use_arg_then2 ("x_neq", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2)))))) (disch_tac [])) THEN ((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] []))))))); + ((case THEN (move ["i_eq"])) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_index", [nth_index])) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("mem_x_s2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("i_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_eq", []))(thm_tac (new_rewrite [] [])))))); + ((((((use_arg_then2 ("s2_pairs_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`i = indexl (last d (list_pairs s2)) (list_pairs s2)`))) (term_tac (have_gen_tac [](move ["i_eq2"])))); + (((((use_arg_then2 ("s2_pairs_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("last", [last]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("index_last", [index_last]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("s2_pairs_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("i_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_ineqs_s2", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("i_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("i_eq2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("last_s2", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_index", [nth_index]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((((use_arg_then2 ("s2_pairs_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("last", [last]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_last", [mem_last]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(i = sizel (list_pairs s2) - 1)`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))))) ((((use_arg_then2 ("i_ineqs", [])) (disch_tac [])) THEN (clear_assumption "i_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("s2_pairs_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addn1", [addn1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("next_el", [next_el]))(thm_tac (new_rewrite [] []))))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`indexl x (list_pairs s') = i + 1`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(i + 1 = sizel (list_pairs s') - 1)`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))))) ((((use_arg_then2 ("i_ineqs", [])) (disch_tac [])) THEN (clear_assumption "i_ineqs") THEN BETA_TAC) THEN (((use_arg_then2 ("size_ineqs_s2", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("addn1", [addn1]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("s'_pairs_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`nth x (list_pairs s') (i + 1) = x`))) (term_tac (have_gen_tac [](move ["nth_eq"]))))); + ((((use_arg_then2 ("nth_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index_uniq", [index_uniq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("perm_eq_uniq", [perm_eq_uniq])) (fun fst_arg -> (use_arg_then2 ("p_eq_f_s'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("uniq_f", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("i_ineqs", [])) (disch_tac [])) THEN (clear_assumption "i_ineqs") THEN BETA_TAC) THEN (((use_arg_then2 ("size_ineqs_s2", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_index", [nth_index])) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("mem_x_s2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("i_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addn1", [addn1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s'_pairs_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s2_pairs_eq", []))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("i_ineqs", [])) (disch_tac [])) THEN (clear_assumption "i_ineqs") THEN ((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN case) [ALL_TAC; ((move ["j"]) THEN (move ["j_ineq"]))]) ((arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [2] [])))))); + (((use_arg_then2 ("set_nth_default", [set_nth_default])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("j_ineq", [])) (disch_tac [])) THEN (clear_assumption "j_ineq") THEN BETA_TAC) THEN ((((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_ineqs_s2", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section SplitListHyp *) +let split_list_hyp_alt = Sections.finalize_theorem split_list_hyp_alt;; +let d_not_in_dart_split_eq = Sections.finalize_theorem d_not_in_dart_split_eq;; +let list_eq_cat_find_pair_list = Sections.finalize_theorem list_eq_cat_find_pair_list;; +let list_eq_cat_list_diag = Sections.finalize_theorem list_eq_cat_list_diag;; +let split_list_explicit = Sections.finalize_theorem split_list_explicit;; +let darts_of_list_split = Sections.finalize_theorem darts_of_list_split;; +let darts_of_list_split_same = Sections.finalize_theorem darts_of_list_split_same;; +let list_of_elements_split = Sections.finalize_theorem list_of_elements_split;; +let mem_list_hyp_diag = Sections.finalize_theorem mem_list_hyp_diag;; +let good_list_split = Sections.finalize_theorem good_list_split;; +let hypermap_of_list_perm = Sections.finalize_theorem hypermap_of_list_perm;; +let find_face_rot = Sections.finalize_theorem find_face_rot;; +let rot_list_of_darts_perm = Sections.finalize_theorem rot_list_of_darts_perm;; +let rot_hypermap_of_list_eq = Sections.finalize_theorem rot_hypermap_of_list_eq;; +let hypermap_of_split_list_eq3 = Sections.finalize_theorem hypermap_of_split_list_eq3;; +let f_split_list = Sections.finalize_theorem f_split_list;; +Sections.end_section "SplitListHyp";; + +(* Section FanAndList *) +Sections.begin_section "FanAndList";; + +(* Lemma set_of_edge_subset *) +let set_of_edge_subset = Sections.section_proof ["V";"E";"E'";"x"] +`E SUBSET E' ==> set_of_edge x V E SUBSET set_of_edge x V E'` +[ + ((((repeat_tactic 1 9 (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_of_edge", [set_of_edge]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))))) THEN (move ["subE"]) THEN (move ["y"]) THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("subE", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fan_list_iso_invariant *) +let fan_list_iso_invariant = Sections.section_proof ["F1";"F2";"f"] +`fan_list_iso (fan_list_iso (f, F1), F2) = fan_list_iso (f, F1)` +[ + ((((use_arg_then2 ("F2", [])) (disch_tac [])) THEN (clear_assumption "F2") THEN ((use_arg_then2 ("F1", [])) (disch_tac [])) THEN (clear_assumption "F1") THEN BETA_TAC THEN (case THEN ((move ["V"]) THEN (move ["E"]))) THEN (case THEN ((move ["V'"]) THEN (move ["E'"])))) THEN ((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["v"]) THEN (move ["w"]))))); + ((repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("fan_list_iso", [fan_list_iso]))(fun tmp_arg1 -> (use_arg_then2 ("fan_list_nodes_iso", [fan_list_nodes_iso]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_var (mk_var ("L", (`:((A)list)list`))));; +(Sections.add_section_var (mk_var ("f", (`:real^3#real^3 -> A#A`))));; +(Sections.add_section_hyp "fanV" (`FAN (vec 0,V,E)`));; +(Sections.add_section_hyp "goodL" (`good_list L`));; +(Sections.add_section_hyp "f_iso" (`hyp_iso f (hypermap_of_fan (V,E), hypermap_of_list L)`));; + +(* Lemma hyp_iso_eq_fan_list_iso *) +let hyp_iso_eq_fan_list_iso = Sections.section_proof ["y"] +`y IN dart_of_fan (V,E) ==> f y = fan_list_iso (f, (V,E)) y` +[ + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (move ["mapsH"]))))); + ((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartG"]) THEN (move ["mapsG"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan (V,E)`))) (term_tac (set_tac "H"))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_list L`))) (term_tac (set_tac "G"))); + ((fun arg_tac -> arg_tac (Arg_term (`d IN dart_of_fan (V,E) ==> f d IN darts_of_list L`))) (term_tac (have_gen_tac ["d"](move ["f_in"])))); + ((((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartG", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["d_in"])) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((use_arg_then2 ("y", [])) (disch_tac [])) THEN (clear_assumption "y") THEN case THEN ((move ["a"]) THEN (move ["b"])) THEN (move ["ab_in"])); + (((use_arg_then2 ("fan_list_iso", [fan_list_iso]))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> arg_tac (Arg_term (`fan_list_nodes_iso _`))) (term_tac (set_tac "h"))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`?g. !v w. (v,w) IN dart_of_fan (V,E) ==> f(v,w) = (h v:A, g (v,w):A)`))) (term_tac (have_gen_tac [](case THEN ((move ["g"]) THEN (move ["f_eq"]))))))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("IN_DART_OF_FAN", [IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ab_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["v"])) THEN (case THEN (move ["w"])) THEN (case THEN (move ["vw_eq"])) THEN (move ["vw_in"])); + ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_comm", [hyp_iso_comm])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`a,b`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ab_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((((use_arg_then2 ("mapsG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mapsH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_fan_pair_ext_explicit", [e_fan_pair_ext_explicit]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("e_list_ext", [e_list_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("dartG", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))); + ((((repeat_tactic 1 9 (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 1 (((use_arg_then2 ("dart_switch", [dart_switch]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("e_list", [e_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SND", [SND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`\d. SND (f d)`))) (term_tac exists_tac)); + ((BETA_TAC THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"])) THEN ((((fun arg_tac -> (use_arg_then2 ("pair_expand", [pair_expand])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fan_list_nodes_iso", [fan_list_nodes_iso]))(thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> arg_tac (Arg_term (`set_of_edge v V E = {}`))) (disch_eq_tac "set_empty" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN (clear_assumption "vw_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("dart_of_fan_eq", [dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) case (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN", [PAIR_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then2 ("set_empty", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((BETA_TAC THEN (case THEN (move ["u"])) THEN (case THEN (move ["_"])) THEN (case THEN ((move ["eq1"]) THEN (move ["eq2"])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["vw_in1"])))); + ((((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dart_of_fan_eq", [dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))))); + (case THEN ((TRY done_tac)) THEN (case THEN (move ["u"])) THEN (case THEN (move ["empty"])) THEN (move ["eq"])); + ((((use_arg_then2 ("empty", [])) (disch_tac [])) THEN (clear_assumption "empty") THEN BETA_TAC) THEN ((((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_empty", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`CHOICE _`))) (term_tac (set_tac "w'"))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`f (v,w') IN node G (f (v,w))`))) (term_tac (have_gen_tac []ALL_TAC)))); + ((((use_arg_then2 ("Hypermap.node", [Hypermap.node]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Hypermap.orbit_map", [Hypermap.orbit_map]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("mapsG", []))(thm_tac (new_rewrite [] []))))); + (BETA_TAC THEN (case THEN (move ["n"])) THEN (case THEN (move ["_"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("pair_expand", [pair_expand]))(thm_tac (new_rewrite [2] [])))) THEN (((use_arg_then2 ("fst_n_list_ext_power", [fst_n_list_ext_power]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartG", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("iso_components", [iso_components])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("FUN_IN_IMAGE", [FUN_IN_IMAGE]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("NODE_HYPERMAP_OF_FAN_ALT", [NODE_HYPERMAP_OF_FAN_ALT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((use_arg_then2 ("w'", [])) (term_tac exists_tac)) THEN ((split_tac) THEN ((TRY done_tac))) THEN (((((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("CHOICE_DEF", [CHOICE_DEF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ssrbool.implybF", [Ssrbool.implybF]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["eq"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN", [PAIR_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fan_list_nodes_iso_surj *) +let fan_list_nodes_iso_surj = Sections.section_proof [] +`SURJ (fan_list_nodes_iso (f,(V,E))) V (elements_of_list L)` +[ + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["hypV"]))); + ((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["hypL"]))); + ((use_arg_then2 ("hyp_iso_eq_fan_list_iso", [hyp_iso_eq_fan_list_iso])) (fun arg -> thm_tac MP_TAC arg THEN (move ["iso_eq"]))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan (V,E)`))) (term_tac (set_tac "H"))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_list L`))) (term_tac (set_tac "G"))); + ((((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("elements_of_list", [elements_of_list]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mem_list_of_elements", [mem_list_of_elements]))(thm_tac (new_rewrite [] [])))))); + ((THENL) (split_tac) [(move ["v"]); ((move ["a"]) THEN (case THEN (move ["b"])))]); + ((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("DART_EXISTS", [DART_EXISTS])) (fun fst_arg -> (use_arg_then2 ("E", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["w"])) THEN (move ["vw_in"])); + ((fun arg_tac -> arg_tac (Arg_term (`fan_list_nodes_iso (f,V,E) w`))) (term_tac exists_tac)); + ((((use_arg_then2 ("fan_list_iso", [fan_list_iso]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hypL", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("iso_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hypV", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hypL", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["ab_in"])); + ((fun arg_tac -> arg_tac (Arg_term (`res_inv f (dart H) (a,b)`))) (term_tac (set_tac "d"))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_inv", [hyp_iso_inv])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ab_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("d_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hypV", []))(thm_tac (new_rewrite [] []))))) THEN (move ["d_in"])); + (((fun arg_tac -> arg_tac (Arg_term (`FST d`))) (term_tac exists_tac)) THEN (split_tac)); + (((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`FST d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SND d`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`f d = a,b`))) (term_tac (have_gen_tac []ALL_TAC)))); + ((((((use_arg_then2 ("iso_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("pair_expand", [pair_expand])) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("fan_list_iso", [fan_list_iso]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("d_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("surj_res_inv_right", [surj_res_inv_right])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_SURJ", [hyp_iso_SURJ])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fan_list_nodes_to *) +let fan_list_nodes_to = Sections.section_proof ["v"] +`v IN V ==> fan_list_nodes_iso (f,(V,E)) v IN elements_of_list L` +[ + ((((use_arg_then2 ("fan_list_nodes_iso_surj", [fan_list_nodes_iso_surj])) (disch_tac [])) THEN (clear_assumption "fan_list_nodes_iso_surj") THEN BETA_TAC) THEN ((((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] [])))) THEN (move ["surj"]) THEN (move ["vV"])) THEN (((use_arg_then2 ("surj", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma fan_list_diag_eq *) +let fan_list_diag_eq = Sections.section_proof ["v";"w"] +`(v,w) IN dart1_of_fan (V,E) + ==> fan_list_iso (f,(V,E)) (w, sigma_fan (vec 0) V E v w) = list_hyp_diag L (f (v,w))` +[ + ((((use_arg_then2 ("list_hyp_diag", [list_hyp_diag]))(thm_tac (new_rewrite [] [])))) THEN (move ["vw_in1"])); + ((((use_arg_then2 ("goodL", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["uniqL"])) THEN (move ["_"]))); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["vw_in"])))); + (((((use_arg_then2 ("dart_of_fan_eq", [dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["fan_hyp"]))); + ((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["list_hyp"]))); + ((use_arg_then2 ("hyp_iso_eq_fan_list_iso", [hyp_iso_eq_fan_list_iso])) (fun arg -> thm_tac MP_TAC arg THEN (move ["f_eq"]))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan (V,E)`))) (term_tac (set_tac "H"))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_list L`))) (term_tac (set_tac "G"))); + ((fun arg_tac -> arg_tac (Arg_term (`FST _`))) (term_tac (set_tac "y"))); + ((fun arg_tac -> arg_tac (Arg_term (`y = FST (inverse (face_map G) (f (v,w)))`))) (term_tac (have_gen_tac [](move ["y_eq"])))); + (((((use_arg_then2 ("list_hyp", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_list_ext_inverse", [f_list_ext_inverse]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_hyp", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("fan_hyp", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("fan_list_iso", [fan_list_iso]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SND", [SND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("hyp_iso_inverse_comm", [hyp_iso_inverse_comm])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fan_hyp", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("Hypermap_and_fan.INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [Hypermap_and_fan.INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + (((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("fan_list_iso", [fan_list_iso]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart_switch", [dart_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_dart1_in_dart", [in_dart1_in_dart]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(Sections.add_section_hyp "good_nodes" (`good_list_nodes L`));; + +(* Lemma fan_list_nodes_iso_BIJ *) +let fan_list_nodes_iso_BIJ = Sections.section_proof [] +`BIJ (fan_list_nodes_iso (f,(V,E))) V (elements_of_list L)` +[ + ((((use_arg_then2 ("finite_surj_eq_bij", [finite_surj_eq_bij]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("fan_list_nodes_iso_surj", [fan_list_nodes_iso_surj]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("fan_imp_finite_set", [fan_imp_finite_set])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("elements_of_list", [elements_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_SET_OF_LIST", [FINITE_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("card_set_of_list_uniq", [card_set_of_list_uniq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uniq_list_of_elements", [uniq_list_of_elements]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("iffLR", [iffLR])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("good_list_nodes_condition", [good_list_nodes_condition])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("number_of_nodes", [number_of_nodes]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("iso_number_of_nodes", [iso_number_of_nodes])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("number_of_nodes", [number_of_nodes]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (use_arg_then2 ("NODE_SET_AS_IMAGE", [NODE_SET_AS_IMAGE])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["f"]) THEN (case THEN (move ["inj"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + (((use_arg_then2 ("CARD_IMAGE_INJ", [CARD_IMAGE_INJ])) (thm_tac apply_tac)) THEN (((((fun arg_tac -> (use_arg_then2 ("fan_imp_finite_set", [fan_imp_finite_set])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("inj", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Lemma fan_list_nodes_iso_inj *) +let fan_list_nodes_iso_inj = Sections.section_proof ["x";"y"] +`x IN V /\ y IN V + /\ fan_list_nodes_iso (f,(V,E)) x = fan_list_nodes_iso (f,(V,E)) y + ==> x = y` +[ + (BETA_TAC THEN (case THEN (move ["x_in"])) THEN (case THEN (move ["y_in"])) THEN (move ["eq"])); + ((((use_arg_then2 ("fan_list_nodes_iso_BIJ", [fan_list_nodes_iso_BIJ])) (disch_tac [])) THEN (clear_assumption "fan_list_nodes_iso_BIJ") THEN BETA_TAC) THEN (((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["_"])) THEN (move ["inj"]) THEN (move ["_"]))); + (((use_arg_then2 ("inj", [])) (disch_tac [])) THEN (clear_assumption "inj") THEN (exact_tac)); +];; +(Sections.add_section_hyp "f_surr" (`fully_surrounded (V,E)`));; + +(* Lemma iso_imp_good_conditions *) +let iso_imp_good_conditions = Sections.section_proof ["d"] +`MEM d (list_of_darts L) /\ 3 < sizel (find_face L d) + ==> ~MEM (list_hyp_diag L d) (list_of_darts L) /\ + ~(FST (list_hyp_diag L d) = SND (list_hyp_diag L d))` +[ + (BETA_TAC THEN (case THEN ((move ["mem_d"]) THEN (move ["f_size"])))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["hypV"]))); + ((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["hypL"]))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan (V,E)`))) (term_tac (set_tac "H"))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_list L`))) (term_tac (set_tac "G"))); + ((((use_arg_then2 ("mem_d", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hypL", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["d_in"]))); + ((fun arg_tac -> arg_tac (Arg_term (`?x. f x = d /\ x IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](case THEN ((case THEN ((move ["v"]) THEN (move ["w"]))) THEN (case THEN ((move ["d_eq"]) THEN (move ["vw_in"])))))))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_surj", [hyp_iso_surj])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["x"]) THEN (case THEN ((move ["x_in"]) THEN (move ["f_eq"]))))))); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("hypV", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart1_of_fan (V,E) /\ v,w IN dart H`))) (term_tac (have_gen_tac [](move ["vw_in1"])))); + (((((use_arg_then2 ("hypV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`3 < CARD (face H (v,w))`))) (term_tac (have_gen_tac [](move ["card_f"])))); + (((((fun arg_tac -> (use_arg_then2 ("hyp_iso_card_components", [hyp_iso_card_components])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("G_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_face_of_list", [card_face_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_ROT (-1)) (((((use_arg_then2 ("d_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fan_list_diag_eq", [fan_list_diag_eq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (split_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("fan_list_iso", [fan_list_iso]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("implybF", [implybF]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("fan_list_nodes_iso_inj", [fan_list_nodes_iso_inj])) (thm_tac (match_mp_then snd_th MP_TAC))))); + ((((use_arg_then2 ("sigma_fan_inV", [sigma_fan_inV]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); + ((((use_arg_then2 ("sigma_fan_not_fixed", [sigma_fan_not_fixed]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hypL", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_diag_not_in_dart", [fully_surrounded_diag_not_in_dart])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (move ["ww'_in"]))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_surj", [hyp_iso_surj])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ww'_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN (case THEN ((move ["a"]) THEN (move ["b"])))))); + ((((use_arg_then2 ("hypV", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["ab_in"]))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`a IN V /\ b IN V`))) (term_tac (have_gen_tac [](move ["ab_inV"])))) ((repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`w IN V /\ w' IN V`))) (term_tac (have_gen_tac [](move ["ww'_inV"])))); + (((((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("sigma_fan_inV", [sigma_fan_inV]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("hyp_iso_eq_fan_list_iso", [hyp_iso_eq_fan_list_iso]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("fan_list_iso", [fan_list_iso]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))); + (BETA_TAC THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("fan_list_nodes_iso_inj", [fan_list_nodes_iso_inj])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (move ["eq1"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("fan_list_nodes_iso_inj", [fan_list_nodes_iso_inj])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["eq2"])); + (((((use_arg_then2 ("eq1", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eq2", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma iso_imp_good_list_split *) +let iso_imp_good_list_split = Sections.section_proof ["d"] +`good_list (split_list_hyp L d)` +[ + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`MEM d (list_of_darts L)`))) (disch_eq_tac "mem_d" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("d_not_in_dart_split_eq", [d_not_in_dart_split_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((fun arg_tac -> (use_arg_then2 ("good_list_split", [good_list_split])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`sizel (find_pair_list L d) <= 3`))) (disch_eq_tac "f_size" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((use_arg_then2 ("iso_imp_good_conditions", [iso_imp_good_conditions])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("find_face_alt", [find_face_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_list_pairs", [size_list_pairs]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_d", []))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("f_size", [])) (disch_tac [])) THEN (clear_assumption "f_size") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma split_list_hyp_iso *) +let split_list_hyp_iso = Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) ==> + hyp_iso (fan_list_iso (f,(V,E))) + (hypermap_of_fan (split_fan_face (V,E) d), hypermap_of_list (split_list_hyp L (f d)))` +[ + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN BETA_TAC THEN (case THEN ((move ["v"]) THEN (move ["w"]))) THEN (move ["vw_in"])); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["hypV"]))); + ((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["hypL"]))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan (V,E)`))) (term_tac (set_tac "H"))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_list L`))) (term_tac (set_tac "G"))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["d1_eq"]))); + ((fun arg_tac -> arg_tac (Arg_term (`MEM (f (v,w)) (list_of_darts L)`))) (term_tac (have_gen_tac [](move ["mem_fd"])))); + (((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hypL", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hypV", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`CARD (face H (v,w)) = sizel (find_face L (f (v,w)))`))) (term_tac (have_gen_tac [](move ["card_f"])))); + (((((fun arg_tac -> (use_arg_then2 ("hyp_iso_card_components", [hyp_iso_card_components])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("hypV", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("card_face_of_list", [card_face_of_list]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("goodL", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("good_list", [good_list]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["uniqL"])) THEN (move ["_"]))); + (((fun arg_tac -> arg_tac (Arg_term (`sizel (find_face L (f (v,w))) <= 3`))) (disch_eq_tac "f_size" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((fun arg_tac -> (use_arg_then2 ("hypermap_of_split_list_eq3", [hypermap_of_split_list_eq3])) (fun fst_arg -> (use_arg_then2 ("f_size", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("G_def", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("split_fan_face_eq", [split_fan_face_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("fanV", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FULLY_SURROUNDED_IMP_CARD_FACE_GE_3", [FULLY_SURROUNDED_IMP_CARD_FACE_GE_3])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("f_size", [])) (disch_tac [])) THEN (clear_assumption "f_size") THEN BETA_TAC) THEN ((((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); + (((((fun arg_tac -> (use_arg_then2 ("hyp_iso_ext", [hyp_iso_ext])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hypV", []))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["x_in"])); + ((((use_arg_then2 ("hyp_iso_eq_fan_list_iso", [hyp_iso_eq_fan_list_iso]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`3 < CARD (face (hypermap_of_fan (V,E)) (v,w))`))) (term_tac (have_gen_tac [](move ["card_f3"])))); + ((((use_arg_then2 ("f_size", [])) (disch_tac [])) THEN (clear_assumption "f_size") THEN BETA_TAC) THEN ((((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["fan_split"]) THEN (case THEN (move ["dart_splitV_eq"])) THEN (move ["f_split_surr"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`split_fan_face (V,E) (v,w)`))) (term_tac (set_tac "F1"))); + (in_tac ["f_split_surr"; "fan_split"] false (((fun arg_tac -> (use_arg_then2 ("pair_expand", [pair_expand])) (fun fst_arg -> (use_arg_then2 ("F1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq])) (fun fst_arg -> (use_arg_then2 ("fan_split", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_split_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (simp_tac))) THEN (move ["split1_eq"])); + ((fun arg_tac -> (use_arg_then2 ("iso_imp_good_list_split", [iso_imp_good_list_split])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["good_split"]))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["vw_in1"])))) ((((use_arg_then2 ("d1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> (use_arg_then2 ("fan_list_diag_eq", [fan_list_diag_eq])) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["diag_eq"]))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`fan_list_iso _`))) (term_tac (set_tac "R"))); + ((fun arg_tac -> arg_tac (Arg_term (`dart (hypermap_of_list (split_list_hyp L (f (v,w)))) + = darts_of_list L UNION {R (w',w), R (w, w')}`))) (term_tac (have_gen_tac [](move ["dart_splitL_eq"])))); + ((((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("good_split", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`3 < sizel (find_pair_list L (f (v,w)))`))) (term_tac (have_gen_tac [](move ["gt3"])))); + ((((use_arg_then2 ("f_size", [])) (disch_tac [])) THEN (clear_assumption "f_size") THEN BETA_TAC) THEN ((((use_arg_then2 ("find_face_alt", [find_face_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_list_pairs", [size_list_pairs]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + (((fun arg_tac -> (use_arg_then2 ("perm_eq_set_of_list_eq", [perm_eq_set_of_list_eq])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("darts_of_list_split", [darts_of_list_split])) (fun fst_arg -> (use_arg_then2 ("gt3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))); + ((((use_arg_then2 ("APPEND_cat", [APPEND_cat]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SET_OF_LIST_APPEND", [SET_OF_LIST_APPEND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("UNION_COMM", [UNION_COMM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] []))))); + ((congr_tac (`_1 UNION _2`)) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL set_of_list)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("diag_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then2 ("fan_list_iso", [fan_list_iso]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_list", [e_list]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("fan_list_iso", [fan_list_iso]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("R_def", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Collect_geom.PER_SET2)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan_split", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (simp_tac))); + ((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("good_split", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H1"))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_list _`))) (term_tac (set_tac "G1"))); + (BETA_TAC THEN (move ["hypL1"]) THEN (move ["hypV1"])); + ((fun arg_tac -> arg_tac (Arg_term (`dart G1 = IMAGE R (dart H1)`))) (term_tac (have_gen_tac [](move ["dartG1_eq"])))); + ((((use_arg_then2 ("dart_splitL_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hypV1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart_splitV_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hypL", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hypV", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("IMAGE_UNION", [IMAGE_UNION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IMAGE_CLAUSES)))(thm_tac (new_rewrite [] [])))))) THEN ((congr_tac (`_1 UNION _2`)) THEN ((TRY done_tac)))); + (((((fun arg_tac -> (use_arg_then2 ("iso_dart", [iso_dart])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hypV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("image_ext_eq", [image_ext_eq])) (thm_tac apply_tac)) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("hyp_iso_eq_fan_list_iso", [hyp_iso_eq_fan_list_iso])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("hyp_iso_edge_face", [hyp_iso_edge_face]))(thm_tac (new_rewrite [] [])))) THEN (split_tac)); + ((((use_arg_then2 ("dartG1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Misc_defs_and_lemmas.IMAGE_SURJ", [Misc_defs_and_lemmas.IMAGE_SURJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (split_tac) ((BETA_TAC THEN (move ["x"]) THEN (move ["x_in"])) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac))); + (BETA_TAC THEN (case THEN ((move ["v1"]) THEN (move ["w1"]))) THEN (case THEN ((move ["v2"]) THEN (move ["w2"]))) THEN (case THEN (move ["vw1_in"])) THEN (case THEN (move ["vw2_in"])) THEN (move ["eq"])); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`v1 IN V /\ v2 IN V /\ w1 IN V /\ w2 IN V`))) (term_tac (have_gen_tac [](move ["inV"]))))); + ((((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN ((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("fan_list_iso", [fan_list_iso]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("fan_list_nodes_iso_inj", [fan_list_nodes_iso_inj])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("fan_list_nodes_iso_inj", [fan_list_nodes_iso_inj])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("vw2_in", [])) (disch_tac [])) THEN (clear_assumption "vw2_in") THEN ((use_arg_then2 ("vw1_in", [])) (disch_tac [])) THEN (clear_assumption "vw1_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("hypV1", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("pair_expand", [pair_expand])) (fun fst_arg -> (use_arg_then2 ("F1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))); + (BETA_TAC THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan_split", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["vw1_in"]) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan_split", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC))))); + ((((use_arg_then2 ("vw1_in", [])) (disch_tac [])) THEN (clear_assumption "vw1_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("F1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); + (case THEN (move ["a"]) THEN (move ["b"]) THEN (move ["ab_in"])); + ((fun arg_tac -> arg_tac (Arg_term (`R (a,b) IN dart G1`))) (term_tac (have_gen_tac [](move ["Rab_in"])))); + (((((use_arg_then2 ("dartG1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`a,b`))) (term_tac exists_tac)) THEN (done_tac)); + (split_tac); + ((((use_arg_then2 ("hypV1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hypL1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_list_ext", [e_list_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hypL1", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Rab_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("e_list", [e_list]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("fan_list_iso", [fan_list_iso]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("fan_list_iso", [fan_list_iso]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((fun arg_tac -> (use_arg_then2 ("pair_expand", [pair_expand])) (fun fst_arg -> (use_arg_then2 ("F1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_fan_pair_ext_explicit", [e_fan_pair_ext_explicit]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("pair_expand", [pair_expand]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hypV1", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_split_fan_face))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("F1_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E w' v`))) (term_tac (set_tac "u"))); + (BETA_TAC THEN (move ["f_fan_eq"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_split_list))) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)); + (((((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_size", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("iso_imp_good_conditions", [iso_imp_good_conditions])) (thm_tac apply_tac))); + ((((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`split_list_hyp L _`))) (term_tac (set_tac "L2"))); + ((((use_arg_then2 ("diag_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (BETA_TAC THEN (move ["f_list_eq"]))); + ((((use_arg_then2 ("hypV1", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("pair_expand", [pair_expand])) (fun fst_arg -> (use_arg_then2 ("F1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("split1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hypV1", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ab_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("hypL1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_list_ext", [f_list_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hypL1", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Rab_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`x IN dart_of_fan (V,E) ==> R x = f x`))) (term_tac (have_gen_tac ["x"](move ["R_eq_f"])))); + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("hyp_iso_eq_fan_list_iso", [hyp_iso_eq_fan_list_iso])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then2 ("R_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`a,b = v,w`))) (disch_eq_tac "eq1" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) (((((use_arg_then2 ("eq1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("R_eq_f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`w',v = inverse (face_map H) (v,w)`))) (term_tac (have_gen_tac [](move ["w'v_eq"])))); + (((((use_arg_then2 ("hypV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`w',v IN dart H`))) (term_tac (have_gen_tac [](move ["w'v_in"])))); + (((((use_arg_then2 ("w'v_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lemma_dart_inveriant_under_inverse_maps", [lemma_dart_inveriant_under_inverse_maps]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`u,w' = inverse (face_map H) (w',v)`))) (term_tac (have_gen_tac [](move ["uw'_eq"])))); + ((((use_arg_then2 ("hypV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INVERSE_F_FAN_PAIR_EXT_EXPLICIT", [INVERSE_F_FAN_PAIR_EXT_EXPLICIT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("d1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hypV", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w'v_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("u_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`a,b = w,w'`))) (disch_eq_tac "eq2" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((use_arg_then2 ("eq2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_list_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'v_eq", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("R_eq_f", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("hypV", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_dart_inveriant_under_inverse_maps", [lemma_dart_inveriant_under_inverse_maps]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("hyp_iso_inverse_comm", [hyp_iso_inverse_comm])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("hypL", []))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("f_list_ext_inverse", [f_list_ext_inverse]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`R (w',w) = e_list (R (w,w'))`))) (term_tac (have_gen_tac [](move ["Rw'w_eq"])))); + (((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("fan_list_iso", [fan_list_iso]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("e_list", [e_list]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`a,b = w',w`))) (disch_eq_tac "eq3" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((use_arg_then2 ("eq3", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Rw'w_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_list_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`f_fan_pair (V,E) (v,w) = face_map H (v,w)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("hypV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("R_eq_f", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("hypV", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("hyp_iso_comm", [hyp_iso_comm])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("hypL", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_list_ext", [f_list_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`find_face L (f (v,w))`))) (term_tac (set_tac "ff"))); + ((fun arg_tac -> arg_tac (Arg_term (`R (u,w') = prev_el ff (prev_el ff (f (v,w)))`))) (term_tac (have_gen_tac [](move ["Ruw'_eq"])))); + ((((use_arg_then2 ("uw'_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("R_eq_f", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("hypV", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_dart_inveriant_under_inverse_maps", [lemma_dart_inveriant_under_inverse_maps]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("hyp_iso_inverse_comm", [hyp_iso_inverse_comm])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("w'v_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_inverse_comm", [hyp_iso_inverse_comm])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("hypL", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("f_list_ext_inverse", [f_list_ext_inverse]))(thm_tac (new_rewrite [2] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_fd", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("ff_def", []))(thm_tac (new_rewrite [] []))))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`prev_el ff (f (v,w)) IN darts_of_list L`))) (term_tac (have_gen_tac [](move ["mem_ff"]))))); + ((((use_arg_then2 ("f_list_ext_inverse", [f_list_ext_inverse]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_ff", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`find_face L (prev_el ff (f (v,w))) = ff`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((ALL_TAC) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("find_face_eq", [find_face_eq])) (fun fst_arg -> (use_arg_then2 ("uniqL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("darts_of_list", [darts_of_list]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_prev_el", [mem_prev_el]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ff_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("mem_find_face", [mem_find_face]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((use_arg_then2 ("darts_of_list", [darts_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("mem_find_face_imp_mem_darts", [mem_find_face_imp_mem_darts])) (thm_tac apply_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`f (v,w)`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("ff_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_prev_el", [mem_prev_el]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ff_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart_in_face", [dart_in_face]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`a,b = u,w'`))) (disch_eq_tac "eq4" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((((use_arg_then2 ("eq4", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ruw'_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_list_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Rw'w_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) (((use_arg_then2 ("f_fan_eq", []))(thm_tac (new_rewrite [] [])))) (((((use_arg_then2 ("hypV1", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ab_in", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`a,b IN dart H`))) (term_tac (have_gen_tac [](move ["ab_in0"])))); + ((((use_arg_then2 ("ab_in", [])) (disch_tac [])) THEN (clear_assumption "ab_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("hypV1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart_splitV_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hypV", []))(gsym_then (thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq3", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_ROT (-1)) (((use_arg_then2 ("f_list_eq", []))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`f_fan_pair (V,E) (a,b) = face_map H (a,b)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("hypV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hypV", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ab_in0", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("R_eq_f", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("hypV", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("hyp_iso_comm", [hyp_iso_comm])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("hypL", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_list_ext", [f_list_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hypL", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("R_eq_f", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("hypV", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hypL1", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Rab_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("Ruw'_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Rw'w_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("R_eq_f", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`a IN V /\ b IN V /\ u IN V /\ v IN V /\ w' IN V /\ w IN V`))) (term_tac (have_gen_tac [](move ["in_all"])))); + ((((use_arg_then2 ("ab_in0", [])) (disch_tac [])) THEN (clear_assumption "ab_in0") THEN BETA_TAC) THEN ((((use_arg_then2 ("hypV", []))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (simp_tac))); + ((((use_arg_then2 ("w'v_in", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("hypV", []))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (simp_tac))); + (((fun arg_tac -> (use_arg_then2 ("lemma_dart_inveriant_under_inverse_maps", [lemma_dart_inveriant_under_inverse_maps])) (fun fst_arg -> (use_arg_then2 ("w'v_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((((use_arg_then2 ("uw'_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hypV", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((fun arg_tac ->(use_arg_then2 ("eq1", []))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("eq2", []))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("eq3", []))(fun tmp_arg1 -> (use_arg_then2 ("eq4", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2)))))) (disch_tac [])) THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("fan_list_iso", [fan_list_iso]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 (case)) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("fan_list_nodes_iso_inj", [fan_list_nodes_iso_inj])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["h1"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("fan_list_nodes_iso_inj", [fan_list_nodes_iso_inj])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["h2"])) THEN ((((use_arg_then2 ("h1", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("h2", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma iso_imp_good_list_nodes_split *) +let iso_imp_good_list_nodes_split = Sections.section_proof ["d"] +`good_list_nodes (split_list_hyp L d)` +[ + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`MEM d (list_of_darts L)`))) (disch_eq_tac "mem_d" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("d_not_in_dart_split_eq", [d_not_in_dart_split_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("mem_d", [])) (disch_tac [])) THEN (clear_assumption "mem_d") THEN BETA_TAC) THEN (((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("darts_of_list", [darts_of_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("components_hypermap_of_list", [components_hypermap_of_list])) (fun fst_arg -> (use_arg_then2 ("goodL", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["d_in"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_surj", [hyp_iso_surj])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((case THEN ((move ["v"]) THEN (move ["w"]))) THEN (case THEN ((move ["vw_in"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))))))))); + (in_tac ["vw_in"] false (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (use_arg_then2 ("split_list_hyp_iso", [split_list_hyp_iso])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["iso_th"]))); + ((((use_arg_then2 ("good_list_nodes_condition", [good_list_nodes_condition]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("iso_imp_good_list_split", [iso_imp_good_list_split]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("number_of_nodes", [number_of_nodes]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("iso_number_of_nodes", [iso_number_of_nodes])) (fun fst_arg -> (use_arg_then2 ("iso_th", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> (use_arg_then2 ("perm_eq_size", [perm_eq_size])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("list_of_elements_split", [list_of_elements_split])) (fun fst_arg -> (use_arg_then2 ("L", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["fan_split"]) THEN (move ["_"]))))); + (in_tac ["fan_split"] true (((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("fan_number_of_nodes", [fan_number_of_nodes]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("fan_number_of_nodes", [fan_number_of_nodes])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((fun arg_tac -> (use_arg_then2 ("iso_number_of_nodes", [iso_number_of_nodes])) (fun fst_arg -> (use_arg_then2 ("f_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("number_of_nodes", [number_of_nodes]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("good_list_nodes_condition", [good_list_nodes_condition]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section FanAndList *) +let set_of_edge_subset = Sections.finalize_theorem set_of_edge_subset;; +let fan_list_iso_invariant = Sections.finalize_theorem fan_list_iso_invariant;; +let hyp_iso_eq_fan_list_iso = Sections.finalize_theorem hyp_iso_eq_fan_list_iso;; +let fan_list_nodes_iso_surj = Sections.finalize_theorem fan_list_nodes_iso_surj;; +let fan_list_nodes_to = Sections.finalize_theorem fan_list_nodes_to;; +let fan_list_diag_eq = Sections.finalize_theorem fan_list_diag_eq;; +let fan_list_nodes_iso_BIJ = Sections.finalize_theorem fan_list_nodes_iso_BIJ;; +let fan_list_nodes_iso_inj = Sections.finalize_theorem fan_list_nodes_iso_inj;; +let iso_imp_good_conditions = Sections.finalize_theorem iso_imp_good_conditions;; +let iso_imp_good_list_split = Sections.finalize_theorem iso_imp_good_list_split;; +let split_list_hyp_iso = Sections.finalize_theorem split_list_hyp_iso;; +let iso_imp_good_list_nodes_split = Sections.finalize_theorem iso_imp_good_list_nodes_split;; +Sections.end_section "FanAndList";; + +(* Close the module *) +end;; diff --git a/formal_lp/hypermap/tests/test_all_lists.hl b/formal_lp/hypermap/tests/test_all_lists.hl new file mode 100644 index 0000000..74bf229 --- /dev/null +++ b/formal_lp/hypermap/tests/test_all_lists.hl @@ -0,0 +1,147 @@ +needs "../formal_lp/hypermap/tests/Tri2.ml";; +needs "../formal_lp/hypermap/tests/Quad2.ml";; +needs "../formal_lp/hypermap/tests/Pent2.ml";; +needs "../formal_lp/hypermap/tests/Hex2.ml";; + +(* 18762 *) +length pent + length hex + length tri + length quad;; + + + +open List;; + +(* undup *) +let rec undup s = + match s with + [] -> [] + | h :: t -> if mem h t then undup t else h :: undup t;; + + +(* uniq *) +let rec uniq_test s = + match s with + [] -> true + | h :: t -> if mem h t then false else uniq_test t;; + + +(* list_of_elements *) +let list_of_elements hyp = undup (flatten hyp);; + + +(* list_pairs *) +let list_pairs s = + let head = hd s in + let rec list_pairs_head s = + match s with + [] -> failwith "list_pairs" + | [h] -> [h,head] + | h1 :: h2 :: t -> (h1,h2) :: list_pairs_head (h2 :: t) in + list_pairs_head s;; + + +(* list_of_faces *) +let list_of_faces hyp = + map list_pairs hyp;; + + +(* list_of_darts *) +let list_of_darts hyp = flatten (list_of_faces hyp);; + + +(* find_pair_list *) +let rec find_pair_list hyp d = + match hyp with + [] -> [] + | f :: t -> if mem d (list_pairs f) then f else find_pair_list t d;; + + +(* find_face *) +let find_face hyp d = list_pairs (find_pair_list hyp d);; + + +(* next_el *) +let next_el s d = + let head = hd s in + let rec next s = + match s with + [] -> failwith "next_el" + | [h] -> if Pervasives.compare h d = 0 then head else next [] + | h1 :: h2 :: t -> if Pervasives.compare h1 d = 0 then h2 else next (h2 :: t) in + next s;; + + +(* prev_el *) +let prev_el s d = + let rec prev_rec prev s = + match s with + [] -> failwith "prev_el" + | h :: t -> if Pervasives.compare h d = 0 then prev else prev_rec h t in + prev_rec (last s) s;; + + +(* e_list *) +let e_list (d1,d2) = d2,d1;; + + +(* f_list *) +let f_list hyp d = next_el (find_face hyp d) d;; + + +(* n_list *) +let n_list hyp d = e_list (prev_el (find_face hyp d) d);; + + +(* orbit *) +let orbit f d = + let rec orbit_acc acc x = + let next = f x in + if mem next acc then acc else orbit_acc (next :: acc) next in + rev (orbit_acc [d] d);; + + +(* orbits *) +let orbits f set = + let rec orbits_rec set = + match set with + [] -> [] + | h :: t -> + let x = orbit f h in + x :: orbits_rec (subtract set x) in + orbits_rec set;; + + +(* good_list *) +let good_list hyp = + let darts = list_of_darts hyp in + let c1 = uniq_test darts in + let c2 = for_all (fun l -> l <> []) hyp in + let c3 = for_all (fun (d1,d2) -> mem (d2,d1) darts) darts in + c1 & c2 & c3;; + + +(* good_list_nodes *) +let good_list_nodes hyp = + let darts = list_of_darts hyp in + let n0 = length (list_of_elements hyp) in + let n1 = length (orbits (n_list hyp) darts) in + n0 = n1;; + + + +let tm = hd hex;; +good_list tm;; +good_list_nodes tm;; + +let good_test = fold_left (fun l h -> l & good_list h) true;; +let good_nodes_test = fold_left (fun l h -> l & good_list_nodes h) true;; + +let tri_test = good_test tri;; +let quad_test = good_test quad;; +let pent_test = good_test pent;; +let hex_test = good_test hex;; + + +let tri_test2 = good_nodes_test tri;; +let quad_test2 = good_nodes_test quad;; +let pent_test2 = good_nodes_test pent;; +let hex_test2 = good_nodes_test hex;; diff --git a/formal_lp/hypermap/verify_all.hl b/formal_lp/hypermap/verify_all.hl new file mode 100644 index 0000000..77ccefa --- /dev/null +++ b/formal_lp/hypermap/verify_all.hl @@ -0,0 +1,99 @@ +needs "../formal_lp/hypermap/main/prove_flyspeck_lp.hl";; + +module Verify_all = struct + +open List;; +open Flyspeck_lp;; +open Lp_certificate;; + +let cert_dir = ref (flyspeck_dir ^ "/../formal_lp/glpk/binary");; + +let get_files_with_prefix dir prefix = + let files = Array.to_list (Sys.readdir dir) in + let n = String.length prefix in + let files1 = filter (fun f -> String.length f >= n) files in + let files2 = filter (fun f -> String.sub f 0 n = prefix) files1 in + map (fun f -> sprintf "%s/%s" dir f) files2;; + +let get_certificate_files_with_prefix dir prefix = + let alt_dir = dir ^ "/lp_certificates" in + let files1 = get_files_with_prefix dir prefix in + let files2 = + if Sys.file_exists alt_dir then + get_files_with_prefix alt_dir prefix + else + [] in + files1 @ files2;; + +let mem_stat () = + let stat = Gc.stat() in + let word = float_of_int (Sys.word_size / 8) in + let free = float_of_int stat.Gc.free_words *. word /. 1024.0 in + let total = float_of_int stat.Gc.heap_words *. word /. 1024.0 in + let allocated = total -. free in + let str = sprintf "allocated = %f (free = %f; total_size = %f; %f)\n" + allocated free total (free /. total) in + print_string str;; + + +let verify_file = + let counter = ref 0 and + total = ref 0 in + let report s = + Format.print_string s; Format.print_newline(); Format.print_flush() in + let process certificate = + let _ = counter := !counter + 1 in + let _ = report (sprintf "%d/%d" !counter !total) in + verify_lp_certificate certificate in + let process_all file = + let certificates = read_lp_certificates file in + let _ = counter := 0 in + let _ = total := length certificates in + let start = Unix.gettimeofday() in + let result = map process certificates in + let finish = Unix.gettimeofday() in + result, finish -. start in + fun file -> + let _ = report (sprintf "Verifying %s" file) in + let result, time = process_all file in + let _ = Gc.compact() in + let _ = mem_stat() in + result, time;; + + +let init_ineqs() = + try + let _ = Lp_ineqs.find_ineq false 3 "y1_def" in + let _ = report "Inequalities are already initialized" in + () + with Not_found -> + Flyspeck_lp.init_ineqs();; + + + +let verify_easy() = + let _ = init_ineqs() in + let files = get_certificate_files_with_prefix !cert_dir "easy" in + map verify_file files;; + +let verify_hard() = + let _ = init_ineqs() in + let files = get_certificate_files_with_prefix !cert_dir "hard" in + map verify_file files;; + +let verify_all() = + let result_hard = verify_hard() in + let result_easy = verify_easy() in + result_hard @ result_easy;; + +let test_result result = + let ths = List.flatten (map fst result) in + let time = map snd result in + let total = end_itlist (+.) time in + let concls = setify (map concl ths) in + let hyps = unions (map (fun th -> filter (fun tm -> not (is_binary "iso" tm)) (hyp th)) ths) in + total, concls, hyps;; + + + +end;; diff --git a/formal_lp/ineqs/constants_approx.hl b/formal_lp/ineqs/constants_approx.hl new file mode 100644 index 0000000..9db0b47 --- /dev/null +++ b/formal_lp/ineqs/constants_approx.hl @@ -0,0 +1,572 @@ +(* Basic interval arithmetic for approximation of constants *) +needs "tame/tame_defs.hl";; +needs "tame/TameGeneral.hl";; + +module Constants_approx = struct + +let interval_arith = new_definition `interval_arith (x:real) (lo, hi) <=> lo <= x /\ x <= hi`;; + + +let CONST_INTERVAL = prove(`!x. interval_arith x (x,x)`, REWRITE_TAC[interval_arith; REAL_LE_REFL]);; + + +let EPS_TO_INTERVAL = prove(`abs (f - x) <= e <=> interval_arith f (x - e, x + e)`, + REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; + + +let APPROX_INTERVAL = prove(`(a <= lo /\ hi <= b) /\ interval_arith x (lo, hi) + ==> interval_arith x (a,b)`, + REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; + + + +(* Numerical approximations for cos and acos *) + + +let COS_EQ_NEG_SIN = prove(`!x. cos (x + pi / &2) = --sin x`, + REWRITE_TAC[COS_SIN; REAL_ARITH `a - (b + a) = --b`; SIN_NEG]);; + + + + +let COS_DERIVATIVES = prove(`!x n. ((\x. cos (x + &n * pi / &2)) has_real_derivative cos (x + &(n + 1) * pi / &2)) (atreal x)`, + REPEAT GEN_TAC THEN REWRITE_TAC[] THEN + MP_TAC (REAL_DIFF_CONV `((\x. cos (x + &n * pi / &2)) has_real_derivative f) (atreal x)`) THEN + SUBGOAL_THEN `(&1 + &0) * --sin (x + &n * pi / &2) = cos (x + &(n + 1) * pi / &2)` (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[REAL_ARITH `(&1 + &0) * --a = --a`] THEN + REWRITE_TAC[GSYM REAL_OF_NUM_ADD] THEN + REWRITE_TAC[REAL_ARITH `x + (a + &1) * t = (x + a * t) + t`] THEN + REWRITE_TAC[COS_EQ_NEG_SIN]);; + + + + +let REAL_TAYLOR_COS_RAW = prove(`!x n. abs (cos x - sum (0..n) (\k. if (EVEN k) then ((-- &1) pow (k DIV 2) * x pow k) / &(FACT k) else &0)) <= + abs x pow (n + 1) / &(FACT (n + 1))`, + REPEAT GEN_TAC THEN + MP_TAC (SPECL [`(\i x. cos (x + &i * pi / &2))`; `n:num`; `UNIV:real->bool`; `&1`] REAL_TAYLOR) THEN + ANTS_TAC THENL + [ + REWRITE_TAC[is_realinterval; IN_UNIV; WITHINREAL_UNIV; COS_DERIVATIVES; COS_BOUND]; + ALL_TAC + ] THEN + REWRITE_TAC[IN_UNIV] THEN + DISCH_THEN (MP_TAC o SPECL [`&0`; `x:real`]) THEN + REWRITE_TAC[REAL_MUL_LZERO; REAL_ADD_RID; REAL_ADD_LID; REAL_SUB_RZERO; REAL_MUL_LID] THEN + SUBGOAL_THEN `!i. cos (&i * pi / &2) * x pow i / &(FACT i) = if EVEN i then (-- &1 pow (i DIV 2) * x pow i) / &(FACT i) else &0` (fun th -> SIMP_TAC[th]) THEN + GEN_TAC THEN + ASM_CASES_TAC `EVEN i` THEN ASM_REWRITE_TAC[] THENL + [ + POP_ASSUM MP_TAC THEN + REWRITE_TAC[EVEN_EXISTS] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `(2 * m) DIV 2 = m` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC DIV_MULT THEN + ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[GSYM REAL_OF_NUM_MUL] THEN + REWRITE_TAC[REAL_ARITH `(&2 * a) * b / &2 = a * b`] THEN + REWRITE_TAC[COS_NPI] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + SUBGOAL_THEN `cos (&i * pi / &2) = &0` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[COS_ZERO] THEN + DISJ1_TAC THEN EXISTS_TAC `i:num` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[REAL_MUL_LZERO]);; + + +let SUM_PAIR_0 = prove(`!f n. sum (0..2 * n + 1) f = sum(0..n) (\i. f (2 * i) + f (2 * i + 1))`, + REPEAT GEN_TAC THEN + MP_TAC (SPECL [`f:num->real`; `0`; `n:num`] SUM_PAIR) THEN + REWRITE_TAC[ARITH_RULE `2 * 0 = 0`]);; + + +let REAL_TAYLOR_COS = prove(`!x n. abs (cos x - sum (0..n) (\i. (-- &1) pow i * x pow (2 * i) / &(FACT (2 * i)))) <= abs x pow (2*n + 2) / &(FACT (2*n + 2))`, + REPEAT GEN_TAC THEN + MP_TAC (SPECL [`x:real`; `2 * n + 1`] REAL_TAYLOR_COS_RAW) THEN + REWRITE_TAC[SUM_PAIR_0; EVEN_DOUBLE; ARITH_RULE `(2 * n + 1) + 1 = 2 *n + 2`] THEN + SUBGOAL_THEN `!i. ~(EVEN (2 * i + 1))` MP_TAC THENL + [ + GEN_TAC THEN REWRITE_TAC[NOT_EVEN] THEN + REWRITE_TAC[ARITH_ODD; ODD_ADD; ODD_MULT]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> SIMP_TAC[th]) THEN + SUBGOAL_THEN `!i. (2 * i) DIV 2 = i` MP_TAC THENL + [ + GEN_TAC THEN + MATCH_MP_TAC DIV_MULT THEN + REWRITE_TAC[ARITH]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; REAL_ADD_RID]) THEN + REWRITE_TAC[REAL_ARITH `(a * b) / c = a * b / c`]);; + + + + + +let gen_sum_thm n = + let SUM_lemma n = + let tm = list_mk_comb (`sum:(num->bool)->(num->real)->real`, [mk_comb (`(..) 0`, mk_small_numeral n); `f:num->real`]) in + let suc_th = REWRITE_RULE[EQ_CLAUSES] (REWRITE_CONV[ARITH] (mk_eq (mk_small_numeral n, mk_comb (`SUC`, mk_small_numeral (n - 1))))) in + let th1 = REWRITE_CONV[suc_th] tm in + REWRITE_RULE[SUM_CLAUSES_NUMSEG; ARITH] th1 in + let rec rewriter th n = + if n > 0 then + rewriter (REWRITE_RULE[SUM_lemma n; GSYM REAL_ADD_ASSOC] th) (n - 1) + else + th in + GEN_ALL (rewriter (SUM_lemma n) (n - 1));; + + +(* Evaluates cos at a given point using n terms from the cosine Taylor series *) +let cos_eval x n = + let th1 = (SPECL [x; mk_small_numeral n] REAL_TAYLOR_COS) in + let th2 = REWRITE_RULE[gen_sum_thm n] th1 in + let th4 = CONV_RULE (NUM_REDUCE_CONV) th2 in + let th5 = CONV_RULE (DEPTH_CONV REAL_INT_POW_CONV) th4 in + CONV_RULE (REAL_RAT_REDUCE_CONV) th5;; + + + +let acs3_lo = prove(`#1.230959417 <= acs (&1 / &3)`, + SUBGOAL_THEN `#1.230959417 = acs (cos(#1.230959417))` (fun th -> ONCE_REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC (GSYM ACS_COS) THEN + MP_TAC PI_APPROX_32 THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + MATCH_MP_TAC ACS_MONO_LE THEN + REWRITE_TAC[COS_BOUNDS] THEN + MP_TAC (cos_eval `#1.230959417` 6) THEN + REAL_ARITH_TAC);; + + +(* 1.23095941734077 *) +let acs3_hi = prove(`acs(&1 / &3) <= #1.230959418`, + SUBGOAL_THEN `#1.230959418 = acs(cos(#1.230959418))` (fun th -> ONCE_REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC (GSYM ACS_COS) THEN + MP_TAC PI_APPROX_32 THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + MATCH_MP_TAC ACS_MONO_LE THEN + REWRITE_TAC[COS_BOUNDS] THEN + MP_TAC (cos_eval `#1.230959418` 6) THEN + REAL_ARITH_TAC);; + + +let le_op_real = `(<=):real->real->bool` and + minus_op_real = `(-):real->real->real` and + plus_op_real = `(+):real->real->real` and + mul_op_real = `( * ):real->real->real` and + div_op_real = `(/):real->real->real` and + inv_op_real = `inv:real->real` and + neg_op_real = `(--):real->real`;; + +let mk_decimal a b = + let tm = mk_comb(mk_comb(`DECIMAL`, mk_numeral (Num.abs_num a)), mk_numeral b) in + if (a + interval_arith (sqrt x) (abs c, abs d)`, + REWRITE_TAC[interval_arith] THEN REPEAT STRIP_TAC THENL + [ + MATCH_MP_TAC REAL_LE_RSQRT THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a:real` THEN + ASM_REWRITE_TAC[REAL_ARITH `abs a pow 2 = a * a`]; + MATCH_MP_TAC REAL_LE_LSQRT THEN + ASM_REWRITE_TAC[REAL_ARITH `abs d pow 2 = d * d`; REAL_ABS_POS] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a:real` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `c * c:real` THEN + ASM_REWRITE_TAC[REAL_LE_SQUARE]; + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `b:real` THEN + ASM_REWRITE_TAC[] + ] + ]);; + + + +let interval_sqrt th precision = + let th' = CONV_RULE (REWRITE_CONV[DECIMAL] THENC REAL_RAT_REDUCE_CONV) th in + let lo, hi = dest_pair(rand(concl th')) in + let x_lo, x_hi = float_of_num (rat_of_term lo), float_of_num (rat_of_term hi) in + let lo_sqrt, hi_sqrt = Pervasives.sqrt x_lo, Pervasives.sqrt x_hi in + let m = 10.0 ** float_of_int precision in + let hack n = num_of_string (Int64.to_string (Int64.of_float n)) in + let sqrt_lo_num, sqrt_hi_num = hack (floor (lo_sqrt *. m)), hack (ceil (hi_sqrt *. m)) in + let m_num = Int 10 **/ Int precision in + let x_lo_tm = mk_decimal sqrt_lo_num m_num in + let x_hi_tm = mk_decimal sqrt_hi_num m_num in + let conv = EQT_ELIM o REAL_RAT_REDUCE_CONV in + let lo_th = conv (mk_binop le_op_real (mk_binop mul_op_real x_lo_tm x_lo_tm) lo) in + let hi_th = conv (mk_binop le_op_real hi (mk_binop mul_op_real x_hi_tm x_hi_tm)) in + let th0 = CONJ th' (CONJ lo_th hi_th) in + (CONV_RULE REAL_RAT_REDUCE_CONV) (MATCH_MP INTERVAL_SQRT th0);; + + + +(************************************) + +(* Arithmetic of intervals *) + +let INTERVAL_ADD = prove(`interval_arith x (a, b) /\ interval_arith y (c, d) + ==> interval_arith (x + y) (a + c, b + d)`, + REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; + + +let INTERVAL_SUB = prove(`interval_arith x (a, b) /\ interval_arith y (c, d) + ==> interval_arith (x - y) (a - d, b - c)`, + REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; + + +let INTERVAL_NEG = prove(`interval_arith x (a, b) ==> + interval_arith (--x) (--b, --a)`, + REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; + + + +let INTERVAL_INV = prove(`interval_arith x (a, b) /\ (&0 < a \/ b < &0) + ==> interval_arith (inv x) (inv b, inv a)`, + REWRITE_TAC[interval_arith] THEN + STRIP_TAC THENL + [ + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_INV2 THEN + ASM_REWRITE_TAC[] THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + ONCE_REWRITE_TAC[REAL_ARITH `a <= b <=> --b <= --a`] THEN + REWRITE_TAC[GSYM REAL_INV_NEG] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_INV2 THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC);; + + +let INTERVAL_INV_POS = prove(`interval_arith x (a,b) /\ &0 < a + ==> interval_arith (inv x) (inv b, inv a)`, + SIMP_TAC[INTERVAL_INV]);; + + +let INTERVAL_INV_NEG = prove(`interval_arith x (a,b) /\ b < &0 + ==> interval_arith (inv x) (inv b, inv a)`, + SIMP_TAC[INTERVAL_INV]);; + + + +let INTERVAL_MUL_lemma = prove(`!x y a b c d. interval_arith x (a, b) /\ interval_arith y (c, d) /\ x <= y + ==> x * y <= max (max (a * c) (a * d)) (max (b * c) (b * d))`, + REPEAT GEN_TAC THEN + REWRITE_TAC[interval_arith] THEN DISCH_TAC THEN + ABBREV_TAC `t = max (max (a * c) (a * d)) (max (b * c) (b * d))` THEN + SUBGOAL_THEN `a * c <= t /\ a * d <= t /\ b * c <= t /\ b * d <= t:real` ASSUME_TAC THENL + [ + EXPAND_TAC "t" THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + DISJ_CASES_TAC (REAL_ARITH `&0 <= x \/ x <= &0`) THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `b * d:real` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `x:real` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISJ_CASES_TAC (REAL_ARITH `&0 <= b \/ b <= &0`) THENL + [ + DISJ_CASES_TAC (REAL_ARITH `&0 <= y \/ y <= &0`) THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `&0` THEN + CONJ_TAC THENL + [ + ONCE_REWRITE_TAC[REAL_ARITH `&0 = &0 * y`] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `b * d:real` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `y:real` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a * c:real` THEN + ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[GSYM REAL_NEG_MUL2] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[REAL_LE_NEG; REAL_NEG_GE0]; + ALL_TAC + ] THEN + + DISJ_CASES_TAC (REAL_ARITH `&0 <= c \/ c <= &0`) THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `b * c:real` THEN + ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[REAL_ARITH `x * y <= b * c <=> (--b) * c <= (--x) * y`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[REAL_LE_NEG; REAL_NEG_GE0]; + ALL_TAC + ] THEN + + DISJ_CASES_TAC (REAL_ARITH `&0 <= y \/ y <= &0`) THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `&0` THEN + CONJ_TAC THENL + [ + ONCE_REWRITE_TAC[REAL_ARITH `&0 = &0 * y`] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a * c:real` THEN + ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[GSYM REAL_NEG_MUL2] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[REAL_NEG_GE0] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `x:real` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a * c:real` THEN + ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[GSYM REAL_NEG_MUL2] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[REAL_LE_NEG; REAL_NEG_GE0]);; + + + +let INTERVAL_MUL_lemma2 = prove(`!x y a b c d. interval_arith x (a,b) /\ interval_arith y (c,d) + ==> x * y <= max (max (a * c) (a * d)) (max (b * c) (b * d))`, + REPEAT STRIP_TAC THEN + DISJ_CASES_TAC (REAL_ARITH `x <= y \/ y <= x:real`) THENL + [ + MATCH_MP_TAC INTERVAL_MUL_lemma THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`y:real`; `x:real`; `c:real`; `d:real`; `a:real`; `b:real`] INTERVAL_MUL_lemma) THEN + ASM_REWRITE_TAC[] THEN + REAL_ARITH_TAC);; + + + + +let INTERVAL_MUL = prove(`interval_arith x (a, b) /\ interval_arith y (c, d) + ==> interval_arith (x * y) + (min (min (a * c) (a * d)) (min (b * c) (b * d)), + max (max (a * c) (a * d)) (max (b * c) (b * d)))`, + DISCH_TAC THEN REWRITE_TAC[interval_arith] THEN + ASM_SIMP_TAC[INTERVAL_MUL_lemma2] THEN + MP_TAC (SPECL[`--x:real`; `y:real`; `--b:real`; `--a:real`; `c:real`; `d:real`] INTERVAL_MUL_lemma2) THEN + ASM_SIMP_TAC[INTERVAL_NEG] THEN + REAL_ARITH_TAC);; + + + + + + +(**************************************) + + +let const_interval tm = SPEC tm CONST_INTERVAL;; + + +let interval_neg th = MATCH_MP INTERVAL_NEG th;; + + +let interval_add th1 th2 = + let th0 = MATCH_MP INTERVAL_ADD (CONJ th1 th2) in + (CONV_RULE (RAND_CONV REAL_RAT_REDUCE_CONV)) th0;; + +let interval_sub th1 th2 = + let th0 = MATCH_MP INTERVAL_SUB (CONJ th1 th2) in + (CONV_RULE (RAND_CONV REAL_RAT_REDUCE_CONV)) th0;; + + +let interval_mul th1 th2 = + let th0 = MATCH_MP INTERVAL_MUL (CONJ th1 th2) in + (CONV_RULE (RAND_CONV REAL_RAT_REDUCE_CONV)) th0;; + + +let interval_inv th = + let lt_op_real = `(<):real->real->bool` in + let lo_tm, hi_tm = dest_pair(rand(concl th)) in + let lo_ineq = REAL_RAT_LT_CONV (mk_binop lt_op_real `&0` lo_tm) in + if (rand(concl lo_ineq) = `T`) then + let th0 = CONJ th (EQT_ELIM lo_ineq) in + (CONV_RULE (RAND_CONV REAL_RAT_REDUCE_CONV)) (MATCH_MP INTERVAL_INV_POS th0) + else + let hi_ineq = REAL_RAT_LT_CONV (mk_binop lt_op_real hi_tm `&0`) in + if (rand(concl hi_ineq) = `T`) then + let th0 = CONJ th (EQT_ELIM hi_ineq) in + (CONV_RULE (RAND_CONV REAL_RAT_REDUCE_CONV)) (MATCH_MP INTERVAL_INV_NEG th0) + else failwith("interval_inv: 0 is inside interval");; + +let interval_div th1 th2 = + let th2' = interval_inv th2 in + ONCE_REWRITE_RULE[GSYM real_div] (interval_mul th1 th2');; + + + +(*************************) + + +let acs3_interval = REWRITE_RULE[GSYM interval_arith] (CONJ acs3_lo acs3_hi);; + + +let pi_interval = prove(`interval_arith pi (#3.141592653, #3.141592654)`, + REWRITE_TAC[interval_arith] THEN + MP_TAC PI_APPROX_32 THEN REAL_ARITH_TAC);; + + +let tgt_interval = prove(`interval_arith tgt (#1.541, #1.541)`, + REWRITE_TAC[Tame_defs.tgt; interval_arith; REAL_LE_REFL]);; + + + +let interval_table = Hashtbl.create 10;; +let add_interval th = Hashtbl.add interval_table ((rand o rator o concl) th) th;; + + + +let rec create_interval tm = + if Hashtbl.mem interval_table tm then + Hashtbl.find interval_table tm + else + if (is_ratconst tm) then + const_interval tm + else if (is_binop plus_op_real tm) then + let lhs, rhs = dest_binop plus_op_real tm in + interval_add (create_interval lhs) (create_interval rhs) + else if (is_binop minus_op_real tm) then + let lhs, rhs = dest_binop minus_op_real tm in + interval_sub (create_interval lhs) (create_interval rhs) + else if (is_binop mul_op_real tm) then + let lhs, rhs = dest_binop mul_op_real tm in + interval_mul (create_interval lhs) (create_interval rhs) + else if (is_binop div_op_real tm) then + let lhs, rhs = dest_binop div_op_real tm in + interval_div (create_interval lhs) (create_interval rhs) + else if (is_comb tm) then + let ltm, rtm = dest_comb tm in + if (ltm = inv_op_real) then + interval_inv (create_interval rtm) + else if (ltm = neg_op_real) then + interval_neg (create_interval rtm) + else failwith "create_interval: unknown unary operation" + else + failwith "create_interval: unexpected term";; + + + +open Sphere;; + + +add_interval pi_interval;; +add_interval acs3_interval;; +add_interval tgt_interval;; +add_interval (REWRITE_RULE[GSYM sqrt8] (interval_sqrt (const_interval `&8`) 9));; +add_interval (REWRITE_RULE[GSYM sol0] (create_interval `&3 * acs(&1 / &3) - pi`));; +add_interval (create_interval `sol0 / pi`);; + +let rho218 = new_definition `rho218 = rho(#2.18)`;; + +let rho218_def = (REWRITE_CONV[rho218; rho; ly; interp; GSYM Tame_general.sol0_over_pi_EQ_const1] THENC + REAL_RAT_REDUCE_CONV) `rho218`;; + +let rho218_interval = REWRITE_RULE[SYM rho218_def] (create_interval(rand(concl rho218_def)));; + +add_interval rho218_interval;; + + +(* +approx_interval (create_interval `rho (#2.18)`) 8;; + +approx_interval (create_interval `&2 * (pi + sol0)`) 6;; + +approx_interval (create_interval `sqrt8 - pi / sol0 + rho(#2.18) * &3`) 6;; + +approx_interval (create_interval `pi * pi`) 6;; +*) + +end;; \ No newline at end of file diff --git a/formal_lp/ineqs/delta_ineq.hl b/formal_lp/ineqs/delta_ineq.hl new file mode 100644 index 0000000..046735f --- /dev/null +++ b/formal_lp/ineqs/delta_ineq.hl @@ -0,0 +1,166 @@ +needs "tame/Inequalities.hl";; + +module Delta_ineq = struct + +open Tame_inequalities;; + +let lemma1 = prove(`!x1 x2 x3 x4 x5 x6. #4.0 <= x1 /\ x1 <= #6.3504 /\ #4.0 <= x4 + ==> delta_x x1 x2 x3 x4 x5 x6 >= delta_x #4.0 x2 x3 x4 x5 x6 + \/ delta_x x1 x2 x3 x4 x5 x6 >= delta_x #6.3504 x2 x3 x4 x5 x6`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `!x1. delta_x x1 x2 x3 x4 x5 x6 = (\x. delta_x x x2 x3 x4 x5 x6) x1` (fun th -> ONCE_REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC lemma' THEN + ASM_REWRITE_TAC[Sphere.delta_x; FUN_EQ_THM] THEN + MAP_EVERY EXISTS_TAC [`--x4`; `x4*(x2+x3-x4+x5+x6)+x2*x5+x3*x6-x3*x5-x2*x6`; `x2*x5*(x3-x2+x4-x5+x6) + x3*x6*(x2-x3+x4+x5-x6)-x2*x3*x4-x4*x5*x6`] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC);; + + +let lemma2 = prove(`!x1 x2 x3 x4 x5 x6. #4.0 <= x2 /\ x2 <= #6.3504 /\ #4.0 <= x5 + ==> delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 #4.0 x3 x4 x5 x6 + \/ delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 #6.3504 x3 x4 x5 x6`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `!x2. delta_x x1 x2 x3 x4 x5 x6 = (\x. delta_x x1 x x3 x4 x5 x6) x2` (fun th -> ONCE_REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC lemma' THEN + ASM_REWRITE_TAC[Sphere.delta_x; FUN_EQ_THM] THEN + MAP_EVERY EXISTS_TAC [`--x5`; `x5*(x1+x3+x4-x5+x6)+x1*x4+x3*x6-x3*x4-x1*x6`; `x1*x4*(--x1+x3-x4+x5+x6) + x3*x6*(x1-x3+x4+x5-x6)-x1*x3*x5-x4*x5*x6`] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC);; + + +let lemma3 = prove(`!x1 x2 x3 x4 x5 x6. #4.0 <= x3 /\ x3 <= #6.3504 /\ #4.0 <= x6 + ==> delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 x2 #4.0 x4 x5 x6 + \/ delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 x2 #6.3504 x4 x5 x6`, + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x2 x x4 x5 x6) x3`)] THEN + MATCH_MP_TAC lemma' THEN + ASM_REWRITE_TAC[Sphere.delta_x; FUN_EQ_THM] THEN + MAP_EVERY EXISTS_TAC [`--x6`; `x6*(x1+x2-x6+x4+x5)+x1*x4+x2*x5-x2*x4-x1*x5`; `x2*x5*(x1-x2+x4-x5+x6) + x1*x4*(--x1+x2-x4+x5+x6)-x1*x2*x6-x4*x5*x6`] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC);; + + +let lemma4 = prove(`!x1 x2 x3 x4 x5 x6. #4.0 <= x4 /\ x4 <= &9 /\ #4.0 <= x1 + ==> delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 x2 x3 #4.0 x5 x6 + \/ delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 x2 x3 (&9) x5 x6`, + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x2 x3 x x5 x6) x4`)] THEN + MATCH_MP_TAC lemma' THEN + ASM_REWRITE_TAC[Sphere.delta_x; FUN_EQ_THM] THEN + MAP_EVERY EXISTS_TAC [`--x1`; `x1*(--x1+x2+x3+x5+x6)+x2*x5+x3*x6-x2*x3-x5*x6`; `x2*x5*(x1-x2+x3-x5+x6) + x3*x6*(x1+x2-x3+x5-x6)-x1*x3*x5-x1*x2*x6`] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC);; + + +let lemma5 = prove(`!x1 x2 x3 x4 x5 x6. #4.0 <= x5 /\ x5 <= &9 /\ #4.0 <= x2 + ==> delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 x2 x3 x4 #4.0 x6 + \/ delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 x2 x3 x4 (&9) x6`, + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x2 x3 x4 x x6) x5`)] THEN + MATCH_MP_TAC lemma' THEN + ASM_REWRITE_TAC[Sphere.delta_x; FUN_EQ_THM] THEN + MAP_EVERY EXISTS_TAC [`--x2`; `x2*(x1+x3-x2+x4+x6)+x1*x4+x3*x6-x1*x3-x4*x6`; `x1*x4*(--x1+x2+x3-x4+x6) + x3*x6*(x1+x2-x3+x4-x6)-x2*x3*x4-x1*x2*x6`] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC);; + + +let lemma6 = prove(`!x1 x2 x3 x4 x5 x6. #4.0 <= x6 /\ x6 <= &9 /\ #4.0 <= x3 + ==> delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 x2 x3 x4 x5 #4.0 + \/ delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 x2 x3 x4 x5 (&9)`, + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x2 x3 x4 x5 x) x6`)] THEN + MATCH_MP_TAC lemma' THEN + ASM_REWRITE_TAC[Sphere.delta_x; FUN_EQ_THM] THEN + MAP_EVERY EXISTS_TAC [`--x3`; `x3*(x1+x2-x3+x4+x5)+x1*x4+x2*x5-x1*x2-x4*x5`; `x2*x5*(x1-x2+x3+x4-x5) + x1*x4*(--x1+x2+x3-x4+x5)-x2*x3*x4-x1*x3*x5`] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC);; + + +(* delta_x > 0 for apex darts *) +let delta_x_pos_apex = prove(`!x1 x2 x3 x4 x5 x6. ineq [#4.0,x1,#6.3504; + #4.0,x2,#6.3504; + #4.0,x3,#6.3504; + #4.0,x4,&9; + #4.0,x5,&9; + #4.0,x6,&9] (delta_x x1 x2 x3 x4 x5 x6 >= &1)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[INEQ_ALT; ALL] THEN + REPEAT STRIP_TAC THEN + ASSUME_TAC (REAL_ARITH `#4.0 <= #4.0 /\ #4.0 <= #6.3504`) THEN + + (* x1 *) + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x x2 x3 x4 x5 x6) x1`)] THEN + MATCH_MP_TAC main_lemma THEN + MAP_EVERY EXISTS_TAC [`#4.0`; `#6.3504`] THEN + ASM_SIMP_TAC[lemma1] THEN + CONJ_TAC THEN + + (* x2 *) + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x x3 x4 x5 x6) x2`)] THEN + MATCH_MP_TAC main_lemma THEN + MAP_EVERY EXISTS_TAC [`#4.0`; `#6.3504`] THEN + ASM_SIMP_TAC[lemma2] THEN + CONJ_TAC THEN + + (* x3 *) + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x2 x x4 x5 x6) x3`)] THEN + MATCH_MP_TAC main_lemma THEN + MAP_EVERY EXISTS_TAC [`#4.0`; `#6.3504`] THEN + ASM_SIMP_TAC[lemma3] THEN + CONJ_TAC THEN + + (* x4 *) + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x2 x3 x x5 x6) x4`)] THEN + MATCH_MP_TAC main_lemma THEN + MAP_EVERY EXISTS_TAC [`#4.0`; `&9`] THEN + ASM_SIMP_TAC[lemma4] THEN + CONJ_TAC THEN + + (* x5 *) + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x2 x3 x4 x x6) x5`)] THEN + MATCH_MP_TAC main_lemma THEN + MAP_EVERY EXISTS_TAC [`#4.0`; `&9`] THEN + ASM_SIMP_TAC[lemma5] THEN + CONJ_TAC THEN + + (* x6 *) + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x2 x3 x4 x5 x) x6`)] THEN + MATCH_MP_TAC main_lemma THEN + MAP_EVERY EXISTS_TAC [`#4.0`; `&9`] THEN + ASM_SIMP_TAC[lemma6] THEN + CONJ_TAC THEN + + (* Final stage *) + REWRITE_TAC[Sphere.delta_x] THEN + CONV_TAC REAL_RAT_REDUCE_CONV);; + + +let aux_lemma1 = prove(`!a. &2 <= a /\ a <= #2.52 ==> #4.0 <= a * a /\ a * a <= #6.3504`, + REWRITE_TAC[ARITH_RULE `#4.0 = &2 * &2 /\ #6.3504 = #2.52 * #2.52`] THEN + REWRITE_TAC[GSYM REAL_POW_2; GSYM REAL_LE_SQUARE_ABS] THEN ARITH_TAC);; + +let aux_lemma2 = prove(`!a. &2 <= a /\ a <= &3 ==> #4.0 <= a * a /\ a * a <= &9`, + REWRITE_TAC[ARITH_RULE `#4.0 = &2 * &2 /\ &9 = &3 * &3`] THEN + REWRITE_TAC[GSYM REAL_POW_2; GSYM REAL_LE_SQUARE_ABS] THEN ARITH_TAC);; + + +let delta_y_pos_apex = prove(`!y1 y2 y3 y4 y5 y6. + &2 <= y1 /\ y1 <= #2.52 + /\ &2 <= y2 /\ y2 <= #2.52 + /\ &2 <= y3 /\ y3 <= #2.52 + /\ &2 <= y4 /\ y4 <= &3 + /\ &2 <= y5 /\ y5 <= &3 + /\ &2 <= y6 /\ y6 <= &3 + ==> &0 <= delta_y y1 y2 y3 y4 y5 y6`, + REPEAT STRIP_TAC THEN REWRITE_TAC[Sphere.delta_y] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&1` THEN + REWRITE_TAC[ARITH_RULE `&0 <= &1`; GSYM real_ge] THEN + MP_TAC delta_x_pos_apex THEN REWRITE_TAC[INEQ_ALT; ALL] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_SIMP_TAC[aux_lemma1; aux_lemma2]);; + +end;; diff --git a/formal_lp/lp_example/out_test.hl b/formal_lp/lp_example/out_test.hl new file mode 100644 index 0000000..0f96fc4 --- /dev/null +++ b/formal_lp/lp_example/out_test.hl @@ -0,0 +1,21 @@ +module Lp = struct +let target = `&3 * zz_x + -- &1 * zz_y`;; +let target_bound = `-- &6938 / &10000`;; +let precision_constant = Int 100000;; +let ineqs = [ +ASSUME (mk_le_ineq (mk_linear [(mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); ] ["zz_x"; "zz_y"; "z"; ])(mk_real_int64 314160L)), (mk_real_int64 150000L); +ASSUME (mk_le_ineq (mk_linear [(mk_real_int64 100000L); (mk_real_int64 141421L); (negate (mk_real_int64 100000L)); ] ["zz_x"; "zz_y"; "z"; ])(mk_real_int64 173206L)), (mk_real_int64 150000L); +];; +let target_vars = [ +ASSUME (mk_le_ineq (mk_linear [(mk_real_int64 100000L); ] ["zz_y"; ])(mk_real_int64 1000000L)), (mk_real_int64 50000L); +ASSUME (mk_le_ineq (mk_linear [(negate (mk_real_int64 100000L)); ] ["zz_y"; ])(negate (mk_real_int64 173205L))), (mk_real_int64 46213200000L); +];; + + +let var_ineqs = [ +];; +let start = Sys.time();; +let result = prove_lp ineqs var_ineqs target_vars target_bound precision_constant;; +end;; +Sys.time() -. Lp.start;; +concl (Lp.result);; diff --git a/formal_lp/more_arith/arith_int.hl b/formal_lp/more_arith/arith_int.hl new file mode 100644 index 0000000..9b69817 --- /dev/null +++ b/formal_lp/more_arith/arith_int.hl @@ -0,0 +1,275 @@ +needs "../formal_lp/hypermap/arith_link.hl";; +needs "arith/nat.hl";; +needs "misc/misc.hl";; +needs "misc/vars.hl";; + +(* Based on the code of calc_int.ml *) + +module Arith_int : + sig + val my_mk_realintconst : num -> term + val my_dest_realintconst : term -> num + val my_real_int_neg_conv : term -> thm + val my_real_int_add_conv : term -> thm + val my_real_int_sub_conv : term -> thm + val my_real_int_mul_conv : term -> thm + end + = struct + +open Misc_vars;; + +let test = Arith_misc.test;; + +let to_numeral = Arith_nat.NUM_TO_NUMERAL_CONV;; +let from_numeral = Arith_nat.NUMERAL_TO_NUM_CONV;; +let mk_num = Arith_nat.mk_numeral_array;; +let dest_num = Arith_hash.dest_numeral_hash;; +let num_suc = Arith_nat.NUM_SUC_HASH_CONV;; +let num_add = Arith_nat.NUM_ADD_HASH_CONV;; +let num_mul = Arith_nat.NUM_MULT_HASH_CONV;; +let num_gt0 = Arith_nat.NUM_GT0_HASH_CONV;; + + +let my_mk_realintconst n = + if n >=/ Int 0 then mk_comb(amp_op_real, mk_num n) + else mk_comb(neg_op_real, mk_comb(amp_op_real, mk_num (minus_num n)));; + + +let my_dest_realintconst tm = + let ltm, rtm = dest_comb tm in + if (ltm = neg_op_real) then + let amp_tm, n_tm = dest_comb rtm in + if (amp_tm = amp_op_real) then + minus_num (dest_num n_tm) + else + failwith "my_dest_realintconst: --(&n) expected" + else + if (ltm = amp_op_real) then + dest_num rtm + else + failwith "my_dest_realintconst: &n expected";; + + + +let is_neg_comb tm = is_comb tm && rator tm = neg_op_real;; + + +let replace_numerals = (rand o concl o DEPTH_CONV from_numeral);; +let REPLACE_NUMERALS = CONV_RULE (DEPTH_CONV from_numeral);; + + +let zero_const = replace_numerals `&0`;; + + +(***************************************) + +(* NEG *) + +let neg_0 = (REPLACE_NUMERALS o prove)(`-- &0 = &0`, REAL_ARITH_TAC) and + neg_neg = prove(`--(--(&n)) = &n`, REAL_ARITH_TAC);; + + +let my_real_int_neg_conv tm = + let neg_tm, rtm = dest_comb tm in + if (neg_tm = neg_op_real) then + if (rtm = zero_const) then + neg_0 + else + let neg_tm, rtm = dest_comb rtm in + let amp_tm, n_tm = dest_comb rtm in + if (neg_tm = neg_op_real && amp_tm = amp_op_real) then + INST[n_tm, n_var_num] neg_neg + else + failwith "my_real_int_neg_conv: --(--(&n)) expected" + else + failwith "my_real_int_neg_conv: --x expected";; + + +(* +let tm = `-- -- &12241`;; + +(* 1.880 *) +test 100000 REAL_INT_NEG_CONV tm;; +(* 0.292 *) +test 100000 my_real_int_neg_conv tm;; +*) + + + +(***************************************) + +(* ADD *) + +let pth1 = prove(`(--(&m) + --(&n) = --(&(m + n)))`, REWRITE_TAC[GSYM REAL_OF_NUM_ADD; REAL_NEG_ADD]) and + pth2 = prove(`(--(&m) + &(m + n) = &n)`, REWRITE_TAC[GSYM REAL_OF_NUM_ADD] THEN REAL_ARITH_TAC) and + pth3 = prove(`(--(&(m + n)) + &m = --(&n))`, REWRITE_TAC[GSYM REAL_OF_NUM_ADD] THEN REAL_ARITH_TAC) and + pth4 = prove(`(&(m + n) + --(&m) = &n)`, REWRITE_TAC[GSYM REAL_OF_NUM_ADD] THEN REAL_ARITH_TAC) and + pth5 = prove(`(&m + --(&(m + n)) = --(&n))`, REWRITE_TAC[GSYM REAL_OF_NUM_ADD] THEN REAL_ARITH_TAC) and + pth6 = prove(`(&m + &n = &(m + n))`, REWRITE_TAC[GSYM REAL_OF_NUM_ADD]);; + + +let my_real_int_add_conv = + let dest = dest_binop add_op_real in + (fun tm -> + try let l,r = dest tm in + if rator l = neg_op_real then + if rator r = neg_op_real then + let th1 = INST [rand(rand l), m_var_num; rand(rand r), n_var_num] pth1 in + let tm1 = rand(rand(rand(concl th1))) in + let th2 = AP_TERM neg_op_real (AP_TERM amp_op_real (num_add tm1)) in + TRANS th1 th2 + else + let m = rand(rand l) and n = rand r in + let m' = dest_num m and n' = dest_num n in + if m' <=/ n' then + let p = mk_num (n' -/ m') in + let th1 = INST [m,m_var_num; p,n_var_num] pth2 in + let th2 = num_add (rand(rand(lhand(concl th1)))) in + let th3 = AP_TERM (rator tm) (AP_TERM amp_op_real (SYM th2)) in + TRANS th3 th1 + else + let p = mk_num (m' -/ n') in + let th1 = INST [n,m_var_num; p,n_var_num] pth3 in + let th2 = num_add (rand(rand(lhand(lhand(concl th1))))) in + let th3 = AP_TERM neg_op_real (AP_TERM amp_op_real (SYM th2)) in + let th4 = AP_THM (AP_TERM add_op_real th3) (rand tm) in + TRANS th4 th1 + else + if rator r = neg_op_real then + let m = rand l and n = rand(rand r) in + let m' = dest_num m and n' = dest_num n in + if n' <=/ m' then + let p = mk_num (m' -/ n') in + let th1 = INST [n,m_var_num; p,n_var_num] pth4 in + let th2 = num_add (rand(lhand(lhand(concl th1)))) in + let th3 = AP_TERM add_op_real (AP_TERM amp_op_real (SYM th2)) in + let th4 = AP_THM th3 (rand tm) in + TRANS th4 th1 + else + let p = mk_num (n' -/ m') in + let th1 = INST [m,m_var_num; p,n_var_num] pth5 in + let th2 = num_add (rand(rand(rand(lhand(concl th1))))) in + let th3 = AP_TERM neg_op_real (AP_TERM amp_op_real (SYM th2)) in + let th4 = AP_TERM (rator tm) th3 in + TRANS th4 th1 + else + let th1 = INST [rand l,m_var_num; rand r,n_var_num] pth6 in + let tm1 = rand(rand(concl th1)) in + let th2 = AP_TERM amp_op_real (num_add tm1) in + TRANS th1 th2 + with Failure _ -> failwith "my_real_int_add_conv");; + + +(* +let tm = `&3252375395 + --(&3454570237434)`;; +let tm' = replace_numerals tm;; + +(* 1.192 *) +test 1000 REAL_INT_ADD_CONV tm;; +(* 0.224 *) +test 1000 my_real_int_add_conv tm';; +*) + + +(****************************************) + +(* SUB *) + +let real_sub' = SPEC_ALL real_sub;; + +let my_real_int_sub_conv tm = + let x_tm, y_tm = dest_binop sub_op_real tm in + let th0 = INST[x_tm, x_var_real; y_tm, y_var_real] real_sub' in + if (is_neg_comb y_tm) then + let ltm, rtm = dest_comb(rand(concl th0)) in + let neg_th = my_real_int_neg_conv rtm in + let th1 = AP_TERM ltm neg_th in + let th2 = my_real_int_add_conv (rand(concl th1)) in + TRANS th0 (TRANS th1 th2) + else + let th1 = my_real_int_add_conv (rand(concl th0)) in + TRANS th0 th1;; + + +(* +let tm = `-- &35252352362346236236 - (-- &12236236363523)`;; +let tm' = replace_numerals tm;; + +(* 1.860 *) +test 1000 REAL_INT_SUB_CONV tm;; +(* 0.348 *) +test 1000 my_real_int_sub_conv tm';; +*) + + + + +(****************************************) + +(* MUL *) + + +let mul_pp = prove(`&m * &n = &(m * n)`, REWRITE_TAC[REAL_OF_NUM_MUL]);; +let mul_nn = prove(`--(&m) * --(&n) = &(m * n)`, REWRITE_TAC[REAL_NEG_MUL2; mul_pp]) and + mul_np = prove(`--(&m) * &n = --(&(m * n))`, REWRITE_TAC[REAL_MUL_LNEG; mul_pp]) and + mul_pn = prove(`&m * --(&n) = --(&(m * n))`, REWRITE_TAC[REAL_MUL_RNEG; mul_pp]);; + + +let my_real_int_mul_conv tm = + let l, r = dest_binop mul_op_real tm in + if rator l = neg_op_real then + if rator r = neg_op_real then + let th1 = INST [rand(rand l), m_var_num; rand(rand r), n_var_num] mul_nn in + let tm1 = rand(rand(concl th1)) in + let th2 = AP_TERM amp_op_real (num_mul tm1) in + TRANS th1 th2 + else + let th1 = INST [rand(rand l), m_var_num; rand r, n_var_num] mul_np in + let tm1 = rand(rand(rand(concl th1))) in + let th2 = AP_TERM neg_op_real (AP_TERM amp_op_real (num_mul tm1)) in + TRANS th1 th2 + else + if rator r = neg_op_real then + let th1 = INST[rand l, m_var_num; rand(rand r), n_var_num] mul_pn in + let tm1 = rand(rand(rand(concl th1))) in + let th2 = AP_TERM neg_op_real (AP_TERM amp_op_real (num_mul tm1)) in + TRANS th1 th2 + else + let th1 = INST[rand l, m_var_num; rand r, n_var_num] mul_pp in + let tm1 = rand(rand(concl th1)) in + let th2 = AP_TERM amp_op_real (num_mul tm1) in + TRANS th1 th2;; + + + +(* +let amp x = mk_comb(amp_op_real, x);; +let negate x = mk_comb(neg_op_real, x);; + +let x = num_of_string "398537263103485";; +let y = num_of_string "243089539573957";; + + +let xx = amp (mk_num x) and yy = amp (mk_num y);; +let xxx = amp (mk_numeral x) and yyy = amp (mk_numeral y);; + + +(* 1.800 *) +test 100 REAL_INT_MUL_CONV (mk_binop mul_op_real (negate xxx) yyy);; + +(* 0.108 *) +test 100 my_real_int_mul_conv (mk_binop mul_op_real (negate xx) yy);; + +(DEPTH_CONV NUM_TO_NUMERAL_CONV) (concl(REAL_BITS_MUL_CONV (mk_binop mul_op_real xx yy))) + +*) + + + +end;; + + + + + + diff --git a/formal_lp/more_arith/lin_f.hl b/formal_lp/more_arith/lin_f.hl new file mode 100644 index 0000000..f6ce76b --- /dev/null +++ b/formal_lp/more_arith/lin_f.hl @@ -0,0 +1,112 @@ +module Linear_function = struct + +(********************) +(* Main definitions *) +(********************) + +(* A linear function *) +let lin_f = new_definition `lin_f terms = + ITLIST (\tm x. (FST tm) * (SND tm) + x) terms (&0)`;; + +(* Example: let x = `lin_f [&1, x:real; &2, y:real]`;; *) + + +(**********************) +(* Theorems for lin_f *) +(**********************) + +(* Basic properties of lin_f *) +let LIN_F_CONS = prove(`!h t. lin_f (CONS h t) = (FST h * SND h) + lin_f t`, + REWRITE_TAC[lin_f; ITLIST]);; + + +let LIN_F_EMPTY = prove(`lin_f [] = &0`, + REWRITE_TAC[lin_f; ITLIST]);; + + +let LIN_F_APPEND = prove(`!t1 t2. lin_f (APPEND t1 t2) = lin_f t1 + lin_f t2`, + LIST_INDUCT_TAC THEN REWRITE_TAC[APPEND] THENL + [ + REWRITE_TAC[LIN_F_EMPTY; REAL_ADD_LID]; + ALL_TAC + ] THEN + + GEN_TAC THEN + ASM_REWRITE_TAC[LIN_F_CONS; REAL_ADD_ASSOC]);; + + +(* Sum of two lin_f *) + +let LIN_F_SUM_HD = prove(`!v c1 t1 c2 t2 c. c1 + c2 = c ==> + lin_f (CONS (c1,v) t1) + lin_f (CONS (c2,v) t2) = lin_f [c,v] + (lin_f t1 + lin_f t2)`, + REPEAT GEN_TAC THEN REWRITE_TAC[LIN_F_CONS; LIN_F_EMPTY] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN REAL_ARITH_TAC);; + +let LIN_F_SUM_HD_ZERO = prove(`!v c1 t1 c2 t2. c1 + c2 = &0 ==> + lin_f (CONS (c1,v) t1) + lin_f (CONS (c2,v) t2) = lin_f t1 + lin_f t2`, + REPEAT GEN_TAC THEN DISCH_THEN (MP_TAC o MATCH_MP LIN_F_SUM_HD) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; LIN_F_CONS; LIN_F_EMPTY]) THEN + REAL_ARITH_TAC);; + +let LIN_F_SUM_EMPTY1 = prove(`!x. lin_f [] + lin_f x = lin_f x`, + REWRITE_TAC[LIN_F_EMPTY; REAL_ADD_LID]);; + +let LIN_F_SUM_EMPTY2 = prove(`!x. lin_f x + lin_f [] = lin_f x`, + REWRITE_TAC[LIN_F_EMPTY; REAL_ADD_RID]);; + +let LIN_F_SUM_MOVE1 = prove(`!h t x. lin_f (CONS h t) + lin_f x = lin_f [h] + (lin_f t + lin_f x)`, + REPEAT GEN_TAC THEN REWRITE_TAC[LIN_F_CONS; LIN_F_EMPTY] THEN REAL_ARITH_TAC);; + +let LIN_F_SUM_MOVE2 = prove(`!h t x. lin_f x + lin_f (CONS h t) = lin_f [h] + (lin_f x + lin_f t)`, + REPEAT GEN_TAC THEN REWRITE_TAC[LIN_F_CONS; LIN_F_EMPTY] THEN REAL_ARITH_TAC);; + + +let LIN_F_ADD_SINGLE = prove(`!h t. lin_f [h] + lin_f t = lin_f (CONS h t)`, + REWRITE_TAC[LIN_F_CONS; LIN_F_EMPTY] THEN REAL_ARITH_TAC);; + + +let LIN_F_ADD_SING_RCANCEL = prove(`!c v t. c * v + lin_f (CONS (--c, v) t) + = lin_f t`, + REWRITE_TAC[LIN_F_CONS; LIN_F_EMPTY] THEN REAL_ARITH_TAC);; + +let LIN_F_ADD_SING_LCANCEL = prove(`!c v t. --c * v + lin_f (CONS (c, v) t) + = lin_f t`, + REWRITE_TAC[LIN_F_CONS; LIN_F_EMPTY] THEN REAL_ARITH_TAC);; + + +(* Multiplication of lin_f *) + +let LIN_F_MUL = prove(`!v t. v * lin_f t = lin_f (MAP (\tm. v * FST tm, SND tm) t)`, + REWRITE_TAC[lin_f] THEN GEN_TAC THEN LIST_INDUCT_TAC THENL + [ + REWRITE_TAC[ITLIST; MAP; REAL_MUL_RZERO]; + ALL_TAC + ] THEN + REWRITE_TAC[ITLIST; MAP] THEN + ASM_REWRITE_TAC[REAL_ADD_LDISTRIB; REAL_MUL_ASSOC]);; + + +let LIN_F_MUL_HD = prove(`!x c v t c1. x * c = c1 ==> + x * lin_f (CONS (c,v) t) = lin_f [c1, v] + x * lin_f t`, + REWRITE_TAC[LIN_F_CONS; LIN_F_EMPTY] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[REAL_ARITH `x * (c * v + a) = (x * c) * v + x * a:real`] THEN + REAL_ARITH_TAC);; + + +let LIN_F_MUL_EMPTY = prove(`!x. x * lin_f [] = lin_f []`, + REWRITE_TAC[LIN_F_EMPTY] THEN REAL_ARITH_TAC);; + + +(* Theorems for converting sums into lin_f *) +let TO_LIN_F0 = prove(`!x. x = x + lin_f []`, REWRITE_TAC[LIN_F_EMPTY; REAL_ADD_RID]);; + +let TO_LIN_F1 = prove(`!a x. a * x = lin_f [a, x]`, + REWRITE_TAC[lin_f; ITLIST; REAL_ADD_RID]);; + +let TO_LIN_F = prove(`!c v x t. (c * v + x) + lin_f t = x + lin_f (CONS (c, v) t) /\ + c * v + lin_f t = lin_f (CONS (c, v) t)`, + REWRITE_TAC[LIN_F_CONS] THEN REAL_ARITH_TAC);; + + +end;; diff --git a/formal_lp/more_arith/prove_lp.hl b/formal_lp/more_arith/prove_lp.hl new file mode 100644 index 0000000..e9ba6bc --- /dev/null +++ b/formal_lp/more_arith/prove_lp.hl @@ -0,0 +1,440 @@ +needs "../formal_lp/more_arith/lin_f.hl";; +needs "../formal_lp/more_arith/arith_int.hl";; + + +module Prove_lp = struct + +open Linear_function;; +open Arith_misc;; +open Arith_nat;; +open Arith_int;; +open Misc_vars;; + + + +(* Special versions of the above theorems (for using with INST) *) + + +let NUM_ZERO = prove(mk_eq(mk_comb(amp_op_real, mk_comb(Arith_hash.num_const, zero_const)), `&0`), + REWRITE_TAC[Arith_hash.NUM_THM; NUMERAL]);; + +let LIN_F_SUM_HD', + LIN_F_SUM_HD_ZERO', + LIN_F_SUM_EMPTY1', LIN_F_SUM_EMPTY2', + LIN_F_SUM_MOVE1', LIN_F_SUM_MOVE2', + LIN_F_ADD_SINGLE' = + UNDISCH_ALL (SPEC_ALL LIN_F_SUM_HD), + UNDISCH_ALL (SPEC_ALL (ONCE_REWRITE_RULE[GSYM NUM_ZERO] LIN_F_SUM_HD_ZERO)), + SPEC_ALL LIN_F_SUM_EMPTY1, SPEC_ALL LIN_F_SUM_EMPTY2, + SPEC_ALL LIN_F_SUM_MOVE1, SPEC_ALL LIN_F_SUM_MOVE2, + SPEC_ALL LIN_F_ADD_SINGLE;; + +let LIN_F_MUL_HD', LIN_F_MUL_EMPTY' = + UNDISCH_ALL (SPEC_ALL LIN_F_MUL_HD), SPEC_ALL LIN_F_MUL_EMPTY;; + +let LIN_F_ADD_SING_RCANCEL', LIN_F_ADD_SING_LCANCEL' = + SPEC_ALL LIN_F_ADD_SING_RCANCEL, SPEC_ALL LIN_F_ADD_SING_LCANCEL;; + + + +(***********************************************) + + +(* Constants *) + +let a1_var_real = `a1:real` and + a2_var_real = `a2:real` and + b1_var_real = `b1:real` and + b2_var_real = `b2:real` and + c1_var_real = `c1:real` and + c2_var_real = `c2:real` and + h_var = `h:real#real` and + r_var = `r:(real#real)list` and + x_var = `x:(real#real)list` and + y_var = `y:(real#real)list` and + t_var = `t:(real#real)list` and + x_var_real = `x:real` and + c1_var = `c1:real` and + c2_var = `c2:real` and + c_var = `c:real` and + v_var = `v:real` and + t1_var = `t1:(real#real)list` and + t2_var = `t2:(real#real)list` and + empty_const = `[]:(real)list`;; + +let ge_op_real = `(>=):real->real->bool`;; + +let cons_const = `CONS:(real#real)->(real#real)list->(real#real)list` and + empty_const = `[]:(real)list`;; + + +(* HACK: for some reason Big_int.big_int_of_int64 is not defined *) +let num_of_int64 n = + let big = Big_int.big_int_of_string (Int64.to_string n) in + Num.num_of_big_int big;; + +(* Term constructors *) +let cons h t = mk_comb (mk_comb (cons_const, h), t);; +let negate tm = mk_comb (neg_op_real, tm);; +let mk_real_int n = mk_comb(amp_op_real, mk_numeral_array n);; +let mk_real_int64 n = mk_comb(amp_op_real, mk_numeral_array (num_of_int64 n));; +let mk_linear cs vars = + let mk_term (c, var) = mk_binop mul_op_real c (mk_var (var, real_ty)) in + list_mk_binop add_op_real (map mk_term (zip cs vars));; + +let mk_le_ineq lhs rhs = mk_binop le_op_real lhs rhs;; +let mk_eq_ineq lhs rhs = mk_eq (lhs, rhs);; +let mk_ge_ineq lhs rhs = mk_binop ge_op_real lhs rhs;; + + + +(************************************************) + +(* Computes (lin_f x + lin_f y) with REAL_BITS_ADD_CONV *) +let lin_f_add_conv tm = + let rec lin_f_add_conv2 x y = + if (is_comb y) then + if (is_comb x) then + let hx = rand (rator x) in + let hy = rand (rator y) in + let c1, v1 = dest_pair hx in + let c2, v2 = dest_pair hy in + + if v1 = v2 then + let tx, ty = rand x, rand y in + let c_thm = my_real_int_add_conv (mk_binop add_op_real c1 c2) in + let c = rand (concl c_thm) in + if (rand(rand c) = zero_const) then + let th0 = INST [v1, v_var; c1, c1_var; tx, t1_var; c2, c2_var; ty, t2_var] + LIN_F_SUM_HD_ZERO' in + TRANS (MY_PROVE_HYP c_thm th0) (lin_f_add_conv2 tx ty) + else + let th0 = INST[v1, v_var; c1, c1_var; tx, t1_var; c2, c2_var; ty, t2_var; c, c_var] + LIN_F_SUM_HD' in + let ltm = rator (rand(concl th0)) in + let th1 = lin_f_add_conv2 tx ty in + let th2 = TRANS (MY_PROVE_HYP c_thm th0) (AP_TERM ltm th1) in + let th3 = INST[mk_pair (c, v1), h_var; rand(rand(concl th1)), t_var] LIN_F_ADD_SINGLE' in + TRANS th2 th3 + else + if (v1 < v2) then + let tx = rand x in + let th0 = INST[hx, h_var; tx, t_var; y, x_var] LIN_F_SUM_MOVE1' in + let ltm = rator (rand(concl th0)) in + let th1 = lin_f_add_conv2 tx y in + let th2 = TRANS th0 (AP_TERM ltm th1) in + let th3 = INST[hx, h_var; rand(rand(concl th1)), t_var] LIN_F_ADD_SINGLE' in + TRANS th2 th3 + else + let ty = rand y in + let th0 = INST[hy, h_var; ty, t_var; x, x_var] LIN_F_SUM_MOVE2' in + let ltm = rator (rand(concl th0)) in + let th1 = lin_f_add_conv2 x ty in + let th2 = TRANS th0 (AP_TERM ltm th1) in + let th3 = INST[hy, h_var; rand(rand(concl th1)), t_var] LIN_F_ADD_SINGLE' in + TRANS th2 th3 + else + (* x = [] *) + INST[y, x_var] LIN_F_SUM_EMPTY1' + else + (* y = [] *) + INST[x, x_var] LIN_F_SUM_EMPTY2' in + + let larg, rarg = dest_comb tm in + let larg = rand larg in + lin_f_add_conv2 (rand larg) (rand rarg);; + + + +(*********************) +(* lin_f conversions *) +(*********************) + + +(* Transforms a sum in the form `a * x + b * y + c * z` into `lin_f [(c,z); (b,y); (a,x)]` *) +let LIN_F_RAW_CONV = ONCE_REWRITE_CONV[TO_LIN_F0] THENC REWRITE_CONV[TO_LIN_F];; + +let LIN_F_ADD_CONV = lin_f_add_conv;; + +(* Transforms a sum into `lin_f` and sorts the terms *) +let LIN_F_CONV = (REWRITE_CONV[TO_LIN_F1] THENC (DEPTH_CONV LIN_F_ADD_CONV));; + + +(* Computes `v * lin_f y` *) + +let rec LIN_F_MUL_CONV tm = + let x, f = dest_binop mul_op_real tm in + let list = rand f in + if (is_comb list) then + let cons_h, t = dest_comb list in + let h = rand cons_h in + let c, v = dest_pair h in + + let product = my_real_int_mul_conv (mk_binop mul_op_real x c) in + let c1 = rand(concl product) in + let th = INST[x, x_var_real; c, c_var; v, v_var; t, t_var; c1, c1_var] LIN_F_MUL_HD' in + let th1 = MY_PROVE_HYP product th in + let lplus, tm = dest_comb(rand(concl th1)) in + let th2 = LIN_F_MUL_CONV tm in + let h = mk_pair (c1, v) in + let t = rand(rand(concl th2)) in + let th3 = TRANS th1 (AP_TERM lplus th2) in + let th4 = INST[h, h_var; t, t_var] LIN_F_ADD_SINGLE' in + TRANS th3 th4 + else + INST[x, x_var_real] LIN_F_MUL_EMPTY';; + + +(* Conversion without numerical multiplication *) +let LIN_F_MUL_RAW_CONV = ONCE_REWRITE_CONV[LIN_F_MUL] THENC REWRITE_CONV[MAP];; + + + +(************************************************) + + +(* Creates an inequality in the correct form *) +let REAL_POS' = SPEC_ALL REAL_POS;; +let REAL_LE_LMUL' = UNDISCH_ALL (REWRITE_RULE[GSYM IMP_IMP] (SPEC_ALL REAL_LE_LMUL));; +let TO_LIN_F1' = SPEC_ALL TO_LIN_F1;; + +let rec lin_f_conv tm = + if is_binary "real_add" tm then + let ltm, rtm = dest_binary "real_add" tm in + let a_tm, x_tm = dest_binary "real_mul" ltm in + let th1 = INST[a_tm, a_var_real; x_tm, x_var_real] TO_LIN_F1' in + let th2 = lin_f_conv rtm in + let eq_th = MK_COMB (AP_TERM add_op_real th1, th2) in + let eq_th2 = lin_f_add_conv (rand (concl eq_th)) in + TRANS eq_th eq_th2 + else + let a_tm, x_tm = dest_binary "real_mul" tm in + INST[a_tm, a_var_real; x_tm, x_var_real] TO_LIN_F1';; + + +let transform_le_ineq (ineq, m) = + let lhs, rhs = dest_binop le_op_real (concl ineq) in + let lhs_f_th = lin_f_conv lhs in + let original_th = EQ_MP (AP_THM (AP_TERM le_op_real lhs_f_th) rhs) ineq in + let lhs = rand(concl lhs_f_th) in + let pos_th = INST[rand m, n_var_num] REAL_POS' in + let th0 = INST[m, x_var_real; lhs, y_var_real; rhs, z_var_real] REAL_LE_LMUL' in + let th1 = MY_PROVE_HYP pos_th th0 in + let th2 = MY_PROVE_HYP original_th th1 in + let lhs, rhs = dest_binop le_op_real (concl th2) in + let lhs_th = LIN_F_MUL_CONV lhs in + let rhs_th = my_real_int_mul_conv rhs in + let th3 = MK_COMB(AP_TERM le_op_real lhs_th, rhs_th) in + EQ_MP th3 th2;; + + +let transform_le_ineq_tm (ineq, m) = + let lhs, rhs = dest_binop le_op_real ineq in + let lhs_f_th = lin_f_conv lhs in + let original_th = EQ_MP (AP_THM (AP_TERM le_op_real lhs_f_th) rhs) (ASSUME ineq) in + let lhs = rand(concl lhs_f_th) in + let pos_th = INST[rand m, n_var_num] REAL_POS' in + let th0 = INST[m, x_var_real; lhs, y_var_real; rhs, z_var_real] REAL_LE_LMUL' in + let th1 = MY_PROVE_HYP pos_th th0 in + let th2 = MY_PROVE_HYP original_th th1 in + let lhs, rhs = dest_binop le_op_real (concl th2) in + let lhs_th = LIN_F_MUL_CONV lhs in + let rhs_th = my_real_int_mul_conv rhs in + let th3 = MK_COMB(AP_TERM le_op_real lhs_th, rhs_th) in + EQ_MP th3 th2;; + + + +(* Computes the sum of two inequalities *) +let REAL_LE_ADD2' = UNDISCH_ALL (REWRITE_RULE[GSYM IMP_IMP] (SPEC_ALL REAL_LE_ADD2));; + +(* Computes the sum of two inequalities (with LIN_F_ADD_CONV and REAL_BITS_ADD_CONV) *) +let add_step' ineq1 ineq2 = + let lhs1, rhs1 = dest_binop le_op_real (concl ineq1) in + let lhs2, rhs2 = dest_binop le_op_real (concl ineq2) in + let th0 = INST [lhs1, w_var_real; rhs1, x_var_real; lhs2, y_var_real; rhs2, z_var_real] + REAL_LE_ADD2' in + let th1 = MY_PROVE_HYP ineq2 (MY_PROVE_HYP ineq1 th0) in + let lhs, rhs = dest_binop le_op_real (concl th1) in + let lhs_th = LIN_F_ADD_CONV lhs in + let rhs_th = my_real_int_add_conv rhs in + EQ_MP (MK_COMB(AP_TERM le_op_real lhs_th, rhs_th)) th1;; + + +(* Computes the sum of lin_f[--c, x;...] and c * x *) +let add_cancel_step ineq var_ineq = + let lhs1, rhs1 = dest_binop le_op_real (concl var_ineq) in + let lhs2, rhs2 = dest_binop le_op_real (concl ineq) in + let th0 = INST[lhs1, w_var_real; rhs1, x_var_real; lhs2, y_var_real; rhs2, z_var_real] + REAL_LE_ADD2' in + let th1 = MY_PROVE_HYP ineq (MY_PROVE_HYP var_ineq th0) in + let ctm, vtm = dest_binop mul_op_real lhs1 in + let ttm = rand(rand lhs2) in + if (rator ctm = neg_op_real) then + let lhs_th = INST[rand ctm, c_var; vtm, v_var; ttm, t_var] LIN_F_ADD_SING_LCANCEL' in + let rhs_th = my_real_int_add_conv (rand(concl th1)) in + EQ_MP (MK_COMB(AP_TERM le_op_real lhs_th, rhs_th)) th1 + else + let lhs_th = INST[ctm, c_var; vtm, v_var; ttm, t_var] LIN_F_ADD_SING_RCANCEL' in + let rhs_th = my_real_int_add_conv (rand(concl th1)) in + EQ_MP (MK_COMB(AP_TERM le_op_real lhs_th, rhs_th)) th1;; + + + +let zero_const_real = `&0`;; + +(* Multiplies a linear inequality by a rational positive constant *) +let mul_rat_step ineq c = + let pos_thm = REAL_ARITH (mk_le_ineq zero_const_real c) in + let hyp = CONJ pos_thm ineq in + let th0 = MATCH_MP REAL_LE_LMUL hyp in + let lhs, rhs = dest_binop le_op_real (concl th0) in + let lhs_th = (LIN_F_MUL_RAW_CONV THENC DEPTH_CONV REAL_RAT_MUL_CONV) lhs in + let rhs_th = REAL_RAT_MUL_CONV rhs in + EQ_MP (MK_COMB (AP_TERM le_op_real lhs_th, rhs_th)) th0;; + + + +(* Multiplies a linear inequality in the form lin_f x <= y by + a positive integer c *) +let mul_step ineq c = + let lhs, rhs = dest_binop le_op_real (concl ineq) in + let pos_th = INST[rand c, n_var_num] REAL_POS' in + let th0 = INST[c, x_var_real; lhs, y_var_real; rhs, z_var_real] REAL_LE_LMUL' in + let th1 = MY_PROVE_HYP pos_th th0 in + let th2 = MY_PROVE_HYP ineq th1 in + let lhs, rhs = dest_binop le_op_real (concl th2) in + let lhs_th = LIN_F_MUL_CONV lhs in + let rhs_th = my_real_int_mul_conv rhs in + let th3 = MK_COMB(AP_TERM le_op_real lhs_th, rhs_th) in + EQ_MP th3 th2;; + + + +(* Transformations for variables *) + +let VAR_MUL_THM = prove(`!x c1 c2 a b v. &0 <= x /\ x * c1 = a /\ x * c2 = b /\ c1 * v <= c2 + ==> a * v <= b`, + REPEAT STRIP_TAC THEN + UNDISCH_TAC `x * c1 = a:real` THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + UNDISCH_TAC `x * c2 = b:real` THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[GSYM REAL_MUL_ASSOC] THEN + MATCH_MP_TAC REAL_LE_LMUL THEN + ASM_REWRITE_TAC[]);; + + +let VAR_MUL_THM' = (UNDISCH_ALL o SPEC_ALL o (REWRITE_RULE[GSYM IMP_IMP])) VAR_MUL_THM;; + +let VAR_ADD_THM = prove(`!x a1 b1 a2 b2 c1 c2. a1 * x <= b1 /\ a2 * x <= b2 /\ + a1 + a2 = c1 /\ b1 + b2 = c2 ==> c1 * x <= c2`, + REPEAT STRIP_TAC THEN + EXPAND_TAC "c1" THEN EXPAND_TAC "c2" THEN + REWRITE_TAC[REAL_ADD_RDISTRIB] THEN + MATCH_MP_TAC REAL_LE_ADD2 THEN + ASM_REWRITE_TAC[]);; + +let VAR_ADD_THM' = (UNDISCH_ALL o SPEC_ALL o (REWRITE_RULE[GSYM IMP_IMP])) VAR_ADD_THM;; + + +(* Multiplies c1 * x <= c2 by m *) +let var1_le_transform (var_ineq, m) = + let lhs, c2tm = dest_binop le_op_real (var_ineq) in + let pos_th = INST[rand m, n_var_num] REAL_POS' in + let c1tm, xtm = dest_binop mul_op_real lhs in + let c1_th = my_real_int_mul_conv (mk_binop mul_op_real m c1tm) in + let c2_th = my_real_int_mul_conv (mk_binop mul_op_real m c2tm) in + let th = INST[m, x_var_real; c1tm, c1_var; c2tm, c2_var; xtm, v_var; + rand(concl c1_th), a_var_real; rand(concl c2_th), b_var_real] + VAR_MUL_THM' in + MY_PROVE_HYP pos_th (MY_PROVE_HYP (ASSUME var_ineq) (MY_PROVE_HYP c1_th (MY_PROVE_HYP c2_th th)));; + + +(* Sums two inequalities *) +let add_le_ineqs ineq1 ineq2 = + let lhs1, b1tm = dest_binop le_op_real (concl ineq1) in + let lhs2, b2tm = dest_binop le_op_real (concl ineq2) in + let a1tm, xtm = dest_binop mul_op_real lhs1 in + let a2tm = rand(rator lhs2) in + let b_th = my_real_int_add_conv (mk_binop add_op_real b1tm b2tm) in + let a_th = my_real_int_add_conv (mk_binop add_op_real a1tm a2tm) in + let th0 = INST[a1tm, a1_var_real; a2tm, a2_var_real; + b1tm, b1_var_real; b2tm, b2_var_real; + rand(concl a_th), c1_var_real; rand(concl b_th), c2_var_real; + xtm, x_var_real] VAR_ADD_THM' in + MY_PROVE_HYP ineq2 (MY_PROVE_HYP ineq1 (MY_PROVE_HYP b_th (MY_PROVE_HYP a_th th0)));; + + + +(* Multiplies the corresponding inequalities and finds the sum of results *) +let var2_le_transform (var_ineq1,m1) (var_ineq2,m2) = + let ineq1 = var1_le_transform (var_ineq1, m1) and + ineq2 = var1_le_transform (var_ineq2, m2) in + let lhs1, b1tm = dest_binop le_op_real (concl ineq1) in + let lhs2, b2tm = dest_binop le_op_real (concl ineq2) in + let a1tm, xtm = dest_binop mul_op_real lhs1 in + let a2tm = rand(rator lhs2) in + let b_th = my_real_int_add_conv (mk_binop add_op_real b1tm b2tm) in + let a_th = my_real_int_add_conv (mk_binop add_op_real a1tm a2tm) in + let th0 = INST[a1tm, a1_var_real; a2tm, a2_var_real; + b1tm, b1_var_real; b2tm, b2_var_real; + rand(concl a_th), c1_var_real; rand(concl b_th), c2_var_real; + xtm, x_var_real] VAR_ADD_THM' in + MY_PROVE_HYP ineq2 (MY_PROVE_HYP ineq1 (MY_PROVE_HYP b_th (MY_PROVE_HYP a_th th0)));; + + + + + +(* The main function *) +(* Example: prove_lp ineqs var_ineqs target_vars `&12` (Int 100000) *) +(* ineq - inequalities obtained from constraints with multipliers *) +(* var_ineqs - bounds for variables as inequalities in the correct form *) +(* target_vars - bounds and multipliers for variables in the objective function *) +(* bound - a bound for the objective function which is proved *) +(* m - a precision constant *) + + +let LIN_F_EMPTY_LE_0 = prove(`lin_f [] <= &0`, REWRITE_TAC[LIN_F_EMPTY; REAL_LE_REFL]);; +let dummy = REWRITE_RULE[GSYM NUM_ZERO] LIN_F_EMPTY_LE_0;; + + +let prove_lp_tm ineqs var_ineqs target_vars target_bound precision_constant = + (* Compute the sum of all constraints *) + let r1 = map transform_le_ineq_tm ineqs in + let r2' = List.fold_left add_step' dummy r1 in + let r2 = mul_step r2' (mk_real_int precision_constant) in + + (* Use bounds of variables *) + let r3 = List.fold_left add_cancel_step r2 var_ineqs in + let r4 = List.fold_left add_step' dummy (map transform_le_ineq_tm target_vars) in + let r5 = add_step' r3 r4 in + + (* Convert the result into a usual form *) + let r6 = CONV_RULE (DEPTH_CONV NUM_TO_NUMERAL_CONV) r5 in + let m = term_of_rat (precision_constant */ precision_constant */ precision_constant) in + let r7 = mul_rat_step r6 (mk_comb (`(/) (&1)`, m)) in + let r8 = REWRITE_RULE[lin_f; ITLIST; REAL_ADD_RID] r7 in + let r9 = EQT_ELIM (REAL_RAT_LE_CONV (mk_binop le_op_real ((rand o concl) r8) target_bound)) in + MATCH_MP REAL_LE_TRANS (CONJ r8 r9);; + + +let prove_lp ineqs var_ineqs target_vars target_bound precision_constant = + (* Compute the sum of all constraints *) + let r1 = map transform_le_ineq ineqs in + let r2' = List.fold_left add_step' dummy r1 in + let r2 = mul_step r2' (mk_real_int precision_constant) in + + (* Use bounds of variables *) + let r3 = List.fold_left add_cancel_step r2 var_ineqs in + let r4 = List.fold_left add_step' dummy (map transform_le_ineq target_vars) in + let r5 = add_step' r3 r4 in + + (* Convert the result into a usual form *) + let r6 = CONV_RULE (DEPTH_CONV NUM_TO_NUMERAL_CONV) r5 in + let m = term_of_rat (precision_constant */ precision_constant */ precision_constant) in + let r7 = mul_rat_step r6 (mk_comb (`(/) (&1)`, m)) in + let r8 = REWRITE_RULE[lin_f; ITLIST; REAL_ADD_RID] r7 in + let r9 = EQT_ELIM (REAL_RAT_LE_CONV (mk_binop le_op_real ((rand o concl) r8) target_bound)) in + MATCH_MP REAL_LE_TRANS (CONJ r8 r9);; + +end;; diff --git a/formal_lp/old/arith/arith_array.hl b/formal_lp/old/arith/arith_array.hl new file mode 100644 index 0000000..50cafce --- /dev/null +++ b/formal_lp/old/arith/arith_array.hl @@ -0,0 +1,1849 @@ +module type Arith_hash_sig = + sig + val num_def : thm + val NUM_THM : thm + val num_const : term + val const_array : term array + val def_array: thm array + val def_thm_array: thm array + val mk_numeral_hash : num -> term + val mk_numeral_array : num -> term + val mk_small_numeral_array : int -> term + val raw_dest_hash : term -> num + val dest_numeral_hash : term -> num + val NUMERAL_TO_NUM_CONV : term -> thm + val NUM_TO_NUMERAL_CONV : term -> thm + val raw_suc_conv_hash : term -> thm + val NUM_SUC_HASH_CONV : term -> thm + val raw_eq0_hash_conv : term -> thm + val NUM_EQ0_HASH_CONV : term -> thm + val raw_pre_hash_conv : term -> thm + val NUM_PRE_HASH_CONV : term -> thm + val raw_gt0_hash_conv : term -> thm + val NUM_GT0_HASH_CONV : term -> thm + val raw_lt_hash_conv : term -> thm + val raw_le_hash_conv : term -> thm + val NUM_LT_HASH_CONV : term -> thm + val NUM_LE_HASH_CONV : term -> thm + val raw_add_conv_hash : term -> thm + val NUM_ADD_HASH_CONV : term -> thm + val raw_sub_hash_conv : term -> thm + val raw_sub_and_le_hash_conv : term -> term -> thm * thm + val NUM_SUB_HASH_CONV : term -> thm + val raw_mul_conv_hash : term -> thm + val NUM_MULT_HASH_CONV : term -> thm + val raw_div_hash_conv : term -> thm + val NUM_DIV_HASH_CONV : term -> thm + + val raw_even_hash_conv : term -> thm + val raw_odd_hash_conv : term -> thm + val NUM_EVEN_HASH_CONV : term -> thm + val NUM_ODD_HASH_CONV : term -> thm +end;; + +(* Dependencies *) +needs "../formal_lp/arith/misc.hl";; +needs "../formal_lp/arith/arith_options.hl";; + +module Arith_hash : Arith_hash_sig = struct + +open Arith_misc;; +open Arith_options;; + +let maximum = base;; + +(******************) + +(* Generate definitions and constants *) + +let num_type = `:num`;; +let fnum_type = `:num->num`;; + +let numeral_const = `NUMERAL` and + zero_const = `_0` and + bit0_const = `BIT0` and + bit1_const = `BIT1` and + truth_const = `T` and + false_const = `F`;; + +let m_var_num = `m:num` and + n_var_num = `n:num` and + t_var_num = `t:num` and + r_var_num = `r:num` and + p_var_num = `p:num` and + q_var_num = `q:num`;; + +let suc_const = `SUC` and + plus_op_num = `(+):num->num->num` and + minus_op_num = `(-):num->num->num` and + mul_op_num = `( * ):num->num->num` and + div_op_num = `(DIV):num->num->num` and + le_op_num = `(<=):num->num->bool` and + lt_op_num = `(<):num->num->bool`;; + + +let plus_op_real = `(+):real->real->real` and + mul_op_real = `( * ):real->real->real`;; + + + +let names_array = Array.init maximum (fun i -> "D"^(string_of_int i));; + + +(* Definitions *) + +let num_name = "NUM"^(string_of_int base);; +let num_def = new_basic_definition (mk_eq(mk_var(num_name, fnum_type), numeral_const));; +let num_const = mk_const(num_name, []);; +let num_def_sym = SYM num_def;; +let NUM_THM = prove(mk_eq(mk_comb(num_const, n_var_num), n_var_num), + REWRITE_TAC[num_def; NUMERAL]);; + + + +(* B_i(n) = i + B_0(n) *) +let mk_bit_definition i = + let lhs = mk_var (names_array.(i), fnum_type) in + let tm1 = mk_binop mul_op_num (mk_small_numeral base) n_var_num in + let tm2 = mk_binop plus_op_num tm1 (mk_small_numeral i) in + let rhs = mk_abs (n_var_num, tm2) in + new_basic_definition (mk_eq (lhs, rhs));; + + + +let def_basic_array = Array.init maximum mk_bit_definition;; +let def_array = Array.init maximum (fun i -> + let basic = def_basic_array.(i) in + let th1 = AP_THM basic n_var_num in + TRANS th1 (BETA (rand (concl th1))));; + +(* Index computation *) + +let get_index = + let zero_index = int_of_char '0' in + let rec index str len i acc = + if i >= len then acc else + let ch = int_of_char (String.get str i) - zero_index in + index str len (i + 1) (acc * 10 + ch) in + fun tm -> + let str = (fst o dest_const) tm in + index str (String.length str) 1 0;; + + + +let def_table = Hashtbl.create maximum;; +let def_basic_table = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + let _ = Hashtbl.add def_table names_array.(i) def_array.(i) in + Hashtbl.add def_basic_table names_array.(i) def_basic_array.(i) +done;; + + +(* Constants *) + + +let const_array = Array.init maximum (fun i -> mk_const(names_array.(i),[]));; + +let b0_def = def_array.(0);; +let b0_const = const_array.(0);; +let b0_name = names_array.(0);; + +let max_const = mk_small_numeral maximum;; + + + +(* Alternative definition of B_i *) + +let ADD_0_n = prove(`_0 + n = n`, + ONCE_REWRITE_TAC[GSYM NUMERAL] THEN + REWRITE_TAC[GSYM ARITH_ADD; ADD_CLAUSES]);; +let ADD_n_0 = prove(`n + _0 = n`, + ONCE_REWRITE_TAC[GSYM NUMERAL] THEN + REWRITE_TAC[GSYM ARITH_ADD; ADD_CLAUSES]);; + +let MUL_n_0 = prove(`n * _0 = 0`, + REWRITE_TAC[NUMERAL] THEN + SUBGOAL_THEN `_0 = 0` MP_TAC THENL [ REWRITE_TAC[NUMERAL]; ALL_TAC ] THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th]) THEN + ARITH_TAC);; + + +(* B_i(n) = i + B_0(n) *) +let def_thm i = + let bin = mk_comb(const_array.(i), n_var_num) in + let bi0 = mk_comb(const_array.(i), zero_const) in + let b0n = mk_comb(const_array.(0), n_var_num) in + let rhs = mk_binop plus_op_num bi0 b0n in + prove(mk_eq(bin, rhs), REWRITE_TAC[def_array.(i); def_array.(0)] THEN + REWRITE_TAC[MUL_n_0; ADD_CLAUSES] THEN ARITH_TAC);; + + +let def_thm_array = Array.init maximum def_thm;; + + +let B0_0 = prove(mk_eq(mk_comb(b0_const, zero_const), zero_const), + REWRITE_TAC[b0_def; MUL_n_0; ADD_CLAUSES; NUMERAL]);; + + + +let B0_EXPLICIT = prove(mk_eq(mk_comb(b0_const, n_var_num), + mk_binop mul_op_num max_const n_var_num), + REWRITE_TAC[b0_def; ADD_CLAUSES]);; + + + + +(******************************) + +(* mk_numeral and dest_numeral *) + + +(* mk_table *) + +let mk_table = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + Hashtbl.add mk_table (Int i) const_array.(i) +done;; + + +(* mk_numeral *) +let max_num = Int maximum;; + + +let mk_numeral_hash = + let rec mk_num n = + if (n =/ num_0) then + zero_const + else + let m = mod_num n max_num in + let bit = Hashtbl.find mk_table m in + mk_comb(bit, mk_num(quo_num n max_num)) in + fun n -> if n if n if n < 0 then failwith "mk_small_numeral_array: negative argument" + else mk_comb (num_const, mk_num n);; + + + +(* +(* 10: 1.232 *) +test 10000 mk_numeral_hash (Int 65535);; (* 0.736 *) +(* 10: 1.216 *) +test 10000 mk_numeral_array (Int 65535);; (* 0.728 *) +(* 10: 0.272 *) +test 100000 mk_small_numeral_array 65535;; (* 0.216 *) +(* 10: 0.316 *) +test 1000 mk_numeral_array (num_of_string "9111111111111111");; (* 0.288 *) +*) + + + + +(* dest_table *) + +let dest_table_num = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + Hashtbl.add dest_table_num names_array.(i) (Int i) +done;; + +let dest_array_num = Array.init maximum (fun i -> Num.num_of_int i);; + + +(* dest_numeral *) + +let max_num = Int maximum;; + + +let rec raw_dest_hash tm = + if tm = zero_const then + num_0 + else + let l, r = dest_comb tm in + let n = max_num */ raw_dest_hash r in + let cn = fst(dest_const l) in + n +/ (Hashtbl.find dest_table_num cn);; + + +let rec raw_dest_array tm = + if tm = zero_const then + num_0 + else + let l, r = dest_comb tm in + let n = max_num */ raw_dest_array r in + n +/ dest_array_num.(get_index l);; + + +let dest_numeral_hash tm = raw_dest_hash (rand tm);; +let dest_numeral_array tm = raw_dest_array (rand tm);; + +let tm = mk_numeral_array (Int 11111111);; + +dest_numeral_array tm;; + + +(* 10: 0.852 *) +(* 100: 0.520 *) +test 100000 dest_numeral_array (mk_numeral_array (Int 11111111));; + + + + + +(******************************) + +(* NUMERAL_TO_NUM_CONV: coverts usual HOL numerals into k-bit numerals *) + + +let th_num_conv = Array.init maximum (fun i -> (SYM o SPEC_ALL) def_array.(i));; +let mod_op_num = `MOD`;; +let zero = `0`;; + + +let DIV_BASE = + let h1 = mk_eq(mk_binop div_op_num m_var_num max_const, q_var_num) in + let h2 = mk_eq(mk_binop mod_op_num m_var_num max_const, r_var_num) in + let c = mk_eq(m_var_num, mk_binop plus_op_num (mk_binop mul_op_num max_const q_var_num) r_var_num) in + (UNDISCH_ALL o ARITH_RULE) (mk_imp(h1, mk_imp(h2, c)));; + + +let ZERO_EQ_ZERO = (EQT_ELIM o REWRITE_CONV[NUMERAL]) `0 = _0`;; +let SYM_ZERO_EQ_ZERO = SYM ZERO_EQ_ZERO;; +let SYM_NUM_THM = SYM NUM_THM;; + + + +let NUMERAL_TO_NUM_CONV tm = + let rec raw_conv tm = + if (rand tm = zero_const) then + ZERO_EQ_ZERO + else + let th_div = NUM_DIV_CONV (mk_binop div_op_num tm max_const) in + let th_mod = NUM_MOD_CONV (mk_binop mod_op_num tm max_const) in + let q_tm = rand(concl th_div) in + let r_tm = rand(concl th_mod) in + let th0 = INST[tm, m_var_num; q_tm, q_var_num; r_tm, r_var_num] DIV_BASE in + let th1 = MY_PROVE_HYP th_mod (MY_PROVE_HYP th_div th0) in + let r = dest_small_numeral r_tm in + let th2 = INST[q_tm, n_var_num] th_num_conv.(r) in + let th = TRANS th1 th2 in + let ltm, rtm = dest_comb(rand(concl th)) in + let r_th = raw_conv rtm in + TRANS th (AP_TERM ltm r_th) in + + if (fst o dest_const o rator) tm <> "NUMERAL" then + failwith "NUMERAL_TO_NUM_CONV" + else + let th0 = raw_conv tm in + let n_tm = rand(concl th0) in + TRANS th0 (INST[n_tm, n_var_num] SYM_NUM_THM);; + + +(* +(* 100: 2.588 *) +test 100 NUMERAL_TO_NUM_CONV `100034242430`;; +*) + + + +let replace_numerals = rand o concl o DEPTH_CONV NUMERAL_TO_NUM_CONV;; +let REPLACE_NUMERALS = CONV_RULE (DEPTH_CONV NUMERAL_TO_NUM_CONV);; + + + +(* NUM_TO_NUMERAL_CONV *) + + +let NUM_TO_NUMERAL_CONV tm = + let rec raw_conv tm = + if tm = zero_const then + SYM_ZERO_EQ_ZERO + else + let b_tm, n_tm = dest_comb tm in + let n_th = raw_conv n_tm in + let n_tm' = rand(concl n_th) in + let cb = (fst o dest_const) b_tm in + let th0 = Hashtbl.find def_table cb in + let th1 = AP_TERM b_tm n_th in + let th2 = TRANS th1 (INST[n_tm', n_var_num] th0) in + let ltm, rtm = dest_comb(rand(concl th2)) in + let mul_th = NUM_MULT_CONV (rand ltm) in + let add_th0 = AP_THM (AP_TERM plus_op_num mul_th) rtm in + let add_th = TRANS add_th0 (NUM_ADD_CONV (rand(concl add_th0))) in + TRANS th2 add_th in + let ltm, rtm = dest_comb tm in + if (fst o dest_const) ltm <> num_name then + failwith "NUM_TO_NUMERAL_CONV" + else + let num_th = INST[rtm, n_var_num] NUM_THM in + let th0 = raw_conv rtm in + TRANS num_th th0;; + + + + + +(*************************) + +(* SUC_CONV *) + +let suc_const = `SUC`;; + +(* Theorems *) + +let SUC_NUM = prove(mk_eq(mk_comb(suc_const, mk_comb (num_const, n_var_num)), + mk_comb(num_const, mk_comb (suc_const, n_var_num))), + REWRITE_TAC[num_def; NUMERAL]);; + +let SUC_0 = prove(mk_eq(`SUC _0`, mk_comb (const_array.(1), zero_const)), + REWRITE_TAC[def_array.(1); MUL_n_0; ARITH_SUC; NUMERAL; ARITH_ADD]);; + + +let suc_th i = + let cflag = (i + 1 >= maximum) in + let suc = if (cflag) then 0 else i + 1 in + let lhs = mk_comb(suc_const, (mk_comb (const_array.(i), n_var_num))) in + let rhs = mk_comb(const_array.(suc), + if (cflag) then mk_comb(suc_const, n_var_num) else n_var_num) in + let proof = REWRITE_TAC [def_array.(i); def_array.(suc)] THEN ARITH_TAC in + prove(mk_eq(lhs, rhs), proof);; + + +let th_suc_array = Array.init maximum suc_th;; + +let th_suc_table = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + Hashtbl.add th_suc_table names_array.(i) th_suc_array.(i) +done;; + +let SUC_MAX = th_suc_array.(maximum - 1);; +let bit_max_name = names_array.(maximum - 1);; + + +(* Conversion *) + +let rec raw_suc_conv_hash tm = + let otm = rand tm in + if (otm = zero_const) then + SUC_0 + else + let btm, ntm = dest_comb otm in + let cn = fst(dest_const btm) in + if (cn = bit_max_name) then + let th = INST [ntm, n_var_num] SUC_MAX in + let ltm, rtm = dest_comb(rand(concl th)) in + TRANS th (AP_TERM ltm (raw_suc_conv_hash rtm)) + else + INST [ntm, n_var_num] (Hashtbl.find th_suc_table cn);; + + +let rec raw_suc_conv_array tm = + let otm = rand tm in + if (otm = zero_const) then + SUC_0 + else + let btm, ntm = dest_comb otm in + let cn = fst(dest_const btm) in + if (cn = bit_max_name) then + let th = INST [ntm, n_var_num] SUC_MAX in + let ltm, rtm = dest_comb(rand(concl th)) in + TRANS th (AP_TERM ltm (raw_suc_conv_hash rtm)) + else + INST [ntm, n_var_num] (th_suc_array.(get_index btm));; + + + +let NUM_SUC_HASH_CONV tm = + let ntm = rand (rand tm) in + let th = INST [ntm, n_var_num] SUC_NUM in + let lhs, rhs = dest_eq(concl th) in + if (lhs <> tm) then failwith("NUM_SUC_HASH_CONV") + else + let ltm, rtm = dest_comb rhs in + TRANS th (AP_TERM ltm (raw_suc_conv_hash rtm));; + + + + + + +let x = mk_comb(suc_const, mk_small_numeral_array 99999);; +NUM_SUC_HASH_CONV x;; +(* 10: 1.488 *) +test 50000 NUM_SUC_HASH_CONV x;; (* 5: 0.980 *) + +let x = mk_comb(suc_const, rand (mk_small_numeral_array 999999));; +(* 100: 0.668 *) +test 50000 raw_suc_conv_hash x;; +(* 100: 0.672 *) +test 50000 raw_suc_conv_array x;; + + + +(**************************************) + +(* EQ_0_CONV *) + +let EQ_0_NUM = prove(mk_eq(mk_eq(mk_comb(num_const, n_var_num), `_0`), `n = _0`), + REWRITE_TAC[num_def; NUMERAL]);; + +let EQ_B0_0 = prove(mk_eq(mk_eq(mk_comb(b0_const, n_var_num), `_0`), `n = _0`), + REWRITE_TAC[b0_def; ADD_CLAUSES; NUMERAL; REWRITE_RULE[NUMERAL] MULT_EQ_0; ARITH_EQ]);; + +let EQ_0_0 = prove(`_0 = _0 <=> T`, REWRITE_TAC[ARITH_EQ]);; + +let eq_0_lemma = REWRITE_RULE[NUMERAL] (ARITH_RULE `a + b = 0 <=> a = 0 /\ b = 0`);; + +let eq_0_i i = + let concl = mk_eq(mk_eq(mk_comb(const_array.(i), n_var_num), zero_const), false_const) in + prove(concl, REWRITE_TAC[def_array.(i); eq_0_lemma; NUMERAL; ARITH_EQ]);; + +let th_eq0_array = Array.init maximum (fun i -> if (i = 0) then EQ_0_0 else eq_0_i i);; + +let th_eq0_table = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + Hashtbl.add th_eq0_table names_array.(i) th_eq0_array.(i) +done;; + + + +let rec raw_eq0_hash_conv rtm = + if (rtm = zero_const) then + EQ_0_0 + else + let b_tm, n_tm = dest_comb rtm in + let cn = (fst o dest_const) b_tm in + if (cn = b0_name) then + let th0 = INST[n_tm, n_var_num] EQ_B0_0 in + let th1 = raw_eq0_hash_conv n_tm in + TRANS th0 th1 + else + INST[n_tm, n_var_num] (Hashtbl.find th_eq0_table cn);; + + + +let NUM_EQ0_HASH_CONV rtm = + let n_tm = rand rtm in + let th = INST [n_tm, n_var_num] EQ_0_NUM in + TRANS th (raw_eq0_hash_conv n_tm);; + + +(* +let x = mk_small_numeral_array 0;; +NUM_EQ0_HASH_CONV x;; +raw_eq0_hash_conv `B0 (B0 _0)`;; +*) + + +(**************************************) + +(* PRE_CONV *) + +let pre_const = `PRE`;; + +(* Theorems *) + +let PRE_NUM = prove(mk_eq(mk_comb(pre_const, mk_comb (num_const, n_var_num)), + mk_comb(num_const, mk_comb (pre_const, n_var_num))), + REWRITE_TAC[num_def; NUMERAL]);; + + +let PRE_0 = prove(`PRE _0 = _0`, + MP_TAC (CONJUNCT1 PRE) THEN SIMP_TAC[NUMERAL]);; + +let PRE_B1_0 = prove(mk_eq(mk_comb(`PRE`, mk_comb(const_array.(1), `_0`)), `_0`), + REWRITE_TAC[def_array.(1); MUL_n_0; ARITH_ADD; NUMERAL; ARITH_PRE; ARITH_EQ]);; + + +let PRE_B0_n0 = (UNDISCH_ALL o prove)(mk_imp(`n = _0 <=> T`, + mk_eq(mk_comb(`PRE`, mk_comb(b0_const, `n:num`)), `_0`)), + REWRITE_TAC[B0_EXPLICIT] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; MUL_n_0]) THEN + REWRITE_TAC[NUMERAL; ARITH_PRE]);; + + +let PRE_B0_n1 = (UNDISCH_ALL o PURE_REWRITE_RULE[NUMERAL] o prove)(mk_imp(`n = 0 <=> F`, + mk_eq(mk_comb(`PRE`, mk_comb(b0_const, `n:num`)), + mk_comb(const_array.(maximum - 1), `PRE n`))), + REWRITE_TAC[B0_EXPLICIT; def_array.(maximum - 1)] THEN ARITH_TAC);; + + +let PRE_lemma = (UNDISCH_ALL o PURE_REWRITE_RULE[NUMERAL] o ARITH_RULE) `((n = 0) <=> F) ==> (SUC m = n <=> PRE n = m)`;; + + +let pre_th i = + let pre = i - 1 in + let pre_tm = mk_comb(const_array.(pre), n_var_num) in + let suc_tm = mk_comb(suc_const, pre_tm) in + let suc_th = raw_suc_conv_hash suc_tm in + let n_tm = rand(concl suc_th) in + let n0_th = raw_eq0_hash_conv n_tm in + let th0 = INST[pre_tm, m_var_num; n_tm, n_var_num] PRE_lemma in + MY_PROVE_HYP n0_th (EQ_MP th0 suc_th);; + + + + +let th_pre_array = Array.init maximum (fun i -> if i = 0 then REFL `_0` else pre_th i);; + +let th_pre_table = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + Hashtbl.add th_pre_table names_array.(i) th_pre_array.(i) +done;; + + +(* Conversion *) +let b1_name = names_array.(1);; +let b1_pre_thm = th_pre_array.(1);; + +let rec raw_pre_hash_conv tm = + let otm = rand tm in + if (otm = zero_const) then + PRE_0 + else + let btm, ntm = dest_comb otm in + let cn = fst(dest_const btm) in + if (cn = b0_name) then + let n_th = raw_eq0_hash_conv ntm in + if (rand(concl n_th) = false_const) then + let th0 = INST[ntm, n_var_num] PRE_B0_n1 in + let th1 = MY_PROVE_HYP n_th th0 in + let ltm, rtm = dest_comb(rand(concl th1)) in + let th2 = raw_pre_hash_conv rtm in + TRANS th1 (AP_TERM ltm th2) + else + let th = INST[ntm, n_var_num] PRE_B0_n0 in + MY_PROVE_HYP n_th th + else + if (cn = b1_name) then + if (ntm = zero_const) then + PRE_B1_0 + else + INST[ntm, n_var_num] b1_pre_thm + else + INST [ntm, n_var_num] (Hashtbl.find th_pre_table cn);; + + + +let NUM_PRE_HASH_CONV tm = + let ntm = rand (rand tm) in + let th = INST [ntm, n_var_num] PRE_NUM in + let lhs, rhs = dest_eq(concl th) in + if (lhs <> tm) then failwith("NUM_PRE_HASH_CONV") + else + let ltm, rtm = dest_comb rhs in + TRANS th (AP_TERM ltm (raw_pre_hash_conv rtm));; + + +(* +let x = mk_comb(pre_const, mk_small_numeral_array 100000);; +NUM_PRE_HASH_CONV x;; +(* 10: 0.488; 100: 0.200 *) +test 5000 NUM_PRE_HASH_CONV x;; +let x = mk_comb(pre_const, mk_small_numeral_array 65536);; +(* 10: 0.468; 100: 0.496 *) +test 50000 NUM_PRE_HASH_CONV x;; +*) + + + + +(**************************************) + +(* GT0_CONV *) + + +let gt0_table = Hashtbl.create maximum;; + +let GT0_NUM = (REWRITE_RULE[GSYM num_def] o prove)(`0 < NUMERAL n <=> _0 < n`, REWRITE_TAC[NUMERAL]);; + +let gt0_0 = prove(`_0 < _0 <=> F`, REWRITE_TAC[ARITH_LT]);; +let gt0_b0 = (REWRITE_RULE[NUMERAL] o prove)(mk_eq (mk_binop lt_op_num `0` (mk_comb(b0_const, n_var_num)), `0 < n`), + REWRITE_TAC[b0_def] THEN ARITH_TAC);; + + +let zero = `0`;; + +let gt0_th i = + let bi = const_array.(i) in + let concl = mk_eq (mk_binop lt_op_num zero (mk_comb(bi, n_var_num)), truth_const) in + let proof = REWRITE_TAC[def_array.(i)] THEN ARITH_TAC in + (PURE_REWRITE_RULE[NUMERAL] o prove)(concl, proof);; + + +for i = 1 to maximum - 1 do + Hashtbl.add gt0_table names_array.(i) (gt0_th i) +done;; + + +let rec raw_gt0_hash_conv rtm = + if (rtm = zero_const) then + gt0_0 + else + let b_tm, n_tm = dest_comb rtm in + let cn = (fst o dest_const) b_tm in + if (cn = b0_name) then + let th0 = INST[n_tm, n_var_num] gt0_b0 in + let th1 = raw_gt0_hash_conv n_tm in + TRANS th0 th1 + else + INST[n_tm, n_var_num] (Hashtbl.find gt0_table cn);; + + + +let NUM_GT0_HASH_CONV rtm = + let n_tm = rand rtm in + let th = INST [n_tm, n_var_num] GT0_NUM in + TRANS th (raw_gt0_hash_conv n_tm);; + + + + +(* +let tm = mk_binop lt_op_num (mk_small_numeral_array 0) (mk_small_numeral_array 100000);; +NUM_GT0_HASH_CONV (rand tm);; +(* 10: 0.232 *) +test 10000 NUM_GT0_HASH_CONV (rand tm);; +*) + + + +(*************************************) + +(* LT and LE *) + +let LT_NUM = (REWRITE_RULE[SYM num_def] o prove)(`NUMERAL m < NUMERAL n <=> m < n`, REWRITE_TAC[NUMERAL]);; +let LE_NUM = (REWRITE_RULE[SYM num_def] o prove)(`NUMERAL m <= NUMERAL n <=> m <= n`, REWRITE_TAC[NUMERAL]);; + +let LT_n_0 = prove(`n < _0 <=> F`, + SUBGOAL_THEN `_0 = 0` MP_TAC THENL [ REWRITE_TAC[NUMERAL]; ALL_TAC ] THEN + DISCH_THEN (fun th -> PURE_ONCE_REWRITE_TAC[th]) THEN + ARITH_TAC);; + +let LE_0_n = prove(`_0 <= n <=> T`, + SUBGOAL_THEN `_0 = 0` MP_TAC THENL [ REWRITE_TAC[NUMERAL]; ALL_TAC ] THEN + DISCH_THEN (fun th -> PURE_ONCE_REWRITE_TAC[th]) THEN + ARITH_TAC);; + +let SUC_LT_THM = ARITH_RULE `SUC m < SUC n <=> m < n`;; +let SUC_LE_THM = ARITH_RULE `SUC m <= SUC n <=> m <= n`;; + + + +(* LT tables *) + +(* Generates the theorem |- _0 < bi(n) <=> T (or |- _0 < b0(n) <=> _0 < n) *) +let gen_0_lt_bi i = + let bin = mk_comb (const_array.(i), n_var_num) in + let lt_tm = mk_binop lt_op_num zero bin in + if i > 0 then + (PURE_REWRITE_RULE[NUMERAL] o EQT_INTRO o prove)(lt_tm, REWRITE_TAC[def_array.(i)] THEN ARITH_TAC) + else + (PURE_REWRITE_RULE[NUMERAL] o prove)(mk_eq(lt_tm, `0 < n`), REWRITE_TAC[B0_EXPLICIT] THEN ARITH_TAC);; + + +let th_lt0_table = Hashtbl.create maximum;; +for i = 0 to maximum - 1 do + let th = gen_0_lt_bi i in + let name = names_array.(i) in + Hashtbl.add th_lt0_table name th +done;; + + + + +(* Generates the theorem |- bi(m) < bj(n) <=> m <= n (or m < n) *) + +let gen_bi_lt_bj i j = + let bim = mk_comb (const_array.(i), m_var_num) in + let bjn = mk_comb (const_array.(j), n_var_num) in + let lt_tm = mk_binop lt_op_num bim bjn in + let rhs = + if i >= j then + mk_binop lt_op_num m_var_num n_var_num + else + mk_binop le_op_num m_var_num n_var_num in + prove(mk_eq(lt_tm, rhs), REWRITE_TAC[def_array.(i); def_array.(j)] THEN ARITH_TAC);; + + + +(* Given a theorem |- bi(m) < bj(n) <=> P m n, generates the theorem + |- SUC(bi(m)) < SUC(bj(n)) <=> P m n *) +let gen_next_lt_thm th = + let ltm, n_tm = (dest_comb o lhand o concl) th in + let m_tm = rand ltm in + let th0 = INST[m_tm, m_var_num; n_tm, n_var_num] SUC_LT_THM in + let suc_m = raw_suc_conv_hash (mk_comb (suc_const, m_tm)) in + let suc_n = raw_suc_conv_hash (mk_comb (suc_const, n_tm)) in + let th1 = SYM (MK_COMB ((AP_TERM lt_op_num suc_m), suc_n)) in + TRANS (TRANS th1 th0) th;; + + +let th_lt_table = Hashtbl.create (maximum * maximum);; + + +for i = 0 to maximum - 1 do + let th = ref (gen_bi_lt_bj 0 i) in + let name_left = names_array.(0) and + name_right = names_array.(i) in + let _ = Hashtbl.add th_lt_table (name_left ^ name_right) !th in + + for k = 1 to maximum - i - 1 do + let x = k and y = i + k in + let name_left = names_array.(x) and + name_right = names_array.(y) in + th := gen_next_lt_thm (!th); + Hashtbl.add th_lt_table (name_left ^ name_right) !th + done; +done;; + + +for i = 1 to maximum - 1 do + let th = ref (gen_bi_lt_bj i 0) in + let name_left = names_array.(i) and + name_right = names_array.(0) in + let _ = Hashtbl.add th_lt_table (name_left ^ name_right) !th in + + for k = 1 to maximum - i - 1 do + let x = i + k and y = k in + let name_left = names_array.(x) and + name_right = names_array.(y) in + th := gen_next_lt_thm (!th); + Hashtbl.add th_lt_table (name_left ^ name_right) !th + done; +done;; + + + + +(* LE tables *) + +(* Generates the theorem |- bi(n) <= _0 <=> F (or |- b0(n) <= _0 <=> n <= _0) *) +let gen_bi_le_0 i = + let bin = mk_comb (const_array.(i), n_var_num) in + let lt_tm = mk_binop le_op_num bin zero in + if i > 0 then + (PURE_REWRITE_RULE[NUMERAL] o prove)(mk_eq(lt_tm, false_const), REWRITE_TAC[def_array.(i)] THEN ARITH_TAC) + else + (PURE_REWRITE_RULE[NUMERAL] o prove)(mk_eq(lt_tm, `n <= 0`), REWRITE_TAC[B0_EXPLICIT] THEN ARITH_TAC);; + + + +let th_le0_table = Hashtbl.create maximum;; +for i = 0 to maximum - 1 do + let th = gen_bi_le_0 i in + let name = names_array.(i) in + Hashtbl.add th_le0_table name th +done;; + + + + +(* Generates the theorem |- bi(m) <= bj(n) <=> m <= n (or m < n) *) +let gen_bi_le_bj i j = + let bim = mk_comb (const_array.(i), m_var_num) in + let bjn = mk_comb (const_array.(j), n_var_num) in + let lt_tm = mk_binop le_op_num bim bjn in + let rhs = + if i > j then + mk_binop lt_op_num m_var_num n_var_num + else + mk_binop le_op_num m_var_num n_var_num in + prove(mk_eq(lt_tm, rhs), REWRITE_TAC[def_array.(i); def_array.(j)] THEN ARITH_TAC);; + + + +(* Given a theorem |- bi(m) <= bj(n) <=> P m n, generates the theorem + |- SUC(bi(m)) <= SUC(bj(n)) <=> P m n *) +let gen_next_le_thm th = + let ltm, n_tm = (dest_comb o lhand o concl) th in + let m_tm = rand ltm in + let th0 = INST[m_tm, m_var_num; n_tm, n_var_num] SUC_LE_THM in + let suc_m = raw_suc_conv_hash (mk_comb (suc_const, m_tm)) in + let suc_n = raw_suc_conv_hash (mk_comb (suc_const, n_tm)) in + let th1 = SYM (MK_COMB ((AP_TERM le_op_num suc_m), suc_n)) in + TRANS (TRANS th1 th0) th;; + + + +let th_le_table = Hashtbl.create (maximum * maximum);; + + +for i = 0 to maximum - 1 do + let th = ref (gen_bi_le_bj 0 i) in + let name_left = names_array.(0) and + name_right = names_array.(i) in + let _ = Hashtbl.add th_le_table (name_left ^ name_right) !th in + + for k = 1 to maximum - i - 1 do + let x = k and y = i + k in + let name_left = names_array.(x) and + name_right = names_array.(y) in + th := gen_next_le_thm (!th); + Hashtbl.add th_le_table (name_left ^ name_right) !th + done; +done;; + + +for i = 1 to maximum - 1 do + let th = ref (gen_bi_le_bj i 0) in + let name_left = names_array.(i) and + name_right = names_array.(0) in + let _ = Hashtbl.add th_le_table (name_left ^ name_right) !th in + + for k = 1 to maximum - i - 1 do + let x = i + k and y = k in + let name_left = names_array.(x) and + name_right = names_array.(y) in + th := gen_next_le_thm (!th); + Hashtbl.add th_le_table (name_left ^ name_right) !th + done; +done;; + + +(* Conversions *) + +let rec raw_lt_hash_conv tm = + let ltm, rtm = dest_comb tm in + let ltm = rand ltm in + if is_const rtm then + (* n < _0 <=> F *) + INST[ltm, n_var_num] LT_n_0 + else + if is_const ltm then + (* _0 < Bi(n) *) + let bn_tm, n_tm = dest_comb rtm in + let cbn = (fst o dest_const) bn_tm in + let th0 = INST[n_tm, n_var_num] (Hashtbl.find th_lt0_table cbn) in + if cbn = b0_name then + let th1 = raw_lt_hash_conv (rand (concl th0)) in + TRANS th0 th1 + else + th0 + else + (* Bi(n) < Bj(m) *) + let bm_tm, m_tm = dest_comb ltm in + let bn_tm, n_tm = dest_comb rtm in + let cbm = (fst o dest_const) bm_tm in + let cbn = (fst o dest_const) bn_tm in + let th0 = INST[m_tm, m_var_num; n_tm, n_var_num] (Hashtbl.find th_lt_table (cbm^cbn)) in + let op = (fst o dest_const o rator o rator o rand o concl) th0 in + let th1 = + if op = "<" then + raw_lt_hash_conv (rand (concl th0)) + else + raw_le_hash_conv (rand (concl th0)) in + TRANS th0 th1 and + + raw_le_hash_conv tm = + let ltm, rtm = dest_comb tm in + let ltm = rand ltm in + if is_const ltm then + (* _0 <= n <=> T *) + INST[rtm, n_var_num] LE_0_n + else + if is_const rtm then + (* Bi(n) <= _0 *) + let bn_tm, n_tm = dest_comb ltm in + let cbn = (fst o dest_const) bn_tm in + let th0 = INST[n_tm, n_var_num] (Hashtbl.find th_le0_table cbn) in + if cbn = b0_name then + let th1 = raw_le_hash_conv (rand (concl th0)) in + TRANS th0 th1 + else + th0 + else + (* Bi(n) <= Bj(m) *) + let bm_tm, m_tm = dest_comb ltm in + let bn_tm, n_tm = dest_comb rtm in + let cbm = (fst o dest_const) bm_tm in + let cbn = (fst o dest_const) bn_tm in + let th0 = INST[m_tm, m_var_num; n_tm, n_var_num] (Hashtbl.find th_le_table (cbm^cbn)) in + let op = (fst o dest_const o rator o rator o rand o concl) th0 in + let th1 = + if op = "<" then + raw_lt_hash_conv (rand (concl th0)) + else + raw_le_hash_conv (rand (concl th0)) in + TRANS th0 th1;; + + + +let NUM_LT_HASH_CONV tm = + let atm, rtm = dest_comb tm in + let ltm = rand atm in + let th = INST [rand ltm, m_var_num; rand rtm, n_var_num] LT_NUM in + let rtm = rand(concl th) in + TRANS th (raw_lt_hash_conv rtm);; + + + +let NUM_LE_HASH_CONV tm = + let atm, rtm = dest_comb tm in + let ltm = rand atm in + let th = INST [rand ltm, m_var_num; rand rtm, n_var_num] LE_NUM in + let rtm = rand(concl th) in + TRANS th (raw_le_hash_conv rtm);; + + + +(* +let x = num_of_string "3543593547359325353535";; +let y = num_of_string "9392392983247294924242";; + +let xx = mk_binop lt_op_num (mk_numeral_array x) (mk_numeral_array y);; +let yy = mk_binop lt_op_num (mk_numeral x) (mk_numeral y);; + + +(* 2.38 *) +test 1000 NUM_LT_CONV yy;; +(* 10: 1.248 *) +test 10000 NUM_LT_HASH_CONV xx;; +*) + + + + +(**************************************) + +(* ADD_CONV *) + + +(* ADD theorems *) + +let ADD_NUM = (REWRITE_RULE[GSYM num_def] o prove) + (`NUMERAL m + NUMERAL n = NUMERAL (m + n)`, REWRITE_TAC[NUMERAL]);; + + +let CADD_0_n = prove(`SUC (_0 + n) = SUC n`, REWRITE_TAC[ADD_0_n]);; +let CADD_n_0 = prove(`SUC (n + _0) = SUC n`, REWRITE_TAC[ADD_n_0]);; + +(* B0 (SUC n) = B0 n + maximum *) +let B0_SUC = prove(mk_eq(mk_comb(b0_const, mk_comb(suc_const, n_var_num)), + mk_binop plus_op_num max_const (mk_comb(b0_const, n_var_num))), + REWRITE_TAC [B0_EXPLICIT] THEN ARITH_TAC);; + +let B0_ADD = prove(mk_eq(mk_binop plus_op_num (mk_comb(b0_const, m_var_num)) (mk_comb(b0_const, n_var_num)), + mk_comb(b0_const, mk_binop plus_op_num m_var_num n_var_num)), + REWRITE_TAC[B0_EXPLICIT] THEN ARITH_TAC);; + +let SUC_ADD_RIGHT = prove(`SUC(m + n) = m + SUC n`, ARITH_TAC);; + + +(* Generate all theorems iteratively *) + +let th_add_right_next th = + let lhs, rhs = dest_eq(concl th) in + let ltm, rtm = dest_comb rhs in + let cn = fst(dest_const ltm) in + let suc_th = AP_TERM suc_const th in + let th_rhs = INST[rtm, n_var_num] (Hashtbl.find th_suc_table cn) in + let ltm, rarg = dest_comb lhs in + let larg = rand ltm in + let th1 = INST[larg, m_var_num; rarg, n_var_num] SUC_ADD_RIGHT in + let cn = fst(dest_const(rator rarg)) in + let th2 = Hashtbl.find th_suc_table cn in + let th_lhs = TRANS th1 (AP_TERM ltm th2) in + TRANS (TRANS (SYM th_lhs) suc_th) th_rhs;; + + +let th_add_array = Array.make (maximum * maximum) (REFL zero_const);; + +for i = 0 to maximum - 1 do + let th0 = + if i = 0 then + B0_ADD + else + INST[n_var_num, m_var_num; m_var_num, n_var_num] + (ONCE_REWRITE_RULE[ADD_AC] th_add_array.(i)) in + let _ = th_add_array.(i * maximum) <- th0 in + + for j = 1 to maximum - 1 do + th_add_array.(i * maximum + j) <- th_add_right_next th_add_array.(i * maximum + j - 1) + done; +done;; + + +(* SUC (B_i(m) + B_j(n)) = B_p(...) *) +let th_cadd i j = + let add_th = th_add_array.(i * maximum + j) in + let th0 = AP_TERM suc_const add_th in + let ltm, rtm = dest_comb(rand(concl th0)) in + let ltm, rtm = dest_comb rtm in + let cn = fst(dest_const ltm) in + let suc_th = INST[rtm, n_var_num] (Hashtbl.find th_suc_table cn) in + TRANS th0 suc_th;; + + +let th_cadd_array = Array.make (maximum * maximum) (REFL zero_const);; + +for i = 0 to maximum - 1 do + for j = 0 to maximum - 1 do + th_cadd_array.(i * maximum + j) <- th_cadd i j + done; +done;; + + + +let th_add_table = Hashtbl.create (maximum * maximum);; + +for i = 0 to maximum - 1 do + for j = 0 to maximum - 1 do + let name = names_array.(i) ^ names_array.(j) in + let th = th_add_array.(i * maximum + j) in + let cflag = (i + j >= maximum) in + Hashtbl.add th_add_table name (th, cflag) + done; +done;; + + + +let th_cadd_table = Hashtbl.create (maximum * maximum);; + +for i = 0 to maximum - 1 do + for j = 0 to maximum - 1 do + let name = names_array.(i) ^ names_array.(j) in + let th = th_cadd_array.(i * maximum + j) in + let cflag = (i + j + 1 >= maximum) in + Hashtbl.add th_cadd_table name (th, cflag) + done; +done;; + + + +(* ADD conversion *) + + +let rec raw_add_conv_hash tm = + let atm,rtm = dest_comb tm in + let ltm = rand atm in + if ltm = zero_const then + INST [rtm,n_var_num] ADD_0_n + else if rtm = zero_const then + INST [ltm,n_var_num] ADD_n_0 + else + let lbit,larg = dest_comb ltm + and rbit,rarg = dest_comb rtm in + let name = fst(dest_const lbit) ^ fst(dest_const rbit) in + let th0, cflag = Hashtbl.find th_add_table name in + let th = INST [larg, m_var_num; rarg, n_var_num] th0 in + let ltm, rtm = dest_comb(rand(concl th)) in + if cflag then + TRANS th (AP_TERM ltm (raw_adc_conv_hash rtm)) + else + TRANS th (AP_TERM ltm (raw_add_conv_hash rtm)) +and raw_adc_conv_hash tm = + let atm,rtm = dest_comb (rand tm) in + let ltm = rand atm in + if ltm = zero_const then + let th = INST [rtm,n_var_num] CADD_0_n in + TRANS th (raw_suc_conv_hash (rand(concl th))) + else if rtm = zero_const then + let th = INST [ltm,n_var_num] CADD_n_0 in + TRANS th (raw_suc_conv_hash (rand(concl th))) + else + let lbit,larg = dest_comb ltm + and rbit,rarg = dest_comb rtm in + let name = fst(dest_const lbit) ^ fst(dest_const rbit) in + let th0, cflag = Hashtbl.find th_cadd_table name in + let th = INST [larg, m_var_num; rarg, n_var_num] th0 in + let ltm, rtm = dest_comb(rand(concl th)) in + if cflag then + TRANS th (AP_TERM ltm (raw_adc_conv_hash rtm)) + else + TRANS th (AP_TERM ltm (raw_add_conv_hash rtm));; + + +let NUM_ADD_HASH_CONV tm = + let atm, rtm = dest_comb tm in + let ltm = rand atm in + let th = INST [rand ltm, m_var_num; rand rtm, n_var_num] ADD_NUM in + let ltm, rtm = dest_comb(rand(concl th)) in + TRANS th (AP_TERM ltm (raw_add_conv_hash rtm));; + + +(* +let x = num_of_string "3543593547359325353535";; +let y = num_of_string "9392392983247294924242";; + +let xx = mk_binop plus_op_num (mk_numeral_array x) (mk_numeral_array y);; +let yy = mk_binop plus_op_num (mk_numeral x) (mk_numeral y);; + +NUM_ADD_HASH_CONV xx;; + +test 10000 NUM_ADD_CONV yy;; (* 5.672 *) +(* 10: 1.672 *) +test 10000 NUM_ADD_HASH_CONV xx;; +*) + +(********************************) + +(* Subtraction *) + +let SUB_NUM = prove(mk_eq(mk_binop minus_op_num (mk_comb (num_const, m_var_num)) (mk_comb (num_const, n_var_num)), + mk_comb(num_const, mk_binop minus_op_num m_var_num n_var_num)), + REWRITE_TAC[num_def; NUMERAL]);; + +let SUB_lemma1 = (UNDISCH_ALL o ARITH_RULE) `n + t = m ==> m - n = t:num`;; +let SUB_lemma2 = (UNDISCH_ALL o REWRITE_RULE[NUMERAL] o ARITH_RULE) `m + t = n ==> m - n = 0`;; +let LE_lemma = (UNDISCH_ALL o ARITH_RULE) `n + t = m ==> n <= m:num`;; + + +let raw_sub_hash_conv tm = + let ltm, n_tm = dest_comb tm in + let m_tm = rand ltm in + let m = raw_dest_hash m_tm in + let n = raw_dest_hash n_tm in + let t = m -/ n in + if t >=/ num_0 then + let t_tm = rand (mk_numeral_array t) in + let th0 = INST[n_tm, n_var_num; t_tm, t_var_num; m_tm, m_var_num] SUB_lemma1 in + let th_add = raw_add_conv_hash (mk_binop plus_op_num n_tm t_tm) in + MY_PROVE_HYP th_add th0 + else + let t_tm = rand (mk_numeral_array (Num.abs_num t)) in + let th0 = INST[m_tm, m_var_num; t_tm, t_var_num; n_tm, n_var_num] SUB_lemma2 in + let th_add = raw_add_conv_hash (mk_binop plus_op_num m_tm t_tm) in + MY_PROVE_HYP th_add th0;; + + + +(* Returns either (tm1 - tm2, tm2 <= tm1) or (tm2 - tm1, tm1 <= tm2) *) +let raw_sub_and_le_hash_conv tm1 tm2 = + let m = raw_dest_hash tm1 in + let n = raw_dest_hash tm2 in + let t = m -/ n in + if t >=/ num_0 then + let t_tm = rand (mk_numeral_array t) in + let inst = INST[tm2, n_var_num; t_tm, t_var_num; tm1, m_var_num] in + let th_sub = inst SUB_lemma1 in + let th_le = inst LE_lemma in + let th_add = raw_add_conv_hash (mk_binop plus_op_num tm2 t_tm) in + (MY_PROVE_HYP th_add th_sub, MY_PROVE_HYP th_add th_le) + else + let t_tm = rand (mk_numeral_array (Num.abs_num t)) in + let inst = INST[tm2, m_var_num; t_tm, t_var_num; tm1, n_var_num] in + let th_sub = inst SUB_lemma1 in + let th_le = inst LE_lemma in + let th_add = raw_add_conv_hash (mk_binop plus_op_num tm1 t_tm) in + (MY_PROVE_HYP th_add th_sub, MY_PROVE_HYP th_add th_le);; + + + +let NUM_SUB_HASH_CONV tm = + let atm, rtm = dest_comb tm in + let ltm = rand atm in + let th = INST [rand ltm, m_var_num; rand rtm, n_var_num] SUB_NUM in + let ltm, rtm = dest_comb(rand(concl th)) in + TRANS th (AP_TERM ltm (raw_sub_hash_conv rtm));; + + +(* +let y = num_of_string "3543593547359325353535";; +let x = num_of_string "9392392983247294924242";; + +let xx = mk_binop minus_op_num (mk_numeral_array x) (mk_numeral_array y);; +let yy = mk_binop minus_op_num (mk_numeral x) (mk_numeral y);; + +NUM_SUB_HASH_CONV xx;; + +test 1000 NUM_SUB_CONV yy;; (* 2.376 *) +(* 10: 0.872 *) +test 1000 NUM_SUB_HASH_CONV xx;; +*) + + + +(********************************) + +(* Multiplication *) + +let MUL_NUM = prove(mk_eq(mk_binop mul_op_num (mk_comb(num_const, m_var_num)) (mk_comb(num_const, n_var_num)), + mk_comb(num_const, mk_binop mul_op_num m_var_num n_var_num)), + REWRITE_TAC[num_def; NUMERAL]);; + +let MUL_0_n = prove(`_0 * n = _0`, ONCE_REWRITE_TAC[GSYM NUM_THM] THEN + ONCE_REWRITE_TAC[GSYM MUL_NUM] THEN REWRITE_TAC[num_def] THEN + REWRITE_TAC[MULT_CLAUSES]);; + +let MUL_n_0 = ONCE_REWRITE_RULE[MULT_AC] MUL_0_n;; + +let MUL_1_n, MUL_n_1 = + let one_const = mk_comb (const_array.(1), zero) in + let cond = mk_eq(mk_binop mul_op_num one_const n_var_num, n_var_num) in + let th = (REWRITE_RULE[NUMERAL] o prove)(cond, REWRITE_TAC[def_array.(1)] THEN ARITH_TAC) in + th, ONCE_REWRITE_RULE[MULT_AC] th;; + + + +let MUL_B0_t = prove(mk_eq(mk_binop mul_op_num (mk_comb(b0_const, n_var_num)) t_var_num, + mk_comb(b0_const, mk_binop mul_op_num n_var_num t_var_num)), + REWRITE_TAC[def_array.(0)] THEN ARITH_TAC);; + + +let MUL_t_B0 = ONCE_REWRITE_RULE[MULT_AC] MUL_B0_t;; + + +let MUL_SUC_RIGHT = prove(`m * SUC(n) = m * n + m`, ARITH_TAC);; + + +(* Multiplication table *) + +let mul_th_next_right th = + let ltm, rtm = dest_comb(rand(rator(concl th))) in + let mtm = rand ltm in + let th0 = INST[mtm, m_var_num; rtm, n_var_num] MUL_SUC_RIGHT in + let th1 = AP_THM (AP_TERM plus_op_num th) mtm in + let sum_th = raw_add_conv_hash (rand(concl th1)) in + let th2 = TRANS (TRANS th0 th1) sum_th in + let cn = fst(dest_const (rator rtm)) in + let th_suc = INST[zero_const, n_var_num] (Hashtbl.find th_suc_table cn) in + let th3 = AP_TERM (mk_comb (mul_op_num, mtm)) th_suc in + TRANS (SYM th3) th2;; + + +let mul_array = Array.make (maximum * maximum) (REFL zero_const);; +for i = 1 to maximum - 1 do + let th1 = INST[mk_comb(const_array.(i), zero_const), n_var_num] MUL_n_1 in + let _ = mul_array.(i * maximum + 1) <- th1 in + + for j = 2 to maximum - 1 do + mul_array.(i * maximum + j) <- mul_th_next_right mul_array.(i * maximum + j - 1) + done; +done;; + + + +let mul_table = Hashtbl.create (maximum * maximum);; +for i = 1 to maximum - 1 do + for j = 1 to maximum - 1 do + Hashtbl.add mul_table (names_array.(i) ^ names_array.(j)) mul_array.(i * maximum + j) + done; +done;; + + +(* General multiplication theorem *) + +let prod_lemma = + let mul (a,b) = mk_binop mul_op_num a b and + add (a,b) = mk_binop plus_op_num a b in + let lhs = mul(add(t_var_num, mk_comb(b0_const, m_var_num)), + add(r_var_num, mk_comb(b0_const, n_var_num))) in + let rhs = add(mul(t_var_num, r_var_num), + mk_comb(b0_const, add(mk_comb(b0_const, mul(m_var_num, n_var_num)), + add(mul(m_var_num, r_var_num), + mul(n_var_num, t_var_num))))) in + prove(mk_eq(lhs, rhs), + REWRITE_TAC[LEFT_ADD_DISTRIB; RIGHT_ADD_DISTRIB] THEN + REWRITE_TAC[MUL_B0_t; MUL_t_B0] THEN + ONCE_REWRITE_TAC[GSYM ADD_ASSOC] THEN + REWRITE_TAC[th_add_array.(0)] THEN + REWRITE_TAC[ADD_AC; MULT_AC]);; + +let ADD_ASSOC' = SPEC_ALL ADD_ASSOC;; + +let dest_op tm = + let ltm, rtm = dest_comb tm in + rand ltm, rtm;; + + +(* B_i(m) * B_j(n) = B_p(B_q(m * n) + m * B_j(0) + n * B_i(0)) + where B_p(B_q(0)) = i * j *) +let gen_mul_thm i j = + let bi0 = mk_comb(const_array.(i), zero_const) and + bj0 = mk_comb(const_array.(j), zero_const) in + let def_i = INST[m_var_num, n_var_num] def_thm_array.(i) in + let def_j = def_thm_array.(j) in + let th0 = MK_COMB(AP_TERM mul_op_num def_i, def_j) in + let th1 = TRANS th0 (INST[bi0, t_var_num; bj0, r_var_num] prod_lemma) in + let mul_th = mul_array.(i * maximum + j) in + let larg, rarg = dest_op (rand (concl th1)) in + let th2 = TRANS th1 (AP_THM (AP_TERM plus_op_num mul_th) rarg) in + let larg = rand(concl mul_th) in + let b_low, b_high = dest_comb larg in + let rtm = rand(rarg) in + let th_add = INST[b_high, m_var_num; rtm, n_var_num] + (fst(Hashtbl.find th_add_table (fst(dest_const b_low)^b0_name))) in + if i * j < maximum then + let ltm, rtm = dest_op(rand(rand(concl th_add))) in + let add_0 = AP_TERM b_low (INST[rtm, n_var_num] ADD_0_n) in + TRANS th2 (TRANS th_add add_0) + else + let larg, rtm = dest_op (rand(rand(concl th_add))) in + let rarg, rtm = dest_op rtm in + let th_assoc = INST[larg, m_var_num; rarg, n_var_num; rtm, p_var_num] ADD_ASSOC' in + let mn = rand(rarg) in + let b_high = rator b_high in + let th_add2' = INST[zero_const, m_var_num; mn, n_var_num] + (fst(Hashtbl.find th_add_table (fst(dest_const b_high)^b0_name))) in + let add_0 = AP_TERM b_high (INST[mn, n_var_num] ADD_0_n) in + let th_add2 = TRANS th_add2' add_0 in + let th3 = TRANS th_assoc (AP_THM (AP_TERM plus_op_num th_add2) rtm) in + let th4 = TRANS th_add (AP_TERM b_low th3) in + TRANS th2 th4;; + + +let gen_mul_table = Hashtbl.create (maximum * maximum);; + +for i = 1 to maximum - 1 do + for j = 1 to maximum - 1 do + let name = names_array.(i) ^ names_array.(j) in + Hashtbl.add gen_mul_table name (gen_mul_thm i j) + done; +done;; + + +(* B_i(m) * B_j(0) = B_p(B_q(0) + m * B_j(0)) + where i * j = B_p(B_q(0)) *) +let mul1_right_th i j = + let th0 = INST[zero_const, n_var_num] + (Hashtbl.find gen_mul_table (names_array.(i)^names_array.(j))) in + let b_low, rtm = dest_comb(rand(concl th0)) in + let tm1, tm23 = dest_op rtm in + let tm2p, tm3 = dest_comb tm23 in + let tm3_th = INST[rand tm3, n_var_num] MUL_0_n in + let tm2_th = INST[rand(tm2p), n_var_num] ADD_n_0 in + let tm23_th = TRANS (AP_TERM tm2p tm3_th) tm2_th in + let ltm, rtm = dest_comb tm1 in + if (i * j < maximum) then + let tm1_th = TRANS (AP_TERM ltm (INST[m_var_num, n_var_num] MUL_n_0)) B0_0 in + let tm123_th' = TRANS (INST[tm23, n_var_num] ADD_0_n) tm23_th in + let tm123_th = TRANS (AP_THM (AP_TERM plus_op_num tm1_th) tm23) tm123_th' in + TRANS th0 (AP_TERM b_low tm123_th) + else + let tm1_th = AP_TERM ltm (INST[m_var_num, n_var_num] MUL_n_0) in + let tm123_th = MK_COMB(AP_TERM plus_op_num tm1_th, tm23_th) in + TRANS th0 (AP_TERM b_low tm123_th);; + + +(* B_j(0) * B_i(m) = B_p(B_q(0) + B_j(0) * B_i(m) *) + +let MULT_AC' = CONJUNCT1 MULT_AC;; + +let mul1_left_th th = + let lhs, rhs = dest_eq(concl th) in + let ltm, rtm = dest_op lhs in + let th_lhs = INST[ltm, n_var_num; rtm, m_var_num] MULT_AC' in + let btm, rtm = dest_comb rhs in + let larg, rarg = dest_op rtm in + if (is_comb larg) then + let ltm, rtm = dest_op rarg in + let th_rhs' = INST[ltm, m_var_num; rtm, n_var_num] MULT_AC' in + let th_rhs = AP_TERM (mk_comb(plus_op_num, larg)) th_rhs' in + TRANS th_lhs (TRANS th (AP_TERM btm th_rhs)) + else + let th_rhs = INST[larg, m_var_num; rarg, n_var_num] MULT_AC' in + TRANS th_lhs (TRANS th (AP_TERM btm th_rhs));; + + + + +let mul1_right_th_table = Hashtbl.create (maximum * maximum);; +let mul1_left_th_table = Hashtbl.create (maximum * maximum);; + +for i = 1 to maximum - 1 do + for j = 1 to maximum - 1 do + let name_right = names_array.(i) ^ names_array.(j) in + let name_left = names_array.(j) ^ names_array.(i) in + let th = mul1_right_th i j in + let add_flag = (i * j >= maximum) in + let _ = Hashtbl.add mul1_right_th_table name_right (add_flag, th) in + Hashtbl.add mul1_left_th_table name_left (add_flag, mul1_left_th th) + done; +done;; + + + +(******************************************************) + +(* Conversions *) + + +(* Multiplies arg and (tm = tmname(_0)) *) +let rec raw_mul1_right_hash arg tm tmname = + if arg = zero_const then + INST [tm, n_var_num] MUL_0_n + else + let btm, mtm = dest_comb arg in + let cn = fst(dest_const btm) in + if (cn = b0_name) then + let th = INST[mtm, n_var_num; tm, t_var_num] MUL_B0_t in + TRANS th (AP_TERM b0_const (raw_mul1_right_hash mtm tm tmname)) + else + let name = cn ^ tmname in + if (mtm = zero_const) then + Hashtbl.find mul_table name + else + let add_flag, th' = Hashtbl.find mul1_right_th_table name in + let th = INST[mtm, m_var_num] th' in + if add_flag then + let ltm, rtm = dest_comb(rand(concl th)) in + let lplus, rarg = dest_comb rtm in + let th2 = AP_TERM lplus (raw_mul1_right_hash mtm tm tmname) in + let th_add = raw_add_conv_hash (rand(concl th2)) in + TRANS th (AP_TERM ltm (TRANS th2 th_add)) + else + let ltm = rator(rand(concl th)) in + let th2 = AP_TERM ltm (raw_mul1_right_hash mtm tm tmname) in + TRANS th th2;; + + +(* Multiplies (tm = tmname(_0)) and arg *) +let rec raw_mul1_left_hash tm tmname arg = + if arg = zero_const then + INST [tm, n_var_num] MUL_n_0 + else + let btm, mtm = dest_comb arg in + let cn = fst(dest_const btm) in + if (cn = b0_name) then + let th = INST[mtm, n_var_num; tm, t_var_num] MUL_t_B0 in + TRANS th (AP_TERM b0_const (raw_mul1_left_hash tm tmname mtm)) + else + let name = tmname ^ cn in + if (mtm = zero_const) then + Hashtbl.find mul_table name + else + let add_flag, th' = Hashtbl.find mul1_left_th_table name in + let th = INST[mtm, m_var_num] th' in + if add_flag then + let ltm, rtm = dest_comb(rand(concl th)) in + let lplus, rarg = dest_comb rtm in + let th2 = AP_TERM lplus (raw_mul1_left_hash tm tmname mtm) in + let th_add = raw_add_conv_hash (rand(concl th2)) in + TRANS th (AP_TERM ltm (TRANS th2 th_add)) + else + let ltm = rator(rand(concl th)) in + let th2 = AP_TERM ltm (raw_mul1_left_hash tm tmname mtm) in + TRANS th th2;; + + +(* Computes B_i(m) * B_j(n) *) +let rec raw_mul_conv_hash tm = + let larg, rarg = dest_comb tm in + let larg = rand larg in + if larg = zero_const then + INST [rarg, n_var_num] MUL_0_n + else if rarg = zero_const then + INST [larg, n_var_num] MUL_n_0 + else + + let lbtm, mtm = dest_comb larg in + let lcn = fst(dest_const lbtm) in + if (lcn = b0_name) then + let th = INST[rarg, t_var_num; mtm, n_var_num] MUL_B0_t in + let ltm, rtm = dest_comb(rand(concl th)) in + TRANS th (AP_TERM ltm (raw_mul_conv_hash rtm)) + else + let rbtm, ntm = dest_comb rarg in + let rcn = fst(dest_const rbtm) in + if (rcn = b0_name) then + let th = INST[larg, t_var_num; ntm, n_var_num] MUL_t_B0 in + let ltm, rtm = dest_comb(rand(concl th)) in + TRANS th (AP_TERM ltm (raw_mul_conv_hash rtm)) + else + + if (ntm = zero_const) then + if (mtm = zero_const) then + Hashtbl.find mul_table (lcn ^ rcn) + else + raw_mul1_right_hash larg (mk_comb(rbtm, zero_const)) rcn + else if (mtm = zero_const) then + raw_mul1_left_hash (mk_comb(lbtm, zero_const)) lcn rarg + else + + let th0 = INST[mtm, m_var_num; ntm, n_var_num] + (Hashtbl.find gen_mul_table (lcn ^ rcn)) in + let b_low, expr = dest_comb(rand(concl th0)) in + let ltm, rsum = dest_comb expr in + let b_high, mul0 = dest_comb (rand ltm) in + let th_mul0 = raw_mul_conv_hash mul0 in + let th_mul1 = raw_mul1_right_hash mtm (mk_comb(rbtm, zero_const)) rcn in + let th_mul2 = raw_mul1_right_hash ntm (mk_comb(lbtm, zero_const)) lcn in + let th_larg = AP_TERM plus_op_num (AP_TERM b_high th_mul0) in + let th_rarg = MK_COMB(AP_TERM plus_op_num th_mul1, th_mul2) in + + let add_rarg = TRANS th_rarg (raw_add_conv_hash (rand(concl th_rarg))) in + let add_th = MK_COMB (th_larg, add_rarg) in + let add = TRANS add_th (raw_add_conv_hash (rand(concl add_th))) in + + TRANS th0 (AP_TERM b_low add);; + + + +(* The main multiplication conversion *) +let NUM_MULT_HASH_CONV tm = + let ltm, rtm = dest_comb tm in + let larg, rarg = rand (rand ltm), rand rtm in + let th0 = INST[larg, m_var_num; rarg, n_var_num] MUL_NUM in + if (rand(rator(concl th0)) <> tm) then + failwith "NUM_MULT_HASH_CONV" + else + let rtm = rand(rand(concl th0)) in + let th = raw_mul_conv_hash rtm in + TRANS th0 (AP_TERM num_const th);; + + + +(**************************) + +(* Tests *) + +(* +let x = Int 325325353;; +let y = Int 999434312;; + +let xx = mk_binop mul_op_num (mk_numeral_array x) (mk_numeral_array y);; +let yy = mk_binop mul_op_num (mk_numeral x) (mk_numeral y);; +let zz = rand(concl(REWRITE_CONV[NUM_THM] xx));; + +NUM_MULT_HASH_CONV xx;; + +test 1000 NUM_MULT_CONV yy;; (* 4.12 *) +(* 10: 1.896 *) +test 1000 NUM_MULT_HASH_CONV xx;; (* 4: 1.69; 6: 0.716(1), 0.608(2), 8: 0.328(3) *) +(* 10: 1.864 *) +test 1000 raw_mul_conv_hash zz;; (* 4: 2.45(1), 1.576(2), 8: 0.320 *) + + +needs "example0.hl";; + +let x = map (fun t1, t2 -> mk_binop mul_op_num (mk_numeral t1) (mk_numeral t2)) example;; +let h1 = map (fun t1, t2 -> mk_binop mul_op_num (mk_numeral_array t1) (mk_numeral_array t2)) example;; +let h2 = map (fun t1, t2 -> mk_binop mul_op_num + (rand (mk_numeral_array t1)) + (rand (mk_numeral_array t2))) example;; + + +test 1 (map NUM_MULT_CONV) x;; (* 2.64 *) +test 10 (map NUM_MULT_HASH_CONV) h1;; (* 4: 5.43; 6: 3.12; 8: 1.67 *) +test 10 (map raw_mul_conv_hash) h2;; (* 5.42; 8: 1.576 *) +*) + + + +(************************************) + +(* DIV *) + + +let DIV_NUM = prove(mk_eq(mk_binop div_op_num (mk_comb(num_const, m_var_num)) (mk_comb(num_const, n_var_num)), + mk_comb(num_const, mk_binop div_op_num m_var_num n_var_num)), + REWRITE_TAC[num_def; NUMERAL]);; + + +let DIV_UNIQ' = (UNDISCH_ALL o + PURE_ONCE_REWRITE_RULE[ARITH_RULE `a < b <=> (a < b:num <=> T)`] o + ONCE_REWRITE_RULE[ARITH_RULE `m = q * n + r <=> q * n + r = m:num`] o + REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL) DIV_UNIQ;; + +(* Computes m DIV n *) +let raw_div_hash_conv tm = + let ltm, n_tm = dest_comb tm in + let m_tm = rand ltm in + let m = raw_dest_hash m_tm in + let n = raw_dest_hash n_tm in + let q = Num.quo_num m n and + r = Num.mod_num m n in + let q_tm = rand (mk_numeral_array q) and + r_tm = rand (mk_numeral_array r) in + + let qn_th = raw_mul_conv_hash (mk_binop mul_op_num q_tm n_tm) in + let qn_tm = rand (concl qn_th) in + let qnr_th = raw_add_conv_hash (mk_binop plus_op_num qn_tm r_tm) in + let th1 = TRANS (AP_THM (AP_TERM plus_op_num qn_th) r_tm) qnr_th in + let th2 = raw_lt_hash_conv (mk_binop lt_op_num r_tm n_tm) in + let th0 = INST[r_tm, r_var_num; n_tm, n_var_num; m_tm, m_var_num; q_tm, q_var_num] DIV_UNIQ' in + MY_PROVE_HYP th1 (MY_PROVE_HYP th2 th0);; + + + +(* The main division conversion *) +let NUM_DIV_HASH_CONV tm = + let ltm, rtm = dest_comb tm in + let larg, rarg = rand (rand ltm), rand rtm in + let th0 = INST[larg, m_var_num; rarg, n_var_num] DIV_NUM in + if (rand(rator(concl th0)) <> tm) then + failwith "NUM_DIV_HASH_CONV" + else + let rtm = rand(rand(concl th0)) in + let th = raw_div_hash_conv rtm in + TRANS th0 (AP_TERM num_const th);; + + +(* +let y = num_of_string "3543593547359";; +let x = num_of_string "9392392983247294924242";; + + +let xx = mk_binop div_op_num (mk_numeral_array x) (mk_numeral_array y);; +let yy = mk_binop div_op_num (mk_numeral x) (mk_numeral y);; + +(* 1.844 *) +test 100 NUM_DIV_CONV yy;; +(* 10: 0.428 *) +test 100 NUM_DIV_HASH_CONV xx;; +*) + + + +(*********************************************) + +(* EVEN_CONV, ODD_CONV *) + +let even_const = `EVEN` and + odd_const = `ODD` and + eq_const = `<=>` and + f_const = `F` and + t_const = `T`;; + + + +let EVEN_NUM = (REWRITE_RULE[GSYM num_def] o prove) + (`EVEN (NUMERAL n) <=> EVEN n`, REWRITE_TAC[NUMERAL]);; + +let ODD_NUM = (REWRITE_RULE[GSYM num_def] o prove) + (`ODD (NUMERAL n) <=> ODD n`, REWRITE_TAC[NUMERAL]);; + +let EVEN_ZERO = prove(`EVEN _0 <=> T`, REWRITE_TAC[ARITH_EVEN]);; +let ODD_ZERO = prove(`ODD _0 <=> F`, REWRITE_TAC[ARITH_ODD]);; + + +let EVEN_B0 = prove(mk_eq(mk_comb(`EVEN`, mk_comb(b0_const, `n:num`)), `T`), + REWRITE_TAC[B0_EXPLICIT; EVEN_MULT] THEN + DISJ1_TAC THEN CONV_TAC NUM_EVEN_CONV);; + + +let ODD_B0 = prove(mk_eq(mk_comb(`ODD`, mk_comb(b0_const, `n:num`)), `F`), + REWRITE_TAC[NOT_ODD; EVEN_B0]);; + +let EVEN_SUC_T = prove(`(EVEN (SUC n) <=> T) <=> (EVEN n <=> F)`, REWRITE_TAC[EVEN]);; +let EVEN_SUC_F = prove(`(EVEN (SUC n) <=> F) <=> (EVEN n <=> T)`, REWRITE_TAC[EVEN]);; + +let ODD_SUC_T = prove(`(ODD (SUC n) <=> T) <=> (ODD n <=> F)`, REWRITE_TAC[ODD]);; +let ODD_SUC_F = prove(`(ODD (SUC n) <=> F) <=> (ODD n <=> T)`, REWRITE_TAC[ODD]);; + + + +let next_even_th th = + let ltm, rtm = dest_comb(concl th) in + let b_tm = rand(rand ltm) in + let suc_b = raw_suc_conv_hash (mk_comb (suc_const, b_tm)) in + let flag = (fst o dest_const) rtm = "T" in + let th0 = SYM (AP_TERM even_const suc_b) in + let th1 = AP_THM (AP_TERM eq_const th0) (if flag then f_const else t_const) in + let th2 = INST[b_tm, n_var_num] (if flag then EVEN_SUC_F else EVEN_SUC_T) in + EQ_MP (SYM (TRANS th1 th2)) th;; + + +let next_odd_th th = + let ltm, rtm = dest_comb(concl th) in + let b_tm = rand(rand ltm) in + let suc_b = raw_suc_conv_hash (mk_comb (suc_const, b_tm)) in + let flag = (fst o dest_const) rtm = "T" in + let th0 = SYM (AP_TERM odd_const suc_b) in + let th1 = AP_THM (AP_TERM eq_const th0) (if flag then f_const else t_const) in + let th2 = INST[b_tm, n_var_num] (if flag then ODD_SUC_F else ODD_SUC_T) in + EQ_MP (SYM (TRANS th1 th2)) th;; + + +let even_thm_table = Hashtbl.create maximum;; + + +Hashtbl.add even_thm_table names_array.(0) EVEN_B0;; + + +for i = 1 to maximum - 1 do + let th0 = next_even_th (Hashtbl.find even_thm_table names_array.(i - 1)) in + Hashtbl.add even_thm_table names_array.(i) th0 +done;; + + +let odd_thm_table = Hashtbl.create maximum;; + +Hashtbl.add odd_thm_table names_array.(0) ODD_B0;; + +for i = 1 to maximum - 1 do + let th0 = next_odd_th (Hashtbl.find odd_thm_table names_array.(i - 1)) in + Hashtbl.add odd_thm_table names_array.(i) th0 +done;; + + +let raw_even_hash_conv tm = + let ltm, rtm = dest_comb tm in + if ((fst o dest_const) ltm <> "EVEN") then + failwith "raw_even_hash_conv: no EVEN" + else + if (is_const rtm) then + EVEN_ZERO + else + let b_tm, n_tm = dest_comb rtm in + let th0 = Hashtbl.find even_thm_table ((fst o dest_const) b_tm) in + INST[n_tm, n_var_num] th0;; + + +let raw_odd_hash_conv tm = + let ltm, rtm = dest_comb tm in + if ((fst o dest_const) ltm <> "ODD") then + failwith "raw_odd_hash_conv: no ODD" + else + if (is_const rtm) then + ODD_ZERO + else + let b_tm, n_tm = dest_comb rtm in + let th0 = Hashtbl.find odd_thm_table ((fst o dest_const) b_tm) in + INST[n_tm, n_var_num] th0;; + + + +let NUM_EVEN_HASH_CONV tm = + let ltm, rtm = dest_comb tm in + let th0 = INST[rand rtm, n_var_num] EVEN_NUM in + let ltm, rtm = dest_comb(concl th0) in + if (rand ltm <> tm) then + failwith "NUM_EVEN_HASH_CONV" + else + let th1 = raw_even_hash_conv rtm in + TRANS th0 th1;; + + +let NUM_ODD_HASH_CONV tm = + let ltm, rtm = dest_comb tm in + let th0 = INST[rand rtm, n_var_num] ODD_NUM in + let ltm, rtm = dest_comb(concl th0) in + if (rand ltm <> tm) then + failwith "NUM_ODD_HASH_CONV" + else + let th1 = raw_odd_hash_conv rtm in + TRANS th0 th1;; + + + +end;; + + diff --git a/formal_lp/old/arith/arith_cache.hl b/formal_lp/old/arith/arith_cache.hl new file mode 100644 index 0000000..644d0df --- /dev/null +++ b/formal_lp/old/arith/arith_cache.hl @@ -0,0 +1,211 @@ +(*****************************) +(* Cached natural arithmetic *) +(*****************************) + +(* Dependencies *) +needs "../formal_lp/arith/arith_options.hl";; +needs ("../formal_lp/arith/"^(if Arith_options.binary then "arith_hash.hl" else "arith_hash2.hl"));; + + +module Arith_cache = struct + +(* Hash tables *) +let cache_size = if Arith_options.cached then 10000 else 1;; +let max_cache_size = cache_size * 2;; + +let my_add h key v = + if Hashtbl.length h >= max_cache_size then + let _ = Hashtbl.clear h in + print_string "Clearing a nat hash table" + else + (); + Hashtbl.add h key v;; + +let le_table = Hashtbl.create cache_size and + add_table = Hashtbl.create cache_size and + sub_table = Hashtbl.create cache_size and + sub_le_table = Hashtbl.create cache_size and + mul_table = Hashtbl.create cache_size and + div_table = Hashtbl.create cache_size;; + +(* Counters for collecting stats *) +let suc_counter = ref 0 and + eq0_counter = ref 0 and + pre_counter = ref 0 and + gt0_counter = ref 0 and + lt_counter = ref 0 and + le_counter = ref 0 and + add_counter = ref 0 and + sub_counter = ref 0 and + sub_le_counter = ref 0 and + mul_counter = ref 0 and + div_counter = ref 0 and + even_counter = ref 0 and + odd_counter = ref 0;; + + +(* Clears all cached results *) +let reset_cache () = + let clear = Hashtbl.clear in + clear le_table; + clear add_table; + clear sub_table; + clear sub_le_table; + clear mul_table; + clear div_table;; + + +(* Resets all counters *) +let reset_stat () = + suc_counter := 0; + eq0_counter := 0; + pre_counter := 0; + gt0_counter := 0; + lt_counter := 0; + le_counter := 0; + add_counter := 0; + sub_counter := 0; + sub_le_counter := 0; + mul_counter := 0; + div_counter := 0; + even_counter := 0; + odd_counter := 0;; + +(* Prints stats *) +let print_stat () = + let len = Hashtbl.length in + let suc_pre_str = sprintf "suc = %d\npre = %d\n" !suc_counter !pre_counter in + let cmp0_str = sprintf "eq0 = %d\ngt0 = %d\n" !eq0_counter !gt0_counter in + let lt_str = sprintf "lt = %d\n" !lt_counter in + let even_odd_str = sprintf "even = %d\nodd = %d\n" !even_counter !odd_counter in + let le_str = sprintf "le = %d (le_hash = %d)\n" !le_counter (len le_table) in + let add_str = sprintf "add = %d (add_hash = %d)\n" !add_counter (len add_table) in + let sub_str = sprintf "sub = %d (sub_hash = %d)\n" !sub_counter (len sub_table) in + let sub_le_str = sprintf "sub_le = %d (sub_le_hash = %d)\n" !sub_le_counter (len sub_le_table) in + let mul_str = sprintf "mul = %d (mul_hash = %d)\n" !mul_counter (len mul_table) in + let div_str = sprintf "div = %d (div_hash = %d)\n" !div_counter (len div_table) in + print_string (suc_pre_str ^ cmp0_str ^ lt_str ^ even_odd_str ^ + le_str ^ add_str ^ sub_str ^ sub_le_str ^ mul_str ^ div_str);; + + +(* Note: the standard Hashtbl.hash function works very purely on terms *) +let rec num_tm_hash tm = + if is_comb tm then + let b_tm, n_tm = dest_comb tm in + let str = (fst o dest_const) b_tm in + str ^ num_tm_hash n_tm + else + "";; + +let op_tm_hash tm = + let lhs, tm2 = dest_comb tm in + let tm1 = rand lhs in + num_tm_hash tm1 ^ "x" ^ num_tm_hash tm2;; + + +let tm1_tm2_hash tm1 tm2 = + num_tm_hash tm1 ^ "x" ^ num_tm_hash tm2;; + + +(* SUC *) +let raw_suc_conv_hash tm = + let _ = suc_counter := !suc_counter + 1 in +(* let _ = suc_list := tm :: !suc_list in *) + Arith_hash.raw_suc_conv_hash tm;; + +(* x = 0 *) +let raw_eq0_hash_conv tm = + let _ = eq0_counter := !eq0_counter + 1 in +(* let _ = eq0_list := tm :: !eq0_list in *) + Arith_hash.raw_eq0_hash_conv tm;; + +(* PRE *) +let raw_pre_hash_conv tm = + let _ = pre_counter := !pre_counter + 1 in + Arith_hash.raw_pre_hash_conv tm;; + +(* x > 0 *) +let raw_gt0_hash_conv tm = + let _ = gt0_counter := !gt0_counter + 1 in + Arith_hash.raw_gt0_hash_conv tm;; + +(* x < y *) +let raw_lt_hash_conv tm = + let _ = lt_counter := !lt_counter + 1 in + Arith_hash.raw_lt_hash_conv tm;; + +(* x <= y *) +let raw_le_hash_conv tm = + let _ = le_counter := !le_counter + 1 in + let hash = op_tm_hash tm in + try + Hashtbl.find le_table hash + with Not_found -> + let result = Arith_hash.raw_le_hash_conv tm in + let _ = my_add le_table hash result in + result;; + +(* x + y *) +let raw_add_conv_hash tm = + let _ = add_counter := !add_counter + 1 in + let hash = op_tm_hash tm in + try + Hashtbl.find add_table hash + with Not_found -> + let result = Arith_hash.raw_add_conv_hash tm in + let _ = my_add add_table hash result in + result;; + +(* x - y *) +let raw_sub_hash_conv tm = + let _ = sub_counter := !sub_counter + 1 in + let hash = op_tm_hash tm in + try + Hashtbl.find sub_table hash + with Not_found -> + let result = Arith_hash.raw_sub_hash_conv tm in + let _ = my_add sub_table hash result in + result;; + +let raw_sub_and_le_hash_conv tm1 tm2 = + let _ = sub_le_counter := !sub_le_counter + 1 in + let hash = tm1_tm2_hash tm1 tm2 in + try + Hashtbl.find sub_le_table hash + with Not_found -> + let result = Arith_hash.raw_sub_and_le_hash_conv tm1 tm2 in + let _ = my_add sub_le_table hash result in + result;; + +(* x * y *) +let raw_mul_conv_hash tm = + let _ = mul_counter := !mul_counter + 1 in + let hash = op_tm_hash tm in + try + Hashtbl.find mul_table hash + with Not_found -> + let result = Arith_hash.raw_mul_conv_hash tm in + let _ = my_add mul_table hash result in + result;; + +(* x / y *) +let raw_div_hash_conv tm = + let _ = div_counter := !div_counter + 1 in + let hash = op_tm_hash tm in + try + Hashtbl.find div_table hash + with Not_found -> + let result = Arith_hash.raw_div_hash_conv tm in + let _ = my_add div_table hash result in + result;; + +(* EVEN, ODD *) +let raw_even_hash_conv tm = + let _ = even_counter := !even_counter + 1 in + Arith_hash.raw_even_hash_conv tm;; + +let raw_odd_hash_conv tm = + let _ = odd_counter := !odd_counter + 1 in + Arith_hash.raw_odd_hash_conv tm;; + +end;; diff --git a/formal_lp/old/arith/arith_hash.hl b/formal_lp/old/arith/arith_hash.hl new file mode 100644 index 0000000..f8d9322 --- /dev/null +++ b/formal_lp/old/arith/arith_hash.hl @@ -0,0 +1,1803 @@ +module type Arith_hash_sig = + sig + val num_def : thm + val NUM_THM : thm + val num_const : term + val const_array : term array + val def_array: thm array + val def_thm_array: thm array + val mk_numeral_hash : num -> term + val mk_numeral_array : num -> term + val mk_small_numeral_array : int -> term + val mk_int64_numeral_array : int64 -> term + val raw_dest_hash : term -> num + val dest_numeral_hash : term -> num + val dest_numeral64_hash : term -> int64 + val NUMERAL_TO_NUM_CONV : term -> thm + val NUM_TO_NUMERAL_CONV : term -> thm + + val raw_suc_conv_hash : term -> thm + val NUM_SUC_HASH_CONV : term -> thm + + val raw_eq0_hash_conv : term -> thm + val NUM_EQ0_HASH_CONV : term -> thm + + val raw_pre_hash_conv : term -> thm + val NUM_PRE_HASH_CONV : term -> thm + + val raw_gt0_hash_conv : term -> thm + val NUM_GT0_HASH_CONV : term -> thm + + val raw_lt_hash_conv : term -> thm + val raw_le_hash_conv : term -> thm + val NUM_LT_HASH_CONV : term -> thm + val NUM_LE_HASH_CONV : term -> thm + + val raw_add_conv_hash : term -> thm + val NUM_ADD_HASH_CONV : term -> thm + + val raw_sub_hash_conv : term -> thm + val raw_sub_and_le_hash_conv : term -> term -> thm * thm + val NUM_SUB_HASH_CONV : term -> thm + + val raw_mul_conv_hash : term -> thm + val NUM_MULT_HASH_CONV : term -> thm + + val raw_div_hash_conv : term -> thm + val NUM_DIV_HASH_CONV : term -> thm + + val raw_even_hash_conv : term -> thm + val raw_odd_hash_conv : term -> thm + val NUM_EVEN_HASH_CONV : term -> thm + val NUM_ODD_HASH_CONV : term -> thm +end;; + +(* Dependencies *) +needs "../formal_lp/arith/misc.hl";; +needs "../formal_lp/arith/arith_options.hl";; + +module Arith_hash : Arith_hash_sig = struct + +(* Open modules *) +open Arith_misc;; +open Arith_options;; + + + +(* Main parameter *) + +let rec log2b n = + if n > 1 then log2b (n lsr 1) + 1 else 0;; + + +let bits = log2b base;; + + + +(******************) +let maximum = 1 lsl bits;; +let mask = maximum - 1;; + +(* Check that the base is correct *) +if maximum <> base then + failwith "arith_hash: base is not a power of 2" +else + ();; + + +(* Generate definitions and constants *) + +let num_type = `:num`;; +let fnum_type = `:num->num`;; + +let numeral_const = `NUMERAL` and + zero_const = `_0` and + bit0_const = `BIT0` and + bit1_const = `BIT1` and + truth_const = `T` and + false_const = `F`;; + +let m_var_num = `m:num` and + n_var_num = `n:num` and + t_var_num = `t:num` and + r_var_num = `r:num` and + p_var_num = `p:num` and + q_var_num = `q:num`;; + +let suc_const = `SUC` and + plus_op_num = `(+):num->num->num` and + minus_op_num = `(-):num->num->num` and + mul_op_num = `( * ):num->num->num` and + div_op_num = `(DIV):num->num->num` and + le_op_num = `(<=):num->num->bool` and + lt_op_num = `(<):num->num->bool`;; + + +let plus_op_real = `(+):real->real->real` and + mul_op_real = `( * ):real->real->real`;; + + + +let decode n k = + let rec decode n level = + if (level >= k) then "" + else if (n land 1 = 1) then "1"^decode (n lsr 1) (level + 1) + else "0"^decode (n lsr 1) (level + 1) in + decode n 0;; + + +let rec create_bit_term n k = + if (k <= 0) then n_var_num + else let bit = + if (n land 1 = 1) then bit1_const else bit0_const in + mk_comb (bit, create_bit_term (n lsr 1) (k - 1));; + + + +let names_array = Array.init maximum (fun i -> "B"^(string_of_int i));; + + +(* Definitions *) + +let num_name = "NUM"^(string_of_int bits);; +let num_def = new_basic_definition (mk_eq(mk_var(num_name, fnum_type), numeral_const));; +let num_const = mk_const(num_name, []);; +let num_def_sym = SYM num_def;; +let NUM_THM = prove(mk_eq(mk_comb(num_const, n_var_num), n_var_num), + REWRITE_TAC[num_def; NUMERAL]);; + + +let mk_bit_definition i = + let lhs = mk_var (names_array.(i), fnum_type) in + let rhs = mk_abs (n_var_num, create_bit_term i bits) in + new_basic_definition (mk_eq(lhs, rhs));; + + +let def_basic_array = Array.init maximum mk_bit_definition;; +let def_array = Array.init maximum (fun i -> + let basic = def_basic_array.(i) in + let th1 = AP_THM basic n_var_num in + TRANS th1 (BETA (rand (concl th1))));; +let def_table = Hashtbl.create maximum;; +let def_basic_table = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + let _ = Hashtbl.add def_table names_array.(i) def_array.(i) in + Hashtbl.add def_basic_table names_array.(i) def_basic_array.(i) +done;; + + +(* Constants *) + + +let const_array = Array.init maximum (fun i -> mk_const(names_array.(i),[]));; + +let b0_def = def_array.(0);; +let b0_const = const_array.(0);; +let b0_name = names_array.(0);; + +let max_const = mk_small_numeral maximum;; + + + +(* Alternative definition of B_i *) + +let ADD_0_n = prove(`_0 + n = n`, + ONCE_REWRITE_TAC[GSYM NUMERAL] THEN + REWRITE_TAC[GSYM ARITH_ADD; ADD_CLAUSES]);; +let ADD_n_0 = prove(`n + _0 = n`, + ONCE_REWRITE_TAC[GSYM NUMERAL] THEN + REWRITE_TAC[GSYM ARITH_ADD; ADD_CLAUSES]);; + +(* B_i(n) = i + B_0(n) *) +let def_thm i = + let bin = mk_comb(const_array.(i), n_var_num) in + let bi0 = mk_comb(const_array.(i), zero_const) in + let b0n = mk_comb(const_array.(0), n_var_num) in + let rhs = mk_binop plus_op_num bi0 b0n in + prove(mk_eq(bin, rhs), REWRITE_TAC[def_array.(i); def_array.(0)] THEN + REWRITE_TAC[ARITH_ZERO; ARITH_ADD; ADD_0_n; ADD_n_0]);; + +let def_thm_array = Array.init maximum def_thm;; + + +let B0_0 = prove(mk_eq(mk_comb(b0_const, zero_const), zero_const), + REWRITE_TAC[b0_def; ARITH_ZERO]);; + +let B0_EXPLICIT = prove(mk_eq(mk_comb(b0_const, n_var_num), + mk_binop mul_op_num max_const n_var_num), + REWRITE_TAC[b0_def] THEN + GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [BIT0] THEN + ARITH_TAC);; + + + + + +(******************************) + +(* mk_numeral and dest_numeral *) + + +(* mk_table *) + +let mk_table = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + Hashtbl.add mk_table (Int i) const_array.(i) +done;; + + +(* mk_numeral *) +let max_num = Int maximum;; +let mask64 = Int64.of_int mask;; + +let mk_numeral_hash = + let rec mk_num n = + if (n =/ num_0) then + zero_const + else + let m = mod_num n max_num in + let bit = Hashtbl.find mk_table m in + mk_comb(bit, mk_num(quo_num n max_num)) in + fun n -> if n if n if n < 0 then failwith "mk_small_numeral_array: negative argument" + else mk_comb (num_const, mk_num n);; + + +let mk_int64_numeral_array = + let rec mk_num n = + if (n = 0L) then zero_const + else + let m = Int64.to_int (Int64.logand n mask64) in + let bit = const_array.(m) in + mk_comb(bit, mk_num(Int64.shift_right n bits)) in + fun n -> if n < 0L then failwith "mk_int64_numeral_array: negative argument" + else mk_comb (num_const, mk_num n);; + + + +(* +test 10000 mk_numeral_hash (Int 65535);; (* 0.736 *) +test 10000 mk_numeral_array (Int 65535);; (* 0.728 *) +test 100000 mk_small_numeral_array 65535;; (* 0.216 *) +test 100000 mk_int64_numeral_array 65535L;; (* 0.264 *) + +test 1000 mk_numeral_array (num_of_string "9111111111111111");; (* 0.288 *) +test 1000 mk_int64_numeral_array 9111111111111111L;; (* 0.012 *) +*) + + + +(* dest_table *) + +let dest_table_num = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + Hashtbl.add dest_table_num names_array.(i) (Int i) +done;; + + +let dest_table_int64 = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + Hashtbl.add dest_table_int64 names_array.(i) (Int64.of_int i) +done;; + + + +(* dest_numeral *) + +let max_num = Int maximum;; + + +let rec raw_dest_hash tm = + if tm = zero_const then + num_0 + else + let l, r = dest_comb tm in + let n = max_num */ raw_dest_hash r in + let cn = fst(dest_const l) in + n +/ (Hashtbl.find dest_table_num cn);; + + +let dest_numeral_hash tm = raw_dest_hash (rand tm);; + + +let dest_numeral64_hash tm = + let rec dest_num tm = + if (tm = zero_const) then + 0L + else + let l, r = dest_comb tm in + let n = Int64.shift_left (dest_num r) bits in + let cn = fst(dest_const l) in + Int64.add n (Hashtbl.find dest_table_int64 cn) in + dest_num (rand tm);; + + + +(* +test 100000 dest_numeral_hash (mk_numeral_array (Int 11111111));; (* 5: 0.572 *) +test 100000 dest_numeral64_hash (mk_numeral_array (Int 11111111));; (* 5: 0.264 *) +*) + + + +(******************************) + +(* NUMERAL_TO_NUM_CONV: coverts usual HOL numerals into k-bit numerals *) + + +let th_num_conv = Array.init maximum (fun i -> (SYM o SPEC_ALL) def_array.(i));; + +let th_part_num_conv = Array.init maximum + (fun i -> REWRITE_RULE[ARITH_ZERO] (INST [zero_const, n_var_num] th_num_conv.(i)));; + +th_part_num_conv.(0) <- REFL zero_const;; + + + +let NUMERAL_TO_NUM_CONV tm = + let rec find_match tm i level = + if (level >= bits) then + if (tm = zero_const) then + INST [zero_const, n_var_num] th_num_conv.(i) + else + let th = INST[tm, n_var_num] th_num_conv.(i) in + let ltm, rtm = dest_comb (rand (concl th)) in + TRANS th (AP_TERM ltm (find_match rtm 0 0)) + else if (tm = zero_const) then + INST [zero_const, n_var_num] th_part_num_conv.(i) + else + let btm, ntm = dest_comb tm in + let cn = fst(dest_const btm) in + if (cn = "BIT0") then + find_match ntm i (level + 1) + else if (cn = "BIT1") then + find_match ntm (i lor (1 lsl level)) (level + 1) + else failwith("NUMERAL_TO_NUM_CONV") in + let ltm, rtm = dest_comb tm in + if (ltm = numeral_const) then + MK_COMB (num_def_sym, find_match rtm 0 0) + else failwith("NUMERAL_TO_NUM_CONV");; + + +let replace_numerals = rand o concl o DEPTH_CONV NUMERAL_TO_NUM_CONV;; +let REPLACE_NUMERALS = CONV_RULE (DEPTH_CONV NUMERAL_TO_NUM_CONV);; +(* NUM_TO_NUMERAL_CONV *) + + +let th_part_num_table = Hashtbl.create maximum;; + +for i = 1 to maximum - 1 do + Hashtbl.add th_part_num_table names_array.(i) (SYM th_part_num_conv.(i)) +done;; + + + +let NUM_TO_NUMERAL_CONV tm = + let rec bits_to_num tm = + if (tm = zero_const) then + REFL zero_const + else + let btm, ntm = dest_comb tm in + let cn = fst(dest_const btm) in + if ntm = zero_const then + Hashtbl.find th_part_num_table cn + else + let th0 = Hashtbl.find def_basic_table cn in + let th1 = bits_to_num ntm in + let th = MK_COMB(th0, th1) in + TRANS th (BETA_CONV (rand(concl th))) in + let ltm, rtm = dest_comb tm in + if (ltm = num_const) then + MK_COMB(num_def, bits_to_num rtm) + else + failwith("NUM_TO_NUMERAL_CONV");; + + + +(*************************) + +(* SUC_CONV *) + +let suc_const = `SUC`;; + +(* Theorems *) + +let SUC_NUM = prove(mk_eq(mk_comb(suc_const, mk_comb (num_const, n_var_num)), + mk_comb(num_const, mk_comb (suc_const, n_var_num))), + REWRITE_TAC[num_def; NUMERAL]);; + +let SUC_0 = prove(mk_eq(`SUC _0`, mk_comb (const_array.(1), zero_const)), + REWRITE_TAC[def_array.(1); ARITH_SUC; ARITH_ZERO]);; + + +let suc_th i = + let cflag = (i + 1 >= maximum) in + let suc = if (cflag) then 0 else i + 1 in + let lhs = mk_comb(suc_const, (mk_comb (const_array.(i), n_var_num))) in + let rhs = mk_comb(const_array.(suc), + if (cflag) then mk_comb(suc_const, n_var_num) else n_var_num) in + let proof = REWRITE_TAC [def_array.(i); def_array.(suc); ARITH_SUC] in + prove(mk_eq(lhs, rhs), proof);; + + +let th_suc_array = Array.init maximum suc_th;; + +let th_suc_table = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + Hashtbl.add th_suc_table names_array.(i) th_suc_array.(i) +done;; + +let SUC_MAX = th_suc_array.(maximum - 1);; +let bit_max_name = names_array.(maximum - 1);; + + +(* Conversion *) + +let rec raw_suc_conv_hash tm = + let otm = rand tm in + if (otm = zero_const) then + SUC_0 + else + let btm, ntm = dest_comb otm in + let cn = fst(dest_const btm) in + if (cn = bit_max_name) then + let th = INST [ntm, n_var_num] SUC_MAX in + let ltm, rtm = dest_comb(rand(concl th)) in + TRANS th (AP_TERM ltm (raw_suc_conv_hash rtm)) + else + INST [ntm, n_var_num] (Hashtbl.find th_suc_table cn);; + + + +let NUM_SUC_HASH_CONV tm = + let ntm = rand (rand tm) in + let th = INST [ntm, n_var_num] SUC_NUM in + let lhs, rhs = dest_eq(concl th) in + if (lhs <> tm) then failwith("NUM_SUC_HASH_CONV") + else + let ltm, rtm = dest_comb rhs in + TRANS th (AP_TERM ltm (raw_suc_conv_hash rtm));; + + + + + +(* +let x = mk_comb(suc_const, mk_small_numeral_array 65535);; +test 50000 NUM_SUC_HASH_CONV x;; (* 5: 0.980 *) +*) + + +(**************************************) + +(* EQ_0_CONV *) + +let EQ_0_NUM = prove(mk_eq(mk_eq(mk_comb(num_const, n_var_num), `_0`), `n = _0`), + REWRITE_TAC[num_def; NUMERAL]);; + +let EQ_B0_0 = prove(mk_eq(mk_eq(mk_comb(b0_const, n_var_num), `_0`), `n = _0`), + REWRITE_TAC[b0_def; ARITH_EQ]);; + +let EQ_0_0 = prove(`_0 = _0 <=> T`, REWRITE_TAC[ARITH_EQ]);; + +let eq_0_i i = + let concl = mk_eq(mk_eq(mk_comb(const_array.(i), n_var_num), zero_const), false_const) in + prove(concl, REWRITE_TAC[def_array.(i); ARITH_EQ]);; + + + +let th_eq0_array = Array.init maximum (fun i -> if (i = 0) then EQ_0_0 else eq_0_i i);; + +let th_eq0_table = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + Hashtbl.add th_eq0_table names_array.(i) th_eq0_array.(i) +done;; + + + +let rec raw_eq0_hash_conv rtm = + if (rtm = zero_const) then + EQ_0_0 + else + let b_tm, n_tm = dest_comb rtm in + let cn = (fst o dest_const) b_tm in + if (cn = b0_name) then + let th0 = INST[n_tm, n_var_num] EQ_B0_0 in + let th1 = raw_eq0_hash_conv n_tm in + TRANS th0 th1 + else + INST[n_tm, n_var_num] (Hashtbl.find th_eq0_table cn);; + + + +let NUM_EQ0_HASH_CONV rtm = + let n_tm = rand rtm in + let th = INST [n_tm, n_var_num] EQ_0_NUM in + TRANS th (raw_eq0_hash_conv n_tm);; + + + +(**************************************) + +(* PRE_CONV *) + +let pre_const = `PRE`;; + +(* Theorems *) + +let PRE_NUM = prove(mk_eq(mk_comb(pre_const, mk_comb (num_const, n_var_num)), + mk_comb(num_const, mk_comb (pre_const, n_var_num))), + REWRITE_TAC[num_def; NUMERAL]);; + + +let PRE_0 = prove(`PRE _0 = _0`, + MP_TAC (CONJUNCT1 PRE) THEN SIMP_TAC[NUMERAL]);; + +let PRE_B1_0 = prove(mk_eq(mk_comb(`PRE`, mk_comb(const_array.(1), `_0`)), `_0`), + REWRITE_TAC[def_array.(1); ARITH_PRE; ARITH_EQ]);; + +let PRE_B0_n0 = (UNDISCH_ALL o prove)(mk_imp(`n = _0 <=> T`, + mk_eq(mk_comb(`PRE`, mk_comb(b0_const, `n:num`)), `_0`)), + REWRITE_TAC[def_array.(0); ARITH_PRE; ARITH_EQ] THEN SIMP_TAC[]);; + + +let PRE_B0_n1 = (UNDISCH_ALL o prove)(mk_imp(`n = _0 <=> F`, + mk_eq(mk_comb(`PRE`, mk_comb(b0_const, `n:num`)), + mk_comb(const_array.(maximum - 1), `PRE n`))), + REWRITE_TAC[def_array.(0); def_array.(maximum - 1); ARITH_PRE; ARITH_EQ] THEN SIMP_TAC[]);; + + + +let pre_th i = + let pre = i - 1 in + let lhs = mk_comb(pre_const, (mk_comb (const_array.(i), n_var_num))) in + let rhs = mk_comb(const_array.(pre), n_var_num) in + let proof = REWRITE_TAC [def_array.(i); def_array.(pre); ARITH_PRE; ARITH_EQ] in + prove(mk_eq(lhs, rhs), proof);; + + +let th_pre_array = Array.init maximum (fun i -> if i = 0 then REFL `_0` else pre_th i);; + +let th_pre_table = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + Hashtbl.add th_pre_table names_array.(i) th_pre_array.(i) +done;; + + +(* Conversion *) +let b1_name = names_array.(1);; +let b1_pre_thm = th_pre_array.(1);; + +let rec raw_pre_hash_conv tm = + let otm = rand tm in + if (otm = zero_const) then + PRE_0 + else + let btm, ntm = dest_comb otm in + let cn = fst(dest_const btm) in + if (cn = b0_name) then + let n_th = raw_eq0_hash_conv ntm in + if (rand(concl n_th) = false_const) then + let th0 = INST[ntm, n_var_num] PRE_B0_n1 in + let th1 = MY_PROVE_HYP n_th th0 in + let ltm, rtm = dest_comb(rand(concl th1)) in + let th2 = raw_pre_hash_conv rtm in + TRANS th1 (AP_TERM ltm th2) + else + let th = INST[ntm, n_var_num] PRE_B0_n0 in + MY_PROVE_HYP n_th th + else + if (cn = b1_name) then + if (ntm = zero_const) then + PRE_B1_0 + else + INST[ntm, n_var_num] b1_pre_thm + else + INST [ntm, n_var_num] (Hashtbl.find th_pre_table cn);; + + + +let NUM_PRE_HASH_CONV tm = + let ntm = rand (rand tm) in + let th = INST [ntm, n_var_num] PRE_NUM in + let lhs, rhs = dest_eq(concl th) in + if (lhs <> tm) then failwith("NUM_PRE_HASH_CONV") + else + let ltm, rtm = dest_comb rhs in + TRANS th (AP_TERM ltm (raw_pre_hash_conv rtm));; + + +(* +let x = mk_comb(pre_const, mk_small_numeral_array 65535);; +(* 8: 0.444 *) +test 50000 NUM_PRE_HASH_CONV x;; +let x = mk_comb(pre_const, mk_small_numeral_array 65536);; +(* 8: 1.752 *) +test 50000 NUM_PRE_HASH_CONV x;; +*) + + + + +(**************************************) + +(* GT0_CONV *) + + +let gt0_table = Hashtbl.create maximum;; + +let GT0_NUM = (REWRITE_RULE[GSYM num_def] o prove)(`0 < NUMERAL n <=> _0 < n`, REWRITE_TAC[NUMERAL]);; + +let gt0_0 = prove(`_0 < _0 <=> F`, REWRITE_TAC[ARITH_LT]);; +let gt0_b0 = prove(mk_eq (mk_binop lt_op_num zero_const (mk_comb(b0_const, n_var_num)), `_0 < n`), + REWRITE_TAC[b0_def; ARITH_LT]);; + + + +let gt0_th i = + let bi = const_array.(i) in + let concl = mk_eq (mk_binop lt_op_num zero_const (mk_comb(bi, n_var_num)), truth_const) in + let proof = REWRITE_TAC[def_array.(i); ARITH_LT] in + prove(concl, proof);; + + +for i = 1 to maximum - 1 do + Hashtbl.add gt0_table names_array.(i) (gt0_th i) +done;; + + +let rec raw_gt0_hash_conv rtm = + if (rtm = zero_const) then + gt0_0 + else + let b_tm, n_tm = dest_comb rtm in + let cn = (fst o dest_const) b_tm in + if (cn = b0_name) then + let th0 = INST[n_tm, n_var_num] gt0_b0 in + let th1 = raw_gt0_hash_conv n_tm in + TRANS th0 th1 + else + INST[n_tm, n_var_num] (Hashtbl.find gt0_table cn);; + + + +let NUM_GT0_HASH_CONV rtm = + let n_tm = rand rtm in + let th = INST [n_tm, n_var_num] GT0_NUM in + TRANS th (raw_gt0_hash_conv n_tm);; + + + +(* +let tm = `0 < 65536`;; +let tm' = rand (replace_numerals tm);; + +(* 3.704 *) +test 10000 NUM_LT_CONV tm;; +(* 0.112 *) +test 10000 NUM_GT0_HASH_CONV tm';; +*) + + + +(*************************************) + +(* LT and LE *) + +let LT_NUM = (REWRITE_RULE[SYM num_def] o prove)(`NUMERAL m < NUMERAL n <=> m < n`, REWRITE_TAC[NUMERAL]);; +let LE_NUM = (REWRITE_RULE[SYM num_def] o prove)(`NUMERAL m <= NUMERAL n <=> m <= n`, REWRITE_TAC[NUMERAL]);; + +let LT_n_0 = prove(`n < _0 <=> F`, + SUBGOAL_THEN `_0 = 0` MP_TAC THENL [ REWRITE_TAC[NUMERAL]; ALL_TAC ] THEN + DISCH_THEN (fun th -> PURE_ONCE_REWRITE_TAC[th]) THEN + ARITH_TAC);; + +let LE_0_n = prove(`_0 <= n <=> T`, + SUBGOAL_THEN `_0 = 0` MP_TAC THENL [ REWRITE_TAC[NUMERAL]; ALL_TAC ] THEN + DISCH_THEN (fun th -> PURE_ONCE_REWRITE_TAC[th]) THEN + ARITH_TAC);; + +let SUC_LT_THM = ARITH_RULE `SUC m < SUC n <=> m < n`;; +let SUC_LE_THM = ARITH_RULE `SUC m <= SUC n <=> m <= n`;; + + + +(* LT tables *) + +(* Generates the theorem |- _0 < bi(n) <=> T (or |- _0 < b0(n) <=> _0 < n) *) +let gen_0_lt_bi i = + let bin = mk_comb (const_array.(i), n_var_num) in + let lt_tm = mk_binop lt_op_num zero_const bin in + REWRITE_CONV[def_array.(i); ARITH_LT; ARITH_LE] lt_tm;; + + +let th_lt0_table = Hashtbl.create maximum;; +for i = 0 to maximum - 1 do + let th = gen_0_lt_bi i in + let name = names_array.(i) in + Hashtbl.add th_lt0_table name th +done;; + + + + +(* Generates the theorem |- bi(m) < bj(n) <=> m <= n (or m < n) *) +let gen_bi_lt_bj i j = + let bim = mk_comb (const_array.(i), m_var_num) in + let bjn = mk_comb (const_array.(j), n_var_num) in + let lt_tm = mk_binop lt_op_num bim bjn in + REWRITE_CONV[def_array.(i); def_array.(j); ARITH_LT; ARITH_LE] lt_tm;; + + +(* Given a theorem |- bi(m) < bj(n) <=> P m n, generates the theorem + |- SUC(bi(m)) < SUC(bj(n)) <=> P m n *) +let gen_next_lt_thm th = + let ltm, n_tm = (dest_comb o lhand o concl) th in + let m_tm = rand ltm in + let th0 = INST[m_tm, m_var_num; n_tm, n_var_num] SUC_LT_THM in + let suc_m = raw_suc_conv_hash (mk_comb (suc_const, m_tm)) in + let suc_n = raw_suc_conv_hash (mk_comb (suc_const, n_tm)) in + let th1 = SYM (MK_COMB ((AP_TERM lt_op_num suc_m), suc_n)) in + TRANS (TRANS th1 th0) th;; + + + + +let th_lt_table = Hashtbl.create (maximum * maximum);; + + +for i = 0 to maximum - 1 do + let th = ref (gen_bi_lt_bj 0 i) in + let name_left = names_array.(0) and + name_right = names_array.(i) in + let _ = Hashtbl.add th_lt_table (name_left ^ name_right) !th in + + for k = 1 to maximum - i - 1 do + let x = k and y = i + k in + let name_left = names_array.(x) and + name_right = names_array.(y) in + th := gen_next_lt_thm (!th); + Hashtbl.add th_lt_table (name_left ^ name_right) !th + done; +done;; + + +for i = 1 to maximum - 1 do + let th = ref (gen_bi_lt_bj i 0) in + let name_left = names_array.(i) and + name_right = names_array.(0) in + let _ = Hashtbl.add th_lt_table (name_left ^ name_right) !th in + + for k = 1 to maximum - i - 1 do + let x = i + k and y = k in + let name_left = names_array.(x) and + name_right = names_array.(y) in + th := gen_next_lt_thm (!th); + Hashtbl.add th_lt_table (name_left ^ name_right) !th + done; +done;; + + + + +(* LE tables *) + + +(* Generates the theorem |- bi(n) <= _0 <=> F (or |- b0(n) <= _0 <=> n <= _0) *) +let gen_bi_le_0 i = + let bin = mk_comb (const_array.(i), n_var_num) in + let lt_tm = mk_binop le_op_num bin zero_const in + REWRITE_CONV[def_array.(i); ARITH_LT; ARITH_LE] lt_tm;; + + +let th_le0_table = Hashtbl.create maximum;; +for i = 0 to maximum - 1 do + let th = gen_bi_le_0 i in + let name = names_array.(i) in + Hashtbl.add th_le0_table name th +done;; + + + + +(* Generates the theorem |- bi(m) <= bj(n) <=> m <= n (or m < n) *) +let gen_bi_le_bj i j = + let bim = mk_comb (const_array.(i), m_var_num) in + let bjn = mk_comb (const_array.(j), n_var_num) in + let lt_tm = mk_binop le_op_num bim bjn in + REWRITE_CONV[def_array.(i); def_array.(j); ARITH_LT; ARITH_LE] lt_tm;; + + +(* Given a theorem |- bi(m) <= bj(n) <=> P m n, generates the theorem + |- SUC(bi(m)) <= SUC(bj(n)) <=> P m n *) +let gen_next_le_thm th = + let ltm, n_tm = (dest_comb o lhand o concl) th in + let m_tm = rand ltm in + let th0 = INST[m_tm, m_var_num; n_tm, n_var_num] SUC_LE_THM in + let suc_m = raw_suc_conv_hash (mk_comb (suc_const, m_tm)) in + let suc_n = raw_suc_conv_hash (mk_comb (suc_const, n_tm)) in + let th1 = SYM (MK_COMB ((AP_TERM le_op_num suc_m), suc_n)) in + TRANS (TRANS th1 th0) th;; + + + +let th_le_table = Hashtbl.create (maximum * maximum);; + + +for i = 0 to maximum - 1 do + let th = ref (gen_bi_le_bj 0 i) in + let name_left = names_array.(0) and + name_right = names_array.(i) in + let _ = Hashtbl.add th_le_table (name_left ^ name_right) !th in + + for k = 1 to maximum - i - 1 do + let x = k and y = i + k in + let name_left = names_array.(x) and + name_right = names_array.(y) in + th := gen_next_le_thm (!th); + Hashtbl.add th_le_table (name_left ^ name_right) !th + done; +done;; + + +for i = 1 to maximum - 1 do + let th = ref (gen_bi_le_bj i 0) in + let name_left = names_array.(i) and + name_right = names_array.(0) in + let _ = Hashtbl.add th_le_table (name_left ^ name_right) !th in + + for k = 1 to maximum - i - 1 do + let x = i + k and y = k in + let name_left = names_array.(x) and + name_right = names_array.(y) in + th := gen_next_le_thm (!th); + Hashtbl.add th_le_table (name_left ^ name_right) !th + done; +done;; + + +(* Conversions *) + +let rec raw_lt_hash_conv tm = + let ltm, rtm = dest_comb tm in + let ltm = rand ltm in + if is_const rtm then + (* n < _0 <=> F *) + INST[ltm, n_var_num] LT_n_0 + else + if is_const ltm then + (* _0 < Bi(n) *) + let bn_tm, n_tm = dest_comb rtm in + let cbn = (fst o dest_const) bn_tm in + let th0 = INST[n_tm, n_var_num] (Hashtbl.find th_lt0_table cbn) in + if cbn = b0_name then + let th1 = raw_lt_hash_conv (rand (concl th0)) in + TRANS th0 th1 + else + th0 + else + (* Bi(n) < Bj(m) *) + let bm_tm, m_tm = dest_comb ltm in + let bn_tm, n_tm = dest_comb rtm in + let cbm = (fst o dest_const) bm_tm in + let cbn = (fst o dest_const) bn_tm in + let th0 = INST[m_tm, m_var_num; n_tm, n_var_num] (Hashtbl.find th_lt_table (cbm^cbn)) in + let op = (fst o dest_const o rator o rator o rand o concl) th0 in + let th1 = + if op = "<" then + raw_lt_hash_conv (rand (concl th0)) + else + raw_le_hash_conv (rand (concl th0)) in + TRANS th0 th1 and + + raw_le_hash_conv tm = + let ltm, rtm = dest_comb tm in + let ltm = rand ltm in + if is_const ltm then + (* _0 <= n <=> T *) + INST[rtm, n_var_num] LE_0_n + else + if is_const rtm then + (* Bi(n) <= _0 *) + let bn_tm, n_tm = dest_comb ltm in + let cbn = (fst o dest_const) bn_tm in + let th0 = INST[n_tm, n_var_num] (Hashtbl.find th_le0_table cbn) in + if cbn = b0_name then + let th1 = raw_le_hash_conv (rand (concl th0)) in + TRANS th0 th1 + else + th0 + else + (* Bi(n) <= Bj(m) *) + let bm_tm, m_tm = dest_comb ltm in + let bn_tm, n_tm = dest_comb rtm in + let cbm = (fst o dest_const) bm_tm in + let cbn = (fst o dest_const) bn_tm in + let th0 = INST[m_tm, m_var_num; n_tm, n_var_num] (Hashtbl.find th_le_table (cbm^cbn)) in + let op = (fst o dest_const o rator o rator o rand o concl) th0 in + let th1 = + if op = "<" then + raw_lt_hash_conv (rand (concl th0)) + else + raw_le_hash_conv (rand (concl th0)) in + TRANS th0 th1;; + + + +let NUM_LT_HASH_CONV tm = + let atm, rtm = dest_comb tm in + let ltm = rand atm in + let th = INST [rand ltm, m_var_num; rand rtm, n_var_num] LT_NUM in + let rtm = rand(concl th) in + TRANS th (raw_lt_hash_conv rtm);; + + + +let NUM_LE_HASH_CONV tm = + let atm, rtm = dest_comb tm in + let ltm = rand atm in + let th = INST [rand ltm, m_var_num; rand rtm, n_var_num] LE_NUM in + let rtm = rand(concl th) in + TRANS th (raw_le_hash_conv rtm);; + + + +(* +let x = num_of_string "3543593547359325353535";; +let y = num_of_string "9392392983247294924242";; + +let xx = mk_binop lt_op_num (mk_numeral_array x) (mk_numeral_array y);; +let yy = mk_binop lt_op_num (mk_numeral x) (mk_numeral y);; + + +(* 8: 2.352 *) +test 1000 NUM_LT_CONV yy;; +(* 8: 0.644 *) +test 10000 NUM_LT_HASH_CONV xx;; +*) + + + + +(**************************************) + +(* ADD_CONV *) + + +(* ADD theorems *) + +let ADD_NUM = prove(mk_eq(mk_binop plus_op_num (mk_comb (num_const, m_var_num)) (mk_comb (num_const, n_var_num)), + mk_comb(num_const, mk_binop plus_op_num m_var_num n_var_num)), + REWRITE_TAC[num_def; NUMERAL]);; + +let CADD_0_n = prove(`SUC (_0 + n) = SUC n`, REWRITE_TAC[ADD_0_n]);; +let CADD_n_0 = prove(`SUC (n + _0) = SUC n`, REWRITE_TAC[ADD_n_0]);; + +(* B0 (SUC n) = B0 n + maximum *) +let B0_SUC = prove(mk_eq(mk_comb(b0_const, mk_comb(suc_const, n_var_num)), + mk_binop plus_op_num max_const (mk_comb(b0_const, n_var_num))), + REWRITE_TAC [B0_EXPLICIT] THEN ARITH_TAC);; + +let B0_ADD = prove(mk_eq(mk_binop plus_op_num (mk_comb(b0_const, m_var_num)) (mk_comb(b0_const, n_var_num)), + mk_comb(b0_const, mk_binop plus_op_num m_var_num n_var_num)), + REWRITE_TAC[B0_EXPLICIT] THEN ARITH_TAC);; + +let SUC_ADD_RIGHT = prove(`SUC(m + n) = m + SUC n`, ARITH_TAC);; + + +(* Generate all theorems iteratively *) + +let th_add_right_next th = + let lhs, rhs = dest_eq(concl th) in + let ltm, rtm = dest_comb rhs in + let cn = fst(dest_const ltm) in + let suc_th = AP_TERM suc_const th in + let th_rhs = INST[rtm, n_var_num] (Hashtbl.find th_suc_table cn) in + let ltm, rarg = dest_comb lhs in + let larg = rand ltm in + let th1 = INST[larg, m_var_num; rarg, n_var_num] SUC_ADD_RIGHT in + let cn = fst(dest_const(rator rarg)) in + let th2 = Hashtbl.find th_suc_table cn in + let th_lhs = TRANS th1 (AP_TERM ltm th2) in + TRANS (TRANS (SYM th_lhs) suc_th) th_rhs;; + + +let th_add_array = Array.make (maximum * maximum) (REFL zero_const);; + +for i = 0 to maximum - 1 do + let th0 = + if i = 0 then + B0_ADD + else + INST[n_var_num, m_var_num; m_var_num, n_var_num] + (ONCE_REWRITE_RULE[ADD_AC] th_add_array.(i)) in + let _ = th_add_array.(i * maximum) <- th0 in + + for j = 1 to maximum - 1 do + th_add_array.(i * maximum + j) <- th_add_right_next th_add_array.(i * maximum + j - 1) + done; +done;; + + + +(* SUC (B_i(m) + B_j(n)) = B_p(...) *) +let th_cadd i j = + let add_th = th_add_array.(i * maximum + j) in + let th0 = AP_TERM suc_const add_th in + let ltm, rtm = dest_comb(rand(concl th0)) in + let ltm, rtm = dest_comb rtm in + let cn = fst(dest_const ltm) in + let suc_th = INST[rtm, n_var_num] (Hashtbl.find th_suc_table cn) in + TRANS th0 suc_th;; + + +let th_cadd_array = Array.make (maximum * maximum) (REFL zero_const);; + +for i = 0 to maximum - 1 do + for j = 0 to maximum - 1 do + th_cadd_array.(i * maximum + j) <- th_cadd i j + done; +done;; + + + +let th_add_table = Hashtbl.create (maximum * maximum);; + +for i = 0 to maximum - 1 do + for j = 0 to maximum - 1 do + let name = names_array.(i) ^ names_array.(j) in + let th = th_add_array.(i * maximum + j) in + let cflag = (i + j >= maximum) in + Hashtbl.add th_add_table name (th, cflag) + done; +done;; + + + +let th_cadd_table = Hashtbl.create (maximum * maximum);; + +for i = 0 to maximum - 1 do + for j = 0 to maximum - 1 do + let name = names_array.(i) ^ names_array.(j) in + let th = th_cadd_array.(i * maximum + j) in + let cflag = (i + j + 1 >= maximum) in + Hashtbl.add th_cadd_table name (th, cflag) + done; +done;; + + + +(* ADD conversion *) + + +let rec raw_add_conv_hash tm = + let atm,rtm = dest_comb tm in + let ltm = rand atm in + if ltm = zero_const then + INST [rtm,n_var_num] ADD_0_n + else if rtm = zero_const then + INST [ltm,n_var_num] ADD_n_0 + else + let lbit,larg = dest_comb ltm + and rbit,rarg = dest_comb rtm in + let name = fst(dest_const lbit) ^ fst(dest_const rbit) in + let th0, cflag = Hashtbl.find th_add_table name in + let th = INST [larg, m_var_num; rarg, n_var_num] th0 in + let ltm, rtm = dest_comb(rand(concl th)) in + if cflag then + TRANS th (AP_TERM ltm (raw_adc_conv_hash rtm)) + else + TRANS th (AP_TERM ltm (raw_add_conv_hash rtm)) +and raw_adc_conv_hash tm = + let atm,rtm = dest_comb (rand tm) in + let ltm = rand atm in + if ltm = zero_const then + let th = INST [rtm,n_var_num] CADD_0_n in + TRANS th (raw_suc_conv_hash (rand(concl th))) + else if rtm = zero_const then + let th = INST [ltm,n_var_num] CADD_n_0 in + TRANS th (raw_suc_conv_hash (rand(concl th))) + else + let lbit,larg = dest_comb ltm + and rbit,rarg = dest_comb rtm in + let name = fst(dest_const lbit) ^ fst(dest_const rbit) in + let th0, cflag = Hashtbl.find th_cadd_table name in + let th = INST [larg, m_var_num; rarg, n_var_num] th0 in + let ltm, rtm = dest_comb(rand(concl th)) in + if cflag then + TRANS th (AP_TERM ltm (raw_adc_conv_hash rtm)) + else + TRANS th (AP_TERM ltm (raw_add_conv_hash rtm));; + + +let NUM_ADD_HASH_CONV tm = + let atm, rtm = dest_comb tm in + let ltm = rand atm in + let th = INST [rand ltm, m_var_num; rand rtm, n_var_num] ADD_NUM in + let ltm, rtm = dest_comb(rand(concl th)) in + TRANS th (AP_TERM ltm (raw_add_conv_hash rtm));; + + +(* +let x = num_of_string "3543593547359325353535";; +let y = num_of_string "9392392983247294924242";; + +let xx = mk_binop plus_op_num (mk_numeral_array x) (mk_numeral_array y);; +let yy = mk_binop plus_op_num (mk_numeral x) (mk_numeral y);; + +test 10000 NUM_ADD_CONV yy;; (* 5.672 *) +test 10000 NUM_ADD_HASH_CONV xx;; (* 8: 0.728 *) +*) + +(********************************) + +(* Subtraction *) + +let SUB_NUM = prove(mk_eq(mk_binop minus_op_num (mk_comb (num_const, m_var_num)) (mk_comb (num_const, n_var_num)), + mk_comb(num_const, mk_binop minus_op_num m_var_num n_var_num)), + REWRITE_TAC[num_def; NUMERAL]);; + +let SUB_lemma1 = (UNDISCH_ALL o ARITH_RULE) `n + t = m ==> m - n = t:num`;; +let SUB_lemma2 = (UNDISCH_ALL o REWRITE_RULE[NUMERAL] o ARITH_RULE) `m + t = n ==> m - n = 0`;; +let LE_lemma = (UNDISCH_ALL o ARITH_RULE) `n + t = m ==> n <= m:num`;; + + +let raw_sub_hash_conv tm = + let ltm, n_tm = dest_comb tm in + let m_tm = rand ltm in + let m = raw_dest_hash m_tm in + let n = raw_dest_hash n_tm in + let t = m -/ n in + if t >=/ num_0 then + let t_tm = rand (mk_numeral_array t) in + let th0 = INST[n_tm, n_var_num; t_tm, t_var_num; m_tm, m_var_num] SUB_lemma1 in + let th_add = raw_add_conv_hash (mk_binop plus_op_num n_tm t_tm) in + MY_PROVE_HYP th_add th0 + else + let t_tm = rand (mk_numeral_array (Num.abs_num t)) in + let th0 = INST[m_tm, m_var_num; t_tm, t_var_num; n_tm, n_var_num] SUB_lemma2 in + let th_add = raw_add_conv_hash (mk_binop plus_op_num m_tm t_tm) in + MY_PROVE_HYP th_add th0;; + + + +(* Returns either (tm1 - tm2, tm2 <= tm1) or (tm2 - tm1, tm1 <= tm2) *) +let raw_sub_and_le_hash_conv tm1 tm2 = + let m = raw_dest_hash tm1 in + let n = raw_dest_hash tm2 in + let t = m -/ n in + if t >=/ num_0 then + let t_tm = rand (mk_numeral_array t) in + let inst = INST[tm2, n_var_num; t_tm, t_var_num; tm1, m_var_num] in + let th_sub = inst SUB_lemma1 in + let th_le = inst LE_lemma in + let th_add = raw_add_conv_hash (mk_binop plus_op_num tm2 t_tm) in + (MY_PROVE_HYP th_add th_sub, MY_PROVE_HYP th_add th_le) + else + let t_tm = rand (mk_numeral_array (Num.abs_num t)) in + let inst = INST[tm2, m_var_num; t_tm, t_var_num; tm1, n_var_num] in + let th_sub = inst SUB_lemma1 in + let th_le = inst LE_lemma in + let th_add = raw_add_conv_hash (mk_binop plus_op_num tm1 t_tm) in + (MY_PROVE_HYP th_add th_sub, MY_PROVE_HYP th_add th_le);; + + + +let NUM_SUB_HASH_CONV tm = + let atm, rtm = dest_comb tm in + let ltm = rand atm in + let th = INST [rand ltm, m_var_num; rand rtm, n_var_num] SUB_NUM in + let ltm, rtm = dest_comb(rand(concl th)) in + TRANS th (AP_TERM ltm (raw_sub_hash_conv rtm));; + + +(* +let y = num_of_string "3543593547359325353535";; +let x = num_of_string "9392392983247294924242";; + +let xx = mk_binop minus_op_num (mk_numeral_array x) (mk_numeral_array y);; +let yy = mk_binop minus_op_num (mk_numeral x) (mk_numeral y);; + +test 1000 NUM_SUB_CONV yy;; (* 2.376 *) +test 1000 NUM_SUB_HASH_CONV xx;; (* 4: 0.692 *) +*) + + + +(********************************) + +(* Multiplication *) + +let MUL_NUM = prove(mk_eq(mk_binop mul_op_num (mk_comb(num_const, m_var_num)) (mk_comb(num_const, n_var_num)), + mk_comb(num_const, mk_binop mul_op_num m_var_num n_var_num)), + REWRITE_TAC[num_def; NUMERAL]);; + +let MUL_0_n = prove(`_0 * n = _0`, ONCE_REWRITE_TAC[GSYM NUM_THM] THEN + ONCE_REWRITE_TAC[GSYM MUL_NUM] THEN REWRITE_TAC[num_def] THEN + REWRITE_TAC[MULT_CLAUSES]);; + +let MUL_n_0 = ONCE_REWRITE_RULE[MULT_AC] MUL_0_n;; + +let MUL_1_n, MUL_n_1 = + let one_const = mk_comb (const_array.(1), zero_const) in + let cond = mk_eq(mk_binop mul_op_num one_const n_var_num, n_var_num) in + let th = prove(cond, REWRITE_TAC[def_array.(1); ARITH_ZERO] THEN + ONCE_REWRITE_TAC[GSYM NUM_THM] THEN + ONCE_REWRITE_TAC[GSYM MUL_NUM] THEN + REWRITE_TAC[num_def] THEN + REWRITE_TAC[MULT_CLAUSES]) in + th, ONCE_REWRITE_RULE[MULT_AC] th;; + + +let MUL_BIT0_t = prove(`BIT0 n * t = BIT0 (n * t)`, REWRITE_TAC[BIT0; RIGHT_ADD_DISTRIB]);; + +let MUL_B0_t = prove(mk_eq(mk_binop mul_op_num (mk_comb(b0_const, n_var_num)) t_var_num, + mk_comb(b0_const, mk_binop mul_op_num n_var_num t_var_num)), + REWRITE_TAC[def_array.(0)] THEN REWRITE_TAC[MUL_BIT0_t]);; + +let MUL_t_B0 = ONCE_REWRITE_RULE[MULT_AC] MUL_B0_t;; + + +let MUL_SUC_RIGHT = prove(`m * SUC(n) = m * n + m`, ARITH_TAC);; + + +(* Multiplication table *) + +let mul_th_next_right th = + let ltm, rtm = dest_comb(rand(rator(concl th))) in + let mtm = rand ltm in + let th0 = INST[mtm, m_var_num; rtm, n_var_num] MUL_SUC_RIGHT in + let th1 = AP_THM (AP_TERM plus_op_num th) mtm in + let sum_th = raw_add_conv_hash (rand(concl th1)) in + let th2 = TRANS (TRANS th0 th1) sum_th in + let cn = fst(dest_const (rator rtm)) in + let th_suc = INST[zero_const, n_var_num] (Hashtbl.find th_suc_table cn) in + let th3 = AP_TERM (mk_comb (mul_op_num, mtm)) th_suc in + TRANS (SYM th3) th2;; + + +let mul_array = Array.make (maximum * maximum) (REFL zero_const);; +for i = 1 to maximum - 1 do + let th1 = INST[mk_comb(const_array.(i), zero_const), n_var_num] MUL_n_1 in + let _ = mul_array.(i * maximum + 1) <- th1 in + + for j = 2 to maximum - 1 do + mul_array.(i * maximum + j) <- mul_th_next_right mul_array.(i * maximum + j - 1) + done; +done;; + + +let mul_table = Hashtbl.create (maximum * maximum);; +for i = 1 to maximum - 1 do + for j = 1 to maximum - 1 do + Hashtbl.add mul_table (names_array.(i) ^ names_array.(j)) mul_array.(i * maximum + j) + done; +done;; + + +(* General multiplication theorem *) + +let prod_lemma = + let mul (a,b) = mk_binop mul_op_num a b and + add (a,b) = mk_binop plus_op_num a b in + let lhs = mul(add(t_var_num, mk_comb(b0_const, m_var_num)), + add(r_var_num, mk_comb(b0_const, n_var_num))) in + let rhs = add(mul(t_var_num, r_var_num), + mk_comb(b0_const, add(mk_comb(b0_const, mul(m_var_num, n_var_num)), + add(mul(m_var_num, r_var_num), + mul(n_var_num, t_var_num))))) in + prove(mk_eq(lhs, rhs), + REWRITE_TAC[LEFT_ADD_DISTRIB; RIGHT_ADD_DISTRIB] THEN + REWRITE_TAC[MUL_B0_t; MUL_t_B0] THEN + ONCE_REWRITE_TAC[GSYM ADD_ASSOC] THEN + REWRITE_TAC[th_add_array.(0)] THEN + REWRITE_TAC[ADD_AC; MULT_AC]);; + +let ADD_ASSOC' = SPEC_ALL ADD_ASSOC;; + +let dest_op tm = + let ltm, rtm = dest_comb tm in + rand ltm, rtm;; + + +(* B_i(m) * B_j(n) = B_p(B_q(m * n) + m * B_j(0) + n * B_i(0)) + where B_p(B_q(0)) = i * j *) +let gen_mul_thm i j = + let bi0 = mk_comb(const_array.(i), zero_const) and + bj0 = mk_comb(const_array.(j), zero_const) in + let def_i = INST[m_var_num, n_var_num] def_thm_array.(i) in + let def_j = def_thm_array.(j) in + let th0 = MK_COMB(AP_TERM mul_op_num def_i, def_j) in + let th1 = TRANS th0 (INST[bi0, t_var_num; bj0, r_var_num] prod_lemma) in + let mul_th = mul_array.(i * maximum + j) in + let larg, rarg = dest_op (rand (concl th1)) in + let th2 = TRANS th1 (AP_THM (AP_TERM plus_op_num mul_th) rarg) in + let larg = rand(concl mul_th) in + let b_low, b_high = dest_comb larg in + let rtm = rand(rarg) in + let th_add = INST[b_high, m_var_num; rtm, n_var_num] + (fst(Hashtbl.find th_add_table (fst(dest_const b_low)^b0_name))) in + if i * j < maximum then + let ltm, rtm = dest_op(rand(rand(concl th_add))) in + let add_0 = AP_TERM b_low (INST[rtm, n_var_num] ADD_0_n) in + TRANS th2 (TRANS th_add add_0) + else + let larg, rtm = dest_op (rand(rand(concl th_add))) in + let rarg, rtm = dest_op rtm in + let th_assoc = INST[larg, m_var_num; rarg, n_var_num; rtm, p_var_num] ADD_ASSOC' in + let mn = rand(rarg) in + let b_high = rator b_high in + let th_add2' = INST[zero_const, m_var_num; mn, n_var_num] + (fst(Hashtbl.find th_add_table (fst(dest_const b_high)^b0_name))) in + let add_0 = AP_TERM b_high (INST[mn, n_var_num] ADD_0_n) in + let th_add2 = TRANS th_add2' add_0 in + let th3 = TRANS th_assoc (AP_THM (AP_TERM plus_op_num th_add2) rtm) in + let th4 = TRANS th_add (AP_TERM b_low th3) in + TRANS th2 th4;; + + +let gen_mul_table = Hashtbl.create (maximum * maximum);; + +for i = 1 to maximum - 1 do + for j = 1 to maximum - 1 do + let name = names_array.(i) ^ names_array.(j) in + Hashtbl.add gen_mul_table name (gen_mul_thm i j) + done; +done;; + + +(* B_i(m) * B_j(0) = B_p(B_q(0) + m * B_j(0)) + where i * j = B_p(B_q(0)) *) +let mul1_right_th i j = + let th0 = INST[zero_const, n_var_num] + (Hashtbl.find gen_mul_table (names_array.(i)^names_array.(j))) in + let b_low, rtm = dest_comb(rand(concl th0)) in + let tm1, tm23 = dest_op rtm in + let tm2p, tm3 = dest_comb tm23 in + let tm3_th = INST[rand tm3, n_var_num] MUL_0_n in + let tm2_th = INST[rand(tm2p), n_var_num] ADD_n_0 in + let tm23_th = TRANS (AP_TERM tm2p tm3_th) tm2_th in + let ltm, rtm = dest_comb tm1 in + if (i * j < maximum) then + let tm1_th = TRANS (AP_TERM ltm (INST[m_var_num, n_var_num] MUL_n_0)) B0_0 in + let tm123_th' = TRANS (INST[tm23, n_var_num] ADD_0_n) tm23_th in + let tm123_th = TRANS (AP_THM (AP_TERM plus_op_num tm1_th) tm23) tm123_th' in + TRANS th0 (AP_TERM b_low tm123_th) + else + let tm1_th = AP_TERM ltm (INST[m_var_num, n_var_num] MUL_n_0) in + let tm123_th = MK_COMB(AP_TERM plus_op_num tm1_th, tm23_th) in + TRANS th0 (AP_TERM b_low tm123_th);; + + +(* B_j(0) * B_i(m) = B_p(B_q(0) + B_j(0) * B_i(m) *) + +let MULT_AC' = CONJUNCT1 MULT_AC;; + +let mul1_left_th th = + let lhs, rhs = dest_eq(concl th) in + let ltm, rtm = dest_op lhs in + let th_lhs = INST[ltm, n_var_num; rtm, m_var_num] MULT_AC' in + let btm, rtm = dest_comb rhs in + let larg, rarg = dest_op rtm in + if (is_comb larg) then + let ltm, rtm = dest_op rarg in + let th_rhs' = INST[ltm, m_var_num; rtm, n_var_num] MULT_AC' in + let th_rhs = AP_TERM (mk_comb(plus_op_num, larg)) th_rhs' in + TRANS th_lhs (TRANS th (AP_TERM btm th_rhs)) + else + let th_rhs = INST[larg, m_var_num; rarg, n_var_num] MULT_AC' in + TRANS th_lhs (TRANS th (AP_TERM btm th_rhs));; + + + + +let mul1_right_th_table = Hashtbl.create (maximum * maximum);; +let mul1_left_th_table = Hashtbl.create (maximum * maximum);; + +for i = 1 to maximum - 1 do + for j = 1 to maximum - 1 do + let name_right = names_array.(i) ^ names_array.(j) in + let name_left = names_array.(j) ^ names_array.(i) in + let th = mul1_right_th i j in + let add_flag = (i * j >= maximum) in + let _ = Hashtbl.add mul1_right_th_table name_right (add_flag, th) in + Hashtbl.add mul1_left_th_table name_left (add_flag, mul1_left_th th) + done; +done;; + + + +(******************************************************) + +(* Conversions *) + + +(* Multiplies arg and (tm = tmname(_0)) *) +let rec raw_mul1_right_hash arg tm tmname = + if arg = zero_const then + INST [tm, n_var_num] MUL_0_n + else + let btm, mtm = dest_comb arg in + let cn = fst(dest_const btm) in + if (cn = b0_name) then + let th = INST[mtm, n_var_num; tm, t_var_num] MUL_B0_t in + TRANS th (AP_TERM b0_const (raw_mul1_right_hash mtm tm tmname)) + else + let name = cn ^ tmname in + if (mtm = zero_const) then + Hashtbl.find mul_table name + else + let add_flag, th' = Hashtbl.find mul1_right_th_table name in + let th = INST[mtm, m_var_num] th' in + if add_flag then + let ltm, rtm = dest_comb(rand(concl th)) in + let lplus, rarg = dest_comb rtm in + let th2 = AP_TERM lplus (raw_mul1_right_hash mtm tm tmname) in + let th_add = raw_add_conv_hash (rand(concl th2)) in + TRANS th (AP_TERM ltm (TRANS th2 th_add)) + else + let ltm = rator(rand(concl th)) in + let th2 = AP_TERM ltm (raw_mul1_right_hash mtm tm tmname) in + TRANS th th2;; + + +(* Multiplies (tm = tmname(_0)) and arg *) +let rec raw_mul1_left_hash tm tmname arg = + if arg = zero_const then + INST [tm, n_var_num] MUL_n_0 + else + let btm, mtm = dest_comb arg in + let cn = fst(dest_const btm) in + if (cn = b0_name) then + let th = INST[mtm, n_var_num; tm, t_var_num] MUL_t_B0 in + TRANS th (AP_TERM b0_const (raw_mul1_left_hash tm tmname mtm)) + else + let name = tmname ^ cn in + if (mtm = zero_const) then + Hashtbl.find mul_table name + else + let add_flag, th' = Hashtbl.find mul1_left_th_table name in + let th = INST[mtm, m_var_num] th' in + if add_flag then + let ltm, rtm = dest_comb(rand(concl th)) in + let lplus, rarg = dest_comb rtm in + let th2 = AP_TERM lplus (raw_mul1_left_hash tm tmname mtm) in + let th_add = raw_add_conv_hash (rand(concl th2)) in + TRANS th (AP_TERM ltm (TRANS th2 th_add)) + else + let ltm = rator(rand(concl th)) in + let th2 = AP_TERM ltm (raw_mul1_left_hash tm tmname mtm) in + TRANS th th2;; + + +(* Computes B_i(m) * B_j(n) *) +let rec raw_mul_conv_hash tm = + let larg, rarg = dest_comb tm in + let larg = rand larg in + if larg = zero_const then + INST [rarg, n_var_num] MUL_0_n + else if rarg = zero_const then + INST [larg, n_var_num] MUL_n_0 + else + + let lbtm, mtm = dest_comb larg in + let lcn = fst(dest_const lbtm) in + if (lcn = b0_name) then + let th = INST[rarg, t_var_num; mtm, n_var_num] MUL_B0_t in + let ltm, rtm = dest_comb(rand(concl th)) in + TRANS th (AP_TERM ltm (raw_mul_conv_hash rtm)) + else + let rbtm, ntm = dest_comb rarg in + let rcn = fst(dest_const rbtm) in + if (rcn = b0_name) then + let th = INST[larg, t_var_num; ntm, n_var_num] MUL_t_B0 in + let ltm, rtm = dest_comb(rand(concl th)) in + TRANS th (AP_TERM ltm (raw_mul_conv_hash rtm)) + else + + if (ntm = zero_const) then + if (mtm = zero_const) then + Hashtbl.find mul_table (lcn ^ rcn) + else + raw_mul1_right_hash larg (mk_comb(rbtm, zero_const)) rcn + else if (mtm = zero_const) then + raw_mul1_left_hash (mk_comb(lbtm, zero_const)) lcn rarg + else + + let th0 = INST[mtm, m_var_num; ntm, n_var_num] + (Hashtbl.find gen_mul_table (lcn ^ rcn)) in + let b_low, expr = dest_comb(rand(concl th0)) in + let ltm, rsum = dest_comb expr in + let b_high, mul0 = dest_comb (rand ltm) in + let th_mul0 = raw_mul_conv_hash mul0 in + let th_mul1 = raw_mul1_right_hash mtm (mk_comb(rbtm, zero_const)) rcn in + let th_mul2 = raw_mul1_right_hash ntm (mk_comb(lbtm, zero_const)) lcn in + let th_larg = AP_TERM plus_op_num (AP_TERM b_high th_mul0) in + let th_rarg = MK_COMB(AP_TERM plus_op_num th_mul1, th_mul2) in + + let add_rarg = TRANS th_rarg (raw_add_conv_hash (rand(concl th_rarg))) in + let add_th = MK_COMB (th_larg, add_rarg) in + let add = TRANS add_th (raw_add_conv_hash (rand(concl add_th))) in + + TRANS th0 (AP_TERM b_low add);; + + + +(* The main multiplication conversion *) +let NUM_MULT_HASH_CONV tm = + let ltm, rtm = dest_comb tm in + let larg, rarg = rand (rand ltm), rand rtm in + let th0 = INST[larg, m_var_num; rarg, n_var_num] MUL_NUM in + if (rand(rator(concl th0)) <> tm) then + failwith "NUM_MULT_HASH_CONV" + else + let rtm = rand(rand(concl th0)) in + let th = raw_mul_conv_hash rtm in + TRANS th0 (AP_TERM num_const th);; + + + +(**************************) + +(* Tests *) + +(* +let x = Int 325325353;; +let y = Int 999434312;; + +let xx = mk_binop mul_op_num (mk_numeral_array x) (mk_numeral_array y);; +let yy = mk_binop mul_op_num (mk_numeral x) (mk_numeral y);; +let zz = rand(concl(REWRITE_CONV[NUMERAL] xx));; + +NUM_MULT_HASH_CONV xx;; + +test 1000 NUM_MULT_CONV yy;; (* 4.12 *) +test 1000 NUM_MULT_HASH_CONV xx;; (* 4: 1.69; 6: 0.716(1), 0.608(2), 8: 0.328(3) *) +test 1000 raw_mul_conv_hash zz;; (* 4: 2.45(1), 1.576(2), 8: 0.320 *) + + +needs "example0.hl";; + +let x = map (fun t1, t2 -> mk_binop mul_op_num (mk_numeral t1) (mk_numeral t2)) example;; +let h1 = map (fun t1, t2 -> mk_binop mul_op_num (mk_numeral_array t1) (mk_numeral_array t2)) example;; +let h2 = map (fun t1, t2 -> mk_binop mul_op_num + (rand (mk_numeral_array t1)) + (rand (mk_numeral_array t2))) example;; + + +test 1 (map NUM_MULT_CONV) x;; (* 2.64 *) +test 10 (map NUM_MULT_HASH_CONV) h1;; (* 4: 5.43; 6: 3.12; 8: 1.67 *) +test 10 (map raw_mul_conv_hash) h2;; (* 5.42; 8: 1.576 *) +*) + + + +(************************************) + +(* DIV *) + + +let DIV_NUM = prove(mk_eq(mk_binop div_op_num (mk_comb(num_const, m_var_num)) (mk_comb(num_const, n_var_num)), + mk_comb(num_const, mk_binop div_op_num m_var_num n_var_num)), + REWRITE_TAC[num_def; NUMERAL]);; + + +let DIV_UNIQ' = (UNDISCH_ALL o + PURE_ONCE_REWRITE_RULE[ARITH_RULE `a < b <=> (a < b:num <=> T)`] o + ONCE_REWRITE_RULE[ARITH_RULE `m = q * n + r <=> q * n + r = m:num`] o + REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL) DIV_UNIQ;; + +(* Computes m DIV n *) +let raw_div_hash_conv tm = + let ltm, n_tm = dest_comb tm in + let m_tm = rand ltm in + let m = raw_dest_hash m_tm in + let n = raw_dest_hash n_tm in + let q = Num.quo_num m n and + r = Num.mod_num m n in + let q_tm = rand (mk_numeral_array q) and + r_tm = rand (mk_numeral_array r) in + + let qn_th = raw_mul_conv_hash (mk_binop mul_op_num q_tm n_tm) in + let qn_tm = rand (concl qn_th) in + let qnr_th = raw_add_conv_hash (mk_binop plus_op_num qn_tm r_tm) in + let th1 = TRANS (AP_THM (AP_TERM plus_op_num qn_th) r_tm) qnr_th in + let th2 = raw_lt_hash_conv (mk_binop lt_op_num r_tm n_tm) in + let th0 = INST[r_tm, r_var_num; n_tm, n_var_num; m_tm, m_var_num; q_tm, q_var_num] DIV_UNIQ' in + MY_PROVE_HYP th1 (MY_PROVE_HYP th2 th0);; + + + +(* The main division conversion *) +let NUM_DIV_HASH_CONV tm = + let ltm, rtm = dest_comb tm in + let larg, rarg = rand (rand ltm), rand rtm in + let th0 = INST[larg, m_var_num; rarg, n_var_num] DIV_NUM in + if (rand(rator(concl th0)) <> tm) then + failwith "NUM_DIV_HASH_CONV" + else + let rtm = rand(rand(concl th0)) in + let th = raw_div_hash_conv rtm in + TRANS th0 (AP_TERM num_const th);; + + +(* +let y = num_of_string "3543593547359";; +let x = num_of_string "9392392983247294924242";; + + +let xx = mk_binop div_op_num (mk_numeral_array x) (mk_numeral_array y);; +let yy = mk_binop div_op_num (mk_numeral x) (mk_numeral y);; + +(* 1.624 *) +test 100 NUM_DIV_CONV yy;; +(* 8: 1.084 *) +test 1000 NUM_DIV_HASH_CONV xx;; +*) + + +(*********************************************) + +(* EVEN_CONV, ODD_CONV *) + +let even_const = `EVEN` and + odd_const = `ODD` and + eq_const = `<=>` and + f_const = `F` and + t_const = `T`;; + + + +let EVEN_NUM = (REWRITE_RULE[GSYM num_def] o prove) + (`EVEN (NUMERAL n) <=> EVEN n`, REWRITE_TAC[NUMERAL]);; + +let ODD_NUM = (REWRITE_RULE[GSYM num_def] o prove) + (`ODD (NUMERAL n) <=> ODD n`, REWRITE_TAC[NUMERAL]);; + +let EVEN_ZERO = prove(`EVEN _0 <=> T`, REWRITE_TAC[ARITH_EVEN]);; +let ODD_ZERO = prove(`ODD _0 <=> F`, REWRITE_TAC[ARITH_ODD]);; + + +let EVEN_B0 = prove(mk_eq(mk_comb(`EVEN`, mk_comb(b0_const, `n:num`)), `T`), + REWRITE_TAC[B0_EXPLICIT; EVEN_MULT] THEN + DISJ1_TAC THEN CONV_TAC NUM_EVEN_CONV);; + + +let ODD_B0 = prove(mk_eq(mk_comb(`ODD`, mk_comb(b0_const, `n:num`)), `F`), + REWRITE_TAC[NOT_ODD; EVEN_B0]);; + +let EVEN_SUC_T = prove(`(EVEN (SUC n) <=> T) <=> (EVEN n <=> F)`, REWRITE_TAC[EVEN]);; +let EVEN_SUC_F = prove(`(EVEN (SUC n) <=> F) <=> (EVEN n <=> T)`, REWRITE_TAC[EVEN]);; + +let ODD_SUC_T = prove(`(ODD (SUC n) <=> T) <=> (ODD n <=> F)`, REWRITE_TAC[ODD]);; +let ODD_SUC_F = prove(`(ODD (SUC n) <=> F) <=> (ODD n <=> T)`, REWRITE_TAC[ODD]);; + + + +let next_even_th th = + let ltm, rtm = dest_comb(concl th) in + let b_tm = rand(rand ltm) in + let suc_b = raw_suc_conv_hash (mk_comb (suc_const, b_tm)) in + let flag = (fst o dest_const) rtm = "T" in + let th0 = SYM (AP_TERM even_const suc_b) in + let th1 = AP_THM (AP_TERM eq_const th0) (if flag then f_const else t_const) in + let th2 = INST[b_tm, n_var_num] (if flag then EVEN_SUC_F else EVEN_SUC_T) in + EQ_MP (SYM (TRANS th1 th2)) th;; + + +let next_odd_th th = + let ltm, rtm = dest_comb(concl th) in + let b_tm = rand(rand ltm) in + let suc_b = raw_suc_conv_hash (mk_comb (suc_const, b_tm)) in + let flag = (fst o dest_const) rtm = "T" in + let th0 = SYM (AP_TERM odd_const suc_b) in + let th1 = AP_THM (AP_TERM eq_const th0) (if flag then f_const else t_const) in + let th2 = INST[b_tm, n_var_num] (if flag then ODD_SUC_F else ODD_SUC_T) in + EQ_MP (SYM (TRANS th1 th2)) th;; + + +let even_thm_table = Hashtbl.create maximum;; + + +Hashtbl.add even_thm_table names_array.(0) EVEN_B0;; + + +for i = 1 to maximum - 1 do + let th0 = next_even_th (Hashtbl.find even_thm_table names_array.(i - 1)) in + Hashtbl.add even_thm_table names_array.(i) th0 +done;; + + +let odd_thm_table = Hashtbl.create maximum;; + +Hashtbl.add odd_thm_table names_array.(0) ODD_B0;; + +for i = 1 to maximum - 1 do + let th0 = next_odd_th (Hashtbl.find odd_thm_table names_array.(i - 1)) in + Hashtbl.add odd_thm_table names_array.(i) th0 +done;; + + +let raw_even_hash_conv tm = + let ltm, rtm = dest_comb tm in + if ((fst o dest_const) ltm <> "EVEN") then + failwith "raw_even_hash_conv: no EVEN" + else + if (is_const rtm) then + EVEN_ZERO + else + let b_tm, n_tm = dest_comb rtm in + let th0 = Hashtbl.find even_thm_table ((fst o dest_const) b_tm) in + INST[n_tm, n_var_num] th0;; + + +let raw_odd_hash_conv tm = + let ltm, rtm = dest_comb tm in + if ((fst o dest_const) ltm <> "ODD") then + failwith "raw_odd_hash_conv: no ODD" + else + if (is_const rtm) then + ODD_ZERO + else + let b_tm, n_tm = dest_comb rtm in + let th0 = Hashtbl.find odd_thm_table ((fst o dest_const) b_tm) in + INST[n_tm, n_var_num] th0;; + + + +let NUM_EVEN_HASH_CONV tm = + let ltm, rtm = dest_comb tm in + let th0 = INST[rand rtm, n_var_num] EVEN_NUM in + let ltm, rtm = dest_comb(concl th0) in + if (rand ltm <> tm) then + failwith "NUM_EVEN_HASH_CONV" + else + let th1 = raw_even_hash_conv rtm in + TRANS th0 th1;; + + +let NUM_ODD_HASH_CONV tm = + let ltm, rtm = dest_comb tm in + let th0 = INST[rand rtm, n_var_num] ODD_NUM in + let ltm, rtm = dest_comb(concl th0) in + if (rand ltm <> tm) then + failwith "NUM_ODD_HASH_CONV" + else + let th1 = raw_odd_hash_conv rtm in + TRANS th0 th1;; + + + + +end;; + + diff --git a/formal_lp/old/arith/arith_hash2.hl b/formal_lp/old/arith/arith_hash2.hl new file mode 100644 index 0000000..dc708e3 --- /dev/null +++ b/formal_lp/old/arith/arith_hash2.hl @@ -0,0 +1,1800 @@ +module type Arith_hash_sig = + sig + val num_def : thm + val NUM_THM : thm + val num_const : term + val const_array : term array + val def_array: thm array + val def_thm_array: thm array + val mk_numeral_hash : num -> term + val mk_numeral_array : num -> term + val mk_small_numeral_array : int -> term + val raw_dest_hash : term -> num + val dest_numeral_hash : term -> num + val NUMERAL_TO_NUM_CONV : term -> thm + val NUM_TO_NUMERAL_CONV : term -> thm + val raw_suc_conv_hash : term -> thm + val NUM_SUC_HASH_CONV : term -> thm + val raw_eq0_hash_conv : term -> thm + val NUM_EQ0_HASH_CONV : term -> thm + val raw_pre_hash_conv : term -> thm + val NUM_PRE_HASH_CONV : term -> thm + val raw_gt0_hash_conv : term -> thm + val NUM_GT0_HASH_CONV : term -> thm + val raw_lt_hash_conv : term -> thm + val raw_le_hash_conv : term -> thm + val NUM_LT_HASH_CONV : term -> thm + val NUM_LE_HASH_CONV : term -> thm + val raw_add_conv_hash : term -> thm + val NUM_ADD_HASH_CONV : term -> thm + val raw_sub_hash_conv : term -> thm + val raw_sub_and_le_hash_conv : term -> term -> thm * thm + val NUM_SUB_HASH_CONV : term -> thm + val raw_mul_conv_hash : term -> thm + val NUM_MULT_HASH_CONV : term -> thm + val raw_div_hash_conv : term -> thm + val NUM_DIV_HASH_CONV : term -> thm + + val raw_even_hash_conv : term -> thm + val raw_odd_hash_conv : term -> thm + val NUM_EVEN_HASH_CONV : term -> thm + val NUM_ODD_HASH_CONV : term -> thm +end;; + +(* Dependencies *) +needs "../formal_lp/arith/misc.hl";; +needs "../formal_lp/arith/arith_options.hl";; + +module Arith_hash : Arith_hash_sig = struct + +open Arith_misc;; +open Arith_options;; + +let maximum = base;; + +(******************) + +(* Generate definitions and constants *) + +let num_type = `:num`;; +let fnum_type = `:num->num`;; + +let numeral_const = `NUMERAL` and + zero_const = `_0` and + bit0_const = `BIT0` and + bit1_const = `BIT1` and + truth_const = `T` and + false_const = `F`;; + +let m_var_num = `m:num` and + n_var_num = `n:num` and + t_var_num = `t:num` and + r_var_num = `r:num` and + p_var_num = `p:num` and + q_var_num = `q:num`;; + +let suc_const = `SUC` and + plus_op_num = `(+):num->num->num` and + minus_op_num = `(-):num->num->num` and + mul_op_num = `( * ):num->num->num` and + div_op_num = `(DIV):num->num->num` and + le_op_num = `(<=):num->num->bool` and + lt_op_num = `(<):num->num->bool`;; + + +let plus_op_real = `(+):real->real->real` and + mul_op_real = `( * ):real->real->real`;; + + + +let names_array = Array.init maximum (fun i -> "D"^(string_of_int i));; + + +(* Definitions *) + +let num_name = "NUM"^(string_of_int base);; +let num_def = new_basic_definition (mk_eq(mk_var(num_name, fnum_type), numeral_const));; +let num_const = mk_const(num_name, []);; +let num_def_sym = SYM num_def;; +let NUM_THM = prove(mk_eq(mk_comb(num_const, n_var_num), n_var_num), + REWRITE_TAC[num_def; NUMERAL]);; + + + +(* B_i(n) = i + B_0(n) *) +let mk_bit_definition i = + let lhs = mk_var (names_array.(i), fnum_type) in + let tm1 = mk_binop mul_op_num (mk_small_numeral base) n_var_num in + let tm2 = mk_binop plus_op_num tm1 (mk_small_numeral i) in + let rhs = mk_abs (n_var_num, tm2) in + new_basic_definition (mk_eq (lhs, rhs));; + + + +let def_basic_array = Array.init maximum mk_bit_definition;; +let def_array = Array.init maximum (fun i -> + let basic = def_basic_array.(i) in + let th1 = AP_THM basic n_var_num in + TRANS th1 (BETA (rand (concl th1))));; +let def_table = Hashtbl.create maximum;; +let def_basic_table = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + let _ = Hashtbl.add def_table names_array.(i) def_array.(i) in + Hashtbl.add def_basic_table names_array.(i) def_basic_array.(i) +done;; + + +(* Constants *) + + +let const_array = Array.init maximum (fun i -> mk_const(names_array.(i),[]));; + +let b0_def = def_array.(0);; +let b0_const = const_array.(0);; +let b0_name = names_array.(0);; + +let max_const = mk_small_numeral maximum;; + + + +(* Alternative definition of B_i *) + +let ADD_0_n = prove(`_0 + n = n`, + ONCE_REWRITE_TAC[GSYM NUMERAL] THEN + REWRITE_TAC[GSYM ARITH_ADD; ADD_CLAUSES]);; +let ADD_n_0 = prove(`n + _0 = n`, + ONCE_REWRITE_TAC[GSYM NUMERAL] THEN + REWRITE_TAC[GSYM ARITH_ADD; ADD_CLAUSES]);; + +let MUL_n_0 = prove(`n * _0 = 0`, + REWRITE_TAC[NUMERAL] THEN + SUBGOAL_THEN `_0 = 0` MP_TAC THENL [ REWRITE_TAC[NUMERAL]; ALL_TAC ] THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th]) THEN + ARITH_TAC);; + + +(* B_i(n) = i + B_0(n) *) +let def_thm i = + let bin = mk_comb(const_array.(i), n_var_num) in + let bi0 = mk_comb(const_array.(i), zero_const) in + let b0n = mk_comb(const_array.(0), n_var_num) in + let rhs = mk_binop plus_op_num bi0 b0n in + prove(mk_eq(bin, rhs), REWRITE_TAC[def_array.(i); def_array.(0)] THEN + REWRITE_TAC[MUL_n_0; ADD_CLAUSES] THEN ARITH_TAC);; + + +let def_thm_array = Array.init maximum def_thm;; + + +let B0_0 = prove(mk_eq(mk_comb(b0_const, zero_const), zero_const), + REWRITE_TAC[b0_def; MUL_n_0; ADD_CLAUSES; NUMERAL]);; + + + +let B0_EXPLICIT = prove(mk_eq(mk_comb(b0_const, n_var_num), + mk_binop mul_op_num max_const n_var_num), + REWRITE_TAC[b0_def; ADD_CLAUSES]);; + + + + +(******************************) + +(* mk_numeral and dest_numeral *) + + +(* mk_table *) + +let mk_table = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + Hashtbl.add mk_table (Int i) const_array.(i) +done;; + + +(* mk_numeral *) +let max_num = Int maximum;; + + +let mk_numeral_hash = + let rec mk_num n = + if (n =/ num_0) then + zero_const + else + let m = mod_num n max_num in + let bit = Hashtbl.find mk_table m in + mk_comb(bit, mk_num(quo_num n max_num)) in + fun n -> if n if n if n < 0 then failwith "mk_small_numeral_array: negative argument" + else mk_comb (num_const, mk_num n);; + + + +(* +(* 10: 1.232 *) +test 10000 mk_numeral_hash (Int 65535);; (* 0.736 *) +(* 10: 1.216 *) +test 10000 mk_numeral_array (Int 65535);; (* 0.728 *) +(* 10: 0.272 *) +test 100000 mk_small_numeral_array 65535;; (* 0.216 *) +(* 10: 0.316 *) +test 1000 mk_numeral_array (num_of_string "9111111111111111");; (* 0.288 *) +*) + + + + +(* dest_table *) + +let dest_table_num = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + Hashtbl.add dest_table_num names_array.(i) (Int i) +done;; + + + +(* dest_numeral *) + +let max_num = Int maximum;; + + +let rec raw_dest_hash tm = + if tm = zero_const then + num_0 + else + let l, r = dest_comb tm in + let n = max_num */ raw_dest_hash r in + let cn = fst(dest_const l) in + n +/ (Hashtbl.find dest_table_num cn);; + + +let dest_numeral_hash tm = raw_dest_hash (rand tm);; + + + + +(* +(* 10: 0.852 *) +test 100000 dest_numeral_hash (mk_numeral_array (Int 11111111));; +*) + + + + +(******************************) + +(* NUMERAL_TO_NUM_CONV: coverts usual HOL numerals into k-bit numerals *) + + +let th_num_conv = Array.init maximum (fun i -> (SYM o SPEC_ALL) def_array.(i));; +let mod_op_num = `MOD`;; +let zero = `0`;; + + +let DIV_BASE = + let h1 = mk_eq(mk_binop div_op_num m_var_num max_const, q_var_num) in + let h2 = mk_eq(mk_binop mod_op_num m_var_num max_const, r_var_num) in + let c = mk_eq(m_var_num, mk_binop plus_op_num (mk_binop mul_op_num max_const q_var_num) r_var_num) in + (UNDISCH_ALL o ARITH_RULE) (mk_imp(h1, mk_imp(h2, c)));; + + +let ZERO_EQ_ZERO = (EQT_ELIM o REWRITE_CONV[NUMERAL]) `0 = _0`;; +let SYM_ZERO_EQ_ZERO = SYM ZERO_EQ_ZERO;; +let SYM_NUM_THM = SYM NUM_THM;; + + + +let NUMERAL_TO_NUM_CONV tm = + let rec raw_conv tm = + if (rand tm = zero_const) then + ZERO_EQ_ZERO + else + let th_div = NUM_DIV_CONV (mk_binop div_op_num tm max_const) in + let th_mod = NUM_MOD_CONV (mk_binop mod_op_num tm max_const) in + let q_tm = rand(concl th_div) in + let r_tm = rand(concl th_mod) in + let th0 = INST[tm, m_var_num; q_tm, q_var_num; r_tm, r_var_num] DIV_BASE in + let th1 = MY_PROVE_HYP th_mod (MY_PROVE_HYP th_div th0) in + let r = dest_small_numeral r_tm in + let th2 = INST[q_tm, n_var_num] th_num_conv.(r) in + let th = TRANS th1 th2 in + let ltm, rtm = dest_comb(rand(concl th)) in + let r_th = raw_conv rtm in + TRANS th (AP_TERM ltm r_th) in + + if (fst o dest_const o rator) tm <> "NUMERAL" then + failwith "NUMERAL_TO_NUM_CONV" + else + let th0 = raw_conv tm in + let n_tm = rand(concl th0) in + TRANS th0 (INST[n_tm, n_var_num] SYM_NUM_THM);; + + +(* +(* 100: 2.588 *) +test 100 NUMERAL_TO_NUM_CONV `100034242430`;; +*) + + + +let replace_numerals = rand o concl o DEPTH_CONV NUMERAL_TO_NUM_CONV;; +let REPLACE_NUMERALS = CONV_RULE (DEPTH_CONV NUMERAL_TO_NUM_CONV);; + + + +(* NUM_TO_NUMERAL_CONV *) + + +let NUM_TO_NUMERAL_CONV tm = + let rec raw_conv tm = + if tm = zero_const then + SYM_ZERO_EQ_ZERO + else + let b_tm, n_tm = dest_comb tm in + let n_th = raw_conv n_tm in + let n_tm' = rand(concl n_th) in + let cb = (fst o dest_const) b_tm in + let th0 = Hashtbl.find def_table cb in + let th1 = AP_TERM b_tm n_th in + let th2 = TRANS th1 (INST[n_tm', n_var_num] th0) in + let ltm, rtm = dest_comb(rand(concl th2)) in + let mul_th = NUM_MULT_CONV (rand ltm) in + let add_th0 = AP_THM (AP_TERM plus_op_num mul_th) rtm in + let add_th = TRANS add_th0 (NUM_ADD_CONV (rand(concl add_th0))) in + TRANS th2 add_th in + let ltm, rtm = dest_comb tm in + if (fst o dest_const) ltm <> num_name then + failwith "NUM_TO_NUMERAL_CONV" + else + let num_th = INST[rtm, n_var_num] NUM_THM in + let th0 = raw_conv rtm in + TRANS num_th th0;; + + + + + +(*************************) + +(* SUC_CONV *) + +let suc_const = `SUC`;; + +(* Theorems *) + +let SUC_NUM = prove(mk_eq(mk_comb(suc_const, mk_comb (num_const, n_var_num)), + mk_comb(num_const, mk_comb (suc_const, n_var_num))), + REWRITE_TAC[num_def; NUMERAL]);; + +let SUC_0 = prove(mk_eq(`SUC _0`, mk_comb (const_array.(1), zero_const)), + REWRITE_TAC[def_array.(1); MUL_n_0; ARITH_SUC; NUMERAL; ARITH_ADD]);; + + +let suc_th i = + let cflag = (i + 1 >= maximum) in + let suc = if (cflag) then 0 else i + 1 in + let lhs = mk_comb(suc_const, (mk_comb (const_array.(i), n_var_num))) in + let rhs = mk_comb(const_array.(suc), + if (cflag) then mk_comb(suc_const, n_var_num) else n_var_num) in + let proof = REWRITE_TAC [def_array.(i); def_array.(suc)] THEN ARITH_TAC in + prove(mk_eq(lhs, rhs), proof);; + + +let th_suc_array = Array.init maximum suc_th;; + +let th_suc_table = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + Hashtbl.add th_suc_table names_array.(i) th_suc_array.(i) +done;; + +let SUC_MAX = th_suc_array.(maximum - 1);; +let bit_max_name = names_array.(maximum - 1);; + + +(* Conversion *) + +let rec raw_suc_conv_hash tm = + let otm = rand tm in + if (otm = zero_const) then + SUC_0 + else + let btm, ntm = dest_comb otm in + let cn = fst(dest_const btm) in + if (cn = bit_max_name) then + let th = INST [ntm, n_var_num] SUC_MAX in + let ltm, rtm = dest_comb(rand(concl th)) in + TRANS th (AP_TERM ltm (raw_suc_conv_hash rtm)) + else + INST [ntm, n_var_num] (Hashtbl.find th_suc_table cn);; + + + +let NUM_SUC_HASH_CONV tm = + let ntm = rand (rand tm) in + let th = INST [ntm, n_var_num] SUC_NUM in + let lhs, rhs = dest_eq(concl th) in + if (lhs <> tm) then failwith("NUM_SUC_HASH_CONV") + else + let ltm, rtm = dest_comb rhs in + TRANS th (AP_TERM ltm (raw_suc_conv_hash rtm));; + + + + + +(* +let x = mk_comb(suc_const, mk_small_numeral_array 99999);; +NUM_SUC_HASH_CONV x;; +(* 10: 1.488 *) +test 50000 NUM_SUC_HASH_CONV x;; (* 5: 0.980 *) +*) + + +(**************************************) + +(* EQ_0_CONV *) + +let EQ_0_NUM = prove(mk_eq(mk_eq(mk_comb(num_const, n_var_num), `_0`), `n = _0`), + REWRITE_TAC[num_def; NUMERAL]);; + +let EQ_B0_0 = prove(mk_eq(mk_eq(mk_comb(b0_const, n_var_num), `_0`), `n = _0`), + REWRITE_TAC[b0_def; ADD_CLAUSES; NUMERAL; REWRITE_RULE[NUMERAL] MULT_EQ_0; ARITH_EQ]);; + +let EQ_0_0 = prove(`_0 = _0 <=> T`, REWRITE_TAC[ARITH_EQ]);; + +let eq_0_lemma = REWRITE_RULE[NUMERAL] (ARITH_RULE `a + b = 0 <=> a = 0 /\ b = 0`);; + +let eq_0_i i = + let concl = mk_eq(mk_eq(mk_comb(const_array.(i), n_var_num), zero_const), false_const) in + prove(concl, REWRITE_TAC[def_array.(i); eq_0_lemma; NUMERAL; ARITH_EQ]);; + +let th_eq0_array = Array.init maximum (fun i -> if (i = 0) then EQ_0_0 else eq_0_i i);; + +let th_eq0_table = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + Hashtbl.add th_eq0_table names_array.(i) th_eq0_array.(i) +done;; + + + +let rec raw_eq0_hash_conv rtm = + if (rtm = zero_const) then + EQ_0_0 + else + let b_tm, n_tm = dest_comb rtm in + let cn = (fst o dest_const) b_tm in + if (cn = b0_name) then + let th0 = INST[n_tm, n_var_num] EQ_B0_0 in + let th1 = raw_eq0_hash_conv n_tm in + TRANS th0 th1 + else + INST[n_tm, n_var_num] (Hashtbl.find th_eq0_table cn);; + + + +let NUM_EQ0_HASH_CONV rtm = + let n_tm = rand rtm in + let th = INST [n_tm, n_var_num] EQ_0_NUM in + TRANS th (raw_eq0_hash_conv n_tm);; + + +(* +let x = mk_small_numeral_array 0;; +NUM_EQ0_HASH_CONV x;; +raw_eq0_hash_conv `B0 (B0 _0)`;; +*) + + +(**************************************) + +(* PRE_CONV *) + +let pre_const = `PRE`;; + +(* Theorems *) + +let PRE_NUM = prove(mk_eq(mk_comb(pre_const, mk_comb (num_const, n_var_num)), + mk_comb(num_const, mk_comb (pre_const, n_var_num))), + REWRITE_TAC[num_def; NUMERAL]);; + + +let PRE_0 = prove(`PRE _0 = _0`, + MP_TAC (CONJUNCT1 PRE) THEN SIMP_TAC[NUMERAL]);; + +let PRE_B1_0 = prove(mk_eq(mk_comb(`PRE`, mk_comb(const_array.(1), `_0`)), `_0`), + REWRITE_TAC[def_array.(1); MUL_n_0; ARITH_ADD; NUMERAL; ARITH_PRE; ARITH_EQ]);; + + +let PRE_B0_n0 = (UNDISCH_ALL o prove)(mk_imp(`n = _0 <=> T`, + mk_eq(mk_comb(`PRE`, mk_comb(b0_const, `n:num`)), `_0`)), + REWRITE_TAC[B0_EXPLICIT] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; MUL_n_0]) THEN + REWRITE_TAC[NUMERAL; ARITH_PRE]);; + + +let PRE_B0_n1 = (UNDISCH_ALL o PURE_REWRITE_RULE[NUMERAL] o prove)(mk_imp(`n = 0 <=> F`, + mk_eq(mk_comb(`PRE`, mk_comb(b0_const, `n:num`)), + mk_comb(const_array.(maximum - 1), `PRE n`))), + REWRITE_TAC[B0_EXPLICIT; def_array.(maximum - 1)] THEN ARITH_TAC);; + + +let PRE_lemma = (UNDISCH_ALL o PURE_REWRITE_RULE[NUMERAL] o ARITH_RULE) `((n = 0) <=> F) ==> (SUC m = n <=> PRE n = m)`;; + + +let pre_th i = + let pre = i - 1 in + let pre_tm = mk_comb(const_array.(pre), n_var_num) in + let suc_tm = mk_comb(suc_const, pre_tm) in + let suc_th = raw_suc_conv_hash suc_tm in + let n_tm = rand(concl suc_th) in + let n0_th = raw_eq0_hash_conv n_tm in + let th0 = INST[pre_tm, m_var_num; n_tm, n_var_num] PRE_lemma in + MY_PROVE_HYP n0_th (EQ_MP th0 suc_th);; + + + + +let th_pre_array = Array.init maximum (fun i -> if i = 0 then REFL `_0` else pre_th i);; + +let th_pre_table = Hashtbl.create maximum;; + +for i = 0 to maximum - 1 do + Hashtbl.add th_pre_table names_array.(i) th_pre_array.(i) +done;; + + +(* Conversion *) +let b1_name = names_array.(1);; +let b1_pre_thm = th_pre_array.(1);; + +let rec raw_pre_hash_conv tm = + let otm = rand tm in + if (otm = zero_const) then + PRE_0 + else + let btm, ntm = dest_comb otm in + let cn = fst(dest_const btm) in + if (cn = b0_name) then + let n_th = raw_eq0_hash_conv ntm in + if (rand(concl n_th) = false_const) then + let th0 = INST[ntm, n_var_num] PRE_B0_n1 in + let th1 = MY_PROVE_HYP n_th th0 in + let ltm, rtm = dest_comb(rand(concl th1)) in + let th2 = raw_pre_hash_conv rtm in + TRANS th1 (AP_TERM ltm th2) + else + let th = INST[ntm, n_var_num] PRE_B0_n0 in + MY_PROVE_HYP n_th th + else + if (cn = b1_name) then + if (ntm = zero_const) then + PRE_B1_0 + else + INST[ntm, n_var_num] b1_pre_thm + else + INST [ntm, n_var_num] (Hashtbl.find th_pre_table cn);; + + + +let NUM_PRE_HASH_CONV tm = + let ntm = rand (rand tm) in + let th = INST [ntm, n_var_num] PRE_NUM in + let lhs, rhs = dest_eq(concl th) in + if (lhs <> tm) then failwith("NUM_PRE_HASH_CONV") + else + let ltm, rtm = dest_comb rhs in + TRANS th (AP_TERM ltm (raw_pre_hash_conv rtm));; + + +(* +let x = mk_comb(pre_const, mk_small_numeral_array 100000);; +NUM_PRE_HASH_CONV x;; +(* 10: 0.488; 100: 0.200 *) +test 5000 NUM_PRE_HASH_CONV x;; +let x = mk_comb(pre_const, mk_small_numeral_array 65536);; +(* 10: 0.468; 100: 0.496 *) +test 50000 NUM_PRE_HASH_CONV x;; +*) + + + + +(**************************************) + +(* GT0_CONV *) + + +let gt0_table = Hashtbl.create maximum;; + +let GT0_NUM = (REWRITE_RULE[GSYM num_def] o prove)(`0 < NUMERAL n <=> _0 < n`, REWRITE_TAC[NUMERAL]);; + +let gt0_0 = prove(`_0 < _0 <=> F`, REWRITE_TAC[ARITH_LT]);; +let gt0_b0 = (REWRITE_RULE[NUMERAL] o prove)(mk_eq (mk_binop lt_op_num `0` (mk_comb(b0_const, n_var_num)), `0 < n`), + REWRITE_TAC[b0_def] THEN ARITH_TAC);; + + +let zero = `0`;; + +let gt0_th i = + let bi = const_array.(i) in + let concl = mk_eq (mk_binop lt_op_num zero (mk_comb(bi, n_var_num)), truth_const) in + let proof = REWRITE_TAC[def_array.(i)] THEN ARITH_TAC in + (PURE_REWRITE_RULE[NUMERAL] o prove)(concl, proof);; + + +for i = 1 to maximum - 1 do + Hashtbl.add gt0_table names_array.(i) (gt0_th i) +done;; + + +let rec raw_gt0_hash_conv rtm = + if (rtm = zero_const) then + gt0_0 + else + let b_tm, n_tm = dest_comb rtm in + let cn = (fst o dest_const) b_tm in + if (cn = b0_name) then + let th0 = INST[n_tm, n_var_num] gt0_b0 in + let th1 = raw_gt0_hash_conv n_tm in + TRANS th0 th1 + else + INST[n_tm, n_var_num] (Hashtbl.find gt0_table cn);; + + + +let NUM_GT0_HASH_CONV rtm = + let n_tm = rand rtm in + let th = INST [n_tm, n_var_num] GT0_NUM in + TRANS th (raw_gt0_hash_conv n_tm);; + + + + +(* +let tm = mk_binop lt_op_num (mk_small_numeral_array 0) (mk_small_numeral_array 100000);; +NUM_GT0_HASH_CONV (rand tm);; +(* 10: 0.232 *) +test 10000 NUM_GT0_HASH_CONV (rand tm);; +*) + + + +(*************************************) + +(* LT and LE *) + +let LT_NUM = (REWRITE_RULE[SYM num_def] o prove)(`NUMERAL m < NUMERAL n <=> m < n`, REWRITE_TAC[NUMERAL]);; +let LE_NUM = (REWRITE_RULE[SYM num_def] o prove)(`NUMERAL m <= NUMERAL n <=> m <= n`, REWRITE_TAC[NUMERAL]);; + +let LT_n_0 = prove(`n < _0 <=> F`, + SUBGOAL_THEN `_0 = 0` MP_TAC THENL [ REWRITE_TAC[NUMERAL]; ALL_TAC ] THEN + DISCH_THEN (fun th -> PURE_ONCE_REWRITE_TAC[th]) THEN + ARITH_TAC);; + +let LE_0_n = prove(`_0 <= n <=> T`, + SUBGOAL_THEN `_0 = 0` MP_TAC THENL [ REWRITE_TAC[NUMERAL]; ALL_TAC ] THEN + DISCH_THEN (fun th -> PURE_ONCE_REWRITE_TAC[th]) THEN + ARITH_TAC);; + +let SUC_LT_THM = ARITH_RULE `SUC m < SUC n <=> m < n`;; +let SUC_LE_THM = ARITH_RULE `SUC m <= SUC n <=> m <= n`;; + + + +(* LT tables *) + +(* Generates the theorem |- _0 < bi(n) <=> T (or |- _0 < b0(n) <=> _0 < n) *) +let gen_0_lt_bi i = + let bin = mk_comb (const_array.(i), n_var_num) in + let lt_tm = mk_binop lt_op_num zero bin in + if i > 0 then + (PURE_REWRITE_RULE[NUMERAL] o EQT_INTRO o prove)(lt_tm, REWRITE_TAC[def_array.(i)] THEN ARITH_TAC) + else + (PURE_REWRITE_RULE[NUMERAL] o prove)(mk_eq(lt_tm, `0 < n`), REWRITE_TAC[B0_EXPLICIT] THEN ARITH_TAC);; + + +let th_lt0_table = Hashtbl.create maximum;; +for i = 0 to maximum - 1 do + let th = gen_0_lt_bi i in + let name = names_array.(i) in + Hashtbl.add th_lt0_table name th +done;; + + + + +(* Generates the theorem |- bi(m) < bj(n) <=> m <= n (or m < n) *) + +let gen_bi_lt_bj i j = + let bim = mk_comb (const_array.(i), m_var_num) in + let bjn = mk_comb (const_array.(j), n_var_num) in + let lt_tm = mk_binop lt_op_num bim bjn in + let rhs = + if i >= j then + mk_binop lt_op_num m_var_num n_var_num + else + mk_binop le_op_num m_var_num n_var_num in + prove(mk_eq(lt_tm, rhs), REWRITE_TAC[def_array.(i); def_array.(j)] THEN ARITH_TAC);; + + + +(* Given a theorem |- bi(m) < bj(n) <=> P m n, generates the theorem + |- SUC(bi(m)) < SUC(bj(n)) <=> P m n *) +let gen_next_lt_thm th = + let ltm, n_tm = (dest_comb o lhand o concl) th in + let m_tm = rand ltm in + let th0 = INST[m_tm, m_var_num; n_tm, n_var_num] SUC_LT_THM in + let suc_m = raw_suc_conv_hash (mk_comb (suc_const, m_tm)) in + let suc_n = raw_suc_conv_hash (mk_comb (suc_const, n_tm)) in + let th1 = SYM (MK_COMB ((AP_TERM lt_op_num suc_m), suc_n)) in + TRANS (TRANS th1 th0) th;; + + +let th_lt_table = Hashtbl.create (maximum * maximum);; + + +for i = 0 to maximum - 1 do + let th = ref (gen_bi_lt_bj 0 i) in + let name_left = names_array.(0) and + name_right = names_array.(i) in + let _ = Hashtbl.add th_lt_table (name_left ^ name_right) !th in + + for k = 1 to maximum - i - 1 do + let x = k and y = i + k in + let name_left = names_array.(x) and + name_right = names_array.(y) in + th := gen_next_lt_thm (!th); + Hashtbl.add th_lt_table (name_left ^ name_right) !th + done; +done;; + + +for i = 1 to maximum - 1 do + let th = ref (gen_bi_lt_bj i 0) in + let name_left = names_array.(i) and + name_right = names_array.(0) in + let _ = Hashtbl.add th_lt_table (name_left ^ name_right) !th in + + for k = 1 to maximum - i - 1 do + let x = i + k and y = k in + let name_left = names_array.(x) and + name_right = names_array.(y) in + th := gen_next_lt_thm (!th); + Hashtbl.add th_lt_table (name_left ^ name_right) !th + done; +done;; + + + + +(* LE tables *) + +(* Generates the theorem |- bi(n) <= _0 <=> F (or |- b0(n) <= _0 <=> n <= _0) *) +let gen_bi_le_0 i = + let bin = mk_comb (const_array.(i), n_var_num) in + let lt_tm = mk_binop le_op_num bin zero in + if i > 0 then + (PURE_REWRITE_RULE[NUMERAL] o prove)(mk_eq(lt_tm, false_const), REWRITE_TAC[def_array.(i)] THEN ARITH_TAC) + else + (PURE_REWRITE_RULE[NUMERAL] o prove)(mk_eq(lt_tm, `n <= 0`), REWRITE_TAC[B0_EXPLICIT] THEN ARITH_TAC);; + + + +let th_le0_table = Hashtbl.create maximum;; +for i = 0 to maximum - 1 do + let th = gen_bi_le_0 i in + let name = names_array.(i) in + Hashtbl.add th_le0_table name th +done;; + + + + +(* Generates the theorem |- bi(m) <= bj(n) <=> m <= n (or m < n) *) +let gen_bi_le_bj i j = + let bim = mk_comb (const_array.(i), m_var_num) in + let bjn = mk_comb (const_array.(j), n_var_num) in + let lt_tm = mk_binop le_op_num bim bjn in + let rhs = + if i > j then + mk_binop lt_op_num m_var_num n_var_num + else + mk_binop le_op_num m_var_num n_var_num in + prove(mk_eq(lt_tm, rhs), REWRITE_TAC[def_array.(i); def_array.(j)] THEN ARITH_TAC);; + + + +(* Given a theorem |- bi(m) <= bj(n) <=> P m n, generates the theorem + |- SUC(bi(m)) <= SUC(bj(n)) <=> P m n *) +let gen_next_le_thm th = + let ltm, n_tm = (dest_comb o lhand o concl) th in + let m_tm = rand ltm in + let th0 = INST[m_tm, m_var_num; n_tm, n_var_num] SUC_LE_THM in + let suc_m = raw_suc_conv_hash (mk_comb (suc_const, m_tm)) in + let suc_n = raw_suc_conv_hash (mk_comb (suc_const, n_tm)) in + let th1 = SYM (MK_COMB ((AP_TERM le_op_num suc_m), suc_n)) in + TRANS (TRANS th1 th0) th;; + + + +let th_le_table = Hashtbl.create (maximum * maximum);; + + +for i = 0 to maximum - 1 do + let th = ref (gen_bi_le_bj 0 i) in + let name_left = names_array.(0) and + name_right = names_array.(i) in + let _ = Hashtbl.add th_le_table (name_left ^ name_right) !th in + + for k = 1 to maximum - i - 1 do + let x = k and y = i + k in + let name_left = names_array.(x) and + name_right = names_array.(y) in + th := gen_next_le_thm (!th); + Hashtbl.add th_le_table (name_left ^ name_right) !th + done; +done;; + + +for i = 1 to maximum - 1 do + let th = ref (gen_bi_le_bj i 0) in + let name_left = names_array.(i) and + name_right = names_array.(0) in + let _ = Hashtbl.add th_le_table (name_left ^ name_right) !th in + + for k = 1 to maximum - i - 1 do + let x = i + k and y = k in + let name_left = names_array.(x) and + name_right = names_array.(y) in + th := gen_next_le_thm (!th); + Hashtbl.add th_le_table (name_left ^ name_right) !th + done; +done;; + + +(* Conversions *) + +let rec raw_lt_hash_conv tm = + let ltm, rtm = dest_comb tm in + let ltm = rand ltm in + if is_const rtm then + (* n < _0 <=> F *) + INST[ltm, n_var_num] LT_n_0 + else + if is_const ltm then + (* _0 < Bi(n) *) + let bn_tm, n_tm = dest_comb rtm in + let cbn = (fst o dest_const) bn_tm in + let th0 = INST[n_tm, n_var_num] (Hashtbl.find th_lt0_table cbn) in + if cbn = b0_name then + let th1 = raw_lt_hash_conv (rand (concl th0)) in + TRANS th0 th1 + else + th0 + else + (* Bi(n) < Bj(m) *) + let bm_tm, m_tm = dest_comb ltm in + let bn_tm, n_tm = dest_comb rtm in + let cbm = (fst o dest_const) bm_tm in + let cbn = (fst o dest_const) bn_tm in + let th0 = INST[m_tm, m_var_num; n_tm, n_var_num] (Hashtbl.find th_lt_table (cbm^cbn)) in + let op = (fst o dest_const o rator o rator o rand o concl) th0 in + let th1 = + if op = "<" then + raw_lt_hash_conv (rand (concl th0)) + else + raw_le_hash_conv (rand (concl th0)) in + TRANS th0 th1 and + + raw_le_hash_conv tm = + let ltm, rtm = dest_comb tm in + let ltm = rand ltm in + if is_const ltm then + (* _0 <= n <=> T *) + INST[rtm, n_var_num] LE_0_n + else + if is_const rtm then + (* Bi(n) <= _0 *) + let bn_tm, n_tm = dest_comb ltm in + let cbn = (fst o dest_const) bn_tm in + let th0 = INST[n_tm, n_var_num] (Hashtbl.find th_le0_table cbn) in + if cbn = b0_name then + let th1 = raw_le_hash_conv (rand (concl th0)) in + TRANS th0 th1 + else + th0 + else + (* Bi(n) <= Bj(m) *) + let bm_tm, m_tm = dest_comb ltm in + let bn_tm, n_tm = dest_comb rtm in + let cbm = (fst o dest_const) bm_tm in + let cbn = (fst o dest_const) bn_tm in + let th0 = INST[m_tm, m_var_num; n_tm, n_var_num] (Hashtbl.find th_le_table (cbm^cbn)) in + let op = (fst o dest_const o rator o rator o rand o concl) th0 in + let th1 = + if op = "<" then + raw_lt_hash_conv (rand (concl th0)) + else + raw_le_hash_conv (rand (concl th0)) in + TRANS th0 th1;; + + + +let NUM_LT_HASH_CONV tm = + let atm, rtm = dest_comb tm in + let ltm = rand atm in + let th = INST [rand ltm, m_var_num; rand rtm, n_var_num] LT_NUM in + let rtm = rand(concl th) in + TRANS th (raw_lt_hash_conv rtm);; + + + +let NUM_LE_HASH_CONV tm = + let atm, rtm = dest_comb tm in + let ltm = rand atm in + let th = INST [rand ltm, m_var_num; rand rtm, n_var_num] LE_NUM in + let rtm = rand(concl th) in + TRANS th (raw_le_hash_conv rtm);; + + + +(* +let x = num_of_string "3543593547359325353535";; +let y = num_of_string "9392392983247294924242";; + +let xx = mk_binop lt_op_num (mk_numeral_array x) (mk_numeral_array y);; +let yy = mk_binop lt_op_num (mk_numeral x) (mk_numeral y);; + + +(* 2.38 *) +test 1000 NUM_LT_CONV yy;; +(* 10: 1.248 *) +test 10000 NUM_LT_HASH_CONV xx;; +*) + + + + +(**************************************) + +(* ADD_CONV *) + + +(* ADD theorems *) + +let ADD_NUM = (REWRITE_RULE[GSYM num_def] o prove) + (`NUMERAL m + NUMERAL n = NUMERAL (m + n)`, REWRITE_TAC[NUMERAL]);; + + +let CADD_0_n = prove(`SUC (_0 + n) = SUC n`, REWRITE_TAC[ADD_0_n]);; +let CADD_n_0 = prove(`SUC (n + _0) = SUC n`, REWRITE_TAC[ADD_n_0]);; + +(* B0 (SUC n) = B0 n + maximum *) +let B0_SUC = prove(mk_eq(mk_comb(b0_const, mk_comb(suc_const, n_var_num)), + mk_binop plus_op_num max_const (mk_comb(b0_const, n_var_num))), + REWRITE_TAC [B0_EXPLICIT] THEN ARITH_TAC);; + +let B0_ADD = prove(mk_eq(mk_binop plus_op_num (mk_comb(b0_const, m_var_num)) (mk_comb(b0_const, n_var_num)), + mk_comb(b0_const, mk_binop plus_op_num m_var_num n_var_num)), + REWRITE_TAC[B0_EXPLICIT] THEN ARITH_TAC);; + +let SUC_ADD_RIGHT = prove(`SUC(m + n) = m + SUC n`, ARITH_TAC);; + + +(* Generate all theorems iteratively *) + +let th_add_right_next th = + let lhs, rhs = dest_eq(concl th) in + let ltm, rtm = dest_comb rhs in + let cn = fst(dest_const ltm) in + let suc_th = AP_TERM suc_const th in + let th_rhs = INST[rtm, n_var_num] (Hashtbl.find th_suc_table cn) in + let ltm, rarg = dest_comb lhs in + let larg = rand ltm in + let th1 = INST[larg, m_var_num; rarg, n_var_num] SUC_ADD_RIGHT in + let cn = fst(dest_const(rator rarg)) in + let th2 = Hashtbl.find th_suc_table cn in + let th_lhs = TRANS th1 (AP_TERM ltm th2) in + TRANS (TRANS (SYM th_lhs) suc_th) th_rhs;; + + +let th_add_array = Array.make (maximum * maximum) (REFL zero_const);; + +for i = 0 to maximum - 1 do + let th0 = + if i = 0 then + B0_ADD + else + INST[n_var_num, m_var_num; m_var_num, n_var_num] + (ONCE_REWRITE_RULE[ADD_AC] th_add_array.(i)) in + let _ = th_add_array.(i * maximum) <- th0 in + + for j = 1 to maximum - 1 do + th_add_array.(i * maximum + j) <- th_add_right_next th_add_array.(i * maximum + j - 1) + done; +done;; + + +(* SUC (B_i(m) + B_j(n)) = B_p(...) *) +let th_cadd i j = + let add_th = th_add_array.(i * maximum + j) in + let th0 = AP_TERM suc_const add_th in + let ltm, rtm = dest_comb(rand(concl th0)) in + let ltm, rtm = dest_comb rtm in + let cn = fst(dest_const ltm) in + let suc_th = INST[rtm, n_var_num] (Hashtbl.find th_suc_table cn) in + TRANS th0 suc_th;; + + +let th_cadd_array = Array.make (maximum * maximum) (REFL zero_const);; + +for i = 0 to maximum - 1 do + for j = 0 to maximum - 1 do + th_cadd_array.(i * maximum + j) <- th_cadd i j + done; +done;; + + + +let th_add_table = Hashtbl.create (maximum * maximum);; + +for i = 0 to maximum - 1 do + for j = 0 to maximum - 1 do + let name = names_array.(i) ^ names_array.(j) in + let th = th_add_array.(i * maximum + j) in + let cflag = (i + j >= maximum) in + Hashtbl.add th_add_table name (th, cflag) + done; +done;; + + + +let th_cadd_table = Hashtbl.create (maximum * maximum);; + +for i = 0 to maximum - 1 do + for j = 0 to maximum - 1 do + let name = names_array.(i) ^ names_array.(j) in + let th = th_cadd_array.(i * maximum + j) in + let cflag = (i + j + 1 >= maximum) in + Hashtbl.add th_cadd_table name (th, cflag) + done; +done;; + + + +(* ADD conversion *) + + +let rec raw_add_conv_hash tm = + let atm,rtm = dest_comb tm in + let ltm = rand atm in + if ltm = zero_const then + INST [rtm,n_var_num] ADD_0_n + else if rtm = zero_const then + INST [ltm,n_var_num] ADD_n_0 + else + let lbit,larg = dest_comb ltm + and rbit,rarg = dest_comb rtm in + let name = fst(dest_const lbit) ^ fst(dest_const rbit) in + let th0, cflag = Hashtbl.find th_add_table name in + let th = INST [larg, m_var_num; rarg, n_var_num] th0 in + let ltm, rtm = dest_comb(rand(concl th)) in + if cflag then + TRANS th (AP_TERM ltm (raw_adc_conv_hash rtm)) + else + TRANS th (AP_TERM ltm (raw_add_conv_hash rtm)) +and raw_adc_conv_hash tm = + let atm,rtm = dest_comb (rand tm) in + let ltm = rand atm in + if ltm = zero_const then + let th = INST [rtm,n_var_num] CADD_0_n in + TRANS th (raw_suc_conv_hash (rand(concl th))) + else if rtm = zero_const then + let th = INST [ltm,n_var_num] CADD_n_0 in + TRANS th (raw_suc_conv_hash (rand(concl th))) + else + let lbit,larg = dest_comb ltm + and rbit,rarg = dest_comb rtm in + let name = fst(dest_const lbit) ^ fst(dest_const rbit) in + let th0, cflag = Hashtbl.find th_cadd_table name in + let th = INST [larg, m_var_num; rarg, n_var_num] th0 in + let ltm, rtm = dest_comb(rand(concl th)) in + if cflag then + TRANS th (AP_TERM ltm (raw_adc_conv_hash rtm)) + else + TRANS th (AP_TERM ltm (raw_add_conv_hash rtm));; + + +let NUM_ADD_HASH_CONV tm = + let atm, rtm = dest_comb tm in + let ltm = rand atm in + let th = INST [rand ltm, m_var_num; rand rtm, n_var_num] ADD_NUM in + let ltm, rtm = dest_comb(rand(concl th)) in + TRANS th (AP_TERM ltm (raw_add_conv_hash rtm));; + + +(* +let x = num_of_string "3543593547359325353535";; +let y = num_of_string "9392392983247294924242";; + +let xx = mk_binop plus_op_num (mk_numeral_array x) (mk_numeral_array y);; +let yy = mk_binop plus_op_num (mk_numeral x) (mk_numeral y);; + +NUM_ADD_HASH_CONV xx;; + +test 10000 NUM_ADD_CONV yy;; (* 5.672 *) +(* 10: 1.672 *) +test 10000 NUM_ADD_HASH_CONV xx;; +*) + +(********************************) + +(* Subtraction *) + +let SUB_NUM = prove(mk_eq(mk_binop minus_op_num (mk_comb (num_const, m_var_num)) (mk_comb (num_const, n_var_num)), + mk_comb(num_const, mk_binop minus_op_num m_var_num n_var_num)), + REWRITE_TAC[num_def; NUMERAL]);; + +let SUB_lemma1 = (UNDISCH_ALL o ARITH_RULE) `n + t = m ==> m - n = t:num`;; +let SUB_lemma2 = (UNDISCH_ALL o REWRITE_RULE[NUMERAL] o ARITH_RULE) `m + t = n ==> m - n = 0`;; +let LE_lemma = (UNDISCH_ALL o ARITH_RULE) `n + t = m ==> n <= m:num`;; + + +let raw_sub_hash_conv tm = + let ltm, n_tm = dest_comb tm in + let m_tm = rand ltm in + let m = raw_dest_hash m_tm in + let n = raw_dest_hash n_tm in + let t = m -/ n in + if t >=/ num_0 then + let t_tm = rand (mk_numeral_array t) in + let th0 = INST[n_tm, n_var_num; t_tm, t_var_num; m_tm, m_var_num] SUB_lemma1 in + let th_add = raw_add_conv_hash (mk_binop plus_op_num n_tm t_tm) in + MY_PROVE_HYP th_add th0 + else + let t_tm = rand (mk_numeral_array (Num.abs_num t)) in + let th0 = INST[m_tm, m_var_num; t_tm, t_var_num; n_tm, n_var_num] SUB_lemma2 in + let th_add = raw_add_conv_hash (mk_binop plus_op_num m_tm t_tm) in + MY_PROVE_HYP th_add th0;; + + + +(* Returns either (tm1 - tm2, tm2 <= tm1) or (tm2 - tm1, tm1 <= tm2) *) +let raw_sub_and_le_hash_conv tm1 tm2 = + let m = raw_dest_hash tm1 in + let n = raw_dest_hash tm2 in + let t = m -/ n in + if t >=/ num_0 then + let t_tm = rand (mk_numeral_array t) in + let inst = INST[tm2, n_var_num; t_tm, t_var_num; tm1, m_var_num] in + let th_sub = inst SUB_lemma1 in + let th_le = inst LE_lemma in + let th_add = raw_add_conv_hash (mk_binop plus_op_num tm2 t_tm) in + (MY_PROVE_HYP th_add th_sub, MY_PROVE_HYP th_add th_le) + else + let t_tm = rand (mk_numeral_array (Num.abs_num t)) in + let inst = INST[tm2, m_var_num; t_tm, t_var_num; tm1, n_var_num] in + let th_sub = inst SUB_lemma1 in + let th_le = inst LE_lemma in + let th_add = raw_add_conv_hash (mk_binop plus_op_num tm1 t_tm) in + (MY_PROVE_HYP th_add th_sub, MY_PROVE_HYP th_add th_le);; + + + +let NUM_SUB_HASH_CONV tm = + let atm, rtm = dest_comb tm in + let ltm = rand atm in + let th = INST [rand ltm, m_var_num; rand rtm, n_var_num] SUB_NUM in + let ltm, rtm = dest_comb(rand(concl th)) in + TRANS th (AP_TERM ltm (raw_sub_hash_conv rtm));; + + +(* +let y = num_of_string "3543593547359325353535";; +let x = num_of_string "9392392983247294924242";; + +let xx = mk_binop minus_op_num (mk_numeral_array x) (mk_numeral_array y);; +let yy = mk_binop minus_op_num (mk_numeral x) (mk_numeral y);; + +NUM_SUB_HASH_CONV xx;; + +test 1000 NUM_SUB_CONV yy;; (* 2.376 *) +(* 10: 0.872 *) +test 1000 NUM_SUB_HASH_CONV xx;; +*) + + + +(********************************) + +(* Multiplication *) + +let MUL_NUM = prove(mk_eq(mk_binop mul_op_num (mk_comb(num_const, m_var_num)) (mk_comb(num_const, n_var_num)), + mk_comb(num_const, mk_binop mul_op_num m_var_num n_var_num)), + REWRITE_TAC[num_def; NUMERAL]);; + +let MUL_0_n = prove(`_0 * n = _0`, ONCE_REWRITE_TAC[GSYM NUM_THM] THEN + ONCE_REWRITE_TAC[GSYM MUL_NUM] THEN REWRITE_TAC[num_def] THEN + REWRITE_TAC[MULT_CLAUSES]);; + +let MUL_n_0 = ONCE_REWRITE_RULE[MULT_AC] MUL_0_n;; + +let MUL_1_n, MUL_n_1 = + let one_const = mk_comb (const_array.(1), zero) in + let cond = mk_eq(mk_binop mul_op_num one_const n_var_num, n_var_num) in + let th = (REWRITE_RULE[NUMERAL] o prove)(cond, REWRITE_TAC[def_array.(1)] THEN ARITH_TAC) in + th, ONCE_REWRITE_RULE[MULT_AC] th;; + + + +let MUL_B0_t = prove(mk_eq(mk_binop mul_op_num (mk_comb(b0_const, n_var_num)) t_var_num, + mk_comb(b0_const, mk_binop mul_op_num n_var_num t_var_num)), + REWRITE_TAC[def_array.(0)] THEN ARITH_TAC);; + + +let MUL_t_B0 = ONCE_REWRITE_RULE[MULT_AC] MUL_B0_t;; + + +let MUL_SUC_RIGHT = prove(`m * SUC(n) = m * n + m`, ARITH_TAC);; + + +(* Multiplication table *) + +let mul_th_next_right th = + let ltm, rtm = dest_comb(rand(rator(concl th))) in + let mtm = rand ltm in + let th0 = INST[mtm, m_var_num; rtm, n_var_num] MUL_SUC_RIGHT in + let th1 = AP_THM (AP_TERM plus_op_num th) mtm in + let sum_th = raw_add_conv_hash (rand(concl th1)) in + let th2 = TRANS (TRANS th0 th1) sum_th in + let cn = fst(dest_const (rator rtm)) in + let th_suc = INST[zero_const, n_var_num] (Hashtbl.find th_suc_table cn) in + let th3 = AP_TERM (mk_comb (mul_op_num, mtm)) th_suc in + TRANS (SYM th3) th2;; + + +let mul_array = Array.make (maximum * maximum) (REFL zero_const);; +for i = 1 to maximum - 1 do + let th1 = INST[mk_comb(const_array.(i), zero_const), n_var_num] MUL_n_1 in + let _ = mul_array.(i * maximum + 1) <- th1 in + + for j = 2 to maximum - 1 do + mul_array.(i * maximum + j) <- mul_th_next_right mul_array.(i * maximum + j - 1) + done; +done;; + + + +let mul_table = Hashtbl.create (maximum * maximum);; +for i = 1 to maximum - 1 do + for j = 1 to maximum - 1 do + Hashtbl.add mul_table (names_array.(i) ^ names_array.(j)) mul_array.(i * maximum + j) + done; +done;; + + +(* General multiplication theorem *) + +let prod_lemma = + let mul (a,b) = mk_binop mul_op_num a b and + add (a,b) = mk_binop plus_op_num a b in + let lhs = mul(add(t_var_num, mk_comb(b0_const, m_var_num)), + add(r_var_num, mk_comb(b0_const, n_var_num))) in + let rhs = add(mul(t_var_num, r_var_num), + mk_comb(b0_const, add(mk_comb(b0_const, mul(m_var_num, n_var_num)), + add(mul(m_var_num, r_var_num), + mul(n_var_num, t_var_num))))) in + prove(mk_eq(lhs, rhs), + REWRITE_TAC[LEFT_ADD_DISTRIB; RIGHT_ADD_DISTRIB] THEN + REWRITE_TAC[MUL_B0_t; MUL_t_B0] THEN + ONCE_REWRITE_TAC[GSYM ADD_ASSOC] THEN + REWRITE_TAC[th_add_array.(0)] THEN + REWRITE_TAC[ADD_AC; MULT_AC]);; + +let ADD_ASSOC' = SPEC_ALL ADD_ASSOC;; + +let dest_op tm = + let ltm, rtm = dest_comb tm in + rand ltm, rtm;; + + +(* B_i(m) * B_j(n) = B_p(B_q(m * n) + m * B_j(0) + n * B_i(0)) + where B_p(B_q(0)) = i * j *) +let gen_mul_thm i j = + let bi0 = mk_comb(const_array.(i), zero_const) and + bj0 = mk_comb(const_array.(j), zero_const) in + let def_i = INST[m_var_num, n_var_num] def_thm_array.(i) in + let def_j = def_thm_array.(j) in + let th0 = MK_COMB(AP_TERM mul_op_num def_i, def_j) in + let th1 = TRANS th0 (INST[bi0, t_var_num; bj0, r_var_num] prod_lemma) in + let mul_th = mul_array.(i * maximum + j) in + let larg, rarg = dest_op (rand (concl th1)) in + let th2 = TRANS th1 (AP_THM (AP_TERM plus_op_num mul_th) rarg) in + let larg = rand(concl mul_th) in + let b_low, b_high = dest_comb larg in + let rtm = rand(rarg) in + let th_add = INST[b_high, m_var_num; rtm, n_var_num] + (fst(Hashtbl.find th_add_table (fst(dest_const b_low)^b0_name))) in + if i * j < maximum then + let ltm, rtm = dest_op(rand(rand(concl th_add))) in + let add_0 = AP_TERM b_low (INST[rtm, n_var_num] ADD_0_n) in + TRANS th2 (TRANS th_add add_0) + else + let larg, rtm = dest_op (rand(rand(concl th_add))) in + let rarg, rtm = dest_op rtm in + let th_assoc = INST[larg, m_var_num; rarg, n_var_num; rtm, p_var_num] ADD_ASSOC' in + let mn = rand(rarg) in + let b_high = rator b_high in + let th_add2' = INST[zero_const, m_var_num; mn, n_var_num] + (fst(Hashtbl.find th_add_table (fst(dest_const b_high)^b0_name))) in + let add_0 = AP_TERM b_high (INST[mn, n_var_num] ADD_0_n) in + let th_add2 = TRANS th_add2' add_0 in + let th3 = TRANS th_assoc (AP_THM (AP_TERM plus_op_num th_add2) rtm) in + let th4 = TRANS th_add (AP_TERM b_low th3) in + TRANS th2 th4;; + + +let gen_mul_table = Hashtbl.create (maximum * maximum);; + +for i = 1 to maximum - 1 do + for j = 1 to maximum - 1 do + let name = names_array.(i) ^ names_array.(j) in + Hashtbl.add gen_mul_table name (gen_mul_thm i j) + done; +done;; + + +(* B_i(m) * B_j(0) = B_p(B_q(0) + m * B_j(0)) + where i * j = B_p(B_q(0)) *) +let mul1_right_th i j = + let th0 = INST[zero_const, n_var_num] + (Hashtbl.find gen_mul_table (names_array.(i)^names_array.(j))) in + let b_low, rtm = dest_comb(rand(concl th0)) in + let tm1, tm23 = dest_op rtm in + let tm2p, tm3 = dest_comb tm23 in + let tm3_th = INST[rand tm3, n_var_num] MUL_0_n in + let tm2_th = INST[rand(tm2p), n_var_num] ADD_n_0 in + let tm23_th = TRANS (AP_TERM tm2p tm3_th) tm2_th in + let ltm, rtm = dest_comb tm1 in + if (i * j < maximum) then + let tm1_th = TRANS (AP_TERM ltm (INST[m_var_num, n_var_num] MUL_n_0)) B0_0 in + let tm123_th' = TRANS (INST[tm23, n_var_num] ADD_0_n) tm23_th in + let tm123_th = TRANS (AP_THM (AP_TERM plus_op_num tm1_th) tm23) tm123_th' in + TRANS th0 (AP_TERM b_low tm123_th) + else + let tm1_th = AP_TERM ltm (INST[m_var_num, n_var_num] MUL_n_0) in + let tm123_th = MK_COMB(AP_TERM plus_op_num tm1_th, tm23_th) in + TRANS th0 (AP_TERM b_low tm123_th);; + + +(* B_j(0) * B_i(m) = B_p(B_q(0) + B_j(0) * B_i(m) *) + +let MULT_AC' = CONJUNCT1 MULT_AC;; + +let mul1_left_th th = + let lhs, rhs = dest_eq(concl th) in + let ltm, rtm = dest_op lhs in + let th_lhs = INST[ltm, n_var_num; rtm, m_var_num] MULT_AC' in + let btm, rtm = dest_comb rhs in + let larg, rarg = dest_op rtm in + if (is_comb larg) then + let ltm, rtm = dest_op rarg in + let th_rhs' = INST[ltm, m_var_num; rtm, n_var_num] MULT_AC' in + let th_rhs = AP_TERM (mk_comb(plus_op_num, larg)) th_rhs' in + TRANS th_lhs (TRANS th (AP_TERM btm th_rhs)) + else + let th_rhs = INST[larg, m_var_num; rarg, n_var_num] MULT_AC' in + TRANS th_lhs (TRANS th (AP_TERM btm th_rhs));; + + + + +let mul1_right_th_table = Hashtbl.create (maximum * maximum);; +let mul1_left_th_table = Hashtbl.create (maximum * maximum);; + +for i = 1 to maximum - 1 do + for j = 1 to maximum - 1 do + let name_right = names_array.(i) ^ names_array.(j) in + let name_left = names_array.(j) ^ names_array.(i) in + let th = mul1_right_th i j in + let add_flag = (i * j >= maximum) in + let _ = Hashtbl.add mul1_right_th_table name_right (add_flag, th) in + Hashtbl.add mul1_left_th_table name_left (add_flag, mul1_left_th th) + done; +done;; + + + +(******************************************************) + +(* Conversions *) + + +(* Multiplies arg and (tm = tmname(_0)) *) +let rec raw_mul1_right_hash arg tm tmname = + if arg = zero_const then + INST [tm, n_var_num] MUL_0_n + else + let btm, mtm = dest_comb arg in + let cn = fst(dest_const btm) in + if (cn = b0_name) then + let th = INST[mtm, n_var_num; tm, t_var_num] MUL_B0_t in + TRANS th (AP_TERM b0_const (raw_mul1_right_hash mtm tm tmname)) + else + let name = cn ^ tmname in + if (mtm = zero_const) then + Hashtbl.find mul_table name + else + let add_flag, th' = Hashtbl.find mul1_right_th_table name in + let th = INST[mtm, m_var_num] th' in + if add_flag then + let ltm, rtm = dest_comb(rand(concl th)) in + let lplus, rarg = dest_comb rtm in + let th2 = AP_TERM lplus (raw_mul1_right_hash mtm tm tmname) in + let th_add = raw_add_conv_hash (rand(concl th2)) in + TRANS th (AP_TERM ltm (TRANS th2 th_add)) + else + let ltm = rator(rand(concl th)) in + let th2 = AP_TERM ltm (raw_mul1_right_hash mtm tm tmname) in + TRANS th th2;; + + +(* Multiplies (tm = tmname(_0)) and arg *) +let rec raw_mul1_left_hash tm tmname arg = + if arg = zero_const then + INST [tm, n_var_num] MUL_n_0 + else + let btm, mtm = dest_comb arg in + let cn = fst(dest_const btm) in + if (cn = b0_name) then + let th = INST[mtm, n_var_num; tm, t_var_num] MUL_t_B0 in + TRANS th (AP_TERM b0_const (raw_mul1_left_hash tm tmname mtm)) + else + let name = tmname ^ cn in + if (mtm = zero_const) then + Hashtbl.find mul_table name + else + let add_flag, th' = Hashtbl.find mul1_left_th_table name in + let th = INST[mtm, m_var_num] th' in + if add_flag then + let ltm, rtm = dest_comb(rand(concl th)) in + let lplus, rarg = dest_comb rtm in + let th2 = AP_TERM lplus (raw_mul1_left_hash tm tmname mtm) in + let th_add = raw_add_conv_hash (rand(concl th2)) in + TRANS th (AP_TERM ltm (TRANS th2 th_add)) + else + let ltm = rator(rand(concl th)) in + let th2 = AP_TERM ltm (raw_mul1_left_hash tm tmname mtm) in + TRANS th th2;; + + +(* Computes B_i(m) * B_j(n) *) +let rec raw_mul_conv_hash tm = + let larg, rarg = dest_comb tm in + let larg = rand larg in + if larg = zero_const then + INST [rarg, n_var_num] MUL_0_n + else if rarg = zero_const then + INST [larg, n_var_num] MUL_n_0 + else + + let lbtm, mtm = dest_comb larg in + let lcn = fst(dest_const lbtm) in + if (lcn = b0_name) then + let th = INST[rarg, t_var_num; mtm, n_var_num] MUL_B0_t in + let ltm, rtm = dest_comb(rand(concl th)) in + TRANS th (AP_TERM ltm (raw_mul_conv_hash rtm)) + else + let rbtm, ntm = dest_comb rarg in + let rcn = fst(dest_const rbtm) in + if (rcn = b0_name) then + let th = INST[larg, t_var_num; ntm, n_var_num] MUL_t_B0 in + let ltm, rtm = dest_comb(rand(concl th)) in + TRANS th (AP_TERM ltm (raw_mul_conv_hash rtm)) + else + + if (ntm = zero_const) then + if (mtm = zero_const) then + Hashtbl.find mul_table (lcn ^ rcn) + else + raw_mul1_right_hash larg (mk_comb(rbtm, zero_const)) rcn + else if (mtm = zero_const) then + raw_mul1_left_hash (mk_comb(lbtm, zero_const)) lcn rarg + else + + let th0 = INST[mtm, m_var_num; ntm, n_var_num] + (Hashtbl.find gen_mul_table (lcn ^ rcn)) in + let b_low, expr = dest_comb(rand(concl th0)) in + let ltm, rsum = dest_comb expr in + let b_high, mul0 = dest_comb (rand ltm) in + let th_mul0 = raw_mul_conv_hash mul0 in + let th_mul1 = raw_mul1_right_hash mtm (mk_comb(rbtm, zero_const)) rcn in + let th_mul2 = raw_mul1_right_hash ntm (mk_comb(lbtm, zero_const)) lcn in + let th_larg = AP_TERM plus_op_num (AP_TERM b_high th_mul0) in + let th_rarg = MK_COMB(AP_TERM plus_op_num th_mul1, th_mul2) in + + let add_rarg = TRANS th_rarg (raw_add_conv_hash (rand(concl th_rarg))) in + let add_th = MK_COMB (th_larg, add_rarg) in + let add = TRANS add_th (raw_add_conv_hash (rand(concl add_th))) in + + TRANS th0 (AP_TERM b_low add);; + + + +(* The main multiplication conversion *) +let NUM_MULT_HASH_CONV tm = + let ltm, rtm = dest_comb tm in + let larg, rarg = rand (rand ltm), rand rtm in + let th0 = INST[larg, m_var_num; rarg, n_var_num] MUL_NUM in + if (rand(rator(concl th0)) <> tm) then + failwith "NUM_MULT_HASH_CONV" + else + let rtm = rand(rand(concl th0)) in + let th = raw_mul_conv_hash rtm in + TRANS th0 (AP_TERM num_const th);; + + + +(**************************) + +(* Tests *) + +(* +let x = Int 325325353;; +let y = Int 999434312;; + +let xx = mk_binop mul_op_num (mk_numeral_array x) (mk_numeral_array y);; +let yy = mk_binop mul_op_num (mk_numeral x) (mk_numeral y);; +let zz = rand(concl(REWRITE_CONV[NUM_THM] xx));; + +NUM_MULT_HASH_CONV xx;; + +test 1000 NUM_MULT_CONV yy;; (* 4.12 *) +(* 10: 1.896 *) +test 1000 NUM_MULT_HASH_CONV xx;; (* 4: 1.69; 6: 0.716(1), 0.608(2), 8: 0.328(3) *) +(* 10: 1.864 *) +test 1000 raw_mul_conv_hash zz;; (* 4: 2.45(1), 1.576(2), 8: 0.320 *) + + +needs "example0.hl";; + +let x = map (fun t1, t2 -> mk_binop mul_op_num (mk_numeral t1) (mk_numeral t2)) example;; +let h1 = map (fun t1, t2 -> mk_binop mul_op_num (mk_numeral_array t1) (mk_numeral_array t2)) example;; +let h2 = map (fun t1, t2 -> mk_binop mul_op_num + (rand (mk_numeral_array t1)) + (rand (mk_numeral_array t2))) example;; + + +test 1 (map NUM_MULT_CONV) x;; (* 2.64 *) +test 10 (map NUM_MULT_HASH_CONV) h1;; (* 4: 5.43; 6: 3.12; 8: 1.67 *) +test 10 (map raw_mul_conv_hash) h2;; (* 5.42; 8: 1.576 *) +*) + + + +(************************************) + +(* DIV *) + + +let DIV_NUM = prove(mk_eq(mk_binop div_op_num (mk_comb(num_const, m_var_num)) (mk_comb(num_const, n_var_num)), + mk_comb(num_const, mk_binop div_op_num m_var_num n_var_num)), + REWRITE_TAC[num_def; NUMERAL]);; + + +let DIV_UNIQ' = (UNDISCH_ALL o + PURE_ONCE_REWRITE_RULE[ARITH_RULE `a < b <=> (a < b:num <=> T)`] o + ONCE_REWRITE_RULE[ARITH_RULE `m = q * n + r <=> q * n + r = m:num`] o + REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL) DIV_UNIQ;; + +(* Computes m DIV n *) +let raw_div_hash_conv tm = + let ltm, n_tm = dest_comb tm in + let m_tm = rand ltm in + let m = raw_dest_hash m_tm in + let n = raw_dest_hash n_tm in + let q = Num.quo_num m n and + r = Num.mod_num m n in + let q_tm = rand (mk_numeral_array q) and + r_tm = rand (mk_numeral_array r) in + + let qn_th = raw_mul_conv_hash (mk_binop mul_op_num q_tm n_tm) in + let qn_tm = rand (concl qn_th) in + let qnr_th = raw_add_conv_hash (mk_binop plus_op_num qn_tm r_tm) in + let th1 = TRANS (AP_THM (AP_TERM plus_op_num qn_th) r_tm) qnr_th in + let th2 = raw_lt_hash_conv (mk_binop lt_op_num r_tm n_tm) in + let th0 = INST[r_tm, r_var_num; n_tm, n_var_num; m_tm, m_var_num; q_tm, q_var_num] DIV_UNIQ' in + MY_PROVE_HYP th1 (MY_PROVE_HYP th2 th0);; + + + +(* The main division conversion *) +let NUM_DIV_HASH_CONV tm = + let ltm, rtm = dest_comb tm in + let larg, rarg = rand (rand ltm), rand rtm in + let th0 = INST[larg, m_var_num; rarg, n_var_num] DIV_NUM in + if (rand(rator(concl th0)) <> tm) then + failwith "NUM_DIV_HASH_CONV" + else + let rtm = rand(rand(concl th0)) in + let th = raw_div_hash_conv rtm in + TRANS th0 (AP_TERM num_const th);; + + +(* +let y = num_of_string "3543593547359";; +let x = num_of_string "9392392983247294924242";; + + +let xx = mk_binop div_op_num (mk_numeral_array x) (mk_numeral_array y);; +let yy = mk_binop div_op_num (mk_numeral x) (mk_numeral y);; + +(* 1.844 *) +test 100 NUM_DIV_CONV yy;; +(* 10: 0.428 *) +test 100 NUM_DIV_HASH_CONV xx;; +*) + + + +(*********************************************) + +(* EVEN_CONV, ODD_CONV *) + +let even_const = `EVEN` and + odd_const = `ODD` and + eq_const = `<=>` and + f_const = `F` and + t_const = `T`;; + + + +let EVEN_NUM = (REWRITE_RULE[GSYM num_def] o prove) + (`EVEN (NUMERAL n) <=> EVEN n`, REWRITE_TAC[NUMERAL]);; + +let ODD_NUM = (REWRITE_RULE[GSYM num_def] o prove) + (`ODD (NUMERAL n) <=> ODD n`, REWRITE_TAC[NUMERAL]);; + +let EVEN_ZERO = prove(`EVEN _0 <=> T`, REWRITE_TAC[ARITH_EVEN]);; +let ODD_ZERO = prove(`ODD _0 <=> F`, REWRITE_TAC[ARITH_ODD]);; + + +let EVEN_B0 = prove(mk_eq(mk_comb(`EVEN`, mk_comb(b0_const, `n:num`)), `T`), + REWRITE_TAC[B0_EXPLICIT; EVEN_MULT] THEN + DISJ1_TAC THEN CONV_TAC NUM_EVEN_CONV);; + + +let ODD_B0 = prove(mk_eq(mk_comb(`ODD`, mk_comb(b0_const, `n:num`)), `F`), + REWRITE_TAC[NOT_ODD; EVEN_B0]);; + +let EVEN_SUC_T = prove(`(EVEN (SUC n) <=> T) <=> (EVEN n <=> F)`, REWRITE_TAC[EVEN]);; +let EVEN_SUC_F = prove(`(EVEN (SUC n) <=> F) <=> (EVEN n <=> T)`, REWRITE_TAC[EVEN]);; + +let ODD_SUC_T = prove(`(ODD (SUC n) <=> T) <=> (ODD n <=> F)`, REWRITE_TAC[ODD]);; +let ODD_SUC_F = prove(`(ODD (SUC n) <=> F) <=> (ODD n <=> T)`, REWRITE_TAC[ODD]);; + + + +let next_even_th th = + let ltm, rtm = dest_comb(concl th) in + let b_tm = rand(rand ltm) in + let suc_b = raw_suc_conv_hash (mk_comb (suc_const, b_tm)) in + let flag = (fst o dest_const) rtm = "T" in + let th0 = SYM (AP_TERM even_const suc_b) in + let th1 = AP_THM (AP_TERM eq_const th0) (if flag then f_const else t_const) in + let th2 = INST[b_tm, n_var_num] (if flag then EVEN_SUC_F else EVEN_SUC_T) in + EQ_MP (SYM (TRANS th1 th2)) th;; + + +let next_odd_th th = + let ltm, rtm = dest_comb(concl th) in + let b_tm = rand(rand ltm) in + let suc_b = raw_suc_conv_hash (mk_comb (suc_const, b_tm)) in + let flag = (fst o dest_const) rtm = "T" in + let th0 = SYM (AP_TERM odd_const suc_b) in + let th1 = AP_THM (AP_TERM eq_const th0) (if flag then f_const else t_const) in + let th2 = INST[b_tm, n_var_num] (if flag then ODD_SUC_F else ODD_SUC_T) in + EQ_MP (SYM (TRANS th1 th2)) th;; + + +let even_thm_table = Hashtbl.create maximum;; + + +Hashtbl.add even_thm_table names_array.(0) EVEN_B0;; + + +for i = 1 to maximum - 1 do + let th0 = next_even_th (Hashtbl.find even_thm_table names_array.(i - 1)) in + Hashtbl.add even_thm_table names_array.(i) th0 +done;; + + +let odd_thm_table = Hashtbl.create maximum;; + +Hashtbl.add odd_thm_table names_array.(0) ODD_B0;; + +for i = 1 to maximum - 1 do + let th0 = next_odd_th (Hashtbl.find odd_thm_table names_array.(i - 1)) in + Hashtbl.add odd_thm_table names_array.(i) th0 +done;; + + +let raw_even_hash_conv tm = + let ltm, rtm = dest_comb tm in + if ((fst o dest_const) ltm <> "EVEN") then + failwith "raw_even_hash_conv: no EVEN" + else + if (is_const rtm) then + EVEN_ZERO + else + let b_tm, n_tm = dest_comb rtm in + let th0 = Hashtbl.find even_thm_table ((fst o dest_const) b_tm) in + INST[n_tm, n_var_num] th0;; + + +let raw_odd_hash_conv tm = + let ltm, rtm = dest_comb tm in + if ((fst o dest_const) ltm <> "ODD") then + failwith "raw_odd_hash_conv: no ODD" + else + if (is_const rtm) then + ODD_ZERO + else + let b_tm, n_tm = dest_comb rtm in + let th0 = Hashtbl.find odd_thm_table ((fst o dest_const) b_tm) in + INST[n_tm, n_var_num] th0;; + + + +let NUM_EVEN_HASH_CONV tm = + let ltm, rtm = dest_comb tm in + let th0 = INST[rand rtm, n_var_num] EVEN_NUM in + let ltm, rtm = dest_comb(concl th0) in + if (rand ltm <> tm) then + failwith "NUM_EVEN_HASH_CONV" + else + let th1 = raw_even_hash_conv rtm in + TRANS th0 th1;; + + +let NUM_ODD_HASH_CONV tm = + let ltm, rtm = dest_comb tm in + let th0 = INST[rand rtm, n_var_num] ODD_NUM in + let ltm, rtm = dest_comb(concl th0) in + if (rand ltm <> tm) then + failwith "NUM_ODD_HASH_CONV" + else + let th1 = raw_odd_hash_conv rtm in + TRANS th0 th1;; + + + +end;; + + diff --git a/formal_lp/old/arith/arith_hash_int.hl b/formal_lp/old/arith/arith_hash_int.hl new file mode 100644 index 0000000..3938cf3 --- /dev/null +++ b/formal_lp/old/arith/arith_hash_int.hl @@ -0,0 +1,277 @@ +needs "../formal_lp/arith/arith_hash2.hl";; + +(* Based on the code of calc_int.ml *) + +let test = Arith_hash2.test;; + +let to_numeral = Arith_hash2.NUM_TO_NUMERAL_CONV;; +let from_numeral = Arith_hash2.NUMERAL_TO_NUM_CONV;; +let mk_num = Arith_hash2.mk_numeral_array;; +let dest_num = Arith_hash2.dest_numeral_hash;; +let num_suc = Arith_hash2.NUM_SUC_HASH_CONV;; +let num_add = Arith_hash2.NUM_ADD_HASH_CONV;; +let num_mul = Arith_hash2.NUM_MULT_HASH_CONV;; +let num_gt0 = Arith_hash2.NUM_GT0_HASH_CONV;; + + +(* Constants *) + +let n_var_num = `n:num` and + m_var_num = `m:num` and + x_var_real = `x:real` and + y_var_real = `y:real`;; + + + +let neg_op_real = `(--):real->real` and + amp_op_real = `(&):num->real` and + plus_op_real = `(+):real->real->real` and + minus_op_real = `(-):real->real->real` and + mul_op_real = `( * ):real->real->real` and + le_op_real = `(<=):real->real->bool` and + lt_op_real = `(<):real->real->bool`;; + + +let my_mk_realintconst n = + if n >=/ Int 0 then mk_comb(amp_op_real, mk_num n) + else mk_comb(neg_op_real, mk_comb(amp_op_real, mk_num (minus_num n)));; + + +let my_dest_realintconst tm = + let ltm, rtm = dest_comb tm in + if (ltm = neg_op_real) then + let amp_tm, n_tm = dest_comb rtm in + if (amp_tm = amp_op_real) then + minus_num (dest_num n_tm) + else + failwith "my_dest_realintconst: --(&n) expected" + else + if (ltm = amp_op_real) then + dest_num rtm + else + failwith "my_dest_realintconst: &n expected";; + + + +let is_neg_comb tm = is_comb tm && rator tm = neg_op_real;; + + +let replace_numerals = (rand o concl o DEPTH_CONV from_numeral);; +let REPLACE_NUMERALS = CONV_RULE (DEPTH_CONV from_numeral);; + + +let zero_const = replace_numerals `&0`;; + + +(***************************************) + +(* NEG *) + +let neg_0 = (REPLACE_NUMERALS o prove)(`-- &0 = &0`, REAL_ARITH_TAC) and + neg_neg = prove(`--(--(&n)) = &n`, REAL_ARITH_TAC);; + + +let my_real_int_neg_conv tm = + let neg_tm, rtm = dest_comb tm in + if (neg_tm = neg_op_real) then + if (rtm = zero_const) then + neg_0 + else + let neg_tm, rtm = dest_comb rtm in + let amp_tm, n_tm = dest_comb rtm in + if (neg_tm = neg_op_real && amp_tm = amp_op_real) then + INST[n_tm, n_var_num] neg_neg + else + failwith "my_real_int_neg_conv: --(--(&n)) expected" + else + failwith "my_real_int_neg_conv: --x expected";; + + +(* +let tm = `-- -- &12241`;; + +(* 1.880 *) +test 100000 REAL_INT_NEG_CONV tm;; +(* 0.292 *) +test 100000 my_real_int_neg_conv tm;; +*) + + + +(***************************************) + +(* ADD *) + +let pth1 = prove(`(--(&m) + --(&n) = --(&(m + n)))`, REWRITE_TAC[GSYM REAL_OF_NUM_ADD; REAL_NEG_ADD]) and + pth2 = prove(`(--(&m) + &(m + n) = &n)`, REWRITE_TAC[GSYM REAL_OF_NUM_ADD] THEN REAL_ARITH_TAC) and + pth3 = prove(`(--(&(m + n)) + &m = --(&n))`, REWRITE_TAC[GSYM REAL_OF_NUM_ADD] THEN REAL_ARITH_TAC) and + pth4 = prove(`(&(m + n) + --(&m) = &n)`, REWRITE_TAC[GSYM REAL_OF_NUM_ADD] THEN REAL_ARITH_TAC) and + pth5 = prove(`(&m + --(&(m + n)) = --(&n))`, REWRITE_TAC[GSYM REAL_OF_NUM_ADD] THEN REAL_ARITH_TAC) and + pth6 = prove(`(&m + &n = &(m + n))`, REWRITE_TAC[GSYM REAL_OF_NUM_ADD]);; + + +let my_real_int_add_conv = + let dest = dest_binop plus_op_real in + (fun tm -> + try let l,r = dest tm in + if rator l = neg_op_real then + if rator r = neg_op_real then + let th1 = INST [rand(rand l), m_var_num; rand(rand r), n_var_num] pth1 in + let tm1 = rand(rand(rand(concl th1))) in + let th2 = AP_TERM neg_op_real (AP_TERM amp_op_real (num_add tm1)) in + TRANS th1 th2 + else + let m = rand(rand l) and n = rand r in + let m' = dest_num m and n' = dest_num n in + if m' <=/ n' then + let p = mk_num (n' -/ m') in + let th1 = INST [m,m_var_num; p,n_var_num] pth2 in + let th2 = num_add (rand(rand(lhand(concl th1)))) in + let th3 = AP_TERM (rator tm) (AP_TERM amp_op_real (SYM th2)) in + TRANS th3 th1 + else + let p = mk_num (m' -/ n') in + let th1 = INST [n,m_var_num; p,n_var_num] pth3 in + let th2 = num_add (rand(rand(lhand(lhand(concl th1))))) in + let th3 = AP_TERM neg_op_real (AP_TERM amp_op_real (SYM th2)) in + let th4 = AP_THM (AP_TERM plus_op_real th3) (rand tm) in + TRANS th4 th1 + else + if rator r = neg_op_real then + let m = rand l and n = rand(rand r) in + let m' = dest_num m and n' = dest_num n in + if n' <=/ m' then + let p = mk_num (m' -/ n') in + let th1 = INST [n,m_var_num; p,n_var_num] pth4 in + let th2 = num_add (rand(lhand(lhand(concl th1)))) in + let th3 = AP_TERM plus_op_real (AP_TERM amp_op_real (SYM th2)) in + let th4 = AP_THM th3 (rand tm) in + TRANS th4 th1 + else + let p = mk_num (n' -/ m') in + let th1 = INST [m,m_var_num; p,n_var_num] pth5 in + let th2 = num_add (rand(rand(rand(lhand(concl th1))))) in + let th3 = AP_TERM neg_op_real (AP_TERM amp_op_real (SYM th2)) in + let th4 = AP_TERM (rator tm) th3 in + TRANS th4 th1 + else + let th1 = INST [rand l,m_var_num; rand r,n_var_num] pth6 in + let tm1 = rand(rand(concl th1)) in + let th2 = AP_TERM amp_op_real (num_add tm1) in + TRANS th1 th2 + with Failure _ -> failwith "my_real_int_add_conv");; + + +(* +let tm = `&3252375395 + --(&3454570237434)`;; +let tm' = replace_numerals tm;; + +(* 1.192 *) +test 1000 REAL_INT_ADD_CONV tm;; +(* 0.224 *) +test 1000 my_real_int_add_conv tm';; +*) + + +(****************************************) + +(* SUB *) + +let real_sub' = SPEC_ALL real_sub;; + +let my_real_int_sub_conv tm = + let x_tm, y_tm = dest_binop minus_op_real tm in + let th0 = INST[x_tm, x_var_real; y_tm, y_var_real] real_sub' in + if (is_neg_comb y_tm) then + let ltm, rtm = dest_comb(rand(concl th0)) in + let neg_th = my_real_int_neg_conv rtm in + let th1 = AP_TERM ltm neg_th in + let th2 = my_real_int_add_conv (rand(concl th1)) in + TRANS th0 (TRANS th1 th2) + else + let th1 = my_real_int_add_conv (rand(concl th0)) in + TRANS th0 th1;; + + +(* +let tm = `-- &35252352362346236236 - (-- &12236236363523)`;; +let tm' = replace_numerals tm;; + +(* 1.860 *) +test 1000 REAL_INT_SUB_CONV tm;; +(* 0.348 *) +test 1000 my_real_int_sub_conv tm';; +*) + + + + +(****************************************) + +(* MUL *) + + +let mul_pp = prove(`&m * &n = &(m * n)`, REWRITE_TAC[REAL_OF_NUM_MUL]);; +let mul_nn = prove(`--(&m) * --(&n) = &(m * n)`, REWRITE_TAC[REAL_NEG_MUL2; mul_pp]) and + mul_np = prove(`--(&m) * &n = --(&(m * n))`, REWRITE_TAC[REAL_MUL_LNEG; mul_pp]) and + mul_pn = prove(`&m * --(&n) = --(&(m * n))`, REWRITE_TAC[REAL_MUL_RNEG; mul_pp]);; + + +let my_real_int_mul_conv tm = + let l, r = dest_binop mul_op_real tm in + if rator l = neg_op_real then + if rator r = neg_op_real then + let th1 = INST [rand(rand l), m_var_num; rand(rand r), n_var_num] mul_nn in + let tm1 = rand(rand(concl th1)) in + let th2 = AP_TERM amp_op_real (num_mul tm1) in + TRANS th1 th2 + else + let th1 = INST [rand(rand l), m_var_num; rand r, n_var_num] mul_np in + let tm1 = rand(rand(rand(concl th1))) in + let th2 = AP_TERM neg_op_real (AP_TERM amp_op_real (num_mul tm1)) in + TRANS th1 th2 + else + if rator r = neg_op_real then + let th1 = INST[rand l, m_var_num; rand(rand r), n_var_num] mul_pn in + let tm1 = rand(rand(rand(concl th1))) in + let th2 = AP_TERM neg_op_real (AP_TERM amp_op_real (num_mul tm1)) in + TRANS th1 th2 + else + let th1 = INST[rand l, m_var_num; rand r, n_var_num] mul_pp in + let tm1 = rand(rand(concl th1)) in + let th2 = AP_TERM amp_op_real (num_mul tm1) in + TRANS th1 th2;; + + + +(* +let amp x = mk_comb(amp_op_real, x);; +let negate x = mk_comb(neg_op_real, x);; + +let x = num_of_string "398537263103485";; +let y = num_of_string "243089539573957";; + + +let xx = amp (mk_num x) and yy = amp (mk_num y);; +let xxx = amp (mk_numeral x) and yyy = amp (mk_numeral y);; + + +(* 1.800 *) +test 100 REAL_INT_MUL_CONV (mk_binop mul_op_real (negate xxx) yyy);; + +(* 0.108 *) +test 100 my_real_int_mul_conv (mk_binop mul_op_real (negate xx) yy);; + +(DEPTH_CONV NUM_TO_NUMERAL_CONV) (concl(REAL_BITS_MUL_CONV (mk_binop mul_op_real xx yy))) + +*) + + + + + + + + + + diff --git a/formal_lp/old/arith/arith_hash_rat.hl b/formal_lp/old/arith/arith_hash_rat.hl new file mode 100644 index 0000000..5542205 --- /dev/null +++ b/formal_lp/old/arith/arith_hash_rat.hl @@ -0,0 +1,389 @@ +needs "../formal_lp/arith/arith_hash_int.hl";; + + +let MY_PROVE_HYP hyp th = EQ_MP (DEDUCT_ANTISYM_RULE hyp th) hyp;; +let REFL_CONV tm = EQT_INTRO (REFL (rand tm));; + + +(* Constants *) + +let div_op_real = `(/):real->real->real` and + inv_op_real = `inv:real->real`;; + + +let REPLACE_NUMERALS_CONV = DEPTH_CONV from_numeral;; +let REPLACE_NUMERALS = CONV_RULE REPLACE_NUMERALS_CONV;; +let REPLACE_NUMS = CONV_RULE (DEPTH_CONV to_numeral);; + + +(******************************) + +(* INT_RAT_CONV *) + +let int_to_rat = (REPLACE_NUMERALS o prove) (`&n = &n / &1`, + CONV_TAC (DEPTH_CONV to_numeral) THEN REAL_ARITH_TAC) and + neg_int_to_rat = (REPLACE_NUMERALS o prove) (`-- &n = -- &n / &1`, + CONV_TAC (DEPTH_CONV to_numeral) THEN REAL_ARITH_TAC);; + + +let my_real_int_rat_conv tm = + if (is_binop div_op_real tm) then + REFL tm + else + let ltm, rtm = dest_comb tm in + if (ltm = neg_op_real) then + let amp_tm, n_tm = dest_comb rtm in + if (amp_tm = amp_op_real) then + INST[n_tm, n_var_num] neg_int_to_rat + else + failwith "my_real_int_rat_conv: --(&n) expected" + else + if (ltm = amp_op_real) then + INST[rtm, n_var_num] int_to_rat + else + failwith "my_real_int_rat_conv: &n expected";; + + +(* +let tm = `-- &343`;; +(* 0.180 *) +test 10000 REAL_INT_RAT_CONV tm;; +(* 0.044 *) +test 10000 my_real_int_rat_conv tm;; +*) + + + +(*********************************) + +(* ADD *) + +let add_th = (UNDISCH_ALL o REPLACE_NUMERALS o prove) (`0 < n1==> 0 < n2 ==> 0 < n3 ==> + (x1 * &n2 + x2 * &n1) * &n3 = x3 * &n1 * &n2 ==> + x1 / &n1 + x2 / &n2 = x3 / &n3`, + REWRITE_TAC[GSYM REAL_OF_NUM_LT] THEN + MAP_EVERY ABBREV_TAC [`y1 = &n1`; `y2 = &n2`; `y3 = &n3`] THEN + REPEAT DISCH_TAC THEN + MP_TAC RAT_LEMMA2 THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN SUBST1_TAC THEN + REWRITE_TAC[GSYM REAL_INV_MUL; GSYM real_div] THEN + SUBGOAL_THEN `&0 < y1 * y2 /\ &0 < y3` MP_TAC THENL + [ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LT_MUL THEN + ASM_REWRITE_TAC[]; + DISCH_THEN(fun th -> ASM_REWRITE_TAC[MATCH_MP RAT_LEMMA5 th])]);; + +let x1_var = `x1:real` and x2_var = `x2:real` and x3_var = `x3:real` and + y1_var = `y1:real` and y2_var = `y2:real` and + n1_var = `n1:num` and n2_var = `n2:num` and n3_var = `n3:num`;; + + +let raw_real_rat_add_conv tm = + let r1, r2 = dest_binop plus_op_real tm in + let x1_tm, y1_tm = dest_binop div_op_real r1 and + x2_tm, y2_tm = dest_binop div_op_real r2 in + let x1n = my_dest_realintconst x1_tm and + y1n = my_dest_realintconst y1_tm and + x2n = my_dest_realintconst x2_tm and + y2n = my_dest_realintconst y2_tm in + let x3n = x1n */ y2n +/ x2n */ y1n and + y3n = y1n */ y2n in + let d = gcd_num x3n y3n in + let x3n' = quo_num x3n d and y3n' = quo_num y3n d in + let x3n'',y3n'' = if y3n' >/ Int 0 then x3n',y3n' + else minus_num x3n',minus_num y3n' in + let x3_tm = my_mk_realintconst x3n'' and + y3_tm = my_mk_realintconst y3n'' in + + let n1_tm = rand y1_tm and n2_tm = rand y2_tm and n3_tm = rand y3_tm in + let n1_pos = EQT_ELIM(num_gt0 n1_tm) and + n2_pos = EQT_ELIM(num_gt0 n2_tm) and + n3_pos = EQT_ELIM(num_gt0 n3_tm) in + + let th0 = INST [x1_tm, x1_var; n1_tm, n1_var; x2_tm, x2_var; + n2_tm, n2_var; x3_tm, x3_var; n3_tm, n3_var] add_th in + let th1 = MY_PROVE_HYP n1_pos (MY_PROVE_HYP n2_pos (MY_PROVE_HYP n3_pos th0)) in + let tm2, tm3 = (dest_eq o hd o hyp) th1 in + let th2 = (LAND_CONV (BINOP_CONV my_real_int_mul_conv THENC + my_real_int_add_conv) THENC my_real_int_mul_conv) tm2 and + th3 = (RAND_CONV my_real_int_mul_conv THENC my_real_int_mul_conv) tm3 in + MY_PROVE_HYP (TRANS th2 (SYM th3)) th1;; + + +let my_real_rat_add_conv tm = + (BINOP_CONV my_real_int_rat_conv THENC raw_real_rat_add_conv) tm;; + + +(* +let tm = `-- &235346 / &146424 + -- &44635 / &3463462`;; +let tm' = replace_numerals tm;; + +(* 2.868 *) +test 100 REAL_RAT_ADD_CONV tm;; +(* 0.216 *) +test 100 my_real_rat_add_conv tm';; +*) + + +(*************************************) + +(* MUL *) + +let mul_nocancel = prove(`(x1 / y1) * (x2 / y2) = (x1 * x2) / (y1 * y2)`, + REWRITE_TAC[real_div; REAL_INV_MUL; REAL_MUL_AC]);; +let mul_cancel = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o REPLACE_NUMERALS o prove) + (`0 < n1 /\ 0 < n2 /\ + (&n1 * u1 = x1) /\ (&n2 * u2 = x2) /\ + (&n2 * v1 = y1) /\ (&n1 * v2 = y2) + ==> ((x1 / y1) * (x2 / y2) = (u1 * u2) / (v1 * v2))`, + REWRITE_TAC[ARITH_RULE `0 < n <=> ~(n = 0)`] THEN + REWRITE_TAC[GSYM REAL_OF_NUM_EQ] THEN + MAP_EVERY ABBREV_TAC [`d1 = &n1`; `d2 = &n2`] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + DISCH_THEN(REPEAT_TCL CONJUNCTS_THEN (SUBST1_TAC o SYM)) THEN + ASM_REWRITE_TAC[real_div; REAL_INV_MUL] THEN + ONCE_REWRITE_TAC[AC REAL_MUL_AC + `((d1 * u1) * (id2 * iv1)) * ((d2 * u2) * id1 * iv2) = + (u1 * u2) * (iv1 * iv2) * (id2 * d2) * (id1 * d1)`] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_MUL_RID]);; + +let u1_var = `u1:real` and v1_var = `v1:real` and + u2_var = `u2:real` and v2_var = `v2:real`;; + + + +let raw_real_rat_mul_conv tm = + let r1,r2 = dest_binop mul_op_real tm in + let x1',y1' = dest_binop div_op_real r1 and + x2',y2' = dest_binop div_op_real r2 in + + let x1n = my_dest_realintconst x1' and + y1n = my_dest_realintconst y1' and + x2n = my_dest_realintconst x2' and + y2n = my_dest_realintconst y2' in + + let d1n = gcd_num x1n y2n and + d2n = gcd_num x2n y1n in + if d1n = num_1 & d2n = num_1 then + let th0 = INST [x1',x1_var; y1',y1_var; x2',x2_var; y2',y2_var] mul_nocancel in + let th1 = BINOP_CONV my_real_int_mul_conv (rand(concl th0)) in + TRANS th0 th1 + else + let u1n = quo_num x1n d1n and + u2n = quo_num x2n d2n and + v1n = quo_num y1n d2n and + v2n = quo_num y2n d1n in + let u1' = my_mk_realintconst u1n and + u2' = my_mk_realintconst u2n and + v1' = my_mk_realintconst v1n and + v2' = my_mk_realintconst v2n and + n1' = mk_num d1n and + n2' = mk_num d2n in + + let th0 = INST [x1',x1_var; y1',y1_var; x2',x2_var; y2',y2_var; + u1',u1_var; v1',v1_var; u2',u2_var; v2',v2_var; + n1',n1_var; n2',n2_var] mul_cancel in + let n1_pos = EQT_ELIM(num_gt0 n1') and + n2_pos = EQT_ELIM(num_gt0 n2') in + let th1 = MY_PROVE_HYP n1_pos (MY_PROVE_HYP n2_pos th0) in + let hyp_ths = map (EQT_ELIM o (LAND_CONV my_real_int_mul_conv THENC REFL_CONV)) (hyp th1) in + let th2 = itlist MY_PROVE_HYP hyp_ths th1 in + let th3 = BINOP_CONV my_real_int_mul_conv (rand(concl th2)) in + TRANS th2 th3;; + + +let my_real_rat_mul_conv tm = + (BINOP_CONV my_real_int_rat_conv THENC raw_real_rat_mul_conv) tm;; + + +(* +let tm = `-- &656 / &4567 * &4566 / &3666`;; +let tm' = replace_numerals tm;; + +my_real_rat_mul_conv tm';; + +(* 6.384 *) +test 1000 REAL_RAT_MUL_CONV tm;; +(* 0.640 *) +test 1000 my_real_rat_mul_conv tm';; +*) + + + +(***********************************) + +(* DIV *) + + +let div_th = prove(`(x1 / y1) / (x2 / y2) = (x1 / y1) * (y2 / x2)`, + REWRITE_TAC[real_div; REAL_INV_MUL; REAL_INV_INV; REAL_MUL_AC]);; + + +let my_real_rat_div_conv tm = + let th0 = BINOP_CONV my_real_int_rat_conv tm in + let r1, r2 = dest_binop div_op_real (rand(concl th0)) in + let x1, y1 = dest_binop div_op_real r1 and + x2, y2 = dest_binop div_op_real r2 in + let th1 = INST[x1,x1_var; y1,y1_var; x2,x2_var; y2,y2_var] div_th in + let th2 = raw_real_rat_mul_conv (rand(concl th1)) in + TRANS th0 (TRANS th1 th2);; + + + + +(***********************************************) + +(* Polynomial functions *) + + +let poly_f = new_definition `poly_f cs x = ITLIST (\c s. c + x * s) cs (&0)`;; + +(* Even function *) +let poly_f_even = new_definition `poly_f_even cs x = ITLIST (\c s. c + (x * x) * s) cs (&0)`;; +(* Odd function *) +let poly_f_odd = new_definition `poly_f_odd cs x = x * poly_f_even cs x`;; +let poly_f_odd' = SPECL[`t:(real)list`; `x:real`] poly_f_odd;; + +let POLY_F_EMPTY = (REPLACE_NUMERALS o prove) (`poly_f [] x = &0`, REWRITE_TAC[poly_f; ITLIST]) and + POLY_F_CONS = prove(`poly_f (CONS h t) x = h + x * poly_f t x`, REWRITE_TAC[poly_f; ITLIST]);; + +let POLY_F_EVEN_EMPTY = (REPLACE_NUMERALS o prove) (`poly_f_even [] x = &0`, REWRITE_TAC[poly_f_even; ITLIST]) and + POLY_F_EVEN_CONS = prove(`poly_f_even (CONS h t) x = h + (x * x) * poly_f_even t x`, REWRITE_TAC[poly_f_even; ITLIST]);; + +let POLY_F_ODD_EMPTY = (REPLACE_NUMERALS o prove) (`poly_f_odd [] x = &0`, REWRITE_TAC[poly_f_odd; poly_f_even; ITLIST; REAL_MUL_RZERO]);; + + +let x_var = `x:real` and + h_var = `h:real` and + t_var = `t:(real)list`;; + + +(*************************) + +(* poly_f_conv, poly_f_even_conv, poly_f_odd_conv *) + + + +let poly_f_conv tm = + let ltm, x_tm = dest_comb tm in + let list_tm = rand ltm in + let inst_t = INST[x_tm, x_var] in + let poly_f_cons, poly_f_empty = inst_t POLY_F_CONS, inst_t POLY_F_EMPTY in + + let rec poly_f_conv_raw list_tm = + if (is_comb list_tm) then + let h_tm, t_tm = dest_comb list_tm in + let th0 = INST[rand h_tm, h_var; t_tm, t_var] poly_f_cons in + let h_plus, rtm = dest_comb(rand(concl th0)) in + let x_times = rator rtm in + let th1 = poly_f_conv_raw t_tm in + let th2 = TRANS th0 (AP_TERM h_plus (AP_TERM x_times th1)) in + let th3 = (RAND_CONV my_real_rat_mul_conv THENC my_real_rat_add_conv) (rand(concl th2)) in + TRANS th2 th3 + else + poly_f_empty in + + poly_f_conv_raw list_tm;; + + + +let poly_f_even_conv tm = + let ltm, x_tm = dest_comb tm in + let list_tm = rand ltm in + let inst_t = INST[x_tm, x_var] in + let poly_f_even_cons = inst_t POLY_F_EVEN_CONS and + poly_f_even_empty = inst_t POLY_F_EVEN_EMPTY in + let x2_times = AP_TERM mul_op_real (my_real_rat_mul_conv (mk_binop mul_op_real x_tm x_tm)) in + + let rec poly_f_even_conv_raw list_tm = + if (is_comb list_tm) then + let h_tm, t_tm = dest_comb list_tm in + let th0 = INST[rand h_tm, h_var; t_tm, t_var] poly_f_even_cons in + let h_plus, rtm = dest_comb(rand(concl th0)) in + let th1 = poly_f_even_conv_raw t_tm in + let th2 = TRANS th0 (AP_TERM h_plus (MK_COMB(x2_times, th1))) in + let th3 = (RAND_CONV my_real_rat_mul_conv THENC my_real_rat_add_conv) (rand(concl th2)) in + TRANS th2 th3 + else + poly_f_even_empty in + + poly_f_even_conv_raw list_tm;; + + + +let poly_f_odd_conv tm = + let ltm, x_tm = dest_comb tm in + let list_tm = rand ltm in + let th0 = INST[list_tm, t_var; x_tm, x_var] poly_f_odd' in + let ltm, rtm = dest_comb(rand(concl th0)) in + let th1 = AP_TERM ltm (poly_f_even_conv rtm) in + let th2 = my_real_rat_mul_conv (rand(concl th1)) in + TRANS th0 (TRANS th1 th2);; + + + +(* +let tm = `poly_f [-- &1436346 / &436346; -- &244664 / &4654235; &3 / &43545] (-- &144545 / &2345345)`;; +let tm2 = (rand o concl) (REWRITE_CONV[poly_f; ITLIST] tm);; +let tm' = replace_numerals tm;; + +poly_f_conv tm';; + +(* 3.280 *) +test 10 (REWRITE_CONV [poly_f; ITLIST] THENC REAL_RAT_REDUCE_CONV) tm;; +(* 3.188 *) +test 10 REAL_RAT_REDUCE_CONV tm2;; +(* 0.184 *) +test 10 poly_f_conv tm';; +*) + + +(********************************) + + +(* +let REVERSE_TABLE = define `(REVERSE_TABLE (f:num->A) 0 = []) /\ + (REVERSE_TABLE f (SUC i) = CONS (f i) ( REVERSE_TABLE f i))`;; + +let TABLE = new_definition `!(f:num->A) k. TABLE f k = REVERSE (REVERSE_TABLE f k)`;; + + +let rec reverse_table_conv tm = + let ltm, i_tm = dest_comb tm in + if (i_tm = `0`) then + ONCE_REWRITE_CONV[REVERSE_TABLE] tm + else + let i_suc = num_CONV i_tm in + let th1 = ONCE_REWRITE_RULE[REVERSE_TABLE] (AP_TERM ltm i_suc) in + let ltm, rtm = dest_comb (rand(concl th1)) in + let th2 = reverse_table_conv rtm in + TRANS th1 (AP_TERM ltm th2);; + + +let cos_taylor n = + let tm = mk_comb(`TABLE (\k. (if (EVEN k) then &1 else --(&1)) / &(FACT(2 * k)))`, + mk_small_numeral n) in + (rand o concl) ((REWRITE_CONV[TABLE] THENC + ONCE_DEPTH_CONV reverse_table_conv THENC + REWRITE_CONV[REVERSE; APPEND] THENC NUM_REDUCE_CONV) tm);; + + +let cos_poly n x = + let tm = mk_comb(mk_comb(`poly_f_even`, cos_taylor n), x) in + let tm' = replace_numerals tm in + tm';; + +let x = rand(concl(REWRITE_CONV[DECIMAL] `#1.230959417`));; + +let tm = cos_poly 6 x;; + +let tm' = (rand(concl(REPLACE_NUMS (REWRITE_CONV[poly_f_even; ITLIST] tm))));; +(* 5.860 *) +test 1 REAL_RAT_REDUCE_CONV tm';; + +(* 0.200 *) +test 1 poly_f_even_conv tm;; +let result = poly_f_even_conv tm;; +REPLACE_NUMS result;; +*) diff --git a/formal_lp/old/arith/arith_options.hl b/formal_lp/old/arith/arith_options.hl new file mode 100644 index 0000000..b4f6288 --- /dev/null +++ b/formal_lp/old/arith/arith_options.hl @@ -0,0 +1,21 @@ +(*************************************) +(* Options of the arithmetic library *) +(*************************************) +module Arith_options = struct + +(* Base of arithmetic operations with natural numbers *) +(* The base should be even in order to represent inv(2) exactly *) +let base = 200;; +(* If true then special optimized binary operations are used for the natural + number arithmetic whenever possible *) +let binary = false;; +(* If true then operation results are cached for the natural number arithmetic *) +let cached = true;; + +(* Minimal exponent value for floating point numbers + (should be even for the square root operation) *) +let min_exp = 50;; +(* If true, then arithmetic operations with floating point numbers are cached *) +let float_cached = true;; + +end;; diff --git a/formal_lp/old/arith/float.hl b/formal_lp/old/arith/float.hl new file mode 100644 index 0000000..3d3c92c --- /dev/null +++ b/formal_lp/old/arith/float.hl @@ -0,0 +1,4613 @@ +(*****************************) +(* Floating point arithmetic *) +(*****************************) + +(* Dependencies *) +needs "../formal_lp/arith/nat.hl";; +needs "../formal_lp/arith/num_exp_theory.hl";; +needs "../formal_lp/arith/float_theory.hl";; +needs "../formal_lp/arith/interval_arith.hl";; + + +prioritize_real();; + + +module type Arith_float_sig = + sig + val mk_num_exp : term -> term -> term + val dest_num_exp : term -> (term * term) + val dest_float : term -> (string * term * term) + val float_lt0 : term -> thm + val float_gt0 : term -> thm + val float_lt : term -> term -> thm + val float_le0 : term -> thm + val float_ge0 : term -> thm + val float_le : term -> term -> thm + val float_min : term -> term -> thm + val float_max : term -> term -> thm + val float_min_max : term -> term -> (thm * thm) + val float_mul_eq : term -> term -> thm + val float_mul_lo : int -> term -> term -> thm + val float_mul_hi : int -> term -> term -> thm + val float_div_lo : int -> term -> term -> thm + val float_div_hi : int -> term -> term -> thm + val float_add_lo : int -> term -> term -> thm + val float_add_hi : int -> term -> term -> thm + val float_sub_lo : int -> term -> term -> thm + val float_sub_hi : int -> term -> term -> thm + val float_sqrt_lo : int -> term -> thm + val float_sqrt_hi : int -> term -> thm + + val reset_stat : unit -> unit + val reset_cache : unit -> unit + val print_stat : unit -> unit +(* + val mul_lo_list : (int * term * term) list ref + val mul_hi_list : (int * term * term) list ref + val div_lo_list : (int * term * term) list ref + val div_hi_list : (int * term * term) list ref + val add_lo_list : (int * term * term) list ref + val add_hi_list : (int * term * term) list ref + val sub_lo_list : (int * term * term) list ref + val sub_hi_list : (int * term * term) list ref +*) + + val dest_float_interval : term -> term * term * term + val mk_float_interval_small_num : int -> thm + val mk_float_interval_num : num -> thm + + val float_lo : int -> term -> thm + val float_hi : int -> term -> thm + + val float_interval_round : int -> thm -> thm + + val float_interval_neg : thm -> thm + val float_interval_mul : int -> thm -> thm -> thm + val float_interval_div : int -> thm -> thm -> thm + val float_interval_add : int -> thm -> thm -> thm + val float_interval_sub : int -> thm -> thm -> thm + val float_interval_sqrt : int -> thm -> thm + + val float_abs : term -> thm + + + val FLOAT_TO_NUM_CONV : term -> thm +end;; + + + +module Arith_float : Arith_float_sig = struct + + +open Big_int;; + +open Arith_options;; +open Arith_misc;; +open Arith_nat;; +open Num_exp_theory;; +open Float_theory;; +open Interval_arith;; + + + +(* interval *) + + +let APPROX_INTERVAL' = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP]) APPROX_INTERVAL;; + + +let zero_const = `_0` and + t_const = `T` and + f_const = `F`;; + +let n_var_num = `n:num` and + m_var_num = `m:num` and + k_var_num = `k:num` and + e_var_num = `e:num` and + e1_var_num = `e1:num` and + e2_var_num = `e2:num` and + r_var_num = `r:num` and + r1_var_num = `r1:num` and + r2_var_num = `r2:num` and + n1_var_num = `n1:num` and + n2_var_num = `n2:num` and + m1_var_num = `m1:num` and + m2_var_num = `m2:num` and + x_var_num = `x:num` and + y_var_num = `y:num`;; + +let le_op_num = `(<=):num->num->bool` and + lt_op_num = `(<):num->num->bool` and + mul_op_num = `( * ):num->num->num` and + plus_op_num = `(+):num->num->num` and + minus_op_num = `(-):num->num->num` and + div_op_real = `(/):real->real->real` and + div_op_num = `DIV` and + mul_op_real = `( * ):real->real->real` and + plus_op_real = `(+):real->real->real` and + minus_op_real = `(-):real->real->real` and + neg_op_real = `(--):real->real` and + le_op_real = `(<=):real->real->bool`;; + + + +let amp_op_real = `(&):num->real` and + interval_const = `interval_arith` and + num_exp_const = `num_exp`;; + +let x_var_real = `x:real` and + y_var_real = `y:real` and + z_var_real = `z:real` and + a_var_real = `a:real` and + b_var_real = `b:real` and + lo_var_real = `lo:real` and + hi_var_real = `hi:real` and + f1_var_real = `f1:real` and + f2_var_real = `f2:real`;; + + + +let b0_const = (fst o dest_comb o lhand o concl) (Arith_hash.def_array.(0));; +let b0_name = (fst o dest_const) b0_const;; +let base_const = mk_small_numeral base;; + + +let NUM_REMOVE = prove(mk_eq(mk_comb(Arith_hash.num_const, n_var_num), n_var_num), + REWRITE_TAC[Arith_hash.num_def; NUMERAL]);; + + +(* B0 n = base * n *) +let b0_thm = prove(mk_eq(mk_comb(b0_const, n_var_num), + mk_binop mul_op_num base_const n_var_num), + REWRITE_TAC[Arith_hash.def_array.(0)] THEN + TRY ARITH_TAC THEN + GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [BIT0] THEN + ARITH_TAC);; + + +let dest_num_exp tm = + let ltm, e_tm = dest_comb tm in + rand ltm, e_tm;; + + + +let num_exp_const = `num_exp`;; +let mk_num_exp n_tm e_tm = mk_binop num_exp_const n_tm e_tm;; + + +(* float s n e -> "s", n, e *) +let dest_float tm = + let ltm, e_tm = dest_comb tm in + let ltm, n_tm = dest_comb ltm in + let float_tm, s_tm = dest_comb ltm in + if (fst o dest_const) float_tm <> "float" then + failwith "dest_float: not float" + else + (fst o dest_const) s_tm, n_tm, e_tm;; + + + +(************************************) + +let NUM_EXP_EXP' = SPEC_ALL NUM_EXP_EXP;; + +let NUM_EXP_0' = (SPEC_ALL o REWRITE_RULE[NUMERAL]) NUM_EXP_0;; + +let NUM_EXP_LE' = (UNDISCH_ALL o SPEC_ALL) NUM_EXP_LE;; + +let NUM_EXP_LT' = (UNDISCH_ALL o SPEC_ALL) NUM_EXP_LT;; + + +(* NUM_EXP_DIV *) + +let NUM_EXP_DIV1 = prove(`~(n2 = 0) /\ e2 <= e1 ==> + num_exp n1 e1 DIV num_exp n2 e2 = num_exp n1 (e1 - e2) DIV n2`, + STRIP_TAC THEN + (*`num_exp n1 e1 = 16 EXP e2 * num_exp n1 (e1 - e2)` MP_TAC THENL*) + SUBGOAL_THEN (mk_eq(`num_exp n1 e1`, mk_binop mul_op_num (mk_binop `EXP` base_const `e2:num`) `num_exp n1 (e1 - e2)`)) MP_TAC THENL + [ + REWRITE_TAC[num_exp] THEN + ONCE_REWRITE_TAC[ARITH_RULE `a * b * c = b * (a * c:num)`] THEN + REWRITE_TAC[GSYM EXP_ADD] THEN + ASM_SIMP_TAC[ARITH_RULE `e2 <= e1 ==> e2 + e1 - e2 = e1:num`]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + SUBGOAL_THEN (mk_eq(`num_exp n2 e2`, mk_binop mul_op_num (mk_binop `EXP` base_const `e2:num`) `n2:num`)) MP_TAC THENL + [ + REWRITE_TAC[num_exp; MULT_AC]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MATCH_MP_TAC DIV_MULT2 THEN + ASM_REWRITE_TAC[MULT_EQ_0; DE_MORGAN_THM; EXP_EQ_0] THEN + ARITH_TAC);; + + + +let NUM_EXP_DIV2 = prove(`~(n2 = 0) /\ e1 <= e2 ==> + num_exp n1 e1 DIV num_exp n2 e2 = n1 DIV num_exp n2 (e2 - e1)`, + STRIP_TAC THEN + (*`num_exp n2 e2 = 16 EXP e1 * num_exp n2 (e2 - e1)` MP_TAC THENL*) + SUBGOAL_THEN (mk_eq(`num_exp n2 e2`, mk_binop mul_op_num (mk_binop `EXP` base_const `e1:num`) `num_exp n2 (e2 - e1)`)) MP_TAC THENL + [ + REWRITE_TAC[num_exp] THEN + ONCE_REWRITE_TAC[ARITH_RULE `a * b * c = b * (a * c:num)`] THEN + REWRITE_TAC[GSYM EXP_ADD] THEN + ASM_SIMP_TAC[ARITH_RULE `e1 <= e2 ==> e1 + e2 - e1 = e2:num`]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + SUBGOAL_THEN (mk_eq(`num_exp n1 e1`, mk_binop mul_op_num (mk_binop `EXP` base_const `e1:num`) `n1:num`)) MP_TAC THENL + [ + REWRITE_TAC[num_exp; MULT_AC]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MATCH_MP_TAC DIV_MULT2 THEN + ASM_REWRITE_TAC[num_exp; MULT_EQ_0; DE_MORGAN_THM; EXP_EQ_0] THEN + ARITH_TAC);; + + + + + +(* B0 n = num_exp n bits *) +let normal_lemma1 = prove(mk_eq(mk_comb(b0_const, n_var_num), `num_exp n 1`), + REWRITE_TAC[Arith_hash.def_array.(0); num_exp] THEN + TRY ARITH_TAC THEN + GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [BIT0] THEN + ARITH_TAC);; + + + +let NORMAL_LEMMA1 = NUMERALS_TO_NUM normal_lemma1;; + +let normal_lemma2 = prove(mk_eq (mk_comb (b0_const, `num_exp n e`), `num_exp n (SUC e)`), + REWRITE_TAC[normal_lemma1; NUM_EXP_EXP] THEN ARITH_TAC);; + + + +let rec normalize tm = + if (is_comb tm) then + let ltm, rtm = dest_comb tm in + let lname = (fst o dest_const) ltm in + if (lname = b0_name) then + let lth = INST[rtm, n_var_num] NORMAL_LEMMA1 in + let rth, flag = normalize rtm in + if flag then + let ltm, lexp = (dest_comb o snd o dest_eq o concl) lth in + let ltm, rtm = dest_comb ltm in + let rn, rexp = (dest_comb o snd o dest_eq o concl) rth in + let rn = rand rn in + let th1 = AP_THM (AP_TERM ltm rth) lexp in + let th2 = INST[rexp, e1_var_num; lexp, e2_var_num; rn, n_var_num] NUM_EXP_EXP' in + let th3 = TRANS lth (TRANS th1 th2) in + let ltm, rtm = (dest_comb o snd o dest_eq o concl) th3 in + let add_th = raw_add_conv_hash rtm in + let th4 = AP_TERM ltm add_th in + (TRANS th3 th4, true) + else + (lth, true) + else + (REFL tm, false) + else + (REFL tm, false);; + + +(* Converts a raw numeral to a num_exp expression *) +let to_num_exp tm = + let x, flag = normalize tm in + if flag then x + else + INST[tm, n_var_num] NUM_EXP_0';; + + + + +(* +let tm = `B0 (B0 (B0 (B1 (B2 (B3 _0)))))`;; +(* 8: 0.568 *) +test 10000 normalize tm;; (* 0.568 *) +(* 8: 0.012 *) +test 10000 normalize `B2 (B3 (B4 _0))`;; +*) + + + +(************************************) + +let SYM_NUM_EXP_0' = SYM NUM_EXP_0';; + +let NUM_EXP_n0 = prove(`!e. num_exp 0 e = 0`, REWRITE_TAC[num_exp; MULT_CLAUSES]);; + +let NUM_EXP_n0' = (REWRITE_RULE[NUMERAL] o SPEC_ALL) NUM_EXP_n0;; + + +let NUM_EXP_DENORM = (UNDISCH_ALL o prove) + (mk_imp(`e = _0 <=> F`, mk_eq(`num_exp n e`, mk_comb (b0_const, `num_exp n (PRE e)`))), + REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SYM (REWRITE_CONV[NUMERAL] `0`)] THEN + REWRITE_TAC[num_exp; b0_thm] THEN + REWRITE_TAC[ARITH_RULE (mk_eq(mk_binop mul_op_num base_const `n * a:num`, + mk_binop mul_op_num `n:num` (mk_binop mul_op_num base_const `a:num`)))] THEN + REWRITE_TAC[GSYM EXP] THEN + SIMP_TAC[ARITH_RULE `~(e = 0) ==> SUC (PRE e) = e`]);; + + + + +(* Converts num_exp n e to a numeral by adding e B0's *) +let rec denormalize tm = + let ltm, etm = dest_comb tm in + let ntm = rand ltm in + if (etm = zero_const) then + INST[ntm, n_var_num] SYM_NUM_EXP_0' + else + if ntm = zero_const then + INST[etm, e_var_num] NUM_EXP_n0' + else + let e_th = raw_eq0_hash_conv etm in + let th0' = INST[etm, e_var_num; ntm, n_var_num] NUM_EXP_DENORM in + let th0 = MY_PROVE_HYP e_th th0' in + let b0_tm, rtm = dest_comb(rand(concl th0)) in + let ltm, pre_tm = dest_comb rtm in + let pre_th = raw_pre_hash_conv pre_tm in + let th1 = AP_TERM ltm pre_th in + let th2 = denormalize (rand(concl th1)) in + TRANS th0 (AP_TERM b0_tm (TRANS th1 th2));; + + + +(* +let tm = `num_exp (B1 (B3 (B5 _0))) (B15 _0)`;; +denormalize tm;; +(* 4: 0.264 *) +test 1000 denormalize tm;; +*) + + +(***************************************) + + + +let rec comb_number tm n = + if (is_comb tm) then comb_number ((snd o dest_comb) tm) (n + 1) else n;; + + +let make_lo_thm i = + let th_concl = mk_binop `(<=):num->num->bool` + (mk_comb (Arith_hash.const_array.(0), n_var_num)) + (mk_comb (Arith_hash.const_array.(i), n_var_num)) in + prove(th_concl, + REWRITE_TAC[Arith_hash.def_array.(i); Arith_hash.def_array.(0)] THEN + REWRITE_TAC[ARITH_LE; LE_REFL] THEN + ARITH_TAC);; + + + +let lo_thm_array = Array.init base make_lo_thm;; +let lo_thm_table = Hashtbl.create base;; + +for i = 0 to base - 1 do + Hashtbl.add lo_thm_table Arith_hash.const_array.(i) lo_thm_array.(i); +done;; + + + +let make_lo_thm2 i = + let th_concl = mk_imp (`n <= m:num`, + mk_binop `(<=):num->num->bool` + (mk_comb (Arith_hash.const_array.(0), n_var_num)) + (mk_comb (Arith_hash.const_array.(i), m_var_num))) in + (UNDISCH_ALL o prove) (th_concl, + REWRITE_TAC[Arith_hash.def_array.(i); Arith_hash.def_array.(0); ARITH_LE] THEN + ARITH_TAC);; + + +let lo_thm2_array = Array.init base make_lo_thm2;; +let lo_thm2_table = Hashtbl.create base;; + +for i = 0 to base - 1 do + Hashtbl.add lo_thm2_table Arith_hash.const_array.(i) lo_thm2_array.(i); +done;; + + + + +let make_hi_thm i = + let th_concl = mk_imp (`n < m:num`, + mk_binop `(<):num->num->bool` + (mk_comb (Arith_hash.const_array.(i), n_var_num)) + (mk_comb (Arith_hash.const_array.(0), m_var_num))) in + (UNDISCH_ALL o prove) (th_concl, + REWRITE_TAC[Arith_hash.def_array.(i); Arith_hash.def_array.(0); ARITH_LT] THEN + ARITH_TAC);; + + + +let hi_thm_array = Array.init base make_hi_thm;; +let hi_thm_table = Hashtbl.create base;; + +for i = 0 to base - 1 do + Hashtbl.add hi_thm_table Arith_hash.const_array.(i) hi_thm_array.(i); +done;; + + + +(***************************************) + + +let LE_REFL' = SPEC_ALL LE_REFL;; +let LE_TRANS' = (UNDISCH_ALL o SPEC_ALL o REWRITE_RULE[GSYM IMP_IMP]) LE_TRANS;; + + +let lo_num_conv p tm = + let n = comb_number tm 0 in + if (n <= p) then + INST[tm, n_var_num] LE_REFL' + else + let rec lo_bound n tm = + let btm, rtm = dest_comb tm in + let th0 = INST[rtm, n_var_num] (Hashtbl.find lo_thm_table btm) in + if n > 1 then + let rth = lo_bound (n - 1) rtm in + let xtm = rand (rator (concl rth)) in + let th1' = INST[xtm, n_var_num; rtm, m_var_num] (Hashtbl.find lo_thm2_table btm) in + let th1 = MY_PROVE_HYP rth th1' in + th1 + else + th0 in + + lo_bound (n - p) tm;; + + + +let N_LT_SUC = ARITH_RULE `n < SUC n`;; +let LT_IMP_LE' = (UNDISCH_ALL o SPEC_ALL) LT_IMP_LE;; +let N_LT_SUC = ARITH_RULE `n < SUC n`;; +let LT_LE_TRANS = (UNDISCH_ALL o ARITH_RULE) `n < e ==> e <= m ==> n < m:num`;; + + +(* Generates a theorem |- n <= m such that m contains at most p non-zero digits *) +let hi_num_conv p tm = + let n = comb_number tm 0 in + if (n <= p) then + INST[tm, n_var_num] LE_REFL' + else + let k = n - p in + + let rec check_b0s n tm = + let btm, rtm = dest_comb tm in + if ((fst o dest_const) btm = b0_name) then + if n > 1 then check_b0s (n - 1) rtm else true + else + false in + + if (check_b0s k tm) then + INST[tm, n_var_num] LE_REFL' + else + let rec hi_bound n tm = + if n > 0 then + let btm, rtm = dest_comb tm in + let r_th = hi_bound (n - 1) rtm in + let xtm = rand (concl r_th) in + let th0 = INST[rtm, n_var_num; xtm, m_var_num] (Hashtbl.find hi_thm_table btm) in + MY_PROVE_HYP r_th th0 + else + let th0 = INST[tm, n_var_num] N_LT_SUC in + let ltm, suc_tm = dest_comb (concl th0) in + let suc_th = raw_suc_conv_hash suc_tm in + EQ_MP (AP_TERM ltm suc_th) th0 in + + let th = hi_bound k tm in + let m_tm, l_tm = dest_comb (concl th) in + MY_PROVE_HYP th (INST[rand m_tm, m_var_num; l_tm, n_var_num] LT_IMP_LE');; + + + + +(* +let tm = `B10 (B12 (B11 (B1 (B14 (B15 _0)))))`;; +hi_num_conv 4 tm;; + +let tm = `B0 (B0 (B1 (B2 _0)))`;; +hi_num_conv 2 tm;; +*) + + + +(* Generates a theorem |- n < m such that m contains at most p non-zero digits *) +let hi_lt_num_conv p tm = + let n = comb_number tm 0 in + if (n <= p) then + let th0 = INST[tm, n_var_num] N_LT_SUC in + let ltm, rtm = dest_comb(concl th0) in + let suc_th = raw_suc_conv_hash rtm in + EQ_MP (AP_TERM ltm suc_th) th0 + else + let k = n - p in + + let rec check_b0s n tm = + let btm, rtm = dest_comb tm in + if ((fst o dest_const) btm = b0_name) then + if n > 1 then check_b0s (n - 1) rtm else true + else + false in + + if (check_b0s k tm) then + let th0 = INST[tm, n_var_num] N_LT_SUC in + let ltm, rtm = dest_comb (concl th0) in + let suc_th = raw_suc_conv_hash rtm in + let suc_tm = rand(concl suc_th) in + let th1 = hi_num_conv p suc_tm in + let th2 = EQ_MP (AP_TERM ltm suc_th) th0 in + let th = INST[tm, n_var_num; suc_tm, e_var_num; rand(concl th1), m_var_num] LT_LE_TRANS in + MY_PROVE_HYP th1 (MY_PROVE_HYP th2 th) + + else + let rec hi_bound n tm = + if n > 0 then + let btm, rtm = dest_comb tm in + let r_th = hi_bound (n - 1) rtm in + let xtm = rand (concl r_th) in + let th0 = INST[rtm, n_var_num; xtm, m_var_num] (Hashtbl.find hi_thm_table btm) in + MY_PROVE_HYP r_th th0 + else + let th0 = INST[tm, n_var_num] N_LT_SUC in + let ltm, suc_tm = dest_comb (concl th0) in + let suc_th = raw_suc_conv_hash suc_tm in + EQ_MP (AP_TERM ltm suc_th) th0 in + hi_bound k tm;; + + + +(* +let tm = `B10 (B12 (B11 (B1 (B14 (B15 _0)))))`;; +hi_num_conv 4 tm;; +hi_lt_num_conv 4 tm;; + +let tm = `B0 (B0 (B1 (B2 _0)))`;; +hi_num_conv 3 tm;; +hi_lt_num_conv 3 tm;; +*) + + +(*****************************************) + + + + +let num_exp_lo p tm = + let ltm, e_tm = dest_comb tm in + let n_tm = rand ltm in + let n_th = lo_num_conv p n_tm in + let m_tm = rand (rator (concl n_th)) in + let m_norm, flag = normalize m_tm in + + let th0' = INST[m_tm, m_var_num; n_tm, n_var_num; e_tm, e_var_num] NUM_EXP_LE' in + let th0 = MY_PROVE_HYP n_th th0' in + if flag then + let th1 = AP_THM (AP_TERM (rator ltm) m_norm) e_tm in + let m_tm, me_tm = (dest_comb o rand o concl) m_norm in + let th2 = INST[me_tm, e1_var_num; e_tm, e2_var_num; rand m_tm, n_var_num] NUM_EXP_EXP' in + let th3 = TRANS th1 th2 in + let ltm, rtm = (dest_comb o rand o concl) th3 in + let th_add = raw_add_conv_hash rtm in + let th4 = TRANS th3 (AP_TERM ltm th_add) in + EQ_MP (AP_THM (AP_TERM le_op_num th4) tm) th0 + + + else + th0;; + + + +let num_exp_hi p tm = + let ltm, e_tm = dest_comb tm in + let n_tm = rand ltm in + let n_th = hi_num_conv p n_tm in + let m_tm = rand (concl n_th) in + let m_norm, flag = normalize m_tm in + + let th0' = INST[m_tm, n_var_num; n_tm, m_var_num; e_tm, e_var_num] NUM_EXP_LE' in + let th0 = MY_PROVE_HYP n_th th0' in + if flag then + let th1 = AP_THM (AP_TERM (rator ltm) m_norm) e_tm in + let m_tm, me_tm = (dest_comb o rand o concl) m_norm in + let th2 = INST[me_tm, e1_var_num; e_tm, e2_var_num; rand m_tm, n_var_num] NUM_EXP_EXP' in + let th3 = TRANS th1 th2 in + let ltm, rtm = (dest_comb o rand o concl) th3 in + let th_add = raw_add_conv_hash rtm in + let th4 = TRANS th3 (AP_TERM ltm th_add) in + EQ_MP (AP_TERM (rator (concl th0)) th4) th0 + else + th0;; + + + + +let num_exp_hi_lt p tm = + let ltm, e_tm = dest_comb tm in + let n_tm = rand ltm in + let n_th = hi_lt_num_conv p n_tm in + let m_tm = rand (concl n_th) in + let m_norm, flag = normalize m_tm in + + let th0' = INST[m_tm, n_var_num; n_tm, m_var_num; e_tm, e_var_num] NUM_EXP_LT' in + let th0 = MY_PROVE_HYP n_th th0' in + if flag then + let th1 = AP_THM (AP_TERM (rator ltm) m_norm) e_tm in + let m_tm, me_tm = (dest_comb o rand o concl) m_norm in + let th2 = INST[me_tm, e1_var_num; e_tm, e2_var_num; rand m_tm, n_var_num] NUM_EXP_EXP' in + let th3 = TRANS th1 th2 in + let ltm, rtm = (dest_comb o rand o concl) th3 in + let th_add = raw_add_conv_hash rtm in + let th4 = TRANS th3 (AP_TERM ltm th_add) in + EQ_MP (AP_TERM (rator (concl th0)) th4) th0 + else + th0;; + + + + + +(* +let tm = `num_exp (B5 (B1 (B2 (B3 _0)))) (B3 _0)`;; +num_exp_lo 2 tm;; +num_exp_hi 2 tm;; +num_exp_hi_lt 2 tm;; +num_exp_hi_lt 2 `num_exp (B0 (B0 (B1 _0))) (B4 _0)`;; +(* 4: 0.848 *) +test 10000 (num_exp_lo 2) tm;; +(* 4: 0.448 *) +test 10000 (num_exp_lo 3) tm;; +(* 4: 0.116 *) +test 10000 (num_exp_lo 5) tm;; +*) + + +(***************************************) + +(* num_exp_lt, num_exp_le *) + +let transform = UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL;; + +let NUM_EXP_LT1_EQ' = transform NUM_EXP_LT1_EQ and + NUM_EXP_LT2_EQ' = transform NUM_EXP_LT2_EQ;; + + +let NUM_EXP_LE1_EQ' = transform NUM_EXP_LE1_EQ and + NUM_EXP_LE2_EQ' = transform NUM_EXP_LE2_EQ;; + + +let num_exp_lt tm1 tm2 = + let n1_tm, e1_tm = dest_num_exp tm1 in + let n2_tm, e2_tm = dest_num_exp tm2 in + let sub_th, le_th = raw_sub_and_le_hash_conv e1_tm e2_tm in + let r_tm = rand(concl sub_th) in + if (rand(concl le_th) = e1_tm) then + let x_expr = mk_num_exp n1_tm r_tm in + let x_th = denormalize x_expr in + let x_tm = rand(concl x_th) in + + let th0 = INST[e2_tm, e2_var_num; e1_tm, e1_var_num; + r_tm, r_var_num; x_tm, x_var_num; + n1_tm, n1_var_num; n2_tm, n2_var_num] NUM_EXP_LT1_EQ' in + let th1 = MY_PROVE_HYP x_th (MY_PROVE_HYP sub_th (MY_PROVE_HYP le_th th0)) in + let lt_th = raw_lt_hash_conv (rand(concl th1)) in + TRANS th1 lt_th + else + let x_expr = mk_num_exp n2_tm r_tm in + let x_th = denormalize x_expr in + let x_tm = rand(concl x_th) in + + let th0 = INST[e2_tm, e2_var_num; e1_tm, e1_var_num; + r_tm, r_var_num; x_tm, x_var_num; + n1_tm, n1_var_num; n2_tm, n2_var_num] NUM_EXP_LT2_EQ' in + let th1 = MY_PROVE_HYP x_th (MY_PROVE_HYP sub_th (MY_PROVE_HYP le_th th0)) in + let lt_th = raw_lt_hash_conv (rand(concl th1)) in + TRANS th1 lt_th;; + + + +let num_exp_le tm1 tm2 = + let n1_tm, e1_tm = dest_num_exp tm1 in + let n2_tm, e2_tm = dest_num_exp tm2 in + let sub_th, le_th = raw_sub_and_le_hash_conv e1_tm e2_tm in + let r_tm = rand(concl sub_th) in + if (rand(concl le_th) = e1_tm) then + let x_expr = mk_num_exp n1_tm r_tm in + let x_th = denormalize x_expr in + let x_tm = rand(concl x_th) in + + let th0 = INST[e2_tm, e2_var_num; e1_tm, e1_var_num; + r_tm, r_var_num; x_tm, x_var_num; + n1_tm, n1_var_num; n2_tm, n2_var_num] NUM_EXP_LE1_EQ' in + let th1 = MY_PROVE_HYP x_th (MY_PROVE_HYP sub_th (MY_PROVE_HYP le_th th0)) in + let le_th = raw_le_hash_conv (rand(concl th1)) in + TRANS th1 le_th + else + let x_expr = mk_num_exp n2_tm r_tm in + let x_th = denormalize x_expr in + let x_tm = rand(concl x_th) in + + let th0 = INST[e2_tm, e2_var_num; e1_tm, e1_var_num; + r_tm, r_var_num; x_tm, x_var_num; + n1_tm, n1_var_num; n2_tm, n2_var_num] NUM_EXP_LE2_EQ' in + let th1 = MY_PROVE_HYP x_th (MY_PROVE_HYP sub_th (MY_PROVE_HYP le_th th0)) in + let le_th = raw_le_hash_conv (rand(concl th1)) in + TRANS th1 le_th;; + + + + +(* +let tm1 = `num_exp (D0 (D4 (D1 _0))) (D2 (D3 _0))`;; +let tm2 = `num_exp (D4 (D6 _0)) (D5 (D3 _0))`;; + +num_exp_lt tm1 tm2;; +num_exp_lt tm2 tm1;; +num_exp_le tm1 tm1;; +num_exp_lt tm1 tm1;; + +(* 100: 0.164 *) +test 1000 (num_exp_lt tm1) tm2;; +*) + + + +(***************************************) + +(* num_exp_mul *) + +let NUM_EXP_MUL' = SPEC_ALL NUM_EXP_MUL;; + +let num_exp_mul tm1 tm2 = + let n1_tm, e1_tm = dest_comb tm1 in + let n1_tm = rand n1_tm in + let n2_tm, e2_tm = dest_comb tm2 in + let n2_tm = rand n2_tm in + let th0 = INST[n1_tm, n1_var_num; e1_tm, e1_var_num; + n2_tm, n2_var_num; e2_tm, e2_var_num] NUM_EXP_MUL' in + let ltm, tm_add = dest_comb (rand (concl th0)) in + let tm_mul = rand ltm in + let th_mul = raw_mul_conv_hash tm_mul in + let th_add = raw_add_conv_hash tm_add in + TRANS th0 (MK_COMB (AP_TERM (rator ltm) th_mul, th_add));; + + +(**********************************) + +(* num_exp_add *) + +let NUM_EXP_ADD' = (UNDISCH_ALL o SPEC_ALL) NUM_EXP_ADD;; +let ADD_COMM = ARITH_RULE `m + n = n + m:num`;; + +let num_exp_add tm1 tm2 = + let n1_tm, e1_tm = dest_comb tm1 in + let n1_tm = rand n1_tm in + let n2_tm, e2_tm = dest_comb tm2 in + let n2_tm = rand n2_tm in + let e_sub, e_le = raw_sub_and_le_hash_conv e1_tm e2_tm in + + let flag = (rand(concl e_le) = e2_tm) in + + let th0' = + if flag then + INST[n1_tm, n1_var_num; e1_tm, e1_var_num; + n2_tm, n2_var_num; e2_tm, e2_var_num] NUM_EXP_ADD' + else + INST[n2_tm, n1_var_num; e2_tm, e1_var_num; + n1_tm, n2_var_num; e1_tm, e2_var_num] NUM_EXP_ADD' in + + let th0 = MY_PROVE_HYP e_le th0' in + let ltm, e0_tm = dest_comb(rand(concl th0)) in + let exp_tm, add_tm = dest_comb ltm in + let ltm, d_tm = dest_comb add_tm in + let th1 = AP_TERM (rator d_tm) e_sub in + let th2 = denormalize (rand(concl th1)) in + let th3 = AP_TERM ltm (TRANS th1 th2) in + let th4 = raw_add_conv_hash (rand(concl th3)) in + let th5 = AP_THM (AP_TERM exp_tm (TRANS th3 th4)) e0_tm in + let th = TRANS th0 th5 in + if flag then th else + TRANS (INST[tm1, m_var_num; tm2, n_var_num] ADD_COMM) th;; + + +(* +let tm1 = `num_exp (B0 (B4 (B1 _0))) (B1 (B3 _0))`;; +let tm2 = `num_exp (B4 (B6 _0)) (B1 (B2 _0))`;; +num_exp_add tm1 tm2;; +num_exp_add tm2 tm1;; +num_exp_mul tm1 tm2;; +(* 4: 0.836 *) +test 10000 (num_exp_mul tm1) tm2;; +(* 4: 4.112 *) +test 10000 (num_exp_add tm1) tm2;; +*) + + +(****************************************) + +(* num_exp_sub *) + +let NUM_EXP_SUB1' = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL) NUM_EXP_SUB1 and + NUM_EXP_SUB2' = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL) NUM_EXP_SUB2 and + NUM_EXP_LE1' = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL) NUM_EXP_LE1 and + NUM_EXP_LE2' = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL) NUM_EXP_LE2;; + + +(* Returns two theorems: |- tm1 - tm2 = tm, |- tm2 <= tm1 or + |- tm2 - tm1 = tm, |- tm1 <= tm2 *) +let num_exp_sub tm1 tm2 = + let n1_tm, e1_tm = dest_num_exp tm1 in + let n2_tm, e2_tm = dest_num_exp tm2 in + let e_sub, e_le = raw_sub_and_le_hash_conv e1_tm e2_tm in + + if rand(concl e_le) = e1_tm then + (* e2 <= e1 *) + let e1_sub_e2 = rand(concl e_sub) in + let a0 = mk_num_exp n1_tm e1_sub_e2 in + let b = n2_tm in + let a_th = denormalize a0 in + let a = rand(concl a_th) in + + let th_sub, th_le = raw_sub_and_le_hash_conv a b in + if rand(concl th_le) = a then + (* b <= a *) + let a_sub_b = TRANS (AP_THM (AP_TERM minus_op_num a_th) b) th_sub in + let b_le_a = EQ_MP (SYM (AP_TERM (rator(concl th_le)) a_th)) th_le in + let th0 = AP_THM (AP_TERM num_exp_const a_sub_b) e2_tm in + + let inst = INST[n1_tm, n1_var_num; e1_tm, e1_var_num; + n2_tm, n2_var_num; e2_tm, e2_var_num; e1_sub_e2, r_var_num] in + let th1_sub = inst NUM_EXP_SUB1' in + let th1_le = inst NUM_EXP_LE1' in + let th2_sub = MY_PROVE_HYP e_sub (MY_PROVE_HYP e_le th1_sub) in + let th2_le = MY_PROVE_HYP e_sub (MY_PROVE_HYP b_le_a (MY_PROVE_HYP e_le th1_le)) in + TRANS th2_sub th0, th2_le + + else + (* a <= b *) + let b_sub_a = TRANS (AP_TERM (rator(lhand(concl th_sub))) a_th) th_sub in + let a_le_b = EQ_MP (SYM (AP_THM (AP_TERM le_op_num a_th) b)) th_le in + let th0 = AP_THM (AP_TERM num_exp_const b_sub_a) e2_tm in + let inst = INST[n2_tm, n1_var_num; e2_tm, e1_var_num; + n1_tm, n2_var_num; e1_tm, e2_var_num; e1_sub_e2, r_var_num] in + let th1_sub = inst NUM_EXP_SUB2' in + let th1_le = inst NUM_EXP_LE2' in + let th2_sub = MY_PROVE_HYP e_sub (MY_PROVE_HYP e_le th1_sub) in + let th2_le = MY_PROVE_HYP e_sub (MY_PROVE_HYP a_le_b (MY_PROVE_HYP e_le th1_le)) in + TRANS th2_sub th0, th2_le + + else + (* e1 <= e2 *) + let e2_sub_e1 = rand(concl e_sub) in + let b0 = mk_num_exp n2_tm e2_sub_e1 in + let a = n1_tm in + let b_th = denormalize b0 in + let b = rand(concl b_th) in + + let th_sub, th_le = raw_sub_and_le_hash_conv a b in + if rand(concl th_le) = a then + (* b <= a *) + let a_sub_b = TRANS (AP_TERM (rator(lhand(concl th_sub))) b_th) th_sub in + let b_le_a = EQ_MP (SYM (AP_THM (AP_TERM le_op_num b_th) a)) th_le in + let th0 = AP_THM (AP_TERM num_exp_const a_sub_b) e1_tm in + let inst = INST[n1_tm, n1_var_num; e1_tm, e1_var_num; + n2_tm, n2_var_num; e2_tm, e2_var_num; e2_sub_e1, r_var_num] in + let th1_sub = inst NUM_EXP_SUB2' in + let th1_le = inst NUM_EXP_LE2' in + let th2_sub = MY_PROVE_HYP e_sub (MY_PROVE_HYP e_le th1_sub) in + let th2_le = MY_PROVE_HYP e_sub (MY_PROVE_HYP b_le_a (MY_PROVE_HYP e_le th1_le)) in + TRANS th2_sub th0, th2_le + + else + (* a <= b *) + let b_sub_a = TRANS (AP_THM (AP_TERM minus_op_num b_th) a) th_sub in + let a_le_b = EQ_MP (SYM (AP_TERM (rator(concl th_le)) b_th)) th_le in + let th0 = AP_THM (AP_TERM num_exp_const b_sub_a) e1_tm in + let inst = INST[n2_tm, n1_var_num; e2_tm, e1_var_num; + n1_tm, n2_var_num; e1_tm, e2_var_num; e2_sub_e1, r_var_num] in + let th1_sub = inst NUM_EXP_SUB1' in + let th1_le = inst NUM_EXP_LE1' in + let th2_sub = MY_PROVE_HYP e_sub (MY_PROVE_HYP e_le th1_sub) in + let th2_le = MY_PROVE_HYP e_sub (MY_PROVE_HYP a_le_b (MY_PROVE_HYP e_le th1_le)) in + TRANS th2_sub th0, th2_le;; + + + + +(* +let tm1 = `num_exp (D3 (D4 (D1 _0))) (D2 _0)`;; +let tm2 = `num_exp (D1 (D2 (D1 _0))) (D3 _0)`;; +num_exp_sub tm1 tm2;; +(* 10: 0.252 *) +test 1000 (num_exp_sub tm1) tm2;; +*) + + + + +(*************************************) + +(* division *) + +let NUM_EXP_DIV1' = (UNDISCH_ALL o PURE_REWRITE_RULE[NUMERAL] o + PURE_ONCE_REWRITE_RULE[ARITH_RULE `~(x = 0) <=> (x = 0 <=> F)`] o + REWRITE_RULE[GSYM IMP_IMP]) NUM_EXP_DIV1;; +let NUM_EXP_DIV2' = (UNDISCH_ALL o PURE_REWRITE_RULE[NUMERAL] o + PURE_ONCE_REWRITE_RULE[ARITH_RULE `~(x = 0) <=> (x = 0 <=> F)`] o + REWRITE_RULE[GSYM IMP_IMP]) NUM_EXP_DIV2;; + + +let num_exp_div tm1 tm2 = + let n1_tm, e1_tm = dest_comb tm1 in + let n1_tm = rand n1_tm in + let n2_tm, e2_tm = dest_comb tm2 in + let n2_tm = rand n2_tm in + let e_sub, e_le = raw_sub_and_le_hash_conv e1_tm e2_tm in + + let inst = INST[n1_tm, n1_var_num; e1_tm, e1_var_num; + n2_tm, n2_var_num; e2_tm, e2_var_num] in + + let n2_not_0 = raw_eq0_hash_conv n2_tm in + if ((fst o dest_const o rand o concl) n2_not_0 = "T") then + failwith "num_exp_div: n2 = 0" + else + if (rand(concl e_le) = e1_tm) then + let th0' = inst NUM_EXP_DIV1' in + let th0 = MY_PROVE_HYP n2_not_0 (MY_PROVE_HYP e_le th0') in + + let ltm, rtm = dest_comb(rand(concl th0)) in + let div_tm, rtm2 = dest_comb ltm in + let num_exp_tm = rator rtm2 in + + let th1 = AP_THM (AP_TERM div_tm (AP_TERM num_exp_tm e_sub)) rtm in + let ltm, rtm = dest_comb(rand(concl th1)) in + let tm1 = rand ltm in + + let th2 = AP_THM (AP_TERM div_tm (denormalize tm1)) rtm in + let th3 = raw_div_hash_conv (rand(concl th2)) in + let th = TRANS th0 (TRANS th1 (TRANS th2 th3)) in + TRANS th (INST[rand(concl th), n_var_num] NUM_EXP_0') + + else + let th0' = inst NUM_EXP_DIV2' in + let th0 = MY_PROVE_HYP n2_not_0 (MY_PROVE_HYP e_le th0') in + + let ltm, rtm = dest_comb(rand(concl th0)) in + let num_exp_tm = rator rtm in + let th1 = AP_TERM ltm (AP_TERM num_exp_tm e_sub) in + + let ltm, rtm = dest_comb(rand(concl th1)) in + let th2 = AP_TERM ltm (denormalize rtm) in + let th3 = raw_div_hash_conv (rand(concl th2)) in + let th = TRANS th0 (TRANS th1 (TRANS th2 th3)) in + TRANS th (INST[rand(concl th), n_var_num] NUM_EXP_0');; + + + + +(* +let tm1 = `num_exp (B0 (B4 (B1 _0))) (B1 (B3 _0))`;; +let tm2 = `num_exp (B4 (B6 _0)) (B1 (B2 _0))`;; +num_exp_div tm1 tm2;; +num_exp_div tm2 tm1;; +(* 4: 1.768 *) +test 1000 (num_exp_div tm1) tm2;; +(* 4: 0.656 *) +test 1000 (num_exp_div tm2) tm1;; +*) + +(*****************************) + +(* Computes the lower bound for (op tm1 tm2) *) +let num_exp_op_lo p op tm1 tm2 = + let op_th = op tm1 tm2 in + let rtm = rand (concl op_th) in + let lo_th = num_exp_lo p rtm in + let ltm = rator (concl lo_th) in + let th0 = AP_TERM ltm op_th in + EQ_MP (SYM th0) lo_th;; + + + +let num_exp_op_hi p op tm1 tm2 = + let op_th = op tm1 tm2 in + let rtm = rand (concl op_th) in + let hi_th = num_exp_hi p rtm in + let tm = rand (concl hi_th) in + let th0 = AP_THM (AP_TERM le_op_num op_th) tm in + EQ_MP (SYM th0) hi_th;; + + + +let num_exp_op_hi_lt p op tm1 tm2 = + let op_th = op tm1 tm2 in + let rtm = rand (concl op_th) in + let hi_lt_th = num_exp_hi_lt p rtm in + let tm = rand (concl hi_lt_th) in + let th0 = AP_THM (AP_TERM lt_op_num op_th) tm in + EQ_MP (SYM th0) hi_lt_th;; + + +(* +num_exp_op_lo 1 num_exp_add tm1 tm2;; +num_exp_op_hi 1 num_exp_div tm1 tm2;; +num_exp_op_hi_lt 1 num_exp_div tm1 tm2;; +*) + + +(******************************************) + + +(* float *) + +let mod_plus = new_definition `mod_plus s1 s2 = (~(s1 /\ s2) /\ (s1 \/ s2))`;; + + + + +let EXP_INV_lemma = prove(`!n e1 e2. ~(n = 0) /\ e2 <= e1 ==> &(n EXP (e1 - e2)) = + &(n EXP e1) * inv(&(n EXP e2))`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[GSYM REAL_OF_NUM_POW] THEN + MP_TAC (SPECL [`&n`; `e2:num`; `e1:num`] REAL_POW_SUB) THEN + ASM_REWRITE_TAC[REAL_OF_NUM_EQ; real_div]);; + + +let NUM_EXP_SUB_lemma = prove(`!n e1 e2. e2 <= e1 ==> &(num_exp n (e1 - e2)) = + &(num_exp n e1) * inv(&(num_exp 1 e2))`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[num_exp] THEN + REWRITE_TAC[GSYM REAL_OF_NUM_MUL] THEN + MP_TAC (SPECL [base_const; `e1:num`; `e2:num`] EXP_INV_lemma) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REAL_ARITH_TAC);; + + +(********************) +(* Float operations *) +(********************) + +module Float_ops = struct + + +(**********************************) + +(* FLOAT_LT *) + +let FLOAT_LT_FF = prove(`float F n1 e1 < float F n2 e2 <=> num_exp n1 e1 < num_exp n2 e2`, + REWRITE_TAC[float; GSYM REAL_OF_NUM_LT; REAL_MUL_LID; real_div] THEN + MATCH_MP_TAC REAL_LT_RMUL_EQ THEN + MATCH_MP_TAC REAL_LT_INV THEN + REWRITE_TAC[REAL_OF_NUM_LT; LT_NZ; NUM_EXP_EQ_0] THEN + ARITH_TAC);; + +let FLOAT_LT_TT = prove(`float T n1 e1 < float T n2 e2 <=> num_exp n2 e2 < num_exp n1 e1`, + REWRITE_TAC[FLOAT_NEG_T; REAL_ARITH `--a < --b <=> b < a`] THEN + REWRITE_TAC[FLOAT_LT_FF]);; + + +let FLOAT_LT_FT = prove(`float F n1 e1 < float T n2 e2 <=> F`, + MP_TAC (SPECL [`n2:num`; `e2:num`] FLOAT_T_NEG) THEN + MP_TAC (SPECL [`n1:num`; `e1:num`] FLOAT_F_POS) THEN + REAL_ARITH_TAC);; + + +let FLOAT_LT_TF_00 = (PURE_REWRITE_RULE[NUMERAL] o prove) + (`float T 0 e1 < float F 0 e2 <=> F`, + MP_TAC (SPECL [`T`; `0`; `e1:num`] FLOAT_EQ_0) THEN + MP_TAC (SPECL [`F`; `0`; `e2:num`] FLOAT_EQ_0) THEN + REWRITE_TAC[] THEN + REPLICATE_TAC 2 (DISCH_THEN (fun th -> REWRITE_TAC[th])) THEN + REAL_ARITH_TAC);; + + +let FLOAT_LT_TF_1 = (UNDISCH_ALL o PURE_REWRITE_RULE[NUMERAL] o prove) + (`(n1 = 0 <=> F) ==> (float T n1 e1 < float F n2 e2 <=> T)`, + DISCH_TAC THEN + MATCH_MP_TAC (REAL_ARITH `a < &0 /\ &0 <= b ==> (a < b <=> T)`) THEN + REWRITE_TAC[FLOAT_F_POS] THEN + MATCH_MP_TAC (REAL_ARITH `~(a = &0) /\ a <= &0 ==> a < &0`) THEN + ASM_REWRITE_TAC[FLOAT_T_NEG; FLOAT_EQ_0]);; + + +let FLOAT_LT_TF_2 = (UNDISCH_ALL o PURE_REWRITE_RULE[NUMERAL] o prove) + (`(n2 = 0 <=> F) ==> (float T n1 e1 < float F n2 e2 <=> T)`, + DISCH_TAC THEN + MATCH_MP_TAC (REAL_ARITH `a <= &0 /\ &0 < b ==> (a < b <=> T)`) THEN + REWRITE_TAC[FLOAT_T_NEG] THEN + MATCH_MP_TAC (REAL_ARITH `~(a = &0) /\ &0 <= a ==> &0 < a`) THEN + ASM_REWRITE_TAC[FLOAT_F_POS; FLOAT_EQ_0]);; + + +let FLOAT_F_LT_0 = prove(`float F n e < &0 <=> F`, + MP_TAC (SPEC_ALL FLOAT_F_POS) THEN + REAL_ARITH_TAC);; + +let FLOAT_T_LT_0 = (CONV_RULE (RAND_CONV (REWRITE_CONV[NUMERAL])) o prove) + (`float T n e < &0 <=> (0 < n)`, + REWRITE_TAC[REAL_ARITH `a < &0 <=> a <= &0 /\ ~(a = &0)`] THEN + REWRITE_TAC[FLOAT_T_NEG; FLOAT_EQ_0] THEN + ARITH_TAC);; + + +let FLOAT_F_GT_0 = (CONV_RULE (RAND_CONV (REWRITE_CONV[NUMERAL])) o prove) + (`&0 < float F n e <=> 0 < n`, + REWRITE_TAC[REAL_ARITH `&0 < a <=> &0 <= a /\ ~(a = &0)`] THEN + REWRITE_TAC[FLOAT_F_POS; FLOAT_EQ_0] THEN + ARITH_TAC);; + +let FLOAT_T_GT_0 = prove(`&0 < float T n e <=> F`, + MP_TAC (SPEC_ALL FLOAT_T_NEG) THEN + REAL_ARITH_TAC);; + + +(* float_lt0, float_gt0 *) + +let float_lt0 f1 = + let s, n_tm, e_tm = dest_float f1 in + let inst = INST[n_tm, n_var_num; e_tm, e_var_num] in + if s = "F" then + inst FLOAT_F_LT_0 + else + let gt_th = raw_gt0_hash_conv n_tm in + TRANS (inst FLOAT_T_LT_0) gt_th;; + + +let float_gt0 f1 = + let s, n_tm, e_tm = dest_float f1 in + let inst = INST[n_tm, n_var_num; e_tm, e_var_num] in + if s = "F" then + let gt_th = raw_gt0_hash_conv n_tm in + TRANS (inst FLOAT_F_GT_0) gt_th + else + inst FLOAT_T_GT_0;; + + + +(* float_lt *) + +let float_lt f1 f2 = + let s1, n1, e1 = dest_float f1 in + let s2, n2, e2 = dest_float f2 in + let inst = INST[n1, n1_var_num; e1, e1_var_num; + n2, n2_var_num; e2, e2_var_num] in + if s1 = "F" then + if s2 = "F" then + (* FF *) + let th0 = inst FLOAT_LT_FF in + let ltm, tm2 = dest_comb (rand (concl th0)) in + let lt_th = num_exp_lt (rand ltm) tm2 in + TRANS th0 lt_th + else + (* FT *) + inst FLOAT_LT_FT + else + if s2 = "F" then + (* TF *) + if (is_const n1 && is_const n2) then + (* n1 = _0 and n2 = _0 *) + inst FLOAT_LT_TF_00 + else + let n1_0 = raw_eq0_hash_conv n1 in + if (fst o dest_const o rand o concl) n1_0 = "F" then + (* n1 <> _0 *) + MY_PROVE_HYP n1_0 (inst FLOAT_LT_TF_1) + else + let n2_0 = raw_eq0_hash_conv n2 in + if (fst o dest_const o rand o concl) n2_0 = "F" then + (* n2 <> _0 *) + MY_PROVE_HYP n2_0 (inst FLOAT_LT_TF_2) + else + failwith "float_lt: D0 _0 exception" + else + (* TT *) + let th0 = inst FLOAT_LT_TT in + let ltm, tm2 = dest_comb (rand (concl th0)) in + let lt_th = num_exp_lt (rand ltm) tm2 in + TRANS th0 lt_th;; + +(* +let f1 = `float T (_0) (D5 _0)`;; +let f2 = `float F (D1 _0) (D3 _0)`;; +float_lt f1 f2;; +*) + + +(**********************************) + +(* FLOAT_LE *) + +let FLOAT_LE_FF = prove(`float F n1 e1 <= float F n2 e2 <=> num_exp n1 e1 <= num_exp n2 e2`, + REWRITE_TAC[float; GSYM REAL_OF_NUM_LE; REAL_MUL_LID; real_div] THEN + MATCH_MP_TAC REAL_LE_RMUL_EQ THEN + MATCH_MP_TAC REAL_LT_INV THEN + REWRITE_TAC[REAL_OF_NUM_LT; LT_NZ; NUM_EXP_EQ_0] THEN + ARITH_TAC);; + +let FLOAT_LE_TT = prove(`float T n1 e1 <= float T n2 e2 <=> num_exp n2 e2 <= num_exp n1 e1`, + REWRITE_TAC[FLOAT_NEG_T; REAL_ARITH `--a <= --b <=> b <= a`] THEN + REWRITE_TAC[FLOAT_LE_FF]);; + + +let FLOAT_LE_TF = prove(`float T n1 e1 <= float F n2 e2 <=> T`, + MP_TAC (SPECL [`n1:num`; `e1:num`] FLOAT_T_NEG) THEN + MP_TAC (SPECL [`n2:num`; `e2:num`] FLOAT_F_POS) THEN + REAL_ARITH_TAC);; + + + +let FLOAT_LE_FT = prove(`float F n1 e1 <= float T n2 e2 <=> n1 = 0 /\ n2 = 0`, + REWRITE_TAC[REAL_LE_LT; FLOAT_LT_FT] THEN EQ_TAC THENL + [ + DISCH_TAC THEN SUBGOAL_THEN `float F n1 e1 = &0 /\ float T n2 e2 = &0` MP_TAC THENL + [ + MP_TAC (SPECL [`n2:num`; `e2:num`] FLOAT_T_NEG) THEN + MP_TAC (SPECL [`n1:num`; `e1:num`] FLOAT_F_POS) THEN + ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[FLOAT_EQ_0]; + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[float; NUM_EXP_n0; real_div; REAL_MUL_LZERO; REAL_MUL_RZERO] + ]);; + + +let FLOAT_LE_FT_00 = (PURE_REWRITE_RULE[NUMERAL] o prove) + (`float F 0 e1 <= float T 0 e2 <=> T`, REWRITE_TAC[FLOAT_LE_FT]);; + +let FLOAT_LE_FT_1 = (UNDISCH_ALL o PURE_REWRITE_RULE[NUMERAL] o prove) + (`(n1 = 0 <=> F) ==> (float F n1 e1 <= float T n2 e2 <=> F)`, + DISCH_TAC THEN ASM_REWRITE_TAC[FLOAT_LE_FT]);; + +let FLOAT_LE_FT_2 = (UNDISCH_ALL o PURE_REWRITE_RULE[NUMERAL] o prove) + (`(n2 = 0 <=> F) ==> (float F n1 e1 <= float T n2 e2 <=> F)`, + DISCH_TAC THEN ASM_REWRITE_TAC[FLOAT_LE_FT]);; + + +let FLOAT_F_LE_0 = (CONV_RULE (RAND_CONV (REWRITE_CONV[NUMERAL])) o prove) + (`float F n e <= &0 <=> n = 0`, + REWRITE_TAC[GSYM (SPEC `F` FLOAT_EQ_0)] THEN + MP_TAC (SPEC_ALL FLOAT_F_POS) THEN + REAL_ARITH_TAC);; + +let FLOAT_T_LE_0 = prove(`float T n e <= &0 <=> T`, REWRITE_TAC[FLOAT_T_NEG]);; + + +let FLOAT_F_GE_0 = prove(`&0 <= float F n e <=> T`, REWRITE_TAC[FLOAT_F_POS]);; + +let FLOAT_T_GE_0 = (CONV_RULE (RAND_CONV (REWRITE_CONV[NUMERAL])) o prove) + (`&0 <= float T n e <=> n = 0`, + REWRITE_TAC[GSYM (SPEC `T` FLOAT_EQ_0)] THEN + MP_TAC (SPEC_ALL FLOAT_T_NEG) THEN + REAL_ARITH_TAC);; + + +(* float_le0, float_ge0 *) + +let float_le0 f1 = + let s, n_tm, e_tm = dest_float f1 in + let inst = INST[n_tm, n_var_num; e_tm, e_var_num] in + if s = "T" then + inst FLOAT_T_LE_0 + else + let eq_th = raw_eq0_hash_conv n_tm in + TRANS (inst FLOAT_F_LE_0) eq_th;; + + +let float_ge0 f1 = + let s, n_tm, e_tm = dest_float f1 in + let inst = INST[n_tm, n_var_num; e_tm, e_var_num] in + if s = "T" then + let eq_th = raw_eq0_hash_conv n_tm in + TRANS (inst FLOAT_T_GE_0) eq_th + else + inst FLOAT_F_GE_0;; + + +(* float_le *) + +let float_le f1 f2 = + let s1, n1, e1 = dest_float f1 in + let s2, n2, e2 = dest_float f2 in + let inst = INST[n1, n1_var_num; e1, e1_var_num; + n2, n2_var_num; e2, e2_var_num] in + if s2 = "F" then + if s1 = "F" then + (* FF *) + let th0 = inst FLOAT_LE_FF in + let ltm, tm2 = dest_comb (rand (concl th0)) in + let le_th = num_exp_le (rand ltm) tm2 in + TRANS th0 le_th + else + (* TF *) + inst FLOAT_LE_TF + else + if s1 = "F" then + (* FT *) + if (is_const n1 && is_const n2) then + (* n1 = _0 and n2 = _0 *) + inst FLOAT_LE_FT_00 + else + let n1_0 = raw_eq0_hash_conv n1 in + if (fst o dest_const o rand o concl) n1_0 = "F" then + (* n1 <> _0 *) + MY_PROVE_HYP n1_0 (inst FLOAT_LE_FT_1) + else + let n2_0 = raw_eq0_hash_conv n2 in + if (fst o dest_const o rand o concl) n2_0 = "F" then + (* n2 <> _0 *) + MY_PROVE_HYP n2_0 (inst FLOAT_LE_FT_2) + else + failwith "float_lt: D0 _0 exception" + else + (* TT *) + let th0 = inst FLOAT_LE_TT in + let ltm, tm2 = dest_comb (rand (concl th0)) in + let le_th = num_exp_le (rand ltm) tm2 in + TRANS th0 le_th;; + + +(* +let f1 = `float F (D1 _0) (D5 _0)`;; +let f2 = `float T (D2 _0) (D3 _0)`;; +float_le f1 f2;; +*) + + +(*************************************) +(* float_max, float_min *) + +let FLOAT_MIN_1 = (UNDISCH_ALL o prove)(`(f1 <= f2 <=> T) ==> min f1 f2 = f1`, REAL_ARITH_TAC);; +let FLOAT_MIN_2 = (UNDISCH_ALL o prove)(`(f1 <= f2 <=> F) ==> min f1 f2 = f2`, REAL_ARITH_TAC);; + +let FLOAT_MAX_1 = (UNDISCH_ALL o prove)(`(f1 <= f2 <=> T) ==> max f1 f2 = f2`, REAL_ARITH_TAC);; +let FLOAT_MAX_2 = (UNDISCH_ALL o prove)(`(f1 <= f2 <=> F) ==> max f1 f2 = f1`, REAL_ARITH_TAC);; + + +let float_min f1 f2 = + let inst = INST[f1, f1_var_real; f2, f2_var_real] in + let le_th = float_le f1 f2 in + let th0 = + if (fst o dest_const o rand o concl) le_th = "T" then + inst FLOAT_MIN_1 + else + inst FLOAT_MIN_2 in + MY_PROVE_HYP le_th th0;; + + +let float_max f1 f2 = + let inst = INST[f1, f1_var_real; f2, f2_var_real] in + let le_th = float_le f1 f2 in + let th0 = + if (fst o dest_const o rand o concl) le_th = "T" then + inst FLOAT_MAX_1 + else + inst FLOAT_MAX_2 in + MY_PROVE_HYP le_th th0;; + + +let float_min_max f1 f2 = + let inst = INST[f1, f1_var_real; f2, f2_var_real] in + let le_th = float_le f1 f2 in + let th_min, th_max = + if (fst o dest_const o rand o concl) le_th = "T" then + inst FLOAT_MIN_1, inst FLOAT_MAX_1 + else + inst FLOAT_MIN_2, inst FLOAT_MAX_2 in + MY_PROVE_HYP le_th th_min, MY_PROVE_HYP le_th th_max;; + + +(* +let f1 = `float F (D1 _0) (D5 _0)`;; +let f2 = `float T (D2 _0) (D3 _0)`;; +float_min f1 f2;; +float_max f1 f2;; +float_min_max f1 f2;; +*) + +(*************************************) + +(* FLOAT_MUL *) + +let FLOAT_MUL = prove(`!s1 s2. min_exp <= e /\ num_exp n1 e1 * num_exp n2 e2 = num_exp n e + ==> float s1 n1 e1 * float s2 n2 e2 = + float (mod_plus s1 s2) n (e - min_exp)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[float] THEN + ONCE_REWRITE_TAC[REAL_ARITH `(a * b / c) * (d * e / f) = (a * d) * (b * e) / c / f`] THEN + + SUBGOAL_THEN `(if s1 then -- &1 else &1) * (if s2 then -- &1 else &1) = if mod_plus s1 s2 then -- &1 else &1` MP_TAC THENL + [ + REWRITE_TAC[mod_plus] THEN + COND_CASES_TAC THEN COND_CASES_TAC THEN + REWRITE_TAC[REAL_ARITH `-- &1 * -- &1 = &1`; REAL_MUL_LID; REAL_MUL_RID]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[real_div] THEN + REWRITE_TAC[GSYM REAL_MUL_ASSOC] THEN + REWRITE_TAC[REAL_EQ_MUL_LCANCEL] THEN + DISJ2_TAC THEN + + MP_TAC (SPECL[`n:num`; `e:num`; `min_exp`] NUM_EXP_SUB_lemma) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[REAL_MUL_ASSOC] THEN + ASM_REWRITE_TAC[REAL_OF_NUM_MUL]);; + + + +let FLOAT_MUL_FF = prove(`min_exp <= e /\ e - min_exp = r /\ num_exp n1 e1 * num_exp n2 e2 = num_exp n e ==> + float F n1 e1 * float F n2 e2 = float F n r`, + SIMP_TAC[FLOAT_MUL; mod_plus]);; +let FLOAT_MUL_FT = prove(`min_exp <= e /\ e - min_exp = r /\ num_exp n1 e1 * num_exp n2 e2 = num_exp n e ==> + float F n1 e1 * float T n2 e2 = float T n r`, + SIMP_TAC[FLOAT_MUL; mod_plus]);; +let FLOAT_MUL_TF = prove(`min_exp <= e /\ e - min_exp = r /\ num_exp n1 e1 * num_exp n2 e2 = num_exp n e ==> + float T n1 e1 * float F n2 e2 = float T n r`, + SIMP_TAC[FLOAT_MUL; mod_plus]);; +let FLOAT_MUL_TT = prove(`min_exp <= e /\ e - min_exp = r /\ num_exp n1 e1 * num_exp n2 e2 = num_exp n e ==> + float T n1 e1 * float T n2 e2 = float F n r`, + SIMP_TAC[FLOAT_MUL; mod_plus]);; + + + +let FLOAT_MUL_FF_hi, FLOAT_MUL_FF_lo = + let ff_hi = `min_exp <= e /\ e - min_exp = r /\ num_exp n1 e1 * num_exp n2 e2 <= num_exp n e + ==> float F n1 e1 * float F n2 e2 <= float F n r` in + let ff_lo = `min_exp <= e /\ e - min_exp = r /\ num_exp n e <= num_exp n1 e1 * num_exp n2 e2 + ==> float F n r <= float F n1 e1 * float F n2 e2` in + let proof = + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[GSYM REAL_OF_NUM_LE; GSYM REAL_OF_NUM_MUL] THEN + DISCH_TAC THEN + MAP_EVERY ABBREV_TAC [`z = &(num_exp n e)`; `x = &(num_exp n1 e1)`; `y = &(num_exp n2 e2)`] THEN + ASM_REWRITE_TAC[float; REAL_MUL_LID] THEN + REWRITE_TAC[REAL_ARITH `a / b * c / d = (a * c) / b / d`] THEN + REWRITE_TAC[real_div] THEN + REWRITE_TAC[REAL_MUL_ASSOC] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + REWRITE_TAC[REAL_LE_INV_EQ; REAL_POS] THEN + + MP_TAC (SPECL [`n:num`; `e:num`; `min_exp`] NUM_EXP_SUB_lemma) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + ASM_REWRITE_TAC[REAL_LE_INV_EQ; REAL_POS] in + prove(ff_hi, proof), prove(ff_lo, proof);; + + + +let FLOAT_MUL_TT_hi, FLOAT_MUL_TT_lo = + let tt_hi = `min_exp <= e /\ e - min_exp = r /\ num_exp n1 e1 * num_exp n2 e2 <= num_exp n e + ==> float T n1 e1 * float T n2 e2 <= float F n r` in + let tt_lo = `min_exp <= e /\ e - min_exp = r /\ num_exp n e <= num_exp n1 e1 * num_exp n2 e2 + ==> float F n r <= float T n1 e1 * float T n2 e2` in + let proof = + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[REAL_ARITH `--a * --b = a * b`] THEN + REWRITE_TAC[FLOAT_MUL_FF_hi; FLOAT_MUL_FF_lo] in + prove(tt_hi, proof), prove(tt_lo, proof);; + + + +let FLOAT_MUL_FT_hi, FLOAT_MUL_FT_lo = + let ft_hi = `min_exp <= e /\ e - min_exp = r /\ num_exp n e <= num_exp n1 e1 * num_exp n2 e2 + ==> float F n1 e1 * float T n2 e2 <= float T n r` in + let ft_lo = `min_exp <= e /\ e - min_exp = r /\ num_exp n1 e1 * num_exp n2 e2 <= num_exp n e + ==> float T n r <= float F n1 e1 * float T n2 e2` in + let proof = + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[REAL_ARITH `a * --b <= --c <=> c <= a * b`] THEN + REWRITE_TAC[REAL_ARITH `--c <= a * --b <=> a * b <= c`] THEN + REWRITE_TAC[FLOAT_MUL_FF_hi; FLOAT_MUL_FF_lo] in + prove(ft_hi, proof), prove(ft_lo, proof);; + + + +let FLOAT_MUL_TF_hi, FLOAT_MUL_TF_lo = + let ft_hi = `min_exp <= e /\ e - min_exp = r /\ num_exp n e <= num_exp n1 e1 * num_exp n2 e2 + ==> float T n1 e1 * float F n2 e2 <= float T n r` in + let ft_lo = `min_exp <= e /\ e - min_exp = r /\ num_exp n1 e1 * num_exp n2 e2 <= num_exp n e + ==> float T n r <= float T n1 e1 * float F n2 e2` in + let proof = + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[REAL_ARITH `--a * b <= --c <=> c <= a * b`] THEN + REWRITE_TAC[REAL_ARITH `--c <= --a * b <=> a * b <= c`] THEN + REWRITE_TAC[FLOAT_MUL_FF_hi; FLOAT_MUL_FF_lo] in + prove(ft_hi, proof), prove(ft_lo, proof);; + + +(*********************************************) + +(* float_mul_lo, float_mul_hi *) + +let transform = UNDISCH_ALL o NUMERALS_TO_NUM o REWRITE_RULE[min_exp_def; GSYM IMP_IMP];; +let FLOAT_MUL_FF_hi' = transform FLOAT_MUL_FF_hi and + FLOAT_MUL_FF_lo' = transform FLOAT_MUL_FF_lo and + FLOAT_MUL_TT_hi' = transform FLOAT_MUL_TT_hi and + FLOAT_MUL_TT_lo' = transform FLOAT_MUL_TT_lo and + FLOAT_MUL_FT_hi' = transform FLOAT_MUL_FT_hi and + FLOAT_MUL_FT_lo' = transform FLOAT_MUL_FT_lo and + FLOAT_MUL_TF_hi' = transform FLOAT_MUL_TF_hi and + FLOAT_MUL_TF_lo' = transform FLOAT_MUL_TF_lo;; + +let FLOAT_MUL_FF' = transform FLOAT_MUL_FF and + FLOAT_MUL_TT' = transform FLOAT_MUL_TT and + FLOAT_MUL_FT' = transform FLOAT_MUL_FT and + FLOAT_MUL_TF' = transform FLOAT_MUL_TF;; + + +let float_mul_eq f1 f2 = + let s1, n1, e1 = dest_float f1 and + s2, n2, e2 = dest_float f2 in + let flag = s1 = s2 in + let num_exp1 = mk_num_exp n1 e1 and + num_exp2 = mk_num_exp n2 e2 in + + let mul_th = num_exp_mul num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (rand (concl mul_th)) in + + let sub_th, le_th = raw_sub_and_le_hash_conv e_tm min_exp_num_const in + if (rand(concl le_th) <> e_tm) then + failwith "float_mul_lo: underflow" + else + let r_tm = rand(concl sub_th) in + let inst = INST[e_tm, e_var_num; r_tm, r_var_num; n_tm, n_var_num; + n1, n1_var_num; e1, e1_var_num; n2, n2_var_num; e2, e2_var_num] in + let th0 = inst + (if flag then + if s1 = "F" then FLOAT_MUL_FF' else FLOAT_MUL_TT' + else + if s1 = "F" then FLOAT_MUL_FT' else FLOAT_MUL_TF') in + MY_PROVE_HYP sub_th (MY_PROVE_HYP mul_th (MY_PROVE_HYP le_th th0));; + + + +let float_mul_lo pp f1 f2 = + let s1, n1, e1 = dest_float f1 and + s2, n2, e2 = dest_float f2 in + let flag = s1 = s2 in + let num_exp1 = mk_num_exp n1 e1 and + num_exp2 = mk_num_exp n2 e2 in + + let mul_th, n_tm, e_tm = + if flag then + let th = num_exp_op_lo pp num_exp_mul num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (lhand (concl th)) in + th, n_tm, e_tm + else + let th = num_exp_op_hi pp num_exp_mul num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (rand (concl th)) in + th, n_tm, e_tm in + + let sub_th, le_th = raw_sub_and_le_hash_conv e_tm min_exp_num_const in + if (rand(concl le_th) <> e_tm) then + failwith "float_mul_lo: underflow" + else + let r_tm = rand(concl sub_th) in + let inst = INST[e_tm, e_var_num; r_tm, r_var_num; n_tm, n_var_num; + n1, n1_var_num; e1, e1_var_num; n2, n2_var_num; e2, e2_var_num] in + let th0 = inst + (if flag then + if s1 = "F" then FLOAT_MUL_FF_lo' else FLOAT_MUL_TT_lo' + else + if s1 = "F" then FLOAT_MUL_FT_lo' else FLOAT_MUL_TF_lo') in + MY_PROVE_HYP sub_th (MY_PROVE_HYP mul_th (MY_PROVE_HYP le_th th0));; + + + +let float_mul_hi pp f1 f2 = + let s1, n1, e1 = dest_float f1 and + s2, n2, e2 = dest_float f2 in + let flag = s1 = s2 in + let num_exp1 = mk_num_exp n1 e1 and + num_exp2 = mk_num_exp n2 e2 in + + let mul_th, n_tm, e_tm = + if flag then + let th = num_exp_op_hi pp num_exp_mul num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (rand (concl th)) in + th, n_tm, e_tm + else + let th = num_exp_op_lo pp num_exp_mul num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (lhand (concl th)) in + th, n_tm, e_tm in + + let sub_th, le_th = raw_sub_and_le_hash_conv e_tm min_exp_num_const in + if (rand(concl le_th) <> e_tm) then + failwith "float_mul_hi: underflow" + else + let r_tm = rand(concl sub_th) in + let inst = INST[e_tm, e_var_num; r_tm, r_var_num; n_tm, n_var_num; + n1, n1_var_num; e1, e1_var_num; n2, n2_var_num; e2, e2_var_num] in + let th0 = inst + (if flag then + if s1 = "F" then FLOAT_MUL_FF_hi' else FLOAT_MUL_TT_hi' + else + if s1 = "F" then FLOAT_MUL_FT_hi' else FLOAT_MUL_TF_hi') in + MY_PROVE_HYP sub_th (MY_PROVE_HYP mul_th (MY_PROVE_HYP le_th th0));; + + + + +(*********************************************) + +(* FLOAT_DIV *) + + +let DIV_lemma = prove(`!x y. ~(y = 0) ==> &(x DIV y) <= &x / &y /\ &x / &y <= &(x DIV y + 1)`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + MP_TAC (SPECL [`y:num`; `x:num`] FLOOR_DIV_DIV) THEN + ASM_REWRITE_TAC[GSYM REAL_OF_NUM_ADD] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + SIMP_TAC[FLOOR; REAL_LT_IMP_LE]);; + + +let FLOAT_DIV_FF = prove(`e2 + k <= min_exp + e + e1 /\ ~(n2 = 0) /\ + num_exp n1 k DIV num_exp n2 0 = num_exp n e + ==> float F n ((min_exp + e + e1) - (e2 + k)) <= float F n1 e1 / float F n2 e2`, + MAP_EVERY ABBREV_TAC [`z = num_exp n e`; `x = num_exp n1 k`; `y = num_exp n2 0`] THEN + REPEAT STRIP_TAC THEN + REWRITE_TAC[float; REAL_MUL_LID] THEN + REWRITE_TAC[real_div; REAL_INV_MUL; REAL_INV_INV] THEN + REWRITE_TAC[REAL_ARITH `(a * b) * c * d = (b * d) * (a * c)`] THEN + SUBGOAL_THEN `~(&(num_exp 1 min_exp) = &0)` ASSUME_TAC THENL + [ + REWRITE_TAC[num_exp; REAL_OF_NUM_EQ; MULT_CLAUSES; EXP_EQ_0] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_MUL_LID] THEN + + ASM_SIMP_TAC[NUM_EXP_SUB_lemma] THEN + SUBGOAL_THEN `&(num_exp n1 e1) * inv(&(num_exp n2 e2)) = (&x / &y) * &(num_exp 1 e1) * inv(&(num_exp 1 (e2 + k)))` MP_TAC THENL + [ + EXPAND_TAC "x" THEN EXPAND_TAC "y" THEN + REWRITE_TAC[real_div] THEN + REWRITE_TAC[num_exp; GSYM REAL_OF_NUM_MUL; GSYM REAL_OF_NUM_POW] THEN + REWRITE_TAC[REAL_MUL_LID; REAL_INV_MUL; REAL_INV_1; real_pow; REAL_MUL_RID] THEN + REWRITE_TAC[REAL_POW_ADD; REAL_INV_MUL] THEN + REWRITE_TAC[REAL_ARITH `((a * b) * c) * d * e * f = (b * f) * (a * c * d * e)`] THEN + + SUBGOAL_THEN (mk_comb(`(~)`, mk_eq(mk_binop `pow` (mk_comb (`&`, base_const)) `k:num`, `&0`))) ASSUME_TAC THENL + [ + REWRITE_TAC[REAL_POW_EQ_0] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[REAL_MUL_RINV; REAL_MUL_LID] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ONCE_REWRITE_TAC[REAL_ARITH `(a * b) * c = (a * c) * b`] THEN + REWRITE_TAC[REAL_MUL_ASSOC] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + REWRITE_TAC[REAL_LE_INV_EQ; REAL_POS] THEN + ONCE_REWRITE_TAC[NUM_EXP_SUM1] THEN + REWRITE_TAC[NUM_EXP_SUM] THEN + REWRITE_TAC[GSYM REAL_OF_NUM_MUL] THEN + ASM_REWRITE_TAC[REAL_ARITH `(a * b * c) * d = (d * a) * b * c`] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_MUL_LID] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + REWRITE_TAC[REAL_LE_INV_EQ; REAL_POS] THEN + MP_TAC (SPEC_ALL DIV_lemma) THEN + ANTS_TAC THENL + [ + EXPAND_TAC "y" THEN + REWRITE_TAC[num_exp; MULT_EQ_0; DE_MORGAN_THM] THEN + ASM_REWRITE_TAC[EXP] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[]);; + + + + +let FLOAT_DIV_FF_lo = prove(`e2 + k = r1 /\ min_exp + e + e1 = r2 /\ r2 - r1 = r /\ + r1 <= r2 /\ ~(n2 = 0) /\ + num_exp n e <= num_exp n1 k DIV num_exp n2 0 + ==> float F n r <= float F n1 e1 / float F n2 e2`, + MAP_EVERY ABBREV_TAC [`z = num_exp n e`; `x = num_exp n1 k`; `y = num_exp n2 0`] THEN + REPEAT STRIP_TAC THEN + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN + REPLICATE_TAC 3 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + REPEAT STRIP_TAC THEN + REWRITE_TAC[float; REAL_MUL_LID] THEN + REWRITE_TAC[real_div; REAL_INV_MUL; REAL_INV_INV] THEN + REWRITE_TAC[REAL_ARITH `(a * b) * c * d = (b * d) * (a * c)`] THEN + SUBGOAL_THEN `~(&(num_exp 1 min_exp) = &0)` ASSUME_TAC THENL + [ + REWRITE_TAC[num_exp; REAL_OF_NUM_EQ; MULT_CLAUSES; EXP_EQ_0] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_MUL_LID] THEN + + ASM_SIMP_TAC[NUM_EXP_SUB_lemma] THEN + SUBGOAL_THEN `&(num_exp n1 e1) * inv(&(num_exp n2 e2)) = (&x / &y) * &(num_exp 1 e1) * inv(&(num_exp 1 (e2 + k)))` MP_TAC THENL + [ + EXPAND_TAC "x" THEN EXPAND_TAC "y" THEN + REWRITE_TAC[real_div] THEN + REWRITE_TAC[num_exp; GSYM REAL_OF_NUM_MUL; GSYM REAL_OF_NUM_POW] THEN + REWRITE_TAC[REAL_MUL_LID; REAL_INV_MUL; REAL_INV_1; real_pow; REAL_MUL_RID] THEN + REWRITE_TAC[REAL_POW_ADD; REAL_INV_MUL] THEN + REWRITE_TAC[REAL_ARITH `((a * b) * c) * d * e * f = (b * f) * (a * c * d * e)`] THEN + SUBGOAL_THEN + (mk_comb(`(~)`, mk_eq(mk_binop `pow` (mk_comb (`&`, base_const)) `k:num`, `&0`))) ASSUME_TAC THENL + [ + REWRITE_TAC[REAL_POW_EQ_0] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[REAL_MUL_RINV; REAL_MUL_LID] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ONCE_REWRITE_TAC[REAL_ARITH `(a * b) * c = (a * c) * b`] THEN + REWRITE_TAC[REAL_MUL_ASSOC] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + REWRITE_TAC[REAL_LE_INV_EQ; REAL_POS] THEN + ONCE_REWRITE_TAC[NUM_EXP_SUM1] THEN + REWRITE_TAC[NUM_EXP_SUM] THEN + REWRITE_TAC[GSYM REAL_OF_NUM_MUL] THEN + ASM_REWRITE_TAC[REAL_ARITH `(a * b * c) * d = (d * a) * b * c`] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_MUL_LID] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + REWRITE_TAC[REAL_LE_INV_EQ; REAL_POS] THEN + MP_TAC (SPEC_ALL DIV_lemma) THEN + ANTS_TAC THENL + [ + EXPAND_TAC "y" THEN + REWRITE_TAC[num_exp; MULT_EQ_0; DE_MORGAN_THM] THEN + ASM_REWRITE_TAC[EXP] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + STRIP_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `&(x DIV y)` THEN + ASM_REWRITE_TAC[REAL_OF_NUM_LE]);; + + + + +let FLOAT_DIV_FF_hi = prove(`e2 + k = r1 /\ min_exp + e + e1 = r2 /\ r2 - r1 = r /\ + r1 <= r2 /\ ~(n2 = 0) /\ + num_exp n1 k DIV num_exp n2 0 < num_exp n e + ==> float F n1 e1 / float F n2 e2 <= float F n r`, + MAP_EVERY ABBREV_TAC [`z = num_exp n e`; `x = num_exp n1 k`; `y = num_exp n2 0`] THEN + REPEAT STRIP_TAC THEN + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN + REPLICATE_TAC 3 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + REPEAT STRIP_TAC THEN + REWRITE_TAC[float; REAL_MUL_LID] THEN + REWRITE_TAC[real_div; REAL_INV_MUL; REAL_INV_INV] THEN + REWRITE_TAC[REAL_ARITH `(a * b) * c * d = (b * d) * (a * c)`] THEN + SUBGOAL_THEN `~(&(num_exp 1 min_exp) = &0)` ASSUME_TAC THENL + [ + REWRITE_TAC[num_exp; REAL_OF_NUM_EQ; MULT_CLAUSES; EXP_EQ_0] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_MUL_LID] THEN + + ASM_SIMP_TAC[NUM_EXP_SUB_lemma] THEN + SUBGOAL_THEN `&(num_exp n1 e1) * inv(&(num_exp n2 e2)) = (&x / &y) * &(num_exp 1 e1) * inv(&(num_exp 1 (e2 + k)))` MP_TAC THENL + [ + EXPAND_TAC "x" THEN EXPAND_TAC "y" THEN + REWRITE_TAC[real_div] THEN + REWRITE_TAC[num_exp; GSYM REAL_OF_NUM_MUL; GSYM REAL_OF_NUM_POW] THEN + REWRITE_TAC[REAL_MUL_LID; REAL_INV_MUL; REAL_INV_1; real_pow; REAL_MUL_RID] THEN + REWRITE_TAC[REAL_POW_ADD; REAL_INV_MUL] THEN + REWRITE_TAC[REAL_ARITH `((a * b) * c) * d * e * f = (b * f) * (a * c * d * e)`] THEN + SUBGOAL_THEN + (mk_comb(`(~)`, mk_eq(mk_binop `pow` (mk_comb (`&`, base_const)) `k:num`, `&0`))) ASSUME_TAC THENL + [ + REWRITE_TAC[REAL_POW_EQ_0] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[REAL_MUL_RINV; REAL_MUL_LID] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ONCE_REWRITE_TAC[REAL_ARITH `(a * b) * c = (a * c) * b`] THEN + REWRITE_TAC[REAL_MUL_ASSOC] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + REWRITE_TAC[REAL_LE_INV_EQ; REAL_POS] THEN + ONCE_REWRITE_TAC[NUM_EXP_SUM1] THEN + REWRITE_TAC[NUM_EXP_SUM] THEN + REWRITE_TAC[GSYM REAL_OF_NUM_MUL] THEN + ASM_REWRITE_TAC[REAL_ARITH `(a * b * c) * d = (d * a) * b * c`] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_MUL_LID] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + REWRITE_TAC[REAL_LE_INV_EQ; REAL_POS] THEN + MP_TAC (SPEC_ALL DIV_lemma) THEN + ANTS_TAC THENL + [ + EXPAND_TAC "y" THEN + REWRITE_TAC[num_exp; MULT_EQ_0; DE_MORGAN_THM] THEN + ASM_REWRITE_TAC[EXP] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + STRIP_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `&(x DIV y + 1)` THEN + ASM_REWRITE_TAC[REAL_OF_NUM_LE] THEN + UNDISCH_TAC `x DIV y < z` THEN + ARITH_TAC);; + + + +let FLOAT_DIV_TT_lo = prove(`e2 + k = r1 /\ min_exp + e + e1 = r2 /\ r2 - r1 = r /\ + r1 <= r2 /\ ~(n2 = 0) /\ + num_exp n e <= num_exp n1 k DIV num_exp n2 0 + ==> float F n r <= float T n1 e1 / float T n2 e2`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[real_div; REAL_INV_NEG; REAL_NEG_MUL2] THEN + REWRITE_TAC[GSYM real_div] THEN + REWRITE_TAC[FLOAT_DIV_FF_lo]);; + +let FLOAT_DIV_TT_hi = prove(`e2 + k = r1 /\ min_exp + e + e1 = r2 /\ + r2 - r1 = r /\ r1 <= r2 /\ ~(n2 = 0) /\ + num_exp n1 k DIV num_exp n2 0 < num_exp n e + ==> float T n1 e1 / float T n2 e2 <= float F n r`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[real_div; REAL_INV_NEG; REAL_NEG_MUL2] THEN + REWRITE_TAC[GSYM real_div] THEN + REWRITE_TAC[FLOAT_DIV_FF_hi]);; + + +let FLOAT_DIV_FT_lo = prove(`e2 + k = r1 /\ min_exp + e + e1 = r2 /\ + r2 - r1 = r /\ r1 <= r2 /\ ~(n2 = 0) /\ + num_exp n1 k DIV num_exp n2 0 < num_exp n e + ==> float T n r <= float F n1 e1 / float T n2 e2`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[real_div; REAL_INV_NEG] THEN + REWRITE_TAC[REAL_ARITH `--a <= b * --c <=> b * c <= a`] THEN + REWRITE_TAC[GSYM real_div] THEN + REWRITE_TAC[FLOAT_DIV_FF_hi]);; + +let FLOAT_DIV_FT_hi = prove(`e2 + k = r1 /\ min_exp + e + e1 = r2 /\ + r2 - r1 = r /\ r1 <= r2 /\ ~(n2 = 0) /\ + num_exp n e <= num_exp n1 k DIV num_exp n2 0 + ==> float F n1 e1 / float T n2 e2 <= float T n r`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[real_div; REAL_INV_NEG] THEN + REWRITE_TAC[REAL_ARITH `a * --b <= --c <=> c <= a * b`] THEN + REWRITE_TAC[GSYM real_div] THEN + REWRITE_TAC[FLOAT_DIV_FF_lo]);; + + +let FLOAT_DIV_TF_lo = prove(`e2 + k = r1 /\ min_exp + e + e1 = r2 /\ + r2 - r1 = r /\ r1 <= r2 /\ ~(n2 = 0) /\ + num_exp n1 k DIV num_exp n2 0 < num_exp n e + ==> float T n r <= float T n1 e1 / float F n2 e2`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[real_div; REAL_INV_NEG] THEN + REWRITE_TAC[REAL_ARITH `--a <= --b * c <=> b * c <= a`] THEN + REWRITE_TAC[GSYM real_div] THEN + REWRITE_TAC[FLOAT_DIV_FF_hi]);; + +let FLOAT_DIV_TF_hi = prove(`e2 + k = r1 /\ min_exp + e + e1 = r2 /\ + r2 - r1 = r /\ r1 <= r2 /\ ~(n2 = 0) /\ + num_exp n e <= num_exp n1 k DIV num_exp n2 0 + ==> float T n1 e1 / float F n2 e2 <= float T n r`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[real_div; REAL_INV_NEG] THEN + REWRITE_TAC[REAL_ARITH `--a * b <= --c <=> c <= a * b`] THEN + REWRITE_TAC[GSYM real_div] THEN + REWRITE_TAC[FLOAT_DIV_FF_lo]);; + + +(******************************************) + +(* float_div_lo, float_div_hi *) + +let transform = UNDISCH_ALL o PURE_REWRITE_RULE[TAUT `~P <=> (P <=> F)`] o + NUMERALS_TO_NUM o REWRITE_RULE[GSYM IMP_IMP; min_exp_def];; + +let FLOAT_DIV_FF_hi' = transform FLOAT_DIV_FF_hi and + FLOAT_DIV_FF_lo' = transform FLOAT_DIV_FF_lo and + FLOAT_DIV_TT_hi' = transform FLOAT_DIV_TT_hi and + FLOAT_DIV_TT_lo' = transform FLOAT_DIV_TT_lo and + FLOAT_DIV_FT_hi' = transform FLOAT_DIV_FT_hi and + FLOAT_DIV_FT_lo' = transform FLOAT_DIV_FT_lo and + FLOAT_DIV_TF_hi' = transform FLOAT_DIV_TF_hi and + FLOAT_DIV_TF_lo' = transform FLOAT_DIV_TF_lo;; + + + +let float_div_lo pp f1 f2 = + let s1, n1, e1 = dest_float f1 and + s2, n2, e2 = dest_float f2 in + let flag = s1 = s2 in + + let k_tm = rand (mk_small_numeral_array (2 * pp)) in + let num_exp1 = mk_num_exp n1 k_tm and + num_exp2 = mk_num_exp n2 zero_const in + let div_th, n_tm, e_tm = + if flag then + let th = num_exp_op_lo pp num_exp_div num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (lhand(concl th)) in + th, n_tm, e_tm + else + let th = num_exp_op_hi_lt pp num_exp_div num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (rand(concl th)) in + th, n_tm, e_tm in + + let r1_th = raw_add_conv_hash (mk_binop plus_op_num e2 k_tm) in + let r1_tm = rand(concl r1_th) in + let e_plus_e1 = raw_add_conv_hash (mk_binop plus_op_num e_tm e1) in + let ltm, rtm = dest_comb(concl e_plus_e1) in + let r2_th' = raw_add_conv_hash (mk_binop plus_op_num min_exp_num_const rtm) in + let r2_th = TRANS (AP_TERM (mk_comb (plus_op_num, min_exp_num_const)) e_plus_e1) r2_th' in + let r2_tm = rand(concl r2_th) in + let sub_th, le_th = raw_sub_and_le_hash_conv r2_tm r1_tm in + if rand(concl le_th) <> r2_tm then + failwith "float_div_lo: underflow" + else + let r_tm = rand(concl sub_th) in + let n2_not_zero = raw_eq0_hash_conv n2 in + let inst = INST[r1_tm, r1_var_num; r2_tm, r2_var_num; + n1, n1_var_num; e1, e1_var_num; + e_tm, e_var_num; k_tm, k_var_num; + n2, n2_var_num; e2, e2_var_num; + n_tm, n_var_num; r_tm, r_var_num] in + let th0 = inst + (if flag then + if s1 = "F" then FLOAT_DIV_FF_lo' else FLOAT_DIV_TT_lo' + else + if s1 = "F" then FLOAT_DIV_FT_lo' else FLOAT_DIV_TF_lo') in + let th1 = MY_PROVE_HYP n2_not_zero (MY_PROVE_HYP div_th (MY_PROVE_HYP le_th th0)) in + MY_PROVE_HYP sub_th (MY_PROVE_HYP r2_th (MY_PROVE_HYP r1_th th1));; + + + + + +let float_div_hi pp f1 f2 = + let s1, n1, e1 = dest_float f1 and + s2, n2, e2 = dest_float f2 in + let flag = s1 = s2 in + + let k_tm = rand (mk_small_numeral_array (2 * pp)) in + let num_exp1 = mk_num_exp n1 k_tm and + num_exp2 = mk_num_exp n2 zero_const in + let div_th, n_tm, e_tm = + if flag then + let th = num_exp_op_hi_lt pp num_exp_div num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (rand(concl th)) in + th, n_tm, e_tm + else + let th = num_exp_op_lo pp num_exp_div num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (lhand(concl th)) in + th, n_tm, e_tm in + + let r1_th = raw_add_conv_hash (mk_binop plus_op_num e2 k_tm) in + let r1_tm = rand(concl r1_th) in + let e_plus_e1 = raw_add_conv_hash (mk_binop plus_op_num e_tm e1) in + let ltm, rtm = dest_comb(concl e_plus_e1) in + let r2_th' = raw_add_conv_hash (mk_binop plus_op_num min_exp_num_const rtm) in + let r2_th = TRANS (AP_TERM (mk_comb (plus_op_num, min_exp_num_const)) e_plus_e1) r2_th' in + let r2_tm = rand(concl r2_th) in + let sub_th, le_th = raw_sub_and_le_hash_conv r2_tm r1_tm in + if rand(concl le_th) <> r2_tm then + failwith "float_div_hi: underflow" + else + let r_tm = rand(concl sub_th) in + let n2_not_zero = raw_eq0_hash_conv n2 in + let inst = INST[r1_tm, r1_var_num; r2_tm, r2_var_num; + n1, n1_var_num; e1, e1_var_num; + e_tm, e_var_num; k_tm, k_var_num; + n2, n2_var_num; e2, e2_var_num; + n_tm, n_var_num; r_tm, r_var_num] in + let th0 = inst + (if flag then + if s1 = "F" then FLOAT_DIV_FF_hi' else FLOAT_DIV_TT_hi' + else + if s1 = "F" then FLOAT_DIV_FT_hi' else FLOAT_DIV_TF_hi') in + let th1 = MY_PROVE_HYP n2_not_zero (MY_PROVE_HYP div_th (MY_PROVE_HYP le_th th0)) in + MY_PROVE_HYP sub_th (MY_PROVE_HYP r2_th (MY_PROVE_HYP r1_th th1));; + + + + + +(* +float_div_lo 1 `float F (B1 _0) (B10 _0)` `float F (B3 _0) (B10 _0)`;; +float_div_hi 1 `float F (B1 _0) (B10 _0)` `float F (B3 _0) (B10 _0)`;; +float_div_hi 5 f1 f2;; +*) + + + + +(***********************************) + + +(* FLOAT_ADD *) + +let FLOAT_ADD_FF = prove(`num_exp n1 e1 + num_exp n2 e2 = num_exp n e + ==> float F n1 e1 + float F n2 e2 = float F n e`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[float; REAL_MUL_LID] THEN + REWRITE_TAC[REAL_ARITH `a / b + c / b = (a + c) / b`] THEN + ASM_REWRITE_TAC[REAL_OF_NUM_ADD]);; + + +let FLOAT_ADD_TT = prove(`num_exp n1 e1 + num_exp n2 e2 = num_exp n e + ==> float T n1 e1 + float T n2 e2 = float T n e`, + REWRITE_TAC[FLOAT_NEG_T; REAL_ARITH `--a + --b = --c <=> a + b = c`] THEN + REWRITE_TAC[FLOAT_ADD_FF]);; + + + +let FLOAT_ADD_FF_lo = prove(`num_exp n e <= num_exp n1 e1 + num_exp n2 e2 + ==> float F n e <= float F n1 e1 + float F n2 e2`, + REWRITE_TAC[GSYM REAL_OF_NUM_LE; GSYM REAL_OF_NUM_ADD] THEN + REPEAT STRIP_TAC THEN + MAP_EVERY ABBREV_TAC [`z = &(num_exp n e)`; `x = &(num_exp n1 e1)`; `y = &(num_exp n2 e2)`] THEN + ASM_REWRITE_TAC[float; REAL_MUL_LID] THEN + REWRITE_TAC[REAL_ARITH `a / b + c / b = (a + c) / b`] THEN + REWRITE_TAC[real_div] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + ASM_REWRITE_TAC[REAL_LE_INV_EQ; REAL_POS]);; + + + + + +let FLOAT_ADD_FF_hi = prove(`num_exp n1 e1 + num_exp n2 e2 <= num_exp n e + ==> float F n1 e1 + float F n2 e2 <= float F n e`, + REWRITE_TAC[GSYM REAL_OF_NUM_LE; GSYM REAL_OF_NUM_ADD] THEN + REPEAT STRIP_TAC THEN + MAP_EVERY ABBREV_TAC [`z = &(num_exp n e)`; `x = &(num_exp n1 e1)`; `y = &(num_exp n2 e2)`] THEN + ASM_REWRITE_TAC[float; REAL_MUL_LID] THEN + REWRITE_TAC[REAL_ARITH `a / b + c / b = (a + c) / b`] THEN + REWRITE_TAC[real_div] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + ASM_REWRITE_TAC[REAL_LE_INV_EQ; REAL_POS]);; + + + +let FLOAT_ADD_TT_lo = prove(`num_exp n1 e1 + num_exp n2 e2 <= num_exp n e + ==> float T n e <= float T n1 e1 + float T n2 e2`, + REWRITE_TAC[FLOAT_NEG_T; REAL_ARITH `--a <= --b + --c <=> b + c <= a`] THEN + REWRITE_TAC[FLOAT_ADD_FF_hi]);; + + + +let FLOAT_ADD_TT_hi = prove(`num_exp n e <= num_exp n1 e1 + num_exp n2 e2 + ==> float T n1 e1 + float T n2 e2 <= float T n e`, + REWRITE_TAC[FLOAT_NEG_T; REAL_ARITH `--b + --c <= --a <=> a <= b + c`] THEN + REWRITE_TAC[FLOAT_ADD_FF_lo]);; + + + +let FLOAT_ADD_FT_F_lo = prove(`num_exp n2 e2 <= num_exp n1 e1 ==> + num_exp n e <= num_exp n1 e1 - num_exp n2 e2 + ==> float F n e <= float F n1 e1 + float T n2 e2`, + MAP_EVERY ABBREV_TAC[`z = num_exp n e`; `x = num_exp n1 e1`; `y = num_exp n2 e2`] THEN + ASM_REWRITE_TAC[FLOAT_NEG_T; float; REAL_MUL_LID] THEN + DISCH_TAC THEN + ASM_SIMP_TAC[GSYM REAL_OF_NUM_LE; GSYM REAL_OF_NUM_SUB] THEN + REWRITE_TAC[num_exp; min_exp_def; MULT_CLAUSES; GSYM REAL_OF_NUM_POW] THEN + REAL_ARITH_TAC);; + + +let FLOAT_ADD_FT_T_lo = prove(`num_exp n1 e1 <= num_exp n2 e2 ==> + num_exp n2 e2 - num_exp n1 e1 <= num_exp n e + ==> float T n e <= float F n1 e1 + float T n2 e2`, + MAP_EVERY ABBREV_TAC[`z = num_exp n e`; `x = num_exp n1 e1`; `y = num_exp n2 e2`] THEN + ASM_REWRITE_TAC[FLOAT_NEG_T; float; REAL_MUL_LID] THEN + DISCH_TAC THEN + ASM_SIMP_TAC[GSYM REAL_OF_NUM_LE; GSYM REAL_OF_NUM_SUB] THEN + REWRITE_TAC[num_exp; min_exp_def; MULT_CLAUSES; GSYM REAL_OF_NUM_POW] THEN + REAL_ARITH_TAC);; + + +let FLOAT_ADD_FT_F_hi = prove(`num_exp n2 e2 <= num_exp n1 e1 ==> + num_exp n1 e1 - num_exp n2 e2 <= num_exp n e + ==> float F n1 e1 + float T n2 e2 <= float F n e`, + REWRITE_TAC[FLOAT_NEG_T; REAL_ARITH `a + --b <= c <=> --c <= b + --a`] THEN + REWRITE_TAC[GSYM FLOAT_NEG_T; FLOAT_ADD_FT_T_lo]);; + + +let FLOAT_ADD_FT_T_hi = prove(`num_exp n1 e1 <= num_exp n2 e2 ==> + num_exp n e <= num_exp n2 e2 - num_exp n1 e1 + ==> float F n1 e1 + float T n2 e2 <= float T n e`, + REWRITE_TAC[FLOAT_NEG_T; REAL_ARITH `a + --b <= --c <=> c <= b + --a`] THEN + REWRITE_TAC[GSYM FLOAT_NEG_T; FLOAT_ADD_FT_F_lo]);; + + + + +(******************************************) + +(* float_add_lo, float_add_hi *) + +let m_var_real = `m:real` and + n_var_real = `n:real`;; + +let REAL_ADD_COMM = CONJUNCT1 REAL_ADD_AC;; + +let transform = UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o NUMERALS_TO_NUM;; +let FLOAT_ADD_FF_hi' = transform FLOAT_ADD_FF_hi and + FLOAT_ADD_FF_lo' = transform FLOAT_ADD_FF_lo and + FLOAT_ADD_TT_hi' = transform FLOAT_ADD_TT_hi and + FLOAT_ADD_TT_lo' = transform FLOAT_ADD_TT_lo and + FLOAT_ADD_FT_F_lo' = transform FLOAT_ADD_FT_F_lo and + FLOAT_ADD_FT_T_lo' = transform FLOAT_ADD_FT_T_lo and + FLOAT_ADD_FT_F_hi' = transform FLOAT_ADD_FT_F_hi and + FLOAT_ADD_FT_T_hi' = transform FLOAT_ADD_FT_T_hi;; + + + + +let float_add_lo pp f1 f2 = + let s1, n1, e1 = dest_float f1 in + let s2, n2, e2 = dest_float f2 in + if s1 = s2 then + let num_exp1 = mk_num_exp n1 e1 in + let num_exp2 = mk_num_exp n2 e2 in + + if s1 = "F" then + (* F + F *) + let add_th = num_exp_op_lo pp num_exp_add num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (lhand(concl add_th)) in + let th0 = INST[e_tm, e_var_num; n_tm, n_var_num; n1, n1_var_num; + e1, e1_var_num; n2, n2_var_num; e2, e2_var_num] FLOAT_ADD_FF_lo' in + MY_PROVE_HYP add_th th0 + else + (* T + T *) + let add_th = num_exp_op_hi pp num_exp_add num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (rand(concl add_th)) in + let th0 = INST[e_tm, e_var_num; n_tm, n_var_num; n1, n1_var_num; + e1, e1_var_num; n2, n2_var_num; e2, e2_var_num] FLOAT_ADD_TT_lo' in + MY_PROVE_HYP add_th th0 + else + (* F + T or T + F *) + let th0, n1, e1, n2, e2 = + if s1 = "T" then + INST[f2, m_var_real; f1, n_var_real] REAL_ADD_COMM, n2, e2, n1, e1 + else + REFL(mk_binop plus_op_real f1 f2), n1, e1, n2, e2 in + + let num_exp1 = mk_num_exp n1 e1 in + let num_exp2 = mk_num_exp n2 e2 in + + let sub_th, le_th = num_exp_sub num_exp1 num_exp2 in + let sub_tm = rand(concl sub_th) in + + if rand(concl le_th) = num_exp1 then + let lo_th = num_exp_lo pp sub_tm in + let n_tm, e_tm = dest_num_exp (lhand(concl lo_th)) in + let lo_sub_th = EQ_MP (AP_TERM (rator(concl lo_th)) (SYM sub_th)) lo_th in + + let th1 = INST[n1, n1_var_num; e1, e1_var_num; n2, n2_var_num; e2, e2_var_num; + n_tm, n_var_num; e_tm, e_var_num] FLOAT_ADD_FT_F_lo' in + let th2 = MY_PROVE_HYP lo_sub_th (MY_PROVE_HYP le_th th1) in + EQ_MP (AP_TERM (rator(concl th2)) th0) th2 + + else + let hi_th = num_exp_hi pp sub_tm in + let n_tm, e_tm = dest_num_exp(rand(concl hi_th)) in + let hi_sub_th = EQ_MP (SYM (AP_THM (AP_TERM le_op_num sub_th) (rand(concl hi_th)))) hi_th in + + let th1 = INST[n1, n1_var_num; e1, e1_var_num; n2, n2_var_num; e2, e2_var_num; + n_tm, n_var_num; e_tm, e_var_num] FLOAT_ADD_FT_T_lo' in + let th2 = MY_PROVE_HYP hi_sub_th (MY_PROVE_HYP le_th th1) in + EQ_MP (AP_TERM (rator(concl th2)) th0) th2;; + + + + + + +let float_add_hi pp f1 f2 = + let s1, n1, e1 = dest_float f1 in + let s2, n2, e2 = dest_float f2 in + if s1 = s2 then + let num_exp1 = mk_num_exp n1 e1 in + let num_exp2 = mk_num_exp n2 e2 in + + if s1 = "F" then + (* F + F *) + let add_th = num_exp_op_hi pp num_exp_add num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (rand(concl add_th)) in + let th0 = INST[e_tm, e_var_num; n_tm, n_var_num; n1, n1_var_num; + e1, e1_var_num; n2, n2_var_num; e2, e2_var_num] FLOAT_ADD_FF_hi' in + MY_PROVE_HYP add_th th0 + else + (* T + T *) + let add_th = num_exp_op_lo pp num_exp_add num_exp1 num_exp2 in + let n_tm, e_tm = dest_num_exp (lhand(concl add_th)) in + let th0 = INST[e_tm, e_var_num; n_tm, n_var_num; n1, n1_var_num; + e1, e1_var_num; n2, n2_var_num; e2, e2_var_num] FLOAT_ADD_TT_hi' in + MY_PROVE_HYP add_th th0 + else + (* F + T or T + F *) + let th0, n1, e1, n2, e2 = + if s1 = "T" then + INST[f2, m_var_real; f1, n_var_real] REAL_ADD_COMM, n2, e2, n1, e1 + else + REFL(mk_binop plus_op_real f1 f2), n1, e1, n2, e2 in + + let num_exp1 = mk_num_exp n1 e1 in + let num_exp2 = mk_num_exp n2 e2 in + + let sub_th, le_th = num_exp_sub num_exp1 num_exp2 in + let sub_tm = rand(concl sub_th) in + + if rand(concl le_th) = num_exp1 then + let hi_th = num_exp_hi pp sub_tm in + let n_tm, e_tm = dest_num_exp (rand(concl hi_th)) in + let hi_sub_th = EQ_MP (SYM (AP_THM (AP_TERM le_op_num sub_th) (rand(concl hi_th)))) hi_th in + + let th1 = INST[n1, n1_var_num; e1, e1_var_num; n2, n2_var_num; e2, e2_var_num; + n_tm, n_var_num; e_tm, e_var_num] FLOAT_ADD_FT_F_hi' in + let th2 = MY_PROVE_HYP hi_sub_th (MY_PROVE_HYP le_th th1) in + EQ_MP (AP_THM (AP_TERM le_op_real th0) (rand(concl th2))) th2 + + else + let lo_th = num_exp_lo pp sub_tm in + let n_tm, e_tm = dest_num_exp(lhand(concl lo_th)) in + let lo_sub_th = EQ_MP (AP_TERM (rator(concl lo_th)) (SYM sub_th)) lo_th in + + let th1 = INST[n1, n1_var_num; e1, e1_var_num; n2, n2_var_num; e2, e2_var_num; + n_tm, n_var_num; e_tm, e_var_num] FLOAT_ADD_FT_T_hi' in + let th2 = MY_PROVE_HYP lo_sub_th (MY_PROVE_HYP le_th th1) in + EQ_MP (AP_THM (AP_TERM le_op_real th0) (rand(concl th2))) th2;; + + + +(* +float_add_lo 1 f1 f2;; +float_add_hi 1 f1 f2;; +*) + + + +(******************************************) + +(* float_sub_lo, float_sub_hi *) + + +let s1_var_bool = `s1:bool` and + f1_var_real = `f1:real` and + f2_var_real = `f2:real`;; + + +let FLOAT_SUB_F_EQ_ADD = (SYM o prove)(`f1 - float F n2 e2 = f1 + float T n2 e2`, + REWRITE_TAC[FLOAT_NEG_T] THEN REAL_ARITH_TAC);; + +let FLOAT_SUB_T_EQ_ADD = (SYM o prove)(`f1 - float T n2 e2 = f1 + float F n2 e2`, + REWRITE_TAC[FLOAT_NEG_T] THEN REAL_ARITH_TAC);; + + + +let float_sub_lo pp f1 f2 = + let s2, n2, e2 = dest_float f2 in + let th0 = + INST[f1, f1_var_real; n2, n2_var_num; e2, e2_var_num] + (if s2 = "F" then FLOAT_SUB_F_EQ_ADD else FLOAT_SUB_T_EQ_ADD) in + let ltm,f2_tm = dest_comb(lhand(concl th0)) in + let f1_tm = rand ltm in + let lo_th = float_add_lo pp f1_tm f2_tm in + EQ_MP (AP_TERM (rator(concl lo_th)) th0) lo_th;; + + + +let float_sub_hi pp f1 f2 = + let s2, n2, e2 = dest_float f2 in + let th0 = + INST[f1, f1_var_real; n2, n2_var_num; e2, e2_var_num] + (if s2 = "F" then FLOAT_SUB_F_EQ_ADD else FLOAT_SUB_T_EQ_ADD) in + let ltm, f2_tm = dest_comb(lhand(concl th0)) in + let f1_tm = rand ltm in + let hi_th = float_add_hi pp f1_tm f2_tm in + EQ_MP (AP_THM (AP_TERM le_op_real th0) (rand(concl hi_th))) hi_th;; + + + + +(* +let f1 = `float F (D5 (D2 _0)) (D0 (D1 _0))`;; +let f2 = `float F (D3 (D2 _0)) (D9 _0)`;; +float_sub_hi 1 f2 f1;; +*) + + +(*******************************************) + +(* FLOAT_SQRT *) + + +(* float F m e = float F (B0 m) (PRE e) *) +let FLOAT_PRE_EXP = prove(mk_imp(`~(e = 0) /\ PRE e = e1`, + mk_eq(`float F m e`, + mk_comb(mk_comb(`float F`, mk_comb(b0_const, m_var_num)), `e1:num`))), + STRIP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[float; REAL_MUL_LID; real_div; REAL_EQ_MUL_RCANCEL] THEN + DISJ1_TAC THEN + REWRITE_TAC[num_exp; b0_thm; REAL_OF_NUM_EQ] THEN + SUBGOAL_THEN `e = SUC (PRE e)` MP_TAC THENL + [ + POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> CONV_TAC (LAND_CONV (ONCE_REWRITE_CONV[th]))) THEN + REWRITE_TAC[EXP] THEN + ARITH_TAC);; + + + + + +let DIV2_EVEN_lemma = prove(`!n. EVEN n ==> 2 * (n DIV 2) = n`, + GEN_TAC THEN + REWRITE_TAC[EVEN_EXISTS] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC (ARITH_RULE `x = y ==> 2 * x = 2 * y`) THEN + MATCH_MP_TAC DIV_MULT THEN + ARITH_TAC);; + + + +let FLOAT_SQRT_EVEN_lo = prove(`f1 * f1 = f2 /\ f2 <= x /\ + num_exp m (2 * p) = x /\ f1 = num_exp n1 e1 + /\ EVEN e /\ e DIV 2 = e2 /\ + e1 + e2 + (min_exp DIV 2) = r /\ + p <= r /\ r - p = r2 + ==> float F n1 r2 <= sqrt (float F m e)`, + STRIP_TAC THEN + UNDISCH_TAC `f2 <= x:num` THEN + UNDISCH_TAC `num_exp m (2 * p) = x` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + UNDISCH_TAC `f1 * f1 = f2:num` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + UNDISCH_TAC `e1 + e2 + min_exp DIV 2 = r` THEN + UNDISCH_TAC `e DIV 2 = e2` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REWRITE_TAC[num_exp; float; REAL_MUL_LID; GSYM REAL_OF_NUM_MUL] THEN + REPEAT STRIP_TAC THEN + UNDISCH_TAC `r - p = r2:num` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + + MATCH_MP_TAC REAL_LE_RSQRT THEN + REWRITE_TAC[GSYM REAL_OF_NUM_POW; REAL_POW_DIV] THEN + REWRITE_TAC[REAL_POW_2; real_div; REAL_INV_MUL] THEN + REWRITE_TAC[REAL_MUL_ASSOC] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + CONJ_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `(((a * b) * a) * b) * c = (a * a) * (b * b) * c:real`] THEN + REWRITE_TAC[GSYM REAL_POW_ADD] THEN + REWRITE_TAC[ARITH_RULE `r - p + r - p = 2 * r - 2 * p`] THEN + MP_TAC (SPECL[mk_comb(amp_op_real, base_const); `2 * r`; `2 * p`] REAL_DIV_POW2) THEN + ANTS_TAC THENL [ REAL_ARITH_TAC; ALL_TAC ] THEN + ASM_SIMP_TAC[ARITH_RULE `p <= r ==> 2 * p <= 2 * r`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th; real_div]) THEN + + SUBGOAL_THEN `2 * r = (e1 + e1) + min_exp + e` (fun th -> REWRITE_TAC[th]) THENL + [ + EXPAND_TAC "r" THEN + REWRITE_TAC[ARITH_RULE `2 * (e1 + b + c) = (e1 + e1) + 2 * c + 2 * b`] THEN + MATCH_MP_TAC (ARITH_RULE `b1 = b2 /\ c1 = c2 ==> a + b1 + c1 = a + b2 + c2:num`) THEN + SUBGOAL_THEN `EVEN min_exp` ASSUME_TAC THENL + [ + REWRITE_TAC[min_exp_def] THEN ARITH_TAC; + ALL_TAC + ] THEN + ASM_SIMP_TAC[DIV2_EVEN_lemma]; + ALL_TAC + ] THEN + + REWRITE_TAC[REAL_POW_ADD] THEN + REWRITE_TAC[REAL_ARITH `(n * n) * (((e * e) * x * y) * z) * u = (n * e) * (n * e) * (x * u) * z * y:real`] THEN + SUBGOAL_THEN `~(&(num_exp 1 min_exp) = &0)` MP_TAC THENL + [ + REWRITE_TAC[REAL_OF_NUM_EQ; NUM_EXP_EQ_0] THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[num_exp; REAL_MUL_LID; GSYM REAL_OF_NUM_POW; GSYM REAL_OF_NUM_MUL] THEN + DISCH_THEN (fun th -> SIMP_TAC[th; REAL_MUL_RINV; REAL_MUL_LID]) THEN + FIRST_X_ASSUM (MP_TAC o check(fun th -> (fst o dest_var o lhand o concl) th = "f1")) THEN + REWRITE_TAC[GSYM REAL_OF_NUM_EQ; GSYM REAL_OF_NUM_MUL; GSYM REAL_OF_NUM_POW] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + + REWRITE_TAC[REAL_MUL_ASSOC] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + CONJ_TAC THENL + [ + SUBGOAL_THEN `!x y z. &0 < x /\ y <= z * x ==> y * inv x <= z` MP_TAC THENL + [ + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`y * inv x`; `z:real`; `x:real`] REAL_LE_RMUL_EQ) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th; GSYM REAL_MUL_ASSOC]) THEN + ASM_SIMP_TAC[REAL_ARITH `&0 < x ==> ~(x = &0)`; REAL_MUL_LINV; REAL_MUL_RID]; + ALL_TAC + ] THEN + + DISCH_THEN (MP_TAC o SPECL[`&(num_exp 1 (2 * p))`; `&(f1 * f1)`; `&m`]) THEN + REWRITE_TAC[num_exp; GSYM REAL_OF_NUM_MUL; GSYM REAL_OF_NUM_POW; REAL_MUL_LID] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[REAL_OF_NUM_MUL; REAL_OF_NUM_POW; REAL_OF_NUM_LE] THEN + REWRITE_TAC[REAL_OF_NUM_LT; EXP_LT_0] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_POW_LE THEN + ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_INV THEN + MATCH_MP_TAC REAL_POW_LE THEN + ARITH_TAC);; + + +let FLOAT_SQRT_EVEN_hi = prove(`f1 * f1 = f2 /\ x <= f2 /\ + num_exp m (2 * p) = x /\ f1 = num_exp n1 e1 + /\ EVEN e /\ e DIV 2 = e2 /\ + e1 + e2 + (min_exp DIV 2) = r /\ + p <= r /\ r - p = r2 + ==> sqrt (float F m e) <= float F n1 r2`, + STRIP_TAC THEN + UNDISCH_TAC `x <= f2:num` THEN + UNDISCH_TAC `num_exp m (2 * p) = x` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + UNDISCH_TAC `f1 * f1 = f2:num` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + UNDISCH_TAC `e1 + e2 + min_exp DIV 2 = r` THEN + UNDISCH_TAC `e DIV 2 = e2` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REWRITE_TAC[num_exp; float; REAL_MUL_LID; GSYM REAL_OF_NUM_MUL] THEN + REPEAT STRIP_TAC THEN + UNDISCH_TAC `r - p = r2:num` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + + MATCH_MP_TAC REAL_LE_LSQRT THEN + REPEAT CONJ_TAC THENL + [ + REWRITE_TAC[REAL_OF_NUM_MUL; real_div] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + REWRITE_TAC[REAL_POS] THEN + MATCH_MP_TAC REAL_LE_INV THEN + REWRITE_TAC[REAL_POS]; + REWRITE_TAC[REAL_OF_NUM_MUL; real_div] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + REWRITE_TAC[REAL_POS] THEN + MATCH_MP_TAC REAL_LE_INV THEN + REWRITE_TAC[REAL_POS]; + ALL_TAC + ] THEN + + REWRITE_TAC[GSYM REAL_OF_NUM_POW; REAL_POW_DIV] THEN + REWRITE_TAC[REAL_POW_2; real_div; REAL_INV_MUL] THEN + REWRITE_TAC[REAL_MUL_ASSOC] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + CONJ_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `(((a * b) * a) * b) * c = (a * a) * (b * b) * c:real`] THEN + REWRITE_TAC[GSYM REAL_POW_ADD] THEN + REWRITE_TAC[ARITH_RULE `r - p + r - p = 2 * r - 2 * p`] THEN + MP_TAC (SPECL[mk_comb(amp_op_real, base_const); `2 * r`; `2 * p`] REAL_DIV_POW2) THEN + ANTS_TAC THENL [ REAL_ARITH_TAC; ALL_TAC ] THEN + ASM_SIMP_TAC[ARITH_RULE `p <= r ==> 2 * p <= 2 * r`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th; real_div]) THEN + + SUBGOAL_THEN `2 * r = (e1 + e1) + min_exp + e` (fun th -> REWRITE_TAC[th]) THENL + [ + EXPAND_TAC "r" THEN + REWRITE_TAC[ARITH_RULE `2 * (e1 + b + c) = (e1 + e1) + 2 * c + 2 * b`] THEN + MATCH_MP_TAC (ARITH_RULE `b1 = b2 /\ c1 = c2 ==> a + b1 + c1 = a + b2 + c2:num`) THEN + SUBGOAL_THEN `EVEN min_exp` ASSUME_TAC THENL + [ + REWRITE_TAC[min_exp_def] THEN ARITH_TAC; + ALL_TAC + ] THEN + ASM_SIMP_TAC[DIV2_EVEN_lemma]; + ALL_TAC + ] THEN + + REWRITE_TAC[REAL_POW_ADD] THEN + REWRITE_TAC[REAL_ARITH `(n * n) * (((e * e) * x * y) * z) * u = (n * e) * (n * e) * (x * u) * z * y:real`] THEN + SUBGOAL_THEN `~(&(num_exp 1 min_exp) = &0)` MP_TAC THENL + [ + REWRITE_TAC[REAL_OF_NUM_EQ; NUM_EXP_EQ_0] THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[num_exp; REAL_MUL_LID; GSYM REAL_OF_NUM_POW; GSYM REAL_OF_NUM_MUL] THEN + DISCH_THEN (fun th -> SIMP_TAC[th; REAL_MUL_RINV; REAL_MUL_LID]) THEN + FIRST_X_ASSUM (MP_TAC o check(fun th -> (fst o dest_var o lhand o concl) th = "f1")) THEN + REWRITE_TAC[GSYM REAL_OF_NUM_EQ; GSYM REAL_OF_NUM_MUL; GSYM REAL_OF_NUM_POW] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + + REWRITE_TAC[REAL_MUL_ASSOC] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + CONJ_TAC THENL + [ + SUBGOAL_THEN `!x y z. &0 < x /\ z * x <= y ==> z <= y * inv x` MP_TAC THENL + [ + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`z:real`; `y * inv x`; `x:real`] REAL_LE_RMUL_EQ) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th; GSYM REAL_MUL_ASSOC]) THEN + ASM_SIMP_TAC[REAL_ARITH `&0 < x ==> ~(x = &0)`; REAL_MUL_LINV; REAL_MUL_RID]; + ALL_TAC + ] THEN + + DISCH_THEN (MP_TAC o SPECL[`&(num_exp 1 (2 * p))`; `&(f1 * f1)`; `&m`]) THEN + REWRITE_TAC[num_exp; GSYM REAL_OF_NUM_MUL; GSYM REAL_OF_NUM_POW; REAL_MUL_LID] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[REAL_OF_NUM_MUL; REAL_OF_NUM_POW; REAL_OF_NUM_LE] THEN + REWRITE_TAC[REAL_OF_NUM_LT; EXP_LT_0] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_POW_LE THEN + ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_INV THEN + MATCH_MP_TAC REAL_POW_LE THEN + ARITH_TAC);; + + + + + +let transform = UNDISCH_ALL o + PURE_ONCE_REWRITE_RULE[TAUT `EVEN e <=> (EVEN e <=> T)`] o + NUMERALS_TO_NUM o + CONV_RULE (DEPTH_CONV NUM_DIV_CONV) o + REWRITE_RULE[GSYM IMP_IMP; min_exp_def];; + + +let FLOAT_SQRT_EVEN_lo' = transform FLOAT_SQRT_EVEN_lo and + FLOAT_SQRT_EVEN_hi' = transform FLOAT_SQRT_EVEN_hi and + FLOAT_PRE_EXP' = (UNDISCH_ALL o + PURE_ONCE_REWRITE_RULE[TAUT `~(e = _0) <=> ((e = _0) <=> F)`] o + REWRITE_RULE[GSYM IMP_IMP; NUMERAL]) FLOAT_PRE_EXP;; + + +let even_const = `EVEN` and + pre_const = `PRE` and + two_num = rand(mk_small_numeral_array 2) and + min_exp_div2 = rand(mk_small_numeral_array (min_exp / 2)) and + f2_var_num = `f2:num` and + f1_var_num = `f1:num` and + p_var_num = `p:num`;; + + +(* Returns the list of digits of the given Big_int n in the base b *) +let rec get_big_int_digits b n = + let bb = big_int_of_int b in + if le_big_int n zero_big_int then [] + else + let q, r = quomod_big_int n bb in + r :: get_big_int_digits b q;; + + +(* [1;2;3] -> 123 (base = 10) *) +let rec big_int_from_list b list = + let rec proc acc list = + match list with + [] -> acc + | h::t -> proc (add_big_int h (mult_int_big_int b acc)) t in + proc zero_big_int list;; + + +(* Returns n first elements of the list *) +let rec take n list = + match list with + x :: xs -> if n > 0 then x :: take (n - 1) xs else [] + | [] -> [];; + + + +(* Returns an integer number that contains at most pp "significant" digits + in the given base b *) +let big_int_round_lo base pp n = + let digits = rev (get_big_int_digits base n) in + let n_digits = length digits in + if n_digits <= pp then + n + else + let m = big_int_from_list base (take pp digits) in + mult_big_int (power_int_positive_int base (n_digits - pp)) m;; + + + +let big_int_round_hi base pp n = + let digits = rev (get_big_int_digits base n) in + let n_digits = length digits in + if n_digits <= pp then n + else + let l1, l2 = chop_list pp digits in + if forall (eq_big_int zero_big_int) l2 then n + else + let m = succ_big_int (big_int_from_list base l1) in + mult_big_int (power_int_positive_int base (n_digits - pp)) m;; + + + +(******************) + +let rec float_sqrt_lo pp tm = + let s, m_tm, e_tm = dest_float tm in + let p_tm = rand (mk_small_numeral_array pp) in + if s <> "F" then + failwith "float_sqrt_lo: negative argument" + else + let even_th = raw_even_hash_conv (mk_comb (even_const, e_tm)) in + if (fst o dest_const o rand o concl) even_th <> "T" then + (* ODD e *) + let pre_e = raw_pre_hash_conv (mk_comb (pre_const, e_tm)) in + let e_neq_0 = raw_eq0_hash_conv e_tm in + let e1_tm = rand (concl pre_e) in + let th0 = INST[e1_tm, e1_var_num; e_tm, e_var_num; m_tm, m_var_num] FLOAT_PRE_EXP' in + let th1 = MY_PROVE_HYP pre_e (MY_PROVE_HYP e_neq_0 th0) in + let th2 = float_sqrt_lo pp (rand(concl th1)) in + let ltm, rtm = dest_comb (concl th2) in + EQ_MP (SYM (AP_TERM ltm (AP_TERM (rator rtm) th1))) th2 + else + (* EVEN e *) + let p2_tm = mk_binop mul_op_num two_num p_tm in + let p2_th = raw_mul_conv_hash p2_tm in + let f1_1 = AP_TERM (mk_comb(num_exp_const, m_tm)) p2_th in + let f1_2 = TRANS f1_1 (denormalize (rand (concl f1_1))) in + + let x_tm = rand(concl f1_2) in + let x = raw_dest_hash x_tm in + let f1' = Big_int.sqrt_big_int (big_int_of_num x) in + let f1 = num_of_big_int (big_int_round_lo base pp f1') in + let f1_tm = rand(mk_numeral_array f1) in + let f1_num_exp = to_num_exp f1_tm in + + let n1_tm, e1_tm = dest_num_exp (rand (concl f1_num_exp)) in + let f1f1_eq_f2 = raw_mul_conv_hash (mk_binop mul_op_num f1_tm f1_tm) in + let f2_tm = rand(concl f1f1_eq_f2) in + let f2_le_x = EQT_ELIM (raw_le_hash_conv (mk_binop le_op_num f2_tm x_tm)) in + + let e_div2_eq_e2 = raw_div_hash_conv (mk_binop div_op_num e_tm two_num) in + let e2_tm = rand(concl e_div2_eq_e2) in + let r_th1 = raw_add_conv_hash (mk_binop plus_op_num e2_tm min_exp_div2) in + let r_th2 = AP_TERM (mk_comb(plus_op_num, e1_tm)) r_th1 in + let r_th = TRANS r_th2 (raw_add_conv_hash (rand (concl r_th2))) in + + let r_tm = rand(concl r_th) in + let r_sub_p, p_le_r = raw_sub_and_le_hash_conv p_tm r_tm in + let r2_tm = rand(concl r_sub_p) in + if (rand(concl p_le_r) <> r_tm) then + failwith "float_sqrt_lo: underflow" + else + let th0 = INST[f2_tm, f2_var_num; x_tm, x_var_num; p_tm, p_var_num; r_tm, r_var_num; + f1_tm, f1_var_num; n1_tm, n1_var_num; e1_tm, e1_var_num; e2_tm, e2_var_num; + e_tm, e_var_num; m_tm, m_var_num; r2_tm, r2_var_num] + FLOAT_SQRT_EVEN_lo' in + MY_PROVE_HYP f1_2 ( + MY_PROVE_HYP e_div2_eq_e2 ( + MY_PROVE_HYP r_sub_p ( + MY_PROVE_HYP r_th ( + MY_PROVE_HYP f1f1_eq_f2 ( + MY_PROVE_HYP f1_num_exp ( + MY_PROVE_HYP even_th ( + MY_PROVE_HYP f2_le_x ( + MY_PROVE_HYP p_le_r th0 + ))))))));; + + + + + +let rec float_sqrt_hi pp tm = + let s, m_tm, e_tm = dest_float tm in + let p_tm = rand (mk_small_numeral_array pp) in + if s <> "F" then + failwith "float_sqrt_lo: negative argument" + else + let even_th = raw_even_hash_conv (mk_comb (even_const, e_tm)) in + if (fst o dest_const o rand o concl) even_th <> "T" then + (* ODD e *) + let pre_e = raw_pre_hash_conv (mk_comb (pre_const, e_tm)) in + let e_neq_0 = raw_eq0_hash_conv e_tm in + let e1_tm = rand (concl pre_e) in + let th0 = INST[e1_tm, e1_var_num; e_tm, e_var_num; m_tm, m_var_num] FLOAT_PRE_EXP' in + let th1 = MY_PROVE_HYP pre_e (MY_PROVE_HYP e_neq_0 th0) in + let th2 = float_sqrt_hi pp (rand(concl th1)) in + let ltm, rtm = dest_comb (concl th2) in + let ltm2, rtm2 = dest_comb ltm in + let th3 = AP_THM (AP_TERM ltm2 (AP_TERM (rator rtm2) th1)) rtm in + EQ_MP (SYM th3) th2 + else + (* EVEN e *) + let p2_tm = mk_binop mul_op_num two_num p_tm in + let p2_th = raw_mul_conv_hash p2_tm in + let f1_1 = AP_TERM (mk_comb(num_exp_const, m_tm)) p2_th in + let f1_2 = TRANS f1_1 (denormalize (rand (concl f1_1))) in + + let x_tm = rand(concl f1_2) in + let x = raw_dest_hash x_tm in + let x' = big_int_of_num x in + let f1' = sqrt_big_int x' in + let f1 = (num_of_big_int o big_int_round_hi base pp) + (if eq_big_int (mult_big_int f1' f1') x' then f1' else succ_big_int f1') in + + let f1_tm = rand(mk_numeral_array f1) in + let f1_num_exp = to_num_exp f1_tm in + + let n1_tm, e1_tm = dest_num_exp (rand (concl f1_num_exp)) in + let f1f1_eq_f2 = raw_mul_conv_hash (mk_binop mul_op_num f1_tm f1_tm) in + let f2_tm = rand(concl f1f1_eq_f2) in + let x_le_f2 = EQT_ELIM (raw_le_hash_conv (mk_binop le_op_num x_tm f2_tm)) in + + let e_div2_eq_e2 = raw_div_hash_conv (mk_binop div_op_num e_tm two_num) in + let e2_tm = rand(concl e_div2_eq_e2) in + let r_th1 = raw_add_conv_hash (mk_binop plus_op_num e2_tm min_exp_div2) in + let r_th2 = AP_TERM (mk_comb(plus_op_num, e1_tm)) r_th1 in + let r_th = TRANS r_th2 (raw_add_conv_hash (rand (concl r_th2))) in + + let r_tm = rand(concl r_th) in + let r_sub_p, p_le_r = raw_sub_and_le_hash_conv p_tm r_tm in + let r2_tm = rand(concl r_sub_p) in + if (rand(concl p_le_r) <> r_tm) then + failwith "float_sqrt_lo: underflow" + else + let th0 = INST[f2_tm, f2_var_num; x_tm, x_var_num; p_tm, p_var_num; r_tm, r_var_num; + f1_tm, f1_var_num; n1_tm, n1_var_num; e1_tm, e1_var_num; e2_tm, e2_var_num; + e_tm, e_var_num; m_tm, m_var_num; r2_tm, r2_var_num] + FLOAT_SQRT_EVEN_hi' in + MY_PROVE_HYP f1_2 ( + MY_PROVE_HYP e_div2_eq_e2 ( + MY_PROVE_HYP r_sub_p ( + MY_PROVE_HYP r_th ( + MY_PROVE_HYP f1f1_eq_f2 ( + MY_PROVE_HYP f1_num_exp ( + MY_PROVE_HYP even_th ( + MY_PROVE_HYP x_le_f2 ( + MY_PROVE_HYP p_le_r th0 + ))))))));; + + + +(* +float_sqrt_lo 3 `float F (D2 _0) (D0 (D2 _0))`;; +float_sqrt_hi 3 `float F (D2 _0) (D0 (D2 _0))`;; + +let tm = `float F (D2 _0) (D0 (D2 _0))`;; +(* 10: 1.092 *) +test 1000 (float_sqrt_lo 5) tm;; +(* 10: 1.128 *) +test 1000 (float_sqrt_hi 5) tm;; +*) + + + +end;; (* Float_ops module *) + +(************************************) +(* Cached floating point operations *) +(************************************) + +(* Counters for collecting stats *) +let lt0_c = ref 0 and + gt0_c = ref 0 and + lt_c = ref 0 and + le0_c = ref 0 and + ge0_c = ref 0 and + le_c = ref 0 and + min_c = ref 0 and + max_c = ref 0 and + min_max_c = ref 0 and + mul_lo_c = ref 0 and + mul_hi_c = ref 0 and + div_lo_c = ref 0 and + div_hi_c = ref 0 and + add_lo_c = ref 0 and + add_hi_c = ref 0 and + sub_lo_c = ref 0 and + sub_hi_c = ref 0 and + sqrt_lo_c = ref 0 and + sqrt_hi_c = ref 0;; + +(* +let mul_lo_list = ref [] and + mul_hi_list = ref [] and + div_lo_list = ref [] and + div_hi_list = ref [] and + add_lo_list = ref [] and + add_hi_list = ref [] and + sub_lo_list = ref [] and + sub_hi_list = ref [];; +*) + +(* Hash tables *) +let cache_size = if Arith_options.cached then 10000 else 1;; +let max_cache_size = cache_size * 2;; + +let my_add h key v = + if Hashtbl.length h >= max_cache_size then + let _ = Hashtbl.clear h in + print_string "Clearing a float hash table" + else + (); + Hashtbl.add h key v;; + + +let mul_table = Hashtbl.create cache_size and + div_table = Hashtbl.create cache_size and + add_table = Hashtbl.create cache_size and + sub_table = Hashtbl.create cache_size and + sqrt_table = Hashtbl.create cache_size and + le_table = Hashtbl.create cache_size and + max_table = Hashtbl.create cache_size;; + +let reset_cache () = + Hashtbl.clear mul_table; + Hashtbl.clear div_table; + Hashtbl.clear add_table; + Hashtbl.clear sub_table; + Hashtbl.clear sqrt_table; + Hashtbl.clear le_table; + Hashtbl.clear max_table;; + +let reset_stat () = + lt0_c := 0; + gt0_c := 0; + lt_c := 0; + le0_c := 0; + ge0_c := 0; + le_c := 0; + min_c := 0; + max_c := 0; + min_max_c := 0; + mul_lo_c := 0; + mul_hi_c := 0; + div_lo_c := 0; + div_hi_c := 0; + add_lo_c := 0; + add_hi_c := 0; + sub_lo_c := 0; + sub_hi_c := 0; + sqrt_lo_c := 0; + sqrt_hi_c := 0;; + +let print_stat () = + let len = Hashtbl.length in + let cmp_str1 = sprintf "lt0 = %d\ngt0 = %d\nlt = %d\n" !lt0_c !gt0_c !lt_c and + cmp_str2 = sprintf "le0 = %d\nge0 = %d\n" !le0_c !ge0_c and + cmp_str3 = sprintf "min = %d\nmin_max = %d\n" !min_c !min_max_c and + le_str = sprintf "le = %d (le_hash = %d)\n" !le_c (len le_table) and + max_str = sprintf "max = %d (max_hash = %d)\n" !max_c (len max_table) and + mul_str = sprintf "mul_lo = %d, mul_hi = %d (mul_hash = %d)\n" !mul_lo_c !mul_hi_c (len mul_table) and + div_str = sprintf "div_lo = %d, div_hi = %d (div_hash = %d)\n" !div_lo_c !div_hi_c (len div_table) and + add_str = sprintf "add_lo = %d, add_hi = %d (add_hash = %d)\n" !add_lo_c !add_hi_c (len add_table) and + sub_str = sprintf "sub_lo = %d, sub_hi = %d (sub_hash = %d)\n" !sub_lo_c !sub_hi_c (len sub_table) and + sqrt_str = sprintf "sqrt_lo = %d, sqrt_hi = %d (sqrt_hash = %d)\n" !sqrt_lo_c !sqrt_hi_c (len sqrt_table) in + print_string (cmp_str1 ^ cmp_str2 ^ cmp_str3 ^ + le_str ^ max_str ^ mul_str ^ div_str ^ add_str ^ sub_str ^ sqrt_str);; + + +(* lt0 *) +let float_lt0 = + if float_cached then + fun tm -> + let _ = lt0_c := !lt0_c + 1 in + Float_ops.float_lt0 tm + else + Float_ops.float_lt0;; + +(* gt0 *) +let float_gt0 = + if float_cached then + fun tm -> + let _ = gt0_c := !gt0_c + 1 in + Float_ops.float_gt0 tm + else + Float_ops.float_gt0;; + +(* lt *) +let float_lt = + if float_cached then + fun tm1 tm2 -> + let _ = lt_c := !lt_c + 1 in + Float_ops.float_lt tm1 tm2 + else + Float_ops.float_lt;; + +(* le0 *) +let float_le0 = + if float_cached then + fun tm -> + let _ = le0_c := !le0_c + 1 in + Float_ops.float_le0 tm + else + Float_ops.float_le0;; + +(* ge0 *) +let float_ge0 = + if float_cached then + fun tm -> + let _ = ge0_c := !ge0_c + 1 in + Float_ops.float_ge0 tm + else + Float_ops.float_ge0;; + +(* min *) +let float_min = + if float_cached then + fun tm1 tm2 -> + let _ = min_c := !min_c + 1 in + Float_ops.float_min tm1 tm2 + else + Float_ops.float_min;; + +(* min_max *) +let float_min_max = + if float_cached then + fun tm1 tm2 -> + let _ = min_max_c := !min_max_c + 1 in + Float_ops.float_min_max tm1 tm2 + else + Float_ops.float_min_max;; + + +(***************) +let float_hash tm = + let s, n_tm, e_tm = dest_float tm in + s ^ (Arith_cache.num_tm_hash n_tm) ^ "e" ^ (Arith_cache.num_tm_hash e_tm);; + +let float_op_hash pp tm1 tm2 = + string_of_int pp ^ float_hash tm1 ^ "x" ^ float_hash tm2;; + +let float_op_hash1 pp tm = + string_of_int pp ^ float_hash tm;; + + +(* le *) +let float_le = + if float_cached then + fun tm1 tm2 -> + let _ = le_c := !le_c + 1 in + let hash = float_op_hash 0 tm1 tm2 in + try + Hashtbl.find le_table hash + with Not_found -> + let result = Float_ops.float_le tm1 tm2 in + let _ = my_add le_table hash result in + result + else + Float_ops.float_le;; + +(* max *) +let float_max = + if float_cached then + fun tm1 tm2 -> + let _ = max_c := !max_c + 1 in + let hash = float_op_hash 0 tm1 tm2 in + try + Hashtbl.find max_table hash + with Not_found -> + let result = Float_ops.float_max tm1 tm2 in + let _ = my_add max_table hash result in + result + else + Float_ops.float_max;; + +(* mul_eq *) +let float_mul_eq = Float_ops.float_mul_eq;; + +(* mul_lo *) +let float_mul_lo = + if float_cached then + fun pp tm1 tm2 -> + let _ = mul_lo_c := !mul_lo_c + 1 in +(* let _ = mul_lo_list := (pp,tm1,tm2) :: !mul_lo_list in *) + let hash = "lo" ^ float_op_hash pp tm1 tm2 in + try + Hashtbl.find mul_table hash + with Not_found -> + let result = Float_ops.float_mul_lo pp tm1 tm2 in + let _ = my_add mul_table hash result in + result + else + Float_ops.float_mul_lo;; + +(* mul_hi *) +let float_mul_hi = + if float_cached then + fun pp tm1 tm2 -> + let _ = mul_hi_c := !mul_hi_c + 1 in +(* let _ = mul_hi_list := (pp,tm1,tm2) :: !mul_hi_list in *) + let hash = "hi" ^ float_op_hash pp tm1 tm2 in + try + Hashtbl.find mul_table hash + with Not_found -> + let result = Float_ops.float_mul_hi pp tm1 tm2 in + let _ = my_add mul_table hash result in + result + else + Float_ops.float_mul_hi;; + +(* div_lo *) +let float_div_lo = + if float_cached then + fun pp tm1 tm2 -> + let _ = div_lo_c := !div_lo_c + 1 in +(* let _ = div_lo_list := (pp,tm1,tm2) :: !div_lo_list in *) + let hash = "lo" ^ float_op_hash pp tm1 tm2 in + try + Hashtbl.find div_table hash + with Not_found -> + let result = Float_ops.float_div_lo pp tm1 tm2 in + let _ = my_add div_table hash result in + result + else + Float_ops.float_div_lo;; + +(* div_hi *) +let float_div_hi = + if float_cached then + fun pp tm1 tm2 -> + let _ = div_hi_c := !div_hi_c + 1 in +(* let _ = div_hi_list := (pp,tm1,tm2) :: !div_hi_list in *) + let hash = "hi" ^ float_op_hash pp tm1 tm2 in + try + Hashtbl.find div_table hash + with Not_found -> + let result = Float_ops.float_div_hi pp tm1 tm2 in + let _ = my_add div_table hash result in + result + else + Float_ops.float_div_hi;; + +(* add_lo *) +let float_add_lo = + if float_cached then + fun pp tm1 tm2 -> + let _ = add_lo_c := !add_lo_c + 1 in +(* let _ = add_lo_list := (pp,tm1,tm2) :: !add_lo_list in *) + let hash = "lo" ^ float_op_hash pp tm1 tm2 in + try + Hashtbl.find add_table hash + with Not_found -> + let result = Float_ops.float_add_lo pp tm1 tm2 in + let _ = my_add add_table hash result in + result + else + Float_ops.float_add_lo;; + +(* add_hi *) +let float_add_hi = + if float_cached then + fun pp tm1 tm2 -> + let _ = add_hi_c := !add_hi_c + 1 in +(* let _ = add_hi_list := (pp,tm1,tm2) :: !add_hi_list in *) + let hash = "hi" ^ float_op_hash pp tm1 tm2 in + try + Hashtbl.find add_table hash + with Not_found -> + let result = Float_ops.float_add_hi pp tm1 tm2 in + let _ = my_add add_table hash result in + result + else + Float_ops.float_add_hi;; + +(* sub_lo *) +let float_sub_lo = + if float_cached then + fun pp tm1 tm2 -> + let _ = sub_lo_c := !sub_lo_c + 1 in +(* let _ = sub_lo_list := (pp,tm1,tm2) :: !sub_lo_list in *) + let hash = "lo" ^ float_op_hash pp tm1 tm2 in + try + Hashtbl.find sub_table hash + with Not_found -> + let result = Float_ops.float_sub_lo pp tm1 tm2 in + let _ = my_add sub_table hash result in + result + else + Float_ops.float_sub_lo;; + +(* sub_hi *) +let float_sub_hi = + if float_cached then + fun pp tm1 tm2 -> + let _ = sub_hi_c := !sub_hi_c + 1 in +(* let _ = sub_hi_list := (pp,tm1,tm2) :: !sub_hi_list in *) + let hash = "hi" ^ float_op_hash pp tm1 tm2 in + try + Hashtbl.find sub_table hash + with Not_found -> + let result = Float_ops.float_sub_hi pp tm1 tm2 in + let _ = my_add sub_table hash result in + result + else + Float_ops.float_sub_hi;; + + +(* sqrt_lo *) +let float_sqrt_lo = + if float_cached then + fun pp tm -> + let _ = sqrt_lo_c := !sqrt_lo_c + 1 in + let hash = "lo" ^ float_op_hash1 pp tm in + try + Hashtbl.find sqrt_table hash + with Not_found -> + let result = Float_ops.float_sqrt_lo pp tm in + let _ = my_add sqrt_table hash result in + result + else + Float_ops.float_sqrt_lo;; + +(* sqrt_hi *) +let float_sqrt_hi = + if float_cached then + fun pp tm -> + let _ = sqrt_hi_c := !sqrt_hi_c + 1 in + let hash = "hi" ^ float_op_hash1 pp tm in + try + Hashtbl.find sqrt_table hash + with Not_found -> + let result = Float_ops.float_sqrt_hi pp tm in + let _ = my_add sqrt_table hash result in + result + else + Float_ops.float_sqrt_hi;; + + + +(******************************************) + +(* float intervals *) + +let FLOAT_OF_NUM' = (SPEC_ALL o REWRITE_RULE[min_exp_def]) FLOAT_OF_NUM;; + +let FLOAT_INTERVAL_OF_NUM = (NUMERALS_TO_NUM o REWRITE_RULE[min_exp_def] o prove)(`interval_arith (&n) (float F n min_exp, float F n min_exp)`, + REWRITE_TAC[FLOAT_OF_NUM; CONST_INTERVAL]);; + +let FLOAT_F_bound' = (UNDISCH_ALL o SPEC_ALL) FLOAT_F_bound;; + +let FLOAT_T_bound' = (UNDISCH_ALL o SPEC_ALL) FLOAT_T_bound;; + + + + + + +(* interval_arith x (float s1 n1 e1, float s2 n2 e2) -> x, float s1 n1 e1, float s2 n2 e2 *) +let dest_float_interval tm = + let ltm, rtm = dest_comb tm in + let f1, f2 = dest_pair rtm in + rand ltm, f1, f2;; + + + + +let mk_float_interval_small_num n = + let n_tm0 = mk_small_numeral n in + let n_th = NUMERAL_TO_NUM_CONV n_tm0 in + let n_tm = rand(rand(concl n_th)) in + let n_th1 = TRANS n_th (INST[n_tm, n_var_num] NUM_REMOVE) in + let th1 = AP_TERM amp_op_real n_th1 in + let int_th = INST[n_tm, n_var_num] FLOAT_INTERVAL_OF_NUM in + let rtm = rand(concl int_th) in + EQ_MP (SYM (AP_THM (AP_TERM interval_const th1) rtm)) int_th;; + + +let mk_float_interval_num n = + let n_tm0 = mk_numeral n in + let n_th = NUMERAL_TO_NUM_CONV n_tm0 in + let n_tm = rand(rand(concl n_th)) in + let n_th1 = TRANS n_th (INST[n_tm, n_var_num] NUM_REMOVE) in + let th1 = AP_TERM amp_op_real n_th1 in + let int_th = INST[n_tm, n_var_num] FLOAT_INTERVAL_OF_NUM in + let rtm = rand(concl int_th) in + EQ_MP (SYM (AP_THM (AP_TERM interval_const th1) rtm)) int_th;; + + + + + + +(* Returns the lower bound for the given float *) +let float_lo p tm = + let s, n_tm, e_tm = dest_float tm in + if s = "F" then + let num_exp_tm = mk_num_exp n_tm e_tm in + let th0 = num_exp_lo p num_exp_tm in + let ltm, e1_tm = dest_comb(lhand(concl th0)) in + let n1_tm = rand ltm in + let th1 = INST[n1_tm, n1_var_num; e1_tm, e1_var_num; n_tm, n2_var_num; e_tm, e2_var_num] FLOAT_F_bound' in + MY_PROVE_HYP th0 th1 + else + let num_exp_tm = mk_num_exp n_tm e_tm in + let th0 = num_exp_hi p num_exp_tm in + let ltm, e1_tm = dest_comb(rand(concl th0)) in + let n1_tm = rand ltm in + let th1 = INST[n_tm, n1_var_num; e_tm, e1_var_num; n1_tm, n2_var_num; e1_tm, e2_var_num] FLOAT_T_bound' in + MY_PROVE_HYP th0 th1;; + + + +(* Returns the upper bound for the given float *) +let float_hi p tm = + let s, n_tm, e_tm = dest_float tm in + if s = "F" then + let num_exp_tm = mk_num_exp n_tm e_tm in + let th0 = num_exp_hi p num_exp_tm in + let ltm, e2_tm = dest_comb(rand(concl th0)) in + let n2_tm = rand ltm in + let th1 = INST[n_tm, n1_var_num; e_tm, e1_var_num; n2_tm, n2_var_num; e2_tm, e2_var_num] FLOAT_F_bound' in + MY_PROVE_HYP th0 th1 + else + let num_exp_tm = mk_num_exp n_tm e_tm in + let th0 = num_exp_lo p num_exp_tm in + let ltm, e1_tm = dest_comb(lhand(concl th0)) in + let n1_tm = rand ltm in + let th1 = INST[n1_tm, n1_var_num; e1_tm, e1_var_num; n_tm, n2_var_num; e_tm, e2_var_num] FLOAT_T_bound' in + MY_PROVE_HYP th0 th1;; + + + + + + +(* Approximates the given interval with p-digit float numbers *) +let float_interval_round p th = + let x_tm, f1, f2 = dest_float_interval (concl th) in + let lo_th = float_lo p f1 in + let hi_th = float_hi p f2 in + let lo_tm = lhand(concl lo_th) in + let hi_tm = rand(concl hi_th) in + let th0 = INST[x_tm, x_var_real; f1, lo_var_real; f2, hi_var_real; lo_tm, a_var_real; hi_tm, b_var_real] APPROX_INTERVAL' in + MY_PROVE_HYP lo_th (MY_PROVE_HYP hi_th (MY_PROVE_HYP th th0));; + + + + +(* +let th = mk_float_interval_num 124235353;; +float_interval_round 5 th;; +(* 4: 0.240 *) +test 1000 (float_interval_round 5) th;; +*) + + +(****************************************) + +(* float_interval_lt *) + +let FLOAT_INTERVAL_LT = prove(`interval_arith x (lo1, hi1) /\ interval_arith y (lo2, hi2) /\ hi1 < lo2 + ==> x < y`, + REWRITE_TAC[interval_arith] THEN + REAL_ARITH_TAC);; + + + +(****************************************) + +(* float_interval_neg *) + + +let FLOAT_INTERVAL_NEG = prove(`!s1 s2. interval_arith x (float s1 n1 e1, float s2 n2 e2) + ==> interval_arith (--x) (float (~s2) n2 e2, float (~s1) n1 e1)`, + REPEAT GEN_TAC THEN + DISCH_THEN (fun th -> MP_TAC (MATCH_MP INTERVAL_NEG th)) THEN + SIMP_TAC[FLOAT_NEG]);; + + +let FLOAT_INTERVAL_NEG_FF = (UNDISCH_ALL o REWRITE_RULE[] o SPECL[`F`; `F`]) FLOAT_INTERVAL_NEG;; +let FLOAT_INTERVAL_NEG_FT = (UNDISCH_ALL o REWRITE_RULE[] o SPECL[`F`; `T`]) FLOAT_INTERVAL_NEG;; +let FLOAT_INTERVAL_NEG_TF = (UNDISCH_ALL o REWRITE_RULE[] o SPECL[`T`; `F`]) FLOAT_INTERVAL_NEG;; +let FLOAT_INTERVAL_NEG_TT = (UNDISCH_ALL o REWRITE_RULE[] o SPECL[`T`; `T`]) FLOAT_INTERVAL_NEG;; + + + + + +(* |- interval x (float s1 n1 e1, float s2 n2 e2) -> + |- interval (--x) (float ~s2 n2 e2, float ~s1 n1 e1 *) +let float_interval_neg th = + let x_tm, f1, f2 = dest_float_interval (concl th) in + let s1, n1_tm, e1_tm = dest_float f1 in + let s2, n2_tm, e2_tm = dest_float f2 in + let inst = INST[x_tm, x_var_real; n1_tm, n1_var_num; e1_tm, e1_var_num; + n2_tm, n2_var_num; e2_tm, e2_var_num] in + let th0 = + if s1 = "F" then + if s2 = "F" then + inst FLOAT_INTERVAL_NEG_FF + else + inst FLOAT_INTERVAL_NEG_FT + else + if s2 = "F" then + inst FLOAT_INTERVAL_NEG_TF + else + inst FLOAT_INTERVAL_NEG_TT in + MY_PROVE_HYP th th0;; + + + +(***********************************************) + +(* float_interval_mul *) + + +let f1_var_real = `f1:real` and + f2_var_real = `f2:real` and + f1_1_var = `f1_1:real` and + f1_2_var = `f1_2:real` and + f2_1_var = `f2_1:real` and + f2_2_var = `f2_2:real`;; + + + +(* FF_FF *) +let FLOAT_INTERVAL_MUL_FF_FF = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (float F n1 e1, float F n2 e2) /\ + interval_arith y (float F m1 r1, float F m2 r2) /\ + f1 <= float F n1 e1 * float F m1 r1 /\ + float F n2 e2 * float F m2 r2 <= f2 + ==> interval_arith (x * y) (f1, f2)`, + MAP_EVERY ABBREV_TAC [`a = float F n1 e1`; `b = float F n2 e2`; `c = float F m1 r1`; `d = float F m2 r2`] THEN + SUBGOAL_THEN `&0 <= a /\ &0 <= b /\ &0 <= c /\ &0 <= d` MP_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["a"; "b"; "c"; "d"] THEN + REWRITE_TAC[FLOAT_F_POS]; + ALL_TAC + ] THEN + REPEAT (POP_ASSUM (fun th -> ALL_TAC)) THEN + REWRITE_TAC[interval_arith] THEN + REPEAT STRIP_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a * c:real` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `b * d:real` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THENL + [ + EXISTS_TAC `a:real` THEN ASM_REWRITE_TAC[]; + EXISTS_TAC `c:real` THEN ASM_REWRITE_TAC[] + ] + ]);; + + + +(* TT_TT *) +let FLOAT_INTERVAL_MUL_TT_TT = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (float T n1 e1, float T n2 e2) /\ + interval_arith y (float T m1 r1, float T m2 r2) /\ + f1 <= float T n2 e2 * float T m2 r2 /\ + float T n1 e1 * float T m1 r1 <= f2 + ==> interval_arith (x * y) (f1, f2)`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[interval_arith] THEN + MAP_EVERY ABBREV_TAC [`a = float F n1 e1`; `b = float F n2 e2`; `c = float F m1 r1`; `d = float F m2 r2`] THEN + SUBGOAL_THEN `&0 <= a /\ &0 <= b /\ &0 <= c /\ &0 <= d` MP_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["a"; "b"; "c"; "d"] THEN + REWRITE_TAC[FLOAT_F_POS]; + ALL_TAC + ] THEN + REWRITE_TAC[REAL_NEG_MUL2] THEN + REPEAT STRIP_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `b * d:real` THEN + ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[REAL_ARITH `a <= x * y <=> a <= --x * --y`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ONCE_REWRITE_TAC[REAL_ARITH `b <= --x <=> x <= --b`] THEN + ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a * c:real` THEN + ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[REAL_ARITH `x * y <= a <=> --x * --y <= a`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ONCE_REWRITE_TAC[REAL_ARITH `--x <= c <=> --c <= x`] THEN + ASM_REWRITE_TAC[] THEN + ASSUME_TAC (REAL_ARITH `!b x. &0 <= b /\ x <= --b ==> &0 <= --x`) THEN + CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THENL + [ + EXISTS_TAC `b:real` THEN ASM_REWRITE_TAC[]; + EXISTS_TAC `d:real` THEN ASM_REWRITE_TAC[] + ] + ]);; + + + +(* FF_TT *) +let FLOAT_INTERVAL_MUL_FF_TT = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (float F n1 e1, float F n2 e2) /\ + interval_arith y (float T m1 r1, float T m2 r2) /\ + f1 <= float F n2 e2 * float T m1 r1 /\ + float F n1 e1 * float T m2 r2 <= f2 + ==> interval_arith (x * y) (f1, f2)`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[interval_arith] THEN + MAP_EVERY ABBREV_TAC [`a = float F n1 e1`; `b = float F n2 e2`; `c = float F m1 r1`; `d = float F m2 r2`] THEN + SUBGOAL_THEN `&0 <= a /\ &0 <= b /\ &0 <= c /\ &0 <= d` MP_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["a"; "b"; "c"; "d"] THEN + REWRITE_TAC[FLOAT_F_POS]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `b * --c` THEN + ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[REAL_ARITH `b * --c <= x * y <=> x * --y <= b * c`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ONCE_REWRITE_TAC[REAL_ARITH `--y <= c <=> --c <= y`] THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THENL + [ + EXISTS_TAC `a:real` THEN ASM_REWRITE_TAC[]; + EXISTS_TAC `d:real` THEN + ONCE_REWRITE_TAC[REAL_ARITH `d <= --y <=> y <= --d`] THEN + ASM_REWRITE_TAC[] + ]; + + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a * --d` THEN + ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[REAL_ARITH `x * y <= a * --d <=> a * d <= x * --y`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ONCE_REWRITE_TAC[REAL_ARITH `d <= --y <=> y <= --d`] THEN + ASM_REWRITE_TAC[] + ]);; + + +(* TT_FF *) +let FLOAT_INTERVAL_MUL_TT_FF = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (float T n1 e1, float T n2 e2) /\ + interval_arith y (float F m1 r1, float F m2 r2) /\ + f1 <= float T n1 e1 * float F m2 r2 /\ + float T n2 e2 * float F m1 r1 <= f2 + ==> interval_arith (x * y) (f1, f2)`, + STRIP_TAC THEN + MP_TAC ((GEN_ALL o DISCH_ALL) FLOAT_INTERVAL_MUL_FF_TT) THEN + DISCH_THEN (MP_TAC o SPECL[`n1:num`; `e1:num`; `n2:num`; `e2:num`; `m1:num`; `r1:num`; `m2:num`; `r2:num`]) THEN + DISCH_THEN (MP_TAC o SPECL[`y:real`; `x:real`; `f1:real`; `f2:real`]) THEN + REPEAT (POP_ASSUM MP_TAC) THEN + SIMP_TAC[REAL_MUL_AC]);; + + + +(* TF_FF *) +let FLOAT_INTERVAL_MUL_TF_FF = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (float T n1 e1, float F n2 e2) /\ + interval_arith y (float F m1 r1, float F m2 r2) /\ + f1 <= float T n1 e1 * float F m2 r2 /\ + float F n2 e2 * float F m2 r2 <= f2 + ==> interval_arith (x * y) (f1, f2)`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[interval_arith] THEN + MAP_EVERY ABBREV_TAC [`a = float F n1 e1`; `b = float F n2 e2`; `c = float F m1 r1`; `d = float F m2 r2`] THEN + STRIP_TAC THEN + SUBGOAL_THEN `&0 <= a /\ &0 <= b /\ &0 <= c /\ &0 <= d` ASSUME_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["a"; "b"; "c"; "d"] THEN + REWRITE_TAC[FLOAT_F_POS]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `&0 <= y` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `c:real` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + DISJ_CASES_TAC (REAL_ARITH `&0 <= x \/ &0 <= --x`) THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `--a * d` THEN + ASM_REWRITE_TAC[REAL_ARITH `--a * d <= &0 <=> &0 <= a * d`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[] + ]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `--a * d` THEN ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[REAL_ARITH `--a * d <= x * y <=> --x * y <= a * d`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ONCE_REWRITE_TAC[REAL_ARITH `--x <= a <=> --a <= x`] THEN ASM_REWRITE_TAC[]; + + DISJ_CASES_TAC (REAL_ARITH `&0 <= --x \/ &0 <= x`) THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + CONJ_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `x * y <= &0 <=> &0 <= --x * y`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b * d` THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[] + ]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b * d` THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN ASM_REWRITE_TAC[] + ]);; + + +(* TF_TT *) +let FLOAT_INTERVAL_MUL_TF_TT = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (float T n1 e1, float F n2 e2) /\ + interval_arith y (float T m1 r1, float T m2 r2) /\ + f1 <= float F n2 e2 * float T m1 r1 /\ + float T n1 e1 * float T m1 r1 <= f2 + ==> interval_arith (x * y) (f1, f2)`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[interval_arith] THEN + MAP_EVERY ABBREV_TAC [`a = float F n1 e1`; `b = float F n2 e2`; `c = float F m1 r1`; `d = float F m2 r2`] THEN + STRIP_TAC THEN + SUBGOAL_THEN `&0 <= a /\ &0 <= b /\ &0 <= c /\ &0 <= d` ASSUME_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["a"; "b"; "c"; "d"] THEN + REWRITE_TAC[FLOAT_F_POS]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `&0 <= --y` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `d:real` THEN + ONCE_REWRITE_TAC[REAL_ARITH `d <= --y <=> y <= --d`] THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + DISJ_CASES_TAC (REAL_ARITH `&0 <= --x \/ &0 <= x`) THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b * --c` THEN + ASM_REWRITE_TAC[REAL_ARITH `b * --c <= &0 <=> &0 <= b * c`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[REAL_ARITH `x * y = --x * --y`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[] + ]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b * --c` THEN ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[REAL_ARITH `b * --c <= x * y <=> x * --y <= b * c`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN ONCE_REWRITE_TAC[REAL_ARITH `--y <= c <=> --c <= y`] THEN + ASM_REWRITE_TAC[]; + + DISJ_CASES_TAC (REAL_ARITH `&0 <= x \/ &0 <= --x`) THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + CONJ_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `x * y <= &0 <=> &0 <= x * --y`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `--a * --c` THEN ASM_REWRITE_TAC[REAL_NEG_MUL2] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[] + ]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `--a * --c` THEN ASM_REWRITE_TAC[REAL_NEG_MUL2] THEN + ONCE_REWRITE_TAC[REAL_ARITH `x * y <= a * c <=> --x * --y <= a * c`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN ONCE_REWRITE_TAC[REAL_ARITH `--x <= a <=> --a <= x`] THEN + ASM_REWRITE_TAC[] + ]);; + +(* FF_TF *) +let FLOAT_INTERVAL_MUL_FF_TF = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (float F n1 e1, float F n2 e2) /\ + interval_arith y (float T m1 r1, float F m2 r2) /\ + f1 <= float F n2 e2 * float T m1 r1 /\ + float F n2 e2 * float F m2 r2 <= f2 + ==> interval_arith (x * y) (f1, f2)`, + STRIP_TAC THEN + MP_TAC ((SPECL [`n1:num`; `e1:num`; `n2:num`; `e2:num`; `m1:num`; `r1:num`; `m2:num`; `r2:num`; `y:real`; `x:real`; `f1:real`; `f2:real`] o GEN_ALL o DISCH_ALL) FLOAT_INTERVAL_MUL_TF_FF) THEN + ASM_REWRITE_TAC[REAL_MUL_SYM] THEN DISCH_THEN MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC);; + +(* TT_TF *) +let FLOAT_INTERVAL_MUL_TT_TF = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (float T n1 e1, float T n2 e2) /\ + interval_arith y (float T m1 r1, float F m2 r2) /\ + f1 <= float T n1 e1 * float F m2 r2 /\ + float T n1 e1 * float T m1 r1 <= f2 + ==> interval_arith (x * y) (f1, f2)`, + STRIP_TAC THEN + MP_TAC ((SPECL [`n1:num`; `e1:num`; `n2:num`; `e2:num`; `m1:num`; `r1:num`; `m2:num`; `r2:num`; `y:real`; `x:real`; `f1:real`; `f2:real`] o GEN_ALL o DISCH_ALL) FLOAT_INTERVAL_MUL_TF_TT) THEN + ASM_REWRITE_TAC[REAL_MUL_SYM] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[REAL_MUL_SYM]);; + + +(* TF_TF *) +let FLOAT_INTERVAL_MUL_TF_TF = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (float T n1 e1, float F n2 e2) /\ + interval_arith y (float T m1 r1, float F m2 r2) /\ + f1_1 <= float T n1 e1 * float F m2 r2 /\ + f1_2 <= float F n2 e2 * float T m1 r1 /\ + min f1_1 f1_2 = f1 /\ + float T n1 e1 * float T m1 r1 <= f2_1 /\ + float F n2 e2 * float F m2 r2 <= f2_2 /\ + max f2_1 f2_2 = f2 + ==> interval_arith (x * y) (f1, f2)`, + REWRITE_TAC[EQ_SYM_EQ; FLOAT_NEG_T] THEN + REWRITE_TAC[interval_arith] THEN + MAP_EVERY ABBREV_TAC [`a = float F n1 e1`; `b = float F n2 e2`; `c = float F m1 r1`; `d = float F m2 r2`] THEN + STRIP_TAC THEN + SUBGOAL_THEN `&0 <= a /\ &0 <= b /\ &0 <= c /\ &0 <= d` ASSUME_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["a"; "b"; "c"; "d"] THEN + REWRITE_TAC[FLOAT_F_POS]; + ALL_TAC + ] THEN + + DISJ_CASES_TAC (REAL_ARITH `&0 <= x \/ &0 <= --x`) THENL + [ + DISJ_CASES_TAC (REAL_ARITH `&0 <= y \/ &0 <= --y`) THENL + [ + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `f1_1:real` THEN + ASM_REWRITE_TAC[REAL_MIN_MIN] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `--a * d` THEN + ASM_REWRITE_TAC[REAL_ARITH `--a * d <= &0 <=> &0 <= a * d`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b * d` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_MUL2 THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `f2_2:real` THEN + ASM_REWRITE_TAC[REAL_MAX_MAX]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `f1_2:real` THEN + ASM_REWRITE_TAC[REAL_MIN_MIN] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b * --c` THEN + ONCE_REWRITE_TAC[REAL_ARITH `b * --c <= x * y <=> x * --y <= b * c`] THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN ONCE_REWRITE_TAC[REAL_ARITH `--y <= c <=> --c <= y`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + CONJ_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `x * y <= &0 <=> &0 <= x * --y`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `f2_2:real` THEN + ASM_REWRITE_TAC[REAL_MAX_MAX] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b * d` THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISJ_CASES_TAC (REAL_ARITH `&0 <= y \/ &0 <= --y`) THENL + [ + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `f1_1:real` THEN + ASM_REWRITE_TAC[REAL_MIN_MIN] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `--a * d` THEN + ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[REAL_ARITH `--a * d <= x * y <=> --x * y <= a * d`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN ONCE_REWRITE_TAC[REAL_ARITH `--x <= a <=> --a <= x`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + CONJ_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `x * y <= &0 <=> &0 <= --x * y`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `f2_2:real` THEN + ASM_REWRITE_TAC[REAL_MAX_MAX] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b * d` THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `f1_1:real` THEN + ASM_REWRITE_TAC[REAL_MIN_MIN] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `--a * d` THEN + ASM_REWRITE_TAC[REAL_ARITH `--a * d <= &0 <=> &0 <= a * d`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ONCE_REWRITE_TAC[GSYM REAL_NEG_MUL2] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `--a * --c` THEN + CONJ_TAC THENL + [ + ONCE_REWRITE_TAC[GSYM REAL_NEG_MUL2] THEN REWRITE_TAC[REAL_NEG_NEG] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN ONCE_REWRITE_TAC[REAL_ARITH `--x <= a <=> --a <= x`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `f2_1:real` THEN + ASM_REWRITE_TAC[REAL_MAX_MAX]);; + + +(****************************) + +let float_interval_mul pp th1 th2 = + let x, l_lo, l_hi = dest_float_interval (concl th1) and + y, r_lo, r_hi = dest_float_interval (concl th2) in + let s1, n1, e1 = dest_float l_lo and + s2, n2, e2 = dest_float l_hi and + s3, m1, r1 = dest_float r_lo and + s4, m2, r2 = dest_float r_hi in + + (* Special case *) + if s1 <> s2 && s3 <> s4 then + if s1 = "F" or s3 = "F" then + failwith ("float_interval_mul: FT interval: "^ + (string_of_term (concl th1))^"; "^(string_of_term (concl th2))) + else + let lo1, lo2 = float_mul_lo pp l_lo r_hi, float_mul_lo pp l_hi r_lo and + hi1, hi2 = float_mul_hi pp l_lo r_lo, float_mul_hi pp l_hi r_hi in + let f1_1 = (lhand o concl) lo1 and + f1_2 = (lhand o concl) lo2 and + f2_1 = (rand o concl) hi1 and + f2_2 = (rand o concl) hi2 in + let min_th = float_min f1_1 f1_2 and + max_th = float_max f2_1 f2_2 in + let f1_tm = (rand o concl) min_th and + f2_tm = (rand o concl) max_th in + let th0 = INST[x, x_var_real; n1, n1_var_num; e1, e1_var_num; + y, y_var_real; n2, n2_var_num; e2, e2_var_num; + m1, m1_var_num; r1, r1_var_num; + m2, m2_var_num; r2, r2_var_num; + f1_tm, f1_var_real; f2_tm, f2_var_real; + f1_1, f1_1_var; f1_2, f1_2_var; + f2_1, f2_1_var; f2_2, f2_2_var] FLOAT_INTERVAL_MUL_TF_TF in + (MY_PROVE_HYP min_th o MY_PROVE_HYP max_th o MY_PROVE_HYP lo1 o MY_PROVE_HYP lo2 o + MY_PROVE_HYP hi1 o MY_PROVE_HYP hi2 o MY_PROVE_HYP th1 o MY_PROVE_HYP th2) th0 + else + let lo_th, hi_th, th0 = + if s1 <> s2 then + if s1 = "F" then + failwith ("float_interval_mul: FT interval: "^ + (string_of_term (concl th1))^"; "^(string_of_term (concl th2))) + else + if s3 = "F" then + float_mul_lo pp l_lo r_hi, float_mul_hi pp l_hi r_hi, FLOAT_INTERVAL_MUL_TF_FF + else + float_mul_lo pp l_hi r_lo, float_mul_hi pp l_lo r_lo, FLOAT_INTERVAL_MUL_TF_TT + else + if s3 <> s4 then + if s3 = "F" then + failwith ("float_interval_mul: FT interval: "^ + (string_of_term (concl th1))^"; "^(string_of_term (concl th2))) + else + if s1 = "F" then + float_mul_lo pp l_hi r_lo, float_mul_hi pp l_hi r_hi, FLOAT_INTERVAL_MUL_FF_TF + else + float_mul_lo pp l_lo r_hi, float_mul_hi pp l_lo r_lo, FLOAT_INTERVAL_MUL_TT_TF + else + if s1 = "F" then + if s3 = "F" then + float_mul_lo pp l_lo r_lo, float_mul_hi pp l_hi r_hi, FLOAT_INTERVAL_MUL_FF_FF + else + float_mul_lo pp l_hi r_lo, float_mul_hi pp l_lo r_hi, FLOAT_INTERVAL_MUL_FF_TT + else + if s3 = "F" then + float_mul_lo pp l_lo r_hi, float_mul_hi pp l_hi r_lo, FLOAT_INTERVAL_MUL_TT_FF + else + float_mul_lo pp l_hi r_hi, float_mul_hi pp l_lo r_lo, FLOAT_INTERVAL_MUL_TT_TT in + + let f1_tm = lhand(concl lo_th) and + f2_tm = rand(concl hi_th) in + + let th = INST[x, x_var_real; n1, n1_var_num; e1, e1_var_num; + y, y_var_real; n2, n2_var_num; e2, e2_var_num; + m1, m1_var_num; r1, r1_var_num; + m2, m2_var_num; r2, r2_var_num; + f1_tm, f1_var_real; f2_tm, f2_var_real] th0 in + MY_PROVE_HYP lo_th (MY_PROVE_HYP hi_th (MY_PROVE_HYP th1 (MY_PROVE_HYP th2 th)));; + + + +let float_interval_mul_old pp th1 th2 = + let x, l_lo, l_hi = dest_float_interval (concl th1) and + y, r_lo, r_hi = dest_float_interval (concl th2) in + let s1, n1, e1 = dest_float l_lo and + s2, n2, e2 = dest_float l_hi and + s3, m1, r1 = dest_float r_lo and + s4, m2, r2 = dest_float r_hi in + + (* Special case *) + if s1 <> s2 or s3 <> s4 then + failwith "float_interval_mul: not implemented" + else + let lo_th, hi_th, th0 = + if s1 = "F" then + if s3 = "F" then + float_mul_lo pp l_lo r_lo, float_mul_hi pp l_hi r_hi, FLOAT_INTERVAL_MUL_FF_FF + else + float_mul_lo pp l_hi r_lo, float_mul_hi pp l_lo r_hi, FLOAT_INTERVAL_MUL_FF_TT + else + if s3 = "F" then + float_mul_lo pp l_lo r_hi, float_mul_hi pp l_hi r_lo, FLOAT_INTERVAL_MUL_TT_FF + else + float_mul_lo pp l_hi r_hi, float_mul_hi pp l_lo r_lo, FLOAT_INTERVAL_MUL_TT_TT in + + let f1_tm = lhand(concl lo_th) and + f2_tm = rand(concl hi_th) in + + let th = INST[x, x_var_real; n1, n1_var_num; e1, e1_var_num; + y, y_var_real; n2, n2_var_num; e2, e2_var_num; + m1, m1_var_num; r1, r1_var_num; + m2, m2_var_num; r2, r2_var_num; + f1_tm, f1_var_real; f2_tm, f2_var_real] th0 in + MY_PROVE_HYP lo_th (MY_PROVE_HYP hi_th (MY_PROVE_HYP th1 (MY_PROVE_HYP th2 th)));; + + + + +(* +let th1 = mk_float_interval_small_num 135;; +let th2 = mk_float_interval_small_num 34;; +let th1' = float_interval_neg th1;; +let th2' = float_interval_neg th2;; + +float_interval_mul_old 2 th1 th2;; +float_interval_mul_old 2 th1 th2';; +float_interval_mul_old 2 th1' th2;; +float_interval_mul_old 2 th1' th2';; + +float_interval_mul 2 th1 th2;; +float_interval_mul 2 th1 th2';; +float_interval_mul 2 th1' th2;; +float_interval_mul 2 th1' th2';; + +let th3 = (NUMERALS_TO_NUM o REWRITE_RULE[FLOAT_OF_NUM; min_exp_def; GSYM FLOAT_NEG_T] o prove) + (`interval_arith (&0) (-- &5, &10)`, REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; +let th4 = (NUMERALS_TO_NUM o REWRITE_RULE[FLOAT_OF_NUM; min_exp_def; GSYM FLOAT_NEG_T] o prove) + (`interval_arith (&0) (-- &10, &5)`, REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; + +float_interval_mul_old 2 th3 th1;; +float_interval_mul 2 th3 th1;; +float_interval_mul 2 th1 th3;; +float_interval_mul 2 th3 th1';; +float_interval_mul 2 th1' th3;; +float_interval_mul 2 th3 th3;; +float_interval_mul 2 th3 th4;; + + +(* 10: 0.708 *) +test 1000 (float_interval_mul_old 2 th1) th2;; +(* 10: 0.712 *) +test 1000 (float_interval_mul 2 th1) th2;; + +(* 10: 0.504 *) +test 1000 (float_interval_mul 2 th3) th2;; +(* 10: 1.096 *) +test 1000 (float_interval_mul 2 th3) th4;; + + +let th1 = mk_float_interval_small_num 123456781;; +let th2 = mk_float_interval_small_num 514553443;; +(* 4: 0.340 *) +test 100 (float_interval_mul_old 5 th1) th2;; +(* 4: 0.368 *) +test 100 (float_interval_mul_old 1 th1) th2;; + + +let tm1 = mk_small_numeral_array 123456781;; +let tm2 = mk_small_numeral_array 514553443;; +let tm = mk_binop mul_op_num tm1 tm2;; + +(* 4: 0.148 *) +test 100 NUM_MULT_HASH_CONV tm;; + + +let th1' = float_interval_round 5 th1;; +let th2' = float_interval_round 5 th2;; + +(* 4: 0.176 *) +test 100 (float_interval_mul_old 5 th1') th2';; +*) + + +(*************************************) + +(* float_interval_div *) + +(* FF_FF *) +let FLOAT_INTERVAL_DIV_FF_FF = prove( + `~(m1 = 0) /\ + interval_arith x (float F n1 e1, float F n2 e2) /\ + interval_arith y (float F m1 r1, float F m2 r2) /\ + f1 <= float F n1 e1 / float F m2 r2 /\ + float F n2 e2 / float F m1 r1 <= f2 + ==> interval_arith (x / y) (f1, f2)`, + MAP_EVERY ABBREV_TAC [`a = float F n1 e1`; `b = float F n2 e2`; `c = float F m1 r1`; `d = float F m2 r2`] THEN + REWRITE_TAC[real_div] THEN + STRIP_TAC THEN + SUBGOAL_THEN `&0 <= a /\ &0 <= b /\ &0 <= c /\ &0 <= d` MP_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["a"; "b"; "c"; "d"] THEN + REWRITE_TAC[FLOAT_F_POS]; + ALL_TAC + ] THEN + SUBGOAL_THEN `~(c = &0)` ASSUME_TAC THENL + [ + EXPAND_TAC "c" THEN ASM_REWRITE_TAC[FLOAT_EQ_0]; + ALL_TAC + ] THEN + STRIP_TAC THEN + SUBGOAL_THEN `~(d = &0)` MP_TAC THENL + [ + MATCH_MP_TAC (REAL_ARITH `~(c = &0) /\ &0 <= c /\ c <= d ==> ~(d = &0)`) THEN + ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `interval_arith y (c,d)` THEN + REWRITE_TAC[interval_arith] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + REPLICATE_TAC 10 (POP_ASSUM MP_TAC) THEN + REPEAT (POP_ASSUM (fun th -> ALL_TAC)) THEN + REWRITE_TAC[interval_arith] THEN + REPEAT STRIP_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a * inv d` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[REAL_LE_INV_EQ] THEN + MATCH_MP_TAC REAL_LE_INV2 THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LTE_TRANS THEN + EXISTS_TAC `c:real` THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < c <=> ~(c = &0) /\ &0 <= c`]; + + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `b * inv c` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[REAL_LE_INV_EQ] THEN + REPEAT CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a:real` THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `c:real` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_INV2 THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < c <=> ~(c = &0) /\ &0 <= c`] + ]);; + + +(* TT_TT *) +let FLOAT_INTERVAL_DIV_TT_TT = prove( + `~(m2 = 0) /\ + interval_arith x (float T n1 e1, float T n2 e2) /\ + interval_arith y (float T m1 r1, float T m2 r2) /\ + f1 <= float T n2 e2 / float T m1 r1 /\ + float T n1 e1 / float T m2 r2 <= f2 + ==> interval_arith (x / y) (f1,f2)`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[real_div; REAL_INV_NEG; REAL_NEG_MUL2] THEN + GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV)[interval_arith] THEN + REWRITE_TAC[REAL_ARITH `--a <= x /\ x <= --b <=> b <= --x /\ --x <= a`] THEN + GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV)[GSYM interval_arith] THEN + STRIP_TAC THEN + MP_TAC ((SPECL[`n2:num`; `e2:num`; `m1:num`; `r1:num`; `n1:num`; `e1:num`; `m2:num`; `r2:num`; `--x`; `--y`] o GEN_ALL) FLOAT_INTERVAL_DIV_FF_FF) THEN + REWRITE_TAC[real_div; REAL_INV_NEG; REAL_NEG_MUL2] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]);; + + +(* FF_TT *) +let FLOAT_INTERVAL_DIV_FF_TT = prove( + `~(m2 = 0) /\ + interval_arith x (float F n1 e1, float F n2 e2) /\ + interval_arith y (float T m1 r1, float T m2 r2) /\ + f1 <= float F n2 e2 / float T m2 r2 /\ + float F n1 e1 / float T m1 r1 <= f2 + ==> interval_arith (x / y) (f1,f2)`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[real_div; REAL_INV_NEG] THEN + REWRITE_TAC[REAL_ARITH `a * --b <= c <=> --c <= a * b`] THEN + REWRITE_TAC[REAL_ARITH `c <= a * --b <=> a * b <= --c`] THEN + GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV)[interval_arith] THEN + REWRITE_TAC[REAL_ARITH `--a <= x /\ x <= --b <=> b <= --x /\ --x <= a`] THEN + GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV)[GSYM interval_arith] THEN + STRIP_TAC THEN + MP_TAC ((SPECL[`n1:num`; `e1:num`; `m1:num`; `r1:num`; `n2:num`; `e2:num`; `m2:num`; `r2:num`; `x:real`; `--y`; `--f2`; `--f1`] o GEN_ALL) FLOAT_INTERVAL_DIV_FF_FF) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[real_div]; + ALL_TAC + ] THEN + REWRITE_TAC[real_div; REAL_INV_NEG; interval_arith] THEN + REAL_ARITH_TAC);; + + +(* TT_FF *) +let FLOAT_INTERVAL_DIV_TT_FF = prove( + `~(m1 = 0) /\ + interval_arith x (float T n1 e1, float T n2 e2) /\ + interval_arith y (float F m1 r1, float F m2 r2) /\ + f1 <= float T n1 e1 / float F m1 r1 /\ + float T n2 e2 / float F m2 r2 <= f2 + ==> interval_arith (x / y) (f1,f2)`, + REWRITE_TAC[FLOAT_NEG_T] THEN + REWRITE_TAC[real_div; REAL_INV_NEG] THEN + REWRITE_TAC[REAL_ARITH `--a * b <= c <=> --c <= a * b`] THEN + REWRITE_TAC[REAL_ARITH `c <= --a * b <=> a * b <= --c`] THEN + GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV)[interval_arith] THEN + REWRITE_TAC[REAL_ARITH `--a <= x /\ x <= --b <=> b <= --x /\ --x <= a`] THEN + GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV)[GSYM interval_arith] THEN + STRIP_TAC THEN + MP_TAC ((SPECL[`n2:num`; `e2:num`; `m2:num`; `r2:num`; `n1:num`; `e1:num`; `m1:num`; `r1:num`; `--x:real`; `y:real`; `--f2`; `--f1`] o GEN_ALL) FLOAT_INTERVAL_DIV_FF_FF) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[real_div]; + ALL_TAC + ] THEN + REWRITE_TAC[real_div; REAL_INV_NEG; interval_arith] THEN + REAL_ARITH_TAC);; + + +let FLOAT_0 = prove(`!s e. float s 0 e = &0`, REWRITE_TAC[FLOAT_EQ_0]);; + + +(* TF_FF *) +let FLOAT_INTERVAL_DIV_TF_FF = prove( + `~(m1 = 0) /\ + interval_arith x (float T n1 e1, float F n2 e2) /\ + interval_arith y (float F m1 r1, float F m2 r2) /\ + f1 <= float T n1 e1 / float F m1 r1 /\ + float F n2 e2 / float F m1 r1 <= f2 + ==> interval_arith (x / y) (f1,f2)`, + REWRITE_TAC[FLOAT_NEG_T] THEN STRIP_TAC THEN + MAP_EVERY ABBREV_TAC [`a = float F n1 e1`; `b = float F n2 e2`; `c = float F m1 r1`; `d = float F m2 r2`] THEN + SUBGOAL_THEN `&0 <= a /\ &0 <= b /\ &0 <= c /\ &0 <= d` ASSUME_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["a"; "b"; "c"; "d"] THEN REWRITE_TAC[FLOAT_F_POS]; + ALL_TAC + ] THEN + + DISJ_CASES_TAC (REAL_ARITH `&0 <= x \/ x <= &0`) THENL + [ + SUBGOAL_THEN `interval_arith x (float F 0 0, b)` ASSUME_TAC THENL + [ + UNDISCH_TAC `interval_arith x (--a, b)` THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[interval_arith; FLOAT_0] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + MP_TAC ((SPEC_ALL o SPECL [`0`; `0`] o GEN_ALL) FLOAT_INTERVAL_DIV_FF_FF) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN MATCH_MP_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + REWRITE_TAC[real_div] THEN CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `--a / c` THEN + ASM_REWRITE_TAC[real_div; ARITH_RULE `--a * b <= &0 <=> &0 <= a * b`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[REAL_LE_INV_EQ]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[REAL_LE_INV_EQ; FLOAT_F_POS]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `interval_arith x (--a, float T 0 0)` ASSUME_TAC THENL + [ + UNDISCH_TAC `interval_arith x (--a, b)` THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[interval_arith; FLOAT_0] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + MP_TAC ((INST[`0`, `n2:num`; `0`, `e2:num`]) FLOAT_INTERVAL_DIV_TT_FF) THEN + ASM_REWRITE_TAC[FLOAT_NEG_T] THEN DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[GSYM FLOAT_NEG_T] THEN MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + REWRITE_TAC[real_div] THEN CONJ_TAC THENL + [ + REWRITE_TAC[FLOAT_0; REAL_MUL_LZERO; REAL_LE_REFL]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b / c` THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_DIV THEN ASM_REWRITE_TAC[]);; + + +(* TF_TT *) +let FLOAT_INTERVAL_DIV_TF_TT = prove( + `~(m2 = 0) /\ + interval_arith x (float T n1 e1, float F n2 e2) /\ + interval_arith y (float T m1 r1, float T m2 r2) /\ + f1 <= float F n2 e2 / float T m2 r2 /\ + float T n1 e1 / float T m2 r2 <= f2 + ==> interval_arith (x / y) (f1,f2)`, + REWRITE_TAC[FLOAT_NEG_T] THEN STRIP_TAC THEN + MAP_EVERY ABBREV_TAC [`a = float F n1 e1`; `b = float F n2 e2`; `c = float F m1 r1`; `d = float F m2 r2`] THEN + SUBGOAL_THEN `&0 <= a /\ &0 <= b /\ &0 <= c /\ &0 <= d` ASSUME_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["a"; "b"; "c"; "d"] THEN REWRITE_TAC[FLOAT_F_POS]; + ALL_TAC + ] THEN + + DISJ_CASES_TAC (REAL_ARITH `x <= &0 \/ &0 <= x`) THENL + [ + SUBGOAL_THEN `interval_arith x (--a, float T 0 0)` ASSUME_TAC THENL + [ + UNDISCH_TAC `interval_arith x (--a, b)` THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[interval_arith; FLOAT_0] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + MP_TAC ((SPEC_ALL o SPECL [`0`; `0`] o GEN_ALL) FLOAT_INTERVAL_DIV_TT_TT) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN MATCH_MP_TAC THEN ASM_REWRITE_TAC[FLOAT_NEG_T] THEN + ASM_REWRITE_TAC[GSYM FLOAT_NEG_T] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + REWRITE_TAC[real_div] THEN CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b / --d` THEN + ASM_REWRITE_TAC[real_div; REAL_INV_NEG; REAL_ARITH `b * --d <= &0 <=> &0 <= b * d`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[REAL_LE_INV_EQ]; + ALL_TAC + ] THEN + + REWRITE_TAC[FLOAT_0; REAL_MUL_LZERO; REAL_LE_REFL]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `interval_arith x (float F 0 0, b)` ASSUME_TAC THENL + [ + UNDISCH_TAC `interval_arith x (--a, b)` THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[interval_arith; FLOAT_0] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + MP_TAC ((INST[`0`, `n1:num`; `0`, `e1:num`]) FLOAT_INTERVAL_DIV_FF_TT) THEN + ASM_REWRITE_TAC[FLOAT_NEG_T] THEN DISCH_THEN MATCH_MP_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&0` THEN + REWRITE_TAC[real_div] THEN CONJ_TAC THENL + [ + REWRITE_TAC[FLOAT_0; REAL_MUL_LZERO; REAL_LE_REFL]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `--a / --d` THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[real_div; REAL_INV_NEG; REAL_NEG_MUL2] THEN MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[REAL_LE_INV_EQ]);; + + + + +let transform = UNDISCH_ALL o + PURE_REWRITE_RULE[TAUT `~P <=> (P <=> F)`] o + REWRITE_RULE[GSYM IMP_IMP] o + NUMERALS_TO_NUM;; + + +let FLOAT_INTERVAL_DIV_FF_FF' = transform FLOAT_INTERVAL_DIV_FF_FF and + FLOAT_INTERVAL_DIV_TT_TT' = transform FLOAT_INTERVAL_DIV_TT_TT and + FLOAT_INTERVAL_DIV_FF_TT' = transform FLOAT_INTERVAL_DIV_FF_TT and + FLOAT_INTERVAL_DIV_TT_FF' = transform FLOAT_INTERVAL_DIV_TT_FF and + FLOAT_INTERVAL_DIV_TF_FF' = transform FLOAT_INTERVAL_DIV_TF_FF and + FLOAT_INTERVAL_DIV_TF_TT' = transform FLOAT_INTERVAL_DIV_TF_TT;; + + + +let float_interval_div pp th1 th2 = + let x, l_lo, l_hi = dest_float_interval (concl th1) and + y, r_lo, r_hi = dest_float_interval (concl th2) in + let s1, n1, e1 = dest_float l_lo and + s2, n2, e2 = dest_float l_hi and + s3, m1, r1 = dest_float r_lo and + s4, m2, r2 = dest_float r_hi in + + if s3 <> s4 then + failwith "float_interval_div: division by an interval containing 0" + else + let lo_th, hi_th, th0, zero_th = + if s1 = s2 then + if s1 = "F" then + if s3 = "F" then + float_div_lo pp l_lo r_hi, float_div_hi pp l_hi r_lo, + FLOAT_INTERVAL_DIV_FF_FF', raw_eq0_hash_conv m1 + else + float_div_lo pp l_hi r_hi, float_div_hi pp l_lo r_lo, + FLOAT_INTERVAL_DIV_FF_TT', raw_eq0_hash_conv m2 + else + if s3 = "F" then + float_div_lo pp l_lo r_lo, float_div_hi pp l_hi r_hi, + FLOAT_INTERVAL_DIV_TT_FF', raw_eq0_hash_conv m1 + else + float_div_lo pp l_hi r_lo, float_div_hi pp l_lo r_hi, + FLOAT_INTERVAL_DIV_TT_TT', raw_eq0_hash_conv m2 + else + if s1 = "F" then + failwith "float_interval_div: interval (F,T)" + else + if s3 = "F" then + float_div_lo pp l_lo r_lo, float_div_hi pp l_hi r_lo, + FLOAT_INTERVAL_DIV_TF_FF', raw_eq0_hash_conv m1 + else + float_div_lo pp l_hi r_hi, float_div_hi pp l_lo r_hi, + FLOAT_INTERVAL_DIV_TF_TT', raw_eq0_hash_conv m2 in + + let f1_tm = lhand(concl lo_th) and + f2_tm = rand(concl hi_th) in + + let th = INST[x, x_var_real; n1, n1_var_num; e1, e1_var_num; + y, y_var_real; n2, n2_var_num; e2, e2_var_num; + m1, m1_var_num; r1, r1_var_num; + m2, m2_var_num; r2, r2_var_num; + f1_tm, f1_var_real; f2_tm, f2_var_real] th0 in + (MY_PROVE_HYP lo_th o MY_PROVE_HYP hi_th o + MY_PROVE_HYP th1 o MY_PROVE_HYP th2 o MY_PROVE_HYP zero_th) th;; + + + + + +(* +let th1 = mk_float_interval_small_num 123456781;; +let th2 = mk_float_interval_small_num 514;; +let th1' = float_interval_neg th1;; +let th2' = float_interval_neg th2;; + +let th3 = (NUMERALS_TO_NUM o REWRITE_RULE[FLOAT_OF_NUM; min_exp_def; GSYM FLOAT_NEG_T] o prove) + (`interval_arith (&0) (-- &5, &10)`, REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; +let th4 = (NUMERALS_TO_NUM o REWRITE_RULE[FLOAT_OF_NUM; min_exp_def; GSYM FLOAT_NEG_T] o prove) + (`interval_arith (&0) (-- &10, &5)`, REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; + +float_interval_div 5 th1 th2;; +float_interval_div 5 th1' th2;; +float_interval_div 5 th1 th2';; +float_interval_div 5 th1' th2';; +float_interval_div 1 th1 th2;; + +float_interval_div 5 th3 th1;; +float_interval_div 5 th3 th1';; +float_interval_div 5 th3 th4;; + +(* 4: 0.392 *) +test 100 (float_interval_div 5 th1) th2;; +(* 4: 0.224 *) +test 100 (float_interval_div 1 th1) th2;; + + +let tm1 = mk_small_numeral_array 123456781;; +let tm2 = mk_small_numeral_array 514;; +let tm = mk_binop `DIV` tm1 tm2;; + +(* 4: 0.056 *) +test 100 NUM_DIV_HASH_CONV tm;; +NUM_DIV_HASH_CONV tm;; + + +let th1' = float_interval_round 3 th1;; +let th2' = float_interval_round 3 th2;; + +(* 4: 0.256 *) +test 100 (float_interval_div 3 th1') th2';; + + + + +let th1 = mk_float_interval_num 1;; +let th2 = mk_float_interval_num 17;; + +float_interval_div 5 th1 th2;; +*) + + + +(*****************************************) + +(* float_interval_add, float_interval_sub *) + +let n1_var_real = `n1:real` and + n2_var_real = `n2:real` and + m1_var_real = `m1:real` and + m2_var_real = `m2:real` and + n_var_real = `n:real` and + m_var_real = `m:real`;; + + +let INTERVAL_ADD = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (n1, m1) /\ + interval_arith y (n2, m2) /\ + n <= n1 + n2 /\ m1 + m2 <= m + ==> interval_arith (x + y) (n, m)`, + REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; + + + +let INTERVAL_SUB = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove)( + `interval_arith x (n1, m1) /\ + interval_arith y (n2, m2) /\ + n <= n1 - m2 /\ m1 - n2 <= m + ==> interval_arith (x - y) (n, m)`, + REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; + + + + +let float_interval_add pp th1 th2 = + let x, n1, m1 = dest_float_interval (concl th1) in + let y, n2, m2 = dest_float_interval (concl th2) in + let lo_th = float_add_lo pp n1 n2 in + let hi_th = float_add_hi pp m1 m2 in + let n_tm = lhand (concl lo_th) in + let m_tm = rand (concl hi_th) in + let th0 = INST[x, x_var_real; n1, n1_var_real; m1, m1_var_real; + y, y_var_real; n2, n2_var_real; m2, m2_var_real; + n_tm, n_var_real; m_tm, m_var_real] INTERVAL_ADD in + MY_PROVE_HYP lo_th (MY_PROVE_HYP hi_th (MY_PROVE_HYP th2 (MY_PROVE_HYP th1 th0)));; + + + +let float_interval_sub pp th1 th2 = + let x, n1, m1 = dest_float_interval (concl th1) in + let y, n2, m2 = dest_float_interval (concl th2) in + let lo_th = float_sub_lo pp n1 m2 in + let hi_th = float_sub_hi pp m1 n2 in + let n_tm = lhand(concl lo_th) in + let m_tm = rand(concl hi_th) in + let th0 = INST[x, x_var_real; n1, n1_var_real; m1, m1_var_real; + y, y_var_real; n2, n2_var_real; m2, m2_var_real; + n_tm, n_var_real; m_tm, m_var_real] INTERVAL_SUB in + MY_PROVE_HYP lo_th (MY_PROVE_HYP hi_th (MY_PROVE_HYP th2 (MY_PROVE_HYP th1 th0)));; + + + +(* +let th1 = mk_float_interval_num (Num.num_of_int 123456781);; +let th2 = mk_float_interval_num (Num.num_of_int 514);; +let th3 = float_interval_neg th1;; +float_interval_add 5 th1 th2;; +float_interval_sub 5 th2 th1;; +float_interval_add 1 th1 th2;; + +float_interval_add 5 th3 th2;; +float_interval_add 1 th3 th2;; + +(* 4: 0.424 *) +test 1000 (float_interval_add 5 th1) th2;; +(* 4: 0.648 *) +test 1000 (float_interval_add 1 th1) th2;; + + +let tm1 = mk_small_numeral_array 123456781;; +let tm2 = mk_small_numeral_array 514;; +let tm = mk_binop plus_op_num tm1 tm2;; + +(* 4: 0.036 *) +test 1000 NUM_ADD_HASH_CONV tm;; +NUM_ADD_HASH_CONV tm;; + + +let th1' = float_interval_round 3 th1;; +let th2' = float_interval_round 3 th2;; +float_interval_add 3 th1' th2';; + +(* 4: 0.724 *) +test 1000 (float_interval_add 3 th1') th2';; +*) + +(********************************************) + +(* FLOAT_ABS *) + +let s_var_bool = `s:bool`;; + +let FLOAT_ABS = prove(`abs (float s n e) = float F n e`, + BOOL_CASES_TAC `s:bool` THEN + REWRITE_TAC[FLOAT_NEG_T; REAL_ABS_NEG; REAL_ABS_REFL; FLOAT_F_POS]);; + + +let float_abs tm = + let ltm, rtm = dest_comb tm in + if ((fst o dest_const) ltm <> "real_abs") then + failwith "float_abs: no abs" + else + let ltm, e_tm = dest_comb rtm in + let ltm, n_tm = dest_comb ltm in + let s_tm = rand ltm in + INST[s_tm, s_var_bool; n_tm, n_var_num; e_tm, e_var_num] FLOAT_ABS;; + + + + + + +(*******************************) + +(* float_interval_sqrt *) + +let FLOAT_INTERVAL_SQRT = prove(`interval_arith x (float F n1 e1, hi) /\ + f1 <= sqrt (float F n1 e1) /\ sqrt hi <= f2 + ==> interval_arith (sqrt x) (f1, f2)`, + ABBREV_TAC `lo = float F n1 e1` THEN + REWRITE_TAC[interval_arith] THEN + STRIP_TAC THEN + SUBGOAL_THEN `&0 <= lo /\ &0 <= hi` ASSUME_TAC THENL + [ + EXPAND_TAC "lo" THEN + REWRITE_TAC[FLOAT_F_POS] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `x:real` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `lo:real` THEN + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "lo" THEN + REWRITE_TAC[FLOAT_F_POS]; + ALL_TAC + ] THEN + SUBGOAL_THEN `&0 <= x` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `lo:real` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `sqrt lo` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC SQRT_MONO_LE THEN + ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `sqrt hi` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC SQRT_MONO_LE THEN + ASM_REWRITE_TAC[] + ]);; + + +let FLOAT_INTERVAL_SQRT' = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP]) FLOAT_INTERVAL_SQRT;; + + +let float_interval_sqrt pp th = + let x_tm, lo_tm, hi_tm = dest_float_interval (concl th) in + let s1, n1_tm, e1_tm = dest_float lo_tm in + if s1 <> "F" then + failwith "float_interval_sqrt: negative low bound" + else + let lo_th = float_sqrt_lo pp lo_tm in + let hi_th = float_sqrt_hi pp hi_tm in + let f1_tm = lhand (concl lo_th) in + let f2_tm = rand (concl hi_th) in + let th0 = INST[x_tm, x_var_real; n1_tm, n1_var_num; e1_tm, e1_var_num; + hi_tm, hi_var_real; f1_tm, f1_var_real; + f2_tm, f2_var_real] FLOAT_INTERVAL_SQRT' in + MY_PROVE_HYP lo_th (MY_PROVE_HYP hi_th (MY_PROVE_HYP th th0));; + + + + +(******************************************) + +(* FLOAT_TO_NUM_CONV *) + + +let FLOAT_TO_NUM_CONV tm = + let ltm, e_tm = dest_comb tm in + let f_tm, n_tm = dest_comb ltm in + if (fst o dest_const o rator) f_tm <> "float" then + failwith "FLOAT_TO_NUM_CONV" + else + let n_th' = SYM (INST[n_tm, n_var_num] Arith_hash.NUM_THM) in + let e_th' = SYM (INST[e_tm, n_var_num] Arith_hash.NUM_THM) in + let n_th = TRANS n_th' (NUM_TO_NUMERAL_CONV (mk_comb(Arith_hash.num_const, n_tm))) in + let e_th = TRANS e_th' (NUM_TO_NUMERAL_CONV (mk_comb(Arith_hash.num_const, e_tm))) in + let th0 = MK_COMB (AP_TERM f_tm n_th, e_th) in + let tm0 = rand(concl th0) in + let th1 = REWRITE_CONV[float; num_exp; REAL_MUL_LID; GSYM REAL_OF_NUM_MUL; GSYM REAL_OF_NUM_POW; min_exp_def] tm0 in + let th2 = REAL_RAT_REDUCE_CONV (rand(concl th1)) in + TRANS th0 (TRANS th1 th2);; + + +end;; + + +(**************************************) +(* Printer for floating-point numbers *) +(**************************************) + +let print_float tm= + try + let s, m_tm, e_tm = Arith_float.dest_float tm in + let m = Arith_hash.raw_dest_hash m_tm and + e = Arith_hash.raw_dest_hash e_tm -/ Num.num_of_int Arith_options.min_exp in + let s_str = if s = "T" then "-" else "" in + let m_str = Num.string_of_num m in + let e_str = if e = num_0 then "" + else "*" ^ string_of_int Arith_options.base ^ "^" ^ Num.string_of_num e in + let str = "##" ^ s_str ^ m_str ^ e_str in + print_string str + with _ -> failwith "print_float";; + + +install_user_printer ("float", print_float);; diff --git a/formal_lp/old/arith/float_atn.hl b/formal_lp/old/arith/float_atn.hl new file mode 100644 index 0000000..6cf34db --- /dev/null +++ b/formal_lp/old/arith/float_atn.hl @@ -0,0 +1,1028 @@ +(* Dependencies *) +needs "jordan/refinement.hl";; +open Refinement;; +needs "jordan/parse_ext_override_interface.hl";; +needs "jordan/real_ext.hl";; +prioritize_real();; +needs "jordan/taylor_atn.hl";; + +needs "../formal_lp/arith/float.hl";; + + +module type Float_atn_sig = + sig + val float_interval_pow_simple : int -> int -> thm -> thm + val pi_approx_array : thm array + val pi2_approx_array : thm array + + val float_interval_atn : int -> thm -> thm + val float_interval_acs : int -> thm -> thm +end;; + + +module Float_atn : Float_atn_sig = struct + +open Arith_misc;; +open Interval_arith;; +open Float_theory;; +open Arith_float;; +open Taylor_atn;; + + +(******************************) +let x_var_real = `x:real` and + n_var_num = `n:num` and + e_var_num = `e:num` and + a_var_real = `a:real` and + b_var_real = `b:real` and + d_var_real = `d:real` and + hi_var_real = `hi:real` and + lo_var_real = `lo:real`;; + + +let add_op_real = `(+):real->real->real` and + sub_op_real = `(-):real->real->real` and + mul_op_real = `( * ):real->real->real` and + div_op_real = `(/):real->real->real` and + neg_op_real = `(--):real->real` and + mul_op_num = `( * ):num->num->num` and + add_op_num = `(+):num->num->num`;; + + + +(******************************) +(* halfatn and halfatn4 *) + +let float_interval_1 = mk_float_interval_small_num 1;; + + +let HALFATN' = (SYM o SPEC_ALL o REWRITE_RULE[REAL_POW_2]) halfatn;; +let HALFATN4' = prove(`halfatn(halfatn(halfatn(halfatn x))) = halfatn4 x`, + REWRITE_TAC[halfatn4; o_THM]);; + + + + +let float_interval_halfatn pp x_th = + let x_tm = (rand o rator o concl) x_th in + let xx_th = float_interval_mul pp x_th x_th in + let one_xx_th = float_interval_add pp float_interval_1 xx_th in + let sqrt_th = float_interval_sqrt pp one_xx_th in + let one_sqrt_th = float_interval_add pp sqrt_th float_interval_1 in + let r_th = float_interval_div pp x_th one_sqrt_th in + let th0 = INST[x_tm, x_var_real] HALFATN' in + let ltm, rtm = dest_comb(concl r_th) in + EQ_MP (AP_THM (AP_TERM (rator ltm) th0) rtm) r_th;; + + +let float_interval_halfatn4 pp x_th = + let x_tm = (rand o rator o concl) x_th in + let r_th = float_interval_halfatn pp + (float_interval_halfatn pp + (float_interval_halfatn pp (float_interval_halfatn pp x_th))) in + let th0 = INST[x_tm, x_var_real] HALFATN4' in + let ltm, rtm = dest_comb(concl r_th) in + EQ_MP (AP_THM (AP_TERM (rator ltm) th0) rtm) r_th;; + + + +(* +let x_th = mk_float_interval_small_num 3;; +let x_th2 = float_interval_div 11 float_interval_1 x_th;; + +float_interval_halfatn4 11 x_th2;; +(* 10: 1.180 *) +test 10 (float_interval_halfatn4 11) x_th2;; +*) + + + +(****************************************) + + +let rec float_interval_calc pp expr x_th = + if is_var expr then + x_th + else + let ltm, r_tm = dest_comb expr in + if is_comb ltm then + let op, l_tm = dest_comb ltm in + let l_th = float_interval_calc pp l_tm x_th in + let r_th = float_interval_calc pp r_tm x_th in + if op = add_op_real then + float_interval_add pp l_th r_th + else if op = mul_op_real then + float_interval_mul pp l_th r_th + else if op = div_op_real then + float_interval_div pp l_th r_th + else if op = sub_op_real then + float_interval_sub pp l_th r_th + else + failwith ("Unknown operation: " ^ (fst o dest_const) op) + else + if ltm = neg_op_real then + let r_th = float_interval_calc pp r_tm x_th in + float_interval_neg r_th + else + mk_float_interval_num (dest_numeral r_tm);; + + +(*************************************) +(* Polynomial functions *) + +let poly_f = new_definition `poly_f cs x = ITLIST (\c s. c + x * s) cs (&0)`;; + +(* Even function *) +let poly_f_even = new_definition `poly_f_even cs x = ITLIST (\c s. c + (x * x) * s) cs (&0)`;; +(* Odd function *) +let poly_f_odd = new_definition `poly_f_odd cs x = x * poly_f_even cs x`;; +let poly_f_odd' = SPECL[`t:(real)list`; `x:real`] poly_f_odd;; + +let NUMERALS_TO_NUM = Arith_nat.NUMERALS_TO_NUM;; + +let POLY_F_EMPTY = (NUMERALS_TO_NUM o prove) (`poly_f [] x = &0`, REWRITE_TAC[poly_f; ITLIST]) and + POLY_F_CONS = prove(`poly_f (CONS h t) x = h + x * poly_f t x`, REWRITE_TAC[poly_f; ITLIST]);; + +let POLY_F_EVEN_EMPTY = (NUMERALS_TO_NUM o prove) (`poly_f_even [] x = &0`, REWRITE_TAC[poly_f_even; ITLIST]) and + POLY_F_EVEN_CONS = prove(`poly_f_even (CONS h t) x = h + (x * x) * poly_f_even t x`, REWRITE_TAC[poly_f_even; ITLIST]);; + +let POLY_F_ODD_EMPTY = (NUMERALS_TO_NUM o prove) (`poly_f_odd [] x = &0`, REWRITE_TAC[poly_f_odd; poly_f_even; ITLIST; REAL_MUL_RZERO]);; + + +(* TABLE *) + +let REVERSE_TABLE = define `(REVERSE_TABLE (f:num->A) 0 = []) /\ + (REVERSE_TABLE f (SUC i) = CONS (f i) ( REVERSE_TABLE f i))`;; + + +let TABLE = new_definition `!(f:num->A) k. TABLE f k = REVERSE (REVERSE_TABLE f k)`;; + + +let LENGTH_REVERSE_TABLE = prove(`!(f:num->A) n. LENGTH (REVERSE_TABLE f n) = n`, + GEN_TAC THEN INDUCT_TAC THEN ASM_REWRITE_TAC[REVERSE_TABLE; LENGTH]);; + + +let LENGTH_REVERSE = prove(`!(l:(A)list). LENGTH (REVERSE l) = LENGTH l`, + MATCH_MP_TAC list_INDUCT THEN REWRITE_TAC[REVERSE] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[LENGTH_APPEND; LENGTH] THEN + ARITH_TAC);; + + +let LENGTH_TABLE = prove(`!(f:num->A) n. LENGTH (TABLE f n) = n`, + REWRITE_TAC[TABLE; LENGTH_REVERSE; LENGTH_REVERSE_TABLE]);; + + + +let rec reverse_table_conv tm = + let ltm, i_tm = dest_comb tm in + if (i_tm = `0`) then + ONCE_REWRITE_CONV[REVERSE_TABLE] tm + else + let i_suc = num_CONV i_tm in + let th1 = ONCE_REWRITE_RULE[REVERSE_TABLE] (AP_TERM ltm i_suc) in + let ltm, rtm = dest_comb (rand(concl th1)) in + let th2 = reverse_table_conv rtm in + TRANS th1 (AP_TERM ltm th2);; + + + + +let atn_co_table = new_definition `atn_co_table n = TABLE + (\k. (if (EVEN k) then &1 else --(&1)) / &(2 * k + 1)) (SUC n)`;; + + +(* Returns a theorem |- atn_co_table n = [...] and + a list of interval approximations of the coefficients in the table *) +let mk_atn_co_table pp n = + let table = SPEC (mk_small_numeral n) atn_co_table in + let th = CONV_RULE (DEPTH_CONV NUM_SUC_CONV THENC + REWRITE_CONV[TABLE] THENC + ONCE_DEPTH_CONV reverse_table_conv THENC + REWRITE_CONV[REVERSE; APPEND] THENC + NUM_REDUCE_CONV) table in + let list = (rand o concl) th in + th, map (fun tm -> float_interval_calc pp tm float_interval_1) (dest_list list);; + + + +let POLY_F_EVEN_ALT = prove(`poly_f_even cs x = poly_f cs (x * x)`, + REWRITE_TAC[poly_f_even; poly_f]);; + + +let POLY_F_APPEND = prove(`!x b a. poly_f (APPEND a b) x = poly_f a x + x pow (LENGTH a) * poly_f b x`, + GEN_TAC THEN GEN_TAC THEN + MATCH_MP_TAC list_INDUCT THEN + REPEAT STRIP_TAC THENL + [ + REWRITE_TAC[APPEND; poly_f; ITLIST; LENGTH] THEN + REWRITE_TAC[real_pow; REAL_MUL_LID; REAL_ADD_LID]; + ALL_TAC + ] THEN + + REWRITE_TAC[APPEND; poly_f; ITLIST] THEN + ASM_REWRITE_TAC[GSYM poly_f] THEN + REWRITE_TAC[LENGTH; real_pow] THEN + REAL_ARITH_TAC);; + + +let POLY_F_EVEN_APPEND = prove(`!x b a. poly_f_even (APPEND a b) x = poly_f_even a x + x pow (2 * LENGTH a) * poly_f_even b x`, + REWRITE_TAC[POLY_F_EVEN_ALT; POLY_F_APPEND] THEN + REWRITE_TAC[GSYM REAL_POW_2; REAL_POW_POW]);; + + +let POLY_F_ODD_APPEND = prove(`!x b a. poly_f_odd (APPEND a b) x = poly_f_odd a x + x pow (2 * LENGTH a) * poly_f_odd b x`, + REPEAT GEN_TAC THEN + REWRITE_TAC[poly_f_odd] THEN + REWRITE_TAC[POLY_F_EVEN_APPEND] THEN + REAL_ARITH_TAC);; + + +let ATN_SUM_TABLE = prove(`!x n. sum (0..n) (halfatn4_co x) = poly_f_odd (atn_co_table n) (halfatn4 x)`, + GEN_TAC THEN INDUCT_TAC THENL + [ + REWRITE_TAC[SUM_SING_NUMSEG; atn_co_table; TABLE; REVERSE_TABLE; REVERSE; APPEND] THEN + REWRITE_TAC[ARITH_EVEN] THEN + REWRITE_TAC[poly_f_odd; poly_f_even; ITLIST] THEN + REWRITE_TAC[halfatn4_co; REAL_MUL_RZERO; REAL_ADD_RID] THEN + REWRITE_TAC[MULT_CLAUSES; ARITH_ADD; REAL_POW_1; real_pow] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + REWRITE_TAC[SUM_CLAUSES_NUMSEG; atn_co_table; TABLE; LE_0] THEN + ONCE_REWRITE_TAC[REVERSE_TABLE] THEN + ONCE_REWRITE_TAC[REVERSE] THEN + REWRITE_TAC[GSYM TABLE; GSYM atn_co_table] THEN + ASM_REWRITE_TAC[POLY_F_ODD_APPEND] THEN + REWRITE_TAC[REAL_EQ_ADD_LCANCEL] THEN + REWRITE_TAC[atn_co_table; LENGTH_TABLE; halfatn4_co] THEN + REWRITE_TAC[poly_f_odd; poly_f_even; ITLIST; REAL_MUL_RZERO; REAL_ADD_RID] THEN + REWRITE_TAC[real_div; REAL_MUL_ASSOC] THEN + REWRITE_TAC[REAL_EQ_MUL_RCANCEL] THEN + DISJ1_TAC THEN + REWRITE_TAC[REAL_MUL_AC] THEN + REWRITE_TAC[GSYM real_pow; ARITH_RULE `2 * SUC n + 1 = SUC (2 * SUC n)`] THEN + GEN_REWRITE_TAC LAND_CONV [REAL_MUL_AC] THEN + REWRITE_TAC[REAL_EQ_MUL_RCANCEL] THEN + DISJ1_TAC THEN + REWRITE_TAC[REAL_POW_NEG; real_pow; REAL_POW_ONE; REAL_MUL_RID]);; + + + +let POLY_F_SING = prove(`poly_f [c] x = c`, + REWRITE_TAC[poly_f; ITLIST; REAL_MUL_RZERO; REAL_ADD_RID]);; + + +let c_var_real = `c:real` and + cs_var_list = `cs:(real)list` and + h_var_real = `h:real` and + t_var_list = `t:(real)list`;; + +let interval_const = `interval_arith`;; + + +let rec float_interval_poly_f pp (cs, l) x_th = + if length l = 0 then + failwith "float_interval_poly_f: an empty coefficient list" + else + let ltm, x_bounds = dest_comb (concl x_th) in + let x_tm = rand ltm in + let first = hd l in + let ltm, first_bounds = dest_comb (concl first) in + let first_tm = rand ltm in + if length l = 1 then + let th0 = INST[first_tm, c_var_real; x_tm, x_var_real] POLY_F_SING in + EQ_MP (SYM (AP_THM (AP_TERM interval_const th0) first_bounds)) first + else + let ltm, t_tm = dest_comb cs in + let h_tm = rand ltm in + + let th0 = INST[h_tm, h_var_real; t_tm, t_var_list; x_tm, x_var_real] POLY_F_CONS in + let r_th = float_interval_poly_f pp (t_tm, tl l) x_th in + let th1 = float_interval_add pp first (float_interval_mul pp x_th r_th) in + let bounds = rand (concl th1) in + EQ_MP (SYM (AP_THM (AP_TERM interval_const th0) bounds)) th1;; + + + + + +let float_interval_poly_f_even pp (cs, l) x_th = + let x_tm = (rand o rator o concl) x_th in + let xx_th = float_interval_mul pp x_th x_th in + let th0 = INST[cs, cs_var_list; x_tm, x_var_real] POLY_F_EVEN_ALT in + let th1 = float_interval_poly_f pp (cs, l) xx_th in + let bounds = rand(concl th1) in + EQ_MP (SYM (AP_THM (AP_TERM interval_const th0) bounds)) th1;; + + +let float_interval_poly_f_odd pp (cs, l) x_th = + let x_tm = (rand o rator o concl) x_th in + let th0 = INST[cs, t_var_list; x_tm, x_var_real] poly_f_odd' in + let even_th = float_interval_poly_f_even pp (cs, l) x_th in + let th1 = float_interval_mul pp x_th even_th in + let bounds = rand(concl th1) in + EQ_MP (SYM (AP_THM (AP_TERM interval_const th0) bounds)) th1;; + + + + +let poly_f_odd_const = `poly_f_odd`;; +let ATN_SUM_TABLE' = SPEC_ALL ATN_SUM_TABLE;; +let float_interval_16 = mk_float_interval_small_num 16;; + + +(* Computes an interval for &16 * sum(0..n) (halfatn4_co x) *) +let float_interval_atn_sum pp (cs_th, l) x_th = + let n_tm = (rand o lhand o concl) cs_th in + let cs_tm = rand(concl cs_th) in + let halfatn4 = float_interval_halfatn4 pp x_th in + + let poly_th = float_interval_poly_f_odd pp (cs_tm, l) halfatn4 in + let bounds = rand (concl poly_th) in + let halfatn4_tm = (rand o rator o concl) halfatn4 in + let x_tm = rand halfatn4_tm in + + let th1 = AP_THM (AP_TERM interval_const (AP_THM (AP_TERM poly_f_odd_const cs_th) halfatn4_tm)) bounds in + let poly_atn_th = EQ_MP (SYM th1) poly_th in + let bounds = rand (concl poly_atn_th) in + + let th2 = INST[n_tm, n_var_num; x_tm, x_var_real] ATN_SUM_TABLE' in + let th3 = EQ_MP (SYM (AP_THM (AP_TERM interval_const th2) bounds)) poly_atn_th in + float_interval_mul pp float_interval_16 th3;; + + + + +(* +let pp = 10;; +let cs_th, l = mk_atn_co_table pp 4;; +let cs = rand (concl cs_th);; +let x_th = float_interval_1;; + +let th = float_interval_poly_f pp (cs, l) x_th;; +float_interval_mul pp (mk_float_interval_small_num 4) th;; + + +let th = float_interval_atn_sum pp (cs_th, l) x_th;; +float_interval_mul pp (mk_float_interval_small_num 4) th;; +*) + + +(******************************) + +let bounds_var_pair = `bounds:real#real`;; + + +let FLOAT_INTERVAL_INV = prove(`interval_arith (&1 / x) bounds <=> + interval_arith (inv x) bounds`, + REWRITE_TAC[real_div; REAL_MUL_LID]);; + + + +let float_interval_inv pp x_th = + let x_tm = (rand o rator o concl) x_th in + let r_th = float_interval_div pp float_interval_1 x_th in + let th0 = INST[x_tm, x_var_real; rand(concl r_th), bounds_var_pair] FLOAT_INTERVAL_INV in + EQ_MP th0 r_th;; + + +let REAL_POW_SUC = (SPEC_ALL o CONJUNCT2) real_pow;; + +let INTERVAL_REAL_POW_0 = prove(mk_comb(`interval_arith (x pow 0)`, (rand o concl) float_interval_1), + REWRITE_TAC[real_pow; float_interval_1]);; + +let INTERVAL_REAL_POW_1 = prove(`interval_arith x bounds <=> interval_arith (x pow 1) bounds`, + REWRITE_TAC[REAL_POW_1]);; + + + + +let rec float_interval_pow_simple pp n x_th = + let x_tm = (rand o rator o concl) x_th in + if n = 0 then + INST[x_tm, x_var_real] INTERVAL_REAL_POW_0 + else + if n = 1 then + let bounds = rand(concl x_th) in + let th0 = INST[x_tm, x_var_real; bounds, bounds_var_pair] INTERVAL_REAL_POW_1 in + EQ_MP th0 x_th + else + let n_tm' = mk_small_numeral n in + let n_suc = num_CONV n_tm' in + let n_tm = rand(rand(concl n_suc)) in + let th0 = INST[x_tm, x_var_real; n_tm, n_var_num] REAL_POW_SUC in + let r_th = float_interval_pow_simple pp (n - 1) x_th in + let th1 = float_interval_mul pp x_th r_th in + let bounds = rand (concl th1) in + let th2 = TRANS (AP_TERM (rator(lhand(concl th0))) n_suc) th0 in + EQ_MP (SYM (AP_THM (AP_TERM interval_const th2) bounds)) th1;; + + + +let float_interval_2 = mk_float_interval_small_num 2 and + six_const = `6` and + five_const = `5`;; + + + +(* Computes an interval for inv(&2 pow (6 * n + 5)) *) +let compute_eps1 pp n = + let n_tm = mk_small_numeral n in + let n6 = NUM_MULT_CONV (mk_binop mul_op_num six_const n_tm) in + let n65_1 = AP_THM (AP_TERM add_op_num n6) five_const in + let n65_2 = NUM_ADD_CONV (rand (concl n65_1)) in + let n65 = TRANS n65_1 n65_2 in + let pow_th = float_interval_pow_simple pp (6 * n + 5) float_interval_2 in + let ltm, bounds = dest_comb(concl pow_th) in + let pow_tm = (rator o rand) ltm in + let th0 = EQ_MP (SYM (AP_THM (AP_TERM interval_const (AP_TERM pow_tm n65)) bounds)) pow_th in + float_interval_inv pp th0;; + + + + +(**********************************) + + + +let FLOAT_ATN_LO_HI = prove(`interval_arith (&16 * sum(0..n) (halfatn4_co x)) (a, b) /\ + interval_arith (inv(&2 pow (6*n + 5))) (c,d) /\ + b + d <= hi /\ lo <= a - d + ==> interval_arith (atn x) (lo, hi)`, + REWRITE_TAC[interval_arith] THEN + STRIP_TAC THEN + MP_TAC (SPEC_ALL real_taylor_atn_halfatn4) THEN + MP_TAC (REAL_ARITH `&0 <= abs(&16)`) THEN + REWRITE_TAC[IMP_IMP] THEN + DISCH_THEN (MP_TAC o MATCH_MP REAL_LE_LMUL) THEN + REWRITE_TAC[GSYM REAL_ABS_MUL; REAL_ARITH `a * (b - c) = a * b - a * c:real`] THEN + ONCE_REWRITE_TAC[GSYM atn_halfatn4] THEN + REWRITE_TAC[REAL_ARITH `abs (x - v) <= e <=> v - e <= x /\ x <= v + e`] THEN + REWRITE_TAC[REAL_ABS_NUM] THEN + SUBGOAL_THEN `&16 * inv(&8 pow (2 * n + 3)) = inv(&2 pow (6 * n + 5))` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[GSYM real_div] THEN + SUBGOAL_THEN `&16 = &2 pow 4 /\ &8 = &2 pow 3 /\ ~(&2 = &0)` ASSUME_TAC THENL + [ + REAL_ARITH_TAC; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[REAL_POW_POW] THEN + ASM_SIMP_TAC[REAL_DIV_POW2] THEN + REWRITE_TAC[ARITH_RULE `~(3 * (2 * n + 3) <= 4)`] THEN + REPEAT AP_TERM_TAC THEN + ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[GSYM halfatn4_co] THEN + SUBGOAL_THEN `sum (0..n) (\j. halfatn4_co x j) = sum (0..n) (halfatn4_co x)` (fun th -> REWRITE_TAC[th]) THENL + [ + AP_TERM_TAC THEN + REWRITE_TAC[FUN_EQ_THM]; + ALL_TAC + ] THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC);; + + +let FLOAT_ATN_LO_HI' = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP]) FLOAT_ATN_LO_HI;; + + + +let float_interval_atn_0 pp (cs_th, l) eps1_th x_th = + let sum_th = float_interval_atn_sum pp (cs_th, l) x_th in + let n_tm = (rand o lhand o concl) cs_th in + let x_tm = (rand o rator o concl) x_th in + + let sum_bounds = rand (concl sum_th) in + let a_tm, b_tm = dest_pair sum_bounds in + let c_tm, d_tm = (dest_pair o rand o concl) eps1_th in + + let hi_th = float_add_hi pp b_tm d_tm in + let lo_th = float_sub_lo pp a_tm d_tm in + let hi_tm = rand(concl hi_th) in + let lo_tm = lhand(concl lo_th) in + + let th0 = INST[n_tm, n_var_num; x_tm, x_var_real; + a_tm, a_var_real; b_tm, b_var_real; + c_tm, c_var_real; d_tm, d_var_real; + hi_tm, hi_var_real; lo_tm, lo_var_real] FLOAT_ATN_LO_HI' in + MY_PROVE_HYP lo_th (MY_PROVE_HYP hi_th (MY_PROVE_HYP sum_th (MY_PROVE_HYP eps1_th th0)));; + + +(* +let pp = 10;; +let n = 5;; +let cs_th, l = mk_atn_co_table pp n;; +let eps1_th = compute_eps1 pp n;; +let x_th = float_interval_2;; + +float_interval_atn_0 pp (cs_th, l) eps1_th x_th;; +(* 10(min_exp = 20): 1.316 *) +test 10 (float_interval_atn_0 pp (cs_th, l) eps1_th) x_th;; +*) + + + +(* Fill in lookup tables *) + +(* Computes n such that 2^(-(6n + 5)) <= base^(-(p + 1)) *) +let n_of_p pp = + let x = (float_of_int (pp + 1) *. log (float_of_int Arith_options.base) /. log (2.0) -. 5.0) /. 6.0 in + let n = (int_of_float o ceil) x in + if n < 1 then 1 else n;; + + +let atn_co_array = Array.init 21 (fun i -> mk_atn_co_table (i + 1) (n_of_p i));; +let eps1_array = Array.init 21 (fun i -> compute_eps1 (i + 1) (n_of_p i));; + + +let float_interval_atn pp x_th = + float_interval_atn_0 pp atn_co_array.(pp) eps1_array.(pp) x_th;; + + + + +(*****************************************) + +(* pi approximation *) + +let pp = 20;; +let x_th = float_interval_1;; +let th1 = float_interval_atn pp x_th;; +let th2 = float_interval_mul pp (mk_float_interval_small_num 4) th1;; +let float_interval_pi = REWRITE_RULE[ATN_1; REAL_ARITH `&4 * pi / &4 = pi`] th2;; +let float_interval_pi2 = float_interval_div pp float_interval_pi float_interval_2;; + + +let pi_approx_array = Array.init 19 (fun i -> float_interval_round i float_interval_pi);; +let pi2_approx_array = Array.init 19 (fun i -> float_interval_round i float_interval_pi2);; + + + + +(********************************************) + +(* acs *) + +let TAN_HALF = prove(`!x. ~(cos x = -- &1) ==> tan (x / &2) = sin x / (&1 + cos x)`, + GEN_TAC THEN + ABBREV_TAC `t = x / &2` THEN + SUBGOAL_THEN `x = &2 * t` ASSUME_TAC THENL + [ + EXPAND_TAC "t" THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[SIN_DOUBLE; COS_DOUBLE_COS; REAL_ARITH `&1 + a - &1 = a`] THEN + REWRITE_TAC[REAL_ARITH `a - &1 = -- &1 <=> a = &0`] THEN + REWRITE_TAC[real_div; REAL_INV_MUL; REAL_POW_2] THEN + REWRITE_TAC[REAL_ENTIRE; REAL_ARITH `&2 = &0 <=> F`] THEN + DISCH_TAC THEN + REWRITE_TAC[REAL_ARITH `(&2 * s * c) * i2 * ic * ic = (&2 * i2) * (c * ic) * s * ic`] THEN + ASM_SIMP_TAC[REAL_MUL_RINV; REAL_ARITH `~(&2 = &0)`] THEN + REWRITE_TAC[REAL_MUL_LID; tan; real_div]);; + + + +let X_EQ_COS_T = prove(`!x. abs x <= &1 ==> ?t. &0 <= t /\ t <= pi /\ x = cos t`, + REWRITE_TAC[REAL_ARITH `abs x <= &1 <=> -- &1 <= x /\ x <= &1`] THEN + REPEAT STRIP_TAC THEN + EXISTS_TAC `acs x` THEN + ASM_SIMP_TAC[ACS_BOUNDS; COS_ACS]);; + + + +let ACS_ATN_ALT = prove(`!x. -- &1 < x /\ x <= &1 ==> + acs x = &2 * atn (sqrt (&1 - x pow 2) / (&1 + x))`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL X_EQ_COS_T) THEN + ANTS_TAC THENL + [ + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[ACS_COS] THEN + MP_TAC (SPEC `t:real` SIN_COS_SQRT) THEN + ANTS_TAC THENL + [ + ASM_SIMP_TAC[SIN_POS_PI_LE]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MP_TAC (SPEC `t:real` TAN_HALF) THEN + ANTS_TAC THENL + [ + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + UNDISCH_TAC `-- &1 < x` THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[REAL_ARITH `t = &2 * a <=> a = t / &2`] THEN + MATCH_MP_TAC TAN_ATN THEN + REWRITE_TAC[REAL_ARITH `a / &2 < b / &2 <=> a < b`] THEN + REWRITE_TAC[REAL_ARITH `--(a / &2) < b / &2 <=> --a < b`] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LTE_TRANS THEN + EXISTS_TAC `&0` THEN + ASM_REWRITE_TAC[REAL_NEG_LT0; PI_POS]; + SUBGOAL_THEN `t = acs x` MP_TAC THENL + [ + ASM_SIMP_TAC[ACS_COS]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[SYM ACS_NEG_1] THEN + MATCH_MP_TAC ACS_MONO_LT THEN + ASM_REWRITE_TAC[REAL_LE_REFL] + ]);; + + + +let FLOAT_F_LT = prove(`!n e. &0 < float F n e <=> ~(n = 0)`, + REWRITE_TAC[REAL_ARITH `&0 < a <=> &0 <= a /\ ~(a = &0)`] THEN + REWRITE_TAC[FLOAT_F_POS; FLOAT_EQ_0]);; + + + +let FLOAT_INTERVAL_ACS = prove(`interval_arith (pi / &2 - atn(x / sqrt(&1 - x * x))) bounds /\ + interval_arith (&1 - x * x) (float F n e, hi) /\ + ~(n = 0) + ==> interval_arith (acs x) bounds`, + REWRITE_TAC[GSYM REAL_POW_2] THEN + STRIP_TAC THEN + MP_TAC (SPEC_ALL ACS_ATN) THEN + ANTS_TAC THENL + [ + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[interval_arith] THEN + REWRITE_TAC[REAL_ARITH `-- &1 < x /\ x < &1 <=> abs x < abs (&1)`] THEN + REWRITE_TAC[REAL_LT_SQUARE_ABS] THEN + REWRITE_TAC[REAL_ARITH `&1 pow 2 = &1`] THEN + REPEAT STRIP_TAC THEN + REWRITE_TAC[REAL_ARITH `a < &1 <=> &0 < &1 - a`] THEN + + MP_TAC (SPEC_ALL FLOAT_F_LT) THEN + ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `float F n e <= &1 - x pow 2` THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> ASM_REWRITE_TAC[th]));; + + + + +let ZERO_EQ_ZERO_CONST = prove(`0 = _0`, REWRITE_TAC[NUMERAL]);; + + +let FLOAT_INTERVAL_ACS' = (UNDISCH_ALL o + PURE_ONCE_REWRITE_RULE[TAUT `~P <=> (P <=> F)`] o + REWRITE_RULE[ZERO_EQ_ZERO_CONST; GSYM IMP_IMP]) FLOAT_INTERVAL_ACS;; + + + + +let float_interval_acs_0 pp (cs_th, l) eps1_th x_th = + let int1 = float_interval_sub pp float_interval_1 (float_interval_mul pp x_th x_th) in + let int2 = float_interval_div pp x_th (float_interval_sqrt pp int1) in + let atn_int = float_interval_atn_0 pp (cs_th, l) eps1_th int2 in + let acs_int = float_interval_sub pp pi2_approx_array.(pp + 1) atn_int in + + let x_tm = (rand o rator o concl) x_th in + let bounds = (rand o concl) acs_int in + let int1_bounds = (rand o concl) int1 in + let lo_tm, hi_tm = dest_pair int1_bounds in + let s, n_tm, e_tm = dest_float lo_tm in + if s <> "F" then + failwith "float_interval_acs_0: &1 - x pow 2 < &1 is not satisfied" + else + let n_th = Arith_nat.raw_eq0_hash_conv n_tm in + let th0 = INST[x_tm, x_var_real; bounds, bounds_var_pair; + n_tm, n_var_num; e_tm, e_var_num; + hi_tm, hi_var_real] FLOAT_INTERVAL_ACS' in + MY_PROVE_HYP acs_int (MY_PROVE_HYP int1 (MY_PROVE_HYP n_th th0));; + + +let float_interval_acs pp x_th = + float_interval_acs_0 pp atn_co_array.(pp) eps1_array.(pp) x_th;; + + +(* +(* acs(&1 / &3) <= #1.230959418 *) +let pp = 11;; +let n = 5;; +let cs_th, l = mk_atn_co_table pp n;; +let eps1_th = compute_eps1 pp n;; +let x_th = float_interval_div pp float_interval_1 (mk_float_interval_small_num 3);; + + +float_interval_acs_0 pp (cs_th, l) eps1_th x_th;; +float_interval_acs pp x_th;; + +(* 10: 1.908 *) +test 10 (float_interval_acs_0 pp (cs_th, l) eps1_th) x_th;; + +*) + + + +(****************************************) + +(* delta_x, delta_x4, delta_y *) + + +let delta_x' = SPEC_ALL delta_x;; +let x1_var_real = `x1:real` and + x2_var_real = `x2:real` and + x3_var_real = `x3:real` and + x4_var_real = `x4:real` and + x5_var_real = `x5:real` and + x6_var_real = `x6:real`;; + + + +let float_interval_delta_x pp x1 x2 x3 x4 x5 x6 = + let (+++) = float_interval_add pp in + let (---) = float_interval_sub pp in + let neg = float_interval_neg in + let (|*|) = float_interval_mul pp in + + let t1 = neg x1 +++ (x2 +++ (x3 --- x4 +++ (x5 +++ x6))) and + t2 = x1 --- x2 +++ (x3 +++ (x4 --- x5 +++ x6)) and + t3 = x1 +++ (x2 --- x3 +++ (x4 +++ (x5 --- x6))) in + let s1 = x1 |*| (x4 |*| t1) and + s2 = x2 |*| (x5 |*| t2) and + s3 = x3 |*| (x6 |*| t3) and + s4 = x2 |*| (x3 |*| x4) and + s5 = x1 |*| (x3 |*| x5) and + s6 = x1 |*| (x2 |*| x6) and + s7 = x4 |*| (x5 |*| x6) in + + let int_th = s1 +++ (s2 +++ (s3 --- s4 --- s5 --- s6 --- s7)) in + + let get_tm = rand o rator o concl in + let x1_tm = get_tm x1 and + x2_tm = get_tm x2 and + x3_tm = get_tm x3 and + x4_tm = get_tm x4 and + x5_tm = get_tm x5 and + x6_tm = get_tm x6 in + + let delta_th = INST[x1_tm, x1_var_real; x2_tm, x2_var_real; x3_tm, x3_var_real; + x4_tm, x4_var_real; x5_tm, x5_var_real; x6_tm, x6_var_real] delta_x' in + EQ_MP (SYM (AP_THM (AP_TERM interval_const delta_th) (rand (concl int_th)))) int_th;; + + +(* delta_x4 *) + +let delta_x4' = SPEC_ALL Sphere.delta_x4;; + +let float_interval_delta_x4 pp x1 x2 x3 x4 x5 x6 = + let (+++) = float_interval_add pp in + let (---) = float_interval_sub pp in + let neg = float_interval_neg in + let (|*|) = float_interval_mul pp in + + let t1 = neg x1 +++ (x2 +++ (x3 --- x4 +++ (x5 +++ x6))) in + let s1 = neg x2 |*| x3 and + s2 = x1 |*| x4 and + s3 = x2 |*| x5 and + s4 = x3 |*| x6 and + s5 = x5 |*| x6 and + s6 = x1 |*| t1 in + + let int_th = s1 --- s2 +++ (s3 +++ (s4 --- s5 +++ s6)) in + + let get_tm = rand o rator o concl in + let x1_tm = get_tm x1 and + x2_tm = get_tm x2 and + x3_tm = get_tm x3 and + x4_tm = get_tm x4 and + x5_tm = get_tm x5 and + x6_tm = get_tm x6 in + + let delta4_th = INST[x1_tm, x1_var_real; x2_tm, x2_var_real; x3_tm, x3_var_real; + x4_tm, x4_var_real; x5_tm, x5_var_real; x6_tm, x6_var_real] delta_x4' in + EQ_MP (SYM (AP_THM (AP_TERM interval_const delta4_th) (rand (concl int_th)))) int_th;; + + + +(* delta_y *) + +let delta_y' = SPEC_ALL Sphere.delta_y;; + +let y1_var_real = `y1:real` and + y2_var_real = `y2:real` and + y3_var_real = `y3:real` and + y4_var_real = `y4:real` and + y5_var_real = `y5:real` and + y6_var_real = `y6:real`;; + + +let float_interval_delta_y pp y1 y2 y3 y4 y5 y6 = + let (|*|) = float_interval_mul pp in + let x1 = y1 |*| y1 and + x2 = y2 |*| y2 and + x3 = y3 |*| y3 and + x4 = y4 |*| y4 and + x5 = y5 |*| y5 and + x6 = y6 |*| y6 in + let get_tm = rand o rator o concl in + let y1_tm = get_tm y1 and + y2_tm = get_tm y2 and + y3_tm = get_tm y3 and + y4_tm = get_tm y4 and + y5_tm = get_tm y5 and + y6_tm = get_tm y6 in + + let int_th = float_interval_delta_x pp x1 x2 x3 x4 x5 x6 in + let delta_th = INST[y1_tm, y1_var_real; y2_tm, y2_var_real; y3_tm, y3_var_real; + y4_tm, y4_var_real; y5_tm, y5_var_real; y6_tm, y6_var_real] delta_y' in + EQ_MP (SYM (AP_THM (AP_TERM interval_const delta_th) (rand (concl int_th)))) int_th;; + + + + +(* +let x1 = mk_float_interval_small_num 1;; +let x2 = mk_float_interval_small_num 2;; +let x3 = mk_float_interval_small_num 3;; +let x4 = mk_float_interval_small_num 4;; +let x5 = mk_float_interval_small_num 5;; +let x6 = mk_float_interval_small_num 6;; + +float_interval_delta_x 5 x1 x2 x3 x4 x5 x6;; +(* 100: 1.248 *) +test 100 (float_interval_delta_x 5 x1 x2 x3 x4 x5) x6;; +*) + + +(* +let pp = 7;; +let mk_int = mk_float_interval_small_num;; +let (///) = float_interval_div pp;; + +let x1 = mk_int 1 /// mk_int 3 and + x2 = float_interval_sqrt pp (mk_int 2) and + x3 = mk_int 3 /// mk_int 11 and + x4 = mk_int 2 /// mk_int 61 and + x5 = mk_int 17 /// mk_int 13 and + x6 = pi_approx_array.(pp);; + +float_interval_delta_x pp x1 x2 x3 x4 x5 x6;; +(* 100: 0.632 *) +test 10 (float_interval_delta_x pp x1 x2 x3 x4 x5) x6;; +*) + + +(* +let pp = 10;; +let x1 = pi_approx_array.(pp);; +float_interval_delta_x pp x1 x1 x1 x1 x1 x1;; +float_interval_delta_y pp x1 x1 x1 x1 x1 x1;; +float_interval_delta_x4 pp x1 x1 x1 x1 x1 x1;; +*) + + +(**********************************) + +(* dih_x *) + + +let dih_x_interval = prove(`&0 < &4 * x1 * delta_x x1 x2 x3 x4 x5 x6 /\ + interval_arith (pi / &2 + atn (--delta_x4 x1 x2 x3 x4 x5 x6 / sqrt(&4 * x1 * delta_x x1 x2 x3 x4 x5 x6))) bounds + ==> interval_arith (dih_x x1 x2 x3 x4 x5 x6) bounds`, + REWRITE_TAC[Sphere.dih_x] THEN + CONV_TAC (DEPTH_CONV let_CONV) THEN + MAP_EVERY ABBREV_TAC [`d = delta_x x1 x2 x3 x4 x5 x6`; `d4 = delta_x4 x1 x2 x3 x4 x5 x6`] THEN + STRIP_TAC THEN + SUBGOAL_THEN `atn2 (sqrt (&4 * x1 * d), --d4) = atn(--d4 / sqrt (&4 * x1 * d))` MP_TAC THENL + [ + MP_TAC ((CONJUNCT1 o SPECL[`sqrt(&4 * x1 * d)`; `--d4`]) Trigonometry1.ATN2_BREAKDOWN) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC SQRT_POS_LT THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> ASM_REWRITE_TAC[th]));; + + + +let FLOAT_INTERVAL_GT0 = prove(`interval_arith x (lo, hi) /\ (&0 < lo <=> T) + ==> &0 < x`, + REWRITE_TAC[interval_arith] THEN + REAL_ARITH_TAC);; + +let FLOAT_INTERVAL_GT0' = (UNDISCH_ALL o PURE_REWRITE_RULE[GSYM IMP_IMP]) FLOAT_INTERVAL_GT0;; + + + +let float_interval_gt0 x_th = + let x_tm, lo_tm, hi_tm = dest_float_interval (concl x_th) in + let gt_th = float_gt0 lo_tm in + if (fst o dest_const o rand o concl) gt_th <> "T" then + failwith "float_interval_gt0" + else + let th0 = INST[x_tm, x_var_real; lo_tm, lo_var_real; hi_tm, hi_var_real] FLOAT_INTERVAL_GT0' in + MY_PROVE_HYP x_th (MY_PROVE_HYP gt_th th0);; + + + + +let DIH_X_INTERVAL' = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP]) dih_x_interval;; +let float_interval_4 = mk_float_interval_small_num 4;; + +let float_interval_dih_x pp x1 x2 x3 x4 x5 x6 = + let (|*|) = float_interval_mul pp in + let d_int = float_interval_delta_x pp x1 x2 x3 x4 x5 x6 in + let d4_int = float_interval_delta_x4 pp x1 x2 x3 x4 x5 x6 in + let int1 = float_interval_4 |*| (x1 |*| d_int) in + let x_int = float_interval_sqrt pp int1 in + let y_int = float_interval_neg d4_int in + let atn_int = float_interval_atn pp (float_interval_div pp y_int x_int) in + let int_th = float_interval_add pp pi2_approx_array.(pp) atn_int in + + let bounds = (rand o concl) int_th in + let get_tm = rand o rator o concl in + let x1_tm = get_tm x1 and + x2_tm = get_tm x2 and + x3_tm = get_tm x3 and + x4_tm = get_tm x4 and + x5_tm = get_tm x5 and + x6_tm = get_tm x6 in + + let gt_th = float_interval_gt0 int1 in + let th0 = INST[bounds, bounds_var_pair; + x1_tm, x1_var_real; x2_tm, x2_var_real; x3_tm, x3_var_real; + x4_tm, x4_var_real; x5_tm, x5_var_real; x6_tm, x6_var_real] DIH_X_INTERVAL' in + MY_PROVE_HYP int_th (MY_PROVE_HYP gt_th th0);; + + +(* +let pp = 7;; +let x1 = pi_approx_array.(pp);; +float_interval_dih_x pp x1 x1 x1 x1 x1 x1;; + +(* 10: 1.628 *) +test 10 (float_interval_dih_x pp x1 x1 x1 x1 x1) x1;; +*) + + +(* dih_y *) + +let dih_y' = (SYM o SPEC_ALL o CONV_RULE (DEPTH_CONV let_CONV)) Sphere.dih_y;; + + +let float_interval_dih_y pp y1 y2 y3 y4 y5 y6 = + let (|*|) = float_interval_mul pp in + let x1 = y1 |*| y1 and + x2 = y2 |*| y2 and + x3 = y3 |*| y3 and + x4 = y4 |*| y4 and + x5 = y5 |*| y5 and + x6 = y6 |*| y6 in + let get_tm = rand o rator o concl in + let y1_tm = get_tm y1 and + y2_tm = get_tm y2 and + y3_tm = get_tm y3 and + y4_tm = get_tm y4 and + y5_tm = get_tm y5 and + y6_tm = get_tm y6 in + + let int_th = float_interval_dih_x pp x1 x2 x3 x4 x5 x6 in + let y_th = INST[y1_tm, y1_var_real; y2_tm, y2_var_real; y3_tm, y3_var_real; + y4_tm, y4_var_real; y5_tm, y5_var_real; y6_tm, y6_var_real] dih_y' in + EQ_MP (AP_THM (AP_TERM interval_const y_th) (rand (concl int_th))) int_th;; + + +(* + +let pp = 15;; +let x1 = pi_approx_array.(pp);; +float_interval_dih_x pp x1 x1 x1 x1 x1 x1;; + +float_interval_dih_y pp x1 x1 x1 x1 x1 x1;; +float_interval_dih_x pp x1 x1 x1 x1 x1 x1;; + +*) + +(***********************************) + + +end;; diff --git a/formal_lp/old/arith/float_test.hl b/formal_lp/old/arith/float_test.hl new file mode 100644 index 0000000..db635be --- /dev/null +++ b/formal_lp/old/arith/float_test.hl @@ -0,0 +1,166 @@ +needs "../formal_lp/arith/float.hl";; +needs "../formal_lp/arith/arith_hash_rat.hl";; + + + +let rec float_interval_test pp expr x_th = + if is_var expr then + x_th + else + let ltm, r_tm = dest_comb expr in + if is_comb ltm then + let op, l_tm = dest_comb ltm in + let l_th = float_interval_test pp l_tm x_th in + let r_th = float_interval_test pp r_tm x_th in + if op = plus_op_real then + float_interval_add pp l_th r_th + else if op = mul_op_real then + float_interval_mul pp l_th r_th + else if op = div_op_real then + float_interval_div pp l_th r_th + else if op = minus_op_real then + float_interval_sub pp l_th r_th + else + failwith ("Unknown operation: " ^ (fst o dest_const) op) + else + if ltm = neg_op_real then + let r_th = float_interval_test pp r_tm x_th in + float_interval_neg r_th + else + mk_float_interval_num (dest_numeral r_tm);; + + +let rec rat_arith_test expr x_th = + if is_var expr then + x_th + else + let ltm, r_tm = dest_comb expr in + if is_comb ltm then + let op, l_tm = dest_comb ltm in + let l_th = rat_arith_test l_tm x_th in + let r_th = rat_arith_test r_tm x_th in + let th0 = MK_COMB (AP_TERM op l_th, r_th) in + let rtm = rand(concl th0) in + let th1 = + if op = plus_op_real then + my_real_rat_add_conv rtm + else if op = mul_op_real then + my_real_rat_mul_conv rtm + else if op = div_op_real then + my_real_rat_div_conv rtm + else + failwith ("Unknown operation: " ^ (fst o dest_const) op) in + TRANS th0 th1 + else + AP_TERM ltm (NUMERAL_TO_NUM_CONV r_tm);; + + + + + +let expr1 = `&1 + x + x*x / &2 + x*x*x / &6 + x*x*x*x / &24 + x*x*x*x*x / &120 + x*x*x*x*x*x / &720`;; +let expr2 = `&1 + x*(&1 + x*(&1 / &2 + x*(&1 / &6 + x*(&1 / &24 + x*(&1 / &120 + x / &720)))))`;; +let expr3 = `&1 + x*x*(--(&1 / &2) + x*x*(&1 / &24 + x*x*(--(&1 / &720) + x*x*(&1 / &40320 + x*x*(--(&1 / &3628800) + x*x / &479001600)))))`;; +let eps_expr = `x*x*x*x*x*x*x*x*x*x*x*x*x*x / &87178291200`;; + + +let f x = + 1. +. x*.x*.(~-. 0.5 +. x*.x*.(1. /. 24. +. x*.x*.(~-.1. /. 720. +. x*.x*.(1. /. 40320. +. x*.x*.(~-. 1. /. 3628800. +. x*.x /. 479001600.)))));; + +f 1.230959417;; + + + +let int1 = mk_float_interval_small_num 1 and + int3 = mk_float_interval_small_num 3 and + int234451 = mk_float_interval_small_num 234451 and + int1234567 = mk_float_interval_small_num 1234567;; + + +let pp = 10;; + +let x1_th = int1;; +let x2_th = float_interval_div pp int1 int3;; +let x3_th = float_interval_div pp int234451 int1234567;; + +let x_th = + let n = mk_float_interval_num (Num.num_of_string "1230959417") in + let d = mk_float_interval_num (Num.num_of_string "1000000000") in + float_interval_div pp n d;; + +(* pp = 11: + 10, min_exp = 20: 0.180 + 100, min_exp = 20: 0.144 *) +(* pp = 6: + 100, min_exp = 20: 0.116 *) +(* pp = 5: + 8, min_exp = 20: 0.060 *) + +float_interval_test pp expr3 x_th;; +test 1 (float_interval_test pp expr3) x_th;; + +float_interval_test pp eps_expr x_th;; + +let th1 = float_interval_test pp expr3 x_th;; +let th2 = float_interval_sub pp th1 x2_th;; + + +float_interval_test pp expr3 x1_th;; +float_interval_test pp expr3 x2_th;; +float_interval_test pp expr3 x3_th;; + + +let y1_th = REPLACE_NUMERALS_CONV `&1`;; +let y2_th = REPLACE_NUMERALS_CONV `&1 / &3`;; +let y3_th = REPLACE_NUMERALS_CONV `&234451 / &1234567`;; + +rat_arith_test expr1 y1_th;; +float_interval_test pp expr1 x1_th;; + +rat_arith_test expr2 y1_th;; +float_interval_test pp expr2 x1_th;; + +rat_arith_test expr1 y2_th;; +float_interval_test pp expr1 x2_th;; + +rat_arith_test expr2 y2_th;; +float_interval_test pp expr2 x2_th;; + +rat_arith_test expr1 y3_th;; +float_interval_test pp expr1 x3_th;; + +rat_arith_test expr2 y3_th;; +float_interval_test pp expr2 x3_th;; + + + + +(* 4: 0.624 *) +test 100 (rat_arith_test expr1) y1_th;; +(* 4: 2.028 *) +test 100 (float_interval_test pp expr1) x1_th;; + +(* 4: 0.496 *) +test 100 (rat_arith_test expr2) y1_th;; +(* 4: 1.756 *) +test 100 (float_interval_test pp expr2) x1_th;; + +(* 4: 1.012 *) +test 100 (rat_arith_test expr1) y2_th;; +(* 4: 4.252 *) +test 100 (float_interval_test pp expr1) x2_th;; + +(* 4: 0.760 *) +test 100 (rat_arith_test expr2) y2_th;; +(* 4: 2.460 *) +test 100 (float_interval_test pp expr2) x2_th;; + +(* 4: 5.732 *) +test 10 (rat_arith_test expr1) y3_th;; +(* 4: 0.468 *) +test 10 (float_interval_test pp expr1) x3_th;; + +(* 4: 1.504 *) +test 100 (rat_arith_test expr2) y3_th;; +(* 4: 0.244 *) +test 100 (float_interval_test pp expr2) x3_th;; diff --git a/formal_lp/old/arith/float_theory.hl b/formal_lp/old/arith/float_theory.hl new file mode 100644 index 0000000..5ff1baf --- /dev/null +++ b/formal_lp/old/arith/float_theory.hl @@ -0,0 +1,92 @@ +(* Theoretical results for the floating-point arithmetic *) + +(* Dependencies *) +needs "../formal_lp/arith/nat.hl";; +needs "../formal_lp/arith/num_exp_theory.hl";; + +module Float_theory = struct + +open Num_exp_theory;; +open Arith_nat;; +open Arith_options;; + +(* The main definition *) +let min_exp_num_const = rand (mk_small_numeral_array min_exp);; +let min_exp_const = mk_small_numeral min_exp;; + +let min_exp_def = new_definition (mk_eq(`min_exp:num`, min_exp_const));; + + +let float_tm = `float s n e = (if s then (-- &1) else &1) * &(num_exp n e) / &(num_exp 1 min_exp)`;; +let float = new_definition float_tm;; + +let FLOAT_OF_NUM = (GEN_ALL o prove)(`&n = float F n min_exp`, + REWRITE_TAC[float; num_exp; REAL_MUL_LID] THEN + REWRITE_TAC[GSYM REAL_OF_NUM_MUL; REAL_MUL_LID; real_div] THEN + SUBGOAL_THEN (mk_comb(`(~)`, mk_eq(mk_comb(`&`, mk_binop `EXP` base_const `min_exp`), `&0`))) ASSUME_TAC THENL + [ + REWRITE_TAC[REAL_OF_NUM_EQ; EXP_EQ_0] THEN ARITH_TAC; + ALL_TAC + ] THEN + ASM_SIMP_TAC[GSYM REAL_MUL_ASSOC; REAL_MUL_RINV; REAL_MUL_RID]);; + + + +let FLOAT_NEG = prove(`!s n e. --float s n e = float (~s) n e`, + REWRITE_TAC[float] THEN REAL_ARITH_TAC);; + + +let FLOAT_NEG_F = (GSYM o REWRITE_RULE[] o SPEC `T`) FLOAT_NEG;; +let FLOAT_NEG_T = (GSYM o REWRITE_RULE[] o SPEC `F`) FLOAT_NEG;; + + + + +let FLOAT_F_POS = prove(`!n e. &0 <= float F n e`, + REPEAT GEN_TAC THEN REWRITE_TAC[float; REAL_MUL_LID; real_div] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + REWRITE_TAC[REAL_POS; REAL_LE_INV_EQ]);; + + +let FLOAT_T_NEG = prove(`!n e. float T n e <= &0`, + REPEAT GEN_TAC THEN REWRITE_TAC[float; real_div] THEN + REWRITE_TAC[REAL_ARITH `-- &1 * a * b <= &0 <=> &0 <= a * b`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + REWRITE_TAC[REAL_POS; REAL_LE_INV_EQ]);; + + + +let FLOAT_EQ_0 = prove(`!s n e. float s n e = &0 <=> n = 0`, + REPEAT GEN_TAC THEN REWRITE_TAC[float; real_div] THEN + REWRITE_TAC[REAL_ENTIRE] THEN + EQ_TAC THENL + [ + STRIP_TAC THEN POP_ASSUM MP_TAC THENL + [ + COND_CASES_TAC THEN REAL_ARITH_TAC; + REWRITE_TAC[REAL_OF_NUM_EQ; NUM_EXP_EQ_0]; + REWRITE_TAC[REAL_INV_EQ_0; REAL_OF_NUM_EQ; NUM_EXP_EQ_0] THEN + ARITH_TAC + ]; + + DISCH_TAC THEN + DISJ2_TAC THEN DISJ1_TAC THEN + ASM_REWRITE_TAC[REAL_OF_NUM_EQ; NUM_EXP_EQ_0] + ]);; + + +let FLOAT_F_bound = (GEN_ALL o prove)(`num_exp n1 e1 <= num_exp n2 e2 + ==> float F n1 e1 <= float F n2 e2`, + DISCH_TAC THEN + REWRITE_TAC[float; REAL_MUL_LID; real_div] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + ASM_REWRITE_TAC[REAL_OF_NUM_LE; REAL_LE_INV_EQ; REAL_POS]);; + + +let FLOAT_T_bound = (GEN_ALL o prove)(`num_exp n1 e1 <= num_exp n2 e2 + ==> float T n2 e2 <= float T n1 e1`, + REWRITE_TAC[FLOAT_NEG_T; REAL_LE_NEG; FLOAT_F_bound]);; + + + +end;; diff --git a/formal_lp/old/arith/informal/informal_arith.hl b/formal_lp/old/arith/informal/informal_arith.hl new file mode 100644 index 0000000..cea2e9a --- /dev/null +++ b/formal_lp/old/arith/informal/informal_arith.hl @@ -0,0 +1,904 @@ +(* Dependencies *) +needs "../formal_lp/arith/misc.hl";; +needs "../formal_lp/arith/arith_options.hl";; + + +(* Natural numbers *) + +module type Informal_nat_sig = + sig + type nat + val mk_nat : num -> nat + val mk_small_nat : int -> nat + val dest_nat : nat -> num + val eq_nat : nat -> nat -> bool + val suc_nat : nat -> nat + val pre_nat : nat -> nat + val eq0_nat : nat -> bool + val gt0_nat : nat -> bool + val lt_nat : nat -> nat -> bool + val le_nat : nat -> nat -> bool + val add_nat : nat -> nat -> nat + val sub_nat : nat -> nat -> nat + (* If sub_and_le_nat m n = (m - n, true) if n <= m; (n - m, false) if m < n *) + val sub_and_le_nat : nat -> nat -> nat * bool + val mul_nat : nat -> nat -> nat + val div_nat : nat -> nat -> nat + val even_nat : nat -> bool + val odd_nat : nat -> bool + + (* normalize_nat m = (n, e) s.t. m = n * base^e, e >= 0 *) + val normalize_nat : nat -> nat * int + val denormalize_nat : nat * int -> nat + (* hi_nat p m = (n, e) s.t. m <= n * base^e and n contains at most p "digits" *) + val hi_nat : int -> nat -> nat * int + val hi_lt_nat : int -> nat -> nat * int + (* lo_nat p m = (n, e) s.t. n * base^e <= m and n contains at most p "digits" *) + val lo_nat : int -> nat -> nat * int + end;; + + + +module Informal_nat : Informal_nat_sig = struct + +open Arith_misc;; +open Arith_options;; +open Big_int;; + +type nat = big_int;; + +let mk_nat n = + let result = big_int_of_num n in + if sign_big_int result < 0 then zero_big_int else result;; + +let mk_small_nat n = + if n < 0 then zero_big_int else big_int_of_int n;; + +let dest_nat = num_of_big_int;; + +let eq_nat = eq_big_int;; + +let suc_nat = succ_big_int;; + +let pre_nat n = + let result = pred_big_int n in + if sign_big_int result < 0 then zero_big_int else result;; + +let eq0_nat n = sign_big_int n = 0;; + +let gt0_nat n = sign_big_int n > 0;; + +let lt_nat = lt_big_int;; + +let le_nat = le_big_int;; + +let add_nat = add_big_int;; + +let sub_nat m n = + let result = sub_big_int m n in + if sign_big_int result < 0 then zero_big_int else result;; + +let sub_and_le_nat m n = + let result = sub_big_int m n in + if sign_big_int result >= 0 then (result, true) else (abs_big_int result, false);; + +let mul_nat = mult_big_int;; + +let div_nat = div_big_int;; + +let two_big_int = big_int_of_int 2;; + +let even_nat n = sign_big_int (mod_big_int n two_big_int) = 0;; + +let odd_nat n = sign_big_int (mod_big_int n two_big_int) > 0;; + +(*******************************) +(* num_exp *) + +let base_nat = mk_small_nat base;; + +(* normalize_nat m = (n, e) s.t. m = n * base^e, e >= 0 *) +let normalize_nat = + let rec normalize n e = + let q, r = quomod_big_int n base_nat in + if sign_big_int r > 0 then + (n, e) + else + normalize q (succ e) in + fun n -> + if sign_big_int n = 0 then (n, 0) else normalize n 0;; + + +let denormalize_nat (n, e) = + mult_big_int n (power_int_positive_int base e);; + + +let lo_nat pp = + let max = power_int_positive_int base pp in + let rec lo m e = + if lt_big_int m max then + (m, e) + else + let q = div_big_int m base_nat in + lo q (succ e) in + fun m -> + if sign_big_int m = 0 then + (m, 0) + else + let n1, e1 = lo m 0 in + let n, e2 = normalize_nat n1 in + n, e1 + e2;; + + +let hi_nat pp = + if pp <= 0 then failwith "hi_nat: pp <= 0" else + let max = power_int_positive_int base pp in + let rec hi m e = + if lt_big_int m max then + (m, e) + else + let q, r = quomod_big_int m base_nat in + if sign_big_int r = 0 then + hi q (succ e) + else + hi (succ_big_int q) (succ e) in + fun m -> + if sign_big_int m = 0 then + (m, 0) + else + let n1, e1 = hi m 0 in + let n, e2 = normalize_nat n1 in + n, e1 + e2;; + + +let hi_lt_nat pp m = + hi_nat pp (succ_big_int m);; + + +end;; + + + +(* Floating point numbers *) + +module type Informal_float_sig = + sig + type ifloat + val mk_float : num -> int -> ifloat + val mk_num_float : num -> ifloat + val mk_small_num_float : int -> ifloat + val dest_float : ifloat -> bool * num * int + val sign_float : ifloat -> bool + (* Compares representations, not numbers themselves *) + val eq_float : ifloat -> ifloat -> bool + val lo_float : int -> ifloat -> ifloat + val hi_float : int -> ifloat -> ifloat + val neg_float : ifloat -> ifloat + val abs_float : ifloat -> ifloat + val lt0_float : ifloat -> bool + val gt0_float : ifloat -> bool + val le0_float : ifloat -> bool + val ge0_float : ifloat -> bool + val lt_float : ifloat -> ifloat -> bool + val le_float : ifloat -> ifloat -> bool + val min_float : ifloat -> ifloat -> ifloat + val max_float : ifloat -> ifloat -> ifloat + val mul_float_eq : ifloat -> ifloat -> ifloat + val mul_float_lo : int -> ifloat -> ifloat -> ifloat + val mul_float_hi : int -> ifloat -> ifloat -> ifloat + val div_float_lo : int -> ifloat -> ifloat -> ifloat + val div_float_hi : int -> ifloat -> ifloat -> ifloat + val add_float_lo : int -> ifloat -> ifloat -> ifloat + val add_float_hi : int -> ifloat -> ifloat -> ifloat + val sub_float_lo : int -> ifloat -> ifloat -> ifloat + val sub_float_hi : int -> ifloat -> ifloat -> ifloat + val sqrt_float_lo : int -> ifloat -> ifloat + val sqrt_float_hi : int -> ifloat -> ifloat + end;; + +module Informal_float : Informal_float_sig = struct + +open Arith_options;; +open Informal_nat;; + +type ifloat = bool * nat * int;; + +(* Creates a non-negative float *) +let mk_float n e : ifloat = false, mk_nat n, e;; + +let mk_num_float n = false, mk_nat n, min_exp;; + +let mk_small_num_float n = false, mk_small_nat n, min_exp;; + +let dest_float ((s, n, e) : ifloat) = s, dest_nat n, e;; + +let sign_float ((s,_,_) : ifloat) = s;; + +let eq_float (s1,n1,e1) (s2,n2,e2) = s1 = s2 && eq_nat n1 n2 && e1 = e2;; + +let lo_float pp (s,n,e) = + let n1, e1 = if s then hi_nat pp n else lo_nat pp n in + (s, n1, e + e1);; + +let hi_float pp (s,n,e) = + let n1, e1 = if s then lo_nat pp n else hi_nat pp n in + (s, n1, e + e1);; + +(* Auxiliary num_exp functions *) + +let num_exp_add = + let (+) = add_nat in + fun (n1,e1) (n2,e2) -> + if e1 <= e2 then + n1 + denormalize_nat (n2, e2 - e1), e1 + else + n2 + denormalize_nat (n1, e1 - e2), e2;; + + +(* Returns (n,e),true if (n1,e1) >= (n2,e2) and (n,e) = (n1,e1) - (n2,e2) + Returns (n,e),false if (n1,e1) <= (n2,e2) and (n,e) = (n2,e2) - (n1,e1) *) +let num_exp_sub = + let (--) = sub_and_le_nat in + fun (n1,e1) (n2,e2) -> + if e2 <= e1 then + let a = denormalize_nat (n1, e1 - e2) and + b = n2 in + let sub, flag = a -- b in + (sub, e2), flag + else + let a = n1 and + b = denormalize_nat (n2, e2 - e1) in + let sub, flag = a -- b in + (sub, e1), flag;; + + +let num_exp_le = + let (<=/) = le_nat in + fun (n1,e1) (n2,e2) -> + if e1 <= e2 then + n1 <=/ denormalize_nat (n2, e2 - e1) + else + denormalize_nat (n1, e1 - e2) <=/ n2;; + + +let num_exp_lt = + let ( + if e1 <= e2 then + n1 interval + val mk_num_interval : num -> interval + val mk_small_num_interval : int -> interval + val dest_interval : interval -> Informal_float.ifloat * Informal_float.ifloat + val round_interval : int -> interval -> interval + val neg_interval : interval -> interval + val mul_interval : int -> interval -> interval -> interval + val div_interval : int -> interval -> interval -> interval + val add_interval : int -> interval -> interval -> interval + val sub_interval : int -> interval -> interval -> interval + val sqrt_interval : int -> interval -> interval + val inv_interval : int -> interval -> interval + val pow_interval : int -> int -> interval -> interval + (* Computes max(-lo, hi) *) + val abs_interval : interval -> Informal_float.ifloat + end;; + +module Informal_interval : Informal_interval_sig = struct + +open Informal_float;; + + +type interval = ifloat * ifloat;; + +let mk_interval (lo,hi) = + if lt_float hi lo then failwith "mk_interval: hi < lo" else (lo,hi);; + +let mk_num_interval n = + let f = mk_num_float n in (f, f);; + +let mk_small_num_interval n = + let f = mk_small_num_float n in (f, f);; + +let one_interval = mk_small_num_interval 1;; +let two_interval = mk_small_num_interval 2;; + +let dest_interval ((lo,hi) : interval) = (lo,hi);; + +let round_interval pp (lo,hi) = (lo_float pp lo, hi_float pp hi);; + +let neg_interval (lo,hi) = (neg_float hi, neg_float lo);; + +let abs_interval (lo,hi) = max_float hi (neg_float lo);; + +let add_interval pp (lo1,hi1) (lo2,hi2) = + (add_float_lo pp lo1 lo2, add_float_hi pp hi1 hi2);; + +let sub_interval pp (lo1,hi1) (lo2,hi2) = + (sub_float_lo pp lo1 hi2, sub_float_hi pp hi1 lo2);; + +let sqrt_interval pp (lo,hi) = + if sign_float lo then + failwith "sqrt_interval: negative lower bound" + else + (sqrt_float_lo pp lo, sqrt_float_hi pp hi);; + +(* mul *) +let mul_interval pp (l_lo,l_hi) (r_lo,r_hi) = + let s1 = sign_float l_lo and + s2 = sign_float l_hi and + s3 = sign_float r_lo and + s4 = sign_float r_hi in + if s1 <> s2 && s3 <> s4 then + if not s1 or not s3 then + failwith "mul_interval: FT interval" + else + let lo1, lo2 = mul_float_lo pp l_lo r_hi, mul_float_lo pp l_hi r_lo and + hi1, hi2 = mul_float_hi pp l_lo r_lo, mul_float_hi pp l_hi r_hi in + (min_float lo1 lo2, max_float hi1 hi2) + else + let lo1, lo2, hi1, hi2 = + if s1 <> s2 then + if not s1 then + failwith "mul_interval: FT interval" + else + if not s3 then + l_lo, r_hi, l_hi, r_hi + else + l_hi, r_lo, l_lo, r_lo + else + if s3 <> s4 then + if not s3 then + failwith "mul_interval: FT interval" + else + if not s1 then + l_hi, r_lo, l_hi, r_hi + else + l_lo, r_hi, l_lo, r_lo + else + if not s1 then + if not s3 then + l_lo, r_lo, l_hi, r_hi + else + l_hi, r_lo, l_lo, r_hi + else + if not s3 then + l_lo, r_hi, l_hi, r_lo + else + l_hi, r_hi, l_lo, r_lo in + (mul_float_lo pp lo1 lo2, mul_float_hi pp hi1 hi2);; + +(* div *) +let div_interval pp (l_lo,l_hi) (r_lo,r_hi) = + let s1 = sign_float l_lo and + s2 = sign_float l_hi and + s3 = sign_float r_lo and + s4 = sign_float r_hi in + if s3 <> s4 then + failwith "div_interval: division by an interval containing 0" + else + let lo1, lo2, hi1, hi2 = + if s1 = s2 then + if not s1 then + if not s3 then + l_lo, r_hi, l_hi, r_lo + else + l_hi, r_hi, l_lo, r_lo + else + if not s3 then + l_lo, r_lo, l_hi, r_hi + else + l_hi, r_lo, l_lo, r_hi + else + if not s1 then + failwith "div_interval: FT interval" + else + if not s3 then + l_lo, r_lo, l_hi, r_lo + else + l_hi, r_hi, l_lo, r_hi in + (div_float_lo pp lo1 lo2, div_float_hi pp hi1 hi2);; + +(* inv *) +let inv_interval pp int = + div_interval pp one_interval int;; + +(* pow *) +let pow_interval pp n int = + let rec pow n = + if n <= 0 then + one_interval + else if n = 1 then + int + else + let i2 = pow (n - 1) in + mul_interval pp int i2 in + pow n;; + + +(* Arith_misc.gen_pow (mul_interval pp) one_interval n;; *) + +end;; + + +(* atn *) +module type Informal_atn_sig = + sig + val atn_interval : int -> Informal_interval.interval -> Informal_interval.interval + val acs_interval : int -> Informal_interval.interval -> Informal_interval.interval + val pi_approx_array : Informal_interval.interval array + val pi2_approx_array : Informal_interval.interval array + end;; + + +module Informal_atn : Informal_atn_sig = struct + +open Informal_float;; +open Informal_interval;; + + +let rec poly_f_interval pp l x = + if length l = 0 then + failwith "poly_f_interval: an empty coefficient list" + else + let first = hd l in + if length l = 1 then + first + else + let r = poly_f_interval pp (tl l) x in + add_interval pp first (mul_interval pp x r);; + + +let poly_f_even_interval pp l x = + let xx = mul_interval pp x x in + poly_f_interval pp l xx;; + + +let poly_f_odd_interval pp l x = + let even = poly_f_even_interval pp l x in + mul_interval pp x even;; + + +let halfatn_interval pp x = + let xx = mul_interval pp x x in + let one_xx = add_interval pp one_interval xx in + let sqrt = sqrt_interval pp one_xx in + let one_sqrt = add_interval pp sqrt one_interval in + div_interval pp x one_sqrt;; + + +let halfatn4_interval pp x = + (halfatn_interval pp o halfatn_interval pp o halfatn_interval pp o halfatn_interval pp) x;; + + +(* Computes an interval for 16 * sum(0..n) (halfatn4_co x) *) +let atn_sum_interval = + let interval_16 = mk_small_num_interval 16 in + fun pp l x -> + let halfatn4 = halfatn4_interval pp x in + let poly = poly_f_odd_interval pp l halfatn4 in + mul_interval pp interval_16 poly;; + + +let atn0_interval pp l eps x = + let sum = atn_sum_interval pp l x in + let a, b = dest_interval sum in + let _, d = dest_interval eps in + let hi = add_float_hi pp b d in + let lo = sub_float_lo pp a d in + mk_interval (lo, hi);; + + +(* Computes an interval for 2 ^ -(6n + 5) *) +let compute_eps1 pp n = + let pow = pow_interval pp (6 * n + 5) two_interval in + inv_interval pp pow;; + + +let mk_atn_co_table pp n = + let get_val k = + let l = if (k land 1) = 0 then one_interval else neg_interval (one_interval) in + let r = mk_small_num_interval (2 * k + 1) in + div_interval pp l r in + map get_val (0--n);; + +(* Lookup tables *) +let n_of_p pp = + let x = (float_of_int (pp + 1) *. log (float_of_int Arith_options.base) /. log (2.0) -. 5.0) /. 6.0 in + let n = (int_of_float o ceil) x in + if n < 1 then 1 else n;; + +let atn_co_array = Array.init 21 (fun i -> mk_atn_co_table (i + 1) (n_of_p i));; +let eps1_array = Array.init 21 (fun i -> compute_eps1 (i + 1) (n_of_p i));; + + +let atn_interval pp x = + atn0_interval pp atn_co_array.(pp) eps1_array.(pp) x;; + + +(* pi approximation *) +let pi_approx_array, pi2_approx_array = + let pp = 20 in + let x = one_interval in + let r1 = atn_interval pp x in + let r2 = mul_interval pp (mk_small_num_interval 4) r1 in + let float_pi = r2 in + let float_pi2 = div_interval pp float_pi two_interval in + let pi_int0 = mk_small_num_interval 0 in + let pi2_int0 = pi_int0 in + Array.init 19 (fun i -> if i = 0 then pi_int0 else round_interval i float_pi), + Array.init 19 (fun i -> if i = 0 then pi2_int0 else round_interval i float_pi2);; + + +(* acs *) +let acs0_interval pp l eps1 x = + let int1 = sub_interval pp one_interval (mul_interval pp x x) in + let int2 = div_interval pp x (sqrt_interval pp int1) in + let atn_int = atn0_interval pp l eps1 int2 in + sub_interval pp pi2_approx_array.(pp + 1) atn_int;; + + +let acs_interval pp x = + acs0_interval pp atn_co_array.(pp) eps1_array.(pp) x;; + + +end;; + + +(* +needs "../formal_lp/arith/float_atn.hl";; + +open Float_atn;; +open Informal_atn;; + + +open Arith_float;; +open Informal_interval;; + +let n1 = 111 and + n2 = 33;; + +let a_th = mk_float_interval_small_num n1 and + b_th = mk_float_interval_small_num n2;; + +let a = mk_small_num_interval n1 and + b = mk_small_num_interval n2;; + + +let dest_int i = + let lo, hi = dest_interval i in + Informal_float.dest_float lo, Informal_float.dest_float hi;; + +let pp = 10;; + +float_interval_mul pp a_th b_th;; +dest_int (mul_interval pp a b);; + +float_interval_div pp a_th b_th;; +dest_int (div_interval pp a b);; + + + +let mk_f = (fst o dest_pair o rand o concl o mk_float_interval_small_num);; +let mk_neg_f = (fst o dest_pair o rand o concl o float_interval_neg o mk_float_interval_small_num);; +let mk_if n = mk_float (Num.num_of_int n) Arith_options.min_exp;; + +let n1 = 3 and + n2 = 121;; + +let f1_tm = mk_f n1 and + f2_tm = mk_f n2;; + + +let f1 = (mk_if n1) and + f2 = (mk_if n2);; + +let pp = 20;; + +float_sqrt_lo pp f1_tm;; +dest_float (sqrt_float_lo pp f1);; + +float_sqrt_lo pp f2_tm;; +dest_float (sqrt_float_lo pp f2);; + +float_sqrt_hi pp f1_tm;; +dest_float (sqrt_float_hi pp f1);; + +float_sqrt_hi pp f2_tm;; +dest_float (sqrt_float_hi pp f2);; + +open Arith_misc;; + +test 100 (float_sqrt_lo pp) f1_tm;; +test 100 (sqrt_float_lo pp) f1;; + +dest_float (sqrt_float_lo pp f1);; + +float_le0 f1_tm;; +le0_float f1;; +float_le0 f2_tm;; +le0_float f2;; + +float_lt f2_tm f1_tm;; +lt_float f2 f1;; + +float_le f2_tm f1_tm;; +le_float f2 f1;; + + +float_mul_eq f1_tm f2_tm;; +dest_float (mul_float_eq f1 f2);; + +let pp = 2;; + +float_add_lo pp f1_tm f2_tm;; +dest_float (add_float_lo pp f1 f2);; + +float_add_hi pp f1_tm f2_tm;; +dest_float (add_float_hi pp f1 f2);; + +float_sub_lo pp f1_tm f2_tm;; +dest_float (sub_float_lo pp f1 f2);; + +float_sub_hi pp f1_tm f2_tm;; +dest_float (sub_float_hi pp f1 f2);; + +float_mul_lo pp f1_tm f2_tm;; +dest_float (mul_float_lo pp f1 f2);; + +float_mul_hi pp f1_tm f2_tm;; +dest_float (mul_float_hi pp f1 f2);; + +float_div_lo pp f1_tm f2_tm;; +dest_float (div_float_lo pp f1 f2);; + +float_div_hi pp f1_tm f2_tm;; +dest_float (div_float_hi pp f1 f2);; + +open Arith_misc;; + +test 1000 (float_div_lo pp f1_tm) f2_tm;; +test 1000 (div_float_lo pp f1) f2;; + + + +*) diff --git a/formal_lp/old/arith/informal/informal_eval_interval.hl b/formal_lp/old/arith/informal/informal_eval_interval.hl new file mode 100644 index 0000000..a41f30b --- /dev/null +++ b/formal_lp/old/arith/informal/informal_eval_interval.hl @@ -0,0 +1,298 @@ +needs "../formal_lp/arith/informal/informal_arith.hl";; + +module Informal_eval_interval = struct + +open Informal_interval;; +open Informal_float;; +open Informal_atn;; + +(* Creates an interval approximation of the given decimal term *) +let mk_float_interval_decimal pp decimal_tm = + let n_tm, d_tm = dest_binary "DECIMAL" decimal_tm in + let n, d = dest_numeral n_tm, dest_numeral d_tm in + let n_int, d_int = mk_num_interval n, mk_num_interval d in + div_interval pp n_int d_int;; + + +(* Unary interval operations *) +let unary_interval_operations = + let table = Hashtbl.create 10 in + let add = Hashtbl.add in + add table "real_neg" (fun pp -> neg_interval); + add table "real_inv" inv_interval; + add table "sqrt" sqrt_interval; + add table "atn" atn_interval; + add table "acs" acs_interval; + table;; + + +(* Binary interval operations *) +let binary_interval_operations = + let table = Hashtbl.create 10 in + let add = Hashtbl.add in + add table "real_add" add_interval; + add table "real_sub" sub_interval; + add table "real_mul" mul_interval; + add table "real_div" div_interval; + table;; + + +(* Interval approximations of constants *) +let interval_constants = + let table = Hashtbl.create 10 in + let add = Hashtbl.add in + add table "pi" (fun pp -> pi_approx_array.(pp)); + table;; + + + +(* Type of an interval function *) +type interval_fun = + | Int_ref of int + | Int_var of int + | Int_const of interval + | Int_decimal_const of term + | Int_named_const of string + | Int_pow of int * interval_fun + | Int_unary of string * interval_fun + | Int_binary of string * interval_fun * interval_fun;; + + +(* Equality of interval functions *) +let rec eq_ifun ifun1 ifun2 = + match (ifun1, ifun2) with + | (Int_ref r1, Int_ref r2) -> r1 = r2 + | (Int_var v1, Int_var v2) -> v1 = v2 + | (Int_decimal_const tm1, Int_decimal_const tm2) -> tm1 = tm2 + | (Int_named_const name1, Int_named_const name2) -> name1 = name2 + | (Int_pow (n1, f1), Int_pow (n2, f2)) -> n1 = n2 && eq_ifun f1 f2 + | (Int_unary (op1, f1), Int_unary (op2, f2)) -> op1 = op2 && eq_ifun f1 f2 + | (Int_binary (op1, f1, g1), Int_binary (op2, f2, g2)) -> op1 = op2 && eq_ifun f1 f2 && eq_ifun g1 g2 + | (Int_const int1, Int_const int2) -> + let lo1, hi1 = dest_interval int1 and + lo2, hi2 = dest_interval int2 in + eq_float lo1 lo2 && eq_float hi1 hi2 + | _ -> false;; + + +(* Evaluates the given interval function at the point + defined by the given list of variables *) +let eval_interval_fun = + let u_find = Hashtbl.find unary_interval_operations and + b_find = Hashtbl.find binary_interval_operations and + c_find = Hashtbl.find interval_constants in + fun pp ifun vars refs -> + let rec rec_eval f = + match f with + | Int_ref i -> List.nth refs i + | Int_var i -> List.nth vars (i - 1) + | Int_const int -> int + | Int_decimal_const tm -> mk_float_interval_decimal pp tm + | Int_named_const name -> (c_find name) pp + | Int_pow (n,f1) -> pow_interval pp n (rec_eval f1) + | Int_unary (op,f1) -> (u_find op) pp (rec_eval f1) + | Int_binary (op,f1,f2) -> (b_find op) pp (rec_eval f1) (rec_eval f2) in + rec_eval ifun;; + + +(* Evaluates all sub-expressions involving constants in the given interval function *) +let eval_constants = + let u_find = Hashtbl.find unary_interval_operations and + b_find = Hashtbl.find binary_interval_operations and + c_find = Hashtbl.find interval_constants in + fun pp ifun -> + let rec rec_eval f = + match f with + | Int_decimal_const tm -> Int_const (mk_float_interval_decimal pp tm) + | Int_named_const name -> Int_const (c_find name pp) + | Int_pow (n, f1) -> + (let f1_val = rec_eval f1 in + match f1_val with + | Int_const int -> Int_const (pow_interval pp n int) + | _ -> Int_pow (n,f1_val)) + | Int_unary (op, f1) -> + (let f1_val = rec_eval f1 in + match f1_val with + | Int_const int -> Int_const (u_find op pp int) + | _ -> Int_unary (op, f1_val)) + | Int_binary (op, f1, f2) -> + (let f1_val, f2_val = rec_eval f1, rec_eval f2 in + match f1_val with + | Int_const int1 -> + (match f2_val with + | Int_const int2 -> Int_const (b_find op pp int1 int2) + | _ -> Int_binary (op, f1_val, f2_val)) + | _ -> Int_binary (op, f1_val, f2_val)) + | _ -> f in + rec_eval ifun;; + + + +(**************************************) + +(* Builds an interval function from the given term expression *) +let build_interval_fun = + let amp_op_real = `(&):num -> real` in + let rec rec_build expr_tm = + if is_const expr_tm then + (* Constant *) + Int_named_const (fst (dest_const expr_tm)) + else if is_var expr_tm then + (* Variables should be of the form name$i *) + failwith ("Variables should be of the form name$i: " ^ string_of_term expr_tm) + else + let ltm, r_tm = dest_comb expr_tm in + (* Unary operations *) + if is_const ltm then + (* & *) + if ltm = amp_op_real then + let n = dest_numeral r_tm in + Int_const (mk_num_interval n) + else + let r_fun = rec_build r_tm in + Int_unary ((fst o dest_const) ltm, r_fun) + else + (* Binary operations *) + let op, l_tm = dest_comb ltm in + let name = (fst o dest_const) op in + if name = "DECIMAL" then + (* DECIMAL *) + Int_decimal_const expr_tm + else if name = "real_pow" then + (* pow *) + let n = dest_small_numeral r_tm in + Int_pow (n, rec_build l_tm) + else if name = "$" then + (* $ *) + Int_var (dest_small_numeral (rand expr_tm)) + else + let lhs = rec_build l_tm and + rhs = rec_build r_tm in + Int_binary ((fst o dest_const) op, lhs, rhs) in + rec_build;; + + +(* Replaces the given subexpression with the given reference index + for all interval functions in the list. + Returns the number of replaces and a new list of interval functions *) +let replace_subexpr expr expr_index f_list = + let rec replace f = + if eq_ifun f expr then + 1, Int_ref expr_index + else + match f with + | Int_pow (k, f1) -> + let c, f1' = replace f1 in + c, Int_pow (k, f1') + | Int_unary (op, f1) -> + let c, f1' = replace f1 in + c, Int_unary (op, f1') + | Int_binary (op, f1, f2) -> + let c1, f1' = replace f1 in + let c2, f2' = replace f2 in + c1 + c2, Int_binary (op, f1', f2') + | _ -> 0, f in + let cs, fs = unzip (map replace f_list) in + itlist (+) cs 0, fs;; + + + +let is_leaf f = + match f with + | Int_pow _ -> false + | Int_unary _ -> false + | Int_binary _ -> false + | _ -> true;; + +let find_and_replace_all f_list acc = + let rec find_and_replace f i f_list = + if is_leaf f then + f, (0, f_list) + else + let expr, (c, fs) = + match f with + | Int_pow (k, f1) -> find_and_replace f1 i f_list + | Int_unary (op, f1) -> find_and_replace f1 i f_list + | Int_binary (op, f1, f2) -> + let expr, (c1, fs) = find_and_replace f1 i f_list in + if c1 > 1 then expr, (c1, fs) else find_and_replace f2 i f_list + | _ -> f, (0, f_list) in + if c > 1 then expr, (c, fs) else f, replace_subexpr f i f_list in + + let rec iterate fs acc = + let i = length acc in + let expr, (c, fs') = find_and_replace (hd fs) i fs in + if c > 1 then iterate fs' (acc @ [expr]) else fs, acc in + + let rec iterate_all f_list ref_acc f_acc = + match f_list with + | [] -> f_acc, ref_acc + | f :: fs -> + let fs', acc' = iterate f_list ref_acc in + iterate_all (tl fs') acc' (f_acc @ [hd fs']) in + + iterate_all f_list acc [];; + + +let eval_interval_fun_list pp (f_list, refs) vars = + let rec eval_refs refs acc = + match refs with + | [] -> acc + | r :: rs -> + let v = eval_interval_fun pp r vars acc in + eval_refs rs (acc @ [v]) in + let rs = eval_refs refs [] in + map (fun f -> eval_interval_fun pp f vars rs) f_list;; + + +end;; + + +(* +(* Tests *) +needs "../formal_lp/formal_interval/eval_interval.hl";; + +let pp = 7;; + +let var_tm = `&1 / #7.1`;; +let var = eval_interval_fun pp (build_interval_fun var_tm) [] [];; +let var0 = Informal_eval_interval.eval_interval_fun pp + (Informal_eval_interval.build_interval_fun var_tm) [] [];; + +let test_vars = [`(x:real^1)$1`, var];; +let test_vars0 = [var0];; +let test_expr1 = `(x:real^1)$1 * x$1 + (&3 * x$1) * x$1 * x$1 + &3 * x$1 + &3 * x$1`;; +let test_expr2 = `((x:real^1)$1 * x$1) * (x$1 * &2) + x$1 * &2`;; +let subexpr1 = `(x:real^1)$1 * x$1` and subexpr2 = `&3 * (x:real^1)$1`;; + +let test_f1 = build_interval_fun test_expr1 and + test_f2 = build_interval_fun test_expr2;; +let sub1 = build_interval_fun subexpr1 and sub2 = build_interval_fun subexpr2;; + +let f1, f2, s1, s2 = + let build = Informal_eval_interval.build_interval_fun in + build test_expr1, build test_expr2, build subexpr1, build subexpr2;; + +let v = find_and_replace_all [test_f1; test_f2] [];; +let v0 = Informal_eval_interval.find_and_replace_all [f1; f2] [];; + +let test_dest int = + let lo, hi = Informal_interval.dest_interval int in + Informal_float.dest_float lo, Informal_float.dest_float hi;; + +eval_interval_fun_list pp v test_vars;; +map test_dest (Informal_eval_interval.eval_interval_fun_list pp v0 test_vars0);; + +map (fun f -> eval_interval_fun pp f test_vars []) [test_f1; test_f2];; +let r = map (fun f -> Informal_eval_interval.eval_interval_fun pp f test_vars0 []) [f1; f2];; +map test_dest r;; + + +(* 0.712 *) +test 100 (map (fun f -> eval_interval_fun pp f test_vars [])) [test_f1; test_f2];; +(* 0.432 *) +test 100 (eval_interval_fun_list pp v) test_vars;; + +test 100 (map (fun f -> Informal_eval_interval.eval_interval_fun pp f test_vars0 [])) [f1; f2];; +test 100 (Informal_eval_interval.eval_interval_fun_list pp v0) test_vars0;; +*) diff --git a/formal_lp/old/arith/informal/informal_m_taylor.hl b/formal_lp/old/arith/informal/informal_m_taylor.hl new file mode 100644 index 0000000..ee82e02 --- /dev/null +++ b/formal_lp/old/arith/informal/informal_m_taylor.hl @@ -0,0 +1,540 @@ +(* Dependencies *) +needs "../formal_lp/arith/informal/informal_arith.hl";; +needs "../formal_lp/arith/informal/informal_eval_interval.hl";; + + +module Informal_taylor = struct + +open Informal_interval;; +open Informal_float;; +open Informal_atn;; +open Informal_eval_interval;; + + +type m_cell_domain = +{ + lo : ifloat list; + hi : ifloat list; + y : ifloat list; + w : ifloat list; +};; + + +type m_taylor_interval = +{ + n : int; + domain : m_cell_domain; + f : interval; + df : interval list; + ddf : interval list list; +};; + + +let float_0 = mk_small_num_float 0 and + float_1 = mk_small_num_float 1 and + float_2 = mk_small_num_float 2;; + +let float_inv2 = div_float_lo 1 float_1 float_2;; + +(* convert_to_float_list *) +let convert_to_float_list pp lo_flag list_tm = + let tms = dest_list list_tm in + let i_funs = map build_interval_fun tms in + let ints = map (fun f -> eval_interval_fun pp f [] []) i_funs in + let extract = (if lo_flag then fst else snd) o dest_interval in + map extract ints;; + + +(* mk_m_center_domain *) +let mk_m_center_domain pp x_list z_list = + let y_list = + let ( * ), (+) = mul_float_eq, add_float_hi pp in + map2 (fun x z -> if eq_float x z then x else float_inv2 * (x + z)) x_list z_list in + + (* test: x <= y <= z *) + let flag1 = itlist2 (fun x y a -> le_float x y && a) x_list y_list true and + flag2 = itlist2 (fun y z a -> le_float y z && a) y_list z_list true in + if not flag1 or not flag2 then + failwith "mk_m_center_domain: ~(x <= y <= z)" + else + let w_list = + let (-) = sub_float_hi pp in + let w1 = map2 (-) y_list x_list in + let w2 = map2 (-) z_list y_list in + map2 max_float w1 w2 in + {lo = x_list; hi = z_list; y = y_list; w = w_list};; + + +(* eval_m_taylor (pp0 for initial evaluation of constants) *) +let eval_m_taylor pp0 f_tm partials partials2 = + let build = eval_constants pp0 o build_interval_fun o snd o dest_abs in + let f = build f_tm in + let n = length partials in + (* Verify that the list of second partial derivatives is correct *) + let _ = map2 (fun i list -> if length list <> i then + failwith "eval_m_taylor: incorrect partials2" else ()) (1--n) partials2 in + let dfs = map (build o rand o concl) partials in + let d2fs = map (build o rand o concl) (List.flatten partials2) in + let f_dfs_list = find_and_replace_all (f :: dfs) [] in + let rec shape_list dd i = + if i >= n then [dd] else + let l1, l2 = chop_list i dd in + l1 :: shape_list l2 (i + 1) in + let d2fs_list = find_and_replace_all d2fs [] in + fun p_lin p_second domain -> + let y_ints = map (fun y -> mk_interval (y, y)) domain.y in + let xz_ints = map mk_interval (zip domain.lo domain.hi) in + let f_dfs_vals = eval_interval_fun_list p_lin f_dfs_list y_ints in + let d2fs_vals = eval_interval_fun_list p_second d2fs_list xz_ints in + {n = n; domain = domain; + f = hd f_dfs_vals; df = tl f_dfs_vals; + ddf = shape_list d2fs_vals 1};; + + +(* mk_eval_functionq *) +let mk_eval_function pp0 f_tm = + let build = eval_constants pp0 o build_interval_fun o snd o dest_abs in + let f = build f_tm in + let f_list = find_and_replace_all [f] [] in + fun pp x_list z_list -> + let xz_ints = map mk_interval (zip x_list z_list) in + let f_val = eval_interval_fun_list pp f_list xz_ints in + hd f_val;; + + +(* error_mul_f2_hi *) +let error_mul_f2_hi pp a int = mul_float_hi pp a (abs_interval int);; + + +(* eval_m_taylor_error *) +(* sum_{i = 1}^n (w_i * (f_ii * w_i + 2 * sum_{j = 1}^{i - 1} w_j * f_ij)) *) +let eval_m_taylor_error pp ti = + let w = ti.domain.w in + let ns = 1--ti.n in + let ( * ), ( + ) = mul_float_hi pp, add_float_hi pp in + let mul_wdd = map2 (fun list i -> Arith_misc.my_map2 (error_mul_f2_hi pp) w list) ti.ddf ns in + let sums1 = map (end_itlist ( + ) o butlast) (tl mul_wdd) in + let sums2 = (hd o hd) mul_wdd :: map2 (fun list t1 -> last list + float_2 * t1) (tl mul_wdd) sums1 in + let sums = map2 ( * ) w sums2 in + end_itlist ( + ) sums;; + + +(* eval_m_taylor_upper_bound *) +let eval_m_taylor_upper_bound pp ti = + let f_hi = (snd o dest_interval) ti.f in + let error = eval_m_taylor_error pp ti in + let ( * ), ( + ) = mul_float_hi pp, add_float_hi pp in + let sum2 = + let mul_wd = map2 (error_mul_f2_hi pp) ti.domain.w ti.df in + end_itlist ( + ) mul_wd in + let a = sum2 + float_inv2 * error in + f_hi + a;; + +(* eval_m_taylor_lower_bound *) +let eval_m_taylor_lower_bound pp ti = + let f_lo = (fst o dest_interval) ti.f in + let error = eval_m_taylor_error pp ti in + let ( * ), ( + ), ( - ) = mul_float_hi pp, add_float_hi pp, sub_float_lo pp in + let sum2 = + let mul_wd = map2 (error_mul_f2_hi pp) ti.domain.w ti.df in + end_itlist ( + ) mul_wd in + let a = sum2 + float_inv2 * error in + f_lo - a;; + + +(* eval_m_taylor_bound *) +let eval_m_taylor_bound pp ti = + let f_lo, f_hi = dest_interval ti.f in + let error = eval_m_taylor_error pp ti in + let ( * ), ( + ), ( - ) = mul_float_hi pp, add_float_hi pp, sub_float_lo pp in + let sum2 = + let mul_wd = map2 (error_mul_f2_hi pp) ti.domain.w ti.df in + end_itlist ( + ) mul_wd in + let a = sum2 + float_inv2 * error in + let hi = f_hi + a in + let lo = f_lo - a in + mk_interval (lo, hi);; + + +(* eval_m_taylor_partial_upper *) +let eval_m_taylor_partial_upper pp i ti = + let df_hi = (snd o dest_interval o List.nth ti.df) (i - 1) in + let dd_list = map (fun j -> if j <= i then + List.nth (List.nth ti.ddf (i - 1)) (j - 1) + else + List.nth (List.nth ti.ddf (j - 1)) (i - 1)) (1--ti.n) in + let sum2 = + let mul_dd = map2 (error_mul_f2_hi pp) ti.domain.w dd_list in + end_itlist (add_float_hi pp) mul_dd in + add_float_hi pp df_hi sum2;; + + +(* eval_m_taylor_partial_lower *) +let eval_m_taylor_partial_lower pp i ti = + let df_lo = (fst o dest_interval o List.nth ti.df) (i - 1) in + let dd_list = map (fun j -> if j <= i then + List.nth (List.nth ti.ddf (i - 1)) (j - 1) + else + List.nth (List.nth ti.ddf (j - 1)) (i - 1)) (1--ti.n) in + let sum2 = + let mul_dd = map2 (error_mul_f2_hi pp) ti.domain.w dd_list in + end_itlist (add_float_hi pp) mul_dd in + sub_float_lo pp df_lo sum2;; + + +(* eval_m_taylor_partial_bound *) +let eval_m_taylor_partial_bound pp i ti = + let df_lo, df_hi = (dest_interval o List.nth ti.df) (i - 1) in + let dd_list = map (fun j -> if j <= i then + List.nth (List.nth ti.ddf (i - 1)) (j - 1) + else + List.nth (List.nth ti.ddf (j - 1)) (i - 1)) (1--ti.n) in + let sum2 = + let mul_dd = map2 (error_mul_f2_hi pp) ti.domain.w dd_list in + end_itlist (add_float_hi pp) mul_dd in + let lo = sub_float_lo pp df_lo sum2 in + let hi = add_float_hi pp df_hi sum2 in + mk_interval (lo, hi);; + + +(* add *) +let eval_m_taylor_add p_lin p_second taylor1 taylor2 = + let ( + ), ( ++ ) = add_interval p_lin, add_interval p_second in + { + n = taylor1.n; + domain = taylor1.domain; + f = taylor1.f + taylor2.f; + df = map2 (+) taylor1.df taylor2.df; + ddf = map2 (map2 (++)) taylor1.ddf taylor2.ddf + };; + + +(* sub *) +let eval_m_taylor_sub p_lin p_second taylor1 taylor2 = + let ( - ), ( -- ) = sub_interval p_lin, sub_interval p_second in + { + n = taylor1.n; + domain = taylor1.domain; + f = taylor1.f - taylor2.f; + df = map2 (-) taylor1.df taylor2.df; + ddf = map2 (map2 (--)) taylor1.ddf taylor2.ddf + };; + + +(* mul *) +let eval_m_taylor_mul p_lin p_second ti1 ti2 = + let n = ti1.n in + let ns = 1--n in + let bounds = mul_interval p_lin ti1.f ti2.f in + let df = map2 (fun d1 d2 -> + let ( * ), ( + ) = mul_interval p_lin, add_interval p_lin in + d1 * ti2.f + ti1.f * d2) ti1.df ti2.df in + let d1_bounds = map (fun i -> eval_m_taylor_partial_bound p_second i ti1) ns in + let d2_bounds = map (fun i -> eval_m_taylor_partial_bound p_second i ti2) ns in + let f1_bound = eval_m_taylor_bound p_second ti1 in + let f2_bound = eval_m_taylor_bound p_second ti2 in + let ddf = + let ( * ), ( + ) = mul_interval p_second, add_interval p_second in + map2 (fun (list1, list2) i -> + let di1 = List.nth d1_bounds (i - 1) in + let di2 = List.nth d2_bounds (i - 1) in + map2 (fun (dd1, dd2) j -> + let dj1 = List.nth d1_bounds (j - 1) in + let dj2 = List.nth d2_bounds (j - 1) in + (dd1 * f2_bound + di1 * dj2) + (dj1 * di2 + f1_bound * dd2)) + (zip list1 list2) (1--i)) (zip ti1.ddf ti2.ddf) ns in + { + n = n; + domain = ti1.domain; + f = bounds; + df = df; + ddf = ddf; + };; + + +(* inv *) +let eval_m_taylor_inv p_lin p_second ti = + let n = ti.n in + let ns = 1--n in + let f1_bound = eval_m_taylor_bound p_second ti in + let bounds = inv_interval p_lin ti.f in + let u_bounds = + let neg, inv, ( * ) = neg_interval, inv_interval p_lin, mul_interval p_lin in + neg (inv (ti.f * ti.f)) in + let df = + let ( * ) = mul_interval p_lin in + map (fun d -> u_bounds * d) ti.df in + let d1_bounds = map (fun i -> eval_m_taylor_partial_bound p_second i ti) ns in + let d1, d2 = + let inv, ( * ) = inv_interval p_second, mul_interval p_second in + let ff = f1_bound * f1_bound in + inv ff, two_interval * inv (f1_bound * ff) in + let ddf = + let ( * ), ( - ) = mul_interval p_second, sub_interval p_second in + map2 (fun dd_list di1 -> + Arith_misc.my_map2 (fun dd dj1 -> + (d2 * dj1) * di1 - d1 * dd) dd_list d1_bounds) ti.ddf d1_bounds in + { + n = n; + domain = ti.domain; + f = bounds; + df = df; + ddf = ddf; + };; + + +(* sqrt *) +let eval_m_taylor_sqrt p_lin p_second ti = + let n = ti.n in + let ns = 1--n in + let f1_bound = eval_m_taylor_bound p_second ti in + let bounds = sqrt_interval p_lin ti.f in + let u_bounds = + let inv, ( * ) = inv_interval p_lin, mul_interval p_lin in + inv (two_interval * bounds) in + let df = + let ( * ) = mul_interval p_lin in + map (fun d -> u_bounds * d) ti.df in + let d1_bounds = map (fun i -> eval_m_taylor_partial_bound p_second i ti) ns in + let d1, d2 = + let neg, sqrt, inv, ( * ) = neg_interval, sqrt_interval p_second, + inv_interval p_second, mul_interval p_second in + let two_sqrt_f = two_interval * sqrt f1_bound in + inv two_sqrt_f, neg (inv (two_sqrt_f * (two_interval * f1_bound))) in + let ddf = + let ( * ), ( + ) = mul_interval p_second, add_interval p_second in + map2 (fun dd_list di1 -> + Arith_misc.my_map2 (fun dd dj1 -> + (d2 * dj1) * di1 + d1 * dd) dd_list d1_bounds) ti.ddf d1_bounds in + { + n = n; + domain = ti.domain; + f = bounds; + df = df; + ddf = ddf; + };; + + +(* atn *) +let eval_m_taylor_atn = + let neg_two_interval = neg_interval two_interval in + fun p_lin p_second ti -> + let n = ti.n in + let ns = 1--n in + let f1_bound = eval_m_taylor_bound p_second ti in + let bounds = atn_interval p_lin ti.f in + let u_bounds = + let inv, ( + ), ( * ) = inv_interval p_lin, add_interval p_lin, mul_interval p_lin in + inv (one_interval + ti.f * ti.f) in + let df = + let ( * ) = mul_interval p_lin in + map (fun d -> u_bounds * d) ti.df in + let d1_bounds = map (fun i -> eval_m_taylor_partial_bound p_second i ti) ns in + let d1, d2 = + let neg, inv, ( + ), ( * ) = neg_interval, inv_interval p_second, + add_interval p_second, mul_interval p_second in + let pow2 = pow_interval p_second 2 in + let inv_one_ff = inv (one_interval + f1_bound * f1_bound) in + inv_one_ff, (neg_two_interval * f1_bound) * pow2 inv_one_ff in + let ddf = + let ( * ), ( + ) = mul_interval p_second, add_interval p_second in + map2 (fun dd_list di1 -> + Arith_misc.my_map2 (fun dd dj1 -> + (d2 * dj1) * di1 + d1 * dd) dd_list d1_bounds) ti.ddf d1_bounds in + { + n = n; + domain = ti.domain; + f = bounds; + df = df; + ddf = ddf; + };; + + +(* acs *) +let eval_m_taylor_acs p_lin p_second ti = + let n = ti.n in + let ns = 1--n in + let f1_bound = eval_m_taylor_bound p_second ti in + let bounds = acs_interval p_lin ti.f in + let u_bounds = + let inv, sqrt, neg = inv_interval p_lin, sqrt_interval p_lin, neg_interval in + let ( * ), ( - ) = mul_interval p_lin, sub_interval p_lin in + neg (inv (sqrt (one_interval - ti.f * ti.f))) in + let df = + let ( * ) = mul_interval p_lin in + map (fun d -> u_bounds * d) ti.df in + let d1_bounds = map (fun i -> eval_m_taylor_partial_bound p_second i ti) ns in + let d1, d2 = + let neg, sqrt, inv = neg_interval, sqrt_interval p_second, inv_interval p_second in + let ( - ), ( * ), ( / ) = sub_interval p_second, mul_interval p_second, div_interval p_second in + let pow3 = pow_interval p_second 3 in + let ff_1 = one_interval - f1_bound * f1_bound in + inv (sqrt ff_1), neg (f1_bound / sqrt (pow3 ff_1)) in + let ddf = + let ( * ), ( - ) = mul_interval p_second, sub_interval p_second in + map2 (fun dd_list di1 -> + Arith_misc.my_map2 (fun dd dj1 -> + (d2 * dj1) * di1 - d1 * dd) dd_list d1_bounds) ti.ddf d1_bounds in + { + n = n; + domain = ti.domain; + f = bounds; + df = df; + ddf = ddf; + };; + + +end;; + + +(* +(* Tests *) + +open Informal_taylor;; + +let dest_int int = + let f1, f2 = Informal_interval.dest_interval int in + Informal_float.dest_float f1, Informal_float.dest_float f2;; + +let dest_ti ti = + dest_int ti.f, map dest_int ti.df, map (map dest_int) ti.ddf;; + +let dest_f = Informal_float.dest_float;; + + +needs "../formal_lp/formal_interval/m_taylor_arith2.hl";; + +let convert_to_float_list pp lo_flag list_tm = + let tms = dest_list list_tm in + let i_funs = map build_interval_fun tms in + let ints = map (fun f -> eval_interval_fun pp f [] []) i_funs in + let extract = (if lo_flag then fst else snd) o dest_pair o rand o concl in + mk_list (map extract ints, real_ty);; + + +let pp = 7;; +let poly = expr_to_vector_fun `x1 + x2 * x3 + x3 * (x1 + x3 pow 2)`;; +let n = (get_dim o fst o dest_abs) poly;; + +let xx = `[#1.1; &2; -- sqrt(&2)]` and + zz = `[&3; &3; &1 + sqrt(&3)]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; + +let xx0 = Informal_taylor.convert_to_float_list pp true xx and + zz0 = Informal_taylor.convert_to_float_list pp false zz;; + +let dom_th = mk_m_center_domain n pp xx1 zz1;; +let dom = Informal_taylor.mk_m_center_domain pp xx0 zz0;; + +let partials = map (fun i -> gen_partial_poly i poly) (1--n);; +let get_partial i eq_th = + let partial_i = gen_partial_poly i (rand (concl eq_th)) in + let pi = (rator o lhand o concl) partial_i in + REWRITE_RULE[GSYM partial2] (TRANS (AP_TERM pi eq_th) partial_i);; +let partials2 = map (fun j -> + let th = List.nth partials (j - 1) in + map (fun i -> get_partial i th) (1--j)) (1--n);; + +let diff_th = gen_diff_poly poly;; +let diff2_th = gen_diff2c_domain_poly poly;; +let lin_th = gen_lin_approx_poly_thm poly diff_th partials;; +let second_th = gen_second_bounded_poly_thm poly partials2;; + +let eval_taylor = eval_m_taylor pp diff2_th lin_th second_th;; +let taylor = Informal_taylor.eval_m_taylor pp poly partials partials2;; + +let ti_th = eval_taylor pp pp dom_th;; +let ti = taylor pp pp dom;; +dest_ti ti;; + +eval_m_taylor_bound n pp ti_th;; +dest_int (Informal_taylor.eval_m_taylor_bound pp ti);; + +eval_m_taylor_partial_upper n pp 3 ti_th;; +dest_f (Informal_taylor.eval_m_taylor_partial_upper pp 3 ti);; + +let t2_th = eval_m_taylor_sub n 2 5 ti_th ti_th;; +let t2 = Informal_taylor.eval_m_taylor_sub 2 5 ti ti;; +dest_ti t2;; + +eval_m_taylor_sub n 8 8 ti_th t2_th;; +dest_ti (Informal_taylor.eval_m_taylor_sub 8 8 ti t2);; + +let xx = `[#0.0; &0; sqrt(&0)]` and + zz = `[#0.2; #0.1; sqrt(&0) + #0.1]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; + +let xx0 = Informal_taylor.convert_to_float_list pp true xx and + zz0 = Informal_taylor.convert_to_float_list pp false zz;; + +let dom_th = mk_m_center_domain n pp xx1 zz1;; +let dom = Informal_taylor.mk_m_center_domain pp xx0 zz0;; + + +let ti_th = eval_taylor pp pp dom_th;; +let ti = taylor pp pp dom;; +let th = eval_m_taylor_acs n pp pp ti_th;; +let t = Informal_taylor.eval_m_taylor_acs pp pp ti;; +dest_ti t;; + +eval_m_taylor_bound n 20 th;; +dest_int (Informal_taylor.eval_m_taylor_bound 20 t);; + +eval_m_taylor_partial_bound n 20 2 th;; +dest_int (Informal_taylor.eval_m_taylor_partial_bound 20 2 t);; + +eval_m_taylor_mul n pp pp ti_th th;; +dest_ti (Informal_taylor.eval_m_taylor_mul pp pp ti t);; + + +(* 1.20 *) +test 100 eval_taylor dom_th;; +(* 0.04 *) +test 100 taylor dom;; + +(* bounds *) +eval_m_taylor_bound n pp ti_th;; +dest_int (Informal_taylor.eval_m_taylor_bound pp ti);; + +eval_m_taylor_upper_bound n pp ti_th;; +dest_f (Informal_taylor.eval_m_taylor_upper_bound pp ti);; + +eval_m_taylor_lower_bound n pp ti_th;; +dest_f (Informal_taylor.eval_m_taylor_lower_bound pp ti);; + + +(* 1.288 *) +test 100 (eval_m_taylor_bound n pp) ti_th;; +(* 0.044 *) +test 100 (Informal_taylor.eval_m_taylor_bound pp) ti;; + + + +(* partials *) + +eval_m_taylor_upper_partial n pp 1 ti_th;; +dest_f (Informal_taylor.eval_m_taylor_upper_partial pp 1 ti);; + +eval_m_taylor_upper_partial n pp 2 ti_th;; +dest_f (Informal_taylor.eval_m_taylor_upper_partial pp 2 ti);; + +eval_m_taylor_upper_partial n pp 3 ti_th;; +dest_f (Informal_taylor.eval_m_taylor_upper_partial pp 3 ti);; + + +eval_m_taylor_lower_partial n pp 1 ti_th;; +dest_f (Informal_taylor.eval_m_taylor_lower_partial pp 1 ti);; + +eval_m_taylor_lower_partial n pp 2 ti_th;; +dest_f (Informal_taylor.eval_m_taylor_lower_partial pp 2 ti);; + +eval_m_taylor_lower_partial n pp 3 ti_th;; +dest_f (Informal_taylor.eval_m_taylor_lower_partial pp 3 ti);; + +eval_m_taylor_interval_partial n pp 1 ti_th;; +dest_int (Informal_taylor.eval_m_taylor_interval_partial pp 1 ti);; +*) diff --git a/formal_lp/old/arith/informal/informal_m_verifier.hl b/formal_lp/old/arith/informal/informal_m_verifier.hl new file mode 100644 index 0000000..dd3f7b6 --- /dev/null +++ b/formal_lp/old/arith/informal/informal_m_verifier.hl @@ -0,0 +1,283 @@ +(* Dependencies *) +needs "../formal_lp/arith/informal/informal_m_taylor.hl";; +needs "../formal_lp/formal_interval/interval_m/verifier.hl";; + +module Informal_verifier = struct + +open Informal_float;; +open Informal_interval;; +open Informal_taylor;; +open Recurse;; + + +type verification_funs = +{ + (* p_lin -> p_second -> dom -> ti *) + taylor : int -> int -> m_cell_domain -> m_taylor_interval; + (* pp -> xx -> zz -> interval *) + f : int -> ifloat list -> ifloat list -> interval; + (* j -> pp -> xx -> zz -> interval *) + df : int -> int -> ifloat list -> ifloat list -> interval; + (* i j -> pp -> xx -> zz -> interval *) + ddf : int -> int -> int -> ifloat list -> ifloat list -> interval; +};; + + +(* m_subset_interval *) +let m_subset_interval a b c d = + let prove_le l1 l2 = itlist2 (fun x y r -> le_float x y && r) l1 l2 true in + prove_le a c && prove_le d b;; + +(* m_taylor_cell_pass *) +let m_taylor_cell_pass pp ti = + let upper = eval_m_taylor_upper_bound pp ti in + lt0_float upper;; + +(* m_taylor_cell_pass0 *) +let m_taylor_cell_pass0 int = + (lt0_float o snd o dest_interval) int;; + +(* m_cell_pass_subdomain *) +let m_cell_pass_subdomain domain2 pass_domain = + let a, b = pass_domain.lo, pass_domain. hi in + let c, d = domain2.lo, domain2.hi in + m_subset_interval a b c d;; + +(* m_incr_pass *) +let m_incr_pass pp j ti = + let partial_bound = eval_m_taylor_partial_lower pp j ti in + ge0_float partial_bound;; + +(* m_decr_pass *) +let m_decr_pass pp j ti = + let partial_bound = eval_m_taylor_partial_upper pp j ti in + le0_float partial_bound;; + +(* m_mono_pass_gen *) +let m_mono_pass_gen decr_flag bound = + (if decr_flag then le0_float else ge0_float) bound;; + +(* m_convex_pass *) +let m_convex_pass int = + (ge0_float o fst o dest_interval) int;; + + +(* mk_verification_functions *) +let mk_verification_functions pp0 f partials partials2 = + let n = length partials in + let taylor = eval_m_taylor pp0 f partials partials2 in + let eval0 = mk_eval_function pp0 f in + let eval1 = map (fun i -> mk_eval_function pp0 ((rand o concl o List.nth partials) (i - 1))) (1--n) in + let eval2 = map (fun i -> + map (fun j -> + let d2 = List.nth (List.nth partials2 (i - 1)) (j - 1) in + mk_eval_function pp0 ((rand o concl) d2)) (1--i)) (1--n) in + { + taylor = taylor; + f = eval0; + df = (fun i -> List.nth eval1 (i - 1)); + ddf = (fun i j -> List.nth (List.nth eval2 (j - 1)) (i - 1)); + };; + + +(* split_domain *) +let split_domain pp j domain = + let n = length domain.w in + let t = List.nth domain.y (j - 1) in + let vv = map (fun i -> if i = j then t else List.nth domain.hi (i - 1)) (1--n) in + let uu = map (fun i -> if i = j then t else List.nth domain.lo (i - 1)) (1--n) in + mk_m_center_domain pp domain.lo vv, mk_m_center_domain pp uu domain.hi;; + + +(* restrict_domain *) +let restrict_domain j left_flag domain = + let replace list j v = map (fun i -> if i = j then v else List.nth list (i - 1)) (1--length list) in + let t = List.nth (if left_flag then domain.lo else domain.hi) (j - 1) in + let lo = if left_flag then domain.lo else replace domain.lo j t in + let hi = if left_flag then replace domain.hi j t else domain.hi in + let w = replace domain.w j float_0 in + let y = replace domain.y j t in + {lo = lo; hi = hi; w = w; y = y};; + + +(*****************************) +let verbatim = ref true;; + +(* m_verify_raw *) +(* Constructs a p_result_tree from the given result_tree *) +let m_verify_raw p_split p_min p_max fs certificate domain0 ref_list = + let r_size = result_size certificate in + let k = ref 0 in + let ps = p_min -- p_max in + + (* finds an optimal precision value *) + let rec find_p p_fun p_list = + match p_list with + | [] -> failwith "find_p: no good p found" + | p :: ps -> + let flag = (try p_fun p with Failure _ -> false) in + if flag then + let _ = if !verbatim then report (sprintf "p = %d" p) else () in p + else find_p p_fun ps in + + (* pass_test *) + let pass_test domain f0_flag pp = + if f0_flag then + m_taylor_cell_pass0 (fs.f pp domain.lo domain.hi) + else + m_taylor_cell_pass pp (fs.taylor pp pp domain) in + + (* glue_test *) + let glue_test domain i convex_flag pp = + if convex_flag then + m_convex_pass (fs.ddf (i + 1) (i + 1) pp domain.lo domain.hi) + else + true in + + (* mono_test *) + let mono_test mono domain domains pp = + let xx, zz = domain.lo, domain.hi in + let taylor = fs.taylor pp pp domain in + let gen_mono m = + if m.df0_flag then + if m.decr_flag then + (snd o dest_interval) (fs.df m.variable pp xx zz) + else + (fst o dest_interval) (fs.df m.variable pp xx zz) + else + if m.decr_flag then + eval_m_taylor_partial_upper pp m.variable taylor + else + eval_m_taylor_partial_lower pp m.variable taylor in + let monos = map gen_mono mono in + rev_itlist (fun (m, bound) pass -> + let flag = m.decr_flag in + m_mono_pass_gen flag bound && pass) (rev (zip mono monos)) true in + + (* mk_domains *) + let rec mk_domains mono dom0 acc = + match mono with + | [] -> rev acc + | m :: ms -> + let j, flag = m.variable, m.decr_flag in + let dom = restrict_domain j flag dom0 in + mk_domains ms dom (dom :: acc) in + + (* rec_verify *) + let rec rec_verify domain certificate = + match certificate with + | Result_mono (mono, r1) -> + let _ = + if !verbatim then + let mono_strs = + map (fun m -> sprintf "%s%d (%b)" (if m.decr_flag then "-" else "") + m.variable m.df0_flag) mono in + report (sprintf "Mono: [%s]" (String.concat ";" mono_strs)) + else () in + let domains = mk_domains mono domain [] in + let tree1 = rec_verify (last domains) r1 in + (try + let pp = find_p (mono_test mono domain domains) ps in + P_result_mono ({pp = pp}, mono, tree1) + with Failure _ -> failwith "mono: failed") + + | Result_pass (f0_flag, _, _) -> + let _ = k := !k + 1 in + let _ = + if !verbatim then + report (sprintf "Verifying: %d/%d (f0_flag = %b)" !k r_size f0_flag) + else () in + (try + let pp = find_p (pass_test domain f0_flag) ps in + P_result_pass ({pp = pp}, f0_flag) + with Failure _ -> failwith "pass: failed") + + | Result_glue (i, convex_flag, r1, r2) -> + let domain1, domain2 = + if convex_flag then + let d1 = restrict_domain (i + 1) true domain in + let d2 = restrict_domain (i + 1) false domain in + d1, d2 + else + split_domain p_split (i + 1) domain in + let tree1 = rec_verify domain1 r1 in + let tree2 = rec_verify domain2 r2 in + (try + let pp = find_p (glue_test domain i convex_flag) ps in + P_result_glue ({pp = pp}, i, convex_flag, tree1, tree2) + with Failure _ -> failwith "glue: failed") + + | Result_pass_ref i -> + let _ = if !verbatim then report (sprintf "Ref: %d" i) else () in + let pass_flag = + if i > 0 then + let _ = List.nth ref_list (i - 1) in + true + else + let pass_domain = List.nth ref_list (-i - 1) in + m_cell_pass_subdomain domain pass_domain in + if not pass_flag then + failwith "ref: failed" + else + P_result_ref i + + | _ -> failwith "False result" in + + rec_verify domain0 certificate;; + + + +(*****************) + +(* m_verify_raw0 *) +let m_verify_raw0 p_split p_min p_max fs certificate xx zz = + m_verify_raw p_split p_min p_max fs certificate (mk_m_center_domain p_split xx zz) [];; + + +(* m_verify_list *) +let m_verify_list p_split p_min p_max fs certificate_list xx zz = + let domain_hash = Hashtbl.create (length certificate_list * 10) in + let mem, find, add = Hashtbl.mem domain_hash, + Hashtbl.find domain_hash, Hashtbl.add domain_hash in + + let get_m_cell_domain pp domain0 path = + let rec get_rec domain path hash = + match path with + | [] -> domain + | (s, j) :: ps -> + let hash' = hash^s^(string_of_int j) in + if mem hash' then + get_rec (find hash') ps hash' + else + if s = "l" or s = "r" then + let domain1, domain2 = split_domain pp j domain in + let hash1 = hash^"l"^(string_of_int j) and + hash2 = hash^"r"^(string_of_int j) in + let _ = add hash1 domain1; add hash2 domain2 in + if s = "l" then + get_rec domain1 ps hash' + else + get_rec domain2 ps hash' + else + let l_flag = (s = "ml") in + let domain' = restrict_domain j l_flag domain in + let _ = add hash' domain' in + get_rec domain' ps hash' in + get_rec domain0 path "" in + + let domain0 = mk_m_center_domain p_split xx zz in + let size = length certificate_list in + let k = ref 0 in + let rec rec_verify certificate_list dom_list tree_list = + match certificate_list with + | [] -> rev tree_list + | (path, certificate) :: cs -> + let _ = k := !k + 1; report (sprintf "List: %d/%d" !k size) in + let domain = get_m_cell_domain p_split domain0 path in + let tree = m_verify_raw p_split p_min p_max fs certificate domain dom_list in + rec_verify cs (dom_list @ [domain]) ((path, tree) :: tree_list) in + rec_verify certificate_list [] [];; + +end;; + + diff --git a/formal_lp/old/arith/informal/tests1.hl b/formal_lp/old/arith/informal/tests1.hl new file mode 100644 index 0000000..349be49 --- /dev/null +++ b/formal_lp/old/arith/informal/tests1.hl @@ -0,0 +1,493 @@ +(* Tests *) +needs "../formal_lp/formal_interval/m_verifier.hl";; + +let reset_all () = + Arith_cache.reset_stat(); + Arith_cache.reset_cache(); + Arith_float.reset_stat(); + Arith_float.reset_cache();; + +let dest_int int = + let f1, f2 = Informal_interval.dest_interval int in + Informal_float.dest_float f1, Informal_float.dest_float f2;; + +let dest_f = Informal_float.dest_float;; + +let dest_dom dom = + map dest_f dom.Informal_taylor.lo, + map dest_f dom.Informal_taylor.hi, + map dest_f dom.Informal_taylor.y, + map dest_f dom.Informal_taylor.w;; + +let dest_ti ti = + dest_int ti.Informal_taylor.f, + map dest_int ti.Informal_taylor.df, + map (map dest_int) ti.Informal_taylor.ddf;; + + +needs "../formal_lp/formal_interval/m_examples_poly.hl";; + + + +(***) +(* delta_y *) +let delta_y_poly = + let tm = (rand o concl o SPEC_ALL o REWRITE_RULE[Sphere.delta_x]) Sphere.delta_y in + expr_to_vector_fun tm;; + + +let pp = 10;; +let pp0 = 4;; +let n = 6;; +let xx = `[&2;&2;&2;&2;&2;&2]` and + zz = `[#2.52;#2.52;#2.52;#2.52;#2.52;#2.52]`;; + +let xx1 = convert_to_float_list pp0 true xx and + zz1 = convert_to_float_list pp0 false zz;; +let xx2 = Informal_taylor.convert_to_float_list pp0 true xx and + zz2 = Informal_taylor.convert_to_float_list pp0 false zz;; +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +let eval_delta_y, tf_delta_y, ti_delta_y = mk_verification_functions pp delta_y_poly true `#127.999`;; +let certificate = run_test tf_delta_y xx_float zz_float false 0.0 true true true true 0.0;; +let c1 = transform_result xx_float zz_float certificate;; + + +(* 10: 362; 165 (find_and_replace_all); 300: 75 *) +(* 10 (cached, float_cached): 33.778 *) +reset_all();; +test 1 (m_verify_list n pp eval_delta_y c1 xx1) zz1;; + +let p_min = 1 and + p_max = pp and + p_split = pp;; + +let cp1 = Informal_verifier.m_verify_list p_split p_min p_max ti_delta_y c1 xx2 zz2;; + +(* 10: 26.950 *) +reset_all();; +test 1 (m_p_verify_list n pp eval_delta_y cp1 xx1) zz1;; + + + + +(************************) +let poly1 = `x2 + x3 + x5 + x6 - #7.99 - #0.00385 * delta_y x1 x2 x3 x4 x5 x6 - + #2.75 * ((x1 + x4) * #0.5 - sqrt (&8))`;; +let poly_ineq = (expr_to_vector_fun o rand o concl o + REWRITE_CONV[Sphere.delta_y; Sphere.delta_x]) poly1;; +let pp = 10;; +let pp0 = 5;; + +let n = 6;; +let xx = `[sqrt (&8); &2; &2; sqrt (&8); &2; &2]` and + zz = `[&3; #2.07; #2.07; &4 * #1.26; #2.07; #2.07]`;; + +let xx1 = convert_to_float_list pp0 true xx and + zz1 = convert_to_float_list pp0 false zz;; +let xx2 = Informal_taylor.convert_to_float_list pp0 true xx and + zz2 = Informal_taylor.convert_to_float_list pp0 false zz;; +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +let eval_ineq, tf_ineq, ti_ineq = mk_verification_functions pp poly_ineq true `&0`;; +let certificate = run_test tf_ineq xx_float zz_float false 0.0 true true true true 0.0;; +let c1 = transform_result xx_float zz_float certificate;; + +let p_split = pp and + p_min = 1 and + p_max = pp;; +let cp1 = Informal_verifier.m_verify_list p_split p_min p_max ti_ineq c1 xx2 zz2;; + + +(* 10: 14.665 *) +reset_all();; +test 1 (m_verify_list n pp eval_ineq c1 xx1) zz1;; +(* 10: 4.788 *) +test 1 (m_verify_list n pp eval_ineq c1 xx1) zz1;; + + +(* 10: 12.465 *) +reset_all();; +test 1 (m_p_verify_list n p_split eval_ineq cp1 xx1) zz1;; +(* 10: 4.520 *) +test 1 (m_p_verify_list n p_split eval_ineq cp1 xx1) zz1;; + + + + +(*******************************) + +let get_m_cell_domain = + let domain_hash = Hashtbl.create 20 in + let mem, find, add = Hashtbl.mem domain_hash, + Hashtbl.find domain_hash, Hashtbl.add domain_hash in + fun n pp domain0 path -> + let rec get_rec domain_th path hash = + match path with + | [] -> domain_th + | (s, j) :: ps -> + let hash' = hash^s^(string_of_int j) in + if mem hash' then + get_rec (find hash') ps hash' + else + if s = "l" or s = "r" then + let domain1_th, domain2_th = split_domain n pp j domain_th in + let hash1 = hash^"l"^(string_of_int j) and + hash2 = hash^"r"^(string_of_int j) in + let _ = add hash1 domain1_th; add hash2 domain2_th in + if s = "l" then + get_rec domain1_th ps hash' + else + get_rec domain2_th ps hash' + else + let l_flag = (s = "ml") in + let domain_th', _ = restrict_domain n j l_flag domain_th in + let _ = add hash' domain_th' in + get_rec domain_th' ps hash' in + get_rec domain0 path "";; + + +let m_p_verify_list0 n p_split fs certificate_list xx zz th_refs = + let domain_th0 = mk_m_center_domain n p_split xx zz in + let size = length certificate_list in + let k = ref 0 in + let rec rec_verify certificate_list th_list = + match certificate_list with + | [] -> th_list + | (path, certificate) :: cs -> + let _ = k := !k + 1; report (sprintf "List: %d/%d" !k size) in + let domain_th = get_m_cell_domain n p_split domain_th0 path in + let th = m_p_verify_raw n p_split fs certificate domain_th th_list in + rec_verify cs (th_list @ [th]) in + rec_verify certificate_list th_refs;; + + +let i_get_m_cell_domain = + let domain_hash = Hashtbl.create 20 in + let mem, find, add = Hashtbl.mem domain_hash, + Hashtbl.find domain_hash, Hashtbl.add domain_hash in + fun pp domain0 path -> + let rec get_rec domain_th path hash = + match path with + | [] -> domain_th + | (s, j) :: ps -> + let hash' = hash^s^(string_of_int j) in + if mem hash' then + get_rec (find hash') ps hash' + else + if s = "l" or s = "r" then + let domain1_th, domain2_th = Informal_verifier.split_domain pp j domain_th in + let hash1 = hash^"l"^(string_of_int j) and + hash2 = hash^"r"^(string_of_int j) in + let _ = add hash1 domain1_th; add hash2 domain2_th in + if s = "l" then + get_rec domain1_th ps hash' + else + get_rec domain2_th ps hash' + else + let l_flag = (s = "ml") in + let domain_th' = Informal_verifier.restrict_domain j l_flag domain_th in + let _ = add hash' domain_th' in + get_rec domain_th' ps hash' in + get_rec domain0 path "";; + + +let i_m_verify_list p_split p_min p_max fs certificate_list xx zz = + let domain0 = Informal_taylor.mk_m_center_domain p_split xx zz in + let size = length certificate_list in + let k = ref 0 in + let rec rec_verify certificate_list dom_list tree_list = + match certificate_list with + | [] -> rev tree_list, dom_list + | (path, certificate) :: cs -> + let _ = k := !k + 1; report (sprintf "List: %d/%d" !k size) in + let domain = i_get_m_cell_domain p_split domain0 path in + let tree = Informal_verifier.m_verify_raw p_split p_min p_max fs certificate domain dom_list in + rec_verify cs (dom_list @ [domain]) ((path, tree) :: tree_list) in + rec_verify certificate_list [] [];; + + +(***********************) + + +let l1, l2 = chop_list 26 cp1;; +let ths1 = m_p_verify_list0 n p_split eval_ineq l1 xx1 zz1 [];; +let path2, c2 = hd l2;; +let dom2_th = get_m_cell_domain n p_split (mk_m_center_domain n p_split xx1 zz1) path2;; +let dom2 = i_get_m_cell_domain p_split (Informal_taylor.mk_m_center_domain p_split xx2 zz2) path2;; +dest_dom dom2;; + + +m_p_verify_raw n p_split eval_ineq c2 dom2_th ths1;; +c2;; + +let d1_th, d2_th = split_domain n p_split (3 + 1) dom2_th;; +let d1, d2 = Informal_verifier.split_domain p_split (3 + 1) dom2;; + +let t2_th = eval_ineq.taylor 4 4 d2_th;; +eval_m_taylor_upper_partial n 4 4 t2_th;; + +let t2 = ti_ineq.Informal_verifier.taylor 4 d2;; +dest_f (Informal_taylor.eval_m_taylor_upper_partial 4 4 t2);; + +let f0, df0, ddf0 = dest_ti t2;; +let _, _, _, _, f1, df1, ddf1 = dest_m_taylor (concl t2_th);; + +df1;; +df0;; +(* partial 4, upper bound: -67 * 10^-2, (true, 671, 47) *) + +let x_tm, body_tm = dest_abs poly_ineq;; +let new_f = mk_abs (x_tm, mk_binop sub_op_real `&0` body_tm);; +let partial4 = gen_partial_poly 4 new_f;; + +let g1 = mk_eval_function_eq pp partial4;; +let g0 = Informal_taylor.mk_eval_function pp (rand (concl partial4));; + +let _, y1, _ = dest_m_cell_domain (concl d2_th);; +let y0 = d2.Informal_taylor.y;; + +g1 2 y1 y1;; +dest_int (g0 2 y0 y0);; + +float_interval_pow_simple 2 4 (mk_const_interval (mk_float 29 49));; +let ff = Informal_float.mk_float (Int 29) 49;; +dest_int (Informal_interval.pow_interval 2 4 (Informal_interval.mk_interval (ff, ff)));; + +let g_test = `\x:real^2. (-- &77 / &10000) * x$2 * x$1 pow 4`;; +let pp = 10;; +let g1 = mk_eval_function_eq pp (REFL g_test);; +let g0 = Informal_taylor.mk_eval_function pp g_test;; + +let yy = `[#2.9; &3]`;; +let y1' = mk_vector (convert_to_float_list pp true yy);; +let y0' = Informal_taylor.convert_to_float_list pp true yy;; + +g1 2 y1' y1';; +dest_int (g0 2 y0' y0');; + +partial4;; + + +(***) + +List.nth ddf0 5;; +List.nth (dest_list ddf1) 5;; + + + + +d2_th;; +dest_dom d2;; + + +m_p_verify_list0 n p_split eval_ineq l2 xx1 zz1 ths1;; + +List.nth cp1 26;; + + + + + + + + + +let x = 2;; + + + + +(***) +(* schwefel *) +let pp = 12;; +let n = 3;; +let xx = `[-- &10; -- &10; -- &10]` and + zz = `[&10; &10; &10]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; +let xx2 = Informal_taylor.convert_to_float_list pp true xx and + zz2 = Informal_taylor.convert_to_float_list pp false zz;; +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +let eval_schwefel, tf_schwefel, i_schwefel = mk_verification_functions pp schwefel_poly true schwefel_min;; +let c00 = run_test tf_schwefel xx_float zz_float false 0.0 true true false false 0.0;; +let c0 = run_test tf_schwefel xx_float zz_float false 0.0 true true false true 0.0;; +result_stat c0;; +let c1' = run_test tf_schwefel xx_float zz_float false 0.0 true true true true 0.0;; +let c1 = transform_result xx_float zz_float c1';; + +let p_split = pp and + p_min = 1 and p_max = pp;; + +reset_all();; +let cp0 = Informal_verifier.m_verify_raw0 p_split p_min p_max i_schwefel c0 xx2 zz2;; + +(* 10: 27.006 *) +reset_all();; +test 1 (m_verify_raw0 n pp eval_schwefel c0 xx1) zz1;; + +(* 10: 24.642 *) +reset_all();; +test 1 (m_p_verify_raw0 n p_split eval_schwefel cp0 xx1) zz1;; + + +(* 10: 136.257 *) +reset_all();; +test 1 (m_verify_raw0 n pp eval_schwefel c00 xx1) zz1;; + +let cp00 = Informal_verifier.m_verify_raw0 p_split p_min p_max i_schwefel c00 xx2 zz2;; + +(* 10: 126.400 *) +reset_all();; +test 1 (m_p_verify_raw0 n p_split eval_schwefel cp00 xx1) zz1;; + +(* 10: 23.297 *) +reset_all();; +test 1 (m_verify_list n pp eval_schwefel c1 xx1) zz1;; + +let cp1 = Informal_verifier.m_verify_list p_split p_min p_max i_schwefel c1 xx2 zz2;; + +(* 10: 21.205 *) +reset_all();; +test 1 (m_p_verify_list n p_split eval_schwefel cp1 xx1) zz1;; + + +(***) +(* rd *) + +let pp = 12;; +let n = 3;; +let xx = `[-- &5; -- &5; -- &5]` and + zz = `[&5; &5; &5]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; +let xx2 = Informal_taylor.convert_to_float_list pp true xx and + zz2 = Informal_taylor.convert_to_float_list pp false zz;; +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +let eval_rd, tf_rd, i_rd = mk_verification_functions pp rd_poly true rd_min;; +let certificate = run_test tf_rd xx_float zz_float false 0.0 true true true false 0.0;; +(* 1 *) +result_size certificate;; +m_verify_raw0 n pp eval_rd certificate xx1 zz1;; + +let p_split = pp and + p_min = 1 and + p_max = pp;; + +Informal_verifier.m_verify_raw0 p_split p_min p_max i_rd certificate xx2 zz2;; + + +(***) +(* caprasse *) + +let pp = 8;; +let n = 4;; +let xx = `[-- #0.5; -- #0.5; -- #0.5; -- #0.5]` and + zz = `[#0.5; #0.5; #0.5; #0.5]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; +let xx2 = Informal_taylor.convert_to_float_list pp true xx and + zz2 = Informal_taylor.convert_to_float_list pp false zz;; +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +let eval_caprasse, tf_caprasse, ti_caprasse = mk_verification_functions pp caprasse_poly true caprasse_min;; +let c0 = run_test tf_caprasse xx_float zz_float false 0.0 true true false true 0.0;; +let certificate = run_test tf_caprasse xx_float zz_float false 0.0 true true true true 0.0;; +let c1 = transform_result xx_float zz_float certificate;; + +(* 10: 1.668 *) +reset_all();; +test 1 (m_verify_list n pp eval_caprasse c1 xx1) zz1;; + +let p_split = pp and + p_min = 1 and + p_max = pp;; + +let cp1 = Informal_verifier.m_verify_list p_split p_min p_max ti_caprasse c1 xx2 zz2;; + +(* 10: 1.552 *) +reset_all();; +test 1 (m_p_verify_list n p_split eval_caprasse cp1 xx1) zz1;; + + +(***) +(* magnetism *) + +let pp = 8;; +let n = 7;; +let xx = `[-- &1; -- &1; -- &1; -- &1; -- &1; -- &1; -- &1]` and + zz = `[&1; &1; &1; &1; &1; &1; &1]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; +let xx2 = Informal_taylor.convert_to_float_list pp true xx and + zz2 = Informal_taylor.convert_to_float_list pp false zz;; +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +let eval_magnetism, tf_magnetism, ti_magnetism = + mk_verification_functions pp magnetism_poly true magnetism_min;; +let certificate = run_test tf_magnetism xx_float zz_float false 0.0 true true true true 0.0;; +result_stat certificate;; + +let c1 = transform_result xx_float zz_float certificate;; + +(* 10: 1.34 *) +reset_all();; +test 1 (m_verify_list n pp eval_magnetism c1 xx1) zz1;; + +let p_split = pp and + p_min = 1 and + p_max = pp;; + +let cp1 = Informal_verifier.m_verify_list p_split p_min p_max ti_magnetism c1 xx2 zz2;; + +(* 10: 1.372 *) +reset_all();; +test 1 (m_p_verify_list n p_split eval_magnetism cp1 xx1) zz1;; + + +(***) +(* heart *) + +let pp = 10;; +let pp0 = 6;; +let n = 8;; +let xx = `[-- #0.1; #0.4; -- #0.7; -- #0.7; #0.1; -- #0.1; -- #0.3; -- #1.1]` and + zz = `[#0.4; &1; -- #0.4; #0.4; #0.2; #0.2; #1.1; -- #0.3]`;; + +let xx1 = convert_to_float_list pp0 true xx and + zz1 = convert_to_float_list pp0 false zz;; +let xx2 = Informal_taylor.convert_to_float_list pp0 true xx and + zz2 = Informal_taylor.convert_to_float_list pp0 false zz;; +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +let eval_heart, tf_heart, ti_heart = mk_verification_functions pp heart_poly true heart_min;; +let certificate = run_test tf_heart xx_float zz_float false 0.0 true true true true 1e-10;; +let c1 = transform_result xx_float zz_float certificate;; + +let p_split = pp and + p_min = 1 and + p_max = 10;; + +let cp1 = Informal_verifier.m_verify_list p_split p_min p_max ti_heart c1 xx2 zz2;; + +(* 10: 1.528 *) +reset_all();; +test 1 (m_verify_list n pp eval_heart c1 xx1) zz1;; + +(* 10: 1.496 *) +reset_all();; +test 1 (m_p_verify_list n p_split eval_heart cp1 xx1) zz1;; + diff --git a/formal_lp/old/arith/informal/tests2.hl b/formal_lp/old/arith/informal/tests2.hl new file mode 100644 index 0000000..9f26968 --- /dev/null +++ b/formal_lp/old/arith/informal/tests2.hl @@ -0,0 +1,601 @@ +needs "../formal_lp/formal_interval/m_taylor_arith2.hl";; +needs "../formal_lp/formal_interval/m_verifier.hl";; +needs "../formal_lp/arith/informal/informal_m_verifier.hl";; + + + +let reset_all () = + Arith_cache.reset_stat(); + Arith_cache.reset_cache(); + Arith_float.reset_stat(); + Arith_float.reset_cache();; + + +let dest_int int = + let f1, f2 = Informal_interval.dest_interval int in + Informal_float.dest_float f1, Informal_float.dest_float f2;; + +let dest_f = Informal_float.dest_float;; + +let dest_dom dom = + map dest_f dom.Informal_taylor.lo, + map dest_f dom.Informal_taylor.hi, + map dest_f dom.Informal_taylor.y, + map dest_f dom.Informal_taylor.w;; + +let dest_ti ti = + dest_int ti.Informal_taylor.f, + map dest_int ti.Informal_taylor.df, + map (map dest_int) ti.Informal_taylor.ddf;; + + + +(******************************) + +(* dummy functions *) + +let eval_d0 i pp t1 t2 = failwith "eval_d0";; +let eval_dd0 i j pp t1 t2 = failwith "eval_dd0";; +let eval_0 pp t1 t2 = failwith "eval_0";; +let eval_diff2 t1 t2 = failwith "eval_diff2";; + + +(******************************) +(* real tests *) + +let n = 6;; +let pp = 15;; +let pp = 8;; + +(* delta_y *) +let delta_y_poly = + let tm = (rand o concl o SPEC_ALL o REWRITE_RULE[Sphere.delta_x]) Sphere.delta_y in + expr_to_vector_fun tm;; + +(* delta_y4 *) +let delta_y4_poly = + let tm = (rand o concl o SPECL[`y1*y1`; `y2*y2`; `y3*y3`; `y4*y4`; `y5*y5`; `y6*y6`]) Sphere.delta_x4 in + expr_to_vector_fun tm;; + +(* 4 * y1 * delta_y *) +let four_y1_delta_y_poly = + let x_var, tm = dest_abs delta_y_poly in + mk_abs (x_var, mk_binop mul_op_real `&4` (mk_binop mul_op_real `(x:real^6)$1 * x$1` tm));; + +(* - delta_y4 *) +let neg_delta_y4_poly = + let x_var, tm = dest_abs delta_y4_poly in + mk_abs (x_var, mk_comb (neg_op_real, tm));; + + +let eval_neg_delta_y4, tf_neg_delta_y4, ti_neg_delta_y4 = + mk_verification_functions pp neg_delta_y4_poly false `&0`;; + +let eval_4y1_delta_y, tf_4y1_delta_y, ti_4y1_delta_y = + mk_verification_functions pp four_y1_delta_y_poly false `&0`;; + +let eval_pi2, tf_pi2, ti_pi2 = + mk_verification_functions pp `\x:real^6. pi / &2` false `&0`;; + + +let eval_pi2_plus, tf_pi2_plus, ti_pi2_plus = + mk_verification_functions pp `\x:real^6. pi / &2 - #1.893` false `&0`;; + + +(* dih_y *) +open Univariate;; + +let tf_dih_y_hi = + let denom = Uni_compose (uinv, Uni_compose (usqrt, tf_4y1_delta_y)) in + Plus (tf_pi2_plus, Uni_compose (uatan, Product (tf_neg_delta_y4, denom)));; + +let eval_dih_y_hi p_lin p_second th = + let inv, atn, sqrt, ( * ), ( + ) = + eval_m_taylor_inv2 n p_lin p_second, eval_m_taylor_atn2 n p_lin p_second, + eval_m_taylor_sqrt2 n p_lin p_second, eval_m_taylor_mul2 n p_lin p_second, + eval_m_taylor_add2 n p_lin p_second in + let poly1 = eval_4y1_delta_y.taylor p_lin p_second th and + poly2 = eval_neg_delta_y4.taylor p_lin p_second th and + pi2 = eval_pi2_plus.taylor p_lin p_second th in + pi2 + atn (poly2 * inv (sqrt (poly1)));; + + +let ti_dih_y_hi p_lin p_second th = + let inv, atn, sqrt, ( * ), ( + ) = + Informal_taylor.eval_m_taylor_inv p_lin p_second, Informal_taylor.eval_m_taylor_atn p_lin p_second, + Informal_taylor.eval_m_taylor_sqrt p_lin p_second, Informal_taylor.eval_m_taylor_mul p_lin p_second, + Informal_taylor.eval_m_taylor_add p_lin p_second in + let poly1 = ti_4y1_delta_y.Informal_verifier.taylor p_lin p_second th and + poly2 = ti_neg_delta_y4.Informal_verifier.taylor p_lin p_second th and + pi2 = ti_pi2_plus.Informal_verifier.taylor p_lin p_second th in + pi2 + atn (poly2 * inv (sqrt (poly1)));; + + +let eval_taylor = + {taylor = eval_dih_y_hi; f = eval_0; df = eval_d0; ddf = eval_dd0; diff2_f = eval_diff2};; + +let ti = + {Informal_verifier.taylor = ti_dih_y_hi; + Informal_verifier.f = eval_0; + Informal_verifier.df = eval_d0; + Informal_verifier.ddf = eval_dd0};; + + + +(************) +(* Small domain *) +let xx_s = `[&2; &2; &2; &2; &2; &2]` and + zz_s = `[#2.1; #2.1; #2.1; #2.1; #2.1; #2.1]`;; + +(* domain *) +let domain_th = + let xx1_s = convert_to_float_list pp true xx_s and + zz1_s = convert_to_float_list pp false zz_s in + mk_m_center_domain n pp xx1_s zz1_s;; + +let dom = + let xx2_s = Informal_taylor.convert_to_float_list pp true xx_s and + zz2_s = Informal_taylor.convert_to_float_list pp false zz_s in + Informal_taylor.mk_m_center_domain pp xx2_s zz2_s;; + + + +(* 10: 9.121 (pp = 15) *) +(* 300: 5.5 (pp = 8) *) +(* 100 (cached, float_cached, pp = 8): 2.68 *) +(* 100 (optimization): 1.732 *) +(* 200 (m_taylor_arith2): 1.428 *) +reset_all();; +test 1 (eval_dih_y_hi pp pp) domain_th;; +(* 100: 1.668 *) +(* 200 (optimization): 0.580 *) +(* 200 (m_taylor_arith2): 0.328 *) +test 1 (eval_dih_y_hi pp pp) domain_th;; +(* 100: 0.088 *) + +test 1 (ti_dih_y_hi pp pp) dom;; + + +Arith_cache.print_stat();; +Arith_float.print_stat();; + +(***) + +let th1 = eval_4y1_delta_y.taylor pp pp domain_th;; +let th2 = eval_neg_delta_y4.taylor pp pp domain_th;; +let pi2_th = eval_pi2_plus.taylor pp pp domain_th;; + +let r1 = eval_m_taylor_sqrt2 n pp pp th1;; +let r2 = eval_m_taylor_inv2 n pp pp r1;; +let r3 = eval_m_taylor_mul2 n pp pp th2 r2;; +let r4 = eval_m_taylor_atn2 n pp pp r3;; +let r5 = eval_m_taylor_add2 n pp pp pi2_th r4;; + +reset_all();; + +(* 100: 0.264 (second: 0.084) *) +test 1 (eval_4y1_delta_y.taylor pp pp) domain_th;; +(* 100: 0.032 (second: 0.020) *) +test 1 (eval_neg_delta_y4.taylor pp pp) domain_th;; +(* 100: 0.000 (second: 0.000) *) +test 1 (eval_pi2_plus.taylor pp pp) domain_th;; + +(* 100: 0.356 (second: 0.168); 0.300 (0.116) *) +test 1 (eval_m_taylor_sqrt n pp pp) th1;; +(* 200: 0.220 (second: 0.048) *) +test 1 (eval_m_taylor_sqrt2 n pp pp) th1;; + +(* 100: 0.412 (second: 0.188); 0.316 (0.104) *) +test 1 (eval_m_taylor_inv n pp pp) r1;; +(* 200: 0.264 (second: 0.056) *) +test 1 (eval_m_taylor_inv2 n pp pp) r1;; + +(* 100: 0.384 (second: 0.212); 0.316 (0.140) *) +test 1 (eval_m_taylor_mul n pp pp th2) r2;; +(* 200: 0.244 (second: 0.092) *) +test 1 (eval_m_taylor_mul2 n pp pp th2) r2;; + +(* 100: 0.616 (second: 0.272); build2: 0.504 (0.132) *) +test 1 (eval_m_taylor_atn n pp pp) r3;; +(* 200: 0.436 (second: 0.060) *) +test 1 (eval_m_taylor_atn2 n pp pp) r3;; + +(* 100: 0.096 (second: 0.072); 0.072 (0.052) *) +test 1 (eval_m_taylor_add n pp pp pi2_th) r4;; +(* 200: 0.032 (second: 0.024) *) +test 1 (eval_m_taylor_add2 n pp pp pi2_th) r4;; + + + +(***) +let xx = `[&2; &2; &2; &2; &2; &2]` and + zz = `[#2.52; #2.52; #2.52; #2.52; #2.52; #2.52]`;; + +let xx_s = `[&2; &2; &2; &2; &2; &2]` and + zz_s = `[#2.52; #2.1; #2.1; #2.1; #2.1; #2.1]`;; + +let xx_s2 = `[&2; &2; &2; &2; &2; &2]` and + zz_s2 = `[#2.52; #2.2; #2.2; #2.2; #2.2; #2.2]`;; + + +let pp0 = 3;; +let pp0 = 5;; +let xx1 = convert_to_float_list pp0 true xx and + zz1 = convert_to_float_list pp0 false zz and + xx1_s = convert_to_float_list pp0 true xx_s and + zz1_s = convert_to_float_list pp0 false zz_s and + xx1_s2 = convert_to_float_list pp0 true xx_s2 and + zz1_s2 = convert_to_float_list pp0 false zz_s2;; + +let xx2 = Informal_taylor.convert_to_float_list pp0 true xx and + zz2 = Informal_taylor.convert_to_float_list pp0 false zz and + xx2_s = Informal_taylor.convert_to_float_list pp0 true xx_s and + zz2_s = Informal_taylor.convert_to_float_list pp0 false zz_s and + xx2_s2 = Informal_taylor.convert_to_float_list pp0 true xx_s2 and + zz2_s2 = Informal_taylor.convert_to_float_list pp0 false zz_s2;; + + +let xx_float, zz_float, xx_s_float, zz_s_float, xx_s2_float, zz_s2_float = + let pad = replicate 0.0 (8 - length (dest_list xx1)) in + map float_of_float_tm (dest_list xx1) @ pad, + map float_of_float_tm (dest_list zz1) @ pad, + map float_of_float_tm (dest_list xx1_s) @ pad, + map float_of_float_tm (dest_list zz1_s) @ pad, + map float_of_float_tm (dest_list xx1_s2) @ pad, + map float_of_float_tm (dest_list zz1_s2) @ pad;; + + + +(***) + + +let c_dih_y_s = run_test tf_dih_y_hi xx_s_float zz_s_float false 0.0 true false true false 0.0;; +let c_dih_y_s2 = run_test tf_dih_y_hi xx_s2_float zz_s2_float false 0.0 true false true false 0.0;; +let c_dih_y0 = run_test tf_dih_y_hi xx_float zz_float false 0.0 true false false false 0.0;; + +(* pass = 4 *) +result_stat c_dih_y_s;; +(* pass = 63 *) +result_stat c_dih_y_s2;; +(* pass = 4294, mono = 10 *) +result_stat c_dih_y0;; + +let p_split = pp and + p_min = 1 and + p_max = pp;; + +let cp_s = Informal_verifier.m_verify_raw0 p_split p_min p_max ti c_dih_y_s xx2_s zz2_s;; +let cp_s2 = Informal_verifier.m_verify_raw0 p_split p_min p_max ti c_dih_y_s2 xx2_s2 zz2_s2;; + + +(*********************) + +reset_all();; + +(* 10 (pp = 15): 38.418 *) +(* 300 (pp = 8): 22.289 *) +(* 100 (cached, float_cached, pp = 8): 12.229; 9.372 (MY_BETA_RULE); 8.028 (build2) *) +(* 200 (m_taylor_arith2) : 6.548 *) +let _ = + let start = Sys.time() in + let result = m_verify_raw0 n pp eval_taylor c_dih_y_s xx1_s zz1_s in + let finish = Sys.time() in + let _ = report + (sprintf "Verification time: %f" (finish -. start)) in + result;; + +Arith_cache.print_stat();; +Arith_float.print_stat();; + + +(* 100 (cached, float_cached, pp = 8): 8.025; 5.116 (MY_BETA_RULE); 3.700 (build2) *) +(* 200 (m_taylor_arith2): 2.496 *) +reset_all();; +let _ = + let start = Sys.time() in + let result = m_p_verify_raw0 n p_split eval_taylor cp_s xx1_s zz1_s in + let finish = Sys.time() in + let _ = report + (sprintf "Verification time: %f" (finish -. start)) in + result;; + +(* stats *) +result_p_stat false cp_s2;; + +(* 100 (cached, float_cached, pp = adaptive): 129.788; 87.729 (MY_BETA_RULE); 64.884 (build2) *) +(* (pp = 8: 233.80) *) +(* 200: 63.984 (build2) *) +(* 200 (m_taylor_arith2): 43.927 *) +reset_all();; + +let _ = + let start = Sys.time() in + let result = m_p_verify_raw0 n p_split eval_taylor cp_s2 xx1_s2 zz1_s2 in + let finish = Sys.time() in + let _ = report + (sprintf "Verification time: %f" (finish -. start)) in + result;; + +(*****************) +let cp = Informal_verifier.m_verify_raw0 p_split p_min p_max ti c_dih_y0 xx2 zz2;; +result_p_stat false cp;; + +(* 100: 9105 (was 15202)*) +(* 200 (build2): 4242 *) +(* 200 (m_taylor_arith2): 3121 *) +(* 200 (mixed_partials): 2880 *) +reset_all();; +let _ = + let start = Sys.time() in + let result = m_p_verify_raw0 n p_split eval_taylor cp xx1 zz1 in + let finish = Sys.time() in + let _ = report + (sprintf "Verification time: %f" (finish -. start)) in + result;; + + + + + +(**************************************) +(* 3318775219 *) + +let tf_dih_y = + let denom = Uni_compose (uinv, Uni_compose (usqrt, tf_4y1_delta_y)) in + Plus (tf_pi2, Uni_compose (uatan, Product (tf_neg_delta_y4, denom)));; + +let eval_dih_y p_lin p_second th = + let inv, atn, sqrt, ( * ), ( + ) = + eval_m_taylor_inv2 n p_lin p_second, eval_m_taylor_atn2 n p_lin p_second, + eval_m_taylor_sqrt2 n p_lin p_second, eval_m_taylor_mul2 n p_lin p_second, + eval_m_taylor_add2 n p_lin p_second in + let poly1 = eval_4y1_delta_y.taylor p_lin p_second th and + poly2 = eval_neg_delta_y4.taylor p_lin p_second th and + pi2 = eval_pi2.taylor p_lin p_second th in + pi2 + atn (poly2 * inv (sqrt (poly1)));; + + +let ti_dih_y p_lin p_second th = + let inv, atn, sqrt, ( * ), ( + ) = + Informal_taylor.eval_m_taylor_inv p_lin p_second, Informal_taylor.eval_m_taylor_atn p_lin p_second, + Informal_taylor.eval_m_taylor_sqrt p_lin p_second, Informal_taylor.eval_m_taylor_mul p_lin p_second, + Informal_taylor.eval_m_taylor_add p_lin p_second in + let poly1 = ti_4y1_delta_y.Informal_verifier.taylor p_lin p_second th and + poly2 = ti_neg_delta_y4.Informal_verifier.taylor p_lin p_second th and + pi2 = ti_pi2.Informal_verifier.taylor p_lin p_second th in + pi2 + atn (poly2 * inv (sqrt (poly1)));; + + +(* - #1.629 + + (#0.414 * (y2 + y3 + y5 + y6 - #8.0)) - + (#0.763 * (y4 - #2.52)) - + (#0.315 * (y1 - #2.0)) *) +let neg_poly3318 = expr_to_vector_fun `-- (-- #1.629 + + (#0.414 * (y2 + y3 + y5 + y6 - #8.0)) - + (#0.763 * (y4 - #2.52)) - + (#0.315 * (y1 - #2.0)))`;; + +let eval_poly3318, tf_poly3318, ti_poly3318 = + mk_verification_functions pp neg_poly3318 false `&0`;; + + +let tf_3318 = + let dih = tf_dih_y in + let poly = tf_poly3318 in + Plus (poly, Scale (dih, mk_interval (-1.0, -1.0)));; + + +let eval_3318 p_lin p_second th = + let ( - ) = eval_m_taylor_sub2 n p_lin p_second in + let dih = eval_dih_y p_lin p_second th and + poly = eval_poly3318.taylor p_lin p_second th in + poly - dih;; + +let ti_3318 p_lin p_second th = + let ( - ) = Informal_taylor.eval_m_taylor_sub p_lin p_second in + let dih = ti_dih_y p_lin p_second th and + poly = ti_poly3318.Informal_verifier.taylor p_lin p_second th in + poly - dih;; + + +let eval_taylor = + {taylor = eval_3318; f = eval_0; df = eval_d0; ddf = eval_dd0; diff2_f = eval_diff2};; + +let ti = + {Informal_verifier.taylor = ti_3318; + Informal_verifier.f = eval_0; + Informal_verifier.df = eval_d0; + Informal_verifier.ddf = eval_dd0};; + + +(* domain *) +let xx = `[&2; &2; &2; #2.52; &2; &2]` and + zz = `[#2.52; #2.52; #2.52; sqrt(&8); #2.52; #2.52]`;; + +let xx_s = `[&2; &2; &2; #2.52; &2; &2]` and + zz_s = `[#2.52; #2.1; #2.1; sqrt(&8); #2.1; #2.1]`;; + +let pp0 = 3;; +let xx1 = convert_to_float_list pp0 true xx and + zz1 = convert_to_float_list pp0 false zz and + xx1_s = convert_to_float_list pp0 true xx_s and + zz1_s = convert_to_float_list pp0 false zz_s;; + +let xx2 = Informal_taylor.convert_to_float_list pp0 true xx and + zz2 = Informal_taylor.convert_to_float_list pp0 false zz and + xx2_s = Informal_taylor.convert_to_float_list pp0 true xx_s and + zz2_s = Informal_taylor.convert_to_float_list pp0 false zz_s;; + +let xx_float, zz_float, xx_s_float, zz_s_float = + let pad = replicate 0.0 (8 - length (dest_list xx1)) in + map float_of_float_tm (dest_list xx1) @ pad, + map float_of_float_tm (dest_list zz1) @ pad, + map float_of_float_tm (dest_list xx1_s) @ pad, + map float_of_float_tm (dest_list zz1_s) @ pad;; + + +(* certificates *) + +let c_s = run_test tf_3318 xx_s_float zz_s_float false 0.0 true false false false 0.0;; +let c0 = run_test tf_3318 xx_float zz_float false 0.0 true false false false 0.0;; +let c_test = run_test tf_3318 xx_float zz_float false 0.0 true true true true 0.0;; + +(* pass = 355, mono = 21 *) +result_stat c_s;; +(* pass = 16165, mono = 1036 *) +result_stat c0;; +(* pass = 15924 (raw = 1), mono = 796, pass_mono = 240 *) +result_stat c_test;; + +let p_split = pp and + p_min = 1 and + p_max = pp;; + +let cp_s = Informal_verifier.m_verify_raw0 p_split p_min p_max ti c_s xx2_s zz2_s;; +let cp0 = Informal_verifier.m_verify_raw0 p_split p_min p_max ti c0 xx2 zz2;; + + +(*********************) + +reset_all();; + +(* 200 (m_taylor_arith2): 282.7 *) +let _ = + let start = Sys.time() in + let result = m_p_verify_raw0 n p_split eval_taylor cp_s xx1_s zz1_s in + let finish = Sys.time() in + let _ = report + (sprintf "Verification time: %f" (finish -. start)) in + result;; + + +reset_all();; + +(* 200 (m_taylor_arith2): 14175.2 *) +let _ = + let start = Sys.time() in + let result = m_p_verify_raw0 n p_split eval_taylor cp0 xx1 zz1 in + let finish = Sys.time() in + let _ = report + (sprintf "Verification time: %f" (finish -. start)) in + result;; + + +(**************************************) +(* 9922699028 *) + + +(* #1.6294 - + (#0.2213 * (y2 + y3 + y5 + y6 - #8.0)) + + (#0.913 * (y4 - #2.52)) + + (#0.728 * (y1 - #2.0)) *) +let neg_poly9922 = expr_to_vector_fun `-- (#1.6294 - + (#0.2213 * (y2 + y3 + y5 + y6 - #8.0)) + + (#0.913 * (y4 - #2.52)) + + (#0.728 * (y1 - #2.0)))`;; + +let eval_poly9922, tf_poly9922, ti_poly9922 = + mk_verification_functions pp neg_poly9922 false `&0`;; + + + +let tf_9922 = + let dih = tf_dih_y in + let poly = tf_poly9922 in + Plus (dih, poly);; + + +let eval_9922 p_lin p_second th = + let ( + ) = eval_m_taylor_add2 n p_lin p_second in + let dih = eval_dih_y p_lin p_second th and + poly = eval_poly9922.taylor p_lin p_second th in + dih + poly;; + +let ti_9922 p_lin p_second th = + let ( + ) = Informal_taylor.eval_m_taylor_add p_lin p_second in + let dih = ti_dih_y p_lin p_second th and + poly = ti_poly9922.Informal_verifier.taylor p_lin p_second th in + dih + poly;; + + +let eval_taylor = + {taylor = eval_9922; f = eval_0; df = eval_d0; ddf = eval_dd0; diff2_f = eval_diff2};; + +let ti = + {Informal_verifier.taylor = ti_9922; + Informal_verifier.f = eval_0; + Informal_verifier.df = eval_d0; + Informal_verifier.ddf = eval_dd0};; + + +(* domain *) +let xx = `[&2; &2; &2; #2.52; &2; &2]` and + zz = `[#2.52; #2.52; #2.52; sqrt(&8); #2.52; #2.52]`;; + +let xx_s = `[&2; &2; &2; #2.52; &2; &2]` and + zz_s = `[#2.52; #2.1; #2.1; sqrt(&8); #2.1; #2.1]`;; + +let pp0 = 3;; +let xx1 = convert_to_float_list pp0 true xx and + zz1 = convert_to_float_list pp0 false zz and + xx1_s = convert_to_float_list pp0 true xx_s and + zz1_s = convert_to_float_list pp0 false zz_s;; + +let xx2 = Informal_taylor.convert_to_float_list pp0 true xx and + zz2 = Informal_taylor.convert_to_float_list pp0 false zz and + xx2_s = Informal_taylor.convert_to_float_list pp0 true xx_s and + zz2_s = Informal_taylor.convert_to_float_list pp0 false zz_s;; + +let xx_float, zz_float, xx_s_float, zz_s_float = + let pad = replicate 0.0 (8 - length (dest_list xx1)) in + map float_of_float_tm (dest_list xx1) @ pad, + map float_of_float_tm (dest_list zz1) @ pad, + map float_of_float_tm (dest_list xx1_s) @ pad, + map float_of_float_tm (dest_list zz1_s) @ pad;; + + +(* certificates *) + +let c_s = run_test tf_9922 xx_s_float zz_s_float false 0.0 true false false false 0.0;; +let c0 = run_test tf_9922 xx_float zz_float false 0.0 true false false false 0.0;; +let c_test = run_test tf_9922 xx_float zz_float false 0.0 true true true true 0.0;; + +(* pass = 179, mono = 26 *) +result_stat c_s;; +(* pass = 6322, mono = 235 *) +result_stat c0;; +(* pass = 6307 (raw = 5), mono = 220, pass_mono = 15 *) +result_stat c_test;; + +let p_split = pp and + p_min = 1 and + p_max = pp;; + +let cp_s = Informal_verifier.m_verify_raw0 p_split p_min p_max ti c_s xx2_s zz2_s;; +let cp0 = Informal_verifier.m_verify_raw0 p_split p_min p_max ti c0 xx2 zz2;; + + +(*********************) + +reset_all();; + +(* 200 (m_taylor_arith2): 157.2 *) +let _ = + let start = Sys.time() in + let result = m_p_verify_raw0 n p_split eval_taylor cp_s xx1_s zz1_s in + let finish = Sys.time() in + let _ = report + (sprintf "Verification time: %f" (finish -. start)) in + result;; + + +reset_all();; + +(* 200 (m_taylor_arith2): 5039.6 *) +let _ = + let start = Sys.time() in + let result = m_p_verify_raw0 n p_split eval_taylor cp0 xx1 zz1 in + let finish = Sys.time() in + let _ = report + (sprintf "Verification time: %f" (finish -. start)) in + result;; diff --git a/formal_lp/old/arith/informal/tests3.hl b/formal_lp/old/arith/informal/tests3.hl new file mode 100644 index 0000000..2e369d3 --- /dev/null +++ b/formal_lp/old/arith/informal/tests3.hl @@ -0,0 +1,247 @@ +needs "../formal_lp/formal_interval/m_taylor_arith.hl";; +needs "../formal_lp/formal_interval/m_verifier.hl";; +needs "../formal_lp/arith/informal/informal_m_verifier.hl";; + + +let reset_all () = + Arith_cache.reset_stat(); + Arith_cache.reset_cache(); + Arith_float.reset_stat(); + Arith_float.reset_cache();; + + +let dest_int int = + let f1, f2 = Informal_interval.dest_interval int in + Informal_float.dest_float f1, Informal_float.dest_float f2;; + +let dest_f = Informal_float.dest_float;; + +let dest_dom dom = + map dest_f dom.Informal_taylor.lo, + map dest_f dom.Informal_taylor.hi, + map dest_f dom.Informal_taylor.y, + map dest_f dom.Informal_taylor.w;; + +let dest_ti ti = + dest_int ti.Informal_taylor.f, + map dest_int ti.Informal_taylor.df, + map (map dest_int) ti.Informal_taylor.ddf;; + + + +(******************************) + +(* dummy functions *) + +let eval_d0 i pp t1 t2 = failwith "eval_d0";; +let eval_dd0 i j pp t1 t2 = failwith "eval_dd0";; +let eval_0 pp t1 t2 = failwith "eval_0";; +let eval_diff2 t1 t2 = failwith "eval_diff2";; + + +(********************************) +(* ArcProperties.hl inequality *) + +let n = 2;; +let p_split = 8 and + p_min = 1 and + p_max = 10;; + +let poly1 = `\x:real^2. x$1 * x$1 + x$2 * x$2 - &2 * &2`;; +let poly2 = `\x:real^2. &2 * x$1 * x$2`;; +let lm2_poly = `\x:real^2. (#2.52 - x$1 * inv(&2)) * inv(#2.52 - &1)`;; + +let eval1, tf1, ti1 = + mk_verification_functions p_split poly1 false `&0`;; + +let eval2, tf2, ti2 = + mk_verification_functions p_split poly2 false `&0`;; + +let eval_lm2, tf_lm2, ti_lm2 = + mk_verification_functions p_split lm2_poly false `&0`;; + + +(* arc *) +open Univariate;; + +let tf_arc = + let r = Product (tf1, Uni_compose (uinv, tf2)) in + Uni_compose (uacos, r);; + + +let eval_arc p_lin p_second th = + let inv, acs, ( * ) = + eval_m_taylor_inv n p_lin p_second, eval_m_taylor_acs n p_lin p_second, + eval_m_taylor_mul n p_lin p_second in + let r1 = eval1.taylor p_lin p_second th and + r2 = eval2.taylor p_lin p_second th in + acs (r1 * inv r2);; + + +let ti_arc p_lin p_second dom = + let inv, acs, ( * ) = + Informal_taylor.eval_m_taylor_inv p_lin p_second, Informal_taylor.eval_m_taylor_acs p_lin p_second, + Informal_taylor.eval_m_taylor_mul p_lin p_second in + let r1 = ti1.Informal_verifier.taylor p_lin p_second dom and + r2 = ti2.Informal_verifier.taylor p_lin p_second dom in + acs (r1 * inv r2);; + + +(*********************) + +let eval_ineq p_lin p_second th = + let arc = eval_arc p_lin p_second + +Sphere.lmfun;; + + +let eval_taylor = + {taylor = eval_dih_y_hi; f = eval_0; df = eval_d0; ddf = eval_dd0; diff2_f = eval_diff2};; + +let ti = + {Informal_verifier.taylor = ti_dih_y_hi; + Informal_verifier.f = eval_0; + Informal_verifier.df = eval_d0; + Informal_verifier.ddf = eval_dd0};; + + + +(************) +(* Small domain *) +let xx_s = `[&2; &2; &2; &2; &2; &2]` and + zz_s = `[#2.1; #2.1; #2.1; #2.1; #2.1; #2.1]`;; + +let domain_th = + let xx1_s = convert_to_float_list pp true xx_s and + zz1_s = convert_to_float_list pp false zz_s in + mk_m_center_domain n pp xx1_s zz1_s;; + +let dom = + let xx2_s = Informal_taylor.convert_to_float_list pp true xx_s and + zz2_s = Informal_taylor.convert_to_float_list pp false zz_s in + Informal_taylor.mk_m_center_domain pp xx2_s zz2_s;; + + + +(* 10: 9.121 (pp = 15) *) +(* 300: 5.5 (pp = 8) *) +(* 100 (cached, float_cached, pp = 8): 2.68 *) +reset_all();; +test 1 (eval_dih_y_hi pp pp) domain_th;; +(* 100: 1.668 *) +test 1 (eval_dih_y_hi pp pp) domain_th;; +(* 100: 0.088 *) +test 1 (ti_dih_y_hi pp pp) dom;; + + +Arith_cache.print_stat();; +Arith_float.print_stat();; + +(***) + +let th1 = eval_4y1_delta_y.taylor pp pp domain_th;; +let th2 = eval_neg_delta_y4.taylor pp pp domain_th;; +let pi2_th = eval_pi2_plus.taylor pp pp domain_th;; + +let r1 = eval_m_taylor_sqrt n pp th1;; +let r2 = eval_m_taylor_inv n pp r1;; +let r3 = eval_m_taylor_mul n pp th2 r2;; +let r4 = eval_m_taylor_atn n pp r3;; +let r5 = eval_m_taylor_add n pp pi2_th r4;; + + +reset_all();; +(* 100: 0.264 (second: 0.084) *) +test 1 (eval_4y1_delta_y.taylor pp pp) domain_th;; +(* 100: 0.032 (second: 0.020) *) +test 1 (eval_neg_delta_y4.taylor pp pp) domain_th;; +(* 100: 0.000 (second: 0.000) *) +test 1 (eval_pi2_plus.taylor pp pp) domain_th;; + +(* 100: 0.444 (second: 0.280) *) +test 1 (eval_m_taylor_sqrt n pp) th1;; +(* 100: 0.496 (second: 0.284) *) +test 1 (eval_m_taylor_inv n pp) r1;; +(* 100: 0.512 (second: 0.396) *) +test 1 (eval_m_taylor_mul n pp th2) r2;; +(* 100: 0.780 (second: 0.444) *) +test 1 (eval_m_taylor_atn n pp) r3;; +(* 100: 0.264 (second: 0.256) *) +test 1 (eval_m_taylor_add n pp pi2_th) r4;; + + + +(***) +let xx = `[&2; &2; &2; &2; &2; &2]` and + zz = `[#2.52; #2.52; #2.52; #2.52; #2.52; #2.52]`;; + +let xx_s = `[&2; &2; &2; &2; &2; &2]` and + zz_s = `[#2.52; #2.1; #2.1; #2.1; #2.1; #2.1]`;; + +let xx_s2 = `[&2; &2; &2; &2; &2; &2]` and + zz_s2 = `[#2.52; #2.2; #2.2; #2.2; #2.2; #2.2]`;; + + +let pp0 = 3;; +let xx1 = convert_to_float_list pp0 true xx and + zz1 = convert_to_float_list pp0 false zz and + xx1_s = convert_to_float_list pp0 true xx_s and + zz1_s = convert_to_float_list pp0 false zz_s and + xx1_s2 = convert_to_float_list pp0 true xx_s2 and + zz1_s2 = convert_to_float_list pp0 false zz_s2;; + +let xx2 = Informal_taylor.convert_to_float_list pp0 true xx and + zz2 = Informal_taylor.convert_to_float_list pp0 false zz and + xx2_s = Informal_taylor.convert_to_float_list pp0 true xx_s and + zz2_s = Informal_taylor.convert_to_float_list pp0 false zz_s and + xx2_s2 = Informal_taylor.convert_to_float_list pp0 true xx_s2 and + zz2_s2 = Informal_taylor.convert_to_float_list pp0 false zz_s2;; + + +let xx_float, zz_float, xx_s_float, zz_s_float, xx_s2_float, zz_s2_float = + let pad = replicate 0.0 (8 - length (dest_list xx1)) in + map float_of_float_tm (dest_list xx1) @ pad, + map float_of_float_tm (dest_list zz1) @ pad, + map float_of_float_tm (dest_list xx1_s) @ pad, + map float_of_float_tm (dest_list zz1_s) @ pad, + map float_of_float_tm (dest_list xx1_s2) @ pad, + map float_of_float_tm (dest_list zz1_s2) @ pad;; + + + +(***) + + +let c_dih_y_s = run_test tf_dih_y_hi xx_s_float zz_s_float false 0.0 true false true false 0.0;; +let c_dih_y_s2 = run_test tf_dih_y_hi xx_s2_float zz_s2_float false 0.0 true false true false 0.0;; +let c_dih_y0 = run_test tf_dih_y_hi xx_float zz_float false 0.0 true false false false 0.0;; + +(* pass = 4 *) +result_stat c_dih_y_s;; +(* pass = 63 *) +result_stat c_dih_y_s2;; +(* pass = 4294, mono = 10 *) +result_stat c_dih_y0;; + +let p_split = pp and + p_min = 1 and + p_max = pp;; + +let cp_s = Informal_verifier.m_verify_raw0 p_split p_min p_max ti c_dih_y_s xx2_s zz2_s;; +let cp_s2 = Informal_verifier.m_verify_raw0 p_split p_min p_max ti c_dih_y_s2 xx2_s2 zz2_s2;; + + +(*********************) + +reset_all();; + +(* 10 (pp = 15): 38.418 *) +(* 300 (pp = 8): 22.289 *) +(* 100 (cached, float_cached, pp = 8): 12.229 *) +let _ = + let start = Sys.time() in + let result = m_verify_raw0 n pp eval_taylor c_dih_y_s xx1_s zz1_s in + let finish = Sys.time() in + let _ = report + (sprintf "Verification time: %f" (finish -. start)) in + result;; diff --git a/formal_lp/old/arith/informal/tests_poly.hl b/formal_lp/old/arith/informal/tests_poly.hl new file mode 100644 index 0000000..5c756ae --- /dev/null +++ b/formal_lp/old/arith/informal/tests_poly.hl @@ -0,0 +1,134 @@ +(* Tests *) +needs "../formal_lp/formal_interval/m_verifier.hl";; + +let reset_all () = + Arith_cache.reset_stat(); + Arith_cache.reset_cache(); + Arith_float.reset_stat(); + Arith_float.reset_cache();; + +let dest_int int = + let f1, f2 = Informal_interval.dest_interval int in + Informal_float.dest_float f1, Informal_float.dest_float f2;; + +let dest_f = Informal_float.dest_float;; + +let dest_dom dom = + map dest_f dom.Informal_taylor.lo, + map dest_f dom.Informal_taylor.hi, + map dest_f dom.Informal_taylor.y, + map dest_f dom.Informal_taylor.w;; + +let dest_ti ti = + dest_int ti.Informal_taylor.f, + map dest_int ti.Informal_taylor.df, + map (map dest_int) ti.Informal_taylor.ddf;; + + +(***) +let beale = expr_to_vector_fun `(#1.5 - x1 + x1 * x2) pow 2 + (#2.25 - x1 + x1 * x2 pow 2) pow 2 + (#2.625 - x1 + x1 * x2 pow 3) pow 2` and + beale_dom = `[-- &10; -- &10], [&10; &10]` and + beale_min = `-- (#0.1 pow 6)`;; + +let camelback = expr_to_vector_fun `&12 * x1 pow 2 - #6.3 * x1 pow 4 + x1 pow 6 + &3 * x1 * x2 - &12 * x2 pow 2 + &12 * x2 pow 4` and + camelback_dom = `[-- &5; -- &5], [&5; &5]` and + camelback_min = `-- #3.0949288079362787`;; + +let goldstein_price = expr_to_vector_fun + `(&1 + (x1 + x2 + &1) pow 2 * + (&19 - &14 * x1 + &13 * x1 pow 2 - &14 * x2 + &6 * x1 * x2 + &3 * x2 pow 2)) * + (&30 + (&2 * x1 - &3 * x2) pow 2 * + (&18 - &32 * x1 + &12 * x1 pow 2 + &48 * x2 - &36 * x1 * x2 + &27 * x2 pow 2))` and + goldstein_price_dom = `[-- &2; -- &2], [&2; &2]` and + goldstein_price_min = `#2.999948501586914`;; + +(**********************) + +let mk_doms pp dom_tm = + let xx, zz = dest_pair dom_tm in + let xx1, zz1 = convert_to_float_list pp true xx, convert_to_float_list pp false zz in + let xx2, zz2 = + let conv = Informal_taylor.convert_to_float_list pp in + conv true xx, conv false zz in + let xf, zf = + let conv = map float_of_float_tm o dest_list in + conv xx1, conv zz1 in + (xx1, zz1), (xx2, zz2), (xf, zf);; + + +let p_split = 8 and + p_min = 1 and + p_max = 10;; + +(****************) + +let n = 2;; +let ineq_tm, dom_tm, min_tm = beale, beale_dom, beale_min;; +let (xx1, zz1), (xx2, zz2), (xx_float, zz_float) = mk_doms p_split dom_tm;; + +let eval_ineq, tf_ineq, ti_ineq = mk_verification_functions p_split ineq_tm true min_tm;; +let certificate = run_test tf_ineq xx_float zz_float false 0.0 true true true true 0.0;; +(* pass = 4585 (raw = 4500); pass_min = 59 *) +result_stat certificate;; +let c1 = transform_result xx_float zz_float certificate;; + +let cp1 = Informal_verifier.m_verify_list p_split p_min p_max ti_ineq c1 xx2 zz2;; +map (result_p_stat false o snd) cp1;; + +(* 100 (cached): 67.984 *) +reset_all();; +test 1 (m_p_verify_list n p_split eval_ineq cp1 xx1) zz1;; + + +(****************) + +let n = 2;; +let ineq_tm, dom_tm, min_tm = camelback, camelback_dom, camelback_min;; +let (xx1, zz1), (xx2, zz2), (xx_float, zz_float) = mk_doms p_split dom_tm;; + +let eval_ineq, tf_ineq, ti_ineq = mk_verification_functions p_split ineq_tm true min_tm;; +let certificate = run_test tf_ineq xx_float zz_float false 0.0 true true true true 0.0;; +let c0 = run_test tf_ineq xx_float zz_float false 0.0 true true false true 0.0;; +(* pass = 78 (raw = 4); pass_min = 90 *) +result_stat certificate;; +(* pass = 272 (raw = 68); mono = 118 *) +result_stat c0;; +let c1 = transform_result xx_float zz_float certificate;; + +let cp1 = Informal_verifier.m_verify_list p_split p_min p_max ti_ineq c1 xx2 zz2;; +let cp0 = Informal_verifier.m_verify_raw0 p_split p_min p_max ti_ineq c0 xx2 zz2;; +(* 100 - 4: 34; 3: 74; 2: 234; 1: 48 *) +result_p_stat false cp0;; + +(* 100 (cached): 3.68 *) +reset_all();; +test 1 (m_p_verify_list n p_split eval_ineq cp1 xx1) zz1;; +(* 100: 2.268 *) +test 1 (m_p_verify_list n p_split eval_ineq cp1 xx1) zz1;; + +(* 100 (cached): 6.208 *) +reset_all();; +test 1 (m_p_verify_raw0 n p_split eval_ineq cp0 xx1) zz1;; +(* 100: 3.676 *) +test 1 (m_p_verify_raw0 n p_split eval_ineq cp0 xx1) zz1;; + +(************) + +let n = 2;; +let ineq_tm, dom_tm, min_tm = goldstein_price, goldstein_price_dom, goldstein_price_min;; +let (xx1, zz1), (xx2, zz2), (xx_float, zz_float) = mk_doms p_split dom_tm;; + +let eval_ineq, tf_ineq, ti_ineq = mk_verification_functions p_split ineq_tm true min_tm;; +let certificate = run_test tf_ineq xx_float zz_float false 0.0 true true true true 0.0;; +(* pass = 2153 (raw = 333); pass_min = 29 *) +result_stat certificate;; +let c1 = transform_result xx_float zz_float certificate;; + +let cp1 = Informal_verifier.m_verify_list p_split p_min p_max ti_ineq c1 xx2 zz2;; +(* map (result_p_stat false o snd) cp1;; *) + +(* 100 (cached): 428.127 *) +reset_all();; +test 1 (m_p_verify_list n p_split eval_ineq cp1 xx1) zz1;; + + diff --git a/formal_lp/old/arith/interval_arith.hl b/formal_lp/old/arith/interval_arith.hl new file mode 100644 index 0000000..7a19085 --- /dev/null +++ b/formal_lp/old/arith/interval_arith.hl @@ -0,0 +1,26 @@ +(********************************) +(* Interval arithmetic (theory) *) +(********************************) + +module Interval_arith = struct + +(* The main definition *) +let interval_arith = + new_definition `interval_arith (x:real) (lo, hi) <=> lo <= x /\ x <= hi`;; + + +let CONST_INTERVAL = prove(`!x. interval_arith x (x,x)`, + REWRITE_TAC[interval_arith; REAL_LE_REFL]);; + + +let APPROX_INTERVAL = prove(`(a <= lo /\ hi <= b) /\ interval_arith x (lo, hi) + ==> interval_arith x (a,b)`, + REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; + +let INTERVAL_NEG = prove(`interval_arith x (a, b) ==> + interval_arith (--x) (--b, --a)`, + REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; + + + +end;; diff --git a/formal_lp/old/arith/misc.hl b/formal_lp/old/arith/misc.hl new file mode 100644 index 0000000..177b270 --- /dev/null +++ b/formal_lp/old/arith/misc.hl @@ -0,0 +1,58 @@ +(************************************) +(* Contains commonly used functions *) +(************************************) +module Arith_misc = struct + +(* A little faster version of PROVE_HYP *) +let MY_PROVE_HYP hyp th = EQ_MP (DEDUCT_ANTISYM_RULE hyp th) hyp;; + +(* A faster version of BETA_RULE *) +let MY_BETA_RULE th = + let rec beta tm = + let op, arg = dest_comb tm in + if is_comb op then + let op_th = AP_THM (beta op) arg in + let beta_th = BETA_CONV (rand (concl op_th)) in + TRANS op_th beta_th + else + BETA_CONV tm in + EQ_MP (beta (concl th)) th;; + + +(* Applies f to arg the given number of times and returns the total execution time *) +let test n f arg = + let start = Sys.time() in + for i = 1 to n do + let _ = f arg in () + done; + Sys.time() -. start;; + +(* Generates a power function for the given binary operation *) +let gen_pow op id n x = + let ( * ) = op in + let rec pow n = + if n <= 0 then id + else if n = 1 then x + else if n land 1 = 1 then + x * pow (n - 1) + else + let t = pow (n lsr 1) in + t * t in + pow n;; + +let rec shape_list n list = + if length list <= n then [list] + else + let l1, l2 = chop_list n list in + l1 :: shape_list n l2;; + +(* map2 which works for lists of any size (no requirement |l1| = |l2|) *) +let rec my_map2 f l1 l2 = + match l1 with + | [] -> [] + | (h1::t1) -> + (match l2 with + | [] -> [] + | (h2::t2) -> (f h1 h2) :: my_map2 f t1 t2);; + +end;; diff --git a/formal_lp/old/arith/nat.hl b/formal_lp/old/arith/nat.hl new file mode 100644 index 0000000..e3d4b20 --- /dev/null +++ b/formal_lp/old/arith/nat.hl @@ -0,0 +1,100 @@ +(*********************************) +(* The natural number arithmetic *) +(*********************************) + +(* Dependencies *) +needs "../formal_lp/arith/arith_options.hl";; +needs "../formal_lp/arith/arith_cache.hl";; + +module Arith_nat = struct + +open Arith_options;; + +(* mk *) +let mk_small_numeral_array = Arith_hash.mk_small_numeral_array;; +let mk_numeral_array = Arith_hash.mk_numeral_array;; +let NUMERAL_TO_NUM_CONV = Arith_hash.NUMERAL_TO_NUM_CONV;; +let NUM_TO_NUMERAL_CONV = Arith_hash.NUM_TO_NUMERAL_CONV;; + +(* dest *) +let raw_dest_hash = Arith_hash.raw_dest_hash;; + +(* SUC *) +let raw_suc_conv_hash = + if cached then Arith_cache.raw_suc_conv_hash else Arith_hash.raw_suc_conv_hash;; + +let NUM_SUC_HASH_CONV = Arith_hash.NUM_SUC_HASH_CONV;; + +(* x = 0 *) +let raw_eq0_hash_conv = + if cached then Arith_cache.raw_eq0_hash_conv else Arith_hash.raw_eq0_hash_conv;; + +let NUM_EQ0_HASH_CONV = Arith_hash.NUM_EQ0_HASH_CONV;; + +(* PRE *) +let raw_pre_hash_conv = + if cached then Arith_cache.raw_pre_hash_conv else Arith_hash.raw_pre_hash_conv;; + +let NUM_PRE_HASH_CONV = Arith_hash.NUM_PRE_HASH_CONV;; + +(* x > 0 *) +let raw_gt0_hash_conv = + if cached then Arith_cache.raw_gt0_hash_conv else Arith_hash.raw_gt0_hash_conv;; + +let NUM_GT0_HASH_CONV = Arith_hash.NUM_GT0_HASH_CONV;; + +(* x < y, x <= y *) +let raw_lt_hash_conv = + if cached then Arith_cache.raw_lt_hash_conv else Arith_hash.raw_lt_hash_conv;; + +let raw_le_hash_conv = + if cached then Arith_cache.raw_le_hash_conv else Arith_hash.raw_le_hash_conv;; + +let NUM_LT_HASH_CONV = Arith_hash.NUM_LT_HASH_CONV;; + +let NUM_LE_HASH_CONV = Arith_hash.NUM_LE_HASH_CONV;; + +(* x + y *) +let raw_add_conv_hash = + if cached then Arith_cache.raw_add_conv_hash else Arith_hash.raw_add_conv_hash;; + +let NUM_ADD_HASH_CONV = Arith_hash.NUM_ADD_HASH_CONV;; + +(* x - y *) +let raw_sub_hash_conv = + if cached then Arith_cache.raw_sub_hash_conv else Arith_hash.raw_sub_hash_conv;; + +let raw_sub_and_le_hash_conv = + if cached then Arith_cache.raw_sub_and_le_hash_conv else Arith_hash.raw_sub_and_le_hash_conv;; + +let NUM_SUB_HASH_CONV = Arith_hash.NUM_SUB_HASH_CONV;; + +(* x * y *) +let raw_mul_conv_hash = + if cached then Arith_cache.raw_mul_conv_hash else Arith_hash.raw_mul_conv_hash;; + +let NUM_MULT_HASH_CONV = Arith_hash.NUM_MULT_HASH_CONV;; + +(* x / y *) +let raw_div_hash_conv = + if cached then Arith_cache.raw_div_hash_conv else Arith_hash.raw_div_hash_conv;; + +let NUM_DIV_HASH_CONV = Arith_hash.NUM_DIV_HASH_CONV;; + +(* EVEN, ODD *) +let raw_even_hash_conv = + if cached then Arith_cache.raw_even_hash_conv else Arith_hash.raw_even_hash_conv;; + +let raw_odd_hash_conv = + if cached then Arith_cache.raw_odd_hash_conv else Arith_hash.raw_odd_hash_conv;; + +let NUM_EVEN_HASH_CONV = Arith_hash.NUM_EVEN_HASH_CONV;; + +let NUM_ODD_HASH_CONV = Arith_hash.NUM_ODD_HASH_CONV;; + + +let NUMERALS_TO_NUM = + PURE_REWRITE_RULE[Arith_hash.NUM_THM] o CONV_RULE (DEPTH_CONV NUMERAL_TO_NUM_CONV);; + + +end;; diff --git a/formal_lp/old/arith/num_exp_theory.hl b/formal_lp/old/arith/num_exp_theory.hl new file mode 100644 index 0000000..eb13af4 --- /dev/null +++ b/formal_lp/old/arith/num_exp_theory.hl @@ -0,0 +1,184 @@ +(* Exponential representation of natural numbers *) + +(* Dependencies *) +needs "../formal_lp/arith/nat.hl";; + + +module Num_exp_theory = struct + +open Arith_options;; + + +let base_const = mk_small_numeral base;; + +(* num_exp definition *) +let num_exp_tm = mk_eq (`(num_exp:num->num->num) n e`, + mk_binop `( * ):num->num->num` `n:num` (mk_binop `EXP` base_const `e:num`));; +(* let num_exp = new_definition `num_exp n e = n * 2 EXP e`;; *) +let num_exp = new_definition num_exp_tm;; + +(**********************************) +(* Theorems *) + +let NUM_EXP_EXP = prove(`!n e1 e2. num_exp (num_exp n e1) e2 = num_exp n (e1 + e2)`, + REPEAT GEN_TAC THEN + REWRITE_TAC[num_exp; EXP_ADD] THEN + ARITH_TAC);; + + +let NUM_EXP_SUM = prove(`!n e1 e2. num_exp n (e1 + e2) = num_exp n e1 * num_exp 1 e2`, + REPEAT GEN_TAC THEN + REWRITE_TAC[num_exp; EXP_ADD] THEN + ARITH_TAC);; + + +let NUM_EXP_SUM1 = prove(`!n e1 e2. num_exp n (e1 + e2) = num_exp 1 e1 * num_exp n e2`, + REPEAT GEN_TAC THEN REWRITE_TAC[num_exp; EXP_ADD] THEN ARITH_TAC);; + +let NUM_EXP_0 = prove(`!n. n = num_exp n 0`, + GEN_TAC THEN REWRITE_TAC[num_exp; EXP; MULT_CLAUSES]);; + +let NUM_EXP_LE = prove(`!m n e. m <= n ==> num_exp m e <= num_exp n e`, + SIMP_TAC[num_exp; LE_MULT_RCANCEL]);; + +let NUM_EXP_LT = prove(`!m n e. m < n ==> num_exp m e < num_exp n e`, + SIMP_TAC[num_exp; LT_MULT_RCANCEL; EXP_EQ_0] THEN + ARITH_TAC);; + +let NUM_EXP_EQ_0 = prove(`!n e. num_exp n e = 0 <=> n = 0`, + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[num_exp; MULT_EQ_0; EXP_EQ_0] THEN + ARITH_TAC);; + +let NUM_EXP_MUL = prove(`!n1 e1 n2 e2. num_exp n1 e1 * num_exp n2 e2 = num_exp (n1 * n2) (e1 + e2)`, + REWRITE_TAC[num_exp; EXP_ADD] THEN ARITH_TAC);; + +let NUM_EXP_ADD = prove(`!n1 e1 n2 e2. e1 <= e2 ==> + num_exp n1 e1 + num_exp n2 e2 = num_exp (n1 + num_exp n2 (e2 - e1)) e1`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[num_exp] THEN + REWRITE_TAC[ARITH_RULE `(a + b * c) * d = a * d + b * (c * d):num`] THEN + REWRITE_TAC[GSYM EXP_ADD] THEN + ASM_SIMP_TAC[ARITH_RULE `e1 <= e2 ==> e2 - e1 + e1 = e2:num`]);; + +let NUM_EXP_SUB2 = prove(`!n1 e1 n2 e2 r. e1 <= e2 /\ e2 - e1 = r ==> + num_exp n1 e1 - num_exp n2 e2 = num_exp (n1 - num_exp n2 r) e1`, + REPEAT STRIP_TAC THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[num_exp] THEN + MP_TAC (ARITH_RULE `e1 <= e2 ==> e2 = (e2 - e1) + e1:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [th]) THEN + REWRITE_TAC[EXP_ADD; MULT_ASSOC] THEN + REWRITE_TAC[GSYM RIGHT_SUB_DISTRIB]);; + +let NUM_EXP_SUB1 = prove(`!n1 e1 n2 e2 r. e2 <= e1 /\ e1 - e2 = r ==> + num_exp n1 e1 - num_exp n2 e2 = num_exp (num_exp n1 r - n2) e2`, + REPEAT STRIP_TAC THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[num_exp] THEN + MP_TAC (ARITH_RULE `e2 <= e1 ==> e1 = (e1 - e2) + e2:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [th]) THEN + REWRITE_TAC[EXP_ADD; MULT_ASSOC] THEN + REWRITE_TAC[GSYM RIGHT_SUB_DISTRIB]);; + +(* NUM_EXP_LE *) + +let NUM_EXP_LE1 = prove(`!n1 e1 n2 e2 r. e2 <= e1 /\ e1 - e2 = r /\ n2 <= num_exp n1 r + ==> num_exp n2 e2 <= num_exp n1 e1`, + REPEAT GEN_TAC THEN REWRITE_TAC[num_exp] THEN + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN DISCH_TAC THEN + MP_TAC (ARITH_RULE `e2 <= e1 ==> e1 = (e1 - e2) + e2:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN(fun th -> ONCE_REWRITE_TAC[th]) THEN + REWRITE_TAC[EXP_ADD; MULT_ASSOC] THEN + ASM_REWRITE_TAC[LE_MULT_RCANCEL]);; + +let NUM_EXP_LE2 = prove(`!n1 e1 n2 e2 r. e1 <= e2 /\ e2 - e1 = r /\ num_exp n2 r <= n1 + ==> num_exp n2 e2 <= num_exp n1 e1`, + REPEAT GEN_TAC THEN REWRITE_TAC[num_exp] THEN + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN DISCH_TAC THEN + MP_TAC (ARITH_RULE `e1 <= e2 ==> e2 = (e2 - e1) + e1:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN(fun th -> ONCE_REWRITE_TAC[th]) THEN + REWRITE_TAC[EXP_ADD; MULT_ASSOC] THEN + ASM_REWRITE_TAC[LE_MULT_RCANCEL]);; + +let NUM_EXP_LE1_EQ = prove(`!n1 e1 n2 e2 r x. e2 <= e1 /\ e1 - e2 = r /\ num_exp n1 r = x ==> + (num_exp n1 e1 <= num_exp n2 e2 <=> x <= n2)`, + REPEAT GEN_TAC THEN REWRITE_TAC[num_exp] THEN + STRIP_TAC THEN + REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + MP_TAC (ARITH_RULE `e2 <= e1 ==> e1 = (e1 - e2) + e2:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [th]) THEN + REWRITE_TAC[EXP_ADD; MULT_ASSOC] THEN + ASM_REWRITE_TAC[LE_MULT_RCANCEL; EXP_EQ_0; ARITH_EQ]);; + +let NUM_EXP_LE2_EQ = prove(`!n1 e1 n2 e2 r x. e1 <= e2 /\ e2 - e1 = r /\ num_exp n2 r = x ==> + (num_exp n1 e1 <= num_exp n2 e2 <=> n1 <= x)`, + REPEAT GEN_TAC THEN REWRITE_TAC[num_exp] THEN + STRIP_TAC THEN + REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + MP_TAC (ARITH_RULE `e1 <= e2 ==> e2 = (e2 - e1) + e1:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [th]) THEN + REWRITE_TAC[EXP_ADD; MULT_ASSOC] THEN + ASM_REWRITE_TAC[LE_MULT_RCANCEL; EXP_EQ_0; ARITH_EQ]);; + +(* NUM_EXP_LT *) + +let NUM_EXP_LT1 = prove(`!n1 e1 n2 e2 r. e2 <= e1 /\ e1 - e2 = r /\ n2 < num_exp n1 r + ==> num_exp n2 e2 < num_exp n1 e1`, + REPEAT GEN_TAC THEN REWRITE_TAC[num_exp] THEN + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN DISCH_TAC THEN + MP_TAC (ARITH_RULE `e2 <= e1 ==> e1 = (e1 - e2) + e2:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th]) THEN + REWRITE_TAC[EXP_ADD; MULT_ASSOC] THEN + ASM_REWRITE_TAC[LT_MULT_RCANCEL; EXP_EQ_0; ARITH_EQ]);; + + + +let NUM_EXP_LT2 = prove(`!n1 e1 n2 e2 r. e1 <= e2 /\ e2 - e1 = r /\ num_exp n2 r < n1 + ==> num_exp n2 e2 < num_exp n1 e1`, + REPEAT GEN_TAC THEN REWRITE_TAC[num_exp] THEN + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN DISCH_TAC THEN + MP_TAC (ARITH_RULE `e1 <= e2 ==> e2 = (e2 - e1) + e1:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th]) THEN + REWRITE_TAC[EXP_ADD; MULT_ASSOC] THEN + ASM_REWRITE_TAC[LT_MULT_RCANCEL; EXP_EQ_0; ARITH_EQ]);; + + + +let NUM_EXP_LT1_EQ = prove(`!n1 e1 n2 e2 r x. e2 <= e1 /\ e1 - e2 = r /\ num_exp n1 r = x ==> + (num_exp n1 e1 < num_exp n2 e2 <=> x < n2)`, + REPEAT GEN_TAC THEN REWRITE_TAC[num_exp] THEN + STRIP_TAC THEN + REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + MP_TAC (ARITH_RULE `e2 <= e1 ==> e1 = (e1 - e2) + e2:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [th]) THEN + REWRITE_TAC[EXP_ADD; MULT_ASSOC] THEN + ASM_REWRITE_TAC[LT_MULT_RCANCEL; EXP_EQ_0; ARITH_EQ]);; + + + +let NUM_EXP_LT2_EQ = prove(`!n1 e1 n2 e2 r x. e1 <= e2 /\ e2 - e1 = r /\ num_exp n2 r = x ==> + (num_exp n1 e1 < num_exp n2 e2 <=> n1 < x)`, + REPEAT GEN_TAC THEN REWRITE_TAC[num_exp] THEN + STRIP_TAC THEN + REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + MP_TAC (ARITH_RULE `e1 <= e2 ==> e2 = (e2 - e1) + e1:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [th]) THEN + REWRITE_TAC[EXP_ADD; MULT_ASSOC] THEN + ASM_REWRITE_TAC[LT_MULT_RCANCEL; EXP_EQ_0; ARITH_EQ]);; + +end;; diff --git a/formal_lp/old/arith/prove_lp.hl b/formal_lp/old/arith/prove_lp.hl new file mode 100644 index 0000000..6ff5958 --- /dev/null +++ b/formal_lp/old/arith/prove_lp.hl @@ -0,0 +1,523 @@ +needs "arith/arith_int.hl";; + +open Arith_hash;; + +(********************) +(* Main definitions *) +(********************) + +(* A linear function *) +let lin_f = new_definition `lin_f terms = + ITLIST (\tm x. (FST tm) * (SND tm) + x) terms (&0)`;; + +(* Example: let x = `lin_f [&1, x:real; &2, y:real]`;; *) + + +(**********************) +(* Theorems for lin_f *) +(**********************) + +(* Basic properties of lin_f *) +let LIN_F_CONS = prove(`!h t. lin_f (CONS h t) = (FST h * SND h) + lin_f t`, + REWRITE_TAC[lin_f; ITLIST]);; + + +let LIN_F_EMPTY = prove(`lin_f [] = &0`, + REWRITE_TAC[lin_f; ITLIST]);; + + +let LIN_F_APPEND = prove(`!t1 t2. lin_f (APPEND t1 t2) = lin_f t1 + lin_f t2`, + LIST_INDUCT_TAC THEN REWRITE_TAC[APPEND] THENL + [ + REWRITE_TAC[LIN_F_EMPTY; REAL_ADD_LID]; + ALL_TAC + ] THEN + + GEN_TAC THEN + ASM_REWRITE_TAC[LIN_F_CONS; REAL_ADD_ASSOC]);; + + +(* Sum of two lin_f *) + +let LIN_F_SUM_HD = prove(`!v c1 t1 c2 t2 c. c1 + c2 = c ==> + lin_f (CONS (c1,v) t1) + lin_f (CONS (c2,v) t2) = lin_f [c,v] + (lin_f t1 + lin_f t2)`, + REPEAT GEN_TAC THEN REWRITE_TAC[LIN_F_CONS; LIN_F_EMPTY] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN REAL_ARITH_TAC);; + +let LIN_F_SUM_HD_ZERO = prove(`!v c1 t1 c2 t2. c1 + c2 = &0 ==> + lin_f (CONS (c1,v) t1) + lin_f (CONS (c2,v) t2) = lin_f t1 + lin_f t2`, + REPEAT GEN_TAC THEN DISCH_THEN (MP_TAC o MATCH_MP LIN_F_SUM_HD) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; LIN_F_CONS; LIN_F_EMPTY]) THEN + REAL_ARITH_TAC);; + +let LIN_F_SUM_EMPTY1 = prove(`!x. lin_f [] + lin_f x = lin_f x`, + REWRITE_TAC[LIN_F_EMPTY; REAL_ADD_LID]);; + +let LIN_F_SUM_EMPTY2 = prove(`!x. lin_f x + lin_f [] = lin_f x`, + REWRITE_TAC[LIN_F_EMPTY; REAL_ADD_RID]);; + +let LIN_F_SUM_MOVE1 = prove(`!h t x. lin_f (CONS h t) + lin_f x = lin_f [h] + (lin_f t + lin_f x)`, + REPEAT GEN_TAC THEN REWRITE_TAC[LIN_F_CONS; LIN_F_EMPTY] THEN REAL_ARITH_TAC);; + +let LIN_F_SUM_MOVE2 = prove(`!h t x. lin_f x + lin_f (CONS h t) = lin_f [h] + (lin_f x + lin_f t)`, + REPEAT GEN_TAC THEN REWRITE_TAC[LIN_F_CONS; LIN_F_EMPTY] THEN REAL_ARITH_TAC);; + + +let LIN_F_ADD_SINGLE = prove(`!h t. lin_f [h] + lin_f t = lin_f (CONS h t)`, + REWRITE_TAC[LIN_F_CONS; LIN_F_EMPTY] THEN REAL_ARITH_TAC);; + + +let LIN_F_ADD_SING_RCANCEL = prove(`!c v t. c * v + lin_f (CONS (--c, v) t) + = lin_f t`, + REWRITE_TAC[LIN_F_CONS; LIN_F_EMPTY] THEN REAL_ARITH_TAC);; + +let LIN_F_ADD_SING_LCANCEL = prove(`!c v t. --c * v + lin_f (CONS (c, v) t) + = lin_f t`, + REWRITE_TAC[LIN_F_CONS; LIN_F_EMPTY] THEN REAL_ARITH_TAC);; + + +(* Multiplication of lin_f *) + +let LIN_F_MUL = prove(`!v t. v * lin_f t = lin_f (MAP (\tm. v * FST tm, SND tm) t)`, + REWRITE_TAC[lin_f] THEN GEN_TAC THEN LIST_INDUCT_TAC THENL + [ + REWRITE_TAC[ITLIST; MAP; REAL_MUL_RZERO]; + ALL_TAC + ] THEN + REWRITE_TAC[ITLIST; MAP] THEN + ASM_REWRITE_TAC[REAL_ADD_LDISTRIB; REAL_MUL_ASSOC]);; + + +let LIN_F_MUL_HD = prove(`!x c v t c1. x * c = c1 ==> + x * lin_f (CONS (c,v) t) = lin_f [c1, v] + x * lin_f t`, + REWRITE_TAC[LIN_F_CONS; LIN_F_EMPTY] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[REAL_ARITH `x * (c * v + a) = (x * c) * v + x * a:real`] THEN + REAL_ARITH_TAC);; + + +let LIN_F_MUL_EMPTY = prove(`!x. x * lin_f [] = lin_f []`, + REWRITE_TAC[LIN_F_EMPTY] THEN REAL_ARITH_TAC);; + + +(* Theorems for converting sums into lin_f *) +let TO_LIN_F0 = prove(`!x. x = x + lin_f []`, REWRITE_TAC[LIN_F_EMPTY; REAL_ADD_RID]);; + +let TO_LIN_F1 = prove(`!a x. a * x = lin_f [a, x]`, + REWRITE_TAC[lin_f; ITLIST; REAL_ADD_RID]);; + +let TO_LIN_F = prove(`!c v x t. (c * v + x) + lin_f t = x + lin_f (CONS (c, v) t) /\ + c * v + lin_f t = lin_f (CONS (c, v) t)`, + REWRITE_TAC[LIN_F_CONS] THEN REAL_ARITH_TAC);; + + +(* Special versions of the above theorems (for using with INST) *) + +let amp_op = `(&):num->real`;; +let zero_const = `_0`;; + +let NUM_ZERO = prove(mk_eq(mk_comb(amp_op,mk_comb(num_const, zero_const)), `&0`), + REWRITE_TAC[NUM_THM; NUMERAL]);; + +let LIN_F_SUM_HD', + LIN_F_SUM_HD_ZERO', + LIN_F_SUM_EMPTY1', LIN_F_SUM_EMPTY2', + LIN_F_SUM_MOVE1', LIN_F_SUM_MOVE2', + LIN_F_ADD_SINGLE' = + UNDISCH_ALL (SPEC_ALL LIN_F_SUM_HD), + UNDISCH_ALL (SPEC_ALL (ONCE_REWRITE_RULE[GSYM NUM_ZERO] LIN_F_SUM_HD_ZERO)), + SPEC_ALL LIN_F_SUM_EMPTY1, SPEC_ALL LIN_F_SUM_EMPTY2, + SPEC_ALL LIN_F_SUM_MOVE1, SPEC_ALL LIN_F_SUM_MOVE2, + SPEC_ALL LIN_F_ADD_SINGLE;; + +let LIN_F_MUL_HD', LIN_F_MUL_EMPTY' = + UNDISCH_ALL (SPEC_ALL LIN_F_MUL_HD), SPEC_ALL LIN_F_MUL_EMPTY;; + +let LIN_F_ADD_SING_RCANCEL', LIN_F_ADD_SING_LCANCEL' = + SPEC_ALL LIN_F_ADD_SING_RCANCEL, SPEC_ALL LIN_F_ADD_SING_LCANCEL;; + + +(* A little faster version of PROVE_HYP *) +let MY_PROVE_HYP hyp th = EQ_MP (DEDUCT_ANTISYM_RULE hyp th) hyp;; + + + +(***********************************************) + + +(* Constants *) + +let a_var_real = `a:real` and + b_var_real = `b:real` and + a1_var_real = `a1:real` and + a2_var_real = `a2:real` and + b1_var_real = `b1:real` and + b2_var_real = `b2:real` and + c1_var_real = `c1:real` and + c2_var_real = `c2:real` and + h_var = `h:real#real` and + r_var = `r:(real#real)list` and + x_var = `x:(real#real)list` and + y_var = `y:(real#real)list` and + t_var = `t:(real#real)list` and + x_var_real = `x:real` and + c1_var = `c1:real` and + c2_var = `c2:real` and + c_var = `c:real` and + v_var = `v:real` and + t1_var = `t1:(real#real)list` and + t2_var = `t2:(real#real)list` and + empty_const = `[]:(real)list`;; + +let cons_const = `CONS:(real#real)->(real#real)list->(real#real)list` and + empty_const = `[]:(real)list`;; + +let plus_op = `(+):real->real->real` and + plus_op_num = `(+):num->num->num` and + le_op = `(<=):real->real->bool` and + ge_op = `(>=):real->real->bool` and + mul_op = `( * ):real->real->real` and + neg_op = `(--):real->real`;; + +let real_type = `:real`;; + + +(* Term constructors *) +let cons h t = mk_comb (mk_comb (cons_const, h), t);; +let negate tm = mk_comb (neg_op, tm);; +let mk_real_int n = mk_comb(amp_op, mk_numeral_array n);; +let mk_real_int64 n = mk_comb(amp_op, mk_int64_numeral_array n);; +let mk_linear cs vars = + let mk_term (c, var) = mk_binop mul_op c (mk_var (var, real_type)) in + list_mk_binop plus_op (map mk_term (zip cs vars));; + +let mk_le_ineq lhs rhs = mk_binop le_op lhs rhs;; +let mk_eq_ineq lhs rhs = mk_eq (lhs, rhs);; +let mk_ge_ineq lhs rhs = mk_binop ge_op lhs rhs;; + + + +(************************************************) + +(* Computes (lin_f x + lin_f y) with REAL_BITS_ADD_CONV *) +let lin_f_add_conv tm = + let rec lin_f_add_conv2 x y = + if (is_comb y) then + if (is_comb x) then + let hx = rand (rator x) in + let hy = rand (rator y) in + let c1, v1 = dest_pair hx in + let c2, v2 = dest_pair hy in + + if v1 = v2 then + let tx, ty = rand x, rand y in + let c_thm = REAL_BITS_ADD_CONV (mk_binop plus_op c1 c2) in + let c = rand (concl c_thm) in + if (rand(rand c) = zero_const) then + let th0 = INST [v1, v_var; c1, c1_var; tx, t1_var; c2, c2_var; ty, t2_var] + LIN_F_SUM_HD_ZERO' in + TRANS (MY_PROVE_HYP c_thm th0) (lin_f_add_conv2 tx ty) + else + let th0 = INST[v1, v_var; c1, c1_var; tx, t1_var; c2, c2_var; ty, t2_var; c, c_var] + LIN_F_SUM_HD' in + let ltm = rator (rand(concl th0)) in + let th1 = lin_f_add_conv2 tx ty in + let th2 = TRANS (MY_PROVE_HYP c_thm th0) (AP_TERM ltm th1) in + let th3 = INST[mk_pair (c, v1), h_var; rand(rand(concl th1)), t_var] LIN_F_ADD_SINGLE' in + TRANS th2 th3 + else + if (v1 < v2) then + let tx = rand x in + let th0 = INST[hx, h_var; tx, t_var; y, x_var] LIN_F_SUM_MOVE1' in + let ltm = rator (rand(concl th0)) in + let th1 = lin_f_add_conv2 tx y in + let th2 = TRANS th0 (AP_TERM ltm th1) in + let th3 = INST[hx, h_var; rand(rand(concl th1)), t_var] LIN_F_ADD_SINGLE' in + TRANS th2 th3 + else + let ty = rand y in + let th0 = INST[hy, h_var; ty, t_var; x, x_var] LIN_F_SUM_MOVE2' in + let ltm = rator (rand(concl th0)) in + let th1 = lin_f_add_conv2 x ty in + let th2 = TRANS th0 (AP_TERM ltm th1) in + let th3 = INST[hy, h_var; rand(rand(concl th1)), t_var] LIN_F_ADD_SINGLE' in + TRANS th2 th3 + else + (* x = [] *) + INST[y, x_var] LIN_F_SUM_EMPTY1' + else + (* y = [] *) + INST[x, x_var] LIN_F_SUM_EMPTY2' in + + let larg, rarg = dest_comb tm in + let larg = rand larg in + lin_f_add_conv2 (rand larg) (rand rarg);; + + + +(*********************) +(* lin_f conversions *) +(*********************) + + +(* Transforms a sum in the form `a * x + b * y + c * z` into `lin_f [(c,z); (b,y); (a,x)]` *) +let LIN_F_RAW_CONV = ONCE_REWRITE_CONV[TO_LIN_F0] THENC REWRITE_CONV[TO_LIN_F];; + +let LIN_F_ADD_CONV = lin_f_add_conv;; + +(* Transforms a sum into `lin_f` and sorts the terms *) +let LIN_F_CONV = (REWRITE_CONV[TO_LIN_F1] THENC (DEPTH_CONV LIN_F_ADD_CONV));; + + +(* Computes `v * lin_f y` *) + +let rec LIN_F_MUL_CONV tm = + let x, f = dest_binop mul_op tm in + let list = rand f in + if (is_comb list) then + let cons_h, t = dest_comb list in + let h = rand cons_h in + let c, v = dest_pair h in + + let product = REAL_BITS_MUL_CONV (mk_binop mul_op x c) in + let c1 = rand(concl product) in + let th = INST[x, x_var_real; c, c_var; v, v_var; t, t_var; c1, c1_var] LIN_F_MUL_HD' in + let th1 = MY_PROVE_HYP product th in + let lplus, tm = dest_comb(rand(concl th1)) in + let th2 = LIN_F_MUL_CONV tm in + let h = mk_pair (c1, v) in + let t = rand(rand(concl th2)) in + let th3 = TRANS th1 (AP_TERM lplus th2) in + let th4 = INST[h, h_var; t, t_var] LIN_F_ADD_SINGLE' in + TRANS th3 th4 + else + INST[x, x_var_real] LIN_F_MUL_EMPTY';; + + +(* Conversion without numerical multiplication *) +let LIN_F_MUL_RAW_CONV = ONCE_REWRITE_CONV[LIN_F_MUL] THENC REWRITE_CONV[MAP];; + + + +(************************************************) + + +(* Creates an inequality in the correct form *) +let REAL_POS' = SPEC_ALL REAL_POS;; +let REAL_LE_LMUL' = UNDISCH_ALL (REWRITE_RULE[GSYM IMP_IMP] (SPEC_ALL REAL_LE_LMUL));; +let n_var_num = `n:num`;; +let x_var_real = `x:real`;; +let y_var_real = `y:real`;; +let z_var_real = `z:real`;; + + +let transform_le_ineq (ineq, m) = + let lhs, rhs = dest_binop le_op (concl ineq) in + let lhs_f_th = LIN_F_CONV lhs in + let original_th = EQ_MP (AP_THM (AP_TERM le_op lhs_f_th) rhs) ineq in + let lhs = rand(concl lhs_f_th) in + let pos_th = INST[rand m, n_var_num] REAL_POS' in + let th0 = INST[m, x_var_real; lhs, y_var_real; rhs, z_var_real] REAL_LE_LMUL' in + let th1 = MY_PROVE_HYP pos_th th0 in + let th2 = MY_PROVE_HYP original_th th1 in + let lhs, rhs = dest_binop le_op (concl th2) in + let lhs_th = LIN_F_MUL_CONV lhs in + let rhs_th = REAL_BITS_MUL_CONV rhs in + let th3 = MK_COMB(AP_TERM le_op lhs_th, rhs_th) in + EQ_MP th3 th2;; + + +let transform_le_ineq_tm (ineq, m) = + let lhs, rhs = dest_binop le_op ineq in + let lhs_f_th = LIN_F_CONV lhs in + let original_th = EQ_MP (AP_THM (AP_TERM le_op lhs_f_th) rhs) (ASSUME ineq) in + let lhs = rand(concl lhs_f_th) in + let pos_th = INST[rand m, n_var_num] REAL_POS' in + let th0 = INST[m, x_var_real; lhs, y_var_real; rhs, z_var_real] REAL_LE_LMUL' in + let th1 = MY_PROVE_HYP pos_th th0 in + let th2 = MY_PROVE_HYP original_th th1 in + let lhs, rhs = dest_binop le_op (concl th2) in + let lhs_th = LIN_F_MUL_CONV lhs in + let rhs_th = REAL_BITS_MUL_CONV rhs in + let th3 = MK_COMB(AP_TERM le_op lhs_th, rhs_th) in + EQ_MP th3 th2;; + + + +(* Computes the sum of two inequalities *) +let REAL_LE_ADD2' = UNDISCH_ALL (REWRITE_RULE[GSYM IMP_IMP] (SPEC_ALL REAL_LE_ADD2));; +let w_var_real = `w:real`;; + +(* Computes the sum of two inequalities (with LIN_F_ADD_CONV and REAL_BITS_ADD_CONV) *) +let add_step' ineq1 ineq2 = + let lhs1, rhs1 = dest_binop le_op (concl ineq1) in + let lhs2, rhs2 = dest_binop le_op (concl ineq2) in + let th0 = INST [lhs1, w_var_real; rhs1, x_var_real; lhs2, y_var_real; rhs2, z_var_real] + REAL_LE_ADD2' in + let th1 = MY_PROVE_HYP ineq2 (MY_PROVE_HYP ineq1 th0) in + let lhs, rhs = dest_binop le_op (concl th1) in + let lhs_th = LIN_F_ADD_CONV lhs in + let rhs_th = REAL_BITS_ADD_CONV rhs in + EQ_MP (MK_COMB(AP_TERM le_op lhs_th, rhs_th)) th1;; + + +(* Computes the sum of lin_f[--c, x;...] and c * x *) +let add_cancel_step ineq var_ineq = + let lhs1, rhs1 = dest_binop le_op (concl var_ineq) in + let lhs2, rhs2 = dest_binop le_op (concl ineq) in + let th0 = INST[lhs1, w_var_real; rhs1, x_var_real; lhs2, y_var_real; rhs2, z_var_real] + REAL_LE_ADD2' in + let th1 = MY_PROVE_HYP ineq (MY_PROVE_HYP var_ineq th0) in + let ctm, vtm = dest_binop mul_op lhs1 in + let ttm = rand(rand lhs2) in + if (rator ctm = neg_op) then + let lhs_th = INST[rand ctm, c_var; vtm, v_var; ttm, t_var] LIN_F_ADD_SING_LCANCEL' in + let rhs_th = REAL_BITS_ADD_CONV (rand(concl th1)) in + EQ_MP (MK_COMB(AP_TERM le_op lhs_th, rhs_th)) th1 + else + let lhs_th = INST[ctm, c_var; vtm, v_var; ttm, t_var] LIN_F_ADD_SING_RCANCEL' in + let rhs_th = REAL_BITS_ADD_CONV (rand(concl th1)) in + EQ_MP (MK_COMB(AP_TERM le_op lhs_th, rhs_th)) th1;; + + + +let zero_const_real = `&0`;; + +(* Multiplies a linear inequality by a rational positive constant *) +let mul_rat_step ineq c = + let pos_thm = REAL_ARITH (mk_le_ineq zero_const_real c) in + let hyp = CONJ pos_thm ineq in + let th0 = MATCH_MP REAL_LE_LMUL hyp in + let lhs, rhs = dest_binop le_op (concl th0) in + let lhs_th = (LIN_F_MUL_RAW_CONV THENC DEPTH_CONV REAL_RAT_MUL_CONV) lhs in + let rhs_th = REAL_RAT_MUL_CONV rhs in + EQ_MP (MK_COMB (AP_TERM le_op lhs_th, rhs_th)) th0;; + + + +(* Multiplies a linear inequality in the form lin_f x <= y by + a positive integer c *) +let mul_step ineq c = + let lhs, rhs = dest_binop le_op (concl ineq) in + let pos_th = INST[rand c, n_var_num] REAL_POS' in + let th0 = INST[c, x_var_real; lhs, y_var_real; rhs, z_var_real] REAL_LE_LMUL' in + let th1 = MY_PROVE_HYP pos_th th0 in + let th2 = MY_PROVE_HYP ineq th1 in + let lhs, rhs = dest_binop le_op (concl th2) in + let lhs_th = LIN_F_MUL_CONV lhs in + let rhs_th = REAL_BITS_MUL_CONV rhs in + let th3 = MK_COMB(AP_TERM le_op lhs_th, rhs_th) in + EQ_MP th3 th2;; + + + +(* Transformations for variables *) + +let VAR_MUL_THM = prove(`!x c1 c2 a b v. &0 <= x /\ x * c1 = a /\ x * c2 = b /\ c1 * v <= c2 + ==> a * v <= b`, + REPEAT STRIP_TAC THEN + UNDISCH_TAC `x * c1 = a:real` THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + UNDISCH_TAC `x * c2 = b:real` THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[GSYM REAL_MUL_ASSOC] THEN + MATCH_MP_TAC REAL_LE_LMUL THEN + ASM_REWRITE_TAC[]);; + + +let VAR_MUL_THM' = (UNDISCH_ALL o SPEC_ALL o (REWRITE_RULE[GSYM IMP_IMP])) VAR_MUL_THM;; + +let VAR_ADD_THM = prove(`!x a1 b1 a2 b2 c1 c2. a1 * x <= b1 /\ a2 * x <= b2 /\ + a1 + a2 = c1 /\ b1 + b2 = c2 ==> c1 * x <= c2`, + REPEAT STRIP_TAC THEN + EXPAND_TAC "c1" THEN EXPAND_TAC "c2" THEN + REWRITE_TAC[REAL_ADD_RDISTRIB] THEN + MATCH_MP_TAC REAL_LE_ADD2 THEN + ASM_REWRITE_TAC[]);; + +let VAR_ADD_THM' = (UNDISCH_ALL o SPEC_ALL o (REWRITE_RULE[GSYM IMP_IMP])) VAR_ADD_THM;; + + +(* Multiplies c1 * x <= c2 by m *) +let var1_le_transform (var_ineq, m) = + let lhs, c2tm = dest_binop le_op (var_ineq) in + let pos_th = INST[rand m, n_var_num] REAL_POS' in + let c1tm, xtm = dest_binop mul_op lhs in + let c1_th = REAL_BITS_MUL_CONV (mk_binop mul_op m c1tm) in + let c2_th = REAL_BITS_MUL_CONV (mk_binop mul_op m c2tm) in + let th = INST[m, x_var_real; c1tm, c1_var; c2tm, c2_var; xtm, v_var; + rand(concl c1_th), a_var_real; rand(concl c2_th), b_var_real] + VAR_MUL_THM' in + MY_PROVE_HYP pos_th (MY_PROVE_HYP (ASSUME var_ineq) (MY_PROVE_HYP c1_th (MY_PROVE_HYP c2_th th)));; + + +(* Multiplies the corresponding inequalities and finds the sum of results *) +let var2_le_transform (var_ineq1,m1) (var_ineq2,m2) = + let ineq1 = var1_le_transform (var_ineq1, m1) and + ineq2 = var1_le_transform (var_ineq2, m2) in + let lhs1, b1tm = dest_binop le_op (concl ineq1) in + let lhs2, b2tm = dest_binop le_op (concl ineq2) in + let a1tm, xtm = dest_binop mul_op lhs1 in + let a2tm = rand(rator lhs2) in + let b_th = REAL_BITS_ADD_CONV (mk_binop plus_op b1tm b2tm) in + let a_th = REAL_BITS_ADD_CONV (mk_binop plus_op a1tm a2tm) in + let th0 = INST[a1tm, a1_var_real; a2tm, a2_var_real; + b1tm, b1_var_real; b2tm, b2_var_real; + rand(concl a_th), c1_var_real; rand(concl b_th), c2_var_real; + xtm, x_var_real] VAR_ADD_THM' in + MY_PROVE_HYP ineq2 (MY_PROVE_HYP ineq1 (MY_PROVE_HYP b_th (MY_PROVE_HYP a_th th0)));; + + + + + +(* The main function *) +(* Example: prove_lp ineqs var_ineqs target_vars `&12` (Int 100000) *) +(* ineq - inequalities obtained from constraints with multipliers *) +(* var_ineqs - bounds for variables as inequalities in the correct form *) +(* target_vars - bounds and multipliers for variables in the objective function *) +(* bound - a bound for the objective function which is proved *) +(* m - a precision constant *) + + +let LIN_F_EMPTY_LE_0 = prove(`lin_f [] <= &0`, REWRITE_TAC[LIN_F_EMPTY; REAL_LE_REFL]);; +let dummy = REWRITE_RULE[GSYM NUM_ZERO] LIN_F_EMPTY_LE_0;; + + +let prove_lp_tm ineqs var_ineqs target_vars target_bound precision_constant = + (* Compute the sum of all constraints *) + let r1 = map transform_le_ineq_tm ineqs in + let r2' = List.fold_left add_step' dummy r1 in + let r2 = mul_step r2' (mk_real_int precision_constant) in + + (* Use bounds of variables *) + let r3 = List.fold_left add_cancel_step r2 var_ineqs in + let r4 = List.fold_left add_step' dummy (map transform_le_ineq_tm target_vars) in + let r5 = add_step' r3 r4 in + + (* Convert the result into a usual form *) + let r6 = CONV_RULE (DEPTH_CONV NUM_TO_NUMERAL_CONV) r5 in + let m = term_of_rat (precision_constant */ precision_constant */ precision_constant) in + let r7 = mul_rat_step r6 (mk_comb (`(/) (&1)`, m)) in + let r8 = REWRITE_RULE[lin_f; ITLIST; REAL_ADD_RID] r7 in + let r9 = EQT_ELIM (REAL_RAT_LE_CONV (mk_binop le_op ((rand o concl) r8) target_bound)) in + MATCH_MP REAL_LE_TRANS (CONJ r8 r9);; + + +let prove_lp ineqs var_ineqs target_vars target_bound precision_constant = + (* Compute the sum of all constraints *) + let r1 = map transform_le_ineq ineqs in + let r2' = List.fold_left add_step' dummy r1 in + let r2 = mul_step r2' (mk_real_int precision_constant) in + + (* Use bounds of variables *) + let r3 = List.fold_left add_cancel_step r2 var_ineqs in + let r4 = List.fold_left add_step' dummy (map transform_le_ineq target_vars) in + let r5 = add_step' r3 r4 in + + (* Convert the result into a usual form *) + let r6 = CONV_RULE (DEPTH_CONV NUM_TO_NUMERAL_CONV) r5 in + let m = term_of_rat (precision_constant */ precision_constant */ precision_constant) in + let r7 = mul_rat_step r6 (mk_comb (`(/) (&1)`, m)) in + let r8 = REWRITE_RULE[lin_f; ITLIST; REAL_ADD_RID] r7 in + let r9 = EQT_ELIM (REAL_RAT_LE_CONV (mk_binop le_op ((rand o concl) r8) target_bound)) in + MATCH_MP REAL_LE_TRANS (CONJ r8 r9);; + diff --git a/formal_lp/old/arith/tests/arith_test_data10.hl b/formal_lp/old/arith/tests/arith_test_data10.hl new file mode 100644 index 0000000..68cfeb1 --- /dev/null +++ b/formal_lp/old/arith/tests/arith_test_data10.hl @@ -0,0 +1,1002 @@ +let data = [ +(mk_real_int64 1726243269L),(mk_real_int64 1817325359L);(* 9, 9 *) +(mk_real_int64 1768022689L),(mk_real_int64 1558161191L);(* 9, 9 *) +(mk_real_int64 1206033154L),(mk_real_int64 1558884794L);(* 9, 9 *) +(mk_real_int64 1906027066L),(mk_real_int64 1442177873L);(* 9, 9 *) +(mk_real_int64 1977549753L),(mk_real_int64 1273704457L);(* 9, 9 *) +(mk_real_int64 1291906284L),(mk_real_int64 1467314700L);(* 9, 9 *) +(mk_real_int64 1632659072L),(mk_real_int64 1469511878L);(* 9, 9 *) +(mk_real_int64 1982151253L),(mk_real_int64 1030366990L);(* 9, 9 *) +(mk_real_int64 1862370153L),(mk_real_int64 1995347081L);(* 9, 9 *) +(mk_real_int64 1677181149L),(mk_real_int64 1314591793L);(* 9, 9 *) +(mk_real_int64 1816907908L),(mk_real_int64 1848051783L);(* 9, 9 *) +(mk_real_int64 1991902175L),(mk_real_int64 1032625198L);(* 9, 9 *) +(mk_real_int64 1699941983L),(mk_real_int64 1526284142L);(* 9, 9 *) +(mk_real_int64 1934018658L),(mk_real_int64 1687620282L);(* 9, 9 *) +(mk_real_int64 1546815434L),(mk_real_int64 1081109949L);(* 9, 9 *) +(mk_real_int64 1187124574L),(mk_real_int64 1453327185L);(* 9, 9 *) +(mk_real_int64 1297171865L),(mk_real_int64 1988543779L);(* 9, 9 *) +(mk_real_int64 1642697472L),(mk_real_int64 1762963588L);(* 9, 9 *) +(mk_real_int64 1030394292L),(mk_real_int64 1381004506L);(* 9, 9 *) +(mk_real_int64 1343141844L),(mk_real_int64 1957455165L);(* 9, 9 *) +(mk_real_int64 1505129212L),(mk_real_int64 1715972512L);(* 9, 9 *) +(mk_real_int64 1118957729L),(mk_real_int64 1273451483L);(* 9, 9 *) +(mk_real_int64 1907097950L),(mk_real_int64 1794765593L);(* 9, 9 *) +(mk_real_int64 1337160339L),(mk_real_int64 1457208787L);(* 9, 9 *) +(mk_real_int64 1146825040L),(mk_real_int64 1221314739L);(* 9, 9 *) +(mk_real_int64 1410073279L),(mk_real_int64 1718726832L);(* 9, 9 *) +(mk_real_int64 1619830283L),(mk_real_int64 1487968052L);(* 9, 9 *) +(mk_real_int64 1194913436L),(mk_real_int64 1878191486L);(* 9, 9 *) +(mk_real_int64 1825423184L),(mk_real_int64 1735397491L);(* 9, 9 *) +(mk_real_int64 1858219207L),(mk_real_int64 1679749011L);(* 9, 9 *) +(mk_real_int64 1624866135L),(mk_real_int64 1218406783L);(* 9, 9 *) +(mk_real_int64 1895362439L),(mk_real_int64 1896439803L);(* 9, 9 *) +(mk_real_int64 1086579883L),(mk_real_int64 1838579099L);(* 9, 9 *) +(mk_real_int64 1170142834L),(mk_real_int64 1644115293L);(* 9, 9 *) +(mk_real_int64 1826814405L),(mk_real_int64 1219187664L);(* 9, 9 *) +(mk_real_int64 1999972697L),(mk_real_int64 1481365646L);(* 9, 9 *) +(mk_real_int64 1652205236L),(mk_real_int64 1719725983L);(* 9, 9 *) +(mk_real_int64 1809462580L),(mk_real_int64 1100935396L);(* 9, 9 *) +(mk_real_int64 1729094053L),(mk_real_int64 1718450691L);(* 9, 9 *) +(mk_real_int64 1125527248L),(mk_real_int64 1905176389L);(* 9, 9 *) +(mk_real_int64 1189123803L),(mk_real_int64 1476809871L);(* 9, 9 *) +(mk_real_int64 1540795242L),(mk_real_int64 1325500694L);(* 9, 9 *) +(mk_real_int64 1671036670L),(mk_real_int64 1468397741L);(* 9, 9 *) +(mk_real_int64 1833496901L),(mk_real_int64 1809203813L);(* 9, 9 *) +(mk_real_int64 1793630342L),(mk_real_int64 1764505986L);(* 9, 9 *) +(mk_real_int64 1937540404L),(mk_real_int64 1294996801L);(* 9, 9 *) +(mk_real_int64 1522785299L),(mk_real_int64 1663392833L);(* 9, 9 *) +(mk_real_int64 1332589029L),(mk_real_int64 1286722429L);(* 9, 9 *) +(mk_real_int64 1820610073L),(mk_real_int64 1222517925L);(* 9, 9 *) +(mk_real_int64 1186871599L),(mk_real_int64 1068518850L);(* 9, 9 *) +(mk_real_int64 1624622759L),(mk_real_int64 1693045045L);(* 9, 9 *) +(mk_real_int64 1630394382L),(mk_real_int64 1927637375L);(* 9, 9 *) +(mk_real_int64 1221342041L),(mk_real_int64 1928707632L);(* 9, 9 *) +(mk_real_int64 1066521596L),(mk_real_int64 1900104300L);(* 9, 9 *) +(mk_real_int64 1678505472L),(mk_real_int64 1093978040L);(* 9, 9 *) +(mk_real_int64 1149097432L),(mk_real_int64 1106972492L);(* 9, 9 *) +(mk_real_int64 1609870242L),(mk_real_int64 1953042817L);(* 9, 9 *) +(mk_real_int64 1490625208L),(mk_real_int64 1148056264L);(* 9, 9 *) +(mk_real_int64 1677611541L),(mk_real_int64 1569861744L);(* 9, 9 *) +(mk_real_int64 1225403132L),(mk_real_int64 1618182142L);(* 9, 9 *) +(mk_real_int64 1005082197L),(mk_real_int64 1360939021L);(* 9, 9 *) +(mk_real_int64 1850484951L),(mk_real_int64 1062308419L);(* 9, 9 *) +(mk_real_int64 1281647260L),(mk_real_int64 1704975895L);(* 9, 9 *) +(mk_real_int64 1958580347L),(mk_real_int64 1988812403L);(* 9, 9 *) +(mk_real_int64 1387136953L),(mk_real_int64 1522740151L);(* 9, 9 *) +(mk_real_int64 1280325323L),(mk_real_int64 1506576128L);(* 9, 9 *) +(mk_real_int64 1531579091L),(mk_real_int64 1057008397L);(* 9, 9 *) +(mk_real_int64 1280553630L),(mk_real_int64 1496078757L);(* 9, 9 *) +(mk_real_int64 1846415488L),(mk_real_int64 1613157866L);(* 9, 9 *) +(mk_real_int64 1104158652L),(mk_real_int64 1742329037L);(* 9, 9 *) +(mk_real_int64 1401876145L),(mk_real_int64 1933392601L);(* 9, 9 *) +(mk_real_int64 1130698341L),(mk_real_int64 1699652301L);(* 9, 9 *) +(mk_real_int64 1615408553L),(mk_real_int64 1830567911L);(* 9, 9 *) +(mk_real_int64 1685126559L),(mk_real_int64 1569742481L);(* 9, 9 *) +(mk_real_int64 1172767625L),(mk_real_int64 1184532765L);(* 9, 9 *) +(mk_real_int64 1609110887L),(mk_real_int64 1250748328L);(* 9, 9 *) +(mk_real_int64 1997114792L),(mk_real_int64 1568689457L);(* 9, 9 *) +(mk_real_int64 1063436652L),(mk_real_int64 1263683737L);(* 9, 9 *) +(mk_real_int64 1842560094L),(mk_real_int64 1568085962L);(* 9, 9 *) +(mk_real_int64 1645990114L),(mk_real_int64 1516366145L);(* 9, 9 *) +(mk_real_int64 1970127284L),(mk_real_int64 1077709192L);(* 9, 9 *) +(mk_real_int64 1512967346L),(mk_real_int64 1155765321L);(* 9, 9 *) +(mk_real_int64 1813652717L),(mk_real_int64 1642521304L);(* 9, 9 *) +(mk_real_int64 1575393400L),(mk_real_int64 1552861844L);(* 9, 9 *) +(mk_real_int64 1672489187L),(mk_real_int64 1994546450L);(* 9, 9 *) +(mk_real_int64 1301640775L),(mk_real_int64 1064453674L);(* 9, 9 *) +(mk_real_int64 1465703091L),(mk_real_int64 1483074095L);(* 9, 9 *) +(mk_real_int64 1216305996L),(mk_real_int64 1071689596L);(* 9, 9 *) +(mk_real_int64 1230240680L),(mk_real_int64 1150832649L);(* 9, 9 *) +(mk_real_int64 1446899866L),(mk_real_int64 1451079349L);(* 9, 9 *) +(mk_real_int64 1019849336L),(mk_real_int64 1388837866L);(* 9, 9 *) +(mk_real_int64 1816044778L),(mk_real_int64 1202604188L);(* 9, 9 *) +(mk_real_int64 1913629263L),(mk_real_int64 1029576994L);(* 9, 9 *) +(mk_real_int64 1509461335L),(mk_real_int64 1962889634L);(* 9, 9 *) +(mk_real_int64 1993571745L),(mk_real_int64 1016869892L);(* 9, 9 *) +(mk_real_int64 1653518663L),(mk_real_int64 1278329526L);(* 9, 9 *) +(mk_real_int64 1967167752L),(mk_real_int64 1587792507L);(* 9, 9 *) +(mk_real_int64 1772201752L),(mk_real_int64 1324166952L);(* 9, 9 *) +(mk_real_int64 1420425255L),(mk_real_int64 1974933019L);(* 9, 9 *) +(mk_real_int64 1885999584L),(mk_real_int64 1972887248L);(* 9, 9 *) +(mk_real_int64 1255174511L),(mk_real_int64 1132264714L);(* 9, 9 *) +(mk_real_int64 1897253294L),(mk_real_int64 1178221175L);(* 9, 9 *) +(mk_real_int64 1882891989L),(mk_real_int64 1544657213L);(* 9, 9 *) +(mk_real_int64 1785045237L),(mk_real_int64 1514040697L);(* 9, 9 *) +(mk_real_int64 1352383461L),(mk_real_int64 1991747056L);(* 9, 9 *) +(mk_real_int64 1033443057L),(mk_real_int64 1691727444L);(* 9, 9 *) +(mk_real_int64 1121186096L),(mk_real_int64 1194910765L);(* 9, 9 *) +(mk_real_int64 1496516809L),(mk_real_int64 1581289418L);(* 9, 9 *) +(mk_real_int64 1261664414L),(mk_real_int64 1310363158L);(* 9, 9 *) +(mk_real_int64 1242136058L),(mk_real_int64 1784075723L);(* 9, 9 *) +(mk_real_int64 1133059969L),(mk_real_int64 1612503766L);(* 9, 9 *) +(mk_real_int64 1559290099L),(mk_real_int64 1655619294L);(* 9, 9 *) +(mk_real_int64 1341027786L),(mk_real_int64 1023311249L);(* 9, 9 *) +(mk_real_int64 1097285922L),(mk_real_int64 1877910584L);(* 9, 9 *) +(mk_real_int64 1710872342L),(mk_real_int64 1892139044L);(* 9, 9 *) +(mk_real_int64 1651264341L),(mk_real_int64 1255307660L);(* 9, 9 *) +(mk_real_int64 1264833064L),(mk_real_int64 1474012618L);(* 9, 9 *) +(mk_real_int64 1195904838L),(mk_real_int64 1887584622L);(* 9, 9 *) +(mk_real_int64 1491584571L),(mk_real_int64 1637823602L);(* 9, 9 *) +(mk_real_int64 1319712198L),(mk_real_int64 1368972049L);(* 9, 9 *) +(mk_real_int64 1244531756L),(mk_real_int64 1995420637L);(* 9, 9 *) +(mk_real_int64 1610506173L),(mk_real_int64 1001824689L);(* 9, 9 *) +(mk_real_int64 1983426835L),(mk_real_int64 1961791218L);(* 9, 9 *) +(mk_real_int64 1157143429L),(mk_real_int64 1772256987L);(* 9, 9 *) +(mk_real_int64 1091275698L),(mk_real_int64 1190912333L);(* 9, 9 *) +(mk_real_int64 1062502537L),(mk_real_int64 1110062096L);(* 9, 9 *) +(mk_real_int64 1732796961L),(mk_real_int64 1101923861L);(* 9, 9 *) +(mk_real_int64 1839827278L),(mk_real_int64 1642670744L);(* 9, 9 *) +(mk_real_int64 1572974614L),(mk_real_int64 1241634000L);(* 9, 9 *) +(mk_real_int64 1837193388L),(mk_real_int64 1859580740L);(* 9, 9 *) +(mk_real_int64 1447371291L),(mk_real_int64 1907134653L);(* 9, 9 *) +(mk_real_int64 1803168354L),(mk_real_int64 1460244416L);(* 9, 9 *) +(mk_real_int64 1340482714L),(mk_real_int64 1778135396L);(* 9, 9 *) +(mk_real_int64 1426894379L),(mk_real_int64 1647173478L);(* 9, 9 *) +(mk_real_int64 1999005927L),(mk_real_int64 1608932186L);(* 9, 9 *) +(mk_real_int64 1089704847L),(mk_real_int64 1623840811L);(* 9, 9 *) +(mk_real_int64 1990650959L),(mk_real_int64 1873164008L);(* 9, 9 *) +(mk_real_int64 1539543967L),(mk_real_int64 1137639332L);(* 9, 9 *) +(mk_real_int64 1001997593L),(mk_real_int64 1557465410L);(* 9, 9 *) +(mk_real_int64 1672192458L),(mk_real_int64 1379236567L);(* 9, 9 *) +(mk_real_int64 1866167819L),(mk_real_int64 1325028935L);(* 9, 9 *) +(mk_real_int64 1786634886L),(mk_real_int64 1519960008L);(* 9, 9 *) +(mk_real_int64 1829636507L),(mk_real_int64 1541202244L);(* 9, 9 *) +(mk_real_int64 1522510698L),(mk_real_int64 1162909203L);(* 9, 9 *) +(mk_real_int64 1634185339L),(mk_real_int64 1553234093L);(* 9, 9 *) +(mk_real_int64 1314610007L),(mk_real_int64 1249950571L);(* 9, 9 *) +(mk_real_int64 1800630214L),(mk_real_int64 1460131458L);(* 9, 9 *) +(mk_real_int64 1921600758L),(mk_real_int64 1337397102L);(* 9, 9 *) +(mk_real_int64 1192252282L),(mk_real_int64 1150261756L);(* 9, 9 *) +(mk_real_int64 1661341974L),(mk_real_int64 1205291438L);(* 9, 9 *) +(mk_real_int64 1534896838L),(mk_real_int64 1509969951L);(* 9, 9 *) +(mk_real_int64 1773251059L),(mk_real_int64 1482343511L);(* 9, 9 *) +(mk_real_int64 1101207486L),(mk_real_int64 1438661725L);(* 9, 9 *) +(mk_real_int64 1119411137L),(mk_real_int64 1859632953L);(* 9, 9 *) +(mk_real_int64 1562379894L),(mk_real_int64 1702187946L);(* 9, 9 *) +(mk_real_int64 1640673151L),(mk_real_int64 1015509204L);(* 9, 9 *) +(mk_real_int64 1569441541L),(mk_real_int64 1457956820L);(* 9, 9 *) +(mk_real_int64 1993412920L),(mk_real_int64 1122342356L);(* 9, 9 *) +(mk_real_int64 1120499767L),(mk_real_int64 1283208346L);(* 9, 9 *) +(mk_real_int64 1630607909L),(mk_real_int64 1799280470L);(* 9, 9 *) +(mk_real_int64 1255624698L),(mk_real_int64 1263985176L);(* 9, 9 *) +(mk_real_int64 1012988138L),(mk_real_int64 1445771834L);(* 9, 9 *) +(mk_real_int64 1294322178L),(mk_real_int64 1839754275L);(* 9, 9 *) +(mk_real_int64 1823210597L),(mk_real_int64 1530519501L);(* 9, 9 *) +(mk_real_int64 1951563249L),(mk_real_int64 1202146864L);(* 9, 9 *) +(mk_real_int64 1945387049L),(mk_real_int64 1851735836L);(* 9, 9 *) +(mk_real_int64 1896123436L),(mk_real_int64 1466901020L);(* 9, 9 *) +(mk_real_int64 1844339729L),(mk_real_int64 1356197867L);(* 9, 9 *) +(mk_real_int64 1551777875L),(mk_real_int64 1304291374L);(* 9, 9 *) +(mk_real_int64 1418752521L),(mk_real_int64 1390974781L);(* 9, 9 *) +(mk_real_int64 1421791107L),(mk_real_int64 1662877745L);(* 9, 9 *) +(mk_real_int64 1600529309L),(mk_real_int64 1931997393L);(* 9, 9 *) +(mk_real_int64 1912560941L),(mk_real_int64 1299100803L);(* 9, 9 *) +(mk_real_int64 1680509030L),(mk_real_int64 1342673394L);(* 9, 9 *) +(mk_real_int64 1466718537L),(mk_real_int64 1799258402L);(* 9, 9 *) +(mk_real_int64 1216897335L),(mk_real_int64 1909043936L);(* 9, 9 *) +(mk_real_int64 1519653847L),(mk_real_int64 1862061504L);(* 9, 9 *) +(mk_real_int64 1949666740L),(mk_real_int64 1270911662L);(* 9, 9 *) +(mk_real_int64 1496981813L),(mk_real_int64 1327479225L);(* 9, 9 *) +(mk_real_int64 1188021332L),(mk_real_int64 1261453211L);(* 9, 9 *) +(mk_real_int64 1615451128L),(mk_real_int64 1588891635L);(* 9, 9 *) +(mk_real_int64 1908069703L),(mk_real_int64 1360233029L);(* 9, 9 *) +(mk_real_int64 1756800896L),(mk_real_int64 1788937314L);(* 9, 9 *) +(mk_real_int64 1119385767L),(mk_real_int64 1102540520L);(* 9, 9 *) +(mk_real_int64 1613617091L),(mk_real_int64 1637215053L);(* 9, 9 *) +(mk_real_int64 1570564480L),(mk_real_int64 1816208392L);(* 9, 9 *) +(mk_real_int64 1864455824L),(mk_real_int64 1239633127L);(* 9, 9 *) +(mk_real_int64 1377489362L),(mk_real_int64 1592746952L);(* 9, 9 *) +(mk_real_int64 1663455866L),(mk_real_int64 1080990745L);(* 9, 9 *) +(mk_real_int64 1533210892L),(mk_real_int64 1995221375L);(* 9, 9 *) +(mk_real_int64 1159245245L),(mk_real_int64 1480537203L);(* 9, 9 *) +(mk_real_int64 1063800964L),(mk_real_int64 1152304847L);(* 9, 9 *) +(mk_real_int64 1985249528L),(mk_real_int64 1036343113L);(* 9, 9 *) +(mk_real_int64 1332081989L),(mk_real_int64 1034061932L);(* 9, 9 *) +(mk_real_int64 1517234280L),(mk_real_int64 1573428066L);(* 9, 9 *) +(mk_real_int64 1859216054L),(mk_real_int64 1224298649L);(* 9, 9 *) +(mk_real_int64 1116270042L),(mk_real_int64 1157299310L);(* 9, 9 *) +(mk_real_int64 1775523653L),(mk_real_int64 1832899472L);(* 9, 9 *) +(mk_real_int64 1754808041L),(mk_real_int64 1240296279L);(* 9, 9 *) +(mk_real_int64 1175196496L),(mk_real_int64 1123623626L);(* 9, 9 *) +(mk_real_int64 1179715036L),(mk_real_int64 1577968509L);(* 9, 9 *) +(mk_real_int64 1729056302L),(mk_real_int64 1829503484L);(* 9, 9 *) +(mk_real_int64 1228693921L),(mk_real_int64 1400688942L);(* 9, 9 *) +(mk_real_int64 1044588112L),(mk_real_int64 1280020719L);(* 9, 9 *) +(mk_real_int64 1484572141L),(mk_real_int64 1356919787L);(* 9, 9 *) +(mk_real_int64 1607455795L),(mk_real_int64 1415991068L);(* 9, 9 *) +(mk_real_int64 1794268333L),(mk_real_int64 1192799957L);(* 9, 9 *) +(mk_real_int64 1102207966L),(mk_real_int64 1134913924L);(* 9, 9 *) +(mk_real_int64 1525090671L),(mk_real_int64 1755764856L);(* 9, 9 *) +(mk_real_int64 1374983501L),(mk_real_int64 1720457783L);(* 9, 9 *) +(mk_real_int64 1456855325L),(mk_real_int64 1085323835L);(* 9, 9 *) +(mk_real_int64 1585306240L),(mk_real_int64 1040189024L);(* 9, 9 *) +(mk_real_int64 1777998998L),(mk_real_int64 1346265831L);(* 9, 9 *) +(mk_real_int64 1699938350L),(mk_real_int64 1707156513L);(* 9, 9 *) +(mk_real_int64 1464109474L),(mk_real_int64 1544589890L);(* 9, 9 *) +(mk_real_int64 1837938911L),(mk_real_int64 1423159586L);(* 9, 9 *) +(mk_real_int64 1905794248L),(mk_real_int64 1409587265L);(* 9, 9 *) +(mk_real_int64 1815506338L),(mk_real_int64 1581276736L);(* 9, 9 *) +(mk_real_int64 1751480900L),(mk_real_int64 1234297479L);(* 9, 9 *) +(mk_real_int64 1923610925L),(mk_real_int64 1584560585L);(* 9, 9 *) +(mk_real_int64 1991755000L),(mk_real_int64 1052061270L);(* 9, 9 *) +(mk_real_int64 1549489790L),(mk_real_int64 1160314492L);(* 9, 9 *) +(mk_real_int64 1965972270L),(mk_real_int64 1443224986L);(* 9, 9 *) +(mk_real_int64 1430030316L),(mk_real_int64 1923470084L);(* 9, 9 *) +(mk_real_int64 1055091344L),(mk_real_int64 1640609728L);(* 9, 9 *) +(mk_real_int64 1307808800L),(mk_real_int64 1999043185L);(* 9, 9 *) +(mk_real_int64 1865312778L),(mk_real_int64 1454738712L);(* 9, 9 *) +(mk_real_int64 1666768301L),(mk_real_int64 1094391200L);(* 9, 9 *) +(mk_real_int64 1992662268L),(mk_real_int64 1688867278L);(* 9, 9 *) +(mk_real_int64 1051504485L),(mk_real_int64 1882428090L);(* 9, 9 *) +(mk_real_int64 1700750592L),(mk_real_int64 1337431598L);(* 9, 9 *) +(mk_real_int64 1815911245L),(mk_real_int64 1939982251L);(* 9, 9 *) +(mk_real_int64 1518980876L),(mk_real_int64 1184296208L);(* 9, 9 *) +(mk_real_int64 1510196819L),(mk_real_int64 1384681067L);(* 9, 9 *) +(mk_real_int64 1377293618L),(mk_real_int64 1520931230L);(* 9, 9 *) +(mk_real_int64 1383433024L),(mk_real_int64 1290793191L);(* 9, 9 *) +(mk_real_int64 1832153930L),(mk_real_int64 1790422915L);(* 9, 9 *) +(mk_real_int64 1728702782L),(mk_real_int64 1404794055L);(* 9, 9 *) +(mk_real_int64 1535834045L),(mk_real_int64 1424991748L);(* 9, 9 *) +(mk_real_int64 1074216753L),(mk_real_int64 1334774012L);(* 9, 9 *) +(mk_real_int64 1916235514L),(mk_real_int64 1776468266L);(* 9, 9 *) +(mk_real_int64 1652065169L),(mk_real_int64 1823499745L);(* 9, 9 *) +(mk_real_int64 1236781089L),(mk_real_int64 1838895725L);(* 9, 9 *) +(mk_real_int64 1557846808L),(mk_real_int64 1451055536L);(* 9, 9 *) +(mk_real_int64 1742818964L),(mk_real_int64 1721115138L);(* 9, 9 *) +(mk_real_int64 1588614467L),(mk_real_int64 1062613622L);(* 9, 9 *) +(mk_real_int64 1182792993L),(mk_real_int64 1041182835L);(* 9, 9 *) +(mk_real_int64 1883809993L),(mk_real_int64 1654323402L);(* 9, 9 *) +(mk_real_int64 1236150024L),(mk_real_int64 1609507539L);(* 9, 9 *) +(mk_real_int64 1641333616L),(mk_real_int64 1781676061L);(* 9, 9 *) +(mk_real_int64 1933028167L),(mk_real_int64 1045349248L);(* 9, 9 *) +(mk_real_int64 1546176465L),(mk_real_int64 1534160114L);(* 9, 9 *) +(mk_real_int64 1257176704L),(mk_real_int64 1017015608L);(* 9, 9 *) +(mk_real_int64 1166889254L),(mk_real_int64 1074889862L);(* 9, 9 *) +(mk_real_int64 1726035929L),(mk_real_int64 1261974246L);(* 9, 9 *) +(mk_real_int64 1558557154L),(mk_real_int64 1567670519L);(* 9, 9 *) +(mk_real_int64 1614650524L),(mk_real_int64 1716730473L);(* 9, 9 *) +(mk_real_int64 1966192575L),(mk_real_int64 1924282325L);(* 9, 9 *) +(mk_real_int64 1685366429L),(mk_real_int64 1992411500L);(* 9, 9 *) +(mk_real_int64 1703201161L),(mk_real_int64 1680085150L);(* 9, 9 *) +(mk_real_int64 1626449400L),(mk_real_int64 1059141282L);(* 9, 9 *) +(mk_real_int64 1641862103L),(mk_real_int64 1656178479L);(* 9, 9 *) +(mk_real_int64 1932316762L),(mk_real_int64 1320819401L);(* 9, 9 *) +(mk_real_int64 1108000197L),(mk_real_int64 1790971095L);(* 9, 9 *) +(mk_real_int64 1906612921L),(mk_real_int64 1074379380L);(* 9, 9 *) +(mk_real_int64 1168644030L),(mk_real_int64 1926326506L);(* 9, 9 *) +(mk_real_int64 1783658132L),(mk_real_int64 1292540691L);(* 9, 9 *) +(mk_real_int64 1401745845L),(mk_real_int64 1870886266L);(* 9, 9 *) +(mk_real_int64 1230291800L),(mk_real_int64 1117905055L);(* 9, 9 *) +(mk_real_int64 1566323040L),(mk_real_int64 1219765480L);(* 9, 9 *) +(mk_real_int64 1672006471L),(mk_real_int64 1482956945L);(* 9, 9 *) +(mk_real_int64 1725019606L),(mk_real_int64 1480844717L);(* 9, 9 *) +(mk_real_int64 1162557983L),(mk_real_int64 1020943948L);(* 9, 9 *) +(mk_real_int64 1447963097L),(mk_real_int64 1466062520L);(* 9, 9 *) +(mk_real_int64 1074990259L),(mk_real_int64 1959527668L);(* 9, 9 *) +(mk_real_int64 1968956972L),(mk_real_int64 1243738524L);(* 9, 9 *) +(mk_real_int64 1906306377L),(mk_real_int64 1961248465L);(* 9, 9 *) +(mk_real_int64 1155226661L),(mk_real_int64 1873886884L);(* 9, 9 *) +(mk_real_int64 1403487145L),(mk_real_int64 1889997986L);(* 9, 9 *) +(mk_real_int64 1601843351L),(mk_real_int64 1936357303L);(* 9, 9 *) +(mk_real_int64 1909015411L),(mk_real_int64 1375918158L);(* 9, 9 *) +(mk_real_int64 1168276941L),(mk_real_int64 1651656548L);(* 9, 9 *) +(mk_real_int64 1093330215L),(mk_real_int64 1632230648L);(* 9, 9 *) +(mk_real_int64 1784012387L),(mk_real_int64 1322109832L);(* 9, 9 *) +(mk_real_int64 1314984628L),(mk_real_int64 1095306309L);(* 9, 9 *) +(mk_real_int64 1693990525L),(mk_real_int64 1567461374L);(* 9, 9 *) +(mk_real_int64 1426088459L),(mk_real_int64 1483435680L);(* 9, 9 *) +(mk_real_int64 1008078678L),(mk_real_int64 1143492454L);(* 9, 9 *) +(mk_real_int64 1334121676L),(mk_real_int64 1161017385L);(* 9, 9 *) +(mk_real_int64 1493620496L),(mk_real_int64 1911372814L);(* 9, 9 *) +(mk_real_int64 1872856303L),(mk_real_int64 1641937677L);(* 9, 9 *) +(mk_real_int64 1715980836L),(mk_real_int64 1947085253L);(* 9, 9 *) +(mk_real_int64 1105422407L),(mk_real_int64 1924905506L);(* 9, 9 *) +(mk_real_int64 1020020128L),(mk_real_int64 1822409666L);(* 9, 9 *) +(mk_real_int64 1137314030L),(mk_real_int64 1527858961L);(* 9, 9 *) +(mk_real_int64 1467399121L),(mk_real_int64 1340293814L);(* 9, 9 *) +(mk_real_int64 1516061703L),(mk_real_int64 1629965737L);(* 9, 9 *) +(mk_real_int64 1310750069L),(mk_real_int64 1296088312L);(* 9, 9 *) +(mk_real_int64 1314680004L),(mk_real_int64 1073363057L);(* 9, 9 *) +(mk_real_int64 1387514501L),(mk_real_int64 1530327335L);(* 9, 9 *) +(mk_real_int64 1236931560L),(mk_real_int64 1125853265L);(* 9, 9 *) +(mk_real_int64 1151077892L),(mk_real_int64 1979683950L);(* 9, 9 *) +(mk_real_int64 1265537142L),(mk_real_int64 1401495598L);(* 9, 9 *) +(mk_real_int64 1817650064L),(mk_real_int64 1422870696L);(* 9, 9 *) +(mk_real_int64 1953169786L),(mk_real_int64 1011734206L);(* 9, 9 *) +(mk_real_int64 1539765207L),(mk_real_int64 1242469759L);(* 9, 9 *) +(mk_real_int64 1396377490L),(mk_real_int64 1690470537L);(* 9, 9 *) +(mk_real_int64 1063500999L),(mk_real_int64 1267077733L);(* 9, 9 *) +(mk_real_int64 1659937322L),(mk_real_int64 1221191688L);(* 9, 9 *) +(mk_real_int64 1546234140L),(mk_real_int64 1168424709L);(* 9, 9 *) +(mk_real_int64 1612210519L),(mk_real_int64 1961602720L);(* 9, 9 *) +(mk_real_int64 1184795802L),(mk_real_int64 1787125666L);(* 9, 9 *) +(mk_real_int64 1627907188L),(mk_real_int64 1353696711L);(* 9, 9 *) +(mk_real_int64 1051399670L),(mk_real_int64 1796122722L);(* 9, 9 *) +(mk_real_int64 1172685611L),(mk_real_int64 1711990366L);(* 9, 9 *) +(mk_real_int64 1828812450L),(mk_real_int64 1260758618L);(* 9, 9 *) +(mk_real_int64 1773502883L),(mk_real_int64 1963293160L);(* 9, 9 *) +(mk_real_int64 1674441253L),(mk_real_int64 1747003038L);(* 9, 9 *) +(mk_real_int64 1490859785L),(mk_real_int64 1736296885L);(* 9, 9 *) +(mk_real_int64 1681548110L),(mk_real_int64 1703926808L);(* 9, 9 *) +(mk_real_int64 1107255442L),(mk_real_int64 1597149431L);(* 9, 9 *) +(mk_real_int64 1869239879L),(mk_real_int64 1125579823L);(* 9, 9 *) +(mk_real_int64 1988093753L),(mk_real_int64 1224929361L);(* 9, 9 *) +(mk_real_int64 1943916324L),(mk_real_int64 1825591165L);(* 9, 9 *) +(mk_real_int64 1566464738L),(mk_real_int64 1043672336L);(* 9, 9 *) +(mk_real_int64 1636150989L),(mk_real_int64 1093488316L);(* 9, 9 *) +(mk_real_int64 1527128916L),(mk_real_int64 1219089792L);(* 9, 9 *) +(mk_real_int64 1918116815L),(mk_real_int64 1275328839L);(* 9, 9 *) +(mk_real_int64 1941057463L),(mk_real_int64 1363952225L);(* 9, 9 *) +(mk_real_int64 1351776761L),(mk_real_int64 1911840430L);(* 9, 9 *) +(mk_real_int64 1350095928L),(mk_real_int64 1021527341L);(* 9, 9 *) +(mk_real_int64 1250185085L),(mk_real_int64 1241179420L);(* 9, 9 *) +(mk_real_int64 1182921756L),(mk_real_int64 1279006589L);(* 9, 9 *) +(mk_real_int64 1468966875L),(mk_real_int64 1433084329L);(* 9, 9 *) +(mk_real_int64 1016029283L),(mk_real_int64 1316497960L);(* 9, 9 *) +(mk_real_int64 1776217948L),(mk_real_int64 1923640436L);(* 9, 9 *) +(mk_real_int64 1539643577L),(mk_real_int64 1842307331L);(* 9, 9 *) +(mk_real_int64 1061169267L),(mk_real_int64 1015061087L);(* 9, 9 *) +(mk_real_int64 1092362841L),(mk_real_int64 1059215978L);(* 9, 9 *) +(mk_real_int64 1799031913L),(mk_real_int64 1402977826L);(* 9, 9 *) +(mk_real_int64 1409780387L),(mk_real_int64 1225808504L);(* 9, 9 *) +(mk_real_int64 1229657984L),(mk_real_int64 1129013274L);(* 9, 9 *) +(mk_real_int64 1075839377L),(mk_real_int64 1735324134L);(* 9, 9 *) +(mk_real_int64 1733629701L),(mk_real_int64 1554413091L);(* 9, 9 *) +(mk_real_int64 1045176345L),(mk_real_int64 1399112413L);(* 9, 9 *) +(mk_real_int64 1805945575L),(mk_real_int64 1126907560L);(* 9, 9 *) +(mk_real_int64 1384520124L),(mk_real_int64 1769707680L);(* 9, 9 *) +(mk_real_int64 1353830880L),(mk_real_int64 1085728100L);(* 9, 9 *) +(mk_real_int64 1346964346L),(mk_real_int64 1628060459L);(* 9, 9 *) +(mk_real_int64 1942658067L),(mk_real_int64 1709087164L);(* 9, 9 *) +(mk_real_int64 1755962486L),(mk_real_int64 1510831994L);(* 9, 9 *) +(mk_real_int64 1809561882L),(mk_real_int64 1249966777L);(* 9, 9 *) +(mk_real_int64 1267454388L),(mk_real_int64 1712510552L);(* 9, 9 *) +(mk_real_int64 1553844739L),(mk_real_int64 1684821585L);(* 9, 9 *) +(mk_real_int64 1157920525L),(mk_real_int64 1903055727L);(* 9, 9 *) +(mk_real_int64 1182965998L),(mk_real_int64 1881841484L);(* 9, 9 *) +(mk_real_int64 1564920311L),(mk_real_int64 1948798934L);(* 9, 9 *) +(mk_real_int64 1502060043L),(mk_real_int64 1124287423L);(* 9, 9 *) +(mk_real_int64 1791869357L),(mk_real_int64 1121171810L);(* 9, 9 *) +(mk_real_int64 1165340043L),(mk_real_int64 1447597621L);(* 9, 9 *) +(mk_real_int64 1545376887L),(mk_real_int64 1914553784L);(* 9, 9 *) +(mk_real_int64 1387907983L),(mk_real_int64 1616916870L);(* 9, 9 *) +(mk_real_int64 1510552384L),(mk_real_int64 1649310387L);(* 9, 9 *) +(mk_real_int64 1539120312L),(mk_real_int64 1769935896L);(* 9, 9 *) +(mk_real_int64 1488476451L),(mk_real_int64 1975441166L);(* 9, 9 *) +(mk_real_int64 1668096741L),(mk_real_int64 1464302381L);(* 9, 9 *) +(mk_real_int64 1116557910L),(mk_real_int64 1089944749L);(* 9, 9 *) +(mk_real_int64 1647015340L),(mk_real_int64 1898948392L);(* 9, 9 *) +(mk_real_int64 1416246622L),(mk_real_int64 1979691206L);(* 9, 9 *) +(mk_real_int64 1861558886L),(mk_real_int64 1363328824L);(* 9, 9 *) +(mk_real_int64 1181479395L),(mk_real_int64 1048808116L);(* 9, 9 *) +(mk_real_int64 1396492565L),(mk_real_int64 1142120617L);(* 9, 9 *) +(mk_real_int64 1216146415L),(mk_real_int64 1924104090L);(* 9, 9 *) +(mk_real_int64 1561987248L),(mk_real_int64 1435721189L);(* 9, 9 *) +(mk_real_int64 1267647636L),(mk_real_int64 1229543456L);(* 9, 9 *) +(mk_real_int64 1293858743L),(mk_real_int64 1225792535L);(* 9, 9 *) +(mk_real_int64 1462720416L),(mk_real_int64 1495060445L);(* 9, 9 *) +(mk_real_int64 1163710276L),(mk_real_int64 1841408702L);(* 9, 9 *) +(mk_real_int64 1122924010L),(mk_real_int64 1192645012L);(* 9, 9 *) +(mk_real_int64 1739414393L),(mk_real_int64 1618144000L);(* 9, 9 *) +(mk_real_int64 1173390240L),(mk_real_int64 1783908842L);(* 9, 9 *) +(mk_real_int64 1196345133L),(mk_real_int64 1182479358L);(* 9, 9 *) +(mk_real_int64 1234958985L),(mk_real_int64 1718663616L);(* 9, 9 *) +(mk_real_int64 1765283574L),(mk_real_int64 1474975561L);(* 9, 9 *) +(mk_real_int64 1301783594L),(mk_real_int64 1603111650L);(* 9, 9 *) +(mk_real_int64 1708040801L),(mk_real_int64 1812178150L);(* 9, 9 *) +(mk_real_int64 1259612924L),(mk_real_int64 1802011218L);(* 9, 9 *) +(mk_real_int64 1266118226L),(mk_real_int64 1496568771L);(* 9, 9 *) +(mk_real_int64 1518061218L),(mk_real_int64 1245787365L);(* 9, 9 *) +(mk_real_int64 1400770454L),(mk_real_int64 1586448293L);(* 9, 9 *) +(mk_real_int64 1087323139L),(mk_real_int64 1103399123L);(* 9, 9 *) +(mk_real_int64 1502288260L),(mk_real_int64 1258932994L);(* 9, 9 *) +(mk_real_int64 1681582423L),(mk_real_int64 1442304205L);(* 9, 9 *) +(mk_real_int64 1001581965L),(mk_real_int64 1621497464L);(* 9, 9 *) +(mk_real_int64 1926234473L),(mk_real_int64 1805606638L);(* 9, 9 *) +(mk_real_int64 1776024381L),(mk_real_int64 1223601610L);(* 9, 9 *) +(mk_real_int64 1240276813L),(mk_real_int64 1243414886L);(* 9, 9 *) +(mk_real_int64 1189938584L),(mk_real_int64 1397570553L);(* 9, 9 *) +(mk_real_int64 1852462982L),(mk_real_int64 1214013206L);(* 9, 9 *) +(mk_real_int64 1907161632L),(mk_real_int64 1497482798L);(* 9, 9 *) +(mk_real_int64 1158820516L),(mk_real_int64 1087011686L);(* 9, 9 *) +(mk_real_int64 1133937595L),(mk_real_int64 1664535986L);(* 9, 9 *) +(mk_real_int64 1521502655L),(mk_real_int64 1481680592L);(* 9, 9 *) +(mk_real_int64 1966179611L),(mk_real_int64 1660709197L);(* 9, 9 *) +(mk_real_int64 1228942219L),(mk_real_int64 1667141504L);(* 9, 9 *) +(mk_real_int64 1323347483L),(mk_real_int64 1877136644L);(* 9, 9 *) +(mk_real_int64 1791874557L),(mk_real_int64 1152966099L);(* 9, 9 *) +(mk_real_int64 1530820860L),(mk_real_int64 1069991116L);(* 9, 9 *) +(mk_real_int64 1281620581L),(mk_real_int64 1937412139L);(* 9, 9 *) +(mk_real_int64 1500896935L),(mk_real_int64 1792654780L);(* 9, 9 *) +(mk_real_int64 1717081651L),(mk_real_int64 1143786109L);(* 9, 9 *) +(mk_real_int64 1548741088L),(mk_real_int64 1496176955L);(* 9, 9 *) +(mk_real_int64 1827087268L),(mk_real_int64 1484439190L);(* 9, 9 *) +(mk_real_int64 1571901337L),(mk_real_int64 1016198037L);(* 9, 9 *) +(mk_real_int64 1612072634L),(mk_real_int64 1868547672L);(* 9, 9 *) +(mk_real_int64 1644105788L),(mk_real_int64 1304048011L);(* 9, 9 *) +(mk_real_int64 1338625733L),(mk_real_int64 1903287656L);(* 9, 9 *) +(mk_real_int64 1427627777L),(mk_real_int64 1000311452L);(* 9, 9 *) +(mk_real_int64 1969461528L),(mk_real_int64 1837752274L);(* 9, 9 *) +(mk_real_int64 1737430338L),(mk_real_int64 1199901830L);(* 9, 9 *) +(mk_real_int64 1476124594L),(mk_real_int64 1340872768L);(* 9, 9 *) +(mk_real_int64 1392555244L),(mk_real_int64 1259092968L);(* 9, 9 *) +(mk_real_int64 1482259155L),(mk_real_int64 1898887737L);(* 9, 9 *) +(mk_real_int64 1431727053L),(mk_real_int64 1087310713L);(* 9, 9 *) +(mk_real_int64 1712594025L),(mk_real_int64 1119947467L);(* 9, 9 *) +(mk_real_int64 1115949971L),(mk_real_int64 1915050843L);(* 9, 9 *) +(mk_real_int64 1713116271L),(mk_real_int64 1114506851L);(* 9, 9 *) +(mk_real_int64 1780401146L),(mk_real_int64 1015034406L);(* 9, 9 *) +(mk_real_int64 1538270598L),(mk_real_int64 1637760639L);(* 9, 9 *) +(mk_real_int64 1837448717L),(mk_real_int64 1037063465L);(* 9, 9 *) +(mk_real_int64 1909779255L),(mk_real_int64 1949981573L);(* 9, 9 *) +(mk_real_int64 1048636563L),(mk_real_int64 1360394546L);(* 9, 9 *) +(mk_real_int64 1023035716L),(mk_real_int64 1019299471L);(* 9, 9 *) +(mk_real_int64 1538510910L),(mk_real_int64 1888586900L);(* 9, 9 *) +(mk_real_int64 1725338321L),(mk_real_int64 1530509407L);(* 9, 9 *) +(mk_real_int64 1100529588L),(mk_real_int64 1443868307L);(* 9, 9 *) +(mk_real_int64 1199981800L),(mk_real_int64 1300995105L);(* 9, 9 *) +(mk_real_int64 1316530185L),(mk_real_int64 1376208883L);(* 9, 9 *) +(mk_real_int64 1751230864L),(mk_real_int64 1289648119L);(* 9, 9 *) +(mk_real_int64 1013917800L),(mk_real_int64 1928199531L);(* 9, 9 *) +(mk_real_int64 1052712137L),(mk_real_int64 1484590623L);(* 9, 9 *) +(mk_real_int64 1303604012L),(mk_real_int64 1492125166L);(* 9, 9 *) +(mk_real_int64 1752597701L),(mk_real_int64 1729054945L);(* 9, 9 *) +(mk_real_int64 1590931740L),(mk_real_int64 1224118881L);(* 9, 9 *) +(mk_real_int64 1122886509L),(mk_real_int64 1412593370L);(* 9, 9 *) +(mk_real_int64 1462040854L),(mk_real_int64 1331700889L);(* 9, 9 *) +(mk_real_int64 1000303556L),(mk_real_int64 1700366873L);(* 9, 9 *) +(mk_real_int64 1290122575L),(mk_real_int64 1526143020L);(* 9, 9 *) +(mk_real_int64 1292236204L),(mk_real_int64 1032160697L);(* 9, 9 *) +(mk_real_int64 1236057252L),(mk_real_int64 1462959683L);(* 9, 9 *) +(mk_real_int64 1360376826L),(mk_real_int64 1543140152L);(* 9, 9 *) +(mk_real_int64 1361972391L),(mk_real_int64 1182084617L);(* 9, 9 *) +(mk_real_int64 1019417878L),(mk_real_int64 1672081664L);(* 9, 9 *) +(mk_real_int64 1715069042L),(mk_real_int64 1412121166L);(* 9, 9 *) +(mk_real_int64 1797976666L),(mk_real_int64 1404192263L);(* 9, 9 *) +(mk_real_int64 1263803542L),(mk_real_int64 1248622478L);(* 9, 9 *) +(mk_real_int64 1623842838L),(mk_real_int64 1909249186L);(* 9, 9 *) +(mk_real_int64 1984351327L),(mk_real_int64 1425188631L);(* 9, 9 *) +(mk_real_int64 1646377561L),(mk_real_int64 1556511396L);(* 9, 9 *) +(mk_real_int64 1607796845L),(mk_real_int64 1293980770L);(* 9, 9 *) +(mk_real_int64 1428367731L),(mk_real_int64 1314392028L);(* 9, 9 *) +(mk_real_int64 1765700390L),(mk_real_int64 1312744951L);(* 9, 9 *) +(mk_real_int64 1068468553L),(mk_real_int64 1768828699L);(* 9, 9 *) +(mk_real_int64 1443564750L),(mk_real_int64 1499614927L);(* 9, 9 *) +(mk_real_int64 1010872529L),(mk_real_int64 1790387165L);(* 9, 9 *) +(mk_real_int64 1083972678L),(mk_real_int64 1719070166L);(* 9, 9 *) +(mk_real_int64 1053590867L),(mk_real_int64 1550958117L);(* 9, 9 *) +(mk_real_int64 1567822705L),(mk_real_int64 1509571984L);(* 9, 9 *) +(mk_real_int64 1122618231L),(mk_real_int64 1121519394L);(* 9, 9 *) +(mk_real_int64 1472707288L),(mk_real_int64 1080516037L);(* 9, 9 *) +(mk_real_int64 1013985903L),(mk_real_int64 1178810574L);(* 9, 9 *) +(mk_real_int64 1426142215L),(mk_real_int64 1718694246L);(* 9, 9 *) +(mk_real_int64 1148789828L),(mk_real_int64 1213418376L);(* 9, 9 *) +(mk_real_int64 1707858051L),(mk_real_int64 1091054370L);(* 9, 9 *) +(mk_real_int64 1716015545L),(mk_real_int64 1864933943L);(* 9, 9 *) +(mk_real_int64 1879765458L),(mk_real_int64 1735724808L);(* 9, 9 *) +(mk_real_int64 1424363852L),(mk_real_int64 1942076481L);(* 9, 9 *) +(mk_real_int64 1034591951L),(mk_real_int64 1045984797L);(* 9, 9 *) +(mk_real_int64 1777439761L),(mk_real_int64 1049227440L);(* 9, 9 *) +(mk_real_int64 1113616064L),(mk_real_int64 1250589178L);(* 9, 9 *) +(mk_real_int64 1228516913L),(mk_real_int64 1215454115L);(* 9, 9 *) +(mk_real_int64 1401248636L),(mk_real_int64 1007589500L);(* 9, 9 *) +(mk_real_int64 1320219584L),(mk_real_int64 1544733375L);(* 9, 9 *) +(mk_real_int64 1195031610L),(mk_real_int64 1072884720L);(* 9, 9 *) +(mk_real_int64 1341426480L),(mk_real_int64 1474779342L);(* 9, 9 *) +(mk_real_int64 1302570399L),(mk_real_int64 1524858167L);(* 9, 9 *) +(mk_real_int64 1083804108L),(mk_real_int64 1527280808L);(* 9, 9 *) +(mk_real_int64 1279994867L),(mk_real_int64 1249557157L);(* 9, 9 *) +(mk_real_int64 1888249813L),(mk_real_int64 1047006144L);(* 9, 9 *) +(mk_real_int64 1163955123L),(mk_real_int64 1855050176L);(* 9, 9 *) +(mk_real_int64 1060970648L),(mk_real_int64 1352510380L);(* 9, 9 *) +(mk_real_int64 1783599381L),(mk_real_int64 1145938586L);(* 9, 9 *) +(mk_real_int64 1910621707L),(mk_real_int64 1348247870L);(* 9, 9 *) +(mk_real_int64 1294706314L),(mk_real_int64 1111514386L);(* 9, 9 *) +(mk_real_int64 1516366165L),(mk_real_int64 1521837908L);(* 9, 9 *) +(mk_real_int64 1732132222L),(mk_real_int64 1073390791L);(* 9, 9 *) +(mk_real_int64 1007903329L),(mk_real_int64 1222118109L);(* 9, 9 *) +(mk_real_int64 1851999123L),(mk_real_int64 1798531787L);(* 9, 9 *) +(mk_real_int64 1777561937L),(mk_real_int64 1418552715L);(* 9, 9 *) +(mk_real_int64 1398474661L),(mk_real_int64 1604056452L);(* 9, 9 *) +(mk_real_int64 1018386766L),(mk_real_int64 1634973330L);(* 9, 9 *) +(mk_real_int64 1749627889L),(mk_real_int64 1241236202L);(* 9, 9 *) +(mk_real_int64 1562363544L),(mk_real_int64 1354907290L);(* 9, 9 *) +(mk_real_int64 1651920700L),(mk_real_int64 1897083043L);(* 9, 9 *) +(mk_real_int64 1662081613L),(mk_real_int64 1785034794L);(* 9, 9 *) +(mk_real_int64 1157734984L),(mk_real_int64 1730433617L);(* 9, 9 *) +(mk_real_int64 1885272317L),(mk_real_int64 1258565888L);(* 9, 9 *) +(mk_real_int64 1189618530L),(mk_real_int64 1876006532L);(* 9, 9 *) +(mk_real_int64 1431854733L),(mk_real_int64 1255310050L);(* 9, 9 *) +(mk_real_int64 1096967793L),(mk_real_int64 1971971714L);(* 9, 9 *) +(mk_real_int64 1250027061L),(mk_real_int64 1083517224L);(* 9, 9 *) +(mk_real_int64 1556518554L),(mk_real_int64 1819588572L);(* 9, 9 *) +(mk_real_int64 1742647120L),(mk_real_int64 1229179607L);(* 9, 9 *) +(mk_real_int64 1516954838L),(mk_real_int64 1861685999L);(* 9, 9 *) +(mk_real_int64 1675281684L),(mk_real_int64 1481463080L);(* 9, 9 *) +(mk_real_int64 1471995219L),(mk_real_int64 1469697097L);(* 9, 9 *) +(mk_real_int64 1648531483L),(mk_real_int64 1559898670L);(* 9, 9 *) +(mk_real_int64 1836663409L),(mk_real_int64 1425997317L);(* 9, 9 *) +(mk_real_int64 1602882490L),(mk_real_int64 1542363178L);(* 9, 9 *) +(mk_real_int64 1583575041L),(mk_real_int64 1555714416L);(* 9, 9 *) +(mk_real_int64 1696327169L),(mk_real_int64 1397623270L);(* 9, 9 *) +(mk_real_int64 1449432772L),(mk_real_int64 1731331371L);(* 9, 9 *) +(mk_real_int64 1364102923L),(mk_real_int64 1001698605L);(* 9, 9 *) +(mk_real_int64 1188118474L),(mk_real_int64 1749337441L);(* 9, 9 *) +(mk_real_int64 1032499578L),(mk_real_int64 1975992591L);(* 9, 9 *) +(mk_real_int64 1366677053L),(mk_real_int64 1522251887L);(* 9, 9 *) +(mk_real_int64 1321584922L),(mk_real_int64 1426502946L);(* 9, 9 *) +(mk_real_int64 1354029391L),(mk_real_int64 1934869542L);(* 9, 9 *) +(mk_real_int64 1078454776L),(mk_real_int64 1930039317L);(* 9, 9 *) +(mk_real_int64 1498589082L),(mk_real_int64 1333183936L);(* 9, 9 *) +(mk_real_int64 1837952452L),(mk_real_int64 1790234701L);(* 9, 9 *) +(mk_real_int64 1221801358L),(mk_real_int64 1180618533L);(* 9, 9 *) +(mk_real_int64 1313039575L),(mk_real_int64 1688037886L);(* 9, 9 *) +(mk_real_int64 1081902133L),(mk_real_int64 1325373646L);(* 9, 9 *) +(mk_real_int64 1421902478L),(mk_real_int64 1763621212L);(* 9, 9 *) +(mk_real_int64 1273124042L),(mk_real_int64 1889491555L);(* 9, 9 *) +(mk_real_int64 1671735008L),(mk_real_int64 1541253376L);(* 9, 9 *) +(mk_real_int64 1275644545L),(mk_real_int64 1852403790L);(* 9, 9 *) +(mk_real_int64 1634084451L),(mk_real_int64 1825187183L);(* 9, 9 *) +(mk_real_int64 1455485648L),(mk_real_int64 1740948514L);(* 9, 9 *) +(mk_real_int64 1041061133L),(mk_real_int64 1767617396L);(* 9, 9 *) +(mk_real_int64 1829186420L),(mk_real_int64 1699289093L);(* 9, 9 *) +(mk_real_int64 1114786026L),(mk_real_int64 1949743331L);(* 9, 9 *) +(mk_real_int64 1148112175L),(mk_real_int64 1222028536L);(* 9, 9 *) +(mk_real_int64 1205869278L),(mk_real_int64 1901793867L);(* 9, 9 *) +(mk_real_int64 1347542541L),(mk_real_int64 1672843172L);(* 9, 9 *) +(mk_real_int64 1043774095L),(mk_real_int64 1250391105L);(* 9, 9 *) +(mk_real_int64 1717761963L),(mk_real_int64 1906092468L);(* 9, 9 *) +(mk_real_int64 1175821912L),(mk_real_int64 1268814239L);(* 9, 9 *) +(mk_real_int64 1418291795L),(mk_real_int64 1676065037L);(* 9, 9 *) +(mk_real_int64 1919796471L),(mk_real_int64 1862744828L);(* 9, 9 *) +(mk_real_int64 1327434962L),(mk_real_int64 1268878366L);(* 9, 9 *) +(mk_real_int64 1702868548L),(mk_real_int64 1477185498L);(* 9, 9 *) +(mk_real_int64 1850516878L),(mk_real_int64 1780331545L);(* 9, 9 *) +(mk_real_int64 1150858401L),(mk_real_int64 1501625601L);(* 9, 9 *) +(mk_real_int64 1300785090L),(mk_real_int64 1253267592L);(* 9, 9 *) +(mk_real_int64 1474553668L),(mk_real_int64 1757640568L);(* 9, 9 *) +(mk_real_int64 1292122803L),(mk_real_int64 1070335055L);(* 9, 9 *) +(mk_real_int64 1961048280L),(mk_real_int64 1522512265L);(* 9, 9 *) +(mk_real_int64 1065832507L),(mk_real_int64 1363296243L);(* 9, 9 *) +(mk_real_int64 1539925711L),(mk_real_int64 1859873596L);(* 9, 9 *) +(mk_real_int64 1119504367L),(mk_real_int64 1520108610L);(* 9, 9 *) +(mk_real_int64 1416078670L),(mk_real_int64 1600280869L);(* 9, 9 *) +(mk_real_int64 1845717460L),(mk_real_int64 1421343903L);(* 9, 9 *) +(mk_real_int64 1823491412L),(mk_real_int64 1369552076L);(* 9, 9 *) +(mk_real_int64 1676581878L),(mk_real_int64 1365270211L);(* 9, 9 *) +(mk_real_int64 1406895387L),(mk_real_int64 1779420611L);(* 9, 9 *) +(mk_real_int64 1821152042L),(mk_real_int64 1178316305L);(* 9, 9 *) +(mk_real_int64 1440182434L),(mk_real_int64 1560308053L);(* 9, 9 *) +(mk_real_int64 1996420545L),(mk_real_int64 1637600527L);(* 9, 9 *) +(mk_real_int64 1099226452L),(mk_real_int64 1367780629L);(* 9, 9 *) +(mk_real_int64 1071170135L),(mk_real_int64 1704243677L);(* 9, 9 *) +(mk_real_int64 1601008776L),(mk_real_int64 1094274948L);(* 9, 9 *) +(mk_real_int64 1198289504L),(mk_real_int64 1286133526L);(* 9, 9 *) +(mk_real_int64 1958268302L),(mk_real_int64 1647426908L);(* 9, 9 *) +(mk_real_int64 1945044187L),(mk_real_int64 1653309646L);(* 9, 9 *) +(mk_real_int64 1202981731L),(mk_real_int64 1054995552L);(* 9, 9 *) +(mk_real_int64 1136139325L),(mk_real_int64 1059922874L);(* 9, 9 *) +(mk_real_int64 1743240460L),(mk_real_int64 1807326352L);(* 9, 9 *) +(mk_real_int64 1852799695L),(mk_real_int64 1102587678L);(* 9, 9 *) +(mk_real_int64 1631468037L),(mk_real_int64 1429172975L);(* 9, 9 *) +(mk_real_int64 1956840133L),(mk_real_int64 1781306324L);(* 9, 9 *) +(mk_real_int64 1825043723L),(mk_real_int64 1935514878L);(* 9, 9 *) +(mk_real_int64 1846372205L),(mk_real_int64 1695133057L);(* 9, 9 *) +(mk_real_int64 1936488525L),(mk_real_int64 1113806498L);(* 9, 9 *) +(mk_real_int64 1630152621L),(mk_real_int64 1400740226L);(* 9, 9 *) +(mk_real_int64 1526091720L),(mk_real_int64 1428231979L);(* 9, 9 *) +(mk_real_int64 1264069790L),(mk_real_int64 1172145082L);(* 9, 9 *) +(mk_real_int64 1788703461L),(mk_real_int64 1415260689L);(* 9, 9 *) +(mk_real_int64 1919099833L),(mk_real_int64 1321803721L);(* 9, 9 *) +(mk_real_int64 1401991365L),(mk_real_int64 1559583933L);(* 9, 9 *) +(mk_real_int64 1463075601L),(mk_real_int64 1176064504L);(* 9, 9 *) +(mk_real_int64 1424507888L),(mk_real_int64 1023272231L);(* 9, 9 *) +(mk_real_int64 1162288480L),(mk_real_int64 1351899835L);(* 9, 9 *) +(mk_real_int64 1643281285L),(mk_real_int64 1761229167L);(* 9, 9 *) +(mk_real_int64 1435075844L),(mk_real_int64 1632856082L);(* 9, 9 *) +(mk_real_int64 1707508358L),(mk_real_int64 1893832866L);(* 9, 9 *) +(mk_real_int64 1006132490L),(mk_real_int64 1670053477L);(* 9, 9 *) +(mk_real_int64 1410940495L),(mk_real_int64 1289863810L);(* 9, 9 *) +(mk_real_int64 1879199954L),(mk_real_int64 1665493897L);(* 9, 9 *) +(mk_real_int64 1247902743L),(mk_real_int64 1503156447L);(* 9, 9 *) +(mk_real_int64 1349645001L),(mk_real_int64 1844461803L);(* 9, 9 *) +(mk_real_int64 1017274286L),(mk_real_int64 1544303960L);(* 9, 9 *) +(mk_real_int64 1127217926L),(mk_real_int64 1774749752L);(* 9, 9 *) +(mk_real_int64 1790925761L),(mk_real_int64 1963994243L);(* 9, 9 *) +(mk_real_int64 1271219413L),(mk_real_int64 1327979770L);(* 9, 9 *) +(mk_real_int64 1888226518L),(mk_real_int64 1530995974L);(* 9, 9 *) +(mk_real_int64 1700596313L),(mk_real_int64 1071884104L);(* 9, 9 *) +(mk_real_int64 1966097374L),(mk_real_int64 1780775628L);(* 9, 9 *) +(mk_real_int64 1356798436L),(mk_real_int64 1801771492L);(* 9, 9 *) +(mk_real_int64 1773226398L),(mk_real_int64 1494472369L);(* 9, 9 *) +(mk_real_int64 1051851771L),(mk_real_int64 1175259358L);(* 9, 9 *) +(mk_real_int64 1678730653L),(mk_real_int64 1997296539L);(* 9, 9 *) +(mk_real_int64 1693231868L),(mk_real_int64 1632258854L);(* 9, 9 *) +(mk_real_int64 1422099489L),(mk_real_int64 1594016313L);(* 9, 9 *) +(mk_real_int64 1761204586L),(mk_real_int64 1498839651L);(* 9, 9 *) +(mk_real_int64 1536060735L),(mk_real_int64 1253605935L);(* 9, 9 *) +(mk_real_int64 1073900978L),(mk_real_int64 1898834918L);(* 9, 9 *) +(mk_real_int64 1209938932L),(mk_real_int64 1618613797L);(* 9, 9 *) +(mk_real_int64 1158790217L),(mk_real_int64 1880203927L);(* 9, 9 *) +(mk_real_int64 1896054304L),(mk_real_int64 1387538727L);(* 9, 9 *) +(mk_real_int64 1560974073L),(mk_real_int64 1679287041L);(* 9, 9 *) +(mk_real_int64 1490009754L),(mk_real_int64 1107096073L);(* 9, 9 *) +(mk_real_int64 1744629563L),(mk_real_int64 1176512383L);(* 9, 9 *) +(mk_real_int64 1193236552L),(mk_real_int64 1934248385L);(* 9, 9 *) +(mk_real_int64 1703956102L),(mk_real_int64 1630164867L);(* 9, 9 *) +(mk_real_int64 1933065374L),(mk_real_int64 1077428462L);(* 9, 9 *) +(mk_real_int64 1892267499L),(mk_real_int64 1753430373L);(* 9, 9 *) +(mk_real_int64 1451304675L),(mk_real_int64 1174385642L);(* 9, 9 *) +(mk_real_int64 1165731149L),(mk_real_int64 1019977747L);(* 9, 9 *) +(mk_real_int64 1851072092L),(mk_real_int64 1494959072L);(* 9, 9 *) +(mk_real_int64 1352650263L),(mk_real_int64 1196909448L);(* 9, 9 *) +(mk_real_int64 1202789657L),(mk_real_int64 1772379762L);(* 9, 9 *) +(mk_real_int64 1791919034L),(mk_real_int64 1634620582L);(* 9, 9 *) +(mk_real_int64 1457094995L),(mk_real_int64 1801761395L);(* 9, 9 *) +(mk_real_int64 1861945172L),(mk_real_int64 1347483576L);(* 9, 9 *) +(mk_real_int64 1621985411L),(mk_real_int64 1476594508L);(* 9, 9 *) +(mk_real_int64 1905717187L),(mk_real_int64 1385687671L);(* 9, 9 *) +(mk_real_int64 1933498295L),(mk_real_int64 1372564729L);(* 9, 9 *) +(mk_real_int64 1685249604L),(mk_real_int64 1571634580L);(* 9, 9 *) +(mk_real_int64 1252666975L),(mk_real_int64 1516719484L);(* 9, 9 *) +(mk_real_int64 1439022301L),(mk_real_int64 1487851103L);(* 9, 9 *) +(mk_real_int64 1890060210L),(mk_real_int64 1131039719L);(* 9, 9 *) +(mk_real_int64 1565774276L),(mk_real_int64 1458632273L);(* 9, 9 *) +(mk_real_int64 1361338436L),(mk_real_int64 1320470604L);(* 9, 9 *) +(mk_real_int64 1447530242L),(mk_real_int64 1035553289L);(* 9, 9 *) +(mk_real_int64 1452882647L),(mk_real_int64 1138812470L);(* 9, 9 *) +(mk_real_int64 1029131835L),(mk_real_int64 1401095232L);(* 9, 9 *) +(mk_real_int64 1034888464L),(mk_real_int64 1364064625L);(* 9, 9 *) +(mk_real_int64 1476497384L),(mk_real_int64 1717629991L);(* 9, 9 *) +(mk_real_int64 1315177038L),(mk_real_int64 1110008981L);(* 9, 9 *) +(mk_real_int64 1719417387L),(mk_real_int64 1391475156L);(* 9, 9 *) +(mk_real_int64 1072303213L),(mk_real_int64 1356472525L);(* 9, 9 *) +(mk_real_int64 1008179455L),(mk_real_int64 1456470865L);(* 9, 9 *) +(mk_real_int64 1171711274L),(mk_real_int64 1506579827L);(* 9, 9 *) +(mk_real_int64 1819932077L),(mk_real_int64 1078739945L);(* 9, 9 *) +(mk_real_int64 1489136038L),(mk_real_int64 1594096569L);(* 9, 9 *) +(mk_real_int64 1767310771L),(mk_real_int64 1334352607L);(* 9, 9 *) +(mk_real_int64 1055936770L),(mk_real_int64 1864799159L);(* 9, 9 *) +(mk_real_int64 1306849237L),(mk_real_int64 1071749938L);(* 9, 9 *) +(mk_real_int64 1206605485L),(mk_real_int64 1333286760L);(* 9, 9 *) +(mk_real_int64 1273282145L),(mk_real_int64 1136624391L);(* 9, 9 *) +(mk_real_int64 1354231152L),(mk_real_int64 1826391882L);(* 9, 9 *) +(mk_real_int64 1894600929L),(mk_real_int64 1483172940L);(* 9, 9 *) +(mk_real_int64 1447462672L),(mk_real_int64 1504621955L);(* 9, 9 *) +(mk_real_int64 1350799206L),(mk_real_int64 1569433670L);(* 9, 9 *) +(mk_real_int64 1896067345L),(mk_real_int64 1967619612L);(* 9, 9 *) +(mk_real_int64 1256457541L),(mk_real_int64 1142657994L);(* 9, 9 *) +(mk_real_int64 1797302096L),(mk_real_int64 1047547145L);(* 9, 9 *) +(mk_real_int64 1415547890L),(mk_real_int64 1533587684L);(* 9, 9 *) +(mk_real_int64 1122860263L),(mk_real_int64 1109303410L);(* 9, 9 *) +(mk_real_int64 1286920999L),(mk_real_int64 1854758609L);(* 9, 9 *) +(mk_real_int64 1500538526L),(mk_real_int64 1368790297L);(* 9, 9 *) +(mk_real_int64 1546417251L),(mk_real_int64 1858786078L);(* 9, 9 *) +(mk_real_int64 1371501699L),(mk_real_int64 1694779228L);(* 9, 9 *) +(mk_real_int64 1345158461L),(mk_real_int64 1170089305L);(* 9, 9 *) +(mk_real_int64 1057215387L),(mk_real_int64 1404747446L);(* 9, 9 *) +(mk_real_int64 1511024506L),(mk_real_int64 1981890277L);(* 9, 9 *) +(mk_real_int64 1836726835L),(mk_real_int64 1582792996L);(* 9, 9 *) +(mk_real_int64 1037244003L),(mk_real_int64 1245911330L);(* 9, 9 *) +(mk_real_int64 1461871596L),(mk_real_int64 1525006515L);(* 9, 9 *) +(mk_real_int64 1009008193L),(mk_real_int64 1667089319L);(* 9, 9 *) +(mk_real_int64 1155780620L),(mk_real_int64 1250498407L);(* 9, 9 *) +(mk_real_int64 1182672599L),(mk_real_int64 1521516426L);(* 9, 9 *) +(mk_real_int64 1337639028L),(mk_real_int64 1624652776L);(* 9, 9 *) +(mk_real_int64 1537050510L),(mk_real_int64 1008389625L);(* 9, 9 *) +(mk_real_int64 1449251268L),(mk_real_int64 1773261553L);(* 9, 9 *) +(mk_real_int64 1948889675L),(mk_real_int64 1097302075L);(* 9, 9 *) +(mk_real_int64 1046365761L),(mk_real_int64 1418523536L);(* 9, 9 *) +(mk_real_int64 1636085865L),(mk_real_int64 1985440855L);(* 9, 9 *) +(mk_real_int64 1279974631L),(mk_real_int64 1035814851L);(* 9, 9 *) +(mk_real_int64 1111671240L),(mk_real_int64 1752683443L);(* 9, 9 *) +(mk_real_int64 1159463493L),(mk_real_int64 1180709901L);(* 9, 9 *) +(mk_real_int64 1512218282L),(mk_real_int64 1491319899L);(* 9, 9 *) +(mk_real_int64 1456595106L),(mk_real_int64 1274567263L);(* 9, 9 *) +(mk_real_int64 1305931159L),(mk_real_int64 1214509100L);(* 9, 9 *) +(mk_real_int64 1010303141L),(mk_real_int64 1169636560L);(* 9, 9 *) +(mk_real_int64 1071716087L),(mk_real_int64 1597853747L);(* 9, 9 *) +(mk_real_int64 1100295217L),(mk_real_int64 1619831680L);(* 9, 9 *) +(mk_real_int64 1698977988L),(mk_real_int64 1250040118L);(* 9, 9 *) +(mk_real_int64 1186117697L),(mk_real_int64 1024900824L);(* 9, 9 *) +(mk_real_int64 1521147049L),(mk_real_int64 1746848923L);(* 9, 9 *) +(mk_real_int64 1157728718L),(mk_real_int64 1336768836L);(* 9, 9 *) +(mk_real_int64 1720838037L),(mk_real_int64 1283953834L);(* 9, 9 *) +(mk_real_int64 1455857771L),(mk_real_int64 1413722431L);(* 9, 9 *) +(mk_real_int64 1935524516L),(mk_real_int64 1418203298L);(* 9, 9 *) +(mk_real_int64 1946707130L),(mk_real_int64 1051803148L);(* 9, 9 *) +(mk_real_int64 1965936698L),(mk_real_int64 1426056745L);(* 9, 9 *) +(mk_real_int64 1413335275L),(mk_real_int64 1256324749L);(* 9, 9 *) +(mk_real_int64 1507625825L),(mk_real_int64 1975070719L);(* 9, 9 *) +(mk_real_int64 1738280125L),(mk_real_int64 1691352700L);(* 9, 9 *) +(mk_real_int64 1064921319L),(mk_real_int64 1063071765L);(* 9, 9 *) +(mk_real_int64 1318721616L),(mk_real_int64 1322541409L);(* 9, 9 *) +(mk_real_int64 1998086483L),(mk_real_int64 1279614708L);(* 9, 9 *) +(mk_real_int64 1701545465L),(mk_real_int64 1351035927L);(* 9, 9 *) +(mk_real_int64 1997006857L),(mk_real_int64 1426534081L);(* 9, 9 *) +(mk_real_int64 1719545548L),(mk_real_int64 1386045746L);(* 9, 9 *) +(mk_real_int64 1799323157L),(mk_real_int64 1255073806L);(* 9, 9 *) +(mk_real_int64 1514667801L),(mk_real_int64 1364822317L);(* 9, 9 *) +(mk_real_int64 1594954725L),(mk_real_int64 1822694657L);(* 9, 9 *) +(mk_real_int64 1459871864L),(mk_real_int64 1228264447L);(* 9, 9 *) +(mk_real_int64 1035462128L),(mk_real_int64 1042872675L);(* 9, 9 *) +(mk_real_int64 1339042747L),(mk_real_int64 1887727860L);(* 9, 9 *) +(mk_real_int64 1267801969L),(mk_real_int64 1958499993L);(* 9, 9 *) +(mk_real_int64 1203699861L),(mk_real_int64 1645659342L);(* 9, 9 *) +(mk_real_int64 1184518472L),(mk_real_int64 1843970467L);(* 9, 9 *) +(mk_real_int64 1112205854L),(mk_real_int64 1723907268L);(* 9, 9 *) +(mk_real_int64 1511759993L),(mk_real_int64 1494764996L);(* 9, 9 *) +(mk_real_int64 1959979504L),(mk_real_int64 1458075284L);(* 9, 9 *) +(mk_real_int64 1428127306L),(mk_real_int64 1835187309L);(* 9, 9 *) +(mk_real_int64 1338682352L),(mk_real_int64 1441223329L);(* 9, 9 *) +(mk_real_int64 1582408369L),(mk_real_int64 1104821843L);(* 9, 9 *) +(mk_real_int64 1416715573L),(mk_real_int64 1508990434L);(* 9, 9 *) +(mk_real_int64 1698657750L),(mk_real_int64 1560661384L);(* 9, 9 *) +(mk_real_int64 1252479990L),(mk_real_int64 1710862892L);(* 9, 9 *) +(mk_real_int64 1911388944L),(mk_real_int64 1048512958L);(* 9, 9 *) +(mk_real_int64 1661370024L),(mk_real_int64 1684931168L);(* 9, 9 *) +(mk_real_int64 1515198855L),(mk_real_int64 1510015677L);(* 9, 9 *) +(mk_real_int64 1655890572L),(mk_real_int64 1022048644L);(* 9, 9 *) +(mk_real_int64 1724029017L),(mk_real_int64 1430993756L);(* 9, 9 *) +(mk_real_int64 1054739439L),(mk_real_int64 1039586490L);(* 9, 9 *) +(mk_real_int64 1075914846L),(mk_real_int64 1055886122L);(* 9, 9 *) +(mk_real_int64 1166517455L),(mk_real_int64 1153036390L);(* 9, 9 *) +(mk_real_int64 1314328226L),(mk_real_int64 1995638280L);(* 9, 9 *) +(mk_real_int64 1874285753L),(mk_real_int64 1304558160L);(* 9, 9 *) +(mk_real_int64 1295094302L),(mk_real_int64 1056592516L);(* 9, 9 *) +(mk_real_int64 1936695010L),(mk_real_int64 1759767415L);(* 9, 9 *) +(mk_real_int64 1484012304L),(mk_real_int64 1018648535L);(* 9, 9 *) +(mk_real_int64 1645856077L),(mk_real_int64 1930640284L);(* 9, 9 *) +(mk_real_int64 1626157102L),(mk_real_int64 1830052312L);(* 9, 9 *) +(mk_real_int64 1189070110L),(mk_real_int64 1707140585L);(* 9, 9 *) +(mk_real_int64 1706020002L),(mk_real_int64 1492836969L);(* 9, 9 *) +(mk_real_int64 1734270397L),(mk_real_int64 1136005514L);(* 9, 9 *) +(mk_real_int64 1182600443L),(mk_real_int64 1427274686L);(* 9, 9 *) +(mk_real_int64 1208708413L),(mk_real_int64 1001744315L);(* 9, 9 *) +(mk_real_int64 1838874424L),(mk_real_int64 1937930860L);(* 9, 9 *) +(mk_real_int64 1734046266L),(mk_real_int64 1997133550L);(* 9, 9 *) +(mk_real_int64 1780447869L),(mk_real_int64 1299095862L);(* 9, 9 *) +(mk_real_int64 1365308482L),(mk_real_int64 1526522246L);(* 9, 9 *) +(mk_real_int64 1938304388L),(mk_real_int64 1263679183L);(* 9, 9 *) +(mk_real_int64 1194662207L),(mk_real_int64 1703019469L);(* 9, 9 *) +(mk_real_int64 1686375630L),(mk_real_int64 1947921829L);(* 9, 9 *) +(mk_real_int64 1415768590L),(mk_real_int64 1854796427L);(* 9, 9 *) +(mk_real_int64 1111817947L),(mk_real_int64 1901602608L);(* 9, 9 *) +(mk_real_int64 1200918863L),(mk_real_int64 1496550320L);(* 9, 9 *) +(mk_real_int64 1864159600L),(mk_real_int64 1725250288L);(* 9, 9 *) +(mk_real_int64 1395891542L),(mk_real_int64 1893976705L);(* 9, 9 *) +(mk_real_int64 1241923645L),(mk_real_int64 1347598853L);(* 9, 9 *) +(mk_real_int64 1333566487L),(mk_real_int64 1583077877L);(* 9, 9 *) +(mk_real_int64 1321615724L),(mk_real_int64 1030511940L);(* 9, 9 *) +(mk_real_int64 1970435946L),(mk_real_int64 1887053540L);(* 9, 9 *) +(mk_real_int64 1786929867L),(mk_real_int64 1872541437L);(* 9, 9 *) +(mk_real_int64 1465683736L),(mk_real_int64 1357163441L);(* 9, 9 *) +(mk_real_int64 1322546249L),(mk_real_int64 1939561459L);(* 9, 9 *) +(mk_real_int64 1979319545L),(mk_real_int64 1184916442L);(* 9, 9 *) +(mk_real_int64 1653340052L),(mk_real_int64 1119333830L);(* 9, 9 *) +(mk_real_int64 1992335896L),(mk_real_int64 1362477918L);(* 9, 9 *) +(mk_real_int64 1635390104L),(mk_real_int64 1486050640L);(* 9, 9 *) +(mk_real_int64 1020764954L),(mk_real_int64 1758098172L);(* 9, 9 *) +(mk_real_int64 1077068379L),(mk_real_int64 1879473970L);(* 9, 9 *) +(mk_real_int64 1024187566L),(mk_real_int64 1280997834L);(* 9, 9 *) +(mk_real_int64 1226355822L),(mk_real_int64 1712158092L);(* 9, 9 *) +(mk_real_int64 1137584715L),(mk_real_int64 1113624136L);(* 9, 9 *) +(mk_real_int64 1542039317L),(mk_real_int64 1840069561L);(* 9, 9 *) +(mk_real_int64 1755209905L),(mk_real_int64 1432849016L);(* 9, 9 *) +(mk_real_int64 1965529374L),(mk_real_int64 1782230604L);(* 9, 9 *) +(mk_real_int64 1204906521L),(mk_real_int64 1907792447L);(* 9, 9 *) +(mk_real_int64 1293243236L),(mk_real_int64 1307608667L);(* 9, 9 *) +(mk_real_int64 1916089602L),(mk_real_int64 1813834193L);(* 9, 9 *) +(mk_real_int64 1482238093L),(mk_real_int64 1058605148L);(* 9, 9 *) +(mk_real_int64 1532250177L),(mk_real_int64 1172256487L);(* 9, 9 *) +(mk_real_int64 1922283062L),(mk_real_int64 1016002421L);(* 9, 9 *) +(mk_real_int64 1843210267L),(mk_real_int64 1744825769L);(* 9, 9 *) +(mk_real_int64 1732914392L),(mk_real_int64 1033413623L);(* 9, 9 *) +(mk_real_int64 1258586601L),(mk_real_int64 1755873004L);(* 9, 9 *) +(mk_real_int64 1326833898L),(mk_real_int64 1575468315L);(* 9, 9 *) +(mk_real_int64 1506009498L),(mk_real_int64 1442141754L);(* 9, 9 *) +(mk_real_int64 1006324374L),(mk_real_int64 1689438111L);(* 9, 9 *) +(mk_real_int64 1660697717L),(mk_real_int64 1074771774L);(* 9, 9 *) +(mk_real_int64 1734956722L),(mk_real_int64 1352059600L);(* 9, 9 *) +(mk_real_int64 1815124124L),(mk_real_int64 1482476688L);(* 9, 9 *) +(mk_real_int64 1184351554L),(mk_real_int64 1546470529L);(* 9, 9 *) +(mk_real_int64 1219387068L),(mk_real_int64 1871109447L);(* 9, 9 *) +(mk_real_int64 1914427308L),(mk_real_int64 1084543448L);(* 9, 9 *) +(mk_real_int64 1069234682L),(mk_real_int64 1327781437L);(* 9, 9 *) +(mk_real_int64 1569961038L),(mk_real_int64 1206930761L);(* 9, 9 *) +(mk_real_int64 1275860079L),(mk_real_int64 1018463231L);(* 9, 9 *) +(mk_real_int64 1347223792L),(mk_real_int64 1851931078L);(* 9, 9 *) +(mk_real_int64 1358714772L),(mk_real_int64 1210353401L);(* 9, 9 *) +(mk_real_int64 1868947824L),(mk_real_int64 1392758945L);(* 9, 9 *) +(mk_real_int64 1380709743L),(mk_real_int64 1508625693L);(* 9, 9 *) +(mk_real_int64 1581482960L),(mk_real_int64 1999336901L);(* 9, 9 *) +(mk_real_int64 1106015117L),(mk_real_int64 1390061059L);(* 9, 9 *) +(mk_real_int64 1276221106L),(mk_real_int64 1762764767L);(* 9, 9 *) +(mk_real_int64 1901468073L),(mk_real_int64 1603805124L);(* 9, 9 *) +(mk_real_int64 1646910949L),(mk_real_int64 1841317828L);(* 9, 9 *) +(mk_real_int64 1078877470L),(mk_real_int64 1130178492L);(* 9, 9 *) +(mk_real_int64 1243481023L),(mk_real_int64 1049773489L);(* 9, 9 *) +(mk_real_int64 1987904933L),(mk_real_int64 1375812533L);(* 9, 9 *) +(mk_real_int64 1796615353L),(mk_real_int64 1972100819L);(* 9, 9 *) +(mk_real_int64 1830398460L),(mk_real_int64 1648370943L);(* 9, 9 *) +(mk_real_int64 1964178941L),(mk_real_int64 1930805163L);(* 9, 9 *) +(mk_real_int64 1185911966L),(mk_real_int64 1119903137L);(* 9, 9 *) +(mk_real_int64 1299608235L),(mk_real_int64 1487546267L);(* 9, 9 *) +(mk_real_int64 1094917962L),(mk_real_int64 1154393295L);(* 9, 9 *) +(mk_real_int64 1330723339L),(mk_real_int64 1450344315L);(* 9, 9 *) +(mk_real_int64 1205823949L),(mk_real_int64 1342197776L);(* 9, 9 *) +(mk_real_int64 1971349856L),(mk_real_int64 1306498431L);(* 9, 9 *) +(mk_real_int64 1900993728L),(mk_real_int64 1185014653L);(* 9, 9 *) +(mk_real_int64 1440455412L),(mk_real_int64 1829326008L);(* 9, 9 *) +(mk_real_int64 1594888341L),(mk_real_int64 1151662541L);(* 9, 9 *) +(mk_real_int64 1183075375L),(mk_real_int64 1465429557L);(* 9, 9 *) +(mk_real_int64 1680870487L),(mk_real_int64 1728643210L);(* 9, 9 *) +(mk_real_int64 1128053291L),(mk_real_int64 1145681587L);(* 9, 9 *) +(mk_real_int64 1774982207L),(mk_real_int64 1297450303L);(* 9, 9 *) +(mk_real_int64 1864026145L),(mk_real_int64 1982902239L);(* 9, 9 *) +(mk_real_int64 1413738048L),(mk_real_int64 1896847004L);(* 9, 9 *) +(mk_real_int64 1562360484L),(mk_real_int64 1732338799L);(* 9, 9 *) +(mk_real_int64 1544446751L),(mk_real_int64 1650677796L);(* 9, 9 *) +(mk_real_int64 1813424935L),(mk_real_int64 1986111980L);(* 9, 9 *) +(mk_real_int64 1090452823L),(mk_real_int64 1788674839L);(* 9, 9 *) +(mk_real_int64 1667846804L),(mk_real_int64 1747074778L);(* 9, 9 *) +(mk_real_int64 1273081784L),(mk_real_int64 1196566633L);(* 9, 9 *) +(mk_real_int64 1635493878L),(mk_real_int64 1736679693L);(* 9, 9 *) +(mk_real_int64 1158828635L),(mk_real_int64 1936982592L);(* 9, 9 *) +(mk_real_int64 1148779760L),(mk_real_int64 1802890280L);(* 9, 9 *) +(mk_real_int64 1935357120L),(mk_real_int64 1967289344L);(* 9, 9 *) +(mk_real_int64 1377212478L),(mk_real_int64 1678735919L);(* 9, 9 *) +(mk_real_int64 1465295568L),(mk_real_int64 1498749383L);(* 9, 9 *) +(mk_real_int64 1249934676L),(mk_real_int64 1457268756L);(* 9, 9 *) +(mk_real_int64 1991849845L),(mk_real_int64 1153926648L);(* 9, 9 *) +(mk_real_int64 1712564059L),(mk_real_int64 1797467659L);(* 9, 9 *) +(mk_real_int64 1290367150L),(mk_real_int64 1347821100L);(* 9, 9 *) +(mk_real_int64 1036606267L),(mk_real_int64 1308976944L);(* 9, 9 *) +(mk_real_int64 1779837292L),(mk_real_int64 1239011056L);(* 9, 9 *) +(mk_real_int64 1762051679L),(mk_real_int64 1250315932L);(* 9, 9 *) +(mk_real_int64 1371589718L),(mk_real_int64 1454343431L);(* 9, 9 *) +(mk_real_int64 1738873185L),(mk_real_int64 1806213502L);(* 9, 9 *) +(mk_real_int64 1483815736L),(mk_real_int64 1436000596L);(* 9, 9 *) +(mk_real_int64 1192347772L),(mk_real_int64 1484303853L);(* 9, 9 *) +(mk_real_int64 1093149331L),(mk_real_int64 1391373597L);(* 9, 9 *) +(mk_real_int64 1986852951L),(mk_real_int64 1837999615L);(* 9, 9 *) +(mk_real_int64 1148670542L),(mk_real_int64 1061135864L);(* 9, 9 *) +(mk_real_int64 1047545118L),(mk_real_int64 1446448703L);(* 9, 9 *) +(mk_real_int64 1519634526L),(mk_real_int64 1883624565L);(* 9, 9 *) +(mk_real_int64 1267043231L),(mk_real_int64 1045697367L);(* 9, 9 *) +(mk_real_int64 1400743119L),(mk_real_int64 1356156178L);(* 9, 9 *) +(mk_real_int64 1994262134L),(mk_real_int64 1936526175L);(* 9, 9 *) +(mk_real_int64 1076110779L),(mk_real_int64 1870379145L);(* 9, 9 *) +(mk_real_int64 1456707627L),(mk_real_int64 1925260683L);(* 9, 9 *) +(mk_real_int64 1159960366L),(mk_real_int64 1326516933L);(* 9, 9 *) +(mk_real_int64 1956842401L),(mk_real_int64 1919817578L);(* 9, 9 *) +(mk_real_int64 1174930912L),(mk_real_int64 1898463828L);(* 9, 9 *) +(mk_real_int64 1431300562L),(mk_real_int64 1481013688L);(* 9, 9 *) +(mk_real_int64 1228416159L),(mk_real_int64 1570998976L);(* 9, 9 *) +(mk_real_int64 1194920182L),(mk_real_int64 1029294971L);(* 9, 9 *) +(mk_real_int64 1306401610L),(mk_real_int64 1765630823L);(* 9, 9 *) +(mk_real_int64 1364119424L),(mk_real_int64 1600476248L);(* 9, 9 *) +(mk_real_int64 1167073696L),(mk_real_int64 1874564443L);(* 9, 9 *) +(mk_real_int64 1648797116L),(mk_real_int64 1229231285L);(* 9, 9 *) +(mk_real_int64 1300275982L),(mk_real_int64 1590157563L);(* 9, 9 *) +(mk_real_int64 1789342418L),(mk_real_int64 1896212726L);(* 9, 9 *) +(mk_real_int64 1971967825L),(mk_real_int64 1716354311L);(* 9, 9 *) +(mk_real_int64 1849572812L),(mk_real_int64 1015433539L);(* 9, 9 *) +(mk_real_int64 1460081297L),(mk_real_int64 1802347009L);(* 9, 9 *) +(mk_real_int64 1730102722L),(mk_real_int64 1613436591L);(* 9, 9 *) +(mk_real_int64 1979292969L),(mk_real_int64 1267087089L);(* 9, 9 *) +(mk_real_int64 1324343486L),(mk_real_int64 1766632397L);(* 9, 9 *) +(mk_real_int64 1434531196L),(mk_real_int64 1067035372L);(* 9, 9 *) +(mk_real_int64 1663068703L),(mk_real_int64 1250206714L);(* 9, 9 *) +(mk_real_int64 1629835301L),(mk_real_int64 1566531429L);(* 9, 9 *) +(mk_real_int64 1218032544L),(mk_real_int64 1948635550L);(* 9, 9 *) +(mk_real_int64 1688704383L),(mk_real_int64 1237748259L);(* 9, 9 *) +(mk_real_int64 1739295756L),(mk_real_int64 1635112296L);(* 9, 9 *) +(mk_real_int64 1992036754L),(mk_real_int64 1393785886L);(* 9, 9 *) +(mk_real_int64 1769452478L),(mk_real_int64 1201546336L);(* 9, 9 *) +(mk_real_int64 1221582029L),(mk_real_int64 1227476341L);(* 9, 9 *) +(mk_real_int64 1624984701L),(mk_real_int64 1569802802L);(* 9, 9 *) +(mk_real_int64 1537174515L),(mk_real_int64 1060629675L);(* 9, 9 *) +(mk_real_int64 1947849753L),(mk_real_int64 1458576600L);(* 9, 9 *) +(mk_real_int64 1048891015L),(mk_real_int64 1415867023L);(* 9, 9 *) +(mk_real_int64 1020932391L),(mk_real_int64 1426069149L);(* 9, 9 *) +(mk_real_int64 1840896253L),(mk_real_int64 1581483591L);(* 9, 9 *) +(mk_real_int64 1050002002L),(mk_real_int64 1039314521L);(* 9, 9 *) +(mk_real_int64 1441287336L),(mk_real_int64 1597487027L);(* 9, 9 *) +(mk_real_int64 1165945051L),(mk_real_int64 1100038324L);(* 9, 9 *) +(mk_real_int64 1211495740L),(mk_real_int64 1398590402L);(* 9, 9 *) +(mk_real_int64 1599395984L),(mk_real_int64 1733744553L);(* 9, 9 *) +(mk_real_int64 1372125019L),(mk_real_int64 1840706868L);(* 9, 9 *) +(mk_real_int64 1207508342L),(mk_real_int64 1734219566L);(* 9, 9 *) +(mk_real_int64 1977058554L),(mk_real_int64 1214460516L);(* 9, 9 *) +(mk_real_int64 1023396784L),(mk_real_int64 1066295410L);(* 9, 9 *) +(mk_real_int64 1032894530L),(mk_real_int64 1528556386L);(* 9, 9 *) +(mk_real_int64 1391854562L),(mk_real_int64 1751816627L);(* 9, 9 *) +(mk_real_int64 1642102387L),(mk_real_int64 1754540684L);(* 9, 9 *) +(mk_real_int64 1229457881L),(mk_real_int64 1373901521L);(* 9, 9 *) +(mk_real_int64 1119185619L),(mk_real_int64 1204492102L);(* 9, 9 *) +(mk_real_int64 1201315698L),(mk_real_int64 1213968278L);(* 9, 9 *) +(mk_real_int64 1545599037L),(mk_real_int64 1791963394L);(* 9, 9 *) +(mk_real_int64 1107739296L),(mk_real_int64 1107220792L);(* 9, 9 *) +(mk_real_int64 1187746256L),(mk_real_int64 1699981234L);(* 9, 9 *) +(mk_real_int64 1193824959L),(mk_real_int64 1394549727L);(* 9, 9 *) +(mk_real_int64 1227840834L),(mk_real_int64 1669414154L);(* 9, 9 *) +(mk_real_int64 1990050595L),(mk_real_int64 1822991626L);(* 9, 9 *) +(mk_real_int64 1628080357L),(mk_real_int64 1891240148L);(* 9, 9 *) +(mk_real_int64 1197677783L),(mk_real_int64 1696467647L);(* 9, 9 *) +(mk_real_int64 1853121332L),(mk_real_int64 1213630186L);(* 9, 9 *) +(mk_real_int64 1481518045L),(mk_real_int64 1834430499L);(* 9, 9 *) +(mk_real_int64 1392470238L),(mk_real_int64 1954636981L);(* 9, 9 *) +(mk_real_int64 1393174619L),(mk_real_int64 1312339867L);(* 9, 9 *) +(mk_real_int64 1189629029L),(mk_real_int64 1298185375L);(* 9, 9 *) +(mk_real_int64 1397212134L),(mk_real_int64 1686746652L);(* 9, 9 *) +(mk_real_int64 1368029145L),(mk_real_int64 1792043530L);(* 9, 9 *) +(mk_real_int64 1980852705L),(mk_real_int64 1007003637L);(* 9, 9 *) +(mk_real_int64 1197274704L),(mk_real_int64 1385427705L);(* 9, 9 *) +(mk_real_int64 1188145515L),(mk_real_int64 1580161624L);(* 9, 9 *) +(mk_real_int64 1732967571L),(mk_real_int64 1100287550L);(* 9, 9 *) +(mk_real_int64 1546473309L),(mk_real_int64 1277077320L);(* 9, 9 *) +(mk_real_int64 1020635556L),(mk_real_int64 1628847057L);(* 9, 9 *) +(mk_real_int64 1838454575L),(mk_real_int64 1363480376L);(* 9, 9 *) +(mk_real_int64 1538505790L),(mk_real_int64 1568862935L);(* 9, 9 *) +(mk_real_int64 1123736269L),(mk_real_int64 1750862239L);(* 9, 9 *) +(mk_real_int64 1556862900L),(mk_real_int64 1532990234L);(* 9, 9 *) +(mk_real_int64 1520780188L),(mk_real_int64 1905555432L);(* 9, 9 *) +(mk_real_int64 1722974056L),(mk_real_int64 1366885198L);(* 9, 9 *) +(mk_real_int64 1821498040L),(mk_real_int64 1590962056L);(* 9, 9 *) +(mk_real_int64 1398788775L),(mk_real_int64 1795399428L);(* 9, 9 *) +(mk_real_int64 1917591763L),(mk_real_int64 1889560881L);(* 9, 9 *) +(mk_real_int64 1302769100L),(mk_real_int64 1507078306L);(* 9, 9 *) +(mk_real_int64 1026520581L),(mk_real_int64 1435797304L);(* 9, 9 *) +(mk_real_int64 1688561448L),(mk_real_int64 1983046957L);(* 9, 9 *) +(mk_real_int64 1625716922L),(mk_real_int64 1242652651L);(* 9, 9 *) +(mk_real_int64 1703094632L),(mk_real_int64 1617516159L);(* 9, 9 *) +(mk_real_int64 1963500075L),(mk_real_int64 1752833781L);(* 9, 9 *) +(mk_real_int64 1667156877L),(mk_real_int64 1204440725L);(* 9, 9 *) +(mk_real_int64 1813794942L),(mk_real_int64 1763623180L);(* 9, 9 *) +(mk_real_int64 1116182405L),(mk_real_int64 1029694242L);(* 9, 9 *) +(mk_real_int64 1773834077L),(mk_real_int64 1620766093L);(* 9, 9 *) +(mk_real_int64 1174449105L),(mk_real_int64 1646349895L);(* 9, 9 *) +(mk_real_int64 1129883752L),(mk_real_int64 1835038911L);(* 9, 9 *) +(mk_real_int64 1271263342L),(mk_real_int64 1075297273L);(* 9, 9 *) +(mk_real_int64 1284029581L),(mk_real_int64 1830389505L);(* 9, 9 *) +(mk_real_int64 1563929665L),(mk_real_int64 1597183459L);(* 9, 9 *) +(mk_real_int64 1181372848L),(mk_real_int64 1937568142L);(* 9, 9 *) +(mk_real_int64 1182695787L),(mk_real_int64 1656912428L);(* 9, 9 *) +(mk_real_int64 1974308219L),(mk_real_int64 1513557249L);(* 9, 9 *) +(mk_real_int64 1602326475L),(mk_real_int64 1402657271L);(* 9, 9 *) +(mk_real_int64 1674918928L),(mk_real_int64 1555458832L);(* 9, 9 *) +(mk_real_int64 1943146012L),(mk_real_int64 1881083617L);(* 9, 9 *) +(mk_real_int64 1047767606L),(mk_real_int64 1939346740L);(* 9, 9 *) +(mk_real_int64 1569490158L),(mk_real_int64 1767946407L);(* 9, 9 *) +(mk_real_int64 1238398554L),(mk_real_int64 1518533331L);(* 9, 9 *) +(mk_real_int64 1553090256L),(mk_real_int64 1057874859L);(* 9, 9 *) +(mk_real_int64 1474779650L),(mk_real_int64 1369094533L);(* 9, 9 *) +(mk_real_int64 1021565351L),(mk_real_int64 1296825669L);(* 9, 9 *) +(mk_real_int64 1715111776L),(mk_real_int64 1656419205L);(* 9, 9 *) +(mk_real_int64 1377194554L),(mk_real_int64 1191481670L);(* 9, 9 *) +(mk_real_int64 1164533962L),(mk_real_int64 1613264175L);(* 9, 9 *) +(mk_real_int64 1699017376L),(mk_real_int64 1795327417L);(* 9, 9 *) +(mk_real_int64 1678722986L),(mk_real_int64 1105911173L);(* 9, 9 *) +(mk_real_int64 1436143310L),(mk_real_int64 1025931932L);(* 9, 9 *) +(mk_real_int64 1570137994L),(mk_real_int64 1010244449L);(* 9, 9 *) +(mk_real_int64 1230132505L),(mk_real_int64 1300237692L);(* 9, 9 *) +(mk_real_int64 1161296704L),(mk_real_int64 1713525134L);(* 9, 9 *) +(mk_real_int64 1354775314L),(mk_real_int64 1218375244L);(* 9, 9 *) +(mk_real_int64 1677620081L),(mk_real_int64 1293365487L);(* 9, 9 *) +(mk_real_int64 1598582288L),(mk_real_int64 1190537011L);(* 9, 9 *) +(mk_real_int64 1265548752L),(mk_real_int64 1503316934L);(* 9, 9 *) +(mk_real_int64 1836898718L),(mk_real_int64 1765496250L);(* 9, 9 *) +(mk_real_int64 1277299248L),(mk_real_int64 1506054806L);(* 9, 9 *) +(mk_real_int64 1122403808L),(mk_real_int64 1812278315L);(* 9, 9 *) +(mk_real_int64 1916002791L),(mk_real_int64 1885870118L);(* 9, 9 *) +(mk_real_int64 1941800652L),(mk_real_int64 1317889014L);(* 9, 9 *) +(mk_real_int64 1136362695L),(mk_real_int64 1410844804L);(* 9, 9 *) +(mk_real_int64 1238123309L),(mk_real_int64 1061654752L);(* 9, 9 *) +(mk_real_int64 1856441456L),(mk_real_int64 1147818595L);(* 9, 9 *) +(mk_real_int64 1202360631L),(mk_real_int64 1941856433L);(* 9, 9 *) +(mk_real_int64 1503203430L),(mk_real_int64 1543558225L);(* 9, 9 *) +(mk_real_int64 1197808412L),(mk_real_int64 1228154105L);(* 9, 9 *) +(mk_real_int64 1288400825L),(mk_real_int64 1252852563L)(* 9, 9 *) +];; diff --git a/formal_lp/old/arith/tests/arith_test_data15.hl b/formal_lp/old/arith/tests/arith_test_data15.hl new file mode 100644 index 0000000..6317713 --- /dev/null +++ b/formal_lp/old/arith/tests/arith_test_data15.hl @@ -0,0 +1,1002 @@ +let data = [ +(mk_real_int64 702941795326221L),(mk_real_int64 587475864851776L);(* 14, 14 *) +(mk_real_int64 557681790741140L),(mk_real_int64 431609991799574L);(* 14, 14 *) +(mk_real_int64 428657639559786L),(mk_real_int64 365457651324725L);(* 14, 14 *) +(mk_real_int64 804672350225920L),(mk_real_int64 164799879070188L);(* 14, 14 *) +(mk_real_int64 690700943383416L),(mk_real_int64 450621203384716L);(* 14, 14 *) +(mk_real_int64 902567172378080L),(mk_real_int64 208922254068150L);(* 14, 14 *) +(mk_real_int64 805104422742681L),(mk_real_int64 572429814888816L);(* 14, 14 *) +(mk_real_int64 270459131819466L),(mk_real_int64 304148661952170L);(* 14, 14 *) +(mk_real_int64 463191535210470L),(mk_real_int64 805728111094115L);(* 14, 14 *) +(mk_real_int64 244467228142752L),(mk_real_int64 667000318316892L);(* 14, 14 *) +(mk_real_int64 222131484494596L),(mk_real_int64 359290324562560L);(* 14, 14 *) +(mk_real_int64 447908652928800L),(mk_real_int64 507708675244619L);(* 14, 14 *) +(mk_real_int64 302795068486160L),(mk_real_int64 473247248215110L);(* 14, 14 *) +(mk_real_int64 288273096314095L),(mk_real_int64 671484270634352L);(* 14, 14 *) +(mk_real_int64 809186366965808L),(mk_real_int64 645392591505409L);(* 14, 14 *) +(mk_real_int64 744422670553440L),(mk_real_int64 558730890514225L);(* 14, 14 *) +(mk_real_int64 182607355397331L),(mk_real_int64 657560460440954L);(* 14, 14 *) +(mk_real_int64 913387107541545L),(mk_real_int64 356668474352544L);(* 14, 14 *) +(mk_real_int64 700179795938260L),(mk_real_int64 241404815137642L);(* 14, 14 *) +(mk_real_int64 259727217701130L),(mk_real_int64 794044510790370L);(* 14, 14 *) +(mk_real_int64 376141263117354L),(mk_real_int64 339961632304200L);(* 14, 14 *) +(mk_real_int64 724223950704660L),(mk_real_int64 622132223304621L);(* 14, 14 *) +(mk_real_int64 852003110535472L),(mk_real_int64 384658775936028L);(* 14, 14 *) +(mk_real_int64 354862272152465L),(mk_real_int64 357110480531104L);(* 14, 14 *) +(mk_real_int64 318147969036604L),(mk_real_int64 155757341270475L);(* 14, 14 *) +(mk_real_int64 572122276941163L),(mk_real_int64 797515640627430L);(* 14, 14 *) +(mk_real_int64 154631673126928L),(mk_real_int64 887284587732912L);(* 14, 14 *) +(mk_real_int64 267953256539136L),(mk_real_int64 156206936375520L);(* 14, 14 *) +(mk_real_int64 476924059192500L),(mk_real_int64 310967383408374L);(* 14, 14 *) +(mk_real_int64 319016288248101L),(mk_real_int64 545169027562368L);(* 14, 14 *) +(mk_real_int64 442430147544021L),(mk_real_int64 170012585320383L);(* 14, 14 *) +(mk_real_int64 619589298196320L),(mk_real_int64 844856475393980L);(* 14, 14 *) +(mk_real_int64 294253361839890L),(mk_real_int64 460826851897130L);(* 14, 14 *) +(mk_real_int64 325033246271111L),(mk_real_int64 315444072925107L);(* 14, 14 *) +(mk_real_int64 261568757276544L),(mk_real_int64 640312364909246L);(* 14, 14 *) +(mk_real_int64 213476297484455L),(mk_real_int64 734418513415860L);(* 14, 14 *) +(mk_real_int64 604243569249650L),(mk_real_int64 600235895745256L);(* 14, 14 *) +(mk_real_int64 403014557725500L),(mk_real_int64 237260728296735L);(* 14, 14 *) +(mk_real_int64 250386269932208L),(mk_real_int64 322323328798161L);(* 14, 14 *) +(mk_real_int64 660366167449224L),(mk_real_int64 480690479307252L);(* 14, 14 *) +(mk_real_int64 601255265294824L),(mk_real_int64 174918668116752L);(* 14, 14 *) +(mk_real_int64 598790140086569L),(mk_real_int64 527485861651776L);(* 14, 14 *) +(mk_real_int64 369044774046672L),(mk_real_int64 250876047027450L);(* 14, 14 *) +(mk_real_int64 273385871939502L),(mk_real_int64 190834559174125L);(* 14, 14 *) +(mk_real_int64 342940661716120L),(mk_real_int64 322729150591719L);(* 14, 14 *) +(mk_real_int64 434881094309112L),(mk_real_int64 251436596098506L);(* 14, 14 *) +(mk_real_int64 581329952031192L),(mk_real_int64 499504426524070L);(* 14, 14 *) +(mk_real_int64 720490783645215L),(mk_real_int64 214896131146252L);(* 14, 14 *) +(mk_real_int64 804335550437760L),(mk_real_int64 364661953912662L);(* 14, 14 *) +(mk_real_int64 645439815446745L),(mk_real_int64 966046385975926L);(* 14, 14 *) +(mk_real_int64 576000838272411L),(mk_real_int64 193943358331632L);(* 14, 14 *) +(mk_real_int64 779551175501802L),(mk_real_int64 472071958808208L);(* 14, 14 *) +(mk_real_int64 153329179657797L),(mk_real_int64 750271198524640L);(* 14, 14 *) +(mk_real_int64 334792895382176L),(mk_real_int64 397325753023975L);(* 14, 14 *) +(mk_real_int64 248363686553556L),(mk_real_int64 542005513043540L);(* 14, 14 *) +(mk_real_int64 366789640924804L),(mk_real_int64 584124651722202L);(* 14, 14 *) +(mk_real_int64 186287533864404L),(mk_real_int64 461681196343836L);(* 14, 14 *) +(mk_real_int64 616778033652710L),(mk_real_int64 382444819990412L);(* 14, 14 *) +(mk_real_int64 225596890128104L),(mk_real_int64 670724383606394L);(* 14, 14 *) +(mk_real_int64 339908258377764L),(mk_real_int64 405505469971976L);(* 14, 14 *) +(mk_real_int64 428370319478712L),(mk_real_int64 200996725344373L);(* 14, 14 *) +(mk_real_int64 323014944067595L),(mk_real_int64 802180352622636L);(* 14, 14 *) +(mk_real_int64 136410553525698L),(mk_real_int64 171519957847992L);(* 14, 14 *) +(mk_real_int64 755378179208730L),(mk_real_int64 393461749199548L);(* 14, 14 *) +(mk_real_int64 684050481212478L),(mk_real_int64 551076901488000L);(* 14, 14 *) +(mk_real_int64 609729761645697L),(mk_real_int64 541811233513341L);(* 14, 14 *) +(mk_real_int64 362945078194498L),(mk_real_int64 638117671427124L);(* 14, 14 *) +(mk_real_int64 271626924366687L),(mk_real_int64 562379720565696L);(* 14, 14 *) +(mk_real_int64 628681413918503L),(mk_real_int64 290443445260440L);(* 14, 14 *) +(mk_real_int64 369612864115468L),(mk_real_int64 392004698904540L);(* 14, 14 *) +(mk_real_int64 773812084651807L),(mk_real_int64 408087711517040L);(* 14, 14 *) +(mk_real_int64 565364999209028L),(mk_real_int64 254549586225772L);(* 14, 14 *) +(mk_real_int64 369070953701116L),(mk_real_int64 310615753918140L);(* 14, 14 *) +(mk_real_int64 843847343488960L),(mk_real_int64 343069567108764L);(* 14, 14 *) +(mk_real_int64 434618877871152L),(mk_real_int64 209481069955696L);(* 14, 14 *) +(mk_real_int64 628233275793400L),(mk_real_int64 442326067536087L);(* 14, 14 *) +(mk_real_int64 162718822961304L),(mk_real_int64 638554322626425L);(* 14, 14 *) +(mk_real_int64 556627522455486L),(mk_real_int64 180777466429038L);(* 14, 14 *) +(mk_real_int64 780585292039465L),(mk_real_int64 217142256943520L);(* 14, 14 *) +(mk_real_int64 394688199427381L),(mk_real_int64 538577941316352L);(* 14, 14 *) +(mk_real_int64 132085440106110L),(mk_real_int64 351777186362208L);(* 14, 14 *) +(mk_real_int64 555631801860552L),(mk_real_int64 574384162934925L);(* 14, 14 *) +(mk_real_int64 933147773762346L),(mk_real_int64 529778910083616L);(* 14, 14 *) +(mk_real_int64 829999592257460L),(mk_real_int64 355692692428580L);(* 14, 14 *) +(mk_real_int64 415102133340375L),(mk_real_int64 334405961088486L);(* 14, 14 *) +(mk_real_int64 483708974303577L),(mk_real_int64 786205272080510L);(* 14, 14 *) +(mk_real_int64 711860919923023L),(mk_real_int64 307976528266407L);(* 14, 14 *) +(mk_real_int64 273921420533046L),(mk_real_int64 834166782560034L);(* 14, 14 *) +(mk_real_int64 729230212944502L),(mk_real_int64 387986583219456L);(* 14, 14 *) +(mk_real_int64 262283189492104L),(mk_real_int64 271577027329725L);(* 14, 14 *) +(mk_real_int64 748320579670056L),(mk_real_int64 387837325862055L);(* 14, 14 *) +(mk_real_int64 259574359587584L),(mk_real_int64 252268784271024L);(* 14, 14 *) +(mk_real_int64 529629469693475L),(mk_real_int64 698244387448599L);(* 14, 14 *) +(mk_real_int64 467969089544880L),(mk_real_int64 417877847845446L);(* 14, 14 *) +(mk_real_int64 521134107523944L),(mk_real_int64 538428518195560L);(* 14, 14 *) +(mk_real_int64 145508463152400L),(mk_real_int64 238249527243963L);(* 14, 14 *) +(mk_real_int64 462229618103296L),(mk_real_int64 117753449871512L);(* 14, 14 *) +(mk_real_int64 673175608756080L),(mk_real_int64 298509199253454L);(* 14, 14 *) +(mk_real_int64 457904017658778L),(mk_real_int64 501294611820290L);(* 14, 14 *) +(mk_real_int64 298454241997198L),(mk_real_int64 185361038600271L);(* 14, 14 *) +(mk_real_int64 462002361828392L),(mk_real_int64 681368380154709L);(* 14, 14 *) +(mk_real_int64 144783148181035L),(mk_real_int64 296957261215536L);(* 14, 14 *) +(mk_real_int64 509181522064462L),(mk_real_int64 361478003577652L);(* 14, 14 *) +(mk_real_int64 252781905558039L),(mk_real_int64 183649445379505L);(* 14, 14 *) +(mk_real_int64 381261992115303L),(mk_real_int64 681558069096648L);(* 14, 14 *) +(mk_real_int64 486767414899650L),(mk_real_int64 125978964147625L);(* 14, 14 *) +(mk_real_int64 675595169265050L),(mk_real_int64 515434028588322L);(* 14, 14 *) +(mk_real_int64 637143840347950L),(mk_real_int64 415900907551070L);(* 14, 14 *) +(mk_real_int64 812253320086096L),(mk_real_int64 468701861485150L);(* 14, 14 *) +(mk_real_int64 822222199619600L),(mk_real_int64 412038121629696L);(* 14, 14 *) +(mk_real_int64 636953290225000L),(mk_real_int64 172669555938750L);(* 14, 14 *) +(mk_real_int64 534768049107240L),(mk_real_int64 677432489728568L);(* 14, 14 *) +(mk_real_int64 235415145947312L),(mk_real_int64 819676510474176L);(* 14, 14 *) +(mk_real_int64 684023252882046L),(mk_real_int64 200398986010272L);(* 14, 14 *) +(mk_real_int64 240317062183068L),(mk_real_int64 765007899782938L);(* 14, 14 *) +(mk_real_int64 725138825407488L),(mk_real_int64 636606741195216L);(* 14, 14 *) +(mk_real_int64 461888666812328L),(mk_real_int64 300659646917376L);(* 14, 14 *) +(mk_real_int64 348969015873514L),(mk_real_int64 329003280879910L);(* 14, 14 *) +(mk_real_int64 717253452670330L),(mk_real_int64 468942198628055L);(* 14, 14 *) +(mk_real_int64 199176173959870L),(mk_real_int64 333318394782932L);(* 14, 14 *) +(mk_real_int64 691427595574564L),(mk_real_int64 762813696952134L);(* 14, 14 *) +(mk_real_int64 399650967537282L),(mk_real_int64 515666816995950L);(* 14, 14 *) +(mk_real_int64 584619907378980L),(mk_real_int64 215216842431210L);(* 14, 14 *) +(mk_real_int64 536423826564339L),(mk_real_int64 376626025721715L);(* 14, 14 *) +(mk_real_int64 440728276506792L),(mk_real_int64 664195476119130L);(* 14, 14 *) +(mk_real_int64 615611480344490L),(mk_real_int64 327888426524672L);(* 14, 14 *) +(mk_real_int64 209640501275520L),(mk_real_int64 132166263337640L);(* 14, 14 *) +(mk_real_int64 558237992229038L),(mk_real_int64 412751392690728L);(* 14, 14 *) +(mk_real_int64 785490342963948L),(mk_real_int64 806368903933776L);(* 14, 14 *) +(mk_real_int64 642596512049120L),(mk_real_int64 741244819991000L);(* 14, 14 *) +(mk_real_int64 580226064753600L),(mk_real_int64 383907999627822L);(* 14, 14 *) +(mk_real_int64 276707760318400L),(mk_real_int64 549973348743588L);(* 14, 14 *) +(mk_real_int64 319275679911897L),(mk_real_int64 505527729671400L);(* 14, 14 *) +(mk_real_int64 464996107696136L),(mk_real_int64 579515788972614L);(* 14, 14 *) +(mk_real_int64 401725951162200L),(mk_real_int64 210061067264830L);(* 14, 14 *) +(mk_real_int64 652094227735297L),(mk_real_int64 433523184430465L);(* 14, 14 *) +(mk_real_int64 324568750483855L),(mk_real_int64 292423870305900L);(* 14, 14 *) +(mk_real_int64 524145900463738L),(mk_real_int64 386996916791660L);(* 14, 14 *) +(mk_real_int64 308993200647930L),(mk_real_int64 881687092434610L);(* 14, 14 *) +(mk_real_int64 478219999325865L),(mk_real_int64 896883424272412L);(* 14, 14 *) +(mk_real_int64 319397368414410L),(mk_real_int64 496241394700596L);(* 14, 14 *) +(mk_real_int64 452205750244860L),(mk_real_int64 373524558180264L);(* 14, 14 *) +(mk_real_int64 496532935594288L),(mk_real_int64 358147638142056L);(* 14, 14 *) +(mk_real_int64 147216537711029L),(mk_real_int64 233486842289280L);(* 14, 14 *) +(mk_real_int64 396831824282848L),(mk_real_int64 539349465184365L);(* 14, 14 *) +(mk_real_int64 723656692628776L),(mk_real_int64 786215585628618L);(* 14, 14 *) +(mk_real_int64 119394463335256L),(mk_real_int64 825713240570278L);(* 14, 14 *) +(mk_real_int64 326362496734770L),(mk_real_int64 360753474294437L);(* 14, 14 *) +(mk_real_int64 340052639982900L),(mk_real_int64 356041565761595L);(* 14, 14 *) +(mk_real_int64 335249974420020L),(mk_real_int64 335028810981410L);(* 14, 14 *) +(mk_real_int64 198442167102360L),(mk_real_int64 553776823015345L);(* 14, 14 *) +(mk_real_int64 540460291862520L),(mk_real_int64 377209737210504L);(* 14, 14 *) +(mk_real_int64 617018054416116L),(mk_real_int64 199298486037322L);(* 14, 14 *) +(mk_real_int64 175105737246000L),(mk_real_int64 349641711638247L);(* 14, 14 *) +(mk_real_int64 528678417495746L),(mk_real_int64 204389631628872L);(* 14, 14 *) +(mk_real_int64 280392429043442L),(mk_real_int64 813770888392000L);(* 14, 14 *) +(mk_real_int64 196258862678092L),(mk_real_int64 566453035021239L);(* 14, 14 *) +(mk_real_int64 506041985601164L),(mk_real_int64 349764767744898L);(* 14, 14 *) +(mk_real_int64 655798802064208L),(mk_real_int64 782963275501160L);(* 14, 14 *) +(mk_real_int64 555522682226915L),(mk_real_int64 662518802409450L);(* 14, 14 *) +(mk_real_int64 495712725106190L),(mk_real_int64 239941356168561L);(* 14, 14 *) +(mk_real_int64 949445981245198L),(mk_real_int64 527008708559196L);(* 14, 14 *) +(mk_real_int64 555249091031480L),(mk_real_int64 143395360604720L);(* 14, 14 *) +(mk_real_int64 713544877485336L),(mk_real_int64 256168557082752L);(* 14, 14 *) +(mk_real_int64 467231941918730L),(mk_real_int64 633877701237600L);(* 14, 14 *) +(mk_real_int64 270119092698672L),(mk_real_int64 200700498213611L);(* 14, 14 *) +(mk_real_int64 340191736121016L),(mk_real_int64 349466807332237L);(* 14, 14 *) +(mk_real_int64 417066812290821L),(mk_real_int64 618037866309760L);(* 14, 14 *) +(mk_real_int64 191634817098459L),(mk_real_int64 195328792461944L);(* 14, 14 *) +(mk_real_int64 458368556437692L),(mk_real_int64 276657680509798L);(* 14, 14 *) +(mk_real_int64 270484694390981L),(mk_real_int64 185838698248920L);(* 14, 14 *) +(mk_real_int64 423290078720027L),(mk_real_int64 558366569976510L);(* 14, 14 *) +(mk_real_int64 441459494248410L),(mk_real_int64 210934384721119L);(* 14, 14 *) +(mk_real_int64 334405914589968L),(mk_real_int64 237655814054880L);(* 14, 14 *) +(mk_real_int64 642586851795798L),(mk_real_int64 624579346128006L);(* 14, 14 *) +(mk_real_int64 744219044666464L),(mk_real_int64 302145247152084L);(* 14, 14 *) +(mk_real_int64 407533481554356L),(mk_real_int64 640355645688256L);(* 14, 14 *) +(mk_real_int64 200535624042650L),(mk_real_int64 861581837619072L);(* 14, 14 *) +(mk_real_int64 470765587636264L),(mk_real_int64 291762483604876L);(* 14, 14 *) +(mk_real_int64 297694007494552L),(mk_real_int64 312850660690590L);(* 14, 14 *) +(mk_real_int64 394323002617581L),(mk_real_int64 663902157462544L);(* 14, 14 *) +(mk_real_int64 476802838904832L),(mk_real_int64 672875755825938L);(* 14, 14 *) +(mk_real_int64 546625114912338L),(mk_real_int64 564423049949520L);(* 14, 14 *) +(mk_real_int64 400627677455460L),(mk_real_int64 500915717800671L);(* 14, 14 *) +(mk_real_int64 629695821813506L),(mk_real_int64 485679623259186L);(* 14, 14 *) +(mk_real_int64 305527027108815L),(mk_real_int64 164503455378368L);(* 14, 14 *) +(mk_real_int64 394997058713510L),(mk_real_int64 527758662637920L);(* 14, 14 *) +(mk_real_int64 275767869678348L),(mk_real_int64 234003021915552L);(* 14, 14 *) +(mk_real_int64 242056825321344L),(mk_real_int64 652688073050535L);(* 14, 14 *) +(mk_real_int64 444414020817650L),(mk_real_int64 414154328932084L);(* 14, 14 *) +(mk_real_int64 209494746669120L),(mk_real_int64 308600174486422L);(* 14, 14 *) +(mk_real_int64 501532898275305L),(mk_real_int64 498395262003840L);(* 14, 14 *) +(mk_real_int64 498864301758304L),(mk_real_int64 681115649847150L);(* 14, 14 *) +(mk_real_int64 260043309321028L),(mk_real_int64 538129203997686L);(* 14, 14 *) +(mk_real_int64 395163479535144L),(mk_real_int64 416814290794335L);(* 14, 14 *) +(mk_real_int64 327191842372185L),(mk_real_int64 224622269666479L);(* 14, 14 *) +(mk_real_int64 169221002391336L),(mk_real_int64 502784361254590L);(* 14, 14 *) +(mk_real_int64 790543963829457L),(mk_real_int64 342054121502720L);(* 14, 14 *) +(mk_real_int64 218257712167675L),(mk_real_int64 322079271090808L);(* 14, 14 *) +(mk_real_int64 857438425700448L),(mk_real_int64 362981450501558L);(* 14, 14 *) +(mk_real_int64 177965860744700L),(mk_real_int64 397644092902404L);(* 14, 14 *) +(mk_real_int64 740166918080505L),(mk_real_int64 539751051095536L);(* 14, 14 *) +(mk_real_int64 281843150621022L),(mk_real_int64 751637415644416L);(* 14, 14 *) +(mk_real_int64 559652596638696L),(mk_real_int64 147575048807604L);(* 14, 14 *) +(mk_real_int64 384944994467998L),(mk_real_int64 808019044103479L);(* 14, 14 *) +(mk_real_int64 548600719167896L),(mk_real_int64 341385839953230L);(* 14, 14 *) +(mk_real_int64 600673210227680L),(mk_real_int64 158061600512010L);(* 14, 14 *) +(mk_real_int64 576544880969028L),(mk_real_int64 414105666520968L);(* 14, 14 *) +(mk_real_int64 362835843555383L),(mk_real_int64 190564773269344L);(* 14, 14 *) +(mk_real_int64 777882158637216L),(mk_real_int64 330721899229040L);(* 14, 14 *) +(mk_real_int64 379396495399068L),(mk_real_int64 273051307857216L);(* 14, 14 *) +(mk_real_int64 404197248976950L),(mk_real_int64 256205529026988L);(* 14, 14 *) +(mk_real_int64 250687800785475L),(mk_real_int64 521917918571340L);(* 14, 14 *) +(mk_real_int64 706078002255360L),(mk_real_int64 118152214795063L);(* 14, 14 *) +(mk_real_int64 669115406447442L),(mk_real_int64 188055865373175L);(* 14, 14 *) +(mk_real_int64 228130771126770L),(mk_real_int64 476101650918961L);(* 14, 14 *) +(mk_real_int64 322669556969264L),(mk_real_int64 464223635275414L);(* 14, 14 *) +(mk_real_int64 241911411325731L),(mk_real_int64 424788294384629L);(* 14, 14 *) +(mk_real_int64 271930275661600L),(mk_real_int64 325877156885715L);(* 14, 14 *) +(mk_real_int64 184872188619888L),(mk_real_int64 607784075874201L);(* 14, 14 *) +(mk_real_int64 233113628329417L),(mk_real_int64 440700726437550L);(* 14, 14 *) +(mk_real_int64 589524793880772L),(mk_real_int64 327910083154415L);(* 14, 14 *) +(mk_real_int64 319816043947344L),(mk_real_int64 328682225331600L);(* 14, 14 *) +(mk_real_int64 216114582970244L),(mk_real_int64 527890798290961L);(* 14, 14 *) +(mk_real_int64 251239147254088L),(mk_real_int64 294354684052551L);(* 14, 14 *) +(mk_real_int64 333003922482888L),(mk_real_int64 266705541890616L);(* 14, 14 *) +(mk_real_int64 393522825190706L),(mk_real_int64 442847484547072L);(* 14, 14 *) +(mk_real_int64 369521962372986L),(mk_real_int64 280063338470824L);(* 14, 14 *) +(mk_real_int64 801756162834120L),(mk_real_int64 515640473908950L);(* 14, 14 *) +(mk_real_int64 564901775975198L),(mk_real_int64 338684427678432L);(* 14, 14 *) +(mk_real_int64 580317241750680L),(mk_real_int64 295865702326716L);(* 14, 14 *) +(mk_real_int64 296419888316025L),(mk_real_int64 530374441251655L);(* 14, 14 *) +(mk_real_int64 135041450276581L),(mk_real_int64 694004195994620L);(* 14, 14 *) +(mk_real_int64 344660126730843L),(mk_real_int64 471224502771876L);(* 14, 14 *) +(mk_real_int64 324528723453942L),(mk_real_int64 148271593003164L);(* 14, 14 *) +(mk_real_int64 274238571381768L),(mk_real_int64 456761984781798L);(* 14, 14 *) +(mk_real_int64 440150781069404L),(mk_real_int64 165535748272296L);(* 14, 14 *) +(mk_real_int64 775477720878770L),(mk_real_int64 735322939451527L);(* 14, 14 *) +(mk_real_int64 162143883456272L),(mk_real_int64 229928260815033L);(* 14, 14 *) +(mk_real_int64 258521503478406L),(mk_real_int64 210092056448400L);(* 14, 14 *) +(mk_real_int64 320027427319587L),(mk_real_int64 125234314739025L);(* 14, 14 *) +(mk_real_int64 235014928587008L),(mk_real_int64 199506949581375L);(* 14, 14 *) +(mk_real_int64 296492812021440L),(mk_real_int64 457097533597506L);(* 14, 14 *) +(mk_real_int64 229763219483676L),(mk_real_int64 305184305616176L);(* 14, 14 *) +(mk_real_int64 312660180536166L),(mk_real_int64 462797655770880L);(* 14, 14 *) +(mk_real_int64 438646643738472L),(mk_real_int64 214203831432500L);(* 14, 14 *) +(mk_real_int64 416290078764574L),(mk_real_int64 194963383241350L);(* 14, 14 *) +(mk_real_int64 595707480652580L),(mk_real_int64 196858864427248L);(* 14, 14 *) +(mk_real_int64 444282779519871L),(mk_real_int64 512571000331908L);(* 14, 14 *) +(mk_real_int64 461080013276493L),(mk_real_int64 484608815603730L);(* 14, 14 *) +(mk_real_int64 407202966771866L),(mk_real_int64 321262449505020L);(* 14, 14 *) +(mk_real_int64 563650771041792L),(mk_real_int64 621676176592570L);(* 14, 14 *) +(mk_real_int64 271073876509009L),(mk_real_int64 700042450267362L);(* 14, 14 *) +(mk_real_int64 331519481127499L),(mk_real_int64 566860593086976L);(* 14, 14 *) +(mk_real_int64 198722822828871L),(mk_real_int64 613580488719400L);(* 14, 14 *) +(mk_real_int64 403267480068027L),(mk_real_int64 463566591530040L);(* 14, 14 *) +(mk_real_int64 534611026120720L),(mk_real_int64 546584212563118L);(* 14, 14 *) +(mk_real_int64 483817999775832L),(mk_real_int64 426480628544240L);(* 14, 14 *) +(mk_real_int64 716558937058195L),(mk_real_int64 421793480570660L);(* 14, 14 *) +(mk_real_int64 534449108640700L),(mk_real_int64 497080516821730L);(* 14, 14 *) +(mk_real_int64 474586541052637L),(mk_real_int64 548611857419640L);(* 14, 14 *) +(mk_real_int64 239054944946981L),(mk_real_int64 400412990171070L);(* 14, 14 *) +(mk_real_int64 254686670905260L),(mk_real_int64 610384111359900L);(* 14, 14 *) +(mk_real_int64 319309454589342L),(mk_real_int64 676086791747862L);(* 14, 14 *) +(mk_real_int64 322927105851560L),(mk_real_int64 450226061594541L);(* 14, 14 *) +(mk_real_int64 346858386741440L),(mk_real_int64 308362556543147L);(* 14, 14 *) +(mk_real_int64 174319133977000L),(mk_real_int64 388500231425014L);(* 14, 14 *) +(mk_real_int64 297531671619022L),(mk_real_int64 803851493944752L);(* 14, 14 *) +(mk_real_int64 351493987577056L),(mk_real_int64 679632629934336L);(* 14, 14 *) +(mk_real_int64 461128827565494L),(mk_real_int64 723465870410357L);(* 14, 14 *) +(mk_real_int64 449399023526642L),(mk_real_int64 671190839522140L);(* 14, 14 *) +(mk_real_int64 177522985924344L),(mk_real_int64 368132988069441L);(* 14, 14 *) +(mk_real_int64 288223257219726L),(mk_real_int64 702022482682779L);(* 14, 14 *) +(mk_real_int64 404049127270880L),(mk_real_int64 578225861031780L);(* 14, 14 *) +(mk_real_int64 314316010228192L),(mk_real_int64 470001783295814L);(* 14, 14 *) +(mk_real_int64 443421150296283L),(mk_real_int64 386614551796228L);(* 14, 14 *) +(mk_real_int64 749612952040888L),(mk_real_int64 608795413661736L);(* 14, 14 *) +(mk_real_int64 253550217757914L),(mk_real_int64 302287744860507L);(* 14, 14 *) +(mk_real_int64 319755488352132L),(mk_real_int64 225213516540112L);(* 14, 14 *) +(mk_real_int64 247745112357240L),(mk_real_int64 373499663825270L);(* 14, 14 *) +(mk_real_int64 227602560011511L),(mk_real_int64 572921042132628L);(* 14, 14 *) +(mk_real_int64 620647455959620L),(mk_real_int64 429734623718653L);(* 14, 14 *) +(mk_real_int64 675844269012384L),(mk_real_int64 337057722320208L);(* 14, 14 *) +(mk_real_int64 602798397514020L),(mk_real_int64 304861015600186L);(* 14, 14 *) +(mk_real_int64 718028875754512L),(mk_real_int64 553971771137120L);(* 14, 14 *) +(mk_real_int64 141215423835536L),(mk_real_int64 522077762747413L);(* 14, 14 *) +(mk_real_int64 287084888668440L),(mk_real_int64 234670545423444L);(* 14, 14 *) +(mk_real_int64 936085538917134L),(mk_real_int64 595253232679284L);(* 14, 14 *) +(mk_real_int64 185806543261605L),(mk_real_int64 130786743585888L);(* 14, 14 *) +(mk_real_int64 768976488474740L),(mk_real_int64 254896272054320L);(* 14, 14 *) +(mk_real_int64 787568354309232L),(mk_real_int64 589565293992950L);(* 14, 14 *) +(mk_real_int64 800369274634204L),(mk_real_int64 731727206172534L);(* 14, 14 *) +(mk_real_int64 681762086600025L),(mk_real_int64 289919376203408L);(* 14, 14 *) +(mk_real_int64 313805662108440L),(mk_real_int64 241168395509982L);(* 14, 14 *) +(mk_real_int64 836467497798579L),(mk_real_int64 323699840048769L);(* 14, 14 *) +(mk_real_int64 399889997038950L),(mk_real_int64 265792091781525L);(* 14, 14 *) +(mk_real_int64 234922718349520L),(mk_real_int64 246361999063329L);(* 14, 14 *) +(mk_real_int64 450308370528550L),(mk_real_int64 621963990492714L);(* 14, 14 *) +(mk_real_int64 174937646293816L),(mk_real_int64 696970265178186L);(* 14, 14 *) +(mk_real_int64 637292191841105L),(mk_real_int64 472344257630570L);(* 14, 14 *) +(mk_real_int64 299319456130494L),(mk_real_int64 658057841993448L);(* 14, 14 *) +(mk_real_int64 153493465191682L),(mk_real_int64 633008648900040L);(* 14, 14 *) +(mk_real_int64 373384739133607L),(mk_real_int64 454057793033413L);(* 14, 14 *) +(mk_real_int64 717975474751284L),(mk_real_int64 197120324640422L);(* 14, 14 *) +(mk_real_int64 477209188519906L),(mk_real_int64 749186552904624L);(* 14, 14 *) +(mk_real_int64 214099355294520L),(mk_real_int64 254214233384007L);(* 14, 14 *) +(mk_real_int64 633371645531676L),(mk_real_int64 704851940502717L);(* 14, 14 *) +(mk_real_int64 575212223410209L),(mk_real_int64 477463676314455L);(* 14, 14 *) +(mk_real_int64 199012028826600L),(mk_real_int64 576073296128355L);(* 14, 14 *) +(mk_real_int64 197844374404912L),(mk_real_int64 731744543961557L);(* 14, 14 *) +(mk_real_int64 615059159620256L),(mk_real_int64 515767570368078L);(* 14, 14 *) +(mk_real_int64 592801870638654L),(mk_real_int64 188875018438092L);(* 14, 14 *) +(mk_real_int64 455317589985264L),(mk_real_int64 680981157665025L);(* 14, 14 *) +(mk_real_int64 883229167772844L),(mk_real_int64 432449616649864L);(* 14, 14 *) +(mk_real_int64 241340357015100L),(mk_real_int64 126823079865222L);(* 14, 14 *) +(mk_real_int64 446219438497520L),(mk_real_int64 267243368587936L);(* 14, 14 *) +(mk_real_int64 501283036978919L),(mk_real_int64 627153034024176L);(* 14, 14 *) +(mk_real_int64 648083797686110L),(mk_real_int64 430608361075235L);(* 14, 14 *) +(mk_real_int64 749821147709546L),(mk_real_int64 375461068521700L);(* 14, 14 *) +(mk_real_int64 723319778661205L),(mk_real_int64 451097515880037L);(* 14, 14 *) +(mk_real_int64 345245039645800L),(mk_real_int64 447644588507760L);(* 14, 14 *) +(mk_real_int64 616743657064890L),(mk_real_int64 320595470429988L);(* 14, 14 *) +(mk_real_int64 379829759705232L),(mk_real_int64 150825472859484L);(* 14, 14 *) +(mk_real_int64 162217253302844L),(mk_real_int64 296590042061860L);(* 14, 14 *) +(mk_real_int64 300736517861472L),(mk_real_int64 527962577170875L);(* 14, 14 *) +(mk_real_int64 509980939317108L),(mk_real_int64 284817204434790L);(* 14, 14 *) +(mk_real_int64 110737825109723L),(mk_real_int64 383322857894700L);(* 14, 14 *) +(mk_real_int64 501459617356328L),(mk_real_int64 198107714351365L);(* 14, 14 *) +(mk_real_int64 605965193127112L),(mk_real_int64 372605726134629L);(* 14, 14 *) +(mk_real_int64 235198300213030L),(mk_real_int64 239997786964141L);(* 14, 14 *) +(mk_real_int64 252557007276320L),(mk_real_int64 206191464147240L);(* 14, 14 *) +(mk_real_int64 620021190631680L),(mk_real_int64 535624120842258L);(* 14, 14 *) +(mk_real_int64 347852781872368L),(mk_real_int64 493174452056215L);(* 14, 14 *) +(mk_real_int64 384111010952135L),(mk_real_int64 309040239119556L);(* 14, 14 *) +(mk_real_int64 478475966695024L),(mk_real_int64 328337939393075L);(* 14, 14 *) +(mk_real_int64 241154452963984L),(mk_real_int64 490204504789230L);(* 14, 14 *) +(mk_real_int64 478020556073716L),(mk_real_int64 607077659783658L);(* 14, 14 *) +(mk_real_int64 326503808969037L),(mk_real_int64 284782227576980L);(* 14, 14 *) +(mk_real_int64 321825878741283L),(mk_real_int64 692197732501176L);(* 14, 14 *) +(mk_real_int64 211034403160995L),(mk_real_int64 313969149858544L);(* 14, 14 *) +(mk_real_int64 151454282960388L),(mk_real_int64 559425764930025L);(* 14, 14 *) +(mk_real_int64 200029796122780L),(mk_real_int64 385911311390642L);(* 14, 14 *) +(mk_real_int64 421115518794960L),(mk_real_int64 167915987663480L);(* 14, 14 *) +(mk_real_int64 694995691825740L),(mk_real_int64 246341494942760L);(* 14, 14 *) +(mk_real_int64 370867602134274L),(mk_real_int64 701000286926336L);(* 14, 14 *) +(mk_real_int64 185171369917508L),(mk_real_int64 415437369735123L);(* 14, 14 *) +(mk_real_int64 353505345990291L),(mk_real_int64 350112364813827L);(* 14, 14 *) +(mk_real_int64 323905966911432L),(mk_real_int64 236818421167189L);(* 14, 14 *) +(mk_real_int64 130011870002726L),(mk_real_int64 396671712594960L);(* 14, 14 *) +(mk_real_int64 417662161716247L),(mk_real_int64 323992253306880L);(* 14, 14 *) +(mk_real_int64 365867492581226L),(mk_real_int64 408667929660936L);(* 14, 14 *) +(mk_real_int64 449586581704530L),(mk_real_int64 285508424761716L);(* 14, 14 *) +(mk_real_int64 690380857728139L),(mk_real_int64 377861145080111L);(* 14, 14 *) +(mk_real_int64 946827733646620L),(mk_real_int64 284430710888456L);(* 14, 14 *) +(mk_real_int64 428311255088750L),(mk_real_int64 615634304102972L);(* 14, 14 *) +(mk_real_int64 218967670786000L),(mk_real_int64 211804715915600L);(* 14, 14 *) +(mk_real_int64 658350667242144L),(mk_real_int64 280173784789605L);(* 14, 14 *) +(mk_real_int64 848734281032930L),(mk_real_int64 365607885313251L);(* 14, 14 *) +(mk_real_int64 721743133316492L),(mk_real_int64 280021436018634L);(* 14, 14 *) +(mk_real_int64 511928938049781L),(mk_real_int64 585613865311409L);(* 14, 14 *) +(mk_real_int64 166694008918976L),(mk_real_int64 143889951701603L);(* 14, 14 *) +(mk_real_int64 277342533758640L),(mk_real_int64 912525759796140L);(* 14, 14 *) +(mk_real_int64 209211461740827L),(mk_real_int64 720120780147096L);(* 14, 14 *) +(mk_real_int64 338892460331362L),(mk_real_int64 513560594673540L);(* 14, 14 *) +(mk_real_int64 531644440460000L),(mk_real_int64 632912570827016L);(* 14, 14 *) +(mk_real_int64 445731691968976L),(mk_real_int64 204549944638312L);(* 14, 14 *) +(mk_real_int64 537591141477299L),(mk_real_int64 489311274090576L);(* 14, 14 *) +(mk_real_int64 581845841754450L),(mk_real_int64 204285583619260L);(* 14, 14 *) +(mk_real_int64 508510475575896L),(mk_real_int64 512229184659008L);(* 14, 14 *) +(mk_real_int64 645153181647492L),(mk_real_int64 278402984479668L);(* 14, 14 *) +(mk_real_int64 137501106965235L),(mk_real_int64 127197565397460L);(* 14, 14 *) +(mk_real_int64 263319151634605L),(mk_real_int64 574506146499450L);(* 14, 14 *) +(mk_real_int64 408663642726861L),(mk_real_int64 159987099067920L);(* 14, 14 *) +(mk_real_int64 568621401716040L),(mk_real_int64 189102846648485L);(* 14, 14 *) +(mk_real_int64 576810012457574L),(mk_real_int64 834075215493680L);(* 14, 14 *) +(mk_real_int64 454709922624880L),(mk_real_int64 507249510583390L);(* 14, 14 *) +(mk_real_int64 300098149496880L),(mk_real_int64 307754117792226L);(* 14, 14 *) +(mk_real_int64 526451740573737L),(mk_real_int64 476000849647180L);(* 14, 14 *) +(mk_real_int64 714737455873614L),(mk_real_int64 438646418654900L);(* 14, 14 *) +(mk_real_int64 648959792972722L),(mk_real_int64 313656052407866L);(* 14, 14 *) +(mk_real_int64 447460729631850L),(mk_real_int64 816032432921792L);(* 14, 14 *) +(mk_real_int64 204899940724930L),(mk_real_int64 854395280929707L);(* 14, 14 *) +(mk_real_int64 535205103241169L),(mk_real_int64 583804279832000L);(* 14, 14 *) +(mk_real_int64 274668182827798L),(mk_real_int64 452734297586495L);(* 14, 14 *) +(mk_real_int64 304914642986602L),(mk_real_int64 177627670110908L);(* 14, 14 *) +(mk_real_int64 817279687758366L),(mk_real_int64 847317232316640L);(* 14, 14 *) +(mk_real_int64 335667957851248L),(mk_real_int64 645770937150384L);(* 14, 14 *) +(mk_real_int64 715199407112120L),(mk_real_int64 175051260725986L);(* 14, 14 *) +(mk_real_int64 705597711583776L),(mk_real_int64 401140748617560L);(* 14, 14 *) +(mk_real_int64 133543616636958L),(mk_real_int64 794289415029708L);(* 14, 14 *) +(mk_real_int64 195150747200772L),(mk_real_int64 493008669386742L);(* 14, 14 *) +(mk_real_int64 360403901482725L),(mk_real_int64 485570191147672L);(* 14, 14 *) +(mk_real_int64 853402363119955L),(mk_real_int64 591611895914272L);(* 14, 14 *) +(mk_real_int64 261822572293737L),(mk_real_int64 425519750756221L);(* 14, 14 *) +(mk_real_int64 561213063977790L),(mk_real_int64 223903320452306L);(* 14, 14 *) +(mk_real_int64 718492027247601L),(mk_real_int64 124728090216800L);(* 14, 14 *) +(mk_real_int64 724685764625055L),(mk_real_int64 197802173302685L);(* 14, 14 *) +(mk_real_int64 290397462208533L),(mk_real_int64 579766439571748L);(* 14, 14 *) +(mk_real_int64 154409647820442L),(mk_real_int64 541920817609350L);(* 14, 14 *) +(mk_real_int64 654285007939094L),(mk_real_int64 258829762930002L);(* 14, 14 *) +(mk_real_int64 315359665303760L),(mk_real_int64 472299283076544L);(* 14, 14 *) +(mk_real_int64 567953914662360L),(mk_real_int64 250386252869199L);(* 14, 14 *) +(mk_real_int64 350691867941088L),(mk_real_int64 242681268803364L);(* 14, 14 *) +(mk_real_int64 304788938412231L),(mk_real_int64 448910075254332L);(* 14, 14 *) +(mk_real_int64 608132198936988L),(mk_real_int64 311185490457303L);(* 14, 14 *) +(mk_real_int64 459214395553599L),(mk_real_int64 753911552065662L);(* 14, 14 *) +(mk_real_int64 232802909947096L),(mk_real_int64 563120685306195L);(* 14, 14 *) +(mk_real_int64 682178291741772L),(mk_real_int64 700104239364348L);(* 14, 14 *) +(mk_real_int64 212961781558240L),(mk_real_int64 135518572797228L);(* 14, 14 *) +(mk_real_int64 832228448580718L),(mk_real_int64 672552198631720L);(* 14, 14 *) +(mk_real_int64 888971450466660L),(mk_real_int64 778561860539646L);(* 14, 14 *) +(mk_real_int64 260714444341338L),(mk_real_int64 330391583671466L);(* 14, 14 *) +(mk_real_int64 254337398475018L),(mk_real_int64 323388274481415L);(* 14, 14 *) +(mk_real_int64 589092026220511L),(mk_real_int64 298771882739824L);(* 14, 14 *) +(mk_real_int64 525020249786496L),(mk_real_int64 511606376139690L);(* 14, 14 *) +(mk_real_int64 276282507311430L),(mk_real_int64 329572421020511L);(* 14, 14 *) +(mk_real_int64 254182915914627L),(mk_real_int64 273595818133120L);(* 14, 14 *) +(mk_real_int64 790949821261270L),(mk_real_int64 639850591427480L);(* 14, 14 *) +(mk_real_int64 459385696269312L),(mk_real_int64 745337577516740L);(* 14, 14 *) +(mk_real_int64 656959770026119L),(mk_real_int64 816167732165424L);(* 14, 14 *) +(mk_real_int64 400346668530574L),(mk_real_int64 713375397363531L);(* 14, 14 *) +(mk_real_int64 450921748647448L),(mk_real_int64 472250149612743L);(* 14, 14 *) +(mk_real_int64 184845914397485L),(mk_real_int64 815771840516352L);(* 14, 14 *) +(mk_real_int64 485550135694080L),(mk_real_int64 730836187559936L);(* 14, 14 *) +(mk_real_int64 293019550619664L),(mk_real_int64 424006691696381L);(* 14, 14 *) +(mk_real_int64 766911986571125L),(mk_real_int64 483480264465576L);(* 14, 14 *) +(mk_real_int64 147930270810300L),(mk_real_int64 301359319749000L);(* 14, 14 *) +(mk_real_int64 720513732547440L),(mk_real_int64 247958326593056L);(* 14, 14 *) +(mk_real_int64 542530941365182L),(mk_real_int64 614438284446035L);(* 14, 14 *) +(mk_real_int64 262544872512104L),(mk_real_int64 421783531057716L);(* 14, 14 *) +(mk_real_int64 540825793168271L),(mk_real_int64 605524398040803L);(* 14, 14 *) +(mk_real_int64 136712470567756L),(mk_real_int64 295610167857256L);(* 14, 14 *) +(mk_real_int64 314286253763742L),(mk_real_int64 222791346299070L);(* 14, 14 *) +(mk_real_int64 697155453298776L),(mk_real_int64 643645283640580L);(* 14, 14 *) +(mk_real_int64 304198223340057L),(mk_real_int64 879272717581080L);(* 14, 14 *) +(mk_real_int64 559954627241376L),(mk_real_int64 620713088907891L);(* 14, 14 *) +(mk_real_int64 320192172138240L),(mk_real_int64 555120315626340L);(* 14, 14 *) +(mk_real_int64 218618766984912L),(mk_real_int64 175507292601792L);(* 14, 14 *) +(mk_real_int64 320913636291670L),(mk_real_int64 600649949676370L);(* 14, 14 *) +(mk_real_int64 419584001038528L),(mk_real_int64 359339007207556L);(* 14, 14 *) +(mk_real_int64 540571535652752L),(mk_real_int64 729063390272055L);(* 14, 14 *) +(mk_real_int64 867328636501925L),(mk_real_int64 182230486261803L);(* 14, 14 *) +(mk_real_int64 572411731757177L),(mk_real_int64 622483795886366L);(* 14, 14 *) +(mk_real_int64 454716828819153L),(mk_real_int64 515263498916028L);(* 14, 14 *) +(mk_real_int64 523929525121492L),(mk_real_int64 213494571300504L);(* 14, 14 *) +(mk_real_int64 305126356206113L),(mk_real_int64 751079759759766L);(* 14, 14 *) +(mk_real_int64 668250721031994L),(mk_real_int64 438217344609396L);(* 14, 14 *) +(mk_real_int64 812312747546120L),(mk_real_int64 251742819157548L);(* 14, 14 *) +(mk_real_int64 427545159075797L),(mk_real_int64 402515269217061L);(* 14, 14 *) +(mk_real_int64 736520259942585L),(mk_real_int64 300614268785250L);(* 14, 14 *) +(mk_real_int64 113670417077580L),(mk_real_int64 382888671428821L);(* 14, 14 *) +(mk_real_int64 220907550360000L),(mk_real_int64 183017188568475L);(* 14, 14 *) +(mk_real_int64 239798504389008L),(mk_real_int64 223672146085405L);(* 14, 14 *) +(mk_real_int64 411615369630920L),(mk_real_int64 550341127415794L);(* 14, 14 *) +(mk_real_int64 251102994852057L),(mk_real_int64 724662364742316L);(* 14, 14 *) +(mk_real_int64 216207169348332L),(mk_real_int64 153651115563288L);(* 14, 14 *) +(mk_real_int64 265186374526730L),(mk_real_int64 612532286336236L);(* 14, 14 *) +(mk_real_int64 314927322086021L),(mk_real_int64 437863173099040L);(* 14, 14 *) +(mk_real_int64 202042103055594L),(mk_real_int64 223538075733874L);(* 14, 14 *) +(mk_real_int64 221167494199515L),(mk_real_int64 256050065441872L);(* 14, 14 *) +(mk_real_int64 210859405081424L),(mk_real_int64 438287461768646L);(* 14, 14 *) +(mk_real_int64 609033610480680L),(mk_real_int64 716505877240184L);(* 14, 14 *) +(mk_real_int64 291541977608347L),(mk_real_int64 715998933910876L);(* 14, 14 *) +(mk_real_int64 542236273592524L),(mk_real_int64 526438793041592L);(* 14, 14 *) +(mk_real_int64 358239425660022L),(mk_real_int64 439666269321235L);(* 14, 14 *) +(mk_real_int64 307975921543636L),(mk_real_int64 486427463641750L);(* 14, 14 *) +(mk_real_int64 673536837278445L),(mk_real_int64 184223866927530L);(* 14, 14 *) +(mk_real_int64 209831970073632L),(mk_real_int64 460050665433120L);(* 14, 14 *) +(mk_real_int64 552104405477319L),(mk_real_int64 231973624166500L);(* 14, 14 *) +(mk_real_int64 444365329006836L),(mk_real_int64 399706037011344L);(* 14, 14 *) +(mk_real_int64 229997384570260L),(mk_real_int64 628084862849640L);(* 14, 14 *) +(mk_real_int64 479999514424800L),(mk_real_int64 708581811939948L);(* 14, 14 *) +(mk_real_int64 738464957427544L),(mk_real_int64 459798310444032L);(* 14, 14 *) +(mk_real_int64 653284714320900L),(mk_real_int64 818386148868672L);(* 14, 14 *) +(mk_real_int64 144096684612800L),(mk_real_int64 413418706745308L);(* 14, 14 *) +(mk_real_int64 591479435374128L),(mk_real_int64 390781216393377L);(* 14, 14 *) +(mk_real_int64 826682134372800L),(mk_real_int64 648839109408147L);(* 14, 14 *) +(mk_real_int64 709403592830409L),(mk_real_int64 488339287510525L);(* 14, 14 *) +(mk_real_int64 457113528866865L),(mk_real_int64 358648682654052L);(* 14, 14 *) +(mk_real_int64 178461064852065L),(mk_real_int64 714540549678425L);(* 14, 14 *) +(mk_real_int64 271555833747962L),(mk_real_int64 464695093013315L);(* 14, 14 *) +(mk_real_int64 269854499766085L),(mk_real_int64 758705266978393L);(* 14, 14 *) +(mk_real_int64 579193328897001L),(mk_real_int64 506057507584616L);(* 14, 14 *) +(mk_real_int64 592807918976325L),(mk_real_int64 451912327542593L);(* 14, 14 *) +(mk_real_int64 231442292051284L),(mk_real_int64 894902957784346L);(* 14, 14 *) +(mk_real_int64 306614027776722L),(mk_real_int64 543489708815091L);(* 14, 14 *) +(mk_real_int64 450257949207216L),(mk_real_int64 261968956458183L);(* 14, 14 *) +(mk_real_int64 394369174361444L),(mk_real_int64 470186192332323L);(* 14, 14 *) +(mk_real_int64 228356760582402L),(mk_real_int64 411424578059350L);(* 14, 14 *) +(mk_real_int64 631166265992864L),(mk_real_int64 255589992393788L);(* 14, 14 *) +(mk_real_int64 471133993562050L),(mk_real_int64 106796436325404L);(* 14, 14 *) +(mk_real_int64 202378939457590L),(mk_real_int64 501124608873720L);(* 14, 14 *) +(mk_real_int64 502686670709072L),(mk_real_int64 264808985782424L);(* 14, 14 *) +(mk_real_int64 329658040849072L),(mk_real_int64 358739755376586L);(* 14, 14 *) +(mk_real_int64 387436840701842L),(mk_real_int64 533923141421250L);(* 14, 14 *) +(mk_real_int64 523490258455008L),(mk_real_int64 823405027863620L);(* 14, 14 *) +(mk_real_int64 300095581763340L),(mk_real_int64 348366828293718L);(* 14, 14 *) +(mk_real_int64 547963661603984L),(mk_real_int64 168937935721504L);(* 14, 14 *) +(mk_real_int64 362248413268311L),(mk_real_int64 616389894532159L);(* 14, 14 *) +(mk_real_int64 257960019608320L),(mk_real_int64 247032144833805L);(* 14, 14 *) +(mk_real_int64 200519518487958L),(mk_real_int64 741974257482416L);(* 14, 14 *) +(mk_real_int64 199379260872792L),(mk_real_int64 248326471900944L);(* 14, 14 *) +(mk_real_int64 790684055753228L),(mk_real_int64 786433430318016L);(* 14, 14 *) +(mk_real_int64 748998134147536L),(mk_real_int64 409900298978100L);(* 14, 14 *) +(mk_real_int64 141379444193157L),(mk_real_int64 783011082748772L);(* 14, 14 *) +(mk_real_int64 337709969129520L),(mk_real_int64 380282174153952L);(* 14, 14 *) +(mk_real_int64 185769130480587L),(mk_real_int64 554843700594650L);(* 14, 14 *) +(mk_real_int64 374930583476740L),(mk_real_int64 591498580052919L);(* 14, 14 *) +(mk_real_int64 507810635816960L),(mk_real_int64 250435211923956L);(* 14, 14 *) +(mk_real_int64 371575216781505L),(mk_real_int64 342769675430343L);(* 14, 14 *) +(mk_real_int64 370409954642508L),(mk_real_int64 644888375155062L);(* 14, 14 *) +(mk_real_int64 452313867539220L),(mk_real_int64 215128634727204L);(* 14, 14 *) +(mk_real_int64 535512510993668L),(mk_real_int64 573980027463960L);(* 14, 14 *) +(mk_real_int64 157246280372028L),(mk_real_int64 218052129413850L);(* 14, 14 *) +(mk_real_int64 355540841043384L),(mk_real_int64 233671650737216L);(* 14, 14 *) +(mk_real_int64 398861798671928L),(mk_real_int64 254408142012136L);(* 14, 14 *) +(mk_real_int64 383082552257850L),(mk_real_int64 347287802872608L);(* 14, 14 *) +(mk_real_int64 672738232373136L),(mk_real_int64 809306835283758L);(* 14, 14 *) +(mk_real_int64 511579025091096L),(mk_real_int64 287484820856811L);(* 14, 14 *) +(mk_real_int64 130517672620716L),(mk_real_int64 523234863852910L);(* 14, 14 *) +(mk_real_int64 720769195231650L),(mk_real_int64 449145286747992L);(* 14, 14 *) +(mk_real_int64 360242608161559L),(mk_real_int64 251547505894375L);(* 14, 14 *) +(mk_real_int64 251839370695924L),(mk_real_int64 191265750289488L);(* 14, 14 *) +(mk_real_int64 293734242063900L),(mk_real_int64 522204471166952L);(* 14, 14 *) +(mk_real_int64 273366396121531L),(mk_real_int64 188388340868232L);(* 14, 14 *) +(mk_real_int64 420297360384800L),(mk_real_int64 266322831169032L);(* 14, 14 *) +(mk_real_int64 145767674013212L),(mk_real_int64 494918821666000L);(* 14, 14 *) +(mk_real_int64 779636012457726L),(mk_real_int64 477967229752240L);(* 14, 14 *) +(mk_real_int64 301136312364230L),(mk_real_int64 208237001472831L);(* 14, 14 *) +(mk_real_int64 793869206035568L),(mk_real_int64 550520764618232L);(* 14, 14 *) +(mk_real_int64 555522787535760L),(mk_real_int64 189681514192960L);(* 14, 14 *) +(mk_real_int64 356170680559952L),(mk_real_int64 343072142499609L);(* 14, 14 *) +(mk_real_int64 551125907708530L),(mk_real_int64 885557237296596L);(* 14, 14 *) +(mk_real_int64 820210348169355L),(mk_real_int64 766498824333280L);(* 14, 14 *) +(mk_real_int64 640835123352825L),(mk_real_int64 600456551580288L);(* 14, 14 *) +(mk_real_int64 425344170765672L),(mk_real_int64 228361621541256L);(* 14, 14 *) +(mk_real_int64 388342264778335L),(mk_real_int64 620697533883525L);(* 14, 14 *) +(mk_real_int64 322992668287088L),(mk_real_int64 774903540525240L);(* 14, 14 *) +(mk_real_int64 354498559753968L),(mk_real_int64 239340142680912L);(* 14, 14 *) +(mk_real_int64 655811172600467L),(mk_real_int64 303007609123488L);(* 14, 14 *) +(mk_real_int64 223187030821204L),(mk_real_int64 876371195873506L);(* 14, 14 *) +(mk_real_int64 426656874014472L),(mk_real_int64 813923526014444L);(* 14, 14 *) +(mk_real_int64 380840343693257L),(mk_real_int64 336637615674714L);(* 14, 14 *) +(mk_real_int64 865895247465430L),(mk_real_int64 481178164821021L);(* 14, 14 *) +(mk_real_int64 607067898284970L),(mk_real_int64 664341127051264L);(* 14, 14 *) +(mk_real_int64 278522376483920L),(mk_real_int64 456589090915753L);(* 14, 14 *) +(mk_real_int64 569154220760840L),(mk_real_int64 108447215549824L);(* 14, 14 *) +(mk_real_int64 259868561936646L),(mk_real_int64 356032748971860L);(* 14, 14 *) +(mk_real_int64 623651980661018L),(mk_real_int64 632572477277524L);(* 14, 14 *) +(mk_real_int64 760796839815792L),(mk_real_int64 541910889773032L);(* 14, 14 *) +(mk_real_int64 703798952573440L),(mk_real_int64 500422636762430L);(* 14, 14 *) +(mk_real_int64 534112173388470L),(mk_real_int64 400690919781360L);(* 14, 14 *) +(mk_real_int64 273824213252876L),(mk_real_int64 200795259470400L);(* 14, 14 *) +(mk_real_int64 864519053242421L),(mk_real_int64 543977996587472L);(* 14, 14 *) +(mk_real_int64 348627025497916L),(mk_real_int64 258383447040523L);(* 14, 14 *) +(mk_real_int64 297309463250844L),(mk_real_int64 282746574452784L);(* 14, 14 *) +(mk_real_int64 504330820474572L),(mk_real_int64 426123055903368L);(* 14, 14 *) +(mk_real_int64 288591190562884L),(mk_real_int64 321436866725406L);(* 14, 14 *) +(mk_real_int64 700377216102960L),(mk_real_int64 802095725756175L);(* 14, 14 *) +(mk_real_int64 180527804443260L),(mk_real_int64 724206358890024L);(* 14, 14 *) +(mk_real_int64 227074174078514L),(mk_real_int64 644464986753104L);(* 14, 14 *) +(mk_real_int64 434722374899604L),(mk_real_int64 395013617517870L);(* 14, 14 *) +(mk_real_int64 298577649252731L),(mk_real_int64 526008118997406L);(* 14, 14 *) +(mk_real_int64 304241989187630L),(mk_real_int64 396440278691328L);(* 14, 14 *) +(mk_real_int64 276593684577756L),(mk_real_int64 617272184339520L);(* 14, 14 *) +(mk_real_int64 515596193963432L),(mk_real_int64 540982474434753L);(* 14, 14 *) +(mk_real_int64 382901741333964L),(mk_real_int64 172346658576268L);(* 14, 14 *) +(mk_real_int64 288585158527603L),(mk_real_int64 499110579283246L);(* 14, 14 *) +(mk_real_int64 760232866068891L),(mk_real_int64 712275669956133L);(* 14, 14 *) +(mk_real_int64 402521667332724L),(mk_real_int64 209229593862240L);(* 14, 14 *) +(mk_real_int64 514618489656414L),(mk_real_int64 128788845770230L);(* 14, 14 *) +(mk_real_int64 450834280924373L),(mk_real_int64 581444365300272L);(* 14, 14 *) +(mk_real_int64 504245502371133L),(mk_real_int64 506935572643581L);(* 14, 14 *) +(mk_real_int64 559278912149322L),(mk_real_int64 611987254866106L);(* 14, 14 *) +(mk_real_int64 535516795129272L),(mk_real_int64 222366239451720L);(* 14, 14 *) +(mk_real_int64 531463242485548L),(mk_real_int64 385376562766276L);(* 14, 14 *) +(mk_real_int64 298134796795056L),(mk_real_int64 492727754026875L);(* 14, 14 *) +(mk_real_int64 827342964690516L),(mk_real_int64 637577807408175L);(* 14, 14 *) +(mk_real_int64 404989249823163L),(mk_real_int64 558499044572157L);(* 14, 14 *) +(mk_real_int64 675340988213522L),(mk_real_int64 737884748959671L);(* 14, 14 *) +(mk_real_int64 414423503320960L),(mk_real_int64 515592586264770L);(* 14, 14 *) +(mk_real_int64 456543130822576L),(mk_real_int64 358867101667842L);(* 14, 14 *) +(mk_real_int64 592102828349425L),(mk_real_int64 535359626320024L);(* 14, 14 *) +(mk_real_int64 523050845127651L),(mk_real_int64 502450973382456L);(* 14, 14 *) +(mk_real_int64 268040826889398L),(mk_real_int64 428182305986730L);(* 14, 14 *) +(mk_real_int64 567009903899680L),(mk_real_int64 829260714777034L);(* 14, 14 *) +(mk_real_int64 539062424789234L),(mk_real_int64 307825688646400L);(* 14, 14 *) +(mk_real_int64 476371965213105L),(mk_real_int64 477524335067321L);(* 14, 14 *) +(mk_real_int64 692666251791176L),(mk_real_int64 417509836631386L);(* 14, 14 *) +(mk_real_int64 192453277976610L),(mk_real_int64 549697337694179L);(* 14, 14 *) +(mk_real_int64 875287952743904L),(mk_real_int64 842982907138403L);(* 14, 14 *) +(mk_real_int64 358407962990432L),(mk_real_int64 713297418318344L);(* 14, 14 *) +(mk_real_int64 420904445122688L),(mk_real_int64 464160369737172L);(* 14, 14 *) +(mk_real_int64 406937622299312L),(mk_real_int64 464734907915040L);(* 14, 14 *) +(mk_real_int64 391899631028650L),(mk_real_int64 584356946072998L);(* 14, 14 *) +(mk_real_int64 446891706480625L),(mk_real_int64 602600697244080L);(* 14, 14 *) +(mk_real_int64 481799506534556L),(mk_real_int64 396077081873101L);(* 14, 14 *) +(mk_real_int64 671982629724637L),(mk_real_int64 464193099830440L);(* 14, 14 *) +(mk_real_int64 551530892722140L),(mk_real_int64 340542807735586L);(* 14, 14 *) +(mk_real_int64 268144502189031L),(mk_real_int64 917683285194236L);(* 14, 14 *) +(mk_real_int64 498968260351569L),(mk_real_int64 639069069190320L);(* 14, 14 *) +(mk_real_int64 517476698419168L),(mk_real_int64 782771857142340L);(* 14, 14 *) +(mk_real_int64 653900895142564L),(mk_real_int64 211660637941760L);(* 14, 14 *) +(mk_real_int64 479287405123173L),(mk_real_int64 365830302399396L);(* 14, 14 *) +(mk_real_int64 263372690124663L),(mk_real_int64 385530175619941L);(* 14, 14 *) +(mk_real_int64 304766134973524L),(mk_real_int64 710056319580342L);(* 14, 14 *) +(mk_real_int64 284615936587619L),(mk_real_int64 311143260716220L);(* 14, 14 *) +(mk_real_int64 765589557255200L),(mk_real_int64 265233531196860L);(* 14, 14 *) +(mk_real_int64 207138328584440L),(mk_real_int64 589508541177616L);(* 14, 14 *) +(mk_real_int64 473993142083254L),(mk_real_int64 215588489608710L);(* 14, 14 *) +(mk_real_int64 688655294007098L),(mk_real_int64 159938787375458L);(* 14, 14 *) +(mk_real_int64 530971787060792L),(mk_real_int64 251548431566005L);(* 14, 14 *) +(mk_real_int64 212739843776910L),(mk_real_int64 429217524506192L);(* 14, 14 *) +(mk_real_int64 577487209982088L),(mk_real_int64 686170986207840L);(* 14, 14 *) +(mk_real_int64 481358874475500L),(mk_real_int64 482350032174346L);(* 14, 14 *) +(mk_real_int64 195056743964432L),(mk_real_int64 485023687637976L);(* 14, 14 *) +(mk_real_int64 566022024312756L),(mk_real_int64 603473062410004L);(* 14, 14 *) +(mk_real_int64 437254606965260L),(mk_real_int64 557756203255950L);(* 14, 14 *) +(mk_real_int64 189138314204238L),(mk_real_int64 517501858009500L);(* 14, 14 *) +(mk_real_int64 690926347781511L),(mk_real_int64 264873086127156L);(* 14, 14 *) +(mk_real_int64 477565753516656L),(mk_real_int64 420575867512084L);(* 14, 14 *) +(mk_real_int64 464964223903704L),(mk_real_int64 582209272943210L);(* 14, 14 *) +(mk_real_int64 170790388705476L),(mk_real_int64 152689732450866L);(* 14, 14 *) +(mk_real_int64 601032244916427L),(mk_real_int64 557305791795302L);(* 14, 14 *) +(mk_real_int64 364393255520412L),(mk_real_int64 310152168497056L);(* 14, 14 *) +(mk_real_int64 501436945574416L),(mk_real_int64 457716049565258L);(* 14, 14 *) +(mk_real_int64 748469838326330L),(mk_real_int64 493571870419740L);(* 14, 14 *) +(mk_real_int64 166897883082770L),(mk_real_int64 294430819655976L);(* 14, 14 *) +(mk_real_int64 261855338937064L),(mk_real_int64 577479274050056L);(* 14, 14 *) +(mk_real_int64 131751427939900L),(mk_real_int64 406892686908848L);(* 14, 14 *) +(mk_real_int64 377013383132388L),(mk_real_int64 202029895018658L);(* 14, 14 *) +(mk_real_int64 262978989783302L),(mk_real_int64 621321975020277L);(* 14, 14 *) +(mk_real_int64 393861417389186L),(mk_real_int64 678615423359463L);(* 14, 14 *) +(mk_real_int64 249918913114344L),(mk_real_int64 504455537302927L);(* 14, 14 *) +(mk_real_int64 678557177170116L),(mk_real_int64 214541494088112L);(* 14, 14 *) +(mk_real_int64 371792247030234L),(mk_real_int64 487643151055368L);(* 14, 14 *) +(mk_real_int64 601069304565856L),(mk_real_int64 226191321071772L);(* 14, 14 *) +(mk_real_int64 287539198480510L),(mk_real_int64 393537153874004L);(* 14, 14 *) +(mk_real_int64 446125053399017L),(mk_real_int64 309924227555982L);(* 14, 14 *) +(mk_real_int64 719875429928876L),(mk_real_int64 263571991592412L);(* 14, 14 *) +(mk_real_int64 258118727970996L),(mk_real_int64 533012949653570L);(* 14, 14 *) +(mk_real_int64 276807827291292L),(mk_real_int64 545153702756559L);(* 14, 14 *) +(mk_real_int64 296018702541224L),(mk_real_int64 194513885560080L);(* 14, 14 *) +(mk_real_int64 203811661994492L),(mk_real_int64 422787217602127L);(* 14, 14 *) +(mk_real_int64 544168048729210L),(mk_real_int64 528959985408712L);(* 14, 14 *) +(mk_real_int64 251696866400100L),(mk_real_int64 244530453059200L);(* 14, 14 *) +(mk_real_int64 593807989783066L),(mk_real_int64 758441469513882L);(* 14, 14 *) +(mk_real_int64 270849660518392L),(mk_real_int64 625985821144602L);(* 14, 14 *) +(mk_real_int64 519409919896572L),(mk_real_int64 329615871362199L);(* 14, 14 *) +(mk_real_int64 252535659077376L),(mk_real_int64 156233982224416L);(* 14, 14 *) +(mk_real_int64 705127022430870L),(mk_real_int64 137538961435410L);(* 14, 14 *) +(mk_real_int64 819897509404245L),(mk_real_int64 197148544762356L);(* 14, 14 *) +(mk_real_int64 200180410835089L),(mk_real_int64 660291885802980L);(* 14, 14 *) +(mk_real_int64 636076654560976L),(mk_real_int64 530742516962940L);(* 14, 14 *) +(mk_real_int64 648323409557120L),(mk_real_int64 565998972842760L);(* 14, 14 *) +(mk_real_int64 153035398552440L),(mk_real_int64 516930832843138L);(* 14, 14 *) +(mk_real_int64 525484213260160L),(mk_real_int64 796647091970828L);(* 14, 14 *) +(mk_real_int64 398472944272872L),(mk_real_int64 721070597577148L);(* 14, 14 *) +(mk_real_int64 206779231443933L),(mk_real_int64 505652481968485L);(* 14, 14 *) +(mk_real_int64 458488151021846L),(mk_real_int64 211709172051528L);(* 14, 14 *) +(mk_real_int64 759253493894700L),(mk_real_int64 749999408208875L);(* 14, 14 *) +(mk_real_int64 571479080079730L),(mk_real_int64 467800621697000L);(* 14, 14 *) +(mk_real_int64 240577076832600L),(mk_real_int64 540498001890695L);(* 14, 14 *) +(mk_real_int64 695977998860592L),(mk_real_int64 284149341686860L);(* 14, 14 *) +(mk_real_int64 381205205453933L),(mk_real_int64 134953323166512L);(* 14, 14 *) +(mk_real_int64 178003622623684L),(mk_real_int64 174366093663170L);(* 14, 14 *) +(mk_real_int64 444773633368834L),(mk_real_int64 202105631390538L);(* 14, 14 *) +(mk_real_int64 295977271656420L),(mk_real_int64 507133242212112L);(* 14, 14 *) +(mk_real_int64 466889204754742L),(mk_real_int64 513352586255436L);(* 14, 14 *) +(mk_real_int64 351294383870184L),(mk_real_int64 525613792063512L);(* 14, 14 *) +(mk_real_int64 758622366175950L),(mk_real_int64 534617780403148L);(* 14, 14 *) +(mk_real_int64 665279616202920L),(mk_real_int64 464245636765410L);(* 14, 14 *) +(mk_real_int64 290350828414449L),(mk_real_int64 135703445872696L);(* 14, 14 *) +(mk_real_int64 596653892373000L),(mk_real_int64 664905172163988L);(* 14, 14 *) +(mk_real_int64 505544677867032L),(mk_real_int64 712956289774292L);(* 14, 14 *) +(mk_real_int64 897069320244944L),(mk_real_int64 201561747590365L);(* 14, 14 *) +(mk_real_int64 375078841474854L),(mk_real_int64 464173939662664L);(* 14, 14 *) +(mk_real_int64 593595067945840L),(mk_real_int64 918210442569056L);(* 14, 14 *) +(mk_real_int64 358997099861444L),(mk_real_int64 385492989975100L);(* 14, 14 *) +(mk_real_int64 420148344733880L),(mk_real_int64 374882064402150L);(* 14, 14 *) +(mk_real_int64 781786463923715L),(mk_real_int64 373782559793412L);(* 14, 14 *) +(mk_real_int64 463800276922752L),(mk_real_int64 364428427128885L);(* 14, 14 *) +(mk_real_int64 224781321071541L),(mk_real_int64 206199534951480L);(* 14, 14 *) +(mk_real_int64 767412609496302L),(mk_real_int64 195282862037120L);(* 14, 14 *) +(mk_real_int64 572239691685402L),(mk_real_int64 294415678048296L);(* 14, 14 *) +(mk_real_int64 347625702733056L),(mk_real_int64 238340384638200L);(* 14, 14 *) +(mk_real_int64 255413073181020L),(mk_real_int64 556373297873952L);(* 14, 14 *) +(mk_real_int64 454334620485856L),(mk_real_int64 409595352669704L);(* 14, 14 *) +(mk_real_int64 160089314476520L),(mk_real_int64 810922675617972L);(* 14, 14 *) +(mk_real_int64 376552371061416L),(mk_real_int64 610174165993050L);(* 14, 14 *) +(mk_real_int64 205980102482037L),(mk_real_int64 515482045053378L);(* 14, 14 *) +(mk_real_int64 421460988299820L),(mk_real_int64 432225455395176L);(* 14, 14 *) +(mk_real_int64 212517721199589L),(mk_real_int64 321540547948872L);(* 14, 14 *) +(mk_real_int64 357537733648288L),(mk_real_int64 414280590690000L);(* 14, 14 *) +(mk_real_int64 176884469305789L),(mk_real_int64 393560997608142L);(* 14, 14 *) +(mk_real_int64 306642957585420L),(mk_real_int64 238828124932075L);(* 14, 14 *) +(mk_real_int64 702614555880867L),(mk_real_int64 583938984302085L);(* 14, 14 *) +(mk_real_int64 268188668429472L),(mk_real_int64 539343781389429L);(* 14, 14 *) +(mk_real_int64 253691250299667L),(mk_real_int64 498993327323960L);(* 14, 14 *) +(mk_real_int64 314123961366417L),(mk_real_int64 814041366625270L);(* 14, 14 *) +(mk_real_int64 522333001293300L),(mk_real_int64 360047616981570L);(* 14, 14 *) +(mk_real_int64 247549111962004L),(mk_real_int64 361254789250200L);(* 14, 14 *) +(mk_real_int64 234378076762320L),(mk_real_int64 271713880568039L);(* 14, 14 *) +(mk_real_int64 616004852870135L),(mk_real_int64 430817935527854L);(* 14, 14 *) +(mk_real_int64 581794474849809L),(mk_real_int64 328873311563262L);(* 14, 14 *) +(mk_real_int64 248898313673703L),(mk_real_int64 593939939111418L);(* 14, 14 *) +(mk_real_int64 912890206860304L),(mk_real_int64 229054457755305L);(* 14, 14 *) +(mk_real_int64 250624249476182L),(mk_real_int64 148730599352340L);(* 14, 14 *) +(mk_real_int64 242985825652404L),(mk_real_int64 209024269906536L);(* 14, 14 *) +(mk_real_int64 656783471248422L),(mk_real_int64 422841916228331L);(* 14, 14 *) +(mk_real_int64 213190142831626L),(mk_real_int64 496313783414829L);(* 14, 14 *) +(mk_real_int64 338338886336556L),(mk_real_int64 360183806467182L);(* 14, 14 *) +(mk_real_int64 553272892495422L),(mk_real_int64 424888323760142L);(* 14, 14 *) +(mk_real_int64 324045561260322L),(mk_real_int64 324915553512176L);(* 14, 14 *) +(mk_real_int64 409323423885624L),(mk_real_int64 274667564368714L);(* 14, 14 *) +(mk_real_int64 249064543767840L),(mk_real_int64 227300532143380L);(* 14, 14 *) +(mk_real_int64 647693628891900L),(mk_real_int64 252892228152104L);(* 14, 14 *) +(mk_real_int64 542292226151036L),(mk_real_int64 244226841868413L);(* 14, 14 *) +(mk_real_int64 467720547080262L),(mk_real_int64 173653172812770L);(* 14, 14 *) +(mk_real_int64 533978757539700L),(mk_real_int64 617242632265350L);(* 14, 14 *) +(mk_real_int64 248058495967884L),(mk_real_int64 368252954213400L);(* 14, 14 *) +(mk_real_int64 647468715267528L),(mk_real_int64 242477425452579L);(* 14, 14 *) +(mk_real_int64 597997904795292L),(mk_real_int64 517298684546880L);(* 14, 14 *) +(mk_real_int64 257132267239120L),(mk_real_int64 443581342779028L);(* 14, 14 *) +(mk_real_int64 196977117902082L),(mk_real_int64 490742568627693L);(* 14, 14 *) +(mk_real_int64 546761610058962L),(mk_real_int64 359240890305165L);(* 14, 14 *) +(mk_real_int64 183239085047993L),(mk_real_int64 930930484736538L);(* 14, 14 *) +(mk_real_int64 655385321984498L),(mk_real_int64 149251950775814L);(* 14, 14 *) +(mk_real_int64 650898747514372L),(mk_real_int64 636631788479907L);(* 14, 14 *) +(mk_real_int64 586227026518271L),(mk_real_int64 576710596233240L);(* 14, 14 *) +(mk_real_int64 505364009274594L),(mk_real_int64 831126480906432L);(* 14, 14 *) +(mk_real_int64 711329307929817L),(mk_real_int64 462615860781116L);(* 14, 14 *) +(mk_real_int64 202703928463140L),(mk_real_int64 356189499776728L);(* 14, 14 *) +(mk_real_int64 416729650981000L),(mk_real_int64 381257111837910L);(* 14, 14 *) +(mk_real_int64 206410988621025L),(mk_real_int64 569734279908871L);(* 14, 14 *) +(mk_real_int64 593237011088267L),(mk_real_int64 368953285756416L);(* 14, 14 *) +(mk_real_int64 798228038468088L),(mk_real_int64 707639372105244L);(* 14, 14 *) +(mk_real_int64 679039412288545L),(mk_real_int64 274846284755730L);(* 14, 14 *) +(mk_real_int64 517285551119268L),(mk_real_int64 447956762378268L);(* 14, 14 *) +(mk_real_int64 468474797060388L),(mk_real_int64 384425998935618L);(* 14, 14 *) +(mk_real_int64 128552468662040L),(mk_real_int64 300071575813502L);(* 14, 14 *) +(mk_real_int64 498782793936634L),(mk_real_int64 135807439880950L);(* 14, 14 *) +(mk_real_int64 186767846927035L),(mk_real_int64 199472014413416L);(* 14, 14 *) +(mk_real_int64 676962971424070L),(mk_real_int64 534860927345570L);(* 14, 14 *) +(mk_real_int64 591276142148432L),(mk_real_int64 313766927505303L);(* 14, 14 *) +(mk_real_int64 197128472968640L),(mk_real_int64 555871180309286L);(* 14, 14 *) +(mk_real_int64 149990546118086L),(mk_real_int64 648497883393591L);(* 14, 14 *) +(mk_real_int64 447257625367784L),(mk_real_int64 370813684717796L);(* 14, 14 *) +(mk_real_int64 294976478624784L),(mk_real_int64 590248388188602L);(* 14, 14 *) +(mk_real_int64 865718869133328L),(mk_real_int64 435438127904570L);(* 14, 14 *) +(mk_real_int64 744556776312567L),(mk_real_int64 387746354056060L);(* 14, 14 *) +(mk_real_int64 339457363823030L),(mk_real_int64 510552492281780L);(* 14, 14 *) +(mk_real_int64 165150916394870L),(mk_real_int64 138943596167142L);(* 14, 14 *) +(mk_real_int64 486357087572905L),(mk_real_int64 302618257844200L);(* 14, 14 *) +(mk_real_int64 540675771843265L),(mk_real_int64 473665633848380L);(* 14, 14 *) +(mk_real_int64 615663783924387L),(mk_real_int64 105838455752998L);(* 14, 14 *) +(mk_real_int64 767873881450680L),(mk_real_int64 774852368113860L);(* 14, 14 *) +(mk_real_int64 530569243945836L),(mk_real_int64 126199377469808L);(* 14, 14 *) +(mk_real_int64 345284677563632L),(mk_real_int64 416175314965430L);(* 14, 14 *) +(mk_real_int64 205606900468890L),(mk_real_int64 744713973284964L);(* 14, 14 *) +(mk_real_int64 503429301207245L),(mk_real_int64 683044703458848L);(* 14, 14 *) +(mk_real_int64 621417217412034L),(mk_real_int64 819945645396960L);(* 14, 14 *) +(mk_real_int64 497543937667617L),(mk_real_int64 236475588512064L);(* 14, 14 *) +(mk_real_int64 300961316566911L),(mk_real_int64 661409837432880L);(* 14, 14 *) +(mk_real_int64 690123663286996L),(mk_real_int64 656253686899476L);(* 14, 14 *) +(mk_real_int64 808055146247076L),(mk_real_int64 638883345620868L);(* 14, 14 *) +(mk_real_int64 468149167107344L),(mk_real_int64 451633281438738L);(* 14, 14 *) +(mk_real_int64 348479530337583L),(mk_real_int64 316585869201600L);(* 14, 14 *) +(mk_real_int64 206390523135080L),(mk_real_int64 494138367818820L);(* 14, 14 *) +(mk_real_int64 168414963144844L),(mk_real_int64 460316600911686L);(* 14, 14 *) +(mk_real_int64 125110142250148L),(mk_real_int64 331790551174299L);(* 14, 14 *) +(mk_real_int64 677850354201132L),(mk_real_int64 210780707831988L);(* 14, 14 *) +(mk_real_int64 762063695110494L),(mk_real_int64 395074866460424L);(* 14, 14 *) +(mk_real_int64 144582213963492L),(mk_real_int64 714352476346359L);(* 14, 14 *) +(mk_real_int64 339308251059824L),(mk_real_int64 761834899034506L);(* 14, 14 *) +(mk_real_int64 625721117000837L),(mk_real_int64 579163181788950L);(* 14, 14 *) +(mk_real_int64 187061707393280L),(mk_real_int64 170858452909130L);(* 14, 14 *) +(mk_real_int64 402943416536334L),(mk_real_int64 637521739802874L);(* 14, 14 *) +(mk_real_int64 610062146882025L),(mk_real_int64 682863801173250L);(* 14, 14 *) +(mk_real_int64 212022093676440L),(mk_real_int64 325667074230544L);(* 14, 14 *) +(mk_real_int64 581452341231424L),(mk_real_int64 430412068140828L);(* 14, 14 *) +(mk_real_int64 293266443037962L),(mk_real_int64 760787429234434L);(* 14, 14 *) +(mk_real_int64 225627153802798L),(mk_real_int64 398761864662168L);(* 14, 14 *) +(mk_real_int64 596437629497712L),(mk_real_int64 241463628412266L);(* 14, 14 *) +(mk_real_int64 407240101585665L),(mk_real_int64 548271163542779L);(* 14, 14 *) +(mk_real_int64 583327173792327L),(mk_real_int64 446012480810385L);(* 14, 14 *) +(mk_real_int64 789796852357275L),(mk_real_int64 431677992361124L);(* 14, 14 *) +(mk_real_int64 599415411416323L),(mk_real_int64 239145282634944L);(* 14, 14 *) +(mk_real_int64 435874083915272L),(mk_real_int64 934782454965570L);(* 14, 14 *) +(mk_real_int64 471076077598320L),(mk_real_int64 196074993060216L);(* 14, 14 *) +(mk_real_int64 237390993001983L),(mk_real_int64 150705632570799L);(* 14, 14 *) +(mk_real_int64 162251955534600L),(mk_real_int64 505139599827150L);(* 14, 14 *) +(mk_real_int64 443006156913188L),(mk_real_int64 652884441114044L);(* 14, 14 *) +(mk_real_int64 224477524191220L),(mk_real_int64 634294672038472L);(* 14, 14 *) +(mk_real_int64 563149753605171L),(mk_real_int64 522141089425904L);(* 14, 14 *) +(mk_real_int64 237750005353420L),(mk_real_int64 716646145586478L);(* 14, 14 *) +(mk_real_int64 760458640533030L),(mk_real_int64 447433261203014L);(* 14, 14 *) +(mk_real_int64 344103109020471L),(mk_real_int64 565227360818280L);(* 14, 14 *) +(mk_real_int64 662619040902676L),(mk_real_int64 227123046408860L);(* 14, 14 *) +(mk_real_int64 285321488935896L),(mk_real_int64 812920706100906L);(* 14, 14 *) +(mk_real_int64 261843178592919L),(mk_real_int64 341213011880202L);(* 14, 14 *) +(mk_real_int64 556139126753150L),(mk_real_int64 294250682526064L);(* 14, 14 *) +(mk_real_int64 596446891266330L),(mk_real_int64 594800053552698L);(* 14, 14 *) +(mk_real_int64 305036266603248L),(mk_real_int64 583347591055516L);(* 14, 14 *) +(mk_real_int64 322306600454650L),(mk_real_int64 216592435745772L);(* 14, 14 *) +(mk_real_int64 330192526079950L),(mk_real_int64 412361130814805L);(* 14, 14 *) +(mk_real_int64 264481781883800L),(mk_real_int64 520987658600490L);(* 14, 14 *) +(mk_real_int64 381257027568818L),(mk_real_int64 321665374212560L);(* 14, 14 *) +(mk_real_int64 508183440589374L),(mk_real_int64 526619570329224L);(* 14, 14 *) +(mk_real_int64 879422863453920L),(mk_real_int64 777391274672652L);(* 14, 14 *) +(mk_real_int64 715871770524600L),(mk_real_int64 350406665865765L);(* 14, 14 *) +(mk_real_int64 527431854752088L),(mk_real_int64 407046411162160L);(* 14, 14 *) +(mk_real_int64 146452003162244L),(mk_real_int64 285383694690316L);(* 14, 14 *) +(mk_real_int64 592225159107267L),(mk_real_int64 336983454226644L);(* 14, 14 *) +(mk_real_int64 273912769814278L),(mk_real_int64 559844247536960L);(* 14, 14 *) +(mk_real_int64 427845295069918L),(mk_real_int64 702722831950764L);(* 14, 14 *) +(mk_real_int64 422271722392742L),(mk_real_int64 402749206005939L);(* 14, 14 *) +(mk_real_int64 238490343284250L),(mk_real_int64 435016285075943L);(* 14, 14 *) +(mk_real_int64 478886166821526L),(mk_real_int64 316627949988324L);(* 14, 14 *) +(mk_real_int64 375751419876014L),(mk_real_int64 499887753715266L);(* 14, 14 *) +(mk_real_int64 351022256512052L),(mk_real_int64 844962725337490L);(* 14, 14 *) +(mk_real_int64 359637441060216L),(mk_real_int64 130901854920957L);(* 14, 14 *) +(mk_real_int64 345514854286110L),(mk_real_int64 251432581019970L);(* 14, 14 *) +(mk_real_int64 454720663677940L),(mk_real_int64 636634334090106L);(* 14, 14 *) +(mk_real_int64 623514390876090L),(mk_real_int64 153830335700048L);(* 14, 14 *) +(mk_real_int64 304100061444290L),(mk_real_int64 437231837892304L);(* 14, 14 *) +(mk_real_int64 646388341505280L),(mk_real_int64 648766599450193L);(* 14, 14 *) +(mk_real_int64 236154064165658L),(mk_real_int64 515948944128579L);(* 14, 14 *) +(mk_real_int64 345710732904915L),(mk_real_int64 452088781837056L);(* 14, 14 *) +(mk_real_int64 471285526580000L),(mk_real_int64 221956683205747L);(* 14, 14 *) +(mk_real_int64 680082310467772L),(mk_real_int64 720446399819125L);(* 14, 14 *) +(mk_real_int64 484250184957924L),(mk_real_int64 113148927184950L);(* 14, 14 *) +(mk_real_int64 567118418748440L),(mk_real_int64 376640280642437L);(* 14, 14 *) +(mk_real_int64 536117353041750L),(mk_real_int64 634757602277761L);(* 14, 14 *) +(mk_real_int64 377509396423876L),(mk_real_int64 451642933957778L);(* 14, 14 *) +(mk_real_int64 462029996541125L),(mk_real_int64 413387513323280L);(* 14, 14 *) +(mk_real_int64 158714557959549L),(mk_real_int64 177672604581700L);(* 14, 14 *) +(mk_real_int64 818120432360519L),(mk_real_int64 679116664278280L);(* 14, 14 *) +(mk_real_int64 271226737296894L),(mk_real_int64 482948977291534L);(* 14, 14 *) +(mk_real_int64 428748798858980L),(mk_real_int64 406793644471585L);(* 14, 14 *) +(mk_real_int64 627869057149078L),(mk_real_int64 708628715816000L);(* 14, 14 *) +(mk_real_int64 301948988737536L),(mk_real_int64 783370270333080L);(* 14, 14 *) +(mk_real_int64 709537404084751L),(mk_real_int64 291715967255532L);(* 14, 14 *) +(mk_real_int64 500976060195891L),(mk_real_int64 353548211060594L);(* 14, 14 *) +(mk_real_int64 750173617535949L),(mk_real_int64 220190007255510L);(* 14, 14 *) +(mk_real_int64 347060019010320L),(mk_real_int64 310710259258905L);(* 14, 14 *) +(mk_real_int64 249839595953866L),(mk_real_int64 374108179461924L);(* 14, 14 *) +(mk_real_int64 289053011951008L),(mk_real_int64 408495635272920L);(* 14, 14 *) +(mk_real_int64 400965556733124L),(mk_real_int64 626239579541723L);(* 14, 14 *) +(mk_real_int64 810629702279895L),(mk_real_int64 443195000824350L);(* 14, 14 *) +(mk_real_int64 552938480715000L),(mk_real_int64 262629122411145L);(* 14, 14 *) +(mk_real_int64 244663833190404L),(mk_real_int64 640907490981144L);(* 14, 14 *) +(mk_real_int64 315322384246530L),(mk_real_int64 394650476739463L);(* 14, 14 *) +(mk_real_int64 549724173390024L),(mk_real_int64 290171249116620L);(* 14, 14 *) +(mk_real_int64 738446579109360L),(mk_real_int64 289267777188375L);(* 14, 14 *) +(mk_real_int64 733891008478590L),(mk_real_int64 394392371191905L);(* 14, 14 *) +(mk_real_int64 478479780024145L),(mk_real_int64 452244680725615L);(* 14, 14 *) +(mk_real_int64 290985968594160L),(mk_real_int64 175180915904930L);(* 14, 14 *) +(mk_real_int64 365431918522111L),(mk_real_int64 486663914224488L);(* 14, 14 *) +(mk_real_int64 166485834418400L),(mk_real_int64 324090554347136L);(* 14, 14 *) +(mk_real_int64 205540017838400L),(mk_real_int64 163398904655930L);(* 14, 14 *) +(mk_real_int64 948261714384600L),(mk_real_int64 171758545307560L);(* 14, 14 *) +(mk_real_int64 158877153497874L),(mk_real_int64 365721124314825L);(* 14, 14 *) +(mk_real_int64 638550143217562L),(mk_real_int64 173260957679452L);(* 14, 14 *) +(mk_real_int64 245650002828590L),(mk_real_int64 501930849007744L);(* 14, 14 *) +(mk_real_int64 691482896804244L),(mk_real_int64 285113472254677L);(* 14, 14 *) +(mk_real_int64 658149161166275L),(mk_real_int64 223814560963000L);(* 14, 14 *) +(mk_real_int64 393023762289924L),(mk_real_int64 681202592099682L);(* 14, 14 *) +(mk_real_int64 242892434084165L),(mk_real_int64 449634817964773L);(* 14, 14 *) +(mk_real_int64 366170306802785L),(mk_real_int64 797055625815870L);(* 14, 14 *) +(mk_real_int64 424035908411692L),(mk_real_int64 769103299805886L);(* 14, 14 *) +(mk_real_int64 432867236803737L),(mk_real_int64 860182996999392L);(* 14, 14 *) +(mk_real_int64 303966823679470L),(mk_real_int64 593310301049004L);(* 14, 14 *) +(mk_real_int64 427538649482157L),(mk_real_int64 318651247504304L);(* 14, 14 *) +(mk_real_int64 531454600852560L),(mk_real_int64 419850055835028L);(* 14, 14 *) +(mk_real_int64 261703066572285L),(mk_real_int64 242551980493856L);(* 14, 14 *) +(mk_real_int64 453018601332325L),(mk_real_int64 199518609350596L);(* 14, 14 *) +(mk_real_int64 391661770799981L),(mk_real_int64 477868892797704L);(* 14, 14 *) +(mk_real_int64 510352996648280L),(mk_real_int64 169390070500092L);(* 14, 14 *) +(mk_real_int64 236258908593152L),(mk_real_int64 609459212576130L);(* 14, 14 *) +(mk_real_int64 559330344952992L),(mk_real_int64 599173373580624L);(* 14, 14 *) +(mk_real_int64 784408616010720L),(mk_real_int64 620029722255552L);(* 14, 14 *) +(mk_real_int64 547902252576928L),(mk_real_int64 529223356003296L);(* 14, 14 *) +(mk_real_int64 372544411072674L),(mk_real_int64 548420000436779L);(* 14, 14 *) +(mk_real_int64 737232436825836L),(mk_real_int64 375502989223800L);(* 14, 14 *) +(mk_real_int64 528207953584944L),(mk_real_int64 369524479533150L);(* 14, 14 *) +(mk_real_int64 909186331014962L),(mk_real_int64 432432248190724L);(* 14, 14 *) +(mk_real_int64 327595953859864L),(mk_real_int64 548508533764448L);(* 14, 14 *) +(mk_real_int64 769896257589474L),(mk_real_int64 501431285139732L);(* 14, 14 *) +(mk_real_int64 283445988614102L),(mk_real_int64 477927704102134L);(* 14, 14 *) +(mk_real_int64 604344341699948L),(mk_real_int64 367160697825545L);(* 14, 14 *) +(mk_real_int64 467323967396528L),(mk_real_int64 205500666179232L);(* 14, 14 *) +(mk_real_int64 580920026089311L),(mk_real_int64 715284788000695L);(* 14, 14 *) +(mk_real_int64 188837901505800L),(mk_real_int64 690650541439233L);(* 14, 14 *) +(mk_real_int64 502957025802505L),(mk_real_int64 454915620363408L);(* 14, 14 *) +(mk_real_int64 673766278337372L),(mk_real_int64 216418964685120L);(* 14, 14 *) +(mk_real_int64 607789389993480L),(mk_real_int64 364403207121317L);(* 14, 14 *) +(mk_real_int64 410082613758912L),(mk_real_int64 469243431399413L);(* 14, 14 *) +(mk_real_int64 448803885085128L),(mk_real_int64 183330660493813L);(* 14, 14 *) +(mk_real_int64 778682867340924L),(mk_real_int64 506179735514530L);(* 14, 14 *) +(mk_real_int64 765938264601341L),(mk_real_int64 230123251183548L);(* 14, 14 *) +(mk_real_int64 820262332173746L),(mk_real_int64 705760614036800L);(* 14, 14 *) +(mk_real_int64 980893970525850L),(mk_real_int64 246368717537134L);(* 14, 14 *) +(mk_real_int64 525553618847838L),(mk_real_int64 440557722027159L);(* 14, 14 *) +(mk_real_int64 552813839356030L),(mk_real_int64 529618372314975L);(* 14, 14 *) +(mk_real_int64 381919273092000L),(mk_real_int64 445633878297716L);(* 14, 14 *) +(mk_real_int64 510444345536325L),(mk_real_int64 420100810987220L);(* 14, 14 *) +(mk_real_int64 157482018586035L),(mk_real_int64 314508697459313L);(* 14, 14 *) +(mk_real_int64 502546964747144L),(mk_real_int64 723832942056544L);(* 14, 14 *) +(mk_real_int64 456444668354904L),(mk_real_int64 396384152048076L);(* 14, 14 *) +(mk_real_int64 398160282751042L),(mk_real_int64 625529855643420L);(* 14, 14 *) +(mk_real_int64 439752774789504L),(mk_real_int64 165062658456144L);(* 14, 14 *) +(mk_real_int64 419477462674281L),(mk_real_int64 182366284906884L);(* 14, 14 *) +(mk_real_int64 367513017575328L),(mk_real_int64 491720053462500L);(* 14, 14 *) +(mk_real_int64 428376828922028L),(mk_real_int64 514155880605024L);(* 14, 14 *) +(mk_real_int64 817718106349095L),(mk_real_int64 170677426396770L);(* 14, 14 *) +(mk_real_int64 224677866316310L),(mk_real_int64 321162142131936L);(* 14, 14 *) +(mk_real_int64 597473177182200L),(mk_real_int64 533253983995740L);(* 14, 14 *) +(mk_real_int64 401486026409550L),(mk_real_int64 551514627776458L);(* 14, 14 *) +(mk_real_int64 295794415226656L),(mk_real_int64 524545142457908L);(* 14, 14 *) +(mk_real_int64 447973554990004L),(mk_real_int64 535983055241688L);(* 14, 14 *) +(mk_real_int64 468656747540320L),(mk_real_int64 368689299457674L);(* 14, 14 *) +(mk_real_int64 385528170030553L),(mk_real_int64 519262662801094L);(* 14, 14 *) +(mk_real_int64 341867338110896L),(mk_real_int64 343406576887014L);(* 14, 14 *) +(mk_real_int64 665809582618792L),(mk_real_int64 274082823830593L);(* 14, 14 *) +(mk_real_int64 552934955727770L),(mk_real_int64 325152897697068L);(* 14, 14 *) +(mk_real_int64 183174984013302L),(mk_real_int64 375706869791255L);(* 14, 14 *) +(mk_real_int64 585680330160021L),(mk_real_int64 535512799687824L);(* 14, 14 *) +(mk_real_int64 700253566002228L),(mk_real_int64 287279768189124L);(* 14, 14 *) +(mk_real_int64 541451781064936L),(mk_real_int64 572961739763844L);(* 14, 14 *) +(mk_real_int64 459438929948918L),(mk_real_int64 747649317106512L);(* 14, 14 *) +(mk_real_int64 588225337930032L),(mk_real_int64 354302699520640L);(* 14, 14 *) +(mk_real_int64 935214705361940L),(mk_real_int64 569441729046090L);(* 14, 14 *) +(mk_real_int64 436907735484692L),(mk_real_int64 379585482881756L);(* 14, 14 *) +(mk_real_int64 891838053657701L),(mk_real_int64 691563223844024L);(* 14, 14 *) +(mk_real_int64 504677044860352L),(mk_real_int64 148737812748273L);(* 14, 14 *) +(mk_real_int64 481940641764912L),(mk_real_int64 345721562301896L);(* 14, 14 *) +(mk_real_int64 494335949343852L),(mk_real_int64 721698028328375L);(* 14, 14 *) +(mk_real_int64 862443376792130L),(mk_real_int64 211339866876655L);(* 14, 14 *) +(mk_real_int64 479183249103405L),(mk_real_int64 549212020961274L);(* 14, 14 *) +(mk_real_int64 304032309300777L),(mk_real_int64 307394733821660L);(* 14, 14 *) +(mk_real_int64 513547271618900L),(mk_real_int64 537179494651425L);(* 14, 14 *) +(mk_real_int64 406834534601872L),(mk_real_int64 297556417194976L);(* 14, 14 *) +(mk_real_int64 592394529824112L),(mk_real_int64 246066846676576L);(* 14, 14 *) +(mk_real_int64 695035158557881L),(mk_real_int64 267009108414696L);(* 14, 14 *) +(mk_real_int64 533652559710237L),(mk_real_int64 594607676091000L);(* 14, 14 *) +(mk_real_int64 968528910905600L),(mk_real_int64 328795965893751L);(* 14, 14 *) +(mk_real_int64 431677448200725L),(mk_real_int64 310799438183650L);(* 14, 14 *) +(mk_real_int64 471338212190916L),(mk_real_int64 416909917636765L);(* 14, 14 *) +(mk_real_int64 555097531242280L),(mk_real_int64 326780907657425L);(* 14, 14 *) +(mk_real_int64 122172643078430L),(mk_real_int64 407985350233249L);(* 14, 14 *) +(mk_real_int64 393468631846262L),(mk_real_int64 195231416406611L);(* 14, 14 *) +(mk_real_int64 439897285615782L),(mk_real_int64 447117698836476L);(* 14, 14 *) +(mk_real_int64 375576295353000L),(mk_real_int64 518361599504493L);(* 14, 14 *) +(mk_real_int64 399500369210108L),(mk_real_int64 272510883241128L);(* 14, 14 *) +(mk_real_int64 381990115372096L),(mk_real_int64 366831399334512L);(* 14, 14 *) +(mk_real_int64 301663928500584L),(mk_real_int64 600410915782500L);(* 14, 14 *) +(mk_real_int64 455419734175812L),(mk_real_int64 697234416653760L);(* 14, 14 *) +(mk_real_int64 120712376726460L),(mk_real_int64 743144519548858L);(* 14, 14 *) +(mk_real_int64 388484932571196L),(mk_real_int64 545807863934400L);(* 14, 14 *) +(mk_real_int64 689894810856905L),(mk_real_int64 455506958750337L);(* 14, 14 *) +(mk_real_int64 302243963986503L),(mk_real_int64 604443182153832L);(* 14, 14 *) +(mk_real_int64 453007156298249L),(mk_real_int64 378871724582296L);(* 14, 14 *) +(mk_real_int64 341414813208702L),(mk_real_int64 622848653932230L);(* 14, 14 *) +(mk_real_int64 504984092898272L),(mk_real_int64 161628394556424L);(* 14, 14 *) +(mk_real_int64 495600079041957L),(mk_real_int64 313009200381800L);(* 14, 14 *) +(mk_real_int64 346755075562487L),(mk_real_int64 328327998666650L);(* 14, 14 *) +(mk_real_int64 382086292889295L),(mk_real_int64 381969384268210L);(* 14, 14 *) +(mk_real_int64 464728417911567L),(mk_real_int64 182239968412850L);(* 14, 14 *) +(mk_real_int64 258399325869762L),(mk_real_int64 437795854174850L);(* 14, 14 *) +(mk_real_int64 410778810055350L),(mk_real_int64 551821819755310L);(* 14, 14 *) +(mk_real_int64 534617685441262L),(mk_real_int64 423311294018750L);(* 14, 14 *) +(mk_real_int64 513339328787396L),(mk_real_int64 447417168979101L);(* 14, 14 *) +(mk_real_int64 656751864450825L),(mk_real_int64 301604936270945L);(* 14, 14 *) +(mk_real_int64 669269881768965L),(mk_real_int64 648844187191200L);(* 14, 14 *) +(mk_real_int64 796510103913784L),(mk_real_int64 424223688511802L);(* 14, 14 *) +(mk_real_int64 270861112056444L),(mk_real_int64 593953925553612L);(* 14, 14 *) +(mk_real_int64 246866458987008L),(mk_real_int64 256396452986065L);(* 14, 14 *) +(mk_real_int64 652154112539776L),(mk_real_int64 530649425308880L);(* 14, 14 *) +(mk_real_int64 592747840471040L),(mk_real_int64 339235585740210L);(* 14, 14 *) +(mk_real_int64 270457420009050L),(mk_real_int64 173209307507320L);(* 14, 14 *) +(mk_real_int64 195174373864536L),(mk_real_int64 541810762591848L);(* 14, 14 *) +(mk_real_int64 564262617296576L),(mk_real_int64 155043792801180L);(* 14, 14 *) +(mk_real_int64 506193175942630L),(mk_real_int64 158571121761540L);(* 14, 14 *) +(mk_real_int64 415202688442075L),(mk_real_int64 512187370962210L);(* 14, 14 *) +(mk_real_int64 693356840546194L),(mk_real_int64 754402541412688L);(* 14, 14 *) +(mk_real_int64 447287625790410L),(mk_real_int64 696843201181644L);(* 14, 14 *) +(mk_real_int64 374037323413000L),(mk_real_int64 565014347241587L);(* 14, 14 *) +(mk_real_int64 919758675756222L),(mk_real_int64 327139473818892L);(* 14, 14 *) +(mk_real_int64 419585554051202L),(mk_real_int64 553635094854119L);(* 14, 14 *) +(mk_real_int64 279662711969096L),(mk_real_int64 827744501220452L);(* 14, 14 *) +(mk_real_int64 361721479611888L),(mk_real_int64 156073508919474L);(* 14, 14 *) +(mk_real_int64 161136401266308L),(mk_real_int64 938864335216503L);(* 14, 14 *) +(mk_real_int64 283752745291763L),(mk_real_int64 241868834757151L);(* 14, 14 *) +(mk_real_int64 196716331920780L),(mk_real_int64 567016927424948L);(* 14, 14 *) +(mk_real_int64 693253390612640L),(mk_real_int64 251728765683525L);(* 14, 14 *) +(mk_real_int64 310462130525274L),(mk_real_int64 396955005175652L);(* 14, 14 *) +(mk_real_int64 216804737077761L),(mk_real_int64 454210574958910L);(* 14, 14 *) +(mk_real_int64 296578297721370L),(mk_real_int64 310834417328160L);(* 14, 14 *) +(mk_real_int64 259480268524440L),(mk_real_int64 536928131719088L)(* 14, 14 *) +];; diff --git a/formal_lp/old/arith/tests/arith_test_data18.hl b/formal_lp/old/arith/tests/arith_test_data18.hl new file mode 100644 index 0000000..20a2917 --- /dev/null +++ b/formal_lp/old/arith/tests/arith_test_data18.hl @@ -0,0 +1,1002 @@ +let data = [ +(mk_real_int64 593577076514247969L),(mk_real_int64 428680505437969320L);(* 17, 17 *) +(mk_real_int64 115148850047821254L),(mk_real_int64 400625175641427675L);(* 17, 17 *) +(mk_real_int64 267559796243890150L),(mk_real_int64 136412146185955315L);(* 17, 17 *) +(mk_real_int64 297040999931329479L),(mk_real_int64 29825072577377098L);(* 17, 16 *) +(mk_real_int64 858357628464932527L),(mk_real_int64 213035687964967841L);(* 17, 17 *) +(mk_real_int64 692780235444750948L),(mk_real_int64 32361101103141920L);(* 17, 16 *) +(mk_real_int64 368368415358674470L),(mk_real_int64 642250206775142145L);(* 17, 17 *) +(mk_real_int64 44352225921124639L),(mk_real_int64 84828703199977545L);(* 16, 16 *) +(mk_real_int64 293767468923358080L),(mk_real_int64 490354811484381388L);(* 17, 17 *) +(mk_real_int64 11580401050568952L),(mk_real_int64 328542995430032790L);(* 16, 17 *) +(mk_real_int64 361658680742465480L),(mk_real_int64 32529200157013252L);(* 17, 16 *) +(mk_real_int64 720930266342781826L),(mk_real_int64 154152718338301010L);(* 17, 17 *) +(mk_real_int64 32494575670377125L),(mk_real_int64 294730722590458680L);(* 16, 17 *) +(mk_real_int64 302457425920251063L),(mk_real_int64 171171393669591983L);(* 17, 17 *) +(mk_real_int64 607014172489591917L),(mk_real_int64 583373694158955503L);(* 17, 17 *) +(mk_real_int64 136475059390012953L),(mk_real_int64 802638546348782037L);(* 17, 17 *) +(mk_real_int64 72604157973643010L),(mk_real_int64 109591660960474693L);(* 16, 17 *) +(mk_real_int64 181227586211215124L),(mk_real_int64 481352555272347506L);(* 17, 17 *) +(mk_real_int64 469409098050003981L),(mk_real_int64 81703500828888114L);(* 17, 16 *) +(mk_real_int64 523818167442188320L),(mk_real_int64 113624381071366665L);(* 17, 17 *) +(mk_real_int64 90176144567500932L),(mk_real_int64 176029278330009456L);(* 16, 17 *) +(mk_real_int64 314312111378233182L),(mk_real_int64 674468900005789776L);(* 17, 17 *) +(mk_real_int64 606735181438351267L),(mk_real_int64 276571488323597520L);(* 17, 17 *) +(mk_real_int64 346812068985741636L),(mk_real_int64 95360777077860000L);(* 17, 16 *) +(mk_real_int64 182600518690968273L),(mk_real_int64 12804250058753183L);(* 17, 16 *) +(mk_real_int64 432891753125152496L),(mk_real_int64 584777428468571058L);(* 17, 17 *) +(mk_real_int64 205562116747747041L),(mk_real_int64 59876458977379590L);(* 17, 16 *) +(mk_real_int64 63764679139133024L),(mk_real_int64 15949346321153958L);(* 16, 16 *) +(mk_real_int64 581232493658172982L),(mk_real_int64 72640184426663042L);(* 17, 16 *) +(mk_real_int64 386144941881660951L),(mk_real_int64 139340247736797800L);(* 17, 17 *) +(mk_real_int64 1834399628878245L),(mk_real_int64 52992453560315558L);(* 15, 16 *) +(mk_real_int64 198554588400482100L),(mk_real_int64 947856141299473804L);(* 17, 17 *) +(mk_real_int64 202372079351488772L),(mk_real_int64 142006166408538738L);(* 17, 17 *) +(mk_real_int64 30304525036039896L),(mk_real_int64 139176746068147216L);(* 16, 17 *) +(mk_real_int64 518986357192159120L),(mk_real_int64 77320061352118746L);(* 17, 16 *) +(mk_real_int64 375108279078092640L),(mk_real_int64 91443459108583337L);(* 17, 16 *) +(mk_real_int64 511138638300269448L),(mk_real_int64 390345752646113160L);(* 17, 17 *) +(mk_real_int64 31881316669604122L),(mk_real_int64 152733592195099581L);(* 16, 17 *) +(mk_real_int64 567048714070888293L),(mk_real_int64 16727242942719006L);(* 17, 16 *) +(mk_real_int64 478646606294174545L),(mk_real_int64 333567474600622906L);(* 17, 17 *) +(mk_real_int64 75387897831759795L),(mk_real_int64 79902574033969975L);(* 16, 16 *) +(mk_real_int64 522789246229386240L),(mk_real_int64 318113105262331938L);(* 17, 17 *) +(mk_real_int64 668821765419722550L),(mk_real_int64 19441889042953960L);(* 17, 16 *) +(mk_real_int64 224969149043018168L),(mk_real_int64 15506915245560675L);(* 17, 16 *) +(mk_real_int64 34727842856539638L),(mk_real_int64 201587350012327084L);(* 16, 17 *) +(mk_real_int64 7718212768683318L),(mk_real_int64 165334157732744532L);(* 15, 17 *) +(mk_real_int64 27022496088630661L),(mk_real_int64 490555087105277608L);(* 16, 17 *) +(mk_real_int64 16761546396004295L),(mk_real_int64 181893596499823404L);(* 16, 17 *) +(mk_real_int64 568493999054889740L),(mk_real_int64 250322347468258725L);(* 17, 17 *) +(mk_real_int64 409886520928385886L),(mk_real_int64 861977709480663750L);(* 17, 17 *) +(mk_real_int64 33750615705282585L),(mk_real_int64 159909611686283128L);(* 16, 17 *) +(mk_real_int64 480873536374793258L),(mk_real_int64 403545250580123214L);(* 17, 17 *) +(mk_real_int64 349475323501652400L),(mk_real_int64 23133548472456150L);(* 17, 16 *) +(mk_real_int64 23620501525765480L),(mk_real_int64 288620016849006140L);(* 16, 17 *) +(mk_real_int64 81211034886982776L),(mk_real_int64 189853068631257952L);(* 16, 17 *) +(mk_real_int64 81499790593513080L),(mk_real_int64 366681427710683904L);(* 16, 17 *) +(mk_real_int64 7949818594636644L),(mk_real_int64 85408420777383152L);(* 15, 16 *) +(mk_real_int64 634197005289549405L),(mk_real_int64 166272832722748360L);(* 17, 17 *) +(mk_real_int64 125534262847858460L),(mk_real_int64 173882194745925094L);(* 17, 17 *) +(mk_real_int64 313544292480479458L),(mk_real_int64 117964910018325792L);(* 17, 17 *) +(mk_real_int64 243412030980796347L),(mk_real_int64 1114044407758268L);(* 17, 15 *) +(mk_real_int64 945851299305824814L),(mk_real_int64 121355180105389626L);(* 17, 17 *) +(mk_real_int64 17425681026832232L),(mk_real_int64 6879176136108735L);(* 16, 15 *) +(mk_real_int64 74689563565062600L),(mk_real_int64 539732462100269320L);(* 16, 17 *) +(mk_real_int64 138450201815611932L),(mk_real_int64 719635337454146616L);(* 17, 17 *) +(mk_real_int64 405826054742195052L),(mk_real_int64 369653802612391780L);(* 17, 17 *) +(mk_real_int64 264941710677584820L),(mk_real_int64 276274772473447181L);(* 17, 17 *) +(mk_real_int64 608326901916297575L),(mk_real_int64 55961604681412362L);(* 17, 16 *) +(mk_real_int64 865000774650459200L),(mk_real_int64 74262523934704434L);(* 17, 16 *) +(mk_real_int64 1113644835197622L),(mk_real_int64 254920014998145330L);(* 15, 17 *) +(mk_real_int64 281529665999463664L),(mk_real_int64 409018730295274792L);(* 17, 17 *) +(mk_real_int64 449001186656439960L),(mk_real_int64 85121853080698102L);(* 17, 16 *) +(mk_real_int64 350852999189380512L),(mk_real_int64 78636991734309096L);(* 17, 16 *) +(mk_real_int64 368395200123333808L),(mk_real_int64 310945489396631454L);(* 17, 17 *) +(mk_real_int64 28888194000980283L),(mk_real_int64 135767904078146136L);(* 16, 17 *) +(mk_real_int64 272781364443450000L),(mk_real_int64 372972681985485166L);(* 17, 17 *) +(mk_real_int64 44395895538852856L),(mk_real_int64 102649825639854575L);(* 16, 17 *) +(mk_real_int64 394896429705037512L),(mk_real_int64 9936393940485474L);(* 17, 15 *) +(mk_real_int64 260779687734248416L),(mk_real_int64 121536563662906003L);(* 17, 17 *) +(mk_real_int64 34126573183279535L),(mk_real_int64 504032628076773540L);(* 16, 17 *) +(mk_real_int64 67481169086988228L),(mk_real_int64 5789790942269693L);(* 16, 15 *) +(mk_real_int64 247158371534520459L),(mk_real_int64 436729323378602020L);(* 17, 17 *) +(mk_real_int64 192355602867232522L),(mk_real_int64 805220047814808805L);(* 17, 17 *) +(mk_real_int64 418400998477857558L),(mk_real_int64 300752070718209408L);(* 17, 17 *) +(mk_real_int64 167901300044116480L),(mk_real_int64 163721723802592360L);(* 17, 17 *) +(mk_real_int64 279595990657022535L),(mk_real_int64 559691791891692600L);(* 17, 17 *) +(mk_real_int64 272947776810709350L),(mk_real_int64 233192394156385458L);(* 17, 17 *) +(mk_real_int64 373028763761464980L),(mk_real_int64 197169279973814285L);(* 17, 17 *) +(mk_real_int64 447973625558312610L),(mk_real_int64 257275865559752575L);(* 17, 17 *) +(mk_real_int64 162751268632080996L),(mk_real_int64 49158816079191705L);(* 17, 16 *) +(mk_real_int64 362434068641894216L),(mk_real_int64 327116761013379216L);(* 17, 17 *) +(mk_real_int64 597068501739285535L),(mk_real_int64 12241898397071550L);(* 17, 16 *) +(mk_real_int64 391006093467659481L),(mk_real_int64 465699562690802953L);(* 17, 17 *) +(mk_real_int64 207152321072355911L),(mk_real_int64 223755720965302032L);(* 17, 17 *) +(mk_real_int64 53733848653588300L),(mk_real_int64 530662923876621125L);(* 16, 17 *) +(mk_real_int64 76523313269231895L),(mk_real_int64 9717215647913124L);(* 16, 15 *) +(mk_real_int64 35807129585941770L),(mk_real_int64 11311388289769568L);(* 16, 16 *) +(mk_real_int64 296596702614925752L),(mk_real_int64 192721070270345436L);(* 17, 17 *) +(mk_real_int64 18289220989301220L),(mk_real_int64 645933272672277888L);(* 16, 17 *) +(mk_real_int64 181377626984399430L),(mk_real_int64 21658451652450692L);(* 17, 16 *) +(mk_real_int64 103869686343254018L),(mk_real_int64 604754777331707829L);(* 17, 17 *) +(mk_real_int64 91635169822009996L),(mk_real_int64 12485624993411737L);(* 16, 16 *) +(mk_real_int64 172953434924303243L),(mk_real_int64 252696236796920210L);(* 17, 17 *) +(mk_real_int64 153134968640597414L),(mk_real_int64 13789298656558605L);(* 17, 16 *) +(mk_real_int64 396845123478383840L),(mk_real_int64 270159836959960593L);(* 17, 17 *) +(mk_real_int64 38980695007353333L),(mk_real_int64 23522944404051840L);(* 16, 16 *) +(mk_real_int64 269394527747421920L),(mk_real_int64 494966004413881960L);(* 17, 17 *) +(mk_real_int64 252749377141810745L),(mk_real_int64 354581938043061988L);(* 17, 17 *) +(mk_real_int64 371001846228785592L),(mk_real_int64 474034906819971389L);(* 17, 17 *) +(mk_real_int64 176070144108119300L),(mk_real_int64 539906586098534991L);(* 17, 17 *) +(mk_real_int64 51632118105881364L),(mk_real_int64 88091229914334960L);(* 16, 16 *) +(mk_real_int64 428143100748513234L),(mk_real_int64 397120188117104316L);(* 17, 17 *) +(mk_real_int64 35292113095600632L),(mk_real_int64 307514352857007765L);(* 16, 17 *) +(mk_real_int64 393491271648668697L),(mk_real_int64 62937123177410860L);(* 17, 16 *) +(mk_real_int64 683812585302996812L),(mk_real_int64 45449088773707160L);(* 17, 16 *) +(mk_real_int64 236455448093063344L),(mk_real_int64 766942110506460591L);(* 17, 17 *) +(mk_real_int64 95646258873971960L),(mk_real_int64 196263107194503972L);(* 16, 17 *) +(mk_real_int64 196544078903723040L),(mk_real_int64 111499757545873270L);(* 17, 17 *) +(mk_real_int64 657753565991728392L),(mk_real_int64 294974608343260340L);(* 17, 17 *) +(mk_real_int64 227725097514624255L),(mk_real_int64 24845876191717988L);(* 17, 16 *) +(mk_real_int64 711427827948594624L),(mk_real_int64 536975540302481448L);(* 17, 17 *) +(mk_real_int64 198634711104299430L),(mk_real_int64 251619941516349532L);(* 17, 17 *) +(mk_real_int64 535658038560687174L),(mk_real_int64 36855341637391728L);(* 17, 16 *) +(mk_real_int64 7527954595002825L),(mk_real_int64 578297599242777180L);(* 15, 17 *) +(mk_real_int64 143935275495457800L),(mk_real_int64 501315176991445116L);(* 17, 17 *) +(mk_real_int64 42312215579068512L),(mk_real_int64 291745732504001760L);(* 16, 17 *) +(mk_real_int64 4376044718667753L),(mk_real_int64 12498334937909835L);(* 15, 16 *) +(mk_real_int64 190202776130624240L),(mk_real_int64 317076479065475838L);(* 17, 17 *) +(mk_real_int64 440538805958922063L),(mk_real_int64 893034731045406807L);(* 17, 17 *) +(mk_real_int64 680165557303656460L),(mk_real_int64 478236709963851762L);(* 17, 17 *) +(mk_real_int64 37049082325054749L),(mk_real_int64 421176144561881446L);(* 16, 17 *) +(mk_real_int64 299105370770375661L),(mk_real_int64 85425107536710292L);(* 17, 16 *) +(mk_real_int64 67433391948385890L),(mk_real_int64 156219513133267969L);(* 16, 17 *) +(mk_real_int64 229251953226132586L),(mk_real_int64 349874996308937495L);(* 17, 17 *) +(mk_real_int64 27152596689423411L),(mk_real_int64 124458308343775314L);(* 16, 17 *) +(mk_real_int64 324550243136308488L),(mk_real_int64 348621898431194546L);(* 17, 17 *) +(mk_real_int64 3404623470361015L),(mk_real_int64 208778859696372669L);(* 15, 17 *) +(mk_real_int64 71955317877020544L),(mk_real_int64 236172215821516624L);(* 16, 17 *) +(mk_real_int64 871185625987423034L),(mk_real_int64 135650618364233520L);(* 17, 17 *) +(mk_real_int64 359102803375130388L),(mk_real_int64 563540458036194819L);(* 17, 17 *) +(mk_real_int64 341715459547967820L),(mk_real_int64 109658830457248992L);(* 17, 17 *) +(mk_real_int64 59006283293639610L),(mk_real_int64 252538158661749100L);(* 16, 17 *) +(mk_real_int64 30020057115869704L),(mk_real_int64 393812864292377852L);(* 16, 17 *) +(mk_real_int64 205986414112689444L),(mk_real_int64 1159244375316120L);(* 17, 15 *) +(mk_real_int64 53799437234710998L),(mk_real_int64 449872350498821358L);(* 16, 17 *) +(mk_real_int64 560319387270645308L),(mk_real_int64 678094921304502912L);(* 17, 17 *) +(mk_real_int64 97505848669525961L),(mk_real_int64 16464827738268584L);(* 16, 16 *) +(mk_real_int64 72482493056156928L),(mk_real_int64 159053078429255120L);(* 16, 17 *) +(mk_real_int64 325101240400510274L),(mk_real_int64 92009505566696716L);(* 17, 16 *) +(mk_real_int64 23085921324146800L),(mk_real_int64 205509583682664066L);(* 16, 17 *) +(mk_real_int64 29818640585443872L),(mk_real_int64 148008669567525104L);(* 16, 17 *) +(mk_real_int64 106612038859912470L),(mk_real_int64 345760306683501828L);(* 17, 17 *) +(mk_real_int64 11184785044380255L),(mk_real_int64 130876791833643255L);(* 16, 17 *) +(mk_real_int64 273687032090948400L),(mk_real_int64 16959732329964152L);(* 17, 16 *) +(mk_real_int64 145972708563073340L),(mk_real_int64 91999379160339312L);(* 17, 16 *) +(mk_real_int64 588703340234359992L),(mk_real_int64 145457586545942504L);(* 17, 17 *) +(mk_real_int64 222088761109606600L),(mk_real_int64 40920521901355395L);(* 17, 16 *) +(mk_real_int64 122950554769918735L),(mk_real_int64 216120054808213164L);(* 17, 17 *) +(mk_real_int64 745110061683934584L),(mk_real_int64 503809707130100304L);(* 17, 17 *) +(mk_real_int64 361418581471626432L),(mk_real_int64 479760028542834996L);(* 17, 17 *) +(mk_real_int64 64047583705729632L),(mk_real_int64 109159068275009612L);(* 16, 17 *) +(mk_real_int64 222251373766624006L),(mk_real_int64 779288998712127207L);(* 17, 17 *) +(mk_real_int64 24738894062152611L),(mk_real_int64 59472745302516150L);(* 16, 16 *) +(mk_real_int64 115488616195994680L),(mk_real_int64 252784105965486576L);(* 17, 17 *) +(mk_real_int64 342500018982039072L),(mk_real_int64 320764335449866614L);(* 17, 17 *) +(mk_real_int64 7536670133451927L),(mk_real_int64 60339530795479360L);(* 15, 16 *) +(mk_real_int64 51036410965356257L),(mk_real_int64 203102254067186208L);(* 16, 17 *) +(mk_real_int64 5073267793058696L),(mk_real_int64 716946310451578680L);(* 15, 17 *) +(mk_real_int64 454545788414598181L),(mk_real_int64 921283123522146L);(* 17, 14 *) +(mk_real_int64 5469369972227032L),(mk_real_int64 321992199206833638L);(* 15, 17 *) +(mk_real_int64 92531941442587572L),(mk_real_int64 29628958330353021L);(* 16, 16 *) +(mk_real_int64 55766593837271040L),(mk_real_int64 406733957429677280L);(* 16, 17 *) +(mk_real_int64 18030480689736120L),(mk_real_int64 102280659071464965L);(* 16, 17 *) +(mk_real_int64 295968148353485055L),(mk_real_int64 30333286834670495L);(* 17, 16 *) +(mk_real_int64 217914640067007856L),(mk_real_int64 668426766942359089L);(* 17, 17 *) +(mk_real_int64 386169873414707930L),(mk_real_int64 202363639892105652L);(* 17, 17 *) +(mk_real_int64 190564133398151841L),(mk_real_int64 379284879307229328L);(* 17, 17 *) +(mk_real_int64 142611111947983833L),(mk_real_int64 161347081704455680L);(* 17, 17 *) +(mk_real_int64 535995834008423700L),(mk_real_int64 62399799331398523L);(* 17, 16 *) +(mk_real_int64 95952315379167546L),(mk_real_int64 74005856147147176L);(* 16, 16 *) +(mk_real_int64 498776542144479936L),(mk_real_int64 239307031709724860L);(* 17, 17 *) +(mk_real_int64 331507016234909159L),(mk_real_int64 415088128288339002L);(* 17, 17 *) +(mk_real_int64 476480090139910838L),(mk_real_int64 310198958983844690L);(* 17, 17 *) +(mk_real_int64 10483790480830320L),(mk_real_int64 581633437425680750L);(* 16, 17 *) +(mk_real_int64 407793212755189440L),(mk_real_int64 313029237083503200L);(* 17, 17 *) +(mk_real_int64 8857688605585647L),(mk_real_int64 56349810741436078L);(* 15, 16 *) +(mk_real_int64 199741859949628314L),(mk_real_int64 244869802544418540L);(* 17, 17 *) +(mk_real_int64 61436800723215897L),(mk_real_int64 66351149466140982L);(* 16, 16 *) +(mk_real_int64 229074624892492624L),(mk_real_int64 137747323125799403L);(* 17, 17 *) +(mk_real_int64 23680724168227016L),(mk_real_int64 457064614716083922L);(* 16, 17 *) +(mk_real_int64 135922210174223886L),(mk_real_int64 35828964697400160L);(* 17, 16 *) +(mk_real_int64 168856535922700990L),(mk_real_int64 363491046369203558L);(* 17, 17 *) +(mk_real_int64 182009255609432160L),(mk_real_int64 575055304886640270L);(* 17, 17 *) +(mk_real_int64 208212541926871524L),(mk_real_int64 132146049980955479L);(* 17, 17 *) +(mk_real_int64 127332952851360306L),(mk_real_int64 235031200652394190L);(* 17, 17 *) +(mk_real_int64 9029153171294760L),(mk_real_int64 130059053128835080L);(* 15, 17 *) +(mk_real_int64 301466824069340755L),(mk_real_int64 983249445501630L);(* 17, 14 *) +(mk_real_int64 746180663030933360L),(mk_real_int64 173520366663593952L);(* 17, 17 *) +(mk_real_int64 58486989805413218L),(mk_real_int64 75514031476451645L);(* 16, 16 *) +(mk_real_int64 182438406328915145L),(mk_real_int64 451297356761033568L);(* 17, 17 *) +(mk_real_int64 13819262630206200L),(mk_real_int64 89006413325831939L);(* 16, 16 *) +(mk_real_int64 251197757828780732L),(mk_real_int64 638363789773816834L);(* 17, 17 *) +(mk_real_int64 152736915466691248L),(mk_real_int64 283619989933277007L);(* 17, 17 *) +(mk_real_int64 121130032250304168L),(mk_real_int64 37152797043406563L);(* 17, 16 *) +(mk_real_int64 263994620405030685L),(mk_real_int64 397038399465778000L);(* 17, 17 *) +(mk_real_int64 103106446127621405L),(mk_real_int64 272272732440987798L);(* 17, 17 *) +(mk_real_int64 400673537413237970L),(mk_real_int64 9263736331827680L);(* 17, 15 *) +(mk_real_int64 531614303185912005L),(mk_real_int64 195839139748123744L);(* 17, 17 *) +(mk_real_int64 305876508529382800L),(mk_real_int64 133228306938368L);(* 17, 14 *) +(mk_real_int64 812168617662155990L),(mk_real_int64 147413738255595240L);(* 17, 17 *) +(mk_real_int64 162297956943142118L),(mk_real_int64 101708348125687810L);(* 17, 17 *) +(mk_real_int64 433496891151348882L),(mk_real_int64 37694441514423550L);(* 17, 16 *) +(mk_real_int64 85473914484837970L),(mk_real_int64 106100201076501060L);(* 16, 17 *) +(mk_real_int64 81656765262615060L),(mk_real_int64 11732945262301840L);(* 16, 16 *) +(mk_real_int64 343287849250124700L),(mk_real_int64 31038832199918213L);(* 17, 16 *) +(mk_real_int64 864273540846398592L),(mk_real_int64 17528389391613380L);(* 17, 16 *) +(mk_real_int64 444581262464597L),(mk_real_int64 478513787820283827L);(* 14, 17 *) +(mk_real_int64 384798851493251446L),(mk_real_int64 44621943606777114L);(* 17, 16 *) +(mk_real_int64 60193580767447120L),(mk_real_int64 119081512917922030L);(* 16, 17 *) +(mk_real_int64 217592667270940910L),(mk_real_int64 12918587421730662L);(* 17, 16 *) +(mk_real_int64 25543856085636600L),(mk_real_int64 149411224244210577L);(* 16, 17 *) +(mk_real_int64 548685113327138700L),(mk_real_int64 132439015597735979L);(* 17, 17 *) +(mk_real_int64 50702202434371113L),(mk_real_int64 153259410432667140L);(* 16, 17 *) +(mk_real_int64 212670612297368L),(mk_real_int64 152646018772595282L);(* 14, 17 *) +(mk_real_int64 9398550639602350L),(mk_real_int64 109285038251745408L);(* 15, 17 *) +(mk_real_int64 195735175389224220L),(mk_real_int64 65909645514966045L);(* 17, 16 *) +(mk_real_int64 13050466242967296L),(mk_real_int64 294695140372941680L);(* 16, 17 *) +(mk_real_int64 322536050414181578L),(mk_real_int64 65587528251929095L);(* 17, 16 *) +(mk_real_int64 567228631900235625L),(mk_real_int64 418535050108566352L);(* 17, 17 *) +(mk_real_int64 359716527290209680L),(mk_real_int64 178680639115499444L);(* 17, 17 *) +(mk_real_int64 134675447156571436L),(mk_real_int64 239468991290438280L);(* 17, 17 *) +(mk_real_int64 52640661601250412L),(mk_real_int64 221611620347699462L);(* 16, 17 *) +(mk_real_int64 8593585849344808L),(mk_real_int64 60382316014617380L);(* 15, 16 *) +(mk_real_int64 29526377923331844L),(mk_real_int64 289346592082006684L);(* 16, 17 *) +(mk_real_int64 14900514608590758L),(mk_real_int64 38060565166686860L);(* 16, 16 *) +(mk_real_int64 2500846013626656L),(mk_real_int64 306266011514444802L);(* 15, 17 *) +(mk_real_int64 31754513352044415L),(mk_real_int64 64453635938894880L);(* 16, 16 *) +(mk_real_int64 619306183693446318L),(mk_real_int64 647265304374681980L);(* 17, 17 *) +(mk_real_int64 399783260600307683L),(mk_real_int64 1590711591338816L);(* 17, 15 *) +(mk_real_int64 38271444177252440L),(mk_real_int64 28470986909003709L);(* 16, 16 *) +(mk_real_int64 49234943667239070L),(mk_real_int64 3045316701912904L);(* 16, 15 *) +(mk_real_int64 174434346505389492L),(mk_real_int64 14214848254723970L);(* 17, 16 *) +(mk_real_int64 162102288946819670L),(mk_real_int64 158806596271052835L);(* 17, 17 *) +(mk_real_int64 44188349701310145L),(mk_real_int64 69874761950848848L);(* 16, 16 *) +(mk_real_int64 41753283518651936L),(mk_real_int64 140189930041789140L);(* 16, 17 *) +(mk_real_int64 21492823394400190L),(mk_real_int64 114357455324274742L);(* 16, 17 *) +(mk_real_int64 317122132163156460L),(mk_real_int64 32864027802422875L);(* 17, 16 *) +(mk_real_int64 269459489144852370L),(mk_real_int64 53731832959018116L);(* 17, 16 *) +(mk_real_int64 1755495090541608L),(mk_real_int64 680348411229582366L);(* 15, 17 *) +(mk_real_int64 325450714537315080L),(mk_real_int64 240701242117938732L);(* 17, 17 *) +(mk_real_int64 11675168942651088L),(mk_real_int64 180837447858264092L);(* 16, 17 *) +(mk_real_int64 199586973565389740L),(mk_real_int64 584827043267803955L);(* 17, 17 *) +(mk_real_int64 519757143929621952L),(mk_real_int64 115215000505827792L);(* 17, 17 *) +(mk_real_int64 228901291121299536L),(mk_real_int64 166107144289808995L);(* 17, 17 *) +(mk_real_int64 110256899984893960L),(mk_real_int64 94250039733365111L);(* 17, 16 *) +(mk_real_int64 20881595075859840L),(mk_real_int64 456116293043596820L);(* 16, 17 *) +(mk_real_int64 170199638014602180L),(mk_real_int64 445452794101254632L);(* 17, 17 *) +(mk_real_int64 325123249773875927L),(mk_real_int64 221694834071874800L);(* 17, 17 *) +(mk_real_int64 363111962916667852L),(mk_real_int64 356416423234506750L);(* 17, 17 *) +(mk_real_int64 326981312664076720L),(mk_real_int64 324301112702375263L);(* 17, 17 *) +(mk_real_int64 276875940729903200L),(mk_real_int64 328684337227569319L);(* 17, 17 *) +(mk_real_int64 618503564531835L),(mk_real_int64 140964281311281630L);(* 14, 17 *) +(mk_real_int64 31719442074907275L),(mk_real_int64 191497833873471395L);(* 16, 17 *) +(mk_real_int64 137156963954724970L),(mk_real_int64 330971357509405888L);(* 17, 17 *) +(mk_real_int64 72966112399229232L),(mk_real_int64 166121922852055396L);(* 16, 17 *) +(mk_real_int64 662179135599193896L),(mk_real_int64 40061468175331140L);(* 17, 16 *) +(mk_real_int64 215383144596181548L),(mk_real_int64 26648831051211425L);(* 17, 16 *) +(mk_real_int64 322173735589951960L),(mk_real_int64 242941596763714090L);(* 17, 17 *) +(mk_real_int64 363578889618560302L),(mk_real_int64 234960520082923068L);(* 17, 17 *) +(mk_real_int64 523238402390966400L),(mk_real_int64 337491466628723620L);(* 17, 17 *) +(mk_real_int64 31519314667009180L),(mk_real_int64 579841056333224751L);(* 16, 17 *) +(mk_real_int64 109017346836836304L),(mk_real_int64 32885159804207640L);(* 17, 16 *) +(mk_real_int64 185651726506320966L),(mk_real_int64 233841680895092230L);(* 17, 17 *) +(mk_real_int64 10960671338035380L),(mk_real_int64 650358741227734184L);(* 16, 17 *) +(mk_real_int64 47263468351578128L),(mk_real_int64 282792510460582857L);(* 16, 17 *) +(mk_real_int64 793549667027214839L),(mk_real_int64 88040219740318170L);(* 17, 16 *) +(mk_real_int64 335398728970647900L),(mk_real_int64 663685179874661331L);(* 17, 17 *) +(mk_real_int64 75674486248624386L),(mk_real_int64 76179155741421720L);(* 16, 16 *) +(mk_real_int64 359541162114242832L),(mk_real_int64 20546505576975352L);(* 17, 16 *) +(mk_real_int64 502159561777520892L),(mk_real_int64 23916740460208200L);(* 17, 16 *) +(mk_real_int64 464267909803572770L),(mk_real_int64 62155301715071390L);(* 17, 16 *) +(mk_real_int64 249764117659684661L),(mk_real_int64 356337950803418475L);(* 17, 17 *) +(mk_real_int64 304323019404668770L),(mk_real_int64 247135260325725250L);(* 17, 17 *) +(mk_real_int64 317142706086137318L),(mk_real_int64 146424868516807220L);(* 17, 17 *) +(mk_real_int64 246637813304621530L),(mk_real_int64 635318301473187380L);(* 17, 17 *) +(mk_real_int64 36493606281527064L),(mk_real_int64 50121185194755196L);(* 16, 16 *) +(mk_real_int64 56660129567743824L),(mk_real_int64 56737312115843232L);(* 16, 16 *) +(mk_real_int64 620408719927368558L),(mk_real_int64 617406520259732433L);(* 17, 17 *) +(mk_real_int64 11163115822194906L),(mk_real_int64 8157877628814816L);(* 16, 15 *) +(mk_real_int64 600037644342656306L),(mk_real_int64 87486818799947280L);(* 17, 16 *) +(mk_real_int64 271009067929780368L),(mk_real_int64 747585271145609402L);(* 17, 17 *) +(mk_real_int64 771840699546069900L),(mk_real_int64 588341334039643140L);(* 17, 17 *) +(mk_real_int64 106578562655071752L),(mk_real_int64 252527556390580188L);(* 17, 17 *) +(mk_real_int64 225289348505247612L),(mk_real_int64 45458350309807560L);(* 17, 16 *) +(mk_real_int64 327517597885524536L),(mk_real_int64 295769811303097549L);(* 17, 17 *) +(mk_real_int64 224947959761813248L),(mk_real_int64 81531223308189244L);(* 17, 16 *) +(mk_real_int64 9879288157918288L),(mk_real_int64 57109329090843700L);(* 15, 16 *) +(mk_real_int64 489684519570241311L),(mk_real_int64 275340445109356200L);(* 17, 17 *) +(mk_real_int64 632394256346331012L),(mk_real_int64 4109162784837390L);(* 17, 15 *) +(mk_real_int64 119116823842730074L),(mk_real_int64 585102241508406346L);(* 17, 17 *) +(mk_real_int64 124733913253405728L),(mk_real_int64 295261908438735054L);(* 17, 17 *) +(mk_real_int64 9402516412382304L),(mk_real_int64 98562126947697075L);(* 15, 16 *) +(mk_real_int64 762447903651976154L),(mk_real_int64 88954522809503782L);(* 17, 16 *) +(mk_real_int64 471644751757414580L),(mk_real_int64 50361805537691571L);(* 17, 16 *) +(mk_real_int64 754305307490470050L),(mk_real_int64 286070872467533500L);(* 17, 17 *) +(mk_real_int64 382339139599808820L),(mk_real_int64 9087528998115040L);(* 17, 15 *) +(mk_real_int64 676895764060895754L),(mk_real_int64 438302030974332110L);(* 17, 17 *) +(mk_real_int64 250734033511892091L),(mk_real_int64 379719080052221610L);(* 17, 17 *) +(mk_real_int64 135948236040499820L),(mk_real_int64 66424862932572960L);(* 17, 16 *) +(mk_real_int64 129871176710817185L),(mk_real_int64 139767848415195639L);(* 17, 17 *) +(mk_real_int64 347255803217270220L),(mk_real_int64 381062465965689541L);(* 17, 17 *) +(mk_real_int64 52478169947878215L),(mk_real_int64 131436405010956474L);(* 16, 17 *) +(mk_real_int64 180531012721495744L),(mk_real_int64 443608448341991328L);(* 17, 17 *) +(mk_real_int64 72245903238289074L),(mk_real_int64 672261464428338582L);(* 16, 17 *) +(mk_real_int64 78701102536979250L),(mk_real_int64 3310952884532885L);(* 16, 15 *) +(mk_real_int64 421245902344450932L),(mk_real_int64 69440209438615656L);(* 17, 16 *) +(mk_real_int64 156630693464266545L),(mk_real_int64 502568160881995045L);(* 17, 17 *) +(mk_real_int64 366481174077495750L),(mk_real_int64 299511852435647412L);(* 17, 17 *) +(mk_real_int64 296434880915962880L),(mk_real_int64 349324011158639472L);(* 17, 17 *) +(mk_real_int64 347788600716983184L),(mk_real_int64 391712416764112605L);(* 17, 17 *) +(mk_real_int64 130558000080487650L),(mk_real_int64 214177563933272335L);(* 17, 17 *) +(mk_real_int64 116633318688157126L),(mk_real_int64 259482392938442640L);(* 17, 17 *) +(mk_real_int64 115798391914472000L),(mk_real_int64 15911217431489028L);(* 17, 16 *) +(mk_real_int64 62865805432806312L),(mk_real_int64 11684680772064144L);(* 16, 16 *) +(mk_real_int64 12701693110122529L),(mk_real_int64 341948864526628720L);(* 16, 17 *) +(mk_real_int64 34672340426360490L),(mk_real_int64 281634089042179272L);(* 16, 17 *) +(mk_real_int64 25774146398909950L),(mk_real_int64 3733728996040600L);(* 16, 15 *) +(mk_real_int64 86985518108563089L),(mk_real_int64 64561483497787515L);(* 16, 16 *) +(mk_real_int64 290594092303558290L),(mk_real_int64 256552414995652362L);(* 17, 17 *) +(mk_real_int64 48374153671476608L),(mk_real_int64 22016447217828486L);(* 16, 16 *) +(mk_real_int64 68858913199392255L),(mk_real_int64 37337040380932204L);(* 16, 16 *) +(mk_real_int64 292733808455942300L),(mk_real_int64 432247011448038549L);(* 17, 17 *) +(mk_real_int64 225799538014044908L),(mk_real_int64 199756931403223223L);(* 17, 17 *) +(mk_real_int64 867052349059168325L),(mk_real_int64 36585750957279200L);(* 17, 16 *) +(mk_real_int64 37909515109507080L),(mk_real_int64 221731287228613719L);(* 16, 17 *) +(mk_real_int64 13429066143364650L),(mk_real_int64 245248258702886610L);(* 16, 17 *) +(mk_real_int64 184593801636927360L),(mk_real_int64 469255574233047232L);(* 17, 17 *) +(mk_real_int64 258111718919554358L),(mk_real_int64 58707802620411476L);(* 17, 16 *) +(mk_real_int64 23157823586872410L),(mk_real_int64 501770041902910566L);(* 16, 17 *) +(mk_real_int64 487638582633736487L),(mk_real_int64 9158748958960500L);(* 17, 15 *) +(mk_real_int64 242485647513638950L),(mk_real_int64 6009335672906784L);(* 17, 15 *) +(mk_real_int64 39022830127389810L),(mk_real_int64 95266812491246794L);(* 16, 16 *) +(mk_real_int64 210907209845871422L),(mk_real_int64 4505705938886544L);(* 17, 15 *) +(mk_real_int64 347388785593813725L),(mk_real_int64 92329020210157200L);(* 17, 16 *) +(mk_real_int64 19405205110530058L),(mk_real_int64 626825034770971256L);(* 16, 17 *) +(mk_real_int64 10027279149285741L),(mk_real_int64 84053163187888972L);(* 16, 16 *) +(mk_real_int64 28816660288789191L),(mk_real_int64 251663084776003450L);(* 16, 17 *) +(mk_real_int64 125366116255098600L),(mk_real_int64 65625056548741812L);(* 17, 16 *) +(mk_real_int64 1747807045623320L),(mk_real_int64 42875789802173660L);(* 15, 16 *) +(mk_real_int64 62166212445147426L),(mk_real_int64 174772598523477474L);(* 16, 17 *) +(mk_real_int64 4634504272791316L),(mk_real_int64 389218161147703956L);(* 15, 17 *) +(mk_real_int64 53118155463315404L),(mk_real_int64 204684784150231890L);(* 16, 17 *) +(mk_real_int64 188598633989126425L),(mk_real_int64 391239494720695832L);(* 17, 17 *) +(mk_real_int64 49042499816042048L),(mk_real_int64 411543903154483706L);(* 16, 17 *) +(mk_real_int64 105948106070871059L),(mk_real_int64 494971127467061028L);(* 17, 17 *) +(mk_real_int64 510411998636942381L),(mk_real_int64 4094714141895354L);(* 17, 15 *) +(mk_real_int64 102800962709287268L),(mk_real_int64 279079732365018740L);(* 17, 17 *) +(mk_real_int64 246267718419420048L),(mk_real_int64 425257460757118404L);(* 17, 17 *) +(mk_real_int64 277777553279745408L),(mk_real_int64 203886464930639937L);(* 17, 17 *) +(mk_real_int64 187762349581660620L),(mk_real_int64 489466117031376375L);(* 17, 17 *) +(mk_real_int64 104972444463237032L),(mk_real_int64 1520363773240480L);(* 17, 15 *) +(mk_real_int64 300977754901383936L),(mk_real_int64 256688257412093871L);(* 17, 17 *) +(mk_real_int64 131520776355337380L),(mk_real_int64 155728212297871099L);(* 17, 17 *) +(mk_real_int64 81226700792260128L),(mk_real_int64 253200981232851974L);(* 16, 17 *) +(mk_real_int64 439742937600173704L),(mk_real_int64 357566547063273975L);(* 17, 17 *) +(mk_real_int64 149434602909944930L),(mk_real_int64 61049175436478463L);(* 17, 16 *) +(mk_real_int64 212104290296339773L),(mk_real_int64 391710468618109840L);(* 17, 17 *) +(mk_real_int64 179478716247689800L),(mk_real_int64 44214260580503509L);(* 17, 16 *) +(mk_real_int64 452992986808639542L),(mk_real_int64 262759542547948578L);(* 17, 17 *) +(mk_real_int64 14461562773966394L),(mk_real_int64 312052038103269540L);(* 16, 17 *) +(mk_real_int64 2166951230704338L),(mk_real_int64 4242598754495763L);(* 15, 15 *) +(mk_real_int64 25483256874681012L),(mk_real_int64 312957282989132600L);(* 16, 17 *) +(mk_real_int64 266270925102595950L),(mk_real_int64 16700160707790920L);(* 17, 16 *) +(mk_real_int64 711670373430384024L),(mk_real_int64 9026168794509348L);(* 17, 15 *) +(mk_real_int64 601059720946448883L),(mk_real_int64 519743191546926731L);(* 17, 17 *) +(mk_real_int64 133699211141907465L),(mk_real_int64 347952807432327589L);(* 17, 17 *) +(mk_real_int64 99864889578374400L),(mk_real_int64 78020592391040075L);(* 16, 16 *) +(mk_real_int64 364074224072180L),(mk_real_int64 786806229974465040L);(* 14, 17 *) +(mk_real_int64 731942186003430150L),(mk_real_int64 233428789336079412L);(* 17, 17 *) +(mk_real_int64 192343093131202230L),(mk_real_int64 247411404511450864L);(* 17, 17 *) +(mk_real_int64 136851384183953712L),(mk_real_int64 650630476336004108L);(* 17, 17 *) +(mk_real_int64 355397561005550416L),(mk_real_int64 100815433997218248L);(* 17, 17 *) +(mk_real_int64 99766375486658910L),(mk_real_int64 626732031538528095L);(* 16, 17 *) +(mk_real_int64 353917875141915748L),(mk_real_int64 84092423658133878L);(* 17, 16 *) +(mk_real_int64 194495292154321126L),(mk_real_int64 9813152945288304L);(* 17, 15 *) +(mk_real_int64 860828654578504899L),(mk_real_int64 686628945523857600L);(* 17, 17 *) +(mk_real_int64 166325255123767740L),(mk_real_int64 303052090130874405L);(* 17, 17 *) +(mk_real_int64 181092365537175081L),(mk_real_int64 77965632368170866L);(* 17, 16 *) +(mk_real_int64 359699913048241872L),(mk_real_int64 308831817723027572L);(* 17, 17 *) +(mk_real_int64 15741948481811244L),(mk_real_int64 67779715077021522L);(* 16, 16 *) +(mk_real_int64 6796682935031584L),(mk_real_int64 161201192421263900L);(* 15, 17 *) +(mk_real_int64 15632966247819424L),(mk_real_int64 455350778392759451L);(* 16, 17 *) +(mk_real_int64 326891916932835888L),(mk_real_int64 755266648992100002L);(* 17, 17 *) +(mk_real_int64 186012666572402056L),(mk_real_int64 90204203006729952L);(* 17, 16 *) +(mk_real_int64 745545065773481921L),(mk_real_int64 28261683130750848L);(* 17, 16 *) +(mk_real_int64 91683597967971680L),(mk_real_int64 14758852351053330L);(* 16, 16 *) +(mk_real_int64 628044769387649985L),(mk_real_int64 24489397147014960L);(* 17, 16 *) +(mk_real_int64 195458693032701900L),(mk_real_int64 188082605425813862L);(* 17, 17 *) +(mk_real_int64 223727976987860070L),(mk_real_int64 4360332914249166L);(* 17, 15 *) +(mk_real_int64 49401604364971117L),(mk_real_int64 258748626842429085L);(* 16, 17 *) +(mk_real_int64 393278439209933820L),(mk_real_int64 100742743980640125L);(* 17, 17 *) +(mk_real_int64 191110218283001160L),(mk_real_int64 77308921537454863L);(* 17, 16 *) +(mk_real_int64 22693878678601600L),(mk_real_int64 117942525828599121L);(* 16, 17 *) +(mk_real_int64 5093296744366008L),(mk_real_int64 295810800009685701L);(* 15, 17 *) +(mk_real_int64 75456914080229280L),(mk_real_int64 341287088725970022L);(* 16, 17 *) +(mk_real_int64 193638807054800310L),(mk_real_int64 581097421202856802L);(* 17, 17 *) +(mk_real_int64 41352409989390720L),(mk_real_int64 210691788830722620L);(* 16, 17 *) +(mk_real_int64 544311083696580612L),(mk_real_int64 544257755160116340L);(* 17, 17 *) +(mk_real_int64 10268168936144398L),(mk_real_int64 12118926933488816L);(* 16, 16 *) +(mk_real_int64 371267116859843730L),(mk_real_int64 774390458911136606L);(* 17, 17 *) +(mk_real_int64 538406272662200506L),(mk_real_int64 897462746811145650L);(* 17, 17 *) +(mk_real_int64 22291454001651575L),(mk_real_int64 146072925944970990L);(* 16, 17 *) +(mk_real_int64 14654718776377708L),(mk_real_int64 148939423919324220L);(* 16, 17 *) +(mk_real_int64 70432538555545418L),(mk_real_int64 297717274758711500L);(* 16, 17 *) +(mk_real_int64 166697116771735692L),(mk_real_int64 365281182465954700L);(* 17, 17 *) +(mk_real_int64 90222334039348506L),(mk_real_int64 85208738269727616L);(* 16, 16 *) +(mk_real_int64 496111698942030003L),(mk_real_int64 18655030212288016L);(* 17, 16 *) +(mk_real_int64 230518753381871790L),(mk_real_int64 849253246116793920L);(* 17, 17 *) +(mk_real_int64 371059785357853590L),(mk_real_int64 411838448864260128L);(* 17, 17 *) +(mk_real_int64 354259460966857307L),(mk_real_int64 802128091797661893L);(* 17, 17 *) +(mk_real_int64 71337939285542040L),(mk_real_int64 498931544933022914L);(* 16, 17 *) +(mk_real_int64 53678803283507898L),(mk_real_int64 468155478728409885L);(* 16, 17 *) +(mk_real_int64 148819745765631962L),(mk_real_int64 119453894386003500L);(* 17, 17 *) +(mk_real_int64 904760984587626069L),(mk_real_int64 256027712066025540L);(* 17, 17 *) +(mk_real_int64 232065928115177948L),(mk_real_int64 114287366167416310L);(* 17, 17 *) +(mk_real_int64 152672205429483272L),(mk_real_int64 568246829396111752L);(* 17, 17 *) +(mk_real_int64 100995865086032465L),(mk_real_int64 11310524696533719L);(* 17, 16 *) +(mk_real_int64 186389799194979448L),(mk_real_int64 190753739422509921L);(* 17, 17 *) +(mk_real_int64 168829396007173080L),(mk_real_int64 595689573012885931L);(* 17, 17 *) +(mk_real_int64 210943999499709564L),(mk_real_int64 93154816133918112L);(* 17, 16 *) +(mk_real_int64 36456230028725676L),(mk_real_int64 826982409627260712L);(* 16, 17 *) +(mk_real_int64 9089121208105666L),(mk_real_int64 21226501340240667L);(* 15, 16 *) +(mk_real_int64 459161880645325198L),(mk_real_int64 12203201503937752L);(* 17, 16 *) +(mk_real_int64 142727185040516497L),(mk_real_int64 931152520204456435L);(* 17, 17 *) +(mk_real_int64 66245316686005776L),(mk_real_int64 422573665432328262L);(* 16, 17 *) +(mk_real_int64 52229806412610450L),(mk_real_int64 880120471149534330L);(* 16, 17 *) +(mk_real_int64 157169173152858810L),(mk_real_int64 207461523809505060L);(* 17, 17 *) +(mk_real_int64 130425446679672484L),(mk_real_int64 5710202329867816L);(* 17, 15 *) +(mk_real_int64 234590577474221280L),(mk_real_int64 218645118178581056L);(* 17, 17 *) +(mk_real_int64 146116789517563680L),(mk_real_int64 148724655234246813L);(* 17, 17 *) +(mk_real_int64 177210195386899408L),(mk_real_int64 707418746897103104L);(* 17, 17 *) +(mk_real_int64 696273371928173520L),(mk_real_int64 13111998616981799L);(* 17, 16 *) +(mk_real_int64 369144905073156179L),(mk_real_int64 447871769170193121L);(* 17, 17 *) +(mk_real_int64 261556580390938302L),(mk_real_int64 248652283714420680L);(* 17, 17 *) +(mk_real_int64 29129004534852180L),(mk_real_int64 165904299320848704L);(* 16, 17 *) +(mk_real_int64 356821541154757536L),(mk_real_int64 206833497379075210L);(* 17, 17 *) +(mk_real_int64 163738327735650690L),(mk_real_int64 469535868143783624L);(* 17, 17 *) +(mk_real_int64 390650133026481985L),(mk_real_int64 155080393089333915L);(* 17, 17 *) +(mk_real_int64 50404703987358414L),(mk_real_int64 356118081793979610L);(* 16, 17 *) +(mk_real_int64 32568769546106409L),(mk_real_int64 434661770518349732L);(* 16, 17 *) +(mk_real_int64 20332203202549910L),(mk_real_int64 8918688988766223L);(* 16, 15 *) +(mk_real_int64 488967417474265277L),(mk_real_int64 1965813342753946L);(* 17, 15 *) +(mk_real_int64 263663509550159264L),(mk_real_int64 16600888116415890L);(* 17, 16 *) +(mk_real_int64 84300216206278378L),(mk_real_int64 439803583284153896L);(* 16, 17 *) +(mk_real_int64 312848116933632523L),(mk_real_int64 152356748937403824L);(* 17, 17 *) +(mk_real_int64 209540559484061415L),(mk_real_int64 1551108060821646L);(* 17, 15 *) +(mk_real_int64 17386666711985491L),(mk_real_int64 294602829982765544L);(* 16, 17 *) +(mk_real_int64 484492416858935484L),(mk_real_int64 85794693728147514L);(* 17, 16 *) +(mk_real_int64 24372545287642674L),(mk_real_int64 43075206256836746L);(* 16, 16 *) +(mk_real_int64 432094512993548445L),(mk_real_int64 11551911778098185L);(* 17, 16 *) +(mk_real_int64 131418918284629968L),(mk_real_int64 76473628247266480L);(* 17, 16 *) +(mk_real_int64 152519938871818544L),(mk_real_int64 814803367645219824L);(* 17, 17 *) +(mk_real_int64 559770470213342646L),(mk_real_int64 137676242235612114L);(* 17, 17 *) +(mk_real_int64 182252539223136690L),(mk_real_int64 401793393661529955L);(* 17, 17 *) +(mk_real_int64 374666662939408515L),(mk_real_int64 122804154075680544L);(* 17, 17 *) +(mk_real_int64 56544640550303950L),(mk_real_int64 272784156676652502L);(* 16, 17 *) +(mk_real_int64 291495160776037608L),(mk_real_int64 6869634395566059L);(* 17, 15 *) +(mk_real_int64 76035179482527328L),(mk_real_int64 109154862425922936L);(* 16, 17 *) +(mk_real_int64 73507590599888720L),(mk_real_int64 151415412000890160L);(* 16, 17 *) +(mk_real_int64 12976671050689476L),(mk_real_int64 304761843656700040L);(* 16, 17 *) +(mk_real_int64 306336033537339608L),(mk_real_int64 92908961156132248L);(* 17, 16 *) +(mk_real_int64 296802536444184320L),(mk_real_int64 471595376275064076L);(* 17, 17 *) +(mk_real_int64 265248536227550008L),(mk_real_int64 485474214446145529L);(* 17, 17 *) +(mk_real_int64 317196419626351915L),(mk_real_int64 816253754302619732L);(* 17, 17 *) +(mk_real_int64 153527692971084520L),(mk_real_int64 11557641893607440L);(* 17, 16 *) +(mk_real_int64 676888268015492361L),(mk_real_int64 151831926674149920L);(* 17, 17 *) +(mk_real_int64 434172341809240414L),(mk_real_int64 725355431554870674L);(* 17, 17 *) +(mk_real_int64 136394095741712550L),(mk_real_int64 621432715517875044L);(* 17, 17 *) +(mk_real_int64 3449962333007127L),(mk_real_int64 480369999672100969L);(* 15, 17 *) +(mk_real_int64 112755219806006910L),(mk_real_int64 108458061553200753L);(* 17, 17 *) +(mk_real_int64 20425420295104110L),(mk_real_int64 235855246958106344L);(* 16, 17 *) +(mk_real_int64 336769516810671791L),(mk_real_int64 170049482258806570L);(* 17, 17 *) +(mk_real_int64 120015193102019478L),(mk_real_int64 500363097909504156L);(* 17, 17 *) +(mk_real_int64 242531186920431465L),(mk_real_int64 374889727587607920L);(* 17, 17 *) +(mk_real_int64 830990516216339322L),(mk_real_int64 44870434498250946L);(* 17, 16 *) +(mk_real_int64 437337966777932430L),(mk_real_int64 123617647681404149L);(* 17, 17 *) +(mk_real_int64 32010075175130853L),(mk_real_int64 175238622667784988L);(* 16, 17 *) +(mk_real_int64 6401180336291811L),(mk_real_int64 469413146181597156L);(* 15, 17 *) +(mk_real_int64 72225885730934367L),(mk_real_int64 100902841783165630L);(* 16, 17 *) +(mk_real_int64 555947721932368422L),(mk_real_int64 71884411384828716L);(* 17, 16 *) +(mk_real_int64 11310082851412980L),(mk_real_int64 5840806486672276L);(* 16, 15 *) +(mk_real_int64 69094491382961484L),(mk_real_int64 115089316787779656L);(* 16, 17 *) +(mk_real_int64 77474187408421716L),(mk_real_int64 198790402562268054L);(* 16, 17 *) +(mk_real_int64 114052136099710176L),(mk_real_int64 133655234207060784L);(* 17, 17 *) +(mk_real_int64 640642861755418382L),(mk_real_int64 140328667680253455L);(* 17, 17 *) +(mk_real_int64 99426032717989264L),(mk_real_int64 811459517714491071L);(* 16, 17 *) +(mk_real_int64 299388146280726874L),(mk_real_int64 56023948078244003L);(* 17, 16 *) +(mk_real_int64 14681460631173710L),(mk_real_int64 126598047592659600L);(* 16, 17 *) +(mk_real_int64 190594738453607418L),(mk_real_int64 273520413046779600L);(* 17, 17 *) +(mk_real_int64 45130834913067726L),(mk_real_int64 72922927355163648L);(* 16, 16 *) +(mk_real_int64 682524197809864560L),(mk_real_int64 11501134039783259L);(* 17, 16 *) +(mk_real_int64 261147710188142596L),(mk_real_int64 10795719052521864L);(* 17, 16 *) +(mk_real_int64 612242647351633425L),(mk_real_int64 724753581578167707L);(* 17, 17 *) +(mk_real_int64 89447031723680592L),(mk_real_int64 613575854361825712L);(* 16, 17 *) +(mk_real_int64 75221044130221610L),(mk_real_int64 62437493767215000L);(* 16, 16 *) +(mk_real_int64 122980369081653920L),(mk_real_int64 139350098640226264L);(* 17, 17 *) +(mk_real_int64 191753108742459732L),(mk_real_int64 59765304065246994L);(* 17, 16 *) +(mk_real_int64 496248375998034660L),(mk_real_int64 185976720605796741L);(* 17, 17 *) +(mk_real_int64 11663449119405014L),(mk_real_int64 220112113481034950L);(* 16, 17 *) +(mk_real_int64 90019979931442324L),(mk_real_int64 138680103047713833L);(* 16, 17 *) +(mk_real_int64 246972887627693676L),(mk_real_int64 279748763615295912L);(* 17, 17 *) +(mk_real_int64 263299358734156679L),(mk_real_int64 18700083552569724L);(* 17, 16 *) +(mk_real_int64 842713184656371184L),(mk_real_int64 222686162228646900L);(* 17, 17 *) +(mk_real_int64 60076245168859232L),(mk_real_int64 13001979270207723L);(* 16, 16 *) +(mk_real_int64 206156636493363892L),(mk_real_int64 39450170112980375L);(* 17, 16 *) +(mk_real_int64 132664093425110379L),(mk_real_int64 101833372337589640L);(* 17, 17 *) +(mk_real_int64 59624200077623463L),(mk_real_int64 225283324310008170L);(* 16, 17 *) +(mk_real_int64 350506842258682381L),(mk_real_int64 823524378783026698L);(* 17, 17 *) +(mk_real_int64 229009312730583112L),(mk_real_int64 139679788568211472L);(* 17, 17 *) +(mk_real_int64 238586586148697472L),(mk_real_int64 3438075068066610L);(* 17, 15 *) +(mk_real_int64 55181926868040362L),(mk_real_int64 564285090785712988L);(* 16, 17 *) +(mk_real_int64 228373092961359570L),(mk_real_int64 45324711403960979L);(* 17, 16 *) +(mk_real_int64 433450039566505800L),(mk_real_int64 5779814058999612L);(* 17, 15 *) +(mk_real_int64 119040428754426073L),(mk_real_int64 162608716447001550L);(* 17, 17 *) +(mk_real_int64 126543423111601348L),(mk_real_int64 26028028310115306L);(* 17, 16 *) +(mk_real_int64 63540787532674749L),(mk_real_int64 156740157883775536L);(* 16, 17 *) +(mk_real_int64 23324021500639024L),(mk_real_int64 58648466211657553L);(* 16, 16 *) +(mk_real_int64 633331026360422811L),(mk_real_int64 341101435007020383L);(* 17, 17 *) +(mk_real_int64 1600055299487659L),(mk_real_int64 51028019134901524L);(* 15, 16 *) +(mk_real_int64 485820496143072944L),(mk_real_int64 516150123043777665L);(* 17, 17 *) +(mk_real_int64 255448667625962832L),(mk_real_int64 55722623811698980L);(* 17, 16 *) +(mk_real_int64 409828665334907158L),(mk_real_int64 78246103581519040L);(* 17, 16 *) +(mk_real_int64 284837621710441948L),(mk_real_int64 752003815325565722L);(* 17, 17 *) +(mk_real_int64 602905320343796525L),(mk_real_int64 742811965071900480L);(* 17, 17 *) +(mk_real_int64 215551282196246976L),(mk_real_int64 642773295888196992L);(* 17, 17 *) +(mk_real_int64 583074379399228680L),(mk_real_int64 22867696506149583L);(* 17, 16 *) +(mk_real_int64 400906498646797560L),(mk_real_int64 243223929420077568L);(* 17, 17 *) +(mk_real_int64 908723312675275350L),(mk_real_int64 118569180727903016L);(* 17, 17 *) +(mk_real_int64 240227407007770092L),(mk_real_int64 44300934657485926L);(* 17, 16 *) +(mk_real_int64 211964822498530245L),(mk_real_int64 240061121885985300L);(* 17, 17 *) +(mk_real_int64 94930428544323606L),(mk_real_int64 234767838130868694L);(* 16, 17 *) +(mk_real_int64 99474907863353302L),(mk_real_int64 584524170084483909L);(* 16, 17 *) +(mk_real_int64 12650320854337824L),(mk_real_int64 229605112793307713L);(* 16, 17 *) +(mk_real_int64 59702192440211952L),(mk_real_int64 764342185901862036L);(* 16, 17 *) +(mk_real_int64 486763512203189298L),(mk_real_int64 444232265802732874L);(* 17, 17 *) +(mk_real_int64 253148755480914656L),(mk_real_int64 110885433291927504L);(* 17, 17 *) +(mk_real_int64 3017282624126673L),(mk_real_int64 12284946223335636L);(* 15, 16 *) +(mk_real_int64 423072048903281050L),(mk_real_int64 42369065159124920L);(* 17, 16 *) +(mk_real_int64 258213374964468434L),(mk_real_int64 622676329793374780L);(* 17, 17 *) +(mk_real_int64 261269463129805152L),(mk_real_int64 652165415334478031L);(* 17, 17 *) +(mk_real_int64 528239585152350773L),(mk_real_int64 359626150072275007L);(* 17, 17 *) +(mk_real_int64 200102652952194438L),(mk_real_int64 248047961710365531L);(* 17, 17 *) +(mk_real_int64 409254169132740096L),(mk_real_int64 10684881587668145L);(* 17, 16 *) +(mk_real_int64 789948491613588496L),(mk_real_int64 417663227448475960L);(* 17, 17 *) +(mk_real_int64 490366800409409040L),(mk_real_int64 31212308763091533L);(* 17, 16 *) +(mk_real_int64 191075942182785996L),(mk_real_int64 55867299018160917L);(* 17, 16 *) +(mk_real_int64 107100682253722719L),(mk_real_int64 373085966097961255L);(* 17, 17 *) +(mk_real_int64 8804800651476300L),(mk_real_int64 157231485025656188L);(* 15, 17 *) +(mk_real_int64 454861192419900800L),(mk_real_int64 745146441904545450L);(* 17, 17 *) +(mk_real_int64 11496795608306112L),(mk_real_int64 159249453772591225L);(* 16, 17 *) +(mk_real_int64 57932613414425664L),(mk_real_int64 223851113048079618L);(* 16, 17 *) +(mk_real_int64 76590884363125301L),(mk_real_int64 243665443228419730L);(* 16, 17 *) +(mk_real_int64 152179147779991700L),(mk_real_int64 183308423333938188L);(* 17, 17 *) +(mk_real_int64 128683737848599622L),(mk_real_int64 117916588465090106L);(* 17, 17 *) +(mk_real_int64 98077062191483520L),(mk_real_int64 257526207710618346L);(* 16, 17 *) +(mk_real_int64 16442619629007052L),(mk_real_int64 746325585172341104L);(* 16, 17 *) +(mk_real_int64 133734742264750684L),(mk_real_int64 10259442198451440L);(* 17, 16 *) +(mk_real_int64 3543874476514560L),(mk_real_int64 399903439010291508L);(* 15, 17 *) +(mk_real_int64 292528609951499060L),(mk_real_int64 886240262048344980L);(* 17, 17 *) +(mk_real_int64 165300999540805296L),(mk_real_int64 59214302982243489L);(* 17, 16 *) +(mk_real_int64 8367875217369317L),(mk_real_int64 34987378643976330L);(* 15, 16 *) +(mk_real_int64 413136279301505408L),(mk_real_int64 267461272795659440L);(* 17, 17 *) +(mk_real_int64 249549638557193175L),(mk_real_int64 347615490772393128L);(* 17, 17 *) +(mk_real_int64 145330460084736683L),(mk_real_int64 653803041793988880L);(* 17, 17 *) +(mk_real_int64 158384809891715638L),(mk_real_int64 96599431220847322L);(* 17, 16 *) +(mk_real_int64 205608112902088339L),(mk_real_int64 273006455558363813L);(* 17, 17 *) +(mk_real_int64 275135580389051676L),(mk_real_int64 104253466269589164L);(* 17, 17 *) +(mk_real_int64 414344819195654844L),(mk_real_int64 702422930092998582L);(* 17, 17 *) +(mk_real_int64 6036873136353720L),(mk_real_int64 676613953513603858L);(* 15, 17 *) +(mk_real_int64 359011770037510932L),(mk_real_int64 680586248165284398L);(* 17, 17 *) +(mk_real_int64 182707943046567704L),(mk_real_int64 272463312987014540L);(* 17, 17 *) +(mk_real_int64 388775585384215848L),(mk_real_int64 122104942625027043L);(* 17, 17 *) +(mk_real_int64 54045314469805320L),(mk_real_int64 615953249067435796L);(* 16, 17 *) +(mk_real_int64 189093503288281000L),(mk_real_int64 398650271000471392L);(* 17, 17 *) +(mk_real_int64 261956794725602670L),(mk_real_int64 87759452300160704L);(* 17, 16 *) +(mk_real_int64 258629958248844171L),(mk_real_int64 761223369252198420L);(* 17, 17 *) +(mk_real_int64 604169305404880610L),(mk_real_int64 92481445687557094L);(* 17, 16 *) +(mk_real_int64 562261910286786663L),(mk_real_int64 184627938299588868L);(* 17, 17 *) +(mk_real_int64 24878503874262038L),(mk_real_int64 675572774177415203L);(* 16, 17 *) +(mk_real_int64 106541340017109198L),(mk_real_int64 22258850839292304L);(* 17, 16 *) +(mk_real_int64 724184692892950590L),(mk_real_int64 825359130951253326L);(* 17, 17 *) +(mk_real_int64 693075996996144197L),(mk_real_int64 172959712008462016L);(* 17, 17 *) +(mk_real_int64 13949939963043000L),(mk_real_int64 351869023743482795L);(* 16, 17 *) +(mk_real_int64 382082364816605928L),(mk_real_int64 171988161800618340L);(* 17, 17 *) +(mk_real_int64 27341423225829112L),(mk_real_int64 445596123978428785L);(* 16, 17 *) +(mk_real_int64 138531555168270588L),(mk_real_int64 477921774802602864L);(* 17, 17 *) +(mk_real_int64 137036365154310114L),(mk_real_int64 278018435167329375L);(* 17, 17 *) +(mk_real_int64 329287979720347207L),(mk_real_int64 367924564473646964L);(* 17, 17 *) +(mk_real_int64 110196892117470774L),(mk_real_int64 302235801544384800L);(* 17, 17 *) +(mk_real_int64 678413313744607340L),(mk_real_int64 130160199267019103L);(* 17, 17 *) +(mk_real_int64 434476267930486350L),(mk_real_int64 356434436091543276L);(* 17, 17 *) +(mk_real_int64 260625674650198410L),(mk_real_int64 635233329583232982L);(* 17, 17 *) +(mk_real_int64 278867035391393680L),(mk_real_int64 92057441784679717L);(* 17, 16 *) +(mk_real_int64 169867260130126056L),(mk_real_int64 238579286587064794L);(* 17, 17 *) +(mk_real_int64 46580907943251968L),(mk_real_int64 139836477448303564L);(* 16, 17 *) +(mk_real_int64 229816383142221948L),(mk_real_int64 257664827952003873L);(* 17, 17 *) +(mk_real_int64 705083541903912L),(mk_real_int64 214662654938848147L);(* 14, 17 *) +(mk_real_int64 730184990273655828L),(mk_real_int64 80838698975170020L);(* 17, 16 *) +(mk_real_int64 370797272500143933L),(mk_real_int64 57499855574062876L);(* 17, 16 *) +(mk_real_int64 743103586250010000L),(mk_real_int64 12560479554589880L);(* 17, 16 *) +(mk_real_int64 295994821633703896L),(mk_real_int64 12521729801254695L);(* 17, 16 *) +(mk_real_int64 96691874039859280L),(mk_real_int64 90100502189072994L);(* 16, 16 *) +(mk_real_int64 178725656364342637L),(mk_real_int64 42085643324748171L);(* 17, 16 *) +(mk_real_int64 380008250683731870L),(mk_real_int64 515283790742670989L);(* 17, 17 *) +(mk_real_int64 353348734281330611L),(mk_real_int64 249461239753401336L);(* 17, 17 *) +(mk_real_int64 20569010317601772L),(mk_real_int64 139049406702602612L);(* 16, 17 *) +(mk_real_int64 351300270231794506L),(mk_real_int64 445205625043864884L);(* 17, 17 *) +(mk_real_int64 275253948407168514L),(mk_real_int64 273163011986949064L);(* 17, 17 *) +(mk_real_int64 144067194933109305L),(mk_real_int64 20473084461446706L);(* 17, 16 *) +(mk_real_int64 256504003116280920L),(mk_real_int64 177139517580898552L);(* 17, 17 *) +(mk_real_int64 22956760304090834L),(mk_real_int64 473704949375808384L);(* 16, 17 *) +(mk_real_int64 169948356632419706L),(mk_real_int64 371727527717719440L);(* 17, 17 *) +(mk_real_int64 37736475700250000L),(mk_real_int64 7058251797180480L);(* 16, 15 *) +(mk_real_int64 338072901759894938L),(mk_real_int64 395966005163576203L);(* 17, 17 *) +(mk_real_int64 2872003702204068L),(mk_real_int64 222573971856406985L);(* 15, 17 *) +(mk_real_int64 42508564456494585L),(mk_real_int64 547725863948010690L);(* 16, 17 *) +(mk_real_int64 413056527906494574L),(mk_real_int64 446735681900480421L);(* 17, 17 *) +(mk_real_int64 389529928452339592L),(mk_real_int64 4422461108880258L);(* 17, 15 *) +(mk_real_int64 19007411974911500L),(mk_real_int64 312522463711735584L);(* 16, 17 *) +(mk_real_int64 160351674415701444L),(mk_real_int64 4380781863364179L);(* 17, 15 *) +(mk_real_int64 144499830580439316L),(mk_real_int64 26127883629905232L);(* 17, 16 *) +(mk_real_int64 473931903797856896L),(mk_real_int64 76677814264616800L);(* 17, 16 *) +(mk_real_int64 190617069775577328L),(mk_real_int64 405514137331460556L);(* 17, 17 *) +(mk_real_int64 147895553238175778L),(mk_real_int64 68877141636610044L);(* 17, 16 *) +(mk_real_int64 96279929034063373L),(mk_real_int64 175992526856146494L);(* 16, 17 *) +(mk_real_int64 293890934178484870L),(mk_real_int64 178245899053238982L);(* 17, 17 *) +(mk_real_int64 192668268002044769L),(mk_real_int64 40014834374693010L);(* 17, 16 *) +(mk_real_int64 6539761442928800L),(mk_real_int64 144412941763248549L);(* 15, 17 *) +(mk_real_int64 50295279025946584L),(mk_real_int64 150444706863997483L);(* 16, 17 *) +(mk_real_int64 549059853896400132L),(mk_real_int64 98092221765344876L);(* 17, 16 *) +(mk_real_int64 60398071684593004L),(mk_real_int64 165228893375945106L);(* 16, 17 *) +(mk_real_int64 53751846841125246L),(mk_real_int64 259931237188116098L);(* 16, 17 *) +(mk_real_int64 122131336718759264L),(mk_real_int64 23376654691930832L);(* 17, 16 *) +(mk_real_int64 598276947867716280L),(mk_real_int64 14457658984269984L);(* 17, 16 *) +(mk_real_int64 31101592548212400L),(mk_real_int64 779705450302531332L);(* 16, 17 *) +(mk_real_int64 33471294181001516L),(mk_real_int64 51258014550354447L);(* 16, 16 *) +(mk_real_int64 279478945543446735L),(mk_real_int64 690497977979321044L);(* 17, 17 *) +(mk_real_int64 512323710977707455L),(mk_real_int64 83304258517403220L);(* 17, 16 *) +(mk_real_int64 298783632546375743L),(mk_real_int64 148930285464602965L);(* 17, 17 *) +(mk_real_int64 352958353099748693L),(mk_real_int64 1197070644155433L);(* 17, 15 *) +(mk_real_int64 70319404633186656L),(mk_real_int64 49320859492526344L);(* 16, 16 *) +(mk_real_int64 87805654610749690L),(mk_real_int64 182321097758949612L);(* 16, 17 *) +(mk_real_int64 6905168065513406L),(mk_real_int64 144634561278775281L);(* 15, 17 *) +(mk_real_int64 809344036204263712L),(mk_real_int64 263617285775156811L);(* 17, 17 *) +(mk_real_int64 814707898359841615L),(mk_real_int64 297374110102353753L);(* 17, 17 *) +(mk_real_int64 166039500111485424L),(mk_real_int64 20257935411515040L);(* 17, 16 *) +(mk_real_int64 263783361757101924L),(mk_real_int64 657599387703695746L);(* 17, 17 *) +(mk_real_int64 107418119566871335L),(mk_real_int64 465859416597984720L);(* 17, 17 *) +(mk_real_int64 6919830365244285L),(mk_real_int64 115142390660589080L);(* 15, 17 *) +(mk_real_int64 23992960654117708L),(mk_real_int64 155448572416898144L);(* 16, 17 *) +(mk_real_int64 506405480277386320L),(mk_real_int64 724218551032667724L);(* 17, 17 *) +(mk_real_int64 184130386813404252L),(mk_real_int64 417058108112373410L);(* 17, 17 *) +(mk_real_int64 40907074836978840L),(mk_real_int64 220897212370868430L);(* 16, 17 *) +(mk_real_int64 560727410304792750L),(mk_real_int64 125738889241979724L);(* 17, 17 *) +(mk_real_int64 13559768894492252L),(mk_real_int64 22649478162101400L);(* 16, 16 *) +(mk_real_int64 4018272354494754L),(mk_real_int64 9948615410592795L);(* 15, 15 *) +(mk_real_int64 175044982773215969L),(mk_real_int64 48970811819748000L);(* 17, 16 *) +(mk_real_int64 85768313635517605L),(mk_real_int64 179453265141700386L);(* 16, 17 *) +(mk_real_int64 62378902283841374L),(mk_real_int64 520137487404553641L);(* 16, 17 *) +(mk_real_int64 95196278856083274L),(mk_real_int64 253469679982741233L);(* 16, 17 *) +(mk_real_int64 127898254137345237L),(mk_real_int64 720421350860148400L);(* 17, 17 *) +(mk_real_int64 440649642567663672L),(mk_real_int64 326897213832856725L);(* 17, 17 *) +(mk_real_int64 12873265363929250L),(mk_real_int64 24347550958829808L);(* 16, 16 *) +(mk_real_int64 290885035486985346L),(mk_real_int64 592869385156681598L);(* 17, 17 *) +(mk_real_int64 379869156569487508L),(mk_real_int64 454380729218279235L);(* 17, 17 *) +(mk_real_int64 688979527108774992L),(mk_real_int64 37949922989679275L);(* 17, 16 *) +(mk_real_int64 6892645217251739L),(mk_real_int64 390312507314801376L);(* 15, 17 *) +(mk_real_int64 823268783092292689L),(mk_real_int64 505311355874309421L);(* 17, 17 *) +(mk_real_int64 665818615368411344L),(mk_real_int64 67611582294459555L);(* 17, 16 *) +(mk_real_int64 31833332963680245L),(mk_real_int64 348262340038993125L);(* 16, 17 *) +(mk_real_int64 121929772878457635L),(mk_real_int64 491735590348504050L);(* 17, 17 *) +(mk_real_int64 109395874076045700L),(mk_real_int64 221013617050208528L);(* 17, 17 *) +(mk_real_int64 555645964202062272L),(mk_real_int64 1251323835469176L);(* 17, 15 *) +(mk_real_int64 268655574457902072L),(mk_real_int64 83331374977281032L);(* 17, 16 *) +(mk_real_int64 194339498503644029L),(mk_real_int64 150538320271112478L);(* 17, 17 *) +(mk_real_int64 24728638166275685L),(mk_real_int64 125212371087329127L);(* 16, 17 *) +(mk_real_int64 229078069940799898L),(mk_real_int64 121132576807714157L);(* 17, 17 *) +(mk_real_int64 191899689974393028L),(mk_real_int64 248614128793710527L);(* 17, 17 *) +(mk_real_int64 19335421454942824L),(mk_real_int64 110523712674094430L);(* 16, 17 *) +(mk_real_int64 291539245693503030L),(mk_real_int64 233488069926128432L);(* 17, 17 *) +(mk_real_int64 122366897955991668L),(mk_real_int64 7487780422235004L);(* 17, 15 *) +(mk_real_int64 448642491013006926L),(mk_real_int64 146513571733996290L);(* 17, 17 *) +(mk_real_int64 107139608798366326L),(mk_real_int64 20993173960042410L);(* 17, 16 *) +(mk_real_int64 117174904940548008L),(mk_real_int64 213438507760869604L);(* 17, 17 *) +(mk_real_int64 427266686183988168L),(mk_real_int64 6683230458510552L);(* 17, 15 *) +(mk_real_int64 665377191480758010L),(mk_real_int64 14491050422204223L);(* 17, 16 *) +(mk_real_int64 273488086759997865L),(mk_real_int64 624360148264280560L);(* 17, 17 *) +(mk_real_int64 50881747603036632L),(mk_real_int64 239692135032472428L);(* 16, 17 *) +(mk_real_int64 5392570685914020L),(mk_real_int64 173497425593500920L);(* 15, 17 *) +(mk_real_int64 142009248163947850L),(mk_real_int64 389405872099749076L);(* 17, 17 *) +(mk_real_int64 81135789824832518L),(mk_real_int64 253938024272531709L);(* 16, 17 *) +(mk_real_int64 41040677633273240L),(mk_real_int64 106077318662935300L);(* 16, 17 *) +(mk_real_int64 350501205384717248L),(mk_real_int64 21100257914671170L);(* 17, 16 *) +(mk_real_int64 310017645108957258L),(mk_real_int64 279377902539486580L);(* 17, 17 *) +(mk_real_int64 889859221165683735L),(mk_real_int64 87821791390148772L);(* 17, 16 *) +(mk_real_int64 374796768845337930L),(mk_real_int64 96445585303862872L);(* 17, 16 *) +(mk_real_int64 123721359722623385L),(mk_real_int64 243984998537948889L);(* 17, 17 *) +(mk_real_int64 128183134240081518L),(mk_real_int64 539191902400704L);(* 17, 14 *) +(mk_real_int64 7432427777665280L),(mk_real_int64 58569398040162939L);(* 15, 16 *) +(mk_real_int64 657619674768234675L),(mk_real_int64 216415837373855430L);(* 17, 17 *) +(mk_real_int64 198796664853296016L),(mk_real_int64 69572846670067730L);(* 17, 16 *) +(mk_real_int64 3634661912794563L),(mk_real_int64 319187171508271164L);(* 15, 17 *) +(mk_real_int64 92944899629007679L),(mk_real_int64 318640920553105125L);(* 16, 17 *) +(mk_real_int64 32567485615317754L),(mk_real_int64 190133256236867102L);(* 16, 17 *) +(mk_real_int64 165322080139398850L),(mk_real_int64 113738615973366186L);(* 17, 17 *) +(mk_real_int64 117856642879233051L),(mk_real_int64 13283396370650560L);(* 17, 16 *) +(mk_real_int64 57952217319737964L),(mk_real_int64 270650634099323403L);(* 16, 17 *) +(mk_real_int64 451648154099218301L),(mk_real_int64 66321310463737569L);(* 17, 16 *) +(mk_real_int64 36728674297155661L),(mk_real_int64 86580401011932834L);(* 16, 16 *) +(mk_real_int64 307555587490145421L),(mk_real_int64 451111610895042920L);(* 17, 17 *) +(mk_real_int64 235020814043246386L),(mk_real_int64 58083905635139604L);(* 17, 16 *) +(mk_real_int64 439032608939671200L),(mk_real_int64 55091318812432512L);(* 17, 16 *) +(mk_real_int64 463352733900576846L),(mk_real_int64 325984018786893456L);(* 17, 17 *) +(mk_real_int64 183824622200934468L),(mk_real_int64 103385296222218528L);(* 17, 17 *) +(mk_real_int64 7820198683476111L),(mk_real_int64 172059693574856292L);(* 15, 17 *) +(mk_real_int64 60169547546833020L),(mk_real_int64 397864005974938572L);(* 16, 17 *) +(mk_real_int64 280875578320387834L),(mk_real_int64 96030962571192532L);(* 17, 16 *) +(mk_real_int64 165651466887694615L),(mk_real_int64 25821329868928485L);(* 17, 16 *) +(mk_real_int64 453480154188053896L),(mk_real_int64 506242593165416596L);(* 17, 17 *) +(mk_real_int64 710581541711202564L),(mk_real_int64 289511114251656276L);(* 17, 17 *) +(mk_real_int64 233271177390337114L),(mk_real_int64 655289791406641380L);(* 17, 17 *) +(mk_real_int64 76645042306484868L),(mk_real_int64 544213064303056096L);(* 16, 17 *) +(mk_real_int64 161784229567887822L),(mk_real_int64 3416518397036514L);(* 17, 15 *) +(mk_real_int64 234783246854951280L),(mk_real_int64 165142279215827528L);(* 17, 17 *) +(mk_real_int64 374305475472972930L),(mk_real_int64 49638554171065090L);(* 17, 16 *) +(mk_real_int64 710048097451578160L),(mk_real_int64 138368208049183274L);(* 17, 17 *) +(mk_real_int64 645032304724825656L),(mk_real_int64 620334463872975000L);(* 17, 17 *) +(mk_real_int64 330029614147215908L),(mk_real_int64 162256397899255205L);(* 17, 17 *) +(mk_real_int64 340283912255138016L),(mk_real_int64 254756445463584534L);(* 17, 17 *) +(mk_real_int64 510999965172915750L),(mk_real_int64 123240687146453484L);(* 17, 17 *) +(mk_real_int64 59423632882065298L),(mk_real_int64 4942354507281306L);(* 16, 15 *) +(mk_real_int64 105166487413569624L),(mk_real_int64 4169229747669826L);(* 17, 15 *) +(mk_real_int64 46581618440128792L),(mk_real_int64 18041786959126777L);(* 16, 16 *) +(mk_real_int64 793896091622760282L),(mk_real_int64 291747218574375984L);(* 17, 17 *) +(mk_real_int64 122966836148459667L),(mk_real_int64 258372999180339360L);(* 17, 17 *) +(mk_real_int64 269321520054520296L),(mk_real_int64 62276945455656756L);(* 17, 16 *) +(mk_real_int64 327861143929499224L),(mk_real_int64 9876116528656470L);(* 17, 15 *) +(mk_real_int64 9283271001840040L),(mk_real_int64 456553441651470916L);(* 15, 17 *) +(mk_real_int64 140172681802374828L),(mk_real_int64 210377704821887273L);(* 17, 17 *) +(mk_real_int64 189204871918513824L),(mk_real_int64 590557570376391020L);(* 17, 17 *) +(mk_real_int64 740578497478932042L),(mk_real_int64 208381914920982120L);(* 17, 17 *) +(mk_real_int64 197673975191962875L),(mk_real_int64 210222514456692322L);(* 17, 17 *) +(mk_real_int64 157919681039601L),(mk_real_int64 7013976546028011L);(* 14, 15 *) +(mk_real_int64 8660283088717464L),(mk_real_int64 333350816310440100L);(* 15, 17 *) +(mk_real_int64 78568388580078632L),(mk_real_int64 490633124255592659L);(* 16, 17 *) +(mk_real_int64 11685071470329242L),(mk_real_int64 4637653878752424L);(* 16, 15 *) +(mk_real_int64 357266922560543700L),(mk_real_int64 915604545922068503L);(* 17, 17 *) +(mk_real_int64 77544405516974140L),(mk_real_int64 16849530487435360L);(* 16, 16 *) +(mk_real_int64 163199827468618176L),(mk_real_int64 168365728255787700L);(* 17, 17 *) +(mk_real_int64 132546524093757508L),(mk_real_int64 148606604601560560L);(* 17, 17 *) +(mk_real_int64 191235677777320920L),(mk_real_int64 587209958339248408L);(* 17, 17 *) +(mk_real_int64 703613079796670046L),(mk_real_int64 507082967833159190L);(* 17, 17 *) +(mk_real_int64 19683672627344228L),(mk_real_int64 130696099532675325L);(* 16, 17 *) +(mk_real_int64 118274577131884446L),(mk_real_int64 307639710454062546L);(* 17, 17 *) +(mk_real_int64 574210892346098850L),(mk_real_int64 498411953426871824L);(* 17, 17 *) +(mk_real_int64 299725400493044072L),(mk_real_int64 814463464567806915L);(* 17, 17 *) +(mk_real_int64 80282015006414592L),(mk_real_int64 358989457644404496L);(* 16, 17 *) +(mk_real_int64 343240417218675114L),(mk_real_int64 65847620304719592L);(* 17, 16 *) +(mk_real_int64 48880795796606160L),(mk_real_int64 115395610321739202L);(* 16, 17 *) +(mk_real_int64 10257882923411224L),(mk_real_int64 47395373091219684L);(* 16, 16 *) +(mk_real_int64 524077236617636L),(mk_real_int64 29116893943284840L);(* 14, 16 *) +(mk_real_int64 187612596843716416L),(mk_real_int64 123407823106743189L);(* 17, 17 *) +(mk_real_int64 351237459002698650L),(mk_real_int64 341391307778962264L);(* 17, 17 *) +(mk_real_int64 62852914686887248L),(mk_real_int64 66412532437748332L);(* 16, 16 *) +(mk_real_int64 433159175983670136L),(mk_real_int64 242357699754983280L);(* 17, 17 *) +(mk_real_int64 207272034879086200L),(mk_real_int64 550049714742216412L);(* 17, 17 *) +(mk_real_int64 56226380193261252L),(mk_real_int64 1015550363672625L);(* 16, 15 *) +(mk_real_int64 127351329399566820L),(mk_real_int64 448512907072586691L);(* 17, 17 *) +(mk_real_int64 518498419624574906L),(mk_real_int64 470871911210692875L);(* 17, 17 *) +(mk_real_int64 138468892180627957L),(mk_real_int64 46666680598928610L);(* 17, 16 *) +(mk_real_int64 126632132059167468L),(mk_real_int64 446955457730116294L);(* 17, 17 *) +(mk_real_int64 469424389389248850L),(mk_real_int64 166400285479642030L);(* 17, 17 *) +(mk_real_int64 14576018859788694L),(mk_real_int64 161949995937481108L);(* 16, 17 *) +(mk_real_int64 173422191673189725L),(mk_real_int64 145495390776482160L);(* 17, 17 *) +(mk_real_int64 10490681218720953L),(mk_real_int64 497223415630387524L);(* 16, 17 *) +(mk_real_int64 143685196090929688L),(mk_real_int64 419272989328472688L);(* 17, 17 *) +(mk_real_int64 739182443681562920L),(mk_real_int64 264288903209167296L);(* 17, 17 *) +(mk_real_int64 299203096051222548L),(mk_real_int64 107813319077050686L);(* 17, 17 *) +(mk_real_int64 618528069533712330L),(mk_real_int64 388859241688819594L);(* 17, 17 *) +(mk_real_int64 7156092663611112L),(mk_real_int64 85973839319757765L);(* 15, 16 *) +(mk_real_int64 135481002442061087L),(mk_real_int64 5090686761320640L);(* 17, 15 *) +(mk_real_int64 224510509483173864L),(mk_real_int64 31051784724899826L);(* 17, 16 *) +(mk_real_int64 92536072472813864L),(mk_real_int64 586285053997561722L);(* 16, 17 *) +(mk_real_int64 291949804926934478L),(mk_real_int64 79652793687890297L);(* 17, 16 *) +(mk_real_int64 128667269174756844L),(mk_real_int64 557825939213274608L);(* 17, 17 *) +(mk_real_int64 780462449872516308L),(mk_real_int64 45785044427610279L);(* 17, 16 *) +(mk_real_int64 51521165456357440L),(mk_real_int64 737855891778078324L);(* 16, 17 *) +(mk_real_int64 549589368559853400L),(mk_real_int64 132271987593624482L);(* 17, 17 *) +(mk_real_int64 384259306325462280L),(mk_real_int64 74202904977827430L);(* 17, 16 *) +(mk_real_int64 429766829770096802L),(mk_real_int64 189645633148436765L);(* 17, 17 *) +(mk_real_int64 371248243711292948L),(mk_real_int64 36399899495312380L);(* 17, 16 *) +(mk_real_int64 506522979701785083L),(mk_real_int64 101156369051498700L);(* 17, 17 *) +(mk_real_int64 497619114810863184L),(mk_real_int64 382066475022846012L);(* 17, 17 *) +(mk_real_int64 115312647922151400L),(mk_real_int64 207160080362094211L);(* 17, 17 *) +(mk_real_int64 32794320918543432L),(mk_real_int64 71854364743961760L);(* 16, 16 *) +(mk_real_int64 2630110581817725L),(mk_real_int64 308519632016436978L);(* 15, 17 *) +(mk_real_int64 15404249291611914L),(mk_real_int64 280658980088209846L);(* 16, 17 *) +(mk_real_int64 1666085223959040L),(mk_real_int64 175755115472855464L);(* 15, 17 *) +(mk_real_int64 94770900606789904L),(mk_real_int64 396582995083982000L);(* 16, 17 *) +(mk_real_int64 561150930549842824L),(mk_real_int64 867294576472654304L);(* 17, 17 *) +(mk_real_int64 404072306023940801L),(mk_real_int64 226523082932498976L);(* 17, 17 *) +(mk_real_int64 58882677993157982L),(mk_real_int64 388653047904339228L);(* 16, 17 *) +(mk_real_int64 355051677322317412L),(mk_real_int64 531006800188200L);(* 17, 14 *) +(mk_real_int64 26539786357709184L),(mk_real_int64 450652423590012721L);(* 16, 17 *) +(mk_real_int64 494739044272459800L),(mk_real_int64 74043522864770718L);(* 17, 16 *) +(mk_real_int64 249201136656102826L),(mk_real_int64 429095069595859224L);(* 17, 17 *) +(mk_real_int64 354913159176479L),(mk_real_int64 442496149398184478L);(* 14, 17 *) +(mk_real_int64 210472506754160628L),(mk_real_int64 79581119381824520L);(* 17, 16 *) +(mk_real_int64 229758403056206164L),(mk_real_int64 149502082993191096L);(* 17, 17 *) +(mk_real_int64 121885361476901120L),(mk_real_int64 300065640458675176L);(* 17, 17 *) +(mk_real_int64 115008996345505605L),(mk_real_int64 460815598154100618L);(* 17, 17 *) +(mk_real_int64 171819785560068464L),(mk_real_int64 5839394762112185L);(* 17, 15 *) +(mk_real_int64 22653870015726144L),(mk_real_int64 118290442108972700L);(* 16, 17 *) +(mk_real_int64 210182587784577732L),(mk_real_int64 425834901779389229L);(* 17, 17 *) +(mk_real_int64 18388064577089341L),(mk_real_int64 107677872137251552L);(* 16, 17 *) +(mk_real_int64 171366834562569784L),(mk_real_int64 95138790011576892L);(* 17, 16 *) +(mk_real_int64 371951431215785390L),(mk_real_int64 570539735983729160L);(* 17, 17 *) +(mk_real_int64 274572186851220780L),(mk_real_int64 86378080215768000L);(* 17, 16 *) +(mk_real_int64 55544369931079412L),(mk_real_int64 280232037384432806L);(* 16, 17 *) +(mk_real_int64 41848810557034088L),(mk_real_int64 77949689489972982L);(* 16, 16 *) +(mk_real_int64 446023715973708836L),(mk_real_int64 629364959738620802L);(* 17, 17 *) +(mk_real_int64 1659860815619514L),(mk_real_int64 23098009218234864L);(* 15, 16 *) +(mk_real_int64 107517481744419242L),(mk_real_int64 300772932346479903L);(* 17, 17 *) +(mk_real_int64 109744272721043037L),(mk_real_int64 712426655342965748L);(* 17, 17 *) +(mk_real_int64 624010191478381422L),(mk_real_int64 106022302962512400L);(* 17, 17 *) +(mk_real_int64 184379721115291800L),(mk_real_int64 263070742701816475L);(* 17, 17 *) +(mk_real_int64 1968060468328722L),(mk_real_int64 14764922547597084L);(* 15, 16 *) +(mk_real_int64 756443004474658290L),(mk_real_int64 553845033121683466L);(* 17, 17 *) +(mk_real_int64 191566706784999549L),(mk_real_int64 119682523209090924L);(* 17, 17 *) +(mk_real_int64 113951674623144924L),(mk_real_int64 270249508853490048L);(* 17, 17 *) +(mk_real_int64 654470961193540788L),(mk_real_int64 447847400945278422L);(* 17, 17 *) +(mk_real_int64 532332225241003125L),(mk_real_int64 173070319279127250L);(* 17, 17 *) +(mk_real_int64 377495332182269596L),(mk_real_int64 175829142341763080L);(* 17, 17 *) +(mk_real_int64 163976487125827728L),(mk_real_int64 235804133841310435L);(* 17, 17 *) +(mk_real_int64 231620414743149025L),(mk_real_int64 136060152681048096L);(* 17, 17 *) +(mk_real_int64 525515028768702813L),(mk_real_int64 49148139903864422L);(* 17, 16 *) +(mk_real_int64 276360055437806824L),(mk_real_int64 41895692752209384L);(* 17, 16 *) +(mk_real_int64 5128579272023900L),(mk_real_int64 231338296950936370L);(* 15, 17 *) +(mk_real_int64 273424096675798791L),(mk_real_int64 314614293521831902L);(* 17, 17 *) +(mk_real_int64 707292147617436815L),(mk_real_int64 301443519069825713L);(* 17, 17 *) +(mk_real_int64 213019146422093220L),(mk_real_int64 139270493820204615L);(* 17, 17 *) +(mk_real_int64 63808718833548992L),(mk_real_int64 221304093026843178L);(* 16, 17 *) +(mk_real_int64 193919741062213704L),(mk_real_int64 102339429138180432L);(* 17, 17 *) +(mk_real_int64 147859250000980584L),(mk_real_int64 205347642781108275L);(* 17, 17 *) +(mk_real_int64 182295949824552096L),(mk_real_int64 275780402695777674L);(* 17, 17 *) +(mk_real_int64 576541331914549586L),(mk_real_int64 245801525908535010L);(* 17, 17 *) +(mk_real_int64 31404509514450802L),(mk_real_int64 511965901452799528L);(* 16, 17 *) +(mk_real_int64 532574376520588L),(mk_real_int64 81410173493047931L);(* 14, 16 *) +(mk_real_int64 135223815423703986L),(mk_real_int64 264918864708798750L);(* 17, 17 *) +(mk_real_int64 41898895942064364L),(mk_real_int64 25132929952228176L);(* 16, 16 *) +(mk_real_int64 11189686376143366L),(mk_real_int64 11859768678774720L);(* 16, 16 *) +(mk_real_int64 201278394715701469L),(mk_real_int64 100738272787649543L);(* 17, 17 *) +(mk_real_int64 11988769347048120L),(mk_real_int64 64302279973561665L);(* 16, 16 *) +(mk_real_int64 462857929676491200L),(mk_real_int64 19156546165428792L);(* 17, 16 *) +(mk_real_int64 99558975960270398L),(mk_real_int64 131470614204830216L);(* 16, 17 *) +(mk_real_int64 565640182911810039L),(mk_real_int64 119873845965604687L);(* 17, 17 *) +(mk_real_int64 116113171745810400L),(mk_real_int64 172837592245430094L);(* 17, 17 *) +(mk_real_int64 858927598293632368L),(mk_real_int64 166981368042027549L);(* 17, 17 *) +(mk_real_int64 146796810763834184L),(mk_real_int64 99677355156230893L);(* 17, 16 *) +(mk_real_int64 385514215156884898L),(mk_real_int64 315121954012951682L);(* 17, 17 *) +(mk_real_int64 255593180124225760L),(mk_real_int64 460793643361493768L);(* 17, 17 *) +(mk_real_int64 842726796875314650L),(mk_real_int64 274245243061579272L);(* 17, 17 *) +(mk_real_int64 266732566875944779L),(mk_real_int64 159072893105265999L);(* 17, 17 *) +(mk_real_int64 276734851149681784L),(mk_real_int64 119150330445378135L);(* 17, 17 *) +(mk_real_int64 52455887967785984L),(mk_real_int64 394912449102918530L);(* 16, 17 *) +(mk_real_int64 276908697434380440L),(mk_real_int64 21746679088327311L);(* 17, 16 *) +(mk_real_int64 450266605045071004L),(mk_real_int64 28251048432871824L);(* 17, 16 *) +(mk_real_int64 63037226969930180L),(mk_real_int64 373620555830229271L);(* 16, 17 *) +(mk_real_int64 237621098998615824L),(mk_real_int64 35641528284130827L);(* 17, 16 *) +(mk_real_int64 134395053316622355L),(mk_real_int64 149613456100834899L);(* 17, 17 *) +(mk_real_int64 895552409557569157L),(mk_real_int64 243467275621622307L);(* 17, 17 *) +(mk_real_int64 347730102107935700L),(mk_real_int64 698613085669645160L);(* 17, 17 *) +(mk_real_int64 391353711916315168L),(mk_real_int64 311469670087907766L);(* 17, 17 *) +(mk_real_int64 127506035067772360L),(mk_real_int64 309990171882536952L);(* 17, 17 *) +(mk_real_int64 221722270910587094L),(mk_real_int64 392016290355693960L);(* 17, 17 *) +(mk_real_int64 135321079752243567L),(mk_real_int64 293076709112869485L);(* 17, 17 *) +(mk_real_int64 397831144030928280L),(mk_real_int64 475907001773383368L);(* 17, 17 *) +(mk_real_int64 253683678292556838L),(mk_real_int64 144956972675040894L);(* 17, 17 *) +(mk_real_int64 793788504332261802L),(mk_real_int64 312410896046190375L);(* 17, 17 *) +(mk_real_int64 200940126244604148L),(mk_real_int64 135073441454723136L);(* 17, 17 *) +(mk_real_int64 348568683417709476L),(mk_real_int64 231559093334273821L);(* 17, 17 *) +(mk_real_int64 40700985550552460L),(mk_real_int64 117936152231015652L);(* 16, 17 *) +(mk_real_int64 636974990510621448L),(mk_real_int64 415766678174080380L);(* 17, 17 *) +(mk_real_int64 743598920867412838L),(mk_real_int64 1970197989130872L);(* 17, 15 *) +(mk_real_int64 382717594438405276L),(mk_real_int64 211956078260422395L);(* 17, 17 *) +(mk_real_int64 165752217268235424L),(mk_real_int64 133748123574746320L);(* 17, 17 *) +(mk_real_int64 665529040758255056L),(mk_real_int64 143903850677551420L);(* 17, 17 *) +(mk_real_int64 113673918320665638L),(mk_real_int64 243959520104901354L);(* 17, 17 *) +(mk_real_int64 72725505924838897L),(mk_real_int64 36162897910769800L);(* 16, 16 *) +(mk_real_int64 137031057438899519L),(mk_real_int64 760294558447754970L);(* 17, 17 *) +(mk_real_int64 709939843753034888L),(mk_real_int64 57676979978558325L);(* 17, 16 *) +(mk_real_int64 317876766055665642L),(mk_real_int64 921980601061499210L);(* 17, 17 *) +(mk_real_int64 124511460390176262L),(mk_real_int64 294759419208697004L);(* 17, 17 *) +(mk_real_int64 65953054089804120L),(mk_real_int64 300268147932220380L);(* 16, 17 *) +(mk_real_int64 317463022073811584L),(mk_real_int64 377215986989877504L);(* 17, 17 *) +(mk_real_int64 133230609351783750L),(mk_real_int64 247864715813073359L);(* 17, 17 *) +(mk_real_int64 426045677492551170L),(mk_real_int64 194442740742505504L);(* 17, 17 *) +(mk_real_int64 115160680748029283L),(mk_real_int64 15439324090340844L);(* 17, 16 *) +(mk_real_int64 881092378878251104L),(mk_real_int64 269316157549801572L);(* 17, 17 *) +(mk_real_int64 513427355524044745L),(mk_real_int64 132912183568687302L);(* 17, 17 *) +(mk_real_int64 609250328704311100L),(mk_real_int64 184868778372047040L);(* 17, 17 *) +(mk_real_int64 2380701428626628L),(mk_real_int64 111161332815330168L);(* 15, 17 *) +(mk_real_int64 237781656084123954L),(mk_real_int64 29204260009601010L);(* 17, 16 *) +(mk_real_int64 226572202799640585L),(mk_real_int64 204580954007556060L);(* 17, 17 *) +(mk_real_int64 41743697216086104L),(mk_real_int64 488871133196409504L);(* 16, 17 *) +(mk_real_int64 547133832837154132L),(mk_real_int64 10536181013841112L);(* 17, 16 *) +(mk_real_int64 23270181032347800L),(mk_real_int64 54955384365944986L);(* 16, 16 *) +(mk_real_int64 162342977721316524L),(mk_real_int64 545848594498042430L);(* 17, 17 *) +(mk_real_int64 17464584477790112L),(mk_real_int64 562814369441690436L);(* 16, 17 *) +(mk_real_int64 15901002821257168L),(mk_real_int64 244700399962528020L);(* 16, 17 *) +(mk_real_int64 36028217879185776L),(mk_real_int64 539684247993252024L);(* 16, 17 *) +(mk_real_int64 17276742210111612L),(mk_real_int64 332066502994913014L);(* 16, 17 *) +(mk_real_int64 411861232643791700L),(mk_real_int64 183268351507142560L);(* 17, 17 *) +(mk_real_int64 154562124489353560L),(mk_real_int64 126420759130043840L);(* 17, 17 *) +(mk_real_int64 207392420809125334L),(mk_real_int64 197501180868631836L);(* 17, 17 *) +(mk_real_int64 380410031190093222L),(mk_real_int64 156071122965120045L);(* 17, 17 *) +(mk_real_int64 468703627490825733L),(mk_real_int64 3881380531815340L);(* 17, 15 *) +(mk_real_int64 333263575399151025L),(mk_real_int64 404431614334041525L);(* 17, 17 *) +(mk_real_int64 17850406233849963L),(mk_real_int64 364998319528309880L);(* 16, 17 *) +(mk_real_int64 126976874877096972L),(mk_real_int64 482107703879974740L);(* 17, 17 *) +(mk_real_int64 214443810147758400L),(mk_real_int64 541202758843736344L);(* 17, 17 *) +(mk_real_int64 161674218961402748L),(mk_real_int64 261656286006718218L);(* 17, 17 *) +(mk_real_int64 353770294415700264L),(mk_real_int64 758852310241553063L);(* 17, 17 *) +(mk_real_int64 7681799209976340L),(mk_real_int64 443315678914358892L);(* 15, 17 *) +(mk_real_int64 436883833381497336L),(mk_real_int64 848554393123349056L);(* 17, 17 *) +(mk_real_int64 3949055269001832L),(mk_real_int64 61824642967060480L);(* 15, 16 *) +(mk_real_int64 64161742453752595L),(mk_real_int64 214958175606024563L);(* 16, 17 *) +(mk_real_int64 719504767141180296L),(mk_real_int64 305992066135500675L);(* 17, 17 *) +(mk_real_int64 516515755698751896L),(mk_real_int64 64038827307927006L);(* 17, 16 *) +(mk_real_int64 615099697516901520L),(mk_real_int64 214570171543079696L);(* 17, 17 *) +(mk_real_int64 53172839478065324L),(mk_real_int64 113466688109732400L);(* 16, 17 *) +(mk_real_int64 450042466989577968L),(mk_real_int64 279434226229034500L);(* 17, 17 *) +(mk_real_int64 59247174988456000L),(mk_real_int64 197081463270400527L);(* 16, 17 *) +(mk_real_int64 122343633331464879L),(mk_real_int64 135107495831644492L);(* 17, 17 *) +(mk_real_int64 369070577119551582L),(mk_real_int64 142499420784079793L);(* 17, 17 *) +(mk_real_int64 87068063759834970L),(mk_real_int64 698592279886825831L);(* 16, 17 *) +(mk_real_int64 301623726610970226L),(mk_real_int64 371732134830124158L);(* 17, 17 *) +(mk_real_int64 152139855421718528L),(mk_real_int64 127971173280527455L);(* 17, 17 *) +(mk_real_int64 46108528365681000L),(mk_real_int64 407418689319883098L);(* 16, 17 *) +(mk_real_int64 545832346315037886L),(mk_real_int64 121032785667250876L);(* 17, 17 *) +(mk_real_int64 50751303543158560L),(mk_real_int64 9720152323395381L);(* 16, 15 *) +(mk_real_int64 46199641318565998L),(mk_real_int64 85171122976843332L);(* 16, 16 *) +(mk_real_int64 578812927050840789L),(mk_real_int64 143575671668458866L);(* 17, 17 *) +(mk_real_int64 173007109679410659L),(mk_real_int64 207434525539963545L);(* 17, 17 *) +(mk_real_int64 389312500157236432L),(mk_real_int64 63656378468524644L);(* 17, 16 *) +(mk_real_int64 192796647732118885L),(mk_real_int64 130892409247257888L);(* 17, 17 *) +(mk_real_int64 231533110015678328L),(mk_real_int64 182572312942703025L);(* 17, 17 *) +(mk_real_int64 363547090596094308L),(mk_real_int64 365145568172045856L);(* 17, 17 *) +(mk_real_int64 5489458260594330L),(mk_real_int64 45692268604238840L);(* 15, 16 *) +(mk_real_int64 68766190462115756L),(mk_real_int64 432180490461756096L);(* 16, 17 *) +(mk_real_int64 703055171030543604L),(mk_real_int64 255212878557116304L);(* 17, 17 *) +(mk_real_int64 93970746832775914L),(mk_real_int64 294235315543082016L);(* 16, 17 *) +(mk_real_int64 117050018256574724L),(mk_real_int64 176428910215525640L);(* 17, 17 *) +(mk_real_int64 139863280367853955L),(mk_real_int64 324199919509673761L);(* 17, 17 *) +(mk_real_int64 65158803933103712L),(mk_real_int64 13821663810399426L);(* 16, 16 *) +(mk_real_int64 554687522356083282L),(mk_real_int64 94148870902433000L);(* 17, 16 *) +(mk_real_int64 201822139227044916L),(mk_real_int64 110096388460402124L);(* 17, 17 *) +(mk_real_int64 46302230478061424L),(mk_real_int64 277607508704007200L);(* 16, 17 *) +(mk_real_int64 495673479025596876L),(mk_real_int64 17931209052999808L);(* 17, 16 *) +(mk_real_int64 484090893934579380L),(mk_real_int64 55402876818758979L);(* 17, 16 *) +(mk_real_int64 17478150331965120L),(mk_real_int64 589239857585307560L);(* 16, 17 *) +(mk_real_int64 109581539444833200L),(mk_real_int64 355880822933535285L);(* 17, 17 *) +(mk_real_int64 29712032115734024L),(mk_real_int64 591375581400199224L);(* 16, 17 *) +(mk_real_int64 205448206201777448L),(mk_real_int64 229410595119248190L);(* 17, 17 *) +(mk_real_int64 180715357660899024L),(mk_real_int64 820394344313280954L);(* 17, 17 *) +(mk_real_int64 3208513901620940L),(mk_real_int64 630308329531850220L);(* 15, 17 *) +(mk_real_int64 108239696293847472L),(mk_real_int64 217696934850047166L);(* 17, 17 *) +(mk_real_int64 3278646456054860L),(mk_real_int64 87230369675115500L);(* 15, 16 *) +(mk_real_int64 190658228364689165L),(mk_real_int64 583771138523183016L);(* 17, 17 *) +(mk_real_int64 522441559935677431L),(mk_real_int64 151881200544040829L);(* 17, 17 *) +(mk_real_int64 632112321944825842L),(mk_real_int64 702550956543485L);(* 17, 14 *) +(mk_real_int64 430393736487154041L),(mk_real_int64 35699556543230259L);(* 17, 16 *) +(mk_real_int64 48659693605499419L),(mk_real_int64 69209942882719290L);(* 16, 16 *) +(mk_real_int64 275760265815429915L),(mk_real_int64 22808169388131530L);(* 17, 16 *) +(mk_real_int64 462937606973496754L),(mk_real_int64 184070636852543280L);(* 17, 17 *) +(mk_real_int64 574842697987773960L),(mk_real_int64 595010128197365239L);(* 17, 17 *) +(mk_real_int64 442296715147222500L),(mk_real_int64 325935069106206400L);(* 17, 17 *) +(mk_real_int64 172005190044720840L),(mk_real_int64 290996261740193775L);(* 17, 17 *) +(mk_real_int64 591492781147993832L),(mk_real_int64 234319844823734325L);(* 17, 17 *) +(mk_real_int64 698087689456918596L),(mk_real_int64 159884434995535044L);(* 17, 17 *) +(mk_real_int64 158778992549916840L),(mk_real_int64 304105039337086650L);(* 17, 17 *) +(mk_real_int64 166863446198837475L),(mk_real_int64 18108059250851009L);(* 17, 16 *) +(mk_real_int64 126463954150142685L),(mk_real_int64 101730449428039208L);(* 17, 17 *) +(mk_real_int64 15913350915986160L),(mk_real_int64 109001895371971846L);(* 16, 17 *) +(mk_real_int64 5940942356202987L),(mk_real_int64 213057784576916136L);(* 15, 17 *) +(mk_real_int64 100625553784011648L),(mk_real_int64 249172447774652180L);(* 17, 17 *) +(mk_real_int64 597283421606798304L),(mk_real_int64 58733029901475297L);(* 17, 16 *) +(mk_real_int64 52036769592637940L),(mk_real_int64 113989812766825788L);(* 16, 17 *) +(mk_real_int64 553919213993684436L),(mk_real_int64 33105454005133150L);(* 17, 16 *) +(mk_real_int64 218110100398360212L),(mk_real_int64 131254967377563600L)(* 17, 17 *) +];; diff --git a/formal_lp/old/arith/tests/arith_test_data20.hl b/formal_lp/old/arith/tests/arith_test_data20.hl new file mode 100644 index 0000000..0f82512 --- /dev/null +++ b/formal_lp/old/arith/tests/arith_test_data20.hl @@ -0,0 +1,1002 @@ +let data = [ +(mk_real_int (num_of_string "33572409929580833751")),(mk_real_int (num_of_string "31148544303953368259"));(* 19, 19 *) +(mk_real_int (num_of_string "25286050174190807804")),(mk_real_int (num_of_string "24730080721092594782"));(* 19, 19 *) +(mk_real_int (num_of_string "28102898481056826372")),(mk_real_int (num_of_string "20558178005327796900"));(* 19, 19 *) +(mk_real_int (num_of_string "35597949478152789376")),(mk_real_int (num_of_string "16655501835545179420"));(* 19, 19 *) +(mk_real_int (num_of_string "34358853243790303767")),(mk_real_int (num_of_string "28853735865560168563"));(* 19, 19 *) +(mk_real_int (num_of_string "39810130950918898900")),(mk_real_int (num_of_string "20991793221680908374"));(* 19, 19 *) +(mk_real_int (num_of_string "36164914639034706954")),(mk_real_int (num_of_string "28333668815475848484"));(* 19, 19 *) +(mk_real_int (num_of_string "20198888744582626276")),(mk_real_int (num_of_string "17283271267412299215"));(* 19, 19 *) +(mk_real_int (num_of_string "23439470377235278080")),(mk_real_int (num_of_string "38563033030730109572"));(* 19, 19 *) +(mk_real_int (num_of_string "15223622583443498928")),(mk_real_int (num_of_string "29735798434737708390"));(* 19, 19 *) +(mk_real_int (num_of_string "18525935614021875028")),(mk_real_int (num_of_string "24037285142129988256"));(* 19, 19 *) +(mk_real_int (num_of_string "28051053154610255550")),(mk_real_int (num_of_string "28768830119973522601"));(* 19, 19 *) +(mk_real_int (num_of_string "17788180790513167760")),(mk_real_int (num_of_string "23090170534600145328"));(* 19, 19 *) +(mk_real_int (num_of_string "21291126661160206268")),(mk_real_int (num_of_string "30741578193770457992"));(* 19, 19 *) +(mk_real_int (num_of_string "37312400635530845968")),(mk_real_int (num_of_string "32065354411190445411"));(* 19, 19 *) +(mk_real_int (num_of_string "33876812647503135915")),(mk_real_int (num_of_string "25416986314790221239"));(* 19, 19 *) +(mk_real_int (num_of_string "13985990300271092642")),(mk_real_int (num_of_string "33251196154616671077"));(* 19, 19 *) +(mk_real_int (num_of_string "40189368257349303135")),(mk_real_int (num_of_string "19866689936242500384"));(* 19, 19 *) +(mk_real_int (num_of_string "32885639039242757680")),(mk_real_int (num_of_string "20826379267161536948"));(* 19, 19 *) +(mk_real_int (num_of_string "21407567181068817584")),(mk_real_int (num_of_string "36013468503693282789"));(* 19, 19 *) +(mk_real_int (num_of_string "20154159275924798586")),(mk_real_int (num_of_string "21532637598082055214"));(* 19, 19 *) +(mk_real_int (num_of_string "33702246114925956370")),(mk_real_int (num_of_string "29222938712195650763"));(* 19, 19 *) +(mk_real_int (num_of_string "38227543832118719848")),(mk_real_int (num_of_string "25135325679368858646"));(* 19, 19 *) +(mk_real_int (num_of_string "22321716812668731381")),(mk_real_int (num_of_string "23543573531048464927"));(* 19, 19 *) +(mk_real_int (num_of_string "23769134273467183997")),(mk_real_int (num_of_string "14369117920579248750"));(* 19, 19 *) +(mk_real_int (num_of_string "29136534010572339318")),(mk_real_int (num_of_string "35899345969306125625"));(* 19, 19 *) +(mk_real_int (num_of_string "14328464291121391796")),(mk_real_int (num_of_string "40312202315066193600"));(* 19, 19 *) +(mk_real_int (num_of_string "21216429602204626944")),(mk_real_int (num_of_string "13321039568452832480"));(* 19, 19 *) +(mk_real_int (num_of_string "26396844807676863696")),(mk_real_int (num_of_string "24664233439087612568"));(* 19, 19 *) +(mk_real_int (num_of_string "22613254802828210532")),(mk_real_int (num_of_string "27943544635047532128"));(* 19, 19 *) +(mk_real_int (num_of_string "20458784280731690817")),(mk_real_int (num_of_string "15903106777293095789"));(* 19, 19 *) +(mk_real_int (num_of_string "27612300487446391420")),(mk_real_int (num_of_string "37299649274712282535"));(* 19, 19 *) +(mk_real_int (num_of_string "19535852241344569009")),(mk_real_int (num_of_string "25235363567080868608"));(* 19, 19 *) +(mk_real_int (num_of_string "21573960810733653630")),(mk_real_int (num_of_string "17395045895945547819"));(* 19, 19 *) +(mk_real_int (num_of_string "22426091998882023936")),(mk_real_int (num_of_string "30917169703164305462"));(* 19, 19 *) +(mk_real_int (num_of_string "17436089345828729895")),(mk_real_int (num_of_string "36147047013286273911"));(* 19, 19 *) +(mk_real_int (num_of_string "29943846419256650397")),(mk_real_int (num_of_string "31608722356773399101"));(* 19, 19 *) +(mk_real_int (num_of_string "20758244686394967125")),(mk_real_int (num_of_string "16297076128134636120"));(* 19, 19 *) +(mk_real_int (num_of_string "23361855748705720224")),(mk_real_int (num_of_string "21805600907356868899"));(* 19, 19 *) +(mk_real_int (num_of_string "33361192690924017876")),(mk_real_int (num_of_string "26155717117492121390"));(* 19, 19 *) +(mk_real_int (num_of_string "32788120729712350904")),(mk_real_int (num_of_string "13701368012601836952"));(* 19, 19 *) +(mk_real_int (num_of_string "31429381722792545800")),(mk_real_int (num_of_string "28056695270325970336"));(* 19, 19 *) +(mk_real_int (num_of_string "23946781337003799175")),(mk_real_int (num_of_string "23354125263327730300"));(* 19, 19 *) +(mk_real_int (num_of_string "19610178037329369996")),(mk_real_int (num_of_string "17483345854794771820"));(* 19, 19 *) +(mk_real_int (num_of_string "19580385825437237680")),(mk_real_int (num_of_string "18369444402307520511"));(* 19, 19 *) +(mk_real_int (num_of_string "20373012670885241488")),(mk_real_int (num_of_string "18372444575150410888"));(* 19, 19 *) +(mk_real_int (num_of_string "31774043202253507155")),(mk_real_int (num_of_string "22230406098202282156"));(* 19, 19 *) +(mk_real_int (num_of_string "36260488950256746285")),(mk_real_int (num_of_string "14298842877484343112"));(* 19, 19 *) +(mk_real_int (num_of_string "38348399502295316544")),(mk_real_int (num_of_string "23127526008428915304"));(* 19, 19 *) +(mk_real_int (num_of_string "29468135840364033120")),(mk_real_int (num_of_string "42859521857231658832"));(* 19, 19 *) +(mk_real_int (num_of_string "26195223730935481574")),(mk_real_int (num_of_string "14674640879141308450"));(* 19, 19 *) +(mk_real_int (num_of_string "36971521144248970323")),(mk_real_int (num_of_string "25725412717362572071"));(* 19, 19 *) +(mk_real_int (num_of_string "15373724279892883047")),(mk_real_int (num_of_string "37064424717555453504"));(* 19, 19 *) +(mk_real_int (num_of_string "18456612225491964304")),(mk_real_int (num_of_string "20784497229636632470"));(* 19, 19 *) +(mk_real_int (num_of_string "17238747478973240132")),(mk_real_int (num_of_string "25715658083515545574"));(* 19, 19 *) +(mk_real_int (num_of_string "19434461103584416241")),(mk_real_int (num_of_string "29366615813009873244"));(* 19, 19 *) +(mk_real_int (num_of_string "16186400016474915612")),(mk_real_int (num_of_string "21138557277456953576"));(* 19, 19 *) +(mk_real_int (num_of_string "31076127393825322842")),(mk_real_int (num_of_string "26127382992901047440"));(* 19, 19 *) +(mk_real_int (num_of_string "16638819785499599952")),(mk_real_int (num_of_string "30605559054078364356"));(* 19, 19 *) +(mk_real_int (num_of_string "21653085879670267638")),(mk_real_int (num_of_string "24663482055635505478"));(* 19, 19 *) +(mk_real_int (num_of_string "22047586830857827668")),(mk_real_int (num_of_string "21989678249953775823"));(* 19, 19 *) +(mk_real_int (num_of_string "25246202619247689365")),(mk_real_int (num_of_string "38244780124493141826"));(* 19, 19 *) +(mk_real_int (num_of_string "12754315174605904086")),(mk_real_int (num_of_string "14541853045744529648"));(* 19, 19 *) +(mk_real_int (num_of_string "35068518276916323738")),(mk_real_int (num_of_string "19911078974382448424"));(* 19, 19 *) +(mk_real_int (num_of_string "31788444163659174552")),(mk_real_int (num_of_string "25398105397820760000"));(* 19, 19 *) +(mk_real_int (num_of_string "28708395192612575154")),(mk_real_int (num_of_string "30633710003636824128"));(* 19, 19 *) +(mk_real_int (num_of_string "21039999747285910666")),(mk_real_int (num_of_string "32217872110426500168"));(* 19, 19 *) +(mk_real_int (num_of_string "23961590926169909859")),(mk_real_int (num_of_string "28739147203340671306"));(* 19, 19 *) +(mk_real_int (num_of_string "33711641417643357883")),(mk_real_int (num_of_string "23440835558663189216"));(* 19, 19 *) +(mk_real_int (num_of_string "18430860997436289534")),(mk_real_int (num_of_string "23629245698406122170"));(* 19, 19 *) +(mk_real_int (num_of_string "36675765814115269974")),(mk_real_int (num_of_string "22153900897071146280"));(* 19, 19 *) +(mk_real_int (num_of_string "30642052708947370746")),(mk_real_int (num_of_string "19715061005550366852"));(* 19, 19 *) +(mk_real_int (num_of_string "23631480399362961103")),(mk_real_int (num_of_string "21356124255862188133"));(* 19, 19 *) +(mk_real_int (num_of_string "38061016225101124332")),(mk_real_int (num_of_string "21480531385150581876"));(* 19, 19 *) +(mk_real_int (num_of_string "21788126356522731348")),(mk_real_int (num_of_string "15250407105622096408"));(* 19, 19 *) +(mk_real_int (num_of_string "29939331877831765862")),(mk_real_int (num_of_string "24621235745368217571"));(* 19, 19 *) +(mk_real_int (num_of_string "13559743163737887402")),(mk_real_int (num_of_string "29429210272328063175"));(* 19, 19 *) +(mk_real_int (num_of_string "28196902181228285934")),(mk_real_int (num_of_string "19014462787109404824"));(* 19, 19 *) +(mk_real_int (num_of_string "34413995495155206920")),(mk_real_int (num_of_string "17999593615355747120"));(* 19, 19 *) +(mk_real_int (num_of_string "20098053603131429233")),(mk_real_int (num_of_string "25397368874886828820"));(* 19, 19 *) +(mk_real_int (num_of_string "13991262173392155564")),(mk_real_int (num_of_string "20101775826597660624"));(* 19, 19 *) +(mk_real_int (num_of_string "25958041019478922926")),(mk_real_int (num_of_string "30973577744291784525"));(* 19, 19 *) +(mk_real_int (num_of_string "41762004568998584211")),(mk_real_int (num_of_string "24486642710242001344"));(* 19, 19 *) +(mk_real_int (num_of_string "38468053625130677284")),(mk_real_int (num_of_string "21883488378665367740"));(* 19, 19 *) +(mk_real_int (num_of_string "24217476494071001625")),(mk_real_int (num_of_string "19956600491408230034"));(* 19, 19 *) +(mk_real_int (num_of_string "25031801718319605693")),(mk_real_int (num_of_string "35339430150394906635"));(* 19, 19 *) +(mk_real_int (num_of_string "35354835249533769530")),(mk_real_int (num_of_string "19186948927433489202"));(* 19, 19 *) +(mk_real_int (num_of_string "19633304667574387845")),(mk_real_int (num_of_string "37783496757986652992"));(* 19, 19 *) +(mk_real_int (num_of_string "32591004179898436580")),(mk_real_int (num_of_string "26031672488743456128"));(* 19, 19 *) +(mk_real_int (num_of_string "19562909602060384076")),(mk_real_int (num_of_string "18420082240032456225"));(* 19, 19 *) +(mk_real_int (num_of_string "33906326894153724824")),(mk_real_int (num_of_string "23773891695716936565"));(* 19, 19 *) +(mk_real_int (num_of_string "21631917102787719552")),(mk_real_int (num_of_string "21696134640674596080"));(* 19, 19 *) +(mk_real_int (num_of_string "27877186561900804480")),(mk_real_int (num_of_string "32708760906440572536"));(* 19, 19 *) +(mk_real_int (num_of_string "28250948698268387168")),(mk_real_int (num_of_string "21718640730902267944"));(* 19, 19 *) +(mk_real_int (num_of_string "28054715173237417192")),(mk_real_int (num_of_string "23724974246612918125"));(* 19, 19 *) +(mk_real_int (num_of_string "13565268300577577980")),(mk_real_int (num_of_string "18766332146987952351"));(* 19, 19 *) +(mk_real_int (num_of_string "29089666539115063112")),(mk_real_int (num_of_string "11788072578080417476"));(* 19, 19 *) +(mk_real_int (num_of_string "31029529641606442320")),(mk_real_int (num_of_string "21189804410527311174"));(* 19, 19 *) +(mk_real_int (num_of_string "21801602489769337686")),(mk_real_int (num_of_string "23333346236694607520"));(* 19, 19 *) +(mk_real_int (num_of_string "22684686870294067696")),(mk_real_int (num_of_string "15329888225567164194"));(* 19, 19 *) +(mk_real_int (num_of_string "22437730893159525592")),(mk_real_int (num_of_string "31755887733435638916"));(* 19, 19 *) +(mk_real_int (num_of_string "14118269694795938672")),(mk_real_int (num_of_string "19722019532976082278"));(* 19, 19 *) +(mk_real_int (num_of_string "26250225002606078045")),(mk_real_int (num_of_string "21135249282229087676"));(* 19, 19 *) +(mk_real_int (num_of_string "21754225347515547458")),(mk_real_int (num_of_string "14890978077204913948"));(* 19, 19 *) +(mk_real_int (num_of_string "23066719611694210881")),(mk_real_int (num_of_string "33227912427853816728"));(* 19, 19 *) +(mk_real_int (num_of_string "25405180212497008000")),(mk_real_int (num_of_string "12418361347178457440"));(* 19, 19 *) +(mk_real_int (num_of_string "33247375512579506300")),(mk_real_int (num_of_string "25281151297831080333"));(* 19, 19 *) +(mk_real_int (num_of_string "29600381494511770954")),(mk_real_int (num_of_string "24180176992314040940"));(* 19, 19 *) +(mk_real_int (num_of_string "38059796897847382064")),(mk_real_int (num_of_string "24518423044570037440"));(* 19, 19 *) +(mk_real_int (num_of_string "37060845735857157500")),(mk_real_int (num_of_string "21514010489270917365"));(* 19, 19 *) +(mk_real_int (num_of_string "33948244403495950000")),(mk_real_int (num_of_string "13427941318582173240"));(* 19, 19 *) +(mk_real_int (num_of_string "30925399411668710520")),(mk_real_int (num_of_string "30536000935575507064"));(* 19, 19 *) +(mk_real_int (num_of_string "15178435189357299200")),(mk_real_int (num_of_string "36076146656034140480"));(* 19, 19 *) +(mk_real_int (num_of_string "34199486308027151958")),(mk_real_int (num_of_string "17512585691833478400"));(* 19, 19 *) +(mk_real_int (num_of_string "23048226430814991780")),(mk_real_int (num_of_string "34970883248279429220"));(* 19, 19 *) +(mk_real_int (num_of_string "33972533374485277440")),(mk_real_int (num_of_string "28540529182512238078"));(* 19, 19 *) +(mk_real_int (num_of_string "25233560957627367884")),(mk_real_int (num_of_string "18038597906312433296"));(* 19, 19 *) +(mk_real_int (num_of_string "20959328223742049152")),(mk_real_int (num_of_string "21595284432295804230"));(* 19, 19 *) +(mk_real_int (num_of_string "34839745554275565860")),(mk_real_int (num_of_string "27666930136205473575"));(* 19, 19 *) +(mk_real_int (num_of_string "18148005270634314735")),(mk_real_int (num_of_string "20922461477993382736"));(* 19, 19 *) +(mk_real_int (num_of_string "34823205431082330526")),(mk_real_int (num_of_string "35633283730567513870"));(* 19, 19 *) +(mk_real_int (num_of_string "21193870188627553032")),(mk_real_int (num_of_string "29351738040767819600"));(* 19, 19 *) +(mk_real_int (num_of_string "30455341615295874068")),(mk_real_int (num_of_string "20117684297361308196"));(* 19, 19 *) +(mk_real_int (num_of_string "24509729858501569539")),(mk_real_int (num_of_string "18946984426713251370"));(* 19, 19 *) +(mk_real_int (num_of_string "22318280476914474624")),(mk_real_int (num_of_string "31543831574588562669"));(* 19, 19 *) +(mk_real_int (num_of_string "32876829237972386205")),(mk_real_int (num_of_string "17641064336296436992"));(* 19, 19 *) +(mk_real_int (num_of_string "16136845849044126976")),(mk_real_int (num_of_string "12024977431884627056"));(* 19, 19 *) +(mk_real_int (num_of_string "29591382097243846726")),(mk_real_int (num_of_string "21761958033105990414"));(* 19, 19 *) +(mk_real_int (num_of_string "34921852586595252300")),(mk_real_int (num_of_string "36338215165810686975"));(* 19, 19 *) +(mk_real_int (num_of_string "31575698644415464759")),(mk_real_int (num_of_string "36821630712231475000"));(* 19, 19 *) +(mk_real_int (num_of_string "29374461955377970200")),(mk_real_int (num_of_string "19295396972157570858"));(* 19, 19 *) +(mk_real_int (num_of_string "23551080882586423254")),(mk_real_int (num_of_string "26021043057968355045"));(* 19, 19 *) +(mk_real_int (num_of_string "24509669884122627930")),(mk_real_int (num_of_string "22765660249132309080"));(* 19, 19 *) +(mk_real_int (num_of_string "27502589129746076940")),(mk_real_int (num_of_string "26600162897418547866"));(* 19, 19 *) +(mk_real_int (num_of_string "21197378314893792000")),(mk_real_int (num_of_string "14999401956071515400"));(* 19, 19 *) +(mk_real_int (num_of_string "31726683382172574686")),(mk_real_int (num_of_string "24156318532958805215"));(* 19, 19 *) +(mk_real_int (num_of_string "18516751632574286861")),(mk_real_int (num_of_string "16464444229019918560"));(* 19, 19 *) +(mk_real_int (num_of_string "23282705218191493228")),(mk_real_int (num_of_string "26808540544890302352"));(* 19, 19 *) +(mk_real_int (num_of_string "24224375458191889167")),(mk_real_int (num_of_string "40426735523114963660"));(* 19, 19 *) +(mk_real_int (num_of_string "24729832065754451845")),(mk_real_int (num_of_string "40256825431310309338"));(* 19, 19 *) +(mk_real_int (num_of_string "24532845531534315261")),(mk_real_int (num_of_string "24997986586900784424"));(* 19, 19 *) +(mk_real_int (num_of_string "21455661113055105255")),(mk_real_int (num_of_string "23737870065937842496"));(* 19, 19 *) +(mk_real_int (num_of_string "24503286503879146700")),(mk_real_int (num_of_string "18885353652616094226"));(* 19, 19 *) +(mk_real_int (num_of_string "15813703053057549222")),(mk_real_int (num_of_string "18659272566817945920"));(* 19, 19 *) +(mk_real_int (num_of_string "21919386273746184256")),(mk_real_int (num_of_string "24410507728974085290"));(* 19, 19 *) +(mk_real_int (num_of_string "35351640769827902388")),(mk_real_int (num_of_string "35166919009549550091"));(* 19, 19 *) +(mk_real_int (num_of_string "12403084155904289056")),(mk_real_int (num_of_string "38587630402981230956"));(* 19, 19 *) +(mk_real_int (num_of_string "18357829687152643930")),(mk_real_int (num_of_string "22525579055020439794"));(* 19, 19 *) +(mk_real_int (num_of_string "21858957799970582577")),(mk_real_int (num_of_string "23238374947547825384"));(* 19, 19 *) +(mk_real_int (num_of_string "20065513266972118044")),(mk_real_int (num_of_string "18068565091568894045"));(* 19, 19 *) +(mk_real_int (num_of_string "15661850298963786720")),(mk_real_int (num_of_string "24517170026531564250"));(* 19, 19 *) +(mk_real_int (num_of_string "25303340338657447968")),(mk_real_int (num_of_string "21935617186639158288"));(* 19, 19 *) +(mk_real_int (num_of_string "33081651678310792722")),(mk_real_int (num_of_string "13827540706109639894"));(* 19, 19 *) +(mk_real_int (num_of_string "16335537411557237610")),(mk_real_int (num_of_string "23561533332977778831"));(* 19, 19 *) +(mk_real_int (num_of_string "28233169332902303880")),(mk_real_int (num_of_string "15695575969530806712"));(* 19, 19 *) +(mk_real_int (num_of_string "21011542803365853618")),(mk_real_int (num_of_string "38561936241481526720"));(* 19, 19 *) +(mk_real_int (num_of_string "18827391882792107560")),(mk_real_int (num_of_string "26745459634561440762"));(* 19, 19 *) +(mk_real_int (num_of_string "23590842498659226450")),(mk_real_int (num_of_string "23742472686542216068"));(* 19, 19 *) +(mk_real_int (num_of_string "32665890285705956389")),(mk_real_int (num_of_string "37728670265050820880"));(* 19, 19 *) +(mk_real_int (num_of_string "27576476991159319850")),(mk_real_int (num_of_string "32543750898982323880"));(* 19, 19 *) +(mk_real_int (num_of_string "22766986312687886698")),(mk_real_int (num_of_string "19774910912344837843"));(* 19, 19 *) +(mk_real_int (num_of_string "42511566901090363692")),(mk_real_int (num_of_string "24598422411097651215"));(* 19, 19 *) +(mk_real_int (num_of_string "28192701133435584702")),(mk_real_int (num_of_string "12553678556632687936"));(* 19, 19 *) +(mk_real_int (num_of_string "32221328176975547940")),(mk_real_int (num_of_string "17102144059749226368"));(* 19, 19 *) +(mk_real_int (num_of_string "28862640072739190773")),(mk_real_int (num_of_string "28684249091778024250"));(* 19, 19 *) +(mk_real_int (num_of_string "18566567717553172680")),(mk_real_int (num_of_string "13946885838781744420"));(* 19, 19 *) +(mk_real_int (num_of_string "19114401628089157500")),(mk_real_int (num_of_string "20162167293220081591"));(* 19, 19 *) +(mk_real_int (num_of_string "19851583929739884124")),(mk_real_int (num_of_string "27857155807442616160"));(* 19, 19 *) +(mk_real_int (num_of_string "17972046906509828649")),(mk_real_int (num_of_string "20570599301922216767"));(* 19, 19 *) +(mk_real_int (num_of_string "21617151726877793163")),(mk_real_int (num_of_string "16346621830867942108"));(* 19, 19 *) +(mk_real_int (num_of_string "19069024794172757888")),(mk_real_int (num_of_string "15223494796378903056"));(* 19, 19 *) +(mk_real_int (num_of_string "20516178072197899047")),(mk_real_int (num_of_string "29671516061196220134"));(* 19, 19 *) +(mk_real_int (num_of_string "20762847548821657125")),(mk_real_int (num_of_string "17343373910494965080"));(* 19, 19 *) +(mk_real_int (num_of_string "20618467076378920320")),(mk_real_int (num_of_string "21135634926579888000"));(* 19, 19 *) +(mk_real_int (num_of_string "28783602679901071002")),(mk_real_int (num_of_string "30607469559621331036"));(* 19, 19 *) +(mk_real_int (num_of_string "34952750589763145172")),(mk_real_int (num_of_string "20773387779415296718"));(* 19, 19 *) +(mk_real_int (num_of_string "21663700659878912052")),(mk_real_int (num_of_string "31738022168048514120"));(* 19, 19 *) +(mk_real_int (num_of_string "15067586704074398450")),(mk_real_int (num_of_string "39393741347756167548"));(* 19, 19 *) +(mk_real_int (num_of_string "25856646965954567103")),(mk_real_int (num_of_string "24101111445972077902"));(* 19, 19 *) +(mk_real_int (num_of_string "22969508248904385861")),(mk_real_int (num_of_string "17853062093770904110"));(* 19, 19 *) +(mk_real_int (num_of_string "23593250100320878131")),(mk_real_int (num_of_string "34052417430591296880"));(* 19, 19 *) +(mk_real_int (num_of_string "25574140422098661888")),(mk_real_int (num_of_string "32110910233566469272"));(* 19, 19 *) +(mk_real_int (num_of_string "27312149886651808101")),(mk_real_int (num_of_string "31819075231891378706"));(* 19, 19 *) +(mk_real_int (num_of_string "20228868063451733400")),(mk_real_int (num_of_string "22767237113306329688"));(* 19, 19 *) +(mk_real_int (num_of_string "29000691323467414012")),(mk_real_int (num_of_string "29688670921350339184"));(* 19, 19 *) +(mk_real_int (num_of_string "18149199099000179925")),(mk_real_int (num_of_string "13176519098165803292"));(* 19, 19 *) +(mk_real_int (num_of_string "20895657111240075120")),(mk_real_int (num_of_string "30387247130400193110"));(* 19, 19 *) +(mk_real_int (num_of_string "18041726745700697028")),(mk_real_int (num_of_string "16578817088051910560"));(* 19, 19 *) +(mk_real_int (num_of_string "18724010569156142976")),(mk_real_int (num_of_string "30283190447828916290"));(* 19, 19 *) +(mk_real_int (num_of_string "21485532037632035230")),(mk_real_int (num_of_string "21228585073275008000"));(* 19, 19 *) +(mk_real_int (num_of_string "15441576730070721120")),(mk_real_int (num_of_string "23203789204405517796"));(* 19, 19 *) +(mk_real_int (num_of_string "23980580918626336290")),(mk_real_int (num_of_string "27884855142978774336"));(* 19, 19 *) +(mk_real_int (num_of_string "24458494418868606734")),(mk_real_int (num_of_string "31956362945544922500"));(* 19, 19 *) +(mk_real_int (num_of_string "17543007688597081064")),(mk_real_int (num_of_string "29665170852355203858"));(* 19, 19 *) +(mk_real_int (num_of_string "23391008316914182692")),(mk_real_int (num_of_string "21740149625097397395"));(* 19, 19 *) +(mk_real_int (num_of_string "17968200652006529540")),(mk_real_int (num_of_string "15280161176449006882"));(* 19, 19 *) +(mk_real_int (num_of_string "18526668902915813145")),(mk_real_int (num_of_string "25725618717964397320"));(* 19, 19 *) +(mk_real_int (num_of_string "37631433263277548343")),(mk_real_int (num_of_string "24302775082118358980"));(* 19, 19 *) +(mk_real_int (num_of_string "16234385580921780712")),(mk_real_int (num_of_string "19115360328189971538"));(* 19, 19 *) +(mk_real_int (num_of_string "38862409563677772864")),(mk_real_int (num_of_string "19997602817828134268"));(* 19, 19 *) +(mk_real_int (num_of_string "14454331638446689220")),(mk_real_int (num_of_string "19903070754044856356"));(* 19, 19 *) +(mk_real_int (num_of_string "32907022481777039255")),(mk_real_int (num_of_string "27067046447658850864"));(* 19, 19 *) +(mk_real_int (num_of_string "17889493514926932547")),(mk_real_int (num_of_string "34423976486808398336"));(* 19, 19 *) +(mk_real_int (num_of_string "30173428453947449220")),(mk_real_int (num_of_string "13570298312770941324"));(* 19, 19 *) +(mk_real_int (num_of_string "21159384420414011585")),(mk_real_int (num_of_string "38204222449892118620"));(* 19, 19 *) +(mk_real_int (num_of_string "29252463947900339168")),(mk_real_int (num_of_string "18824370595084099045"));(* 19, 19 *) +(mk_real_int (num_of_string "31592010113233650476")),(mk_real_int (num_of_string "16593326100162570330"));(* 19, 19 *) +(mk_real_int (num_of_string "29154597430593861512")),(mk_real_int (num_of_string "26803434626433084312"));(* 19, 19 *) +(mk_real_int (num_of_string "21021652073815640951")),(mk_real_int (num_of_string "20942684826217401632"));(* 19, 19 *) +(mk_real_int (num_of_string "37639824290981401104")),(mk_real_int (num_of_string "24256345483251875620"));(* 19, 19 *) +(mk_real_int (num_of_string "22611435485892780296")),(mk_real_int (num_of_string "18571118204886449664"));(* 19, 19 *) +(mk_real_int (num_of_string "23344095849474622365")),(mk_real_int (num_of_string "22711490771468691291"));(* 19, 19 *) +(mk_real_int (num_of_string "21022861777868756025")),(mk_real_int (num_of_string "23592319748734711491"));(* 19, 19 *) +(mk_real_int (num_of_string "33550375893316112226")),(mk_real_int (num_of_string "12443890794364870566"));(* 19, 19 *) +(mk_real_int (num_of_string "31091426703633150426")),(mk_real_int (num_of_string "18683078954341495485"));(* 19, 19 *) +(mk_real_int (num_of_string "22029307894570906215")),(mk_real_int (num_of_string "29180187263806709438"));(* 19, 19 *) +(mk_real_int (num_of_string "17313467714242277160")),(mk_real_int (num_of_string "21175391909182828900"));(* 19, 19 *) +(mk_real_int (num_of_string "20886644587278159228")),(mk_real_int (num_of_string "24308394289659303439"));(* 19, 19 *) +(mk_real_int (num_of_string "17377934872656963000")),(mk_real_int (num_of_string "19694851222645694865"));(* 19, 19 *) +(mk_real_int (num_of_string "19531645594108771200")),(mk_real_int (num_of_string "27353687880319154079"));(* 19, 19 *) +(mk_real_int (num_of_string "15095517418017230084")),(mk_real_int (num_of_string "24367145327645102598"));(* 19, 19 *) +(mk_real_int (num_of_string "30670896409691227140")),(mk_real_int (num_of_string "23282256849070081995"));(* 19, 19 *) +(mk_real_int (num_of_string "18058765456197825546")),(mk_real_int (num_of_string "20692670312869565230"));(* 19, 19 *) +(mk_real_int (num_of_string "14195656193932143700")),(mk_real_int (num_of_string "28545033381349941060"));(* 19, 19 *) +(mk_real_int (num_of_string "17570057243762665488")),(mk_real_int (num_of_string "16610104346969969561"));(* 19, 19 *) +(mk_real_int (num_of_string "20380752462050320626")),(mk_real_int (num_of_string "20065344591096659624"));(* 19, 19 *) +(mk_real_int (num_of_string "19232092477610461636")),(mk_real_int (num_of_string "25973000999163902464"));(* 19, 19 *) +(mk_real_int (num_of_string "24995182068165660692")),(mk_real_int (num_of_string "19286366253170364854"));(* 19, 19 *) +(mk_real_int (num_of_string "35445021594672206286")),(mk_real_int (num_of_string "29931442569965248026"));(* 19, 19 *) +(mk_real_int (num_of_string "29117447130800545495")),(mk_real_int (num_of_string "22155053961808404120"));(* 19, 19 *) +(mk_real_int (num_of_string "27742764056591265990")),(mk_real_int (num_of_string "18980076482308156908"));(* 19, 19 *) +(mk_real_int (num_of_string "16966438935537374250")),(mk_real_int (num_of_string "29178181123590289703"));(* 19, 19 *) +(mk_real_int (num_of_string "12053340226144389282")),(mk_real_int (num_of_string "33855812770349013290"));(* 19, 19 *) +(mk_real_int (num_of_string "18170280513695587585")),(mk_real_int (num_of_string "25754112139586535408"));(* 19, 19 *) +(mk_real_int (num_of_string "18186168554789042808")),(mk_real_int (num_of_string "13330016601258737358"));(* 19, 19 *) +(mk_real_int (num_of_string "15906969118515146595")),(mk_real_int (num_of_string "22286164457235329244"));(* 19, 19 *) +(mk_real_int (num_of_string "21581669523223757508")),(mk_real_int (num_of_string "14562959639504134320"));(* 19, 19 *) +(mk_real_int (num_of_string "35482774215702490710")),(mk_real_int (num_of_string "35607133211609937384"));(* 19, 19 *) +(mk_real_int (num_of_string "16209989142320107772")),(mk_real_int (num_of_string "22345207211109852927"));(* 19, 19 *) +(mk_real_int (num_of_string "21773240177061127744")),(mk_real_int (num_of_string "14433677298971087520"));(* 19, 19 *) +(mk_real_int (num_of_string "18936034135085987348")),(mk_real_int (num_of_string "13471466844063717500"));(* 19, 19 *) +(mk_real_int (num_of_string "17354745485231552640")),(mk_real_int (num_of_string "18230529179626830000"));(* 19, 19 *) +(mk_real_int (num_of_string "19220326678110420720")),(mk_real_int (num_of_string "24737122565887447254"));(* 19, 19 *) +(mk_real_int (num_of_string "15259900645808649996")),(mk_real_int (num_of_string "20992671308236571416"));(* 19, 19 *) +(mk_real_int (num_of_string "24176218476796561989")),(mk_real_int (num_of_string "21364738248703094784"));(* 19, 19 *) +(mk_real_int (num_of_string "20815812501351657768")),(mk_real_int (num_of_string "17048832156482749480"));(* 19, 19 *) +(mk_real_int (num_of_string "27210633864901937978")),(mk_real_int (num_of_string "16484565937387436020"));(* 19, 19 *) +(mk_real_int (num_of_string "28892013642217754930")),(mk_real_int (num_of_string "17968794754260957508"));(* 19, 19 *) +(mk_real_int (num_of_string "20532996895144585137")),(mk_real_int (num_of_string "24178200931553138613"));(* 19, 19 *) +(mk_real_int (num_of_string "27344628599778361927")),(mk_real_int (num_of_string "25029824984976538980"));(* 19, 19 *) +(mk_real_int (num_of_string "19599776763403286714")),(mk_real_int (num_of_string "22323268951505419260"));(* 19, 19 *) +(mk_real_int (num_of_string "28389907471848568800")),(mk_real_int (num_of_string "28274088091656918170"));(* 19, 19 *) +(mk_real_int (num_of_string "21166750325965741112")),(mk_real_int (num_of_string "33977726365574968878"));(* 19, 19 *) +(mk_real_int (num_of_string "24670303706391574110")),(mk_real_int (num_of_string "25971856095244184576"));(* 19, 19 *) +(mk_real_int (num_of_string "17277683789911756959")),(mk_real_int (num_of_string "27229795019899182700"));(* 19, 19 *) +(mk_real_int (num_of_string "21402593447934487734")),(mk_real_int (num_of_string "21687111141911205408"));(* 19, 19 *) +(mk_real_int (num_of_string "29078686775718432160")),(mk_real_int (num_of_string "25171811110690446323"));(* 19, 19 *) +(mk_real_int (num_of_string "27126072922588956756")),(mk_real_int (num_of_string "23950321867875466360"));(* 19, 19 *) +(mk_real_int (num_of_string "33305771987516661017")),(mk_real_int (num_of_string "24468524500330552290"));(* 19, 19 *) +(mk_real_int (num_of_string "27921131753019252990")),(mk_real_int (num_of_string "26394242937943914528"));(* 19, 19 *) +(mk_real_int (num_of_string "27045834098608407148")),(mk_real_int (num_of_string "26617239134096634870"));(* 19, 19 *) +(mk_real_int (num_of_string "17827874715790694522")),(mk_real_int (num_of_string "19275397617563667855"));(* 19, 19 *) +(mk_real_int (num_of_string "15522028285332619974")),(mk_real_int (num_of_string "33087542953825461387"));(* 19, 19 *) +(mk_real_int (num_of_string "19684113097994867522")),(mk_real_int (num_of_string "30361068119675378052"));(* 19, 19 *) +(mk_real_int (num_of_string "17777766080187911952")),(mk_real_int (num_of_string "28304071546000928832"));(* 19, 19 *) +(mk_real_int (num_of_string "24701740819723327976")),(mk_real_int (num_of_string "23249426930623449963"));(* 19, 19 *) +(mk_real_int (num_of_string "15626383485965048225")),(mk_real_int (num_of_string "24610090203093475916"));(* 19, 19 *) +(mk_real_int (num_of_string "19912840531332936836")),(mk_real_int (num_of_string "36655821249221511260"));(* 19, 19 *) +(mk_real_int (num_of_string "23457936080048044960")),(mk_real_int (num_of_string "31405259545579645440"));(* 19, 19 *) +(mk_real_int (num_of_string "26162251126555051728")),(mk_real_int (num_of_string "34953126054172656682"));(* 19, 19 *) +(mk_real_int (num_of_string "20947243755607552460")),(mk_real_int (num_of_string "33040622577818480108"));(* 19, 19 *) +(mk_real_int (num_of_string "14078893498675132050")),(mk_real_int (num_of_string "26209061871934627576"));(* 19, 19 *) +(mk_real_int (num_of_string "17874561660889509378")),(mk_real_int (num_of_string "34995431734586687364"));(* 19, 19 *) +(mk_real_int (num_of_string "19722509821913233335")),(mk_real_int (num_of_string "26216971740241668540"));(* 19, 19 *) +(mk_real_int (num_of_string "18344244271878932440")),(mk_real_int (num_of_string "23392767028792280273"));(* 19, 19 *) +(mk_real_int (num_of_string "28032454510825810122")),(mk_real_int (num_of_string "25999562749903501528"));(* 19, 19 *) +(mk_real_int (num_of_string "34663056879982884584")),(mk_real_int (num_of_string "28928679338965278510"));(* 19, 19 *) +(mk_real_int (num_of_string "16467213935942451990")),(mk_real_int (num_of_string "20701325711559050712"));(* 19, 19 *) +(mk_real_int (num_of_string "20958348605371005444")),(mk_real_int (num_of_string "20693907454225623640"));(* 19, 19 *) +(mk_real_int (num_of_string "22991639050824817560")),(mk_real_int (num_of_string "22831987758755124345"));(* 19, 19 *) +(mk_real_int (num_of_string "18963489141520879307")),(mk_real_int (num_of_string "31099308534703877160"));(* 19, 19 *) +(mk_real_int (num_of_string "28750492385478360200")),(mk_real_int (num_of_string "25020044018647608777"));(* 19, 19 *) +(mk_real_int (num_of_string "33629559216526149096")),(mk_real_int (num_of_string "20567895169536088396"));(* 19, 19 *) +(mk_real_int (num_of_string "28183874476069732794")),(mk_real_int (num_of_string "23063923513337985905"));(* 19, 19 *) +(mk_real_int (num_of_string "31627307797642771830")),(mk_real_int (num_of_string "28106774188626583241"));(* 19, 19 *) +(mk_real_int (num_of_string "12952044016828521220")),(mk_real_int (num_of_string "25641346373459661163"));(* 19, 19 *) +(mk_real_int (num_of_string "21103192133019558144")),(mk_real_int (num_of_string "15481220670131773128"));(* 19, 19 *) +(mk_real_int (num_of_string "41898102151306065214")),(mk_real_int (num_of_string "29960774778839900248"));(* 19, 19 *) +(mk_real_int (num_of_string "15034303370302387325")),(mk_real_int (num_of_string "12300353092863620928"));(* 19, 19 *) +(mk_real_int (num_of_string "35528629318596256700")),(mk_real_int (num_of_string "21920093424238797216"));(* 19, 19 *) +(mk_real_int (num_of_string "35117743435591618131")),(mk_real_int (num_of_string "28003743443031332900"));(* 19, 19 *) +(mk_real_int (num_of_string "37066810033626111365")),(mk_real_int (num_of_string "36090507772144342506"));(* 19, 19 *) +(mk_real_int (num_of_string "34724490290216914275")),(mk_real_int (num_of_string "17161689223016674028"));(* 19, 19 *) +(mk_real_int (num_of_string "21219950840232526800")),(mk_real_int (num_of_string "18415045991539750058"));(* 19, 19 *) +(mk_real_int (num_of_string "37759705646207842143")),(mk_real_int (num_of_string "20577665293957461459"));(* 19, 19 *) +(mk_real_int (num_of_string "22563412948386039015")),(mk_real_int (num_of_string "20175884350710156552"));(* 19, 19 *) +(mk_real_int (num_of_string "18212580186806832640")),(mk_real_int (num_of_string "15216977162738800735"));(* 19, 19 *) +(mk_real_int (num_of_string "25940566047008574940")),(mk_real_int (num_of_string "31634171328449180634"));(* 19, 19 *) +(mk_real_int (num_of_string "18897775995233865620")),(mk_real_int (num_of_string "34790823789921925902"));(* 19, 19 *) +(mk_real_int (num_of_string "29165832446308109530")),(mk_real_int (num_of_string "23630863338677843270"));(* 19, 19 *) +(mk_real_int (num_of_string "18526482687065515173")),(mk_real_int (num_of_string "30497661154671633351"));(* 19, 19 *) +(mk_real_int (num_of_string "12613587919218559196")),(mk_real_int (num_of_string "30148283770248797120"));(* 19, 19 *) +(mk_real_int (num_of_string "25043255540874981223")),(mk_real_int (num_of_string "28689590854105105210"));(* 19, 19 *) +(mk_real_int (num_of_string "35322221600815909474")),(mk_real_int (num_of_string "18051552726004570256"));(* 19, 19 *) +(mk_real_int (num_of_string "29343576262735977704")),(mk_real_int (num_of_string "35294058361966766736"));(* 19, 19 *) +(mk_real_int (num_of_string "20516884598322759438")),(mk_real_int (num_of_string "19320319006336470122"));(* 19, 19 *) +(mk_real_int (num_of_string "31267282633928547844")),(mk_real_int (num_of_string "35861154558309369366"));(* 19, 19 *) +(mk_real_int (num_of_string "27550689559525622094")),(mk_real_int (num_of_string "26280923396917494393"));(* 19, 19 *) +(mk_real_int (num_of_string "18145348381422887130")),(mk_real_int (num_of_string "26184297950690421630"));(* 19, 19 *) +(mk_real_int (num_of_string "15422719373259310684")),(mk_real_int (num_of_string "33476564191573589009"));(* 19, 19 *) +(mk_real_int (num_of_string "32556607704984662112")),(mk_real_int (num_of_string "25630833834504104877"));(* 19, 19 *) +(mk_real_int (num_of_string "28594665725854332522")),(mk_real_int (num_of_string "14327634629606891549"));(* 19, 19 *) +(mk_real_int (num_of_string "22365449743008243344")),(mk_real_int (num_of_string "34684581374063387745"));(* 19, 19 *) +(mk_real_int (num_of_string "40236644587287275886")),(mk_real_int (num_of_string "20781153690060239586"));(* 19, 19 *) +(mk_real_int (num_of_string "18610141729705037325")),(mk_real_int (num_of_string "13176319433599394314"));(* 19, 19 *) +(mk_real_int (num_of_string "27542384672833362156")),(mk_real_int (num_of_string "19682637014151234816"));(* 19, 19 *) +(mk_real_int (num_of_string "23708318483042944718")),(mk_real_int (num_of_string "31868852818940076324"));(* 19, 19 *) +(mk_real_int (num_of_string "29843340901941755540")),(mk_real_int (num_of_string "26706282763966833720"));(* 19, 19 *) +(mk_real_int (num_of_string "34001500222865547427")),(mk_real_int (num_of_string "22507086852821019548"));(* 19, 19 *) +(mk_real_int (num_of_string "35842699595817676980")),(mk_real_int (num_of_string "23728872105232017020"));(* 19, 19 *) +(mk_real_int (num_of_string "19828772840263304225")),(mk_real_int (num_of_string "24823180329320899372"));(* 19, 19 *) +(mk_real_int (num_of_string "32553484226000737560")),(mk_real_int (num_of_string "18147481397960764157"));(* 19, 19 *) +(mk_real_int (num_of_string "21676364112776796632")),(mk_real_int (num_of_string "15041594447000182116"));(* 19, 19 *) +(mk_real_int (num_of_string "16447285630014439695")),(mk_real_int (num_of_string "17551431940450573440"));(* 19, 19 *) +(mk_real_int (num_of_string "16808111208105559936")),(mk_real_int (num_of_string "25772541405183852125"));(* 19, 19 *) +(mk_real_int (num_of_string "24874720927323956766")),(mk_real_int (num_of_string "16990049119982136396"));(* 19, 19 *) +(mk_real_int (num_of_string "11891814757647978065")),(mk_real_int (num_of_string "21732289830190325375"));(* 19, 19 *) +(mk_real_int (num_of_string "23456784257886497078")),(mk_real_int (num_of_string "17877286236876984665"));(* 19, 19 *) +(mk_real_int (num_of_string "28949427753858318278")),(mk_real_int (num_of_string "23397956039203959213"));(* 19, 19 *) +(mk_real_int (num_of_string "15179451784142189390")),(mk_real_int (num_of_string "21984582213447723562"));(* 19, 19 *) +(mk_real_int (num_of_string "16899841421205218575")),(mk_real_int (num_of_string "16669908767746994760"));(* 19, 19 *) +(mk_real_int (num_of_string "28223003585259342288")),(mk_real_int (num_of_string "29797405189398803880"));(* 19, 19 *) +(mk_real_int (num_of_string "21507545708574622752")),(mk_real_int (num_of_string "25975447924780473350"));(* 19, 19 *) +(mk_real_int (num_of_string "26205609252560085095")),(mk_real_int (num_of_string "24731479066832761608"));(* 19, 19 *) +(mk_real_int (num_of_string "27985839086539151840")),(mk_real_int (num_of_string "17671559399794983980"));(* 19, 19 *) +(mk_real_int (num_of_string "15895356965370990107")),(mk_real_int (num_of_string "22632390546596123590"));(* 19, 19 *) +(mk_real_int (num_of_string "25525045286361632286")),(mk_real_int (num_of_string "27987171825415936826"));(* 19, 19 *) +(mk_real_int (num_of_string "20293758261542977629")),(mk_real_int (num_of_string "21813473539208521940"));(* 19, 19 *) +(mk_real_int (num_of_string "17572261936650012042")),(mk_real_int (num_of_string "30624608353547807962"));(* 19, 19 *) +(mk_real_int (num_of_string "20956472842282125555")),(mk_real_int (num_of_string "21692216994371491480"));(* 19, 19 *) +(mk_real_int (num_of_string "16225444592257846308")),(mk_real_int (num_of_string "27965542798181046135"));(* 19, 19 *) +(mk_real_int (num_of_string "15036010767021545180")),(mk_real_int (num_of_string "20929192536310667202"));(* 19, 19 *) +(mk_real_int (num_of_string "22616206252016347080")),(mk_real_int (num_of_string "18021113039004339000"));(* 19, 19 *) +(mk_real_int (num_of_string "31068739159544436900")),(mk_real_int (num_of_string "21403839397870847225"));(* 19, 19 *) +(mk_real_int (num_of_string "18831386543112750915")),(mk_real_int (num_of_string "30980340403688096080"));(* 19, 19 *) +(mk_real_int (num_of_string "15652020837335436840")),(mk_real_int (num_of_string "19970010932973331923"));(* 19, 19 *) +(mk_real_int (num_of_string "19286980805687969286")),(mk_real_int (num_of_string "19368977873383819989"));(* 19, 19 *) +(mk_real_int (num_of_string "20924342284695386394")),(mk_real_int (num_of_string "17027708934231526300"));(* 19, 19 *) +(mk_real_int (num_of_string "11910339418519621937")),(mk_real_int (num_of_string "20557989760266093520"));(* 19, 19 *) +(mk_real_int (num_of_string "20563150893831517356")),(mk_real_int (num_of_string "22273400428480720640"));(* 19, 19 *) +(mk_real_int (num_of_string "19846853780140487683")),(mk_real_int (num_of_string "19693815906448338072"));(* 19, 19 *) +(mk_real_int (num_of_string "21914899759078112226")),(mk_real_int (num_of_string "18879844193693089464"));(* 19, 19 *) +(mk_real_int (num_of_string "30996332483375752196")),(mk_real_int (num_of_string "22054403955108551818"));(* 19, 19 *) +(mk_real_int (num_of_string "42098132858377824140")),(mk_real_int (num_of_string "16499240709793965860"));(* 19, 19 *) +(mk_real_int (num_of_string "23438588359708245625")),(mk_real_int (num_of_string "27294632478354169841"));(* 19, 19 *) +(mk_real_int (num_of_string "20362447198571333625")),(mk_real_int (num_of_string "19778322300291670500"));(* 19, 19 *) +(mk_real_int (num_of_string "28984118193464681808")),(mk_real_int (num_of_string "18615777827849879292"));(* 19, 19 *) +(mk_real_int (num_of_string "37377977572124788555")),(mk_real_int (num_of_string "21200286739730208957"));(* 19, 19 *) +(mk_real_int (num_of_string "34034199364359205396")),(mk_real_int (num_of_string "19135486806945622036"));(* 19, 19 *) +(mk_real_int (num_of_string "26574092226113406975")),(mk_real_int (num_of_string "27364197794452862959"));(* 19, 19 *) +(mk_real_int (num_of_string "16628062295952432512")),(mk_real_int (num_of_string "14090157723953142975"));(* 19, 19 *) +(mk_real_int (num_of_string "18674051343439457273")),(mk_real_int (num_of_string "40668265006554954780"));(* 19, 19 *) +(mk_real_int (num_of_string "15683851921081656312")),(mk_real_int (num_of_string "33380019479297179854"));(* 19, 19 *) +(mk_real_int (num_of_string "18495271454633589242")),(mk_real_int (num_of_string "28345198646120300208"));(* 19, 19 *) +(mk_real_int (num_of_string "30790102737490098464")),(mk_real_int (num_of_string "29434253824397078316"));(* 19, 19 *) +(mk_real_int (num_of_string "23301763729611442768")),(mk_real_int (num_of_string "17515245159724128817"));(* 19, 19 *) +(mk_real_int (num_of_string "26471663763843548250")),(mk_real_int (num_of_string "25905254090861207216"));(* 19, 19 *) +(mk_real_int (num_of_string "26333740460139536160")),(mk_real_int (num_of_string "19732481027856899896"));(* 19, 19 *) +(mk_real_int (num_of_string "27690365539057347720")),(mk_real_int (num_of_string "27986997261805128096"));(* 19, 19 *) +(mk_real_int (num_of_string "31402837346152004964")),(mk_real_int (num_of_string "16087997506814935504"));(* 19, 19 *) +(mk_real_int (num_of_string "12482908031899925334")),(mk_real_int (num_of_string "12074534421506609580"));(* 19, 19 *) +(mk_real_int (num_of_string "16865054989510033130")),(mk_real_int (num_of_string "25311479139287101200"));(* 19, 19 *) +(mk_real_int (num_of_string "26701144789330873466")),(mk_real_int (num_of_string "15162250273970036160"));(* 19, 19 *) +(mk_real_int (num_of_string "31614871463289433440")),(mk_real_int (num_of_string "19718429491535357275"));(* 19, 19 *) +(mk_real_int (num_of_string "29440626033317497394")),(mk_real_int (num_of_string "38864899869119902688"));(* 19, 19 *) +(mk_real_int (num_of_string "22314351305843742420")),(mk_real_int (num_of_string "28033308342251155515"));(* 19, 19 *) +(mk_real_int (num_of_string "22560438337513844581")),(mk_real_int (num_of_string "17835311046174804644"));(* 19, 19 *) +(mk_real_int (num_of_string "24449292854132620232")),(mk_real_int (num_of_string "21354423440548669900"));(* 19, 19 *) +(mk_real_int (num_of_string "33961168769518178694")),(mk_real_int (num_of_string "28539147237330071100"));(* 19, 19 *) +(mk_real_int (num_of_string "29110217637976409176")),(mk_real_int (num_of_string "21219378231222655198"));(* 19, 19 *) +(mk_real_int (num_of_string "22161141551634969510")),(mk_real_int (num_of_string "36490836787647976811"));(* 19, 19 *) +(mk_real_int (num_of_string "17314846198769732030")),(mk_real_int (num_of_string "38797942951815097776"));(* 19, 19 *) +(mk_real_int (num_of_string "24625748700107882800")),(mk_real_int (num_of_string "28401162576451413760"));(* 19, 19 *) +(mk_real_int (num_of_string "19069497830518416490")),(mk_real_int (num_of_string "28075529187933913015"));(* 19, 19 *) +(mk_real_int (num_of_string "19387086820405057468")),(mk_real_int (num_of_string "17945187196181865180"));(* 19, 19 *) +(mk_real_int (num_of_string "38731339272095791002")),(mk_real_int (num_of_string "38869445422362906780"));(* 19, 19 *) +(mk_real_int (num_of_string "21322779799938168904")),(mk_real_int (num_of_string "28955320941001624609"));(* 19, 19 *) +(mk_real_int (num_of_string "35997371074004079740")),(mk_real_int (num_of_string "14589487651792161460"));(* 19, 19 *) +(mk_real_int (num_of_string "35840710489786105024")),(mk_real_int (num_of_string "22271823002327442720"));(* 19, 19 *) +(mk_real_int (num_of_string "12093770197792685226")),(mk_real_int (num_of_string "36347297260764411240"));(* 19, 19 *) +(mk_real_int (num_of_string "13816202228225201772")),(mk_real_int (num_of_string "24125978880493300008"));(* 19, 19 *) +(mk_real_int (num_of_string "19296203926430636205")),(mk_real_int (num_of_string "22540604625533767256"));(* 19, 19 *) +(mk_real_int (num_of_string "37949082883945744170")),(mk_real_int (num_of_string "28090341039491342304"));(* 19, 19 *) +(mk_real_int (num_of_string "17140609291250961516")),(mk_real_int (num_of_string "27441105323877719639"));(* 19, 19 *) +(mk_real_int (num_of_string "31241110974541698846")),(mk_real_int (num_of_string "21121476357610481204"));(* 19, 19 *) +(mk_real_int (num_of_string "32399604181929621714")),(mk_real_int (num_of_string "13101169717074505297"));(* 19, 19 *) +(mk_real_int (num_of_string "35135381590831089304")),(mk_real_int (num_of_string "19834393913906561957"));(* 19, 19 *) +(mk_real_int (num_of_string "18369289023529407678")),(mk_real_int (num_of_string "30429545112624550860"));(* 19, 19 *) +(mk_real_int (num_of_string "16670874718441946772")),(mk_real_int (num_of_string "26800501647391853634"));(* 19, 19 *) +(mk_real_int (num_of_string "31693625340511240414")),(mk_real_int (num_of_string "15984710443303034400"));(* 19, 19 *) +(mk_real_int (num_of_string "23647195846585175656")),(mk_real_int (num_of_string "25218671587136807472"));(* 19, 19 *) +(mk_real_int (num_of_string "25678706922013782384")),(mk_real_int (num_of_string "22322294403582285816"));(* 19, 19 *) +(mk_real_int (num_of_string "18465224703401519076")),(mk_real_int (num_of_string "17627942862200919127"));(* 19, 19 *) +(mk_real_int (num_of_string "18907559590609795248")),(mk_real_int (num_of_string "20747360802181123198"));(* 19, 19 *) +(mk_real_int (num_of_string "27933037182226617408")),(mk_real_int (num_of_string "18543035784393141395"));(* 19, 19 *) +(mk_real_int (num_of_string "24019258243865272080")),(mk_real_int (num_of_string "33178761195927571323"));(* 19, 19 *) +(mk_real_int (num_of_string "15526718194575053422")),(mk_real_int (num_of_string "26953857246622990783"));(* 19, 19 *) +(mk_real_int (num_of_string "34447034474573944047")),(mk_real_int (num_of_string "32484264642048457392"));(* 19, 19 *) +(mk_real_int (num_of_string "14757200260959769910")),(mk_real_int (num_of_string "13050745606135584468"));(* 19, 19 *) +(mk_real_int (num_of_string "39286505752254599839")),(mk_real_int (num_of_string "29845651254317409797"));(* 19, 19 *) +(mk_real_int (num_of_string "39547531196479139460")),(mk_real_int (num_of_string "35009514400119365799"));(* 19, 19 *) +(mk_real_int (num_of_string "16953430526985040110")),(mk_real_int (num_of_string "18324985039305335369"));(* 19, 19 *) +(mk_real_int (num_of_string "16027361749560866298")),(mk_real_int (num_of_string "18416945279451047175"));(* 19, 19 *) +(mk_real_int (num_of_string "26148109550447514784")),(mk_real_int (num_of_string "19289372172792584016"));(* 19, 19 *) +(mk_real_int (num_of_string "30121263740432215296")),(mk_real_int (num_of_string "23845559370533947464"));(* 19, 19 *) +(mk_real_int (num_of_string "20755604343228731625")),(mk_real_int (num_of_string "18564483599982367707"));(* 19, 19 *) +(mk_real_int (num_of_string "20857226330656349887")),(mk_real_int (num_of_string "21785221658085316970"));(* 19, 19 *) +(mk_real_int (num_of_string "36394745648335822165")),(mk_real_int (num_of_string "28299888218909212587"));(* 19, 19 *) +(mk_real_int (num_of_string "24296453070147447552")),(mk_real_int (num_of_string "36145798268757190156"));(* 19, 19 *) +(mk_real_int (num_of_string "30808120739474498035")),(mk_real_int (num_of_string "36062740403311556880"));(* 19, 19 *) +(mk_real_int (num_of_string "20005790813286604612")),(mk_real_int (num_of_string "34374435669861218162"));(* 19, 19 *) +(mk_real_int (num_of_string "22903292103178501872")),(mk_real_int (num_of_string "22858582701377320359"));(* 19, 19 *) +(mk_real_int (num_of_string "14643627693160703600")),(mk_real_int (num_of_string "38413837964106063360"));(* 19, 19 *) +(mk_real_int (num_of_string "29319377725551576960")),(mk_real_int (num_of_string "36328152133226218496"));(* 19, 19 *) +(mk_real_int (num_of_string "20146761151355475648")),(mk_real_int (num_of_string "24024887138121953028"));(* 19, 19 *) +(mk_real_int (num_of_string "37522875010188929405")),(mk_real_int (num_of_string "22815604137021047352"));(* 19, 19 *) +(mk_real_int (num_of_string "14713629418630219550")),(mk_real_int (num_of_string "19406934189903902400"));(* 19, 19 *) +(mk_real_int (num_of_string "34497818175869545948")),(mk_real_int (num_of_string "17040707895650386112"));(* 19, 19 *) +(mk_real_int (num_of_string "26235226395971030130")),(mk_real_int (num_of_string "28895402157789258982"));(* 19, 19 *) +(mk_real_int (num_of_string "19461468255659542112")),(mk_real_int (num_of_string "23446073393084060268"));(* 19, 19 *) +(mk_real_int (num_of_string "23891196715991283591")),(mk_real_int (num_of_string "28130785491678816705"));(* 19, 19 *) +(mk_real_int (num_of_string "13236126403087653516")),(mk_real_int (num_of_string "16883664536085428312"));(* 19, 19 *) +(mk_real_int (num_of_string "21179869037384128566")),(mk_real_int (num_of_string "21666713728407223905"));(* 19, 19 *) +(mk_real_int (num_of_string "30727938578510315406")),(mk_real_int (num_of_string "28888551296934550650"));(* 19, 19 *) +(mk_real_int (num_of_string "17243366571928325763")),(mk_real_int (num_of_string "39610641731888216385"));(* 19, 19 *) +(mk_real_int (num_of_string "24968455904351066426")),(mk_real_int (num_of_string "28013375780368531014"));(* 19, 19 *) +(mk_real_int (num_of_string "18498472021224497984")),(mk_real_int (num_of_string "30928160069849654304"));(* 19, 19 *) +(mk_real_int (num_of_string "16146451863124230318")),(mk_real_int (num_of_string "17787234799872446656"));(* 19, 19 *) +(mk_real_int (num_of_string "19602965929204599040")),(mk_real_int (num_of_string "31084352144430113144"));(* 19, 19 *) +(mk_real_int (num_of_string "21166945185366868096")),(mk_real_int (num_of_string "25347005849926191805"));(* 19, 19 *) +(mk_real_int (num_of_string "25593028666691249236")),(mk_real_int (num_of_string "33168047080363214118"));(* 19, 19 *) +(mk_real_int (num_of_string "40120278827846512900")),(mk_real_int (num_of_string "19171281054163002919"));(* 19, 19 *) +(mk_real_int (num_of_string "27786996889090894774")),(mk_real_int (num_of_string "31987698754000069509"));(* 19, 19 *) +(mk_real_int (num_of_string "28833901254188249274")),(mk_real_int (num_of_string "24623248113726045663"));(* 19, 19 *) +(mk_real_int (num_of_string "26242963290992346668")),(mk_real_int (num_of_string "14674162647648763688"));(* 19, 19 *) +(mk_real_int (num_of_string "21837116817758393184")),(mk_real_int (num_of_string "33578587160158710450"));(* 19, 19 *) +(mk_real_int (num_of_string "32308720031395484028")),(mk_real_int (num_of_string "22262431374078419304"));(* 19, 19 *) +(mk_real_int (num_of_string "38772958076956140532")),(mk_real_int (num_of_string "18421681569409950656"));(* 19, 19 *) +(mk_real_int (num_of_string "21835573189556921619")),(mk_real_int (num_of_string "21195853794395582302"));(* 19, 19 *) +(mk_real_int (num_of_string "32936034992967092745")),(mk_real_int (num_of_string "17017105877426655000"));(* 19, 19 *) +(mk_real_int (num_of_string "11779314930266035515")),(mk_real_int (num_of_string "22210367086454507697"));(* 19, 19 *) +(mk_real_int (num_of_string "21262392262367283566")),(mk_real_int (num_of_string "18080247469344774021"));(* 19, 19 *) +(mk_real_int (num_of_string "18485080201259915496")),(mk_real_int (num_of_string "19330266469721050228"));(* 19, 19 *) +(mk_real_int (num_of_string "21314275633080189760")),(mk_real_int (num_of_string "26672783404801383366"));(* 19, 19 *) +(mk_real_int (num_of_string "18225376473803493478")),(mk_real_int (num_of_string "35114088523317972168"));(* 19, 19 *) +(mk_real_int (num_of_string "22256469025376193696")),(mk_real_int (num_of_string "14244710412207347160"));(* 19, 19 *) +(mk_real_int (num_of_string "15814028600098804460")),(mk_real_int (num_of_string "29455255415320130242"));(* 19, 19 *) +(mk_real_int (num_of_string "22207852932166681417")),(mk_real_int (num_of_string "26516227258443784004"));(* 19, 19 *) +(mk_real_int (num_of_string "14789447783886017682")),(mk_real_int (num_of_string "16084367232224943916"));(* 19, 19 *) +(mk_real_int (num_of_string "18833328680591237472")),(mk_real_int (num_of_string "21825090411736568528"));(* 19, 19 *) +(mk_real_int (num_of_string "15597572379087638544")),(mk_real_int (num_of_string "26077792023578054298"));(* 19, 19 *) +(mk_real_int (num_of_string "26878119204936958530")),(mk_real_int (num_of_string "33476608253746618444"));(* 19, 19 *) +(mk_real_int (num_of_string "21449072397693693841")),(mk_real_int (num_of_string "35292704961684409316"));(* 19, 19 *) +(mk_real_int (num_of_string "30199759622256795340")),(mk_real_int (num_of_string "24489522504759870954"));(* 19, 19 *) +(mk_real_int (num_of_string "21339496126239382542")),(mk_real_int (num_of_string "28216628392467036797"));(* 19, 19 *) +(mk_real_int (num_of_string "18283805257051816746")),(mk_real_int (num_of_string "24086808184522759500"));(* 19, 19 *) +(mk_real_int (num_of_string "29808506556312959475")),(mk_real_int (num_of_string "19850537876095504710"));(* 19, 19 *) +(mk_real_int (num_of_string "15647902267586078160")),(mk_real_int (num_of_string "24081196614941322120"));(* 19, 19 *) +(mk_real_int (num_of_string "29479869033054686829")),(mk_real_int (num_of_string "15456675031417026000"));(* 19, 19 *) +(mk_real_int (num_of_string "20640313180694555700")),(mk_real_int (num_of_string "24429910974973387752"));(* 19, 19 *) +(mk_real_int (num_of_string "19017622319184472610")),(mk_real_int (num_of_string "30215491581640326115"));(* 19, 19 *) +(mk_real_int (num_of_string "26044108791274477200")),(mk_real_int (num_of_string "32133176543618161968"));(* 19, 19 *) +(mk_real_int (num_of_string "34522332525723352640")),(mk_real_int (num_of_string "23921287334186517968"));(* 19, 19 *) +(mk_real_int (num_of_string "29505364164285463575")),(mk_real_int (num_of_string "37317681774104336748"));(* 19, 19 *) +(mk_real_int (num_of_string "14710512227849318100")),(mk_real_int (num_of_string "23802448655388557264"));(* 19, 19 *) +(mk_real_int (num_of_string "30196352118354653616")),(mk_real_int (num_of_string "27106624139908863077"));(* 19, 19 *) +(mk_real_int (num_of_string "36784290814305071400")),(mk_real_int (num_of_string "31187606612894238969"));(* 19, 19 *) +(mk_real_int (num_of_string "33262687821254277474")),(mk_real_int (num_of_string "23365975397006060500"));(* 19, 19 *) +(mk_real_int (num_of_string "21779146247504967035")),(mk_real_int (num_of_string "18357828649500301566"));(* 19, 19 *) +(mk_real_int (num_of_string "14596900574194861560")),(mk_real_int (num_of_string "33232277302903407795"));(* 19, 19 *) +(mk_real_int (num_of_string "17955737100058116722")),(mk_real_int (num_of_string "21650341275797518515"));(* 19, 19 *) +(mk_real_int (num_of_string "20323424466540095120")),(mk_real_int (num_of_string "34041169657965394958"));(* 19, 19 *) +(mk_real_int (num_of_string "25685066141358506883")),(mk_real_int (num_of_string "27586149979933496292"));(* 19, 19 *) +(mk_real_int (num_of_string "29521436359943206800")),(mk_real_int (num_of_string "23999532044905642192"));(* 19, 19 *) +(mk_real_int (num_of_string "22395619896118559992")),(mk_real_int (num_of_string "40128807183259944380"));(* 19, 19 *) +(mk_real_int (num_of_string "21380197764028746852")),(mk_real_int (num_of_string "29531541010963108887"));(* 19, 19 *) +(mk_real_int (num_of_string "25195124945782994400")),(mk_real_int (num_of_string "15931637546605504317"));(* 19, 19 *) +(mk_real_int (num_of_string "19273086397990407136")),(mk_real_int (num_of_string "23628956380354304595"));(* 19, 19 *) +(mk_real_int (num_of_string "17641688134558872428")),(mk_real_int (num_of_string "21143921627181894750"));(* 19, 19 *) +(mk_real_int (num_of_string "31373974749750652096")),(mk_real_int (num_of_string "21840199146188831551"));(* 19, 19 *) +(mk_real_int (num_of_string "24804374934459121540")),(mk_real_int (num_of_string "11400862432903300148"));(* 19, 19 *) +(mk_real_int (num_of_string "15714037058937398720")),(mk_real_int (num_of_string "24507889619577658008"));(* 19, 19 *) +(mk_real_int (num_of_string "25000780992104284774")),(mk_real_int (num_of_string "17333849398852842108"));(* 19, 19 *) +(mk_real_int (num_of_string "22253922015024750336")),(mk_real_int (num_of_string "19687298941090487014"));(* 19, 19 *) +(mk_real_int (num_of_string "25808962862689204704")),(mk_real_int (num_of_string "29248275235162252500"));(* 19, 19 *) +(mk_real_int (num_of_string "23655817116327309408")),(mk_real_int (num_of_string "37594936717336802870"));(* 19, 19 *) +(mk_real_int (num_of_string "24272488042654248540")),(mk_real_int (num_of_string "20452705544156415816"));(* 19, 19 *) +(mk_real_int (num_of_string "25283537823142476944")),(mk_real_int (num_of_string "13404457723972847840"));(* 19, 19 *) +(mk_real_int (num_of_string "19881318870777807630")),(mk_real_int (num_of_string "32971053158189425675"));(* 19, 19 *) +(mk_real_int (num_of_string "16975830808340138900")),(mk_real_int (num_of_string "16925656200290432265"));(* 19, 19 *) +(mk_real_int (num_of_string "21161092370452799292")),(mk_real_int (num_of_string "34934643910763005332"));(* 19, 19 *) +(mk_real_int (num_of_string "18841409901378752688")),(mk_real_int (num_of_string "18558385525761954224"));(* 19, 19 *) +(mk_real_int (num_of_string "37632767767193286688")),(mk_real_int (num_of_string "35331980382329536422"));(* 19, 19 *) +(mk_real_int (num_of_string "33121220549861720672")),(mk_real_int (num_of_string "20946802877876600120"));(* 19, 19 *) +(mk_real_int (num_of_string "13044865963920872147")),(mk_real_int (num_of_string "35428033112795346276"));(* 19, 19 *) +(mk_real_int (num_of_string "18889016228299739808")),(mk_real_int (num_of_string "24898998758022348729"));(* 19, 19 *) +(mk_real_int (num_of_string "16344640111860894735")),(mk_real_int (num_of_string "27879078405385841425"));(* 19, 19 *) +(mk_real_int (num_of_string "24231112031053786980")),(mk_real_int (num_of_string "30472672804489195764"));(* 19, 19 *) +(mk_real_int (num_of_string "26150856558496395264")),(mk_real_int (num_of_string "15338673653532911484"));(* 19, 19 *) +(mk_real_int (num_of_string "25051521140390473443")),(mk_real_int (num_of_string "18606893513954745219"));(* 19, 19 *) +(mk_real_int (num_of_string "20581729693959774362")),(mk_real_int (num_of_string "33819525307256244402"));(* 19, 19 *) +(mk_real_int (num_of_string "23042274063944186370")),(mk_real_int (num_of_string "21780182013103100169"));(* 19, 19 *) +(mk_real_int (num_of_string "30883007964058191084")),(mk_real_int (num_of_string "31289003924588312760"));(* 19, 19 *) +(mk_real_int (num_of_string "13891883593180453608")),(mk_real_int (num_of_string "17349750538845126402"));(* 19, 19 *) +(mk_real_int (num_of_string "20385676494129768228")),(mk_real_int (num_of_string "20625889638236156032"));(* 19, 19 *) +(mk_real_int (num_of_string "21947337678461729424")),(mk_real_int (num_of_string "18555426993793533690"));(* 19, 19 *) +(mk_real_int (num_of_string "21719375807209157055")),(mk_real_int (num_of_string "19183305589395548172"));(* 19, 19 *) +(mk_real_int (num_of_string "31396646920272046776")),(mk_real_int (num_of_string "35640418074086180971"));(* 19, 19 *) +(mk_real_int (num_of_string "25763672516441210758")),(mk_real_int (num_of_string "20680085336517726735"));(* 19, 19 *) +(mk_real_int (num_of_string "14029958728229911038")),(mk_real_int (num_of_string "30051566983801046596"));(* 19, 19 *) +(mk_real_int (num_of_string "35496281454137761763")),(mk_real_int (num_of_string "21107324411363064380"));(* 19, 19 *) +(mk_real_int (num_of_string "20535679195437347392")),(mk_real_int (num_of_string "21701303937929182985"));(* 19, 19 *) +(mk_real_int (num_of_string "22893236960604226502")),(mk_real_int (num_of_string "17332455990826841480"));(* 19, 19 *) +(mk_real_int (num_of_string "21868039566218851720")),(mk_real_int (num_of_string "24073034895901006092"));(* 19, 19 *) +(mk_real_int (num_of_string "19483225121903585383")),(mk_real_int (num_of_string "15748691116098277656"));(* 19, 19 *) +(mk_real_int (num_of_string "23656772980901958084")),(mk_real_int (num_of_string "16697614051956951828"));(* 19, 19 *) +(mk_real_int (num_of_string "12699454851053170420")),(mk_real_int (num_of_string "25461510562697376750"));(* 19, 19 *) +(mk_real_int (num_of_string "35662732873196498289")),(mk_real_int (num_of_string "28611306826766293080"));(* 19, 19 *) +(mk_real_int (num_of_string "22416539791459745470")),(mk_real_int (num_of_string "13995037989450860188"));(* 19, 19 *) +(mk_real_int (num_of_string "35878978645130975244")),(mk_real_int (num_of_string "29092793441652213240"));(* 19, 19 *) +(mk_real_int (num_of_string "29455260321262238100")),(mk_real_int (num_of_string "16399031271517392300"));(* 19, 19 *) +(mk_real_int (num_of_string "22557952450292566879")),(mk_real_int (num_of_string "23864941981560058786"));(* 19, 19 *) +(mk_real_int (num_of_string "26368360885501374432")),(mk_real_int (num_of_string "39147149669121170259"));(* 19, 19 *) +(mk_real_int (num_of_string "36393515656323289035")),(mk_real_int (num_of_string "36672604880094858664"));(* 19, 19 *) +(mk_real_int (num_of_string "30780162470002874346")),(mk_real_int (num_of_string "27752257689340888704"));(* 19, 19 *) +(mk_real_int (num_of_string "25689258876340596834")),(mk_real_int (num_of_string "21441108621776803443"));(* 19, 19 *) +(mk_real_int (num_of_string "23737226118466944545")),(mk_real_int (num_of_string "30994701259082878317"));(* 19, 19 *) +(mk_real_int (num_of_string "25282242824740556688")),(mk_real_int (num_of_string "37148939628436148062"));(* 19, 19 *) +(mk_real_int (num_of_string "21013194624316808529")),(mk_real_int (num_of_string "20255913077961248688"));(* 19, 19 *) +(mk_real_int (num_of_string "31054139089427845787")),(mk_real_int (num_of_string "19607683804071960960"));(* 19, 19 *) +(mk_real_int (num_of_string "15303024613317648944")),(mk_real_int (num_of_string "39408872501785937942"));(* 19, 19 *) +(mk_real_int (num_of_string "20898994338157062336")),(mk_real_int (num_of_string "38025069964956110300"));(* 19, 19 *) +(mk_real_int (num_of_string "18968333228354927186")),(mk_real_int (num_of_string "21018674954106317466"));(* 19, 19 *) +(mk_real_int (num_of_string "39790487940152314750")),(mk_real_int (num_of_string "22008196746171716509"));(* 19, 19 *) +(mk_real_int (num_of_string "33017162701071351726")),(mk_real_int (num_of_string "30623384819158111552"));(* 19, 19 *) +(mk_real_int (num_of_string "19091830859217444592")),(mk_real_int (num_of_string "26220236181304455400"));(* 19, 19 *) +(mk_real_int (num_of_string "29157386168392844560")),(mk_real_int (num_of_string "11271378385086514992"));(* 19, 19 *) +(mk_real_int (num_of_string "19447811743626438887")),(mk_real_int (num_of_string "25148407602027456648"));(* 19, 19 *) +(mk_real_int (num_of_string "30131465927424366604")),(mk_real_int (num_of_string "29360540495144766292"));(* 19, 19 *) +(mk_real_int (num_of_string "34002073485636530164")),(mk_real_int (num_of_string "26834180965871892888"));(* 19, 19 *) +(mk_real_int (num_of_string "35672024606187267584")),(mk_real_int (num_of_string "26468202097817481771"));(* 19, 19 *) +(mk_real_int (num_of_string "24961548100229544705")),(mk_real_int (num_of_string "25999859467693733600"));(* 19, 19 *) +(mk_real_int (num_of_string "22295613667897276278")),(mk_real_int (num_of_string "18047102405916751200"));(* 19, 19 *) +(mk_real_int (num_of_string "39033376394649241264")),(mk_real_int (num_of_string "30880326766048636008"));(* 19, 19 *) +(mk_real_int (num_of_string "22813007803174618502")),(mk_real_int (num_of_string "22063227488563837180"));(* 19, 19 *) +(mk_real_int (num_of_string "18709905187338992352")),(mk_real_int (num_of_string "21719877799596511920"));(* 19, 19 *) +(mk_real_int (num_of_string "24098182147414487970")),(mk_real_int (num_of_string "23651738249051735592"));(* 19, 19 *) +(mk_real_int (num_of_string "18849676051484033052")),(mk_real_int (num_of_string "17314533458455923580"));(* 19, 19 *) +(mk_real_int (num_of_string "32029828035309675615")),(mk_real_int (num_of_string "37157871809647249782"));(* 19, 19 *) +(mk_real_int (num_of_string "13351949757625652712")),(mk_real_int (num_of_string "33859823103015458340"));(* 19, 19 *) +(mk_real_int (num_of_string "15999759484967973792")),(mk_real_int (num_of_string "28592403385028861884"));(* 19, 19 *) +(mk_real_int (num_of_string "26219308464093530412")),(mk_real_int (num_of_string "19979634390551284020"));(* 19, 19 *) +(mk_real_int (num_of_string "20847752193707676655")),(mk_real_int (num_of_string "25076325914072886035"));(* 19, 19 *) +(mk_real_int (num_of_string "17875505079745949350")),(mk_real_int (num_of_string "26109848057034145536"));(* 19, 19 *) +(mk_real_int (num_of_string "17572875153060997770")),(mk_real_int (num_of_string "29113855434106231217"));(* 19, 19 *) +(mk_real_int (num_of_string "22832872037954766425")),(mk_real_int (num_of_string "25897357592381159016"));(* 19, 19 *) +(mk_real_int (num_of_string "20617963579715412438")),(mk_real_int (num_of_string "17941483848787653352"));(* 19, 19 *) +(mk_real_int (num_of_string "16586772811067563368")),(mk_real_int (num_of_string "22577575012573999880"));(* 19, 19 *) +(mk_real_int (num_of_string "34264192210874287629")),(mk_real_int (num_of_string "31735607411072497867"));(* 19, 19 *) +(mk_real_int (num_of_string "23115416111143986663")),(mk_real_int (num_of_string "16967646085217465088"));(* 19, 19 *) +(mk_real_int (num_of_string "22962185970251136180")),(mk_real_int (num_of_string "12808457799981573070"));(* 19, 19 *) +(mk_real_int (num_of_string "27165110514303590796")),(mk_real_int (num_of_string "28554387401526071184"));(* 19, 19 *) +(mk_real_int (num_of_string "25585191232850450421")),(mk_real_int (num_of_string "27087811082981623546"));(* 19, 19 *) +(mk_real_int (num_of_string "26664612388681030170")),(mk_real_int (num_of_string "28339469831309891870"));(* 19, 19 *) +(mk_real_int (num_of_string "25771062593658789044")),(mk_real_int (num_of_string "18222926787001930752"));(* 19, 19 *) +(mk_real_int (num_of_string "27586091301364074292")),(mk_real_int (num_of_string "21812202620855555205"));(* 19, 19 *) +(mk_real_int (num_of_string "23445910158224676408")),(mk_real_int (num_of_string "24476303740024606250"));(* 19, 19 *) +(mk_real_int (num_of_string "38588034485550390192")),(mk_real_int (num_of_string "29500904736758084784"));(* 19, 19 *) +(mk_real_int (num_of_string "19652744433819514743")),(mk_real_int (num_of_string "25156141770392809319"));(* 19, 19 *) +(mk_real_int (num_of_string "29965525190581326566")),(mk_real_int (num_of_string "36314785139233560531"));(* 19, 19 *) +(mk_real_int (num_of_string "21466258262340035760")),(mk_real_int (num_of_string "29263041789177721140"));(* 19, 19 *) +(mk_real_int (num_of_string "24397602931801015532")),(mk_real_int (num_of_string "25484236670011121640"));(* 19, 19 *) +(mk_real_int (num_of_string "30310047782521318625")),(mk_real_int (num_of_string "23609134994805415132"));(* 19, 19 *) +(mk_real_int (num_of_string "27659667981760402500")),(mk_real_int (num_of_string "24628272363884320857"));(* 19, 19 *) +(mk_real_int (num_of_string "19978469335455279330")),(mk_real_int (num_of_string "24116883763569872715"));(* 19, 19 *) +(mk_real_int (num_of_string "26892789155560700680")),(mk_real_int (num_of_string "36826219781739975433"));(* 19, 19 *) +(mk_real_int (num_of_string "29394132354177563764")),(mk_real_int (num_of_string "23221912176679400800"));(* 19, 19 *) +(mk_real_int (num_of_string "26830089923470820415")),(mk_real_int (num_of_string "28365564961988932458"));(* 19, 19 *) +(mk_real_int (num_of_string "31382923082882636408")),(mk_real_int (num_of_string "20146078635041420985"));(* 19, 19 *) +(mk_real_int (num_of_string "19816396770725025900")),(mk_real_int (num_of_string "24522489899722746998"));(* 19, 19 *) +(mk_real_int (num_of_string "38749541586950688120")),(mk_real_int (num_of_string "39098718085652716854"));(* 19, 19 *) +(mk_real_int (num_of_string "24953776264020954592")),(mk_real_int (num_of_string "34754678475782026300"));(* 19, 19 *) +(mk_real_int (num_of_string "24980861439510874920")),(mk_real_int (num_of_string "21198569882617308060"));(* 19, 19 *) +(mk_real_int (num_of_string "25658580097839459056")),(mk_real_int (num_of_string "25212675872485860660"));(* 19, 19 *) +(mk_real_int (num_of_string "19385852360280688326")),(mk_real_int (num_of_string "29509350922069688131"));(* 19, 19 *) +(mk_real_int (num_of_string "23671836189729585000")),(mk_real_int (num_of_string "27831702775237992180"));(* 19, 19 *) +(mk_real_int (num_of_string "26544931026881917848")),(mk_real_int (num_of_string "20990756168224711517"));(* 19, 19 *) +(mk_real_int (num_of_string "30047478145078388302")),(mk_real_int (num_of_string "27770176135212062695"));(* 19, 19 *) +(mk_real_int (num_of_string "27316732758493825845")),(mk_real_int (num_of_string "19538268693513719952"));(* 19, 19 *) +(mk_real_int (num_of_string "21561909110929122507")),(mk_real_int (num_of_string "41262572341482248504"));(* 19, 19 *) +(mk_real_int (num_of_string "26501376724912212651")),(mk_real_int (num_of_string "32352759210287208726"));(* 19, 19 *) +(mk_real_int (num_of_string "26184337037668596160")),(mk_real_int (num_of_string "34565717092174178768"));(* 19, 19 *) +(mk_real_int (num_of_string "32173352765971071116")),(mk_real_int (num_of_string "17265475475387274520"));(* 19, 19 *) +(mk_real_int (num_of_string "25152477836196229431")),(mk_real_int (num_of_string "21416597443651344726"));(* 19, 19 *) +(mk_real_int (num_of_string "18541278738854842047")),(mk_real_int (num_of_string "19892101781340409995"));(* 19, 19 *) +(mk_real_int (num_of_string "19416448921216784822")),(mk_real_int (num_of_string "33392288363839030483"));(* 19, 19 *) +(mk_real_int (num_of_string "16689221150454470772")),(mk_real_int (num_of_string "16884844507537379868"));(* 19, 19 *) +(mk_real_int (num_of_string "36074432973524338800")),(mk_real_int (num_of_string "22884161377122256860"));(* 19, 19 *) +(mk_real_int (num_of_string "17982463638819408520")),(mk_real_int (num_of_string "30714353454772618697"));(* 19, 19 *) +(mk_real_int (num_of_string "27963961335826272867")),(mk_real_int (num_of_string "21751183914121743763"));(* 19, 19 *) +(mk_real_int (num_of_string "31983056409192838334")),(mk_real_int (num_of_string "16849795793906519444"));(* 19, 19 *) +(mk_real_int (num_of_string "23828508717964552888")),(mk_real_int (num_of_string "21905102686851911670"));(* 19, 19 *) +(mk_real_int (num_of_string "19524189968843721876")),(mk_real_int (num_of_string "22296291538003493120"));(* 19, 19 *) +(mk_real_int (num_of_string "30003230312244243912")),(mk_real_int (num_of_string "31524168070512828480"));(* 19, 19 *) +(mk_real_int (num_of_string "25378970707150727260")),(mk_real_int (num_of_string "27694584206296789474"));(* 19, 19 *) +(mk_real_int (num_of_string "15001396544174109960")),(mk_real_int (num_of_string "22597302615363537556"));(* 19, 19 *) +(mk_real_int (num_of_string "28650239001671556258")),(mk_real_int (num_of_string "29791235497066187848"));(* 19, 19 *) +(mk_real_int (num_of_string "22574500911615728460")),(mk_real_int (num_of_string "31733840856116244780"));(* 19, 19 *) +(mk_real_int (num_of_string "19401400630377382584")),(mk_real_int (num_of_string "24129285810268778700"));(* 19, 19 *) +(mk_real_int (num_of_string "34196034285619615695")),(mk_real_int (num_of_string "18047615096119075896"));(* 19, 19 *) +(mk_real_int (num_of_string "21982009838094264464")),(mk_real_int (num_of_string "22424652782690362512"));(* 19, 19 *) +(mk_real_int (num_of_string "27791903869775971464")),(mk_real_int (num_of_string "25973068407781352880"));(* 19, 19 *) +(mk_real_int (num_of_string "14304069474463657152")),(mk_real_int (num_of_string "14341256874380659014"));(* 19, 19 *) +(mk_real_int (num_of_string "27667441193806736949")),(mk_real_int (num_of_string "31540493569147746843"));(* 19, 19 *) +(mk_real_int (num_of_string "21090871618263748576")),(mk_real_int (num_of_string "16848512912294645010"));(* 19, 19 *) +(mk_real_int (num_of_string "23478791800103107072")),(mk_real_int (num_of_string "22847439476393054952"));(* 19, 19 *) +(mk_real_int (num_of_string "34335901118600926548")),(mk_real_int (num_of_string "26932079655173527560"));(* 19, 19 *) +(mk_real_int (num_of_string "17040284624562954293")),(mk_real_int (num_of_string "22658477257343206466"));(* 19, 19 *) +(mk_real_int (num_of_string "15956634778338900844")),(mk_real_int (num_of_string "26689382937164893638"));(* 19, 19 *) +(mk_real_int (num_of_string "14011671230034854200")),(mk_real_int (num_of_string "24543107305284487458"));(* 19, 19 *) +(mk_real_int (num_of_string "20353518960608955187")),(mk_real_int (num_of_string "19472405224360089386"));(* 19, 19 *) +(mk_real_int (num_of_string "22665117812763391680")),(mk_real_int (num_of_string "29827041475339497543"));(* 19, 19 *) +(mk_real_int (num_of_string "21860523829262727026")),(mk_real_int (num_of_string "31579961924409641127"));(* 19, 19 *) +(mk_real_int (num_of_string "22347825113359737090")),(mk_real_int (num_of_string "23515764525675482753"));(* 19, 19 *) +(mk_real_int (num_of_string "31025699041969103186")),(mk_real_int (num_of_string "15742238779906783914"));(* 19, 19 *) +(mk_real_int (num_of_string "21238761019553983312")),(mk_real_int (num_of_string "28895960507926675504"));(* 19, 19 *) +(mk_real_int (num_of_string "26453246915869727492")),(mk_real_int (num_of_string "22304668791543107046"));(* 19, 19 *) +(mk_real_int (num_of_string "21095515470598270790")),(mk_real_int (num_of_string "19162429559220454969"));(* 19, 19 *) +(mk_real_int (num_of_string "28742273211849664478")),(mk_real_int (num_of_string "17189194323445028742"));(* 19, 19 *) +(mk_real_int (num_of_string "33944953713377163886")),(mk_real_int (num_of_string "21833964167745880876"));(* 19, 19 *) +(mk_real_int (num_of_string "19620133336135880064")),(mk_real_int (num_of_string "23870181030677562944"));(* 19, 19 *) +(mk_real_int (num_of_string "18159998781406997988")),(mk_real_int (num_of_string "24833946036411722408"));(* 19, 19 *) +(mk_real_int (num_of_string "18263686907120302648")),(mk_real_int (num_of_string "18036860900769570453"));(* 19, 19 *) +(mk_real_int (num_of_string "19933458841347060460")),(mk_real_int (num_of_string "26575623380299331338"));(* 19, 19 *) +(mk_real_int (num_of_string "25200099264514284770")),(mk_real_int (num_of_string "23862600305112480769"));(* 19, 19 *) +(mk_real_int (num_of_string "19668776568490331887")),(mk_real_int (num_of_string "15481177495656699200"));(* 19, 19 *) +(mk_real_int (num_of_string "27600383229493630325")),(mk_real_int (num_of_string "35404523088447292824"));(* 19, 19 *) +(mk_real_int (num_of_string "22796120663121608187")),(mk_real_int (num_of_string "30377444381526688501"));(* 19, 19 *) +(mk_real_int (num_of_string "25781006763175331316")),(mk_real_int (num_of_string "23577069805680829977"));(* 19, 19 *) +(mk_real_int (num_of_string "20985501502835422344")),(mk_real_int (num_of_string "16695021197303776096"));(* 19, 19 *) +(mk_real_int (num_of_string "33072455242031449530")),(mk_real_int (num_of_string "12913517912579789780"));(* 19, 19 *) +(mk_real_int (num_of_string "36224161914498238153")),(mk_real_int (num_of_string "14772829702133894787"));(* 19, 19 *) +(mk_real_int (num_of_string "13813400700338909901")),(mk_real_int (num_of_string "34453671596238453240"));(* 19, 19 *) +(mk_real_int (num_of_string "33343972111168420856")),(mk_real_int (num_of_string "30091839935821648050"));(* 19, 19 *) +(mk_real_int (num_of_string "33993906187652787552")),(mk_real_int (num_of_string "30820853625105027000"));(* 19, 19 *) +(mk_real_int (num_of_string "15398262358260039060")),(mk_real_int (num_of_string "26309820863576217121"));(* 19, 19 *) +(mk_real_int (num_of_string "26198210986492520184")),(mk_real_int (num_of_string "35291341456130224080"));(* 19, 19 *) +(mk_real_int (num_of_string "20282304095836622532")),(mk_real_int (num_of_string "34885133775451950892"));(* 19, 19 *) +(mk_real_int (num_of_string "14004673892884099953")),(mk_real_int (num_of_string "29057703638847203056"));(* 19, 19 *) +(mk_real_int (num_of_string "22907801178625159390")),(mk_real_int (num_of_string "14868861612268124956"));(* 19, 19 *) +(mk_real_int (num_of_string "35538939861605280100")),(mk_real_int (num_of_string "34252561611460523375"));(* 19, 19 *) +(mk_real_int (num_of_string "26841326791092839146")),(mk_real_int (num_of_string "25472680586614535340"));(* 19, 19 *) +(mk_real_int (num_of_string "16363271346712834830")),(mk_real_int (num_of_string "24973121537740975951"));(* 19, 19 *) +(mk_real_int (num_of_string "35026051287526630650")),(mk_real_int (num_of_string "21061660193237446585"));(* 19, 19 *) +(mk_real_int (num_of_string "19349716319279206476")),(mk_real_int (num_of_string "13458090771119812752"));(* 19, 19 *) +(mk_real_int (num_of_string "16947350985084926692")),(mk_real_int (num_of_string "13117012462162467870"));(* 19, 19 *) +(mk_real_int (num_of_string "23317740640386032764")),(mk_real_int (num_of_string "18008229442063096071"));(* 19, 19 *) +(mk_real_int (num_of_string "21468421073837433168")),(mk_real_int (num_of_string "23345546932891421568"));(* 19, 19 *) +(mk_real_int (num_of_string "22583095457927525455")),(mk_real_int (num_of_string "25209712123444250358"));(* 19, 19 *) +(mk_real_int (num_of_string "23254470779552887292")),(mk_real_int (num_of_string "23916875771977117479"));(* 19, 19 *) +(mk_real_int (num_of_string "35817883931216821500")),(mk_real_int (num_of_string "24250161146652353770"));(* 19, 19 *) +(mk_real_int (num_of_string "31213699324173896508")),(mk_real_int (num_of_string "27441032356296400050"));(* 19, 19 *) +(mk_real_int (num_of_string "17745025504298030246")),(mk_real_int (num_of_string "12561974162522840484"));(* 19, 19 *) +(mk_real_int (num_of_string "28451704245600251000")),(mk_real_int (num_of_string "31753646719707495418"));(* 19, 19 *) +(mk_real_int (num_of_string "27079462488720831860")),(mk_real_int (num_of_string "33103930501167051999"));(* 19, 19 *) +(mk_real_int (num_of_string "40763611124460240940")),(mk_real_int (num_of_string "19771122417175555635"));(* 19, 19 *) +(mk_real_int (num_of_string "18708193082788002486")),(mk_real_int (num_of_string "24283826884383442684"));(* 19, 19 *) +(mk_real_int (num_of_string "31730479417294456480")),(mk_real_int (num_of_string "41330439387262982528"));(* 19, 19 *) +(mk_real_int (num_of_string "25534576776676283272")),(mk_real_int (num_of_string "24965013034087710430"));(* 19, 19 *) +(mk_real_int (num_of_string "21557433898333368640")),(mk_real_int (num_of_string "19795009624311561750"));(* 19, 19 *) +(mk_real_int (num_of_string "35499214825031756700")),(mk_real_int (num_of_string "19972281333562377512"));(* 19, 19 *) +(mk_real_int (num_of_string "27404570400407320032")),(mk_real_int (num_of_string "19435177175271893805"));(* 19, 19 *) +(mk_real_int (num_of_string "19156846007767209027")),(mk_real_int (num_of_string "21923918239967151815"));(* 19, 19 *) +(mk_real_int (num_of_string "34350656859968979486")),(mk_real_int (num_of_string "17279712264357716800"));(* 19, 19 *) +(mk_real_int (num_of_string "26112985511247953230")),(mk_real_int (num_of_string "22567007898443664832"));(* 19, 19 *) +(mk_real_int (num_of_string "18692729353472770200")),(mk_real_int (num_of_string "16710457357447345800"));(* 19, 19 *) +(mk_real_int (num_of_string "19610630158063286760")),(mk_real_int (num_of_string "27145524445597080402"));(* 19, 19 *) +(mk_real_int (num_of_string "24125241853056887752")),(mk_real_int (num_of_string "23376959364467089249"));(* 19, 19 *) +(mk_real_int (num_of_string "12815874200850731296")),(mk_real_int (num_of_string "38603926498953215763"));(* 19, 19 *) +(mk_real_int (num_of_string "25394056643949092616")),(mk_real_int (num_of_string "27952693788759455694"));(* 19, 19 *) +(mk_real_int (num_of_string "22109091123482872872")),(mk_real_int (num_of_string "23442113221904340964"));(* 19, 19 *) +(mk_real_int (num_of_string "26784603512782114230")),(mk_real_int (num_of_string "24533406266317859592"));(* 19, 19 *) +(mk_real_int (num_of_string "20663208626305111680")),(mk_real_int (num_of_string "18202478751545590656"));(* 19, 19 *) +(mk_real_int (num_of_string "20246697089444257091")),(mk_real_int (num_of_string "23327500277984659680"));(* 19, 19 *) +(mk_real_int (num_of_string "18393501891872553402")),(mk_real_int (num_of_string "24581544571835771520"));(* 19, 19 *) +(mk_real_int (num_of_string "24705736347753684091")),(mk_real_int (num_of_string "20462461784791727470"));(* 19, 19 *) +(mk_real_int (num_of_string "30991127112516016611")),(mk_real_int (num_of_string "29752372313983413754"));(* 19, 19 *) +(mk_real_int (num_of_string "18109415153526238080")),(mk_real_int (num_of_string "24476035812284447028"));(* 19, 19 *) +(mk_real_int (num_of_string "19249085474578925262")),(mk_real_int (num_of_string "22063561655134422104"));(* 19, 19 *) +(mk_real_int (num_of_string "18725681245967196490")),(mk_real_int (num_of_string "35897033449780160350"));(* 19, 19 *) +(mk_real_int (num_of_string "23552106614514505500")),(mk_real_int (num_of_string "24038981472989649034"));(* 19, 19 *) +(mk_real_int (num_of_string "18542971626674708862")),(mk_real_int (num_of_string "18985958452095117450"));(* 19, 19 *) +(mk_real_int (num_of_string "18969731775635593920")),(mk_real_int (num_of_string "21303396667310437515"));(* 19, 19 *) +(mk_real_int (num_of_string "27950853924636269902")),(mk_real_int (num_of_string "27740744599373815548"));(* 19, 19 *) +(mk_real_int (num_of_string "32371868675867677011")),(mk_real_int (num_of_string "24750658371458880124"));(* 19, 19 *) +(mk_real_int (num_of_string "19559092727748063897")),(mk_real_int (num_of_string "30297393325237576956"));(* 19, 19 *) +(mk_real_int (num_of_string "40525825037409130408")),(mk_real_int (num_of_string "15723254263122848871"));(* 19, 19 *) +(mk_real_int (num_of_string "17372071073042919662")),(mk_real_int (num_of_string "16252631542319883480"));(* 19, 19 *) +(mk_real_int (num_of_string "17204409311432310132")),(mk_real_int (num_of_string "14220816779884022154"));(* 19, 19 *) +(mk_real_int (num_of_string "32595387439053013806")),(mk_real_int (num_of_string "27001122572747090856"));(* 19, 19 *) +(mk_real_int (num_of_string "18029968363269057382")),(mk_real_int (num_of_string "25352806340877438753"));(* 19, 19 *) +(mk_real_int (num_of_string "17826631682711419260")),(mk_real_int (num_of_string "19063618754807575476"));(* 19, 19 *) +(mk_real_int (num_of_string "24349160455233169875")),(mk_real_int (num_of_string "27089364767111193261"));(* 19, 19 *) +(mk_real_int (num_of_string "18438142935199058082")),(mk_real_int (num_of_string "18921160730005941220"));(* 19, 19 *) +(mk_real_int (num_of_string "24125576091154548494")),(mk_real_int (num_of_string "18239369601915679855"));(* 19, 19 *) +(mk_real_int (num_of_string "16140557084423002770")),(mk_real_int (num_of_string "22204497050438990100"));(* 19, 19 *) +(mk_real_int (num_of_string "29636046329509796847")),(mk_real_int (num_of_string "16308049534152817936"));(* 19, 19 *) +(mk_real_int (num_of_string "28939435029772785034")),(mk_real_int (num_of_string "20287995266292043653"));(* 19, 19 *) +(mk_real_int (num_of_string "22942044862974291593")),(mk_real_int (num_of_string "14391726373990748970"));(* 19, 19 *) +(mk_real_int (num_of_string "27729528689185688409")),(mk_real_int (num_of_string "29589692474685879613"));(* 19, 19 *) +(mk_real_int (num_of_string "19803067057916920316")),(mk_real_int (num_of_string "21757789760907289320"));(* 19, 19 *) +(mk_real_int (num_of_string "29973731599962358296")),(mk_real_int (num_of_string "22544276048750317972"));(* 19, 19 *) +(mk_real_int (num_of_string "29442429349135566984")),(mk_real_int (num_of_string "29118657870363305464"));(* 19, 19 *) +(mk_real_int (num_of_string "19094520257069123152")),(mk_real_int (num_of_string "23764276951741156402"));(* 19, 19 *) +(mk_real_int (num_of_string "14622269779899103245")),(mk_real_int (num_of_string "22302554145334720884"));(* 19, 19 *) +(mk_real_int (num_of_string "25186566031316655405")),(mk_real_int (num_of_string "20283868484641519692"));(* 19, 19 *) +(mk_real_int (num_of_string "15927858921062204974")),(mk_real_int (num_of_string "41095293506851279696"));(* 19, 19 *) +(mk_real_int (num_of_string "30425953718752171734")),(mk_real_int (num_of_string "15069390144141249972"));(* 19, 19 *) +(mk_real_int (num_of_string "31933138638792957643")),(mk_real_int (num_of_string "31094188475962731405"));(* 19, 19 *) +(mk_real_int (num_of_string "30885956505287588375")),(mk_real_int (num_of_string "31533388056578563584"));(* 19, 19 *) +(mk_real_int (num_of_string "24509598869442237309")),(mk_real_int (num_of_string "37827610630008496000"));(* 19, 19 *) +(mk_real_int (num_of_string "35617073287735853243")),(mk_real_int (num_of_string "21640293701026126280"));(* 19, 19 *) +(mk_real_int (num_of_string "21864141896494592552")),(mk_real_int (num_of_string "19414858669469493274"));(* 19, 19 *) +(mk_real_int (num_of_string "22497046821796996680")),(mk_real_int (num_of_string "24468361849494163755"));(* 19, 19 *) +(mk_real_int (num_of_string "18454160315433307575")),(mk_real_int (num_of_string "29544262229545937390"));(* 19, 19 *) +(mk_real_int (num_of_string "31389254625076667462")),(mk_real_int (num_of_string "25477028738146954496"));(* 19, 19 *) +(mk_real_int (num_of_string "38165379396797212593")),(mk_real_int (num_of_string "33222660668557097199"));(* 19, 19 *) +(mk_real_int (num_of_string "32659689786159888100")),(mk_real_int (num_of_string "19724349117170828790"));(* 19, 19 *) +(mk_real_int (num_of_string "26588996672188922136")),(mk_real_int (num_of_string "26199019831970324064"));(* 19, 19 *) +(mk_real_int (num_of_string "25497183208097766484")),(mk_real_int (num_of_string "26791236689114765362"));(* 19, 19 *) +(mk_real_int (num_of_string "13553688060939942542")),(mk_real_int (num_of_string "18788975757545615578"));(* 19, 19 *) +(mk_real_int (num_of_string "24626605995958018888")),(mk_real_int (num_of_string "14675606037815959225"));(* 19, 19 *) +(mk_real_int (num_of_string "14360744317476348330")),(mk_real_int (num_of_string "16988500655803533120"));(* 19, 19 *) +(mk_real_int (num_of_string "33604134480727498490")),(mk_real_int (num_of_string "30978531819722722235"));(* 19, 19 *) +(mk_real_int (num_of_string "26598261395929266120")),(mk_real_int (num_of_string "20886689752436495647"));(* 19, 19 *) +(mk_real_int (num_of_string "16274997882728650560")),(mk_real_int (num_of_string "30576091956785224531"));(* 19, 19 *) +(mk_real_int (num_of_string "15795590437661664058")),(mk_real_int (num_of_string "32607007828032847671"));(* 19, 19 *) +(mk_real_int (num_of_string "21226657063041387199")),(mk_real_int (num_of_string "19380600379037717160"));(* 19, 19 *) +(mk_real_int (num_of_string "17731492421475320840")),(mk_real_int (num_of_string "31447565893156133292"));(* 19, 19 *) +(mk_real_int (num_of_string "39017189815494029304")),(mk_real_int (num_of_string "22074840229465576014"));(* 19, 19 *) +(mk_real_int (num_of_string "36771261272764828953")),(mk_real_int (num_of_string "25177793280198373298"));(* 19, 19 *) +(mk_real_int (num_of_string "20118517852716865615")),(mk_real_int (num_of_string "27600852437538170120"));(* 19, 19 *) +(mk_real_int (num_of_string "12798707362650958133")),(mk_real_int (num_of_string "13596375121038965541"));(* 19, 19 *) +(mk_real_int (num_of_string "21924971892685498406")),(mk_real_int (num_of_string "18535986363171178440"));(* 19, 19 *) +(mk_real_int (num_of_string "24377705425187318611")),(mk_real_int (num_of_string "25522947763916285980"));(* 19, 19 *) +(mk_real_int (num_of_string "27747326026551073932")),(mk_real_int (num_of_string "11470453796212064390"));(* 19, 19 *) +(mk_real_int (num_of_string "34407010449780647976")),(mk_real_int (num_of_string "34382739334333531504"));(* 19, 19 *) +(mk_real_int (num_of_string "27705310311230639406")),(mk_real_int (num_of_string "12805445347440959092"));(* 19, 19 *) +(mk_real_int (num_of_string "22380991783605488880")),(mk_real_int (num_of_string "22091018206208962956"));(* 19, 19 *) +(mk_real_int (num_of_string "15231881672406607626")),(mk_real_int (num_of_string "35524479484320363779"));(* 19, 19 *) +(mk_real_int (num_of_string "25323696262052730850")),(mk_real_int (num_of_string "31064262492329038368"));(* 19, 19 *) +(mk_real_int (num_of_string "33181388727825713562")),(mk_real_int (num_of_string "36905068628580972160"));(* 19, 19 *) +(mk_real_int (num_of_string "29531663516820563615")),(mk_real_int (num_of_string "14929396566819381856"));(* 19, 19 *) +(mk_real_int (num_of_string "19014337390570743540")),(mk_real_int (num_of_string "29674481741532370512"));(* 19, 19 *) +(mk_real_int (num_of_string "34120619231727276490")),(mk_real_int (num_of_string "31967514887679298224"));(* 19, 19 *) +(mk_real_int (num_of_string "36263673891684893676")),(mk_real_int (num_of_string "29341339085540926532"));(* 19, 19 *) +(mk_real_int (num_of_string "26078170459254886236")),(mk_real_int (num_of_string "21772899228906584836"));(* 19, 19 *) +(mk_real_int (num_of_string "25550138063915180232")),(mk_real_int (num_of_string "19983476906423455392"));(* 19, 19 *) +(mk_real_int (num_of_string "16582615836984859992")),(mk_real_int (num_of_string "23091038345673222408"));(* 19, 19 *) +(mk_real_int (num_of_string "16041562952460098152")),(mk_real_int (num_of_string "21129650129457407010"));(* 19, 19 *) +(mk_real_int (num_of_string "12006603173605852130")),(mk_real_int (num_of_string "17487121410700070283"));(* 19, 19 *) +(mk_real_int (num_of_string "32946725289700714239")),(mk_real_int (num_of_string "16155093850487430916"));(* 19, 19 *) +(mk_real_int (num_of_string "37146289981551417216")),(mk_real_int (num_of_string "22125607319717363044"));(* 19, 19 *) +(mk_real_int (num_of_string "13328250983295056754")),(mk_real_int (num_of_string "31775852003226558942"));(* 19, 19 *) +(mk_real_int (num_of_string "22132328423998996830")),(mk_real_int (num_of_string "35678121467210738780"));(* 19, 19 *) +(mk_real_int (num_of_string "27593476222192887644")),(mk_real_int (num_of_string "30781287604773253020"));(* 19, 19 *) +(mk_real_int (num_of_string "20169312843359152000")),(mk_real_int (num_of_string "13513481699418255170"));(* 19, 19 *) +(mk_real_int (num_of_string "21409277147739266038")),(mk_real_int (num_of_string "29952470206552291002"));(* 19, 19 *) +(mk_real_int (num_of_string "30248208034708693370")),(mk_real_int (num_of_string "33787441562769576000"));(* 19, 19 *) +(mk_real_int (num_of_string "17179944701068635860")),(mk_real_int (num_of_string "20246696732625708224"));(* 19, 19 *) +(mk_real_int (num_of_string "27592950045860018336")),(mk_real_int (num_of_string "22656866243372258887"));(* 19, 19 *) +(mk_real_int (num_of_string "21645206055816802305")),(mk_real_int (num_of_string "35165670323329428960"));(* 19, 19 *) +(mk_real_int (num_of_string "15138933888302827702")),(mk_real_int (num_of_string "20666020761463043736"));(* 19, 19 *) +(mk_real_int (num_of_string "30675362596463602776")),(mk_real_int (num_of_string "16849906652436225258"));(* 19, 19 *) +(mk_real_int (num_of_string "19623236605051973850")),(mk_real_int (num_of_string "27428330004651971846"));(* 19, 19 *) +(mk_real_int (num_of_string "26344184171233972824")),(mk_real_int (num_of_string "25279693627925442915"));(* 19, 19 *) +(mk_real_int (num_of_string "36654593024610957968")),(mk_real_int (num_of_string "27646920664560662993"));(* 19, 19 *) +(mk_real_int (num_of_string "31221939749053570627")),(mk_real_int (num_of_string "17965315047249648144"));(* 19, 19 *) +(mk_real_int (num_of_string "25597944237540268110")),(mk_real_int (num_of_string "41808751982371823790"));(* 19, 19 *) +(mk_real_int (num_of_string "21344451558004133020")),(mk_real_int (num_of_string "17124918083033992440"));(* 19, 19 *) +(mk_real_int (num_of_string "21981096408346541829")),(mk_real_int (num_of_string "13674620900120828725"));(* 19, 19 *) +(mk_real_int (num_of_string "14647819175183465040")),(mk_real_int (num_of_string "30034774506045728100"));(* 19, 19 *) +(mk_real_int (num_of_string "22143544139323588267")),(mk_real_int (num_of_string "29885638079817176338"));(* 19, 19 *) +(mk_real_int (num_of_string "19550733879651497985")),(mk_real_int (num_of_string "29568402713350133952"));(* 19, 19 *) +(mk_real_int (num_of_string "26985541859353609290")),(mk_real_int (num_of_string "25304391139247949300"));(* 19, 19 *) +(mk_real_int (num_of_string "22096491556805736378")),(mk_real_int (num_of_string "35226266126172145332"));(* 19, 19 *) +(mk_real_int (num_of_string "34004720482896220838")),(mk_real_int (num_of_string "21278642233425501309"));(* 19, 19 *) +(mk_real_int (num_of_string "24536086935723931953")),(mk_real_int (num_of_string "29275992463371021390"));(* 19, 19 *) +(mk_real_int (num_of_string "31331396467788170204")),(mk_real_int (num_of_string "19878039994797111710"));(* 19, 19 *) +(mk_real_int (num_of_string "20309178453818646700")),(mk_real_int (num_of_string "37548673291733307418"));(* 19, 19 *) +(mk_real_int (num_of_string "22328525158439225726")),(mk_real_int (num_of_string "21307219565831411454"));(* 19, 19 *) +(mk_real_int (num_of_string "29427492048601420400")),(mk_real_int (num_of_string "22201442719323778284"));(* 19, 19 *) +(mk_real_int (num_of_string "31711775010073139124")),(mk_real_int (num_of_string "29404749415651586790"));(* 19, 19 *) +(mk_real_int (num_of_string "22100592600805206708")),(mk_real_int (num_of_string "25728987974184227656"));(* 19, 19 *) +(mk_real_int (num_of_string "17855939735664750775")),(mk_real_int (num_of_string "17212428397568501350"));(* 19, 19 *) +(mk_real_int (num_of_string "17402582047553443158")),(mk_real_int (num_of_string "22066766222533077705"));(* 19, 19 *) +(mk_real_int (num_of_string "17382638054358948800")),(mk_real_int (num_of_string "23141063801553832530"));(* 19, 19 *) +(mk_real_int (num_of_string "24321715574161737996")),(mk_real_int (num_of_string "17116106132371068900"));(* 19, 19 *) +(mk_real_int (num_of_string "23087526006034420502")),(mk_real_int (num_of_string "30211104660413350905"));(* 19, 19 *) +(mk_real_int (num_of_string "38819900249420230908")),(mk_real_int (num_of_string "35609313341546045992"));(* 19, 19 *) +(mk_real_int (num_of_string "32277773000740037936")),(mk_real_int (num_of_string "24221259742153765500"));(* 19, 19 *) +(mk_real_int (num_of_string "23669881335897108312")),(mk_real_int (num_of_string "23821386511061026195"));(* 19, 19 *) +(mk_real_int (num_of_string "15936801526316245542")),(mk_real_int (num_of_string "22701857823789760044"));(* 19, 19 *) +(mk_real_int (num_of_string "27443341459799324796")),(mk_real_int (num_of_string "18138408851798046768"));(* 19, 19 *) +(mk_real_int (num_of_string "23017878989135860214")),(mk_real_int (num_of_string "28299754207163618080"));(* 19, 19 *) +(mk_real_int (num_of_string "23486112054204467041")),(mk_real_int (num_of_string "32462369300386538667"));(* 19, 19 *) +(mk_real_int (num_of_string "22034346603138198384")),(mk_real_int (num_of_string "19336747127471395369"));(* 19, 19 *) +(mk_real_int (num_of_string "17068604785795454100")),(mk_real_int (num_of_string "26551280941354186281"));(* 19, 19 *) +(mk_real_int (num_of_string "24513793605909128268")),(mk_real_int (num_of_string "22010906713199306760"));(* 19, 19 *) +(mk_real_int (num_of_string "21698337868319856744")),(mk_real_int (num_of_string "24659990850858277530"));(* 19, 19 *) +(mk_real_int (num_of_string "18987790856881628936")),(mk_real_int (num_of_string "38703222585351931750"));(* 19, 19 *) +(mk_real_int (num_of_string "26380381640729697570")),(mk_real_int (num_of_string "13269001234986019512"));(* 19, 19 *) +(mk_real_int (num_of_string "18261258302314984044")),(mk_real_int (num_of_string "18190213142655771525"));(* 19, 19 *) +(mk_real_int (num_of_string "25788522625823421530")),(mk_real_int (num_of_string "28599443352100219170"));(* 19, 19 *) +(mk_real_int (num_of_string "27582711707211597090")),(mk_real_int (num_of_string "13052864770226574524"));(* 19, 19 *) +(mk_real_int (num_of_string "24408460288856776506")),(mk_real_int (num_of_string "21770068987618583632"));(* 19, 19 *) +(mk_real_int (num_of_string "30830903962137692160")),(mk_real_int (num_of_string "31359588218548448166"));(* 19, 19 *) +(mk_real_int (num_of_string "18495207171285569956")),(mk_real_int (num_of_string "27420822346202658945"));(* 19, 19 *) +(mk_real_int (num_of_string "18847940188537546625")),(mk_real_int (num_of_string "24148041476039731712"));(* 19, 19 *) +(mk_real_int (num_of_string "21761763003063494125")),(mk_real_int (num_of_string "19519470799177735760"));(* 19, 19 *) +(mk_real_int (num_of_string "33564953961711504464")),(mk_real_int (num_of_string "32653099097339940065"));(* 19, 19 *) +(mk_real_int (num_of_string "23255989360125834312")),(mk_real_int (num_of_string "11428483616948489850"));(* 19, 19 *) +(mk_real_int (num_of_string "25137192059546909056")),(mk_real_int (num_of_string "24274242678058871927"));(* 19, 19 *) +(mk_real_int (num_of_string "25802598736174967575")),(mk_real_int (num_of_string "28364616950519037606"));(* 19, 19 *) +(mk_real_int (num_of_string "24685943665311845972")),(mk_real_int (num_of_string "27685215255504302012"));(* 19, 19 *) +(mk_real_int (num_of_string "24262716995383439870")),(mk_real_int (num_of_string "23413108019946708470"));(* 19, 19 *) +(mk_real_int (num_of_string "14354642629640124471")),(mk_real_int (num_of_string "13212980882165527540"));(* 19, 19 *) +(mk_real_int (num_of_string "37605209795841517247")),(mk_real_int (num_of_string "34434325806805453320"));(* 19, 19 *) +(mk_real_int (num_of_string "17482455975190084076")),(mk_real_int (num_of_string "28882137203104564236"));(* 19, 19 *) +(mk_real_int (num_of_string "24063328203927668392")),(mk_real_int (num_of_string "21364869037106819070"));(* 19, 19 *) +(mk_real_int (num_of_string "32807061770042118185")),(mk_real_int (num_of_string "33847185911901104600"));(* 19, 19 *) +(mk_real_int (num_of_string "21734625173406995520")),(mk_real_int (num_of_string "36785867593029564636"));(* 19, 19 *) +(mk_real_int (num_of_string "33291805040098432586")),(mk_real_int (num_of_string "20918779597896747886"));(* 19, 19 *) +(mk_real_int (num_of_string "24764382238421506725")),(mk_real_int (num_of_string "22049541964017668463"));(* 19, 19 *) +(mk_real_int (num_of_string "36980452711734625335")),(mk_real_int (num_of_string "16251343302261158520"));(* 19, 19 *) +(mk_real_int (num_of_string "25470220787897428620")),(mk_real_int (num_of_string "21454231125193216240"));(* 19, 19 *) +(mk_real_int (num_of_string "21884788984906964743")),(mk_real_int (num_of_string "21318765634307187442"));(* 19, 19 *) +(mk_real_int (num_of_string "16316068658335596612")),(mk_real_int (num_of_string "22464820172853730320"));(* 19, 19 *) +(mk_real_int (num_of_string "22409649905876649427")),(mk_real_int (num_of_string "31411461082596577136"));(* 19, 19 *) +(mk_real_int (num_of_string "37775162746432655280")),(mk_real_int (num_of_string "27093678766252889725"));(* 19, 19 *) +(mk_real_int (num_of_string "30019980116289418750")),(mk_real_int (num_of_string "17681088934580252126"));(* 19, 19 *) +(mk_real_int (num_of_string "15787621091768439738")),(mk_real_int (num_of_string "31241006724121256205"));(* 19, 19 *) +(mk_real_int (num_of_string "18576616934182214193")),(mk_real_int (num_of_string "27076865338594659071"));(* 19, 19 *) +(mk_real_int (num_of_string "27801119379245204014")),(mk_real_int (num_of_string "18499554587128490810"));(* 19, 19 *) +(mk_real_int (num_of_string "33021601686411958334")),(mk_real_int (num_of_string "18984143019924845950"));(* 19, 19 *) +(mk_real_int (num_of_string "34656284071577674605")),(mk_real_int (num_of_string "25400363181131315520"));(* 19, 19 *) +(mk_real_int (num_of_string "22238992111205128006")),(mk_real_int (num_of_string "23259623118620891211"));(* 19, 19 *) +(mk_real_int (num_of_string "16397842823556602760")),(mk_real_int (num_of_string "13316280665147741270"));(* 19, 19 *) +(mk_real_int (num_of_string "21649143791556018155")),(mk_real_int (num_of_string "24380830033197971872"));(* 19, 19 *) +(mk_real_int (num_of_string "13199435846426084860")),(mk_real_int (num_of_string "24847810947692768288"));(* 19, 19 *) +(mk_real_int (num_of_string "14150269988641140200")),(mk_real_int (num_of_string "15815660819655009225"));(* 19, 19 *) +(mk_real_int (num_of_string "42204146720928205860")),(mk_real_int (num_of_string "14712568422015628340"));(* 19, 19 *) +(mk_real_int (num_of_string "13246708761339822153")),(mk_real_int (num_of_string "19607589261722560725"));(* 19, 19 *) +(mk_real_int (num_of_string "32895760411454747488")),(mk_real_int (num_of_string "17460796088764225758"));(* 19, 19 *) +(mk_real_int (num_of_string "18899167984289012288")),(mk_real_int (num_of_string "23793384144659539696"));(* 19, 19 *) +(mk_real_int (num_of_string "33978551778860244732")),(mk_real_int (num_of_string "21825851399025562240"));(* 19, 19 *) +(mk_real_int (num_of_string "30488087759588800825")),(mk_real_int (num_of_string "16314329673313065548"));(* 19, 19 *) +(mk_real_int (num_of_string "26280004180894450800")),(mk_real_int (num_of_string "35078125034309500308"));(* 19, 19 *) +(mk_real_int (num_of_string "16485356594170991197")),(mk_real_int (num_of_string "27036995653100044381"));(* 19, 19 *) +(mk_real_int (num_of_string "22571128837490441362")),(mk_real_int (num_of_string "36340873507586687512"));(* 19, 19 *) +(mk_real_int (num_of_string "22791167115233475530")),(mk_real_int (num_of_string "35440417913455324737"));(* 19, 19 *) +(mk_real_int (num_of_string "27669954355559036653")),(mk_real_int (num_of_string "39536455825803336840"));(* 19, 19 *) +(mk_real_int (num_of_string "22584127379549514086")),(mk_real_int (num_of_string "27604438056215103776"));(* 19, 19 *) +(mk_real_int (num_of_string "26313087740355472749")),(mk_real_int (num_of_string "19999933290240356684"));(* 19, 19 *) +(mk_real_int (num_of_string "28386135969361328235")),(mk_real_int (num_of_string "20442551843693814120"));(* 19, 19 *) +(mk_real_int (num_of_string "18459196260535502472")),(mk_real_int (num_of_string "21176814170883095296"));(* 19, 19 *) +(mk_real_int (num_of_string "27998349573677267400")),(mk_real_int (num_of_string "17940473647285109778"));(* 19, 19 *) +(mk_real_int (num_of_string "21314466750214810535")),(mk_real_int (num_of_string "23261891940621234582"));(* 19, 19 *) +(mk_real_int (num_of_string "29353566625665142960")),(mk_real_int (num_of_string "15196203556960611900"));(* 19, 19 *) +(mk_real_int (num_of_string "16062224144359705169")),(mk_real_int (num_of_string "31965756049675649124"));(* 19, 19 *) +(mk_real_int (num_of_string "31181753387861102400")),(mk_real_int (num_of_string "32800476488473214466"));(* 19, 19 *) +(mk_real_int (num_of_string "36342765802472223600")),(mk_real_int (num_of_string "28929950600399156616"));(* 19, 19 *) +(mk_real_int (num_of_string "26803964775091217714")),(mk_real_int (num_of_string "30443294620546244096"));(* 19, 19 *) +(mk_real_int (num_of_string "20162640799716389700")),(mk_real_int (num_of_string "28535526671688838439"));(* 19, 19 *) +(mk_real_int (num_of_string "32672562169071981464")),(mk_real_int (num_of_string "22213898848408890150"));(* 19, 19 *) +(mk_real_int (num_of_string "27509399082047618208")),(mk_real_int (num_of_string "20357649146563834875"));(* 19, 19 *) +(mk_real_int (num_of_string "40282882683633784766")),(mk_real_int (num_of_string "23993493380779388268"));(* 19, 19 *) +(mk_real_int (num_of_string "24889592076979535664")),(mk_real_int (num_of_string "25596758577025945936"));(* 19, 19 *) +(mk_real_int (num_of_string "36178449801387946074")),(mk_real_int (num_of_string "30036016885453005438"));(* 19, 19 *) +(mk_real_int (num_of_string "18340256349106495056")),(mk_real_int (num_of_string "27351018742769488338"));(* 19, 19 *) +(mk_real_int (num_of_string "30349903186600500239")),(mk_real_int (num_of_string "22675907052739393024"));(* 19, 19 *) +(mk_real_int (num_of_string "25340956861049952980")),(mk_real_int (num_of_string "14554696132468375488"));(* 19, 19 *) +(mk_real_int (num_of_string "30434053486901543094")),(mk_real_int (num_of_string "34903111318344978753"));(* 19, 19 *) +(mk_real_int (num_of_string "20593526293144207260")),(mk_real_int (num_of_string "34320938490381856533"));(* 19, 19 *) +(mk_real_int (num_of_string "25294599512835352095")),(mk_real_int (num_of_string "28866778122270999988"));(* 19, 19 *) +(mk_real_int (num_of_string "30595768371252037250")),(mk_real_int (num_of_string "17157010495496446080"));(* 19, 19 *) +(mk_real_int (num_of_string "31156269790789924440")),(mk_real_int (num_of_string "25586580972559089637"));(* 19, 19 *) +(mk_real_int (num_of_string "26313869294074956352")),(mk_real_int (num_of_string "22294258113680253547"));(* 19, 19 *) +(mk_real_int (num_of_string "21718643998109387472")),(mk_real_int (num_of_string "17685530933316988665"));(* 19, 19 *) +(mk_real_int (num_of_string "34432579086991905820")),(mk_real_int (num_of_string "24125740438134501320"));(* 19, 19 *) +(mk_real_int (num_of_string "37110643144701792380")),(mk_real_int (num_of_string "20775493568154656958"));(* 19, 19 *) +(mk_real_int (num_of_string "36545974624960336690")),(mk_real_int (num_of_string "31428508005398278412"));(* 19, 19 *) +(mk_real_int (num_of_string "43197310567402523400")),(mk_real_int (num_of_string "16088091250951015186"));(* 19, 19 *) +(mk_real_int (num_of_string "23257535950489181033")),(mk_real_int (num_of_string "28456451544992664303"));(* 19, 19 *) +(mk_real_int (num_of_string "28593229202225308368")),(mk_real_int (num_of_string "27017600688668787890"));(* 19, 19 *) +(mk_real_int (num_of_string "22557743372387916000")),(mk_real_int (num_of_string "22888176977370647888"));(* 19, 19 *) +(mk_real_int (num_of_string "26691937052873753958")),(mk_real_int (num_of_string "26386172792557327420"));(* 19, 19 *) +(mk_real_int (num_of_string "13576802810000164405")),(mk_real_int (num_of_string "24768228216581841453"));(* 19, 19 *) +(mk_real_int (num_of_string "30311697775602001440")),(mk_real_int (num_of_string "35431818084121715168"));(* 19, 19 *) +(mk_real_int (num_of_string "25948640898213573276")),(mk_real_int (num_of_string "25940834982073338239"));(* 19, 19 *) +(mk_real_int (num_of_string "26849875634153504240")),(mk_real_int (num_of_string "30872325595819157450"));(* 19, 19 *) +(mk_real_int (num_of_string "21507347672586141696")),(mk_real_int (num_of_string "12928425043997799292"));(* 19, 19 *) +(mk_real_int (num_of_string "24335519952035172804")),(mk_real_int (num_of_string "16822125598636476228"));(* 19, 19 *) +(mk_real_int (num_of_string "23600351176291570428")),(mk_real_int (num_of_string "24713184514508879466"));(* 19, 19 *) +(mk_real_int (num_of_string "22899088229278768661")),(mk_real_int (num_of_string "23379690009005171688"));(* 19, 19 *) +(mk_real_int (num_of_string "37956340093595272360")),(mk_real_int (num_of_string "18102109283614287954"));(* 19, 19 *) +(mk_real_int (num_of_string "14655950813499902555")),(mk_real_int (num_of_string "24050402490225431628"));(* 19, 19 *) +(mk_real_int (num_of_string "29648948809431069624")),(mk_real_int (num_of_string "25138431393115367250"));(* 19, 19 *) +(mk_real_int (num_of_string "19758837791426189170")),(mk_real_int (num_of_string "25956783408841313215"));(* 19, 19 *) +(mk_real_int (num_of_string "16569199130785328808")),(mk_real_int (num_of_string "28529726078769698783"));(* 19, 19 *) +(mk_real_int (num_of_string "21266812450129096488")),(mk_real_int (num_of_string "26505103197560241760"));(* 19, 19 *) +(mk_real_int (num_of_string "25493453905539500540")),(mk_real_int (num_of_string "18658959656612538670"));(* 19, 19 *) +(mk_real_int (num_of_string "23556577019856893584")),(mk_real_int (num_of_string "28488314694106903537"));(* 19, 19 *) +(mk_real_int (num_of_string "19948414148749771256")),(mk_real_int (num_of_string "22273438498791337506"));(* 19, 19 *) +(mk_real_int (num_of_string "33297813638782113036")),(mk_real_int (num_of_string "17882231489399270444"));(* 19, 19 *) +(mk_real_int (num_of_string "29397677932176682051")),(mk_real_int (num_of_string "21549186267093807487"));(* 19, 19 *) +(mk_real_int (num_of_string "19465798849849673046")),(mk_real_int (num_of_string "23745245152315670665"));(* 19, 19 *) +(mk_real_int (num_of_string "29773451615455176387")),(mk_real_int (num_of_string "27163788802998857394"));(* 19, 19 *) +(mk_real_int (num_of_string "32842813070487631772")),(mk_real_int (num_of_string "16377913050783071436"));(* 19, 19 *) +(mk_real_int (num_of_string "30091707703911362432")),(mk_real_int (num_of_string "25249656137020914060"));(* 19, 19 *) +(mk_real_int (num_of_string "23589225235850488049")),(mk_real_int (num_of_string "34206879536826949920"));(* 19, 19 *) +(mk_real_int (num_of_string "31898780065226162814")),(mk_real_int (num_of_string "19465926564544377632"));(* 19, 19 *) +(mk_real_int (num_of_string "41305668996654499316")),(mk_real_int (num_of_string "27191351362377963486"));(* 19, 19 *) +(mk_real_int (num_of_string "20623370293922374352")),(mk_real_int (num_of_string "20147453042584755140"));(* 19, 19 *) +(mk_real_int (num_of_string "39974127750395204487")),(mk_real_int (num_of_string "31398746878691767652"));(* 19, 19 *) +(mk_real_int (num_of_string "22300899890820961696")),(mk_real_int (num_of_string "13900499863132201506"));(* 19, 19 *) +(mk_real_int (num_of_string "22232761782592376312")),(mk_real_int (num_of_string "23744723660532921728"));(* 19, 19 *) +(mk_real_int (num_of_string "27966187428081714196")),(mk_real_int (num_of_string "36096106859875704950"));(* 19, 19 *) +(mk_real_int (num_of_string "38314073399773546892")),(mk_real_int (num_of_string "19600899384345470488"));(* 19, 19 *) +(mk_real_int (num_of_string "28961126991378701790")),(mk_real_int (num_of_string "28910525367378710682"));(* 19, 19 *) +(mk_real_int (num_of_string "17470633936510449816")),(mk_real_int (num_of_string "20912864791058017569"));(* 19, 19 *) +(mk_real_int (num_of_string "26663069926377673800")),(mk_real_int (num_of_string "30161730089727198171"));(* 19, 19 *) +(mk_real_int (num_of_string "21342089120250327858")),(mk_real_int (num_of_string "18550588946773456452"));(* 19, 19 *) +(mk_real_int (num_of_string "26273505029779571872")),(mk_real_int (num_of_string "19822877957026831687"));(* 19, 19 *) +(mk_real_int (num_of_string "32876421336244952488")),(mk_real_int (num_of_string "20149284916234047233"));(* 19, 19 *) +(mk_real_int (num_of_string "25577887599110607585")),(mk_real_int (num_of_string "26835929099437470375"));(* 19, 19 *) +(mk_real_int (num_of_string "42626056963981528400")),(mk_real_int (num_of_string "19943764079993547695"));(* 19, 19 *) +(mk_real_int (num_of_string "21838923264396913950")),(mk_real_int (num_of_string "22825133517720625575"));(* 19, 19 *) +(mk_real_int (num_of_string "22239186334554632520")),(mk_real_int (num_of_string "22769737641242918997"));(* 19, 19 *) +(mk_real_int (num_of_string "29709011451290931188")),(mk_real_int (num_of_string "23234555493455919525"));(* 19, 19 *) +(mk_real_int (num_of_string "12691541633567538269")),(mk_real_int (num_of_string "22662773436066740680"));(* 19, 19 *) +(mk_real_int (num_of_string "22314796872591389782")),(mk_real_int (num_of_string "14588080525587964571"));(* 19, 19 *) +(mk_real_int (num_of_string "26101202929280956026")),(mk_real_int (num_of_string "27392355273695007288"));(* 19, 19 *) +(mk_real_int (num_of_string "25855063617604744600")),(mk_real_int (num_of_string "24123189463932751346"));(* 19, 19 *) +(mk_real_int (num_of_string "25429453413802726453")),(mk_real_int (num_of_string "20022582181469275716"));(* 19, 19 *) +(mk_real_int (num_of_string "25900968320854327624")),(mk_real_int (num_of_string "20174118381402248692"));(* 19, 19 *) +(mk_real_int (num_of_string "21607066735242664104")),(mk_real_int (num_of_string "27874902862578863575"));(* 19, 19 *) +(mk_real_int (num_of_string "27247746728153494158")),(mk_real_int (num_of_string "31246197516952637901"));(* 19, 19 *) +(mk_real_int (num_of_string "11649269097240563250")),(mk_real_int (num_of_string "33376888058324957916"));(* 19, 19 *) +(mk_real_int (num_of_string "21002321600510230904")),(mk_real_int (num_of_string "25521918462486637950"));(* 19, 19 *) +(mk_real_int (num_of_string "34361779077523253136")),(mk_real_int (num_of_string "27478709758417471884"));(* 19, 19 *) +(mk_real_int (num_of_string "19307364164949234605")),(mk_real_int (num_of_string "27201664169583979185"));(* 19, 19 *) +(mk_real_int (num_of_string "21708972060248583726")),(mk_real_int (num_of_string "26625792852522188424"));(* 19, 19 *) +(mk_real_int (num_of_string "20992909644750678602")),(mk_real_int (num_of_string "28216581947324199880"));(* 19, 19 *) +(mk_real_int (num_of_string "23171041241070068632")),(mk_real_int (num_of_string "16984018234806833672"));(* 19, 19 *) +(mk_real_int (num_of_string "29304555834043072110")),(mk_real_int (num_of_string "21942018883209161000"));(* 19, 19 *) +(mk_real_int (num_of_string "21431728051247383881")),(mk_real_int (num_of_string "21046630079900826060"));(* 19, 19 *) +(mk_real_int (num_of_string "19972222957218643606")),(mk_real_int (num_of_string "21348324562632103905"));(* 19, 19 *) +(mk_real_int (num_of_string "29215086405346809528")),(mk_real_int (num_of_string "17383389464387498332"));(* 19, 19 *) +(mk_real_int (num_of_string "19876900009504031032")),(mk_real_int (num_of_string "27577444252954639362"));(* 19, 19 *) +(mk_real_int (num_of_string "20045304743982062490")),(mk_real_int (num_of_string "25809624318970708326"));(* 19, 19 *) +(mk_real_int (num_of_string "28754657356275651889")),(mk_real_int (num_of_string "21176415570809191000"));(* 19, 19 *) +(mk_real_int (num_of_string "24113366001973459651")),(mk_real_int (num_of_string "21711858573018874227"));(* 19, 19 *) +(mk_real_int (num_of_string "29630032496049242367")),(mk_real_int (num_of_string "20756856522358502887"));(* 19, 19 *) +(mk_real_int (num_of_string "30040003158269082935")),(mk_real_int (num_of_string "29726820060748053936"));(* 19, 19 *) +(mk_real_int (num_of_string "37836152937793969616")),(mk_real_int (num_of_string "19944601580631661890"));(* 19, 19 *) +(mk_real_int (num_of_string "18848916771827463068")),(mk_real_int (num_of_string "26922325303954551042"));(* 19, 19 *) +(mk_real_int (num_of_string "15128095960284562332")),(mk_real_int (num_of_string "17800846923923030275"));(* 19, 19 *) +(mk_real_int (num_of_string "29093134335533733696")),(mk_real_int (num_of_string "27303960891980689840"));(* 19, 19 *) +(mk_real_int (num_of_string "31958131407042904448")),(mk_real_int (num_of_string "22379320634918408205"));(* 19, 19 *) +(mk_real_int (num_of_string "23294275063204857250")),(mk_real_int (num_of_string "18669256321770054000"));(* 19, 19 *) +(mk_real_int (num_of_string "17786143591562317488")),(mk_real_int (num_of_string "30176673536329722622"));(* 19, 19 *) +(mk_real_int (num_of_string "28542283896162267264")),(mk_real_int (num_of_string "13207308519643598250"));(* 19, 19 *) +(mk_real_int (num_of_string "29983153526405863740")),(mk_real_int (num_of_string "15013036575285946362"));(* 19, 19 *) +(mk_real_int (num_of_string "23858314977795409100")),(mk_real_int (num_of_string "29854780687499042484"));(* 19, 19 *) +(mk_real_int (num_of_string "34872388448702151754")),(mk_real_int (num_of_string "34174775218509951102"));(* 19, 19 *) +(mk_real_int (num_of_string "26983669734902155572")),(mk_real_int (num_of_string "32092615951770995082"));(* 19, 19 *) +(mk_real_int (num_of_string "23116869093692308220")),(mk_real_int (num_of_string "26343594450116949159"));(* 19, 19 *) +(mk_real_int (num_of_string "41047867128209699340")),(mk_real_int (num_of_string "22610949879326408292"));(* 19, 19 *) +(mk_real_int (num_of_string "27227312429443226947")),(mk_real_int (num_of_string "29862366717098140841"));(* 19, 19 *) +(mk_real_int (num_of_string "17667643772654073242")),(mk_real_int (num_of_string "37270985840329657196"));(* 19, 19 *) +(mk_real_int (num_of_string "23638363667741175276")),(mk_real_int (num_of_string "14629372843573341084"));(* 19, 19 *) +(mk_real_int (num_of_string "13842637499705193036")),(mk_real_int (num_of_string "41480226945249484590"));(* 19, 19 *) +(mk_real_int (num_of_string "17236894653963564140")),(mk_real_int (num_of_string "15816420339603437631"));(* 19, 19 *) +(mk_real_int (num_of_string "13913517528973566504")),(mk_real_int (num_of_string "25436130346155656842"));(* 19, 19 *) +(mk_real_int (num_of_string "31220442655840998560")),(mk_real_int (num_of_string "16925990165385038595"));(* 19, 19 *) +(mk_real_int (num_of_string "22833486705024467703")),(mk_real_int (num_of_string "25890454048049275146"));(* 19, 19 *) +(mk_real_int (num_of_string "16993108282830367226")),(mk_real_int (num_of_string "22014373786659157453"));(* 19, 19 *) +(mk_real_int (num_of_string "21437302216226175345")),(mk_real_int (num_of_string "24291181329271812560"));(* 19, 19 *) +(mk_real_int (num_of_string "17857255840162203432")),(mk_real_int (num_of_string "29021998546870931778"))(* 19, 19 *) +];; diff --git a/formal_lp/old/arith/tests/arith_test_data25.hl b/formal_lp/old/arith/tests/arith_test_data25.hl new file mode 100644 index 0000000..2a0fb46 --- /dev/null +++ b/formal_lp/old/arith/tests/arith_test_data25.hl @@ -0,0 +1,1002 @@ +let data = [ +(mk_real_int (num_of_string "3680857660418378333747253")),(mk_real_int (num_of_string "4414269758065822047732996"));(* 24, 24 *) +(mk_real_int (num_of_string "4869533942069625706034388")),(mk_real_int (num_of_string "2695321389480405743094754"));(* 24, 24 *) +(mk_real_int (num_of_string "6026959379057037304561920")),(mk_real_int (num_of_string "3021227783731778829105340"));(* 24, 24 *) +(mk_real_int (num_of_string "6069890482189228444287384")),(mk_real_int (num_of_string "2508693981660739820982375"));(* 24, 24 *) +(mk_real_int (num_of_string "5085493857943497294277410")),(mk_real_int (num_of_string "2784707669039116279880796"));(* 24, 24 *) +(mk_real_int (num_of_string "2529596662834216166045470")),(mk_real_int (num_of_string "5094971413369308935456745"));(* 24, 24 *) +(mk_real_int (num_of_string "2083046894126884554363792")),(mk_real_int (num_of_string "4638708864695794085582280"));(* 24, 24 *) +(mk_real_int (num_of_string "2853448616036064779238000")),(mk_real_int (num_of_string "3330517235861434969162152"));(* 24, 24 *) +(mk_real_int (num_of_string "2619438989990631321152800")),(mk_real_int (num_of_string "3123403170002537185764864"));(* 24, 24 *) +(mk_real_int (num_of_string "4053189443833334918741056")),(mk_real_int (num_of_string "5474988659661997619311874"));(* 24, 24 *) +(mk_real_int (num_of_string "3346348473610119083580435")),(mk_real_int (num_of_string "4248285207423699106852671"));(* 24, 24 *) +(mk_real_int (num_of_string "4275207716371465895734440")),(mk_real_int (num_of_string "2969374045599498823638480"));(* 24, 24 *) +(mk_real_int (num_of_string "5169305558992765167994720")),(mk_real_int (num_of_string "3253553768332158469844600"));(* 24, 24 *) +(mk_real_int (num_of_string "2062186532980711479654480")),(mk_real_int (num_of_string "3729404660533155628084500"));(* 24, 24 *) +(mk_real_int (num_of_string "5495396336283149374902100")),(mk_real_int (num_of_string "4687638315669344249960665"));(* 24, 24 *) +(mk_real_int (num_of_string "3931747933635968205820844")),(mk_real_int (num_of_string "2771712931061171659900226"));(* 24, 24 *) +(mk_real_int (num_of_string "3510532587420800309052194")),(mk_real_int (num_of_string "2211596659077008563631250"));(* 24, 24 *) +(mk_real_int (num_of_string "2123730420742821853609902")),(mk_real_int (num_of_string "7064299598380154058384000"));(* 24, 24 *) +(mk_real_int (num_of_string "3105063047609196616212480")),(mk_real_int (num_of_string "2365140887350023350218560"));(* 24, 24 *) +(mk_real_int (num_of_string "3064353092092804040987784")),(mk_real_int (num_of_string "2916432603768504021011712"));(* 24, 24 *) +(mk_real_int (num_of_string "2383721772458811758230509")),(mk_real_int (num_of_string "2464945407055935999350025"));(* 24, 24 *) +(mk_real_int (num_of_string "3478411509903167804854575")),(mk_real_int (num_of_string "4562581799306809054901328"));(* 24, 24 *) +(mk_real_int (num_of_string "3621316804577343551566950")),(mk_real_int (num_of_string "2550994550215075643914053"));(* 24, 24 *) +(mk_real_int (num_of_string "1750200282008421731464920")),(mk_real_int (num_of_string "5725458041781646050077524"));(* 24, 24 *) +(mk_real_int (num_of_string "3192468630324760374194409")),(mk_real_int (num_of_string "3403776646428500725809612"));(* 24, 24 *) +(mk_real_int (num_of_string "3417435761634201385811744")),(mk_real_int (num_of_string "2479391179062576469550968"));(* 24, 24 *) +(mk_real_int (num_of_string "5975071497508369324180932")),(mk_real_int (num_of_string "2562568339906846968281410"));(* 24, 24 *) +(mk_real_int (num_of_string "4322874197996914489529226")),(mk_real_int (num_of_string "2947903435531652302048824"));(* 24, 24 *) +(mk_real_int (num_of_string "3190806295090043587472275")),(mk_real_int (num_of_string "3148717815525864571540200"));(* 24, 24 *) +(mk_real_int (num_of_string "2165066039022822385314720")),(mk_real_int (num_of_string "1789667065043536098768516"));(* 24, 24 *) +(mk_real_int (num_of_string "3544217078579404889403632")),(mk_real_int (num_of_string "1719620726900459949129408"));(* 24, 24 *) +(mk_real_int (num_of_string "4975798555669974494894850")),(mk_real_int (num_of_string "2551548992139386318128712"));(* 24, 24 *) +(mk_real_int (num_of_string "4951911396640711363819200")),(mk_real_int (num_of_string "4152301302036776635279512"));(* 24, 24 *) +(mk_real_int (num_of_string "4491288491237901426394272")),(mk_real_int (num_of_string "2631946141755769234538912"));(* 24, 24 *) +(mk_real_int (num_of_string "4545423334511168657484519")),(mk_real_int (num_of_string "4658046691233522803154367"));(* 24, 24 *) +(mk_real_int (num_of_string "1733986131733180992015552")),(mk_real_int (num_of_string "3196517734402713660976740"));(* 24, 24 *) +(mk_real_int (num_of_string "1775683452707085499156708")),(mk_real_int (num_of_string "3769688709694824344064702"));(* 24, 24 *) +(mk_real_int (num_of_string "2294479279699999024839990")),(mk_real_int (num_of_string "3181581126568371503429460"));(* 24, 24 *) +(mk_real_int (num_of_string "3573282858174024051474126")),(mk_real_int (num_of_string "3501097823648368976284480"));(* 24, 24 *) +(mk_real_int (num_of_string "2354093297820505361664576")),(mk_real_int (num_of_string "4232218889714137372079568"));(* 24, 24 *) +(mk_real_int (num_of_string "3975432450689183427293688")),(mk_real_int (num_of_string "3921741171241369802325363"));(* 24, 24 *) +(mk_real_int (num_of_string "1341687685141100305801884")),(mk_real_int (num_of_string "2342899857768319895491602"));(* 24, 24 *) +(mk_real_int (num_of_string "5014715224374016128677892")),(mk_real_int (num_of_string "2247479330116216087862256"));(* 24, 24 *) +(mk_real_int (num_of_string "4794805770310877151740544")),(mk_real_int (num_of_string "5178712808077970014705680"));(* 24, 24 *) +(mk_real_int (num_of_string "3823551335893024713717030")),(mk_real_int (num_of_string "4712396855488429978936416"));(* 24, 24 *) +(mk_real_int (num_of_string "3339610543556138013709239")),(mk_real_int (num_of_string "3460379483248658185637832"));(* 24, 24 *) +(mk_real_int (num_of_string "3126824052272971648254198")),(mk_real_int (num_of_string "2846310197206151567879160"));(* 24, 24 *) +(mk_real_int (num_of_string "4976921386354566978877020")),(mk_real_int (num_of_string "2724190822978858891102368"));(* 24, 24 *) +(mk_real_int (num_of_string "3868322959227720786444990")),(mk_real_int (num_of_string "2834794460530573874620493"));(* 24, 24 *) +(mk_real_int (num_of_string "3806186870542498909262796")),(mk_real_int (num_of_string "1854167532325130096813592"));(* 24, 24 *) +(mk_real_int (num_of_string "2997218349017407762690494")),(mk_real_int (num_of_string "3220146512606107750810221"));(* 24, 24 *) +(mk_real_int (num_of_string "2869447584142557930608694")),(mk_real_int (num_of_string "3214537679931159027199842"));(* 24, 24 *) +(mk_real_int (num_of_string "3505531594393264927150280")),(mk_real_int (num_of_string "2099747502179401595487360"));(* 24, 24 *) +(mk_real_int (num_of_string "2074023604438605921828216")),(mk_real_int (num_of_string "3288064708456254087507120"));(* 24, 24 *) +(mk_real_int (num_of_string "4605341127827031387475758")),(mk_real_int (num_of_string "3384978417362671963599150"));(* 24, 24 *) +(mk_real_int (num_of_string "6803202158448157216759396")),(mk_real_int (num_of_string "3683855794725939882005840"));(* 24, 24 *) +(mk_real_int (num_of_string "3130199101998336679219125")),(mk_real_int (num_of_string "3016851995941040303113438"));(* 24, 24 *) +(mk_real_int (num_of_string "5144222638325352643882421")),(mk_real_int (num_of_string "3369920402699560088045667"));(* 24, 24 *) +(mk_real_int (num_of_string "2712346394363038291983435")),(mk_real_int (num_of_string "6395925068788489550630592"));(* 24, 24 *) +(mk_real_int (num_of_string "3467376684543582559552020")),(mk_real_int (num_of_string "2128208492552431074493350"));(* 24, 24 *) +(mk_real_int (num_of_string "5415148644331751251891200")),(mk_real_int (num_of_string "3866363135314615395252855"));(* 24, 24 *) +(mk_real_int (num_of_string "2836846938576599847191508")),(mk_real_int (num_of_string "3278429679524453150052480"));(* 24, 24 *) +(mk_real_int (num_of_string "4272198351534367270595040")),(mk_real_int (num_of_string "2134330313063458420434960"));(* 24, 24 *) +(mk_real_int (num_of_string "1890763478558507244852000")),(mk_real_int (num_of_string "3403905409782445999494000"));(* 24, 24 *) +(mk_real_int (num_of_string "4012348283800700333242928")),(mk_real_int (num_of_string "1686153041853083191675248"));(* 24, 24 *) +(mk_real_int (num_of_string "3684897676763580922882164")),(mk_real_int (num_of_string "2596997901617597919418810"));(* 24, 24 *) +(mk_real_int (num_of_string "2432860488289906006544240")),(mk_real_int (num_of_string "2199097551229251540807072"));(* 24, 24 *) +(mk_real_int (num_of_string "2219207324705634782651496")),(mk_real_int (num_of_string "3280134834524258413318560"));(* 24, 24 *) +(mk_real_int (num_of_string "4281812610452363858331460")),(mk_real_int (num_of_string "2291827655326688504622284"));(* 24, 24 *) +(mk_real_int (num_of_string "2311301167426197506501838")),(mk_real_int (num_of_string "3428254847018049828189408"));(* 24, 24 *) +(mk_real_int (num_of_string "4106396327950841384544000")),(mk_real_int (num_of_string "1519855021732655091405600"));(* 24, 24 *) +(mk_real_int (num_of_string "4574436248720511522670200")),(mk_real_int (num_of_string "3752666330976676195227630"));(* 24, 24 *) +(mk_real_int (num_of_string "6060088460967430248859520")),(mk_real_int (num_of_string "2751183273513060318370880"));(* 24, 24 *) +(mk_real_int (num_of_string "5936652774963812405375000")),(mk_real_int (num_of_string "1934307048092504193486300"));(* 24, 24 *) +(mk_real_int (num_of_string "2966282780968813768296120")),(mk_real_int (num_of_string "4554330723537599733523816"));(* 24, 24 *) +(mk_real_int (num_of_string "4066034642911280512435200")),(mk_real_int (num_of_string "3182582607381827923268520"));(* 24, 24 *) +(mk_real_int (num_of_string "3563570100200781569985000")),(mk_real_int (num_of_string "4251922123057236845557620"));(* 24, 24 *) +(mk_real_int (num_of_string "4165625658592128432921520")),(mk_real_int (num_of_string "3181323461627667361337648"));(* 24, 24 *) +(mk_real_int (num_of_string "3490972371192151507271296")),(mk_real_int (num_of_string "3514970213076356218280460"));(* 24, 24 *) +(mk_real_int (num_of_string "2852044109793304237709040")),(mk_real_int (num_of_string "2671977203273762349360360"));(* 24, 24 *) +(mk_real_int (num_of_string "3915334439659948711843346")),(mk_real_int (num_of_string "5956897025974722583452150"));(* 24, 24 *) +(mk_real_int (num_of_string "4313158434068389266139968")),(mk_real_int (num_of_string "2653805462158669944348384"));(* 24, 24 *) +(mk_real_int (num_of_string "2754336596780610471421350")),(mk_real_int (num_of_string "2772300369425996824797690"));(* 24, 24 *) +(mk_real_int (num_of_string "4905620798835419319401472")),(mk_real_int (num_of_string "2857332698454377916692480"));(* 24, 24 *) +(mk_real_int (num_of_string "2532069156823170882274560")),(mk_real_int (num_of_string "1379564442693197304033504"));(* 24, 24 *) +(mk_real_int (num_of_string "4947971569340910625685632")),(mk_real_int (num_of_string "5178758091567081706175334"));(* 24, 24 *) +(mk_real_int (num_of_string "4668751225864626203800981")),(mk_real_int (num_of_string "3545390797653050605725000"));(* 24, 24 *) +(mk_real_int (num_of_string "3515238210071573298488000")),(mk_real_int (num_of_string "3917771747980800228227709"));(* 24, 24 *) +(mk_real_int (num_of_string "3974260796924945298942540")),(mk_real_int (num_of_string "2675047863492134070751200"));(* 24, 24 *) +(mk_real_int (num_of_string "2701212383544604571433000")),(mk_real_int (num_of_string "2551105824986287552061950"));(* 24, 24 *) +(mk_real_int (num_of_string "3353097986611672900839282")),(mk_real_int (num_of_string "2242020391999505588419795"));(* 24, 24 *) +(mk_real_int (num_of_string "3064771028334398285413588")),(mk_real_int (num_of_string "3572998177272916435359680"));(* 24, 24 *) +(mk_real_int (num_of_string "3090781458062850904665939")),(mk_real_int (num_of_string "6946037168952791997500820"));(* 24, 24 *) +(mk_real_int (num_of_string "3572522167547604940352036")),(mk_real_int (num_of_string "4400456166147890886739344"));(* 24, 24 *) +(mk_real_int (num_of_string "2564895552099059502603720")),(mk_real_int (num_of_string "2363657410040192228447616"));(* 24, 24 *) +(mk_real_int (num_of_string "2435295010923027695176050")),(mk_real_int (num_of_string "2658879763930517002525440"));(* 24, 24 *) +(mk_real_int (num_of_string "3731986736282107605541376")),(mk_real_int (num_of_string "3643683257180774788982430"));(* 24, 24 *) +(mk_real_int (num_of_string "1934859277092254036885040")),(mk_real_int (num_of_string "6830307149849087499930362"));(* 24, 24 *) +(mk_real_int (num_of_string "2530144512121302228105430")),(mk_real_int (num_of_string "3337809587674217377166110"));(* 24, 24 *) +(mk_real_int (num_of_string "2390987582050522765833864")),(mk_real_int (num_of_string "2128950082119999634279368"));(* 24, 24 *) +(mk_real_int (num_of_string "1801877367436339432206240")),(mk_real_int (num_of_string "3123699200575804967141250"));(* 24, 24 *) +(mk_real_int (num_of_string "5466441655140846553078560")),(mk_real_int (num_of_string "1788617313593277909631344"));(* 24, 24 *) +(mk_real_int (num_of_string "2465087542211644211511870")),(mk_real_int (num_of_string "2615739313857496973491611"));(* 24, 24 *) +(mk_real_int (num_of_string "2953522074969932903774700")),(mk_real_int (num_of_string "4096063849122441554820000"));(* 24, 24 *) +(mk_real_int (num_of_string "2007145459097460241272600")),(mk_real_int (num_of_string "4162541767252076451830580"));(* 24, 24 *) +(mk_real_int (num_of_string "5430888892585395778267350")),(mk_real_int (num_of_string "4324249558881214572718640"));(* 24, 24 *) +(mk_real_int (num_of_string "2775835639167828427319250")),(mk_real_int (num_of_string "4725201745868974509328920"));(* 24, 24 *) +(mk_real_int (num_of_string "7224027538697433660753492")),(mk_real_int (num_of_string "2517044131010981715888873"));(* 24, 24 *) +(mk_real_int (num_of_string "3913987572409201599526896")),(mk_real_int (num_of_string "1391277403447889718473664"));(* 24, 24 *) +(mk_real_int (num_of_string "5032898552919662361402720")),(mk_real_int (num_of_string "3325621987638880759116000"));(* 24, 24 *) +(mk_real_int (num_of_string "1996616622819610598163480")),(mk_real_int (num_of_string "1621650060828807618513320"));(* 24, 24 *) +(mk_real_int (num_of_string "2651027604103717379135625")),(mk_real_int (num_of_string "3629240399070136919377600"));(* 24, 24 *) +(mk_real_int (num_of_string "1784725554808080858425358")),(mk_real_int (num_of_string "1980789758144140075714355"));(* 24, 24 *) +(mk_real_int (num_of_string "3118705154749481776946467")),(mk_real_int (num_of_string "1941656404556598716235952"));(* 24, 24 *) +(mk_real_int (num_of_string "1949365175707955575849752")),(mk_real_int (num_of_string "3773979470855669631283728"));(* 24, 24 *) +(mk_real_int (num_of_string "3385073197846140097479000")),(mk_real_int (num_of_string "2165264053676023708262400"));(* 24, 24 *) +(mk_real_int (num_of_string "4594810229909494948983084")),(mk_real_int (num_of_string "4203883076566568653677356"));(* 24, 24 *) +(mk_real_int (num_of_string "3563798935728332031302304")),(mk_real_int (num_of_string "3606496318464501687608184"));(* 24, 24 *) +(mk_real_int (num_of_string "2143597071358191602034000")),(mk_real_int (num_of_string "6979131304638593073200664"));(* 24, 24 *) +(mk_real_int (num_of_string "3136507206814624511714340")),(mk_real_int (num_of_string "1824724051223353798551110"));(* 24, 24 *) +(mk_real_int (num_of_string "3239893738685445736594392")),(mk_real_int (num_of_string "5105726599313502896104800"));(* 24, 24 *) +(mk_real_int (num_of_string "3821515089222452989796352")),(mk_real_int (num_of_string "5119791707001722420914272"));(* 24, 24 *) +(mk_real_int (num_of_string "2604459407217387601892400")),(mk_real_int (num_of_string "4097463128007138284215128"));(* 24, 24 *) +(mk_real_int (num_of_string "3071435380663325913873240")),(mk_real_int (num_of_string "1633083507453268989198080"));(* 24, 24 *) +(mk_real_int (num_of_string "2408028822735649773240240")),(mk_real_int (num_of_string "3396584272586694967004430"));(* 24, 24 *) +(mk_real_int (num_of_string "2202383548466759613276480")),(mk_real_int (num_of_string "3374626785030251185529600"));(* 24, 24 *) +(mk_real_int (num_of_string "2291900767057913983502700")),(mk_real_int (num_of_string "3442712976445079361024000"));(* 24, 24 *) +(mk_real_int (num_of_string "2608094721815726160536415")),(mk_real_int (num_of_string "2997568460560585187836800"));(* 24, 24 *) +(mk_real_int (num_of_string "2800746642903629405947928")),(mk_real_int (num_of_string "5235065231624031939922500"));(* 24, 24 *) +(mk_real_int (num_of_string "2692342941442729015836360")),(mk_real_int (num_of_string "2957783908800553055719920"));(* 24, 24 *) +(mk_real_int (num_of_string "2746818435345676723357480")),(mk_real_int (num_of_string "2003512507767009856539648"));(* 24, 24 *) +(mk_real_int (num_of_string "3426450617089113528226680")),(mk_real_int (num_of_string "3582442592579029895321232"));(* 24, 24 *) +(mk_real_int (num_of_string "2733962034727774885573904")),(mk_real_int (num_of_string "2109663267100626537887454"));(* 24, 24 *) +(mk_real_int (num_of_string "2506066568383585307554944")),(mk_real_int (num_of_string "2709498947876642778115980"));(* 24, 24 *) +(mk_real_int (num_of_string "3676438365709094379647110")),(mk_real_int (num_of_string "4102234807436038571659984"));(* 24, 24 *) +(mk_real_int (num_of_string "3629991651433849053255420")),(mk_real_int (num_of_string "2315754679208992475234196"));(* 24, 24 *) +(mk_real_int (num_of_string "3302943359998991947853035")),(mk_real_int (num_of_string "3972495889006573344354120"));(* 24, 24 *) +(mk_real_int (num_of_string "4447984875021248628557184")),(mk_real_int (num_of_string "2256959201265717332757100"));(* 24, 24 *) +(mk_real_int (num_of_string "3547915725957155260591000")),(mk_real_int (num_of_string "4637693516349085976448504"));(* 24, 24 *) +(mk_real_int (num_of_string "4885058929587272510872080")),(mk_real_int (num_of_string "2205807580605573714657048"));(* 24, 24 *) +(mk_real_int (num_of_string "3046909431989449693524424")),(mk_real_int (num_of_string "3205859539520201431193088"));(* 24, 24 *) +(mk_real_int (num_of_string "2736270340853886359125425")),(mk_real_int (num_of_string "2332015519572934570163550"));(* 24, 24 *) +(mk_real_int (num_of_string "4691776065946488723080820")),(mk_real_int (num_of_string "1852736962489000947106560"));(* 24, 24 *) +(mk_real_int (num_of_string "3679791072298926681351060")),(mk_real_int (num_of_string "2751063087953713328195330"));(* 24, 24 *) +(mk_real_int (num_of_string "2715598523559576544607280")),(mk_real_int (num_of_string "2946284354139227479719100"));(* 24, 24 *) +(mk_real_int (num_of_string "1738629892567591488552000")),(mk_real_int (num_of_string "2585159385992904535904880"));(* 24, 24 *) +(mk_real_int (num_of_string "1869199790605948431590400")),(mk_real_int (num_of_string "3691728317294819359467510"));(* 24, 24 *) +(mk_real_int (num_of_string "3634789546718695326719572")),(mk_real_int (num_of_string "3158183305756271031892660"));(* 24, 24 *) +(mk_real_int (num_of_string "1642203387466459407921858")),(mk_real_int (num_of_string "3198646640837524650170380"));(* 24, 24 *) +(mk_real_int (num_of_string "2060683897536347475002100")),(mk_real_int (num_of_string "2304489361448693626937460"));(* 24, 24 *) +(mk_real_int (num_of_string "1888771412055086518326822")),(mk_real_int (num_of_string "3050080131747772156432504"));(* 24, 24 *) +(mk_real_int (num_of_string "3897131325410782390735516")),(mk_real_int (num_of_string "2475879597754217034629276"));(* 24, 24 *) +(mk_real_int (num_of_string "5305078937997422088047802")),(mk_real_int (num_of_string "4235329055092652560927026"));(* 24, 24 *) +(mk_real_int (num_of_string "4054974424515820472761500")),(mk_real_int (num_of_string "2232712380835275783080640"));(* 24, 24 *) +(mk_real_int (num_of_string "1559172550876776052986000")),(mk_real_int (num_of_string "4749112378847404364589551"));(* 24, 24 *) +(mk_real_int (num_of_string "1790552615612520240102972")),(mk_real_int (num_of_string "4024826997451796555365962"));(* 24, 24 *) +(mk_real_int (num_of_string "1676409283820706142879080")),(mk_real_int (num_of_string "1428505169975437471362180"));(* 24, 24 *) +(mk_real_int (num_of_string "2798048096194626424919160")),(mk_real_int (num_of_string "2275387859016418545818784"));(* 24, 24 *) +(mk_real_int (num_of_string "4594577339109149706833430")),(mk_real_int (num_of_string "6286523530824598250451744"));(* 24, 24 *) +(mk_real_int (num_of_string "2047856158161286275988976")),(mk_real_int (num_of_string "1372491351879079050281520"));(* 24, 24 *) +(mk_real_int (num_of_string "2272701095435371557326292")),(mk_real_int (num_of_string "1891801762948279865902500"));(* 24, 24 *) +(mk_real_int (num_of_string "2088080990826796594296000")),(mk_real_int (num_of_string "2412734355552828425497920"));(* 24, 24 *) +(mk_real_int (num_of_string "2619499284958867049663364")),(mk_real_int (num_of_string "1998132074159230881089136"));(* 24, 24 *) +(mk_real_int (num_of_string "2202606038617879807824696")),(mk_real_int (num_of_string "2875129356329763033213440"));(* 24, 24 *) +(mk_real_int (num_of_string "3751025457380535643995268")),(mk_real_int (num_of_string "2280620215677807588215340"));(* 24, 24 *) +(mk_real_int (num_of_string "3233260288564450132408962")),(mk_real_int (num_of_string "2359331533321344355832289"));(* 24, 24 *) +(mk_real_int (num_of_string "2531580631019444262671802")),(mk_real_int (num_of_string "3720280731378367896886140"));(* 24, 24 *) +(mk_real_int (num_of_string "4515613893682141131342720")),(mk_real_int (num_of_string "3190438265675381006404140"));(* 24, 24 *) +(mk_real_int (num_of_string "3627734701866734970700224")),(mk_real_int (num_of_string "3887561562117260064176370"));(* 24, 24 *) +(mk_real_int (num_of_string "1868530721231120446447830")),(mk_real_int (num_of_string "4643932256947155223048600"));(* 24, 24 *) +(mk_real_int (num_of_string "3390651387660244658744718")),(mk_real_int (num_of_string "2423394689663933959290912"));(* 24, 24 *) +(mk_real_int (num_of_string "3740820130346018563688040")),(mk_real_int (num_of_string "4053452359105539233073240"));(* 24, 24 *) +(mk_real_int (num_of_string "4853202037717698240386454")),(mk_real_int (num_of_string "3430849713991211965605570"));(* 24, 24 *) +(mk_real_int (num_of_string "3893553184531953148538328")),(mk_real_int (num_of_string "3764437614700390789885920"));(* 24, 24 *) +(mk_real_int (num_of_string "1673387528743561482115498")),(mk_real_int (num_of_string "3462548317193169742921560"));(* 24, 24 *) +(mk_real_int (num_of_string "2445619810118824006215114")),(mk_real_int (num_of_string "4201561844549768760127638"));(* 24, 24 *) +(mk_real_int (num_of_string "2970425520237593922545664")),(mk_real_int (num_of_string "4606446474553038802420608"));(* 24, 24 *) +(mk_real_int (num_of_string "1735666746975335174900700")),(mk_real_int (num_of_string "2641374039165613557831774"));(* 24, 24 *) +(mk_real_int (num_of_string "3026272042331624287411860")),(mk_real_int (num_of_string "5135990406166036535818980"));(* 24, 24 *) +(mk_real_int (num_of_string "3033974370556022474575575")),(mk_real_int (num_of_string "5886116732637780706944360"));(* 24, 24 *) +(mk_real_int (num_of_string "2122881279758065543333960")),(mk_real_int (num_of_string "5856429326067594260110204"));(* 24, 24 *) +(mk_real_int (num_of_string "1865635784241405149280300")),(mk_real_int (num_of_string "3887764710200833500348216"));(* 24, 24 *) +(mk_real_int (num_of_string "2108194656482894539381185")),(mk_real_int (num_of_string "3024041889238453856991960"));(* 24, 24 *) +(mk_real_int (num_of_string "3614379219401015912378130")),(mk_real_int (num_of_string "3961540502990981756890408"));(* 24, 24 *) +(mk_real_int (num_of_string "3626568755889394780597552")),(mk_real_int (num_of_string "3949093464761248758416250"));(* 24, 24 *) +(mk_real_int (num_of_string "2478390039500999658674640")),(mk_real_int (num_of_string "2357727475594350036125760"));(* 24, 24 *) +(mk_real_int (num_of_string "3218672705940127925553000")),(mk_real_int (num_of_string "3860417960803560852809835"));(* 24, 24 *) +(mk_real_int (num_of_string "2926026705208510992755130")),(mk_real_int (num_of_string "3457560015663836867346870"));(* 24, 24 *) +(mk_real_int (num_of_string "4301205337630414230219720")),(mk_real_int (num_of_string "3327174911143264219419120"));(* 24, 24 *) +(mk_real_int (num_of_string "5236192768636957219783760")),(mk_real_int (num_of_string "3010787240856020340604000"));(* 24, 24 *) +(mk_real_int (num_of_string "1885120553390417918308160")),(mk_real_int (num_of_string "2550787151042836114498242"));(* 24, 24 *) +(mk_real_int (num_of_string "4564186474411868104657152")),(mk_real_int (num_of_string "3503049259248220121164872"));(* 24, 24 *) +(mk_real_int (num_of_string "2382581727931448516403000")),(mk_real_int (num_of_string "2020977086719348777938048"));(* 24, 24 *) +(mk_real_int (num_of_string "5915103627656378999460600")),(mk_real_int (num_of_string "2806961531095398725277300"));(* 24, 24 *) +(mk_real_int (num_of_string "6525402984399687376816920")),(mk_real_int (num_of_string "3654347645423727413567076"));(* 24, 24 *) +(mk_real_int (num_of_string "3144703351003709087150280")),(mk_real_int (num_of_string "2344972170860439370339830"));(* 24, 24 *) +(mk_real_int (num_of_string "4812615225330234437627883")),(mk_real_int (num_of_string "2917506997467823601328327"));(* 24, 24 *) +(mk_real_int (num_of_string "2422397336199441953574144")),(mk_real_int (num_of_string "1626921422339370742417176"));(* 24, 24 *) +(mk_real_int (num_of_string "4026702186345047070786320")),(mk_real_int (num_of_string "5446345995936324423495408"));(* 24, 24 *) +(mk_real_int (num_of_string "2667697884083368771777450")),(mk_real_int (num_of_string "3587707657123288925963410"));(* 24, 24 *) +(mk_real_int (num_of_string "1713319013545625898372582")),(mk_real_int (num_of_string "4281602692194806127168123"));(* 24, 24 *) +(mk_real_int (num_of_string "2566290672711815464685234")),(mk_real_int (num_of_string "4628801339116994466175544"));(* 24, 24 *) +(mk_real_int (num_of_string "6313355811154487015372998")),(mk_real_int (num_of_string "2922341255059162599784400"));(* 24, 24 *) +(mk_real_int (num_of_string "2530659684551571264740328")),(mk_real_int (num_of_string "3164617218010839733177932"));(* 24, 24 *) +(mk_real_int (num_of_string "4042288306038832178218596")),(mk_real_int (num_of_string "5196659467674369792664896"));(* 24, 24 *) +(mk_real_int (num_of_string "2905240152738828329469000")),(mk_real_int (num_of_string "3567822275310227822653290"));(* 24, 24 *) +(mk_real_int (num_of_string "2658391705322346278149176")),(mk_real_int (num_of_string "4222727720477057686033622"));(* 24, 24 *) +(mk_real_int (num_of_string "4057774310915319912206418")),(mk_real_int (num_of_string "2187291211741654447444416"));(* 24, 24 *) +(mk_real_int (num_of_string "3930351646133475447251760")),(mk_real_int (num_of_string "3397285376426760702847260"));(* 24, 24 *) +(mk_real_int (num_of_string "3201396531435436973595075")),(mk_real_int (num_of_string "2100340161704413703517282"));(* 24, 24 *) +(mk_real_int (num_of_string "3011607028932051530386644")),(mk_real_int (num_of_string "3171372046227668310177024"));(* 24, 24 *) +(mk_real_int (num_of_string "4861531423666840288544350")),(mk_real_int (num_of_string "3968601892175320931232870"));(* 24, 24 *) +(mk_real_int (num_of_string "5976530243446371838091786")),(mk_real_int (num_of_string "2808401559914129988625552"));(* 24, 24 *) +(mk_real_int (num_of_string "3037856780650139925913800")),(mk_real_int (num_of_string "3546633262761072290008720"));(* 24, 24 *) +(mk_real_int (num_of_string "4028754100841399278950480")),(mk_real_int (num_of_string "2178473160142295476944890"));(* 24, 24 *) +(mk_real_int (num_of_string "2164356730123805226531194")),(mk_real_int (num_of_string "1652312733001554033643850"));(* 24, 24 *) +(mk_real_int (num_of_string "2009603752212967818177152")),(mk_real_int (num_of_string "2600702467280483393597000"));(* 24, 24 *) +(mk_real_int (num_of_string "1858816711761863447881149")),(mk_real_int (num_of_string "2749083947469050460183000"));(* 24, 24 *) +(mk_real_int (num_of_string "3175485625695642428431328")),(mk_real_int (num_of_string "2590737316460059431503440"));(* 24, 24 *) +(mk_real_int (num_of_string "2438800342808051710289830")),(mk_real_int (num_of_string "2666832628731302546500237"));(* 24, 24 *) +(mk_real_int (num_of_string "2080571740698196759640075")),(mk_real_int (num_of_string "2767797394930381955155560"));(* 24, 24 *) +(mk_real_int (num_of_string "3704382715070758242608112")),(mk_real_int (num_of_string "3502369547219471185004100"));(* 24, 24 *) +(mk_real_int (num_of_string "4281763083713158732855790")),(mk_real_int (num_of_string "2355216972911223538561416"));(* 24, 24 *) +(mk_real_int (num_of_string "2045511049684050795484400")),(mk_real_int (num_of_string "3155340364118630887209520"));(* 24, 24 *) +(mk_real_int (num_of_string "3182511375935478640171026")),(mk_real_int (num_of_string "4312006461736963272548314"));(* 24, 24 *) +(mk_real_int (num_of_string "2148860809769156082522768")),(mk_real_int (num_of_string "3257592881455191116306700"));(* 24, 24 *) +(mk_real_int (num_of_string "2785059991856346651564855")),(mk_real_int (num_of_string "3007341915428953703268080"));(* 24, 24 *) +(mk_real_int (num_of_string "1379222760901918934531520")),(mk_real_int (num_of_string "3171893051246254647846828"));(* 24, 24 *) +(mk_real_int (num_of_string "2979687229721903911094280")),(mk_real_int (num_of_string "2905103357150715743589000"));(* 24, 24 *) +(mk_real_int (num_of_string "3336388672393549661802375")),(mk_real_int (num_of_string "3090434288166512562368000"));(* 24, 24 *) +(mk_real_int (num_of_string "1649812639647223418619720")),(mk_real_int (num_of_string "2143524694423637251043037"));(* 24, 24 *) +(mk_real_int (num_of_string "2876560826294331046927452")),(mk_real_int (num_of_string "2308523552466662120534433"));(* 24, 24 *) +(mk_real_int (num_of_string "1191353355500004310833765")),(mk_real_int (num_of_string "3027315373760144230235920"));(* 24, 24 *) +(mk_real_int (num_of_string "3065396965211547677640492")),(mk_real_int (num_of_string "2238004268352446753204736"));(* 24, 24 *) +(mk_real_int (num_of_string "2900450928959289384637062")),(mk_real_int (num_of_string "2426441008472380165747728"));(* 24, 24 *) +(mk_real_int (num_of_string "7407449026844002623338880")),(mk_real_int (num_of_string "2127205942262211941701824"));(* 24, 24 *) +(mk_real_int (num_of_string "3703893579446695382275000")),(mk_real_int (num_of_string "4196802839229934715355912"));(* 24, 24 *) +(mk_real_int (num_of_string "2805981628673246534701344")),(mk_real_int (num_of_string "1799081531155596443082390"));(* 24, 24 *) +(mk_real_int (num_of_string "5843010404023574503255225")),(mk_real_int (num_of_string "2671322857651759770345915"));(* 24, 24 *) +(mk_real_int (num_of_string "4346850707619923500298178")),(mk_real_int (num_of_string "3122188681319209915024388"));(* 24, 24 *) +(mk_real_int (num_of_string "2024152162990612466884864")),(mk_real_int (num_of_string "2418033742705899520797075"));(* 24, 24 *) +(mk_real_int (num_of_string "1807637311253118257884062")),(mk_real_int (num_of_string "5943159214533643591925820"));(* 24, 24 *) +(mk_real_int (num_of_string "3295485786398298873540538")),(mk_real_int (num_of_string "3757220501449259702343600"));(* 24, 24 *) +(mk_real_int (num_of_string "3025261572744227085898496")),(mk_real_int (num_of_string "2922157373168618505237681"));(* 24, 24 *) +(mk_real_int (num_of_string "3014109359934091224419250")),(mk_real_int (num_of_string "4029119529490816972725472"));(* 24, 24 *) +(mk_real_int (num_of_string "4811548061896982993541888")),(mk_real_int (num_of_string "2667701466191417956564160"));(* 24, 24 *) +(mk_real_int (num_of_string "3011072478149365414884036")),(mk_real_int (num_of_string "1520441543283610140078304"));(* 24, 24 *) +(mk_real_int (num_of_string "1649578174700693390933040")),(mk_real_int (num_of_string "2429639618240216205072040"));(* 24, 24 *) +(mk_real_int (num_of_string "4701088509797559635203170")),(mk_real_int (num_of_string "2425638879806675329379520"));(* 24, 24 *) +(mk_real_int (num_of_string "3971840775495799053319056")),(mk_real_int (num_of_string "3599060596825347856564880"));(* 24, 24 *) +(mk_real_int (num_of_string "3518100912653238833339400")),(mk_real_int (num_of_string "2895088949394456720074325"));(* 24, 24 *) +(mk_real_int (num_of_string "2628521626683933352604166")),(mk_real_int (num_of_string "2770783135022712680713700"));(* 24, 24 *) +(mk_real_int (num_of_string "4215223219124847774213432")),(mk_real_int (num_of_string "3960512374456688617792200"));(* 24, 24 *) +(mk_real_int (num_of_string "3905001987762139435894500")),(mk_real_int (num_of_string "4192062835824792632903667"));(* 24, 24 *) +(mk_real_int (num_of_string "1890337315212195368182140")),(mk_real_int (num_of_string "5278460138594444052424800"));(* 24, 24 *) +(mk_real_int (num_of_string "3231688089598373660453600")),(mk_real_int (num_of_string "4403389468863279172421920"));(* 24, 24 *) +(mk_real_int (num_of_string "3472817674451349037450780")),(mk_real_int (num_of_string "3078501757646961566683140"));(* 24, 24 *) +(mk_real_int (num_of_string "3463845899848181254603152")),(mk_real_int (num_of_string "4929093222946325442909237"));(* 24, 24 *) +(mk_real_int (num_of_string "6519892936247810746253900")),(mk_real_int (num_of_string "1807076487940984433594220"));(* 24, 24 *) +(mk_real_int (num_of_string "1798002285636790737466688")),(mk_real_int (num_of_string "4910354225449337382747840"));(* 24, 24 *) +(mk_real_int (num_of_string "1428826417781212539327168")),(mk_real_int (num_of_string "2442479009528224611646272"));(* 24, 24 *) +(mk_real_int (num_of_string "5319906065106604303679165")),(mk_real_int (num_of_string "4698923998881181913686480"));(* 24, 24 *) +(mk_real_int (num_of_string "2985721174205796690930084")),(mk_real_int (num_of_string "4524873621275492702153266"));(* 24, 24 *) +(mk_real_int (num_of_string "4365811451604304886108463")),(mk_real_int (num_of_string "1260814541858732426406152"));(* 24, 24 *) +(mk_real_int (num_of_string "4020081761352521578433104")),(mk_real_int (num_of_string "3166061522253896060283951"));(* 24, 24 *) +(mk_real_int (num_of_string "2010861224094962044902096")),(mk_real_int (num_of_string "3838485308854525397125380"));(* 24, 24 *) +(mk_real_int (num_of_string "5229805454779102249565576")),(mk_real_int (num_of_string "2154268145376919020470400"));(* 24, 24 *) +(mk_real_int (num_of_string "2764782868627789208875944")),(mk_real_int (num_of_string "3138250561369443620084409"));(* 24, 24 *) +(mk_real_int (num_of_string "2141731053643805648027760")),(mk_real_int (num_of_string "1632127961024157699712891"));(* 24, 24 *) +(mk_real_int (num_of_string "3421094153011726233918528")),(mk_real_int (num_of_string "3121854631753091190354724"));(* 24, 24 *) +(mk_real_int (num_of_string "2415059991508058990869200")),(mk_real_int (num_of_string "4192772906070206883710973"));(* 24, 24 *) +(mk_real_int (num_of_string "3996546100300498874099580")),(mk_real_int (num_of_string "5205644676672384546184236"));(* 24, 24 *) +(mk_real_int (num_of_string "2666899766142088222106240")),(mk_real_int (num_of_string "1632306583078964612553456"));(* 24, 24 *) +(mk_real_int (num_of_string "6459242516486355883355640")),(mk_real_int (num_of_string "6276571472060575884175185"));(* 24, 24 *) +(mk_real_int (num_of_string "1687509026574079923829170")),(mk_real_int (num_of_string "1923112223134436728420547"));(* 24, 24 *) +(mk_real_int (num_of_string "3163262230947776642934139")),(mk_real_int (num_of_string "2543292912878765499873120"));(* 24, 24 *) +(mk_real_int (num_of_string "4367276553131859544455168")),(mk_real_int (num_of_string "2496547690526169727662288"));(* 24, 24 *) +(mk_real_int (num_of_string "2243242227009436100754125")),(mk_real_int (num_of_string "2902244669695548440427570"));(* 24, 24 *) +(mk_real_int (num_of_string "4677512265762453505082070")),(mk_real_int (num_of_string "4880050733488480288001199"));(* 24, 24 *) +(mk_real_int (num_of_string "4375760510193640653585216")),(mk_real_int (num_of_string "5679350324832156615321444"));(* 24, 24 *) +(mk_real_int (num_of_string "2315362924942702171459052")),(mk_real_int (num_of_string "3739207362885741670111972"));(* 24, 24 *) +(mk_real_int (num_of_string "2177231599956901628136870")),(mk_real_int (num_of_string "6064774723780636074099840"));(* 24, 24 *) +(mk_real_int (num_of_string "3905594325851099814691200")),(mk_real_int (num_of_string "4949707425592787431332864"));(* 24, 24 *) +(mk_real_int (num_of_string "4263740091149568585664080")),(mk_real_int (num_of_string "3022586806214784348753696"));(* 24, 24 *) +(mk_real_int (num_of_string "2380714731233323097564850")),(mk_real_int (num_of_string "2185945903415184001502400"));(* 24, 24 *) +(mk_real_int (num_of_string "4202529072886683880119706")),(mk_real_int (num_of_string "3284397421662576595245396"));(* 24, 24 *) +(mk_real_int (num_of_string "1934025869291452072744608")),(mk_real_int (num_of_string "2965657588650504380660724"));(* 24, 24 *) +(mk_real_int (num_of_string "2390748531039718716619890")),(mk_real_int (num_of_string "2821104894083978774737280"));(* 24, 24 *) +(mk_real_int (num_of_string "2697050299548414218174958")),(mk_real_int (num_of_string "2671222165732893376555380"));(* 24, 24 *) +(mk_real_int (num_of_string "3126161655981094216282902")),(mk_real_int (num_of_string "6973365209997825543172500"));(* 24, 24 *) +(mk_real_int (num_of_string "2666926172336290770536380")),(mk_real_int (num_of_string "4834759765829616590402862"));(* 24, 24 *) +(mk_real_int (num_of_string "2100947464183064996301360")),(mk_real_int (num_of_string "2394828487191656264297472"));(* 24, 24 *) +(mk_real_int (num_of_string "2079826568717690819582720")),(mk_real_int (num_of_string "5297237044842862783242656"));(* 24, 24 *) +(mk_real_int (num_of_string "3836154727066700872993904")),(mk_real_int (num_of_string "3706471411229943249872460"));(* 24, 24 *) +(mk_real_int (num_of_string "5325350621021905854685900")),(mk_real_int (num_of_string "3141209172193411438368263"));(* 24, 24 *) +(mk_real_int (num_of_string "4535053885364909492266974")),(mk_real_int (num_of_string "3611640051656072980748568"));(* 24, 24 *) +(mk_real_int (num_of_string "3888336370488591939239980")),(mk_real_int (num_of_string "2089775516962169584447848"));(* 24, 24 *) +(mk_real_int (num_of_string "3577550486188165157031840")),(mk_real_int (num_of_string "3943759759250199237584400"));(* 24, 24 *) +(mk_real_int (num_of_string "4305849788505839642123784")),(mk_real_int (num_of_string "2055652000553913508311296"));(* 24, 24 *) +(mk_real_int (num_of_string "4865502935017285132872735")),(mk_real_int (num_of_string "2428499045404614177525600"));(* 24, 24 *) +(mk_real_int (num_of_string "1971317612533365792311040")),(mk_real_int (num_of_string "3193210724635212199652241"));(* 24, 24 *) +(mk_real_int (num_of_string "1764488215405595470985040")),(mk_real_int (num_of_string "1826383701772883242024546"));(* 24, 24 *) +(mk_real_int (num_of_string "2658713677549105034040000")),(mk_real_int (num_of_string "4463341131810757742736036"));(* 24, 24 *) +(mk_real_int (num_of_string "2443168311218583662921328")),(mk_real_int (num_of_string "2245767819105194944232520"));(* 24, 24 *) +(mk_real_int (num_of_string "2360749817479949727397720")),(mk_real_int (num_of_string "4698220348763252846799880"));(* 24, 24 *) +(mk_real_int (num_of_string "1652999324424845565340785")),(mk_real_int (num_of_string "2008939231284937541199456"));(* 24, 24 *) +(mk_real_int (num_of_string "2033564618823410903856192")),(mk_real_int (num_of_string "3372930820294031227527088"));(* 24, 24 *) +(mk_real_int (num_of_string "2917069087635731282730300")),(mk_real_int (num_of_string "4244070806362014955710378"));(* 24, 24 *) +(mk_real_int (num_of_string "3613429680971503238575251")),(mk_real_int (num_of_string "3893844138422640879834280"));(* 24, 24 *) +(mk_real_int (num_of_string "2874075866860907186409540")),(mk_real_int (num_of_string "4705582682344355049640941"));(* 24, 24 *) +(mk_real_int (num_of_string "2273888711090849073746694")),(mk_real_int (num_of_string "3924054181765156318423500"));(* 24, 24 *) +(mk_real_int (num_of_string "2817834190824438230936400")),(mk_real_int (num_of_string "2204531181670965099956685"));(* 24, 24 *) +(mk_real_int (num_of_string "2735289648231979117428765")),(mk_real_int (num_of_string "2288778068627138959002000"));(* 24, 24 *) +(mk_real_int (num_of_string "3178456944443197491838000")),(mk_real_int (num_of_string "3745293109002685629188720"));(* 24, 24 *) +(mk_real_int (num_of_string "4079392936412486461744800")),(mk_real_int (num_of_string "3992941547256682847420880"));(* 24, 24 *) +(mk_real_int (num_of_string "4885812873662085989091000")),(mk_real_int (num_of_string "5397362548999139173774080"));(* 24, 24 *) +(mk_real_int (num_of_string "2258145203451770220023100")),(mk_real_int (num_of_string "4291031872388514266195104"));(* 24, 24 *) +(mk_real_int (num_of_string "5436440159669669069304000")),(mk_real_int (num_of_string "3523213160714169416462997"));(* 24, 24 *) +(mk_real_int (num_of_string "3375201219791203812680388")),(mk_real_int (num_of_string "2187254970040432587317000"));(* 24, 24 *) +(mk_real_int (num_of_string "2353860220383035041373055")),(mk_real_int (num_of_string "4896520136927559425413930"));(* 24, 24 *) +(mk_real_int (num_of_string "2552863451559708220629158")),(mk_real_int (num_of_string "3143596093627464364940295"));(* 24, 24 *) +(mk_real_int (num_of_string "2758512397510815559967808")),(mk_real_int (num_of_string "4859094233483659062596232"));(* 24, 24 *) +(mk_real_int (num_of_string "5214950997916200229144800")),(mk_real_int (num_of_string "4104101067057021830132176"));(* 24, 24 *) +(mk_real_int (num_of_string "2036497145970722836279704")),(mk_real_int (num_of_string "5206535027548412824214940"));(* 24, 24 *) +(mk_real_int (num_of_string "2339859801385345879476000")),(mk_real_int (num_of_string "1878231441943334830535775"));(* 24, 24 *) +(mk_real_int (num_of_string "2750676552087875353648832")),(mk_real_int (num_of_string "3183926732101107577250400"));(* 24, 24 *) +(mk_real_int (num_of_string "4096137656275559159373248")),(mk_real_int (num_of_string "2036957940931695831086271"));(* 24, 24 *) +(mk_real_int (num_of_string "2243017424363424509081120")),(mk_real_int (num_of_string "2250814318972608210950700"));(* 24, 24 *) +(mk_real_int (num_of_string "3633254407265459251144588")),(mk_real_int (num_of_string "1876053551069278734975636"));(* 24, 24 *) +(mk_real_int (num_of_string "2969317672686392492952864")),(mk_real_int (num_of_string "3997218538187092313865000"));(* 24, 24 *) +(mk_real_int (num_of_string "4175896879680397218950400")),(mk_real_int (num_of_string "4504177595952207436140130"));(* 24, 24 *) +(mk_real_int (num_of_string "2611932920231236676249955")),(mk_real_int (num_of_string "1719236338818801480217344"));(* 24, 24 *) +(mk_real_int (num_of_string "2164909344906238563788640")),(mk_real_int (num_of_string "3681230074585725081859450"));(* 24, 24 *) +(mk_real_int (num_of_string "2478542091668439822778950")),(mk_real_int (num_of_string "3978905051266610413580520"));(* 24, 24 *) +(mk_real_int (num_of_string "3298843114016562174718656")),(mk_real_int (num_of_string "2802682320722699664557328"));(* 24, 24 *) +(mk_real_int (num_of_string "5348671022568563591120256")),(mk_real_int (num_of_string "3681914645001209140307520"));(* 24, 24 *) +(mk_real_int (num_of_string "1380234575353858286292498")),(mk_real_int (num_of_string "5637730544575066062197316"));(* 24, 24 *) +(mk_real_int (num_of_string "2192262994114541017517952")),(mk_real_int (num_of_string "3277362809327049417746625"));(* 24, 24 *) +(mk_real_int (num_of_string "3253786765955399407202100")),(mk_real_int (num_of_string "2837964342169794422149704"));(* 24, 24 *) +(mk_real_int (num_of_string "3665438318965926387415608")),(mk_real_int (num_of_string "2302432169638013772478662"));(* 24, 24 *) +(mk_real_int (num_of_string "2404860979692714948178238")),(mk_real_int (num_of_string "5912021963984470680499440"));(* 24, 24 *) +(mk_real_int (num_of_string "4575711617443909547190872")),(mk_real_int (num_of_string "2928912702806271355164900"));(* 24, 24 *) +(mk_real_int (num_of_string "1623900572914388421159456")),(mk_real_int (num_of_string "2714759629814468533897236"));(* 24, 24 *) +(mk_real_int (num_of_string "2875610801697635613336984")),(mk_real_int (num_of_string "1837668339386052318899124"));(* 24, 24 *) +(mk_real_int (num_of_string "3086502980677008129632955")),(mk_real_int (num_of_string "2829289935400052976475416"));(* 24, 24 *) +(mk_real_int (num_of_string "4276548216949915461314142")),(mk_real_int (num_of_string "3754591819515012116144889"));(* 24, 24 *) +(mk_real_int (num_of_string "2423370537562076500111038")),(mk_real_int (num_of_string "2899462605337441487717632"));(* 24, 24 *) +(mk_real_int (num_of_string "3170664866702341194612794")),(mk_real_int (num_of_string "3566895356076005263489850"));(* 24, 24 *) +(mk_real_int (num_of_string "3478847963719978039525192")),(mk_real_int (num_of_string "1854982467250982490976800"));(* 24, 24 *) +(mk_real_int (num_of_string "2106512437488401248502690")),(mk_real_int (num_of_string "2661443305967140215239808"));(* 24, 24 *) +(mk_real_int (num_of_string "2265527424983410137122208")),(mk_real_int (num_of_string "2180574814273162253122176"));(* 24, 24 *) +(mk_real_int (num_of_string "3553100931280228466446260")),(mk_real_int (num_of_string "4191090088282233805338960"));(* 24, 24 *) +(mk_real_int (num_of_string "3469945860479219840283180")),(mk_real_int (num_of_string "2151836328420176769095424"));(* 24, 24 *) +(mk_real_int (num_of_string "5129447473921080656206080")),(mk_real_int (num_of_string "2331256968813334641805200"));(* 24, 24 *) +(mk_real_int (num_of_string "2787088344030347329422164")),(mk_real_int (num_of_string "3890527928039325037999500"));(* 24, 24 *) +(mk_real_int (num_of_string "5835494826267547490169120")),(mk_real_int (num_of_string "6616305967285876291574076"));(* 24, 24 *) +(mk_real_int (num_of_string "4745825359454452270640580")),(mk_real_int (num_of_string "4636425885004701145717632"));(* 24, 24 *) +(mk_real_int (num_of_string "2971408921128205779645165")),(mk_real_int (num_of_string "2988624839195305858086189"));(* 24, 24 *) +(mk_real_int (num_of_string "3138188269635169019555904")),(mk_real_int (num_of_string "5597524548157172059854394"));(* 24, 24 *) +(mk_real_int (num_of_string "3949751964390881547459063")),(mk_real_int (num_of_string "1980388452444045444437472"));(* 24, 24 *) +(mk_real_int (num_of_string "1545631918442141910192176")),(mk_real_int (num_of_string "6792710308770333193372830"));(* 24, 24 *) +(mk_real_int (num_of_string "2948815060007869983005768")),(mk_real_int (num_of_string "3483757325881289709884600"));(* 24, 24 *) +(mk_real_int (num_of_string "7156916113355496092508750")),(mk_real_int (num_of_string "2996015837959530626036550"));(* 24, 24 *) +(mk_real_int (num_of_string "2633069512650175327145200")),(mk_real_int (num_of_string "4431508930605363536722112"));(* 24, 24 *) +(mk_real_int (num_of_string "3952363215269745696956800")),(mk_real_int (num_of_string "1907435895363707600842992"));(* 24, 24 *) +(mk_real_int (num_of_string "3247912747275279510681824")),(mk_real_int (num_of_string "3278107922026658100639168"));(* 24, 24 *) +(mk_real_int (num_of_string "6113820100524616389161120")),(mk_real_int (num_of_string "3757243955769481723943904"));(* 24, 24 *) +(mk_real_int (num_of_string "3720607984463669914296630")),(mk_real_int (num_of_string "3692632293212261351117760"));(* 24, 24 *) +(mk_real_int (num_of_string "3748869610826980004801436")),(mk_real_int (num_of_string "3166129504786817080274400"));(* 24, 24 *) +(mk_real_int (num_of_string "3978864825874341989708144")),(mk_real_int (num_of_string "2917771410908374594382946"));(* 24, 24 *) +(mk_real_int (num_of_string "2108920981200346048396320")),(mk_real_int (num_of_string "2856094821944851692214800"));(* 24, 24 *) +(mk_real_int (num_of_string "3027758583067266375396960")),(mk_real_int (num_of_string "2339807066741573986719344"));(* 24, 24 *) +(mk_real_int (num_of_string "2960304443717620807429005")),(mk_real_int (num_of_string "5709472524981270175844238"));(* 24, 24 *) +(mk_real_int (num_of_string "1736592508195890840402656")),(mk_real_int (num_of_string "4733823858798612363524640"));(* 24, 24 *) +(mk_real_int (num_of_string "3651014867890056752116080")),(mk_real_int (num_of_string "2336145996071195999425800"));(* 24, 24 *) +(mk_real_int (num_of_string "2010697251103226943085180")),(mk_real_int (num_of_string "4207049022585141991667520"));(* 24, 24 *) +(mk_real_int (num_of_string "1675758959800525689709620")),(mk_real_int (num_of_string "3535467501781993920773865"));(* 24, 24 *) +(mk_real_int (num_of_string "3709020422542967078722200")),(mk_real_int (num_of_string "2874672380829338043540416"));(* 24, 24 *) +(mk_real_int (num_of_string "2441459866156342594383000")),(mk_real_int (num_of_string "3022287556360458071572880"));(* 24, 24 *) +(mk_real_int (num_of_string "4042742046820611849852813")),(mk_real_int (num_of_string "3022257715423923080509200"));(* 24, 24 *) +(mk_real_int (num_of_string "3736479962580079314642900")),(mk_real_int (num_of_string "1773372900996612367598820"));(* 24, 24 *) +(mk_real_int (num_of_string "3209020740197913519620964")),(mk_real_int (num_of_string "4197251716960041774040047"));(* 24, 24 *) +(mk_real_int (num_of_string "3245093023925168164790880")),(mk_real_int (num_of_string "3781046912262487353315060"));(* 24, 24 *) +(mk_real_int (num_of_string "4388864610962604827465236")),(mk_real_int (num_of_string "2238303777920595342792960"));(* 24, 24 *) +(mk_real_int (num_of_string "4091366740216034564249328")),(mk_real_int (num_of_string "3227770278463830361262500"));(* 24, 24 *) +(mk_real_int (num_of_string "3265097577786284452073112")),(mk_real_int (num_of_string "4228090225754337921657952"));(* 24, 24 *) +(mk_real_int (num_of_string "3324969226869596617340348")),(mk_real_int (num_of_string "6036134641487984730781227"));(* 24, 24 *) +(mk_real_int (num_of_string "3546168808297821873345864")),(mk_real_int (num_of_string "3370832045373977797778172"));(* 24, 24 *) +(mk_real_int (num_of_string "4434040357351707780932000")),(mk_real_int (num_of_string "2812500448521181382784848"));(* 24, 24 *) +(mk_real_int (num_of_string "2838034568798545493385000")),(mk_real_int (num_of_string "3745970426747710415973195"));(* 24, 24 *) +(mk_real_int (num_of_string "4317625074930199784764600")),(mk_real_int (num_of_string "5988227902754687996125055"));(* 24, 24 *) +(mk_real_int (num_of_string "3690585093281250715958160")),(mk_real_int (num_of_string "3043474610355426658979848"));(* 24, 24 *) +(mk_real_int (num_of_string "5022620011946793313430672")),(mk_real_int (num_of_string "2088045814513950362014230"));(* 24, 24 *) +(mk_real_int (num_of_string "3604758041405035976957600")),(mk_real_int (num_of_string "6950229436092558307545768"));(* 24, 24 *) +(mk_real_int (num_of_string "3686269376301116585152736")),(mk_real_int (num_of_string "3230039786730905173549300"));(* 24, 24 *) +(mk_real_int (num_of_string "3259949237302708436672160")),(mk_real_int (num_of_string "4320684199962535726074600"));(* 24, 24 *) +(mk_real_int (num_of_string "2431468769937990762316884")),(mk_real_int (num_of_string "3661490753059484833606349"));(* 24, 24 *) +(mk_real_int (num_of_string "3764015737305526406092896")),(mk_real_int (num_of_string "3537457307740137397922254"));(* 24, 24 *) +(mk_real_int (num_of_string "4022759105652016905725242")),(mk_real_int (num_of_string "3113115006162744189377095"));(* 24, 24 *) +(mk_real_int (num_of_string "3305382982588033545522636")),(mk_real_int (num_of_string "5403156422084203141636464"));(* 24, 24 *) +(mk_real_int (num_of_string "3490795071230359265933094")),(mk_real_int (num_of_string "4648629736409543249219838"));(* 24, 24 *) +(mk_real_int (num_of_string "4805114977717781375306680")),(mk_real_int (num_of_string "3120558578353297652872560"));(* 24, 24 *) +(mk_real_int (num_of_string "3131515502850949359360594")),(mk_real_int (num_of_string "2192395663709144508255894"));(* 24, 24 *) +(mk_real_int (num_of_string "2172487367325029181470890")),(mk_real_int (num_of_string "4875059458720272796560225"));(* 24, 24 *) +(mk_real_int (num_of_string "2762354368765540944533880")),(mk_real_int (num_of_string "2900691952539911813343372"));(* 24, 24 *) +(mk_real_int (num_of_string "2944603409799463342571520")),(mk_real_int (num_of_string "3073925764886803032519840"));(* 24, 24 *) +(mk_real_int (num_of_string "4019727923606109475010958")),(mk_real_int (num_of_string "2984398872262055462494477"));(* 24, 24 *) +(mk_real_int (num_of_string "3983277295427479818535536")),(mk_real_int (num_of_string "2021099250304136559710960"));(* 24, 24 *) +(mk_real_int (num_of_string "3038306519939718291025788")),(mk_real_int (num_of_string "3109063807869415455086080"));(* 24, 24 *) +(mk_real_int (num_of_string "3676251721183286510507840")),(mk_real_int (num_of_string "4703955550799097972681540"));(* 24, 24 *) +(mk_real_int (num_of_string "2162943630402011301069960")),(mk_real_int (num_of_string "3285803927091928145083696"));(* 24, 24 *) +(mk_real_int (num_of_string "3370192608950678210708988")),(mk_real_int (num_of_string "4884811314457597322339760"));(* 24, 24 *) +(mk_real_int (num_of_string "3248649890916604120066440")),(mk_real_int (num_of_string "2861902202098549035270900"));(* 24, 24 *) +(mk_real_int (num_of_string "3372834112175540618809840")),(mk_real_int (num_of_string "2563638804491408551068696"));(* 24, 24 *) +(mk_real_int (num_of_string "2942212642004272126649376")),(mk_real_int (num_of_string "2902764292381866424061280"));(* 24, 24 *) +(mk_real_int (num_of_string "2808628583243974957548144")),(mk_real_int (num_of_string "3040807813787578515090390"));(* 24, 24 *) +(mk_real_int (num_of_string "2251841685050575688188864")),(mk_real_int (num_of_string "1904900528278992698760150"));(* 24, 24 *) +(mk_real_int (num_of_string "5672865885193253316245824")),(mk_real_int (num_of_string "4089012423044369425963488"));(* 24, 24 *) +(mk_real_int (num_of_string "1644054406161754086076955")),(mk_real_int (num_of_string "2698711155535467564161652"));(* 24, 24 *) +(mk_real_int (num_of_string "1741058562240392628825250")),(mk_real_int (num_of_string "4132036228599560706844356"));(* 24, 24 *) +(mk_real_int (num_of_string "3461363842118891156821628")),(mk_real_int (num_of_string "2733784076007615749144320"));(* 24, 24 *) +(mk_real_int (num_of_string "2188933460101117565711040")),(mk_real_int (num_of_string "5040790855390880275924539"));(* 24, 24 *) +(mk_real_int (num_of_string "3045055732952917100212890")),(mk_real_int (num_of_string "2550412930616009789014230"));(* 24, 24 *) +(mk_real_int (num_of_string "3633391982921077946876190")),(mk_real_int (num_of_string "3151184976138836160550488"));(* 24, 24 *) +(mk_real_int (num_of_string "3844298869323738424336724")),(mk_real_int (num_of_string "2049849754371883226407050"));(* 24, 24 *) +(mk_real_int (num_of_string "3134691256834270451756121")),(mk_real_int (num_of_string "2692782485727581073822996"));(* 24, 24 *) +(mk_real_int (num_of_string "4683786431469441758742800")),(mk_real_int (num_of_string "2216431204560387605365388"));(* 24, 24 *) +(mk_real_int (num_of_string "1940069527678291356559872")),(mk_real_int (num_of_string "4387341911084707093011744"));(* 24, 24 *) +(mk_real_int (num_of_string "2883668468781784956249432")),(mk_real_int (num_of_string "2971153066457187003946662"));(* 24, 24 *) +(mk_real_int (num_of_string "2390285393972899165913600")),(mk_real_int (num_of_string "2892404223118619371138548"));(* 24, 24 *) +(mk_real_int (num_of_string "2442749401358879684828229")),(mk_real_int (num_of_string "2481656678009898533022400"));(* 24, 24 *) +(mk_real_int (num_of_string "3806240636616518540009500")),(mk_real_int (num_of_string "5040737852268912182365320"));(* 24, 24 *) +(mk_real_int (num_of_string "3988804554208061401698936")),(mk_real_int (num_of_string "3221176438171479037810392"));(* 24, 24 *) +(mk_real_int (num_of_string "3370268985701687170774140")),(mk_real_int (num_of_string "1185573170159663989345950"));(* 24, 24 *) +(mk_real_int (num_of_string "3316420816441171425374840")),(mk_real_int (num_of_string "2652695252324338199705208"));(* 24, 24 *) +(mk_real_int (num_of_string "3779796114539958969680280")),(mk_real_int (num_of_string "4337928600492365981913660"));(* 24, 24 *) +(mk_real_int (num_of_string "4191559885721475568829952")),(mk_real_int (num_of_string "4107475549347258245091000"));(* 24, 24 *) +(mk_real_int (num_of_string "2458049149716540150695760")),(mk_real_int (num_of_string "5234529485460594912695144"));(* 24, 24 *) +(mk_real_int (num_of_string "1859094431882653763667240")),(mk_real_int (num_of_string "5824650274206897042788704"));(* 24, 24 *) +(mk_real_int (num_of_string "2629624333948316763541395")),(mk_real_int (num_of_string "1944155964976901417010176"));(* 24, 24 *) +(mk_real_int (num_of_string "4356941563711504993306900")),(mk_real_int (num_of_string "4758801800757332677552500"));(* 24, 24 *) +(mk_real_int (num_of_string "2691648212198111546546220")),(mk_real_int (num_of_string "3440047602853354364169462"));(* 24, 24 *) +(mk_real_int (num_of_string "3422153473131695078636100")),(mk_real_int (num_of_string "2262095063216187492589930"));(* 24, 24 *) +(mk_real_int (num_of_string "2521676538180305189467056")),(mk_real_int (num_of_string "1234871169346058627005920"));(* 24, 24 *) +(mk_real_int (num_of_string "3424824953475753634075360")),(mk_real_int (num_of_string "1865185993344010572739215"));(* 24, 24 *) +(mk_real_int (num_of_string "2480009801217898715994540")),(mk_real_int (num_of_string "4269160290408644298588696"));(* 24, 24 *) +(mk_real_int (num_of_string "3832372723197884225638324")),(mk_real_int (num_of_string "2516383644688498990130739"));(* 24, 24 *) +(mk_real_int (num_of_string "5096895227786131244667000")),(mk_real_int (num_of_string "4751866955977617164098800"));(* 24, 24 *) +(mk_real_int (num_of_string "2354995569751904488037398")),(mk_real_int (num_of_string "1864395673309687616393256"));(* 24, 24 *) +(mk_real_int (num_of_string "4361708421884937163728448")),(mk_real_int (num_of_string "5321263274223395615948270"));(* 24, 24 *) +(mk_real_int (num_of_string "3770241216032645670082760")),(mk_real_int (num_of_string "2509579123783101638972895"));(* 24, 24 *) +(mk_real_int (num_of_string "4822068426927348395675520")),(mk_real_int (num_of_string "5940724329976471906937664"));(* 24, 24 *) +(mk_real_int (num_of_string "2814662470142057608918048")),(mk_real_int (num_of_string "2609492952401052020406180"));(* 24, 24 *) +(mk_real_int (num_of_string "5216024001225128661945760")),(mk_real_int (num_of_string "2841716015244338391405400"));(* 24, 24 *) +(mk_real_int (num_of_string "3918270597306092645222592")),(mk_real_int (num_of_string "3480856133599794130206795"));(* 24, 24 *) +(mk_real_int (num_of_string "3457876659846088215698994")),(mk_real_int (num_of_string "1589200961720500363361600"));(* 24, 24 *) +(mk_real_int (num_of_string "2627989496682030264741830")),(mk_real_int (num_of_string "2525533348753835519192768"));(* 24, 24 *) +(mk_real_int (num_of_string "2736645587340329112268500")),(mk_real_int (num_of_string "3045291596257757784421680"));(* 24, 24 *) +(mk_real_int (num_of_string "2236644592585489593427624")),(mk_real_int (num_of_string "4199738755526481942387938"));(* 24, 24 *) +(mk_real_int (num_of_string "2637405467599900952085504")),(mk_real_int (num_of_string "4512763710738522344088369"));(* 24, 24 *) +(mk_real_int (num_of_string "3701751255730610611990536")),(mk_real_int (num_of_string "3266958962741850687158484"));(* 24, 24 *) +(mk_real_int (num_of_string "2483521795963911716335224")),(mk_real_int (num_of_string "2407481677718593641936540"));(* 24, 24 *) +(mk_real_int (num_of_string "3018412573662049796297619")),(mk_real_int (num_of_string "3536680196463410800933920"));(* 24, 24 *) +(mk_real_int (num_of_string "2290126604428601248857738")),(mk_real_int (num_of_string "2492650216302678541782400"));(* 24, 24 *) +(mk_real_int (num_of_string "3665731940375308133530716")),(mk_real_int (num_of_string "3161803539134853550900878"));(* 24, 24 *) +(mk_real_int (num_of_string "2214179826636063440319480")),(mk_real_int (num_of_string "3817905654750086590860384"));(* 24, 24 *) +(mk_real_int (num_of_string "1895873086074655187177100")),(mk_real_int (num_of_string "5592284623307547334961750"));(* 24, 24 *) +(mk_real_int (num_of_string "3240852388016706225128755")),(mk_real_int (num_of_string "2201098956992486610970500"));(* 24, 24 *) +(mk_real_int (num_of_string "2301595831816796097986880")),(mk_real_int (num_of_string "3730902591794562940979250"));(* 24, 24 *) +(mk_real_int (num_of_string "5602948854544410602238462")),(mk_real_int (num_of_string "2945515984573044296479716"));(* 24, 24 *) +(mk_real_int (num_of_string "3323713967312345107957377")),(mk_real_int (num_of_string "3146329210656240116740680"));(* 24, 24 *) +(mk_real_int (num_of_string "3112648059165517352079532")),(mk_real_int (num_of_string "1848794444424010109463120"));(* 24, 24 *) +(mk_real_int (num_of_string "2755322124081717462470076")),(mk_real_int (num_of_string "2408990848894048024863432"));(* 24, 24 *) +(mk_real_int (num_of_string "2757020838395289348299916")),(mk_real_int (num_of_string "3036120054765644566554336"));(* 24, 24 *) +(mk_real_int (num_of_string "1794282890922509278372200")),(mk_real_int (num_of_string "3236071813359841618731108"));(* 24, 24 *) +(mk_real_int (num_of_string "3351206283629589357575625")),(mk_real_int (num_of_string "2268587798765717360624979"));(* 24, 24 *) +(mk_real_int (num_of_string "2470051050174866243420156")),(mk_real_int (num_of_string "3206449671651100482334705"));(* 24, 24 *) +(mk_real_int (num_of_string "3510202544555606514793500")),(mk_real_int (num_of_string "1547569031171232382921920"));(* 24, 24 *) +(mk_real_int (num_of_string "3214337249907352965199602")),(mk_real_int (num_of_string "2149800819123782166745338"));(* 24, 24 *) +(mk_real_int (num_of_string "4303233958425560131936527")),(mk_real_int (num_of_string "3019367868060442587877125"));(* 24, 24 *) +(mk_real_int (num_of_string "2655319450364318518469444")),(mk_real_int (num_of_string "3806382904046840691549360"));(* 24, 24 *) +(mk_real_int (num_of_string "4944836816092137703320264")),(mk_real_int (num_of_string "2819237965671427936451272"));(* 24, 24 *) +(mk_real_int (num_of_string "1936882171988931068295264")),(mk_real_int (num_of_string "2306279870390203335802460"));(* 24, 24 *) +(mk_real_int (num_of_string "2727789002819013958029630")),(mk_real_int (num_of_string "3502188757432913739884928"));(* 24, 24 *) +(mk_real_int (num_of_string "2176864822703095479852482")),(mk_real_int (num_of_string "4965364989515719320083552"));(* 24, 24 *) +(mk_real_int (num_of_string "5341132315796427937522470")),(mk_real_int (num_of_string "2913650664076008713248722"));(* 24, 24 *) +(mk_real_int (num_of_string "3611725134929953488893000")),(mk_real_int (num_of_string "5202269428051954148686848"));(* 24, 24 *) +(mk_real_int (num_of_string "5608700980127645569459807")),(mk_real_int (num_of_string "3727963641699022077072000"));(* 24, 24 *) +(mk_real_int (num_of_string "2659106999205355757723080")),(mk_real_int (num_of_string "2991658517211527227991802"));(* 24, 24 *) +(mk_real_int (num_of_string "2564708296146024263098500")),(mk_real_int (num_of_string "3524698733696466497872440"));(* 24, 24 *) +(mk_real_int (num_of_string "5608241077510186623615406")),(mk_real_int (num_of_string "3863681735787329988520704"));(* 24, 24 *) +(mk_real_int (num_of_string "5241525140825051938420055")),(mk_real_int (num_of_string "3246430986830744440315245"));(* 24, 24 *) +(mk_real_int (num_of_string "3695831862530009720289984")),(mk_real_int (num_of_string "4682481744424862643649824"));(* 24, 24 *) +(mk_real_int (num_of_string "1867932463971518007954800")),(mk_real_int (num_of_string "2116053413450871355164778"));(* 24, 24 *) +(mk_real_int (num_of_string "2503263156536046855213888")),(mk_real_int (num_of_string "1860205109177358473750400"));(* 24, 24 *) +(mk_real_int (num_of_string "3566887930501440915276900")),(mk_real_int (num_of_string "3119411074966404346699200"));(* 24, 24 *) +(mk_real_int (num_of_string "3181219767618511684265760")),(mk_real_int (num_of_string "3519000882230365751967822"));(* 24, 24 *) +(mk_real_int (num_of_string "1614871783756904729202168")),(mk_real_int (num_of_string "4445952826915852408628472"));(* 24, 24 *) +(mk_real_int (num_of_string "2250056523819933285111744")),(mk_real_int (num_of_string "3249474790642784808154800"));(* 24, 24 *) +(mk_real_int (num_of_string "4903556798118027093228600")),(mk_real_int (num_of_string "3110716740640195981598304"));(* 24, 24 *) +(mk_real_int (num_of_string "4369371863471751902034009")),(mk_real_int (num_of_string "3762281027615271724286252"));(* 24, 24 *) +(mk_real_int (num_of_string "1628071391357853844082366")),(mk_real_int (num_of_string "1886833276682065568885730"));(* 24, 24 *) +(mk_real_int (num_of_string "2297372302548316465111682")),(mk_real_int (num_of_string "2552580571534286707784160"));(* 24, 24 *) +(mk_real_int (num_of_string "4850014610271571666467516")),(mk_real_int (num_of_string "1597237298318378533271566"));(* 24, 24 *) +(mk_real_int (num_of_string "4972291580229559672453848")),(mk_real_int (num_of_string "3536758601701187778638912"));(* 24, 24 *) +(mk_real_int (num_of_string "3223697308727816459747712")),(mk_real_int (num_of_string "2066175160990542721473934"));(* 24, 24 *) +(mk_real_int (num_of_string "1926747179135464118355108")),(mk_real_int (num_of_string "4807256530769740020161394"));(* 24, 24 *) +(mk_real_int (num_of_string "4990823657572809255164100")),(mk_real_int (num_of_string "6365013144248103690824160"));(* 24, 24 *) +(mk_real_int (num_of_string "3494296499874226327209365")),(mk_real_int (num_of_string "1889528218736537377781472"));(* 24, 24 *) +(mk_real_int (num_of_string "4119531947388198344886660")),(mk_real_int (num_of_string "5631221184158669894381664"));(* 24, 24 *) +(mk_real_int (num_of_string "5276324990868633828155808")),(mk_real_int (num_of_string "3024009097567566833069928"));(* 24, 24 *) +(mk_real_int (num_of_string "3440584656232452265609422")),(mk_real_int (num_of_string "3171800142498697274826296"));(* 24, 24 *) +(mk_real_int (num_of_string "2084956409352596606590512")),(mk_real_int (num_of_string "2155399387412000511896712"));(* 24, 24 *) +(mk_real_int (num_of_string "1150918348693958324992656")),(mk_real_int (num_of_string "2974047148052004115648620"));(* 24, 24 *) +(mk_real_int (num_of_string "5877596951506738318094883")),(mk_real_int (num_of_string "2004659160298866322934032"));(* 24, 24 *) +(mk_real_int (num_of_string "2085081025936173120881280")),(mk_real_int (num_of_string "4256797579887852104656452"));(* 24, 24 *) +(mk_real_int (num_of_string "2532988651290696826110660")),(mk_real_int (num_of_string "5839911686514219140473680"));(* 24, 24 *) +(mk_real_int (num_of_string "3653532172822230240217600")),(mk_real_int (num_of_string "1909287915386385750385554"));(* 24, 24 *) +(mk_real_int (num_of_string "3178121555473303086276948")),(mk_real_int (num_of_string "4953683839206976728767406"));(* 24, 24 *) +(mk_real_int (num_of_string "2630114165742423484703400")),(mk_real_int (num_of_string "3107675010779355622573056"));(* 24, 24 *) +(mk_real_int (num_of_string "4129167077212755796631328")),(mk_real_int (num_of_string "3556194949263240314961199"));(* 24, 24 *) +(mk_real_int (num_of_string "1645183843027905440997660")),(mk_real_int (num_of_string "3478659530950478466466560"));(* 24, 24 *) +(mk_real_int (num_of_string "2847521404427215513544064")),(mk_real_int (num_of_string "2293227872915395653019938"));(* 24, 24 *) +(mk_real_int (num_of_string "4184075516104036111790160")),(mk_real_int (num_of_string "3827745060945879546144414"));(* 24, 24 *) +(mk_real_int (num_of_string "5952789213090057326180400")),(mk_real_int (num_of_string "3469585495788977115877617"));(* 24, 24 *) +(mk_real_int (num_of_string "3697382820702727461808674")),(mk_real_int (num_of_string "4496689087322095391856690"));(* 24, 24 *) +(mk_real_int (num_of_string "3634511866845385766512580")),(mk_real_int (num_of_string "1798391954218632571351080"));(* 24, 24 *) +(mk_real_int (num_of_string "1420635797229043442563560")),(mk_real_int (num_of_string "2938362848581987293022500"));(* 24, 24 *) +(mk_real_int (num_of_string "3264210037319698314967925")),(mk_real_int (num_of_string "3993074441368154416295340"));(* 24, 24 *) +(mk_real_int (num_of_string "2688963665404272897502197")),(mk_real_int (num_of_string "4207271144237165477486208"));(* 24, 24 *) +(mk_real_int (num_of_string "3187754371986498977796966")),(mk_real_int (num_of_string "3483499838114526235775784"));(* 24, 24 *) +(mk_real_int (num_of_string "4345149025834465402178618")),(mk_real_int (num_of_string "4732907567341784536261710"));(* 24, 24 *) +(mk_real_int (num_of_string "4302780553244126599059216")),(mk_real_int (num_of_string "3327974227550752516265760"));(* 24, 24 *) +(mk_real_int (num_of_string "2480872370051357527092925")),(mk_real_int (num_of_string "3590349469952819635412955"));(* 24, 24 *) +(mk_real_int (num_of_string "4964391156333560892916000")),(mk_real_int (num_of_string "3192042701665393482479760"));(* 24, 24 *) +(mk_real_int (num_of_string "3121284595348577967705612")),(mk_real_int (num_of_string "3953432402070988402932240"));(* 24, 24 *) +(mk_real_int (num_of_string "1637487069795379453799000")),(mk_real_int (num_of_string "2034540331916956075027000"));(* 24, 24 *) +(mk_real_int (num_of_string "2478311046899474389558800")),(mk_real_int (num_of_string "3245781975060315402462960"));(* 24, 24 *) +(mk_real_int (num_of_string "2442209792753146007827440")),(mk_real_int (num_of_string "2966608639142357185475100"));(* 24, 24 *) +(mk_real_int (num_of_string "6706019554075664843810400")),(mk_real_int (num_of_string "4663334530328018819812440"));(* 24, 24 *) +(mk_real_int (num_of_string "3259964108441741745974544")),(mk_real_int (num_of_string "3370315629341470008028500"));(* 24, 24 *) +(mk_real_int (num_of_string "2806140656860430163007510")),(mk_real_int (num_of_string "2919954165705914664749330"));(* 24, 24 *) +(mk_real_int (num_of_string "4682834487580435676492436")),(mk_real_int (num_of_string "2579158067756238172818000"));(* 24, 24 *) +(mk_real_int (num_of_string "2380270436024448448790782")),(mk_real_int (num_of_string "4854066969484715202089640"));(* 24, 24 *) +(mk_real_int (num_of_string "2551881811251010373426688")),(mk_real_int (num_of_string "3108433079437999230154541"));(* 24, 24 *) +(mk_real_int (num_of_string "2714374318357383772178424")),(mk_real_int (num_of_string "2731410788371849366341624"));(* 24, 24 *) +(mk_real_int (num_of_string "2231920621777928173583400")),(mk_real_int (num_of_string "4202853802510828034018190"));(* 24, 24 *) +(mk_real_int (num_of_string "3658682908886960285857680")),(mk_real_int (num_of_string "2263891110230682976352400"));(* 24, 24 *) +(mk_real_int (num_of_string "2673021566060395941232572")),(mk_real_int (num_of_string "2223307069639802881812000"));(* 24, 24 *) +(mk_real_int (num_of_string "3651011897855768760171375")),(mk_real_int (num_of_string "2294685867918222466732590"));(* 24, 24 *) +(mk_real_int (num_of_string "3511370031841840959528516")),(mk_real_int (num_of_string "3242950619380072614361712"));(* 24, 24 *) +(mk_real_int (num_of_string "2978041989443282952573504")),(mk_real_int (num_of_string "4337026344964206753702336"));(* 24, 24 *) +(mk_real_int (num_of_string "1827969192634422008293500")),(mk_real_int (num_of_string "3569824728891433935129088"));(* 24, 24 *) +(mk_real_int (num_of_string "5658442032093901065002208")),(mk_real_int (num_of_string "3239285228245969791696560"));(* 24, 24 *) +(mk_real_int (num_of_string "2445122036238524696381328")),(mk_real_int (num_of_string "1752567313236555694534650"));(* 24, 24 *) +(mk_real_int (num_of_string "4634854541328930158406400")),(mk_real_int (num_of_string "3373325437893915309809302"));(* 24, 24 *) +(mk_real_int (num_of_string "3143716774773617193499516")),(mk_real_int (num_of_string "3674557947353065990409080"));(* 24, 24 *) +(mk_real_int (num_of_string "2054753445316781088195978")),(mk_real_int (num_of_string "1751154660924626551114250"));(* 24, 24 *) +(mk_real_int (num_of_string "4153642424134442960407661")),(mk_real_int (num_of_string "5919673818099539091147840"));(* 24, 24 *) +(mk_real_int (num_of_string "2861531543974049689867096")),(mk_real_int (num_of_string "2696776428253698146471934"));(* 24, 24 *) +(mk_real_int (num_of_string "4855454089346716230139505")),(mk_real_int (num_of_string "5685274893419215556638800"));(* 24, 24 *) +(mk_real_int (num_of_string "3673234804128270216280720")),(mk_real_int (num_of_string "3441993612277086105715980"));(* 24, 24 *) +(mk_real_int (num_of_string "4461857281890784590204600")),(mk_real_int (num_of_string "2477346219809981479703370"));(* 24, 24 *) +(mk_real_int (num_of_string "3927699294086413032575850")),(mk_real_int (num_of_string "2331506434343814290440540"));(* 24, 24 *) +(mk_real_int (num_of_string "2017761628198251307875696")),(mk_real_int (num_of_string "2638394930345032567140144"));(* 24, 24 *) +(mk_real_int (num_of_string "2979508010771300437963422")),(mk_real_int (num_of_string "4283856959593876977786096"));(* 24, 24 *) +(mk_real_int (num_of_string "6166455341890413080562480")),(mk_real_int (num_of_string "3122494753514819058016775"));(* 24, 24 *) +(mk_real_int (num_of_string "2181320700175908750201840")),(mk_real_int (num_of_string "3600989971639653399674520"));(* 24, 24 *) +(mk_real_int (num_of_string "2596359177022619513756082")),(mk_real_int (num_of_string "3138774845382018874654930"));(* 24, 24 *) +(mk_real_int (num_of_string "4934963635463193755906494")),(mk_real_int (num_of_string "2276208158329438239542569"));(* 24, 24 *) +(mk_real_int (num_of_string "3467830656481952260004445")),(mk_real_int (num_of_string "3029249622105646246307520"));(* 24, 24 *) +(mk_real_int (num_of_string "2738088336027446828352180")),(mk_real_int (num_of_string "1951244921737135736706060"));(* 24, 24 *) +(mk_real_int (num_of_string "2056623393806257562141585")),(mk_real_int (num_of_string "4281156282557585725040544"));(* 24, 24 *) +(mk_real_int (num_of_string "1477159917565703194735800")),(mk_real_int (num_of_string "1681451055059772326541925"));(* 24, 24 *) +(mk_real_int (num_of_string "4128593795790524783941680")),(mk_real_int (num_of_string "1548303888015218313138700"));(* 24, 24 *) +(mk_real_int (num_of_string "3346745965832022223262628")),(mk_real_int (num_of_string "2444230731232107482996004"));(* 24, 24 *) +(mk_real_int (num_of_string "3116065609444505717571904")),(mk_real_int (num_of_string "3666724887346125442155136"));(* 24, 24 *) +(mk_real_int (num_of_string "4720551012815856513496575")),(mk_real_int (num_of_string "1735960717917516108157440"));(* 24, 24 *) +(mk_real_int (num_of_string "2839626124484320575624000")),(mk_real_int (num_of_string "5671265431683361455795984"));(* 24, 24 *) +(mk_real_int (num_of_string "2587244548362917119966538")),(mk_real_int (num_of_string "4565956295041404381643622"));(* 24, 24 *) +(mk_real_int (num_of_string "3959523966399494125129510")),(mk_real_int (num_of_string "6202131128265812937688206"));(* 24, 24 *) +(mk_real_int (num_of_string "2702444905307779008832798")),(mk_real_int (num_of_string "4685504284331908623097050"));(* 24, 24 *) +(mk_real_int (num_of_string "3992951262126805818131775")),(mk_real_int (num_of_string "1960688005581452392873208"));(* 24, 24 *) +(mk_real_int (num_of_string "2594289781723889092972986")),(mk_real_int (num_of_string "3317699810877781720983680"));(* 24, 24 *) +(mk_real_int (num_of_string "3252978063999666521135400")),(mk_real_int (num_of_string "2000731406858133961593348"));(* 24, 24 *) +(mk_real_int (num_of_string "4045836001217665907670050")),(mk_real_int (num_of_string "2381478103440811136204664"));(* 24, 24 *) +(mk_real_int (num_of_string "2796531057080085769945293")),(mk_real_int (num_of_string "5749668916743868216788744"));(* 24, 24 *) +(mk_real_int (num_of_string "4890195926793629600580000")),(mk_real_int (num_of_string "3963616003823920605887040"));(* 24, 24 *) +(mk_real_int (num_of_string "2929283474066196042064360")),(mk_real_int (num_of_string "4513301454663127631534080"));(* 24, 24 *) +(mk_real_int (num_of_string "4528873117987916629936200")),(mk_real_int (num_of_string "3212401643832141916888500"));(* 24, 24 *) +(mk_real_int (num_of_string "4631952590092393815337344")),(mk_real_int (num_of_string "2714703617866549142673000"));(* 24, 24 *) +(mk_real_int (num_of_string "4473802790379934473640944")),(mk_real_int (num_of_string "3460233422343005154791604"));(* 24, 24 *) +(mk_real_int (num_of_string "4204067424920557108148160")),(mk_real_int (num_of_string "4702496145073303850747298"));(* 24, 24 *) +(mk_real_int (num_of_string "3598857725271740641636632")),(mk_real_int (num_of_string "2976280255710714017532246"));(* 24, 24 *) +(mk_real_int (num_of_string "4037441040716730744914960")),(mk_real_int (num_of_string "2443066610927734420685568"));(* 24, 24 *) +(mk_real_int (num_of_string "2955486909446820734601000")),(mk_real_int (num_of_string "5361828111029821417247844"));(* 24, 24 *) +(mk_real_int (num_of_string "3363459689366462710402470")),(mk_real_int (num_of_string "3564359543930647134700104"));(* 24, 24 *) +(mk_real_int (num_of_string "5386044208881706199580000")),(mk_real_int (num_of_string "2671113496718970176526856"));(* 24, 24 *) +(mk_real_int (num_of_string "2718818348391963415173568")),(mk_real_int (num_of_string "3106188046703253471351315"));(* 24, 24 *) +(mk_real_int (num_of_string "5437868019183024213673248")),(mk_real_int (num_of_string "2300835052706981265150375"));(* 24, 24 *) +(mk_real_int (num_of_string "5720450450793539815154320")),(mk_real_int (num_of_string "2751767006176621435032084"));(* 24, 24 *) +(mk_real_int (num_of_string "7694601444603575866150500")),(mk_real_int (num_of_string "2868067773076146144624972"));(* 24, 24 *) +(mk_real_int (num_of_string "3431818575210682219099390")),(mk_real_int (num_of_string "3904908106810073366314872"));(* 24, 24 *) +(mk_real_int (num_of_string "3284127251668499789376000")),(mk_real_int (num_of_string "3385707756585382640069224"));(* 24, 24 *) +(mk_real_int (num_of_string "2719500727012846183714296")),(mk_real_int (num_of_string "4686774378731542177296120"));(* 24, 24 *) +(mk_real_int (num_of_string "3034730227396458322283832")),(mk_real_int (num_of_string "3712038681710629240658688"));(* 24, 24 *) +(mk_real_int (num_of_string "4546494397318961536417584")),(mk_real_int (num_of_string "3907625976617325022000753"));(* 24, 24 *) +(mk_real_int (num_of_string "2476217058926299755325440")),(mk_real_int (num_of_string "1990708634598351879168280"));(* 24, 24 *) +(mk_real_int (num_of_string "3618472797188061879399564")),(mk_real_int (num_of_string "2074426535332438388410812"));(* 24, 24 *) +(mk_real_int (num_of_string "2730699327880591581038770")),(mk_real_int (num_of_string "3520238383778503745826720"));(* 24, 24 *) +(mk_real_int (num_of_string "3545636300621248047113240")),(mk_real_int (num_of_string "3035651318424981632733984"));(* 24, 24 *) +(mk_real_int (num_of_string "3494902110003380883793500")),(mk_real_int (num_of_string "2708690141715156252001950"));(* 24, 24 *) +(mk_real_int (num_of_string "1836504937361898578594820")),(mk_real_int (num_of_string "4034304744828169643190595"));(* 24, 24 *) +(mk_real_int (num_of_string "2848360644278302317096096")),(mk_real_int (num_of_string "3655367912539289400286448"));(* 24, 24 *) +(mk_real_int (num_of_string "3639178957082170275039300")),(mk_real_int (num_of_string "2921402780592750722680440"));(* 24, 24 *) +(mk_real_int (num_of_string "2473247481671462767553984")),(mk_real_int (num_of_string "3044889058979910338402886"));(* 24, 24 *) +(mk_real_int (num_of_string "5207275558826973585124584")),(mk_real_int (num_of_string "2484289009664793646432700"));(* 24, 24 *) +(mk_real_int (num_of_string "2749235025453504762214782")),(mk_real_int (num_of_string "2767252244168037877236340"));(* 24, 24 *) +(mk_real_int (num_of_string "4457269760898171809860656")),(mk_real_int (num_of_string "2537589291833892987201546"));(* 24, 24 *) +(mk_real_int (num_of_string "4959859216799122796901216")),(mk_real_int (num_of_string "3325865242462439596381008"));(* 24, 24 *) +(mk_real_int (num_of_string "4086861150286375786884217")),(mk_real_int (num_of_string "3664782026624849047183680"));(* 24, 24 *) +(mk_real_int (num_of_string "5713854534033013226047152")),(mk_real_int (num_of_string "3711870296092911481680672"));(* 24, 24 *) +(mk_real_int (num_of_string "3510755697023148728655632")),(mk_real_int (num_of_string "2748656576240710389484780"));(* 24, 24 *) +(mk_real_int (num_of_string "3934433601959927763222240")),(mk_real_int (num_of_string "2403610319610875824225866"));(* 24, 24 *) +(mk_real_int (num_of_string "3520958017985589451778816")),(mk_real_int (num_of_string "4251641715594108432816512"));(* 24, 24 *) +(mk_real_int (num_of_string "5083300849858327757754356")),(mk_real_int (num_of_string "2968714349735339402126694"));(* 24, 24 *) +(mk_real_int (num_of_string "2907196912286388754866900")),(mk_real_int (num_of_string "3969262695625523525255004"));(* 24, 24 *) +(mk_real_int (num_of_string "3486432531035724611317600")),(mk_real_int (num_of_string "3451735845922941300130911"));(* 24, 24 *) +(mk_real_int (num_of_string "2347658906076336405736170")),(mk_real_int (num_of_string "2668831071342872694620940"));(* 24, 24 *) +(mk_real_int (num_of_string "5899649289890134801954512")),(mk_real_int (num_of_string "2085857302208791903149540"));(* 24, 24 *) +(mk_real_int (num_of_string "4507195836964730665314600")),(mk_real_int (num_of_string "3223814800494932100223500"));(* 24, 24 *) +(mk_real_int (num_of_string "3969048322980490158406855")),(mk_real_int (num_of_string "2847005566732199931224375"));(* 24, 24 *) +(mk_real_int (num_of_string "3539596983984564240840480")),(mk_real_int (num_of_string "3574919188864211215187718"));(* 24, 24 *) +(mk_real_int (num_of_string "1779874358523524105050326")),(mk_real_int (num_of_string "2519769086822114102463660"));(* 24, 24 *) +(mk_real_int (num_of_string "3443487593214965231127710")),(mk_real_int (num_of_string "2426782895375382878614212"));(* 24, 24 *) +(mk_real_int (num_of_string "3285656338990512429091275")),(mk_real_int (num_of_string "2984373445919228003273094"));(* 24, 24 *) +(mk_real_int (num_of_string "4314236230687193720267938")),(mk_real_int (num_of_string "2225373491864527250771700"));(* 24, 24 *) +(mk_real_int (num_of_string "2478372279428313787572144")),(mk_real_int (num_of_string "3801426829023353984025000"));(* 24, 24 *) +(mk_real_int (num_of_string "2500983974801256013099590")),(mk_real_int (num_of_string "4455517448168933816797203"));(* 24, 24 *) +(mk_real_int (num_of_string "2002660447950195390065100")),(mk_real_int (num_of_string "4488279614864399904105450"));(* 24, 24 *) +(mk_real_int (num_of_string "4163410600149027442970304")),(mk_real_int (num_of_string "3203418022345839022287840"));(* 24, 24 *) +(mk_real_int (num_of_string "2599024466111021067147595")),(mk_real_int (num_of_string "4667693580579038985578160"));(* 24, 24 *) +(mk_real_int (num_of_string "2147626184708940627195714")),(mk_real_int (num_of_string "3898777472839066849346480"));(* 24, 24 *) +(mk_real_int (num_of_string "4986732430512447935874972")),(mk_real_int (num_of_string "2026349844854417472196800"));(* 24, 24 *) +(mk_real_int (num_of_string "2235233767138328400441921")),(mk_real_int (num_of_string "2514963234737734682616780"));(* 24, 24 *) +(mk_real_int (num_of_string "4203291947432653538192286")),(mk_real_int (num_of_string "2333300927154146250669414"));(* 24, 24 *) +(mk_real_int (num_of_string "1916261457270795390230552")),(mk_real_int (num_of_string "3231655283661329516916144"));(* 24, 24 *) +(mk_real_int (num_of_string "4491965932549805600097685")),(mk_real_int (num_of_string "3504168050840627489641620"));(* 24, 24 *) +(mk_real_int (num_of_string "3074107809630860486718422")),(mk_real_int (num_of_string "2981689537832681997593910"));(* 24, 24 *) +(mk_real_int (num_of_string "5245568715873189191083868")),(mk_real_int (num_of_string "3375718636842147109854000"));(* 24, 24 *) +(mk_real_int (num_of_string "4753063523302355267638320")),(mk_real_int (num_of_string "2327107102098530481453360"));(* 24, 24 *) +(mk_real_int (num_of_string "1705397382417506318926560")),(mk_real_int (num_of_string "3085913616828201993917265"));(* 24, 24 *) +(mk_real_int (num_of_string "5019586577411706882669696")),(mk_real_int (num_of_string "3926451060427808917112080"));(* 24, 24 *) +(mk_real_int (num_of_string "3241713713511443485190260")),(mk_real_int (num_of_string "2182836938772685960004058"));(* 24, 24 *) +(mk_real_int (num_of_string "2552786980499730679649952")),(mk_real_int (num_of_string "2973966043684451127530140"));(* 24, 24 *) +(mk_real_int (num_of_string "4479763353915970040187396")),(mk_real_int (num_of_string "1511609643218873899237500"));(* 24, 24 *) +(mk_real_int (num_of_string "4155170643346024211240300")),(mk_real_int (num_of_string "4417744887806841266637636"));(* 24, 24 *) +(mk_real_int (num_of_string "4059338987780609857286076")),(mk_real_int (num_of_string "5568595794476263901754936"));(* 24, 24 *) +(mk_real_int (num_of_string "4013162028339373727972700")),(mk_real_int (num_of_string "3952142675317672325776188"));(* 24, 24 *) +(mk_real_int (num_of_string "4836813598681259947156020")),(mk_real_int (num_of_string "3381483203482708552498172"));(* 24, 24 *) +(mk_real_int (num_of_string "2665430683910890637297352")),(mk_real_int (num_of_string "4245531220529071191258688"));(* 24, 24 *) +(mk_real_int (num_of_string "1629556072161053646370124")),(mk_real_int (num_of_string "4002462676387666213400748"));(* 24, 24 *) +(mk_real_int (num_of_string "1615197316463463566109360")),(mk_real_int (num_of_string "1715515091427536278015626"));(* 24, 24 *) +(mk_real_int (num_of_string "3482818479233442171725760")),(mk_real_int (num_of_string "2982222781087759574832090"));(* 24, 24 *) +(mk_real_int (num_of_string "2775487112541913677054651")),(mk_real_int (num_of_string "2717017211809153618142106"));(* 24, 24 *) +(mk_real_int (num_of_string "2251632801889865424162030")),(mk_real_int (num_of_string "3828458778281338693676400"));(* 24, 24 *) +(mk_real_int (num_of_string "2065401054824157092751048")),(mk_real_int (num_of_string "3474426600035747339666826"));(* 24, 24 *) +(mk_real_int (num_of_string "3498756425256722232024688")),(mk_real_int (num_of_string "4067601972837753252059352"));(* 24, 24 *) +(mk_real_int (num_of_string "2405500717993232347218088")),(mk_real_int (num_of_string "3866668251678339471814164"));(* 24, 24 *) +(mk_real_int (num_of_string "2311588582476455589038150")),(mk_real_int (num_of_string "3900767452577121559274868"));(* 24, 24 *) +(mk_real_int (num_of_string "3171032658989222245367760")),(mk_real_int (num_of_string "5435575394383580128572960"));(* 24, 24 *) +(mk_real_int (num_of_string "5218063628817107909325600")),(mk_real_int (num_of_string "1952099170321457941801479"));(* 24, 24 *) +(mk_real_int (num_of_string "4830555908515012273666320")),(mk_real_int (num_of_string "2496228456196981817168490"));(* 24, 24 *) +(mk_real_int (num_of_string "1220810705236250691501456")),(mk_real_int (num_of_string "3210451479062445512812608"));(* 24, 24 *) +(mk_real_int (num_of_string "4261279342148788250114460")),(mk_real_int (num_of_string "2188772775319654342086534"));(* 24, 24 *) +(mk_real_int (num_of_string "2991344747479902137895186")),(mk_real_int (num_of_string "2220091707630399731868660"));(* 24, 24 *) +(mk_real_int (num_of_string "6060340143176580413219816")),(mk_real_int (num_of_string "4619675419444584492567335"));(* 24, 24 *) +(mk_real_int (num_of_string "5577827895551567509142784")),(mk_real_int (num_of_string "3766892451448798783631520"));(* 24, 24 *) +(mk_real_int (num_of_string "5101963767420177424719640")),(mk_real_int (num_of_string "5422614303201216129006096"));(* 24, 24 *) +(mk_real_int (num_of_string "3555860887498522886334528")),(mk_real_int (num_of_string "2247259234538002221485010"));(* 24, 24 *) +(mk_real_int (num_of_string "3090363763848825329298992")),(mk_real_int (num_of_string "3343881543059550192321450"));(* 24, 24 *) +(mk_real_int (num_of_string "3398474887607600118859695")),(mk_real_int (num_of_string "3764410772456867594814990"));(* 24, 24 *) +(mk_real_int (num_of_string "2806701035896688342372280")),(mk_real_int (num_of_string "4014691964182037881999200"));(* 24, 24 *) +(mk_real_int (num_of_string "2637060490992142385555400")),(mk_real_int (num_of_string "2686307811209691666513600"));(* 24, 24 *) +(mk_real_int (num_of_string "3592051750103661055608320")),(mk_real_int (num_of_string "5465096901912289132587824"));(* 24, 24 *) +(mk_real_int (num_of_string "3609269198041113223857240")),(mk_real_int (num_of_string "4645752364777824886061952"));(* 24, 24 *) +(mk_real_int (num_of_string "1436831251554644449174776")),(mk_real_int (num_of_string "2837381902253721613220675"));(* 24, 24 *) +(mk_real_int (num_of_string "2610632352807352705441480")),(mk_real_int (num_of_string "4043738007861746920457442"));(* 24, 24 *) +(mk_real_int (num_of_string "1728684146659908804657688")),(mk_real_int (num_of_string "1087005085142325418071000"));(* 24, 24 *) +(mk_real_int (num_of_string "5048393757113006650705264")),(mk_real_int (num_of_string "2972748841728811073527320"));(* 24, 24 *) +(mk_real_int (num_of_string "3069177827362379181886248")),(mk_real_int (num_of_string "1525812459184099252778700"));(* 24, 24 *) +(mk_real_int (num_of_string "2712298542392133298788100")),(mk_real_int (num_of_string "3408285432041219441099340"));(* 24, 24 *) +(mk_real_int (num_of_string "5746168233059231419918344")),(mk_real_int (num_of_string "1994114488322539597862640"));(* 24, 24 *) +(mk_real_int (num_of_string "3168847786392806493809358")),(mk_real_int (num_of_string "4780861202502421020033280"));(* 24, 24 *) +(mk_real_int (num_of_string "2518346080772103067639920")),(mk_real_int (num_of_string "3811991482792838102175600"));(* 24, 24 *) +(mk_real_int (num_of_string "2205723700259107942342880")),(mk_real_int (num_of_string "1862393619826874111532800"));(* 24, 24 *) +(mk_real_int (num_of_string "2788057974655178048444940")),(mk_real_int (num_of_string "2334272927137485384348441"));(* 24, 24 *) +(mk_real_int (num_of_string "2147390234014055247280000")),(mk_real_int (num_of_string "6943830955023672976315980"));(* 24, 24 *) +(mk_real_int (num_of_string "2313492239846413917774320")),(mk_real_int (num_of_string "1575338375378015129792196"));(* 24, 24 *) +(mk_real_int (num_of_string "4952985687992764823871600")),(mk_real_int (num_of_string "2275617485835052279466712"));(* 24, 24 *) +(mk_real_int (num_of_string "3254798915686629647175672")),(mk_real_int (num_of_string "4883306706833673106230921"));(* 24, 24 *) +(mk_real_int (num_of_string "1939162723280980781997864")),(mk_real_int (num_of_string "4695052903674560853618907"));(* 24, 24 *) +(mk_real_int (num_of_string "1689109164030144643389180")),(mk_real_int (num_of_string "1882435458698167886660810"));(* 24, 24 *) +(mk_real_int (num_of_string "1898880894184168019388836")),(mk_real_int (num_of_string "5227335360862736444312724"));(* 24, 24 *) +(mk_real_int (num_of_string "4546330764450031715216940")),(mk_real_int (num_of_string "3211468738883724957346080"));(* 24, 24 *) +(mk_real_int (num_of_string "3378869674935630536362989")),(mk_real_int (num_of_string "2069959299171637725128504"));(* 24, 24 *) +(mk_real_int (num_of_string "5280175285500206726262784")),(mk_real_int (num_of_string "3195617278810402518024550"));(* 24, 24 *) +(mk_real_int (num_of_string "1728727020143330602855840")),(mk_real_int (num_of_string "3254335369807155055564660"));(* 24, 24 *) +(mk_real_int (num_of_string "5995645929201090102459200")),(mk_real_int (num_of_string "4253471431171762385696528"));(* 24, 24 *) +(mk_real_int (num_of_string "3669359286980234535836420")),(mk_real_int (num_of_string "4762101775580533332544160"));(* 24, 24 *) +(mk_real_int (num_of_string "2183867446903845982595264")),(mk_real_int (num_of_string "4669744339750872409352424"));(* 24, 24 *) +(mk_real_int (num_of_string "2133624998435171614540456")),(mk_real_int (num_of_string "3067949171292532507532092"));(* 24, 24 *) +(mk_real_int (num_of_string "4423048619794623598736828")),(mk_real_int (num_of_string "3146074707325709780410290"));(* 24, 24 *) +(mk_real_int (num_of_string "4290702587887162550321316")),(mk_real_int (num_of_string "2807281905577256940249978"));(* 24, 24 *) +(mk_real_int (num_of_string "3003655269995361360696000")),(mk_real_int (num_of_string "5126218504796917478998800"));(* 24, 24 *) +(mk_real_int (num_of_string "2465164017460896470941644")),(mk_real_int (num_of_string "5005676407170062976165806"));(* 24, 24 *) +(mk_real_int (num_of_string "3648483074723188565039072")),(mk_real_int (num_of_string "3656416951796210024164776"));(* 24, 24 *) +(mk_real_int (num_of_string "2116870974808569356089752")),(mk_real_int (num_of_string "3882683032085684566613130"));(* 24, 24 *) +(mk_real_int (num_of_string "3496365161102924665580460")),(mk_real_int (num_of_string "4554670163172702025345536"));(* 24, 24 *) +(mk_real_int (num_of_string "3954468023887095899512800")),(mk_real_int (num_of_string "3930246037966805986259920"));(* 24, 24 *) +(mk_real_int (num_of_string "3018346675219523287763760")),(mk_real_int (num_of_string "3782169658117946193270054"));(* 24, 24 *) +(mk_real_int (num_of_string "2573650331408599873309440")),(mk_real_int (num_of_string "1886395854007188775216848"));(* 24, 24 *) +(mk_real_int (num_of_string "2696165896360316776426492")),(mk_real_int (num_of_string "5573838865713805216774860"));(* 24, 24 *) +(mk_real_int (num_of_string "2879490122979213294944562")),(mk_real_int (num_of_string "2055686761281629461304592"));(* 24, 24 *) +(mk_real_int (num_of_string "3809911744693475538956832")),(mk_real_int (num_of_string "3400494787104971719539522"));(* 24, 24 *) +(mk_real_int (num_of_string "2804925593497118988301340")),(mk_real_int (num_of_string "2346571721763204172960138"));(* 24, 24 *) +(mk_real_int (num_of_string "2513547677852393863494044")),(mk_real_int (num_of_string "3538864702480318889520864"));(* 24, 24 *) +(mk_real_int (num_of_string "2569339403409757642824972")),(mk_real_int (num_of_string "3397177476970212389203800"));(* 24, 24 *) +(mk_real_int (num_of_string "3203444061211206763542780")),(mk_real_int (num_of_string "2913446612193826143526608"));(* 24, 24 *) +(mk_real_int (num_of_string "2298258180308311529647965")),(mk_real_int (num_of_string "5874856716054410368397883"));(* 24, 24 *) +(mk_real_int (num_of_string "3905424324315168629236668")),(mk_real_int (num_of_string "1312552778380132631355630"));(* 24, 24 *) +(mk_real_int (num_of_string "2100401568808789500938130")),(mk_real_int (num_of_string "3624185475493973228350999"));(* 24, 24 *) +(mk_real_int (num_of_string "2735564228922707339422382")),(mk_real_int (num_of_string "2848369989068442380880639"));(* 24, 24 *) +(mk_real_int (num_of_string "5474346718199559347665760")),(mk_real_int (num_of_string "1434160534242763273148784"));(* 24, 24 *) +(mk_real_int (num_of_string "4395654228223559568127686")),(mk_real_int (num_of_string "2059211346711145307357184"));(* 24, 24 *) +(mk_real_int (num_of_string "3997773594622678229946496")),(mk_real_int (num_of_string "2735630886606255619122400"));(* 24, 24 *) +(mk_real_int (num_of_string "5551069986141672573141372")),(mk_real_int (num_of_string "1764488920036674471696000"));(* 24, 24 *) +(mk_real_int (num_of_string "3383080218107440062091776")),(mk_real_int (num_of_string "3854658659983760167134272"));(* 24, 24 *) +(mk_real_int (num_of_string "2285029837604246420061648")),(mk_real_int (num_of_string "2006428793525331937972704"));(* 24, 24 *) +(mk_real_int (num_of_string "2066528788331516455386534")),(mk_real_int (num_of_string "3357129845572650546502970"));(* 24, 24 *) +(mk_real_int (num_of_string "4252224592197236768800410")),(mk_real_int (num_of_string "2847262293940670823525552"));(* 24, 24 *) +(mk_real_int (num_of_string "3669156096680054599739454")),(mk_real_int (num_of_string "4560948525729991467338433"));(* 24, 24 *) +(mk_real_int (num_of_string "4653299518019798026604220")),(mk_real_int (num_of_string "2771268569748152216184816"));(* 24, 24 *) +(mk_real_int (num_of_string "2216089039727139625503252")),(mk_real_int (num_of_string "2035011323583548959960773"));(* 24, 24 *) +(mk_real_int (num_of_string "4864408409177209450629498")),(mk_real_int (num_of_string "3675115473613313238144240"));(* 24, 24 *) +(mk_real_int (num_of_string "2642135296420783466470036")),(mk_real_int (num_of_string "2601448092917950480235020"));(* 24, 24 *) +(mk_real_int (num_of_string "1557370470602866884607500")),(mk_real_int (num_of_string "2536269125553467233628160"));(* 24, 24 *) +(mk_real_int (num_of_string "4386194819425356158263680")),(mk_real_int (num_of_string "1707381307674273705062400"));(* 24, 24 *) +(mk_real_int (num_of_string "5650036206681632812616544")),(mk_real_int (num_of_string "1317277097957760439183488"));(* 24, 24 *) +(mk_real_int (num_of_string "2091632447013160221793233")),(mk_real_int (num_of_string "3546416136459480394323928"));(* 24, 24 *) +(mk_real_int (num_of_string "3252501491099008866572610")),(mk_real_int (num_of_string "2219073850905812907806688"));(* 24, 24 *) +(mk_real_int (num_of_string "2260513241487530712885888")),(mk_real_int (num_of_string "4637259398672364708216960"));(* 24, 24 *) +(mk_real_int (num_of_string "3196356468385805267486592")),(mk_real_int (num_of_string "2352978380479574174062134"));(* 24, 24 *) +(mk_real_int (num_of_string "3714057298480235143874038")),(mk_real_int (num_of_string "3571837133464168521598080"));(* 24, 24 *) +(mk_real_int (num_of_string "4610918404935155548349616")),(mk_real_int (num_of_string "2120682899434171511243910"));(* 24, 24 *) +(mk_real_int (num_of_string "4922899954384169263217170")),(mk_real_int (num_of_string "2210547168277235466418080"));(* 24, 24 *) +(mk_real_int (num_of_string "2960626131797007955682674")),(mk_real_int (num_of_string "4277962918696360385898000"));(* 24, 24 *) +(mk_real_int (num_of_string "4515490547648444411084695")),(mk_real_int (num_of_string "1569887925740428924873620"));(* 24, 24 *) +(mk_real_int (num_of_string "2780763205535868959241050")),(mk_real_int (num_of_string "4056949241277091622381568"));(* 24, 24 *) +(mk_real_int (num_of_string "3201767991034105671755280")),(mk_real_int (num_of_string "2350553743997253715117197"));(* 24, 24 *) +(mk_real_int (num_of_string "3724987470309020360168472")),(mk_real_int (num_of_string "3429567734675220809454850"));(* 24, 24 *) +(mk_real_int (num_of_string "3938698149785114837545440")),(mk_real_int (num_of_string "6131169302912038822972320"));(* 24, 24 *) +(mk_real_int (num_of_string "3395710073615647174584356")),(mk_real_int (num_of_string "1678529113735920561129664"));(* 24, 24 *) +(mk_real_int (num_of_string "7269519556215240259854704")),(mk_real_int (num_of_string "3537200463244173539446542"));(* 24, 24 *) +(mk_real_int (num_of_string "4801317070771283122928748")),(mk_real_int (num_of_string "4478532737656770213917259"));(* 24, 24 *) +(mk_real_int (num_of_string "3682003573644424252035630")),(mk_real_int (num_of_string "1950885564721030069055616"));(* 24, 24 *) +(mk_real_int (num_of_string "5446965365946434393069490")),(mk_real_int (num_of_string "3065638380346793995642674"));(* 24, 24 *) +(mk_real_int (num_of_string "3414262112322264079319040")),(mk_real_int (num_of_string "3000463633367199149754996"));(* 24, 24 *) +(mk_real_int (num_of_string "3477210997651554728793548")),(mk_real_int (num_of_string "2238012569604837611287468"));(* 24, 24 *) +(mk_real_int (num_of_string "2397940080265256872376850")),(mk_real_int (num_of_string "7164284672449448711229440"));(* 24, 24 *) +(mk_real_int (num_of_string "1920225109538486329758288")),(mk_real_int (num_of_string "3782477993216083113543408"));(* 24, 24 *) +(mk_real_int (num_of_string "3384707638379139460530792")),(mk_real_int (num_of_string "3431808747319441443432500"));(* 24, 24 *) +(mk_real_int (num_of_string "2351301264311734801079126")),(mk_real_int (num_of_string "3621205301355428301129566"));(* 24, 24 *) +(mk_real_int (num_of_string "3966665035633266460679640")),(mk_real_int (num_of_string "2403421476288006422304000"));(* 24, 24 *) +(mk_real_int (num_of_string "3576887668698535447459740")),(mk_real_int (num_of_string "3581997969604934315876776"));(* 24, 24 *) +(mk_real_int (num_of_string "3409910285149697296920984")),(mk_real_int (num_of_string "6770814009080962580277120"));(* 24, 24 *) +(mk_real_int (num_of_string "2853513652481387858482800")),(mk_real_int (num_of_string "3226634307221175611848440"));(* 24, 24 *) +(mk_real_int (num_of_string "2387804176228079537570625")),(mk_real_int (num_of_string "2944513954290027755615112"));(* 24, 24 *) +(mk_real_int (num_of_string "5267300335689198610515075")),(mk_real_int (num_of_string "4604806741911951544187194"));(* 24, 24 *) +(mk_real_int (num_of_string "1420848860925426826597968")),(mk_real_int (num_of_string "1835392191899974868181876"));(* 24, 24 *) +(mk_real_int (num_of_string "1790041612902132482678016")),(mk_real_int (num_of_string "4552106763868225825287544"));(* 24, 24 *) +(mk_real_int (num_of_string "2662666647277983358115700")),(mk_real_int (num_of_string "2220933142447482545655378"));(* 24, 24 *) +(mk_real_int (num_of_string "1961018156393779549961568")),(mk_real_int (num_of_string "2372849960507874529038060"));(* 24, 24 *) +(mk_real_int (num_of_string "3880727101280308691429850")),(mk_real_int (num_of_string "2234403290226715215444800"));(* 24, 24 *) +(mk_real_int (num_of_string "2665926384817997919166038")),(mk_real_int (num_of_string "4670029254777132063838075"));(* 24, 24 *) +(mk_real_int (num_of_string "2784893193130297123610383")),(mk_real_int (num_of_string "2150499599310185288615670"));(* 24, 24 *) +(mk_real_int (num_of_string "4723188924824289143709276")),(mk_real_int (num_of_string "3294353411065339059335836"));(* 24, 24 *) +(mk_real_int (num_of_string "2232051901288524666672310")),(mk_real_int (num_of_string "4145742036523115915560100"));(* 24, 24 *) +(mk_real_int (num_of_string "1975679804277267924882144")),(mk_real_int (num_of_string "4105474903823749701919989"));(* 24, 24 *) +(mk_real_int (num_of_string "3709535969545162547261610")),(mk_real_int (num_of_string "4198147955726582801071856"));(* 24, 24 *) +(mk_real_int (num_of_string "3620705082268964290914852")),(mk_real_int (num_of_string "2103332314626327005886732"));(* 24, 24 *) +(mk_real_int (num_of_string "1795163272996691139641904")),(mk_real_int (num_of_string "2707432087412693713392320"));(* 24, 24 *) +(mk_real_int (num_of_string "2638306558357711860007368")),(mk_real_int (num_of_string "3343698657272575888420212"));(* 24, 24 *) +(mk_real_int (num_of_string "5804236556798298673488401")),(mk_real_int (num_of_string "3808867612972287446542458"));(* 24, 24 *) +(mk_real_int (num_of_string "4919864579444673212916000")),(mk_real_int (num_of_string "3934005128314766708376960"));(* 24, 24 *) +(mk_real_int (num_of_string "1982713316904837075243978")),(mk_real_int (num_of_string "3926593049218002075459447"));(* 24, 24 *) +(mk_real_int (num_of_string "3792959862968070379421784")),(mk_real_int (num_of_string "3362579390656969662430625"));(* 24, 24 *) +(mk_real_int (num_of_string "3821041820420836219652850")),(mk_real_int (num_of_string "3743947815109494850338560"));(* 24, 24 *) +(mk_real_int (num_of_string "3938038552485041028732216")),(mk_real_int (num_of_string "4045584137266871515820376"));(* 24, 24 *) +(mk_real_int (num_of_string "2737146216075827246911660")),(mk_real_int (num_of_string "3297115613654613682927737"));(* 24, 24 *) +(mk_real_int (num_of_string "2406995210541409216163248")),(mk_real_int (num_of_string "3878027943927971091008270"));(* 24, 24 *) +(mk_real_int (num_of_string "4489826540173941094254054")),(mk_real_int (num_of_string "2119573062713007906694324"));(* 24, 24 *) +(mk_real_int (num_of_string "1623531464117039382456474")),(mk_real_int (num_of_string "1962767340153793316646558"));(* 24, 24 *) +(mk_real_int (num_of_string "2617541120905243237382400")),(mk_real_int (num_of_string "2181683350452092398682400"));(* 24, 24 *) +(mk_real_int (num_of_string "4949813235338606008029006")),(mk_real_int (num_of_string "3329985822165158031421760"));(* 24, 24 *) +(mk_real_int (num_of_string "4564657810786736028348495")),(mk_real_int (num_of_string "2572809218788399316267685"));(* 24, 24 *) +(mk_real_int (num_of_string "1287104109305144498860482")),(mk_real_int (num_of_string "3936989626514460343082475"));(* 24, 24 *) +(mk_real_int (num_of_string "2229132765122414895600630")),(mk_real_int (num_of_string "2185090593767888234720250"));(* 24, 24 *) +(mk_real_int (num_of_string "5925072543326270369398024")),(mk_real_int (num_of_string "3701479351696411884047904"));(* 24, 24 *) +(mk_real_int (num_of_string "3260603732088058521412720")),(mk_real_int (num_of_string "5717955526523948542766085"));(* 24, 24 *) +(mk_real_int (num_of_string "6089704229847075956380782")),(mk_real_int (num_of_string "4515059664202322678349430"));(* 24, 24 *) +(mk_real_int (num_of_string "2384502833749125551685482")),(mk_real_int (num_of_string "4108414419814259884453278"));(* 24, 24 *) +(mk_real_int (num_of_string "5405368048938813037927320")),(mk_real_int (num_of_string "2456869728841812160987032"));(* 24, 24 *) +(mk_real_int (num_of_string "5555709118721657037229971")),(mk_real_int (num_of_string "3409353028405206474259707"));(* 24, 24 *) +(mk_real_int (num_of_string "4145770782252709682384456")),(mk_real_int (num_of_string "2576036451572432484543390"));(* 24, 24 *) +(mk_real_int (num_of_string "2578735969457993120375296")),(mk_real_int (num_of_string "2214675284593388556653280"));(* 24, 24 *) +(mk_real_int (num_of_string "2909464381868153215888320")),(mk_real_int (num_of_string "2783433524676189869221980"));(* 24, 24 *) +(mk_real_int (num_of_string "3713258512286019278592120")),(mk_real_int (num_of_string "2977028998572790794990280"));(* 24, 24 *) +(mk_real_int (num_of_string "3020180942228366640181248")),(mk_real_int (num_of_string "3028091668665965406411390"));(* 24, 24 *) +(mk_real_int (num_of_string "2245423523762357206723245")),(mk_real_int (num_of_string "3269096807990197660458300"));(* 24, 24 *) +(mk_real_int (num_of_string "2813162924485556091946560")),(mk_real_int (num_of_string "2544559305095499849311898"));(* 24, 24 *) +(mk_real_int (num_of_string "2832427062392052684809138")),(mk_real_int (num_of_string "4039434510916601495094000"));(* 24, 24 *) +(mk_real_int (num_of_string "4378371025102721431296000")),(mk_real_int (num_of_string "3657939048320779263212640"));(* 24, 24 *) +(mk_real_int (num_of_string "4107360228511938043263024")),(mk_real_int (num_of_string "4955332387692102648026776"));(* 24, 24 *) +(mk_real_int (num_of_string "5436711148146713044271760")),(mk_real_int (num_of_string "3462458821755521205760457"));(* 24, 24 *) +(mk_real_int (num_of_string "1973674305815157563069984")),(mk_real_int (num_of_string "3381651016243346007010689"));(* 24, 24 *) +(mk_real_int (num_of_string "5100495154128640720199453")),(mk_real_int (num_of_string "3482253801913287165790410"));(* 24, 24 *) +(mk_real_int (num_of_string "1785590721531524554811824")),(mk_real_int (num_of_string "3961748467234839171830760"));(* 24, 24 *) +(mk_real_int (num_of_string "2377270539951462159476760")),(mk_real_int (num_of_string "2490751406117841852125088"));(* 24, 24 *) +(mk_real_int (num_of_string "5032033308425526566524416")),(mk_real_int (num_of_string "2074464511517629504599040"));(* 24, 24 *) +(mk_real_int (num_of_string "2942469639515776623927102")),(mk_real_int (num_of_string "2733188181184590887199504"));(* 24, 24 *) +(mk_real_int (num_of_string "4802475160397610089814000")),(mk_real_int (num_of_string "3254431376162523650352000"));(* 24, 24 *) +(mk_real_int (num_of_string "2822599275376472475791796")),(mk_real_int (num_of_string "2473295846388528589497272"));(* 24, 24 *) +(mk_real_int (num_of_string "2235523287368673855433088")),(mk_real_int (num_of_string "4366579838228373670874892"));(* 24, 24 *) +(mk_real_int (num_of_string "2203413059461571553955415")),(mk_real_int (num_of_string "3499383296992796129060934"));(* 24, 24 *) +(mk_real_int (num_of_string "3325808408886736395750606")),(mk_real_int (num_of_string "2624384765439873398004900"));(* 24, 24 *) +(mk_real_int (num_of_string "3260509372546136138405628")),(mk_real_int (num_of_string "2358588018637629787499400"));(* 24, 24 *) +(mk_real_int (num_of_string "4619173444075230071480496")),(mk_real_int (num_of_string "2798743023066958575904440"));(* 24, 24 *) +(mk_real_int (num_of_string "2413757147346066310314139")),(mk_real_int (num_of_string "2828010538664101218235494"));(* 24, 24 *) +(mk_real_int (num_of_string "2695484358347008110563632")),(mk_real_int (num_of_string "3928226440296002503853488"));(* 24, 24 *) +(mk_real_int (num_of_string "2919630281131690269988101")),(mk_real_int (num_of_string "3225769195992502750565832"));(* 24, 24 *) +(mk_real_int (num_of_string "2376149228976072780840608")),(mk_real_int (num_of_string "3715412531659976389224780"));(* 24, 24 *) +(mk_real_int (num_of_string "3888077753530830891900204")),(mk_real_int (num_of_string "5885050913844627025051488"));(* 24, 24 *) +(mk_real_int (num_of_string "2358614239305339825695860")),(mk_real_int (num_of_string "5975981997528600660191504"));(* 24, 24 *) +(mk_real_int (num_of_string "2988172387270547212206900")),(mk_real_int (num_of_string "3023430170663008013906544"));(* 24, 24 *) +(mk_real_int (num_of_string "2170836060399603291778560")),(mk_real_int (num_of_string "1692497197142932054277676"));(* 24, 24 *) +(mk_real_int (num_of_string "1777433028479422333816170")),(mk_real_int (num_of_string "5231511312113085712034400"));(* 24, 24 *) +(mk_real_int (num_of_string "4545540685863518124524544")),(mk_real_int (num_of_string "3033036670141677059892135"));(* 24, 24 *) +(mk_real_int (num_of_string "5516472908525595456861200")),(mk_real_int (num_of_string "3248632421956873037497712"));(* 24, 24 *) +(mk_real_int (num_of_string "3613327732914895907590176")),(mk_real_int (num_of_string "2592430014981547702579200"));(* 24, 24 *) +(mk_real_int (num_of_string "3147164404436083703613669")),(mk_real_int (num_of_string "2822106430522611201489786"));(* 24, 24 *) +(mk_real_int (num_of_string "5092693936725943601524688")),(mk_real_int (num_of_string "2706954925707508681911264"));(* 24, 24 *) +(mk_real_int (num_of_string "3900216106407311605829369")),(mk_real_int (num_of_string "2663045715895949635736162"));(* 24, 24 *) +(mk_real_int (num_of_string "3835290235059794911341220")),(mk_real_int (num_of_string "4740597369977702371556975"));(* 24, 24 *) +(mk_real_int (num_of_string "3312020133057015667390272")),(mk_real_int (num_of_string "3524319196260443412215160"));(* 24, 24 *) +(mk_real_int (num_of_string "3654327391145566869382693")),(mk_real_int (num_of_string "2480967920402895911422050"));(* 24, 24 *) +(mk_real_int (num_of_string "3783318665094867715251116")),(mk_real_int (num_of_string "2272653547584035915986704"));(* 24, 24 *) +(mk_real_int (num_of_string "2868066409669595479299016")),(mk_real_int (num_of_string "5818741035989499701039392"));(* 24, 24 *) +(mk_real_int (num_of_string "4493180109061114521004800")),(mk_real_int (num_of_string "2201500662063176338248750"));(* 24, 24 *) +(mk_real_int (num_of_string "3686697283809323160244917")),(mk_real_int (num_of_string "4271361656546144626656624"));(* 24, 24 *) +(mk_real_int (num_of_string "4211812125317822019019200")),(mk_real_int (num_of_string "4422403566512232285695031"));(* 24, 24 *) +(mk_real_int (num_of_string "3453197614954888233295680")),(mk_real_int (num_of_string "3981929378586757323208800"));(* 24, 24 *) +(mk_real_int (num_of_string "2309247920202178729036044")),(mk_real_int (num_of_string "3208945197981154252165020"));(* 24, 24 *) +(mk_real_int (num_of_string "3306996119702008268577990")),(mk_real_int (num_of_string "4043880307983849203623320"));(* 24, 24 *) +(mk_real_int (num_of_string "2114883883410189511094202")),(mk_real_int (num_of_string "3184216904938045204263750"));(* 24, 24 *) +(mk_real_int (num_of_string "2952919714331350069363200")),(mk_real_int (num_of_string "5876412699744818216031816"));(* 24, 24 *) +(mk_real_int (num_of_string "3769437382174693707903152")),(mk_real_int (num_of_string "2565476447448203902466568"));(* 24, 24 *) +(mk_real_int (num_of_string "1725307254792804728288880")),(mk_real_int (num_of_string "2586663881894774346726160"));(* 24, 24 *) +(mk_real_int (num_of_string "2564718711812524173374118")),(mk_real_int (num_of_string "4058434081207693075361340"));(* 24, 24 *) +(mk_real_int (num_of_string "2164528533204020104909200")),(mk_real_int (num_of_string "3554466067783606087782813"));(* 24, 24 *) +(mk_real_int (num_of_string "3715414969648956770189664")),(mk_real_int (num_of_string "4244685581932290093498270"));(* 24, 24 *) +(mk_real_int (num_of_string "3894983489637785283620856")),(mk_real_int (num_of_string "5156102771400354240360960"));(* 24, 24 *) +(mk_real_int (num_of_string "4202972827934777774801550")),(mk_real_int (num_of_string "4780847702925393600007008"));(* 24, 24 *) +(mk_real_int (num_of_string "3534273337045677653475600")),(mk_real_int (num_of_string "4358009326840387400100000"));(* 24, 24 *) +(mk_real_int (num_of_string "2876651086186021980324230")),(mk_real_int (num_of_string "3243040372713434284988928"));(* 24, 24 *) +(mk_real_int (num_of_string "2962649277866019737201310")),(mk_real_int (num_of_string "2779017685801357531021029"));(* 24, 24 *) +(mk_real_int (num_of_string "2315102667320815921207020")),(mk_real_int (num_of_string "2320780188478351696079136"));(* 24, 24 *) +(mk_real_int (num_of_string "4769419908213077485693920")),(mk_real_int (num_of_string "2981852984212469912663340"));(* 24, 24 *) +(mk_real_int (num_of_string "2224859393974661825103210")),(mk_real_int (num_of_string "3440599874728666682929344"));(* 24, 24 *) +(mk_real_int (num_of_string "5570579994531868141885878")),(mk_real_int (num_of_string "3266812861307218115114880"));(* 24, 24 *) +(mk_real_int (num_of_string "3702867379759390156215762")),(mk_real_int (num_of_string "4583452938091837401961116"));(* 24, 24 *) +(mk_real_int (num_of_string "4961769494404693175839944")),(mk_real_int (num_of_string "1530926530580760797685396"));(* 24, 24 *) +(mk_real_int (num_of_string "5728049929213352197190729")),(mk_real_int (num_of_string "1674598136405635762453360"));(* 24, 24 *) +(mk_real_int (num_of_string "4030621484894723831061348")),(mk_real_int (num_of_string "2596532216129821520493012"));(* 24, 24 *) +(mk_real_int (num_of_string "1959873204216208801370634")),(mk_real_int (num_of_string "3597842466443105716862362"));(* 24, 24 *) +(mk_real_int (num_of_string "3606904156095963174553056")),(mk_real_int (num_of_string "2238210053805009608920750"));(* 24, 24 *) +(mk_real_int (num_of_string "3303581287385676756784584")),(mk_real_int (num_of_string "3710070051538617133078400"));(* 24, 24 *) +(mk_real_int (num_of_string "3418027510405129534912656")),(mk_real_int (num_of_string "1688154262729905202044835"));(* 24, 24 *) +(mk_real_int (num_of_string "3619520797540224475800720")),(mk_real_int (num_of_string "3672680730965811639295452"));(* 24, 24 *) +(mk_real_int (num_of_string "5147246259164789444371168")),(mk_real_int (num_of_string "4721548755435949530244368"));(* 24, 24 *) +(mk_real_int (num_of_string "1587840210917553115963960")),(mk_real_int (num_of_string "4134439520367555380790900"));(* 24, 24 *) +(mk_real_int (num_of_string "2298913907225147087675904")),(mk_real_int (num_of_string "3702059809571200553981451"));(* 24, 24 *) +(mk_real_int (num_of_string "5038129334873223844896480")),(mk_real_int (num_of_string "3167451495583167355735392"));(* 24, 24 *) +(mk_real_int (num_of_string "3927939034696373890546500")),(mk_real_int (num_of_string "6707521950665622965364860"));(* 24, 24 *) +(mk_real_int (num_of_string "1809267405475279111804125")),(mk_real_int (num_of_string "4609466476527470391867384"));(* 24, 24 *) +(mk_real_int (num_of_string "4343752201291146716793264")),(mk_real_int (num_of_string "1678315295630693446162725"));(* 24, 24 *) +(mk_real_int (num_of_string "4326453917791671479075766")),(mk_real_int (num_of_string "3386238587309411180302592"));(* 24, 24 *) +(mk_real_int (num_of_string "3463794959208334625692950")),(mk_real_int (num_of_string "2287753439110638256405725"));(* 24, 24 *) +(mk_real_int (num_of_string "3951828146691454281710120")),(mk_real_int (num_of_string "2062122695737615799021800"));(* 24, 24 *) +(mk_real_int (num_of_string "3332828738831289645253376")),(mk_real_int (num_of_string "2648144126603704627173920"));(* 24, 24 *) +(mk_real_int (num_of_string "2976001482854194300322520")),(mk_real_int (num_of_string "2887672701324693956534136"));(* 24, 24 *) +(mk_real_int (num_of_string "2339574252864327339429036")),(mk_real_int (num_of_string "2716969298024328512570496"));(* 24, 24 *) +(mk_real_int (num_of_string "1342205009418183992000645")),(mk_real_int (num_of_string "1767287736407958173765928"));(* 24, 24 *) +(mk_real_int (num_of_string "2910934451193965633979360")),(mk_real_int (num_of_string "5545846909531323260812125"));(* 24, 24 *) +(mk_real_int (num_of_string "2766460280062310813937150")),(mk_real_int (num_of_string "1823557519392735790550250"));(* 24, 24 *) +(mk_real_int (num_of_string "4100883438249583081441710")),(mk_real_int (num_of_string "3776536579466850444434280"));(* 24, 24 *) +(mk_real_int (num_of_string "2754484322605026848424000")),(mk_real_int (num_of_string "2749548253558153043748972"));(* 24, 24 *) +(mk_real_int (num_of_string "5036176523451903716835180")),(mk_real_int (num_of_string "1699964541630268639030846"));(* 24, 24 *) +(mk_real_int (num_of_string "2892457261261515275295072")),(mk_real_int (num_of_string "4737917348249117366382312"));(* 24, 24 *) +(mk_real_int (num_of_string "2655694368730650145334590")),(mk_real_int (num_of_string "5696705810378435054007260"));(* 24, 24 *) +(mk_real_int (num_of_string "2125567616064901984112280")),(mk_real_int (num_of_string "3123401016848598207609624"));(* 24, 24 *) +(mk_real_int (num_of_string "3287532167806442593083696")),(mk_real_int (num_of_string "2851872329541967808088576"));(* 24, 24 *) +(mk_real_int (num_of_string "2110665688856826063982782")),(mk_real_int (num_of_string "4359365146595490694185540"));(* 24, 24 *) +(mk_real_int (num_of_string "2742026171037757323496686")),(mk_real_int (num_of_string "4362951065920148256473655"));(* 24, 24 *) +(mk_real_int (num_of_string "4863996158579315945245404")),(mk_real_int (num_of_string "4661861974837787998583364"));(* 24, 24 *) +(mk_real_int (num_of_string "3137416017688025588209824")),(mk_real_int (num_of_string "1668417247566880818800520"));(* 24, 24 *) +(mk_real_int (num_of_string "2512930687725718356136740")),(mk_real_int (num_of_string "2747490826835787651045760"));(* 24, 24 *) +(mk_real_int (num_of_string "3616727227753120896449790")),(mk_real_int (num_of_string "2138011821151658288097768"));(* 24, 24 *) +(mk_real_int (num_of_string "4303695870465698777856430")),(mk_real_int (num_of_string "3694352795099709117822550"));(* 24, 24 *) +(mk_real_int (num_of_string "2494545587403306610705536")),(mk_real_int (num_of_string "2127047713718586637502335"));(* 24, 24 *) +(mk_real_int (num_of_string "3682937230425044571950100")),(mk_real_int (num_of_string "2787744343394529734604480"));(* 24, 24 *) +(mk_real_int (num_of_string "2720270054035519760933676")),(mk_real_int (num_of_string "1537723295890870892974842"));(* 24, 24 *) +(mk_real_int (num_of_string "4414287224158656730131960")),(mk_real_int (num_of_string "3338820563844857835947284"));(* 24, 24 *) +(mk_real_int (num_of_string "2947712174379402686492152")),(mk_real_int (num_of_string "4278192782495224843027880"));(* 24, 24 *) +(mk_real_int (num_of_string "4254423812842316074921620")),(mk_real_int (num_of_string "5219242672484446856517176"));(* 24, 24 *) +(mk_real_int (num_of_string "2708337926429271288652500")),(mk_real_int (num_of_string "5602515023082664412274073"));(* 24, 24 *) +(mk_real_int (num_of_string "2302230306760603549763640")),(mk_real_int (num_of_string "2616129890348013967167500"));(* 24, 24 *) +(mk_real_int (num_of_string "1537358313649027006915704")),(mk_real_int (num_of_string "3372255058869903855117700"));(* 24, 24 *) +(mk_real_int (num_of_string "2158655391931110381138900")),(mk_real_int (num_of_string "3901648623382268125529625"));(* 24, 24 *) +(mk_real_int (num_of_string "4342147892965040556893040")),(mk_real_int (num_of_string "3233451713602589098425882"));(* 24, 24 *) +(mk_real_int (num_of_string "3254852446790581775575104")),(mk_real_int (num_of_string "2677496538692408692259712"));(* 24, 24 *) +(mk_real_int (num_of_string "2237469021625840187917212")),(mk_real_int (num_of_string "4513488210547085890888443"));(* 24, 24 *) +(mk_real_int (num_of_string "1320275598306020347281600")),(mk_real_int (num_of_string "2744191177715610186507240"));(* 24, 24 *) +(mk_real_int (num_of_string "4109151232557266907816274")),(mk_real_int (num_of_string "4078720687200976153502208"));(* 24, 24 *) +(mk_real_int (num_of_string "4627556064035690169000640")),(mk_real_int (num_of_string "2295629471442102948430740"));(* 24, 24 *) +(mk_real_int (num_of_string "5705707060863012855675640")),(mk_real_int (num_of_string "3600579587450037335729750"));(* 24, 24 *) +(mk_real_int (num_of_string "2512009315950533338457262")),(mk_real_int (num_of_string "3856225045003292468481856"));(* 24, 24 *) +(mk_real_int (num_of_string "2648739216290917247056260")),(mk_real_int (num_of_string "2936601590951541845798784"));(* 24, 24 *) +(mk_real_int (num_of_string "2232576509693201100223613")),(mk_real_int (num_of_string "2144203956355167208472640"));(* 24, 24 *) +(mk_real_int (num_of_string "3485290359254877392280516")),(mk_real_int (num_of_string "5164458804685245700298664"));(* 24, 24 *) +(mk_real_int (num_of_string "4589346462453793817801760")),(mk_real_int (num_of_string "2570339389505226238620500"));(* 24, 24 *) +(mk_real_int (num_of_string "3577299554424904964502000")),(mk_real_int (num_of_string "2453132876981940048243040"));(* 24, 24 *) +(mk_real_int (num_of_string "2821415976668630024164800")),(mk_real_int (num_of_string "3420474992854736708683800"));(* 24, 24 *) +(mk_real_int (num_of_string "2638281059685931705348992")),(mk_real_int (num_of_string "3685876682481139319385912"));(* 24, 24 *) +(mk_real_int (num_of_string "3288519757711992769327512")),(mk_real_int (num_of_string "4788799194591744602098176"));(* 24, 24 *) +(mk_real_int (num_of_string "3448817412865831747744094")),(mk_real_int (num_of_string "2124311349303453010783040"));(* 24, 24 *) +(mk_real_int (num_of_string "2888779820320927016269344")),(mk_real_int (num_of_string "4128675689816007977969286"));(* 24, 24 *) +(mk_real_int (num_of_string "3404877808696273119002760")),(mk_real_int (num_of_string "1906108502880491124119838"));(* 24, 24 *) +(mk_real_int (num_of_string "2190451096354080482571936")),(mk_real_int (num_of_string "3576305198241671999417616"));(* 24, 24 *) +(mk_real_int (num_of_string "2441200367118636213536160")),(mk_real_int (num_of_string "2672304135402470260824000"));(* 24, 24 *) +(mk_real_int (num_of_string "3326727360510639992269440")),(mk_real_int (num_of_string "1961461577056323085459425"));(* 24, 24 *) +(mk_real_int (num_of_string "4263600999060083935558530")),(mk_real_int (num_of_string "4378371892121763599484330"));(* 24, 24 *) +(mk_real_int (num_of_string "3748153850584594227473130")),(mk_real_int (num_of_string "1557284326681534509318624"));(* 24, 24 *) +(mk_real_int (num_of_string "2469809458998362194654824")),(mk_real_int (num_of_string "6912788990497862893419600"));(* 24, 24 *) +(mk_real_int (num_of_string "2818097446806456188455488")),(mk_real_int (num_of_string "2167770862817991712100925"));(* 24, 24 *) +(mk_real_int (num_of_string "3193419136316652676056816")),(mk_real_int (num_of_string "3911625964183102903830612"));(* 24, 24 *) +(mk_real_int (num_of_string "2943657912454805692644960")),(mk_real_int (num_of_string "3160927903601250883354740"));(* 24, 24 *) +(mk_real_int (num_of_string "3222906674062661871231600")),(mk_real_int (num_of_string "2332586263197962852507280"));(* 24, 24 *) +(mk_real_int (num_of_string "4395367582168534571730720")),(mk_real_int (num_of_string "2075983426514422491067008"));(* 24, 24 *) +(mk_real_int (num_of_string "2680310325131737754123008")),(mk_real_int (num_of_string "5313344674862935615826376"));(* 24, 24 *) +(mk_real_int (num_of_string "2400783642560516195403008")),(mk_real_int (num_of_string "3797847089617501345976980"));(* 24, 24 *) +(mk_real_int (num_of_string "4349134886787057589046400")),(mk_real_int (num_of_string "4586079373474017047798165"));(* 24, 24 *) +(mk_real_int (num_of_string "4035209671948663295473170")),(mk_real_int (num_of_string "4356048796728341564364240"));(* 24, 24 *) +(mk_real_int (num_of_string "3359158829624252194267245")),(mk_real_int (num_of_string "2929367238232639926426705"));(* 24, 24 *) +(mk_real_int (num_of_string "2626290274520999296736960")),(mk_real_int (num_of_string "4945570001369515265328000"));(* 24, 24 *) +(mk_real_int (num_of_string "3949980592347107785324032")),(mk_real_int (num_of_string "3285770590740332520317655"));(* 24, 24 *) +(mk_real_int (num_of_string "2642773478317706561247162")),(mk_real_int (num_of_string "2357569242797715689704650"));(* 24, 24 *) +(mk_real_int (num_of_string "3122646690974100178156224")),(mk_real_int (num_of_string "3864496600517377628878248"));(* 24, 24 *) +(mk_real_int (num_of_string "2535202946841047191355985")),(mk_real_int (num_of_string "2477935283344861968563395"));(* 24, 24 *) +(mk_real_int (num_of_string "3303395926186846593897398")),(mk_real_int (num_of_string "2458180965729213074954838"));(* 24, 24 *) +(mk_real_int (num_of_string "3354108602123950392214192")),(mk_real_int (num_of_string "3824842894885232790649800"));(* 24, 24 *) +(mk_real_int (num_of_string "2851106936796166829209552")),(mk_real_int (num_of_string "2718844796718048849545000"));(* 24, 24 *) +(mk_real_int (num_of_string "1412301700970928036501408")),(mk_real_int (num_of_string "4571010725399186056084800"));(* 24, 24 *) +(mk_real_int (num_of_string "2943008909352395049428200")),(mk_real_int (num_of_string "5339336864040083969300796"));(* 24, 24 *) +(mk_real_int (num_of_string "3306884160074212578966688")),(mk_real_int (num_of_string "1872637144586289356949102"));(* 24, 24 *) +(mk_real_int (num_of_string "3256048419850881635016465")),(mk_real_int (num_of_string "2144011085305109275574046"));(* 24, 24 *) +(mk_real_int (num_of_string "2596680805310662290917536")),(mk_real_int (num_of_string "2450421608490904185046404"));(* 24, 24 *) +(mk_real_int (num_of_string "3231793758224635065307064")),(mk_real_int (num_of_string "3958858457346781103547432"));(* 24, 24 *) +(mk_real_int (num_of_string "2405283204226616686936782")),(mk_real_int (num_of_string "2808013476135148272769050"));(* 24, 24 *) +(mk_real_int (num_of_string "3763338878733490155287088")),(mk_real_int (num_of_string "4229089053686137795765529"));(* 24, 24 *) +(mk_real_int (num_of_string "4237755514000042767533712")),(mk_real_int (num_of_string "2119446998743577750160060"));(* 24, 24 *) +(mk_real_int (num_of_string "3464368637930585367397272")),(mk_real_int (num_of_string "2381047749608364820766772"));(* 24, 24 *) +(mk_real_int (num_of_string "4308206451438940458440200")),(mk_real_int (num_of_string "3486250458148780127868816"));(* 24, 24 *) +(mk_real_int (num_of_string "4469654659212523366872060")),(mk_real_int (num_of_string "3840229627895342265878160"));(* 24, 24 *) +(mk_real_int (num_of_string "3416200316785701597352704")),(mk_real_int (num_of_string "2538542568128120877270304"));(* 24, 24 *) +(mk_real_int (num_of_string "3507661181366145790378624")),(mk_real_int (num_of_string "1985547392333058157459268"));(* 24, 24 *) +(mk_real_int (num_of_string "2523240153211810712705720")),(mk_real_int (num_of_string "3186005370171745416754800"));(* 24, 24 *) +(mk_real_int (num_of_string "5099310704830201900730400")),(mk_real_int (num_of_string "2354957348375111252550498"));(* 24, 24 *) +(mk_real_int (num_of_string "5617590437227126220070912")),(mk_real_int (num_of_string "3463090614554593525898430"));(* 24, 24 *) +(mk_real_int (num_of_string "1862730819885660183684836")),(mk_real_int (num_of_string "1829736289222505028470352"));(* 24, 24 *) +(mk_real_int (num_of_string "4056516438924446098756200")),(mk_real_int (num_of_string "1757954110460545441766674"));(* 24, 24 *) +(mk_real_int (num_of_string "2232607912150261722342084")),(mk_real_int (num_of_string "2821288893414261004574073"));(* 24, 24 *) +(mk_real_int (num_of_string "2988962662354245548345400")),(mk_real_int (num_of_string "3712288679813144811733080"));(* 24, 24 *) +(mk_real_int (num_of_string "3110427272209884951787827")),(mk_real_int (num_of_string "1756662262853453142346110"));(* 24, 24 *) +(mk_real_int (num_of_string "2933081616472425876964928")),(mk_real_int (num_of_string "2417207810796129056501460"));(* 24, 24 *) +(mk_real_int (num_of_string "4326377389804058370593904")),(mk_real_int (num_of_string "3559771865194749564087728"));(* 24, 24 *) +(mk_real_int (num_of_string "3908363773138263442414530")),(mk_real_int (num_of_string "2973518378970102660971850"));(* 24, 24 *) +(mk_real_int (num_of_string "3219859556143144901406900")),(mk_real_int (num_of_string "3114906364850162011899660"));(* 24, 24 *) +(mk_real_int (num_of_string "5825462004324264073160545")),(mk_real_int (num_of_string "2870458302900478487665520"));(* 24, 24 *) +(mk_real_int (num_of_string "1990027583394633358454016")),(mk_real_int (num_of_string "4495044219884939828842224"))(* 24, 24 *) +];; diff --git a/formal_lp/old/arith/tests/arith_test_data27.hl b/formal_lp/old/arith/tests/arith_test_data27.hl new file mode 100644 index 0000000..f460954 --- /dev/null +++ b/formal_lp/old/arith/tests/arith_test_data27.hl @@ -0,0 +1,1002 @@ +let data = [ +(mk_real_int (num_of_string "122296604108918879616753777")),(mk_real_int (num_of_string "239583034835457602457170160"));(* 26, 26 *) +(mk_real_int (num_of_string "116945034742723939605374625")),(mk_real_int (num_of_string "125034640094443853206382950"));(* 26, 26 *) +(mk_real_int (num_of_string "256159296716627591337252993")),(mk_real_int (num_of_string "29686298930505441130550938"));(* 26, 25 *) +(mk_real_int (num_of_string "211310562458108613257922016")),(mk_real_int (num_of_string "22602159551554455880029660"));(* 26, 25 *) +(mk_real_int (num_of_string "201429551492824537118121130")),(mk_real_int (num_of_string "52092940603790257161777945"));(* 26, 25 *) +(mk_real_int (num_of_string "54519196153497193827457860")),(mk_real_int (num_of_string "224133888884095562962826880"));(* 25, 26 *) +(mk_real_int (num_of_string "5849599436337919403873424")),(mk_real_int (num_of_string "235227762937248968939586600"));(* 24, 26 *) +(mk_real_int (num_of_string "10967558299264651634687060")),(mk_real_int (num_of_string "329615692237334853724105492"));(* 25, 26 *) +(mk_real_int (num_of_string "20141123268528643579807125")),(mk_real_int (num_of_string "143819191598285367979484040"));(* 25, 26 *) +(mk_real_int (num_of_string "146902580132601563038105243")),(mk_real_int (num_of_string "412617302837237033041285431"));(* 26, 26 *) +(mk_real_int (num_of_string "11816007093635777330403222")),(mk_real_int (num_of_string "673075921862048121915357255"));(* 25, 26 *) +(mk_real_int (num_of_string "109588668779355489159457021")),(mk_real_int (num_of_string "87236743533416743592416552"));(* 26, 25 *) +(mk_real_int (num_of_string "342243394955806544573536461")),(mk_real_int (num_of_string "58699938997035262302742080"));(* 26, 25 *) +(mk_real_int (num_of_string "61447529885311484152274520")),(mk_real_int (num_of_string "29352403770943713801710184"));(* 25, 25 *) +(mk_real_int (num_of_string "249447635048403630529305066")),(mk_real_int (num_of_string "515635526938046418542763984"));(* 26, 26 *) +(mk_real_int (num_of_string "91984661280919854644641920")),(mk_real_int (num_of_string "99438823449764306228010000"));(* 25, 25 *) +(mk_real_int (num_of_string "114056446535802862628551308")),(mk_real_int (num_of_string "8873922455091604177476908"));(* 26, 24 *) +(mk_real_int (num_of_string "38900382230806030194676962")),(mk_real_int (num_of_string "185027347257370294393846710"));(* 25, 26 *) +(mk_real_int (num_of_string "38888182784457895443259744")),(mk_real_int (num_of_string "15200410026967886428789476"));(* 25, 25 *) +(mk_real_int (num_of_string "16373330744761859255164820")),(mk_real_int (num_of_string "238707921968378468710053180"));(* 25, 26 *) +(mk_real_int (num_of_string "516653761295347857092340")),(mk_real_int (num_of_string "37358403966703003792941150"));(* 23, 25 *) +(mk_real_int (num_of_string "265708146265094666098978776")),(mk_real_int (num_of_string "102516874289417821378184644"));(* 26, 26 *) +(mk_real_int (num_of_string "25650219831860326736947584")),(mk_real_int (num_of_string "85337322043862134194142480"));(* 25, 25 *) +(mk_real_int (num_of_string "10105610394265413219412542")),(mk_real_int (num_of_string "262445381834386046609943840"));(* 25, 26 *) +(mk_real_int (num_of_string "88308250498239930013115736")),(mk_real_int (num_of_string "72031612659799292252853360"));(* 25, 25 *) +(mk_real_int (num_of_string "9688922093748114564603426")),(mk_real_int (num_of_string "149521565948861149253524623"));(* 24, 26 *) +(mk_real_int (num_of_string "464348133595924675245309415")),(mk_real_int (num_of_string "25921289950470066579882210"));(* 26, 25 *) +(mk_real_int (num_of_string "45975417098065808839903950")),(mk_real_int (num_of_string "289030250219264603957007360"));(* 25, 26 *) +(mk_real_int (num_of_string "311472398931595271142697200")),(mk_real_int (num_of_string "9391873965493630587272120"));(* 26, 24 *) +(mk_real_int (num_of_string "6930039198194761258206675")),(mk_real_int (num_of_string "15665014657933557411415752"));(* 24, 25 *) +(mk_real_int (num_of_string "7051585105275031454201178")),(mk_real_int (num_of_string "4890103428669738702716412"));(* 24, 24 *) +(mk_real_int (num_of_string "320586921822317611308714384")),(mk_real_int (num_of_string "4665234470258224233623410"));(* 26, 24 *) +(mk_real_int (num_of_string "239009267491273723119988620")),(mk_real_int (num_of_string "244047522691363527842116950"));(* 26, 26 *) +(mk_real_int (num_of_string "773412347805877673800530000")),(mk_real_int (num_of_string "6015077155519403838909345"));(* 26, 24 *) +(mk_real_int (num_of_string "169451911826965369400274450")),(mk_real_int (num_of_string "400214814225619489601757984"));(* 26, 26 *) +(mk_real_int (num_of_string "11486196825068175613232850")),(mk_real_int (num_of_string "13730348576841391955840800"));(* 25, 25 *) +(mk_real_int (num_of_string "10805944849879881845595456")),(mk_real_int (num_of_string "116285726927571637536507360"));(* 25, 26 *) +(mk_real_int (num_of_string "35672973776438726812750848")),(mk_real_int (num_of_string "6979229980509338537479824"));(* 25, 24 *) +(mk_real_int (num_of_string "167956383021033967532182890")),(mk_real_int (num_of_string "78815429387373319861721200"));(* 26, 25 *) +(mk_real_int (num_of_string "55592270499273006069003004")),(mk_real_int (num_of_string "115689099802068224390875296"));(* 25, 26 *) +(mk_real_int (num_of_string "239377923715190559271364439")),(mk_real_int (num_of_string "1071478132300090860323496"));(* 26, 24 *) +(mk_real_int (num_of_string "7585018042065708905106006")),(mk_real_int (num_of_string "1917908528926199082346920"));(* 24, 24 *) +(mk_real_int (num_of_string "42795227065171440418528200")),(mk_real_int (num_of_string "130417754766803596489348320"));(* 25, 26 *) +(mk_real_int (num_of_string "577988343855988237130322384")),(mk_real_int (num_of_string "186779197477012548344362440"));(* 26, 26 *) +(mk_real_int (num_of_string "264678339276426421225228140")),(mk_real_int (num_of_string "168232611913624945346307725"));(* 26, 26 *) +(mk_real_int (num_of_string "30193748763728812301288706")),(mk_real_int (num_of_string "119058203192438357720745600"));(* 25, 26 *) +(mk_real_int (num_of_string "964603332521121539295504")),(mk_real_int (num_of_string "82856398064672208460860660"));(* 23, 25 *) +(mk_real_int (num_of_string "213716681894556831842914832")),(mk_real_int (num_of_string "73146463180354547841908520"));(* 26, 25 *) +(mk_real_int (num_of_string "280903518840595529637599808")),(mk_real_int (num_of_string "36183357905839146617833152"));(* 26, 25 *) +(mk_real_int (num_of_string "205641314336110954224319632")),(mk_real_int (num_of_string "5930501169851541784159311"));(* 26, 24 *) +(mk_real_int (num_of_string "27607540673294163577200000")),(mk_real_int (num_of_string "163608860944099539066640646"));(* 25, 26 *) +(mk_real_int (num_of_string "65764990937679944781780525")),(mk_real_int (num_of_string "6124567987017197694936624"));(* 25, 24 *) +(mk_real_int (num_of_string "31423914558922212661979680")),(mk_real_int (num_of_string "34420177802591330729427251"));(* 25, 25 *) +(mk_real_int (num_of_string "6546495229193988932848980")),(mk_real_int (num_of_string "30081208215835147716322692"));(* 24, 25 *) +(mk_real_int (num_of_string "235186824270729261295613586")),(mk_real_int (num_of_string "88283497639442829956624860"));(* 26, 25 *) +(mk_real_int (num_of_string "679879289035623425822645920")),(mk_real_int (num_of_string "149033570404548009950170056"));(* 26, 26 *) +(mk_real_int (num_of_string "70819284950622441494899200")),(mk_real_int (num_of_string "108527492648313858039168440"));(* 25, 26 *) +(mk_real_int (num_of_string "380875336309314936818341200")),(mk_real_int (num_of_string "93531958806085761208141650"));(* 26, 25 *) +(mk_real_int (num_of_string "193845850035680127763097100")),(mk_real_int (num_of_string "169972048797193342777184630"));(* 26, 26 *) +(mk_real_int (num_of_string "48373371773342715081888475")),(mk_real_int (num_of_string "42551853821775032790271860"));(* 25, 25 *) +(mk_real_int (num_of_string "274290436949962761853372936")),(mk_real_int (num_of_string "258074625667727298015429360"));(* 26, 26 *) +(mk_real_int (num_of_string "6984792919539593522620650")),(mk_real_int (num_of_string "319142462240555824876094691"));(* 24, 26 *) +(mk_real_int (num_of_string "137436429614148856052824900")),(mk_real_int (num_of_string "18122163124518259529480784"));(* 26, 25 *) +(mk_real_int (num_of_string "33856855454038965363529125")),(mk_real_int (num_of_string "11654878023885061460206140"));(* 25, 25 *) +(mk_real_int (num_of_string "18520676608993509653080560")),(mk_real_int (num_of_string "6486267997167307423986912"));(* 25, 24 *) +(mk_real_int (num_of_string "149459752858712606316542736")),(mk_real_int (num_of_string "15233082797907839615775360"));(* 26, 25 *) +(mk_real_int (num_of_string "32596301636061327721582740")),(mk_real_int (num_of_string "12517903918470482054187292"));(* 25, 25 *) +(mk_real_int (num_of_string "26964931195905096342972603")),(mk_real_int (num_of_string "25659752736978568289826836"));(* 25, 25 *) +(mk_real_int (num_of_string "137371439903019016490168779")),(mk_real_int (num_of_string "48719844056903214770967980"));(* 26, 25 *) +(mk_real_int (num_of_string "5170760341507459021209615")),(mk_real_int (num_of_string "285910168967261127184174240"));(* 24, 26 *) +(mk_real_int (num_of_string "30326942514639785867733660")),(mk_real_int (num_of_string "8145193420627196408048640"));(* 25, 24 *) +(mk_real_int (num_of_string "414751282640045513467056920")),(mk_real_int (num_of_string "106953336452550372369574780"));(* 26, 26 *) +(mk_real_int (num_of_string "278800810580715558302832600")),(mk_real_int (num_of_string "111065220126607028432625284"));(* 26, 26 *) +(mk_real_int (num_of_string "296673180910697285946316485")),(mk_real_int (num_of_string "8277381122126293975961664"));(* 26, 24 *) +(mk_real_int (num_of_string "23587019090014470423090492")),(mk_real_int (num_of_string "254399069989333800236141424"));(* 25, 26 *) +(mk_real_int (num_of_string "205040832735555207694113510")),(mk_real_int (num_of_string "37142148734658265092449130"));(* 26, 25 *) +(mk_real_int (num_of_string "479182093798690489170020252")),(mk_real_int (num_of_string "15335961652195726447514240"));(* 26, 25 *) +(mk_real_int (num_of_string "391291462717706087293628988")),(mk_real_int (num_of_string "36793310848265802287142840"));(* 26, 25 *) +(mk_real_int (num_of_string "163554931019212560730838880")),(mk_real_int (num_of_string "88131965722697304757320720"));(* 26, 25 *) +(mk_real_int (num_of_string "21892085081322067791687640")),(mk_real_int (num_of_string "76236459557918426484061890"));(* 25, 25 *) +(mk_real_int (num_of_string "168452709915087795183456960")),(mk_real_int (num_of_string "450466494317901078761194416"));(* 26, 26 *) +(mk_real_int (num_of_string "148107148078634853734210256")),(mk_real_int (num_of_string "33539540299555915477678584"));(* 26, 25 *) +(mk_real_int (num_of_string "1777727230405376624032500")),(mk_real_int (num_of_string "352476769077679752975470040"));(* 24, 26 *) +(mk_real_int (num_of_string "273806574280534970304870276")),(mk_real_int (num_of_string "22601499843669729020881920"));(* 26, 25 *) +(mk_real_int (num_of_string "3177165815192737814394621")),(mk_real_int (num_of_string "3274242796491171245437200"));(* 24, 24 *) +(mk_real_int (num_of_string "306356941048511609779406202")),(mk_real_int (num_of_string "407182235348746786554812979"));(* 26, 26 *) +(mk_real_int (num_of_string "426089330439666827408413020")),(mk_real_int (num_of_string "28283577559211813428556274"));(* 26, 25 *) +(mk_real_int (num_of_string "45487144490236685427975002")),(mk_real_int (num_of_string "236583708919837816320407676"));(* 25, 26 *) +(mk_real_int (num_of_string "52844727384797157888661170")),(mk_real_int (num_of_string "45700575411275219201452378"));(* 25, 25 *) +(mk_real_int (num_of_string "198142286574291102622697085")),(mk_real_int (num_of_string "5967205562600088616678338"));(* 26, 24 *) +(mk_real_int (num_of_string "52758260168618325324972696")),(mk_real_int (num_of_string "7301552728728367975178570"));(* 25, 24 *) +(mk_real_int (num_of_string "202297732544125539523288944")),(mk_real_int (num_of_string "17538288369944641688777856"));(* 26, 25 *) +(mk_real_int (num_of_string "351512252394655059153856936")),(mk_real_int (num_of_string "120728778635979249240259440"));(* 26, 26 *) +(mk_real_int (num_of_string "94830911181927748425538656")),(mk_real_int (num_of_string "222681128727303434175159060"));(* 25, 26 *) +(mk_real_int (num_of_string "18586076205336951289408560")),(mk_real_int (num_of_string "24068502512141965762490900"));(* 25, 25 *) +(mk_real_int (num_of_string "3181526704162247758424856")),(mk_real_int (num_of_string "29557513766521654550747760"));(* 24, 25 *) +(mk_real_int (num_of_string "46959178587563069038963368")),(mk_real_int (num_of_string "288790027821147791750074254"));(* 25, 26 *) +(mk_real_int (num_of_string "13575613573968363115898112")),(mk_real_int (num_of_string "80189754192456666015806324"));(* 25, 25 *) +(mk_real_int (num_of_string "37405442283405685594460928")),(mk_real_int (num_of_string "100197995659768405914262880"));(* 25, 26 *) +(mk_real_int (num_of_string "35655023341524545254275108")),(mk_real_int (num_of_string "12243096216892745827677600"));(* 25, 25 *) +(mk_real_int (num_of_string "7917958776144735309696480")),(mk_real_int (num_of_string "59424838177718067061998432"));(* 24, 25 *) +(mk_real_int (num_of_string "186629399414377955116382484")),(mk_real_int (num_of_string "2711972984221348107107925"));(* 26, 24 *) +(mk_real_int (num_of_string "180616296329587638628430400")),(mk_real_int (num_of_string "3751353127992333167608280"));(* 26, 24 *) +(mk_real_int (num_of_string "17001106507386701740652496")),(mk_real_int (num_of_string "463383521709868689942674496"));(* 25, 26 *) +(mk_real_int (num_of_string "38351551619723864678373800")),(mk_real_int (num_of_string "29135018552152178721431025"));(* 25, 25 *) +(mk_real_int (num_of_string "145760287695241769690288904")),(mk_real_int (num_of_string "556599499095128133823565376"));(* 26, 26 *) +(mk_real_int (num_of_string "38764141869006054397795392")),(mk_real_int (num_of_string "286488447731058847244522112"));(* 25, 26 *) +(mk_real_int (num_of_string "103037027003207435398754348")),(mk_real_int (num_of_string "183488774591362279029739098"));(* 26, 26 *) +(mk_real_int (num_of_string "13040587597488257446325004")),(mk_real_int (num_of_string "13029876036871373976400500"));(* 25, 25 *) +(mk_real_int (num_of_string "88923590459786533250887776")),(mk_real_int (num_of_string "312305367666090840527632608"));(* 25, 26 *) +(mk_real_int (num_of_string "1378621545674061638029899")),(mk_real_int (num_of_string "16835131013553370128016960"));(* 24, 25 *) +(mk_real_int (num_of_string "157651619354455521985757760")),(mk_real_int (num_of_string "4685875316911634091501024"));(* 26, 24 *) +(mk_real_int (num_of_string "41983181291678131184428511")),(mk_real_int (num_of_string "54554767774872291130512"));(* 25, 22 *) +(mk_real_int (num_of_string "73948104126967151252655918")),(mk_real_int (num_of_string "11937856765363411200549492"));(* 25, 25 *) +(mk_real_int (num_of_string "2519336180493844902297600")),(mk_real_int (num_of_string "162332595602835222812713440"));(* 24, 26 *) +(mk_real_int (num_of_string "36190062254479271100341925")),(mk_real_int (num_of_string "25372813951963902310685505"));(* 25, 25 *) +(mk_real_int (num_of_string "164735298270801827011478560")),(mk_real_int (num_of_string "341453810953050156673488827"));(* 26, 26 *) +(mk_real_int (num_of_string "112078046223133398245013516")),(mk_real_int (num_of_string "130502437785361915166995056"));(* 26, 26 *) +(mk_real_int (num_of_string "80563919988599768472620715")),(mk_real_int (num_of_string "153085940093280942460979200"));(* 25, 26 *) +(mk_real_int (num_of_string "10317190683828147549033898")),(mk_real_int (num_of_string "42948033370534452404223096"));(* 25, 25 *) +(mk_real_int (num_of_string "254651577115191268844484288")),(mk_real_int (num_of_string "155384549986315862060215780"));(* 26, 26 *) +(mk_real_int (num_of_string "277319039435137429054579548")),(mk_real_int (num_of_string "221230866080980092766290530"));(* 26, 26 *) +(mk_real_int (num_of_string "4363842981461224343337600")),(mk_real_int (num_of_string "569821164924757584189846000"));(* 24, 26 *) +(mk_real_int (num_of_string "124113784226014765047403200")),(mk_real_int (num_of_string "1258860931580921878349841"));(* 26, 24 *) +(mk_real_int (num_of_string "53460451206916873643632626")),(mk_real_int (num_of_string "56208279601058221102301820"));(* 25, 25 *) +(mk_real_int (num_of_string "10862370499164598507832538")),(mk_real_int (num_of_string "192745386228048481691803408"));(* 25, 26 *) +(mk_real_int (num_of_string "4106008388722064473339152")),(mk_real_int (num_of_string "358297002439618415107600686"));(* 24, 26 *) +(mk_real_int (num_of_string "27419318980412410993175520")),(mk_real_int (num_of_string "80202736827797959263657860"));(* 25, 25 *) +(mk_real_int (num_of_string "47251968512513000135215680")),(mk_real_int (num_of_string "461200816990601812603354260"));(* 25, 26 *) +(mk_real_int (num_of_string "52960240373937217529946206")),(mk_real_int (num_of_string "74674198190313753938790510"));(* 25, 25 *) +(mk_real_int (num_of_string "6154112385062118049435800")),(mk_real_int (num_of_string "57525673380509137850275880"));(* 24, 25 *) +(mk_real_int (num_of_string "763025564928732901778520")),(mk_real_int (num_of_string "166847255806675895511511680"));(* 23, 26 *) +(mk_real_int (num_of_string "49857994615030998639694346")),(mk_real_int (num_of_string "16161005939868816690103825"));(* 25, 25 *) +(mk_real_int (num_of_string "60445721406002507261075808")),(mk_real_int (num_of_string "9183397773792697297117800"));(* 25, 24 *) +(mk_real_int (num_of_string "57509791427373035664640672")),(mk_real_int (num_of_string "425879000513212834765050692"));(* 25, 26 *) +(mk_real_int (num_of_string "150551420299712970337985349")),(mk_real_int (num_of_string "8478037403407779336059112"));(* 26, 24 *) +(mk_real_int (num_of_string "189305705647007063646320115")),(mk_real_int (num_of_string "57088640728074251334710000"));(* 26, 25 *) +(mk_real_int (num_of_string "155713151419371690239361240")),(mk_real_int (num_of_string "6490164450620716838423920"));(* 26, 24 *) +(mk_real_int (num_of_string "180018318707772001422729000")),(mk_real_int (num_of_string "176899079454530524596941504"));(* 26, 26 *) +(mk_real_int (num_of_string "98246598880664439805952")),(mk_real_int (num_of_string "162354057912724717118940900"));(* 22, 26 *) +(mk_real_int (num_of_string "78269683850821904971838308")),(mk_real_int (num_of_string "91424387897791188356264070"));(* 25, 25 *) +(mk_real_int (num_of_string "4370672755263901487913000")),(mk_real_int (num_of_string "78212978187652211045612470"));(* 24, 25 *) +(mk_real_int (num_of_string "43953439624864637470298640")),(mk_real_int (num_of_string "7482811090223673532142000"));(* 25, 24 *) +(mk_real_int (num_of_string "1509625066426809753652154")),(mk_real_int (num_of_string "311479525686656890468389120"));(* 24, 26 *) +(mk_real_int (num_of_string "322471838912406458930353")),(mk_real_int (num_of_string "253856088308010623186800458"));(* 23, 26 *) +(mk_real_int (num_of_string "14124195143826836015806956")),(mk_real_int (num_of_string "22645363516293571358488400"));(* 25, 25 *) +(mk_real_int (num_of_string "11469795158684644106211120")),(mk_real_int (num_of_string "6260226998742971166776850"));(* 25, 24 *) +(mk_real_int (num_of_string "88291840844021735205647637")),(mk_real_int (num_of_string "122970736417675351892613300"));(* 25, 26 *) +(mk_real_int (num_of_string "15396027982411394689128")),(mk_real_int (num_of_string "107337818640332974871667420"));(* 22, 26 *) +(mk_real_int (num_of_string "36033211321296681894326496")),(mk_real_int (num_of_string "4351150522892935100979600"));(* 25, 24 *) +(mk_real_int (num_of_string "3800780938063746562578720")),(mk_real_int (num_of_string "44296666340457172906012320"));(* 24, 25 *) +(mk_real_int (num_of_string "77741643353314463368173200")),(mk_real_int (num_of_string "80189736288510531327928634"));(* 25, 25 *) +(mk_real_int (num_of_string "366643880037271847021293125")),(mk_real_int (num_of_string "232919543426390416887066880"));(* 26, 26 *) +(mk_real_int (num_of_string "136815839344522518087569816")),(mk_real_int (num_of_string "42119075414490876883248720"));(* 26, 25 *) +(mk_real_int (num_of_string "572342331264280064522736")),(mk_real_int (num_of_string "175158984991518519343893932"));(* 23, 26 *) +(mk_real_int (num_of_string "34286452610024448880160240")),(mk_real_int (num_of_string "15045816425518525880718852"));(* 25, 25 *) +(mk_real_int (num_of_string "208398612216264949978758")),(mk_real_int (num_of_string "6805634625186026783180160"));(* 23, 24 *) +(mk_real_int (num_of_string "216792870879872789809700160")),(mk_real_int (num_of_string "2891390097587707455885315"));(* 26, 24 *) +(mk_real_int (num_of_string "262811192980022937188137062")),(mk_real_int (num_of_string "609773424102286131460604260"));(* 26, 26 *) +(mk_real_int (num_of_string "180730531540424393494848")),(mk_real_int (num_of_string "9590412607608888532027320"));(* 23, 24 *) +(mk_real_int (num_of_string "15765996527362898796203640")),(mk_real_int (num_of_string "1658885785061453439964584"));(* 25, 24 *) +(mk_real_int (num_of_string "4300993303195663068441930")),(mk_real_int (num_of_string "85080718024042001923089050"));(* 24, 25 *) +(mk_real_int (num_of_string "39250293845039188865664480")),(mk_real_int (num_of_string "3284549760329707201962672"));(* 25, 24 *) +(mk_real_int (num_of_string "109852745347167805114094280")),(mk_real_int (num_of_string "3136634082216472570747490"));(* 26, 24 *) +(mk_real_int (num_of_string "163751154760696731539842440")),(mk_real_int (num_of_string "17149697061479497135220625"));(* 26, 25 *) +(mk_real_int (num_of_string "45779475364243424158384008")),(mk_real_int (num_of_string "1401818666829818844925656"));(* 25, 24 *) +(mk_real_int (num_of_string "5984018026900435301109120")),(mk_real_int (num_of_string "152838878148709767757750644"));(* 24, 26 *) +(mk_real_int (num_of_string "117891681923283702680747620")),(mk_real_int (num_of_string "179046091585070123094076220"));(* 26, 26 *) +(mk_real_int (num_of_string "460126616801207493606944256")),(mk_real_int (num_of_string "29790677442619849644815904"));(* 26, 25 *) +(mk_real_int (num_of_string "16107058132958316719507585")),(mk_real_int (num_of_string "107166588389414656364129320"));(* 25, 26 *) +(mk_real_int (num_of_string "15507656966133368596156800")),(mk_real_int (num_of_string "104532587906982917431004880"));(* 25, 26 *) +(mk_real_int (num_of_string "210251612714981675572099904")),(mk_real_int (num_of_string "152709463817527667365508050"));(* 26, 26 *) +(mk_real_int (num_of_string "218913858876466893783425560")),(mk_real_int (num_of_string "193307160392015588979762000"));(* 26, 26 *) +(mk_real_int (num_of_string "145751565881074124064958501")),(mk_real_int (num_of_string "202488068529689306930770400"));(* 26, 26 *) +(mk_real_int (num_of_string "20101164833626164653625")),(mk_real_int (num_of_string "137580094437379198216966590"));(* 22, 26 *) +(mk_real_int (num_of_string "67795873951403450803411120")),(mk_real_int (num_of_string "128223868897406025168213560"));(* 25, 26 *) +(mk_real_int (num_of_string "61142133965299536252144576")),(mk_real_int (num_of_string "131275311523099442986659912"));(* 25, 26 *) +(mk_real_int (num_of_string "3281123380326310477786500")),(mk_real_int (num_of_string "70080013474875475894847724"));(* 24, 25 *) +(mk_real_int (num_of_string "216415387485639539038630360")),(mk_real_int (num_of_string "131492970594504376642115980"));(* 26, 26 *) +(mk_real_int (num_of_string "107021157667215831922896804")),(mk_real_int (num_of_string "387692730323519063269056000"));(* 26, 26 *) +(mk_real_int (num_of_string "3617979646569187774526520")),(mk_real_int (num_of_string "550700179191680802652509336"));(* 24, 26 *) +(mk_real_int (num_of_string "11428994137080772970709840")),(mk_real_int (num_of_string "124914502676296451522136030"));(* 25, 26 *) +(mk_real_int (num_of_string "1927127090232028554147720")),(mk_real_int (num_of_string "174825737576319399990841408"));(* 24, 26 *) +(mk_real_int (num_of_string "92596174146436261599280710")),(mk_real_int (num_of_string "213368395739247296427956321"));(* 25, 26 *) +(mk_real_int (num_of_string "50597744458836280633079400")),(mk_real_int (num_of_string "332921510413679088567401481"));(* 25, 26 *) +(mk_real_int (num_of_string "22253673914077713692423280")),(mk_real_int (num_of_string "25288380849397262496659136"));(* 25, 25 *) +(mk_real_int (num_of_string "271128881527516233196415244")),(mk_real_int (num_of_string "20565373958952286285602000"));(* 26, 25 *) +(mk_real_int (num_of_string "52565824824333345395540250")),(mk_real_int (num_of_string "105236602650401585076682221"));(* 25, 26 *) +(mk_real_int (num_of_string "123827650708729353651421420")),(mk_real_int (num_of_string "192622321039696560539083250"));(* 26, 26 *) +(mk_real_int (num_of_string "145900747289070391812334900")),(mk_real_int (num_of_string "157256408866753391334542920"));(* 26, 26 *) +(mk_real_int (num_of_string "21932979102830743406596224")),(mk_real_int (num_of_string "4725176688961768698352644"));(* 25, 24 *) +(mk_real_int (num_of_string "53619267341506189699951776")),(mk_real_int (num_of_string "405319022905367495796409998"));(* 25, 26 *) +(mk_real_int (num_of_string "8296879628962431522164316")),(mk_real_int (num_of_string "6586069741133150432312736"));(* 24, 24 *) +(mk_real_int (num_of_string "83710899686235730987977360")),(mk_real_int (num_of_string "211741104597082483904615328"));(* 25, 26 *) +(mk_real_int (num_of_string "722819963655752067020386800")),(mk_real_int (num_of_string "66957118629737374421720040"));(* 26, 25 *) +(mk_real_int (num_of_string "66684917472312841126254432")),(mk_real_int (num_of_string "38782472071178353533595980"));(* 25, 25 *) +(mk_real_int (num_of_string "131659265559061397213579264")),(mk_real_int (num_of_string "165508047285526878888372373"));(* 26, 26 *) +(mk_real_int (num_of_string "13231585070318138540816372")),(mk_real_int (num_of_string "3476520514842629755371200"));(* 25, 24 *) +(mk_real_int (num_of_string "346455904580011363146375357")),(mk_real_int (num_of_string "246108341931215986754431200"));(* 26, 26 *) +(mk_real_int (num_of_string "3612775780717498603528740")),(mk_real_int (num_of_string "79271523347332962718180894"));(* 24, 25 *) +(mk_real_int (num_of_string "2154701515362019853271552")),(mk_real_int (num_of_string "160712239582408695464826324"));(* 24, 26 *) +(mk_real_int (num_of_string "26731969409821149565203450")),(mk_real_int (num_of_string "250067539160766843716806898"));(* 25, 26 *) +(mk_real_int (num_of_string "455654757548654366039556660")),(mk_real_int (num_of_string "39321271453864735847046150"));(* 26, 25 *) +(mk_real_int (num_of_string "14833308545689636392511000")),(mk_real_int (num_of_string "67008543496344317900260800"));(* 25, 25 *) +(mk_real_int (num_of_string "285717395376322978177623438")),(mk_real_int (num_of_string "260358573951865796592994830"));(* 26, 26 *) +(mk_real_int (num_of_string "28061646315274832856122700")),(mk_real_int (num_of_string "122195022953189660793712960"));(* 25, 26 *) +(mk_real_int (num_of_string "116371628285855245795403275")),(mk_real_int (num_of_string "54165462576192638720945532"));(* 26, 25 *) +(mk_real_int (num_of_string "283750387415357891016428649")),(mk_real_int (num_of_string "9263051188667075197328190"));(* 26, 24 *) +(mk_real_int (num_of_string "168447238167298273265238464")),(mk_real_int (num_of_string "34347960697304086007579712"));(* 26, 25 *) +(mk_real_int (num_of_string "111414721398094193336331606")),(mk_real_int (num_of_string "1572278427812878224716250"));(* 26, 24 *) +(mk_real_int (num_of_string "85424345748758887909684884")),(mk_real_int (num_of_string "53634214036552931078913960"));(* 25, 25 *) +(mk_real_int (num_of_string "433186206909109143113603370")),(mk_real_int (num_of_string "127346213092884213449521500"));(* 26, 26 *) +(mk_real_int (num_of_string "276721457988623553175029760")),(mk_real_int (num_of_string "130145827557924193888669824"));(* 26, 26 *) +(mk_real_int (num_of_string "171970508473947028860509985")),(mk_real_int (num_of_string "63692871133755993015735750"));(* 26, 25 *) +(mk_real_int (num_of_string "42144108424800663673151000")),(mk_real_int (num_of_string "83156496837150767474254080"));(* 25, 25 *) +(mk_real_int (num_of_string "463524504251353022442096")),(mk_real_int (num_of_string "25215178586886634091083104"));(* 23, 25 *) +(mk_real_int (num_of_string "4003282888450251105743603")),(mk_real_int (num_of_string "37617476574130415722490400"));(* 24, 25 *) +(mk_real_int (num_of_string "2303641521195402675183960")),(mk_real_int (num_of_string "11765148318925111873654000"));(* 24, 25 *) +(mk_real_int (num_of_string "42547756127261226763218921")),(mk_real_int (num_of_string "38355758482606505161824150"));(* 25, 25 *) +(mk_real_int (num_of_string "78722930494039920296960772")),(mk_real_int (num_of_string "3470847025527210439774848"));(* 25, 24 *) +(mk_real_int (num_of_string "24391976623918082149024335")),(mk_real_int (num_of_string "30855027740775287834747600"));(* 25, 25 *) +(mk_real_int (num_of_string "151631936507900577369097779")),(mk_real_int (num_of_string "128577869325022238111183404"));(* 26, 26 *) +(mk_real_int (num_of_string "691302673454697863781844025")),(mk_real_int (num_of_string "1739551481345983869408000"));(* 26, 24 *) +(mk_real_int (num_of_string "63619378184111182872159330")),(mk_real_int (num_of_string "11478610084878288820876950"));(* 25, 25 *) +(mk_real_int (num_of_string "68576922562396998506008320")),(mk_real_int (num_of_string "326029040147256049160961088"));(* 25, 26 *) +(mk_real_int (num_of_string "30001128650415805819381704")),(mk_real_int (num_of_string "22738441862746931392302390"));(* 25, 25 *) +(mk_real_int (num_of_string "225226436764705216915893550")),(mk_real_int (num_of_string "4808403312323680157761500"));(* 26, 24 *) +(mk_real_int (num_of_string "1097741458398821296367904")),(mk_real_int (num_of_string "20351048773537304534729940"));(* 24, 25 *) +(mk_real_int (num_of_string "94750343053496362421391306")),(mk_real_int (num_of_string "3484089270790262759746800"));(* 25, 24 *) +(mk_real_int (num_of_string "58729188008825051913637200")),(mk_real_int (num_of_string "19122681934976314969249648"));(* 25, 25 *) +(mk_real_int (num_of_string "1598985800722621254955557")),(mk_real_int (num_of_string "15189245690779641936007476"));(* 24, 25 *) +(mk_real_int (num_of_string "76991596567790840390736600")),(mk_real_int (num_of_string "26892182672299755250049400"));(* 25, 25 *) +(mk_real_int (num_of_string "175296844217553885759240")),(mk_real_int (num_of_string "26575774453688179812147880"));(* 23, 25 *) +(mk_real_int (num_of_string "91082232355656771919992978")),(mk_real_int (num_of_string "3461274640635699378135568"));(* 25, 24 *) +(mk_real_int (num_of_string "24214326817518827356436300")),(mk_real_int (num_of_string "84682698359061687457974210"));(* 25, 25 *) +(mk_real_int (num_of_string "377912587222655343107226064")),(mk_real_int (num_of_string "20894890682750963084452544"));(* 26, 25 *) +(mk_real_int (num_of_string "78219383748166702140049909")),(mk_real_int (num_of_string "342199640740501754251467468"));(* 25, 26 *) +(mk_real_int (num_of_string "4086878836774696827899982")),(mk_real_int (num_of_string "28744668571745563398621040"));(* 24, 25 *) +(mk_real_int (num_of_string "177200847300307408024107648")),(mk_real_int (num_of_string "164168860046010066023850432"));(* 26, 26 *) +(mk_real_int (num_of_string "121303223829489625017449805")),(mk_real_int (num_of_string "154471085166320669731198500"));(* 26, 26 *) +(mk_real_int (num_of_string "35590152858302158415051016")),(mk_real_int (num_of_string "1349669297084661854658560"));(* 25, 24 *) +(mk_real_int (num_of_string "47363745829771085777088663")),(mk_real_int (num_of_string "110999653145149068226554540"));(* 25, 26 *) +(mk_real_int (num_of_string "77975968263017087885457024")),(mk_real_int (num_of_string "115985125060170324694017212"));(* 25, 26 *) +(mk_real_int (num_of_string "208249764501878112237403725")),(mk_real_int (num_of_string "15664023934107852486149690"));(* 26, 25 *) +(mk_real_int (num_of_string "53552105000798735149125245")),(mk_real_int (num_of_string "278452447516437925743132800"));(* 25, 26 *) +(mk_real_int (num_of_string "22779138548031551024450627")),(mk_real_int (num_of_string "231033547040116719085437492"));(* 25, 26 *) +(mk_real_int (num_of_string "791619192697104965254002")),(mk_real_int (num_of_string "12353074842850356526390440"));(* 23, 25 *) +(mk_real_int (num_of_string "1333568832869776768514085")),(mk_real_int (num_of_string "25372106043505578336339360"));(* 24, 25 *) +(mk_real_int (num_of_string "249414648449310915026785200")),(mk_real_int (num_of_string "12688238331846734635853880"));(* 26, 25 *) +(mk_real_int (num_of_string "5651800028501052252435372")),(mk_real_int (num_of_string "498911021239689979613598507"));(* 24, 26 *) +(mk_real_int (num_of_string "98171376453633918494315160")),(mk_real_int (num_of_string "47323530346518173138498400"));(* 25, 25 *) +(mk_real_int (num_of_string "65449480750502003933183000")),(mk_real_int (num_of_string "341476452272297833907880"));(* 25, 23 *) +(mk_real_int (num_of_string "267384734993032433105631750")),(mk_real_int (num_of_string "122905461646875268972411128"));(* 26, 26 *) +(mk_real_int (num_of_string "169817166557896873358471968")),(mk_real_int (num_of_string "129724415081091996050147808"));(* 26, 26 *) +(mk_real_int (num_of_string "71406102302013206715930288")),(mk_real_int (num_of_string "50059941053029300015151760"));(* 25, 25 *) +(mk_real_int (num_of_string "151621345139690071605441495")),(mk_real_int (num_of_string "123021470460189010451960664"));(* 26, 26 *) +(mk_real_int (num_of_string "188745223417810876360558574")),(mk_real_int (num_of_string "8704792166624098781967504"));(* 26, 24 *) +(mk_real_int (num_of_string "221469637524313904512459200")),(mk_real_int (num_of_string "156272800370585974114139100"));(* 26, 26 *) +(mk_real_int (num_of_string "179704454814092155313007576")),(mk_real_int (num_of_string "28260825086168456538872412"));(* 26, 25 *) +(mk_real_int (num_of_string "23801195988064436464882412")),(mk_real_int (num_of_string "13844634115737389333053608"));(* 25, 25 *) +(mk_real_int (num_of_string "935120269076416413354784")),(mk_real_int (num_of_string "18316360396740791736713600"));(* 23, 25 *) +(mk_real_int (num_of_string "439654553378026094034892027")),(mk_real_int (num_of_string "255704868816712216625505888"));(* 26, 26 *) +(mk_real_int (num_of_string "170404271361384502816640216")),(mk_real_int (num_of_string "73411266382865898175987872"));(* 26, 25 *) +(mk_real_int (num_of_string "26065271881196103498543360")),(mk_real_int (num_of_string "1467168518470828200661920"));(* 25, 24 *) +(mk_real_int (num_of_string "162404008667094195684949875")),(mk_real_int (num_of_string "18510874775408758976498880"));(* 26, 25 *) +(mk_real_int (num_of_string "1189523359785213273244726")),(mk_real_int (num_of_string "154246600767929003216789940"));(* 24, 26 *) +(mk_real_int (num_of_string "40268440420822140964377731")),(mk_real_int (num_of_string "124840193958411678611982900"));(* 25, 26 *) +(mk_real_int (num_of_string "92121917085434649446294625")),(mk_real_int (num_of_string "16157134192707421607505240"));(* 25, 25 *) +(mk_real_int (num_of_string "6260336821748596523443200")),(mk_real_int (num_of_string "2177611657464423180133809"));(* 24, 24 *) +(mk_real_int (num_of_string "257044154829655968933778737")),(mk_real_int (num_of_string "29636382569978256264895680"));(* 26, 25 *) +(mk_real_int (num_of_string "20528658019508908153513860")),(mk_real_int (num_of_string "226663510943498071387738240"));(* 25, 26 *) +(mk_real_int (num_of_string "136298832643894768365980700")),(mk_real_int (num_of_string "457938627400910750660040528"));(* 26, 26 *) +(mk_real_int (num_of_string "10143974755162581720659732")),(mk_real_int (num_of_string "4554445379489824344437520"));(* 25, 24 *) +(mk_real_int (num_of_string "746650975691005541523960670")),(mk_real_int (num_of_string "501151342154405894561416020"));(* 26, 26 *) +(mk_real_int (num_of_string "2115861390084372281731900")),(mk_real_int (num_of_string "22552692617060839203075210"));(* 24, 25 *) +(mk_real_int (num_of_string "144672288423576808472284980")),(mk_real_int (num_of_string "21587467418466837298873000"));(* 26, 25 *) +(mk_real_int (num_of_string "99166177913705792373794652")),(mk_real_int (num_of_string "55399503361171845399042200"));(* 25, 25 *) +(mk_real_int (num_of_string "10911266770556496368686848")),(mk_real_int (num_of_string "72274381800635561911205016"));(* 25, 25 *) +(mk_real_int (num_of_string "95374392421696729129429740")),(mk_real_int (num_of_string "761650238758906968522148800"));(* 25, 26 *) +(mk_real_int (num_of_string "334999670911003697998173984")),(mk_real_int (num_of_string "349339498842019834350095167"));(* 26, 26 *) +(mk_real_int (num_of_string "19481096934649073534768280")),(mk_real_int (num_of_string "98073334298427664291684596"));(* 25, 25 *) +(mk_real_int (num_of_string "69652099561113619786767825")),(mk_real_int (num_of_string "119485930323691975659768600"));(* 25, 26 *) +(mk_real_int (num_of_string "420981325085031885278769918")),(mk_real_int (num_of_string "127693676481245208704544360"));(* 26, 26 *) +(mk_real_int (num_of_string "81437072843007058251475280")),(mk_real_int (num_of_string "121751149311661223091165688"));(* 25, 26 *) +(mk_real_int (num_of_string "78760344153797936422399010")),(mk_real_int (num_of_string "2703341311232480654359908"));(* 25, 24 *) +(mk_real_int (num_of_string "140942827957367191008626331")),(mk_real_int (num_of_string "136112541803246350083214680"));(* 26, 26 *) +(mk_real_int (num_of_string "19649311627766235054472008")),(mk_real_int (num_of_string "36458341150648949365893696"));(* 25, 25 *) +(mk_real_int (num_of_string "39319054812981361158571656")),(mk_real_int (num_of_string "4057826883759355326568494"));(* 25, 24 *) +(mk_real_int (num_of_string "184005991725426191335324442")),(mk_real_int (num_of_string "4346246400214419458185736"));(* 26, 24 *) +(mk_real_int (num_of_string "425264509091035464498833670")),(mk_real_int (num_of_string "61294187492407534331751216"));(* 26, 25 *) +(mk_real_int (num_of_string "9136612004415326565897750")),(mk_real_int (num_of_string "790756416411378886044558540"));(* 24, 26 *) +(mk_real_int (num_of_string "40438454575867964385525720")),(mk_real_int (num_of_string "3820822329411379636508912"));(* 25, 24 *) +(mk_real_int (num_of_string "39193934531001001806038400")),(mk_real_int (num_of_string "191219248836906452092545536"));(* 25, 26 *) +(mk_real_int (num_of_string "117394682102034495701396907")),(mk_real_int (num_of_string "158818034054787697000460288"));(* 26, 26 *) +(mk_real_int (num_of_string "320342393622039548044025520")),(mk_real_int (num_of_string "10520373134587455374725171"));(* 26, 25 *) +(mk_real_int (num_of_string "145264321348928067731492034")),(mk_real_int (num_of_string "200517754192029576532950840"));(* 26, 26 *) +(mk_real_int (num_of_string "18346476416812155570336840")),(mk_real_int (num_of_string "93990006905369016566412288"));(* 25, 25 *) +(mk_real_int (num_of_string "152911132188658357813764220")),(mk_real_int (num_of_string "103992231165969389263309080"));(* 26, 26 *) +(mk_real_int (num_of_string "86561079185188032007360410")),(mk_real_int (num_of_string "35277132477074026079450385"));(* 25, 25 *) +(mk_real_int (num_of_string "337546437647847779195434380")),(mk_real_int (num_of_string "14935277363350575767175486"));(* 26, 25 *) +(mk_real_int (num_of_string "17097273813574070605285790")),(mk_real_int (num_of_string "5186071674784879537728159"));(* 25, 24 *) +(mk_real_int (num_of_string "326217160548104840752710")),(mk_real_int (num_of_string "26376479325071786217967296"));(* 23, 25 *) +(mk_real_int (num_of_string "31370224784078854121798618")),(mk_real_int (num_of_string "369745899635051925198466168"));(* 25, 26 *) +(mk_real_int (num_of_string "3564672876792062656476768")),(mk_real_int (num_of_string "13891596789897271990316745"));(* 24, 25 *) +(mk_real_int (num_of_string "11164020823659326911944693")),(mk_real_int (num_of_string "222289827913999541367765152"));(* 25, 26 *) +(mk_real_int (num_of_string "17271825516153737279675892")),(mk_real_int (num_of_string "5214953471104995358866618"));(* 25, 24 *) +(mk_real_int (num_of_string "81124162052337625180795965")),(mk_real_int (num_of_string "8086121808049655052405840"));(* 25, 24 *) +(mk_real_int (num_of_string "75712761224488613894822080")),(mk_real_int (num_of_string "125522635234897448796246336"));(* 25, 26 *) +(mk_real_int (num_of_string "477552136999459785314721516")),(mk_real_int (num_of_string "29411812112998008351030210"));(* 26, 25 *) +(mk_real_int (num_of_string "157974988577192674706009445")),(mk_real_int (num_of_string "117023361523828427452955040"));(* 26, 26 *) +(mk_real_int (num_of_string "20810079278373046877771600")),(mk_real_int (num_of_string "216056932110716206477114602"));(* 25, 26 *) +(mk_real_int (num_of_string "1292491457655875927926164")),(mk_real_int (num_of_string "44112696403192072503008448"));(* 24, 25 *) +(mk_real_int (num_of_string "1516877205992956064422880")),(mk_real_int (num_of_string "95217141823572502529195040"));(* 24, 25 *) +(mk_real_int (num_of_string "37710120286683621591354280")),(mk_real_int (num_of_string "230016167686626746599752512"));(* 25, 26 *) +(mk_real_int (num_of_string "214580541914610775879162880")),(mk_real_int (num_of_string "173021393182665467590047912"));(* 26, 26 *) +(mk_real_int (num_of_string "445467144208472460078841859")),(mk_real_int (num_of_string "282165529982023916213308180"));(* 26, 26 *) +(mk_real_int (num_of_string "105713255339627861325205080")),(mk_real_int (num_of_string "11361704716721795431774960"));(* 26, 25 *) +(mk_real_int (num_of_string "146290073345265655177843680")),(mk_real_int (num_of_string "326859616544183386840635684"));(* 26, 26 *) +(mk_real_int (num_of_string "15846606073752848148387150")),(mk_real_int (num_of_string "18453033720278342116175916"));(* 25, 25 *) +(mk_real_int (num_of_string "62392299697841215049339991")),(mk_real_int (num_of_string "94154997760457158280985570"));(* 25, 25 *) +(mk_real_int (num_of_string "11518501323220754877003990")),(mk_real_int (num_of_string "140848861635951052924017656"));(* 25, 26 *) +(mk_real_int (num_of_string "165680608711598373058618540")),(mk_real_int (num_of_string "61634678288421361465050444"));(* 26, 25 *) +(mk_real_int (num_of_string "228742323184818619056656370")),(mk_real_int (num_of_string "330309201657711001582741680"));(* 26, 26 *) +(mk_real_int (num_of_string "10697050156758197420854926")),(mk_real_int (num_of_string "226774333678351045561580970"));(* 25, 26 *) +(mk_real_int (num_of_string "690311643675450478697997")),(mk_real_int (num_of_string "52015333674707430556206132"));(* 23, 25 *) +(mk_real_int (num_of_string "77234443717434484637176020")),(mk_real_int (num_of_string "44293551043235280063842538"));(* 25, 25 *) +(mk_real_int (num_of_string "242472910763615187923188452")),(mk_real_int (num_of_string "1864108712563719808173480"));(* 26, 24 *) +(mk_real_int (num_of_string "942103325629802927449488")),(mk_real_int (num_of_string "49300658157335196910860408"));(* 23, 25 *) +(mk_real_int (num_of_string "46374679458841357569034848")),(mk_real_int (num_of_string "37876945221723903933658968"));(* 25, 25 *) +(mk_real_int (num_of_string "37062505693713928808927664")),(mk_real_int (num_of_string "324200430512423294767344610"));(* 25, 26 *) +(mk_real_int (num_of_string "93639502936705784554146448")),(mk_real_int (num_of_string "257954121166422304657386822"));(* 25, 26 *) +(mk_real_int (num_of_string "47981232447334968948004410")),(mk_real_int (num_of_string "2170194130972064662902800"));(* 25, 24 *) +(mk_real_int (num_of_string "37701257987237233768201074")),(mk_real_int (num_of_string "62404826098990127372287200"));(* 25, 25 *) +(mk_real_int (num_of_string "1044206513366559862588416")),(mk_real_int (num_of_string "548196697119478237799199120"));(* 24, 26 *) +(mk_real_int (num_of_string "241805263151559174231373300")),(mk_real_int (num_of_string "7138313623290211552321704"));(* 26, 24 *) +(mk_real_int (num_of_string "712800486017009844617829762")),(mk_real_int (num_of_string "55802875308599007685858944"));(* 26, 25 *) +(mk_real_int (num_of_string "12326854624523596756478800")),(mk_real_int (num_of_string "46856337327344504871660000"));(* 25, 25 *) +(mk_real_int (num_of_string "12681548201848464583101744")),(mk_real_int (num_of_string "125929230807405539544401748"));(* 25, 26 *) +(mk_real_int (num_of_string "236757855657257697175232820")),(mk_real_int (num_of_string "4546532345724820863537462"));(* 26, 24 *) +(mk_real_int (num_of_string "58696109356911132970874850")),(mk_real_int (num_of_string "46815287641478058188291164"));(* 25, 25 *) +(mk_real_int (num_of_string "70458738777466860495943092")),(mk_real_int (num_of_string "258185823191162241457762344"));(* 25, 26 *) +(mk_real_int (num_of_string "8108901148828954208157360")),(mk_real_int (num_of_string "432767421835645881808502640"));(* 24, 26 *) +(mk_real_int (num_of_string "17172960672183813025258016")),(mk_real_int (num_of_string "9377010339069090234236532"));(* 25, 24 *) +(mk_real_int (num_of_string "19698417214895854122264500")),(mk_real_int (num_of_string "27055842893427770715896130"));(* 25, 25 *) +(mk_real_int (num_of_string "33579846911335080073430373")),(mk_real_int (num_of_string "140206904157377063075766870"));(* 25, 26 *) +(mk_real_int (num_of_string "537095540591315084330744744")),(mk_real_int (num_of_string "49046907102801217572723488"));(* 26, 25 *) +(mk_real_int (num_of_string "214730568448749804732317568")),(mk_real_int (num_of_string "210796970734683889491780"));(* 26, 23 *) +(mk_real_int (num_of_string "253383394034219437924554692")),(mk_real_int (num_of_string "23051564592863538282742170"));(* 26, 25 *) +(mk_real_int (num_of_string "291086146850790076927602600")),(mk_real_int (num_of_string "1024532782023627253922508"));(* 26, 24 *) +(mk_real_int (num_of_string "35968699119771247594673700")),(mk_real_int (num_of_string "14890179717600964569590572"));(* 25, 25 *) +(mk_real_int (num_of_string "3395151517223597839009368")),(mk_real_int (num_of_string "68419066694950303505347552"));(* 24, 25 *) +(mk_real_int (num_of_string "51645033105520629515418909")),(mk_real_int (num_of_string "245325340010740860849740121"));(* 25, 26 *) +(mk_real_int (num_of_string "1124413745646916304466677")),(mk_real_int (num_of_string "35277141684253427180364352"));(* 24, 25 *) +(mk_real_int (num_of_string "288069788577609165073544985")),(mk_real_int (num_of_string "25504306623150632821535040"));(* 26, 25 *) +(mk_real_int (num_of_string "147159869796821702223459428")),(mk_real_int (num_of_string "62068751243067132294197120"));(* 26, 25 *) +(mk_real_int (num_of_string "731337872139962875698676704")),(mk_real_int (num_of_string "460500373895977321519563500"));(* 26, 26 *) +(mk_real_int (num_of_string "150030336561310312412788224")),(mk_real_int (num_of_string "538459832052505837006957440"));(* 26, 26 *) +(mk_real_int (num_of_string "8309963420508920610021879")),(mk_real_int (num_of_string "268332146214667289959772160"));(* 24, 26 *) +(mk_real_int (num_of_string "332037149910460866854314200")),(mk_real_int (num_of_string "77954172357456525010089656"));(* 26, 25 *) +(mk_real_int (num_of_string "34950316089502298470625892")),(mk_real_int (num_of_string "64498171738333647439851750"));(* 25, 25 *) +(mk_real_int (num_of_string "10539095770917829696025718")),(mk_real_int (num_of_string "210355676802423500912031396"));(* 25, 26 *) +(mk_real_int (num_of_string "394330280489378760154036311")),(mk_real_int (num_of_string "4305518321857677045541728"));(* 26, 24 *) +(mk_real_int (num_of_string "58419518358344713148989872")),(mk_real_int (num_of_string "380222798477226517903752648"));(* 25, 26 *) +(mk_real_int (num_of_string "112157811845994856227470266")),(mk_real_int (num_of_string "111181074282757465077966336"));(* 26, 26 *) +(mk_real_int (num_of_string "1481730029543749993686042")),(mk_real_int (num_of_string "10583626440892741357895700"));(* 24, 25 *) +(mk_real_int (num_of_string "31391084034545216057045200")),(mk_real_int (num_of_string "217011954920433723681241492"));(* 25, 26 *) +(mk_real_int (num_of_string "255490200110427891734705184")),(mk_real_int (num_of_string "352292269852551577203926089"));(* 26, 26 *) +(mk_real_int (num_of_string "295715612811411589343228253")),(mk_real_int (num_of_string "60362263729144459012408182"));(* 26, 25 *) +(mk_real_int (num_of_string "347695316019600314679631872")),(mk_real_int (num_of_string "9934883068880393495091935"));(* 26, 24 *) +(mk_real_int (num_of_string "122656019138052796688249720")),(mk_real_int (num_of_string "52117590409862367365735760"));(* 26, 25 *) +(mk_real_int (num_of_string "45836340858678849280376148")),(mk_real_int (num_of_string "24942844662987217389322221"));(* 25, 25 *) +(mk_real_int (num_of_string "110211132991861942719215620")),(mk_real_int (num_of_string "4686433835251682918693100"));(* 26, 24 *) +(mk_real_int (num_of_string "7576721132155850324172800")),(mk_real_int (num_of_string "514299408786744648830913150"));(* 24, 26 *) +(mk_real_int (num_of_string "36642193007117882681259925")),(mk_real_int (num_of_string "56361023618576146516128384"));(* 25, 25 *) +(mk_real_int (num_of_string "40726505783044174366510900")),(mk_real_int (num_of_string "69734713831369495866048490"));(* 25, 25 *) +(mk_real_int (num_of_string "75140823590890665506461992")),(mk_real_int (num_of_string "37017326042354118651444098"));(* 25, 25 *) +(mk_real_int (num_of_string "4802457511906381443617280")),(mk_real_int (num_of_string "86476152754917874360831878"));(* 24, 25 *) +(mk_real_int (num_of_string "397669900752986420278870080")),(mk_real_int (num_of_string "2574978476889632156990448"));(* 26, 24 *) +(mk_real_int (num_of_string "2194103287561156190726400")),(mk_real_int (num_of_string "188949065814306436899939792"));(* 24, 26 *) +(mk_real_int (num_of_string "389229653553062755568094540")),(mk_real_int (num_of_string "22286797021531824690475728"));(* 26, 25 *) +(mk_real_int (num_of_string "6610248532466324018495846")),(mk_real_int (num_of_string "18297937757199578406065280"));(* 24, 25 *) +(mk_real_int (num_of_string "170506339146915199807005360")),(mk_real_int (num_of_string "136074404952098101431000600"));(* 26, 26 *) +(mk_real_int (num_of_string "49224159005558221435508954")),(mk_real_int (num_of_string "305730529113553789674044880"));(* 25, 26 *) +(mk_real_int (num_of_string "57484706087237935092434194")),(mk_real_int (num_of_string "94326868703862147735959291"));(* 25, 25 *) +(mk_real_int (num_of_string "252994567865116642350187752")),(mk_real_int (num_of_string "46977291842183887558927608"));(* 26, 25 *) +(mk_real_int (num_of_string "513403404777299332612783116")),(mk_real_int (num_of_string "5588470143167318788574520"));(* 26, 24 *) +(mk_real_int (num_of_string "79183075223088612569844216")),(mk_real_int (num_of_string "563789418331208780684259384"));(* 25, 26 *) +(mk_real_int (num_of_string "148522939457520260837103460")),(mk_real_int (num_of_string "87085675531155640009133736"));(* 26, 25 *) +(mk_real_int (num_of_string "32923554361302501510210000")),(mk_real_int (num_of_string "191194630734396919302563792"));(* 25, 26 *) +(mk_real_int (num_of_string "75147196995590745308679872")),(mk_real_int (num_of_string "121955909595204787844508480"));(* 25, 26 *) +(mk_real_int (num_of_string "198122316974864748640001355")),(mk_real_int (num_of_string "600366154826616561404643240"));(* 26, 26 *) +(mk_real_int (num_of_string "43060198254172946733214888")),(mk_real_int (num_of_string "222953692233281193721136817"));(* 25, 26 *) +(mk_real_int (num_of_string "18919460679275378178088132")),(mk_real_int (num_of_string "94646770810742731930162071"));(* 25, 25 *) +(mk_real_int (num_of_string "21809900657924136963672048")),(mk_real_int (num_of_string "610016178006845361454949820"));(* 25, 26 *) +(mk_real_int (num_of_string "433146958272100815211340550")),(mk_real_int (num_of_string "3860671782877522520779520"));(* 26, 24 *) +(mk_real_int (num_of_string "116160069688816578012200030")),(mk_real_int (num_of_string "199058038407708637747355280"));(* 26, 26 *) +(mk_real_int (num_of_string "10380839470045391956809944")),(mk_real_int (num_of_string "162584356533029501365091340"));(* 25, 26 *) +(mk_real_int (num_of_string "237721906265041046244266160")),(mk_real_int (num_of_string "76594403627978679279825750"));(* 26, 25 *) +(mk_real_int (num_of_string "155648256498492206001546406")),(mk_real_int (num_of_string "85774806706361720608706892"));(* 26, 25 *) +(mk_real_int (num_of_string "42253850464768963308554400")),(mk_real_int (num_of_string "631614634086967590682690340"));(* 25, 26 *) +(mk_real_int (num_of_string "195051269231122850993246850")),(mk_real_int (num_of_string "206925556039680778148628360"));(* 26, 26 *) +(mk_real_int (num_of_string "444897981453577826580919926")),(mk_real_int (num_of_string "36654637014112696977779920"));(* 26, 25 *) +(mk_real_int (num_of_string "62768415013884423999307776")),(mk_real_int (num_of_string "30075247130978033861959852"));(* 25, 25 *) +(mk_real_int (num_of_string "44692550502575316249803276")),(mk_real_int (num_of_string "185276979189362673496557756"));(* 25, 26 *) +(mk_real_int (num_of_string "578655588763458816680016")),(mk_real_int (num_of_string "190989645760408606651040062"));(* 23, 26 *) +(mk_real_int (num_of_string "7900278260016279019958280")),(mk_real_int (num_of_string "218162555413382699525526822"));(* 24, 26 *) +(mk_real_int (num_of_string "431902629861550302145680000")),(mk_real_int (num_of_string "6396668476820794499396360"));(* 26, 24 *) +(mk_real_int (num_of_string "11731640531119597739953470")),(mk_real_int (num_of_string "9298711424991592730227920"));(* 25, 24 *) +(mk_real_int (num_of_string "127215754227974748037467205")),(mk_real_int (num_of_string "22468444127591182314372378"));(* 26, 25 *) +(mk_real_int (num_of_string "292520544144964860703101448")),(mk_real_int (num_of_string "155273279152835983519472553"));(* 26, 26 *) +(mk_real_int (num_of_string "12053671468049721729536772")),(mk_real_int (num_of_string "83356922016152546249539672"));(* 25, 25 *) +(mk_real_int (num_of_string "269272502338718802994721796")),(mk_real_int (num_of_string "124315158164937884127368784"));(* 26, 26 *) +(mk_real_int (num_of_string "121288123499008749730729425")),(mk_real_int (num_of_string "6237696625913226883357872"));(* 26, 24 *) +(mk_real_int (num_of_string "152890256985450620570686464")),(mk_real_int (num_of_string "12599524895768493129585658"));(* 26, 25 *) +(mk_real_int (num_of_string "27960753374948852129650000")),(mk_real_int (num_of_string "85261734185283257796122400"));(* 25, 25 *) +(mk_real_int (num_of_string "6090336880186080907794240")),(mk_real_int (num_of_string "155140109962527646088228278"));(* 24, 26 *) +(mk_real_int (num_of_string "501034702227103642943340")),(mk_real_int (num_of_string "54233546279641893660689995"));(* 23, 25 *) +(mk_real_int (num_of_string "477870670389637455243811110")),(mk_real_int (num_of_string "211501282391312674906852866"));(* 26, 26 *) +(mk_real_int (num_of_string "23872766252823644945875280")),(mk_real_int (num_of_string "1371592481091729084726300"));(* 25, 24 *) +(mk_real_int (num_of_string "3617522210332166489604576")),(mk_real_int (num_of_string "60686928973162689836049684"));(* 24, 25 *) +(mk_real_int (num_of_string "125813799008471991322070316")),(mk_real_int (num_of_string "14221953028013748277327872"));(* 26, 25 *) +(mk_real_int (num_of_string "37305987350708659431945600")),(mk_real_int (num_of_string "158876247857947338885111504"));(* 25, 26 *) +(mk_real_int (num_of_string "73775028549188016926089102")),(mk_real_int (num_of_string "13294028558506907140142868"));(* 25, 25 *) +(mk_real_int (num_of_string "78527112059205094459659186")),(mk_real_int (num_of_string "117403308807273241153036860"));(* 25, 26 *) +(mk_real_int (num_of_string "115325042501303813106762790")),(mk_real_int (num_of_string "437189275630895925496800"));(* 26, 23 *) +(mk_real_int (num_of_string "44557626407419271516614683")),(mk_real_int (num_of_string "24523824602155246195372216"));(* 25, 25 *) +(mk_real_int (num_of_string "284303677716466832767316688")),(mk_real_int (num_of_string "11441813301122703234909556"));(* 26, 25 *) +(mk_real_int (num_of_string "48126056857922662342745484")),(mk_real_int (num_of_string "47968659139828088108113722"));(* 25, 25 *) +(mk_real_int (num_of_string "89986287554911571021530176")),(mk_real_int (num_of_string "18981713168114654609957440"));(* 25, 25 *) +(mk_real_int (num_of_string "12238822571029758759581568")),(mk_real_int (num_of_string "28646497865886531456128400"));(* 25, 25 *) +(mk_real_int (num_of_string "12255092860366083731309012")),(mk_real_int (num_of_string "39126119274624433207915935"));(* 25, 25 *) +(mk_real_int (num_of_string "78703170822464274267359464")),(mk_real_int (num_of_string "374439658583495220850333350"));(* 25, 26 *) +(mk_real_int (num_of_string "209718111929700748354250699")),(mk_real_int (num_of_string "74890606920747045715014965"));(* 26, 25 *) +(mk_real_int (num_of_string "973212366944342449265556")),(mk_real_int (num_of_string "4265971827130042992073152"));(* 23, 24 *) +(mk_real_int (num_of_string "621716103397291979766170")),(mk_real_int (num_of_string "177804009058908861763777704"));(* 23, 26 *) +(mk_real_int (num_of_string "83541660086248562780757819")),(mk_real_int (num_of_string "369382262123136567545134368"));(* 25, 26 *) +(mk_real_int (num_of_string "290309861211395105221733180")),(mk_real_int (num_of_string "138565371719005595319834396"));(* 26, 26 *) +(mk_real_int (num_of_string "13625536847921226235242720")),(mk_real_int (num_of_string "257899415892981967139498328"));(* 25, 26 *) +(mk_real_int (num_of_string "888460745261690722223085")),(mk_real_int (num_of_string "389753144661993032184865200"));(* 23, 26 *) +(mk_real_int (num_of_string "76931847611206051675680320")),(mk_real_int (num_of_string "5582126312059516314851888"));(* 25, 24 *) +(mk_real_int (num_of_string "176512498732970388628080480")),(mk_real_int (num_of_string "382576284179291796602438232"));(* 26, 26 *) +(mk_real_int (num_of_string "108039730766854934921718850")),(mk_real_int (num_of_string "34882028785593450981187920"));(* 26, 25 *) +(mk_real_int (num_of_string "41905896843294270205705500")),(mk_real_int (num_of_string "22813848547608640369313064"));(* 25, 25 *) +(mk_real_int (num_of_string "1237069085010263454693000")),(mk_real_int (num_of_string "731924455848031480630914"));(* 24, 23 *) +(mk_real_int (num_of_string "107764797346267429218661555")),(mk_real_int (num_of_string "6822396023351999859132000"));(* 26, 24 *) +(mk_real_int (num_of_string "132489497019626539882674606")),(mk_real_int (num_of_string "43946652207354345927401154"));(* 26, 25 *) +(mk_real_int (num_of_string "77377188918391936417586106")),(mk_real_int (num_of_string "39883903547026942412756109"));(* 25, 25 *) +(mk_real_int (num_of_string "585090339142390239068641200")),(mk_real_int (num_of_string "177365149541759003780069400"));(* 26, 26 *) +(mk_real_int (num_of_string "5919681659901647759929500")),(mk_real_int (num_of_string "15401642284413831304846992"));(* 24, 25 *) +(mk_real_int (num_of_string "320918218594434710837544278")),(mk_real_int (num_of_string "318873617381461035721253580"));(* 26, 26 *) +(mk_real_int (num_of_string "11984672790803680080016464")),(mk_real_int (num_of_string "15037545677536283989436425"));(* 25, 25 *) +(mk_real_int (num_of_string "212584865166215772454082592")),(mk_real_int (num_of_string "763802072583511992156246907"));(* 26, 26 *) +(mk_real_int (num_of_string "141503047299863776042281136")),(mk_real_int (num_of_string "10127292467669633438372025"));(* 26, 25 *) +(mk_real_int (num_of_string "314039627257264385635968750")),(mk_real_int (num_of_string "66491092343301177028578465"));(* 26, 25 *) +(mk_real_int (num_of_string "62658266091551147482264800")),(mk_real_int (num_of_string "214407398037061183382972544"));(* 25, 26 *) +(mk_real_int (num_of_string "1182312152201293273512912")),(mk_real_int (num_of_string "23694195523145136885343392"));(* 24, 25 *) +(mk_real_int (num_of_string "20800526741589669865745245")),(mk_real_int (num_of_string "34780354999224433570285206"));(* 25, 25 *) +(mk_real_int (num_of_string "21102005965096044408483567")),(mk_real_int (num_of_string "164652363615239470399986466"));(* 25, 26 *) +(mk_real_int (num_of_string "3800990166069478301196816")),(mk_real_int (num_of_string "242692846807198373972177734"));(* 24, 26 *) +(mk_real_int (num_of_string "29446186425087260880673360")),(mk_real_int (num_of_string "255498367072574459394115980"));(* 25, 26 *) +(mk_real_int (num_of_string "103001590650579842725775208")),(mk_real_int (num_of_string "3990924599328120336651684"));(* 26, 24 *) +(mk_real_int (num_of_string "6708131940087465507445950")),(mk_real_int (num_of_string "49125210082525720157663012"));(* 24, 25 *) +(mk_real_int (num_of_string "74980155936334998671767512")),(mk_real_int (num_of_string "142514836483615351634631648"));(* 25, 26 *) +(mk_real_int (num_of_string "926639854402640757011928")),(mk_real_int (num_of_string "69541369523498579174048070"));(* 23, 25 *) +(mk_real_int (num_of_string "82351706010892860076814790")),(mk_real_int (num_of_string "105502562214386976500931520"));(* 25, 26 *) +(mk_real_int (num_of_string "42269131793083894614083088")),(mk_real_int (num_of_string "5305414718197019848535400"));(* 25, 24 *) +(mk_real_int (num_of_string "16145086665356766842213650")),(mk_real_int (num_of_string "277901705440033756866668312"));(* 25, 26 *) +(mk_real_int (num_of_string "46996608529295963609388075")),(mk_real_int (num_of_string "23523301451171565747003040"));(* 25, 25 *) +(mk_real_int (num_of_string "117288016118692425716387904")),(mk_real_int (num_of_string "19548347575813718324075820"));(* 26, 25 *) +(mk_real_int (num_of_string "134914259709688444434218220")),(mk_real_int (num_of_string "161829538122298663667449380"));(* 26, 26 *) +(mk_real_int (num_of_string "325792745339171630767187850")),(mk_real_int (num_of_string "13727184353294772844047256"));(* 26, 25 *) +(mk_real_int (num_of_string "59347858194135012077947098")),(mk_real_int (num_of_string "284139964542229978668096"));(* 25, 23 *) +(mk_real_int (num_of_string "5661081071480485679491840")),(mk_real_int (num_of_string "50568128613214758613993275"));(* 24, 25 *) +(mk_real_int (num_of_string "24105907847739911547433980")),(mk_real_int (num_of_string "124169352085343311680956880"));(* 25, 26 *) +(mk_real_int (num_of_string "389527876651343498175597")),(mk_real_int (num_of_string "276819364685320409651715324"));(* 23, 26 *) +(mk_real_int (num_of_string "143877798588087872203126125")),(mk_real_int (num_of_string "13713555858745767004989292"));(* 26, 25 *) +(mk_real_int (num_of_string "20866024341070779843659550")),(mk_real_int (num_of_string "106207003716456391955641842"));(* 25, 26 *) +(mk_real_int (num_of_string "11686079766019203668347840")),(mk_real_int (num_of_string "17828688281153725672519428"));(* 25, 25 *) +(mk_real_int (num_of_string "100167944436384044043590237")),(mk_real_int (num_of_string "10983223719949271177418957"));(* 26, 25 *) +(mk_real_int (num_of_string "51450552219630827128974480")),(mk_real_int (num_of_string "233473277136582475673664081"));(* 25, 26 *) +(mk_real_int (num_of_string "111622927871440256800894776")),(mk_real_int (num_of_string "53691496139980203894232800"));(* 26, 25 *) +(mk_real_int (num_of_string "38505218740837331314132992")),(mk_real_int (num_of_string "216108382782518591705635086"));(* 25, 26 *) +(mk_real_int (num_of_string "21287407981881218221189548")),(mk_real_int (num_of_string "6981640172860580083616928"));(* 25, 24 *) +(mk_real_int (num_of_string "148137688603796002279081776")),(mk_real_int (num_of_string "27805133073817477166077980"));(* 26, 25 *) +(mk_real_int (num_of_string "141385445104534314726706790")),(mk_real_int (num_of_string "31602092819039866737967028"));(* 26, 25 *) +(mk_real_int (num_of_string "18246136963668841354085820")),(mk_real_int (num_of_string "324881246697903737256832568"));(* 25, 26 *) +(mk_real_int (num_of_string "203448657630316118319060216")),(mk_real_int (num_of_string "235876902173578904587764156"));(* 26, 26 *) +(mk_real_int (num_of_string "434966758436857676820922560")),(mk_real_int (num_of_string "62839159229331738066965544"));(* 26, 25 *) +(mk_real_int (num_of_string "54653294824336409761239120")),(mk_real_int (num_of_string "2374491963600258300804852"));(* 25, 24 *) +(mk_real_int (num_of_string "13735436423873469310151272")),(mk_real_int (num_of_string "223388655671318972326341300"));(* 25, 26 *) +(mk_real_int (num_of_string "685440047874114802252993680")),(mk_real_int (num_of_string "92456207551611531721946128"));(* 26, 25 *) +(mk_real_int (num_of_string "466100634781773880357875000")),(mk_real_int (num_of_string "71269047989071759429364164"));(* 26, 25 *) +(mk_real_int (num_of_string "180005000253306119609256000")),(mk_real_int (num_of_string "246095061832061335384831278"));(* 26, 26 *) +(mk_real_int (num_of_string "1805491102059375407925048")),(mk_real_int (num_of_string "20047113588112443671808354"));(* 24, 25 *) +(mk_real_int (num_of_string "12423957516906840908560536")),(mk_real_int (num_of_string "1643947001624459374737328"));(* 25, 24 *) +(mk_real_int (num_of_string "12297170150303451576309377")),(mk_real_int (num_of_string "339816729888375652310213088"));(* 25, 26 *) +(mk_real_int (num_of_string "38811814433651561501453436")),(mk_real_int (num_of_string "220466311533420262623424320"));(* 25, 26 *) +(mk_real_int (num_of_string "938486788930201380514920")),(mk_real_int (num_of_string "214869758239043659378799304"));(* 23, 26 *) +(mk_real_int (num_of_string "1541175343349128838736480")),(mk_real_int (num_of_string "385481890202462242751956404"));(* 24, 26 *) +(mk_real_int (num_of_string "194375386555655635214113262")),(mk_real_int (num_of_string "120935275650995725078585920"));(* 26, 26 *) +(mk_real_int (num_of_string "227419307429334568906399650")),(mk_real_int (num_of_string "134138450795216373440544600"));(* 26, 26 *) +(mk_real_int (num_of_string "34166656548633088199297266")),(mk_real_int (num_of_string "6815179701989167241187"));(* 25, 21 *) +(mk_real_int (num_of_string "1321715032472183388447216")),(mk_real_int (num_of_string "171610409643865924020742800"));(* 24, 26 *) +(mk_real_int (num_of_string "453319891793170097383378449")),(mk_real_int (num_of_string "58651860777027072026928"));(* 26, 22 *) +(mk_real_int (num_of_string "210663848519499481247178000")),(mk_real_int (num_of_string "120409625690224084897198493"));(* 26, 26 *) +(mk_real_int (num_of_string "5099889347962974125246400")),(mk_real_int (num_of_string "90782144763050004527556480"));(* 24, 25 *) +(mk_real_int (num_of_string "51883782085773756731031160")),(mk_real_int (num_of_string "72601191378568507251629760"));(* 25, 25 *) +(mk_real_int (num_of_string "320880601048122206390860976")),(mk_real_int (num_of_string "652924367842204658900782170"));(* 26, 26 *) +(mk_real_int (num_of_string "5935834910143644937732028")),(mk_real_int (num_of_string "51259970330262429497937450"));(* 24, 25 *) +(mk_real_int (num_of_string "212275073739085688700861786")),(mk_real_int (num_of_string "414766115668143677438186400"));(* 26, 26 *) +(mk_real_int (num_of_string "179981544056667510830689072")),(mk_real_int (num_of_string "108889360594299401835703680"));(* 26, 26 *) +(mk_real_int (num_of_string "71849560163540743050300288")),(mk_real_int (num_of_string "112926556863862768311977646"));(* 25, 26 *) +(mk_real_int (num_of_string "18723623906084971838816160")),(mk_real_int (num_of_string "3090262595227727029540248"));(* 25, 24 *) +(mk_real_int (num_of_string "2428371137573353690478640")),(mk_real_int (num_of_string "297825051080529404557944"));(* 24, 23 *) +(mk_real_int (num_of_string "180552200128586362674134400")),(mk_real_int (num_of_string "45040450735529572047158679"));(* 26, 25 *) +(mk_real_int (num_of_string "23506560630338462458852048")),(mk_real_int (num_of_string "60623196601962767358818848"));(* 25, 25 *) +(mk_real_int (num_of_string "112154798819841553432264608")),(mk_real_int (num_of_string "194011373909565036111612000"));(* 26, 26 *) +(mk_real_int (num_of_string "3729556535788409417708388")),(mk_real_int (num_of_string "8421439631098663013773500"));(* 24, 24 *) +(mk_real_int (num_of_string "80601527714781592214182440")),(mk_real_int (num_of_string "367436750665368892154572563"));(* 25, 26 *) +(mk_real_int (num_of_string "63711417649873130379757125")),(mk_real_int (num_of_string "47757836447074352186246230"));(* 25, 25 *) +(mk_real_int (num_of_string "81817422580447388931510900")),(mk_real_int (num_of_string "324734192536899491528679988"));(* 25, 26 *) +(mk_real_int (num_of_string "45073604778773565752324920")),(mk_real_int (num_of_string "8714683875328460169704718"));(* 25, 24 *) +(mk_real_int (num_of_string "3660067204419660506207925")),(mk_real_int (num_of_string "72321685029542931012002160"));(* 24, 25 *) +(mk_real_int (num_of_string "456336113628278051177850048")),(mk_real_int (num_of_string "65641068685341194382255672"));(* 26, 25 *) +(mk_real_int (num_of_string "581311906601481199148075760")),(mk_real_int (num_of_string "100551241413575796657553536"));(* 26, 26 *) +(mk_real_int (num_of_string "44254345905048853180474164")),(mk_real_int (num_of_string "585960482851696116748660230"));(* 25, 26 *) +(mk_real_int (num_of_string "6247768455005254804117608")),(mk_real_int (num_of_string "13341226342684665279424395"));(* 24, 25 *) +(mk_real_int (num_of_string "399810717659463279073920")),(mk_real_int (num_of_string "88765700571757363629944088"));(* 23, 25 *) +(mk_real_int (num_of_string "57513545553267063281655248")),(mk_real_int (num_of_string "275396193758837131531813638"));(* 25, 26 *) +(mk_real_int (num_of_string "60543559109698565030786138")),(mk_real_int (num_of_string "94427796132810224514413088"));(* 25, 25 *) +(mk_real_int (num_of_string "458066842028017227425828064")),(mk_real_int (num_of_string "4019133903774696286167720"));(* 26, 24 *) +(mk_real_int (num_of_string "162950057099087054982423516")),(mk_real_int (num_of_string "329172264402670689953773200"));(* 26, 26 *) +(mk_real_int (num_of_string "196219960140586391035188840")),(mk_real_int (num_of_string "62450369439298975138498620"));(* 26, 25 *) +(mk_real_int (num_of_string "20290915857301971523584955")),(mk_real_int (num_of_string "126300709225852021472531920"));(* 25, 26 *) +(mk_real_int (num_of_string "433427112476069884507406028")),(mk_real_int (num_of_string "58826548095419747283058800"));(* 26, 25 *) +(mk_real_int (num_of_string "79783632137147809770958044")),(mk_real_int (num_of_string "114395290028809460518894200"));(* 25, 26 *) +(mk_real_int (num_of_string "287297435924177812227720")),(mk_real_int (num_of_string "21572180974544997993357600"));(* 23, 25 *) +(mk_real_int (num_of_string "89345577158757673817252814")),(mk_real_int (num_of_string "14928948745847840318847588"));(* 25, 25 *) +(mk_real_int (num_of_string "174172879197552385489920")),(mk_real_int (num_of_string "159330773217139569015169472"));(* 23, 26 *) +(mk_real_int (num_of_string "392339804504372325004768000")),(mk_real_int (num_of_string "491946681162167933117275504"));(* 26, 26 *) +(mk_real_int (num_of_string "44839904203549016710910801")),(mk_real_int (num_of_string "120197221142061248862186432"));(* 25, 26 *) +(mk_real_int (num_of_string "1410976130091158646151128")),(mk_real_int (num_of_string "51931882119722881888368400"));(* 24, 25 *) +(mk_real_int (num_of_string "23275444388294351900908800")),(mk_real_int (num_of_string "254224462495198112998755444"));(* 25, 26 *) +(mk_real_int (num_of_string "37236945163620975500466522")),(mk_real_int (num_of_string "212626099145259591851999056"));(* 25, 26 *) +(mk_real_int (num_of_string "97229497367560694898117")),(mk_real_int (num_of_string "339960869090268669455585608"));(* 22, 26 *) +(mk_real_int (num_of_string "49392368399685415565609120")),(mk_real_int (num_of_string "55343782751267735702215224"));(* 25, 25 *) +(mk_real_int (num_of_string "16024983331013252271468800")),(mk_real_int (num_of_string "262483522332586076754622152"));(* 25, 26 *) +(mk_real_int (num_of_string "92075742081176133811317930")),(mk_real_int (num_of_string "5021378422481407198559984"));(* 25, 24 *) +(mk_real_int (num_of_string "13822115459059717262286912")),(mk_real_int (num_of_string "40748748750272896438786800"));(* 25, 25 *) +(mk_real_int (num_of_string "418283080904328469945751192")),(mk_real_int (num_of_string "2015735017576779880312084"));(* 26, 24 *) +(mk_real_int (num_of_string "99812057905158457089839408")),(mk_real_int (num_of_string "60755783047763071696342740"));(* 25, 25 *) +(mk_real_int (num_of_string "88923495967806850470318000")),(mk_real_int (num_of_string "152170146461991262237564800"));(* 25, 26 *) +(mk_real_int (num_of_string "3712375617386268555743816")),(mk_real_int (num_of_string "175464408301990139969923096"));(* 24, 26 *) +(mk_real_int (num_of_string "54077809340673237458929986")),(mk_real_int (num_of_string "404627886478599524647341464"));(* 25, 26 *) +(mk_real_int (num_of_string "259826168365109665092282")),(mk_real_int (num_of_string "15865085538163581166106976"));(* 23, 25 *) +(mk_real_int (num_of_string "225527392440741415623029076")),(mk_real_int (num_of_string "104270504843540394621850203"));(* 26, 26 *) +(mk_real_int (num_of_string "250124391889262030189199150")),(mk_real_int (num_of_string "48769244093182534981257600"));(* 26, 25 *) +(mk_real_int (num_of_string "20435180607480395109912700")),(mk_real_int (num_of_string "374079304100051945323254"));(* 25, 23 *) +(mk_real_int (num_of_string "162630705034695670976285130")),(mk_real_int (num_of_string "493494100043871922492303722"));(* 26, 26 *) +(mk_real_int (num_of_string "56315352116211051442588596")),(mk_real_int (num_of_string "65446971984974764184421888"));(* 25, 25 *) +(mk_real_int (num_of_string "411009808851297344678962500")),(mk_real_int (num_of_string "379621683432864746936870742"));(* 26, 26 *) +(mk_real_int (num_of_string "140538101679159770894034000")),(mk_real_int (num_of_string "81739307761916093185769420"));(* 26, 25 *) +(mk_real_int (num_of_string "161007951089381840163231600")),(mk_real_int (num_of_string "55624036857928082102088445"));(* 26, 25 *) +(mk_real_int (num_of_string "27138834800112406479987264")),(mk_real_int (num_of_string "129488733457453574515097679"));(* 25, 26 *) +(mk_real_int (num_of_string "3922302267813546856155400")),(mk_real_int (num_of_string "15139121024050207838386656"));(* 24, 25 *) +(mk_real_int (num_of_string "110235428057686904403229630")),(mk_real_int (num_of_string "180526755450816241512801918"));(* 26, 26 *) +(mk_real_int (num_of_string "562757895512841075999505050")),(mk_real_int (num_of_string "80705258129891822285930918"));(* 26, 25 *) +(mk_real_int (num_of_string "42758368255672577143298190")),(mk_real_int (num_of_string "45994665347830962798568896"));(* 25, 25 *) +(mk_real_int (num_of_string "104215341186038258038983648")),(mk_real_int (num_of_string "28156706700335340677171424"));(* 26, 25 *) +(mk_real_int (num_of_string "194649275777298014515780350")),(mk_real_int (num_of_string "53036804648675501566432416"));(* 26, 25 *) +(mk_real_int (num_of_string "58057746139733726268625574")),(mk_real_int (num_of_string "76656125485101384447348780"));(* 25, 25 *) +(mk_real_int (num_of_string "237983350324677612773686792")),(mk_real_int (num_of_string "93272455505308924506452"));(* 26, 22 *) +(mk_real_int (num_of_string "6082058366563777550375976")),(mk_real_int (num_of_string "246784606526569428200351250"));(* 24, 26 *) +(mk_real_int (num_of_string "6254623975487582093997312")),(mk_real_int (num_of_string "533256365322670818697960"));(* 24, 23 *) +(mk_real_int (num_of_string "15310887600253659072603428")),(mk_real_int (num_of_string "15876906859216627925781930"));(* 25, 25 *) +(mk_real_int (num_of_string "39146852972705255866808055")),(mk_real_int (num_of_string "14564461649782030459891200"));(* 25, 25 *) +(mk_real_int (num_of_string "81007535400855092786085186")),(mk_real_int (num_of_string "91395317853124287391093832"));(* 25, 25 *) +(mk_real_int (num_of_string "101374659683891432689014186")),(mk_real_int (num_of_string "23730928234740902470159200"));(* 26, 25 *) +(mk_real_int (num_of_string "161977342956762049401100672")),(mk_real_int (num_of_string "129983109453922583417589729"));(* 26, 26 *) +(mk_real_int (num_of_string "35297170667004073626754534")),(mk_real_int (num_of_string "343064411829741347852955422"));(* 25, 26 *) +(mk_real_int (num_of_string "232855023467246710919603520")),(mk_real_int (num_of_string "426242679351307175146740600"));(* 26, 26 *) +(mk_real_int (num_of_string "52305934901807530374383736")),(mk_real_int (num_of_string "222464315885855985697233867"));(* 25, 26 *) +(mk_real_int (num_of_string "185197949390888877018482432")),(mk_real_int (num_of_string "9339361304502717918730080"));(* 26, 24 *) +(mk_real_int (num_of_string "90538754766552392814366090")),(mk_real_int (num_of_string "26266115513585603113166280"));(* 25, 25 *) +(mk_real_int (num_of_string "125188436931903197595282220")),(mk_real_int (num_of_string "6405266304700037789577024"));(* 26, 24 *) +(mk_real_int (num_of_string "163321232178000139755926151")),(mk_real_int (num_of_string "19374452227465774117100208"));(* 26, 25 *) +(mk_real_int (num_of_string "122993954448462886196187915")),(mk_real_int (num_of_string "146406777281401199433757191"));(* 26, 26 *) +(mk_real_int (num_of_string "205789675113909350664499110")),(mk_real_int (num_of_string "287406124623481673455504400"));(* 26, 26 *) +(mk_real_int (num_of_string "79108299595235583172055872")),(mk_real_int (num_of_string "196468944397738290526120440"));(* 25, 26 *) +(mk_real_int (num_of_string "302667905192145734428138272")),(mk_real_int (num_of_string "89021516160050518405580340"));(* 26, 25 *) +(mk_real_int (num_of_string "115313649039806138402738985")),(mk_real_int (num_of_string "136824800644850609816762760"));(* 26, 26 *) +(mk_real_int (num_of_string "83505953892076184950754544")),(mk_real_int (num_of_string "209573462955675258028867734"));(* 25, 26 *) +(mk_real_int (num_of_string "220864140503623854545329476")),(mk_real_int (num_of_string "225617321411703843189744750"));(* 26, 26 *) +(mk_real_int (num_of_string "88852852462691733253736256")),(mk_real_int (num_of_string "122701196300643633986163876"));(* 25, 26 *) +(mk_real_int (num_of_string "30630452949097413245884680")),(mk_real_int (num_of_string "99820753076223364234894512"));(* 25, 25 *) +(mk_real_int (num_of_string "1205819824574169488648160")),(mk_real_int (num_of_string "505144794834641913830391098"));(* 24, 26 *) +(mk_real_int (num_of_string "177078467482167849527175556")),(mk_real_int (num_of_string "75930785998504989108418080"));(* 26, 25 *) +(mk_real_int (num_of_string "82656148440635895999030800")),(mk_real_int (num_of_string "154971543830121949324201408"));(* 25, 26 *) +(mk_real_int (num_of_string "15522071581182159231822714")),(mk_real_int (num_of_string "129931864325830521430082646"));(* 25, 26 *) +(mk_real_int (num_of_string "35570993072445572535287600")),(mk_real_int (num_of_string "105917598816148894084505265"));(* 25, 26 *) +(mk_real_int (num_of_string "493837504100854051158366696")),(mk_real_int (num_of_string "26357170133223084242691450"));(* 26, 25 *) +(mk_real_int (num_of_string "919288126360529696873049640")),(mk_real_int (num_of_string "36808417961342232143811522"));(* 26, 25 *) +(mk_real_int (num_of_string "41097350074266897265866720")),(mk_real_int (num_of_string "152976071149820537114728320"));(* 25, 26 *) +(mk_real_int (num_of_string "152181923865252399403735296")),(mk_real_int (num_of_string "81855099896495137931696250"));(* 26, 25 *) +(mk_real_int (num_of_string "51437748496104563332193310")),(mk_real_int (num_of_string "185468504568960127862981024"));(* 25, 26 *) +(mk_real_int (num_of_string "5843841633358273702621368")),(mk_real_int (num_of_string "626922273503837653661882304"));(* 24, 26 *) +(mk_real_int (num_of_string "476114009112223549531961630")),(mk_real_int (num_of_string "87322992260996170998840300"));(* 26, 25 *) +(mk_real_int (num_of_string "131892123848377349218325760")),(mk_real_int (num_of_string "370939760741317827756616"));(* 26, 23 *) +(mk_real_int (num_of_string "151134283355799158119369170")),(mk_real_int (num_of_string "10410418530516484133068770"));(* 26, 25 *) +(mk_real_int (num_of_string "111420946257554473743630240")),(mk_real_int (num_of_string "37469997365103083529465504"));(* 26, 25 *) +(mk_real_int (num_of_string "15073461590194664809329784")),(mk_real_int (num_of_string "8899457992989890754472800"));(* 25, 24 *) +(mk_real_int (num_of_string "37493323018895142840451934")),(mk_real_int (num_of_string "129885903658182101033708280"));(* 25, 26 *) +(mk_real_int (num_of_string "391318657753585621208032")),(mk_real_int (num_of_string "399408583388762870751826368"));(* 23, 26 *) +(mk_real_int (num_of_string "191509684135162933370856480")),(mk_real_int (num_of_string "24844282677419432555312976"));(* 26, 25 *) +(mk_real_int (num_of_string "9851979938916257771280432")),(mk_real_int (num_of_string "239835969875946884990764550"));(* 24, 26 *) +(mk_real_int (num_of_string "76703581724178666493491200")),(mk_real_int (num_of_string "46686713370348825010134520"));(* 25, 25 *) +(mk_real_int (num_of_string "149371169661300093669686978")),(mk_real_int (num_of_string "104315238740603731035368376"));(* 26, 26 *) +(mk_real_int (num_of_string "1848504819687652161779550")),(mk_real_int (num_of_string "153598334255104926365048778"));(* 24, 26 *) +(mk_real_int (num_of_string "215544271788775201795421175")),(mk_real_int (num_of_string "11162065447903187990628225"));(* 26, 25 *) +(mk_real_int (num_of_string "176884056276390261184109920")),(mk_real_int (num_of_string "126319640668079994916473420"));(* 26, 26 *) +(mk_real_int (num_of_string "194235377319432026424950400")),(mk_real_int (num_of_string "96601963709296847285353552"));(* 26, 25 *) +(mk_real_int (num_of_string "258379519070518606593734286")),(mk_real_int (num_of_string "271864005181549990760982216"));(* 26, 26 *) +(mk_real_int (num_of_string "6702762673279553259980280")),(mk_real_int (num_of_string "221966878363476076898484336"));(* 24, 26 *) +(mk_real_int (num_of_string "836577470444500759502389888")),(mk_real_int (num_of_string "247644308145840324280320"));(* 26, 23 *) +(mk_real_int (num_of_string "47611142838804804449089290")),(mk_real_int (num_of_string "208427580283401968925097364"));(* 25, 26 *) +(mk_real_int (num_of_string "296388340210114339280261175")),(mk_real_int (num_of_string "34148843128840905244352016"));(* 26, 25 *) +(mk_real_int (num_of_string "64100113366254090668318160")),(mk_real_int (num_of_string "109482805304517490684541888"));(* 25, 26 *) +(mk_real_int (num_of_string "67469525207135444024970000")),(mk_real_int (num_of_string "211491939841106873835712320"));(* 25, 26 *) +(mk_real_int (num_of_string "12442827507922255594696000")),(mk_real_int (num_of_string "114808943014281239379141213"));(* 25, 26 *) +(mk_real_int (num_of_string "106947485384438604137752156")),(mk_real_int (num_of_string "66440270197420812686982582"));(* 26, 25 *) +(mk_real_int (num_of_string "81701223659312628942197820")),(mk_real_int (num_of_string "224553386410805517921197901"));(* 25, 26 *) +(mk_real_int (num_of_string "239103092192003256239937990")),(mk_real_int (num_of_string "30269138748821841095671808"));(* 26, 25 *) +(mk_real_int (num_of_string "34616667592444946434803000")),(mk_real_int (num_of_string "296207615011023441203548356"));(* 25, 26 *) +(mk_real_int (num_of_string "2423941874508669048534276")),(mk_real_int (num_of_string "24632080771267810827787360"));(* 24, 25 *) +(mk_real_int (num_of_string "32222194536256444559446974")),(mk_real_int (num_of_string "70682855137792579621506996"));(* 25, 25 *) +(mk_real_int (num_of_string "35736235504977816545038902")),(mk_real_int (num_of_string "144183992856381938461445865"));(* 25, 26 *) +(mk_real_int (num_of_string "337225097976511751668676560")),(mk_real_int (num_of_string "14168369171765512052441268"));(* 26, 25 *) +(mk_real_int (num_of_string "28457648935994868261731424")),(mk_real_int (num_of_string "194430085420515136520871400"));(* 25, 26 *) +(mk_real_int (num_of_string "3510217663290780111970452")),(mk_real_int (num_of_string "207597513442531604715385920"));(* 24, 26 *) +(mk_real_int (num_of_string "24056225908930196757289560")),(mk_real_int (num_of_string "56448882848301562868856064"));(* 25, 25 *) +(mk_real_int (num_of_string "233979627977952373968017112")),(mk_real_int (num_of_string "72062052074237987253919152"));(* 26, 25 *) +(mk_real_int (num_of_string "223604101565786779181818560")),(mk_real_int (num_of_string "27174168836620901745525296"));(* 26, 25 *) +(mk_real_int (num_of_string "17528767858895634858349580")),(mk_real_int (num_of_string "168553714182939137274183832"));(* 25, 26 *) +(mk_real_int (num_of_string "5557452594460879804501500")),(mk_real_int (num_of_string "129881731890993342759814104"));(* 24, 26 *) +(mk_real_int (num_of_string "29718579635560371213007776")),(mk_real_int (num_of_string "34619097468125662931666216"));(* 25, 25 *) +(mk_real_int (num_of_string "92501436685299682083816800")),(mk_real_int (num_of_string "26673990192443188865413632"));(* 25, 25 *) +(mk_real_int (num_of_string "29273588247113948416936320")),(mk_real_int (num_of_string "16013222575628895408791070"));(* 25, 25 *) +(mk_real_int (num_of_string "315040416116980756015176200")),(mk_real_int (num_of_string "72940347307005234229335600"));(* 26, 25 *) +(mk_real_int (num_of_string "11954403209145829317385864")),(mk_real_int (num_of_string "301974449031713965064279232"));(* 25, 26 *) +(mk_real_int (num_of_string "214817512100409264655520190")),(mk_real_int (num_of_string "158329378990034833719864096"));(* 26, 26 *) +(mk_real_int (num_of_string "1225157583243680344019520")),(mk_real_int (num_of_string "178669978118523169288819980"));(* 24, 26 *) +(mk_real_int (num_of_string "78492915678000431196543000")),(mk_real_int (num_of_string "793202645313817690917460"));(* 25, 23 *) +(mk_real_int (num_of_string "171189407989735922812223695")),(mk_real_int (num_of_string "339671414999752448280445512"));(* 26, 26 *) +(mk_real_int (num_of_string "15459685919194836062864435")),(mk_real_int (num_of_string "4362901825183060499242358"));(* 25, 24 *) +(mk_real_int (num_of_string "249109406572574126693288979")),(mk_real_int (num_of_string "3001290313934159001567459"));(* 26, 24 *) +(mk_real_int (num_of_string "27681436456084491374864100")),(mk_real_int (num_of_string "15725410332619531640329155"));(* 25, 25 *) +(mk_real_int (num_of_string "423941217418327598030201490")),(mk_real_int (num_of_string "115544786296081286853636480"));(* 26, 26 *) +(mk_real_int (num_of_string "225085000972283878373955520")),(mk_real_int (num_of_string "381085660566471666598987500"));(* 26, 26 *) +(mk_real_int (num_of_string "156462001420151346990414840")),(mk_real_int (num_of_string "189221085098721902383765800"));(* 26, 26 *) +(mk_real_int (num_of_string "70672431861320763907696950")),(mk_real_int (num_of_string "370062604667052890680568184"));(* 25, 26 *) +(mk_real_int (num_of_string "104717361470572415859939000")),(mk_real_int (num_of_string "76941239216532554666140650"));(* 26, 25 *) +(mk_real_int (num_of_string "1867504685079455023214206")),(mk_real_int (num_of_string "124746372828024556911116220"));(* 24, 26 *) +(mk_real_int (num_of_string "489574575110683448109360")),(mk_real_int (num_of_string "21049034132684449748198762"));(* 23, 25 *) +(mk_real_int (num_of_string "197343428569747890629181840")),(mk_real_int (num_of_string "27069674876858914322163456"));(* 26, 25 *) +(mk_real_int (num_of_string "201336853027726432183379520")),(mk_real_int (num_of_string "9066714030593720214426486"));(* 26, 24 *) +(mk_real_int (num_of_string "24002555599269227455979400")),(mk_real_int (num_of_string "87087241416958248314261268"));(* 25, 25 *) +(mk_real_int (num_of_string "59387013338043309759435336")),(mk_real_int (num_of_string "41593128302500330158835200"));(* 25, 25 *) +(mk_real_int (num_of_string "324343298568684881593760279")),(mk_real_int (num_of_string "60217938003608513048504106"));(* 26, 25 *) +(mk_real_int (num_of_string "101032577656534567469611008")),(mk_real_int (num_of_string "55329529869567275553483660"));(* 26, 25 *) +(mk_real_int (num_of_string "10952778080002163151368034")),(mk_real_int (num_of_string "41557989373215707862653820"));(* 25, 25 *) +(mk_real_int (num_of_string "40857843254004830718989604")),(mk_real_int (num_of_string "263961421753559446217915244"));(* 25, 26 *) +(mk_real_int (num_of_string "88101501887986104160841055")),(mk_real_int (num_of_string "58092991468720491774032100"));(* 25, 25 *) +(mk_real_int (num_of_string "325052362518574024852277760")),(mk_real_int (num_of_string "28078134237065376892114554"));(* 26, 25 *) +(mk_real_int (num_of_string "387315940431876946743834")),(mk_real_int (num_of_string "35167828013175547269005088"));(* 23, 25 *) +(mk_real_int (num_of_string "357510364981792796689130248")),(mk_real_int (num_of_string "9826128219242835832000575"));(* 26, 24 *) +(mk_real_int (num_of_string "36851702874561639826901958")),(mk_real_int (num_of_string "59252849985174880329949646"));(* 25, 25 *) +(mk_real_int (num_of_string "430105201101521896085477925")),(mk_real_int (num_of_string "344125827283953466950836544"));(* 26, 26 *) +(mk_real_int (num_of_string "45835099031954985077768346")),(mk_real_int (num_of_string "513680913630338840235622080"));(* 25, 26 *) +(mk_real_int (num_of_string "625931768461956277572343080")),(mk_real_int (num_of_string "234844862820799929218211852"));(* 26, 26 *) +(mk_real_int (num_of_string "21955442028250641696228704")),(mk_real_int (num_of_string "13666771406323490563032000"));(* 25, 25 *) +(mk_real_int (num_of_string "21149480630457706299086580")),(mk_real_int (num_of_string "198646969462570115316050520"));(* 25, 26 *) +(mk_real_int (num_of_string "233745587089712599953090312")),(mk_real_int (num_of_string "67824330357750649635898816"));(* 26, 25 *) +(mk_real_int (num_of_string "40083135819359798668474335")),(mk_real_int (num_of_string "245439689266869552302587740"));(* 25, 26 *) +(mk_real_int (num_of_string "183775453512228896441627")),(mk_real_int (num_of_string "220562746138963393485883500"));(* 23, 26 *) +(mk_real_int (num_of_string "372773006063123272745365980")),(mk_real_int (num_of_string "140784232457612271119514160"));(* 26, 26 *) +(mk_real_int (num_of_string "104526856572439195338827760")),(mk_real_int (num_of_string "364462793239150003721070496"));(* 26, 26 *) +(mk_real_int (num_of_string "2011960288023567983000944")),(mk_real_int (num_of_string "36637992090961055086843320"));(* 24, 25 *) +(mk_real_int (num_of_string "39241722175943450568028624")),(mk_real_int (num_of_string "193939260844567392818849604"));(* 25, 26 *) +(mk_real_int (num_of_string "529568345942011100308038")),(mk_real_int (num_of_string "93827845560247795676148"));(* 23, 22 *) +(mk_real_int (num_of_string "506175990082900559831841300")),(mk_real_int (num_of_string "31722872773422984009617700"));(* 26, 25 *) +(mk_real_int (num_of_string "3049716832778815791467322")),(mk_real_int (num_of_string "6461017593636757357676680"));(* 24, 24 *) +(mk_real_int (num_of_string "31574976438298846544762784")),(mk_real_int (num_of_string "86055977734520335688065200"));(* 25, 25 *) +(mk_real_int (num_of_string "56472059911647542989096170")),(mk_real_int (num_of_string "98026795544543331108296220"));(* 25, 25 *) +(mk_real_int (num_of_string "154894452239136501733917672")),(mk_real_int (num_of_string "171772573378834831967057516"));(* 26, 26 *) +(mk_real_int (num_of_string "651989861955465525861341")),(mk_real_int (num_of_string "276817830797404350712403040"));(* 23, 26 *) +(mk_real_int (num_of_string "70193860662897867420065178")),(mk_real_int (num_of_string "1015995820619200056772608"));(* 25, 24 *) +(mk_real_int (num_of_string "52399284296481652596355392")),(mk_real_int (num_of_string "30901533288632851463260224"));(* 25, 25 *) +(mk_real_int (num_of_string "48158272484948890791414855")),(mk_real_int (num_of_string "339499205102682626875756116"));(* 25, 26 *) +(mk_real_int (num_of_string "17392187250010657930299108")),(mk_real_int (num_of_string "697961322658792828435878"));(* 25, 23 *) +(mk_real_int (num_of_string "16555068608390807269632086")),(mk_real_int (num_of_string "128829852310473828873695180"));(* 25, 26 *) +(mk_real_int (num_of_string "49950518864426740806337392")),(mk_real_int (num_of_string "546428817889031820982456217"));(* 25, 26 *) +(mk_real_int (num_of_string "3184130815158350804429298")),(mk_real_int (num_of_string "289932399367074108704658960"));(* 24, 26 *) +(mk_real_int (num_of_string "2884586439158754749202080")),(mk_real_int (num_of_string "8077727174506373940211110"));(* 24, 24 *) +(mk_real_int (num_of_string "99987080859695139980143014")),(mk_real_int (num_of_string "1081007835405515495659550"));(* 25, 24 *) +(mk_real_int (num_of_string "310790965284331802270545920")),(mk_real_int (num_of_string "64159949797885460180457270"));(* 26, 25 *) +(mk_real_int (num_of_string "42358201704572085007353900")),(mk_real_int (num_of_string "46350985715909345074347360"));(* 25, 25 *) +(mk_real_int (num_of_string "263224308699445906107357480")),(mk_real_int (num_of_string "161460745986574256496550848"));(* 26, 26 *) +(mk_real_int (num_of_string "23556848919920223557717676")),(mk_real_int (num_of_string "24084205759686842449431078"));(* 25, 25 *) +(mk_real_int (num_of_string "342058631035689241215785500")),(mk_real_int (num_of_string "338729860635207964243944480"));(* 26, 26 *) +(mk_real_int (num_of_string "54336434373872746832363520")),(mk_real_int (num_of_string "236806815467050791653376640"));(* 25, 26 *) +(mk_real_int (num_of_string "70337103563345810247991584")),(mk_real_int (num_of_string "72748760878790310529406364"));(* 25, 25 *) +(mk_real_int (num_of_string "14689592282635906574549688")),(mk_real_int (num_of_string "2514247363771813385362449"));(* 25, 24 *) +(mk_real_int (num_of_string "180769928510978610143365728")),(mk_real_int (num_of_string "89916018811245517937616787"));(* 26, 25 *) +(mk_real_int (num_of_string "31461821622840042314232240")),(mk_real_int (num_of_string "188205699575212123793126104"));(* 25, 26 *) +(mk_real_int (num_of_string "261914254095670799572649781")),(mk_real_int (num_of_string "99056818252880461389098760"));(* 26, 25 *) +(mk_real_int (num_of_string "95911184412986891886637560")),(mk_real_int (num_of_string "134492114565066113802922680"));(* 25, 26 *) +(mk_real_int (num_of_string "145640879225955854822599128")),(mk_real_int (num_of_string "93886447145216447118307680"));(* 26, 25 *) +(mk_real_int (num_of_string "18265120473568607486780904")),(mk_real_int (num_of_string "20741643808530812043914400"));(* 25, 25 *) +(mk_real_int (num_of_string "42606667311748741258064370")),(mk_real_int (num_of_string "386996284735105375277153024"));(* 25, 26 *) +(mk_real_int (num_of_string "432762475821531753115024884")),(mk_real_int (num_of_string "60428984573049714105562944"));(* 26, 25 *) +(mk_real_int (num_of_string "227487149919928968358463616")),(mk_real_int (num_of_string "39844097904376052531519925"));(* 26, 25 *) +(mk_real_int (num_of_string "21100052167651158360764490")),(mk_real_int (num_of_string "2474538988937193138272250"));(* 25, 24 *) +(mk_real_int (num_of_string "59764375291679061912090000")),(mk_real_int (num_of_string "408757199628628865277362440"));(* 25, 26 *) +(mk_real_int (num_of_string "293375022403204497761621460")),(mk_real_int (num_of_string "218871167083916918168840"));(* 26, 23 *) +(mk_real_int (num_of_string "151813371483942071832299520")),(mk_real_int (num_of_string "116534404670309244919692216"));(* 26, 26 *) +(mk_real_int (num_of_string "17484780749475556318345821")),(mk_real_int (num_of_string "18174514982691974501658150"));(* 25, 25 *) +(mk_real_int (num_of_string "102294880353299775508448562")),(mk_real_int (num_of_string "42774094864858770210839130"));(* 26, 25 *) +(mk_real_int (num_of_string "180377116446286949609332000")),(mk_real_int (num_of_string "14832330275625175576817754"));(* 26, 25 *) +(mk_real_int (num_of_string "116597010652143178040561132")),(mk_real_int (num_of_string "31217787630465852473844252"));(* 26, 25 *) +(mk_real_int (num_of_string "127069017656524001777891484")),(mk_real_int (num_of_string "38475100647452593157685344"));(* 26, 25 *) +(mk_real_int (num_of_string "22175770998075528819117968")),(mk_real_int (num_of_string "6548475115429724533445065"));(* 25, 24 *) +(mk_real_int (num_of_string "37855920529179272699621910")),(mk_real_int (num_of_string "38155856770033747757052824"));(* 25, 25 *) +(mk_real_int (num_of_string "57843151422402117415122600")),(mk_real_int (num_of_string "50485350541793385229687825"));(* 25, 25 *) +(mk_real_int (num_of_string "144830598434319012455122455")),(mk_real_int (num_of_string "2317615381936096966451284"));(* 26, 24 *) +(mk_real_int (num_of_string "6440933838341110674529656")),(mk_real_int (num_of_string "36678142026905685251458816"));(* 24, 25 *) +(mk_real_int (num_of_string "433307679629248635678879664")),(mk_real_int (num_of_string "11819933827402188445898889"));(* 26, 25 *) +(mk_real_int (num_of_string "413552813457591378440417172")),(mk_real_int (num_of_string "2370114655023672844352415"));(* 26, 24 *) +(mk_real_int (num_of_string "381592807026891004210530024")),(mk_real_int (num_of_string "23918209491624178001286306"));(* 26, 25 *) +(mk_real_int (num_of_string "2880682738242672558327570")),(mk_real_int (num_of_string "13091558997555007487124750"));(* 24, 25 *) +(mk_real_int (num_of_string "68415054245365993307612856")),(mk_real_int (num_of_string "27335270311783553810661150"));(* 25, 25 *) +(mk_real_int (num_of_string "68824075509518787369288000")),(mk_real_int (num_of_string "130699038071193197542916024"));(* 25, 26 *) +(mk_real_int (num_of_string "149692501146787462640247084")),(mk_real_int (num_of_string "240702242348489251145947578"));(* 26, 26 *) +(mk_real_int (num_of_string "630202859455058775168716562")),(mk_real_int (num_of_string "9364327023497089028228424"));(* 26, 24 *) +(mk_real_int (num_of_string "8194282447954401886601940")),(mk_real_int (num_of_string "5907856506213803820357528"));(* 24, 24 *) +(mk_real_int (num_of_string "273697355872961074797417360")),(mk_real_int (num_of_string "150803123434928559675282864"));(* 26, 26 *) +(mk_real_int (num_of_string "68107303220672968529882640")),(mk_real_int (num_of_string "28003487427337142001839760"));(* 25, 25 *) +(mk_real_int (num_of_string "1207440584204555237241936")),(mk_real_int (num_of_string "32972864614840263913609995"));(* 24, 25 *) +(mk_real_int (num_of_string "54066665157718384858899040")),(mk_real_int (num_of_string "29959620313042408507793820"));(* 25, 25 *) +(mk_real_int (num_of_string "7233159082053229457781600")),(mk_real_int (num_of_string "11156557785799733017366040"));(* 24, 25 *) +(mk_real_int (num_of_string "138966653174705067826470240")),(mk_real_int (num_of_string "9291664960599268652165376"));(* 26, 24 *) +(mk_real_int (num_of_string "169972300361500924594042389")),(mk_real_int (num_of_string "4413079524608170346764530"));(* 26, 24 *) +(mk_real_int (num_of_string "84541915116590126922255865")),(mk_real_int (num_of_string "64210651997581348429214590"));(* 25, 25 *) +(mk_real_int (num_of_string "341558248172906490485760000")),(mk_real_int (num_of_string "439592092466087084593200"));(* 26, 23 *) +(mk_real_int (num_of_string "42126038393653776780718092")),(mk_real_int (num_of_string "270826520340126533036428560"));(* 25, 26 *) +(mk_real_int (num_of_string "90930720798220387537223424")),(mk_real_int (num_of_string "8773292440491244974039780"));(* 25, 24 *) +(mk_real_int (num_of_string "284133809286685816779976749")),(mk_real_int (num_of_string "6700657656298225520425536"));(* 26, 24 *) +(mk_real_int (num_of_string "54144075442858450273924884")),(mk_real_int (num_of_string "180923677764729133123196160"));(* 25, 26 *) +(mk_real_int (num_of_string "15676132970032719869814232")),(mk_real_int (num_of_string "28904759958888678466749750"));(* 25, 25 *) +(mk_real_int (num_of_string "137394936322327291185903996")),(mk_real_int (num_of_string "18863776467047311971806568"));(* 26, 25 *) +(mk_real_int (num_of_string "13086061688448502773379800")),(mk_real_int (num_of_string "123851340106619139880898460"));(* 25, 26 *) +(mk_real_int (num_of_string "85944825088247334931481042")),(mk_real_int (num_of_string "189767266075150625243516316"));(* 25, 26 *) +(mk_real_int (num_of_string "163664221180260231209025540")),(mk_real_int (num_of_string "583851214597978383351589222"));(* 26, 26 *) +(mk_real_int (num_of_string "37860780007495792760952960")),(mk_real_int (num_of_string "12778131621039471728533360"));(* 25, 25 *) +(mk_real_int (num_of_string "136817600367802836798965376")),(mk_real_int (num_of_string "521845340550023270457086256"));(* 26, 26 *) +(mk_real_int (num_of_string "142943303921608096692725760")),(mk_real_int (num_of_string "527129409690096035300231552"));(* 26, 26 *) +(mk_real_int (num_of_string "228192482314268172630910400")),(mk_real_int (num_of_string "1013184771008012182383480"));(* 26, 24 *) +(mk_real_int (num_of_string "284966383659304188432234872")),(mk_real_int (num_of_string "139862027335054289986974682"));(* 26, 26 *) +(mk_real_int (num_of_string "71979681018288710690766720")),(mk_real_int (num_of_string "131118939488925032042497085"));(* 25, 26 *) +(mk_real_int (num_of_string "3698845606957178920011888")),(mk_real_int (num_of_string "163085472877520936807863376"));(* 24, 26 *) +(mk_real_int (num_of_string "8905425850527301146493785")),(mk_real_int (num_of_string "636587027411585395340994336"));(* 24, 26 *) +(mk_real_int (num_of_string "89142201410580866361271032")),(mk_real_int (num_of_string "3094359649636480460202033"));(* 25, 24 *) +(mk_real_int (num_of_string "15968438653457955002150650")),(mk_real_int (num_of_string "264373093500393728602313730"));(* 25, 26 *) +(mk_real_int (num_of_string "39828055776355211157821000")),(mk_real_int (num_of_string "124398766489224912927855956"));(* 25, 26 *) +(mk_real_int (num_of_string "8299838641638307056156864")),(mk_real_int (num_of_string "186379865255583232029023760"));(* 24, 26 *) +(mk_real_int (num_of_string "1183930684103930299403328")),(mk_real_int (num_of_string "564163247888081401933762438"));(* 24, 26 *) +(mk_real_int (num_of_string "153348617940843081052099200")),(mk_real_int (num_of_string "441122041075546542065560470"));(* 26, 26 *) +(mk_real_int (num_of_string "48304733207115523885478352")),(mk_real_int (num_of_string "76880188932365475224283888"));(* 25, 25 *) +(mk_real_int (num_of_string "18702787100091352779881184")),(mk_real_int (num_of_string "51504501207002436545700384"));(* 25, 25 *) +(mk_real_int (num_of_string "406128143542930114952435776")),(mk_real_int (num_of_string "235445646626131469338850436"));(* 26, 26 *) +(mk_real_int (num_of_string "2518794099870168961723968")),(mk_real_int (num_of_string "7006499916484090399935925"));(* 24, 24 *) +(mk_real_int (num_of_string "56935896013938897775248000")),(mk_real_int (num_of_string "4945952316545763910868295"));(* 25, 24 *) +(mk_real_int (num_of_string "14295198370185450197895690")),(mk_real_int (num_of_string "44886840142202859220172280"));(* 25, 25 *) +(mk_real_int (num_of_string "34048000668778865054869306")),(mk_real_int (num_of_string "10343997920679684100803162"));(* 25, 25 *) +(mk_real_int (num_of_string "4998688624991694952344560")),(mk_real_int (num_of_string "143450095820117659757697966"));(* 24, 26 *) +(mk_real_int (num_of_string "134809209719333955482376805")),(mk_real_int (num_of_string "62817370689153077903586496"));(* 26, 25 *) +(mk_real_int (num_of_string "46545002518935663461515734")),(mk_real_int (num_of_string "22136807729153903782598"));(* 25, 22 *) +(mk_real_int (num_of_string "231320380305338995733056470")),(mk_real_int (num_of_string "40762457382983352092941800"));(* 26, 25 *) +(mk_real_int (num_of_string "5243608931912070341868320")),(mk_real_int (num_of_string "328496367160679863378662636"));(* 24, 26 *) +(mk_real_int (num_of_string "78335175346971017245822656")),(mk_real_int (num_of_string "4037335805335132206892224"));(* 25, 24 *) +(mk_real_int (num_of_string "76851310403192888508389384")),(mk_real_int (num_of_string "417603323590561704097796820"));(* 25, 26 *) +(mk_real_int (num_of_string "309765547622742071732140720")),(mk_real_int (num_of_string "2140281490297082509880584"));(* 26, 24 *) +(mk_real_int (num_of_string "14587406451071071593458112")),(mk_real_int (num_of_string "13567606530506878728033480"));(* 25, 25 *) +(mk_real_int (num_of_string "30909143867698486689818280")),(mk_real_int (num_of_string "171948683472085390025830350"));(* 25, 26 *) +(mk_real_int (num_of_string "329350562655522352548479239")),(mk_real_int (num_of_string "198915807602938493551929375"));(* 26, 26 *) +(mk_real_int (num_of_string "283398362508097483533241875")),(mk_real_int (num_of_string "106947705437480099228607920"));(* 26, 26 *) +(mk_real_int (num_of_string "28825668235183994805198720")),(mk_real_int (num_of_string "30578934153823237165140300"));(* 25, 25 *) +(mk_real_int (num_of_string "99641329072448545880630272")),(mk_real_int (num_of_string "177398751432818387009057975"));(* 25, 26 *) +(mk_real_int (num_of_string "136631921650144573041101570")),(mk_real_int (num_of_string "169990813732200406015243920"));(* 26, 26 *) +(mk_real_int (num_of_string "547651661083809285597087780")),(mk_real_int (num_of_string "33650947287541384842179448"));(* 26, 25 *) +(mk_real_int (num_of_string "87628013456926484529321264")),(mk_real_int (num_of_string "879845852002806031829040"));(* 25, 23 *) +(mk_real_int (num_of_string "4908676645804887990181278")),(mk_real_int (num_of_string "441846058335908737321860865"));(* 24, 26 *) +(mk_real_int (num_of_string "84450065805438253006400864")),(mk_real_int (num_of_string "8569044747690184954598220"));(* 25, 24 *) +(mk_real_int (num_of_string "13606674698615042865589002")),(mk_real_int (num_of_string "1432263432315605152073580"));(* 25, 24 *) +(mk_real_int (num_of_string "12062232294905013060919248")),(mk_real_int (num_of_string "34664785030711497887141308"));(* 25, 25 *) +(mk_real_int (num_of_string "247594656506620624251330726")),(mk_real_int (num_of_string "107993444103317404537012251"));(* 26, 26 *) +(mk_real_int (num_of_string "113216758697900474822183706")),(mk_real_int (num_of_string "112466879803293619913439984"));(* 26, 26 *) +(mk_real_int (num_of_string "4825686946305259779196560")),(mk_real_int (num_of_string "7136289067183337748952640"));(* 24, 24 *) +(mk_real_int (num_of_string "1010676748972984487852130")),(mk_real_int (num_of_string "92284413749865758640841632"));(* 24, 25 *) +(mk_real_int (num_of_string "459061040556543175374093210")),(mk_real_int (num_of_string "173996819588173280251383792"));(* 26, 26 *) +(mk_real_int (num_of_string "537902419795523366748652416")),(mk_real_int (num_of_string "22560293066854997080245300"));(* 26, 25 *) +(mk_real_int (num_of_string "482322932502981711219346360")),(mk_real_int (num_of_string "307590494254998475638843916"));(* 26, 26 *) +(mk_real_int (num_of_string "8587526681855000025123960")),(mk_real_int (num_of_string "253747057535852581222375464"));(* 24, 26 *) +(mk_real_int (num_of_string "311101646642991021722059638")),(mk_real_int (num_of_string "17565704386223597494534904"));(* 26, 25 *) +(mk_real_int (num_of_string "491995824996186989063536860")),(mk_real_int (num_of_string "86754176544338465800871406"));(* 26, 25 *) +(mk_real_int (num_of_string "94749468619620781232730750")),(mk_real_int (num_of_string "100374696723335749379379540"));(* 25, 26 *) +(mk_real_int (num_of_string "655795296167781814929696")),(mk_real_int (num_of_string "185835236435789341822567758"));(* 23, 26 *) +(mk_real_int (num_of_string "92063819930097855967633350")),(mk_real_int (num_of_string "28205824513991777773317648"));(* 25, 25 *) +(mk_real_int (num_of_string "4314308765234760753611654")),(mk_real_int (num_of_string "309142043906615848157007636"));(* 24, 26 *) +(mk_real_int (num_of_string "9343889322909695200241520")),(mk_real_int (num_of_string "183573158621721618091118469"));(* 24, 26 *) +(mk_real_int (num_of_string "40082659138319946062164320")),(mk_real_int (num_of_string "38425284035766453385888560"));(* 25, 25 *) +(mk_real_int (num_of_string "32026393844255312517338568")),(mk_real_int (num_of_string "3175078668445839083467320"));(* 25, 24 *) +(mk_real_int (num_of_string "40866589119655878995554666")),(mk_real_int (num_of_string "181026690893665978064473350"));(* 25, 26 *) +(mk_real_int (num_of_string "165410107973990174679726342")),(mk_real_int (num_of_string "182794793727053519475224874"));(* 26, 26 *) +(mk_real_int (num_of_string "828148912536367165002846104")),(mk_real_int (num_of_string "33973982175637031011398306"));(* 26, 25 *) +(mk_real_int (num_of_string "109827339909185901762960520")),(mk_real_int (num_of_string "408347416592048593365101760"));(* 26, 26 *) +(mk_real_int (num_of_string "16805713054520384908568800")),(mk_real_int (num_of_string "35752691877220840724394016"));(* 25, 25 *) +(mk_real_int (num_of_string "337556867222368121357319000")),(mk_real_int (num_of_string "135958404980427250277403738"));(* 26, 26 *) +(mk_real_int (num_of_string "44068982235389203342335939")),(mk_real_int (num_of_string "38866582043422555012045110"));(* 25, 25 *) +(mk_real_int (num_of_string "66821470063256317008532988")),(mk_real_int (num_of_string "15678887987997917382100032"));(* 25, 25 *) +(mk_real_int (num_of_string "215850018019396246498114197")),(mk_real_int (num_of_string "18815320840448603266168324"));(* 26, 25 *) +(mk_real_int (num_of_string "15759833257011943660822840")),(mk_real_int (num_of_string "58626289552216347744293994"));(* 25, 25 *) +(mk_real_int (num_of_string "3409969265701152644768118")),(mk_real_int (num_of_string "343142654659530429339503658"));(* 24, 26 *) +(mk_real_int (num_of_string "6452259642856377638631720")),(mk_real_int (num_of_string "139775217074171069226279906"));(* 24, 26 *) +(mk_real_int (num_of_string "191525159925802318908085380")),(mk_real_int (num_of_string "12023967098364570752980500"));(* 26, 25 *) +(mk_real_int (num_of_string "73621746440650219693193949")),(mk_real_int (num_of_string "45043560960865503257456928"));(* 25, 25 *) +(mk_real_int (num_of_string "98701174745674834537799595")),(mk_real_int (num_of_string "50816854226398908283859520"));(* 25, 25 *) +(mk_real_int (num_of_string "23067094995968067383621350")),(mk_real_int (num_of_string "56266157940314801963163240"));(* 25, 25 *) +(mk_real_int (num_of_string "183213940892020927024657248")),(mk_real_int (num_of_string "97050236525127603028248200"));(* 26, 25 *) +(mk_real_int (num_of_string "89626869402248472001400734")),(mk_real_int (num_of_string "1566643635132717218313509"));(* 25, 24 *) +(mk_real_int (num_of_string "72242836100364229799337552")),(mk_real_int (num_of_string "95861015548805388645878620"));(* 25, 25 *) +(mk_real_int (num_of_string "39597942981151349107233030")),(mk_real_int (num_of_string "45039604931841096080868078"));(* 25, 25 *) +(mk_real_int (num_of_string "43687422537843389185938750")),(mk_real_int (num_of_string "84049920160236379670484240"));(* 25, 25 *) +(mk_real_int (num_of_string "411565037771379264101097755")),(mk_real_int (num_of_string "165494732185952810852321980"));(* 26, 26 *) +(mk_real_int (num_of_string "94564659648540560101982832")),(mk_real_int (num_of_string "112980673902305644571540999"));(* 25, 26 *) +(mk_real_int (num_of_string "27814519827804493060896444")),(mk_real_int (num_of_string "86490087066532327313744163"));(* 25, 25 *) +(mk_real_int (num_of_string "283144251629266347748626")),(mk_real_int (num_of_string "15209429071971594291899284"));(* 23, 25 *) +(mk_real_int (num_of_string "82149830468462742526021068")),(mk_real_int (num_of_string "224494625182459051309505"));(* 25, 23 *) +(mk_real_int (num_of_string "299881512253452746774592486")),(mk_real_int (num_of_string "9860371895115123743625921"));(* 26, 24 *) +(mk_real_int (num_of_string "206818428412442944307351643")),(mk_real_int (num_of_string "204190025922701357103292054"));(* 26, 26 *) +(mk_real_int (num_of_string "87449772093639243055590420")),(mk_real_int (num_of_string "39786801256794767123858850"));(* 25, 25 *) +(mk_real_int (num_of_string "47587109693748658601305320")),(mk_real_int (num_of_string "68325587245626600656371248"));(* 25, 25 *) +(mk_real_int (num_of_string "116400388691467979008951887")),(mk_real_int (num_of_string "74086503954898207401365800"));(* 26, 25 *) +(mk_real_int (num_of_string "1743461910739837051340800")),(mk_real_int (num_of_string "316154385624651453365830920"));(* 24, 26 *) +(mk_real_int (num_of_string "34822079958796102509727320")),(mk_real_int (num_of_string "680973349518754190312937720"));(* 25, 26 *) +(mk_real_int (num_of_string "227844683016571821439892672")),(mk_real_int (num_of_string "56319719397273660320370840"));(* 26, 25 *) +(mk_real_int (num_of_string "162396539567128686983284500")),(mk_real_int (num_of_string "27090726872164554117045923"));(* 26, 25 *) +(mk_real_int (num_of_string "23896359646767419199897060")),(mk_real_int (num_of_string "67812918734516816387612700"));(* 25, 25 *) +(mk_real_int (num_of_string "271158207804428091830585400")),(mk_real_int (num_of_string "28493892205342331219639040"));(* 26, 25 *) +(mk_real_int (num_of_string "5956840078688659504383072")),(mk_real_int (num_of_string "24811891938949034457921078"));(* 24, 25 *) +(mk_real_int (num_of_string "3163031144871036604935000")),(mk_real_int (num_of_string "742272817957385845081907970"));(* 24, 26 *) +(mk_real_int (num_of_string "191829790885820607747431424")),(mk_real_int (num_of_string "267244401906419504639056748"));(* 26, 26 *) +(mk_real_int (num_of_string "226519296543724826563612800")),(mk_real_int (num_of_string "89497633470742680920554944"));(* 26, 25 *) +(mk_real_int (num_of_string "16455032487236828809574712")),(mk_real_int (num_of_string "14197396101095672012604888"));(* 25, 25 *) +(mk_real_int (num_of_string "134990402598945387865843290")),(mk_real_int (num_of_string "143835377063621682181514775"));(* 26, 26 *) +(mk_real_int (num_of_string "37722759133300884188434872")),(mk_real_int (num_of_string "33448200553702272780779226"));(* 25, 25 *) +(mk_real_int (num_of_string "191878103529698068666248120")),(mk_real_int (num_of_string "175596066951032342102319104"));(* 26, 26 *) +(mk_real_int (num_of_string "203372649411301168358031912")),(mk_real_int (num_of_string "23927478274089051116434668"));(* 26, 25 *) +(mk_real_int (num_of_string "8983788064413857175782400")),(mk_real_int (num_of_string "9264303679062958904971593"));(* 24, 24 *) +(mk_real_int (num_of_string "85100232319660509537721120")),(mk_real_int (num_of_string "45365340136835023531096200"));(* 25, 25 *) +(mk_real_int (num_of_string "73667920350501717096054891")),(mk_real_int (num_of_string "1539729172024025445302112"));(* 25, 24 *) +(mk_real_int (num_of_string "57535101050574909644701770")),(mk_real_int (num_of_string "469893668842766525287656500"));(* 25, 26 *) +(mk_real_int (num_of_string "246847915628602615268224948")),(mk_real_int (num_of_string "271376277076841497105990592"));(* 26, 26 *) +(mk_real_int (num_of_string "141423626885762883645658480")),(mk_real_int (num_of_string "428426319578461487027555292"));(* 26, 26 *) +(mk_real_int (num_of_string "116985306865956530171964024")),(mk_real_int (num_of_string "212376781502879493829014448"));(* 26, 26 *) +(mk_real_int (num_of_string "766091453676938418163236")),(mk_real_int (num_of_string "474121605480538873992152352"));(* 23, 26 *) +(mk_real_int (num_of_string "62032387050305848371495784")),(mk_real_int (num_of_string "34401892369026212515468494"));(* 25, 25 *) +(mk_real_int (num_of_string "4546012157562503974185840")),(mk_real_int (num_of_string "14928746929885255903248786"));(* 24, 25 *) +(mk_real_int (num_of_string "94910417363135133424373220")),(mk_real_int (num_of_string "220506010009543483512964600"));(* 25, 26 *) +(mk_real_int (num_of_string "93209032129864465047468960")),(mk_real_int (num_of_string "7557159214165560245035920"));(* 25, 24 *) +(mk_real_int (num_of_string "51115413616554966190864638")),(mk_real_int (num_of_string "480071230107948759091146864"));(* 25, 26 *) +(mk_real_int (num_of_string "78494778688317133570804344")),(mk_real_int (num_of_string "279200207771399157718709420"));(* 25, 26 *) +(mk_real_int (num_of_string "20795325633069015680028032")),(mk_real_int (num_of_string "7702315779652881337335591"));(* 25, 24 *) +(mk_real_int (num_of_string "346685094670933649514656")),(mk_real_int (num_of_string "3617096870785930016576000"));(* 23, 24 *) +(mk_real_int (num_of_string "736802279408600622213647196")),(mk_real_int (num_of_string "2771246625256818916912185"));(* 26, 24 *) +(mk_real_int (num_of_string "9996890352759373330266480")),(mk_real_int (num_of_string "19163675861627686170314512"));(* 24, 25 *) +(mk_real_int (num_of_string "7437773420711573654314180")),(mk_real_int (num_of_string "132870661467350131995510435"));(* 24, 26 *) +(mk_real_int (num_of_string "330254818492807679142247992")),(mk_real_int (num_of_string "18319151886846357898020000"));(* 26, 25 *) +(mk_real_int (num_of_string "187232044748904179245742160")),(mk_real_int (num_of_string "1626592629177686269559670"));(* 26, 24 *) +(mk_real_int (num_of_string "27188703849642811969160195")),(mk_real_int (num_of_string "146909056403366349661081344"));(* 25, 26 *) +(mk_real_int (num_of_string "344931949533824518830114384")),(mk_real_int (num_of_string "294446460739381647455230252"));(* 26, 26 *) +(mk_real_int (num_of_string "14269048229523221417898912")),(mk_real_int (num_of_string "5657498906931867438372657"));(* 25, 24 *) +(mk_real_int (num_of_string "66762609144321115387855197")),(mk_real_int (num_of_string "49191141034222668393307992"));(* 25, 25 *) +(mk_real_int (num_of_string "305039429558344054605756404")),(mk_real_int (num_of_string "84591372551688183439940192"));(* 26, 25 *) +(mk_real_int (num_of_string "97515874953651444002865152")),(mk_real_int (num_of_string "691673499981880613023704440"));(* 25, 26 *) +(mk_real_int (num_of_string "29193100209236239547618853")),(mk_real_int (num_of_string "70521355040509474901701800"));(* 25, 25 *) +(mk_real_int (num_of_string "7513807692770715060631368")),(mk_real_int (num_of_string "55616442020934041820861816"));(* 24, 25 *) +(mk_real_int (num_of_string "205457625967141352646225642")),(mk_real_int (num_of_string "132515117147444878942936158"));(* 26, 26 *) +(mk_real_int (num_of_string "2973338307145599568749495")),(mk_real_int (num_of_string "92638886888151184120929108"));(* 24, 25 *) +(mk_real_int (num_of_string "86518290223536728695440120")),(mk_real_int (num_of_string "35593212083793255633227086"));(* 25, 25 *) +(mk_real_int (num_of_string "6157307775193447072415280")),(mk_real_int (num_of_string "16082239463539779536364848"));(* 24, 25 *) +(mk_real_int (num_of_string "13420898736213601671340400")),(mk_real_int (num_of_string "82450648926482427213525000"));(* 25, 25 *) +(mk_real_int (num_of_string "99880834288730851673858400")),(mk_real_int (num_of_string "5741253896300511748696800"));(* 25, 24 *) +(mk_real_int (num_of_string "2146462596215413627049868")),(mk_real_int (num_of_string "645168839682234316675215"));(* 24, 23 *) +(mk_real_int (num_of_string "44093965822174619804977200")),(mk_real_int (num_of_string "308822880869809893193894416"));(* 25, 26 *) +(mk_real_int (num_of_string "5892845797658658963336576")),(mk_real_int (num_of_string "36014886084378441527849820"));(* 24, 25 *) +(mk_real_int (num_of_string "415864868921156209509985940")),(mk_real_int (num_of_string "52587340634428081205369772"));(* 26, 25 *) +(mk_real_int (num_of_string "11746692427581616073269140")),(mk_real_int (num_of_string "452764829553174823722320"));(* 25, 23 *) +(mk_real_int (num_of_string "85945724873576799471637600")),(mk_real_int (num_of_string "9261455435860466089152000"));(* 25, 24 *) +(mk_real_int (num_of_string "114552630894373987509331912")),(mk_real_int (num_of_string "108697081925857447766794380"));(* 26, 26 *) +(mk_real_int (num_of_string "65771426224612534605414012")),(mk_real_int (num_of_string "389280266590187169727232296"));(* 25, 26 *) +(mk_real_int (num_of_string "64881020471859832650818589")),(mk_real_int (num_of_string "1568335636534885330810368"));(* 25, 24 *) +(mk_real_int (num_of_string "50259031211335890622802004")),(mk_real_int (num_of_string "94948675787790649525339290"));(* 25, 25 *) +(mk_real_int (num_of_string "790190233716089598559808")),(mk_real_int (num_of_string "524421817064509565073259992"));(* 23, 26 *) +(mk_real_int (num_of_string "73650563171999770916568609")),(mk_real_int (num_of_string "151806905852700479420063376"));(* 25, 26 *) +(mk_real_int (num_of_string "350166527476784211587639784")),(mk_real_int (num_of_string "219753780282997951788344232"));(* 26, 26 *) +(mk_real_int (num_of_string "4245001554147357653832270")),(mk_real_int (num_of_string "2885160683483009403878400"));(* 24, 24 *) +(mk_real_int (num_of_string "237510981757850421510457260")),(mk_real_int (num_of_string "3374762674704642792779370"));(* 26, 24 *) +(mk_real_int (num_of_string "67492576532860916816586240")),(mk_real_int (num_of_string "33239155246689652756908048"));(* 25, 25 *) +(mk_real_int (num_of_string "242118077416687146010806080")),(mk_real_int (num_of_string "151813349260759445946757330"));(* 26, 26 *) +(mk_real_int (num_of_string "7468515125860164831692412")),(mk_real_int (num_of_string "46102906513687678293051486"));(* 24, 25 *) +(mk_real_int (num_of_string "121454008074660255105623810")),(mk_real_int (num_of_string "31561260882577397678847384"));(* 26, 25 *) +(mk_real_int (num_of_string "15200017655157476666233570")),(mk_real_int (num_of_string "6503985635860530075357600"));(* 25, 24 *) +(mk_real_int (num_of_string "648324969256675815602262150")),(mk_real_int (num_of_string "21777313269829092051129480"));(* 26, 25 *) +(mk_real_int (num_of_string "30756207353423144579068500")),(mk_real_int (num_of_string "155731081504024968238354568"));(* 25, 26 *) +(mk_real_int (num_of_string "479081794171155796836742302")),(mk_real_int (num_of_string "151753809174650640323491840"));(* 26, 26 *) +(mk_real_int (num_of_string "11078051882191222004813415")),(mk_real_int (num_of_string "519619608171787236569919000"));(* 25, 26 *) +(mk_real_int (num_of_string "66352522069723354505562570")),(mk_real_int (num_of_string "14423653822341810361771412"));(* 25, 25 *) +(mk_real_int (num_of_string "3673768608245325848010368")),(mk_real_int (num_of_string "66772662607545392321311824"));(* 24, 25 *) +(mk_real_int (num_of_string "30077521700719583707846320")),(mk_real_int (num_of_string "21705893618607616899782070"));(* 25, 25 *) +(mk_real_int (num_of_string "95642237542137967801731520")),(mk_real_int (num_of_string "178672124964119436708997050"));(* 25, 26 *) +(mk_real_int (num_of_string "45369040420819630960896165")),(mk_real_int (num_of_string "92037728831035290876409980"));(* 25, 25 *) +(mk_real_int (num_of_string "34677444316335721837565000")),(mk_real_int (num_of_string "187222367965936608198593370"));(* 25, 26 *) +(mk_real_int (num_of_string "2709515955176139369580672")),(mk_real_int (num_of_string "9161798408105298036475782"));(* 24, 24 *) +(mk_real_int (num_of_string "44693267602288459053572020")),(mk_real_int (num_of_string "615357360379781255177417217"));(* 25, 26 *) +(mk_real_int (num_of_string "214175265710793927902654250")),(mk_real_int (num_of_string "23821232986579606655612238"));(* 26, 25 *) +(mk_real_int (num_of_string "199458987571580038333543295")),(mk_real_int (num_of_string "310615928569618167757051800"));(* 26, 26 *) +(mk_real_int (num_of_string "181110399388169266742474727")),(mk_real_int (num_of_string "9614395742898676279662882"));(* 26, 24 *) +(mk_real_int (num_of_string "23513121951469005953325120")),(mk_real_int (num_of_string "132156691181845140516367536"));(* 25, 26 *) +(mk_real_int (num_of_string "57084948980178074963258367")),(mk_real_int (num_of_string "9306533557766076735781455"));(* 25, 24 *) +(mk_real_int (num_of_string "110186075325816552267975468")),(mk_real_int (num_of_string "373779926075700375570000000"));(* 26, 26 *) +(mk_real_int (num_of_string "59356836087430550483121912")),(mk_real_int (num_of_string "84912410498754265576003008"));(* 25, 25 *) +(mk_real_int (num_of_string "16137589430467035463230774")),(mk_real_int (num_of_string "130172207477002210633048320"));(* 25, 26 *) +(mk_real_int (num_of_string "72073790395213864881139040")),(mk_real_int (num_of_string "16297986355403817143871000"));(* 25, 25 *) +(mk_real_int (num_of_string "36144887168704655803747446")),(mk_real_int (num_of_string "99777291684275949636786600"));(* 25, 25 *) +(mk_real_int (num_of_string "322809309325110308440741474")),(mk_real_int (num_of_string "47748371847639645180450816"));(* 26, 25 *) +(mk_real_int (num_of_string "95462093067891793274315680")),(mk_real_int (num_of_string "23996920508724788662801920"));(* 25, 25 *) +(mk_real_int (num_of_string "17523931379594670358777680")),(mk_real_int (num_of_string "103231477535224497815535300"));(* 25, 26 *) +(mk_real_int (num_of_string "224935664588137217579543040")),(mk_real_int (num_of_string "940015791620835233081085"));(* 26, 23 *) +(mk_real_int (num_of_string "58788947982575409123778600")),(mk_real_int (num_of_string "11485999042076404832742000"));(* 25, 25 *) +(mk_real_int (num_of_string "88937334091851478030034640")),(mk_real_int (num_of_string "20408764400562625224153660"));(* 25, 25 *) +(mk_real_int (num_of_string "1351169393377393176823808")),(mk_real_int (num_of_string "42038643409854598695912812"));(* 24, 25 *) +(mk_real_int (num_of_string "93025556167144210440138840")),(mk_real_int (num_of_string "470146802486038291505640000"));(* 25, 26 *) +(mk_real_int (num_of_string "32919471526449773889662958")),(mk_real_int (num_of_string "15337179591731762467177280"));(* 25, 25 *) +(mk_real_int (num_of_string "255960058165114659612296898")),(mk_real_int (num_of_string "31895676634714912760544344"));(* 26, 25 *) +(mk_real_int (num_of_string "7652127059184302113950180")),(mk_real_int (num_of_string "3167982572272008158306880"));(* 24, 24 *) +(mk_real_int (num_of_string "121943388238227706297960488")),(mk_real_int (num_of_string "116752430660455551636510920"));(* 26, 26 *) +(mk_real_int (num_of_string "91141287274092517721823270")),(mk_real_int (num_of_string "79015733961557027161214922"));(* 25, 25 *) +(mk_real_int (num_of_string "103212324289841072748962940")),(mk_real_int (num_of_string "23502581069283562153293760"));(* 26, 25 *) +(mk_real_int (num_of_string "61614558847678542748661124")),(mk_real_int (num_of_string "30080373129063928545001335"));(* 25, 25 *) +(mk_real_int (num_of_string "67348570429438607390372760")),(mk_real_int (num_of_string "252253949451085013543273880"));(* 25, 26 *) +(mk_real_int (num_of_string "5950181556420393069816192")),(mk_real_int (num_of_string "115096599793294399632965184"));(* 24, 26 *) +(mk_real_int (num_of_string "197289115083308089086645368")),(mk_real_int (num_of_string "262985948481156523157561528"));(* 26, 26 *) +(mk_real_int (num_of_string "326688936905310894901958400")),(mk_real_int (num_of_string "128478388908257244413502960"));(* 26, 26 *) +(mk_real_int (num_of_string "13435497654971261923470508")),(mk_real_int (num_of_string "244760622394318696657811688"));(* 25, 26 *) +(mk_real_int (num_of_string "53693401818520230944999040")),(mk_real_int (num_of_string "272454686606824072235110590"));(* 25, 26 *) +(mk_real_int (num_of_string "164225008028941516988763110")),(mk_real_int (num_of_string "44076863789195264272202283"));(* 26, 25 *) +(mk_real_int (num_of_string "111781556599484113990738200")),(mk_real_int (num_of_string "487589044616521629260928"));(* 26, 23 *) +(mk_real_int (num_of_string "36350761507453325764481760")),(mk_real_int (num_of_string "347374166095670267300651520"));(* 25, 26 *) +(mk_real_int (num_of_string "4404942392921450910539208")),(mk_real_int (num_of_string "16444722093731286642870604"));(* 24, 25 *) +(mk_real_int (num_of_string "34998542391989350171813324")),(mk_real_int (num_of_string "84819422723869175977829376"));(* 25, 25 *) +(mk_real_int (num_of_string "142508624656563484960180176")),(mk_real_int (num_of_string "130849540384544543867467760"));(* 26, 26 *) +(mk_real_int (num_of_string "43986798679684733492603976")),(mk_real_int (num_of_string "76796829600524767256418600"));(* 25, 25 *) +(mk_real_int (num_of_string "4640303951091638102707632")),(mk_real_int (num_of_string "95288029738926444070197300"));(* 24, 25 *) +(mk_real_int (num_of_string "51686196587942632748001868")),(mk_real_int (num_of_string "287668623895644101033490255"));(* 25, 26 *) +(mk_real_int (num_of_string "15011398046653417983945774")),(mk_real_int (num_of_string "63028631677435065516125384"));(* 25, 25 *) +(mk_real_int (num_of_string "63216540212824961625516768")),(mk_real_int (num_of_string "219251594828186673098220"));(* 25, 23 *) +(mk_real_int (num_of_string "42379870300474368690480488")),(mk_real_int (num_of_string "7627042596971518427619720"));(* 25, 24 *) +(mk_real_int (num_of_string "5503946748109005467824722")),(mk_real_int (num_of_string "320500583033903645465503488"));(* 24, 26 *) +(mk_real_int (num_of_string "66499538008604918794833828")),(mk_real_int (num_of_string "17140735203194607391207382"));(* 25, 25 *) +(mk_real_int (num_of_string "72397763758837572475412478")),(mk_real_int (num_of_string "334939552279180111362131970"));(* 25, 26 *) +(mk_real_int (num_of_string "12405146054091027622802040")),(mk_real_int (num_of_string "71841725875555855637450640"));(* 25, 25 *) +(mk_real_int (num_of_string "11534060791051108128203690")),(mk_real_int (num_of_string "60325163633529506262456360"));(* 25, 25 *) +(mk_real_int (num_of_string "299487775163966216348847228")),(mk_real_int (num_of_string "68812516903112439267275028"));(* 26, 25 *) +(mk_real_int (num_of_string "506849656895603265992374620")),(mk_real_int (num_of_string "46981860287044964395885056"));(* 26, 25 *) +(mk_real_int (num_of_string "3919145778705146796555840")),(mk_real_int (num_of_string "118464359635823539696419428"));(* 24, 26 *) +(mk_real_int (num_of_string "120999185201390185748233392")),(mk_real_int (num_of_string "1870967514738423738074454"));(* 26, 24 *) +(mk_real_int (num_of_string "120361650250624166252690724")),(mk_real_int (num_of_string "5984929271431735341528140"));(* 26, 24 *) +(mk_real_int (num_of_string "298195614557485690435380120")),(mk_real_int (num_of_string "40339061872612185698121015"));(* 26, 25 *) +(mk_real_int (num_of_string "206624463534576852523649088")),(mk_real_int (num_of_string "263583275731972832083619535"));(* 26, 26 *) +(mk_real_int (num_of_string "25759813401567234659878416")),(mk_real_int (num_of_string "1381377187766198724764370"));(* 25, 24 *) +(mk_real_int (num_of_string "14643926876456204547436500")),(mk_real_int (num_of_string "66035463286993257658481160"));(* 25, 25 *) +(mk_real_int (num_of_string "10239878780474324527028064")),(mk_real_int (num_of_string "123110027275150929706348275"));(* 25, 26 *) +(mk_real_int (num_of_string "52288380076897156628171883")),(mk_real_int (num_of_string "107640065587742738219248408"));(* 25, 26 *) +(mk_real_int (num_of_string "150187153762447331713114140")),(mk_real_int (num_of_string "216450251278049686422048"));(* 26, 23 *) +(mk_real_int (num_of_string "294469113902292273392121366")),(mk_real_int (num_of_string "2790586443249668493421200"));(* 26, 24 *) +(mk_real_int (num_of_string "130627031809654148720219120")),(mk_real_int (num_of_string "165611796432171376193818002"));(* 26, 26 *) +(mk_real_int (num_of_string "71316892944530455853281860")),(mk_real_int (num_of_string "74510409395918279108435544"));(* 25, 25 *) +(mk_real_int (num_of_string "150682336540333536496157600")),(mk_real_int (num_of_string "34877581958730675888086076"));(* 26, 25 *) +(mk_real_int (num_of_string "111334749782228031387393120")),(mk_real_int (num_of_string "239950072590491713719656560"));(* 26, 26 *) +(mk_real_int (num_of_string "22784254051740592329078160")),(mk_real_int (num_of_string "70950618239978846841850072"))(* 25, 25 *) +];; diff --git a/formal_lp/old/arith/tests/arith_test_data5.hl b/formal_lp/old/arith/tests/arith_test_data5.hl new file mode 100644 index 0000000..af4d62e --- /dev/null +++ b/formal_lp/old/arith/tests/arith_test_data5.hl @@ -0,0 +1,1002 @@ +let data = [ +(mk_real_int64 75361L),(mk_real_int64 83558L);(* 4, 4 *) +(mk_real_int64 79121L),(mk_real_int64 60233L);(* 4, 4 *) +(mk_real_int64 28542L),(mk_real_int64 60299L);(* 4, 4 *) +(mk_real_int64 91541L),(mk_real_int64 49795L);(* 4, 4 *) +(mk_real_int64 97978L),(mk_real_int64 34633L);(* 4, 4 *) +(mk_real_int64 36271L),(mk_real_int64 52057L);(* 4, 4 *) +(mk_real_int64 66938L),(mk_real_int64 52255L);(* 4, 4 *) +(mk_real_int64 98392L),(mk_real_int64 12732L);(* 4, 4 *) +(mk_real_int64 87612L),(mk_real_int64 99580L);(* 4, 4 *) +(mk_real_int64 70945L),(mk_real_int64 38312L);(* 4, 4 *) +(mk_real_int64 83520L),(mk_real_int64 86323L);(* 4, 4 *) +(mk_real_int64 99270L),(mk_real_int64 12936L);(* 4, 4 *) +(mk_real_int64 72994L),(mk_real_int64 57365L);(* 4, 4 *) +(mk_real_int64 94060L),(mk_real_int64 71885L);(* 4, 4 *) +(mk_real_int64 59212L),(mk_real_int64 17299L);(* 4, 4 *) +(mk_real_int64 26841L),(mk_real_int64 50798L);(* 4, 4 *) +(mk_real_int64 36745L),(mk_real_int64 98967L);(* 4, 4 *) +(mk_real_int64 67842L),(mk_real_int64 78665L);(* 4, 4 *) +(mk_real_int64 12735L),(mk_real_int64 44290L);(* 4, 4 *) +(mk_real_int64 40882L),(mk_real_int64 96170L);(* 4, 4 *) +(mk_real_int64 55461L),(mk_real_int64 74436L);(* 4, 4 *) +(mk_real_int64 20706L),(mk_real_int64 34610L);(* 4, 4 *) +(mk_real_int64 91637L),(mk_real_int64 81528L);(* 4, 4 *) +(mk_real_int64 40344L),(mk_real_int64 51148L);(* 4, 4 *) +(mk_real_int64 23214L),(mk_real_int64 29918L);(* 4, 4 *) +(mk_real_int64 46906L),(mk_real_int64 74684L);(* 4, 4 *) +(mk_real_int64 65784L),(mk_real_int64 53916L);(* 4, 4 *) +(mk_real_int64 27542L),(mk_real_int64 89036L);(* 4, 4 *) +(mk_real_int64 84287L),(mk_real_int64 76185L);(* 4, 4 *) +(mk_real_int64 87238L),(mk_real_int64 71176L);(* 4, 4 *) +(mk_real_int64 66237L),(mk_real_int64 29656L);(* 4, 4 *) +(mk_real_int64 90581L),(mk_real_int64 90678L);(* 4, 4 *) +(mk_real_int64 17792L),(mk_real_int64 85471L);(* 4, 4 *) +(mk_real_int64 25312L),(mk_real_int64 67969L);(* 4, 4 *) +(mk_real_int64 84412L),(mk_real_int64 29726L);(* 4, 4 *) +(mk_real_int64 99996L),(mk_real_int64 53322L);(* 4, 4 *) +(mk_real_int64 68697L),(mk_real_int64 74774L);(* 4, 4 *) +(mk_real_int64 82850L),(mk_real_int64 19084L);(* 4, 4 *) +(mk_real_int64 75617L),(mk_real_int64 74659L);(* 4, 4 *) +(mk_real_int64 21297L),(mk_real_int64 91464L);(* 4, 4 *) +(mk_real_int64 27020L),(mk_real_int64 52912L);(* 4, 4 *) +(mk_real_int64 58671L),(mk_real_int64 39294L);(* 4, 4 *) +(mk_real_int64 70392L),(mk_real_int64 52155L);(* 4, 4 *) +(mk_real_int64 85013L),(mk_real_int64 82827L);(* 4, 4 *) +(mk_real_int64 81425L),(mk_real_int64 78804L);(* 4, 4 *) +(mk_real_int64 94377L),(mk_real_int64 36549L);(* 4, 4 *) +(mk_real_int64 57050L),(mk_real_int64 69704L);(* 4, 4 *) +(mk_real_int64 39932L),(mk_real_int64 35804L);(* 4, 4 *) +(mk_real_int64 83854L),(mk_real_int64 30026L);(* 4, 4 *) +(mk_real_int64 26818L),(mk_real_int64 16166L);(* 4, 4 *) +(mk_real_int64 66215L),(mk_real_int64 72373L);(* 4, 4 *) +(mk_real_int64 66734L),(mk_real_int64 93486L);(* 4, 4 *) +(mk_real_int64 29920L),(mk_real_int64 93582L);(* 4, 4 *) +(mk_real_int64 15986L),(mk_real_int64 91008L);(* 4, 4 *) +(mk_real_int64 71064L),(mk_real_int64 18457L);(* 4, 4 *) +(mk_real_int64 23418L),(mk_real_int64 19627L);(* 4, 4 *) +(mk_real_int64 64887L),(mk_real_int64 95772L);(* 4, 4 *) +(mk_real_int64 54155L),(mk_real_int64 23324L);(* 4, 4 *) +(mk_real_int64 70984L),(mk_real_int64 61286L);(* 4, 4 *) +(mk_real_int64 30286L),(mk_real_int64 65635L);(* 4, 4 *) +(mk_real_int64 10457L),(mk_real_int64 42484L);(* 4, 4 *) +(mk_real_int64 86542L),(mk_real_int64 15607L);(* 4, 4 *) +(mk_real_int64 35347L),(mk_real_int64 73447L);(* 4, 4 *) +(mk_real_int64 96271L),(mk_real_int64 98992L);(* 4, 4 *) +(mk_real_int64 44841L),(mk_real_int64 57046L);(* 4, 4 *) +(mk_real_int64 35228L),(mk_real_int64 55591L);(* 4, 4 *) +(mk_real_int64 57841L),(mk_real_int64 15130L);(* 4, 4 *) +(mk_real_int64 35249L),(mk_real_int64 54646L);(* 4, 4 *) +(mk_real_int64 86176L),(mk_real_int64 65183L);(* 4, 4 *) +(mk_real_int64 19374L),(mk_real_int64 76808L);(* 4, 4 *) +(mk_real_int64 46168L),(mk_real_int64 94004L);(* 4, 4 *) +(mk_real_int64 21762L),(mk_real_int64 72968L);(* 4, 4 *) +(mk_real_int64 65386L),(mk_real_int64 84750L);(* 4, 4 *) +(mk_real_int64 71660L),(mk_real_int64 61276L);(* 4, 4 *) +(mk_real_int64 25548L),(mk_real_int64 26607L);(* 4, 4 *) +(mk_real_int64 64819L),(mk_real_int64 32567L);(* 4, 4 *) +(mk_real_int64 99739L),(mk_real_int64 61181L);(* 4, 4 *) +(mk_real_int64 15709L),(mk_real_int64 33731L);(* 4, 4 *) +(mk_real_int64 85829L),(mk_real_int64 61127L);(* 4, 4 *) +(mk_real_int64 68138L),(mk_real_int64 56472L);(* 4, 4 *) +(mk_real_int64 97310L),(mk_real_int64 16993L);(* 4, 4 *) +(mk_real_int64 56166L),(mk_real_int64 24018L);(* 4, 4 *) +(mk_real_int64 83227L),(mk_real_int64 67826L);(* 4, 4 *) +(mk_real_int64 61784L),(mk_real_int64 59757L);(* 4, 4 *) +(mk_real_int64 70523L),(mk_real_int64 99508L);(* 4, 4 *) +(mk_real_int64 37147L),(mk_real_int64 15800L);(* 4, 4 *) +(mk_real_int64 51912L),(mk_real_int64 53476L);(* 4, 4 *) +(mk_real_int64 29467L),(mk_real_int64 16451L);(* 4, 4 *) +(mk_real_int64 30721L),(mk_real_int64 23574L);(* 4, 4 *) +(mk_real_int64 50220L),(mk_real_int64 50596L);(* 4, 4 *) +(mk_real_int64 11786L),(mk_real_int64 44995L);(* 4, 4 *) +(mk_real_int64 83443L),(mk_real_int64 28234L);(* 4, 4 *) +(mk_real_int64 92225L),(mk_real_int64 12661L);(* 4, 4 *) +(mk_real_int64 55851L),(mk_real_int64 96659L);(* 4, 4 *) +(mk_real_int64 99420L),(mk_real_int64 11518L);(* 4, 4 *) +(mk_real_int64 68816L),(mk_real_int64 35049L);(* 4, 4 *) +(mk_real_int64 97044L),(mk_real_int64 62900L);(* 4, 4 *) +(mk_real_int64 79497L),(mk_real_int64 39174L);(* 4, 4 *) +(mk_real_int64 47837L),(mk_real_int64 97742L);(* 4, 4 *) +(mk_real_int64 89739L),(mk_real_int64 97558L);(* 4, 4 *) +(mk_real_int64 32965L),(mk_real_int64 21903L);(* 4, 4 *) +(mk_real_int64 90751L),(mk_real_int64 26039L);(* 4, 4 *) +(mk_real_int64 89459L),(mk_real_int64 59018L);(* 4, 4 *) +(mk_real_int64 80653L),(mk_real_int64 56263L);(* 4, 4 *) +(mk_real_int64 41714L),(mk_real_int64 99256L);(* 4, 4 *) +(mk_real_int64 13009L),(mk_real_int64 72254L);(* 4, 4 *) +(mk_real_int64 20906L),(mk_real_int64 27541L);(* 4, 4 *) +(mk_real_int64 54686L),(mk_real_int64 62315L);(* 4, 4 *) +(mk_real_int64 33549L),(mk_real_int64 37932L);(* 4, 4 *) +(mk_real_int64 31792L),(mk_real_int64 80566L);(* 4, 4 *) +(mk_real_int64 21975L),(mk_real_int64 65124L);(* 4, 4 *) +(mk_real_int64 60335L),(mk_real_int64 69005L);(* 4, 4 *) +(mk_real_int64 40692L),(mk_real_int64 12097L);(* 4, 4 *) +(mk_real_int64 18755L),(mk_real_int64 89011L);(* 4, 4 *) +(mk_real_int64 73977L),(mk_real_int64 90291L);(* 4, 4 *) +(mk_real_int64 68613L),(mk_real_int64 32977L);(* 4, 4 *) +(mk_real_int64 33834L),(mk_real_int64 52660L);(* 4, 4 *) +(mk_real_int64 27631L),(mk_real_int64 89881L);(* 4, 4 *) +(mk_real_int64 54242L),(mk_real_int64 67403L);(* 4, 4 *) +(mk_real_int64 38773L),(mk_real_int64 43207L);(* 4, 4 *) +(mk_real_int64 32007L),(mk_real_int64 99586L);(* 4, 4 *) +(mk_real_int64 64944L),(mk_real_int64 10164L);(* 4, 4 *) +(mk_real_int64 98507L),(mk_real_int64 96560L);(* 4, 4 *) +(mk_real_int64 24142L),(mk_real_int64 79502L);(* 4, 4 *) +(mk_real_int64 18214L),(mk_real_int64 27181L);(* 4, 4 *) +(mk_real_int64 15625L),(mk_real_int64 19905L);(* 4, 4 *) +(mk_real_int64 75950L),(mk_real_int64 19173L);(* 4, 4 *) +(mk_real_int64 85583L),(mk_real_int64 67839L);(* 4, 4 *) +(mk_real_int64 61567L),(mk_real_int64 31746L);(* 4, 4 *) +(mk_real_int64 85346L),(mk_real_int64 87361L);(* 4, 4 *) +(mk_real_int64 50262L),(mk_real_int64 91641L);(* 4, 4 *) +(mk_real_int64 82284L),(mk_real_int64 51421L);(* 4, 4 *) +(mk_real_int64 40643L),(mk_real_int64 80031L);(* 4, 4 *) +(mk_real_int64 48420L),(mk_real_int64 68244L);(* 4, 4 *) +(mk_real_int64 99909L),(mk_real_int64 64803L);(* 4, 4 *) +(mk_real_int64 18073L),(mk_real_int64 66145L);(* 4, 4 *) +(mk_real_int64 99157L),(mk_real_int64 88583L);(* 4, 4 *) +(mk_real_int64 58558L),(mk_real_int64 22387L);(* 4, 4 *) +(mk_real_int64 10179L),(mk_real_int64 60171L);(* 4, 4 *) +(mk_real_int64 70496L),(mk_real_int64 44130L);(* 4, 4 *) +(mk_real_int64 87954L),(mk_real_int64 39252L);(* 4, 4 *) +(mk_real_int64 80796L),(mk_real_int64 56795L);(* 4, 4 *) +(mk_real_int64 84666L),(mk_real_int64 58707L);(* 4, 4 *) +(mk_real_int64 57025L),(mk_real_int64 24661L);(* 4, 4 *) +(mk_real_int64 67076L),(mk_real_int64 59790L);(* 4, 4 *) +(mk_real_int64 38314L),(mk_real_int64 32495L);(* 4, 4 *) +(mk_real_int64 82055L),(mk_real_int64 51411L);(* 4, 4 *) +(mk_real_int64 92943L),(mk_real_int64 40365L);(* 4, 4 *) +(mk_real_int64 27302L),(mk_real_int64 23523L);(* 4, 4 *) +(mk_real_int64 69520L),(mk_real_int64 28476L);(* 4, 4 *) +(mk_real_int64 58140L),(mk_real_int64 55896L);(* 4, 4 *) +(mk_real_int64 79591L),(mk_real_int64 53410L);(* 4, 4 *) +(mk_real_int64 19108L),(mk_real_int64 49479L);(* 4, 4 *) +(mk_real_int64 20746L),(mk_real_int64 87366L);(* 4, 4 *) +(mk_real_int64 60613L),(mk_real_int64 73196L);(* 4, 4 *) +(mk_real_int64 67659L),(mk_real_int64 11395L);(* 4, 4 *) +(mk_real_int64 61249L),(mk_real_int64 51215L);(* 4, 4 *) +(mk_real_int64 99406L),(mk_real_int64 21010L);(* 4, 4 *) +(mk_real_int64 20844L),(mk_real_int64 35488L);(* 4, 4 *) +(mk_real_int64 66754L),(mk_real_int64 81934L);(* 4, 4 *) +(mk_real_int64 33005L),(mk_real_int64 33758L);(* 4, 4 *) +(mk_real_int64 11168L),(mk_real_int64 50119L);(* 4, 4 *) +(mk_real_int64 36488L),(mk_real_int64 85577L);(* 4, 4 *) +(mk_real_int64 84088L),(mk_real_int64 57746L);(* 4, 4 *) +(mk_real_int64 95639L),(mk_real_int64 28193L);(* 4, 4 *) +(mk_real_int64 95083L),(mk_real_int64 86655L);(* 4, 4 *) +(mk_real_int64 90650L),(mk_real_int64 52020L);(* 4, 4 *) +(mk_real_int64 85989L),(mk_real_int64 42057L);(* 4, 4 *) +(mk_real_int64 59659L),(mk_real_int64 37385L);(* 4, 4 *) +(mk_real_int64 47687L),(mk_real_int64 45187L);(* 4, 4 *) +(mk_real_int64 47960L),(mk_real_int64 69658L);(* 4, 4 *) +(mk_real_int64 64047L),(mk_real_int64 93878L);(* 4, 4 *) +(mk_real_int64 92129L),(mk_real_int64 36918L);(* 4, 4 *) +(mk_real_int64 71245L),(mk_real_int64 40840L);(* 4, 4 *) +(mk_real_int64 52004L),(mk_real_int64 81932L);(* 4, 4 *) +(mk_real_int64 29520L),(mk_real_int64 91813L);(* 4, 4 *) +(mk_real_int64 56768L),(mk_real_int64 87584L);(* 4, 4 *) +(mk_real_int64 95469L),(mk_real_int64 34381L);(* 4, 4 *) +(mk_real_int64 54727L),(mk_real_int64 39472L);(* 4, 4 *) +(mk_real_int64 26921L),(mk_real_int64 33530L);(* 4, 4 *) +(mk_real_int64 65389L),(mk_real_int64 62999L);(* 4, 4 *) +(mk_real_int64 91725L),(mk_real_int64 42420L);(* 4, 4 *) +(mk_real_int64 78111L),(mk_real_int64 81003L);(* 4, 4 *) +(mk_real_int64 20744L),(mk_real_int64 19228L);(* 4, 4 *) +(mk_real_int64 65224L),(mk_real_int64 67348L);(* 4, 4 *) +(mk_real_int64 61350L),(mk_real_int64 83457L);(* 4, 4 *) +(mk_real_int64 87800L),(mk_real_int64 31566L);(* 4, 4 *) +(mk_real_int64 43973L),(mk_real_int64 63346L);(* 4, 4 *) +(mk_real_int64 69710L),(mk_real_int64 17289L);(* 4, 4 *) +(mk_real_int64 57988L),(mk_real_int64 99568L);(* 4, 4 *) +(mk_real_int64 24331L),(mk_real_int64 53247L);(* 4, 4 *) +(mk_real_int64 15742L),(mk_real_int64 23707L);(* 4, 4 *) +(mk_real_int64 98671L),(mk_real_int64 13270L);(* 4, 4 *) +(mk_real_int64 39887L),(mk_real_int64 13065L);(* 4, 4 *) +(mk_real_int64 56550L),(mk_real_int64 61607L);(* 4, 4 *) +(mk_real_int64 87328L),(mk_real_int64 30186L);(* 4, 4 *) +(mk_real_int64 20464L),(mk_real_int64 24156L);(* 4, 4 *) +(mk_real_int64 79796L),(mk_real_int64 84960L);(* 4, 4 *) +(mk_real_int64 77931L),(mk_real_int64 31626L);(* 4, 4 *) +(mk_real_int64 25767L),(mk_real_int64 21126L);(* 4, 4 *) +(mk_real_int64 26174L),(mk_real_int64 62016L);(* 4, 4 *) +(mk_real_int64 75614L),(mk_real_int64 84654L);(* 4, 4 *) +(mk_real_int64 30582L),(mk_real_int64 46061L);(* 4, 4 *) +(mk_real_int64 14012L),(mk_real_int64 35201L);(* 4, 4 *) +(mk_real_int64 53611L),(mk_real_int64 42122L);(* 4, 4 *) +(mk_real_int64 64670L),(mk_real_int64 47438L);(* 4, 4 *) +(mk_real_int64 81483L),(mk_real_int64 27351L);(* 4, 4 *) +(mk_real_int64 19198L),(mk_real_int64 22142L);(* 4, 4 *) +(mk_real_int64 57257L),(mk_real_int64 78018L);(* 4, 4 *) +(mk_real_int64 43748L),(mk_real_int64 74840L);(* 4, 4 *) +(mk_real_int64 51116L),(mk_real_int64 17679L);(* 4, 4 *) +(mk_real_int64 62676L),(mk_real_int64 13616L);(* 4, 4 *) +(mk_real_int64 80019L),(mk_real_int64 41163L);(* 4, 4 *) +(mk_real_int64 72993L),(mk_real_int64 73643L);(* 4, 4 *) +(mk_real_int64 51769L),(mk_real_int64 59012L);(* 4, 4 *) +(mk_real_int64 85413L),(mk_real_int64 48083L);(* 4, 4 *) +(mk_real_int64 91520L),(mk_real_int64 46862L);(* 4, 4 *) +(mk_real_int64 83394L),(mk_real_int64 62314L);(* 4, 4 *) +(mk_real_int64 77632L),(mk_real_int64 31086L);(* 4, 4 *) +(mk_real_int64 93124L),(mk_real_int64 62609L);(* 4, 4 *) +(mk_real_int64 99256L),(mk_real_int64 14685L);(* 4, 4 *) +(mk_real_int64 59453L),(mk_real_int64 24428L);(* 4, 4 *) +(mk_real_int64 96936L),(mk_real_int64 49889L);(* 4, 4 *) +(mk_real_int64 48702L),(mk_real_int64 93111L);(* 4, 4 *) +(mk_real_int64 14958L),(mk_real_int64 67654L);(* 4, 4 *) +(mk_real_int64 37702L),(mk_real_int64 99912L);(* 4, 4 *) +(mk_real_int64 87877L),(mk_real_int64 50926L);(* 4, 4 *) +(mk_real_int64 70008L),(mk_real_int64 18495L);(* 4, 4 *) +(mk_real_int64 99338L),(mk_real_int64 71997L);(* 4, 4 *) +(mk_real_int64 14635L),(mk_real_int64 89417L);(* 4, 4 *) +(mk_real_int64 73066L),(mk_real_int64 40368L);(* 4, 4 *) +(mk_real_int64 83431L),(mk_real_int64 94597L);(* 4, 4 *) +(mk_real_int64 56707L),(mk_real_int64 26586L);(* 4, 4 *) +(mk_real_int64 55917L),(mk_real_int64 44620L);(* 4, 4 *) +(mk_real_int64 43956L),(mk_real_int64 56883L);(* 4, 4 *) +(mk_real_int64 44508L),(mk_real_int64 36171L);(* 4, 4 *) +(mk_real_int64 84893L),(mk_real_int64 81137L);(* 4, 4 *) +(mk_real_int64 75582L),(mk_real_int64 46431L);(* 4, 4 *) +(mk_real_int64 58224L),(mk_real_int64 48248L);(* 4, 4 *) +(mk_real_int64 16679L),(mk_real_int64 40129L);(* 4, 4 *) +(mk_real_int64 92460L),(mk_real_int64 79881L);(* 4, 4 *) +(mk_real_int64 68685L),(mk_real_int64 84114L);(* 4, 4 *) +(mk_real_int64 31310L),(mk_real_int64 85499L);(* 4, 4 *) +(mk_real_int64 60205L),(mk_real_int64 50594L);(* 4, 4 *) +(mk_real_int64 76852L),(mk_real_int64 74899L);(* 4, 4 *) +(mk_real_int64 62974L),(mk_real_int64 15635L);(* 4, 4 *) +(mk_real_int64 26451L),(mk_real_int64 13706L);(* 4, 4 *) +(mk_real_int64 89542L),(mk_real_int64 68888L);(* 4, 4 *) +(mk_real_int64 31253L),(mk_real_int64 64855L);(* 4, 4 *) +(mk_real_int64 67719L),(mk_real_int64 80350L);(* 4, 4 *) +(mk_real_int64 93971L),(mk_real_int64 14081L);(* 4, 4 *) +(mk_real_int64 59155L),(mk_real_int64 58073L);(* 4, 4 *) +(mk_real_int64 33145L),(mk_real_int64 11531L);(* 4, 4 *) +(mk_real_int64 25019L),(mk_real_int64 16740L);(* 4, 4 *) +(mk_real_int64 75342L),(mk_real_int64 33577L);(* 4, 4 *) +(mk_real_int64 60269L),(mk_real_int64 61089L);(* 4, 4 *) +(mk_real_int64 65317L),(mk_real_int64 74505L);(* 4, 4 *) +(mk_real_int64 96956L),(mk_real_int64 93184L);(* 4, 4 *) +(mk_real_int64 71682L),(mk_real_int64 99316L);(* 4, 4 *) +(mk_real_int64 73287L),(mk_real_int64 71206L);(* 4, 4 *) +(mk_real_int64 66379L),(mk_real_int64 15322L);(* 4, 4 *) +(mk_real_int64 67766L),(mk_real_int64 69055L);(* 4, 4 *) +(mk_real_int64 93907L),(mk_real_int64 38873L);(* 4, 4 *) +(mk_real_int64 19719L),(mk_real_int64 81186L);(* 4, 4 *) +(mk_real_int64 91594L),(mk_real_int64 16694L);(* 4, 4 *) +(mk_real_int64 25177L),(mk_real_int64 93368L);(* 4, 4 *) +(mk_real_int64 80528L),(mk_real_int64 36328L);(* 4, 4 *) +(mk_real_int64 46156L),(mk_real_int64 88378L);(* 4, 4 *) +(mk_real_int64 30726L),(mk_real_int64 20611L);(* 4, 4 *) +(mk_real_int64 60968L),(mk_real_int64 29778L);(* 4, 4 *) +(mk_real_int64 70479L),(mk_real_int64 53465L);(* 4, 4 *) +(mk_real_int64 75251L),(mk_real_int64 53275L);(* 4, 4 *) +(mk_real_int64 24630L),(mk_real_int64 11884L);(* 4, 4 *) +(mk_real_int64 50316L),(mk_real_int64 51945L);(* 4, 4 *) +(mk_real_int64 16749L),(mk_real_int64 96356L);(* 4, 4 *) +(mk_real_int64 97205L),(mk_real_int64 31936L);(* 4, 4 *) +(mk_real_int64 91566L),(mk_real_int64 96511L);(* 4, 4 *) +(mk_real_int64 23970L),(mk_real_int64 88648L);(* 4, 4 *) +(mk_real_int64 46313L),(mk_real_int64 90098L);(* 4, 4 *) +(mk_real_int64 64165L),(mk_real_int64 94271L);(* 4, 4 *) +(mk_real_int64 91810L),(mk_real_int64 43832L);(* 4, 4 *) +(mk_real_int64 25144L),(mk_real_int64 68648L);(* 4, 4 *) +(mk_real_int64 18399L),(mk_real_int64 66900L);(* 4, 4 *) +(mk_real_int64 80560L),(mk_real_int64 38989L);(* 4, 4 *) +(mk_real_int64 38348L),(mk_real_int64 18577L);(* 4, 4 *) +(mk_real_int64 72458L),(mk_real_int64 61070L);(* 4, 4 *) +(mk_real_int64 48347L),(mk_real_int64 53508L);(* 4, 4 *) +(mk_real_int64 10727L),(mk_real_int64 22914L);(* 4, 4 *) +(mk_real_int64 40070L),(mk_real_int64 24491L);(* 4, 4 *) +(mk_real_int64 54425L),(mk_real_int64 92022L);(* 4, 4 *) +(mk_real_int64 88556L),(mk_real_int64 67773L);(* 4, 4 *) +(mk_real_int64 74437L),(mk_real_int64 95236L);(* 4, 4 *) +(mk_real_int64 19487L),(mk_real_int64 93240L);(* 4, 4 *) +(mk_real_int64 11801L),(mk_real_int64 84016L);(* 4, 4 *) +(mk_real_int64 22358L),(mk_real_int64 57506L);(* 4, 4 *) +(mk_real_int64 52065L),(mk_real_int64 40626L);(* 4, 4 *) +(mk_real_int64 56445L),(mk_real_int64 66696L);(* 4, 4 *) +(mk_real_int64 37967L),(mk_real_int64 36647L);(* 4, 4 *) +(mk_real_int64 38320L),(mk_real_int64 16602L);(* 4, 4 *) +(mk_real_int64 44875L),(mk_real_int64 57728L);(* 4, 4 *) +(mk_real_int64 31323L),(mk_real_int64 21326L);(* 4, 4 *) +(mk_real_int64 23596L),(mk_real_int64 98170L);(* 4, 4 *) +(mk_real_int64 33898L),(mk_real_int64 46134L);(* 4, 4 *) +(mk_real_int64 83587L),(mk_real_int64 48057L);(* 4, 4 *) +(mk_real_int64 95784L),(mk_real_int64 11056L);(* 4, 4 *) +(mk_real_int64 58578L),(mk_real_int64 31822L);(* 4, 4 *) +(mk_real_int64 45673L),(mk_real_int64 72141L);(* 4, 4 *) +(mk_real_int64 15715L),(mk_real_int64 34036L);(* 4, 4 *) +(mk_real_int64 69393L),(mk_real_int64 29907L);(* 4, 4 *) +(mk_real_int64 59160L),(mk_real_int64 25158L);(* 4, 4 *) +(mk_real_int64 65098L),(mk_real_int64 96543L);(* 4, 4 *) +(mk_real_int64 26631L),(mk_real_int64 80840L);(* 4, 4 *) +(mk_real_int64 66511L),(mk_real_int64 41832L);(* 4, 4 *) +(mk_real_int64 14625L),(mk_real_int64 81650L);(* 4, 4 *) +(mk_real_int64 25541L),(mk_real_int64 74078L);(* 4, 4 *) +(mk_real_int64 84592L),(mk_real_int64 33468L);(* 4, 4 *) +(mk_real_int64 79614L),(mk_real_int64 96695L);(* 4, 4 *) +(mk_real_int64 70699L),(mk_real_int64 77229L);(* 4, 4 *) +(mk_real_int64 54176L),(mk_real_int64 76265L);(* 4, 4 *) +(mk_real_int64 71338L),(mk_real_int64 73352L);(* 4, 4 *) +(mk_real_int64 19652L),(mk_real_int64 63742L);(* 4, 4 *) +(mk_real_int64 88230L),(mk_real_int64 21302L);(* 4, 4 *) +(mk_real_int64 98927L),(mk_real_int64 30243L);(* 4, 4 *) +(mk_real_int64 94951L),(mk_real_int64 84302L);(* 4, 4 *) +(mk_real_int64 60981L),(mk_real_int64 13930L);(* 4, 4 *) +(mk_real_int64 67252L),(mk_real_int64 18413L);(* 4, 4 *) +(mk_real_int64 57441L),(mk_real_int64 29717L);(* 4, 4 *) +(mk_real_int64 92629L),(mk_real_int64 34779L);(* 4, 4 *) +(mk_real_int64 94694L),(mk_real_int64 42755L);(* 4, 4 *) +(mk_real_int64 41659L),(mk_real_int64 92064L);(* 4, 4 *) +(mk_real_int64 41508L),(mk_real_int64 11937L);(* 4, 4 *) +(mk_real_int64 32516L),(mk_real_int64 31705L);(* 4, 4 *) +(mk_real_int64 26462L),(mk_real_int64 35110L);(* 4, 4 *) +(mk_real_int64 52206L),(mk_real_int64 48977L);(* 4, 4 *) +(mk_real_int64 11442L),(mk_real_int64 38484L);(* 4, 4 *) +(mk_real_int64 79858L),(mk_real_int64 93126L);(* 4, 4 *) +(mk_real_int64 58567L),(mk_real_int64 85806L);(* 4, 4 *) +(mk_real_int64 15505L),(mk_real_int64 11355L);(* 4, 4 *) +(mk_real_int64 18312L),(mk_real_int64 15329L);(* 4, 4 *) +(mk_real_int64 81912L),(mk_real_int64 46267L);(* 4, 4 *) +(mk_real_int64 46879L),(mk_real_int64 30322L);(* 4, 4 *) +(mk_real_int64 30668L),(mk_real_int64 21611L);(* 4, 4 *) +(mk_real_int64 16825L),(mk_real_int64 76178L);(* 4, 4 *) +(mk_real_int64 76025L),(mk_real_int64 59896L);(* 4, 4 *) +(mk_real_int64 14065L),(mk_real_int64 45919L);(* 4, 4 *) +(mk_real_int64 82534L),(mk_real_int64 21421L);(* 4, 4 *) +(mk_real_int64 44606L),(mk_real_int64 79272L);(* 4, 4 *) +(mk_real_int64 41844L),(mk_real_int64 17715L);(* 4, 4 *) +(mk_real_int64 41226L),(mk_real_int64 66524L);(* 4, 4 *) +(mk_real_int64 94838L),(mk_real_int64 73817L);(* 4, 4 *) +(mk_real_int64 78035L),(mk_real_int64 55974L);(* 4, 4 *) +(mk_real_int64 82859L),(mk_real_int64 32496L);(* 4, 4 *) +(mk_real_int64 34070L),(mk_real_int64 74125L);(* 4, 4 *) +(mk_real_int64 59845L),(mk_real_int64 71633L);(* 4, 4 *) +(mk_real_int64 24212L),(mk_real_int64 91274L);(* 4, 4 *) +(mk_real_int64 26466L),(mk_real_int64 89364L);(* 4, 4 *) +(mk_real_int64 60842L),(mk_real_int64 95390L);(* 4, 4 *) +(mk_real_int64 55184L),(mk_real_int64 21185L);(* 4, 4 *) +(mk_real_int64 81267L),(mk_real_int64 20905L);(* 4, 4 *) +(mk_real_int64 24880L),(mk_real_int64 50283L);(* 4, 4 *) +(mk_real_int64 59083L),(mk_real_int64 92308L);(* 4, 4 *) +(mk_real_int64 44911L),(mk_real_int64 65521L);(* 4, 4 *) +(mk_real_int64 55949L),(mk_real_int64 68437L);(* 4, 4 *) +(mk_real_int64 58520L),(mk_real_int64 79293L);(* 4, 4 *) +(mk_real_int64 53962L),(mk_real_int64 97788L);(* 4, 4 *) +(mk_real_int64 70128L),(mk_real_int64 51786L);(* 4, 4 *) +(mk_real_int64 20490L),(mk_real_int64 18094L);(* 4, 4 *) +(mk_real_int64 68230L),(mk_real_int64 90904L);(* 4, 4 *) +(mk_real_int64 47461L),(mk_real_int64 98171L);(* 4, 4 *) +(mk_real_int64 87539L),(mk_real_int64 42699L);(* 4, 4 *) +(mk_real_int64 26332L),(mk_real_int64 14392L);(* 4, 4 *) +(mk_real_int64 45683L),(mk_real_int64 22790L);(* 4, 4 *) +(mk_real_int64 29452L),(mk_real_int64 93168L);(* 4, 4 *) +(mk_real_int64 60578L),(mk_real_int64 49214L);(* 4, 4 *) +(mk_real_int64 34088L),(mk_real_int64 30658L);(* 4, 4 *) +(mk_real_int64 36446L),(mk_real_int64 30321L);(* 4, 4 *) +(mk_real_int64 51644L),(mk_real_int64 54554L);(* 4, 4 *) +(mk_real_int64 24733L),(mk_real_int64 85725L);(* 4, 4 *) +(mk_real_int64 21063L),(mk_real_int64 27337L);(* 4, 4 *) +(mk_real_int64 76546L),(mk_real_int64 65632L);(* 4, 4 *) +(mk_real_int64 25604L),(mk_real_int64 80551L);(* 4, 4 *) +(mk_real_int64 27670L),(mk_real_int64 26422L);(* 4, 4 *) +(mk_real_int64 31146L),(mk_real_int64 74679L);(* 4, 4 *) +(mk_real_int64 78874L),(mk_real_int64 52747L);(* 4, 4 *) +(mk_real_int64 37160L),(mk_real_int64 64279L);(* 4, 4 *) +(mk_real_int64 73722L),(mk_real_int64 83095L);(* 4, 4 *) +(mk_real_int64 33364L),(mk_real_int64 82180L);(* 4, 4 *) +(mk_real_int64 33950L),(mk_real_int64 54690L);(* 4, 4 *) +(mk_real_int64 56624L),(mk_real_int64 32120L);(* 4, 4 *) +(mk_real_int64 46068L),(mk_real_int64 62779L);(* 4, 4 *) +(mk_real_int64 17858L),(mk_real_int64 19305L);(* 4, 4 *) +(mk_real_int64 55205L),(mk_real_int64 33303L);(* 4, 4 *) +(mk_real_int64 71341L),(mk_real_int64 49806L);(* 4, 4 *) +(mk_real_int64 10142L),(mk_real_int64 65934L);(* 4, 4 *) +(mk_real_int64 93360L),(mk_real_int64 82503L);(* 4, 4 *) +(mk_real_int64 79841L),(mk_real_int64 30123L);(* 4, 4 *) +(mk_real_int64 31624L),(mk_real_int64 31907L);(* 4, 4 *) +(mk_real_int64 27094L),(mk_real_int64 45780L);(* 4, 4 *) +(mk_real_int64 86720L),(mk_real_int64 29260L);(* 4, 4 *) +(mk_real_int64 91643L),(mk_real_int64 54772L);(* 4, 4 *) +(mk_real_int64 24293L),(mk_real_int64 17830L);(* 4, 4 *) +(mk_real_int64 22054L),(mk_real_int64 69807L);(* 4, 4 *) +(mk_real_int64 56934L),(mk_real_int64 53350L);(* 4, 4 *) +(mk_real_int64 96955L),(mk_real_int64 69463L);(* 4, 4 *) +(mk_real_int64 30604L),(mk_real_int64 70042L);(* 4, 4 *) +(mk_real_int64 39100L),(mk_real_int64 88941L);(* 4, 4 *) +(mk_real_int64 81267L),(mk_real_int64 23766L);(* 4, 4 *) +(mk_real_int64 57773L),(mk_real_int64 16299L);(* 4, 4 *) +(mk_real_int64 35345L),(mk_real_int64 94366L);(* 4, 4 *) +(mk_real_int64 55080L),(mk_real_int64 81338L);(* 4, 4 *) +(mk_real_int64 74536L),(mk_real_int64 22940L);(* 4, 4 *) +(mk_real_int64 59386L),(mk_real_int64 54655L);(* 4, 4 *) +(mk_real_int64 84437L),(mk_real_int64 53599L);(* 4, 4 *) +(mk_real_int64 61470L),(mk_real_int64 11457L);(* 4, 4 *) +(mk_real_int64 65085L),(mk_real_int64 88168L);(* 4, 4 *) +(mk_real_int64 67968L),(mk_real_int64 37364L);(* 4, 4 *) +(mk_real_int64 40475L),(mk_real_int64 91294L);(* 4, 4 *) +(mk_real_int64 48486L),(mk_real_int64 10028L);(* 4, 4 *) +(mk_real_int64 97250L),(mk_real_int64 85396L);(* 4, 4 *) +(mk_real_int64 76367L),(mk_real_int64 27990L);(* 4, 4 *) +(mk_real_int64 52850L),(mk_real_int64 40678L);(* 4, 4 *) +(mk_real_int64 45329L),(mk_real_int64 33318L);(* 4, 4 *) +(mk_real_int64 53402L),(mk_real_int64 90898L);(* 4, 4 *) +(mk_real_int64 48855L),(mk_real_int64 17857L);(* 4, 4 *) +(mk_real_int64 74132L),(mk_real_int64 20795L);(* 4, 4 *) +(mk_real_int64 20435L),(mk_real_int64 92353L);(* 4, 4 *) +(mk_real_int64 74179L),(mk_real_int64 20305L);(* 4, 4 *) +(mk_real_int64 80235L),(mk_real_int64 11353L);(* 4, 4 *) +(mk_real_int64 58443L),(mk_real_int64 67397L);(* 4, 4 *) +(mk_real_int64 85369L),(mk_real_int64 13335L);(* 4, 4 *) +(mk_real_int64 91879L),(mk_real_int64 95497L);(* 4, 4 *) +(mk_real_int64 14377L),(mk_real_int64 42435L);(* 4, 4 *) +(mk_real_int64 12073L),(mk_real_int64 11736L);(* 4, 4 *) +(mk_real_int64 58465L),(mk_real_int64 89971L);(* 4, 4 *) +(mk_real_int64 75279L),(mk_real_int64 57745L);(* 4, 4 *) +(mk_real_int64 19047L),(mk_real_int64 49947L);(* 4, 4 *) +(mk_real_int64 27998L),(mk_real_int64 37089L);(* 4, 4 *) +(mk_real_int64 38487L),(mk_real_int64 43858L);(* 4, 4 *) +(mk_real_int64 77610L),(mk_real_int64 36068L);(* 4, 4 *) +(mk_real_int64 11252L),(mk_real_int64 93537L);(* 4, 4 *) +(mk_real_int64 14744L),(mk_real_int64 53612L);(* 4, 4 *) +(mk_real_int64 37324L),(mk_real_int64 54290L);(* 4, 4 *) +(mk_real_int64 77733L),(mk_real_int64 75614L);(* 4, 4 *) +(mk_real_int64 63183L),(mk_real_int64 30170L);(* 4, 4 *) +(mk_real_int64 21059L),(mk_real_int64 47132L);(* 4, 4 *) +(mk_real_int64 51583L),(mk_real_int64 39852L);(* 4, 4 *) +(mk_real_int64 10027L),(mk_real_int64 73032L);(* 4, 4 *) +(mk_real_int64 36110L),(mk_real_int64 57352L);(* 4, 4 *) +(mk_real_int64 36300L),(mk_real_int64 12894L);(* 4, 4 *) +(mk_real_int64 31244L),(mk_real_int64 51665L);(* 4, 4 *) +(mk_real_int64 42433L),(mk_real_int64 58882L);(* 4, 4 *) +(mk_real_int64 42577L),(mk_real_int64 26387L);(* 4, 4 *) +(mk_real_int64 11747L),(mk_real_int64 70486L);(* 4, 4 *) +(mk_real_int64 74355L),(mk_real_int64 47090L);(* 4, 4 *) +(mk_real_int64 81817L),(mk_real_int64 46376L);(* 4, 4 *) +(mk_real_int64 33742L),(mk_real_int64 32375L);(* 4, 4 *) +(mk_real_int64 66145L),(mk_real_int64 91831L);(* 4, 4 *) +(mk_real_int64 98590L),(mk_real_int64 48266L);(* 4, 4 *) +(mk_real_int64 68173L),(mk_real_int64 60085L);(* 4, 4 *) +(mk_real_int64 64701L),(mk_real_int64 36457L);(* 4, 4 *) +(mk_real_int64 48552L),(mk_real_int64 38294L);(* 4, 4 *) +(mk_real_int64 78912L),(mk_real_int64 38146L);(* 4, 4 *) +(mk_real_int64 16162L),(mk_real_int64 79193L);(* 4, 4 *) +(mk_real_int64 49920L),(mk_real_int64 54964L);(* 4, 4 *) +(mk_real_int64 10978L),(mk_real_int64 81134L);(* 4, 4 *) +(mk_real_int64 17557L),(mk_real_int64 74715L);(* 4, 4 *) +(mk_real_int64 14823L),(mk_real_int64 59585L);(* 4, 4 *) +(mk_real_int64 61103L),(mk_real_int64 55860L);(* 4, 4 *) +(mk_real_int64 21035L),(mk_real_int64 20936L);(* 4, 4 *) +(mk_real_int64 52543L),(mk_real_int64 17246L);(* 4, 4 *) +(mk_real_int64 11258L),(mk_real_int64 26092L);(* 4, 4 *) +(mk_real_int64 48352L),(mk_real_int64 74681L);(* 4, 4 *) +(mk_real_int64 23390L),(mk_real_int64 29207L);(* 4, 4 *) +(mk_real_int64 73706L),(mk_real_int64 18194L);(* 4, 4 *) +(mk_real_int64 74440L),(mk_real_int64 87843L);(* 4, 4 *) +(mk_real_int64 89178L),(mk_real_int64 76214L);(* 4, 4 *) +(mk_real_int64 48192L),(mk_real_int64 94785L);(* 4, 4 *) +(mk_real_int64 13113L),(mk_real_int64 14138L);(* 4, 4 *) +(mk_real_int64 79968L),(mk_real_int64 14430L);(* 4, 4 *) +(mk_real_int64 20225L),(mk_real_int64 32552L);(* 4, 4 *) +(mk_real_int64 30566L),(mk_real_int64 29390L);(* 4, 4 *) +(mk_real_int64 46111L),(mk_real_int64 10683L);(* 4, 4 *) +(mk_real_int64 38819L),(mk_real_int64 59025L);(* 4, 4 *) +(mk_real_int64 27552L),(mk_real_int64 16559L);(* 4, 4 *) +(mk_real_int64 40728L),(mk_real_int64 52729L);(* 4, 4 *) +(mk_real_int64 37231L),(mk_real_int64 57236L);(* 4, 4 *) +(mk_real_int64 17542L),(mk_real_int64 57454L);(* 4, 4 *) +(mk_real_int64 35199L),(mk_real_int64 32459L);(* 4, 4 *) +(mk_real_int64 89941L),(mk_real_int64 14230L);(* 4, 4 *) +(mk_real_int64 24755L),(mk_real_int64 86953L);(* 4, 4 *) +(mk_real_int64 15487L),(mk_real_int64 41725L);(* 4, 4 *) +(mk_real_int64 80523L),(mk_real_int64 23134L);(* 4, 4 *) +(mk_real_int64 91955L),(mk_real_int64 41341L);(* 4, 4 *) +(mk_real_int64 36523L),(mk_real_int64 20036L);(* 4, 4 *) +(mk_real_int64 56472L),(mk_real_int64 56964L);(* 4, 4 *) +(mk_real_int64 75891L),(mk_real_int64 16605L);(* 4, 4 *) +(mk_real_int64 10711L),(mk_real_int64 29990L);(* 4, 4 *) +(mk_real_int64 86679L),(mk_real_int64 81867L);(* 4, 4 *) +(mk_real_int64 79979L),(mk_real_int64 47669L);(* 4, 4 *) +(mk_real_int64 45862L),(mk_real_int64 64364L);(* 4, 4 *) +(mk_real_int64 11654L),(mk_real_int64 67146L);(* 4, 4 *) +(mk_real_int64 77465L),(mk_real_int64 31711L);(* 4, 4 *) +(mk_real_int64 60612L),(mk_real_int64 41941L);(* 4, 4 *) +(mk_real_int64 68672L),(mk_real_int64 90736L);(* 4, 4 *) +(mk_real_int64 69586L),(mk_real_int64 80652L);(* 4, 4 *) +(mk_real_int64 24195L),(mk_real_int64 75738L);(* 4, 4 *) +(mk_real_int64 89673L),(mk_real_int64 33270L);(* 4, 4 *) +(mk_real_int64 27065L),(mk_real_int64 88839L);(* 4, 4 *) +(mk_real_int64 48866L),(mk_real_int64 32977L);(* 4, 4 *) +(mk_real_int64 18727L),(mk_real_int64 97476L);(* 4, 4 *) +(mk_real_int64 32502L),(mk_real_int64 17516L);(* 4, 4 *) +(mk_real_int64 60086L),(mk_real_int64 83762L);(* 4, 4 *) +(mk_real_int64 76837L),(mk_real_int64 30625L);(* 4, 4 *) +(mk_real_int64 56525L),(mk_real_int64 87550L);(* 4, 4 *) +(mk_real_int64 70774L),(mk_real_int64 53331L);(* 4, 4 *) +(mk_real_int64 52479L),(mk_real_int64 52272L);(* 4, 4 *) +(mk_real_int64 68367L),(mk_real_int64 60390L);(* 4, 4 *) +(mk_real_int64 85298L),(mk_real_int64 48339L);(* 4, 4 *) +(mk_real_int64 64258L),(mk_real_int64 58812L);(* 4, 4 *) +(mk_real_int64 62521L),(mk_real_int64 60013L);(* 4, 4 *) +(mk_real_int64 72668L),(mk_real_int64 45785L);(* 4, 4 *) +(mk_real_int64 50448L),(mk_real_int64 75819L);(* 4, 4 *) +(mk_real_int64 42768L),(mk_real_int64 10152L);(* 4, 4 *) +(mk_real_int64 26930L),(mk_real_int64 77439L);(* 4, 4 *) +(mk_real_int64 12924L),(mk_real_int64 97838L);(* 4, 4 *) +(mk_real_int64 43000L),(mk_real_int64 57002L);(* 4, 4 *) +(mk_real_int64 38942L),(mk_real_int64 48384L);(* 4, 4 *) +(mk_real_int64 41862L),(mk_real_int64 94137L);(* 4, 4 *) +(mk_real_int64 17060L),(mk_real_int64 93702L);(* 4, 4 *) +(mk_real_int64 54872L),(mk_real_int64 39986L);(* 4, 4 *) +(mk_real_int64 85414L),(mk_real_int64 81120L);(* 4, 4 *) +(mk_real_int64 29961L),(mk_real_int64 26255L);(* 4, 4 *) +(mk_real_int64 38173L),(mk_real_int64 71922L);(* 4, 4 *) +(mk_real_int64 17371L),(mk_real_int64 39283L);(* 4, 4 *) +(mk_real_int64 47970L),(mk_real_int64 78725L);(* 4, 4 *) +(mk_real_int64 34580L),(mk_real_int64 90053L);(* 4, 4 *) +(mk_real_int64 70455L),(mk_real_int64 58712L);(* 4, 4 *) +(mk_real_int64 34807L),(mk_real_int64 86715L);(* 4, 4 *) +(mk_real_int64 67066L),(mk_real_int64 84266L);(* 4, 4 *) +(mk_real_int64 50993L),(mk_real_int64 76684L);(* 4, 4 *) +(mk_real_int64 13695L),(mk_real_int64 79084L);(* 4, 4 *) +(mk_real_int64 84625L),(mk_real_int64 72935L);(* 4, 4 *) +(mk_real_int64 20330L),(mk_real_int64 95475L);(* 4, 4 *) +(mk_real_int64 23329L),(mk_real_int64 29982L);(* 4, 4 *) +(mk_real_int64 28528L),(mk_real_int64 91160L);(* 4, 4 *) +(mk_real_int64 41278L),(mk_real_int64 70555L);(* 4, 4 *) +(mk_real_int64 13939L),(mk_real_int64 32534L);(* 4, 4 *) +(mk_real_int64 74597L),(mk_real_int64 91547L);(* 4, 4 *) +(mk_real_int64 25823L),(mk_real_int64 34193L);(* 4, 4 *) +(mk_real_int64 47645L),(mk_real_int64 70845L);(* 4, 4 *) +(mk_real_int64 92780L),(mk_real_int64 87646L);(* 4, 4 *) +(mk_real_int64 39468L),(mk_real_int64 34198L);(* 4, 4 *) +(mk_real_int64 73257L),(mk_real_int64 52946L);(* 4, 4 *) +(mk_real_int64 86545L),(mk_real_int64 80229L);(* 4, 4 *) +(mk_real_int64 23577L),(mk_real_int64 55145L);(* 4, 4 *) +(mk_real_int64 37070L),(mk_real_int64 32793L);(* 4, 4 *) +(mk_real_int64 52709L),(mk_real_int64 78186L);(* 4, 4 *) +(mk_real_int64 36290L),(mk_real_int64 16330L);(* 4, 4 *) +(mk_real_int64 96493L),(mk_real_int64 57025L);(* 4, 4 *) +(mk_real_int64 15924L),(mk_real_int64 42696L);(* 4, 4 *) +(mk_real_int64 58592L),(mk_real_int64 87387L);(* 4, 4 *) +(mk_real_int64 20755L),(mk_real_int64 56809L);(* 4, 4 *) +(mk_real_int64 47446L),(mk_real_int64 64024L);(* 4, 4 *) +(mk_real_int64 86113L),(mk_real_int64 47920L);(* 4, 4 *) +(mk_real_int64 84113L),(mk_real_int64 43259L);(* 4, 4 *) +(mk_real_int64 70891L),(mk_real_int64 42873L);(* 4, 4 *) +(mk_real_int64 46620L),(mk_real_int64 80147L);(* 4, 4 *) +(mk_real_int64 83902L),(mk_real_int64 26048L);(* 4, 4 *) +(mk_real_int64 49615L),(mk_real_int64 60427L);(* 4, 4 *) +(mk_real_int64 99676L),(mk_real_int64 67383L);(* 4, 4 *) +(mk_real_int64 18930L),(mk_real_int64 43099L);(* 4, 4 *) +(mk_real_int64 16405L),(mk_real_int64 73381L);(* 4, 4 *) +(mk_real_int64 64090L),(mk_real_int64 18484L);(* 4, 4 *) +(mk_real_int64 27845L),(mk_real_int64 35751L);(* 4, 4 *) +(mk_real_int64 96243L),(mk_real_int64 68267L);(* 4, 4 *) +(mk_real_int64 95053L),(mk_real_int64 68797L);(* 4, 4 *) +(mk_real_int64 28268L),(mk_real_int64 14949L);(* 4, 4 *) +(mk_real_int64 22252L),(mk_real_int64 15392L);(* 4, 4 *) +(mk_real_int64 76890L),(mk_real_int64 82658L);(* 4, 4 *) +(mk_real_int64 86751L),(mk_real_int64 19232L);(* 4, 4 *) +(mk_real_int64 66831L),(mk_real_int64 48625L);(* 4, 4 *) +(mk_real_int64 96114L),(mk_real_int64 80316L);(* 4, 4 *) +(mk_real_int64 84253L),(mk_real_int64 94195L);(* 4, 4 *) +(mk_real_int64 86172L),(mk_real_int64 72561L);(* 4, 4 *) +(mk_real_int64 94283L),(mk_real_int64 20242L);(* 4, 4 *) +(mk_real_int64 66713L),(mk_real_int64 46066L);(* 4, 4 *) +(mk_real_int64 57347L),(mk_real_int64 48540L);(* 4, 4 *) +(mk_real_int64 33766L),(mk_real_int64 25492L);(* 4, 4 *) +(mk_real_int64 80982L),(mk_real_int64 47373L);(* 4, 4 *) +(mk_real_int64 92718L),(mk_real_int64 38962L);(* 4, 4 *) +(mk_real_int64 46178L),(mk_real_int64 60361L);(* 4, 4 *) +(mk_real_int64 51676L),(mk_real_int64 25845L);(* 4, 4 *) +(mk_real_int64 48205L),(mk_real_int64 12094L);(* 4, 4 *) +(mk_real_int64 24605L),(mk_real_int64 41670L);(* 4, 4 *) +(mk_real_int64 67894L),(mk_real_int64 78509L);(* 4, 4 *) +(mk_real_int64 49156L),(mk_real_int64 66956L);(* 4, 4 *) +(mk_real_int64 73675L),(mk_real_int64 90444L);(* 4, 4 *) +(mk_real_int64 10551L),(mk_real_int64 70304L);(* 4, 4 *) +(mk_real_int64 46984L),(mk_real_int64 36087L);(* 4, 4 *) +(mk_real_int64 89127L),(mk_real_int64 69893L);(* 4, 4 *) +(mk_real_int64 32310L),(mk_real_int64 55283L);(* 4, 4 *) +(mk_real_int64 41467L),(mk_real_int64 86000L);(* 4, 4 *) +(mk_real_int64 11554L),(mk_real_int64 58986L);(* 4, 4 *) +(mk_real_int64 21449L),(mk_real_int64 79726L);(* 4, 4 *) +(mk_real_int64 81182L),(mk_real_int64 96758L);(* 4, 4 *) +(mk_real_int64 34409L),(mk_real_int64 39517L);(* 4, 4 *) +(mk_real_int64 89939L),(mk_real_int64 57789L);(* 4, 4 *) +(mk_real_int64 73052L),(mk_real_int64 16469L);(* 4, 4 *) +(mk_real_int64 96947L),(mk_real_int64 80269L);(* 4, 4 *) +(mk_real_int64 42111L),(mk_real_int64 82158L);(* 4, 4 *) +(mk_real_int64 79589L),(mk_real_int64 54502L);(* 4, 4 *) +(mk_real_int64 14666L),(mk_real_int64 25773L);(* 4, 4 *) +(mk_real_int64 71085L),(mk_real_int64 99755L);(* 4, 4 *) +(mk_real_int64 72390L),(mk_real_int64 66902L);(* 4, 4 *) +(mk_real_int64 47988L),(mk_real_int64 63460L);(* 4, 4 *) +(mk_real_int64 78507L),(mk_real_int64 54895L);(* 4, 4 *) +(mk_real_int64 58244L),(mk_real_int64 32824L);(* 4, 4 *) +(mk_real_int64 16651L),(mk_real_int64 90894L);(* 4, 4 *) +(mk_real_int64 28894L),(mk_real_int64 65674L);(* 4, 4 *) +(mk_real_int64 24290L),(mk_real_int64 89217L);(* 4, 4 *) +(mk_real_int64 90643L),(mk_real_int64 44878L);(* 4, 4 *) +(mk_real_int64 60487L),(mk_real_int64 71135L);(* 4, 4 *) +(mk_real_int64 54100L),(mk_real_int64 19638L);(* 4, 4 *) +(mk_real_int64 77015L),(mk_real_int64 25885L);(* 4, 4 *) +(mk_real_int64 27391L),(mk_real_int64 94081L);(* 4, 4 *) +(mk_real_int64 73355L),(mk_real_int64 66714L);(* 4, 4 *) +(mk_real_int64 93974L),(mk_real_int64 16968L);(* 4, 4 *) +(mk_real_int64 90303L),(mk_real_int64 77807L);(* 4, 4 *) +(mk_real_int64 50616L),(mk_real_int64 25694L);(* 4, 4 *) +(mk_real_int64 24915L),(mk_real_int64 11797L);(* 4, 4 *) +(mk_real_int64 86595L),(mk_real_int64 54545L);(* 4, 4 *) +(mk_real_int64 41738L),(mk_real_int64 27721L);(* 4, 4 *) +(mk_real_int64 28250L),(mk_real_int64 79513L);(* 4, 4 *) +(mk_real_int64 81271L),(mk_real_int64 67115L);(* 4, 4 *) +(mk_real_int64 51138L),(mk_real_int64 82157L);(* 4, 4 *) +(mk_real_int64 87574L),(mk_real_int64 41273L);(* 4, 4 *) +(mk_real_int64 65978L),(mk_real_int64 52893L);(* 4, 4 *) +(mk_real_int64 91513L),(mk_real_int64 44711L);(* 4, 4 *) +(mk_real_int64 94013L),(mk_real_int64 43530L);(* 4, 4 *) +(mk_real_int64 71671L),(mk_real_int64 61446L);(* 4, 4 *) +(mk_real_int64 32739L),(mk_real_int64 56504L);(* 4, 4 *) +(mk_real_int64 49511L),(mk_real_int64 53906L);(* 4, 4 *) +(mk_real_int64 90104L),(mk_real_int64 21793L);(* 4, 4 *) +(mk_real_int64 60919L),(mk_real_int64 51276L);(* 4, 4 *) +(mk_real_int64 42520L),(mk_real_int64 38842L);(* 4, 4 *) +(mk_real_int64 50277L),(mk_real_int64 13199L);(* 4, 4 *) +(mk_real_int64 50758L),(mk_real_int64 22492L);(* 4, 4 *) +(mk_real_int64 12621L),(mk_real_int64 46098L);(* 4, 4 *) +(mk_real_int64 13139L),(mk_real_int64 42765L);(* 4, 4 *) +(mk_real_int64 52884L),(mk_real_int64 74585L);(* 4, 4 *) +(mk_real_int64 38365L),(mk_real_int64 19900L);(* 4, 4 *) +(mk_real_int64 74746L),(mk_real_int64 45232L);(* 4, 4 *) +(mk_real_int64 16507L),(mk_real_int64 42082L);(* 4, 4 *) +(mk_real_int64 10736L),(mk_real_int64 51081L);(* 4, 4 *) +(mk_real_int64 25453L),(mk_real_int64 55591L);(* 4, 4 *) +(mk_real_int64 83793L),(mk_real_int64 17086L);(* 4, 4 *) +(mk_real_int64 54021L),(mk_real_int64 63468L);(* 4, 4 *) +(mk_real_int64 79057L),(mk_real_int64 40091L);(* 4, 4 *) +(mk_real_int64 15034L),(mk_real_int64 87831L);(* 4, 4 *) +(mk_real_int64 37616L),(mk_real_int64 16457L);(* 4, 4 *) +(mk_real_int64 28594L),(mk_real_int64 39995L);(* 4, 4 *) +(mk_real_int64 34595L),(mk_real_int64 22296L);(* 4, 4 *) +(mk_real_int64 41880L),(mk_real_int64 84374L);(* 4, 4 *) +(mk_real_int64 90513L),(mk_real_int64 53485L);(* 4, 4 *) +(mk_real_int64 50271L),(mk_real_int64 55415L);(* 4, 4 *) +(mk_real_int64 41571L),(mk_real_int64 61248L);(* 4, 4 *) +(mk_real_int64 90645L),(mk_real_int64 97084L);(* 4, 4 *) +(mk_real_int64 33080L),(mk_real_int64 22839L);(* 4, 4 *) +(mk_real_int64 81756L),(mk_real_int64 14279L);(* 4, 4 *) +(mk_real_int64 47398L),(mk_real_int64 58022L);(* 4, 4 *) +(mk_real_int64 21057L),(mk_real_int64 19837L);(* 4, 4 *) +(mk_real_int64 35822L),(mk_real_int64 86927L);(* 4, 4 *) +(mk_real_int64 55047L),(mk_real_int64 43190L);(* 4, 4 *) +(mk_real_int64 59177L),(mk_real_int64 87289L);(* 4, 4 *) +(mk_real_int64 43434L),(mk_real_int64 72529L);(* 4, 4 *) +(mk_real_int64 41063L),(mk_real_int64 25307L);(* 4, 4 *) +(mk_real_int64 15149L),(mk_real_int64 46426L);(* 4, 4 *) +(mk_real_int64 55991L),(mk_real_int64 98369L);(* 4, 4 *) +(mk_real_int64 85304L),(mk_real_int64 62450L);(* 4, 4 *) +(mk_real_int64 13351L),(mk_real_int64 32131L);(* 4, 4 *) +(mk_real_int64 51567L),(mk_real_int64 57250L);(* 4, 4 *) +(mk_real_int64 10810L),(mk_real_int64 70037L);(* 4, 4 *) +(mk_real_int64 24020L),(mk_real_int64 32544L);(* 4, 4 *) +(mk_real_int64 26440L),(mk_real_int64 56935L);(* 4, 4 *) +(mk_real_int64 40387L),(mk_real_int64 66218L);(* 4, 4 *) +(mk_real_int64 58334L),(mk_real_int64 10755L);(* 4, 4 *) +(mk_real_int64 50432L),(mk_real_int64 79592L);(* 4, 4 *) +(mk_real_int64 95399L),(mk_real_int64 18757L);(* 4, 4 *) +(mk_real_int64 14172L),(mk_real_int64 47666L);(* 4, 4 *) +(mk_real_int64 67247L),(mk_real_int64 98688L);(* 4, 4 *) +(mk_real_int64 35197L),(mk_real_int64 13223L);(* 4, 4 *) +(mk_real_int64 20050L),(mk_real_int64 77740L);(* 4, 4 *) +(mk_real_int64 24351L),(mk_real_int64 26263L);(* 4, 4 *) +(mk_real_int64 56099L),(mk_real_int64 54218L);(* 4, 4 *) +(mk_real_int64 51093L),(mk_real_int64 34710L);(* 4, 4 *) +(mk_real_int64 37533L),(mk_real_int64 29305L);(* 4, 4 *) +(mk_real_int64 10927L),(mk_real_int64 25267L);(* 4, 4 *) +(mk_real_int64 16454L),(mk_real_int64 63806L);(* 4, 4 *) +(mk_real_int64 19026L),(mk_real_int64 65784L);(* 4, 4 *) +(mk_real_int64 72907L),(mk_real_int64 32503L);(* 4, 4 *) +(mk_real_int64 26750L),(mk_real_int64 12241L);(* 4, 4 *) +(mk_real_int64 56902L),(mk_real_int64 77215L);(* 4, 4 *) +(mk_real_int64 24195L),(mk_real_int64 40308L);(* 4, 4 *) +(mk_real_int64 74874L),(mk_real_int64 35555L);(* 4, 4 *) +(mk_real_int64 51026L),(mk_real_int64 47234L);(* 4, 4 *) +(mk_real_int64 94196L),(mk_real_int64 47637L);(* 4, 4 *) +(mk_real_int64 95202L),(mk_real_int64 14662L);(* 4, 4 *) +(mk_real_int64 96933L),(mk_real_int64 48344L);(* 4, 4 *) +(mk_real_int64 47199L),(mk_real_int64 33068L);(* 4, 4 *) +(mk_real_int64 55685L),(mk_real_int64 97755L);(* 4, 4 *) +(mk_real_int64 76444L),(mk_real_int64 72221L);(* 4, 4 *) +(mk_real_int64 15842L),(mk_real_int64 15676L);(* 4, 4 *) +(mk_real_int64 38684L),(mk_real_int64 39028L);(* 4, 4 *) +(mk_real_int64 99826L),(mk_real_int64 35165L);(* 4, 4 *) +(mk_real_int64 73138L),(mk_real_int64 41592L);(* 4, 4 *) +(mk_real_int64 99729L),(mk_real_int64 48387L);(* 4, 4 *) +(mk_real_int64 74758L),(mk_real_int64 44743L);(* 4, 4 *) +(mk_real_int64 81938L),(mk_real_int64 32956L);(* 4, 4 *) +(mk_real_int64 56319L),(mk_real_int64 42833L);(* 4, 4 *) +(mk_real_int64 63545L),(mk_real_int64 84041L);(* 4, 4 *) +(mk_real_int64 51388L),(mk_real_int64 30543L);(* 4, 4 *) +(mk_real_int64 13191L),(mk_real_int64 13858L);(* 4, 4 *) +(mk_real_int64 40513L),(mk_real_int64 89894L);(* 4, 4 *) +(mk_real_int64 34101L),(mk_real_int64 96264L);(* 4, 4 *) +(mk_real_int64 28332L),(mk_real_int64 68108L);(* 4, 4 *) +(mk_real_int64 26606L),(mk_real_int64 85956L);(* 4, 4 *) +(mk_real_int64 20098L),(mk_real_int64 75150L);(* 4, 4 *) +(mk_real_int64 56057L),(mk_real_int64 54528L);(* 4, 4 *) +(mk_real_int64 96397L),(mk_real_int64 51226L);(* 4, 4 *) +(mk_real_int64 48531L),(mk_real_int64 85166L);(* 4, 4 *) +(mk_real_int64 40481L),(mk_real_int64 49709L);(* 4, 4 *) +(mk_real_int64 62416L),(mk_real_int64 19433L);(* 4, 4 *) +(mk_real_int64 47503L),(mk_real_int64 55808L);(* 4, 4 *) +(mk_real_int64 72878L),(mk_real_int64 60458L);(* 4, 4 *) +(mk_real_int64 32722L),(mk_real_int64 73976L);(* 4, 4 *) +(mk_real_int64 92024L),(mk_real_int64 14366L);(* 4, 4 *) +(mk_real_int64 69522L),(mk_real_int64 71643L);(* 4, 4 *) +(mk_real_int64 56367L),(mk_real_int64 55900L);(* 4, 4 *) +(mk_real_int64 69029L),(mk_real_int64 11984L);(* 4, 4 *) +(mk_real_int64 75161L),(mk_real_int64 48789L);(* 4, 4 *) +(mk_real_int64 14926L),(mk_real_int64 13562L);(* 4, 4 *) +(mk_real_int64 16832L),(mk_real_int64 15029L);(* 4, 4 *) +(mk_real_int64 24986L),(mk_real_int64 23773L);(* 4, 4 *) +(mk_real_int64 38289L),(mk_real_int64 99606L);(* 4, 4 *) +(mk_real_int64 88684L),(mk_real_int64 37409L);(* 4, 4 *) +(mk_real_int64 36558L),(mk_real_int64 15093L);(* 4, 4 *) +(mk_real_int64 94301L),(mk_real_int64 78378L);(* 4, 4 *) +(mk_real_int64 53560L),(mk_real_int64 11678L);(* 4, 4 *) +(mk_real_int64 68126L),(mk_real_int64 93756L);(* 4, 4 *) +(mk_real_int64 66353L),(mk_real_int64 84703L);(* 4, 4 *) +(mk_real_int64 27016L),(mk_real_int64 73641L);(* 4, 4 *) +(mk_real_int64 73541L),(mk_real_int64 54354L);(* 4, 4 *) +(mk_real_int64 76083L),(mk_real_int64 22240L);(* 4, 4 *) +(mk_real_int64 26433L),(mk_real_int64 48454L);(* 4, 4 *) +(mk_real_int64 28783L),(mk_real_int64 10156L);(* 4, 4 *) +(mk_real_int64 85497L),(mk_real_int64 94412L);(* 4, 4 *) +(mk_real_int64 76063L),(mk_real_int64 99741L);(* 4, 4 *) +(mk_real_int64 80239L),(mk_real_int64 36918L);(* 4, 4 *) +(mk_real_int64 42877L),(mk_real_int64 57386L);(* 4, 4 *) +(mk_real_int64 94446L),(mk_real_int64 33730L);(* 4, 4 *) +(mk_real_int64 27519L),(mk_real_int64 73271L);(* 4, 4 *) +(mk_real_int64 71773L),(mk_real_int64 95312L);(* 4, 4 *) +(mk_real_int64 47418L),(mk_real_int64 86930L);(* 4, 4 *) +(mk_real_int64 20063L),(mk_real_int64 91143L);(* 4, 4 *) +(mk_real_int64 28082L),(mk_real_int64 54689L);(* 4, 4 *) +(mk_real_int64 87773L),(mk_real_int64 75271L);(* 4, 4 *) +(mk_real_int64 45629L),(mk_real_int64 90457L);(* 4, 4 *) +(mk_real_int64 31772L),(mk_real_int64 41283L);(* 4, 4 *) +(mk_real_int64 40020L),(mk_real_int64 62476L);(* 4, 4 *) +(mk_real_int64 38945L),(mk_real_int64 12746L);(* 4, 4 *) +(mk_real_int64 97338L),(mk_real_int64 89833L);(* 4, 4 *) +(mk_real_int64 80822L),(mk_real_int64 88527L);(* 4, 4 *) +(mk_real_int64 51911L),(mk_real_int64 42144L);(* 4, 4 *) +(mk_real_int64 39028L),(mk_real_int64 94559L);(* 4, 4 *) +(mk_real_int64 98137L),(mk_real_int64 26642L);(* 4, 4 *) +(mk_real_int64 68799L),(mk_real_int64 20739L);(* 4, 4 *) +(mk_real_int64 99309L),(mk_real_int64 42622L);(* 4, 4 *) +(mk_real_int64 67184L),(mk_real_int64 53744L);(* 4, 4 *) +(mk_real_int64 11868L),(mk_real_int64 78228L);(* 4, 4 *) +(mk_real_int64 16936L),(mk_real_int64 89151L);(* 4, 4 *) +(mk_real_int64 12176L),(mk_real_int64 35289L);(* 4, 4 *) +(mk_real_int64 30371L),(mk_real_int64 74093L);(* 4, 4 *) +(mk_real_int64 22382L),(mk_real_int64 20226L);(* 4, 4 *) +(mk_real_int64 58782L),(mk_real_int64 85605L);(* 4, 4 *) +(mk_real_int64 77968L),(mk_real_int64 48955L);(* 4, 4 *) +(mk_real_int64 96896L),(mk_real_int64 80399L);(* 4, 4 *) +(mk_real_int64 28441L),(mk_real_int64 91700L);(* 4, 4 *) +(mk_real_int64 36391L),(mk_real_int64 37684L);(* 4, 4 *) +(mk_real_int64 92447L),(mk_real_int64 83244L);(* 4, 4 *) +(mk_real_int64 53400L),(mk_real_int64 15274L);(* 4, 4 *) +(mk_real_int64 57901L),(mk_real_int64 25502L);(* 4, 4 *) +(mk_real_int64 93004L),(mk_real_int64 11440L);(* 4, 4 *) +(mk_real_int64 85888L),(mk_real_int64 77033L);(* 4, 4 *) +(mk_real_int64 75961L),(mk_real_int64 13007L);(* 4, 4 *) +(mk_real_int64 33272L),(mk_real_int64 78027L);(* 4, 4 *) +(mk_real_int64 39414L),(mk_real_int64 61791L);(* 4, 4 *) +(mk_real_int64 55540L),(mk_real_int64 49792L);(* 4, 4 *) +(mk_real_int64 10569L),(mk_real_int64 72048L);(* 4, 4 *) +(mk_real_int64 69462L),(mk_real_int64 16729L);(* 4, 4 *) +(mk_real_int64 76145L),(mk_real_int64 41685L);(* 4, 4 *) +(mk_real_int64 83360L),(mk_real_int64 53422L);(* 4, 4 *) +(mk_real_int64 26591L),(mk_real_int64 59181L);(* 4, 4 *) +(mk_real_int64 29744L),(mk_real_int64 88398L);(* 4, 4 *) +(mk_real_int64 92297L),(mk_real_int64 17608L);(* 4, 4 *) +(mk_real_int64 16231L),(mk_real_int64 39500L);(* 4, 4 *) +(mk_real_int64 61295L),(mk_real_int64 28623L);(* 4, 4 *) +(mk_real_int64 34827L),(mk_real_int64 11661L);(* 4, 4 *) +(mk_real_int64 41249L),(mk_real_int64 86672L);(* 4, 4 *) +(mk_real_int64 42283L),(mk_real_int64 28931L);(* 4, 4 *) +(mk_real_int64 88204L),(mk_real_int64 45347L);(* 4, 4 *) +(mk_real_int64 44263L),(mk_real_int64 55775L);(* 4, 4 *) +(mk_real_int64 62332L),(mk_real_int64 99939L);(* 4, 4 *) +(mk_real_int64 19541L),(mk_real_int64 45105L);(* 4, 4 *) +(mk_real_int64 34859L),(mk_real_int64 78648L);(* 4, 4 *) +(mk_real_int64 91131L),(mk_real_int64 64341L);(* 4, 4 *) +(mk_real_int64 68221L),(mk_real_int64 85717L);(* 4, 4 *) +(mk_real_int64 17098L),(mk_real_int64 21715L);(* 4, 4 *) +(mk_real_int64 31913L),(mk_real_int64 14479L);(* 4, 4 *) +(mk_real_int64 98910L),(mk_real_int64 43822L);(* 4, 4 *) +(mk_real_int64 81694L),(mk_real_int64 97488L);(* 4, 4 *) +(mk_real_int64 84735L),(mk_real_int64 68352L);(* 4, 4 *) +(mk_real_int64 96775L),(mk_real_int64 93771L);(* 4, 4 *) +(mk_real_int64 26731L),(mk_real_int64 20791L);(* 4, 4 *) +(mk_real_int64 36964L),(mk_real_int64 53878L);(* 4, 4 *) +(mk_real_int64 18542L),(mk_real_int64 23895L);(* 4, 4 *) +(mk_real_int64 39764L),(mk_real_int64 50530L);(* 4, 4 *) +(mk_real_int64 28523L),(mk_real_int64 40797L);(* 4, 4 *) +(mk_real_int64 97420L),(mk_real_int64 37584L);(* 4, 4 *) +(mk_real_int64 91088L),(mk_real_int64 26651L);(* 4, 4 *) +(mk_real_int64 49640L),(mk_real_int64 84638L);(* 4, 4 *) +(mk_real_int64 63539L),(mk_real_int64 23649L);(* 4, 4 *) +(mk_real_int64 26476L),(mk_real_int64 51888L);(* 4, 4 *) +(mk_real_int64 71277L),(mk_real_int64 75577L);(* 4, 4 *) +(mk_real_int64 21524L),(mk_real_int64 23111L);(* 4, 4 *) +(mk_real_int64 79747L),(mk_real_int64 36770L);(* 4, 4 *) +(mk_real_int64 87761L),(mk_real_int64 98460L);(* 4, 4 *) +(mk_real_int64 47236L),(mk_real_int64 90715L);(* 4, 4 *) +(mk_real_int64 60611L),(mk_real_int64 75909L);(* 4, 4 *) +(mk_real_int64 58999L),(mk_real_int64 68560L);(* 4, 4 *) +(mk_real_int64 83207L),(mk_real_int64 98749L);(* 4, 4 *) +(mk_real_int64 18140L),(mk_real_int64 80979L);(* 4, 4 *) +(mk_real_int64 70105L),(mk_real_int64 77235L);(* 4, 4 *) +(mk_real_int64 34577L),(mk_real_int64 27690L);(* 4, 4 *) +(mk_real_int64 67193L),(mk_real_int64 76300L);(* 4, 4 *) +(mk_real_int64 24294L),(mk_real_int64 94327L);(* 4, 4 *) +(mk_real_int64 23390L),(mk_real_int64 82259L);(* 4, 4 *) +(mk_real_int64 94181L),(mk_real_int64 97055L);(* 4, 4 *) +(mk_real_int64 43948L),(mk_real_int64 71085L);(* 4, 4 *) +(mk_real_int64 51876L),(mk_real_int64 54886L);(* 4, 4 *) +(mk_real_int64 32493L),(mk_real_int64 51153L);(* 4, 4 *) +(mk_real_int64 99265L),(mk_real_int64 23853L);(* 4, 4 *) +(mk_real_int64 74130L),(mk_real_int64 81771L);(* 4, 4 *) +(mk_real_int64 36132L),(mk_real_int64 41303L);(* 4, 4 *) +(mk_real_int64 13294L),(mk_real_int64 37807L);(* 4, 4 *) +(mk_real_int64 80184L),(mk_real_int64 31510L);(* 4, 4 *) +(mk_real_int64 78583L),(mk_real_int64 32528L);(* 4, 4 *) +(mk_real_int64 43442L),(mk_real_int64 50890L);(* 4, 4 *) +(mk_real_int64 76497L),(mk_real_int64 82558L);(* 4, 4 *) +(mk_real_int64 53542L),(mk_real_int64 49239L);(* 4, 4 *) +(mk_real_int64 27311L),(mk_real_int64 53586L);(* 4, 4 *) +(mk_real_int64 18383L),(mk_real_int64 45223L);(* 4, 4 *) +(mk_real_int64 98815L),(mk_real_int64 85419L);(* 4, 4 *) +(mk_real_int64 23380L),(mk_real_int64 15502L);(* 4, 4 *) +(mk_real_int64 14279L),(mk_real_int64 50179L);(* 4, 4 *) +(mk_real_int64 56766L),(mk_real_int64 89525L);(* 4, 4 *) +(mk_real_int64 34033L),(mk_real_int64 14112L);(* 4, 4 *) +(mk_real_int64 46066L),(mk_real_int64 42053L);(* 4, 4 *) +(mk_real_int64 99482L),(mk_real_int64 94286L);(* 4, 4 *) +(mk_real_int64 16849L),(mk_real_int64 88333L);(* 4, 4 *) +(mk_real_int64 51103L),(mk_real_int64 93272L);(* 4, 4 *) +(mk_real_int64 24396L),(mk_real_int64 39386L);(* 4, 4 *) +(mk_real_int64 96114L),(mk_real_int64 92782L);(* 4, 4 *) +(mk_real_int64 25743L),(mk_real_int64 90860L);(* 4, 4 *) +(mk_real_int64 48816L),(mk_real_int64 53290L);(* 4, 4 *) +(mk_real_int64 30557L),(mk_real_int64 61389L);(* 4, 4 *) +(mk_real_int64 27542L),(mk_real_int64 12636L);(* 4, 4 *) +(mk_real_int64 37575L),(mk_real_int64 78906L);(* 4, 4 *) +(mk_real_int64 42770L),(mk_real_int64 64042L);(* 4, 4 *) +(mk_real_int64 25036L),(mk_real_int64 88709L);(* 4, 4 *) +(mk_real_int64 68391L),(mk_real_int64 30630L);(* 4, 4 *) +(mk_real_int64 37024L),(mk_real_int64 63113L);(* 4, 4 *) +(mk_real_int64 81040L),(mk_real_int64 90658L);(* 4, 4 *) +(mk_real_int64 97476L),(mk_real_int64 74471L);(* 4, 4 *) +(mk_real_int64 86460L),(mk_real_int64 11389L);(* 4, 4 *) +(mk_real_int64 51406L),(mk_real_int64 82210L);(* 4, 4 *) +(mk_real_int64 75708L),(mk_real_int64 65208L);(* 4, 4 *) +(mk_real_int64 98135L),(mk_real_int64 34037L);(* 4, 4 *) +(mk_real_int64 39190L),(mk_real_int64 78996L);(* 4, 4 *) +(mk_real_int64 49107L),(mk_real_int64 16033L);(* 4, 4 *) +(mk_real_int64 69675L),(mk_real_int64 32518L);(* 4, 4 *) +(mk_real_int64 66684L),(mk_real_int64 60987L);(* 4, 4 *) +(mk_real_int64 29622L),(mk_real_int64 95376L);(* 4, 4 *) +(mk_real_int64 71982L),(mk_real_int64 31397L);(* 4, 4 *) +(mk_real_int64 76535L),(mk_real_int64 67159L);(* 4, 4 *) +(mk_real_int64 99282L),(mk_real_int64 45440L);(* 4, 4 *) +(mk_real_int64 79249L),(mk_real_int64 28138L);(* 4, 4 *) +(mk_real_int64 29942L),(mk_real_int64 30472L);(* 4, 4 *) +(mk_real_int64 66247L),(mk_real_int64 61281L);(* 4, 4 *) +(mk_real_int64 58345L),(mk_real_int64 15456L);(* 4, 4 *) +(mk_real_int64 95305L),(mk_real_int64 51271L);(* 4, 4 *) +(mk_real_int64 14400L),(mk_real_int64 47427L);(* 4, 4 *) +(mk_real_int64 11883L),(mk_real_int64 48345L);(* 4, 4 *) +(mk_real_int64 85679L),(mk_real_int64 62332L);(* 4, 4 *) +(mk_real_int64 14500L),(mk_real_int64 13538L);(* 4, 4 *) +(mk_real_int64 49715L),(mk_real_int64 63773L);(* 4, 4 *) +(mk_real_int64 24934L),(mk_real_int64 19003L);(* 4, 4 *) +(mk_real_int64 29034L),(mk_real_int64 45872L);(* 4, 4 *) +(mk_real_int64 63945L),(mk_real_int64 76036L);(* 4, 4 *) +(mk_real_int64 43490L),(mk_real_int64 85662L);(* 4, 4 *) +(mk_real_int64 28675L),(mk_real_int64 76079L);(* 4, 4 *) +(mk_real_int64 97934L),(mk_real_int64 29301L);(* 4, 4 *) +(mk_real_int64 12105L),(mk_real_int64 15966L);(* 4, 4 *) +(mk_real_int64 12960L),(mk_real_int64 57569L);(* 4, 4 *) +(mk_real_int64 45266L),(mk_real_int64 77662L);(* 4, 4 *) +(mk_real_int64 67788L),(mk_real_int64 77907L);(* 4, 4 *) +(mk_real_int64 30650L),(mk_real_int64 43650L);(* 4, 4 *) +(mk_real_int64 20726L),(mk_real_int64 28404L);(* 4, 4 *) +(mk_real_int64 28118L),(mk_real_int64 29256L);(* 4, 4 *) +(mk_real_int64 59103L),(mk_real_int64 81275L);(* 4, 4 *) +(mk_real_int64 19696L),(mk_real_int64 19649L);(* 4, 4 *) +(mk_real_int64 26896L),(mk_real_int64 72997L);(* 4, 4 *) +(mk_real_int64 27444L),(mk_real_int64 45509L);(* 4, 4 *) +(mk_real_int64 30505L),(mk_real_int64 70246L);(* 4, 4 *) +(mk_real_int64 99103L),(mk_real_int64 84068L);(* 4, 4 *) +(mk_real_int64 66526L),(mk_real_int64 90210L);(* 4, 4 *) +(mk_real_int64 27790L),(mk_real_int64 72681L);(* 4, 4 *) +(mk_real_int64 86780L),(mk_real_int64 29226L);(* 4, 4 *) +(mk_real_int64 53336L),(mk_real_int64 85097L);(* 4, 4 *) +(mk_real_int64 45321L),(mk_real_int64 95916L);(* 4, 4 *) +(mk_real_int64 45385L),(mk_real_int64 38110L);(* 4, 4 *) +(mk_real_int64 27066L),(mk_real_int64 36836L);(* 4, 4 *) +(mk_real_int64 45748L),(mk_real_int64 71806L);(* 4, 4 *) +(mk_real_int64 43122L),(mk_real_int64 81283L);(* 4, 4 *) +(mk_real_int64 98275L),(mk_real_int64 10630L);(* 4, 4 *) +(mk_real_int64 27754L),(mk_real_int64 44688L);(* 4, 4 *) +(mk_real_int64 26932L),(mk_real_int64 62213L);(* 4, 4 *) +(mk_real_int64 75966L),(mk_real_int64 19025L);(* 4, 4 *) +(mk_real_int64 59182L),(mk_real_int64 34936L);(* 4, 4 *) +(mk_real_int64 11857L),(mk_real_int64 66595L);(* 4, 4 *) +(mk_real_int64 85460L),(mk_real_int64 42712L);(* 4, 4 *) +(mk_real_int64 58464L),(mk_real_int64 61197L);(* 4, 4 *) +(mk_real_int64 21136L),(mk_real_int64 77576L);(* 4, 4 *) +(mk_real_int64 60117L),(mk_real_int64 57968L);(* 4, 4 *) +(mk_real_int64 56869L),(mk_real_int64 91499L);(* 4, 4 *) +(mk_real_int64 75066L),(mk_real_int64 43019L);(* 4, 4 *) +(mk_real_int64 83934L),(mk_real_int64 63185L);(* 4, 4 *) +(mk_real_int64 45890L),(mk_real_int64 81585L);(* 4, 4 *) +(mk_real_int64 92582L),(mk_real_int64 90059L);(* 4, 4 *) +(mk_real_int64 37248L),(mk_real_int64 55636L);(* 4, 4 *) +(mk_real_int64 12386L),(mk_real_int64 49221L);(* 4, 4 *) +(mk_real_int64 71969L),(mk_real_int64 98473L);(* 4, 4 *) +(mk_real_int64 66313L),(mk_real_int64 31838L);(* 4, 4 *) +(mk_real_int64 73277L),(mk_real_int64 65575L);(* 4, 4 *) +(mk_real_int64 96714L),(mk_real_int64 77754L);(* 4, 4 *) +(mk_real_int64 70043L),(mk_real_int64 28399L);(* 4, 4 *) +(mk_real_int64 83240L),(mk_real_int64 78725L);(* 4, 4 *) +(mk_real_int64 20456L),(mk_real_int64 12672L);(* 4, 4 *) +(mk_real_int64 79644L),(mk_real_int64 65868L);(* 4, 4 *) +(mk_real_int64 25700L),(mk_real_int64 68170L);(* 4, 4 *) +(mk_real_int64 21689L),(mk_real_int64 85152L);(* 4, 4 *) +(mk_real_int64 34413L),(mk_real_int64 16776L);(* 4, 4 *) +(mk_real_int64 35562L),(mk_real_int64 84734L);(* 4, 4 *) +(mk_real_int64 60753L),(mk_real_int64 63745L);(* 4, 4 *) +(mk_real_int64 26323L),(mk_real_int64 94380L);(* 4, 4 *) +(mk_real_int64 26442L),(mk_real_int64 69121L);(* 4, 4 *) +(mk_real_int64 97686L),(mk_real_int64 56219L);(* 4, 4 *) +(mk_real_int64 64208L),(mk_real_int64 46238L);(* 4, 4 *) +(mk_real_int64 70742L),(mk_real_int64 59990L);(* 4, 4 *) +(mk_real_int64 94882L),(mk_real_int64 89296L);(* 4, 4 *) +(mk_real_int64 14299L),(mk_real_int64 94540L);(* 4, 4 *) +(mk_real_int64 61253L),(mk_real_int64 79114L);(* 4, 4 *) +(mk_real_int64 31455L),(mk_real_int64 56667L);(* 4, 4 *) +(mk_real_int64 59777L),(mk_real_int64 15208L);(* 4, 4 *) +(mk_real_int64 52729L),(mk_real_int64 43218L);(* 4, 4 *) +(mk_real_int64 11940L),(mk_real_int64 36714L);(* 4, 4 *) +(mk_real_int64 74359L),(mk_real_int64 69077L);(* 4, 4 *) +(mk_real_int64 43947L),(mk_real_int64 27233L);(* 4, 4 *) +(mk_real_int64 24807L),(mk_real_int64 65193L);(* 4, 4 *) +(mk_real_int64 72910L),(mk_real_int64 81578L);(* 4, 4 *) +(mk_real_int64 71084L),(mk_real_int64 19531L);(* 4, 4 *) +(mk_real_int64 49252L),(mk_real_int64 12333L);(* 4, 4 *) +(mk_real_int64 61311L),(mk_real_int64 10921L);(* 4, 4 *) +(mk_real_int64 30711L),(mk_real_int64 37021L);(* 4, 4 *) +(mk_real_int64 24516L),(mk_real_int64 74216L);(* 4, 4 *) +(mk_real_int64 41929L),(mk_real_int64 29653L);(* 4, 4 *) +(mk_real_int64 70985L),(mk_real_int64 36402L);(* 4, 4 *) +(mk_real_int64 63871L),(mk_real_int64 27148L);(* 4, 4 *) +(mk_real_int64 33899L),(mk_real_int64 55298L);(* 4, 4 *) +(mk_real_int64 85320L),(mk_real_int64 78893L);(* 4, 4 *) +(mk_real_int64 34956L),(mk_real_int64 55544L);(* 4, 4 *) +(mk_real_int64 21016L),(mk_real_int64 83104L);(* 4, 4 *) +(mk_real_int64 92439L),(mk_real_int64 89727L);(* 4, 4 *) +(mk_real_int64 94761L),(mk_real_int64 38609L);(* 4, 4 *) +(mk_real_int64 22272L),(mk_real_int64 46975L);(* 4, 4 *) +(mk_real_int64 31430L),(mk_real_int64 15548L);(* 4, 4 *) +(mk_real_int64 87078L),(mk_real_int64 23303L);(* 4, 4 *) +(mk_real_int64 28212L),(mk_real_int64 94766L);(* 4, 4 *) +(mk_real_int64 55287L),(mk_real_int64 58919L);(* 4, 4 *) +(mk_real_int64 27802L),(mk_real_int64 30533L);(* 4, 4 *) +(mk_real_int64 35955L),(mk_real_int64 32756L)(* 4, 4 *) +];; diff --git a/formal_lp/old/arith/tests/test_nat_arith.hl b/formal_lp/old/arith/tests/test_nat_arith.hl new file mode 100644 index 0000000..289fcb7 --- /dev/null +++ b/formal_lp/old/arith/tests/test_nat_arith.hl @@ -0,0 +1,197 @@ +needs "arith/prove_lp.hl";; +needs "arith_test_data25.hl";; +needs "arith_test_data20.hl";; +needs "arith_test_data15.hl";; +needs "arith_test_data10.hl";; +needs "arith_test_data5.hl";; + + + +let mul_op_num = `( * ):num->num->num` and + mul_op_real = `( * ):real->real->real` and + plus_op_num = `(+):num->num->num` and + plus_op_real = `(+):real->real->real` and + neg_op_real = `(--):real->real` and + amp_op_real = `(&):num->real`;; + + +let mul_data_int = map (fun (t1,t2) -> mk_binop mul_op_real t1 t2) data;; +let add_data_int = map (fun (t1,t2) -> mk_binop plus_op_real t1 t2) data;; +let sub_data_int = map (fun (t1,t2) -> mk_binop plus_op_real t1 (mk_comb(neg_op_real, t2))) data;; + + +let NUM_TO_NUMERAL = rand o concl o NUM_TO_NUMERAL_CONV;; + +let data2 = map (fun (t1,t2) -> (mk_comb(amp_op_real, NUM_TO_NUMERAL(rand t1)), + mk_comb(amp_op_real, NUM_TO_NUMERAL(rand t2)))) data;; + +let mul_data2 = map (fun (t1,t2) -> mk_binop mul_op_real t1 t2) data2;; +let add_data2 = map (fun (t1,t2) -> mk_binop plus_op_real t1 t2) data2;; +let sub_data2 = map (fun (t1,t2) -> mk_binop plus_op_real t1 (mk_comb(neg_op_real, t2))) data2;; + + + +(**********************************) + +(* data25 *) + + +(* 4: 10.645 + 8: 3.592 + *) +test 1 (map REAL_BITS_MUL_CONV) mul_data_int;; + +(* 4: 0.208 + 8: 0.132 +*) +test 1 (map REAL_BITS_ADD_CONV) add_data_int;; + +(* 4: 880 + 8: 0.524 +*) +test 1 (map REAL_BITS_ADD_CONV) sub_data_int;; + + + +(* 85.081 *) +test 1 (map REAL_INT_MUL_CONV) mul_data2;; + +(* 0.808 *) +test 1 (map REAL_INT_ADD_CONV) add_data2;; + +(* 2.588 *) +test 1 (map REAL_INT_ADD_CONV) sub_data2;; + + + +(**********************************) + +(* data20 *) + + +(* 4: 6.092 + 8: 2.256 + *) +test 1 (map REAL_BITS_MUL_CONV) mul_data_int;; + +(* 4: 0.176 + 8: 0.108 +*) +test 1 (map REAL_BITS_ADD_CONV) add_data_int;; + +(* 4: 0.728 + 8: 0.420 +*) +test 1 (map REAL_BITS_ADD_CONV) sub_data_int;; + + + + +(* 59.160 *) +test 1 (map REAL_INT_MUL_CONV) mul_data2;; + +(* 0.648 *) +test 1 (map REAL_INT_ADD_CONV) add_data2;; + +(* 2.392 *) +test 1 (map REAL_INT_ADD_CONV) sub_data2;; + + + + +(**********************************) + +(* data15 *) + + +(* 4: 3.880 + 8: 1.316 + *) +test 1 (map REAL_BITS_MUL_CONV) mul_data_int;; + +(* 4: 0.112 + 8: 0.096 +*) +test 1 (map REAL_BITS_ADD_CONV) add_data_int;; + +(* 4: 0.560 + 8: 0.340 +*) +test 1 (map REAL_BITS_ADD_CONV) sub_data_int;; + + +(* 16.081 *) +test 1 (map REAL_INT_MUL_CONV) mul_data2;; + +(* 0.492 *) +test 1 (map REAL_INT_ADD_CONV) add_data2;; + +(* 1.792 *) +test 1 (map REAL_INT_ADD_CONV) sub_data2;; + + + +(**********************************) + +(* data10 *) + + +(* 4: 1.292 + 8: 0.376 + *) +test 1 (map REAL_BITS_MUL_CONV) mul_data_int;; + +(* 4: 0.100 + 8: 0.064 +*) +test 1 (map REAL_BITS_ADD_CONV) add_data_int;; + +(* 4: 0.328 + 8: 0.220 +*) +test 1 (map REAL_BITS_ADD_CONV) sub_data_int;; + + + +(* 7.216 *) +test 1 (map REAL_INT_MUL_CONV) mul_data2;; + +(* 0.324 *) +test 1 (map REAL_INT_ADD_CONV) add_data2;; + +(* 0.876 *) +test 1 (map REAL_INT_ADD_CONV) sub_data2;; + + + + +(**********************************) + +(* data5 *) + + +(* 4: 0.428 + 8: 0.148 + *) +test 1 (map REAL_BITS_MUL_CONV) mul_data_int;; + +(* 4: 0.064 + 8: 0.052 +*) +test 1 (map REAL_BITS_ADD_CONV) add_data_int;; + +(* 4: 0.192 + 8: 0.132 +*) +test 1 (map REAL_BITS_ADD_CONV) sub_data_int;; + + + +(* 2.220 *) +test 1 (map REAL_INT_MUL_CONV) mul_data2;; + +(* 0.188 *) +test 1 (map REAL_INT_ADD_CONV) add_data2;; + +(* 0.568 *) +test 1 (map REAL_INT_ADD_CONV) sub_data2;; diff --git a/formal_lp/old/formal_interval/eval_interval.hl b/formal_lp/old/formal_interval/eval_interval.hl new file mode 100644 index 0000000..2de7765 --- /dev/null +++ b/formal_lp/old/formal_interval/eval_interval.hl @@ -0,0 +1,261 @@ +needs "../formal_lp/formal_interval/more_float.hl";; + +let x_var_num = `x:num` and + y_var_num = `y:num`;; + +let amp_op_real = `(&):num->real`;; + +(* Creates an interval approximation of the given decimal term *) +let mk_float_interval_decimal = + let DECIMAL' = SPEC_ALL DECIMAL in + fun pp decimal_tm -> + let n_tm, d_tm = dest_binary "DECIMAL" decimal_tm in + let n, d = dest_numeral n_tm, dest_numeral d_tm in + let n_int, d_int = mk_float_interval_num n, mk_float_interval_num d in + let int = float_interval_div pp n_int d_int in + let eq_th = INST[n_tm, x_var_num; d_tm, y_var_num] DECIMAL' in + norm_interval int eq_th;; + + +(* Unary interval operations *) +let unary_interval_operations = + let table = Hashtbl.create 10 in + let add = Hashtbl.add in + add table `--` (fun pp -> float_interval_neg); + add table `inv` float_interval_inv; + add table `sqrt` float_interval_sqrt; + add table `atn` float_interval_atn; + add table `acs` float_interval_acs; + table;; + + +(* Binary interval operations *) +let binary_interval_operations = + let table = Hashtbl.create 10 in + let add = Hashtbl.add in + add table `+` float_interval_add; + add table `-` float_interval_sub; + add table `*` float_interval_mul; + add table `/` float_interval_div; + table;; + + +(* Interval approximations of constants *) +let interval_constants = + let table = Hashtbl.create 10 in + let add = Hashtbl.add in + add table `pi` (fun pp -> pi_approx_array.(pp)); + table;; + + + +(* Type of an interval function *) +type interval_fun = + | Int_ref of int + | Int_var of term + | Int_const of thm + | Int_decimal_const of term + | Int_named_const of term + | Int_pow of int * interval_fun + | Int_unary of term * interval_fun + | Int_binary of term * interval_fun * interval_fun;; + + +(* Evaluates the given interval function at the point + defined by the given list of variables *) +let eval_interval_fun pp ifun vars refs = + let u_find = Hashtbl.find unary_interval_operations and + b_find = Hashtbl.find binary_interval_operations and + c_find = Hashtbl.find interval_constants in + let rec rec_eval f = + match f with + | Int_ref i -> List.nth refs i + | Int_var tm -> assoc tm vars + | Int_const th -> th + | Int_decimal_const tm -> mk_float_interval_decimal pp tm + | Int_named_const tm -> c_find tm pp + | Int_pow (n,f1) -> float_interval_pow_simple pp n (rec_eval f1) + | Int_unary (tm,f1) -> u_find tm pp (rec_eval f1) + | Int_binary (tm,f1,f2) -> b_find tm pp (rec_eval f1) (rec_eval f2) in + rec_eval ifun;; + + +(* Evaluates all sub-expressions involving constants in the given interval function *) +let eval_constants pp ifun = + let u_find = Hashtbl.find unary_interval_operations and + b_find = Hashtbl.find binary_interval_operations and + c_find = Hashtbl.find interval_constants in + let rec rec_eval f = + match f with + | Int_decimal_const tm -> Int_const (mk_float_interval_decimal pp tm) + | Int_named_const tm -> Int_const (c_find tm pp) + | Int_pow (n,f1) -> + (let f1_val = rec_eval f1 in + match f1_val with + | Int_const th -> Int_const (float_interval_pow_simple pp n th) + | _ -> Int_pow (n,f1_val)) + | Int_unary (tm,f1) -> + (let f1_val = rec_eval f1 in + match f1_val with + | Int_const th -> Int_const (u_find tm pp th) + | _ -> Int_unary (tm, f1_val)) + | Int_binary (tm,f1,f2) -> + (let f1_val, f2_val = rec_eval f1, rec_eval f2 in + match f1_val with + | Int_const th1 -> + (match f2_val with + | Int_const th2 -> Int_const (b_find tm pp th1 th2) + | _ -> Int_binary (tm, f1_val, f2_val)) + | _ -> Int_binary (tm, f1_val, f2_val)) + | _ -> f in + rec_eval ifun;; + + + +(**************************************) + +(* Builds an interval function from the given term expression *) +let rec build_interval_fun expr_tm = + if is_const expr_tm then + (* Constant *) + Int_named_const expr_tm + else if is_var expr_tm then + (* Variable *) + Int_var expr_tm + else + let ltm, r_tm = dest_comb expr_tm in + (* Unary operations *) + if is_const ltm then + (* & *) + if ltm = amp_op_real then + let n = dest_numeral r_tm in + Int_const (mk_float_interval_num n) + else + let r_fun = build_interval_fun r_tm in + Int_unary (ltm, r_fun) + else + (* Binary operations *) + let op, l_tm = dest_comb ltm in + let name = (fst o dest_const) op in + if name = "DECIMAL" then + (* DECIMAL *) + Int_decimal_const expr_tm + else if name = "real_pow" then + (* pow *) + let n = dest_small_numeral r_tm in + Int_pow (n, build_interval_fun l_tm) + else if name = "$" then + (* $ *) + Int_var expr_tm + else + let lhs = build_interval_fun l_tm and + rhs = build_interval_fun r_tm in + Int_binary (op, lhs, rhs);; + + +(* +let test_vars = [`x:real`, two_interval];; +let f = build_interval_fun `(&1 + &3 * pi) + sqrt (#3.13525238353 * x)`;; +let f2 = eval_constants pp f;; +eval_interval_fun pp f test_vars;; +eval_interval_fun pp f2 test_vars;; + +test 100 (eval_interval_fun pp f) test_vars;; +test 100 (eval_interval_fun pp f2) test_vars;; +*) + +(* Replaces the given subexpression with the given reference index + in all interval functions in the list. + Returns the number of replaces and a new list of interval functions *) +let replace_subexpr expr expr_index f_list = + let rec replace f = + if f = expr then + 1, Int_ref expr_index + else + match f with + | Int_pow (k, f1) -> + let c, f1' = replace f1 in + c, Int_pow (k, f1') + | Int_unary (tm, f1) -> + let c, f1' = replace f1 in + c, Int_unary (tm, f1') + | Int_binary (tm, f1, f2) -> + let c1, f1' = replace f1 in + let c2, f2' = replace f2 in + c1 + c2, Int_binary (tm, f1', f2') + | _ -> 0, f in + let cs, fs = unzip (map replace f_list) in + itlist (+) cs 0, fs;; + + + +let is_leaf f = + match f with + | Int_pow _ -> false + | Int_unary _ -> false + | Int_binary _ -> false + | _ -> true;; + +let find_and_replace_all f_list acc = + let rec find_and_replace f i f_list = + if is_leaf f then + f, (0, f_list) + else + let expr, (c, fs) = + match f with + | Int_pow (k, f1) -> find_and_replace f1 i f_list + | Int_unary (tm, f1) -> find_and_replace f1 i f_list + | Int_binary (tm, f1, f2) -> + let expr, (c1, fs) = find_and_replace f1 i f_list in + if c1 > 1 then expr, (c1, fs) else find_and_replace f2 i f_list + | _ -> f, (0, f_list) in + if c > 1 then expr, (c, fs) else f, replace_subexpr f i f_list in + + let rec iterate fs acc = + let i = length acc in + let expr, (c, fs') = find_and_replace (hd fs) i fs in + if c > 1 then iterate fs' (acc @ [expr]) else fs, acc in + + let rec iterate_all f_list ref_acc f_acc = + match f_list with + | [] -> f_acc, ref_acc + | f :: fs -> + let fs', acc' = iterate f_list ref_acc in + iterate_all (tl fs') acc' (f_acc @ [hd fs']) in + + iterate_all f_list acc [];; + + +let eval_interval_fun_list pp (f_list, refs) vars = + let rec eval_refs refs acc = + match refs with + | [] -> acc + | r :: rs -> + let v = eval_interval_fun pp r vars acc in + eval_refs rs (acc @ [v]) in + let rs = eval_refs refs [] in + map (fun f -> eval_interval_fun pp f vars rs) f_list;; + + +(* +let pp = 5;; +let test_vars = [`x:real`, two_interval];; +let test_expr1 = `x * x + (&3 * x) * x * x + &3 * x + &3 * x`;; +let test_expr2 = `(x * x) * (x * &2) + x * &2`;; +let subexpr1 = `x * x` and subexpr2 = `&3 * x`;; +let test_f1 = build_interval_fun test_expr1 and + test_f2 = build_interval_fun test_expr2;; +let sub1 = build_interval_fun subexpr1 and sub2 = build_interval_fun subexpr2;; + + +let v = find_and_replace_all [test_f1; test_f2] [];; + +eval_interval_fun_list pp v test_vars;; +map (fun f -> eval_interval_fun pp f test_vars []) [test_f1; test_f2];; + +(* 0.712 *) +test 100 (map (fun f -> eval_interval_fun pp f test_vars [])) [test_f1; test_f2];; +(* 0.432 *) +test 100 (eval_interval_fun_list pp v) test_vars;; +*) + diff --git a/formal_lp/old/formal_interval/interval_1d/interval.hl b/formal_lp/old/formal_interval/interval_1d/interval.hl new file mode 100644 index 0000000..0ec438f --- /dev/null +++ b/formal_lp/old/formal_interval/interval_1d/interval.hl @@ -0,0 +1,165 @@ + +(* port of interval.hl, + +This file gives a simple implementation of interval arithmetic, +together with the basic arithmetic operations on intervals. + +It has been incompletely implemented. + +For now, I am not implementing directed roundings. +However, McLaughlin implemented directed rounding several years ago: +See http://perso.ens-lyon.fr/nathalie.revol/mpfi.html + ~/Library/McLaughlinOCAML/ocaml/src/extensions/ocaml-mpfi/ + + *) + +module Interval =struct + + +let mk_interval (a,b) = { lo = a; hi = b; };; + +let string_of_interval x = Printf.sprintf "[%f;%f]" x.lo x.hi;; + +(* let izero = mk_interval(0.0,0.0);; *) +let zero = mk_interval(0.0,0.0);; +let one = mk_interval(1.0,1.0);; +let two = mk_interval(2.0,2.0);; +let four = mk_interval(4.0,4.0);; + +let is_zero x =(x.lo=0.0)&&(x.hi=0.0);; + +let pos x = if (x.lo >= 0.0) then x else + mk_interval(0.0, if (x.hi < 0.0) then 0.0 else x.hi );; + +let imax (x,y) = let t=max x.hi y.hi in mk_interval(t,t);; + +let imin (x,y) = let t = min x.lo y.lo in mk_interval(t,t);; + +let imin3(x,y,z) = imin(x,imin(y,z));; + +let imax3(x,y,z) = imax(x,imax(y,z));; + +let imax4(w,x,y,z) = imax(imax(w,x),imax(y,z));; + +let sup x = x.hi;; + +let inf x = x.lo;; + +let iabs x = max x.hi (~-. (x.lo));; + +let ilt x y = (x.hi < y.lo);; + +let igt x y = (x.lo > y.hi);; + +let ieq x y = (x.lo = y.lo && x.hi = y.hi);; + +(* need rounding modes -- BUG *) + + +(* start of bug section *) + +let up() = ( (* bug *) );; +let down() = ( (* bug *) );; +let nearest() = ( (* bug *) );; +let upadd x y = ( x +. y);; (* bug *) +let upmul x y = (x *. y);; +let updiv x y = (x /. y);; +let upsub x y = (x -. y);; +let downadd x y = (x +. y);; +let downmul x y = (x *. y);; +let downdiv x y = (x /. y);; +let downsub x y = (x -. y);; + +(* end of bug section *) + +let interval_of_string = + let dbl_min =1.0e-300 in + fun (s1,s2) -> + let ( - ) = (down(); downsub) in + let lo = float_of_string s1 - dbl_min in + let ( + ) = (up(); upadd) in + let hi = float_of_string s2 + dbl_min in + mk_interval(lo,hi);; + +let interval_of_single s = interval_of_string (s,s);; + +let ineg x = mk_interval(~-. (x.hi), ~-. (x.lo));; + +let iadd x y = mk_interval((down(); downadd x.lo y.lo), (up(); upadd x.hi y.hi));; + +let slowcases x y = + if (x.lo >= 0.0) then + (if (y.lo >= 0.0) then (x.lo,y.lo,x.hi,y.hi) + else if (y.hi <= 0.0) then (x.hi,y.lo,x.lo,y.hi ) else (x.hi,y.lo,x.hi,y.hi)) + else if (x.hi <= 0.0) then + (if (y.hi <= 0.0) then (x.hi,y.hi,x.lo,y.lo) + else if (y.lo >= 0.0) then (x.lo,y.hi,x.hi,y.lo) else (x.lo,y.hi,x.lo,y.lo)) + else + (if (y.lo >=0.0) then (x.lo,y.hi,x.hi,y.hi) + else if (y.hi <=0.0) then (x.hi,y.lo,x.lo,y.lo) + else (let lo = (down(); min (downmul x.hi y.lo) (downmul x.lo y.hi)) in + let hi = (up(); max (upmul x.hi y.hi) (upmul x.lo y.lo)) in (lo,1.0,hi,1.0)));; + +let slowmul x y = + let (xlo,ylo,xhi,yhi) = slowcases x y in + mk_interval((down(); downmul xlo ylo),(up(); upmul xhi yhi));; + +let _ = + let test_slowmul x y = + let all = [x.lo *. y.lo; x.hi *. y.lo; x.lo *. y.hi; x.hi *. y.hi] in + let m = end_itlist min all in + let M = end_itlist max all in + ( mk_interval(m,M) = slowmul x y) in + let xs = map mk_interval [(~-. 7.0, ~-. 5.0);(~-. 3.0,9.0);(11.0,13.0)] in + let ys = map mk_interval [(~-. 16.0, ~-. 14.0);(~-. 10.0,12.0); (18.0,22.0)] in + let test i j = test_slowmul (List.nth xs i) (List.nth ys j) or + failwith (Printf.sprintf "%d %d" i j) in + for i=0 to 2 do + for j= 0 to 2 do + let _ = test i j in (); + done; done;; + +let imul x y = if (x.lo > 0.0 && y.lo > 0.0) then + mk_interval((down(); downmul x.lo y.lo, (up(); upmul x.hi y.hi))) else slowmul x y;; + +let isub x y = mk_interval((down();downsub x.lo y.hi),(up(); upsub x.hi y.lo));; + +let isqrt = + let sqrt = Pervasives.sqrt in + fun x -> mk_interval( + (if (x.lo <= 0.0) then 0.0 else (down(); sqrt(x.lo))), + (if (x.hi <= 0.0) then 0.0 else (up(); sqrt(x.hi))));; + +let iatan x = + let _ = nearest() in + mk_interval((down(); atan x.lo),(up(); atan x.hi));; + +let iacos x = + let _ = nearest() in + mk_interval((down(); acos x.hi),(up(); acos x.lo));; + +let combine x y = mk_interval(inf(imin(x,y)),sup(imax(x,y)));; + +let rand01 = + let random_int_seed = 81757 in + let _ = Random.init(random_int_seed) in + fun _ -> Random.float(1.0);; + +let bounded_from_zero = + let dbl_epsilon = 1.0e-8 in + fun x-> (x.hi < ~-. dbl_epsilon or x.lo > dbl_epsilon);; + +let idiv x y = if (bounded_from_zero y) then + imul x (mk_interval((down(); downdiv 1.0 y.hi),(up(); updiv 1.0 y.lo))) + else raise Unstable;; + +(* overload arithmetic ops *) + +(* +let (+) = iadd;; +let (-) = isub;; +let (/) = idiv;; +let (~-) = ineg;; +*) + +end;; diff --git a/formal_lp/old/formal_interval/interval_1d/line_interval.hl b/formal_lp/old/formal_interval/interval_1d/line_interval.hl new file mode 100644 index 0000000..2fc4b03 --- /dev/null +++ b/formal_lp/old/formal_interval/interval_1d/line_interval.hl @@ -0,0 +1,109 @@ +(* port of lineInterval.cc. + Only the top section has been translated. The rest should be + automatically generated from HOL Light specs. + + This impements basic operations on the type line, + such as addition and scalar multiplication. + + *) + +flyspeck_needs "../formal_lp/formal_interval/interval_1d/interval.hl";; + +module Line_interval = struct + + open List;; + open Interval;; + + +(* general utilities *) +(* let iter6 = 0--5;; + + let table f = map f iter6;; + + let table2 f = map (fun i -> map (fun j-> f i j) iter6) iter6;; + + let rth m x i = if (i >=0) && (i < m) then List.nth x i else + failwith (Printf.sprintf "index %d not in 0..%d" i (m-1));; + + let mth x i = if (i >=0) && (i < 6) then List.nth x i else + failwith (Printf.sprintf "index %d not in 0..6" i );; + + let mth2 a i j = mth (mth a i) j;; + + let maxl xs = end_itlist max xs;; + + let minl xs = end_itlist min xs;; +*) +(* line interval proper *) + +(* +let partial line i = mth line.df i ;; +*) + +let mk_line(f1,df1) = { f = f1; df = df1};; + +let line_zero = + let z = zero in + mk_line(z,z);; + +let line_unit = + mk_line(one,zero);; + +let lmul = + let ( * ) = imul in + let ( + ) = iadd in + fun a b -> mk_line ( a.f * b.f, a.f * b.df + b.f * a.df );; + +let smul = + let ( * ) = imul in + fun a b -> mk_line ( a.f * b, a.df * b ) + +let ldiv = + let one = mk_interval(1.0,1.0) in + let ( * ) = imul in + let ( - ) = isub in + let ( / ) = idiv in + fun b a -> + let r = one/a.f in + let f = b.f * r in + let r2 = r * r in + mk_line ( f, (b.df * a.f - a.df * b.f) * r2 );; + +let ladd = + let ( + ) = iadd in + fun b a -> + mk_line(b.f + a.f, b.df + a.df);; + +let lsub = + let ( - ) = isub in + fun b a -> + mk_line(b.f - a.f, b.df - a.df);; + +let lneg = + let ineg = ineg in + fun a -> + mk_line(ineg a.f, ineg a.df);; + +let lsqrt = + let one = mk_interval(1.0,1.0) in + let two = mk_interval(2.0,2.0) in + let ( * ) = imul in + let ( / ) = idiv in + fun a -> + let f = isqrt a.f in + let rs = one / (two * f) in + mk_line(f, a.df * rs);; + +let latan = (* arctan (a/b) *) + let one = mk_interval(1.0,1.0) in + let ( * ) = imul in + let ( + ) = iadd in + let ( - ) = isub in + let ( / ) = idiv in + fun a b -> + let f = iatan (a.f/b.f) in + let rden = one/ (a.f * a.f + b.f * b.f) in + mk_line(f, rden * (a.df * b.f - b.df * a.f));; + + + end;; diff --git a/formal_lp/old/formal_interval/interval_1d/recurse.hl b/formal_lp/old/formal_interval/interval_1d/recurse.hl new file mode 100644 index 0000000..48c5071 --- /dev/null +++ b/formal_lp/old/formal_interval/interval_1d/recurse.hl @@ -0,0 +1,170 @@ +(* port of recurse.cc *) + +(* +This is the code that verifies a disjunct of nonlinear inequalities. +The are given as a list (tf:tfunction list). If tf = [f1;....;fk], then +the list represents the inequality (f1 < 0 \/ f2 < 0 .... fk < 0). + +The end user should only need to define a cell option, +and then call recursive_verifier, which recursively bisects the domain +until a partition of the domain is found on which verifier_cell gives +a pass on each piece of the partition. + +*) + +flyspeck_needs "../formal_lp/formal_interval/interval_1d/types.hl";; +flyspeck_needs "../formal_lp/formal_interval/interval_1d/report.hl";; +flyspeck_needs "../formal_lp/formal_interval/interval_1d/interval.hl";; +flyspeck_needs "../formal_lp/formal_interval/interval_1d/univariate.hl";; +flyspeck_needs "../formal_lp/formal_interval/interval_1d/line_interval.hl";; +flyspeck_needs "../formal_lp/formal_interval/interval_1d/taylor.hl";; + +module Recurse = struct + +open Interval;; +open Univariate;; +open Line_interval;; +open Taylor;; + +type cellOption = { + allow_sharp : bool; + mutable iteration_count : int; + iteration_limit : int; + recursion_depth : int; +};; + +(* cell verification is complex, and we use exceptions to + exit as soon as the status has been determined. *) + +type cell_status = + | Cell_pass + | Cell_counterexample + | Cell_inconclusive of (float * float * tfunction);; + +type result_tree = + | Result_false + | Result_pass of (float * float) + | Result_glue of result_tree * result_tree;; + + +exception Return of cell_status;; + + +let return c = raise (Return c);; + + +(* error checking and reporting functions *) + +let boolify _ = true;; + +let string_of_domain x = + Printf.sprintf "{%f}" x;; + +let string3 (x,z,s) = (string_of_domain x ^"\n"^ string_of_domain z ^ "\n" ^ s);; + +let report_current = boolify o Report.report_timed o string3;; + +let report_error = boolify o Report.report_error o string3;; + +let report_fatal = boolify o Report.report_fatal o string3;; + + +(* let t = [0.1;0.2;0.3;0.4;0.5;0.6] in report_error (t,t,"ok");; *) + +let periodic_count = + let end_count = ref 0 in + fun () -> + let _ = end_count := !end_count + 1 in + (0 = ( !end_count mod 80000));; + +let check_limit opt depth = + let _ = opt.iteration_count <- opt.iteration_count + 1 in + ( opt.iteration_count < opt.iteration_limit or opt.iteration_limit = 0 ) && + (depth < opt.recursion_depth);; + +let sgn x = if (x.lo > 0.0) then 1 else if (x.hi < 0.0) then -1 else 0;; + + +(* a bit tricky because unstable exceptions are common early on, + and evaluations are very expensive. + We don't want a single unstable disjunct to ruin everything. + + When boxes are small, then we throw away unstable disjuncts and continue w/o them. + When the boxes are still big, we return inconclusive to force a bisection. + + Starting with this procedure, we can throw an exception to return early, + as soon as we are able to determine the cell_status. All these exceptions + get caught at the last line of verify_cell. +*) + +let rec set_targets (x,z,tf) = + try ( + let target = evalf tf x z in + let _ = upper_bound target >= 0.0 or return Cell_pass in + [target, tf] + ) + with Unstable -> ( +(* let _ = (2.0 *. maxwidth <= opt.width_cutoff) or return (Cell_inconclusive (x, z, x0, z0, tf)) in []*) + return (Cell_inconclusive (x, z, tf)) + ); +;; + + +let rec delete_false acc tis = + if (tis=[]) then List.rev acc + else if (lower_bound (fst (hd tis)) > 0.0) then delete_false acc (tl tis) + else delete_false (hd tis::acc) (tl tis);; + + + +(* loop as long as monotonicity keeps making progress. *) + +let rec going_strong(x,z,tf,opt) = + let (y,w) = center_form (x,z) in + let maxwidth = w in + let tis = set_targets(x,z,tf) in + let epsilon_width = 1.0e-8 in + let _ = (maxwidth >= epsilon_width) or return + (if (opt.allow_sharp) then (Report.inc_corner_count(); Cell_pass) + else Cell_counterexample) in + let tis = delete_false [] tis in + let _ = (List.length tis > 0) or return Cell_counterexample in + (x, z, maxwidth, tis);; + +(* +This procedure is mostly guided by heuristics that don't require formal +verification. In particular, no justification is required for tossing out inequalities +(since they appear as disjuncts, we can choose which one to prove). + +Formal verification is required whenever a Cell_passes is issued, +and whenever the domain (x,z) is restricted. + +The record (x0,z0) of the current outer boundary must be restricted to (x,z) +whenever an inequality is tossed out. +*) + +let rec verify_cell (x,z,tf,opt) = + try ( + let _ = not(periodic_count ()) or report_current (x,z,"periodic report") in + let (x,z,maxwidth,tis) = going_strong(x,z,tf,opt) in + Cell_inconclusive (x,z,hd (map snd tis)); + ) + with Return c -> c;; + +let rec recursive_verifier (depth,x,z,tf,opt) = + let _ = check_limit opt depth or report_fatal(x,z,Printf.sprintf "check_limit: depth %d" depth) in + match verify_cell(x,z,tf,opt) with + | Cell_counterexample -> Result_false + | Cell_pass -> Result_pass(x,z) + | Cell_inconclusive(x,z,tf) -> + (let ( ++ ), ( / ) = up(); upadd, updiv in + let yj = (x ++ z) / 2.0 in + let r1 = recursive_verifier(depth + 1, x, yj, tf, opt) in + if r1 = Result_false then Result_false else + let r2 = recursive_verifier(depth + 1, yj, z, tf, opt) in + if r2 = Result_false then Result_false else + Result_glue (r1, r2) + );; + + + end;; diff --git a/formal_lp/old/formal_interval/interval_1d/report.hl b/formal_lp/old/formal_interval/interval_1d/report.hl new file mode 100644 index 0000000..a4776bc --- /dev/null +++ b/formal_lp/old/formal_interval/interval_1d/report.hl @@ -0,0 +1,40 @@ +(* port of error.cc + basic procedures to print messages to the standard output + and to count errors. + +*) + +module Report = struct + +let time_string () = Printf.sprintf "time(%.0f)" (Sys.time());; + +let (get_error_count,reset_error_count,inc_error_count) = + let error_count = ref 0 in + ((fun _ -> !error_count),(fun _ -> error_count := 0), + (fun _ -> error_count:= !error_count + 1));; + +let (get_corner_count,reset_corner_count,inc_corner_count) = + let corner_count = ref 0 in + ((fun _ -> !corner_count),(fun _ -> corner_count := 0), + (fun _ -> corner_count:= !corner_count + 1));; + +let diagnostic_string () = + let d = get_error_count() in + if (d>0) then Printf.sprintf "(errors %d)" (get_error_count()) else "(no errors)";; + +let report s = + Format.print_string s; Format.print_newline(); Format.print_flush();; + +let report_timed s = report (s^" "^(time_string()));; + +let report_error = + let error_max = 25 in (* was 200, recurse.cc had a separate counter limit at 25 *) + fun s -> + let ec = get_error_count() in + (inc_error_count(); report_timed (Printf.sprintf "error(%d) --\n%s" ec s); + Pervasives.ignore(get_error_count() < error_max or raise Fatal));; + +let report_fatal s = + ( inc_error_count(); report_timed ("error --\n"^s); raise Fatal);; + +end;; diff --git a/formal_lp/old/formal_interval/interval_1d/taylor.hl b/formal_lp/old/formal_interval/interval_1d/taylor.hl new file mode 100644 index 0000000..efbcd6d --- /dev/null +++ b/formal_lp/old/formal_interval/interval_1d/taylor.hl @@ -0,0 +1,230 @@ +(* port of taylor functions, taylor interval *) + +(* +The first part of the file implements basic operations on type taylor_interval. + +Then a type tfunction is defined that represents a twice continuously +differentiable function of six variables. It can be evaluated, which +is the taylor_interval data associated with it. + +Sometimes a tfunction f is used to represent an inequality f < 0. +(See recurse.hl. +*) + + +module Taylor = struct + +open Interval;; +open Univariate;; +open Line_interval;; + + +(* general utilities *) + + +let center_form(x,z) = + let ( + ) , ( - ), ( / ) = up(); upadd,upsub,updiv in + let y = if x = z then x else (x + z) / 2.0 in + let w = max (z - y) (y - x) in + let _ = (w >= 0.0) or failwith "centerform" in + (y,w);; + +(* start with taylor interval operations *) + +let make_taylor_interval (l1,w1,dd1) = {l = l1; w = w1; dd=dd1;};; + +let ti_add (ti1,ti2) = + let _ = (ti1.w = ti2.w) or failwith ("width mismatch in ti") in + make_taylor_interval( ladd ti1.l ti2.l,ti1.w, iadd ti1.dd ti2.dd);; + +let ti_sub (ti1,ti2) = + let _ = (ti1.w = ti2.w) or failwith ("width mistmatch in ti") in + make_taylor_interval( lsub ti1.l ti2.l, ti1.w, isub ti1.dd ti2.dd );; + +let ti_scale (ti,t) = + make_taylor_interval( smul ti.l t, ti.w, imul ti.dd t );; + + + +let taylor_error ti = + let ( + ), ( * ) , ( / )= up(); upadd, upmul, updiv in + (ti.w * ti.w * iabs ti.dd) / 2.0;; + +let upper_bound ti = + let e = taylor_error ti in + let ( + ), ( * ) = up(); upadd, upmul in + ti.l.f.hi + ti.w * iabs ti.l.df + e;; + +let lower_bound ti = + let e = taylor_error ti in + let ( + ), ( * ),( - ) = down(); downadd,downmul,downsub in + ti.l.f.lo - e + ( ~-. (ti.w)) * iabs ti.l.df;; + +(* t + List.fold_left2 (fun a b c -> a + ( ~-. b) * iabs c) 0.0 ti.w ti.l.df;; *) + +let upper_partial ti = + let ( + ), ( * ) = up(); upadd,upmul in + let err = ti.w * (max ti.dd.hi (~-. (ti.dd.lo))) in + err + Interval.sup ( ti.l.df );; + +let lower_partial ti = + let ( + ), ( * ), ( - ) = down();downadd,downmul,downsub in + let err = ti.w * min ti.dd.lo (~-. (ti.dd.hi)) in + Interval.inf ( ti.l.df ) + err;; + + + + +let ti_mul (ti1, ti2) = + let _ = (ti1.w = ti2.w) or failwith ("width mistmatch in ti") in + let f = mk_interval (lower_bound ti1, upper_bound ti1) and + g = mk_interval (lower_bound ti2, upper_bound ti2) and + df = mk_interval (lower_partial ti1, upper_partial ti1) and + dg = mk_interval (lower_partial ti2, upper_partial ti2) and + ( + ), ( * ) = iadd, imul in + make_taylor_interval( lmul ti1.l ti2.l, ti1.w, + ti1.dd * g + two * df * dg + f * ti2.dd);; + + +(* primitive A *) + +type primitiveA = { + hfn : float -> line; + second : float -> float -> interval; +};; + +let make_primitiveA (h1,s1) = {hfn = h1; second = s1; };; + +let unitA = + make_primitiveA ( + (fun y -> line_unit), + (fun x z -> zero) +);; + +let evalf4A pA w x y z = + make_taylor_interval( + pA.hfn y, + w, + pA.second x z + );; + +let line_estimateA pA y = pA.hfn y;; + +(* primitive U *) + +type primitiveU = { + uv: univariate; +};; + +let mk_primitiveU uv1 = { uv = uv1; };; + +let line_estimateU p y = + let y0 = y in + let t = mk_interval(y0,y0) in + let d = eval p.uv t 1 in + mk_line (eval p.uv t 0, d);; + +let evalf4U p w x y z = + let t = mk_interval(x,z) in + make_taylor_interval( + line_estimateU p y, + w, + eval p.uv t 2 + );; + +type tfunction = + | Prim_a of primitiveA + | Uni of primitiveU + | Plus of tfunction * tfunction + | Minus of tfunction * tfunction + | Product of tfunction * tfunction + | Scale of tfunction * interval + | Uni_compose of univariate * tfunction + | Composite of tfunction * tfunction;; + +let unit = Prim_a unitA;; + +let x1 = Uni (mk_primitiveU ux);; + + +(* This is one of the most difficult functions in the interval code. + It uses the chain rule to compute the second partial derivatives with + respect to x(i) x(j), of a function composition + + F(x1,...,x6) = f(g1(x1,...x6),g2(x1,...x6),...,g6(x1,...x6)). + + (F i j) = sum {k m} (f k m) (gk i) (gm j) + sum {r} (f r) (gr i j). + + Fast performance of this function is very important, especially + when many of the functions g* are constant. + There is a bit of imperative programming here, in computing the sums. + + Note that ( + ) and ( * ) have different types in various subsections. +*) + +let eval_composite = + fun hdr p w -> + (* wide and narrow ranges of p *) + let (aw,bw) = lower_bound p, upper_bound p in + let (a,b) = p.l.f.lo, p.l.f.hi in + (* wide and narrow widths from a to b *) + let (u,wu,wf) = + let ( + ),( - ),( / ) = up();upadd,upsub,updiv in + let u = (a + b) / 2.0 in + let wu = max (bw - u) (u - aw) in + let wf = max (b - u) (u - a) in + (u, wu, wf) in + let (fu:taylor_interval) = hdr wu aw u bw in + let fpy = + let t = make_taylor_interval(fu.l,wf,fu.dd) in + mk_line ( + mk_interval(lower_bound t, upper_bound t), + mk_interval(lower_partial t, upper_partial t)) in + (* use chain rule imperatively to compute narrow first derivative *) + let lin = + let ( * ) = imul in + mk_line (fpy.f, fpy.df * p.l.df) in + (* second derivative init *) + let fW_partial = mk_interval(lower_partial fu, upper_partial fu) in + let pW_partial = mk_interval(lower_partial p, upper_partial p) in + let dcw_list = + let ( + ) = iadd in + let ( * ) = imul in + fW_partial * p.dd + fu.dd * pW_partial * pW_partial in + make_taylor_interval(lin,w,dcw_list);; + +let rec evalf4 tf w x y z = match tf with + | Prim_a p -> evalf4A p w x y z + | Uni p -> evalf4U p w x y z + | Plus (tf1,tf2) -> ti_add(evalf4 tf1 w x y z, evalf4 tf2 w x y z) + | Minus (tf1, tf2) -> ti_sub(evalf4 tf1 w x y z, evalf4 tf2 w x y z) + | Product (tf1, tf2) -> ti_mul(evalf4 tf1 w x y z, evalf4 tf2 w x y z) + | Composite(h,g) -> eval_composite (evalf4 h) (evalf4 g w x y z) w + | Scale (tf,t) -> ti_scale ((evalf4 tf w x y z),t) + | Uni_compose (uf,tf) -> + evalf4 (Composite(Uni (mk_primitiveU uf),tf)) w x y z;; + +let evalf tf x z = + let (y,w) = center_form (x,z) in + evalf4 tf w x y z;; + +let line_estimate_composite = + let ( * ) = imul in + fun h p -> + let (a,b) = (p.f.lo, p.f.hi) in + let fN = evalf h a b in + let fN_partial = mk_interval(lower_partial fN, upper_partial fN) in + mk_line (fN.l.f, fN_partial * p.df);; + +let rec line_estimate tf y = match tf with + | Prim_a p -> line_estimateA p y + | Uni p -> line_estimateU p y + | Plus (p,q) -> ladd (line_estimate p y) (line_estimate q y) + | Minus (p,q) -> lsub (line_estimate p y) (line_estimate q y) + | Product (p,q) -> lmul (line_estimate p y) (line_estimate q y) + | Scale (p,t) -> smul (line_estimate p y) t + | Uni_compose (uf,tf) -> + line_estimate (Composite(Uni (mk_primitiveU uf),tf)) y + | Composite(h,g) -> line_estimate_composite h (line_estimate g y);; + +end;; diff --git a/formal_lp/old/formal_interval/interval_1d/test1d.hl b/formal_lp/old/formal_interval/interval_1d/test1d.hl new file mode 100644 index 0000000..8db226e --- /dev/null +++ b/formal_lp/old/formal_interval/interval_1d/test1d.hl @@ -0,0 +1,258 @@ +needs "../formal_lp/formal_interval/interval_1d/recurse.hl";; +needs "../formal_lp/formal_interval/second_approx.hl";; +needs "../formal_lp/formal_interval/verifier.hl";; + + +open Taylor;; +open Univariate;; +open Interval;; +open Recurse;; + +let x_var_real = `x:real` and + add_op_real = `(+):real->real->real` and + sub_op_real = `(-):real->real->real` and + mul_op_real = `( * ):real->real->real` and + div_op_real = `(/):real->real->real` and + neg_op_real = `(--):real->real`;; + +let taylor_interval_div_alt pp th1 th2 = + let domain_th, _, _ = dest_taylor_interval_th th1 in + let rhs = taylor_interval_compose pp eval_taylor_inv (fun _ _ -> th2) in + taylor_interval_mul pp th1 (rhs domain_th);; + + +let mk_formal_binop taylor_binop arg1 arg2 = + fun pp domain_th -> + let lhs = arg1 pp domain_th and + rhs = arg2 pp domain_th in + taylor_binop pp lhs rhs;; + + +let rec eval_interval pp expr_tm = + let ltm, r_tm = dest_comb expr_tm in + if is_comb ltm then + let op, l_tm = dest_comb ltm in + let l_th = eval_interval pp l_tm in + let r_th = eval_interval pp r_tm in + if op = plus_op_real then + float_interval_add pp l_th r_th + else if op = mul_op_real then + float_interval_mul pp l_th r_th + else if op = div_op_real then + float_interval_div pp l_th r_th + else if op = minus_op_real then + float_interval_sub pp l_th r_th + else + failwith ("Unknown operation: " ^ (fst o dest_const) op) + else + if ltm = neg_op_real then + let r_th = eval_interval pp r_tm in + float_interval_neg r_th + else + mk_float_interval_num (dest_numeral r_tm);; + + +let rat_term_of_term tm = + let th0 = REWRITE_CONV[DECIMAL] tm in + let th1 = (REAL_RAT_REDUCE_CONV o rand o concl) th0 in + GEN_REWRITE_RULE RAND_CONV [th1] th0;; + + +let float_of_term tm = + (float_of_num o rat_of_term o rand o concl o rat_term_of_term) tm;; + + +let interval_of_term pp tm = + let eq_th = rat_term_of_term tm in + let int_th = eval_interval pp (rand (concl eq_th)) in + REWRITE_RULE[SYM eq_th] int_th;; + + +let rec mk_taylor_functions pp expr_tm = + (* Variable *) + if is_var expr_tm then + if (expr_tm = x_var_real) then x1, (fun pp -> eval_taylor_x) + else failwith "mk_taylor_functions: only x variable is allowed" + else + (* Constant *) + if is_const expr_tm then + let name,_ = dest_const expr_tm in + if name = "inv" then + Uni (mk_primitiveU uinv), eval_taylor_inv + else if name = "sqrt" then + Uni (mk_primitiveU usqrt), eval_taylor_sqrt + else if name = "atn" then + Uni (mk_primitiveU uatan), eval_taylor_atn + else + failwith ("mk_taylor_functions: unknown constant: "^name) + else + (* Number *) + try + let rat_th = rat_term_of_term expr_tm in + let rat_tm = rand (concl rat_th) in + let n = (float_of_num o rat_of_term) rat_tm in + let int_th = + let th0 = eval_interval pp rat_tm in + REWRITE_RULE[SYM rat_th] th0 in + Scale (unit, mk_interval (n, n)), (fun pp -> eval_taylor_const_interval int_th) + with Failure _ -> + (* Combination *) + let lhs, r_tm = dest_comb expr_tm in + let r, r2 = mk_taylor_functions pp r_tm in + (* Unary operations *) + if lhs = neg_op_real then + Scale (r, ineg one), (fun pp -> eval_taylor_x) + else + (* Composite *) + try + let l, l2 = mk_taylor_functions pp lhs in + if r_tm = x_var_real then + l, l2 + else + Composite (l,r), (fun pp domain_th -> taylor_interval_compose pp l2 r2 domain_th) + with Failure _ -> + (* Binary operations *) + if is_comb lhs then + let op, l_tm = dest_comb lhs in + let l, l2 = mk_taylor_functions pp l_tm in + if op = add_op_real then + Plus (l,r), mk_formal_binop taylor_interval_add l2 r2 + else if op = sub_op_real then + Minus (l,r), mk_formal_binop taylor_interval_sub l2 r2 + else if op = mul_op_real then + Product (l,r), mk_formal_binop taylor_interval_mul l2 r2 + else if op = div_op_real then + Product (l, Uni_compose (uinv,r)), mk_formal_binop taylor_interval_div_alt l2 r2 + else + failwith ("mk_taylor_functions: unknown binary operation "^string_of_term op) + else + failwith ("mk_taylor_functions: error: "^string_of_term lhs);; + +(**********************************) + +let rec result_size r = + match r with + | Result_false -> failwith "False result detected" + | Result_glue (r1, r2) -> result_size r1 + result_size r2 + | Result_pass _ -> 1;; + + + +let atan1 = `let P00, P01, P02 = #4.26665376811246382, #3.291955407318148, #0.281939359003812 in + let Q00, Q01 = #4.26665376811354027, #4.714173328637605 in + let x1 = x * x in + let x2 = x1 * x1 in + x * (x1 * P01 + x2 * P02 + P00) / (x1 * Q01 + x2 + Q00) - atn x - #0.001`;; +let atan1_tm = (rand o concl o REPEATC let_CONV) atan1;; + +(* tan(pi/16) = 0.198912367379658 *) + +let atn1_f, atn1_formal = mk_taylor_functions 15 atan1_tm;; +let result = + let opt = { + allow_sharp = false; + iteration_count = 0; + iteration_limit = 0; + recursion_depth = 20 + } in + recursive_verifier (0, 0.0, 0.2, atn1_f, opt);; + +result_size result;; + + +let prove_result pp formal_f result lo_tm hi_tm = + let pass_counter = ref 0 in + let r_size = result_size result in + let rec rec_prove result lo_tm hi_tm = + let domain_th = mk_center_domain pp lo_tm hi_tm in + match result with + | Result_false -> failwith "False result" + | Result_pass _ -> + pass_counter := !pass_counter + 1; + let th0 = taylor_cell_pass pp (formal_f pp domain_th) in + let _ = report (sprintf "Result_pass: %d/%d" !pass_counter r_size) in + th0 + | Result_glue (r1, r2) -> + let _, y_tm, _, _ = dest_cell_domain (concl domain_th) in + let th1 = rec_prove r1 lo_tm y_tm and + th2 = rec_prove r2 y_tm hi_tm in + cell_pass_glue th1 th2 in + rec_prove result lo_tm hi_tm;; + + + +let lo_tm, hi_tm = mk_float 0 min_exp, mk_float 2 (min_exp - 1);; +prove_result 15 atn1_formal result lo_tm hi_tm;; + + +let CELL_PASS_IMP = prove + (`cell_pass f (lo, hi) ==> + interval_arith x (lo, w1) ==> + interval_arith z (w2, hi) ==> + !t. t IN real_interval [x, z] ==> f t < &0`, + REWRITE_TAC[cell_pass; interval_arith; IN_REAL_INTERVAL] THEN REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REAL_ARITH_TAC);; + + +let prove_ineq1d pp expr_tm lo_tm hi_tm = + let f, formal_f = mk_taylor_functions pp expr_tm in + let lo, hi = float_of_term lo_tm, float_of_term hi_tm in + let lo_int, hi_int = interval_of_term pp lo_tm, interval_of_term pp hi_tm in + let lo1_tm = (fst o dest_pair o rand o concl) lo_int and + hi1_tm = (snd o dest_pair o rand o concl) hi_int in + let _ = report (sprintf "Starting verification from %f to %f" lo hi) in + + let result = + let opt = { + allow_sharp = false; + iteration_count = 0; + iteration_limit = 0; + recursion_depth = 50 + } in + recursive_verifier (0, lo, hi, f, opt) in + + let th0 = prove_result pp formal_f result lo1_tm hi1_tm in + REWRITE_RULE[] (MATCH_MP (MATCH_MP (MATCH_MP CELL_PASS_IMP th0) lo_int) hi_int);; + + +prove_ineq1d 10 `atn x - x` `#0.001` `#30`;; + + + + +result_size result;; +let domain_th = mk_center_domain 10 (mk_float 175 (min_exp - 3)) (mk_float 2 (min_exp - 1));; +let th1 = atn1_formal 10 domain_th;; +test 1 (atn1_formal 10) domain_th;; +evalf atn1_f 0.0 0.025;; +eval_taylor_f_bounds 10 th1;; + + + +(**********************************) + +let pp = 10;; +let domain_th = mk_center_domain pp (mk_float 1 (min_exp - 1)) (mk_float 8 (min_exp - 1));; + +let f, f2 = mk_taylor_functions 10 `atn x / x - &1 / &3`;; + + + + + +evalf f 0.1 0.8;; +f2 pp domain_th;; + + +let opt = { + allow_sharp = false; + iteration_count = 0; + iteration_limit = 0; + recursion_depth = 100 +} in + recursive_verifier (0, 0.1, 0.8, f, opt);; + + +let int1 = f2 pp (mk_center_domain pp (mk_float 1 49) (mk_float 14375 45));; +eval_taylor_f_bounds pp int1;; diff --git a/formal_lp/old/formal_interval/interval_1d/types.hl b/formal_lp/old/formal_interval/interval_1d/types.hl new file mode 100644 index 0000000..7ceac66 --- /dev/null +++ b/formal_lp/old/formal_interval/interval_1d/types.hl @@ -0,0 +1,43 @@ + + +exception Unstable;; (* generally thrown when there is a divide by zero *) + +exception Fatal;; (* generally indicates an uncorrected bug *) + +(* represents a closed interval [lo,hi] of the real line *) + +type interval = { + lo : float; + hi : float; +};; + +(* represents a function u:real->real, its derivative du, and 2nd derivative *) + +type univariate = { + u : interval -> interval; + du : interval -> interval; + ddu : interval -> interval; +};; + +(* represents the value f of a function and its derivative at some point y *) + +type line = { + f : interval; + df : interval; +};; + +(* + represents approximation data for a function f on a rectangular domain [x,z]. + l gives the value and the derivative of f at some point y in the domain. + dd gives interval bounds on the second derivative over the entire domain. + w i is an upper bound on widths (z - y) and (y - x). +*) + +type taylor_interval = { + l : line; + w : float; + dd : interval; +};; + + + diff --git a/formal_lp/old/formal_interval/interval_1d/univariate.hl b/formal_lp/old/formal_interval/interval_1d/univariate.hl new file mode 100644 index 0000000..82be06d --- /dev/null +++ b/formal_lp/old/formal_interval/interval_1d/univariate.hl @@ -0,0 +1,98 @@ +(* port of univariate.cc + a univariate represents a function u:real->real. + its first derivative du:real->real + and its second derivative ddu;real->real. + + For example, if the function is x |-> x, + its derivative is x |-> 1, + and second derivative is x |-> 0, + which is implemented as ux1. + + We give a few other examples, sqrt, 1/x, atan. + + *) + +module Univariate = struct + +open Interval;; + +let eval uni x = function + | 0 -> uni.u x + | 1 -> uni.du x + | _ -> uni.ddu x;; + +let mk_univariate (u1,du1,ddu1) = { u = u1; du = du1; ddu = ddu1; };; + +let raise_zero x = bounded_from_zero x or raise Unstable ;; + +(* here are a couple of examples *) + +let ux = + mk_univariate( + (fun x -> x), + (fun x -> one), + (fun x-> zero) + );; + +let usqrt = + let ( / ) = idiv in + let ( * ) = imul in + mk_univariate( + isqrt, + + (fun x -> + let _ = raise_zero x in + one / (two * isqrt x)), + + (fun x -> + let _ = raise_zero x in + ineg (one / (four * x * isqrt x))) +);; + +let uinv = + let ( / ) = idiv in + let ( * ) = imul in + mk_univariate( + (fun x -> + let _ = raise_zero x in + one / x), + + (fun x -> + let _ = raise_zero x in + ineg (one / ( x * x))), + + (fun x -> + let _ = raise_zero x in + two / ( x * x * x)) + );; + +let uatan = + let ( / ) = idiv in + let ( * ) = imul in + let ( + ) = iadd in + mk_univariate( + iatan, + + (fun x -> + one / (one + x * x)), + + (fun x -> + let t = one + x * x in + ineg (two * x/ (t * t))) + );; + + +let uacos = + let ( / ) = idiv in + let ( * ) = imul in + let ( - ) = isub in + mk_univariate( + iacos, + (fun x -> + ineg (one / isqrt (one - x * x))), + (fun x -> + let t = one - x * x in + ineg (x / isqrt (t * t * t))) + );; + +end;; diff --git a/formal_lp/old/formal_interval/interval_m/function_data.hl b/formal_lp/old/formal_interval/interval_m/function_data.hl new file mode 100644 index 0000000..f2f5a0a --- /dev/null +++ b/formal_lp/old/formal_interval/interval_m/function_data.hl @@ -0,0 +1,338 @@ +(* file combining all the function data *) + +(* + +This gives the verification of a sample inequality drawn from ineq.hl. + +*) + + +flyspeck_needs "../formal_lp/formal_interval/interval_m/recurse.hl";; +flyspeck_needs "../formal_lp/formal_interval/interval_m/verifier.hl";; + + +open Interval;; +open Univariate;; +open Line_interval;; +open Taylor;; +open Recurse;; + +(********************************) + +let delta_x_poly = + let tm = (rand o concl o SPEC_ALL) Sphere.delta_x in + expr_to_vector_fun tm;; + +let delta_y_poly = + let tm = (rand o concl o SPEC_ALL o REWRITE_RULE[Sphere.delta_x]) Sphere.delta_y in + expr_to_vector_fun tm;; + +let delta_x4_poly = + let tm = (rand o concl o SPEC_ALL) Sphere.delta_x4 in + expr_to_vector_fun tm;; + +let delta_y4_poly = + let tm = (rand o concl o SPECL[`y1*y1`; `y2*y2`; `y3*y3`; `y4*y4`; `y5*y5`; `y6*y6`]) Sphere.delta_x4 in + expr_to_vector_fun tm;; + + +let tf_delta_x = build_taylor pp delta_x_poly;; +let tf_delta_y = build_taylor pp delta_y_poly;; +let tf_delta_x4 = build_taylor pp delta_x4_poly;; +let tf_delta_y4 = build_taylor pp delta_y4_poly;; + +let x = replicate 1.0 8 and + y = replicate 2.0 8 and + z = replicate 3.0 8 and + w = replicate 1.0 8;; + +evalf4 tf_delta_x w x y z;; +evalf4 tf_delta_y w x y z;; +evalf4 tf_delta_x4 w x y z;; + + +(************************************) + + +let four_y1_delta_y_poly = + let x_var, tm = dest_abs delta_y_poly in + mk_abs (x_var, mk_binop mul_op_real `&4` (mk_binop mul_op_real `(x:real^6)$1 * x$1` tm));; + +let neg_delta_y4_poly = + let x_var, tm = dest_abs delta_y4_poly in + mk_abs (x_var, mk_comb (neg_op_real, tm));; + +let four_y1_delta_y = build_taylor pp four_y1_delta_y_poly;; +let neg_delta_y4 = build_taylor pp neg_delta_y4_poly;; +dih_y_taylor;; + +let pi_taylor = build_taylor 10 `\x:real^1. pi`;; +let neg_pi_taylor = build_taylor 10 `\x:real^1. --pi`;; +let pi2_taylor = build_taylor 10 `\x:real^1. pi / &2`;; + + +let f = tf_product x1 (tf_product x1 x3);; +let f = Uni_compose (uinv, x2);; +evalf0 f 0 x y;; +evalf0 f 2 x y;; + +(* dih_y *) +let dih_y_taylor = + let denom = Uni_compose (uinv, Uni_compose (usqrt, four_y1_delta_y)) in + Plus (pi2_taylor, Uni_compose (uatan, tf_product neg_delta_y4 denom));; + + +(* sol_y *) + +Sphere.sol_y;; +let sol_y_taylor = + let dih1 = dih_y_taylor and + dih2 = Composite (dih_y_taylor, x2, x3, x1, x5, x6, x4, unit, unit) and + dih3 = Composite (dih_y_taylor, x3, x1, x2, x6, x4, x5, unit, unit) in + Plus (dih1, Plus (dih2, Plus (dih3, neg_pi_taylor)));; + + +let pi_val= 3.1415926535897932;; +let sol0_val = 0.5512855984325308;; +let const1_val = sol0_val /. pi_val;; +let const1_plus1 = const1_val +. 1.0;; + + +let ly_taylor = build_taylor pp `\x:real^1. #2.52 / #0.52 - x$1 * inv(#0.52)`;; +let lnazim_y_taylor = + tf_product ly_taylor dih_y_taylor;; + +Sphere.taum;; +let taum_taylor = + let azim1 = lnazim_y_taylor and + azim2 = Composite (lnazim_y_taylor, x2, x3, x1, x5, x6, x4, unit, unit) and + azim3 = Composite (lnazim_y_taylor, x3, x1, x2, x6, x4, x5, unit, unit) in + let f1 = Scale (sol_y_taylor, mk_interval (const1_plus1, const1_plus1)) and + f2 = Plus (azim1, Plus (azim2, azim3)) in + Plus (f1, Scale (f2, mk_interval (~-.const1_val, ~-.const1_val)));; + + +(*********************) + +let rec count_f0_flags r = + match r with + | Result_false _ -> failwith "False result" + | Result_glue (_,_,_,r1,r2) -> count_f0_flags r1 + count_f0_flags r2 + | Result_pass (_,flag,_,_) -> if flag then 1 else 0 + | Result_pass_mono _ -> 0;; + +let rec all_mono r = + match r with + | Result_false _ -> failwith "False result" + | Result_glue (mono,_,_,r1,r2) -> List.concat mono @ all_mono r1 @ all_mono r2 + | Result_pass (mono,_,_,_) -> List.concat mono + | Result_pass_mono _ -> [];; + +let rec all_pass r = + match r with + | Result_false _ -> failwith "False result" + | Result_glue (_,_,_,r1,r2) -> all_pass r1 @ all_pass r2 + | Result_pass (_,_,x,z) -> [x,z] + | Result_pass_mono _ -> [];; + + +let rec count_pass_mono r = + match r with + | Result_false _ -> failwith "False result" + | Result_glue (_,_,_,r1,r2) -> count_pass_mono r1 + count_pass_mono r2 + | Result_pass (_,_,_,_) -> 0 + | Result_pass_mono _ -> 1;; + +let rec count_convex r = + match r with + | Result_false _ -> failwith "False result" + | Result_glue (_,_,flag,r1,r2) -> (if flag then 1 else 0) + count_convex r1 + count_convex r2 + | _ -> 0;; + + + + + +(*********************) + +let x = [2.0001; 2.0001; 2.0001; 2.0; 2.0; 2.0; 0.0; 0.0] and + z = [2.52; 2.52; 2.52; 2.0; 2.0; 2.0; 0.0; 0.0];; + +let taum_test1 = run_test taum_taylor x z true 0.0 true true true;; +(* 79 *) +result_size taum_test1;; + +let taum_test1_0 = run_test0 taum_taylor x z true 0.0 true true true;; +(* 57281 *) +result_size taum_test1_0;; + + +count_f0_flags taum_test1;; +length (all_mono taum_test1);; +count_pass_mono taum_test1;; +count_convex taum_test1;; + + + + +(***) +let x = [2.0; 2.0; 2.0; 2.0; 2.0; 2.52; 0.0; 0.0] and + z = [2.52; 2.52; 2.52; 2.0; 2.0; 2.52; 0.0; 0.0];; + +(CONV_RULE (NUM_REDUCE_CONV THENC REAL_RAT_REDUCE_CONV) o SPECL[`2`; `1`]) Sphere.tame_table_d;; + +let taum_test2 = run_test taum_taylor x z true 0.103 false;; +result_size taum_test2;; + +(***) +let x = [2.0; 2.0; 2.0; 2.1771; 2.0; 2.0; 0.0; 0.0] and + z = [2.52; 2.52; 2.52; 2.52; 2.52; 2.52; 0.0; 0.0];; + +let taum_test3 = run_test taum_taylor x z true 0.04 false;; +result_size taum_test3;; + + + + +(***) +let x, z = + replicate 2.0 6 @ [0.;0.], + replicate 2.52 6 @ [0.;0.];; +let ineq = Plus (taum_taylor, Scale (dih_y_taylor, mk_interval (0.626, 0.626)));; +let taum_test4 = run_test ineq x z true 0.77 true true true;; +(* 52540 (48014) *) +result_size taum_test4;; + +count_f0_flags taum_test4;; +length (all_mono taum_test4);; +count_pass_mono taum_test4;; +count_convex taum_test4;; + + +let ineq = Plus (taum_taylor, Scale (dih_y_taylor, mk_interval (-0.259, -0.259)));; +let taum_test5 = run_test ineq x z true (-0.32) false;; +(* 37737 *) +result_size taum_test5;; + + + + +let x, z = + replicate 2.0 6 @ [0.;0.], + replicate 2.52 6 @ [0.;0.];; + +let ineq1_test = run_test dih_y_taylor x z true 0.852 true true true;; +(* 10298 (10142) *) +result_size ineq1_test;; + +let ineq1_test0 = run_test0 dih_y_taylor x z true 0.852 true true true;; +(* 604796 (true false true) 308962 (true true true) *) +result_size ineq1_test0;; + + + +count_f0_flags ineq1_test;; +all_mono ineq1_test;; +count_pass_mono ineq1_test;; +count_convex ineq1_test;; + +let pp = 10;; +let n = 6;; +let xx = `[&2;&2;&2;&2;&2;&2]` and + zz = `[#2.52;#2.52;#2.52;#2.52;#2.52;#2.52]`;; +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; + +m_verify_domain_test n pp eval_delta_x4 ineq1_test xx1 zz1;; + +ineq1_test;; + +let dd = (evalf dih_y_taylor x x).dd;; +map (fun i -> mth (mth dd i) i) iter8;; + + +let ineq2_test = run_test dih_y_taylor x z false 1.893 true true false;; +(* 4905 (4886 with derivatives) *) +result_size ineq2_test;; + +let ineq2_test0 = run_test0 dih_y_taylor x z false 1.893 true true true;; +(* 35842 (true false true) 35842 (true true true) *) +result_size ineq2_test0;; + +let all_p = all_pass ineq2_test;; +let xx, zz = List.nth all_p 134;; +let dd = (evalf dih_y_taylor xx zz).dd;; +map (fun i -> mth (mth dd i) i) iter8;; + + + +count_f0_flags ineq2_test;; +all_mono ineq2_test;; +count_pass_mono ineq2_test;; +count_convex ineq2_test;; + +count_f0_flags ineq2_test0;; +length (all_mono ineq2_test0);; +count_pass_mono ineq2_test0;; +count_convex ineq2_test0;; + + + +let rec pass_intervals r = + match r with + | Result_false _ -> failwith "False result" + | Result_glue (_,r1,r2) -> pass_intervals r1 @ pass_intervals r2 + | Result_pass (x,z) -> [x,z];; + + +let intersect_results r1 r2 = + let i1 = pass_intervals r1 and + i2 = pass_intervals r2 in + let i = intersect i1 i2 in + length i, i;; + +(* 1683 *) +let n1, i1 = intersect_results ineq1_test ineq2_test;; +(* 583 *) +let n2, i2 = intersect_results ineq1_test taum_test4;; +(* 5 *) +let n3, i3 = intersect_results ineq2_test taum_test4;; + +(* 14486 *) +let n4, i4 = intersect_results taum_test4 taum_test5;; +maxl (map (maxl o filter (fun x -> x <> 0.) o snd o center_form) (pass_intervals taum_test4));; + +let x = 2;; + + +(*****************************) + + +(* +Sphere.dih_x;; +Ineq.I_5735387903;; +Ineq.dart_std3;; + +Ineq.getexact "5735387903";; +Ineq.getexact "5490182221";; +Ineq.getexact "2570626711";; +Ineq.getexact "3296257235";; + +Ineq.getexact "8519146937";; +Ineq.getexact "4667071578";; +Ineq.getexact "1395142356";; +Ineq.getexact "7394240696";; +Ineq.getexact "7726998381";; +Ineq.getexact "4047599236";; + +Ineq.getexact "8248508703";; +Ineq.getexact "7931207804";; + +Ineq.getexact "4491491732";; +*) + + + +(**********************************) + + diff --git a/formal_lp/old/formal_interval/interval_m/interval.hl b/formal_lp/old/formal_interval/interval_m/interval.hl new file mode 100644 index 0000000..7e8555b --- /dev/null +++ b/formal_lp/old/formal_interval/interval_m/interval.hl @@ -0,0 +1,166 @@ + + +(* port of interval.hl, + +This file gives a simple implementation of interval arithmetic, +together with the basic arithmetic operations on intervals. + +It has been incompletely implemented. + +For now, I am not implementing directed roundings. +However, McLaughlin implemented directed rounding several years ago: +See http://perso.ens-lyon.fr/nathalie.revol/mpfi.html + ~/Library/McLaughlinOCAML/ocaml/src/extensions/ocaml-mpfi/ + + *) + +module Interval =struct + + +let mk_interval (a,b) = { lo = a; hi = b; };; + +let string_of_interval x = Printf.sprintf "[%f;%f]" x.lo x.hi;; + +(* let izero = mk_interval(0.0,0.0);; *) +let zero = mk_interval(0.0,0.0);; +let one = mk_interval(1.0,1.0);; +let two = mk_interval(2.0,2.0);; +let four = mk_interval(4.0,4.0);; + +let is_zero x =(x.lo=0.0)&&(x.hi=0.0);; + +let pos x = if (x.lo >= 0.0) then x else + mk_interval(0.0, if (x.hi < 0.0) then 0.0 else x.hi );; + +let imax (x,y) = let t=max x.hi y.hi in mk_interval(t,t);; + +let imin (x,y) = let t = min x.lo y.lo in mk_interval(t,t);; + +let imin3(x,y,z) = imin(x,imin(y,z));; + +let imax3(x,y,z) = imax(x,imax(y,z));; + +let imax4(w,x,y,z) = imax(imax(w,x),imax(y,z));; + +let sup x = x.hi;; + +let inf x = x.lo;; + +let iabs x = max x.hi (~-. (x.lo));; + +let ilt x y = (x.hi < y.lo);; + +let igt x y = (x.lo > y.hi);; + +let ieq x y = (x.lo = y.lo && x.hi = y.hi);; + +(* need rounding modes -- BUG *) + + +(* start of bug section *) + +let up() = ( (* bug *) );; +let down() = ( (* bug *) );; +let nearest() = ( (* bug *) );; +let upadd x y = ( x +. y);; (* bug *) +let upmul x y = (x *. y);; +let updiv x y = (x /. y);; +let upsub x y = (x -. y);; +let downadd x y = (x +. y);; +let downmul x y = (x *. y);; +let downdiv x y = (x /. y);; +let downsub x y = (x -. y);; + +(* end of bug section *) + +let interval_of_string = + let dbl_min =1.0e-300 in + fun (s1,s2) -> + let ( - ) = (down(); downsub) in + let lo = float_of_string s1 - dbl_min in + let ( + ) = (up(); upadd) in + let hi = float_of_string s2 + dbl_min in + mk_interval(lo,hi);; + +let interval_of_single s = interval_of_string (s,s);; + +let ineg x = mk_interval(~-. (x.hi), ~-. (x.lo));; + +let iadd x y = mk_interval((down(); downadd x.lo y.lo), (up(); upadd x.hi y.hi));; + +let slowcases x y = + if (x.lo >= 0.0) then + (if (y.lo >= 0.0) then (x.lo,y.lo,x.hi,y.hi) + else if (y.hi <= 0.0) then (x.hi,y.lo,x.lo,y.hi ) else (x.hi,y.lo,x.hi,y.hi)) + else if (x.hi <= 0.0) then + (if (y.hi <= 0.0) then (x.hi,y.hi,x.lo,y.lo) + else if (y.lo >= 0.0) then (x.lo,y.hi,x.hi,y.lo) else (x.lo,y.hi,x.lo,y.lo)) + else + (if (y.lo >=0.0) then (x.lo,y.hi,x.hi,y.hi) + else if (y.hi <=0.0) then (x.hi,y.lo,x.lo,y.lo) + else (let lo = (down(); min (downmul x.hi y.lo) (downmul x.lo y.hi)) in + let hi = (up(); max (upmul x.hi y.hi) (upmul x.lo y.lo)) in (lo,1.0,hi,1.0)));; + +let slowmul x y = + let (xlo,ylo,xhi,yhi) = slowcases x y in + mk_interval((down(); downmul xlo ylo),(up(); upmul xhi yhi));; + +let _ = + let test_slowmul x y = + let all = [x.lo *. y.lo; x.hi *. y.lo; x.lo *. y.hi; x.hi *. y.hi] in + let m = end_itlist min all in + let M = end_itlist max all in + ( mk_interval(m,M) = slowmul x y) in + let xs = map mk_interval [(~-. 7.0, ~-. 5.0);(~-. 3.0,9.0);(11.0,13.0)] in + let ys = map mk_interval [(~-. 16.0, ~-. 14.0);(~-. 10.0,12.0); (18.0,22.0)] in + let test i j = test_slowmul (List.nth xs i) (List.nth ys j) or + failwith (Printf.sprintf "%d %d" i j) in + for i=0 to 2 do + for j= 0 to 2 do + let _ = test i j in (); + done; done;; + +let imul x y = if (x.lo > 0.0 && y.lo > 0.0) then + mk_interval((down(); downmul x.lo y.lo, (up(); upmul x.hi y.hi))) else slowmul x y;; + +let isub x y = mk_interval((down();downsub x.lo y.hi),(up(); upsub x.hi y.lo));; + +let isqrt = + let sqrt = Pervasives.sqrt in + fun x -> mk_interval( + (if (x.lo <= 0.0) then 0.0 else (down(); sqrt(x.lo))), + (if (x.hi <= 0.0) then 0.0 else (up(); sqrt(x.hi))));; + +let iatan x = + let _ = nearest() in + mk_interval((down(); atan x.lo),(up(); atan x.hi));; + +let iacos x = + let _ = nearest() in + mk_interval((down(); acos x.hi),(up(); acos x.lo));; + +let combine x y = mk_interval(inf(imin(x,y)),sup(imax(x,y)));; + +let rand01 = + let random_int_seed = 81757 in + let _ = Random.init(random_int_seed) in + fun _ -> Random.float(1.0);; + +let bounded_from_zero = + let dbl_epsilon = 1.0e-8 in + fun x-> (x.hi < ~-. dbl_epsilon or x.lo > dbl_epsilon);; + +let idiv x y = if (bounded_from_zero y) then + imul x (mk_interval((down(); downdiv 1.0 y.hi),(up(); updiv 1.0 y.lo))) + else raise Unstable;; + +(* overload arithmetic ops *) + +(* +let (+) = iadd;; +let (-) = isub;; +let (/) = idiv;; +let (~-) = ineg;; +*) + +end;; diff --git a/formal_lp/old/formal_interval/interval_m/line_interval.hl b/formal_lp/old/formal_interval/interval_m/line_interval.hl new file mode 100644 index 0000000..5481418 --- /dev/null +++ b/formal_lp/old/formal_interval/interval_m/line_interval.hl @@ -0,0 +1,108 @@ + +(* port of lineInterval.cc. + Only the top section has been translated. The rest should be + automatically generated from HOL Light specs. + + This impements basic operations on the type line, + such as addition and scalar multiplication. + + *) + +flyspeck_needs "../formal_lp/formal_interval/interval_m/interval.hl";; + +module Line_interval = struct + + open List;; + open Interval;; + + +(* general utilities *) + let iter8 = 0--7;; + + let table f = map f iter8;; + + let table2 f = map (fun i -> map (fun j-> f i j) iter8) iter8;; + + let rth m x i = if (i >=0) && (i < m) then List.nth x i else + failwith (Printf.sprintf "index %d not in 0..%d" i (m-1));; + + let mth x i = if (i >=0) && (i < 8) then List.nth x i else + failwith (Printf.sprintf "index %d not in 0..8" i );; + + let mth2 a i j = mth (mth a i) j;; + + let maxl xs = end_itlist max xs;; + + let minl xs = end_itlist min xs;; + +(* line interval proper *) + +let partial line i = mth line.df i ;; + +let mk_line(f1,df1) = { f = f1; df =df1};; + +let line_zero = + let z = zero in + mk_line(z,replicate z 8);; + +let line_unit = + mk_line(one,replicate zero 8);; + +let lmul = + let ( * ) = imul in + let ( + ) = iadd in + fun a b -> mk_line ( a.f * b.f, map (fun i -> a.f * mth b.df i + b.f * mth a.df i) iter8);; + +let smul = + let ( * ) = imul in + fun a b -> mk_line ( a.f * b, map (fun x -> x * b) a.df);; + +let ldiv = + let one = mk_interval(1.0,1.0) in + let ( * ) = imul in + let ( - ) = isub in + let ( / ) = idiv in + fun b a -> + let r = one/a.f in + let f = b.f * r in + let r2 = r * r in + mk_line ( f, map (fun i -> ((mth b.df i) * a.f - (mth a.df i) * b.f)* r2) iter8);; + +let ladd = + let ( + ) = iadd in + fun b a -> + mk_line(b.f + a.f, map (fun i -> mth b.df i + mth a.df i) iter8);; + +let lsub = + let ( - ) = isub in + fun b a -> + mk_line(b.f - a.f, map (fun i -> mth b.df i - mth a.df i) iter8);; + +let lneg = + let ineg = ineg in + fun a -> + mk_line(ineg a.f, map ineg a.df);; + +let lsqrt = + let one = mk_interval(1.0,1.0) in + let two = mk_interval(2.0,2.0) in + let ( * ) = imul in + let ( / ) = idiv in + fun a -> + let f = isqrt a.f in + let rs = one / (two * f) in + mk_line(f, map (fun i -> mth a.df i * rs) iter8);; + +let latan = (* arctan (a/b) *) + let one = mk_interval(1.0,1.0) in + let ( * ) = imul in + let ( + ) = iadd in + let ( - ) = isub in + let ( / ) = idiv in + fun a b -> + let f = iatan (a.f/b.f) in + let rden = one/ (a.f * a.f + b.f * b.f) in + mk_line(f, map (fun i -> rden * (mth a.df i * b.f - mth b.df i * a.f)) iter8);; + + + end;; diff --git a/formal_lp/old/formal_interval/interval_m/recurse.hl b/formal_lp/old/formal_interval/interval_m/recurse.hl new file mode 100644 index 0000000..8f69938 --- /dev/null +++ b/formal_lp/old/formal_interval/interval_m/recurse.hl @@ -0,0 +1,282 @@ + + + +(* port of recurse.cc *) + +(* +This is the code that verifies a disjunct of nonlinear inequalities. +The are given as a list (tf:tfunction list). If tf = [f1;....;fk], then +the list represents the inequality (f1 < 0 \/ f2 < 0 .... fk < 0). + +The end user should only need to define a cell option, +and then call recursive_verifier, which recursively bisects the domain +until a partition of the domain is found on which verifier_cell gives +a pass on each piece of the partition. + +*) + +flyspeck_needs "../formal_lp/formal_interval/interval_m/types.hl";; +flyspeck_needs "../formal_lp/formal_interval/interval_m/report.hl";; +flyspeck_needs "../formal_lp/formal_interval/interval_m/interval.hl";; +flyspeck_needs "../formal_lp/formal_interval/interval_m/univariate.hl";; +flyspeck_needs "../formal_lp/formal_interval/interval_m/line_interval.hl";; +flyspeck_needs "../formal_lp/formal_interval/interval_m/taylor.hl";; + +module Recurse = struct + +open Interval;; +open Univariate;; +open Line_interval;; +open Taylor;; + +type cellOption = { + only_check_deriv1_negative : bool; + is_using_dihmax : bool; + is_using_bigface126 : bool; + width_cutoff : float; + allow_sharp : bool; + allow_derivatives : bool; + mutable iteration_count : int; + iteration_limit : int; + recursion_depth : int; + mono_pass : bool; + convex_flag : bool; + raw_int_flag : bool; + eps : float; +};; + +(* cell verification is complex, and we use exceptions to + exit as soon as the status has been determined. *) + +type mono_status = { + variable : int; + decr_flag : bool; + df0_flag : bool; + ti_flag : bool; +};; + + +type cell_status = + | Cell_pass of mono_status list list * bool + | Cell_pass_mono of mono_status list list * mono_status + | Cell_counterexample + | Cell_inconclusive_ti of (mono_status list list * taylor_interval * float list * float list * float list * float list) + | Cell_inconclusive of (mono_status list list * float list * float list * float list * float list);; + +exception Return of cell_status;; + +type result_tree = + | Result_false of (float list * float list) + | Result_pass of (bool * float list * float list) + | Result_pass_mono of mono_status + | Result_pass_ref of int + | Result_mono of mono_status list * result_tree + (* variable, convex_flag, r1, r2 *) + | Result_glue of (int * bool * result_tree * result_tree);; + +type p_status = { + pp : int; +};; + +type p_result_tree = + | P_result_pass of p_status * bool + | P_result_mono of p_status * mono_status list * p_result_tree + | P_result_glue of p_status * int * bool * p_result_tree * p_result_tree + | P_result_ref of int;; + +let rec result_size r = + match r with + | Result_false _ -> failwith "False result detected" + | Result_mono (_,r1) -> result_size r1 + | Result_glue (_, _, r1, r2) -> result_size r1 + result_size r2 + | Result_pass_mono _ -> 1 + | Result_pass _ -> 1 + | _ -> 0;; + +let rec p_result_size r = + match r with + | P_result_pass _ -> 1 + | P_result_mono (_, _, r1) -> p_result_size r1 + | P_result_glue (_, _, _, r1, r2) -> p_result_size r1 + p_result_size r2 + | _ -> 0;; + + +let return c = raise (Return c);; + + +(* error checking and reporting functions *) + +let string_of_domain x = + let n = mth in + Printf.sprintf "{%f, %f, %f, %f, %f, %f, %f, %f}" (n x 0) (n x 1) (n x 2) (n x 3) (n x 4) (n x 5) (n x 6) (n x 7);; + +let string3 (x,z,s) = (string_of_domain x ^"\n"^ string_of_domain z ^ "\n" ^ s);; + +let boolify _ = true;; + +let report_current = boolify o Report.report_timed o string3;; + +let report_error = boolify o Report.report_error o string3;; + +let report_fatal = boolify o Report.report_fatal o string3;; + +(* let t = [0.1;0.2;0.3;0.4;0.5;0.6] in report_error (t,t,"ok");; *) + +let periodic_count = + let end_count = ref 0 in + fun () -> + let _ = end_count := !end_count + 1 in + (0 = ( !end_count mod 1000));; + +let check_limit opt depth = + let _ = opt.iteration_count <- opt.iteration_count + 1 in + ( opt.iteration_count < opt.iteration_limit or opt.iteration_limit = 0 ) && + (depth < opt.recursion_depth);; + +let sgn x = if (x.lo > 0.0) then 1 else if (x.hi < 0.0) then -1 else 0;; + +let rec same_sgn x y = (x = []) or (sgn (hd x) = sgn (hd y) && same_sgn (tl x) (tl y));; + + +(* has_monotone *) + +let rec has_monotone opt tf ti domain0 x z x0 z0 is found = match is with + | [] -> (x,z,x0,z0,List.rev found) + | j::js when (mth x j >= mth z j) -> + has_monotone opt tf ti domain0 x z x0 z0 js found + | j::js -> + let df_int = + if opt.raw_int_flag then + try evalf0 tf (j + 1) (fst domain0) (snd domain0) + with Unstable -> mk_interval (-1.0,1.0) + else + mk_interval (-1.0, 1.0) in + let allpos_df0, allpos_ti = df_int.lo >= opt.eps, lower_partial ti j >= opt.eps in + let allneg_df0, allneg_ti = df_int.hi < ~-.(opt.eps), upper_partial ti j < ~-.(opt.eps) in + if (allpos_df0 or allpos_ti) then + let status = + {variable = j + 1; decr_flag = false; df0_flag = allpos_df0; ti_flag = allpos_ti} in + if opt.mono_pass && mth z j < mth z0 j then return (Cell_pass_mono ([], status)) + else + let setj u = table (fun i -> (if i=j then mth z j else mth u i)) in + has_monotone opt tf ti domain0 (setj x) (setj z) + (setj x0) (setj z0) js (status :: found) + else if (allneg_df0 or allneg_ti) then + let status = + {variable = j + 1; decr_flag = true; df0_flag = allneg_df0; ti_flag = allneg_ti} in + if opt.mono_pass && mth x j > mth x0 j then return (Cell_pass_mono ([], status)) + else + let setj u = table (fun i -> (if i=j then mth x j else mth u i)) in + has_monotone opt tf ti domain0 (setj x) (setj z) + (setj x0) (setj z0) js (status :: found) + else has_monotone opt tf ti domain0 x z x0 z0 js found;; + +(* loop as long as monotonicity keeps making progress. *) + +let rec going_strong(x,z,x0,z0,tf,opt,mono) = + let (y,w) = center_form (x,z) in + let maxwidth = maxl w in + let target0 = + if opt.raw_int_flag then + try evalf0 tf 0 x z with Unstable -> one + else + one in + let _ = target0.hi >= ~-.(opt.eps) or return (Cell_pass (mono, true)) in + let target = + try evalf tf x z with Unstable -> return (Cell_inconclusive (mono,x,z,x0,z0)) in + let _ = upper_bound target >= ~-.(opt.eps) or return (Cell_pass (mono, false)) in + let _ = lower_bound target < 0.0 or return Cell_counterexample in + let epsilon_width = 1.0e-8 in + let _ = (maxwidth >= epsilon_width) or return Cell_counterexample in + let (x,z,x0,z0,strong) = + if (opt.allow_derivatives) then + try + has_monotone opt tf target (x,z) x z x0 z0 iter8 [] + with Return (Cell_pass_mono (_, status)) -> return (Cell_pass_mono (mono, status)) + else (x,z,x0,z0,[]) in + if (strong <> []) then + going_strong(x,z,x0,z0,tf,opt,mono @ [strong]) + else + (target,x,z,x0,z0,maxwidth,mono);; + + +(* +This procedure is mostly guided by heuristics that don't require formal +verification. In particular, no justification is required for tossing out inequalities +(since they appear as disjuncts, we can choose which one to prove). + +Formal verification is required whenever a Cell_passes is issued, +and whenever the domain (x,z) is restricted. + +The record (x0,z0) of the current outer boundary must be restricted to (x,z) +whenever an inequality is tossed out. +*) + +let rec verify_cell (x,z,x0,z0,tf,opt) = + try ( + let _ = not(periodic_count ()) or report_current (x,z,"periodic report") in + let (ti,x,z,x0,z0,maxwidth,mono) = going_strong(x,z,x0,z0,tf,opt,[]) in + if opt.convex_flag then + Cell_inconclusive_ti (mono,ti,x,z,x0,z0) + else + Cell_inconclusive (mono,x,z,x0,z0) + ) + with Return c -> c;; + +let rec recursive_verifier (depth,x,z,x0,z0,tf,opt) = + let _ = check_limit opt depth or report_fatal(x,z,Printf.sprintf "depth %d" depth) in + let split_and_verify j x z x0 z0 convex_flag = + let ( ++ ), ( / ) = up(); upadd, updiv in + let yj = (mth x j ++ mth z j) / 2.0 in + let delta b v = table (fun i-> if (i = j && b) then yj else mth v i) in + let x1, z1 = + if convex_flag then + x, table (fun i -> if i = j then mth x i else mth z i) + else + delta false x, delta true z in + let x2, z2 = + if convex_flag then + table (fun i -> if i = j then mth z i else mth x i), z + else + delta true x, delta false z in + let r1 = recursive_verifier(depth+1,x1,z1,x0,z0,tf,opt) in + match r1 with + | Result_false t -> Result_false t + | _ -> + (let r2 = recursive_verifier(depth+1,x2,z2,x0,z0,tf,opt) in + match r2 with + | Result_false t -> Result_false t + | _ -> Result_glue (j, convex_flag, r1, r2)) in + + let add_mono mono r1 = + itlist (fun m r -> Result_mono (m, r)) mono r1 in + + match verify_cell(x,z,x0,z0,tf,opt) with + | Cell_counterexample -> Result_false (x,z) + | Cell_pass (mono, f0_flag) -> add_mono mono (Result_pass (f0_flag,x,z)) + | Cell_pass_mono (mono, status) -> add_mono mono (Result_pass_mono status) + | Cell_inconclusive_ti(mono,ti,x,z,x0,z0) -> + let dds = map (fun i -> mth (mth ti.dd i) i, i) iter8 in + let convex_dds = filter (fun dd, i -> dd.lo >= opt.eps && mth x i < mth z i) dds in + let convex_i = map snd convex_dds in + let w2 = List.map2 upsub z x in + let convex_flag, ws, ws_i = + if convex_dds = [] then + false, w2, iter8 + else + true, map (mth w2) convex_i, convex_i in + let maxwidth2 = maxl ws in + let j_wide = try( find (fun i -> mth w2 i = maxwidth2) ws_i) with + | _ -> failwith "recursive_verifier find" in + add_mono mono (split_and_verify j_wide x z x0 z0 convex_flag) + + | Cell_inconclusive(mono,x,z,x0,z0) -> + let w2 = List.map2 upsub z x in + let maxwidth2 = maxl w2 in + let j_wide = try( find (fun i -> mth w2 i = maxwidth2) iter8) with + | _ -> failwith "recursive_verifier find" in + add_mono mono (split_and_verify j_wide x z x0 z0 false);; + + + + end;; diff --git a/formal_lp/old/formal_interval/interval_m/recurse0.hl b/formal_lp/old/formal_interval/interval_m/recurse0.hl new file mode 100644 index 0000000..d59b279 --- /dev/null +++ b/formal_lp/old/formal_interval/interval_m/recurse0.hl @@ -0,0 +1,145 @@ +(* Recursive verification of inequalities using the basic interval arithmetic only *) + +flyspeck_needs "../formal_lp/formal_interval/interval_m/recurse.hl";; + +module Recurse0 = struct + +open Interval;; +open Univariate;; +open Line_interval;; +open Taylor;; +open Recurse;; + + + +(* has_monotone *) + +let rec has_monotone0 opt tf domain0 x z x0 z0 is found = match is with + | [] -> (x,z,x0,z0,List.rev found) + | j::js when (mth x j >= mth z j) -> + has_monotone0 opt tf domain0 x z x0 z0 js found + | j::js -> + let df_int = try evalf0 tf (j + 1) (fst domain0) (snd domain0) with Unstable -> mk_interval (-1.0,1.0) in + let allpos_df0 = df_int.lo >= opt.eps in + let allneg_df0 = df_int.hi < ~-.(opt.eps) in + if allpos_df0 then + let status = + {variable = j + 1; decr_flag = false; df0_flag = allpos_df0; ti_flag = false} in + if opt.mono_pass && mth z j < mth z0 j then return (Cell_pass_mono ([], status)) + else + let setj u = table (fun i -> (if i=j then mth z j else mth u i)) in + has_monotone0 opt tf domain0 (setj x) (setj z) + (setj x0) (setj z0) js (status :: found) + else if allneg_df0 then + let status = + {variable = j + 1; decr_flag = true; df0_flag = allneg_df0; ti_flag = false} in + if opt.mono_pass && mth x j > mth x0 j then return (Cell_pass_mono ([], status)) + else + let setj u = table (fun i -> (if i=j then mth x j else mth u i)) in + has_monotone0 opt tf domain0 (setj x) (setj z) + (setj x0) (setj z0) js (status :: found) + else has_monotone0 opt tf domain0 x z x0 z0 js found;; + +(* loop as long as monotonicity keeps making progress. *) + +let rec going_strong0(x,z,x0,z0,tf,opt,mono) = + let (y,w) = center_form (x,z) in + let maxwidth = maxl w in + let target0 = try evalf0 tf 0 x z with Unstable -> return (Cell_inconclusive (mono,x,z,x0,z0)) in + let _ = target0.hi >= ~-.(opt.eps) or return (Cell_pass (mono, true)) in + let epsilon_width = 1.0e-8 in + let _ = (maxwidth >= epsilon_width) or return Cell_counterexample in + let (x,z,x0,z0,strong) = + if (opt.allow_derivatives) then + try + has_monotone0 opt tf (x,z) x z x0 z0 iter8 [] + with Return (Cell_pass_mono (_, status)) -> return (Cell_pass_mono (mono, status)) + else (x,z,x0,z0,[]) in + if (strong <> []) then + going_strong0(x,z,x0,z0,tf,opt,mono @ [strong]) + else + (x,z,x0,z0,maxwidth,mono);; + + +(* +This procedure is mostly guided by heuristics that don't require formal +verification. In particular, no justification is required for tossing out inequalities +(since they appear as disjuncts, we can choose which one to prove). + +Formal verification is required whenever a Cell_passes is issued, +and whenever the domain (x,z) is restricted. + +The record (x0,z0) of the current outer boundary must be restricted to (x,z) +whenever an inequality is tossed out. +*) + +let rec verify_cell0 (x,z,x0,z0,tf,opt) = + try ( + let _ = not(periodic_count ()) or report_current (x,z,"periodic report") in + let (x,z,x0,z0,maxwidth,mono) = going_strong0(x,z,x0,z0,tf,opt,[]) in + if opt.convex_flag then + let ti = try evalf tf x z with Unstable -> return (Cell_inconclusive (mono,x,z,x0,z0)) in + Cell_inconclusive_ti (mono,ti,x,z,x0,z0) + else + Cell_inconclusive (mono,x,z,x0,z0) + ) + with Return c -> c;; + +let rec recursive_verifier0 (depth,x,z,x0,z0,tf,opt) = + let _ = check_limit opt depth or report_fatal(x,z,Printf.sprintf "depth %d" depth) in + let split_and_verify j x z x0 z0 convex_flag = + let ( ++ ), ( / ) = up(); upadd, updiv in + let yj = (mth x j ++ mth z j) / 2.0 in + let delta b v = table (fun i-> if (i = j && b) then yj else mth v i) in + let x1, z1 = + if convex_flag then + x, table (fun i -> if i = j then mth x i else mth z i) + else + delta false x, delta true z in + let x2, z2 = + if convex_flag then + table (fun i -> if i = j then mth z i else mth x i), z + else + delta true x, delta false z in + let r1 = recursive_verifier0(depth+1,x1,z1,x0,z0,tf,opt) in + match r1 with + | Result_false t -> Result_false t + | _ -> + (let r2 = recursive_verifier0(depth+1,x2,z2,x0,z0,tf,opt) in + match r2 with + | Result_false t -> Result_false t + | _ -> Result_glue (j, convex_flag, r1, r2)) in + + let add_mono mono r1 = + itlist (fun m r -> Result_mono (m, r)) mono r1 in + + + match verify_cell0(x,z,x0,z0,tf,opt) with + | Cell_counterexample -> Result_false (x,z) + | Cell_pass (mono, f0_flag) -> add_mono mono (Result_pass (f0_flag,x,z)) + | Cell_pass_mono (mono, status) -> add_mono mono (Result_pass_mono status) + | Cell_inconclusive_ti(mono,ti,x,z,x0,z0) -> + let dds = map (fun i -> mth (mth ti.dd i) i, i) iter8 in + let convex_dds = filter (fun dd, i -> dd.lo >= opt.eps && mth x i < mth z i) dds in + let convex_i = map snd convex_dds in + let w2 = List.map2 upsub z x in + let convex_flag, ws, ws_i = + if convex_dds = [] then + false, w2, iter8 + else + true, map (mth w2) convex_i, convex_i in + let maxwidth2 = maxl ws in + let j_wide = try( find (fun i -> mth w2 i = maxwidth2) ws_i) with + | _ -> failwith "recursive_verifier find" in + add_mono mono (split_and_verify j_wide x z x0 z0 convex_flag) + + | Cell_inconclusive(mono,x,z,x0,z0) -> + let w2 = List.map2 upsub z x in + let maxwidth2 = maxl w2 in + let j_wide = try( find (fun i -> mth w2 i = maxwidth2) iter8) with + | _ -> failwith "recursive_verifier find" in + add_mono mono (split_and_verify j_wide x z x0 z0 false);; + + + + end;; diff --git a/formal_lp/old/formal_interval/interval_m/report.hl b/formal_lp/old/formal_interval/interval_m/report.hl new file mode 100644 index 0000000..a4776bc --- /dev/null +++ b/formal_lp/old/formal_interval/interval_m/report.hl @@ -0,0 +1,40 @@ +(* port of error.cc + basic procedures to print messages to the standard output + and to count errors. + +*) + +module Report = struct + +let time_string () = Printf.sprintf "time(%.0f)" (Sys.time());; + +let (get_error_count,reset_error_count,inc_error_count) = + let error_count = ref 0 in + ((fun _ -> !error_count),(fun _ -> error_count := 0), + (fun _ -> error_count:= !error_count + 1));; + +let (get_corner_count,reset_corner_count,inc_corner_count) = + let corner_count = ref 0 in + ((fun _ -> !corner_count),(fun _ -> corner_count := 0), + (fun _ -> corner_count:= !corner_count + 1));; + +let diagnostic_string () = + let d = get_error_count() in + if (d>0) then Printf.sprintf "(errors %d)" (get_error_count()) else "(no errors)";; + +let report s = + Format.print_string s; Format.print_newline(); Format.print_flush();; + +let report_timed s = report (s^" "^(time_string()));; + +let report_error = + let error_max = 25 in (* was 200, recurse.cc had a separate counter limit at 25 *) + fun s -> + let ec = get_error_count() in + (inc_error_count(); report_timed (Printf.sprintf "error(%d) --\n%s" ec s); + Pervasives.ignore(get_error_count() < error_max or raise Fatal));; + +let report_fatal s = + ( inc_error_count(); report_timed ("error --\n"^s); raise Fatal);; + +end;; diff --git a/formal_lp/old/formal_interval/interval_m/taylor.hl b/formal_lp/old/formal_interval/interval_m/taylor.hl new file mode 100644 index 0000000..dd9e098 --- /dev/null +++ b/formal_lp/old/formal_interval/interval_m/taylor.hl @@ -0,0 +1,367 @@ +(* port of taylor functions, taylor interval *) + +(* +The first part of the file implements basic operations on type taylor_interval. + +Then a type tfunction is defined that represents a twice continuously +differentiable function of six variables. It can be evaluated, which +is the taylor_interval data associated with it. + +Sometimes a tfunction f is used to represent an inequality f < 0. +(See recurse.hl. +*) + + +module Taylor = struct + +open Interval;; +open Univariate;; +open Line_interval;; + + +(* general utilities *) + + +let m8_sum = + let ( + ) = iadd in + fun dd1 dd2 -> + let r8_sum (x,y) = table (fun i -> mth x i + mth y i) in + map r8_sum (zip dd1 dd2);; + +let center_form(x,z) = + let ( + ) , ( - ), ( / ) = up(); upadd,upsub,updiv in + let y = table (fun i -> if (mth x i=mth z i) then mth x i else (mth x i + mth z i)/ 2.0) in + let w = table (fun i -> max (mth z i - mth y i) (mth y i - mth x i)) in + let _ = (minl w >= 0.0) or failwith "centerform" in + (y,w);; + +(* start with taylor interval operations *) + +let make_taylor_interval (l1,w1,dd1) = {l = l1; w = w1; dd=dd1;};; + +let ti_add (ti1,ti2) = + let _ = (ti1.w = ti2.w) or failwith ("width mismatch in ti") in + make_taylor_interval( ladd ti1.l ti2.l,ti1.w, m8_sum ti1.dd ti2.dd);; + +let ti_scale (ti,t) = + make_taylor_interval( smul ti.l t,ti.w, table2 (fun i j -> imul (mth2 ti.dd i j) t));; + + + +let taylor_error ti = + let ( + ), ( * ) , ( / )= up(); upadd, upmul, updiv in + let dot_abs_row r = List.fold_left2 (fun a b c -> a + b * iabs c) 0.0 ti.w r in + let dots = map dot_abs_row (ti.dd) in + (List.fold_left2 (fun a b c -> a + b * c) 0.0 ti.w dots) / 2.0;; +(* (end_itlist ( + ) p) / 2.0 ;; *) + +let upper_bound ti = + let e = taylor_error ti in + let ( + ), ( * ) = up(); upadd, upmul in + let t = ti.l.f.hi + e in + t + List.fold_left2 (fun a b c -> a + b * iabs c) 0.0 ti.w ti.l.df;; + +let lower_bound ti = + let e = taylor_error ti in + let ( + ), ( * ),(- ) = down(); downadd,downmul,downsub in + let t = ti.l.f.lo - e in + t + List.fold_left2 (fun a b c -> a + ( ~-. b) * iabs c) 0.0 ti.w ti.l.df;; + +let upper_partial ti i = + let ( + ), ( * ) = up(); upadd,upmul in + let err = List.fold_left2 (fun a b c -> a + b*(max c.hi (~-. (c.lo)))) + 0.0 ti.w (mth ti.dd i) in + err + Interval.sup ( mth ti.l.df i);; + +let lower_partial ti i = + let ( + ), ( * ), ( - ) = down();downadd,downmul,downsub in + let err = List.fold_left2 (fun a b c -> a + b * min c.lo (~-. (c.hi))) + 0.0 ti.w (mth ti.dd i) in + Interval.inf ( mth ti.l.df i) + err;; + + +let ti_mul (ti1,ti2) = + let _ = (ti1.w = ti2.w) or failwith ("ti_mul: width mismatch in ti") in + let line = lmul ti1.l ti2.l in + let f1_int = + let lo, hi = lower_bound ti1, upper_bound ti1 in mk_interval (lo, hi) in + let f2_int = + let lo, hi = lower_bound ti2, upper_bound ti2 in mk_interval (lo, hi) in + let d1_ints = table (fun i -> mk_interval (lower_partial ti1 i, upper_partial ti1 i)) in + let d2_ints = table (fun i -> mk_interval (lower_partial ti2 i, upper_partial ti2 i)) in + let dd = table2 (fun i j -> + let ( + ), ( * ) = iadd, imul in + mth2 ti1.dd i j * f2_int + mth d1_ints i * mth d2_ints j + + mth d1_ints j * mth d2_ints i + f1_int * mth2 ti2.dd i j) in + make_taylor_interval(line, ti1.w, dd);; + + + +(* primitive A *) + +type primitiveA = { + f_df : int -> float list -> float list -> interval; + hfn : float list -> line; + second : float list -> float list -> interval list list; +};; + +let make_primitiveA (f,h1,s1) = {f_df = f; hfn = h1; second = s1; };; + +let unitA = + let zero2 = table2 (fun i j -> zero) in + make_primitiveA ( + (fun i x z -> if i = 0 then one else zero), + (fun y -> line_unit), + (fun x z -> zero2) +);; + +let evalf4A pA w x y z = + make_taylor_interval( + pA.hfn y, + w, + pA.second x z + );; + +let line_estimateA pA y = pA.hfn y;; + +(* primitive U *) + +type primitiveU = { + slot: int; + uv: univariate; +};; + +let mk_primitiveU s1 uv1 = + let _ = (s1 < 8) or failwith (Printf.sprintf "slot %d" s1) in + { slot = s1; uv = uv1; };; + +let line_estimateU p y = + let y0 = mth y p.slot in + let t = mk_interval(y0,y0) in + let d = table (fun i -> if (i=p.slot) then eval p.uv t 1 else zero) in + mk_line ( eval p.uv t 0, d );; + +let evalf4U = + let row0 = table (fun i -> zero) in + fun p w x y z -> + let t = mk_interval(mth x p.slot,mth z p.slot) in + let row_slot = table (fun i -> if (i=p.slot) then eval p.uv t 2 else zero) in + let dd = table (fun i -> if (i=p.slot) then row_slot else row0) in + make_taylor_interval( + line_estimateU p y, + w, + dd + );; + +type tfunction = + | Prim_a of primitiveA + | Uni of primitiveU + | Plus of tfunction * tfunction + | Product of tfunction * tfunction + | Scale of tfunction * interval + | Uni_compose of univariate * tfunction + | Composite of tfunction * (* F(g1,g2,g3,g4,g5,g6,g7,g8) *) + tfunction *tfunction *tfunction * + tfunction *tfunction *tfunction * + tfunction *tfunction;; + +let unit = Prim_a unitA;; + +let x1 = Uni (mk_primitiveU 0 ux1);; +let x2 = Uni (mk_primitiveU 1 ux1);; +let x3 = Uni (mk_primitiveU 2 ux1);; +let x4 = Uni (mk_primitiveU 3 ux1);; +let x5 = Uni (mk_primitiveU 4 ux1);; +let x6 = Uni (mk_primitiveU 5 ux1);; + + +let x1x2 = + let tab2 = table2 (fun i j -> if (i+j=1) then one else zero) in + Prim_a (make_primitiveA( + (fun i x z -> + let x1 = mk_interval (mth x 0, mth z 0) in + let x2 = mk_interval (mth x 1, mth z 1) in + if i = 0 then imul x1 x2 + else if i = 1 then x2 + else if i = 2 then x1 + else zero), + (fun y -> + let u1 = mth y 0 in + let u2 = mth y 1 in + let x1 = mk_interval(u1,u1) in + let x2 = mk_interval(u2,u2) in + mk_line( + imul x1 x2, + table (fun i -> if i=0 then x2 else if i=1 then x1 else zero) + )), + (fun x z -> tab2)));; + +let tf_product tf1 tf2 = Composite(x1x2,tf1,tf2,unit,unit,unit,unit,unit,unit);; + + +(* This is one of the most difficult functions in the interval code. + It uses the chain rule to compute the second partial derivatives with + respect to x(i) x(j), of a function composition + + F(x1,...,x6) = f(g1(x1,...x6),g2(x1,...x6),...,g6(x1,...x6)). + + (F i j) = sum {k m} (f k m) (gk i) (gm j) + sum {r} (f r) (gr i j). + + Fast performance of this function is very important, especially + when many of the functions g* are constant. + There is a bit of imperative programming here, in computing the sums. + + Note that ( + ) and ( * ) have different types in various subsections. +*) + +let eval_composite = + let rest = () in + let sparse_table h f = filter h (List.flatten (table2 f)) in + fun hdr p1 p2 p3 p4 p5 p6 p7 p8 w -> + let p = [p1;p2;p3;p4;p5;p6;p7;p8] in + (* wide and narrow ranges of p *) + let (aw,bw) = map (lower_bound) p, map (upper_bound) p in + let (a,b) = map (fun p -> p.l.f.lo) p, map (fun p -> p.l.f.hi) p in + (* wide and narrow widths from a to b *) + let (u,wu,wf) = + let ( + ),( - ),( / ) = up();upadd,upsub,updiv in + let u = table (fun i -> (mth a i + mth b i) / 2.0) in + let wu = table (fun i -> max (mth bw i - mth u i) (mth u i - mth aw i)) in + let wf = table (fun i -> max (mth b i - mth u i) (mth u i - mth a i)) in + (u,wu,wf) in + let (fu:taylor_interval) = hdr wu aw u bw in + let fpy = + let t = make_taylor_interval(fu.l,wf,fu.dd) in + mk_line ( + mk_interval(lower_bound t, upper_bound t), + table (fun i -> mk_interval(lower_partial t i,upper_partial t i)) ) in + (* use chain rule imperatively to compute narrow first derivative *) + let df_tmp = Array.create 8 zero in + let ( + ) = iadd in + let ( * ) = imul in + let _ = for j=0 to 7 do + let dfj = mth fpy.df j in + if is_zero dfj then rest + else for i=0 to 7 do + let r = mth (mth p j).l.df i in + if (is_zero r) then rest else df_tmp.(i) <- df_tmp.(i) + dfj * r; + done; + done in + let lin = mk_line ( fpy.f, Array.to_list df_tmp ) in + (* second derivative init *) + let fW_partial = table (fun i -> mk_interval(lower_partial fu i,upper_partial fu i)) in + let pW_partial = sparse_table (fun (_,_,z) ->not (is_zero z)) + (fun k i -> (k,i,(mk_interval(lower_partial (mth p k) i,upper_partial (mth p k) i)))) in + (* chain rule 4-nested loop!, but flattened with sparse table *) + let dcw = Array.make_matrix 8 8 zero in + let _ = for i=0 to 7 do for j=0 to 7 do for k=0 to 7 do + if (is_zero (mth2 (mth p k).dd i j)) then rest + else dcw.(i).(j) <- dcw.(i).(j) + mth fW_partial k * mth2 ((mth p k).dd) i j ; + done; done; done in + let len = List.length pW_partial in + let _ = for ki = 0 to len-1 do + let (k,i,rki) = List.nth pW_partial ki in + for mj=0 to len-1 do + let (m,j,rmj) = List.nth pW_partial mj in +(* Report.report (Printf.sprintf "k i m j rki rmj fuddkm = %d %d %d %d %f %f %f" k i m j rki.lo rmj.lo (mth2 fu.dd k m).lo); *) + dcw.(i).(j) <- dcw.(i).(j) + mth2 fu.dd k m * rki * rmj; (* innermost loop *) + done; done in + let dcw_list = map Array.to_list (Array.to_list dcw) in + make_taylor_interval(lin,w,dcw_list);; + +let rec evalf4 tf w x y z = match tf with + | Prim_a p -> evalf4A p w x y z + | Uni p -> evalf4U p w x y z + | Plus (tf1,tf2) -> ti_add(evalf4 tf1 w x y z, evalf4 tf2 w x y z) + | Product (tf1,tf2) -> ti_mul(evalf4 tf1 w x y z, evalf4 tf2 w x y z) + | Composite(h,g1,g2,g3,g4,g5,g6,g7,g8) -> + let [p1;p2;p3;p4;p5;p6;p7;p8] = map (fun t-> evalf4 t w x y z) [g1;g2;g3;g4;g5;g6;g7;g8] in + eval_composite (evalf4 h) p1 p2 p3 p4 p5 p6 p7 p8 w + | Scale (tf,t) -> ti_scale ((evalf4 tf w x y z),t) + | Uni_compose (uf,tf) -> + let ti = evalf4 tf w x y z in + let fy = ti.l.f in + let u_fy = uf.u fy in + let du_fy = uf.du fy in + let line = + let ( * ) = imul in + mk_line (u_fy, table (fun i -> du_fy * mth ti.l.df i)) in + let fx = mk_interval (lower_bound ti, upper_bound ti) in + let dfx = table (fun i -> mk_interval (lower_partial ti i, upper_partial ti i)) in + let du_fx = uf.du fx in + let ddu_fx = uf.ddu fx in + let dd = table2 (fun i j -> + let ( + ), ( * ) = iadd, imul in + (ddu_fx * mth dfx j) * mth dfx i + du_fx * mth2 ti.dd j i) in + make_taylor_interval(line, w, dd);; + + + +(* evalf4 (Composite(Uni (mk_primitiveU 0 uf),tf,unit,unit,unit,unit,unit,unit,unit)) w x y z;; *) + +let evalf tf x z = + let (y,w) = center_form (x,z) in + evalf4 tf w x y z;; + + +(* Evaluates a function (i = 0) and its first derivatives (i = 1, 2, ...) at the given interval *) +let rec evalf0 tf i x z = match tf with + | Prim_a p -> p.f_df i x z + | Uni p -> + let int = mk_interval (mth x p.slot, mth z p.slot) in + if i = 0 then eval p.uv int 0 + else if i = p.slot + 1 then eval p.uv int 1 + else zero + | Plus (tf1, tf2) -> iadd (evalf0 tf1 i x z) (evalf0 tf2 i x z) + | Product (tf1, tf2) -> + let itf1, itf2 = evalf0 tf1 0 x z, evalf0 tf2 0 x z in + if i = 0 then imul itf1 itf2 + else + let i_df1, i_df2 = evalf0 tf1 i x z, evalf0 tf2 i x z in + iadd (imul i_df1 itf2) (imul itf1 i_df2) + | Scale (tf, t) -> imul (evalf0 tf i x z) t + | Uni_compose (uf, tf) -> + let itf = evalf0 tf 0 x z in + if i = 0 then eval uf itf 0 + else + let i_df = evalf0 tf i x z in + imul (eval uf itf 1) i_df + | Composite (h,g1,g2,g3,g4,g5,g6,g7,g8) -> + let gs = [g1;g2;g3;g4;g5;g6;g7;g8] in + let ps = map (fun t -> let int = evalf0 t 0 x z in int.lo, int.hi) gs in + let x', z' = unzip ps in + if i = 0 then evalf0 h 0 x' z' + else + let dhs = table (fun j -> evalf0 h (j + 1) x' z') in + let dgs = map (fun t -> evalf0 t i x z) gs in + let ( + ), ( * ) = iadd, imul in + itlist2 (fun a b c -> a * b + c) dhs dgs zero;; + + +(* +let line_estimate_composite = + let ( + ) = iadd in + let ( * ) = imul in + fun h p1 p2 p3 p4 p5 p6 p7 p8 -> + let p = [p1;p2;p3;p4;p5;p6;p7;p8] in + let (a,b) = map (fun p -> p.f.lo) p, map (fun p -> p.f.hi) p in + let fN = evalf h a b in + let fN_partial = table (fun i -> mk_interval(lower_partial fN i,upper_partial fN i)) in + let pN_partial =table2(fun i j-> (mth (mth p i).df j)) in + let cN_partial2 = table2 (fun i j -> mth fN_partial j * mth2 pN_partial j i) in + let cN_partial = map (end_itlist ( + )) cN_partial2 in + mk_line ( fN.l.f, cN_partial );; + +let rec line_estimate tf y = match tf with + | Prim_a p -> line_estimateA p y + | Uni p -> line_estimateU p y + | Plus (p,q) -> ladd (line_estimate p y) (line_estimate q y) + | Scale (p,t) -> smul (line_estimate p y) t + | Uni_compose (uf,tf) -> + line_estimate (Composite(Uni { slot=0; uv=uf; },tf,unit,unit,unit,unit,unit,unit,unit)) y + | Composite(h,g1,g2,g3,g4,g5,g6,g7,g8) -> + let [p1;p2;p3;p4;p5;p6;p7;p8] = map (fun t-> line_estimate t y) [g1;g2;g3;g4;g5;g6;g7;g8] in + line_estimate_composite h p1 p2 p3 p4 p5 p6 p7 p8;; +*) + +end;; diff --git a/formal_lp/old/formal_interval/interval_m/types.hl b/formal_lp/old/formal_interval/interval_m/types.hl new file mode 100644 index 0000000..664f141 --- /dev/null +++ b/formal_lp/old/formal_interval/interval_m/types.hl @@ -0,0 +1,47 @@ + + + +exception Unstable;; (* generally thrown when there is a divide by zero *) + +exception Fatal;; (* generally indicates an uncorrected bug *) + +(* represents a closed interval [lo,hi] of the real line *) + +type interval = { + lo : float; + hi : float; +};; + +(* represents a function u:real->real, its derivative du, and 2nd derivative *) + +type univariate = { + u : interval -> interval; + du : interval -> interval; + ddu : interval -> interval; +};; + +(* represents the value f of function of six variables at some point y. + and the value df of its six partial derivatives, evaluated at the same point y. + The length of the list df should always be 8. +*) + +type line = { + f : interval; + df : (interval) list; +};; + +(* + represents approximation data for a function f on a rectangular domain [x,z]. + l gives the value and partial derivatives of f at some point y in the domain. + dd gives interval bounds on the second derivatives over the entire domain. + w i is an upper bound on widths (z i - y i) and (y i - x i). +*) + +type taylor_interval = { + l : line; + w : float list; + dd : interval list list; +};; + + + diff --git a/formal_lp/old/formal_interval/interval_m/univariate.hl b/formal_lp/old/formal_interval/interval_m/univariate.hl new file mode 100644 index 0000000..eb0c330 --- /dev/null +++ b/formal_lp/old/formal_interval/interval_m/univariate.hl @@ -0,0 +1,99 @@ + +(* port of univariate.cc + a univariate represents a function u:real->real. + its first derivative du:real->real + and its second derivative ddu;real->real. + + For example, if the function is x |-> x, + its derivative is x |-> 1, + and second derivative is x |-> 0, + which is implemented as ux1. + + We give a few other examples, sqrt, 1/x, atan. + + *) + +module Univariate = struct + +open Interval;; + +let eval uni x = function + | 0 -> uni.u x + | 1 -> uni.du x + | _ -> uni.ddu x;; + +let mk_univariate (u1,du1,ddu1) = { u = u1; du = du1; ddu = ddu1; };; + +let raise_zero x = bounded_from_zero x or raise Unstable ;; + +(* here are a couple of examples *) + +let ux1 = + mk_univariate( + (fun x -> x), + (fun x -> one), + (fun x-> zero) + );; + +let usqrt = + let ( / ) = idiv in + let ( * ) = imul in + mk_univariate( + isqrt, + + (fun x -> + let _ = raise_zero x in + one / (two * isqrt x)), + + (fun x -> + let _ = raise_zero x in + ineg (one / ((two * isqrt x) * (two * x)))) +);; + +let uinv = + let ( / ) = idiv in + let ( * ) = imul in + mk_univariate( + (fun x -> + let _ = raise_zero x in + one / x), + + (fun x -> + let _ = raise_zero x in + ineg (one / ( x * x))), + + (fun x -> + let _ = raise_zero x in + two / ( x * (x * x))) + );; + +let uatan = + let ( / ) = idiv in + let ( * ) = imul in + let ( + ) = iadd in + mk_univariate( + iatan, + + (fun x -> + one / (one + x * x)), + + (fun x -> + let t = one / (one + x * x) in + (ineg two * x) * (t * t)) + );; + + +let uacos = + let ( / ) = idiv in + let ( * ) = imul in + let ( - ) = isub in + mk_univariate( + iacos, + (fun x -> + ineg (one / isqrt (one - x * x))), + (fun x -> + let t = one - x * x in + ineg (x / isqrt (t * t * t))) + );; + +end;; diff --git a/formal_lp/old/formal_interval/interval_m/verifier.hl b/formal_lp/old/formal_interval/interval_m/verifier.hl new file mode 100644 index 0000000..85a3ad7 --- /dev/null +++ b/formal_lp/old/formal_interval/interval_m/verifier.hl @@ -0,0 +1,414 @@ +flyspeck_needs "../formal_lp/formal_interval/interval_m/recurse.hl";; +flyspeck_needs "../formal_lp/formal_interval/interval_m/recurse0.hl";; + +module Verifier = struct + +open Interval;; +open Univariate;; +open Line_interval;; +open Taylor;; +open Recurse;; + + + +(****************************) +(* Interval functions for the native OCaml arithmetic *) + +type int_fun = + | F_int_var of int + | F_int_const of interval + | F_int_pow of int * int_fun + | F_int_neg of int_fun + | F_int_add of int_fun * int_fun + | F_int_sub of int_fun * int_fun + | F_int_mul of int_fun * int_fun;; + + +let ipow = Arith_misc.gen_pow imul Interval.one;; + + +let eval_int_fun i_fun = + fun x -> + let rec eval_rec f = + match f with + | F_int_var i -> List.nth x (i - 1) + | F_int_const int -> int + | F_int_neg f1 -> ineg (eval_rec f1) + | F_int_pow (n,f1) -> ipow n (eval_rec f1) + | F_int_add (f1,f2) -> iadd (eval_rec f1) (eval_rec f2) + | F_int_sub (f1,f2) -> isub (eval_rec f1) (eval_rec f2) + | F_int_mul (f1,f2) -> imul (eval_rec f1) (eval_rec f2) in + eval_rec i_fun;; + +(**********************************) +let run_test f x z min_flag min_max allow_d convex_flag mono_pass_flag raw_int_flag eps = + let pad = replicate 0.0 (8 - length x) in + let xx = x @ pad and zz = z @ pad in + let mone = mk_interval(-1.0,-1.0) in + let neg_f = Scale(f, mone) in + let ff = if min_flag then + Plus(neg_f, Scale(unit,mk_interval(min_max, min_max))) + else + Plus(f, Scale(unit, ineg (mk_interval(min_max, min_max)))) in + let opt = { + only_check_deriv1_negative = false; + is_using_dihmax =false; + is_using_bigface126 =false; + width_cutoff =0.05; + allow_sharp =false; + allow_derivatives =allow_d; + iteration_count =0; + iteration_limit =0; + recursion_depth =200; + mono_pass = mono_pass_flag; + convex_flag = convex_flag; + raw_int_flag = raw_int_flag; + eps = eps; + } in + recursive_verifier(0,xx,zz,xx,zz,ff,opt);; + + + +open Recurse0;; + + +let run_test0 f x z min_flag min_max allow_d convex_flag mono_pass_flag eps = + let pad = replicate 0.0 (8 - length x) in + let xx = x @ pad and zz = z @ pad in + let mone = mk_interval(-1.0,-1.0) in + let neg_f = Scale(f, mone) in + let ff = if min_flag then + Plus(neg_f, Scale(unit,mk_interval(min_max, min_max))) + else + Plus(f, Scale(unit, ineg (mk_interval(min_max, min_max)))) in + let opt = { + only_check_deriv1_negative = false; + is_using_dihmax =false; + is_using_bigface126 =false; + width_cutoff =0.05; + allow_sharp =false; + allow_derivatives =allow_d; + iteration_count =0; + iteration_limit =0; + recursion_depth =200; + mono_pass = mono_pass_flag; + convex_flag = convex_flag; + raw_int_flag = true; + eps = eps; + } in + recursive_verifier0(0,xx,zz,xx,zz,ff,opt);; + + + +(****************************************) + + + + +(*************) + +let domain_str x z = + let s1 = map string_of_float x and + s2 = map string_of_float z in + sprintf "[%s], [%s]" (String.concat "; " s1) (String.concat "; " s2);; + +let path_str p = + String.concat "," (map (fun s, j -> sprintf "%s(%d)" s j) p);; + + +(* get_results0 *) +(* This function finds all subtrees of the given solution tree which can be + veified immediately (no Result_pass_mono). These subtrees are added to + the accumulator. Paths to the roots of all subtrees are also saved in + the accumulator. The third returned value is a solution tree where all + found subtrees are replaced with Result_pass_ref j, with j = #of the corresponding + subtree in the accumulator (1-based) *) + + +let get_results0 path r acc = + let dummy_tree = Result_false ([], []) in + let is_ref r = match r with Result_pass_ref _ -> true | _ -> false in + + let rec get_rec path r acc = + match r with + | Result_mono (mono, r1) -> + let get_m m = (if m.decr_flag then "ml" else "mr"), m.variable in + let path' = rev_itlist (fun m l -> get_m m :: l) mono path in + let flag, acc', tree = get_rec path' r1 acc in + if flag then true, acc', dummy_tree + else false, acc', Result_mono (mono, tree) + | Result_glue (j, convex_flag, r1, r2) -> + let s1, s2 = if convex_flag then "ml", "mr" else "l", "r" in + let p1, p2 = ((s1, j + 1) :: path), ((s2, j + 1) :: path) in + let flag1, acc1, tree1 = get_rec p1 r1 acc in + let flag2, acc', tree2 = get_rec p2 r2 acc1 in + let n = (length acc' + 1) in + if flag1 then + if flag2 then + true, acc', dummy_tree + else if is_ref r1 then + false, acc', Result_glue (j, convex_flag, r1, tree2) + else + false, acc' @ [rev p1, r1], Result_glue (j, convex_flag, Result_pass_ref n, tree2) + else + if flag2 then + if is_ref r2 then + false, acc', Result_glue (j, convex_flag, tree1, r2) + else + false, acc' @ [rev p2, r2], Result_glue (j, convex_flag, tree1, Result_pass_ref n) + else + false, acc', Result_glue (j, convex_flag, tree1, tree2) + + | Result_pass_mono _ -> false, acc, r + | _ -> true, acc, dummy_tree in + + get_rec path r acc;; + + + + +(* transform_result *) + + +let transform_result x z r = + (* get_domain *) + (* Subdivides the given domain (x,z) according to the given path *) + let domain_hash = Hashtbl.create 1000 in + let find_hash, mem_hash, add_hash = + Hashtbl.find domain_hash, Hashtbl.mem domain_hash, Hashtbl.add domain_hash in + + let get_domain path = + let n = length x in + let table f = map f (0--(n - 1)) in + let rec rec_domain (x, z) path hash = + match path with + | [] -> x, z + | (s, j) :: ps -> + let hash' = hash^s^(string_of_int j) in + if mem_hash hash' then + rec_domain (find_hash hash') ps hash' + else + let j = j - 1 in + let domain' = + if s = "l" or s = "r" then + let ( ++ ), ( / ) = up(); upadd, updiv in + let yj = (mth x j ++ mth z j) / 2.0 in + let delta b v = table (fun i -> if i = j && b then yj else mth v i) in + if s = "l" then + delta false x, delta true z + else + delta true x, delta false z + else + if s = "ml" then + x, table (fun i -> if i = j then mth x i else mth z i) + else + table (fun i -> if i = j then mth z i else mth x i), z in + let _ = add_hash hash' domain' in + rec_domain domain' ps hash' in + rec_domain (x,z) path "" in + + (* sub_domain *) + (* Verifies if interval [x',z'] SUBSET interval [x,z] *) + let sub_domain (x',z') (x,z) = + let le a b = itlist2 (fun a b c -> c & (a <= b)) a b true in + le x x' & le z' z in + + (* transform_pass_mono *) + (* Replaces all (Result_pass_mono m) with (Result_mono [m] (Result_ref j)) where + j is the reference to the corresponding domain *) + let transform_pass_mono x z domains r = + let domains_i = zip domains (1--length domains) in + + let find_domain x' z' = + try find (fun d, _ -> sub_domain (x', z') d) domains_i with Failure _ -> (x,z), -1 in + + let get_m m = (if m.decr_flag then "ml" else "mr"), m.variable in + + let rec rec_transform path r = + match r with + | Result_mono (mono, r1) -> + let path' = rev_itlist (fun m l -> get_m m :: l) mono path in + Result_mono (mono, rec_transform path' r1) + | Result_glue (j, convex_flag, r1, r2) -> + let s1, s2 = if convex_flag then "ml", "mr" else "l", "r" in + let p1, p2 = ((s1, j + 1) :: path), ((s2, j + 1) :: path) in + let t1 = rec_transform p1 r1 in + let t2 = rec_transform p2 r2 in + Result_glue (j, convex_flag, t1, t2) + | Result_pass_mono m -> + let path' = rev (get_m m :: path) in + let x', z' = get_domain path' in + let _, i = find_domain x' z' in + (* let _ = report (sprintf "p = %s, d = %s, found: %d" + (domain_str x' z') (path_str path') i) in *) + if i >= 0 then Result_mono ([m], Result_pass_ref (-i)) else r + | _ -> r in + + rec_transform [] r in + + let rec transform acc r = + let flag, rs, r' = get_results0 [] r acc in + if flag then (rs @ [[], r]) + else + let domains = map (fun p, _ -> get_domain p) rs in + let r_next = transform_pass_mono x z domains r' in + let _ = r_next <> r' or failwith "transform_result: deadlock" in + transform rs r_next in + transform [] r;; + + + + + + +(* +let pp = 8;; +let n = 7;; +let xx = `[-- &1; -- &1; -- &1; -- &1; -- &1; -- &1; -- &1]` and + zz = `[&1; &1; &1; &1; &1; &1; &1]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +let eval0_magnetism, eval_magnetism, tf_magnetism = + mk_verification_functions pp magnetism_poly true magnetism_min;; +let c1 = run_test tf_magnetism xx_float zz_float false 0.0 true false true;; +let c0 = run_test0 tf_magnetism xx_float zz_float false 0.0 true false true;; +(* 77 *) +result_size c1;; +(* 121 *) +result_size c0;; + +let r = transform_result xx_float zz_float c1;; +r;; +length r;; +let x = map (fun _, r -> + match r with | Result_pass_ref j -> 1 | _ -> 0) r;; +itlist (+) x 0;; + +map (fun _, r -> + match r with + | Result_pass _ -> "pass" + | Result_mono _ -> "mono" + | Result_glue _ -> "glue" + | Result_false _ -> "_|_" + | Result_pass_mono _ -> "pass_mono" + | Result_pass_ref _ -> "ref" + ) r;; + + +length it;; +transform_result xx_float zz_float c0;; + +let pp = 5;; +let n = 2;; + +let poly_tm = expr_to_vector_fun `x1 pow 2 + x2 pow 2`;; + +let xx = `[-- &6; -- &6]` and + zz = `[&1; &2]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +let eval0_poly, eval_poly, tf_poly = mk_verification_functions pp poly_tm true `-- &1`;; +let c1 = run_test tf_poly xx_float zz_float false 0.0 true false true;; + +transform_result xx_float zz_float c1;; + +let c0 = run_test0 tf_poly xx_float zz_float false 0.0 true false true;; +(* 22 *) +result_size c1;; +(* 38 *) +result_size c0;; +m_verify_raw n pp eval0_poly eval_poly c1 xx1 zz1;; +m_verify_raw n pp eval0_poly eval_poly c1 xx1 zz1;; + + + +transform_result xx_float zz_float c1;; + +let flag, rs1, r1 = get_results0 [] c1 [];; +rs1;; +r1;; +let domains = map (fun p, _ -> get_domain xx_float zz_float p) rs1;; +let r2 = transform_pass_mono xx_float zz_float domains r1;; + +let flag, rs3, r3 = get_results0 [] r2 rs1;; +rs3;; +r3;; +let domains = map (fun p, _ -> get_domain xx_float zz_float p) rs3;; +let r4 = transform_pass_mono xx_float zz_float domains r3;; + +let flag, rs5, r5 = get_results0 [] r4 rs3;; +rs5;; +r5;; + + + +test 1000 (get_results0 [] c1) [];; +test 1000 (map (fun p, _ -> get_domain xx_float zz_float p)) rs1;; +test 1000 (transform_pass_mono xx_float zz_float domains) r1;; + +let flag, rs3, r3 = get_results0 [] r2 rs1;; +let domains = map (fun p, _ -> get_domain xx_float zz_float p) rs3;; +let r4 = transform_pass_mono xx_float zz_float domains r3;; + +let flag, rs5, r5 = get_results0 [] r4 rs3;; +*) + + + +let result_stat result = + let pass = ref 0 and + mono = ref 0 and + glue = ref 0 and + pass_mono = ref 0 and + pass_raw = ref 0 and + glue_convex = ref 0 in + + let rec count r = + match r with + | Result_false _ -> failwith "False result" + | Result_pass (flag, _, _) -> + pass := !pass + 1; + if flag then pass_raw := !pass_raw + 1 else () + | Result_pass_mono _ -> pass_mono := !pass_mono + 1 + | Result_mono (_, r1) -> mono := !mono + 1; count r1 + | Result_glue (_, flag, r1, r2) -> + glue := !glue + 1; + if flag then glue_convex := !glue_convex + 1 else (); + count r1; count r2 in + + let _ = count result in + let s = sprintf "pass = %d (pass_raw = %d)\nmono = %d\nglue = %d (glue_convex = %d)\npass_mono = %d" + !pass !pass_raw !mono !glue !glue_convex !pass_mono in + report s;; + + +let result_p_stat glue_flag p_result = + let p_table = Hashtbl.create 10 in + let add1 p = + let c = if Hashtbl.mem p_table p then Hashtbl.find p_table p else 0 in + Hashtbl.replace p_table p (succ c) in + + let rec count r = + match r with + | P_result_ref _ -> () + | P_result_pass (pp, _) -> add1 pp.pp + | P_result_mono (pp, _, r1) -> add1 pp.pp; count r1 + | P_result_glue (pp, _, _, r1, r2) -> + if glue_flag then add1 pp.pp else (); + count r1; count r2 in + + let _ = count p_result in + let s = Hashtbl.fold + (fun p c s -> (sprintf "p = %d: %d\n" p c) ^ s) p_table "" in + report s;; + + +end;; diff --git a/formal_lp/old/formal_interval/lin_approx.hl b/formal_lp/old/formal_interval/lin_approx.hl new file mode 100644 index 0000000..2958363 --- /dev/null +++ b/formal_lp/old/formal_interval/lin_approx.hl @@ -0,0 +1,641 @@ +needs "../formal_lp/formal_interval/more_float.hl";; + + +(*******************************************) + +(* Given two terms (\x. f1 x) and (\x. f2 x) and a binary operation, + returns an equality theorem + \x. (\x. f1 x) x (op) (\x. f2 x) x = \x. f1 x (op) f2 x *) +let binary_beta_eq f1_tm f2_tm op_tm = + let beta_tm1, beta_tm2 = mk_comb (f1_tm, x_var_real), mk_comb (f2_tm, x_var_real) in + let beta_th1 = if is_abs f1_tm then BETA beta_tm1 else REFL beta_tm1 and + beta_th2 = if is_abs f2_tm then BETA beta_tm2 else REFL beta_tm2 in + ABS x_var_real (MK_COMB (AP_TERM op_tm beta_th1, beta_th2));; + + +let unary_beta_eq f_tm op_tm = + let beta_tm = mk_comb (f_tm, x_var_real) in + let beta_th = if is_abs f_tm then BETA beta_tm else REFL beta_tm in + ABS x_var_real (AP_TERM op_tm beta_th);; + + + +(*****************************************) +(* mk_lin_approx, dest_lin_approx *) + + +let MK_LIN_APPROX' = (RULE o MATCH_MP EQ_IMP o SYM o SPEC_ALL) lin_approx_eq;; +let DEST_LIN_APPROX' = (RULE o MATCH_MP EQ_IMP o SPEC_ALL) lin_approx_eq;; + + +let dest_lin_approx approx_tm = + let lhs, df_bounds = dest_comb approx_tm in + let lhs2, f_bounds = dest_comb lhs in + let lhs3, x_tm = dest_comb lhs2 in + let f_tm = rand lhs3 in + f_tm, x_tm, f_bounds, df_bounds;; + + +let lin_approx_components approx_th = + let f_tm, x_tm, f_bounds, df_bounds = dest_lin_approx (concl approx_th) in + let th0 = INST[f_tm, f_var_fun; x_tm, x_var_real; + f_bounds, f_bounds_var; df_bounds, df_bounds_var] DEST_LIN_APPROX' in + let th1 = MY_PROVE_HYP approx_th th0 in + let [r1; r2; r3] = CONJUNCTS th1 in + (r1, r2, r3);; + + +let mk_lin_approx f_bounds_th df_bounds_th diff_th = + let lhs, f_bounds = dest_comb (concl f_bounds_th) in + let fx_tm = rand lhs in + let f_tm, x_tm = dest_comb fx_tm in + let df_bounds = (rand o concl) df_bounds_th in + (MY_PROVE_HYP f_bounds_th o MY_PROVE_HYP df_bounds_th o MY_PROVE_HYP diff_th o + INST[f_tm, f_var_fun; x_tm, x_var_real; f_bounds, f_bounds_var; df_bounds, df_bounds_var]) + MK_LIN_APPROX';; + + + +(***************************) +(* f(x) = x *) +let LIN_APPROX_X' = RULE lin_approx_x;; + +let eval_lin_approx_x x_tm = + INST[x_tm, x_var_real] LIN_APPROX_X';; + + +(***************************) +(* f(x) = c *) +let LIN_APPROX_CONST' = RULE lin_approx_const;; + + +let c_var_real = `c:real`;; + + +let eval_lin_approx_const c_tm x_tm = + INST[c_tm, c_var_real; x_tm, x_var_real] LIN_APPROX_CONST';; + + +(*******************************) +(* f(x) = atn x *) + +let MK_LIN_APPROX_ATN' = (UNDISCH_ALL o REWRITE_RULE[derivative_atn] o DISCH_ALL o + MY_PROVE_HYP (SPEC_ALL REAL_DIFFERENTIABLE_AT_ATN) o + INST[`atn`, `f:real->real`]) MK_LIN_APPROX';; + + +let eval_lin_approx_atn pp x_tm = + let x_th = mk_const_interval x_tm in + let d_th = float_interval_inv pp (float_interval_add pp one_interval (float_interval_mul pp x_th x_th)) in + let atn_th = float_interval_atn pp x_th in + let f_bounds = (rand o concl) atn_th in + let df_bounds = (rand o concl) d_th in + let th0 = INST[x_tm, x_var_real; f_bounds, f_bounds_var; df_bounds, df_bounds_var] MK_LIN_APPROX_ATN' in + MY_PROVE_HYP d_th (MY_PROVE_HYP atn_th th0);; + + +(**************************************) +(* f(x) = inv x *) + +let MK_LIN_APPROX_INV' = (UNDISCH_ALL o prove) + (`(x = &0 <=> F) ==> + interval_arith (inv x) f_bounds ==> + interval_arith (--(inv x * inv x)) df_bounds ==> + lin_approx inv x f_bounds df_bounds`, + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[lin_approx_eq] THEN + ASM_SIMP_TAC[derivative_inv; REAL_DIFFERENTIABLE_AT_INV; REAL_INV_MUL]);; + +let eval_lin_approx_inv pp x_tm = + let x_th = mk_const_interval x_tm in + let inv_th = float_interval_inv pp x_th in + let d_th = + let neg = float_interval_neg and + ( * ) = float_interval_mul pp in + neg (inv_th * inv_th) in + let f_bounds = (rand o concl) inv_th and + df_bounds = (rand o concl) d_th in + let xn0_th = float_eq0 x_tm in + (MY_PROVE_HYP xn0_th o MY_PROVE_HYP inv_th o MY_PROVE_HYP d_th o + INST[x_tm, x_var_real; f_bounds, f_bounds_var; df_bounds, df_bounds_var]) + MK_LIN_APPROX_INV';; + + + +(**************************************) +(* f(x) = sqrt x *) + +let MK_LIN_APPROX_SQRT' = (UNDISCH_ALL o prove) + (`(&0 < x <=> T) ==> + interval_arith (sqrt x) f_bounds ==> + interval_arith (inv(&2 * sqrt x)) df_bounds ==> + lin_approx sqrt x f_bounds df_bounds`, + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[lin_approx_eq] THEN + ASM_SIMP_TAC[derivative_sqrt; REAL_DIFFERENTIABLE_AT_SQRT]);; + + +let eval_lin_approx_sqrt pp x_tm = + let x_th = mk_const_interval x_tm in + let sqrt_th = float_interval_sqrt pp x_th in + let d_th = + let ( * ) = float_interval_mul pp and + inv = float_interval_inv pp in + inv (two_interval * sqrt_th) in + let f_bounds = (rand o concl) sqrt_th and + df_bounds = (rand o concl) d_th in + let x_pos_th = float_gt0 x_tm in + (MY_PROVE_HYP x_pos_th o MY_PROVE_HYP sqrt_th o MY_PROVE_HYP d_th o + INST[x_tm, x_var_real; f_bounds, f_bounds_var; df_bounds, df_bounds_var]) + MK_LIN_APPROX_SQRT';; + +(* +eval_lin_approx_sqrt 5 two_float;; +let x = 2;; +*) + + +(**************************************) +(* f(x) = acs x *) + +let MK_LIN_APPROX_ACS' = (UNDISCH_ALL o GEN_REWRITE_RULE (LAND_CONV o LAND_CONV o RAND_CONV) [(SYM o FLOAT_TO_NUM_CONV) one_float] o prove) + (`(abs x < &1 <=> T) ==> + interval_arith (acs x) f_bounds ==> + interval_arith (--inv (sqrt (&1 - x * x))) df_bounds ==> + lin_approx acs x f_bounds df_bounds`, + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[lin_approx_eq] THEN + ASM_SIMP_TAC[derivative_acs; REAL_DIFFERENTIABLE_AT_ACS]);; + +let abs_tm = `abs`;; +let check_abs_lt_1 x_tm = + let abs_eq = float_abs (mk_comb (abs_tm, x_tm)) in + let lt_th = float_lt (rand (concl abs_eq)) one_float in + if (fst o dest_const o rand o concl) lt_th <> "T" then + failwith "check_abs_lt_1: abs < 1 <=> F" + else + let th0 = AP_THM (AP_TERM lt_op_real abs_eq) one_float in + TRANS th0 lt_th;; + + + +let eval_lin_approx_acs pp x_tm = + let x_th = mk_const_interval x_tm in + let acs_th = float_interval_acs pp x_th in + let d_th = + let ( * ) = float_interval_mul pp and + inv = float_interval_inv pp and + sqrt = float_interval_sqrt pp and + neg = float_interval_neg and + (-) = float_interval_sub pp in + neg (inv (sqrt (one_interval - x_th * x_th))) in + let f_bounds = (rand o concl) acs_th and + df_bounds = (rand o concl) d_th in + let x_abs_th = check_abs_lt_1 x_tm in + (MY_PROVE_HYP x_abs_th o MY_PROVE_HYP acs_th o MY_PROVE_HYP d_th o + INST[x_tm, x_var_real; f_bounds, f_bounds_var; df_bounds, df_bounds_var]) + MK_LIN_APPROX_ACS';; + + + + +(*************************) +(* lin_approx arithmetic *) +(*************************) + + +(********************************) +(* lin_approx_neg *) + +let MK_LIN_APPROX_NEG' = (UNDISCH_ALL o prove) + (`f real_differentiable atreal x ==> + interval_arith (--f x) f_bounds ==> + interval_arith (--derivative f x) df_bounds ==> + lin_approx (\x. --f x) x f_bounds df_bounds`, + REPEAT DISCH_TAC THEN ASM_REWRITE_TAC[lin_approx_eq] THEN + ASM_SIMP_TAC[REAL_DIFFERENTIABLE_NEG; derivative_neg]);; + + +let lin_approx_neg approx1 = + let diff1_th, f1_th, df1_th = lin_approx_components approx1 in + let f1_tm = (lhand o concl) diff1_th and + x_tm = (rand o rand o concl) diff1_th in + + let f_th = float_interval_neg f1_th and + df_th = float_interval_neg df1_th in + + let f_bounds = (rand o concl) f_th and + df_bounds = (rand o concl) df_th in + + (MY_PROVE_HYP diff1_th o MY_PROVE_HYP f_th o MY_PROVE_HYP df_th o + INST[f1_tm, f_var_fun; x_tm, x_var_real; + f_bounds, f_bounds_var; df_bounds, df_bounds_var]) MK_LIN_APPROX_NEG';; + + + +(* +let pp = 5;; +let approx1 = eval_lin_approx_atn pp one_float;; +let approx2 = eval_lin_approx_x one_float;; +lin_approx_neg approx1;; +lin_approx_neg approx2;; +*) + + + +(********************************) +(* lin_approx_add *) + +let MK_LIN_APPROX_ADD' = (UNDISCH_ALL o prove) + (`f real_differentiable atreal x ==> g real_differentiable atreal x ==> + interval_arith (f x + g x) f_bounds ==> + interval_arith (derivative f x + derivative g x) df_bounds ==> + lin_approx (\x. f x + g x) x f_bounds df_bounds`, + REPEAT DISCH_TAC THEN ASM_REWRITE_TAC[lin_approx_eq] THEN + ASM_SIMP_TAC[REAL_DIFFERENTIABLE_ADD; derivative_add]);; + + +let lin_approx_add pp approx1 approx2 = + let diff1_th, f1_th, df1_th = lin_approx_components approx1 and + diff2_th, f2_th, df2_th = lin_approx_components approx2 in + let f1_tm = (lhand o concl) diff1_th and + f2_tm = (lhand o concl) diff2_th and + x_tm = (rand o rand o concl) diff1_th in + + let f_th = float_interval_add pp f1_th f2_th and + df_th = float_interval_add pp df1_th df2_th in + + let f_bounds = (rand o concl) f_th and + df_bounds = (rand o concl) df_th in + + (MY_PROVE_HYP diff1_th o MY_PROVE_HYP diff2_th o MY_PROVE_HYP f_th o MY_PROVE_HYP df_th o + INST[f1_tm, f_var_fun; f2_tm, g_var_fun; x_tm, x_var_real; + f_bounds, f_bounds_var; df_bounds, df_bounds_var]) MK_LIN_APPROX_ADD';; + + + +(* +let pp = 5;; +let approx1 = eval_lin_approx_atn pp one_float;; +let approx2 = eval_lin_approx_x one_float;; +lin_approx_add pp (eval_lin_approx_add pp approx2 approx2) approx1;; +*) + + + +(********************************) +(* lin_approx_sub *) + +let MK_LIN_APPROX_SUB' = (UNDISCH_ALL o prove) + (`f real_differentiable atreal x ==> g real_differentiable atreal x ==> + interval_arith (f x - g x) f_bounds ==> + interval_arith (derivative f x - derivative g x) df_bounds ==> + lin_approx (\x. f x - g x) x f_bounds df_bounds`, + REPEAT DISCH_TAC THEN ASM_REWRITE_TAC[lin_approx_eq] THEN + ASM_SIMP_TAC[REAL_DIFFERENTIABLE_SUB; derivative_sub]);; + + +let lin_approx_sub pp approx1 approx2 = + let diff1_th, f1_th, df1_th = lin_approx_components approx1 and + diff2_th, f2_th, df2_th = lin_approx_components approx2 in + let f1_tm = (lhand o concl) diff1_th and + f2_tm = (lhand o concl) diff2_th and + x_tm = (rand o rand o concl) diff1_th in + + let f_th = float_interval_sub pp f1_th f2_th and + df_th = float_interval_sub pp df1_th df2_th in + + let f_bounds = (rand o concl) f_th and + df_bounds = (rand o concl) df_th in + + (MY_PROVE_HYP diff1_th o MY_PROVE_HYP diff2_th o MY_PROVE_HYP f_th o MY_PROVE_HYP df_th o + INST[f1_tm, f_var_fun; f2_tm, g_var_fun; x_tm, x_var_real; + f_bounds, f_bounds_var; df_bounds, df_bounds_var]) MK_LIN_APPROX_SUB';; + + + +(* +let pp = 5;; +let approx1 = eval_lin_approx_atn pp one_float;; +let approx2 = eval_lin_approx_x one_float;; +lin_approx_sub pp approx1 approx2;; +*) + + + +(********************************) +(* lin_approx_mul *) + +let MK_LIN_APPROX_MUL' = (UNDISCH_ALL o prove) + (`f real_differentiable atreal x ==> g real_differentiable atreal x ==> + interval_arith (f x * g x) f_bounds ==> + interval_arith (f x * derivative g x + derivative f x * g x) df_bounds ==> + lin_approx (\x. f x * g x) x f_bounds df_bounds`, + REPEAT DISCH_TAC THEN ASM_REWRITE_TAC[lin_approx_eq] THEN + ASM_SIMP_TAC[REAL_DIFFERENTIABLE_MUL_ATREAL; derivative_mul]);; + + +let lin_approx_mul pp approx1 approx2 = + let diff1_th, f1_th, df1_th = lin_approx_components approx1 and + diff2_th, f2_th, df2_th = lin_approx_components approx2 in + let f1_tm = (lhand o concl) diff1_th and + f2_tm = (lhand o concl) diff2_th and + x_tm = (rand o rand o concl) diff1_th in + + let f_th, df_th = + let (+) = float_interval_add pp and + ( * ) = float_interval_mul pp in + f1_th * f2_th, f1_th * df2_th + df1_th * f2_th in + + let f_bounds = (rand o concl) f_th and + df_bounds = (rand o concl) df_th in + + (MY_PROVE_HYP diff1_th o MY_PROVE_HYP diff2_th o MY_PROVE_HYP f_th o MY_PROVE_HYP df_th o + INST[f1_tm, f_var_fun; f2_tm, g_var_fun; x_tm, x_var_real; + f_bounds, f_bounds_var; df_bounds, df_bounds_var]) MK_LIN_APPROX_MUL';; + + +(* +let pp = 5;; +let approx1 = eval_lin_approx_atn (pp + 2) one_float;; +let approx2 = eval_lin_approx_x one_float;; +lin_approx_mul pp approx1 approx1;; +*) + + +(********************************) +(* lin_approx_div *) + +let MK_LIN_APPROX_DIV' = (UNDISCH_ALL o prove) + (`interval_arith (g x) g_bounds ==> interval_not_zero g_bounds ==> + f real_differentiable atreal x ==> g real_differentiable atreal x ==> + interval_arith (f x / g x) f_bounds ==> + interval_arith ((derivative f x * g x - f x * derivative g x) / (g x * g x)) df_bounds ==> + lin_approx (\x. f x / g x) x f_bounds df_bounds`, + REPEAT DISCH_TAC THEN ASM_REWRITE_TAC[lin_approx_eq] THEN + SUBGOAL_THEN `~((g:real->real) x = &0)` ASSUME_TAC THENL + [ + MATCH_MP_TAC (REWRITE_RULE[IMP_IMP] interval_arith_not_zero) THEN + EXISTS_TAC `g_bounds:real#real` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[REAL_DIFFERENTIABLE_DIV_ATREAL; derivative_div]);; + + +let lin_approx_div pp approx1 approx2 = + let diff1_th, f1_th, df1_th = lin_approx_components approx1 and + diff2_th, f2_th, df2_th = lin_approx_components approx2 in + let f1_tm = (lhand o concl) diff1_th and + f2_tm = (lhand o concl) diff2_th and + x_tm = (rand o rand o concl) diff1_th and + g_bounds = (rand o concl) f2_th in + + let not_zero_th = check_interval_not_zero g_bounds in + let f_th, df_th = + let (-) = float_interval_sub pp and + ( * ) = float_interval_mul pp and + (/) = float_interval_div pp in + f1_th / f2_th, (df1_th * f2_th - f1_th * df2_th) / (f2_th * f2_th) in + + let f_bounds = (rand o concl) f_th and + df_bounds = (rand o concl) df_th in + + (MY_PROVE_HYP not_zero_th o MY_PROVE_HYP f2_th o + MY_PROVE_HYP diff1_th o MY_PROVE_HYP diff2_th o + MY_PROVE_HYP f_th o MY_PROVE_HYP df_th o + INST[f1_tm, f_var_fun; f2_tm, g_var_fun; x_tm, x_var_real; + f_bounds, f_bounds_var; df_bounds, df_bounds_var; + g_bounds, g_bounds_var]) MK_LIN_APPROX_DIV';; + + +(* +let pp = 5;; +let approx1 = eval_lin_approx_atn (pp + 2) one_float;; +let approx2 = eval_lin_approx_x one_float;; +let approx3 = eval_lin_approx_atn 4 (mk_float 0 50);; +lin_approx_div pp approx1 approx2;; +lin_approx_div pp approx2 approx1;; +*) + + + +(********************************) +(* lin_approx_atn *) + +let atn_tm = `atn`;; + +let MK_LIN_APPROX_COMPOSE_ATN' = (UNDISCH_ALL o prove) + (`f real_differentiable atreal x ==> + interval_arith (atn (f x)) f_bounds ==> + interval_arith (derivative f x / (&1 + f x * f x)) df_bounds ==> + lin_approx (\x. atn (f x)) x f_bounds df_bounds`, + REPEAT DISCH_TAC THEN ASM_REWRITE_TAC[lin_approx_eq] THEN + ASM_SIMP_TAC[derivative_compose_atn]);; + + +let lin_approx_atn pp approx1 = + let diff1_th, f1_th, df1_th = lin_approx_components approx1 in + let f1_tm = (lhand o concl) diff1_th and + x_tm = (rand o rand o concl) diff1_th in + + let f_th, df_th = + let (+) = float_interval_add pp and + ( * ) = float_interval_mul pp and + (/) = float_interval_div pp and + atn = float_interval_atn pp in + atn f1_th, df1_th / (one_interval + f1_th * f1_th) in + + let f_bounds = (rand o concl) f_th and + df_bounds = (rand o concl) df_th in + + (MY_PROVE_HYP diff1_th o MY_PROVE_HYP f_th o MY_PROVE_HYP df_th o + INST[f1_tm, f_var_fun; x_tm, x_var_real; + f_bounds, f_bounds_var; df_bounds, df_bounds_var]) MK_LIN_APPROX_COMPOSE_ATN';; + + + +(* +let pp = 5;; +let approx1 = eval_lin_approx_atn (pp + 2) one_float;; +let approx2 = eval_lin_approx_x one_float;; +let approx3 = eval_lin_approx_atn 4 (mk_float 0 50);; +lin_approx_atn pp approx1;; +lin_approx_atn pp approx2;; +lin_approx_atn pp approx3;; +*) + + + +(********************************) +(* lin_approx_inv *) + +let inv_tm = `inv`;; + +let MK_LIN_APPROX_COMPOSE_INV' = (UNDISCH_ALL o prove) + (`interval_arith (f x) int ==> interval_not_zero int ==> + f real_differentiable atreal x ==> + interval_arith (inv (f x)) f_bounds ==> + interval_arith (--(derivative f x * inv(f x) * inv(f x))) df_bounds ==> + lin_approx (\x. inv (f x)) x f_bounds df_bounds`, + REWRITE_TAC[GSYM REAL_INV_MUL] THEN REWRITE_TAC[GSYM REAL_MUL_RNEG] THEN ONCE_REWRITE_TAC[REAL_MUL_SYM] THEN + REPEAT DISCH_TAC THEN ASM_REWRITE_TAC[lin_approx_eq] THEN + SUBGOAL_THEN `~((f:real->real) x = &0)` ASSUME_TAC THENL + [ + MATCH_MP_TAC (REWRITE_RULE[IMP_IMP] interval_arith_not_zero) THEN + EXISTS_TAC `int:real#real` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[derivative_compose_inv]);; + + +let lin_approx_inv pp approx1 = + let diff1_th, f1_th, df1_th = lin_approx_components approx1 in + let f1_tm = (lhand o concl) diff1_th and + x_tm = (rand o rand o concl) diff1_th and + int_tm = (rand o concl) f1_th in + + let not_zero_th = check_interval_not_zero int_tm in + let f_th = float_interval_inv pp f1_th in + let df_th = + let ( * ) = float_interval_mul pp and + neg = float_interval_neg in + neg (df1_th * (f_th * f_th)) in + + let f_bounds = (rand o concl) f_th and + df_bounds = (rand o concl) df_th in + + (MY_PROVE_HYP diff1_th o MY_PROVE_HYP f_th o MY_PROVE_HYP df_th o + MY_PROVE_HYP f1_th o MY_PROVE_HYP not_zero_th o + INST[f1_tm, f_var_fun; x_tm, x_var_real; + f_bounds, f_bounds_var; df_bounds, df_bounds_var; + int_tm, int_var]) MK_LIN_APPROX_COMPOSE_INV';; + + + +(* +let pp = 5;; +let approx1 = eval_lin_approx_atn (pp + 2) one_float;; +let approx2 = eval_lin_approx_x one_float;; +let approx3 = eval_lin_approx_atn 4 (mk_float 0 50);; +lin_approx_inv pp approx1;; +lin_approx_inv pp approx2;; +lin_approx_inv pp approx3;; +*) + + +(********************************) +(* lin_approx_sqrt *) + +let sqrt_tm = `sqrt`;; + +let MK_LIN_APPROX_COMPOSE_SQRT' = (UNDISCH_ALL o prove) + (`interval_arith (f x) int ==> interval_pos int ==> + f real_differentiable atreal x ==> + interval_arith (sqrt (f x)) f_bounds ==> + interval_arith (derivative f x / (&2 * sqrt (f x))) df_bounds ==> + lin_approx (\x. sqrt (f x)) x f_bounds df_bounds`, + REPEAT DISCH_TAC THEN ASM_REWRITE_TAC[lin_approx_eq] THEN + SUBGOAL_THEN `&0 < ((f:real->real) x)` ASSUME_TAC THENL + [ + MATCH_MP_TAC (REWRITE_RULE[IMP_IMP] interval_arith_pos) THEN + EXISTS_TAC `int:real#real` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[derivative_compose_sqrt]);; + + +let lin_approx_sqrt pp approx1 = + let diff1_th, f1_th, df1_th = lin_approx_components approx1 in + let f1_tm = (lhand o concl) diff1_th and + x_tm = (rand o rand o concl) diff1_th and + int_tm = (rand o concl) f1_th in + + let pos_th = check_interval_pos int_tm in + let f_th = float_interval_sqrt pp f1_th in + let df_th = + let ( * ) = float_interval_mul pp and + (/) = float_interval_div pp in + (df1_th / (two_interval * f_th)) in + + let f_bounds = (rand o concl) f_th and + df_bounds = (rand o concl) df_th in + + (MY_PROVE_HYP diff1_th o MY_PROVE_HYP f_th o MY_PROVE_HYP df_th o + MY_PROVE_HYP f1_th o MY_PROVE_HYP pos_th o + INST[f1_tm, f_var_fun; x_tm, x_var_real; + f_bounds, f_bounds_var; df_bounds, df_bounds_var; + int_tm, int_var]) MK_LIN_APPROX_COMPOSE_SQRT';; + + + +(* +let pp = 5;; +let approx1 = eval_lin_approx_atn (pp + 2) one_float;; +let approx2 = eval_lin_approx_x one_float;; +let approx3 = eval_lin_approx_atn 4 (mk_float 0 50);; +lin_approx_sqrt pp approx1;; +lin_approx_sqrt pp approx2;; +lin_approx_sqrt pp approx3;; +*) + + + +(********************************) +(* lin_approx_acs *) + +let acs_tm = `acs`;; + +let MK_LIN_APPROX_COMPOSE_ACS' = + (UNDISCH_ALL o + GEN_REWRITE_RULE (RAND_CONV o LAND_CONV o LAND_CONV o RAND_CONV) [GSYM (FLOAT_TO_NUM_CONV one_float)] o + prove) + (`interval_arith (f x) int ==> (iabs int < &1 <=> T) ==> + f real_differentiable atreal x ==> + interval_arith (acs (f x)) f_bounds ==> + interval_arith (--(derivative f x / sqrt (&1 - f x * f x))) df_bounds ==> + lin_approx (\x. acs (f x)) x f_bounds df_bounds`, + REPEAT DISCH_TAC THEN ASM_REWRITE_TAC[lin_approx_eq] THEN + SUBGOAL_THEN `abs ((f:real->real) x) < &1` ASSUME_TAC THENL + [ + MATCH_MP_TAC (REWRITE_RULE[IMP_IMP] interval_arith_abs) THEN + EXISTS_TAC `int:real#real` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[derivative_compose_acs]);; + + +let lin_approx_acs pp approx1 = + let diff1_th, f1_th, df1_th = lin_approx_components approx1 in + let f1_tm = (lhand o concl) diff1_th and + x_tm = (rand o rand o concl) diff1_th and + int_tm = (rand o concl) f1_th in + + let abs_th = check_interval_iabs int_tm one_float in + let f_th = float_interval_acs pp f1_th in + let df_th = + let (-) = float_interval_sub pp and + ( * ) = float_interval_mul pp and + (/) = float_interval_div pp and + neg = float_interval_neg and + sqrt = float_interval_sqrt pp in + neg (df1_th / sqrt (one_interval - f1_th * f1_th)) in + + let f_bounds = (rand o concl) f_th and + df_bounds = (rand o concl) df_th in + + (MY_PROVE_HYP diff1_th o MY_PROVE_HYP f_th o MY_PROVE_HYP df_th o + MY_PROVE_HYP f1_th o MY_PROVE_HYP abs_th o + INST[f1_tm, f_var_fun; x_tm, x_var_real; + f_bounds, f_bounds_var; df_bounds, df_bounds_var; + int_tm, int_var]) MK_LIN_APPROX_COMPOSE_ACS';; + + + +(* +let pp = 5;; +let approx1 = eval_lin_approx_atn (pp + 2) one_float;; +let approx2 = eval_lin_approx_x one_float;; +let approx3 = eval_lin_approx_atn 4 (mk_float 0 50);; +lin_approx_acs pp approx1;; +lin_approx_acs pp approx2;; +lin_approx_acs pp approx3;; +*) + + diff --git a/formal_lp/old/formal_interval/m_examples_poly.hl b/formal_lp/old/formal_interval/m_examples_poly.hl new file mode 100644 index 0000000..3bf1c64 --- /dev/null +++ b/formal_lp/old/formal_interval/m_examples_poly.hl @@ -0,0 +1,35 @@ +(* Polynomial Examples *) +let schwefel_poly = expr_to_vector_fun `(x1 - x2 pow 2) pow 2 + (x2 - &1) pow 2 + + (x1 - x3 pow 2) pow 2 + (x3 - &1) pow 2`;; +let rd_poly = expr_to_vector_fun `-- x1 + &2 * x2 - x3 - #0.835634534 * x2 * (&1 + x2)`;; +let caprasse_poly = expr_to_vector_fun `-- x1 * x3 pow 3 + &4 * x2 * x3 pow 2 * x4 + + &4 * x1 * x3 * x4 pow 2 + &2 * x2 * x4 pow 3 + &4 * x1 * x3 + &4 * x3 pow 2 - + &10 * x2 * x4 - &10 * x4 pow 2 + &2`;; +let lv_poly = expr_to_vector_fun `x1 * x2 pow 2 + x1 * x3 pow 2 + x1 * x4 pow 2 - #1.1 * x1 + &1`;; +let butcher_poly = expr_to_vector_fun `x6 * x2 pow 2 + x5 * x3 pow 2 - x1 * x4 pow 2 + x4 pow 2 - + &1 / &3 * x1 + &4 / &3 * x4`;; +let magnetism_poly = expr_to_vector_fun `x1 pow 2 + &2 * x2 pow 2 + &2 * x3 pow 2 + &2 * x4 pow 2 + + &2 * x5 pow 2 + &2 * x6 pow 2 + &2 * x7 pow 2 - x1`;; +let heart_poly = expr_to_vector_fun `-- x1 * x6 pow 3 + &3 * x1 * x6 * x7 pow 2 - x3 * x7 pow 3 + + &3 * x3 * x7 * x6 pow 2 - x2 * x5 pow 3 + &3 * x2 * x5 * x8 pow 2 - x4 * x8 pow 3 + + &3 * x4 * x8 * x5 pow 2 - #0.9563453`;; + +let schwefel_min = `-- #0.00000000058806` and + rd_min = `-- #36.7126907` and + caprasse_min = `-- #3.1801` and + lv_min = `-- #20.801` and + butcher_min = `-- #1.44` and + magnetism_min = `-- #0.25001` and + heart_min = `-- #1.7435`;; + +let schwefel_dom = `[-- &10; -- &10; -- &10]`, `[&10; &10; &10]`;; +let rd_dom = `[-- &5; -- &5; -- &5]`, `[&5; &5; &5]`;; +let caprasse_dom = `[-- #0.5; -- #0.5; -- #0.5; -- #0.5]`, `[#0.5; #0.5; #0.5; #0.5]`;; +let lv_dom = `[-- &2; -- &2; -- &2; -- &2]`, `[&2; &2; &2; &2]`;; +let butcher_dom = `[-- &1; -- #0.1; -- #0.1; -- &1; -- #0.1; -- #0.1]`, + `[&0; #0.9; #0.5; -- #0.1; -- #0.05; -- #0.03]`;; +let magnetism_dom = `[-- &1; -- &1; -- &1; -- &1; -- &1; -- &1; -- &1]`, + `[&1; &1; &1; &1; &1; &1; &1]`;; +let heart_dom = `[-- #0.1; #0.4; -- #0.7; -- #0.7; #0.1; -- #0.1; -- #0.3; -- #1.1]`, + `[#0.4; &1; -- #0.4; #0.4; #0.2; #0.2; #1.1; -- #0.3]`;; + diff --git a/formal_lp/old/formal_interval/m_taylor.hl b/formal_lp/old/formal_interval/m_taylor.hl new file mode 100644 index 0000000..3e5e791 --- /dev/null +++ b/formal_lp/old/formal_interval/m_taylor.hl @@ -0,0 +1,1867 @@ +(* TODO: move lemmas about TABLE into a separate file *) +(* TODO: remove dependencies on Packing3, Arc_properties from theory files as well *) +needs "packing/pack3.hl";; + +needs "../formal_lp/formal_interval/more_float.hl";; +needs "../formal_lp/formal_interval/theory/taylor_interval.hl";; +needs "../formal_lp/formal_interval/theory/multivariate_taylor.hl";; +needs "../formal_lp/formal_interval/second_approx.hl";; +needs "../formal_lp/formal_interval/eval_interval.hl";; +needs "../formal_lp/list/list_conversions.hl";; +needs "../formal_lp/list/list_float.hl";; + +let max_dim = 8;; + +let inst_first_type_var ty th = + let ty_vars = type_vars_in_term (concl th) in + if ty_vars = [] then + failwith "inst_first_type: no type variables in the theorem" + else + INST_TYPE [ty, hd ty_vars] th;; + +let float0 = mk_float 0 Arith_options.min_exp and + interval0 = mk_float_interval_small_num 0;; + + +let real_ty = `:real` and + real_list_ty = `:(real)list` and + real_pair_ty = `:real#real` and + real_pair_list_ty = `:(real#real)list` and + nty = `:N`;; + +let d_bounds_list_var = `d_bounds_list : (real#real)list` and + dd_bounds_list_var = `dd_bounds_list : ((real#real)list)list` and + error_var = `error : real` and + dd_list_var = `dd_list : (real#real)list`;; + +let has_size_array = Array.init (max_dim + 1) + (fun i -> match i with + | 0 -> TRUTH + | 1 -> HAS_SIZE_1 + | _ -> define_finite_type i);; + +let dimindex_array = Array.init (max_dim + 1) + (fun i -> if i < 1 then TRUTH else MATCH_MP DIMINDEX_UNIQUE has_size_array.(i));; + +let n_type_array = Array.init (max_dim + 1) + (fun i -> if i < 1 then bool_ty else + let dimindex_th = dimindex_array.(i) in + (hd o snd o dest_type o snd o dest_const o rand o lhand o concl) dimindex_th);; + +let n_vector_type_array = Array.init (max_dim + 1) + (fun i -> if i < 1 then bool_ty else mk_type ("cart", [real_ty; n_type_array.(i)]));; + + + +(************************************) +(* m_cell_domain *) + +let ALL2_ALL_ZIP = prove(`!(P:A->B->bool) l1 l2. LENGTH l1 = LENGTH l2 ==> + (ALL2 P l1 l2 <=> ALL (\p. P (FST p) (SND p)) (ZIP l1 l2))`, + GEN_TAC THEN LIST_INDUCT_TAC THENL + [ + GEN_TAC THEN REWRITE_TAC[LENGTH; EQ_SYM_EQ; LENGTH_EQ_NIL] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[ZIP; ALL2; ALL]; + ALL_TAC + ] THEN + + LIST_INDUCT_TAC THEN REWRITE_TAC[LENGTH] THENL [ARITH_TAC; ALL_TAC] THEN + REWRITE_TAC[eqSS] THEN DISCH_TAC THEN + REWRITE_TAC[ALL2; ZIP; ALL] THEN + FIRST_X_ASSUM (new_rewrite [] []) THEN ASM_REWRITE_TAC[]);; + +let EL_ZIP = prove(`!(l1:(A)list) (l2:(B)list) i. LENGTH l1 = LENGTH l2 /\ i < LENGTH l1 ==> + EL i (ZIP l1 l2) = (EL i l1, EL i l2)`, + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[ZIP; LENGTH] THEN TRY ARITH_TAC THEN + case THEN REWRITE_TAC[EL; HD; TL] THEN GEN_TAC THEN + REWRITE_TAC[eqSS; ARITH_RULE `SUC n < SUC x <=> n < x`] THEN STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]);; + +let LENGTH_ZIP = prove(`!l1 l2. LENGTH l1 = LENGTH l2 ==> LENGTH (ZIP l1 l2) = LENGTH l1`, + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[ZIP; LENGTH] THEN TRY ARITH_TAC THEN + REWRITE_TAC[eqSS] THEN DISCH_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]);; + + + +let VECTOR_COMPONENT = prove(`!l i. i IN 1..dimindex (:N) ==> + (vector l:A^N)$i = EL (i - 1) l`, +REWRITE_TAC[IN_NUMSEG] THEN REPEAT GEN_TAC THEN DISCH_TAC THEN REWRITE_TAC[vector] THEN + MATCH_MP_TAC LAMBDA_BETA THEN ASM_REWRITE_TAC[]);; + + +let test_domain_xi = new_definition + `test_domain_xi xz yw <=> FST xz <= FST yw /\ FST yw <= SND xz /\ + FST yw - FST xz <= SND yw /\ SND xz - FST yw <= SND yw`;; + +let MK_CELL_DOMAIN = prove(`!xz (yw:(real#real)list) x z y w. + LENGTH x = dimindex (:N) /\ LENGTH z = dimindex (:N) /\ + LENGTH y = dimindex (:N) /\ LENGTH w = dimindex (:N) /\ + ZIP y w = yw /\ ZIP x z = xz /\ + ALL2 test_domain_xi xz yw ==> + m_cell_domain (vector x, vector z:real^N) (vector y) (vector w)`, + REPEAT GEN_TAC THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN + SUBGOAL_THEN `LENGTH (xz:(real#real)list) = dimindex (:N) /\ LENGTH (yw:(real#real)list) = dimindex (:N)` ASSUME_TAC THENL + [ + EXPAND_TAC "yw" THEN EXPAND_TAC "xz" THEN + REPEAT (new_rewrite [] [] LENGTH_ZIP) THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + rewrite [] [] ALL2_ALL_ZIP THEN ASM_REWRITE_TAC[m_cell_domain; GSYM ALL_EL] THEN DISCH_TAC THEN + REWRITE_TAC[m_cell_domain] THEN GEN_TAC THEN DISCH_TAC THEN + REPEAT (new_rewrite [] [] VECTOR_COMPONENT) THEN ASM_REWRITE_TAC[] THEN + ABBREV_TAC `j = i - 1` THEN + SUBGOAL_THEN `j < dimindex (:N)` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `j:num`) THEN REWRITE_TAC[test_domain_xi] THEN + rewrite [] [] LENGTH_ZIP THEN ASM_REWRITE_TAC[] THEN + rewrite [] [] EL_ZIP THEN ASM_REWRITE_TAC[] THEN + EXPAND_TAC "xz" THEN EXPAND_TAC "yw" THEN + REPEAT (new_rewrite [] [] EL_ZIP) THEN ASM_REWRITE_TAC[] THEN + ARITH_TAC);; + + + + +let float0_eq = FLOAT_TO_NUM_CONV (mk_float 0 Arith_options.min_exp);; + + +(* array of theorems *) +let mk_m_domain_array = + let mk_m_domain n = + let dimindex_th = dimindex_array.(n) in + let n_ty = (hd o snd o dest_type o snd o dest_const o rand o lhand o concl) dimindex_th in + let nty = `:N` in + (UNDISCH_ALL o REWRITE_RULE[float0_eq] o DISCH_ALL o RULE o + REWRITE_RULE[dimindex_th] o INST_TYPE[n_ty, nty]) MK_CELL_DOMAIN in + Array.init (max_dim + 1) (fun i -> if i < 1 then TRUTH else mk_m_domain i);; + + + +let x_var_real_list = `x:(real)list` and + y_var_real_list = `y:(real)list` and + z_var_real_list = `z:(real)list` and + w_var_real_list = `w:(real)list` and + yw_var = `yw:(real#real)list` and + xz_var = `xz:(real#real)list` and + xz_pair_var = `xz:real#real` and + yw_pair_var = `yw:real#real`;; + + + + +let TEST_DOMAIN_XI' = (EQT_INTRO o RULE o prove)(`xz = (x,z) /\ yw = (y,w) /\ + x <= y /\ y <= z /\ y - x <= w1 /\ z - y <= w2 /\ w1 <= w /\ w2 <= w ==> test_domain_xi xz yw`, + SIMP_TAC[test_domain_xi] THEN REAL_ARITH_TAC);; + + +let eval_test_domain_xi pp test_domain_tm = + let ltm, yw = dest_comb test_domain_tm in + let xz = rand ltm in + let x, z = dest_pair xz and + y, w = dest_pair yw in + let (<=) = (fun t1 t2 -> EQT_ELIM (float_le t1 t2)) and + (-) = float_sub_hi pp in + let x_le_y = x <= y and + y_le_z = y <= z and + yx_le_w1 = y - x and + zy_le_w2 = z - y in + let w1 = (rand o concl) yx_le_w1 and + w2 = (rand o concl) zy_le_w2 in + let w1_le_w = w1 <= w and + w2_le_w = w2 <= w in + (MY_PROVE_HYP (REFL xz) o MY_PROVE_HYP (REFL yw) o + MY_PROVE_HYP x_le_y o MY_PROVE_HYP y_le_z o + MY_PROVE_HYP yx_le_w1 o MY_PROVE_HYP zy_le_w2 o + MY_PROVE_HYP w1_le_w o MY_PROVE_HYP w2_le_w o + INST[x, x_var_real; y, y_var_real; z, z_var_real; w, w_var_real; + w1, w1_var_real; w2, w2_var_real; + xz, xz_pair_var; yw, yw_pair_var]) TEST_DOMAIN_XI';; + + +(* mk_m_center_domain *) +let mk_m_center_domain n pp x_list_tm z_list_tm = + let x_list = dest_list x_list_tm and + z_list = dest_list z_list_tm in + let y_list = + let ( * ) = (fun t1 t2 -> (rand o concl) (float_mul_eq t1 t2)) and + (+) = (fun t1 t2 -> (rand o concl) (float_add_hi pp t1 t2)) in + map2 (fun x y -> if x = y then x else float_inv2 * (x + y)) x_list z_list in + + let w_list = + let (-) = (fun t1 t2 -> (rand o concl) (float_sub_hi pp t1 t2)) and + max = (fun t1 t2 -> (rand o concl) (float_max t1 t2)) in + let w1 = map2 (-) y_list x_list and + w2 = map2 (-) z_list y_list in + map2 max w1 w2 in + + let y_list_tm = mk_list (y_list, real_ty) and + w_list_tm = mk_list (w_list, real_ty) in + + let yw_zip_th = eval_zip y_list_tm w_list_tm and + xz_zip_th = eval_zip x_list_tm z_list_tm in + + let yw_list_tm = (rand o concl) yw_zip_th and + xz_list_tm = (rand o concl) xz_zip_th in + + let len_x_th = eval_length x_list_tm and + len_z_th = eval_length z_list_tm and + len_y_th = eval_length y_list_tm and + len_w_th = eval_length w_list_tm in + let th0 = (MY_PROVE_HYP len_x_th o MY_PROVE_HYP len_z_th o + MY_PROVE_HYP len_y_th o MY_PROVE_HYP len_w_th o + MY_PROVE_HYP yw_zip_th o MY_PROVE_HYP xz_zip_th o + INST[x_list_tm, x_var_real_list; z_list_tm, z_var_real_list; + y_list_tm, y_var_real_list; w_list_tm, w_var_real_list; + yw_list_tm, yw_var; xz_list_tm, xz_var]) mk_m_domain_array.(n) in + let all_th = (EQT_ELIM o all2_conv_univ (eval_test_domain_xi pp) o hd o hyp) th0 in + MY_PROVE_HYP all_th th0;; + + +(* +let n = 8;; +let pp = 5;; + +let x_list_tm = mk_list (replicate one_float n, real_ty) and + z_list_tm = mk_list (replicate two_float n, real_ty);; + +mk_m_center_domain n pp x_list_tm z_list_tm;; + +(* 10: 1.572 *) +test 100 (mk_m_center_domain n pp x_list_tm) z_list_tm;; +*) + + +(***********************) + +let MK_M_TAYLOR_INTERVAL' = (RULE o MATCH_MP iffRL o SPEC_ALL) m_taylor_interval;; + + +let get_types_and_vars n = + let ty = n_type_array.(n) and + xty = n_vector_type_array.(n) in + let x_var = mk_var ("x", xty) and + f_var = mk_var ("f", mk_fun_ty xty real_ty) and + y_var = mk_var ("y", xty) and + w_var = mk_var ("w", xty) and + domain_var = mk_var ("domain", mk_type ("prod", [xty; xty])) in + ty, xty, x_var, f_var, y_var, w_var, domain_var;; + + + +let dest_m_cell_domain domain_tm = + let lhs, w_tm = dest_comb domain_tm in + let lhs2, y_tm = dest_comb lhs in + rand lhs2, y_tm, w_tm;; + + +(**************************************************) + +(* Given a variable of the type `:real^N` returns the number N *) +let get_dim = int_of_string o fst o dest_type o hd o tl o snd o dest_type o type_of;; + + +(**********************) +(* eval_m_taylor_poly *) + +let partial_pow = prove(`!i f n (y:real^N). lift o f differentiable at y ==> + partial i (\x. f x pow n) y = &n * f y pow (n - 1) * partial i f y`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `(\x:real^N. f x pow n) = (\t. t pow n) o f` (fun th -> REWRITE_TAC[th]) THENL + [ + ONCE_REWRITE_TAC[GSYM eq_ext] THEN REWRITE_TAC[o_THM]; + ALL_TAC + ] THEN + new_rewrite [] [] partial_uni_compose THENL + [ + ASM_REWRITE_TAC[] THEN + new_rewrite [] [] REAL_DIFFERENTIABLE_POW_ATREAL THEN REWRITE_TAC[REAL_DIFFERENTIABLE_ID]; + ALL_TAC + ] THEN + new_rewrite [] [] derivative_pow THEN REWRITE_TAC[REAL_DIFFERENTIABLE_ID; derivative_x] THEN + REAL_ARITH_TAC);; + + +let nth_diff2_pow = prove(`!n y. nth_diff_strong 2 (\x. x pow n) y`, + REWRITE_TAC[nth_diff_strong2_eq] THEN REPEAT GEN_TAC THEN + EXISTS_TAC `(:real)` THEN REWRITE_TAC[REAL_OPEN_UNIV; IN_UNIV] THEN GEN_TAC THEN + new_rewrite [] [] REAL_DIFFERENTIABLE_POW_ATREAL THEN REWRITE_TAC[REAL_DIFFERENTIABLE_ID] THEN + MATCH_MP_TAC differentiable_local THEN + EXISTS_TAC `\x. &n * x pow (n - 1)` THEN EXISTS_TAC `(:real)` THEN + REWRITE_TAC[REAL_OPEN_UNIV; IN_UNIV] THEN + new_rewrite [] [] REAL_DIFFERENTIABLE_MUL_ATREAL THEN REWRITE_TAC[REAL_DIFFERENTIABLE_CONST] THENL + [ + new_rewrite [] [] REAL_DIFFERENTIABLE_POW_ATREAL THEN REWRITE_TAC[REAL_DIFFERENTIABLE_ID]; + ALL_TAC + ] THEN + GEN_TAC THEN new_rewrite [] [] derivative_pow THEN REWRITE_TAC[REAL_DIFFERENTIABLE_ID] THEN + REWRITE_TAC[derivative_x; REAL_MUL_RID]);; + + +let diff2c_pow = prove(`!f n (x:real^N). diff2c f x ==> diff2c (\x. f x pow n) x`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `(\x:real^N. f x pow n) = (\t. t pow n) o f` (fun th -> REWRITE_TAC[th]) THENL + [ + ONCE_REWRITE_TAC[GSYM eq_ext] THEN REWRITE_TAC[o_THM]; + ALL_TAC + ] THEN + apply_tac diff2c_uni_compose THEN ASM_REWRITE_TAC[nth_diff2_pow] THEN + REWRITE_TAC[nth_derivative2] THEN + SUBGOAL_THEN `!n. derivative (\t. t pow n) = (\t. &n * t pow (n - 1))` ASSUME_TAC THENL + [ + GEN_TAC THEN REWRITE_TAC[FUN_EQ_THM] THEN GEN_TAC THEN + new_rewrite [] [] derivative_pow THEN REWRITE_TAC[REAL_DIFFERENTIABLE_ID] THEN + REWRITE_TAC[derivative_x; REAL_MUL_RID]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `!n. derivative (\t. &n * t pow (n - 1)) = (\t. &n * derivative (\t. t pow (n - 1)) t)` ASSUME_TAC THENL + [ + GEN_TAC THEN REWRITE_TAC[FUN_EQ_THM] THEN GEN_TAC THEN + new_rewrite [] [] derivative_scale THEN REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_DIFFERENTIABLE_POW_ATREAL THEN REWRITE_TAC[REAL_DIFFERENTIABLE_ID]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + REPEAT (MATCH_MP_TAC REAL_CONTINUOUS_LMUL) THEN + MATCH_MP_TAC REAL_CONTINUOUS_POW THEN + REWRITE_TAC[REAL_CONTINUOUS_AT_ID]);; + + +let diff2c_domain_pow = prove(`!f n domain. diff2c_domain domain f ==> + diff2c_domain domain (\x. f x pow n)`, + REWRITE_TAC[diff2c_domain] THEN REPEAT STRIP_TAC THEN ASM_SIMP_TAC[diff2c_pow]);; + + +let diff2c_domain_tm = `diff2c_domain domain`;; + +let rec gen_diff2c_domain_poly poly_tm = + let x_var, expr = dest_abs poly_tm in + let n = (int_of_string o fst o dest_type o hd o tl o snd o dest_type o type_of) x_var in + let diff2c_tm = mk_icomb (diff2c_domain_tm, poly_tm) in + if frees expr = [] then + (* const *) + (SPEC_ALL o ISPEC expr o inst_first_type_var (n_type_array.(n))) diff2c_domain_const + else + let lhs, r_tm = dest_comb expr in + if lhs = neg_op_real then + (* -- *) + let r_th = gen_diff2c_domain_poly (mk_abs (x_var, r_tm)) in + prove(diff2c_tm, MATCH_MP_TAC diff2c_domain_neg THEN REWRITE_TAC[r_th]) + else + let op, l_tm = dest_comb lhs in + let name = (fst o dest_const) op in + if name = "$" then + (* x$k *) + let dim_th = dimindex_array.(n) in + prove(diff2c_tm, MATCH_MP_TAC diff2c_domain_x THEN + REWRITE_TAC[IN_NUMSEG; dim_th] THEN ARITH_TAC) + else + let l_th = gen_diff2c_domain_poly (mk_abs (x_var, l_tm)) in + if name = "real_pow" then + (* f pow n *) + prove(diff2c_tm, MATCH_MP_TAC diff2c_domain_pow THEN REWRITE_TAC[l_th]) + else + let r_th = gen_diff2c_domain_poly (mk_abs (x_var, r_tm)) in + prove(diff2c_tm, + MAP_FIRST apply_tac [diff2c_domain_add; diff2c_domain_sub; diff2c_domain_mul] THEN + REWRITE_TAC[l_th; r_th]);; + + +let gen_diff2c_poly = + let th_imp = prove(`!f. (!domain. diff2c_domain domain f) ==> !x:real^N. diff2c f x`, + REWRITE_TAC[diff2c_domain] THEN REPEAT STRIP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + EXISTS_TAC `(x:real^N, x:real^N)` THEN + REWRITE_TAC[INTERVAL_SING; IN_SING]) in + fun poly_tm -> + (MATCH_MP th_imp o GEN_ALL o gen_diff2c_domain_poly) poly_tm;; + + +let gen_diff_poly = + let th_imp = prove(`!f. (!domain. diff2c_domain domain f) ==> !x:real^N. lift o f differentiable at x`, + REWRITE_TAC[diff2c_domain; diff2c; diff2] THEN REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`x:real^N, x:real^N`; `x:real^N`]) THEN + REWRITE_TAC[INTERVAL_SING; IN_SING] THEN case THEN REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:real^N`) THEN ASM_SIMP_TAC[]) in + fun poly_tm -> + (MATCH_MP th_imp o GEN_ALL o gen_diff2c_domain_poly) poly_tm;; + + +let in_tm = `IN`;; + +let gen_partial_poly i poly_tm = + let i_tm = mk_small_numeral i in + let rec gen_rec poly_tm = + let x_var, expr = dest_abs poly_tm in + let n = (int_of_string o fst o dest_type o hd o tl o snd o dest_type o type_of) x_var in + if frees expr = [] then + (* const *) + (SPECL [i_tm; expr] o inst_first_type_var (n_type_array.(n))) partial_const + else + let lhs, r_tm = dest_comb expr in + if lhs = neg_op_real then + (* -- *) + let r_poly = mk_abs (x_var, r_tm) in + let r_diff = (SPEC_ALL o gen_diff_poly) r_poly and + r_partial = gen_rec r_poly in + let th0 = SPEC i_tm (MATCH_MP partial_neg r_diff) in + REWRITE_RULE[r_partial] th0 + else + let op, l_tm = dest_comb lhs in + let name = (fst o dest_const) op in + if name = "$" then + (* comp *) + let dim_th = dimindex_array.(n) in + let dim_tm = (lhand o concl) dim_th in + let i_eq_k = NUM_EQ_CONV (mk_eq (i_tm, r_tm)) in + let int_tm = mk_binop `..` `1` dim_tm in + let k_in_dim = prove(mk_comb (mk_icomb(in_tm, r_tm), int_tm), + REWRITE_TAC[IN_NUMSEG; dim_th] THEN ARITH_TAC) in + (REWRITE_RULE[i_eq_k] o MATCH_MP (SPECL [r_tm; i_tm] partial_x)) k_in_dim + else + let l_poly = mk_abs (x_var, l_tm) in + let l_partial = gen_rec l_poly in + let l_diff = (SPEC_ALL o gen_diff_poly) l_poly in + if name = "real_pow" then + (* f pow n *) + let th0 = SPECL [i_tm; r_tm] (MATCH_MP partial_pow l_diff) in + REWRITE_RULE[l_partial] th0 + else + let r_poly = mk_abs (x_var, r_tm) in + let r_partial = gen_rec r_poly in + let r_diff = (SPEC_ALL o gen_diff_poly) r_poly in + let imp_th = assoc op [add_op_real, partial_add; + sub_op_real, partial_sub; + mul_op_real, partial_mul] in + let th0 = SPEC i_tm (MATCH_MP (MATCH_MP imp_th l_diff) r_diff) in + REWRITE_RULE[l_partial; r_partial] th0 in + + let th1 = gen_rec poly_tm in + let th2 = ((NUM_REDUCE_CONV THENC REWRITE_CONV[DECIMAL] THENC REAL_POLY_CONV) o rand o concl) th1 in + (REWRITE_RULE[ETA_AX] o ONCE_REWRITE_RULE[eq_ext] o GEN_ALL) (TRANS th1 th2);; + + +let gen_partial2_poly i j poly_tm = + let partial_j = gen_partial_poly j poly_tm in + let partial_ij = gen_partial_poly i (rand (concl partial_j)) in + let pi = (rator o lhand o concl) partial_ij in + REWRITE_RULE[GSYM partial2] (TRANS (AP_TERM pi partial_j) partial_ij);; + + +(* +let poly_tm = `\x:real^2. (x$1 - x$2) pow 3 * (x$1 - x$2) * x$1 pow 2`;; +gen_partial2_poly 2 2 poly_tm;; +*) + +let expr_to_vector_fun = + let comp_op = `$` in + fun expr_tm -> + let vars = List.sort Pervasives.compare (frees expr_tm) in + let n = length vars in + let x_var = mk_var ("x", n_vector_type_array.(n)) in + let x_tm = mk_icomb (comp_op, x_var) in + let vars2 = map (fun i -> mk_comb (x_tm, mk_small_numeral i)) (1--n) in + mk_abs (x_var, subst (zip vars2 vars) expr_tm);; + +(* +let delta_x4_poly = expr_to_vector_fun ((rand o concl o SPEC_ALL) Sphere.delta_x4);; +gen_partial2_poly 2 3 delta_x4_poly;; + +map (fun i -> map (fun j -> gen_partial2_poly i j poly_delta_x4) (1--6)) (1--6);; +*) + + + + + +(********************************************) + +let x_var_names = Array.init (max_dim + 1) (fun i -> "x"^(string_of_int i)) and + y_var_names = Array.init (max_dim + 1) (fun i -> "y"^(string_of_int i)) and + z_var_names = Array.init (max_dim + 1) (fun i -> "z"^(string_of_int i)) and + w_var_names = Array.init (max_dim + 1) (fun i -> "w"^(string_of_int i));; + +let x_vars_array = Array.init (max_dim + 1) (fun i -> mk_var(x_var_names.(i), real_ty)) and + y_vars_array = Array.init (max_dim + 1) (fun i -> mk_var(y_var_names.(i), real_ty)) and + z_vars_array = Array.init (max_dim + 1) (fun i -> mk_var(z_var_names.(i), real_ty)) and + w_vars_array = Array.init (max_dim + 1) (fun i -> mk_var(w_var_names.(i), real_ty));; + +let df_vars_array = Array.init (max_dim + 1) (fun i -> mk_var ("df"^(string_of_int i), real_pair_ty));; +let dd_vars_array = Array.init (max_dim + 1) (fun i -> + Array.init (max_dim + 1) (fun j -> mk_var ("dd"^(string_of_int i)^(string_of_int j), real_pair_ty)));; + +let dest_vector = dest_list o rand;; + +let mk_vector list_tm = + let n = (length o dest_list) list_tm in + let ty = (hd o snd o dest_type o type_of) list_tm in + let vec = mk_const ("vector", [ty, aty; n_type_array.(n), nty]) in + mk_comb (vec, list_tm);; + +let mk_vector_list list = + mk_vector (mk_list (list, type_of (hd list)));; + + +let el_thms_array = + let el_tm = `EL : num->(A)list->A` in + let gen0 n = + let e_list = mk_list (map (fun i -> mk_var ("e"^(string_of_int i), aty)) (1--n), aty) in + let el0_th = REWRITE_CONV[EL; HD] (mk_binop el_tm `0` e_list) in + Array.create n el0_th in + let array = Array.init (max_dim + 1) gen0 in + let gen_i n i = + let e_list = (rand o lhand o concl) array.(n).(i) in + let prev_thm = array.(n - 1).(i - 1) in + let i_tm = mk_small_numeral i in + let prev_i = num_CONV i_tm in + let el_th = REWRITE_CONV[prev_i; EL; HD; TL; prev_thm] (mk_binop el_tm i_tm e_list) in + array.(n).(i) <- el_th in + let _ = map (fun n -> map (fun i -> gen_i n i) (1--(n - 1))) (2--max_dim) in + array;; + + +let gen_comp_thm n i = + let i_tm = mk_small_numeral i and + x_list = mk_list (map (fun i -> mk_var("x"^(string_of_int i), aty)) (1--n), aty) in + let th0 = (ISPECL [x_list; i_tm] o inst_first_type_var (n_type_array.(n))) VECTOR_COMPONENT in + let th1 = (CONV_RULE NUM_REDUCE_CONV o REWRITE_RULE[IN_NUMSEG; dimindex_array.(n)]) th0 in + REWRITE_RULE[el_thms_array.(n).(i - 1)] th1;; + +let comp_thms_array = Array.init (max_dim + 1) + (fun n -> Array.init (n + 1) + (fun i -> if i < 1 or n < 1 then TRUTH else gen_comp_thm n i));; + +(*****************************) + +let eval_diff2_poly diff2_domain_th = + fun xx zz -> + let domain_tm = mk_pair (xx, zz) in + INST[domain_tm, mk_var ("domain", type_of domain_tm)] diff2_domain_th;; + + +(*****************************) + + +let gen_lin_approx_eq_thm n = + let ty = n_type_array.(n) in + let df_vars = map (fun i -> df_vars_array.(i)) (1--n) in + let df_bounds_list = mk_list (df_vars, real_pair_ty) in + let th0 = (SPECL[f_bounds_var; df_bounds_list] o inst_first_type_var ty) m_lin_approx in + let th1 = (CONV_RULE NUM_REDUCE_CONV o REWRITE_RULE[all_n]) th0 in + th1;; + + +let gen_lin_approx_poly_thm poly_tm diff_th partials = + let x_var, _ = dest_abs poly_tm in + let n = get_dim x_var in + let lin_eq = (REWRITE_RULE partials o SPECL [poly_tm]) (gen_lin_approx_eq_thm n) in + let x_vec = mk_vector_list (map (fun i -> x_vars_array.(i)) (1--n)) in + let th1 = (REWRITE_RULE (Array.to_list comp_thms_array.(n)) o SPEC x_vec o REWRITE_RULE[diff_th]) lin_eq in + th1;; + + +let gen_lin_approx_poly_thm0 poly_tm = + let x_var, _ = dest_abs poly_tm in + let n = get_dim x_var in + let partials = map (fun i -> gen_partial_poly i poly_tm) (1--n) in + let diff_th = gen_diff_poly poly_tm in + gen_lin_approx_poly_thm poly_tm diff_th partials;; + + +let eval_lin_approx pp0 lin_approx_th = + let poly_tm, _, _, _ = (dest_lin_approx o lhand o concl) lin_approx_th in + let x_var, _ = dest_abs poly_tm in + let n = get_dim x_var in + let th0 = lin_approx_th in + let th1 = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o MATCH_MP iffRL) th0 in + let build_eval int_hyp = + let expr, b_var = dest_binary "interval_arith" int_hyp in + (eval_constants pp0 o build_interval_fun) expr, b_var in + let int_fs = map build_eval (hyp th1) in + + let rec split_rules i_list = + match i_list with + | [] -> ([], []) + | ((i_fun, var_tm) :: es) -> + let th_list, i_list' = split_rules es in + match i_fun with + | Int_const th -> (var_tm, th) :: th_list, i_list' + | Int_var v -> (var_tm, INST[v, x_var_real] CONST_INTERVAL') :: th_list, i_list' + | _ -> th_list, (var_tm, i_fun) :: i_list' in + + let const_th_list, i_list0 = split_rules int_fs in + let th2 = itlist (fun (var_tm, th) th0 -> + let b_tm = rand (concl th) in + (MY_PROVE_HYP th o INST[b_tm, var_tm]) th0) const_th_list th1 in + let v_list, i_list' = unzip i_list0 in + let i_list = find_and_replace_all i_list' [] in + fun pp vector_tm -> + let x_vals = dest_vector vector_tm in + if length x_vals <> n then failwith (sprintf "Wrong vector size; expected size: %d" n) + else + let x_ints = map mk_const_interval x_vals in + let vars = map (fun i -> x_vars_array.(i)) (1--n) in + let th3 = INST (zip x_vals vars) th2 in + let i_vals = eval_interval_fun_list pp i_list (zip vars x_ints) in + itlist2 (fun var_tm th th0 -> + let b_tm = rand (concl th) in + (MY_PROVE_HYP th o INST[b_tm, var_tm]) th0) v_list i_vals th3;; + + +let eval_lin_approx_poly0 pp0 poly_tm = + eval_lin_approx pp0 (gen_lin_approx_poly_thm0 poly_tm);; + + +(* +let pp = 10;; +let eval_rd = eval_lin_approx_poly0 pp rd_poly;; +let eval_rd_old = eval_lin_approx_poly0_old pp rd_poly;; +let pi5 = (fst o dest_pair o rand o concl) pi_approx_array.(5);; +let y_list = mk_list (replicate pi5 3, real_ty);; +let th1 = eval_rd (mk_vector y_list);; +let th2 = eval_rd_old (mk_vector y_list);; +th1 = th2;; + +(* 1.216 (rd) *) +test 100 eval_rd (mk_vector y_list);; +(* 1.180 *) +test 100 eval_rd_old (mk_vector y_list);; + + +let pp = 10;; +let eval_rd = eval_lin_approx_poly0 pp delta_y_poly;; +let eval_rd_old = eval_lin_approx_poly0_old pp delta_y_poly;; +let pi5 = (fst o dest_pair o rand o concl) pi_approx_array.(5);; +let y_list = mk_list (replicate pi5 6, real_ty);; +let th1 = eval_rd (mk_vector y_list);; +let th2 = eval_rd_old (mk_vector y_list);; +th1 = th2;; + +(* 4.888 *) +test 10 eval_rd (mk_vector y_list);; +(* 6.972 *) +test 10 eval_rd_old (mk_vector y_list);; +th1 = th2;; +*) + + +(* +let pp = 5;; +let test_poly = `\x:real^2. x$1 * x$2`;; +let test_poly = `\x:real^2. &1`;; +gen_lin_approx_poly_thm0 test_poly;; +let eval_test = eval_lin_approx_poly0 pp test_poly;; +let y_list = mk_list (replicate one_float 2, real_ty);; +eval_test (mk_vector y_list);; +*) + + +(*******************************) + +(* +let pp = 5;; +let eval_rd = eval_lin_approx_poly pp rd_poly;; +let pi5 = (fst o dest_pair o rand o concl) pi_approx_array.(5);; +let y_list = mk_list (replicate pi5 3, real_ty);; +eval_rd (mk_vector y_list);; + +let eval_schwefel = eval_lin_approx_poly pp schwefel_poly;; +let y_list = mk_list (replicate pi5 3, real_ty);; +eval_schwefel (mk_vector y_list);; + + +let eval_heart = eval_lin_approx_poly pp heart_poly;; +let y_list = mk_list (replicate pi5 8, real_ty);; +eval_heart (mk_vector y_list);; + +let eval_magnetism = eval_lin_approx_poly pp magnetism_poly;; +let y_list = mk_list (replicate pi5 7, real_ty);; +eval_magnetism (mk_vector y_list);; + + + +gen_lin_approx_poly_thm magnetism_poly;; +gen_lin_approx_poly_thm rd_poly;; +*) + + +(*************************************) + + +let le_op_num = `(<=):num->num->bool`;; + +(* 1 <= i /\ i <= n <=> i = 1 \/ i = 2 \/ ... \/ i = n *) +let i_int_array = + let i_tm = `i:num` in + let i_th0 = prove(`1 <= i /\ i <= SUC n <=> (1 <= i /\ i <= n) \/ i = SUC n`, ARITH_TAC) in + let th1 = prove(`1 <= i /\ i <= 1 <=> i = 1`, ARITH_TAC) in + let array = Array.create (max_dim + 1) th1 in + let prove_next n = + let n_tm = mk_small_numeral n in + let prev_n = num_CONV n_tm in + let tm = mk_conj (`1 <= i`, mk_binop le_op_num i_tm n_tm) in + let th = REWRITE_CONV[prev_n; i_th0; array.(n - 1)] tm in + array.(n) <- REWRITE_RULE[SYM prev_n; DISJ_ACI] th in + let _ = map prove_next (2--max_dim) in + array;; + + + +(* (!i. 1 <= i /\ i <= n ==> P i) <=> P 1 /\ P 2 /\ ... /\ P n *) +let gen_in_interval = + let th0 = prove(`(!i:num. (i = k \/ Q i) ==> P i) <=> (P k /\ (!i. Q i ==> P i))`, MESON_TAC[]) in + let th1 = prove(`(!i:num. (i = k ==> P i)) <=> P k`, MESON_TAC[]) in + fun n -> + let n_tm = mk_small_numeral n and + i_tm = `i:num` in + let lhs1 = mk_conj (`1 <= i`, mk_binop le_op_num i_tm n_tm) in + let lhs = mk_forall (i_tm, mk_imp (lhs1, `(P:num->bool) i`)) in + REWRITE_CONV[i_int_array.(n); th0; th1] lhs;; + + +let gen_second_bounded_eq_thm n = + let ty, _, x_var, _, _, _, domain_var = get_types_and_vars n in + let dd_vars = map (fun i -> map (fun j -> dd_vars_array.(j).(i)) (1--i)) (1--n) in + let dd_bounds_list = mk_list (map (fun l -> mk_list (l, real_pair_ty)) dd_vars, real_pair_list_ty) in + let th0 = (SPECL[domain_var; dd_bounds_list] o inst_first_type_var ty) second_bounded in + let th1 = (CONV_RULE NUM_REDUCE_CONV o REWRITE_RULE[all_n]) th0 in + th1;; + + +let gen_second_bounded_poly_thm poly_tm partials2 = + let x_var, _ = dest_abs poly_tm in + let n = get_dim x_var in + let partials2' = List.flatten partials2 in + let second_th = (REWRITE_RULE partials2' o SPECL [poly_tm]) (gen_second_bounded_eq_thm n) in + second_th;; + + +let gen_second_bounded_poly_thm0 poly_tm = + let x_var, _ = dest_abs poly_tm in + let n = get_dim x_var in + let partials = map (fun i -> gen_partial_poly i poly_tm) (1--n) in + let get_partial i eq_th = + let partial_i = gen_partial_poly i (rand (concl eq_th)) in + let pi = (rator o lhand o concl) partial_i in + REWRITE_RULE[GSYM partial2] (TRANS (AP_TERM pi eq_th) partial_i) in + let partials2 = map (fun th, i -> map (fun j -> get_partial j th) (1--i)) (zip partials (1--n)) in + gen_second_bounded_poly_thm poly_tm partials2;; + +(* let eq_th = TAUT `(P ==> Q /\ R) <=> ((P ==> Q) /\ (P ==> R))` in + REWRITE_RULE[eq_th; FORALL_AND_THM; GSYM m_bounded_on_int] second_th;;*) + + +(* eval_second_bounded *) +let eval_second_bounded pp0 second_bounded_th = + let poly_tm = (lhand o rator o lhand o concl) second_bounded_th in + let th0 = second_bounded_th in + let n = (get_dim o fst o dest_abs) poly_tm in + let x_vector = mk_vector_list (map (fun i -> x_vars_array.(i)) (1--n)) and + z_vector = mk_vector_list (map (fun i -> z_vars_array.(i)) (1--n)) in + let _, _, _, _, _, _, domain_var = get_types_and_vars n in + + let th1 = INST[mk_pair (x_vector, z_vector), domain_var] th0 in + let th2 = REWRITE_RULE[IN_INTERVAL; dimindex_array.(n)] th1 in + let th3 = REWRITE_RULE[gen_in_interval n; GSYM interval_arith] th2 in + let th4 = (REWRITE_RULE[CONJ_ACI] o REWRITE_RULE (Array.to_list comp_thms_array.(n))) th3 in + let final_th0 = (UNDISCH_ALL o MATCH_MP iffRL) th4 in + + let x_var, h_tm = (dest_forall o hd o hyp) final_th0 in + let _, h2 = dest_imp h_tm in + let concl_ints = striplist dest_conj h2 in + + let i_funs = map (fun int -> + let expr, var = dest_interval_arith int in + (eval_constants pp0 o build_interval_fun) expr, var) concl_ints in + + let rec split_rules i_list = + match i_list with + | [] -> ([], []) + | ((i_fun, var_tm) :: es) -> + let th_list, i_list' = split_rules es in + match i_fun with + | Int_const th -> (var_tm, th) :: th_list, i_list' +(* | Int_var v -> (var_tm, INST[v, x_var_real] CONST_INTERVAL') :: th_list, i_list' *) + | _ -> th_list, (var_tm, i_fun) :: i_list' in + + let const_th_list, i_list0 = split_rules i_funs in + let th5 = itlist (fun (var_tm, th) th0 -> + let b_tm = rand (concl th) in + (REWRITE_RULE[th] o INST[b_tm, var_tm]) th0) const_th_list (SYM th4) in + let final_th = REWRITE_RULE[GSYM IMP_IMP] th5 in + let v_list, i_list' = unzip i_list0 in + let i_list = find_and_replace_all i_list' [] in + + fun pp x_vector_tm z_vector_tm -> + let x_vals = dest_vector x_vector_tm and + z_vals = dest_vector z_vector_tm in + if length x_vals <> n or length z_vals <> n then + failwith (sprintf "Wrong vector size; expected size: %d" n) + else + let x_vars = map (fun i -> x_vars_array.(i)) (1--n) and + z_vars = map (fun i -> z_vars_array.(i)) (1--n) in + + let inst_th = (INST (zip x_vals x_vars) o INST (zip z_vals z_vars)) final_th in + if (not o is_eq) (concl inst_th) then inst_th + else + let x_var, lhs = (dest_forall o lhand o concl) inst_th in + let hs = (butlast o striplist dest_imp) lhs in + let vars = map (rand o rator) hs in + let int_vars = zip vars (map ASSUME hs) in + + let dd_ints = eval_interval_fun_list pp i_list int_vars in + let inst_dd = map2 (fun var th -> (rand o concl) th, var) v_list dd_ints in + let inst_th2 = INST inst_dd inst_th in + + let conj_th = end_itlist CONJ dd_ints in + let lhs_th = GEN x_var (itlist DISCH hs conj_th) in + EQ_MP inst_th2 lhs_th;; + + + +let eval_second_bounded_poly0 pp0 poly_tm = + eval_second_bounded pp0 (gen_second_bounded_poly_thm0 poly_tm);; + + +(****************************) + +(* +needs "../formal_lp/formal_interval/m_examples_poly.hl";; + +let pi5 = (fst o dest_pair o rand o concl) pi_approx_array.(5);; +let pp = 5;; + +(* n = 3 *) + +let n = 3;; +let x_tm = mk_vector_list (replicate one_float n) and + z_tm = mk_vector_list (replicate pi5 n);; + +let eval_poly = eval_second_bounded_poly0 pp schwefel_poly;; +eval_poly pp x_tm z_tm;; +(* 10: 0.928 (0.688 after find_and_replace_all) *) +test 100 (eval_poly pp x_tm) z_tm;; + + +let eval_poly = eval_second_bounded_poly0 pp rd_poly;; +eval_poly pp x_tm z_tm;; +(* 10: 0.08 *) +test 1000 (eval_poly x_tm) z_tm;; + + +(* n = 4 *) +let n = 4;; +let x_tm = mk_vector_list (replicate one_float n) and + z_tm = mk_vector_list (replicate pi5 n);; + +let eval_poly = eval_second_bounded_poly0 pp lv_poly;; +eval_poly 2 x_tm z_tm;; +(* 10: 0.460 (0.232 after find_and_replace_all) *) +test 100 (eval_poly x_tm) z_tm;; + + +(* n = 6 *) +let n = 6;; +let x_tm = mk_vector_list (replicate one_float n) and + z_tm = mk_vector_list (replicate pi5 n);; + +let eval_poly = eval_second_bounded_poly0 pp delta_x4_poly;; +eval_poly x_tm z_tm;; +(* 10: 0.168 *) +test 1000 (eval_poly x_tm) z_tm;; + +(* n = 7 *) +let n = 7;; +let x_tm = mk_vector_list (replicate one_float n) and + z_tm = mk_vector_list (replicate pi5 n);; + +let eval_poly = eval_second_bounded_poly0 pp magnetism_poly;; +eval_poly 3 x_tm z_tm;; +(* 10: 0.212 *) +test 1000 (eval_poly x_tm) z_tm;; + + +(* n = 8 *) +let n = 8;; +let x_tm = mk_vector_list (replicate one_float n) and + z_tm = mk_vector_list (replicate pi5 n);; + +let eval_poly = eval_second_bounded_poly0 pp heart_poly;; +eval_poly x_tm z_tm;; +(* 10: 7.03 (3.272 after find_and_replace_all) *) +test 100 (eval_poly x_tm) z_tm;; +*) + + +(*************************************) + +let eval_m_taylor pp0 diff2c_th lin_th second_th = + let poly_tm = (rand o concl) diff2c_th in + let n = (get_dim o fst o dest_abs) poly_tm in + let eval_lin = eval_lin_approx pp0 lin_th and + eval_second = eval_second_bounded pp0 second_th in + + let ty, _, x_var, f_var, y_var, w_var, domain_var = get_types_and_vars n in + let th0 = (SPEC_ALL o inst_first_type_var ty) m_taylor_interval in + let th1 = INST[poly_tm, f_var] th0 in + let th2 = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o MATCH_MP iffRL o REWRITE_RULE[diff2c_th]) th1 in + + fun p_lin p_second domain_th -> + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let x_tm, z_tm = dest_pair domain_tm in + + let lin_th = eval_lin p_lin y_tm and + second_th = eval_second p_second x_tm z_tm in + + let _, _, f_bounds, df_bounds_list = dest_lin_approx (concl lin_th) in + let dd_bounds_list = (rand o concl) second_th in + let df_var = mk_var ("d_bounds_list", type_of df_bounds_list) and + dd_var = mk_var ("dd_bounds_list", type_of dd_bounds_list) in + + (MY_PROVE_HYP domain_th o MY_PROVE_HYP lin_th o MY_PROVE_HYP second_th o + INST[domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + f_bounds, f_bounds_var; df_bounds_list, df_var; dd_bounds_list, dd_var]) th2;; + + +let eval_m_taylor_poly0 pp0 poly_tm = + let diff2_th = gen_diff2c_domain_poly poly_tm in + let x_var, _ = dest_abs poly_tm in + let n = get_dim x_var in + let partials = map (fun i -> gen_partial_poly i poly_tm) (1--n) in + let get_partial i eq_th = + let partial_i = gen_partial_poly i (rand (concl eq_th)) in + let pi = (rator o lhand o concl) partial_i in + REWRITE_RULE[GSYM partial2] (TRANS (AP_TERM pi eq_th) partial_i) in + let partials2 = map2 (fun th i -> map (fun j -> get_partial j th) (1--i)) partials (1--n) in + let second_th = gen_second_bounded_poly_thm poly_tm partials2 in + let diff_th = gen_diff_poly poly_tm in + let lin_th = gen_lin_approx_poly_thm poly_tm diff_th partials in + eval_m_taylor pp0 diff2_th lin_th second_th;; + + +(**************************) + +(* +let pp = 5;; +let n = 3;; + +let x_list = mk_list (replicate one_float n, real_ty) and + z_list = mk_list (replicate pi5 n, real_ty);; +let domain_th = mk_m_center_domain n pp x_list z_list;; + +let poly_tm = rd_poly;; +let eval_poly = eval_m_taylor_poly0 pp poly_tm;; +eval_poly pp pp domain_th;; +(* 10: 1.004 *) +test 100 eval_poly domain_th;; + +(* n = 6 *) +let n = 6;; + +let x_list = mk_list (replicate one_float n, real_ty) and + z_list = mk_list (replicate pi5 n, real_ty);; +let domain_th = mk_m_center_domain n pp x_list z_list;; + +let poly_tm = delta_x4_poly;; +let eval_poly = eval_m_taylor_poly pp poly_tm;; +eval_poly domain_th;; +(* 10: 2.672 *) +test 100 eval_poly domain_th;; + + + +(* n = 8 *) +let n = 8;; + +let x_list = mk_list (replicate one_float n, real_ty) and + z_list = mk_list (replicate pi5 n, real_ty);; +let domain_th = mk_m_center_domain n pp x_list z_list;; + +let poly_tm = heart_poly;; +let eval_poly = eval_m_taylor_poly0 pp poly_tm;; +eval_poly pp pp domain_th;; +(* 10: 2.208 *) +test 10 eval_poly domain_th;; +*) + + +(******************************************) + +(* mk_eval_function *) + +let mk_eval_function_eq pp0 eq_th = + let expr_tm = (rand o concl) eq_th in + let tm0 = `!x:real^N. x IN interval [domain] ==> interval_arith (f x) f_bounds` in + let n = (get_dim o fst o dest_abs) expr_tm in + let x_vector = mk_vector_list (map (fun i -> x_vars_array.(i)) (1--n)) and + z_vector = mk_vector_list (map (fun i -> z_vars_array.(i)) (1--n)) in + let ty, _, _, _, _, _, domain_var = get_types_and_vars n and + f_var = mk_var ("f", type_of expr_tm) in + let th1 = (REWRITE_CONV[IN_INTERVAL] o subst[mk_pair(x_vector,z_vector), domain_var] o inst[ty, nty]) tm0 in + let th2 = REWRITE_RULE [dimindex_array.(n)] th1 in + let th3 = REWRITE_RULE [gen_in_interval n; GSYM interval_arith] th2 in + let th4 = (REWRITE_RULE[GSYM IMP_IMP; CONJ_ACI] o REWRITE_RULE (Array.to_list comp_thms_array.(n))) th3 in + let final_th0 = (CONV_RULE ((RAND_CONV o ONCE_DEPTH_CONV) BETA_CONV) o INST[expr_tm, f_var]) th4 in + let x_var, h_tm = (dest_forall o rand o concl) final_th0 in + let f_tm = (fst o dest_interval_arith o last o striplist dest_imp) h_tm in + let i_fun = (eval_constants pp0 o build_interval_fun) f_tm in + let i_list = find_and_replace_all [i_fun] [] in + let final_th = (PURE_REWRITE_RULE[SYM eq_th] o SYM) final_th0 in + fun pp x_vector_tm z_vector_tm -> + let x_vals = dest_vector x_vector_tm and + z_vals = dest_vector z_vector_tm in + if length x_vals <> n or length z_vals <> n then + failwith (sprintf "Wrong vector size; expected size: %d" n) + else + let x_vars = map (fun i -> x_vars_array.(i)) (1--n) and + z_vars = map (fun i -> z_vars_array.(i)) (1--n) in + + let inst_th = (INST (zip x_vals x_vars) o INST (zip z_vals z_vars)) final_th in + let x_var, lhs = (dest_forall o lhand o concl) inst_th in + let hs = (butlast o striplist dest_imp) lhs in + let vars = map (rand o rator) hs in + let int_vars = zip vars (map ASSUME hs) in + let eval_th = hd (eval_interval_fun_list pp i_list int_vars) in + let f_bounds = (rand o concl) eval_th in + let inst_th2 = INST[f_bounds, f_bounds_var] inst_th in + let lhs_th = GEN x_var (itlist DISCH hs eval_th) in + EQ_MP inst_th2 lhs_th;; + + +let mk_eval_function pp0 expr_tm = mk_eval_function_eq pp0 (REFL expr_tm);; + + + + + +(********************************) +(* m_taylor_error *) + + +(* +(* n = 4 *) +let n = 4;; +let x_list = mk_list (replicate one_float n, real_ty) and + z_list = mk_list (replicate pi5 n, real_ty);; +let domain_th = mk_m_center_domain n pp x_list z_list;; + +let eval_poly = eval_m_taylor_poly pp lv_poly;; +eval_poly domain_th;; +*) + +(**********) + + +(* Sum of the list elements *) +let ITLIST2_EQ_SUM = prove(`!(f:A->B->real) l1 l2. LENGTH l1 <= LENGTH l2 ==> + ITLIST2 (\x y z. f x y + z) l1 l2 (&0) = + sum (1..(LENGTH l1)) (\i. f (EL (i - 1) l1) (EL (i - 1) l2))`, + GEN_TAC THEN + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[LENGTH; ITLIST2_DEF] THEN TRY ARITH_TAC THENL + [ + REWRITE_TAC[SUM_CLAUSES_NUMSEG; ARITH]; + REWRITE_TAC[SUM_CLAUSES_NUMSEG; ARITH]; + ALL_TAC + ] THEN + REWRITE_TAC[leqSS] THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `t':(B)list`) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[TL; th]) THEN + REWRITE_TAC[GSYM add1n] THEN + new_rewrite [] [] SUM_ADD_SPLIT THEN REWRITE_TAC[ARITH] THEN + REWRITE_TAC[TWO; add1n; SUM_SING_NUMSEG; subnn; EL; HD] THEN + REWRITE_TAC[GSYM addn1; SUM_OFFSET; REAL_EQ_ADD_LCANCEL] THEN + MATCH_MP_TAC SUM_EQ THEN move ["i"] THEN REWRITE_TAC[IN_NUMSEG] THEN DISCH_TAC THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= i ==> (i + 1) - 1 = SUC (i - 1)`; EL; TL]);; + + +let interval_arith_abs_le = prove(`!x int y. interval_arith x int ==> iabs int <= y ==> abs x <= y`, + GEN_TAC THEN case THEN REWRITE_TAC[interval_arith; IABS'] THEN REAL_ARITH_TAC);; + +let l_seq = new_definition `l_seq n m = TABLE (\i. n + i) ((m + 1) - n)`;; + +(* TODO: create a file containing theorems about tables *) + +let REVERSE_TABLE = define `(REVERSE_TABLE (f:num->A) 0 = []) /\ + (REVERSE_TABLE f (SUC i) = CONS (f i) ( REVERSE_TABLE f i))`;; + + +let TABLE = new_definition `!(f:num->A) k. TABLE f k = REVERSE (REVERSE_TABLE f k)`;; + + +let LENGTH_REVERSE_TABLE = prove(`!(f:num->A) n. LENGTH (REVERSE_TABLE f n) = n`, + GEN_TAC THEN INDUCT_TAC THEN ASM_REWRITE_TAC[REVERSE_TABLE; LENGTH]);; + + +let LENGTH_REVERSE = prove(`!(l:(A)list). LENGTH (REVERSE l) = LENGTH l`, + MATCH_MP_TAC list_INDUCT THEN REWRITE_TAC[REVERSE] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[LENGTH_APPEND; LENGTH] THEN + ARITH_TAC);; + + +let LENGTH_TABLE = prove(`!(f:num->A) n. LENGTH (TABLE f n) = n`, + REWRITE_TAC[TABLE; LENGTH_REVERSE; LENGTH_REVERSE_TABLE]);; + + +let LENGTH_L_SEQ = prove(`LENGTH (l_seq n m) = (m + 1) - n`, REWRITE_TAC[l_seq; LENGTH_TABLE]);; +let EL_L_SEQ = prove(`!i m n. i < (m + 1) - n ==> EL i (l_seq n m) = n + i`, + REWRITE_TAC[l_seq] THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC Packing3.EL_TABLE THEN ASM_REWRITE_TAC[]);; +let L_SEQ_NIL = prove(`!n m. l_seq n m = [] <=> (m < n)`, + GEN_TAC THEN GEN_TAC THEN REWRITE_TAC[GSYM LENGTH_EQ_NIL; LENGTH_L_SEQ] THEN ARITH_TAC);; +let L_SEQ_NN = prove(`!n. l_seq n n = [n]`, + GEN_TAC THEN REWRITE_TAC[l_seq; ARITH_RULE `(n + 1) - n = 1`; ONE; TABLE; REVERSE_TABLE; REVERSE] THEN + REWRITE_TAC[APPEND; ADD_0]);; + +let L_SEQ_CONS = prove(`!n m. n <= m ==> l_seq n m = CONS n (l_seq (n + 1) m)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[Packing3.LIST_EL_EQ; LENGTH_L_SEQ; LENGTH] THEN CONJ_TAC THENL + [ + ASM_ARITH_TAC; + ALL_TAC + ] THEN + case THENL + [ + DISCH_TAC THEN new_rewrite [] [] EL_L_SEQ THEN ASM_REWRITE_TAC[EL; HD; addn0]; + move ["i"; "lt"] THEN + new_rewrite [] [] EL_L_SEQ THEN ASM_REWRITE_TAC[EL; TL] THEN + new_rewrite [] [] EL_L_SEQ THEN ASM_ARITH_TAC + ]);; + + + +let ALL_N_ALL2 = prove(`!P (l:(A)list) i0. + (all_n i0 l P <=> if l = [] then T else ALL2 P (l_seq i0 ((i0 + LENGTH l) - 1)) l)`, + GEN_TAC THEN LIST_INDUCT_TAC THEN GEN_TAC THEN REWRITE_TAC[all_n; NOT_CONS_NIL] THEN + new_rewrite [] [] L_SEQ_CONS THEN REWRITE_TAC[LENGTH; ALL2] THEN TRY ARITH_TAC THEN + FIRST_X_ASSUM (new_rewrite [] []) THEN TRY ARITH_TAC THEN + REWRITE_TAC[addSn; addnS; addn1] THEN + SPEC_TAC (`t:(A)list`, `t:(A)list`) THEN case THEN SIMP_TAC[NOT_CONS_NIL] THEN + REWRITE_TAC[LENGTH; addn0] THEN + MP_TAC (SPECL [`SUC i0`; `SUC i0 - 1`] L_SEQ_NIL) THEN + REWRITE_TAC[ARITH_RULE `SUC i0 - 1 < SUC i0`] THEN DISCH_THEN (fun th -> REWRITE_TAC[th; ALL2]));; + + +let ALL_N_EL = prove(`!P (l:(A)list) i0. all_n i0 l P <=> (!i. i < LENGTH l ==> P (i0 + i) (EL i l))`, + REPEAT GEN_TAC THEN REWRITE_TAC[ALL_N_ALL2] THEN + SPEC_TAC (`l:(A)list`, `l:(A)list`) THEN case THEN SIMP_TAC[NOT_CONS_NIL; LENGTH; ltn0] THEN + REPEAT GEN_TAC THEN + new_rewrite [] [] ALL2_ALL_ZIP THENL + [ + REWRITE_TAC[LENGTH_L_SEQ; LENGTH] THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[GSYM ALL_EL] THEN + new_rewrite [] [] LENGTH_ZIP THENL + [ + REWRITE_TAC[LENGTH_L_SEQ; LENGTH] THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[LENGTH_L_SEQ; ARITH_RULE `((i0 + SUC a) - 1 + 1) - i0 = SUC a`] THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[] THEN + new_rewrite [] [] EL_ZIP THENL + [ + REWRITE_TAC[LENGTH_L_SEQ; LENGTH] THEN ASM_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[] THEN new_rewrite [] [] EL_L_SEQ THEN ASM_ARITH_TAC; + ALL_TAC + ] THEN + new_rewrite [] [] EL_ZIP THENL + [ + REWRITE_TAC[LENGTH_L_SEQ; LENGTH] THEN ASM_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[] THEN new_rewrite [] [] EL_L_SEQ THEN TRY ASM_ARITH_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]);; + + + +let LENGTH_BUTLAST = prove(`!l. LENGTH (BUTLAST l) = LENGTH l - 1`, + MATCH_MP_TAC list_INDUCT THEN REWRITE_TAC[BUTLAST; LENGTH; ARITH] THEN REPEAT STRIP_TAC THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[LENGTH; ARITH] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM LENGTH_EQ_NIL] THEN + ARITH_TAC);; + + +let EL_BUTLAST = prove(`!(l:(A)list) i. i < LENGTH l - 1 ==> EL i (BUTLAST l) = EL i l`, + MATCH_MP_TAC list_INDUCT THEN REWRITE_TAC[BUTLAST; LENGTH] THEN REPEAT STRIP_TAC THEN + COND_CASES_TAC THENL + [ + UNDISCH_TAC `i < SUC (LENGTH (a1:(A)list)) - 1` THEN + ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[EL_CONS] THEN COND_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i - 1`) THEN + ANTS_TAC THENL + [ + ASM_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[]);; + + + +let M_TAYLOR_ERROR_ITLIST2 = prove(`!f domain y w dd_bounds_list error. + m_cell_domain domain y (vector w) ==> + diff2c_domain domain f ==> + second_bounded (f:real^N->real) domain dd_bounds_list ==> + LENGTH w = dimindex (:N) ==> + LENGTH dd_bounds_list = dimindex (:N) ==> + all_n 1 dd_bounds_list (\i list. LENGTH list = i) ==> + ITLIST2 (\list x z. x * (x * iabs (LAST list) + + &2 * ITLIST2 (\a b c. b * iabs a + c) (BUTLAST list) w (&0)) + z) + dd_bounds_list w (&0) <= error ==> + m_taylor_error f domain (vector w) error`, + REPEAT GEN_TAC THEN REWRITE_TAC[second_bounded] THEN + set_tac "s" `ITLIST2 _1 _2 _3 _4` THEN + move ["domain"; "d2f"; "second"; "lw"; "ldd"; "ldd_all"; "s_le"] THEN + ASM_SIMP_TAC[m_taylor_error_eq] THEN move ["x"; "x_in"] THEN + SUBGOAL_THEN `!i. i IN 1..dimindex (:N) ==> &0 <= EL (i - 1) w` (LABEL_TAC "w_ge0") THENL + [ + GEN_TAC THEN DISCH_TAC THEN REMOVE_THEN "domain" MP_TAC THEN new_rewrite [] [] pair_eq THEN + REWRITE_TAC[m_cell_domain] THEN + DISCH_THEN (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[VECTOR_COMPONENT] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `s:real` THEN ASM_REWRITE_TAC[] THEN + EXPAND_TAC "s" THEN + new_rewrite [] [] ITLIST2_EQ_SUM THEN ASM_REWRITE_TAC[LE_REFL] THEN + MATCH_MP_TAC SUM_LE THEN REWRITE_TAC[FINITE_NUMSEG] THEN + move ["i"; "i_in"] THEN ASM_SIMP_TAC[VECTOR_COMPONENT] THEN + USE_THEN "i_in" (ASSUME_TAC o REWRITE_RULE[IN_NUMSEG]) THEN + MATCH_MP_TAC REAL_LE_LMUL THEN ASM_SIMP_TAC[] THEN + SUBGOAL_THEN `LENGTH (EL (i - 1) dd_bounds_list:(real#real)list) = i` (LABEL_TAC "len_i") THENL + [ + REMOVE_THEN "ldd_all" MP_TAC THEN + REWRITE_TAC[ALL_N_EL] THEN DISCH_THEN (MP_TAC o SPEC `i - 1`) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + new_rewrite [] [] ITLIST2_EQ_SUM THEN ASM_REWRITE_TAC[] THENL + [ + REWRITE_TAC[LENGTH_BUTLAST] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_ADD2 THEN CONJ_TAC THENL + [ + new_rewrite [] [] LAST_EL THENL + [ + ASM_REWRITE_TAC[GSYM LENGTH_EQ_NIL] THEN + REMOVE_THEN "i_in" MP_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_LMUL THEN ASM_SIMP_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:real^N`) THEN ASM_REWRITE_TAC[ALL_N_EL] THEN + DISCH_THEN (MP_TAC o SPEC `i - 1`) THEN + ANTS_TAC THENL + [ + REMOVE_THEN "i_in" MP_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (MP_TAC o SPEC `i - 1`) THEN ANTS_TAC THENL + [ + UNDISCH_TAC `1 <= i /\ i <= dimindex (:N)` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC; + ALL_TAC + ] THEN + SUBGOAL_THEN `1 + i - 1 = i /\ 1 + i - 1 = i` (fun th -> REWRITE_TAC[th]) THENL + [ + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[partial2] THEN + DISCH_THEN (MP_TAC o MATCH_MP interval_arith_abs_le) THEN + DISCH_THEN MATCH_MP_TAC THEN REWRITE_TAC[REAL_LE_REFL]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_LMUL THEN CONJ_TAC THENL [ REAL_ARITH_TAC; ALL_TAC ] THEN + ASM_REWRITE_TAC[LENGTH_BUTLAST] THEN + MATCH_MP_TAC SUM_LE THEN REWRITE_TAC[FINITE_NUMSEG] THEN + move ["j"; "j_in"] THEN + SUBGOAL_THEN `j IN 1..dimindex (:N)` (LABEL_TAC "j_in2") THENL + [ + REMOVE_THEN "i_in" MP_TAC THEN REMOVE_THEN "j_in" MP_TAC THEN + REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + ASM_SIMP_TAC[VECTOR_COMPONENT] THEN + USE_THEN "j_in" (ASSUME_TAC o REWRITE_RULE[IN_NUMSEG]) THEN + MATCH_MP_TAC REAL_LE_LMUL THEN ASM_SIMP_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:real^N`) THEN ASM_REWRITE_TAC[ALL_N_EL] THEN + DISCH_THEN (MP_TAC o SPEC `i - 1`) THEN ANTS_TAC THENL + [ + REMOVE_THEN "i_in" MP_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (MP_TAC o SPEC `j - 1`) THEN ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + SUBGOAL_THEN `1 + j - 1 = j /\ 1 + i - 1 = i` (fun th -> REWRITE_TAC[th]) THENL + [ + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[partial2] THEN + DISCH_THEN (MP_TAC o MATCH_MP interval_arith_abs_le) THEN + DISCH_THEN MATCH_MP_TAC THEN + new_rewrite [] [] EL_BUTLAST THENL + [ + ASM_REWRITE_TAC[] THEN REMOVE_THEN "j_in" MP_TAC THEN REMOVE_THEN "i_in" MP_TAC THEN + REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[REAL_LE_REFL]);; + + +let M_TAYLOR_ERROR_ITLIST2_ALT = prove(`!f domain y w f_lo f_hi d_bounds_list dd_bounds_list error. + m_taylor_interval f domain y (vector w:real^N) (f_lo, f_hi) d_bounds_list dd_bounds_list ==> + LENGTH w = dimindex (:N) ==> + LENGTH dd_bounds_list = dimindex (:N) ==> + all_n 1 dd_bounds_list (\i list. LENGTH list = i) ==> + ITLIST2 (\list x z. x * (x * iabs (LAST list) + + &2 * ITLIST2 (\a b c. b * iabs a + c) (BUTLAST list) w (&0)) + z) + dd_bounds_list w (&0) <= error ==> + m_taylor_error f domain (vector w) error`, + REWRITE_TAC[m_taylor_interval] THEN REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL M_TAYLOR_ERROR_ITLIST2) THEN ASM_REWRITE_TAC[]);; + + + +(**********************************) + +(* +let pp = 5;; +let eval_poly = eval_m_taylor_poly0 pp lv_poly;; + +let n = 4;; +let xx = mk_vector_list (replicate one_float 4) and + zz = mk_vector_list (replicate two_float 4);; + +let domain4_th = mk_m_center_domain n pp (rand xx) (rand zz);; + +let m_taylor_th = eval_poly pp pp domain4_th;; +*) + +(****************************) + +let M_TAYLOR_INTERVAL' = MY_RULE m_taylor_interval;; + +let dest_m_taylor m_taylor_tm = + let ltm1, dd_bounds_list = dest_comb m_taylor_tm in + let ltm2, d_bounds_list = dest_comb ltm1 in + let ltm3, f_bounds = dest_comb ltm2 in + let ltm4, w = dest_comb ltm3 in + let ltm5, y = dest_comb ltm4 in + let ltm6, domain = dest_comb ltm5 in + rand ltm6, domain, y, w, f_bounds, d_bounds_list, dd_bounds_list;; + +let dest_m_taylor_thms n = + let ty, xty, x_var, f_var, y_var, w_var, domain_var = get_types_and_vars n in + fun m_taylor_th -> + let f, domain, y, w, f_bounds, d_bounds_list, dd_bounds_list = dest_m_taylor (concl m_taylor_th) in + let th0 = (INST[f, f_var; domain, domain_var; y, y_var; w, w_var; f_bounds, f_bounds_var; + d_bounds_list, d_bounds_list_var; dd_bounds_list, dd_bounds_list_var] o + inst_first_type_var ty) M_TAYLOR_INTERVAL' in + let th1 = EQ_MP th0 m_taylor_th in + let [domain_th; d2_th; lin_th; second_th] = CONJUNCTS th1 in + domain_th, d2_th, lin_th, second_th;; + + + +(* +eval_m_taylor_error n pp m_taylor_th;; +(* 0.956 *) +test 100 (eval_m_taylor_error n pp) m_taylor_th;; +*) + +(**********************) + +(* bound *) +let M_TAYLOR_BOUND' = + prove(`m_taylor_interval f domain y (vector w:real^N) (f_lo, f_hi) d_bounds_list dd_bounds_list /\ + m_taylor_error f domain (vector w) error /\ + ITLIST2 (\a b c. b * iabs a + c) d_bounds_list w (&0) <= b /\ + b + inv(&2) * error <= a /\ + lo <= f_lo - a /\ + f_hi + a <= hi /\ + LENGTH w = dimindex (:N) /\ LENGTH d_bounds_list = dimindex (:N) ==> + (!x. x IN interval [domain] ==> interval_arith (f x) (lo, hi))`, + REWRITE_TAC[GSYM m_bounded_on_int; m_taylor_interval; m_lin_approx; ALL_N_EL] THEN + set_tac "s" `ITLIST2 _1 _2 _3 _4` THEN STRIP_TAC THEN + SUBGOAL_THEN `diff2_domain domain (f:real^N->real)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + SIMP_TAC[diff2_domain; diff2c_domain; diff2c]; + ALL_TAC + ] THEN + apply_tac m_taylor_bounds THEN + MAP_EVERY EXISTS_TAC [`y:real^N`; `vector w:real^N`; `error:real`; `f_lo:real`; `f_hi:real`; `a:real`] THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b + inv (&2) * error` THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[real_div; REAL_MUL_AC] THEN + MATCH_MP_TAC REAL_LE_ADD2 THEN REWRITE_TAC[REAL_LE_REFL] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `s:real` THEN ASM_REWRITE_TAC[] THEN + EXPAND_TAC "s" THEN new_rewrite [] [] ITLIST2_EQ_SUM THEN ASM_REWRITE_TAC[LE_REFL] THEN + MATCH_MP_TAC SUM_LE THEN REWRITE_TAC[FINITE_NUMSEG] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN ASM_SIMP_TAC[VECTOR_COMPONENT; REAL_LE_REFL; REAL_ABS_POS] THEN + CONJ_TAC THENL + [ + UNDISCH_TAC `m_cell_domain domain (y:real^N) (vector w)` THEN + new_rewrite [] [] pair_eq THEN REWRITE_TAC[m_cell_domain] THEN + DISCH_THEN (MP_TAC o SPEC `x:num`) THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[VECTOR_COMPONENT] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x - 1`) THEN + ANTS_TAC THENL + [ + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (MP_TAC o MATCH_MP interval_arith_abs_le) THEN + SUBGOAL_THEN `1 + x - 1 = x` (fun th -> REWRITE_TAC[th]) THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN MATCH_MP_TAC THEN REWRITE_TAC[REAL_LE_REFL]);; + + +(* upper *) +let M_TAYLOR_UPPER_BOUND' = prove(`m_taylor_interval f domain y (vector w) (f_lo, f_hi) + d_bounds_list dd_bounds_list /\ + m_taylor_error f domain (vector w:real^N) error /\ + ITLIST2 (\a b c. b * iabs a + c) d_bounds_list w (&0) <= b /\ + b + inv(&2) * error <= a /\ + f_hi + a <= hi /\ + LENGTH w = dimindex (:N) /\ LENGTH d_bounds_list = dimindex (:N) ==> + (!p. p IN interval [domain] ==> f p <= hi)`, + STRIP_TAC THEN + MP_TAC (INST[`f_lo - a:real`, `lo:real`] M_TAYLOR_BOUND') THEN + ASM_SIMP_TAC[interval_arith; REAL_LE_REFL]);; + + +(* lower *) +let M_TAYLOR_LOWER_BOUND' = prove(`m_taylor_interval f domain y (vector w:real^N) (f_lo, f_hi) + d_bounds_list dd_bounds_list /\ + m_taylor_error f domain (vector w) error /\ + ITLIST2 (\a b c. b * iabs a + c) d_bounds_list w (&0) <= b /\ + b + inv(&2) * error <= a /\ + lo <= f_lo - a /\ + LENGTH w = dimindex (:N) /\ LENGTH d_bounds_list = dimindex (:N) ==> + (!p. p IN interval [domain] ==> lo <= f p)`, + STRIP_TAC THEN + MP_TAC (INST[`f_hi + a:real`, `hi:real`] M_TAYLOR_BOUND') THEN + ASM_SIMP_TAC[interval_arith; REAL_LE_REFL]);; + + + +(* arrays *) +let gen_taylor_bound_th bound_th n = + let th0 = (DISCH_ALL o MY_RULE o REWRITE_RULE[MY_RULE M_TAYLOR_ERROR_ITLIST2_ALT]) bound_th in + let ns = 1--n in + let mk_list_hd l = mk_list (l, type_of (hd l)) in + let w_list = mk_list_hd (map (fun i -> w_vars_array.(i)) ns) in + let d_bounds_list = mk_list_hd (map (fun i -> df_vars_array.(i)) ns) in + let dd_bounds_list = mk_list_hd (map (fun i -> mk_list_hd (map (fun j -> dd_vars_array.(i).(j)) (1--i))) ns) in + let th1 = (INST[w_list, w_var_list; d_bounds_list, d_bounds_list_var; + dd_bounds_list, dd_bounds_list_var] o INST_TYPE[n_type_array.(n), nty]) th0 in + let th2 = REWRITE_RULE[LAST; NOT_CONS_NIL; BUTLAST; all_n; ITLIST2_DEF; LENGTH; ARITH; dimindex_array.(n)] th1 in + let th3 = REWRITE_RULE[HD; TL; REAL_MUL_RZERO; REAL_ADD_RID; GSYM error_mul_f2] th2 in + (MY_RULE o REWRITE_RULE[float_inv2_th; SYM float2_eq]) th3;; + + +let m_taylor_upper_array = Array.init (max_dim + 1) + (fun i -> if i < 1 then TRUTH else gen_taylor_bound_th M_TAYLOR_UPPER_BOUND' i);; + +let m_taylor_lower_array = Array.init (max_dim + 1) + (fun i -> if i < 1 then TRUTH else gen_taylor_bound_th M_TAYLOR_LOWER_BOUND' i);; + +let m_taylor_bound_array = Array.init (max_dim + 1) + (fun i -> if i < 1 then TRUTH else gen_taylor_bound_th M_TAYLOR_BOUND' i);; + +(***************************) +(* eval_m_taylor_bounds0 *) +let b_var_real = `b:real`;; + + +let eval_m_taylor_bounds0 mode n pp m_taylor_th = + let bound_th = + if mode = "upper" then + m_taylor_upper_array.(n) + else if mode = "bound" then + m_taylor_bound_array.(n) + else + m_taylor_lower_array.(n) in + + let f_tm, domain_tm, y_tm, w_tm, f_bounds, d_bounds_list, dd_bounds_list = dest_m_taylor (concl m_taylor_th) in + let f_lo, f_hi = dest_pair f_bounds and + ws = dest_list (rand w_tm) and + dfs = dest_list d_bounds_list and + dds = map dest_list (dest_list dd_bounds_list) in + let ns = 1--n in + let df_vars = map (fun i -> df_vars_array.(i)) ns and + dd_vars = map (fun i -> map (fun j -> dd_vars_array.(i).(j)) (1--i)) ns and + w_vars = map (fun i -> w_vars_array.(i)) ns and + y_var = mk_var ("y", type_of y_tm) and + f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + (* sum of first partials *) + let d_th = + let mul_wd = map2 (error_mul_f2_le_conv2 pp) ws dfs in + end_itlist (add_ineq_hi pp) mul_wd in + + let b_tm = (rand o concl) d_th in + + (* sum of second partials *) + let dd_th = + let ( * ), ( + ) = mul_ineq_pos_const_hi pp, add_ineq_hi pp in + let mul_wdd = map2 (fun list i -> my_map2 (error_mul_f2_le_conv2 pp) ws list) dds ns in + let sums1 = map (end_itlist ( + ) o butlast) (tl mul_wdd) in + let sums2 = (hd o hd) mul_wdd :: map2 (fun list th1 -> last list + two_float * th1) (tl mul_wdd) sums1 in + let sums = map2 ( * ) ws sums2 in + end_itlist ( + ) sums in + + let error_tm = (rand o concl) dd_th in + + (* additional inequalities *) + let ineq1_th = + let ( * ), ( + ) = float_mul_hi pp, add_ineq_hi pp in + mk_refl_ineq b_tm + float_inv2 * error_tm in + + let a_tm = (rand o concl) ineq1_th in + + let prove_ineq2, bounds_inst = + if mode = "upper" then + let ineq2 = float_add_hi pp f_hi a_tm in + MY_PROVE_HYP ineq2, [(rand o concl) ineq2, hi_var_real] + else if mode = "bound" then + let ineq2 = float_add_hi pp f_hi a_tm in + let ineq3 = float_sub_lo pp f_lo a_tm in + MY_PROVE_HYP ineq2 o MY_PROVE_HYP ineq3, + [(rand o concl) ineq2, hi_var_real; (lhand o concl) ineq3, lo_var_real] + else + let ineq2 = float_sub_lo pp f_lo a_tm in + MY_PROVE_HYP ineq2, [(lhand o concl) ineq2, lo_var_real] in + + (* final step *) + let inst_list = + let inst1 = zip dfs df_vars in + let inst2 = zip (List.flatten dds) (List.flatten dd_vars) in + let inst3 = zip ws w_vars in + inst1 @ inst2 @ inst3 in + + (MY_PROVE_HYP m_taylor_th o MY_PROVE_HYP dd_th o MY_PROVE_HYP d_th o + MY_PROVE_HYP ineq1_th o prove_ineq2 o + INST ([f_hi, f_hi_var; f_lo, f_lo_var; error_tm, error_var; + a_tm, a_var_real; b_tm, b_var_real; + y_tm, y_var; domain_tm, domain_var; + f_tm, f_var] @ bounds_inst @ inst_list)) bound_th;; + + +(* upper *) +let eval_m_taylor_upper_bound = eval_m_taylor_bounds0 "upper";; + +(* lower *) +let eval_m_taylor_lower_bound = eval_m_taylor_bounds0 "lower";; + +(* bound *) +let eval_m_taylor_bound = eval_m_taylor_bounds0 "bound";; + + + +(* +eval_m_taylor_upper_bound n pp m_taylor_th;; +(* 10: 1.220 *) +test 100 (eval_m_taylor_upper_bound n pp) m_taylor_th;; +*) + + +(******************************) +(* taylor_upper_partial_bound *) +(* taylor_lower_partial_bound *) + + +(* bound *) +let M_TAYLOR_PARTIAL_BOUND' = + prove(`m_taylor_interval f domain (y:real^N) (vector w) f_bounds d_bounds_list dd_bounds_list /\ + i IN 1..dimindex (:N) /\ + EL (i - 1) d_bounds_list = (df_lo, df_hi) /\ + (!x. x IN interval [domain] ==> all_n 1 dd_list + (\j int. interval_arith (if j <= i then partial2 j i f x else partial2 i j f x) int)) /\ + LENGTH dd_list = dimindex (:N) /\ + LENGTH d_bounds_list = dimindex (:N) /\ + LENGTH w = dimindex (:N) /\ + ITLIST2 (\a b c. b * iabs a + c) dd_list w (&0) <= error /\ + df_hi + error <= hi ==> + lo <= df_lo - error ==> + (!x. x IN interval [domain] ==> interval_arith (partial i f x) (lo, hi))`, + REWRITE_TAC[m_taylor_interval; m_lin_approx; ALL_N_EL; GSYM m_bounded_on_int] THEN + set_tac "s" `ITLIST2 _1 _2 _3 _4` THEN REPEAT STRIP_TAC THEN + SUBGOAL_THEN `1 <= i /\ i <= dimindex (:N)` (LABEL_TAC "i_in") THENL + [ + ASM_REWRITE_TAC[GSYM IN_NUMSEG]; + ALL_TAC + ] THEN + SUBGOAL_THEN `diff2_domain domain (f:real^N->real)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + SIMP_TAC[diff2_domain; diff2c_domain; diff2c]; + ALL_TAC + ] THEN + REWRITE_TAC[ETA_AX] THEN apply_tac m_taylor_partial_bounds THEN + MAP_EVERY EXISTS_TAC [`y:real^N`; `vector w:real^N`; `error:real`; `df_lo:real`; `df_hi:real`] THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i - 1`) THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= i /\ i <= n ==> i - 1 < n`] THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= i ==> 1 + i - 1 = i`; interval_arith] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + REWRITE_TAC[m_taylor_partial_error] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `s:real` THEN ASM_REWRITE_TAC[] THEN + EXPAND_TAC "s" THEN new_rewrite [] [] ITLIST2_EQ_SUM THEN ASM_REWRITE_TAC[LE_REFL] THEN + MATCH_MP_TAC SUM_LE THEN REWRITE_TAC[FINITE_NUMSEG] THEN + move ["j"; "j_in"] THEN + ASM_SIMP_TAC[VECTOR_COMPONENT] THEN + MATCH_MP_TAC REAL_LE_LMUL THEN CONJ_TAC THENL + [ + UNDISCH_TAC `m_cell_domain domain (y:real^N) (vector w)` THEN + new_rewrite [] [] pair_eq THEN REWRITE_TAC[m_cell_domain] THEN + DISCH_THEN (MP_TAC o SPEC `j:num`) THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[VECTOR_COMPONENT] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:real^N`) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `j - 1`) THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN DISCH_TAC THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= j /\ j <= n ==> j - 1 < n`] THEN + ASM_SIMP_TAC[ARITH_RULE `!i. 1 <= i ==> 1 + i - 1 = i`; GSYM partial2] THEN + DISCH_THEN (MP_TAC o MATCH_MP interval_arith_abs_le) THEN + COND_CASES_TAC THEN TRY (DISCH_THEN MATCH_MP_TAC THEN REWRITE_TAC[REAL_LE_REFL]) THEN + new_rewrite [] [] mixed_second_partials THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + ASM_SIMP_TAC[diff2c_domain]; + ALL_TAC + ] THEN + DISCH_THEN MATCH_MP_TAC THEN REWRITE_TAC[REAL_LE_REFL]);; + + +(* upper *) +let M_TAYLOR_PARTIAL_UPPER' = + prove(`m_taylor_interval f domain (y:real^N) (vector w) f_bounds d_bounds_list dd_bounds_list /\ + i IN 1..dimindex (:N) /\ + EL (i - 1) d_bounds_list = (df_lo, df_hi) /\ + (!x. x IN interval [domain] ==> all_n 1 dd_list + (\j int. interval_arith (if j <= i then partial2 j i f x else partial2 i j f x) int)) /\ + LENGTH dd_list = dimindex (:N) /\ + LENGTH d_bounds_list = dimindex (:N) /\ + LENGTH w = dimindex (:N) /\ + ITLIST2 (\a b c. b * iabs a + c) dd_list w (&0) <= error /\ + df_hi + error <= hi ==> + (!x. x IN interval [domain] ==> partial i f x <= hi)`, + REPEAT STRIP_TAC THEN + MP_TAC (INST[`df_lo - error`, `lo:real`] M_TAYLOR_PARTIAL_BOUND') THEN ASM_REWRITE_TAC[REAL_LE_REFL] THEN + ASM_SIMP_TAC[interval_arith]);; + + +(* lower *) +let M_TAYLOR_PARTIAL_LOWER' = + prove(`m_taylor_interval f domain (y:real^N) (vector w) f_bounds d_bounds_list dd_bounds_list /\ + i IN 1..dimindex (:N) /\ + EL (i - 1) d_bounds_list = (df_lo, df_hi) /\ + (!x. x IN interval [domain] ==> all_n 1 dd_list + (\j int. interval_arith (if j <= i then partial2 j i f x else partial2 i j f x) int)) /\ + LENGTH dd_list = dimindex (:N) /\ + LENGTH d_bounds_list = dimindex (:N) /\ + LENGTH w = dimindex (:N) /\ + ITLIST2 (\a b c. b * iabs a + c) dd_list w (&0) <= error /\ + lo <= df_lo - error ==> + (!x. x IN interval [domain] ==> lo <= partial i f x)`, + REPEAT STRIP_TAC THEN + MP_TAC (INST[`df_hi + error`, `hi:real`] M_TAYLOR_PARTIAL_BOUND') THEN ASM_REWRITE_TAC[REAL_LE_REFL] THEN + ASM_SIMP_TAC[interval_arith]);; + + + + +(* arrays *) +let gen_taylor_partial_bound_th = + let imp_and_eq = TAUT `((P ==> Q) /\ (P ==> R)) <=> (P ==> Q /\ R)` in + let mk_list_hd l = mk_list (l, type_of (hd l)) in + let dd_list_var = `dd_list : (real#real)list` in + fun bound_th n i -> + let ns = 1--n in + let i_tm = mk_small_numeral i in + let w_list = mk_list_hd (map (fun i -> w_vars_array.(i)) ns) in + let d_bounds_list = mk_list_hd (map (fun i -> df_vars_array.(i)) ns) in + let dd_bounds_list = mk_list_hd + (map (fun i -> mk_list_hd (map (fun j -> dd_vars_array.(i).(j)) (1--i))) ns) in + let dd_list = mk_list_hd + (map (fun j -> if j <= i then dd_vars_array.(i).(j) else dd_vars_array.(j).(i)) ns) in + + let th1 = (INST[w_list, w_var_list; d_bounds_list, d_bounds_list_var; dd_list, dd_list_var; i_tm, `i:num`; + dd_bounds_list, dd_bounds_list_var] o INST_TYPE[n_type_array.(n), nty]) bound_th in + let th2 = REWRITE_RULE[REAL_ADD_RID; HD; TL; ITLIST2_DEF; LENGTH; ARITH; dimindex_array.(n)] th1 in + let th3 = REWRITE_RULE[IN_NUMSEG; ARITH; el_thms_array.(n).(i - 1)] th2 in + let th4 = (REWRITE_RULE[] o INST[`df_lo:real, df_hi:real`, df_vars_array.(i)]) th3 in + let th5 = (MY_RULE o REWRITE_RULE[GSYM imp_and_eq; GSYM AND_FORALL_THM; all_n; ARITH]) th4 in + + let m_taylor_hyp = find (can dest_m_taylor) (hyp th5) in + let t_th0 = (REWRITE_RULE[ARITH; all_n; second_bounded; m_taylor_interval] o ASSUME) m_taylor_hyp in + let t_th1 = REWRITE_RULE[GSYM imp_and_eq; GSYM AND_FORALL_THM] t_th0 in + (MY_RULE_NUM o REWRITE_RULE[GSYM error_mul_f2; t_th1] o DISCH_ALL) th5;; + + +(* The (n, i)-th element is the theorem |- i IN 1..dimindex (:n) *) +let i_in_array = Array.init (max_dim + 1) + (fun i -> Array.init (i + 1) + (fun j -> + if j < 1 then TRUTH else + let j_tm = mk_small_numeral j in + let tm0 = `j IN 1..dimindex (:N)` in + let tm1 = (subst [j_tm, `j:num`] o inst [n_type_array.(i), nty]) tm0 in + prove(tm1, REWRITE_TAC[dimindex_array.(i); IN_NUMSEG] THEN ARITH_TAC)));; + +let m_taylor_partial_upper_array, m_taylor_partial_lower_array, m_taylor_partial_bound_array = + let gen_array bound_th = Array.init (max_dim + 1) + (fun i -> Array.init (i + 1) + (fun j -> if j < 1 then TRUTH else gen_taylor_partial_bound_th bound_th i j)) in + gen_array M_TAYLOR_PARTIAL_UPPER', gen_array M_TAYLOR_PARTIAL_LOWER', gen_array M_TAYLOR_PARTIAL_BOUND';; + + +(***************************) + + +let eval_m_taylor_partial_bounds0 mode n pp i m_taylor_th = + let bound_th = + if mode = "upper" then + m_taylor_partial_upper_array.(n).(i) + else if mode = "bound" then + m_taylor_partial_bound_array.(n).(i) + else + m_taylor_partial_lower_array.(n).(i) in + + let f_tm, domain_tm, y_tm, w_tm, f_bounds, d_bounds_list, dd_bounds_list = dest_m_taylor (concl m_taylor_th) in + let ws = dest_list (rand w_tm) and + dfs = dest_list d_bounds_list and + dds = map dest_list (dest_list dd_bounds_list) in + let ns = 1--n in + let df_lo, df_hi = dest_pair (List.nth dfs (i - 1)) and + df_vars = map (fun i -> df_vars_array.(i)) ns and + dd_vars = map (fun i -> map (fun j -> dd_vars_array.(i).(j)) (1--i)) ns and + w_vars = map (fun i -> w_vars_array.(i)) ns and + y_var = mk_var ("y", type_of y_tm) and + f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + (* sum of second partials *) + let dd_list = map + (fun j -> if j <= i then List.nth (List.nth dds (i-1)) (j-1) else List.nth (List.nth dds (j-1)) (i-1)) ns in + + let dd_th = + let mul_dd = map2 (error_mul_f2_le_conv2 pp) ws dd_list in + end_itlist (add_ineq_hi pp) mul_dd in + + let error_tm = (rand o concl) dd_th in + + (* additional inequalities *) + let prove_ineq, bounds_inst = + if mode = "upper" then + let ineq2 = float_add_hi pp df_hi error_tm in + MY_PROVE_HYP ineq2, [(rand o concl) ineq2, hi_var_real] + else if mode = "bound" then + let ineq2 = float_add_hi pp df_hi error_tm in + let ineq3 = float_sub_lo pp df_lo error_tm in + MY_PROVE_HYP ineq2 o MY_PROVE_HYP ineq3, + [(rand o concl) ineq2, hi_var_real; (lhand o concl) ineq3, lo_var_real] + else + let ineq2 = float_sub_lo pp df_lo error_tm in + MY_PROVE_HYP ineq2, [(lhand o concl) ineq2, lo_var_real] in + + (* final step *) + let inst_list = + let inst1 = zip dfs df_vars in + let inst2 = zip (List.flatten dds) (List.flatten dd_vars) in + let inst3 = zip ws w_vars in + inst1 @ inst2 @ inst3 in + + (MY_PROVE_HYP m_taylor_th o MY_PROVE_HYP dd_th o prove_ineq o + INST ([df_hi, df_hi_var; df_lo, df_lo_var; error_tm, error_var; + y_tm, y_var; domain_tm, domain_var; f_bounds, f_bounds_var; + f_tm, f_var] @ bounds_inst @ inst_list)) bound_th;; + + +(* upper *) +let eval_m_taylor_partial_upper = eval_m_taylor_partial_bounds0 "upper";; + +(* lower *) +let eval_m_taylor_partial_lower = eval_m_taylor_partial_bounds0 "lower";; + +(* bound *) +let eval_m_taylor_partial_bound = eval_m_taylor_partial_bounds0 "bound";; + + +(* +eval_m_taylor_partial_upper n pp 1 m_taylor_th;; +eval_m_taylor_partial_upper n pp 4 m_taylor_th;; + +eval_m_taylor_partial_lower n pp 1 m_taylor_th;; +eval_m_taylor_partial_lower n pp 4 m_taylor_th;; + +(* 10: 0.252 *) +test 100 (eval_m_taylor_partial_upper n pp 1) m_taylor_th;; +(* 10: 0.296 *) +test 100 (eval_m_taylor_partial_upper n pp 4) m_taylor_th;; +*) + + + + +(**********************************) + +(* +let pp = 5;; +let eval_butcher = eval_m_taylor_poly0 pp butcher_poly;; + +let n = 6;; +let xx = mk_vector_list (replicate one_float n) and + zz = mk_vector_list (replicate two_float n);; + +let domain6_th = mk_m_center_domain n pp (rand xx) (rand zz);; + +let m_taylor_th = eval_butcher pp pp domain6_th;; + + + +eval_m_taylor_upper_bound n pp m_taylor_th;; +eval_m_taylor_partial_upper n pp 1 m_taylor_th;; +eval_m_taylor_partial_upper n pp 5 m_taylor_th;; + + +(* 10: 2.524 *) +(* 10 (mixed): 1.480 *) +test 100 (eval_m_taylor_upper_bound n pp) m_taylor_th;; +(* 10: 0.416 *) +(* 10 (mixed): 0.348 *) +test 100 (eval_m_taylor_partial_upper n pp 1) m_taylor_th;; +(* 10: 0.432 *) +(* 10 (mixed): 0.300 *) +test 100 (eval_m_taylor_partial_upper n pp 5) m_taylor_th;; +*) + + + diff --git a/formal_lp/old/formal_interval/m_taylor_arith.hl b/formal_lp/old/formal_interval/m_taylor_arith.hl new file mode 100644 index 0000000..8ae3c6d --- /dev/null +++ b/formal_lp/old/formal_interval/m_taylor_arith.hl @@ -0,0 +1,1684 @@ +needs "../formal_lp/formal_interval/m_taylor.hl";; + + +let i_var_num = `i:num` and + j_var_num = `j:num` and + df_bounds_list_var = `df_bounds_list : (real#real)list` and + list_var_real_pair = `list : (real#real)list`;; + + +(*************************************) + +let binary_beta_gen_eq f1_tm f2_tm x_var op_tm = + let beta_tm1, beta_tm2 = mk_comb (f1_tm, x_var), mk_comb (f2_tm, x_var) in + let beta_th1 = if is_abs f1_tm then BETA beta_tm1 else REFL beta_tm1 and + beta_th2 = if is_abs f2_tm then BETA beta_tm2 else REFL beta_tm2 in + ABS x_var (MK_COMB (AP_TERM op_tm beta_th1, beta_th2));; + + +let unary_beta_gen_eq f_tm x_var op_tm = + let beta_tm = mk_comb (f_tm, x_var) in + let beta_th = if is_abs f_tm then BETA beta_tm else REFL beta_tm in + ABS x_var (AP_TERM op_tm beta_th);; + + + +let m_taylor_interval_norm th eq_th = + let lhs1, d2f = dest_comb (concl th) in + let lhs2, d1f = dest_comb lhs1 in + let lhs3, d0f = dest_comb lhs2 in + let lhs4, w = dest_comb lhs3 in + let lhs5, y = dest_comb lhs4 in + let lhs6, domain = dest_comb lhs5 in + let m_taylor = rator lhs6 in + let th0 = AP_TERM m_taylor eq_th in + let th1 = AP_THM (AP_THM (AP_THM (AP_THM (AP_THM (AP_THM th0 domain) y) w) d0f) d1f) d2f in + EQ_MP th1 th;; + + + + +(************************************) + +(* +let pp = 4;; +let n = 3;; + +let f1 = expr_to_vector_fun `x1 + x2 * x3`;; +let f2 = `\x:real^3. x$2 * x$2`;; + +let xx = mk_vector_list [mk_float 2718281 44; mk_float 2 50; mk_float 1 50];; + + +let lin1_th = eval_lin_approx_poly0 pp f1 xx;; +let lin2_th = eval_lin_approx_poly0 pp f2 xx;; +*) + + +(*****************************************) +(* dest_m_lin_approx *) + + +let MK_M_LIN_APPROX' = (RULE o MATCH_MP EQ_IMP o SYM o SPEC_ALL) m_lin_approx;; +let DEST_M_LIN_APPROX' = MY_RULE_NUM m_lin_approx;; + + + +let m_lin_approx_components n m_lin_th = + let f_tm, x_tm, f_bounds, d_bounds_list = dest_lin_approx (concl m_lin_th) in + let ty = n_type_array.(n) in + let f_var = mk_var ("f", type_of f_tm) in + let x_var = mk_var ("x", type_of x_tm) in + let th0 = (INST[f_tm, f_var; x_tm, x_var; f_bounds, f_bounds_var; + d_bounds_list, df_bounds_list_var] o inst_first_type_var ty) DEST_M_LIN_APPROX' in + let th1 = EQ_MP th0 m_lin_th in + let [r1; r2; r3] = CONJUNCTS th1 in + r1, r2, r3;; + + +(********************************) +(* all_n manipulations *) + +let ALL_N_EMPTY' = prove(`all_n n [] (s:num->A->bool)`, REWRITE_TAC[all_n]);; +let ALL_N_CONS_IMP' = (MY_RULE o prove)(`SUC n = m /\ s n (x:A) ==> + (all_n m t s <=> all_n n (CONS x t) s)`, SIMP_TAC[all_n]);; +let ALL_N_CONS_EQ' = (MY_RULE o prove)(`SUC n = m ==> + (all_n n (CONS x t) s <=> (s n (x:A) /\ all_n m t s))`, SIMP_TAC[all_n]);; + +let dest_all_n all_n_tm = + let ltm, s_tm = dest_comb all_n_tm in + let ltm2, list_tm = dest_comb ltm in + rand ltm2, list_tm, s_tm;; + + +(* Splits `|- all_n n list s` into separate components. + Also returns the list of SUC n = m theorems *) +let all_n_components all_n_th = + let n_tm, list_tm, s_tm = dest_all_n (concl all_n_th) in + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let s_var = mk_var ("s", type_of s_tm) and + x_var = mk_var ("x", ty) and + t_var = mk_var ("t", list_ty) in + let all_n_cons_th = (INST[s_tm, s_var] o INST_TYPE[ty, aty]) ALL_N_CONS_EQ' in + + let rec get_components n_tm list_tm all_n_th = + if is_const list_tm then [], [] + else + let x_tm, t_tm = dest_cons list_tm in + let suc_th = raw_suc_conv_hash (mk_comb (suc_const, n_tm)) in + let m_tm = rand (concl suc_th) in + let th0 = INST[n_tm, n_var_num; m_tm, m_var_num; x_tm, x_var; t_tm, t_var] all_n_cons_th in + let th1 = MY_PROVE_HYP suc_th th0 in + let th2 = EQ_MP th1 all_n_th in + let snx_th, all_m_th = CONJUNCT1 th2, CONJUNCT2 th2 in + let comps, suc_list = get_components m_tm t_tm all_m_th in + snx_th :: comps, suc_th :: suc_list in + get_components n_tm list_tm all_n_th;; + + +(* Builds all_n from the given theorems and SUC n = m results *) +let build_all_n ths suc_ths = + (* The list ths should be not empty *) + let tm0 = (concl o hd) ths in + let lhs, rhs = dest_comb tm0 in + let s_tm = rator lhs in + let ty = type_of rhs in + let list_ty = mk_type ("list", [ty]) in + let s_var = mk_var ("s", type_of s_tm) and + x_var = mk_var ("x", ty) and + t_var = mk_var ("t", list_ty) in + let m_tm = (rand o concl o hd) suc_ths in + + let empty_th = (INST[s_tm, s_var; m_tm, n_var_num] o INST_TYPE[ty, aty]) ALL_N_EMPTY' in + let cons_th = (INST[s_tm, s_var] o INST_TYPE[ty, aty]) ALL_N_CONS_IMP' in + + let build suc_th s_th th = + let t_tm = (rand o rator o concl) th in + let x_tm = rand (concl s_th) in + let lhs, m_tm = dest_eq (concl suc_th) in + let n_tm = rand lhs in + let th' = INST[n_tm, n_var_num; m_tm, m_var_num; x_tm, x_var; t_tm, t_var] cons_th in + EQ_MP (MY_PROVE_HYP s_th (MY_PROVE_HYP suc_th th')) th in + + rev_itlist2 build suc_ths ths empty_th;; + + +(*************************) + +(* Generates |- s D1 a1 /\ ... /\ s D_m a_m <=> all_n D1 [a1; ... ; a_m] s *) +let gen_all_n_th m = + let a_vars = map (fun i -> mk_var ("a"^string_of_int i, aty)) (1--m) in + let list_tm = mk_list (a_vars, aty) in + let all_tm = mk_comb (mk_binop `all_n : num -> (A)list -> (num -> A -> bool) -> bool` `1` list_tm, + `s : num -> A -> bool`) in + (SYM o MY_RULE_NUM o CONV_RULE NUM_REDUCE_CONV) (REWRITE_CONV[all_n] all_tm);; + +let all_n_array = Array.init (max_dim + 1) (fun i -> if i = 0 then TRUTH else gen_all_n_th i);; + +(***) + +let build2 ths = + let n = length ths in + let th0 = rev_itlist CONJ (tl ths) (hd ths) in + let tm0 = (concl o hd) ths in + let lhs, rhs = dest_comb tm0 in + let a_tms = rev (map (rand o concl) ths) in + let s_tm = rator lhs in + let ty = type_of rhs in + let s_var = mk_var ("s", type_of s_tm) and + a_vars0 = map (fun i -> mk_var ("a"^string_of_int i, ty)) (1--n) in + + let th1 = (INST[s_tm, s_var] o INST (zip a_tms a_vars0) o INST_TYPE[ty, aty]) all_n_array.(n) in + EQ_MP th1 th0;; + + + + +(************************) + + +(* Constructs all_n n (map s list1) *) +let eval_all_n all_n1_th beta_flag s = + let ths1', suc_ths = all_n_components all_n1_th in + let ths1 = if beta_flag then map MY_BETA_RULE ths1' else ths1' in + let ths1, suc_ths = List.rev ths1, List.rev suc_ths in + let ths = map s ths1 in +(* build_all_n ths suc_ths;; *) + build2 ths;; + + + +(* Constructs all_n n (map2 s list1 list2) *) +let eval_all_n2 all_n1_th all_n2_th beta_flag s = + let ths1', suc_ths = all_n_components all_n1_th in + let ths2', _ = all_n_components all_n2_th in + let ths1, ths2 = + if beta_flag then map MY_BETA_RULE ths1', map MY_BETA_RULE ths2' else ths1', ths2' in + + let ths1, ths2, suc_ths = List.rev ths1, List.rev ths2, List.rev suc_ths in + let ths = map2 s ths1 ths2 in +(* build_all_n ths suc_ths;; *) + build2 ths;; + + + + + +(********************************) +(* m_lin_approx_add *) + + +let MK_M_LIN_APPROX_ADD' = (MY_RULE_NUM o prove) + (`lift o f differentiable at x ==> lift o g differentiable at (x:real^N) ==> + interval_arith (f x + g x) f_bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (partial i f x + partial i g x) int) ==> + m_lin_approx (\x. f x + g x) x f_bounds d_bounds_list`, + REWRITE_TAC[m_lin_approx] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + REWRITE_TAC[f_lift_add] THEN + new_rewrite [] [] DIFFERENTIABLE_ADD THEN + ASM_REWRITE_TAC[ETA_AX]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[partial_add]);; + + + +let add_partial_lemma' = prove(`interval_arith (partial i f (x:real^N) + partial i g x) int <=> + (\i int. interval_arith (partial i f x + partial i g x) int) i int`, + REWRITE_TAC[]);; + + + + +let eval_m_lin_approx_add n pp lin1_th lin2_th = + let diff1_th, f1_th, df1_th = m_lin_approx_components n lin1_th and + diff2_th, f2_th, df2_th = m_lin_approx_components n lin2_th in + let f1_tm = (rand o lhand o concl) diff1_th and + f2_tm = (rand o lhand o concl) diff2_th and + x_tm = (rand o rand o concl) diff1_th in + let x_var = mk_var ("x", type_of x_tm) and + f_var = mk_var ("f", type_of f1_tm) and + g_var = mk_var ("g", type_of f2_tm) in + + let f_th = float_interval_add pp f1_th f2_th in + let f_bounds = (rand o concl) f_th in + + let lemma0 = (INST[f1_tm, f_var; f2_tm, g_var; x_tm, x_var] o + INST_TYPE[n_type_array.(n), nty]) add_partial_lemma' in + + let add th1 th2 = + let add_th = float_interval_add pp th1 th2 in + let int_tm = rand (concl add_th) and + i_tm = (rand o rator o rator o lhand) (concl th1) in + let th0 = INST[i_tm, i_var_num; int_tm, int_var] lemma0 in + EQ_MP th0 add_th in + + let df_th = eval_all_n2 df1_th df2_th true add in + let df_bounds_list = (rand o rator o concl) df_th in + + (MY_PROVE_HYP diff1_th o MY_PROVE_HYP diff2_th o MY_PROVE_HYP f_th o MY_PROVE_HYP df_th o + INST[f1_tm, f_var; f2_tm, g_var; x_tm, x_var; + f_bounds, f_bounds_var; df_bounds_list, d_bounds_list_var] o + INST_TYPE[n_type_array.(n), nty]) MK_M_LIN_APPROX_ADD';; + + + + +(* +m_lin_approx_add n pp lin1_th lin2_th;; + +(* 10: 3.888 *) +test 1000 (m_lin_approx_add n pp lin2_th) lin1_th;; +*) + + +(*******************************************************) + + +(***************************************) +(* eval_m_taylor_add *) + + +let SECOND_BOUNDED' = MY_RULE_NUM second_bounded;; + +let dest_second_bounded tm = + let ltm, dd = dest_comb tm in + let ltm2, domain = dest_comb ltm in + rand ltm2, domain, dd;; + +let second_bounded_components n th = + let f_tm, domain_tm, dd_tm = dest_second_bounded (concl th) in + let x_var = mk_var ("x", n_vector_type_array.(n)) in + let th0 = (INST[f_tm, mk_var ("f", type_of f_tm); + domain_tm, mk_var ("domain", type_of domain_tm); + dd_tm, dd_bounds_list_var] o inst_first_type_var n_type_array.(n)) SECOND_BOUNDED' in + UNDISCH (SPEC x_var (EQ_MP th0 th));; + + + + +let MK_M_TAYLOR_ADD' = (MY_RULE_NUM o prove) + (`m_cell_domain domain (y:real^N) w ==> + diff2c_domain domain f ==> + diff2c_domain domain g ==> + interval_arith (f y + g y) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (partial i f y + partial i g y) int) ==> + (!x. x IN interval [domain] ==> all_n 1 dd_bounds_list (\i list_i. all_n 1 list_i + (\j int. interval_arith (partial2 j i f x + partial2 j i g x) int))) ==> + m_taylor_interval (\x. f x + g x) domain y w bounds d_bounds_list dd_bounds_list`, + REWRITE_TAC[m_taylor_interval; m_lin_approx; second_bounded] THEN + REPEAT DISCH_TAC THEN + SUBGOAL_THEN `lift o f differentiable at (y:real^N) /\ lift o g differentiable at y` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + UNDISCH_TAC `diff2c_domain domain (g:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN STRIP_TAC THEN STRIP_TAC THEN + REPEAT (new_rewrite [] [] diff2_imp_diff) THEN REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC y_in_domain THEN EXISTS_TAC `w:real^N` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + new_rewrite [] [] diff2c_domain_add THEN ASM_REWRITE_TAC[]; + REWRITE_TAC[f_lift_add] THEN + new_rewrite [] [] DIFFERENTIABLE_ADD THEN + ASM_REWRITE_TAC[ETA_AX]; + ASM_SIMP_TAC[partial_add]; + ALL_TAC + ] THEN + + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + UNDISCH_TAC `diff2c_domain domain (g:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN + REPEAT (DISCH_THEN (MP_TAC o SPEC `x:real^N` o CONJUNCT1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC) THEN + ASM_SIMP_TAC[second_partial_add]);; + + +(*************************) + + +let add_partial_lemma' = prove(`interval_arith (partial i f (x:real^N) + partial i g x) int <=> + (\i int. interval_arith (partial i f x + partial i g x) int) i int`, + REWRITE_TAC[]);; + +let add_second_lemma' = prove(`interval_arith (partial2 j i f (x:real^N) + partial2 j i g x) int <=> + (\j int. interval_arith (partial2 j i f x + partial2 j i g x) int) j int`, + REWRITE_TAC[]);; + +let add_second_lemma'' = (NUMERALS_TO_NUM o prove)(`all_n 1 list + (\j int. interval_arith (partial2 j i f (x:real^N) + partial2 j i g x) int) <=> + (\i list. all_n 1 list + (\j int. interval_arith (partial2 j i f x + partial2 j i g x) int)) i list`, + REWRITE_TAC[]);; + + + + +let eval_m_taylor_add n p_lin p_second taylor1_th taylor2_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let _, diff2_f2_th, lin2_th, second2_th = dest_m_taylor_thms n taylor2_th in + let f1_tm = (rand o concl) diff2_f1_th and + f2_tm = (rand o concl) diff2_f2_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let ty = type_of y_tm in + + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + g_var = mk_var ("g", type_of f2_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th and + _, bounds2_th, df2_th = m_lin_approx_components n lin2_th in + + let bounds_th = float_interval_add p_lin bounds1_th bounds2_th in + let bounds_tm = (rand o concl) bounds_th in + + let add_lemma0 = (INST[f1_tm, f_var; f2_tm, g_var; y_tm, x_var] o + INST_TYPE[n_type_array.(n), nty]) add_partial_lemma' in + + let add th1 th2 = + let add_th = float_interval_add p_lin th1 th2 in + let int_tm = rand (concl add_th) and + i_tm = (rand o rator o rator o lhand) (concl th1) in + let th0 = INST[i_tm, i_var_num; int_tm, int_var] add_lemma0 in + EQ_MP th0 add_th in + + let df_th = eval_all_n2 df1_th df2_th true add in + let d_bounds_list = (rand o rator o concl) df_th in + + + let dd1 = second_bounded_components n second1_th in + let dd2 = second_bounded_components n second2_th in + + let add_second_lemma0 = (INST[f1_tm, f_var; f2_tm, g_var] o + INST_TYPE[n_type_array.(n), nty]) add_second_lemma' in + + let add_second_lemma1 = (INST[f1_tm, f_var; f2_tm, g_var] o + INST_TYPE[n_type_array.(n), nty]) add_second_lemma'' in + + + let add_second2 th1 th2 = + let i_tm = (rand o rator o concl) th1 in + let th1, th2 = MY_BETA_RULE th1, MY_BETA_RULE th2 in + let lemma = INST[i_tm, i_var_num] add_second_lemma0 in + let add_second th1 th2 = + let add_th = float_interval_add p_second th1 th2 in + let int_tm = rand (concl add_th) and + j_tm = (rand o rator o rator o rator o lhand) (concl th1) in + let th0 = INST[j_tm, j_var_num; int_tm, int_var] lemma in + EQ_MP th0 add_th in + let add_th = eval_all_n2 th1 th2 true add_second in + let list_tm = (rand o rator o concl) add_th in + let lemma1 = INST[i_tm, i_var_num; list_tm, list_var_real_pair] add_second_lemma1 in + EQ_MP lemma1 add_th in + + + let dd_th0 = eval_all_n2 dd1 dd2 false add_second2 in + let dd_list = (rand o rator o concl) dd_th0 in + let dd_th = GEN x_var (DISCH_ALL dd_th0) in + + let th = (MY_PROVE_HYP dd_th o MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP diff2_f2_th o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP df_th o MY_PROVE_HYP domain_th o + INST[f1_tm, f_var; f2_tm, g_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var; d_bounds_list, d_bounds_list_var; + dd_list, dd_bounds_list_var] o + INST_TYPE[n_type_array.(n), nty]) MK_M_TAYLOR_ADD' in + let eq_th = binary_beta_gen_eq f1_tm f2_tm x_var add_op_real in + m_taylor_interval_norm th eq_th;; + + +(*******************************************************) + + +(***************************************) +(* eval_m_taylor_sub *) + + +let MK_M_TAYLOR_SUB' = (MY_RULE_NUM o prove) + (`m_cell_domain domain (y:real^N) w ==> + diff2c_domain domain f ==> + diff2c_domain domain g ==> + interval_arith (f y - g y) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (partial i f y - partial i g y) int) ==> + (!x. x IN interval [domain] ==> all_n 1 dd_bounds_list (\i list_i. all_n 1 list_i + (\j int. interval_arith (partial2 j i f x - partial2 j i g x) int))) ==> + m_taylor_interval (\x. f x - g x) domain y w bounds d_bounds_list dd_bounds_list`, + REWRITE_TAC[m_taylor_interval; m_lin_approx; second_bounded] THEN + REPEAT DISCH_TAC THEN + SUBGOAL_THEN `lift o f differentiable at (y:real^N) /\ lift o g differentiable at y` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + UNDISCH_TAC `diff2c_domain domain (g:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN STRIP_TAC THEN STRIP_TAC THEN + REPEAT (new_rewrite [] [] diff2_imp_diff) THEN REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC y_in_domain THEN EXISTS_TAC `w:real^N` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + new_rewrite [] [] diff2c_domain_sub THEN ASM_REWRITE_TAC[]; + REWRITE_TAC[f_lift_sub] THEN + new_rewrite [] [] DIFFERENTIABLE_SUB THEN + ASM_REWRITE_TAC[ETA_AX]; + ASM_SIMP_TAC[partial_sub]; + ALL_TAC + ] THEN + + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + UNDISCH_TAC `diff2c_domain domain (g:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN + REPEAT (DISCH_THEN (MP_TAC o SPEC `x:real^N` o CONJUNCT1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC) THEN + ASM_SIMP_TAC[second_partial_sub]);; + + +(*************************) + + +let sub_partial_lemma' = prove(`interval_arith (partial i f (x:real^N) - partial i g x) int <=> + (\i int. interval_arith (partial i f x - partial i g x) int) i int`, + REWRITE_TAC[]);; + +let sub_second_lemma' = prove(`interval_arith (partial2 j i f (x:real^N) - partial2 j i g x) int <=> + (\j int. interval_arith (partial2 j i f x - partial2 j i g x) int) j int`, + REWRITE_TAC[]);; + +let sub_second_lemma'' = (NUMERALS_TO_NUM o prove)(`all_n 1 list + (\j int. interval_arith (partial2 j i f (x:real^N) - partial2 j i g x) int) <=> + (\i list. all_n 1 list + (\j int. interval_arith (partial2 j i f x - partial2 j i g x) int)) i list`, + REWRITE_TAC[]);; + + + + +let eval_m_taylor_sub n p_lin p_second taylor1_th taylor2_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let _, diff2_f2_th, lin2_th, second2_th = dest_m_taylor_thms n taylor2_th in + let f1_tm = (rand o concl) diff2_f1_th and + f2_tm = (rand o concl) diff2_f2_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let ty = type_of y_tm in + + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + g_var = mk_var ("g", type_of f2_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th and + _, bounds2_th, df2_th = m_lin_approx_components n lin2_th in + + let bounds_th = float_interval_sub p_lin bounds1_th bounds2_th in + let bounds_tm = (rand o concl) bounds_th in + + let sub_lemma0 = (INST[f1_tm, f_var; f2_tm, g_var; y_tm, x_var] o + INST_TYPE[n_type_array.(n), nty]) sub_partial_lemma' in + + let sub th1 th2 = + let sub_th = float_interval_sub p_lin th1 th2 in + let int_tm = rand (concl sub_th) and + i_tm = (rand o rator o rator o lhand) (concl th1) in + let th0 = INST[i_tm, i_var_num; int_tm, int_var] sub_lemma0 in + EQ_MP th0 sub_th in + + let df_th = eval_all_n2 df1_th df2_th true sub in + let d_bounds_list = (rand o rator o concl) df_th in + + + let dd1 = second_bounded_components n second1_th in + let dd2 = second_bounded_components n second2_th in + + let sub_second_lemma0 = (INST[f1_tm, f_var; f2_tm, g_var] o + INST_TYPE[n_type_array.(n), nty]) sub_second_lemma' in + + let sub_second_lemma1 = (INST[f1_tm, f_var; f2_tm, g_var] o + INST_TYPE[n_type_array.(n), nty]) sub_second_lemma'' in + + + let sub_second2 th1 th2 = + let i_tm = (rand o rator o concl) th1 in + let th1, th2 = MY_BETA_RULE th1, MY_BETA_RULE th2 in + let lemma = INST[i_tm, i_var_num] sub_second_lemma0 in + let sub_second th1 th2 = + let sub_th = float_interval_sub p_second th1 th2 in + let int_tm = rand (concl sub_th) and + j_tm = (rand o rator o rator o rator o lhand) (concl th1) in + let th0 = INST[j_tm, j_var_num; int_tm, int_var] lemma in + EQ_MP th0 sub_th in + let sub_th = eval_all_n2 th1 th2 true sub_second in + let list_tm = (rand o rator o concl) sub_th in + let lemma1 = INST[i_tm, i_var_num; list_tm, list_var_real_pair] sub_second_lemma1 in + EQ_MP lemma1 sub_th in + + + let dd_th0 = eval_all_n2 dd1 dd2 false sub_second2 in + let dd_list = (rand o rator o concl) dd_th0 in + let dd_th = GEN x_var (DISCH_ALL dd_th0) in + + let th = (MY_PROVE_HYP dd_th o MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP diff2_f2_th o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP df_th o MY_PROVE_HYP domain_th o + INST[f1_tm, f_var; f2_tm, g_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var; d_bounds_list, d_bounds_list_var; + dd_list, dd_bounds_list_var] o + INST_TYPE[n_type_array.(n), nty]) MK_M_TAYLOR_SUB' in + let eq_th = binary_beta_gen_eq f1_tm f2_tm x_var sub_op_real in + m_taylor_interval_norm th eq_th;; + + +(*******************************************************) + + +(***************************************) +(* eval_m_taylor_mul *) + + +let MK_M_TAYLOR_MUL' = (MY_RULE_NUM o prove) + (`m_cell_domain domain (y:real^N) w ==> + diff2c_domain domain f ==> + diff2c_domain domain g ==> + interval_arith (f y * g y) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (partial i f y * g y + f y * partial i g y) int) ==> + (!x. x IN interval [domain] ==> all_n 1 dd_bounds_list (\i list_i. all_n 1 list_i + (\j int. interval_arith ((partial2 j i f x * g x + partial i f x * partial j g x) + + partial j f x * partial i g x + f x * partial2 j i g x) int))) ==> + m_taylor_interval (\x. f x * g x) domain y w bounds d_bounds_list dd_bounds_list`, + REWRITE_TAC[m_taylor_interval; m_lin_approx; second_bounded] THEN + REPEAT DISCH_TAC THEN + SUBGOAL_THEN `lift o f differentiable at (y:real^N) /\ lift o g differentiable at y` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + UNDISCH_TAC `diff2c_domain domain (g:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN STRIP_TAC THEN STRIP_TAC THEN + REPEAT (new_rewrite [] [] diff2_imp_diff) THEN REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC y_in_domain THEN EXISTS_TAC `w:real^N` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + new_rewrite [] [] diff2c_domain_mul THEN ASM_REWRITE_TAC[]; + new_rewrite [] [] differentiable_mul THEN ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[partial_mul]; + ALL_TAC + ] THEN + + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + UNDISCH_TAC `diff2c_domain domain (g:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN + REPEAT (DISCH_THEN (MP_TAC o SPEC `x:real^N` o CONJUNCT1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC) THEN + ASM_SIMP_TAC[second_partial_mul]);; + + +(*************************) + + +let mul_partial_lemma' = + prove(`interval_arith (partial i f (y:real^N) * g y + f y * partial i g y) int <=> + (\i int. interval_arith (partial i f y * g y + f y * partial i g y) int) i int`, + REWRITE_TAC[]);; + +let mul_second_lemma' = + prove(`interval_arith ((partial2 j i f x * g (x:real^N) + partial i f x * partial j g x) + + partial j f x * partial i g x + f x * partial2 j i g x) int <=> + (\j int. interval_arith ((partial2 j i f x * g x + partial i f x * partial j g x) + + partial j f x * partial i g x + f x * partial2 j i g x) int) j int`, + REWRITE_TAC[]);; + + +let mul_second_lemma'' = (NUMERALS_TO_NUM o prove) + (`all_n 1 list (\j int. interval_arith ((partial2 j i f x * g x + partial i f x * partial j g x) + + partial j f x * partial i g x + f (x:real^N) * partial2 j i g x) int) <=> + (\i list. all_n 1 list + (\j int. interval_arith ((partial2 j i f x * g x + partial i f x * partial j g x) + + partial j f x * partial i g x + f x * partial2 j i g x) int)) i list`, + REWRITE_TAC[]);; + + + + +let eval_m_taylor_mul n p_lin p_second taylor1_th taylor2_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th and + _, diff2_f2_th, lin2_th, second2_th = dest_m_taylor_thms n taylor2_th in + let f1_tm = (rand o concl) diff2_f1_th and + f2_tm = (rand o concl) diff2_f2_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let ty = type_of y_tm in + + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + g_var = mk_var ("g", type_of f2_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th and + _, bounds2_th, df2_th = m_lin_approx_components n lin2_th in + + let bounds_th = float_interval_mul p_lin bounds1_th bounds2_th in + let bounds_tm = (rand o concl) bounds_th in + + let mul_lemma0 = (INST[f1_tm, f_var; f2_tm, g_var; y_tm, y_var] o + INST_TYPE[n_type_array.(n), nty]) mul_partial_lemma' in + + let mul th1 th2 = + let mul_th = + let ( * ), ( + ) = float_interval_mul p_lin, float_interval_add p_lin in + th1 * bounds2_th + bounds1_th * th2 in + let int_tm = rand (concl mul_th) in + let i_tm = (rand o rator o rator o lhand) (concl th1) in + let th0 = INST[i_tm, i_var_num; int_tm, int_var] mul_lemma0 in + EQ_MP th0 mul_th in + + let df_th = eval_all_n2 df1_th df2_th true mul in + let d_bounds_list = (rand o rator o concl) df_th in + + + let dd1 = second_bounded_components n second1_th in + let dd2 = second_bounded_components n second2_th in + + let mul_second_lemma0 = (INST[f1_tm, f_var; f2_tm, g_var] o + INST_TYPE[n_type_array.(n), nty]) mul_second_lemma' in + + let mul_second_lemma1 = (INST[f1_tm, f_var; f2_tm, g_var] o + INST_TYPE[n_type_array.(n), nty]) mul_second_lemma'' in + + let undisch = UNDISCH o SPEC x_var in + + let d1_bounds = map (fun i -> + let th0 = eval_m_taylor_partial_bound n p_second i taylor1_th in + undisch th0) (1--n) in + + let d2_bounds = map (fun i -> + let th0 = eval_m_taylor_partial_bound n p_second i taylor2_th in + undisch th0) (1--n) in + + let f1_bound = undisch (eval_m_taylor_bound n p_second taylor1_th) and + f2_bound = undisch (eval_m_taylor_bound n p_second taylor2_th) in + + let mul_second2 th1 th2 = + let i_tm = (rand o rator o concl) th1 in + let i_int = (Num.int_of_num o raw_dest_hash) i_tm in + let di1 = List.nth d1_bounds (i_int - 1) and + di2 = List.nth d2_bounds (i_int - 1) in + let th1, th2 = MY_BETA_RULE th1, MY_BETA_RULE th2 in + let lemma = INST[i_tm, i_var_num] mul_second_lemma0 in + let mul_second th1 th2 = + let j_tm = (rand o rator o rator o rator o lhand) (concl th1) in + let j_int = (Num.int_of_num o raw_dest_hash) j_tm in + let dj1 = List.nth d1_bounds (j_int - 1) and + dj2 = List.nth d2_bounds (j_int - 1) in + + let mul_th = + let ( * ), ( + ) = float_interval_mul p_second, float_interval_add p_second in + (th1 * f2_bound + di1 * dj2) + (dj1 * di2 + f1_bound * th2) in + + let int_tm = rand (concl mul_th) in + let th0 = INST[j_tm, j_var_num; int_tm, int_var] lemma in + EQ_MP th0 mul_th in + + let mul_th = eval_all_n2 th1 th2 true mul_second in + let list_tm = (rand o rator o concl) mul_th in + let lemma1 = INST[i_tm, i_var_num; list_tm, list_var_real_pair] mul_second_lemma1 in + EQ_MP lemma1 mul_th in + + + let dd_th0 = eval_all_n2 dd1 dd2 false mul_second2 in + let dd_list = (rand o rator o concl) dd_th0 in + let dd_th = GEN x_var (DISCH_ALL dd_th0) in + + let th = (MY_PROVE_HYP dd_th o MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP diff2_f2_th o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP df_th o MY_PROVE_HYP domain_th o + INST[f1_tm, f_var; f2_tm, g_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var; d_bounds_list, d_bounds_list_var; + dd_list, dd_bounds_list_var] o + INST_TYPE[n_type_array.(n), nty]) MK_M_TAYLOR_MUL' in + let eq_th = binary_beta_gen_eq f1_tm f2_tm x_var mul_op_real in + m_taylor_interval_norm th eq_th;; + + + + + + +(*******************************************************) + +(* inv, sqrt, atn, acs *) + + + +let partial_uni_compose' = + REWRITE_RULE[SWAP_FORALL_THM; GSYM RIGHT_IMP_FORALL_THM] partial_uni_compose;; +let second_partial_uni_compose' = + REWRITE_RULE[SWAP_FORALL_THM; GSYM RIGHT_IMP_FORALL_THM] second_partial_uni_compose;; + + +(* inv *) +let MK_M_TAYLOR_INV' = (UNDISCH_ALL o PURE_REWRITE_RULE[float2_eq] o DISCH_ALL o + MY_RULE_FLOAT o prove) + (`m_cell_domain domain (y:real^N) w ==> + (!x. x IN interval [domain] ==> interval_arith (f x) f_bounds) ==> + interval_not_zero f_bounds ==> + diff2c_domain domain f ==> + interval_arith (inv (f y)) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (--inv (f y * f y) * partial i f y) int) ==> + (!x. x IN interval [domain] ==> all_n 1 dd_bounds_list (\i list_i. all_n 1 list_i + (\j int. interval_arith (((&2 * inv (f x * f x * f x)) * partial j f x) * partial i f x - + inv (f x * f x) * partial2 j i f x) int))) ==> + m_taylor_interval (\x. inv (f x)) domain y w bounds d_bounds_list dd_bounds_list`, + REWRITE_TAC[m_taylor_interval; m_lin_approx; second_bounded; ETA_AX] THEN + REPEAT DISCH_TAC THEN + SUBGOAL_THEN `lift o f differentiable at (y:real^N)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN STRIP_TAC THEN + new_rewrite [] [] diff2_imp_diff THEN REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC y_in_domain THEN EXISTS_TAC `w:real^N` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!x:real^N. x IN interval [domain] ==> ~(f x = &0)` ASSUME_TAC THENL + [ + GEN_TAC THEN DISCH_TAC THEN + apply_tac interval_arith_not_zero THEN + EXISTS_TAC `f_bounds:real#real` THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `~(f (y:real^N) = &0)` ASSUME_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC y_in_domain THEN EXISTS_TAC `w:real^N` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain] THEN REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[GSYM o_THM] THEN REWRITE_TAC[ETA_AX] THEN + apply_tac diff2c_inv_compose THEN CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + new_rewrite [] [`inv _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + apply_tac diff_uni_compose THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_DIFFERENTIABLE_AT_INV THEN ASM_REWRITE_TAC[]; + new_rewrite [] [`inv _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + MP_TAC (ISPECL [`y:real^N`; `f:real^N->real`] partial_uni_compose') THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `inv`) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC REAL_DIFFERENTIABLE_AT_INV THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[derivative_inv]; + ALL_TAC + ] THEN + + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN + DISCH_THEN (MP_TAC o SPEC `x:real^N` o CONJUNCT1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (ISPECL [`x:real^N`; `f:real^N->real`] second_partial_uni_compose') THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `inv`) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC diff2_inv THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + new_rewrite [] [`inv _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + ASM_SIMP_TAC[second_derivative_inv; derivative_inv; REAL_MUL_LNEG; GSYM real_sub] THEN + ASM_SIMP_TAC[REAL_ARITH `a pow 3 = a * a * a`]);; + + +(* sqrt *) +let MK_M_TAYLOR_SQRT' = (UNDISCH_ALL o PURE_REWRITE_RULE[float2_eq; float4_eq] o + DISCH_ALL o MY_RULE_FLOAT o prove) + (`m_cell_domain domain (y:real^N) w ==> + (!x. x IN interval [domain] ==> interval_arith (f x) f_bounds) ==> + interval_pos f_bounds ==> + diff2c_domain domain f ==> + interval_arith (sqrt (f y)) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (inv (&2 * sqrt (f y)) * partial i f y) int) ==> + (!x. x IN interval [domain] ==> all_n 1 dd_bounds_list (\i list_i. all_n 1 list_i + (\j int. interval_arith ((--inv ((&2 * sqrt (f x)) * (&2 * f x)) * partial j f x) * partial i f x + + inv (&2 * sqrt (f x)) * partial2 j i f x) int))) ==> + m_taylor_interval (\x. sqrt (f x)) domain y w bounds d_bounds_list dd_bounds_list`, + REWRITE_TAC[m_taylor_interval; m_lin_approx; second_bounded; ETA_AX] THEN + REPEAT DISCH_TAC THEN + SUBGOAL_THEN `lift o f differentiable at (y:real^N)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN STRIP_TAC THEN + new_rewrite [] [] diff2_imp_diff THEN REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC y_in_domain THEN EXISTS_TAC `w:real^N` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!x:real^N. x IN interval [domain] ==> &0 < f x` ASSUME_TAC THENL + [ + GEN_TAC THEN DISCH_TAC THEN + apply_tac interval_arith_pos THEN + EXISTS_TAC `f_bounds:real#real` THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `&0 < f (y:real^N)` ASSUME_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC y_in_domain THEN EXISTS_TAC `w:real^N` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain] THEN REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[GSYM o_THM] THEN REWRITE_TAC[ETA_AX] THEN + apply_tac diff2c_sqrt_compose THEN CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + new_rewrite [] [`sqrt _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + apply_tac diff_uni_compose THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_DIFFERENTIABLE_AT_SQRT THEN ASM_REWRITE_TAC[]; + new_rewrite [] [`sqrt _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + MP_TAC (ISPECL [`y:real^N`; `f:real^N->real`] partial_uni_compose') THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `sqrt`) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC REAL_DIFFERENTIABLE_AT_SQRT THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[derivative_sqrt]; + ALL_TAC + ] THEN + + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN + DISCH_THEN (MP_TAC o SPEC `x:real^N` o CONJUNCT1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (ISPECL [`x:real^N`; `f:real^N->real`] second_partial_uni_compose') THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `sqrt`) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC diff2_sqrt THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + new_rewrite [] [`sqrt _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + ASM_SIMP_TAC[second_derivative_sqrt; derivative_sqrt] THEN DISCH_THEN (fun th -> ALL_TAC) THEN + REWRITE_TAC[REAL_ARITH `a pow 3 = a * a pow 2`] THEN + new_rewrite [] [] SQRT_MUL THENL + [ + REWRITE_TAC[REAL_LE_POW_2] THEN + MATCH_MP_TAC REAL_LT_IMP_LE THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + new_rewrite [] [] POW_2_SQRT THENL + [ + MATCH_MP_TAC REAL_LT_IMP_LE THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[REAL_ARITH `&4 * a * b = (&2 * a) * (&2 * b)`]);; + + + +(* atn *) +let MK_M_TAYLOR_ATN' = (UNDISCH_ALL o PURE_REWRITE_RULE[float1_eq; float2_eq; num2_eq] o DISCH_ALL o + MY_RULE_FLOAT o prove) + (`m_cell_domain domain (y:real^N) w ==> + diff2c_domain domain f ==> + interval_arith (atn (f y)) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (inv (&1 + f y * f y) * partial i f y) int) ==> + (!x. x IN interval [domain] ==> all_n 1 dd_bounds_list (\i list_i. all_n 1 list_i + (\j int. interval_arith ((((-- &2 * f x) * inv (&1 + f x * f x) pow 2) * partial j f x) + * partial i f x + inv (&1 + f x * f x) * partial2 j i f x) int))) ==> + m_taylor_interval (\x. atn (f x)) domain y w bounds d_bounds_list dd_bounds_list`, + REWRITE_TAC[m_taylor_interval; m_lin_approx; second_bounded; ETA_AX] THEN + REPEAT DISCH_TAC THEN + SUBGOAL_THEN `lift o f differentiable at (y:real^N)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN STRIP_TAC THEN + new_rewrite [] [] diff2_imp_diff THEN REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC y_in_domain THEN EXISTS_TAC `w:real^N` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain] THEN REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[GSYM o_THM] THEN REWRITE_TAC[ETA_AX] THEN + apply_tac diff2c_atn_compose THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + new_rewrite [] [`atn _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + apply_tac diff_uni_compose THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[REAL_DIFFERENTIABLE_AT_ATN]; + new_rewrite [] [`atn _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + MP_TAC (ISPECL [`y:real^N`; `f:real^N->real`] partial_uni_compose') THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `atn`) THEN REWRITE_TAC[REAL_DIFFERENTIABLE_AT_ATN] THEN + ASM_SIMP_TAC[derivative_atn]; + ALL_TAC + ] THEN + + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN + DISCH_THEN (MP_TAC o SPEC `x:real^N` o CONJUNCT1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (ISPECL [`x:real^N`; `f:real^N->real`] second_partial_uni_compose') THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `atn`) THEN + REWRITE_TAC[diff2_atn] THEN + new_rewrite [] [`atn _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + ASM_SIMP_TAC[nth_derivative2; second_derivative_atn; derivative_atn] THEN + new_rewrite [] [`f x pow 2`] REAL_POW_2 THEN + ASM_SIMP_TAC[]);; + + +(* acs *) +let iabs_lemma = GEN_REWRITE_RULE (RAND_CONV o RAND_CONV) [GSYM float1_eq] (REFL `iabs f_bounds < &1`);; + +let MK_M_TAYLOR_ACS' = (UNDISCH_ALL o PURE_ONCE_REWRITE_RULE[iabs_lemma] o + PURE_REWRITE_RULE[float1_eq; num3_eq] o DISCH_ALL o + MY_RULE_FLOAT o prove) + (`m_cell_domain domain (y:real^N) w ==> + (!x. x IN interval [domain] ==> interval_arith (f x) f_bounds) ==> + iabs f_bounds < &1 ==> + diff2c_domain domain f ==> + interval_arith (acs (f y)) bounds ==> + all_n 1 d_bounds_list + (\i int. interval_arith (--inv (sqrt (&1 - f y * f y)) * partial i f y) int) ==> + (!x. x IN interval [domain] ==> all_n 1 dd_bounds_list (\i list_i. all_n 1 list_i + (\j int. interval_arith ((--(f x / sqrt ((&1 - f x * f x) pow 3)) * partial j f x) * partial i f x - + inv (sqrt (&1 - f x * f x)) * partial2 j i f x) int))) ==> + m_taylor_interval (\x. acs (f x)) domain y w bounds d_bounds_list dd_bounds_list`, + REWRITE_TAC[m_taylor_interval; m_lin_approx; second_bounded; ETA_AX] THEN + REPEAT DISCH_TAC THEN + SUBGOAL_THEN `lift o f differentiable at (y:real^N)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN STRIP_TAC THEN + new_rewrite [] [] diff2_imp_diff THEN REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC y_in_domain THEN EXISTS_TAC `w:real^N` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!x:real^N. x IN interval [domain] ==> abs (f x) < &1` ASSUME_TAC THENL + [ + GEN_TAC THEN DISCH_TAC THEN + apply_tac interval_arith_abs THEN + EXISTS_TAC `f_bounds:real#real` THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `abs (f (y:real^N)) < &1` ASSUME_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC y_in_domain THEN EXISTS_TAC `w:real^N` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain] THEN REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[GSYM o_THM] THEN REWRITE_TAC[ETA_AX] THEN + apply_tac diff2c_acs_compose THEN CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + new_rewrite [] [`acs _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + apply_tac diff_uni_compose THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_DIFFERENTIABLE_AT_ACS THEN ASM_REWRITE_TAC[]; + new_rewrite [] [`acs _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + MP_TAC (ISPECL [`y:real^N`; `f:real^N->real`] partial_uni_compose') THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `acs`) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC REAL_DIFFERENTIABLE_AT_ACS THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[derivative_acs]; + ALL_TAC + ] THEN + + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2c_domain_alt; diff2_domain] THEN + DISCH_THEN (MP_TAC o SPEC `x:real^N` o CONJUNCT1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (ISPECL [`x:real^N`; `f:real^N->real`] second_partial_uni_compose') THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `acs`) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC diff2_acs THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + new_rewrite [] [`acs _`] (GSYM o_THM) THEN REWRITE_TAC[ETA_AX] THEN + ASM_SIMP_TAC[second_derivative_acs; derivative_acs; REAL_MUL_LNEG; GSYM real_sub] THEN + ASM_SIMP_TAC[GSYM REAL_MUL_LNEG]);; + + + +(*************************) + +(***************************************) +(* eval_m_taylor_inv *) + + +let inv_partial_lemma' = + prove(`interval_arith (--inv (f y * f y) * partial i f (y:real^N)) int <=> + (\i int. interval_arith (--inv (f y * f y) * partial i f y) int) i int`, + REWRITE_TAC[]);; + +let inv_second_lemma' = + prove(`interval_arith (((&2 * inv (f x * f x * f x)) * partial j f x) * partial i f (x:real^N) - + inv (f x * f x) * partial2 j i f x) int <=> + (\j int. interval_arith (((&2 * inv (f x * f x * f x)) * partial j f x) * partial i f x - + inv (f x * f x) * partial2 j i f x) int) j int`, + REWRITE_TAC[]);; + + +let inv_second_lemma'' = (PURE_REWRITE_RULE[GSYM num1_eq] o prove) + (`all_n 1 list + (\j int. interval_arith (((&2 * inv (f x * f x * f x)) * partial j f x) * partial i f (x:real^N) - + inv (f x * f x) * partial2 j i f x) int) <=> + (\i list. all_n 1 list + (\j int. interval_arith (((&2 * inv (f x * f x * f x)) * partial j f x) * partial i f x - + inv (f x * f x) * partial2 j i f x) int)) i list`, + REWRITE_TAC[]);; + + + + +let eval_m_taylor_inv n p_lin p_second taylor1_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let f1_tm = (rand o concl) diff2_f1_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let ty = type_of y_tm in + + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let undisch = UNDISCH o SPEC x_var in + + let f1_bound0 = eval_m_taylor_bound n p_second taylor1_th in + let f1_bound = undisch f1_bound0 in + let f_bounds_tm = (rand o concl) f1_bound in + + (* cond *) + let cond_th = check_interval_not_zero f_bounds_tm in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th in + + let bounds_th = float_interval_inv p_lin bounds1_th in + let bounds_tm = (rand o concl) bounds_th in + + (* partial_lemma' *) + let u_lemma0 = (INST[f1_tm, f_var; y_tm, y_var] o + INST_TYPE[n_type_array.(n), nty]) inv_partial_lemma' in + + let u_bounds = + let neg, inv, ( * ) = float_interval_neg, float_interval_inv p_lin, float_interval_mul p_lin in + neg (inv (bounds1_th * bounds1_th)) in + + + let u_lin th1 = + (* partial *) + let u_th = + let ( * ) = float_interval_mul p_lin in + u_bounds * th1 in + let int_tm = rand (concl u_th) in + let i_tm = (rand o rator o rator o lhand) (concl th1) in + let th0 = INST[i_tm, i_var_num; int_tm, int_var] u_lemma0 in + EQ_MP th0 u_th in + + let df_th = eval_all_n df1_th true u_lin in + let d_bounds_list = (rand o rator o concl) df_th in + + + let dd1 = second_bounded_components n second1_th in + + (* second_lemma', second_lemma'' *) + let u_second_lemma0 = (INST[f1_tm, f_var] o + INST_TYPE[n_type_array.(n), nty]) inv_second_lemma' in + + let u_second_lemma1 = (INST[f1_tm, f_var] o + INST_TYPE[n_type_array.(n), nty]) inv_second_lemma'' in + + + let d1_bounds = map (fun i -> + let th0 = eval_m_taylor_partial_bound n p_second i taylor1_th in + undisch th0) (1--n) in + + (* u'(f x), u''(f x) *) + let d1_th0, d2_th0 = + let inv, ( * ) = float_interval_inv p_second, float_interval_mul p_second in + let ff = f1_bound * f1_bound in + inv ff, + two_interval * inv (f1_bound * ff) in + + + let u_second2 th1 = + let i_tm = (rand o rator o concl) th1 in + let i_int = (Num.int_of_num o raw_dest_hash) i_tm in + let di1 = List.nth d1_bounds (i_int - 1) in + let th1 = MY_BETA_RULE th1 in + let lemma = INST[i_tm, i_var_num] u_second_lemma0 in + let u_second th1 = + let j_tm = (rand o rator o rator o rator o lhand) (concl th1) in + let j_int = (Num.int_of_num o raw_dest_hash) j_tm in + let dj1 = List.nth d1_bounds (j_int - 1) in + + (* partial2 *) + let u_th = + let ( * ), ( - ) = float_interval_mul p_second, float_interval_sub p_second in + (d2_th0 * dj1) * di1 - d1_th0 * th1 in + + let int_tm = rand (concl u_th) in + let th0 = INST[j_tm, j_var_num; int_tm, int_var] lemma in + EQ_MP th0 u_th in + + let u_th = eval_all_n th1 true u_second in + let list_tm = (rand o rator o concl) u_th in + let lemma1 = INST[i_tm, i_var_num; list_tm, list_var_real_pair] u_second_lemma1 in + EQ_MP lemma1 u_th in + + let dd_th0 = eval_all_n dd1 false u_second2 in + let dd_list = (rand o rator o concl) dd_th0 in + let dd_th = GEN x_var (DISCH_ALL dd_th0) in + + let th = (MY_PROVE_HYP dd_th o MY_PROVE_HYP diff2_f1_th o + MY_PROVE_HYP cond_th o MY_PROVE_HYP f1_bound0 o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP df_th o MY_PROVE_HYP domain_th o + INST[f1_tm, f_var; f_bounds_tm, f_bounds_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var; d_bounds_list, d_bounds_list_var; + dd_list, dd_bounds_list_var] o + INST_TYPE[n_type_array.(n), nty]) MK_M_TAYLOR_INV' in + let eq_th = unary_beta_gen_eq f1_tm x_var inv_op_real in + m_taylor_interval_norm th eq_th;; + + +(***************************************) +(* eval_m_taylor_sqrt *) + +let sqrt_partial_lemma' = + prove(`interval_arith (inv (&2 * sqrt (f y)) * partial i f (y:real^N)) int <=> + (\i int. interval_arith (inv (&2 * sqrt (f y)) * partial i f y) int) i int`, + REWRITE_TAC[]);; + + +let sqrt_second_lemma' = + prove(`interval_arith ((--inv ((&2 * sqrt (f x)) * (&2 * f x)) * partial j f x) * partial i f (x:real^N) + + inv (&2 * sqrt (f x)) * partial2 j i f x) int <=> + (\j int. interval_arith ((--inv ((&2 * sqrt (f x))*(&2 * f x)) * partial j f x) * partial i f x + + inv (&2 * sqrt (f x)) * partial2 j i f x) int) j int`, + REWRITE_TAC[]);; + + +let sqrt_second_lemma'' = (PURE_REWRITE_RULE[GSYM num1_eq] o prove) + (`all_n 1 list + (\j int. interval_arith ((--inv ((&2 * sqrt (f x)) * (&2 * f x)) * partial j f x) * partial i f x + + inv (&2 * sqrt (f x)) * partial2 j i f (x:real^N)) int) <=> + (\i list. all_n 1 list + (\j int. interval_arith ((--inv ((&2 * sqrt (f x)) * (&2 * f x)) * partial j f x) * partial i f x + + inv (&2 * sqrt (f x)) * partial2 j i f (x:real^N)) int)) i list`, + REWRITE_TAC[]);; + + +let eval_m_taylor_sqrt n p_lin p_second taylor1_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let f1_tm = (rand o concl) diff2_f1_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let ty = type_of y_tm in + + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let undisch = UNDISCH o SPEC x_var in + + let f1_bound0 = eval_m_taylor_bound n p_second taylor1_th in + let f1_bound = undisch f1_bound0 in + let f_bounds_tm = (rand o concl) f1_bound in + + (* cond *) + let cond_th = check_interval_pos f_bounds_tm in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th in + + let bounds_th = float_interval_sqrt p_lin bounds1_th in + let bounds_tm = (rand o concl) bounds_th in + + (* partial_lemma' *) + let u_lemma0 = (INST[f1_tm, f_var; y_tm, y_var] o + INST_TYPE[n_type_array.(n), nty]) sqrt_partial_lemma' in + + let u_bounds = + let inv, ( * ) = float_interval_inv p_lin, float_interval_mul p_lin in + inv (two_interval * bounds_th) in + + let u_lin th1 = + (* partial *) + let u_th = + let ( * ) = float_interval_mul p_lin in + u_bounds * th1 in + let int_tm = rand (concl u_th) in + let i_tm = (rand o rator o rator o lhand) (concl th1) in + let th0 = INST[i_tm, i_var_num; int_tm, int_var] u_lemma0 in + EQ_MP th0 u_th in + + let df_th = eval_all_n df1_th true u_lin in + let d_bounds_list = (rand o rator o concl) df_th in + + + let dd1 = second_bounded_components n second1_th in + + (* second_lemma', second_lemma'' *) + let u_second_lemma0 = (INST[f1_tm, f_var] o + INST_TYPE[n_type_array.(n), nty]) sqrt_second_lemma' in + + let u_second_lemma1 = (INST[f1_tm, f_var] o + INST_TYPE[n_type_array.(n), nty]) sqrt_second_lemma'' in + + let d1_bounds = map (fun i -> + let th0 = eval_m_taylor_partial_bound n p_second i taylor1_th in + undisch th0) (1--n) in + + (* u'(f x), u''(f x) *) + let d1_th0, d2_th0 = + let neg, sqrt, inv, ( * ) = float_interval_neg, float_interval_sqrt p_second, + float_interval_inv p_second, float_interval_mul p_second in + let two_sqrt_f = two_interval * sqrt f1_bound in + inv two_sqrt_f, + neg (inv (two_sqrt_f * (two_interval * f1_bound))) in + + let u_second2 th1 = + let i_tm = (rand o rator o concl) th1 in + let i_int = (Num.int_of_num o raw_dest_hash) i_tm in + let di1 = List.nth d1_bounds (i_int - 1) in + let th1 = MY_BETA_RULE th1 in + let lemma = INST[i_tm, i_var_num] u_second_lemma0 in + let u_second th1 = + let j_tm = (rand o rator o rator o rator o lhand) (concl th1) in + let j_int = (Num.int_of_num o raw_dest_hash) j_tm in + let dj1 = List.nth d1_bounds (j_int - 1) in + + (* partial2 *) + let u_th = + let ( * ), ( + ) = float_interval_mul p_second, float_interval_add p_second in + (d2_th0 * dj1) * di1 + d1_th0 * th1 in + + let int_tm = rand (concl u_th) in + let th0 = INST[j_tm, j_var_num; int_tm, int_var] lemma in + EQ_MP th0 u_th in + + let u_th = eval_all_n th1 true u_second in + let list_tm = (rand o rator o concl) u_th in + let lemma1 = INST[i_tm, i_var_num; list_tm, list_var_real_pair] u_second_lemma1 in + EQ_MP lemma1 u_th in + + let dd_th0 = eval_all_n dd1 false u_second2 in + let dd_list = (rand o rator o concl) dd_th0 in + let dd_th = GEN x_var (DISCH_ALL dd_th0) in + + let th = (MY_PROVE_HYP dd_th o MY_PROVE_HYP diff2_f1_th o + MY_PROVE_HYP cond_th o MY_PROVE_HYP f1_bound0 o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP df_th o MY_PROVE_HYP domain_th o + INST[f1_tm, f_var; f_bounds_tm, f_bounds_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var; d_bounds_list, d_bounds_list_var; + dd_list, dd_bounds_list_var] o + INST_TYPE[n_type_array.(n), nty]) MK_M_TAYLOR_SQRT' in + let eq_th = unary_beta_gen_eq f1_tm x_var sqrt_tm in + m_taylor_interval_norm th eq_th;; + + + +(***************************************) +(* eval_m_taylor_atn *) + +let atn_partial_lemma' = + prove(`interval_arith (inv (&1 + f y * f y) * partial i f (y:real^N)) int <=> + (\i int. interval_arith (inv (&1 + f y * f y) * partial i f y) int) i int`, + REWRITE_TAC[]);; + + +let atn_second_lemma' = + prove(`interval_arith ((((-- &2 * f x) * inv (&1 + f x * f x) pow 2) * partial j f (x:real^N)) + * partial i f x + inv (&1 + f x * f x) * partial2 j i f x) int <=> + (\j int. interval_arith ((((-- &2 * f x) * inv (&1 + f x * f x) pow 2) * partial j f x) + * partial i f x + inv (&1 + f x * f x) * partial2 j i f x) int) j int`, + REWRITE_TAC[]);; + + +let atn_second_lemma'' = (PURE_REWRITE_RULE[float1_eq; float2_eq; num2_eq] o NUMERALS_TO_NUM o + PURE_REWRITE_RULE[FLOAT_OF_NUM; min_exp_def] o prove) + (`all_n 1 list + (\j int. interval_arith ((((-- &2 * f x) * inv (&1 + f x * f x) pow 2) * partial j f (x:real^N)) + * partial i f x + inv (&1 + f x * f x) * partial2 j i f x) int) <=> + (\i list. all_n 1 list + (\j int. interval_arith ((((-- &2 * f x) * inv (&1 + f x * f x) pow 2) * partial j f x) + * partial i f x + inv (&1 + f x * f x) * partial2 j i f x) int)) i list`, + REWRITE_TAC[]);; + + + +let eval_m_taylor_atn n p_lin p_second taylor1_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let f1_tm = (rand o concl) diff2_f1_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let ty = type_of y_tm in + + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let undisch = UNDISCH o SPEC x_var in + + let f1_bound0 = eval_m_taylor_bound n p_second taylor1_th in + let f1_bound = undisch f1_bound0 in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th in + + let bounds_th = float_interval_atn p_lin bounds1_th in + let bounds_tm = (rand o concl) bounds_th in + + (* partial_lemma' *) + let u_lemma0 = (INST[f1_tm, f_var; y_tm, y_var] o + INST_TYPE[n_type_array.(n), nty]) atn_partial_lemma' in + + let u_bounds = + let inv, ( + ), ( * ) = float_interval_inv p_lin, float_interval_add p_lin, float_interval_mul p_lin in + inv (one_interval + bounds1_th * bounds1_th) in + + let u_lin th1 = + (* partial *) + let u_th = + let ( * ) = float_interval_mul p_lin in + u_bounds * th1 in + let int_tm = rand (concl u_th) in + let i_tm = (rand o rator o rator o lhand) (concl th1) in + let th0 = INST[i_tm, i_var_num; int_tm, int_var] u_lemma0 in + EQ_MP th0 u_th in + + let df_th = eval_all_n df1_th true u_lin in + let d_bounds_list = (rand o rator o concl) df_th in + + + let dd1 = second_bounded_components n second1_th in + + (* second_lemma', second_lemma'' *) + let u_second_lemma0 = (INST[f1_tm, f_var] o + INST_TYPE[n_type_array.(n), nty]) atn_second_lemma' in + + let u_second_lemma1 = (INST[f1_tm, f_var] o + INST_TYPE[n_type_array.(n), nty]) atn_second_lemma'' in + + let d1_bounds = map (fun i -> + let th0 = eval_m_taylor_partial_bound n p_second i taylor1_th in + undisch th0) (1--n) in + + + (* u'(f x), u''(f x) *) + let d1_th0, d2_th0 = + let neg, inv, ( + ), ( * ), pow2 = float_interval_neg, float_interval_inv p_second, + float_interval_add p_second, float_interval_mul p_second, float_interval_pow_simple p_second 2 in + let inv_one_ff = inv (one_interval + f1_bound * f1_bound) in + inv_one_ff, + (neg_two_interval * f1_bound) * pow2 inv_one_ff in + + let u_second2 th1 = + let i_tm = (rand o rator o concl) th1 in + let i_int = (Num.int_of_num o raw_dest_hash) i_tm in + let di1 = List.nth d1_bounds (i_int - 1) in + let th1 = MY_BETA_RULE th1 in + let lemma = INST[i_tm, i_var_num] u_second_lemma0 in + let u_second th1 = + let j_tm = (rand o rator o rator o rator o lhand) (concl th1) in + let j_int = (Num.int_of_num o raw_dest_hash) j_tm in + let dj1 = List.nth d1_bounds (j_int - 1) in + + (* partial2 *) + let u_th = + let ( * ), ( + ) = float_interval_mul p_second, float_interval_add p_second in + (d2_th0 * dj1) * di1 + d1_th0 * th1 in + + let int_tm = rand (concl u_th) in + let th0 = INST[j_tm, j_var_num; int_tm, int_var] lemma in + EQ_MP th0 u_th in + + let u_th = eval_all_n th1 true u_second in + let list_tm = (rand o rator o concl) u_th in + let lemma1 = INST[i_tm, i_var_num; list_tm, list_var_real_pair] u_second_lemma1 in + EQ_MP lemma1 u_th in + + let dd_th0 = eval_all_n dd1 false u_second2 in + let dd_list = (rand o rator o concl) dd_th0 in + let dd_th = GEN x_var (DISCH_ALL dd_th0) in + + let th = (MY_PROVE_HYP dd_th o MY_PROVE_HYP diff2_f1_th o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP df_th o MY_PROVE_HYP domain_th o + INST[f1_tm, f_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var; d_bounds_list, d_bounds_list_var; + dd_list, dd_bounds_list_var] o + INST_TYPE[n_type_array.(n), nty]) MK_M_TAYLOR_ATN' in + let eq_th = unary_beta_gen_eq f1_tm x_var atn_tm in + m_taylor_interval_norm th eq_th;; + + + +(***************************************) +(* eval_m_taylor_acs *) + +let acs_partial_lemma' = + prove(`interval_arith (--inv (sqrt (&1 - f y * f y)) * partial i f (y:real^N)) int <=> + (\i int. interval_arith (--inv (sqrt (&1 - f y * f y)) * partial i f y) int) i int`, + REWRITE_TAC[]);; + + +let acs_second_lemma' = + prove(`interval_arith ((--(f x / sqrt ((&1 - f x * f x) pow 3)) * partial j f x) * partial i f (x:real^N) - inv (sqrt (&1 - f x * f x)) * partial2 j i f x) int <=> + + (\j int. interval_arith ((--(f x / sqrt ((&1 - f x * f x) pow 3)) * partial j f x) * partial i f (x:real^N) - inv (sqrt (&1 - f x * f x)) * partial2 j i f x) int) j int`, + REWRITE_TAC[]);; + + +let acs_second_lemma'' = (PURE_REWRITE_RULE[float1_eq; float2_eq; num3_eq; num2_eq] o NUMERALS_TO_NUM o + PURE_REWRITE_RULE[FLOAT_OF_NUM; min_exp_def] o prove) + (`all_n 1 list + (\j int. interval_arith ((--(f x / sqrt ((&1 - f x * f x) pow 3)) * partial j f x) * partial i f (x:real^N) - inv (sqrt (&1 - f x * f x)) * partial2 j i f x) int) <=> + (\i list. all_n 1 list + (\j int. interval_arith ((--(f x / sqrt ((&1 - f x * f x) pow 3)) * partial j f x) * partial i f (x:real^N) - inv (sqrt (&1 - f x * f x)) * partial2 j i f x) int)) i list`, + REWRITE_TAC[]);; + + +let eval_m_taylor_acs n p_lin p_second taylor1_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let f1_tm = (rand o concl) diff2_f1_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let ty = type_of y_tm in + + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let undisch = UNDISCH o SPEC x_var in + + let f1_bound0 = eval_m_taylor_bound n p_second taylor1_th in + let f1_bound = undisch f1_bound0 in + let f_bounds_tm = (rand o concl) f1_bound in + + (* cond *) + let cond_th = EQT_ELIM (check_interval_iabs f_bounds_tm one_float) in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th in + + let bounds_th = float_interval_acs p_lin bounds1_th in + let bounds_tm = (rand o concl) bounds_th in + + (* partial_lemma' *) + let u_lemma0 = (INST[f1_tm, f_var; y_tm, y_var] o + INST_TYPE[n_type_array.(n), nty]) acs_partial_lemma' in + + let u_bounds = + let inv, sqrt, neg = float_interval_inv p_lin, float_interval_sqrt p_lin, float_interval_neg in + let ( * ), (-) = float_interval_mul p_lin, float_interval_sub p_lin in + neg (inv (sqrt (one_interval - bounds1_th * bounds1_th))) in + + let u_lin th1 = + (* partial *) + let u_th = + let ( * ) = float_interval_mul p_lin in + u_bounds * th1 in + let int_tm = rand (concl u_th) in + let i_tm = (rand o rator o rator o lhand) (concl th1) in + let th0 = INST[i_tm, i_var_num; int_tm, int_var] u_lemma0 in + EQ_MP th0 u_th in + + let df_th = eval_all_n df1_th true u_lin in + let d_bounds_list = (rand o rator o concl) df_th in + + + let dd1 = second_bounded_components n second1_th in + + (* second_lemma', second_lemma'' *) + let u_second_lemma0 = (INST[f1_tm, f_var] o + INST_TYPE[n_type_array.(n), nty]) acs_second_lemma' in + + let u_second_lemma1 = (INST[f1_tm, f_var] o + INST_TYPE[n_type_array.(n), nty]) acs_second_lemma'' in + + let d1_bounds = map (fun i -> + let th0 = eval_m_taylor_partial_bound n p_second i taylor1_th in + undisch th0) (1--n) in + + (* u'(f x), u''(f x) *) + let d1_th0, d2_th0 = + let neg, sqrt, inv = float_interval_neg, float_interval_sqrt p_second, float_interval_inv p_second in + let (-), ( * ), (/) = float_interval_sub p_second, float_interval_mul p_second, float_interval_div p_second in + let pow3 = float_interval_pow_simple p_second 3 in + let ff_1 = one_interval - f1_bound * f1_bound in + inv (sqrt ff_1), + neg (f1_bound / sqrt (pow3 ff_1)) in + + let u_second2 th1 = + let i_tm = (rand o rator o concl) th1 in + let i_int = (Num.int_of_num o raw_dest_hash) i_tm in + let di1 = List.nth d1_bounds (i_int - 1) in + let th1 = MY_BETA_RULE th1 in + let lemma = INST[i_tm, i_var_num] u_second_lemma0 in + let u_second th1 = + let j_tm = (rand o rator o rator o rator o lhand) (concl th1) in + let j_int = (Num.int_of_num o raw_dest_hash) j_tm in + let dj1 = List.nth d1_bounds (j_int - 1) in + + (* partial2 *) + let u_th = + let ( * ), ( - ) = float_interval_mul p_second, float_interval_sub p_second in + (d2_th0 * dj1) * di1 - d1_th0 * th1 in + + let int_tm = rand (concl u_th) in + let th0 = INST[j_tm, j_var_num; int_tm, int_var] lemma in + EQ_MP th0 u_th in + + let u_th = eval_all_n th1 true u_second in + let list_tm = (rand o rator o concl) u_th in + let lemma1 = INST[i_tm, i_var_num; list_tm, list_var_real_pair] u_second_lemma1 in + EQ_MP lemma1 u_th in + + let dd_th0 = eval_all_n dd1 false u_second2 in + let dd_list = (rand o rator o concl) dd_th0 in + let dd_th = GEN x_var (DISCH_ALL dd_th0) in + + let th = (MY_PROVE_HYP dd_th o MY_PROVE_HYP diff2_f1_th o + MY_PROVE_HYP cond_th o MY_PROVE_HYP f1_bound0 o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP df_th o MY_PROVE_HYP domain_th o + INST[f1_tm, f_var; f_bounds_tm, f_bounds_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var; d_bounds_list, d_bounds_list_var; + dd_list, dd_bounds_list_var] o + INST_TYPE[n_type_array.(n), nty]) MK_M_TAYLOR_ACS' in + let eq_th = unary_beta_gen_eq f1_tm x_var acs_tm in + m_taylor_interval_norm th eq_th;; + + +(******************) + +(* +let n = 3;; +let pp = 7;; + +let xx = mk_vector_list [one_float; one_float; one_float];; +let r = mk_float 27182 46;; +let r = mk_float 11 49;; +let zz = mk_vector_list [r; r; r];; + +let r = mk_float 0 50;; +let xx = mk_vector_list [r; r; r];; +let r = mk_float 1 49;; +let zz = mk_vector_list [r; r; r];; + +let domain_th = mk_m_center_domain n pp (rand xx) (rand zz);; +let f1 = expr_to_vector_fun `x1 + x2 * x3`;; +let f2 = `\x:real^3. x$2 * x$2`;; +let taylor1 = eval_m_taylor_poly0 pp f1 pp pp domain_th;; +let taylor2 = eval_m_taylor_poly0 pp f2 pp pp domain_th;; + +let th = eval_m_taylor_add n pp pp taylor1 taylor2;; + +(* 10: 1.408 *) +test 100 (eval_m_taylor_add n pp pp taylor1) taylor2;; + +let th = eval_m_taylor_mul n pp pp taylor1 taylor2;; + +(* 10: 5.976 *) +test 100 (eval_m_taylor_mul n pp pp taylor1) taylor2;; + + +let eval_poly = eval_m_taylor_poly0 pp `\x:real^3. (x$1 + x$2 * x$3) * x$2 * x$2 + &100`;; +let th = eval_poly pp pp domain_th;; +(* 10: 0.808 *) +test 100 (eval_poly pp pp) domain_th;; + +eval_m_taylor_bound n pp th;; + +eval_m_taylor_atn n pp pp th;; +eval_m_taylor_acs n pp pp th;; +*) diff --git a/formal_lp/old/formal_interval/m_taylor_arith2.hl b/formal_lp/old/formal_interval/m_taylor_arith2.hl new file mode 100644 index 0000000..e32cb64 --- /dev/null +++ b/formal_lp/old/formal_interval/m_taylor_arith2.hl @@ -0,0 +1,669 @@ +needs "../formal_lp/formal_interval/m_taylor_arith.hl";; + + + + +(**************************************) +let real_pair_ty = `:real#real`;; +let mk_vars n name ty = map (fun i -> mk_var (name^string_of_int i, ty)) (1--n);; + + +let all_n_components2 n all_n_th = + let th0 = SYM (all_n_array.(n)) in + let _, list_tm, s_tm = dest_all_n (concl all_n_th) in + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let s_var = mk_var ("s", type_of s_tm) and + a_vars = mk_vars n "a" ty in + + let list_tms = dest_list list_tm in + let th1 = (INST ([s_tm, s_var] @ zip list_tms a_vars) o INST_TYPE[ty, aty]) th0 in + CONJUNCTS (EQ_MP th1 all_n_th);; + + + +(***************************************) + +let gen_taylor_arith_thm arith_th final_rule n = + let num1_th = (SYM o REWRITE_RULE[Arith_hash.NUM_THM] o NUMERAL_TO_NUM_CONV) `1` in + let th0 = (REWRITE_RULE[num1_th] o DISCH_ALL o INST_TYPE[n_type_array.(n), nty]) arith_th in + let pty = `:real#real` in + let dfs = mk_vars n "df" pty in + let ddfs' = map (fun i -> map (fun j -> dd_vars_array.(i).(j)) (1--i)) (1--n) in + let ddfs = map (fun list -> mk_list (list, pty)) ddfs' in + let d_bounds_list = mk_list (dfs, pty) in + let dd_bounds_list = mk_list (ddfs, type_of (hd ddfs)) in + let th1 = INST[d_bounds_list, d_bounds_list_var; dd_bounds_list, dd_bounds_list_var] th0 in + let th2 = (CONV_RULE NUM_REDUCE_CONV o REWRITE_RULE[all_n]) th1 in + (UNDISCH_ALL o final_rule o REWRITE_RULE[GSYM CONJ_ASSOC] o + NUMERALS_TO_NUM o PURE_REWRITE_RULE[FLOAT_OF_NUM; min_exp_def]) th2;; + + +let gen_add_thm = gen_taylor_arith_thm MK_M_TAYLOR_ADD' (CONV_RULE ALL_CONV);; +let gen_sub_thm = gen_taylor_arith_thm MK_M_TAYLOR_SUB' (CONV_RULE ALL_CONV);; +let gen_mul_thm = gen_taylor_arith_thm MK_M_TAYLOR_MUL' (CONV_RULE ALL_CONV);; +let gen_inv_thm = gen_taylor_arith_thm MK_M_TAYLOR_INV' (REWRITE_RULE[float2_eq]);; +let gen_sqrt_thm = gen_taylor_arith_thm MK_M_TAYLOR_SQRT' (REWRITE_RULE[float2_eq]);; + +let gen_atn_thm = + let pow2_th = (SYM o REWRITE_CONV[SYM num2_eq]) `x pow 2` in + gen_taylor_arith_thm MK_M_TAYLOR_ATN' (REWRITE_RULE[float2_eq; float1_eq; pow2_th]);; + +let gen_acs_thm = + let iabs_lemma = REWRITE_CONV[SYM float1_eq] `iabs f_bounds < &1` in + let pow3_lemma = (SYM o REWRITE_CONV[SYM num3_eq]) `x pow 3` in + gen_taylor_arith_thm MK_M_TAYLOR_ACS' (REWRITE_RULE[iabs_lemma] o REWRITE_RULE[float1_eq; pow3_lemma]);; + + +let add_ths_array, + sub_ths_array, + mul_ths_array, + inv_ths_array, + sqrt_ths_array, + atn_ths_array, + acs_ths_array = + let gen = fun f -> Array.init (max_dim + 1) (fun i -> if i = 0 then TRUTH else f i) in + gen gen_add_thm, + gen gen_sub_thm, + gen gen_mul_thm, + gen gen_inv_thm, + gen gen_sqrt_thm, + gen gen_atn_thm, + gen gen_acs_thm;; + + +(*********************) +(* add *) + +let eval_m_taylor_add2 n p_lin p_second taylor1_th taylor2_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let _, diff2_f2_th, lin2_th, second2_th = dest_m_taylor_thms n taylor2_th in + let f1_tm = (rand o concl) diff2_f1_th and + f2_tm = (rand o concl) diff2_f2_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let ty = type_of y_tm in + + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + g_var = mk_var ("g", type_of f2_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th and + _, bounds2_th, df2_th = m_lin_approx_components n lin2_th in + + let bounds_th = float_interval_add p_lin bounds1_th bounds2_th in + let bounds_tm = (rand o concl) bounds_th in + + let df_ths = + let df1_ths = map MY_BETA_RULE (all_n_components2 n df1_th) in + let df2_ths = map MY_BETA_RULE (all_n_components2 n df2_th) in + map2 (float_interval_add p_lin) df1_ths df2_ths in + + let df_th = end_itlist CONJ df_ths in + + let dd_ths = + let dd1' = all_n_components2 n (second_bounded_components n second1_th) in + let dd2' = all_n_components2 n (second_bounded_components n second2_th) in + let dd1 = map2 (fun i -> map MY_BETA_RULE o all_n_components2 i o MY_BETA_RULE) (1--n) dd1' in + let dd2 = map2 (fun i -> map MY_BETA_RULE o all_n_components2 i o MY_BETA_RULE) (1--n) dd2' in + map2 (map2 (float_interval_add p_second)) dd1 dd2 in + + let dd_th = (GEN x_var o DISCH_ALL o end_itlist CONJ) (List.flatten dd_ths) in + + let df_vars = map (fun i -> df_vars_array.(i)) (1--n) in + let dd_vars = map (fun i -> map (fun j -> dd_vars_array.(i).(j)) (1--i)) (1--n) in + + let dfs = map (rand o concl) df_ths in + let dds = map (map (rand o concl)) dd_ths in + let inst_list = union (zip dfs df_vars) (zip (List.flatten dds) (List.flatten dd_vars)) in + + let th = (MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP diff2_f2_th o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP domain_th o + MY_PROVE_HYP df_th o MY_PROVE_HYP dd_th o + INST([f1_tm, f_var; f2_tm, g_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var] @ inst_list)) add_ths_array.(n) in + let eq_th = binary_beta_gen_eq f1_tm f2_tm x_var add_op_real in + m_taylor_interval_norm th eq_th;; + + +(*********************) +(* sub *) + +let eval_m_taylor_sub2 n p_lin p_second taylor1_th taylor2_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let _, diff2_f2_th, lin2_th, second2_th = dest_m_taylor_thms n taylor2_th in + let f1_tm = (rand o concl) diff2_f1_th and + f2_tm = (rand o concl) diff2_f2_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let ty = type_of y_tm in + + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + g_var = mk_var ("g", type_of f2_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th and + _, bounds2_th, df2_th = m_lin_approx_components n lin2_th in + + let bounds_th = float_interval_sub p_lin bounds1_th bounds2_th in + let bounds_tm = (rand o concl) bounds_th in + + let df_ths = + let df1_ths = map MY_BETA_RULE (all_n_components2 n df1_th) in + let df2_ths = map MY_BETA_RULE (all_n_components2 n df2_th) in + map2 (float_interval_sub p_lin) df1_ths df2_ths in + + let df_th = end_itlist CONJ df_ths in + + let dd_ths = + let dd1' = all_n_components2 n (second_bounded_components n second1_th) in + let dd2' = all_n_components2 n (second_bounded_components n second2_th) in + let dd1 = map2 (fun i -> map MY_BETA_RULE o all_n_components2 i o MY_BETA_RULE) (1--n) dd1' in + let dd2 = map2 (fun i -> map MY_BETA_RULE o all_n_components2 i o MY_BETA_RULE) (1--n) dd2' in + map2 (map2 (float_interval_sub p_second)) dd1 dd2 in + + let dd_th = (GEN x_var o DISCH_ALL o end_itlist CONJ) (List.flatten dd_ths) in + + let df_vars = map (fun i -> df_vars_array.(i)) (1--n) in + let dd_vars = map (fun i -> map (fun j -> dd_vars_array.(i).(j)) (1--i)) (1--n) in + + let dfs = map (rand o concl) df_ths in + let dds = map (map (rand o concl)) dd_ths in + let inst_list = union (zip dfs df_vars) (zip (List.flatten dds) (List.flatten dd_vars)) in + + let th = (MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP diff2_f2_th o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP domain_th o + MY_PROVE_HYP df_th o MY_PROVE_HYP dd_th o + INST([f1_tm, f_var; f2_tm, g_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var] @ inst_list)) sub_ths_array.(n) in + let eq_th = binary_beta_gen_eq f1_tm f2_tm x_var sub_op_real in + m_taylor_interval_norm th eq_th;; + + +(*********************) +(* mul *) + +let eval_m_taylor_mul2 n p_lin p_second taylor1_th taylor2_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let _, diff2_f2_th, lin2_th, second2_th = dest_m_taylor_thms n taylor2_th in + let f1_tm = (rand o concl) diff2_f1_th and + f2_tm = (rand o concl) diff2_f2_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let ty = type_of y_tm in + + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + g_var = mk_var ("g", type_of f2_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let undisch = UNDISCH o SPEC x_var in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th and + _, bounds2_th, df2_th = m_lin_approx_components n lin2_th in + + let bounds_th = float_interval_mul p_lin bounds1_th bounds2_th in + let bounds_tm = (rand o concl) bounds_th in + + (* first partials *) + let df_ths = + let df1_ths = map MY_BETA_RULE (all_n_components2 n df1_th) in + let df2_ths = map MY_BETA_RULE (all_n_components2 n df2_th) in + let ( * ), ( + ) = float_interval_mul p_lin, float_interval_add p_lin in + map2 (fun d1 d2 -> d1 * bounds2_th + bounds1_th * d2) df1_ths df2_ths in + + let df_th = end_itlist CONJ df_ths in + + (* second partials *) + let d1_bounds = map (fun i -> + undisch (eval_m_taylor_partial_bound n p_second i taylor1_th)) (1--n) in + let d2_bounds = map (fun i -> + undisch (eval_m_taylor_partial_bound n p_second i taylor2_th)) (1--n) in + let f1_bound = undisch (eval_m_taylor_bound n p_second taylor1_th) in + let f2_bound = undisch (eval_m_taylor_bound n p_second taylor2_th) in + + let dd_ths = + let ns = 1--n in + let dd1' = all_n_components2 n (second_bounded_components n second1_th) in + let dd2' = all_n_components2 n (second_bounded_components n second2_th) in + let dd1 = map2 (fun i -> map MY_BETA_RULE o all_n_components2 i o MY_BETA_RULE) ns dd1' in + let dd2 = map2 (fun i -> map MY_BETA_RULE o all_n_components2 i o MY_BETA_RULE) ns dd2' in + let ( * ), ( + ) = float_interval_mul p_second, float_interval_add p_second in + map2 (fun (dd1_list, dd2_list) i -> + let di1 = List.nth d1_bounds (i - 1) in + let di2 = List.nth d2_bounds (i - 1) in + map2 (fun (dd1, dd2) j -> + let dj1 = List.nth d1_bounds (j - 1) in + let dj2 = List.nth d2_bounds (j - 1) in + (dd1 * f2_bound + di1 * dj2) + (dj1 * di2 + f1_bound * dd2)) + (zip dd1_list dd2_list) (1--i)) (zip dd1 dd2) ns in + + let dd_th = (GEN x_var o DISCH_ALL o end_itlist CONJ) (List.flatten dd_ths) in + + let df_vars = map (fun i -> df_vars_array.(i)) (1--n) in + let dd_vars = map (fun i -> map (fun j -> dd_vars_array.(i).(j)) (1--i)) (1--n) in + + let dfs = map (rand o concl) df_ths in + let dds = map (map (rand o concl)) dd_ths in + let inst_list = union (zip dfs df_vars) (zip (List.flatten dds) (List.flatten dd_vars)) in + + let th = (MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP diff2_f2_th o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP domain_th o + MY_PROVE_HYP df_th o MY_PROVE_HYP dd_th o + INST([f1_tm, f_var; f2_tm, g_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var] @ inst_list)) mul_ths_array.(n) in + let eq_th = binary_beta_gen_eq f1_tm f2_tm x_var mul_op_real in + m_taylor_interval_norm th eq_th;; + + + +(******************************) +(* inv *) + +let eval_m_taylor_inv2 n p_lin p_second taylor1_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let f1_tm = (rand o concl) diff2_f1_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + + let ty = type_of y_tm in + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let undisch = UNDISCH o SPEC x_var in + + let f1_bound0 = eval_m_taylor_bound n p_second taylor1_th in + let f1_bound = undisch f1_bound0 in + let f_bounds_tm = (rand o concl) f1_bound in + + (* cond *) + let cond_th = check_interval_not_zero f_bounds_tm in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th in + + let bounds_th = float_interval_inv p_lin bounds1_th in + let bounds_tm = (rand o concl) bounds_th in + + (* first partials *) + let u_bounds = + let neg, inv, ( * ) = float_interval_neg, float_interval_inv p_lin, float_interval_mul p_lin in + neg (inv (bounds1_th * bounds1_th)) in + + let df1_ths' = all_n_components2 n df1_th in + let df1_ths = map MY_BETA_RULE df1_ths' in + + let df_ths = + let ( * ) = float_interval_mul p_lin in + map (fun th1 -> u_bounds * th1) df1_ths in + + let df_th = end_itlist CONJ df_ths in + + (* second partials *) + let dd_ths = + let dd1 = all_n_components2 n (second_bounded_components n second1_th) in + map2 (fun i -> map MY_BETA_RULE o all_n_components2 i o MY_BETA_RULE) (1--n) dd1 in + + let d1_bounds = map (fun i -> + let th0 = eval_m_taylor_partial_bound n p_second i taylor1_th in + undisch th0) (1--n) in + + (* u'(f x), u''(f x) *) + let d1_th0, d2_th0 = + let inv, ( * ) = float_interval_inv p_second, float_interval_mul p_second in + let ff = f1_bound * f1_bound in + inv ff, + two_interval * inv (f1_bound * ff) in + + let dd_ths = + let ( * ), ( - ) = float_interval_mul p_second, float_interval_sub p_second in + map2 (fun dd_list di1 -> + my_map2 (fun dd dj1 -> + (d2_th0 * dj1) * di1 - d1_th0 * dd) dd_list d1_bounds) dd_ths d1_bounds in + + let dd_th = (GEN x_var o DISCH_ALL o end_itlist CONJ) (List.flatten dd_ths) in + + (***) + let df_vars = map (fun i -> df_vars_array.(i)) (1--n) in + let dd_vars = map (fun i -> map (fun j -> dd_vars_array.(i).(j)) (1--i)) (1--n) in + + let dfs = map (rand o concl) df_ths in + let dds = map (map (rand o concl)) dd_ths in + + let inst_list = union (zip dfs df_vars) (zip (List.flatten dds) (List.flatten dd_vars)) in + + let th1 = (MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP cond_th o MY_PROVE_HYP f1_bound0 o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP domain_th o + MY_PROVE_HYP dd_th o MY_PROVE_HYP df_th o + INST([f1_tm, f_var; f_bounds_tm, f_bounds_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var] @ inst_list)) inv_ths_array.(n) in + let eq_th = unary_beta_gen_eq f1_tm x_var inv_op_real in + m_taylor_interval_norm th1 eq_th;; + + + +(******************************) +(* sqrt *) + +let eval_m_taylor_sqrt2 n p_lin p_second taylor1_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let f1_tm = (rand o concl) diff2_f1_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + + let ty = type_of y_tm in + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let undisch = UNDISCH o SPEC x_var in + + let f1_bound0 = eval_m_taylor_bound n p_second taylor1_th in + let f1_bound = undisch f1_bound0 in + let f_bounds_tm = (rand o concl) f1_bound in + + (* cond *) + let cond_th = check_interval_pos f_bounds_tm in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th in + + let bounds_th = float_interval_sqrt p_lin bounds1_th in + let bounds_tm = (rand o concl) bounds_th in + + (* first partials *) + let u_bounds = + let inv, ( * ) = float_interval_inv p_lin, float_interval_mul p_lin in + inv (two_interval * bounds_th) in + + let df1_ths' = all_n_components2 n df1_th in + let df1_ths = map MY_BETA_RULE df1_ths' in + + let df_ths = + let ( * ) = float_interval_mul p_lin in + map (fun th1 -> u_bounds * th1) df1_ths in + + let df_th = end_itlist CONJ df_ths in + + (* second partials *) + let dd_ths = + let dd1 = all_n_components2 n (second_bounded_components n second1_th) in + map2 (fun i -> map MY_BETA_RULE o all_n_components2 i o MY_BETA_RULE) (1--n) dd1 in + + let d1_bounds = map (fun i -> + let th0 = eval_m_taylor_partial_bound n p_second i taylor1_th in + undisch th0) (1--n) in + + (* u'(f x), u''(f x) *) + let d1_th0, d2_th0 = + let neg, sqrt, inv, ( * ) = float_interval_neg, float_interval_sqrt p_second, + float_interval_inv p_second, float_interval_mul p_second in + let two_sqrt_f = two_interval * sqrt f1_bound in + inv two_sqrt_f, neg (inv (two_sqrt_f * (two_interval * f1_bound))) in + + let dd_ths = + let ( * ), ( + ) = float_interval_mul p_second, float_interval_add p_second in + map2 (fun dd_list di1 -> + my_map2 (fun dd dj1 -> + (d2_th0 * dj1) * di1 + d1_th0 * dd) dd_list d1_bounds) dd_ths d1_bounds in + + let dd_th = (GEN x_var o DISCH_ALL o end_itlist CONJ) (List.flatten dd_ths) in + + (***) + let df_vars = map (fun i -> df_vars_array.(i)) (1--n) in + let dd_vars = map (fun i -> map (fun j -> dd_vars_array.(i).(j)) (1--i)) (1--n) in + + let dfs = map (rand o concl) df_ths in + let dds = map (map (rand o concl)) dd_ths in + + let inst_list = union (zip dfs df_vars) (zip (List.flatten dds) (List.flatten dd_vars)) in + + let th1 = (MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP cond_th o MY_PROVE_HYP f1_bound0 o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP domain_th o + MY_PROVE_HYP dd_th o MY_PROVE_HYP df_th o + INST([f1_tm, f_var; f_bounds_tm, f_bounds_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var] @ inst_list)) sqrt_ths_array.(n) in + let eq_th = unary_beta_gen_eq f1_tm x_var sqrt_tm in + m_taylor_interval_norm th1 eq_th;; + + + +(******************************) +(* atn *) + +let eval_m_taylor_atn2 n p_lin p_second taylor1_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let f1_tm = (rand o concl) diff2_f1_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + + let ty = type_of y_tm in + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let undisch = UNDISCH o SPEC x_var in + + let f1_bound0 = eval_m_taylor_bound n p_second taylor1_th in + let f1_bound = undisch f1_bound0 in + let f_bounds_tm = (rand o concl) f1_bound in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th in + + let bounds_th = float_interval_atn p_lin bounds1_th in + let bounds_tm = (rand o concl) bounds_th in + + (* first partials *) + let u_bounds = + let inv, ( + ), ( * ) = float_interval_inv p_lin, + float_interval_add p_lin, float_interval_mul p_lin in + inv (one_interval + bounds1_th * bounds1_th) in + + let df1_ths' = all_n_components2 n df1_th in + let df1_ths = map MY_BETA_RULE df1_ths' in + + let df_ths = + let ( * ) = float_interval_mul p_lin in + map (fun th1 -> u_bounds * th1) df1_ths in + + let df_th = end_itlist CONJ df_ths in + + (* second partials *) + let dd_ths = + let dd1 = all_n_components2 n (second_bounded_components n second1_th) in + map2 (fun i -> map MY_BETA_RULE o all_n_components2 i o MY_BETA_RULE) (1--n) dd1 in + + let d1_bounds = map (fun i -> + let th0 = eval_m_taylor_partial_bound n p_second i taylor1_th in + undisch th0) (1--n) in + + (* u'(f x), u''(f x) *) + let d1_th0, d2_th0 = + let neg, inv, ( + ), ( * ), pow2 = float_interval_neg, float_interval_inv p_second, + float_interval_add p_second, float_interval_mul p_second, float_interval_pow_simple p_second 2 in + let inv_one_ff = inv (one_interval + f1_bound * f1_bound) in + inv_one_ff, (neg_two_interval * f1_bound) * pow2 inv_one_ff in + + let dd_ths = + let ( * ), ( + ) = float_interval_mul p_second, float_interval_add p_second in + map2 (fun dd_list di1 -> + my_map2 (fun dd dj1 -> + (d2_th0 * dj1) * di1 + d1_th0 * dd) dd_list d1_bounds) dd_ths d1_bounds in + + let dd_th = (GEN x_var o DISCH_ALL o end_itlist CONJ) (List.flatten dd_ths) in + + (***) + let df_vars = map (fun i -> df_vars_array.(i)) (1--n) in + let dd_vars = map (fun i -> map (fun j -> dd_vars_array.(i).(j)) (1--i)) (1--n) in + + let dfs = map (rand o concl) df_ths in + let dds = map (map (rand o concl)) dd_ths in + + let inst_list = union (zip dfs df_vars) (zip (List.flatten dds) (List.flatten dd_vars)) in + + let th1 = (MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP f1_bound0 o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP domain_th o + MY_PROVE_HYP dd_th o MY_PROVE_HYP df_th o + INST([f1_tm, f_var; f_bounds_tm, f_bounds_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var] @ inst_list)) atn_ths_array.(n) in + let eq_th = unary_beta_gen_eq f1_tm x_var atn_tm in + m_taylor_interval_norm th1 eq_th;; + + +(******************************) +(* acs *) + +let eval_m_taylor_acs2 n p_lin p_second taylor1_th = + let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th in + let f1_tm = (rand o concl) diff2_f1_th in + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + + let ty = type_of y_tm in + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let undisch = UNDISCH o SPEC x_var in + + let f1_bound0 = eval_m_taylor_bound n p_second taylor1_th in + let f1_bound = undisch f1_bound0 in + let f_bounds_tm = (rand o concl) f1_bound in + + (* cond *) + let cond_th = EQT_ELIM (check_interval_iabs f_bounds_tm one_float) in + + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th in + + let bounds_th = float_interval_acs p_lin bounds1_th in + let bounds_tm = (rand o concl) bounds_th in + + (* first partials *) + let u_bounds = + let inv, sqrt, neg = float_interval_inv p_lin, float_interval_sqrt p_lin, float_interval_neg in + let ( * ), ( - ) = float_interval_mul p_lin, float_interval_sub p_lin in + neg (inv (sqrt (one_interval - bounds1_th * bounds1_th))) in + + let df1_ths' = all_n_components2 n df1_th in + let df1_ths = map MY_BETA_RULE df1_ths' in + + let df_ths = + let ( * ) = float_interval_mul p_lin in + map (fun th1 -> u_bounds * th1) df1_ths in + + let df_th = end_itlist CONJ df_ths in + + (* second partials *) + let dd_ths = + let dd1 = all_n_components2 n (second_bounded_components n second1_th) in + map2 (fun i -> map MY_BETA_RULE o all_n_components2 i o MY_BETA_RULE) (1--n) dd1 in + + let d1_bounds = map (fun i -> + let th0 = eval_m_taylor_partial_bound n p_second i taylor1_th in + undisch th0) (1--n) in + + (* u'(f x), u''(f x) *) + let d1_th0, d2_th0 = + let neg, sqrt, inv = float_interval_neg, float_interval_sqrt p_second, float_interval_inv p_second in + let ( - ), ( * ), ( / ), pow3 = float_interval_sub p_second, float_interval_mul p_second, + float_interval_div p_second, float_interval_pow_simple p_second 3 in + let ff_1 = one_interval - f1_bound * f1_bound in + inv (sqrt ff_1), neg (f1_bound / sqrt (pow3 ff_1)) in + + let dd_ths = + let ( * ), ( - ) = float_interval_mul p_second, float_interval_sub p_second in + map2 (fun dd_list di1 -> + my_map2 (fun dd dj1 -> + (d2_th0 * dj1) * di1 - d1_th0 * dd) dd_list d1_bounds) dd_ths d1_bounds in + + let dd_th = (GEN x_var o DISCH_ALL o end_itlist CONJ) (List.flatten dd_ths) in + + (***) + let df_vars = map (fun i -> df_vars_array.(i)) (1--n) in + let dd_vars = map (fun i -> map (fun j -> dd_vars_array.(i).(j)) (1--i)) (1--n) in + + let dfs = map (rand o concl) df_ths in + let dds = map (map (rand o concl)) dd_ths in + + let inst_list = union (zip dfs df_vars) (zip (List.flatten dds) (List.flatten dd_vars)) in + + let th1 = (MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP cond_th o MY_PROVE_HYP f1_bound0 o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP domain_th o + MY_PROVE_HYP dd_th o MY_PROVE_HYP df_th o + INST([f1_tm, f_var; f_bounds_tm, f_bounds_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var] @ inst_list)) acs_ths_array.(n) in + let eq_th = unary_beta_gen_eq f1_tm x_var acs_tm in + m_taylor_interval_norm th1 eq_th;; + + + +(*******************************) + + +(* +let n = 3;; +let pp = 2;; + +let xx = mk_vector_list [one_float; one_float; one_float];; +let r = mk_float 27182 46;; +let r = mk_float 11 49;; +let zz = mk_vector_list [r; r; r];; + +let r = mk_float 0 50;; +let xx = mk_vector_list [r; r; r];; +let r = mk_float 1 49;; +let zz = mk_vector_list [r; r; r];; + +let domain_th = mk_m_center_domain n pp (rand xx) (rand zz);; +let f1 = expr_to_vector_fun `x1 + x2 * x3 + pi`;; +let f2 = `\x:real^3. x$2 * x$2 + &2 * pi`;; +let taylor1 = eval_m_taylor_poly0 pp f1 pp pp domain_th;; +let taylor2 = eval_m_taylor_poly0 pp f2 pp pp domain_th;; + +eval_m_taylor_inv n pp pp taylor1;; +eval_m_taylor_inv2 n pp pp taylor1;; +(* 200: 1.240 *) +test 100 (eval_m_taylor_inv n pp pp) taylor1;; +(* 200: 1.124 *) +test 100 (eval_m_taylor_inv2 n pp pp) taylor1;; + +(* 200: 1.236 *) +test 100 (eval_m_taylor_sqrt 3 2 2) taylor1;; +(* 200: 0.992 *) +test 100 (eval_m_taylor_sqrt2 3 2 2) taylor1;; + +eval_m_taylor_add2 3 2 2 taylor1 taylor2;; +eval_m_taylor_sub2 3 2 2 taylor1 taylor2;; +(* 200: 0.604 *) +test 100 (eval_m_taylor_add 3 2 2 taylor1) taylor2;; +(* 200: 0.392 *) +test 100 (eval_m_taylor_add2 3 2 2 taylor1) taylor2;; + +eval_m_taylor_mul2 3 2 2 taylor1 taylor2;; +(* 200: 2.140 *) +test 100 (eval_m_taylor_mul 3 2 2 taylor1) taylor2;; +(* 200: 1.924 *) +test 100 (eval_m_taylor_mul2 3 2 2 taylor1) taylor2;; + +eval_m_taylor_atn2 3 2 2 taylor1;; +(* 200: 1.416 *) +test 100 (eval_m_taylor_atn 3 2 2) taylor1;; +(* 200: 1.152 *) +test 100 (eval_m_taylor_atn2 3 2 2) taylor1;; +*) + diff --git a/formal_lp/old/formal_interval/m_taylor_old.hl b/formal_lp/old/formal_interval/m_taylor_old.hl new file mode 100644 index 0000000..c0ef24d --- /dev/null +++ b/formal_lp/old/formal_interval/m_taylor_old.hl @@ -0,0 +1,891 @@ +needs "../formal_lp/formal_interval/m_taylor.hl";; + +module M_taylor_old = struct + +let gen_second_bounded_eq_thm n = + let ty, _, x_var, _, _, _, domain_var = get_types_and_vars n in + let dd_vars = map (fun i -> map (fun j -> dd_vars_array.(j).(i)) (1--n)) (1--n) in + let dd_bounds_list = mk_list (map (fun l -> mk_list (l, real_pair_ty)) dd_vars, real_pair_list_ty) in + let th0 = (SPECL[domain_var; dd_bounds_list] o inst_first_type_var ty) second_bounded in + let th1 = (CONV_RULE NUM_REDUCE_CONV o REWRITE_RULE[all_n]) th0 in + th1;; + +let gen_second_bounded_poly_thm poly_tm partials2 = + let x_var, _ = dest_abs poly_tm in + let n = get_dim x_var in + let partials2' = List.flatten partials2 in + let second_th = (REWRITE_RULE partials2' o SPECL [poly_tm]) (gen_second_bounded_eq_thm n) in + second_th;; + + +let gen_second_bounded_poly_thm0 poly_tm = + let x_var, _ = dest_abs poly_tm in + let n = get_dim x_var in + let partials = map (fun i -> gen_partial_poly i poly_tm) (1--n) in + let get_partial i eq_th = + let partial_i = gen_partial_poly i (rand (concl eq_th)) in + let pi = (rator o lhand o concl) partial_i in + REWRITE_RULE[GSYM partial2] (TRANS (AP_TERM pi eq_th) partial_i) in + let partials2 = map (fun th -> map (fun i -> get_partial i th) (1--n)) partials in + gen_second_bounded_poly_thm poly_tm partials2;; + + +(* eval_second_bounded *) +let eval_second_bounded pp0 second_bounded_th = + let poly_tm = (lhand o rator o lhand o concl) second_bounded_th in + let th0 = second_bounded_th in + let n = (get_dim o fst o dest_abs) poly_tm in + let x_vector = mk_vector_list (map (fun i -> x_vars_array.(i)) (1--n)) and + z_vector = mk_vector_list (map (fun i -> z_vars_array.(i)) (1--n)) in + let _, _, _, _, _, _, domain_var = get_types_and_vars n in + + let th1 = INST[mk_pair (x_vector, z_vector), domain_var] th0 in + let th2 = REWRITE_RULE[IN_INTERVAL; dimindex_array.(n)] th1 in + let th3 = REWRITE_RULE[gen_in_interval n; GSYM interval_arith] th2 in + let th4 = (REWRITE_RULE[CONJ_ACI] o REWRITE_RULE (Array.to_list comp_thms_array.(n))) th3 in + let final_th0 = (UNDISCH_ALL o MATCH_MP iffRL) th4 in + + let x_var, h_tm = (dest_forall o hd o hyp) final_th0 in + let _, h2 = dest_imp h_tm in + let concl_ints = striplist dest_conj h2 in + + let i_funs = map (fun int -> + let expr, var = dest_interval_arith int in + (eval_constants pp0 o build_interval_fun) expr, var) concl_ints in + + let rec split_rules i_list = + match i_list with + | [] -> ([], []) + | ((i_fun, var_tm) :: es) -> + let th_list, i_list' = split_rules es in + match i_fun with + | Int_const th -> (var_tm, th) :: th_list, i_list' + | _ -> th_list, (var_tm, i_fun) :: i_list' in + + let const_th_list, i_list0 = split_rules i_funs in + let th5 = itlist (fun (var_tm, th) th0 -> + let b_tm = rand (concl th) in + (REWRITE_RULE[th] o INST[b_tm, var_tm]) th0) const_th_list (SYM th4) in + let final_th = REWRITE_RULE[GSYM IMP_IMP] th5 in + let v_list, i_list' = unzip i_list0 in + let i_list = find_and_replace_all i_list' [] in + + fun pp x_vector_tm z_vector_tm -> + let x_vals = dest_vector x_vector_tm and + z_vals = dest_vector z_vector_tm in + if length x_vals <> n or length z_vals <> n then + failwith (sprintf "Wrong vector size; expected size: %d" n) + else + let x_vars = map (fun i -> x_vars_array.(i)) (1--n) and + z_vars = map (fun i -> z_vars_array.(i)) (1--n) in + + let inst_th = (INST (zip x_vals x_vars) o INST (zip z_vals z_vars)) final_th in + if (not o is_eq) (concl inst_th) then inst_th + else + let x_var, lhs = (dest_forall o lhand o concl) inst_th in + let hs = (butlast o striplist dest_imp) lhs in + let vars = map (rand o rator) hs in + let int_vars = zip vars (map ASSUME hs) in + + let dd_ints = eval_interval_fun_list pp i_list int_vars in + let inst_dd = map2 (fun var th -> (rand o concl) th, var) v_list dd_ints in + let inst_th2 = INST inst_dd inst_th in + + let conj_th = end_itlist CONJ dd_ints in + let lhs_th = GEN x_var (itlist DISCH hs conj_th) in + EQ_MP inst_th2 lhs_th;; + + + +let eval_second_bounded_poly0 pp0 poly_tm = + eval_second_bounded pp0 (gen_second_bounded_poly_thm0 poly_tm);; + + +(*************************************) + +let eval_m_taylor pp0 diff2c_th lin_th second_th = + let poly_tm = (rand o concl) diff2c_th in + let n = (get_dim o fst o dest_abs) poly_tm in + let eval_lin = eval_lin_approx pp0 lin_th and + eval_second = eval_second_bounded pp0 second_th in + + let ty, _, x_var, f_var, y_var, w_var, domain_var = get_types_and_vars n in + let th0 = (SPEC_ALL o inst_first_type_var ty) m_taylor_interval in + let th1 = INST[poly_tm, f_var] th0 in + let th2 = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o MATCH_MP iffRL o REWRITE_RULE[diff2c_th]) th1 in + + fun p_lin p_second domain_th -> + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let x_tm, z_tm = dest_pair domain_tm in + + let lin_th = eval_lin p_lin y_tm and + second_th = eval_second p_second x_tm z_tm in + + let _, _, f_bounds, df_bounds_list = dest_lin_approx (concl lin_th) in + let dd_bounds_list = (rand o concl) second_th in + let df_var = mk_var ("d_bounds_list", type_of df_bounds_list) and + dd_var = mk_var ("dd_bounds_list", type_of dd_bounds_list) in + + (MY_PROVE_HYP domain_th o MY_PROVE_HYP lin_th o MY_PROVE_HYP second_th o + INST[domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + f_bounds, f_bounds_var; df_bounds_list, df_var; dd_bounds_list, dd_var]) th2;; + + +let eval_m_taylor_poly0 pp0 poly_tm = + let diff2_th = gen_diff2c_domain_poly poly_tm in + let x_var, _ = dest_abs poly_tm in + let n = get_dim x_var in + let partials = map (fun i -> gen_partial_poly i poly_tm) (1--n) in + let get_partial i eq_th = + let partial_i = gen_partial_poly i (rand (concl eq_th)) in + let pi = (rator o lhand o concl) partial_i in + REWRITE_RULE[GSYM partial2] (TRANS (AP_TERM pi eq_th) partial_i) in + let partials2 = map (fun th -> map (fun i -> get_partial i th) (1--n)) partials in + let second_th = gen_second_bounded_poly_thm poly_tm partials2 in + let diff_th = gen_diff_poly poly_tm in + let lin_th = gen_lin_approx_poly_thm poly_tm diff_th partials in + eval_m_taylor pp0 diff2_th lin_th second_th;; + + + +(********************************) +(* m_taylor_error *) + + +(* Sum of the list elements *) + +let ITLIST2_EQ_SUM = prove(`!(f:A->real) l1 l2. LENGTH l1 = LENGTH l2 ==> + ITLIST2 (\x y z. x * f y + z) l1 l2 (&0) = + sum (1..(LENGTH l1)) (\i. EL (i - 1) l1 * f (EL (i - 1) l2))`, + GEN_TAC THEN + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[LENGTH; ITLIST2] THEN TRY ARITH_TAC THENL + [ + REWRITE_TAC[SUM_CLAUSES_NUMSEG; ARITH]; + ALL_TAC + ] THEN + REWRITE_TAC[eqSS] THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `t':(A)list`) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[GSYM add1n] THEN + new_rewrite [] [] SUM_ADD_SPLIT THEN REWRITE_TAC[ARITH] THEN + REWRITE_TAC[TWO; add1n; SUM_SING_NUMSEG; subnn; EL; HD] THEN + REWRITE_TAC[GSYM addn1; SUM_OFFSET; REAL_EQ_ADD_LCANCEL] THEN + MATCH_MP_TAC SUM_EQ THEN move ["i"] THEN REWRITE_TAC[IN_NUMSEG] THEN DISCH_TAC THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= i ==> (i + 1) - 1 = SUC (i - 1)`; EL; TL]);; + + + +let M_TAYLOR_ERROR_ITLIST2 = prove(`!f domain y w dd_bounds_list error. + m_cell_domain domain y (vector w) ==> + second_bounded (f:real^N->real) domain dd_bounds_list ==> + LENGTH w = dimindex (:N) ==> + LENGTH dd_bounds_list = dimindex (:N) ==> + ALL (\list. LENGTH list = dimindex (:N)) dd_bounds_list ==> + ITLIST2 (\x list z. x * ITLIST2 (\a b c. a * iabs b + c) w list (&0) + z) + w dd_bounds_list (&0) <= error ==> + m_taylor_error f domain (vector w) error`, + REWRITE_TAC[second_bounded; m_taylor_error] THEN REPEAT GEN_TAC THEN + set_tac "s" `ITLIST2 _1 _2 _3 _4` THEN + move ["domain"; "second"; "lw"; "ldd"; "ldd_all"; "s_le"; "x"; "x_in"] THEN + SUBGOAL_THEN `!i. i IN 1..dimindex (:N) ==> &0 <= EL (i - 1) w` (LABEL_TAC "w_ge0") THENL + [ + GEN_TAC THEN DISCH_TAC THEN REMOVE_THEN "domain" MP_TAC THEN new_rewrite [] [] pair_eq THEN + REWRITE_TAC[m_cell_domain] THEN + DISCH_THEN (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[VECTOR_COMPONENT] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `s:real` THEN ASM_REWRITE_TAC[] THEN + EXPAND_TAC "s" THEN + new_rewrite [] [] ITLIST2_EQ_SUM THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC SUM_LE THEN REWRITE_TAC[FINITE_NUMSEG] THEN + move ["i"; "i_in"] THEN ASM_SIMP_TAC[VECTOR_COMPONENT] THEN + USE_THEN "i_in" (ASSUME_TAC o REWRITE_RULE[IN_NUMSEG]) THEN + MATCH_MP_TAC REAL_LE_LMUL THEN ASM_SIMP_TAC[] THEN + new_rewrite [] [] ITLIST2_EQ_SUM THEN ASM_REWRITE_TAC[] THENL + [ + REMOVE_THEN "ldd_all" MP_TAC THEN REWRITE_TAC[GSYM ALL_EL] THEN + DISCH_THEN (MP_TAC o SPEC `i - 1`) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + MATCH_MP_TAC SUM_LE THEN REWRITE_TAC[FINITE_NUMSEG] THEN + move ["j"; "j_in"] THEN ASM_SIMP_TAC[VECTOR_COMPONENT] THEN + USE_THEN "j_in" (ASSUME_TAC o REWRITE_RULE[IN_NUMSEG]) THEN + MATCH_MP_TAC REAL_LE_LMUL THEN ASM_SIMP_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:real^N`) THEN ASM_REWRITE_TAC[ALL_N_EL] THEN + DISCH_THEN (MP_TAC o SPEC `i - 1`) THEN ANTS_TAC THENL + [ + REMOVE_THEN "i_in" MP_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (MP_TAC o SPEC `j - 1`) THEN ANTS_TAC THENL + [ + REMOVE_THEN "ldd_all" MP_TAC THEN REWRITE_TAC[GSYM ALL_EL] THEN + DISCH_THEN (new_rewrite [] []) THEN ASM_REWRITE_TAC[] THENL + [ + REMOVE_THEN "i_in" MP_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + REMOVE_THEN "j_in" MP_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + SUBGOAL_THEN `1 + j - 1 = j /\ 1 + i - 1 = i` (fun th -> REWRITE_TAC[th]) THENL + [ + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[partial2] THEN + DISCH_THEN (MP_TAC o MATCH_MP interval_arith_abs_le) THEN + DISCH_THEN MATCH_MP_TAC THEN REWRITE_TAC[REAL_LE_REFL]);; + + +let M_TAYLOR_ERROR_LIST_SUM2 = prove(`!f domain y w dd_bounds_list error. + m_cell_domain domain y (vector w) ==> + second_bounded (f:real^N->real) domain dd_bounds_list ==> + LENGTH w = dimindex (:N) ==> + LENGTH dd_bounds_list = dimindex (:N) ==> + ALL (\list. LENGTH list = dimindex (:N)) dd_bounds_list ==> + list_sum2 (error_mul_f1 w) w dd_bounds_list <= error ==> + m_taylor_error f domain (vector w) error`, + REWRITE_TAC[list_sum2; error_mul_f1; error_mul_f2; M_TAYLOR_ERROR_ITLIST2]);; + + + +(**********************************) + +let m_taylor_error_array = Array.init (max_dim + 1) + (fun i -> if i < 1 then TRUTH else + (MY_RULE_NUM o REWRITE_RULE[dimindex_array.(i)] o inst_first_type_var (n_type_array.(i))) + M_TAYLOR_ERROR_LIST_SUM2);; + + +let REFL_CONV tm = + let rhs = rand tm in + let th0 = EQT_INTRO (REFL rhs) in + th0;; + +let eval_m_taylor_error n pp m_taylor_th = + let domain_th, _, _, second_th = dest_m_taylor_thms n m_taylor_th in + let f_tm = (rand o rator o rator o concl) second_th in + let domain_tm, y_tm, w_tm = (dest_m_cell_domain o concl) domain_th in + let dd_bounds_list = (rand o concl) second_th in + let w_list = rand w_tm in + let y_var = mk_var ("y", type_of y_tm) and + f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let th0 = (MY_PROVE_HYP domain_th o MY_PROVE_HYP second_th o + INST[dd_bounds_list, dd_bounds_list_var; w_list, w_var_list; + domain_tm, domain_var; y_tm, y_var; f_tm, f_var]) m_taylor_error_array.(n) in + + let len_dd = eval_length dd_bounds_list in + let len_w = eval_length w_list in + + let th1 = (MY_PROVE_HYP len_dd o MY_PROVE_HYP len_w) th0 in + let [all_tm; sum2_tm] = hyp th1 in + let l_conv = (BETA_CONV THENC LAND_CONV length_conv THENC REFL_CONV) in + let all_len = EQT_ELIM (all_conv_univ l_conv all_tm) in + let sum2_le_th = list_sum2_le_conv pp (error_mul_f1_le_conv w_list) (lhand sum2_tm) in + let error_tm = (rand o concl) sum2_le_th in + (MY_PROVE_HYP all_len o MY_PROVE_HYP sum2_le_th o INST[error_tm, error_var]) th1;; + + +(**********************) +(* taylor_upper_bound *) + + +(* upper *) +let M_TAYLOR_UPPER_BOUND' = prove(`m_cell_domain domain (y:real^N) (vector w) /\ + diff2c_domain domain f /\ + m_lin_approx f y (f_lo, f_hi) d_bounds_list /\ + m_taylor_error f domain (vector w) error /\ + list_sum2 error_mul_f2 w d_bounds_list <= b /\ + b + inv(&2) * error <= a /\ + f_hi + a <= hi /\ + LENGTH w = dimindex (:N) /\ LENGTH d_bounds_list = dimindex (:N) ==> + (!p. p IN interval [domain] ==> f p <= hi)`, + REWRITE_TAC[m_lin_approx; interval_arith; list_sum2; error_mul_f2; ALL_N_EL] THEN + set_tac "s" `ITLIST2 _1 _2 _3 _4` THEN STRIP_TAC THEN + SUBGOAL_THEN `diff2_domain domain (f:real^N->real)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + SIMP_TAC[diff2_domain; diff2c_domain; diff2c]; + ALL_TAC + ] THEN + apply_tac m_taylor_upper_bound THEN + MAP_EVERY EXISTS_TAC [`y:real^N`; `vector w:real^N`; `error:real`; `f_hi:real`] THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `f_hi + a:real` THEN + ASM_REWRITE_TAC[real_div] THEN MATCH_MP_TAC REAL_LE_ADD2 THEN + ONCE_REWRITE_TAC[REAL_MUL_SYM] THEN ASM_REWRITE_TAC[REAL_LE_REFL] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b + inv (&2) * error` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_ADD2 THEN ASM_REWRITE_TAC[REAL_LE_REFL] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `s:real` THEN ASM_REWRITE_TAC[] THEN + EXPAND_TAC "s" THEN new_rewrite [] [] ITLIST2_EQ_SUM THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC SUM_LE THEN REWRITE_TAC[FINITE_NUMSEG] THEN REPEAT STRIP_TAC THEN + new_rewrite [] [] REAL_MUL_SYM THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN ASM_SIMP_TAC[VECTOR_COMPONENT; REAL_LE_REFL; REAL_ABS_POS] THEN + CONJ_TAC THENL + [ + UNDISCH_TAC `m_cell_domain domain (y:real^N) (vector w)` THEN + new_rewrite [] [] pair_eq THEN REWRITE_TAC[m_cell_domain] THEN + DISCH_THEN (MP_TAC o SPEC `x:num`) THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[VECTOR_COMPONENT] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x - 1`) THEN + ANTS_TAC THENL + [ + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (MP_TAC o MATCH_MP interval_arith_abs_le) THEN + SUBGOAL_THEN `1 + x - 1 = x` (fun th -> REWRITE_TAC[th]) THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN MATCH_MP_TAC THEN REWRITE_TAC[REAL_LE_REFL]);; + + +(* lower *) +let M_TAYLOR_LOWER_BOUND' = prove(`m_cell_domain domain (y:real^N) (vector w) /\ + diff2c_domain domain f /\ + m_lin_approx f y (f_lo, f_hi) d_bounds_list /\ + m_taylor_error f domain (vector w) error /\ + list_sum2 error_mul_f2 w d_bounds_list <= b /\ + b + inv(&2) * error <= a /\ + lo <= f_lo - a /\ + LENGTH w = dimindex (:N) /\ LENGTH d_bounds_list = dimindex (:N) ==> + (!p. p IN interval [domain] ==> lo <= f p)`, + REWRITE_TAC[m_lin_approx; interval_arith; list_sum2; error_mul_f2; ALL_N_EL] THEN + set_tac "s" `ITLIST2 _1 _2 _3 _4` THEN STRIP_TAC THEN + SUBGOAL_THEN `diff2_domain domain (f:real^N->real)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + SIMP_TAC[diff2_domain; diff2c_domain; diff2c]; + ALL_TAC + ] THEN + apply_tac m_taylor_lower_bound THEN + MAP_EVERY EXISTS_TAC [`y:real^N`; `vector w:real^N`; `error:real`; `f_lo:real`] THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `f_lo - a:real` THEN + ASM_REWRITE_TAC[real_div; real_sub] THEN MATCH_MP_TAC REAL_LE_ADD2 THEN + ASM_REWRITE_TAC[REAL_LE_REFL; REAL_LE_NEG] THEN + ONCE_REWRITE_TAC[REAL_MUL_SYM] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `b + inv (&2) * error` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_ADD2 THEN ASM_REWRITE_TAC[REAL_LE_REFL] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `s:real` THEN ASM_REWRITE_TAC[] THEN + EXPAND_TAC "s" THEN new_rewrite [] [] ITLIST2_EQ_SUM THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC SUM_LE THEN REWRITE_TAC[FINITE_NUMSEG] THEN REPEAT STRIP_TAC THEN + new_rewrite [] [] REAL_MUL_SYM THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN ASM_SIMP_TAC[VECTOR_COMPONENT; REAL_LE_REFL; REAL_ABS_POS] THEN + CONJ_TAC THENL + [ + UNDISCH_TAC `m_cell_domain domain (y:real^N) (vector w)` THEN + new_rewrite [] [] pair_eq THEN REWRITE_TAC[m_cell_domain] THEN + DISCH_THEN (MP_TAC o SPEC `x:num`) THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[VECTOR_COMPONENT] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x - 1`) THEN + ANTS_TAC THENL + [ + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (MP_TAC o MATCH_MP interval_arith_abs_le) THEN + SUBGOAL_THEN `1 + x - 1 = x` (fun th -> REWRITE_TAC[th]) THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN MATCH_MP_TAC THEN REWRITE_TAC[REAL_LE_REFL]);; + + +(* bound *) +let M_TAYLOR_BOUND' = + prove(`m_cell_domain domain (y:real^N) (vector w) /\ + diff2c_domain domain f /\ + m_lin_approx f y (f_lo, f_hi) d_bounds_list /\ + m_taylor_error f domain (vector w) error /\ + list_sum2 error_mul_f2 w d_bounds_list <= b /\ + b + inv(&2) * error <= a /\ + lo <= f_lo - a /\ + f_hi + a <= hi /\ + LENGTH w = dimindex (:N) /\ LENGTH d_bounds_list = dimindex (:N) ==> + (!x. x IN interval [domain] ==> interval_arith (f x) (lo, hi))`, + REPEAT STRIP_TAC THEN REWRITE_TAC[interval_arith] THEN + MP_TAC M_TAYLOR_UPPER_BOUND' THEN + MP_TAC M_TAYLOR_LOWER_BOUND' THEN + ASM_REWRITE_TAC[] THEN + REPEAT (DISCH_THEN (MP_TAC o SPEC `x:real^N`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC));; + + + +(* arrays *) + +let m_taylor_upper_array = Array.init (max_dim + 1) + (fun i -> if i < 1 then TRUTH else + (MY_RULE_NUM o REWRITE_RULE[dimindex_array.(i); float_inv2_th] o inst_first_type_var (n_type_array.(i))) + M_TAYLOR_UPPER_BOUND');; + + +let m_taylor_lower_array = Array.init (max_dim + 1) + (fun i -> if i < 1 then TRUTH else + (MY_RULE_NUM o REWRITE_RULE[dimindex_array.(i); float_inv2_th] o inst_first_type_var (n_type_array.(i))) + M_TAYLOR_LOWER_BOUND');; + + +let m_taylor_bound_array = Array.init (max_dim + 1) + (fun i -> if i < 1 then TRUTH else + (MY_RULE_NUM o REWRITE_RULE[dimindex_array.(i); float_inv2_th] o inst_first_type_var (n_type_array.(i))) + M_TAYLOR_BOUND');; + + + +(* upper *) +let b_var_real = `b:real`;; + +let eval_m_taylor_upper_bound n pp m_taylor_th = + let domain_th, diff_th, lin_th, _ = dest_m_taylor_thms n m_taylor_th in + let error_th = eval_m_taylor_error n pp m_taylor_th in + + let f_tm, _, f_bounds, d_bounds_list = dest_lin_approx (concl lin_th) and + domain_tm, y_tm, w_tm = (dest_m_cell_domain o concl) domain_th and + error_tm = (rand o concl) error_th in + let w_list = rand w_tm and + f_lo, f_hi = dest_pair f_bounds in + + let y_var = mk_var ("y", type_of y_tm) and + f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let th0 = (MY_PROVE_HYP domain_th o MY_PROVE_HYP diff_th o + MY_PROVE_HYP lin_th o MY_PROVE_HYP error_th o + INST[d_bounds_list, d_bounds_list_var; w_list, w_var_list; + f_lo, f_lo_var; f_hi, f_hi_var; error_tm, error_var; + domain_tm, domain_var; y_tm, y_var; f_tm, f_var]) m_taylor_upper_array.(n) in + + let len_d_th = eval_length d_bounds_list and + len_w_th = eval_length w_list in + let th1 = (MY_PROVE_HYP len_d_th o MY_PROVE_HYP len_w_th) th0 in + + let sum2_tm = (C List.nth 2 o hyp) th1 in + let sum2_le_th = list_sum2_le_conv pp error_mul_f2_le_conv2 (lhand sum2_tm) in + let b_tm = (rand o concl) sum2_le_th in + + let ineq1_th = + let ( * ), ( + ) = float_mul_hi pp, add_ineq_hi pp in + mk_refl_ineq b_tm + float_inv2 * error_tm in + + let a_tm = (rand o concl) ineq1_th in + let ineq2_th = float_add_hi pp f_hi a_tm in + let hi_tm = (rand o concl) ineq2_th in + (MY_PROVE_HYP ineq2_th o MY_PROVE_HYP ineq1_th o MY_PROVE_HYP sum2_le_th o + INST[a_tm, a_var_real; b_tm, b_var_real; hi_tm, hi_var_real]) th1;; + + +(* lower *) +let eval_m_taylor_lower_bound n pp m_taylor_th = + let domain_th, diff_th, lin_th, _ = dest_m_taylor_thms n m_taylor_th in + let error_th = eval_m_taylor_error n pp m_taylor_th in + + let f_tm, _, f_bounds, d_bounds_list = dest_lin_approx (concl lin_th) and + domain_tm, y_tm, w_tm = (dest_m_cell_domain o concl) domain_th and + error_tm = (rand o concl) error_th in + let w_list = rand w_tm and + f_lo, f_hi = dest_pair f_bounds in + + let y_var = mk_var ("y", type_of y_tm) and + f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let th0 = (MY_PROVE_HYP domain_th o MY_PROVE_HYP diff_th o + MY_PROVE_HYP lin_th o MY_PROVE_HYP error_th o + INST[d_bounds_list, d_bounds_list_var; w_list, w_var_list; + f_lo, f_lo_var; f_hi, f_hi_var; error_tm, error_var; + domain_tm, domain_var; y_tm, y_var; f_tm, f_var]) m_taylor_lower_array.(n) in + + let len_d_th = eval_length d_bounds_list and + len_w_th = eval_length w_list in + let th1 = (MY_PROVE_HYP len_d_th o MY_PROVE_HYP len_w_th) th0 in + + let sum2_tm = (C List.nth 2 o hyp) th1 in + let sum2_le_th = list_sum2_le_conv pp error_mul_f2_le_conv2 (lhand sum2_tm) in + let b_tm = (rand o concl) sum2_le_th in + + let ineq1_th = + let ( * ), ( + ) = float_mul_hi pp, add_ineq_hi pp in + mk_refl_ineq b_tm + float_inv2 * error_tm in + + let a_tm = (rand o concl) ineq1_th in + let ineq2_th = float_sub_lo pp f_lo a_tm in + let lo_tm = (lhand o concl) ineq2_th in + + (MY_PROVE_HYP ineq2_th o MY_PROVE_HYP ineq1_th o MY_PROVE_HYP sum2_le_th o + INST[a_tm, a_var_real; b_tm, b_var_real; lo_tm, lo_var_real]) th1;; + + + +(* bound *) +let eval_m_taylor_bound n pp m_taylor_th = + let domain_th, diff_th, lin_th, _ = dest_m_taylor_thms n m_taylor_th in + let error_th = eval_m_taylor_error n pp m_taylor_th in + + let f_tm, _, f_bounds, d_bounds_list = dest_lin_approx (concl lin_th) and + domain_tm, y_tm, w_tm = (dest_m_cell_domain o concl) domain_th and + error_tm = (rand o concl) error_th in + let w_list = rand w_tm and + f_lo, f_hi = dest_pair f_bounds in + + let y_var = mk_var ("y", type_of y_tm) and + f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let th0 = (MY_PROVE_HYP domain_th o MY_PROVE_HYP diff_th o + MY_PROVE_HYP lin_th o MY_PROVE_HYP error_th o + INST[d_bounds_list, d_bounds_list_var; w_list, w_var_list; + f_lo, f_lo_var; f_hi, f_hi_var; error_tm, error_var; + domain_tm, domain_var; y_tm, y_var; f_tm, f_var]) m_taylor_bound_array.(n) in + + let len_d_th = eval_length d_bounds_list and + len_w_th = eval_length w_list in + let th1 = (MY_PROVE_HYP len_d_th o MY_PROVE_HYP len_w_th) th0 in + + let sum2_tm = (C List.nth 3 o hyp) th1 in + let sum2_le_th = list_sum2_le_conv pp error_mul_f2_le_conv2 (lhand sum2_tm) in + let b_tm = (rand o concl) sum2_le_th in + + let ineq1_th = + let ( * ), ( + ) = float_mul_hi pp, add_ineq_hi pp in + mk_refl_ineq b_tm + float_inv2 * error_tm in + + let a_tm = (rand o concl) ineq1_th in + let ineq2_th = float_add_hi pp f_hi a_tm in + let hi_tm = (rand o concl) ineq2_th in + + let ineq3_th = float_sub_lo pp f_lo a_tm in + let lo_tm = (lhand o concl) ineq3_th in + + (MY_PROVE_HYP ineq3_th o MY_PROVE_HYP ineq2_th o + MY_PROVE_HYP ineq1_th o MY_PROVE_HYP sum2_le_th o + INST[a_tm, a_var_real; b_tm, b_var_real; hi_tm, hi_var_real; lo_tm, lo_var_real]) th1;; + +(******************************) +(* taylor_upper_partial_bound *) +(* taylor_lower_partial_bound *) + + +(* upper *) +let M_TAYLOR_UPPER_PARTIAL_BOUND' = + prove(`m_taylor_interval f domain (y:real^N) (vector w) f_bounds d_bounds_list dd_bounds_list /\ + i IN 1..dimindex (:N) /\ + EL (i - 1) d_bounds_list = (df_lo, df_hi) /\ + EL (i - 1) dd_bounds_list = dd_list /\ + LENGTH d_bounds_list = dimindex (:N) /\ + LENGTH dd_bounds_list = dimindex (:N) /\ + LENGTH dd_list = dimindex (:N) /\ LENGTH w = dimindex (:N) /\ + list_sum2 error_mul_f2 w dd_list <= error /\ + df_hi + error <= hi ==> + (!p. p IN interval [domain] ==> partial i f p <= hi)`, + REWRITE_TAC[m_taylor_interval; m_lin_approx; second_bounded; ALL_N_EL] THEN STRIP_TAC THEN + SUBGOAL_THEN `1 <= i /\ i <= dimindex (:N)` (LABEL_TAC "i_in") THENL + [ + ASM_REWRITE_TAC[GSYM IN_NUMSEG]; + ALL_TAC + ] THEN + SUBGOAL_THEN `diff2_domain domain (f:real^N->real)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + SIMP_TAC[diff2_domain; diff2c_domain; diff2c]; + ALL_TAC + ] THEN + apply_tac m_taylor_upper_partial_bound THEN + MAP_EVERY EXISTS_TAC [`y:real^N`; `vector w:real^N`; `error:real`; `df_hi:real`] THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i - 1`) THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= i /\ i <= n ==> i - 1 < n`] THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= i ==> 1 + i - 1 = i`; interval_arith] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + REWRITE_TAC[m_taylor_partial_error] THEN REPEAT STRIP_TAC THEN + UNDISCH_TAC `list_sum2 error_mul_f2 w dd_list <= error` THEN + REWRITE_TAC[list_sum2; error_mul_f2] THEN + MATCH_MP_TAC (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS) THEN + new_rewrite [] [] ITLIST2_EQ_SUM THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC SUM_LE THEN REWRITE_TAC[FINITE_NUMSEG] THEN + move ["j"; "j_in"] THEN + ASM_SIMP_TAC[VECTOR_COMPONENT] THEN + MATCH_MP_TAC REAL_LE_LMUL THEN CONJ_TAC THENL + [ + UNDISCH_TAC `m_cell_domain domain (y:real^N) (vector w)` THEN + new_rewrite [] [] pair_eq THEN REWRITE_TAC[m_cell_domain] THEN + DISCH_THEN (MP_TAC o SPEC `j:num`) THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[VECTOR_COMPONENT] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:real^N`) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `i - 1`) THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= i /\ i <= n ==> i - 1 < n`] THEN + DISCH_THEN (MP_TAC o SPEC `j - 1`) THEN + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN DISCH_TAC THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= j /\ j <= n ==> j - 1 < n`] THEN + ASM_SIMP_TAC[ARITH_RULE `!i. 1 <= i ==> 1 + i - 1 = i`; GSYM partial2] THEN + DISCH_THEN (MP_TAC o MATCH_MP interval_arith_abs_le) THEN + DISCH_THEN MATCH_MP_TAC THEN REWRITE_TAC[REAL_LE_REFL]);; + + +(* lower *) +let M_TAYLOR_LOWER_PARTIAL_BOUND' = + prove(`m_taylor_interval f domain (y:real^N) (vector w) f_bounds d_bounds_list dd_bounds_list /\ + i IN 1..dimindex (:N) /\ + EL (i - 1) d_bounds_list = (df_lo, df_hi) /\ + EL (i - 1) dd_bounds_list = dd_list /\ + LENGTH d_bounds_list = dimindex (:N) /\ + LENGTH dd_bounds_list = dimindex (:N) /\ + LENGTH dd_list = dimindex (:N) /\ LENGTH w = dimindex (:N) /\ + list_sum2 error_mul_f2 w dd_list <= error /\ + lo <= df_lo - error ==> + (!p. p IN interval [domain] ==> lo <= partial i f p)`, + REWRITE_TAC[m_taylor_interval; m_lin_approx; second_bounded; ALL_N_EL] THEN STRIP_TAC THEN + SUBGOAL_THEN `1 <= i /\ i <= dimindex (:N)` (LABEL_TAC "i_in") THENL + [ + ASM_REWRITE_TAC[GSYM IN_NUMSEG]; + ALL_TAC + ] THEN + SUBGOAL_THEN `diff2_domain domain (f:real^N->real)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + SIMP_TAC[diff2_domain; diff2c_domain; diff2c]; + ALL_TAC + ] THEN + apply_tac m_taylor_lower_partial_bound THEN + MAP_EVERY EXISTS_TAC [`y:real^N`; `vector w:real^N`; `error:real`; `df_lo:real`] THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i - 1`) THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= i /\ i <= n ==> i - 1 < n`] THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= i ==> 1 + i - 1 = i`; interval_arith] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + REWRITE_TAC[m_taylor_partial_error] THEN REPEAT STRIP_TAC THEN + UNDISCH_TAC `list_sum2 error_mul_f2 w dd_list <= error` THEN + REWRITE_TAC[list_sum2; error_mul_f2] THEN + MATCH_MP_TAC (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS) THEN + new_rewrite [] [] ITLIST2_EQ_SUM THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC SUM_LE THEN REWRITE_TAC[FINITE_NUMSEG] THEN + move ["j"; "j_in"] THEN + ASM_SIMP_TAC[VECTOR_COMPONENT] THEN + MATCH_MP_TAC REAL_LE_LMUL THEN CONJ_TAC THENL + [ + UNDISCH_TAC `m_cell_domain domain (y:real^N) (vector w)` THEN + new_rewrite [] [] pair_eq THEN REWRITE_TAC[m_cell_domain] THEN + DISCH_THEN (MP_TAC o SPEC `j:num`) THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[VECTOR_COMPONENT] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:real^N`) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `i - 1`) THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= i /\ i <= n ==> i - 1 < n`] THEN + DISCH_THEN (MP_TAC o SPEC `j - 1`) THEN + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN DISCH_TAC THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= j /\ j <= n ==> j - 1 < n`] THEN + ASM_SIMP_TAC[ARITH_RULE `!i. 1 <= i ==> 1 + i - 1 = i`; GSYM partial2] THEN + DISCH_THEN (MP_TAC o MATCH_MP interval_arith_abs_le) THEN + DISCH_THEN MATCH_MP_TAC THEN REWRITE_TAC[REAL_LE_REFL]);; + + +let M_TAYLOR_PARTIAL_BOUND' = + prove(`m_taylor_interval f domain (y:real^N) (vector w) f_bounds d_bounds_list dd_bounds_list /\ + i IN 1..dimindex (:N) /\ + EL (i - 1) d_bounds_list = (df_lo, df_hi) /\ + EL (i - 1) dd_bounds_list = dd_list /\ + LENGTH d_bounds_list = dimindex (:N) /\ + LENGTH dd_bounds_list = dimindex (:N) /\ + LENGTH dd_list = dimindex (:N) /\ LENGTH w = dimindex (:N) /\ + list_sum2 error_mul_f2 w dd_list <= error /\ + df_hi + error <= hi ==> + lo <= df_lo - error ==> + (!x. x IN interval [domain] ==> interval_arith (partial i f x) (lo, hi))`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[interval_arith] THEN + MP_TAC M_TAYLOR_UPPER_PARTIAL_BOUND' THEN + MP_TAC M_TAYLOR_LOWER_PARTIAL_BOUND' THEN + ASM_REWRITE_TAC[] THEN + REPEAT (DISCH_THEN (MP_TAC o SPEC `x:real^N`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC));; + + + +(* The (n, i)-th element is the theorem |- i IN 1..dimindex (:n) *) +let i_in_array = Array.init (max_dim + 1) + (fun i -> Array.init (i + 1) + (fun j -> + if j < 1 then TRUTH else + let j_tm = mk_small_numeral j in + let tm0 = `j IN 1..dimindex (:N)` in + let tm1 = (subst [j_tm, `j:num`] o inst [n_type_array.(i), nty]) tm0 in + prove(tm1, REWRITE_TAC[dimindex_array.(i); IN_NUMSEG] THEN ARITH_TAC)));; + + +let m_taylor_upper_partial_array = Array.init (max_dim + 1) + (fun i -> Array.init (i + 1) + (fun j -> + if j < 1 then TRUTH else + let j_tm = mk_small_numeral j in + (MY_RULE_NUM o CONV_RULE NUM_REDUCE_CONV o REWRITE_RULE[dimindex_array.(i); IN_NUMSEG] o + INST[j_tm, `i:num`] o inst_first_type_var n_type_array.(i)) + M_TAYLOR_UPPER_PARTIAL_BOUND'));; + + +let m_taylor_lower_partial_array = Array.init (max_dim + 1) + (fun i -> Array.init (i + 1) + (fun j -> + if j < 1 then TRUTH else + let j_tm = mk_small_numeral j in + (MY_RULE_NUM o CONV_RULE NUM_REDUCE_CONV o REWRITE_RULE[dimindex_array.(i); IN_NUMSEG] o + INST[j_tm, `i:num`] o inst_first_type_var n_type_array.(i)) + M_TAYLOR_LOWER_PARTIAL_BOUND'));; + +let m_taylor_interval_partial_array = Array.init (max_dim + 1) + (fun i -> Array.init (i + 1) + (fun j -> + if j < 1 then TRUTH else + let j_tm = mk_small_numeral j in + (MY_RULE_NUM o CONV_RULE NUM_REDUCE_CONV o REWRITE_RULE[dimindex_array.(i); IN_NUMSEG] o + INST[j_tm, `i:num`] o inst_first_type_var n_type_array.(i)) + M_TAYLOR_PARTIAL_BOUND'));; + + +(* upper_partial *) +let eval_m_taylor_upper_partial n pp i m_taylor_th = + let f_tm, domain_tm, y_tm, w_tm, f_bounds, d_bounds_list, dd_bounds_list = + dest_m_taylor (concl m_taylor_th) in + let w_list = rand w_tm in + let y_var = mk_var ("y", type_of y_tm) and + f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let th0 = (MY_PROVE_HYP m_taylor_th o + INST[dd_bounds_list, dd_bounds_list_var; d_bounds_list, d_bounds_list_var; + w_list, w_var_list; f_bounds, f_bounds_var; + domain_tm, domain_var; y_tm, y_var; f_tm, f_var]) m_taylor_upper_partial_array.(n).(i) in + + let el_dd_list_tm = (hd o hyp) th0 in + let dd_list_th = el_conv (lhand el_dd_list_tm) in + let dd_list_tm = (rand o concl) dd_list_th in + + let len_dd_list_th = eval_length dd_list_tm and + len_dd_th = eval_length dd_bounds_list and + len_d_th = eval_length d_bounds_list and + len_w_th = eval_length w_list in + let th1 = (MY_PROVE_HYP len_dd_list_th o MY_PROVE_HYP len_dd_th o MY_PROVE_HYP len_d_th o + MY_PROVE_HYP len_w_th o MY_PROVE_HYP dd_list_th o + INST[dd_list_tm, dd_list_var]) th0 in + + let el_d_list_tm = (hd o hyp) th1 in + let d_list_th = el_conv (lhand el_d_list_tm) in + let df_lo, df_hi = (dest_pair o rand o concl) d_list_th in + let th2 = (MY_PROVE_HYP d_list_th o INST[df_lo, df_lo_var; df_hi, df_hi_var]) th1 in + + let sum2_tm = (C List.nth 1 o hyp) th2 in + let sum2_le_th = list_sum2_le_conv pp error_mul_f2_le_conv2 (lhand sum2_tm) in + let error_tm = (rand o concl) sum2_le_th in + + let ineq1_th = float_add_hi pp df_hi error_tm in + let hi_tm = (rand o concl) ineq1_th in + (MY_PROVE_HYP ineq1_th o MY_PROVE_HYP sum2_le_th o + INST[error_tm, error_var; hi_tm, hi_var_real]) th2;; + + +(* lower_partial *) +let eval_m_taylor_lower_partial n pp i m_taylor_th = + let f_tm, domain_tm, y_tm, w_tm, f_bounds, d_bounds_list, dd_bounds_list = + dest_m_taylor (concl m_taylor_th) in + let w_list = rand w_tm in + let y_var = mk_var ("y", type_of y_tm) and + f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let th0 = (MY_PROVE_HYP m_taylor_th o + INST[dd_bounds_list, dd_bounds_list_var; d_bounds_list, d_bounds_list_var; + w_list, w_var_list; f_bounds, f_bounds_var; + domain_tm, domain_var; y_tm, y_var; f_tm, f_var]) m_taylor_lower_partial_array.(n).(i) in + + let el_dd_list_tm = (hd o hyp) th0 in + let dd_list_th = el_conv (lhand el_dd_list_tm) in + let dd_list_tm = (rand o concl) dd_list_th in + + let len_dd_list_th = eval_length dd_list_tm and + len_dd_th = eval_length dd_bounds_list and + len_d_th = eval_length d_bounds_list and + len_w_th = eval_length w_list in + let th1 = (MY_PROVE_HYP len_dd_list_th o MY_PROVE_HYP len_dd_th o MY_PROVE_HYP len_d_th o + MY_PROVE_HYP len_w_th o MY_PROVE_HYP dd_list_th o + INST[dd_list_tm, dd_list_var]) th0 in + + let el_d_list_tm = (hd o hyp) th1 in + let d_list_th = el_conv (lhand el_d_list_tm) in + let df_lo, df_hi = (dest_pair o rand o concl) d_list_th in + let th2 = (MY_PROVE_HYP d_list_th o INST[df_lo, df_lo_var; df_hi, df_hi_var]) th1 in + + let sum2_tm = (C List.nth 1 o hyp) th2 in + let sum2_le_th = list_sum2_le_conv pp error_mul_f2_le_conv2 (lhand sum2_tm) in + let error_tm = (rand o concl) sum2_le_th in + + let ineq1_th = float_sub_lo pp df_lo error_tm in + let lo_tm = (lhand o concl) ineq1_th in + (MY_PROVE_HYP ineq1_th o MY_PROVE_HYP sum2_le_th o + INST[error_tm, error_var; lo_tm, lo_var_real]) th2;; + + +(* interval_partial *) +let eval_m_taylor_interval_partial n pp i m_taylor_th = + let f_tm, domain_tm, y_tm, w_tm, f_bounds, d_bounds_list, dd_bounds_list = + dest_m_taylor (concl m_taylor_th) in + let w_list = rand w_tm in + let y_var = mk_var ("y", type_of y_tm) and + f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let th0 = (MY_PROVE_HYP m_taylor_th o + INST[dd_bounds_list, dd_bounds_list_var; d_bounds_list, d_bounds_list_var; + w_list, w_var_list; f_bounds, f_bounds_var; + domain_tm, domain_var; y_tm, y_var; f_tm, f_var]) m_taylor_interval_partial_array.(n).(i) in + + let el_dd_list_tm = (hd o hyp) th0 in + let dd_list_th = el_conv (lhand el_dd_list_tm) in + let dd_list_tm = (rand o concl) dd_list_th in + + let len_dd_list_th = eval_length dd_list_tm and + len_dd_th = eval_length dd_bounds_list and + len_d_th = eval_length d_bounds_list and + len_w_th = eval_length w_list in + let th1 = (MY_PROVE_HYP len_dd_list_th o MY_PROVE_HYP len_dd_th o MY_PROVE_HYP len_d_th o + MY_PROVE_HYP len_w_th o MY_PROVE_HYP dd_list_th o + INST[dd_list_tm, dd_list_var]) th0 in + + let el_d_list_tm = (hd o hyp) th1 in + let d_list_th = el_conv (lhand el_d_list_tm) in + let df_lo, df_hi = (dest_pair o rand o concl) d_list_th in + let th2 = (MY_PROVE_HYP d_list_th o INST[df_lo, df_lo_var; df_hi, df_hi_var]) th1 in + + let sum2_tm = (C List.nth 2 o hyp) th2 in + let sum2_le_th = list_sum2_le_conv pp error_mul_f2_le_conv2 (lhand sum2_tm) in + let error_tm = (rand o concl) sum2_le_th in + + let ineq1_th = float_sub_lo pp df_lo error_tm in + let lo_tm = (lhand o concl) ineq1_th in + let ineq2_th = float_add_hi pp df_hi error_tm in + let hi_tm = (rand o concl) ineq2_th in + (MY_PROVE_HYP ineq1_th o MY_PROVE_HYP ineq2_th o MY_PROVE_HYP sum2_le_th o + INST[error_tm, error_var; lo_tm, lo_var_real; hi_tm, hi_var_real]) th2;; + + + +end;; \ No newline at end of file diff --git a/formal_lp/old/formal_interval/m_test.hl b/formal_lp/old/formal_interval/m_test.hl new file mode 100644 index 0000000..d5a9367 --- /dev/null +++ b/formal_lp/old/formal_interval/m_test.hl @@ -0,0 +1,183 @@ +let pp = 10 and + n = 8 and + xx = `[-- #0.1; #0.4; -- #0.7; -- #0.7; #0.1; -- #0.1; -- #0.3; -- #1.1]` and + zz = `[#0.4; &1; -- #0.4; #0.4; #0.2; #0.2; #1.1; -- #0.3]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +(* let eval_heart, tf_heart = mk_verification_functions pp heart_poly true heart_min;; *) +let certificate = run_test tf_heart xx_float zz_float false 0.0 true false;; +result_size certificate;; +m_verify_raw n pp eval_heart certificate xx1 zz1;; +m_verify_raw_old n pp eval_heart certificate xx1 zz1;; + + + + +let m_verify_raw n pp eval_taylor certificate xx zz = + let r_size = result_size certificate in + let k = ref 0 in + let domain_th = mk_m_center_domain n pp xx zz in + + + let rec rec_verify = + let rec apply_trans sub_ths th0 acc = + match sub_ths with + | [] -> rev acc + | th :: ths -> + let th' = eval_subset_trans th th0 in + apply_trans ths th' (th' :: acc) in + + let rec mk_domains mono th0 acc = + match mono with + | [] -> rev acc + | j :: js -> + let j, flag = if j < 0 then (-j), true else j, false in + let ths = restrict_domain n j flag th0 in + mk_domains js (fst ths) (ths :: acc) in + + + let verify_mono mono domain_th certificate = + let taylor_th = eval_taylor domain_th in + let _, diff2_th, _, _ = dest_m_taylor_thms n taylor_th in + let domain_ths = mk_domains mono domain_th [] in + + let mono_ths = map (fun j -> if j < 0 then + eval_m_taylor_upper_partial n pp (-j) taylor_th else + eval_m_taylor_lower_partial n pp j taylor_th) mono in + let _ = map (fun i -> + let j = List.nth mono (i - 1) and + th = List.nth mono_ths (i - 1) in + let f = if j < 0 then rand else lhand in + (string_of_term o f o rand o snd o dest_forall o concl) th) (1--(length mono)) in + + let pass_th0 = rec_verify ((fst o last) domain_ths) certificate in + let sub_th0 = (eval_subset_refl o rand o concl o snd o hd) domain_ths in + let sub_ths = apply_trans (sub_th0 :: map snd (butlast domain_ths)) sub_th0 [] in + let th = rev_itlist (fun ((j, mono_th), sub_th) pass_th -> + let j, flag = if j < 0 then (-j), true else j, false in + m_mono_pass_gen n j flag diff2_th mono_th sub_th pass_th) + (rev (zip (zip mono mono_ths) sub_ths)) pass_th0 in + if hyp th <> [] then failwith ("hyp <> []: "^string_of_thm th) else th in + + + + + fun domain_th certificate -> + match certificate with + | Result_pass (mono, xx, zz) -> + if mono = [] then + let _ = k := !k + 1 in + let _ = report (sprintf "Verifying: %d/%d" !k r_size) in + let taylor_th = eval_taylor domain_th in + m_taylor_cell_pass n pp taylor_th + else + let _ = report (sprintf "Mono: [%s]" (String.concat ";" (map string_of_int (hd mono)))) in + verify_mono (hd mono) domain_th (Result_pass (tl mono, xx, zz)) + + | Result_glue (mono, i, r1, r2) -> + let _ = report "Result_glue" in + if mono = [] then + let domain1_th, domain2_th = split_domain n pp (i + 1) domain_th in + let th1 = rec_verify domain1_th r1 in + let th2 = rec_verify domain2_th r2 in + m_glue_cells n (i + 1) th1 th2 + else + let _ = report (sprintf "GlueMono: [%s]" (String.concat ";" (map string_of_int (hd mono)))) in + verify_mono (hd mono) domain_th (Result_glue (tl mono, i, r1, r2)) + + | _ -> failwith "False result" in + + rec_verify domain_th certificate;; + + +m_verify_raw_old n pp eval_heart certificate xx1 zz1;; +m_verify_raw n pp eval_heart certificate xx1 zz1;; + + + +let rec test_computations tf x z certificate = + let rec mono_test mono ti x z = + match mono with + | [] -> x,z + | j :: js -> + let bound = if j < 0 then upper_partial ti (-j - 1) else lower_partial ti (j - 1) in + let setj u = + if j < 0 then + table (fun i -> (if i=j then mth x j else mth u i)) + else + table (fun i -> (if i=j then mth z j else mth u i)) in + + let _ = report (sprintf "j = %d, bound = %f" j bound) in + mono_test js ti (setj x) (setj z) in + + + match certificate with + | Result_pass (mono, _, _) -> + let _ = report (sprintf "Pass: |mono| = %d" (length mono)) in + let ti = evalf tf x z in + let x,z = mono_test mono ti x z in + + let ti = evalf tf x z in + let bound = upper_bound ti in + report (sprintf "bound = %f" bound) + | Result_glue (mono, j, r1, r2) -> + let _ = report (sprintf "Glue: |mono| = %d" (length mono)) in + let ( ++ ), ( / ) = up(); upadd, updiv in + let yj = (mth x j ++ mth z j) / 2.0 in + let delta b v = table (fun i -> if (i = j && b) then yj else mth v i) in + let _ = test_computations tf (delta false x) (delta true z) r1 in + let _ = test_computations tf (delta true x) (delta false z) r2 in + ();; + + +test_computations tf_heart xx_float zz_float certificate;; + + + +(***) + + +let rec apply_trans sub_ths th0 acc = + match sub_ths with + | [] -> rev acc + | th :: ths -> + let th' = eval_subset_trans th th0 in + apply_trans ths th' (th' :: acc);; + +let rec mk_domains mono th0 acc = + match mono with + | [] -> rev acc + | j :: js -> + let j, flag = if j < 0 then (-j), true else j, false in + let ths = restrict_domain n j flag th0 in + mk_domains js (fst ths) (ths :: acc);; + + +let mono = [-1;-2] and domain_th = mk_m_center_domain n pp xx1 zz1;; + +let verify_mono mono domain_th certificate = 0;; +let taylor_th = eval_taylor domain_th;; +let _, diff2_th, _, _ = dest_m_taylor_thms n taylor_th;; +let domain_ths = mk_domains mono domain_th [];; + +let mono_ths = map (fun j -> if j < 0 then + eval_m_taylor_upper_partial n pp (-j) taylor_th else + eval_m_taylor_lower_partial n pp j taylor_th) mono;; + +let domain0 = (fst o last) domain_ths;; +let taylor0 = eval_taylor domain0;; +let pass_th0 = m_taylor_cell_pass n pp taylor0;; + +let sub_th0 = (eval_subset_refl o rand o concl o snd o hd) domain_ths;; +let sub_ths = apply_trans (sub_th0 :: map snd (butlast domain_ths)) sub_th0 [];; +zip (zip mono mono_ths) sub_ths;; + +rev_itlist (fun ((j, mono_th), sub_th) pass_th -> + let j, flag = if j < 0 then (-j), true else j, false in + m_mono_pass_gen n j flag diff2_th mono_th sub_th pass_th) + (rev (zip (zip mono mono_ths) sub_ths)) pass_th0;; + diff --git a/formal_lp/old/formal_interval/m_tests.hl b/formal_lp/old/formal_interval/m_tests.hl new file mode 100644 index 0000000..c3e3a70 --- /dev/null +++ b/formal_lp/old/formal_interval/m_tests.hl @@ -0,0 +1,588 @@ +flyspeck_needs "../formal_lp/formal_interval/m_verifier.hl";; + + +let reset_all () = + Arith_cache.reset_stat(); + Arith_cache.reset_cache(); + Arith_float.reset_stat(); + Arith_float.reset_cache();; + + +(**************************) +(* Examples *) +let schwefel_poly = expr_to_vector_fun `(x1 - x2 pow 2) pow 2 + (x2 - &1) pow 2 + + (x1 - x3 pow 2) pow 2 + (x3 - &1) pow 2`;; +let rd_poly = expr_to_vector_fun `-- x1 + &2 * x2 - x3 - #0.835634534 * x2 * (&1 + x2)`;; +let caprasse_poly = expr_to_vector_fun `-- x1 * x3 pow 3 + &4 * x2 * x3 pow 2 * x4 + + &4 * x1 * x3 * x4 pow 2 + &2 * x2 * x4 pow 3 + &4 * x1 * x3 + &4 * x3 pow 2 - + &10 * x2 * x4 - &10 * x4 pow 2 + &2`;; +let lv_poly = expr_to_vector_fun `x1 * x2 pow 2 + x1 * x3 pow 2 + x1 * x4 pow 2 - #1.1 * x1 + &1`;; +let butcher_poly = expr_to_vector_fun `x6 * x2 pow 2 + x5 * x3 pow 2 - x1 * x4 pow 2 + x4 pow 2 - + &1 / &3 * x1 + &4 / &3 * x4`;; +let magnetism_poly = expr_to_vector_fun `x1 pow 2 + &2 * x2 pow 2 + &2 * x3 pow 2 + &2 * x4 pow 2 + + &2 * x5 pow 2 + &2 * x6 pow 2 + &2 * x7 pow 2 - x1`;; +let heart_poly = expr_to_vector_fun `-- x1 * x6 pow 3 + &3 * x1 * x6 * x7 pow 2 - x3 * x7 pow 3 + + &3 * x3 * x7 * x6 pow 2 - x2 * x5 pow 3 + &3 * x2 * x5 * x8 pow 2 - x4 * x8 pow 3 + + &3 * x4 * x8 * x5 pow 2 - #0.9563453`;; + + +let schwefel_min = `-- #0.00000000058806` and + rd_min = `-- #36.7126907` and + caprasse_min = `-- #3.1801` and + lv_min = `-- #20.801` and + butcher_min = `-- #1.44` and + magnetism_min = `-- #0.25001` and + heart_min = `-- #1.7435`;; + +let schwefel_dom = `[-- &10; -- &10; -- &10]`, `[&10; &10; &10]`;; +let rd_dom = `[-- &5; -- &5; -- &5]`, `[&5; &5; &5]`;; +let caprasse_dom = `[-- #0.5; -- #0.5; -- #0.5; -- #0.5]`, `[#0.5; #0.5; #0.5; #0.5]`;; +let lv_dom = `[-- &2; -- &2; -- &2; -- &2]`, `[&2; &2; &2; &2]`;; +let butcher_dom = `[-- &1; -- #0.1; -- #0.1; -- &1; -- #0.1; -- #0.1]`, + `[&0; #0.9; #0.5; -- #0.1; -- #0.05; -- #0.03]`;; +let magnetism_dom = `[-- &1; -- &1; -- &1; -- &1; -- &1; -- &1; -- &1]`, + `[&1; &1; &1; &1; &1; &1; &1]`;; +let heart_dom = `[-- #0.1; #0.4; -- #0.7; -- #0.7; #0.1; -- #0.1; -- #0.3; -- #1.1]`, + `[#0.4; &1; -- #0.4; #0.4; #0.2; #0.2; #1.1; -- #0.3]`;; + + + +(****************) +let delta_x_poly = + let tm = (rand o concl o SPEC_ALL) Sphere.delta_x in + expr_to_vector_fun tm;; + +let delta_y_poly = + let tm = (rand o concl o SPEC_ALL o REWRITE_RULE[Sphere.delta_x]) Sphere.delta_y in + expr_to_vector_fun tm;; + +let delta_x4_poly = + let tm = (rand o concl o SPEC_ALL) Sphere.delta_x4 in + expr_to_vector_fun tm;; + + +let delta_x4_dom = `[&4;&4;&4;&4;&4;&8]`, `[#6.3504;#6.3504;#6.3504;#6.3504;#6.3504;#25.4016]`;; +let delta_x_dom = `[&4;&4;&4;&4;&4;&4]`, `[#6.3504;#6.3504;#6.3504;#6.3504;#6.3504;#6.3504]`;; +let delta_y_dom = `[&2;&2;&2;&2;&2;&2]`, `[#2.52;#2.52;#2.52;#2.52;#2.52;#2.52]`;; + + + +(***********************************) + +let test_verify pp poly_tm min_flag val_tm (xx,zz) eps = + let total_start = Sys.time() in + let n = (get_dim o fst o dest_abs) poly_tm in + let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz in + let xx2 = Informal_taylor.convert_to_float_list pp true xx and + zz2 = Informal_taylor.convert_to_float_list pp false zz in + let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1) in + let eval_fs, tf, ti = mk_verification_functions pp poly_tm min_flag val_tm in + let certificate = run_test tf xx_float zz_float false 0.0 true true true true eps in + let c1 = transform_result xx_float zz_float certificate in + let c1p = Informal_verifier.m_verify_list pp 1 pp ti c1 xx2 zz2 in + let start = Sys.time() in + let result = m_p_verify_list n pp eval_fs c1p xx1 zz1 in + let finish = Sys.time() in + let _ = report + (sprintf "Total time: %f; Verification time: %f" (finish -. total_start) (finish -. start)) in + result;; + + +(******) + +let pp = 5;; + +let n = 2;; +let poly_tm = expr_to_vector_fun `x1 pow 3 + x2`;; + +let xx = `[-- &1; &0]` and zz = `[&1; &1]`;; +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; + +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +let eval_fs, tf, ti = mk_verification_functions pp poly_tm true `-- #1.1`;; +let certificate = run_test tf xx_float zz_float false 0.0 true false false false 0.0;; +let c1 = transform_result xx_float zz_float certificate;; +(* 5 *) +result_size certificate;; + +m_verify_list n pp eval_fs c1 xx1 zz1;; + +let c0 = run_test0 tf xx_float zz_float false 0.0 false false false 0.0;; +(* 7 *) +result_size c0;; +m_verify_raw0 n pp eval_fs c0 xx1 zz1;; + +test_verify pp poly_tm true `-- &1` (xx,zz) 0.0;; + + + +let domain0 = mk_m_center_domain n pp xx1 zz1;; +let domain1, _ = restrict_domain n 2 true domain0;; +let domain11, domain12 = split_domain n pp 1 domain1;; +let domain111, domain112 = split_domain n pp 1 domain11;; + +let eval_taylor = + match eval_fs with (_, _, _, f) -> f;; + +let taylor0 = eval_taylor domain0;; +eval_m_taylor_upper_partial n pp 2 taylor0;; + +let taylor111 = eval_taylor domain111;; +eval_m_taylor_upper_bound n pp taylor111;; +let taylor112 = eval_taylor domain112;; +eval_m_taylor_upper_bound n pp taylor112;; + +let taylor12 = eval_taylor domain12;; +eval_m_taylor_upper_bound n pp taylor12;; + + + + +(****) +(* delta_x4 *) +let pp = 10;; +let n = 6;; +let xx = `[&4;&4;&4;&4;&4;&8]` and + zz = `[#6.3504;#6.3504;#6.3504;#6.3504;#6.3504;#25.4016]`;; +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; + +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + + +let eval_delta_x4, tf_delta_x4, ti = mk_verification_functions pp delta_x4_poly true `#6.02525`;; +let certificate = run_test tf_delta_x4 xx_float zz_float false 0.0 true true true false 0.0;; +let c1 = transform_result xx_float zz_float certificate;; +(* 1 *) +result_size certificate;; + +m_verify_list n pp eval_delta_x4 c1 xx1 zz1;; +m_verify_raw0 n pp eval_delta_x4 certificate xx1 zz1;; + + +let c0 = run_test0 tf_delta_x4 xx_float zz_float false 0.0 true true false 0.0;; +(* 12 (true false false) 2 (true true false) *) +result_size c0;; +m_verify_raw0 n pp eval_delta_x4 c0 xx1 zz1;; + +(* 1.076 *) +test 10 (m_verify_raw0 n pp eval_delta_x4 certificate xx1) zz1;; +(* 0.836 *) +test 10 (m_verify_raw0 n pp eval_delta_x4 c0 xx1) zz1;; + + + +(***) +(* delta_x *) + +let pp = 10;; +let n = 6;; +let xx = `[&4;&4;&4;&4;&4;&4]` and + zz = `[#6.3504;#6.3504;#6.3504;#6.3504;#6.3504;#6.3504]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +let eval_delta_x, tf_delta_x, ti = mk_verification_functions pp delta_x_poly true `#127.999`;; +let certificate = run_test tf_delta_x xx_float zz_float false 0.0 true true true true 0.0;; +let c1 = transform_result xx_float zz_float certificate;; +(* 1 *) +length c1;; +(* 46 (true false false) 10 (true true false) 10 (true true true) *) +result_size certificate;; +m_verify_raw0 n pp eval_delta_x certificate xx1 zz1;; +m_verify_list n pp eval_delta_x c1 xx1 zz1;; + +let c0 = run_test0 tf_delta_x xx_float zz_float false 0.0 true true true 0.0;; +(* 4873 (true false true) 32 (true true true) *) +result_size c0;; +m_verify_raw0 n pp eval_delta_x c0 xx1 zz1;; + +(* 10: 65 *) +test 1 (m_verify_raw_old n pp eval_delta_x certificate xx1) zz1;; +(* 10: 38.642 + 100 (cached): 0.384 +*) +reset_all();; +test 1 (m_verify_raw0 n pp eval_delta_x certificate xx1) zz1;; +(* 10: 40.187; 5.140 (convexity) 3.104 (find_and_replace_all); 3.028 (mixed_partials) *) +reset_all();; +test 1 (m_verify_list n pp eval_delta_x c1 xx1) zz1;; +(* 10: 1.860 *) +test 1 (m_verify_raw0 n pp eval_delta_x c0 xx1) zz1;; +(* 10: 4.228 (2.408, new restrict_domain) *) +test 1 (m_verify_domain_test n pp certificate xx1) zz1;; + + + +(***) +(* delta_y *) +let pp = 10;; +let n = 6;; +let xx = `[&2;&2;&2;&2;&2;&2]` and + zz = `[#2.52;#2.52;#2.52;#2.52;#2.52;#2.52]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list 4 false zz;; +let xx2 = Informal_taylor.convert_to_float_list pp true xx and + zz2 = Informal_taylor.convert_to_float_list 4 false zz;; +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +let eval_delta_y, tf_delta_y, ti_delta_y = mk_verification_functions pp delta_y_poly true `#127.999`;; +let certificate = run_test tf_delta_y xx_float zz_float false 0.0 true true true true 0.0;; +let c1 = transform_result xx_float zz_float certificate;; +let c1p = Informal_verifier.m_verify_list pp 1 pp ti_delta_y c1 xx2 zz2;; +(* 17 *) +length c1;; +(* 134 (true true false) 133 (128) (true true true) *) +result_size certificate;; + +m_verify_list n pp eval_delta_y c1 xx1 zz1;; +(* 10: 494 *) +test 1 (m_verify_raw n pp eval0_delta_y eval_delta_y certificate xx1) zz1;; + +(* 10: 362; 165 (find_and_replace_all); 166.9 (mixed_partials) 300: 75 +*) +reset_all();; +test 1 (m_verify_list n pp eval_delta_y c1 xx1) zz1;; + +(* 100: *) +reset_all();; +test 1 (m_p_verify_list n pp eval_delta_y c1p xx1) zz1;; + +let c00 = run_test0 tf_delta_y xx_float zz_float false 0.0 true true true 0.0;; +(* 24671 (true false true) 1785 (1862) (true true true) *) +result_size c00;; +let c0 = transform_result xx_float zz_float c00;; +(* 431 (460) *) +length c0;; + +(* 10: 406; 263 (find_and_replace_all) *) +test 1 (m_verify_list n pp eval_delta_y c0 xx1) zz1;; + + +(***) +let eval_delta_y0, tf_delta_y0 = mk_verification_functions pp delta_y_poly true `&0`;; +let certificate = run_test tf_delta_y0 xx_float zz_float false 0.0 true true true true 0.0;; +result_stat certificate;; +(* 25 (27) *) +result_size certificate;; +let c1 = transform_result xx_float zz_float certificate;; +(* 1 *) +length c1;; +m_verify_list n pp eval_delta_y0 c1 xx1 zz1;; +test 1 (m_verify_list n pp eval_delta_y0 c1 xx1) zz1;; + + +(***) +let poly1 = `x2 + x3 + x5 + x6 - #7.99 - #0.00385 * delta_y x1 x2 x3 x4 x5 x6 - + #2.75 * ((x1 + x4) * #0.5 - sqrt (&8))`;; +let poly_ineq = (expr_to_vector_fun o rand o concl o + REWRITE_CONV[Sphere.delta_y; Sphere.delta_x]) poly1;; + +let pp = 10;; +let n = 6;; + +let xx = `[sqrt (&8); &2; &2; sqrt (&8); &2; &2]` and + zz = `[&3; #2.07; #2.07; &4 * #1.26; #2.07; #2.07]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +let eval_ineq, tf_ineq = mk_verification_functions pp poly_ineq true `&0`;; +let certificate = run_test tf_ineq xx_float zz_float false 0.0 true true true true 0.0;; +(* 51 (true true true) 54 (true false/true false) 439 (false false false) *) +result_size certificate;; +let c1 = transform_result xx_float zz_float certificate;; +(* 30 *) +length c1;; + +m_verify_list n pp eval_ineq c1 xx1 zz1;; + + + + + + +(***) +(* schwefel *) +let pp = 12;; +let pp = 4;; +let n = 3;; +let xx = `[-- &10; -- &10; -- &10]` and + zz = `[&10; &10; &10]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +let eval_schwefel,tf_schwefel, ti = mk_verification_functions pp schwefel_poly true schwefel_min;; +let certificate = run_test tf_schwefel xx_float zz_float false 0.0 true true true true 0.0;; +result_stat certificate;; + +let c1 = transform_result xx_float zz_float certificate;; +(* 641 (661 after eps = 1e-10)*) +length c1;; +(* 1922 (true false false) 1423 (true false true) 1427 (true true true) *) +result_size certificate;; + +m_verify_list n pp eval_schwefel c1 xx1 zz1;; + +(* 10: 698 (f0_flag: 133) *) +test 1 (m_verify_raw0 n pp eval0_schwefel eval_schwefel certificate xx1) zz1;; +(* 10: 103 (diff2_f: 100) (find_and_replace_all: 91); (mixed_partials: 93); 300: 54 *) +test 1 (m_verify_list n pp eval_schwefel c1 xx1) zz1;; + +let c0 = run_test0 tf_schwefel xx_float zz_float false 0.0 true false false 0.0;; +(* 2152 (true false false) *) +result_size c0;; + + + +(***) +(* rd *) + +let pp = 12;; +let n = 3;; +let xx = `[-- &5; -- &5; -- &5]` and + zz = `[&5; &5; &5]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +let eval_rd, tf_rd = mk_verification_functions pp rd_poly true rd_min;; +let certificate = run_test tf_rd xx_float zz_float false 0.0 true true true 0.0;; +(* 1 *) +result_size certificate;; +m_verify_raw0 n pp eval_rd certificate xx1 zz1;; + +(***) +(* caprasse *) + +let pp = 8;; +let n = 4;; +let xx = `[-- #0.5; -- #0.5; -- #0.5; -- #0.5]` and + zz = `[#0.5; #0.5; #0.5; #0.5]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +let eval_caprasse,tf_caprasse,ti = mk_verification_functions pp caprasse_poly true caprasse_min;; +let certificate = run_test tf_caprasse xx_float zz_float false 0.0 true true true true 0.0;; +let c1 = transform_result xx_float zz_float certificate;; +(* 53 (true false true) 33 (true true true) (41, eps = 1e-10)*) +length c1;; +(* 48 (64, eps = 1e-10) (true true false/true) 80 (true false false) 80 (true false true) *) +result_size certificate;; +m_verify_list n pp eval_caprasse c1 xx1 zz1;; + +(* 10: 30.826 (f0_flag: 16.497) (diff2_f: 10.1172, true false false) *) +test 1 (m_verify_raw0 n pp eval_caprasse certificate xx1) zz1;; +(* 10: 6.332 (8.912, eps = 1e-10); 4.848 (find_and_replace_all) *) +test 1 (m_verify_list n pp eval_caprasse c1 xx1) zz1;; + +let c00 = run_test0 tf_caprasse xx_float zz_float false 0.0 true true true 0.0;; +(* 128 (true false false) 88 (true true false) *) +result_size c00;; +let c0 = transform_result xx_float zz_float c00;; +(* 69 *) +length c0;; +m_verify_list n pp eval_caprasse c0 xx1 zz1;; + +(* 10: 6.652 (true true false) 4.632 (true true true) *) +test 1 (m_verify_list n pp eval_caprasse c0 xx1) zz1;; + + + +(***) +(* lv *) + +let pp = 5;; +let n = 4;; +let xx = `[-- &2; -- &2; -- &2; -- &2]` and + zz = `[&2; &2; &2; &2]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +let eval_lv, tf_lv = mk_verification_functions pp lv_poly true lv_min;; +let certificate = run_test tf_lv xx_float zz_float false 0.0 true true true 0.0;; +let c1 = transform_result xx_float zz_float certificate;; +(* 1 *) +length c1;; +(* 3 (true true false/true) 11 (true false false) *) +result_size certificate;; +m_verify_list n pp eval_lv c1 xx1 zz1;; + +(* 10: 2.688 (f0_flag: 1.216) (df0_flag: 0.564) 0.052 (true true true) *) +test 1 (m_verify_list n pp eval_lv c1 xx1) zz1;; + + +let c0 = run_test0 tf_lv xx_float zz_float false 0.0 true true false 0.0;; +(* 11 (true false false) 3 (true true false) *) +result_size c0;; + +(* 0.06 (true true false) *) +test 1 (m_verify_raw0 n pp eval_lv c0 xx1) zz1;; + +(***) +(* butcher *) + +let pp = 5;; +let n = 6;; +let xx = `[-- &1; -- #0.1; -- #0.1; -- &1; -- #0.1; -- #0.1]` and + zz = `[&0; #0.9; #0.5; -- #0.1; -- #0.05; -- #0.03]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +let eval_butcher, tf_butcher = mk_verification_functions pp butcher_poly true butcher_min;; +let certificate = run_test tf_butcher xx_float zz_float false 0.0 true true false 0.0;; +result_size certificate;; +m_verify_raw0 n pp eval_butcher certificate xx1 zz1;; + + +(***) +(* magnetism *) + +let pp = 8;; +let n = 7;; +let xx = `[-- &1; -- &1; -- &1; -- &1; -- &1; -- &1; -- &1]` and + zz = `[&1; &1; &1; &1; &1; &1; &1]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +let eval_magnetism, tf_magnetism, ti = + mk_verification_functions pp magnetism_poly true magnetism_min;; +let certificate = run_test tf_magnetism xx_float zz_float false 0.0 true true true true 0.0;; +result_stat certificate;; + +let c1 = transform_result xx_float zz_float certificate;; +(* 76 *) +length c1;; +(* 8732 (true false false) 77 (true false/true true) *) +result_size certificate;; + +m_verify_list n pp eval_magnetism c1 xx1 zz1;; +(* 10: 7.86 (diff2_f: 5.788) *) +test 1 (m_verify_list n pp eval_magnetism c1 xx1) zz1;; + + +let c00 = run_test0 tf_magnetism xx_float zz_float false 0.0 true false true 0.0;; +(* 121 (true false true) *) +result_size c00;; +let c0 = transform_result xx_float zz_float c00;; +(* 120 *) +length c0;; +m_verify_list n pp eval_magnetism c0 xx1 zz1;; +(* 10: 13.772 (diff2_f: 9.517) *) +test 1 (m_verify_list n pp eval_magnetism c0 xx1) zz1;; + + + + + +(***) +(* heart *) + +let pp = 10;; +let pp = 4;; +let n = 8;; +let xx = `[-- #0.1; #0.4; -- #0.7; -- #0.7; #0.1; -- #0.1; -- #0.3; -- #1.1]` and + zz = `[#0.4; &1; -- #0.4; #0.4; #0.2; #0.2; #1.1; -- #0.3]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +let eval_heart, tf_heart, ti = mk_verification_functions pp heart_poly true heart_min;; +let certificate = run_test tf_heart xx_float zz_float false 0.0 true true true true 1e-10;; +result_stat certificate;; +let c1 = transform_result xx_float zz_float certificate;; +(* 23 *) +length c1;; +(* 42 (true true false) 50 (true false false) 48 (true false true) 37 (true true true) *) +result_size certificate;; +m_verify_list n pp eval_heart c1 xx1 zz1;; + +let c00 = run_test0 tf_heart xx_float zz_float false 0.0 true true true 1e-10;; +(* 46 (true true false) 61 (true false false) 45 (true true true) *) +result_size c00;; +let c0 = transform_result xx_float zz_float c00;; +(* 32 *) +length c0;; +m_verify_list n pp eval_heart c0 xx1 zz1;; + + +(* 10: 109 *) +test 1 (m_verify_raw_old n pp eval_heart certificate xx1) zz1;; + +(* 10: 94 (f0_flag: 22.929) (df0_flag: 13.229) *) +test 1 (m_verify_raw0 n pp eval0_heart eval_heart certificate xx1) zz1;; + +(* 10: 13.689 (diff2_f: 7.080 (true false true)) 4.868 (true true true) 4.448 (find_and_replace_all) *) +test 1 (m_verify_list n pp eval_heart c1 xx1) zz1;; +(* 10: 4.048 *) +test 1 (m_verify_raw0 n pp eval_heart c00 xx1) zz1;; +(* 10: 4.248 *) +test 1 (m_verify_list n pp eval_heart c0 xx1) zz1;; + + + +(* 10: 13 (10.625, new restrict_domain) (f0_flag: 5.3) (df0_flag: 2.264) *) +test 1 (m_verify_domain_test n pp certificate xx1) zz1;; + + + + +(************************************) +(* full time tests *) +(* Bernstein PVS time in parentheses *) + +(* 10: 93.717; 89.042 (10.23; 3.18) *) +(* 10 (adaptive p): 93.602; 83.853 *) +test_verify 12 schwefel_poly true schwefel_min schwefel_dom 0.0;; + +(* 10: 1.860; 0.024 (3.11; 0.17) *) +test_verify 11 rd_poly true rd_min rd_dom 0.0;; + +(* 10: 11.829; 4.856 (11.44; 1.2) *) +reset_all();; +test_verify 8 caprasse_poly true caprasse_min caprasse_dom 0.0;; + +(* 10: 2.204; 0.048 (4.75; 0.23) *) +test_verify 5 lv_poly true lv_min lv_dom 0.0;; + +(* 10: 4.164; 0.024 (19.83; 0.47)*) +test_verify 5 butcher_poly true butcher_min butcher_dom 0.0;; + +(* 10: 11.965; 5.600 (160.44; 82.87) *) +test_verify 8 magnetism_poly true magnetism_min magnetism_dom 0.0;; + +(* 10: 23.205; 4.376 (79.68; 26.14) *) +(* 10 (adaptive p): 20.145; 4.288 *) +test_verify 10 heart_poly true heart_min heart_dom 1e-10;; diff --git a/formal_lp/old/formal_interval/m_tests2.hl b/formal_lp/old/formal_interval/m_tests2.hl new file mode 100644 index 0000000..02e8b2b --- /dev/null +++ b/formal_lp/old/formal_interval/m_tests2.hl @@ -0,0 +1,599 @@ +needs "../formal_lp/formal_interval/m_taylor_arith.hl";; +needs "../formal_lp/formal_interval/m_verifier.hl";; + + +let pp = 10;; +let n = 2;; + +let poly1 = expr_to_vector_fun `x1 * x2`;; +let poly2 = expr_to_vector_fun `x2 + x1 * x2`;; + +let (_, _, _, eval1), tf1 = mk_verification_functions pp poly1 false `&0` and + (_, _, _, eval2), tf2 = mk_verification_functions pp poly2 false `&0`;; + + +let xx = `[&1; &1]` and + zz = `[&2; &2]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; + +let xx_float, zz_float = + let pad = replicate 0.0 (8 - length (dest_list xx1)) in + map float_of_float_tm (dest_list xx1) @ pad, + map float_of_float_tm (dest_list zz1) @ pad;; + +let domain_th = mk_m_center_domain n pp xx1 zz1;; + +evalf (Uni_compose (uatan, tf2)) xx_float zz_float;; +eval_m_taylor_mul n pp (eval1 domain_th) (eval2 domain_th);; +evalf (Product (tf1, tf2)) xx_float zz_float;; + + + +(******************************) + +(* dummy functions *) + +let eval_d0 i t1 t2 = failwith "eval_d0";; +let eval_dd0 i j t1 t2 = failwith "eval_dd0";; +let eval_0 t1 t2 = failwith "eval_0";; + + +(******************************) + + +(* 1d test *) + +let n = 1;; +let pp = 5;; + +let eval_x = eval_m_taylor_poly0 pp `\x:real^1. x$1`;; + +let f_eval th = + let x = eval_x th in + let ( - ), ( * ), atn = eval_m_taylor_sub n pp, eval_m_taylor_mul n pp, eval_m_taylor_atn n pp in + x * x - atn x;; + +let tf = Plus (Product (x1, x1), Scale (Uni_compose (uatan, x1), ineg one));; + + +let xx = `[#0.01]` and + zz = `[#0.8]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; + +let xx_float, zz_float = + let pad = replicate 0.0 (8 - length (dest_list xx1)) in + map float_of_float_tm (dest_list xx1) @ pad, + map float_of_float_tm (dest_list zz1) @ pad;; + +let domain_th = mk_m_center_domain n pp xx1 zz1;; +f_eval domain_th;; +evalf tf xx_float zz_float;; + +let certificate = run_test tf xx_float zz_float false 0.0 true false true false 0.0;; +let c1 = transform_result xx_float zz_float certificate;; + +m_verify_list n pp (eval_d0, eval_dd0, eval_0, f_eval) c1 xx1 zz1;; + + +(********************) + +let n = 1;; +let pp = 10;; + +let atan_num = `let P00, P01, P02 = #4.26665376811246382, #3.291955407318148, #0.281939359003812 in + let x1 = x * x in + let x2 = x1 * x1 in + x * (x1 * P01 + x2 * P02 + P00)`;; + +let atan_denom = `let Q00, Q01 = #4.26665376811354027, #4.714173328637605 in + let x1 = x * x in + let x2 = x1 * x1 in + x1 * Q01 + x2 + Q00`;; + + +let num_poly = (expr_to_vector_fun o rand o concl o REPEATC let_CONV) atan_num;; +let denom_poly = (expr_to_vector_fun o rand o concl o REPEATC let_CONV) atan_denom;; + +let (_, _, _, eval_num), tf_num = mk_verification_functions pp num_poly false `&0`;; +let (_, _, _, eval_denom), tf_denom = mk_verification_functions pp denom_poly false `&0`;; + +let (_, _, _, eval_eps), tf_eps = mk_verification_functions pp `\x:real^1. #0.00000001` false `&0`;; + + +let eval_approx_hi th = + let x = eval_x th in + let eps = eval_eps th in + let atn, inv, ( * ), ( - ) = eval_m_taylor_atn n pp, eval_m_taylor_inv n pp, + eval_m_taylor_mul n pp, eval_m_taylor_sub n pp in + (eval_num th * inv (eval_denom th) - atn x) - eps;; + +(***) +let xx = `[#0.0000001]` and + zz = `[#0.2]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; + +let xx_float, zz_float = + let pad = replicate 0.0 (8 - length (dest_list xx1)) in + map float_of_float_tm (dest_list xx1) @ pad, + map float_of_float_tm (dest_list zz1) @ pad;; + +let domain_th = mk_m_center_domain n pp xx1 zz1;; + + +eval_approx_hi domain_th;; +(* 10: 0.800 (p = 15) *) +test 1 eval_approx_hi domain_th;; + + +(***) +let tf_approx_hi = Plus (Plus (Product (tf_num, Uni_compose (uinv, tf_denom)), + Scale (Uni_compose (uatan, x1), ineg one)), + Scale (tf_eps, ineg one));; + + +let certificate = run_test tf_approx_hi xx_float zz_float false 0.0 true false true false 0.0;; +result_stat certificate;; +let c1 = transform_result xx_float zz_float certificate;; + +m_verify_list n pp (eval_d0, eval_dd0, eval_0, eval_approx_hi) c1 xx1 zz1;; + + + + +(* 2d test *) + +let n = 2;; +let pp = 10;; + +let eval_x = eval_m_taylor_poly0 pp `\x:real^2. x$1` and + eval_y = eval_m_taylor_poly0 pp `\x:real^2. x$2`;; + +let eval_xy = eval_m_taylor_poly0 pp `\x:real^2. x$1 * x$2`;; + +let f_eval th = + let x = eval_x th in + let y = eval_y th in + let ( - ), ( * ), atn = eval_m_taylor_sub n pp, eval_m_taylor_mul n pp, eval_m_taylor_atn n pp in + atn (x * y) - x * y;; + +let f_eval2 th = + let xy = eval_xy th in + let ( - ), ( * ), atn = eval_m_taylor_sub n pp, eval_m_taylor_mul n pp, eval_m_taylor_atn n pp in + atn xy - xy;; + + +let tf = Plus (Uni_compose (uatan, Product (x1, x2)), Scale (Product (x1, x2), ineg one));; + + +let xx = `[#0.1; #0.1]` and + zz = `[#0.6; #0.6]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; + +let xx_float, zz_float = + let pad = replicate 0.0 (8 - length (dest_list xx1)) in + map float_of_float_tm (dest_list xx1) @ pad, + map float_of_float_tm (dest_list zz1) @ pad;; + +let domain_th = mk_m_center_domain n pp xx1 zz1;; + +let certificate = run_test tf xx_float zz_float false 0.0 true false true false 0.0;; +let c1 = transform_result xx_float zz_float certificate;; + +(* 10: 33.926 *) +test 1 (m_verify_list n pp (eval_d0, eval_dd0, eval_0, f_eval) c1 xx1) zz1;; +(* 10: 25.089 *) +test 1 (m_verify_list n pp (eval_d0, eval_dd0, eval_0, f_eval2) c1 xx1) zz1;; + + + +(* 6d tests *) + +let n = 6;; +let pp = 10;; + +let (_, _, _, eval_xy), tf0 = + mk_verification_functions pp `\x:real^6. x$1 * x$2 + x$3 * x$4 + x$5 * x$6` false `&0`;; + +let f_eval_sqrt th = + let xy = eval_xy th in + let ( - ), ( * ), sqrt = eval_m_taylor_sub n pp, eval_m_taylor_mul n pp, eval_m_taylor_sqrt n pp in + xy - sqrt xy;; + +let f_eval_atn th = + let xy = eval_xy th in + let ( - ), ( * ), atn = eval_m_taylor_sub n pp, eval_m_taylor_mul n pp, eval_m_taylor_atn n pp in + atn xy - xy;; + + +let tf_sqrt = Plus (tf0, Scale (Uni_compose (usqrt, tf0), ineg one));; +let tf_atn = Plus (Uni_compose (uatan, tf0), Scale (tf0, ineg one));; + + +let xx = `[#0.1; #0.1; #0.1; #0.1; #0.1; #0.1]` and + zz = `[#0.2; #0.2; #0.2; #0.2; #0.2; #0.2]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; + +let xx_float, zz_float = + let pad = replicate 0.0 (8 - length (dest_list xx1)) in + map float_of_float_tm (dest_list xx1) @ pad, + map float_of_float_tm (dest_list zz1) @ pad;; + + +let certificate_sqrt = run_test tf_sqrt xx_float zz_float false 0.0 true false true false 0.0;; +let c1_sqrt = transform_result xx_float zz_float certificate_sqrt;; + +let certificate_atn = run_test tf_atn xx_float zz_float false 0.0 true false true false 0.0;; +let c1_atn = transform_result xx_float zz_float certificate_atn;; + +m_verify_list n pp (eval_d0, eval_dd0, eval_0, f_eval_sqrt) c1_sqrt xx1 zz1;; +m_verify_list n pp (eval_d0, eval_dd0, eval_0, f_eval_atn) c1_atn xx1 zz1;; + + + +(*********************************) + +(* real tests *) + +let n = 6;; +let pp = 15;; +(* let pp = 8;; *) + +(* delta_y *) +let delta_y_poly = + let tm = (rand o concl o SPEC_ALL o REWRITE_RULE[Sphere.delta_x]) Sphere.delta_y in + expr_to_vector_fun tm;; + +(* delta_y4 *) +let delta_y4_poly = + let tm = (rand o concl o SPECL[`y1*y1`; `y2*y2`; `y3*y3`; `y4*y4`; `y5*y5`; `y6*y6`]) Sphere.delta_x4 in + expr_to_vector_fun tm;; + +(* 4 * y1 * delta_y *) +let four_y1_delta_y_poly = + let x_var, tm = dest_abs delta_y_poly in + mk_abs (x_var, mk_binop mul_op_real `&4` (mk_binop mul_op_real `(x:real^6)$1 * x$1` tm));; + +(* - delta_y4 *) +let neg_delta_y4_poly = + let x_var, tm = dest_abs delta_y4_poly in + mk_abs (x_var, mk_comb (neg_op_real, tm));; + + +let (_, _, _, eval_neg_delta_y4), tf_neg_delta_y4 = + mk_verification_functions pp neg_delta_y4_poly false `&0`;; + +let (_, _, _, eval_4y1_delta_y), tf_4y1_delta_y = + mk_verification_functions pp four_y1_delta_y_poly false `&0`;; + +let (_, _, _, eval_pi2), tf_pi2 = + mk_verification_functions pp `\x:real^6. pi / &2` false `&0`;; + + +let (_, _, _, eval_pi2_plus), tf_pi2_plus = + mk_verification_functions pp `\x:real^6. pi / &2 - #1.893` false `&0`;; + + + +Sphere.dih_x;; + +(* dih_y *) +let tf_dih_y_hi = + let denom = Uni_compose (uinv, Uni_compose (usqrt, tf_4y1_delta_y)) in + Plus (tf_pi2_plus, Uni_compose (uatan, Product (tf_neg_delta_y4, denom)));; + +let eval_dih_y_hi th = + let inv, atn, sqrt, ( * ), ( + ) = + eval_m_taylor_inv n pp, eval_m_taylor_atn n pp, eval_m_taylor_sqrt n pp, + eval_m_taylor_mul n pp, eval_m_taylor_add n pp in + let poly1 = eval_4y1_delta_y th and + poly2 = eval_neg_delta_y4 th and + pi2 = eval_pi2_plus th in + pi2 + atn (poly2 * inv (sqrt (poly1)));; + + + +(************) + +let xx = `[&2; &2; &2; &2; &2; &2]` and + zz = `[#2.52; #2.52; #2.52; #2.52; #2.52; #2.52]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; + + +(* Small domain *) +let xx_s = `[&2; &2; &2; &2; &2; &2]` and + zz_s = `[#2.1; #2.1; #2.1; #2.1; #2.1; #2.1]`;; + +let domain_th = + let xx1_s = convert_to_float_list pp true xx_s and + zz1_s = convert_to_float_list pp false zz_s in + mk_m_center_domain n pp xx1_s zz1_s;; + +(* 10: 9.121 (pp = 15); 300: 5.5 (pp = 8) *) +test 1 eval_dih_y_hi domain_th;; + + +(***) + +let xx_s = `[&2; &2; &2; &2; &2; &2]` and + zz_s = `[#2.52; #2.1; #2.1; #2.1; #2.1; #2.1]`;; + +let xx1_s = convert_to_float_list pp true xx_s and + zz1_s = convert_to_float_list pp false zz_s;; + + +let xx_float, zz_float, xx_s_float, zz_s_float = + let pad = replicate 0.0 (8 - length (dest_list xx1)) in + map float_of_float_tm (dest_list xx1) @ pad, + map float_of_float_tm (dest_list zz1) @ pad, + map float_of_float_tm (dest_list xx1_s) @ pad, + map float_of_float_tm (dest_list zz1_s) @ pad;; + + + +(***) + +let c_dih_y_s = run_test tf_dih_y_hi xx_s_float zz_s_float false 0.0 true false true false 0.0;; +let c_dih_y = run_test tf_dih_y_hi xx_float zz_float false 0.0 true false true false 0.0;; +let c_dih_y0 = run_test tf_dih_y_hi xx_float zz_float false 0.0 true false false false 0.0;; +let c_dih_y_full = run_test tf_dih_y_hi xx_float zz_float false 0.0 true true true true 0.0;; +let c_dih_y_min = run_test tf_dih_y_hi xx_float zz_float false 0.0 false false false false 0.0;; + +(* pass = 4 *) +result_stat c_dih_y_s;; + +(* pass = 4292, mono = 8, pass_mono = 2 *) +result_stat c_dih_y;; +(* pass = 4294, mono = 10 *) +result_stat c_dih_y0;; +(* pass = 4292, mono = 8, pass_mono = 2 *) +result_stat c_dih_y_full;; +(* pass = 4317, mono = 0 *) +result_stat c_dih_y_min;; + +m_verify_raw0 n pp (eval_d0, eval_dd0, eval_0, eval_dih_y) c_dih_y_s xx1_s zz1_s;; +(* 10: 38.418; 300: 22.289 (pp = 8)*) +test 1 (m_verify_raw0 n pp (eval_d0, eval_dd0, eval_0, eval_dih_y) c_dih_y_s xx1_s) zz1_s;; + + + +m_verify_raw0 n pp (eval_d0, eval_dd0, eval_0, eval_dih_y) c_dih_y0 xx1 zz1;; +let c1_dih_y = transform_result xx_float zz_float c_dih_y;; + + + +(*************************************) +(* dih_y *) +let tf_dih_y = + let denom = Uni_compose (uinv, Uni_compose (usqrt, tf_4y1_delta_y)) in + Plus (tf_pi2, Uni_compose (uatan, Product (tf_neg_delta_y4, denom)));; + + +(* sol_y *) + +let _, tf_neg_pi = mk_verification_functions 15 `\x:real^6. --pi` false `&0`;; + +Sphere.sol_y;; +let tf_sol_y = + let dih1 = tf_dih_y and + dih2 = Composite (tf_dih_y, x2, x3, x1, x5, x6, x4, unit, unit) and + dih3 = Composite (tf_dih_y, x3, x1, x2, x6, x4, x5, unit, unit) in + Plus (dih1, Plus (dih2, Plus (dih3, tf_neg_pi)));; + +(* taum *) + +let pi_val= 3.1415926535897932;; +let sol0_val = 0.5512855984325308;; +let const1_val = sol0_val /. pi_val;; +let const1_plus1 = const1_val +. 1.0;; + +let _, tf_ly = mk_verification_functions 15 `\x:real^1. #2.52 / #0.52 - x$1 * inv(#0.52)` false `&0`;; +let tf_lnazim_y = Product (tf_ly, tf_dih_y);; + +Sphere.taum;; +let tf_taum = + let azim1 = tf_lnazim_y and + azim2 = Composite (tf_lnazim_y, x2, x3, x1, x5, x6, x4, unit, unit) and + azim3 = Composite (tf_lnazim_y, x3, x1, x2, x6, x4, x5, unit, unit) in + let f1 = Scale (tf_sol_y, mk_interval (const1_plus1, const1_plus1)) and + f2 = Plus (azim1, Plus (azim2, azim3)) in + Plus (f1, Scale (f2, mk_interval (~-.const1_val, ~-.const1_val)));; + + + +(* dih_y < 1.893 *) +let tf_test1 = + Plus (tf_dih_y, Scale (unit, ineg (mk_interval (1.893, 1.893))));; + + +(* dih_y > 0.852 *) +let tf_test2 = + Plus (Scale (unit, mk_interval (0.852, 0.852)), Scale (tf_dih_y, ineg one));; + + +(* taum + 0.626 * dih_y - 0.77 > 0 *) +let tf_test3 = + let f = Plus (tf_taum, Scale (tf_dih_y, mk_interval (0.626, 0.626))) in + Plus (Scale (unit, mk_interval (0.77, 0.77)), Scale (f, ineg one));; + + +(* taum - 0.259 * dih_y + 0.32 > 0 *) +let tf_test4 = + let f = Plus (tf_taum, Scale (tf_dih_y, mk_interval (-0.259, -0.259))) in + Plus (Scale (unit, mk_interval (-0.32, -0.32)), Scale (f, ineg one));; + + +(* taum - 0.507 * dih_y + 0.724 > 0 *) +let tf_test5 = + let f = Plus (tf_taum, Scale (tf_dih_y, mk_interval (-0.507, -0.507))) in + Plus (Scale (unit, mk_interval (-0.724, -0.724)), Scale (f, ineg one));; + + +(* sol_y - 0.55125 - 0.196 * (y4 + y5 + y6 - 6) + 0.38 * (y1 + y2 + y3 - 6) > 0 *) +let _, tf_poly = mk_verification_functions 15 + `\x:real^6. #0.55125 + #0.196 * (x$4 + x$5 + x$6 - &6) - #0.38 * (x$1 + x$2 + x$3 - &6)` false `&0`;; + +let tf_test6 = + Plus (tf_poly, Scale (tf_sol_y, ineg one));; + + +(* dih_y - 1.2308 + 0.3639 * (y2 + y3 + y5 + y6 - 8) - 0.235 * (y1 - 2) - 0.685 * (y4 - 2) > 0 *) +let _, tf_poly = mk_verification_functions 15 + `\x:real^6. #1.2308 - #0.3639 * (x$2 + x$3 + x$5 + x$6 - &8) + #0.235 * (x$1 - &2) + #0.685 * (x$4 - &2)` + false `&0`;; + +let tf_test7 = + Plus (tf_poly, Scale (tf_dih_y, ineg one));; + + + + +(****) +let c1_1 = run_test tf_test1 xx_float zz_float false 0.0 true false true false 0.0;; +let c1 = run_test tf_test1 xx_float zz_float false 0.0 false false false false 0.0;; +result_stat c1_1;; +(* pass = 4317 *) +result_stat c1;; + + +(****) +let c2_1 = run_test tf_test2 xx_float zz_float false 0.0 true false true false 0.0;; +let c2 = run_test tf_test2 xx_float zz_float false 0.0 false false false false 0.0;; +(* pass = 8891, mono = 77, pass_mono = 2 *) +result_stat c2_1;; +(* pass = 9007 *) +result_stat c2;; + +(***) +let c3 = run_test tf_test3 xx_float zz_float false 0.0 false false false false 0.0 and + c4 = run_test tf_test4 xx_float zz_float false 0.0 false false false false 0.0 and + c5 = run_test tf_test5 xx_float zz_float false 0.0 false false false false 0.0;; + + +(* 48104 *) +result_stat c3;; +(* 34015 *) +result_stat c4;; +(* 25859 *) +result_stat c5;; + + + + +(****) +let c6_1 = run_test tf_test6 xx_float zz_float false 0.0 true false true false 0.0;; +let c6 = run_test tf_test6 xx_float zz_float false 0.0 false false false false 0.0;; +(* pass = 67337, mono = 214, pass_mono = 33 *) +result_stat c6_1;; +(* pass = 9007 *) +result_stat c2;; + + +(****) +let c7_1 = run_test tf_test7 xx_float zz_float false 0.0 true false true false 0.0;; +let c7 = run_test tf_test7 xx_float zz_float false 0.0 false false false false 0.0;; +let c7_full = run_test tf_test7 xx_float zz_float false 0.0 true true true true 0.0;; +(* pass = 21104, mono = 1203, pass_mono = 58 *) +result_stat c7_full;; +(* pass = 21104, mono = 1203, pass_mono = 58 *) +result_stat c7_1;; +(* pass = 23251 *) +result_stat c7;; + + + +(****************) + +let rec get_pass_intervals r = + match r with + | Result_pass (_, xx, zz) -> [xx, zz] + | Result_glue (_, _, r1, r2) -> get_pass_intervals r1 @ get_pass_intervals r2 + | _ -> [];; + +let sum_rs rs = itlist (+) (map result_size rs) 0;; +let sum1_rs rs = itlist (+) (filter (fun s -> s = 1) (map result_size rs)) 0;; + + +let c1_ints = get_pass_intervals c1;; +let c2_ints = get_pass_intervals c2;; +let c3_ints = get_pass_intervals c3;; +let c4_ints = get_pass_intervals c4;; +let c5_ints = get_pass_intervals c5;; +let c6_ints = get_pass_intervals c6;; +let c7_ints = get_pass_intervals c7;; + +(***) +let c2_1_rs = map (fun (xx, zz) -> + run_test tf_test2 xx zz false 0.0 false false false false 0.0) c1_ints;; + +let c2_7_rs = map (fun (xx, zz) -> + run_test tf_test2 xx zz false 0.0 false false false false 0.0) c7_ints;; + +(* 9121 vs 9007 *) +sum_rs c2_1_rs;; +(* 2146 *) +sum1_rs c2_1_rs;; + +(* 23922 *) +sum_rs c2_7_rs;; +(* 22762 *) +sum1_rs c2_7_rs;; + +(***) +let c1_2_rs = map (fun (xx, zz) -> + run_test tf_test1 xx zz false 0.0 false false false false 0.0) c2_ints;; + +let c1_7_rs = map (fun (xx, zz) -> + run_test tf_test1 xx zz false 0.0 false false false false 0.0) c7_ints;; + + +(* 9121 vs 9007 *) +sum_rs c1_2_rs;; +(* 8933 *) +sum1_rs c1_2_rs;; + +(* 23268 *) +sum_rs c1_7_rs;; +(* 23247 *) +sum1_rs c1_7_rs;; + + +(***) +let c7_2_rs = map (fun (xx, zz) -> + run_test tf_test7 xx zz false 0.0 false false false false 0.0) c2_ints;; + + +(* 23922 vs 23251 *) +sum_rs c7_2_rs;; +(* 3918 *) +sum1_rs c7_2_rs;; + + +(*********) +let c4_3_rs = map (fun (xx, zz) -> + run_test tf_test4 xx zz false 0.0 false false false false 0.0) c3_ints and + c5_3_rs = map (fun (xx, zz) -> + run_test tf_test5 xx zz false 0.0 false false false false 0.0) c3_ints;; + + +(* 54465 vs 34015 *) +sum_rs c4_3_rs;; +(* 43517 *) +sum1_rs c4_3_rs;; + + +(* 52093 vs 25859 *) +sum_rs c5_3_rs;; +(* 45488 *) +sum1_rs c5_3_rs;; diff --git a/formal_lp/old/formal_interval/m_tests3.hl b/formal_lp/old/formal_interval/m_tests3.hl new file mode 100644 index 0000000..9da969b --- /dev/null +++ b/formal_lp/old/formal_interval/m_tests3.hl @@ -0,0 +1,437 @@ +let mem_stat () = + let stat = Gc.stat() in + let word = float_of_int (Sys.word_size / 8) in + let free = float_of_int stat.Gc.free_words *. word /. 1024.0 in + let total = float_of_int stat.Gc.heap_words *. word /. 1024.0 in + let allocated = total -. free in + let str = sprintf "allocated = %f (free = %f; total_size = %f; %f)\n" + allocated free total (free /. total) in + print_string str;; + + +(* allocated = 85862 *) +mem_stat();; + +Gc.set { (Gc.get()) with Gc.verbose = 0x05 };; +Gc.compact();; + +(* allocated = 60243 *) +mem_stat();; + + + + +flyspeck_needs "../formal_lp/formal_interval/m_verifier.hl";; + +(* allocated = 129006 *) +mem_stat();; + +Gc.compact();; +(* allocated = 80510 *) +mem_stat();; + +Arith_cache.print_stat();; +Arith_float.print_stat();; + + +let reset_all () = + Arith_cache.reset_cache(); + Arith_cache.reset_stat(); + Arith_float.reset_cache(); + Arith_float.reset_stat();; + + +reset_all();; +Gc.compact();; +(* allocated = 79346 *) +mem_stat();; + + +(**************************) +(* Examples *) +let heart_poly = expr_to_vector_fun `-- x1 * x6 pow 3 + &3 * x1 * x6 * x7 pow 2 - x3 * x7 pow 3 + + &3 * x3 * x7 * x6 pow 2 - x2 * x5 pow 3 + &3 * x2 * x5 * x8 pow 2 - x4 * x8 pow 3 + + &3 * x4 * x8 * x5 pow 2 - #0.9563453`;; + +let poly1 = `x2 + x3 + x5 + x6 - #7.99 - #0.00385 * delta_y x1 x2 x3 x4 x5 x6 - + #2.75 * ((x1 + x4) * #0.5 - sqrt (&8))`;; +let poly_ineq = (expr_to_vector_fun o rand o concl o + REWRITE_CONV[Sphere.delta_y; Sphere.delta_x]) poly1;; + +let heart_min = `-- #1.7435` and + poly_min = `&0`;; + +let heart_dom = `[-- #0.1; #0.4; -- #0.7; -- #0.7; #0.1; -- #0.1; -- #0.3; -- #1.1]`, + `[#0.4; &1; -- #0.4; #0.4; #0.2; #0.2; #1.1; -- #0.3]`;; +let poly_dom = `[sqrt (&8); &2; &2; sqrt (&8); &2; &2]`, + `[&3; #2.07; #2.07; &4 * #1.26; #2.07; #2.07]`;; + + +(***********************************) + +let test_verify pp poly_tm min_flag val_tm (xx,zz) eps = + let total_start = Sys.time() in + let n = (get_dim o fst o dest_abs) poly_tm in + let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz in + let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1) in + let eval_fs, tf = mk_verification_functions pp poly_tm min_flag val_tm in + let certificate = run_test tf xx_float zz_float false 0.0 true true true true eps in + let c1 = transform_result xx_float zz_float certificate in + let start = Sys.time() in + let result = m_verify_list n pp eval_fs c1 xx1 zz1 in + let finish = Sys.time() in + let _ = report + (sprintf "Total time: %f; Verification time: %f" (finish -. total_start) (finish -. start)) in + result;; + + +(******) + +(* + PVS: 79.68; 26.14 + 8 (10): 27.937; 9.176 + 64 (6): 24.249; 5.672 + 512 (3): 23.113; 3.428 + + Why is the base 10 much faster than 8? + Possible explanation: the domain is described by decimal numbers, + so computations with the base 10 are faster in general (the approximation is better: + requires less digits). + 10 (10): 23.205; 4.376 + 10 (10, cached, float_cached): 20.001; 1.548 + 10 (10, float_cached): 19.769; 1.744 + 100 (5): 21.733; 3.180 + 100 (5, cached): 20.737; 2.196 +*) + + +reset_all();; +test_verify 10 heart_poly true heart_min heart_dom 1e-10;; + +Arith_cache.print_stat();; +Arith_float.print_stat();; + +(* 117589 *) +mem_stat();; + +Gc.compact();; +(* 80340 *) +mem_stat();; + +reset_all();; +Gc.compact();; +(* 79372 *) +mem_stat();; + +(* + 8 (10): 215.953; 112.399 + 64 (6): 162.754; 62.588 + 64 (5): 150.573; 49.991 + 512 (3): 137.967; 32.250 + + 10 (10): 185.211; 83.785 + 100 (5): 139.821; 40.975 + 100 (5, cached): 119.267; 20.009 +*) +reset_all ();; +(* +test_verify 5 poly_ineq true poly_min poly_dom 0.0;; +Arith_cache.print_stat();; +*) + +(******) + +let pp = 10;; +let n = (get_dim o fst o dest_abs) poly_ineq;; +let xx, zz = poly_dom;; +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; +let xx_float = map float_of_float_tm (dest_list xx1) and + zz_float = map float_of_float_tm (dest_list zz1);; + +Arith_cache.print_stat();; +Arith_float.print_stat();; + +let eval_fs, tf = mk_verification_functions pp poly_ineq true poly_min;; + +Arith_cache.print_stat();; +Arith_float.print_stat();; + +let certificate = run_test tf xx_float zz_float false 0.0 true true true true 0.0;; +let c1 = transform_result xx_float zz_float certificate;; + +reset_all();; + +(* 10 (10, cached): 30.589 *) +(* 10 (10, cached, float_cached): 16.137 *) +(* 10 (10, float_cached): 17.001 *) +(* 100 (5, cached): 20.101 *) +(* 100 (5, cached, float_cached): 10.452 *) + +let _ = + let start = Sys.time() in + let result = m_verify_list n pp eval_fs c1 xx1 zz1 in + let finish = Sys.time() in + let _ = report + (sprintf "Verification time: %f" (finish -. start)) in + result;; + +Arith_cache.print_stat();; +Arith_float.print_stat();; + +Gc.compact();; +(* 89346 *) +mem_stat();; + +reset_all();; +Gc.compact();; +(* 79973 *) +mem_stat();; + + +(* num *) + +let add_list = !Arith_cache.add_list and + mul_list = !Arith_cache.mul_list and + sub_le_list = !Arith_cache.sub_le_list;; + +(* 10: 24.621 *) +(* 100: 7.612 *) +test 1 (map Arith_hash.raw_add_conv_hash) add_list;; +(* 100: 22.681 *) +test 1 (map Arith_hash.raw_mul_conv_hash) mul_list;; +(* 100: 9.917 *) +test 1 (map (fun tm1, tm2 -> Arith_hash.raw_sub_and_le_hash_conv tm1 tm2)) sub_le_list;; + +Arith_cache.reset_cache();; + +(* 10: 6.064 *) +(* 100: 1.884 *) +test 1 (map raw_add_conv_hash) add_list;; +(* 100: 2.396 *) +test 1 (map raw_mul_conv_hash) mul_list;; +(* 100: 2.384 *) +test 1 (map (fun tm1, tm2 -> raw_sub_and_le_hash_conv tm1 tm2)) sub_le_list;; + + +(****************) +(* float *) + +let mul_lo_list = !Arith_float.mul_lo_list and + mul_hi_list = !Arith_float.mul_hi_list and + add_lo_list = !Arith_float.add_lo_list and + add_hi_list = !Arith_float.add_hi_list;; + +(* 10: 10.308 *) +reset_all();; +test 1 (map (fun p,tm1,tm2 -> float_mul_lo p tm1 tm2)) mul_lo_list;; +(* 10: 13.152 *) +reset_all();; +test 1 (map (fun p,tm1,tm2 -> float_mul_hi p tm1 tm2)) mul_hi_list;; + +(* 10: 2.688 *) +reset_all();; +test 1 (map (fun p,tm1,tm2 -> float_add_lo p tm1 tm2)) add_lo_list;; +(* 10: 3.104 *) +reset_all();; +test 1 (map (fun p,tm1,tm2 -> float_add_hi p tm1 tm2)) add_hi_list;; + +(***********) + +let float_hash tm = + let s, n_tm, e_tm = dest_float tm in + s ^ (num_tm_hash n_tm) ^ "e" ^ (num_tm_hash e_tm);; + + +let float_op_hash pp tm1 tm2 = + string_of_int pp ^ float_hash tm1 ^ "x" ^ float_hash tm2;; + +let float_mul_table = Hashtbl.create 10000;; + +let float_mul_lo_cached pp tm1 tm2 = + let hash = float_op_hash pp tm1 tm2 in + try + Hashtbl.find float_mul_table hash + with Not_found -> + let result = float_mul_lo pp tm1 tm2 in + let _ = Hashtbl.add float_mul_table hash result in + result;; + +reset_all();; + +(* 10: 3.624 *) +test 1 (map (fun p,tm1,tm2 -> float_mul_lo_cached p tm1 tm2)) mul_lo_list;; +(* 2150 *) +Hashtbl.length float_mul_table;; +(* 24044 *) +length mul_lo_list;; + + +let x = 2;; + + + +(****************) + +Hashtbl.length Arith_cache.mul_table;; +Hashtbl.length Arith_cache.sub_le_table;; +Hashtbl.length Arith_cache.add_table;; + + +(* 100: 0.148 *) +test 1 (map Arith_hash.raw_suc_conv_hash) !Arith_cache.suc_list;; +(* 100: 0.180 *) +test 1 (map Arith_hash.raw_eq0_hash_conv) !Arith_cache.eq0_list;; +(* 100: 0.532 *) +test 1 (map Arith_hash.raw_div_hash_conv) !Arith_cache.div_list;; + +(* 100: 10.196 *) +test 1 (map (fun tm1, tm2 -> Arith_hash.raw_sub_and_le_hash_conv tm1 tm2)) !Arith_cache.sub_le_list;; + + + + +let mul_table = Hashtbl.create 100000;; + +let mul_cache1 tm = + if Hashtbl.mem mul_table tm then + Hashtbl.find mul_table tm + else + let result = Arith_hash.raw_mul_conv_hash tm in + let _ = Hashtbl.add mul_table tm result in + result;; + + +(* 100: 25.882 *) +Hashtbl.clear mul_table;; +test 1 (map mul_cache1) !Arith_cache.mul_list;; +(* 100: 44.398 *) +test 1 (map mul_cache1) !Arith_cache.mul_list;; + +(* 100: 22.609 *) +test 1 (map (Hashtbl.mem mul_table)) !Arith_cache.mul_list;; +(* 100: 22.233 *) +test 1 (map (Hashtbl.find mul_table)) !Arith_cache.mul_list;; +(* 100: 0.044 *) +test 1 (map Hashtbl.hash) !Arith_cache.mul_list;; + +let rec num_tm_hash tm = + if is_comb tm then + let b_tm, n_tm = dest_comb tm in + let str = (fst o dest_const) b_tm in + str ^ num_tm_hash n_tm + else + "";; + + +let op_tm_hash tm = + let lhs, tm2 = dest_comb tm in + let tm1 = rand lhs in + num_tm_hash tm1 ^ "x" ^ num_tm_hash tm2;; + + +(* 0.340 *) +test 1 (map op_tm_hash) !Arith_cache.mul_list;; +(* 0.428 *) +test 1 (map (Hashtbl.hash o op_tm_hash)) !Arith_cache.mul_list;; + +(******) + +let mul_table2 = Hashtbl.create 10000;; +let add_table2 = Hashtbl.create 10000;; +let div_table2 = Hashtbl.create 10000;; + +let mul_cache2 tm = + let hash = op_tm_hash tm in + try + Hashtbl.find mul_table2 hash + with Not_found -> + let result = Arith_hash.raw_mul_conv_hash tm in + let _ = Hashtbl.add mul_table2 hash result in + result;; + +let add_cache2 tm = + let hash = op_tm_hash tm in + try + Hashtbl.find add_table2 hash + with Not_found -> + let result = Arith_hash.raw_add_conv_hash tm in + let _ = Hashtbl.add add_table2 hash result in + result;; + +let div_cache2 tm = + let hash = op_tm_hash tm in + try + Hashtbl.find div_table2 hash + with Not_found -> + let result = Arith_hash.raw_div_hash_conv tm in + let _ = Hashtbl.add div_table2 hash result in + result;; + +Hashtbl.clear div_table2;; +(* 100: 0.016 *) +test 1 (map div_cache2) !Arith_cache.div_list;; +(* 12 *) +Hashtbl.length div_table2;; +(* 100: 0.016 *) +test 1 (map div_cache2) !Arith_cache.div_list;; + + +Hashtbl.clear mul_table2;; +(* 100: 2.536 *) +test 1 (map mul_cache2) !Arith_cache.mul_list;; +(* 4687 *) +Hashtbl.length mul_table2;; +(* 100: 0.384 *) +test 1 (map mul_cache2) !Arith_cache.mul_list;; + +Hashtbl.clear add_table2;; +(* 100: 2.052 *) +test 1 (map add_cache2) !Arith_cache.add_list;; +(* 5184 *) +Hashtbl.length add_table2;; +(* 100: 1.548 *) +test 1 (map add_cache2) !Arith_cache.add_list;; + + + +let op_sizes tm = + let lhs, tm2 = dest_comb tm in + let tm1 = rand lhs in + let list1 = striplist dest_comb tm1 and + list2 = striplist dest_comb tm2 in + length list1, length list2;; + +let l0 = map op_sizes !Arith_cache.mul_list;; +(* 172 *) +length (List.filter (fun p -> fst p = 1) l0);; +(* 514 *) +length (List.filter (fun p -> fst p = 2) l0);; +(* 345 *) +length (List.filter (fun p -> fst p = 3) l0);; +(* 6 *) +length (List.filter (fun p -> fst p = 4) l0);; +(* 106 *) +length (List.filter (fun p -> fst p = 5) l0);; +(* 2872 *) +length (List.filter (fun p -> fst p = 6) l0);; +(* 672 *) +length (List.filter (fun p -> fst p = 7) l0);; + +(* 0 *) +length (List.filter (fun p -> snd p = 1) l0);; +(* 93 *) +length (List.filter (fun p -> snd p = 2) l0);; +(* 1 *) +length (List.filter (fun p -> snd p = 3) l0);; +(* 13 *) +length (List.filter (fun p -> snd p = 4) l0);; +(* 175 *) +length (List.filter (fun p -> snd p = 5) l0);; +(* 4187 *) +length (List.filter (fun p -> snd p = 6) l0);; +(* 218 *) +length (List.filter (fun p -> snd p = 7) l0);; + diff --git a/formal_lp/old/formal_interval/m_tests4.hl b/formal_lp/old/formal_interval/m_tests4.hl new file mode 100644 index 0000000..eb4ab2b --- /dev/null +++ b/formal_lp/old/formal_interval/m_tests4.hl @@ -0,0 +1,235 @@ +let mem_stat () = + let stat = Gc.stat() in + let word = float_of_int (Sys.word_size / 8) in + let free = float_of_int stat.Gc.free_words *. word /. 1024.0 in + let total = float_of_int stat.Gc.heap_words *. word /. 1024.0 in + let allocated = total -. free in + let str = sprintf "allocated = %f (free = %f; total_size = %f; %f)\n" + allocated free total (free /. total) in + print_string str;; + + +(* allocated = 85862 *) +mem_stat();; + +Gc.set { (Gc.get()) with Gc.verbose = 0x05 };; +Gc.compact();; + +(* allocated = 60243 *) +mem_stat();; + + +needs "../formal_lp/formal_interval/m_taylor_arith.hl";; +needs "../formal_lp/formal_interval/m_verifier.hl";; + +let reset_all () = + Arith_cache.reset_cache(); + Arith_cache.reset_stat(); + Arith_float.reset_cache(); + Arith_float.reset_stat();; + +Arith_cache.print_stat();; +Arith_float.print_stat();; +reset_all();; + + +(******************************) + +(* dummy functions *) + +let eval_d0 i t1 t2 = failwith "eval_d0";; +let eval_dd0 i j t1 t2 = failwith "eval_dd0";; +let eval_0 t1 t2 = failwith "eval_0";; + + +(******************************) +(* real tests *) + +let n = 6;; +let pp = 15;; +let pp = 8;; + +(* delta_y *) +let delta_y_poly = + let tm = (rand o concl o SPEC_ALL o REWRITE_RULE[Sphere.delta_x]) Sphere.delta_y in + expr_to_vector_fun tm;; + +(* delta_y4 *) +let delta_y4_poly = + let tm = (rand o concl o SPECL[`y1*y1`; `y2*y2`; `y3*y3`; `y4*y4`; `y5*y5`; `y6*y6`]) Sphere.delta_x4 in + expr_to_vector_fun tm;; + +(* 4 * y1 * delta_y *) +let four_y1_delta_y_poly = + let x_var, tm = dest_abs delta_y_poly in + mk_abs (x_var, mk_binop mul_op_real `&4` (mk_binop mul_op_real `(x:real^6)$1 * x$1` tm));; + +(* - delta_y4 *) +let neg_delta_y4_poly = + let x_var, tm = dest_abs delta_y4_poly in + mk_abs (x_var, mk_comb (neg_op_real, tm));; + + +let (_, _, _, eval_neg_delta_y4), tf_neg_delta_y4 = + mk_verification_functions pp neg_delta_y4_poly false `&0`;; + +let (_, _, _, eval_4y1_delta_y), tf_4y1_delta_y = + mk_verification_functions pp four_y1_delta_y_poly false `&0`;; + +let (_, _, _, eval_pi2), tf_pi2 = + mk_verification_functions pp `\x:real^6. pi / &2` false `&0`;; + + +let (_, _, _, eval_pi2_plus), tf_pi2_plus = + mk_verification_functions pp `\x:real^6. pi / &2 - #1.893` false `&0`;; + + +(* dih_y *) +let tf_dih_y_hi = + let denom = Uni_compose (uinv, Uni_compose (usqrt, tf_4y1_delta_y)) in + Plus (tf_pi2_plus, Uni_compose (uatan, Product (tf_neg_delta_y4, denom)));; + +let eval_dih_y_hi th = + let inv, atn, sqrt, ( * ), ( + ) = + eval_m_taylor_inv n pp, eval_m_taylor_atn n pp, eval_m_taylor_sqrt n pp, + eval_m_taylor_mul n pp, eval_m_taylor_add n pp in + let poly1 = eval_4y1_delta_y th and + poly2 = eval_neg_delta_y4 th and + pi2 = eval_pi2_plus th in + pi2 + atn (poly2 * inv (sqrt (poly1)));; + + + +(************) + +let xx = `[&2; &2; &2; &2; &2; &2]` and + zz = `[#2.52; #2.52; #2.52; #2.52; #2.52; #2.52]`;; + +let xx1 = convert_to_float_list pp true xx and + zz1 = convert_to_float_list pp false zz;; + + +(* Small domain *) +let xx_s = `[&2; &2; &2; &2; &2; &2]` and + zz_s = `[#2.1; #2.1; #2.1; #2.1; #2.1; #2.1]`;; + + +let domain_th = + let xx1_s = convert_to_float_list pp true xx_s and + zz1_s = convert_to_float_list pp false zz_s in + mk_m_center_domain n pp xx1_s zz1_s;; + +reset_all();; + +(* 10: 9.121 (pp = 15) *) +(* 300: 5.5 (pp = 8) *) +(* 100 (cached, float_cached, pp = 8): 2.68 *) +test 1 eval_dih_y_hi domain_th;; + +Arith_cache.print_stat();; +Arith_float.print_stat();; + + +(***) + +let xx_s = `[&2; &2; &2; &2; &2; &2]` and + zz_s = `[#2.52; #2.1; #2.1; #2.1; #2.1; #2.1]`;; + +let xx_s2 = `[&2; &2; &2; &2; &2; &2]` and + zz_s2 = `[#2.52; #2.2; #2.2; #2.2; #2.2; #2.2]`;; + + +let xx1_s = convert_to_float_list pp true xx_s and + zz1_s = convert_to_float_list pp false zz_s;; + +let xx1_s2 = convert_to_float_list pp true xx_s2 and + zz1_s2 = convert_to_float_list pp false zz_s2;; + + + +let xx_float, zz_float, xx_s_float, zz_s_float, xx_s2_float, zz_s2_float = + let pad = replicate 0.0 (8 - length (dest_list xx1)) in + map float_of_float_tm (dest_list xx1) @ pad, + map float_of_float_tm (dest_list zz1) @ pad, + map float_of_float_tm (dest_list xx1_s) @ pad, + map float_of_float_tm (dest_list zz1_s) @ pad, + map float_of_float_tm (dest_list xx1_s2) @ pad, + map float_of_float_tm (dest_list zz1_s2) @ pad;; + + + +(***) + +let c_dih_y_s = run_test tf_dih_y_hi xx_s_float zz_s_float false 0.0 true false true false 0.0;; +let c_dih_y_s2 = run_test tf_dih_y_hi xx_s2_float zz_s2_float false 0.0 true false true false 0.0;; +let c_dih_y0 = run_test tf_dih_y_hi xx_float zz_float false 0.0 true false false false 0.0;; + +(* pass = 4 *) +result_stat c_dih_y_s;; +(* pass = 63 *) +result_stat c_dih_y_s2;; +(* pass = 4294, mono = 10 *) +result_stat c_dih_y0;; + +reset_all();; +Gc.compact();; +(* 80642 *) +mem_stat();; + +(* 10 (pp = 15): 38.418 *) +(* 300 (pp = 8): 22.289 *) +(* 100 (cached, float_cached, pp = 8): 12.229 *) +let _ = + let start = Sys.time() in + let result = m_verify_raw0 n pp (eval_d0, eval_dd0, eval_0, eval_dih_y_hi) c_dih_y_s xx1_s zz1_s in + let finish = Sys.time() in + let _ = report + (sprintf "Verification time: %f" (finish -. start)) in + result;; + +Arith_cache.print_stat();; +Arith_float.print_stat();; + +(* 104321 *) +mem_stat();; +Gc.compact();; +(* 84679 *) +mem_stat();; + +reset_all();; +Gc.compact();; +(* 80643 *) +mem_stat();; + +(* 100 (cached, float_cached, pp = 8): 233.80 *) +let _ = + let start = Sys.time() in + let result = m_verify_raw0 n pp (eval_d0, eval_dd0, eval_0, eval_dih_y_hi) c_dih_y_s2 xx1_s2 zz1_s2 in + let finish = Sys.time() in + let _ = report + (sprintf "Verification time: %f" (finish -. start)) in + result;; + +Arith_cache.print_stat();; +Arith_float.print_stat();; + +(* 135718 (after two runs) *) +mem_stat();; +Gc.compact();; +(* 101048 *) +mem_stat();; + +reset_all();; +Gc.compact();; +(* 81711 *) +mem_stat();; + + +(* 15202 *) +let _ = + let start = Sys.time() in + let result = m_verify_raw0 n pp (eval_d0, eval_dd0, eval_0, eval_dih_y_hi) c_dih_y0 xx1 zz1 in + let finish = Sys.time() in + let _ = report + (sprintf "Verification time: %f" (finish -. start)) in + result;; diff --git a/formal_lp/old/formal_interval/m_verifier.hl b/formal_lp/old/formal_interval/m_verifier.hl new file mode 100644 index 0000000..1126619 --- /dev/null +++ b/formal_lp/old/formal_interval/m_verifier.hl @@ -0,0 +1,1331 @@ +needs "../formal_lp/formal_interval/m_taylor.hl";; +needs "../formal_lp/formal_interval/m_verifier0.hl";; +needs "../formal_lp/arith/informal/informal_m_verifier.hl";; + + +let mk_real_vars n name = map (fun i -> mk_var (sprintf "%s%d" name i, real_ty)) (1--n);; + + +(*************************************) + +let BOUNDED_INTERVAL_ARITH_IMP_HI' = (MY_RULE o prove) + (`(!x. x IN interval [domain] ==> interval_arith (f x) (lo, hi)) ==> + (!x. x IN interval [domain] ==> f x <= hi)`, SIMP_TAC[interval_arith]);; + +let BOUNDED_INTERVAL_ARITH_IMP_LO' = (MY_RULE o prove) + (`(!x. x IN interval [domain] ==> interval_arith (f x) (lo, hi)) ==> + (!x. x IN interval [domain] ==> lo <= f x)`, SIMP_TAC[interval_arith]);; + + +let eval_interval_arith_hi n bound_th = + let tm0 = (snd o dest_forall o concl) bound_th in + let int_tm, concl_tm = dest_comb tm0 in + let domain_tm = (rand o rator o rand o rand o rand) int_tm in + let ltm, bounds_tm = dest_interval_arith concl_tm in + let f_tm, (lo_tm, hi_tm) = rator ltm, dest_pair bounds_tm in + let f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + (MY_PROVE_HYP bound_th o + INST[f_tm, f_var; domain_tm, domain_var; hi_tm, hi_var_real; lo_tm, lo_var_real] o + inst_first_type_var n_type_array.(n)) BOUNDED_INTERVAL_ARITH_IMP_HI';; + + +let eval_interval_arith_lo n bound_th = + let tm0 = (snd o dest_forall o concl) bound_th in + let int_tm, concl_tm = dest_comb tm0 in + let domain_tm = (rand o rator o rand o rand o rand) int_tm in + let ltm, bounds_tm = dest_interval_arith concl_tm in + let f_tm, (lo_tm, hi_tm) = rator ltm, dest_pair bounds_tm in + let f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + (MY_PROVE_HYP bound_th o + INST[f_tm, f_var; domain_tm, domain_var; hi_tm, hi_var_real; lo_tm, lo_var_real] o + inst_first_type_var n_type_array.(n)) BOUNDED_INTERVAL_ARITH_IMP_LO';; + + + +(*************************************) +(* subdomains *) + +let eval_subset_trans = + let SUBSET_TRANS' = MY_RULE SUBSET_TRANS in + fun st_th tu_th -> + let ltm, t_tm = dest_comb (concl st_th) in + let s_tm = rand ltm and + u_tm = rand (concl tu_th) in + let ty = (hd o snd o dest_type o type_of) s_tm and + s_var = mk_var ("s", type_of s_tm) and + t_var = mk_var ("t", type_of t_tm) and + u_var = mk_var ("u", type_of u_tm) in + (MY_PROVE_HYP st_th o MY_PROVE_HYP tu_th o + INST[s_tm, s_var; t_tm, t_var; u_tm, u_var] o inst_first_type_var ty) SUBSET_TRANS';; + +let eval_subset_refl = + let SUBSET_REFL' = MY_RULE SUBSET_REFL in + fun s_tm -> + let ty = (hd o snd o dest_type o type_of) s_tm and + s_var = mk_var ("s", type_of s_tm) in + (INST[s_tm, s_var] o inst_first_type_var ty) SUBSET_REFL';; + + + +let SUBSET_INTERVAL_IMP = prove(`!a b c d. (!i. i IN 1..dimindex (:N) ==> a$i <= c$i /\ d$i <= b$i) ==> + interval [c:real^N,d] SUBSET interval [a,b]`, + SIMP_TAC[SUBSET_INTERVAL; GSYM IN_NUMSEG]);; + + +let gen_subset_interval_lemma n = + let a_vars = mk_real_vars n "a" and + b_vars = mk_real_vars n "b" and + c_vars = mk_real_vars n "c" and + d_vars = mk_real_vars n "d" in + + let a_tm = mk_vector_list a_vars and + b_tm = mk_vector_list b_vars and + c_tm = mk_vector_list c_vars and + d_tm = mk_vector_list d_vars in + + let th0 = (SPEC_ALL o ISPECL [a_tm; b_tm; c_tm; d_tm]) SUBSET_INTERVAL_IMP in + let th1 = REWRITE_RULE[dimindex_array.(n); IN_NUMSEG; gen_in_interval n; ARITH] th0 in + let th2 = REWRITE_RULE (Array.to_list comp_thms_array.(n)) th1 in + MY_RULE th2;; + + +let subset_interval_thms_array = Array.init (max_dim + 1) + (fun n -> if n < 1 then TRUTH else gen_subset_interval_lemma n);; + + + +let m_subset_interval n a_tm b_tm c_tm d_tm = + let a_vars = mk_real_vars n "a" and + b_vars = mk_real_vars n "b" and + c_vars = mk_real_vars n "c" and + d_vars = mk_real_vars n "d" in + + let a_s = dest_vector a_tm and + b_s = dest_vector b_tm and + c_s = dest_vector c_tm and + d_s = dest_vector d_tm in + + let th0 = (INST (zip a_s a_vars) o INST (zip b_s b_vars) o + INST (zip c_s c_vars) o INST (zip d_s d_vars)) subset_interval_thms_array.(n) in + let prove_le tm = + let ltm, rtm = dest_binop le_op_real tm in + EQT_ELIM (float_le ltm rtm) in + let hyp_ths = map prove_le (hyp th0) in + itlist (fun hyp_th th -> MY_PROVE_HYP hyp_th th) hyp_ths th0;; + + +(* +let pp = 5;; +let n = 2;; + +let aa = `[&1; &1]` and bb = `[&3; &2]` and + cc = `[#1.5; &1]` and dd = `[&3; #1.6]`;; +let a_tm = mk_vector (convert_to_float_list pp true aa) and + b_tm = mk_vector (convert_to_float_list pp false bb) and + c_tm = mk_vector (convert_to_float_list pp true cc) and + d_tm = mk_vector (convert_to_float_list pp false dd);; + + +m_subset_interval n a_tm b_tm c_tm d_tm;; +(* 10: 0.704 *) +test 1000 (m_subset_interval n a_tm b_tm c_tm) d_tm;; +*) + +(*************************************) + +let M_RESTRICT_RIGHT_LEMMA = prove(`!j x z y w u y' w'. m_cell_domain (x:real^N,z) y w /\ + (!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> + u$i = x$i /\ y'$i = y$i /\ w'$i = w$i) /\ + u$j = z$j /\ y'$j = z$j /\ w'$j = &0 ==> + m_cell_domain (u,z) y' w' /\ interval [u,z] SUBSET interval [x,z]`, + REWRITE_TAC[m_cell_domain; SUBSET_INTERVAL; GSYM IN_NUMSEG] THEN REPEAT GEN_TAC THEN STRIP_TAC THEN + CONJ_TAC THENL + [ + GEN_TAC THEN DISCH_TAC THEN + ASM_CASES_TAC `i = j:num` THENL + [ + ASM_REWRITE_TAC[REAL_LE_REFL; REAL_SUB_REFL; real_max]; + ALL_TAC + ] THEN + REPEAT (FIRST_ASSUM (new_rewrite [] []) THEN ASM_REWRITE_TAC[]); + ALL_TAC + ] THEN + DISCH_TAC THEN GEN_TAC THEN DISCH_TAC THEN + ASM_CASES_TAC `i = j:num` THENL + [ + ASM_REWRITE_TAC[REAL_LE_REFL] THEN + REPEAT (FIRST_X_ASSUM (MP_TAC o SPEC `j:num`)) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + REPEAT (FIRST_ASSUM (new_rewrite [] [])) THEN ASM_REWRITE_TAC[REAL_LE_REFL]);; + + + +let M_RESTRICT_LEFT_LEMMA = prove(`!j x z y w u y' w'. m_cell_domain (x:real^N,z) y w /\ + (!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> + u$i = z$i /\ y'$i = y$i /\ w'$i = w$i) /\ + u$j = x$j /\ y'$j = x$j /\ w'$j = &0 ==> + m_cell_domain (x,u) y' w' /\ interval [x,u] SUBSET interval [x,z]`, + REWRITE_TAC[m_cell_domain; SUBSET_INTERVAL; GSYM IN_NUMSEG] THEN REPEAT GEN_TAC THEN STRIP_TAC THEN + CONJ_TAC THENL + [ + GEN_TAC THEN DISCH_TAC THEN + ASM_CASES_TAC `i = j:num` THENL + [ + ASM_REWRITE_TAC[REAL_LE_REFL; REAL_SUB_REFL; real_max]; + ALL_TAC + ] THEN + REPEAT (FIRST_ASSUM (new_rewrite [] []) THEN ASM_REWRITE_TAC[]); + ALL_TAC + ] THEN + DISCH_TAC THEN GEN_TAC THEN DISCH_TAC THEN + ASM_CASES_TAC `i = j:num` THENL + [ + ASM_REWRITE_TAC[REAL_LE_REFL] THEN + REPEAT (FIRST_X_ASSUM (MP_TAC o SPEC `j:num`)) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + REPEAT (FIRST_ASSUM (new_rewrite [] [])) THEN ASM_REWRITE_TAC[REAL_LE_REFL]);; + + +let gen_restrict_lemma n j left_flag = + let xs = mk_real_vars n "x" and + zs = mk_real_vars n "z" and + ys = mk_real_vars n "y" and + ws = mk_real_vars n "w" and + j_tm = mk_small_numeral j in + let a, b = if left_flag then zs, xs else xs, zs in + let x_tm = mk_vector_list xs and + z_tm = mk_vector_list zs and + y_tm = mk_vector_list ys and + w_tm = mk_vector_list ws and + u_tm = mk_vector_list (map (fun i -> List.nth (if i = j then b else a) (i - 1)) (1--n)) and + y'_tm = mk_vector_list (map (fun i -> List.nth (if i = j then b else ys) (i - 1)) (1--n)) and + w'_tm = mk_vector_list (map (fun i -> if i = j then `&0` else List.nth ws (i - 1)) (1--n)) in + + let th0 = (SPEC_ALL o ISPECL [j_tm; x_tm; z_tm; y_tm; w_tm; u_tm; y'_tm; w'_tm]) + (if left_flag then M_RESTRICT_LEFT_LEMMA else M_RESTRICT_RIGHT_LEMMA) in + let th1 = REWRITE_RULE[dimindex_array.(n); IN_NUMSEG; gen_in_interval n; ARITH] th0 in + let th2 = REWRITE_RULE (Array.to_list comp_thms_array.(n)) th1 in + MY_RULE_FLOAT th2;; + + +let left_restrict_thms_array = Array.init (max_dim + 1) + (fun n -> Array.init (n + 1) + (fun j -> if j < 1 then TRUTH else gen_restrict_lemma n j true));; + + +let right_restrict_thms_array = Array.init (max_dim + 1) + (fun n -> Array.init (n + 1) + (fun j -> if j < 1 then TRUTH else gen_restrict_lemma n j false));; + + + + +(******************************) +(* m_cell_pass *) + + + +let m_cell_pass = new_definition `m_cell_pass f domain <=> (!x. x IN interval [domain] ==> f x < &0)`;; + +let dest_m_cell_pass pass_tm = + let ltm, domain = dest_comb pass_tm in + rand ltm, domain;; + + +(*********************************) + +let M_CELL_PASS_LEMMA = prove(`(!x. x IN interval [domain] ==> f x <= hi) /\ (hi < &0 <=> T) ==> + m_cell_pass f domain`, + REWRITE_TAC[m_cell_pass] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `hi:real` THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]);; + +let M_CELL_PASS_LEMMA' = MY_RULE M_CELL_PASS_LEMMA;; + +let M_CELL_PASS_INTERVAL_LEMMA' = (MY_RULE o prove) + (`(!x. x IN interval [domain] ==> interval_arith (f x) (lo, hi)) /\ hi < &0 ==> m_cell_pass f domain`, + REWRITE_TAC[interval_arith] THEN STRIP_TAC THEN MATCH_MP_TAC M_CELL_PASS_LEMMA THEN + ASM_SIMP_TAC[]);; + +let M_CELL_PASS_SUBSET' = (MY_RULE o prove)(`m_cell_pass f domain /\ + interval [domain2] SUBSET interval [domain] ==> + m_cell_pass f domain2`, + REWRITE_TAC[m_cell_pass; SUBSET] THEN REPEAT STRIP_TAC THEN + REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]);; + +(* m_cell_pass with taylor_interval *) +let m_taylor_cell_pass n pp m_taylor_th = + let upper_th = eval_m_taylor_upper_bound n pp m_taylor_th in + let tm0 = (snd o dest_forall o concl) upper_th in + let int_tm, concl_tm = dest_comb tm0 in + let domain_tm = (rand o rator o rand o rand o rand) int_tm in + let ltm, hi_tm = dest_comb concl_tm in + let f_tm = (rator o rand) ltm in + let f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + + let hi_lt0_th = float_lt0 hi_tm in + if (fst o dest_const o rand o concl) hi_lt0_th = "F" then + failwith "m_taylor_cell_pass: hi < &0 <=> F" + else + (MY_PROVE_HYP upper_th o MY_PROVE_HYP hi_lt0_th o + INST[f_tm, f_var; domain_tm, domain_var; hi_tm, hi_var_real] o + inst_first_type_var n_type_array.(n)) M_CELL_PASS_LEMMA';; + + +(* m_cell_pass with a raw interval *) +let m_taylor_cell_pass0 n bound_th = + let tm0 = (snd o dest_forall o concl) bound_th in + let int_tm, concl_tm = dest_comb tm0 in + let domain_tm = (rand o rator o rand o rand o rand) int_tm in + let ltm, bounds_tm = dest_interval_arith concl_tm in + let f_tm, (lo_tm, hi_tm) = rator ltm, dest_pair bounds_tm in + let f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + let hi_lt0_th = try EQT_ELIM (float_lt0 hi_tm) with Failure _ -> failwith "m_taylor_cell_pass0" in + (MY_PROVE_HYP bound_th o MY_PROVE_HYP hi_lt0_th o + INST[f_tm, f_var; domain_tm, domain_var; hi_tm, hi_var_real; lo_tm, lo_var_real] o + inst_first_type_var n_type_array.(n)) M_CELL_PASS_INTERVAL_LEMMA';; + + +(**********************) + +let M_CELL_PASS_SUBDOMAIN' = (MY_RULE o prove)(`interval [domain2] SUBSET interval [domain] /\ + m_cell_pass f domain ==> m_cell_pass f domain2`, + REWRITE_TAC[m_cell_pass; SUBSET] THEN REPEAT STRIP_TAC THEN ASM_SIMP_TAC[]);; + + +let m_cell_pass_subdomain domain2_tm pass_th = + let f_tm, domain_tm = dest_m_cell_pass (concl pass_th) in + let f_var = mk_var ("f", type_of f_tm) and + domain_var = mk_var ("domain", type_of domain_tm) and + domain2_var = mk_var ("domain2", type_of domain2_tm) in + let a, b = dest_pair domain_tm and + c, d = dest_pair domain2_tm in + let n = get_dim a in + let sub_th = m_subset_interval n a b c d in + (MY_PROVE_HYP sub_th o MY_PROVE_HYP pass_th o + INST[domain_tm, domain_var; domain2_tm, domain2_var; f_tm, f_var] o + inst_first_type_var n_type_array.(n)) M_CELL_PASS_SUBDOMAIN';; + + + + + +(******************************) + +let M_CELL_PASS_GLUE_LEMMA = prove(`!j x z v u f. + (!i. 1 <= i /\ i <= dimindex (:N) ==> ~(i = j) ==> + u$i = x$i /\ v$i = z$i) ==> + v$j = u$j ==> + m_cell_pass f (x,v) ==> + m_cell_pass f (u,z) ==> + m_cell_pass f (x,z:real^N)`, + REWRITE_TAC[m_cell_pass; IN_INTERVAL] THEN REPEAT GEN_TAC THEN + move ["eq1"; "eq_vu"; "cell1"; "cell2"; "y"; "ineq"] THEN + ASM_CASES_TAC `(y:real^N)$j <= (v:real^N)$j` THENL + [ + REMOVE_THEN "cell1" MATCH_MP_TAC THEN GEN_TAC THEN DISCH_TAC THEN + USE_THEN "ineq" (new_rewrite [] []) THEN ASM_REWRITE_TAC[] THEN + ASM_CASES_TAC `i = j:num` THENL + [ + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN SIMP_TAC[]; + ALL_TAC + ] THEN + USE_THEN "eq1" (new_rewrite [] []) THEN ASM_REWRITE_TAC[] THEN + USE_THEN "ineq" (new_rewrite [] []) THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + POP_ASSUM (ASSUME_TAC o MATCH_MP (REAL_ARITH `~(a <= b) ==> b <= a:real`)) THEN + REMOVE_THEN "cell2" MATCH_MP_TAC THEN GEN_TAC THEN DISCH_TAC THEN + USE_THEN "ineq" (new_rewrite [] []) THEN ASM_REWRITE_TAC[] THEN + ASM_CASES_TAC `i = j:num` THENL + [ + ASM_REWRITE_TAC[] THEN USE_THEN "eq_vu" (fun th -> REWRITE_TAC[SYM th]) THEN + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN SIMP_TAC[]; + ALL_TAC + ] THEN + USE_THEN "eq1" (new_rewrite [] []) THEN ASM_REWRITE_TAC[] THEN + USE_THEN "ineq" (new_rewrite [] []) THEN ASM_REWRITE_TAC[]);; + + +let gen_glue_lemma n j = + let mk_vars name = map (fun i -> mk_var (sprintf "%s%d" name i, real_ty)) (1--n) in + let xs = mk_vars "x" and + zs = mk_vars "z" and + t_var = mk_var ("t", real_ty) and + j_tm = mk_small_numeral j in + let x_tm = mk_vector_list xs and + z_tm = mk_vector_list zs and + v_tm = mk_vector_list (map (fun i -> if i = j then t_var else List.nth zs (i - 1)) (1--n)) and + u_tm = mk_vector_list (map (fun i -> if i = j then t_var else List.nth xs (i - 1)) (1--n)) in + + let th0 = (SPEC_ALL o ISPECL [j_tm; x_tm; z_tm; v_tm; u_tm]) M_CELL_PASS_GLUE_LEMMA in + let th1 = REWRITE_RULE[dimindex_array.(n); gen_in_interval n; ARITH] th0 in + let th2 = REWRITE_RULE (Array.to_list comp_thms_array.(n)) th1 in + MY_RULE th2;; + + +let glue_thms_array = Array.init (max_dim + 1) + (fun n -> Array.init (n + 1) + (fun j -> if j < 1 then TRUTH else gen_glue_lemma n j));; + + + +(***************************************) + +let M_CELL_SUP = prove(`!f x z. lift o f continuous_on interval [x,z:real^N] /\ m_cell_pass f (x,z) ==> + ?a. a < &0 /\ !y. y IN interval [x,z] ==> f y <= a`, + REWRITE_TAC[m_cell_pass] THEN REPEAT STRIP_TAC THEN + ASM_CASES_TAC `interval [x:real^N,z] = {}` THENL + [ + EXISTS_TAC `-- &1` THEN ASM_REWRITE_TAC[NOT_IN_EMPTY] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + MP_TAC (SPECL [`f:real^N->real`; `interval [x,z:real^N]`] CONTINUOUS_ATTAINS_SUP) THEN + ASM_REWRITE_TAC[COMPACT_INTERVAL] THEN + DISCH_THEN (X_CHOOSE_THEN `y:real^N` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `(f:real^N->real) y` THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]);; + + +let DIFF2_DOMAIN_IMP_CONTINUOUS_ON = prove(`!(f:real^N->real) domain. diff2_domain domain f ==> + lift o f continuous_on interval [domain]`, + REWRITE_TAC[diff2_domain] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC CONTINUOUS_AT_IMP_CONTINUOUS_ON THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC DIFFERENTIABLE_IMP_CONTINUOUS_AT THEN + MATCH_MP_TAC diff2_imp_diff THEN + ASM_SIMP_TAC[]);; + + + +let M_CELL_INCREASING_PASS_LEMMA = prove(`!j x z u domain lo f. + interval [x,z] SUBSET interval [domain] ==> + diff2c_domain domain f ==> + (!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = x$i) ==> + u$j = z$j ==> + &0 <= lo ==> + (!y. y IN interval [domain] ==> lo <= partial j f y) ==> + m_cell_pass f (u,z) ==> + m_cell_pass f (x,z:real^N)`, + REWRITE_TAC[SUBSET] THEN REPEAT STRIP_TAC THEN REWRITE_TAC[m_cell_pass] THEN + X_GEN_TAC `y:real^N` THEN + ASM_CASES_TAC `~(!i. i IN 1..dimindex (:N) ==> (x:real^N)$i <= (z:real^N)$i)` THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[NOT_FORALL_THM; NOT_IMP; IN_INTERVAL; GSYM IN_NUMSEG] THEN + DISCH_THEN (CHOOSE_THEN STRIP_ASSUME_TAC) THEN + DISCH_THEN (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[negbK] THEN DISCH_TAC THEN + SUBGOAL_THEN `diff2_domain domain (f:real^N->real)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + SIMP_TAC[diff2_domain; diff2c_domain; diff2c]; + ALL_TAC + ] THEN + MP_TAC (SPECL [`f:real^N->real`; `u:real^N`; `z:real^N`] M_CELL_SUP) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC DIFF2_DOMAIN_IMP_CONTINUOUS_ON THEN + UNDISCH_TAC `diff2_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2_domain] THEN REPEAT STRIP_TAC THEN + REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[IN_INTERVAL] THEN DISCH_TAC THEN GEN_TAC THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[IN_NUMSEG] THEN + ASM_CASES_TAC `i = j:num` THENL [ ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; ALL_TAC] THEN + FIRST_X_ASSUM (new_rewrite [] []) THEN ASM_REWRITE_TAC[IN_NUMSEG]; + ALL_TAC + ] THEN + DISCH_THEN (CHOOSE_THEN STRIP_ASSUME_TAC) THEN DISCH_TAC THEN + MP_TAC (SPECL [`f:real^N->real`; `j:num`; `u:real^N`; `x:real^N`; `z:real^N`; `a:real`] partial_increasing_right) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL + [ + REPEAT STRIP_TAC THEN + MATCH_MP_TAC diff2_imp_diff THEN + UNDISCH_TAC `diff2_domain domain (f:real^N->real)` THEN REWRITE_TAC[diff2_domain] THEN + DISCH_THEN MATCH_MP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ANTS_TAC THENL + [ + REPEAT STRIP_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `lo:real` THEN ASM_REWRITE_TAC[] THEN + REPEAT (FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + ALL_TAC + ] THEN + DISCH_TAC THEN MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `a:real` THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]);; + + + +let M_CELL_DECREASING_PASS_LEMMA = prove(`!j x z u domain hi f. + interval [x,z] SUBSET interval [domain] ==> + diff2c_domain domain f ==> + (!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = z$i) ==> + u$j = x$j ==> + hi <= &0 ==> + (!y. y IN interval [domain] ==> partial j f y <= hi) ==> + m_cell_pass f (x,u) ==> + m_cell_pass f (x,z:real^N)`, + REWRITE_TAC[SUBSET] THEN REPEAT STRIP_TAC THEN REWRITE_TAC[m_cell_pass] THEN X_GEN_TAC `y:real^N` THEN + ASM_CASES_TAC `~(!i. i IN 1..dimindex (:N) ==> (x:real^N)$i <= (z:real^N)$i)` THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[NOT_FORALL_THM; NOT_IMP; IN_INTERVAL; GSYM IN_NUMSEG] THEN + DISCH_THEN (CHOOSE_THEN STRIP_ASSUME_TAC) THEN + DISCH_THEN (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[negbK] THEN DISCH_TAC THEN + SUBGOAL_THEN `diff2_domain domain (f:real^N->real)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain domain (f:real^N->real)` THEN + SIMP_TAC[diff2_domain; diff2c_domain; diff2c]; + ALL_TAC + ] THEN + MP_TAC (SPECL [`f:real^N->real`; `x:real^N`; `u:real^N`] M_CELL_SUP) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC DIFF2_DOMAIN_IMP_CONTINUOUS_ON THEN + UNDISCH_TAC `diff2_domain domain (f:real^N->real)` THEN + REWRITE_TAC[diff2_domain] THEN REPEAT STRIP_TAC THEN + REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[IN_INTERVAL] THEN DISCH_TAC THEN GEN_TAC THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[IN_NUMSEG] THEN + ASM_CASES_TAC `i = j:num` THENL [ ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; ALL_TAC] THEN + FIRST_X_ASSUM (new_rewrite [] []) THEN ASM_REWRITE_TAC[IN_NUMSEG]; + ALL_TAC + ] THEN + DISCH_THEN (CHOOSE_THEN STRIP_ASSUME_TAC) THEN DISCH_TAC THEN + MP_TAC (SPECL [`f:real^N->real`; `j:num`; `u:real^N`; `x:real^N`; `z:real^N`; `a:real`] partial_decreasing_left) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL + [ + REPEAT STRIP_TAC THEN + MATCH_MP_TAC diff2_imp_diff THEN + UNDISCH_TAC `diff2_domain domain (f:real^N->real)` THEN REWRITE_TAC[diff2_domain] THEN + DISCH_THEN MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ANTS_TAC THENL + [ + REPEAT STRIP_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `hi:real` THEN ASM_REWRITE_TAC[] THEN + REPEAT (FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + ALL_TAC + ] THEN + DISCH_TAC THEN MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `a:real` THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]);; + + + +let M_CELL_CONVEX_PASS_LEMMA = prove(`!j x z u v lo f. + diff2c_domain (x,z) f ==> + (!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = z$i /\ v$i = x$i) ==> + u$j = x$j ==> v$j = z$j ==> + &0 <= lo ==> + (!y. y IN interval [x,z] ==> lo <= partial2 j j f y) ==> + m_cell_pass f (x,u) ==> + m_cell_pass f (v,z) ==> + m_cell_pass f (x:real^N,z)`, + REPEAT STRIP_TAC THEN REWRITE_TAC[m_cell_pass] THEN + X_GEN_TAC `y:real^N` THEN DISCH_TAC THEN + SUBGOAL_THEN `!i. i IN 1..dimindex (:N) ==> (x:real^N)$i <= (z:real^N)$i` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[IN_INTERVAL] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `(y:real^N)$i` THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[GSYM IN_NUMSEG]; + ALL_TAC + ] THEN + SUBGOAL_THEN `diff2_domain (x,z) (f:real^N->real)` ASSUME_TAC THENL + [ + UNDISCH_TAC `diff2c_domain (x,z) (f:real^N->real)` THEN + SIMP_TAC[diff2_domain; diff2c_domain; diff2c]; + ALL_TAC + ] THEN + MP_TAC (SPECL [`f:real^N->real`; `v:real^N`; `z:real^N`] M_CELL_SUP) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC DIFF2_DOMAIN_IMP_CONTINUOUS_ON THEN + UNDISCH_TAC `diff2_domain (x,z) (f:real^N->real)` THEN + REWRITE_TAC[diff2_domain] THEN REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[IN_INTERVAL] THEN DISCH_TAC THEN GEN_TAC THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[IN_NUMSEG] THEN + ASM_CASES_TAC `i = j:num` THENL [ ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; ALL_TAC] THEN + FIRST_X_ASSUM (new_rewrite [] []) THEN ASM_REWRITE_TAC[IN_NUMSEG]; + ALL_TAC + ] THEN + DISCH_THEN (CHOOSE_THEN STRIP_ASSUME_TAC) THEN + + MP_TAC (SPECL [`f:real^N->real`; `x:real^N`; `u:real^N`] M_CELL_SUP) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC DIFF2_DOMAIN_IMP_CONTINUOUS_ON THEN + UNDISCH_TAC `diff2_domain (x,z) (f:real^N->real)` THEN + REWRITE_TAC[diff2_domain] THEN REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[IN_INTERVAL] THEN DISCH_TAC THEN GEN_TAC THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[IN_NUMSEG] THEN + ASM_CASES_TAC `i = j:num` THENL [ ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; ALL_TAC] THEN + FIRST_X_ASSUM (new_rewrite [] []) THEN ASM_REWRITE_TAC[IN_NUMSEG]; + ALL_TAC + ] THEN + DISCH_THEN (CHOOSE_THEN STRIP_ASSUME_TAC) THEN + + MP_TAC (SPECL [`f:real^N->real`; `j:num`; `x:real^N`; `z:real^N`; `u:real^N`; `v:real^N`; `max a a'`] partial_convex_max) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL + [ + REPEAT STRIP_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `lo:real` THEN ASM_REWRITE_TAC[] THEN + REPEAT (FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + ALL_TAC + ] THEN + ANTS_TAC THENL + [ + REPEAT STRIP_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a':real` THEN + ASM_SIMP_TAC[] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + ANTS_TAC THENL + [ + REPEAT STRIP_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a:real` THEN + ASM_SIMP_TAC[] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_TAC THEN MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `max a a'` THEN + ASM_SIMP_TAC[] THEN + ASM_REAL_ARITH_TAC);; + + + +(*********************) + +let ZERO_EQ_ZERO_CONST = prove(`0 = _0`, REWRITE_TAC[NUMERAL]);; + +let gen_increasing_lemma n j = + let mk_vars name = map (fun i -> mk_var (sprintf "%s%d" name i, real_ty)) (1--n) in + let xs = mk_vars "x" and + zs = mk_vars "z" and + j_tm = mk_small_numeral j in + let x_tm = mk_vector_list xs and + z_tm = mk_vector_list zs and + u_tm = mk_vector_list (map (fun i -> List.nth (if i = j then zs else xs) (i - 1)) (1--n)) in + let th0 = (SPEC_ALL o ISPECL [j_tm; x_tm; z_tm; u_tm]) M_CELL_INCREASING_PASS_LEMMA in + let th1 = REWRITE_RULE[dimindex_array.(n); IN_NUMSEG; gen_in_interval n; ARITH] th0 in + let th2 = REWRITE_RULE (Array.to_list comp_thms_array.(n)) th1 in + let th3 = MY_RULE_NUM th2 in + (UNDISCH_ALL o ONCE_REWRITE_RULE[GSYM ZERO_EQ_ZERO_CONST] o DISCH (last (hyp th3))) th3;; + + +let gen_mono_lemma0 th = + let h2 = List.nth (hyp th) 1 in + let domain_tm = (lhand o rand o lhand) h2 in + let domain_var = mk_var ("domain", type_of domain_tm) in + (UNDISCH_ALL o REWRITE_RULE[SUBSET_REFL] o DISCH_ALL o INST[domain_tm, domain_var]) th;; + +let incr_gen_thms_array = Array.init (max_dim + 1) + (fun n -> Array.init (n + 1) + (fun j -> if j < 1 then TRUTH else gen_increasing_lemma n j));; + +let incr_thms_array = Array.init (max_dim + 1) + (fun n -> Array.init (n + 1) + (fun j -> if j < 1 then TRUTH else gen_mono_lemma0 incr_gen_thms_array.(n).(j)));; + + + +let gen_decreasing_lemma n j = + let mk_vars name = map (fun i -> mk_var (sprintf "%s%d" name i, real_ty)) (1--n) in + let xs = mk_vars "x" and + zs = mk_vars "z" and + j_tm = mk_small_numeral j in + let x_tm = mk_vector_list xs and + z_tm = mk_vector_list zs and + u_tm = mk_vector_list (map (fun i -> List.nth (if i = j then xs else zs) (i - 1)) (1--n)) in + let th0 = (SPEC_ALL o ISPECL [j_tm; x_tm; z_tm; u_tm]) M_CELL_DECREASING_PASS_LEMMA in + let th1 = REWRITE_RULE[dimindex_array.(n); IN_NUMSEG; gen_in_interval n; ARITH] th0 in + let th2 = REWRITE_RULE (Array.to_list comp_thms_array.(n)) th1 in + let th3 = MY_RULE_NUM th2 in + (UNDISCH_ALL o ONCE_REWRITE_RULE[GSYM ZERO_EQ_ZERO_CONST] o DISCH (last (hyp th3))) th3;; + + +let decr_gen_thms_array = Array.init (max_dim + 1) + (fun n -> Array.init (n + 1) + (fun j -> if j < 1 then TRUTH else gen_decreasing_lemma n j));; + +let decr_thms_array = Array.init (max_dim + 1) + (fun n -> Array.init (n + 1) + (fun j -> if j < 1 then TRUTH else gen_mono_lemma0 decr_gen_thms_array.(n).(j)));; + + +(****************************************) + +let gen_convex_max_lemma n j = + let xs = mk_real_vars n "x" and + zs = mk_real_vars n "z" and + j_tm = mk_small_numeral j in + let x_tm = mk_vector_list xs and + z_tm = mk_vector_list zs and + u_tm = mk_vector_list (map (fun i -> List.nth (if i = j then xs else zs) (i - 1)) (1--n)) and + v_tm = mk_vector_list (map (fun i -> List.nth (if i = j then zs else xs) (i - 1)) (1--n)) in + let th0 = (SPEC_ALL o ISPECL [j_tm; x_tm; z_tm; u_tm; v_tm]) M_CELL_CONVEX_PASS_LEMMA in + let th1 = REWRITE_RULE[dimindex_array.(n); IN_NUMSEG; gen_in_interval n; ARITH] th0 in + let th2 = REWRITE_RULE (Array.to_list comp_thms_array.(n)) th1 in + let th3 = MY_RULE_NUM th2 in + (UNDISCH_ALL o ONCE_REWRITE_RULE[GSYM ZERO_EQ_ZERO_CONST] o DISCH (last (hyp th3))) th3;; + + +let convex_thms_array = Array.init (max_dim + 1) + (fun n -> Array.init (n + 1) + (fun j -> if j < 1 then TRUTH else gen_convex_max_lemma n j));; + + + +(******************************************) + +let m_glue_cells n j pass_th1 pass_th2 = + let f_tm, domain1 = dest_m_cell_pass (concl pass_th1) and + domain2 = rand (concl pass_th2) in + let x1, z1 = dest_pair domain1 and + x2, z2 = dest_pair domain2 in + + let x1s = dest_vector x1 and + x2s = dest_vector x2 and + z2s = dest_vector z2 in + + let x_vars = map (fun i -> x_vars_array.(i)) (1--n) and + z_vars = map (fun i -> z_vars_array.(i)) (1--n) and + f_var = mk_var ("f", type_of f_tm) and + t_tm = List.nth x2s (j - 1) in + + let th0 = (INST[t_tm, t_var_real; f_tm, f_var] o + INST (zip z2s z_vars) o INST (zip x1s x_vars)) glue_thms_array.(n).(j) in + (MY_PROVE_HYP pass_th1 o MY_PROVE_HYP pass_th2) th0;; + + +(**********************) + +let m_mono_pass_gen n j decr_flag diff2_th partial_mono_th sub_th pass_th = + let f_tm, domain0 = dest_m_cell_pass (concl pass_th) and + domain = (rand o rator o concl) diff2_th and + xv, zv = (dest_pair o lhand o rand o lhand o concl) sub_th and + bound_tm = ((if decr_flag then rand else lhand) o rand o snd o dest_forall o concl) partial_mono_th in + + let xs = dest_vector xv and + zs = dest_vector zv in + + let x_vars = map (fun i -> x_vars_array.(i)) (1--n) and + z_vars = map (fun i -> z_vars_array.(i)) (1--n) and + domain_var = mk_var ("domain", type_of domain) and + f_var = mk_var ("f", type_of f_tm) and + bound_var = mk_var ((if decr_flag then "hi" else "lo"), real_ty) in + + let le_th0 = (if decr_flag then float_le0 else float_ge0) bound_tm in + let le_th = try EQT_ELIM le_th0 with Failure _ -> + failwith (sprintf "m_mono_pass_gen: j = %d, th = %s" j (string_of_thm le_th0)) in + + let th0 = (INST[f_tm, f_var; bound_tm, bound_var; domain, domain_var] o + INST (zip xs x_vars) o INST (zip zs z_vars)) + (if decr_flag then decr_gen_thms_array.(n).(j) else incr_gen_thms_array.(n).(j)) in + (MY_PROVE_HYP le_th o MY_PROVE_HYP pass_th o MY_PROVE_HYP diff2_th o + MY_PROVE_HYP sub_th o MY_PROVE_HYP partial_mono_th) th0;; + + + +(* m_incr_pass *) +let m_incr_pass n pp j m_taylor_th pass_th0 = + let _, diff2_th, _, _ = dest_m_taylor_thms n m_taylor_th in + let partial_bound = eval_m_taylor_partial_lower n pp j m_taylor_th in + + let f_tm, domain0 = dest_m_cell_pass (concl pass_th0) and + domain = (rand o rator o concl) diff2_th and + lo_tm = (lhand o rand o snd o dest_forall o concl) partial_bound in + let lo_ge0_th = EQT_ELIM (float_ge0 lo_tm) in + + let x_tm, z_tm = dest_pair domain in + let xs = dest_vector x_tm and + zs = dest_vector z_tm in + + let x_vars = map (fun i -> x_vars_array.(i)) (1--n) and + z_vars = map (fun i -> z_vars_array.(i)) (1--n) and + f_var = mk_var ("f", type_of f_tm) in + let th0 = (INST[f_tm, f_var; lo_tm, lo_var_real] o + INST (zip zs z_vars) o INST (zip xs x_vars)) incr_thms_array.(n).(j) in + (MY_PROVE_HYP lo_ge0_th o MY_PROVE_HYP pass_th0 o + MY_PROVE_HYP diff2_th o MY_PROVE_HYP partial_bound) th0;; + + +(* m_decr_pass *) +let m_decr_pass n pp j m_taylor_th pass_th0 = + let _, diff2_th, _, _ = dest_m_taylor_thms n m_taylor_th in + let partial_bound = eval_m_taylor_partial_upper n pp j m_taylor_th in + + let f_tm, domain0 = dest_m_cell_pass (concl pass_th0) and + domain = (rand o rator o concl) diff2_th and + hi_tm = (rand o rand o snd o dest_forall o concl) partial_bound in + let hi_le0_th = EQT_ELIM (float_le0 hi_tm) in + + let x_tm, z_tm = dest_pair domain in + let xs = dest_vector x_tm and + zs = dest_vector z_tm in + + let x_vars = map (fun i -> x_vars_array.(i)) (1--n) and + z_vars = map (fun i -> z_vars_array.(i)) (1--n) and + f_var = mk_var ("f", type_of f_tm) in + let th0 = (INST[f_tm, f_var; hi_tm, hi_var_real] o + INST (zip zs z_vars) o INST (zip xs x_vars)) decr_thms_array.(n).(j) in + (MY_PROVE_HYP hi_le0_th o MY_PROVE_HYP pass_th0 o + MY_PROVE_HYP diff2_th o MY_PROVE_HYP partial_bound) th0;; + +(*************************) + +(* m_convex_pass *) +let m_convex_pass n j diff2_th partial2_bound_th pass1_th pass2_th = + let f_tm, domain1 = dest_m_cell_pass (concl pass1_th) and + _, domain2 = dest_m_cell_pass (concl pass2_th) in + let x_tm, _ = dest_pair domain1 and + _, z_tm = dest_pair domain2 and + bound_tm = (lhand o rand o snd o dest_forall o concl) partial2_bound_th in + + let xs = dest_vector x_tm and + zs = dest_vector z_tm in + + let x_vars = map (fun i -> x_vars_array.(i)) (1--n) and + z_vars = map (fun i -> z_vars_array.(i)) (1--n) and + f_var = mk_var ("f", type_of f_tm) in + + let le_th0 = float_ge0 bound_tm in + let le_th = + try EQT_ELIM le_th0 with Failure _ -> failwith ("m_convex_pass: "^string_of_thm le_th0) in + + let th0 = (INST[f_tm, f_var; bound_tm, lo_var_real] o + INST (zip xs x_vars) o INST (zip zs z_vars)) convex_thms_array.(n).(j) in + (MY_PROVE_HYP le_th o MY_PROVE_HYP pass1_th o MY_PROVE_HYP pass2_th o + MY_PROVE_HYP diff2_th o MY_PROVE_HYP partial2_bound_th) th0;; + + + + +(***********************) + +(* mk_verification_functions *) + +type verification_funs = +{ + (* p_lin -> p_second -> domain_th -> taylor_th *) + taylor : int -> int -> thm -> thm; + (* pp -> lo -> hi -> interval_th *) + f : int -> term -> term -> thm; + (* i -> pp -> lo -> hi -> interval_th *) + df : int -> int -> term -> term -> thm; + (* i -> j -> pp -> lo -> hi -> interval_th *) + ddf : int -> int -> int -> term -> term -> thm; + (* lo -> hi -> diff2_th *) + diff2_f : term -> term -> thm; +};; + + +let mk_verification_functions pp0 poly_tm min_flag value_tm = + let x_tm, body_tm = dest_abs poly_tm in + let new_expr = + uncurry (mk_binop sub_op_real) (if min_flag then value_tm, body_tm else body_tm, value_tm) in + let new_f = mk_abs (x_tm, new_expr) in + let n = get_dim x_tm in + + let partials = map (fun i -> + let _ = report (sprintf "Partial %d/%d" i n) in + gen_partial_poly i new_f) (1--n) in + let get_partial i eq_th = + let partial_i = gen_partial_poly i (rand (concl eq_th)) in + let pi = (rator o lhand o concl) partial_i in + REWRITE_RULE[GSYM partial2] (TRANS (AP_TERM pi eq_th) partial_i) in + let partials2 = map (fun j -> + let th = List.nth partials (j - 1) in + let _ = report (sprintf "Partial2 %d/%d" j n) in + map (fun i -> get_partial i th) (1--j)) (1--n) in + + let diff_th = gen_diff_poly new_f in + let lin_th = gen_lin_approx_poly_thm new_f diff_th partials in + let diff2_th = gen_diff2c_domain_poly new_f in + let second_th = gen_second_bounded_poly_thm new_f partials2 in + + let replace_numeral i th = + let num_eq = (REWRITE_RULE[Arith_hash.NUM_THM] o NUMERAL_TO_NUM_CONV) (mk_small_numeral i) in + GEN_REWRITE_RULE (LAND_CONV o RATOR_CONV o DEPTH_CONV) [num_eq] th in + + let eval0 = mk_eval_function pp0 new_f in + let eval1 = map (fun i -> + let d_th = List.nth partials (i - 1) in + let eq_th = replace_numeral i d_th in + mk_eval_function_eq pp0 eq_th) (1--n) in + + let eval2 = map (fun i -> + map (fun j -> + let d2_th = List.nth (List.nth partials2 (i - 1)) (j - 1) in + let eq_th' = replace_numeral i d2_th in + let eq_th = replace_numeral j eq_th' in + mk_eval_function_eq pp0 eq_th) (1--i)) (1--n) in + + let diff2_f = eval_diff2_poly diff2_th in + let eval_f = eval_m_taylor pp0 diff2_th lin_th second_th in + let taylor_f = build_taylor pp0 lin_th second_th in + {taylor = eval_f; + f = eval0; + df = (fun i -> List.nth eval1 (i - 1)); + ddf = (fun i j -> List.nth (List.nth eval2 (j - 1)) (i - 1)); + diff2_f = diff2_f; + }, taylor_f, Informal_verifier.mk_verification_functions pp0 new_f partials partials2;; + + +(* split_domain *) + +let split_domain n pp j domain_th = + let domain_tm, y_tm, _ = dest_m_cell_domain (concl domain_th) in + let x_tm, z_tm = dest_pair domain_tm in + let xs = dest_vector x_tm and + zs = dest_vector z_tm and + t = List.nth (dest_vector y_tm) (j - 1) in + + let vv = map (fun i -> if i = j then t else List.nth zs (i - 1)) (1--n) and + uu = map (fun i -> if i = j then t else List.nth xs (i - 1)) (1--n) in + + let domain1_th = mk_m_center_domain n pp (rand x_tm) (mk_list (vv, real_ty)) and + domain2_th = mk_m_center_domain n pp (mk_list (uu, real_ty)) (rand z_tm) in + domain1_th, domain2_th;; + + +(* restrict_domain *) + +let restrict_domain n j left_flag domain_th = + let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th) in + let x_tm, z_tm = dest_pair domain_tm in + let xs = dest_vector x_tm and + zs = dest_vector z_tm and + ys = dest_vector y_tm and + ws = dest_vector w_tm in + + let th0 = (INST (zip xs (mk_real_vars n "x")) o INST (zip zs (mk_real_vars n "z")) o + INST (zip ys (mk_real_vars n "y")) o INST (zip ws (mk_real_vars n "w"))) + (if left_flag then left_restrict_thms_array.(n).(j) else right_restrict_thms_array.(n).(j)) in + let ths = CONJUNCTS (MY_PROVE_HYP domain_th th0) in + hd ths, hd (tl ths);; + + +let convert_to_float_list pp lo_flag list_tm = + let tms = dest_list list_tm in + let i_funs = map build_interval_fun tms in + let ints = map (fun f -> eval_interval_fun pp f [] []) i_funs in + let extract = (if lo_flag then fst else snd) o dest_pair o rand o concl in + mk_list (map extract ints, real_ty);; + + + + + +(****************************************) + +(* time test for domain computations *) +let m_verify_domain_test n pp certificate xx zz = + let r_size = result_size certificate in + let k = ref 0 in + let domain_th = mk_m_center_domain n pp xx zz in + + let rec rec_verify domain_th certificate = + match certificate with + | Result_mono (mono, r1) -> + let m = hd mono in + let _ = report (sprintf "Mono: %d (%b)" m.variable m.decr_flag) in + let j, left_flag = m.variable, m.decr_flag in + let domain1_th, _ = restrict_domain n j left_flag domain_th in + let r = if tl mono = [] then r1 else Result_mono (tl mono, r1) in + rec_verify domain1_th r + + | Result_pass (f0_flag, xx, zz) -> + let _ = k := !k + 1 in + let _ = report (sprintf "Verifying: %d/%d" !k r_size) in () + + | Result_glue (i, convex_flag, r1, r2) -> + let domain1_th, domain2_th = + if convex_flag then + let d1, _ = restrict_domain n (i + 1) true domain_th and + d2, _ = restrict_domain n (i + 1) false domain_th in + d1, d2 + else + split_domain n pp (i + 1) domain_th in + let _ = rec_verify domain1_th r1 and + _ = rec_verify domain2_th r2 in () + + | _ -> failwith "False result" in + + rec_verify domain_th certificate;; + + + + + +(***************************) + +let m_verify_raw n pp fs certificate domain_th0 th_list = + let r_size = result_size certificate in + let k = ref 0 in + + let rec rec_verify = + let rec apply_trans sub_ths th0 acc = + match sub_ths with + | [] -> rev acc + | th :: ths -> + let th' = eval_subset_trans th th0 in + apply_trans ths th' (th' :: acc) in + + let rec mk_domains mono th0 acc = + match mono with + | [] -> rev acc + | m :: ms -> + let j, flag = m.variable, m.decr_flag in + let ths = restrict_domain n j flag th0 in + mk_domains ms (fst ths) (ths :: acc) in + + let verify_mono mono domain_th certificate = + let domain, _, _ = (dest_m_cell_domain o concl) domain_th in + let xx, zz = dest_pair domain in + let df0_flags = itlist (fun m b -> m.df0_flag & b) mono true in + let _ = report (sprintf "df0_flags = %b" df0_flags) in + let taylor_th, diff2_th = + if df0_flags then + TRUTH, fs.diff2_f xx zz + else + let t_th = fs.taylor pp pp domain_th in + let _, d_th, _, _ = dest_m_taylor_thms n t_th in + t_th, d_th in + + let domain_ths = mk_domains mono domain_th [] in +(* let domains = domain_th :: map fst (butlast domain_ths) in *) + +(* let gen_mono (m, domain_th) = *) + let gen_mono m = + if m.df0_flag then + if m.decr_flag then + eval_interval_arith_hi n (fs.df m.variable pp xx zz) + else + eval_interval_arith_lo n (fs.df m.variable pp xx zz) + else + if m.decr_flag then + eval_m_taylor_partial_upper n pp m.variable taylor_th + else + eval_m_taylor_partial_lower n pp m.variable taylor_th in + +(* let mono_ths = map gen_mono (zip mono domains) in *) + let mono_ths = map gen_mono mono in + let pass_th0 = rec_verify ((fst o last) domain_ths) certificate in + let sub_th0 = (eval_subset_refl o rand o concl o snd o hd) domain_ths in + let sub_ths = apply_trans (sub_th0 :: map snd (butlast domain_ths)) sub_th0 [] in + let th = rev_itlist (fun ((m, mono_th), sub_th) pass_th -> + let j, flag = m.variable, m.decr_flag in + m_mono_pass_gen n j flag diff2_th mono_th sub_th pass_th) + (rev (zip (zip mono mono_ths) sub_ths)) pass_th0 in + if hyp th <> [] then failwith ("hyp <> []: "^string_of_thm th) else th in + + + + fun domain_th certificate -> + match certificate with + | Result_mono (mono, r1) -> + let mono_strs = + map (fun m -> sprintf "%s%d (%b)" (if m.decr_flag then "-" else "") + m.variable m.df0_flag) mono in + let _ = report (sprintf "Mono: [%s]" (String.concat ";" mono_strs)) in + verify_mono mono domain_th r1 + + | Result_pass (f0_flag, xx, zz) -> + let _ = k := !k + 1 in + let _ = report (sprintf "Verifying: %d/%d (f0_flag = %b)" !k r_size f0_flag) in + if f0_flag then + let domain, _, _ = (dest_m_cell_domain o concl) domain_th in + let xx, zz = dest_pair domain in + m_taylor_cell_pass0 n (fs.f pp xx zz) + else + let taylor_th = fs.taylor pp pp domain_th in + m_taylor_cell_pass n pp taylor_th + + | Result_glue (i, convex_flag, r1, r2) -> + let domain1_th, domain2_th = + if convex_flag then + let d1, _ = restrict_domain n (i + 1) true domain_th in + let d2, _ = restrict_domain n (i + 1) false domain_th in + d1, d2 + else + split_domain n pp (i + 1) domain_th in + let th1 = rec_verify domain1_th r1 in + let th2 = rec_verify domain2_th r2 in + if convex_flag then + let _ = report (sprintf "GlueConvex: %d" (i + 1)) in + let domain, _, _ = (dest_m_cell_domain o concl) domain_th in + let xx, zz = dest_pair domain in + let diff2_th = fs.diff2_f xx zz in + let partial2_th = fs.ddf (i + 1) (i + 1) pp xx zz in + let lo_partial2_th = eval_interval_arith_lo n partial2_th in + m_convex_pass n (i + 1) diff2_th lo_partial2_th th1 th2 + else + m_glue_cells n (i + 1) th1 th2 + + | Result_pass_ref i -> + let _ = report (sprintf "Ref: %d" i) in + if i > 0 then + List.nth th_list (i - 1) + else + let domain, _, _ = (dest_m_cell_domain o concl) domain_th in + let pass_th = List.nth th_list (-i - 1) in + m_cell_pass_subdomain domain pass_th + + | _ -> failwith "False result" in + + rec_verify domain_th0 certificate;; + + +(*****************) + + +let m_verify_raw0 n pp fs certificate xx zz = + m_verify_raw n pp fs certificate (mk_m_center_domain n pp xx zz) [];; + + + +let m_verify_list n pp fs certificate_list xx zz = + let domain_hash = Hashtbl.create (length certificate_list * 10) in + let mem, find, add = Hashtbl.mem domain_hash, + Hashtbl.find domain_hash, Hashtbl.add domain_hash in + + let get_m_cell_domain n pp domain0 path = + let rec get_rec domain_th path hash = + match path with + | [] -> domain_th + | (s, j) :: ps -> + let hash' = hash^s^(string_of_int j) in + if mem hash' then + get_rec (find hash') ps hash' + else + if s = "l" or s = "r" then + let domain1_th, domain2_th = split_domain n pp j domain_th in + let hash1 = hash^"l"^(string_of_int j) and + hash2 = hash^"r"^(string_of_int j) in + let _ = add hash1 domain1_th; add hash2 domain2_th in + if s = "l" then + get_rec domain1_th ps hash' + else + get_rec domain2_th ps hash' + else + let l_flag = (s = "ml") in + let domain_th', _ = restrict_domain n j l_flag domain_th in + let _ = add hash' domain_th' in + get_rec domain_th' ps hash' in + get_rec domain0 path "" in + + let domain_th0 = mk_m_center_domain n pp xx zz in + let size = length certificate_list in + let k = ref 0 in + let rec rec_verify certificate_list th_list = + match certificate_list with + | [] -> last th_list + | (path, certificate) :: cs -> + let _ = k := !k + 1; report (sprintf "List: %d/%d" !k size) in + let domain_th = get_m_cell_domain n pp domain_th0 path in + let th = m_verify_raw n pp fs certificate domain_th th_list in + rec_verify cs (th_list @ [th]) in + rec_verify certificate_list [];; + + +(***************************) +(* Verification based on a p_result_tree *) + +let m_p_verify_raw n p_split fs certificate domain_th0 th_list = + let r_size = p_result_size certificate in + let k = ref 0 in + + let rec rec_verify = + let rec apply_trans sub_ths th0 acc = + match sub_ths with + | [] -> rev acc + | th :: ths -> + let th' = eval_subset_trans th th0 in + apply_trans ths th' (th' :: acc) in + + let rec mk_domains mono th0 acc = + match mono with + | [] -> rev acc + | m :: ms -> + let j, flag = m.variable, m.decr_flag in + let ths = restrict_domain n j flag th0 in + mk_domains ms (fst ths) (ths :: acc) in + + let verify_mono p_stat mono domain_th certificate = + let domain, _, _ = (dest_m_cell_domain o concl) domain_th in + let xx, zz = dest_pair domain in + let df0_flags = itlist (fun m b -> m.df0_flag & b) mono true in + let _ = report (sprintf "df0_flags = %b" df0_flags) in + let taylor_th, diff2_th = + if df0_flags then + TRUTH, fs.diff2_f xx zz + else + let t_th = fs.taylor p_stat.pp p_stat.pp domain_th in + let _, d_th, _, _ = dest_m_taylor_thms n t_th in + t_th, d_th in + + let domain_ths = mk_domains mono domain_th [] in + let gen_mono m = + if m.df0_flag then + if m.decr_flag then + eval_interval_arith_hi n (fs.df m.variable p_stat.pp xx zz) + else + eval_interval_arith_lo n (fs.df m.variable p_stat.pp xx zz) + else + if m.decr_flag then + eval_m_taylor_partial_upper n p_stat.pp m.variable taylor_th + else + eval_m_taylor_partial_lower n p_stat.pp m.variable taylor_th in + let mono_ths = map gen_mono mono in + let pass_th0 = rec_verify ((fst o last) domain_ths) certificate in + let sub_th0 = (eval_subset_refl o rand o concl o snd o hd) domain_ths in + let sub_ths = apply_trans (sub_th0 :: map snd (butlast domain_ths)) sub_th0 [] in + let th = rev_itlist (fun ((m, mono_th), sub_th) pass_th -> + let j, flag = m.variable, m.decr_flag in + m_mono_pass_gen n j flag diff2_th mono_th sub_th pass_th) + (rev (zip (zip mono mono_ths) sub_ths)) pass_th0 in + if hyp th <> [] then failwith ("hyp <> []: "^string_of_thm th) else th in + + + + fun domain_th certificate -> + match certificate with + | P_result_mono (p_stat, mono, r1) -> + let mono_strs = + map (fun m -> sprintf "%s%d (%b)" (if m.decr_flag then "-" else "") + m.variable m.df0_flag) mono in + let _ = report (sprintf "Mono: [%s]" (String.concat ";" mono_strs)) in + verify_mono p_stat mono domain_th r1 + + | P_result_pass (p_stat, f0_flag) -> + let _ = k := !k + 1 in + let _ = report (sprintf "Verifying: %d/%d (f0_flag = %b)" !k r_size f0_flag) in + if f0_flag then + let domain, _, _ = (dest_m_cell_domain o concl) domain_th in + let xx, zz = dest_pair domain in + m_taylor_cell_pass0 n (fs.f p_stat.pp xx zz) + else + let taylor_th = fs.taylor p_stat.pp p_stat.pp domain_th in + m_taylor_cell_pass n p_stat.pp taylor_th + + | P_result_glue (p_stat, i, convex_flag, r1, r2) -> + let domain1_th, domain2_th = + if convex_flag then + let d1, _ = restrict_domain n (i + 1) true domain_th in + let d2, _ = restrict_domain n (i + 1) false domain_th in + d1, d2 + else + split_domain n p_split (i + 1) domain_th in + let th1 = rec_verify domain1_th r1 in + let th2 = rec_verify domain2_th r2 in + if convex_flag then + let _ = report (sprintf "GlueConvex: %d" (i + 1)) in + let domain, _, _ = (dest_m_cell_domain o concl) domain_th in + let xx, zz = dest_pair domain in + let diff2_th = fs.diff2_f xx zz in + let partial2_th = fs.ddf (i + 1) (i + 1) p_stat.pp xx zz in + let lo_partial2_th = eval_interval_arith_lo n partial2_th in + m_convex_pass n (i + 1) diff2_th lo_partial2_th th1 th2 + else + m_glue_cells n (i + 1) th1 th2 + + | P_result_ref i -> + let _ = report (sprintf "Ref: %d" i) in + if i > 0 then + List.nth th_list (i - 1) + else + let domain, _, _ = (dest_m_cell_domain o concl) domain_th in + let pass_th = List.nth th_list (-i - 1) in + m_cell_pass_subdomain domain pass_th in + + rec_verify domain_th0 certificate;; + +(*****************) + +let m_p_verify_raw0 n p_split fs certificate xx zz = + m_p_verify_raw n p_split fs certificate (mk_m_center_domain n p_split xx zz) [];; + + + +let m_p_verify_list n p_split fs certificate_list xx zz = + let domain_hash = Hashtbl.create (length certificate_list * 10) in + let mem, find, add = Hashtbl.mem domain_hash, + Hashtbl.find domain_hash, Hashtbl.add domain_hash in + + let get_m_cell_domain n pp domain0 path = + let rec get_rec domain_th path hash = + match path with + | [] -> domain_th + | (s, j) :: ps -> + let hash' = hash^s^(string_of_int j) in + if mem hash' then + get_rec (find hash') ps hash' + else + if s = "l" or s = "r" then + let domain1_th, domain2_th = split_domain n pp j domain_th in + let hash1 = hash^"l"^(string_of_int j) and + hash2 = hash^"r"^(string_of_int j) in + let _ = add hash1 domain1_th; add hash2 domain2_th in + if s = "l" then + get_rec domain1_th ps hash' + else + get_rec domain2_th ps hash' + else + let l_flag = (s = "ml") in + let domain_th', _ = restrict_domain n j l_flag domain_th in + let _ = add hash' domain_th' in + get_rec domain_th' ps hash' in + get_rec domain0 path "" in + + let domain_th0 = mk_m_center_domain n p_split xx zz in + let size = length certificate_list in + let k = ref 0 in + let rec rec_verify certificate_list th_list = + match certificate_list with + | [] -> last th_list + | (path, certificate) :: cs -> + let _ = k := !k + 1; report (sprintf "List: %d/%d" !k size) in + let domain_th = get_m_cell_domain n p_split domain_th0 path in + let th = m_p_verify_raw n p_split fs certificate domain_th th_list in + rec_verify cs (th_list @ [th]) in + rec_verify certificate_list [];; diff --git a/formal_lp/old/formal_interval/m_verifier0.hl b/formal_lp/old/formal_interval/m_verifier0.hl new file mode 100644 index 0000000..58b4946 --- /dev/null +++ b/formal_lp/old/formal_interval/m_verifier0.hl @@ -0,0 +1,88 @@ +flyspeck_needs "../formal_lp/formal_interval/interval_m/verifier.hl";; +flyspeck_needs "../formal_lp/formal_interval/eval_interval.hl";; + +open Verifier;; +open Interval;; +open Line_interval;; +open Taylor;; +open Recurse;; + +(****************************) +(* Automatic conversion of formal interval functions into functions *) + +let rec build_fun i_fun = + match i_fun with + | Int_var tm -> + (try F_int_var (dest_small_numeral (rand tm)) + with Failure _ -> + let name = (fst o dest_var) tm in + F_int_var (int_of_string (String.sub name 1 (String.length name - 1)))) + | Int_const th -> + let f1, f2 = (dest_pair o rand o concl) th in + let int = mk_interval (float_of_float_tm f1, float_of_float_tm f2) in + F_int_const int + | Int_pow (n, f) -> F_int_pow (n, build_fun f) + | Int_unary (op, f) -> + let f' = build_fun f in + if op = neg_op_real then F_int_neg f' else failwith ("Unsupported operator: "^string_of_term op) + | Int_binary (op, f1, f2) -> + let f1', f2' = build_fun f1, build_fun f2 in + if op = add_op_real then F_int_add (f1',f2') + else if op = sub_op_real then F_int_sub (f1',f2') + else if op = mul_op_real then F_int_mul (f1',f2') + else failwith ("Unsupported operator: "^string_of_term op) + | _ -> failwith "Unsupported function";; + + +let buildL pp lin_th = + let funs = map (fst o dest_interval_arith) ((striplist dest_conj o rand o concl) lin_th) in + let i_funs = map (eval_constants pp o build_interval_fun) funs in + let fs = map build_fun i_funs @ (replicate (F_int_const zero) (8 - length funs + 1)) in + let eval_fs = map eval_int_fun fs in + let f, df = hd eval_fs, tl eval_fs in + (fun i x z -> + let vars = map2 (curry mk_interval) x z in + if i = 0 then f vars else (List.nth df (i - 1)) vars), + (fun x -> + let vars = map (fun x -> mk_interval (x,x)) x in + mk_line (f vars, map (fun df -> df vars) df));; + +let buildL0 pp poly_tm = + let lin_th = gen_lin_approx_poly_thm0 poly_tm in + buildL pp lin_th;; + +let buildDD pp second_th = + let poly_tm = (lhand o rator o lhand o concl) second_th in + let n = (get_dim o fst o dest_abs) poly_tm in + let ns = 1--n in + let funs = (striplist dest_conj o rand o snd o dest_forall o rand o concl) second_th in + let i_funs = map (eval_constants pp o build_interval_fun o fst o dest_interval_arith) funs in + let fs0 = map build_fun i_funs in + let pad1 = replicate zero (8 - n) and + pad2 = replicate zero 8 in + let pad3 = replicate pad2 (8 - n) in + let get_el dd i j = + let i', j' = if j <= i then i, j else j, i in + let index = (i' - 1) * i' / 2 + (j' - 1) in + List.nth dd index in + let eval_fs = map eval_int_fun fs0 in + fun x z -> + let ints = map2 (curry mk_interval) x z in + let vals = map (fun f -> f ints) eval_fs in + map (fun i -> map (fun j -> get_el vals i j) ns @ pad1) ns @ pad3;; + + +let buildDD0 pp poly_tm = + let second_th = gen_second_bounded_poly_thm0 poly_tm in + buildDD pp second_th;; + + +(******) + +let build_taylor pp lin_th second_th = + let f_df, lin = buildL pp lin_th and + dd = buildDD pp second_th in + Prim_a (make_primitiveA (f_df, lin, dd));; + +let build_taylor0 pp poly_tm = + build_taylor pp (gen_lin_approx_poly_thm0 poly_tm) (gen_second_bounded_poly_thm0 poly_tm);; diff --git a/formal_lp/old/formal_interval/more_float.hl b/formal_lp/old/formal_interval/more_float.hl new file mode 100644 index 0000000..c5e0758 --- /dev/null +++ b/formal_lp/old/formal_interval/more_float.hl @@ -0,0 +1,576 @@ +needs "tame/ArcProperties.hl";; +needs "../formal_lp/arith/float_atn.hl";; + + +let REAL_LE_POW_2 = prove(`!x. &0 <= x pow 2`, + REWRITE_TAC[REAL_POW_2; REAL_LE_SQUARE]);; + +let REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT = + prove(`!f s. real_open s ==> + (f real_continuous_on s <=> (!x. x IN s ==> f real_continuous atreal x))`, + REWRITE_TAC[REAL_OPEN; REAL_CONTINUOUS_ON; REAL_CONTINUOUS_CONTINUOUS_ATREAL] THEN + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL[`lift o f o drop`; `IMAGE lift s`] CONTINUOUS_ON_EQ_CONTINUOUS_AT) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th; IN_IMAGE_LIFT_DROP]) THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[LIFT_DROP]; + FIRST_X_ASSUM (MP_TAC o SPEC `drop x`) THEN ASM_REWRITE_TAC[LIFT_DROP] + ]);; + + +let ALL_EL = prove + (`!P l. (!i. i < LENGTH l ==> P (EL i l)) <=> ALL P l`, + REWRITE_TAC[GSYM ALL_MEM; MEM_EXISTS_EL] THEN MESON_TAC[]);; + + +needs "../formal_lp/formal_interval/theory/taylor_interval.hl";; + +open Arith_misc;; +open Float_theory;; +open Interval_arith;; +open Arith_float;; +open Float_atn;; + + +let RULE = UNDISCH_ALL o Arith_nat.NUMERALS_TO_NUM o REWRITE_RULE[FLOAT_OF_NUM; min_exp_def; GSYM IMP_IMP] o SPEC_ALL;; + +let x_var_real = `x:real` and + y_var_real = `y:real` and + w_var_real = `w:real` and + f_var_fun = `f : real->real` and + g_var_fun = `g : real->real` and + f1_var_fun = `f1 : real->real` and + f2_var_fun = `f2 : real->real` and + int_var = `int : real#real` and + f_bounds_var = `f_bounds : real#real` and + df_bounds_var = `df_bounds : real#real` and + dd_bounds_var = `dd_bounds : real#real` and + x_lo_var = `x_lo : real` and + x_hi_var = `x_hi : real` and + dd_var_real = `dd : real` and + df_lo_var = `df_lo : real` and + df_hi_var = `df_hi : real` and + df_var_real = `df : real` and + f_lo_var = `f_lo : real` and + f_hi_var = `f_hi : real` and + s_var_bool = `s:bool` and + n_var_num = `n:num` and + e_var_num = `e:num`;; + +let add_op_real = `(+):real->real->real` and + mul_op_real = `( * ):real->real->real` and + sub_op_real = `(-):real->real->real` and + div_op_real = `(/):real->real->real` and + inv_op_real = `inv` and + neg_op_real = `--` and + eq_op_real = `(=):real->real->bool` and + lt_op_real = `(<):real->real->bool`;; + +let w1_var_real = `w1 : real` and + w2_var_real = `w2 : real` and + t_var_real = `t : real` and + g_bounds_var = `g_bounds : real#real` and + dg_bounds_var = `dg_bounds : real#real` and + bounds_var = `bounds : real#real` and + d_bounds_var = `d_bounds : real#real` and + x0_var_real = `x0 : real` and + z0_var_real = `z0 : real` and + w0_var_real = `w0 : real`;; + + +(*************************************) +(* More float *) + + +(* Converts a float term to the corresponding rational number *) +let num_of_float_tm tm = + let s, n_tm, e_tm = dest_float tm in + let b = Num.num_of_int Arith_options.base in + let m = Num.num_of_int Arith_options.min_exp in + let ( * ), (^), (-), (!) = ( */ ), ( **/ ), (-/), Arith_nat.raw_dest_hash in + let r = !n_tm * (b ^ (!e_tm - m)) in + if s = "T" then minus_num r else r;; + + +let float_of_float_tm tm = + float_of_num (num_of_float_tm tm);; + + + +let mk_float n e = + let n, s = if n < 0 then -n, `T` else n, `F` in + let n_tm = rand (Arith_nat.mk_small_numeral_array n) in + let e_tm = rand (Arith_nat.mk_small_numeral_array e) in + mk_comb(mk_comb(mk_comb (`float`, s), n_tm), e_tm);; + + +let float0_eq = FLOAT_TO_NUM_CONV (mk_float 0 Arith_options.min_exp);; +let float1_eq = FLOAT_TO_NUM_CONV (mk_float 1 Arith_options.min_exp);; +let float2_eq = FLOAT_TO_NUM_CONV (mk_float 2 Arith_options.min_exp);; +let float3_eq = FLOAT_TO_NUM_CONV (mk_float 3 Arith_options.min_exp);; +let float4_eq = FLOAT_TO_NUM_CONV (mk_float 4 Arith_options.min_exp);; + +let num1_eq = (SYM o REWRITE_RULE[Arith_hash.NUM_THM] o Arith_nat.NUMERAL_TO_NUM_CONV) `1`;; +let num2_eq = (SYM o REWRITE_RULE[Arith_hash.NUM_THM] o Arith_nat.NUMERAL_TO_NUM_CONV) `2`;; +let num3_eq = (SYM o REWRITE_RULE[Arith_hash.NUM_THM] o Arith_nat.NUMERAL_TO_NUM_CONV) `3`;; + +(*********************) + + + +let interval_tm = `interval_arith`;; + +let mk_interval tm bounds = + mk_comb(mk_comb(interval_tm, tm), bounds);; + + +(* const interval *) + +let CONST_INTERVAL' = SPEC_ALL CONST_INTERVAL;; +let mk_const_interval tm = INST[tm, x_var_real] CONST_INTERVAL';; + +let float_F_const = `float F`;; + +let mk_float_small n = + let n_tm0 = mk_small_numeral n in + let n_th = Arith_nat.NUMERAL_TO_NUM_CONV n_tm0 in + let n_tm = rand(rand(concl n_th)) in + mk_comb(mk_comb(float_F_const, n_tm), min_exp_num_const);; + + +let one_float = mk_float_small 1;; +let two_float = mk_float_small 2;; +let one_interval = mk_float_interval_small_num 1;; +let two_interval = mk_float_interval_small_num 2;; +let neg_two_interval = float_interval_neg two_interval;; + + +(***********************************) +(* float_eq0 *) + +let FLOAT_EQ_0' = (GEN_REWRITE_RULE (RAND_CONV o RAND_CONV) [NUMERAL] o SPEC_ALL) + FLOAT_EQ_0;; + + +let float_eq0 f_tm = + let lhs, e_tm = dest_comb f_tm in + let lhs2, n_tm = dest_comb lhs in + let th0 = INST[rand lhs2, s_var_bool; n_tm, n_var_num; e_tm, e_var_num] FLOAT_EQ_0' in + let eq_th = Arith_nat.raw_eq0_hash_conv n_tm in + TRANS th0 eq_th;; + + + + +(***********************************) +(* float_interval_scale *) + +let float_interval_scale pp c_tm th = + let c_th = mk_const_interval c_tm in + float_interval_mul pp c_th th;; + + +(**********************************) +(* float_pos *) + +let FLOAT_F_POS' = SPEC_ALL FLOAT_F_POS;; + +(* Returns &0 <= float F n e *) +let float_pos tm = + let _, n_tm, e_tm = dest_float tm in + INST[n_tm, n_var_num; e_tm, e_var_num] FLOAT_F_POS';; + + + +(************************************) +(* float_iabs *) + +let FLOAT_NEG_F' = (RULE) FLOAT_NEG_T;; +let FLOAT_NEG_T' = (RULE) FLOAT_NEG_F;; + +let float_neg tm = + let sign, n_tm, e_tm = dest_float tm in + if sign = "T" then + INST[n_tm, n_var_num; e_tm, e_var_num] FLOAT_NEG_T' + else + INST[n_tm, n_var_num; e_tm, e_var_num] FLOAT_NEG_F';; + + +let IABS' = RULE iabs;; + + +let float_iabs int_tm = + let lo_tm, hi_tm = dest_pair int_tm in + let neg_lo_th = float_neg lo_tm in + let max_th = SYM (float_max hi_tm ((rand o rator o concl) neg_lo_th)) in + let lhs, rhs = dest_comb (concl max_th) in + let th0 = SYM (EQ_MP (AP_TERM lhs (AP_TERM (rator rhs) neg_lo_th)) max_th) in + let th1 = INST[lo_tm, x_lo_var; hi_tm, x_hi_var] IABS' in + TRANS th1 th0;; + + +let FLOAT_IABS_FF = prove(`iabs (float F n1 e1, float F n2 e2) = float F n2 e2`, + REWRITE_TAC[iabs] THEN + MP_TAC (SPECL [`n1:num`; `e1:num`] FLOAT_F_POS) THEN + MP_TAC (SPECL [`n2:num`; `e2:num`] FLOAT_F_POS) THEN + REAL_ARITH_TAC);; + + +let FLOAT_IABS_TT = prove(`iabs (float T n1 e1, float T n2 e2) = float F n1 e1`, + REWRITE_TAC[iabs; GSYM FLOAT_NEG_F] THEN + MP_TAC (SPECL [`n1:num`; `e1:num`] FLOAT_F_POS) THEN + MP_TAC (SPECL [`n2:num`; `e2:num`] FLOAT_T_NEG) THEN + REAL_ARITH_TAC);; + +(* let FLOAT_IABS_FT = prove(`iabs (float F n1 e1, float T n2 e2) *) + + +(****************************) +(* interval_not_zero *) + +let INTERVAL_NOT_ZERO1' = (UNDISCH_ALL o prove) + (`(&0 < lo <=> T) ==> interval_not_zero (lo, hi)`, SIMP_TAC[interval_not_zero]);; +let INTERVAL_NOT_ZERO2' = (UNDISCH_ALL o prove) + (`(hi < &0 <=> T) ==> interval_not_zero (lo, hi)`, SIMP_TAC[interval_not_zero]);; + +let lo_var_real = `lo:real` and + hi_var_real = `hi:real`;; + + +let check_interval_not_zero int_tm = + let lo, hi = dest_pair int_tm in + let inst = INST[lo, lo_var_real; hi, hi_var_real] in + let s1, _, _ = dest_float lo in + if s1 = "F" then + let gt_th = float_gt0 lo in + if (fst o dest_const o rand o concl) gt_th <> "T" then + failwith "check_interval_not_zero: &0 < lo <=> F" + else + (MY_PROVE_HYP gt_th o inst) INTERVAL_NOT_ZERO1' + else + let lt_th = float_lt0 hi in + if (fst o dest_const o rand o concl) lt_th <> "T" then + failwith "check_interval_not_zero: hi < &0 <=> F" + else + (MY_PROVE_HYP lt_th o inst) INTERVAL_NOT_ZERO2';; + + + +(* +let int1 = mk_pair (mk_float 3 50, mk_float 4 50);; +let int2 = mk_pair (mk_float (-4) 50, mk_float (-3) 50);; + +check_interval_not_zero int1;; +check_interval_not_zero int2;; +*) + +(*************************************) +(* interval_pos *) + +let INTERVAL_POS' = (UNDISCH_ALL o prove) + (`(&0 < lo <=> T) ==> interval_pos (lo, hi:real)`, SIMP_TAC[interval_pos]);; + + +let check_interval_pos int_tm = + let lo, hi = dest_pair int_tm in + let gt_th = float_gt0 lo in + if (fst o dest_const o rand o concl) gt_th <> "T" then + failwith "check_interval_pos: &0 < lo <=> F" + else + (MY_PROVE_HYP gt_th o INST[lo, lo_var_real; hi, hi_var_real]) INTERVAL_POS';; + + +(* +check_interval_pos int1;; +check_interval_pos int2;; +*) + +(************************************) +(* check_interval_iabs *) + + +(* proves iabs int < rhs *) +let check_interval_iabs int_tm rhs_tm = + let iabs_eq = float_iabs int_tm in + let lt_th = float_lt (rand (concl iabs_eq)) rhs_tm in + if (fst o dest_const o rand o concl) lt_th <> "T" then + failwith "check_interval_iabs: iabs < rhs <=> F" + else + let th0 = AP_THM (AP_TERM lt_op_real iabs_eq) rhs_tm in + TRANS th0 lt_th;; + + +(* +check_interval_iabs int2 (mk_float 41 49);; +*) + + +(****************************) +(* inv *) + +let INV_EQ_DIV_LEMMA = prove(`&1 / x = inv x`, REWRITE_TAC[real_div; REAL_MUL_LID]);; + + +let float_interval_inv pp th = + let x_tm = (rand o rator o concl) th in + let div_th = INST[x_tm, x_var_real] INV_EQ_DIV_LEMMA in + let th0 = float_interval_div pp one_interval th in + let lhs, rhs = dest_comb (concl th0) in + let lhs2, rhs2 = dest_comb lhs in + EQ_MP (AP_THM (AP_TERM lhs2 div_th) rhs) th0;; + + + +(*****************************************) +(* bounded_on_int *) + + +let norm_derivative d_th eq_th = + let lhs, rhs = (dest_eq o concl) d_th in + let lhs2, rhs2 = dest_comb lhs in + let th0 = AP_THM (AP_TERM (rator lhs2) eq_th) rhs2 in + TRANS (SYM th0) d_th;; + +let norm_diff d_th eq_th = + let lhs, rhs = (dest_comb o concl) d_th in + let th0 = AP_THM (AP_TERM (rator lhs) eq_th) rhs in + EQ_MP th0 d_th;; + +let norm_interval int_th eq_th = + let lhs, rhs = (dest_comb o concl) int_th in + let th0 = AP_THM (AP_TERM (rator lhs) eq_th) rhs in + EQ_MP (SYM th0) int_th;; + +let norm_second_derivative th eq_th = + let lhs, dd_bounds = dest_comb (concl th) in + let lhs2, int_tm = dest_comb lhs in + let th0 = AP_THM (AP_THM (AP_TERM (rator lhs2) eq_th) int_tm) dd_bounds in + EQ_MP th0 th;; + +let norm_lin_approx th eq_th = + let lhs, df_bounds = dest_comb (concl th) in + let lhs2, f_bounds = dest_comb lhs in + let lhs3, x_tm = dest_comb lhs2 in + let th0 = AP_THM (AP_THM (AP_THM (AP_TERM (rator lhs3) eq_th) x_tm) f_bounds) df_bounds in + EQ_MP th0 th;; + + + + + +let BOUNDED_ON_INT = (UNDISCH_ALL o prove)(`(!x. interval_arith x int ==> + interval_arith (f x) f_bounds) + ==> bounded_on_int f int f_bounds`, + REWRITE_TAC[bounded_on_int; interval_arith; IN_REAL_INTERVAL]);; + + +let BOUNDED_ON_INT_DEST = (UNDISCH_ALL o prove)(`bounded_on_int f int f_bounds ==> + (!x. interval_arith x int ==> interval_arith (f x) f_bounds)`, + REWRITE_TAC[bounded_on_int; interval_arith; IN_REAL_INTERVAL]);; + + +let mk_bounded_on_int th = + let int_tm = (rand o hd o hyp) th in + let lhs, f_bounds_tm = dest_comb (concl th) in + let lhs2, rhs2 = dest_comb lhs in + let f_tm = mk_abs (x_var_real, rhs2) in + let b_th0 = (SYM o BETA_CONV) (mk_comb (f_tm , x_var_real)) in + let b_th1 = AP_THM (AP_TERM lhs2 b_th0) f_bounds_tm in + let th2 = EQ_MP b_th1 th in + let th3 = DISCH_ALL th2 in + let th4 = GEN x_var_real th3 in + let th_int = INST[int_tm, int_var; f_bounds_tm, f_bounds_var; + f_tm, f_var_fun] BOUNDED_ON_INT in + MY_PROVE_HYP th4 th_int;; + + + +let dest_bounded_on_int th = + let lhs, f_bounds = dest_comb (concl th) in + let lhs2, int_tm = dest_comb lhs in + let f_tm = rand lhs2 in + let th0 = INST[f_tm, f_var_fun; int_tm, int_var; f_bounds, f_bounds_var] BOUNDED_ON_INT_DEST in + let th1 = UNDISCH_ALL (SPEC x_var_real (MY_PROVE_HYP th th0)) in + if is_abs f_tm then + let f_tm = (rand o rator o concl) th1 in + let eq_th = BETA_CONV f_tm in + norm_interval th1 (SYM eq_th) + else + th1;; + + +let dest_bounded_on_int_raw th = + let lhs, f_bounds = dest_comb (concl th) in + let lhs2, int_tm = dest_comb lhs in + let f_tm = rand lhs2 in + let th0 = INST[f_tm, f_var_fun; int_tm, int_var; f_bounds, f_bounds_var] BOUNDED_ON_INT_DEST in + UNDISCH_ALL (SPEC x_var_real (MY_PROVE_HYP th th0));; + + +(* +let pp = 5;; +let th0 = (RULE o ASSUME) `interval_arith x (&2, &3)`;; +let th = float_interval_atn pp th0;; +let b_th = mk_bounded_on_int th;; +let d_th = dest_bounded_on_int b_th;; +*) + +(***********************************) +(* bounded_on_int arithmetic *) + +let bounded_on_int_scale pp c_tm th = + let i_th = dest_bounded_on_int th in + let th0 = float_interval_scale pp c_tm i_th in + mk_bounded_on_int th0;; + + +let bounded_on_int_mul_int pp int_th th = + let i_th = dest_bounded_on_int th in + let th0 = float_interval_mul pp int_th i_th in + mk_bounded_on_int th0;; + + +let bounded_on_int_neg th1 = + let i_th = dest_bounded_on_int th1 in + let th0 = float_interval_neg i_th in + mk_bounded_on_int th0;; + + +let bounded_on_int_add pp th1 th2 = + let i_th1, i_th2 = dest_bounded_on_int th1, dest_bounded_on_int th2 in + let th0 = float_interval_add pp i_th1 i_th2 in + mk_bounded_on_int th0;; + + +let bounded_on_int_sub pp th1 th2 = + let i_th1, i_th2 = dest_bounded_on_int th1, dest_bounded_on_int th2 in + let th0 = float_interval_sub pp i_th1 i_th2 in + mk_bounded_on_int th0;; + + +let bounded_on_int_mul pp th1 th2 = + let i_th1, i_th2 = dest_bounded_on_int th1, dest_bounded_on_int th2 in + let th0 = float_interval_mul pp i_th1 i_th2 in + mk_bounded_on_int th0;; + + +let bounded_on_int_mul_raw pp th1 th2 = + let i_th1, i_th2 = dest_bounded_on_int_raw th1, dest_bounded_on_int_raw th2 in + let th0 = float_interval_mul pp i_th1 i_th2 in + mk_bounded_on_int th0;; + + + +let bounded_on_int_div pp th1 th2 = + let i_th1, i_th2 = dest_bounded_on_int th1, dest_bounded_on_int th2 in + let th0 = float_interval_div pp i_th1 i_th2 in + mk_bounded_on_int th0;; + + +(* +let b_sub = bounded_on_int_sub pp b_th b_th;; +bounded_on_int_mul pp b_sub b_th;; +*) + + +(************************************) +let ADD_INEQ_HI = (RULE o REAL_ARITH) `x1 <= y1 /\ x2 <= y2 /\ y1 + y2 <= y ==> x1 + x2 <= y`;; +let ADD_INEQ_LO = (RULE o REAL_ARITH) `x1 <= y1 /\ x2 <= y2 /\ x <= x1 + x2 ==> x <= y1 + y2`;; +let SUB_INEQ_HI = (RULE o REAL_ARITH) `x1 <= y1 /\ y2 <= x2 /\ y1 - y2 <= y ==> x1 - x2 <= y`;; +let SUB_INEQ_LO = (RULE o REAL_ARITH) `x1 <= y1 /\ y2 <= x2 /\ x <= x1 - x2 ==> x <= y1 - y2`;; +let MUL_INEQ_HI = (UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o prove) + (`&0 <= x1 /\ &0 <= x2 /\ x1 <= y1 /\ x2 <= y2 /\ y1 * y2 <= y ==> x1 * x2 <= y`, + DISCH_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `y1 * y2` THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN ASM_REWRITE_TAC[]);; + +let MUL_INEQ_POS_CONST_HI = (UNDISCH_ALL o prove) + (`(&0 <= x <=> T) ==> y1 <= y2 ==> x * y2 <= z ==> x * y1 <= z`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `x * y2` THEN + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LE_LMUL THEN ASM_REWRITE_TAC[]);; + + +let REAL_LE_REFL' = RULE REAL_LE_REFL;; + + +let mk_refl_ineq tm = INST[tm, x_var_real] REAL_LE_REFL';; + +let dest_le_op ineq = + let lhs, y_tm = dest_comb ineq in (rand lhs, y_tm);; + + +let y1_var_real = `y1:real` and + x1_var_real = `x1:real` and + y2_var_real = `y2:real` and + x2_var_real = `x2:real` and + z_var_real = `z:real`;; + + +let mul_ineq_pos_const_hi pp c_tm ineq = + let y1_tm, y2_tm = dest_le_op (concl ineq) in + let ge0_th = float_ge0 c_tm in + let mul_hi_th = float_mul_hi pp c_tm y2_tm in + let z_tm = (rand o concl) mul_hi_th in + (MY_PROVE_HYP ge0_th o MY_PROVE_HYP ineq o MY_PROVE_HYP mul_hi_th o + INST[c_tm, x_var_real; y1_tm, y1_var_real; y2_tm, y2_var_real; z_tm, z_var_real]) + MUL_INEQ_POS_CONST_HI;; + + +let mul_ineq_hi pp ineq1 ineq2 = + let x1_tm, y1_tm = dest_le_op (concl ineq1) in + let x2_tm, y2_tm = dest_le_op (concl ineq2) in + let x1_pos, x2_pos = float_pos x1_tm, float_pos x2_tm in + let rhs_mul = float_mul_hi pp y1_tm y2_tm in + let y_tm = (rand o concl) rhs_mul in + let th0 = INST[x1_tm, x1_var_real; y1_tm, y1_var_real; + x2_tm, x2_var_real; y2_tm, y2_var_real; + y_tm, y_var_real] MUL_INEQ_HI in + (MY_PROVE_HYP x1_pos o MY_PROVE_HYP x2_pos o MY_PROVE_HYP ineq1 o + MY_PROVE_HYP ineq2 o MY_PROVE_HYP rhs_mul) th0;; + + + +let sub_ineq_hi pp ineq1 ineq2 = + let x1_tm, y1_tm = dest_le_op (concl ineq1) in + let y2_tm, x2_tm = dest_le_op (concl ineq2) in + let rhs_sub = float_sub_hi pp y1_tm y2_tm in + let y_tm = (rand o concl) rhs_sub in + let th0 = INST[x1_tm, x1_var_real; y1_tm, y1_var_real; + x2_tm, x2_var_real; y2_tm, y2_var_real; + y_tm, y_var_real] SUB_INEQ_HI in + MY_PROVE_HYP ineq1 (MY_PROVE_HYP ineq2 (MY_PROVE_HYP rhs_sub th0));; + +let sub_ineq_lo pp ineq1 ineq2 = + let x1_tm, y1_tm = dest_le_op (concl ineq1) in + let y2_tm, x2_tm = dest_le_op (concl ineq2) in + let lhs_sub = float_sub_lo pp x1_tm x2_tm in + let x_tm = (lhand o concl) lhs_sub in + let th0 = INST[x1_tm, x1_var_real; y1_tm, y1_var_real; + x2_tm, x2_var_real; y2_tm, y2_var_real; + x_tm, x_var_real] SUB_INEQ_LO in + MY_PROVE_HYP ineq1 (MY_PROVE_HYP ineq2 (MY_PROVE_HYP lhs_sub th0));; + + + +let add_ineq_hi pp ineq1 ineq2 = + let x1_tm, y1_tm = dest_le_op (concl ineq1) in + let x2_tm, y2_tm = dest_le_op (concl ineq2) in + let rhs_sum = float_add_hi pp y1_tm y2_tm in + let y_tm = (rand o concl) rhs_sum in + let th0 = INST[x1_tm, x1_var_real; y1_tm, y1_var_real; + x2_tm, x2_var_real; y2_tm, y2_var_real; + y_tm, y_var_real] ADD_INEQ_HI in + MY_PROVE_HYP ineq1 (MY_PROVE_HYP ineq2 (MY_PROVE_HYP rhs_sum th0));; + + +let add_ineq_lo pp ineq1 ineq2 = + let x1_tm, y1_tm = dest_le_op (concl ineq1) in + let x2_tm, y2_tm = dest_le_op (concl ineq2) in + let lhs_sum = float_add_lo pp x1_tm x2_tm in + let x_tm = (lhand o concl) lhs_sum in + let th0 = INST[x1_tm, x1_var_real; y1_tm, y1_var_real; + x2_tm, x2_var_real; y2_tm, y2_var_real; + x_tm, x_var_real] ADD_INEQ_LO in + MY_PROVE_HYP ineq1 (MY_PROVE_HYP ineq2 (MY_PROVE_HYP lhs_sum th0));; + diff --git a/formal_lp/old/formal_interval/second_approx.hl b/formal_lp/old/formal_interval/second_approx.hl new file mode 100644 index 0000000..506088d --- /dev/null +++ b/formal_lp/old/formal_interval/second_approx.hl @@ -0,0 +1,1200 @@ +needs "../formal_lp/formal_interval/lin_approx.hl";; + +(* Explicit formula (float) for inv(&2) *) + +let float_inv2_th = + let one_float_eq_one = FLOAT_TO_NUM_CONV one_float in + let inv2_eq_lemma = prove(`interval_arith (&2 * x) (&1, &1) ==> inv (&2) = x`, + REWRITE_TAC[interval_arith] THEN CONV_TAC REAL_FIELD) in + let half_tm = (fst o dest_pair o rand o concl) (float_interval_inv 1 two_interval) in + let half_interval = mk_const_interval half_tm in + let mul_th = REWRITE_RULE[one_float_eq_one] (float_interval_mul 2 two_interval half_interval) in + MATCH_MP inv2_eq_lemma mul_th;; + +let float_inv2 = rand (concl float_inv2_th);; +let inv2_interval = mk_const_interval float_inv2;; + +let INTERVAL_IMP_HI = (RULE o prove)(`interval_arith x (lo, hi) ==> x <= hi`, + REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; + +let interval_imp_hi int_th = + let lhs, bounds = dest_comb (concl int_th) in + let x_tm, (lo_tm, hi_tm) = rand lhs, dest_pair bounds in + let th0 = INST[x_tm, x_var_real; lo_tm, lo_var_real; hi_tm, hi_var_real] INTERVAL_IMP_HI in + MY_PROVE_HYP int_th th0;; + + +(*****************************) +(* cell_domain *) + +let dest_cell_domain tm = + let lhs, w_tm = dest_comb tm in + let lhs2, z_tm = dest_comb lhs in + let lhs3, y_tm = dest_comb lhs2 in + rand lhs3, y_tm, z_tm, w_tm;; + + +(******************************************) + +let CELL_DOMAIN_IMP_INTERVAL_ARITH = prove(`cell_domain x y z w ==> interval_arith y (x, z)`, + REWRITE_TAC[cell_domain; interval_arith] THEN REAL_ARITH_TAC);; + + +let MK_CELL_DOMAIN_0' = (UNDISCH_ALL o PURE_REWRITE_RULE[GSYM IMP_IMP] o prove) + (`(x <= y <=> T) /\ (y <= z <=> T) /\ y - x <= w1 /\ z - y <= w2 /\ (w1 <= w <=> T) /\ (w2 <= w <=> T) ==> + cell_domain x y z w`, + SIMP_TAC[cell_domain] THEN REAL_ARITH_TAC);; + + +let MK_CELL_DOMAIN' = (UNDISCH_ALL o PURE_REWRITE_RULE[GSYM IMP_IMP] o prove) + (`(x <= y <=> T) /\ (y <= z <=> T) /\ y - x <= w1 /\ z - y <= w2 /\ max w1 w2 = w ==> + cell_domain x y z w`, REWRITE_TAC[cell_domain] THEN REAL_ARITH_TAC);; + + +let mk_cell_domain0 pp x_tm y_tm z_tm w_tm = + let xy_th = float_le x_tm y_tm and + yz_th = float_le y_tm z_tm in + let yx_w1 = float_sub_hi pp y_tm x_tm and + zy_w2 = float_sub_hi pp z_tm y_tm in + let w1_tm = (rand o concl) yx_w1 and + w2_tm = (rand o concl) zy_w2 in + let w1w = float_le w1_tm w_tm and + w2w = float_le w2_tm w_tm in + let th0 = INST[x_tm, x_var_real; y_tm, y_var_real; z_tm, z_var_real; + w_tm, w_var_real; w1_tm, w1_var_real; w2_tm, w2_var_real] MK_CELL_DOMAIN_0' in + (MY_PROVE_HYP xy_th o MY_PROVE_HYP yz_th o MY_PROVE_HYP yx_w1 o MY_PROVE_HYP zy_w2 o + MY_PROVE_HYP w1w o MY_PROVE_HYP w2w) th0;; + + +let mk_cell_domain pp x_tm y_tm z_tm = + let w1_th = float_sub_hi pp y_tm x_tm and + w2_th = float_sub_hi pp z_tm y_tm in + let w1_tm = (rand o concl) w1_th and + w2_tm = (rand o concl) w2_th in + let max_th = float_max w1_tm w2_tm in + let w_tm = (rand o concl) max_th in + let x_le_y = float_le x_tm y_tm and + y_le_z = float_le y_tm z_tm in + let th0 = INST[x_tm, x_var_real; y_tm, y_var_real; z_tm, z_var_real; + w_tm, w_var_real; w1_tm, w1_var_real; w2_tm, w2_var_real] MK_CELL_DOMAIN' in + (MY_PROVE_HYP x_le_y o MY_PROVE_HYP y_le_z o + MY_PROVE_HYP w1_th o MY_PROVE_HYP w2_th o MY_PROVE_HYP max_th) th0;; + + + + +(* TODO: remove formal computation of y *) +let mk_center_domain pp x_tm z_tm = + let y0_tm = (rand o concl) (float_add_hi pp x_tm z_tm) in + let y_tm = (rand o concl) (float_mul_eq float_inv2 y0_tm) in + mk_cell_domain pp x_tm y_tm z_tm;; + + +(* +let x_tm = mk_float 1 50;; +let z_tm = mk_float 4 50;; + +let domain_th = mk_center_domain 2 x_tm z_tm;; + +let x_tm, y_tm, z_tm, w_tm = dest_cell_domain (concl domain_th);; +mk_cell_domain 2 x_tm y_tm z_tm;; +mk_cell_domain0 2 x_tm y_tm z_tm w_tm;; +*) + + +(***************************************************) +(* Elementary functions and their taylor intervals *) +(***************************************************) + + +(*****************************) +(* f(x) = x *) + +let TAYLOR_X' = RULE taylor_x;; + + +let eval_taylor_x domain_th = + let x_tm, y_tm, z_tm, w_tm = dest_cell_domain (concl domain_th) in + let th0 = INST[x_tm, x_var_real; y_tm, y_var_real; z_tm, z_var_real; w_tm, w_var_real] TAYLOR_X' in + MY_PROVE_HYP domain_th th0;; + + +(* +eval_taylor_x domain_th;; +*) + +(********************************) +(* f(x) = const *) + +let TAYLOR_CONST' = RULE taylor_const;; +let eval_taylor_const domain_th c_tm = + let x_tm, y_tm, z_tm, w_tm = dest_cell_domain (concl domain_th) in + (MY_PROVE_HYP domain_th o + INST[c_tm, c_var_real; x_tm, x_var_real; y_tm, y_var_real; + z_tm, z_var_real; w_tm, w_var_real]) TAYLOR_CONST';; + + +let TAYLOR_CONST_INTERVAL' = (RULE o prove) + (`cell_domain x y z w ==> interval_arith c bounds ==> + taylor_interval (\x. c) x y z w bounds (&0, &0) (&0, &0)`, + REPEAT DISCH_TAC THEN + MP_TAC (SPEC_ALL taylor_const) THEN ASM_SIMP_TAC[taylor_interval; lin_approx_eq]);; + +let eval_taylor_const_interval int_th domain_th = + let x_tm, y_tm, z_tm, w_tm = dest_cell_domain (concl domain_th) in + let lhs, bounds = dest_comb (concl int_th) in + let c_tm = rand lhs in + (MY_PROVE_HYP int_th o MY_PROVE_HYP domain_th o + INST[c_tm, c_var_real; bounds, bounds_var; x_tm, x_var_real; y_tm, y_var_real; + z_tm, z_var_real; w_tm, w_var_real]) TAYLOR_CONST_INTERVAL';; + + +(* +eval_taylor_const domain_th `&3`;; +*) + +(***********************************) +(* f(x) = atn x *) + +let taylor_atn = prove(`cell_domain x y z w ==> + bounded_on_int (\x. (-- &2 * x) / (&1 + x pow 2) pow 2) (x,z) dd_bounds ==> + lin_approx atn y f_bounds df_bounds ==> + taylor_interval atn x y z w f_bounds df_bounds dd_bounds`, + REWRITE_TAC[cell_domain; taylor_interval; real_div; REAL_INV_POW] THEN REPEAT DISCH_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC second_derivative_atn_bounds THEN ASM_REWRITE_TAC[]);; + +let TAYLOR_ATN' = (UNDISCH_ALL o REWRITE_RULE[REAL_POW_2]) taylor_atn;; + + +let eval_taylor_atn pp domain_th = + let x_tm, y_tm, z_tm, w_tm = dest_cell_domain (concl domain_th) in + let atn_lin = eval_lin_approx_atn pp y_tm in + let _, _, f_bounds, df_bounds = dest_lin_approx (concl atn_lin) in + + let ddf_th = + let x_th = ASSUME (mk_interval x_var_real (mk_pair (x_tm, z_tm))) and + ( * ) = float_interval_mul pp and + (+) = float_interval_add pp and + (/) = float_interval_div pp in + let x2_1 = one_interval + x_th * x_th in + mk_bounded_on_int ((neg_two_interval * x_th) / (x2_1 * x2_1)) in + + let dd_bounds = rand (concl ddf_th) in + (MY_PROVE_HYP domain_th o MY_PROVE_HYP atn_lin o MY_PROVE_HYP ddf_th o + INST[x_tm, x_var_real; y_tm, y_var_real; z_tm, z_var_real; w_tm, w_var_real; + dd_bounds, dd_bounds_var; f_bounds, f_bounds_var; df_bounds, df_bounds_var]) TAYLOR_ATN';; + + + +(* +let domain_th = mk_center_domain 5 (mk_float 1 50) (mk_float 4 50);; +let pp = 5;; +eval_taylor_atn pp domain_th;; +*) + + + +(***********************************) +(* f(x) = inv x *) + +let taylor_inv = prove(`cell_domain x y z w ==> + interval_not_zero (x,z) ==> + bounded_on_int (\x. &2 * inv (x pow 3)) (x,z) dd_bounds ==> + lin_approx inv y f_bounds df_bounds ==> + taylor_interval inv x y z w f_bounds df_bounds dd_bounds`, + REWRITE_TAC[cell_domain; taylor_interval] THEN REPEAT DISCH_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC (REWRITE_RULE[IMP_IMP] second_derivative_inv_bounds) THEN ASM_REWRITE_TAC[]);; + +let TAYLOR_INV' = (UNDISCH_ALL o REWRITE_RULE[GSYM real_div; REAL_ARITH `x pow 3 = x * x * x`]) taylor_inv;; + + +let eval_taylor_inv pp domain_th = + let x_tm, y_tm, z_tm, w_tm = dest_cell_domain (concl domain_th) in + let int_tm = mk_pair (x_tm, z_tm) in + let lin_th = eval_lin_approx_inv pp y_tm in + let _, _, f_bounds, df_bounds = dest_lin_approx (concl lin_th) in + let cond_th = check_interval_not_zero int_tm in + + let ddf_th = + let x_th = ASSUME (mk_interval x_var_real (mk_pair (x_tm, z_tm))) and + ( * ) = float_interval_mul pp and + (/) = float_interval_div pp in + mk_bounded_on_int (two_interval / (x_th * (x_th * x_th))) in + + let dd_bounds = rand (concl ddf_th) in + (MY_PROVE_HYP domain_th o MY_PROVE_HYP lin_th o MY_PROVE_HYP ddf_th o MY_PROVE_HYP cond_th o + INST[x_tm, x_var_real; y_tm, y_var_real; z_tm, z_var_real; w_tm, w_var_real; + dd_bounds, dd_bounds_var; f_bounds, f_bounds_var; df_bounds, df_bounds_var]) TAYLOR_INV';; + + + +(* +let domain_th = mk_center_domain 5 (mk_float 1 50) (mk_float 4 50);; +let pp = 5;; +eval_taylor_inv pp domain_th;; +*) + + +(***********************************) +(* f(x) = sqrt x *) + +let taylor_sqrt = prove(`cell_domain x y z w ==> + interval_pos (x,z) ==> + bounded_on_int (\x. --inv (&4 * sqrt (x pow 3))) (x,z) dd_bounds ==> + lin_approx sqrt y f_bounds df_bounds ==> + taylor_interval sqrt x y z w f_bounds df_bounds dd_bounds`, + REWRITE_TAC[cell_domain; taylor_interval] THEN REPEAT DISCH_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC (REWRITE_RULE[IMP_IMP] second_derivative_sqrt_bounds) THEN ASM_REWRITE_TAC[]);; + +let TAYLOR_SQRT' = (UNDISCH_ALL o REWRITE_RULE[REAL_ARITH `x pow 3 = x * x * x`]) taylor_sqrt;; +let four_interval = mk_float_interval_small_num 4;; + + +let eval_taylor_sqrt pp domain_th = + let x_tm, y_tm, z_tm, w_tm = dest_cell_domain (concl domain_th) in + let int_tm = mk_pair (x_tm, z_tm) in + let lin_th = eval_lin_approx_sqrt pp y_tm in + let _, _, f_bounds, df_bounds = dest_lin_approx (concl lin_th) in + let cond_th = check_interval_pos int_tm in + + let ddf_th = + let x_th = ASSUME (mk_interval x_var_real (mk_pair (x_tm, z_tm))) and + ( * ) = float_interval_mul pp and + sqrt = float_interval_sqrt pp and + inv = float_interval_inv pp and + neg = float_interval_neg in + mk_bounded_on_int (neg (inv (four_interval * sqrt (x_th * (x_th * x_th))))) in + + let dd_bounds = rand (concl ddf_th) in + (MY_PROVE_HYP domain_th o MY_PROVE_HYP lin_th o MY_PROVE_HYP ddf_th o MY_PROVE_HYP cond_th o + INST[x_tm, x_var_real; y_tm, y_var_real; z_tm, z_var_real; w_tm, w_var_real; + dd_bounds, dd_bounds_var; f_bounds, f_bounds_var; df_bounds, df_bounds_var]) TAYLOR_SQRT';; + + + +(* +let domain_th = mk_center_domain 5 (mk_float 1 50) (mk_float 4 50);; +let pp = 5;; +eval_taylor_sqrt pp domain_th;; +*) + + +(***********************************) +(* f(x) = acs x *) + +let iabs_lt1_lemma = + (GEN_REWRITE_RULE (RAND_CONV o LAND_CONV o RAND_CONV) [GSYM (FLOAT_TO_NUM_CONV one_float)] o prove) + (`iabs int < &1 <=> (iabs int < &1 <=> T)`, REWRITE_TAC[]);; + +let taylor_acs = prove(`cell_domain x y z w ==> + iabs (x,z) < &1 ==> + bounded_on_int (\x. --(x / sqrt ((&1 - x * x) pow 3))) (x,z) dd_bounds ==> + lin_approx acs y f_bounds df_bounds ==> + taylor_interval acs x y z w f_bounds df_bounds dd_bounds`, + REWRITE_TAC[cell_domain; taylor_interval] THEN REPEAT DISCH_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC (REWRITE_RULE[IMP_IMP] second_derivative_acs_bounds) THEN ASM_REWRITE_TAC[]);; + +let TAYLOR_ACS' = + (UNDISCH_ALL o + PURE_ONCE_REWRITE_RULE[iabs_lt1_lemma] o + REWRITE_RULE[REAL_ARITH `x pow 3 = x * x * x`]) taylor_acs;; + + +let eval_taylor_acs pp domain_th = + let x_tm, y_tm, z_tm, w_tm = dest_cell_domain (concl domain_th) in + let int_tm = mk_pair (x_tm, z_tm) in + let lin_th = eval_lin_approx_acs pp y_tm in + let _, _, f_bounds, df_bounds = dest_lin_approx (concl lin_th) in + let cond_th = check_interval_iabs int_tm one_float in + + let ddf_th = + let x_th = ASSUME (mk_interval x_var_real (mk_pair (x_tm, z_tm))) and + ( * ) = float_interval_mul pp and + (-) = float_interval_sub pp and + (/) = float_interval_div pp and + sqrt = float_interval_sqrt pp and + neg = float_interval_neg in + let x2_1 = one_interval - x_th * x_th in + mk_bounded_on_int (neg (x_th / sqrt (x2_1 * (x2_1 * x2_1)))) in + + let dd_bounds = rand (concl ddf_th) in + (MY_PROVE_HYP domain_th o MY_PROVE_HYP lin_th o MY_PROVE_HYP ddf_th o MY_PROVE_HYP cond_th o + INST[x_tm, x_var_real; y_tm, y_var_real; z_tm, z_var_real; w_tm, w_var_real; + dd_bounds, dd_bounds_var; f_bounds, f_bounds_var; df_bounds, df_bounds_var]) TAYLOR_ACS';; + + + +(* +let domain_th1 = mk_center_domain 5 (mk_float 1 49) (mk_float 8 49);; +let domain_th2 = mk_center_domain 5 (mk_float (-5) 49) (mk_float 1 49);; +let pp = 5;; +eval_taylor_acs pp domain_th1;; +eval_taylor_atn pp domain_th1;; +eval_taylor_inv pp domain_th1;; +eval_taylor_sqrt pp domain_th1;; + +eval_taylor_acs pp domain_th2;; +eval_taylor_atn pp domain_th2;; +eval_taylor_inv pp domain_th2;; +eval_taylor_sqrt pp domain_th2;; +*) + + +(***********************************************************) + + +(***********************************) +(* Taylor bounds *) + + +let dest_taylor_interval tm = + let lhs, dd_bounds = dest_comb tm in + let lhs, df_bounds = dest_comb lhs in + let lhs, f_bounds = dest_comb lhs in + let lhs, w_tm = dest_comb lhs in + let lhs, z_tm = dest_comb lhs in + let lhs, y_tm = dest_comb lhs in + let lhs, x_tm = dest_comb lhs in + rand lhs, x_tm, y_tm, z_tm, w_tm, f_bounds, df_bounds, dd_bounds;; + + +(****************************) +(* f_bounds *) + +let TAYLOR_F_BOUNDS' = (RULE o REWRITE_RULE[float_inv2_th]) taylor_f_bounds;; + + +let eval_taylor_f_bounds pp th = + let f_tm, x_tm, y_tm, z_tm, w_tm, f_bounds, df_bounds, dd_bounds = dest_taylor_interval (concl th) in + let f_lo, f_hi = dest_pair f_bounds in + let iabs_df_th = float_iabs df_bounds and + iabs_dd_th = float_iabs dd_bounds in + let df_tm = (rand o concl) iabs_df_th and + dd_tm = (rand o concl) iabs_dd_th in + + let error_th = + let df = mk_refl_ineq df_tm and + inv2 = mk_refl_ineq float_inv2 and + ( * ) = mul_ineq_pos_const_hi pp and + ( + ) = add_ineq_hi pp in + w_tm * (df + w_tm * (dd_tm * inv2)) in + + let t_tm = (rand o concl) error_th in + let lo_th = float_sub_lo pp f_lo t_tm and + hi_th = float_add_hi pp f_hi t_tm in + let lo_tm = (lhand o concl) lo_th and + hi_tm = (rand o concl) hi_th in + + (MY_PROVE_HYP lo_th o MY_PROVE_HYP hi_th o MY_PROVE_HYP error_th o + MY_PROVE_HYP iabs_df_th o MY_PROVE_HYP iabs_dd_th o MY_PROVE_HYP th o + INST[dd_bounds, dd_bounds_var; dd_tm, dd_var_real; df_bounds, df_bounds_var; + df_tm, df_var_real; t_tm, t_var_real; + lo_tm, lo_var_real; f_lo, f_lo_var; + w_tm, w_var_real; f_hi, f_hi_var; hi_tm, hi_var_real; + f_tm, f_var_fun; x_tm, x_var_real; + y_tm, y_var_real; z_tm, z_var_real]) TAYLOR_F_BOUNDS';; + + +(* +let pp = 3;; +let domain_th = mk_center_domain pp one_float two_float;; +let th = eval_taylor_atn pp domain_th;; +eval_taylor_f_bounds pp th;; +(* 10: 1.620 *) +test 1000 (eval_taylor_f_bounds pp) th;; +*) + + +(****************************) +(* df_bounds *) + + +let TAYLOR_DF_BOUNDS' = RULE taylor_df_bounds;; + +let eval_taylor_df_bounds pp th = + let f_tm, x_tm, y_tm, z_tm, w_tm, f_bounds, df_bounds, dd_bounds = dest_taylor_interval (concl th) in + let df_lo, df_hi = dest_pair df_bounds in + let iabs_dd_th = float_iabs dd_bounds in + let dd_tm = (rand o concl) iabs_dd_th in + let w_dd_hi = float_mul_hi pp w_tm dd_tm in + + let lo_th = sub_ineq_lo pp (mk_refl_ineq df_lo) w_dd_hi and + hi_th = add_ineq_hi pp (mk_refl_ineq df_hi) w_dd_hi in + let lo_tm = (lhand o concl) lo_th and + hi_tm = (rand o concl) hi_th in + + (MY_PROVE_HYP lo_th o MY_PROVE_HYP hi_th o MY_PROVE_HYP th o MY_PROVE_HYP iabs_dd_th o + INST[dd_bounds, dd_bounds_var; dd_tm, dd_var_real; f_bounds, f_bounds_var; + lo_tm, lo_var_real; df_lo, df_lo_var; + w_tm, w_var_real; df_hi, df_hi_var; hi_tm, hi_var_real; + f_tm, f_var_fun; x_tm, x_var_real; + y_tm, y_var_real; z_tm, z_var_real]) TAYLOR_DF_BOUNDS';; + + +(* +let pp = 3;; +let th = eval_taylor_atn pp domain_th;; +eval_taylor_df_bounds pp th;; +*) + +(**************************************************) +(* mk_taylor_interval_th, dest_taylor_interval_th *) + +let TAYLOR_INTERVAL_EQ' = (RULE o prove)(`taylor_interval f x y z w f_bounds df_bounds dd_bounds <=> + cell_domain x y z w /\ lin_approx f y f_bounds df_bounds /\ + has_bounded_second_derivative f (x,z) dd_bounds`, + SIMP_TAC[cell_domain; taylor_interval; CONJ_ACI]);; + +let MK_TAYLOR_INTERVAL' = (RULE o prove)(`cell_domain x y z w /\ + lin_approx f y f_bounds df_bounds /\ + has_bounded_second_derivative f (x,z) dd_bounds ==> + taylor_interval f x y z w f_bounds df_bounds dd_bounds`, + SIMP_TAC[cell_domain; taylor_interval]);; + + +let dest_taylor_interval_th th = + let f_tm, x_tm, y_tm, z_tm, w_tm, f_bounds, df_bounds, dd_bounds = dest_taylor_interval (concl th) in + let th0 = INST[f_tm, f_var_fun; x_tm, x_var_real; y_tm, y_var_real; z_tm, z_var_real; + w_tm, w_var_real; f_bounds, f_bounds_var; + df_bounds, df_bounds_var; dd_bounds, dd_bounds_var] TAYLOR_INTERVAL_EQ' in + let [domain; approx; second] = CONJUNCTS (EQ_MP th0 th) in + domain, approx, second;; + + + +let mk_taylor_interval_th domain_th approx_th second_th = + let x_tm, y_tm, z_tm, w_tm = dest_cell_domain (concl domain_th) in + let f_tm, _, f_bounds, df_bounds = dest_lin_approx (concl approx_th) in + let dd_bounds = rand (concl second_th) in + let th0 = INST[f_tm, f_var_fun; x_tm, x_var_real; y_tm, y_var_real; z_tm, z_var_real; + w_tm, w_var_real; f_bounds, f_bounds_var; + df_bounds, df_bounds_var; dd_bounds, dd_bounds_var] MK_TAYLOR_INTERVAL' in + (MY_PROVE_HYP approx_th o MY_PROVE_HYP domain_th o MY_PROVE_HYP second_th) th0;; + + + +(* +let th = eval_taylor_atn 5 domain_th;; +let domain_th, approx_th, second_th = dest_taylor_interval_th th;; +mk_taylor_interval_th domain_th approx_th second_th;; +*) + + +(**************************************) +(* has_bounded_second_derivative_dest *) + +let HAS_BOUNDED_SECOND_DERIVATIVE_EQ' = SPEC_ALL has_bounded_second_derivative;; + + +let dest_has_bounded_second_derivative tm = + let lhs, dd_bounds = dest_comb tm in + let lhs2, int_tm = dest_comb lhs in + rand lhs2, int_tm, dd_bounds;; + + +let dest_has_bounded_second_derivative_th th = + let f_tm, int_tm, dd_bounds = dest_has_bounded_second_derivative (concl th) in + let th0 = INST[f_tm, f_var_fun; int_tm, int_var; + dd_bounds, dd_bounds_var] HAS_BOUNDED_SECOND_DERIVATIVE_EQ' in + let [diff_th; bounded_th] = CONJUNCTS (EQ_MP th0 th) in + diff_th, bounded_th;; + + +(* +let diff_th, bounded_th = dest_has_bounded_second_derivative_th second_th;; +*) + +(********************************************) + + +(******************************) +(* Taylor interval arithmetic *) +(******************************) + + +(**************************************) +let taylor_interval_tm = `taylor_interval`;; + +let taylor_interval_norm th eq_th = + let lhs1, d2f = dest_comb (concl th) in + let lhs2, d1f = dest_comb lhs1 in + let lhs3, d0f = dest_comb lhs2 in + let lhs4, w = dest_comb lhs3 in + let lhs5, z = dest_comb lhs4 in + let lhs6, y = dest_comb lhs5 in + let x = rand lhs6 in + let th0 = AP_TERM taylor_interval_tm eq_th in + let th1 = (AP_THM (AP_THM (AP_THM (AP_THM (AP_THM (AP_THM (AP_THM th0 x) y) z) w) d0f) d1f) d2f) in + EQ_MP th1 th;; + + +(*************************************) +(* taylor_interval_neg *) +let TAYLOR_INTERVAL_NEG' = (UNDISCH_ALL o prove) + (`cell_domain x y z w ==> + lin_approx (\x. -- (f x)) y bounds d_bounds ==> + nth_diff_strong_int 2 (x,z) f ==> + bounded_on_int (\x. -- nth_derivative 2 f x) (x,z) dd_bounds ==> + taylor_interval (\x. -- (f x)) x y z w bounds d_bounds dd_bounds`, + SIMP_TAC[taylor_interval; cell_domain] THEN ONCE_REWRITE_TAC[REAL_ARITH `--a = (-- (&1)) * a`] THEN + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[second_derivative_scale_bounds]);; + + +let taylor_interval_neg th1 = + let domain_th, approx1_th, second1_th = dest_taylor_interval_th th1 in + let diff1_th, dd1_th = dest_has_bounded_second_derivative_th second1_th in + + let approx_th = lin_approx_neg approx1_th in + let dd_th = bounded_on_int_neg dd1_th in + + let x_tm, y_tm, z_tm, w_tm = dest_cell_domain (concl domain_th) and + f_tm = (rand o concl) diff1_th and + _, _, bounds, d_bounds = dest_lin_approx (concl approx_th) and + dd_bounds = (rand o concl) dd_th in + + let th0 = (MY_PROVE_HYP domain_th o MY_PROVE_HYP approx_th o + MY_PROVE_HYP diff1_th o MY_PROVE_HYP dd_th o + INST[x_tm, x_var_real; y_tm, y_var_real; z_tm, z_var_real; w_tm, w_var_real; + f_tm, f_var_fun; + bounds, bounds_var; d_bounds, d_bounds_var; dd_bounds, dd_bounds_var]) + TAYLOR_INTERVAL_NEG' in + let eq_th = unary_beta_eq f_tm neg_op_real in + taylor_interval_norm th0 eq_th;; + + +(* +let th1 = eval_taylor_x domain_th and + th2 = eval_taylor_sqrt pp domain_th;; +taylor_interval_neg th1;; +taylor_interval_neg th2;; +*) + + + +(*************************************) +(* taylor_interval_add *) + +let TAYLOR_INTERVAL_ADD' = (UNDISCH_ALL o prove) + (`cell_domain x y z w ==> + lin_approx (\x. f x + g x) y bounds d_bounds ==> + nth_diff_strong_int 2 (x,z) f ==> + nth_diff_strong_int 2 (x,z) g ==> + bounded_on_int (\x. nth_derivative 2 f x + nth_derivative 2 g x) (x,z) dd_bounds ==> + taylor_interval (\x. f x + g x) x y z w bounds d_bounds dd_bounds`, + SIMP_TAC[taylor_interval; cell_domain] THEN REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[second_derivative_add_bounds]);; + + +let taylor_interval_add pp th1 th2 = + let domain_th, approx1_th, second1_th = dest_taylor_interval_th th1 and + _, approx2_th, second2_th = dest_taylor_interval_th th2 in + let diff1_th, dd1_th = dest_has_bounded_second_derivative_th second1_th and + diff2_th, dd2_th = dest_has_bounded_second_derivative_th second2_th in + + let approx_th = lin_approx_add pp approx1_th approx2_th in + let dd_th = + let (+) = bounded_on_int_add pp in + dd1_th + dd2_th in + + let x_tm, y_tm, z_tm, w_tm = dest_cell_domain (concl domain_th) and + f_tm = (rand o concl) diff1_th and + g_tm = (rand o concl) diff2_th and + _, _, bounds, d_bounds = dest_lin_approx (concl approx_th) and + dd_bounds = (rand o concl) dd_th in + + let th0 = (MY_PROVE_HYP domain_th o MY_PROVE_HYP approx_th o + MY_PROVE_HYP diff1_th o MY_PROVE_HYP diff2_th o MY_PROVE_HYP dd_th o + INST[x_tm, x_var_real; y_tm, y_var_real; z_tm, z_var_real; w_tm, w_var_real; + f_tm, f_var_fun; g_tm, g_var_fun; + bounds, bounds_var; d_bounds, d_bounds_var; dd_bounds, dd_bounds_var]) + TAYLOR_INTERVAL_ADD' in + let eq_th = binary_beta_eq f_tm g_tm add_op_real in + taylor_interval_norm th0 eq_th;; + + + +(* +let th1 = eval_taylor_x domain_th and + th2 = eval_taylor_sqrt pp domain_th;; +taylor_interval_add pp th1 th2;; +*) + + +(*************************************) +(* taylor_interval_sub *) + +let TAYLOR_INTERVAL_SUB' = (UNDISCH_ALL o prove) + (`cell_domain x y z w ==> + lin_approx (\x. f x - g x) y bounds d_bounds ==> + nth_diff_strong_int 2 (x,z) f ==> + nth_diff_strong_int 2 (x,z) g ==> + bounded_on_int (\x. nth_derivative 2 f x - nth_derivative 2 g x) (x,z) dd_bounds ==> + taylor_interval (\x. f x - g x) x y z w bounds d_bounds dd_bounds`, + SIMP_TAC[taylor_interval; cell_domain] THEN REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[second_derivative_sub_bounds]);; + + +let taylor_interval_sub pp th1 th2 = + let domain_th, approx1_th, second1_th = dest_taylor_interval_th th1 and + _, approx2_th, second2_th = dest_taylor_interval_th th2 in + let diff1_th, dd1_th = dest_has_bounded_second_derivative_th second1_th and + diff2_th, dd2_th = dest_has_bounded_second_derivative_th second2_th in + + let approx_th = lin_approx_sub pp approx1_th approx2_th in + let dd_th = + let (-) = bounded_on_int_sub pp in + dd1_th - dd2_th in + + let x_tm, y_tm, z_tm, w_tm = dest_cell_domain (concl domain_th) and + f_tm = (rand o concl) diff1_th and + g_tm = (rand o concl) diff2_th and + _, _, bounds, d_bounds = dest_lin_approx (concl approx_th) and + dd_bounds = (rand o concl) dd_th in + + let th0 = (MY_PROVE_HYP domain_th o MY_PROVE_HYP approx_th o + MY_PROVE_HYP diff1_th o MY_PROVE_HYP diff2_th o MY_PROVE_HYP dd_th o + INST[x_tm, x_var_real; y_tm, y_var_real; z_tm, z_var_real; w_tm, w_var_real; + f_tm, f_var_fun; g_tm, g_var_fun; + bounds, bounds_var; d_bounds, d_bounds_var; dd_bounds, dd_bounds_var]) + TAYLOR_INTERVAL_SUB' in + let eq_th = binary_beta_eq f_tm g_tm sub_op_real in + taylor_interval_norm th0 eq_th;; + + + +(* +let th1 = eval_taylor_x domain_th and + th2 = eval_taylor_sqrt pp domain_th;; +taylor_interval_sub pp th1 th2;; +*) + + +(*************************************) +(* taylor_interval_mul *) + +let TAYLOR_INTERVAL_MUL' = (UNDISCH_ALL o prove) + (`cell_domain x y z w ==> + lin_approx (\x. f x * g x) y bounds d_bounds ==> + nth_diff_strong_int 2 (x,z) f ==> + nth_diff_strong_int 2 (x,z) g ==> + bounded_on_int (\x. f x * nth_derivative 2 g x + &2 * derivative f x * derivative g x + + nth_derivative 2 f x * g x) (x,z) dd_bounds ==> + taylor_interval (\x. f x * g x) x y z w bounds d_bounds dd_bounds`, + SIMP_TAC[taylor_interval; cell_domain] THEN REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[second_derivative_mul_bounds]);; + + +let taylor_interval_mul pp th1 th2 = + let domain_th, approx1_th, second1_th = dest_taylor_interval_th th1 and + _, approx2_th, second2_th = dest_taylor_interval_th th2 in + let diff1_th, dd1_th = dest_has_bounded_second_derivative_th second1_th and + diff2_th, dd2_th = dest_has_bounded_second_derivative_th second2_th in + + let approx_th = lin_approx_mul pp approx1_th approx2_th in + let dd_th = + let dest = dest_bounded_on_int_raw in + let f = (dest o eval_taylor_f_bounds pp) th1 and + g = (dest o eval_taylor_f_bounds pp) th2 and + df = (dest o eval_taylor_df_bounds pp) th1 and + dg = (dest o eval_taylor_df_bounds pp) th2 and + ddf = dest dd1_th and + ddg = dest dd2_th and + (+) = float_interval_add pp and + ( * ) = float_interval_mul pp in + mk_bounded_on_int (f * ddg + (two_interval * (df * dg) + ddf * g)) in + + let x_tm, y_tm, z_tm, w_tm = dest_cell_domain (concl domain_th) and + f_tm = (rand o concl) diff1_th and + g_tm = (rand o concl) diff2_th and + _, _, bounds, d_bounds = dest_lin_approx (concl approx_th) and + dd_bounds = (rand o concl) dd_th in + + let th0 = (MY_PROVE_HYP domain_th o MY_PROVE_HYP approx_th o + MY_PROVE_HYP diff1_th o MY_PROVE_HYP diff2_th o MY_PROVE_HYP dd_th o + INST[x_tm, x_var_real; y_tm, y_var_real; z_tm, z_var_real; w_tm, w_var_real; + f_tm, f_var_fun; g_tm, g_var_fun; + bounds, bounds_var; d_bounds, d_bounds_var; dd_bounds, dd_bounds_var]) + TAYLOR_INTERVAL_MUL' in + let eq_th = binary_beta_eq f_tm g_tm mul_op_real in + taylor_interval_norm th0 eq_th;; + + + +(* +let th1 = eval_taylor_x domain_th and + th2 = eval_taylor_sqrt pp domain_th;; +let th3 = taylor_interval_sub pp th1 th2;; +taylor_interval_mul pp th1 th3;; +*) + + + +(*************************************) +(* taylor_interval_div *) + +let TAYLOR_INTERVAL_DIV' = (UNDISCH_ALL o prove) + (`cell_domain x y z w ==> + bounded_on_int g (x,z) g_bounds ==> + interval_not_zero g_bounds ==> + lin_approx (\x. f x / g x) y bounds d_bounds ==> + nth_diff_strong_int 2 (x,z) f ==> + nth_diff_strong_int 2 (x,z) g ==> + bounded_on_int (\x. ((nth_derivative 2 f x * g x - f x * nth_derivative 2 g x) * g x - + &2 * derivative g x * (derivative f x * g x - f x * derivative g x)) / + (g x * g x * g x)) (x,z) dd_bounds ==> + taylor_interval (\x. f x / g x) x y z w bounds d_bounds dd_bounds`, + SIMP_TAC[taylor_interval; cell_domain] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC ((SPEC_ALL o REWRITE_RULE[IMP_IMP]) second_derivative_div_bounds) THEN + ASM_REWRITE_TAC[REAL_ARITH `g x pow 3 = g x * g x * (g:real->real) x`]);; + + +let taylor_interval_div pp th1 th2 = + let domain_th, approx1_th, second1_th = dest_taylor_interval_th th1 and + _, approx2_th, second2_th = dest_taylor_interval_th th2 in + let diff1_th, dd1_th = dest_has_bounded_second_derivative_th second1_th and + diff2_th, dd2_th = dest_has_bounded_second_derivative_th second2_th in + + let g_bounds_th = eval_taylor_f_bounds pp th2 and + approx_th = lin_approx_div pp approx1_th approx2_th in + let g_bounds = (rand o concl) g_bounds_th in + let cond_th = check_interval_not_zero g_bounds in + + let dd_th = + let dest = dest_bounded_on_int_raw in + let f = (dest o eval_taylor_f_bounds pp) th1 and + g = dest g_bounds_th and + df = (dest o eval_taylor_df_bounds pp) th1 and + dg = (dest o eval_taylor_df_bounds pp) th2 and + ddf = dest dd1_th and + ddg = dest dd2_th and + (-) = float_interval_sub pp and + ( * ) = float_interval_mul pp and + (/) = float_interval_div pp in + mk_bounded_on_int (((ddf * g - f * ddg) * g - two_interval * (dg * (df * g - f * dg))) / (g * (g * g))) in + + let x_tm, y_tm, z_tm, w_tm = dest_cell_domain (concl domain_th) and + f_tm = (rand o concl) diff1_th and + g_tm = (rand o concl) diff2_th and + _, _, bounds, d_bounds = dest_lin_approx (concl approx_th) and + dd_bounds = (rand o concl) dd_th in + + let th0 = (MY_PROVE_HYP domain_th o MY_PROVE_HYP approx_th o + MY_PROVE_HYP g_bounds_th o MY_PROVE_HYP cond_th o + MY_PROVE_HYP diff1_th o MY_PROVE_HYP diff2_th o MY_PROVE_HYP dd_th o + INST[x_tm, x_var_real; y_tm, y_var_real; z_tm, z_var_real; w_tm, w_var_real; + f_tm, f_var_fun; g_tm, g_var_fun; g_bounds, g_bounds_var; + bounds, bounds_var; d_bounds, d_bounds_var; dd_bounds, dd_bounds_var]) + TAYLOR_INTERVAL_DIV' in + let eq_th = binary_beta_eq f_tm g_tm div_op_real in + taylor_interval_norm th0 eq_th;; + + +(* +let pp = 5;; +let domain_th = mk_center_domain pp one_float two_float;; +let th1 = eval_taylor_x domain_th and + th2 = eval_taylor_sqrt pp domain_th;; +let th3 = taylor_interval_sub pp th1 th2;; +taylor_interval_div pp th1 th2;; +taylor_interval_div pp th3 th2;; +(* 10: 3.372 *) +test 100 (taylor_interval_div pp th1) th2;; +*) + + +(*************************************) +(* taylor_interval_atn *) + +let TAYLOR_INTERVAL_ATN' = (UNDISCH_ALL o REWRITE_RULE[REAL_POW_2] o prove) + (`cell_domain x y z w ==> + lin_approx (\x. atn (f x)) y bounds d_bounds ==> + nth_diff_strong_int 2 (x,z) f ==> + bounded_on_int (\x. (nth_derivative 2 f x * (&1 + f x * f x) - &2 * f x * derivative f x pow 2) / + (&1 + f x * f x) pow 2) (x,z) dd_bounds ==> + taylor_interval (\x. atn (f x)) x y z w bounds d_bounds dd_bounds`, + SIMP_TAC[taylor_interval; cell_domain] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC ((SPEC_ALL o REWRITE_RULE[IMP_IMP]) second_derivative_compose_atn_bounds) THEN + ASM_REWRITE_TAC[]);; + + +let taylor_interval_atn pp th1 = + let domain_th, approx1_th, second1_th = dest_taylor_interval_th th1 in + let diff1_th, dd1_th = dest_has_bounded_second_derivative_th second1_th in + + let approx_th = lin_approx_atn pp approx1_th in + let dd_th = + let dest = dest_bounded_on_int_raw in + let f = (dest o eval_taylor_f_bounds pp) th1 and + df = (dest o eval_taylor_df_bounds pp) th1 and + ddf = dest dd1_th and + (+) = float_interval_add pp and + (-) = float_interval_sub pp and + ( * ) = float_interval_mul pp and + (/) = float_interval_div pp in + let ff1 = one_interval + f * f in + mk_bounded_on_int ((ddf * ff1 - two_interval * (f * (df * df))) / (ff1 * ff1)) in + + let x_tm, y_tm, z_tm, w_tm = dest_cell_domain (concl domain_th) and + f_tm = (rand o concl) diff1_th and + _, _, bounds, d_bounds = dest_lin_approx (concl approx_th) and + dd_bounds = (rand o concl) dd_th in + + let th0 = (MY_PROVE_HYP domain_th o MY_PROVE_HYP approx_th o + MY_PROVE_HYP diff1_th o MY_PROVE_HYP dd_th o + INST[x_tm, x_var_real; y_tm, y_var_real; z_tm, z_var_real; w_tm, w_var_real; + f_tm, f_var_fun; + bounds, bounds_var; d_bounds, d_bounds_var; dd_bounds, dd_bounds_var]) + TAYLOR_INTERVAL_ATN' in + let eq_th = unary_beta_eq f_tm atn_tm in + taylor_interval_norm th0 eq_th;; + + +(* +let pp = 5;; +let domain_th = mk_center_domain pp one_float two_float;; +let th1 = eval_taylor_x domain_th and + th2 = eval_taylor_sqrt pp domain_th;; +let th3 = taylor_interval_add pp th1 th2;; +taylor_interval_atn pp th1;; +taylor_interval_atn pp th2;; +taylor_interval_atn pp th3;; +*) + + + + +(*************************************) +(* taylor_interval_inv *) + +let TAYLOR_INTERVAL_INV' = (UNDISCH_ALL o REWRITE_RULE[REAL_POW_2; REAL_ARITH `a pow 3 = a * a * a`] o prove) + (`cell_domain x y z w ==> + bounded_on_int f (x,z) f_bounds ==> + interval_not_zero f_bounds ==> + lin_approx (\x. inv (f x)) y bounds d_bounds ==> + nth_diff_strong_int 2 (x,z) f ==> + bounded_on_int (\x. (&2 * derivative f x pow 2 - nth_derivative 2 f x * f x) / (f x pow 3)) (x,z) dd_bounds + ==> taylor_interval (\x. inv (f x)) x y z w bounds d_bounds dd_bounds`, + SIMP_TAC[taylor_interval; cell_domain] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC ((SPEC_ALL o REWRITE_RULE[IMP_IMP]) second_derivative_compose_inv_bounds) THEN + ASM_REWRITE_TAC[]);; + + +let taylor_interval_inv pp th1 = + let domain_th, approx1_th, second1_th = dest_taylor_interval_th th1 in + let diff1_th, dd1_th = dest_has_bounded_second_derivative_th second1_th in + + let f_bounds_th = eval_taylor_f_bounds pp th1 and + approx_th = lin_approx_inv pp approx1_th in + let f_bounds = (rand o concl) f_bounds_th in + let cond_th = check_interval_not_zero f_bounds in + + let dd_th = + let dest = dest_bounded_on_int_raw in + let f = dest f_bounds_th and + df = (dest o eval_taylor_df_bounds pp) th1 and + ddf = dest dd1_th and + (-) = float_interval_sub pp and + ( * ) = float_interval_mul pp and + (/) = float_interval_div pp in + mk_bounded_on_int ((two_interval * (df * df) - ddf * f) / (f * (f * f))) in + + let x_tm, y_tm, z_tm, w_tm = dest_cell_domain (concl domain_th) and + f_tm = (rand o concl) diff1_th and + _, _, bounds, d_bounds = dest_lin_approx (concl approx_th) and + dd_bounds = (rand o concl) dd_th in + + let th0 = (MY_PROVE_HYP domain_th o MY_PROVE_HYP approx_th o + MY_PROVE_HYP f_bounds_th o MY_PROVE_HYP cond_th o + MY_PROVE_HYP diff1_th o MY_PROVE_HYP dd_th o + INST[x_tm, x_var_real; y_tm, y_var_real; z_tm, z_var_real; w_tm, w_var_real; + f_tm, f_var_fun; f_bounds, f_bounds_var; + bounds, bounds_var; d_bounds, d_bounds_var; dd_bounds, dd_bounds_var]) + TAYLOR_INTERVAL_INV' in + let eq_th = unary_beta_eq f_tm inv_tm in + taylor_interval_norm th0 eq_th;; + + +(* +let pp = 5;; +let domain_th = mk_center_domain pp one_float two_float;; +let th1 = eval_taylor_x domain_th and + th2 = eval_taylor_sqrt pp domain_th;; +let th3 = taylor_interval_add pp th1 th2;; +taylor_interval_inv pp th1;; +taylor_interval_inv pp th2;; +taylor_interval_inv pp th3;; +*) + + + +(*************************************) +(* taylor_interval_sqrt *) + +let TAYLOR_INTERVAL_SQRT' = (UNDISCH_ALL o REWRITE_RULE[REAL_POW_2; REAL_ARITH `a pow 3 = a * a * a`] o prove) + (`cell_domain x y z w ==> + bounded_on_int f (x,z) f_bounds ==> + interval_pos f_bounds ==> + lin_approx (\x. sqrt (f x)) y bounds d_bounds ==> + nth_diff_strong_int 2 (x,z) f ==> + bounded_on_int (\x. (&2 * nth_derivative 2 f x * f x - derivative f x pow 2) / + (&4 * sqrt (f x pow 3))) (x,z) dd_bounds ==> + taylor_interval (\x. sqrt (f x)) x y z w bounds d_bounds dd_bounds`, + SIMP_TAC[taylor_interval; cell_domain] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC ((SPEC_ALL o REWRITE_RULE[IMP_IMP]) second_derivative_compose_sqrt_bounds) THEN + ASM_REWRITE_TAC[]);; + + +let taylor_interval_sqrt pp th1 = + let domain_th, approx1_th, second1_th = dest_taylor_interval_th th1 in + let diff1_th, dd1_th = dest_has_bounded_second_derivative_th second1_th in + + let f_bounds_th = eval_taylor_f_bounds pp th1 and + approx_th = lin_approx_sqrt pp approx1_th in + let f_bounds = (rand o concl) f_bounds_th in + let cond_th = check_interval_pos f_bounds in + + let dd_th = + let dest = dest_bounded_on_int_raw in + let f = dest f_bounds_th and + df = (dest o eval_taylor_df_bounds pp) th1 and + ddf = dest dd1_th and + (-) = float_interval_sub pp and + ( * ) = float_interval_mul pp and + (/) = float_interval_div pp and + sqrt = float_interval_sqrt pp in + mk_bounded_on_int ((two_interval * (ddf * f) - df * df) / (four_interval * sqrt (f * (f * f)))) in + + let x_tm, y_tm, z_tm, w_tm = dest_cell_domain (concl domain_th) and + f_tm = (rand o concl) diff1_th and + _, _, bounds, d_bounds = dest_lin_approx (concl approx_th) and + dd_bounds = (rand o concl) dd_th in + + let th0 = (MY_PROVE_HYP domain_th o MY_PROVE_HYP approx_th o + MY_PROVE_HYP f_bounds_th o MY_PROVE_HYP cond_th o + MY_PROVE_HYP diff1_th o MY_PROVE_HYP dd_th o + INST[x_tm, x_var_real; y_tm, y_var_real; z_tm, z_var_real; w_tm, w_var_real; + f_tm, f_var_fun; f_bounds, f_bounds_var; + bounds, bounds_var; d_bounds, d_bounds_var; dd_bounds, dd_bounds_var]) + TAYLOR_INTERVAL_SQRT' in + let eq_th = unary_beta_eq f_tm sqrt_tm in + taylor_interval_norm th0 eq_th;; + + +(* +let pp = 5;; +let domain_th = mk_center_domain pp one_float two_float;; +let th1 = eval_taylor_x domain_th and + th2 = eval_taylor_sqrt pp domain_th;; +let th3 = taylor_interval_add pp th1 th2;; +taylor_interval_sqrt pp th1;; +taylor_interval_sqrt pp th2;; +taylor_interval_sqrt pp th3;; +*) + + +(*************************************) +(* taylor_interval_acs *) + +let TAYLOR_INTERVAL_ACS' = + (UNDISCH_ALL o PURE_ONCE_REWRITE_RULE[iabs_lt1_lemma] o + REWRITE_RULE[REAL_POW_2; REAL_ARITH `a pow 3 = a * a * a`] o prove) + (`cell_domain x y z w ==> + bounded_on_int f (x,z) f_bounds ==> + (iabs f_bounds < &1 <=> T)==> + lin_approx (\x. acs (f x)) y bounds d_bounds ==> + nth_diff_strong_int 2 (x,z) f ==> + bounded_on_int (\x. --((nth_derivative 2 f x * (&1 - f x * f x) + f x * derivative f x pow 2) / + sqrt ((&1 - f x * f x) pow 3))) (x,z) dd_bounds ==> + taylor_interval (\x. acs (f x)) x y z w bounds d_bounds dd_bounds`, + SIMP_TAC[taylor_interval; cell_domain] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC ((SPEC_ALL o REWRITE_RULE[IMP_IMP]) second_derivative_compose_acs_bounds) THEN + ASM_REWRITE_TAC[]);; + + +let taylor_interval_acs pp th1 = + let domain_th, approx1_th, second1_th = dest_taylor_interval_th th1 in + let diff1_th, dd1_th = dest_has_bounded_second_derivative_th second1_th in + + let f_bounds_th = eval_taylor_f_bounds pp th1 and + approx_th = lin_approx_acs pp approx1_th in + let f_bounds = (rand o concl) f_bounds_th in + let cond_th = check_interval_iabs f_bounds one_float in + + let dd_th = + let dest = dest_bounded_on_int_raw in + let f = dest f_bounds_th and + df = (dest o eval_taylor_df_bounds pp) th1 and + ddf = dest dd1_th and + (+) = float_interval_add pp and + (-) = float_interval_sub pp and + ( * ) = float_interval_mul pp and + (/) = float_interval_div pp and + sqrt = float_interval_sqrt pp and + neg = float_interval_neg in + let ff1 = one_interval - f * f in + mk_bounded_on_int (neg ((ddf * ff1 + f * (df * df)) / sqrt (ff1 * (ff1 * ff1)))) in + + let x_tm, y_tm, z_tm, w_tm = dest_cell_domain (concl domain_th) and + f_tm = (rand o concl) diff1_th and + _, _, bounds, d_bounds = dest_lin_approx (concl approx_th) and + dd_bounds = (rand o concl) dd_th in + + let th0 = (MY_PROVE_HYP domain_th o MY_PROVE_HYP approx_th o + MY_PROVE_HYP f_bounds_th o MY_PROVE_HYP cond_th o + MY_PROVE_HYP diff1_th o MY_PROVE_HYP dd_th o + INST[x_tm, x_var_real; y_tm, y_var_real; z_tm, z_var_real; w_tm, w_var_real; + f_tm, f_var_fun; f_bounds, f_bounds_var; + bounds, bounds_var; d_bounds, d_bounds_var; dd_bounds, dd_bounds_var]) + TAYLOR_INTERVAL_ACS' in + let eq_th = unary_beta_eq f_tm acs_tm in + taylor_interval_norm th0 eq_th;; + + +(* +let pp = 5;; +let domain_th = mk_center_domain pp (mk_float (-5) 49) (mk_float 3 49);; +let th1 = eval_taylor_x domain_th and + th2 = eval_taylor_atn pp domain_th;; +let th3 = taylor_interval_mul pp th1 th2;; + +taylor_interval_acs pp th1;; +taylor_interval_acs pp th2;; +taylor_interval_acs pp th3;; +*) + + + + + + + +(****************************************) +(* Composition *) + +let dest_bounded_on_int_tm tm = + let lhs, f_bounds = dest_comb tm in + let lhs2, int_tm = dest_comb lhs in + rand lhs2, int_tm, f_bounds;; + +let dest_interval_arith tm = + let lhs, int_tm = dest_comb tm in + rand lhs, int_tm;; + + +let BOUNDED_SECOND_DERIVATIVE_COMPOSE' = (UNDISCH_ALL o REWRITE_RULE[REAL_POW_2] o SPEC_ALL) + second_derivative_compose_bounds;; + +let BOUNDED_ON_INT_COMPOSE' = (UNDISCH_ALL o SPEC_ALL) bounded_on_int_compose;; + +let TAYLOR_INTERVAL_NARROW' = (UNDISCH_ALL o PURE_ONCE_REWRITE_RULE[REAL_ARITH `a <= b <=> (a <= b <=> T)`] o + SPEC_ALL) taylor_interval_narrow;; + +let BOUNDED_ON_INT_IMP_INTERVAL' = (UNDISCH_ALL o SPEC_ALL) bounded_on_int_imp_interval_arith;; + +let LIN_APPROX_COMPOSE' = (UNDISCH_ALL o SPEC_ALL) lin_approx_compose;; + + + +let taylor_interval_compose pp eval_f eval_g domain_th = + let g_taylor = eval_g pp domain_th in + let _, lin_g, second_g = dest_taylor_interval_th g_taylor in + let dg_th, g2_th = dest_has_bounded_second_derivative_th second_g in + let g0_th = eval_taylor_f_bounds pp g_taylor in + let g1_th = eval_taylor_df_bounds pp g_taylor in + let g_tm, y_tm, g_bounds0, _ = dest_lin_approx (concl lin_g) in + + (* narrow domain *) + let g0_lo, g0_hi = dest_pair g_bounds0 in + let fu_domain = mk_center_domain (pp + 1) g0_lo g0_hi in + let w0_tm = (rand o concl) fu_domain in + + (* wide domain *) + let _, u_tm, _, _ = dest_cell_domain (concl fu_domain) in + let g_lo, g_hi = (dest_pair o rand o concl) g0_th in + let fw_domain = mk_cell_domain pp g_lo u_tm g_hi in + let w_tm = (rand o concl) fw_domain in + + (* taylor_interval f *) + let f_taylor = eval_f pp fw_domain in + let f1_th = eval_taylor_df_bounds pp f_taylor in + let _, lin_f, second_f = dest_taylor_interval_th f_taylor in + let f_tm, _, f_bounds0, df_bounds0 = dest_lin_approx (concl lin_f) in + let df_th, f2_th = dest_has_bounded_second_derivative_th second_f in + + (* has_bounded_second_derivative (\x. f (g x)) *) + let _, int_tm, g_bounds = dest_bounded_on_int_tm (concl g0_th) in + let df_tm, _, df_bounds = dest_bounded_on_int_tm (concl f1_th) in + let ddf_tm, _, ddf_bounds = dest_bounded_on_int_tm (concl f2_th) in + + let f2_g_bounded_th = (MY_PROVE_HYP g0_th o MY_PROVE_HYP f2_th o + INST[ddf_tm, f_var_fun; g_tm, g_var_fun; g_bounds, g_bounds_var; + ddf_bounds, f_bounds_var; int_tm, int_var]) BOUNDED_ON_INT_COMPOSE' in + let f1_g_bounded_th = (MY_PROVE_HYP g0_th o MY_PROVE_HYP f1_th o + INST[df_tm, f_var_fun; g_tm, g_var_fun; g_bounds, g_bounds_var; + df_bounds, f_bounds_var; int_tm, int_var]) BOUNDED_ON_INT_COMPOSE' in + + let fg2_bounded_th0 = + let ( * ) = bounded_on_int_mul pp and + (+) = bounded_on_int_add pp in + (f2_g_bounded_th * (g1_th * g1_th) + f1_g_bounded_th * g2_th) in + + let dd_bounds = (rand o concl) fg2_bounded_th0 in + let fg2_bounded_th = (MY_PROVE_HYP fg2_bounded_th0 o MY_PROVE_HYP g0_th o + MY_PROVE_HYP dg_th o MY_PROVE_HYP df_th o + INST[f_tm, f_var_fun; g_tm, g_var_fun; int_tm, int_var; + dd_bounds, dd_bounds_var; g_bounds, g_bounds_var]) + BOUNDED_SECOND_DERIVATIVE_COMPOSE' in + + (* lin_approx (\x. f (g x)) *) + let fu_taylor = (MY_PROVE_HYP (float_le g_lo g0_lo) o MY_PROVE_HYP (float_le g0_hi g_hi) o + MY_PROVE_HYP fu_domain o MY_PROVE_HYP f_taylor o + INST[g0_lo, x0_var_real; u_tm, y_var_real; g0_hi, z0_var_real; w0_tm, w0_var_real; + f_tm, f_var_fun; g_lo, x_var_real; g_hi, z_var_real; w_tm, w_var_real; + f_bounds0, f_bounds_var; df_bounds0, df_bounds_var; ddf_bounds, dd_bounds_var]) + TAYLOR_INTERVAL_NARROW' in + + let df0_th = + let _, _, f_second = dest_taylor_interval_th fu_taylor in + (fst o dest_has_bounded_second_derivative_th) f_second in + let f00_th = eval_taylor_f_bounds pp fu_taylor in + let f01_th = eval_taylor_df_bounds pp fu_taylor in + let fg_bounds0 = (rand o concl) f00_th in + let dfg_bounds0 = (rand o concl) f01_th in + + let dg0_th, int_g_th, int_dg_th = lin_approx_components lin_g in + let gy_tm, _ = dest_interval_arith (concl int_g_th) in + + let int_df_g_th = (MY_PROVE_HYP int_g_th o MY_PROVE_HYP f01_th o + INST[df_tm, f_var_fun; gy_tm, y_var_real; g_bounds0, int_var; dfg_bounds0, f_bounds_var]) + BOUNDED_ON_INT_IMP_INTERVAL' in + + let int_dfg_th = float_interval_mul pp int_dg_th int_df_g_th in + let dfg_bounds00 = rand (concl int_dfg_th) in + + let fg_lin_th = (MY_PROVE_HYP int_dfg_th o MY_PROVE_HYP int_g_th o MY_PROVE_HYP f00_th o + MY_PROVE_HYP dg0_th o MY_PROVE_HYP df0_th o + INST[f_tm, f_var_fun; g_tm, g_var_fun; y_tm, y_var_real; dfg_bounds00, d_bounds_var; + g_bounds0, g_bounds_var; fg_bounds0, f_bounds_var]) LIN_APPROX_COMPOSE' in + + (* beta reduction *) + let gx_tm = mk_comb (g_tm, x_var_real) in + let gx_th = if is_abs g_tm then BETA gx_tm else REFL gx_tm in + + let fgx_th0 = MK_COMB (REFL f_tm, gx_th) in + let fgx_eq_th = ABS x_var_real + (if is_abs f_tm then TRANS fgx_th0 (BETA_CONV (rand (concl fgx_th0))) else fgx_th0) in + + let fg_lin_th1 = norm_lin_approx fg_lin_th fgx_eq_th and + fg2_bounded_th1 = norm_second_derivative fg2_bounded_th fgx_eq_th in + + mk_taylor_interval_th domain_th fg_lin_th1 fg2_bounded_th1;; + + + + + diff --git a/formal_lp/old/formal_interval/test.hl b/formal_lp/old/formal_interval/test.hl new file mode 100644 index 0000000..95e25ce --- /dev/null +++ b/formal_lp/old/formal_interval/test.hl @@ -0,0 +1,418 @@ +needs "../formal_lp/formal_interval/verifier.hl";; + + +(************) +(* Examples *) +(************) + +(* f(x) = x * x - atn x; f(x) < 0 when 0.01 <= x <= 0.8 *) +prove_ineq1d 5 `x * x - atn x` `#0.01` `#0.8`;; + +(* f(x) = x * x * x - atn (x * x); f(x) < 0 when 0.01 <= x <= 0.8 *) +prove_ineq1d 5 `x * x * x - atn (x * x)` `#0.01` `#0.8`;; + +(* f(x) = atn x - x; f(x) < 0 when 0.001 <= x <= sqrt(2) *) +prove_ineq1d 10 `atn x - x` `#0.001` `sqrt (&2) + pi`;; + + +(****************************************) +(* arclength #2.52 #2.52 (&2) >= #0.816 *) +(* arclength (&2) #2.52 (&2) - arclength #2.52 #2.52 (&2) >= #0.073 *) +(* arclength a b c = acs ((a * a + b * b - c * c) / (&2 * a * b)) *) + +let arclength_tm = `acs ((a * a + b * b - c * c) / (&2 * a * b))`;; +let tm1 = subst[`#2.52`, `a:real`; `#2.52`, `b:real`; `&2`, `c:real`] arclength_tm and + tm2 = subst[`&2`, `a:real`; `#2.52`, `b:real`; `&2`, `c:real`] arclength_tm;; + +let ineq1, ineq2 = + let (-) = mk_binop sub_op_real in + `#0.816` - tm1, `#0.073` - (tm2 - tm1);; + +prove_ineq1d 6 ineq1 `&0` `&0`;; +prove_ineq1d 6 ineq2 `&0` `&0`;; + + +(********************************************) +(* !x. &2 <= x /\ x <= #2.52 *) +(* ==> arclength (&2) x (&2) - arclength (#2.52) x (&2) >= #0.073` *) + +let ineq = + let tm1 = subst[`&2`, `a:real`; `x:real`, `b:real`; `&2`, `c:real`] arclength_tm and + tm2 = subst[`#2.52`, `a:real`; `x:real`, `b:real`; `&2`, `c:real`] arclength_tm and + (-) = mk_binop sub_op_real in + `#0.073` - (tm1 - tm2);; + +prove_ineq1d 7 ineq `&2` `#2.52`;; + + +(***********************) +(* !x. &2 <= x /\ x <= #2.52 ==> &1 / &4 * --inv (sqrt (&1 - (x / &4) pow 2)) <= -- #0.28 *) + +prove_ineq1d 4 `#0.28 + &1 / &4 * --inv (sqrt (&1 - (x * inv(&4)) * (x * inv(&4))))` `&2` `#2.52`;; + +(* !x. &2 <= x /\ x <= #2.52 ==> + inv (sqrt (&1 - ((&3969 / &625 + x * x - &4) / (&2 * #2.52 * x)) pow 2)) <= &2 *) + +let ineq = (rand o concl o REWRITE_CONV[REAL_POW_2]) + `inv (sqrt (&1 - ((&3969 / &625 + x * x - &4) / (&2 * #2.52 * x)) pow 2)) - &2`;; + +prove_ineq1d 3 ineq `&2` `#2.52`;; + + + +(***********************************************) +(* |atn x - x / (1 + 0.28 * x * x)| < 0.005 when x IN [0, 1] *) +let abs_lemma = prove(`f - eps < &0 ==> -- eps - f < &0 ==> abs f < eps`, REAL_ARITH_TAC);; + +let tm = `atn x - x / (&1 + #0.28 * x * x)`;; +let eps = `#0.005`;; +let hi_tm = mk_binop sub_op_real tm eps;; +let lo_tm = mk_binop sub_op_real (mk_comb (neg_op_real, eps)) tm;; +let hi_th = (UNDISCH_ALL o SPEC_ALL) (prove_ineq1d 5 hi_tm `&0` `&1`);; +let lo_th = (UNDISCH_ALL o SPEC_ALL) (prove_ineq1d 6 lo_tm `&0` `&1`);; +(GEN_ALL o DISCH_ALL) (MATCH_MP (MATCH_MP abs_lemma hi_th) lo_th);; + + + +(*************************************) +(* A polynomial approximation of atn *) +let tm = `x * (&1 - (x * x) * (&11184811 / &33554432 - (x * x) * (&13421773 / &67108864))) - atn x`;; +let eps = `#0.0000001`;; +let hi_tm = mk_binop sub_op_real tm eps;; +let lo_tm = mk_binop sub_op_real (mk_comb (neg_op_real, eps)) tm;; +let hi_th = (UNDISCH_ALL o SPEC_ALL) (prove_ineq1d 8 hi_tm `&0` `&1 / &30`) and + lo_th = (UNDISCH_ALL o SPEC_ALL) (prove_ineq1d 8 lo_tm `&0` `&1 / &30`) and + hi_th' = (UNDISCH_ALL o SPEC_ALL) (prove_ineq1d 8 hi_tm `-- &1 / &30` `&0`) and + lo_th' = (UNDISCH_ALL o SPEC_ALL) (prove_ineq1d 8 lo_tm `-- &1 / &30` `&0`);; + + +(GEN_ALL o DISCH_ALL) (MATCH_MP (MATCH_MP abs_lemma hi_th) lo_th);; + + + +(***********************************) +(* A rational approximation of atn *) + + +let atan1 = `let P00, P01, P02 = #4.26665376811246382, #3.291955407318148, #0.281939359003812 in + let Q00, Q01 = #4.26665376811354027, #4.714173328637605 in + let x1 = x * x in + let x2 = x1 * x1 in + x * (x1 * P01 + x2 * P02 + P00) / (x1 * Q01 + x2 + Q00) - atn x`;; +let atan1_tm = (rand o concl o REPEATC let_CONV) atan1;; + +let eps = `#0.00001`;; +let hi_tm = mk_binop sub_op_real atan1_tm eps;; +let lo_tm = mk_binop sub_op_real (mk_comb (neg_op_real, eps)) atan1_tm;; +let hi_th = (UNDISCH_ALL o SPEC_ALL) (prove_ineq1d 10 hi_tm `&0` `#0.2`);; +let lo_th = (UNDISCH_ALL o SPEC_ALL) (prove_ineq1d 10 lo_tm `&0` `#0.2`);; +(GEN_ALL o DISCH_ALL) (MATCH_MP (MATCH_MP abs_lemma hi_th) lo_th);; + + +(* +(* A higher precision approximation *) +let eps = `#0.0000000001`;; +let hi_tm = mk_binop sub_op_real atan1_tm eps;; +let lo_tm = mk_binop sub_op_real (mk_comb (neg_op_real, eps)) atan1_tm;; +let hi_th = (UNDISCH_ALL o SPEC_ALL) (prove_ineq1d 15 hi_tm `&0` `#0.2`);; +let lo_th = (UNDISCH_ALL o SPEC_ALL) (prove_ineq1d 15 lo_tm `&0` `#0.2`);; +(GEN_ALL o DISCH_ALL) (MATCH_MP (MATCH_MP abs_lemma hi_th) lo_th);; +*) + + + +(****************************************************************) +(* Test 1: f(x) = x * x - atn x; f(x) < 0 when 0.01 <= x <= 0.8 *) +(****************************************************************) + +llet eps = `#0.00001`;; +let hi_tm = mk_binop sub_op_real atan1_tm eps;; +let lo_tm = mk_binop sub_op_real (mk_comb (neg_op_real, eps)) atan1_tm;; +let hi_th = (UNDISCH_ALL o SPEC_ALL) (prove_ineq1d 10 hi_tm `&0` `#0.2`);; +let lo_th = (UNDISCH_ALL o SPEC_ALL) (prove_ineq1d 10 lo_tm `&0` `#0.2`);; +(GEN_ALL o DISCH_ALL) (MATCH_MP (MATCH_MP abs_lemma hi_th) lo_th);; +let eps = `#0.00001`;; +let hi_tm = mk_binop sub_op_real atan1_tm eps;; +let lo_tm = mk_binop sub_op_real (mk_comb (neg_op_real, eps)) atan1_tm;; +let hi_th = (UNDISCH_ALL o SPEC_ALL) (prove_ineq1d 10 hi_tm `&0` `#0.2`);; +let lo_th = (UNDISCH_ALL o SPEC_ALL) (prove_ineq1d 10 lo_tm `&0` `#0.2`);; +(GEN_ALL o DISCH_ALL) (MATCH_MP (MATCH_MP abs_lemma hi_th) lo_th);; +let eps = `#0.00001`;; +let hi_tm = mk_binop sub_op_real atan1_tm eps;; +let lo_tm = mk_binop sub_op_real (mk_comb (neg_op_real, eps)) atan1_tm;; +let hi_th = (UNDISCH_ALL o SPEC_ALL) (prove_ineq1d 10 hi_tm `&0` `#0.2`);; +let lo_th = (UNDISCH_ALL o SPEC_ALL) (prove_ineq1d 10 lo_tm `&0` `#0.2`);; +(GEN_ALL o DISCH_ALL) (MATCH_MP (MATCH_MP abs_lemma hi_th) lo_th);; +et x_tm = mk_float 1 48;; +let z_tm = mk_float 8 49;; + +let domain_th = mk_center_domain 5 x_tm z_tm;; +let _, y_tm, _, _ = dest_cell_domain (concl domain_th);; + + +let domain1_th = mk_center_domain 5 x_tm y_tm;; +let _, y1_tm, _, _ = dest_cell_domain (concl domain1_th);; +let domain11_th = mk_center_domain 5 x_tm y1_tm;; +let domain12_th = mk_center_domain 5 y1_tm y_tm;; + +let domain2_th = mk_center_domain 5 y_tm z_tm;; + + +let eval_f pp domain_th = + let int_x = eval_taylor_x domain_th in + let int_atn = eval_taylor_atn pp domain_th in + let int_x2 = taylor_interval_mul pp int_x int_x in + taylor_interval_sub pp int_x2 int_atn;; + + +let int_th = eval_f 5 domain_th;; +let int_th11 = eval_f 5 domain11_th;; +let int_th12 = eval_f 5 domain12_th;; +let int_th2 = eval_f 5 domain2_th;; + +taylor_cell_pass 5 int_th;; +let pass11 = taylor_cell_pass 5 int_th11;; +let pass12 = taylor_cell_pass 5 int_th12;; +let pass2 = taylor_cell_pass 5 int_th2;; + +let pass1 = cell_pass_glue pass11 pass12;; +let pass = cell_pass_glue pass1 pass2;; + + + +(*************************************************************************) +(* Test 2: f(x) = x * x * x - atn (x * x); f(x) < 0 when 0.1 <= x <= 0.8 *) +(*************************************************************************) + +let x_tm = mk_float 1 49;; +let z_tm = mk_float 8 49;; + +let domain_th = mk_center_domain 5 x_tm z_tm;; +let _, y_tm, _, _ = dest_cell_domain (concl domain_th);; + +let domain1_th = mk_center_domain 5 x_tm y_tm;; +let _, y1_tm, _, _ = dest_cell_domain (concl domain1_th);; + +let domain11_th = mk_center_domain 5 x_tm y1_tm;; +let _, y11_tm, _, _ = dest_cell_domain (concl domain11_th);; + +let domain111_th = mk_center_domain 5 x_tm y11_tm;; +let domain112_th = mk_center_domain 5 y11_tm y1_tm;; + +let domain12_th = mk_center_domain 5 y1_tm y_tm;; +let domain2_th = mk_center_domain 5 y_tm z_tm;; + +let eval_sqr pp domain_th = + let x_th = eval_taylor_x domain_th in + taylor_interval_mul pp x_th x_th;; + + +let eval_f pp domain_th = + let int_x = eval_taylor_x domain_th in + let int_x2 = taylor_interval_mul pp int_x int_x in + let int_x3 = taylor_interval_mul pp int_x int_x2 in + let atn_x2 = taylor_interval_compose pp eval_taylor_atn eval_sqr domain_th in + taylor_interval_sub pp int_x3 atn_x2;; + +let int_th = eval_f 5 domain_th;; +let int_th111 = eval_f 5 domain111_th;; +let int_th112 = eval_f 5 domain112_th;; +let int_th12 = eval_f 5 domain12_th;; +let int_th2 = eval_f 5 domain2_th;; + +taylor_cell_pass 5 int_th;; +let pass111 = taylor_cell_pass 5 int_th111;; +let pass112 = taylor_cell_pass 5 int_th112;; +let pass12 = taylor_cell_pass 5 int_th12;; +let pass2 = taylor_cell_pass 5 int_th2;; + +let pass11 = cell_pass_glue pass111 pass112;; +let pass1 = cell_pass_glue pass11 pass12;; +let pass = cell_pass_glue pass1 pass2;; + +let th0 = REWRITE_RULE[cell_pass; interval_arith] pass;; +CONV_RULE (DEPTH_CONV FLOAT_TO_NUM_CONV) th0;; + + + +(********************************************) +(* Test 3: *) +(* !x. &2 <= x /\ x <= #2.52 *) +(* ==> arclength (&2) x (&2) - arclength (#2.52) x (&2) >= #0.073` *) + +let eval_arc1 pp domain_th = + let two = eval_taylor_const domain_th two_float and + ( * ) = taylor_interval_mul pp and + (+) = taylor_interval_add pp and + (-) = taylor_interval_sub pp in + let b = (fun pp domain_th -> + let x = eval_taylor_x domain_th in + two * two * x) in + let a = (fun pp domain_th -> + let x = eval_taylor_x domain_th in + let rhs = taylor_interval_compose pp eval_taylor_inv b domain_th in + (two * two + x * x - two * two) * rhs) in + taylor_interval_compose pp eval_taylor_acs a domain_th;; + + +let h_float = mk_float 252 48;; +let eval_arc2 pp domain_th = + let two = eval_taylor_const domain_th two_float and + h = eval_taylor_const domain_th h_float and + ( * ) = taylor_interval_mul pp and + (+) = taylor_interval_add pp and + (-) = taylor_interval_sub pp in + let b = (fun pp domain_th -> + let x = eval_taylor_x domain_th in + two * h * x) in + let a = (fun pp domain_th -> + let x = eval_taylor_x domain_th in + let rhs = taylor_interval_compose pp eval_taylor_inv b domain_th in + (h * h + x * x - two * two) * rhs) in + taylor_interval_compose pp eval_taylor_acs a domain_th;; + + +let t_float = mk_float 73 47;; +let eval_f pp domain_th = + let t = eval_taylor_const domain_th t_float and + (+) = taylor_interval_add pp and + (-) = taylor_interval_sub pp and + arc1 = eval_arc1 pp domain_th and + arc2 = eval_arc2 pp domain_th in + t + arc2 - arc1;; + +let pp = 6;; +let domain0 = mk_center_domain pp two_float h_float;; + +let _, y1_tm, _, _ = dest_cell_domain (concl domain0);; +let domain1 = mk_center_domain pp two_float y1_tm and + domain2 = mk_center_domain pp y1_tm h_float;; + +let _, y12_tm, _, _ = dest_cell_domain (concl domain2);; +let domain21 = mk_center_domain pp y1_tm y12_tm and + domain22 = mk_center_domain pp y12_tm h_float;; + +let _, y122_tm, _, _ = dest_cell_domain (concl domain22);; +let domain221 = mk_center_domain pp y12_tm y122_tm and + domain222 = mk_center_domain pp y122_tm h_float;; + +let int1 = eval_f pp domain1;; +let int21 = eval_f pp domain21;; +let int221 = eval_f pp domain221;; +let int222 = eval_f pp domain222;; + +let pass1 = taylor_cell_pass pp int1;; +let pass21 = taylor_cell_pass pp int21;; + +let pass221 = taylor_cell_pass pp int221;; +let pass222 = taylor_cell_pass pp int222;; + +let pass22 = cell_pass_glue pass221 pass222;; +let pass2 = cell_pass_glue pass21 pass22;; + +let pass = cell_pass_glue pass1 pass2;; + +let th0 = REWRITE_RULE[cell_pass; interval_arith] pass;; +CONV_RULE (DEPTH_CONV FLOAT_TO_NUM_CONV) th0;; + + +let ineq_test pp = + let domain0 = mk_center_domain pp two_float h_float in + let _, y1_tm, _, _ = dest_cell_domain (concl domain0) in + let domain1 = mk_center_domain pp two_float y1_tm and + domain2 = mk_center_domain pp y1_tm h_float in + let _, y12_tm, _, _ = dest_cell_domain (concl domain2) in + let domain21 = mk_center_domain pp y1_tm y12_tm and + domain22 = mk_center_domain pp y12_tm h_float in + let _, y122_tm, _, _ = dest_cell_domain (concl domain22) in + let domain221 = mk_center_domain pp y12_tm y122_tm and + domain222 = mk_center_domain pp y122_tm h_float in + + let int1 = eval_f pp domain1 and + int21 = eval_f pp domain21 and + int221 = eval_f pp domain221 and + int222 = eval_f pp domain222 in + + let pass1 = taylor_cell_pass pp int1 in + let pass21 = taylor_cell_pass pp int21 in + let pass221 = taylor_cell_pass pp int221 in + let pass222 = taylor_cell_pass pp int222 in + let pass22 = cell_pass_glue pass221 pass222 in + let pass2 = cell_pass_glue pass21 pass22 in + cell_pass_glue pass1 pass2;; + + +ineq_test 5;; +ineq_test 6;; +ineq_test 7;; +ineq_test 10;; + +(* 10: 9.768 *) +test 5 ineq_test 6;; +(* 10: 11.012 *) +test 5 ineq_test 7;; +(* 10: 16.381 *) +test 5 ineq_test 10;; + + + + +(***************************) + +let x_tm = mk_float 20 48;; +let z_tm = mk_float 99 48;; + +let domain_th = mk_center_domain 5 x_tm z_tm;; +test 1000 (mk_center_domain 5 x_tm) z_tm;; + +let int_x = eval_taylor_x domain_th;; +let int_atn = eval_taylor_atn 5 domain_th;; +let int_x2 = taylor_interval_mul 5 int_x int_x;; +let int_x_atn = taylor_interval_mul 5 int_x int_atn;; + +let int_th1 = taylor_interval_sub 5 int_x2 int_x;; +let int_th2 = taylor_interval_sub 5 int_x_atn int_x;; + +eval_taylor_f_bounds 5 int_th1;; +eval_taylor_f_bounds 5 int_th2;; + +let x_th = + let x_tm, y_tm, z_tm, w_tm = dest_cell_domain (concl domain_th) in + (mk_bounded_on_int o ASSUME) (mk_interval x_var_real (mk_pair (x_tm, z_tm)));; + + +let b_x2 = bounded_on_int_mul 5 x_th x_th;; +bounded_on_int_sub 5 b_x2 x_th;; + + + + + + +(*******************************************) +(* arclength #2.52 #2.52 (&2) >= #0.816 *) +(* arclength (&2) #2.52 (&2) - arclength #2.52 #2.52 (&2) >= #0.073 *) +(* arclength a b c = acs ((a * a + b * b - c * c) / (&2 * a * b)) *) + +let two_tm = mk_float 2 50;; +let h_tm = mk_float 252 48;; +let pp = 6;; + + +let arclength_int pp a b c = + let ( * ) = float_interval_mul pp and + (+) = float_interval_add pp and + (/) = float_interval_div pp and + (-) = float_interval_sub pp and + acs = float_interval_acs pp in + acs ((a * a + b * b - c * c) / (two_interval * a * b));; + +let result = + let (!) = mk_const_interval and + (-) = float_interval_sub pp in + arclength_int pp !h_tm !h_tm !two_tm, + arclength_int pp !two_tm !h_tm !two_tm - arclength_int pp !h_tm !h_tm !two_tm;; + + +(CONV_RULE (DEPTH_CONV FLOAT_TO_NUM_CONV)) (fst result);; +(CONV_RULE (DEPTH_CONV FLOAT_TO_NUM_CONV)) (snd result);; diff --git a/formal_lp/old/formal_interval/test_taylor_arith.hl b/formal_lp/old/formal_interval/test_taylor_arith.hl new file mode 100644 index 0000000..e184dd4 --- /dev/null +++ b/formal_lp/old/formal_interval/test_taylor_arith.hl @@ -0,0 +1,313 @@ +needs "../formal_lp/formal_interval/m_taylor_arith.hl";; + +let reset_all () = + Arith_cache.reset_stat(); + Arith_cache.reset_cache(); + Arith_float.reset_stat(); + Arith_float.reset_cache();; + +(*************) + +let pp = 4;; + +let poly1 = expr_to_vector_fun `x1 * x2 * x3 + x2 * (x4 + x5) pow 3`;; +let n = (get_dim o fst o dest_abs) poly1;; +let xx = `[-- &3; -- &3; -- &3; -- &3; -- &3]` and + zz = `[&2; &2; &2; &2; &2]`;; + +let xx1 = convert_to_float_list n true xx and + zz1 = convert_to_float_list n false zz;; + +let eval_poly, tf, ti = mk_verification_functions pp poly1 false `&0`;; +let dom_th = mk_m_center_domain n pp xx1 zz1;; + +let th = eval_poly.taylor pp pp dom_th;; + +(* 100: 0.524 *) +reset_all();; +test 100 (eval_poly.taylor pp pp) dom_th;; +(* 100: 0.512 *) +test 100 (eval_poly.taylor pp pp) dom_th;; + +(************) + +(* 100: 4.120 *) +reset_all();; +test 100 (eval_m_taylor_add n pp pp th) th;; +(* 100: 4.184 *) +test 100 (eval_m_taylor_add n pp pp th) th;; + + +(*****************) + +let p_lin = pp and p_second = pp and + taylor1_th = th and taylor2_th = th;; + +(****************) + +let domain_th, diff2_f1_th, lin1_th, second1_th = dest_m_taylor_thms n taylor1_th;; +let _, diff2_f2_th, lin2_th, second2_th = dest_m_taylor_thms n taylor2_th;; +let f1_tm = (rand o concl) diff2_f1_th and + f2_tm = (rand o concl) diff2_f2_th;; +let domain_tm, y_tm, w_tm = dest_m_cell_domain (concl domain_th);; +let ty = type_of y_tm;; + +let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + g_var = mk_var ("g", type_of f2_tm) and + domain_var = mk_var ("domain", type_of domain_tm);; + +let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th and + _, bounds2_th, df2_th = m_lin_approx_components n lin2_th;; + +let bounds_th = float_interval_add p_lin bounds1_th bounds2_th;; +let bounds_tm = (rand o concl) bounds_th;; + +let add_lemma0 = (INST[f1_tm, f_var; f2_tm, g_var; y_tm, x_var] o + INST_TYPE[n_type_array.(n), nty]) add_partial_lemma';; + +let add th1 th2 = + let add_th = float_interval_add p_lin th1 th2 in + let int_tm = rand (concl add_th) and + i_tm = (rand o rator o rator o lhand) (concl th1) in + let th0 = INST[i_tm, i_var_num; int_tm, int_var] add_lemma0 in + EQ_MP th0 add_th;; + +let df_th = eval_all_n2 df1_th df2_th true add;; +let d_bounds_list = (rand o rator o concl) df_th;; + + +let dd1 = second_bounded_components n second1_th;; +let dd2 = second_bounded_components n second2_th;; + +let add_second_lemma0 = (INST[f1_tm, f_var; f2_tm, g_var] o + INST_TYPE[n_type_array.(n), nty]) add_second_lemma';; + +let add_second_lemma1 = (INST[f1_tm, f_var; f2_tm, g_var] o + INST_TYPE[n_type_array.(n), nty]) add_second_lemma'';; + + +let add_second2 th1 th2 = + let i_tm = (rand o rator o concl) th1 in + let th1, th2 = BETA_RULE th1, BETA_RULE th2 in + let lemma = INST[i_tm, i_var_num] add_second_lemma0 in + let add_second th1 th2 = + let add_th = float_interval_add p_second th1 th2 in + let int_tm = rand (concl add_th) and + j_tm = (rand o rator o rator o rator o lhand) (concl th1) in + let th0 = INST[j_tm, j_var_num; int_tm, int_var] lemma in + EQ_MP th0 add_th in + let add_th = eval_all_n2 th1 th2 true add_second in + let list_tm = (rand o rator o concl) add_th in + let lemma1 = INST[i_tm, i_var_num; list_tm, list_var_real_pair] add_second_lemma1 in + EQ_MP lemma1 add_th;; + + +let dd_th0 = eval_all_n2 dd1 dd2 false add_second2;; +let dd_list = (rand o rator o concl) dd_th0;; +let dd_th = GEN x_var (DISCH_ALL dd_th0);; + +let th = (MY_PROVE_HYP dd_th o MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP diff2_f2_th o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP df_th o MY_PROVE_HYP domain_th o + INST[f1_tm, f_var; f2_tm, g_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var; d_bounds_list, d_bounds_list_var; + dd_list, dd_bounds_list_var] o + INST_TYPE[n_type_array.(n), nty]) MK_M_TAYLOR_ADD';; +let eq_th = binary_beta_gen_eq f1_tm f2_tm x_var add_op_real;; +m_taylor_interval_norm th eq_th;; + + +(********************) +reset_all();; + +(* 0.028 *) +test 100 (dest_m_taylor_thms n) taylor1_th;; +(* 0.028 *) +test 100 (dest_m_taylor_thms n) taylor2_th;; + +(* 0.000 *) +let f () = + let a =(rand o concl) diff2_f1_th and + b = (rand o concl) diff2_f2_th in + a, b;; +test 100 f ();; + + +(* 0.000 *) +test 100 dest_m_cell_domain (concl domain_th);; +(* 0.000 *) +test 100 type_of y_tm;; + +(* 0.000 *) +let f () = + let x_var = mk_var ("x", ty) and + y_var = mk_var ("y", ty) and + w_var = mk_var ("w", ty) and + f_var = mk_var ("f", type_of f1_tm) and + g_var = mk_var ("g", type_of f2_tm) and + domain_var = mk_var ("domain", type_of domain_tm) in + x_var, y_var, w_var, f_var, g_var, domain_var;; +test 100 f ();; + +(* 0.052 *) +let f () = + let _, bounds1_th, df1_th = m_lin_approx_components n lin1_th and + _, bounds2_th, df2_th = m_lin_approx_components n lin2_th in + bounds1_th, df1_th, bounds2_th, df2_th;; +test 100 f ();; + +(* 0.012 *) +test 100 (float_interval_add p_lin bounds1_th) bounds2_th;; +(* 0.000 *) +test 100 (rand o concl) bounds_th;; + +(* 0.008 *) +test 100 (INST[f1_tm, f_var; f2_tm, g_var; y_tm, x_var] o + INST_TYPE[n_type_array.(n), nty]) add_partial_lemma';; + +let add th1 th2 = + let add_th = float_interval_add p_lin th1 th2 in + let int_tm = rand (concl add_th) and + i_tm = (rand o rator o rator o lhand) (concl th1) in + let th0 = INST[i_tm, i_var_num; int_tm, int_var] add_lemma0 in + EQ_MP th0 add_th;; + +(* 0.688 *) +test 100 (eval_all_n2 df1_th df2_th true) add;; +(* 0.000 *) +test 100 (rand o rator o concl) df_th;; + +(* 0.044 *) +test 100 (second_bounded_components n) second1_th;; +(* 0.040 *) +test 100 (second_bounded_components n) second2_th;; + +(* 0.011 *) +test 100 (INST[f1_tm, f_var; f2_tm, g_var] o + INST_TYPE[n_type_array.(n), nty]) add_second_lemma';; + +(* 0.020 *) +test 100 (INST[f1_tm, f_var; f2_tm, g_var] o + INST_TYPE[n_type_array.(n), nty]) add_second_lemma'';; + + +let add_second2 th1 th2 = + let i_tm = (rand o rator o concl) th1 in + let th1, th2 = BETA_RULE th1, BETA_RULE th2 in + let lemma = INST[i_tm, i_var_num] add_second_lemma0 in + let add_second th1 th2 = + let add_th = float_interval_add p_second th1 th2 in + let int_tm = rand (concl add_th) and + j_tm = (rand o rator o rator o rator o lhand) (concl th1) in + let th0 = INST[j_tm, j_var_num; int_tm, int_var] lemma in + EQ_MP th0 add_th in + let add_th = eval_all_n2 th1 th2 true add_second in + let list_tm = (rand o rator o concl) add_th in + let lemma1 = INST[i_tm, i_var_num; list_tm, list_var_real_pair] add_second_lemma1 in + EQ_MP lemma1 add_th;; + + +(* 3.016 *) +test 100 (eval_all_n2 dd1 dd2 false) add_second2;; +(* 0.000 *) +test 100 (rand o rator o concl) dd_th0;; +(* 0.004 *) +test 100 (GEN x_var o DISCH_ALL) dd_th0;; + +(* 0.096 *) +test 100 (MY_PROVE_HYP dd_th o MY_PROVE_HYP diff2_f1_th o MY_PROVE_HYP diff2_f2_th o + MY_PROVE_HYP bounds_th o MY_PROVE_HYP df_th o MY_PROVE_HYP domain_th o + INST[f1_tm, f_var; f2_tm, g_var; + domain_tm, domain_var; y_tm, y_var; w_tm, w_var; + bounds_tm, bounds_var; d_bounds_list, d_bounds_list_var; + dd_list, dd_bounds_list_var] o + INST_TYPE[n_type_array.(n), nty]) MK_M_TAYLOR_ADD';; +(* 0.000 *) +test 100 (binary_beta_gen_eq f1_tm f2_tm x_var) add_op_real;; +(* 0.004 *) +test 100 (m_taylor_interval_norm th) eq_th;; + + +(***********************) + +test 100 (eval_all_n2 df1_th df2_th true) add;; + +(* Constructs all_n n (map2 s list1 list2) *) +let all_n1_th = df1_th and all_n2_th = df2_th and beta_flag = true and s = add;; + +(***) + +let ths1', suc_ths = all_n_components all_n1_th;; +let ths2', _ = all_n_components all_n2_th;; +let ths1, ths2 = + if beta_flag then map BETA_RULE ths1', map BETA_RULE ths2' else ths1', ths2';; + +let ths1, ths2, suc_ths = List.rev ths1, List.rev ths2, List.rev suc_ths;; +let ths = map2 s ths1 ths2;; +build_all_n ths suc_ths;; + + +(***) + +(* 0.040 *) +test 100 all_n_components all_n1_th;; +(* 0.052 *) +test 100 all_n_components all_n2_th;; +(* 0.244 *) +test 100 (map BETA_RULE) ths1';; +(* 0.240 *) +test 100 (map BETA_RULE) ths2';; + +hd ths1';; +BETA_RULE (hd ths1');; + +(* 0.000 *) +let f () = + let ths1, ths2, suc_ths = List.rev ths1, List.rev ths2, List.rev suc_ths in + ths1, ths2, suc_ths;; +test 100 f ();; + +(* 0.052 *) +test 100 (map2 s ths1) ths2;; +(* 0.056 *) +test 100 (build_all_n ths) suc_ths;; + + +(*************) + +let th0 = hd ths1';; +BETA_RULE th0;; + +(* 0.436 *) +test 1000 BETA_RULE th0;; + + +let MY_BETA_RULE th = + let rec beta tm = + let op, arg = dest_comb tm in + if is_comb op then + let op_th = AP_THM (beta op) arg in + let beta_th = BETA_CONV (rand (concl op_th)) in + TRANS op_th beta_th + else + BETA_CONV tm in + EQ_MP (beta (concl th)) th;; + + +let MY_BETA_RULE2 th0 = + let c = concl th0 in + let lhs, rhs = dest_comb c in + + let th1 = BETA_CONV lhs in + let th2 = AP_THM th1 rhs in + let th3 = BETA_CONV (rand (concl th2)) in + EQ_MP (TRANS th2 th3) th0;; + +MY_BETA_RULE2 th0;; +(* 0.036 *) +test 1000 MY_BETA_RULE2 th0;; + + diff --git a/formal_lp/old/formal_interval/tests_cmp.hl b/formal_lp/old/formal_interval/tests_cmp.hl new file mode 100644 index 0000000..80ac706 --- /dev/null +++ b/formal_lp/old/formal_interval/tests_cmp.hl @@ -0,0 +1,165 @@ +needs "../formal_lp/formal_interval/m_taylor_old.hl";; +needs "../formal_lp/formal_interval/m_examples_poly.hl";; + +(******************************) +(* Test 1 *) + +let pp = 4;; + +let poly_tm = lv_poly;; +let x_tm, z_tm = lv_dom;; + +let n = (get_dim o fst o dest_abs) poly_tm;; +let xx1, zz1 = convert_to_float_list pp false x_tm, convert_to_float_list pp true z_tm;; + + +let dom_th = mk_m_center_domain n pp xx1 zz1;; +let eval = eval_m_taylor_poly0 pp poly_tm;; +let eval_old = M_taylor_old.eval_m_taylor_poly0 pp poly_tm;; + +let t_th = eval pp pp dom_th;; +let t_th_old = eval_old pp pp dom_th;; + +let bound = eval_m_taylor_upper_bound n pp t_th;; +let bound_old = M_taylor_old.eval_m_taylor_upper_bound n pp t_th_old;; + +let p1 = eval_m_taylor_partial_upper n pp 1 t_th;; +let p1_old = M_taylor_old.eval_m_taylor_upper_partial n pp 1 t_th_old;; + +let p_bounds = map (fun i -> eval_m_taylor_partial_bound n pp i t_th) (1--n);; +let p_bounds_old = map (fun i -> M_taylor_old.eval_m_taylor_interval_partial n pp i t_th_old) (1--n);; + + +(* 10: 0.764 *) +test 100 (mk_m_center_domain n pp xx1) zz1;; + +(* 10: 1.148 *) +test 100 (eval pp pp) dom_th;; +(* 10: 1.148 *) +test 100 (eval_old pp pp) dom_th;; + +(* 10: 0.744 *) +test 100 (eval_m_taylor_upper_bound n pp) t_th;; +(* 10: 1.168 *) +test 100 (M_taylor_old.eval_m_taylor_upper_bound n pp) t_th_old;; + +(* 10: 0.204 *) +test 100 (eval_m_taylor_partial_upper n pp 1) t_th;; +(* 10: 0.252 *) +test 100 (M_taylor_old.eval_m_taylor_upper_partial n pp 1) t_th_old;; + +(* 10: 0.944 *) +test 100 (map (fun i -> eval_m_taylor_partial_bound n pp i t_th)) (1--n);; +(* 10: 1.176 *) +test 100 (map (fun i -> M_taylor_old.eval_m_taylor_interval_partial n pp i t_th_old)) (1--n);; + + + +(******************************) +(* Test 2 *) + +let pp = 4;; + +let poly_tm = butcher_poly;; +let x_tm, z_tm = butcher_dom;; + +let n = (get_dim o fst o dest_abs) poly_tm;; +let xx1, zz1 = convert_to_float_list pp false x_tm, convert_to_float_list pp true z_tm;; + + +let dom_th = mk_m_center_domain n pp xx1 zz1;; +let eval = eval_m_taylor_poly0 pp poly_tm;; +let eval_old = M_taylor_old.eval_m_taylor_poly0 pp poly_tm;; + +let t_th = eval pp pp dom_th;; +let t_th_old = eval_old pp pp dom_th;; + +let bound = eval_m_taylor_upper_bound n pp t_th;; +let bound_old = M_taylor_old.eval_m_taylor_upper_bound n pp t_th_old;; + +let p1 = eval_m_taylor_partial_upper n pp 1 t_th;; +let p1_old = M_taylor_old.eval_m_taylor_upper_partial n pp 1 t_th_old;; + +let p_bounds = map (fun i -> eval_m_taylor_partial_bound n pp i t_th) (1--n);; +let p_bounds_old = map (fun i -> M_taylor_old.eval_m_taylor_interval_partial n pp i t_th_old) (1--n);; + + +(* 10: 1.400 *) +test 100 (mk_m_center_domain n pp xx1) zz1;; + +(* 10: 1.644 *) +test 100 (eval pp pp) dom_th;; +(* 10: 1.680 *) +test 100 (eval_old pp pp) dom_th;; + +(* 10: 1.516 *) +test 100 (eval_m_taylor_upper_bound n pp) t_th;; +(* 10: 2.428 *) +test 100 (M_taylor_old.eval_m_taylor_upper_bound n pp) t_th_old;; + +(* 10: 0.300 *) +test 100 (eval_m_taylor_partial_upper n pp 1) t_th;; +(* 10: 0.408 *) +test 100 (M_taylor_old.eval_m_taylor_upper_partial n pp 1) t_th_old;; + +(* 10: 1.988 *) +test 100 (map (fun i -> eval_m_taylor_partial_bound n pp i t_th)) (1--n);; +(* 10: 2.560 *) +test 100 (map (fun i -> M_taylor_old.eval_m_taylor_interval_partial n pp i t_th_old)) (1--n);; + + + +(******************************) +(* Test 3 *) + +let pp = 10;; + +let poly_tm = heart_poly;; +let x_tm, z_tm = heart_dom;; + +let n = (get_dim o fst o dest_abs) poly_tm;; +let xx1, zz1 = convert_to_float_list pp false x_tm, convert_to_float_list pp true z_tm;; + + +let dom_th = mk_m_center_domain n pp xx1 zz1;; +let eval = eval_m_taylor_poly0 pp poly_tm;; +let eval_old = M_taylor_old.eval_m_taylor_poly0 pp poly_tm;; + +let t_th = eval pp pp dom_th;; +let t_th_old = eval_old pp pp dom_th;; + +let bound = eval_m_taylor_upper_bound n pp t_th;; +let bound_old = M_taylor_old.eval_m_taylor_upper_bound n pp t_th_old;; + +let p1 = eval_m_taylor_partial_upper n pp 1 t_th;; +let p1_old = M_taylor_old.eval_m_taylor_upper_partial n pp 1 t_th_old;; + +let p_bounds = map (fun i -> eval_m_taylor_partial_bound n pp i t_th) (1--n);; +let p_bounds_old = map (fun i -> M_taylor_old.eval_m_taylor_interval_partial n pp i t_th_old) (1--n);; + + +(* 10: 2.368 *) +test 100 (mk_m_center_domain n pp xx1) zz1;; + +(* 10: 9.977 *) +test 100 (eval pp pp) dom_th;; +(* 10: 9.756 *) +test 100 (eval_old pp pp) dom_th;; + +(* 10: 3.920 *) +test 100 (eval_m_taylor_upper_bound n pp) t_th;; +(* 10: 6.124 *) +test 100 (M_taylor_old.eval_m_taylor_upper_bound n pp) t_th_old;; + +(* 10: 0.572 *) +test 100 (eval_m_taylor_partial_upper n pp 1) t_th;; +(* 10: 0.664 *) +test 100 (M_taylor_old.eval_m_taylor_upper_partial n pp 1) t_th_old;; + +(* 10: 5.024 *) +test 100 (map (fun i -> eval_m_taylor_partial_bound n pp i t_th)) (1--n);; +(* 10: 6.336 *) +test 100 (map (fun i -> M_taylor_old.eval_m_taylor_interval_partial n pp i t_th_old)) (1--n);; + + + diff --git a/formal_lp/old/formal_interval/theory/multivariate_taylor.hl b/formal_lp/old/formal_interval/theory/multivariate_taylor.hl new file mode 100644 index 0000000..329bfa1 --- /dev/null +++ b/formal_lp/old/formal_interval/theory/multivariate_taylor.hl @@ -0,0 +1,2124 @@ +load_path := "/mnt/Repository/jHOLLight"::(!load_path);; +needs "caml/raw_printer.hl";; +needs "caml/sections.hl";; +needs "caml/ssreflect.hl";; +needs "Examples/ssrbool-compiled.hl";; +needs "Examples/ssrnat-compiled.hl";; +needs "../formal_lp/formal_interval/theory/taylor_interval.hl";; +section_stack := [];; +prioritize_overload `:real^K`;; +prioritize_overload `:real^N`;; +prioritize_real();; + +let partial = new_definition `partial i f x = derivative (f o (\t. (x:real^N) + t % basis i)) (&0)`;; +let all_n = define `(all_n n [] s <=> T) /\ (all_n n (CONS h t) s <=> s n h /\ all_n (SUC n) t s)`;; +let m_lin_approx = new_definition `m_lin_approx (f:real^N->real) x f_bounds df_bounds_list <=> + (lift o f) differentiable at x /\ + interval_arith (f x) f_bounds /\ + all_n 1 df_bounds_list (\i int. interval_arith (partial i f x) int)`;; +(begin_section "Misc");; +(start_section_proof ["f"](`lift o (\x. --f x) = (\x. --(lift o f) x)`));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN LIFT_NEG)(new_rewrite [] []))) THEN (done_tac)))));; +let f_lift_neg = end_section_proof();; +(start_section_proof ["f";"c"](`lift o (\x. c * f x) = (\x. c % (lift o f) x)`));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN LIFT_CMUL)(new_rewrite [] []))) THEN (done_tac)))));; +let f_lift_scale = end_section_proof();; +(start_section_proof ["f";"g"](`lift o (\x. f x + g x) = (\x. (lift o f) x + (lift o g) x)`));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN LIFT_ADD)(new_rewrite [] []))) THEN (done_tac)))));; +let f_lift_add = end_section_proof();; +(start_section_proof ["f";"g"](`lift o (\x. f x - g x) = (\x. (lift o f) x - (lift o g) x)`));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN LIFT_SUB)(new_rewrite [] []))) THEN (done_tac)))));; +let f_lift_sub = end_section_proof();; +(start_section_proof ["op";"f";"g"](`(\t. op (f t) (g t)) o drop = (\x. op (f (drop x)) (g (drop x)))`));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] [])))) THEN (done_tac)))));; +let f_binary_drop = end_section_proof();; +(start_section_proof ["op";"f"](`(\t. op (f t)) o drop = (\x. op (f (drop x)))`));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] [])))) THEN (done_tac)))));; +let f_unary_drop = end_section_proof();; +(begin_section "MoreFrechet");; +(add_section_var (mk_var ("f", (`:real^N -> real^M`))); add_section_var (mk_var ("g", (`:real^N -> real^M`))));; +(add_section_var (mk_var ("x", (`:real^N`))); add_section_var (mk_var ("y", (`:real^N`))));; +(start_section_proof ["f";"g";"x"](`f differentiable at (g x) ==> + g differentiable at x ==> + frechet_derivative (f o g) (at x) = frechet_derivative f (at (g x)) o frechet_derivative g (at x)`));; +refine (by (VALID (((BETA_TAC THEN (move ["df"]) THEN (move ["dg"])) THEN ((USE_THM_THEN EQ_SYM_EQ)(new_rewrite [] [])) THEN ((USE_THM_THEN FRECHET_DERIVATIVE_AT) apply_tac)))));; +refine (by (VALID ((((USE_THM_THEN DIFF_CHAIN_AT) apply_tac) THEN repeat_tactic 1 9 (((USE_THM_THEN FRECHET_DERIVATIVE_WORKS)(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac)))));; +let frechet_compose = end_section_proof();; +(start_section_proof ["z"](`frechet_derivative (\x. y) (at z) = (\x. vec 0)`));; +refine (by (VALID ((((USE_THM_THEN EQ_SYM_EQ)(new_rewrite [] [])) THEN ((USE_THM_THEN FRECHET_DERIVATIVE_AT) apply_tac) THEN ((USE_THM_THEN HAS_DERIVATIVE_CONST)(new_rewrite [] [])) THEN (done_tac)))));; +let frechet_const = end_section_proof();; +(start_section_proof [](`frechet_derivative (\x. x) (at y) = (\x. x)`));; +refine (by (VALID ((((USE_THM_THEN EQ_SYM_EQ)(new_rewrite [] [])) THEN ((USE_THM_THEN FRECHET_DERIVATIVE_AT) apply_tac) THEN ((USE_THM_THEN HAS_DERIVATIVE_ID)(new_rewrite [] [])) THEN (done_tac)))));; +let frechet_id = end_section_proof();; +(start_section_proof ["z"](`frechet_derivative (\x. drop x % y) (at z) = (\x. drop x % y)`));; +refine (by (VALID ((((USE_THM_THEN EQ_SYM_EQ)(new_rewrite [] [])) THEN ((USE_THM_THEN FRECHET_DERIVATIVE_AT) apply_tac) THEN ((USE_THM_THEN HAS_DERIVATIVE_VMUL_DROP) apply_tac)))));; +refine (by (VALID (((USE_THM_THEN HAS_DERIVATIVE_ID)(new_rewrite [] [])))));; +let frechet_vmul = end_section_proof();; +(add_section_hyp "df" (`f differentiable at x`));; +(start_section_proof [](`frechet_derivative (\x. --f x) (at x) = (\y. --frechet_derivative f (at x) y)`));; +refine (by (VALID ((((USE_THM_THEN EQ_SYM_EQ)(new_rewrite [] [])) THEN ((USE_THM_THEN FRECHET_DERIVATIVE_AT) apply_tac) THEN ((USE_THM_THEN HAS_DERIVATIVE_NEG) apply_tac)))));; +refine (by (VALID ((((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN ((USE_THM_THEN FRECHET_DERIVATIVE_WORKS)(GSYM_THEN (new_rewrite [] []))) THEN (done_tac)))));; +let frechet_neg = end_section_proof();; +(start_section_proof ["c"](`frechet_derivative (\x. c % f x) (at x) = (\y. c % frechet_derivative f (at x) y)`));; +refine (by (VALID ((((USE_THM_THEN EQ_SYM_EQ)(new_rewrite [] [])) THEN ((USE_THM_THEN FRECHET_DERIVATIVE_AT) apply_tac) THEN ((USE_THM_THEN HAS_DERIVATIVE_CMUL) apply_tac)))));; +refine (by (VALID ((((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN ((USE_THM_THEN FRECHET_DERIVATIVE_WORKS)(GSYM_THEN (new_rewrite [] []))) THEN (done_tac)))));; +let frechet_scale = end_section_proof();; +(add_section_hyp "dg" (`g differentiable at x`));; +(start_section_proof [](`frechet_derivative (\x. f x + g x) (at x) = + (\y. frechet_derivative f (at x) y + frechet_derivative g (at x) y)`));; +refine (by (VALID ((((USE_THM_THEN EQ_SYM_EQ)(new_rewrite [] [])) THEN ((USE_THM_THEN FRECHET_DERIVATIVE_AT) apply_tac) THEN ((USE_THM_THEN HAS_DERIVATIVE_ADD) apply_tac)))));; +refine (by (VALID ((((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN repeat_tactic 1 9 (((USE_THM_THEN FRECHET_DERIVATIVE_WORKS)(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac)))));; +let frechet_add = end_section_proof();; +(start_section_proof [](`frechet_derivative (\x. f x - g x) (at x) = + (\y. frechet_derivative f (at x) y - frechet_derivative g (at x) y)`));; +refine (by (VALID ((((USE_THM_THEN EQ_SYM_EQ)(new_rewrite [] [])) THEN ((USE_THM_THEN FRECHET_DERIVATIVE_AT) apply_tac) THEN ((USE_THM_THEN HAS_DERIVATIVE_SUB) apply_tac)))));; +refine (by (VALID ((((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN repeat_tactic 1 9 (((USE_THM_THEN FRECHET_DERIVATIVE_WORKS)(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac)))));; +let frechet_sub = end_section_proof();; +let frechet_sub = finalize_theorem frechet_sub;; +let frechet_add = finalize_theorem frechet_add;; +let frechet_scale = finalize_theorem frechet_scale;; +let frechet_neg = finalize_theorem frechet_neg;; +let frechet_vmul = finalize_theorem frechet_vmul;; +let frechet_id = finalize_theorem frechet_id;; +let frechet_const = finalize_theorem frechet_const;; +let frechet_compose = finalize_theorem frechet_compose;; +(end_section "MoreFrechet");; +(start_section_proof ["f";"g";"x"](`f differentiable at (g x) ==> + g differentiable at x ==> + (f o g) differentiable at x`));; +refine (by (VALID (((BETA_TAC THEN (move ["df"]) THEN (move ["dg"])) THEN ((USE_THM_THEN FRECHET_DERIVATIVE_WORKS)(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THM_THEN frechet_compose)(new_rewrite [] [])) THEN ((TRY done_tac))) THEN ((USE_THM_THEN DIFF_CHAIN_AT) apply_tac) THEN repeat_tactic 1 9 (((USE_THM_THEN FRECHET_DERIVATIVE_WORKS)(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac)))));; +let differentiable_compose_at = end_section_proof();; +(start_section_proof ["f";"g";"x"](`f differentiable at (g x) ==> + g differentiable at x ==> + jacobian (f o g) (at x) = jacobian f (at (g x)) ** jacobian g (at x)`));; +refine (by (VALID ((BETA_TAC THEN (move ["df"]) THEN (move ["dg"])))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN jacobian)(new_rewrite [] []))) THEN ((USE_THM_THEN frechet_compose)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN MATRIX_COMPOSE)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN LINEAR_FRECHET_DERIVATIVE)(new_rewrite [] [])))) THEN (done_tac)))));; +let jacobian_compose = end_section_proof();; +(start_section_proof ["f";"x"](`f differentiable at x ==> + frechet_derivative f (at x) = (\h. jacobian f (at x) ** h)`));; +refine (by (VALID ((BETA_TAC THEN (move ["df"])))));; +refine (by (VALID (((((USE_THM_THEN EQ_SYM_EQ)(new_rewrite [] [])) THEN ((USE_THM_THEN FRECHET_DERIVATIVE_AT)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN JACOBIAN_WORKS)(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac)))));; +let frechet_eq_jacobian = end_section_proof();; +(begin_section "Product");; +(start_section_proof ["w";"x";"y";"z"](`&0 < w /\ w <= x /\ &0 <= y /\ y < z ==> w * y < x * z`));; +refine (by (VALID ((BETA_TAC THEN (move ["ineq"])))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN EXCLUDED_MIDDLE)(ISPEC_THEN (`w = x`) thm_tac))MP_TAC) THEN case THENL [(move ["w_eq_x"]); (move ["wnx"])]))));; +refine (by (VALID (((((USE_THEN "w_eq_x")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_LT_LMUL)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN REAL_LT_MUL2)(new_rewrite [] [])) THEN (((USE_THEN "wnx")MP_TAC) THEN (clear_assumption "wnx") THEN ((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +let REAL_LET_MUL2 = end_section_proof();; +(start_section_proof ["y"](`(lift o (\x:real^2. x$1 * x$2) has_derivative lift o (\x. y$2 * x$1 + y$1 * x$2)) (at y)`));; +refine (by (VALID ((((USE_THM_THEN has_derivative_at)(new_rewrite [] [])) THEN (split_tac)))));; +refine (by (VALID ((((USE_THM_THEN linear)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN repeat_tactic 1 9 (((USE_THM_THEN VECTOR_ADD_COMPONENT)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN VECTOR_MUL_COMPONENT)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN LIFT_ADD)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN LIFT_CMUL)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN LIFT_ADD)(new_rewrite [] [])))))));; +refine (by (VALID (((VECTOR_ARITH_TAC) THEN (done_tac)))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN LIFT_ADD)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN LIFT_SUB)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN LIFT_CMUL)(GSYM_THEN (new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THM_THEN LIM_AT)(new_rewrite [] [])) THEN (simp_tac) THEN repeat_tactic 1 9 (((USE_THM_THEN dist)(new_rewrite [] []))) THEN ((USE_THM_THEN (GEN_ALL VECTOR_SUB_RZERO))(new_rewrite [] [])) THEN ((USE_THM_THEN NORM_LIFT)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN VECTOR_SUB_COMPONENT)(new_rewrite [] [])))) THEN (move ["e"]) THEN (move ["e0"])))));; +refine (by (VALID (((USE_THM_THEN (REAL_ARITH `(x:real^2)$1 * x$2 - ((y:real^2)$1 * y$2 + y$2 * (x$1 - y$1) + y$1 * (x$2 - y$2)) = + (x$2 - y$2) * (x$1 - y$1)`))(new_rewrite [] [])))));; +refine (by (VALID (((exists_tac (mk_var("e",mk_type("real",[])))) THEN ((((USE_THEN "e0")(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["x"]) THEN (case THEN ((move ["norm0"]) THEN (move ["norm_e"]))))))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN REAL_ABS_MUL)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_ABS_INV)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_ABS_NORM)(new_rewrite [] []))))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN VECTOR_SUB_COMPONENT)(GSYM_THEN (new_rewrite [] [])))) THEN (set_tac "p" (`x - y:real^2`))))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN NORM_BOUND_COMPONENT_LT)(fun fst_th ->(USE_THEN "norm_e")(fun th -> MATCH_MP_THEN th thm_tac fst_th))) MP_TAC) THEN (move ["ineq"])))));; +refine (by (VALID (((((USE_THM_THEN REAL_LTE_TRANS)MP_TAC) THEN (clear_assumption "REAL_LTE_TRANS") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (`inv (infnorm p) * infnorm p * e`))))));; +refine (by (VALID (((THENL_FIRST) (have_tac (move ["infnorm_0"]) (`&0 < infnorm p`)) ((((USE_THM_THEN INFNORM_POS_LT)(new_rewrite [] [])) THEN ((USE_THM_THEN NORM_POS_LT)(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac))))));; +refine (by (VALID (((THENL_ROT (-1)) (split_tac)))));; +refine (by (VALID (((((USE_THM_THEN REAL_MUL_ASSOC)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_LINV)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_MUL_LID)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN INFNORM_EQ_0)(new_rewrite [] [])) THEN ((USE_THM_THEN NORM_POS_LT)(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN REAL_LET_MUL2)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LT_INV)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN REAL_LE_INV2)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN INFNORM_LE_NORM)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN REAL_LE_MUL)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_ABS_POS)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))))));; +refine (by (VALID ((have_tac ALL_TAC (`infnorm p = abs (p$1) \/ infnorm p = abs (p$2)`)))));; +refine (by (VALID ((((USE_THM_THEN (GEN_ALL INFNORM_2))(new_rewrite [] [])) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((((THENL_FIRST) (case THEN (DISCH_THEN(GSYM_THEN (new_rewrite [] [])))) ((USE_THM_THEN REAL_MUL_SYM)(new_rewrite [] []))) THEN (((USE_THM_THEN REAL_LT_LMUL)(new_rewrite [] [])) THEN ((USE_THEN "ineq")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN DIMINDEX_2)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +let has_derivative_x12 = end_section_proof();; +(start_section_proof ["f"](`(\x:A. lambda i. f i x) = + (\x. vsum (1..dimindex (:N)) (\i. f i x % (basis i:real^N)))`));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac)) THEN (move ["x"])))));; +refine (by (VALID (((((USE_THM_THEN CART_EQ)(new_rewrite [] [])) THEN (move ["i"]) THEN (move ["ineq"])) THEN (((USE_THM_THEN (GEN_ALL LAMBDA_BETA))(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN VSUM_COMPONENT)(new_rewrite [] [])) THEN ((simp_tac THEN TRY done_tac)))))));; +refine (by (VALID (((set_tac "A" (`1.. _`)) THEN (set_tac "B" (`A DIFF {i}`))))));; +refine (by (VALID ((have_tac (move ["cond"]) (`DISJOINT B {i} /\ A = B UNION {i}`)))));; +refine (by (VALID ((((USE_THM_THEN DISJOINT)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN EXTENSION)(new_rewrite [] []))) THEN ((USE_THEN "B_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "A_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN IN_INTER)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_DIFF)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_SING)(new_rewrite [] [])) THEN ((USE_THM_THEN NOT_IN_EMPTY)(new_rewrite [] [])) THEN (simp_tac)))));; +refine (by (VALID (((THENL_FIRST) ((split_tac) THEN (move ["x"])) ((repeat_tactic 1 9 (((USE_THM_THEN negb_and)(new_rewrite [] []))) THEN ((USE_THM_THEN negbK)(new_rewrite [] [])) THEN ((USE_THM_THEN orbA)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN EXCLUDED_MIDDLE)(new_rewrite [] []))) THEN (done_tac))))));; +refine (by (VALID ((((USE_THM_THEN IN_UNION)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_DIFF)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_SING)(new_rewrite [] []))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THM_THEN EXCLUDED_MIDDLE)(ISPEC_THEN (`x = i`) thm_tac))MP_TAC) THEN case THEN (DISCH_THEN(new_rewrite [] [])) THEN ((TRY done_tac))) THEN ((simp_tac) THEN ((USE_THM_THEN IN_NUMSEG)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THEN "cond")(new_rewrite [] [])) THEN ((USE_THM_THEN SUM_UNION)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "cond")(new_rewrite [] []))) THEN ((USE_THEN "B_def")(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN FINITE_DIFF)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "A_def")(GSYM_THEN (new_rewrite [] [])))) THEN repeat_tactic 0 10 (((USE_THM_THEN FINITE_NUMSEG)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN FINITE_SING)(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID ((((USE_THM_THEN SUM_SING)(new_rewrite [] [])) THEN (simp_tac) THEN repeat_tactic 1 9 (((USE_THM_THEN VECTOR_MUL_COMPONENT)(new_rewrite [] []))) THEN ((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN BASIS_COMPONENT)(ISPEC_THEN (mk_var("i",mk_type("num",[]))) thm_tac))(ISPEC_THEN (mk_var("i",mk_type("num",[]))) thm_tac))(new_rewrite [] [])) THEN ((simp_tac THEN TRY done_tac))))));; +refine (by (VALID (((((USE_THM_THEN (REAL_ARITH `!a b. a = b + a * &1 <=> b = &0`))(new_rewrite [] [])) THEN ((USE_THM_THEN SUM_EQ_0)(new_rewrite [] [])) THEN ((TRY done_tac))) THEN (move ["j"])))));; +refine (by (VALID ((((((USE_THM_THEN IN_DIFF)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_SING)(new_rewrite [] []))) THEN (move ["ineq_j"]) THEN (simp_tac)) THEN (((USE_THM_THEN BASIS_COMPONENT)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((fun thm_tac -> (USE_THM_THEN EQ_SYM_EQ)(ISPEC_THEN (mk_var("i",mk_type("num",[]))) thm_tac))(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THEN "ineq_j")(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN REAL_MUL_RZERO)(new_rewrite [] []))) THEN (done_tac)))));; +let lambda_eq_vsum = end_section_proof();; +(start_section_proof ["f";"f'";"y"](`(!i. i IN 1..dimindex (:M) ==> (lift o (f i) has_derivative lift o (f' i)) (at (y:real^N))) ==> + (((\x. lambda i. f i x):real^N->real^M) has_derivative (\x. lambda i. f' i x) ) (at y)`));; +refine (by (VALID (((BETA_TAC THEN (move ["df"])) THEN repeat_tactic 1 9 (((USE_THM_THEN lambda_eq_vsum)(new_rewrite [] []))) THEN ((USE_THM_THEN HAS_DERIVATIVE_VSUM) apply_tac)))));; +refine (by (VALID (((((USE_THM_THEN FINITE_NUMSEG)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac)))));; +refine (by (VALID ((have_tac (move ["eq"]) (`!f. (\x:real^N. f i x % (basis i:real^M)) = (\x. drop ((lift o f i) x) % basis i)`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["g"])) THEN (((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN ((USE_THM_THEN LIFT_DROP)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "eq")(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("num",[]);mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "N"]);mk_type("real",[])])]))) thm_tac))(new_rewrite [] [])) THEN ((fun thm_tac -> (USE_THEN "eq")(ISPEC_THEN (mk_var("f'",mk_type("fun",[mk_type("num",[]);mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "N"]);mk_type("real",[])])]))) thm_tac))(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL HAS_DERIVATIVE_VMUL_DROP))(new_rewrite [] []))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN ((USE_THEN "df")(new_rewrite [] [])) THEN (done_tac)))));; +let has_derivative_lambda = end_section_proof();; +(start_section_proof ["x";"y"](`(vector [x; y]:real^2) = (lambda i. if i = 1 then x else y)`));; +refine (by (VALID ((((((USE_THM_THEN CART_EQ)(new_rewrite [] [])) THEN ((USE_THM_THEN DIMINDEX_2)(new_rewrite [] []))) THEN (move ["i"])) THEN ((USE_THM_THEN (ARITH_RULE `1 <= i /\ i <= 2 <=> i = 1 \/ i = 2`))(new_rewrite [] []))))));; +refine (by (VALID (((case THEN (DISCH_THEN(new_rewrite [1; 3] []))) THEN (((USE_THM_THEN (GEN_ALL VECTOR_2))(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL LAMBDA_BETA))(new_rewrite [] [])) THEN (simp_tac) THEN repeat_tactic 0 10 (((USE_THM_THEN DIMINDEX_2)(new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)))));; +let vector2_eq_lambda = end_section_proof();; +(start_section_proof ["f";"g";"f'";"g'";"y"](`(lift o f has_derivative lift o f') (at y) ==> + (lift o g has_derivative lift o g') (at y) ==> + ((\x. vector [f x; g x]:real^2) has_derivative (\x. vector [f' x; g' x]:real^2)) (at y)`));; +refine (by (VALID (((BETA_TAC THEN (move ["df"]) THEN (move ["dg"])) THEN repeat_tactic 1 9 (((USE_THM_THEN vector2_eq_lambda)(new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN has_derivative_lambda) apply_tac) THEN ((((USE_THM_THEN DIMINDEX_2)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_NUMSEG)(new_rewrite [] []))) THEN (move ["i"]))))));; +refine (by (VALID ((((USE_THM_THEN (ARITH_RULE `1 <= i /\ i <= 2 <=> i = 1 \/ i = 2`))(new_rewrite [] [])) THEN (case THEN (DISCH_THEN(new_rewrite [2; 4] [])) THEN (simp_tac)) THEN (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN ((TRY done_tac)))))));; +refine (by (VALID (((((USE_THM_THEN (ARITH_RULE `~(2 = 1)`))(new_rewrite [] [])) THEN (simp_tac)) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (done_tac)))));; +let has_derivative_vector2 = end_section_proof();; +(start_section_proof ["f";"g";"f'";"g'";"y"](`(lift o f has_derivative lift o f') (at y) ==> + (lift o g has_derivative lift o g') (at y) ==> + (lift o (\x. f x * g x) has_derivative lift o (\x. f' x * g y + f y * g' x)) (at y)`));; +refine (by (VALID ((BETA_TAC THEN (move ["df"]) THEN (move ["dg"])))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`lift o (\x. f x * g x) = (lift o (\p. p$1 * p$2)) o (\x. vector [f x; g x]:real^2)`)))));; +refine (by (VALID ((((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac)) THEN (move ["x"])) THEN repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL VECTOR_2))(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((set_tac "q" (`vector [f y; g y]:real^2`)))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`lift o (\x. f' x * g y + f y * g' x) = + (lift o (\x:real^2. q$2 * x$1 + q$1 * x$2)) o (\x. vector [f' x; g' x])`)))));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THEN "q_def")(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL VECTOR_2))(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_MUL_SYM)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN DIFF_CHAIN_AT) apply_tac) THEN (simp_tac)) THEN (((USE_THEN "q_def")(new_rewrite [] [])) THEN ((USE_THM_THEN has_derivative_x12)(new_rewrite [] [])) THEN ((USE_THM_THEN has_derivative_vector2)(new_rewrite [] []))) THEN (done_tac)))));; +let has_derivative_mul = end_section_proof();; +(start_section_proof ["f"](`f = lift o (drop o f)`));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN ((USE_THM_THEN LIFT_DROP)(new_rewrite [] []))) THEN (done_tac)))));; +let f_eq_lift_drop = end_section_proof();; +(start_section_proof ["f";"g";"y"](`lift o f differentiable (at y) ==> + lift o g differentiable (at y) ==> + lift o (\x. f x * g x) differentiable (at y)`));; +refine (by (VALID ((repeat_tactic 2 0 (((USE_THM_THEN differentiable)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN (move ["f'"])) THEN (move ["df"]) THEN (case THEN (move ["g'"])) THEN (move ["dg"])))));; +refine (by (VALID (((((USE_THEN "dg")MP_TAC) THEN (clear_assumption "dg") THEN ((USE_THEN "df")MP_TAC) THEN (clear_assumption "df") THEN BETA_TAC) THEN ((((fun thm_tac -> (USE_THM_THEN f_eq_lift_drop)(ISPEC_THEN (mk_var("f'",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "?1451210"]);mk_type("cart",[mk_type("real",[]);mk_type("1",[])])]))) thm_tac))(new_rewrite [] [])) THEN ((fun thm_tac -> (USE_THM_THEN f_eq_lift_drop)(ISPEC_THEN (mk_var("g'",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "?1451210"]);mk_type("cart",[mk_type("real",[]);mk_type("1",[])])]))) thm_tac))(new_rewrite [] []))) THEN (move ["df"]) THEN (move ["dg"]))))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN has_derivative_mul)(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "dg")(fun th -> MATCH_MP_THEN th thm_tac fst_th))) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID ((((USE_THM_THEN HAS_DERIVATIVE_IMP_DIFFERENTIABLE) apply_tac) THEN (done_tac)))));; +let differentiable_mul = end_section_proof();; +(start_section_proof ["f";"g";"y"](`lift o f differentiable at y ==> + lift o g differentiable at y ==> + frechet_derivative (lift o (\x. f x * g x)) (at y) = + (\x. g y % frechet_derivative (lift o f) (at y) x + + f y % frechet_derivative (lift o g) (at y) x)`));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN FRECHET_DERIVATIVE_WORKS)(new_rewrite [] []))) THEN ((USE_THM_THEN f_eq_lift_drop)(new_rewrite [] [(`frechet_derivative _1 _2`)]))) THEN (move ["df"])))));; +refine (by (VALID ((((USE_THM_THEN f_eq_lift_drop)(new_rewrite [] [(`frechet_derivative _1 _2`)])) THEN (move ["dg"])))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN has_derivative_mul)(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "dg")(fun th -> MATCH_MP_THEN th thm_tac fst_th))) MP_TAC) THEN ALL_TAC) THEN ((DISCH_THEN (fun snd_th -> (USE_THM_THEN FRECHET_DERIVATIVE_AT)(MATCH_MP_THEN snd_th MP_TAC))) THEN BETA_TAC THEN (DISCH_THEN(GSYM_THEN (new_rewrite [] []))))))));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN repeat_tactic 1 9 (((USE_THM_THEN LIFT_DROP)(new_rewrite [] [])))) THEN (move ["x"])))));; +refine (by (VALID (((((USE_THM_THEN LIFT_ADD)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_SYM)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN LIFT_CMUL)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN LIFT_DROP)(new_rewrite [] [])))) THEN (done_tac)))));; +let frechet_mul = end_section_proof();; +let frechet_mul = finalize_theorem frechet_mul;; +let differentiable_mul = finalize_theorem differentiable_mul;; +let f_eq_lift_drop = finalize_theorem f_eq_lift_drop;; +let has_derivative_mul = finalize_theorem has_derivative_mul;; +let has_derivative_vector2 = finalize_theorem has_derivative_vector2;; +let vector2_eq_lambda = finalize_theorem vector2_eq_lambda;; +let has_derivative_lambda = finalize_theorem has_derivative_lambda;; +let lambda_eq_vsum = finalize_theorem lambda_eq_vsum;; +let has_derivative_x12 = finalize_theorem has_derivative_x12;; +let REAL_LET_MUL2 = finalize_theorem REAL_LET_MUL2;; +(end_section "Product");; +let frechet_mul = finalize_theorem frechet_mul;; +let differentiable_mul = finalize_theorem differentiable_mul;; +let f_eq_lift_drop = finalize_theorem f_eq_lift_drop;; +let has_derivative_mul = finalize_theorem has_derivative_mul;; +let has_derivative_vector2 = finalize_theorem has_derivative_vector2;; +let vector2_eq_lambda = finalize_theorem vector2_eq_lambda;; +let has_derivative_lambda = finalize_theorem has_derivative_lambda;; +let lambda_eq_vsum = finalize_theorem lambda_eq_vsum;; +let has_derivative_x12 = finalize_theorem has_derivative_x12;; +let REAL_LET_MUL2 = finalize_theorem REAL_LET_MUL2;; +let frechet_eq_jacobian = finalize_theorem frechet_eq_jacobian;; +let jacobian_compose = finalize_theorem jacobian_compose;; +let differentiable_compose_at = finalize_theorem differentiable_compose_at;; +let frechet_sub = finalize_theorem frechet_sub;; +let frechet_add = finalize_theorem frechet_add;; +let frechet_scale = finalize_theorem frechet_scale;; +let frechet_neg = finalize_theorem frechet_neg;; +let frechet_vmul = finalize_theorem frechet_vmul;; +let frechet_id = finalize_theorem frechet_id;; +let frechet_const = finalize_theorem frechet_const;; +let frechet_compose = finalize_theorem frechet_compose;; +let f_unary_drop = finalize_theorem f_unary_drop;; +let f_binary_drop = finalize_theorem f_binary_drop;; +let f_lift_sub = finalize_theorem f_lift_sub;; +let f_lift_add = finalize_theorem f_lift_add;; +let f_lift_scale = finalize_theorem f_lift_scale;; +let f_lift_neg = finalize_theorem f_lift_neg;; +(end_section "Misc");; +(begin_section "Partial");; +(start_section_proof ["f";"h";"t"](`(lift o f) differentiable at (h t) ==> + (h o drop) differentiable at (lift t) ==> + ((f o h) has_real_derivative (drop o (frechet_derivative (lift o f) (at (h t)) o + frechet_derivative (h o drop) (at (lift t))) o lift) (&1)) (atreal t)`));; +refine (by (VALID ((BETA_TAC THEN (move ["diff_f"]) THEN (move ["diff_h"])))));; +refine (by (VALID (((((USE_THEN "diff_h")MP_TAC) THEN ((USE_THEN "diff_f")MP_TAC) THEN BETA_TAC) THEN repeat_tactic 1 9 (((USE_THM_THEN FRECHET_DERIVATIVE_WORKS)(new_rewrite [] [])))))));; +refine (by (VALID ((set_tac "f'" (`frechet_derivative _1 _2`)))));; +refine (by (VALID ((set_tac "h'" (`frechet_derivative _1 _2`)))));; +refine (by (VALID ((BETA_TAC THEN (move ["df"]) THEN (move ["dh"])))));; +refine (by (VALID (((USE_THM_THEN (GEN_ALL HAS_REAL_FRECHET_DERIVATIVE_AT))(new_rewrite [] [])))));; +refine (by (VALID (((THENL_FIRST) (have_tac (DISCH_THEN(new_rewrite [] [])) (`lift o (f o h) o drop = (lift o f) o (h o drop)`)) (repeat_tactic 1 9 (((USE_THM_THEN o_ASSOC)(new_rewrite [] []))) THEN (done_tac))))));; +refine (by (VALID ((((THENL_ROT 1)) (have_tac (DISCH_THEN(new_rewrite [] [])) (`(\x. (drop o (f' o h') o lift) (&1) % x) = f' o h'`))))));; +refine (by (VALID (((((USE_THM_THEN DIFF_CHAIN_AT)(new_rewrite [] [])) THEN ((USE_THEN "dh")(new_rewrite [] [])) THEN ((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN ((USE_THM_THEN LIFT_DROP)(new_rewrite [] [])) THEN ((USE_THEN "df")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] [])))) THEN (move ["x"]) THEN (simp_tac)))));; +refine (by (VALID ((have_tac (move ["lin"]) (`linear f' /\ linear h'`)))));; +refine (by (VALID (((((USE_THEN "h'_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "f'_def")(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN LINEAR_FRECHET_DERIVATIVE)(new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [2] [])) (`x = drop x % lift (&1)`)))));; +refine (by (VALID (((((USE_THM_THEN DROP_EQ)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN DROP_CMUL)(new_rewrite [] [])) THEN ((USE_THM_THEN LIFT_DROP)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_RID)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN LINEAR_CMUL)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN DROP_EQ)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN DROP_CMUL)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_MUL_SYM)(new_rewrite [] []))) THEN (done_tac)))));; +let real_derivative_compose_frechet = end_section_proof();; +(start_section_proof ["f";"h";"t"](`(lift o f) differentiable at (h t) ==> + (h o drop) differentiable at (lift t) ==> + ((f o h) has_real_derivative (jacobian (lift o f) (at (h t)) ** + jacobian (h o drop) (at (lift t)))$1$1) (atreal t)`));; +refine (by (VALID ((BETA_TAC THEN (move ["df"]) THEN (move ["dh"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN real_derivative_compose_frechet)(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "dh")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN frechet_eq_jacobian)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac)))));; +refine (by (VALID ((((USE_THM_THEN MATRIX_VECTOR_MUL_ASSOC)(new_rewrite [] [])) THEN ((USE_THM_THEN matrix_vector_mul)(new_rewrite [] [])) THEN ((USE_THM_THEN DROP_LAMBDA)(new_rewrite [] [])) THEN ((USE_THM_THEN DIMINDEX_1)(new_rewrite [] [])) THEN ((USE_THM_THEN SUM_SING_NUMSEG)(new_rewrite [] [])) THEN (simp_tac)))));; +refine (by (VALID (((((USE_THM_THEN LIFT_COMPONENT)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_RID)(new_rewrite [] []))) THEN (done_tac)))));; +let real_derivative_compose_jacobian = end_section_proof();; +(start_section_proof ["f";"h";"t"](`(lift o f) differentiable at (h t) ==> + (h o drop) differentiable at (lift t) ==> + (f o h) real_differentiable atreal t`));; +refine (by (VALID ((BETA_TAC THEN (move ["diff_f"]) THEN (move ["diff_h"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN real_derivative_compose_frechet)(fun fst_th ->(USE_THEN "diff_f")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "diff_h")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC))));; +refine (by (VALID ((set_tac "fh'" (`(drop o _ o lift) (&1)`)))));; +refine (by (VALID (((((USE_THM_THEN real_differentiable)(new_rewrite [] [])) THEN (move ["dfh"])) THEN (exists_tac (mk_var("fh'",mk_type("real",[])))) THEN (done_tac)))));; +let diff_imp_real_diff = end_section_proof();; +(start_section_proof ["y";"e";"net"](`((\t. y + t % e) o drop) differentiable net`));; +refine (by (VALID (((THENL_FIRST) (have_tac (DISCH_THEN(new_rewrite [] [])) (`(\t. y + t % e) o drop = (\x. y + drop x % e)`)) ((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (done_tac))))));; +refine (by (VALID ((((USE_THM_THEN DIFFERENTIABLE_ADD)(new_rewrite [] [])) THEN ((USE_THM_THEN DIFFERENTIABLE_CONST)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))))));; +refine (by (VALID (((USE_THM_THEN HAS_DERIVATIVE_IMP_DIFFERENTIABLE) apply_tac))));; +refine (by (VALID (((exists_tac (`\x. drop x % e`)) THEN ((USE_THM_THEN HAS_DERIVATIVE_VMUL_DROP) apply_tac) THEN ((USE_THM_THEN HAS_DERIVATIVE_ID)(new_rewrite [] [])) THEN (done_tac)))));; +let diff_direction = end_section_proof();; +(start_section_proof ["y";"e";"t"](`frechet_derivative ((\t. y + t % e) o drop) (at (lift t)) = (\x. drop x % e)`));; +refine (by (VALID ((((USE_THM_THEN f_unary_drop)(new_rewrite [] [])) THEN ((USE_THM_THEN frechet_add)(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THM_THEN DIFFERENTIABLE_CONST)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN ((USE_THM_THEN HAS_DERIVATIVE_IMP_DIFFERENTIABLE) apply_tac)))));; +refine (by (VALID (((exists_tac (`\x. drop x % e`)) THEN ((USE_THM_THEN HAS_DERIVATIVE_VMUL_DROP) apply_tac) THEN ((USE_THM_THEN HAS_DERIVATIVE_ID)(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THM_THEN frechet_vmul)(new_rewrite [] [])) THEN ((USE_THM_THEN frechet_const)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN VECTOR_ADD_LID)(new_rewrite [] []))) THEN (done_tac)))));; +let frechet_direction = end_section_proof();; +(start_section_proof ["f";"y";"e";"t"](`(lift o f) differentiable at (y + t % e) ==> + ((f o (\t. y + t % e)) has_real_derivative + (drop (frechet_derivative (lift o f) (at (y + t % e)) e))) (atreal t)`));; +refine (by (VALID ((BETA_TAC THEN (move ["df"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN real_derivative_compose_frechet)(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "?1451778"]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (`\t. y + t % e`) thm_tac))(ISPEC_THEN (mk_var("t",mk_type("real",[]))) thm_tac))MP_TAC) THEN BETA_TAC))));; +refine (by (VALID (((((USE_THEN "df")(new_rewrite [] [])) THEN ((USE_THM_THEN diff_direction)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN frechet_direction)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN LIFT_DROP)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_MUL_LID)(new_rewrite [] []))) THEN (done_tac)))));; +let real_dir_derivative_frechet = end_section_proof();; +(start_section_proof ["f";"y";"e";"t"](`(lift o f) differentiable at (y + t % e) ==> + ((f o (\t. y + t % e)) has_real_derivative + drop (jacobian (lift o f) (at (y + t % e)) ** e)) (atreal t)`));; +refine (by (VALID ((BETA_TAC THEN (move ["df"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN real_dir_derivative_frechet)(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "?1451859"]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (mk_var("e",mk_type("cart",[mk_type("real",[]);mk_vartype "?1451859"]))) thm_tac))(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC))));; +refine (by (VALID ((((USE_THM_THEN frechet_eq_jacobian)(new_rewrite [] [])) THEN (done_tac)))));; +let real_dir_derivative_jacobian = end_section_proof();; +(start_section_proof ["f";"y";"i"](`(lift o f) differentiable at (y:real^N) ==> + partial i f y = drop (frechet_derivative (lift o f) (at y) (basis i))`));; +refine (by (VALID (((BETA_TAC THEN (move ["df"])) THEN ((USE_THM_THEN partial)(new_rewrite [] []))))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN real_dir_derivative_frechet)(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "N"]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (mk_var("y",mk_type("cart",[mk_type("real",[]);mk_vartype "N"]))) thm_tac))(ISPEC_THEN (`basis i:real^N`) thm_tac))(ISPEC_THEN (`&0`) thm_tac))MP_TAC) THEN BETA_TAC) THEN (((USE_THM_THEN VECTOR_MUL_LZERO)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_ADD_RID)(new_rewrite [] [])))))));; +refine (by (VALID (((BETA_TAC THEN ((fun thm_tac -> DISCH_THEN (fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN (DISCH_THEN (fun snd_th -> (USE_THM_THEN derivative_unique)(MATCH_MP_THEN snd_th MP_TAC)))) THEN (done_tac)))));; +let partial_eq_frechet = end_section_proof();; +(start_section_proof ["f";"y";"i"](`(lift o f) differentiable at y ==> + partial i f y = drop (jacobian (lift o f) (at y) ** basis i)`));; +refine (by (VALID ((BETA_TAC THEN (move ["df"])))));; +refine (by (VALID (((((USE_THEN "df")MP_TAC) THEN BETA_TAC) THEN ((((USE_THM_THEN partial_eq_frechet)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN JACOBIAN_WORKS)(new_rewrite [] []))) THEN (DISCH_THEN (fun snd_th -> (USE_THM_THEN FRECHET_DERIVATIVE_AT)(MATCH_MP_THEN snd_th MP_TAC))) THEN (DISCH_THEN(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac)))));; +let partial_eq_jacobian = end_section_proof();; +(start_section_proof ["f";"y";"i"](`(lift o (f:real^N->real)) differentiable at y ==> + i IN 1..dimindex (:N) ==> + partial i f y = drop (column i (jacobian (lift o f) (at y)))`));; +refine (by (VALID ((((USE_THM_THEN IN_NUMSEG)(new_rewrite [] [])) THEN (move ["df"]) THEN (move ["ineq"])))));; +refine (by (VALID (((((USE_THM_THEN partial_eq_jacobian)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN MATRIX_VECTOR_MUL_BASIS)(new_rewrite [] []))) THEN (done_tac)))));; +let partial_eq_jacobian_column = end_section_proof();; +(start_section_proof ["f";"y";"i"](`(lift o (f:real^N->real)) differentiable at y ==> + i IN 1..dimindex (:N) ==> + partial i f y = (jacobian (lift o f) (at y))$1$i`));; +refine (by (VALID (((BETA_TAC THEN (move ["df"]) THEN (move ["ineq"])) THEN (((USE_THM_THEN partial_eq_jacobian_column)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN column)(new_rewrite [] [])) THEN ((USE_THM_THEN DROP_LAMBDA)(new_rewrite [] []))) THEN (done_tac)))));; +let partial_eq_jacobian_entry = end_section_proof();; +(add_section_var (mk_var ("y", (`:real^N`))));; +(add_section_var (mk_var ("i", (`:num`))));; +(start_section_proof ["f"](`~(i IN 1..dimindex (:N)) ==> + partial i f y = &0`));; +refine (by (VALID (((BETA_TAC THEN (move ["ineq"])) THEN ((USE_THM_THEN partial)(new_rewrite [] []))))));; +refine (by (VALID (((THENL_FIRST) (have_tac (DISCH_THEN(new_rewrite [] [])) (`basis i = (vec 0):real^N`)) (((USE_THM_THEN BASIS_EQ_0)(new_rewrite [] [])) THEN (done_tac))))));; +refine (by (VALID ((((USE_THM_THEN VECTOR_MUL_RZERO)(fun th -> ONCE_REWRITE_TAC[th])) THEN ((USE_THM_THEN VECTOR_ADD_RID)(fun th -> ONCE_REWRITE_TAC[th]))))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`derivative (f o (\t. y)) = derivative (\t. f y)`)))));; +refine (by (VALID (((AP_TERM_TAC) THEN (((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN derivative_const)(new_rewrite [] [])) THEN (done_tac)))));; +let partial_eq0 = end_section_proof();; +(start_section_proof ["f";"g";"x"](`f real_differentiable atreal (g x) ==> + g real_differentiable atreal x ==> + derivative (f o g) x = derivative f (g x) * derivative g x`));; +refine (by (VALID ((BETA_TAC THEN (move ["df"]) THEN (move ["dg"])))));; +refine (by (VALID (((THENL_FIRST) (have_tac (DISCH_THEN(new_rewrite [] [])) (`f o g = \x. f (g x)`)) ((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (done_tac))))));; +refine (by (VALID (((((USE_THM_THEN derivative_composition)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN REAL_MUL_SYM)(new_rewrite [] []))) THEN (done_tac)))));; +let derivative_compose = end_section_proof();; +(start_section_proof ["i";"net"](`i IN 1..dimindex (:N) ==> + (lift o (\x:real^N. x$i) has_derivative lift o (\x. x$i)) net`));; +refine (by (VALID ((((USE_THM_THEN IN_NUMSEG)(new_rewrite [] [])) THEN (move ["ineq"])))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`lift o (\x:real^N. x$i) = (\x. x$i % vec 1)`)))));; +refine (by (VALID ((((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN (simp_tac)) THEN (move ["x"])) THEN (((USE_THM_THEN DROP_EQ)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN LIFT_DROP)(new_rewrite [] [])) THEN ((USE_THM_THEN DROP_CMUL)(new_rewrite [] [])) THEN ((USE_THM_THEN DROP_VEC)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_RID)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN (GEN_ALL HAS_DERIVATIVE_VMUL_COMPONENT))(new_rewrite [] [])) THEN ((USE_THM_THEN HAS_DERIVATIVE_ID)(new_rewrite [] []))) THEN (done_tac)))));; +let projection_has_derivative = end_section_proof();; +(start_section_proof ["i";"net"](`i IN 1..dimindex (:N) ==> + (lift o (\x:real^N. x$i)) differentiable net`));; +refine (by (VALID ((((USE_THM_THEN differentiable)(new_rewrite [] [])) THEN (DISCH_THEN (fun snd_th -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN projection_has_derivative)(ISPEC_THEN (mk_var("i",mk_type("num",[]))) thm_tac))(ISPEC_THEN (mk_var("net",mk_type("net",[mk_type("cart",[mk_type("real",[]);mk_vartype "N"])]))) thm_tac))(MATCH_MP_THEN snd_th MP_TAC))) THEN (move ["h"])))));; +refine (by (VALID (((exists_tac (`lift o \x:real^N. x$i`)) THEN (done_tac)))));; +let projection_diff = end_section_proof();; +(start_section_proof ["i";"x"](`i IN 1..dimindex (:N) ==> + frechet_derivative (lift o (\x:real^N. x$i)) (at x) = lift o (\x:real^N. x$i)`));; +refine (by (VALID (((BETA_TAC THEN (move ["ineq"])) THEN ((USE_THM_THEN EQ_SYM_EQ)(new_rewrite [] [])) THEN ((USE_THM_THEN FRECHET_DERIVATIVE_AT) apply_tac)))));; +refine (by (VALID ((((USE_THM_THEN projection_has_derivative)(new_rewrite [] [])) THEN (done_tac)))));; +let frechet_projection = end_section_proof();; +(start_section_proof ["h";"t";"i"](`i IN 1..dimindex (:N) ==> + (h o drop) differentiable at (lift t) ==> + ((\s. (h:real->real^N) s$i) has_real_derivative + (frechet_derivative (h o drop) (at (lift t)) (lift (&1)))$i) (atreal t)`));; +refine (by (VALID ((BETA_TAC THEN (move ["ineq"]) THEN (move ["dh"])))));; +refine (by (VALID (((THENL_FIRST) (have_tac (DISCH_THEN(new_rewrite [] [])) (`(\s. h s$i) = (\x. x$i) o h`)) ((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (done_tac))))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN real_derivative_compose_frechet)(ISPEC_THEN (`\x:real^N. x$i`) thm_tac))(ISPEC_THEN (mk_var("h",mk_type("fun",[mk_type("real",[]);mk_type("cart",[mk_type("real",[]);mk_vartype "N"])]))) thm_tac))(ISPEC_THEN (mk_var("t",mk_type("real",[]))) thm_tac))MP_TAC) THEN BETA_TAC))));; +refine (by (VALID ((((USE_THEN "dh")(new_rewrite [] [])) THEN ((USE_THM_THEN projection_diff)(new_rewrite [] [])) THEN ((simp_tac THEN TRY done_tac))))));; +refine (by (VALID ((set_tac "lhs" (`(drop o _ o lift) (&1)`)))));; +refine (by (VALID ((set_tac "rhs" (`(frechet_derivative _1 _2 _3)$i`)))));; +refine (by (VALID (((THENL_FIRST) (((THENL_ROT 1)) (have_tac (DISCH_THEN(new_rewrite [] [])) (`lhs = rhs`))) ((done_tac) THEN (done_tac))))));; +refine (by (VALID (((((USE_THEN "lhs_def")(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN frechet_projection)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THEN "rhs_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN LIFT_DROP)(new_rewrite [] []))) THEN (done_tac)))));; +let has_derivative_vector_frechet = end_section_proof();; +(start_section_proof ["h";"t";"i"](`i IN 1..dimindex (:N) ==> + (h o drop) differentiable at (lift t) ==> + ((\s. (h:real->real^N) s$i) has_real_derivative (jacobian (h o drop) (at (lift t)))$i$1) (atreal t)`));; +refine (by (VALID ((BETA_TAC THEN (move ["ineq"]) THEN (move ["dh"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN has_derivative_vector_frechet)(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "dh")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC))));; +refine (by (VALID ((set_tac "lhs" (`(frechet_derivative _1 _2 _3)$i`)))));; +refine (by (VALID ((set_tac "rhs" (`jacobian _1 _2$i$1`)))));; +refine (by (VALID (((THENL_FIRST) (((THENL_ROT 1)) (have_tac (DISCH_THEN(new_rewrite [] [])) (`lhs = rhs`))) ((done_tac) THEN (done_tac))))));; +refine (by (VALID ((((USE_THEN "lhs_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN frechet_eq_jacobian)(new_rewrite [] [])) THEN ((simp_tac THEN TRY done_tac))))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`lift (&1) = basis 1`)))));; +refine (by (VALID (((((USE_THM_THEN DROP_EQ)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN LIFT_DROP)(new_rewrite [] [])) THEN ((USE_THM_THEN basis)(new_rewrite [] [])) THEN ((USE_THM_THEN DROP_LAMBDA)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN MATRIX_VECTOR_MUL_BASIS)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN DIMINDEX_GE_1)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN leqnn)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN column)(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL LAMBDA_BETA))(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN IN_NUMSEG)(GSYM_THEN (new_rewrite [] []))))) THEN (done_tac)))));; +let has_derivative_vector_jacobian = end_section_proof();; +(start_section_proof ["h";"t";"i"](`i IN 1..dimindex (:N) ==> + ((h:real->real^N) o drop) differentiable at (lift t) ==> + derivative (\s. h s$i) t = jacobian (h o drop) (at (lift t))$i$1`));; +refine (by (VALID (((BETA_TAC THEN (move ["ineq"]) THEN (move ["dh"])) THEN ((USE_THM_THEN derivative_unique) apply_tac) THEN ((USE_THM_THEN has_derivative_vector_jacobian)(new_rewrite [] [])) THEN (done_tac)))));; +let derivative_vector_jacobian = end_section_proof();; +(start_section_proof ["f";"h";"t"](`(lift o (f:real^N -> real)) differentiable at (h t) ==> + (h o drop) differentiable at (lift t) ==> + ((f o h) has_real_derivative + sum (1..dimindex (:N)) (\i. partial i f (h t) * derivative (\s. h s$i) t)) (atreal t)`));; +refine (by (VALID ((BETA_TAC THEN (move ["df"]) THEN (move ["dh"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN real_derivative_compose_jacobian)(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "dh")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC))));; +refine (by (VALID (((set_tac "lhs" (`_$1$1`)) THEN (set_tac "rhs" (`sum _ _2`))))));; +refine (by (VALID (((THENL_FIRST) (((THENL_ROT 1)) (have_tac (DISCH_THEN(new_rewrite [] [])) (`lhs = rhs`))) ((done_tac) THEN (done_tac))))));; +refine (by (VALID (((USE_THEN "lhs_def")(GSYM_THEN (new_rewrite [] []))))));; +refine (by (VALID ((((USE_THM_THEN matrix_mul)(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL LAMBDA_BETA))(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN DIMINDEX_GE_1)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN leqnn)(new_rewrite [] []))) THEN ((simp_tac THEN TRY done_tac))))));; +refine (by (VALID ((((USE_THM_THEN (GEN_ALL LAMBDA_BETA))(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN DIMINDEX_GE_1)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN leqnn)(new_rewrite [] []))) THEN ((simp_tac THEN TRY done_tac)) THEN ((USE_THEN "rhs_def")(GSYM_THEN (new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN SUM_EQ) apply_tac) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac)))));; +refine (by (VALID (((((USE_THM_THEN partial_eq_jacobian_entry)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN REAL_EQ_MUL_LCANCEL)(new_rewrite [] [])) THEN ((USE_THM_THEN derivative_vector_jacobian)(new_rewrite [] []))) THEN (done_tac)))));; +let real_derivative_compose_partial = end_section_proof();; +(start_section_proof ["f";"e";"t"](`(lift o f) differentiable at (y + t % e) ==> + ((f o (\t. y + t % e)) has_real_derivative + sum (1..dimindex (:N)) (\i. e$i * (partial i f o (\t. y + t % e)) t)) (atreal t)`));; +refine (by (VALID ((BETA_TAC THEN (move ["df"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN real_dir_derivative_jacobian)(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "N"]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (mk_var("y",mk_type("cart",[mk_type("real",[]);mk_vartype "N"]))) thm_tac))(ISPEC_THEN (mk_var("e",mk_type("cart",[mk_type("real",[]);mk_vartype "N"]))) thm_tac))(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC))));; +refine (by (VALID ((((USE_THM_THEN matrix_vector_mul)(new_rewrite [] [])) THEN ((USE_THM_THEN DROP_LAMBDA)(new_rewrite [] []))))));; +refine (by (VALID (((set_tac "lhs" (`sum _1 _2`)) THEN (set_tac "rhs" (`sum _1 _2`))))));; +refine (by (VALID (((THENL_FIRST) (((THENL_ROT 1)) (have_tac (DISCH_THEN(new_rewrite [] [])) (`lhs = rhs`))) ((done_tac) THEN (done_tac))))));; +refine (by (VALID (((((USE_THEN "lhs_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "rhs_def")(GSYM_THEN (new_rewrite [] [])))) THEN (((USE_THM_THEN SUM_EQ) apply_tac) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac))))));; +refine (by (VALID (((((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN ((USE_THM_THEN partial_eq_jacobian_entry)(new_rewrite [] [])) THEN ((simp_tac THEN TRY done_tac)) THEN ((USE_THM_THEN REAL_MUL_SYM)(new_rewrite [] []))) THEN (done_tac)))));; +let real_dir_derivative_partial = end_section_proof();; +(add_section_var (mk_var ("f", (`:real^N -> real`))); add_section_var (mk_var ("g", (`:real^N -> real`))));; +(add_section_hyp "df" (`(lift o f) differentiable at y`));; +(start_section_proof ["u"](`u real_differentiable atreal (f y) ==> + partial i (u o f) y = derivative u (f y) * partial i f y`));; +refine (by (VALID (((BETA_TAC THEN (move ["du"])) THEN (repeat_tactic 1 9 (((USE_THM_THEN partial)(new_rewrite [] []))) THEN ((USE_THM_THEN o_ASSOC)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN derivative_compose)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac))))));; +refine (by (VALID (((((USE_THM_THEN diff_imp_real_diff)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN VECTOR_MUL_LZERO)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_ADD_RID)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "df")(new_rewrite [] [])) THEN ((USE_THM_THEN diff_direction)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN VECTOR_MUL_LZERO)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_ADD_RID)(new_rewrite [] []))) THEN (done_tac)))));; +let partial_uni_compose = end_section_proof();; +(start_section_proof [](`partial i (\x. --f x) y = --partial i f y`));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN partial_eq_frechet)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN f_lift_neg)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN DIFFERENTIABLE_NEG)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN repeat_tactic 0 10 (((USE_THM_THEN frechet_neg)(new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN DROP_NEG)(fun th -> ONCE_REWRITE_TAC[th]))) THEN (done_tac)))));; +let partial_neg = end_section_proof();; +(start_section_proof ["c"](`partial i (\x. c * f x) y = c * partial i f y`));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN partial_eq_frechet)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN f_lift_scale)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN DIFFERENTIABLE_CMUL)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN repeat_tactic 0 10 (((USE_THM_THEN frechet_scale)(new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))) THEN ((TRY done_tac)))))));; +refine (by (VALID ((((USE_THM_THEN DROP_CMUL)(new_rewrite [] [])) THEN (done_tac)))));; +let partial_scale = end_section_proof();; +(add_section_hyp "dg" (`(lift o g) differentiable at y`));; +(start_section_proof [](`partial i (\x. f x + g x) y = partial i f y + partial i g y`));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN partial_eq_frechet)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN f_lift_add)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN DIFFERENTIABLE_ADD)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN repeat_tactic 0 10 (((USE_THM_THEN frechet_add)(new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))) THEN ((TRY done_tac)))))));; +refine (by (VALID ((((USE_THM_THEN DROP_ADD)(new_rewrite [] [])) THEN (done_tac)))));; +let partial_add = end_section_proof();; +(start_section_proof [](`partial i (\x. f x - g x) y = partial i f y - partial i g y`));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN partial_eq_frechet)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN f_lift_sub)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN DIFFERENTIABLE_SUB)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN repeat_tactic 0 10 (((USE_THM_THEN frechet_sub)(new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))) THEN ((TRY done_tac)))))));; +refine (by (VALID ((((USE_THM_THEN DROP_SUB)(new_rewrite [] [])) THEN (done_tac)))));; +let partial_sub = end_section_proof();; +(start_section_proof [](`partial i (\x. f x * g x) y = partial i f y * g y + f y * partial i g y`));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN partial)(new_rewrite [] []))) THEN (set_tac "h" (`\t. y + t % basis i`))))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`(\x. f x * g x) o h = (\t. (f o h) t * (g o h) t)`)))));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID (((THENL_ROT (-1)) ((USE_THM_THEN derivative_mul)(new_rewrite [] []))))));; +refine (by (VALID ((((USE_THEN "h_def")(GSYM_THEN (new_rewrite [1; 4] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN VECTOR_MUL_LZERO)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_ADD_RID)(new_rewrite [] [])) THEN ((fun thm_tac -> (USE_THM_THEN o_THM)(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "N"]);mk_type("real",[])]))) thm_tac))(GSYM_THEN (new_rewrite [] []))) THEN ((fun thm_tac -> (USE_THM_THEN o_THM)(ISPEC_THEN (mk_var("g",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "N"]);mk_type("real",[])]))) thm_tac))(GSYM_THEN (new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN REAL_ADD_SYM)(new_rewrite [] [])) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (done_tac)))));; +refine (by (VALID (((THENL_FIRST) (have_tac (move ["h0"]) (`h (&0) = y`)) ((((USE_THEN "h_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN VECTOR_MUL_LZERO)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_ADD_RID)(new_rewrite [] []))) THEN (done_tac))))));; +refine (by (VALID (((THENL_FIRST) (have_tac (move ["dh"]) (`(h o drop) differentiable at (lift (&0))`)) ((((USE_THEN "h_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN diff_direction)(new_rewrite [] []))) THEN (done_tac))))));; +refine (by (VALID ((((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (repeat_tactic 1 9 (((USE_THM_THEN diff_imp_real_diff)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "h0")(new_rewrite [] [])))) THEN (done_tac)))));; +let partial_mul = end_section_proof();; +let partial_mul = finalize_theorem partial_mul;; +let partial_sub = finalize_theorem partial_sub;; +let partial_add = finalize_theorem partial_add;; +let partial_scale = finalize_theorem partial_scale;; +let partial_neg = finalize_theorem partial_neg;; +let partial_uni_compose = finalize_theorem partial_uni_compose;; +let real_dir_derivative_partial = finalize_theorem real_dir_derivative_partial;; +let real_derivative_compose_partial = finalize_theorem real_derivative_compose_partial;; +let derivative_vector_jacobian = finalize_theorem derivative_vector_jacobian;; +let has_derivative_vector_jacobian = finalize_theorem has_derivative_vector_jacobian;; +let has_derivative_vector_frechet = finalize_theorem has_derivative_vector_frechet;; +let frechet_projection = finalize_theorem frechet_projection;; +let projection_diff = finalize_theorem projection_diff;; +let projection_has_derivative = finalize_theorem projection_has_derivative;; +let derivative_compose = finalize_theorem derivative_compose;; +let partial_eq0 = finalize_theorem partial_eq0;; +let partial_eq_jacobian_entry = finalize_theorem partial_eq_jacobian_entry;; +let partial_eq_jacobian_column = finalize_theorem partial_eq_jacobian_column;; +let partial_eq_jacobian = finalize_theorem partial_eq_jacobian;; +let partial_eq_frechet = finalize_theorem partial_eq_frechet;; +let real_dir_derivative_jacobian = finalize_theorem real_dir_derivative_jacobian;; +let real_dir_derivative_frechet = finalize_theorem real_dir_derivative_frechet;; +let frechet_direction = finalize_theorem frechet_direction;; +let diff_direction = finalize_theorem diff_direction;; +let diff_imp_real_diff = finalize_theorem diff_imp_real_diff;; +let real_derivative_compose_jacobian = finalize_theorem real_derivative_compose_jacobian;; +let real_derivative_compose_frechet = finalize_theorem real_derivative_compose_frechet;; +(end_section "Partial");; +(begin_section "PartialMonotone");; +(start_section_proof ["f";"x"](`f real_differentiable atreal x ==> + derivative f x = derivative (f o (\t. x + t)) (&0)`));; +refine (by (VALID ((BETA_TAC THEN (move ["diff_f"])))));; +refine (by (VALID ((((USE_THM_THEN derivative_compose)(new_rewrite [] [])) THEN (simp_tac) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_ADD_RID)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "diff_f")(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THM_THEN REAL_DIFFERENTIABLE_ADD)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_DIFFERENTIABLE_CONST)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_DIFFERENTIABLE_ID)(new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN derivative_add)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_DIFFERENTIABLE_CONST)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_DIFFERENTIABLE_ID)(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID (((((USE_THM_THEN derivative_const)(new_rewrite [] [])) THEN ((USE_THM_THEN derivative_x)(new_rewrite [] [])) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac)))));; +let derivative_translation = end_section_proof();; +(add_section_type (mk_var ("f", (`:real^N->real`))));; +(start_section_proof ["f";"j";"u";"x";"z";"lo"](`(!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = z$i) ==> + u$j = x$j ==> + (!y. y IN interval [x,z] ==> (lift o f) differentiable at y) ==> + (!y. y IN interval [x,z] ==> &0 <= partial j f y) ==> + (!y. y IN interval [x,u] ==> lo <= f y) ==> + (!y. y IN interval [x,z] ==> lo <= f y)`));; +refine (by (VALID (((((USE_THM_THEN IN_NUMSEG)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL IN_INTERVAL))(new_rewrite [] [])))) THEN (move ["uz_eq"]) THEN (move ["ux_eq"]) THEN (move ["diff_f"]) THEN (move ["partial_pos"]) THEN (move ["f_bound"]) THEN (move ["y"]) THEN (move ["y_in"])))));; +refine (by (VALID (((((USE_THEN "partial_pos")MP_TAC) THEN (clear_assumption "partial_pos") THEN ((USE_THEN "diff_f")MP_TAC) THEN (clear_assumption "diff_f") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL IN_INTERVAL))(GSYM_THEN (new_rewrite [] [])))) THEN (move ["diff_f"]) THEN (move ["partial_pos"]))))));; +refine (by (VALID ((set_tac "y'" (`(lambda i. if i = j then x$j else y$i):real^N`)))));; +refine (by (VALID ((((THENL_ROT 1)) (have_tac ALL_TAC (`f y' <= f y`))))));; +refine (by (VALID (((((USE_THM_THEN (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))MP_TAC) THEN (DISCH_THEN apply_tac)) THEN (((USE_THEN "f_bound")MP_TAC) THEN (clear_assumption "f_bound") THEN (DISCH_THEN apply_tac) THEN (move ["i"]) THEN (move ["i_in"]))))));; +refine (by (VALID ((((USE_THEN "y'_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN (GEN_ALL LAMBDA_BETA))(new_rewrite [] [])) THEN ((simp_tac THEN TRY done_tac))))));; +refine (by (VALID (((THENL_FIRST) (((fun thm_tac -> (USE_THM_THEN EXCLUDED_MIDDLE)(ISPEC_THEN (`i = j`) thm_tac))MP_TAC) THEN case THEN (simp_tac) THEN (move ["ij"])) ((((USE_THEN "ux_eq")(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] []))) THEN (done_tac))))));; +refine (by (VALID (((((USE_THEN "uz_eq")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THEN "y_in")(new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID ((((THENL_ROT (-1)) (((fun thm_tac -> (USE_THM_THEN EXCLUDED_MIDDLE)(ISPEC_THEN (`j IN 1..dimindex (:N)`) thm_tac))MP_TAC) THEN case)) THEN (((USE_THM_THEN IN_NUMSEG)(new_rewrite [] [])) THEN (move ["j_in"]))))));; +refine (by (VALID (((THENL_FIRST) (((THENL_ROT 1)) (have_tac ALL_TAC (`y' = y`))) ((BETA_TAC THEN (DISCH_THEN(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] [])) THEN (done_tac))))));; +refine (by (VALID ((((USE_THM_THEN CART_EQ)(new_rewrite [] [])) THEN (move ["i"]) THEN (move ["i_in"])))));; +refine (by (VALID (((THENL_FIRST) (have_tac (move ["inj"]) (`~(i = j)`)) ((((USE_THEN "i_in")MP_TAC) THEN (clear_assumption "i_in") THEN ((USE_THEN "j_in")MP_TAC) THEN (clear_assumption "j_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID (((((USE_THEN "y'_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN (GEN_ALL LAMBDA_BETA))(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((set_tac "g" (`f o (\t. y' + t % basis j)`)))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`f y' = g (&0)`)))));; +refine (by (VALID (((((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN VECTOR_MUL_LZERO)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_ADD_RID)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`f y = g (y$j - x$j)`)))));; +refine (by (VALID (((((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN (simp_tac)) THEN (AP_TERM_TAC)))));; +refine (by (VALID ((((USE_THM_THEN CART_EQ)(new_rewrite [] [])) THEN (move ["i"]) THEN (move ["i_in"])))));; +refine (by (VALID ((((USE_THM_THEN VECTOR_ADD_COMPONENT)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_MUL_COMPONENT)(new_rewrite [] [])) THEN ((USE_THM_THEN BASIS_COMPONENT)(new_rewrite [] [])) THEN ((TRY done_tac))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THM_THEN EXCLUDED_MIDDLE)(ISPEC_THEN (`i = j`) thm_tac))MP_TAC) THEN case THEN (simp_tac) THEN (move ["ij"])) THEN (((USE_THEN "y'_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN (GEN_ALL LAMBDA_BETA))(new_rewrite [] [])) THEN ((TRY done_tac)))))));; +refine (by (VALID (((arith_tac) THEN (done_tac)))));; +refine (by (VALID ((((simp_tac) THEN ((USE_THEN "ij")(new_rewrite [] [])) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((set_tac "s" (`real_interval [&0, y$j - x$j]`)))));; +refine (by (VALID ((have_tac (move ["in_s"]) (`!t. t IN s ==> y' + t % basis j IN interval [x,z]`)))));; +refine (by (VALID (((((USE_THEN "s_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL IN_INTERVAL))(new_rewrite [] []))) THEN (move ["t"]) THEN (move ["t_ineq"]) THEN (move ["i"]) THEN (move ["i_ineq"])))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN VECTOR_ADD_COMPONENT)(new_rewrite [] []))) THEN ((USE_THM_THEN VECTOR_MUL_COMPONENT)(new_rewrite [] [])) THEN ((USE_THM_THEN BASIS_COMPONENT)(new_rewrite [] [])) THEN ((TRY done_tac))))));; +refine (by (VALID ((((USE_THEN "y'_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN (GEN_ALL LAMBDA_BETA))(new_rewrite [] [])) THEN ((simp_tac THEN TRY done_tac))))));; +refine (by (VALID (((THENL_ROT (-1)) (((fun thm_tac -> (USE_THM_THEN EXCLUDED_MIDDLE)(ISPEC_THEN (`i = j`) thm_tac))MP_TAC) THEN case THEN (simp_tac) THEN (move ["ij"]))))));; +refine (by (VALID (((((USE_THM_THEN REAL_MUL_RZERO)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_ADD_RID)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THEN "y_in")(new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THEN "t_ineq")MP_TAC) THEN (clear_assumption "t_ineq") THEN ((fun thm_tac -> (USE_THEN "y_in")(fun fst_th ->(USE_THEN "i_ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC) THEN ((USE_THEN "ij")(new_rewrite [] [])) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["ds"]) (`!t. t IN s ==> (g has_real_derivative (partial j f (y' + t % basis j))) (atreal t within s)`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "in_s")(MATCH_MP_THEN snd_th MP_TAC))) THEN (move ["p_in"])) THEN (((USE_THM_THEN HAS_REAL_DERIVATIVE_ATREAL_WITHIN)MP_TAC) THEN (clear_assumption "HAS_REAL_DERIVATIVE_ATREAL_WITHIN") THEN (DISCH_THEN apply_tac)) THEN ((USE_THM_THEN partial)(new_rewrite [] []))))));; +refine (by (VALID ((set_tac "h" (`f o _`)))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`h = g o (\t'. t + t')`)))));; +refine (by (VALID ((((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "h_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] [])))) THEN (move ["r"])) THEN (repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac))))));; +refine (by (VALID (((((USE_THM_THEN (GEN_ALL VECTOR_ADD_RDISTRIB))(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL VECTOR_ADD_ASSOC))(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN derivative_translation)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN has_derivative_alt)(new_rewrite [] []))) THEN ((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN diff_imp_real_diff)(new_rewrite [] []))) THEN (((USE_THEN "diff_f")(new_rewrite [] [])) THEN ((simp_tac THEN TRY done_tac)) THEN ((USE_THM_THEN diff_direction)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((THENL_FIRST) (have_tac (move ["pos"]) (`&0 <= y$j - x$j`)) ((((fun thm_tac -> (USE_THEN "y_in")(fun fst_th ->(USE_THEN "j_in")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN HAS_REAL_DERIVATIVE_INCREASING_IMP)(ISPEC_THEN (mk_var("g",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (`\t. partial j f (y' + t % basis j)`) thm_tac))(ISPEC_THEN (mk_var("s",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])]))) thm_tac))(ISPEC_THEN (`&0`) thm_tac))(ISPEC_THEN (`y$j - x$j`) thm_tac)) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID (((((USE_THEN "s_def")(GSYM_THEN (new_rewrite [1] []))) THEN ((USE_THM_THEN IS_REALINTERVAL_INTERVAL)(new_rewrite [] [])) THEN (simp_tac)) THEN (((USE_THEN "ds")(fun th -> ONCE_REWRITE_TAC[th])) THEN (simp_tac)) THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID ((((USE_THEN "s_def")(GSYM_THEN (new_rewrite [2; 3] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN ((USE_THEN "pos")(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] []))) THEN (simp_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "in_s")(MATCH_MP_THEN snd_th MP_TAC))) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "partial_pos")(MATCH_MP_THEN snd_th MP_TAC)))) THEN (done_tac)))));; +let partial_increasing_left = end_section_proof();; +(start_section_proof ["f";"j";"u";"x";"z";"hi"](`(!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = z$i) ==> + u$j = x$j ==> + (!y. y IN interval [x,z] ==> (lift o f) differentiable at y) ==> + (!y. y IN interval [x,z] ==> partial j f y <= &0) ==> + (!y. y IN interval [x,u] ==> f y <= hi) ==> + (!y. y IN interval [x,z] ==> f y <= hi)`));; +refine (by (VALID ((BETA_TAC THEN (move ["u_eq_i"]) THEN (move ["u_eq_j"]) THEN (move ["diff_f"]) THEN (move ["partial_f"]) THEN (move ["f_bound"]) THEN (move ["y"]) THEN (move ["y_in"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN partial_increasing_left)(ISPEC_THEN (`(\p. -- f p)`) thm_tac))(ISPEC_THEN (mk_var("j",mk_type("num",[]))) thm_tac))(ISPEC_THEN (mk_var("u",mk_type("cart",[mk_type("real",[]);mk_vartype "N"]))) thm_tac))(ISPEC_THEN (mk_var("x",mk_type("cart",[mk_type("real",[]);mk_vartype "N"]))) thm_tac))(ISPEC_THEN (mk_var("z",mk_type("cart",[mk_type("real",[]);mk_vartype "N"]))) thm_tac))(ISPEC_THEN (`--hi`) thm_tac))(fun fst_th ->(USE_THEN "u_eq_i")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "u_eq_j")(fun th -> MATCH_MP_THEN th thm_tac fst_th))) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID (((THENL_FIRST) (ANTS_TAC) ((BETA_TAC THEN (move ["p"]) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "diff_f")(MATCH_MP_THEN snd_th MP_TAC))) THEN (DISCH_THEN (fun snd_th -> (USE_THM_THEN DIFFERENTIABLE_NEG)(MATCH_MP_THEN snd_th MP_TAC)))) THEN ((USE_THM_THEN f_lift_neg)(new_rewrite [] [])) THEN (done_tac))))));; +refine (by (VALID ((ANTS_TAC))));; +refine (by (VALID (((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])) THEN (((USE_THM_THEN partial_neg)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "diff_f")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN REAL_NEG_GE0)(new_rewrite [] [])) THEN ((USE_THEN "partial_f")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((THENL_FIRST) (ANTS_TAC) ((BETA_TAC THEN (move ["p"]) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "f_bound")(MATCH_MP_THEN snd_th MP_TAC)))) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID (((((fun thm_tac -> DISCH_THEN (fun fst_th ->(USE_THEN "y_in")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +let partial_decreasing_left = end_section_proof();; +(start_section_proof ["f";"i";"p";"y"](`lift o f differentiable at (p + y) ==> + partial i (f o (\x. p + x)) y = partial i f (p + y)`));; +refine (by (VALID ((BETA_TAC THEN (move ["diff"])))));; +refine (by (VALID ((have_tac (move ["diff_p"]) (`!net. (\x. p + x) differentiable net`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["net"])) THEN (((USE_THM_THEN DIFFERENTIABLE_ADD)(new_rewrite [] [])) THEN ((USE_THM_THEN DIFFERENTIABLE_CONST)(new_rewrite [] [])) THEN ((USE_THM_THEN DIFFERENTIABLE_ID)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN partial_eq_frechet)(new_rewrite [] [])) THEN repeat_tactic 0 1 (((USE_THM_THEN o_ASSOC)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN DIFFERENTIABLE_CHAIN_AT)(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID ((((USE_THM_THEN frechet_compose)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN frechet_add)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN DIFFERENTIABLE_ID)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN DIFFERENTIABLE_CONST)(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID ((((USE_THM_THEN frechet_const)(new_rewrite [] [])) THEN ((USE_THM_THEN frechet_id)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN VECTOR_ADD_LID)(new_rewrite [] [])) THEN ((USE_THM_THEN I_DEF)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN I_O_ID)(new_rewrite [] []))))));; +refine (by (VALID ((((USE_THM_THEN partial_eq_frechet)(new_rewrite [] [])) THEN (done_tac)))));; +let partial_translation = end_section_proof();; +(start_section_proof ["f";"i";"p";"y"](`lift o f differentiable at (p - y) ==> + partial i (f o (\x. p - x)) y = --partial i f (p - y)`));; +refine (by (VALID ((BETA_TAC THEN (move ["diff"])))));; +refine (by (VALID ((have_tac (move ["diff_p"]) (`!net. (\x. p - x) differentiable net`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["net"])) THEN (((USE_THM_THEN DIFFERENTIABLE_SUB)(new_rewrite [] [])) THEN ((USE_THM_THEN DIFFERENTIABLE_CONST)(new_rewrite [] [])) THEN ((USE_THM_THEN DIFFERENTIABLE_ID)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN partial_eq_frechet)(new_rewrite [] [])) THEN repeat_tactic 0 1 (((USE_THM_THEN o_ASSOC)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN DIFFERENTIABLE_CHAIN_AT)(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID ((((USE_THM_THEN frechet_compose)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN frechet_sub)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN DIFFERENTIABLE_ID)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN DIFFERENTIABLE_CONST)(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID ((((USE_THM_THEN frechet_const)(new_rewrite [] [])) THEN ((USE_THM_THEN frechet_id)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN (GEN_ALL VECTOR_SUB_LZERO))(new_rewrite [] []))))));; +refine (by (VALID ((((USE_THM_THEN partial_eq_frechet)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac)))));; +refine (by (VALID (((((USE_THM_THEN LINEAR_NEG)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN LINEAR_FRECHET_DERIVATIVE)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN DROP_NEG)(new_rewrite [] []))) THEN (done_tac)))));; +let partial_rev_translation = end_section_proof();; +(start_section_proof ["f";"j";"u";"x";"z";"hi"](`(!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = x$i) ==> + u$j = z$j ==> + (!y. y IN interval [x,z] ==> (lift o f) differentiable at y) ==> + (!y. y IN interval [x,z] ==> &0 <= partial j f y) ==> + (!y. y IN interval [u,z] ==> f y <= hi) ==> + (!y. y IN interval [x,z] ==> f y <= hi)`));; +refine (by (VALID ((BETA_TAC THEN (move ["u_eq_i"]) THEN (move ["u_eq_j"]) THEN (move ["diff_f"]) THEN (move ["partial_f"]) THEN (move ["f_bound"]) THEN (move ["y"]) THEN (move ["y_in"])))));; +refine (by (VALID ((((THENL_ROT (-1)) (((fun thm_tac -> (USE_THM_THEN EXCLUDED_MIDDLE)(ISPEC_THEN (`j IN 1..dimindex (:N)`) thm_tac))MP_TAC) THEN case)) THEN (((USE_THM_THEN IN_NUMSEG)(new_rewrite [] [])) THEN (move ["j_in"]))))));; +refine (by (VALID (((((USE_THEN "f_bound")MP_TAC) THEN (clear_assumption "f_bound") THEN (DISCH_THEN apply_tac)) THEN (((USE_THEN "y_in")MP_TAC) THEN (clear_assumption "y_in") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL IN_INTERVAL))(new_rewrite [] []))) THEN (move ["y_ineq"]) THEN (move ["i"]) THEN (move ["i_in"]))))));; +refine (by (VALID (((THENL_FIRST) (have_tac (move ["inj"]) (`~(i = j)`)) ((((USE_THEN "i_in")MP_TAC) THEN (clear_assumption "i_in") THEN ((USE_THEN "j_in")MP_TAC) THEN (clear_assumption "j_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID (((((USE_THEN "u_eq_i")(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN IN_NUMSEG)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THEN "y_ineq")(new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN partial_decreasing_left)(ISPEC_THEN (`f o (\p:real^N. x + (z - p))`) thm_tac))(ISPEC_THEN (mk_var("j",mk_type("num",[]))) thm_tac))(ISPEC_THEN (`x + (z - u):real^N`) thm_tac))(ISPEC_THEN (mk_var("x",mk_type("cart",[mk_type("real",[]);mk_vartype "N"]))) thm_tac))(ISPEC_THEN (mk_var("z",mk_type("cart",[mk_type("real",[]);mk_vartype "N"]))) thm_tac))(ISPEC_THEN (mk_var("hi",mk_type("real",[]))) thm_tac)) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID ((ANTS_TAC))));; +refine (by (VALID (((BETA_TAC THEN (move ["i"]) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "u_eq_i")(MATCH_MP_THEN snd_th MP_TAC))) THEN (move ["eq1"]) THEN (move ["inj"])) THEN (((USE_THM_THEN VECTOR_ADD_COMPONENT)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_SUB_COMPONENT)(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THEN "eq1")(new_rewrite [] [])) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((THENL_FIRST) (ANTS_TAC) ((((USE_THM_THEN VECTOR_ADD_COMPONENT)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_SUB_COMPONENT)(new_rewrite [] [])) THEN ((USE_THEN "u_eq_j")(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID ((have_tac (move ["Hp"]) (`!p. p IN interval [x,z] ==> x + (z - p) IN interval [x,z]`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["p"])) THEN (repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL IN_INTERVAL))(new_rewrite [] []))) THEN (move ["p_in"]) THEN (move ["i"]) THEN (move ["ineq"]))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "p_in")(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC) THEN (((USE_THM_THEN VECTOR_ADD_COMPONENT)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_SUB_COMPONENT)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((set_tac "dP" (`!y. _ y`)))));; +refine (by (VALID ((have_tac (move ["P"]) (mk_var("dP",mk_type("bool",[])))))));; +refine (by (VALID ((((USE_THEN "dP_def")(GSYM_THEN (new_rewrite [] []))) THEN (BETA_TAC THEN (move ["p"]) THEN (move ["p_in"]))))));; +refine (by (VALID (((((USE_THM_THEN o_ASSOC)(new_rewrite [] [])) THEN ((USE_THM_THEN DIFFERENTIABLE_CHAIN_AT)(new_rewrite [] [])) THEN ((USE_THM_THEN DIFFERENTIABLE_ADD)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN DIFFERENTIABLE_SUB)(new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((USE_THM_THEN DIFFERENTIABLE_ID)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN DIFFERENTIABLE_CONST)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THEN "diff_f")(new_rewrite [] [])) THEN ((simp_tac THEN TRY done_tac)) THEN ((USE_THEN "Hp")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THEN "P")MP_TAC) THEN (clear_assumption "P") THEN BETA_TAC THEN (simp_tac)) THEN (((USE_THEN "dP_def")(GSYM_THEN (new_rewrite [] []))) THEN (move ["diff"]))))));; +refine (by (VALID ((ANTS_TAC))));; +refine (by (VALID ((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])))));; +refine (by (VALID ((((USE_THM_THEN (VECTOR_ARITH `!x z p. x + z - p = (x + z) - p:real^N`)) MP_TAC) THEN (move ["assoc"])))));; +refine (by (VALID ((((USE_THEN "assoc")(new_rewrite [] [])) THEN ((USE_THM_THEN partial_rev_translation)(new_rewrite [] [])) THEN ((USE_THEN "assoc")(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "diff_f")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "Hp")(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID (((((USE_THM_THEN REAL_NEG_LE0)(new_rewrite [] [])) THEN ((USE_THEN "partial_f")(new_rewrite [] [])) THEN ((USE_THEN "Hp")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((ANTS_TAC))));; +refine (by (VALID (((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])) THEN (((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THEN "f_bound")(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THEN "p_in")MP_TAC) THEN (clear_assumption "p_in") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL IN_INTERVAL))(new_rewrite [] []))) THEN (move ["ineq"]) THEN (move ["i"]) THEN (move ["i_ineq"]))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "ineq")(fun fst_th ->(USE_THEN "i_ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN VECTOR_ADD_COMPONENT)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN VECTOR_SUB_COMPONENT)(new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((((fun thm_tac -> DISCH_THEN (ISPEC_THEN (`x + z - y:real^N`) thm_tac))MP_TAC) THEN BETA_TAC) THEN (((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN (simp_tac))))));; +refine (by (VALID ((((USE_THM_THEN (VECTOR_ARITH `!x z y:real^N. x + z - (x + z - y) = y`))(new_rewrite [] [])) THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID ((((USE_THEN "Hp")(new_rewrite [] [])) THEN (done_tac)))));; +let partial_increasing_right = end_section_proof();; +let partial_increasing_right = finalize_theorem partial_increasing_right;; +let partial_rev_translation = finalize_theorem partial_rev_translation;; +let partial_translation = finalize_theorem partial_translation;; +let partial_decreasing_left = finalize_theorem partial_decreasing_left;; +let partial_increasing_left = finalize_theorem partial_increasing_left;; +let derivative_translation = finalize_theorem derivative_translation;; +(end_section "PartialMonotone");; +(begin_section "Taylor");; +(start_section_proof ["f";"dd_bound"](`nth_diff_strong_int 2 (&0, &1) f ==> + (!t. interval_arith t (&0, &1) ==> abs (nth_derivative 2 f t) <= dd_bound) ==> + abs (f (&1) - (f (&0) + derivative f (&0))) <= dd_bound / &2`));; +refine (by (VALID (((((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_diff_strong2_eq_alt)(new_rewrite [] []))) THEN (move ["df"]) THEN (move ["dd"])))));; +refine (by (VALID ((set_tac "R" (`\i. if i = 0 then f else if i = 1 then derivative f else nth_derivative 2 f`)))));; +refine (by (VALID ((((USE_THM_THEN (ARITH_RULE `0 + 1 = 1 /\ ~(1 = 0) /\ 1 + 1 = 2 /\ ~(2 = 1) /\ ~(2 = 0)`)) MP_TAC) THEN (move ["arithH"])))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN REAL_TAYLOR)(ISPEC_THEN (mk_var("R",mk_type("fun",[mk_type("num",[]);mk_type("fun",[mk_type("real",[]);mk_type("real",[])])]))) thm_tac))(ISPEC_THEN (`1`) thm_tac))(ISPEC_THEN (`real_interval [&0, &1]`) thm_tac))(ISPEC_THEN (mk_var("dd_bound",mk_type("real",[]))) thm_tac))MP_TAC) THEN BETA_TAC) THEN (ANTS_TAC)))));; +refine (by (VALID (((((USE_THM_THEN IS_REALINTERVAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (split_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["i"]) THEN (move ["x"])) THEN (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN interval_arith)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN (ARITH_RULE `i <= 1 <=> i = 0 \/ i = 1`))(new_rewrite [] [])))))));; +refine (by (VALID ((BETA_TAC THEN (case THEN ALL_TAC) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "df")(MATCH_MP_THEN snd_th MP_TAC))) THEN (case THEN (move ["s"])) THEN (move ["d_f"])))));; +refine (by (VALID (((case THEN (DISCH_THEN(new_rewrite [] []))) THEN (((USE_THEN "R_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac) THEN repeat_tactic 1 9 (((USE_THEN "arithH")(new_rewrite [] []))) THEN (simp_tac)) THEN ((USE_THM_THEN HAS_REAL_DERIVATIVE_ATREAL_WITHIN) apply_tac) THEN ((USE_THEN "d_f")(new_rewrite [] [])) THEN (done_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["x"])) THEN ((((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN interval_arith)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "arithH")(new_rewrite [] []))) THEN (move ["ineq"]))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "df")(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (move ["d_f"])) THEN (((USE_THEN "R_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac) THEN repeat_tactic 1 9 (((USE_THEN "arithH")(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THEN "dd")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> DISCH_THEN (ISPEC_THEN (`&0`) thm_tac))(ISPEC_THEN (`&1`) thm_tac))MP_TAC) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_LE_01)(new_rewrite [] [])) THEN (simp_tac))))));; +refine (by (VALID ((((USE_THM_THEN REAL_SUB_RZERO)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_ABS_1)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_POW_ONE)(new_rewrite [] []))) THEN ((USE_THM_THEN (ARITH_RULE `FACT (1 + 1) = 2`))(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN real_div)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_MUL_LID)(new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN ONE)(new_rewrite [2] [])) THEN ((USE_THM_THEN (GEN_ALL SUM_CLAUSES_NUMSEG))(new_rewrite [] [])) THEN ((USE_THM_THEN SUM_SING_NUMSEG)(new_rewrite [] [])) THEN ((USE_THM_THEN ONE)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN (ARITH_RULE `0 <= 1`))(new_rewrite [] [])) THEN (simp_tac)))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN (ARITH_RULE `FACT 0 = 1 /\ FACT 1 = 1`))(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_INV_1)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_MUL_RID)(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THEN "R_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac) THEN repeat_tactic 1 9 (((USE_THEN "arithH")(new_rewrite [] [])))) THEN (done_tac)))));; +let real_taylor2_bound = end_section_proof();; +(start_section_proof ["f";"d_bound"](`(!t. interval_arith t (&0, &1) ==> f real_differentiable atreal t /\ + abs (derivative f t) <= d_bound) ==> + abs (f (&1) - f (&0)) <= d_bound`));; +refine (by (VALID ((BETA_TAC THEN (move ["df"])))));; +refine (by (VALID ((set_tac "R" (`\i. if i = 0 then f else derivative f`)))));; +refine (by (VALID ((((USE_THM_THEN (ARITH_RULE `0 + 1 = 1 /\ ~(1 = 0)`)) MP_TAC) THEN (move ["arithH"])))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN REAL_TAYLOR)(ISPEC_THEN (mk_var("R",mk_type("fun",[mk_type("num",[]);mk_type("fun",[mk_type("real",[]);mk_type("real",[])])]))) thm_tac))(ISPEC_THEN (`0`) thm_tac))(ISPEC_THEN (`real_interval [&0, &1]`) thm_tac))(ISPEC_THEN (mk_var("d_bound",mk_type("real",[]))) thm_tac))MP_TAC) THEN BETA_TAC) THEN (ANTS_TAC)))));; +refine (by (VALID (((((USE_THM_THEN IS_REALINTERVAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (split_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["i"]) THEN (move ["x"])) THEN (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN interval_arith)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN leqn0)(new_rewrite [] [])))))));; +refine (by (VALID ((BETA_TAC THEN (case THEN ALL_TAC) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "df")(MATCH_MP_THEN snd_th MP_TAC))) THEN (case THEN ((move ["diff_f"]) THEN (move ["df_bound"]))) THEN (DISCH_THEN(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THEN "R_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac) THEN repeat_tactic 1 9 (((USE_THEN "arithH")(new_rewrite [] []))) THEN (simp_tac)) THEN ((USE_THM_THEN HAS_REAL_DERIVATIVE_ATREAL_WITHIN) apply_tac) THEN ((USE_THM_THEN has_derivative_alt)(new_rewrite [] [])) THEN (done_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["x"])) THEN ((((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN interval_arith)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "arithH")(new_rewrite [] []))) THEN (move ["ineq"]))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "df")(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (move ["d_f"])) THEN (((USE_THEN "R_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac) THEN repeat_tactic 1 9 (((USE_THEN "arithH")(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THEN "df")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> DISCH_THEN (ISPEC_THEN (`&0`) thm_tac))(ISPEC_THEN (`&1`) thm_tac))MP_TAC) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_LE_01)(new_rewrite [] [])) THEN (simp_tac))))));; +refine (by (VALID ((((USE_THM_THEN SUM_SING_NUMSEG)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN REAL_SUB_RZERO)(new_rewrite [] [])) THEN ((USE_THEN "arithH")(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_ABS_1)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_POW_ONE)(new_rewrite [] [])))))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN (ARITH_RULE `FACT 1 = 1 /\ FACT 0 = 1`))(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_DIV_1)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_MUL_RID)(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THEN "R_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac) THEN repeat_tactic 1 9 (((USE_THEN "arithH")(new_rewrite [] [])))) THEN (done_tac)))));; +let real_taylor1_bound = end_section_proof();; +let m_taylor_error = new_definition `m_taylor_error f domain (w:real^N) error <=> + !x:real^N. x IN interval [domain] ==> sum (1..dimindex (:N)) (\i. w$i * sum (1..dimindex (:N)) + (\j. w$j * abs (partial j (partial i f) x))) <= error`;; +let m_taylor_partial_error = new_definition `m_taylor_partial_error f i domain (w:real^N) error <=> + (!x:real^N. x IN interval[domain] ==> + sum (1..dimindex (:N)) (\j. w$j * abs (partial j (partial i f) x)) <= error)`;; +(start_section_proof ["f";"domain";"w";"p_error";"error"](`(!i. i IN 1..dimindex (:N) ==> m_taylor_partial_error f i domain w (p_error i) /\ &0 <= w$i) ==> + sum (1..dimindex (:N)) (\i. w$i * p_error i) <= error ==> + m_taylor_error f domain (w:real^N) error`));; +refine (by (VALID (((((USE_THM_THEN m_taylor_partial_error)(new_rewrite [] [])) THEN ((USE_THM_THEN m_taylor_error)(new_rewrite [] []))) THEN (move ["partialH"]) THEN (move ["ineq"]) THEN (move ["p"]) THEN (move ["p_in"])))));; +refine (by (VALID ((((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN ((USE_THM_THEN (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))MP_TAC) THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID ((((USE_THM_THEN SUM_LE) apply_tac) THEN ((((USE_THM_THEN FINITE_NUMSEG)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac))))));; +refine (by (VALID (((((USE_THM_THEN REAL_LE_LMUL)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((fun thm_tac -> (USE_THEN "partialH")(fun fst_th ->(USE_THEN "i_ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])))) THEN (done_tac)))));; +let taylor_error_eq_sum_partial_errors = end_section_proof();; +let partial2 = new_definition `partial2 j i f = partial j (partial i f)`;; +let diff2 = new_definition `diff2 f x <=> + ?s. open s /\ x IN s /\ (!y. y IN s ==> (lift o f) differentiable at y /\ + (!i. (lift o partial i f) differentiable at y))`;; +let diff2c = new_definition `diff2c f x <=> diff2 f x /\ + (!i j. (lift o partial2 j i f) continuous at x)`;; +(start_section_proof ["f";"x"](`diff2c f x ==> diff2 f x`));; +refine (by (VALID (((((USE_THM_THEN diff2c)(new_rewrite [] [])) THEN (simp_tac)) THEN (done_tac)))));; +let diff2c_imp_diff2 = end_section_proof();; +(start_section_proof ["f";"x"](`diff2 f x <=> + ?s. open s /\ x IN s /\ (!y. y IN s ==> diff2 f y)`));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN diff2)(new_rewrite [] []))) THEN ((split_tac) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]))))));; +refine (by (VALID (((exists_tac (mk_var("s",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "?1454959"]);mk_type("bool",[])])))) THEN ((((USE_THEN "open_s")(new_rewrite [1] [])) THEN ((USE_THEN "xs")(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["y"]) THEN (move ["ys"])) THEN (exists_tac (mk_var("s",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "?1454959"]);mk_type("bool",[])])))) THEN (done_tac)))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "df")(fun fst_th ->(USE_THEN "xs")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["df2"])) THEN (((USE_THEN "df")MP_TAC) THEN (clear_assumption "df") THEN BETA_TAC THEN (move ["_"]))))));; +refine (by (VALID (((exists_tac (mk_var("t",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "?1454959"]);mk_type("bool",[])])))) THEN (done_tac)))));; +let diff2_eq_diff2_on_open = end_section_proof();; +(start_section_proof ["f";"x";"e";"t"](`diff2 f (x + t % e) ==> + f o (\t. x + t % e) real_differentiable atreal t`));; +refine (by (VALID ((((USE_THM_THEN diff2)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])))));; +refine (by (VALID ((((USE_THM_THEN diff_imp_real_diff) apply_tac) THEN ((simp_tac) THEN ((USE_THEN "df")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN diff_direction)(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_imp_real_diff = end_section_proof();; +(start_section_proof ["f";"x";"e";"t"](`diff2 f (x + t % e:real^N) ==> + derivative (f o (\t. x + t % e)) t = + sum (1..dimindex (:N)) (\i. e$i * (partial i f o (\t. x + t % e)) t)`));; +refine (by (VALID ((((USE_THM_THEN diff2)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])))));; +refine (by (VALID (((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((USE_THM_THEN real_dir_derivative_partial)(new_rewrite [] [])) THEN ((USE_THEN "df")(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_dir_derivative = end_section_proof();; +(start_section_proof ["f";"i";"x";"e";"t"](`diff2 f (x + t % e:real^N) ==> + partial i f o (\t. x + t % e) real_differentiable atreal t`));; +refine (by (VALID ((((USE_THM_THEN diff2)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])))));; +refine (by (VALID (((((USE_THM_THEN diff_imp_real_diff)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THEN "df")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN diff_direction)(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_partial_real_diff = end_section_proof();; +(start_section_proof ["x";"s";"t"](`t SUBSET s ==> x IN t ==> x IN s`));; +refine (by (VALID ((((USE_THM_THEN SUBSET)(new_rewrite [] [])) THEN (move ["sub"]) THEN (move ["xt"])))));; +refine (by (VALID ((((USE_THEN "sub")MP_TAC) THEN (clear_assumption "sub") THEN (exact_tac)))));; +let in_trans = end_section_proof();; +(start_section_proof ["e";"s";"x"](`open s ==> x IN s ==> + ?a b. &0 IN real_interval (a, b) /\ IMAGE (\t. x + t % e) (real_interval (a, b)) SUBSET s`));; +refine (by (VALID ((((USE_THM_THEN OPEN_CONTAINS_BALL)(new_rewrite [] [])) THEN (move ["open_s"])))));; +refine (by (VALID ((((DISCH_THEN (fun snd_th -> (USE_THEN "open_s")(MATCH_MP_THEN snd_th MP_TAC))) THEN BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["ball_s"])) THEN (((USE_THEN "open_s")MP_TAC) THEN (clear_assumption "open_s") THEN BETA_TAC THEN (move ["_"]))))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN EXCLUDED_MIDDLE)(ISPEC_THEN (`norm e = &0`) thm_tac))MP_TAC) THEN case THENL [ALL_TAC; (move ["n0"])]))));; +refine (by (VALID (((((USE_THM_THEN NORM_EQ_0)(new_rewrite [] [])) THEN (DISCH_THEN(new_rewrite [] []))) THEN ((exists_tac (`--d`)) THEN (exists_tac (mk_var("d",mk_type("real",[])))))))));; +refine (by (VALID (((THENL_FIRST) (split_tac) (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])) THEN (((USE_THEN "d0")MP_TAC) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID ((((((USE_THM_THEN SUBSET)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_IMAGE)(new_rewrite [] []))) THEN (move ["y"]) THEN (case THEN (move ["t"])) THEN (DISCH_THEN(new_rewrite [] [])) THEN (simp_tac)) THEN (((USE_THM_THEN (GEN_ALL VECTOR_MUL_RZERO))(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_ADD_RID)(new_rewrite [] [])))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THM_THEN in_trans)(fun fst_th ->(USE_THEN "ball_s")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN ((USE_THM_THEN CENTRE_IN_BALL)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((set_tac "y" (`((d / &2) * inv(norm e)) % e`)))));; +refine (by (VALID ((have_tac (move ["norm_y"]) (`norm y = d / &2`)))));; +refine (by (VALID ((((USE_THEN "y_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN VECTOR_MUL_ASSOC)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN NORM_MUL)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_ABS_INV)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_ABS_NORM)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_LINV)(new_rewrite [] [])) THEN ((TRY done_tac))))));; +refine (by (VALID (((((USE_THEN "d0")MP_TAC) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((((exists_tac (`-- (d / &2 * inv (norm e))`)) THEN (exists_tac (`d / &2 * inv (norm e)`))) THEN (split_tac)))));; +refine (by (VALID ((((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_NEG_LT0)(new_rewrite [] [])) THEN ((USE_THM_THEN andbb)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LT_MUL)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LT_INV)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN NORM_POS_LT)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN NORM_EQ_0)(GSYM_THEN (new_rewrite [] [])))) THEN ((TRY done_tac))))));; +refine (by (VALID (((((USE_THEN "d0")MP_TAC) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN SUBSET_TRANS) apply_tac) THEN (exists_tac (`ball (x, d)`)) THEN ((((USE_THEN "ball_s")(new_rewrite [] [])) THEN ((USE_THM_THEN andbT)(new_rewrite [] [])) THEN ((USE_THM_THEN SUBSET)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_IMAGE)(new_rewrite [] []))) THEN (move ["p"]) THEN (case THEN (move ["t"])) THEN (case THEN (DISCH_THEN(new_rewrite [] []))) THEN (move ["t_in"]) THEN (simp_tac))))));; +refine (by (VALID ((((USE_THM_THEN IN_BALL)(new_rewrite [] [])) THEN ((USE_THM_THEN dist)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_SUB_RADD)(new_rewrite [] [])) THEN ((USE_THM_THEN NORM_NEG)(new_rewrite [] [])) THEN ((USE_THM_THEN NORM_MUL)(new_rewrite [] []))))));; +refine (by (VALID (((THENL_LAST) ((((USE_THM_THEN REAL_LET_TRANS)MP_TAC) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (`d / &2`)) THEN (split_tac)) ((((USE_THEN "d0")MP_TAC) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN REAL_MUL_RID)(ISPEC_THEN (`d / &2`) thm_tac))(GSYM_THEN (new_rewrite [] []))) THEN ((fun thm_tac -> (USE_THM_THEN REAL_MUL_LINV)(fun fst_th ->(USE_THEN "n0")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_MUL_ASSOC)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_RMUL)(new_rewrite [] [])) THEN ((USE_THM_THEN NORM_POS_LE)(new_rewrite [] [])) THEN ((USE_THM_THEN andbT)(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THEN "t_in")MP_TAC) THEN (clear_assumption "t_in") THEN BETA_TAC) THEN ((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])) THEN (arith_tac) THEN (done_tac)))));; +let open_contains_open_interval = end_section_proof();; +(start_section_proof ["f";"x";"e";"t"](`diff2 f (x + t % e:real^N) ==> + nth_diff_strong 2 (f o (\t. x + t % e)) t`));; +refine (by (VALID (((((USE_THM_THEN diff2_eq_diff2_on_open)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_diff_strong2_eq)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN open_contains_open_interval)(ISPEC_THEN (mk_var("e",mk_type("cart",[mk_type("real",[]);mk_vartype "N"]))) thm_tac))(fun fst_th ->(USE_THEN "open_s")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "xs")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN (move ["in0"])) THEN (move ["sub"])))));; +refine (by (VALID (((exists_tac (`real_interval (a + t, b + t)`)) THEN (((USE_THM_THEN REAL_OPEN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (split_tac)))));; +refine (by (VALID (((((USE_THEN "in0")MP_TAC) THEN (clear_assumption "in0") THEN BETA_TAC) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((BETA_TAC THEN (move ["p"]) THEN (move ["p_int"])))));; +refine (by (VALID ((have_tac (move ["xp_in"]) (`x + p % e IN s`)))));; +refine (by (VALID (((((USE_THEN "sub")MP_TAC) THEN (clear_assumption "sub") THEN BETA_TAC) THEN ((USE_THM_THEN SUBSET)(new_rewrite [] [])) THEN (DISCH_THEN apply_tac) THEN (((USE_THM_THEN IN_IMAGE)(new_rewrite [] [])) THEN (simp_tac)) THEN (exists_tac (`p - t`))))));; +refine (by (VALID (((split_tac) THENL [(VECTOR_ARITH_TAC); ((((USE_THEN "p_int")MP_TAC) THEN (clear_assumption "p_int") THEN BETA_TAC) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN (arith_tac))] THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN diff2_imp_real_diff)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))))));; +refine (by (VALID (((USE_THM_THEN differentiable_local) apply_tac))));; +refine (by (VALID ((exists_tac (`\t. sum (1..dimindex(:N)) (\i. e$i * (partial i f o (\t. x + t % e)) t)`)))));; +refine (by (VALID ((set_tac "d" (`min (p - (a + t)) (b + t - p)`)))));; +refine (by (VALID (((THENL_FIRST) (have_tac (move ["d0"]) (`&0 < d`)) ((((USE_THEN "p_int")MP_TAC) THEN (clear_assumption "p_int") THEN BETA_TAC) THEN (((USE_THEN "d_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID (((exists_tac (`real_interval (p - d, p + d)`)) THEN (split_tac)))));; +refine (by (VALID ((((USE_THM_THEN differentiable_sum_numseg)(new_rewrite [] [])) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac)))));; +refine (by (VALID (((((USE_THM_THEN REAL_DIFFERENTIABLE_MUL_ATREAL)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_DIFFERENTIABLE_CONST)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))))));; +refine (by (VALID (((((USE_THM_THEN diff2_partial_real_diff)(new_rewrite [] [])) THEN ((USE_THEN "df")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN REAL_OPEN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (split_tac)))));; +refine (by (VALID ((((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])) THEN (((USE_THEN "d0")MP_TAC) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["y"]) THEN (move ["y_in"])) THEN (((USE_THM_THEN diff2_dir_derivative)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "df")(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THEN "sub")MP_TAC) THEN (clear_assumption "sub") THEN BETA_TAC) THEN ((USE_THM_THEN SUBSET)(new_rewrite [] [])) THEN (DISCH_THEN apply_tac) THEN (((USE_THM_THEN IN_IMAGE)(new_rewrite [] [])) THEN (simp_tac)) THEN (exists_tac (`y - t`))))));; +refine (by (VALID (((THENL_FIRST) (split_tac) ((VECTOR_ARITH_TAC) THEN (done_tac))))));; +refine (by (VALID (((((USE_THEN "p_int")MP_TAC) THEN (clear_assumption "p_int") THEN ((USE_THEN "d_def")MP_TAC) THEN (clear_assumption "d_def") THEN ((USE_THEN "y_in")MP_TAC) THEN (clear_assumption "y_in") THEN BETA_TAC) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +let diff2_dir = end_section_proof();; +(start_section_proof ["f";"x";"e";"t"](`diff2 f (x + t % e:real^N) ==> + nth_derivative 2 (f o (\t. x + t % e)) t = + sum (1..dimindex (:N)) (\i. sum (1..dimindex (:N)) + (\j. e$i * e$j * (partial j (partial i f) o (\t. x + t % e)) t))`));; +refine (by (VALID ((((USE_THM_THEN diff2_eq_diff2_on_open)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])))));; +refine (by (VALID ((((USE_THM_THEN nth_derivative2)(new_rewrite [] [])) THEN (((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID ((((USE_THM_THEN Arc_properties.HAS_REAL_DERIVATIVE_LOCAL)MP_TAC) THEN (clear_assumption "Arc_properties.HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID (((exists_tac (`\t. sum (1..dimindex(:N)) (\i. e$i * (partial i f o (\t. x + t % e)) t)`)) THEN (split_tac)))));; +refine (by (VALID ((((USE_THM_THEN HAS_REAL_DERIVATIVE_SUM) apply_tac) THEN ((((USE_THM_THEN FINITE_NUMSEG)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["i"]) THEN (move ["ineq"]) THEN (simp_tac))))));; +refine (by (VALID (((((USE_THM_THEN SUM_LMUL)(new_rewrite [] [])) THEN ((USE_THM_THEN HAS_REAL_DERIVATIVE_LMUL_ATREAL)(new_rewrite [] []))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))))));; +refine (by (VALID (((USE_THM_THEN real_dir_derivative_partial)(new_rewrite [] [])))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "df")(fun fst_th ->(USE_THEN "xs")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC) THEN (((USE_THM_THEN diff2)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["r"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xr"])) THEN (DISCH_THEN(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN open_contains_open_interval)(ISPEC_THEN (mk_var("e",mk_type("cart",[mk_type("real",[]);mk_vartype "N"]))) thm_tac))(fun fst_th ->(USE_THEN "open_s")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "xs")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN (move ["in0"])) THEN (move ["sub"])))));; +refine (by (VALID (((exists_tac (`real_interval (a + t, b + t)`)) THEN (((USE_THM_THEN REAL_OPEN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (split_tac)))));; +refine (by (VALID (((((USE_THEN "in0")MP_TAC) THEN (clear_assumption "in0") THEN BETA_TAC) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])) THEN (((USE_THM_THEN diff2_dir_derivative)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "df")(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THEN "sub")MP_TAC) THEN (clear_assumption "sub") THEN BETA_TAC) THEN ((USE_THM_THEN SUBSET)(new_rewrite [] [])) THEN (DISCH_THEN apply_tac) THEN (((USE_THM_THEN IN_IMAGE)(new_rewrite [] [])) THEN (simp_tac)) THEN (exists_tac (`p - t`))))));; +refine (by (VALID (((THENL_FIRST) (split_tac) ((VECTOR_ARITH_TAC) THEN (done_tac))))));; +refine (by (VALID (((((USE_THEN "p_in")MP_TAC) THEN (clear_assumption "p_in") THEN BETA_TAC) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +let diff2_dir_derivative2 = end_section_proof();; +(start_section_proof ["f";"i";"x";"e";"t"](`diff2 f (x + t % e:real^N) ==> + (partial i f o (\t. x + t % e) has_real_derivative + sum (1..dimindex (:N)) (\j. e$j * (partial j (partial i f) o (\t. x + t % e)) t)) (atreal t)`));; +refine (by (VALID ((((USE_THM_THEN diff2)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])))));; +refine (by (VALID (((((USE_THM_THEN real_dir_derivative_partial)(new_rewrite [] [])) THEN ((USE_THEN "df")(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_has_derivative_partial = end_section_proof();; +(start_section_proof ["f";"i";"x";"e";"t"](`diff2 f (x + t % e:real^N) ==> + derivative (partial i f o (\t. x + t % e)) t = + sum (1..dimindex (:N)) (\j. e$j * (partial j (partial i f) o (\t. x + t % e)) t)`));; +refine (by (VALID (((BETA_TAC THEN (move ["df"])) THEN (((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((USE_THM_THEN diff2_has_derivative_partial)MP_TAC) THEN (clear_assumption "diff2_has_derivative_partial") THEN (exact_tac)) THEN (done_tac)))));; +let diff2_derivative_partial = end_section_proof();; +(start_section_proof ["f";"i";"x";"e";"t"](`diff2 f (x + t % e:real^N) ==> + partial i f o (\t. x + t % e) real_differentiable atreal t`));; +refine (by (VALID ((BETA_TAC THEN (move ["df2"])))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN diff2_has_derivative_partial)(fun fst_th ->(USE_THEN "df2")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(ISPEC_THEN (mk_var("i",mk_type("num",[]))) thm_tac))MP_TAC) THEN BETA_TAC) THEN (set_tac "s" (`sum _1 _2`))))));; +refine (by (VALID (((((USE_THM_THEN real_differentiable)(new_rewrite [] [])) THEN (move ["df"])) THEN (exists_tac (mk_var("s",mk_type("real",[])))) THEN (done_tac)))));; +let diff2_real_diff_partial = end_section_proof();; +(start_section_proof ["i";"c"](`partial i (\x:real^N. c) = (\x. &0)`));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN partial)(new_rewrite [] []))) THEN (move ["x"]) THEN (simp_tac)))));; +refine (by (VALID ((((THENL_ROT 1)) (have_tac (DISCH_THEN(new_rewrite [] [])) (`(\x. c) o (\t. x + t % basis i) = (\x. c)`))))));; +refine (by (VALID ((((USE_THM_THEN derivative_const)(new_rewrite [] [])) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (done_tac)))));; +let partial_const = end_section_proof();; +(start_section_proof ["i";"f"](`~(i IN 1..dimindex (:N)) ==> partial i f = (\x:real^N. &0)`));; +refine (by (VALID (((BETA_TAC THEN (move ["ih"])) THEN (((USE_THM_THEN FUN_EQ_THM)(new_rewrite [] [])) THEN (move ["x"])) THEN ((USE_THM_THEN partial_eq0)(new_rewrite [] [])) THEN (done_tac)))));; +let partial_eq0_alt = end_section_proof();; +(start_section_proof [](`!f f' a. (!x. abs x <= abs a ==> (f has_real_derivative f' x) (atreal x)) ==> + (?t. abs t <= abs a /\ f a - f (&0) = f' t * a)`));; +refine (by (VALID ((BETA_TAC THEN (move ["f"]) THEN (move ["f'"]) THEN (move ["a"]) THEN (move ["h"])))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN EXCLUDED_MIDDLE)(ISPEC_THEN (`&0 <= a`) thm_tac))MP_TAC) THEN case THEN (move ["a_ineq"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN REAL_MVT_VERY_SIMPLE)(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (mk_var("f'",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (`&0`) thm_tac))(ISPEC_THEN (mk_var("a",mk_type("real",[]))) thm_tac)) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID (((((USE_THEN "a_ineq")(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])))) THEN (ANTS_TAC)))));; +refine (by (VALID ((BETA_TAC THEN (move ["x"]) THEN (move ["x_ineq"])))));; +refine (by (VALID (((((USE_THM_THEN HAS_REAL_DERIVATIVE_ATREAL_WITHIN)(new_rewrite [] [])) THEN ((USE_THEN "h")(new_rewrite [] []))) THEN (((USE_THEN "x_ineq")MP_TAC) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["t_ineq"])) THEN (move ["eq"])))));; +refine (by (VALID (((exists_tac (mk_var("t",mk_type("real",[])))) THEN ((USE_THEN "eq")(new_rewrite [] [])) THEN (((USE_THEN "t_ineq")MP_TAC) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN REAL_MVT_VERY_SIMPLE)(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (mk_var("f'",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (mk_var("a",mk_type("real",[]))) thm_tac))(ISPEC_THEN (`&0`) thm_tac)) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN (ANTS_TAC)))));; +refine (by (VALID (((THENL_FIRST) (split_tac) ((((USE_THEN "a_ineq")MP_TAC) THEN (clear_assumption "a_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID (((BETA_TAC THEN (move ["x"]) THEN (move ["x_ineq"])) THEN (((USE_THM_THEN HAS_REAL_DERIVATIVE_ATREAL_WITHIN)(new_rewrite [] [])) THEN ((USE_THEN "h")(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THEN "x_ineq")MP_TAC) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["t_ineq"])) THEN (move ["eq"])))));; +refine (by (VALID (((exists_tac (mk_var("t",mk_type("real",[])))) THEN (((USE_THM_THEN REAL_NEG_SUB)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "eq")(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_NEG_RMUL)(new_rewrite [] []))) THEN (((USE_THEN "t_ineq")MP_TAC) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +let real_mvt0 = end_section_proof();; +(start_section_proof ["f";"x";"i";"j"](`diff2c f x ==> partial2 i j f x = partial2 j i f (x:real^N)`));; +refine (by (VALID (((((USE_THM_THEN diff2c)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN partial2)(new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["d2f"]) THEN (move ["pc"])))))));; +refine (by (VALID (((THENL_ROT (-1)) (((fun thm_tac -> (USE_THM_THEN EXCLUDED_MIDDLE)(ISPEC_THEN (`i IN 1..dimindex (:N)`) thm_tac))MP_TAC) THEN case THEN (move ["ih"]))))));; +refine (by (VALID (((repeat_tactic 1 9 (((fun thm_tac -> (USE_THM_THEN partial_eq0_alt)(ISPEC_THEN (mk_var("i",mk_type("num",[]))) thm_tac))(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN partial_const)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((THENL_ROT (-1)) (((fun thm_tac -> (USE_THM_THEN EXCLUDED_MIDDLE)(ISPEC_THEN (`j IN 1..dimindex (:N)`) thm_tac))MP_TAC) THEN case THEN (move ["jh"]))))));; +refine (by (VALID (((repeat_tactic 1 9 (((fun thm_tac -> (USE_THM_THEN partial_eq0_alt)(ISPEC_THEN (mk_var("j",mk_type("num",[]))) thm_tac))(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN partial_const)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THEN "jh")MP_TAC) THEN (clear_assumption "jh") THEN ((USE_THEN "ih")MP_TAC) THEN (clear_assumption "ih") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN IN_NUMSEG)(new_rewrite [] []))) THEN (move ["ih"]) THEN (move ["jh"]))))));; +refine (by (VALID (((((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((USE_THM_THEN diff2_eq_diff2_on_open)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["d2f"]))))));; +refine (by (VALID ((set_tac "F1" (`\h k. f ((x + k % basis j) + h % basis i) - f (x + k % basis j)`)))));; +refine (by (VALID ((set_tac "F2" (`\k h. f ((x + h % basis i) + k % basis j) - f (x + h % basis i)`)))));; +refine (by (VALID ((set_tac "G" (`\h k. F1 h k - F1 h (&0)`)))));; +refine (by (VALID (((THENL_FIRST) (have_tac (move ["v_eq"]) (`!h k. (x + k % basis j) + h % basis i = (x + h % basis i) + k % basis j`)) ((VECTOR_ARITH_TAC) THEN (done_tac))))));; +refine (by (VALID ((have_tac (move ["G_eq"]) (`G = \h k. F2 k h - F2 k (&0)`)))));; +refine (by (VALID ((repeat_tactic 2 0 (((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] [])))) THEN (move ["h"]) THEN (move ["k"])))));; +refine (by (VALID (((((USE_THEN "G_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "F2_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "F1_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac) THEN repeat_tactic 1 9 (((USE_THM_THEN VECTOR_MUL_LZERO)(new_rewrite [] []))) THEN ((USE_THM_THEN VECTOR_ADD_RID)(new_rewrite [] [])) THEN ((USE_THEN "v_eq")(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((have_tac (ALL_TAC THEN (case THEN ((move ["r"]) THEN (case THEN ((move ["r0"]) THEN (move ["rs"])))))) (`?r. &0 < r /\ (!h k. abs h <= r /\ abs k <= r ==> (x + h % basis i) + k % basis j IN s)`)))));; +refine (by (VALID (((((USE_THEN "open_s")MP_TAC) THEN (clear_assumption "open_s") THEN BETA_TAC) THEN ((((USE_THM_THEN OPEN_CONTAINS_BALL)(new_rewrite [] [])) THEN ((USE_THM_THEN SUBSET)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_BALL)(new_rewrite [] [])) THEN ((USE_THM_THEN dist)(new_rewrite [] []))) THEN ((fun thm_tac -> DISCH_THEN (fun fst_th ->(USE_THEN "xs")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN (case THEN (move ["e"])) THEN (case THEN ((move ["e0"]) THEN (move ["de"]))))))));; +refine (by (VALID (((THENL_FIRST) ((exists_tac (`e / &3`)) THEN (split_tac)) ((((USE_THEN "e0")MP_TAC) THEN (clear_assumption "e0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID ((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])))));; +refine (by (VALID ((((USE_THEN "de")(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL VECTOR_ADD_ASSOC))(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN VECTOR_SUB_RADD)(new_rewrite [] [])) THEN ((USE_THM_THEN NORM_NEG)(new_rewrite [] []))))));; +refine (by (VALID (((THENL_LAST) ((((USE_THM_THEN REAL_LET_TRANS)MP_TAC) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (`e / &3 + e / &3`)) THEN (split_tac)) ((((USE_THEN "e0")MP_TAC) THEN (clear_assumption "e0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID (((THENL_LAST) ((((USE_THM_THEN REAL_LE_TRANS)MP_TAC) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (`abs h + abs k`)) THEN (split_tac)) ((((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN NORM_TRIANGLE)(ISPEC_THEN (`h % basis i:real^N`) thm_tac))(ISPEC_THEN (`k % basis j:real^N`) thm_tac)) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN NORM_MUL)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN NORM_BASIS)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_MUL_RID)(new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["in_s"]) (`(!h. abs h <= r ==> x + h % basis i IN s) /\ (!k. abs k <= r ==> x + k % basis j IN s)`)))));; +refine (by (VALID (((split_tac) THENL [((move ["h"]) THEN (move ["h_ineq"])); ((move ["k"]) THEN (move ["k_ineq"]))]))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (USE_THEN "rs")(ISPEC_THEN (mk_var("h",mk_type("real",[]))) thm_tac))(ISPEC_THEN (`&0`) thm_tac))MP_TAC) THEN BETA_TAC) THEN ((((USE_THM_THEN VECTOR_MUL_LZERO)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_ADD_RID)(new_rewrite [] [])) THEN ((USE_THEN "h_ineq")(new_rewrite [] []))) THEN (DISCH_THEN(new_rewrite [] []))) THEN (((USE_THEN "r0")MP_TAC) THEN (clear_assumption "r0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (USE_THEN "rs")(ISPEC_THEN (`&0`) thm_tac))(ISPEC_THEN (mk_var("k",mk_type("real",[]))) thm_tac))MP_TAC) THEN BETA_TAC) THEN ((((USE_THM_THEN VECTOR_MUL_LZERO)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_ADD_RID)(new_rewrite [] [])) THEN ((USE_THEN "k_ineq")(new_rewrite [] []))) THEN (DISCH_THEN(new_rewrite [] []))) THEN (((USE_THEN "r0")MP_TAC) THEN (clear_assumption "r0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["F1h"]) (`!h. F1 h = (\k. (f o (\k. (x + h % basis i) + k % basis j)) k - (f o (\k. x + k % basis j)) k)`)))));; +refine (by (VALID (((((USE_THEN "F1_def")(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THEN "v_eq")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["dF1"]) (`!h. abs h <= r ==> !k. abs k <= r ==> (F1 h) real_differentiable atreal k`)))));; +refine (by (VALID ((BETA_TAC THEN (move ["h"]) THEN (move ["h_ineq"]) THEN (move ["k"]) THEN (move ["k_ineq"])))));; +refine (by (VALID (((((USE_THEN "F1h")(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_DIFFERENTIABLE_SUB)(new_rewrite [] []))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN diff2_imp_real_diff)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "d2f")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "rs")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "in_s")(new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["F1_der"]) (`!h k. abs h <= r /\ abs k <= r ==> + derivative (F1 h) k = partial j f ((x + h % basis i) + k % basis j) - partial j f (x + k % basis j)`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])) THEN (((USE_THEN "F1h")(new_rewrite [] [])) THEN ((USE_THM_THEN derivative_sub)(new_rewrite [] []))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (repeat_tactic 0 10 (((USE_THM_THEN diff2_imp_real_diff)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "d2f")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "rs")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "in_s")(new_rewrite [] []))) THEN ((TRY done_tac)))))));; +refine (by (VALID (((((USE_THM_THEN derivative_translation)(new_rewrite [] [(`derivative (f o (\k. x + k % basis j)) k`)])) THEN repeat_tactic 0 1 (((USE_THM_THEN derivative_translation)(new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((USE_THM_THEN diff2_imp_real_diff)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "d2f")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "rs")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "in_s")(new_rewrite [] []))) THEN ((TRY done_tac)))))));; +refine (by (VALID ((have_tac (move ["eq"]) (`!y e. (f o (\k. y + k % e)) o (\t. k + t) = f o (\t. (y + k % e) + t % e)`)))));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN (GEN_ALL VECTOR_ADD_RDISTRIB))(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL VECTOR_ADD_ASSOC))(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THEN "eq")(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN partial)(GSYM_THEN (new_rewrite [] []))))) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["Gh"]) (`!h k. abs h <= r /\ abs k <= r ==> + (?t1. G h k = k * derivative (F1 h) t1 /\ abs t1 <= abs k)`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])) THEN (((USE_THEN "G_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac))))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN real_mvt0)(ISPEC_THEN (`F1 h`) thm_tac))(ISPEC_THEN (`derivative (F1 h)`) thm_tac))(ISPEC_THEN (mk_var("k",mk_type("real",[]))) thm_tac)) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID ((ANTS_TAC))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN (((USE_THM_THEN has_derivative_alt)(new_rewrite [] [])) THEN ((USE_THEN "dF1")(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THEN "t_ineq")MP_TAC) THEN (clear_assumption "t_ineq") THEN ((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["t1"])) THEN (case THEN (move ["t1_ineq"])) THEN (move ["eq"])))));; +refine (by (VALID (((exists_tac (mk_var("t1",mk_type("real",[])))) THEN ((USE_THEN "eq")(new_rewrite [] [])) THEN (((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN ((USE_THEN "t1_ineq")MP_TAC) THEN (clear_assumption "t1_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["Ghk"]) (`!h k. abs h <= r /\ abs k <= r ==> + (?t1 t2. G h k = h * k * partial i (partial j f) (x + t1 % basis j + t2 % basis i) + /\ abs t1 <= abs k /\ abs t2 <= abs h)`)))));; +refine (by (VALID ((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (USE_THEN "Gh")(ISPEC_THEN (mk_var("h",mk_type("real",[]))) thm_tac))(ISPEC_THEN (mk_var("k",mk_type("real",[]))) thm_tac))MP_TAC) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((USE_THEN "ineq")(new_rewrite [] []))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["t1"])) THEN (case THEN ((move ["eq"]) THEN (move ["t1k"]))))))));; +refine (by (VALID (((((USE_THEN "eq")MP_TAC) THEN (clear_assumption "eq") THEN BETA_TAC) THEN ((USE_THEN "F1_der")(new_rewrite [] [])) THENL [((((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN ((USE_THEN "t1k")MP_TAC) THEN (clear_assumption "t1k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); (BETA_TAC THEN (move ["eq"]))]))));; +refine (by (VALID ((set_tac "g" (`partial j f o (\h. (x + t1 % basis j) + h % basis i)`)))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN real_mvt0)(ISPEC_THEN (mk_var("g",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (`derivative g`) thm_tac))(ISPEC_THEN (mk_var("h",mk_type("real",[]))) thm_tac)) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID ((ANTS_TAC))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN ((USE_THM_THEN has_derivative_alt)(new_rewrite [] []))))));; +refine (by (VALID ((((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN diff2_partial_real_diff)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] [])) THEN ((USE_THEN "v_eq")(new_rewrite [] [])) THEN ((USE_THEN "rs")(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN ((USE_THEN "t_ineq")MP_TAC) THEN (clear_assumption "t_ineq") THEN ((USE_THEN "t1k")MP_TAC) THEN (clear_assumption "t1k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["t2"])) THEN (case THEN (move ["t2_ineq"])) THEN (move ["g_eq"])))));; +refine (by (VALID (((THENL_LAST) (((exists_tac (mk_var("t1",mk_type("real",[])))) THEN (exists_tac (mk_var("t2",mk_type("real",[]))))) THEN ((USE_THEN "eq")(new_rewrite [] [])) THEN (split_tac)) ((((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN ((USE_THEN "t2_ineq")MP_TAC) THEN (clear_assumption "t2_ineq") THEN ((USE_THEN "t1k")MP_TAC) THEN (clear_assumption "t1k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID ((set_tac "p" (`_1 - _2`)))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`p = g h - g (&0)`)))));; +refine (by (VALID (((((USE_THEN "p_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN VECTOR_MUL_LZERO)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_ADD_RID)(new_rewrite [] [])) THEN ((USE_THEN "v_eq")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THEN "g_eq")(new_rewrite [] [])) THEN ((USE_THM_THEN (REAL_ARITH `!a. k * a * h = h * k * a`))(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_MUL_ASSOC)(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THM_THEN REAL_EQ_MUL_LCANCEL)(new_rewrite [] [])) THEN ((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] [])))) THEN (DISJ2_TAC)))));; +refine (by (VALID (((USE_THM_THEN derivative_translation)(new_rewrite [] [])))));; +refine (by (VALID (((((USE_THM_THEN diff2_partial_real_diff)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] [])) THEN ((USE_THEN "v_eq")(new_rewrite [] [])) THEN ((USE_THEN "rs")(new_rewrite [] []))) THEN (((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN ((USE_THEN "t2_ineq")MP_TAC) THEN (clear_assumption "t2_ineq") THEN ((USE_THEN "t1k")MP_TAC) THEN (clear_assumption "t1k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN partial)(new_rewrite [] [])) THEN (AP_THM_TAC) THEN (AP_TERM_TAC)))));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN (GEN_ALL VECTOR_ADD_RDISTRIB))(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL VECTOR_ADD_ASSOC))(GSYM_THEN (new_rewrite [] []))))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THEN "F1_def")MP_TAC) THEN (clear_assumption "F1_def") THEN ((USE_THEN "G_def")MP_TAC) THEN (clear_assumption "G_def") THEN ((USE_THEN "F1h")MP_TAC) THEN (clear_assumption "F1h") THEN ((USE_THEN "dF1")MP_TAC) THEN (clear_assumption "dF1") THEN ((USE_THEN "F1_der")MP_TAC) THEN (clear_assumption "F1_der") THEN ((USE_THEN "Gh")MP_TAC) THEN (clear_assumption "Gh") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"])))));; +refine (by (VALID ((have_tac (move ["F2h"]) (`!k. F2 k = (\h. (f o (\h. (x + k % basis j) + h % basis i)) h - (f o (\h. x + h % basis i)) h)`)))));; +refine (by (VALID (((((USE_THEN "F2_def")(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THEN "v_eq")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["dF2"]) (`!k. abs k <= r ==> !h. abs h <= r ==> (F2 k) real_differentiable atreal h`)))));; +refine (by (VALID ((BETA_TAC THEN (move ["k"]) THEN (move ["k_ineq"]) THEN (move ["h"]) THEN (move ["h_ineq"])))));; +refine (by (VALID (((((USE_THEN "F2h")(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_DIFFERENTIABLE_SUB)(new_rewrite [] []))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN diff2_imp_real_diff)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "d2f")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "v_eq")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "rs")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "in_s")(new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["F2_der"]) (`!h k. abs h <= r /\ abs k <= r ==> + derivative (F2 k) h = partial i f ((x + k % basis j) + h % basis i) - partial i f (x + h % basis i)`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])) THEN (((USE_THEN "F2h")(new_rewrite [] [])) THEN ((USE_THM_THEN derivative_sub)(new_rewrite [] []))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (repeat_tactic 0 10 (((USE_THM_THEN diff2_imp_real_diff)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "d2f")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "v_eq")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "rs")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "in_s")(new_rewrite [] []))) THEN ((TRY done_tac)))))));; +refine (by (VALID (((((USE_THEN "v_eq")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN derivative_translation)(new_rewrite [] [(`derivative (f o (\h. x + h % basis i)) h`)])) THEN repeat_tactic 0 1 (((USE_THM_THEN derivative_translation)(new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((USE_THM_THEN diff2_imp_real_diff)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "d2f")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "v_eq")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "rs")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "in_s")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THEN "v_eq")(GSYM_THEN (new_rewrite [] []))))))));; +refine (by (VALID ((have_tac (move ["eq"]) (`!y e. (f o (\h. y + h % e)) o (\t. h + t) = f o (\t. (y + h % e) + t % e)`)))));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN (GEN_ALL VECTOR_ADD_RDISTRIB))(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL VECTOR_ADD_ASSOC))(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THEN "eq")(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN partial)(GSYM_THEN (new_rewrite [] []))))) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["Gk"]) (`!h k. abs h <= r /\ abs k <= r ==> + (?t3. G h k = h * derivative (F2 k) t3 /\ abs t3 <= abs h)`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])) THEN (((USE_THEN "G_eq")(new_rewrite [] [])) THEN (simp_tac))))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN real_mvt0)(ISPEC_THEN (`F2 k`) thm_tac))(ISPEC_THEN (`derivative (F2 k)`) thm_tac))(ISPEC_THEN (mk_var("h",mk_type("real",[]))) thm_tac)) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID ((ANTS_TAC))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN (((USE_THM_THEN has_derivative_alt)(new_rewrite [] [])) THEN ((USE_THEN "dF2")(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THEN "t_ineq")MP_TAC) THEN (clear_assumption "t_ineq") THEN ((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["t3"])) THEN (case THEN (move ["t3_ineq"])) THEN (move ["eq"])))));; +refine (by (VALID (((exists_tac (mk_var("t3",mk_type("real",[])))) THEN ((USE_THEN "eq")(new_rewrite [] [])) THEN (((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN ((USE_THEN "t3_ineq")MP_TAC) THEN (clear_assumption "t3_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["Gkh"]) (`!h k. abs h <= r /\ abs k <= r ==> + (?t3 t4. G h k = h * k * partial j (partial i f) (x + t4 % basis j + t3 % basis i) + /\ abs t3 <= abs h /\ abs t4 <= abs k)`)))));; +refine (by (VALID ((BETA_TAC THEN (move ["h"]) THEN (move ["k"]) THEN (move ["ineq"])))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (USE_THEN "Gk")(ISPEC_THEN (mk_var("h",mk_type("real",[]))) thm_tac))(ISPEC_THEN (mk_var("k",mk_type("real",[]))) thm_tac))MP_TAC) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((USE_THEN "ineq")(new_rewrite [] []))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["t3"])) THEN (case THEN ((move ["eq"]) THEN (move ["t3h"]))))))));; +refine (by (VALID (((((USE_THEN "eq")MP_TAC) THEN (clear_assumption "eq") THEN BETA_TAC) THEN ((USE_THEN "F2_der")(new_rewrite [] [])) THENL [((((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN ((USE_THEN "t3h")MP_TAC) THEN (clear_assumption "t3h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); (BETA_TAC THEN (move ["eq"]))]))));; +refine (by (VALID ((set_tac "g" (`partial i f o (\k. (x + t3 % basis i) + k % basis j)`)))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN real_mvt0)(ISPEC_THEN (mk_var("g",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (`derivative g`) thm_tac))(ISPEC_THEN (mk_var("k",mk_type("real",[]))) thm_tac)) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID ((ANTS_TAC))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineq"])) THEN ((USE_THM_THEN has_derivative_alt)(new_rewrite [] []))))));; +refine (by (VALID ((((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN diff2_partial_real_diff)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] [])) THEN ((USE_THEN "rs")(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN ((USE_THEN "t_ineq")MP_TAC) THEN (clear_assumption "t_ineq") THEN ((USE_THEN "t3h")MP_TAC) THEN (clear_assumption "t3h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["t4"])) THEN (case THEN (move ["t4_ineq"])) THEN (move ["g_eq"])))));; +refine (by (VALID (((THENL_LAST) (((exists_tac (mk_var("t3",mk_type("real",[])))) THEN (exists_tac (mk_var("t4",mk_type("real",[]))))) THEN ((USE_THEN "eq")(new_rewrite [] [])) THEN (split_tac)) ((((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN ((USE_THEN "t4_ineq")MP_TAC) THEN (clear_assumption "t4_ineq") THEN ((USE_THEN "t3h")MP_TAC) THEN (clear_assumption "t3h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID ((set_tac "p" (`_1 - _2`)))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`p = g k - g (&0)`)))));; +refine (by (VALID (((((USE_THEN "p_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN VECTOR_MUL_LZERO)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_ADD_RID)(new_rewrite [] [])) THEN ((USE_THEN "v_eq")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THEN "g_eq")(new_rewrite [] [])) THEN ((USE_THM_THEN (REAL_ARITH `!a. h * a * k = h * k * a`))(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_MUL_ASSOC)(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THM_THEN REAL_EQ_MUL_LCANCEL)(new_rewrite [] [])) THEN ((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] [])))) THEN (DISJ2_TAC)))));; +refine (by (VALID (((USE_THM_THEN derivative_translation)(new_rewrite [] [])))));; +refine (by (VALID (((((USE_THM_THEN diff2_partial_real_diff)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] [])) THEN ((USE_THEN "rs")(new_rewrite [] []))) THEN (((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN ((USE_THEN "t4_ineq")MP_TAC) THEN (clear_assumption "t4_ineq") THEN ((USE_THEN "t3h")MP_TAC) THEN (clear_assumption "t3h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN partial)(new_rewrite [] [])) THEN (AP_THM_TAC) THEN (AP_TERM_TAC)))));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN (GEN_ALL VECTOR_ADD_RDISTRIB))(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL VECTOR_ADD_ASSOC))(GSYM_THEN (new_rewrite [] []))))) THEN (move ["y"])))));; +refine (by (VALID (((AP_TERM_TAC) THEN (VECTOR_ARITH_TAC) THEN (done_tac)))));; +refine (by (VALID ((((USE_THEN "F2_def")MP_TAC) THEN (clear_assumption "F2_def") THEN ((USE_THEN "G_eq")MP_TAC) THEN (clear_assumption "G_eq") THEN ((USE_THEN "F2h")MP_TAC) THEN (clear_assumption "F2h") THEN ((USE_THEN "dF2")MP_TAC) THEN (clear_assumption "dF2") THEN ((USE_THEN "F2_der")MP_TAC) THEN (clear_assumption "F2_der") THEN ((USE_THEN "Gk")MP_TAC) THEN (clear_assumption "Gk") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"])))));; +refine (by (VALID ((have_tac (move ["lim0"]) (`(vec 0:real^2) limit_point_of {y | &0 < y$1 /\ &0 < y$2}`)))));; +refine (by (VALID (((((USE_THM_THEN limit_point_of)(new_rewrite [] [])) THEN ((USE_THM_THEN OPEN_CONTAINS_BALL)(new_rewrite [] [])) THEN ((USE_THM_THEN SUBSET)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_BALL)(new_rewrite [] [])) THEN ((USE_THM_THEN dist)(new_rewrite [] []))) THEN (move ["t"]) THEN (case THEN (move ["v0t"]))))));; +refine (by (VALID ((((fun thm_tac -> DISCH_THEN (fun fst_th ->(USE_THEN "v0t")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["e"])) THEN (case THEN (move ["e0"])) THEN (move ["in_t"])))));; +refine (by (VALID ((set_tac "y" (`e / &2 % (vec 1:real^2)`)))));; +refine (by (VALID (((THENL_FIRST) (have_tac (move ["yc"]) (`!i. y$i = e / (&2)`)) ((((USE_THEN "y_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN VECTOR_MUL_COMPONENT)(new_rewrite [] [])) THEN ((USE_THM_THEN VEC_COMPONENT)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_RID)(new_rewrite [] []))) THEN (done_tac))))));; +refine (by (VALID (((THENL_FIRST) (have_tac (move ["ineq"]) (`&0 < e / (&2)`)) ((((USE_THM_THEN REAL_LT_DIV)(new_rewrite [] [])) THEN ((USE_THEN "e0")(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID ((have_tac (move ["inf_y"]) (`infnorm y = e / &2`)))));; +refine (by (VALID (((((USE_THM_THEN (GEN_ALL INFNORM_2))(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THEN "yc")(new_rewrite [] []))) THEN ((USE_THM_THEN (GEN_ALL (CONJUNCT2 REAL_MAX_ACI)))(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_ABS_REFL)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_LT)(new_rewrite [] [])) THEN ((USE_THEN "ineq")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((THENL_FIRST) ((exists_tac (mk_var("y",mk_type("cart",[mk_type("real",[]);mk_type("2",[])])))) THEN (split_tac)) ((((USE_THM_THEN INFNORM_EQ_0)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "inf_y")(new_rewrite [] []))) THEN (((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID (((THENL_FIRST) (split_tac) ((((USE_THM_THEN IN_ELIM_THM)(new_rewrite [] [])) THEN (simp_tac)) THEN (exists_tac (mk_var("y",mk_type("cart",[mk_type("real",[]);mk_type("2",[])])))) THEN (repeat_tactic 1 9 (((USE_THEN "yc")(new_rewrite [] []))) THEN ((USE_THEN "ineq")(new_rewrite [] []))) THEN (done_tac))))));; +refine (by (VALID ((((USE_THEN "in_t")(new_rewrite [] [])) THEN (((USE_THM_THEN REAL_LET_TRANS)MP_TAC) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (`e * inv(&2) * sqrt(&2)`)) THEN (split_tac)))));; +refine (by (VALID (((((USE_THM_THEN REAL_LE_TRANS)MP_TAC) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (`infnorm y * sqrt (&2)`)) THEN (split_tac)))));; +refine (by (VALID (((((USE_THM_THEN (GEN_ALL REAL_MUL_AC))(new_rewrite [] [])) THEN ((USE_THM_THEN NORM_SUB)(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL VECTOR_SUB_RZERO))(new_rewrite [] [])) THEN ((USE_THM_THEN DIMINDEX_2)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN NORM_LE_INFNORM)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THEN "inf_y")(new_rewrite [] [])) THEN ((USE_THM_THEN real_div)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_ASSOC)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN REAL_MUL_RID)(ISPEC_THEN (mk_var("e",mk_type("real",[]))) thm_tac))(GSYM_THEN (new_rewrite [2] []))) THEN ((USE_THM_THEN REAL_LT_LMUL)(new_rewrite [] [])) THEN ((USE_THEN "e0")(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THM_THEN REAL_MUL_LINV)(ISPEC_THEN (`&2`) thm_tac))(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_LT_LMUL)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_LT_INV)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN ((TRY) (arith_tac))))));; +refine (by (VALID (((THENL_FIRST) (have_tac (DISCH_THEN(new_rewrite [2] [])) (`&2 = sqrt (&2 * &2)`)) ((((USE_THM_THEN REAL_POW_2)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN POW_2_SQRT_ABS)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID ((((USE_THM_THEN SQRT_MONO_LT)(new_rewrite [] [])) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["lim_ji"]) (`((\y:real^2. lift (G (y$1) (y$2) / (y$1 * y$2))) --> lift (partial j (partial i f) x)) + (at (vec 0) within {y | &0 < y$1 /\ &0 < y$2})`)))));; +refine (by (VALID ((((USE_THM_THEN LIM_WITHIN)(new_rewrite [] [])) THEN (move ["e"]) THEN (move ["e_gt0"])))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (USE_THEN "pc")(ISPEC_THEN (mk_var("i",mk_type("num",[]))) thm_tac))(ISPEC_THEN (mk_var("j",mk_type("num",[]))) thm_tac))MP_TAC) THEN BETA_TAC) THEN ((((USE_THM_THEN (GEN_ALL continuous_at))(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN dist)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] [])))) THEN ((fun thm_tac -> DISCH_THEN (fun fst_th ->(USE_THEN "e_gt0")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["e_ineq"]))))));; +refine (by (VALID (((THENL_FIRST) ((exists_tac (`min r (d / &2)`)) THEN ((USE_THM_THEN REAL_LT_MIN)(new_rewrite [] [])) THEN (split_tac)) ((((USE_THEN "d0")MP_TAC) THEN (clear_assumption "d0") THEN ((USE_THEN "r0")MP_TAC) THEN (clear_assumption "r0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID ((((simp_tac) THEN ((USE_THM_THEN (GEN_ALL VECTOR_SUB_RZERO))(new_rewrite [] []))) THEN (move ["y"]) THEN (move ["ineq"])))));; +refine (by (VALID ((have_tac (move ["y0"]) (`&0 < abs (y$1) /\ &0 < abs (y$2)`)))));; +refine (by (VALID (((((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN ((((USE_THM_THEN IN_ELIM_THM)(new_rewrite [] [])) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["z"])) THEN (case THEN (move ["z_ineq"])) THEN (DISCH_THEN(new_rewrite [] [])) THEN (move ["_"]))))));; +refine (by (VALID (((((USE_THEN "z_ineq")MP_TAC) THEN (clear_assumption "z_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["yr"]) (`abs (y$1) <= r /\ abs (y$2) <= r /\ abs (y$1) < d / &2 /\ abs (y$2) < d / &2`)))));; +refine (by (VALID (((THENL_FIRST) (((THENL_ROT 1)) (have_tac ALL_TAC (`infnorm y < min r (d / &2)`))) (((USE_THM_THEN (GEN_ALL INFNORM_2))(new_rewrite [] [])) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID (((((USE_THM_THEN REAL_LET_TRANS)MP_TAC) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (`norm y`)) THEN ((USE_THM_THEN INFNORM_LE_NORM)(new_rewrite [] [])) THEN (done_tac)))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THEN "Gkh")(ISPEC_THEN (`y$1`) thm_tac))(ISPEC_THEN (`y$2`) thm_tac)) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THEN "yr")(new_rewrite [] []))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["t1"])) THEN (case THEN (move ["t2"])) THEN (case THEN (move ["G_eq"])) THEN (move ["t_ineq"])))));; +refine (by (VALID ((((USE_THEN "G_eq")(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_ASSOC)(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL REAL_MUL_AC))(new_rewrite [] [])) THEN ((USE_THM_THEN real_div)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_ASSOC)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_MUL_RINV)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_MUL_RID)(new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN REAL_ENTIRE)(new_rewrite [] [])) THEN (((USE_THEN "y0")MP_TAC) THEN (clear_assumption "y0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((((USE_THEN "e_ineq")MP_TAC) THEN (clear_assumption "e_ineq") THEN (DISCH_THEN apply_tac)) THEN ((USE_THM_THEN (GEN_ALL VECTOR_ADD_SUB))(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THM_THEN REAL_LET_TRANS)MP_TAC) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (`norm (t2 % basis j:real^N) + norm (t1 % basis i:real^N)`))))));; +refine (by (VALID ((((USE_THM_THEN NORM_TRIANGLE)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN NORM_MUL)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN NORM_BASIS)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_MUL_RID)(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THEN "yr")MP_TAC) THEN (clear_assumption "yr") THEN ((USE_THEN "t_ineq")MP_TAC) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["lim_ij"]) (`((\y:real^2. lift (G (y$1) (y$2) / (y$1 * y$2))) --> lift (partial i (partial j f) x)) + (at (vec 0) within {y | &0 < y$1 /\ &0 < y$2})`)))));; +refine (by (VALID ((((USE_THM_THEN LIM_WITHIN)(new_rewrite [] [])) THEN (move ["e"]) THEN (move ["e_gt0"])))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (USE_THEN "pc")(ISPEC_THEN (mk_var("j",mk_type("num",[]))) thm_tac))(ISPEC_THEN (mk_var("i",mk_type("num",[]))) thm_tac))MP_TAC) THEN BETA_TAC) THEN ((((USE_THM_THEN (GEN_ALL continuous_at))(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN dist)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] [])))) THEN ((fun thm_tac -> DISCH_THEN (fun fst_th ->(USE_THEN "e_gt0")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["e_ineq"]))))));; +refine (by (VALID (((THENL_FIRST) ((exists_tac (`min r (d / &2)`)) THEN ((USE_THM_THEN REAL_LT_MIN)(new_rewrite [] [])) THEN (split_tac)) ((((USE_THEN "d0")MP_TAC) THEN (clear_assumption "d0") THEN ((USE_THEN "r0")MP_TAC) THEN (clear_assumption "r0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID ((((simp_tac) THEN ((USE_THM_THEN (GEN_ALL VECTOR_SUB_RZERO))(new_rewrite [] []))) THEN (move ["y"]) THEN (move ["ineq"])))));; +refine (by (VALID ((have_tac (move ["y0"]) (`&0 < abs (y$1) /\ &0 < abs (y$2)`)))));; +refine (by (VALID (((((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN ((((USE_THM_THEN IN_ELIM_THM)(new_rewrite [] [])) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["z"])) THEN (case THEN (move ["z_ineq"])) THEN (DISCH_THEN(new_rewrite [] [])) THEN (move ["_"]))))));; +refine (by (VALID (((((USE_THEN "z_ineq")MP_TAC) THEN (clear_assumption "z_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["yr"]) (`abs (y$1) <= r /\ abs (y$2) <= r /\ abs (y$1) < d / &2 /\ abs (y$2) < d / &2`)))));; +refine (by (VALID (((THENL_FIRST) (((THENL_ROT 1)) (have_tac ALL_TAC (`infnorm y < min r (d / &2)`))) (((USE_THM_THEN (GEN_ALL INFNORM_2))(new_rewrite [] [])) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID (((((USE_THM_THEN REAL_LET_TRANS)MP_TAC) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (`norm y`)) THEN ((USE_THM_THEN INFNORM_LE_NORM)(new_rewrite [] [])) THEN (done_tac)))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THEN "Ghk")(ISPEC_THEN (`y$1`) thm_tac))(ISPEC_THEN (`y$2`) thm_tac)) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THEN "yr")(new_rewrite [] []))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["t1"])) THEN (case THEN (move ["t2"])) THEN (case THEN (move ["G_eq"])) THEN (move ["t_ineq"])))));; +refine (by (VALID ((((USE_THEN "G_eq")(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_ASSOC)(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL REAL_MUL_AC))(new_rewrite [] [])) THEN ((USE_THM_THEN real_div)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_ASSOC)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_MUL_RINV)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_MUL_RID)(new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN REAL_ENTIRE)(new_rewrite [] [])) THEN (((USE_THEN "y0")MP_TAC) THEN (clear_assumption "y0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((((USE_THEN "e_ineq")MP_TAC) THEN (clear_assumption "e_ineq") THEN (DISCH_THEN apply_tac)) THEN ((USE_THM_THEN (GEN_ALL VECTOR_ADD_SUB))(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THM_THEN REAL_LET_TRANS)MP_TAC) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (`norm (t1 % basis j:real^N) + norm (t2 % basis i:real^N)`))))));; +refine (by (VALID ((((USE_THM_THEN NORM_TRIANGLE)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN NORM_MUL)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN NORM_BASIS)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_MUL_RID)(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THEN "yr")MP_TAC) THEN (clear_assumption "yr") THEN ((USE_THEN "t_ineq")MP_TAC) THEN (clear_assumption "t_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN LIFT_EQ)(GSYM_THEN (new_rewrite [] []))) THEN ((fun thm_tac -> (USE_THM_THEN LIM_UNIQUE)(ISPEC_THEN (`at (vec 0:real^2) within {y:real^2 | &0 < y$1 /\ &0 < y$2}`) thm_tac)) apply_tac)))));; +refine (by (VALID ((exists_tac (`\y:real^2. lift (G (y$1) (y$2) / (y$1 * y$2))`)))));; +refine (by (VALID (((((USE_THM_THEN (GEN_ALL TRIVIAL_LIMIT_WITHIN))(new_rewrite [] [])) THEN ((USE_THM_THEN negbK)(new_rewrite [] [])) THEN ((USE_THEN "lim0")(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (done_tac)))));; +let mixed_second_partials = end_section_proof();; +let m_cell_domain = new_definition `m_cell_domain (x:real^N, z:real^N) (y:real^N) (w:real^N) <=> + !i. i IN 1..dimindex (:N) ==> x$i <= y$i /\ y$i <= z$i /\ max (y$i - x$i) (z$i - y$i) <= w$i`;; +let m_bounded_on_int = new_definition `m_bounded_on_int (f:real^N->real) domain f_bounds <=> + !x. x IN interval [domain] ==> interval_arith (f x) f_bounds`;; +let diff2_domain = new_definition `diff2_domain domain f <=> + !x. x IN interval [domain] ==> diff2 f x`;; +let diff2c_domain = new_definition `diff2c_domain domain f <=> + !x. x IN interval [domain] ==> diff2c f x`;; +(start_section_proof ["f";"domain"](`diff2c_domain domain f <=> diff2_domain domain f /\ + (!x. x IN interval [domain] ==> !i j. (lift o partial2 j i f) continuous at x)`));; +refine (by (VALID (((((USE_THM_THEN diff2c_domain)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2c)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2_domain)(new_rewrite [] []))) THEN ((split_tac) THENL [(move ["h1"]); ((case THEN ((move ["h1"]) THEN (move ["h2"]))) THEN (move ["x"]) THEN (move ["h3"]))])))));; +refine (by (VALID ((((split_tac) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "h1")(MATCH_MP_THEN snd_th MP_TAC))) THEN (simp_tac)) THEN (done_tac)))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "h1")(fun fst_th ->(USE_THEN "h3")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN ((fun thm_tac -> (USE_THEN "h2")(fun fst_th ->(USE_THEN "h3")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (simp_tac)) THEN (done_tac)))));; +let diff2c_domain_alt = end_section_proof();; +(start_section_proof ["domain";"y";"w"](`m_cell_domain domain y w ==> y IN interval [domain]`));; +refine (by (VALID ((((disch_tm_tac [](mk_var("domain",mk_type("prod",[mk_type("cart",[mk_type("real",[]);mk_vartype "?1457984"]);mk_type("cart",[mk_type("real",[]);mk_vartype "?1457984"])])))) THEN (clear_assumption "domain") THEN case THEN (move ["x"]) THEN (move ["z"])) THEN ((((USE_THM_THEN m_cell_domain)(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL IN_INTERVAL))(new_rewrite [] [])) THEN ((USE_THM_THEN IN_NUMSEG)(new_rewrite [] []))) THEN (move ["ineqs"]) THEN (move ["i"]))))));; +refine (by (VALID ((((DISCH_THEN (fun snd_th -> (USE_THEN "ineqs")(MATCH_MP_THEN snd_th MP_TAC))) THEN BETA_TAC THEN (simp_tac)) THEN (done_tac)))));; +let y_in_domain = end_section_proof();; +(start_section_proof ["p";"domain";"y";"w"](`m_cell_domain domain y (w:real^N) ==> + p IN interval [domain] ==> + !i. i IN 1..dimindex (:N) ==> abs (p$i - y$i) <= w$i`));; +refine (by (VALID ((((disch_tm_tac [](mk_var("domain",mk_type("prod",[mk_type("cart",[mk_type("real",[]);mk_vartype "N"]);mk_type("cart",[mk_type("real",[]);mk_vartype "N"])])))) THEN (clear_assumption "domain") THEN case THEN (move ["x"]) THEN (move ["z"])) THEN (((USE_THM_THEN m_cell_domain)(new_rewrite [] [])) THEN (move ["ineqs"]) THEN (move ["p_in"]) THEN (move ["i"]) THEN (move ["i_in"]))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "ineqs")(fun fst_th ->(USE_THEN "i_in")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN ((USE_THEN "p_in")MP_TAC) THEN (clear_assumption "p_in") THEN BETA_TAC) THEN ((((USE_THM_THEN (GEN_ALL IN_INTERVAL))(new_rewrite [] [])) THEN ((USE_THM_THEN IN_NUMSEG)(GSYM_THEN (new_rewrite [] [])))) THEN ((fun thm_tac -> DISCH_THEN (fun fst_th ->(USE_THEN "i_in")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC)) THEN (arith_tac) THEN (done_tac)))));; +let domain_width = end_section_proof();; +(start_section_proof ["g";"n"](`sum (1..n) (\i. sum (i + 1..n) (\j. g i j)) = + sum (1..n) (\i. sum (1..i - 1) (\j. g j i))`));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN SUM_SUM_PRODUCT)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN FINITE_NUMSEG)(new_rewrite [] []))) THEN ((simp_tac THEN TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_NUMSEG)(new_rewrite [] [])))))));; +refine (by (VALID ((set_tac "s1" (`{i, j | (1 <= i /\ i <= n) /\ i + 1 <= j /\ j <= n}`)))));; +refine (by (VALID ((set_tac "s2" (`{i, j | (1 <= i /\ i <= n) /\ 1 <= j /\ j <= i - 1}`)))));; +refine (by (VALID ((set_tac "f" (`\(i,j):num#num. j, i`)))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`s1 = IMAGE f s2`)))));; +refine (by (VALID ((((((USE_THEN "s1_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "s2_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "f_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN EXTENSION)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_IMAGE)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_ELIM_THM)(new_rewrite [] []))) THEN (simp_tac)) THEN (move ["p"])) THEN (split_tac)))));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["i"])) THEN (case THEN (move ["j"])) THEN (case THEN (move ["ineq"])) THEN (move ["p_eq"])))));; +refine (by (VALID (((exists_tac (`j, i`)) THEN (((USE_THEN "p_eq")(new_rewrite [] [])) THEN (simp_tac)) THEN ((exists_tac (mk_var("j",mk_type("num",[])))) THEN (exists_tac (mk_var("i",mk_type("num",[]))))) THEN (((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["p1"])) THEN (case THEN (move ["p_eq"])) THEN (case THEN (move ["i"])) THEN (case THEN (move ["j"])) THEN (case THEN (move ["ineq"])) THEN (move ["p1_eq"])))));; +refine (by (VALID ((((exists_tac (mk_var("j",mk_type("num",[])))) THEN (exists_tac (mk_var("i",mk_type("num",[]))))) THEN (((USE_THEN "p_eq")(new_rewrite [] [])) THEN ((USE_THEN "p1_eq")(new_rewrite [] [])) THEN (simp_tac)) THEN (((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`(\(i,j). g j i) = (\(i,j). g i j) o f`)))));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN ((USE_THEN "f_def")(GSYM_THEN (new_rewrite [] [])))) THEN case THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN SUM_IMAGE) apply_tac) THEN (case THEN (move ["i1"]) THEN (move ["j1"])) THEN (case THEN (move ["i2"]) THEN (move ["j2"]))))));; +refine (by (VALID ((((((USE_THEN "f_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac) THEN repeat_tactic 1 9 (((USE_THM_THEN PAIR_EQ)(new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN ((DISCH_THEN(new_rewrite [] [])) THEN (DISCH_THEN(new_rewrite [] []))))) THEN (done_tac)))));; +let sum_swap1 = end_section_proof();; +(start_section_proof ["f";"domain";"w";"error"](`diff2c_domain domain f ==> + (m_taylor_error f domain (w:real^N) error <=> + (!x. x IN interval [domain] ==> + sum (1..dimindex (:N)) (\i. w$i * (w$i * abs (partial2 i i f x) + + &2 * sum (1..i - 1) (\j. w$j * abs (partial2 j i f x)))) <= error))`));; +refine (by (VALID (((((USE_THM_THEN diff2c_domain)(new_rewrite [] [])) THEN ((USE_THM_THEN m_taylor_error)(new_rewrite [] []))) THEN (move ["d2f"])))));; +refine (by (VALID ((have_tac (move ["eq"]) (`!g1 g2. (!x. x IN interval [domain] ==> g1 x = g2 x) ==> + ((!x. x IN interval [domain] ==> g1 x <= error) <=> (!x. x IN interval [domain] ==> g2 x <= error))`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["g1"]) THEN (move ["g2"]) THEN (move ["eq"])) THEN ((split_tac) THEN (move ["cond"]) THEN (move ["x"]) THEN (move ["Px"]))))));; +refine (by (VALID (((((USE_THEN "eq")(GSYM_THEN (new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THEN "cond")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THEN "eq")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "cond")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THEN "eq")MP_TAC) THEN (clear_assumption "eq") THEN (DISCH_THEN apply_tac) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "d2f")(MATCH_MP_THEN snd_th MP_TAC))) THEN (move ["d2fx"])))));; +refine (by (VALID ((set_tac "g" (`\i j. w$i * w$j * abs (partial2 j i f x)`)))));; +refine (by (VALID ((set_tac "n" (`dimindex (:N)`)))));; +refine (by (VALID ((set_tac "s1" (`sum _1 _2`)))));; +refine (by (VALID ((have_tac (move ["s1_eq"]) (`s1 = sum (1..n) (\i. sum (1..n) (\j. g i j))`)))));; +refine (by (VALID ((((USE_THEN "s1_def")(GSYM_THEN (new_rewrite [] []))) THEN (((USE_THM_THEN SUM_EQ) apply_tac) THEN (move ["i"]) THEN (simp_tac) THEN (move ["i_in"]))))));; +refine (by (VALID (((((USE_THM_THEN SUM_LMUL)(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN partial2)(new_rewrite [] []))) THEN ((USE_THM_THEN SUM_EQ) apply_tac) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN REAL_MUL_2)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_ADD_LDISTRIB)(new_rewrite [] []))) THEN ((USE_THM_THEN SUM_LMUL)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_ADD_ASSOC)(new_rewrite [] [])) THEN ((USE_THM_THEN SUM_ADD_NUMSEG)(new_rewrite [] [])) THEN (simp_tac)))));; +refine (by (VALID ((set_tac "s2" (`sum _1 _2`)))));; +refine (by (VALID (((THENL_FIRST) (have_tac (move ["s2_eq"]) (`s2 = sum (1..n) (\i. g i i + sum (1..i - 1) (\j. g i j))`)) ((((USE_THEN "s2_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac))))));; +refine (by (VALID ((set_tac "s3" (`sum _1 _2`)))));; +refine (by (VALID (((THENL_FIRST) (have_tac (move ["s3_eq"]) (`s3 = sum (1..n) (\i. sum (1..i - 1) (\j. g i j))`)) ((((USE_THEN "s3_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac))))));; +refine (by (VALID ((((USE_THEN "s3_def")MP_TAC) THEN (clear_assumption "s3_def") THEN ((USE_THEN "s2_def")MP_TAC) THEN (clear_assumption "s2_def") THEN ((USE_THEN "s1_def")MP_TAC) THEN (clear_assumption "s1_def") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"])))));; +refine (by (VALID ((((THENL_ROT 1)) (have_tac (DISCH_THEN(new_rewrite [] [])) (`s3 = sum (1..n) (\i. sum (i + 1..n) (\j. g i j))`))))));; +refine (by (VALID (((((USE_THEN "s2_eq")(new_rewrite [] [])) THEN ((USE_THM_THEN SUM_ADD_NUMSEG)(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THEN "s1_eq")(new_rewrite [] []))) THEN (((USE_THM_THEN SUM_EQ) apply_tac) THEN (move ["i"]) THEN (simp_tac)) THEN (((USE_THM_THEN IN_NUMSEG)(new_rewrite [] [])) THEN (move ["i_ineq"]))))));; +refine (by (VALID (((((USE_THM_THEN (REAL_ARITH `!a b c. (a + b) + c = (a + c) + b`))(new_rewrite [] [])) THEN ((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN SUM_SING_NUMSEG)(ISPEC_THEN (`g i`) thm_tac))(ISPEC_THEN (mk_var("i",mk_type("num",[]))) thm_tac))(GSYM_THEN (new_rewrite [] [])))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))))));; +refine (by (VALID (((THENL_FIRST) (((USE_THM_THEN SUM_COMBINE_R)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "i_ineq")(new_rewrite [] [])))) ((arith_tac) THEN (done_tac))))));; +refine (by (VALID (((((USE_THM_THEN (GEN_ALL REAL_ADD_AC))(new_rewrite [] [])) THEN ((USE_THM_THEN SUM_COMBINE_L)(new_rewrite [] [])) THEN ((TRY done_tac))) THEN (((USE_THEN "i_ineq")MP_TAC) THEN (clear_assumption "i_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((((USE_THEN "s3_eq")(new_rewrite [] [])) THEN ((USE_THM_THEN sum_swap1)(new_rewrite [] []))) THEN (((USE_THM_THEN SUM_EQ) apply_tac) THEN (move ["i"]) THEN (move ["_"]) THEN (simp_tac)) THEN (((USE_THM_THEN SUM_EQ) apply_tac) THEN (move ["j"]) THEN (move ["_"]) THEN (simp_tac))))));; +refine (by (VALID (((((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN (REAL_ARITH `!a b c. a * b * c = b * a * c`))(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_EQ_MUL_LCANCEL)(new_rewrite [] [])))) THEN (DISJ2_TAC) THEN (DISJ2_TAC)))));; +refine (by (VALID ((((USE_THM_THEN mixed_second_partials)(new_rewrite [] [])) THEN (done_tac)))));; +let m_taylor_error_eq = end_section_proof();; +(start_section_proof ["domain";"y";"w";"p";"f";"dd_bound"](`m_cell_domain domain y (w:real^N) ==> + p IN interval [domain] ==> + diff2_domain domain f ==> + m_taylor_error f domain w dd_bound ==> + (!t. interval_arith t (&0, &1) ==> + abs (nth_derivative 2 (f o (\t. y + t % (p - y))) t) <= dd_bound)`));; +refine (by (VALID (((((USE_THM_THEN diff2_domain)(new_rewrite [] [])) THEN ((USE_THM_THEN m_taylor_error)(new_rewrite [] []))) THEN (move ["domainH"]) THEN (move ["p_in"]) THEN (move ["df"]) THEN (move ["boundedH"]) THEN (move ["t"]) THEN (move ["t_in"])))));; +refine (by (VALID ((have_tac (move ["pt_in"]) (`y + t % (p - y) IN interval [domain]`)))));; +refine (by (VALID ((((USE_THM_THEN (VECTOR_ARITH `y + t % (p - y) = (&1 - t) % y + t % p:real^N`))(new_rewrite [] [])) THEN ((USE_THM_THEN IN_CONVEX_SET)(new_rewrite [] []))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THM_THEN y_in_domain)(fun fst_th ->(USE_THEN "domainH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN ((USE_THEN "p_in")(new_rewrite [] [])) THEN ((USE_THM_THEN interval_arith)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "t_in")(new_rewrite [] [])) THEN ((USE_THM_THEN pair_eq)(new_rewrite [] [])) THEN ((USE_THM_THEN CONVEX_INTERVAL)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN diff2_dir_derivative2)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID (((((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN (simp_tac)) THEN (((fun thm_tac -> (USE_THEN "boundedH")(fun fst_th ->(USE_THEN "pt_in")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC)))));; +refine (by (VALID (((set_tac "s1" (`sum _1 _2`)) THEN ((set_tac "s2" (`sum _1 _2`)) THEN (move ["i1"]))))));; +refine (by (VALID (((((USE_THM_THEN REAL_LE_TRANS)MP_TAC) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (mk_var("s1",mk_type("real",[])))) THEN (((USE_THEN "i1")(new_rewrite [] [])) THEN ((USE_THM_THEN andbT)(new_rewrite [] [])) THEN ((USE_THEN "s1_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "s2_def")(GSYM_THEN (new_rewrite [] []))))))));; +refine (by (VALID (((((USE_THM_THEN SUM_ABS_LE)(new_rewrite [] [])) THEN ((USE_THM_THEN FINITE_NUMSEG)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac)))));; +refine (by (VALID (((((USE_THM_THEN SUM_LMUL)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN SUM_ABS_LE)(new_rewrite [] [])) THEN ((USE_THM_THEN FINITE_NUMSEG)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["j"]) THEN (move ["j_ineq"]) THEN (simp_tac)))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN REAL_ABS_MUL)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_LE_MUL2)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_LE_MUL)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_ABS_POS)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN VECTOR_SUB_COMPONENT)(new_rewrite [] []))) THEN (((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN domain_width)(fun fst_th ->(USE_THEN "domainH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "p_in")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_derivative2_bound = end_section_proof();; +(start_section_proof ["domain";"y";"w";"p";"f";"dd_bound"](`m_cell_domain domain y (w:real^N) ==> + p IN interval [domain] ==> + diff2_domain domain f ==> + m_taylor_error f domain w dd_bound ==> + abs (f p - (f y + sum (1..dimindex (:N)) (\i. (p - y)$i * partial i f y))) <= dd_bound / &2`));; +refine (by (VALID ((((USE_THM_THEN diff2_domain)(new_rewrite [] [])) THEN (BETA_TAC THEN (move ["domainH"]) THEN (move ["p_in"]) THEN (move ["df"]) THEN (move ["taylor_error"]))))));; +refine (by (VALID ((have_tac (move ["pt_in"]) (`!t. interval_arith t (&0, &1) ==> y + t % (p - y) IN interval [domain]`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (move ["t_in"])) THEN (((USE_THM_THEN (VECTOR_ARITH `y + t % (p - y) = (&1 - t) % y + t % p:real^N`))(new_rewrite [] [])) THEN ((USE_THM_THEN IN_CONVEX_SET)(new_rewrite [] [])))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THM_THEN y_in_domain)(fun fst_th ->(USE_THEN "domainH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN ((USE_THEN "p_in")(new_rewrite [] [])) THEN ((USE_THM_THEN interval_arith)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "t_in")(new_rewrite [] [])) THEN ((USE_THM_THEN pair_eq)(new_rewrite [] [])) THEN ((USE_THM_THEN CONVEX_INTERVAL)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN real_taylor2_bound)(ISPEC_THEN (`f o (\t. y + t % (p - y))`) thm_tac))(ISPEC_THEN (mk_var("dd_bound",mk_type("real",[]))) thm_tac))MP_TAC) THEN BETA_TAC))));; +refine (by (VALID (((THENL_FIRST) (ANTS_TAC) ((((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] [])) THEN (move ["t"]) THEN (move ["t_in"])) THEN (((USE_THM_THEN diff2_dir)(new_rewrite [] [])) THEN ((USE_THEN "df")(new_rewrite [] [])) THEN ((USE_THEN "pt_in")(new_rewrite [] []))) THEN (done_tac))))));; +refine (by (VALID (((THENL_FIRST) (ANTS_TAC) ((((fun thm_tac -> (USE_THM_THEN diff2_derivative2_bound)(fun fst_th ->(USE_THEN "domainH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN (DISCH_THEN apply_tac)) THEN ((USE_THM_THEN diff2_domain)(new_rewrite [] [])) THEN (done_tac))))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN VECTOR_MUL_LID)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_MUL_LZERO)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_ADD_RID)(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL VECTOR_SUB_ADD2))(new_rewrite [] []))))));; +refine (by (VALID (((THENL_FIRST) (((USE_THM_THEN diff2_dir_derivative)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "pt_in")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN interval_arith)(new_rewrite [] [])))) ((arith_tac) THEN (done_tac))))));; +refine (by (VALID (((((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN VECTOR_MUL_LZERO)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_ADD_RID)(new_rewrite [] []))) THEN (done_tac)))));; +let m_taylor_error_lemma = end_section_proof();; +(start_section_proof ["domain";"y";"w";"f";"dd_bound";"hi";"hi_bound"](`m_cell_domain domain y (w:real^N) ==> + diff2_domain domain f ==> + m_taylor_error f domain w dd_bound ==> + f y <= hi ==> + hi + sum(1..dimindex (:N)) (\i. w$i * abs (partial i f y)) + dd_bound / &2 <= hi_bound ==> + !p. p IN interval [domain] ==> f p <= hi_bound`));; +refine (by (VALID ((BETA_TAC THEN (move ["domainH"]) THEN (move ["df"]) THEN (move ["errorH"]) THEN (move ["f_bound"]) THEN (move ["total_bound"]) THEN (move ["p"]) THEN (move ["p_in"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN m_taylor_error_lemma)(fun fst_th ->(USE_THEN "domainH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "p_in")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "errorH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC))));; +refine (by (VALID (((DISCH_THEN (fun snd_th -> (USE_THM_THEN (REAL_ARITH `!x y e. abs (x - y) <= e ==> x <= y + e`))(MATCH_MP_THEN snd_th MP_TAC))) THEN BETA_TAC))));; +refine (by (VALID (((set_tac "s" (`sum _1 _2`)) THEN (move ["ineq"])))));; +refine (by (VALID (((((USE_THM_THEN REAL_LE_TRANS)MP_TAC) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (`(f y + s) + dd_bound / &2`)) THEN (((USE_THEN "ineq")(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THEN "total_bound")MP_TAC) THEN (clear_assumption "total_bound") THEN ((USE_THM_THEN (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))MP_TAC) THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID ((((USE_THM_THEN REAL_ADD_ASSOC)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_RADD)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_ADD2)(new_rewrite [] [])) THEN ((USE_THEN "f_bound")(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THM_THEN REAL_LE_TRANS)MP_TAC) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (`abs s`)) THEN (((USE_THM_THEN REAL_ABS_LE)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THEN "s_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN SUM_ABS_LE)(new_rewrite [] [])) THEN ((USE_THM_THEN FINITE_NUMSEG)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac)))));; +refine (by (VALID (((((USE_THM_THEN REAL_ABS_MUL)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_MUL2)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_ABS_POS)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_SUB_COMPONENT)(new_rewrite [] [])) THEN ((fun thm_tac -> (USE_THM_THEN domain_width)(fun fst_th ->(USE_THEN "domainH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] []))) THEN (done_tac)))));; +let m_taylor_upper_bound = end_section_proof();; +(start_section_proof ["domain";"y";"w";"f";"dd_bound";"lo";"lo_bound"](`m_cell_domain domain y (w:real^N) ==> + diff2_domain domain f ==> + m_taylor_error f domain w dd_bound ==> + lo <= f y ==> + lo_bound <= lo - (sum(1..dimindex (:N)) (\i. w$i * abs (partial i f y)) + dd_bound / &2) ==> + !p. p IN interval [domain] ==> lo_bound <= f p`));; +refine (by (VALID ((BETA_TAC THEN (move ["domainH"]) THEN (move ["df"]) THEN (move ["errorH"]) THEN (move ["f_bound"]) THEN (move ["total_bound"]) THEN (move ["p"]) THEN (move ["p_in"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN m_taylor_error_lemma)(fun fst_th ->(USE_THEN "domainH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "p_in")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "errorH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC))));; +refine (by (VALID (((DISCH_THEN (fun snd_th -> (USE_THM_THEN (REAL_ARITH `!x y e. abs (x - y) <= e ==> y - e <= x`))(MATCH_MP_THEN snd_th MP_TAC))) THEN BETA_TAC))));; +refine (by (VALID (((set_tac "s" (`sum _1 _2`)) THEN (move ["ineq"])))));; +refine (by (VALID (((((USE_THM_THEN REAL_LE_TRANS)MP_TAC) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (`(f y + s) - dd_bound / &2`)) THEN (((USE_THEN "ineq")(new_rewrite [] [])) THEN ((USE_THM_THEN andbT)(new_rewrite [] [])))))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))(fun fst_th ->(USE_THEN "total_bound")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN real_sub)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_NEG_ADD)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_ADD_ASSOC)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_RADD)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_ADD2)(new_rewrite [] [])) THEN ((USE_THEN "f_bound")(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))))));; +refine (by (VALID (((THENL_LAST) ((((USE_THM_THEN REAL_LE_TRANS)MP_TAC) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (`--abs s`)) THEN ((USE_THM_THEN REAL_LE_NEG)(new_rewrite [] [])) THEN (split_tac)) ((arith_tac) THEN (done_tac))))));; +refine (by (VALID (((((USE_THEN "s_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN SUM_ABS_LE)(new_rewrite [] [])) THEN ((USE_THM_THEN FINITE_NUMSEG)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac)))));; +refine (by (VALID (((((USE_THM_THEN REAL_ABS_MUL)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_MUL2)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_ABS_POS)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_SUB_COMPONENT)(new_rewrite [] [])) THEN ((fun thm_tac -> (USE_THM_THEN domain_width)(fun fst_th ->(USE_THEN "domainH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] []))) THEN (done_tac)))));; +let m_taylor_lower_bound = end_section_proof();; +(start_section_proof ["domain";"y";"w";"f";"dd_bound";"lo";"hi";"err_bound";"lo_bound";"hi_bound"](`m_cell_domain domain y (w:real^N) ==> + diff2_domain domain f ==> + m_taylor_error f domain w dd_bound ==> + interval_arith (f y) (lo, hi) ==> + sum(1..dimindex (:N)) (\i. w$i * abs(partial i f y)) + dd_bound / &2 <= err_bound ==> + lo_bound <= lo - err_bound ==> + hi + err_bound <= hi_bound ==> + m_bounded_on_int f domain (lo_bound, hi_bound)`));; +refine (by (VALID (((((USE_THM_THEN m_bounded_on_int)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN interval_arith)(new_rewrite [] [])))) THEN (move ["domainH"]) THEN (move ["df"]) THEN (move ["errorH"]) THEN (case THEN ((move ["f_lo"]) THEN (move ["f_hi"]))) THEN (move ["err"]) THEN (move ["lo_ineq"]) THEN (move ["hi_ineq"]) THEN (move ["p"]) THEN (move ["p_in"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN m_taylor_lower_bound)(fun fst_th ->(USE_THEN "domainH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "errorH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "f_lo")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(ISPEC_THEN (mk_var("lo_bound",mk_type("real",[]))) thm_tac))MP_TAC) THEN BETA_TAC THEN (DISCH_THEN(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THEN "p_in")(new_rewrite [] [])) THEN ((USE_THM_THEN andbT)(new_rewrite [] []))) THEN (((USE_THM_THEN REAL_LE_TRANS)MP_TAC) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (`lo - err_bound`))))));; +refine (by (VALID (((((USE_THEN "lo_ineq")(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN real_sub)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_LE_ADD2)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_NEG)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN m_taylor_upper_bound)(fun fst_th ->(USE_THEN "domainH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "errorH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "f_hi")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(ISPEC_THEN (mk_var("hi_bound",mk_type("real",[]))) thm_tac))MP_TAC) THEN BETA_TAC THEN (DISCH_THEN(new_rewrite [] [])) THEN ((TRY done_tac))))));; +refine (by (VALID (((((USE_THEN "p_in")(new_rewrite [] [])) THEN ((USE_THM_THEN andbT)(new_rewrite [] []))) THEN (((USE_THM_THEN REAL_LE_TRANS)MP_TAC) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (`hi + err_bound`))))));; +refine (by (VALID (((((USE_THEN "hi_ineq")(new_rewrite [] [])) THEN ((USE_THM_THEN andbT)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_LADD)(new_rewrite [] []))) THEN (done_tac)))));; +let m_taylor_bounds = end_section_proof();; +(start_section_proof ["domain";"y";"w";"p";"f";"i";"d_bound"](`m_cell_domain domain y (w:real^N) ==> + p IN interval [domain] ==> + diff2_domain domain f ==> + m_taylor_partial_error f i domain w d_bound ==> + (!t. interval_arith t (&0, &1) ==> + abs (derivative (partial i f o (\t. y + t % (p - y))) t) <= d_bound)`));; +refine (by (VALID (((((USE_THM_THEN diff2_domain)(new_rewrite [] [])) THEN ((USE_THM_THEN m_taylor_partial_error)(new_rewrite [] []))) THEN (move ["domainH"]) THEN (move ["p_in"]) THEN (move ["df"]) THEN (move ["boundedH"]) THEN (move ["t"]) THEN (move ["t_in"])))));; +refine (by (VALID ((have_tac (move ["pt_in"]) (`y + t % (p - y) IN interval [domain]`)))));; +refine (by (VALID ((((USE_THM_THEN (VECTOR_ARITH `y + t % (p - y) = (&1 - t) % y + t % p:real^N`))(new_rewrite [] [])) THEN ((USE_THM_THEN IN_CONVEX_SET)(new_rewrite [] []))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THM_THEN y_in_domain)(fun fst_th ->(USE_THEN "domainH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN ((USE_THEN "p_in")(new_rewrite [] [])) THEN ((USE_THM_THEN interval_arith)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "t_in")(new_rewrite [] [])) THEN ((USE_THM_THEN pair_eq)(new_rewrite [] [])) THEN ((USE_THM_THEN CONVEX_INTERVAL)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN diff2_derivative_partial)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID ((((fun thm_tac -> (USE_THEN "boundedH")(fun fst_th ->(USE_THEN "pt_in")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN ((USE_THM_THEN (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))MP_TAC) THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID (((((USE_THM_THEN SUM_ABS_LE)(new_rewrite [] [])) THEN ((USE_THM_THEN FINITE_NUMSEG)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["j"]) THEN (move ["j_ineq"]) THEN (simp_tac)))));; +refine (by (VALID ((((USE_THM_THEN REAL_ABS_MUL)(new_rewrite [] [])) THEN ((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN REAL_LE_MUL2)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_ABS_POS)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_SUB_COMPONENT)(new_rewrite [] []))))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN domain_width)(fun fst_th ->(USE_THEN "domainH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN (done_tac)))));; +let diff2_derivative_partial_bound = end_section_proof();; +(start_section_proof ["domain";"y";"w";"p";"f";"i";"dd_bound"](`m_cell_domain domain y (w:real^N) ==> + p IN interval [domain] ==> + diff2_domain domain f ==> + m_taylor_partial_error f i domain w dd_bound ==> + abs (partial i f p - partial i f y) <= dd_bound`));; +refine (by (VALID ((((USE_THM_THEN diff2_domain)(new_rewrite [] [])) THEN (BETA_TAC THEN (move ["domainH"]) THEN (move ["p_in"]) THEN (move ["df"]) THEN (move ["partial_error"]))))));; +refine (by (VALID ((have_tac (move ["pt_in"]) (`!t. interval_arith t (&0, &1) ==> y + t % (p - y) IN interval [domain]`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (move ["t_in"])) THEN (((USE_THM_THEN (VECTOR_ARITH `y + t % (p - y) = (&1 - t) % y + t % p:real^N`))(new_rewrite [] [])) THEN ((USE_THM_THEN IN_CONVEX_SET)(new_rewrite [] [])))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THM_THEN y_in_domain)(fun fst_th ->(USE_THEN "domainH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN ((USE_THEN "p_in")(new_rewrite [] [])) THEN ((USE_THM_THEN interval_arith)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "t_in")(new_rewrite [] [])) THEN ((USE_THM_THEN pair_eq)(new_rewrite [] [])) THEN ((USE_THM_THEN CONVEX_INTERVAL)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN real_taylor1_bound)(ISPEC_THEN (`partial i f o (\t. y + t % (p - y))`) thm_tac))(ISPEC_THEN (mk_var("dd_bound",mk_type("real",[]))) thm_tac))MP_TAC) THEN BETA_TAC))));; +refine (by (VALID ((ANTS_TAC))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (move ["t_in"])) THEN (((USE_THM_THEN diff2_real_diff_partial)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "pt_in")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((fun thm_tac -> (USE_THM_THEN diff2_derivative_partial_bound)(fun fst_th ->(USE_THEN "domainH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN ((TRY done_tac)))))));; +refine (by (VALID ((((USE_THM_THEN diff2_domain)(new_rewrite [] [])) THEN (done_tac)))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN VECTOR_MUL_LID)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_MUL_LZERO)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_ADD_RID)(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL VECTOR_SUB_ADD2))(new_rewrite [] []))) THEN (done_tac)))));; +let m_taylor_partial_error_lemma = end_section_proof();; +(start_section_proof ["domain";"y";"w";"f";"i";"dd_bound";"hi";"hi_bound"](`m_cell_domain domain y (w:real^N) ==> + diff2_domain domain f ==> + m_taylor_partial_error f i domain w dd_bound ==> + partial i f y <= hi ==> + hi + dd_bound <= hi_bound ==> + !p. p IN interval [domain] ==> partial i f p <= hi_bound`));; +refine (by (VALID ((BETA_TAC THEN (move ["domainH"]) THEN (move ["df"]) THEN (move ["errorH"]) THEN (move ["df_bound"]) THEN (move ["total_bound"]) THEN (move ["p"]) THEN (move ["p_in"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN m_taylor_partial_error_lemma)(fun fst_th ->(USE_THEN "domainH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "p_in")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "errorH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC))));; +refine (by (VALID (((DISCH_THEN (fun snd_th -> (USE_THM_THEN (REAL_ARITH `!x y e. abs (x - y) <= e ==> x <= y + e`))(MATCH_MP_THEN snd_th MP_TAC))) THEN BETA_TAC THEN (move ["ineq"])))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID ((((USE_THEN "total_bound")MP_TAC) THEN (clear_assumption "total_bound") THEN ((USE_THM_THEN (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))MP_TAC) THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID (((((USE_THM_THEN REAL_LE_ADD2)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] []))) THEN (done_tac)))));; +let m_taylor_upper_partial_bound = end_section_proof();; +(start_section_proof ["domain";"y";"w";"f";"i";"dd_bound";"lo";"lo_bound"](`m_cell_domain domain y (w:real^N) ==> + diff2_domain domain f ==> + m_taylor_partial_error f i domain w dd_bound ==> + lo <= partial i f y ==> + lo_bound <= lo - dd_bound ==> + !p. p IN interval [domain] ==> lo_bound <= partial i f p`));; +refine (by (VALID ((BETA_TAC THEN (move ["domainH"]) THEN (move ["df"]) THEN (move ["errorH"]) THEN (move ["df_bound"]) THEN (move ["total_bound"]) THEN (move ["p"]) THEN (move ["p_in"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN m_taylor_partial_error_lemma)(fun fst_th ->(USE_THEN "domainH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "p_in")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "errorH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC))));; +refine (by (VALID (((DISCH_THEN (fun snd_th -> (USE_THM_THEN (REAL_ARITH `!x y e. abs (x - y) <= e ==> y - e <= x`))(MATCH_MP_THEN snd_th MP_TAC))) THEN BETA_TAC THEN (move ["ineq"])))));; +refine (by (VALID ((((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN ((USE_THM_THEN (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))MP_TAC) THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))(fun fst_th ->(USE_THEN "total_bound")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN real_sub)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_LE_ADD2)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] []))) THEN (done_tac)))));; +let m_taylor_lower_partial_bound = end_section_proof();; +(start_section_proof ["domain";"y";"w";"f";"i";"dd_bound";"lo";"hi";"lo_bound";"hi_bound"](`m_cell_domain domain y (w:real^N) ==> + diff2_domain domain f ==> + m_taylor_partial_error f i domain w dd_bound ==> + interval_arith (partial i f y) (lo, hi) ==> + lo_bound <= lo - dd_bound ==> + hi + dd_bound <= hi_bound ==> + m_bounded_on_int (partial i f) domain (lo_bound, hi_bound)`));; +refine (by (VALID (((((USE_THM_THEN m_bounded_on_int)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN interval_arith)(new_rewrite [] [])))) THEN (move ["domainH"]) THEN (move ["df"]) THEN (move ["errorH"]) THEN (case THEN ((move ["df_lo"]) THEN (move ["df_hi"]))) THEN (move ["lo_ineq"]) THEN (move ["hi_ineq"]) THEN (move ["p"]) THEN (move ["p_in"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN m_taylor_lower_partial_bound)(fun fst_th ->(USE_THEN "domainH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "errorH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "df_lo")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(ISPEC_THEN (mk_var("lo_bound",mk_type("real",[]))) thm_tac))MP_TAC) THEN BETA_TAC THEN (DISCH_THEN(new_rewrite [] [])) THEN ((TRY done_tac))))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN m_taylor_upper_partial_bound)(fun fst_th ->(USE_THEN "domainH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "errorH")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "df_hi")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(ISPEC_THEN (mk_var("hi_bound",mk_type("real",[]))) thm_tac))MP_TAC) THEN BETA_TAC THEN (DISCH_THEN(new_rewrite [] []))) THEN (done_tac)))));; +let m_taylor_partial_bounds = end_section_proof();; +let m_taylor_partial_bounds = finalize_theorem m_taylor_partial_bounds;; +let m_taylor_lower_partial_bound = finalize_theorem m_taylor_lower_partial_bound;; +let m_taylor_upper_partial_bound = finalize_theorem m_taylor_upper_partial_bound;; +let m_taylor_partial_error_lemma = finalize_theorem m_taylor_partial_error_lemma;; +let diff2_derivative_partial_bound = finalize_theorem diff2_derivative_partial_bound;; +let m_taylor_bounds = finalize_theorem m_taylor_bounds;; +let m_taylor_lower_bound = finalize_theorem m_taylor_lower_bound;; +let m_taylor_upper_bound = finalize_theorem m_taylor_upper_bound;; +let m_taylor_error_lemma = finalize_theorem m_taylor_error_lemma;; +let diff2_derivative2_bound = finalize_theorem diff2_derivative2_bound;; +let m_taylor_error_eq = finalize_theorem m_taylor_error_eq;; +let sum_swap1 = finalize_theorem sum_swap1;; +let domain_width = finalize_theorem domain_width;; +let y_in_domain = finalize_theorem y_in_domain;; +let diff2c_domain_alt = finalize_theorem diff2c_domain_alt;; +let mixed_second_partials = finalize_theorem mixed_second_partials;; +let real_mvt0 = finalize_theorem real_mvt0;; +let partial_eq0_alt = finalize_theorem partial_eq0_alt;; +let partial_const = finalize_theorem partial_const;; +let diff2_real_diff_partial = finalize_theorem diff2_real_diff_partial;; +let diff2_derivative_partial = finalize_theorem diff2_derivative_partial;; +let diff2_has_derivative_partial = finalize_theorem diff2_has_derivative_partial;; +let diff2_dir_derivative2 = finalize_theorem diff2_dir_derivative2;; +let diff2_dir = finalize_theorem diff2_dir;; +let open_contains_open_interval = finalize_theorem open_contains_open_interval;; +let in_trans = finalize_theorem in_trans;; +let diff2_partial_real_diff = finalize_theorem diff2_partial_real_diff;; +let diff2_dir_derivative = finalize_theorem diff2_dir_derivative;; +let diff2_imp_real_diff = finalize_theorem diff2_imp_real_diff;; +let diff2_eq_diff2_on_open = finalize_theorem diff2_eq_diff2_on_open;; +let diff2c_imp_diff2 = finalize_theorem diff2c_imp_diff2;; +let taylor_error_eq_sum_partial_errors = finalize_theorem taylor_error_eq_sum_partial_errors;; +let real_taylor1_bound = finalize_theorem real_taylor1_bound;; +let real_taylor2_bound = finalize_theorem real_taylor2_bound;; +(end_section "Taylor");; +(begin_section "Diff2Arith");; +(add_section_var (mk_var ("f", (`:real^N -> real`))); add_section_var (mk_var ("g", (`:real^N -> real`))));; +(add_section_var (mk_var ("x", (`:real^N`))));; +(add_section_var (mk_var ("domain", (`:real^N#real^N`))));; +(start_section_proof ["s";"f";"g";"x"](`f differentiable at x ==> open s ==> x IN s ==> (!y. y IN s ==> g y = f y) ==> + g differentiable at x`));; +refine (by (VALID ((((USE_THM_THEN OPEN_CONTAINS_BALL)(new_rewrite [] [])) THEN (move ["df"]) THEN (move ["open_s"]) THEN (move ["xs"]) THEN (move ["eq"])))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "open_s")(fun fst_th ->(USE_THEN "xs")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"]))) THEN ((((USE_THM_THEN SUBSET)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_BALL)(new_rewrite [] []))) THEN (move ["in_ball"]))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THM_THEN DIFFERENTIABLE_TRANSFORM_AT)(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "?1459839"]);mk_type("cart",[mk_type("real",[]);mk_vartype "?1459836"])]))) thm_tac))MP_TAC) THEN (DISCH_THEN apply_tac)) THEN (((USE_THEN "df")(new_rewrite [] [])) THEN ((USE_THM_THEN andbT)(new_rewrite [] [])))))));; +refine (by (VALID (((exists_tac (mk_var("d",mk_type("real",[])))) THEN ((((USE_THEN "d0")(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["z"]) THEN (move ["dzx"])) THEN (((USE_THEN "eq")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "in_ball")(new_rewrite [] [])) THEN ((USE_THM_THEN DIST_SYM)(new_rewrite [] []))) THEN (done_tac)))));; +let differentiable_local_at = end_section_proof();; +(begin_section "Point");; +(start_section_proof ["f";"c"](`diff2 f x ==> diff2 (\x. c * f x) x`));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN diff2)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])))));; +refine (by (VALID (((exists_tac (mk_var("s",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "N"]);mk_type("bool",[])])))) THEN ((((USE_THEN "open_s")(new_rewrite [] [])) THEN ((USE_THEN "xs")(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["z"]) THEN (move ["zs"]))))));; +refine (by (VALID (((THENL_FIRST) (((USE_THM_THEN f_lift_scale)(new_rewrite [] [])) THEN ((USE_THM_THEN DIFFERENTIABLE_CMUL)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))) (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN ((USE_THEN "df")(new_rewrite [] [])) THEN (done_tac))))));; +refine (by (VALID (((BETA_TAC THEN (move ["i"])) THEN (((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN differentiable_local_at)(ISPEC_THEN (mk_var("s",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "N"]);mk_type("bool",[])]))) thm_tac))(ISPEC_THEN (`lift o (\x. c * partial i f x)`) thm_tac))MP_TAC) THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID (((THENL_FIRST) (((USE_THEN "open_s")(new_rewrite [] [])) THEN ((USE_THEN "zs")(new_rewrite [] [])) THEN ((USE_THM_THEN f_lift_scale)(new_rewrite [] [])) THEN ((USE_THM_THEN DIFFERENTIABLE_CMUL)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))) (repeat_tactic 1 9 (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))) THEN ((USE_THEN "df")(new_rewrite [] [])) THEN (done_tac))))));; +refine (by (VALID (((BETA_TAC THEN (move ["y"]) THEN (move ["ys"])) THEN (repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN ((USE_THM_THEN partial_scale)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN LIFT_CMUL)(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_scale = end_section_proof();; +(start_section_proof ["f"](`diff2 f x ==> diff2 (\x. --f x) x`));; +refine (by (VALID ((((DISCH_THEN (fun snd_th -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN diff2_scale)(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "N"]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (`--(&1)`) thm_tac))(MATCH_MP_THEN snd_th MP_TAC))) THEN BETA_TAC) THEN ((USE_THM_THEN REAL_NEG_MINUS1)(GSYM_THEN (new_rewrite [] []))) THEN (done_tac)))));; +let diff2_neg = end_section_proof();; +(begin_section "Composite");; +(start_section_proof ["u";"f";"u'";"f'";"x"](`(lift o f has_derivative f') (at x) ==> + (u has_real_derivative u') (atreal (f x)) ==> + (lift o u o f has_derivative (\x. u' % f' x)) (at x)`));; +refine (by (VALID ((BETA_TAC THEN (move ["df"]) THEN (move ["du"])))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`lift o u o f = (lift o u o drop) o (lift o f)`)))));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN ((USE_THM_THEN LIFT_DROP)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((THENL_FIRST) (have_tac (DISCH_THEN(new_rewrite [] [])) (`(\x. u' % f' x) = (\x. u' % x) o f'`)) ((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac)) THEN (done_tac))))));; +refine (by (VALID (((((USE_THM_THEN DIFF_CHAIN_AT)(new_rewrite [] [])) THEN ((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL HAS_REAL_FRECHET_DERIVATIVE_AT))(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac)))));; +let has_derivative_uni_compose = end_section_proof();; +(start_section_proof ["u";"f";"x"](`lift o f differentiable at x ==> + u real_differentiable atreal (f x) ==> + lift o u o f differentiable at x`));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN differentiable)(new_rewrite [] []))) THEN ((USE_THM_THEN real_differentiable)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN (move ["f'"])) THEN (move ["df"]) THEN (case THEN (move ["u'"])) THEN (move ["du"])))));; +refine (by (VALID (((exists_tac (`\x. u' % f' x`)) THEN ((USE_THM_THEN has_derivative_uni_compose) apply_tac) THEN (done_tac)))));; +let diff_uni_compose = end_section_proof();; +(start_section_proof ["u";"f"](`diff2 f x ==> nth_diff_strong 2 u (f x) ==> diff2 (u o f) x`));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN diff2)(new_rewrite [] []))) THEN ((USE_THM_THEN nth_diff_strong2_eq)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["fxt"])) THEN (move ["du"])))));; +refine (by (VALID ((set_tac "r" (`{z | z IN s /\ (lift o f) z IN (IMAGE lift t)}`)))));; +refine (by (VALID ((have_tac (move ["open_r"]) (`open r`)))));; +refine (by (VALID ((((USE_THEN "r_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN CONTINUOUS_OPEN_PREIMAGE)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_OPEN)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "open_t")(new_rewrite [] [])) THEN ((USE_THEN "open_s")(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andbT)(new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN DIFFERENTIABLE_IMP_CONTINUOUS_ON) apply_tac) THEN (((USE_THM_THEN differentiable_on)(new_rewrite [] [])) THEN (move ["y"]) THEN (move ["ys"])) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))))));; +refine (by (VALID (((((USE_THM_THEN DIFFERENTIABLE_AT_WITHIN)(new_rewrite [] [])) THEN ((USE_THEN "df")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((THENL_FIRST) ((exists_tac (mk_var("r",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "N"]);mk_type("bool",[])])))) THEN (((USE_THEN "open_r")(new_rewrite [] [])) THEN ((USE_THEN "r_def")(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_ELIM_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN ((USE_THM_THEN LIFT_IN_IMAGE_LIFT)(new_rewrite [] []))) THEN (split_tac)) ((exists_tac (mk_var("x",mk_type("cart",[mk_type("real",[]);mk_vartype "N"])))) THEN (done_tac))))));; +refine (by (VALID ((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["z"])) THEN (case THEN ((case THEN (move ["zs"])) THEN (move ["fzt"]))) THEN (DISCH_THEN(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THM_THEN diff_uni_compose)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "du")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["i"])))));; +refine (by (VALID ((((USE_THM_THEN differentiable_local_at) apply_tac) THEN ((exists_tac (mk_var("r",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "N"]);mk_type("bool",[])])))) THEN (exists_tac (`lift o (\y. derivative u (f y) * partial i f y)`)))))));; +refine (by (VALID ((((USE_THEN "open_r")(new_rewrite [] [])) THEN ((USE_THM_THEN differentiable_mul)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN o_THM)(ISPEC_THEN (`derivative u`) thm_tac))(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))) THEN (((USE_THM_THEN diff_uni_compose)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THEN "du")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((THENL_FIRST) ((((USE_THEN "r_def")(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_ELIM_THM)(new_rewrite [] []))) THEN (simp_tac) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN LIFT_IN_IMAGE_LIFT)(new_rewrite [] [])))) THEN (split_tac)) ((exists_tac (mk_var("z",mk_type("cart",[mk_type("real",[]);mk_vartype "N"])))) THEN (done_tac))))));; +refine (by (VALID ((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["p"])) THEN (case THEN ((case THEN (move ["ps"])) THEN (move ["fpt"]))) THEN (DISCH_THEN(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THM_THEN partial_uni_compose)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "du")(new_rewrite [] [])))) THEN (done_tac)))));; +let diff2_uni_compose = end_section_proof();; +(start_section_proof [](`~(f x = &0) ==> diff2 f x ==> diff2 (inv o f) x`));; +refine (by (VALID (((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (USE_THM_THEN diff2_inv)(MATCH_MP_THEN snd_th MP_TAC))) THEN (move ["du"]) THEN (move ["df"])) THEN ((USE_THM_THEN diff2_uni_compose)(new_rewrite [] [])) THEN (done_tac)))));; +let diff2_inv_compose = end_section_proof();; +(start_section_proof [](`&0 < f x ==> diff2 f x ==> diff2 (sqrt o f) x`));; +refine (by (VALID (((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (USE_THM_THEN diff2_sqrt)(MATCH_MP_THEN snd_th MP_TAC))) THEN (move ["du"]) THEN (move ["df"])) THEN ((USE_THM_THEN diff2_uni_compose)(new_rewrite [] [])) THEN (done_tac)))));; +let diff2_sqrt_compose = end_section_proof();; +(start_section_proof [](`diff2 f x ==> diff2 (atn o f) x`));; +refine (by (VALID (((BETA_TAC THEN (move ["df"])) THEN (((USE_THM_THEN diff2_uni_compose)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2_atn)(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_atn_compose = end_section_proof();; +(start_section_proof [](`abs (f x) < &1 ==> diff2 f x ==> diff2 (acs o f) x`));; +refine (by (VALID (((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (USE_THM_THEN diff2_acs)(MATCH_MP_THEN snd_th MP_TAC))) THEN (move ["du"]) THEN (move ["df"])) THEN ((USE_THM_THEN diff2_uni_compose)(new_rewrite [] [])) THEN (done_tac)))));; +let diff2_acs_compose = end_section_proof();; +let diff2_acs_compose = finalize_theorem diff2_acs_compose;; +let diff2_atn_compose = finalize_theorem diff2_atn_compose;; +let diff2_sqrt_compose = finalize_theorem diff2_sqrt_compose;; +let diff2_inv_compose = finalize_theorem diff2_inv_compose;; +let diff2_uni_compose = finalize_theorem diff2_uni_compose;; +let diff_uni_compose = finalize_theorem diff_uni_compose;; +let has_derivative_uni_compose = finalize_theorem has_derivative_uni_compose;; +(end_section "Composite");; +(start_section_proof ["f";"g"](`diff2 f x ==> diff2 g x ==> diff2 (\x. f x + g x) x`));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN diff2)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["ys"])) THEN (move ["dg"])))));; +refine (by (VALID (((exists_tac (`s INTER t`)) THEN ((((USE_THM_THEN OPEN_INTER)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THEN "xs")(new_rewrite [] [])) THEN ((USE_THEN "ys")(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["z"]) THEN (case THEN ((move ["zs"]) THEN (move ["zt"]))))))));; +refine (by (VALID ((((USE_THM_THEN f_lift_add)(new_rewrite [] [])) THEN ((USE_THM_THEN DIFFERENTIABLE_ADD)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (((USE_THEN "df")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "dg")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["i"])) THEN (((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN differentiable_local_at)(ISPEC_THEN (`s INTER t`) thm_tac))(ISPEC_THEN (`lift o (\x. partial i f x + partial i g x)`) thm_tac))MP_TAC) THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID ((((USE_THM_THEN OPEN_INTER)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THEN "zt")(new_rewrite [] [])) THEN ((USE_THEN "zs")(new_rewrite [] [])) THEN ((USE_THM_THEN f_lift_add)(new_rewrite [] [])) THEN ((USE_THM_THEN DIFFERENTIABLE_ADD)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))) THEN (((USE_THEN "df")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "dg")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))) THEN (repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN ((USE_THM_THEN partial_add)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "dg")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN LIFT_ADD)(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_add = end_section_proof();; +(start_section_proof ["f";"g"](`diff2 f x ==> diff2 g x ==> diff2 (\x. f x - g x) x`));; +refine (by (VALID (((BETA_TAC THEN (move ["d2f"]) THEN (move ["d2g"])) THEN (((USE_THM_THEN real_sub)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2_add)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN diff2_neg)(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_sub = end_section_proof();; +(start_section_proof ["f";"g"](`diff2 f x ==> diff2 g x ==> diff2 (\x. f x * g x) x`));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN diff2)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["ys"])) THEN (move ["dg"])))));; +refine (by (VALID (((exists_tac (`s INTER t`)) THEN ((((USE_THM_THEN OPEN_INTER)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THEN "xs")(new_rewrite [] [])) THEN ((USE_THEN "ys")(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["z"]) THEN (case THEN ((move ["zs"]) THEN (move ["zt"]))))))));; +refine (by (VALID (((((USE_THM_THEN differentiable_mul)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "dg")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["i"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN differentiable_local_at)(ISPEC_THEN (`s INTER t`) thm_tac))(ISPEC_THEN (`lift o (\x. partial i f x * g x + f x * partial i g x)`) thm_tac))MP_TAC) THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID ((((USE_THM_THEN OPEN_INTER)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THEN "zt")(new_rewrite [] [])) THEN ((USE_THEN "zs")(new_rewrite [] [])) THEN ((USE_THM_THEN f_lift_add)(new_rewrite [] [])) THEN ((USE_THM_THEN DIFFERENTIABLE_ADD)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))) THEN repeat_tactic 1 9 (((USE_THM_THEN differentiable_mul)(new_rewrite [] []))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "dg")(new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))) THEN (repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN ((USE_THM_THEN partial_mul)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "dg")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN LIFT_ADD)(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_mul = end_section_proof();; +let diff2_mul = finalize_theorem diff2_mul;; +let diff2_sub = finalize_theorem diff2_sub;; +let diff2_add = finalize_theorem diff2_add;; +let diff2_acs_compose = finalize_theorem diff2_acs_compose;; +let diff2_atn_compose = finalize_theorem diff2_atn_compose;; +let diff2_sqrt_compose = finalize_theorem diff2_sqrt_compose;; +let diff2_inv_compose = finalize_theorem diff2_inv_compose;; +let diff2_uni_compose = finalize_theorem diff2_uni_compose;; +let diff_uni_compose = finalize_theorem diff_uni_compose;; +let has_derivative_uni_compose = finalize_theorem has_derivative_uni_compose;; +let diff2_neg = finalize_theorem diff2_neg;; +let diff2_scale = finalize_theorem diff2_scale;; +(end_section "Point");; +(begin_section "Domain");; +(add_section_hyp "d2f" (`diff2_domain domain f`));; +(start_section_proof ["c"](`diff2_domain domain (\x. c * f x)`));; +refine (by (VALID (((((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN diff2_domain)(new_rewrite [] []))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN (((USE_THM_THEN diff2_scale)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_domain_scale = end_section_proof();; +(start_section_proof [](`diff2_domain domain (\x. --f x)`));; +refine (by (VALID (((((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN diff2_domain)(new_rewrite [] []))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN (((USE_THM_THEN diff2_neg)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_domain_neg = end_section_proof();; +(add_section_var (mk_var ("bounds", (`:real#real`))));; +(start_section_proof [](`m_bounded_on_int f domain bounds ==> + interval_not_zero bounds ==> diff2_domain domain (inv o f)`));; +refine (by (VALID (((((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((USE_THM_THEN m_bounded_on_int)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN diff2_domain)(new_rewrite [] [])))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))))));; +refine (by (VALID (((((USE_THM_THEN diff2_inv_compose)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andbT)(new_rewrite [] [])) THEN ((fun thm_tac -> (USE_THM_THEN interval_arith_not_zero)(fun fst_th ->(fun thm_tac -> (USE_THEN "ineq")(fun fst_th ->(USE_THEN "x_in")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_domain_inv_compose = end_section_proof();; +(start_section_proof [](`m_bounded_on_int f domain bounds ==> + interval_pos bounds ==> diff2_domain domain (sqrt o f)`));; +refine (by (VALID (((((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((USE_THM_THEN m_bounded_on_int)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN diff2_domain)(new_rewrite [] [])))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))))));; +refine (by (VALID (((((USE_THM_THEN diff2_sqrt_compose)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andbT)(new_rewrite [] [])) THEN ((fun thm_tac -> (USE_THM_THEN interval_arith_pos)(fun fst_th ->(fun thm_tac -> (USE_THEN "ineq")(fun fst_th ->(USE_THEN "x_in")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_domain_sqrt_compose = end_section_proof();; +(start_section_proof [](`diff2_domain domain (atn o f)`));; +refine (by (VALID (((((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN diff2_domain)(new_rewrite [] []))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN (((USE_THM_THEN diff2_atn_compose)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_domain_atn_compose = end_section_proof();; +(start_section_proof [](`m_bounded_on_int f domain bounds ==> + iabs bounds < &1 ==> diff2_domain domain (acs o f)`));; +refine (by (VALID (((((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((USE_THM_THEN m_bounded_on_int)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN diff2_domain)(new_rewrite [] [])))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))))));; +refine (by (VALID (((((USE_THM_THEN diff2_acs_compose)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andbT)(new_rewrite [] [])) THEN ((fun thm_tac -> (USE_THM_THEN interval_arith_abs)(fun fst_th ->(fun thm_tac -> (USE_THEN "ineq")(fun fst_th ->(USE_THEN "x_in")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_domain_acs_compose = end_section_proof();; +(add_section_hyp "d2g" (`diff2_domain domain g`));; +(start_section_proof [](`diff2_domain domain (\x. f x + g x)`));; +refine (by (VALID (((((USE_THEN "d2g")MP_TAC) THEN (clear_assumption "d2g") THEN ((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN diff2_domain)(new_rewrite [] []))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN (((USE_THM_THEN diff2_add)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "d2g")(new_rewrite [] [])))) THEN (done_tac)))));; +let diff2_domain_add = end_section_proof();; +(start_section_proof [](`diff2_domain domain (\x. f x - g x)`));; +refine (by (VALID (((((USE_THEN "d2g")MP_TAC) THEN (clear_assumption "d2g") THEN ((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN diff2_domain)(new_rewrite [] []))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN (((USE_THM_THEN diff2_sub)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "d2g")(new_rewrite [] [])))) THEN (done_tac)))));; +let diff2_domain_sub = end_section_proof();; +(start_section_proof [](`diff2_domain domain (\x. f x * g x)`));; +refine (by (VALID (((((USE_THEN "d2g")MP_TAC) THEN (clear_assumption "d2g") THEN ((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN diff2_domain)(new_rewrite [] []))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN (((USE_THM_THEN diff2_mul)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "d2g")(new_rewrite [] [])))) THEN (done_tac)))));; +let diff2_domain_mul = end_section_proof();; +let diff2_domain_mul = finalize_theorem diff2_domain_mul;; +let diff2_domain_sub = finalize_theorem diff2_domain_sub;; +let diff2_domain_add = finalize_theorem diff2_domain_add;; +let diff2_domain_acs_compose = finalize_theorem diff2_domain_acs_compose;; +let diff2_domain_atn_compose = finalize_theorem diff2_domain_atn_compose;; +let diff2_domain_sqrt_compose = finalize_theorem diff2_domain_sqrt_compose;; +let diff2_domain_inv_compose = finalize_theorem diff2_domain_inv_compose;; +let diff2_domain_neg = finalize_theorem diff2_domain_neg;; +let diff2_domain_scale = finalize_theorem diff2_domain_scale;; +(end_section "Domain");; +(begin_section "SecondPartial");; +(start_section_proof ["f";"x"](`diff2 f x ==> (lift o f) differentiable at x`));; +refine (by (VALID (((((USE_THM_THEN diff2)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (DISCH_THEN(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_imp_diff = end_section_proof();; +(start_section_proof ["f";"i";"x"](`diff2 f x ==> (lift o partial i f) differentiable at x`));; +refine (by (VALID (((((USE_THM_THEN diff2)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (DISCH_THEN(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_imp_partial_diff = end_section_proof();; +(start_section_proof ["s";"f";"g";"i";"x"](`(lift o f) differentiable at x ==> + open s ==> x IN s ==> (!y:real^N. y IN s ==> f y = g y) ==> + partial i f x = partial i g x`));; +refine (by (VALID (((BETA_TAC THEN (move ["df"]) THEN (move ["open_s"]) THEN (move ["xs"]) THEN (move ["eq"])) THEN repeat_tactic 1 9 (((USE_THM_THEN partial)(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((USE_THM_THEN Arc_properties.HAS_REAL_DERIVATIVE_LOCAL)MP_TAC) THEN (clear_assumption "Arc_properties.HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID (((exists_tac (`g o (\t. x + t % basis i)`)) THEN (split_tac)))));; +refine (by (VALID (((((USE_THM_THEN has_derivative_alt)MP_TAC) THEN (clear_assumption "has_derivative_alt") THEN (DISCH_THEN apply_tac)) THEN ((USE_THM_THEN diff_imp_real_diff) apply_tac) THEN (((USE_THM_THEN diff_direction)(new_rewrite [] [])) THEN ((USE_THM_THEN andbT)(new_rewrite [] [])))))));; +refine (by (VALID (((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN differentiable_local_at)(ISPEC_THEN (mk_var("s",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "N"]);mk_type("bool",[])]))) thm_tac))(ISPEC_THEN (`lift o f`) thm_tac)) apply_tac))));; +refine (by (VALID ((((simp_tac) THEN ((USE_THM_THEN VECTOR_MUL_LZERO)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_ADD_RID)(new_rewrite [] [])) THEN ((USE_THEN "df")(new_rewrite [] [])) THEN ((USE_THEN "open_s")(new_rewrite [] [])) THEN ((USE_THEN "xs")(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["y"]) THEN (move ["ys"])))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN ((USE_THEN "eq")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN open_contains_open_interval)(fun fst_th ->(USE_THEN "open_s")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "xs")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(ISPEC_THEN (`basis i:real^N`) thm_tac))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN (move ["ab0"]))) THEN (((USE_THM_THEN SUBSET)(new_rewrite [] [])) THEN (move ["sub"]))))));; +refine (by (VALID (((exists_tac (`real_interval (a, b)`)) THEN ((((USE_THEN "ab0")(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_OPEN_REAL_INTERVAL)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["y"]) THEN (move ["y_in"]))))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THEN "eq")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "sub")(new_rewrite [] [])) THEN ((USE_THM_THEN IN_IMAGE)(new_rewrite [] [])) THEN (simp_tac)) THEN (exists_tac (mk_var("y",mk_type("real",[])))) THEN (done_tac)))));; +let partial_local = end_section_proof();; +(add_section_var (mk_var ("i", (`:num`))); add_section_var (mk_var ("j", (`:num`))));; +(start_section_proof ["f";"c"](`diff2 f x ==> partial2 i j (\x. c * f x) x = c * partial2 i j f x`));; +refine (by (VALID (((BETA_TAC THEN (move ["d2f"])) THEN (repeat_tactic 1 9 (((USE_THM_THEN partial2)(new_rewrite [] []))) THEN ((USE_THM_THEN partial_scale)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN diff2_imp_partial_diff)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN EQ_SYM_EQ)(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((USE_THM_THEN diff2)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]))))));; +refine (by (VALID ((((USE_THM_THEN partial_local) apply_tac) THEN (exists_tac (mk_var("s",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "N"]);mk_type("bool",[])])))) THEN (((USE_THEN "open_s")(new_rewrite [] [])) THEN ((USE_THEN "xs")(new_rewrite [] [])) THEN ((USE_THM_THEN f_lift_scale)(new_rewrite [] [])) THEN ((USE_THM_THEN DIFFERENTIABLE_CMUL)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] []))))))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))) THEN ((USE_THEN "df")(new_rewrite [] [])) THEN (done_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["y"]) THEN (move ["ys"])) THEN (((USE_THM_THEN partial_scale)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] [])))) THEN (done_tac)))));; +let second_partial_scale = end_section_proof();; +(start_section_proof ["f"](`diff2 f x ==> partial2 i j (\x. --f x) x = --partial2 i j f x`));; +refine (by (VALID ((((DISCH_THEN (fun snd_th -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN second_partial_scale)(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "N"]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (`--(&1)`) thm_tac))(MATCH_MP_THEN snd_th MP_TAC))) THEN BETA_TAC) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_NEG_MINUS1)(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac)))));; +let second_partial_neg = end_section_proof();; +(start_section_proof ["f";"g"](`diff2 f x ==> diff2 g x ==> + partial2 i j (\x. f x + g x) x = partial2 i j f x + partial2 i j g x`));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN diff2)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["ys"])) THEN (move ["dg"])))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN partial2)(new_rewrite [] []))) THEN ((USE_THM_THEN partial_add)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "dg")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN EQ_SYM_EQ)(new_rewrite [] []))) THEN ((USE_THM_THEN partial_local) apply_tac)))));; +refine (by (VALID (((exists_tac (`s INTER t`)) THEN (((USE_THM_THEN OPEN_INTER)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THEN "xs")(new_rewrite [] [])) THEN ((USE_THEN "ys")(new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN f_lift_add)(new_rewrite [] [])) THEN ((USE_THM_THEN DIFFERENTIABLE_ADD)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))) THEN (((USE_THEN "df")(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "dg")(new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["z"]) THEN (case THEN ((move ["zs"]) THEN (move ["zt"])))) THEN (((USE_THM_THEN partial_add)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "dg")(new_rewrite [] [])))) THEN (done_tac)))));; +let second_partial_add = end_section_proof();; +(start_section_proof ["f";"g"](`diff2 f x ==> diff2 g x ==> + partial2 i j (\x. f x - g x) x = partial2 i j f x - partial2 i j g x`));; +refine (by (VALID (((BETA_TAC THEN (move ["d2f"]) THEN (move ["d2g"])) THEN (((USE_THM_THEN real_sub)(new_rewrite [] [])) THEN ((USE_THM_THEN second_partial_add)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN diff2_neg)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN second_partial_neg)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN real_sub)(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac)))));; +let second_partial_sub = end_section_proof();; +(start_section_proof ["f";"g"](`diff2 f x ==> diff2 g x ==> + partial2 i j (\x. f x * g x) x = (partial2 i j f x * g x + partial j f x * partial i g x) + + (partial i f x * partial j g x + f x * partial2 i j g x)`));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN diff2)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["ys"])) THEN (move ["dg"])))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN partial2)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN partial_mul)(GSYM_THEN (new_rewrite [] [])))) THEN repeat_tactic 0 10 (((USE_THM_THEN partial_add)(GSYM_THEN (new_rewrite [] [])))) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "dg")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN repeat_tactic 0 1 (((USE_THM_THEN EQ_SYM_EQ)(new_rewrite [] [])))))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN differentiable_mul)(new_rewrite [] []))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "dg")(new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID (((USE_THM_THEN partial_local) apply_tac))));; +refine (by (VALID (((exists_tac (`s INTER t`)) THEN (((USE_THM_THEN OPEN_INTER)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THEN "xs")(new_rewrite [] [])) THEN ((USE_THEN "ys")(new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN f_lift_add)(new_rewrite [] [])) THEN ((USE_THM_THEN DIFFERENTIABLE_ADD)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))) THEN repeat_tactic 1 9 (((USE_THM_THEN differentiable_mul)(new_rewrite [] []))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "dg")(new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["z"]) THEN (case THEN ((move ["zs"]) THEN (move ["zt"])))) THEN (((USE_THM_THEN partial_mul)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "dg")(new_rewrite [] [])))) THEN (done_tac)))));; +let second_partial_mul = end_section_proof();; +(start_section_proof ["f";"u"](`diff2 f x ==> nth_diff_strong 2 u (f x) ==> + partial2 i j (u o f) x = (nth_derivative 2 u (f x) * partial i f x) * partial j f x + + derivative u (f x) * partial2 i j f x`));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN diff2)(new_rewrite [] []))) THEN ((USE_THM_THEN nth_diff_strong2_eq)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["fxt"])) THEN (move ["du"])))));; +refine (by (VALID ((set_tac "r" (`{z | z IN s /\ (lift o f) z IN (IMAGE lift t)}`)))));; +refine (by (VALID ((have_tac (move ["open_r"]) (`open r`)))));; +refine (by (VALID ((((USE_THEN "r_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN CONTINUOUS_OPEN_PREIMAGE)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_OPEN)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "open_t")(new_rewrite [] [])) THEN ((USE_THEN "open_s")(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andbT)(new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN DIFFERENTIABLE_IMP_CONTINUOUS_ON) apply_tac) THEN (((USE_THM_THEN differentiable_on)(new_rewrite [] [])) THEN (move ["y"]) THEN (move ["ys"])) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))))));; +refine (by (VALID (((((USE_THM_THEN DIFFERENTIABLE_AT_WITHIN)(new_rewrite [] [])) THEN ((USE_THEN "df")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN partial2)(new_rewrite [] []))) THEN ((USE_THM_THEN nth_derivative2)(new_rewrite [] []))))));; +refine (by (VALID ((((USE_THM_THEN partial_uni_compose)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "du")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((fun thm_tac -> (USE_THM_THEN o_THM)(ISPEC_THEN (`derivative u`) thm_tac))(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN partial_mul)(GSYM_THEN (new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THM_THEN diff_uni_compose)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "du")(new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN partial_local) apply_tac) THEN (exists_tac (mk_var("r",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "N"]);mk_type("bool",[])])))) THEN (((USE_THEN "open_r")(new_rewrite [] [])) THEN ((USE_THM_THEN andbT)(new_rewrite [] [])))))));; +refine (by (VALID (((THENL_ROT (-1)) ((((USE_THEN "r_def")(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_ELIM_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN ((USE_THM_THEN LIFT_IN_IMAGE_LIFT)(new_rewrite [] []))) THEN (split_tac))))));; +refine (by (VALID (((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["z"])) THEN (case THEN ((case THEN (move ["zs"])) THEN (move ["fpz"]))) THEN (DISCH_THEN(new_rewrite [] []))) THEN (((USE_THM_THEN partial_uni_compose)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "du")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((THENL_LAST) (split_tac) ((exists_tac (mk_var("x",mk_type("cart",[mk_type("real",[]);mk_vartype "N"])))) THEN (done_tac))))));; +refine (by (VALID ((((USE_THM_THEN differentiable_local_at) apply_tac) THEN ((exists_tac (mk_var("r",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "N"]);mk_type("bool",[])])))) THEN (exists_tac (`lift o (\y. derivative u (f y) * partial j f y)`)))))));; +refine (by (VALID ((((USE_THEN "open_r")(new_rewrite [] [])) THEN ((USE_THM_THEN differentiable_mul)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN o_THM)(ISPEC_THEN (`derivative u`) thm_tac))(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))) THEN (((USE_THM_THEN diff_uni_compose)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THEN "du")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((THENL_FIRST) ((((USE_THEN "r_def")(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_ELIM_THM)(new_rewrite [] []))) THEN (simp_tac) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN LIFT_IN_IMAGE_LIFT)(new_rewrite [] [])))) THEN (split_tac)) ((exists_tac (mk_var("x",mk_type("cart",[mk_type("real",[]);mk_vartype "N"])))) THEN (done_tac))))));; +refine (by (VALID (((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["p"])) THEN (case THEN ((case THEN (move ["ps"])) THEN (move ["fpt"]))) THEN (DISCH_THEN(new_rewrite [] []))) THEN (((USE_THM_THEN partial_uni_compose)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "du")(new_rewrite [] [])))) THEN (done_tac)))));; +let second_partial_uni_compose = end_section_proof();; +let second_partial_uni_compose = finalize_theorem second_partial_uni_compose;; +let second_partial_mul = finalize_theorem second_partial_mul;; +let second_partial_sub = finalize_theorem second_partial_sub;; +let second_partial_add = finalize_theorem second_partial_add;; +let second_partial_neg = finalize_theorem second_partial_neg;; +let second_partial_scale = finalize_theorem second_partial_scale;; +let partial_local = finalize_theorem partial_local;; +let diff2_imp_partial_diff = finalize_theorem diff2_imp_partial_diff;; +let diff2_imp_diff = finalize_theorem diff2_imp_diff;; +(end_section "SecondPartial");; +let second_partial_uni_compose = finalize_theorem second_partial_uni_compose;; +let second_partial_mul = finalize_theorem second_partial_mul;; +let second_partial_sub = finalize_theorem second_partial_sub;; +let second_partial_add = finalize_theorem second_partial_add;; +let second_partial_neg = finalize_theorem second_partial_neg;; +let second_partial_scale = finalize_theorem second_partial_scale;; +let partial_local = finalize_theorem partial_local;; +let diff2_imp_partial_diff = finalize_theorem diff2_imp_partial_diff;; +let diff2_imp_diff = finalize_theorem diff2_imp_diff;; +let diff2_domain_mul = finalize_theorem diff2_domain_mul;; +let diff2_domain_sub = finalize_theorem diff2_domain_sub;; +let diff2_domain_add = finalize_theorem diff2_domain_add;; +let diff2_domain_acs_compose = finalize_theorem diff2_domain_acs_compose;; +let diff2_domain_atn_compose = finalize_theorem diff2_domain_atn_compose;; +let diff2_domain_sqrt_compose = finalize_theorem diff2_domain_sqrt_compose;; +let diff2_domain_inv_compose = finalize_theorem diff2_domain_inv_compose;; +let diff2_domain_neg = finalize_theorem diff2_domain_neg;; +let diff2_domain_scale = finalize_theorem diff2_domain_scale;; +let diff2_mul = finalize_theorem diff2_mul;; +let diff2_sub = finalize_theorem diff2_sub;; +let diff2_add = finalize_theorem diff2_add;; +let diff2_acs_compose = finalize_theorem diff2_acs_compose;; +let diff2_atn_compose = finalize_theorem diff2_atn_compose;; +let diff2_sqrt_compose = finalize_theorem diff2_sqrt_compose;; +let diff2_inv_compose = finalize_theorem diff2_inv_compose;; +let diff2_uni_compose = finalize_theorem diff2_uni_compose;; +let diff_uni_compose = finalize_theorem diff_uni_compose;; +let has_derivative_uni_compose = finalize_theorem has_derivative_uni_compose;; +let diff2_neg = finalize_theorem diff2_neg;; +let diff2_scale = finalize_theorem diff2_scale;; +let differentiable_local_at = finalize_theorem differentiable_local_at;; +(end_section "Diff2Arith");; +(begin_section "Diff2c");; +(start_section_proof ["f";"g";"x";"s"](`g real_continuous at x ==> open s ==> x IN s ==> + (!y. y IN s ==> f y = g y) ==> f real_continuous at x`));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL real_continuous_at))(new_rewrite [] []))) THEN (move ["g_cont"]) THEN (move ["open_s"]) THEN (move ["xs"]) THEN (move ["f_eq_g"]) THEN (move ["e"]) THEN (move ["e_gt0"])))));; +refine (by (VALID (((((fun thm_tac -> (USE_THM_THEN OPEN_CONTAINS_BALL)(ISPEC_THEN (mk_var("s",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "?1460941"]);mk_type("bool",[])]))) thm_tac)) MP_TAC) THEN ALL_TAC) THEN (((USE_THEN "open_s")(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN ball)(new_rewrite [] [])) THEN ((USE_THM_THEN SUBSET)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_ELIM_THM)(new_rewrite [] [])) THEN (simp_tac))))));; +refine (by (VALID ((((fun thm_tac -> DISCH_THEN (fun fst_th ->(USE_THEN "xs")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["d0"])) THEN (case THEN (move ["d0_gt0"])) THEN (move ["sub_s"])))));; +refine (by (VALID ((((fun thm_tac -> (USE_THEN "g_cont")(fun fst_th ->(USE_THEN "e_gt0")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["d1"])) THEN (case THEN (move ["d1_gt0"])) THEN (move ["dist_cond"])))));; +refine (by (VALID ((exists_tac (`min d0 d1`)))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN REAL_LT_MIN)(new_rewrite [] []))) THEN ((USE_THEN "d1_gt0")(new_rewrite [] [])) THEN ((USE_THEN "d0_gt0")(new_rewrite [] [])) THEN (simp_tac)) THEN (move ["y"]) THEN (case THEN ((move ["yd0"]) THEN (move ["yd1"])))))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THEN "f_eq_g")(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID (((((USE_THEN "sub_s")(new_rewrite [] [])) THEN ((USE_THM_THEN DIST_SYM)(new_rewrite [] []))) THEN (exists_tac (mk_var("y",mk_type("cart",[mk_type("real",[]);mk_vartype "?1460941"])))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THEN "dist_cond")MP_TAC) THEN (clear_assumption "dist_cond") THEN (exact_tac)))));; +let real_cont_at_local = end_section_proof();; +(start_section_proof ["v";"u";"t";"x"](`v real_continuous atreal x ==> real_open t ==> x IN t ==> + (!y. y IN t ==> u y = v y) ==> u real_continuous atreal x`));; +refine (by (VALID (repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL REAL_CONTINUOUS_CONTINUOUS_ATREAL))(new_rewrite [] []))))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1))(GSYM_THEN (new_rewrite [] [])))) THEN ((USE_THM_THEN REAL_OPEN)(new_rewrite [] []))) THEN (move ["vc"]) THEN (move ["open_t"]) THEN (move ["xt"]) THEN (move ["v_eq_u"])))));; +refine (by (VALID (((USE_THM_THEN real_cont_at_local) apply_tac))));; +refine (by (VALID (((exists_tac (`v o drop`)) THEN (exists_tac (`IMAGE lift t`))))));; +refine (by (VALID ((((((USE_THEN "open_t")(new_rewrite [] [])) THEN ((USE_THEN "vc")(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN LIFT_IN_IMAGE_LIFT)(new_rewrite [] [])) THEN ((USE_THEN "xt")(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN IN_IMAGE_LIFT_DROP)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] [])))) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "v_eq_u")(MATCH_MP_THEN snd_th MP_TAC)))) THEN (done_tac)))));; +let real_cont_atreal_local = end_section_proof();; +(add_section_type (mk_var ("f", (`:real^N -> real`))); add_section_type (mk_var ("g", (`:real^N -> real`))));; +(add_section_var (mk_var ("x", (`:real^N`))));; +(add_section_var (mk_var ("domain", (`:real^N#real^N`))));; +(begin_section "Point");; +(start_section_proof ["f";"c"](`diff2c f x ==> diff2c (\x. c * f x) x`));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN diff2c)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN ((move ["d2f"]) THEN (move ["p2c"])))) THEN ((((USE_THM_THEN diff2_scale)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["i"]) THEN (move ["j"]))))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (USE_THEN "p2c")(ISPEC_THEN (mk_var("i",mk_type("num",[]))) thm_tac))(ISPEC_THEN (mk_var("j",mk_type("num",[]))) thm_tac))MP_TAC) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1))(GSYM_THEN (new_rewrite [] [])))) THEN (move ["p2ij"]))))));; +refine (by (VALID (((USE_THM_THEN real_cont_at_local) apply_tac))));; +refine (by (VALID (((((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((USE_THM_THEN diff2_eq_diff2_on_open)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["d2s"]))))));; +refine (by (VALID (((exists_tac (`(\x. c * partial2 j i f x)`)) THEN (exists_tac (mk_var("s",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "N"]);mk_type("bool",[])]))))))));; +refine (by (VALID (((THENL_FIRST) ((USE_THM_THEN REAL_CONTINUOUS_LMUL)(new_rewrite [] [])) (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (done_tac))))));; +refine (by (VALID (((((USE_THEN "open_s")(new_rewrite [] [])) THEN ((USE_THEN "xs")(new_rewrite [] [])) THEN (simp_tac)) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "d2s")(MATCH_MP_THEN snd_th MP_TAC))) THEN (move ["d2y"])))));; +refine (by (VALID ((((USE_THM_THEN second_partial_scale)(new_rewrite [] [])) THEN (done_tac)))));; +let diff2c_scale = end_section_proof();; +(start_section_proof ["f"](`diff2c f x ==> diff2c (\x. --f x) x`));; +refine (by (VALID ((((DISCH_THEN (fun snd_th -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN diff2c_scale)(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "N"]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (`--(&1)`) thm_tac))(MATCH_MP_THEN snd_th MP_TAC))) THEN BETA_TAC) THEN ((USE_THM_THEN REAL_NEG_MINUS1)(GSYM_THEN (new_rewrite [] []))) THEN (done_tac)))));; +let diff2c_neg = end_section_proof();; +(begin_section "Composite");; +(start_section_proof ["n";"u";"x"](`nth_diff_strong n u x ==> + ?s. real_open s /\ x IN s /\ (!y. y IN s ==> nth_diff_strong n u y)`));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["dt"])))));; +refine (by (VALID (((exists_tac (mk_var("t",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))) THEN ((((USE_THEN "xt")(new_rewrite [] [])) THEN ((USE_THEN "open_t")(new_rewrite [] [])) THEN (simp_tac)) THEN (move ["y"]) THEN (move ["yt"]))))));; +refine (by (VALID (((exists_tac (mk_var("t",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))) THEN (done_tac)))));; +let nth_diff_strong_eq_on_open = end_section_proof();; +(start_section_proof ["f";"x"](`diff2 f x ==> f real_continuous at x`));; +refine (by (VALID ((((USE_THM_THEN diff2)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])))));; +refine (by (VALID (((((USE_THM_THEN (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1))(new_rewrite [] [])) THEN ((USE_THM_THEN DIFFERENTIABLE_IMP_CONTINUOUS_AT)(new_rewrite [] [])) THEN ((USE_THEN "df")(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_imp_cont = end_section_proof();; +(start_section_proof ["f";"i";"x"](`diff2 f x ==> (partial i f) real_continuous at x`));; +refine (by (VALID ((((USE_THM_THEN diff2)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])))));; +refine (by (VALID (((((USE_THM_THEN (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1))(new_rewrite [] [])) THEN ((USE_THM_THEN DIFFERENTIABLE_IMP_CONTINUOUS_AT)(new_rewrite [] [])) THEN ((USE_THEN "df")(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_imp_partial_cont = end_section_proof();; +(start_section_proof ["u";"f";"x"](`diff2c f x ==> nth_diff_strong 2 u (f x) ==> + (nth_derivative 2 u) real_continuous atreal (f x) ==> diff2c (u o f) x`));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN diff2c)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN (move ["d2f"])) THEN (move ["p2c"]) THEN (move ["d2u"]) THEN (move ["u2c"])))));; +refine (by (VALID (((((USE_THM_THEN diff2_uni_compose)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "d2f")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "d2u")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["i"]) THEN (move ["j"])))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (USE_THEN "p2c")(ISPEC_THEN (mk_var("i",mk_type("num",[]))) thm_tac))(ISPEC_THEN (mk_var("j",mk_type("num",[]))) thm_tac))MP_TAC) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1))(GSYM_THEN (new_rewrite [] [])))) THEN (move ["p2ij"]))))));; +refine (by (VALID (((USE_THM_THEN real_cont_at_local) apply_tac))));; +refine (by (VALID (((((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((USE_THM_THEN diff2_eq_diff2_on_open)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["d2s"]))))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN nth_diff_strong_eq_on_open)(fun fst_th ->(USE_THEN "d2u")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["fxt"])) THEN (move ["d2t"])))));; +refine (by (VALID ((set_tac "r" (`{z | z IN s /\ (lift o f) z IN (IMAGE lift t)}`)))));; +refine (by (VALID ((have_tac (move ["open_r"]) (`open r`)))));; +refine (by (VALID ((((USE_THEN "r_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN CONTINUOUS_OPEN_PREIMAGE)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_OPEN)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "open_t")(new_rewrite [] [])) THEN ((USE_THEN "open_s")(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andbT)(new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN DIFFERENTIABLE_IMP_CONTINUOUS_ON) apply_tac) THEN (((USE_THM_THEN differentiable_on)(new_rewrite [] [])) THEN (move ["y"]) THEN (move ["ys"])) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))))));; +refine (by (VALID (((USE_THM_THEN DIFFERENTIABLE_AT_WITHIN)(new_rewrite [] [])))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "d2s")(fun fst_th ->(USE_THEN "ys")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC) THEN (((USE_THM_THEN diff2)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["s'"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["ys'"])))))));; +refine (by (VALID (((((fun thm_tac -> DISCH_THEN (fun fst_th ->(USE_THEN "ys'")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (simp_tac)) THEN (done_tac)))));; +refine (by (VALID (((exists_tac (`(\x. (nth_derivative 2 u (f x) * partial j f x) * partial i f x + derivative u (f x) * partial2 j i f x)`)) THEN (exists_tac (mk_var("r",mk_type("fun",[mk_type("cart",[mk_type("real",[]);mk_vartype "N"]);mk_type("bool",[])]))))))));; +refine (by (VALID (((THENL_ROT (-1)) ((((USE_THEN "open_r")(new_rewrite [] [])) THEN ((USE_THEN "r_def")(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_ELIM_THM)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN ((USE_THM_THEN LIFT_IN_IMAGE_LIFT)(new_rewrite [] []))) THEN (split_tac))))));; +refine (by (VALID ((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["z"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["zs"])) THEN (move ["fzt"]) THEN (move ["yz"])))));; +refine (by (VALID (((((USE_THM_THEN second_partial_uni_compose)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "yz")(new_rewrite [] [])) THEN ((USE_THEN "d2s")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "d2t")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((THENL_LAST) (split_tac) ((exists_tac (mk_var("x",mk_type("cart",[mk_type("real",[]);mk_vartype "N"])))) THEN (done_tac))))));; +refine (by (VALID (((((USE_THM_THEN REAL_CONTINUOUS_ADD)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_CONTINUOUS_MUL)(new_rewrite [] []))) THEN ((simp_tac THEN TRY done_tac))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (repeat_tactic 0 10 (((fun thm_tac ->(USE_THM_THEN diff2_imp_partial_cont)(fun tmp_th1 -> (USE_THEN "d2s")(fun tmp_th2 -> thm_tac (CONJ tmp_th1 tmp_th2))))(new_rewrite [] []))) THEN ((TRY done_tac)))))));; +refine (by (VALID (((((USE_THM_THEN andbT)(new_rewrite [] [])) THEN ((USE_THM_THEN o_THM)(GSYM_THEN (new_rewrite [] [(`nth_derivative 2 u _1`)])))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))))));; +refine (by (VALID (((USE_THM_THEN (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1))(new_rewrite [] [])))));; +refine (by (VALID ((((USE_THM_THEN o_ASSOC)(new_rewrite [] [])) THEN ((USE_THM_THEN CONTINUOUS_REAL_CONTINUOUS_AT_COMPOSE)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2_imp_cont)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "d2s")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THM_THEN (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1))(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_CONTINUOUS_ATREAL_WITHINREAL)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THEN "p2ij")(new_rewrite [] [])) THEN ((USE_THM_THEN andbT)(new_rewrite [] [])) THEN ((USE_THM_THEN o_THM)(GSYM_THEN (new_rewrite [] [(`derivative u _`)])))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))))));; +refine (by (VALID (((USE_THM_THEN (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1))(new_rewrite [] [])))));; +refine (by (VALID ((((USE_THM_THEN o_ASSOC)(new_rewrite [] [])) THEN ((USE_THM_THEN CONTINUOUS_REAL_CONTINUOUS_AT_COMPOSE)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2_imp_cont)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "d2s")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))))));; +refine (by (VALID ((((USE_THM_THEN (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1))(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_CONTINUOUS_ATREAL_WITHINREAL)(new_rewrite [] []))))));; +refine (by (VALID ((((USE_THM_THEN nth_derivative1)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN nth_derivative_continuous) apply_tac)))));; +refine (by (VALID (((THENL_LAST) ((exists_tac (`2`)) THEN (split_tac)) ((arith_tac) THEN (done_tac))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "d2t")(fun fst_th ->(USE_THEN "fxt")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC) THEN ((((USE_THM_THEN nth_diff_strong)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_differentiable_on)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN (move ["t'"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["fxt'"])) THEN (DISCH_THEN(new_rewrite [] []))) THEN (done_tac)))));; +let diff2c_uni_compose = end_section_proof();; +(start_section_proof ["s";"x"](`real_open s ==> real_open (s DELETE x)`));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN REAL_OPEN)(new_rewrite [] []))) THEN (DISCH_THEN (fun snd_th -> (USE_THM_THEN OPEN_DELETE)(MATCH_MP_THEN snd_th MP_TAC))) THEN ((fun thm_tac -> DISCH_THEN (ISPEC_THEN (`lift x`) thm_tac))MP_TAC)))));; +refine (by (VALID (((((USE_THM_THEN IMAGE_DELETE_INJ)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN LIFT_EQ)(new_rewrite [] [])))) THEN (done_tac)))));; +let real_open_delete = end_section_proof();; +(start_section_proof ["f"](`~(f x = &0) ==> diff2c f x ==> diff2c (inv o f) x`));; +refine (by (VALID (((BETA_TAC THEN (move ["fn0"]) THEN (move ["d2f"])) THEN ((USE_THM_THEN diff2c_uni_compose)(new_rewrite [] []))))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN diff2_inv)(fun fst_th ->(USE_THEN "fn0")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] [])) THEN (simp_tac)))));; +refine (by (VALID ((((USE_THM_THEN real_cont_atreal_local)MP_TAC) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID (((exists_tac (`\x. &2 * inv (x pow 3)`)) THEN (exists_tac (`UNIV DELETE (&0)`))))));; +refine (by (VALID (((THENL_ROT (-1)) ((((USE_THM_THEN real_open_delete)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_OPEN_UNIV)(new_rewrite [] []))) THEN (simp_tac) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_DELETE)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_UNIV)(new_rewrite [] []))) THEN ((USE_THEN "fn0")(new_rewrite [] [])) THEN (simp_tac)) THEN (split_tac))))));; +refine (by (VALID (((BETA_TAC THEN (move ["y"]) THEN (move ["yn0"])) THEN ((USE_THM_THEN second_derivative_inv)(new_rewrite [] [])) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN REAL_CONTINUOUS_LMUL)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_CONTINUOUS_INV_ATREAL)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_CONTINUOUS_POW)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_CONTINUOUS_AT_ID)(new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN REAL_POW_NZ)(new_rewrite [] [])) THEN (done_tac)))));; +let diff2c_inv_compose = end_section_proof();; +(start_section_proof ["f"](`&0 < f x ==> diff2c f x ==> diff2c (sqrt o f) x`));; +refine (by (VALID (((BETA_TAC THEN (move ["fn0"]) THEN (move ["d2f"])) THEN ((USE_THM_THEN diff2c_uni_compose)(new_rewrite [] []))))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN diff2_sqrt)(fun fst_th ->(USE_THEN "fn0")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] [])) THEN (simp_tac)))));; +refine (by (VALID ((((USE_THM_THEN real_cont_atreal_local)MP_TAC) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID (((exists_tac (`\x. -- inv (&4 * sqrt (x pow 3))`)) THEN (exists_tac (`{x | x > &0}`))))));; +refine (by (VALID (((THENL_ROT (-1)) ((((USE_THM_THEN REAL_OPEN_HALFSPACE_GT)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_ELIM_THM)(new_rewrite [] []))) THEN (simp_tac) THEN repeat_tactic 1 9 (((USE_THM_THEN real_gt)(new_rewrite [] [])))) THEN (split_tac))))));; +refine (by (VALID (((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["z"])) THEN (case THEN (move ["z0"])) THEN (DISCH_THEN(new_rewrite [] []))) THEN ((USE_THM_THEN second_derivative_sqrt)(new_rewrite [] [])) THEN (done_tac)))));; +refine (by (VALID (((THENL_LAST) (split_tac) ((exists_tac (`f x`)) THEN (done_tac))))));; +refine (by (VALID (((THENL_ROT (-1)) (((USE_THM_THEN REAL_CONTINUOUS_NEG)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_CONTINUOUS_INV_ATREAL)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_CONTINUOUS_LMUL)(new_rewrite [] [])))))));; +refine (by (VALID (((THENL_FIRST) ((((USE_THM_THEN REAL_ENTIRE)(new_rewrite [] [])) THEN ((USE_THM_THEN negb_or)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (split_tac)) ((arith_tac) THEN (done_tac))))));; +refine (by (VALID ((((USE_THM_THEN SQRT_EQ_0)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_POW_NZ)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_POS_NZ)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN REAL_POW_LE)(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THEN "fn0")MP_TAC) THEN (clear_assumption "fn0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`(\x. sqrt (x pow 3)) = (sqrt o (\x. x pow 3))`)))));; +refine (by (VALID (((((USE_THM_THEN FUN_EQ_THM)(new_rewrite [] [])) THEN ((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN REAL_CONTINUOUS_ATREAL_COMPOSE)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN REAL_CONTINUOUS_POW)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_CONTINUOUS_AT_ID)(new_rewrite [] []))) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THM_THEN REAL_CONTINUOUS_AT_SQRT)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_POW_LT)(new_rewrite [] []))) THEN (done_tac)))));; +let diff2c_sqrt_compose = end_section_proof();; +(start_section_proof ["f"](`diff2c f x ==> diff2c (atn o f) x`));; +refine (by (VALID (((BETA_TAC THEN (move ["d2f"])) THEN ((USE_THM_THEN diff2c_uni_compose)(new_rewrite [] []))))));; +refine (by (VALID ((((USE_THM_THEN diff2_atn)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN nth_derivative2)(new_rewrite [] [])) THEN ((USE_THM_THEN second_derivative_atn)(new_rewrite [] []))))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN REAL_CONTINUOUS_MUL)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_CONTINUOUS_CONST)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_CONTINUOUS_AT_ID)(new_rewrite [] []))) THEN ((simp_tac THEN TRY done_tac))))));; +refine (by (VALID ((((USE_THM_THEN REAL_CONTINUOUS_POW)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_CONTINUOUS_INV_ATREAL)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_CONTINUOUS_ADD)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THM_THEN REAL_CONTINUOUS_CONST)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_CONTINUOUS_POW)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_CONTINUOUS_AT_ID)(new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID (((USE_THM_THEN REAL_RNEG_UNIQ)(new_rewrite [] [])))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN REAL_LE_POW_2)(ISPEC_THEN (`f x`) thm_tac)) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID (((arith_tac) THEN (done_tac)))));; +let diff2c_atn_compose = end_section_proof();; +(start_section_proof ["f"](`abs (f x) < &1 ==> diff2c f x ==> diff2c (acs o f) x`));; +refine (by (VALID (((BETA_TAC THEN (move ["fn1"]) THEN (move ["d2f"])) THEN ((USE_THM_THEN diff2c_uni_compose)(new_rewrite [] []))))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN diff2_acs)(fun fst_th ->(USE_THEN "fn1")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] [])) THEN (simp_tac)))));; +refine (by (VALID ((((USE_THM_THEN real_cont_atreal_local)MP_TAC) THEN (clear_assumption "real_cont_atreal_local") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID (((exists_tac (`\x. --(x / sqrt ((&1 - x * x) pow 3))`)) THEN (exists_tac (`{x | x < &1} INTER {x | x > -- &1}`))))));; +refine (by (VALID ((((USE_THM_THEN REAL_OPEN_INTER)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_OPEN_HALFSPACE_GT)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_OPEN_HALFSPACE_LT)(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID (((THENL_ROT (-1)) ((repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_ELIM_THM)(new_rewrite [] []))) THEN (simp_tac) THEN repeat_tactic 1 9 (((USE_THM_THEN real_gt)(new_rewrite [] [])))) THEN (split_tac))))));; +refine (by (VALID (((BETA_TAC THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["a"])) THEN (case THEN (move ["a1"])) THEN (DISCH_THEN(new_rewrite [] [])) THEN (case THEN (move ["b"])) THEN (case THEN (move ["b1"])) THEN (move ["ab"])) THEN (((USE_THM_THEN second_derivative_acs)(new_rewrite [] [])) THEN ((TRY done_tac)))))));; +refine (by (VALID (((((USE_THEN "a1")MP_TAC) THEN (clear_assumption "a1") THEN ((USE_THEN "b1")MP_TAC) THEN (clear_assumption "b1") THEN ((USE_THEN "ab")MP_TAC) THEN (clear_assumption "ab") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((THENL_LAST) (split_tac) ((split_tac) THEN (exists_tac (`f x`)) THEN (((USE_THEN "fn1")MP_TAC) THEN (clear_assumption "fn1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID (((USE_THM_THEN REAL_CONTINUOUS_NEG)(new_rewrite [] [])))));; +refine (by (VALID (((USE_THM_THEN REAL_CONTINUOUS_DIV_ATREAL) apply_tac))));; +refine (by (VALID ((have_tac (move ["h"]) (`&0 < (&1 - f x * f x) pow 3`)))));; +refine (by (VALID (((USE_THM_THEN REAL_POW_LT)(new_rewrite [] [])))));; +refine (by (VALID ((((USE_THM_THEN (REAL_ARITH `!a. &1 - a * a = (&1 - a) * (&1 + a)`))(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LT_MUL)(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THEN "fn1")MP_TAC) THEN (clear_assumption "fn1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((THENL_ROT (-1)) ((((USE_THM_THEN REAL_CONTINUOUS_AT_ID)(new_rewrite [] [])) THEN (simp_tac)) THEN (split_tac))))));; +refine (by (VALID (((((USE_THM_THEN SQRT_EQ_0)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_LE_LT)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN REAL_LT_IMP_NZ)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`(\x. sqrt ((&1 - x * x) pow 3)) = sqrt o (\x. (&1 - x * x) pow 3)`)))));; +refine (by (VALID (((((USE_THM_THEN FUN_EQ_THM)(new_rewrite [] [])) THEN ((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN REAL_CONTINUOUS_ATREAL_COMPOSE)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_CONTINUOUS_AT_SQRT)(new_rewrite [] [])) THEN ((simp_tac THEN TRY done_tac))))));; +refine (by (VALID ((((USE_THM_THEN REAL_CONTINUOUS_POW)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_CONTINUOUS_SUB)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_CONTINUOUS_CONST)(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THM_THEN REAL_CONTINUOUS_MUL)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_CONTINUOUS_AT_ID)(new_rewrite [] [])))) THEN (done_tac)))));; +let diff2c_acs_compose = end_section_proof();; +let diff2c_acs_compose = finalize_theorem diff2c_acs_compose;; +let diff2c_atn_compose = finalize_theorem diff2c_atn_compose;; +let diff2c_sqrt_compose = finalize_theorem diff2c_sqrt_compose;; +let diff2c_inv_compose = finalize_theorem diff2c_inv_compose;; +let real_open_delete = finalize_theorem real_open_delete;; +let diff2c_uni_compose = finalize_theorem diff2c_uni_compose;; +let diff2_imp_partial_cont = finalize_theorem diff2_imp_partial_cont;; +let diff2_imp_cont = finalize_theorem diff2_imp_cont;; +let nth_diff_strong_eq_on_open = finalize_theorem nth_diff_strong_eq_on_open;; +(end_section "Composite");; +(start_section_proof ["f";"g"](`diff2c f x ==> diff2c g x ==> diff2c (\x. f x + g x) x`));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN diff2c)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN ((move ["d2f"]) THEN (move ["p2f"]))) THEN (case THEN ((move ["d2g"]) THEN (move ["p2g"])))) THEN ((((USE_THM_THEN diff2_add)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["i"]) THEN (move ["j"]))))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (USE_THEN "p2g")(ISPEC_THEN (mk_var("i",mk_type("num",[]))) thm_tac))(ISPEC_THEN (mk_var("j",mk_type("num",[]))) thm_tac))MP_TAC) THEN ((fun thm_tac -> (fun thm_tac -> (USE_THEN "p2f")(ISPEC_THEN (mk_var("i",mk_type("num",[]))) thm_tac))(ISPEC_THEN (mk_var("j",mk_type("num",[]))) thm_tac))MP_TAC) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1))(GSYM_THEN (new_rewrite [] [])))) THEN (move ["p2fij"]) THEN (move ["p2gij"]))))));; +refine (by (VALID (((USE_THM_THEN real_cont_at_local) apply_tac))));; +refine (by (VALID (((((USE_THEN "d2g")MP_TAC) THEN (clear_assumption "d2g") THEN ((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((USE_THM_THEN diff2_eq_diff2_on_open)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["d2f"]))))));; +refine (by (VALID ((((USE_THM_THEN diff2_eq_diff2_on_open)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["d2g"])))));; +refine (by (VALID (((exists_tac (`(\x. partial2 j i f x + partial2 j i g x)`)) THEN (exists_tac (`s INTER t`))))));; +refine (by (VALID (((THENL_FIRST) (repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THEN "xs")(new_rewrite [] [])) THEN ((USE_THEN "xt")(new_rewrite [] [])) THEN ((USE_THM_THEN OPEN_INTER)(new_rewrite [] [])) THEN ((simp_tac THEN TRY done_tac)) THEN ((USE_THM_THEN REAL_CONTINUOUS_ADD)(new_rewrite [] [])) THEN (simp_tac)) (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (done_tac))))));; +refine (by (VALID (((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))) THEN (((USE_THM_THEN second_partial_add)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "d2f")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "d2g")(new_rewrite [] [])))) THEN (done_tac)))));; +let diff2c_add = end_section_proof();; +(start_section_proof ["f";"g"](`diff2c f x ==> diff2c g x ==> diff2c (\x. f x - g x) x`));; +refine (by (VALID (((BETA_TAC THEN (move ["d2f"]) THEN (move ["d2g"])) THEN (((USE_THM_THEN real_sub)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2c_add)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN diff2c_neg)(new_rewrite [] []))) THEN (done_tac)))));; +let diff2c_sub = end_section_proof();; +(start_section_proof ["f";"g"](`diff2c f x ==> diff2c g x ==> diff2c (\x. f x * g x) x`));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN diff2c)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN ((move ["d2f"]) THEN (move ["p2f"]))) THEN (case THEN ((move ["d2g"]) THEN (move ["p2g"])))) THEN ((((USE_THM_THEN diff2_mul)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["i"]) THEN (move ["j"]))))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (USE_THEN "p2g")(ISPEC_THEN (mk_var("i",mk_type("num",[]))) thm_tac))(ISPEC_THEN (mk_var("j",mk_type("num",[]))) thm_tac))MP_TAC) THEN ((fun thm_tac -> (fun thm_tac -> (USE_THEN "p2f")(ISPEC_THEN (mk_var("i",mk_type("num",[]))) thm_tac))(ISPEC_THEN (mk_var("j",mk_type("num",[]))) thm_tac))MP_TAC) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1))(GSYM_THEN (new_rewrite [] [])))) THEN (move ["p2fij"]) THEN (move ["p2gij"]))))));; +refine (by (VALID (((USE_THM_THEN real_cont_at_local) apply_tac))));; +refine (by (VALID (((((USE_THEN "d2g")MP_TAC) THEN (clear_assumption "d2g") THEN ((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (((USE_THM_THEN diff2_eq_diff2_on_open)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["d2f"]))))));; +refine (by (VALID ((((USE_THM_THEN diff2_eq_diff2_on_open)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["d2g"])))));; +refine (by (VALID (((exists_tac (`(\x. (partial2 j i f x * g x + partial i f x * partial j g x) + + partial j f x * partial i g x + f x * partial2 j i g x)`)) THEN (exists_tac (`s INTER t`))))));; +refine (by (VALID (((THENL_ROT (-1)) ((repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THEN "xs")(new_rewrite [] [])) THEN ((USE_THEN "xt")(new_rewrite [] [])) THEN ((USE_THM_THEN OPEN_INTER)(new_rewrite [] [])) THEN ((simp_tac THEN TRY done_tac))) THEN (split_tac))))));; +refine (by (VALID (((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"])))) THEN (((USE_THM_THEN second_partial_mul)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "d2f")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "d2g")(new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN REAL_CONTINUOUS_ADD)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_CONTINUOUS_MUL)(new_rewrite [] [])))) THEN (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN ((TRY done_tac))) THEN (repeat_tactic 0 10 (((USE_THEN "p2gij")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "p2fij")(new_rewrite [] []))) THEN (simp_tac) THEN repeat_tactic 0 10 (((USE_THM_THEN diff2_imp_partial_cont)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN diff2_imp_cont)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "d2f")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "d2g")(new_rewrite [] [])))) THEN (done_tac)))));; +let diff2c_mul = end_section_proof();; +let diff2c_mul = finalize_theorem diff2c_mul;; +let diff2c_sub = finalize_theorem diff2c_sub;; +let diff2c_add = finalize_theorem diff2c_add;; +let diff2c_acs_compose = finalize_theorem diff2c_acs_compose;; +let diff2c_atn_compose = finalize_theorem diff2c_atn_compose;; +let diff2c_sqrt_compose = finalize_theorem diff2c_sqrt_compose;; +let diff2c_inv_compose = finalize_theorem diff2c_inv_compose;; +let real_open_delete = finalize_theorem real_open_delete;; +let diff2c_uni_compose = finalize_theorem diff2c_uni_compose;; +let diff2_imp_partial_cont = finalize_theorem diff2_imp_partial_cont;; +let diff2_imp_cont = finalize_theorem diff2_imp_cont;; +let nth_diff_strong_eq_on_open = finalize_theorem nth_diff_strong_eq_on_open;; +let diff2c_neg = finalize_theorem diff2c_neg;; +let diff2c_scale = finalize_theorem diff2c_scale;; +(end_section "Point");; +(begin_section "Domain");; +(add_section_var (mk_var ("f", (`:real^N -> real`))); add_section_var (mk_var ("g", (`:real^N -> real`))));; +(add_section_hyp "d2f" (`diff2c_domain domain f`));; +(start_section_proof ["c"](`diff2c_domain domain (\x. c * f x)`));; +refine (by (VALID (((((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN diff2c_domain)(new_rewrite [] []))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN (((USE_THM_THEN diff2c_scale)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] []))) THEN (done_tac)))));; +let diff2c_domain_scale = end_section_proof();; +(start_section_proof [](`diff2c_domain domain (\x. --f x)`));; +refine (by (VALID (((((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN diff2c_domain)(new_rewrite [] []))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN (((USE_THM_THEN diff2c_neg)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] []))) THEN (done_tac)))));; +let diff2c_domain_neg = end_section_proof();; +(add_section_var (mk_var ("bounds", (`:real#real`))));; +(start_section_proof [](`m_bounded_on_int f domain bounds ==> + interval_not_zero bounds ==> diff2c_domain domain (inv o f)`));; +refine (by (VALID (((((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((USE_THM_THEN m_bounded_on_int)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN diff2c_domain)(new_rewrite [] [])))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))))));; +refine (by (VALID (((((USE_THM_THEN diff2c_inv_compose)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andbT)(new_rewrite [] [])) THEN ((fun thm_tac -> (USE_THM_THEN interval_arith_not_zero)(fun fst_th ->(fun thm_tac -> (USE_THEN "ineq")(fun fst_th ->(USE_THEN "x_in")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] []))) THEN (done_tac)))));; +let diff2c_domain_inv_compose = end_section_proof();; +(start_section_proof [](`m_bounded_on_int f domain bounds ==> + interval_pos bounds ==> diff2c_domain domain (sqrt o f)`));; +refine (by (VALID (((((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((USE_THM_THEN m_bounded_on_int)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN diff2c_domain)(new_rewrite [] [])))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))))));; +refine (by (VALID (((((USE_THM_THEN diff2c_sqrt_compose)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andbT)(new_rewrite [] [])) THEN ((fun thm_tac -> (USE_THM_THEN interval_arith_pos)(fun fst_th ->(fun thm_tac -> (USE_THEN "ineq")(fun fst_th ->(USE_THEN "x_in")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] []))) THEN (done_tac)))));; +let diff2c_domain_sqrt_compose = end_section_proof();; +(start_section_proof [](`diff2c_domain domain (atn o f)`));; +refine (by (VALID (((((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN diff2c_domain)(new_rewrite [] []))) THEN (move ["d2f"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN (((USE_THM_THEN diff2c_atn_compose)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] []))) THEN (done_tac)))));; +let diff2c_domain_atn_compose = end_section_proof();; +(start_section_proof [](`m_bounded_on_int f domain bounds ==> + iabs bounds < &1 ==> diff2c_domain domain (acs o f)`));; +refine (by (VALID (((((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN ((((USE_THM_THEN m_bounded_on_int)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN diff2c_domain)(new_rewrite [] [])))) THEN (move ["d2f"]) THEN (move ["ineq"]) THEN (move ["n0"]) THEN (move ["x"]) THEN (move ["x_in"]))))));; +refine (by (VALID (((((USE_THM_THEN diff2c_acs_compose)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andbT)(new_rewrite [] [])) THEN ((fun thm_tac -> (USE_THM_THEN interval_arith_abs)(fun fst_th ->(fun thm_tac -> (USE_THEN "ineq")(fun fst_th ->(USE_THEN "x_in")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] []))) THEN (done_tac)))));; +let diff2c_domain_acs_compose = end_section_proof();; +(add_section_hyp "d2g" (`diff2c_domain domain g`));; +(start_section_proof [](`diff2c_domain domain (\x. f x + g x)`));; +refine (by (VALID (((((USE_THEN "d2g")MP_TAC) THEN (clear_assumption "d2g") THEN ((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN diff2c_domain)(new_rewrite [] []))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN (((USE_THM_THEN diff2c_add)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "d2g")(new_rewrite [] [])))) THEN (done_tac)))));; +let diff2c_domain_add = end_section_proof();; +(start_section_proof [](`diff2c_domain domain (\x. f x - g x)`));; +refine (by (VALID (((((USE_THEN "d2g")MP_TAC) THEN (clear_assumption "d2g") THEN ((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN diff2c_domain)(new_rewrite [] []))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN (((USE_THM_THEN diff2c_sub)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "d2g")(new_rewrite [] [])))) THEN (done_tac)))));; +let diff2c_domain_sub = end_section_proof();; +(start_section_proof [](`diff2c_domain domain (\x. f x * g x)`));; +refine (by (VALID (((((USE_THEN "d2g")MP_TAC) THEN (clear_assumption "d2g") THEN ((USE_THEN "d2f")MP_TAC) THEN (clear_assumption "d2f") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN diff2c_domain)(new_rewrite [] []))) THEN (move ["d2f"]) THEN (move ["d2g"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN (((USE_THM_THEN diff2c_mul)(new_rewrite [] [])) THEN ((USE_THEN "d2f")(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "d2g")(new_rewrite [] [])))) THEN (done_tac)))));; +let diff2c_domain_mul = end_section_proof();; +let diff2c_domain_mul = finalize_theorem diff2c_domain_mul;; +let diff2c_domain_sub = finalize_theorem diff2c_domain_sub;; +let diff2c_domain_add = finalize_theorem diff2c_domain_add;; +let diff2c_domain_acs_compose = finalize_theorem diff2c_domain_acs_compose;; +let diff2c_domain_atn_compose = finalize_theorem diff2c_domain_atn_compose;; +let diff2c_domain_sqrt_compose = finalize_theorem diff2c_domain_sqrt_compose;; +let diff2c_domain_inv_compose = finalize_theorem diff2c_domain_inv_compose;; +let diff2c_domain_neg = finalize_theorem diff2c_domain_neg;; +let diff2c_domain_scale = finalize_theorem diff2c_domain_scale;; +(end_section "Domain");; +let diff2c_domain_mul = finalize_theorem diff2c_domain_mul;; +let diff2c_domain_sub = finalize_theorem diff2c_domain_sub;; +let diff2c_domain_add = finalize_theorem diff2c_domain_add;; +let diff2c_domain_acs_compose = finalize_theorem diff2c_domain_acs_compose;; +let diff2c_domain_atn_compose = finalize_theorem diff2c_domain_atn_compose;; +let diff2c_domain_sqrt_compose = finalize_theorem diff2c_domain_sqrt_compose;; +let diff2c_domain_inv_compose = finalize_theorem diff2c_domain_inv_compose;; +let diff2c_domain_neg = finalize_theorem diff2c_domain_neg;; +let diff2c_domain_scale = finalize_theorem diff2c_domain_scale;; +let diff2c_mul = finalize_theorem diff2c_mul;; +let diff2c_sub = finalize_theorem diff2c_sub;; +let diff2c_add = finalize_theorem diff2c_add;; +let diff2c_acs_compose = finalize_theorem diff2c_acs_compose;; +let diff2c_atn_compose = finalize_theorem diff2c_atn_compose;; +let diff2c_sqrt_compose = finalize_theorem diff2c_sqrt_compose;; +let diff2c_inv_compose = finalize_theorem diff2c_inv_compose;; +let real_open_delete = finalize_theorem real_open_delete;; +let diff2c_uni_compose = finalize_theorem diff2c_uni_compose;; +let diff2_imp_partial_cont = finalize_theorem diff2_imp_partial_cont;; +let diff2_imp_cont = finalize_theorem diff2_imp_cont;; +let nth_diff_strong_eq_on_open = finalize_theorem nth_diff_strong_eq_on_open;; +let diff2c_neg = finalize_theorem diff2c_neg;; +let diff2c_scale = finalize_theorem diff2c_scale;; +let real_cont_atreal_local = finalize_theorem real_cont_atreal_local;; +let real_cont_at_local = finalize_theorem real_cont_at_local;; +(end_section "Diff2c");; +(begin_section "M_LinApprox");; +(add_section_var (mk_var ("f", (`:real^N -> real`))); add_section_var (mk_var ("g", (`:real^N -> real`))));; +(add_section_var (mk_var ("bounds", (`:real#real`))));; +(add_section_var (mk_var ("d_bounds_list", (`:(real#real)list`))));; +(add_section_var (mk_var ("x", (`:real^N`))));; +(start_section_proof [](`(lift o f) differentiable at x ==> + interval_arith (--f x) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (--partial i f x) int) ==> + m_lin_approx (\x. --f x) x bounds d_bounds_list`));; +refine (by (VALID ((BETA_TAC THEN (move ["df"]) THEN (move ["b"]) THEN (move ["db"])))));; +refine (by (VALID (((THENL_FIRST) (((USE_THM_THEN m_lin_approx)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THEN "b")(new_rewrite [] [])) THEN ((USE_THM_THEN f_lift_neg)(new_rewrite [] [])) THEN ((USE_THM_THEN DIFFERENTIABLE_NEG)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))) (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (done_tac))))));; +refine (by (VALID (((ASM_SIMP_TAC[partial_neg]) THEN (done_tac)))));; +let m_lin_approx_neg = end_section_proof();; +(start_section_proof ["c"](`(lift o f) differentiable at x ==> + interval_arith (c * f x) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (c * partial i f x) int) ==> + m_lin_approx (\x. c * f x) x bounds d_bounds_list`));; +refine (by (VALID ((BETA_TAC THEN (move ["df"]) THEN (move ["bH"]) THEN (move ["dbH"])))));; +refine (by (VALID (((THENL_FIRST) (((USE_THM_THEN m_lin_approx)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THEN "bH")(new_rewrite [] [])) THEN ((USE_THM_THEN f_lift_scale)(new_rewrite [] [])) THEN ((USE_THM_THEN DIFFERENTIABLE_CMUL)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))) (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (done_tac))))));; +refine (by (VALID (((ASM_SIMP_TAC[partial_scale]) THEN (done_tac)))));; +let m_lin_approx_scale = end_section_proof();; +(start_section_proof [](`(lift o f) differentiable at x ==> + (lift o g) differentiable at x ==> + interval_arith (f x + g x) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (partial i f x + partial i g x) int) ==> + m_lin_approx (\x. f x + g x) x bounds d_bounds_list`));; +refine (by (VALID ((BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["bH"]) THEN (move ["dbH"])))));; +refine (by (VALID (((THENL_FIRST) (((USE_THM_THEN m_lin_approx)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THEN "bH")(new_rewrite [] [])) THEN ((USE_THM_THEN f_lift_add)(new_rewrite [] [])) THEN ((USE_THM_THEN DIFFERENTIABLE_ADD)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))) (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (done_tac))))));; +refine (by (VALID (((ASM_SIMP_TAC[partial_add]) THEN (done_tac)))));; +let m_lin_approx_add = end_section_proof();; +(start_section_proof [](`(lift o f) differentiable at x ==> + (lift o g) differentiable at x ==> + interval_arith (f x - g x) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (partial i f x - partial i g x) int) ==> + m_lin_approx (\x. f x - g x) x bounds d_bounds_list`));; +refine (by (VALID ((BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["bH"]) THEN (move ["dbH"])))));; +refine (by (VALID (((THENL_FIRST) (((USE_THM_THEN m_lin_approx)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THEN "bH")(new_rewrite [] [])) THEN ((USE_THM_THEN f_lift_sub)(new_rewrite [] [])) THEN ((USE_THM_THEN DIFFERENTIABLE_SUB)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))) (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (done_tac))))));; +refine (by (VALID (((ASM_SIMP_TAC[partial_sub]) THEN (done_tac)))));; +let m_lin_approx_sub = end_section_proof();; +(start_section_proof [](`(lift o f) differentiable at x ==> + (lift o g) differentiable at x ==> + interval_arith (f x * g x) bounds ==> + all_n 1 d_bounds_list (\i int. interval_arith (partial i f x * g x + f x * partial i g x) int) ==> + m_lin_approx (\x. f x * g x) x bounds d_bounds_list`));; +refine (by (VALID ((BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["bH"]) THEN (move ["dbH"])))));; +refine (by (VALID ((((USE_THM_THEN m_lin_approx)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THEN "bH")(new_rewrite [] [])) THEN ((USE_THM_THEN differentiable_mul)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID (((ASM_SIMP_TAC[partial_mul]) THEN (done_tac)))));; +let m_lin_approx_mul = end_section_proof();; +let m_lin_approx_mul = finalize_theorem m_lin_approx_mul;; +let m_lin_approx_sub = finalize_theorem m_lin_approx_sub;; +let m_lin_approx_add = finalize_theorem m_lin_approx_add;; +let m_lin_approx_scale = finalize_theorem m_lin_approx_scale;; +let m_lin_approx_neg = finalize_theorem m_lin_approx_neg;; +(end_section "M_LinApprox");; +let second_bounded = new_definition `second_bounded f domain dd_bounds_list <=> + !x. x IN interval [domain] ==> all_n 1 dd_bounds_list + (\i list_i. all_n 1 list_i (\j int. interval_arith (partial2 j i f x) int))`;; +let m_taylor_interval = + new_definition `m_taylor_interval f domain y w f_bounds d_bounds_list dd_bounds_list <=> + m_cell_domain domain y w /\ + diff2c_domain domain f /\ + m_lin_approx f y f_bounds d_bounds_list /\ + second_bounded f domain dd_bounds_list`;; +(begin_section "M_TaylorIntervalArith");; +(add_section_var (mk_var ("f", (`:real^N -> real`))); add_section_var (mk_var ("g", (`:real^N -> real`))));; +(add_section_var (mk_var ("x", (`:real^N`))); add_section_var (mk_var ("z", (`:real^N`))); add_section_var (mk_var ("y", (`:real^N`))); add_section_var (mk_var ("w", (`:real^N`))));; +(add_section_var (mk_var ("domain", (`:real^N#real^N`))));; +(add_section_var (mk_var ("f_bounds", (`:real#real`))); add_section_var (mk_var ("g_bounds", (`:real#real`))); add_section_var (mk_var ("bounds", (`:real#real`))));; +(add_section_var (mk_var ("df_bounds_list", (`:(real#real)list`))); add_section_var (mk_var ("dg_bounds_list", (`:(real#real)list`))); add_section_var (mk_var ("d_bounds_list", (`:(real#real)list`))));; +(add_section_var (mk_var ("ddf_bounds_list", (`:((real#real)list)list`))); add_section_var (mk_var ("ddg_bounds_list", (`:((real#real)list)list`))); add_section_var (mk_var ("dd_bounds_list", (`:((real#real)list)list`))));; +(add_section_hyp "domainH" (`m_cell_domain domain y w`));; +(add_section_hyp "d2f" (`diff2c_domain domain f`));; +(start_section_proof [](`m_bounded_on_int f domain f_bounds ==> interval_not_zero f_bounds ==> + m_lin_approx (inv o f) y bounds d_bounds_list ==> + second_bounded (inv o f) domain dd_bounds_list ==> + m_taylor_interval (inv o f) domain y w bounds d_bounds_list dd_bounds_list`));; +refine (by (VALID (((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN ((USE_THM_THEN m_taylor_interval)(new_rewrite [] []))))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN diff2c_domain_inv_compose)(fun fst_th ->(USE_THEN "d2f")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "bf")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN (done_tac)))));; +let m_taylor_inv_compose = end_section_proof();; +(start_section_proof [](`m_bounded_on_int f domain f_bounds ==> interval_pos f_bounds ==> + m_lin_approx (sqrt o f) y bounds d_bounds_list ==> + second_bounded (sqrt o f) domain dd_bounds_list ==> + m_taylor_interval (sqrt o f) domain y w bounds d_bounds_list dd_bounds_list`));; +refine (by (VALID (((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN ((USE_THM_THEN m_taylor_interval)(new_rewrite [] []))))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN diff2c_domain_sqrt_compose)(fun fst_th ->(USE_THEN "d2f")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "bf")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN (done_tac)))));; +let m_taylor_sqrt_compose = end_section_proof();; +(start_section_proof [](`m_lin_approx (atn o f) y bounds d_bounds_list ==> + second_bounded (atn o f) domain dd_bounds_list ==> + m_taylor_interval (atn o f) domain y w bounds d_bounds_list dd_bounds_list`));; +refine (by (VALID (((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN (((USE_THM_THEN m_taylor_interval)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2c_domain_atn_compose)(new_rewrite [] []))) THEN (done_tac)))));; +let m_taylor_atn_compose = end_section_proof();; +(start_section_proof [](`m_bounded_on_int f domain f_bounds ==> iabs f_bounds < &1 ==> + m_lin_approx (acs o f) y bounds d_bounds_list ==> + second_bounded (acs o f) domain dd_bounds_list ==> + m_taylor_interval (acs o f) domain y w bounds d_bounds_list dd_bounds_list`));; +refine (by (VALID (((BETA_TAC THEN (move ["bf"]) THEN (move ["fn0"]) THEN (move ["lin"]) THEN (move ["second"])) THEN ((USE_THM_THEN m_taylor_interval)(new_rewrite [] []))))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN diff2c_domain_acs_compose)(fun fst_th ->(USE_THEN "d2f")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "bf")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN (done_tac)))));; +let m_taylor_acs_compose = end_section_proof();; +(start_section_proof [](`m_lin_approx (\x. --f x) y bounds d_bounds_list ==> + second_bounded (\x. --f x) domain dd_bounds_list ==> + m_taylor_interval (\x. --f x) domain y w bounds d_bounds_list dd_bounds_list`));; +refine (by (VALID (((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN (((USE_THM_THEN m_taylor_interval)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2c_domain_neg)(new_rewrite [] []))) THEN (done_tac)))));; +let m_taylor_neg = end_section_proof();; +(start_section_proof ["c"](`m_lin_approx (\x. c * f x) y bounds d_bounds_list ==> + second_bounded (\x. c * f x) domain dd_bounds_list ==> + m_taylor_interval (\x. c * f x) domain y w bounds d_bounds_list dd_bounds_list`));; +refine (by (VALID (((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN (((USE_THM_THEN m_taylor_interval)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2c_domain_scale)(new_rewrite [] []))) THEN (done_tac)))));; +let m_taylor_scale = end_section_proof();; +(add_section_hyp "d2g" (`diff2c_domain domain g`));; +(start_section_proof [](`m_lin_approx (\x. f x + g x) y bounds d_bounds_list ==> + second_bounded (\x. f x + g x) domain dd_bounds_list ==> + m_taylor_interval (\x. f x + g x) domain y w bounds d_bounds_list dd_bounds_list`));; +refine (by (VALID (((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN (((USE_THM_THEN m_taylor_interval)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2c_domain_add)(new_rewrite [] []))) THEN (done_tac)))));; +let m_taylor_add = end_section_proof();; +(start_section_proof [](`m_lin_approx (\x. f x - g x) y bounds d_bounds_list ==> + second_bounded (\x. f x - g x) domain dd_bounds_list ==> + m_taylor_interval (\x. f x - g x) domain y w bounds d_bounds_list dd_bounds_list`));; +refine (by (VALID (((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN (((USE_THM_THEN m_taylor_interval)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2c_domain_sub)(new_rewrite [] []))) THEN (done_tac)))));; +let m_taylor_sub = end_section_proof();; +(start_section_proof [](`m_lin_approx (\x. f x * g x) y bounds d_bounds_list ==> + second_bounded (\x. f x * g x) domain dd_bounds_list ==> + m_taylor_interval (\x. f x * g x) domain y w bounds d_bounds_list dd_bounds_list`));; +refine (by (VALID (((BETA_TAC THEN (move ["lin"]) THEN (move ["second"])) THEN (((USE_THM_THEN m_taylor_interval)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2c_domain_mul)(new_rewrite [] []))) THEN (done_tac)))));; +let m_taylor_mul = end_section_proof();; +let m_taylor_mul = finalize_theorem m_taylor_mul;; +let m_taylor_sub = finalize_theorem m_taylor_sub;; +let m_taylor_add = finalize_theorem m_taylor_add;; +let m_taylor_scale = finalize_theorem m_taylor_scale;; +let m_taylor_neg = finalize_theorem m_taylor_neg;; +let m_taylor_acs_compose = finalize_theorem m_taylor_acs_compose;; +let m_taylor_atn_compose = finalize_theorem m_taylor_atn_compose;; +let m_taylor_sqrt_compose = finalize_theorem m_taylor_sqrt_compose;; +let m_taylor_inv_compose = finalize_theorem m_taylor_inv_compose;; +(end_section "M_TaylorIntervalArith");; +(begin_section "PartialConvex");; +(add_section_type (mk_var ("f", (`:real^N->real`))));; +(start_section_proof ["f";"j";"x";"z";"u";"v";"hi"](`(!i. i IN 1..dimindex (:N) ==> ~(i = j) ==> u$i = z$i /\ v$i = x$i) ==> + u$j = x$j ==> v$j = z$j ==> + diff2_domain (x,z) f ==> + (!y. y IN interval [x,z] ==> &0 <= partial2 j j f y) ==> + (!y. y IN interval [x,u] ==> f y <= hi) ==> + (!y. y IN interval [v,z] ==> f y <= hi) ==> + (!y. y IN interval [x,z] ==> f y <= hi)`));; +refine (by (VALID ((((USE_THM_THEN IN_NUMSEG)(new_rewrite [] [])) THEN (move ["uv_eq"]) THEN (move ["ux_eq"]) THEN (move ["vz_eq"])))));; +refine (by (VALID ((((USE_THM_THEN diff2_domain)(new_rewrite [] [])) THEN (move ["diff2_f"]) THEN (move ["partial2_pos"]) THEN (move ["bound1"]) THEN (move ["bound2"]) THEN (move ["y"]) THEN (move ["y_in"])))));; +refine (by (VALID ((set_tac "y1" (`(lambda i. if i = j then x$j else y$i):real^N`)))));; +refine (by (VALID ((set_tac "y2" (`(lambda i. if i = j then z$j else y$i):real^N`)))));; +refine (by (VALID (((((USE_THEN "y_in")MP_TAC) THEN (clear_assumption "y_in") THEN BETA_TAC) THEN (((USE_THM_THEN (GEN_ALL IN_INTERVAL))(new_rewrite [] [])) THEN (move ["y_in"]))))));; +refine (by (VALID ((have_tac (ALL_TAC THEN (case THEN ((move ["y1_in"]) THEN (move ["y2_in"])))) (`y1 IN interval [x,u] /\ y2 IN interval [v,z]`)))));; +refine (by (VALID ((((USE_THEN "y1_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "y2_def")(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL IN_INTERVAL))(new_rewrite [] [])))))));; +refine (by (VALID ((((split_tac) THEN (move ["i"]) THEN (move ["i_ineq"])) THEN (((USE_THM_THEN (GEN_ALL LAMBDA_BETA))(new_rewrite [] [])) THEN ((TRY done_tac))) THEN (((fun thm_tac -> (USE_THM_THEN EXCLUDED_MIDDLE)(ISPEC_THEN (`i = j`) thm_tac))MP_TAC) THEN case THEN (simp_tac) THEN (move ["ij"])) THEN (repeat_tactic 0 10 (((fun thm_tac ->(USE_THEN "ux_eq")(fun tmp_th1 -> (USE_THEN "vz_eq")(fun tmp_th2 -> thm_tac (CONJ tmp_th1 tmp_th2))))(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] []))) THEN ((TRY done_tac))) THEN (((USE_THEN "uv_eq")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THEN "y_in")(new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID ((((THENL_ROT (-1)) (((fun thm_tac -> (USE_THM_THEN EXCLUDED_MIDDLE)(ISPEC_THEN (`j IN 1..dimindex (:N)`) thm_tac))MP_TAC) THEN case)) THEN (((USE_THM_THEN IN_NUMSEG)(new_rewrite [] [])) THEN (move ["j_in"]))))));; +refine (by (VALID (((THENL_FIRST) (((THENL_ROT 1)) (have_tac ALL_TAC (`y1 = y`))) ((BETA_TAC THEN (DISCH_THEN(GSYM_THEN (new_rewrite [] [])))) THEN (((USE_THEN "bound1")MP_TAC) THEN (clear_assumption "bound1") THEN (DISCH_THEN apply_tac)) THEN (done_tac))))));; +refine (by (VALID ((((USE_THM_THEN CART_EQ)(new_rewrite [] [])) THEN (move ["i"]) THEN (move ["i_in"])))));; +refine (by (VALID (((THENL_FIRST) (have_tac (move ["inj"]) (`~(i = j)`)) ((((USE_THEN "i_in")MP_TAC) THEN (clear_assumption "i_in") THEN ((USE_THEN "j_in")MP_TAC) THEN (clear_assumption "j_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID (((((USE_THEN "y1_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN (GEN_ALL LAMBDA_BETA))(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((THENL_ROT 1)) (have_tac ALL_TAC (`f y <= max (f y1) (f y2)`))))));; +refine (by (VALID ((BETA_TAC THEN (move ["cond"])))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN (REWRITE_RULE[GSYM IMP_IMP] REAL_LE_TRANS))(fun fst_th ->(USE_THEN "cond")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "bound2")(fun fst_th ->(USE_THEN "y2_in")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN ((fun thm_tac -> (USE_THEN "bound1")(fun fst_th ->(USE_THEN "y1_in")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((set_tac "g" (`f o (\t. y1 + t % basis j)`)))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`f y1 = g (&0)`)))));; +refine (by (VALID (((((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN VECTOR_MUL_LZERO)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_ADD_RID)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["y_eq"]) (`y = y1 + (y$j - x$j) % basis j /\ y2 = y1 + (z$j - x$j) % basis j`)))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN CART_EQ)(new_rewrite [] []))) THEN ((split_tac) THEN (move ["i"]) THEN (move ["i_in"])) THEN (((USE_THM_THEN VECTOR_ADD_COMPONENT)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_MUL_COMPONENT)(new_rewrite [] [])) THEN ((USE_THM_THEN BASIS_COMPONENT)(new_rewrite [] [])) THEN ((TRY done_tac))) THEN (((fun thm_tac -> (USE_THM_THEN EXCLUDED_MIDDLE)(ISPEC_THEN (`i = j`) thm_tac))MP_TAC) THEN case THEN (simp_tac) THEN (move ["ij"])) THEN (repeat_tactic 0 10 (((fun thm_tac ->(USE_THEN "y1_def")(fun tmp_th1 -> (USE_THEN "y2_def")(fun tmp_th2 -> thm_tac (CONJ tmp_th1 tmp_th2))))(GSYM_THEN (new_rewrite [] [])))) THEN repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL LAMBDA_BETA))(new_rewrite [] []))) THEN ((simp_tac THEN TRY done_tac)) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_MUL_RID)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_SUB_ADD2)(new_rewrite [] []))) THEN ((TRY done_tac)))))));; +refine (by (VALID (((((USE_THEN "ij")(new_rewrite [] [])) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((((USE_THEN "ij")(new_rewrite [] [])) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((THENL_FIRST) (have_tac (DISCH_THEN(new_rewrite [] [])) (`f y = g (y$j - x$j)`)) ((((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THEN "y_eq")(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac))))));; +refine (by (VALID (((THENL_FIRST) (have_tac (DISCH_THEN(new_rewrite [] [])) (`f y2 = g (z$j - x$j)`)) ((((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THEN "y_eq")(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac))))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN EXCLUDED_MIDDLE)(ISPEC_THEN (`z$j = x$j`) thm_tac))MP_TAC) THEN case THEN (move ["zx_j"])))));; +refine (by (VALID (((THENL_FIRST) (((THENL_ROT 1)) (have_tac ALL_TAC (`y$j = x$j`))) ((BETA_TAC THEN (DISCH_THEN(new_rewrite [] []))) THEN (((USE_THEN "zx_j")(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_SUB_REFL)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "y_in")(fun fst_th ->(USE_THEN "j_in")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC) THEN ((USE_THEN "zx_j")(new_rewrite [] [])) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((set_tac "t" (`(y$j - x$j) / (z$j - x$j)`)))));; +refine (by (VALID ((have_tac (move ["zx_pos"]) (`&0 < z$j - x$j`)))));; +refine (by (VALID ((((USE_THM_THEN (REAL_ARITH `!a b. &0 < a - b <=> ~(a = b) /\ b <= a`))(new_rewrite [] [])) THEN ((USE_THEN "zx_j")(new_rewrite [] [])) THEN (simp_tac)))));; +refine (by (VALID (((((USE_THM_THEN REAL_LE_TRANS)MP_TAC) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (`y$j`)) THEN repeat_tactic 1 9 (((USE_THEN "y_in")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["t_props"]) (`&0 <= t /\ t <= &1 /\ y$j - x$j = (&1 - t) * &0 + t * (z$j - x$j)`)))));; +refine (by (VALID ((((USE_THEN "t_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN Packing3.REAL_DIV_LE_1)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN REAL_MUL_RZERO)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_ADD_LID)(new_rewrite [] []))))));; +refine (by (VALID ((((USE_THM_THEN real_div)(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL REAL_MUL_ASSOC))(GSYM_THEN (new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN REAL_MUL_LINV)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_SUB_0)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN REAL_MUL_RID)(new_rewrite [] [])) THEN (simp_tac)))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN real_sub)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_LE_RADD)(new_rewrite [] [])) THEN ((USE_THEN "y_in")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andbT)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN real_sub)(GSYM_THEN (new_rewrite [] []))))))));; +refine (by (VALID (((THENL_FIRST) (((USE_THM_THEN REAL_LE_MUL)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_INV)(new_rewrite [] []))) (((USE_THM_THEN (REAL_ARITH `!a. &0 < a ==> &0 <= a`))(new_rewrite [] [])) THEN (done_tac))))));; +refine (by (VALID (((((USE_THM_THEN REAL_SUB_LE)(new_rewrite [] [])) THEN ((USE_THEN "y_in")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THEN "t_props")(new_rewrite [] [])) THEN (((USE_THM_THEN (GEN_ALL REAL_CONVEX_LOWER))MP_TAC) THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID ((exists_tac (`real_interval [&0, z$j - x$j]`)))));; +refine (by (VALID ((((USE_THM_THEN REAL_SUB_ADD)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_SUB_LE)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THEN "t_props")(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] []))) THEN (simp_tac)))));; +refine (by (VALID ((((USE_THM_THEN (REAL_ARITH `!a. &0 < a ==> &0 <= a`))(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andbT)(new_rewrite [] []))))));; +refine (by (VALID (((set_tac "s" (`real_interval _`)) THEN (((USE_THEN "t_props")MP_TAC) THEN (clear_assumption "t_props") THEN ((USE_THEN "t_def")MP_TAC) THEN (clear_assumption "t_def") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]))))));; +refine (by (VALID ((have_tac (move ["in_s"]) (`!t. t IN s ==> y1 + t % basis j IN interval [x,z]`)))));; +refine (by (VALID (((((USE_THEN "s_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL IN_INTERVAL))(new_rewrite [] []))) THEN (move ["t"]) THEN (move ["t_ineq"]) THEN (move ["i"]) THEN (move ["i_ineq"])))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN VECTOR_ADD_COMPONENT)(new_rewrite [] []))) THEN ((USE_THM_THEN VECTOR_MUL_COMPONENT)(new_rewrite [] [])) THEN ((USE_THM_THEN BASIS_COMPONENT)(new_rewrite [] [])) THEN ((TRY done_tac))))));; +refine (by (VALID ((((USE_THEN "y1_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN (GEN_ALL LAMBDA_BETA))(new_rewrite [] [])) THEN ((simp_tac THEN TRY done_tac))))));; +refine (by (VALID (((THENL_ROT (-1)) (((fun thm_tac -> (USE_THM_THEN EXCLUDED_MIDDLE)(ISPEC_THEN (`i = j`) thm_tac))MP_TAC) THEN case THEN (simp_tac) THEN (move ["ij"]))))));; +refine (by (VALID (((((USE_THM_THEN REAL_MUL_RZERO)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_ADD_RID)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THEN "y_in")(new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THEN "t_ineq")MP_TAC) THEN (clear_assumption "t_ineq") THEN ((fun thm_tac -> (USE_THEN "y_in")(fun fst_th ->(USE_THEN "i_ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC) THEN ((USE_THEN "ij")(new_rewrite [] [])) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["diff2_g"]) (`!t. t IN s ==> nth_diff_strong 2 g t`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (move ["ts"])) THEN ((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] []))) THEN (((USE_THM_THEN diff2_dir)(new_rewrite [] [])) THEN ((USE_THEN "diff2_f")(new_rewrite [] [])) THEN ((USE_THEN "in_s")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["dg"]) (`!t. t IN s ==> derivative g t = partial j f (y1 + t % basis j)`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (move ["ts"])) THEN ((USE_THM_THEN partial)(new_rewrite [] []))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "in_s")(fun fst_th ->(USE_THEN "ts")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (move ["p_in"])) THEN (set_tac "h" (`f o _`))))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`h = g o (\t'. t + t')`)))));; +refine (by (VALID ((((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "h_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] [])))) THEN (move ["r"])) THEN (repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (simp_tac))))));; +refine (by (VALID (((((USE_THM_THEN (GEN_ALL VECTOR_ADD_RDISTRIB))(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL VECTOR_ADD_ASSOC))(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN derivative_translation)(GSYM_THEN (new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "diff2_g")(fun fst_th ->(USE_THEN "ts")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC) THEN (((USE_THM_THEN nth_diff_strong2_eq)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["e"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["te"])) THEN (DISCH_THEN(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["d2g"]) (`!t. t IN s ==> nth_derivative 2 g t = partial2 j j f (y1 + t % basis j)`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (move ["ts"])) THEN (((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN diff2_dir_derivative2)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "diff2_f")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "in_s")(new_rewrite [] []))) THEN ((TRY done_tac)))))));; +refine (by (VALID ((have_tac (move ["s_eq"]) (`1..dimindex (:N) = ((1..dimindex (:N)) DELETE j) UNION {j}`)))));; +refine (by (VALID ((((((USE_THM_THEN EXTENSION)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_UNION)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_SING)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_DELETE)(new_rewrite [] []))) THEN (move ["i"])) THEN (split_tac)))));; +refine (by (VALID (((BETA_TAC THEN (DISCH_THEN(new_rewrite [] []))) THEN (((USE_THM_THEN andTb)(new_rewrite [] [])) THEN ((USE_THM_THEN orNb)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((case THEN (simp_tac)) THEN ((USE_THM_THEN IN_NUMSEG)(new_rewrite [] [])) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["disj"]) (`DISJOINT ((1..dimindex (:N)) DELETE j) {j}`)))));; +refine (by (VALID (((((USE_THM_THEN DISJOINT)(new_rewrite [] [])) THEN ((USE_THM_THEN EXTENSION)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_INTER)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_SING)(new_rewrite [] [])) THEN ((USE_THM_THEN NOT_IN_EMPTY)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_DELETE)(new_rewrite [] []))) THEN (move ["i"])))));; +refine (by (VALID (((((USE_THM_THEN andbA)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN andNb)(new_rewrite [] [])) THEN ((USE_THM_THEN andbF)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THEN "s_eq")(new_rewrite [1] [])) THEN ((USE_THM_THEN SUM_UNION)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN FINITE_DELETE)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN FINITE_NUMSEG)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN FINITE_SING)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN SUM_SING)(new_rewrite [] [])) THEN (simp_tac)))));; +refine (by (VALID ((((USE_THM_THEN SUM_EQ_0)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN IN_DELETE)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_ADD_LID)(new_rewrite [] [])))))));; +refine (by (VALID (((BETA_TAC THEN (move ["i"]) THEN (move ["i_in"])) THEN (((USE_THM_THEN SUM_EQ_0) apply_tac) THEN (move ["k"]) THEN (move ["k_in"]) THEN (simp_tac))))));; +refine (by (VALID (((((USE_THM_THEN BASIS_COMPONENT)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN IN_NUMSEG)(GSYM_THEN (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN ((USE_THEN "i_in")(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN REAL_MUL_LZERO)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THEN "s_eq")(new_rewrite [] [])) THEN ((USE_THM_THEN SUM_UNION)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN FINITE_DELETE)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN FINITE_NUMSEG)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN FINITE_SING)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN SUM_SING)(new_rewrite [] [])) THEN (simp_tac)))));; +refine (by (VALID ((((USE_THM_THEN SUM_EQ_0)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN IN_DELETE)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_ADD_LID)(new_rewrite [] [])))))));; +refine (by (VALID (((BETA_TAC THEN (move ["i"]) THEN (move ["i_in"]) THEN (simp_tac)) THEN ((USE_THM_THEN REAL_ENTIRE)(new_rewrite [] [])) THEN (DISJ2_TAC)))));; +refine (by (VALID (((((USE_THM_THEN BASIS_COMPONENT)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN IN_NUMSEG)(GSYM_THEN (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN ((USE_THEN "i_in")(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN REAL_MUL_LZERO)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN BASIS_COMPONENT)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "j_in")(new_rewrite [] []))) THEN ((simp_tac THEN TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_MUL_LID)(new_rewrite [] []))) THEN ((USE_THM_THEN partial2)(new_rewrite [] [])) THEN ((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN REAL_CONVEX_ON_SECOND_DERIVATIVE)(ISPEC_THEN (mk_var("g",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (`derivative g`) thm_tac))(ISPEC_THEN (`nth_derivative 2 g`) thm_tac))(ISPEC_THEN (mk_var("s",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])]))) thm_tac)) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID (((THENL_ROT (-1)) ((((USE_THEN "s_def")(GSYM_THEN (new_rewrite [1; 2] []))) THEN ((USE_THM_THEN IS_REALINTERVAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])) THEN ((USE_THM_THEN NOT_EXISTS_THM)(new_rewrite [] []))) THEN (DISCH_THEN(new_rewrite [] [])))))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (move ["ts"])) THEN (((USE_THEN "d2g")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "partial2_pos")(new_rewrite [] [])) THEN ((USE_THEN "in_s")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((split_tac))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"])) THEN (((USE_THM_THEN contraT)MP_TAC) THEN (clear_assumption "contraT") THEN (DISCH_THEN apply_tac)) THEN ((((USE_THM_THEN negbK)(new_rewrite [] [])) THEN ((USE_THM_THEN EXTENSION)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_SING)(new_rewrite [] []))) THEN (move ["eq"]))))));; +refine (by (VALID (((((USE_THEN "zx_pos")MP_TAC) THEN (clear_assumption "zx_pos") THEN ((fun thm_tac -> (USE_THEN "eq")(ISPEC_THEN (`z$j - x$j`) thm_tac))MP_TAC) THEN ((fun thm_tac -> (USE_THEN "eq")(ISPEC_THEN (`&0`) thm_tac))MP_TAC) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] []))))))));; +refine (by (VALID (((arith_tac) THEN (done_tac)))));; +refine (by (VALID (((split_tac) THEN (move ["t"]) THEN (move ["ts"])))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "diff2_g")(fun fst_th ->(USE_THEN "ts")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC) THEN (((USE_THM_THEN nth_diff_strong2_eq_alt)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["e"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["te"])) THEN (move ["H"]))))));; +refine (by (VALID (((((USE_THM_THEN HAS_REAL_DERIVATIVE_ATREAL_WITHIN)(new_rewrite [] [])) THEN ((USE_THEN "H")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "diff2_g")(fun fst_th ->(USE_THEN "ts")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC) THEN (((USE_THM_THEN nth_diff_strong2_eq_alt)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["e"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["te"])) THEN (move ["H"]))))));; +refine (by (VALID (((((USE_THM_THEN HAS_REAL_DERIVATIVE_ATREAL_WITHIN)(new_rewrite [] [])) THEN ((USE_THEN "H")(new_rewrite [] []))) THEN (done_tac)))));; +let partial_convex_max = end_section_proof();; +let partial_convex_max = finalize_theorem partial_convex_max;; +(end_section "PartialConvex");; +(begin_section "ElementaryFunctions");; +(start_section_proof ["c"](`lift o (\x. c) = (\x. lift c)`));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (done_tac)))));; +let f_lift_const = end_section_proof();; +(start_section_proof ["f"](`lift o (\x. f x) = (\x. lift (f x))`));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN (done_tac)))));; +let f_lift_unary = end_section_proof();; +(start_section_proof ["c";"x"](`diff2 (\x:real^N. c) x`));; +refine (by (VALID ((((USE_THM_THEN diff2)(new_rewrite [] [])) THEN (exists_tac (`(:real^N)`)) THEN ((((USE_THM_THEN OPEN_UNIV)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_UNIV)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["y"]) THEN (move ["_"]))))));; +refine (by (VALID (((((USE_THM_THEN partial_const)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN f_lift_const)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN DIFFERENTIABLE_CONST)(new_rewrite [] [])))) THEN (done_tac)))));; +let diff2_const = end_section_proof();; +(start_section_proof ["c";"domain"](`diff2_domain domain (\x:real^N. c)`));; +refine (by (VALID (((((USE_THM_THEN diff2_domain)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2_const)(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_domain_const = end_section_proof();; +(start_section_proof ["i";"j";"c"](`partial2 i j (\x:real^N. c) = (\x. &0)`));; +refine (by (VALID (((((USE_THM_THEN partial2)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN partial_const)(new_rewrite [] [])))) THEN (done_tac)))));; +let partial2_const = end_section_proof();; +(start_section_proof ["c";"x"](`diff2c (\x:real^N. c) x`));; +refine (by (VALID (((((USE_THM_THEN diff2c)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2_const)(new_rewrite [] [])) THEN ((USE_THM_THEN partial2_const)(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1))(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_CONTINUOUS_CONST)(new_rewrite [] []))) THEN (done_tac)))));; +let diff2c_const = end_section_proof();; +(start_section_proof ["c";"domain"](`diff2c_domain domain (\x:real^N. c)`));; +refine (by (VALID (((((USE_THM_THEN diff2c_domain)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2c_const)(new_rewrite [] []))) THEN (done_tac)))));; +let diff2c_domain_const = end_section_proof();; +(start_section_proof ["k";"i"](`partial i (\x:real^N. x$k) = (\x. (basis i:real^N)$k)`));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN partial)(new_rewrite [] []))) THEN (move ["x"]) THEN (simp_tac)))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`(\x. x$k) o (\t. x + t % basis i) = (\t. x$k + t * (basis i:real^N)$k)`)))));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN VECTOR_ADD_COMPONENT)(new_rewrite [] [])) THEN ((USE_THM_THEN VECTOR_MUL_COMPONENT)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN derivative_add)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_DIFFERENTIABLE_MUL_ATREAL)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_DIFFERENTIABLE_CONST)(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID (((((USE_THM_THEN REAL_DIFFERENTIABLE_ID)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_DIFFERENTIABLE_CONST)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN derivative_const)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN derivative_mul)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_DIFFERENTIABLE_ID)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_DIFFERENTIABLE_CONST)(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID (((((USE_THM_THEN derivative_x)(new_rewrite [] [])) THEN ((USE_THM_THEN derivative_const)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +let partial_x_lemma = end_section_proof();; +(start_section_proof ["k";"i"](`k IN 1..dimindex (:N) ==> + partial i (\x:real^N. x$k) = (\x. if i = k then &1 else &0)`));; +refine (by (VALID (((BETA_TAC THEN (move ["k_ineq"])) THEN (((USE_THM_THEN partial_x_lemma)(new_rewrite [] [])) THEN ((USE_THM_THEN BASIS_COMPONENT)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN IN_NUMSEG)(GSYM_THEN (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)))));; +let partial_x = end_section_proof();; +(start_section_proof ["k";"i";"j"](`partial2 i j (\x:real^N. x$k) = (\x. &0)`));; +refine (by (VALID (((((USE_THM_THEN partial2)(new_rewrite [] [])) THEN ((USE_THM_THEN partial_x_lemma)(new_rewrite [] [])) THEN ((USE_THM_THEN partial_const)(new_rewrite [] []))) THEN (done_tac)))));; +let partial2_x = end_section_proof();; +(start_section_proof ["k";"x"](`k IN 1..dimindex (:N) ==> diff2 (\x:real^N. x$k) x`));; +refine (by (VALID (((BETA_TAC THEN (move ["k_ineq"])) THEN ((USE_THM_THEN diff2)(new_rewrite [] [])) THEN (exists_tac (`(:real^N)`)) THEN ((((USE_THM_THEN OPEN_UNIV)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_UNIV)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["y"]) THEN (move ["_"]))))));; +refine (by (VALID (((((USE_THM_THEN projection_diff)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN partial_x_lemma)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN f_lift_unary)(new_rewrite [] []))) THEN ((USE_THM_THEN DIFFERENTIABLE_CONST)(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_x = end_section_proof();; +(start_section_proof ["k";"domain"](`k IN 1..dimindex (:N) ==> diff2_domain domain (\x:real^N. x$k)`));; +refine (by (VALID ((((DISCH_THEN (fun snd_th -> (USE_THM_THEN diff2_x)(MATCH_MP_THEN snd_th MP_TAC))) THEN BETA_TAC) THEN (((USE_THM_THEN diff2_domain)(new_rewrite [] [])) THEN (DISCH_THEN(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_domain_x = end_section_proof();; +(start_section_proof ["k";"x"](`k IN 1..dimindex (:N) ==> diff2c (\x:real^N. x$k) x`));; +refine (by (VALID (((BETA_TAC THEN (move ["k_ineq"])) THEN (((USE_THM_THEN diff2c)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2_x)(new_rewrite [] [])) THEN ((TRY done_tac)))))));; +refine (by (VALID (((((USE_THM_THEN (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1))(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN partial2_x)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_CONTINUOUS_CONST)(new_rewrite [] []))) THEN (done_tac)))));; +let diff2c_x = end_section_proof();; +(start_section_proof ["k";"domain"](`k IN 1..dimindex (:N) ==> diff2c_domain domain (\x:real^N. x$k)`));; +refine (by (VALID ((((DISCH_THEN (fun snd_th -> (USE_THM_THEN diff2c_x)(MATCH_MP_THEN snd_th MP_TAC))) THEN BETA_TAC) THEN (((USE_THM_THEN diff2c_domain)(new_rewrite [] [])) THEN (DISCH_THEN(new_rewrite [] []))) THEN (done_tac)))));; +let diff2c_domain_x = end_section_proof();; +let diff2c_domain_x = finalize_theorem diff2c_domain_x;; +let diff2c_x = finalize_theorem diff2c_x;; +let diff2_domain_x = finalize_theorem diff2_domain_x;; +let diff2_x = finalize_theorem diff2_x;; +let partial2_x = finalize_theorem partial2_x;; +let partial_x = finalize_theorem partial_x;; +let partial_x_lemma = finalize_theorem partial_x_lemma;; +let diff2c_domain_const = finalize_theorem diff2c_domain_const;; +let diff2c_const = finalize_theorem diff2c_const;; +let partial2_const = finalize_theorem partial2_const;; +let diff2_domain_const = finalize_theorem diff2_domain_const;; +let diff2_const = finalize_theorem diff2_const;; +let f_lift_unary = finalize_theorem f_lift_unary;; +let f_lift_const = finalize_theorem f_lift_const;; +(end_section "ElementaryFunctions");; diff --git a/formal_lp/old/formal_interval/theory/taylor_interval.hl b/formal_lp/old/formal_interval/theory/taylor_interval.hl new file mode 100644 index 0000000..8277d96 --- /dev/null +++ b/formal_lp/old/formal_interval/theory/taylor_interval.hl @@ -0,0 +1,1786 @@ +load_path := "/mnt/Repository/jHOLLight"::(!load_path);; +needs "caml/raw_printer.hl";; +needs "caml/sections.hl";; +needs "caml/ssreflect.hl";; +needs "Examples/ssrbool-compiled.hl";; +needs "Examples/ssrnat-compiled.hl";; +needs "../formal_lp/arith/interval_arith.hl";; +prioritize_real();; +open Interval_arith;; + +let bounded_on = new_definition `bounded_on f s f_bounds <=> + !x. x IN s ==> interval_arith (f x) f_bounds`;; +let bounded_on_int = new_definition `bounded_on_int f int f_bounds <=> + !x. interval_arith x int ==> interval_arith (f x) f_bounds`;; +let derivative = new_definition `derivative f = \y. @d. (f has_real_derivative d) (atreal y)`;; +let nth_derivative = new_definition `nth_derivative n f = iter n derivative f`;; +let nth_differentiable = define `(nth_differentiable 0 f x <=> f real_continuous atreal x) /\ + (nth_differentiable (SUC n) f x <=> nth_differentiable n f x /\ + nth_derivative n f real_differentiable atreal x)`;; +let nth_differentiable_on = new_definition `nth_differentiable_on n s f <=> + !x. x IN s ==> nth_differentiable n f x`;; +let nth_differentiable_on_int = new_definition `nth_differentiable_on_int n int f <=> + !x. interval_arith x int ==> nth_differentiable n f x`;; +let nth_diff_weak = new_definition `nth_diff_weak n f x <=> f real_continuous atreal x /\ + ?F. F 0 = f /\ !i. i < n ==> (F i has_real_derivative F (SUC i) x) (atreal x)`;; +let nth_diff_strong = new_definition `nth_diff_strong n f x <=> + ?s. real_open s /\ x IN s /\ nth_differentiable_on n s f`;; +let nth_diff_strong_int = new_definition `nth_diff_strong_int n int f <=> + !x. interval_arith x int ==> nth_diff_strong n f x`;; +(begin_section "NthDerivatives");; +(start_section_proof ["f";"x"](`(?d. (f has_real_derivative d) (atreal x)) ==> + (f has_real_derivative (derivative f x)) (atreal x)`));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["d"])) THEN (move ["df"])))));; +refine (by (VALID (((THENL_FIRST) (((THENL_ROT 1)) (have_tac (DISCH_THEN(new_rewrite [] [])) (`derivative f x = d`))) (exact_tac)))));; +refine (by (VALID (((((USE_THM_THEN derivative)(new_rewrite [] [])) THEN (simp_tac)) THEN (((USE_THM_THEN SELECT_UNIQUE) apply_tac) THEN (simp_tac) THEN (move ["y"])) THEN ((split_tac) THENL [(move ["df2"]); ((DISCH_THEN(new_rewrite [] [])) THEN ((TRY done_tac)))])))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN REAL_DERIVATIVE_UNIQUE_ATREAL)(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (mk_var("x",mk_type("real",[]))) thm_tac))MP_TAC) THEN (DISCH_THEN apply_tac)) THEN (done_tac)))));; +let has_derivative_cond = end_section_proof();; +(start_section_proof ["f";"x"](`f real_differentiable atreal x ==> + (f has_real_derivative (derivative f x)) (atreal x)`));; +refine (by (VALID (((((USE_THM_THEN real_differentiable)(new_rewrite [] [])) THEN (DISCH_THEN (fun snd_th -> (USE_THM_THEN has_derivative_cond)(MATCH_MP_THEN snd_th MP_TAC)))) THEN (done_tac)))));; +let has_derivative_alt = end_section_proof();; +(start_section_proof ["f";"f'";"x"](`(f has_real_derivative f') (atreal x) ==> derivative f x = f'`));; +refine (by (VALID (((BETA_TAC THEN (move ["df"])) THEN (((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN REAL_DERIVATIVE_UNIQUE_ATREAL)(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (mk_var("x",mk_type("real",[]))) thm_tac))MP_TAC) THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID (((((USE_THEN "df")(new_rewrite [] [])) THEN ((USE_THM_THEN has_derivative_cond)(new_rewrite [] [])) THEN ((TRY done_tac))) THEN (exists_tac (mk_var("f'",mk_type("real",[])))) THEN (done_tac)))));; +let derivative_unique = end_section_proof();; +(start_section_proof ["s";"f";"f'"](`(!x. x IN s ==> (f has_real_derivative f' x) (atreal x)) ==> + (!x. x IN s ==> f' x = derivative f x)`));; +refine (by (VALID ((BETA_TAC THEN (move ["df"]) THEN (move ["x"]) THEN (move ["xs"])))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN derivative_unique)(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (`f' x`) thm_tac))(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "df")(new_rewrite [] []))) THEN (done_tac)))));; +let derivative_unique_on = end_section_proof();; +(start_section_proof ["f";"f'";"x"](`f real_differentiable atreal x /\ + derivative f x = f' ==> + (f has_real_derivative f') (atreal x)`));; +refine (by (VALID (((BETA_TAC THEN (case THEN ((move ["diff"]) THEN (DISCH_THEN(GSYM_THEN (new_rewrite [] [])))))) THEN ((USE_THM_THEN has_derivative_alt)(new_rewrite [] [])) THEN (done_tac)))));; +let has_derivative_lemma = end_section_proof();; +(start_section_proof ["f"](`nth_derivative 0 f = f`));; +refine (by (VALID (((((USE_THM_THEN nth_derivative)(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL iter))(new_rewrite [] []))) THEN (done_tac)))));; +let nth_derivative0 = end_section_proof();; +(start_section_proof ["n";"f"](`nth_derivative (SUC n) f = derivative (nth_derivative n f)`));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN nth_derivative)(new_rewrite [] []))) THEN ((USE_THM_THEN iterS)(new_rewrite [] []))) THEN (done_tac)))));; +let nth_derivativeS = end_section_proof();; +(start_section_proof ["n";"f"](`nth_derivative (SUC n) f = nth_derivative n (derivative f)`));; +refine (by (VALID (((((USE_THM_THEN nth_derivative)(new_rewrite [] [])) THEN ((USE_THM_THEN iterSr)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_derivative)(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac)))));; +let nth_Sderivative = end_section_proof();; +(start_section_proof ["f"](`nth_derivative 1 f = derivative f`));; +refine (by (VALID (((((USE_THM_THEN ONE)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_derivativeS)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_derivative0)(new_rewrite [] []))) THEN (done_tac)))));; +let nth_derivative1 = end_section_proof();; +(start_section_proof ["f"](`nth_derivative 2 f = derivative (derivative f)`));; +refine (by (VALID (((((USE_THM_THEN (ARITH_RULE `2 = SUC(SUC 0)`))(new_rewrite [] [])) THEN ((USE_THM_THEN nth_derivative)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN iterS)(new_rewrite [] []))) THEN ((USE_THM_THEN (GEN_ALL iter))(new_rewrite [] []))) THEN (done_tac)))));; +let nth_derivative2 = end_section_proof();; +(start_section_proof ["n";"m";"f"](`nth_derivative n (nth_derivative m f) = nth_derivative (n + m) f`));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN nth_derivative)(new_rewrite [] []))) THEN ((USE_THM_THEN iter_add)(new_rewrite [] []))) THEN (done_tac)))));; +let nth_derivative_add = end_section_proof();; +(start_section_proof ["n";"f";"x"](`nth_differentiable n f x ==> + f real_continuous atreal x`));; +refine (by (VALID ((((disch_tm_tac [](mk_var("n",mk_type("num",[])))) THEN (clear_assumption "n") THEN elim THENL [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN (((USE_THM_THEN nth_differentiable)(new_rewrite [] [])) THEN ((TRY done_tac)))))));; +refine (by (VALID (((BETA_TAC THEN (case THEN (DISCH_THEN (fun snd_th -> (USE_THEN "IHn")(MATCH_MP_THEN snd_th MP_TAC)))) THEN (simp_tac)) THEN (done_tac)))));; +let nth_diff_continuous = end_section_proof();; +(start_section_proof ["n";"f";"x"](`nth_differentiable n f x ==> + !i. i < n ==> (nth_derivative i f has_real_derivative (nth_derivative (SUC i) f x)) (atreal x)`));; +refine (by (VALID (((THENL_FIRST) ((disch_tm_tac [](mk_var("n",mk_type("num",[])))) THEN (clear_assumption "n") THEN elim THENL [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) (((USE_THM_THEN ltn0)(new_rewrite [] [])) THEN (done_tac))))));; +refine (by (VALID ((((USE_THM_THEN nth_differentiable)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN ((DISCH_THEN (fun snd_th -> (USE_THEN "IHn")(MATCH_MP_THEN snd_th MP_TAC))) THEN (move ["df_n"]) THEN (move ["dfn"]))) THEN (move ["i"])))));; +refine (by (VALID (((((USE_THM_THEN ltE)(new_rewrite [] [])) THEN ((USE_THM_THEN leqSS)(new_rewrite [] [])) THEN ((USE_THM_THEN leq_eqVlt)(new_rewrite [] []))) THEN (case THENL [(DISCH_THEN(new_rewrite [] [])); ((DISCH_THEN (fun snd_th -> (USE_THEN "df_n")(MATCH_MP_THEN snd_th MP_TAC))) THEN ((TRY done_tac)))])))));; +refine (by (VALID (((((USE_THM_THEN nth_derivativeS)(new_rewrite [] [])) THEN ((USE_THM_THEN has_derivative_alt)(new_rewrite [] []))) THEN (done_tac)))));; +let nth_differentiable_cond = end_section_proof();; +(start_section_proof ["n";"s";"f"](`nth_differentiable_on n s f ==> + !x. x IN s ==> + !i. i < n ==> (nth_derivative i f has_real_derivative (nth_derivative (SUC i) f x)) (atreal x)`));; +refine (by (VALID ((((USE_THM_THEN nth_differentiable_on)(new_rewrite [] [])) THEN (move ["cond"]) THEN (move ["x"])))));; +refine (by (VALID ((((DISCH_THEN (fun snd_th -> (USE_THEN "cond")(MATCH_MP_THEN snd_th MP_TAC))) THEN BETA_TAC THEN (DISCH_THEN (fun snd_th -> (USE_THM_THEN nth_differentiable_cond)(MATCH_MP_THEN snd_th MP_TAC)))) THEN (done_tac)))));; +let nth_differentiable_on_cond = end_section_proof();; +(start_section_proof ["n";"f";"x"](`nth_differentiable n f x <=> + f real_continuous atreal x /\ + !i. i < n ==> (nth_derivative i f has_real_derivative (nth_derivative (SUC i) f x)) (atreal x)`));; +refine (by (VALID (((split_tac) THENL [(move ["dn_f"]); (case THEN (move ["f_cont"]))]))));; +refine (by (VALID (((((fun thm_tac -> (USE_THM_THEN nth_diff_continuous)(fun fst_th ->(USE_THEN "dn_f")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (((USE_THM_THEN nth_differentiable_cond)MP_TAC) THEN (clear_assumption "nth_differentiable_cond") THEN (exact_tac)) THEN (done_tac)))));; +refine (by (VALID ((((disch_tm_tac [](mk_var("n",mk_type("num",[])))) THEN (clear_assumption "n") THEN elim THENL [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((((USE_THM_THEN nth_differentiable)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN ltE)(new_rewrite [] [])) THEN ((USE_THM_THEN leqSS)(new_rewrite [] [])) THEN ((USE_THM_THEN leq_eqVlt)(new_rewrite [] []))) THEN (move ["cond"]))))));; +refine (by (VALID (((THENL_FIRST) (((USE_THEN "IHn")(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))) ((BETA_TAC THEN (move ["i"]) THEN (move ["i_lt_n"])) THEN (((USE_THEN "cond")MP_TAC) THEN (clear_assumption "cond") THEN (DISCH_THEN apply_tac)) THEN (done_tac))))));; +refine (by (VALID ((((USE_THM_THEN real_differentiable)(new_rewrite [] [])) THEN (exists_tac (`nth_derivative (SUC n) f x`))))));; +refine (by (VALID ((((USE_THEN "cond")MP_TAC) THEN (clear_assumption "cond") THEN (exact_tac)))));; +let nth_differentiable_eq = end_section_proof();; +(start_section_proof ["f";"int"](`nth_differentiable_on_int 2 int f ==> + ?f' f''. f' = derivative f /\ f'' = nth_derivative 2 f /\ + !x. interval_arith x int ==> (f has_real_derivative f' x) (atreal x) /\ + (f' has_real_derivative f'' x) (atreal x)`));; +refine (by (VALID ((((USE_THM_THEN nth_differentiable_on_int)(new_rewrite [] [])) THEN (move ["h"])))));; +refine (by (VALID ((((exists_tac (`derivative f`)) THEN (exists_tac (`nth_derivative 2 f`))) THEN (simp_tac) THEN (move ["x"]) THEN (move ["ineq"])))));; +refine (by (VALID ((((USE_THM_THEN nth_derivative1)(GSYM_THEN (new_rewrite [] []))) THEN ((fun thm_tac -> (USE_THM_THEN nth_derivative0)(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(GSYM_THEN (new_rewrite [1] []))) THEN ((USE_THM_THEN ONE)(new_rewrite [1] [])) THEN ((USE_THM_THEN (ARITH_RULE `2 = SUC 1`))(new_rewrite [] []))))));; +refine (by (VALID (((repeat_tactic 1 9 (((fun thm_tac -> (USE_THM_THEN nth_differentiable_cond)(ISPEC_THEN (`2`) thm_tac))(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THEN "h")(new_rewrite [] [])) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)))));; +let nth_differentiable_on_int2 = end_section_proof();; +(start_section_proof ["n";"m";"f";"x"](`n <= m ==> nth_differentiable m f x ==> nth_differentiable n f x`));; +refine (by (VALID (((BETA_TAC THEN (move ["n_le_m"])) THEN (repeat_tactic 1 9 (((USE_THM_THEN nth_differentiable_eq)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN ((DISCH_THEN(new_rewrite [] [])) THEN (move ["cond"])))) THEN (((USE_THM_THEN andTb)(new_rewrite [] [])) THEN (move ["i"]) THEN (move ["in"]))))));; +refine (by (VALID (((((USE_THEN "cond")MP_TAC) THEN (clear_assumption "cond") THEN (DISCH_THEN apply_tac)) THEN (((USE_THEN "n_le_m")MP_TAC) THEN (clear_assumption "n_le_m") THEN ((USE_THM_THEN ltn_leq_trans)MP_TAC) THEN (clear_assumption "ltn_leq_trans") THEN (DISCH_THEN apply_tac)) THEN (done_tac)))));; +let nth_mth_diff = end_section_proof();; +(start_section_proof ["f";"x"](`nth_differentiable 1 f x <=> f real_differentiable atreal x`));; +refine (by (VALID (((((USE_THM_THEN ONE)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL nth_differentiable))(new_rewrite [] []))) THEN ((USE_THM_THEN nth_derivative0)(new_rewrite [] []))) THEN ((split_tac) THENL [(DISCH_THEN(new_rewrite [] [])); (move ["df"])])))));; +refine (by (VALID ((((USE_THM_THEN REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL)(new_rewrite [] [])) THEN (done_tac)))));; +let nth_differentiable1 = end_section_proof();; +(start_section_proof ["n";"f";"x"](`0 < n ==> nth_differentiable n f x ==> + f real_differentiable atreal x`));; +refine (by (VALID ((((((USE_THM_THEN ltE)(new_rewrite [] [])) THEN ((USE_THM_THEN ONE)(GSYM_THEN (new_rewrite [] [])))) THEN (move ["ineq"]) THEN (move ["df"])) THEN ((USE_THM_THEN nth_differentiable1)(GSYM_THEN (new_rewrite [] []))) THEN (((USE_THM_THEN nth_mth_diff)MP_TAC) THEN (clear_assumption "nth_mth_diff") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (mk_var("n",mk_type("num",[])))) THEN (done_tac)))));; +let nth_diff_imp_diff = end_section_proof();; +(start_section_proof ["n";"f";"x";"i"](`nth_differentiable n f x ==> i < n ==> + nth_derivative i f real_continuous atreal x`));; +refine (by (VALID ((((USE_THM_THEN nth_differentiable_eq)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (move ["df"])))));; +refine (by (VALID ((((DISCH_THEN (fun snd_th -> (USE_THEN "df")(MATCH_MP_THEN snd_th MP_TAC))) THEN BETA_TAC THEN (move ["cond"])) THEN (((USE_THM_THEN REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL)MP_TAC) THEN (clear_assumption "REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID ((((USE_THM_THEN real_differentiable)(new_rewrite [] [])) THEN (exists_tac (`nth_derivative (SUC i) f x`)) THEN (done_tac)))));; +let nth_derivative_continuous = end_section_proof();; +(start_section_proof ["i";"n";"f";"x"](`nth_differentiable n f x ==> i < n ==> + nth_differentiable (n - i) (nth_derivative i f) x`));; +refine (by (VALID ((BETA_TAC THEN (move ["dnf"])))));; +refine (by (VALID (((((USE_THEN "dnf")MP_TAC) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN nth_differentiable_eq)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (move ["cond"]) THEN (move ["i_lt_n"]))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THM_THEN nth_derivative_continuous)(fun fst_th ->(USE_THEN "dnf")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["j"]) THEN (move ["j_lt_ni"])))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN nth_derivative_add)(new_rewrite [] []))) THEN ((USE_THM_THEN addSn)(new_rewrite [] [])) THEN ((USE_THEN "cond")(new_rewrite [] []))) THEN (((USE_THEN "j_lt_ni")MP_TAC) THEN (clear_assumption "j_lt_ni") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +let ith_derivative_differentiable = end_section_proof();; +(start_section_proof ["n";"f";"x"](`nth_diff_strong n f x ==> nth_differentiable n f x`));; +refine (by (VALID (((((USE_THM_THEN nth_diff_strong)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xs"]))) THEN (((USE_THM_THEN nth_differentiable_on)(new_rewrite [] [])) THEN (move ["h"]))))));; +refine (by (VALID ((((USE_THEN "h")MP_TAC) THEN (clear_assumption "h") THEN (exact_tac)))));; +let nth_diff_strong_imp_diff = end_section_proof();; +(begin_section "DerivativeArith");; +(begin_section "ElementaryDerivatives");; +(start_section_proof [](`derivative (\x. x) = (\x. &1)`));; +refine (by (VALID ((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN (move ["x"]) THEN (simp_tac)))));; +refine (by (VALID (((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((USE_THM_THEN HAS_REAL_DERIVATIVE_ID)(new_rewrite [] [])) THEN (done_tac)))));; +let derivative_x = end_section_proof();; +(start_section_proof ["c"](`derivative (\x. c) = (\x. &0)`));; +refine (by (VALID ((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN (move ["x"]) THEN (simp_tac)))));; +refine (by (VALID (((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((USE_THM_THEN HAS_REAL_DERIVATIVE_CONST)(new_rewrite [] [])) THEN (done_tac)))));; +let derivative_const = end_section_proof();; +(start_section_proof ["x"](`~(x = &0) ==> derivative inv x = -- inv (x * x)`));; +refine (by (VALID ((BETA_TAC THEN (move ["xn0"])))));; +refine (by (VALID (((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((USE_THM_THEN REAL_POW_2)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN HAS_REAL_DERIVATIVE_INV_BASIC)(new_rewrite [] []))) THEN (done_tac)))));; +let derivative_inv = end_section_proof();; +(start_section_proof [](`derivative atn = (\x. inv (&1 + x * x))`));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_POW_2)(GSYM_THEN (new_rewrite [] [])))) THEN (move ["x"]) THEN (simp_tac)))));; +refine (by (VALID (((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((USE_THM_THEN HAS_REAL_DERIVATIVE_ATN)(new_rewrite [] [])) THEN (done_tac)))));; +let derivative_atn = end_section_proof();; +(start_section_proof [](`derivative exp = exp`));; +refine (by (VALID ((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN (move ["x"]) THEN (simp_tac)))));; +refine (by (VALID (((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((USE_THM_THEN HAS_REAL_DERIVATIVE_EXP)(new_rewrite [] [])) THEN (done_tac)))));; +let derivative_exp = end_section_proof();; +(start_section_proof ["x"](`abs x < &1 ==> derivative acs x = --inv(sqrt(&1 - x * x))`));; +refine (by (VALID ((BETA_TAC THEN (move ["x_ineq"])))));; +refine (by (VALID (((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((USE_THM_THEN REAL_POW_2)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN HAS_REAL_DERIVATIVE_ACS)(new_rewrite [] []))) THEN (done_tac)))));; +let derivative_acs = end_section_proof();; +(start_section_proof ["x"](`&0 < x ==> derivative sqrt x = inv (&2 * sqrt x)`));; +refine (by (VALID ((BETA_TAC THEN (move ["xg0"])))));; +refine (by (VALID (((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN ((USE_THM_THEN HAS_REAL_DERIVATIVE_SQRT)(new_rewrite [] [])) THEN (done_tac)))));; +let derivative_sqrt = end_section_proof();; +(start_section_proof ["f";"g";"x"](`f real_differentiable atreal x ==> + g real_differentiable atreal (f x) ==> + derivative (\x. g (f x)) x = derivative f x * derivative g (f x)`));; +refine (by (VALID (((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (USE_THM_THEN has_derivative_alt)(MATCH_MP_THEN snd_th MP_TAC))) THEN (move ["df"]) THEN (DISCH_THEN (fun snd_th -> (USE_THM_THEN has_derivative_alt)(MATCH_MP_THEN snd_th MP_TAC))) THEN (move ["dg"])) THEN (((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID (((THENL_FIRST) ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN (GEN_ALL HAS_REAL_DERIVATIVE_CHAIN))(ISPEC_THEN (`derivative f x`) thm_tac))(ISPEC_THEN (`derivative g`) thm_tac))(ISPEC_THEN (`\y. y = f x`) thm_tac))(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (mk_var("g",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))) thm_tac)) MP_TAC) THEN ALL_TAC) THEN (ANTS_TAC)) ((BETA_TAC THEN (move ["y"]) THEN (DISCH_THEN(new_rewrite [] []))) THEN (done_tac))))));; +refine (by (VALID (((BETA_TAC THEN (case THEN (move ["_"]))) THEN (DISCH_THEN apply_tac) THEN (done_tac)))));; +let derivative_composition = end_section_proof();; +(begin_section "ElementaryCompose");; +(start_section_proof ["x"](`~(x = &0) ==> inv real_differentiable atreal x`));; +refine (by (VALID ((BETA_TAC THEN (move ["xn0"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN REAL_DIFFERENTIABLE_INV_ATREAL)(ISPEC_THEN (`(\x. x:real)`) thm_tac))(ISPEC_THEN (mk_var("x",mk_type("real",[]))) thm_tac)) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID ((((simp_tac) THEN ((USE_THM_THEN REAL_DIFFERENTIABLE_ID)(new_rewrite [] [])) THEN ((USE_THEN "xn0")(new_rewrite [] [])) THEN (simp_tac)) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (done_tac)))));; +let REAL_DIFFERENTIABLE_AT_INV = end_section_proof();; +(add_section_var (mk_var ("f", (`:real->real`))));; +(add_section_var (mk_var ("x", (`:real`))));; +(add_section_hyp "df" (`f real_differentiable atreal x`));; +(start_section_proof [](`(\x. atn (f x)) real_differentiable atreal x /\ + derivative (\x. atn (f x)) x = derivative f x / (&1 + f x * f x)`));; +refine (by (VALID ((split_tac))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN o_THM)(ISPEC_THEN (`atn`) thm_tac))(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (((USE_THM_THEN REAL_DIFFERENTIABLE_COMPOSE_ATREAL)MP_TAC) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID (((((USE_THM_THEN REAL_DIFFERENTIABLE_AT_ATN)(new_rewrite [] [])) THEN ((USE_THEN "df")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN derivative_composition)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_DIFFERENTIABLE_AT_ATN)(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID (((((USE_THM_THEN derivative_atn)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN real_div)(new_rewrite [] []))) THEN (done_tac)))));; +let derivative_compose_atn = end_section_proof();; +(start_section_proof [](`(\x. exp (f x)) real_differentiable atreal x /\ + derivative (\x. exp (f x)) x = exp (f x) * derivative f x`));; +refine (by (VALID ((split_tac))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN o_THM)(ISPEC_THEN (`exp`) thm_tac))(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (((USE_THM_THEN REAL_DIFFERENTIABLE_COMPOSE_ATREAL)MP_TAC) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID (((((USE_THM_THEN REAL_DIFFERENTIABLE_AT_EXP)(new_rewrite [] [])) THEN ((USE_THEN "df")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN derivative_composition)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_DIFFERENTIABLE_AT_EXP)(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID (((((USE_THM_THEN derivative_exp)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_SYM)(new_rewrite [] []))) THEN (done_tac)))));; +let derivative_compose_exp = end_section_proof();; +(start_section_proof [](`~(f x = &0) ==> + (\x. inv (f x)) real_differentiable atreal x /\ + derivative (\x. inv (f x)) x = -- inv (f x * f x) * derivative f x`));; +refine (by (VALID (((THENL_FIRST) ((BETA_TAC THEN (move ["fn0"])) THEN (split_tac)) ((((USE_THM_THEN REAL_DIFFERENTIABLE_INV_ATREAL)MP_TAC) THEN (clear_assumption "REAL_DIFFERENTIABLE_INV_ATREAL") THEN (DISCH_THEN apply_tac)) THEN (done_tac))))));; +refine (by (VALID (((((USE_THM_THEN derivative_composition)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN derivative_inv)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_MUL_SYM)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THEN "df")(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_DIFFERENTIABLE_AT_INV)(new_rewrite [] []))) THEN (done_tac)))));; +let derivative_compose_inv = end_section_proof();; +(start_section_proof [](`&0 < f x ==> + (\x. sqrt (f x)) real_differentiable atreal x /\ + derivative (\x. sqrt (f x)) x = derivative f x / (&2 * sqrt (f x))`));; +refine (by (VALID (((BETA_TAC THEN (move ["f_pos"])) THEN (split_tac)))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN o_THM)(ISPEC_THEN (`sqrt`) thm_tac))(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (((USE_THM_THEN REAL_DIFFERENTIABLE_COMPOSE_ATREAL)MP_TAC) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID (((((USE_THEN "df")(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (((USE_THM_THEN REAL_DIFFERENTIABLE_AT_SQRT)MP_TAC) THEN (clear_assumption "REAL_DIFFERENTIABLE_AT_SQRT") THEN (DISCH_THEN apply_tac)) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN derivative_composition)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_DIFFERENTIABLE_AT_SQRT)(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID (((((USE_THM_THEN derivative_sqrt)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN real_div)(new_rewrite [] []))) THEN (done_tac)))));; +let derivative_compose_sqrt = end_section_proof();; +(start_section_proof [](`abs (f x) < &1 ==> + (\x. acs (f x)) real_differentiable atreal x /\ + derivative (\x. acs (f x)) x = -- (derivative f x / sqrt (&1 - f x * f x))`));; +refine (by (VALID (((BETA_TAC THEN (move ["f_abs"])) THEN (split_tac)))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN o_THM)(ISPEC_THEN (`acs`) thm_tac))(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (((USE_THM_THEN REAL_DIFFERENTIABLE_COMPOSE_ATREAL)MP_TAC) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID (((((USE_THEN "df")(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_DIFFERENTIABLE_AT_ACS)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN derivative_composition)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_DIFFERENTIABLE_AT_ACS)(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID (((((USE_THM_THEN derivative_acs)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN REAL_MUL_RNEG)(new_rewrite [] [])) THEN ((USE_THM_THEN real_div)(new_rewrite [] []))) THEN (done_tac)))));; +let derivative_compose_acs = end_section_proof();; +let derivative_compose_acs = finalize_theorem derivative_compose_acs;; +let derivative_compose_sqrt = finalize_theorem derivative_compose_sqrt;; +let derivative_compose_inv = finalize_theorem derivative_compose_inv;; +let derivative_compose_exp = finalize_theorem derivative_compose_exp;; +let derivative_compose_atn = finalize_theorem derivative_compose_atn;; +let REAL_DIFFERENTIABLE_AT_INV = finalize_theorem REAL_DIFFERENTIABLE_AT_INV;; +(end_section "ElementaryCompose");; +let derivative_compose_acs = finalize_theorem derivative_compose_acs;; +let derivative_compose_sqrt = finalize_theorem derivative_compose_sqrt;; +let derivative_compose_inv = finalize_theorem derivative_compose_inv;; +let derivative_compose_exp = finalize_theorem derivative_compose_exp;; +let derivative_compose_atn = finalize_theorem derivative_compose_atn;; +let REAL_DIFFERENTIABLE_AT_INV = finalize_theorem REAL_DIFFERENTIABLE_AT_INV;; +let derivative_composition = finalize_theorem derivative_composition;; +let derivative_sqrt = finalize_theorem derivative_sqrt;; +let derivative_acs = finalize_theorem derivative_acs;; +let derivative_exp = finalize_theorem derivative_exp;; +let derivative_atn = finalize_theorem derivative_atn;; +let derivative_inv = finalize_theorem derivative_inv;; +let derivative_const = finalize_theorem derivative_const;; +let derivative_x = finalize_theorem derivative_x;; +(end_section "ElementaryDerivatives");; +(add_section_var (mk_var ("f", (`:real -> real`))); add_section_var (mk_var ("g", (`:real -> real`))));; +(add_section_var (mk_var ("x", (`:real`))); add_section_var (mk_var ("c", (`:real`))));; +(add_section_hyp "df" (`f real_differentiable atreal x`));; +(start_section_proof [](`derivative (\x. c * f x) x = c * derivative f x`));; +refine (by (VALID (((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((USE_THM_THEN HAS_REAL_DERIVATIVE_LMUL_ATREAL)(new_rewrite [] [])) THEN ((USE_THM_THEN has_derivative_alt)(new_rewrite [] []))) THEN (done_tac)))));; +let derivative_scale = end_section_proof();; +(start_section_proof [](`derivative (\x. -- f x) x = -- derivative f x`));; +refine (by (VALID (((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((USE_THM_THEN HAS_REAL_DERIVATIVE_NEG)(new_rewrite [] [])) THEN ((USE_THM_THEN has_derivative_alt)(new_rewrite [] []))) THEN (done_tac)))));; +let derivative_neg = end_section_proof();; +(start_section_proof ["n"](`derivative (\x. f x pow n) x = &n * f x pow (n - 1) * derivative f x`));; +refine (by (VALID (((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((USE_THM_THEN HAS_REAL_DERIVATIVE_POW_ATREAL)(new_rewrite [] [])) THEN ((USE_THM_THEN has_derivative_alt)(new_rewrite [] []))) THEN (done_tac)))));; +let derivative_pow = end_section_proof();; +(add_section_hyp "dg" (`g real_differentiable atreal x`));; +(start_section_proof [](`derivative (\x. f x + g x) x = derivative f x + derivative g x`));; +refine (by (VALID (((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((USE_THM_THEN HAS_REAL_DERIVATIVE_ADD)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN has_derivative_alt)(new_rewrite [] [])))) THEN (done_tac)))));; +let derivative_add = end_section_proof();; +(start_section_proof [](`derivative (\x. f x * g x) x = f x * derivative g x + derivative f x * g x`));; +refine (by (VALID (((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((USE_THM_THEN HAS_REAL_DERIVATIVE_MUL_ATREAL)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN has_derivative_alt)(new_rewrite [] [])))) THEN (done_tac)))));; +let derivative_mul = end_section_proof();; +(start_section_proof [](`derivative (\x. f x - g x) x = derivative f x - derivative g x`));; +refine (by (VALID (((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((USE_THM_THEN HAS_REAL_DERIVATIVE_SUB)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN has_derivative_alt)(new_rewrite [] [])))) THEN (done_tac)))));; +let derivative_sub = end_section_proof();; +(start_section_proof [](`~(g x = &0) ==> + derivative (\x. f x / g x) x = (derivative f x * g x - f x * derivative g x) / (g x * g x)`));; +refine (by (VALID (((BETA_TAC THEN (move ["gn0"])) THEN (((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((USE_THM_THEN REAL_POW_2)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN HAS_REAL_DERIVATIVE_DIV_ATREAL)(new_rewrite [] [])) THEN ((TRY done_tac)))))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN has_derivative_alt)(new_rewrite [] []))) THEN (done_tac)))));; +let derivative_div = end_section_proof();; +let derivative_div = finalize_theorem derivative_div;; +let derivative_sub = finalize_theorem derivative_sub;; +let derivative_mul = finalize_theorem derivative_mul;; +let derivative_add = finalize_theorem derivative_add;; +let derivative_pow = finalize_theorem derivative_pow;; +let derivative_neg = finalize_theorem derivative_neg;; +let derivative_scale = finalize_theorem derivative_scale;; +let derivative_compose_acs = finalize_theorem derivative_compose_acs;; +let derivative_compose_sqrt = finalize_theorem derivative_compose_sqrt;; +let derivative_compose_inv = finalize_theorem derivative_compose_inv;; +let derivative_compose_exp = finalize_theorem derivative_compose_exp;; +let derivative_compose_atn = finalize_theorem derivative_compose_atn;; +let REAL_DIFFERENTIABLE_AT_INV = finalize_theorem REAL_DIFFERENTIABLE_AT_INV;; +let derivative_composition = finalize_theorem derivative_composition;; +let derivative_sqrt = finalize_theorem derivative_sqrt;; +let derivative_acs = finalize_theorem derivative_acs;; +let derivative_exp = finalize_theorem derivative_exp;; +let derivative_atn = finalize_theorem derivative_atn;; +let derivative_inv = finalize_theorem derivative_inv;; +let derivative_const = finalize_theorem derivative_const;; +let derivative_x = finalize_theorem derivative_x;; +(end_section "DerivativeArith");; +(begin_section "MoreDerivativeArith");; +(start_section_proof ["G";"n";"m";"x"](`(!i. i IN n..m ==> G i real_differentiable atreal x) ==> + (\x. sum (n..m) (\i. G i x)) real_differentiable atreal x`));; +refine (by (VALID ((((disch_tm_tac [](mk_var("m",mk_type("num",[])))) THEN (clear_assumption "m") THEN elim THENL [ALL_TAC; ((move ["m"]) THEN (move ["IHm"]))] THEN (move ["dG"])) THEN repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL SUM_CLAUSES_NUMSEG))(new_rewrite [] [])))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THM_THEN EXCLUDED_MIDDLE)(ISPEC_THEN (`n = 0`) thm_tac))MP_TAC) THEN case THEN (simp_tac) THEN (move ["n_eq_0"])) THEN (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN ((USE_THM_THEN REAL_DIFFERENTIABLE_CONST)(fun th -> ONCE_REWRITE_TAC[th])) THEN ((TRY done_tac)))))));; +refine (by (VALID (((((USE_THEN "dG")(new_rewrite [] [])) THEN ((USE_THM_THEN IN_NUMSEG)(new_rewrite [] [])) THEN ((USE_THEN "n_eq_0")(new_rewrite [] [])) THEN ((USE_THM_THEN leqnn)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((THENL_ROT (-1)) (((fun thm_tac -> (USE_THM_THEN EXCLUDED_MIDDLE)(ISPEC_THEN (`n <= SUC m`) thm_tac))MP_TAC) THEN case THEN (simp_tac) THEN (move ["n_le_Sm"]))))));; +refine (by (VALID (((((USE_THEN "IHm")MP_TAC) THEN (clear_assumption "IHm") THEN (DISCH_THEN apply_tac) THEN (move ["i"]) THEN (move ["i_in"])) THEN (((USE_THEN "dG")MP_TAC) THEN (clear_assumption "dG") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID (((((USE_THEN "i_in")MP_TAC) THEN (clear_assumption "i_in") THEN BETA_TAC) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_NUMSEG)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN REAL_DIFFERENTIABLE_ADD)(new_rewrite [] [])) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (((USE_THEN "dG")(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "IHm")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN IN_NUMSEG)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "n_le_Sm")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN leqnn)(new_rewrite [] []))) THEN ((TRY done_tac)))))));; +refine (by (VALID (((BETA_TAC THEN (move ["i"]) THEN (move ["ineq"])) THEN (((USE_THEN "dG")MP_TAC) THEN (clear_assumption "dG") THEN (DISCH_THEN apply_tac)) THEN ((USE_THM_THEN IN_NUMSEG)(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +let differentiable_sum_numseg = end_section_proof();; +(start_section_proof ["G";"n";"m";"x"](`(!i. i IN n..m ==> G i real_differentiable atreal x) ==> + derivative (\x. sum (n..m) (\i. G i x)) x = sum (n..m) (\i. derivative (G i) x)`));; +refine (by (VALID ((((disch_tm_tac [](mk_var("m",mk_type("num",[])))) THEN (clear_assumption "m") THEN elim THENL [ALL_TAC; ((move ["m"]) THEN (move ["IHm"]))] THEN (move ["dG"])) THEN repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL SUM_CLAUSES_NUMSEG))(new_rewrite [] [])))))));; +refine (by (VALID ((((disch_tm_tac [](`n = 0`)) THEN case THEN (simp_tac)) THEN (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN derivative_const)(fun th -> ONCE_REWRITE_TAC[th]))) THEN (done_tac)))));; +refine (by (VALID (((THENL_ROT (-1)) (((fun thm_tac -> (USE_THM_THEN EXCLUDED_MIDDLE)(ISPEC_THEN (`n <= SUC m`) thm_tac))MP_TAC) THEN case THEN (simp_tac) THEN (move ["n_le_Sm"]))))));; +refine (by (VALID (((((USE_THEN "IHm")MP_TAC) THEN (clear_assumption "IHm") THEN (DISCH_THEN apply_tac) THEN (move ["i"]) THEN (move ["i_in"])) THEN (((USE_THEN "dG")MP_TAC) THEN (clear_assumption "dG") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID (((((USE_THEN "i_in")MP_TAC) THEN (clear_assumption "i_in") THEN BETA_TAC) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_NUMSEG)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((USE_THEN "IHm")(GSYM_THEN (new_rewrite [] []))))));; +refine (by (VALID (((BETA_TAC THEN (move ["i"]) THEN (move ["i_in"])) THEN (((USE_THEN "dG")MP_TAC) THEN (clear_assumption "dG") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID (((((USE_THEN "i_in")MP_TAC) THEN (clear_assumption "i_in") THEN BETA_TAC) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_NUMSEG)(new_rewrite [] []))) THEN (arith_tac)))));; +refine (by (VALID ((((USE_THM_THEN derivative_add)(new_rewrite [] [])) THEN (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN ((TRY done_tac)))))));; +refine (by (VALID (((((USE_THEN "dG")(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN IN_NUMSEG)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN leqnn)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andbT)(new_rewrite [] [])) THEN ((USE_THM_THEN differentiable_sum_numseg)(new_rewrite [] []))) THEN (move ["i"]) THEN (move ["i_in"])))));; +refine (by (VALID (((((USE_THEN "dG")MP_TAC) THEN (clear_assumption "dG") THEN (DISCH_THEN apply_tac)) THEN (((USE_THEN "i_in")MP_TAC) THEN (clear_assumption "i_in") THEN BETA_TAC) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_NUMSEG)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +let derivative_sum_numseg = end_section_proof();; +let derivative_sum_numseg = finalize_theorem derivative_sum_numseg;; +let differentiable_sum_numseg = finalize_theorem differentiable_sum_numseg;; +(end_section "MoreDerivativeArith");; +(start_section_proof ["f";"g";"x";"s"](`g real_differentiable atreal x /\ real_open s /\ x IN s /\ + (!y. y IN s ==> f y = g y) ==> f real_differentiable atreal x`));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN real_differentiable)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["f'"])) THEN (move ["dg"]) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["eq"])))));; +refine (by (VALID (((exists_tac (mk_var("f'",mk_type("real",[])))) THEN (((USE_THM_THEN Arc_properties.HAS_REAL_DERIVATIVE_LOCAL)MP_TAC) THEN (clear_assumption "Arc_properties.HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID (((exists_tac (mk_var("g",mk_type("fun",[mk_type("real",[]);mk_type("real",[])])))) THEN (((USE_THEN "dg")(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (exists_tac (mk_var("s",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))) THEN (done_tac)))));; +let differentiable_local = end_section_proof();; +(begin_section "NthDerivativeArith");; +(add_section_var (mk_var ("f", (`:real->real`))); add_section_var (mk_var ("g", (`:real->real`))));; +(add_section_var (mk_var ("int", (`:real#real`))));; +(add_section_var (mk_var ("n", (`:num`))));; +(add_section_hyp "df" (`nth_diff_strong_int n int f`));; +(start_section_proof ["c";"i";"x"](`interval_arith x int ==> i <= n ==> + ?s. real_open s /\ x IN s /\ + !y. y IN s ==> nth_derivative i (\y. c * f y) y = c * nth_derivative i f y`));; +refine (by (VALID (((((USE_THEN "df")MP_TAC) THEN (clear_assumption "df") THEN BETA_TAC) THEN ((((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_diff_strong)(new_rewrite [] []))) THEN (move ["df"]))))));; +refine (by (VALID ((((DISCH_THEN (fun snd_th -> (USE_THEN "df")(MATCH_MP_THEN snd_th MP_TAC))) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"]))) THEN ((((USE_THM_THEN nth_differentiable_on)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_differentiable_eq)(new_rewrite [] []))) THEN (move ["diff"]))))));; +refine (by (VALID (((THENL_FIRST) ((disch_tm_tac [](mk_var("i",mk_type("num",[])))) THEN (clear_assumption "i") THEN elim THENL [(move ["_"]); ((move ["i"]) THEN (move ["IHi"]))]) (repeat_tactic 1 9 (((USE_THM_THEN nth_derivative0)(new_rewrite [] []))) THEN (exists_tac (mk_var("s",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))) THEN (done_tac))))));; +refine (by (VALID (((((USE_THM_THEN nth_derivativeS)(new_rewrite [] [])) THEN ((USE_THM_THEN ltE)(GSYM_THEN (new_rewrite [] [])))) THEN (move ["i_lt_n"])))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "IHi")(fun fst_th ->(fun thm_tac -> (USE_THM_THEN ltnW)(fun fst_th ->(USE_THEN "i_lt_n")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["eq"])) THEN (((USE_THEN "IHi")MP_TAC) THEN (clear_assumption "IHi") THEN BETA_TAC THEN (move ["_"]))))));; +refine (by (VALID (((exists_tac (`s INTER t`)) THEN ((((USE_THM_THEN REAL_OPEN_INTER)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THEN "xt")(new_rewrite [] [])) THEN ((USE_THEN "xs")(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"]))))))));; +refine (by (VALID ((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID ((((USE_THM_THEN Arc_properties.HAS_REAL_DERIVATIVE_LOCAL)MP_TAC) THEN (clear_assumption "Arc_properties.HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID ((exists_tac (`\y. c * nth_derivative i f y`)))));; +refine (by (VALID ((((USE_THM_THEN HAS_REAL_DERIVATIVE_LMUL_ATREAL)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN ((fun thm_tac -> (USE_THEN "diff")(fun fst_th ->(USE_THEN "ys")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN (done_tac)))));; +refine (by (VALID (((exists_tac (`s INTER t`)) THEN ((((USE_THM_THEN REAL_OPEN_INTER)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THEN "yt")(new_rewrite [1] [])) THEN ((USE_THEN "ys")(new_rewrite [1] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["z"]) THEN (move ["z_in"]) THEN (simp_tac))))));; +refine (by (VALID ((((USE_THEN "eq")(new_rewrite [] [])) THEN (done_tac)))));; +let nth_derivative_scale_strong = end_section_proof();; +(start_section_proof ["c";"x"](`interval_arith x int ==> + ?s. real_open s /\ x IN s /\ + !i y. i <= n /\ y IN s ==> nth_derivative i (\y. c * f y) y = c * nth_derivative i f y`));; +refine (by (VALID ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (fun thm_tac -> (USE_THM_THEN nth_derivative_scale_strong)(ISPEC_THEN (mk_var("c",mk_type("real",[]))) thm_tac))(MATCH_MP_THEN snd_th MP_TAC))) THEN (move ["h"])))));; +refine (by (VALID ((set_tac "P" (`\i s. real_open s /\ x IN s /\ + (!y. y IN s ==> nth_derivative i (\y. c * f y) y = c * nth_derivative i f y)`)))));; +refine (by (VALID ((have_tac (move ["sel_P"]) (`!i. i <= n:num ==> P i ((@) (P i))`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["i"]) THEN (move ["i_le_n"])) THEN ((USE_THM_THEN SELECT_AX) apply_tac)))));; +refine (by (VALID ((((fun thm_tac -> (USE_THEN "h")(fun fst_th ->(USE_THEN "i_le_n")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (move ["cond"])))));; +refine (by (VALID (((exists_tac (mk_var("s",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))) THEN (((USE_THEN "P_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac)) THEN (done_tac)))));; +refine (by (VALID ((set_tac "S" (`INTERS (IMAGE (\i. (@) (P i)) (0..n))`)))));; +refine (by (VALID ((exists_tac (mk_var("S",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))))));; +refine (by (VALID ((((USE_THEN "S_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_OPEN_INTERS)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN FINITE_IMAGE)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN FINITE_NUMSEG)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN IN_IMAGE)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (DISCH_THEN(new_rewrite [] [])))) THEN (((USE_THM_THEN IN_NUMSEG_0)(new_rewrite [] [])) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "sel_P")(MATCH_MP_THEN snd_th MP_TAC))))))));; +refine (by (VALID (((((USE_THEN "P_def")(GSYM_THEN (new_rewrite [1] []))) THEN (simp_tac)) THEN (done_tac)))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN IN_INTERS)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_IMAGE)(new_rewrite [] [])))) THEN (split_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (DISCH_THEN(new_rewrite [] [])))) THEN (((USE_THM_THEN IN_NUMSEG_0)(new_rewrite [] [])) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "sel_P")(MATCH_MP_THEN snd_th MP_TAC))))))));; +refine (by (VALID (((((USE_THEN "P_def")(GSYM_THEN (new_rewrite [1] []))) THEN (simp_tac)) THEN (done_tac)))));; +refine (by (VALID ((BETA_TAC THEN (move ["i"]) THEN (move ["y"]) THEN (case THEN (move ["i_le_n"]))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "sel_P")(fun fst_th ->(USE_THEN "i_le_n")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC) THEN ((((USE_THEN "P_def")(GSYM_THEN (new_rewrite [1] []))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["y_in"]) THEN ((fun thm_tac -> DISCH_THEN (ISPEC_THEN (`(@) (P i)`) thm_tac))MP_TAC))))));; +refine (by (VALID (((THENL_FIRST) (ANTS_TAC) ((exists_tac (mk_var("i",mk_type("num",[])))) THEN ((USE_THM_THEN IN_NUMSEG_0)(new_rewrite [] [])) THEN (done_tac))))));; +refine (by (VALID ((((USE_THEN "y_in")MP_TAC) THEN (clear_assumption "y_in") THEN (exact_tac)))));; +let nth_derivative_scale_strong_all = end_section_proof();; +(start_section_proof ["c";"i";"x"](`interval_arith x int ==> i <= n ==> + nth_derivative i (\x. c * f x) x = c * nth_derivative i f x`));; +refine (by (VALID ((BETA_TAC THEN (move ["ineq"]) THEN (move ["i_le_n"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN nth_derivative_scale_strong)(ISPEC_THEN (mk_var("c",mk_type("real",[]))) thm_tac))(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "i_le_n")(fun th -> MATCH_MP_THEN th thm_tac fst_th))) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xs"])) THEN (move ["h"])))));; +refine (by (VALID ((((USE_THEN "h")MP_TAC) THEN (clear_assumption "h") THEN (exact_tac)))));; +let nth_derivative_scale = end_section_proof();; +(start_section_proof ["c"](`nth_diff_strong_int n int (\x. c * f x)`));; +refine (by (VALID (((((USE_THEN "df")MP_TAC) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_differentiable_on)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_differentiable_eq)(new_rewrite [] []))))))));; +refine (by (VALID ((BETA_TAC THEN (move ["df"]) THEN (move ["x"]) THEN (move ["ineq"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN nth_derivative_scale_strong_all)(ISPEC_THEN (mk_var("c",mk_type("real",[]))) thm_tac))(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th))) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["diff"])))));; +refine (by (VALID ((((fun thm_tac -> (USE_THEN "df")(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["diff2"])))));; +refine (by (VALID (((exists_tac (`s INTER t`)) THEN ((((USE_THM_THEN REAL_OPEN_INTER)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN IN_INTER)(new_rewrite [] [])) THEN ((USE_THEN "xs")(new_rewrite [1] [])) THEN ((USE_THEN "xt")(new_rewrite [1] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["yt"]))))))));; +refine (by (VALID (((((USE_THM_THEN REAL_CONTINUOUS_LMUL)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "diff2")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["i"]) THEN (move ["i_lt_n"])))));; +refine (by (VALID ((((USE_THEN "diff")(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "ys")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN ltE)(GSYM_THEN (new_rewrite [] [])))) THEN ((TRY done_tac))))));; +refine (by (VALID ((((USE_THM_THEN Arc_properties.HAS_REAL_DERIVATIVE_LOCAL)MP_TAC) THEN (clear_assumption "Arc_properties.HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID ((exists_tac (`(\y. c * nth_derivative i f y)`)))));; +refine (by (VALID (((THENL_FIRST) (((USE_THM_THEN HAS_REAL_DERIVATIVE_LMUL_ATREAL)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))) (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN ((fun thm_tac -> (USE_THEN "diff2")(fun fst_th ->(USE_THEN "yt")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN (done_tac))))));; +refine (by (VALID (((exists_tac (mk_var("s",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))) THEN ((((USE_THEN "open_s")(new_rewrite [] [])) THEN ((USE_THEN "ys")(new_rewrite [1] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["z"]) THEN (move ["zs"]) THEN (simp_tac))))));; +refine (by (VALID (((((USE_THEN "diff")MP_TAC) THEN (clear_assumption "diff") THEN (DISCH_THEN apply_tac)) THEN ((USE_THM_THEN ltnW)(new_rewrite [] [])) THEN (done_tac)))));; +let nth_diff_scale = end_section_proof();; +(add_section_hyp "dg" (`nth_diff_strong_int n int g`));; +(start_section_proof ["i";"x"](`interval_arith x int ==> i <= n ==> + ?s. real_open s /\ x IN s /\ + !y. y IN s ==> nth_derivative i (\y. f y + g y) y = nth_derivative i f y + nth_derivative i g y`));; +refine (by (VALID (((((USE_THEN "dg")MP_TAC) THEN (clear_assumption "dg") THEN ((USE_THEN "df")MP_TAC) THEN (clear_assumption "df") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong)(new_rewrite [] [])))) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["ineq"]))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "df")(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["sf"])) THEN (case THEN (move ["open_sf"])) THEN (case THEN (move ["xsf"]))) THEN (((USE_THEN "df")MP_TAC) THEN (clear_assumption "df") THEN BETA_TAC THEN (move ["_"]))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "dg")(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["sg"])) THEN (case THEN (move ["open_sg"])) THEN (case THEN (move ["xsg"]))) THEN (((USE_THEN "dg")MP_TAC) THEN (clear_assumption "dg") THEN BETA_TAC THEN (move ["_"]))))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN nth_differentiable_on)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_differentiable_eq)(new_rewrite [] [])))) THEN (move ["diff_g"]) THEN (move ["diff_f"])))));; +refine (by (VALID (((THENL_FIRST) ((disch_tm_tac [](mk_var("i",mk_type("num",[])))) THEN (clear_assumption "i") THEN elim THENL [(move ["_"]); ((move ["i"]) THEN (move ["IHi"]))]) (repeat_tactic 1 9 (((USE_THM_THEN nth_derivative0)(new_rewrite [] []))) THEN (exists_tac (mk_var("sf",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))) THEN (done_tac))))));; +refine (by (VALID (((((USE_THM_THEN nth_derivativeS)(new_rewrite [] [])) THEN ((USE_THM_THEN ltE)(GSYM_THEN (new_rewrite [] [])))) THEN (move ["i_lt_n"])))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "IHi")(fun fst_th ->(fun thm_tac -> (USE_THM_THEN ltnW)(fun fst_th ->(USE_THEN "i_lt_n")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["eq"])) THEN (((USE_THEN "IHi")MP_TAC) THEN (clear_assumption "IHi") THEN BETA_TAC THEN (move ["_"]))))));; +refine (by (VALID ((exists_tac (`sf INTER sg INTER t`)))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN REAL_OPEN_INTER)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THEN "xt")(new_rewrite [] [])) THEN ((USE_THEN "xsf")(new_rewrite [] [])) THEN ((USE_THEN "xsg")(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["y"]) THEN (case THEN (move ["ysf"])) THEN (case THEN ((move ["ysg"]) THEN (move ["yt"])))))));; +refine (by (VALID ((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID ((((USE_THM_THEN Arc_properties.HAS_REAL_DERIVATIVE_LOCAL)MP_TAC) THEN (clear_assumption "Arc_properties.HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID ((exists_tac (`(\y. nth_derivative i f y + nth_derivative i g y)`)))));; +refine (by (VALID ((((USE_THM_THEN HAS_REAL_DERIVATIVE_ADD)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (((fun thm_tac -> (USE_THEN "diff_f")(fun fst_th ->(USE_THEN "ysf")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((fun thm_tac -> (USE_THEN "diff_g")(fun fst_th ->(USE_THEN "ysg")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((exists_tac (`sf INTER sg INTER t`)) THEN (repeat_tactic 1 9 (((USE_THM_THEN REAL_OPEN_INTER)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THEN "yt")(new_rewrite [1] [])) THEN ((USE_THEN "ysf")(new_rewrite [1] [])) THEN ((USE_THEN "ysg")(new_rewrite [1] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] []))))))));; +refine (by (VALID (((BETA_TAC THEN (move ["z"]) THEN (move ["z_in"]) THEN (simp_tac)) THEN ((USE_THEN "eq")(new_rewrite [] [])) THEN (done_tac)))));; +let nth_derivative_add_strong = end_section_proof();; +(start_section_proof ["x"](`interval_arith x int ==> + ?s. real_open s /\ x IN s /\ + !i y. i <= n /\ y IN s ==> + nth_derivative i (\y. f y + g y) y = nth_derivative i f y + nth_derivative i g y`));; +refine (by (VALID ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (USE_THM_THEN nth_derivative_add_strong)(MATCH_MP_THEN snd_th MP_TAC))) THEN (move ["h"])))));; +refine (by (VALID ((set_tac "P" (`\i s. real_open s /\ x IN s /\ + (!y. y IN s ==> nth_derivative i (\y. f y + g y) y = nth_derivative i f y + nth_derivative i g y)`)))));; +refine (by (VALID ((have_tac (move ["sel_P"]) (`!i. i <= n:num ==> P i ((@) (P i))`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["i"]) THEN (move ["i_le_n"])) THEN ((USE_THM_THEN SELECT_AX) apply_tac)))));; +refine (by (VALID ((((fun thm_tac -> (USE_THEN "h")(fun fst_th ->(USE_THEN "i_le_n")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (move ["cond"])))));; +refine (by (VALID (((exists_tac (mk_var("s",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))) THEN (((USE_THEN "P_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac)) THEN (done_tac)))));; +refine (by (VALID ((set_tac "S" (`INTERS (IMAGE (\i. (@) (P i)) (0..n))`)))));; +refine (by (VALID ((exists_tac (mk_var("S",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))))));; +refine (by (VALID ((((USE_THEN "S_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_OPEN_INTERS)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN FINITE_IMAGE)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN FINITE_NUMSEG)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN IN_IMAGE)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (DISCH_THEN(new_rewrite [] [])))) THEN (((USE_THM_THEN IN_NUMSEG_0)(new_rewrite [] [])) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "sel_P")(MATCH_MP_THEN snd_th MP_TAC))))))));; +refine (by (VALID (((((USE_THEN "P_def")(GSYM_THEN (new_rewrite [1] []))) THEN (simp_tac)) THEN (done_tac)))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN IN_INTERS)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_IMAGE)(new_rewrite [] [])))) THEN (split_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (DISCH_THEN(new_rewrite [] [])))) THEN (((USE_THM_THEN IN_NUMSEG_0)(new_rewrite [] [])) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "sel_P")(MATCH_MP_THEN snd_th MP_TAC))))))));; +refine (by (VALID (((((USE_THEN "P_def")(GSYM_THEN (new_rewrite [1] []))) THEN (simp_tac)) THEN (done_tac)))));; +refine (by (VALID ((BETA_TAC THEN (move ["i"]) THEN (move ["y"]) THEN (case THEN (move ["i_le_n"]))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "sel_P")(fun fst_th ->(USE_THEN "i_le_n")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC) THEN ((((USE_THEN "P_def")(GSYM_THEN (new_rewrite [1] []))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["y_in"]) THEN ((fun thm_tac -> DISCH_THEN (ISPEC_THEN (`(@) (P i)`) thm_tac))MP_TAC))))));; +refine (by (VALID (((THENL_FIRST) (ANTS_TAC) ((exists_tac (mk_var("i",mk_type("num",[])))) THEN ((USE_THM_THEN IN_NUMSEG_0)(new_rewrite [] [])) THEN (done_tac))))));; +refine (by (VALID ((((USE_THEN "y_in")MP_TAC) THEN (clear_assumption "y_in") THEN (exact_tac)))));; +let nth_derivative_add_strong_all = end_section_proof();; +(start_section_proof ["i";"x"](`interval_arith x int ==> i <= n ==> + nth_derivative i (\x. f x + g x) x = nth_derivative i f x + nth_derivative i g x`));; +refine (by (VALID ((BETA_TAC THEN (move ["ineq"]) THEN (move ["i_le_n"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN nth_derivative_add_strong)(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "i_le_n")(fun th -> MATCH_MP_THEN th thm_tac fst_th))) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xs"])) THEN (move ["h"])))));; +refine (by (VALID ((((USE_THEN "h")MP_TAC) THEN (clear_assumption "h") THEN (exact_tac)))));; +let nth_derivative_add = end_section_proof();; +(start_section_proof [](`nth_diff_strong_int n int (\x. f x + g x)`));; +refine (by (VALID ((((USE_THEN "dg")MP_TAC) THEN ((USE_THEN "df")MP_TAC) THEN BETA_TAC))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_differentiable_on)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_differentiable_eq)(new_rewrite [] [])))))));; +refine (by (VALID ((BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["x"]) THEN (move ["ineq"])))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN nth_derivative_add_strong_all)(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th))) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["diff"])))));; +refine (by (VALID ((((fun thm_tac -> (USE_THEN "df")(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["tf"])) THEN (case THEN (move ["open_tf"])) THEN (case THEN (move ["xtf"])) THEN (move ["diff_f"])))));; +refine (by (VALID ((((fun thm_tac -> (USE_THEN "dg")(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["tg"])) THEN (case THEN (move ["open_tg"])) THEN (case THEN (move ["xtg"])) THEN (move ["diff_g"])))));; +refine (by (VALID (((exists_tac (`s INTER tf INTER tg`)) THEN (repeat_tactic 1 9 (((USE_THM_THEN REAL_OPEN_INTER)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THEN "xs")(new_rewrite [1] [])) THEN ((USE_THEN "xtf")(new_rewrite [1] [])) THEN ((USE_THEN "xtg")(new_rewrite [1] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] []))))))));; +refine (by (VALID ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (case THEN ((move ["ytf"]) THEN (move ["ytg"])))))))));; +refine (by (VALID (((((USE_THM_THEN REAL_CONTINUOUS_ADD)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "diff_f")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "diff_g")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["i"]) THEN (move ["i_lt_n"])))));; +refine (by (VALID ((((USE_THEN "diff")(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "ys")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN ltE)(GSYM_THEN (new_rewrite [] [])))) THEN ((TRY done_tac))))));; +refine (by (VALID ((((USE_THM_THEN Arc_properties.HAS_REAL_DERIVATIVE_LOCAL)MP_TAC) THEN (clear_assumption "Arc_properties.HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID ((exists_tac (`(\y. nth_derivative i f y + nth_derivative i g y)`)))));; +refine (by (VALID (((THENL_FIRST) (((USE_THM_THEN HAS_REAL_DERIVATIVE_ADD)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))) (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (((fun thm_tac -> (USE_THEN "diff_f")(fun fst_th ->(USE_THEN "ytf")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((fun thm_tac -> (USE_THEN "diff_g")(fun fst_th ->(USE_THEN "ytg")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] []))) THEN (done_tac))))));; +refine (by (VALID (((exists_tac (mk_var("s",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))) THEN ((((USE_THEN "open_s")(new_rewrite [] [])) THEN ((USE_THEN "ys")(new_rewrite [1] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["z"]) THEN (move ["zs"]) THEN (simp_tac))))));; +refine (by (VALID (((((USE_THEN "diff")MP_TAC) THEN (clear_assumption "diff") THEN (DISCH_THEN apply_tac)) THEN ((USE_THM_THEN ltnW)(new_rewrite [] [])) THEN (done_tac)))));; +let nth_diff_add = end_section_proof();; +(start_section_proof ["i";"x"](`interval_arith x int ==> i <= n ==> + ?s. real_open s /\ x IN s /\ + !y. y IN s ==> nth_derivative i (\y. f y - g y) y = nth_derivative i f y - nth_derivative i g y`));; +refine (by (VALID (((((USE_THEN "dg")MP_TAC) THEN (clear_assumption "dg") THEN ((USE_THEN "df")MP_TAC) THEN (clear_assumption "df") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong)(new_rewrite [] [])))) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["ineq"]))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "df")(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["sf"])) THEN (case THEN (move ["open_sf"])) THEN (case THEN (move ["xsf"]))) THEN (((USE_THEN "df")MP_TAC) THEN (clear_assumption "df") THEN BETA_TAC THEN (move ["_"]))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "dg")(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["sg"])) THEN (case THEN (move ["open_sg"])) THEN (case THEN (move ["xsg"]))) THEN (((USE_THEN "dg")MP_TAC) THEN (clear_assumption "dg") THEN BETA_TAC THEN (move ["_"]))))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN nth_differentiable_on)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_differentiable_eq)(new_rewrite [] [])))) THEN (move ["diff_g"]) THEN (move ["diff_f"])))));; +refine (by (VALID (((THENL_FIRST) ((disch_tm_tac [](mk_var("i",mk_type("num",[])))) THEN (clear_assumption "i") THEN elim THENL [(move ["_"]); ((move ["i"]) THEN (move ["IHi"]))]) (repeat_tactic 1 9 (((USE_THM_THEN nth_derivative0)(new_rewrite [] []))) THEN (exists_tac (mk_var("sf",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))) THEN (done_tac))))));; +refine (by (VALID (((((USE_THM_THEN nth_derivativeS)(new_rewrite [] [])) THEN ((USE_THM_THEN ltE)(GSYM_THEN (new_rewrite [] [])))) THEN (move ["i_lt_n"])))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "IHi")(fun fst_th ->(fun thm_tac -> (USE_THM_THEN ltnW)(fun fst_th ->(USE_THEN "i_lt_n")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["eq"])) THEN (((USE_THEN "IHi")MP_TAC) THEN (clear_assumption "IHi") THEN BETA_TAC THEN (move ["_"]))))));; +refine (by (VALID ((exists_tac (`sf INTER sg INTER t`)))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN REAL_OPEN_INTER)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THEN "xt")(new_rewrite [] [])) THEN ((USE_THEN "xsf")(new_rewrite [] [])) THEN ((USE_THEN "xsg")(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["y"]) THEN (case THEN (move ["ysf"])) THEN (case THEN ((move ["ysg"]) THEN (move ["yt"])))))));; +refine (by (VALID ((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID ((((USE_THM_THEN Arc_properties.HAS_REAL_DERIVATIVE_LOCAL)MP_TAC) THEN (clear_assumption "Arc_properties.HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID ((exists_tac (`(\y. nth_derivative i f y - nth_derivative i g y)`)))));; +refine (by (VALID ((((USE_THM_THEN HAS_REAL_DERIVATIVE_SUB)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (((fun thm_tac -> (USE_THEN "diff_f")(fun fst_th ->(USE_THEN "ysf")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((fun thm_tac -> (USE_THEN "diff_g")(fun fst_th ->(USE_THEN "ysg")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((exists_tac (`sf INTER sg INTER t`)) THEN (repeat_tactic 1 9 (((USE_THM_THEN REAL_OPEN_INTER)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THEN "yt")(new_rewrite [1] [])) THEN ((USE_THEN "ysf")(new_rewrite [1] [])) THEN ((USE_THEN "ysg")(new_rewrite [1] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] []))))))));; +refine (by (VALID (((BETA_TAC THEN (move ["z"]) THEN (move ["z_in"]) THEN (simp_tac)) THEN ((USE_THEN "eq")(new_rewrite [] [])) THEN (done_tac)))));; +let nth_derivative_sub_strong = end_section_proof();; +(start_section_proof ["x"](`interval_arith x int ==> + ?s. real_open s /\ x IN s /\ + !i y. i <= n /\ y IN s ==> + nth_derivative i (\y. f y - g y) y = nth_derivative i f y - nth_derivative i g y`));; +refine (by (VALID ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (USE_THM_THEN nth_derivative_sub_strong)(MATCH_MP_THEN snd_th MP_TAC))) THEN (move ["h"])))));; +refine (by (VALID ((set_tac "P" (`\i s. real_open s /\ x IN s /\ + (!y. y IN s ==> nth_derivative i (\y. f y - g y) y = nth_derivative i f y - nth_derivative i g y)`)))));; +refine (by (VALID ((have_tac (move ["sel_P"]) (`!i. i <= n:num ==> P i ((@) (P i))`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["i"]) THEN (move ["i_le_n"])) THEN ((USE_THM_THEN SELECT_AX) apply_tac)))));; +refine (by (VALID ((((fun thm_tac -> (USE_THEN "h")(fun fst_th ->(USE_THEN "i_le_n")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (move ["cond"])))));; +refine (by (VALID (((exists_tac (mk_var("s",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))) THEN (((USE_THEN "P_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac)) THEN (done_tac)))));; +refine (by (VALID ((set_tac "S" (`INTERS (IMAGE (\i. (@) (P i)) (0..n))`)))));; +refine (by (VALID ((exists_tac (mk_var("S",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))))));; +refine (by (VALID ((((USE_THEN "S_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_OPEN_INTERS)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN FINITE_IMAGE)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN FINITE_NUMSEG)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN IN_IMAGE)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (DISCH_THEN(new_rewrite [] [])))) THEN (((USE_THM_THEN IN_NUMSEG_0)(new_rewrite [] [])) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "sel_P")(MATCH_MP_THEN snd_th MP_TAC))))))));; +refine (by (VALID (((((USE_THEN "P_def")(GSYM_THEN (new_rewrite [1] []))) THEN (simp_tac)) THEN (done_tac)))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN IN_INTERS)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_IMAGE)(new_rewrite [] [])))) THEN (split_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (DISCH_THEN(new_rewrite [] [])))) THEN (((USE_THM_THEN IN_NUMSEG_0)(new_rewrite [] [])) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "sel_P")(MATCH_MP_THEN snd_th MP_TAC))))))));; +refine (by (VALID (((((USE_THEN "P_def")(GSYM_THEN (new_rewrite [1] []))) THEN (simp_tac)) THEN (done_tac)))));; +refine (by (VALID ((BETA_TAC THEN (move ["i"]) THEN (move ["y"]) THEN (case THEN (move ["i_le_n"]))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "sel_P")(fun fst_th ->(USE_THEN "i_le_n")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC) THEN ((((USE_THEN "P_def")(GSYM_THEN (new_rewrite [1] []))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["y_in"]) THEN ((fun thm_tac -> DISCH_THEN (ISPEC_THEN (`(@) (P i)`) thm_tac))MP_TAC))))));; +refine (by (VALID (((THENL_FIRST) (ANTS_TAC) ((exists_tac (mk_var("i",mk_type("num",[])))) THEN ((USE_THM_THEN IN_NUMSEG_0)(new_rewrite [] [])) THEN (done_tac))))));; +refine (by (VALID ((((USE_THEN "y_in")MP_TAC) THEN (clear_assumption "y_in") THEN (exact_tac)))));; +let nth_derivative_sub_strong_all = end_section_proof();; +(start_section_proof ["i";"x"](`interval_arith x int ==> i <= n ==> + nth_derivative i (\x. f x - g x) x = nth_derivative i f x - nth_derivative i g x`));; +refine (by (VALID ((BETA_TAC THEN (move ["ineq"]) THEN (move ["i_le_n"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN nth_derivative_sub_strong)(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "i_le_n")(fun th -> MATCH_MP_THEN th thm_tac fst_th))) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xs"])) THEN (move ["h"])))));; +refine (by (VALID ((((USE_THEN "h")MP_TAC) THEN (clear_assumption "h") THEN (exact_tac)))));; +let nth_derivative_sub = end_section_proof();; +(start_section_proof [](`nth_diff_strong_int n int (\x. f x - g x)`));; +refine (by (VALID ((((USE_THEN "dg")MP_TAC) THEN ((USE_THEN "df")MP_TAC) THEN BETA_TAC))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_differentiable_on)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_differentiable_eq)(new_rewrite [] [])))))));; +refine (by (VALID ((BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["x"]) THEN (move ["ineq"])))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN nth_derivative_sub_strong_all)(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th))) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["diff"])))));; +refine (by (VALID ((((fun thm_tac -> (USE_THEN "df")(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["tf"])) THEN (case THEN (move ["open_tf"])) THEN (case THEN (move ["xtf"])) THEN (move ["diff_f"])))));; +refine (by (VALID ((((fun thm_tac -> (USE_THEN "dg")(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["tg"])) THEN (case THEN (move ["open_tg"])) THEN (case THEN (move ["xtg"])) THEN (move ["diff_g"])))));; +refine (by (VALID (((exists_tac (`s INTER tf INTER tg`)) THEN (repeat_tactic 1 9 (((USE_THM_THEN REAL_OPEN_INTER)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THEN "xs")(new_rewrite [1] [])) THEN ((USE_THEN "xtf")(new_rewrite [1] [])) THEN ((USE_THEN "xtg")(new_rewrite [1] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] []))))))));; +refine (by (VALID ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (case THEN ((move ["ytf"]) THEN (move ["ytg"])))))))));; +refine (by (VALID (((((USE_THM_THEN REAL_CONTINUOUS_SUB)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "diff_f")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "diff_g")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["i"]) THEN (move ["i_lt_n"])))));; +refine (by (VALID ((((USE_THEN "diff")(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "ys")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN ltE)(GSYM_THEN (new_rewrite [] [])))) THEN ((TRY done_tac))))));; +refine (by (VALID ((((USE_THM_THEN Arc_properties.HAS_REAL_DERIVATIVE_LOCAL)MP_TAC) THEN (clear_assumption "Arc_properties.HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID ((exists_tac (`(\y. nth_derivative i f y - nth_derivative i g y)`)))));; +refine (by (VALID (((THENL_FIRST) (((USE_THM_THEN HAS_REAL_DERIVATIVE_SUB)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))) (((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (((fun thm_tac -> (USE_THEN "diff_f")(fun fst_th ->(USE_THEN "ytf")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((fun thm_tac -> (USE_THEN "diff_g")(fun fst_th ->(USE_THEN "ytg")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] []))) THEN (done_tac))))));; +refine (by (VALID (((exists_tac (mk_var("s",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))) THEN ((((USE_THEN "open_s")(new_rewrite [] [])) THEN ((USE_THEN "ys")(new_rewrite [1] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["z"]) THEN (move ["zs"]) THEN (simp_tac))))));; +refine (by (VALID (((((USE_THEN "diff")MP_TAC) THEN (clear_assumption "diff") THEN (DISCH_THEN apply_tac)) THEN ((USE_THM_THEN ltnW)(new_rewrite [] [])) THEN (done_tac)))));; +let nth_diff_sub = end_section_proof();; +(start_section_proof ["i";"x"](`interval_arith x int ==> i <= n ==> + ?s. real_open s /\ x IN s /\ + !y. y IN s ==> nth_derivative i (\y. f y * g y) y = + sum (0..i) (\k. &(binom (i, k)) * nth_derivative k f y * nth_derivative (i - k) g y)`));; +refine (by (VALID (((((USE_THEN "dg")MP_TAC) THEN (clear_assumption "dg") THEN ((USE_THEN "df")MP_TAC) THEN (clear_assumption "df") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong)(new_rewrite [] [])))) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["ineq"]))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "df")(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["sf"])) THEN (case THEN (move ["open_sf"])) THEN (case THEN (move ["xsf"]))) THEN (((USE_THEN "df")MP_TAC) THEN (clear_assumption "df") THEN BETA_TAC THEN (move ["_"]))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "dg")(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["sg"])) THEN (case THEN (move ["open_sg"])) THEN (case THEN (move ["xsg"]))) THEN (((USE_THEN "dg")MP_TAC) THEN (clear_assumption "dg") THEN BETA_TAC THEN (move ["_"]))))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN nth_differentiable_on)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_differentiable_eq)(new_rewrite [] [])))) THEN (move ["diff_g"]) THEN (move ["diff_f"])))));; +refine (by (VALID (((disch_tm_tac [](mk_var("i",mk_type("num",[])))) THEN (clear_assumption "i") THEN elim THENL [(move ["_"]); ((move ["i"]) THEN (move ["IHi"]))]))));; +refine (by (VALID (((exists_tac (mk_var("sf",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))) THEN ((((USE_THEN "open_sf")(new_rewrite [] [])) THEN ((USE_THEN "xsf")(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_derivative0)(new_rewrite [] []))) THEN ((USE_THM_THEN SUM_SING_NUMSEG)(new_rewrite [] []))) THEN (move ["y"]) THEN (move ["_"]) THEN (simp_tac))))));; +refine (by (VALID (((((USE_THM_THEN subn0)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_derivative0)(new_rewrite [] []))) THEN ((USE_THM_THEN binom)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_LID)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN nth_derivativeS)(new_rewrite [] [])) THEN ((USE_THM_THEN ltE)(GSYM_THEN (new_rewrite [] [])))) THEN (move ["i_lt_n"])))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "IHi")(fun fst_th ->(fun thm_tac -> (USE_THM_THEN ltnW)(fun fst_th ->(USE_THEN "i_lt_n")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["eq"])) THEN (((USE_THEN "IHi")MP_TAC) THEN (clear_assumption "IHi") THEN BETA_TAC THEN (move ["_"]))))));; +refine (by (VALID ((exists_tac (`sf INTER sg INTER t`)))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN REAL_OPEN_INTER)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THEN "xt")(new_rewrite [] [])) THEN ((USE_THEN "xsf")(new_rewrite [] [])) THEN ((USE_THEN "xsg")(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["y"]) THEN (case THEN (move ["ysf"])) THEN (case THEN ((move ["ysg"]) THEN (move ["yt"])))))));; +refine (by (VALID ((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID ((((USE_THM_THEN Arc_properties.HAS_REAL_DERIVATIVE_LOCAL)MP_TAC) THEN (clear_assumption "Arc_properties.HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID ((exists_tac (`\y. sum (0..i) (\k. &(binom (i, k)) * nth_derivative k f y * nth_derivative (i - k) g y)`)))));; +refine (by (VALID (((THENL_ROT (-1)) (split_tac)))));; +refine (by (VALID (((exists_tac (`sf INTER sg INTER t`)) THEN (repeat_tactic 1 9 (((USE_THM_THEN REAL_OPEN_INTER)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THEN "yt")(new_rewrite [1] [])) THEN ((USE_THEN "ysf")(new_rewrite [1] [])) THEN ((USE_THEN "ysg")(new_rewrite [1] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] []))))))));; +refine (by (VALID (((BETA_TAC THEN (move ["z"]) THEN (move ["z_in"]) THEN (simp_tac)) THEN ((USE_THEN "eq")(new_rewrite [] [])) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN has_derivative_lemma)MP_TAC) THEN (clear_assumption "has_derivative_lemma") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID ((have_tac (move ["diff_cond"]) (`!k. k IN 0..i ==> + nth_derivative k f real_differentiable atreal y /\ + nth_derivative (i - k) g real_differentiable atreal y`)))));; +refine (by (VALID (((((USE_THM_THEN IN_NUMSEG)(new_rewrite [] [])) THEN (move ["k"]) THEN (move ["ineq"]) THEN (simp_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN real_differentiable)(new_rewrite [] []))) THEN (split_tac)))));; +refine (by (VALID (((exists_tac (`nth_derivative (SUC k) f y`)) THEN ((fun thm_tac -> (USE_THEN "diff_f")(fun fst_th ->(USE_THEN "ysf")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THEN "i_lt_n")MP_TAC) THEN (clear_assumption "i_lt_n") THEN ((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((exists_tac (`nth_derivative (SUC (i - k)) g y`)) THEN ((fun thm_tac -> (USE_THEN "diff_g")(fun fst_th ->(USE_THEN "ysg")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THEN "i_lt_n")MP_TAC) THEN (clear_assumption "i_lt_n") THEN ((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["diff_cond2"]) (`!k. k IN 0..i ==> + (\y. &(binom (i, k)) * nth_derivative k f y * nth_derivative (i - k) g y) + real_differentiable atreal y`)))));; +refine (by (VALID ((BETA_TAC THEN (move ["k"]) THEN (move ["k_in"]) THEN (simp_tac)))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN REAL_DIFFERENTIABLE_MUL_ATREAL)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_DIFFERENTIABLE_CONST)(new_rewrite [] [])))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (repeat_tactic 1 9 (((USE_THEN "diff_cond")(new_rewrite [] []))) THEN ((TRY done_tac))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN differentiable_sum_numseg)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN derivative_sum_numseg)(new_rewrite [] [])))) THEN ((simp_tac) THEN ((USE_THEN "diff_cond2")(fun th -> ONCE_REWRITE_TAC[th])) THEN ((TRY done_tac)))))));; +refine (by (VALID ((set_tac "lhs" (`sum (0..i) _`)))));; +refine (by (VALID ((set_tac "sum1" (`sum (0 + 1..i + 1) (\k. &(binom (i, k - 1)) * nth_derivative k f y * nth_derivative (SUC i - k) g y)`)))));; +refine (by (VALID ((set_tac "sum2" (`sum (0..i + 1) (\k. &(binom (i, k)) * nth_derivative k f y * nth_derivative (SUC i - k) g y)`)))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`lhs = sum1 + sum2`)))));; +refine (by (VALID ((((USE_THEN "sum1_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN SUM_OFFSET)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN addn1)(new_rewrite [] [])) THEN ((USE_THM_THEN succnK)(new_rewrite [] [])) THEN ((USE_THM_THEN subSS)(new_rewrite [] []))))));; +refine (by (VALID ((((USE_THEN "sum2_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN addn1)(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL SUM_CLAUSES_NUMSEG))(new_rewrite [] [])) THEN ((USE_THM_THEN (ARITH_RULE `0 <= SUC i`))(new_rewrite [] [])) THEN (simp_tac)))));; +refine (by (VALID (((THENL_FIRST) (have_tac (DISCH_THEN(new_rewrite [] [])) (`binom(i, SUC i) = 0`)) (((USE_THM_THEN BINOM_EQ_0)(new_rewrite [] [])) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID ((((USE_THM_THEN REAL_MUL_LZERO)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_ADD_RID)(new_rewrite [] [])) THEN ((USE_THM_THEN SUM_ADD_NUMSEG)(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THEN "lhs_def")(GSYM_THEN (new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN SUM_EQ) apply_tac) THEN (move ["k"]) THEN (move ["k_in"]) THEN (simp_tac)))));; +refine (by (VALID (((((USE_THM_THEN derivative_scale)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_DIFFERENTIABLE_MUL_ATREAL)(new_rewrite [] [])))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (repeat_tactic 0 10 (((USE_THEN "diff_cond")(new_rewrite [] []))) THEN ((TRY done_tac)))))));; +refine (by (VALID (((((USE_THM_THEN REAL_ADD_LDISTRIB)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_EQ_MUL_LCANCEL)(new_rewrite [] []))) THEN (DISJ2_TAC)))));; +refine (by (VALID ((((USE_THM_THEN derivative_mul)(new_rewrite [] [])) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (repeat_tactic 0 10 (((USE_THEN "diff_cond")(new_rewrite [] []))) THEN ((TRY done_tac)))))));; +refine (by (VALID ((((USE_THM_THEN REAL_ADD_SYM)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_derivativeS)(GSYM_THEN (new_rewrite [] []))))))));; +refine (by (VALID (((THENL_FIRST) (((THENL_ROT 1)) (have_tac (DISCH_THEN(new_rewrite [] [])) (`SUC (i - k) = SUC i - k`))) ((done_tac) THEN (done_tac))))));; +refine (by (VALID (((((USE_THEN "k_in")MP_TAC) THEN (clear_assumption "k_in") THEN BETA_TAC) THEN ((USE_THM_THEN IN_NUMSEG)(new_rewrite [] [])) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN REAL_ADD_SYM)(new_rewrite [] [])) THEN ((USE_THM_THEN SUM_CLAUSES_LEFT)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "sum2_def")(GSYM_THEN (new_rewrite [] [])))) THEN repeat_tactic 0 1 (((USE_THM_THEN SUM_CLAUSES_LEFT)(new_rewrite [] []))) THEN (simp_tac)) THEN ((TRY) (arith_tac))))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN binom)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_MUL_LID)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_ADD_ASSOC)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_EQ_ADD_LCANCEL)(new_rewrite [] []))))));; +refine (by (VALID ((((USE_THEN "sum1_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN SUM_ADD_NUMSEG)(GSYM_THEN (new_rewrite [] []))) THEN ((fun thm_tac -> (USE_THM_THEN addn1)(ISPEC_THEN (mk_var("i",mk_type("num",[]))) thm_tac))(new_rewrite [] []))))));; +refine (by (VALID ((((USE_THM_THEN SUM_EQ) apply_tac) THEN (move ["k"]) THEN (move ["k_in"]) THEN (simp_tac)))));; +refine (by (VALID (((((USE_THM_THEN REAL_ADD_RDISTRIB)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_EQ_MUL_RCANCEL)(new_rewrite [] []))) THEN (DISJ1_TAC)))));; +refine (by (VALID (((THENL_FIRST) ((((USE_THEN "k_in")MP_TAC) THEN (clear_assumption "k_in") THEN (disch_tm_tac [](mk_var("k",mk_type("num",[])))) THEN (clear_assumption "k") THEN case THENL [ALL_TAC; (move ["k"])]) THEN ((USE_THM_THEN IN_NUMSEG)(new_rewrite [] []))) ((arith_tac) THEN (done_tac))))));; +refine (by (VALID (((((USE_THM_THEN binom)(new_rewrite [] [])) THEN ((USE_THM_THEN ONE)(new_rewrite [] [])) THEN ((USE_THM_THEN subSS)(new_rewrite [] [])) THEN ((USE_THM_THEN subn0)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_OF_NUM_ADD)(new_rewrite [] []))) THEN (done_tac)))));; +let nth_derivative_mul_strong = end_section_proof();; +(start_section_proof ["x"](`interval_arith x int ==> + ?s. real_open s /\ x IN s /\ + !i y. i <= n /\ y IN s ==> + nth_derivative i (\y. f y * g y) y = + sum (0..i) (\k. &(binom (i, k)) * nth_derivative k f y * nth_derivative (i - k) g y)`));; +refine (by (VALID ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (USE_THM_THEN nth_derivative_mul_strong)(MATCH_MP_THEN snd_th MP_TAC))) THEN (move ["h"])))));; +refine (by (VALID ((set_tac "P" (`\i s. real_open s /\ x IN s /\ + (!y. y IN s ==> nth_derivative i (\y. f y * g y) y = + sum (0..i) (\k. &(binom (i, k)) * nth_derivative k f y * nth_derivative (i - k) g y))`)))));; +refine (by (VALID ((have_tac (move ["sel_P"]) (`!i. i <= n:num ==> P i ((@) (P i))`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["i"]) THEN (move ["i_le_n"])) THEN ((USE_THM_THEN SELECT_AX) apply_tac)))));; +refine (by (VALID ((((fun thm_tac -> (USE_THEN "h")(fun fst_th ->(USE_THEN "i_le_n")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (move ["cond"])))));; +refine (by (VALID (((exists_tac (mk_var("s",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))) THEN (((USE_THEN "P_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac)) THEN (done_tac)))));; +refine (by (VALID ((set_tac "S" (`INTERS (IMAGE (\i. (@) (P i)) (0..n))`)))));; +refine (by (VALID ((exists_tac (mk_var("S",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))))));; +refine (by (VALID ((((USE_THEN "S_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_OPEN_INTERS)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN FINITE_IMAGE)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN FINITE_NUMSEG)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN IN_IMAGE)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (DISCH_THEN(new_rewrite [] [])))) THEN (((USE_THM_THEN IN_NUMSEG_0)(new_rewrite [] [])) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "sel_P")(MATCH_MP_THEN snd_th MP_TAC))))))));; +refine (by (VALID (((((USE_THEN "P_def")(GSYM_THEN (new_rewrite [1] []))) THEN (simp_tac)) THEN (done_tac)))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN IN_INTERS)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_IMAGE)(new_rewrite [] [])))) THEN (split_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (case THEN (move ["i"])) THEN (case THEN (DISCH_THEN(new_rewrite [] [])))) THEN (((USE_THM_THEN IN_NUMSEG_0)(new_rewrite [] [])) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "sel_P")(MATCH_MP_THEN snd_th MP_TAC))))))));; +refine (by (VALID (((((USE_THEN "P_def")(GSYM_THEN (new_rewrite [1] []))) THEN (simp_tac)) THEN (done_tac)))));; +refine (by (VALID ((BETA_TAC THEN (move ["i"]) THEN (move ["y"]) THEN (case THEN (move ["i_le_n"]))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "sel_P")(fun fst_th ->(USE_THEN "i_le_n")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC) THEN ((((USE_THEN "P_def")(GSYM_THEN (new_rewrite [1] []))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["y_in"]) THEN ((fun thm_tac -> DISCH_THEN (ISPEC_THEN (`(@) (P i)`) thm_tac))MP_TAC))))));; +refine (by (VALID (((THENL_FIRST) (ANTS_TAC) ((exists_tac (mk_var("i",mk_type("num",[])))) THEN ((USE_THM_THEN IN_NUMSEG_0)(new_rewrite [] [])) THEN (done_tac))))));; +refine (by (VALID ((((USE_THEN "y_in")MP_TAC) THEN (clear_assumption "y_in") THEN (exact_tac)))));; +let nth_derivative_mul_strong_all = end_section_proof();; +(start_section_proof ["i";"x"](`interval_arith x int ==> i <= n ==> + nth_derivative i (\x. f x * g x) x = + sum (0..i) (\k. &(binom (i, k)) * nth_derivative k f x * nth_derivative (i - k) g x)`));; +refine (by (VALID ((BETA_TAC THEN (move ["ineq"]) THEN (move ["i_le_n"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN nth_derivative_mul_strong)(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "i_le_n")(fun th -> MATCH_MP_THEN th thm_tac fst_th))) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xs"])) THEN (move ["h"])))));; +refine (by (VALID ((((USE_THEN "h")MP_TAC) THEN (clear_assumption "h") THEN (exact_tac)))));; +let nth_derivative_mul = end_section_proof();; +(start_section_proof [](`nth_diff_strong_int n int (\x. f x * g x)`));; +refine (by (VALID ((((USE_THEN "dg")MP_TAC) THEN ((USE_THEN "df")MP_TAC) THEN BETA_TAC))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_differentiable_on)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_differentiable_eq)(new_rewrite [] [])))))));; +refine (by (VALID ((BETA_TAC THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["x"]) THEN (move ["ineq"])))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN nth_derivative_mul_strong_all)(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th))) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["diff"])))));; +refine (by (VALID ((((fun thm_tac -> (USE_THEN "df")(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["tf"])) THEN (case THEN (move ["open_tf"])) THEN (case THEN (move ["xtf"])) THEN (move ["diff_f"])))));; +refine (by (VALID ((((fun thm_tac -> (USE_THEN "dg")(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["tg"])) THEN (case THEN (move ["open_tg"])) THEN (case THEN (move ["xtg"])) THEN (move ["diff_g"])))));; +refine (by (VALID (((exists_tac (`s INTER tf INTER tg`)) THEN (repeat_tactic 1 9 (((USE_THM_THEN REAL_OPEN_INTER)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THEN "xs")(new_rewrite [1] [])) THEN ((USE_THEN "xtf")(new_rewrite [1] [])) THEN ((USE_THEN "xtg")(new_rewrite [1] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] []))))))));; +refine (by (VALID ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (case THEN ((move ["ytf"]) THEN (move ["ytg"])))))))));; +refine (by (VALID (((((USE_THM_THEN REAL_CONTINUOUS_MUL)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "diff_f")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "diff_g")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["i"]) THEN (move ["i_lt_n"])))));; +refine (by (VALID ((((USE_THM_THEN nth_derivativeS)(new_rewrite [] [])) THEN ((USE_THM_THEN has_derivative_alt)(new_rewrite [] []))))));; +refine (by (VALID ((((USE_THM_THEN differentiable_local)MP_TAC) THEN (clear_assumption "differentiable_local") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID (((exists_tac (`\y. sum (0..i) (\k. &(binom(i, k)) * nth_derivative k f y * nth_derivative (i - k) g y)`)) THEN (exists_tac (mk_var("s",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])]))))))));; +refine (by (VALID (((THENL_LAST) ((((USE_THEN "open_s")(new_rewrite [] [])) THEN ((USE_THEN "ys")(new_rewrite [1] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (split_tac)) ((BETA_TAC THEN (move ["z"]) THEN (move ["zs"])) THEN (((USE_THEN "diff")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN ltnW)(new_rewrite [] []))) THEN (done_tac))))));; +refine (by (VALID (((((USE_THM_THEN differentiable_sum_numseg)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_NUMSEG)(new_rewrite [] []))) THEN (move ["k"]) THEN (move ["k_in"]) THEN (simp_tac)))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN REAL_DIFFERENTIABLE_MUL_ATREAL)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_DIFFERENTIABLE_CONST)(new_rewrite [] []))) THEN ((TRY done_tac))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th]))))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN real_differentiable)(new_rewrite [] []))) THEN (split_tac)))));; +refine (by (VALID (((exists_tac (`nth_derivative (SUC k) f y`)) THEN ((fun thm_tac -> (USE_THEN "diff_f")(fun fst_th ->(USE_THEN "ytf")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THEN "i_lt_n")MP_TAC) THEN (clear_assumption "i_lt_n") THEN ((USE_THEN "k_in")MP_TAC) THEN (clear_assumption "k_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((exists_tac (`nth_derivative (SUC (i - k)) g y`)) THEN ((fun thm_tac -> (USE_THEN "diff_g")(fun fst_th ->(USE_THEN "ytg")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THEN "i_lt_n")MP_TAC) THEN (clear_assumption "i_lt_n") THEN ((USE_THEN "k_in")MP_TAC) THEN (clear_assumption "k_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +let nth_diff_mul = end_section_proof();; +let nth_diff_mul = finalize_theorem nth_diff_mul;; +let nth_derivative_mul = finalize_theorem nth_derivative_mul;; +let nth_derivative_mul_strong_all = finalize_theorem nth_derivative_mul_strong_all;; +let nth_derivative_mul_strong = finalize_theorem nth_derivative_mul_strong;; +let nth_diff_sub = finalize_theorem nth_diff_sub;; +let nth_derivative_sub = finalize_theorem nth_derivative_sub;; +let nth_derivative_sub_strong_all = finalize_theorem nth_derivative_sub_strong_all;; +let nth_derivative_sub_strong = finalize_theorem nth_derivative_sub_strong;; +let nth_diff_add = finalize_theorem nth_diff_add;; +let nth_derivative_add = finalize_theorem nth_derivative_add;; +let nth_derivative_add_strong_all = finalize_theorem nth_derivative_add_strong_all;; +let nth_derivative_add_strong = finalize_theorem nth_derivative_add_strong;; +let nth_diff_scale = finalize_theorem nth_diff_scale;; +let nth_derivative_scale = finalize_theorem nth_derivative_scale;; +let nth_derivative_scale_strong_all = finalize_theorem nth_derivative_scale_strong_all;; +let nth_derivative_scale_strong = finalize_theorem nth_derivative_scale_strong;; +(end_section "NthDerivativeArith");; +let nth_diff_mul = finalize_theorem nth_diff_mul;; +let nth_derivative_mul = finalize_theorem nth_derivative_mul;; +let nth_derivative_mul_strong_all = finalize_theorem nth_derivative_mul_strong_all;; +let nth_derivative_mul_strong = finalize_theorem nth_derivative_mul_strong;; +let nth_diff_sub = finalize_theorem nth_diff_sub;; +let nth_derivative_sub = finalize_theorem nth_derivative_sub;; +let nth_derivative_sub_strong_all = finalize_theorem nth_derivative_sub_strong_all;; +let nth_derivative_sub_strong = finalize_theorem nth_derivative_sub_strong;; +let nth_diff_add = finalize_theorem nth_diff_add;; +let nth_derivative_add = finalize_theorem nth_derivative_add;; +let nth_derivative_add_strong_all = finalize_theorem nth_derivative_add_strong_all;; +let nth_derivative_add_strong = finalize_theorem nth_derivative_add_strong;; +let nth_diff_scale = finalize_theorem nth_diff_scale;; +let nth_derivative_scale = finalize_theorem nth_derivative_scale;; +let nth_derivative_scale_strong_all = finalize_theorem nth_derivative_scale_strong_all;; +let nth_derivative_scale_strong = finalize_theorem nth_derivative_scale_strong;; +let differentiable_local = finalize_theorem differentiable_local;; +let derivative_sum_numseg = finalize_theorem derivative_sum_numseg;; +let differentiable_sum_numseg = finalize_theorem differentiable_sum_numseg;; +let derivative_div = finalize_theorem derivative_div;; +let derivative_sub = finalize_theorem derivative_sub;; +let derivative_mul = finalize_theorem derivative_mul;; +let derivative_add = finalize_theorem derivative_add;; +let derivative_pow = finalize_theorem derivative_pow;; +let derivative_neg = finalize_theorem derivative_neg;; +let derivative_scale = finalize_theorem derivative_scale;; +let derivative_compose_acs = finalize_theorem derivative_compose_acs;; +let derivative_compose_sqrt = finalize_theorem derivative_compose_sqrt;; +let derivative_compose_inv = finalize_theorem derivative_compose_inv;; +let derivative_compose_exp = finalize_theorem derivative_compose_exp;; +let derivative_compose_atn = finalize_theorem derivative_compose_atn;; +let REAL_DIFFERENTIABLE_AT_INV = finalize_theorem REAL_DIFFERENTIABLE_AT_INV;; +let derivative_composition = finalize_theorem derivative_composition;; +let derivative_sqrt = finalize_theorem derivative_sqrt;; +let derivative_acs = finalize_theorem derivative_acs;; +let derivative_exp = finalize_theorem derivative_exp;; +let derivative_atn = finalize_theorem derivative_atn;; +let derivative_inv = finalize_theorem derivative_inv;; +let derivative_const = finalize_theorem derivative_const;; +let derivative_x = finalize_theorem derivative_x;; +let nth_diff_strong_imp_diff = finalize_theorem nth_diff_strong_imp_diff;; +let ith_derivative_differentiable = finalize_theorem ith_derivative_differentiable;; +let nth_derivative_continuous = finalize_theorem nth_derivative_continuous;; +let nth_diff_imp_diff = finalize_theorem nth_diff_imp_diff;; +let nth_differentiable1 = finalize_theorem nth_differentiable1;; +let nth_mth_diff = finalize_theorem nth_mth_diff;; +let nth_differentiable_on_int2 = finalize_theorem nth_differentiable_on_int2;; +let nth_differentiable_eq = finalize_theorem nth_differentiable_eq;; +let nth_differentiable_on_cond = finalize_theorem nth_differentiable_on_cond;; +let nth_differentiable_cond = finalize_theorem nth_differentiable_cond;; +let nth_diff_continuous = finalize_theorem nth_diff_continuous;; +let nth_derivative_add = finalize_theorem nth_derivative_add;; +let nth_derivative2 = finalize_theorem nth_derivative2;; +let nth_derivative1 = finalize_theorem nth_derivative1;; +let nth_Sderivative = finalize_theorem nth_Sderivative;; +let nth_derivativeS = finalize_theorem nth_derivativeS;; +let nth_derivative0 = finalize_theorem nth_derivative0;; +let has_derivative_lemma = finalize_theorem has_derivative_lemma;; +let derivative_unique_on = finalize_theorem derivative_unique_on;; +let derivative_unique = finalize_theorem derivative_unique;; +let has_derivative_alt = finalize_theorem has_derivative_alt;; +let has_derivative_cond = finalize_theorem has_derivative_cond;; +(end_section "NthDerivatives");; +let lin_approx = new_definition `lin_approx f x f_bounds df_bounds <=> + interval_arith (f x) f_bounds /\ + (?f'. (f has_real_derivative f') (atreal x) /\ interval_arith f' df_bounds)`;; +let has_bounded_second_derivative = new_definition `has_bounded_second_derivative f int dd_bounds <=> + nth_diff_strong_int 2 int f /\ + bounded_on_int (nth_derivative 2 f) int dd_bounds`;; +let taylor_interval = new_definition + `taylor_interval f x y z w f_bounds df_bounds ddf_bounds <=> + x <= y /\ y <= z /\ y - x <= w /\ z - y <= w /\ + lin_approx f y f_bounds df_bounds /\ + has_bounded_second_derivative f (x, z) ddf_bounds`;; +let iabs = new_definition `iabs (x_lo, x_hi) = max x_hi (-- x_lo)`;; +(start_section_proof ["n";"int";"f"](`nth_diff_strong_int n int f ==> + nth_differentiable_on_int n int f`));; +refine (by (VALID ((((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_differentiable_on_int)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_diff_strong)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_differentiable_on)(new_rewrite [] []))))));; +refine (by (VALID ((BETA_TAC THEN (move ["h"]) THEN (move ["x"]) THEN (move ["ineq"])))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "h")(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["xs"]))) THEN (exact_tac) THEN (done_tac)))));; +let nth_diff_strong_imp_diff_int = end_section_proof();; +(start_section_proof ["f";"int";"dd_bounds"](`has_bounded_second_derivative f int dd_bounds ==> + ?f' f''. (!x. interval_arith x int ==> (f has_real_derivative f' x) (atreal x) /\ + (f' has_real_derivative f'' x) (atreal x) /\ interval_arith (f'' x) dd_bounds)`));; +refine (by (VALID ((((USE_THM_THEN has_bounded_second_derivative)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (DISCH_THEN (fun snd_th -> (USE_THM_THEN nth_diff_strong_imp_diff_int)(MATCH_MP_THEN snd_th MP_TAC))))))));; +refine (by (VALID (((DISCH_THEN (fun snd_th -> (USE_THM_THEN nth_differentiable_on_int2)(MATCH_MP_THEN snd_th MP_TAC))) THEN BETA_TAC THEN (case THEN (move ["f'"])) THEN (case THEN (move ["f''"]))))));; +refine (by (VALID (((BETA_TAC THEN (case THEN (move ["eq1"])) THEN (case THEN (move ["eq2"])) THEN (move ["h"]) THEN (move ["b"])) THEN (((exists_tac (mk_var("f'",mk_type("fun",[mk_type("real",[]);mk_type("real",[])])))) THEN (exists_tac (mk_var("f''",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))))) THEN (move ["x"]) THEN (move ["ineq"]))))));; +refine (by (VALID (((((USE_THEN "b")MP_TAC) THEN (clear_assumption "b") THEN BETA_TAC) THEN ((((USE_THM_THEN bounded_on_int)(new_rewrite [] [])) THEN ((USE_THEN "eq2")(GSYM_THEN (new_rewrite [] [])))) THEN (move ["b"]))))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THEN "h")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THEN "b")(new_rewrite [] []))) THEN (done_tac)))));; +let has_bounded_second_derivative_old = end_section_proof();; +(start_section_proof ["P";"Q"](`(?x. P x /\ Q x) ==> (?x. P x)`));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN ((move ["Px"]) THEN (move ["_"])))))));; +refine (by (VALID (((exists_tac (mk_var("x",mk_vartype "?1452066"))) THEN (done_tac)))));; +let exists_and_left = end_section_proof();; +(start_section_proof ["a";"b"](`(!e. &0 < e ==> a <= b + e) <=> (a <= b)`));; +refine (by (VALID (((THENL_ROT (-1)) ((split_tac) THENL [ALL_TAC; ((move ["ineq"]) THEN (move ["e"]) THEN (move ["e0"]))])))));; +refine (by (VALID (((((fun thm_tac -> (USE_THM_THEN REAL_ADD_RID)(ISPEC_THEN (mk_var("a",mk_type("real",[]))) thm_tac))(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_LE_ADD2)(new_rewrite [] [])) THEN ((USE_THEN "ineq")(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LT_IMP_LE)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN contraLR)MP_TAC) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac)) THEN ((((USE_THM_THEN NOT_FORALL_THM)(new_rewrite [] [])) THEN ((USE_THM_THEN NOT_IMP)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_NOT_LE)(new_rewrite [] [])))) THEN (move ["ba"]))))));; +refine (by (VALID (((exists_tac (`(a - b) / &2`)) THEN (((USE_THEN "ba")MP_TAC) THEN (clear_assumption "ba") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +let lim_ineq = end_section_proof();; +(start_section_proof ["f";"c";"a"](`(?b. a < b /\ !x. x IN real_interval (a, b) ==> f x <= c) /\ + f real_continuous atreal a ==> f a <= c`));; +refine (by (VALID ((BETA_TAC THEN (case THEN ((case THEN (move ["b"])) THEN (case THEN (move ["ab"])) THEN (move ["ineq"])))))));; +refine (by (VALID (((((USE_THM_THEN REAL_CONTINUOUS_ATREAL)(new_rewrite [] [])) THEN ((USE_THM_THEN REALLIM_ATREAL)(new_rewrite [] []))) THEN (move ["f_cont"])))));; +refine (by (VALID ((((USE_THM_THEN lim_ineq)(GSYM_THEN (new_rewrite [] []))) THEN (move ["e"]) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "f_cont")(MATCH_MP_THEN snd_th MP_TAC))) THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["cond"])))));; +refine (by (VALID ((set_tac "r" (`a + min (b - a) d / &2`)))));; +refine (by (VALID (((THENL_FIRST) ((((fun thm_tac -> (USE_THEN "cond")(ISPEC_THEN (mk_var("r",mk_type("real",[]))) thm_tac))MP_TAC) THEN BETA_TAC) THEN (ANTS_TAC)) ((((USE_THEN "ab")MP_TAC) THEN (clear_assumption "ab") THEN ((USE_THEN "d0")MP_TAC) THEN (clear_assumption "d0") THEN ((USE_THEN "r_def")MP_TAC) THEN (clear_assumption "r_def") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID (((THENL_LAST) ((((fun thm_tac -> (USE_THEN "ineq")(ISPEC_THEN (mk_var("r",mk_type("real",[]))) thm_tac))MP_TAC) THEN BETA_TAC) THEN (ANTS_TAC)) ((arith_tac) THEN (done_tac))))));; +refine (by (VALID ((((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])) THEN (((USE_THEN "ab")MP_TAC) THEN (clear_assumption "ab") THEN ((USE_THEN "d0")MP_TAC) THEN (clear_assumption "d0") THEN ((USE_THEN "r_def")MP_TAC) THEN (clear_assumption "r_def") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +let continuous_leq = end_section_proof();; +(start_section_proof ["f";"x"](`f real_continuous atreal x <=> + (\x. f (--x)) real_continuous atreal (--x)`));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN REAL_CONTINUOUS_ATREAL)(new_rewrite [] []))) THEN (simp_tac) THEN repeat_tactic 1 9 (((USE_THM_THEN REALLIM_ATREAL)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_NEG_NEG)(new_rewrite [] [])) THEN (simp_tac)) THEN ((split_tac) THEN (move ["h"]) THEN (move ["e"]) THEN (move ["e0"]))))));; +refine (by (VALID ((((fun thm_tac -> (USE_THEN "h")(fun fst_th ->(USE_THEN "e0")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["cond"])))));; +refine (by (VALID (((exists_tac (mk_var("d",mk_type("real",[])))) THEN ((((USE_THEN "d0")(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["y"]) THEN (move ["ineqs"])) THEN (((USE_THEN "cond")MP_TAC) THEN (clear_assumption "cond") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID (((((USE_THEN "ineqs")MP_TAC) THEN (clear_assumption "ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((((fun thm_tac -> (USE_THEN "h")(fun fst_th ->(USE_THEN "e0")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["cond"])))));; +refine (by (VALID (((exists_tac (mk_var("d",mk_type("real",[])))) THEN ((((USE_THEN "d0")(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["y"]) THEN (move ["ineqs"]))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "cond")(ISPEC_THEN (`--y`) thm_tac))MP_TAC) THEN BETA_TAC) THEN ((USE_THM_THEN REAL_NEG_NEG)(new_rewrite [] [])) THEN (DISCH_THEN apply_tac) THEN (((USE_THEN "ineqs")MP_TAC) THEN (clear_assumption "ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +let continuous_reflection = end_section_proof();; +(start_section_proof ["f";"c";"a";"b"](`a < b ==> f real_continuous atreal a ==> f real_continuous atreal b ==> + (!x. x IN real_interval (a, b) ==> f x <= c) ==> + (!x. x IN real_interval [a, b] ==> f x <= c)`));; +refine (by (VALID ((BETA_TAC THEN (move ["ab"]) THEN (move ["f_cont_a"]) THEN (move ["f_cont_b"]) THEN (move ["ineq"]) THEN (move ["x"])))));; +refine (by (VALID ((((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])) THEN repeat_tactic 2 0 (((USE_THM_THEN (REAL_ARITH `!a b. a <= b <=> (a = b \/ a < b)`))(new_rewrite [] [])))))));; +refine (by (VALID ((case THEN (case THENL [((DISCH_THEN(GSYM_THEN (new_rewrite [] []))) THEN (move ["_"])); (move ["ax"])])))));; +refine (by (VALID (((((USE_THM_THEN continuous_leq)MP_TAC) THEN (clear_assumption "continuous_leq") THEN (DISCH_THEN apply_tac)) THEN (((USE_THEN "f_cont_a")(new_rewrite [] [])) THEN ((USE_THM_THEN andbT)(new_rewrite [] []))) THEN (exists_tac (mk_var("b",mk_type("real",[])))) THEN (done_tac)))));; +refine (by (VALID (((THENL_LAST) (case THENL [(DISCH_THEN(new_rewrite [] [])); (move ["xb"])]) ((((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN (DISCH_THEN apply_tac)) THEN ((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])) THEN (done_tac))))));; +refine (by (VALID ((set_tac "g" (`\x. f (--x)`)))));; +refine (by (VALID (((THENL_FIRST) (have_tac (move ["fg"]) (`!x. f x = g (--x)`)) ((((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN REAL_NEG_NEG)(new_rewrite [] []))) THEN (done_tac))))));; +refine (by (VALID ((((USE_THEN "fg")(new_rewrite [] [])) THEN (((USE_THM_THEN continuous_leq)MP_TAC) THEN (clear_assumption "continuous_leq") THEN (DISCH_THEN apply_tac)) THEN (split_tac)))));; +refine (by (VALID (((exists_tac (`--a`)) THEN ((((USE_THM_THEN REAL_LT_NEG)(new_rewrite [] [])) THEN ((USE_THEN "ab")(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN (move ["y"]))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "ineq")(ISPEC_THEN (`--y`) thm_tac))MP_TAC) THEN BETA_TAC) THEN (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THEN "fg")(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_NEG_NEG)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((((USE_THEN "g_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN continuous_reflection)(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac)))));; +let continuous_leq_segment = end_section_proof();; +(start_section_proof ["p"](`p = (FST p, SND p)`));; +refine (by (VALID ((done_tac))));; +let pair_eq = end_section_proof();; +(begin_section "Taylor");; +(start_section_proof ["lo";"hi";"a"](`interval_arith a (lo, hi) ==> iabs (lo, hi) = max (abs lo) (abs hi)`));; +refine (by (VALID (((((USE_THM_THEN interval_arith)(new_rewrite [] [])) THEN ((USE_THM_THEN iabs)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +let iabs_alt = end_section_proof();; +(start_section_proof ["lo";"hi";"a"](`interval_arith a (lo, hi) ==> &0 <= iabs (lo, hi)`));; +refine (by (VALID (((((USE_THM_THEN interval_arith)(new_rewrite [] [])) THEN ((USE_THM_THEN iabs)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +let iabs_pos = end_section_proof();; +(add_section_var (mk_var ("f", (`:real -> real`))));; +(add_section_var (mk_var ("x", (`:real`))); add_section_var (mk_var ("y", (`:real`))); add_section_var (mk_var ("z", (`:real`))); add_section_var (mk_var ("w", (`:real`))));; +(add_section_var (mk_var ("f_bounds", (`:real#real`))); add_section_var (mk_var ("df_bounds", (`:real#real`))); add_section_var (mk_var ("ddf_bounds", (`:real#real`))));; +(add_section_var (mk_var ("dd_bound", (`:real`))));; +(add_section_hyp "dd_bound_eq" (`dd_bound = iabs ddf_bounds`));; +(add_section_hyp "tif" (`taylor_interval f x y z w f_bounds df_bounds ddf_bounds`));; +(start_section_proof [](`!t. t IN real_interval [x, z] ==> f real_continuous atreal t`));; +refine (by (VALID (((((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN interval_arith)(GSYM_THEN (new_rewrite [] [])))) THEN (move ["t"]) THEN (move ["t_in"])))));; +refine (by (VALID ((((USE_THM_THEN HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL)MP_TAC) THEN (clear_assumption "HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID (((((USE_THEN "tif")MP_TAC) THEN (clear_assumption "tif") THEN BETA_TAC) THEN ((((USE_THM_THEN taylor_interval)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andbA)(new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (DISCH_THEN (fun snd_th -> (USE_THM_THEN has_bounded_second_derivative_old)(MATCH_MP_THEN snd_th MP_TAC))))))));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["f'"])) THEN (case THEN (move ["f''"])) THEN (move ["df"])))));; +refine (by (VALID (((exists_tac (`f' t`)) THEN ((USE_THEN "df")(new_rewrite [] [])) THEN (done_tac)))));; +let f_continuous = end_section_proof();; +(start_section_proof ["t"](`x <= t /\ t <= z ==> + abs (f t - f y) <= w * iabs df_bounds + w * w * dd_bound / &2`));; +refine (by (VALID ((BETA_TAC THEN (move ["t_ineqs"])))));; +refine (by (VALID (((((USE_THEN "tif") MP_TAC) THEN ALL_TAC) THEN ((((USE_THM_THEN taylor_interval)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andbA)(new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["domain_ineqs"])) THEN (move ["lin_app"]))))));; +refine (by (VALID (((DISCH_THEN (fun snd_th -> (USE_THM_THEN has_bounded_second_derivative_old)(MATCH_MP_THEN snd_th MP_TAC))) THEN BETA_TAC THEN (case THEN (move ["f'"])) THEN (case THEN (move ["f''"])) THEN (move ["df"])))));; +refine (by (VALID ((have_tac (move ["abs_ty"]) (`abs (t - y) <= w`)))));; +refine (by (VALID (((((USE_THEN "t_ineqs")MP_TAC) THEN (clear_assumption "t_ineqs") THEN ((USE_THEN "domain_ineqs")MP_TAC) THEN (clear_assumption "domain_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((THENL_FIRST) (have_tac (move ["y_in"]) (`interval_arith y (x, z)`)) (((USE_THM_THEN interval_arith)(new_rewrite [] [])) THEN (done_tac))))));; +refine (by (VALID ((have_tac (move ["dd_prop"]) (`&0 <= dd_bound /\ !p. p IN real_interval [x, z] ==> abs (f'' p) <= dd_bound`)))));; +refine (by (VALID ((((USE_THEN "dd_bound_eq")(new_rewrite [] [])) THEN (split_tac)))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "df")(fun fst_th ->(USE_THEN "y_in")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC) THEN (((USE_THM_THEN pair_eq)(new_rewrite [] [])) THEN ((USE_THM_THEN interval_arith)(new_rewrite [] [])) THEN ((USE_THM_THEN iabs)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN interval_arith)(GSYM_THEN (new_rewrite [] [])))) THEN (BETA_TAC THEN (move ["p"]) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "df")(MATCH_MP_THEN snd_th MP_TAC)))) THEN (((USE_THM_THEN pair_eq)(new_rewrite [] [])) THEN ((USE_THM_THEN interval_arith)(new_rewrite [] [])) THEN ((USE_THM_THEN iabs)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((((THENL_ROT 1)) (have_tac ALL_TAC (`abs (f t - (f y + f' y * (t - y) pow 1)) <= dd_bound * abs (t - y) pow (1 + 1) / &2`))))));; +refine (by (VALID (((set_tac "b1" (`f' y * _`)) THEN ((set_tac "b2" (`dd_bound * _`)) THEN (move ["ineq1"]))))));; +refine (by (VALID (((((USE_THM_THEN REAL_LE_TRANS)MP_TAC) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (`abs (f t - (f y + b1)) + abs b1`)) THEN (split_tac)))));; +refine (by (VALID (((((USE_THM_THEN (REAL_ARITH `!a b. a - b = (a - (b + b1)) + b1`))(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_ABS_TRIANGLE)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN REAL_ADD_SYM)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_ADD2)(new_rewrite [] [])) THEN ((USE_THEN "b1_def")(GSYM_THEN (new_rewrite [1] []))) THEN ((USE_THM_THEN REAL_POW_1)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_ABS_MUL)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_SYM)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_MUL2)(new_rewrite [] []))))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN REAL_ABS_POS)(new_rewrite [] []))) THEN ((USE_THEN "abs_ty")(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] []))) THEN ((USE_THM_THEN pair_eq)(new_rewrite [] [])) THEN ((USE_THM_THEN iabs)(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THEN "lin_app")MP_TAC) THEN (clear_assumption "lin_app") THEN BETA_TAC) THEN (((USE_THM_THEN lin_approx)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["ff"])) THEN (case THEN (move ["df'"])))))));; +refine (by (VALID (((THENL_FIRST) (((THENL_ROT 1)) (have_tac (DISCH_THEN(new_rewrite [] [])) (`ff = f' y`))) ((((USE_THM_THEN pair_eq)(new_rewrite [] [])) THEN ((USE_THM_THEN interval_arith)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN REAL_DERIVATIVE_UNIQUE_ATREAL)(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (mk_var("y",mk_type("real",[]))) thm_tac))MP_TAC) THEN (DISCH_THEN apply_tac)) THEN (((USE_THEN "df'")(new_rewrite [] [])) THEN ((USE_THEN "df")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN andTb)(new_rewrite [] [])) THEN (((USE_THM_THEN REAL_LE_TRANS)MP_TAC) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (mk_var("b2",mk_type("real",[]))))))));; +refine (by (VALID ((((USE_THEN "ineq1")(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])) THEN ((USE_THEN "b2_def")(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN real_div)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_MUL_ASSOC)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_LE_MUL2)(new_rewrite [] [])) THEN ((USE_THM_THEN (ARITH_RULE `1 + 1 = 2`))(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_INV)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_LE_MUL)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "dd_prop")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_LE_POW_2)(new_rewrite [] [])))) THEN ((TRY) (arith_tac))))));; +refine (by (VALID ((((USE_THM_THEN andTb)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andbT)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_MUL_SYM)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_POW_2)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_LE_MUL2)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] [])) THEN ((USE_THEN "dd_prop")(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THM_THEN REAL_LE_POW_2)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andbT)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_LE_SQUARE_ABS)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_ABS_ABS)(new_rewrite [] []))) THEN (((USE_THEN "abs_ty")MP_TAC) THEN (clear_assumption "abs_ty") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((set_tac "Df" (`\i. if i = 0 then f else if i = 1 then f' else if i = 2 then f'' else I`)))));; +refine (by (VALID ((((USE_THM_THEN (ARITH_RULE `0 + 1 = 1 /\ ~(1 = 0) /\ 1 + 1 = 2 /\ + ~(2 = 1) /\ ~(2 = 1) /\ ~(2 = 0)`)) MP_TAC) THEN (move ["arith"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN REAL_TAYLOR)(ISPEC_THEN (mk_var("Df",mk_type("fun",[mk_type("num",[]);mk_type("fun",[mk_type("real",[]);mk_type("real",[])])]))) thm_tac))(ISPEC_THEN (`1`) thm_tac))(ISPEC_THEN (`real_interval [x, z]`) thm_tac))(ISPEC_THEN (mk_var("dd_bound",mk_type("real",[]))) thm_tac)) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID ((ANTS_TAC))));; +refine (by (VALID (((((USE_THM_THEN IS_REALINTERVAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (split_tac)))));; +refine (by (VALID ((((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN interval_arith)(GSYM_THEN (new_rewrite [] [])))))));; +refine (by (VALID (((BETA_TAC THEN (move ["i"]) THEN (move ["p"]) THEN (case THEN (move ["p_in"]))) THEN ((USE_THM_THEN (ARITH_RULE `i <= 1 <=> i = 0 \/ i = 1`))(new_rewrite [] []))))));; +refine (by (VALID (((case THEN (DISCH_THEN(new_rewrite [] []))) THEN (((USE_THEN "Df_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac)) THEN ((USE_THM_THEN HAS_REAL_DERIVATIVE_ATREAL_WITHIN) apply_tac) THEN (repeat_tactic 1 9 (((USE_THEN "arith")(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THEN "df")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])) THEN (((USE_THEN "Df_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac))))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THEN "arith")(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THEN "dd_prop")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((BETA_TAC THEN ((fun thm_tac -> (fun thm_tac -> DISCH_THEN (ISPEC_THEN (mk_var("y",mk_type("real",[]))) thm_tac))(ISPEC_THEN (mk_var("t",mk_type("real",[]))) thm_tac))MP_TAC)) THEN (repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THEN "domain_ineqs")(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THEN "t_ineqs")(new_rewrite [] []))) THEN (simp_tac))))));; +refine (by (VALID ((((USE_THM_THEN ONE)(new_rewrite [1] [])) THEN ((USE_THM_THEN (GEN_ALL SUM_CLAUSES_NUMSEG))(new_rewrite [] [])) THEN ((USE_THM_THEN SUM_SING_NUMSEG)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THEN "Df_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN ONE)(GSYM_THEN (new_rewrite [] [])))))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN (ARITH_RULE `0 <= 1 /\ ~(1 = 0)`))(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN (GEN_ALL real_pow))(new_rewrite [] [])) THEN ((USE_THM_THEN FACT)(new_rewrite [] []))))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN (ARITH_RULE `FACT 1 = 1 /\ FACT (1 + 1) = 2`))(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_DIV_1)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_MUL_RID)(new_rewrite [] []))) THEN (done_tac)))));; +let taylor_error = end_section_proof();; +(start_section_proof [](`!t. x <= t /\ t <= z ==> + f t <= SND f_bounds + (w * iabs df_bounds + w * w * dd_bound / &2)`));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN pair_eq)(ISPEC_THEN (mk_var("f_bounds",mk_type("prod",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))MP_TAC) THEN BETA_TAC THEN (move ["eq"])))));; +refine (by (VALID ((BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (USE_THM_THEN taylor_error)(MATCH_MP_THEN snd_th MP_TAC)))))));; +refine (by (VALID (((((USE_THEN "tif")MP_TAC) THEN (clear_assumption "tif") THEN BETA_TAC) THEN ((((USE_THM_THEN taylor_interval)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andbA)(new_rewrite [] []))) THEN ((USE_THM_THEN lin_approx)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["_"])) THEN (case THEN (move ["f_int"])) THEN (move ["_"]) THEN (move ["_"]))))));; +refine (by (VALID (((((USE_THEN "f_int")MP_TAC) THEN (clear_assumption "f_int") THEN BETA_TAC) THEN (((USE_THEN "eq")(new_rewrite [1] [])) THEN ((USE_THM_THEN interval_arith)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +let taylor_upper_bound = end_section_proof();; +(start_section_proof [](`!t. x <= t /\ t <= z ==> + FST f_bounds - (w * iabs df_bounds + w * w * dd_bound / &2) <= f t`));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN pair_eq)(ISPEC_THEN (mk_var("f_bounds",mk_type("prod",[mk_type("real",[]);mk_type("real",[])]))) thm_tac)) MP_TAC) THEN (move ["eq"])))));; +refine (by (VALID ((BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (USE_THM_THEN taylor_error)(MATCH_MP_THEN snd_th MP_TAC)))))));; +refine (by (VALID (((((USE_THEN "tif")MP_TAC) THEN (clear_assumption "tif") THEN BETA_TAC) THEN ((((USE_THEN "eq")(new_rewrite [1] [])) THEN ((USE_THM_THEN taylor_interval)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andbA)(new_rewrite [] []))) THEN ((USE_THM_THEN lin_approx)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["_"])) THEN (case THEN (move ["f_int"])) THEN (move ["_"]) THEN (move ["_"]))))));; +refine (by (VALID (((((USE_THEN "f_int")MP_TAC) THEN (clear_assumption "f_int") THEN BETA_TAC) THEN ((USE_THM_THEN interval_arith)(new_rewrite [] [])) THEN (arith_tac)))));; +let taylor_lower_bound = end_section_proof();; +(start_section_proof [](`!t. x <= t /\ t <= z ==> + abs (derivative f t - derivative f y) <= w * dd_bound`));; +refine (by (VALID ((BETA_TAC THEN (move ["t"]) THEN (move ["t_ineqs"])))));; +refine (by (VALID (((((USE_THEN "tif") MP_TAC) THEN ALL_TAC) THEN ((((USE_THM_THEN taylor_interval)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andbA)(new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["domain_ineqs"])) THEN (move ["_"]))))));; +refine (by (VALID (((DISCH_THEN (fun snd_th -> (USE_THM_THEN has_bounded_second_derivative_old)(MATCH_MP_THEN snd_th MP_TAC))) THEN BETA_TAC THEN (case THEN (move ["f'"])) THEN (case THEN (move ["f''"])) THEN (move ["df"])))));; +refine (by (VALID ((have_tac (move ["abs_ty"]) (`abs (t - y) <= w`)))));; +refine (by (VALID (((((USE_THEN "t_ineqs")MP_TAC) THEN (clear_assumption "t_ineqs") THEN ((USE_THEN "domain_ineqs")MP_TAC) THEN (clear_assumption "domain_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((have_tac (move ["der_eq"]) (`!p. x <= p /\ p <= z ==> derivative f p = f' p`)))));; +refine (by (VALID (((((USE_THM_THEN IN_REAL_INTERVAL)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN EQ_SYM_EQ)(new_rewrite [] []))) THEN (((USE_THM_THEN derivative_unique_on)MP_TAC) THEN (clear_assumption "derivative_unique_on") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID ((((((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN interval_arith)(GSYM_THEN (new_rewrite [] [])))) THEN (move ["p"]) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "df")(MATCH_MP_THEN snd_th MP_TAC))) THEN (simp_tac)) THEN (done_tac)))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THEN "der_eq")(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID ((have_tac (move ["dd_prop"]) (`&0 <= dd_bound /\ !p. p IN real_interval [x, z] ==> abs (f'' p) <= dd_bound`)))));; +refine (by (VALID (((((USE_THEN "dd_bound_eq")(new_rewrite [] [])) THEN ((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN interval_arith)(GSYM_THEN (new_rewrite [] [])))) THEN (split_tac)))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "df")(ISPEC_THEN (mk_var("y",mk_type("real",[]))) thm_tac))MP_TAC) THEN BETA_TAC) THEN (((fun thm_tac -> (USE_THM_THEN pair_eq)(ISPEC_THEN (mk_var("ddf_bounds",mk_type("prod",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN interval_arith)(new_rewrite [] []))) THEN ((USE_THM_THEN iabs)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THEN "domain_ineqs")(new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["p"]) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "df")(MATCH_MP_THEN snd_th MP_TAC)))) THEN (((USE_THM_THEN pair_eq)(new_rewrite [] [])) THEN ((USE_THM_THEN interval_arith)(new_rewrite [] [])) THEN ((USE_THM_THEN iabs)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((set_tac "Df" (`\i. if i = 0 then f' else if i = 1 then f'' else I`)))));; +refine (by (VALID ((((USE_THM_THEN (ARITH_RULE `0 + 1 = 1 /\ ~(1 = 0) /\ 1 + 1 = 2 /\ + ~(2 = 1) /\ ~(2 = 1) /\ ~(2 = 0)`)) MP_TAC) THEN (move ["arith"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN REAL_TAYLOR)(ISPEC_THEN (mk_var("Df",mk_type("fun",[mk_type("num",[]);mk_type("fun",[mk_type("real",[]);mk_type("real",[])])]))) thm_tac))(ISPEC_THEN (`0`) thm_tac))(ISPEC_THEN (`real_interval [x, z]`) thm_tac))(ISPEC_THEN (mk_var("dd_bound",mk_type("real",[]))) thm_tac)) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID ((ANTS_TAC))));; +refine (by (VALID (((((USE_THM_THEN IS_REALINTERVAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (split_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["i"]) THEN (move ["p"]) THEN (case THEN (move ["p_in"]))) THEN (((USE_THM_THEN (ARITH_RULE `i <= 0 <=> i = 0`))(new_rewrite [] [])) THEN (DISCH_THEN(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THEN "Df_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac) THEN repeat_tactic 1 9 (((USE_THEN "arith")(new_rewrite [] []))) THEN (simp_tac)) THEN (((USE_THM_THEN HAS_REAL_DERIVATIVE_ATREAL_WITHIN)MP_TAC) THEN (clear_assumption "HAS_REAL_DERIVATIVE_ATREAL_WITHIN") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID (((((USE_THEN "df")(new_rewrite [] [])) THEN ((USE_THM_THEN interval_arith)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_REAL_INTERVAL)(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["p"]) THEN (move ["p_in"])) THEN (((USE_THEN "Df_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac))))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THEN "arith")(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THEN "dd_prop")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((BETA_TAC THEN ((fun thm_tac -> (fun thm_tac -> DISCH_THEN (ISPEC_THEN (mk_var("y",mk_type("real",[]))) thm_tac))(ISPEC_THEN (mk_var("t",mk_type("real",[]))) thm_tac))MP_TAC)) THEN (repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THEN "domain_ineqs")(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THEN "t_ineqs")(new_rewrite [] []))) THEN (simp_tac))))));; +refine (by (VALID ((((USE_THM_THEN ONE)(new_rewrite [1] [])) THEN ((USE_THM_THEN SUM_SING_NUMSEG)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THEN "Df_def")(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN ONE)(GSYM_THEN (new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN (GEN_ALL real_pow))(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THEN "arith")(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN FACT)(new_rewrite [] []))) THEN ((USE_THM_THEN (ARITH_RULE `FACT 1 = 1`))(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_DIV_1)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_MUL_RID)(new_rewrite [] []))))));; +refine (by (VALID ((((USE_THM_THEN REAL_POW_1)(new_rewrite [] [])) THEN (move ["ineq"])))));; +refine (by (VALID (((((USE_THM_THEN REAL_LE_TRANS)MP_TAC) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (`dd_bound * abs (t - y)`))))));; +refine (by (VALID (((((USE_THEN "ineq")(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_SYM)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_RMUL)(new_rewrite [] [])) THEN ((USE_THEN "dd_prop")(new_rewrite [] [])) THEN ((USE_THEN "abs_ty")(new_rewrite [] []))) THEN (done_tac)))));; +let taylor_derivative_error = end_section_proof();; +(start_section_proof [](`FST df_bounds <= derivative f y /\ derivative f y <= SND df_bounds`));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN pair_eq)(ISPEC_THEN (mk_var("df_bounds",mk_type("prod",[mk_type("real",[]);mk_type("real",[])]))) thm_tac)) MP_TAC) THEN (move ["eq"])))));; +refine (by (VALID (((((USE_THEN "tif")MP_TAC) THEN (clear_assumption "tif") THEN BETA_TAC) THEN ((((USE_THM_THEN taylor_interval)(new_rewrite [] [])) THEN ((USE_THM_THEN lin_approx)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andbA)(new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["ineqs"])) THEN (case THEN (move ["g"])) THEN (case THEN ((move ["fg"]) THEN (move ["g_int"]))) THEN (move ["_"]))))));; +refine (by (VALID (((THENL_FIRST) (((THENL_ROT 1)) (have_tac (DISCH_THEN(new_rewrite [] [])) (`derivative f y = g`))) ((((USE_THEN "g_int")MP_TAC) THEN (clear_assumption "g_int") THEN BETA_TAC) THEN (((USE_THEN "eq")(new_rewrite [] [])) THEN ((USE_THM_THEN interval_arith)(new_rewrite [] []))) THEN (done_tac))))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN REAL_DERIVATIVE_UNIQUE_ATREAL)(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (mk_var("y",mk_type("real",[]))) thm_tac))MP_TAC) THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID (((((USE_THEN "fg")(new_rewrite [] [])) THEN ((USE_THM_THEN has_derivative_cond)(new_rewrite [] [])) THEN ((TRY done_tac))) THEN (exists_tac (mk_var("g",mk_type("real",[])))) THEN (done_tac)))));; +let derivative_interval = end_section_proof();; +(start_section_proof [](`!t. x <= t /\ t <= z ==> + derivative f t <= SND df_bounds + w * dd_bound`));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (USE_THM_THEN taylor_derivative_error)(MATCH_MP_THEN snd_th MP_TAC)))) THEN (((USE_THM_THEN derivative_interval)MP_TAC) THEN (clear_assumption "derivative_interval") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +let taylor_derivative_upper_bound = end_section_proof();; +(start_section_proof [](`!t. x <= t /\ t <= z ==> + FST df_bounds - w * dd_bound <= derivative f t`));; +refine (by (VALID (((BETA_TAC THEN (move ["t"]) THEN (DISCH_THEN (fun snd_th -> (USE_THM_THEN taylor_derivative_error)(MATCH_MP_THEN snd_th MP_TAC)))) THEN (((USE_THM_THEN derivative_interval)MP_TAC) THEN (clear_assumption "derivative_interval") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +let taylor_derivative_lower_bound = end_section_proof();; +let taylor_derivative_lower_bound = finalize_theorem taylor_derivative_lower_bound;; +let taylor_derivative_upper_bound = finalize_theorem taylor_derivative_upper_bound;; +let derivative_interval = finalize_theorem derivative_interval;; +let taylor_derivative_error = finalize_theorem taylor_derivative_error;; +let taylor_lower_bound = finalize_theorem taylor_lower_bound;; +let taylor_upper_bound = finalize_theorem taylor_upper_bound;; +let taylor_error = finalize_theorem taylor_error;; +let f_continuous = finalize_theorem f_continuous;; +let iabs_pos = finalize_theorem iabs_pos;; +let iabs_alt = finalize_theorem iabs_alt;; +(end_section "Taylor");; +(begin_section "LinearApproximation");; +(add_section_var (mk_var ("f", (`:real->real`))));; +(add_section_var (mk_var ("f_bounds", (`:real#real`))); add_section_var (mk_var ("df_bounds", (`:real#real`))));; +(add_section_var (mk_var ("x", (`:real`))));; +(start_section_proof [](`lin_approx f x f_bounds df_bounds <=> + (f real_differentiable atreal x /\ interval_arith (f x) f_bounds /\ + interval_arith (derivative f x) df_bounds)`));; +refine (by (VALID (((((USE_THM_THEN lin_approx)(new_rewrite [] [])) THEN ((USE_THM_THEN real_differentiable)(new_rewrite [] []))) THEN ((split_tac) THENL [(case THEN ((DISCH_THEN(new_rewrite [] [])) THEN (case THEN (move ["f'"])) THEN (case THEN ((move ["df'"]) THEN (move ["int_f'"]))))); ((case THEN ((case THEN (move ["f'"])) THEN (move ["df"]))) THEN (case THEN ((DISCH_THEN(new_rewrite [] [])) THEN (move ["df_int"]))))])))));; +refine (by (VALID (((THENL_FIRST) (split_tac) ((exists_tac (mk_var("f'",mk_type("real",[])))) THEN (done_tac))))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN derivative_unique)(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (mk_var("f'",mk_type("real",[]))) thm_tac))(new_rewrite [] [])) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN andTb)(new_rewrite [] [])) THEN (exists_tac (mk_var("f'",mk_type("real",[])))) THEN (((USE_THEN "df")(new_rewrite [] [])) THEN ((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN derivative_unique)(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (mk_var("f'",mk_type("real",[]))) thm_tac))(ISPEC_THEN (mk_var("x",mk_type("real",[]))) thm_tac))(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac)))));; +let lin_approx_eq = end_section_proof();; +(add_section_hyp "approx_f" (`lin_approx f x f_bounds df_bounds`));; +(start_section_proof [](`interval_arith (f x) f_bounds`));; +refine (by (VALID (((((USE_THEN "approx_f")MP_TAC) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN (((USE_THM_THEN lin_approx_eq)(new_rewrite [] [])) THEN (simp_tac)) THEN (done_tac)))));; +let lin_approx_imp_f_interval = end_section_proof();; +(start_section_proof [](`interval_arith (derivative f x) df_bounds`));; +refine (by (VALID (((((USE_THEN "approx_f")MP_TAC) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN (((USE_THM_THEN lin_approx_eq)(new_rewrite [] [])) THEN (simp_tac)) THEN (done_tac)))));; +let lin_approx_imp_df_interval = end_section_proof();; +(start_section_proof [](`f real_differentiable atreal x`));; +refine (by (VALID (((((USE_THEN "approx_f")MP_TAC) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN (((USE_THM_THEN lin_approx_eq)(new_rewrite [] [])) THEN (simp_tac)) THEN (done_tac)))));; +let lin_approx_imp_f_diff = end_section_proof();; +let lin_approx_imp_f_diff = finalize_theorem lin_approx_imp_f_diff;; +let lin_approx_imp_df_interval = finalize_theorem lin_approx_imp_df_interval;; +let lin_approx_imp_f_interval = finalize_theorem lin_approx_imp_f_interval;; +let lin_approx_eq = finalize_theorem lin_approx_eq;; +(end_section "LinearApproximation");; +(begin_section "MoreLinearApproximation");; +(add_section_var (mk_var ("f", (`:real->real`))); add_section_var (mk_var ("g", (`:real->real`))));; +(add_section_var (mk_var ("x", (`:real`))));; +(add_section_var (mk_var ("f_bounds", (`:real#real`))); add_section_var (mk_var ("df_bounds", (`:real#real`))));; +(add_section_var (mk_var ("g_bounds", (`:real#real`))); add_section_var (mk_var ("dg_bounds", (`:real#real`))));; +let interval_not_zero = new_definition `interval_not_zero (lo, hi) <=> &0 < lo \/ hi < &0`;; +let interval_pos = new_definition `interval_pos (lo, hi) <=> &0 < lo`;; +(start_section_proof ["x";"int"](`interval_arith x int ==> interval_not_zero int ==> + ~(x = &0)`));; +refine (by (VALID (((((fun thm_tac -> (USE_THM_THEN PAIR)(ISPEC_THEN (mk_var("int",mk_type("prod",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN interval_arith)(new_rewrite [] [])) THEN ((USE_THM_THEN interval_not_zero)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +let interval_arith_not_zero = end_section_proof();; +(start_section_proof ["x";"int"](`interval_arith x int ==> interval_pos int ==> &0 < x`));; +refine (by (VALID ((((disch_tm_tac [](mk_var("int",mk_type("prod",[mk_type("real",[]);mk_type("real",[])])))) THEN (clear_assumption "int") THEN case) THEN (((USE_THM_THEN interval_arith)(new_rewrite [] [])) THEN ((USE_THM_THEN interval_pos)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +let interval_arith_pos = end_section_proof();; +(start_section_proof ["x";"int";"y"](`interval_arith x int ==> iabs int < y ==> abs x < y`));; +refine (by (VALID (((((fun thm_tac -> (USE_THM_THEN PAIR)(ISPEC_THEN (mk_var("int",mk_type("prod",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN interval_arith)(new_rewrite [] [])) THEN ((USE_THM_THEN iabs)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +let interval_arith_abs = end_section_proof();; +(start_section_proof [](`lin_approx (\x. x) x (x, x) (&1, &1)`));; +refine (by (VALID (((((USE_THM_THEN lin_approx_eq)(new_rewrite [] [])) THEN ((USE_THM_THEN derivative_x)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN interval_arith)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN REAL_DIFFERENTIABLE_ID)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] [])))) THEN (done_tac)))));; +let lin_approx_x = end_section_proof();; +(start_section_proof ["c"](`lin_approx (\x. c) x (c, c) (&0, &0)`));; +refine (by (VALID ((((USE_THM_THEN lin_approx_eq)(new_rewrite [] [])) THEN ((USE_THM_THEN derivative_const)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN interval_arith)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN REAL_DIFFERENTIABLE_CONST)(new_rewrite [] []))))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] []))) THEN (done_tac)))));; +let lin_approx_const = end_section_proof();; +(begin_section "LinearApproxUnivariateComposition");; +(add_section_hyp "approx_f" (`lin_approx f x f_bounds df_bounds`));; +(start_section_proof [](`(\x. atn (f x)) real_differentiable atreal x /\ + derivative (\x. atn (f x)) x = derivative f x / (&1 + f x * f x)`));; +refine (by (VALID (((((USE_THM_THEN derivative_compose_atn)MP_TAC) THEN (clear_assumption "derivative_compose_atn") THEN (DISCH_THEN apply_tac)) THEN (((USE_THEN "approx_f")MP_TAC) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN (((USE_THM_THEN lin_approx_eq)(new_rewrite [] [])) THEN (DISCH_THEN(new_rewrite [] []))) THEN (done_tac)))));; +let lin_approx_compose_atn = end_section_proof();; +(start_section_proof [](`(\x. exp (f x)) real_differentiable atreal x /\ + derivative (\x. exp (f x)) x = exp (f x) * derivative f x`));; +refine (by (VALID (((((USE_THM_THEN derivative_compose_exp)MP_TAC) THEN (clear_assumption "derivative_compose_exp") THEN (DISCH_THEN apply_tac)) THEN (((USE_THEN "approx_f")MP_TAC) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN (((USE_THM_THEN lin_approx_eq)(new_rewrite [] [])) THEN (DISCH_THEN(new_rewrite [] []))) THEN (done_tac)))));; +let lin_approx_compose_exp = end_section_proof();; +(start_section_proof [](`interval_not_zero f_bounds ==> + (\x. inv (f x)) real_differentiable atreal x /\ + derivative (\x. inv (f x)) x = -- inv (f x * f x) * derivative f x`));; +refine (by (VALID (((((USE_THEN "approx_f")MP_TAC) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN (((USE_THM_THEN lin_approx_eq)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN ((move ["df"]) THEN (move ["h"]))) THEN (move ["f0"]))))));; +refine (by (VALID (((THENL_FIRST) (have_tac (move ["fn0"]) (`~(f x = &0)`)) ((((USE_THM_THEN interval_arith_not_zero)MP_TAC) THEN (clear_assumption "interval_arith_not_zero") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (mk_var("f_bounds",mk_type("prod",[mk_type("real",[]);mk_type("real",[])])))) THEN (done_tac))))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN derivative_compose_inv)(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "fn0")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN (exact_tac)))));; +let lin_approx_compose_inv = end_section_proof();; +(start_section_proof [](`interval_pos f_bounds ==> + (\x. sqrt (f x)) real_differentiable atreal x /\ + derivative (\x. sqrt (f x)) x = derivative f x / (&2 * sqrt (f x))`));; +refine (by (VALID (((((USE_THEN "approx_f")MP_TAC) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN (((USE_THM_THEN lin_approx_eq)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN ((move ["df"]) THEN (move ["h"]))) THEN (move ["f_ineq"]))))));; +refine (by (VALID (((THENL_FIRST) (have_tac (move ["f_pos"]) (`&0 < f x`)) ((((USE_THM_THEN interval_arith_pos)MP_TAC) THEN (clear_assumption "interval_arith_pos") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (mk_var("f_bounds",mk_type("prod",[mk_type("real",[]);mk_type("real",[])])))) THEN (done_tac))))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN derivative_compose_sqrt)(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "f_pos")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN (exact_tac)))));; +let lin_approx_compose_sqrt = end_section_proof();; +(start_section_proof [](`iabs f_bounds < &1 ==> + (\x. acs (f x)) real_differentiable atreal x /\ + derivative (\x. acs (f x)) x = -- (derivative f x / sqrt (&1 - f x * f x))`));; +refine (by (VALID (((((USE_THEN "approx_f")MP_TAC) THEN (clear_assumption "approx_f") THEN BETA_TAC) THEN (((USE_THM_THEN lin_approx_eq)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN ((move ["df"]) THEN (move ["h"]))) THEN (move ["f_ineq"]))))));; +refine (by (VALID (((THENL_FIRST) (have_tac (move ["f_abs"]) (`abs (f x) < &1`)) ((((USE_THM_THEN interval_arith_abs)MP_TAC) THEN (clear_assumption "interval_arith_abs") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (mk_var("f_bounds",mk_type("prod",[mk_type("real",[]);mk_type("real",[])])))) THEN (done_tac))))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN derivative_compose_acs)(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "f_abs")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN (exact_tac)))));; +let lin_approx_compose_acs = end_section_proof();; +let lin_approx_compose_acs = finalize_theorem lin_approx_compose_acs;; +let lin_approx_compose_sqrt = finalize_theorem lin_approx_compose_sqrt;; +let lin_approx_compose_inv = finalize_theorem lin_approx_compose_inv;; +let lin_approx_compose_exp = finalize_theorem lin_approx_compose_exp;; +let lin_approx_compose_atn = finalize_theorem lin_approx_compose_atn;; +(end_section "LinearApproxUnivariateComposition");; +(add_section_hyp "approx_f" (`lin_approx f x f_bounds df_bounds`));; +(add_section_hyp "approx_g" (`lin_approx g x g_bounds dg_bounds`));; +(start_section_proof [](`(\x. f x + g x) real_differentiable atreal x`));; +refine (by (VALID ((((USE_THM_THEN REAL_DIFFERENTIABLE_ADD)MP_TAC) THEN (clear_assumption "REAL_DIFFERENTIABLE_ADD") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID (((((fun thm_tac -> (USE_THM_THEN lin_approx_imp_f_diff)(fun fst_th ->(USE_THEN "approx_f")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN ((fun thm_tac -> (USE_THM_THEN lin_approx_imp_f_diff)(fun fst_th ->(USE_THEN "approx_g")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] []))) THEN (done_tac)))));; +let lin_approx_imp_add_diff = end_section_proof();; +(start_section_proof [](`(\x. f x - g x) real_differentiable atreal x`));; +refine (by (VALID ((((USE_THM_THEN REAL_DIFFERENTIABLE_SUB)MP_TAC) THEN (clear_assumption "REAL_DIFFERENTIABLE_SUB") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID (((((fun thm_tac -> (USE_THM_THEN lin_approx_imp_f_diff)(fun fst_th ->(USE_THEN "approx_f")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN ((fun thm_tac -> (USE_THM_THEN lin_approx_imp_f_diff)(fun fst_th ->(USE_THEN "approx_g")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] []))) THEN (done_tac)))));; +let lin_approx_imp_sub_diff = end_section_proof();; +(start_section_proof [](`(\x. f x * g x) real_differentiable atreal x`));; +refine (by (VALID ((((USE_THM_THEN REAL_DIFFERENTIABLE_MUL_ATREAL)MP_TAC) THEN (clear_assumption "REAL_DIFFERENTIABLE_MUL_ATREAL") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID (((((fun thm_tac -> (USE_THM_THEN lin_approx_imp_f_diff)(fun fst_th ->(USE_THEN "approx_f")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN ((fun thm_tac -> (USE_THM_THEN lin_approx_imp_f_diff)(fun fst_th ->(USE_THEN "approx_g")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] []))) THEN (done_tac)))));; +let lin_approx_imp_mul_diff = end_section_proof();; +(start_section_proof [](`interval_not_zero g_bounds ==> (\x. f x / g x) real_differentiable atreal x`));; +refine (by (VALID (((BETA_TAC THEN (move ["gn0"])) THEN (((USE_THM_THEN REAL_DIFFERENTIABLE_DIV_ATREAL)MP_TAC) THEN (clear_assumption "REAL_DIFFERENTIABLE_DIV_ATREAL") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN lin_approx_imp_f_diff)(fun fst_th ->(USE_THEN "approx_f")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN ((fun thm_tac -> (USE_THM_THEN lin_approx_imp_f_diff)(fun fst_th ->(USE_THEN "approx_g")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THM_THEN interval_arith_not_zero)MP_TAC) THEN (clear_assumption "interval_arith_not_zero") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (mk_var("g_bounds",mk_type("prod",[mk_type("real",[]);mk_type("real",[])]))))))));; +refine (by (VALID (((((USE_THEN "approx_g")MP_TAC) THEN (clear_assumption "approx_g") THEN BETA_TAC) THEN (((USE_THM_THEN lin_approx_eq)(new_rewrite [] [])) THEN (DISCH_THEN(new_rewrite [] []))) THEN (done_tac)))));; +let lin_approx_imp_div_diff = end_section_proof();; +let lin_approx_imp_div_diff = finalize_theorem lin_approx_imp_div_diff;; +let lin_approx_imp_mul_diff = finalize_theorem lin_approx_imp_mul_diff;; +let lin_approx_imp_sub_diff = finalize_theorem lin_approx_imp_sub_diff;; +let lin_approx_imp_add_diff = finalize_theorem lin_approx_imp_add_diff;; +let lin_approx_compose_acs = finalize_theorem lin_approx_compose_acs;; +let lin_approx_compose_sqrt = finalize_theorem lin_approx_compose_sqrt;; +let lin_approx_compose_inv = finalize_theorem lin_approx_compose_inv;; +let lin_approx_compose_exp = finalize_theorem lin_approx_compose_exp;; +let lin_approx_compose_atn = finalize_theorem lin_approx_compose_atn;; +let lin_approx_const = finalize_theorem lin_approx_const;; +let lin_approx_x = finalize_theorem lin_approx_x;; +let interval_arith_abs = finalize_theorem interval_arith_abs;; +let interval_arith_pos = finalize_theorem interval_arith_pos;; +let interval_arith_not_zero = finalize_theorem interval_arith_not_zero;; +(end_section "MoreLinearApproximation");; +(begin_section "LinearApproxArith");; +(add_section_var (mk_var ("f1", (`:real->real`))); add_section_var (mk_var ("f2", (`:real->real`))));; +(add_section_var (mk_var ("f1_bounds", (`:real#real`))); add_section_var (mk_var ("f2_bounds", (`:real#real`))));; +(add_section_var (mk_var ("df1_lo", (`:real`))); add_section_var (mk_var ("df1_hi", (`:real`))); add_section_var (mk_var ("df2_lo", (`:real`))); add_section_var (mk_var ("df2_hi", (`:real`))));; +(add_section_var (mk_var ("f_bounds", (`:real#real`))));; +(add_section_var (mk_var ("df_lo", (`:real`))); add_section_var (mk_var ("df_hi", (`:real`))));; +(add_section_var (mk_var ("x", (`:real`))));; +(add_section_hyp "approx1" (`lin_approx f1 x f1_bounds (df1_lo, df1_hi)`));; +(start_section_proof ["c"](`&0 <= c ==> interval_arith (c * f1 x) f_bounds /\ + df_lo <= c * df1_lo /\ c * df1_hi <= df_hi ==> + lin_approx (\x. c * f1 x) x f_bounds (df_lo, df_hi)`));; +refine (by (VALID (((((USE_THM_THEN pair_eq)(new_rewrite [] [])) THEN ((USE_THM_THEN interval_arith)(new_rewrite [] []))) THEN (move ["c0"]) THEN (move ["ineqs"])))));; +refine (by (VALID (((((USE_THM_THEN lin_approx)(new_rewrite [] [])) THEN (simp_tac)) THEN (split_tac)))));; +refine (by (VALID ((((USE_THM_THEN pair_eq)(new_rewrite [] [])) THEN (((USE_THEN "ineqs")MP_TAC) THEN (clear_assumption "ineqs") THEN ((USE_THEN "approx1")MP_TAC) THEN (clear_assumption "approx1") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN lin_approx)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN interval_arith)(new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((((USE_THEN "approx1")MP_TAC) THEN (clear_assumption "approx1") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN lin_approx)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN (move ["int_f1"])) THEN (case THEN (move ["f1'"])) THEN (case THEN ((move ["df1"]) THEN (move ["int_f1'"]))))))));; +refine (by (VALID (((exists_tac (`c * f1'`)) THEN (((USE_THM_THEN HAS_REAL_DERIVATIVE_LMUL_ATREAL)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THEN "int_f1'")MP_TAC) THEN (clear_assumption "int_f1'") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN interval_arith)(new_rewrite [] []))) THEN (move ["ineqs2"])) THEN (split_tac) THEN (((USE_THM_THEN REAL_LE_TRANS)MP_TAC) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID (((exists_tac (`c * df1_lo`)) THEN (((USE_THEN "ineqs")(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_LMUL)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((exists_tac (`c * df1_hi`)) THEN (((USE_THEN "ineqs")(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_LMUL)(new_rewrite [] []))) THEN (done_tac)))));; +let lin_approx_scale = end_section_proof();; +(add_section_hyp "approx2" (`lin_approx f2 x f2_bounds (df2_lo, df2_hi)`));; +(start_section_proof [](`interval_arith (f1 x + f2 x) f_bounds /\ + df_lo <= df1_lo + df2_lo /\ df1_hi + df2_hi <= df_hi ==> + lin_approx (\x. f1 x + f2 x) x f_bounds (df_lo, df_hi)`));; +refine (by (VALID (((((USE_THM_THEN pair_eq)(new_rewrite [] [])) THEN ((USE_THM_THEN interval_arith)(new_rewrite [] []))) THEN (move ["ineqs"])))));; +refine (by (VALID (((((USE_THM_THEN lin_approx)(new_rewrite [] [])) THEN (simp_tac)) THEN (split_tac)))));; +refine (by (VALID ((((USE_THM_THEN pair_eq)(new_rewrite [] [])) THEN (((USE_THEN "ineqs")MP_TAC) THEN (clear_assumption "ineqs") THEN ((USE_THEN "approx2")MP_TAC) THEN (clear_assumption "approx2") THEN ((USE_THEN "approx1")MP_TAC) THEN (clear_assumption "approx1") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN lin_approx)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN interval_arith)(new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((((USE_THEN "approx2")MP_TAC) THEN (clear_assumption "approx2") THEN ((USE_THEN "approx1")MP_TAC) THEN (clear_assumption "approx1") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN lin_approx)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN (move ["int_f1"])) THEN (case THEN (move ["f1'"])) THEN (case THEN ((move ["df1"]) THEN (move ["int_f1'"]))))))));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["int_f2"])) THEN (case THEN (move ["f2'"])) THEN (case THEN ((move ["df2"]) THEN (move ["int_f2'"])))))));; +refine (by (VALID (((exists_tac (`f1' + f2':real`)) THEN (((USE_THM_THEN HAS_REAL_DERIVATIVE_ADD)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THEN "int_f2'")MP_TAC) THEN (clear_assumption "int_f2'") THEN ((USE_THEN "int_f1'")MP_TAC) THEN (clear_assumption "int_f1'") THEN ((USE_THEN "ineqs")MP_TAC) THEN (clear_assumption "ineqs") THEN BETA_TAC) THEN repeat_tactic 1 9 (((USE_THM_THEN interval_arith)(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +let lin_approx_add = end_section_proof();; +let lin_approx_add = finalize_theorem lin_approx_add;; +let lin_approx_scale = finalize_theorem lin_approx_scale;; +(end_section "LinearApproxArith");; +(begin_section "SecondDerivativeBound");; +(add_section_var (mk_var ("f1", (`:real->real`))); add_section_var (mk_var ("f2", (`:real->real`))));; +(add_section_var (mk_var ("int", (`:real#real`))));; +(add_section_var (mk_var ("dd1", (`:real#real`))); add_section_var (mk_var ("dd2", (`:real#real`))));; +(start_section_proof ["f";"x"](`nth_diff_strong 2 f x <=> ?s. real_open s /\ x IN s /\ + !y. y IN s ==> (f has_real_derivative derivative f y) (atreal y) /\ + (derivative f has_real_derivative nth_derivative 2 f y) (atreal y)`));; +refine (by (VALID ((((USE_THM_THEN nth_diff_strong)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_differentiable_on)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_differentiable_eq)(new_rewrite [] [])) THEN ((USE_THM_THEN (ARITH_RULE `i < 2 <=> i = 0 \/ i = 1`))(new_rewrite [] []))))));; +refine (by (VALID (((split_tac) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])))));; +refine (by (VALID (((exists_tac (mk_var("s",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))) THEN ((((USE_THEN "open_s")(new_rewrite [] [])) THEN ((USE_THEN "xs")(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "df")(MATCH_MP_THEN snd_th MP_TAC))) THEN (case THEN (move ["_"])) THEN (move ["h"]))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "h")(ISPEC_THEN (`1`) thm_tac))MP_TAC) THEN ((fun thm_tac -> (USE_THEN "h")(ISPEC_THEN (`0`) thm_tac))MP_TAC) THEN BETA_TAC THEN (simp_tac)) THEN ((((USE_THM_THEN ONE)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN nth_derivative1)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_derivative0)(new_rewrite [] [])) THEN ((USE_THM_THEN TWO)(GSYM_THEN (new_rewrite [] [])))) THEN (DISCH_THEN(new_rewrite [] [])) THEN (DISCH_THEN(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((exists_tac (mk_var("s",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))) THEN ((((USE_THEN "open_s")(new_rewrite [] [])) THEN ((USE_THEN "xs")(new_rewrite [1] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "df")(MATCH_MP_THEN snd_th MP_TAC))) THEN (move ["h"]))))));; +refine (by (VALID ((((USE_THM_THEN REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN real_differentiable)(new_rewrite [] [])) THEN (exists_tac (`derivative f y`)) THEN (done_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["i"])) THEN (case THEN (DISCH_THEN(new_rewrite [] []))) THEN (repeat_tactic 0 10 (((USE_THM_THEN ONE)(GSYM_THEN (new_rewrite [] [])))) THEN repeat_tactic 0 10 (((USE_THM_THEN TWO)(GSYM_THEN (new_rewrite [] [])))) THEN repeat_tactic 1 9 (((fun thm_tac ->(USE_THM_THEN nth_derivative0)(fun tmp_th1 -> (USE_THM_THEN nth_derivative1)(fun tmp_th2 -> thm_tac (CONJ tmp_th1 tmp_th2))))(new_rewrite [] [])))) THEN (done_tac)))));; +let nth_diff_strong2_eq_alt = end_section_proof();; +(start_section_proof ["f";"x"](`nth_diff_strong 2 f x <=> ?s. real_open s /\ x IN s /\ + !y. y IN s ==> f real_differentiable atreal y /\ derivative f real_differentiable atreal y`));; +refine (by (VALID ((((USE_THM_THEN nth_diff_strong)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_differentiable_on)(new_rewrite [] [])) THEN ((USE_THM_THEN TWO)(new_rewrite [] [])) THEN ((USE_THM_THEN ONE)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL nth_differentiable))(new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN ONE)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN nth_derivative0)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_derivative1)(new_rewrite [] []))))));; +refine (by (VALID (((split_tac) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["df"])))));; +refine (by (VALID (((exists_tac (mk_var("s",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))) THEN ((((USE_THEN "open_s")(new_rewrite [] [])) THEN ((USE_THEN "xs")(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "df")(MATCH_MP_THEN snd_th MP_TAC))) THEN (move ["h"])) THEN (done_tac)))));; +refine (by (VALID (((exists_tac (mk_var("s",mk_type("fun",[mk_type("real",[]);mk_type("bool",[])])))) THEN ((((USE_THEN "open_s")(new_rewrite [] [])) THEN ((USE_THEN "xs")(new_rewrite [1] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["y"]) THEN (DISCH_THEN (fun snd_th -> (USE_THEN "df")(MATCH_MP_THEN snd_th MP_TAC))) THEN (move ["h"]))))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THEN "h")(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL)(new_rewrite [] []))) THEN (done_tac)))));; +let nth_diff_strong2_eq = end_section_proof();; +(start_section_proof ["f";"g";"y";"g_bounds";"f_bounds";"d_bounds"](`nth_diff_strong_int 2 g_bounds f ==> + g real_differentiable atreal y ==> + interval_arith (g y) g_bounds ==> + bounded_on_int f g_bounds f_bounds ==> + interval_arith (derivative g y * derivative f (g y)) d_bounds ==> + lin_approx (\x. f (g x)) y f_bounds d_bounds`));; +refine (by (VALID (((((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_diff_strong2_eq)(new_rewrite [] [])) THEN ((USE_THM_THEN bounded_on_int)(new_rewrite [] []))) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["g_int"]) THEN (move ["f_int"]) THEN (move ["dfg_int"])))));; +refine (by (VALID ((have_tac (move ["dfgy"]) (`f real_differentiable atreal (g y)`)))));; +refine (by (VALID (((((fun thm_tac -> (USE_THEN "df")(fun fst_th ->(USE_THEN "g_int")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["ys"])) THEN (DISCH_THEN(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN lin_approx_eq)(new_rewrite [] [])) THEN ((USE_THM_THEN derivative_composition)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "dfg_int")(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THEN "f_int")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andbT)(new_rewrite [] []))))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN o_THM)(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (((USE_THM_THEN REAL_DIFFERENTIABLE_COMPOSE_ATREAL)MP_TAC) THEN (clear_assumption "REAL_DIFFERENTIABLE_COMPOSE_ATREAL") THEN (exact_tac)) THEN (done_tac)))));; +let lin_approx_compose = end_section_proof();; +(start_section_proof ["x"](`((\x. inv (&1 + x pow 2)) has_real_derivative + (-- &2 * x) * inv (&1 + x pow 2) pow 2) (atreal x)`));; +refine (by (VALID (((((USE_THM_THEN REAL_POW_INV)(new_rewrite [] [])) THEN ((USE_THM_THEN real_div)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_NEG_LMUL)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN HAS_REAL_DERIVATIVE_INV_ATREAL)(new_rewrite [] []))) THEN (split_tac)))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN REAL_ADD_LID)(ISPEC_THEN (`&2 * x`) thm_tac))(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN HAS_REAL_DERIVATIVE_ADD)(new_rewrite [] [])) THEN ((USE_THM_THEN HAS_REAL_DERIVATIVE_CONST)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))))));; +refine (by (VALID ((((USE_THM_THEN REAL_POW_2)(new_rewrite [] [])) THEN ((USE_THM_THEN (REAL_ARITH `&2 * x = x * &1 + &1 * x`))(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THM_THEN HAS_REAL_DERIVATIVE_MUL_ATREAL)(new_rewrite [] [])) THEN ((USE_THM_THEN HAS_REAL_DERIVATIVE_ID)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN REAL_POS_NZ)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN REAL_ADD_SYM)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LT_ADD1)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_POW_2)(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_atn_eq = end_section_proof();; +(start_section_proof [](`derivative (derivative atn) = (\x. (-- &2 * x) * inv (&1 + x pow 2) pow 2)`));; +refine (by (VALID ((((((USE_THM_THEN derivative_atn)(new_rewrite [] [])) THEN ((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] [])))) THEN (move ["x"]) THEN (simp_tac)) THEN (((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID (((((USE_THM_THEN REAL_POW_2)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN second_derivative_atn_eq)(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_atn = end_section_proof();; +(start_section_proof ["x"](`nth_diff_strong 2 atn x`));; +refine (by (VALID ((((USE_THM_THEN nth_diff_strong2_eq_alt)(new_rewrite [] [])) THEN (exists_tac (`(:real)`))))));; +refine (by (VALID (((((USE_THM_THEN IN_UNIV)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_OPEN_UNIV)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] []))) THEN ((USE_THM_THEN IN_UNIV)(new_rewrite [] []))) THEN (move ["y"]) THEN (simp_tac)))));; +refine (by (VALID ((((USE_THM_THEN derivative_atn)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_POW_2)(GSYM_THEN (new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN HAS_REAL_DERIVATIVE_ATN)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THM_THEN nth_derivative2)(new_rewrite [] [])) THEN ((USE_THM_THEN second_derivative_atn)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN second_derivative_atn_eq)(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_atn = end_section_proof();; +(start_section_proof ["x"](`~(x = &0) ==> nth_derivative 2 inv x = &2 * inv (x pow 3)`));; +refine (by (VALID ((((USE_THM_THEN nth_derivative2)(new_rewrite [] [])) THEN (move ["xn0"])))));; +refine (by (VALID (((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((USE_THM_THEN Arc_properties.HAS_REAL_DERIVATIVE_LOCAL)MP_TAC) THEN (clear_assumption "Arc_properties.HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID (((exists_tac (`(\x. -- inv (x * x))`)) THEN (split_tac)))));; +refine (by (VALID ((((USE_THM_THEN ((DISCH_ALL o REAL_DIFF_CONV) `((\x. -- inv(x * x)) has_real_derivative f) (atreal x)`))MP_TAC) THEN BETA_TAC))));; +refine (by (VALID ((((USE_THM_THEN REAL_ENTIRE)(new_rewrite [] [])) THEN ((USE_THEN "xn0")(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN real_div)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_LNEG)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_NEG_NEG)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_LID)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_RID)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_2)(GSYM_THEN (new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN (REAL_ARITH `(x * x) pow 2 = x * x pow 3`))(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_INV_MUL)(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THM_THEN (REAL_ARITH `!a. (&2 * x) * inv x * a = &2 * (x * inv x) * a`))(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_RINV)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_MUL_LID)(new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID ((exists_tac (`real_interval (x - abs x, x + abs x)`)))));; +refine (by (VALID (((((USE_THM_THEN REAL_OPEN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])))) THEN ((split_tac) THENL [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))])))));; +refine (by (VALID (((((USE_THEN "xn0")MP_TAC) THEN (clear_assumption "xn0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN derivative_inv)(new_rewrite [] [])) THEN ((simp_tac THEN TRY done_tac))))));; +refine (by (VALID (((((USE_THEN "xn0")MP_TAC) THEN (clear_assumption "xn0") THEN ((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +let second_derivative_inv = end_section_proof();; +(start_section_proof ["x"](`~(x = &0) ==> nth_diff_strong 2 inv x`));; +refine (by (VALID ((((USE_THM_THEN nth_diff_strong2_eq)(new_rewrite [] [])) THEN (move ["xn0"])))));; +refine (by (VALID ((exists_tac (`real_interval (x - abs x, x + abs x)`)))));; +refine (by (VALID (((((USE_THM_THEN REAL_OPEN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])))) THEN ((split_tac) THENL [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))])))));; +refine (by (VALID (((((USE_THEN "xn0")MP_TAC) THEN (clear_assumption "xn0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((THENL_FIRST) (((USE_THM_THEN REAL_DIFFERENTIABLE_AT_INV)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))) ((((USE_THEN "xn0")MP_TAC) THEN (clear_assumption "xn0") THEN ((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID (((((USE_THM_THEN differentiable_local)MP_TAC) THEN (clear_assumption "differentiable_local") THEN (DISCH_THEN apply_tac)) THEN ((exists_tac (`\x. --inv (x * x)`)) THEN (exists_tac (`real_interval (y - abs y, y + abs y)`)))))));; +refine (by (VALID (((((USE_THM_THEN REAL_OPEN_REAL_INTERVAL)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (split_tac)))));; +refine (by (VALID ((((USE_THM_THEN REAL_DIFFERENTIABLE_NEG)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_DIFFERENTIABLE_INV_ATREAL)(new_rewrite [] []))))));; +refine (by (VALID ((((USE_THM_THEN REAL_DIFFERENTIABLE_MUL_ATREAL)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_DIFFERENTIABLE_ID)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN REAL_ENTIRE)(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THEN "xn0")MP_TAC) THEN (clear_assumption "xn0") THEN ((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((split_tac) THENL [ALL_TAC; ((move ["z"]) THEN (move ["ineq2"]))]))));; +refine (by (VALID (((((USE_THEN "xn0")MP_TAC) THEN (clear_assumption "xn0") THEN ((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN derivative_inv)(new_rewrite [] [])) THEN ((TRY done_tac))) THEN (((USE_THEN "xn0")MP_TAC) THEN (clear_assumption "xn0") THEN ((USE_THEN "ineq2")MP_TAC) THEN (clear_assumption "ineq2") THEN ((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +let diff2_inv = end_section_proof();; +(start_section_proof ["x";"n"](`&0 <= x ==> sqrt x pow n = sqrt (x pow n)`));; +refine (by (VALID (((BETA_TAC THEN (move ["ineq"])) THEN ((disch_tm_tac [](mk_var("n",mk_type("num",[])))) THEN (clear_assumption "n") THEN elim THENL [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN (repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL real_pow))(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN SQRT_1)(new_rewrite [] []))) THEN ((TRY done_tac)))))));; +refine (by (VALID (((((USE_THEN "IHn")(new_rewrite [] [])) THEN ((USE_THM_THEN SQRT_MUL)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN REAL_POW_LE)(new_rewrite [] []))) THEN (done_tac)))));; +let SQRT_POW = end_section_proof();; +(start_section_proof ["x"](`&0 < x ==> nth_derivative 2 sqrt x = -- inv(&4 * sqrt (x pow 3))`));; +refine (by (VALID ((((USE_THM_THEN nth_derivative2)(new_rewrite [] [])) THEN (move ["x_pos"])))));; +refine (by (VALID (((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((USE_THM_THEN Arc_properties.HAS_REAL_DERIVATIVE_LOCAL)MP_TAC) THEN (clear_assumption "Arc_properties.HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID (((exists_tac (`(\x. inv (&2 * sqrt x))`)) THEN (split_tac)))));; +refine (by (VALID ((((USE_THM_THEN ((DISCH_ALL o REAL_DIFF_CONV) `((\x. inv(&2 * sqrt x)) has_real_derivative f) (atreal x)`))MP_TAC) THEN BETA_TAC))));; +refine (by (VALID ((have_tac (move ["ineq"]) (`~(&2 * sqrt x = &0)`)))));; +refine (by (VALID (((((USE_THM_THEN REAL_ENTIRE)(new_rewrite [] [])) THEN ((USE_THM_THEN negb_or)(new_rewrite [] [])) THEN ((USE_THM_THEN SQRT_EQ_0)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_LT_IMP_LE)(new_rewrite [] []))) THEN ((TRY done_tac))) THEN (((USE_THEN "x_pos")MP_TAC) THEN (clear_assumption "x_pos") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((((USE_THEN "x_pos")(new_rewrite [] [])) THEN ((USE_THEN "ineq")(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN real_div)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_INV_POW)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_LID)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_LNEG)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_MUL_ASSOC)(GSYM_THEN (new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN (GEN_ALL real_pow))(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_INV_POW)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_POW_MUL)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_INV_MUL)(new_rewrite [] []))) THEN ((USE_THM_THEN SQRT_POW)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_LT_IMP_LE)(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID ((((USE_THM_THEN REAL_MUL_ASSOC)(new_rewrite [] [])) THEN ((USE_THM_THEN (GEN_ALL real_pow))(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_LNEG)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_INV_MUL)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_ASSOC)(new_rewrite [] []))))));; +refine (by (VALID (((THENL_FIRST) (((USE_THM_THEN REAL_MUL_RINV)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_MUL_LID)(new_rewrite [] [])))) ((arith_tac) THEN (done_tac))))));; +refine (by (VALID (((((USE_THM_THEN REAL_MUL_LNEG)(new_rewrite [] [])) THEN ((USE_THM_THEN (REAL_ARITH `&2 pow 2 = &4`))(new_rewrite [] [])) THEN ((USE_THM_THEN (ARITH_RULE `SUC 2 = 3`))(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((exists_tac (`real_interval (&0, x + &1)`)))));; +refine (by (VALID (((((USE_THM_THEN REAL_OPEN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])))) THEN ((split_tac) THENL [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))])))));; +refine (by (VALID (((((USE_THEN "x_pos")MP_TAC) THEN (clear_assumption "x_pos") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN derivative_sqrt)(new_rewrite [] [])) THEN (done_tac)))));; +let second_derivative_sqrt = end_section_proof();; +(start_section_proof ["x"](`&0 < x ==> nth_diff_strong 2 sqrt x`));; +refine (by (VALID ((((USE_THM_THEN nth_diff_strong2_eq)(new_rewrite [] [])) THEN (move ["x_pos"])))));; +refine (by (VALID ((exists_tac (`real_interval (&0, x + &1)`)))));; +refine (by (VALID (((((USE_THM_THEN REAL_OPEN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])))) THEN ((split_tac) THENL [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))])))));; +refine (by (VALID (((((USE_THEN "x_pos")MP_TAC) THEN (clear_assumption "x_pos") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((THENL_FIRST) (((USE_THM_THEN REAL_DIFFERENTIABLE_AT_SQRT)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))) ((((USE_THEN "x_pos")MP_TAC) THEN (clear_assumption "x_pos") THEN ((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID (((((USE_THM_THEN differentiable_local)MP_TAC) THEN (clear_assumption "differentiable_local") THEN (DISCH_THEN apply_tac)) THEN ((exists_tac (`\x. inv (&2 * sqrt x)`)) THEN (exists_tac (`real_interval (&0, y + &1)`)))))));; +refine (by (VALID (((((USE_THM_THEN REAL_OPEN_REAL_INTERVAL)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (split_tac)))));; +refine (by (VALID ((((USE_THM_THEN REAL_DIFFERENTIABLE_INV_ATREAL)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_DIFFERENTIABLE_MUL_ATREAL)(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THM_THEN REAL_DIFFERENTIABLE_CONST)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_DIFFERENTIABLE_AT_SQRT)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN REAL_ENTIRE)(new_rewrite [] [])) THEN ((USE_THM_THEN SQRT_EQ_0)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_LT_IMP_LE)(new_rewrite [] []))) THEN ((TRY done_tac))) THEN (((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((THENL_FIRST) ((split_tac) THENL [ALL_TAC; ((move ["z"]) THEN (move ["ineq2"]))]) ((((USE_THEN "x_pos")MP_TAC) THEN (clear_assumption "x_pos") THEN ((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID ((((USE_THM_THEN derivative_sqrt)(new_rewrite [] [])) THEN (done_tac)))));; +let diff2_sqrt = end_section_proof();; +(start_section_proof ["x";"n"](`x pow (SUC n) = x * x pow n`));; +refine (by (VALID ((((USE_THM_THEN real_pow)(new_rewrite [] [])) THEN (done_tac)))));; +let real_powS = end_section_proof();; +(start_section_proof ["x"](`abs x < &1 ==> + nth_derivative 2 acs x = --(x / sqrt ((&1 - x * x) pow 3))`));; +refine (by (VALID ((((USE_THM_THEN nth_derivative2)(new_rewrite [] [])) THEN (move ["x_ineq"])))));; +refine (by (VALID (((((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((USE_THM_THEN Arc_properties.HAS_REAL_DERIVATIVE_LOCAL)MP_TAC) THEN (clear_assumption "Arc_properties.HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID (((exists_tac (`\x. --inv (sqrt (&1 - x * x))`)) THEN (split_tac)))));; +refine (by (VALID ((((USE_THM_THEN ((DISCH_ALL o REAL_DIFF_CONV) `((\x. --inv (sqrt (&1 - x * x))) has_real_derivative f) (atreal x)`))MP_TAC) THEN BETA_TAC))));; +refine (by (VALID ((have_tac (move ["ineqs"]) (`&0 < &1 - x * x /\ ~(sqrt(&1 - x * x) = &0)`)))));; +refine (by (VALID ((((THENL_ROT 1)) (have_tac (move ["h"]) (`&0 < &1 - x * x`))))));; +refine (by (VALID (((((USE_THM_THEN SQRT_EQ_0)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_LT_IMP_LE)(new_rewrite [] []))) THEN ((TRY done_tac))) THEN (((USE_THEN "h")MP_TAC) THEN (clear_assumption "h") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN (REAL_ARITH `&1 - x * x = (&1 - x) * (&1 + x)`))(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LT_MUL)(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THEN "x_ineq")MP_TAC) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THEN "ineqs")(new_rewrite [] []))) THEN (simp_tac) THEN repeat_tactic 1 9 (((USE_THM_THEN real_div)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_INV_MUL)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_SUB_LZERO)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_MUL_LNEG)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_NEG_NEG)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_MUL_ASSOC)(GSYM_THEN (new_rewrite [] []))))))));; +refine (by (VALID ((((USE_THM_THEN REAL_INV_MUL)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN real_powS)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN SQRT_POW)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_LT_IMP_LE)(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID ((((USE_THM_THEN REAL_MUL_LID)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_RID)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_2)(GSYM_THEN (new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN (REAL_ARITH `!a. (&2 * x) * inv (&2) * a = (&2 * inv (&2)) * x * a`))(new_rewrite [] [])) THEN ((USE_THM_THEN (ARITH_RULE `SUC 2 = 3`))(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THM_THEN REAL_MUL_RINV)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_MUL_LID)(new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((set_tac "e" (`&1 - abs x`)))));; +refine (by (VALID ((exists_tac (`real_interval (x - e, x + e)`)))));; +refine (by (VALID (((((USE_THM_THEN REAL_OPEN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])))) THEN ((split_tac) THENL [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))])))));; +refine (by (VALID (((((USE_THEN "e_def")MP_TAC) THEN (clear_assumption "e_def") THEN ((USE_THEN "x_ineq")MP_TAC) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN derivative_acs)(new_rewrite [] [])) THEN ((simp_tac THEN TRY done_tac))))));; +refine (by (VALID (((((USE_THEN "e_def")MP_TAC) THEN (clear_assumption "e_def") THEN ((USE_THEN "x_ineq")MP_TAC) THEN (clear_assumption "x_ineq") THEN ((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +let second_derivative_acs = end_section_proof();; +(start_section_proof ["x"](`abs x < &1 ==> nth_diff_strong 2 acs x`));; +refine (by (VALID ((((USE_THM_THEN nth_diff_strong2_eq)(new_rewrite [] [])) THEN (move ["x_ineq"])))));; +refine (by (VALID ((set_tac "e" (`&1 - abs x`)))));; +refine (by (VALID ((exists_tac (`real_interval (x - e, x + e)`)))));; +refine (by (VALID (((((USE_THM_THEN REAL_OPEN_REAL_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] [])))) THEN ((split_tac) THENL [ALL_TAC; ((move ["y"]) THEN (move ["ineq"]))])))));; +refine (by (VALID (((((USE_THEN "e_def")MP_TAC) THEN (clear_assumption "e_def") THEN ((USE_THEN "x_ineq")MP_TAC) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID (((THENL_FIRST) (((USE_THM_THEN REAL_DIFFERENTIABLE_AT_ACS)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] [])))) ((((USE_THEN "e_def")MP_TAC) THEN (clear_assumption "e_def") THEN ((USE_THEN "x_ineq")MP_TAC) THEN (clear_assumption "x_ineq") THEN ((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID ((set_tac "e2" (`&1 - abs y`)))));; +refine (by (VALID (((((USE_THM_THEN differentiable_local)MP_TAC) THEN (clear_assumption "differentiable_local") THEN (DISCH_THEN apply_tac)) THEN ((exists_tac (`\x. --inv (sqrt (&1 - x * x))`)) THEN (exists_tac (`real_interval (y - e2, y + e2)`)))))));; +refine (by (VALID (((((USE_THM_THEN REAL_OPEN_REAL_INTERVAL)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (split_tac)))));; +refine (by (VALID ((((USE_THM_THEN REAL_DIFFERENTIABLE_NEG)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_DIFFERENTIABLE_INV_ATREAL)(new_rewrite [] []))))));; +refine (by (VALID ((have_tac (move ["gt0"]) (`&0 < &1 - y * y`)))));; +refine (by (VALID (((((USE_THM_THEN (REAL_ARITH `&1 - y * y = (&1 - y) * (&1 + y)`))(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LT_MUL)(new_rewrite [] []))) THEN (((USE_THEN "e_def")MP_TAC) THEN (clear_assumption "e_def") THEN ((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN SQRT_EQ_0)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_LT_IMP_LE)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN REAL_LT_IMP_NZ)(new_rewrite [] [])) THEN ((simp_tac THEN TRY done_tac))))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`(\x. sqrt (&1 - x * x)) = sqrt o (\x. &1 - x * x)`)))));; +refine (by (VALID (((((USE_THM_THEN eq_ext)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN o_THM)(new_rewrite [] [])) THEN (simp_tac)) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN REAL_DIFFERENTIABLE_COMPOSE_ATREAL)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_DIFFERENTIABLE_AT_SQRT)(new_rewrite [] [])) THEN ((TRY done_tac))))));; +refine (by (VALID ((((USE_THM_THEN REAL_DIFFERENTIABLE_SUB)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN REAL_DIFFERENTIABLE_CONST)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_DIFFERENTIABLE_MUL_ATREAL)(new_rewrite [] [])) THEN ((TRY done_tac))))));; +refine (by (VALID ((((USE_THM_THEN REAL_DIFFERENTIABLE_ID)(new_rewrite [] [])) THEN (done_tac)))));; +refine (by (VALID (((split_tac) THENL [ALL_TAC; ((move ["z"]) THEN (move ["ineq2"]))]))));; +refine (by (VALID (((((USE_THEN "e2_def")MP_TAC) THEN (clear_assumption "e2_def") THEN ((USE_THEN "e_def")MP_TAC) THEN (clear_assumption "e_def") THEN ((USE_THEN "x_ineq")MP_TAC) THEN (clear_assumption "x_ineq") THEN ((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN derivative_acs)(new_rewrite [] [])) THEN ((simp_tac THEN TRY done_tac))))));; +refine (by (VALID (((((USE_THEN "ineq2")MP_TAC) THEN (clear_assumption "ineq2") THEN ((USE_THEN "e2_def")MP_TAC) THEN (clear_assumption "e2_def") THEN ((USE_THEN "e_def")MP_TAC) THEN (clear_assumption "e_def") THEN ((USE_THEN "ineq")MP_TAC) THEN (clear_assumption "ineq") THEN ((USE_THEN "x_ineq")MP_TAC) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +let diff2_acs = end_section_proof();; +(begin_section "SecondDerivativeCompose");; +(start_section_proof ["f";"s";"t"](`f real_continuous_on s ==> real_open s ==> real_open t ==> + real_open {x | x IN s /\ f x IN t}`));; +refine (by (VALID ((BETA_TAC THEN (move ["f_cont"]) THEN (move ["open_s"]) THEN (move ["open_t"])))));; +refine (by (VALID (((USE_THM_THEN REAL_OPEN)(new_rewrite [] [])))));; +refine (by (VALID ((((THENL_ROT 1)) (have_tac (DISCH_THEN(new_rewrite [] [])) (`IMAGE lift {x | x IN s /\ f x IN t} = + {x | x IN (IMAGE lift s) /\ (lift o f o drop) x IN (IMAGE lift t)}`))))));; +refine (by (VALID (((((USE_THM_THEN CONTINUOUS_OPEN_PREIMAGE)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_OPEN)(GSYM_THEN (new_rewrite [] []))))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN ((USE_THM_THEN REAL_CONTINUOUS_ON)(GSYM_THEN (new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((((USE_THM_THEN EXTENSION)(new_rewrite [] [])) THEN ((USE_THM_THEN IN_IMAGE_LIFT_DROP)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_ELIM_THM)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_IMAGE_LIFT_DROP)(new_rewrite [] [])))) THEN (move ["z"]) THEN (simp_tac)) THEN (split_tac)))));; +refine (by (VALID (((BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN (move ["x_in"])) THEN (move ["x_eq"])) THEN (exists_tac (`lift x`))))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN LIFT_DROP)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THEN "x_in")(new_rewrite [] []))) THEN ((USE_THEN "x_eq")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN LIFT_DROP)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN o_THM)(new_rewrite [] []))) THEN ((USE_THM_THEN LIFT_DROP)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN (move ["x_in"])) THEN (move ["x_eq"])))));; +refine (by (VALID (((exists_tac (`drop x`)) THEN (done_tac)))));; +let REAL_CONTINUOUS_OPEN_PREIMAGE = end_section_proof();; +(start_section_proof ["f";"g";"x"](`nth_diff_strong 2 g x ==> nth_diff_strong 2 f (g x) ==> + nth_derivative 2 (\x. f (g x)) x = + nth_derivative 2 f (g x) * (derivative g x) pow 2 + derivative f (g x) * nth_derivative 2 g x`));; +refine (by (VALID ((BETA_TAC THEN (move ["dg"]) THEN (move ["df"])))));; +refine (by (VALID ((((USE_THM_THEN nth_derivative2)(new_rewrite [] [])) THEN (((USE_THM_THEN derivative_unique)MP_TAC) THEN (clear_assumption "derivative_unique") THEN (DISCH_THEN apply_tac)) THEN (((USE_THM_THEN Arc_properties.HAS_REAL_DERIVATIVE_LOCAL)MP_TAC) THEN (clear_assumption "Arc_properties.HAS_REAL_DERIVATIVE_LOCAL") THEN (DISCH_THEN apply_tac))))));; +refine (by (VALID (((THENL_ROT (-1)) ((exists_tac (`\x. derivative f (g x) * derivative g x`)) THEN (split_tac))))));; +refine (by (VALID (((((USE_THEN "dg")MP_TAC) THEN ((USE_THEN "df")MP_TAC) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong2_eq)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["gxs"])) THEN (move ["d_f"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["xt"])) THEN (move ["d_g"]))))));; +refine (by (VALID ((set_tac "s'" (`{z | z IN t /\ g z IN s}`)))));; +refine (by (VALID ((have_tac (move ["open_s'"]) (`real_open s'`)))));; +refine (by (VALID ((((USE_THEN "s'_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_CONTINUOUS_OPEN_PREIMAGE)(new_rewrite [] [])) THEN ((USE_THEN "open_t")(new_rewrite [] [])) THEN ((USE_THEN "open_s")(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andbT)(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THM_THEN REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT)(new_rewrite [] [])) THEN ((TRY done_tac))) THEN (move ["y"]) THEN (move ["yt"])))));; +refine (by (VALID (((((USE_THM_THEN REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL)(new_rewrite [] [])) THEN ((USE_THEN "d_g")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((exists_tac (`t INTER s'`)) THEN (((USE_THM_THEN REAL_OPEN_INTER)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (split_tac)))));; +refine (by (VALID (((((USE_THEN "s'_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN IN_ELIM_THM)(new_rewrite [] [])) THEN ((USE_THEN "xt")(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])) THEN (simp_tac)) THEN (exists_tac (mk_var("x",mk_type("real",[])))) THEN (done_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["yt"]) THEN (move ["ys'"])))) THEN (((USE_THM_THEN derivative_composition)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_MUL_SYM)(new_rewrite [] []))) THEN ((TRY done_tac)))))));; +refine (by (VALID (((((USE_THEN "d_g")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "d_f")(new_rewrite [] [])) THEN ((TRY done_tac))) THEN (((USE_THEN "ys'")MP_TAC) THEN (clear_assumption "ys'") THEN BETA_TAC) THEN ((((USE_THEN "s'_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN IN_ELIM_THM)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN (move ["z"])) THEN (simp_tac)) THEN (done_tac)))));; +refine (by (VALID (((((USE_THEN "dg")MP_TAC) THEN (clear_assumption "dg") THEN ((USE_THEN "df")MP_TAC) THEN (clear_assumption "df") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong2_eq_alt)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (move ["d_f"]) THEN (case THEN (move ["_"])) THEN (move ["d_g"]))))));; +refine (by (VALID (((THENL_ROT (-1)) ((((USE_THM_THEN REAL_ADD_SYM)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_POW_2)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_ASSOC)(new_rewrite [] [])) THEN ((USE_THM_THEN HAS_REAL_DERIVATIVE_MUL_ATREAL)(new_rewrite [] []))) THEN (split_tac))))));; +refine (by (VALID ((((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN ((USE_THEN "d_g")(new_rewrite [] [])) THEN (done_tac)))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN o_THM)(ISPEC_THEN (`derivative f`) thm_tac))(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN ((USE_THM_THEN REAL_DIFF_CHAIN_ATREAL)(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THEN "d_g")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "d_f")(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_compose = end_section_proof();; +(start_section_proof ["f";"g";"x"](`nth_diff_strong 2 g x ==> nth_diff_strong 2 f (g x) ==> + nth_diff_strong 2 (\x. f (g x)) x`));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong2_eq)(new_rewrite [] []))) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (move ["dg"]) THEN (case THEN (move ["t"])) THEN (case THEN (move ["open_t"])) THEN (case THEN (move ["gxt"])) THEN (move ["df"])))));; +refine (by (VALID ((set_tac "s'" (`{z | z IN s /\ g z IN t}`)))));; +refine (by (VALID ((have_tac (move ["open_s'"]) (`real_open s'`)))));; +refine (by (VALID ((((USE_THEN "s'_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_CONTINUOUS_OPEN_PREIMAGE)(new_rewrite [] [])) THEN ((USE_THEN "open_t")(new_rewrite [] [])) THEN ((USE_THEN "open_s")(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andbT)(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THM_THEN REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT)(new_rewrite [] [])) THEN ((TRY done_tac))) THEN (move ["y"]) THEN (move ["yt"])))));; +refine (by (VALID (((((USE_THM_THEN REAL_DIFFERENTIABLE_IMP_CONTINUOUS_ATREAL)(new_rewrite [] [])) THEN ((USE_THEN "dg")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((exists_tac (`s INTER s'`)) THEN (((USE_THM_THEN REAL_OPEN_INTER)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (split_tac)))));; +refine (by (VALID (((((USE_THEN "s'_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN IN_ELIM_THM)(new_rewrite [] [])) THEN ((USE_THEN "xs")(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN ((exists_tac (mk_var("x",mk_type("real",[])))) THEN (simp_tac)) THEN (done_tac)))));; +refine (by (VALID ((BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["ys'"])))))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN o_THM)(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(GSYM_THEN (new_rewrite [1] []))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (((USE_THM_THEN REAL_DIFFERENTIABLE_COMPOSE_ATREAL)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "dg")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN andTb)(new_rewrite [] []))) THEN ((TRY done_tac)))))));; +refine (by (VALID (((((USE_THEN "ys'")MP_TAC) THEN (clear_assumption "ys'") THEN BETA_TAC) THEN ((USE_THEN "s'_def")(GSYM_THEN (new_rewrite [] []))) THEN (((USE_THM_THEN IN_ELIM_THM)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["z"])) THEN (simp_tac)) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN differentiable_local)MP_TAC) THEN (clear_assumption "differentiable_local") THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID (((THENL_ROT (-1)) (((exists_tac (`\x. derivative g x * derivative f (g x)`)) THEN (exists_tac (`s INTER s'`))) THEN (split_tac))))));; +refine (by (VALID (((((USE_THM_THEN REAL_OPEN_INTER)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_INTER)(new_rewrite [] []))) THEN ((USE_THEN "ys")(new_rewrite [1] [])) THEN ((USE_THEN "ys'")(new_rewrite [1] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["z"]) THEN (move ["z_in"])))));; +refine (by (VALID ((((USE_THM_THEN derivative_composition)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "dg")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "df")(new_rewrite [] [])) THEN ((TRY done_tac))))));; +refine (by (VALID (((((USE_THEN "z_in")MP_TAC) THEN (clear_assumption "z_in") THEN BETA_TAC) THEN ((USE_THEN "s'_def")(GSYM_THEN (new_rewrite [] []))) THEN (((USE_THM_THEN IN_ELIM_THM)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (simp_tac)) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN REAL_DIFFERENTIABLE_MUL_ATREAL)(new_rewrite [] [])) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (((USE_THEN "dg")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID ((((fun thm_tac -> (USE_THM_THEN o_THM)(ISPEC_THEN (`derivative f`) thm_tac))(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN ETA_AX)(fun th -> ONCE_REWRITE_TAC[th])) THEN (((USE_THM_THEN REAL_DIFFERENTIABLE_COMPOSE_ATREAL)(new_rewrite [] [])) THEN ((USE_THEN "dg")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "df")(new_rewrite [] [])) THEN ((TRY done_tac)))))));; +refine (by (VALID (((((USE_THEN "ys'")MP_TAC) THEN (clear_assumption "ys'") THEN BETA_TAC) THEN ((USE_THEN "s'_def")(GSYM_THEN (new_rewrite [] []))) THEN (((USE_THM_THEN IN_ELIM_THM)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["z"])) THEN (simp_tac)) THEN (done_tac)))));; +let diff2_compose = end_section_proof();; +(start_section_proof ["f";"x"](`~(f x = &0) ==> f real_continuous atreal x ==> + ?s. real_open s /\ x IN s /\ !y. y IN s ==> ~(f y = &0)`));; +refine (by (VALID ((((USE_THM_THEN real_continuous_atreal)(new_rewrite [] [])) THEN (move ["fn0"]) THEN ((fun thm_tac -> DISCH_THEN (ISPEC_THEN (`abs (f x)`) thm_tac))MP_TAC)))));; +refine (by (VALID (((THENL_FIRST) (ANTS_TAC) ((((USE_THEN "fn0")MP_TAC) THEN (clear_assumption "fn0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["ineq"])))));; +refine (by (VALID ((exists_tac (`real_interval (x - d, x + d)`)))));; +refine (by (VALID (((THENL_FIRST) ((((USE_THM_THEN REAL_OPEN_REAL_INTERVAL)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN ((split_tac) THENL [ALL_TAC; (move ["y"])])) ((((USE_THEN "d0")MP_TAC) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID (((((USE_THEN "fn0")MP_TAC) THEN (clear_assumption "fn0") THEN ((USE_THEN "d0")MP_TAC) THEN (clear_assumption "d0") THEN ((fun thm_tac -> (USE_THEN "ineq")(ISPEC_THEN (mk_var("y",mk_type("real",[]))) thm_tac))MP_TAC) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +let continuous_not0_exists_open = end_section_proof();; +(start_section_proof ["a";"f";"x"](`a < f x ==> f real_continuous atreal x ==> + ?s. real_open s /\ x IN s /\ !y. y IN s ==> a < f y`));; +refine (by (VALID (((BETA_TAC THEN (move ["f_ineq"])) THEN (((USE_THM_THEN real_continuous_atreal)(new_rewrite [] [])) THEN ((fun thm_tac -> DISCH_THEN (ISPEC_THEN (`f x - a`) thm_tac))MP_TAC))))));; +refine (by (VALID (((THENL_FIRST) (ANTS_TAC) ((((USE_THEN "f_ineq")MP_TAC) THEN (clear_assumption "f_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["ineq"])))));; +refine (by (VALID ((exists_tac (`real_interval (x - d, x + d)`)))));; +refine (by (VALID (((THENL_FIRST) ((((USE_THM_THEN REAL_OPEN_REAL_INTERVAL)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN ((split_tac) THENL [ALL_TAC; (move ["y"])])) ((((USE_THEN "d0")MP_TAC) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID (((((USE_THEN "f_ineq")MP_TAC) THEN (clear_assumption "f_ineq") THEN ((USE_THEN "d0")MP_TAC) THEN (clear_assumption "d0") THEN ((fun thm_tac -> (USE_THEN "ineq")(ISPEC_THEN (mk_var("y",mk_type("real",[]))) thm_tac))MP_TAC) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +let continuous_gt_exists_open = end_section_proof();; +(start_section_proof ["a";"f";"x"](`f x < a ==> f real_continuous atreal x ==> + ?s. real_open s /\ x IN s /\ !y. y IN s ==> f y < a`));; +refine (by (VALID (((BETA_TAC THEN (move ["f_ineq"])) THEN (((USE_THM_THEN real_continuous_atreal)(new_rewrite [] [])) THEN ((fun thm_tac -> DISCH_THEN (ISPEC_THEN (`a - f x`) thm_tac))MP_TAC))))));; +refine (by (VALID (((THENL_FIRST) (ANTS_TAC) ((((USE_THEN "f_ineq")MP_TAC) THEN (clear_assumption "f_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID ((BETA_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d0"])) THEN (move ["ineq"])))));; +refine (by (VALID ((exists_tac (`real_interval (x - d, x + d)`)))));; +refine (by (VALID (((THENL_FIRST) ((((USE_THM_THEN REAL_OPEN_REAL_INTERVAL)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_REAL_INTERVAL)(new_rewrite [] []))) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN ((split_tac) THENL [ALL_TAC; (move ["y"])])) ((((USE_THEN "d0")MP_TAC) THEN (clear_assumption "d0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID (((((USE_THEN "f_ineq")MP_TAC) THEN (clear_assumption "f_ineq") THEN ((USE_THEN "d0")MP_TAC) THEN (clear_assumption "d0") THEN ((fun thm_tac -> (USE_THEN "ineq")(ISPEC_THEN (mk_var("y",mk_type("real",[]))) thm_tac))MP_TAC) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +let continuous_lt_exists_open = end_section_proof();; +(add_section_var (mk_var ("f", (`:real->real`))));; +(add_section_var (mk_var ("x", (`:real`))));; +(add_section_hyp "df" (`nth_diff_strong 2 f x`));; +(start_section_proof [](`nth_derivative 2 (\x. atn (f x)) x = + (nth_derivative 2 f x * (&1 + f x * f x) - &2 * f x * derivative f x pow 2) / (&1 + f x * f x) pow 2`));; +refine (by (VALID ((((USE_THM_THEN second_derivative_compose)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN diff2_atn)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN nth_derivative2)(new_rewrite [] [])) THEN ((USE_THM_THEN second_derivative_atn)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN derivative_atn)(new_rewrite [] [])) THEN (simp_tac)))));; +refine (by (VALID ((((USE_THM_THEN REAL_ADD_SYM)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_MUL_LNEG)(new_rewrite [] []))) THEN ((USE_THM_THEN real_sub)(GSYM_THEN (new_rewrite [] [])))))));; +refine (by (VALID (((set_tac "lhs1" (`_1 * _2`)) THEN (set_tac "lhs2" (`_1 * _2`))))));; +refine (by (VALID ((((USE_THM_THEN real_div)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_INV_POW)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_SUB_RDISTRIB)(new_rewrite [] []))))));; +refine (by (VALID (((set_tac "rhs1" (`_1 * _2`)) THEN (set_tac "rhs2" (`_1 * _2`))))));; +refine (by (VALID ((((USE_THM_THEN (REAL_ARITH `lhs1 = rhs1 /\ lhs2 = rhs2 ==> lhs1 - lhs2 = rhs1 - rhs2`))MP_TAC) THEN (DISCH_THEN apply_tac)))));; +refine (by (VALID (((((USE_THEN "lhs2_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THEN "rhs2_def")(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_MUL_ASSOC)(GSYM_THEN (new_rewrite [] [])))) THEN ((USE_THM_THEN REAL_MUL_SYM)(new_rewrite [] [(`_1 * _2 pow 2`)])) THEN ((USE_THM_THEN REAL_POW_2)(GSYM_THEN (new_rewrite [] [])))) THEN ((split_tac) THEN ((TRY done_tac)))))));; +refine (by (VALID ((((USE_THEN "rhs1_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_POW_2)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_MUL_ASSOC)(GSYM_THEN (new_rewrite [] [])))) THEN ((USE_THM_THEN (REAL_ARITH `!a b c d. a * b * c * d = a * (b * c) * d`))(new_rewrite [] []))))));; +refine (by (VALID ((((USE_THM_THEN REAL_MUL_RINV)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "lhs1_def")(GSYM_THEN (new_rewrite [] [])))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_MUL_LID)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_MUL_SYM)(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID (((((fun thm_tac -> (USE_THM_THEN REAL_LE_SQUARE)(ISPEC_THEN (`f x`) thm_tac))MP_TAC) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +let second_derivative_compose_atn = end_section_proof();; +(start_section_proof [](`~(f x = &0) ==> + nth_derivative 2 (\x. inv (f x)) x = + (&2 * derivative f x pow 2 - nth_derivative 2 f x * f x) / (f x pow 3)`));; +refine (by (VALID ((BETA_TAC THEN (move ["fn0"])))));; +refine (by (VALID ((((USE_THM_THEN second_derivative_compose)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN diff2_inv)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN second_derivative_inv)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN derivative_inv)(new_rewrite [] [])) THEN ((TRY done_tac))))));; +refine (by (VALID ((((USE_THM_THEN REAL_MUL_LNEG)(new_rewrite [] [])) THEN ((USE_THM_THEN real_sub)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN real_div)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_SUB_RDISTRIB)(new_rewrite [] []))))));; +refine (by (VALID (((THENL_FIRST) ((((USE_THM_THEN (REAL_ARITH `!a b c d. a = c /\ b = d ==> a - b = c - d`))MP_TAC) THEN (DISCH_THEN apply_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))))));; +refine (by (VALID ((((USE_THM_THEN REAL_INV_POW)(new_rewrite [] [])) THEN ((USE_THM_THEN (ARITH_RULE `3 = SUC 2`))(new_rewrite [] [])) THEN ((USE_THM_THEN real_powS)(new_rewrite [] []))))));; +refine (by (VALID ((((USE_THM_THEN (REAL_ARITH `!a b c d. (a * b) * c * d = a * (b * c) * d`))(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_RINV)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN REAL_MUL_LID)(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THM_THEN REAL_INV_MUL)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_POW_2)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_MUL_SYM)(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_compose_inv = end_section_proof();; +(start_section_proof [](`&0 < f x ==> + nth_derivative 2 (\x. sqrt (f x)) x = + (&2 * nth_derivative 2 f x * f x - derivative f x pow 2) / (&4 * sqrt (f x pow 3))`));; +refine (by (VALID ((BETA_TAC THEN (move ["f_pos"])))));; +refine (by (VALID ((((USE_THM_THEN second_derivative_compose)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN diff2_sqrt)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN second_derivative_sqrt)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN derivative_sqrt)(new_rewrite [] [])) THEN ((TRY done_tac))))));; +refine (by (VALID ((((USE_THM_THEN REAL_MUL_LNEG)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_ADD_SYM)(new_rewrite [] [])) THEN ((USE_THM_THEN real_sub)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN real_div)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_SUB_RDISTRIB)(new_rewrite [] []))))));; +refine (by (VALID (((THENL_LAST) ((((USE_THM_THEN (REAL_ARITH `!a b c d. a = c /\ b = d ==> a - b = c - d`))MP_TAC) THEN (DISCH_THEN apply_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`sqrt (f x pow 3) = sqrt (f x) * f x`)))));; +refine (by (VALID (((((USE_THM_THEN SQRT_POW)(GSYM_THEN (new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_LT_IMP_LE)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN (ARITH_RULE `3 = SUC 2`))(new_rewrite [] [])) THEN ((USE_THM_THEN real_powS)(new_rewrite [] [])) THEN ((USE_THM_THEN SQRT_POW_2)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_LT_IMP_LE)(new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID (repeat_tactic 1 9 (((USE_THM_THEN REAL_INV_MUL)(new_rewrite [] []))))));; +refine (by (VALID (((USE_THM_THEN (REAL_ARITH `!a b c d. (&2 * a * b) * inv (&4) * c * d = (inv (&2) * c) * a * (b * d)`))(new_rewrite [] [])))));; +refine (by (VALID (((((USE_THM_THEN REAL_MUL_RINV)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_POS_NZ)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN REAL_MUL_RID)(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_compose_sqrt = end_section_proof();; +(start_section_proof [](`abs (f x) < &1 ==> + nth_derivative 2 (\x. acs (f x)) x = + -- ((nth_derivative 2 f x * (&1 - f x * f x) + f x * derivative f x pow 2) / + sqrt ((&1 - f x * f x) pow 3))`));; +refine (by (VALID ((BETA_TAC THEN (move ["f_ineq"])))));; +refine (by (VALID ((((USE_THM_THEN second_derivative_compose)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN diff2_acs)(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN second_derivative_acs)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN derivative_acs)(new_rewrite [] [])) THEN ((TRY done_tac))))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN REAL_MUL_LNEG)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_NEG_ADD)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN REAL_EQ_NEG2)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN real_div)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_ADD_RDISTRIB)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_ADD_SYM)(new_rewrite [] []))))));; +refine (by (VALID (((THENL_LAST) ((((USE_THM_THEN (REAL_ARITH `!a b c d. a = c /\ b = d ==> a + b = c + d`))MP_TAC) THEN (DISCH_THEN apply_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))))));; +refine (by (VALID ((set_tac "y" (`&1 - f x * f x`)))));; +refine (by (VALID ((have_tac (move ["y_ineq"]) (`&0 <= y /\ &0 < y /\ ~(y = &0)`)))));; +refine (by (VALID ((((USE_THEN "y_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN (REAL_ARITH `!a. &1 - a * a = (&1 - a) * (&1 + a)`))(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THM_THEN REAL_ENTIRE)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_MUL)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN REAL_LT_MUL)(new_rewrite [] [])))) THEN (((USE_THEN "f_ineq")MP_TAC) THEN (clear_assumption "f_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`sqrt (y pow 3) = sqrt y * y`)))));; +refine (by (VALID (((((USE_THM_THEN SQRT_POW)(GSYM_THEN (new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THM_THEN (ARITH_RULE `3 = SUC 2`))(new_rewrite [] [])) THEN ((USE_THM_THEN real_powS)(new_rewrite [] [])) THEN ((USE_THM_THEN SQRT_POW_2)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN REAL_INV_MUL)(new_rewrite [] [])) THEN ((USE_THM_THEN (REAL_ARITH `!a b c d. (a * b) * c * d = c * a * (b * d)`))(new_rewrite [] []))))));; +refine (by (VALID (((((USE_THM_THEN REAL_MUL_RINV)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN REAL_MUL_RID)(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_compose_acs = end_section_proof();; +(start_section_proof [](`nth_diff_strong 2 (\x. atn (f x)) x`));; +refine (by (VALID (((((USE_THM_THEN diff2_compose)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2_atn)(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_compose_atn = end_section_proof();; +(start_section_proof [](`~(f x = &0) ==> nth_diff_strong 2 (\x. inv (f x)) x`));; +refine (by (VALID (((BETA_TAC THEN (move ["fn0"])) THEN (((USE_THM_THEN diff2_compose)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2_inv)(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_compose_inv = end_section_proof();; +(start_section_proof [](`&0 < f x ==> nth_diff_strong 2 (\x. sqrt (f x)) x`));; +refine (by (VALID (((BETA_TAC THEN (move ["f_pos"])) THEN (((USE_THM_THEN diff2_compose)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2_sqrt)(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_compose_sqrt = end_section_proof();; +(start_section_proof [](`abs (f x) < &1 ==> nth_diff_strong 2 (\x. acs (f x)) x`));; +refine (by (VALID (((BETA_TAC THEN (move ["f_abs"])) THEN (((USE_THM_THEN diff2_compose)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2_acs)(new_rewrite [] []))) THEN (done_tac)))));; +let diff2_compose_acs = end_section_proof();; +let diff2_compose_acs = finalize_theorem diff2_compose_acs;; +let diff2_compose_sqrt = finalize_theorem diff2_compose_sqrt;; +let diff2_compose_inv = finalize_theorem diff2_compose_inv;; +let diff2_compose_atn = finalize_theorem diff2_compose_atn;; +let second_derivative_compose_acs = finalize_theorem second_derivative_compose_acs;; +let second_derivative_compose_sqrt = finalize_theorem second_derivative_compose_sqrt;; +let second_derivative_compose_inv = finalize_theorem second_derivative_compose_inv;; +let second_derivative_compose_atn = finalize_theorem second_derivative_compose_atn;; +let continuous_lt_exists_open = finalize_theorem continuous_lt_exists_open;; +let continuous_gt_exists_open = finalize_theorem continuous_gt_exists_open;; +let continuous_not0_exists_open = finalize_theorem continuous_not0_exists_open;; +let diff2_compose = finalize_theorem diff2_compose;; +let second_derivative_compose = finalize_theorem second_derivative_compose;; +let REAL_CONTINUOUS_OPEN_PREIMAGE = finalize_theorem REAL_CONTINUOUS_OPEN_PREIMAGE;; +(end_section "SecondDerivativeCompose");; +(start_section_proof ["f";"g";"x"](`nth_diff_strong 2 f x ==> + nth_diff_strong 2 g x ==> + nth_derivative 2 (\x. f x * g x) x = + f x * nth_derivative 2 g x + &2 * derivative f x * derivative g x + nth_derivative 2 f x * g x`));; +refine (by (VALID (((BETA_TAC THEN (move ["df0"]) THEN (move ["dg0"])) THEN (set_tac "int" (`(x,x)`))))));; +refine (by (VALID ((have_tac (ALL_TAC THEN (case THEN (move ["ineq"])) THEN (case THEN ((move ["df"]) THEN (move ["dg"])))) (`interval_arith x int /\ nth_diff_strong_int 2 int f /\ nth_diff_strong_int 2 int g`)))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THEN "int_def")(GSYM_THEN (new_rewrite [] [])))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN ((USE_THM_THEN CONST_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))))));; +refine (by (VALID ((((split_tac) THEN (move ["y"])) THEN ((((USE_THM_THEN interval_arith)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_ANTISYM)(new_rewrite [] []))) THEN (DISCH_THEN(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN nth_derivative_mul)(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "dg")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(ISPEC_THEN (`2`) thm_tac))(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th))) MP_TAC) THEN ALL_TAC) THEN (((USE_THM_THEN leqnn)(new_rewrite [] [])) THEN (DISCH_THEN(new_rewrite [] [])) THEN ((TRY done_tac)))))));; +refine (by (VALID ((((USE_THM_THEN TWO)(new_rewrite [1] [])) THEN ((USE_THM_THEN ONE)(new_rewrite [1] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL SUM_CLAUSES_NUMSEG))(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN (ARITH_RULE `!n. 0 <= SUC n`))(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN ONE)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN TWO)(GSYM_THEN (new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN subnn)(new_rewrite [] [])) THEN ((USE_THM_THEN subn0)(new_rewrite [] [])) THEN ((USE_THM_THEN (ARITH_RULE `2 - 1 = 1`))(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_derivative0)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_derivative1)(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THM_THEN binom)(new_rewrite [] [])) THEN ((USE_THM_THEN BINOM_1)(new_rewrite [] [])) THEN ((USE_THM_THEN BINOM_REFL)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN REAL_MUL_LID)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_ADD_ASSOC)(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_mul = end_section_proof();; +(start_section_proof ["f";"g";"x"](`~(g x = &0) ==> + nth_diff_strong 2 f x ==> + nth_diff_strong 2 g x ==> + nth_derivative 2 (\x. f x / g x) x = + ((nth_derivative 2 f x * g x - f x * nth_derivative 2 g x) * g x - + &2 * derivative g x * (derivative f x * g x - f x * derivative g x)) / (g x pow 3)`));; +refine (by (VALID ((BETA_TAC THEN (move ["gn0"]) THEN (move ["diff_f"]) THEN (move ["diff_g"])))));; +refine (by (VALID (((set_tac "dg" (`derivative g x`)) THEN (set_tac "df" (`derivative f x`))))));; +refine (by (VALID (((set_tac "ddg" (`nth_derivative 2 g x`)) THEN (set_tac "ddf" (`nth_derivative 2 f x`))))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN real_div)(new_rewrite [] []))) THEN ((USE_THM_THEN second_derivative_mul)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THM_THEN second_derivative_compose_inv)(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THM_THEN diff2_compose_inv)(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID (((USE_THM_THEN derivative_compose_inv)(new_rewrite [] [])))));; +refine (by (VALID (((((USE_THEN "diff_g")MP_TAC) THEN (clear_assumption "diff_g") THEN BETA_TAC) THEN (((USE_THM_THEN nth_diff_strong2_eq)(new_rewrite [] [])) THEN ALL_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["open_s"])) THEN (case THEN (move ["xs"])) THEN (DISCH_THEN(new_rewrite [] [])) THEN ((TRY done_tac))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THEN "ddf_def")(new_rewrite [] [])) THEN ((USE_THEN "ddg_def")(new_rewrite [] [])) THEN ((USE_THEN "df_def")(new_rewrite [] [])) THEN ((USE_THEN "dg_def")(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN real_div)(new_rewrite [] [])))))));; +refine (by (VALID ((set_tac "lhs" (`_1 + _2`)))));; +refine (by (VALID (((USE_THM_THEN (REAL_RING `!f g x. ((ddf * g x - f x * ddg) * g x - &2 * dg * (df * g x - f x * dg)) * + inv (g x pow 3) = + f x * (&2 * dg pow 2 - ddg * g x) * inv (g x pow 3) + + &2 * df * --(g x * inv (g x pow 3)) * dg + + ddf * (g x * g x * inv (g x pow 3))`))(new_rewrite [] [])))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`g x * inv (g x pow 3) = inv (g x pow 2)`)))));; +refine (by (VALID (((((USE_THM_THEN (ARITH_RULE `3 = SUC 2`))(new_rewrite [] [])) THEN ((USE_THM_THEN real_powS)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_INV_MUL)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_ASSOC)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_RINV)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN REAL_MUL_LID)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((have_tac (DISCH_THEN(new_rewrite [] [])) (`g x * inv (g x pow 2) = inv (g x)`)))));; +refine (by (VALID (((((USE_THM_THEN TWO)(new_rewrite [] [])) THEN ((USE_THM_THEN real_powS)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_INV_MUL)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_ASSOC)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_MUL_RINV)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN REAL_MUL_LID)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_POW_1)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((fun thm_tac -> (USE_THM_THEN REAL_POW_2)(ISPEC_THEN (`g x`) thm_tac))(new_rewrite [] [])) THEN ((USE_THEN "lhs_def")(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_div = end_section_proof();; +(start_section_proof ["f";"g";"x"](`~(g x = &0) ==> nth_diff_strong 2 f x ==> nth_diff_strong 2 g x ==> + nth_diff_strong 2 (\x. f x / g x) x`));; +refine (by (VALID (((BETA_TAC THEN (move ["gn0"]) THEN (move ["df0"]) THEN (move ["dg0"])) THEN (set_tac "int" (`(x,x)`))))));; +refine (by (VALID ((have_tac (ALL_TAC THEN (case THEN (move ["ineq"])) THEN (case THEN ((move ["df"]) THEN (move ["dg"])))) (`interval_arith x int /\ nth_diff_strong_int 2 int f /\ nth_diff_strong_int 2 int g`)))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THEN "int_def")(GSYM_THEN (new_rewrite [] [])))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN ((USE_THM_THEN CONST_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))))));; +refine (by (VALID ((((split_tac) THEN (move ["y"])) THEN ((((USE_THM_THEN interval_arith)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_ANTISYM)(new_rewrite [] []))) THEN (DISCH_THEN(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN nth_diff_mul)(ISPEC_THEN (`2`) thm_tac))(ISPEC_THEN (mk_var("int",mk_type("prod",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (mk_var("f",mk_type("fun",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(ISPEC_THEN (`\x. inv (g x)`) thm_tac))(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th))) MP_TAC) THEN ALL_TAC))));; +refine (by (VALID ((((repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN real_div)(new_rewrite [] []))) THEN (DISCH_THEN(new_rewrite [] []))) THEN ((split_tac) THEN ((TRY done_tac)) THEN (move ["y"]))))));; +refine (by (VALID (((((USE_THEN "int_def")(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN interval_arith)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_ANTISYM)(new_rewrite [] []))) THEN (DISCH_THEN(GSYM_THEN (new_rewrite [] [])))))));; +refine (by (VALID ((((USE_THM_THEN diff2_compose_inv)(new_rewrite [] [])) THEN (done_tac)))));; +let diff2_div = end_section_proof();; +(start_section_proof ["f";"c";"x"](`nth_diff_strong 2 f x ==> + nth_derivative 2 (\x. c * f x) x = c * nth_derivative 2 f x`));; +refine (by (VALID (((BETA_TAC THEN (move ["df0"])) THEN (set_tac "int" (`(x,x)`))))));; +refine (by (VALID ((have_tac (ALL_TAC THEN (case THEN (move ["ineq"])) THEN (move ["df"])) (`interval_arith x int /\ nth_diff_strong_int 2 int f`)))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THEN "int_def")(GSYM_THEN (new_rewrite [] [])))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN ((USE_THM_THEN CONST_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))))));; +refine (by (VALID (((BETA_TAC THEN (move ["y"])) THEN ((((USE_THM_THEN interval_arith)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_ANTISYM)(new_rewrite [] []))) THEN (DISCH_THEN(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN nth_derivative_scale)(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(ISPEC_THEN (mk_var("c",mk_type("real",[]))) thm_tac))(ISPEC_THEN (`2`) thm_tac))(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th))) MP_TAC) THEN ALL_TAC) THEN (((USE_THM_THEN leqnn)(new_rewrite [] [])) THEN (DISCH_THEN(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_scale = end_section_proof();; +(start_section_proof ["f";"g";"x"](`nth_diff_strong 2 f x ==> + nth_diff_strong 2 g x ==> + nth_derivative 2 (\x. f x + g x) x = nth_derivative 2 f x + nth_derivative 2 g x`));; +refine (by (VALID (((BETA_TAC THEN (move ["df0"]) THEN (move ["dg0"])) THEN (set_tac "int" (`(x,x)`))))));; +refine (by (VALID ((have_tac (ALL_TAC THEN (case THEN (move ["ineq"])) THEN (case THEN ((move ["df"]) THEN (move ["dg"])))) (`interval_arith x int /\ nth_diff_strong_int 2 int f /\ nth_diff_strong_int 2 int g`)))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THEN "int_def")(GSYM_THEN (new_rewrite [] [])))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN ((USE_THM_THEN CONST_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))))));; +refine (by (VALID ((((split_tac) THEN (move ["y"])) THEN ((((USE_THM_THEN interval_arith)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_ANTISYM)(new_rewrite [] []))) THEN (DISCH_THEN(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN nth_derivative_add)(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "dg")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(ISPEC_THEN (`2`) thm_tac))(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th))) MP_TAC) THEN ALL_TAC) THEN (((USE_THM_THEN leqnn)(new_rewrite [] [])) THEN (DISCH_THEN(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_add = end_section_proof();; +(start_section_proof ["f";"g";"x"](`nth_diff_strong 2 f x ==> + nth_diff_strong 2 g x ==> + nth_derivative 2 (\x. f x - g x) x = nth_derivative 2 f x - nth_derivative 2 g x`));; +refine (by (VALID (((BETA_TAC THEN (move ["df0"]) THEN (move ["dg0"])) THEN (set_tac "int" (`(x,x)`))))));; +refine (by (VALID ((have_tac (ALL_TAC THEN (case THEN (move ["ineq"])) THEN (case THEN ((move ["df"]) THEN (move ["dg"])))) (`interval_arith x int /\ nth_diff_strong_int 2 int f /\ nth_diff_strong_int 2 int g`)))));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THEN "int_def")(GSYM_THEN (new_rewrite [] [])))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN ((USE_THM_THEN CONST_INTERVAL)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))))));; +refine (by (VALID ((((split_tac) THEN (move ["y"])) THEN ((((USE_THM_THEN interval_arith)(new_rewrite [] [])) THEN ((USE_THM_THEN REAL_LE_ANTISYM)(new_rewrite [] []))) THEN (DISCH_THEN(GSYM_THEN (new_rewrite [] [])))) THEN (done_tac)))));; +refine (by (VALID (((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN nth_derivative_sub)(fun fst_th ->(USE_THEN "df")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "dg")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(ISPEC_THEN (`2`) thm_tac))(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th))) MP_TAC) THEN ALL_TAC) THEN (((USE_THM_THEN leqnn)(new_rewrite [] [])) THEN (DISCH_THEN(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_sub = end_section_proof();; +(start_section_proof ["f";"g";"int";"g_bounds";"dd_bounds"](`nth_diff_strong_int 2 int g ==> + bounded_on_int g int g_bounds ==> + nth_diff_strong_int 2 g_bounds f ==> + bounded_on_int (\x. nth_derivative 2 f (g x) * derivative g x pow 2 + + derivative f (g x) * nth_derivative 2 g x) int dd_bounds ==> + has_bounded_second_derivative (\x. f (g x)) int dd_bounds`));; +refine (by (VALID ((((USE_THM_THEN has_bounded_second_derivative)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN bounded_on_int)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN (simp_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["dg"]) THEN (move ["g_bounded"]) THEN (move ["df"]) THEN (move ["bounded"])) THEN ((split_tac) THEN (move ["x"]) THEN (move ["ineq"]))))));; +refine (by (VALID (((((USE_THM_THEN diff2_compose)(new_rewrite [] [])) THEN ((USE_THEN "dg")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "df")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "g_bounded")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN second_derivative_compose)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "dg")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "g_bounded")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THEN "bounded")(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_compose_bounds = end_section_proof();; +(start_section_proof ["dd_bounds"](`bounded_on_int (\x. (-- &2 * x) * inv(&1 + x pow 2) pow 2) int dd_bounds ==> + has_bounded_second_derivative atn int dd_bounds`));; +refine (by (VALID (((((USE_THM_THEN bounded_on_int)(new_rewrite [] [])) THEN ((USE_THM_THEN has_bounded_second_derivative)(new_rewrite [] []))) THEN (move ["ineq"])))));; +refine (by (VALID (((THENL_LAST) (split_tac) ((((USE_THM_THEN nth_derivative2)(new_rewrite [] [])) THEN ((USE_THM_THEN second_derivative_atn)(new_rewrite [] [])) THEN ((USE_THM_THEN bounded_on_int)(new_rewrite [] []))) THEN (done_tac))))));; +refine (by (VALID (((((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] [])) THEN ((USE_THM_THEN diff2_atn)(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_atn_bounds = end_section_proof();; +(start_section_proof ["f";"dd_bounds"](`nth_diff_strong_int 2 int f ==> + bounded_on_int (\x. (nth_derivative 2 f x * (&1 + f x * f x) - &2 * f x * derivative f x pow 2) / + (&1 + f x * f x) pow 2) int dd_bounds ==> + has_bounded_second_derivative (\x. atn (f x)) int dd_bounds`));; +refine (by (VALID ((((((USE_THM_THEN has_bounded_second_derivative)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN bounded_on_int)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN (simp_tac)) THEN (move ["df"]) THEN (move ["bounded"])) THEN ((split_tac) THEN (move ["x"]) THEN (move ["ineq"]))))));; +refine (by (VALID (((((USE_THM_THEN diff2_compose_atn)(new_rewrite [] [])) THEN ((USE_THEN "df")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN second_derivative_compose_atn)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THEN "bounded")(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_compose_atn_bounds = end_section_proof();; +(start_section_proof ["dd_bounds"](`interval_not_zero int ==> + bounded_on_int (\x. &2 * inv (x pow 3)) int dd_bounds ==> + has_bounded_second_derivative inv int dd_bounds`));; +refine (by (VALID ((((((USE_THM_THEN has_bounded_second_derivative)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN bounded_on_int)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN (simp_tac)) THEN (move ["int0"]) THEN (move ["bounded"])) THEN ((split_tac) THEN (move ["x"]) THEN (move ["ineq"]))))));; +refine (by (VALID (((((USE_THM_THEN diff2_inv)(new_rewrite [] [])) THEN ((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN interval_arith_not_zero)(ISPEC_THEN (mk_var("x",mk_type("real",[]))) thm_tac))(ISPEC_THEN (mk_var("int",mk_type("prod",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN second_derivative_inv)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN interval_arith_not_zero)(ISPEC_THEN (mk_var("x",mk_type("real",[]))) thm_tac))(ISPEC_THEN (mk_var("int",mk_type("prod",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THEN "bounded")(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_inv_bounds = end_section_proof();; +(start_section_proof ["f";"f_bounds";"dd_bounds"](`bounded_on_int f int f_bounds ==> interval_not_zero f_bounds ==> + nth_diff_strong_int 2 int f ==> + bounded_on_int (\x. (&2 * derivative f x pow 2 - nth_derivative 2 f x * f x) / f x pow 3) + int dd_bounds ==> + has_bounded_second_derivative (\x. inv (f x)) int dd_bounds`));; +refine (by (VALID (((((USE_THM_THEN has_bounded_second_derivative)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN bounded_on_int)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN (simp_tac)) THEN (move ["f_bounded"]) THEN (move ["f0"]) THEN (move ["df"]) THEN (move ["bounded"])))));; +refine (by (VALID ((have_tac (move ["fn0"]) (`!x. interval_arith x int ==> ~(f x = &0)`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["x"]) THEN (move ["ineq"])) THEN (((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN interval_arith_not_zero)(ISPEC_THEN (`f x`) thm_tac))(ISPEC_THEN (mk_var("f_bounds",mk_type("prod",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "f_bounded")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((split_tac) THEN (move ["x"]) THEN (move ["ineq"])))));; +refine (by (VALID (((((USE_THM_THEN diff2_compose_inv)(new_rewrite [] [])) THEN ((USE_THEN "df")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "fn0")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN second_derivative_compose_inv)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "fn0")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THEN "bounded")(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_compose_inv_bounds = end_section_proof();; +(start_section_proof ["dd_bounds"](`interval_pos int ==> + bounded_on_int (\x. --inv (&4 * sqrt (x pow 3))) int dd_bounds ==> + has_bounded_second_derivative sqrt int dd_bounds`));; +refine (by (VALID (((((USE_THM_THEN has_bounded_second_derivative)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN bounded_on_int)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN (simp_tac)) THEN (move ["int_pos"]) THEN (move ["bounded"])))));; +refine (by (VALID (((split_tac) THEN (move ["x"]) THEN (move ["ineq"])))));; +refine (by (VALID (((((USE_THM_THEN diff2_sqrt)(new_rewrite [] [])) THEN ((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN interval_arith_pos)(ISPEC_THEN (mk_var("x",mk_type("real",[]))) thm_tac))(ISPEC_THEN (mk_var("int",mk_type("prod",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN second_derivative_sqrt)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN interval_arith_pos)(ISPEC_THEN (mk_var("x",mk_type("real",[]))) thm_tac))(ISPEC_THEN (mk_var("int",mk_type("prod",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THEN "bounded")(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_sqrt_bounds = end_section_proof();; +(start_section_proof ["f";"f_bounds";"dd_bounds"](`bounded_on_int f int f_bounds ==> interval_pos f_bounds ==> + nth_diff_strong_int 2 int f ==> + bounded_on_int (\x. (&2 * nth_derivative 2 f x * f x - derivative f x pow 2) / + (&4 * sqrt (f x pow 3))) + int dd_bounds ==> + has_bounded_second_derivative (\x. sqrt (f x)) int dd_bounds`));; +refine (by (VALID (((((USE_THM_THEN has_bounded_second_derivative)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN bounded_on_int)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN (simp_tac)) THEN (move ["f_bounded"]) THEN (move ["f_int"]) THEN (move ["df"]) THEN (move ["bounded"])))));; +refine (by (VALID ((have_tac (move ["f_pos"]) (`!x. interval_arith x int ==> &0 < f x`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["x"]) THEN (move ["ineq"])) THEN (((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN interval_arith_pos)(ISPEC_THEN (`f x`) thm_tac))(ISPEC_THEN (mk_var("f_bounds",mk_type("prod",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "f_bounded")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((split_tac) THEN (move ["x"]) THEN (move ["ineq"])))));; +refine (by (VALID (((((USE_THM_THEN diff2_compose_sqrt)(new_rewrite [] [])) THEN ((USE_THEN "df")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "f_pos")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN second_derivative_compose_sqrt)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "f_pos")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THEN "bounded")(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_compose_sqrt_bounds = end_section_proof();; +(start_section_proof ["dd_bounds"](`iabs int < &1 ==> + bounded_on_int (\x. --(x / sqrt ((&1 - x * x) pow 3))) int dd_bounds ==> + has_bounded_second_derivative acs int dd_bounds`));; +refine (by (VALID (((((USE_THM_THEN has_bounded_second_derivative)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN bounded_on_int)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN (simp_tac)) THEN (move ["int_abs"]) THEN (move ["bounded"])))));; +refine (by (VALID (((split_tac) THEN (move ["x"]) THEN (move ["ineq"])))));; +refine (by (VALID (((((USE_THM_THEN diff2_acs)(new_rewrite [] [])) THEN ((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN interval_arith_abs)(ISPEC_THEN (mk_var("x",mk_type("real",[]))) thm_tac))(ISPEC_THEN (mk_var("int",mk_type("prod",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN second_derivative_acs)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN interval_arith_abs)(ISPEC_THEN (mk_var("x",mk_type("real",[]))) thm_tac))(ISPEC_THEN (mk_var("int",mk_type("prod",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THEN "bounded")(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_acs_bounds = end_section_proof();; +(start_section_proof ["f";"f_bounds";"dd_bounds"](`bounded_on_int f int f_bounds ==> iabs f_bounds < &1 ==> + nth_diff_strong_int 2 int f ==> + bounded_on_int (\x. --((nth_derivative 2 f x * (&1 - f x * f x) + f x * derivative f x pow 2) / + sqrt ((&1 - f x * f x) pow 3))) int dd_bounds ==> + has_bounded_second_derivative (\x. acs (f x)) int dd_bounds`));; +refine (by (VALID (((((USE_THM_THEN has_bounded_second_derivative)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN bounded_on_int)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN (simp_tac)) THEN (move ["f_bounded"]) THEN (move ["f_abs"]) THEN (move ["df"]) THEN (move ["bounded"])))));; +refine (by (VALID ((have_tac (move ["fabs"]) (`!x. interval_arith x int ==> abs (f x) < &1`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["x"]) THEN (move ["ineq"])) THEN (((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN interval_arith_abs)(ISPEC_THEN (`f x`) thm_tac))(ISPEC_THEN (mk_var("f_bounds",mk_type("prod",[mk_type("real",[]);mk_type("real",[])]))) thm_tac))(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "f_bounded")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((split_tac) THEN (move ["x"]) THEN (move ["ineq"])))));; +refine (by (VALID (((((USE_THM_THEN diff2_compose_acs)(new_rewrite [] [])) THEN ((USE_THEN "df")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "fabs")(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN second_derivative_compose_acs)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "fabs")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THEN "bounded")(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_compose_acs_bounds = end_section_proof();; +(start_section_proof ["c";"f";"dd_bounds"](`nth_diff_strong_int 2 int f ==> + bounded_on_int (\x. c * nth_derivative 2 f x) int dd_bounds ==> + has_bounded_second_derivative (\x. c * f x) int dd_bounds`));; +refine (by (VALID (((((USE_THM_THEN has_bounded_second_derivative)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN bounded_on_int)(new_rewrite [] [])))) THEN (simp_tac) THEN (move ["df"]) THEN (move ["b"])))));; +refine (by (VALID (((((USE_THM_THEN nth_diff_scale)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["x"]) THEN (move ["ineq"])))));; +refine (by (VALID ((((USE_THM_THEN second_derivative_scale)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "b")(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID (((((USE_THEN "df")MP_TAC) THEN (clear_assumption "df") THEN BETA_TAC) THEN ((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] [])) THEN (exact_tac) THEN (done_tac)))));; +let second_derivative_scale_bounds = end_section_proof();; +(start_section_proof ["f";"g";"dd_bounds"](`nth_diff_strong_int 2 int f ==> + nth_diff_strong_int 2 int g ==> + bounded_on_int (\x. nth_derivative 2 f x + nth_derivative 2 g x) int dd_bounds ==> + has_bounded_second_derivative (\x. f x + g x) int dd_bounds`));; +refine (by (VALID (((((USE_THM_THEN has_bounded_second_derivative)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN bounded_on_int)(new_rewrite [] [])))) THEN (simp_tac) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["b"])))));; +refine (by (VALID (((((USE_THM_THEN nth_diff_add)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["x"]) THEN (move ["ineq"])))));; +refine (by (VALID ((((USE_THM_THEN second_derivative_add)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "b")(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID (((((USE_THEN "dg")MP_TAC) THEN (clear_assumption "dg") THEN ((USE_THEN "df")MP_TAC) THEN (clear_assumption "df") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN (DISCH_THEN(new_rewrite [] [])) THEN ((TRY done_tac)) THEN (DISCH_THEN(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_add_bounds = end_section_proof();; +(start_section_proof ["f";"g";"dd_bounds"](`nth_diff_strong_int 2 int f ==> + nth_diff_strong_int 2 int g ==> + bounded_on_int (\x. nth_derivative 2 f x - nth_derivative 2 g x) int dd_bounds ==> + has_bounded_second_derivative (\x. f x - g x) int dd_bounds`));; +refine (by (VALID (((((USE_THM_THEN has_bounded_second_derivative)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN bounded_on_int)(new_rewrite [] [])))) THEN (simp_tac) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["b"])))));; +refine (by (VALID (((((USE_THM_THEN nth_diff_sub)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["x"]) THEN (move ["ineq"])))));; +refine (by (VALID ((((USE_THM_THEN second_derivative_sub)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "b")(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID (((((USE_THEN "dg")MP_TAC) THEN (clear_assumption "dg") THEN ((USE_THEN "df")MP_TAC) THEN (clear_assumption "df") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN (DISCH_THEN(new_rewrite [] [])) THEN ((TRY done_tac)) THEN (DISCH_THEN(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_sub_bounds = end_section_proof();; +(start_section_proof ["f";"g";"dd_bounds"](`nth_diff_strong_int 2 int f ==> + nth_diff_strong_int 2 int g ==> + bounded_on_int (\x. f x * nth_derivative 2 g x + &2 * derivative f x * derivative g x + + nth_derivative 2 f x * g x) int dd_bounds ==> + has_bounded_second_derivative (\x. f x * g x) int dd_bounds`));; +refine (by (VALID (((((USE_THM_THEN has_bounded_second_derivative)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN bounded_on_int)(new_rewrite [] [])))) THEN (simp_tac) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["b"])))));; +refine (by (VALID (((((USE_THM_THEN nth_diff_mul)(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["x"]) THEN (move ["ineq"])))));; +refine (by (VALID ((((USE_THM_THEN second_derivative_mul)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "b")(new_rewrite [] []))) THEN ((TRY done_tac))))));; +refine (by (VALID (((((USE_THEN "dg")MP_TAC) THEN (clear_assumption "dg") THEN ((USE_THEN "df")MP_TAC) THEN (clear_assumption "df") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN (DISCH_THEN(new_rewrite [] [])) THEN ((TRY done_tac)) THEN (DISCH_THEN(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_mul_bounds = end_section_proof();; +(start_section_proof ["f";"g";"g_bounds";"dd_bounds"](`bounded_on_int g int g_bounds ==> interval_not_zero g_bounds ==> + nth_diff_strong_int 2 int f ==> + nth_diff_strong_int 2 int g ==> + bounded_on_int (\x. ((nth_derivative 2 f x * g x - f x * nth_derivative 2 g x) * g x - + &2 * derivative g x * (derivative f x * g x - f x * derivative g x)) / g x pow 3) int dd_bounds ==> + has_bounded_second_derivative (\x. f x / g x) int dd_bounds`));; +refine (by (VALID (((((USE_THM_THEN has_bounded_second_derivative)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN bounded_on_int)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] [])))) THEN (move ["bg"]) THEN (move ["gn0"]) THEN (simp_tac) THEN (move ["df"]) THEN (move ["dg"]) THEN (move ["b"])))));; +refine (by (VALID ((have_tac (move ["g0"]) (`!x. interval_arith x int ==> ~(g x = &0)`)))));; +refine (by (VALID (((BETA_TAC THEN (move ["x"]) THEN (move ["ineq"])) THEN (((USE_THM_THEN interval_arith_not_zero)MP_TAC) THEN (clear_assumption "interval_arith_not_zero") THEN (DISCH_THEN apply_tac)) THEN (exists_tac (`g_bounds`)) THEN ((USE_THEN "bg")(new_rewrite [] [])) THEN (done_tac)))));; +refine (by (VALID (((THENL_FIRST) ((split_tac) THEN (move ["x"]) THEN (move ["ineq"])) ((((USE_THM_THEN diff2_div)(new_rewrite [] [])) THEN ((USE_THEN "g0")(new_rewrite [] [])) THEN ((TRY done_tac)) THEN ((USE_THEN "df")(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "dg")(new_rewrite [] [])))) THEN (done_tac))))));; +refine (by (VALID (((((USE_THM_THEN second_derivative_div)(new_rewrite [] [])) THEN repeat_tactic 0 10 (((USE_THEN "g0")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "df")(new_rewrite [] []))) THEN repeat_tactic 0 10 (((USE_THEN "dg")(new_rewrite [] []))) THEN ((TRY done_tac)) THEN ((USE_THEN "b")(new_rewrite [] []))) THEN (done_tac)))));; +let second_derivative_div_bounds = end_section_proof();; +let second_derivative_div_bounds = finalize_theorem second_derivative_div_bounds;; +let second_derivative_mul_bounds = finalize_theorem second_derivative_mul_bounds;; +let second_derivative_sub_bounds = finalize_theorem second_derivative_sub_bounds;; +let second_derivative_add_bounds = finalize_theorem second_derivative_add_bounds;; +let second_derivative_scale_bounds = finalize_theorem second_derivative_scale_bounds;; +let second_derivative_compose_acs_bounds = finalize_theorem second_derivative_compose_acs_bounds;; +let second_derivative_acs_bounds = finalize_theorem second_derivative_acs_bounds;; +let second_derivative_compose_sqrt_bounds = finalize_theorem second_derivative_compose_sqrt_bounds;; +let second_derivative_sqrt_bounds = finalize_theorem second_derivative_sqrt_bounds;; +let second_derivative_compose_inv_bounds = finalize_theorem second_derivative_compose_inv_bounds;; +let second_derivative_inv_bounds = finalize_theorem second_derivative_inv_bounds;; +let second_derivative_compose_atn_bounds = finalize_theorem second_derivative_compose_atn_bounds;; +let second_derivative_atn_bounds = finalize_theorem second_derivative_atn_bounds;; +let second_derivative_compose_bounds = finalize_theorem second_derivative_compose_bounds;; +let second_derivative_sub = finalize_theorem second_derivative_sub;; +let second_derivative_add = finalize_theorem second_derivative_add;; +let second_derivative_scale = finalize_theorem second_derivative_scale;; +let diff2_div = finalize_theorem diff2_div;; +let second_derivative_div = finalize_theorem second_derivative_div;; +let second_derivative_mul = finalize_theorem second_derivative_mul;; +let diff2_compose_acs = finalize_theorem diff2_compose_acs;; +let diff2_compose_sqrt = finalize_theorem diff2_compose_sqrt;; +let diff2_compose_inv = finalize_theorem diff2_compose_inv;; +let diff2_compose_atn = finalize_theorem diff2_compose_atn;; +let second_derivative_compose_acs = finalize_theorem second_derivative_compose_acs;; +let second_derivative_compose_sqrt = finalize_theorem second_derivative_compose_sqrt;; +let second_derivative_compose_inv = finalize_theorem second_derivative_compose_inv;; +let second_derivative_compose_atn = finalize_theorem second_derivative_compose_atn;; +let continuous_lt_exists_open = finalize_theorem continuous_lt_exists_open;; +let continuous_gt_exists_open = finalize_theorem continuous_gt_exists_open;; +let continuous_not0_exists_open = finalize_theorem continuous_not0_exists_open;; +let diff2_compose = finalize_theorem diff2_compose;; +let second_derivative_compose = finalize_theorem second_derivative_compose;; +let REAL_CONTINUOUS_OPEN_PREIMAGE = finalize_theorem REAL_CONTINUOUS_OPEN_PREIMAGE;; +let diff2_acs = finalize_theorem diff2_acs;; +let second_derivative_acs = finalize_theorem second_derivative_acs;; +let real_powS = finalize_theorem real_powS;; +let diff2_sqrt = finalize_theorem diff2_sqrt;; +let second_derivative_sqrt = finalize_theorem second_derivative_sqrt;; +let SQRT_POW = finalize_theorem SQRT_POW;; +let diff2_inv = finalize_theorem diff2_inv;; +let second_derivative_inv = finalize_theorem second_derivative_inv;; +let diff2_atn = finalize_theorem diff2_atn;; +let second_derivative_atn = finalize_theorem second_derivative_atn;; +let second_derivative_atn_eq = finalize_theorem second_derivative_atn_eq;; +let lin_approx_compose = finalize_theorem lin_approx_compose;; +let nth_diff_strong2_eq = finalize_theorem nth_diff_strong2_eq;; +let nth_diff_strong2_eq_alt = finalize_theorem nth_diff_strong2_eq_alt;; +(end_section "SecondDerivativeBound");; +(begin_section "TaylorArith");; +let cell_domain = new_definition `cell_domain x y z w <=> + x <= y /\ y <= z /\ y - x <= w /\ z - y <= w`;; +(start_section_proof ["x";"y";"z";"w"](`cell_domain x y z w ==> + taylor_interval (\x. x) x y z w (y, y) (&1, &1) (&0, &0)`));; +refine (by (VALID ((((USE_THM_THEN cell_domain)(new_rewrite [] [])) THEN (move ["ineqs"])))));; +refine (by (VALID ((((USE_THM_THEN taylor_interval)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THEN "ineqs")(new_rewrite [] []))) THEN ((USE_THM_THEN lin_approx_x)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID (((USE_THM_THEN has_bounded_second_derivative)(new_rewrite [] [])))));; +refine (by (VALID (((((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_diff_strong)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_differentiable_on)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_differentiable_eq)(new_rewrite [] []))) THEN (split_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["p"]) THEN (move ["_"])) THEN (exists_tac (`(:real)`)) THEN ((((USE_THM_THEN REAL_OPEN_UNIV)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_UNIV)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["q"]) THEN (simp_tac))))));; +refine (by (VALID (((((USE_THM_THEN REAL_CONTINUOUS_AT_ID)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["i"])))));; +refine (by (VALID ((((USE_THM_THEN (ARITH_RULE `i < 2 <=> i = 0 \/ i = 1`))(new_rewrite [] [])) THEN (case THEN (DISCH_THEN(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THM_THEN nth_derivative0)(new_rewrite [] [])) THEN ((USE_THM_THEN ONE)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN nth_derivative1)(new_rewrite [] [])) THEN ((USE_THM_THEN derivative_x)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN HAS_REAL_DERIVATIVE_ID)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN nth_derivative1)(new_rewrite [] [])) THEN ((USE_THM_THEN TWO)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN nth_derivative2)(new_rewrite [] [])) THEN ((USE_THM_THEN derivative_x)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN derivative_const)(new_rewrite [] [])) THEN (simp_tac)))));; +refine (by (VALID ((((USE_THM_THEN HAS_REAL_DERIVATIVE_CONST)(new_rewrite [] [])) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN nth_derivative2)(new_rewrite [] [])) THEN ((USE_THM_THEN derivative_x)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN derivative_const)(new_rewrite [] [])) THEN ((USE_THM_THEN bounded_on_int)(new_rewrite [] [])) THEN (simp_tac)))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN interval_arith)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] []))) THEN (done_tac)))));; +let taylor_x = end_section_proof();; +(start_section_proof ["c";"x";"y";"z";"w"](`cell_domain x y z w ==> + taylor_interval (\x. c) x y z w (c, c) (&0, &0) (&0, &0)`));; +refine (by (VALID ((((USE_THM_THEN cell_domain)(new_rewrite [] [])) THEN (move ["ineqs"])))));; +refine (by (VALID ((((USE_THM_THEN taylor_interval)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THEN "ineqs")(new_rewrite [] []))) THEN ((USE_THM_THEN lin_approx_const)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))))));; +refine (by (VALID (((USE_THM_THEN has_bounded_second_derivative)(new_rewrite [] [])))));; +refine (by (VALID (((((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_diff_strong)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_differentiable_on)(new_rewrite [] [])) THEN ((USE_THM_THEN nth_differentiable_eq)(new_rewrite [] []))) THEN (split_tac)))));; +refine (by (VALID (((BETA_TAC THEN (move ["p"]) THEN (move ["_"])) THEN (exists_tac (`(:real)`)) THEN ((((USE_THM_THEN REAL_OPEN_UNIV)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN IN_UNIV)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN andTb)(new_rewrite [] [])))) THEN (move ["q"]) THEN (simp_tac))))));; +refine (by (VALID (((((USE_THM_THEN REAL_CONTINUOUS_CONST)(new_rewrite [] [])) THEN ((USE_THM_THEN andTb)(new_rewrite [] []))) THEN (move ["i"])))));; +refine (by (VALID ((((USE_THM_THEN (ARITH_RULE `i < 2 <=> i = 0 \/ i = 1`))(new_rewrite [] [])) THEN (case THEN (DISCH_THEN(new_rewrite [] [])))))));; +refine (by (VALID (((((USE_THM_THEN nth_derivative0)(new_rewrite [] [])) THEN ((USE_THM_THEN ONE)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN nth_derivative1)(new_rewrite [] [])) THEN ((USE_THM_THEN derivative_const)(new_rewrite [] [])) THEN (simp_tac) THEN ((USE_THM_THEN HAS_REAL_DERIVATIVE_CONST)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID (((((USE_THM_THEN nth_derivative1)(new_rewrite [] [])) THEN ((USE_THM_THEN TWO)(GSYM_THEN (new_rewrite [] []))) THEN ((USE_THM_THEN nth_derivative2)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN derivative_const)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN HAS_REAL_DERIVATIVE_CONST)(new_rewrite [] []))) THEN (done_tac)))));; +refine (by (VALID ((((USE_THM_THEN nth_derivative2)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN derivative_const)(new_rewrite [] []))) THEN (simp_tac) THEN ((USE_THM_THEN bounded_on_int)(new_rewrite [] [])) THEN (simp_tac)))));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN interval_arith)(new_rewrite [] []))) THEN ((USE_THM_THEN REAL_LE_REFL)(new_rewrite [] []))) THEN (done_tac)))));; +let taylor_const = end_section_proof();; +(add_section_var (mk_var ("f", (`:real->real`))));; +(add_section_var (mk_var ("x", (`:real`))); add_section_var (mk_var ("y", (`:real`))); add_section_var (mk_var ("z", (`:real`))); add_section_var (mk_var ("w", (`:real`))));; +(add_section_var (mk_var ("f_bounds", (`:real#real`))); add_section_var (mk_var ("df_bounds", (`:real#real`))); add_section_var (mk_var ("dd_bounds", (`:real#real`))));; +(add_section_var (mk_var ("f_lo", (`:real`))); add_section_var (mk_var ("f_hi", (`:real`))); add_section_var (mk_var ("df_lo", (`:real`))); add_section_var (mk_var ("df_hi", (`:real`))));; +(start_section_proof ["df";"dd";"lo";"hi";"t"](`taylor_interval f x y z w (f_lo, f_hi) df_bounds dd_bounds ==> + iabs df_bounds = df ==> + iabs dd_bounds = dd ==> + w * (df + w * dd * inv(&2)) <= t ==> + f_hi + t <= hi ==> lo <= f_lo - t ==> + bounded_on_int f (x, z) (lo, hi)`));; +refine (by (VALID ((BETA_TAC THEN (move ["taylor_f"]) THEN (move ["iabs_df"]) THEN (move ["iabs_dd"]) THEN (move ["t_ineq"]) THEN (move ["hi_ineq"]) THEN (move ["lo_ineq"])))));; +refine (by (VALID (((((USE_THM_THEN bounded_on_int)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN interval_arith)(new_rewrite [] [])))) THEN (move ["p"]) THEN (move ["ineq"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN taylor_upper_bound)(fun fst_th ->(fun thm_tac -> (USE_THM_THEN EQ_SYM)(fun fst_th ->(USE_THEN "iabs_dd")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "taylor_f")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN ((fun thm_tac -> (fun thm_tac -> (USE_THM_THEN taylor_lower_bound)(fun fst_th ->(fun thm_tac -> (USE_THM_THEN EQ_SYM)(fun fst_th ->(USE_THEN "iabs_dd")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "taylor_f")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC))));; +refine (by (VALID ((((simp_tac) THEN repeat_tactic 1 9 (((USE_THM_THEN real_div)(new_rewrite [] []))) THEN ((USE_THEN "iabs_df")(new_rewrite [] []))) THEN ((fun thm_tac -> DISCH_THEN (fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN (move ["ineq1"]) THEN ((fun thm_tac -> DISCH_THEN (fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN (move ["ineq2"])))));; +refine (by (VALID (((((USE_THEN "t_ineq")MP_TAC) THEN (clear_assumption "t_ineq") THEN ((USE_THEN "hi_ineq")MP_TAC) THEN (clear_assumption "hi_ineq") THEN ((USE_THEN "lo_ineq")MP_TAC) THEN (clear_assumption "lo_ineq") THEN ((USE_THEN "ineq2")MP_TAC) THEN (clear_assumption "ineq2") THEN ((USE_THEN "ineq1")MP_TAC) THEN (clear_assumption "ineq1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +let taylor_f_bounds = end_section_proof();; +(start_section_proof ["dd";"lo";"hi"](`taylor_interval f x y z w f_bounds (df_lo, df_hi) dd_bounds ==> + iabs dd_bounds = dd ==> + df_hi + w * dd <= hi ==> + lo <= df_lo - w * dd ==> + bounded_on_int (derivative f) (x, z) (lo, hi)`));; +refine (by (VALID ((BETA_TAC THEN (move ["taylor_f"]) THEN (move ["iabs_dd"]) THEN (move ["hi_ineq"]) THEN (move ["lo_ineq"])))));; +refine (by (VALID (((((USE_THM_THEN bounded_on_int)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN interval_arith)(new_rewrite [] [])))) THEN (move ["p"]) THEN (move ["ineq"])))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN taylor_derivative_lower_bound)(fun fst_th ->(fun thm_tac -> (USE_THM_THEN EQ_SYM)(fun fst_th ->(USE_THEN "iabs_dd")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "taylor_f")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC))));; +refine (by (VALID ((((fun thm_tac -> (fun thm_tac -> (fun thm_tac -> (USE_THM_THEN taylor_derivative_upper_bound)(fun fst_th ->(fun thm_tac -> (USE_THM_THEN EQ_SYM)(fun fst_th ->(USE_THEN "iabs_dd")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "taylor_f")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))(fun fst_th ->(USE_THEN "ineq")(fun th -> MATCH_MP_THEN th thm_tac fst_th)))MP_TAC) THEN BETA_TAC))));; +refine (by (VALID (((((USE_THEN "hi_ineq")MP_TAC) THEN (clear_assumption "hi_ineq") THEN ((USE_THEN "lo_ineq")MP_TAC) THEN (clear_assumption "lo_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)))));; +let taylor_df_bounds = end_section_proof();; +(start_section_proof ["g";"int";"g_bounds"](`bounded_on_int g int g_bounds ==> + bounded_on_int f g_bounds f_bounds ==> + bounded_on_int (\x. f (g x)) int f_bounds`));; +refine (by (VALID ((repeat_tactic 1 9 (((USE_THM_THEN bounded_on_int)(new_rewrite [] []))) THEN (move ["g_bounded"]) THEN (move ["f_bounded"]) THEN (move ["x"]) THEN (move ["ineq"]) THEN (simp_tac)))));; +refine (by (VALID (((((USE_THEN "f_bounded")(new_rewrite [] [])) THEN ((USE_THEN "g_bounded")(new_rewrite [] []))) THEN (done_tac)))));; +let bounded_on_int_compose = end_section_proof();; +(start_section_proof ["int"](`bounded_on_int f int f_bounds ==> + interval_arith y int ==> interval_arith (f y) f_bounds`));; +refine (by (VALID ((((USE_THM_THEN bounded_on_int)(new_rewrite [] [])) THEN (move ["bounded_f"]) THEN (move ["int_y"])))));; +refine (by (VALID ((((USE_THEN "bounded_f")(new_rewrite [] [])) THEN (done_tac)))));; +let bounded_on_int_imp_interval_arith = end_section_proof();; +(start_section_proof ["x0";"z0";"w0"](`taylor_interval f x y z w f_bounds df_bounds dd_bounds ==> + cell_domain x0 y z0 w0 ==> + x <= x0 ==> z0 <= z ==> + taylor_interval f x0 y z0 w0 f_bounds df_bounds dd_bounds`));; +refine (by (VALID (((repeat_tactic 1 9 (((USE_THM_THEN taylor_interval)(new_rewrite [] []))) THEN ((USE_THM_THEN cell_domain)(new_rewrite [] [])) THEN repeat_tactic 1 9 (((USE_THM_THEN andbA)(new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((case THEN ((move ["ineq"]) THEN (move ["lin"]))) THEN (move ["dd"]))) THEN (move ["c"]) THEN (move ["i1"]) THEN (move ["i2"])))));; +refine (by (VALID (((THENL_FIRST) ((((USE_THEN "lin")(new_rewrite [] [])) THEN ((USE_THM_THEN andbT)(new_rewrite [] []))) THEN (split_tac)) ((((USE_THEN "i2")MP_TAC) THEN (clear_assumption "i2") THEN ((USE_THEN "i1")MP_TAC) THEN (clear_assumption "i1") THEN ((USE_THEN "c")MP_TAC) THEN (clear_assumption "c") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))))));; +refine (by (VALID (((((USE_THEN "dd")MP_TAC) THEN (clear_assumption "dd") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((USE_THM_THEN has_bounded_second_derivative)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN nth_diff_strong_int)(new_rewrite [] []))) THEN repeat_tactic 1 9 (((USE_THM_THEN bounded_on_int)(new_rewrite [] [])))) THEN (move ["df"]))))));; +refine (by (VALID (((split_tac) THEN (move ["p"]) THEN (move ["int_p"])))));; +refine (by (VALID ((((USE_THEN "df")(new_rewrite [] [])) THEN (((USE_THEN "i2")MP_TAC) THEN (clear_assumption "i2") THEN ((USE_THEN "i1")MP_TAC) THEN (clear_assumption "i1") THEN ((USE_THEN "int_p")MP_TAC) THEN (clear_assumption "int_p") THEN BETA_TAC) THEN repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL interval_arith))(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +refine (by (VALID ((((USE_THEN "df")(new_rewrite [] [])) THEN (((USE_THEN "i2")MP_TAC) THEN (clear_assumption "i2") THEN ((USE_THEN "i1")MP_TAC) THEN (clear_assumption "i1") THEN ((USE_THEN "int_p")MP_TAC) THEN (clear_assumption "int_p") THEN BETA_TAC) THEN repeat_tactic 1 9 (((USE_THM_THEN (GEN_ALL interval_arith))(new_rewrite [] []))) THEN (arith_tac) THEN (done_tac)))));; +let taylor_interval_narrow = end_section_proof();; +let taylor_interval_narrow = finalize_theorem taylor_interval_narrow;; +let bounded_on_int_imp_interval_arith = finalize_theorem bounded_on_int_imp_interval_arith;; +let bounded_on_int_compose = finalize_theorem bounded_on_int_compose;; +let taylor_df_bounds = finalize_theorem taylor_df_bounds;; +let taylor_f_bounds = finalize_theorem taylor_f_bounds;; +let taylor_const = finalize_theorem taylor_const;; +let taylor_x = finalize_theorem taylor_x;; +(end_section "TaylorArith");; diff --git a/formal_lp/old/formal_interval/verifier.hl b/formal_lp/old/formal_interval/verifier.hl new file mode 100644 index 0000000..3ec4baf --- /dev/null +++ b/formal_lp/old/formal_interval/verifier.hl @@ -0,0 +1,284 @@ +needs "../formal_lp/formal_interval/second_approx.hl";; +needs "../formal_lp/formal_interval/interval_1d/recurse.hl";; + + +(***********************************) + +let cell_pass = new_definition `cell_pass f int <=> !x. interval_arith x int ==> f x < &0`;; + +let dest_cell_pass tm = + let lhs, int_tm = dest_comb tm in + rand lhs, int_tm;; + +let CELL_PASS_GLUE = prove(`!f x t z. cell_pass f (x, t) /\ cell_pass f (t, z) ==> cell_pass f (x, z)`, + REWRITE_TAC[cell_domain; cell_pass; interval_arith] THEN + REPEAT STRIP_TAC THEN + DISJ_CASES_TAC (REAL_ARITH `x' <= t \/ t <= x'`) THENL + [ + FIRST_X_ASSUM ((fun th -> ALL_TAC) o SPEC `x':real`) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[] + ]);; + +let CELL_PASS_GLUE' = RULE CELL_PASS_GLUE;; + +let cell_pass_glue pass1 pass2 = + let f_tm, int1 = dest_cell_pass (concl pass1) and + int2 = rand (concl pass2) in + let x_tm, t_tm = dest_pair int1 and + z_tm = rand int2 in + let th0 = INST[f_tm, f_var_fun; x_tm, x_var_real; t_tm, t_var_real; z_tm, z_var_real] CELL_PASS_GLUE' in + (MY_PROVE_HYP pass1 o MY_PROVE_HYP pass2) th0;; + + + + +let CELL_PASS_LEMMA' = (UNDISCH_ALL o PURE_REWRITE_RULE[GSYM IMP_IMP] o prove) + (`bounded_on_int f int (f_lo, f_hi) /\ (f_hi < &0 <=> T) ==> cell_pass f int`, + REWRITE_TAC[bounded_on_int; cell_pass; interval_arith] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `f_hi:real` THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:real`) THEN ASM_SIMP_TAC[]);; + + +let taylor_cell_pass pp taylor_int_th = + let bound_th = eval_taylor_f_bounds pp taylor_int_th in + let lhs, f_bounds = dest_comb (concl bound_th) in + let lhs2, int_tm = dest_comb lhs in + let f_tm = rand lhs2 in + let f_lo, f_hi = dest_pair f_bounds in + let f_hi_lt0 = float_lt0 f_hi in + if (fst o dest_const o rand o concl) f_hi_lt0 <> "T" then + failwith "taylor_cell_pass: f_hi >= 0" + else + let th0 = INST[f_tm, f_var_fun; int_tm, int_var; f_lo, f_lo_var; f_hi, f_hi_var] CELL_PASS_LEMMA' in + (MY_PROVE_HYP bound_th o MY_PROVE_HYP f_hi_lt0) th0;; + + +(*************************************) + + +open Taylor;; +open Univariate;; +open Interval;; +open Recurse;; + +(******************************************) + + +let DECIMAL' = SPEC_ALL DECIMAL;; + +(* Unary interval operations *) +let unary_interval_operations = + let table = Hashtbl.create 10 in + let add = Hashtbl.add in + add table `--` (fun pp -> float_interval_neg); + add table `inv` float_interval_inv; + add table `sqrt` float_interval_sqrt; + add table `atn` float_interval_atn; + add table `acs` float_interval_acs; + table;; + + +(* Binary interval operations *) +let binary_interval_operations = + let table = Hashtbl.create 10 in + let add = Hashtbl.add in + add table `+` float_interval_add; + add table `-` float_interval_sub; + add table `*` float_interval_mul; + add table `/` float_interval_div; + table;; + +(* Interval approximations of constants *) +let interval_constants = + let table = Hashtbl.create 10 in + let add = Hashtbl.add in + add table `pi` (fun pp -> pi_approx_array.(pp)); + table;; + + +(* Builds a function for evaluating an interval approximation of the given expression *) +let rec build_eval_interval expr_tm = + (* Constants *) + if is_const expr_tm then + Hashtbl.find interval_constants expr_tm + else + let ltm, r_tm = dest_comb expr_tm in + (* Unary operations *) + if is_const ltm then + (* & *) + if ltm = amp_op_real then + let n = dest_numeral r_tm in + (fun pp -> mk_float_interval_num n) + else + let r_fun = build_eval_interval r_tm in + let f = Hashtbl.find unary_interval_operations ltm in + (fun pp -> f pp (r_fun pp)) + else + (* Binary operations *) + let op, l_tm = dest_comb ltm in + (* DECIMAL *) + if (fst o dest_const) op = "DECIMAL" then + let n, d = dest_numeral l_tm, dest_numeral r_tm in + (fun pp -> + let (/), (!) = float_interval_div pp, mk_float_interval_num in + let int_th = !n / !d in + let eq_th = INST[l_tm, x_var_num; r_tm, y_var_num] DECIMAL' in + norm_interval int_th eq_th) + else + let lhs = build_eval_interval l_tm and + rhs = build_eval_interval r_tm in + let f = Hashtbl.find binary_interval_operations op in + (fun pp -> f pp (lhs pp) (rhs pp));; + + +(* Converts a float term to the corresponding rational number *) +let num_of_float_tm tm = + let s, n_tm, e_tm = dest_float tm in + let b = Num.num_of_int base in + let m = Num.num_of_int min_exp in + let ( * ), (^), (-), (!) = ( */ ), ( **/ ), (-/), raw_dest_hash in + let r = !n_tm * (b ^ (!e_tm - m)) in + if s = "T" then minus_num r else r;; + + +let float_of_float_tm tm = + float_of_num (num_of_float_tm tm);; + + +(**************************************) + +let taylor_interval_div_alt pp th1 th2 = + let domain_th, _, _ = dest_taylor_interval_th th1 in + let rhs = taylor_interval_compose pp eval_taylor_inv (fun _ _ -> th2) in + taylor_interval_mul pp th1 (rhs domain_th);; + + +let mk_formal_binop taylor_binop arg1 arg2 = + fun pp domain_th -> + let lhs = arg1 pp domain_th and + rhs = arg2 pp domain_th in + taylor_binop pp lhs rhs;; + + +let rec mk_taylor_functions pp expr_tm = + (* Constant *) + try + let eval_f = build_eval_interval expr_tm in + let int_th = eval_f pp in + let lo_tm, hi_tm = (dest_pair o rand o concl) int_th in + let float_int = mk_interval (float_of_float_tm lo_tm, float_of_float_tm hi_tm) in + Scale (unit, float_int), (fun pp -> eval_taylor_const_interval int_th) + with _ -> + (* Variable *) + if is_var expr_tm then + if (expr_tm = x_var_real) then x1, (fun pp -> eval_taylor_x) + else failwith "mk_taylor_functions: only x variable is allowed" + else + (* Constant (operation) *) + if is_const expr_tm then + let name,_ = dest_const expr_tm in + if name = "real_inv" then + Uni (mk_primitiveU uinv), eval_taylor_inv + else if name = "sqrt" then + Uni (mk_primitiveU usqrt), eval_taylor_sqrt + else if name = "atn" then + Uni (mk_primitiveU uatan), eval_taylor_atn + else if name = "acs" then + Uni (mk_primitiveU uacos), eval_taylor_acs + else + failwith ("mk_taylor_functions: unknown constant: "^name) + else + (* Combination *) + let lhs, r_tm = dest_comb expr_tm in + let r, r2 = mk_taylor_functions pp r_tm in + (* Unary operations *) + if lhs = neg_op_real then + Scale (r, ineg one), (fun pp domain_th -> taylor_interval_neg (r2 pp domain_th)) + else + (* Composite *) + try + let l, l2 = mk_taylor_functions pp lhs in + if r_tm = x_var_real then + l, l2 + else + Composite (l,r), (fun pp domain_th -> taylor_interval_compose pp l2 r2 domain_th) + with Failure _ -> + (* Binary operations *) + if is_comb lhs then + let op, l_tm = dest_comb lhs in + let l, l2 = mk_taylor_functions pp l_tm in + if op = add_op_real then + Plus (l,r), mk_formal_binop taylor_interval_add l2 r2 + else if op = sub_op_real then + Minus (l,r), mk_formal_binop taylor_interval_sub l2 r2 + else if op = mul_op_real then + Product (l,r), mk_formal_binop taylor_interval_mul l2 r2 + else if op = div_op_real then + Product (l, Uni_compose (uinv,r)), mk_formal_binop taylor_interval_div_alt l2 r2 + else + failwith ("mk_taylor_functions: unknown binary operation "^string_of_term op) + else + failwith ("mk_taylor_functions: error: "^string_of_term lhs);; + +(**********************************) + + +let rec result_size r = + match r with + | Result_false -> failwith "False result detected" + | Result_glue (r1, r2) -> result_size r1 + result_size r2 + | Result_pass _ -> 1;; + + +let prove_result pp formal_f result lo_tm hi_tm = + let pass_counter = ref 0 in + let r_size = result_size result in + let rec rec_prove result lo_tm hi_tm = + let domain_th = mk_center_domain pp lo_tm hi_tm in + match result with + | Result_false -> failwith "False result" + | Result_pass _ -> + pass_counter := !pass_counter + 1; + let th0 = taylor_cell_pass pp (formal_f pp domain_th) in + let _ = report (sprintf "Result_pass: %d/%d" !pass_counter r_size) in + th0 + | Result_glue (r1, r2) -> + let _, y_tm, _, _ = dest_cell_domain (concl domain_th) in + let th1 = rec_prove r1 lo_tm y_tm and + th2 = rec_prove r2 y_tm hi_tm in + cell_pass_glue th1 th2 in + rec_prove result lo_tm hi_tm;; + + +let CELL_PASS_IMP = prove + (`cell_pass f (lo, hi) ==> + interval_arith x (lo, w1) ==> + interval_arith z (w2, hi) ==> + !t. t IN real_interval [x, z] ==> f t < &0`, + REWRITE_TAC[cell_pass; interval_arith; IN_REAL_INTERVAL] THEN REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REAL_ARITH_TAC);; + + +let prove_ineq1d pp expr_tm lo_tm hi_tm = + let f, formal_f = mk_taylor_functions pp expr_tm in + let lo_int, hi_int = build_eval_interval lo_tm pp, build_eval_interval hi_tm pp in + let lo1_tm = (fst o dest_pair o rand o concl) lo_int and + hi1_tm = (snd o dest_pair o rand o concl) hi_int in + let lo, hi = float_of_float_tm lo1_tm, float_of_float_tm hi1_tm in + let _ = report (sprintf "Starting verification from %f to %f" lo hi) in + + let result = + let opt = { + allow_sharp = false; + iteration_count = 0; + iteration_limit = 0; + recursion_depth = 50 + } in + recursive_verifier (0, lo, hi, f, opt) in + + let th0 = prove_result pp formal_f result lo1_tm hi1_tm in + REWRITE_RULE[] (MATCH_MP (MATCH_MP (MATCH_MP CELL_PASS_IMP th0) lo_int) hi_int);; diff --git a/formal_lp/old/hypermap/constants_approx.hl b/formal_lp/old/hypermap/constants_approx.hl new file mode 100644 index 0000000..bd97f67 --- /dev/null +++ b/formal_lp/old/hypermap/constants_approx.hl @@ -0,0 +1,368 @@ +needs "arith/interval_arith.hl";; +needs "misc/vars.hl";; + +module Constant_approximations = struct + +open Interval_arith;; +open Misc_vars;; + + +let EPS_TO_INTERVAL = prove(`abs (f - x) <= e <=> interval_arith f (x - e, x + e)`, + REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; + +let acs3_lo, acs3_hi = + let verify = MATCH_MP REAL_LT_IMP_LE o fst o M_verifier_main.verify_ineq M_verifier_main.default_params 10 in + verify `#1.230959417 < acs (&1 / &3)`, verify `acs(&1 / &3) < #1.230959418`;; + +let mk_decimal a b = + let tm = mk_comb(mk_comb(`DECIMAL`, mk_numeral (Num.abs_num a)), mk_numeral b) in + if (a + interval_arith (sqrt x) (abs c, abs d)`, + REWRITE_TAC[interval_arith] THEN REPEAT STRIP_TAC THENL + [ + MATCH_MP_TAC REAL_LE_RSQRT THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a:real` THEN + ASM_REWRITE_TAC[REAL_ARITH `abs a pow 2 = a * a`]; + MATCH_MP_TAC REAL_LE_LSQRT THEN + ASM_REWRITE_TAC[REAL_ARITH `abs d pow 2 = d * d`; REAL_ABS_POS] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a:real` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `c * c:real` THEN + ASM_REWRITE_TAC[REAL_LE_SQUARE]; + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `b:real` THEN + ASM_REWRITE_TAC[] + ] + ]);; + + + +let interval_sqrt th precision = + let th' = CONV_RULE (REWRITE_CONV[DECIMAL] THENC REAL_RAT_REDUCE_CONV) th in + let lo, hi = dest_pair(rand(concl th')) in + let x_lo, x_hi = float_of_num (rat_of_term lo), float_of_num (rat_of_term hi) in + let lo_sqrt, hi_sqrt = Pervasives.sqrt x_lo, Pervasives.sqrt x_hi in + let m = 10.0 ** float_of_int precision in + let hack n = num_of_string (Int64.to_string (Int64.of_float n)) in + let sqrt_lo_num, sqrt_hi_num = hack (floor (lo_sqrt *. m)), hack (ceil (hi_sqrt *. m)) in + let m_num = Int 10 **/ Int precision in + let x_lo_tm = mk_decimal sqrt_lo_num m_num in + let x_hi_tm = mk_decimal sqrt_hi_num m_num in + let conv = EQT_ELIM o REAL_RAT_REDUCE_CONV in + let lo_th = conv (mk_binop le_op_real (mk_binop mul_op_real x_lo_tm x_lo_tm) lo) in + let hi_th = conv (mk_binop le_op_real hi (mk_binop mul_op_real x_hi_tm x_hi_tm)) in + let th0 = CONJ th' (CONJ lo_th hi_th) in + (CONV_RULE REAL_RAT_REDUCE_CONV) (MATCH_MP INTERVAL_SQRT th0);; + + + +(************************************) +(* Arithmetic of intervals *) + +let INTERVAL_ADD = prove(`interval_arith x (a, b) /\ interval_arith y (c, d) + ==> interval_arith (x + y) (a + c, b + d)`, + REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; + + +let INTERVAL_SUB = prove(`interval_arith x (a, b) /\ interval_arith y (c, d) + ==> interval_arith (x - y) (a - d, b - c)`, + REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; + + +let INTERVAL_NEG = prove(`interval_arith x (a, b) ==> + interval_arith (--x) (--b, --a)`, + REWRITE_TAC[interval_arith] THEN REAL_ARITH_TAC);; + + + +let INTERVAL_INV = prove(`interval_arith x (a, b) /\ (&0 < a \/ b < &0) + ==> interval_arith (inv x) (inv b, inv a)`, + REWRITE_TAC[interval_arith] THEN + STRIP_TAC THENL + [ + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_INV2 THEN + ASM_REWRITE_TAC[] THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + ONCE_REWRITE_TAC[REAL_ARITH `a <= b <=> --b <= --a`] THEN + REWRITE_TAC[GSYM REAL_INV_NEG] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_INV2 THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC);; + + +let INTERVAL_INV_POS = prove(`interval_arith x (a,b) /\ &0 < a + ==> interval_arith (inv x) (inv b, inv a)`, + SIMP_TAC[INTERVAL_INV]);; + + +let INTERVAL_INV_NEG = prove(`interval_arith x (a,b) /\ b < &0 + ==> interval_arith (inv x) (inv b, inv a)`, + SIMP_TAC[INTERVAL_INV]);; + + + +let INTERVAL_MUL_lemma = prove(`!x y a b c d. interval_arith x (a, b) /\ interval_arith y (c, d) /\ x <= y + ==> x * y <= max (max (a * c) (a * d)) (max (b * c) (b * d))`, + REPEAT GEN_TAC THEN + REWRITE_TAC[interval_arith] THEN DISCH_TAC THEN + ABBREV_TAC `t = max (max (a * c) (a * d)) (max (b * c) (b * d))` THEN + SUBGOAL_THEN `a * c <= t /\ a * d <= t /\ b * c <= t /\ b * d <= t:real` ASSUME_TAC THENL + [ + EXPAND_TAC "t" THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + DISJ_CASES_TAC (REAL_ARITH `&0 <= x \/ x <= &0`) THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `b * d:real` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `x:real` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISJ_CASES_TAC (REAL_ARITH `&0 <= b \/ b <= &0`) THENL + [ + DISJ_CASES_TAC (REAL_ARITH `&0 <= y \/ y <= &0`) THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `&0` THEN + CONJ_TAC THENL + [ + ONCE_REWRITE_TAC[REAL_ARITH `&0 = &0 * y`] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `b * d:real` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `y:real` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a * c:real` THEN + ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[GSYM REAL_NEG_MUL2] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[REAL_LE_NEG; REAL_NEG_GE0]; + ALL_TAC + ] THEN + + DISJ_CASES_TAC (REAL_ARITH `&0 <= c \/ c <= &0`) THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `b * c:real` THEN + ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[REAL_ARITH `x * y <= b * c <=> (--b) * c <= (--x) * y`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[REAL_LE_NEG; REAL_NEG_GE0]; + ALL_TAC + ] THEN + + DISJ_CASES_TAC (REAL_ARITH `&0 <= y \/ y <= &0`) THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `&0` THEN + CONJ_TAC THENL + [ + ONCE_REWRITE_TAC[REAL_ARITH `&0 = &0 * y`] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a * c:real` THEN + ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[GSYM REAL_NEG_MUL2] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[REAL_NEG_GE0] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `x:real` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a * c:real` THEN + ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[GSYM REAL_NEG_MUL2] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[REAL_LE_NEG; REAL_NEG_GE0]);; + + + +let INTERVAL_MUL_lemma2 = prove(`!x y a b c d. interval_arith x (a,b) /\ interval_arith y (c,d) + ==> x * y <= max (max (a * c) (a * d)) (max (b * c) (b * d))`, + REPEAT STRIP_TAC THEN + DISJ_CASES_TAC (REAL_ARITH `x <= y \/ y <= x:real`) THENL + [ + MATCH_MP_TAC INTERVAL_MUL_lemma THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`y:real`; `x:real`; `c:real`; `d:real`; `a:real`; `b:real`] INTERVAL_MUL_lemma) THEN + ASM_REWRITE_TAC[] THEN + REAL_ARITH_TAC);; + + + + +let INTERVAL_MUL = prove(`interval_arith x (a, b) /\ interval_arith y (c, d) + ==> interval_arith (x * y) + (min (min (a * c) (a * d)) (min (b * c) (b * d)), + max (max (a * c) (a * d)) (max (b * c) (b * d)))`, + DISCH_TAC THEN REWRITE_TAC[interval_arith] THEN + ASM_SIMP_TAC[INTERVAL_MUL_lemma2] THEN + MP_TAC (SPECL[`--x:real`; `y:real`; `--b:real`; `--a:real`; `c:real`; `d:real`] INTERVAL_MUL_lemma2) THEN + ASM_SIMP_TAC[INTERVAL_NEG] THEN + REAL_ARITH_TAC);; + + + +(**************************************) +let const_interval tm = SPEC tm CONST_INTERVAL;; + +let interval_neg th = MATCH_MP INTERVAL_NEG th;; + +let interval_add th1 th2 = + let th0 = MATCH_MP INTERVAL_ADD (CONJ th1 th2) in + (CONV_RULE (RAND_CONV REAL_RAT_REDUCE_CONV)) th0;; + +let interval_sub th1 th2 = + let th0 = MATCH_MP INTERVAL_SUB (CONJ th1 th2) in + (CONV_RULE (RAND_CONV REAL_RAT_REDUCE_CONV)) th0;; + +let interval_mul th1 th2 = + let th0 = MATCH_MP INTERVAL_MUL (CONJ th1 th2) in + (CONV_RULE (RAND_CONV REAL_RAT_REDUCE_CONV)) th0;; + +let interval_inv th = + let lt_op_real = `(<):real->real->bool` in + let lo_tm, hi_tm = dest_pair(rand(concl th)) in + let lo_ineq = REAL_RAT_LT_CONV (mk_binop lt_op_real `&0` lo_tm) in + if (rand(concl lo_ineq) = `T`) then + let th0 = CONJ th (EQT_ELIM lo_ineq) in + (CONV_RULE (RAND_CONV REAL_RAT_REDUCE_CONV)) (MATCH_MP INTERVAL_INV_POS th0) + else + let hi_ineq = REAL_RAT_LT_CONV (mk_binop lt_op_real hi_tm `&0`) in + if (rand(concl hi_ineq) = `T`) then + let th0 = CONJ th (EQT_ELIM hi_ineq) in + (CONV_RULE (RAND_CONV REAL_RAT_REDUCE_CONV)) (MATCH_MP INTERVAL_INV_NEG th0) + else failwith("interval_inv: 0 is inside interval");; + +let interval_div th1 th2 = + let th2' = interval_inv th2 in + ONCE_REWRITE_RULE[GSYM real_div] (interval_mul th1 th2');; + + + +(*************************) +let acs3_interval = REWRITE_RULE[GSYM interval_arith] (CONJ acs3_lo acs3_hi);; + +let pi_interval = prove(`interval_arith pi (#3.141592653, #3.141592654)`, + REWRITE_TAC[interval_arith] THEN + MP_TAC PI_APPROX_32 THEN REAL_ARITH_TAC);; + +let tgt_interval = prove(`interval_arith tgt (#1.541, #1.541)`, + REWRITE_TAC[Tame_defs.tgt; interval_arith; REAL_LE_REFL]);; + + +let interval_table = Hashtbl.create 10;; +let add_interval th = Hashtbl.add interval_table ((rand o rator o concl) th) th;; + + +let rec create_interval tm = + if Hashtbl.mem interval_table tm then + Hashtbl.find interval_table tm + else + if (is_ratconst tm) then + const_interval tm + else if (is_binop add_op_real tm) then + let lhs, rhs = dest_binop add_op_real tm in + interval_add (create_interval lhs) (create_interval rhs) + else if (is_binop sub_op_real tm) then + let lhs, rhs = dest_binop sub_op_real tm in + interval_sub (create_interval lhs) (create_interval rhs) + else if (is_binop mul_op_real tm) then + let lhs, rhs = dest_binop mul_op_real tm in + interval_mul (create_interval lhs) (create_interval rhs) + else if (is_binop div_op_real tm) then + let lhs, rhs = dest_binop div_op_real tm in + interval_div (create_interval lhs) (create_interval rhs) + else if (is_comb tm) then + let ltm, rtm = dest_comb tm in + if (ltm = inv_op_real) then + interval_inv (create_interval rtm) + else if (ltm = neg_op_real) then + interval_neg (create_interval rtm) + else failwith "create_interval: unknown unary operation" + else + failwith "create_interval: unexpected term";; + + +open Sphere;; + +add_interval pi_interval;; +add_interval acs3_interval;; +add_interval tgt_interval;; +add_interval (REWRITE_RULE[GSYM sqrt8] (interval_sqrt (const_interval `&8`) 9));; +add_interval (REWRITE_RULE[GSYM sol0] (create_interval `&3 * acs(&1 / &3) - pi`));; +add_interval (create_interval `sol0 / pi`);; + +let rho218 = new_definition `rho218 = rho(#2.18)`;; + +let rho218_def = (REWRITE_CONV[rho218; rho; ly; interp; GSYM Tame_general.sol0_over_pi_EQ_const1] THENC + REAL_RAT_REDUCE_CONV) `rho218`;; + +let rho218_interval = REWRITE_RULE[SYM rho218_def] (create_interval(rand(concl rho218_def)));; +add_interval rho218_interval;; + + +end;; diff --git a/formal_lp/old/hypermap/contravening_ineqs.hl b/formal_lp/old/hypermap/contravening_ineqs.hl new file mode 100644 index 0000000..2d8e39d --- /dev/null +++ b/formal_lp/old/hypermap/contravening_ineqs.hl @@ -0,0 +1,1832 @@ +needs "../formal_lp/hypermap/list_hypermap.hl";; +needs "../formal_lp/hypermap/list_hypermap_iso.hl";; +needs "../formal_lp/hypermap/constants_approx.hl";; + +needs "arith/nat.hl";; +needs "misc/vars.hl";; + +open Constant_approximations;; +open Misc_vars;; +open Sphere;; + + + +(* Definitions of variables *) + + +(* Variables for fans *) +(* TODO: these definitions are not necessary *) + +let azim2_fan = new_definition `azim2_fan (V,E) (x:real^3#real^3) = azim_dart (V,E) (f_fan_pair (V,E) x)`;; +let azim3_fan = new_definition `azim3_fan (V,E) (x:real^3#real^3) = azim_dart (V,E) (inverse (f_fan_pair_ext (V,E)) x)`;; +let yn_fan = new_definition `yn_fan (n:real^3#real^3->bool) = norm (FST (@x. x IN n))`;; +let ln_fan = new_definition `ln_fan (n:real^3#real^3->bool) = abs (ly (yn_fan n))`;; +let ye_fan = new_definition `ye_fan (x:real^3#real^3) = dist x`;; + +let y1_fan = new_definition `y1_fan (x:real^3#real^3) = norm(FST x)`;; +let y2_fan = new_definition `y2_fan (x:real^3#real^3) = norm(SND x)`;; +let y3_fan = new_definition `y3_fan (V,E) (x:real^3#real^3) = norm(sigma_fan (vec 0) V E (FST x) (SND x))`;; +let y4_fan = new_definition `y4_fan (V,E) (x:real^3#real^3) = dist(f_fan_pair (V,E) x)`;; +let y5_fan = new_definition `y5_fan (V,E) (x:real^3#real^3) = dist(inverse (f_fan_pair_ext (V,E)) x)`;; +let y6_fan = new_definition `y6_fan (x:real^3#real^3) = dist x`;; +let y8_fan = new_definition `y8_fan (V,E) (x:real^3#real^3) = y5_fan (V,E) (f_fan_pair_ext (V,E) x)`;; +let y9_fan = new_definition `y9_fan (V,E) (x:real^3#real^3) = dist(f_fan_pair (V,E) x)`;; + +let rhazim_fan = new_definition `rhazim_fan (V,E) (x:real^3#real^3) = abs(rho(y1_fan x)) * azim_dart (V,E) x`;; +let rhazim2_fan = new_definition `rhazim2_fan (V,E) (x:real^3#real^3) = rhazim_fan (V,E) (f_fan_pair (V,E) x)`;; +let rhazim3_fan = new_definition `rhazim3_fan (V,E) (x:real^3#real^3) = rhazim_fan (V,E) (inverse (f_fan_pair_ext (V,E)) x)`;; + +let rho_fan = new_definition `rho_fan n = abs((&1 + sol0 / pi) - ln_fan n * sol0 / pi)`;; +let sol_fan = new_definition `sol_fan (V,E) f = abs(sum f (\x. azim_dart (V,E) x - pi) + &2 * pi)`;; +let tau_fan = new_definition `tau_fan (V,E) f = abs (tauVEF (V,E,f))`;; + + +let fan_defs = +[ + azim2_fan; azim3_fan; yn_fan; ln_fan; ye_fan; + rho_fan; sol_fan; tau_fan; rhazim_fan; rhazim2_fan; rhazim3_fan; + y1_fan; y2_fan; y3_fan; y4_fan; y5_fan; y6_fan; y8_fan; y9_fan; +] + + + +(* Variables for lists *) + + +let list_defs = map new_definition + [ + `azim_list (V,g) = (azim_dart (V,ESTD V) o g):num#num->real`; + `azim2_list (V,g) = (azim2_fan (V,ESTD V) o g):num#num->real`; + `azim3_list (V,g) = (azim3_fan (V,ESTD V) o g):num#num->real`; + `(yn_list g):(num#num->bool)->real = yn_fan o IMAGE g`; + `(ln_list g):(num#num->bool)->real = ln_fan o IMAGE g`; + `rhazim_list (V,g) = (rhazim_fan (V,ESTD V) o g):num#num->real`; + `rhazim2_list (V,g) = (rhazim2_fan (V,ESTD V) o g):num#num->real`; + `rhazim3_list (V,g) = (rhazim3_fan (V,ESTD V) o g):num#num->real`; + `(ye_list g):(num#num->real) = ye_fan o g`; + `(rho_list g):(num#num->bool)->real = rho_fan o IMAGE g`; + `(sol_list (V,g)):(num#num->bool)->real = sol_fan (V,ESTD V) o IMAGE g`; + `(tau_list (V,g)):(num#num->bool)->real = tau_fan (V,ESTD V) o IMAGE g`; + `(y1_list g):(num#num->real) = y1_fan o g`; + `(y2_list g):(num#num->real) = y2_fan o g`; + `(y3_list (V,g)):(num#num->real) = y3_fan (V,ESTD V) o g`; + `(y4_list (V,g)):(num#num->real) = y4_fan (V,ESTD V) o g`; + `(y5_list (V,g)):(num#num->real) = y5_fan (V,ESTD V) o g`; + `(y6_list g):(num#num->real) = y6_fan o g`; + `(y8_list (V,g)):(num#num->real) = y8_fan (V,ESTD V) o g`; + `(y9_list (V,g)):(num#num->real) = y9_fan (V,ESTD V) o g`; + ];; + + +let list_defs2 = map (REWRITE_RULE[FUN_EQ_THM; o_THM]) list_defs;; + + +let list_var_rewrites = + map GSYM list_defs @ map GSYM list_defs2;; + + + +(* All variables are nonnegative *) + +let AZIM_DART_POS = prove(`&0 <= azim_dart (V,E) x`, + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[azim_dart] THEN + COND_CASES_TAC THENL + [ + MP_TAC PI_APPROX_32 THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[Fan_defs.azim_fan] THEN + COND_CASES_TAC THEN REWRITE_TAC[azim] THEN + MP_TAC PI_APPROX_32 THEN REAL_ARITH_TAC);; + + +let DIST_POS = prove(`!x:(real^3#real^3). &0 <= dist x`, + GEN_TAC THEN MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[dist; NORM_POS_LE]);; + + +let list_var_pos = map (fun tm -> prove(tm, + GEN_TAC THEN REWRITE_TAC list_defs2 THEN REWRITE_TAC fan_defs THEN + TRY (MATCH_MP_TAC REAL_LE_MUL) THEN + REWRITE_TAC[AZIM_DART_POS; REAL_ABS_POS; NORM_POS_LE; DIST_POS])) +[ + `!x. &0 <= azim_list (V,g) x`; + `!x. &0 <= azim2_list (V,g) x`; + `!x. &0 <= azim3_list (V,g) x`; + `!x. &0 <= rhazim_list (V,g) x`; + `!x. &0 <= rhazim2_list (V,g) x`; + `!x. &0 <= rhazim3_list (V,g) x`; + `!n. &0 <= yn_list g n`; + `!n. &0 <= ln_list g n`; + `!e. &0 <= ye_list g e`; + `!n. &0 <= rho_list g n`; + `!f. &0 <= sol_list (V,g) f`; + `!f. &0 <= tau_list (V,g) f`; + `!x. &0 <= y1_list g x`; + `!x. &0 <= y2_list g x`; + `!x. &0 <= y3_list (V,g) x`; + `!x. &0 <= y4_list (V,g) x`; + `!x. &0 <= y5_list (V,g) x`; + `!x. &0 <= y6_list g x`; + `!x. &0 <= y8_list (V,g) x`; + `!x. &0 <= y9_list (V,g) x`; +];; + + + +(* mod-file variables and definitions *) + +let var_bound_ineqs = Hashtbl.create 40;; + +let sets = + ["dart", `dart H:A->bool`; + "dart3", `hyp_dart3 H:A->bool`; + "node", `node_set H:(A->bool)->bool`; + "face", `face_set H:(A->bool)->bool`; + "dart_std4", `hyp_dart4 H:A->bool`];; + + +let define_var var_name set_name low high = + let var = match set_name with + "dart" | "dart3" | "dart_std4" -> `d:A` + | "node" -> `n:A->bool` + | "face" -> `f:A->bool` + | _ -> failwith "Undefined set name" in + let var_ty = snd (dest_var var) in + let f_ty = mk_type ("fun", [var_ty; `:real`]) in + let set_ty = mk_type ("fun", [var_ty; `:bool`]) in + let f = mk_var (var_name^"_mod", f_ty) in + let set = assoc set_name sets in + let in_const = mk_mconst ("IN", mk_type ("fun", [var_ty; mk_type ("fun", [set_ty; `:bool`])])) in + let le = `(<=):real->real->bool` in + let fvar = mk_comb (f, var) in + let l, h = mk_binop le low fvar, mk_binop le fvar high in + let cond = mk_binop in_const var set in + + let ineq_lo = mk_forall(var, mk_imp(cond, l)) in + let ineq_hi = mk_forall(var, mk_imp(cond, h)) in + + let _ = Hashtbl.add var_bound_ineqs (var_name^"_lo") ineq_lo in + let _ = Hashtbl.add var_bound_ineqs (var_name^"_hi") ineq_hi in + f;; + + + + +(* Terms for variables in the model file *) +Hashtbl.clear var_bound_ineqs;; + +let azim_mod = define_var "azim" "dart" `&0` `pi` and + azim2_mod = define_var "azim2" "dart3" `&0` `pi` and + azim3_mod = define_var "azim3" "dart3" `&0` `pi` and + ln_mod = define_var "ln" "node" `&0` `&1` and + rhazim_mod = define_var "rhazim" "dart" `&0` `pi + sol0` and + rhazim2_mod = define_var "rhazim2" "dart3" `&0` `pi + sol0` and + rhazim3_mod = define_var "rhazim3" "dart3" `&0` `pi + sol0` and + yn_mod = define_var "yn" "node" `&2` `#2.52`and + ye_mod = define_var "ye" "dart" `&2` `&3` and + rho_mod = define_var "rho" "node" `&1` `&1 + sol0 / pi` and + sol_mod = define_var "sol" "face" `&0` `&4 * pi` and + tau_mod = define_var "tau" "face" `&0` `tgt` and + y1_mod = define_var "y1" "dart" `&2` `#2.52` and + y2_mod = define_var "y2" "dart" `&2` `#2.52` and + y3_mod = define_var "y3" "dart" `&2` `#2.52` and + y4_mod = define_var "y4" "dart3" `&2` `&3` and + y5_mod = define_var "y5" "dart" `&2` `&3` and + y6_mod = define_var "y6" "dart" `&2` `&3` and + y8_mod = define_var "y8" "dart_std4" `&2` `#2.52` and + y9_mod = define_var "y9" "dart_std4" `&2` `#2.52`;; + + +let var_list = + let inst_t = inst[`:real^3#real^3`, aty] in + [ + `hypermap_of_fan (V,E)`, `H:(real^3#real^3)hypermap`; + `azim_dart (V,E)`, inst_t azim_mod; + `azim2_fan (V,E)`, inst_t azim2_mod; + `azim3_fan (V,E)`, inst_t azim3_mod; + `ln_fan`, inst_t ln_mod; + `rhazim_fan (V,E)`, inst_t rhazim_mod; + `rhazim2_fan (V,E)`, inst_t rhazim2_mod; + `rhazim3_fan (V,E)`, inst_t rhazim3_mod; + `yn_fan`, inst_t yn_mod; + `ye_fan`, inst_t ye_mod; + `rho_fan`, inst_t rho_mod; + `sol_fan (V,E)`, inst_t sol_mod; + `tau_fan (V,E)`, inst_t tau_mod; + `y1_fan`, inst_t y1_mod; + `y2_fan`, inst_t y2_mod; + `y3_fan (V,E)`, inst_t y3_mod; + `y4_fan (V,E)`, inst_t y4_mod; + `y5_fan (V,E)`, inst_t y5_mod; + `y6_fan`, inst_t y6_mod; + `y8_fan (V,E)`, inst_t y8_mod; + `y9_fan (V,E)`, inst_t y9_mod; + ];; + + + + +(* Declare all inequalities in a format which is close to the mod-file format *) + +let constraints = Hashtbl.create 100;; +let add_constraints = map (uncurry (Hashtbl.add constraints));; + +(* equality constraints *) + +add_constraints +[ + "azim_sum", `!n. n IN node_set (H:(A)hypermap) ==> sum n azim_mod = &2 * pi`; + "rhazim_sum", `!n. n IN node_set (H:(A)hypermap) ==> sum n rhazim_mod = &2 * pi * rho_mod n`; + + "sol_sum3", `!f. f IN hyp_face3 (H:(A)hypermap) ==> sum f azim_mod = sol_mod f + pi`; + "tau_sum3", `!f. f IN hyp_face3 (H:(A)hypermap) ==> sum f rhazim_mod = tau_mod f + (pi + sol0)`; + "sol_sum4", `!f. f IN hyp_face4 (H:(A)hypermap) ==> sum f azim_mod = sol_mod f + &2 * pi`; + "tau_sum4", `!f. f IN hyp_face4 (H:(A)hypermap) ==> sum f rhazim_mod = tau_mod f + &2 * (pi + sol0)`; + "sol_sum5", `!f. f IN hyp_face5 (H:(A)hypermap) ==> sum f azim_mod = sol_mod f + &3 * pi`; + "tau_sum5", `!f. f IN hyp_face5 (H:(A)hypermap) ==> sum f rhazim_mod = tau_mod f + &3 * (pi + sol0)`; + "sol_sum6", `!f. f IN hyp_face6 (H:(A)hypermap) ==> sum f azim_mod = sol_mod f + &4 * pi`; + "tau_sum6", `!f. f IN hyp_face6 (H:(A)hypermap) ==> sum f rhazim_mod = tau_mod f + &4 * (pi + sol0)`; + + "ln_def", `!n. n IN node_set (H:(A)hypermap) ==> ln_mod n = (#2.52 - yn_mod n) / #0.52`; + "rho_def", `!n. n IN node_set (H:(A)hypermap) ==> rho_mod n = (&1 + sol0 / pi) - ln_mod n * sol0 / pi`; + + "edge_sym", `!e. e IN hyp_edge_pairs (H:(A)hypermap) ==> ye_mod (FST e) = ye_mod (SND e):real`; + + "y1_def", `!d. d IN dart (H:(A)hypermap) ==> y1_mod d = yn_mod (node H d):real`; + "y2_def", `!d. d IN dart (H:(A)hypermap) ==> y2_mod d = yn_mod (node H (face_map H d)):real`; + "y3_def", `!d. d IN dart (H:(A)hypermap) ==> y3_mod d = yn_mod (node H (inverse (face_map H) d)):real`; + "y4_def", `!d. d IN hyp_dart3 (H:(A)hypermap) ==> y4_mod d = ye_mod (face_map H d):real`; + "y5_def", `!d. d IN dart (H:(A)hypermap) ==> y5_mod d = ye_mod (inverse (face_map H) d):real`; + "y6_def", `!d. d IN dart (H:(A)hypermap) ==> y6_mod d = ye_mod d:real`; + "y9_def", `!d. d IN hyp_dart4 (H:(A)hypermap) ==> y9_mod d = ye_mod (face_map H d):real`; + "y8_def", `!d. d IN hyp_dart4 (H:(A)hypermap) ==> y8_mod d = y5_mod (inverse (face_map H) d):real`; + + "azim2c", `!d. d IN hyp_dart3 (H:(A)hypermap) ==> azim2_mod d = azim_mod (face_map H d):real`; + "azim3c", `!d. d IN hyp_dart3 (H:(A)hypermap) ==> azim3_mod d = azim_mod (inverse (face_map H) d):real`; + "rhazim2c", `!d. d IN hyp_dart3 (H:(A)hypermap) ==> rhazim2_mod d = rhazim_mod (face_map H d):real`; + "rhazim3c", `!d. d IN hyp_dart3 (H:(A)hypermap) ==> rhazim3_mod d = rhazim_mod (inverse (face_map H) d):real`; +];; + + + +(* inequality constraints *) + +add_constraints +[ + "RHA", `!d. d IN dart (H:(A)hypermap) ==> rhazim_mod d >= azim_mod d:real`; + "RHB", `!d. d IN dart (H:(A)hypermap) ==> rhazim_mod d <= azim_mod d * (&1 + sol0 / pi)`; +(* "RHBLO"; "RHBHI" *) +];; + + +(* definitional inequalities *) + + + +(* y bounds *) +add_constraints +[ + "yy10", `!d. (d:A) IN dart (H:(A)hypermap) ==> ye_mod d <= #2.52`; +];; + + + +(* tau tame table D inequality (Main Estimate) *) +add_constraints +[ + "tau3", `!f:A->bool. f IN hyp_face3 (H:(A)hypermap) ==> tau_mod f >= &0`; + "tau4", `!f:A->bool. f IN hyp_face4 (H:(A)hypermap) ==> tau_mod f >= #0.206`; + "tau5", `!f:A->bool. f IN hyp_face5 (H:(A)hypermap) ==> tau_mod f >= #0.4819`; + "tau6", `!f:A->bool. f IN hyp_face6 (H:(A)hypermap) ==> tau_mod f >= #0.7578`; +];; + + +add_constraints +[ + "ineq105", `!d:A. d IN hyp_dartX H ==> + ((((azim_mod d) - #1.629) + ((#0.402 * (y2_mod d + + (y3_mod d + (y5_mod d + (y6_mod d - #8.0))))) - + (#0.315 * (y1_mod d - #2.0)))) - #0.0) >= #0.0`; + + "ineq106", `!d:A. d IN hyp_dart3 H ==> + ((((rhazim_mod d) - #1.2308) + (((#0.3639 * (y2_mod d + (y3_mod d + (y5_mod d + (y6_mod d - #8.0))))) - + (#0.6 * (y1_mod d - #2.0))) - (#0.685 * (y4_mod d - #2.0)))) - #0.0) >= #0.0`; + + "ineq107", `!d:A. d IN hyp_dart3 H ==> + (((--(azim_mod d)) + ((#1.231 - (#0.152 * (y2_mod d + (y3_mod d + (y5_mod d + (y6_mod d - #8.0)))))) + ((#0.5 * (y1_mod d - #2.0)) + (#0.773 * (y4_mod d - #2.0))))) - #0.0) >= #0.0`; + + "ineq108", `!d:A. d IN hyp_dart3 H ==> + ((((azim_mod d) - #1.2308) + (((#0.3639 * (y2_mod d + (y3_mod d + (y5_mod d + (y6_mod d - #8.0))))) - (#0.235 * (y1_mod d - #2.0))) - (#0.685 * (y4_mod d - #2.0)))) - #0.0) >= #0.0`; + + "ineq109", `!d:A. d IN hyp_dart3 H ==> + (((--(sol_mod (face H d))) + (#0.5513 + ((#0.3232 * (y4_mod d + (y5_mod d + (y6_mod d - #6.0)))) - (#0.151 * (y1_mod d + (y2_mod d + (y3_mod d - #6.0))))))) - #0.0) >= #0.0`; + + "ineq110", `!d:A. d IN hyp_dart3 H ==> + (((((sol_mod (face H d)) - #0.55125) - (#0.196 * (y4_mod d + (y5_mod d + (y6_mod d - #6.0))))) + (#0.38 * (y1_mod d + (y2_mod d + (y3_mod d - #6.0))))) - #0.0) >= #0.0`; + + "ineq111", `!d:A. d IN hyp_dart3 H ==> + (((tau_mod (face H d)) + ((#0.001 - (#0.18 * (y1_mod d + (y2_mod d + (y3_mod d - #6.0))))) - (#0.125 * (y4_mod d + (y5_mod d + (y6_mod d - #6.0)))))) - #0.0) >= #0.0`; + + + "ineq112", `!d:A. d IN hyp_dart3 H ==> + ((((tau_mod (face H d)) - (#0.507 * (azim_mod d))) + #0.724) - #0.0) >= #0.0`; + + "ineq113", `!d:A. d IN hyp_dart3 H ==> + ((((tau_mod (face H d)) - (#0.259 * (azim_mod d))) + #0.32) - #0.0) >= #0.0`; + + "ineq114", `!d:A. d IN hyp_dart3 H ==> + (((tau_mod (face H d)) + ((#0.626 * (azim_mod d)) - #0.77)) - #0.0) >= #0.0`; + + "ineq115", `!d:A. d IN hyp_dart3 H ==> + (#1.893 - (azim_mod d)) >= #0.0`; + + "ineq116", `!d:A. d IN hyp_dart3 H ==> + ((azim_mod d) - #0.852) >= #0.0`; + + "ineq119", `!d:A. d IN hyp_dart4 H ==> + ((((tau_mod (face H d)) - (#0.453 * (azim_mod d))) + #0.777) - #0.0) >= #0.0`; + + "ineq120", `!d:A. d IN hyp_dart4 H ==> + (((tau_mod (face H d)) + ((#0.7573 * (azim_mod d)) - #1.433)) - #0.0) >= #0.0`; + + "ineq121", `!d:A. d IN hyp_dart4 H ==> + (((tau_mod (face H d)) + ((#0.972 * (azim_mod d)) - #1.707)) - #0.0) >= #0.0`; + + "ineq122", `!d:A. d IN hyp_dart4 H ==> + (((tau_mod (face H d)) + ((#4.72 * (azim_mod d)) - #6.248)) - #0.0) >= #0.0`; +];; + + +(* +let y1_def = `!d. d IN dart (H:(A)hypermap) ==> y1_mod d = yn_mod (node H d):real`;; +y1_def{(i3,i1,i2,j) in e_dart}: y1[i1,j] = yn[i1]; + + +(* Rename terms and types *) +let s1 = inst [`:real^3#real^3`, aty] im_sum;; +let s2 = subst [`hypermap_of_fan (V,E)`, h_fan_hyp] s1;; +let s3 = subst [`azim_dart (V,E)`, azim_mod] s2;; +*) + +(*************************************) + +let SUM_ISOMORPHISM = prove(`!G H (g:B->A) (r:A->real). isomorphism g (G,H) + ==> (!d. d IN dart G ==> sum(node G d) (r o g) = sum(node H (g d)) r)`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `sum(node G d) (r o (g:B->A)) = sum(IMAGE g (node G d)) r` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC (GSYM SUM_IMAGE) THEN + REPEAT STRIP_TAC THEN + UNDISCH_TAC `isomorphism (g:B->A) (G,H)` THEN + REWRITE_TAC[isomorphism; BIJ; INJ] THEN + DISCH_THEN (MP_TAC o CONJUNCT1) THEN + DISCH_THEN (MP_TAC o CONJUNCT1) THEN + DISCH_THEN (MATCH_MP_TAC o CONJUNCT2) THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THEN MATCH_MP_TAC IN_TRANS THEN EXISTS_TAC `node G (d:B)` THEN ASM_SIMP_TAC[Hypermap.lemma_node_subset]; + ALL_TAC + ] THEN + MP_TAC (ISPECL [`g:B->A`; `G:(B)hypermap`; `H:(A)hypermap`; `d:B`] ISOMORPHISM_COMPONENT_IMAGE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]));; + + +let ISO_NODE_INJ = prove(`!G H (g:B->A) n. isomorphism g (G,H) /\ n IN node_set G ==> + (!x y. x IN n /\ y IN n /\ g x = g y ==> x = y)`, + REPEAT STRIP_TAC THEN + UNDISCH_TAC `isomorphism (g:B->A) (G,H)` THEN + REWRITE_TAC[isomorphism; BIJ; INJ] THEN + DISCH_THEN (MP_TAC o CONJUNCT1) THEN DISCH_THEN (MP_TAC o CONJUNCT1) THEN + DISCH_THEN (MATCH_MP_TAC o CONJUNCT2) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (ISPECL [`G:(B)hypermap`; `n:B->bool`] Hypermap.lemma_node_representation) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + CONJ_TAC THEN MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `n:B->bool` THEN + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[Hypermap.lemma_node_subset]);; + + + +let COMPONENTS_ISO_IMAGE = prove(`!G H (g:B->A). isomorphism g (G,H) + ==> (!d. d IN dart G ==> + node H (g d) = IMAGE g (node G d) /\ + face H (g d) = IMAGE g (face G d))`, + REPEAT GEN_TAC THEN STRIP_TAC THEN GEN_TAC THEN DISCH_TAC THEN + MP_TAC (ISPECL[`g:B->A`; `G:(B)hypermap`; `H:(A)hypermap`; `d:B`] ISOMORPHISM_COMPONENT_IMAGE) THEN + ASM_REWRITE_TAC[] THEN + SIMP_TAC[]);; + + +let HYPERMAP_MAPS_ISO_COMM = prove(`!G H (g:B->A). isomorphism g (G,H) + ==> (!d. d IN dart G ==> + face_map H (g d) = g (face_map G d) /\ + node_map H (g d) = g (node_map G d))`, + SIMP_TAC[isomorphism]);; + + +let HYPERMAP_INV_MAPS = prove(`!(G:(B)hypermap) d. d IN dart G + ==> (?k. inverse (face_map G) d = (face_map G POWER k) d)`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `n = CARD (orbit_map (face_map G) (d:B))` THEN + MP_TAC (ISPECL [`face_map G:B->B`; `dart G:B->bool`; `d:B`; `n:num`; `1`] Hypermap_and_fan.FINITE_ORBIT_MAP_INVERSE) THEN + ASM_REWRITE_TAC[Hypermap.hypermap_lemma] THEN + ANTS_TAC THENL + [ + REWRITE_TAC[ARITH_RULE `1 <= n <=> 0 < n`] THEN + EXPAND_TAC "n" THEN + MATCH_MP_TAC Hypermap_and_fan.ORBIT_MAP_CARD_POS THEN + EXISTS_TAC `dart G:B->bool` THEN + REWRITE_TAC[Hypermap.hypermap_lemma]; + ALL_TAC + ] THEN + REWRITE_TAC[Hypermap.POWER_1] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + EXISTS_TAC `n - 1` THEN + REWRITE_TAC[]);; + + + +let HYPERMAP_INV_MAPS_ISO_COMM = prove(`!G H (g:B->A). isomorphism g (G,H) + ==> (!d. d IN dart G ==> + inverse (face_map H) (g d) = g (inverse (face_map G) d) /\ + inverse (node_map H) (g d) = g (inverse (node_map G) d))`, + REWRITE_TAC[isomorphism] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC (GSYM COMM_INVERSE_LEMMA) THEN + MAP_EVERY EXISTS_TAC [`dart G:B->bool`; `dart H:A->bool`] THEN + ASM_SIMP_TAC[Hypermap.hypermap_lemma]);; + + +let HYPERMAP_INV_MAPS_ISO_IMAGE = prove(`!G H (g:B->A). isomorphism g (G,H) + ==> (!d. d IN dart G ==> + face H (inverse (face_map H) (g d)) = IMAGE g (face G (inverse (face_map G) d)) /\ + node H (inverse (face_map H) (g d)) = IMAGE g (node G (inverse (face_map G) d)))`, + REPEAT GEN_TAC THEN DISCH_TAC THEN GEN_TAC THEN DISCH_TAC THEN + ASM_SIMP_TAC[HYPERMAP_INV_MAPS_ISO_COMM] THEN + ABBREV_TAC `x = inverse (face_map G) (d:B)` THEN + SUBGOAL_THEN `x:B IN dart G` ASSUME_TAC THENL + [ + EXPAND_TAC "x" THEN + ASM_SIMP_TAC[Hypermap.lemma_dart_inveriant_under_inverse_maps]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[COMPONENTS_ISO_IMAGE]);; + + + + + +let HYPERMAP_MAPS_ISO_IMAGE = prove(`!G H (g:B->A). isomorphism g (G,H) + ==> (!d. d IN dart G ==> + face H (face_map H (g d)) = IMAGE g (face G (face_map G d)) /\ + face H (node_map H (g d)) = IMAGE g (face G (node_map G d)) /\ + node H (node_map H (g d)) = IMAGE g (node G (node_map G d)) /\ + node H (face_map H (g d)) = IMAGE g (node G (face_map G d)))`, + REPEAT GEN_TAC THEN DISCH_TAC THEN GEN_TAC THEN DISCH_TAC THEN + ASM_SIMP_TAC[HYPERMAP_MAPS_ISO_COMM] THEN + MP_TAC (SPEC_ALL COMPONENTS_ISO_IMAGE) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + REPEAT CONJ_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `face_map G (d:B)`); + FIRST_X_ASSUM (MP_TAC o SPEC `node_map G (d:B)`); + FIRST_X_ASSUM (MP_TAC o SPEC `node_map G (d:B)`); + FIRST_X_ASSUM (MP_TAC o SPEC `face_map G (d:B)`) + ] THEN + ASM_SIMP_TAC[Hypermap.lemma_dart_invariant]);; + + + + + + + + +let SUM_NODE_ISO = prove(`!G H (g:B->A) (r:A->real). isomorphism g (G,H) + ==> (!n. n IN node_set G ==> sum(IMAGE g n) r = sum n (r o g))`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC SUM_IMAGE THEN + MATCH_MP_TAC ISO_NODE_INJ THEN + MAP_EVERY EXISTS_TAC [`G:(B)hypermap`; `H:(A)hypermap`] THEN + ASM_REWRITE_TAC[]);; + + + +let CARD_NODE_ISO = prove(`!G H (g:B->A). isomorphism g (G,H) + ==> (!n. n IN node_set G ==> CARD (IMAGE g n) = CARD n)`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC CARD_IMAGE_INJ THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC ISO_NODE_INJ THEN + MAP_EVERY EXISTS_TAC [`G:(B)hypermap`; `H:(A)hypermap`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`G:(B)hypermap`; `n:B->bool`] Hypermap.lemma_node_representation) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[Hypermap.NODE_FINITE]);; + + +let SUM_NODE_SUB = prove(`!(G:(B)hypermap) r1 r2 n. n IN node_set G + ==> sum n (\x. r1 x - r2 x) = sum n r1 - sum n r2`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`G:(B)hypermap`; `n:B->bool`] Hypermap.lemma_node_representation) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + ASM_SIMP_TAC[Hypermap.NODE_FINITE; SUM_SUB]);; + + +let SUM_NODE_CONST = prove(`!(G:(B)hypermap) c n. n IN node_set G + ==> sum n (\x. c) = &(CARD n) * c`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`G:(B)hypermap`; `n:B->bool`] Hypermap.lemma_node_representation) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + ASM_SIMP_TAC[Hypermap.NODE_FINITE; SUM_CONST]);; + + +let SUM_NODE_SUB_CONST = prove(`!(G:(B)hypermap) r c n. n IN node_set G + ==> sum n (\x. r x - c) = sum n r - &(CARD n) * c`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL SUM_NODE_CONST) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MP_TAC (SPECL [`G:(B)hypermap`; `r:B->real`; `\x:B. c:real`; `n:B->bool`] SUM_NODE_SUB) THEN + ASM_REWRITE_TAC[]);; + + + + + +let ISO_FACE_INJ = prove(`!G H (g:B->A) f. isomorphism g (G,H) /\ f IN face_set G ==> + (!x y. x IN f /\ y IN f /\ g x = g y ==> x = y)`, + REPEAT STRIP_TAC THEN + UNDISCH_TAC `isomorphism (g:B->A) (G,H)` THEN + REWRITE_TAC[isomorphism; BIJ; INJ] THEN + DISCH_THEN (MP_TAC o CONJUNCT1) THEN DISCH_THEN (MP_TAC o CONJUNCT1) THEN + DISCH_THEN (MATCH_MP_TAC o CONJUNCT2) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (ISPECL [`G:(B)hypermap`; `f:B->bool`] Hypermap.lemma_face_representation) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + CONJ_TAC THEN MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `f:B->bool` THEN + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[Hypermap.lemma_face_subset]);; + + +let SUM_FACE_ISO = prove(`!G H (g:B->A) (r:A->real). isomorphism g (G,H) + ==> (!f. f IN face_set G ==> sum(IMAGE g f) r = sum f (r o g))`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC SUM_IMAGE THEN + MATCH_MP_TAC ISO_FACE_INJ THEN + MAP_EVERY EXISTS_TAC [`G:(B)hypermap`; `H:(A)hypermap`] THEN + ASM_REWRITE_TAC[]);; + + + +let CARD_FACE_ISO = prove(`!G H (g:B->A). isomorphism g (G,H) + ==> (!f. f IN face_set G ==> CARD (IMAGE g f) = CARD f)`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC CARD_IMAGE_INJ THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC ISO_FACE_INJ THEN + MAP_EVERY EXISTS_TAC [`G:(B)hypermap`; `H:(A)hypermap`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`G:(B)hypermap`; `f:B->bool`] Hypermap.lemma_face_representation) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[Hypermap.FACE_FINITE]);; + + +let SUM_FACE_SUB = prove(`!(G:(B)hypermap) r1 r2 f. f IN face_set G + ==> sum f (\x. r1 x - r2 x) = sum f r1 - sum f r2`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`G:(B)hypermap`; `f:B->bool`] Hypermap.lemma_face_representation) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + ASM_SIMP_TAC[Hypermap.FACE_FINITE; SUM_SUB]);; + + +let SUM_FACE_CONST = prove(`!(G:(B)hypermap) c f. f IN face_set G + ==> sum f (\x. c) = &(CARD f) * c`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`G:(B)hypermap`; `f:B->bool`] Hypermap.lemma_face_representation) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + ASM_SIMP_TAC[Hypermap.FACE_FINITE; SUM_CONST]);; + + +let SUM_FACE_SUB_CONST = prove(`!(G:(B)hypermap) r c f. f IN face_set G + ==> sum f (\x. r x - c) = sum f r - &(CARD f) * c`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL SUM_FACE_CONST) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MP_TAC (SPECL [`G:(B)hypermap`; `r:B->real`; `\x:B. c:real`; `f:B->bool`] SUM_FACE_SUB) THEN + ASM_REWRITE_TAC[]);; + + + + +let SUM_NODE_LIST = prove(`!L (n:(A#A)list). good_list L /\ MEM n (list_of_nodes L) ==> + sum (set_of_list n) = list_sum n`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[FUN_EQ_THM] THEN X_GEN_TAC `f:(A#A)->real` THEN + MP_TAC (ISPECL [`f:A#A->real`; `n:(A#A)list`] ALL_DISTINCT_SUM) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC ALL_DISTINCT_NODE THEN + EXISTS_TAC `L:((A)list)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[]);; + + + +let SUM_NODE_LIST_ALL = prove(`!L (P:(A#A->bool)->((A#A->real)->real)->bool). good_list L /\ good_list_nodes L ==> + ((!n. n IN node_set (hypermap_of_list L) ==> P n (sum n)) + <=> (!n. MEM n (list_of_nodes L) ==> P (set_of_list n) (list_sum n)))`, + REWRITE_TAC[good_list_nodes] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[IN_SET_OF_LIST; nodes_of_list] THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `set_of_list n:A#A->bool`) THEN + REWRITE_TAC[MEM_MAP] THEN + ANTS_TAC THENL + [ + EXISTS_TAC `n:(A#A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPEC_ALL SUM_NODE_LIST) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN + REWRITE_TAC[MEM_MAP] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:(A#A)list`) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL[`L:((A)list)list`; `x:(A#A)list`] SUM_NODE_LIST) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]));; + + +let CARD_SET_OF_LIST_NODE = prove(`!(L:((A)list)list) n. good_list L /\ MEM n (list_of_nodes L) + ==> CARD(set_of_list n) = LENGTH n`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC CARD_SET_OF_LIST_ALL_DISTINCT THEN + MATCH_MP_TAC ALL_DISTINCT_NODE THEN + EXISTS_TAC `L:((A)list)list` THEN ASM_REWRITE_TAC[]);; + + + + + +let SUM_FACE_LIST = prove(`!L (f:(A#A)list). good_list L /\ MEM f (list_of_faces L) ==> + sum (set_of_list f) = list_sum f`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[FUN_EQ_THM] THEN X_GEN_TAC `r:(A#A)->real` THEN + MP_TAC (ISPECL [`r:A#A->real`; `f:(A#A)list`] ALL_DISTINCT_SUM) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC ALL_DISTINCT_FACE THEN + EXISTS_TAC `L:((A)list)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[]);; + + + +let SUM_FACE_LIST_ALL = prove(`!(L:((A)list)list) P. good_list L ==> + ((!f. f IN face_set (hypermap_of_list L) ==> P f (sum f)) + <=> (!f. MEM f (list_of_faces L) ==> P (set_of_list f) (list_sum f)))`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[FACE_SET_EQ_LIST] THEN + ASM_REWRITE_TAC[IN_SET_OF_LIST; faces_of_list] THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `set_of_list f:A#A->bool`) THEN + REWRITE_TAC[MEM_MAP] THEN + ANTS_TAC THENL + [ + EXISTS_TAC `f:(A#A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPEC_ALL SUM_FACE_LIST) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN + REWRITE_TAC[MEM_MAP] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:(A#A)list`) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL[`L:((A)list)list`; `x:(A#A)list`] SUM_FACE_LIST) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]));; + + + +let CARD_SET_OF_LIST_FACE = prove(`!(L:((A)list)list) f. good_list L /\ MEM f (list_of_faces L) + ==> CARD(set_of_list f) = LENGTH f`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC CARD_SET_OF_LIST_ALL_DISTINCT THEN + MATCH_MP_TAC ALL_DISTINCT_FACE THEN + EXISTS_TAC `L:((A)list)list` THEN ASM_REWRITE_TAC[]);; + + +let IN_DART3_IMP_IN_DART = UNDISCH_ALL (prove(`d:B IN hyp_dart3 G ==> d IN dart G`, + SIMP_TAC[hyp_dart3; IN_ELIM_THM]));; +let IN_DART4_IMP_IN_DART = UNDISCH_ALL (prove(`d:B IN hyp_dart4 G ==> d IN dart G`, + SIMP_TAC[hyp_dart4; IN_ELIM_THM]));; + +let IN_FACE3_IMP_IN_FACE = UNDISCH_ALL (prove(`f IN hyp_face3 (G:(B)hypermap) ==> f IN face_set G`, + SIMP_TAC[hyp_face3; IN_ELIM_THM]));; +let IN_FACE4_IMP_IN_FACE = UNDISCH_ALL (prove(`f IN hyp_face4 (G:(B)hypermap) ==> f IN face_set G`, + SIMP_TAC[hyp_face4; IN_ELIM_THM]));; +let IN_FACE5_IMP_IN_FACE = UNDISCH_ALL (prove(`f IN hyp_face5 (G:(B)hypermap) ==> f IN face_set G`, + SIMP_TAC[hyp_face5; IN_ELIM_THM]));; +let IN_FACE6_IMP_IN_FACE = UNDISCH_ALL (prove(`f IN hyp_face6 (G:(B)hypermap) ==> f IN face_set G`, + SIMP_TAC[hyp_face6; IN_ELIM_THM]));; + + + + +let DART_LIST_ALL = prove(`!(L:((A)list)list) P. good_list L ==> + ((!d. d IN dart (hypermap_of_list L) ==> P d) + <=> (!d. MEM d (list_of_darts L) ==> P d))`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST; darts_of_list; IN_SET_OF_LIST]);; + + +let DART3_LIST_ALL = prove(`!(L:((A)list)list) P. good_list L ==> + ((!d. d IN hyp_dart3 (hypermap_of_list L) ==> P d) + <=> (!d. MEM d (list_of_darts3 L) ==> P d))`, + REPEAT STRIP_TAC THEN ASM_SIMP_TAC[LIST_OF_DARTS3; IN_SET_OF_LIST]);; + + + +let DART4_LIST_ALL = prove(`!(L:((A)list)list) P. good_list L ==> + ((!d. d IN hyp_dart4 (hypermap_of_list L) ==> P d) + <=> (!d. MEM d (list_of_darts4 L) ==> P d))`, + REPEAT STRIP_TAC THEN ASM_SIMP_TAC[LIST_OF_DARTS4; IN_SET_OF_LIST]);; + + +let DARTX_LIST_ALL = prove(`!(L:((A)list)list) P. good_list L ==> + ((!d. d IN hyp_dartX (hypermap_of_list L) ==> P d) + <=> (!d. MEM d (list_of_dartsX L) ==> P d))`, + REPEAT STRIP_TAC THEN ASM_SIMP_TAC[LIST_OF_DARTS_X; IN_SET_OF_LIST]);; + + + +let FACE3_LIST_ALL = prove(`!(L:((A)list)list) P. good_list L ==> + ((!f. f IN hyp_face3 (hypermap_of_list L) ==> P f (sum f)) + <=> (!f. MEM f (list_of_faces3 L) ==> P (set_of_list f) (list_sum f)))`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[LIST_OF_FACES3] THEN + ASM_REWRITE_TAC[IN_SET_OF_LIST; MEM_MAP] THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `set_of_list f:A#A->bool`) THEN + ANTS_TAC THENL + [ + EXISTS_TAC `f:(A#A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPEC_ALL SUM_FACE_LIST) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN + SIMP_TAC[list_of_faces3; MEM_FILTER]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `x:(A#A)list`) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL[`L:((A)list)list`; `x:(A#A)list`] SUM_FACE_LIST) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[list_of_faces3; MEM_FILTER]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]));; + + + +let FACE4_LIST_ALL = prove(`!(L:((A)list)list) P. good_list L ==> + ((!f. f IN hyp_face4 (hypermap_of_list L) ==> P f (sum f)) + <=> (!f. MEM f (list_of_faces4 L) ==> P (set_of_list f) (list_sum f)))`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[LIST_OF_FACES4] THEN + ASM_REWRITE_TAC[IN_SET_OF_LIST; MEM_MAP] THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `set_of_list f:A#A->bool`) THEN + ANTS_TAC THENL + [ + EXISTS_TAC `f:(A#A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPEC_ALL SUM_FACE_LIST) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN + SIMP_TAC[list_of_faces4; MEM_FILTER]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `x:(A#A)list`) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL[`L:((A)list)list`; `x:(A#A)list`] SUM_FACE_LIST) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[list_of_faces4; MEM_FILTER]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]));; + + +let FACE5_LIST_ALL = prove(`!(L:((A)list)list) P. good_list L ==> + ((!f. f IN hyp_face5 (hypermap_of_list L) ==> P f (sum f)) + <=> (!f. MEM f (list_of_faces5 L) ==> P (set_of_list f) (list_sum f)))`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[LIST_OF_FACES5] THEN + ASM_REWRITE_TAC[IN_SET_OF_LIST; MEM_MAP] THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `set_of_list f:A#A->bool`) THEN + ANTS_TAC THENL + [ + EXISTS_TAC `f:(A#A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPEC_ALL SUM_FACE_LIST) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN + SIMP_TAC[list_of_faces5; MEM_FILTER]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `x:(A#A)list`) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL[`L:((A)list)list`; `x:(A#A)list`] SUM_FACE_LIST) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[list_of_faces5; MEM_FILTER]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]));; + + +let FACE6_LIST_ALL = prove(`!(L:((A)list)list) P. good_list L ==> + ((!f. f IN hyp_face6 (hypermap_of_list L) ==> P f (sum f)) + <=> (!f. MEM f (list_of_faces6 L) ==> P (set_of_list f) (list_sum f)))`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[LIST_OF_FACES6] THEN + ASM_REWRITE_TAC[IN_SET_OF_LIST; MEM_MAP] THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `set_of_list f:A#A->bool`) THEN + ANTS_TAC THENL + [ + EXISTS_TAC `f:(A#A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPEC_ALL SUM_FACE_LIST) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN + SIMP_TAC[list_of_faces6; MEM_FILTER]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `x:(A#A)list`) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL[`L:((A)list)list`; `x:(A#A)list`] SUM_FACE_LIST) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[list_of_faces6; MEM_FILTER]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]));; + + + +let EDGE_LIST_ALL = prove(`!(L:((A)list)list) P. good_list L ==> + ((!e. e IN hyp_edge_pairs (hypermap_of_list L) ==> P e) + <=> (!e. MEM e (list_of_edges L) ==> P e))`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[LIST_OF_EDGES; IN_SET_OF_LIST]);; + + +let SUB_CONST_o = prove(`!f (c:real) (g:B->A). (\x. f x - c) o g = (\x. (f o g) x - c)`, + REWRITE_TAC[FUN_EQ_THM; o_THM]);; + + +(*******************************) + + +let in_all_rewrites = +[ + SUM_NODE_LIST_ALL; + SUM_FACE_LIST_ALL; + EDGE_LIST_ALL; + DART_LIST_ALL; + DART3_LIST_ALL; + DART4_LIST_ALL; + DARTX_LIST_ALL; + FACE3_LIST_ALL; + FACE4_LIST_ALL; + FACE5_LIST_ALL; + FACE6_LIST_ALL; +];; + + + +let table_set_hyp = + let table = Hashtbl.create 10 in + let _ = map (uncurry (Hashtbl.add table)) + [ + `hyp_dart3 (G:(B)hypermap)`, IN_DART3_IMP_IN_DART; + `hyp_dart4 (G:(B)hypermap)`, IN_DART4_IMP_IN_DART; + `hyp_face3 (G:(B)hypermap)`, IN_FACE3_IMP_IN_FACE; + `hyp_face4 (G:(B)hypermap)`, IN_FACE4_IMP_IN_FACE; + `hyp_face5 (G:(B)hypermap)`, IN_FACE5_IMP_IN_FACE; + `hyp_face6 (G:(B)hypermap)`, IN_FACE6_IMP_IN_FACE; + ] in + table;; + + + +(*************************************) + + +let iso_dart_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!d. d IN dart H ==> P d) ==> (!d. d IN dart G ==> P (g d)))`, + REWRITE_TAC[isomorphism; BIJ; SURJ] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `d:B`) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `d:B`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `(g:B->A) d`) THEN + ASM_SIMP_TAC[]);; + + +let iso_dart_in = prove(`!(g:B->A) H G d. isomorphism g (G,H) /\ d IN dart G ==> + g d IN dart H`, + REWRITE_TAC[isomorphism; BIJ; SURJ; INJ] THEN + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[]);; + + + +let iso_card_eq = prove(`!(g:B->A) H G s. isomorphism g (G,H) /\ s SUBSET dart G + ==> CARD (IMAGE g s) = CARD s`, + REWRITE_TAC[isomorphism; BIJ; INJ] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC CARD_IMAGE_INJ THEN + CONJ_TAC THENL + [ + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THEN MATCH_MP_TAC IN_TRANS THEN EXISTS_TAC `s:B->bool` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC FINITE_SUBSET THEN + EXISTS_TAC `dart G:B->bool` THEN + ASM_REWRITE_TAC[Hypermap.hypermap_lemma]);; + + +let iso_face_card = prove(`!(g:B->A) H G d. isomorphism g (G,H) /\ d IN dart G + ==> CARD (face H (g d)) = CARD (face G d)`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL COMPONENTS_ISO_IMAGE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `d:B`) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC iso_card_eq THEN + MAP_EVERY EXISTS_TAC [`H:(A)hypermap`; `G:(B)hypermap`] THEN + ASM_SIMP_TAC[Hypermap.lemma_face_subset]);; + + +let iso_dart3_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!d. d IN hyp_dart3 H ==> P d) ==> (!d. d IN hyp_dart3 G ==> P (g d)))`, + REWRITE_TAC[hyp_dart3; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MP_TAC (SPEC_ALL iso_dart_in) THEN + ASM_SIMP_TAC[iso_face_card]);; + + + +let iso_dart4_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!d. d IN hyp_dart4 H ==> P d) ==> (!d. d IN hyp_dart4 G ==> P (g d)))`, + REWRITE_TAC[hyp_dart4; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MP_TAC (SPEC_ALL iso_dart_in) THEN + ASM_SIMP_TAC[iso_face_card]);; + + + +let iso_dartX_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!d. d IN hyp_dartX H ==> P d) ==> (!d. d IN hyp_dartX G ==> P (g d)))`, + REWRITE_TAC[hyp_dartX; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MP_TAC (SPEC_ALL iso_dart_in) THEN + ASM_SIMP_TAC[iso_face_card]);; + + + + +let iso_edge_pairs_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!e. e IN hyp_edge_pairs H ==> P e) ==> (!e. e IN hyp_edge_pairs G ==> P (g (FST e), g (SND e))))`, + REWRITE_TAC[isomorphism; BIJ; SURJ; hyp_edge_pairs; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + EXISTS_TAC `(g:B->A) x` THEN + ASM_SIMP_TAC[]);; + + + + +let iso_node_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!n. n IN node_set H ==> P n) ==> (!n. n IN node_set G ==> P (IMAGE g n)))`, + REPEAT STRIP_TAC THEN + POP_ASSUM (MP_TAC o MATCH_MP Hypermap.lemma_node_representation) THEN + STRIP_TAC THEN + MP_TAC (ISPECL [`g:B->A`; `G:(B)hypermap`; `H:(A)hypermap`; `x:B`] ISOMORPHISM_COMPONENT_IMAGE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[GSYM Hypermap.lemma_in_node_set] THEN + MATCH_MP_TAC iso_dart_in THEN + EXISTS_TAC `G:(B)hypermap` THEN + ASM_REWRITE_TAC[]);; + + + +let iso_face_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!f. f IN face_set H ==> P f) ==> (!f. f IN face_set G ==> P (IMAGE g f)))`, + REPEAT STRIP_TAC THEN + POP_ASSUM (MP_TAC o MATCH_MP Hypermap.lemma_face_representation) THEN + STRIP_TAC THEN + MP_TAC (ISPECL [`g:B->A`; `G:(B)hypermap`; `H:(A)hypermap`; `x:B`] ISOMORPHISM_COMPONENT_IMAGE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[GSYM Hypermap.lemma_in_face_set] THEN + MATCH_MP_TAC iso_dart_in THEN + EXISTS_TAC `G:(B)hypermap` THEN + ASM_REWRITE_TAC[]);; + + +let iso_face3_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!f. f IN hyp_face3 H ==> P f) ==> (!f. f IN hyp_face3 G ==> P (IMAGE g f)))`, + REWRITE_TAC[hyp_face3; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + MP_TAC (SPECL[`g:B->A`; `H:(A)hypermap`; `G:(B)hypermap`] iso_face_trans) THEN + ASM_REWRITE_TAC[] THEN + REPEAT DISCH_TAC THEN + CONJ_TAC THENL + [ + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SPEC_TAC (`f:B->bool`, `f:B->bool`) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL[`G:(B)hypermap`; `f:B->bool`] Hypermap.lemma_face_representation) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + UNDISCH_TAC `CARD (f:B->bool) = 3` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[] THEN + + MP_TAC (SPEC_ALL COMPONENTS_ISO_IMAGE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> ASM_SIMP_TAC[GSYM th]) THEN + MATCH_MP_TAC iso_face_card THEN + ASM_REWRITE_TAC[]);; + + +let iso_face4_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!f. f IN hyp_face4 H ==> P f) ==> (!f. f IN hyp_face4 G ==> P (IMAGE g f)))`, + REWRITE_TAC[hyp_face4; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + MP_TAC (SPECL[`g:B->A`; `H:(A)hypermap`; `G:(B)hypermap`] iso_face_trans) THEN + ASM_REWRITE_TAC[] THEN + REPEAT DISCH_TAC THEN + CONJ_TAC THENL + [ + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SPEC_TAC (`f:B->bool`, `f:B->bool`) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL[`G:(B)hypermap`; `f:B->bool`] Hypermap.lemma_face_representation) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + UNDISCH_TAC `CARD (f:B->bool) = 4` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[] THEN + + MP_TAC (SPEC_ALL COMPONENTS_ISO_IMAGE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> ASM_SIMP_TAC[GSYM th]) THEN + MATCH_MP_TAC iso_face_card THEN + ASM_REWRITE_TAC[]);; + + +let iso_face5_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!f. f IN hyp_face5 H ==> P f) ==> (!f. f IN hyp_face5 G ==> P (IMAGE g f)))`, + REWRITE_TAC[hyp_face5; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + MP_TAC (SPECL[`g:B->A`; `H:(A)hypermap`; `G:(B)hypermap`] iso_face_trans) THEN + ASM_REWRITE_TAC[] THEN + REPEAT DISCH_TAC THEN + CONJ_TAC THENL + [ + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SPEC_TAC (`f:B->bool`, `f:B->bool`) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL[`G:(B)hypermap`; `f:B->bool`] Hypermap.lemma_face_representation) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + UNDISCH_TAC `CARD (f:B->bool) = 5` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[] THEN + + MP_TAC (SPEC_ALL COMPONENTS_ISO_IMAGE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> ASM_SIMP_TAC[GSYM th]) THEN + MATCH_MP_TAC iso_face_card THEN + ASM_REWRITE_TAC[]);; + + +let iso_face6_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!f. f IN hyp_face6 H ==> P f) ==> (!f. f IN hyp_face6 G ==> P (IMAGE g f)))`, + REWRITE_TAC[hyp_face6; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + MP_TAC (SPECL[`g:B->A`; `H:(A)hypermap`; `G:(B)hypermap`] iso_face_trans) THEN + ASM_REWRITE_TAC[] THEN + REPEAT DISCH_TAC THEN + CONJ_TAC THENL + [ + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SPEC_TAC (`f:B->bool`, `f:B->bool`) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL[`G:(B)hypermap`; `f:B->bool`] Hypermap.lemma_face_representation) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + UNDISCH_TAC `CARD (f:B->bool) = 6` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[] THEN + + MP_TAC (SPEC_ALL COMPONENTS_ISO_IMAGE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> ASM_SIMP_TAC[GSYM th]) THEN + MATCH_MP_TAC iso_face_card THEN + ASM_REWRITE_TAC[]);; + + + + +let iso_trans_table = + let table = Hashtbl.create 10 in + let _ = map (uncurry (Hashtbl.add table)) + [ + `dart H:A->bool`, iso_dart_trans; + `node_set (H:(A)hypermap)`, iso_node_trans; + `face_set (H:(A)hypermap)`, iso_face_trans; + `hyp_edge_pairs (H:(A)hypermap)`, iso_edge_pairs_trans; + `hyp_dart3 (H:(A)hypermap)`, iso_dart3_trans; + `hyp_dart4 (H:(A)hypermap)`, iso_dart4_trans; + `hyp_dartX (H:(A)hypermap)`, iso_dartX_trans; + `hyp_face3 (H:(A)hypermap)`, iso_face3_trans; + `hyp_face4 (H:(A)hypermap)`, iso_face4_trans; + `hyp_face5 (H:(A)hypermap)`, iso_face5_trans; + `hyp_face6 (H:(A)hypermap)`, iso_face6_trans; + ] in + table;; + + +(**************************) + + + +let gen_iso_thm ineq = + let x_tm, tm = dest_forall ineq in + let set, p_tm' = dest_binary "==>" tm in + let set_th = Hashtbl.find iso_trans_table (rand set) in + let p_tm = mk_abs (x_tm, p_tm') in + let p_var = mk_var ("P", type_of (rand set)) in + let th3 = (SPEC_ALL (REWRITE_RULE[IMP_IMP] set_th)) in + BETA_RULE (INST[p_tm, p_var] th3);; + + + + + + +let gen_general_ineq ineq = + let iso_th = gen_iso_thm ineq in + (* General rewrites before specifying hypermaps *) + let th0 = UNDISCH_ALL (REWRITE_RULE[GSYM IMP_IMP] iso_th) in + let gen_var, rtm = dest_forall(concl th0) in + let ants = lhand rtm in + let set = rand ants in + let th1 = UNDISCH_ALL (SPEC_ALL th0) in + + let th_rule th = UNDISCH_ALL (SPEC_ALL (UNDISCH_ALL (SPEC_ALL th))) in + + let ths = [ + th_rule SUM_NODE_ISO; + th_rule CARD_NODE_ISO; + th_rule SUM_FACE_ISO; + th_rule CARD_FACE_ISO; + th_rule COMPONENTS_ISO_IMAGE; + th_rule HYPERMAP_MAPS_ISO_IMAGE; + th_rule HYPERMAP_INV_MAPS_ISO_IMAGE; + th_rule HYPERMAP_MAPS_ISO_COMM; + th_rule HYPERMAP_INV_MAPS_ISO_COMM; + SUB_CONST_o; ETA_AX; + th_rule SUM_FACE_SUB_CONST; + ] in + + let th2' = REWRITE_RULE ths th1 in + let th2 = + if (Hashtbl.mem table_set_hyp set) then + PROVE_HYP (Hashtbl.find table_set_hyp set) th2' + else + th2' in + let th3 = GEN gen_var (DISCH ants th2) in + + let s0 = th3 in + + (* G -> hypermap_of_list (L:((num)list)list) *) + (* Instantiate correct types *) + let s1 = INST_TYPE [`:real^3#real^3`, aty; `:num#num`, bty] s0 in + let s2 = INST[`hypermap_of_list (L:((num)list)list)`, `G:(num#num)hypermap`] s1 in + + let th_rule = (UNDISCH_ALL o INST_TYPE [`:num`, aty] o SPEC_ALL o REWRITE_RULE[GSYM IMP_IMP]) in + + let ths = map th_rule in_all_rewrites in + let s3 = REWRITE_RULE ths s2 in + + let gen_var2, rtm = dest_forall(concl s3) in + let ants2 = lhand rtm in + + let s4 = UNDISCH_ALL (SPEC_ALL s3) in + + let ths = + [ + th_rule CARD_SET_OF_LIST_FACE; + th_rule CARD_SET_OF_LIST_NODE; + ] in + + let s5 = REWRITE_RULE ths s4 in + let s6 = GEN gen_var2 (DISCH ants2 s5) in + + (* Deal with basic variables *) + let s7 = INST var_list s6 in + let s8 = INST[`ESTD V`, `E:(real^3->bool)->bool`] s7 in + let s9 = REWRITE_RULE list_var_rewrites s8 in + let r0 = s9 in + + (* Basic rewrites *) + + let ths = + [ + UNDISCH_ALL (INST_TYPE [`:num`, aty] (SPEC_ALL COMPONENTS_HYPERMAP_OF_LIST)); + ] in + let r1 = REWRITE_RULE ths r0 in + + (* Further rewrites *) + let r2 = REWRITE_RULE[darts_of_list; IN_SET_OF_LIST; ALL_MEM] r1 in + r2;; + + + +(***********************) + + +(* + +let get_ineq str = Hashtbl.find constraints str;; + + + +let th = gen_general_ineq (get_ineq "ineq122");; +let th = gen_general_ineq (get_ineq "sol_sum3");; +let th = gen_general_ineq (get_ineq "tau_sum");; +let th = gen_general_ineq (get_ineq "edge_sym");; +let th = gen_general_ineq (get_ineq "ln_def");; +let th = gen_general_ineq (get_ineq "y1_def");; +let th = gen_general_ineq (get_ineq "y2_def");; +let th = gen_general_ineq (get_ineq "y3_def");; +let th = gen_general_ineq (get_ineq "y4_def");; +let th = gen_general_ineq (get_ineq "y5_def");; +let th = gen_general_ineq (get_ineq "y6_def");; +let th = gen_general_ineq (get_ineq "y8_def");; +let th = gen_general_ineq (get_ineq "y9_def");; +let th = gen_general_ineq (get_ineq "RHB");; + + + +let test_list = ref [];; + +let iter_f name ineq = + try + test_list := gen_general_ineq ineq :: !test_list + with x -> + print_string ("problems: "^name^"; ");; + + +Hashtbl.iter iter_f constraints;; + + + + +(********************************) + +let ineq = get_ineq "tau_sum3";; + +let iso_th = gen_iso_thm ineq;; + (* General rewrites before specifying hypermaps *) +let th0 = UNDISCH_ALL (REWRITE_RULE[GSYM IMP_IMP] iso_th);; +let gen_var, rtm = dest_forall(concl th0);; +let ants = lhand rtm;; +let set = rand ants;; +let th1 = UNDISCH_ALL (SPEC_ALL th0);; + +let th_rule th = UNDISCH_ALL (SPEC_ALL (UNDISCH_ALL (SPEC_ALL th)));; + +let ths = [ + th_rule SUM_NODE_ISO; + th_rule CARD_NODE_ISO; + th_rule SUM_FACE_ISO; + th_rule CARD_FACE_ISO; + th_rule COMPONENTS_ISO_IMAGE; + th_rule HYPERMAP_MAPS_ISO_IMAGE; + th_rule HYPERMAP_INV_MAPS_ISO_IMAGE; + th_rule HYPERMAP_MAPS_ISO_COMM; + th_rule HYPERMAP_INV_MAPS_ISO_COMM; + SUB_CONST_o; ETA_AX; + th_rule SUM_FACE_SUB_CONST; +];; + +let th2' = REWRITE_RULE ths th1;; +let th2 = + if (Hashtbl.mem table_set_hyp set) then + PROVE_HYP (Hashtbl.find table_set_hyp set) th2' + else + th2';; + + + let th3 = GEN gen_var (DISCH ants th2);; + + let s0 = th3;; + + (* G -> hypermap_of_list (L:((num)list)list) *) + (* Instantiate correct types *) + let s1 = INST_TYPE [`:real^3#real^3`, aty; `:num#num`, bty] s0;; + let s2 = INST[`hypermap_of_list (L:((num)list)list)`, `G:(num#num)hypermap`] s1;; + + let th_rule = (UNDISCH_ALL o INST_TYPE [`:num`, aty] o SPEC_ALL o REWRITE_RULE[GSYM IMP_IMP]);; + + let ths = map th_rule in_all_rewrites;; + + let s3 = REWRITE_RULE ths s2;; + + let gen_var2, rtm = dest_forall(concl s3);; + let ants2 = lhand rtm;; + + let s4 = UNDISCH_ALL (SPEC_ALL s3);; + + let ths = + [ + th_rule CARD_SET_OF_LIST_FACE; + th_rule CARD_SET_OF_LIST_NODE; + ];; + + let s5 = REWRITE_RULE ths s4;; + let s6 = GEN gen_var2 (DISCH ants2 s5);; + + (* Deal with basic variables *) + let s7 = INST var_list s6;; + let s8 = INST[`ESTD V`, `E:(real^3->bool)->bool`] s7;; + let s9 = REWRITE_RULE list_var_rewrites s8;; + let r0 = s9;; + + (* Basic rewrites *) + + let ths = + [ + UNDISCH_ALL (INST_TYPE [`:num`, aty] (SPEC_ALL COMPONENTS_HYPERMAP_OF_LIST)); + ];; + let r1 = REWRITE_RULE ths r0;; + + (* Further rewrites *) + let r2 = REWRITE_RULE[darts_of_list; IN_SET_OF_LIST; ALL_MEM] r1 + r2;; + + + +*) + +(*********************************************************) + +(* Integral approximation of inequalities and equalities *) + +let mk_decimal (n,m) = + let tm = mk_comb(mk_comb(`DECIMAL`, mk_numeral (abs_num n)), mk_numeral m) in + if (n []) then inst_th sum_th1 else inst_th sum_th2 in + let th2 = split_sum_raw_conv (rand(concl th1)) in + TRANS th1 th2 + else + let inst_th = INST[xy_tm, x_var_real; b_tm, b_var_real; c_tm, c_var_real] in + if (frees xy_tm <> []) then inst_th sum_th1' else inst_th sum_th2' in + + let th0 = INST[tm, x_var_real] sum_th0 in + let th1 = split_sum_raw_conv (rand(concl th0)) in + TRANS th0 th1;; + + + +let rearrange_mul_conv tm = + let rec dest_mul tm = + if (is_binop mul_op_real tm) then + let lhs, rhs = dest_binop mul_op_real tm in + let cs, vars = dest_mul rhs in + if (frees lhs = []) then + lhs::cs, vars + else + cs, lhs::vars + else + if (frees tm = []) then + [tm], [] + else + [], [tm] in + let mk_mul list = + if (list = []) then failwith "rearrange_mul: empty list" + else itlist (fun l r -> mk_binop mul_op_real l r) (tl list) (hd list) in + + let cs, vars = dest_mul tm in + let cs_mul, vars_mul = mk_mul cs, mk_mul vars in + let t = mk_eq(tm, mk_binop mul_op_real cs_mul vars_mul) in + EQT_ELIM (REWRITE_CONV[REAL_MUL_AC] t);; + + + +let le_add_th = REAL_ARITH `x + y <= b + c <=> x - b <= c - y:real`;; + +(* Moves everything with free variables on the left and performs basic reductions *) +let ineq_rewrite_conv = REWRITE_CONV[real_ge; real_div; DECIMAL] THENC + LAND_CONV REAL_POLY_CONV THENC RAND_CONV REAL_POLY_CONV THENC + LAND_CONV split_sum_conv THENC RAND_CONV split_sum_conv THENC + ONCE_REWRITE_CONV[le_add_th] THENC + LAND_CONV REAL_POLY_CONV THENC RAND_CONV REAL_POLY_CONV THENC + REWRITE_CONV[GSYM real_div] THENC + ONCE_DEPTH_CONV rearrange_mul_conv;; + + +(* Approximation *) + +let le_mul1_th = REAL_ARITH `!x. &1 * x <= x`;; +let ge_mul1_th = REAL_ARITH `!x. x <= &1 * x`;; +let INTERVAL_LO = prove(`interval_arith x (a,b) ==> a <= x`, SIMP_TAC[interval_arith]);; +let INTERVAL_HI = prove(`interval_arith x (a,b) ==> x <= b`, SIMP_TAC[interval_arith]);; + +let rec low_approx tm precision = + let low_approx1 tm precision = + if (is_binop mul_op_real tm && frees tm <> []) then + let c, var = dest_binop mul_op_real tm in + let interval_th = approx_interval (create_interval c) precision in + let l_th = MATCH_MP INTERVAL_LO interval_th in + let a, b = dest_binop le_op_real (concl l_th) in + (PROVE_HYP l_th o UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o SPECL[a; b; var]) REAL_LE_RMUL + else + if (frees tm = []) then + MATCH_MP INTERVAL_LO (approx_interval (create_interval tm) precision) + else + SPEC tm le_mul1_th in + + if (is_binop add_op_real tm && frees tm <> []) then + let lhs, rhs = dest_binop add_op_real tm in + let l_th = low_approx1 lhs precision in + let r_th = low_approx rhs precision in + MATCH_MP REAL_LE_ADD2 (CONJ l_th r_th) + else + low_approx1 tm precision;; + + +let rec hi_approx tm precision = + let hi_approx1 tm precision = + if (is_binop mul_op_real tm && frees tm <> []) then + let c, var = dest_binop mul_op_real tm in + let interval_th = approx_interval (create_interval c) precision in + let h_th = MATCH_MP INTERVAL_HI interval_th in + let a, b = dest_binop le_op_real (concl h_th) in + (PROVE_HYP h_th o UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o SPECL[a; b; var]) REAL_LE_RMUL + else + if (frees tm = []) then + MATCH_MP INTERVAL_HI (approx_interval (create_interval tm) precision) + else + SPEC tm ge_mul1_th in + + if (is_binop add_op_real tm && frees tm <> []) then + let lhs, rhs = dest_binop add_op_real tm in + let l_th = hi_approx1 lhs precision in + let r_th = hi_approx rhs precision in + MATCH_MP REAL_LE_ADD2 (CONJ l_th r_th) + else + hi_approx1 tm precision;; + + + +let approx_le_ineq precision tm = + let lhs, rhs = dest_binop le_op_real tm in + let lhs_th = low_approx lhs precision in + let rhs_th = hi_approx rhs precision in + let ll, lr = dest_binop le_op_real (concl lhs_th) in + let rl, rr = dest_binop le_op_real (concl rhs_th) in + + let th0 = ASSUME tm in + let th1 = SPECL[ll; lr; rhs] REAL_LE_TRANS in + let th2 = SPECL[ll; rhs; rr] REAL_LE_TRANS in + let s1 = MATCH_MP th1 (CONJ lhs_th th0) in + MATCH_MP th2 (CONJ s1 rhs_th);; + + +let integer_approx_le_ineq precision ineq = + let lhs, rhs = dest_binop le_op_real ineq in + let m = (Int 10 **/ Int precision) in + let m_num, m_real = mk_numeral m, term_of_rat m in + let m_pos = SPEC m_num REAL_POS in + let mul_th = SPECL[m_real; lhs; rhs] REAL_LE_LMUL in + let th0 = MATCH_MP mul_th (CONJ m_pos (ASSUME ineq)) in + let th1 = (CONV_RULE ineq_rewrite_conv) th0 in + let approx = approx_le_ineq 0 (concl th1) in + PROVE_HYP th1 approx;; + + +let create_approximations precision_list ineq = + let ineq_th = ineq_rewrite_conv ineq in + let rhs = rand(concl ineq_th) in + let th0 = CONV_RULE (LAND_CONV (REWRITE_CONV[DECIMAL] THENC REAL_POLY_CONV)) + (approx_le_ineq 8 rhs) in + + let int_approx p = + let th1 = integer_approx_le_ineq p (concl th0) in + let th2 = PROVE_HYP th0 th1 in + let th3 = DISCH rhs th2 in + REWRITE_RULE[GSYM ineq_th] th3 in + + map int_approx precision_list;; + +(**********************************) + + +(* +let tm = `(&34/ &13 + pi/sol0)* x + &2 + -- &14 / &3 * z <= pi + rho218 + z * sol0 - u / &1000`;; +create_approximations [3;4;5] tm;; +*) + + +(*************************) + +(* Additional step for generalizing hypotheses *) + + +let LIST_SUM_LMUL = prove(`!(f:A->real) c n. list_sum n (\x. c * f x) = c * list_sum n f`, + GEN_TAC THEN GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[list_sum; ITLIST; REAL_MUL_RZERO] THEN + ASM_REWRITE_TAC[GSYM list_sum; REAL_ADD_LDISTRIB]);; + + +let le_hyp_gen = prove(`!f y. (!x. &0 <= f x) ==> &0 <= f y`, SIMP_TAC[]);; +let le_list_sum_hyp_gen = prove(`!(f:A->real) n. (!x. &0 <= f x) ==> &0 <= list_sum n f`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[list_sum] THEN + SPEC_TAC (`n:(A)list`, `n:(A)list`) THEN + LIST_INDUCT_TAC THEN REWRITE_TAC[ITLIST; REAL_LE_REFL] THEN + MATCH_MP_TAC REAL_LE_ADD THEN + ASM_REWRITE_TAC[]);; + + + +let generalize_hyp th = + let gen_hyp = fun tm -> + let fn, arg = dest_comb (rand tm) in + if (is_comb fn && is_const (rator fn) && (fst o dest_const o rator) fn = "list_sum") then + let f, n = arg, rand fn in + UNDISCH_ALL (ISPECL[f; n] le_list_sum_hyp_gen) + else + UNDISCH_ALL (ISPECL[fn; arg] le_hyp_gen) in + + let hyp_ths = map gen_hyp (hyp th) in + itlist PROVE_HYP hyp_ths th;; + + +(* +let tm = `list_sum n (\x. s x * r) + &1 / &3 * (azim_dart (V,E) o g) x <= pi`;; +let ths = create_approximations [3] tm;; +map generalize_hyp ths;; +*) + + +(*******************************) + + +let generate_ineqs precision_list ineq = + + let create_approxs original_th precision_list = + let var, ineq = (dest_abs o rand o rator o concl) original_th in + let final_step = fun approx_th -> + let p_tm', q_tm' = dest_imp (concl approx_th) in + let p_tm, q_tm = mk_abs(var, p_tm'), mk_abs(var, q_tm') in + let list_tm = (rand o concl) original_th in + let mono_th = BETA_RULE (ISPECL[p_tm; q_tm; list_tm] (GEN_ALL MONO_ALL)) in + let s1 = MATCH_MP mono_th (GEN var approx_th) in + MATCH_MP s1 original_th in + + let approx_ths0 = map generalize_hyp (create_approximations precision_list ineq) in + let approx_ths1 = map (itlist PROVE_HYP list_var_pos) approx_ths0 in + let approx_ths = map (REWRITE_RULE[GSYM LIST_SUM_LMUL]) approx_ths1 in + map final_step approx_ths in + + + let ineq_th = gen_general_ineq ineq in + let ineq = (snd o dest_abs o rand o rator o concl) ineq_th in + if (is_eq ineq) then + let eq_th = REWRITE_RULE[GSYM REAL_LE_ANTISYM; GSYM AND_ALL] ineq_th in + let ths1 = create_approxs (CONJUNCT1 eq_th) precision_list in + let ths2 = create_approxs (CONJUNCT2 eq_th) precision_list in + ths1, ths2 + else + create_approxs ineq_th precision_list, [];; + + + + +(*********************************************************************) + +(* Table containing all inequalities *) +let ineq_table = Array.init 6 (fun i -> Hashtbl.create 10);; +let ineq_test_table = Array.init 6 (fun i -> Hashtbl.create 10);; + + + +let DECIMAL_INT = prove(`!n. DECIMAL n 1 = &n`, REWRITE_TAC[DECIMAL; REAL_DIV_1]);; + + +let add_everything_to_table table = + let add_approximations_to_table = fun name ineq -> + let approxs', neg_approxs' = generate_ineqs [3;4;5] ineq in + let approxs = zip (3--5) approxs' in + let neg_approxs = if (neg_approxs' = []) then [] else zip (3--5) neg_approxs' in + let r = CONV_RULE (REWRITE_CONV[DECIMAL_INT] THENC DEPTH_CONV Arith_hash.NUMERAL_TO_NUM_CONV) in + let _ = map (fun (i, t) -> Hashtbl.add (ineq_test_table.(i)) name t; + Hashtbl.add (ineq_table.(i)) name (r t)) approxs in + let _ = map (fun (i, t) -> Hashtbl.add (ineq_test_table.(i)) (name^"_neg") t; + Hashtbl.add (ineq_table.(i)) (name^"_neg") (r t)) neg_approxs in + () in + + Hashtbl.iter (fun name ineq -> add_approximations_to_table name ineq) table;; + + +let find_ineq precision name = Hashtbl.find ineq_table.(precision) name;; +let find_test_ineq precision name = Hashtbl.find ineq_test_table.(precision) name;; + + + +(* Generate and add inequalities for constraints *) +add_everything_to_table constraints;; +add_everything_to_table var_bound_ineqs;; + + +(**************************) + + +(* +generate_ineqs [4] (get_ineq "ineq112");; + +Hashtbl.iter (fun name ineq -> let _ = generate_ineqs[3;4;5] ineq in ()) constraints;; +*) + +(***************) +(*********************) + diff --git a/formal_lp/old/hypermap/list_conversions.hl b/formal_lp/old/hypermap/list_conversions.hl new file mode 100644 index 0000000..9af0a01 --- /dev/null +++ b/formal_lp/old/hypermap/list_conversions.hl @@ -0,0 +1,531 @@ +needs "../formal_lp/hypermap/list_hypermap_defs.hl";; + +#load "unix.cma";; +(* +itlist_conv_univ;; +el_conv;; +*) + +let test n f x = + let start = Unix.gettimeofday() in + for i = 1 to n do + let _ = f x in () + done; + Unix.time() -. start;; + + + +let t_const = `T` and + f_const = `F`;; + +let MY_PROVE_HYP hyp th = EQ_MP (DEDUCT_ANTISYM_RULE hyp th) hyp;; + + + +(******************************) + +(* HD conversions *) + +let HD_A_CONS = prove(`HD (CONS (h:A) t) = h`, REWRITE_TAC[HD]);; + +let hd_conv tm = + let h_tm', t_tm = dest_comb(rand tm) in + let h_tm = rand h_tm' in + let list_ty = type_of t_tm in + let ty = type_of h_tm in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", list_ty) in + INST[h_tm, h_var; t_tm, t_var] (INST_TYPE[ty, aty] HD_A_CONS);; + +(* +let tm = `HD [1;2;3;4]`;; +(* 0.072 *) +test 1000 (REWRITE_CONV[HD]) tm;; +(* 0.016 *) +test 1000 hd_conv tm;; +*) + + + + + + + + +(*******************************) + +(* FST, SND conversions *) + + +let FST' = ISPECL[`x:A`; `y:B`] FST;; +let SND' = ISPECL[`x:A`; `y:B`] SND;; + + +let fst_conv tm = + let x_tm, y_tm = dest_pair (rand tm) in + let x_ty, y_ty = type_of x_tm, type_of y_tm in + let x_var, y_var = mk_var("x", x_ty), mk_var("y", y_ty) in + (INST[x_tm, x_var; y_tm, y_var] o INST_TYPE[x_ty, aty; y_ty, bty]) FST';; + +let snd_conv tm = + let x_tm, y_tm = dest_pair (rand tm) in + let x_ty, y_ty = type_of x_tm, type_of y_tm in + let x_var, y_var = mk_var("x", x_ty), mk_var("y", y_ty) in + (INST[x_tm, x_var; y_tm, y_var] o INST_TYPE[x_ty, aty; y_ty, bty]) SND';; + + +(* +let tm = `FST (1,2)`;; +fst_conv tm;; + +(* 0.688 *) +test 10000 (REWRITE_CONV[]) tm;; +(* 0.100 *) +test 10000 fst_conv tm;; +*) + + +(******************************) + +(* LENGTH conversions *) + +let LENGTH_A_EMPTY = prove(`LENGTH ([]:(A)list) = 0`, REWRITE_TAC[LENGTH]) and + LENGTH_A_CONS = prove(`LENGTH (CONS (h:A) t) = SUC (LENGTH t)`, REWRITE_TAC[LENGTH]);; + +let suc_const = `SUC`;; + + +let length_conv_univ suc_conv tm = + let list_tm = rand tm in + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let inst_t = INST_TYPE[ty, aty] in + let length_empty, length_cons = inst_t LENGTH_A_EMPTY, inst_t LENGTH_A_CONS in + let h_var, t_var = mk_var("h", ty), mk_var("t", list_ty) in + + let rec length_conv_raw = fun list_tm -> + if (is_comb list_tm) then + let ltm, t_tm = dest_comb list_tm in + let h_tm = rand ltm in + let th0 = INST[h_tm, h_var; t_tm, t_var] length_cons in + let th1' = length_conv_raw t_tm in + let th1 = AP_TERM suc_const th1' in + let th2 = suc_conv (rand(concl th1)) in + TRANS (TRANS th0 th1) th2 + else + length_empty in + + length_conv_raw list_tm;; + + +(* +let tm = `LENGTH [&1;&4;&4;&6;&7 * &8]`;; + +test 1000 (REWRITE_CONV[LENGTH; ARITH_SUC]) tm;; (* 0.792 *) +test 1000 (length_conv_univ NUM_SUC_CONV) tm;; (* 0.104 *) +*) + + +(******************************) + +(* MEM conversions *) + +let MEM_A_EMPTY = prove(`MEM (x:A) [] <=> F`, REWRITE_TAC[MEM]) and + MEM_A_HD = UNDISCH_ALL (prove(`(x = h <=> T) ==> (MEM (x:A) (CONS h t) <=> T)`,SIMP_TAC[MEM])) and + MEM_A_TL = UNDISCH_ALL (prove(`(x = h <=> F) ==> (MEM (x:A) (CONS h t) <=> MEM x t)`, SIMP_TAC[MEM]));; + + + + +let rec mem_conv_univ eq_conv tm = + let ltm, list_tm = dest_comb tm in + let x_tm = rand ltm in + let ty = type_of x_tm in + let inst_t = INST_TYPE[ty, aty] in + let mem_empty, mem_hd, mem_tl = inst_t MEM_A_EMPTY, inst_t MEM_A_HD, inst_t MEM_A_TL in + let x_var, h_var = mk_var("x", ty), mk_var("h", ty) in + let t_var = mk_var("t", mk_type("list", [ty])) in + + let rec mem_conv_raw list_tm = + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let eq_th = eq_conv (mk_eq(x_tm, h_tm)) in + if (rand(concl eq_th) = t_const) then + let th0' = INST[x_tm, x_var; h_tm, h_var; t_tm, t_var] mem_hd in + MY_PROVE_HYP eq_th th0' + else + let th0' = INST[x_tm, x_var; h_tm, h_var; t_tm, t_var] mem_tl in + let th0 = MY_PROVE_HYP eq_th th0' in + let th1 = mem_conv_raw t_tm in + TRANS th0 th1 + else + INST[x_tm, x_var] mem_empty in + + mem_conv_raw list_tm;; + + +(* +let tm = `MEM 11 [1;2;3;4;5;6;4;5;6;7;3;4;4;6;8;9;10]`;; +mem_conv_univ (PURE_REWRITE_CONV[ARITH_EQ]) tm;; + +test 100 (mem_conv_univ (REWRITE_CONV[ARITH_EQ])) tm;; (* 0.176 *) +test 100 (REWRITE_CONV[MEM; ARITH_EQ]) tm;; (* 0.352 *) +*) + + +(**********************************) + +(* FILTER conversions *) + +let FILTER_A_EMPTY = prove(`FILTER (P:A->bool) [] = []`, REWRITE_TAC[FILTER]) and + FILTER_A_HD = UNDISCH_ALL (prove(`(P h <=> T) ==> FILTER (P:A->bool) (CONS h t) = CONS h (FILTER P t)`, SIMP_TAC[FILTER])) and + FILTER_A_TL = UNDISCH_ALL (prove(`(P h <=> F) ==> FILTER (P:A->bool) (CONS h t) = FILTER P t`, SIMP_TAC[FILTER]));; + + + +let filter_conv_univ p_conv tm = + let ltm, list_tm = dest_comb tm in + let p_tm = rand ltm in + let p_ty = type_of p_tm in + let ty = (hd o snd o dest_type) p_ty in + let inst_t = INST_TYPE[ty, aty] in + let filter_empty, filter_hd, filter_tl = + inst_t FILTER_A_EMPTY, inst_t FILTER_A_HD, inst_t FILTER_A_TL in + let p_var = mk_var("P", p_ty) in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", mk_type("list",[ty])) in + + let rec filter_conv_raw = fun list_tm -> + if (is_comb list_tm) then + let ltm, t_tm = dest_comb list_tm in + let h_tm = rand ltm in + let p_th = p_conv (mk_comb(p_tm, h_tm)) in + if (rand(concl p_th) = t_const) then + let th0' = INST[p_tm, p_var; h_tm, h_var; t_tm, t_var] filter_hd in + let th0 = MY_PROVE_HYP p_th th0' in + let ltm = rator(rand(concl th0)) in + let th1 = filter_conv_raw t_tm in + TRANS th0 (AP_TERM ltm th1) + else + let th0' = INST[p_tm, p_var; h_tm, h_var; t_tm, t_var] filter_tl in + let th0 = MY_PROVE_HYP p_th th0' in + let th1 = filter_conv_raw t_tm in + TRANS th0 th1 + else + INST[p_tm, p_var] filter_empty in + + filter_conv_raw list_tm;; + + + + +(* +let tm = `FILTER (\n. n = 2 \/ n = 3) [1;2;3;4;2;3;1]`;; + +REWRITE_CONV[FILTER; ARITH_EQ] tm;; +filter_conv_univ (REWRITE_CONV[ARITH_EQ]) tm;; + +test 100 (REWRITE_CONV[FILTER; ARITH_EQ]) tm;; (* 7.596 *) +test 100 (filter_conv_univ (REWRITE_CONV[ARITH_EQ])) tm;; (* 0.236 *) +*) + +(***************************) + +(* FLATTEN conversions *) + +let FLATTEN_A_EMPTY = prove(`FLATTEN ([]:((A)list)list) = []`, REWRITE_TAC[FLATTEN; ITLIST; APPEND]) and + FLATTEN_A_CONS_EMPTY = prove(`FLATTEN (CONS ([]:(A)list) tt) = FLATTEN tt`, REWRITE_TAC[FLATTEN; ITLIST; APPEND]) and + FLATTEN_A_CONS_CONS = prove(`FLATTEN (CONS (CONS (h:A) t) tt) = CONS h (FLATTEN (CONS t tt))`, REWRITE_TAC[FLATTEN; ITLIST; APPEND]);; + + + +(* Works for any list of lists *) +let flatten_conv_univ tm = + let list_list_tm = rand tm in + let list_list_ty = type_of list_list_tm in + let list_ty = (hd o snd o dest_type) list_list_ty in + let ty = (hd o snd o dest_type) list_ty in + let inst_t = INST_TYPE[ty, aty] in + let flatten_empty, flatten_cons_empty, flatten_cons_cons = + inst_t FLATTEN_A_EMPTY, inst_t FLATTEN_A_CONS_EMPTY, inst_t FLATTEN_A_CONS_CONS in + let tt_var = mk_var("tt", list_list_ty) in + let t_var = mk_var("t", list_ty) in + let h_var = mk_var("h", ty) in + + let rec flatten_conv_raw list_list_tm = + if (is_comb list_list_tm) then + let hh_tm', tt_tm = dest_comb list_list_tm in + let hh_tm = rand hh_tm' in + if (is_comb hh_tm) then + let h_tm', t_tm = dest_comb hh_tm in + let h_tm = rand h_tm' in + let th0 = INST[h_tm, h_var; t_tm, t_var; tt_tm, tt_var] flatten_cons_cons in + let ltm, rtm = dest_comb(rand(concl th0)) in + let th1 = AP_TERM ltm (flatten_conv_raw (rand rtm)) in + TRANS th0 th1 + else + let th0 = INST[tt_tm, tt_var] flatten_cons_empty in + let th1 = flatten_conv_raw tt_tm in + TRANS th0 th1 + else + flatten_empty in + + flatten_conv_raw list_list_tm;; + + +(* +let tm = `FLATTEN [[1;2;3];[3];[4;5;2;1;6;7]]`;; +flatten_conv_univ tm;; +REWRITE_CONV[FLATTEN; ITLIST; APPEND] tm;; + +test 100 (REWRITE_CONV[FLATTEN; ITLIST; APPEND]) tm;; (* 0.348 *) +test 100 (flatten_conv_univ) tm;; (* 0.028 *) +*) + + +(***************************) + +(* MAP conversions *) + + +let MAP_AB_EMPTY = prove(`MAP (f:A->B) [] = []`, REWRITE_TAC[MAP]) and + MAP_AB_CONS = prove(`MAP (f:A->B) (CONS h t) = CONS (f h) (MAP f t)`, REWRITE_TAC[MAP]);; + + +let map_conv_univ f_conv tm = + let ltm, list_tm = dest_comb tm in + let ftm = rand ltm in + let ftm_ty = type_of ftm in + let f_var = mk_var("f", ftm_ty) in + let [a_type; b_type] = snd(dest_type ftm_ty) in + let h_var = mk_var("h", a_type) in + let t_var = mk_var("t", mk_type("list", [a_type])) in + let inst_t = INST[ftm, f_var] o INST_TYPE[a_type, aty; b_type, bty] in + let map_empty, map_cons = + inst_t MAP_AB_EMPTY, inst_t MAP_AB_CONS in + + let rec map_conv_raw list_tm = + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let th0 = INST[h_tm, h_var; t_tm, t_var] map_cons in + let ltm, rtm = dest_comb (rand(concl th0)) in + let cons_tm, f_h_tm = dest_comb ltm in + let f_h_th = f_conv f_h_tm in + let map_t_th = map_conv_raw t_tm in + TRANS th0 (MK_COMB (AP_TERM cons_tm f_h_th, map_t_th)) + else + map_empty in + + map_conv_raw list_tm;; + + +(* +let tm = `MAP (\x. x + 1) [1;2;3;4;5;6;7;8;9;10;11]`;; + +REWRITE_CONV[MAP] tm;; +map_conv_univ BETA_CONV tm;; + +test 100 (REWRITE_CONV[MAP]) tm;; (* 0.464 *) +test 100 (map_conv_univ BETA_CONV) tm;; (* 0.04 *) + +test 100 (map_conv_univ (BETA_CONV THENC NUM_ADD_CONV)) tm;; (* 0.096 *) +*) + + +(*****************************************) + +(* ALL rules *) + + +let ALL_A_HD = UNDISCH_ALL(prove(`ALL (P:A->bool) (CONS h t) ==> P h`, SIMP_TAC[ALL])) and + ALL_A_TL = UNDISCH_ALL(prove(`ALL (P:A->bool) (CONS h t) ==> ALL P t`, SIMP_TAC[ALL]));; + + +(* Given a theorem `ALL P list` returns the list of theorems (P x1),...,(P xn) *) +let get_all th = + let ltm, list_tm = dest_comb (concl th) in + let p_tm = rand ltm in + let list_ty = type_of list_tm in + let p_ty = type_of p_tm in + let ty = (hd o snd o dest_type) list_ty in + let p_var = mk_var("P", p_ty) in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", list_ty) in + + let inst_t = INST[p_tm, p_var] o INST_TYPE[ty, aty] in + let all_hd, all_tl = inst_t ALL_A_HD, inst_t ALL_A_TL in + + let rec get_all_raw all_th list_tm = + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let inst_t = INST[h_tm, h_var; t_tm, t_var] in + let th_tl = MY_PROVE_HYP all_th (inst_t all_tl) in + let th_hd = MY_PROVE_HYP all_th (inst_t all_hd) in + th_hd :: get_all_raw th_tl t_tm + else + [] in + + get_all_raw th list_tm;; + + + +(* Given a theorem `ALL P list`, returns (P x_i1),..., (P x_in) + where i1,...,in are given indices. + The list of indices should be sorted *) +let select_all th indices = + let ltm, list_tm = dest_comb (concl th) in + let p_tm = rand ltm in + let list_ty = type_of list_tm in + let p_ty = type_of p_tm in + let ty = (hd o snd o dest_type) list_ty in + let p_var = mk_var("P", p_ty) in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", list_ty) in + + let inst_t = INST[p_tm, p_var] o INST_TYPE[ty, aty] in + let all_hd, all_tl = inst_t ALL_A_HD, inst_t ALL_A_TL in + + let rec get_all_raw all_th list_tm indices n = + match indices with + [] -> [] + | i::is -> + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let inst_t = INST[h_tm, h_var; t_tm, t_var] in + let th_tl = MY_PROVE_HYP all_th (inst_t all_tl) in + + if (i - n = 0) then + let th_hd = MY_PROVE_HYP all_th (inst_t all_hd) in + th_hd :: get_all_raw th_tl t_tm is (n + 1) + else + get_all_raw th_tl t_tm (i::is) (n + 1) in + + get_all_raw th list_tm indices 0;; + + +(* +let tm = `ALL (\x. x > 3) [4; 5; 8; 10; 5; 4]`;; +let th = (EQT_ELIM o REWRITE_CONV[ALL; ARITH]) tm;; + +(* 0.192 *) +test 100 (CONJUNCTS o REWRITE_RULE[ALL]) th;; +(* 0.016 *) +test 100 (get_all) th;; +(* 0.012 *) +test 100 (select_all th) [2;3;4];; +*) + + + +(*************************************) + +(* list_sum conversions *) + + +let LIST_SUM_A_EMPTY = prove(`list_sum [] (f:A->real) = &0`, REWRITE_TAC[list_sum; ITLIST]) and + LIST_SUM_A_H = prove(`list_sum [h:A] f = f h`, REWRITE_TAC[list_sum; ITLIST; REAL_ADD_RID]) and + LIST_SUM_A_CONS = prove(`list_sum (CONS (h:A) t) f = f h + list_sum t f`, REWRITE_TAC[list_sum; ITLIST]);; + + +let list_sum_conv f_conv tm = + let ltm, f_tm = dest_comb tm in + let list_tm = rand ltm in + let list_ty = type_of list_tm in + let f_ty = type_of f_tm in + let ty = (hd o snd o dest_type) list_ty in + let f_var = mk_var("f", f_ty) and + h_var = mk_var("h", ty) and + t_var = mk_var("t", list_ty) in + let inst_t = INST[f_tm, f_var] o INST_TYPE[ty, aty] in + let list_sum_h = inst_t LIST_SUM_A_H and + list_sum_cons = inst_t LIST_SUM_A_CONS in + + let rec list_sum_conv_raw = fun h_tm t_tm -> + if (is_comb t_tm) then + let h_tm', t_tm' = dest_comb t_tm in + let th0 = INST[h_tm, h_var; t_tm, t_var] list_sum_cons in + let ltm, rtm = dest_comb(rand(concl th0)) in + let plus_op, fh_tm = dest_comb ltm in + let f_th = f_conv fh_tm in + let th1 = list_sum_conv_raw (rand h_tm') t_tm' in + let th2 = MK_COMB(AP_TERM plus_op f_th, th1) in + TRANS th0 th2 + else + let th0 = INST[h_tm, h_var] list_sum_h in + let f_th = f_conv (rand(concl th0)) in + TRANS th0 f_th in + + if (is_comb list_tm) then + let h_tm, t_tm = dest_comb list_tm in + list_sum_conv_raw (rand h_tm) t_tm + else + inst_t LIST_SUM_A_EMPTY;; + + + + +(* +let tm = `list_sum [&1; &3; &4; pi; #0.1] cos`;; + +list_sum_conv ALL_CONV tm;; + +(* 2.812 *) +test 1000 (REWRITE_CONV[list_sum; ITLIST; REAL_ADD_RID]) tm;; +(* 0.076 *) +test 1000 (list_sum_conv ALL_CONV) tm;; + + +let tm = `list_sum [&1; &3; &4; pi; #0.1] (\x. cos x)`;; +(* 0.104 *) +test 1000 (list_sum_conv BETA_CONV) tm;; +*) + + + +(*****************************************) + +(* set_of_list conversions *) + +let SET_OF_LIST_A_EMPTY = prove(`set_of_list ([]:(A)list) = {}`, REWRITE_TAC[set_of_list]) and + SET_OF_LIST_A_H = prove(`set_of_list [h:A] = {h}`, REWRITE_TAC[set_of_list]) and + SET_OF_LIST_A_CONS = prove(`set_of_list (CONS (h:A) t) = h INSERT set_of_list t`, REWRITE_TAC[set_of_list]);; + + + +let set_of_list_conv tm = + let list_tm = rand tm in + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", list_ty) in + let inst_t = INST_TYPE[ty, aty] in + let set_of_list_h, set_of_list_cons = inst_t SET_OF_LIST_A_H, inst_t SET_OF_LIST_A_CONS in + + let rec set_of_list_conv_raw = fun h_tm t_tm -> + if (is_comb t_tm) then + let h_tm', t_tm' = dest_comb t_tm in + let th0 = INST[h_tm, h_var; t_tm, t_var] set_of_list_cons in + let ltm, rtm = dest_comb(rand(concl th0)) in + TRANS th0 (AP_TERM ltm (set_of_list_conv_raw (rand h_tm') t_tm')) + else + INST[h_tm, h_var] set_of_list_h in + + if (is_comb list_tm) then + let h_tm, t_tm = dest_comb list_tm in + set_of_list_conv_raw (rand h_tm) t_tm + else + inst_t SET_OF_LIST_A_EMPTY;; + + + +(* +let tm = `set_of_list [&1; &5; &6; &3; &5; &8; &9]`;; + +(* 0.872 *) +test 1000 (REWRITE_CONV[set_of_list]) tm;; +(* 0.076 *) +test 1000 set_of_list_conv tm;; +*) diff --git a/formal_lp/old/hypermap/list_hypermap.hl b/formal_lp/old/hypermap/list_hypermap.hl new file mode 100644 index 0000000..ffc82dc --- /dev/null +++ b/formal_lp/old/hypermap/list_hypermap.hl @@ -0,0 +1,2514 @@ +needs "../formal_lp/hypermap/list_hypermap_defs.hl";; + + +open Sphere;; +(* For IMAGE_LEMMA *) +open Hypermap_and_fan;; + +let REMOVE_ASSUM = POP_ASSUM (fun th -> ALL_TAC);; + +let IN_TRANS = prove(`!(x:A) s t. t SUBSET s /\ x IN t ==> x IN s`, + SET_TAC[]);; + +let LENGTH_ZIP = prove(`!(l1:(A)list) (l2:(B)list). LENGTH l1 = LENGTH l2 ==> LENGTH (ZIP l1 l2) = LENGTH l1`, + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[LENGTH; ZIP; NOT_SUC; GSYM NOT_SUC] THEN + REWRITE_TAC[SUC_INJ] THEN + DISCH_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]);; + + + +let MEM_ZIP = prove(`!(i:A) (j:B) l1 l2. LENGTH l1 = LENGTH l2 /\ MEM (i,j) (ZIP l1 l2) ==> MEM i l1 /\ MEM j l2`, + GEN_TAC THEN GEN_TAC THEN + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[LENGTH; ZIP; MEM; NOT_SUC; GSYM NOT_SUC] THEN + REWRITE_TAC[SUC_INJ; PAIR_EQ] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `t':(B)list`) THEN + ASM_SIMP_TAC[]);; + + +let EL_ZIP = prove(`!(l1:(A)list) (l2:(B)list) i. LENGTH l1 = LENGTH l2 /\ i < LENGTH l1 ==> EL i (ZIP l1 l2) = (EL i l1, EL i l2)`, + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[LENGTH; ZIP; LT; NOT_SUC; SUC_INJ] THEN + POP_ASSUM (fun th -> ALL_TAC) THEN GEN_TAC THEN + REWRITE_TAC[GSYM LT] THEN + DISJ_CASES_TAC (SPEC `i:num` num_CASES) THENL + [ + ASM_REWRITE_TAC[EL; HD]; + ALL_TAC + ] THEN + POP_ASSUM CHOOSE_TAC THEN + ASM_REWRITE_TAC[LT_SUC; EL; TL]);; + + +(****************************) + +(* INDEX *) + + +let EL_INDEX = prove(`!(x:A) list. MEM x list ==> EL (INDEX x list) list = x`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[MEM] THEN + ASM_CASES_TAC `x = h:A` THEN ASM_REWRITE_TAC[] THENL + [ + ASM_REWRITE_TAC[INDEX; EL; HD]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[INDEX; EL; TL]);; + + +let INDEX_LE_LENGTH = prove(`!(x:A) list. INDEX x list <= LENGTH list`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[INDEX; LENGTH; LE_REFL] THEN + ASM_CASES_TAC `x = h:A` THEN ASM_REWRITE_TAC[ARITH_RULE `0 <= SUC n`; LE_SUC]);; + + + +let INDEX_EQ_LENGTH = prove(`!(x:A) list. ~(MEM x list) <=> INDEX x list = LENGTH list`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[MEM; INDEX; LENGTH] THEN + REWRITE_TAC[DE_MORGAN_THM] THEN + ASM_CASES_TAC `x = h:A` THEN ASM_REWRITE_TAC[GSYM NOT_SUC] THEN ARITH_TAC);; + + + +let INDEX_LT_LENGTH = prove(`!(x:A) list. MEM x list <=> INDEX x list < LENGTH list`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[INDEX; LENGTH; MEM; LT_REFL] THEN + ASM_CASES_TAC `x = h:A` THEN ASM_REWRITE_TAC[ARITH_RULE `0 < SUC n`; LT_SUC]);; + + +(* ALL_DISTINCT *) + +let CARD_SET_OF_LIST_ALL_DISTINCT = prove(`!l:(A)list. ALL_DISTINCT l ==> + CARD (set_of_list l) = LENGTH l`, + LIST_INDUCT_TAC THEN REWRITE_TAC[ALL_DISTINCT_ALT; LENGTH; set_of_list; CARD_CLAUSES] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_SIMP_TAC[FINITE_SET_OF_LIST; CARD_CLAUSES; IN_SET_OF_LIST]);; + + +(* list_sum *) + + +let ALL_DISTINCT_SUM = prove(`!(f:A->real) list. ALL_DISTINCT list ==> sum (set_of_list list) f = list_sum list f`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[ALL_DISTINCT_ALT; set_of_list; SUM_CLAUSES; list_sum; ITLIST] THEN + REWRITE_TAC[GSYM list_sum] THEN + STRIP_TAC THEN + ASM_SIMP_TAC[SUM_CLAUSES; FINITE_SET_OF_LIST] THEN + ASM_REWRITE_TAC[IN_SET_OF_LIST]);; + + + +let ALL_DISTINCT_APPEND = prove(`!l1 l2:(A)list. ALL_DISTINCT (APPEND l1 l2) ==> ALL_DISTINCT l1 /\ ALL_DISTINCT l2`, + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[ALL_DISTINCT_ALT; APPEND; APPEND_NIL] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `CONS (h':A) t'`) THEN + ASM_REWRITE_TAC[ALL_DISTINCT_ALT] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + POP_ASSUM MP_TAC THEN + SIMP_TAC[MEM_APPEND; DE_MORGAN_THM]);; + + +let ALL_DISTINCT_APPEND_SYM = prove(`!l1 l2:(A)list. ALL_DISTINCT (APPEND l1 l2) <=> + ALL_DISTINCT (APPEND l2 l1)`, + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[ALL_DISTINCT_ALT; APPEND; APPEND_NIL] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + FIRST_ASSUM (MP_TAC o SPEC `CONS (h':A) t'`) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[APPEND; ALL_DISTINCT_ALT; MEM_APPEND; DE_MORGAN_THM] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `t':(A)list`) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[MEM; DE_MORGAN_THM] THEN + EQ_TAC THEN SIMP_TAC[]);; + + + +let ALL_DISTINCT_IMP_INDEX_UNIQUE = prove(`!(x:A) i l. ALL_DISTINCT l /\ MEM x l /\ i < LENGTH l /\ EL i l = x ==> i = INDEX x l`, + REWRITE_TAC[ALL_DISTINCT] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`i:num`; `INDEX (x:A) l`]) THEN + ASM_REWRITE_TAC[GSYM INDEX_LT_LENGTH] THEN + ASM_SIMP_TAC[EL_INDEX]);; + + + +let INDEX_EL = prove(`!i (list:(A)list). ALL_DISTINCT list /\ i < LENGTH list ==> INDEX (EL i list) list = i`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC (GSYM ALL_DISTINCT_IMP_INDEX_UNIQUE) THEN + ASM_SIMP_TAC[MEM_EL]);; + + + + + +(* Shift left/right *) + + + +let SHIFT_RIGHT = prove(`!h h' (t:(A)list). shift_right ([]:(A)list) = [] + /\ shift_right (CONS h []) = [h] + /\ shift_right (CONS h (CONS h' t)) = CONS (LAST (CONS h' t)) (BUTLAST (CONS h (CONS h' t)))`, + REPEAT GEN_TAC THEN + REWRITE_TAC[shift_right; NOT_CONS_NIL; LAST; BUTLAST]);; + + +let SHIFT_RIGHT = prove(`!(h:A) t. shift_right ([]:(A)list) = [] /\ shift_right (CONS h t) = CONS (LAST (CONS h t)) (BUTLAST (CONS h t))`, + REWRITE_TAC[shift_right; NOT_CONS_NIL]);; + + + +let MEM_SHIFT_LEFT = prove(`!(x:A) l. MEM x l <=> MEM x (shift_left l)`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[MEM; shift_left] THEN + REWRITE_TAC[MEM_APPEND; MEM] THEN + ASM_CASES_TAC `x = h:A` THEN ASM_REWRITE_TAC[]);; + + + + +let BUTLAST_APPEND_SING = prove(`!(x:A) t. BUTLAST (APPEND t [x]) = t`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[APPEND; BUTLAST] THEN + COND_CASES_TAC THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[APPEND_EQ_NIL; NOT_CONS_NIL]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]);; + + + +let SHIFT_LEFT_RIGHT = prove(`!list:(A)list. shift_left (shift_right list) = list /\ shift_right (shift_left list) = list`, + LIST_INDUCT_TAC THEN REWRITE_TAC[shift_left; SHIFT_RIGHT] THEN + SIMP_TAC[NOT_CONS_NIL; APPEND_BUTLAST_LAST] THEN + REWRITE_TAC[shift_right] THEN + COND_CASES_TAC THENL + [ + POP_ASSUM (MP_TAC o AP_TERM `LENGTH:(A)list->num`) THEN + REWRITE_TAC[LENGTH_APPEND; LENGTH] THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[BUTLAST_APPEND_SING; LAST_APPEND; NOT_CONS_NIL; LAST]);; + + + +let SHIFT_LEFT_RIGHT_o_I = prove(`shift_left o shift_right = (I:(A)list->(A)list) /\ shift_right o shift_left = (I:(A)list->(A)list)`, + REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM; SHIFT_LEFT_RIGHT]);; + + + +let MEM_SHIFT_RIGHT = prove(`!(x:A) l. MEM x l <=> MEM x (shift_right l)`, + REPEAT GEN_TAC THEN + MP_TAC (SPEC `l:(A)list` SHIFT_LEFT_RIGHT) THEN + DISCH_THEN (MP_TAC o SYM o CONJUNCT1) THEN + DISCH_THEN (fun th -> CONV_TAC (LAND_CONV (ONCE_REWRITE_CONV[th]))) THEN + REWRITE_TAC[GSYM MEM_SHIFT_LEFT]);; + + + + +let EL_SHIFT_LEFT = prove(`!i (list:(A)list). i < LENGTH list ==> EL i (shift_left list) = if (i = LENGTH list - 1) then EL 0 list else EL (i + 1) list`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[EL; LENGTH; shift_left; LT] THEN + STRIP_TAC THENL + [ + ASM_REWRITE_TAC[EL_APPEND; ARITH_RULE `SUC n - 1 = n`; LT_REFL; SUB_REFL; EL; HD]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[ARITH_RULE `i < n ==> ~(i = SUC n - 1)`] THEN + ASM_REWRITE_TAC[EL_APPEND; GSYM ADD1; EL; TL]);; + + + + +let LENGTH_SHIFT_LEFT = prove(`!list:(A)list. LENGTH (shift_left list) = LENGTH list`, + LIST_INDUCT_TAC THEN REWRITE_TAC[LENGTH; shift_left] THEN + REWRITE_TAC[LENGTH_APPEND; LENGTH] THEN ARITH_TAC);; + + +let LENGTH_SHIFT_RIGHT = prove(`!list:(A)list. LENGTH (shift_right list) = LENGTH list`, + GEN_TAC THEN + MP_TAC (CONJUNCT1 (SPEC `list:(A)list` SHIFT_LEFT_RIGHT)) THEN + DISCH_THEN (MP_TAC o (fun th -> AP_TERM `LENGTH:(A)list->num` th)) THEN + REWRITE_TAC[LENGTH_SHIFT_LEFT]);; + + +let EL_SHIFT_RIGHT = prove(`!i (list:(A)list). i < LENGTH list ==> EL i (shift_right list) = if (i = 0) then EL (LENGTH list - 1) list else EL (i - 1) list`, + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `i = 0` THEN ASM_REWRITE_TAC[] THENL + [ + SUBGOAL_THEN `~(list:(A)list = [])` ASSUME_TAC THENL + [ + DISCH_TAC THEN UNDISCH_TAC `i < LENGTH (list:(A)list)` THEN + ASM_REWRITE_TAC[LENGTH; LT_REFL]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[GSYM LAST_EL] THEN + ASM_REWRITE_TAC[shift_right; EL; HD]; + ALL_TAC + ] THEN + + MP_TAC (CONJUNCT1 (SPEC `list:(A)list` SHIFT_LEFT_RIGHT)) THEN + DISCH_THEN (MP_TAC o (fun th -> AP_TERM `(EL:num->(A)list->A) (i - 1)` th)) THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MP_TAC (SPECL [`i - 1`; `shift_right (list:(A)list)`] EL_SHIFT_LEFT) THEN + REWRITE_TAC[LENGTH_SHIFT_RIGHT; SHIFT_LEFT_RIGHT] THEN + ANTS_TAC THENL + [ + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + SUBGOAL_THEN `~(i - 1 = LENGTH (list:(A)list) - 1)` (fun th -> REWRITE_TAC[th]) THENL + [ + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + ASM_SIMP_TAC[ARITH_RULE `~(i = 0) ==> i - 1 + 1 = i`]);; + + +(* NEXT_EL, PREV_EL *) + + +let NEXT_EL_ALT = prove(`!(x:A) list. MEM x list ==> NEXT_EL x list = EL (INDEX x list) (shift_left list)`, + REWRITE_TAC[INDEX_LT_LENGTH] THEN REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`INDEX x (list:(A)list)`; `list:(A)list`] EL_SHIFT_LEFT) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[NEXT_EL; EL]);; + + +let PREV_EL_ALT = prove(`!(x:A) list. MEM x list ==> PREV_EL x list = EL (INDEX x list) (shift_right list)`, + REWRITE_TAC[INDEX_LT_LENGTH] THEN REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`INDEX x (list:(A)list)`; `list:(A)list`] EL_SHIFT_RIGHT) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[PREV_EL] THEN + AP_THM_TAC THEN AP_TERM_TAC THEN + MATCH_MP_TAC LAST_EL THEN + DISCH_TAC THEN UNDISCH_TAC `INDEX x (list:(A)list) < LENGTH (list:(A)list)` THEN + ASM_REWRITE_TAC[LENGTH; LT]);; + + +let MEM_NEXT_EL = prove(`!(x:A) list. MEM x list ==> MEM (NEXT_EL x list) list`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[NEXT_EL_ALT] THEN + ONCE_REWRITE_TAC[MEM_SHIFT_LEFT] THEN + REWRITE_TAC[MEM_EXISTS_EL] THEN + EXISTS_TAC `INDEX (x:A) list` THEN + ASM_REWRITE_TAC[LENGTH_SHIFT_LEFT; GSYM INDEX_LT_LENGTH]);; + + +let MEM_PREV_EL = prove(`!(x:A) list. MEM x list ==> MEM (PREV_EL x list) list`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[PREV_EL_ALT] THEN + ONCE_REWRITE_TAC[MEM_SHIFT_RIGHT] THEN + REWRITE_TAC[MEM_EXISTS_EL] THEN + EXISTS_TAC `INDEX (x:A) list` THEN + ASM_REWRITE_TAC[LENGTH_SHIFT_RIGHT; GSYM INDEX_LT_LENGTH]);; + + + +let INDEX_HD = prove(`!list:(A)list. ~(list = []) ==> INDEX (HD list) list = 0`, + LIST_INDUCT_TAC THEN ASM_REWRITE_TAC[NOT_CONS_NIL; INDEX; HD]);; + + +let PREV_NEXT_ID = prove(`!(x:A) list. ALL_DISTINCT list /\ MEM x list ==> PREV_EL (NEXT_EL x list) list = x`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[NEXT_EL] THEN + SUBGOAL_THEN `~(list = []:(A)list)` ASSUME_TAC THENL + [ + DISCH_TAC THEN UNDISCH_TAC `MEM (x:A) list` THEN + ASM_REWRITE_TAC[MEM]; + ALL_TAC + ] THEN + COND_CASES_TAC THENL + [ + REWRITE_TAC[PREV_EL] THEN + ASM_SIMP_TAC[INDEX_HD; LAST_EL] THEN + MP_TAC (SPECL [`x:A`; `list:(A)list`] EL_INDEX) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[PREV_EL] THEN + ABBREV_TAC `i = INDEX (x:A) list` THEN + SUBGOAL_THEN `i + 1 < LENGTH (list:(A)list)` ASSUME_TAC THENL + [ + REWRITE_TAC[ARITH_RULE `i + 1 < n <=> i < n /\ ~(i = n - 1)`] THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[GSYM INDEX_LT_LENGTH]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`i + 1`; `list:(A)list`] INDEX_EL) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[ARITH_RULE `~(i + 1 = 0)`; ARITH_RULE `(i + 1) - 1 = i`] THEN + MP_TAC (SPECL [`x:A`; `list:(A)list`] EL_INDEX) THEN + ASM_SIMP_TAC[]);; + + + +let NEXT_PREV_ID = prove(`!(x:A) list. ALL_DISTINCT list /\ MEM x list ==> NEXT_EL (PREV_EL x list) list = x`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[PREV_EL] THEN + SUBGOAL_THEN `~(list = []:(A)list)` ASSUME_TAC THENL + [ + DISCH_TAC THEN UNDISCH_TAC `MEM (x:A) list` THEN + ASM_REWRITE_TAC[MEM]; + ALL_TAC + ] THEN + SUBGOAL_THEN `0 < LENGTH (list:(A)list)` ASSUME_TAC THENL + [ + UNDISCH_TAC `~(list = []:(A)list)` THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[NOT_LT; LE; LENGTH_EQ_NIL]; + ALL_TAC + ] THEN + + COND_CASES_TAC THENL + [ + REWRITE_TAC[NEXT_EL] THEN + SUBGOAL_THEN `INDEX (LAST list) (list:(A)list) = LENGTH list - 1` ASSUME_TAC THENL + [ + ASM_SIMP_TAC[LAST_EL] THEN + MATCH_MP_TAC INDEX_EL THEN + ASM_REWRITE_TAC[ARITH_RULE `n - 1 < n <=> 0 < n`]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL [`x:A`; `list:(A)list`] EL_INDEX) THEN + ASM_REWRITE_TAC[EL]; + ALL_TAC + ] THEN + + REWRITE_TAC[NEXT_EL] THEN + ABBREV_TAC `i = INDEX (x:A) list` THEN + SUBGOAL_THEN `0 < i /\ i - 1 < LENGTH (list:(A)list)` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[LT_NZ] THEN + MATCH_MP_TAC (ARITH_RULE `i < n ==> i - 1 < n`) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[GSYM INDEX_LT_LENGTH]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`i - 1`; `list:(A)list`] INDEX_EL) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ASM_SIMP_TAC[ARITH_RULE `0 < i /\ 0 < n ==> (i - 1 = n - 1 <=> i = n)`] THEN + ASM_SIMP_TAC[ARITH_RULE `0 < i ==> i - 1 + 1 = i`] THEN + EXPAND_TAC "i" THEN ASM_REWRITE_TAC[GSYM INDEX_EQ_LENGTH] THEN + MP_TAC (SPECL [`x:A`; `list:(A)list`] EL_INDEX) THEN + ASM_SIMP_TAC[]);; + + + +(* FLATTEN, REMOVE_DUPLICATES *) + +let MEM_REMOVE_DUPLICATES = prove(`!(x:A) list. MEM x (REMOVE_DUPLICATES list) <=> MEM x list`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[REMOVE_DUPLICATES; MEM] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[MEM] THEN + EQ_TAC THEN SIMP_TAC[] THEN STRIP_TAC THEN ASM_REWRITE_TAC[]);; + + +let ALL_DISTINCT_REMOVE_DUPLICATES = prove(`!list:(A)list. ALL_DISTINCT (REMOVE_DUPLICATES list)`, + LIST_INDUCT_TAC THEN REWRITE_TAC[ALL_DISTINCT_ALT; REMOVE_DUPLICATES] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_REWRITE_TAC[ALL_DISTINCT_ALT; MEM_REMOVE_DUPLICATES]);; + + +let MEM_FLATTEN = prove(`!(x:A) ll. MEM x (FLATTEN ll) <=> ?l. MEM l ll /\ MEM x l`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[MEM; FLATTEN; ITLIST] THEN + REWRITE_TAC[MEM_APPEND; GSYM FLATTEN] THEN + EQ_TAC THENL + [ + STRIP_TAC THENL + [ + EXISTS_TAC `h:(A)list` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + EXISTS_TAC `l:(A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + STRIP_TAC THENL + [ + UNDISCH_TAC `l = h:(A)list` THEN DISCH_THEN (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + DISJ2_TAC THEN ASM_REWRITE_TAC[] THEN + EXISTS_TAC `l:(A)list` THEN ASM_REWRITE_TAC[]);; + + +(* lists *) + + +let LIST_PAIRS_EMPTY = prove(`!list:(A)list. list_pairs list = [] <=> list = []`, + REWRITE_TAC[list_pairs; GSYM LENGTH_EQ_NIL] THEN + SIMP_TAC[LENGTH_ZIP; LENGTH_SHIFT_LEFT]);; + + + + +let LIST_OF_DARTS = prove(`!ll:((A)list)list. list_of_darts ll = FLATTEN (list_of_faces ll)`, + REWRITE_TAC[list_of_darts; FLATTEN; list_of_faces] THEN + LIST_INDUCT_TAC THEN ASM_REWRITE_TAC[ITLIST; MAP]);; + + +(* Faces *) + + +let FIND_FACE = prove(`!(d:A#A) ll. find_face d ll = list_pairs (find_pair_list d ll)`, + REWRITE_TAC[find_face; list_of_faces] THEN + GEN_TAC THEN LIST_INDUCT_TAC THENL + [ + REWRITE_TAC[MAP; find_list; find_pair_list; list_pairs; shift_left; ZIP]; + ALL_TAC + ] THEN + REWRITE_TAC[MAP; find_pair_list; find_list] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[]);; + + +let MEM_FIND_LIST = prove(`!(x:A) ll. MEM x (FLATTEN ll) ==> + MEM (find_list x ll) ll`, + REWRITE_TAC[MEM_FLATTEN] THEN + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[MEM] THEN + STRIP_TAC THENL + [ + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[find_list] THEN DISCH_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_CASES_TAC `MEM (x:A) h` THEN ASM_REWRITE_TAC[find_list] THEN + DISJ2_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + EXISTS_TAC `l:(A)list` THEN + ASM_REWRITE_TAC[]);; + + + +let MEM_FIND_FACE = prove(`!(d:A#A) ll. MEM d (list_of_darts ll) + ==> MEM (find_face d ll) (list_of_faces ll)`, + REWRITE_TAC[LIST_OF_DARTS] THEN REPEAT STRIP_TAC THEN + REWRITE_TAC[find_face] THEN + MATCH_MP_TAC MEM_FIND_LIST THEN + ASM_REWRITE_TAC[]);; + + + +let MEM_FIND_LIST_NONEMPTY = prove(`!(x:A) ll. ALL (\l. ~(l = [])) ll ==> + (MEM x (FLATTEN ll) <=> MEM (find_list x ll) ll)`, + REWRITE_TAC[GSYM ALL_MEM] THEN + REPEAT STRIP_TAC THEN + EQ_TAC THENL + [ + ASM_REWRITE_TAC[MEM_FIND_LIST]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN SPEC_TAC (`ll:((A)list)list`, `ll:((A)list)list`) THEN + LIST_INDUCT_TAC THEN REWRITE_TAC[MEM] THEN + DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o check(is_imp o concl)) THEN + ANTS_TAC THENL + [ + GEN_TAC THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:(A)list`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_TAC THEN + REWRITE_TAC[find_list] THEN + SUBGOAL_THEN `!t. find_list x t = h ==> MEM (x:A) h` ASSUME_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `h:(A)list`) THEN + REWRITE_TAC[] THEN DISCH_TAC THEN + LIST_INDUCT_TAC THEN ASM_REWRITE_TAC[find_list] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + ASM_CASES_TAC `MEM (x:A) h` THEN ASM_REWRITE_TAC[] THENL + [ + REWRITE_TAC[MEM_FLATTEN; MEM] THEN + EXISTS_TAC `h:(A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `t:((A)list)list`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[FLATTEN; ITLIST; MEM_APPEND] THEN + ASM_REWRITE_TAC[GSYM FLATTEN] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]);; + + +let MEM_FIND_FACE_NONEMPTY = prove(`!(d:A#A) ll. ALL (\l. ~(l = [])) ll + ==> (MEM d (list_of_darts ll) <=> MEM (find_face d ll) (list_of_faces ll))`, + REWRITE_TAC[find_face; LIST_OF_DARTS] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC MEM_FIND_LIST_NONEMPTY THEN + REWRITE_TAC[list_of_faces] THEN + REWRITE_TAC[ALL_MAP] THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[GSYM ALL_MEM; o_THM] THEN + DISCH_TAC THEN GEN_TAC THEN DISCH_TAC THEN + REWRITE_TAC[list_pairs] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:(A)list`) THEN + ASM_REWRITE_TAC[CONTRAPOS_THM] THEN + REWRITE_TAC[GSYM LENGTH_EQ_NIL] THEN + SIMP_TAC[LENGTH_ZIP; LENGTH_SHIFT_LEFT]);; + + + +(* Hypermap maps properties *) + + +(* e_list_ext permutes darts *) + +let E_LIST_EXT_INVOLUTION = prove(`!ll:((A)list)list. good_list ll ==> e_list_ext ll o e_list_ext ll = I`, + REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM; e_list_ext; good_list] THEN + REPEAT STRIP_TAC THEN + MP_TAC (ISPEC `x:A#A` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `i:A` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `j:A` ASSUME_TAC) THEN + ASM_REWRITE_TAC[res; e_list] THEN + ASM_CASES_TAC `i,j:A IN darts_of_list ll` THENL + [ + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC (`i:A,j:A`)) THEN + POP_ASSUM MP_TAC THEN + SIMP_TAC[darts_of_list; IN_SET_OF_LIST]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]);; + + +let LEFT_RIGHT_INVERSES_COINSIDE = prove(`!(f:A->B) l r. f o r = I /\ l o f = I ==> r = l`, + REPEAT STRIP_TAC THEN + POP_ASSUM (MP_TAC o (AP_TERM `\tm:(A->A). tm o (r:B->A)`)) THEN + ASM_REWRITE_TAC[I_O_ID; GSYM o_ASSOC] THEN + SIMP_TAC[]);; + + +let INVERSE_EXISTS_IMP_BIJECTIVE = prove(`!(f:A->B) g. f o g = I /\ g o f = I ==> (!y. ?!x. f x = y)`, + REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM] THEN + REPEAT STRIP_TAC THEN REWRITE_TAC[EXISTS_UNIQUE] THEN + EXISTS_TAC `(g:B->A) y` THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + POP_ASSUM (MP_TAC o AP_TERM `g:B->A`) THEN + ASM_REWRITE_TAC[]);; + + + + + +let E_LIST_EXT_PERMUTES_DARTS = prove(`!ll:((A)list)list. good_list ll ==> (e_list_ext ll) permutes (darts_of_list ll)`, + REWRITE_TAC[ permutes] THEN + GEN_TAC THEN STRIP_TAC THEN STRIP_TAC THENL + [ + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[e_list_ext; res]; + ALL_TAC + ] THEN + MATCH_MP_TAC INVERSE_EXISTS_IMP_BIJECTIVE THEN + EXISTS_TAC `e_list_ext (ll:((A)list)list)` THEN + REWRITE_TAC[ETA_AX] THEN + ASM_SIMP_TAC[E_LIST_EXT_INVOLUTION]);; + + + +(* f_list_ext permutes darts *) + +let DART_IN_DARTS = prove(`!(d:A#A) l ll. MEM d (list_pairs l) /\ MEM l ll ==> MEM d (list_of_darts ll)`, + GEN_TAC THEN GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[MEM] THEN + REPEAT STRIP_TAC THEN REWRITE_TAC[list_of_darts; ITLIST; MEM_APPEND] THENL + [ + DISJ1_TAC THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + DISJ2_TAC THEN + REWRITE_TAC[GSYM list_of_darts] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]);; + + + +let MEM_FIND_PAIR_LIST = prove(`!(d:A#A) ll. MEM d (list_of_darts ll) ==> MEM (find_pair_list d ll) ll`, + GEN_TAC THEN LIST_INDUCT_TAC THENL + [ + ASM_REWRITE_TAC[list_of_darts; ITLIST; MEM]; + ALL_TAC + ] THEN + REWRITE_TAC[list_of_darts; find_pair_list; ITLIST; MEM] THEN + COND_CASES_TAC THEN REWRITE_TAC[] THEN + ASM_REWRITE_TAC[MEM_APPEND; GSYM list_of_darts] THEN + DISCH_TAC THEN DISJ2_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]);; + + +let DART_IN_FIND_PAIR_LIST = prove(`!(d:A#A) ll. MEM d (list_of_darts ll) <=> MEM d (list_pairs (find_pair_list d ll))`, + GEN_TAC THEN LIST_INDUCT_TAC THENL + [ + ASM_REWRITE_TAC[list_of_darts; ITLIST; MEM; find_pair_list; list_pairs; shift_left; ZIP]; + ALL_TAC + ] THEN + REWRITE_TAC[list_of_darts; find_pair_list; ITLIST; MEM] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[MEM_APPEND] THEN + ASM_REWRITE_TAC[GSYM list_of_darts]);; + + + + +let DART_IN_FACE = prove(`!(d:A#A) ll. MEM d (list_of_darts ll) <=> MEM d (find_face d ll)`, + REWRITE_TAC[FIND_FACE; DART_IN_FIND_PAIR_LIST]);; + + + + + + +let MEM_IMP_NOT_ALL_DISTINCT_APPEND = prove(`!(x:A) l1 l2. MEM x l1 /\ MEM x l2 ==> ~ALL_DISTINCT (APPEND l1 l2)`, + REWRITE_TAC[ALL_DISTINCT; NOT_FORALL_THM; LENGTH_APPEND; EL_APPEND] THEN + REWRITE_TAC[MEM_EXISTS_EL] THEN + REPEAT STRIP_TAC THEN + EXISTS_TAC `i:num` THEN EXISTS_TAC `LENGTH (l1:(A)list) + i'` THEN + REWRITE_TAC[NOT_IMP] THEN + ASM_SIMP_TAC[ARITH_RULE `i < l1 ==> i < l1 + l2:num`; ARITH_RULE `i' < l2 ==> l1 + i' < l1 + l2:num`; ARITH_RULE `i < l1 ==> ~(i = l1 + i':num)`] THEN + REWRITE_TAC[ARITH_RULE `(l1 + i') - l1 = i':num`] THEN + REWRITE_TAC[ARITH_RULE `~(l1 + i' < l1:num)`] THEN + REPEAT (FIRST_X_ASSUM (fun th -> REWRITE_TAC[SYM th])));; + + + + + +let ALL_DISTINCT_IMP_UNIQUE_LIST = prove(`!l1 l2 (d:A#A) ll. ALL_DISTINCT (list_of_darts ll) /\ MEM l1 ll /\ MEM l2 ll + /\ MEM d (list_pairs l1) /\ MEM d (list_pairs l2) ==> l1 = l2`, + GEN_TAC THEN GEN_TAC THEN GEN_TAC THEN LIST_INDUCT_TAC THENL + [ + REWRITE_TAC[MEM]; + ALL_TAC + ] THEN + REWRITE_TAC[MEM; list_of_darts; ITLIST] THEN + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + FIRST_X_ASSUM (MP_TAC o check (fun th -> (rator o concl) th = `ALL_DISTINCT:(A#A)list->bool`)) THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + DISCH_TAC THEN + MATCH_MP_TAC MEM_IMP_NOT_ALL_DISTINCT_APPEND THEN + EXISTS_TAC `d:A#A` THEN + FIRST_X_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[GSYM list_of_darts] THEN + MATCH_MP_TAC DART_IN_DARTS THEN + EXISTS_TAC `l2:(A)list` THEN + ASM_REWRITE_TAC[]; + + FIRST_X_ASSUM (MP_TAC o check (fun th -> (rator o concl) th = `ALL_DISTINCT:(A#A)list->bool`)) THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + DISCH_TAC THEN + MATCH_MP_TAC MEM_IMP_NOT_ALL_DISTINCT_APPEND THEN + EXISTS_TAC `d:A#A` THEN + FIRST_X_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[GSYM list_of_darts] THEN + MATCH_MP_TAC DART_IN_DARTS THEN + EXISTS_TAC `l1:(A)list` THEN + ASM_REWRITE_TAC[]; + + ALL_TAC + ] THEN + + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o (fun th -> MATCH_MP ALL_DISTINCT_APPEND th)) THEN + SIMP_TAC[GSYM list_of_darts]);; + + + + +let FIND_PAIR_LIST_UNIQUE = prove(`!l d (ll:((A)list)list). ALL_DISTINCT (list_of_darts ll) /\ + MEM l ll /\ MEM d (list_pairs l) ==> l = find_pair_list d ll`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC ALL_DISTINCT_IMP_UNIQUE_LIST THEN + MAP_EVERY EXISTS_TAC [`d:A#A`; `ll:((A)list)list`] THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `MEM (d:A#A) (list_of_darts ll)` ASSUME_TAC THENL + [ + MATCH_MP_TAC DART_IN_DARTS THEN + EXISTS_TAC `l:(A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[MEM_FIND_PAIR_LIST] THEN + ASM_REWRITE_TAC[GSYM DART_IN_FIND_PAIR_LIST]);; + + + +let ALL_DISTINCT_FIND_FACE = prove(`!(d:A#A) ll. ALL_DISTINCT (list_of_darts ll) ==> ALL_DISTINCT (find_face d ll)`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[list_of_darts; ALL_DISTINCT_ALT; ITLIST; find_face; list_of_faces; find_list; MAP] THEN + REWRITE_TAC[GSYM list_of_darts; GSYM find_face; GSYM list_of_faces] THEN + DISCH_THEN (MP_TAC o (fun th -> MATCH_MP ALL_DISTINCT_APPEND th)) THEN + STRIP_TAC THEN + COND_CASES_TAC THEN ASM_SIMP_TAC[]);; + + + + + + + + +let LENGTH_LIST_PAIRS = prove(`!l:(A)list. LENGTH (list_pairs l) = LENGTH l`, + GEN_TAC THEN REWRITE_TAC[list_pairs] THEN + MATCH_MP_TAC LENGTH_ZIP THEN + REWRITE_TAC[LENGTH_SHIFT_LEFT]);; + + + + +let MEM_LIST_PAIRS = prove(`!(x:A) y l. MEM (x,y) (list_pairs l) ==> MEM x l /\ MEM y l`, + REWRITE_TAC[list_pairs] THEN + REPEAT GEN_TAC THEN DISCH_TAC THEN + MP_TAC (ISPECL [`x:A`; `y:A`; `l:(A)list`; `shift_left (l:(A)list)`] MEM_ZIP) THEN + ASM_REWRITE_TAC[LENGTH_SHIFT_LEFT; GSYM MEM_SHIFT_LEFT]);; + + + +let MEM_F_LIST = prove(`!(d:A#A) ll. MEM d (list_of_darts ll) ==> MEM (f_list ll d) (find_face d ll)`, + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[f_list] THEN + MATCH_MP_TAC MEM_NEXT_EL THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]);; + + + + +let EL_LIST_PAIRS = prove(`!i (list:(A)list). i < LENGTH list ==> EL i (list_pairs list) = (EL i list, EL (if i = LENGTH list - 1 then 0 else i + 1) list)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[list_pairs] THEN + MP_TAC (ISPECL [`list:(A)list`; `shift_left (list:(A)list)`; `i:num`] EL_ZIP) THEN + ASM_REWRITE_TAC[LENGTH_SHIFT_LEFT] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; PAIR_EQ]) THEN + ASM_SIMP_TAC[EL_SHIFT_LEFT] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[]);; + + + +let ALL_DISTINCT_LIST_PAIRS = prove(`!list:(A)list. ALL_DISTINCT list ==> ALL_DISTINCT (list_pairs list)`, + REWRITE_TAC[ALL_DISTINCT; LENGTH_LIST_PAIRS] THEN + GEN_TAC THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[NOT_FORALL_THM; NOT_IMP] THEN + STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`i:num`; `j:num`] THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN ASM_SIMP_TAC[EL_LIST_PAIRS; PAIR_EQ]);; + + + +let ALL_DISTINCT_SHIFT_LEFT = prove(`!list:(A)list. ALL_DISTINCT list ==> ALL_DISTINCT (shift_left list)`, + LIST_INDUCT_TAC THEN REWRITE_TAC[shift_left] THEN + POP_ASSUM (fun th -> ALL_TAC) THEN + ASM_REWRITE_TAC[ALL_DISTINCT] THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[NOT_FORALL_THM; NOT_IMP; EL_APPEND; LENGTH_APPEND; LENGTH; ARITH_SUC] THEN + STRIP_TAC THEN POP_ASSUM MP_TAC THEN + ABBREV_TAC `m = LENGTH (t:(A)list)` THEN + ASSUME_TAC (ARITH_RULE `!n. n < m + 1 /\ ~(n < m) ==> n = m`) THEN + REPEAT COND_CASES_TAC THENL + [ + DISCH_TAC THEN + MAP_EVERY EXISTS_TAC [`SUC i`; `SUC j`] THEN + ASM_REWRITE_TAC[LT_SUC; SUC_INJ; EL; TL]; + FIRST_X_ASSUM (MP_TAC o SPEC `j:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; SUB_REFL]) THEN + REWRITE_TAC[EL; HD] THEN DISCH_TAC THEN + MAP_EVERY EXISTS_TAC [`SUC i`; `0`] THEN + ASM_REWRITE_TAC[LT_SUC; NOT_SUC; LT_0; EL; TL; HD]; + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; SUB_REFL]) THEN + REWRITE_TAC[EL; HD] THEN DISCH_TAC THEN + MAP_EVERY EXISTS_TAC [`0`; `SUC j`] THEN + ASM_REWRITE_TAC[LT_SUC; NOT_SUC; LT_0; EL; TL; HD]; + UNDISCH_TAC `~(i = j:num)` THEN + FIRST_ASSUM (MP_TAC o SPEC `i:num`) THEN FIRST_X_ASSUM (MP_TAC o SPEC `j:num`) THEN + ASM_SIMP_TAC[] + ]);; + + + +let MEM_LIST_PAIRS_EXPLICIT = prove(`!(d:A#A) list. ALL_DISTINCT list /\ MEM d (list_pairs list) + ==> d = (FST d, NEXT_EL (FST d) list)`, + REWRITE_TAC[MEM_EXISTS_EL] THEN + REWRITE_TAC[LENGTH_LIST_PAIRS] THEN + REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[list_pairs] THEN + MP_TAC (ISPECL [`list:(A)list`; `shift_left list:(A)list`; `i:num`] EL_ZIP) THEN + ASM_REWRITE_TAC[LENGTH_SHIFT_LEFT] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; PAIR_EQ]) THEN + MP_TAC (SPECL [`EL i list:A`; `list:(A)list`] NEXT_EL_ALT) THEN + ASM_SIMP_TAC[MEM_EL] THEN + DISCH_TAC THEN + MP_TAC (SPEC_ALL INDEX_EL) THEN + ASM_SIMP_TAC[]);; + + + + + +let INDEX_FST_SND = prove(`!i (d:A#A) list. ALL_DISTINCT list /\ i < LENGTH list /\ EL i (list_pairs list) = d ==> + INDEX (FST d) list = i /\ INDEX (SND d) list = if (i = LENGTH list - 1) then 0 else i + 1`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + ASM_SIMP_TAC[EL_LIST_PAIRS] THEN + MP_TAC (ISPEC `d:A#A` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[PAIR_EQ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + CONJ_TAC THEN MATCH_MP_TAC INDEX_EL THEN ASM_REWRITE_TAC[] THEN + ABBREV_TAC `n = LENGTH (list:(A)list)` THEN + UNDISCH_TAC `i < n:num` THEN COND_CASES_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC);; + + + + +let NEXT_EL_LIST_PAIRS = prove(`!(d:A#A) list. ALL_DISTINCT list /\ MEM d (list_pairs list) ==> NEXT_EL d (list_pairs list) = (SND d, NEXT_EL (SND d) list)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[NEXT_EL; LENGTH_LIST_PAIRS] THEN + MP_TAC (SPEC `list:(A)list` ALL_DISTINCT_LIST_PAIRS) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ABBREV_TAC `i = INDEX (d:A#A) (list_pairs list)` THEN + ABBREV_TAC `n = LENGTH (list:(A)list)` THEN + SUBGOAL_THEN `i < n:num` ASSUME_TAC THENL + [ + EXPAND_TAC "n" THEN EXPAND_TAC "i" THEN + ONCE_REWRITE_TAC[GSYM LENGTH_LIST_PAIRS] THEN + ASM_REWRITE_TAC[GSYM INDEX_LT_LENGTH]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `EL i (list_pairs list) = d:A#A` ASSUME_TAC THENL + [ + EXPAND_TAC "i" THEN + MATCH_MP_TAC EL_INDEX THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`i:num`; `d:A#A`; `list:(A)list`] INDEX_FST_SND) THEN + ASM_REWRITE_TAC[] THEN + + COND_CASES_TAC THEN ASM_REWRITE_TAC[] THENL + [ + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPEC_ALL EL_LIST_PAIRS) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC (ARITH_RULE `i < n ==> n - 1 < n`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ONCE_REWRITE_TAC[GSYM EL] THEN + MP_TAC (SPECL [`0`; `list:(A)list`] EL_LIST_PAIRS) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL [ MATCH_MP_TAC (ARITH_RULE `i < n ==> 0 < n`) THEN ASM_REWRITE_TAC[]; ALL_TAC ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; PAIR_EQ]) THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MP_TAC (SPECL [`i + 1`; `list:(A)list`] EL_LIST_PAIRS) THEN + SUBGOAL_THEN `i + 1 < n` ASSUME_TAC THENL + [ + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN ARITH_TAC; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ONCE_REWRITE_TAC[GSYM EL] THEN + MP_TAC (SPECL [`i:num`; `list:(A)list`] EL_LIST_PAIRS) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; PAIR_EQ]) THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[PAIR_EQ]);; + + + + +let PREV_EL_LIST_PAIRS = prove(`!(d:A#A) list. ALL_DISTINCT list /\ MEM d (list_pairs list) ==> + PREV_EL d (list_pairs list) = (PREV_EL (FST d) list, FST d)`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `t = PREV_EL (d:A#A) (list_pairs list)` THEN + SUBGOAL_THEN `MEM (t:A#A) (list_pairs list)` ASSUME_TAC THENL + [ + EXPAND_TAC "t" THEN + MATCH_MP_TAC MEM_PREV_EL THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MP_TAC (SPECL [`t:A#A`; `list:(A)list`] MEM_LIST_PAIRS_EXPLICIT) THEN + ASM_REWRITE_TAC[] THEN + + MP_TAC (ISPEC `t:A#A` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[PAIR_EQ] THEN + DISCH_THEN (MP_TAC o AP_TERM `(\tm:A. PREV_EL tm list)`) THEN + REWRITE_TAC[] THEN + MP_TAC (SPEC_ALL PREV_NEXT_ID) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL [`x:A`; `y:A`; `list:(A)list`] MEM_LIST_PAIRS) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + SUBGOAL_THEN `y = FST (d:A#A)` ASSUME_TAC THENL + [ + UNDISCH_TAC `PREV_EL d (list_pairs list) = t:A#A` THEN + DISCH_THEN (MP_TAC o AP_TERM `\tm:A#A. NEXT_EL tm (list_pairs list)`) THEN + MP_TAC (ISPECL [`d:A#A`; `list_pairs (list:(A)list)`] NEXT_PREV_ID) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC ALL_DISTINCT_LIST_PAIRS THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MP_TAC (SPECL [`t:A#A`; `list:(A)list`] NEXT_EL_LIST_PAIRS) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; PAIR_EQ]); + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> ASM_REWRITE_TAC[SYM th]));; + + + +let F_LIST_INVERSE = prove(`!(d:A#A) ll. ALL_DISTINCT (list_of_darts ll) /\ MEM d (list_of_darts ll) ==> + let g = (\x:A#A. PREV_EL x (find_face x ll)) in + f_list ll (g d) = d /\ g (f_list ll d) = d`, + REWRITE_TAC[LET_DEF; LET_END_DEF; f_list] THEN + REPEAT STRIP_TAC THENL + [ + ABBREV_TAC `f = find_face (d:A#A) ll` THEN + SUBGOAL_THEN `find_face (PREV_EL (d:A#A) f) ll = f` ASSUME_TAC THENL + [ + EXPAND_TAC "f" THEN REWRITE_TAC[FIND_FACE] THEN + AP_TERM_TAC THEN + REWRITE_TAC[GSYM FIND_FACE] THEN + + MATCH_MP_TAC (GSYM FIND_PAIR_LIST_UNIQUE) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPEC_ALL MEM_FIND_PAIR_LIST) THEN + ASM_REWRITE_TAC[darts_of_list; IN_SET_OF_LIST] THEN + DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_REWRITE_TAC[GSYM FIND_FACE] THEN + MATCH_MP_TAC MEM_PREV_EL THEN + EXPAND_TAC "f" THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC NEXT_PREV_ID THEN + MP_TAC (SPEC_ALL ALL_DISTINCT_FIND_FACE) THEN + ASM_SIMP_TAC[] THEN + DISCH_TAC THEN + POP_ASSUM (fun th -> ALL_TAC) THEN POP_ASSUM (fun th -> ALL_TAC) THEN + EXPAND_TAC "f" THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + ABBREV_TAC `f = find_face (d:A#A) ll` THEN + SUBGOAL_THEN `find_face (NEXT_EL (d:A#A) f) ll = f` ASSUME_TAC THENL + [ + EXPAND_TAC "f" THEN REWRITE_TAC[FIND_FACE] THEN + AP_TERM_TAC THEN + REWRITE_TAC[GSYM FIND_FACE] THEN + + MATCH_MP_TAC (GSYM FIND_PAIR_LIST_UNIQUE) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPEC_ALL MEM_FIND_PAIR_LIST) THEN + ASM_REWRITE_TAC[darts_of_list; IN_SET_OF_LIST] THEN + DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_REWRITE_TAC[GSYM FIND_FACE] THEN + MATCH_MP_TAC MEM_NEXT_EL THEN + EXPAND_TAC "f" THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC PREV_NEXT_ID THEN + MP_TAC (SPEC_ALL ALL_DISTINCT_FIND_FACE) THEN + ASM_SIMP_TAC[] THEN + DISCH_TAC THEN + POP_ASSUM (fun th -> ALL_TAC) THEN POP_ASSUM (fun th -> ALL_TAC) THEN + EXPAND_TAC "f" THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]);; + + + + +let FIND_FACE_F_LIST = prove(`!(d:A#A) ll. ALL_DISTINCT (list_of_darts ll) /\ MEM d (list_of_darts ll) ==> + find_face (f_list ll d) ll = find_face d ll`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[FIND_FACE] THEN + AP_TERM_TAC THEN + MATCH_MP_TAC (GSYM FIND_PAIR_LIST_UNIQUE) THEN + ASM_SIMP_TAC[MEM_FIND_PAIR_LIST] THEN + REWRITE_TAC[GSYM FIND_FACE] THEN + ASM_SIMP_TAC[MEM_F_LIST]);; + + + + +let F_LIST_EXT_PERMUTES_DARTS = prove(`!ll:((A)list)list. ALL_DISTINCT (list_of_darts ll) ==> (f_list_ext ll) permutes (darts_of_list ll)`, + REWRITE_TAC[f_list_ext; permutes; res] THEN + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[EXISTS_UNIQUE] THEN + ASM_CASES_TAC `y:A#A IN darts_of_list ll` THENL + [ + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[darts_of_list; IN_SET_OF_LIST] THEN DISCH_TAC THEN + MP_TAC (SPECL [`y:A#A`; `ll:((A)list)list`] F_LIST_INVERSE) THEN + ASM_REWRITE_TAC[LET_DEF; LET_END_DEF] THEN + ABBREV_TAC `x:A#A = PREV_EL y (find_face y ll)` THEN + STRIP_TAC THEN + EXISTS_TAC `x:A#A` THEN + CONJ_TAC THENL + [ + SUBGOAL_THEN `MEM (x:A#A) (list_of_darts ll)` ASSUME_TAC THENL + [ + REWRITE_TAC[DART_IN_FACE] THEN + EXPAND_TAC "x" THEN + SUBGOAL_THEN `find_face (PREV_EL y (find_face y ll)) ll = find_face (y:A#A) ll` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[FIND_FACE] THEN AP_TERM_TAC THEN + MATCH_MP_TAC (GSYM FIND_PAIR_LIST_UNIQUE) THEN + REWRITE_TAC[GSYM FIND_FACE] THEN + ASM_SIMP_TAC[MEM_FIND_PAIR_LIST] THEN + EXPAND_TAC "x" THEN + MATCH_MP_TAC MEM_PREV_EL THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + MATCH_MP_TAC MEM_PREV_EL THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + X_GEN_TAC `d:A#A` THEN + COND_CASES_TAC THENL + [ + DISCH_TAC THEN + MP_TAC (SPEC_ALL F_LIST_INVERSE) THEN + ASM_REWRITE_TAC[LET_DEF; LET_END_DEF] THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> POP_ASSUM (MP_TAC o REWRITE_RULE[th])) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + EXISTS_TAC `y:A#A` THEN + ASM_REWRITE_TAC[] THEN + X_GEN_TAC `z:A#A` THEN + COND_CASES_TAC THENL + [ + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[darts_of_list; IN_SET_OF_LIST] THEN DISCH_TAC THEN + DISCH_THEN (ASSUME_TAC o SYM) THEN + MP_TAC (SPECL [`z:A#A`; `ll:((A)list)list`] MEM_F_LIST) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL [`z:A#A`; `ll:((A)list)list`] FIND_FACE_F_LIST) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + REWRITE_TAC[GSYM DART_IN_FACE] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[GSYM IN_SET_OF_LIST; GSYM darts_of_list]; + ALL_TAC + ] THEN + + REWRITE_TAC[]);; + + + + + + +(* e o n o f = I *) + + +let FIND_FACE_EMPTY = prove(`!(d:A#A) ll. find_face d ll = [] <=> ~MEM d (list_of_darts ll)`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[find_face; MAP; list_of_faces; find_list; list_of_darts; ITLIST; MEM] THEN + COND_CASES_TAC THENL + [ + ASM_REWRITE_TAC[MEM_APPEND] THEN + DISCH_TAC THEN UNDISCH_TAC `MEM (d:A#A) (list_pairs h)` THEN + ASM_REWRITE_TAC[MEM]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[GSYM list_of_faces; GSYM find_face; GSYM list_of_darts; MEM_APPEND]);; + + + + +let MEM_FIND_FACE_IMP_FACES_EQ = prove(`!(x:A#A) y ll. ALL_DISTINCT (list_of_darts ll) /\ MEM y (find_face x ll) + ==> find_face y ll = find_face x ll`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[FIND_FACE] THEN AP_TERM_TAC THEN + MATCH_MP_TAC (GSYM FIND_PAIR_LIST_UNIQUE) THEN + ASM_REWRITE_TAC[GSYM FIND_FACE] THEN + MATCH_MP_TAC MEM_FIND_PAIR_LIST THEN + POP_ASSUM MP_TAC THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[GSYM FIND_FACE_EMPTY] THEN + DISCH_TAC THEN ASM_REWRITE_TAC[MEM]);; + + + +let MEM_FIND_FACE_IMP_MEM_DARTS = prove(`!(d:A#A) x ll. MEM d (find_face x ll) ==> MEM d (list_of_darts ll)`, + GEN_TAC THEN GEN_TAC THEN LIST_INDUCT_TAC THENL + [ + REWRITE_TAC[find_face; list_of_darts; ITLIST; MEM; list_of_faces; MAP; find_list]; + ALL_TAC + ] THEN + REWRITE_TAC[find_face; list_of_darts; ITLIST; MEM_APPEND; list_of_faces; MAP; find_list] THEN + COND_CASES_TAC THENL + [ + DISCH_THEN (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + ASM_SIMP_TAC[GSYM list_of_faces; GSYM find_face; GSYM list_of_darts]);; + + + + + + +let F_LIST_EXT_INVERSE = prove(`!ll:((A)list)list. ALL_DISTINCT (list_of_darts ll) ==> + inverse (f_list_ext ll) = res (\d. PREV_EL d (find_face d ll)) (darts_of_list ll)`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC INVERSE_UNIQUE_o THEN + REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM; f_list_ext; res] THEN + REWRITE_TAC[darts_of_list; IN_SET_OF_LIST] THEN + CONJ_TAC THEN GEN_TAC THENL + [ + ASM_CASES_TAC `MEM (x:A#A) (list_of_darts ll)` THEN ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `MEM (PREV_EL (x:A#A) (find_face x ll)) (list_of_darts ll)` ASSUME_TAC THENL + [ + MATCH_MP_TAC MEM_FIND_FACE_IMP_MEM_DARTS THEN + EXISTS_TAC `x:A#A` THEN + MATCH_MP_TAC MEM_PREV_EL THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[f_list] THEN + SUBGOAL_THEN `find_face (PREV_EL x (find_face x ll)) ll = find_face (x:A#A) ll` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[FIND_FACE] THEN AP_TERM_TAC THEN + MATCH_MP_TAC (GSYM FIND_PAIR_LIST_UNIQUE) THEN + REWRITE_TAC[GSYM FIND_FACE] THEN + ASM_SIMP_TAC[MEM_FIND_PAIR_LIST] THEN + MATCH_MP_TAC MEM_PREV_EL THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + MATCH_MP_TAC NEXT_PREV_ID THEN + ASM_SIMP_TAC[ALL_DISTINCT_FIND_FACE] THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + ASM_CASES_TAC `MEM (x:A#A) (list_of_darts ll)` THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[f_list] THEN + SUBGOAL_THEN `MEM (NEXT_EL (x:A#A) (find_face x ll)) (list_of_darts ll)` ASSUME_TAC THENL + [ + MATCH_MP_TAC MEM_FIND_FACE_IMP_MEM_DARTS THEN + EXISTS_TAC `x:A#A` THEN + MATCH_MP_TAC MEM_NEXT_EL THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `find_face (NEXT_EL x (find_face x ll)) ll = find_face (x:A#A) ll` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[FIND_FACE] THEN AP_TERM_TAC THEN + MATCH_MP_TAC (GSYM FIND_PAIR_LIST_UNIQUE) THEN + REWRITE_TAC[GSYM FIND_FACE] THEN + ASM_SIMP_TAC[MEM_FIND_PAIR_LIST] THEN + MATCH_MP_TAC MEM_NEXT_EL THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + MATCH_MP_TAC PREV_NEXT_ID THEN + ASM_SIMP_TAC[ALL_DISTINCT_FIND_FACE] THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]);; + + +let F_LIST_EXT_INVERSE_WORKS = prove(`!ll:((A)list)list. ALL_DISTINCT (list_of_darts ll) ==> + f_list_ext ll o inverse (f_list_ext ll) = I /\ inverse (f_list_ext ll) o f_list_ext ll = I`, + GEN_TAC THEN DISCH_TAC THEN + MATCH_MP_TAC PERMUTES_INVERSES_o THEN + EXISTS_TAC `(darts_of_list ll):(A#A)->bool` THEN + MATCH_MP_TAC F_LIST_EXT_PERMUTES_DARTS THEN + ASM_REWRITE_TAC[]);; + + + + +let N_EQ_E_FI = prove(`!ll:((A)list)list. ALL_DISTINCT (list_of_darts ll) ==> + n_list_ext ll = e_list_ext ll o (inverse (f_list_ext ll))`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[F_LIST_EXT_INVERSE] THEN + REWRITE_TAC[FUN_EQ_THM; o_THM] THEN GEN_TAC THEN + REWRITE_TAC[n_list_ext; e_list_ext; res] THEN + REWRITE_TAC[darts_of_list; IN_SET_OF_LIST] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `MEM (PREV_EL (x:A#A) (find_face x ll)) (list_of_darts ll)` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC MEM_FIND_FACE_IMP_MEM_DARTS THEN + EXISTS_TAC `x:A#A` THEN + MATCH_MP_TAC MEM_PREV_EL THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + REWRITE_TAC[n_list]);; + + + +let N_LIST_EXT_PERMUTES_DARTS = prove(`!ll:((A)list)list. good_list ll ==> + (n_list_ext ll) permutes (darts_of_list ll)`, + REPEAT STRIP_TAC THEN FIRST_ASSUM MP_TAC THEN REWRITE_TAC[good_list] THEN STRIP_TAC THEN + ASM_SIMP_TAC[N_EQ_E_FI] THEN + MATCH_MP_TAC PERMUTES_COMPOSE THEN + ASM_SIMP_TAC[E_LIST_EXT_PERMUTES_DARTS] THEN + MATCH_MP_TAC PERMUTES_INVERSE THEN + ASM_SIMP_TAC[F_LIST_EXT_PERMUTES_DARTS]);; + + + +let E_N_F_ID = prove(`!ll:((A)list)list. good_list ll ==> + e_list_ext ll o n_list_ext ll o f_list_ext ll = I`, + REPEAT STRIP_TAC THEN FIRST_ASSUM MP_TAC THEN REWRITE_TAC[good_list] THEN STRIP_TAC THEN + ASM_SIMP_TAC[N_EQ_E_FI] THEN + SUBGOAL_THEN `!e (f:A#A->A#A) fi:(A#A)->(A#A). e o (e o fi) o f = (e o e) o (fi o f)` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[o_ASSOC]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[E_LIST_EXT_INVOLUTION; F_LIST_EXT_INVERSE_WORKS] THEN + REWRITE_TAC[I_O_ID]);; + + + +(* hypermap_of_list is a hypermap *) + +let HYPERMAP_OF_LIST = prove(`!ll:((A)list)list. good_list ll ==> + tuple_hypermap (hypermap_of_list ll) = + darts_of_list ll, e_list_ext ll, n_list_ext ll, f_list_ext ll`, + REWRITE_TAC[hypermap_of_list; GSYM Hypermap.hypermap_tybij] THEN + GEN_TAC THEN DISCH_TAC THEN FIRST_ASSUM MP_TAC THEN REWRITE_TAC[good_list] THEN STRIP_TAC THEN + ASM_SIMP_TAC[E_LIST_EXT_PERMUTES_DARTS; N_LIST_EXT_PERMUTES_DARTS; F_LIST_EXT_PERMUTES_DARTS; E_N_F_ID] THEN + REWRITE_TAC[darts_of_list; FINITE_SET_OF_LIST]);; + + +(* Set of faces *) + + + + +let NEXT_EL_MOD = prove(`!list (x:A). MEM x list ==> + NEXT_EL x list = EL ((INDEX x list + 1) MOD LENGTH list) list`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[NEXT_EL] THEN + ABBREV_TAC `n = LENGTH (list:(A)list)` THEN + SUBGOAL_THEN `1 <= n` ASSUME_TAC THENL + [ + UNDISCH_TAC `MEM (x:A) list` THEN + ASM_REWRITE_TAC[MEM_EXISTS_EL] THEN + STRIP_TAC THEN UNDISCH_TAC `i < n:num` THEN + ARITH_TAC; + ALL_TAC + ] THEN + COND_CASES_TAC THENL + [ + ASM_SIMP_TAC[ARITH_RULE `1 <= n ==> n - 1 + 1 = n`] THEN + MP_TAC (SPECL [`n:num`; `1`] MOD_MULT) THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= n ==> ~(n = 0)`; MULT_CLAUSES; EL]; + ALL_TAC + ] THEN + AP_THM_TAC THEN AP_TERM_TAC THEN + MATCH_MP_TAC (GSYM MOD_LT) THEN + MP_TAC (SPEC_ALL INDEX_LT_LENGTH) THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN ARITH_TAC);; + + + + +let NEXT_EL_POWER = prove(`!list (x:A) i. ALL_DISTINCT list /\ MEM x list ==> + ((\t. NEXT_EL t list) POWER i) x = EL ((INDEX x list + i) MOD (LENGTH list)) list`, + GEN_TAC THEN GEN_TAC THEN + ABBREV_TAC `n = LENGTH (list:(A)list)` THEN + ABBREV_TAC `k = INDEX (x:A) list` THEN + INDUCT_TAC THENL + [ + REWRITE_TAC[ADD_0; Hypermap.POWER_0; I_THM] THEN + STRIP_TAC THEN + SUBGOAL_THEN `k MOD n = k` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC MOD_LT THEN + EXPAND_TAC "k" THEN EXPAND_TAC "n" THEN + ASM_REWRITE_TAC[GSYM INDEX_LT_LENGTH]; + ALL_TAC + ] THEN + + EXPAND_TAC "k" THEN + MATCH_MP_TAC (GSYM EL_INDEX) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + SUBGOAL_THEN `~(n = 0)` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[MEM_EXISTS_EL] THEN + STRIP_TAC THEN UNDISCH_TAC `i' < n:num` THEN + ARITH_TAC; + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o check(is_imp o concl)) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_REWRITE_TAC[Hypermap.COM_POWER; o_THM] THEN + ABBREV_TAC `y:A = EL ((k + i) MOD n) list` THEN + MP_TAC (SPECL [`list:(A)list`; `y:A`] NEXT_EL_MOD) THEN + ANTS_TAC THENL + [ + REWRITE_TAC[MEM_EXISTS_EL] THEN + EXISTS_TAC `(k + i) MOD n` THEN + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[DIVISION]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> ASM_REWRITE_TAC[th]) THEN + SUBGOAL_THEN `INDEX (y:A) list = (k + i) MOD n` (fun th -> REWRITE_TAC[th]) THENL + [ + EXPAND_TAC "y" THEN + MATCH_MP_TAC INDEX_EL THEN + ASM_SIMP_TAC[DIVISION]; + ALL_TAC + ] THEN + + AP_THM_TAC THEN AP_TERM_TAC THEN + ASM_CASES_TAC `n = 1` THENL + [ + ASM_REWRITE_TAC[MOD_1]; + ALL_TAC + ] THEN + SUBGOAL_THEN `1 = 1 MOD n` (fun th -> ONCE_REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC (GSYM MOD_LT) THEN + ASM_REWRITE_TAC[ARITH_RULE `1 < n <=> ~(n = 0) /\ ~(n = 1)`]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[MOD_ADD_MOD] THEN + AP_THM_TAC THEN AP_TERM_TAC THEN + ARITH_TAC);; + + + + +let NEXT_EL_ORBIT = prove(`!(list:(A)list) x. ALL_DISTINCT list /\ MEM x list ==> + orbit_map (\t. NEXT_EL t list) x = set_of_list list`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `n = LENGTH (list:(A)list)` THEN + SUBGOAL_THEN `~(n = 0)` ASSUME_TAC THENL + [ + UNDISCH_TAC `MEM (x:A) list` THEN + ASM_REWRITE_TAC[MEM_EXISTS_EL] THEN + STRIP_TAC THEN UNDISCH_TAC `i < n:num` THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[Hypermap.orbit_map; EXTENSION; IN_SET_OF_LIST; IN_ELIM_THM] THEN + GEN_TAC THEN EQ_TAC THENL + [ + STRIP_TAC THEN POP_ASSUM MP_TAC THEN + ASM_SIMP_TAC[NEXT_EL_POWER] THEN DISCH_TAC THEN + MATCH_MP_TAC MEM_EL THEN + ASM_SIMP_TAC[DIVISION]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[MEM_EXISTS_EL] THEN + STRIP_TAC THEN + ASM_SIMP_TAC[NEXT_EL_POWER] THEN + ABBREV_TAC `k = INDEX (x:A) list` THEN + EXISTS_TAC `n - k + i:num` THEN + SUBGOAL_THEN `k < n:num` ASSUME_TAC THENL + [ + EXPAND_TAC "k" THEN EXPAND_TAC "n" THEN + ASM_REWRITE_TAC[GSYM INDEX_LT_LENGTH]; + ALL_TAC + ] THEN + REWRITE_TAC[GE; LE_0] THEN + AP_THM_TAC THEN AP_TERM_TAC THEN + ASM_SIMP_TAC[ARITH_RULE `k < n ==> k + n - k + i = n + i:num`] THEN + MP_TAC (SPECL [`1`; `n:num`; `i:num`] MOD_MULT_ADD) THEN + REWRITE_TAC[MULT_CLAUSES] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MATCH_MP_TAC (GSYM MOD_LT) THEN + ASM_REWRITE_TAC[]);; + + + + +let ORBIT_MAP_RES_LEMMA = prove(`!f (x:A) s. orbit_map f x SUBSET s ==> + orbit_map (res f s) x = orbit_map f x`, + REWRITE_TAC[SUBSET; Hypermap.orbit_map; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN + SUBGOAL_THEN `!n. (res f s POWER n) x = (f POWER n) (x:A)` ASSUME_TAC THENL + [ + INDUCT_TAC THEN REWRITE_TAC[Hypermap.POWER_0] THEN + ASM_REWRITE_TAC[Hypermap.COM_POWER; o_THM] THEN + REWRITE_TAC[res] THEN + SUBGOAL_THEN `(f POWER n) (x:A) IN s` (fun th -> REWRITE_TAC[th]) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + EXISTS_TAC `n:num` THEN + REWRITE_TAC[GE; LE_0]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[]);; + + + +let ORBIT_SUBSET_LEMMA = prove(`!f s (x:A). x IN s /\ (!y. y IN s ==> f y IN s) + ==> orbit_map f x SUBSET s`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[Hypermap.orbit_map; SUBSET; IN_ELIM_THM] THEN + GEN_TAC THEN DISCH_THEN CHOOSE_TAC THEN POP_ASSUM MP_TAC THEN + SPEC_TAC (`x':A`, `y:A`) THEN + SPEC_TAC (`n:num`, `n:num`) THEN + INDUCT_TAC THEN ASM_SIMP_TAC[GE; LE_0; Hypermap.POWER_0; I_THM] THEN + GEN_TAC THEN REWRITE_TAC[Hypermap.COM_POWER; o_THM] THEN + DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `(f POWER n) (x:A)`) THEN + ASM_REWRITE_TAC[GE; LE_0]);; + + + + +let ORBIT_MAP_RES = prove(`!f (x:A) s. x IN s /\ (res f s) permutes s + ==> orbit_map (res f s) x = orbit_map f x`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC ORBIT_MAP_RES_LEMMA THEN + MATCH_MP_TAC ORBIT_SUBSET_LEMMA THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `(f:A->A) y = (res f s) y` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[res]; + ALL_TAC + ] THEN + MP_TAC (ISPECL [`res (f:A->A) s`; `s:A->bool`] Hypermap_and_fan.PERMUTES_IMP_INSIDE) THEN + ASM_SIMP_TAC[]);; + + + + +let F_LIST_EXT_ORBIT = prove(`!ll (x:A#A). MEM x (list_of_darts ll) /\ ALL_DISTINCT (list_of_darts ll) ==> + orbit_map (f_list_ext ll) x = set_of_list (find_face x ll)`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL F_LIST_EXT_PERMUTES_DARTS) THEN + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[f_list_ext] THEN + DISCH_TAC THEN + SUBGOAL_THEN `x:A#A IN darts_of_list ll` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[darts_of_list; IN_SET_OF_LIST]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[ORBIT_MAP_RES] THEN + + REWRITE_TAC[Hypermap.orbit_map] THEN + SUBGOAL_THEN `!n. (f_list ll POWER n) x = ((\d:A#A. NEXT_EL d (find_face x ll)) POWER n) x` ASSUME_TAC THENL + [ + INDUCT_TAC THENL + [ + REWRITE_TAC[Hypermap.POWER_0; I_THM]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[Hypermap.COM_POWER; o_THM] THEN + REWRITE_TAC[f_list] THEN + AP_TERM_TAC THEN + MATCH_MP_TAC MEM_FIND_FACE_IMP_FACES_EQ THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (ISPECL [`find_face (x:A#A) ll`; `x:A#A`; `n:num`] NEXT_EL_POWER) THEN + ANTS_TAC THENL + [ + ASM_SIMP_TAC[ALL_DISTINCT_FIND_FACE] THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[MEM_EXISTS_EL] THEN + ABBREV_TAC `f:(A#A)list = find_face x ll` THEN + EXISTS_TAC `(INDEX (x:A#A) f + n) MOD LENGTH f` THEN + REWRITE_TAC[] THEN + SUBGOAL_THEN `~(LENGTH (f:(A#A)list) = 0)` ASSUME_TAC THENL + [ + MP_TAC (SPEC_ALL (SPECL [`x:A#A`] DART_IN_FACE)) THEN + ASM_REWRITE_TAC[MEM_EXISTS_EL] THEN + STRIP_TAC THEN UNDISCH_TAC `i < LENGTH (f:(A#A)list)` THEN + ARITH_TAC; + ALL_TAC + ] THEN + ASM_SIMP_TAC[DIVISION]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[GSYM Hypermap.orbit_map] THEN + MATCH_MP_TAC NEXT_EL_ORBIT THEN + ASM_SIMP_TAC[ALL_DISTINCT_FIND_FACE; GSYM DART_IN_FACE]);; + + + +let ALL_DISTINCT_FLATTEN = prove(`!ll:((A)list)list. + ALL_DISTINCT (FLATTEN ll) /\ ALL (\l. ~(l = [])) ll ==> ALL_DISTINCT ll`, + LIST_INDUCT_TAC THEN REWRITE_TAC[FLATTEN; ALL_DISTINCT_ALT] THEN + REWRITE_TAC[ITLIST; ALL] THEN + REWRITE_TAC[GSYM FLATTEN; ALL_DISTINCT_APPEND] THEN + STRIP_TAC THEN + MP_TAC (SPECL [`h:(A)list`; `FLATTEN t:(A)list`] ALL_DISTINCT_APPEND) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + ASM_SIMP_TAC[] THEN + REPLICATE_TAC 5 (POP_ASSUM MP_TAC) THEN POP_ASSUM (fun th -> ALL_TAC) THEN + SPEC_TAC (`t:((A)list)list`, `t:((A)list)list`) THEN + LIST_INDUCT_TAC THEN REWRITE_TAC[MEM] THEN + REWRITE_TAC[ALL; FLATTEN; ITLIST] THEN + REWRITE_TAC[GSYM FLATTEN] THEN + REWRITE_TAC[APPEND_ASSOC; DE_MORGAN_THM] THEN + REPEAT STRIP_TAC THENL + [ + MP_TAC (SPECL [`APPEND h h':(A)list`; `FLATTEN t:(A)list`] ALL_DISTINCT_APPEND) THEN + ASM_REWRITE_TAC[DE_MORGAN_THM] THEN + DISJ1_TAC THEN MATCH_MP_TAC MEM_IMP_NOT_ALL_DISTINCT_APPEND THEN + MP_TAC (ISPEC `h':(A)list` list_CASES) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + EXISTS_TAC `h'':A` THEN + ASM_REWRITE_TAC[MEM]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) THEN + REPEAT ANTS_TAC THEN ASM_REWRITE_TAC[] THENL + [ + REPLICATE_TAC 5 REMOVE_ASSUM THEN + POP_ASSUM MP_TAC THEN + ONCE_REWRITE_TAC[ALL_DISTINCT_APPEND_SYM] THEN + REWRITE_TAC[APPEND_ASSOC] THEN + DISCH_TAC THEN + MP_TAC (SPECL [`APPEND (FLATTEN t) h:(A)list`; `h':(A)list`] ALL_DISTINCT_APPEND) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + MP_TAC (SPECL [`h':(A)list`; `FLATTEN t:(A)list`] ALL_DISTINCT_APPEND) THEN + ASM_SIMP_TAC[]);; + + + +let FLATTEN_FILTER_EMPTY = prove(`!ll:((A)list)list. + FLATTEN (FILTER (\l. ~(l = [])) ll) = FLATTEN ll`, + LIST_INDUCT_TAC THEN REWRITE_TAC[FLATTEN; FILTER; ITLIST] THEN + REWRITE_TAC[GSYM FLATTEN] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[APPEND] THEN + REWRITE_TAC[FLATTEN; ITLIST] THEN + ASM_REWRITE_TAC[GSYM FLATTEN]);; + + +let ALL_FILTER = prove(`!P list:(A)list. ALL P (FILTER P list)`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[FILTER; ALL] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[ALL]);; + + + + + +let ALL_DISTINCT_SUBLIST_UNIQUE = prove(`!l1 l2 (x:A) ll. ALL_DISTINCT (FLATTEN ll) /\ + MEM l1 ll /\ MEM l2 ll /\ MEM x l1 /\ MEM x l2 + ==> l1 = l2`, + GEN_TAC THEN GEN_TAC THEN GEN_TAC THEN + LIST_INDUCT_TAC THEN REWRITE_TAC[MEM] THEN + REWRITE_TAC[FLATTEN; ITLIST] THEN + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + FIRST_X_ASSUM (MP_TAC o check (fun th -> (rator o concl) th = `ALL_DISTINCT:(A)list->bool`)) THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + DISCH_TAC THEN + MATCH_MP_TAC MEM_IMP_NOT_ALL_DISTINCT_APPEND THEN + EXISTS_TAC `x:A` THEN + FIRST_X_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[GSYM FLATTEN] THEN + REWRITE_TAC[MEM_FLATTEN] THEN + EXISTS_TAC `l2:(A)list` THEN + ASM_REWRITE_TAC[]; + + FIRST_X_ASSUM (MP_TAC o check (fun th -> (rator o concl) th = `ALL_DISTINCT:(A)list->bool`)) THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + DISCH_TAC THEN + MATCH_MP_TAC MEM_IMP_NOT_ALL_DISTINCT_APPEND THEN + EXISTS_TAC `x:A` THEN + FIRST_X_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[GSYM FLATTEN] THEN + REWRITE_TAC[MEM_FLATTEN] THEN + EXISTS_TAC `l1:(A)list` THEN + ASM_REWRITE_TAC[]; + + ALL_TAC + ] THEN + + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o (fun th -> MATCH_MP ALL_DISTINCT_APPEND th)) THEN + SIMP_TAC[GSYM FLATTEN]);; + + + + + +let ALL_DISTINCT_FACE_UNIQUE = prove(`!f1 f2 d (ll:((A)list)list). + ALL_DISTINCT (list_of_darts ll) /\ MEM f1 (list_of_faces ll) /\ + MEM f2 (list_of_faces ll) /\ MEM d f1 /\ MEM d f2 ==> f1 = f2`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC ALL_DISTINCT_SUBLIST_UNIQUE THEN + EXISTS_TAC `d:A#A` THEN + EXISTS_TAC `list_of_faces ll:((A#A)list)list` THEN + ASM_REWRITE_TAC[GSYM LIST_OF_DARTS]);; + + + + +let MEM_FACE_LEMMA = prove(`!f (ll:((A)list)list). good_list ll /\ + MEM f (list_of_faces ll) ==> + ?d. MEM d (list_of_darts ll) /\ f = find_face d ll`, + REWRITE_TAC[good_list] THEN REPEAT STRIP_TAC THEN + EXISTS_TAC `HD f:A#A` THEN + POP_ASSUM MP_TAC THEN + MP_TAC (ISPEC `f:(A#A)list` list_CASES) THEN + STRIP_TAC THENL + [ + ASM_REWRITE_TAC[list_of_faces; MEM_MAP] THEN + STRIP_TAC THEN POP_ASSUM (MP_TAC o SYM) THEN + REWRITE_TAC[LIST_PAIRS_EMPTY] THEN DISCH_TAC THEN + UNDISCH_TAC `ALL (\l:(A)list. ~(l = [])) ll` THEN + REWRITE_TAC[GSYM ALL_MEM] THEN + DISCH_THEN (MP_TAC o SPEC `x:(A)list`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[HD] THEN DISCH_TAC THEN + SUBGOAL_THEN `MEM (h:A#A) (list_of_darts ll)` ASSUME_TAC THENL + [ + REWRITE_TAC[LIST_OF_DARTS; MEM_FLATTEN] THEN + EXISTS_TAC `f:(A#A)list` THEN + ASM_REWRITE_TAC[MEM]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC ALL_DISTINCT_FACE_UNIQUE THEN + EXISTS_TAC `h:A#A` THEN + EXISTS_TAC `ll:((A)list)list` THEN + ASM_REWRITE_TAC[MEM] THEN + ASM_SIMP_TAC[MEM_FIND_FACE] THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]);; + + + + + + + + +let FACE_SET_EQ_LIST = prove(`!ll:((A)list)list. good_list ll ==> + face_set (hypermap_of_list ll) = set_of_list (faces_of_list ll)`, + REPEAT STRIP_TAC THEN FIRST_ASSUM MP_TAC THEN REWRITE_TAC[good_list] THEN STRIP_TAC THEN + ASM_SIMP_TAC[Hypermap.face_set; Hypermap.face_map; Hypermap.dart; HYPERMAP_OF_LIST] THEN + REWRITE_TAC[Hypermap.set_of_orbits] THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_SET_OF_LIST] THEN + + X_GEN_TAC `f:(A#A->bool)` THEN + REWRITE_TAC[GSYM EXTENSION] THEN + EQ_TAC THENL + [ + DISCH_THEN (X_CHOOSE_THEN `d:A#A` MP_TAC) THEN + REWRITE_TAC[darts_of_list; IN_SET_OF_LIST] THEN + STRIP_TAC THEN POP_ASSUM MP_TAC THEN + ASM_SIMP_TAC[F_LIST_EXT_ORBIT] THEN + DISCH_TAC THEN + REWRITE_TAC[faces_of_list; MEM_MAP] THEN + EXISTS_TAC `find_face (d:A#A) ll` THEN + ASM_SIMP_TAC[MEM_FIND_FACE]; + ALL_TAC + ] THEN + + REWRITE_TAC[faces_of_list; MEM_MAP] THEN + DISCH_THEN (X_CHOOSE_THEN `ff:(A#A)list` ASSUME_TAC) THEN + MP_TAC (SPECL [`ff:(A#A)list`; `ll:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + EXISTS_TAC `d:A#A` THEN + ASM_REWRITE_TAC[darts_of_list; IN_SET_OF_LIST] THEN + ASM_SIMP_TAC[F_LIST_EXT_ORBIT]);; + + +(* Define nodes of a good hypermap *) +let good_list_nodes = new_definition `good_list_nodes L <=> + node_set (hypermap_of_list L) = set_of_list (nodes_of_list L)`;; + + + + +let COMPONENTS_HYPERMAP_OF_LIST = prove(`!L:((A)list)list. good_list L ==> + dart (hypermap_of_list L) = darts_of_list L /\ + edge_map (hypermap_of_list L) = e_list_ext L /\ + node_map (hypermap_of_list L) = n_list_ext L /\ + face_map (hypermap_of_list L) = f_list_ext L`, + GEN_TAC THEN DISCH_TAC THEN + REWRITE_TAC[Hypermap.dart; Hypermap.edge_map; Hypermap.node_map; Hypermap.face_map] THEN + ASM_SIMP_TAC[HYPERMAP_OF_LIST]);; + + + + +let SET_OF_LIST_FILTER = prove(`!P list:(A)list. + set_of_list (FILTER P list) = {x | MEM x list /\ P x}`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[FILTER; MEM] THENL + [ + REWRITE_TAC[set_of_list] THEN SET_TAC[]; + ALL_TAC + ] THEN + COND_CASES_TAC THENL + [ + ASM_REWRITE_TAC[set_of_list] THEN + POP_ASSUM MP_TAC THEN SET_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN SET_TAC[]);; + + + +let SET_OF_LIST_REMOVE_DUPLICATES = prove(`!list:(A)list. + set_of_list (REMOVE_DUPLICATES list) = set_of_list list`, + LIST_INDUCT_TAC THEN REWRITE_TAC[REMOVE_DUPLICATES; set_of_list] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM IN_SET_OF_LIST] THEN + SET_TAC[]);; + + + + +let SET_OF_LIST_FLATTEN = prove(`!list:((A)list)list. + set_of_list (FLATTEN list) = UNIONS {set_of_list l | MEM l list}`, + LIST_INDUCT_TAC THEN REWRITE_TAC[FLATTEN; ITLIST; MEM] THENL + [ + SET_TAC[set_of_list]; + ALL_TAC + ] THEN + REWRITE_TAC[GSYM FLATTEN] THEN + ASM_REWRITE_TAC[SET_OF_LIST_APPEND] THEN + SET_TAC[]);; + + + + +let NODE_OF_LIST_LEMMA = prove(`!(x:A) L. + set_of_list (FILTER (\d. FST d = x) (list_of_darts L)) + = {(x, y) | y | (x, y) IN darts_of_list L}`, + REWRITE_TAC[SET_OF_LIST_FILTER; darts_of_list; IN_SET_OF_LIST] THEN + REPEAT GEN_TAC THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN + X_GEN_TAC `d:A#A` THEN + EQ_TAC THEN STRIP_TAC THENL + [ + EXISTS_TAC `SND (d:A#A)` THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ASM_REWRITE_TAC[] + ]);; + + + + +let NODES_OF_LIST = prove(`!L:((A)list)list. set_of_list (nodes_of_list L) + = {{(x, y) | y | (x, y) IN darts_of_list L} | x | x IN elements_of_list L}`, + REWRITE_TAC[nodes_of_list; list_of_nodes] THEN + REWRITE_TAC[SET_OF_LIST_MAP] THEN + REWRITE_TAC[GSYM IMAGE_LEMMA; IN_ELIM_THM; GSYM elements_of_list] THEN + GEN_TAC THEN + REWRITE_TAC[EXTENSION] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + X_GEN_TAC `y:A#A->bool` THEN + EQ_TAC THEN STRIP_TAC THENL + [ + POP_ASSUM MP_TAC THEN + ASM_REWRITE_TAC[NODE_OF_LIST_LEMMA] THEN + DISCH_TAC THEN + EXISTS_TAC `x':A` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + EXISTS_TAC `FILTER (\d. FST d = x:A) (list_of_darts L)` THEN + ASM_REWRITE_TAC[NODE_OF_LIST_LEMMA] THEN + EXISTS_TAC `x:A` THEN + ASM_REWRITE_TAC[]);; + + + +let GOOD_LIST_NODE = prove(`!L (d:A#A). good_list L /\ good_list_nodes L /\ d IN darts_of_list L + ==> node (hypermap_of_list L) d = {(FST d, x) | x | (FST d, x) IN darts_of_list L}`, + REWRITE_TAC[good_list_nodes; Hypermap.node_set; Hypermap.set_of_orbits] THEN + REWRITE_TAC[GSYM Hypermap.node] THEN + REWRITE_TAC[NODES_OF_LIST] THEN + REPEAT GEN_TAC THEN + GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [EXTENSION] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `node (hypermap_of_list L) (d:A#A)`) THEN + SUBGOAL_THEN `?x:A#A. x IN dart (hypermap_of_list L) /\ node (hypermap_of_list L) d = node (hypermap_of_list L) x` ASSUME_TAC THENL + [ + EXISTS_TAC `d:A#A` THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (ISPECL [`hypermap_of_list (L:((A)list)list)`; `d:A#A`] Hypermap.node_refl) THEN + ASM_REWRITE_TAC[IN_ELIM_THM] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[]);; + + +let PREV_EL_LIST_PAIRS_GENERAL = prove(`!x (y:A) list. MEM (x,y) (list_pairs list) + ==> ?z. PREV_EL (x,y) (list_pairs list) = (z, x) /\ MEM (z,x) (list_pairs list)`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `z = FST (PREV_EL (x:A,y) (list_pairs list))` THEN + EXISTS_TAC `z:A` THEN + SUBGOAL_THEN `PREV_EL (x:A,y) (list_pairs list) = z,x` ASSUME_TAC THENL + [ + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[PREV_EL] THEN + ABBREV_TAC `k = INDEX (x:A,y) (list_pairs list)` THEN + ABBREV_TAC `n = LENGTH (list:(A)list)` THEN + SUBGOAL_THEN `k < n:num` ASSUME_TAC THENL + [ + MP_TAC (SPEC `list:(A)list` LENGTH_LIST_PAIRS) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + EXPAND_TAC "k" THEN + ASM_REWRITE_TAC[GSYM INDEX_LT_LENGTH]; + ALL_TAC + ] THEN + + COND_CASES_TAC THENL + [ + MP_TAC (ISPEC `list_pairs (list:(A)list)` LAST_EL) THEN + ANTS_TAC THENL + [ + DISCH_TAC THEN + UNDISCH_TAC `MEM (x:A,y) (list_pairs list)` THEN + ASM_REWRITE_TAC[MEM]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ASM_REWRITE_TAC[LENGTH_LIST_PAIRS] THEN + MP_TAC (SPECL [`n - 1`; `list:(A)list`] EL_LIST_PAIRS) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC (ARITH_RULE `k < n ==> n - 1 < n`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th; PAIR_EQ]) THEN + MP_TAC (ISPECL [`(x:A,y:A)`; `list_pairs (list:(A)list)`] EL_INDEX) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL [`0`; `list:(A)list`] EL_LIST_PAIRS) THEN + ANTS_TAC THENL + [ + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> SIMP_TAC[th; PAIR_EQ]); + ALL_TAC + ] THEN + + MP_TAC (SPECL [`k - 1`; `list:(A)list`] EL_LIST_PAIRS) THEN + ASM_SIMP_TAC[ARITH_RULE `k < n ==> k - 1 < n`; PAIR_EQ] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + ASM_SIMP_TAC[ARITH_RULE `k < n /\ ~(k = 0) ==> ~(k - 1 = n - 1)`] THEN + ASM_SIMP_TAC[ARITH_RULE `~(k = 0) ==> k - 1 + 1 = k`] THEN + EXPAND_TAC "k" THEN + MP_TAC (ISPECL [`(x:A,y:A)`; `list_pairs (list:(A)list)`] EL_INDEX) THEN + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[EL_LIST_PAIRS; PAIR_EQ]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC MEM_PREV_EL THEN + ASM_REWRITE_TAC[]);; + + + +let N_LIST_EXT_FST = prove(`!(x:A) y L. good_list L /\ (x,y) IN darts_of_list L + ==> ?z. n_list_ext L (x,y) = (x,z) /\ (x,z) IN darts_of_list L`, + REPEAT STRIP_TAC THEN FIRST_ASSUM MP_TAC THEN + REWRITE_TAC[darts_of_list; IN_SET_OF_LIST] THEN + GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV)[DART_IN_FACE] THEN + REWRITE_TAC[FIND_FACE] THEN + STRIP_TAC THEN + MP_TAC (SPECL[`x:A`; `y:A`; `find_pair_list (x:A,y) L`] PREV_EL_LIST_PAIRS_GENERAL) THEN + ASM_REWRITE_TAC[] THEN + + STRIP_TAC THEN + EXISTS_TAC `z:A` THEN + SUBGOAL_THEN `n_list_ext L (x,y) = x,z:A` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[n_list_ext; res; n_list; FIND_FACE; e_list]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[GSYM IN_SET_OF_LIST; GSYM darts_of_list] THEN + MP_TAC (ISPECL[`n_list_ext (L:((A)list)list)`; `darts_of_list (L:((A)list)list)`] PERMUTES_IMP_INSIDE) THEN + ASM_SIMP_TAC[N_LIST_EXT_PERMUTES_DARTS] THEN + DISCH_THEN (MP_TAC o SPEC `x:A,y:A`) THEN + ASM_SIMP_TAC[]);; + + + + + +let LIST_EXT_POWER_IN_DARTS = prove(`!(d:A#A) L n. good_list L /\ d IN darts_of_list L + ==> (e_list_ext L POWER n) d IN darts_of_list L /\ + (n_list_ext L POWER n) d IN darts_of_list L /\ + (f_list_ext L POWER n) d IN darts_of_list L`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + ABBREV_TAC `H = hypermap_of_list (L:((A)list)list)` THEN + MP_TAC (SPEC_ALL COMPONENTS_HYPERMAP_OF_LIST) THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THENL + [ + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `edge H (d:A#A)` THEN + MP_TAC (ISPECL [`H:(A#A)hypermap`; `d:A#A`] Hypermap.lemma_edge_subset) THEN + ASM_SIMP_TAC[Hypermap.edge; Hypermap.orbit_map] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + DISCH_TAC THEN + EXISTS_TAC `n:num` THEN + REWRITE_TAC[GE; LE_0]; + + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `node H (d:A#A)` THEN + MP_TAC (ISPECL [`H:(A#A)hypermap`; `d:A#A`] Hypermap.lemma_node_subset) THEN + ASM_SIMP_TAC[Hypermap.node; Hypermap.orbit_map] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + DISCH_TAC THEN + EXISTS_TAC `n:num` THEN + REWRITE_TAC[GE; LE_0]; + + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `face H (d:A#A)` THEN + MP_TAC (ISPECL [`H:(A#A)hypermap`; `d:A#A`] Hypermap.lemma_face_subset) THEN + ASM_SIMP_TAC[Hypermap.face; Hypermap.orbit_map] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + DISCH_TAC THEN + EXISTS_TAC `n:num` THEN + REWRITE_TAC[GE; LE_0]; + ]);; + + + +let FST_N_LIST_EXT_POWER = prove(`!x (y:A) L n. good_list L /\ x,y IN darts_of_list L + ==> FST ((n_list_ext L POWER n) (x,y)) = x`, + GEN_TAC THEN GEN_TAC THEN GEN_TAC THEN + INDUCT_TAC THEN REWRITE_TAC[Hypermap.POWER_0; I_THM] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ABBREV_TAC `d = (n_list_ext L POWER n) (x:A,y)` THEN + ASM_REWRITE_TAC[Hypermap.COM_POWER; o_THM] THEN + MP_TAC (SPECL [`FST (d:A#A)`; `SND (d:A#A)`; `L:((A)list)list`] N_LIST_EXT_FST) THEN + ASM_REWRITE_TAC[PAIR] THEN + ANTS_TAC THENL + [ + EXPAND_TAC "d" THEN + ASM_SIMP_TAC[LIST_EXT_POWER_IN_DARTS]; + ALL_TAC + ] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[]);; + + + + +let MEM_LIST_PAIRS_EXISTS = prove(`!x l. MEM x l <=> ?y:A. MEM (x,y) (list_pairs l)`, + REPEAT GEN_TAC THEN + EQ_TAC THENL + [ + DISCH_TAC THEN + EXISTS_TAC `NEXT_EL (x:A) l` THEN + REWRITE_TAC[MEM_EXISTS_EL] THEN + EXISTS_TAC `INDEX (x:A) l` THEN + REWRITE_TAC[LENGTH_LIST_PAIRS] THEN + ASM_REWRITE_TAC[GSYM INDEX_LT_LENGTH] THEN + ASM_SIMP_TAC[GSYM INDEX_LT_LENGTH; EL_LIST_PAIRS] THEN + ASM_SIMP_TAC[EL_INDEX; PAIR_EQ; NEXT_EL] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[EL]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[MEM_LIST_PAIRS]);; + + + + +let MEM_LIST_OF_DARTS = prove(`!d L. MEM d (list_of_darts L) <=> + ?l:(A)list. MEM l L /\ MEM d (list_pairs l)`, + REPEAT GEN_TAC THEN EQ_TAC THENL + [ + SPEC_TAC (`L:((A)list)list`, `L:((A)list)list`) THEN + LIST_INDUCT_TAC THEN REWRITE_TAC[list_of_darts; ITLIST; MEM] THEN + REWRITE_TAC[GSYM list_of_darts; MEM_APPEND] THEN + STRIP_TAC THENL + [ + EXISTS_TAC `h:(A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + EXISTS_TAC `l:(A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + STRIP_TAC THEN + MATCH_MP_TAC DART_IN_DARTS THEN + EXISTS_TAC `l:(A)list` THEN ASM_REWRITE_TAC[]);; + + + + +let MEM_LIST_OF_ELEMENTS = prove(`!x L. MEM x (list_of_elements L) <=> + ?y:A. MEM (x,y) (list_of_darts L)`, + REWRITE_TAC[list_of_elements; MEM_REMOVE_DUPLICATES; MEM_FLATTEN] THEN + REWRITE_TAC[MEM_LIST_OF_DARTS] THEN + ONCE_REWRITE_TAC[SWAP_EXISTS_THM] THEN + REWRITE_TAC[RIGHT_EXISTS_AND_THM] THEN + REWRITE_TAC[GSYM MEM_LIST_PAIRS_EXISTS]);; + + + + + +let ALL_DISTINCT_FILTER = prove(`!(P:A->bool) l. ALL_DISTINCT l ==> ALL_DISTINCT (FILTER P l)`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[ALL_DISTINCT_ALT; FILTER] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[ALL_DISTINCT_ALT; MEM_FILTER]);; + + + + +let ALL_DISTINCT_NODE = prove(`!L (n:(A#A)list). good_list L /\ MEM n (list_of_nodes L) + ==> ALL_DISTINCT n`, + REWRITE_TAC[good_list; list_of_nodes; MEM_MAP] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC ALL_DISTINCT_FILTER THEN + ASM_REWRITE_TAC[]);; + + + + +let ALL_DISTINCT_FACE = prove(`!L (f:(A#A)list). good_list L /\ MEM f (list_of_faces L) + ==> ALL_DISTINCT f`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`f:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC ALL_DISTINCT_FIND_FACE THEN + UNDISCH_TAC `good_list (L:((A)list)list)` THEN + SIMP_TAC[good_list]);; + + + + + +let LIST_OF_EDGES = prove(`!L:((A)list)list. good_list L ==> + hyp_edge_pairs (hypermap_of_list L) = set_of_list (list_of_edges L)`, + REWRITE_TAC[hyp_edge_pairs; list_of_edges] THEN + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST] THEN + REWRITE_TAC[darts_of_list; e_list_ext; e_list; res; IN_SET_OF_LIST] THEN + REWRITE_TAC[EXTENSION; IN_SET_OF_LIST; IN_ELIM_THM; MEM_MAP] THEN + GEN_TAC THEN EQ_TAC THEN STRIP_TAC THENL + [ + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + EXISTS_TAC `x':A#A` THEN + ASM_REWRITE_TAC[]; + EXISTS_TAC `x':A#A` THEN + ASM_REWRITE_TAC[] + ]);; + + +(* Theorems for special lists *) + +let FACE_OF_LIST = prove(`!L (x:A#A). good_list L /\ MEM x (list_of_darts L) ==> + face (hypermap_of_list L) x = set_of_list (find_face x L)`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC `L:((A)list)list` FACE_SET_EQ_LIST) THEN + ASM_REWRITE_TAC[Hypermap.face_set; Hypermap.set_of_orbits; GSYM Hypermap.face] THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST; darts_of_list; IN_SET_OF_LIST] THEN + GEN_REWRITE_TAC LAND_CONV [EXTENSION] THEN + DISCH_THEN (MP_TAC o SPEC `face (hypermap_of_list L) (x:A#A)`) THEN + REWRITE_TAC[IN_ELIM_THM] THEN + DISCH_THEN (MP_TAC o MATCH_MP (TAUT `(A <=> B) ==> (A ==> B)`)) THEN + ANTS_TAC THENL + [ + EXISTS_TAC `x:A#A` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[IN_SET_OF_LIST; faces_of_list; MEM_MAP] THEN + DISCH_THEN (X_CHOOSE_THEN `f:(A#A)list` STRIP_ASSUME_TAC) THEN + + MP_TAC (SPECL [`f:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + AP_TERM_TAC THEN + MATCH_MP_TAC (GSYM MEM_FIND_FACE_IMP_FACES_EQ) THEN + CONJ_TAC THENL + [ + UNDISCH_TAC `good_list (L:((A)list)list)` THEN + SIMP_TAC[good_list]; + ALL_TAC + ] THEN + + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REMOVE_ASSUM THEN + REWRITE_TAC[GSYM IN_SET_OF_LIST] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[Hypermap.face_refl]);; + + + +let CARD_FACE_OF_LIST = prove(`!L (x:A#A). good_list L /\ MEM x (list_of_darts L) ==> + CARD (face (hypermap_of_list L) x) = LENGTH (find_face x L)`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[FACE_OF_LIST] THEN + MATCH_MP_TAC CARD_SET_OF_LIST_ALL_DISTINCT THEN + MATCH_MP_TAC ALL_DISTINCT_FIND_FACE THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[good_list]);; + + +let LIST_OF_FACES_n = prove(`!(L:((A)list)list) n. good_list L ==> + {f | f IN face_set (hypermap_of_list L) /\ CARD f = n} = + set_of_list (MAP set_of_list (FILTER (\f. LENGTH f = n) (list_of_faces L)))`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[good_list] THEN STRIP_TAC THEN + REWRITE_TAC[Hypermap.face_set; Hypermap.set_of_orbits; GSYM Hypermap.face] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST] THEN + REWRITE_TAC[darts_of_list; IN_SET_OF_LIST] THEN + REWRITE_TAC[EXTENSION] THEN + X_GEN_TAC `f:A#A->bool` THEN + REWRITE_TAC[GSYM EXTENSION] THEN + REWRITE_TAC[IN_ELIM_THM; IN_SET_OF_LIST; MEM_MAP; MEM_FILTER] THEN + EQ_TAC THENL + [ + STRIP_TAC THEN + EXISTS_TAC `find_face (x:A#A) L` THEN + ASM_SIMP_TAC[MEM_FIND_FACE; FACE_OF_LIST] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[CARD_FACE_OF_LIST]; + DISCH_THEN (X_CHOOSE_THEN `l:(A#A)list` STRIP_ASSUME_TAC) THEN + MP_TAC (SPECL[`l:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + CONJ_TAC THENL + [ + EXISTS_TAC `d:A#A` THEN + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[FACE_OF_LIST]; + ALL_TAC + ] THEN + + UNDISCH_TAC `LENGTH (l:(A#A)list) = n` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC CARD_SET_OF_LIST_ALL_DISTINCT THEN + MATCH_MP_TAC ALL_DISTINCT_FIND_FACE THEN + ASM_REWRITE_TAC[] + ]);; + + + + +let LIST_OF_FACES3 = prove(`!L:((A)list)list. good_list L ==> + hyp_face3 (hypermap_of_list L) = + set_of_list (MAP set_of_list (list_of_faces3 L))`, + REWRITE_TAC[hyp_face3; list_of_faces3] THEN + REWRITE_TAC[LIST_OF_FACES_n]);; + + + +let LIST_OF_FACES4 = prove(`!L:((A)list)list. good_list L ==> + hyp_face4 (hypermap_of_list L) = + set_of_list (MAP set_of_list (list_of_faces4 L))`, + REWRITE_TAC[hyp_face4; list_of_faces4] THEN + REWRITE_TAC[LIST_OF_FACES_n]);; + + + +let LIST_OF_FACES5 = prove(`!L:((A)list)list. good_list L ==> + hyp_face5 (hypermap_of_list L) = + set_of_list (MAP set_of_list (list_of_faces5 L))`, + REWRITE_TAC[hyp_face5; list_of_faces5] THEN + REWRITE_TAC[LIST_OF_FACES_n]);; + + + +let LIST_OF_FACES6 = prove(`!L:((A)list)list. good_list L ==> + hyp_face6 (hypermap_of_list L) = + set_of_list (MAP set_of_list (list_of_faces6 L))`, + REWRITE_TAC[hyp_face6; list_of_faces6] THEN + REWRITE_TAC[LIST_OF_FACES_n]);; + + + + +let LIST_OF_DARTS3 = prove(`!L:((A)list)list. good_list L ==> + hyp_dart3 (hypermap_of_list L) = set_of_list (list_of_darts3 L)`, + REWRITE_TAC[hyp_dart3; list_of_darts3; list_of_faces3] THEN + REPEAT STRIP_TAC THEN + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[good_list] THEN STRIP_TAC THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST] THEN + REWRITE_TAC[darts_of_list; IN_SET_OF_LIST; LIST_OF_DARTS] THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_SET_OF_LIST] THEN + REWRITE_TAC[MEM_FLATTEN; MEM_FILTER] THEN + GEN_TAC THEN EQ_TAC THEN STRIP_TAC THENL + [ + EXISTS_TAC `l:(A#A)list` THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL [`l:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `MEM (x:A#A) (list_of_darts L)` ASSUME_TAC THENL + [ + MATCH_MP_TAC MEM_FIND_FACE_IMP_MEM_DARTS THEN + EXISTS_TAC `d:A#A` THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + ASM_SIMP_TAC[CARD_FACE_OF_LIST] THEN + AP_TERM_TAC THEN + MATCH_MP_TAC (GSYM MEM_FIND_FACE_IMP_FACES_EQ) THEN + ASM_REWRITE_TAC[] THEN + REMOVE_ASSUM THEN POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + EXISTS_TAC `l:(A#A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`l:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + + SUBGOAL_THEN `MEM (x:A#A) (list_of_darts L)` ASSUME_TAC THENL + [ + MATCH_MP_TAC MEM_FIND_FACE_IMP_MEM_DARTS THEN + EXISTS_TAC `d:A#A` THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + ASM_SIMP_TAC[CARD_FACE_OF_LIST] THEN + UNDISCH_TAC `LENGTH (l:(A#A)list) = 3` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + AP_TERM_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC (MEM_FIND_FACE_IMP_FACES_EQ) THEN + ASM_REWRITE_TAC[] THEN + REMOVE_ASSUM THEN POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]));; + + + +let LIST_OF_DARTS4 = prove(`!L:((A)list)list. good_list L ==> + hyp_dart4 (hypermap_of_list L) = set_of_list (list_of_darts4 L)`, + REWRITE_TAC[hyp_dart4; list_of_darts4; list_of_faces4] THEN + REPEAT STRIP_TAC THEN + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[good_list] THEN STRIP_TAC THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST] THEN + REWRITE_TAC[darts_of_list; IN_SET_OF_LIST; LIST_OF_DARTS] THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_SET_OF_LIST] THEN + REWRITE_TAC[MEM_FLATTEN; MEM_FILTER] THEN + GEN_TAC THEN EQ_TAC THEN STRIP_TAC THENL + [ + EXISTS_TAC `l:(A#A)list` THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL [`l:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `MEM (x:A#A) (list_of_darts L)` ASSUME_TAC THENL + [ + MATCH_MP_TAC MEM_FIND_FACE_IMP_MEM_DARTS THEN + EXISTS_TAC `d:A#A` THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + ASM_SIMP_TAC[CARD_FACE_OF_LIST] THEN + AP_TERM_TAC THEN + MATCH_MP_TAC (GSYM MEM_FIND_FACE_IMP_FACES_EQ) THEN + ASM_REWRITE_TAC[] THEN + REMOVE_ASSUM THEN POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + EXISTS_TAC `l:(A#A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`l:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + + SUBGOAL_THEN `MEM (x:A#A) (list_of_darts L)` ASSUME_TAC THENL + [ + MATCH_MP_TAC MEM_FIND_FACE_IMP_MEM_DARTS THEN + EXISTS_TAC `d:A#A` THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + ASM_SIMP_TAC[CARD_FACE_OF_LIST] THEN + UNDISCH_TAC `LENGTH (l:(A#A)list) = 4` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + AP_TERM_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC (MEM_FIND_FACE_IMP_FACES_EQ) THEN + ASM_REWRITE_TAC[] THEN + REMOVE_ASSUM THEN POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]));; + + + +let LIST_OF_DARTS_X = prove(`!L:((A)list)list. good_list L ==> + hyp_dartX (hypermap_of_list L) = set_of_list (list_of_dartsX L)`, + REWRITE_TAC[hyp_dartX; list_of_dartsX; list_of_faces456] THEN + REPEAT STRIP_TAC THEN + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[good_list] THEN STRIP_TAC THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST] THEN + REWRITE_TAC[darts_of_list; IN_SET_OF_LIST; LIST_OF_DARTS] THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_SET_OF_LIST] THEN + REWRITE_TAC[MEM_FLATTEN; MEM_FILTER] THEN + GEN_TAC THEN EQ_TAC THEN STRIP_TAC THENL + [ + EXISTS_TAC `l:(A#A)list` THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN + MP_TAC (SPECL [`l:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `MEM (x:A#A) (list_of_darts L)` ASSUME_TAC THENL + [ + MATCH_MP_TAC MEM_FIND_FACE_IMP_MEM_DARTS THEN + EXISTS_TAC `d:A#A` THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + ASM_SIMP_TAC[CARD_FACE_OF_LIST] THEN + SUBGOAL_THEN `find_face (x:A#A) L = find_face d L` (fun th -> SIMP_TAC[th]) THEN + MATCH_MP_TAC MEM_FIND_FACE_IMP_FACES_EQ THEN + ASM_REWRITE_TAC[] THEN + REMOVE_ASSUM THEN POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + EXISTS_TAC `l:(A#A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`l:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + + SUBGOAL_THEN `MEM (x:A#A) (list_of_darts L)` ASSUME_TAC THENL + [ + MATCH_MP_TAC MEM_FIND_FACE_IMP_MEM_DARTS THEN + EXISTS_TAC `d:A#A` THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + ASM_SIMP_TAC[CARD_FACE_OF_LIST] THEN + UNDISCH_TAC `4 <= LENGTH (l:(A#A)list)` THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `find_face (x:A#A) L = find_face d L` (fun th -> SIMP_TAC[th]) THEN + MATCH_MP_TAC (MEM_FIND_FACE_IMP_FACES_EQ) THEN + ASM_REWRITE_TAC[] THEN + REMOVE_ASSUM THEN POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]));; + + diff --git a/formal_lp/old/hypermap/list_hypermap_computations.hl b/formal_lp/old/hypermap/list_hypermap_computations.hl new file mode 100644 index 0000000..bb0f672 --- /dev/null +++ b/formal_lp/old/hypermap/list_hypermap_computations.hl @@ -0,0 +1,1712 @@ +(* Explicit computations for hypermap_of_list *) + +#load "str.cma";; + +needs "../formal_lp/hypermap/list_hypermap.hl";; +needs "../formal_lp/hypermap/list_conversions.hl";; + +open Str;; +open List;; + + + +let MY_PROVE_HYP hyp th = EQ_MP (DEDUCT_ANTISYM_RULE hyp th) hyp;; + + +let test n f x = + let start = Sys.time() in + for i = 1 to n do + let _ = f x in () + done; + Sys.time() -. start;; + + +(* Constants and variables *) +let hd_var_num = `hd:num` and + h_var_num = `h:num` and + h1_var_num = `h1:num` and + h2_var_num = `h2:num` and + t_var = `t:(num)list` and + x_var_pair = `x:num#num` and + acc_var = `acc:(num#num)list` and + f_var_fun = `f:num#num->num#num`;; + +let num_type = `:num`;; +let num_list_type = `:(num)list`;; +let num_list_list_type = `:((num)list)list`;; + +let mem_const = `MEM:(num#num)->(num#num)list->bool` and + f_const = `F`;; + + +let hypermap_of_list_const = `hypermap_of_list:((num)list)list->(num#num)hypermap` and + list_of_darts_const = `list_of_darts:((num)list)list->(num#num)list` and + list_of_edges_const = `list_of_edges:((num)list)list->((num#num)#(num#num))list` and + list_of_faces_const = `list_of_faces:((num)list)list->((num#num)list)list` and + list_of_nodes_const = `list_of_nodes:((num)list)list->((num#num)list)list` and + list_of_elements_const = `list_of_elements:((num)list)list->(num)list` and + list_of_faces3_const = `list_of_faces3:((num)list)list->((num#num)list)list` and + list_of_faces4_const = `list_of_faces4:((num)list)list->((num#num)list)list` and + list_of_faces5_const = `list_of_faces5:((num)list)list->((num#num)list)list` and + list_of_faces6_const = `list_of_faces6:((num)list)list->((num#num)list)list` and + list_of_darts3_const = `list_of_darts3:((num)list)list->(num#num)list` and + list_of_darts4_const = `list_of_darts4:((num)list)list->(num#num)list` and + list_of_dartsX_const = `list_of_dartsX:((num)list)list->(num#num)list` and + good_list_const = `good_list:((num)list)list->bool` and + good_list_nodes_const = `good_list_nodes:((num)list)list->bool`;; + + + +(* example of java style string from hypermap generator. *) +let pentstring = "13_150834109178 18 3 0 1 2 3 3 2 7 3 3 0 2 4 5 4 0 3 4 6 1 0 4 3 7 2 8 3 8 2 1 4 8 1 6 9 3 9 6 10 3 10 6 4 3 10 4 5 4 5 3 7 11 3 10 5 11 3 11 7 12 3 12 7 8 3 12 8 9 3 9 10 11 3 11 12 9 ";; +let test_string = "149438122187 18 6 0 1 2 3 4 5 4 0 5 6 7 3 6 5 4 3 6 4 8 3 8 4 3 3 8 3 9 3 9 3 2 3 9 2 10 3 10 2 11 3 11 2 1 3 11 1 0 3 11 0 7 3 10 11 7 3 10 7 12 3 12 7 6 3 12 6 8 3 12 8 9 3 9 10 12 ";; + +(* conversion to list. e.g. convert_to_list pentstring *) + +let convert_to_list = + let split_sp= Str.split (regexp " +") in + let strip_ = global_replace (regexp "_") "" in + let rec movelist n (x,a) = + if n=0 then (x,a) else match x with y::ys -> movelist (n-1) (ys, y::a) in + let getone (x,a) = match x with + | [] -> ([],a) + | y::ys -> let (u,v) = movelist y (ys,[]) in (u,v::a) in + let rec getall (x,a) = + if (x=[]) then (x,a) else getall (getone (x,a)) in + fun s -> + let h::ss = (split_sp (strip_ s)) in + let _::ns = map int_of_string ss in + let (_,a) = getall (ns,[]) in + (h,rev (map rev a));; + + + +let create_hol_list str = + let ll = snd (convert_to_list str) in + let s1 = map (map mk_small_numeral) ll in + let s2 = map (fun l -> mk_list (l, num_type)) s1 in + mk_list (s2, num_list_type);; + + + +(********************************************) + +(* MEM_CONV and related conversions *) + + +(* MY_NUM_EQ_CONV *) + +let NUMERAL_EQ = prove(`NUMERAL m = NUMERAL n <=> m = n`, REWRITE_TAC[NUMERAL]) and + NUM_EQ_00 = prove(`BIT0 m = BIT0 n <=> m = n`, REWRITE_TAC[BIT0] THEN ARITH_TAC) and + NUM_EQ_10 = prove(`BIT1 m = BIT0 n <=> F`, REWRITE_TAC[ARITH]) and + NUM_EQ_01 = prove(`BIT0 m = BIT1 n <=> F`, REWRITE_TAC[ARITH]) and + NUM_EQ_11 = prove(`BIT1 m = BIT1 n <=> m = n`, REWRITE_TAC[ARITH]) and + NUM_EQ_ZERO_B0 = prove(`_0 = BIT0 n <=> _0 = n`, REWRITE_TAC[ARITH]) and + NUM_EQ_B0_ZERO = prove(`BIT0 n = _0 <=> n = _0`, REWRITE_TAC[ARITH]) and + NUM_EQ_ZERO_B1 = prove(`_0 = BIT1 n <=> F`, REWRITE_TAC[ARITH]) and + NUM_EQ_B1_ZERO = prove(`BIT1 n = _0 <=> F`, REWRITE_TAC[ARITH]) and + NUM_EQ_ZERO_ZERO = prove(`_0 = _0 <=> T`, REWRITE_TAC[ARITH]);; + + +let zero_const = `_0` and + numeral_const = `NUMERAL` and + n_var_num = `n:num` and + m_var_num = `m:num`;; + +let rec raw_num_eq_conv tm = + let lhs, rhs = dest_eq tm in + if (is_comb lhs) then + let bm, m_tm = dest_comb lhs in + let bm_c = fst(dest_const bm) in + if (is_comb rhs) then + let bn, n_tm = dest_comb rhs in + let bn_c = fst(dest_const bn) in + if (bm_c = bn_c) then + let th0 = INST[m_tm, m_var_num; n_tm, n_var_num] + (if (bm_c = "BIT0") then NUM_EQ_00 else NUM_EQ_11) in + let th1 = raw_num_eq_conv (mk_eq (m_tm, n_tm)) in + TRANS th0 th1 + else + INST[m_tm, m_var_num; n_tm, n_var_num] + (if (bm_c = "BIT0") then NUM_EQ_01 else NUM_EQ_10) + else + if bm_c = "BIT0" then + let th0 = INST[m_tm, n_var_num] NUM_EQ_B0_ZERO in + let th1 = raw_num_eq_conv (mk_eq (m_tm, zero_const)) in + TRANS th0 th1 + else + INST[m_tm, n_var_num] NUM_EQ_B1_ZERO + else + if (is_comb rhs) then + let bn, n_tm = dest_comb rhs in + let bn_c = fst(dest_const bn) in + if (bn_c = "BIT0") then + let th0 = INST[n_tm, n_var_num] NUM_EQ_ZERO_B0 in + let th1 = raw_num_eq_conv (mk_eq (zero_const, n_tm)) in + TRANS th0 th1 + else + INST[n_tm, n_var_num] NUM_EQ_ZERO_B1 + else + NUM_EQ_ZERO_ZERO;; + + +let MY_NUM_EQ_CONV tm = + let lhs, rhs = dest_eq tm in + if lhs = rhs then EQT_INTRO (REFL lhs) else + let th0 = INST[rand lhs, m_var_num; rand rhs, n_var_num] NUMERAL_EQ in + let ltm, rtm = dest_eq (concl th0) in + if ltm <> tm then + failwith "MY_NUM_EQ_CONV" + else + TRANS th0 (raw_num_eq_conv rtm);; + +(* +let tm1 = `65535 = 32767`;; +let tm2 = `65535 = 65535`;; + +test 1000 NUM_EQ_CONV tm1;; (* 0.448 *) +test 1000 NUM_EQ_CONV tm2;; (* 0.488 *) + +test 1000 MY_NUM_EQ_CONV tm1;; (* 0.144 *) +test 1000 MY_NUM_EQ_CONV tm2;; (* 0.136 *) +*) + +(* NUM_PAIR_EQ_CONV *) + +let NUM_PAIR_EQ = UNDISCH_ALL (prove(`(n:num = x <=> T) ==> (m:num = y <=> T) ==> (n, m = x, y <=> T)`, SIMP_TAC[PAIR_EQ])) and + NUM_PAIR_NOT_EQ1 = UNDISCH_ALL (prove(`(n = x <=> F) ==> (n:num,m:num = x,y <=> F)`, SIMP_TAC[PAIR_EQ])) and + NUM_PAIR_NOT_EQ2 = UNDISCH_ALL (prove(`(m = y <=> F) ==> (n:num,m:num = x,y <=> F)`, SIMP_TAC[PAIR_EQ]));; + + +let t_const = `T` and f_const = `F` and + x_var_num = `x:num` and y_var_num = `y:num`;; + + +let NUM_PAIR_EQ_CONV tm = + let lhs, rhs = dest_eq tm in + if (lhs = rhs) then + EQT_INTRO (REFL lhs) + else + let n_tm, m_tm = dest_pair lhs in + let x_tm, y_tm = dest_pair rhs in + let inst = INST[n_tm, n_var_num; m_tm, m_var_num; x_tm, x_var_num; y_tm, y_var_num] in + let fst_th = MY_NUM_EQ_CONV (mk_eq (n_tm, x_tm)) in + if (rand(concl fst_th) = t_const) then + let snd_th = MY_NUM_EQ_CONV (mk_eq (m_tm, y_tm)) in + if (rand(concl snd_th) = t_const) then + let th0 = inst NUM_PAIR_EQ in + MY_PROVE_HYP fst_th (MY_PROVE_HYP snd_th th0) + else + let th0 = inst NUM_PAIR_NOT_EQ2 in + MY_PROVE_HYP snd_th th0 + else + let th0 = inst NUM_PAIR_NOT_EQ1 in + MY_PROVE_HYP fst_th th0;; + + + + +(* +let tm1 = `(12,4) = (12,4)` and + tm2 = `(12,4) = (12,5)`;; + +NUM_PAIR_EQ_CONV tm1;; +NUM_PAIR_EQ_CONV tm2;; +test 1000 NUM_PAIR_EQ_CONV tm1;; (* 0.016 *) +test 1000 NUM_PAIR_EQ_CONV tm2;; (* 0.040 *) +*) + + +(* MEM_NUM_CONV *) + +let MEM_NUM_EMPTY = prove(`MEM (n:num) [] <=> F`, REWRITE_TAC[MEM]) and + MEM_NUM_HD = UNDISCH_ALL (prove(`(n = h <=> T) ==> (MEM (n:num) (CONS h t) <=> T)`,SIMP_TAC[MEM])) and + MEM_NUM_TL = UNDISCH_ALL (prove(`(n = h <=> F) ==> (MEM (n:num) (CONS h t) <=> MEM n t)`, SIMP_TAC[MEM]));; + + +let h_var_num = `h:num` and + t_var_numlist = `t:(num)list`;; + + +let rec MEM_NUM_CONV tm = + let ltm, list_tm = dest_comb tm in + let n_tm = rand ltm in + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let eq_th = MY_NUM_EQ_CONV (mk_eq (n_tm, h_tm)) in + if (rand(concl eq_th) = t_const) then + let th0' = INST[n_tm, n_var_num; h_tm, h_var_num; t_tm, t_var_numlist] MEM_NUM_HD in + MY_PROVE_HYP eq_th th0' + else + let th0' = INST[n_tm, n_var_num; h_tm, h_var_num; t_tm, t_var_numlist] MEM_NUM_TL in + let th0 = MY_PROVE_HYP eq_th th0' in + let th1 = MEM_NUM_CONV (rand(concl th0)) in + TRANS th0 th1 + else + INST[n_tm, n_var_num] MEM_NUM_EMPTY;; + + + +(* MEM_NUM_PAIR_CONV *) + +let MEM_NUM_PAIR_EMPTY = prove(`MEM (n:num#num) [] <=> F`, REWRITE_TAC[MEM]) and + MEM_NUM_PAIR_HD = UNDISCH_ALL (prove(`(n = h <=> T) ==> (MEM (n:num#num) (CONS h t) <=> T)`,SIMP_TAC[MEM])) and + MEM_NUM_PAIR_TL = UNDISCH_ALL (prove(`(n = h <=> F) ==> (MEM (n:num#num) (CONS h t) <=> MEM n t)`, SIMP_TAC[MEM]));; + + +let n_var_numnum = `n:num#num` and + h_var_numnum = `h:num#num` and + t_var_numnumlist = `t:(num#num)list`;; + + +let rec MEM_NUM_PAIR_CONV tm = + let ltm, list_tm = dest_comb tm in + let n_tm = rand ltm in + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let eq_th = NUM_PAIR_EQ_CONV (mk_eq (n_tm, h_tm)) in + if (rand(concl eq_th) = t_const) then + let th0' = INST[n_tm, n_var_numnum; h_tm, h_var_numnum; t_tm, t_var_numnumlist] MEM_NUM_PAIR_HD in + MY_PROVE_HYP eq_th th0' + else + let th0' = INST[n_tm, n_var_numnum; h_tm, h_var_numnum; t_tm, t_var_numnumlist] MEM_NUM_PAIR_TL in + let th0 = MY_PROVE_HYP eq_th th0' in + let th1 = MEM_NUM_PAIR_CONV (rand(concl th0)) in + TRANS th0 th1 + else + INST[n_tm, n_var_numnum] MEM_NUM_PAIR_EMPTY;; + + +let MEM_REWRITE_CONV = REWRITE_CONV[MEM; PAIR_EQ; ARITH_EQ];; + + +(* +test 1000 MEM_NUM_PAIR_CONV `MEM (1,1) [1,2; 3,4; 2,1]`;; (* 0.140 *) +test 1000 MEM_REWRITE_CONV `MEM (1,1) [1,2; 3,4; 2,1]`;; (* 1.276 *) +*) + + + +(* LIST_PAIRS_CONV *) + +let LIST_PAIRS_REWRITE_CONV = REWRITE_CONV[list_pairs; shift_left; APPEND; ZIP];; + + +let list_pairs2 = define `list_pairs2 [] (hd:A) = [] /\ + list_pairs2 (CONS h []) hd = [h,hd] /\ + list_pairs2 (CONS h1 (CONS h2 t)) hd = CONS (h1,h2) (list_pairs2 (CONS h2 t) hd)`;; + + +let [list_pairs2_0; list_pairs2_1; list_pairs2_2] = map (INST_TYPE [`:num`, aty]) (CONJUNCTS list_pairs2);; + +let rec list_pairs2_raw_conv tm = + let ltm, h = dest_comb tm in + let list = rand ltm in + if (is_comb list) then + let h_list, t_list = dest_comb list in + let h_list = rand h_list in + if (is_comb t_list) then + let h2,t2 = dest_comb t_list in + let h2 = rand h2 in + let th0 = INST[h_list, h1_var_num; h2, h2_var_num; t2, t_var; h, hd_var_num] list_pairs2_2 in + let ltm, rtm = dest_comb (rand(concl th0)) in + let th1 = list_pairs2_raw_conv rtm in + TRANS th0 (AP_TERM ltm th1) + else + INST[h_list, h_var_num; h, hd_var_num] list_pairs2_1 + else + INST[h, hd_var_num] list_pairs2_0;; + + +(* +list_pairs2_raw_conv `list_pairs2 [1;2;3;4;5;6] 1`;; +test 1000 (list_pairs2_raw_conv) `list_pairs2 [1;2;3;4;5;6] 1`;; (* 0.072 *) +*) + +let EL_EQ_IMP_EQ = prove(`!l1 l2:(A)list. LENGTH l1 = LENGTH l2 /\ + (!i. i < LENGTH l1 ==> EL i l1 = EL i l2) ==> l1 = l2`, + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[LENGTH; NOT_SUC] THEN + REWRITE_TAC[SUC_INJ; injectivity "list"] THEN + REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `0`) THEN + REWRITE_TAC[LT_0; EL; HD]; + ALL_TAC + ] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `SUC i`) THEN + ASM_REWRITE_TAC[LT_SUC; EL; TL]);; + + +let LENGTH_LIST_PAIRS2 = prove(`!(x:A) list. LENGTH (list_pairs2 list x) = LENGTH list`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[list_pairs2; LENGTH] THEN + DISJ_CASES_TAC (ISPEC `t:(A)list` list_CASES) THENL + [ + ASM_REWRITE_TAC[list_pairs2; LENGTH]; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o check (is_eq o concl)) THEN + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + ASM_REWRITE_TAC[list_pairs2; LENGTH; SUC_INJ]);; + + +let EL_LIST_PAIRS2 = prove(`!(x:A) list i. i < LENGTH list ==> + EL i (list_pairs2 list x) = + EL i list, if i = LENGTH list - 1 then x else EL (i + 1) list`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[LENGTH; LT] THEN + REPEAT STRIP_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + DISJ_CASES_TAC (ISPEC `t:(A)list` list_CASES) THENL + [ + ASM_REWRITE_TAC[LENGTH; list_pairs2; EL; HD; ARITH_RULE `SUC 0 - 1 = 0`]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + ASM_REWRITE_TAC[LENGTH; list_pairs2; EL; TL; ARITH_RULE `SUC (SUC n) - 1 = SUC n`] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `LENGTH (t':(A)list)`) THEN + ASM_REWRITE_TAC[LENGTH; ARITH_RULE `SUC n - 1 = n`; ARITH_RULE `n < SUC n`]; + ALL_TAC + ] THEN + + DISJ_CASES_TAC (ISPEC `t:(A)list` list_CASES) THENL + [ + UNDISCH_TAC `i < LENGTH (t:(A)list)` THEN + ASM_REWRITE_TAC[LENGTH; LT]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + ASM_REWRITE_TAC[list_pairs2; ARITH_RULE `i + 1 = SUC i`; EL; TL] THEN + + DISJ_CASES_TAC (SPEC `i:num` num_CASES) THENL + [ + ASM_REWRITE_TAC[EL; HD; LENGTH; ARITH_RULE `~(0 = SUC(SUC n) - 1)`]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + ASM_REWRITE_TAC[EL; TL] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `n:num`) THEN + ASM_REWRITE_TAC[LENGTH; ARITH_RULE `n + 1 = SUC n`; EL; TL] THEN + REWRITE_TAC[ARITH_RULE `SUC n = SUC (SUC k) - 1 <=> n = SUC k - 1`] THEN + DISCH_THEN MATCH_MP_TAC THEN + UNDISCH_TAC `i < LENGTH (t:(A)list)` THEN + ASM_REWRITE_TAC[LENGTH; LT_SUC] THEN + ARITH_TAC);; + + +let LIST_PAIRS2 = prove(`!list:(A)list. list_pairs list = list_pairs2 list (HD list)`, + GEN_TAC THEN MATCH_MP_TAC EL_EQ_IMP_EQ THEN + REWRITE_TAC[LENGTH_LIST_PAIRS; LENGTH_LIST_PAIRS2] THEN + ASM_SIMP_TAC[EL_LIST_PAIRS; EL_LIST_PAIRS2] THEN + REPEAT STRIP_TAC THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[EL]);; + + +let LIST_PAIRS_NUM_EMPTY = prove(`list_pairs ([]:(num)list) = []`, CONV_TAC LIST_PAIRS_REWRITE_CONV);; +let LIST_PAIRS_NUM_CONS = prove(`list_pairs (CONS (h:num) t) = list_pairs2 (CONS h t) h`, REWRITE_TAC[LIST_PAIRS2; HD]);; + + +let LIST_PAIRS_CONV tm = + let list_tm = rand tm in + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let th0 = INST[h_tm, h_var_num; t_tm, t_var_numlist] LIST_PAIRS_NUM_CONS in + let th1 = list_pairs2_raw_conv (rand(concl th0)) in + TRANS th0 th1 + else + LIST_PAIRS_NUM_EMPTY;; + + + +(* +let z = `list_pairs [1;2;3;4;5;6]`;; +LIST_PAIRS_REWRITE_CONV z;; +test 1000 LIST_PAIRS_REWRITE_CONV z;; (* 2.484 *) + +LIST_PAIRS_CONV z;; +test 1000 LIST_PAIRS_CONV z;; (* 0.08 *) +*) + + +(***********************************************) + +(* LIST_OF_FACES_CONV *) + +let LIST_OF_FACES_REWRITE_CONV = REWRITE_CONV[list_of_faces; MAP; LIST_PAIRS2; list_pairs2; HD];; + +let LIST_OF_FACES_REWRITE_CONV' = REWRITE_CONV[list_of_faces; MAP; list_pairs; shift_left; APPEND; ZIP];; + +(* +let y = mk_comb(list_of_faces_const, hol_list);; +LIST_OF_FACES_CONV y;; +test 10 LIST_OF_FACES_CONV y;; (* 0.304 *) + +LIST_OF_FACES_CONV2 y;; +test 10 LIST_OF_FACES_CONV2 y;; (* 0.172 *) +*) + +(* +LIST_OF_DARTS_CONV' y;; +test 10 LIST_OF_DARTS_CONV' y;; (* 0.920 *) +*) + + +(* LIST_OF_DARTS_CONV *) +let LIST_OF_DARTS_REWRITE_CONV = REWRITE_CONV[list_of_darts; ITLIST; list_pairs; shift_left; APPEND; ZIP];; + + +(* +let x = create_hol_list pentstring;; +let y = mk_comb (list_of_darts_const, hol_list);; +test 10 LIST_OF_DARTS_CONV y;; (* 1.168 *) +*) + + +(**************************************) + + +(* ALL_DISTINCT_CONV *) +let ALL_DISTINCT_REWRITE_CONV = REWRITE_CONV[ALL_DISTINCT_ALT; MEM; PAIR_EQ; ARITH];; + + +let ALL_DISTINCT_NUM_PAIR_EMPTY = prove(`ALL_DISTINCT ([]:(num#num)list) <=> T`, REWRITE_TAC[ALL_DISTINCT_ALT]) and + ALL_DISTINCT_NUM_PAIR_CONS_F = UNDISCH_ALL (prove(`(MEM (h:num#num) t <=> F) ==> (ALL_DISTINCT (CONS h t) <=> ALL_DISTINCT t)`, SIMP_TAC[ALL_DISTINCT_ALT])) and + ALL_DISTINCT_NUM_PAIR_CONS_T = UNDISCH_ALL (prove(`(MEM (h:num#num) t <=> T) ==> (ALL_DISTINCT (CONS h t) <=> F)`, SIMP_TAC[ALL_DISTINCT_ALT]));; + +let mem_numnum_const = `MEM:(num#num)->(num#num)list->bool`;; + +let rec ALL_DISTINCT_NUM_PAIR_CONV tm = + let list_tm = rand tm in + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let inst = INST[h_tm, h_var_numnum; t_tm, t_var_numnumlist] in + let mem_th = MEM_NUM_PAIR_CONV (mk_binop mem_numnum_const h_tm t_tm) in + if (rand (concl mem_th) = t_const) then + MY_PROVE_HYP mem_th (inst ALL_DISTINCT_NUM_PAIR_CONS_T) + else + let th0 = MY_PROVE_HYP mem_th (inst ALL_DISTINCT_NUM_PAIR_CONS_F) in + let th1 = ALL_DISTINCT_NUM_PAIR_CONV (rand(concl th0)) in + TRANS th0 th1 + else + ALL_DISTINCT_NUM_PAIR_EMPTY;; + + +(* +let z = mk_comb(`ALL_DISTINCT:(num#num)list->bool`, rand(concl (LIST_OF_DARTS_CONV y)));; +ALL_DISTINCT_REWRITE_CONV z;; +ALL_DISTINCT_NUM_PAIR_CONV z;; +test 1 ALL_DISTINCT_REWRITE_CONV z;; (* 0.808 *) +test 1 ALL_DISTINCT_NUM_PAIR_CONV z;; (* 0.084 *) +*) + +(*********************************************) + +(* GOOD_LIST_CONV *) + +let GOOD_LIST_COND3_EMPTY = prove(`ALL (\d:num#num. MEM (SND d,FST d) list) [] <=> T`, REWRITE_TAC[ALL]);; +let GOOD_LIST_COND3_CONS_T = UNDISCH_ALL (prove(`(MEM (y,x) list <=> T) ==> + (ALL (\d:num#num. MEM (SND d,FST d) list) (CONS (x,y) t) <=> + ALL (\d:num#num. MEM (SND d,FST d) list) t)`, SIMP_TAC[ALL]));; +let GOOD_LIST_COND3_CONS_F = UNDISCH_ALL (prove(`(MEM (y,x) list <=> F) ==> + (ALL (\d:num#num. MEM (SND d,FST d) list) (CONS (x,y) t) <=> + F)`, SIMP_TAC[ALL]));; + +let list_var_numnumlist = `list:(num#num)list`;; + +let rec GOOD_LIST_COND3_CONV tm = + let ltm, list_tm = dest_comb tm in + let f_tm = rand ltm in + let list2_tm = rand(snd(dest_abs f_tm)) in + if (is_comb list_tm) then + let h_tm, t_tm = dest_comb list_tm in + let x_tm, y_tm = dest_pair (rand h_tm) in + let inst = INST[list2_tm, list_var_numnumlist; x_tm, x_var_num; y_tm, y_var_num; t_tm, t_var_numnumlist] in + let mem_th = MEM_NUM_PAIR_CONV (mk_binop mem_numnum_const (mk_pair (y_tm,x_tm)) list2_tm) in + if (rand(concl mem_th) = t_const) then + let th0 = MY_PROVE_HYP mem_th (inst GOOD_LIST_COND3_CONS_T) in + let th1 = GOOD_LIST_COND3_CONV (rand(concl th0)) in + TRANS th0 th1 + else + MY_PROVE_HYP mem_th (inst GOOD_LIST_COND3_CONS_F) + else + INST[list2_tm, list_var_numnumlist] GOOD_LIST_COND3_EMPTY;; + + +(* +good_list;; +let z = mk_comb(`\ll. !d:num#num. MEM d (list_of_darts ll) ==> MEM (SND d,FST d) (list_of_darts ll)`, x);; +let s1 = rand(concl(REWRITE_CONV[darts; ALL_MEM] z));; +let s2 = REWRITE_CONV[ALL; MEM] s1;; +test 1 (REWRITE_CONV[ALL;MEM]) s1;; (* 1.668 *) + + +GOOD_LIST_COND3_CONV s1;; +test 1 GOOD_LIST_COND3_CONV s1;; (* 0.108 *) +*) + + + + +(*****************************************) + +(* FLATTEN_CONV *) + +let FLATTEN_CLAUSES = prove(`!(h:A) t tt. + FLATTEN ([]:((A)list)list) = [] /\ + FLATTEN (CONS [] tt) = FLATTEN tt /\ + FLATTEN (CONS (CONS h t) tt) = CONS h (FLATTEN (CONS t tt))`, + REPEAT STRIP_TAC THEN REWRITE_TAC[FLATTEN; ITLIST; APPEND]);; + + +let FLATTEN_REWRITE_CONV = REWRITE_CONV[FLATTEN_CLAUSES];; + + +let FLATTEN_NUM_CLAUSES = INST_TYPE[`:num`, aty] (SPEC_ALL FLATTEN_CLAUSES);; + +let [flatten_0; flatten_01; flatten_11] = + CONJUNCTS (FLATTEN_NUM_CLAUSES);; +let tt_var_numlistlist = `tt:((num)list)list`;; +let h_var_num = `h:num`;; +let t_var_numlist = `t:(num)list`;; + + + +let rec FLATTEN_NUM_CONV tm = + let arg = rand tm in + if (is_comb arg) then + let hh_tm', tt_tm = dest_comb arg in + let hh_tm = rand hh_tm' in + if (is_comb hh_tm) then + let h_tm', t_tm = dest_comb hh_tm in + let h_tm = rand h_tm' in + let th0 = INST[h_tm, h_var_num; t_tm, t_var_numlist; tt_tm, tt_var_numlistlist] flatten_11 in + let ltm, rtm = dest_comb(rand(concl th0)) in + let th1 = AP_TERM ltm (FLATTEN_NUM_CONV rtm) in + TRANS th0 th1 + else + let th0 = INST[tt_tm, tt_var_numlistlist] flatten_01 in + let th1 = FLATTEN_NUM_CONV (rand(concl th0)) in + TRANS th0 th1 + else + flatten_0;; + + +let [flattenA_0; flattenA_01; flattenA_11] + = CONJUNCTS (SPEC_ALL FLATTEN_CLAUSES);; + + +(* Works for any list of lists *) +let FLATTEN_CONV tm = + let tm_ty = hd (snd (dest_type (type_of tm))) in + let f0_th = INST_TYPE[tm_ty, aty] flattenA_0 in + let f01_th = INST_TYPE[tm_ty, aty] flattenA_01 in + let f11_th = INST_TYPE[tm_ty, aty] flattenA_11 in + let t_var = mk_var("t", mk_type("list", [tm_ty])) in + let tt_var = mk_var("tt", mk_type("list", [type_of t_var])) in + let h_var = mk_var("h", tm_ty) in + + let rec f_conv tm = + let arg = rand tm in + if (is_comb arg) then + let hh_tm', tt_tm = dest_comb arg in + let hh_tm = rand hh_tm' in + if (is_comb hh_tm) then + let h_tm', t_tm = dest_comb hh_tm in + let h_tm = rand h_tm' in + let th0 = INST[h_tm, h_var; t_tm, t_var; tt_tm, tt_var] f11_th in + let ltm, rtm = dest_comb(rand(concl th0)) in + let th1 = AP_TERM ltm (f_conv rtm) in + TRANS th0 th1 + else + let th0 = INST[tt_tm, tt_var] f01_th in + let th1 = f_conv (rand(concl th0)) in + TRANS th0 th1 + else + f0_th in + + f_conv tm;; + + +(* +let tm = `FLATTEN [[1;2;3]; [4;3;2;1]]`;; +flatten_conv tm;; +test 1000 flatten_conv tm;; (* 0.080 *) + +flatten_conv2 tm;; +test 1000 flatten_conv2 tm;; (* 0.112 *) + +FLATTEN_REWRITE_CONV tm;; +test 1000 FLATTEN_REWRITE_CONV2 tm;; (* 1.11 *) + +let y = mk_comb(`FLATTEN:((num)list)list->(num)list`, x);; +FLATTEN_CONV y;; +test 100 FLATTEN_CONV y;; (* 0.084 *) +test 100 FLATTEN_REWRITE_CONV y;; (* 4.524 *) +*) + + +(**********************************) + +(* REMOVE_DUPLICATES_CONV *) +let remove_duplicates2 = define `remove_duplicates2 [] acc = acc /\ + remove_duplicates2 (CONS (h:A) t) acc = if (MEM h acc) then remove_duplicates2 t acc + else remove_duplicates2 t (CONS h acc)`;; + +let REMOVE_DUPLICATES_REWRITE_CONV = REWRITE_CONV[REMOVE_DUPLICATES; MEM; ARITH_EQ];; + + +let REMOVE_DUPLICATES_NUM_EMPTY = prove(`REMOVE_DUPLICATES ([]:(num)list) = []`, REWRITE_TAC[REMOVE_DUPLICATES]);; +let REMOVE_DUPLICATES_MEM_NUM_T = UNDISCH_ALL(prove(`(MEM (h:num) t <=> T) ==> + REMOVE_DUPLICATES (CONS h t) = REMOVE_DUPLICATES t`, SIMP_TAC[REMOVE_DUPLICATES]));; +let REMOVE_DUPLICATES_MEM_NUM_F = UNDISCH_ALL(prove(`(MEM (h:num) t <=> F) ==> + REMOVE_DUPLICATES (CONS h t) = CONS h (REMOVE_DUPLICATES t)`, SIMP_TAC[REMOVE_DUPLICATES]));; + +let mem_num_const = `MEM:num->(num)list->bool`;; + + +let rec REMOVE_DUPLICATES_NUM_CONV tm = + let list_tm = rand tm in + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let inst = INST[h_tm, h_var_num; t_tm, t_var_numlist] in + let mem_th = MEM_NUM_CONV (mk_binop mem_num_const h_tm t_tm) in + if (rand(concl mem_th) = t_const) then + let th0 = MY_PROVE_HYP mem_th (inst REMOVE_DUPLICATES_MEM_NUM_T) in + let th1 = REMOVE_DUPLICATES_NUM_CONV (rand(concl th0)) in + TRANS th0 th1 + else + let th0 = MY_PROVE_HYP mem_th (inst REMOVE_DUPLICATES_MEM_NUM_F) in + let ltm, rtm = dest_comb (rand(concl th0)) in + let th1 = REMOVE_DUPLICATES_NUM_CONV rtm in + TRANS th0 (AP_TERM ltm th1) + else + REMOVE_DUPLICATES_NUM_EMPTY;; + + +(* +let tm = `REMOVE_DUPLICATES [1;2;3;4;2;1;3]`;; + +REMOVE_DUPLICATES_REWRITE_CONV tm;; +test 10 REMOVE_DUPLICATES_CONV tm;; (* 0.776 *) + +REMOVE_DUPLICATES_NUM_CONV tm;; +test 1000 REMOVE_DUPLICATES_NUM_CONV tm;; (* 0.548 *) +*) + + +(* +let y = mk_comb(list_of_elements_const, hol_list);; + + +let xxx =(REWRITE_CONV[list_of_elements] THENC + REWRITE_CONV[FLATTEN; ITLIST; APPEND]) +y;; + +let zz = `remove_duplicates2 [1;2;3;4;2;1] []`;; +REWRITE_CONV[remove_duplicates2; MEM; ARITH] zz;; + +let zz = rand(concl xxx);; + +REMOVE_DUPLICATES_REWRITE_CONV zz;; (* infty *) +REMOVE_DUPLICATES_NUM_CONV zz;; +test 10 REMOVE_DUPLICATES_NUM_CONV zz;; (* 0.176 *) + +*) + + + +(**************************************) + +(* LIST_OF_ELEMENTS_CONV *) + +let LIST_OF_ELEMENTS_CONV = + ONCE_REWRITE_CONV[list_of_elements] THENC + ONCE_DEPTH_CONV FLATTEN_CONV THENC + REMOVE_DUPLICATES_NUM_CONV;; + +(* +let y = mk_comb(list_of_elements_const, hol_list);; +test 10 LIST_OF_ELEMENTS_CONV y;; (* 0.184 *) +*) + + +(**********************************) + +(* LIST_OF_NODES_CONV *) + + +let FILTER_NODE_EMPTY = prove(`FILTER (\d:num#num. FST d = x) [] = []`, REWRITE_TAC[FILTER]);; +let FILTER_NODE_CONS_EQ = UNDISCH_ALL (prove(`(n = x <=> T) ==> FILTER (\d:num#num. FST d = x) (CONS (n,m) t) = + CONS (n,m) (FILTER (\d. FST d = x) t)`, SIMP_TAC[FILTER]));; +let FILTER_NODE_CONS_NEQ = UNDISCH_ALL (prove(`(n = x <=> F) ==> FILTER (\d:num#num. FST d = x) (CONS (n,m) t) = + FILTER (\d. FST d = x) t`, SIMP_TAC[FILTER]));; + + + +let rec FILTER_NODE_CONV tm = + let ltm, list_tm = dest_comb tm in + let x_tm = (rand o snd o dest_abs o rand) ltm in + if (is_comb list_tm) then + let h_tm, t_tm = dest_comb list_tm in + let n_tm, m_tm = dest_pair (rand h_tm) in + let inst = INST[n_tm, n_var_num; m_tm, m_var_num; t_tm, t_var_numnumlist; x_tm, x_var_num] in + let eq_th = MY_NUM_EQ_CONV (mk_eq (n_tm, x_tm)) in + if (rand(concl eq_th) = t_const) then + let th0 = MY_PROVE_HYP eq_th (inst FILTER_NODE_CONS_EQ) in + let ltm, rtm = dest_comb (rand(concl th0)) in + let th1 = FILTER_NODE_CONV rtm in + TRANS th0 (AP_TERM ltm th1) + else + let th0 = MY_PROVE_HYP eq_th (inst FILTER_NODE_CONS_NEQ) in + let th1 = FILTER_NODE_CONV (rand(concl th0)) in + TRANS th0 th1 + else + INST[x_tm, x_var_num] FILTER_NODE_EMPTY;; + + + +(* +test 10 LIST_OF_NODES_CONV y;; (* 0.992 *) +*) + + + +(****************************************************) + +(* `node (hypermap_of_list L) x` table construction *) + + +let NODE_HYPERMAP_OF_LIST_EXPLICIT = prove(`!(L:((A)list)list) n d. good_list_nodes L /\ + MEM n (list_of_nodes L) /\ MEM d n + ==> node (hypermap_of_list L) d = set_of_list n`, + REWRITE_TAC[good_list_nodes] THEN REPEAT STRIP_TAC THEN + SUBGOAL_THEN `set_of_list n IN node_set (hypermap_of_list (L:((A)list)list))` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[IN_SET_OF_LIST; nodes_of_list; MEM_MAP] THEN + EXISTS_TAC `n:(A#A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MP_TAC (ISPECL [`hypermap_of_list L:(A#A)hypermap`; `set_of_list n:A#A->bool`] Hypermap.lemma_node_representation) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC (GSYM Hypermap.lemma_node_identity) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[IN_SET_OF_LIST]);; + + +let NODES_HYPERMAP_OF_LIST_ALL = prove(`!(L:((A)list)list). good_list_nodes L ==> + ALL (\n. ALL(\d. node (hypermap_of_list L) d = set_of_list n) n) (list_of_nodes L)`, + REWRITE_TAC[GSYM ALL_MEM] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC NODE_HYPERMAP_OF_LIST_EXPLICIT THEN + ASM_REWRITE_TAC[]);; + + + + +let build_table_of_nodes hyp_list nodes_th = + let table_of_nodes = Hashtbl.create 100 in + let th0 = (UNDISCH_ALL o ISPEC hyp_list) NODES_HYPERMAP_OF_LIST_ALL in + let all_tm = rator (concl th0) in + let th1 = EQ_MP (AP_TERM all_tm nodes_th) th0 in + let th1_list = get_all th1 in + + let build1 = fun th -> + let th = BETA_RULE th in + let list_tm = dest_list(rand(concl th)) in + let ths = get_all th in + let r = CONV_RULE (BETA_CONV THENC RAND_CONV set_of_list_conv) in + map (fun tm, th -> Hashtbl.add table_of_nodes tm (r th)) (zip list_tm ths) in + + let _ = map build1 th1_list in + table_of_nodes;; + + + + +(* +let hol_list, th_table = compute_all pentstring;; +let nodes = Hashtbl.find th_table "nodes";; + + +let MEM_h_CONS_h_t = prove(`!(h:A) t. MEM h (CONS h t)`, REWRITE_TAC[MEM]);; + + + +let th = ISPEC hol_list NODES_HYPERMAP_OF_LIST_ALL;; +let nodes_th = UNDISCH_ALL (REWRITE_RULE[nodes; ALL; set_of_list] th);; +CONJUNCTS nodes_th;; +*) + + +(****************************************************) + +(* `face (hypermap_of_list L) x` table construction *) + + +let FACE_HYPERMAP_OF_LIST_EXPLICIT = prove(`!(L:((A)list)list) f d. good_list L /\ + MEM f (list_of_faces L) /\ MEM d f + ==> face (hypermap_of_list L) d = set_of_list f`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`f:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (X_CHOOSE_THEN `x:A#A` STRIP_ASSUME_TAC) THEN + + SUBGOAL_THEN `MEM (d:A#A) (list_of_darts L)` ASSUME_TAC THENL + [ + MATCH_MP_TAC MEM_FIND_FACE_IMP_MEM_DARTS THEN + EXISTS_TAC `x:A#A` THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + ASM_SIMP_TAC[FACE_OF_LIST] THEN + AP_TERM_TAC THEN + MATCH_MP_TAC MEM_FIND_FACE_IMP_FACES_EQ THEN + CONJ_TAC THENL + [ + UNDISCH_TAC `good_list (L:((A)list)list)` THEN + SIMP_TAC[good_list]; + ALL_TAC + ] THEN + + REMOVE_ASSUM THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]));; + + + +let FACES_HYPERMAP_OF_LIST_ALL = prove(`!(L:((A)list)list). good_list L ==> + ALL (\f. ALL(\d. face (hypermap_of_list L) d = set_of_list f) f) (list_of_faces L)`, + REWRITE_TAC[GSYM ALL_MEM] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC FACE_HYPERMAP_OF_LIST_EXPLICIT THEN + ASM_REWRITE_TAC[]);; + + +let build_table_of_faces hyp_list good_list_th faces_th = + let table_of_faces = Hashtbl.create 100 in + let th0 = MY_PROVE_HYP good_list_th ((UNDISCH_ALL o ISPEC hyp_list) FACES_HYPERMAP_OF_LIST_ALL) in + let all_tm = rator (concl th0) in + let th1 = EQ_MP (AP_TERM all_tm faces_th) th0 in + let th1_list = get_all th1 in + + let build1 = fun th -> + let th = BETA_RULE th in + let list_tm = dest_list(rand(concl th)) in + let ths = get_all th in + let r = CONV_RULE (BETA_CONV THENC RAND_CONV set_of_list_conv) in + map (fun tm, th -> Hashtbl.add table_of_faces tm (r th)) (zip list_tm ths) in + + let _ = map build1 th1_list in + table_of_faces;; + + + + + + + + +(********************************************) + +(* face_map H and inverse (face_map H) tables *) + +let f_list_ext_table = define `(f_list_ext_table L [] (first:A#A) <=> T) + /\ (f_list_ext_table L (CONS h1 (CONS h2 t)) first + <=> f_list_ext L h1 = h2 /\ + inverse (f_list_ext L) h2 = h1 /\ + f_list_ext_table L (CONS h2 t) first) + /\ (f_list_ext_table L [h1] first <=> f_list_ext L h1 = first /\ + inverse (f_list_ext L) first = h1)`;; + + +let list_to_pair list = hd list, hd(tl list);; + + +let F_LIST_EXT_SINGLE, INV_F_LIST_EXT_SINGLE = (list_to_pair o CONJUNCTS o UNDISCH_ALL) + (prove(`f_list_ext_table L [h1:num#num] first + ==> f_list_ext L h1 = first /\ + inverse (f_list_ext L) first = h1`, SIMP_TAC[f_list_ext_table])) and +F_LIST_EXT_CONS, INV_F_LIST_EXT_CONS = (list_to_pair o CONJUNCTS o UNDISCH_ALL) + (prove(`f_list_ext_table L (CONS (h1:num#num) (CONS h2 t)) first + ==> f_list_ext L h1 = h2 /\ + inverse (f_list_ext L) h2 = h1`, SIMP_TAC[f_list_ext_table])) and +F_LIST_EXT_TABLE_CONS = UNDISCH_ALL (prove(`f_list_ext_table L (CONS (h1:num#num) t) first + ==> f_list_ext_table L t first`, + DISJ_CASES_TAC (ISPEC `t:(num#num)list` list_CASES) THENL + [ + ASM_REWRITE_TAC[f_list_ext_table]; + POP_ASSUM STRIP_ASSUME_TAC THEN + ASM_SIMP_TAC[f_list_ext_table] + ]));; + + +let h1_var = `h1:num#num` and + h2_var = `h2:num#num` and + t_var = `t:(num#num)list` and + first_var = `first:num#num` and + l_var = `L:((num)list)list`;; + + +let f_list_ext_table_all th = + let ltm, first_tm = dest_comb(concl th) in + let ltm, list_tm = dest_comb ltm in + let l_tm = rand ltm in + let inst_t = INST[l_tm, l_var; first_tm, first_var] in + let f_single, inv_f_single = inst_t F_LIST_EXT_SINGLE, inst_t INV_F_LIST_EXT_SINGLE in + let f_cons, inv_f_cons = inst_t F_LIST_EXT_CONS, inst_t INV_F_LIST_EXT_CONS in + let f_table = inst_t F_LIST_EXT_TABLE_CONS in + + let rec f_list_raw = fun f_table_th h1_tm t1_tm -> + if (is_comb t1_tm) then + let h2_tm', t2_tm = dest_comb t1_tm in + let h2_tm = rand h2_tm' in + let inst_t = MY_PROVE_HYP f_table_th o INST[h1_tm, h1_var; h2_tm, h2_var; t2_tm, t_var] in + + let f_th, inv_f_th = inst_t f_cons, inst_t inv_f_cons in + let th0 = (MY_PROVE_HYP f_table_th o INST[h1_tm, h1_var; t1_tm, t_var]) f_table in + let f_list, inv_f_list = f_list_raw th0 h2_tm t2_tm in + (h1_tm, f_th) :: f_list, (h2_tm, inv_f_th) :: inv_f_list + + else + let inst_t = MY_PROVE_HYP f_table_th o INST[h1_tm, h1_var] in + let f_th, inv_f_th = inst_t f_single, inst_t inv_f_single in + [h1_tm, f_th], [first_tm, inv_f_th] in + + if (is_comb list_tm) then + let h1_tm, t1_tm = dest_comb list_tm in + f_list_raw th (rand h1_tm) t1_tm + else + [], [];; + + + + +(**********************) + + +let FIND_FACE_LEMMA_EXPLICIT = prove(`!(L:((A)list)list) f d. good_list L /\ + MEM f (list_of_faces L) /\ MEM d f + ==> find_face d L = f`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL[`f:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + UNDISCH_TAC `MEM (d:A#A) f` THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MATCH_MP_TAC MEM_FIND_FACE_IMP_FACES_EQ THEN + UNDISCH_TAC `good_list (L:((A)list)list)` THEN + ASM_SIMP_TAC[good_list]);; + + + +let INVERSE_F_LIST_EXT_LEMMA = prove(`!(L:((A)list)list) d. good_list L ==> + inverse (f_list_ext L) (f_list_ext L d) = d`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `H = hypermap_of_list L:(A#A)hypermap` THEN + MP_TAC (ISPECL [`face_map (H:(A#A)hypermap)`; `dart H:A#A->bool`] PERMUTES_INVERSES) THEN + ASM_SIMP_TAC[Hypermap.hypermap_lemma] THEN + EXPAND_TAC "H" THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST]);; + + + +let NEXT_EL_APPEND_lemma = prove(`!l t1 (h:A) h' t2. ALL_DISTINCT l /\ + l = CONS h (APPEND t1 (CONS h' t2)) ==> + NEXT_EL h' l = if (t2 = []) then h else HD t2`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[NEXT_EL] THEN + ABBREV_TAC `n1 = LENGTH (t1:(A)list)` THEN + SUBGOAL_THEN `INDEX (h':A) l = SUC n1` ASSUME_TAC THENL + [ + SUBGOAL_THEN `h':A = EL (SUC n1) l` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[EL; TL; EL_APPEND; LT_REFL; SUB_REFL; HD]; + ALL_TAC + ] THEN + MATCH_MP_TAC INDEX_EL THEN + ASM_REWRITE_TAC[LENGTH; LENGTH_APPEND] THEN + ARITH_TAC; + ALL_TAC + ] THEN + DISJ_CASES_TAC (ISPEC `t2:(A)list` list_CASES) THENL + [ + ASM_REWRITE_TAC[LENGTH; LENGTH_APPEND; HD] THEN + ARITH_TAC; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + ASM_REWRITE_TAC[LENGTH; LENGTH_APPEND; NOT_CONS_NIL; HD] THEN + REWRITE_TAC[ARITH_RULE `~(SUC n1 = SUC (n1 + SUC (SUC n)) - 1)`] THEN + REWRITE_TAC[ARITH_RULE `SUC n1 + 1 = SUC (n1 + 1)`; EL; TL] THEN + ASM_REWRITE_TAC[EL_APPEND; ARITH_RULE `~(n1 + 1 < n1)`; ARITH_RULE `(n1 + 1) - n1 = 1`] THEN + REWRITE_TAC[ARITH_RULE `1 = SUC 0`; EL; TL; HD]);; + + + + +let F_LIST_EXT_TABLE = prove(`!L:((A)list)list. good_list L + ==> ALL (\f. f_list_ext_table L f (HD f)) (list_of_faces L)`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[good_list] THEN STRIP_TAC THEN + REWRITE_TAC[GSYM ALL_MEM] THEN + X_GEN_TAC `f:(A#A)list` THEN DISCH_TAC THEN + + DISJ_CASES_TAC (ISPEC `f:(A#A)list` list_CASES) THENL + [ + ASM_REWRITE_TAC[f_list_ext_table]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + ASM_REWRITE_TAC[HD] THEN + SUBGOAL_THEN `(!t2 t1. t = APPEND t1 t2 ==> f_list_ext_table L t2 (h:A#A)) ==> f_list_ext_table L (CONS h t) h` MP_TAC THENL + [ + DISCH_THEN (MP_TAC o SPECL [`t:(A#A)list`; `[]:(A#A)list`]) THEN + REWRITE_TAC[APPEND] THEN + DISJ_CASES_TAC (ISPEC `t:(A#A)list` list_CASES) THENL + [ + ASM_REWRITE_TAC[f_list_ext_table] THEN + SUBGOAL_THEN `f_list_ext L (h:A#A) = h` ASSUME_TAC THENL + [ + REWRITE_TAC[f_list_ext; res; f_list] THEN + SUBGOAL_THEN `find_face (h:A#A) L = f` ASSUME_TAC THENL + [ + MATCH_MP_TAC FIND_FACE_LEMMA_EXPLICIT THEN + ASM_REWRITE_TAC[MEM]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `h:A#A IN darts_of_list L` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[darts_of_list; IN_SET_OF_LIST; DART_IN_FACE; MEM]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[NEXT_EL; INDEX; LENGTH; ARITH_RULE `SUC 0 - 1 = 0`; HD]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + FIRST_ASSUM (fun th -> ONCE_REWRITE_TAC[SYM th]) THEN + MP_TAC (SPECL [`L:((A)list)list`; `h:A#A`] INVERSE_F_LIST_EXT_LEMMA) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + ASM_REWRITE_TAC[f_list_ext_table] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + + SUBGOAL_THEN `f_list_ext L h = h':A#A` ASSUME_TAC THENL + [ + REWRITE_TAC[f_list_ext; res; f_list] THEN + SUBGOAL_THEN `find_face (h:A#A) L = f` ASSUME_TAC THENL + [ + MATCH_MP_TAC FIND_FACE_LEMMA_EXPLICIT THEN + ASM_REWRITE_TAC[MEM]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `h:A#A IN darts_of_list L` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[darts_of_list; IN_SET_OF_LIST; DART_IN_FACE; MEM]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[NEXT_EL; INDEX; LENGTH; ARITH_RULE `~(0 = SUC(SUC n) - 1)`] THEN + REWRITE_TAC[ARITH_RULE `0 + 1 = SUC 0`; EL; TL; HD]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + POP_ASSUM (fun th -> ONCE_REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[INVERSE_F_LIST_EXT_LEMMA]; + ALL_TAC + ] THEN + + DISCH_THEN MATCH_MP_TAC THEN + LIST_INDUCT_TAC THENL + [ + REWRITE_TAC[f_list_ext_table]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN + + SUBGOAL_THEN `MEM (h':A#A) f` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[MEM; MEM_APPEND]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `ALL_DISTINCT (f:(A#A)list)` ASSUME_TAC THENL + [ + MATCH_MP_TAC ALL_DISTINCT_FACE THEN + EXISTS_TAC `L:((A)list)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + UNDISCH_TAC `t = APPEND t1 (CONS (h':A#A) t')` THEN + DISJ_CASES_TAC (ISPEC `t':(A#A)list` list_CASES) THENL + [ + ASM_REWRITE_TAC[f_list_ext_table] THEN DISCH_TAC THEN + SUBGOAL_THEN `f_list_ext L (h':A#A) = h` ASSUME_TAC THENL + [ + REWRITE_TAC[f_list_ext; res; f_list] THEN + SUBGOAL_THEN `find_face (h':A#A) L = f` ASSUME_TAC THENL + [ + MATCH_MP_TAC FIND_FACE_LEMMA_EXPLICIT THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `h':A#A IN darts_of_list L` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[darts_of_list; IN_SET_OF_LIST; DART_IN_FACE] THEN + REWRITE_TAC[MEM; MEM_APPEND]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + MP_TAC (ISPECL [`f:(A#A)list`; `t1:(A#A)list`; `h:A#A`; `h':A#A`; `t':(A#A)list`] NEXT_EL_APPEND_lemma) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + POP_ASSUM (fun th -> ONCE_REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[INVERSE_F_LIST_EXT_LEMMA]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + ASM_REWRITE_TAC[f_list_ext_table] THEN + DISCH_TAC THEN + + SUBGOAL_THEN `f_list_ext L (h':A#A) = h''` ASSUME_TAC THENL + [ + REWRITE_TAC[f_list_ext; res; f_list] THEN + SUBGOAL_THEN `find_face (h':A#A) L = f` ASSUME_TAC THENL + [ + MATCH_MP_TAC FIND_FACE_LEMMA_EXPLICIT THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `h':A#A IN darts_of_list L` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[darts_of_list; IN_SET_OF_LIST; DART_IN_FACE] THEN + REWRITE_TAC[MEM; MEM_APPEND]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + MP_TAC (ISPECL [`f:(A#A)list`; `t1:(A#A)list`; `h:A#A`; `h':A#A`; `t':(A#A)list`] NEXT_EL_APPEND_lemma) THEN + ASM_REWRITE_TAC[NOT_CONS_NIL; HD]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + POP_ASSUM (fun th -> ONCE_REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[INVERSE_F_LIST_EXT_LEMMA]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `APPEND t1 [h':A#A]`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN MATCH_MP_TAC THEN + + UNDISCH_TAC `t':(A#A)list = CONS h'' t''` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + REPEAT REMOVE_ASSUM THEN + SPEC_TAC (`t1:(A#A)list`, `t1:(A#A)list`) THEN + LIST_INDUCT_TAC THEN ASM_REWRITE_TAC[APPEND]);; + + + + +let build_f_list_ext_table hol_list good_list_th faces_th = + let f_table, inv_f_table = Hashtbl.create 100, Hashtbl.create 100 in + let th0 = (MY_PROVE_HYP good_list_th o UNDISCH_ALL o ISPEC hol_list) F_LIST_EXT_TABLE in + let all_tm = rator(concl th0) in + let th1 = EQ_MP (AP_TERM all_tm faces_th) th0 in + let th1_list = get_all th1 in + + let step = fun th -> + let th = BETA_RULE th in + let ltm, rtm = dest_comb(concl th) in + let first_th = hd_conv rtm in + let f_table_th = EQ_MP (AP_TERM ltm first_th) th in + let f_list, inv_f_list = f_list_ext_table_all f_table_th in + let _ = map (fun tm, th -> Hashtbl.add f_table tm th) f_list in + let _ = map (fun tm, th -> Hashtbl.add inv_f_table tm th) inv_f_list in + () in + + let _ = map step th1_list in + f_table, inv_f_table;; + + + + +(************************************) + +(* Final conversion *) + + +let compute_all hyp_str = + let thm_table = Hashtbl.create 10 in + let fun_table = Hashtbl.create 10 in + let hol_list = create_hol_list hyp_str in + let faces = LIST_OF_FACES_REWRITE_CONV (mk_comb (list_of_faces_const, hol_list)) in + let LIST_OF_DARTS_CONV = REWRITE_CONV[LIST_OF_DARTS; faces; FLATTEN; ITLIST; APPEND] in + let darts = LIST_OF_DARTS_CONV (mk_comb (list_of_darts_const, hol_list)) in + + let GOOD_LIST_CONV tm = + let th0 = REWRITE_CONV[good_list; darts] tm in + let [c1;c2;c3] = conjuncts (rand(concl th0)) in + let th1 = ALL_DISTINCT_NUM_PAIR_CONV c1 in + let th2 = REWRITE_CONV[ALL; NOT_CONS_NIL] c2 in + let th3 = (REWRITE_CONV[ALL_MEM] THENC GOOD_LIST_COND3_CONV) c3 in + let th = CONJ (EQT_ELIM th1) (CONJ (EQT_ELIM th2) (EQT_ELIM th3)) in + EQ_MP (SYM th0) th in + + let y = mk_comb(good_list_const, hol_list) in + let good_list_th = GOOD_LIST_CONV y in + +(* +test 1 GOOD_LIST_CONV y;; (* 2.448; (ALL_DISTINCT_NUM_PAIR_CONV) 1.748; (COND3) 0.244 *) +*) + + let components_th = MATCH_MP COMPONENTS_HYPERMAP_OF_LIST good_list_th in + let darts_th = REWRITE_RULE[darts_of_list; darts] (CONJUNCT1 components_th) in + let faces_th = REWRITE_RULE[faces_of_list; faces] (MATCH_MP FACE_SET_EQ_LIST good_list_th) in + (*REWRITE_RULE[MAP; set_of_list] faces_th;; *) + + let y = mk_comb(list_of_elements_const, hol_list) in + let elements = LIST_OF_ELEMENTS_CONV y in + + let LIST_OF_NODES_CONV = ONCE_REWRITE_CONV[list_of_nodes] THENC + ONCE_REWRITE_CONV[darts] THENC ONCE_REWRITE_CONV[elements] THENC + map_conv_univ (BETA_CONV THENC FILTER_NODE_CONV) in + + let y = mk_comb(list_of_nodes_const, hol_list) in + let nodes = LIST_OF_NODES_CONV y in + + let good_nodes_th = ASSUME (mk_comb(`good_list_nodes:((num)list)list->bool`, hol_list)) in + let hyp_nodes = REWRITE_RULE[good_list_nodes; nodes_of_list; nodes; MAP; set_of_list] good_nodes_th in + + (* Table of node L x *) + let table_of_nodes = build_table_of_nodes hol_list nodes in + + (* Table of face L x *) + let table_of_faces = build_table_of_faces hol_list good_list_th faces in + + (* Table of face_map and inverses *) +(* + let f_list_th1 = MP (ISPEC hol_list F_LIST_EXT_TABLE) good_list_th in + let f_list_th2 = REWRITE_RULE[faces; ALL] f_list_th1 in + let f_list_ext_table_th = REWRITE_RULE[f_list_ext_table; HD] f_list_th2 in +*) + let f_list_ext_table, inv_f_list_ext_table = build_f_list_ext_table hol_list good_list_th faces in + + (* List of edges *) + let y = mk_comb(list_of_edges_const, hol_list) in + let edges = REWRITE_CONV[list_of_edges; darts; MAP] y in + + (* faces3, face4, face5, faces6 *) + let faces3_tm = mk_comb(list_of_faces3_const, hol_list) in + let faces4_tm = mk_comb(list_of_faces4_const, hol_list) in + let faces5_tm = mk_comb(list_of_faces5_const, hol_list) in + let faces6_tm = mk_comb(list_of_faces6_const, hol_list) in + + let filter = filter_conv_univ (BETA_CONV THENC + LAND_CONV (length_conv_univ NUM_SUC_CONV) THENC + MY_NUM_EQ_CONV) in + + let faces3 = (REWRITE_CONV[list_of_faces3; faces] THENC filter) faces3_tm in + let faces4 = (REWRITE_CONV[list_of_faces4; faces] THENC filter) faces4_tm in + let faces5 = (REWRITE_CONV[list_of_faces5; faces] THENC filter) faces5_tm in + let faces6 = (REWRITE_CONV[list_of_faces6; faces] THENC filter) faces6_tm in + + (* darts3, darts4, dartsX *) + let darts3_tm = mk_comb(list_of_darts3_const, hol_list) in + let darts4_tm = mk_comb(list_of_darts4_const, hol_list) in + + let darts3 = (REWRITE_CONV[list_of_darts3; faces3] THENC flatten_conv_univ) darts3_tm in + let darts4 = (REWRITE_CONV[list_of_darts4; faces4] THENC flatten_conv_univ) darts4_tm in + + let filter = filter_conv_univ (BETA_CONV THENC + RAND_CONV (length_conv_univ NUM_SUC_CONV) THENC + NUM_LE_CONV) in + let dartsX_tm = mk_comb(list_of_dartsX_const, hol_list) in + let dartsX = (REWRITE_CONV[list_of_dartsX; list_of_faces456; faces] THENC + RAND_CONV filter THENC flatten_conv_univ) dartsX_tm in + + (* add everything to the table *) + let add = fun str thm -> Hashtbl.add thm_table str thm in + let _ = + add "faces" faces; + add "darts" darts; + add "good_list" good_list_th; + add "edges" edges; + add "nodes" nodes; + add "elements" elements; + add "darts3" darts3; + add "darts4" darts4; + add "dartsX" dartsX; + add "faces3" faces3; + add "faces4" faces4; + add "faces5" faces5; + add "faces6" faces6 in + + let add = fun str table -> Hashtbl.add fun_table str table in + let _ = + add "face" table_of_faces; + add "node" table_of_nodes; + add "inverse" inv_f_list_ext_table; + add "f_list_ext" f_list_ext_table in + + hol_list, thm_table, fun_table;; + + + +(* +let hol_list, thm_table, fun_table = compute_all pentstring;; + +let table = Hashtbl.find fun_table "f_list_ext";; +Hashtbl.find table `0,2`;; + +(* (1): 0.560; (2): 0.640; (3): 1.424; (4): 1.448; (5): 0.748 *) +test 1 compute_all pentstring;; + +Hashtbl.find list_thm "faces_table";; +Hashtbl.find list_thm "darts4";; +Hashtbl.find list_thm "edges";; +*) + + + + + + + + + + + + + + + + +(* +let hol_list, list_thm = compute_all pentstring;; +let th1 = MP (ISPEC hol_list FACE_MAP_TABLE) (Hashtbl.find list_thm "good_list");; +let th2 = REWRITE_RULE[Hashtbl.find list_thm "faces"; ALL] th1;; +let th3 = REWRITE_RULE[face_map_table; HD] th2;; +*) + + +(* Explicit orbit computation *) +(* Orbits for lists *) + +let list_orbit = define `list_orbit f x acc = if (MEM x acc) then acc else list_orbit f (f x) (CONS x acc)`;; + + +(* The same definitions as in "pack_defs.hl" *) +let REVERSE_TABLE = define `(REVERSE_TABLE (f:num->A) 0 = []) /\ + (REVERSE_TABLE f (SUC i) = CONS (f i) ( REVERSE_TABLE f i))`;; + +let TABLE = new_definition `!(f:num->A) k. TABLE f k = REVERSE (REVERSE_TABLE f k)`;; + + +let LENGTH_REVERSE = prove(`!l:(A)list. LENGTH (REVERSE l) = LENGTH l`, + LIST_INDUCT_TAC THEN ASM_REWRITE_TAC[REVERSE; LENGTH; LENGTH_APPEND] THEN ARITH_TAC);; + + +let LENGTH_REVERSE_TABLE = prove(`!(f:num->A) n. LENGTH (REVERSE_TABLE f n) = n`, + GEN_TAC THEN INDUCT_TAC THEN ASM_REWRITE_TAC[REVERSE_TABLE; LENGTH]);; + + +let LENGTH_TABLE = prove(`!(f:num->A) n. LENGTH(TABLE f n) = n`, + REWRITE_TAC[TABLE; LENGTH_REVERSE; LENGTH_REVERSE_TABLE]);; + + +let EL_REVERSE_TABLE = prove(`!(f:num->A) n i. i < n ==> EL i (REVERSE_TABLE f n) = f (n - i - 1)`, + GEN_TAC THEN INDUCT_TAC THEN GEN_TAC THEN REWRITE_TAC[ARITH_RULE `~(i < 0)`] THEN + DISCH_TAC THEN + MP_TAC (SPEC `i:num` num_CASES) THEN + DISCH_THEN DISJ_CASES_TAC THENL + [ + ASM_REWRITE_TAC[REVERSE_TABLE; EL; HD; ARITH_RULE `SUC n - 0 - 1 = n`]; + ALL_TAC + ] THEN + POP_ASSUM CHOOSE_TAC THEN + UNDISCH_TAC `i < SUC n` THEN ASM_REWRITE_TAC[LT_SUC; EL] THEN + REWRITE_TAC[REVERSE_TABLE; TL; ARITH_RULE `SUC n - SUC n' = n - n'`] THEN + DISCH_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]);; + + +let EL_REVERSE = prove(`!(l:(A)list) i. i < LENGTH l ==> EL i (REVERSE l) = EL (LENGTH l - i - 1) l`, + LIST_INDUCT_TAC THEN REWRITE_TAC[LENGTH; REVERSE; LT] THEN + REPEAT STRIP_TAC THENL + [ + ASM_REWRITE_TAC[EL_APPEND; LENGTH_REVERSE; LT_REFL; SUB_REFL] THEN + REWRITE_TAC[ARITH_RULE `SUC n - n - 1 = 0`] THEN + REWRITE_TAC[EL; HD]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[EL_APPEND; LENGTH_REVERSE] THEN + ASM_SIMP_TAC[ARITH_RULE `i < n ==> SUC n - i - 1 = SUC(n - i - 1)`] THEN + REWRITE_TAC[EL; TL]);; + + +let EL_TABLE = prove(`!(f:num->A) n i. i < n ==> EL i (TABLE f n) = f i`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[TABLE] THEN + MP_TAC (SPECL [`REVERSE_TABLE (f:num->A) n`; `i:num`] EL_REVERSE) THEN + ASM_REWRITE_TAC[LENGTH_REVERSE_TABLE] THEN + MP_TAC (SPECL [`f:(num->A)`; `n:num`; `n - i - 1`] EL_REVERSE_TABLE) THEN + ASM_SIMP_TAC[ARITH_RULE `i < n ==> n - (n - i - 1) - 1 = i`] THEN + ASM_SIMP_TAC[ARITH_RULE `i < n ==> n - i - 1 < n`]);; + + + + +let LIST_ORBIT_LEMMA = prove(`!f (x:A) n. 1 <= n /\ (f POWER n) x = x /\ + (!i j. ~(i = j) /\ i < n /\ j < n ==> ~((f POWER i) x = (f POWER j) x)) + ==> (!k. k <= n ==> list_orbit f ((f POWER (n - k)) x) + (REVERSE_TABLE (\i. (f POWER i) x) (n - k)) = REVERSE_TABLE (\i. (f POWER i) x) n)`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + INDUCT_TAC THEN DISCH_TAC THENL + [ + REWRITE_TAC[SUB_0] THEN + ONCE_REWRITE_TAC[list_orbit] THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `MEM (x:A) (REVERSE_TABLE (\i. (f POWER i) x) n)` ASSUME_TAC THENL + [ + REWRITE_TAC[MEM_EXISTS_EL] THEN + EXISTS_TAC `n - 1` THEN + REWRITE_TAC[LENGTH_REVERSE_TABLE] THEN + MP_TAC (ARITH_RULE `1 <= n ==> n - 1 < n`) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_SIMP_TAC[EL_REVERSE_TABLE] THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= n ==> n - (n - 1) - 1 = 0`] THEN + REWRITE_TAC[Hypermap.POWER_0; I_THM]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ONCE_REWRITE_TAC[list_orbit] THEN + COND_CASES_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REWRITE_TAC[MEM_EXISTS_EL] THEN + REWRITE_TAC[LENGTH_REVERSE_TABLE] THEN + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + ASM_SIMP_TAC[EL_REVERSE_TABLE] THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`n - SUC k`; `n - SUC k - i - 1`]) THEN + ANTS_TAC THENL + [ + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + UNDISCH_TAC `1 <= n` THEN + ARITH_TAC; + ALL_TAC + ] THEN + + SIMP_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `f ((f POWER (n - SUC k)) (x:A)) = (f POWER (n - k)) x` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_SIMP_TAC[ARITH_RULE `SUC k <= n ==> n - k = SUC(n - SUC k)`] THEN + REWRITE_TAC[Hypermap.COM_POWER; o_THM]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `CONS ((f POWER (n - SUC k)) (x:A)) (REVERSE_TABLE (\i. (f POWER i) x) (n - SUC k)) = REVERSE_TABLE (\i. (f POWER i) x) (n - k)` ASSUME_TAC THENL + [ + ASM_SIMP_TAC[ARITH_RULE `SUC k <= n ==> n - k = SUC(n - SUC k)`] THEN + REWRITE_TAC[REVERSE_TABLE]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + UNDISCH_TAC `SUC k <= n` THEN ARITH_TAC);; + + + +let LIST_ORBIT_EXPLICIT = prove(`!f (x:A) n. 1 <= n /\ (f POWER n) x = x /\ + (!i j. ~(i = j) /\ i < n /\ j < n ==> ~((f POWER i) x = (f POWER j) x)) + ==> list_orbit f x [] = REVERSE_TABLE (\i. (f POWER i) x) n`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL LIST_ORBIT_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `n:num`) THEN + REWRITE_TAC[LE_REFL; SUB_REFL; Hypermap.POWER; I_THM] THEN + REWRITE_TAC[REVERSE_TABLE]);; + + +let FINITE_ORBIT_MAP_EXPLICIT = prove(`!s f (x:A). f permutes s /\ FINITE s ==> + ?n. 1 <= n /\ + orbit_map f x = {(f POWER k) x | k < n} /\ + (f POWER n) x = x /\ + (!i j. ~(i = j) /\ i < n /\ j < n ==> ~((f POWER i) x = (f POWER j) x))`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `n = CARD (orbit_map f (x:A))` THEN + EXISTS_TAC `n:num` THEN + MP_TAC (SPEC_ALL Hypermap_and_fan.FINITE_ORBIT_MAP) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REPEAT CONJ_TAC THENL + [ + MP_TAC (SPEC_ALL Hypermap_and_fan.ORBIT_MAP_CARD_POS) THEN + ASM_REWRITE_TAC[] THEN + ARITH_TAC; + EXPAND_TAC "n" THEN + MATCH_MP_TAC Hypermap.lemma_cycle_orbit THEN + EXISTS_TAC `s:A->bool` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REPEAT STRIP_TAC THEN + MP_TAC (INST[`n:num`, `k:num`] (SPEC_ALL Hypermap_and_fan.ORBIT_MAP_INJ)) THEN + ASM_REWRITE_TAC[]);; + + + +let ORBIT_EQ_LIST_ORBIT = prove(`!f s (x:A). f permutes s /\ FINITE s + ==> orbit_map f x = set_of_list (list_orbit f x [])`, + REPEAT GEN_TAC THEN + DISCH_THEN (MP_TAC o MATCH_MP FINITE_ORBIT_MAP_EXPLICIT) THEN + DISCH_THEN (STRIP_ASSUME_TAC o SPEC `x:A`) THEN + ASM_SIMP_TAC[LIST_ORBIT_EXPLICIT] THEN + + REWRITE_TAC[EXTENSION] THEN X_GEN_TAC `y:A` THEN + REWRITE_TAC[IN_ELIM_THM; IN_SET_OF_LIST; MEM_EXISTS_EL] THEN + REWRITE_TAC[LENGTH_REVERSE_TABLE] THEN + EQ_TAC THEN STRIP_TAC THENL + [ + EXISTS_TAC `n - k - 1` THEN + MP_TAC (ARITH_RULE `k < n ==> n - k - 1 < n`) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_SIMP_TAC[EL_REVERSE_TABLE] THEN + ASM_SIMP_TAC[ARITH_RULE `k < n ==> n - (n - k - 1) - 1 = k`]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN + ASM_SIMP_TAC[EL_REVERSE_TABLE] THEN DISCH_TAC THEN + EXISTS_TAC `n - i - 1` THEN + ASM_SIMP_TAC[ARITH_RULE `i < n ==> n - i - 1 < n`]);; + + +(**************) + + +(* PREV_EL_CONV *) + +let [el_0_th; el_suc_th] = CONJUNCTS (ISPECL[`n:num`; `l:(num#num)list`] (GEN_ALL EL));; +let n_var_num = `n:num`;; +let l_list = `l:(num#num)list`;; +let zero_const = `_0`;; + +let rec el_conv tm = + let ltm, l_tm = dest_comb tm in + let el_tm, n_tm = dest_comb ltm in + if (rand n_tm <> zero_const) then + let n_suc_th = num_CONV n_tm in + let m_tm = rand (rand (concl n_suc_th)) in + let th0 = AP_THM (AP_TERM el_tm n_suc_th) l_tm in + let th1' = INST[m_tm, n_var_num; l_tm, l_list] el_suc_th in + let th1 = REWRITE_RULE[TL] th1' in + let th2 = el_conv (rand(concl th1)) in + TRANS th0 (TRANS th1 th2) + else + let th0' = INST[l_tm, l_list] el_0_th in + REWRITE_RULE[HD] th0';; + + + +let prev_hd_th = prove(`PREV_EL (x:A) (CONS x t) = LAST (CONS x t)`, + REWRITE_TAC[PREV_EL; INDEX]);; + + + +let PREV_EL_CONV = REWRITE_CONV[PREV_EL; INDEX; PAIR_EQ; ARITH; LAST; NOT_CONS_NIL] THENC + TRY_CONV (ONCE_DEPTH_CONV el_conv);; + + +(* +let N_LIST_CONV = (REWRITE_CONV[n_list] THENC + REWRITE_CONV[find_face; find_list; faces; MEM; PAIR_EQ; ARITH] THENC + ONCE_DEPTH_CONV PREV_EL_CONV THENC + REWRITE_CONV[e_list]);; +*) +(* +let z = mk_comb (`n_list:((num)list)list->num#num->num#num`, x);; +let zz = mk_comb (z, `2,0`);; + + +N_LIST_CONV zz;; +test 10 N_LIST_CONV zz;; (* 0.704 *) +*) + + +let list_orbit_mem = UNDISCH_ALL (prove(`(MEM (x:num#num) acc <=> T) ==> list_orbit f x acc = acc`, + ONCE_REWRITE_TAC[list_orbit] THEN + SIMP_TAC[]));; +let list_orbit_not_mem = UNDISCH_ALL (prove(`(MEM (x:num#num) acc <=> F) + ==> list_orbit f x acc = list_orbit f (f x) (CONS x acc)`, + DISCH_TAC THEN + GEN_REWRITE_TAC LAND_CONV[list_orbit] THEN + ASM_REWRITE_TAC[]));; + + + +let rec list_orbit_conv f_conv tm = + let ltm, acc = dest_comb tm in + let ltm, x_arg = dest_comb ltm in + let ltm, f_arg = dest_comb ltm in + let mem_th = REWRITE_CONV[MEM; PAIR_EQ; ARITH] (mk_binop mem_const x_arg acc) in + if (rand(concl mem_th) = f_const) then + let th0' = INST[x_arg, x_var_pair; f_arg, f_var_fun; acc, acc_var] list_orbit_not_mem in + let th0 = PROVE_HYP mem_th th0' in + let tm1 = rand(concl th0) in + let ltm, acc1 = dest_comb tm1 in + let ltm, x_arg1 = dest_comb ltm in + let x_th = f_conv x_arg1 in + let th1 = TRANS th0 (AP_THM (AP_TERM ltm x_th) acc1) in + let th2 = list_orbit_conv f_conv (rand(concl th1)) in + TRANS th1 th2 + else + let th0 = INST[x_arg, x_var_pair; f_arg, f_var_fun; acc, acc_var] list_orbit_mem in + PROVE_HYP mem_th th0;; + + +(* +let zzz = + let t1 = mk_comb (`list_orbit:(num#num->num#num)->(num#num)->(num#num)list->(num#num)list`, z) in + mk_comb(mk_comb(t1, `12,7`), `[]:(num#num)list`);; + +list_orbit_conv N_LIST_CONV zzz;; +*) diff --git a/formal_lp/old/hypermap/list_hypermap_defs.hl b/formal_lp/old/hypermap/list_hypermap_defs.hl new file mode 100644 index 0000000..2cba3d6 --- /dev/null +++ b/formal_lp/old/hypermap/list_hypermap_defs.hl @@ -0,0 +1,219 @@ +(* Sets *) + +let hyp_edge_pairs = new_definition `hyp_edge_pairs H = {x, edge_map H x | x | x IN dart H}`;; + +let hyp_dart3 = new_definition `hyp_dart3 H = {x | x IN dart H /\ CARD (face H x) = 3}`;; +let hyp_dart4 = new_definition `hyp_dart4 H = {x | x IN dart H /\ CARD (face H x) = 4}`;; +let hyp_dartX = new_definition `hyp_dartX H = {x | x IN dart H /\ 4 <= CARD (face H x)}`;; + +let hyp_face3 = new_definition `hyp_face3 H = {f | f IN face_set H /\ CARD f = 3}`;; +let hyp_face4 = new_definition `hyp_face4 H = {f | f IN face_set H /\ CARD f = 4}`;; +let hyp_face5 = new_definition `hyp_face5 H = {f | f IN face_set H /\ CARD f = 5}`;; +let hyp_face6 = new_definition `hyp_face6 H = {f | f IN face_set H /\ CARD f = 6}`;; + + +(* List operations *) + +let FLATTEN = new_definition `FLATTEN ll = ITLIST (\list all. APPEND list all) ll []`;; + +let REMOVE_DUPLICATES = define `REMOVE_DUPLICATES [] = [] /\ + REMOVE_DUPLICATES (CONS h t) = if (MEM h t) then REMOVE_DUPLICATES t else CONS h (REMOVE_DUPLICATES t)`;; + + +(* INDEX 2 [1;3;4;2] = 3 *) +let INDEX = define `INDEX i [] = 0 /\ INDEX i (CONS h t) = if (i = h) then 0 else SUC (INDEX i t)`;; + +let ALL_DISTINCT = new_definition `ALL_DISTINCT list = (!i j. i < LENGTH list /\ j < LENGTH list /\ ~(i = j) ==> ~(EL i list = EL j list))`;; + + +(* Sum of the list elements *) +let list_sum = new_definition `list_sum list f = ITLIST (\t1 t2. f t1 + t2) list (&0)`;; + + + +(* shift_left [1;2;3] = [2;3;1] *) +let shift_left = define `shift_left [] = [] /\ shift_left (CONS h t) = APPEND t [h]`;; + +let shift_right = new_definition `shift_right list = if (list = []) then [] else CONS (LAST list) (BUTLAST list)`;; + + +(* Returns the next element in the cyclic order: + NEXT_EL [1;3;2] 3 = 2 + NEXT_EL [1;3;2] 2 = 1 *) + +let NEXT_EL = new_definition `NEXT_EL x list = + if (INDEX x list = LENGTH list - 1) then HD list else EL (INDEX x list + 1) list`;; + +let PREV_EL = new_definition `PREV_EL x list = + if (INDEX x list = 0) then LAST list else EL (INDEX x list - 1) list`;; + + + +(* list_pairs [1;2;3] = {(1,2), (2,3), (3,1)} *) +let list_pairs = new_definition `list_pairs list = ZIP list (shift_left list)`;; + + +let list_of_darts = new_definition `list_of_darts ll = ITLIST (\list all. APPEND (list_pairs list) all) ll []`;; + +let darts_of_list = new_definition `darts_of_list ll = set_of_list (list_of_darts ll)`;; + +let list_of_edges = new_definition `list_of_edges L = MAP (\d:A#A. d, (SND d,FST d)) (list_of_darts L)`;; + +let list_of_faces = new_definition `list_of_faces ll = MAP list_pairs ll`;; + +let faces_of_list = new_definition `faces_of_list ll = MAP set_of_list (list_of_faces ll)`;; + +let list_of_elements = new_definition `list_of_elements ll = REMOVE_DUPLICATES (FLATTEN ll)`;; + +let elements_of_list = new_definition `elements_of_list ll = set_of_list (list_of_elements ll)`;; + +let list_of_nodes = new_definition `list_of_nodes ll = MAP (\x. FILTER (\d. FST d = x) (list_of_darts ll)) (list_of_elements ll)`;; + +let nodes_of_list = new_definition `nodes_of_list ll = MAP set_of_list (list_of_nodes ll)`;; + + +(* Special lists *) + +let list_of_faces3 = new_definition `list_of_faces3 (L:((A)list)list) = + FILTER (\f. LENGTH f = 3) (list_of_faces L)`;; + +let list_of_faces4 = new_definition `list_of_faces4 (L:((A)list)list) = + FILTER (\f. LENGTH f = 4) (list_of_faces L)`;; + +let list_of_faces5 = new_definition `list_of_faces5 (L:((A)list)list) = + FILTER (\f. LENGTH f = 5) (list_of_faces L)`;; + +let list_of_faces6 = new_definition `list_of_faces6 (L:((A)list)list) = + FILTER (\f. LENGTH f = 6) (list_of_faces L)`;; + +let list_of_faces456 = new_definition `list_of_faces456 (L:((A)list)list) = + FILTER (\f. 4 <= LENGTH f) (list_of_faces L)`;; + + +let list_of_darts3 = new_definition `list_of_darts3 (L:((A)list)list) = + FLATTEN (list_of_faces3 L)`;; + +let list_of_darts4 = new_definition `list_of_darts4 (L:((A)list)list) = + FLATTEN (list_of_faces4 L)`;; + +let list_of_dartsX = new_definition `list_of_dartsX (L:((A)list)list) = + FLATTEN (list_of_faces456 L)`;; + + +(* Faces *) + +let find_list = define `find_list x [] = [] /\ find_list x (CONS h t) = if (MEM x h) then h else find_list x t`;; + +let find_pair_list = define `find_pair_list d [] = [] /\ find_pair_list d (CONS h t) = if (MEM d (list_pairs h)) then h else find_pair_list d t`;; + +let find_face = new_definition `find_face d ll = find_list d (list_of_faces ll)`;; + + +(* Hypermap maps *) + +let f_list = new_definition `f_list ll d = NEXT_EL d (find_face d ll)`;; + +let e_list = new_definition `e_list ll d = (SND d, FST d)`;; + +(* let n_list = new_definition `n_list ll d = (FST d, PREV_EL (FST d) (find_pair_list d ll))`;; *) +let n_list = new_definition `n_list ll d = e_list ll (PREV_EL d (find_face d ll))`;; + + + + +(* Hypermap definition *) + +let f_list_ext = new_definition `f_list_ext ll = res (f_list ll) (darts_of_list ll)`;; +let e_list_ext = new_definition `e_list_ext ll = res (e_list ll) (darts_of_list ll)`;; +let n_list_ext = new_definition `n_list_ext ll = res (n_list ll) (darts_of_list ll)`;; + + +let hypermap_of_list = new_definition `hypermap_of_list (ll:((A)list)list) = hypermap (darts_of_list ll, e_list_ext ll, n_list_ext ll, f_list_ext ll)`;; + + + +(* Define "good" lists *) +let good_list = new_definition `good_list ll <=> ALL_DISTINCT (list_of_darts ll) /\ + ALL (\l. ~(l = [])) ll /\ + (!d. MEM d (list_of_darts ll) ==> MEM (SND d, FST d) (list_of_darts ll))`;; + + + + + + + +(* Some general theorems *) + +let ALL_DISTINCT_ALT = prove(`!(h:A) t. (ALL_DISTINCT ([]:(A)list) <=> T) /\ (ALL_DISTINCT (CONS h t) <=> ALL_DISTINCT t /\ ~(MEM h t))`, + REPEAT STRIP_TAC THENL + [ + REWRITE_TAC[ALL_DISTINCT; LENGTH] THEN + REWRITE_TAC[ARITH_RULE `~(i < 0)`]; + ALL_TAC + ] THEN + + REWRITE_TAC[ALL_DISTINCT] THEN + EQ_TAC THENL + [ + REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPECL [`SUC i`; `SUC j`]) THEN + ASM_REWRITE_TAC[LENGTH; LT_SUC; SUC_INJ] THEN + ASM_REWRITE_TAC[EL; TL]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN REWRITE_TAC[MEM_EXISTS_EL] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`0`; `SUC i`]) THEN + ASM_REWRITE_TAC[LENGTH; LT_SUC; LT_0; GSYM NOT_SUC] THEN + REWRITE_TAC[EL; HD; TL]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + DISJ_CASES_TAC (SPEC `i:num` num_CASES) THENL + [ + DISJ_CASES_TAC (SPEC `j:num` num_CASES) THENL + [ + UNDISCH_TAC `~(i = j:num)` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + POP_ASSUM CHOOSE_TAC THEN + ASM_REWRITE_TAC[EL; HD; TL] THEN + DISCH_TAC THEN UNDISCH_TAC `~MEM (h:A) t` THEN + REWRITE_TAC[MEM_EXISTS_EL] THEN + EXISTS_TAC `n:num` THEN ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `j < LENGTH (CONS (h:A) t)` THEN + ASM_REWRITE_TAC[LENGTH; LT_SUC]; + ALL_TAC + ] THEN + + POP_ASSUM CHOOSE_TAC THEN + DISJ_CASES_TAC (SPEC `j:num` num_CASES) THENL + [ + ASM_REWRITE_TAC[EL; HD; TL] THEN + DISCH_TAC THEN UNDISCH_TAC `~MEM (h:A) t` THEN + REWRITE_TAC[MEM_EXISTS_EL] THEN + EXISTS_TAC `n:num` THEN ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `i < LENGTH (CONS (h:A) t)` THEN + ASM_REWRITE_TAC[LENGTH; LT_SUC]; + ALL_TAC + ] THEN + + POP_ASSUM CHOOSE_TAC THEN + ASM_REWRITE_TAC[EL; TL] THEN + DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`n:num`; `n':num`]) THEN + ANTS_TAC THENL + [ + UNDISCH_TAC `i < LENGTH (CONS (h:A) t)` THEN UNDISCH_TAC `j < LENGTH (CONS (h:A) t)` THEN + UNDISCH_TAC `~(i = j:num)` THEN + ASM_SIMP_TAC[LENGTH; LT_SUC; SUC_INJ]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[]);; diff --git a/formal_lp/old/hypermap/list_hypermap_iso.hl b/formal_lp/old/hypermap/list_hypermap_iso.hl new file mode 100644 index 0000000..5f8dd36 --- /dev/null +++ b/formal_lp/old/hypermap/list_hypermap_iso.hl @@ -0,0 +1,672 @@ +needs "../formal_lp/hypermap/list_hypermap.hl";; +needs "tame/tame_defs.hl";; + +open Hypermap_and_fan;; +open Tame_defs;; + + +let IN_TRANS = prove(`!(x:A) s t. t SUBSET s /\ x IN t ==> x IN s`, + SET_TAC[]);; + + + + +(* TODO: move to HypermapAndFan.hl *) +let FST_NODE_HYPERMAP_OF_FAN = prove(`!V E x y. FAN (vec 0,V,E) /\ + x IN node (hypermap_of_fan (V,E)) y + ==> FST x = FST y`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC FAN_NODE_EQ_lemma THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `E:(real^3->bool)->bool`] THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC EQ_SYM THEN + MATCH_MP_TAC Hypermap.lemma_node_identity THEN + ASM_REWRITE_TAC[]);; + +let E_FAN_PAIR_EXT_EXPLICIT = prove(`!V E v w. (v,w) IN dart_of_fan (V,E) + ==> e_fan_pair_ext (V,E) (v,w) = (w,v)`, + REWRITE_TAC[dart_of_fan; GSYM dart1_of_fan; IN_UNION] THEN + REPEAT GEN_TAC THEN + REWRITE_TAC[Fan_defs.e_fan_pair_ext] THEN + COND_CASES_TAC THEN REWRITE_TAC[Fan_defs.e_fan_pair] THEN + REWRITE_TAC[IN_ELIM_THM; PAIR_EQ] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[]);; + +let DART_OF_FAN_SYM = prove(`!V E v w. (v,w) IN dart_of_fan (V,E) <=> (w,v) IN dart_of_fan (V,E)`, + GEN_TAC THEN GEN_TAC THEN + SUBGOAL_THEN `!v w. (v,w) IN dart_of_fan (V,E) ==> (w,v) IN dart_of_fan (V,E)` ASSUME_TAC THENL + [ + REWRITE_TAC[dart_of_fan; IN_UNION; IN_ELIM_THM; PAIR_EQ] THEN + REPEAT STRIP_TAC THENL + [ + DISJ1_TAC THEN + EXISTS_TAC `v':real^3` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + DISJ2_TAC THEN + MAP_EVERY EXISTS_TAC [`w':real^3`; `v':real^3`] THEN + ASM_REWRITE_TAC[Collect_geom.PER_SET2]; + ALL_TAC + ] THEN + REPEAT GEN_TAC THEN EQ_TAC THEN ASM_REWRITE_TAC[]);; + + + + + +(* Isomorphism between hypermap_of_fan and hypermap_of_list *) + +let isomorphism = new_definition `isomorphism f (H, G) <=> + BIJ f (dart H) (dart G) /\ + (!x. x IN dart H ==> + edge_map G (f x) = f (edge_map H x) /\ + node_map G (f x) = f (node_map H x) /\ + face_map G (f x) = f (face_map H x))`;; + + +let res_inverse = new_definition `res_inverse f s = (\y. @x. f x = y /\ x IN s)`;; + + +let INJ_IMP_RES_INVERSE = prove(`!(f:A->B) s t. INJ f s t ==> + (!x. x IN s ==> res_inverse f s (f x) = x)`, + REWRITE_TAC[INJ] THEN + REPEAT STRIP_TAC THEN + REWRITE_TAC[res_inverse] THEN + MATCH_MP_TAC SELECT_UNIQUE THEN + REWRITE_TAC[] THEN + GEN_TAC THEN EQ_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]);; + + +let SURJ_IMP_RES_INVERSE = prove(`!(f:A->B) s t. SURJ f s t ==> + (!y. y IN t ==> f (res_inverse f s y) = y /\ res_inverse f s y IN s)`, + REWRITE_TAC[SURJ; res_inverse] THEN + REPEAT GEN_TAC THEN STRIP_TAC THEN STRIP_TAC THEN STRIP_TAC THEN + MP_TAC (ISPEC `\x. (f:A->B) x = y /\ x IN s` SELECT_AX) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `y:B`) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + DISCH_THEN (MP_TAC o SPEC `y':A`) THEN + ASM_SIMP_TAC[]);; + + +let BIJ_IMP_RES_INVERSE = prove(`!(f:A->B) s t. BIJ f s t ==> + (!x. x IN s ==> res_inverse f s (f x) = x) /\ + (!y. y IN t ==> f (res_inverse f s y) = y) /\ + (!y. y IN t ==> res_inverse f s y IN s)`, + REWRITE_TAC[BIJ] THEN REPEAT GEN_TAC THEN STRIP_TAC THEN + MP_TAC (SPEC_ALL INJ_IMP_RES_INVERSE) THEN + MP_TAC (SPEC_ALL SURJ_IMP_RES_INVERSE) THEN + ASM_SIMP_TAC[]);; + + + + +let INJ_ALT = prove(`!(f:A->B) s t. INJ f s t <=> (!x. x IN s ==> f x IN t) /\ + ?g. !x. x IN s ==> g (f x) = x`, + REPEAT GEN_TAC THEN + EQ_TAC THEN STRIP_TAC THENL + [ + CONJ_TAC THENL + [ + POP_ASSUM MP_TAC THEN SIMP_TAC[INJ]; + ALL_TAC + ] THEN + + EXISTS_TAC `res_inverse (f:A->B) s` THEN + MP_TAC (SPEC_ALL INJ_IMP_RES_INVERSE) THEN + ASM_REWRITE_TAC[]; + ASM_REWRITE_TAC[INJ] THEN + REPEAT STRIP_TAC THEN + POP_ASSUM (MP_TAC o AP_TERM `g:B->A`) THEN + ASM_SIMP_TAC[] + ]);; + + +let SURJ_ALT = prove(`!(f:A->B) s t. SURJ f s t <=> (!x. x IN s ==> f x IN t) /\ + ?g. !y. y IN t ==> f (g y) = y /\ g y IN s`, + REPEAT GEN_TAC THEN + EQ_TAC THEN STRIP_TAC THENL + [ + CONJ_TAC THENL [ POP_ASSUM MP_TAC THEN SIMP_TAC[SURJ]; ALL_TAC ] THEN + EXISTS_TAC `res_inverse (f:A->B) s` THEN + MP_TAC (SPEC_ALL SURJ_IMP_RES_INVERSE) THEN + ASM_SIMP_TAC[]; + ASM_REWRITE_TAC[SURJ] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:B`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + EXISTS_TAC `(g:B->A) x` THEN + ASM_REWRITE_TAC[] + ]);; + + +let BIJ_ALT = prove(`!(f:A->B) s t. BIJ f s t <=> (!x. x IN s ==> f x IN t) /\ + ?g. (!x. x IN s ==> g (f x) = x) /\ + (!y. y IN t ==> f (g y) = y /\ g y IN s)`, + REWRITE_TAC[BIJ] THEN + REPEAT GEN_TAC THEN EQ_TAC THENL + [ + STRIP_TAC THEN + MP_TAC (SPEC_ALL INJ_IMP_RES_INVERSE) THEN + MP_TAC (SPEC_ALL SURJ_IMP_RES_INVERSE) THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN SIMP_TAC[SURJ] THEN + REPEAT STRIP_TAC THEN + EXISTS_TAC `res_inverse (f:A->B) s` THEN + ASM_SIMP_TAC[]; + STRIP_TAC THEN + ASM_REWRITE_TAC[INJ_ALT; SURJ_ALT] THEN + CONJ_TAC THEN EXISTS_TAC `g:B->A` THEN ASM_REWRITE_TAC[] + ]);; + + +let BIJ_RES_INVERSE = prove(`!(f:A->B) s t. BIJ f s t ==> BIJ (res_inverse f s) t s`, + REWRITE_TAC[BIJ] THEN + REPEAT GEN_TAC THEN STRIP_TAC THEN + MP_TAC (SPEC_ALL INJ_IMP_RES_INVERSE) THEN + MP_TAC (SPEC_ALL SURJ_IMP_RES_INVERSE) THEN + ASM_REWRITE_TAC[] THEN + + REPEAT STRIP_TAC THENL + [ + REWRITE_TAC[INJ_ALT] THEN + ASM_SIMP_TAC[] THEN + EXISTS_TAC `f:A->B` THEN + ASM_SIMP_TAC[]; + REWRITE_TAC[SURJ_ALT] THEN + ASM_SIMP_TAC[] THEN + EXISTS_TAC `f:A->B` THEN + ASM_SIMP_TAC[] THEN + UNDISCH_TAC `INJ (f:A->B) s t` THEN + SIMP_TAC[INJ] + ]);; + + + + +let RES_INVERSE = prove(`!(f:A->B) g s t. (!y. y IN t ==> g y IN s) /\ + (!x. x IN s ==> g (f x) = x) /\ + (!y. y IN t ==> f (g y) = y) + ==> (!y. y IN t ==> res_inverse f s y = g y)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[res_inverse] THEN + MATCH_MP_TAC SELECT_UNIQUE THEN + X_GEN_TAC `v:A` THEN + REWRITE_TAC[] THEN + EQ_TAC THEN STRIP_TAC THENL + [ + UNDISCH_TAC `(f:A->B) v = y` THEN + DISCH_THEN (MP_TAC o AP_TERM `g:B->A`) THEN + ASM_SIMP_TAC[]; + ASM_SIMP_TAC[] + ]);; + + + +let COMM_RES_INVERSE_LEMMA = prove(`!(f:A->B) s t g1 g2. BIJ f s t /\ + (!x. x IN s ==> g1 x IN s) /\ + (!y. y IN t ==> g2 y IN t) /\ + (!x. x IN s ==> f (g1 x) = g2 (f x)) + ==> (!y. y IN t ==> res_inverse f s (g2 y) = g1 (res_inverse f s y))`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL BIJ_IMP_RES_INVERSE) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + POP_ASSUM (MP_TAC o SPEC `y:B`) THEN + POP_ASSUM (MP_TAC o SPEC `y:B`) THEN + POP_ASSUM (MP_TAC o SPEC `g1 (res_inverse (f:A->B) s y):A`) THEN + ASM_REWRITE_TAC[] THEN + REPEAT DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `res_inverse (f:A->B) s y`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o AP_TERM `res_inverse (f:A->B) s`) THEN + FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `res_inverse (f:A->B) s y`) THEN + ASM_SIMP_TAC[]);; + + +let COMM_RES_INVERSE_LEMMA' = prove(`!(f:A->B) s t g1 g2. BIJ f s t /\ + g1 permutes s /\ g2 permutes t /\ + (!x. x IN s ==> f (g1 x) = g2 (f x)) + ==> (!y. y IN t ==> res_inverse f s (g2 y) = g1 (res_inverse f s y))`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + MATCH_MP_TAC COMM_RES_INVERSE_LEMMA THEN + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[PERMUTES_IMP_INSIDE]);; + + + +let ISOMORPHISM_INVERSE = prove(`!(f:A->B) H G. isomorphism f (H, G) ==> + isomorphism (res_inverse f (dart H)) (G, H)`, + REWRITE_TAC[isomorphism] THEN + REPEAT GEN_TAC THEN STRIP_TAC THEN CONJ_TAC THENL + [ + ASM_SIMP_TAC[BIJ_RES_INVERSE]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN SPEC_TAC (`x:B`, `x:B`) THEN + MATCH_MP_TAC (GSYM COMM_RES_INVERSE_LEMMA') THEN + REWRITE_TAC[ETA_AX] THEN + ASM_SIMP_TAC[Hypermap.hypermap_lemma]);; + + + +let POWER_IN_LEMMA = prove(`!g s. (!x:A. x IN s ==> g x IN s) + ==> (!x n. x IN s ==> (g POWER n) x IN s)`, + REPEAT GEN_TAC THEN STRIP_TAC THEN GEN_TAC THEN + INDUCT_TAC THENL + [ + REWRITE_TAC[Hypermap.POWER_0; I_THM]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[Hypermap.COM_POWER; o_THM]);; + + + + +let COMM_POWER_LEMMA = prove(`!(f:A->B) g1 g2 s. (!x. x IN s ==> g1 x IN s) /\ + (!x. x IN s ==> f (g1 x) = g2 (f x)) + ==> (!x n. x IN s ==> f ((g1 POWER n) x) = (g2 POWER n) (f x))`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + GEN_TAC THEN INDUCT_TAC THENL + [ + REWRITE_TAC[Hypermap.POWER_0; I_THM]; + ALL_TAC + ] THEN + DISCH_TAC THEN FIRST_X_ASSUM (MP_TAC o check(is_imp o concl)) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + REWRITE_TAC[Hypermap.COM_POWER; o_THM] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `(g1 POWER n) (x:A)`) THEN + ASM_SIMP_TAC[POWER_IN_LEMMA]);; + + + +let COMM_POWER_LEMMA_PERMUTES = prove(`!(f:A->B) g1 g2 s. g1 permutes s /\ + (!x. x IN s ==> f (g1 x) = g2 (f x)) + ==> (!x n. x IN s ==> f ((g1 POWER n) x) = (g2 POWER n) (f x))`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + MATCH_MP_TAC COMM_POWER_LEMMA THEN + ASM_SIMP_TAC[PERMUTES_IMP_INSIDE]);; + + + +let COMM_INVERSE_LEMMA = prove(`!(f:A->B) g1 g2 s t x. FINITE s /\ + g1 permutes s /\ g2 permutes t /\ + (!x. x IN s ==> f (g1 x) = g2 (f x)) /\ x IN s + ==> f (inverse g1 x) = inverse g2 (f x)`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL[`s:A->bool`; `g1:A->A`] Hypermap.inverse_element_lemma) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `inverse g2 (f x) = (g2 POWER j) ((f:A->B) x)` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC (GSYM Hypermap.inverse_function) THEN + EXISTS_TAC `t:B->bool` THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPEC_ALL COMM_POWER_LEMMA_PERMUTES) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPECL [`x:A`; `j:num`]) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `inverse (g1:A->A) (x:A)`) THEN + ANTS_TAC THENL + [ + MP_TAC (ISPECL [`inverse (g1:A->A)`; `s:A->bool`] Hypermap_and_fan.PERMUTES_IMP_INSIDE) THEN + ASM_SIMP_TAC[PERMUTES_INVERSE]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MP_TAC (ISPECL [`g1:A->A`; `s:A->bool`] PERMUTES_INVERSES) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + MP_TAC (SPEC_ALL COMM_POWER_LEMMA_PERMUTES) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]);; + + + + + + +let COMM_ORBIT_IMAGE_LEMMA = prove(`!(f:A->B) s g1 g2. (!x. x IN s ==> g1 x IN s) /\ + (!x. x IN s ==> f (g1 x) = g2 (f x)) + ==> (!x. x IN s ==> orbit_map g2 (f x) = IMAGE f (orbit_map g1 x))`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[Hypermap.orbit_map] THEN + MP_TAC (SPEC_ALL COMM_POWER_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `x:A`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + REWRITE_TAC[GSYM IMAGE_LEMMA; IN_ELIM_THM] THEN + SET_TAC[]);; + + + +let COMM_ORBIT_IMAGE_LEMMA_PERMUTES = prove(`!(f:A->B) s g1 g2 y. y IN s /\ g1 permutes s /\ + (!x. x IN s ==> f (g1 x) = g2 (f x)) + ==> orbit_map g2 (f y) = IMAGE f (orbit_map g1 y)`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + MP_TAC (SPEC_ALL COMM_ORBIT_IMAGE_LEMMA) THEN + ASM_SIMP_TAC[PERMUTES_IMP_INSIDE]);; + + + +let ISOMORPHISM_COMPONENT_IMAGE = prove(`!(f:A->B) H G d. isomorphism f (H,G) /\ d IN dart H + ==> node G (f d) = IMAGE f (node H d) /\ + edge G (f d) = IMAGE f (edge H d) /\ + face G (f d) = IMAGE f (face H d)`, + REWRITE_TAC[isomorphism] THEN + REPEAT GEN_TAC THEN STRIP_TAC THEN + REWRITE_TAC[Hypermap.node; Hypermap.edge; Hypermap.face] THEN + REPEAT CONJ_TAC THEN MATCH_MP_TAC COMM_ORBIT_IMAGE_LEMMA_PERMUTES THEN + EXISTS_TAC `dart H:A->bool` THEN + ASM_SIMP_TAC[Hypermap.hypermap_lemma]);; + + + + +let ISOMORPHISM_IMP_ISO = prove(`!(f:A->B) H G. isomorphism f (H, G) + ==> iso H G`, + REWRITE_TAC[isomorphism; Hypermap.iso] THEN + REPEAT STRIP_TAC THEN + EXISTS_TAC `f:A->B` THEN + ASM_REWRITE_TAC[] THEN + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN + REWRITE_TAC[FUN_EQ_THM; o_THM] THEN + SIMP_TAC[]);; + + +let ISO_IMP_ISOMORPHISM = prove(`!H G. iso H G ==> ?f:A->B. isomorphism f (H, G)`, + REWRITE_TAC[Hypermap.iso; isomorphism]);; + + + + + + + + +let ISOMORPHISM_FAN_LIST = prove(`!V E L (f:real^3#real^3->A#A). FAN (vec 0,V,E) /\ + good_list L /\ good_list_nodes L /\ + isomorphism f (hypermap_of_fan (V,E), hypermap_of_list L) + ==> ?h. BIJ h V (elements_of_list L) /\ + (!d. d IN dart_of_fan (V,E) ==> f d = (h (FST d), h (SND d)))`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[isomorphism] THEN STRIP_TAC THEN + SUBGOAL_THEN `!d:real^3#real^3. d IN dart_of_fan (V,E) ==> (f d):A#A IN darts_of_list L` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o check(fun th -> (fst o dest_const o rator o rator o rator o concl) th = "BIJ")) THEN + REWRITE_TAC[BIJ; INJ] THEN + DISCH_THEN (CONJUNCTS_THEN2 MP_TAC (fun th -> ALL_TAC)) THEN + DISCH_THEN (CONJUNCTS_THEN2 MP_TAC (fun th -> ALL_TAC)) THEN + DISCH_THEN (MP_TAC o SPEC `d:real^3#real^3`) THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_FAN; COMPONENTS_HYPERMAP_OF_LIST]; + ALL_TAC + ] THEN + + ABBREV_TAC `h = (\v. FST ((f:real^3#real^3->A#A) (v, if (v,v) IN dart_of_fan (V,E) then v else CHOICE (set_of_edge v V E))))` THEN + EXISTS_TAC `h:real^3->A` THEN + SUBGOAL_THEN `?g. !v w:real^3. (v,w) IN dart_of_fan (V,E) ==> f(v,w) = (h v:A, g (v,w):A)` ASSUME_TAC THENL + [ + EXISTS_TAC `\d:real^3#real^3. SND (f d:A#A)` THEN + REPEAT STRIP_TAC THEN + REWRITE_TAC[] THEN + MP_TAC (ISPEC `(f:real^3#real^3->A#A) (v,w)` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[PAIR_EQ] THEN + EXPAND_TAC "h" THEN + COND_CASES_TAC THENL + [ + SUBGOAL_THEN `set_of_edge (v:real^3) V E = {}` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REWRITE_TAC[dart_of_fan; GSYM dart1_of_fan; IN_UNION; IN_ELIM_THM] THEN + STRIP_TAC THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[PAIR_EQ] THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `v:real^3`] PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + UNDISCH_TAC `v,w IN dart_of_fan (V:real^3->bool, E)` THEN + REWRITE_TAC[dart_of_fan; GSYM dart1_of_fan; IN_UNION; IN_ELIM_THM] THEN + STRIP_TAC THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[PAIR_EQ] THEN + DISCH_TAC THEN + UNDISCH_TAC `f(v:real^3,w:real^3) = x:A,y:A` THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`] PAIR_IN_DART1_OF_FAN) THEN + ASM_REWRITE_TAC[NOT_IN_EMPTY]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `v,w IN dart1_of_fan (V:real^3->bool,E)` ASSUME_TAC THENL + [ + UNDISCH_TAC `v,w IN dart_of_fan (V:real^3->bool,E)` THEN + DISCH_TAC THEN FIRST_ASSUM MP_TAC THEN + REWRITE_TAC[dart_of_fan; GSYM dart1_of_fan; IN_ELIM_THM; IN_UNION] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[PAIR_EQ] THEN + DISCH_TAC THEN + UNDISCH_TAC `v,w IN dart_of_fan (V:real^3->bool,E)` THEN + UNDISCH_TAC `~(v,v IN dart_of_fan (V:real^3->bool,E))` THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + ABBREV_TAC `w' = CHOICE (set_of_edge (v:real^3) V E)` THEN + + SUBGOAL_THEN `(v,w') IN node (hypermap_of_fan (V,E)) (v,w)` MP_TAC THENL + [ + ASM_SIMP_TAC[Hypermap_and_fan.NODE_HYPERMAP_OF_FAN_ALT] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + EXISTS_TAC `w':real^3` THEN + REWRITE_TAC[] THEN + EXPAND_TAC "w'" THEN + MATCH_MP_TAC CHOICE_DEF THEN + DISCH_TAC THEN + MP_TAC (ISPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`] PAIR_IN_DART1_OF_FAN) THEN + ASM_REWRITE_TAC[NOT_IN_EMPTY]; + ALL_TAC + ] THEN + + REWRITE_TAC[Hypermap.node; Hypermap.node_map] THEN + ASM_SIMP_TAC[HYPERMAP_OF_FAN] THEN + REWRITE_TAC[Hypermap.orbit_map; IN_ELIM_THM] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (ISPECL [`f:real^3#real^3->A#A`; `node_map (hypermap_of_fan (V,E))`; `node_map (hypermap_of_list (L:((A)list)list))`; `dart (hypermap_of_fan (V,E))`] COMM_POWER_LEMMA_PERMUTES) THEN + ASM_SIMP_TAC[Hypermap.hypermap_lemma] THEN + DISCH_THEN (MP_TAC o SPEC `v:real^3,w:real^3`) THEN + DISCH_THEN (MP_TAC o SPEC `n:num`) THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_FAN] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + ASM_SIMP_TAC[Hypermap.node_map; HYPERMAP_OF_LIST] THEN + + MATCH_MP_TAC (GSYM FST_N_LIST_EXT_POWER) THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `v:real^3,w:real^3`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + + REPEAT STRIP_TAC THENL + [ + REWRITE_TAC[BIJ; INJ; SURJ] THEN + SUBGOAL_THEN `!x:real^3. x IN V ==> (h x):A IN elements_of_list L` ASSUME_TAC THENL + [ + REWRITE_TAC[elements_of_list; IN_SET_OF_LIST] THEN + REWRITE_TAC[MEM_LIST_OF_ELEMENTS] THEN + X_GEN_TAC `v:real^3` THEN DISCH_TAC THEN + MP_TAC (SPEC_ALL DART_EXISTS) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL[`v:real^3`; `w:real^3`]) THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + EXISTS_TAC `g (v:real^3,w:real^3):A` THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[GSYM IN_SET_OF_LIST; GSYM darts_of_list] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + MAP_EVERY X_GEN_TAC [`v1:real^3`; `v2:real^3`] THEN + STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v1:real^3`] DART_EXISTS) THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v2:real^3`] DART_EXISTS) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (X_CHOOSE_THEN `w2:real^3` ASSUME_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `w1:real^3` ASSUME_TAC) THEN + ABBREV_TAC `d1:A#A = f (v1:real^3,w1:real^3)` THEN + ABBREV_TAC `d2:A#A = f (v2:real^3,w2:real^3)` THEN + SUBGOAL_THEN `MEM (d1:A#A) (list_of_darts L) /\ MEM (d2:A#A) (list_of_darts L)` ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM IN_SET_OF_LIST; GSYM darts_of_list] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `d1:A#A IN node (hypermap_of_list L) d2` MP_TAC THENL + [ + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[GSYM IN_SET_OF_LIST; GSYM darts_of_list] THEN + DISCH_TAC THEN + ASM_SIMP_TAC[GOOD_LIST_NODE] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + EXISTS_TAC `SND (d1:A#A)` THEN + SUBGOAL_THEN `FST (d2:A#A) = FST (d1:A#A)` ASSUME_TAC THENL + [ + FIRST_ASSUM (MP_TAC o SPECL [`v2:real^3`; `w2:real^3`]) THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`v1:real^3`; `w1:real^3`]) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`f:real^3#real^3->A#A`; `hypermap_of_fan (V,E)`; `hypermap_of_list (L:((A)list)list)`; `(v2:real^3,w2:real^3)`] ISOMORPHISM_COMPONENT_IMAGE) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_FAN]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + + REWRITE_TAC[IN_IMAGE] THEN + STRIP_TAC THEN + SUBGOAL_THEN `x = (v1:real^3,w1:real^3)` ASSUME_TAC THENL + [ + UNDISCH_TAC `BIJ f (dart (hypermap_of_fan (V,E))) (dart (hypermap_of_list (L:((A)list)list)))` THEN + REWRITE_TAC[BIJ; INJ] THEN + STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `node (hypermap_of_fan (V,E)) (v2,w2)` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC Hypermap.lemma_node_subset THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_FAN]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_FAN]; + ALL_TAC + ] THEN + + UNDISCH_TAC `x IN node (hypermap_of_fan (V,E)) (v2,w2)` THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + DISCH_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v1:real^3,w1:real^3`; `v2:real^3,w2:real^3`] FST_NODE_HYPERMAP_OF_FAN) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[elements_of_list; IN_SET_OF_LIST; MEM_LIST_OF_ELEMENTS] THEN + REWRITE_TAC[GSYM IN_SET_OF_LIST; GSYM darts_of_list] THEN + REPEAT STRIP_TAC THEN + UNDISCH_TAC `BIJ f (dart (hypermap_of_fan (V,E))) (dart (hypermap_of_list (L:((A)list)list)))` THEN + REWRITE_TAC[BIJ; SURJ] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:A,y:A`) THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST; COMPONENTS_HYPERMAP_OF_FAN] THEN + DISCH_THEN (X_CHOOSE_THEN `d:real^3#real^3` MP_TAC) THEN STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `d:real^3#real^3`] IN_DART_OF_FAN) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + EXISTS_TAC `v:real^3` THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`v:real^3`; `w:real^3`]) THEN + UNDISCH_TAC `f (d:real^3#real^3) = x:A,y:A` THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> SIMP_TAC[th; PAIR_EQ]); + ALL_TAC + ] THEN + + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `d:real^3#real^3`] IN_DART_OF_FAN) THEN + ASM_REWRITE_TAC[] THEN REMOVE_ASSUM THEN STRIP_TAC THEN + FIRST_ASSUM (MP_TAC o SPECL [`v:real^3`; `w:real^3`]) THEN + UNDISCH_TAC `v:real^3,w:real^3 IN dart_of_fan (V,E)` THEN + DISCH_TAC THEN FIRST_ASSUM (fun th -> REWRITE_TAC[th]) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_REWRITE_TAC[PAIR_EQ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `v:real^3,w:real^3`) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `v:real^3,w:real^3`) THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_FAN] THEN + + DISCH_THEN (MP_TAC o CONJUNCT1) THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST] THEN + ASM_REWRITE_TAC[e_list_ext; res] THEN + ASM_SIMP_TAC[E_FAN_PAIR_EXT_EXPLICIT] THEN + REWRITE_TAC[e_list] THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`w:real^3`; `v:real^3`]) THEN + ASM_REWRITE_TAC[DART_OF_FAN_SYM] THEN + SIMP_TAC[PAIR_EQ]);; + + + +(* +prove(`!(H:(A)hypermap) P k. is_no_double_joints H /\ connected_hypermap H /\ + plain_hypermap H /\ + (!x. x IN dart H ==> P x (node_map H x) /\ ~(P x (edge_map H x))) + ==> + (!x y g n. x IN dart H /\ y IN dart H /\ n <= k /\ P x y /\ + x = g 0 /\ y = g n /\ is_path H g n + ==> y IN node H x) /\ + (!x y g n t. x IN dart H /\ y IN dart H /\ n <= k /\ P x y /\ + x = g 0 /\ y = (edge_map H o (node_map H POWER t) o g) n /\ is_path H g n + ==> y IN node H x)`, + REWRITE_TAC[is_no_double_joints] + +*) diff --git a/formal_lp/old/hypermap/nobranching_lp.hl b/formal_lp/old/hypermap/nobranching_lp.hl new file mode 100644 index 0000000..9dfea12 --- /dev/null +++ b/formal_lp/old/hypermap/nobranching_lp.hl @@ -0,0 +1,165 @@ +needs "../formal_lp/hypermap/contravening_ineqs.hl";; +needs "../formal_lp/hypermap/list_hypermap_computations.hl";; +needs "../formal_lp/more_arith/prove_lp.hl";; + +open Linear_function;; +open Prove_lp;; +open Arith_nat;; +open Misc_vars;; + +let REAL_ADD_ASSOC' = (SYM o SPEC_ALL) REAL_ADD_ASSOC;; + +(* Performs the following conversions: + (a + ... + c) + d = a + ... + c + d *) +let rec plus_assoc_conv tm = + if (is_binop add_op_real tm) then + let lhs, rhs = dest_binop add_op_real tm in + if (is_binop add_op_real lhs) then + let x_tm, y_tm = dest_binop add_op_real lhs in + let th0 = INST[x_tm, x_var_real; y_tm, y_var_real; rhs, z_var_real] REAL_ADD_ASSOC' in + let ltm, rtm = dest_comb(rand(concl th0)) in + TRANS th0 (AP_TERM ltm (plus_assoc_conv rtm)) + else + REFL tm + else + REFL tm;; + +(* +let tm = `(&1 + x + y + &2) + (z + t)`;; +plus_assoc_conv tm;; +(* 0.252 *) +test 1000 (REWRITE_CONV[GSYM REAL_ADD_ASSOC]) tm;; +(* 0.036 *) +test 1000 plus_assoc_conv tm;; +*) + + + + +let prove_hypermap_lp hyp_str precision constraints target_var_bounds var_bounds = + let list_hyp, list_thm, fun_table = compute_all hyp_str in + + let table_set_rewrites = + let hyp = Hashtbl.create 10 in + let _ = map (fun set, name -> Hashtbl.add hyp set (Hashtbl.find list_thm name)) + [ + "list_of_darts", "darts"; + "list_of_darts3", "darts3"; + "list_of_darts4", "darts4"; + "list_of_dartsX", "dartsX"; + "list_of_nodes", "nodes"; + "list_of_edges", "edges"; + "list_of_faces", "faces"; + "list_of_faces3", "faces3"; + "list_of_faces4", "faces4"; + "list_of_faces5", "faces5"; + "list_of_faces6", "faces6"; + ] in + hyp in + + let l_var_list = `L:((num)list)list` in + + (* Rewrites subterms in the inequality *) + let rewrite_ineq ineq = + let rec rewrite_lhs = fun tm -> + let rewrite_one = fun tm -> + if (is_binop mul_op_real tm) then + let mul_tm, var_tm = dest_comb tm in + let var_f, arg = dest_comb var_tm in + + let rec convert_arg = fun arg -> + if (is_comb arg) then + let ltm, sub_arg' = dest_comb arg in + let const_name = (fst o dest_const) (if (is_const ltm) then ltm else rator ltm) in + if (const_name = "CONS" or const_name = ",") then + REFL arg + else + try + let sub_arg_th = convert_arg sub_arg' in + let th0 = AP_TERM ltm sub_arg_th in + let rtm = rand(concl th0) in + let th1 = + if (const_name = "set_of_list") then + set_of_list_conv rtm + else if (const_name = "FST") then + fst_conv rtm + else if (const_name = "SND") then + snd_conv rtm + else + let table = Hashtbl.find fun_table const_name in + Hashtbl.find table (rand rtm) in + TRANS th0 th1 + with e -> + failwith ("convert_arg: "^const_name) + else + REFL arg in + + let arg_th = convert_arg arg in + AP_TERM mul_tm (AP_TERM var_f arg_th) + + else + (* tm should be list_sum *) + list_sum_conv BETA_CONV tm in + + if (is_binop add_op_real tm) then + let lhs, rhs = dest_binop add_op_real tm in + let lhs_th = rewrite_one lhs in + let rhs_th = rewrite_lhs rhs in + let th1 = MK_COMB(AP_TERM add_op_real lhs_th, rhs_th) in + if (is_binop add_op_real (rand(concl lhs_th))) then + let th2 = plus_assoc_conv (rand(concl th1)) in + TRANS th1 th2 + else + th1 + else + rewrite_one tm in + + let th0 = BETA_RULE ineq in + let ltm, rtm = dest_comb(concl th0) in + let op_tm, l_tm = dest_comb ltm in + let lhs_th = rewrite_lhs l_tm in + EQ_MP (AP_THM (AP_TERM op_tm lhs_th) rtm) th0 in + + (* This function generates all inequalities from a given base inequality *) + let get_ineqs = fun ineq indices -> + let t0 = INST[list_hyp, l_var_list] ineq in + let t1 = MY_PROVE_HYP (Hashtbl.find list_thm "good_list") t0 in + let all_tm, set_tm = dest_comb (concl t1) in + let set_th = Hashtbl.find table_set_rewrites ((fst o dest_const o rator) set_tm) in + let t2 = EQ_MP (AP_TERM all_tm set_th) t1 in + let ths = select_all t2 indices in + map rewrite_ineq ths in + + + let precision_constant = Int 10 **/ (Int precision) and + target_bound = `&12` in + + (* This function generates all inequalities with the given name and indices, + multiplies these inequalities by given coefficients, and adds up the obtained + inequalities *) + let sum_step = fun (name, indices, c) -> + try + let ineq = find_ineq precision name in + let ineqs = get_ineqs ineq indices in + let s1 = map transform_le_ineq (zip ineqs c) in + List.fold_left add_step' dummy s1 + with e -> + failwith ("Problem: "^name) in + + (* Find all sums *) + let s1' = List.fold_left add_step' dummy (map sum_step constraints) in + let s1 = mul_step s1' (mk_real_int precision_constant) in + let s2 = List.fold_left add_step' dummy (map sum_step target_var_bounds) in + let s3 = List.fold_left add_step' dummy (map sum_step var_bounds) in + let s4 = add_step' (add_step' s1 s2) s3 in + + (* Final transformations *) + let r6 = CONV_RULE (DEPTH_CONV NUM_TO_NUMERAL_CONV) s4 in + let m = term_of_rat (precision_constant */ precision_constant */ precision_constant) in + let r7 = mul_rat_step r6 (mk_comb (`(/) (&1)`, m)) in + let r8 = REWRITE_RULE[lin_f; ITLIST; REAL_ADD_RID] r7 in + let r9 = EQT_ELIM (REAL_RAT_LE_CONV (mk_binop le_op_real ((rand o concl) r8) target_bound)) in + MATCH_MP REAL_LE_TRANS (CONJ r8 r9);; + + + diff --git a/formal_lp/old/ineqs/contravening_ineqs.hl b/formal_lp/old/ineqs/contravening_ineqs.hl new file mode 100644 index 0000000..ab7dedb --- /dev/null +++ b/formal_lp/old/ineqs/contravening_ineqs.hl @@ -0,0 +1,1845 @@ +needs "../formal_lp/ineqs/list_hypermap.hl";; +needs "../formal_lp/ineqs/list_hypermap_iso.hl";; +needs "../formal_lp/ineqs/constants_approx.hl";; + + +needs "arith/nat.hl";; + + +open Sphere;; + + +(* Definitions of variables *) + + +(* Variables for fans *) +(* TODO: these definitions are not necessary *) + + +let azim2_fan = new_definition `azim2_fan (V,E) (x:real^3#real^3) = azim_dart (V,E) (f_fan_pair (V,E) x)`;; +let azim3_fan = new_definition `azim3_fan (V,E) (x:real^3#real^3) = azim_dart (V,E) (inverse (f_fan_pair_ext (V,E)) x)`;; +let yn_fan = new_definition `yn_fan (n:real^3#real^3->bool) = norm (FST (@x. x IN n))`;; +let ln_fan = new_definition `ln_fan (n:real^3#real^3->bool) = abs (ly (yn_fan n))`;; +let ye_fan = new_definition `ye_fan (x:real^3#real^3) = dist x`;; + +let y1_fan = new_definition `y1_fan (x:real^3#real^3) = norm(FST x)`;; +let y2_fan = new_definition `y2_fan (x:real^3#real^3) = norm(SND x)`;; +let y3_fan = new_definition `y3_fan (V,E) (x:real^3#real^3) = norm(sigma_fan (vec 0) V E (FST x) (SND x))`;; +let y4_fan = new_definition `y4_fan (V,E) (x:real^3#real^3) = dist(f_fan_pair (V,E) x)`;; +let y5_fan = new_definition `y5_fan (V,E) (x:real^3#real^3) = dist(inverse (f_fan_pair_ext (V,E)) x)`;; +let y6_fan = new_definition `y6_fan (x:real^3#real^3) = dist x`;; +let y8_fan = new_definition `y8_fan (V,E) (x:real^3#real^3) = y5_fan (V,E) (f_fan_pair_ext (V,E) x)`;; +let y9_fan = new_definition `y9_fan (V,E) (x:real^3#real^3) = dist(f_fan_pair (V,E) x)`;; + +let rhazim_fan = new_definition `rhazim_fan (V,E) (x:real^3#real^3) = abs(rho(y1_fan x)) * azim_dart (V,E) x`;; +let rhazim2_fan = new_definition `rhazim2_fan (V,E) (x:real^3#real^3) = rhazim_fan (V,E) (f_fan_pair (V,E) x)`;; +let rhazim3_fan = new_definition `rhazim3_fan (V,E) (x:real^3#real^3) = rhazim_fan (V,E) (inverse (f_fan_pair_ext (V,E)) x)`;; + +let rho_fan = new_definition `rho_fan n = abs((&1 + sol0 / pi) - ln_fan n * sol0 / pi)`;; +let sol_fan = new_definition `sol_fan (V,E) f = abs(sum f (\x. azim_dart (V,E) x - pi) + &2 * pi)`;; +let tau_fan = new_definition `tau_fan (V,E) f = abs (tauVEF (V,E,f))`;; + + +let fan_defs = +[ + azim2_fan; azim3_fan; yn_fan; ln_fan; ye_fan; + rho_fan; sol_fan; tau_fan; rhazim_fan; rhazim2_fan; rhazim3_fan; + y1_fan; y2_fan; y3_fan; y4_fan; y5_fan; y6_fan; y8_fan; y9_fan; +] + + + +(* Variables for lists *) + + +let list_defs = map new_definition + [ + `azim_list (V,g) = (azim_dart (V,ESTD V) o g):num#num->real`; + `azim2_list (V,g) = (azim2_fan (V,ESTD V) o g):num#num->real`; + `azim3_list (V,g) = (azim3_fan (V,ESTD V) o g):num#num->real`; + `(yn_list g):(num#num->bool)->real = yn_fan o IMAGE g`; + `(ln_list g):(num#num->bool)->real = ln_fan o IMAGE g`; + `rhazim_list (V,g) = (rhazim_fan (V,ESTD V) o g):num#num->real`; + `rhazim2_list (V,g) = (rhazim2_fan (V,ESTD V) o g):num#num->real`; + `rhazim3_list (V,g) = (rhazim3_fan (V,ESTD V) o g):num#num->real`; + `(ye_list g):(num#num->real) = ye_fan o g`; + `(rho_list g):(num#num->bool)->real = rho_fan o IMAGE g`; + `(sol_list (V,g)):(num#num->bool)->real = sol_fan (V,ESTD V) o IMAGE g`; + `(tau_list (V,g)):(num#num->bool)->real = tau_fan (V,ESTD V) o IMAGE g`; + `(y1_list g):(num#num->real) = y1_fan o g`; + `(y2_list g):(num#num->real) = y2_fan o g`; + `(y3_list (V,g)):(num#num->real) = y3_fan (V,ESTD V) o g`; + `(y4_list (V,g)):(num#num->real) = y4_fan (V,ESTD V) o g`; + `(y5_list (V,g)):(num#num->real) = y5_fan (V,ESTD V) o g`; + `(y6_list g):(num#num->real) = y6_fan o g`; + `(y8_list (V,g)):(num#num->real) = y8_fan (V,ESTD V) o g`; + `(y9_list (V,g)):(num#num->real) = y9_fan (V,ESTD V) o g`; + ];; + + +let list_defs2 = map (REWRITE_RULE[FUN_EQ_THM; o_THM]) list_defs;; + + +let list_var_rewrites = + map GSYM list_defs @ map GSYM list_defs2;; + + + +(* All variables are nonnegative *) + + + +let AZIM_DART_POS = prove(`&0 <= azim_dart (V,E) x`, + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[azim_dart] THEN + COND_CASES_TAC THENL + [ + MP_TAC PI_APPROX_32 THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[Fan_defs.azim_fan] THEN + COND_CASES_TAC THEN REWRITE_TAC[azim] THEN + MP_TAC PI_APPROX_32 THEN REAL_ARITH_TAC);; + + +let DIST_POS = prove(`!x:(real^3#real^3). &0 <= dist x`, + GEN_TAC THEN MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[dist; NORM_POS_LE]);; + + +let list_var_pos = map (fun tm -> prove(tm, + GEN_TAC THEN REWRITE_TAC list_defs2 THEN REWRITE_TAC fan_defs THEN + TRY (MATCH_MP_TAC REAL_LE_MUL) THEN + REWRITE_TAC[AZIM_DART_POS; REAL_ABS_POS; NORM_POS_LE; DIST_POS])) +[ + `!x. &0 <= azim_list (V,g) x`; + `!x. &0 <= azim2_list (V,g) x`; + `!x. &0 <= azim3_list (V,g) x`; + `!x. &0 <= rhazim_list (V,g) x`; + `!x. &0 <= rhazim2_list (V,g) x`; + `!x. &0 <= rhazim3_list (V,g) x`; + `!n. &0 <= yn_list g n`; + `!n. &0 <= ln_list g n`; + `!e. &0 <= ye_list g e`; + `!n. &0 <= rho_list g n`; + `!f. &0 <= sol_list (V,g) f`; + `!f. &0 <= tau_list (V,g) f`; + `!x. &0 <= y1_list g x`; + `!x. &0 <= y2_list g x`; + `!x. &0 <= y3_list (V,g) x`; + `!x. &0 <= y4_list (V,g) x`; + `!x. &0 <= y5_list (V,g) x`; + `!x. &0 <= y6_list g x`; + `!x. &0 <= y8_list (V,g) x`; + `!x. &0 <= y9_list (V,g) x`; +];; + + + +(* mod-file variables and definitions *) + + +let var_bound_ineqs = Hashtbl.create 40;; + + +let sets = + ["dart", `dart H:A->bool`; + "dart3", `hyp_dart3 H:A->bool`; + "node", `node_set H:(A->bool)->bool`; + "face", `face_set H:(A->bool)->bool`; + "dart_std4", `hyp_dart4 H:A->bool`];; + + +let define_var var_name set_name low high = + let var = match set_name with + "dart" | "dart3" | "dart_std4" -> `d:A` + | "node" -> `n:A->bool` + | "face" -> `f:A->bool` + | _ -> failwith "Undefined set name" in + let var_ty = snd (dest_var var) in + let f_ty = mk_type ("fun", [var_ty; `:real`]) in + let set_ty = mk_type ("fun", [var_ty; `:bool`]) in + let f = mk_var (var_name^"_mod", f_ty) in + let set = assoc set_name sets in + let in_const = mk_mconst ("IN", mk_type ("fun", [var_ty; mk_type ("fun", [set_ty; `:bool`])])) in + let le = `(<=):real->real->bool` in + let fvar = mk_comb (f, var) in + let l, h = mk_binop le low fvar, mk_binop le fvar high in + let cond = mk_binop in_const var set in + + let ineq_lo = mk_forall(var, mk_imp(cond, l)) in + let ineq_hi = mk_forall(var, mk_imp(cond, h)) in + + let _ = Hashtbl.add var_bound_ineqs (var_name^"_lo") ineq_lo in + let _ = Hashtbl.add var_bound_ineqs (var_name^"_hi") ineq_hi in + f;; + + + + +(* Terms for variables in the model file *) +Hashtbl.clear var_bound_ineqs;; + +let azim_mod = define_var "azim" "dart" `&0` `pi` and + azim2_mod = define_var "azim2" "dart3" `&0` `pi` and + azim3_mod = define_var "azim3" "dart3" `&0` `pi` and + ln_mod = define_var "ln" "node" `&0` `&1` and + rhazim_mod = define_var "rhazim" "dart" `&0` `pi + sol0` and + rhazim2_mod = define_var "rhazim2" "dart3" `&0` `pi + sol0` and + rhazim3_mod = define_var "rhazim3" "dart3" `&0` `pi + sol0` and + yn_mod = define_var "yn" "node" `&2` `#2.52`and + ye_mod = define_var "ye" "dart" `&2` `&3` and + rho_mod = define_var "rho" "node" `&1` `&1 + sol0 / pi` and + sol_mod = define_var "sol" "face" `&0` `&4 * pi` and + tau_mod = define_var "tau" "face" `&0` `tgt` and + y1_mod = define_var "y1" "dart" `&2` `#2.52` and + y2_mod = define_var "y2" "dart" `&2` `#2.52` and + y3_mod = define_var "y3" "dart" `&2` `#2.52` and + y4_mod = define_var "y4" "dart3" `&2` `&3` and + y5_mod = define_var "y5" "dart" `&2` `&3` and + y6_mod = define_var "y6" "dart" `&2` `&3` and + y8_mod = define_var "y8" "dart_std4" `&2` `#2.52` and + y9_mod = define_var "y9" "dart_std4" `&2` `#2.52`;; + + +let var_list = + let inst_t = inst[`:real^3#real^3`, aty] in + [ + `hypermap_of_fan (V,E)`, `H:(real^3#real^3)hypermap`; + `azim_dart (V,E)`, inst_t azim_mod; + `azim2_fan (V,E)`, inst_t azim2_mod; + `azim3_fan (V,E)`, inst_t azim3_mod; + `ln_fan`, inst_t ln_mod; + `rhazim_fan (V,E)`, inst_t rhazim_mod; + `rhazim2_fan (V,E)`, inst_t rhazim2_mod; + `rhazim3_fan (V,E)`, inst_t rhazim3_mod; + `yn_fan`, inst_t yn_mod; + `ye_fan`, inst_t ye_mod; + `rho_fan`, inst_t rho_mod; + `sol_fan (V,E)`, inst_t sol_mod; + `tau_fan (V,E)`, inst_t tau_mod; + `y1_fan`, inst_t y1_mod; + `y2_fan`, inst_t y2_mod; + `y3_fan (V,E)`, inst_t y3_mod; + `y4_fan (V,E)`, inst_t y4_mod; + `y5_fan (V,E)`, inst_t y5_mod; + `y6_fan`, inst_t y6_mod; + `y8_fan (V,E)`, inst_t y8_mod; + `y9_fan (V,E)`, inst_t y9_mod; + ];; + + + + +(* Declare all inequalities in a format which is close to the mod-file format *) + +let constraints = Hashtbl.create 100;; +let add_constraints = map (uncurry (Hashtbl.add constraints));; + +(* equality constraints *) + +add_constraints +[ + "azim_sum", `!n. n IN node_set (H:(A)hypermap) ==> sum n azim_mod = &2 * pi`; + "rhazim_sum", `!n. n IN node_set (H:(A)hypermap) ==> sum n rhazim_mod = &2 * pi * rho_mod n`; + + "sol_sum3", `!f. f IN hyp_face3 (H:(A)hypermap) ==> sum f azim_mod = sol_mod f + pi`; + "tau_sum3", `!f. f IN hyp_face3 (H:(A)hypermap) ==> sum f rhazim_mod = tau_mod f + (pi + sol0)`; + "sol_sum4", `!f. f IN hyp_face4 (H:(A)hypermap) ==> sum f azim_mod = sol_mod f + &2 * pi`; + "tau_sum4", `!f. f IN hyp_face4 (H:(A)hypermap) ==> sum f rhazim_mod = tau_mod f + &2 * (pi + sol0)`; + "sol_sum5", `!f. f IN hyp_face5 (H:(A)hypermap) ==> sum f azim_mod = sol_mod f + &3 * pi`; + "tau_sum5", `!f. f IN hyp_face5 (H:(A)hypermap) ==> sum f rhazim_mod = tau_mod f + &3 * (pi + sol0)`; + "sol_sum6", `!f. f IN hyp_face6 (H:(A)hypermap) ==> sum f azim_mod = sol_mod f + &4 * pi`; + "tau_sum6", `!f. f IN hyp_face6 (H:(A)hypermap) ==> sum f rhazim_mod = tau_mod f + &4 * (pi + sol0)`; + + "ln_def", `!n. n IN node_set (H:(A)hypermap) ==> ln_mod n = (#2.52 - yn_mod n) / #0.52`; + "rho_def", `!n. n IN node_set (H:(A)hypermap) ==> rho_mod n = (&1 + sol0 / pi) - ln_mod n * sol0 / pi`; + + "edge_sym", `!e. e IN hyp_edge_pairs (H:(A)hypermap) ==> ye_mod (FST e) = ye_mod (SND e):real`; + + "y1_def", `!d. d IN dart (H:(A)hypermap) ==> y1_mod d = yn_mod (node H d):real`; + "y2_def", `!d. d IN dart (H:(A)hypermap) ==> y2_mod d = yn_mod (node H (face_map H d)):real`; + "y3_def", `!d. d IN dart (H:(A)hypermap) ==> y3_mod d = yn_mod (node H (inverse (face_map H) d)):real`; + "y4_def", `!d. d IN hyp_dart3 (H:(A)hypermap) ==> y4_mod d = ye_mod (face_map H d):real`; + "y5_def", `!d. d IN dart (H:(A)hypermap) ==> y5_mod d = ye_mod (inverse (face_map H) d):real`; + "y6_def", `!d. d IN dart (H:(A)hypermap) ==> y6_mod d = ye_mod d:real`; + "y9_def", `!d. d IN hyp_dart4 (H:(A)hypermap) ==> y9_mod d = ye_mod (face_map H d):real`; + "y8_def", `!d. d IN hyp_dart4 (H:(A)hypermap) ==> y8_mod d = y5_mod (inverse (face_map H) d):real`; + + "azim2c", `!d. d IN hyp_dart3 (H:(A)hypermap) ==> azim2_mod d = azim_mod (face_map H d):real`; + "azim3c", `!d. d IN hyp_dart3 (H:(A)hypermap) ==> azim3_mod d = azim_mod (inverse (face_map H) d):real`; + "rhazim2c", `!d. d IN hyp_dart3 (H:(A)hypermap) ==> rhazim2_mod d = rhazim_mod (face_map H d):real`; + "rhazim3c", `!d. d IN hyp_dart3 (H:(A)hypermap) ==> rhazim3_mod d = rhazim_mod (inverse (face_map H) d):real`; +];; + + + +(* inequality constraints *) + +add_constraints +[ + "RHA", `!d. d IN dart (H:(A)hypermap) ==> rhazim_mod d >= azim_mod d:real`; + "RHB", `!d. d IN dart (H:(A)hypermap) ==> rhazim_mod d <= azim_mod d * (&1 + sol0 / pi)`; +(* "RHBLO"; "RHBHI" *) +];; + + +(* definitional inequalities *) + + + +(* y bounds *) +add_constraints +[ + "yy10", `!d. (d:A) IN dart (H:(A)hypermap) ==> ye_mod d <= #2.52`; +];; + + + +(* tau tame table D inequality (Main Estimate) *) +add_constraints +[ + "tau3", `!f:A->bool. f IN hyp_face3 (H:(A)hypermap) ==> tau_mod f >= &0`; + "tau4", `!f:A->bool. f IN hyp_face4 (H:(A)hypermap) ==> tau_mod f >= #0.206`; + "tau5", `!f:A->bool. f IN hyp_face5 (H:(A)hypermap) ==> tau_mod f >= #0.4819`; + "tau6", `!f:A->bool. f IN hyp_face6 (H:(A)hypermap) ==> tau_mod f >= #0.7578`; +];; + + +add_constraints +[ + "ineq105", `!d:A. d IN hyp_dartX H ==> + ((((azim_mod d) - #1.629) + ((#0.402 * (y2_mod d + + (y3_mod d + (y5_mod d + (y6_mod d - #8.0))))) - + (#0.315 * (y1_mod d - #2.0)))) - #0.0) >= #0.0`; + + "ineq106", `!d:A. d IN hyp_dart3 H ==> + ((((rhazim_mod d) - #1.2308) + (((#0.3639 * (y2_mod d + (y3_mod d + (y5_mod d + (y6_mod d - #8.0))))) - + (#0.6 * (y1_mod d - #2.0))) - (#0.685 * (y4_mod d - #2.0)))) - #0.0) >= #0.0`; + + "ineq107", `!d:A. d IN hyp_dart3 H ==> + (((--(azim_mod d)) + ((#1.231 - (#0.152 * (y2_mod d + (y3_mod d + (y5_mod d + (y6_mod d - #8.0)))))) + ((#0.5 * (y1_mod d - #2.0)) + (#0.773 * (y4_mod d - #2.0))))) - #0.0) >= #0.0`; + + "ineq108", `!d:A. d IN hyp_dart3 H ==> + ((((azim_mod d) - #1.2308) + (((#0.3639 * (y2_mod d + (y3_mod d + (y5_mod d + (y6_mod d - #8.0))))) - (#0.235 * (y1_mod d - #2.0))) - (#0.685 * (y4_mod d - #2.0)))) - #0.0) >= #0.0`; + + "ineq109", `!d:A. d IN hyp_dart3 H ==> + (((--(sol_mod (face H d))) + (#0.5513 + ((#0.3232 * (y4_mod d + (y5_mod d + (y6_mod d - #6.0)))) - (#0.151 * (y1_mod d + (y2_mod d + (y3_mod d - #6.0))))))) - #0.0) >= #0.0`; + + "ineq110", `!d:A. d IN hyp_dart3 H ==> + (((((sol_mod (face H d)) - #0.55125) - (#0.196 * (y4_mod d + (y5_mod d + (y6_mod d - #6.0))))) + (#0.38 * (y1_mod d + (y2_mod d + (y3_mod d - #6.0))))) - #0.0) >= #0.0`; + + "ineq111", `!d:A. d IN hyp_dart3 H ==> + (((tau_mod (face H d)) + ((#0.001 - (#0.18 * (y1_mod d + (y2_mod d + (y3_mod d - #6.0))))) - (#0.125 * (y4_mod d + (y5_mod d + (y6_mod d - #6.0)))))) - #0.0) >= #0.0`; + + + "ineq112", `!d:A. d IN hyp_dart3 H ==> + ((((tau_mod (face H d)) - (#0.507 * (azim_mod d))) + #0.724) - #0.0) >= #0.0`; + + "ineq113", `!d:A. d IN hyp_dart3 H ==> + ((((tau_mod (face H d)) - (#0.259 * (azim_mod d))) + #0.32) - #0.0) >= #0.0`; + + "ineq114", `!d:A. d IN hyp_dart3 H ==> + (((tau_mod (face H d)) + ((#0.626 * (azim_mod d)) - #0.77)) - #0.0) >= #0.0`; + + "ineq115", `!d:A. d IN hyp_dart3 H ==> + (#1.893 - (azim_mod d)) >= #0.0`; + + "ineq116", `!d:A. d IN hyp_dart3 H ==> + ((azim_mod d) - #0.852) >= #0.0`; + + "ineq119", `!d:A. d IN hyp_dart4 H ==> + ((((tau_mod (face H d)) - (#0.453 * (azim_mod d))) + #0.777) - #0.0) >= #0.0`; + + "ineq120", `!d:A. d IN hyp_dart4 H ==> + (((tau_mod (face H d)) + ((#0.7573 * (azim_mod d)) - #1.433)) - #0.0) >= #0.0`; + + "ineq121", `!d:A. d IN hyp_dart4 H ==> + (((tau_mod (face H d)) + ((#0.972 * (azim_mod d)) - #1.707)) - #0.0) >= #0.0`; + + "ineq122", `!d:A. d IN hyp_dart4 H ==> + (((tau_mod (face H d)) + ((#4.72 * (azim_mod d)) - #6.248)) - #0.0) >= #0.0`; +];; + + +(* +let y1_def = `!d. d IN dart (H:(A)hypermap) ==> y1_mod d = yn_mod (node H d):real`;; +y1_def{(i3,i1,i2,j) in e_dart}: y1[i1,j] = yn[i1]; + + +(* Rename terms and types *) +let s1 = inst [`:real^3#real^3`, aty] im_sum;; +let s2 = subst [`hypermap_of_fan (V,E)`, h_fan_hyp] s1;; +let s3 = subst [`azim_dart (V,E)`, azim_mod] s2;; +*) + +(*************************************) + +let SUM_ISOMORPHISM = prove(`!G H (g:B->A) (r:A->real). isomorphism g (G,H) + ==> (!d. d IN dart G ==> sum(node G d) (r o g) = sum(node H (g d)) r)`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `sum(node G d) (r o (g:B->A)) = sum(IMAGE g (node G d)) r` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC (GSYM SUM_IMAGE) THEN + REPEAT STRIP_TAC THEN + UNDISCH_TAC `isomorphism (g:B->A) (G,H)` THEN + REWRITE_TAC[isomorphism; BIJ; INJ] THEN + DISCH_THEN (MP_TAC o CONJUNCT1) THEN + DISCH_THEN (MP_TAC o CONJUNCT1) THEN + DISCH_THEN (MATCH_MP_TAC o CONJUNCT2) THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THEN MATCH_MP_TAC IN_TRANS THEN EXISTS_TAC `node G (d:B)` THEN ASM_SIMP_TAC[Hypermap.lemma_node_subset]; + ALL_TAC + ] THEN + MP_TAC (ISPECL [`g:B->A`; `G:(B)hypermap`; `H:(A)hypermap`; `d:B`] ISOMORPHISM_COMPONENT_IMAGE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]));; + + +let ISO_NODE_INJ = prove(`!G H (g:B->A) n. isomorphism g (G,H) /\ n IN node_set G ==> + (!x y. x IN n /\ y IN n /\ g x = g y ==> x = y)`, + REPEAT STRIP_TAC THEN + UNDISCH_TAC `isomorphism (g:B->A) (G,H)` THEN + REWRITE_TAC[isomorphism; BIJ; INJ] THEN + DISCH_THEN (MP_TAC o CONJUNCT1) THEN DISCH_THEN (MP_TAC o CONJUNCT1) THEN + DISCH_THEN (MATCH_MP_TAC o CONJUNCT2) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (ISPECL [`G:(B)hypermap`; `n:B->bool`] Hypermap.lemma_node_representation) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + CONJ_TAC THEN MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `n:B->bool` THEN + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[Hypermap.lemma_node_subset]);; + + + +let COMPONENTS_ISO_IMAGE = prove(`!G H (g:B->A). isomorphism g (G,H) + ==> (!d. d IN dart G ==> + node H (g d) = IMAGE g (node G d) /\ + face H (g d) = IMAGE g (face G d))`, + REPEAT GEN_TAC THEN STRIP_TAC THEN GEN_TAC THEN DISCH_TAC THEN + MP_TAC (ISPECL[`g:B->A`; `G:(B)hypermap`; `H:(A)hypermap`; `d:B`] ISOMORPHISM_COMPONENT_IMAGE) THEN + ASM_REWRITE_TAC[] THEN + SIMP_TAC[]);; + + +let HYPERMAP_MAPS_ISO_COMM = prove(`!G H (g:B->A). isomorphism g (G,H) + ==> (!d. d IN dart G ==> + face_map H (g d) = g (face_map G d) /\ + node_map H (g d) = g (node_map G d))`, + SIMP_TAC[isomorphism]);; + + +let HYPERMAP_INV_MAPS = prove(`!(G:(B)hypermap) d. d IN dart G + ==> (?k. inverse (face_map G) d = (face_map G POWER k) d)`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `n = CARD (orbit_map (face_map G) (d:B))` THEN + MP_TAC (ISPECL [`face_map G:B->B`; `dart G:B->bool`; `d:B`; `n:num`; `1`] Hypermap_and_fan.FINITE_ORBIT_MAP_INVERSE) THEN + ASM_REWRITE_TAC[Hypermap.hypermap_lemma] THEN + ANTS_TAC THENL + [ + REWRITE_TAC[ARITH_RULE `1 <= n <=> 0 < n`] THEN + EXPAND_TAC "n" THEN + MATCH_MP_TAC Hypermap_and_fan.ORBIT_MAP_CARD_POS THEN + EXISTS_TAC `dart G:B->bool` THEN + REWRITE_TAC[Hypermap.hypermap_lemma]; + ALL_TAC + ] THEN + REWRITE_TAC[Hypermap.POWER_1] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + EXISTS_TAC `n - 1` THEN + REWRITE_TAC[]);; + + + +let HYPERMAP_INV_MAPS_ISO_COMM = prove(`!G H (g:B->A). isomorphism g (G,H) + ==> (!d. d IN dart G ==> + inverse (face_map H) (g d) = g (inverse (face_map G) d) /\ + inverse (node_map H) (g d) = g (inverse (node_map G) d))`, + REWRITE_TAC[isomorphism] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC (GSYM COMM_INVERSE_LEMMA) THEN + MAP_EVERY EXISTS_TAC [`dart G:B->bool`; `dart H:A->bool`] THEN + ASM_SIMP_TAC[Hypermap.hypermap_lemma]);; + + +let HYPERMAP_INV_MAPS_ISO_IMAGE = prove(`!G H (g:B->A). isomorphism g (G,H) + ==> (!d. d IN dart G ==> + face H (inverse (face_map H) (g d)) = IMAGE g (face G (inverse (face_map G) d)) /\ + node H (inverse (face_map H) (g d)) = IMAGE g (node G (inverse (face_map G) d)))`, + REPEAT GEN_TAC THEN DISCH_TAC THEN GEN_TAC THEN DISCH_TAC THEN + ASM_SIMP_TAC[HYPERMAP_INV_MAPS_ISO_COMM] THEN + ABBREV_TAC `x = inverse (face_map G) (d:B)` THEN + SUBGOAL_THEN `x:B IN dart G` ASSUME_TAC THENL + [ + EXPAND_TAC "x" THEN + ASM_SIMP_TAC[Hypermap.lemma_dart_inveriant_under_inverse_maps]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[COMPONENTS_ISO_IMAGE]);; + + + + + +let HYPERMAP_MAPS_ISO_IMAGE = prove(`!G H (g:B->A). isomorphism g (G,H) + ==> (!d. d IN dart G ==> + face H (face_map H (g d)) = IMAGE g (face G (face_map G d)) /\ + face H (node_map H (g d)) = IMAGE g (face G (node_map G d)) /\ + node H (node_map H (g d)) = IMAGE g (node G (node_map G d)) /\ + node H (face_map H (g d)) = IMAGE g (node G (face_map G d)))`, + REPEAT GEN_TAC THEN DISCH_TAC THEN GEN_TAC THEN DISCH_TAC THEN + ASM_SIMP_TAC[HYPERMAP_MAPS_ISO_COMM] THEN + MP_TAC (SPEC_ALL COMPONENTS_ISO_IMAGE) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + REPEAT CONJ_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `face_map G (d:B)`); + FIRST_X_ASSUM (MP_TAC o SPEC `node_map G (d:B)`); + FIRST_X_ASSUM (MP_TAC o SPEC `node_map G (d:B)`); + FIRST_X_ASSUM (MP_TAC o SPEC `face_map G (d:B)`) + ] THEN + ASM_SIMP_TAC[Hypermap.lemma_dart_invariant]);; + + + + + + + + +let SUM_NODE_ISO = prove(`!G H (g:B->A) (r:A->real). isomorphism g (G,H) + ==> (!n. n IN node_set G ==> sum(IMAGE g n) r = sum n (r o g))`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC SUM_IMAGE THEN + MATCH_MP_TAC ISO_NODE_INJ THEN + MAP_EVERY EXISTS_TAC [`G:(B)hypermap`; `H:(A)hypermap`] THEN + ASM_REWRITE_TAC[]);; + + + +let CARD_NODE_ISO = prove(`!G H (g:B->A). isomorphism g (G,H) + ==> (!n. n IN node_set G ==> CARD (IMAGE g n) = CARD n)`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC CARD_IMAGE_INJ THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC ISO_NODE_INJ THEN + MAP_EVERY EXISTS_TAC [`G:(B)hypermap`; `H:(A)hypermap`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`G:(B)hypermap`; `n:B->bool`] Hypermap.lemma_node_representation) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[Hypermap.NODE_FINITE]);; + + +let SUM_NODE_SUB = prove(`!(G:(B)hypermap) r1 r2 n. n IN node_set G + ==> sum n (\x. r1 x - r2 x) = sum n r1 - sum n r2`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`G:(B)hypermap`; `n:B->bool`] Hypermap.lemma_node_representation) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + ASM_SIMP_TAC[Hypermap.NODE_FINITE; SUM_SUB]);; + + +let SUM_NODE_CONST = prove(`!(G:(B)hypermap) c n. n IN node_set G + ==> sum n (\x. c) = &(CARD n) * c`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`G:(B)hypermap`; `n:B->bool`] Hypermap.lemma_node_representation) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + ASM_SIMP_TAC[Hypermap.NODE_FINITE; SUM_CONST]);; + + +let SUM_NODE_SUB_CONST = prove(`!(G:(B)hypermap) r c n. n IN node_set G + ==> sum n (\x. r x - c) = sum n r - &(CARD n) * c`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL SUM_NODE_CONST) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MP_TAC (SPECL [`G:(B)hypermap`; `r:B->real`; `\x:B. c:real`; `n:B->bool`] SUM_NODE_SUB) THEN + ASM_REWRITE_TAC[]);; + + + + + +let ISO_FACE_INJ = prove(`!G H (g:B->A) f. isomorphism g (G,H) /\ f IN face_set G ==> + (!x y. x IN f /\ y IN f /\ g x = g y ==> x = y)`, + REPEAT STRIP_TAC THEN + UNDISCH_TAC `isomorphism (g:B->A) (G,H)` THEN + REWRITE_TAC[isomorphism; BIJ; INJ] THEN + DISCH_THEN (MP_TAC o CONJUNCT1) THEN DISCH_THEN (MP_TAC o CONJUNCT1) THEN + DISCH_THEN (MATCH_MP_TAC o CONJUNCT2) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (ISPECL [`G:(B)hypermap`; `f:B->bool`] Hypermap.lemma_face_representation) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + CONJ_TAC THEN MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `f:B->bool` THEN + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[Hypermap.lemma_face_subset]);; + + +let SUM_FACE_ISO = prove(`!G H (g:B->A) (r:A->real). isomorphism g (G,H) + ==> (!f. f IN face_set G ==> sum(IMAGE g f) r = sum f (r o g))`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC SUM_IMAGE THEN + MATCH_MP_TAC ISO_FACE_INJ THEN + MAP_EVERY EXISTS_TAC [`G:(B)hypermap`; `H:(A)hypermap`] THEN + ASM_REWRITE_TAC[]);; + + + +let CARD_FACE_ISO = prove(`!G H (g:B->A). isomorphism g (G,H) + ==> (!f. f IN face_set G ==> CARD (IMAGE g f) = CARD f)`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC CARD_IMAGE_INJ THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC ISO_FACE_INJ THEN + MAP_EVERY EXISTS_TAC [`G:(B)hypermap`; `H:(A)hypermap`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`G:(B)hypermap`; `f:B->bool`] Hypermap.lemma_face_representation) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[Hypermap.FACE_FINITE]);; + + +let SUM_FACE_SUB = prove(`!(G:(B)hypermap) r1 r2 f. f IN face_set G + ==> sum f (\x. r1 x - r2 x) = sum f r1 - sum f r2`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`G:(B)hypermap`; `f:B->bool`] Hypermap.lemma_face_representation) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + ASM_SIMP_TAC[Hypermap.FACE_FINITE; SUM_SUB]);; + + +let SUM_FACE_CONST = prove(`!(G:(B)hypermap) c f. f IN face_set G + ==> sum f (\x. c) = &(CARD f) * c`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`G:(B)hypermap`; `f:B->bool`] Hypermap.lemma_face_representation) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + ASM_SIMP_TAC[Hypermap.FACE_FINITE; SUM_CONST]);; + + +let SUM_FACE_SUB_CONST = prove(`!(G:(B)hypermap) r c f. f IN face_set G + ==> sum f (\x. r x - c) = sum f r - &(CARD f) * c`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL SUM_FACE_CONST) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MP_TAC (SPECL [`G:(B)hypermap`; `r:B->real`; `\x:B. c:real`; `f:B->bool`] SUM_FACE_SUB) THEN + ASM_REWRITE_TAC[]);; + + + + +let SUM_NODE_LIST = prove(`!L (n:(A#A)list). good_list L /\ MEM n (list_of_nodes L) ==> + sum (set_of_list n) = list_sum n`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[FUN_EQ_THM] THEN X_GEN_TAC `f:(A#A)->real` THEN + MP_TAC (ISPECL [`f:A#A->real`; `n:(A#A)list`] ALL_DISTINCT_SUM) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC ALL_DISTINCT_NODE THEN + EXISTS_TAC `L:((A)list)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[]);; + + + +let SUM_NODE_LIST_ALL = prove(`!L (P:(A#A->bool)->((A#A->real)->real)->bool). good_list L /\ good_list_nodes L ==> + ((!n. n IN node_set (hypermap_of_list L) ==> P n (sum n)) + <=> (!n. MEM n (list_of_nodes L) ==> P (set_of_list n) (list_sum n)))`, + REWRITE_TAC[good_list_nodes] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[IN_SET_OF_LIST; nodes_of_list] THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `set_of_list n:A#A->bool`) THEN + REWRITE_TAC[MEM_MAP] THEN + ANTS_TAC THENL + [ + EXISTS_TAC `n:(A#A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPEC_ALL SUM_NODE_LIST) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN + REWRITE_TAC[MEM_MAP] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:(A#A)list`) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL[`L:((A)list)list`; `x:(A#A)list`] SUM_NODE_LIST) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]));; + + +let CARD_SET_OF_LIST_NODE = prove(`!(L:((A)list)list) n. good_list L /\ MEM n (list_of_nodes L) + ==> CARD(set_of_list n) = LENGTH n`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC CARD_SET_OF_LIST_ALL_DISTINCT THEN + MATCH_MP_TAC ALL_DISTINCT_NODE THEN + EXISTS_TAC `L:((A)list)list` THEN ASM_REWRITE_TAC[]);; + + + + + +let SUM_FACE_LIST = prove(`!L (f:(A#A)list). good_list L /\ MEM f (list_of_faces L) ==> + sum (set_of_list f) = list_sum f`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[FUN_EQ_THM] THEN X_GEN_TAC `r:(A#A)->real` THEN + MP_TAC (ISPECL [`r:A#A->real`; `f:(A#A)list`] ALL_DISTINCT_SUM) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC ALL_DISTINCT_FACE THEN + EXISTS_TAC `L:((A)list)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[]);; + + + +let SUM_FACE_LIST_ALL = prove(`!(L:((A)list)list) P. good_list L ==> + ((!f. f IN face_set (hypermap_of_list L) ==> P f (sum f)) + <=> (!f. MEM f (list_of_faces L) ==> P (set_of_list f) (list_sum f)))`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[FACE_SET_EQ_LIST] THEN + ASM_REWRITE_TAC[IN_SET_OF_LIST; faces_of_list] THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `set_of_list f:A#A->bool`) THEN + REWRITE_TAC[MEM_MAP] THEN + ANTS_TAC THENL + [ + EXISTS_TAC `f:(A#A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPEC_ALL SUM_FACE_LIST) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN + REWRITE_TAC[MEM_MAP] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:(A#A)list`) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL[`L:((A)list)list`; `x:(A#A)list`] SUM_FACE_LIST) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]));; + + + +let CARD_SET_OF_LIST_FACE = prove(`!(L:((A)list)list) f. good_list L /\ MEM f (list_of_faces L) + ==> CARD(set_of_list f) = LENGTH f`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC CARD_SET_OF_LIST_ALL_DISTINCT THEN + MATCH_MP_TAC ALL_DISTINCT_FACE THEN + EXISTS_TAC `L:((A)list)list` THEN ASM_REWRITE_TAC[]);; + + +let IN_DART3_IMP_IN_DART = UNDISCH_ALL (prove(`d:B IN hyp_dart3 G ==> d IN dart G`, + SIMP_TAC[hyp_dart3; IN_ELIM_THM]));; +let IN_DART4_IMP_IN_DART = UNDISCH_ALL (prove(`d:B IN hyp_dart4 G ==> d IN dart G`, + SIMP_TAC[hyp_dart4; IN_ELIM_THM]));; + +let IN_FACE3_IMP_IN_FACE = UNDISCH_ALL (prove(`f IN hyp_face3 (G:(B)hypermap) ==> f IN face_set G`, + SIMP_TAC[hyp_face3; IN_ELIM_THM]));; +let IN_FACE4_IMP_IN_FACE = UNDISCH_ALL (prove(`f IN hyp_face4 (G:(B)hypermap) ==> f IN face_set G`, + SIMP_TAC[hyp_face4; IN_ELIM_THM]));; +let IN_FACE5_IMP_IN_FACE = UNDISCH_ALL (prove(`f IN hyp_face5 (G:(B)hypermap) ==> f IN face_set G`, + SIMP_TAC[hyp_face5; IN_ELIM_THM]));; +let IN_FACE6_IMP_IN_FACE = UNDISCH_ALL (prove(`f IN hyp_face6 (G:(B)hypermap) ==> f IN face_set G`, + SIMP_TAC[hyp_face6; IN_ELIM_THM]));; + + + + +let DART_LIST_ALL = prove(`!(L:((A)list)list) P. good_list L ==> + ((!d. d IN dart (hypermap_of_list L) ==> P d) + <=> (!d. MEM d (list_of_darts L) ==> P d))`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST; darts_of_list; IN_SET_OF_LIST]);; + + +let DART3_LIST_ALL = prove(`!(L:((A)list)list) P. good_list L ==> + ((!d. d IN hyp_dart3 (hypermap_of_list L) ==> P d) + <=> (!d. MEM d (list_of_darts3 L) ==> P d))`, + REPEAT STRIP_TAC THEN ASM_SIMP_TAC[LIST_OF_DARTS3; IN_SET_OF_LIST]);; + + + +let DART4_LIST_ALL = prove(`!(L:((A)list)list) P. good_list L ==> + ((!d. d IN hyp_dart4 (hypermap_of_list L) ==> P d) + <=> (!d. MEM d (list_of_darts4 L) ==> P d))`, + REPEAT STRIP_TAC THEN ASM_SIMP_TAC[LIST_OF_DARTS4; IN_SET_OF_LIST]);; + + +let DARTX_LIST_ALL = prove(`!(L:((A)list)list) P. good_list L ==> + ((!d. d IN hyp_dartX (hypermap_of_list L) ==> P d) + <=> (!d. MEM d (list_of_dartsX L) ==> P d))`, + REPEAT STRIP_TAC THEN ASM_SIMP_TAC[LIST_OF_DARTS_X; IN_SET_OF_LIST]);; + + + +let FACE3_LIST_ALL = prove(`!(L:((A)list)list) P. good_list L ==> + ((!f. f IN hyp_face3 (hypermap_of_list L) ==> P f (sum f)) + <=> (!f. MEM f (list_of_faces3 L) ==> P (set_of_list f) (list_sum f)))`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[LIST_OF_FACES3] THEN + ASM_REWRITE_TAC[IN_SET_OF_LIST; MEM_MAP] THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `set_of_list f:A#A->bool`) THEN + ANTS_TAC THENL + [ + EXISTS_TAC `f:(A#A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPEC_ALL SUM_FACE_LIST) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN + SIMP_TAC[list_of_faces3; MEM_FILTER]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `x:(A#A)list`) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL[`L:((A)list)list`; `x:(A#A)list`] SUM_FACE_LIST) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[list_of_faces3; MEM_FILTER]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]));; + + + +let FACE4_LIST_ALL = prove(`!(L:((A)list)list) P. good_list L ==> + ((!f. f IN hyp_face4 (hypermap_of_list L) ==> P f (sum f)) + <=> (!f. MEM f (list_of_faces4 L) ==> P (set_of_list f) (list_sum f)))`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[LIST_OF_FACES4] THEN + ASM_REWRITE_TAC[IN_SET_OF_LIST; MEM_MAP] THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `set_of_list f:A#A->bool`) THEN + ANTS_TAC THENL + [ + EXISTS_TAC `f:(A#A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPEC_ALL SUM_FACE_LIST) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN + SIMP_TAC[list_of_faces4; MEM_FILTER]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `x:(A#A)list`) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL[`L:((A)list)list`; `x:(A#A)list`] SUM_FACE_LIST) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[list_of_faces4; MEM_FILTER]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]));; + + +let FACE5_LIST_ALL = prove(`!(L:((A)list)list) P. good_list L ==> + ((!f. f IN hyp_face5 (hypermap_of_list L) ==> P f (sum f)) + <=> (!f. MEM f (list_of_faces5 L) ==> P (set_of_list f) (list_sum f)))`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[LIST_OF_FACES5] THEN + ASM_REWRITE_TAC[IN_SET_OF_LIST; MEM_MAP] THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `set_of_list f:A#A->bool`) THEN + ANTS_TAC THENL + [ + EXISTS_TAC `f:(A#A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPEC_ALL SUM_FACE_LIST) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN + SIMP_TAC[list_of_faces5; MEM_FILTER]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `x:(A#A)list`) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL[`L:((A)list)list`; `x:(A#A)list`] SUM_FACE_LIST) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[list_of_faces5; MEM_FILTER]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]));; + + +let FACE6_LIST_ALL = prove(`!(L:((A)list)list) P. good_list L ==> + ((!f. f IN hyp_face6 (hypermap_of_list L) ==> P f (sum f)) + <=> (!f. MEM f (list_of_faces6 L) ==> P (set_of_list f) (list_sum f)))`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[LIST_OF_FACES6] THEN + ASM_REWRITE_TAC[IN_SET_OF_LIST; MEM_MAP] THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `set_of_list f:A#A->bool`) THEN + ANTS_TAC THENL + [ + EXISTS_TAC `f:(A#A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPEC_ALL SUM_FACE_LIST) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN + SIMP_TAC[list_of_faces6; MEM_FILTER]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `x:(A#A)list`) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL[`L:((A)list)list`; `x:(A#A)list`] SUM_FACE_LIST) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[list_of_faces6; MEM_FILTER]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]));; + + + +let EDGE_LIST_ALL = prove(`!(L:((A)list)list) P. good_list L ==> + ((!e. e IN hyp_edge_pairs (hypermap_of_list L) ==> P e) + <=> (!e. MEM e (list_of_edges L) ==> P e))`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[LIST_OF_EDGES; IN_SET_OF_LIST]);; + + +let SUB_CONST_o = prove(`!f (c:real) (g:B->A). (\x. f x - c) o g = (\x. (f o g) x - c)`, + REWRITE_TAC[FUN_EQ_THM; o_THM]);; + + +(*******************************) + + +let in_all_rewrites = +[ + SUM_NODE_LIST_ALL; + SUM_FACE_LIST_ALL; + EDGE_LIST_ALL; + DART_LIST_ALL; + DART3_LIST_ALL; + DART4_LIST_ALL; + DARTX_LIST_ALL; + FACE3_LIST_ALL; + FACE4_LIST_ALL; + FACE5_LIST_ALL; + FACE6_LIST_ALL; +];; + + + +let table_set_hyp = + let table = Hashtbl.create 10 in + let _ = map (uncurry (Hashtbl.add table)) + [ + `hyp_dart3 (G:(B)hypermap)`, IN_DART3_IMP_IN_DART; + `hyp_dart4 (G:(B)hypermap)`, IN_DART4_IMP_IN_DART; + `hyp_face3 (G:(B)hypermap)`, IN_FACE3_IMP_IN_FACE; + `hyp_face4 (G:(B)hypermap)`, IN_FACE4_IMP_IN_FACE; + `hyp_face5 (G:(B)hypermap)`, IN_FACE5_IMP_IN_FACE; + `hyp_face6 (G:(B)hypermap)`, IN_FACE6_IMP_IN_FACE; + ] in + table;; + + + +(*************************************) + + +let iso_dart_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!d. d IN dart H ==> P d) ==> (!d. d IN dart G ==> P (g d)))`, + REWRITE_TAC[isomorphism; BIJ; SURJ] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `d:B`) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `d:B`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `(g:B->A) d`) THEN + ASM_SIMP_TAC[]);; + + +let iso_dart_in = prove(`!(g:B->A) H G d. isomorphism g (G,H) /\ d IN dart G ==> + g d IN dart H`, + REWRITE_TAC[isomorphism; BIJ; SURJ; INJ] THEN + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[]);; + + + +let iso_card_eq = prove(`!(g:B->A) H G s. isomorphism g (G,H) /\ s SUBSET dart G + ==> CARD (IMAGE g s) = CARD s`, + REWRITE_TAC[isomorphism; BIJ; INJ] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC CARD_IMAGE_INJ THEN + CONJ_TAC THENL + [ + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THEN MATCH_MP_TAC IN_TRANS THEN EXISTS_TAC `s:B->bool` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC FINITE_SUBSET THEN + EXISTS_TAC `dart G:B->bool` THEN + ASM_REWRITE_TAC[Hypermap.hypermap_lemma]);; + + +let iso_face_card = prove(`!(g:B->A) H G d. isomorphism g (G,H) /\ d IN dart G + ==> CARD (face H (g d)) = CARD (face G d)`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL COMPONENTS_ISO_IMAGE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `d:B`) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC iso_card_eq THEN + MAP_EVERY EXISTS_TAC [`H:(A)hypermap`; `G:(B)hypermap`] THEN + ASM_SIMP_TAC[Hypermap.lemma_face_subset]);; + + +let iso_dart3_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!d. d IN hyp_dart3 H ==> P d) ==> (!d. d IN hyp_dart3 G ==> P (g d)))`, + REWRITE_TAC[hyp_dart3; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MP_TAC (SPEC_ALL iso_dart_in) THEN + ASM_SIMP_TAC[iso_face_card]);; + + + +let iso_dart4_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!d. d IN hyp_dart4 H ==> P d) ==> (!d. d IN hyp_dart4 G ==> P (g d)))`, + REWRITE_TAC[hyp_dart4; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MP_TAC (SPEC_ALL iso_dart_in) THEN + ASM_SIMP_TAC[iso_face_card]);; + + + +let iso_dartX_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!d. d IN hyp_dartX H ==> P d) ==> (!d. d IN hyp_dartX G ==> P (g d)))`, + REWRITE_TAC[hyp_dartX; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MP_TAC (SPEC_ALL iso_dart_in) THEN + ASM_SIMP_TAC[iso_face_card]);; + + + + +let iso_edge_pairs_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!e. e IN hyp_edge_pairs H ==> P e) ==> (!e. e IN hyp_edge_pairs G ==> P (g (FST e), g (SND e))))`, + REWRITE_TAC[isomorphism; BIJ; SURJ; hyp_edge_pairs; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + EXISTS_TAC `(g:B->A) x` THEN + ASM_SIMP_TAC[]);; + + + + +let iso_node_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!n. n IN node_set H ==> P n) ==> (!n. n IN node_set G ==> P (IMAGE g n)))`, + REPEAT STRIP_TAC THEN + POP_ASSUM (MP_TAC o MATCH_MP Hypermap.lemma_node_representation) THEN + STRIP_TAC THEN + MP_TAC (ISPECL [`g:B->A`; `G:(B)hypermap`; `H:(A)hypermap`; `x:B`] ISOMORPHISM_COMPONENT_IMAGE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[GSYM Hypermap.lemma_in_node_set] THEN + MATCH_MP_TAC iso_dart_in THEN + EXISTS_TAC `G:(B)hypermap` THEN + ASM_REWRITE_TAC[]);; + + + +let iso_face_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!f. f IN face_set H ==> P f) ==> (!f. f IN face_set G ==> P (IMAGE g f)))`, + REPEAT STRIP_TAC THEN + POP_ASSUM (MP_TAC o MATCH_MP Hypermap.lemma_face_representation) THEN + STRIP_TAC THEN + MP_TAC (ISPECL [`g:B->A`; `G:(B)hypermap`; `H:(A)hypermap`; `x:B`] ISOMORPHISM_COMPONENT_IMAGE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[GSYM Hypermap.lemma_in_face_set] THEN + MATCH_MP_TAC iso_dart_in THEN + EXISTS_TAC `G:(B)hypermap` THEN + ASM_REWRITE_TAC[]);; + + +let iso_face3_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!f. f IN hyp_face3 H ==> P f) ==> (!f. f IN hyp_face3 G ==> P (IMAGE g f)))`, + REWRITE_TAC[hyp_face3; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + MP_TAC (SPECL[`g:B->A`; `H:(A)hypermap`; `G:(B)hypermap`] iso_face_trans) THEN + ASM_REWRITE_TAC[] THEN + REPEAT DISCH_TAC THEN + CONJ_TAC THENL + [ + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SPEC_TAC (`f:B->bool`, `f:B->bool`) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL[`G:(B)hypermap`; `f:B->bool`] Hypermap.lemma_face_representation) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + UNDISCH_TAC `CARD (f:B->bool) = 3` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[] THEN + + MP_TAC (SPEC_ALL COMPONENTS_ISO_IMAGE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> ASM_SIMP_TAC[GSYM th]) THEN + MATCH_MP_TAC iso_face_card THEN + ASM_REWRITE_TAC[]);; + + +let iso_face4_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!f. f IN hyp_face4 H ==> P f) ==> (!f. f IN hyp_face4 G ==> P (IMAGE g f)))`, + REWRITE_TAC[hyp_face4; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + MP_TAC (SPECL[`g:B->A`; `H:(A)hypermap`; `G:(B)hypermap`] iso_face_trans) THEN + ASM_REWRITE_TAC[] THEN + REPEAT DISCH_TAC THEN + CONJ_TAC THENL + [ + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SPEC_TAC (`f:B->bool`, `f:B->bool`) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL[`G:(B)hypermap`; `f:B->bool`] Hypermap.lemma_face_representation) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + UNDISCH_TAC `CARD (f:B->bool) = 4` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[] THEN + + MP_TAC (SPEC_ALL COMPONENTS_ISO_IMAGE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> ASM_SIMP_TAC[GSYM th]) THEN + MATCH_MP_TAC iso_face_card THEN + ASM_REWRITE_TAC[]);; + + +let iso_face5_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!f. f IN hyp_face5 H ==> P f) ==> (!f. f IN hyp_face5 G ==> P (IMAGE g f)))`, + REWRITE_TAC[hyp_face5; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + MP_TAC (SPECL[`g:B->A`; `H:(A)hypermap`; `G:(B)hypermap`] iso_face_trans) THEN + ASM_REWRITE_TAC[] THEN + REPEAT DISCH_TAC THEN + CONJ_TAC THENL + [ + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SPEC_TAC (`f:B->bool`, `f:B->bool`) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL[`G:(B)hypermap`; `f:B->bool`] Hypermap.lemma_face_representation) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + UNDISCH_TAC `CARD (f:B->bool) = 5` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[] THEN + + MP_TAC (SPEC_ALL COMPONENTS_ISO_IMAGE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> ASM_SIMP_TAC[GSYM th]) THEN + MATCH_MP_TAC iso_face_card THEN + ASM_REWRITE_TAC[]);; + + +let iso_face6_trans = prove(`!(g:B->A) H G P. isomorphism g (G,H) ==> + ((!f. f IN hyp_face6 H ==> P f) ==> (!f. f IN hyp_face6 G ==> P (IMAGE g f)))`, + REWRITE_TAC[hyp_face6; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + MP_TAC (SPECL[`g:B->A`; `H:(A)hypermap`; `G:(B)hypermap`] iso_face_trans) THEN + ASM_REWRITE_TAC[] THEN + REPEAT DISCH_TAC THEN + CONJ_TAC THENL + [ + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SPEC_TAC (`f:B->bool`, `f:B->bool`) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL[`G:(B)hypermap`; `f:B->bool`] Hypermap.lemma_face_representation) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + UNDISCH_TAC `CARD (f:B->bool) = 6` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[] THEN + + MP_TAC (SPEC_ALL COMPONENTS_ISO_IMAGE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> ASM_SIMP_TAC[GSYM th]) THEN + MATCH_MP_TAC iso_face_card THEN + ASM_REWRITE_TAC[]);; + + + + +let iso_trans_table = + let table = Hashtbl.create 10 in + let _ = map (uncurry (Hashtbl.add table)) + [ + `dart H:A->bool`, iso_dart_trans; + `node_set (H:(A)hypermap)`, iso_node_trans; + `face_set (H:(A)hypermap)`, iso_face_trans; + `hyp_edge_pairs (H:(A)hypermap)`, iso_edge_pairs_trans; + `hyp_dart3 (H:(A)hypermap)`, iso_dart3_trans; + `hyp_dart4 (H:(A)hypermap)`, iso_dart4_trans; + `hyp_dartX (H:(A)hypermap)`, iso_dartX_trans; + `hyp_face3 (H:(A)hypermap)`, iso_face3_trans; + `hyp_face4 (H:(A)hypermap)`, iso_face4_trans; + `hyp_face5 (H:(A)hypermap)`, iso_face5_trans; + `hyp_face6 (H:(A)hypermap)`, iso_face6_trans; + ] in + table;; + + +(**************************) + + + +let gen_iso_thm ineq = + let x_tm, tm = dest_forall ineq in + let set, p_tm' = dest_binary "==>" tm in + let set_th = Hashtbl.find iso_trans_table (rand set) in + let p_tm = mk_abs (x_tm, p_tm') in + let p_var = mk_var ("P", type_of (rand set)) in + let th3 = (SPEC_ALL (REWRITE_RULE[IMP_IMP] set_th)) in + BETA_RULE (INST[p_tm, p_var] th3);; + + + + + + +let gen_general_ineq ineq = + let iso_th = gen_iso_thm ineq in + (* General rewrites before specifying hypermaps *) + let th0 = UNDISCH_ALL (REWRITE_RULE[GSYM IMP_IMP] iso_th) in + let gen_var, rtm = dest_forall(concl th0) in + let ants = lhand rtm in + let set = rand ants in + let th1 = UNDISCH_ALL (SPEC_ALL th0) in + + let th_rule th = UNDISCH_ALL (SPEC_ALL (UNDISCH_ALL (SPEC_ALL th))) in + + let ths = [ + th_rule SUM_NODE_ISO; + th_rule CARD_NODE_ISO; + th_rule SUM_FACE_ISO; + th_rule CARD_FACE_ISO; + th_rule COMPONENTS_ISO_IMAGE; + th_rule HYPERMAP_MAPS_ISO_IMAGE; + th_rule HYPERMAP_INV_MAPS_ISO_IMAGE; + th_rule HYPERMAP_MAPS_ISO_COMM; + th_rule HYPERMAP_INV_MAPS_ISO_COMM; + SUB_CONST_o; ETA_AX; + th_rule SUM_FACE_SUB_CONST; + ] in + + let th2' = REWRITE_RULE ths th1 in + let th2 = + if (Hashtbl.mem table_set_hyp set) then + PROVE_HYP (Hashtbl.find table_set_hyp set) th2' + else + th2' in + let th3 = GEN gen_var (DISCH ants th2) in + + let s0 = th3 in + + (* G -> hypermap_of_list (L:((num)list)list) *) + (* Instantiate correct types *) + let s1 = INST_TYPE [`:real^3#real^3`, aty; `:num#num`, bty] s0 in + let s2 = INST[`hypermap_of_list (L:((num)list)list)`, `G:(num#num)hypermap`] s1 in + + let th_rule = (UNDISCH_ALL o INST_TYPE [`:num`, aty] o SPEC_ALL o REWRITE_RULE[GSYM IMP_IMP]) in + + let ths = map th_rule in_all_rewrites in + let s3 = REWRITE_RULE ths s2 in + + let gen_var2, rtm = dest_forall(concl s3) in + let ants2 = lhand rtm in + + let s4 = UNDISCH_ALL (SPEC_ALL s3) in + + let ths = + [ + th_rule CARD_SET_OF_LIST_FACE; + th_rule CARD_SET_OF_LIST_NODE; + ] in + + let s5 = REWRITE_RULE ths s4 in + let s6 = GEN gen_var2 (DISCH ants2 s5) in + + (* Deal with basic variables *) + let s7 = INST var_list s6 in + let s8 = INST[`ESTD V`, `E:(real^3->bool)->bool`] s7 in + let s9 = REWRITE_RULE list_var_rewrites s8 in + let r0 = s9 in + + (* Basic rewrites *) + + let ths = + [ + UNDISCH_ALL (INST_TYPE [`:num`, aty] (SPEC_ALL COMPONENTS_HYPERMAP_OF_LIST)); + ] in + let r1 = REWRITE_RULE ths r0 in + + (* Further rewrites *) + let r2 = REWRITE_RULE[darts_of_list; IN_SET_OF_LIST; ALL_MEM] r1 in + r2;; + + + +(***********************) + + +(* + +let get_ineq str = Hashtbl.find constraints str;; + + + +let th = gen_general_ineq (get_ineq "ineq122");; +let th = gen_general_ineq (get_ineq "sol_sum3");; +let th = gen_general_ineq (get_ineq "tau_sum");; +let th = gen_general_ineq (get_ineq "edge_sym");; +let th = gen_general_ineq (get_ineq "ln_def");; +let th = gen_general_ineq (get_ineq "y1_def");; +let th = gen_general_ineq (get_ineq "y2_def");; +let th = gen_general_ineq (get_ineq "y3_def");; +let th = gen_general_ineq (get_ineq "y4_def");; +let th = gen_general_ineq (get_ineq "y5_def");; +let th = gen_general_ineq (get_ineq "y6_def");; +let th = gen_general_ineq (get_ineq "y8_def");; +let th = gen_general_ineq (get_ineq "y9_def");; +let th = gen_general_ineq (get_ineq "RHB");; + + + +let test_list = ref [];; + +let iter_f name ineq = + try + test_list := gen_general_ineq ineq :: !test_list + with x -> + print_string ("problems: "^name^"; ");; + + +Hashtbl.iter iter_f constraints;; + + + + +(********************************) + +let ineq = get_ineq "tau_sum3";; + +let iso_th = gen_iso_thm ineq;; + (* General rewrites before specifying hypermaps *) +let th0 = UNDISCH_ALL (REWRITE_RULE[GSYM IMP_IMP] iso_th);; +let gen_var, rtm = dest_forall(concl th0);; +let ants = lhand rtm;; +let set = rand ants;; +let th1 = UNDISCH_ALL (SPEC_ALL th0);; + +let th_rule th = UNDISCH_ALL (SPEC_ALL (UNDISCH_ALL (SPEC_ALL th)));; + +let ths = [ + th_rule SUM_NODE_ISO; + th_rule CARD_NODE_ISO; + th_rule SUM_FACE_ISO; + th_rule CARD_FACE_ISO; + th_rule COMPONENTS_ISO_IMAGE; + th_rule HYPERMAP_MAPS_ISO_IMAGE; + th_rule HYPERMAP_INV_MAPS_ISO_IMAGE; + th_rule HYPERMAP_MAPS_ISO_COMM; + th_rule HYPERMAP_INV_MAPS_ISO_COMM; + SUB_CONST_o; ETA_AX; + th_rule SUM_FACE_SUB_CONST; +];; + +let th2' = REWRITE_RULE ths th1;; +let th2 = + if (Hashtbl.mem table_set_hyp set) then + PROVE_HYP (Hashtbl.find table_set_hyp set) th2' + else + th2';; + + + let th3 = GEN gen_var (DISCH ants th2);; + + let s0 = th3;; + + (* G -> hypermap_of_list (L:((num)list)list) *) + (* Instantiate correct types *) + let s1 = INST_TYPE [`:real^3#real^3`, aty; `:num#num`, bty] s0;; + let s2 = INST[`hypermap_of_list (L:((num)list)list)`, `G:(num#num)hypermap`] s1;; + + let th_rule = (UNDISCH_ALL o INST_TYPE [`:num`, aty] o SPEC_ALL o REWRITE_RULE[GSYM IMP_IMP]);; + + let ths = map th_rule in_all_rewrites;; + + let s3 = REWRITE_RULE ths s2;; + + let gen_var2, rtm = dest_forall(concl s3);; + let ants2 = lhand rtm;; + + let s4 = UNDISCH_ALL (SPEC_ALL s3);; + + let ths = + [ + th_rule CARD_SET_OF_LIST_FACE; + th_rule CARD_SET_OF_LIST_NODE; + ];; + + let s5 = REWRITE_RULE ths s4;; + let s6 = GEN gen_var2 (DISCH ants2 s5);; + + (* Deal with basic variables *) + let s7 = INST var_list s6;; + let s8 = INST[`ESTD V`, `E:(real^3->bool)->bool`] s7;; + let s9 = REWRITE_RULE list_var_rewrites s8;; + let r0 = s9;; + + (* Basic rewrites *) + + let ths = + [ + UNDISCH_ALL (INST_TYPE [`:num`, aty] (SPEC_ALL COMPONENTS_HYPERMAP_OF_LIST)); + ];; + let r1 = REWRITE_RULE ths r0;; + + (* Further rewrites *) + let r2 = REWRITE_RULE[darts_of_list; IN_SET_OF_LIST; ALL_MEM] r1 + r2;; + + + +*) + +(*********************************************************) + +(* Integral approximation of inequalities and equalities *) + +let neg_op_real = `(--):real->real` and + le_op_real = `(<=):real->real->bool` and + lt_op_real = `(<):real->real->bool` and + ge_op_real = `(>=):real->real->bool` and + plus_op_real = `(+):real->real->real` and + mul_op_real = `( * ):real->real->real`;; + +let mk_decimal (n,m) = + let tm = mk_comb(mk_comb(`DECIMAL`, mk_numeral (abs_num n)), mk_numeral m) in + if (n []) then inst_th sum_th1 else inst_th sum_th2 in + let th2 = split_sum_raw_conv (rand(concl th1)) in + TRANS th1 th2 + else + let inst_th = INST[xy_tm, x_var_real; b_tm, b_var_real; c_tm, c_var_real] in + if (frees xy_tm <> []) then inst_th sum_th1' else inst_th sum_th2' in + + let th0 = INST[tm, x_var_real] sum_th0 in + let th1 = split_sum_raw_conv (rand(concl th0)) in + TRANS th0 th1;; + + + +let rearrange_mul_conv tm = + let rec dest_mul tm = + if (is_binop mul_op_real tm) then + let lhs, rhs = dest_binop mul_op_real tm in + let cs, vars = dest_mul rhs in + if (frees lhs = []) then + lhs::cs, vars + else + cs, lhs::vars + else + if (frees tm = []) then + [tm], [] + else + [], [tm] in + let mk_mul list = + if (list = []) then failwith "rearrange_mul: empty list" + else itlist (fun l r -> mk_binop mul_op_real l r) (tl list) (hd list) in + + let cs, vars = dest_mul tm in + let cs_mul, vars_mul = mk_mul cs, mk_mul vars in + let t = mk_eq(tm, mk_binop mul_op_real cs_mul vars_mul) in + EQT_ELIM (REWRITE_CONV[REAL_MUL_AC] t);; + + + +let le_add_th = REAL_ARITH `x + y <= b + c <=> x - b <= c - y:real`;; + +(* Moves everything with free variables on the left and performs basic reductions *) +let ineq_rewrite_conv = REWRITE_CONV[real_ge; real_div; DECIMAL] THENC + LAND_CONV REAL_POLY_CONV THENC RAND_CONV REAL_POLY_CONV THENC + LAND_CONV split_sum_conv THENC RAND_CONV split_sum_conv THENC + ONCE_REWRITE_CONV[le_add_th] THENC + LAND_CONV REAL_POLY_CONV THENC RAND_CONV REAL_POLY_CONV THENC + REWRITE_CONV[GSYM real_div] THENC + ONCE_DEPTH_CONV rearrange_mul_conv;; + + +(* Approximation *) + +let le_mul1_th = REAL_ARITH `!x. &1 * x <= x`;; +let ge_mul1_th = REAL_ARITH `!x. x <= &1 * x`;; +let INTERVAL_LO = prove(`interval_arith x (a,b) ==> a <= x`, SIMP_TAC[interval_arith]);; +let INTERVAL_HI = prove(`interval_arith x (a,b) ==> x <= b`, SIMP_TAC[interval_arith]);; + +let rec low_approx tm precision = + let low_approx1 tm precision = + if (is_binop mul_op_real tm && frees tm <> []) then + let c, var = dest_binop mul_op_real tm in + let interval_th = approx_interval (create_interval c) precision in + let l_th = MATCH_MP INTERVAL_LO interval_th in + let a, b = dest_binop le_op_real (concl l_th) in + (PROVE_HYP l_th o UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o SPECL[a; b; var]) REAL_LE_RMUL + else + if (frees tm = []) then + MATCH_MP INTERVAL_LO (approx_interval (create_interval tm) precision) + else + SPEC tm le_mul1_th in + + if (is_binop plus_op_real tm && frees tm <> []) then + let lhs, rhs = dest_binop plus_op_real tm in + let l_th = low_approx1 lhs precision in + let r_th = low_approx rhs precision in + MATCH_MP REAL_LE_ADD2 (CONJ l_th r_th) + else + low_approx1 tm precision;; + + +let rec hi_approx tm precision = + let hi_approx1 tm precision = + if (is_binop mul_op_real tm && frees tm <> []) then + let c, var = dest_binop mul_op_real tm in + let interval_th = approx_interval (create_interval c) precision in + let h_th = MATCH_MP INTERVAL_HI interval_th in + let a, b = dest_binop le_op_real (concl h_th) in + (PROVE_HYP h_th o UNDISCH_ALL o REWRITE_RULE[GSYM IMP_IMP] o SPECL[a; b; var]) REAL_LE_RMUL + else + if (frees tm = []) then + MATCH_MP INTERVAL_HI (approx_interval (create_interval tm) precision) + else + SPEC tm ge_mul1_th in + + if (is_binop plus_op_real tm && frees tm <> []) then + let lhs, rhs = dest_binop plus_op_real tm in + let l_th = hi_approx1 lhs precision in + let r_th = hi_approx rhs precision in + MATCH_MP REAL_LE_ADD2 (CONJ l_th r_th) + else + hi_approx1 tm precision;; + + + +let approx_le_ineq precision tm = + let lhs, rhs = dest_binop le_op_real tm in + let lhs_th = low_approx lhs precision in + let rhs_th = hi_approx rhs precision in + let ll, lr = dest_binop le_op_real (concl lhs_th) in + let rl, rr = dest_binop le_op_real (concl rhs_th) in + + let th0 = ASSUME tm in + let th1 = SPECL[ll; lr; rhs] REAL_LE_TRANS in + let th2 = SPECL[ll; rhs; rr] REAL_LE_TRANS in + let s1 = MATCH_MP th1 (CONJ lhs_th th0) in + MATCH_MP th2 (CONJ s1 rhs_th);; + + +let integer_approx_le_ineq precision ineq = + let lhs, rhs = dest_binop le_op_real ineq in + let m = (Int 10 **/ Int precision) in + let m_num, m_real = mk_numeral m, term_of_rat m in + let m_pos = SPEC m_num REAL_POS in + let mul_th = SPECL[m_real; lhs; rhs] REAL_LE_LMUL in + let th0 = MATCH_MP mul_th (CONJ m_pos (ASSUME ineq)) in + let th1 = (CONV_RULE ineq_rewrite_conv) th0 in + let approx = approx_le_ineq 0 (concl th1) in + PROVE_HYP th1 approx;; + + +let create_approximations precision_list ineq = + let ineq_th = ineq_rewrite_conv ineq in + let rhs = rand(concl ineq_th) in + let th0 = CONV_RULE (LAND_CONV (REWRITE_CONV[DECIMAL] THENC REAL_POLY_CONV)) + (approx_le_ineq 8 rhs) in + + let int_approx p = + let th1 = integer_approx_le_ineq p (concl th0) in + let th2 = PROVE_HYP th0 th1 in + let th3 = DISCH rhs th2 in + REWRITE_RULE[GSYM ineq_th] th3 in + + map int_approx precision_list;; + +(**********************************) + + +(* +let tm = `(&34/ &13 + pi/sol0)* x + &2 + -- &14 / &3 * z <= pi + rho218 + z * sol0 - u / &1000`;; +create_approximations [3;4;5] tm;; +*) + + +(*************************) + +(* Additional step for generalizing hypotheses *) + + +let LIST_SUM_LMUL = prove(`!(f:A->real) c n. list_sum n (\x. c * f x) = c * list_sum n f`, + GEN_TAC THEN GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[list_sum; ITLIST; REAL_MUL_RZERO] THEN + ASM_REWRITE_TAC[GSYM list_sum; REAL_ADD_LDISTRIB]);; + + +let le_hyp_gen = prove(`!f y. (!x. &0 <= f x) ==> &0 <= f y`, SIMP_TAC[]);; +let le_list_sum_hyp_gen = prove(`!(f:A->real) n. (!x. &0 <= f x) ==> &0 <= list_sum n f`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[list_sum] THEN + SPEC_TAC (`n:(A)list`, `n:(A)list`) THEN + LIST_INDUCT_TAC THEN REWRITE_TAC[ITLIST; REAL_LE_REFL] THEN + MATCH_MP_TAC REAL_LE_ADD THEN + ASM_REWRITE_TAC[]);; + + + +let generalize_hyp th = + let gen_hyp = fun tm -> + let fn, arg = dest_comb (rand tm) in + if (is_comb fn && is_const (rator fn) && (fst o dest_const o rator) fn = "list_sum") then + let f, n = arg, rand fn in + UNDISCH_ALL (ISPECL[f; n] le_list_sum_hyp_gen) + else + UNDISCH_ALL (ISPECL[fn; arg] le_hyp_gen) in + + let hyp_ths = map gen_hyp (hyp th) in + itlist PROVE_HYP hyp_ths th;; + + +(* +let tm = `list_sum n (\x. s x * r) + &1 / &3 * (azim_dart (V,E) o g) x <= pi`;; +let ths = create_approximations [3] tm;; +map generalize_hyp ths;; +*) + + +(*******************************) + + +let generate_ineqs precision_list ineq = + + let create_approxs original_th precision_list = + let var, ineq = (dest_abs o rand o rator o concl) original_th in + let final_step = fun approx_th -> + let p_tm', q_tm' = dest_imp (concl approx_th) in + let p_tm, q_tm = mk_abs(var, p_tm'), mk_abs(var, q_tm') in + let list_tm = (rand o concl) original_th in + let mono_th = BETA_RULE (ISPECL[p_tm; q_tm; list_tm] (GEN_ALL MONO_ALL)) in + let s1 = MATCH_MP mono_th (GEN var approx_th) in + MATCH_MP s1 original_th in + + let approx_ths0 = map generalize_hyp (create_approximations precision_list ineq) in + let approx_ths1 = map (itlist PROVE_HYP list_var_pos) approx_ths0 in + let approx_ths = map (REWRITE_RULE[GSYM LIST_SUM_LMUL]) approx_ths1 in + map final_step approx_ths in + + + let ineq_th = gen_general_ineq ineq in + let ineq = (snd o dest_abs o rand o rator o concl) ineq_th in + if (is_eq ineq) then + let eq_th = REWRITE_RULE[GSYM REAL_LE_ANTISYM; GSYM AND_ALL] ineq_th in + let ths1 = create_approxs (CONJUNCT1 eq_th) precision_list in + let ths2 = create_approxs (CONJUNCT2 eq_th) precision_list in + ths1, ths2 + else + create_approxs ineq_th precision_list, [];; + + + + +(*********************************************************************) + +(* Table containing all inequalities *) +let ineq_table = Array.init 6 (fun i -> Hashtbl.create 10);; +let ineq_test_table = Array.init 6 (fun i -> Hashtbl.create 10);; + + + +let DECIMAL_INT = prove(`!n. DECIMAL n 1 = &n`, REWRITE_TAC[DECIMAL; REAL_DIV_1]);; + + +let add_everything_to_table table = + let add_approximations_to_table = fun name ineq -> + let approxs', neg_approxs' = generate_ineqs [3;4;5] ineq in + let approxs = zip (3--5) approxs' in + let neg_approxs = if (neg_approxs' = []) then [] else zip (3--5) neg_approxs' in + let r = CONV_RULE (REWRITE_CONV[DECIMAL_INT] THENC DEPTH_CONV Arith_hash.NUMERAL_TO_NUM_CONV) in + let _ = map (fun (i, t) -> Hashtbl.add (ineq_test_table.(i)) name t; + Hashtbl.add (ineq_table.(i)) name (r t)) approxs in + let _ = map (fun (i, t) -> Hashtbl.add (ineq_test_table.(i)) (name^"_neg") t; + Hashtbl.add (ineq_table.(i)) (name^"_neg") (r t)) neg_approxs in + () in + + Hashtbl.iter (fun name ineq -> add_approximations_to_table name ineq) table;; + + +let find_ineq precision name = Hashtbl.find ineq_table.(precision) name;; +let find_test_ineq precision name = Hashtbl.find ineq_test_table.(precision) name;; + + + +(* Generate and add inequalities for constraints *) +add_everything_to_table constraints;; +add_everything_to_table var_bound_ineqs;; + + +(**************************) + + +(* +generate_ineqs [4] (get_ineq "ineq112");; + +Hashtbl.iter (fun name ineq -> let _ = generate_ineqs[3;4;5] ineq in ()) constraints;; +*) + +(***************) +(*********************) + diff --git a/formal_lp/old/ineqs/list_conversions.hl b/formal_lp/old/ineqs/list_conversions.hl new file mode 100644 index 0000000..d485762 --- /dev/null +++ b/formal_lp/old/ineqs/list_conversions.hl @@ -0,0 +1,531 @@ +needs "../formal_lp/ineqs/list_hypermap_defs.hl";; + +#load "unix.cma";; +(* +itlist_conv_univ;; +el_conv;; +*) + +let test n f x = + let start = Unix.gettimeofday() in + for i = 1 to n do + let _ = f x in () + done; + Unix.time() -. start;; + + + +let t_const = `T` and + f_const = `F`;; + +let MY_PROVE_HYP hyp th = EQ_MP (DEDUCT_ANTISYM_RULE hyp th) hyp;; + + + +(******************************) + +(* HD conversions *) + +let HD_A_CONS = prove(`HD (CONS (h:A) t) = h`, REWRITE_TAC[HD]);; + +let hd_conv tm = + let h_tm', t_tm = dest_comb(rand tm) in + let h_tm = rand h_tm' in + let list_ty = type_of t_tm in + let ty = type_of h_tm in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", list_ty) in + INST[h_tm, h_var; t_tm, t_var] (INST_TYPE[ty, aty] HD_A_CONS);; + +(* +let tm = `HD [1;2;3;4]`;; +(* 0.072 *) +test 1000 (REWRITE_CONV[HD]) tm;; +(* 0.016 *) +test 1000 hd_conv tm;; +*) + + + + + + + + +(*******************************) + +(* FST, SND conversions *) + + +let FST' = ISPECL[`x:A`; `y:B`] FST;; +let SND' = ISPECL[`x:A`; `y:B`] SND;; + + +let fst_conv tm = + let x_tm, y_tm = dest_pair (rand tm) in + let x_ty, y_ty = type_of x_tm, type_of y_tm in + let x_var, y_var = mk_var("x", x_ty), mk_var("y", y_ty) in + (INST[x_tm, x_var; y_tm, y_var] o INST_TYPE[x_ty, aty; y_ty, bty]) FST';; + +let snd_conv tm = + let x_tm, y_tm = dest_pair (rand tm) in + let x_ty, y_ty = type_of x_tm, type_of y_tm in + let x_var, y_var = mk_var("x", x_ty), mk_var("y", y_ty) in + (INST[x_tm, x_var; y_tm, y_var] o INST_TYPE[x_ty, aty; y_ty, bty]) SND';; + + +(* +let tm = `FST (1,2)`;; +fst_conv tm;; + +(* 0.688 *) +test 10000 (REWRITE_CONV[]) tm;; +(* 0.100 *) +test 10000 fst_conv tm;; +*) + + +(******************************) + +(* LENGTH conversions *) + +let LENGTH_A_EMPTY = prove(`LENGTH ([]:(A)list) = 0`, REWRITE_TAC[LENGTH]) and + LENGTH_A_CONS = prove(`LENGTH (CONS (h:A) t) = SUC (LENGTH t)`, REWRITE_TAC[LENGTH]);; + +let suc_const = `SUC`;; + + +let length_conv_univ suc_conv tm = + let list_tm = rand tm in + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let inst_t = INST_TYPE[ty, aty] in + let length_empty, length_cons = inst_t LENGTH_A_EMPTY, inst_t LENGTH_A_CONS in + let h_var, t_var = mk_var("h", ty), mk_var("t", list_ty) in + + let rec length_conv_raw = fun list_tm -> + if (is_comb list_tm) then + let ltm, t_tm = dest_comb list_tm in + let h_tm = rand ltm in + let th0 = INST[h_tm, h_var; t_tm, t_var] length_cons in + let th1' = length_conv_raw t_tm in + let th1 = AP_TERM suc_const th1' in + let th2 = suc_conv (rand(concl th1)) in + TRANS (TRANS th0 th1) th2 + else + length_empty in + + length_conv_raw list_tm;; + + +(* +let tm = `LENGTH [&1;&4;&4;&6;&7 * &8]`;; + +test 1000 (REWRITE_CONV[LENGTH; ARITH_SUC]) tm;; (* 0.792 *) +test 1000 (length_conv_univ NUM_SUC_CONV) tm;; (* 0.104 *) +*) + + +(******************************) + +(* MEM conversions *) + +let MEM_A_EMPTY = prove(`MEM (x:A) [] <=> F`, REWRITE_TAC[MEM]) and + MEM_A_HD = UNDISCH_ALL (prove(`(x = h <=> T) ==> (MEM (x:A) (CONS h t) <=> T)`,SIMP_TAC[MEM])) and + MEM_A_TL = UNDISCH_ALL (prove(`(x = h <=> F) ==> (MEM (x:A) (CONS h t) <=> MEM x t)`, SIMP_TAC[MEM]));; + + + + +let rec mem_conv_univ eq_conv tm = + let ltm, list_tm = dest_comb tm in + let x_tm = rand ltm in + let ty = type_of x_tm in + let inst_t = INST_TYPE[ty, aty] in + let mem_empty, mem_hd, mem_tl = inst_t MEM_A_EMPTY, inst_t MEM_A_HD, inst_t MEM_A_TL in + let x_var, h_var = mk_var("x", ty), mk_var("h", ty) in + let t_var = mk_var("t", mk_type("list", [ty])) in + + let rec mem_conv_raw list_tm = + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let eq_th = eq_conv (mk_eq(x_tm, h_tm)) in + if (rand(concl eq_th) = t_const) then + let th0' = INST[x_tm, x_var; h_tm, h_var; t_tm, t_var] mem_hd in + MY_PROVE_HYP eq_th th0' + else + let th0' = INST[x_tm, x_var; h_tm, h_var; t_tm, t_var] mem_tl in + let th0 = MY_PROVE_HYP eq_th th0' in + let th1 = mem_conv_raw t_tm in + TRANS th0 th1 + else + INST[x_tm, x_var] mem_empty in + + mem_conv_raw list_tm;; + + +(* +let tm = `MEM 11 [1;2;3;4;5;6;4;5;6;7;3;4;4;6;8;9;10]`;; +mem_conv_univ (PURE_REWRITE_CONV[ARITH_EQ]) tm;; + +test 100 (mem_conv_univ (REWRITE_CONV[ARITH_EQ])) tm;; (* 0.176 *) +test 100 (REWRITE_CONV[MEM; ARITH_EQ]) tm;; (* 0.352 *) +*) + + +(**********************************) + +(* FILTER conversions *) + +let FILTER_A_EMPTY = prove(`FILTER (P:A->bool) [] = []`, REWRITE_TAC[FILTER]) and + FILTER_A_HD = UNDISCH_ALL (prove(`(P h <=> T) ==> FILTER (P:A->bool) (CONS h t) = CONS h (FILTER P t)`, SIMP_TAC[FILTER])) and + FILTER_A_TL = UNDISCH_ALL (prove(`(P h <=> F) ==> FILTER (P:A->bool) (CONS h t) = FILTER P t`, SIMP_TAC[FILTER]));; + + + +let filter_conv_univ p_conv tm = + let ltm, list_tm = dest_comb tm in + let p_tm = rand ltm in + let p_ty = type_of p_tm in + let ty = (hd o snd o dest_type) p_ty in + let inst_t = INST_TYPE[ty, aty] in + let filter_empty, filter_hd, filter_tl = + inst_t FILTER_A_EMPTY, inst_t FILTER_A_HD, inst_t FILTER_A_TL in + let p_var = mk_var("P", p_ty) in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", mk_type("list",[ty])) in + + let rec filter_conv_raw = fun list_tm -> + if (is_comb list_tm) then + let ltm, t_tm = dest_comb list_tm in + let h_tm = rand ltm in + let p_th = p_conv (mk_comb(p_tm, h_tm)) in + if (rand(concl p_th) = t_const) then + let th0' = INST[p_tm, p_var; h_tm, h_var; t_tm, t_var] filter_hd in + let th0 = MY_PROVE_HYP p_th th0' in + let ltm = rator(rand(concl th0)) in + let th1 = filter_conv_raw t_tm in + TRANS th0 (AP_TERM ltm th1) + else + let th0' = INST[p_tm, p_var; h_tm, h_var; t_tm, t_var] filter_tl in + let th0 = MY_PROVE_HYP p_th th0' in + let th1 = filter_conv_raw t_tm in + TRANS th0 th1 + else + INST[p_tm, p_var] filter_empty in + + filter_conv_raw list_tm;; + + + + +(* +let tm = `FILTER (\n. n = 2 \/ n = 3) [1;2;3;4;2;3;1]`;; + +REWRITE_CONV[FILTER; ARITH_EQ] tm;; +filter_conv_univ (REWRITE_CONV[ARITH_EQ]) tm;; + +test 100 (REWRITE_CONV[FILTER; ARITH_EQ]) tm;; (* 7.596 *) +test 100 (filter_conv_univ (REWRITE_CONV[ARITH_EQ])) tm;; (* 0.236 *) +*) + +(***************************) + +(* FLATTEN conversions *) + +let FLATTEN_A_EMPTY = prove(`FLATTEN ([]:((A)list)list) = []`, REWRITE_TAC[FLATTEN; ITLIST; APPEND]) and + FLATTEN_A_CONS_EMPTY = prove(`FLATTEN (CONS ([]:(A)list) tt) = FLATTEN tt`, REWRITE_TAC[FLATTEN; ITLIST; APPEND]) and + FLATTEN_A_CONS_CONS = prove(`FLATTEN (CONS (CONS (h:A) t) tt) = CONS h (FLATTEN (CONS t tt))`, REWRITE_TAC[FLATTEN; ITLIST; APPEND]);; + + + +(* Works for any list of lists *) +let flatten_conv_univ tm = + let list_list_tm = rand tm in + let list_list_ty = type_of list_list_tm in + let list_ty = (hd o snd o dest_type) list_list_ty in + let ty = (hd o snd o dest_type) list_ty in + let inst_t = INST_TYPE[ty, aty] in + let flatten_empty, flatten_cons_empty, flatten_cons_cons = + inst_t FLATTEN_A_EMPTY, inst_t FLATTEN_A_CONS_EMPTY, inst_t FLATTEN_A_CONS_CONS in + let tt_var = mk_var("tt", list_list_ty) in + let t_var = mk_var("t", list_ty) in + let h_var = mk_var("h", ty) in + + let rec flatten_conv_raw list_list_tm = + if (is_comb list_list_tm) then + let hh_tm', tt_tm = dest_comb list_list_tm in + let hh_tm = rand hh_tm' in + if (is_comb hh_tm) then + let h_tm', t_tm = dest_comb hh_tm in + let h_tm = rand h_tm' in + let th0 = INST[h_tm, h_var; t_tm, t_var; tt_tm, tt_var] flatten_cons_cons in + let ltm, rtm = dest_comb(rand(concl th0)) in + let th1 = AP_TERM ltm (flatten_conv_raw (rand rtm)) in + TRANS th0 th1 + else + let th0 = INST[tt_tm, tt_var] flatten_cons_empty in + let th1 = flatten_conv_raw tt_tm in + TRANS th0 th1 + else + flatten_empty in + + flatten_conv_raw list_list_tm;; + + +(* +let tm = `FLATTEN [[1;2;3];[3];[4;5;2;1;6;7]]`;; +flatten_conv_univ tm;; +REWRITE_CONV[FLATTEN; ITLIST; APPEND] tm;; + +test 100 (REWRITE_CONV[FLATTEN; ITLIST; APPEND]) tm;; (* 0.348 *) +test 100 (flatten_conv_univ) tm;; (* 0.028 *) +*) + + +(***************************) + +(* MAP conversions *) + + +let MAP_AB_EMPTY = prove(`MAP (f:A->B) [] = []`, REWRITE_TAC[MAP]) and + MAP_AB_CONS = prove(`MAP (f:A->B) (CONS h t) = CONS (f h) (MAP f t)`, REWRITE_TAC[MAP]);; + + +let map_conv_univ f_conv tm = + let ltm, list_tm = dest_comb tm in + let ftm = rand ltm in + let ftm_ty = type_of ftm in + let f_var = mk_var("f", ftm_ty) in + let [a_type; b_type] = snd(dest_type ftm_ty) in + let h_var = mk_var("h", a_type) in + let t_var = mk_var("t", mk_type("list", [a_type])) in + let inst_t = INST[ftm, f_var] o INST_TYPE[a_type, aty; b_type, bty] in + let map_empty, map_cons = + inst_t MAP_AB_EMPTY, inst_t MAP_AB_CONS in + + let rec map_conv_raw list_tm = + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let th0 = INST[h_tm, h_var; t_tm, t_var] map_cons in + let ltm, rtm = dest_comb (rand(concl th0)) in + let cons_tm, f_h_tm = dest_comb ltm in + let f_h_th = f_conv f_h_tm in + let map_t_th = map_conv_raw t_tm in + TRANS th0 (MK_COMB (AP_TERM cons_tm f_h_th, map_t_th)) + else + map_empty in + + map_conv_raw list_tm;; + + +(* +let tm = `MAP (\x. x + 1) [1;2;3;4;5;6;7;8;9;10;11]`;; + +REWRITE_CONV[MAP] tm;; +map_conv_univ BETA_CONV tm;; + +test 100 (REWRITE_CONV[MAP]) tm;; (* 0.464 *) +test 100 (map_conv_univ BETA_CONV) tm;; (* 0.04 *) + +test 100 (map_conv_univ (BETA_CONV THENC NUM_ADD_CONV)) tm;; (* 0.096 *) +*) + + +(*****************************************) + +(* ALL rules *) + + +let ALL_A_HD = UNDISCH_ALL(prove(`ALL (P:A->bool) (CONS h t) ==> P h`, SIMP_TAC[ALL])) and + ALL_A_TL = UNDISCH_ALL(prove(`ALL (P:A->bool) (CONS h t) ==> ALL P t`, SIMP_TAC[ALL]));; + + +(* Given a theorem `ALL P list` returns the list of theorems (P x1),...,(P xn) *) +let get_all th = + let ltm, list_tm = dest_comb (concl th) in + let p_tm = rand ltm in + let list_ty = type_of list_tm in + let p_ty = type_of p_tm in + let ty = (hd o snd o dest_type) list_ty in + let p_var = mk_var("P", p_ty) in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", list_ty) in + + let inst_t = INST[p_tm, p_var] o INST_TYPE[ty, aty] in + let all_hd, all_tl = inst_t ALL_A_HD, inst_t ALL_A_TL in + + let rec get_all_raw all_th list_tm = + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let inst_t = INST[h_tm, h_var; t_tm, t_var] in + let th_tl = MY_PROVE_HYP all_th (inst_t all_tl) in + let th_hd = MY_PROVE_HYP all_th (inst_t all_hd) in + th_hd :: get_all_raw th_tl t_tm + else + [] in + + get_all_raw th list_tm;; + + + +(* Given a theorem `ALL P list`, returns (P x_i1),..., (P x_in) + where i1,...,in are given indices. + The list of indices should be sorted *) +let select_all th indices = + let ltm, list_tm = dest_comb (concl th) in + let p_tm = rand ltm in + let list_ty = type_of list_tm in + let p_ty = type_of p_tm in + let ty = (hd o snd o dest_type) list_ty in + let p_var = mk_var("P", p_ty) in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", list_ty) in + + let inst_t = INST[p_tm, p_var] o INST_TYPE[ty, aty] in + let all_hd, all_tl = inst_t ALL_A_HD, inst_t ALL_A_TL in + + let rec get_all_raw all_th list_tm indices n = + match indices with + [] -> [] + | i::is -> + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let inst_t = INST[h_tm, h_var; t_tm, t_var] in + let th_tl = MY_PROVE_HYP all_th (inst_t all_tl) in + + if (i - n = 0) then + let th_hd = MY_PROVE_HYP all_th (inst_t all_hd) in + th_hd :: get_all_raw th_tl t_tm is (n + 1) + else + get_all_raw th_tl t_tm (i::is) (n + 1) in + + get_all_raw th list_tm indices 0;; + + +(* +let tm = `ALL (\x. x > 3) [4; 5; 8; 10; 5; 4]`;; +let th = (EQT_ELIM o REWRITE_CONV[ALL; ARITH]) tm;; + +(* 0.192 *) +test 100 (CONJUNCTS o REWRITE_RULE[ALL]) th;; +(* 0.016 *) +test 100 (get_all) th;; +(* 0.012 *) +test 100 (select_all th) [2;3;4];; +*) + + + +(*************************************) + +(* list_sum conversions *) + + +let LIST_SUM_A_EMPTY = prove(`list_sum [] (f:A->real) = &0`, REWRITE_TAC[list_sum; ITLIST]) and + LIST_SUM_A_H = prove(`list_sum [h:A] f = f h`, REWRITE_TAC[list_sum; ITLIST; REAL_ADD_RID]) and + LIST_SUM_A_CONS = prove(`list_sum (CONS (h:A) t) f = f h + list_sum t f`, REWRITE_TAC[list_sum; ITLIST]);; + + +let list_sum_conv f_conv tm = + let ltm, f_tm = dest_comb tm in + let list_tm = rand ltm in + let list_ty = type_of list_tm in + let f_ty = type_of f_tm in + let ty = (hd o snd o dest_type) list_ty in + let f_var = mk_var("f", f_ty) and + h_var = mk_var("h", ty) and + t_var = mk_var("t", list_ty) in + let inst_t = INST[f_tm, f_var] o INST_TYPE[ty, aty] in + let list_sum_h = inst_t LIST_SUM_A_H and + list_sum_cons = inst_t LIST_SUM_A_CONS in + + let rec list_sum_conv_raw = fun h_tm t_tm -> + if (is_comb t_tm) then + let h_tm', t_tm' = dest_comb t_tm in + let th0 = INST[h_tm, h_var; t_tm, t_var] list_sum_cons in + let ltm, rtm = dest_comb(rand(concl th0)) in + let plus_op, fh_tm = dest_comb ltm in + let f_th = f_conv fh_tm in + let th1 = list_sum_conv_raw (rand h_tm') t_tm' in + let th2 = MK_COMB(AP_TERM plus_op f_th, th1) in + TRANS th0 th2 + else + let th0 = INST[h_tm, h_var] list_sum_h in + let f_th = f_conv (rand(concl th0)) in + TRANS th0 f_th in + + if (is_comb list_tm) then + let h_tm, t_tm = dest_comb list_tm in + list_sum_conv_raw (rand h_tm) t_tm + else + inst_t LIST_SUM_A_EMPTY;; + + + + +(* +let tm = `list_sum [&1; &3; &4; pi; #0.1] cos`;; + +list_sum_conv ALL_CONV tm;; + +(* 2.812 *) +test 1000 (REWRITE_CONV[list_sum; ITLIST; REAL_ADD_RID]) tm;; +(* 0.076 *) +test 1000 (list_sum_conv ALL_CONV) tm;; + + +let tm = `list_sum [&1; &3; &4; pi; #0.1] (\x. cos x)`;; +(* 0.104 *) +test 1000 (list_sum_conv BETA_CONV) tm;; +*) + + + +(*****************************************) + +(* set_of_list conversions *) + +let SET_OF_LIST_A_EMPTY = prove(`set_of_list ([]:(A)list) = {}`, REWRITE_TAC[set_of_list]) and + SET_OF_LIST_A_H = prove(`set_of_list [h:A] = {h}`, REWRITE_TAC[set_of_list]) and + SET_OF_LIST_A_CONS = prove(`set_of_list (CONS (h:A) t) = h INSERT set_of_list t`, REWRITE_TAC[set_of_list]);; + + + +let set_of_list_conv tm = + let list_tm = rand tm in + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", list_ty) in + let inst_t = INST_TYPE[ty, aty] in + let set_of_list_h, set_of_list_cons = inst_t SET_OF_LIST_A_H, inst_t SET_OF_LIST_A_CONS in + + let rec set_of_list_conv_raw = fun h_tm t_tm -> + if (is_comb t_tm) then + let h_tm', t_tm' = dest_comb t_tm in + let th0 = INST[h_tm, h_var; t_tm, t_var] set_of_list_cons in + let ltm, rtm = dest_comb(rand(concl th0)) in + TRANS th0 (AP_TERM ltm (set_of_list_conv_raw (rand h_tm') t_tm')) + else + INST[h_tm, h_var] set_of_list_h in + + if (is_comb list_tm) then + let h_tm, t_tm = dest_comb list_tm in + set_of_list_conv_raw (rand h_tm) t_tm + else + inst_t SET_OF_LIST_A_EMPTY;; + + + +(* +let tm = `set_of_list [&1; &5; &6; &3; &5; &8; &9]`;; + +(* 0.872 *) +test 1000 (REWRITE_CONV[set_of_list]) tm;; +(* 0.076 *) +test 1000 set_of_list_conv tm;; +*) diff --git a/formal_lp/old/ineqs/list_hypermap.hl b/formal_lp/old/ineqs/list_hypermap.hl new file mode 100644 index 0000000..ffc82dc --- /dev/null +++ b/formal_lp/old/ineqs/list_hypermap.hl @@ -0,0 +1,2514 @@ +needs "../formal_lp/hypermap/list_hypermap_defs.hl";; + + +open Sphere;; +(* For IMAGE_LEMMA *) +open Hypermap_and_fan;; + +let REMOVE_ASSUM = POP_ASSUM (fun th -> ALL_TAC);; + +let IN_TRANS = prove(`!(x:A) s t. t SUBSET s /\ x IN t ==> x IN s`, + SET_TAC[]);; + +let LENGTH_ZIP = prove(`!(l1:(A)list) (l2:(B)list). LENGTH l1 = LENGTH l2 ==> LENGTH (ZIP l1 l2) = LENGTH l1`, + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[LENGTH; ZIP; NOT_SUC; GSYM NOT_SUC] THEN + REWRITE_TAC[SUC_INJ] THEN + DISCH_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]);; + + + +let MEM_ZIP = prove(`!(i:A) (j:B) l1 l2. LENGTH l1 = LENGTH l2 /\ MEM (i,j) (ZIP l1 l2) ==> MEM i l1 /\ MEM j l2`, + GEN_TAC THEN GEN_TAC THEN + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[LENGTH; ZIP; MEM; NOT_SUC; GSYM NOT_SUC] THEN + REWRITE_TAC[SUC_INJ; PAIR_EQ] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `t':(B)list`) THEN + ASM_SIMP_TAC[]);; + + +let EL_ZIP = prove(`!(l1:(A)list) (l2:(B)list) i. LENGTH l1 = LENGTH l2 /\ i < LENGTH l1 ==> EL i (ZIP l1 l2) = (EL i l1, EL i l2)`, + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[LENGTH; ZIP; LT; NOT_SUC; SUC_INJ] THEN + POP_ASSUM (fun th -> ALL_TAC) THEN GEN_TAC THEN + REWRITE_TAC[GSYM LT] THEN + DISJ_CASES_TAC (SPEC `i:num` num_CASES) THENL + [ + ASM_REWRITE_TAC[EL; HD]; + ALL_TAC + ] THEN + POP_ASSUM CHOOSE_TAC THEN + ASM_REWRITE_TAC[LT_SUC; EL; TL]);; + + +(****************************) + +(* INDEX *) + + +let EL_INDEX = prove(`!(x:A) list. MEM x list ==> EL (INDEX x list) list = x`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[MEM] THEN + ASM_CASES_TAC `x = h:A` THEN ASM_REWRITE_TAC[] THENL + [ + ASM_REWRITE_TAC[INDEX; EL; HD]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[INDEX; EL; TL]);; + + +let INDEX_LE_LENGTH = prove(`!(x:A) list. INDEX x list <= LENGTH list`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[INDEX; LENGTH; LE_REFL] THEN + ASM_CASES_TAC `x = h:A` THEN ASM_REWRITE_TAC[ARITH_RULE `0 <= SUC n`; LE_SUC]);; + + + +let INDEX_EQ_LENGTH = prove(`!(x:A) list. ~(MEM x list) <=> INDEX x list = LENGTH list`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[MEM; INDEX; LENGTH] THEN + REWRITE_TAC[DE_MORGAN_THM] THEN + ASM_CASES_TAC `x = h:A` THEN ASM_REWRITE_TAC[GSYM NOT_SUC] THEN ARITH_TAC);; + + + +let INDEX_LT_LENGTH = prove(`!(x:A) list. MEM x list <=> INDEX x list < LENGTH list`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[INDEX; LENGTH; MEM; LT_REFL] THEN + ASM_CASES_TAC `x = h:A` THEN ASM_REWRITE_TAC[ARITH_RULE `0 < SUC n`; LT_SUC]);; + + +(* ALL_DISTINCT *) + +let CARD_SET_OF_LIST_ALL_DISTINCT = prove(`!l:(A)list. ALL_DISTINCT l ==> + CARD (set_of_list l) = LENGTH l`, + LIST_INDUCT_TAC THEN REWRITE_TAC[ALL_DISTINCT_ALT; LENGTH; set_of_list; CARD_CLAUSES] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_SIMP_TAC[FINITE_SET_OF_LIST; CARD_CLAUSES; IN_SET_OF_LIST]);; + + +(* list_sum *) + + +let ALL_DISTINCT_SUM = prove(`!(f:A->real) list. ALL_DISTINCT list ==> sum (set_of_list list) f = list_sum list f`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[ALL_DISTINCT_ALT; set_of_list; SUM_CLAUSES; list_sum; ITLIST] THEN + REWRITE_TAC[GSYM list_sum] THEN + STRIP_TAC THEN + ASM_SIMP_TAC[SUM_CLAUSES; FINITE_SET_OF_LIST] THEN + ASM_REWRITE_TAC[IN_SET_OF_LIST]);; + + + +let ALL_DISTINCT_APPEND = prove(`!l1 l2:(A)list. ALL_DISTINCT (APPEND l1 l2) ==> ALL_DISTINCT l1 /\ ALL_DISTINCT l2`, + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[ALL_DISTINCT_ALT; APPEND; APPEND_NIL] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `CONS (h':A) t'`) THEN + ASM_REWRITE_TAC[ALL_DISTINCT_ALT] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + POP_ASSUM MP_TAC THEN + SIMP_TAC[MEM_APPEND; DE_MORGAN_THM]);; + + +let ALL_DISTINCT_APPEND_SYM = prove(`!l1 l2:(A)list. ALL_DISTINCT (APPEND l1 l2) <=> + ALL_DISTINCT (APPEND l2 l1)`, + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[ALL_DISTINCT_ALT; APPEND; APPEND_NIL] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + FIRST_ASSUM (MP_TAC o SPEC `CONS (h':A) t'`) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[APPEND; ALL_DISTINCT_ALT; MEM_APPEND; DE_MORGAN_THM] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `t':(A)list`) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[MEM; DE_MORGAN_THM] THEN + EQ_TAC THEN SIMP_TAC[]);; + + + +let ALL_DISTINCT_IMP_INDEX_UNIQUE = prove(`!(x:A) i l. ALL_DISTINCT l /\ MEM x l /\ i < LENGTH l /\ EL i l = x ==> i = INDEX x l`, + REWRITE_TAC[ALL_DISTINCT] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`i:num`; `INDEX (x:A) l`]) THEN + ASM_REWRITE_TAC[GSYM INDEX_LT_LENGTH] THEN + ASM_SIMP_TAC[EL_INDEX]);; + + + +let INDEX_EL = prove(`!i (list:(A)list). ALL_DISTINCT list /\ i < LENGTH list ==> INDEX (EL i list) list = i`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC (GSYM ALL_DISTINCT_IMP_INDEX_UNIQUE) THEN + ASM_SIMP_TAC[MEM_EL]);; + + + + + +(* Shift left/right *) + + + +let SHIFT_RIGHT = prove(`!h h' (t:(A)list). shift_right ([]:(A)list) = [] + /\ shift_right (CONS h []) = [h] + /\ shift_right (CONS h (CONS h' t)) = CONS (LAST (CONS h' t)) (BUTLAST (CONS h (CONS h' t)))`, + REPEAT GEN_TAC THEN + REWRITE_TAC[shift_right; NOT_CONS_NIL; LAST; BUTLAST]);; + + +let SHIFT_RIGHT = prove(`!(h:A) t. shift_right ([]:(A)list) = [] /\ shift_right (CONS h t) = CONS (LAST (CONS h t)) (BUTLAST (CONS h t))`, + REWRITE_TAC[shift_right; NOT_CONS_NIL]);; + + + +let MEM_SHIFT_LEFT = prove(`!(x:A) l. MEM x l <=> MEM x (shift_left l)`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[MEM; shift_left] THEN + REWRITE_TAC[MEM_APPEND; MEM] THEN + ASM_CASES_TAC `x = h:A` THEN ASM_REWRITE_TAC[]);; + + + + +let BUTLAST_APPEND_SING = prove(`!(x:A) t. BUTLAST (APPEND t [x]) = t`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[APPEND; BUTLAST] THEN + COND_CASES_TAC THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[APPEND_EQ_NIL; NOT_CONS_NIL]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]);; + + + +let SHIFT_LEFT_RIGHT = prove(`!list:(A)list. shift_left (shift_right list) = list /\ shift_right (shift_left list) = list`, + LIST_INDUCT_TAC THEN REWRITE_TAC[shift_left; SHIFT_RIGHT] THEN + SIMP_TAC[NOT_CONS_NIL; APPEND_BUTLAST_LAST] THEN + REWRITE_TAC[shift_right] THEN + COND_CASES_TAC THENL + [ + POP_ASSUM (MP_TAC o AP_TERM `LENGTH:(A)list->num`) THEN + REWRITE_TAC[LENGTH_APPEND; LENGTH] THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[BUTLAST_APPEND_SING; LAST_APPEND; NOT_CONS_NIL; LAST]);; + + + +let SHIFT_LEFT_RIGHT_o_I = prove(`shift_left o shift_right = (I:(A)list->(A)list) /\ shift_right o shift_left = (I:(A)list->(A)list)`, + REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM; SHIFT_LEFT_RIGHT]);; + + + +let MEM_SHIFT_RIGHT = prove(`!(x:A) l. MEM x l <=> MEM x (shift_right l)`, + REPEAT GEN_TAC THEN + MP_TAC (SPEC `l:(A)list` SHIFT_LEFT_RIGHT) THEN + DISCH_THEN (MP_TAC o SYM o CONJUNCT1) THEN + DISCH_THEN (fun th -> CONV_TAC (LAND_CONV (ONCE_REWRITE_CONV[th]))) THEN + REWRITE_TAC[GSYM MEM_SHIFT_LEFT]);; + + + + +let EL_SHIFT_LEFT = prove(`!i (list:(A)list). i < LENGTH list ==> EL i (shift_left list) = if (i = LENGTH list - 1) then EL 0 list else EL (i + 1) list`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[EL; LENGTH; shift_left; LT] THEN + STRIP_TAC THENL + [ + ASM_REWRITE_TAC[EL_APPEND; ARITH_RULE `SUC n - 1 = n`; LT_REFL; SUB_REFL; EL; HD]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[ARITH_RULE `i < n ==> ~(i = SUC n - 1)`] THEN + ASM_REWRITE_TAC[EL_APPEND; GSYM ADD1; EL; TL]);; + + + + +let LENGTH_SHIFT_LEFT = prove(`!list:(A)list. LENGTH (shift_left list) = LENGTH list`, + LIST_INDUCT_TAC THEN REWRITE_TAC[LENGTH; shift_left] THEN + REWRITE_TAC[LENGTH_APPEND; LENGTH] THEN ARITH_TAC);; + + +let LENGTH_SHIFT_RIGHT = prove(`!list:(A)list. LENGTH (shift_right list) = LENGTH list`, + GEN_TAC THEN + MP_TAC (CONJUNCT1 (SPEC `list:(A)list` SHIFT_LEFT_RIGHT)) THEN + DISCH_THEN (MP_TAC o (fun th -> AP_TERM `LENGTH:(A)list->num` th)) THEN + REWRITE_TAC[LENGTH_SHIFT_LEFT]);; + + +let EL_SHIFT_RIGHT = prove(`!i (list:(A)list). i < LENGTH list ==> EL i (shift_right list) = if (i = 0) then EL (LENGTH list - 1) list else EL (i - 1) list`, + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `i = 0` THEN ASM_REWRITE_TAC[] THENL + [ + SUBGOAL_THEN `~(list:(A)list = [])` ASSUME_TAC THENL + [ + DISCH_TAC THEN UNDISCH_TAC `i < LENGTH (list:(A)list)` THEN + ASM_REWRITE_TAC[LENGTH; LT_REFL]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[GSYM LAST_EL] THEN + ASM_REWRITE_TAC[shift_right; EL; HD]; + ALL_TAC + ] THEN + + MP_TAC (CONJUNCT1 (SPEC `list:(A)list` SHIFT_LEFT_RIGHT)) THEN + DISCH_THEN (MP_TAC o (fun th -> AP_TERM `(EL:num->(A)list->A) (i - 1)` th)) THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MP_TAC (SPECL [`i - 1`; `shift_right (list:(A)list)`] EL_SHIFT_LEFT) THEN + REWRITE_TAC[LENGTH_SHIFT_RIGHT; SHIFT_LEFT_RIGHT] THEN + ANTS_TAC THENL + [ + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + SUBGOAL_THEN `~(i - 1 = LENGTH (list:(A)list) - 1)` (fun th -> REWRITE_TAC[th]) THENL + [ + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + ASM_SIMP_TAC[ARITH_RULE `~(i = 0) ==> i - 1 + 1 = i`]);; + + +(* NEXT_EL, PREV_EL *) + + +let NEXT_EL_ALT = prove(`!(x:A) list. MEM x list ==> NEXT_EL x list = EL (INDEX x list) (shift_left list)`, + REWRITE_TAC[INDEX_LT_LENGTH] THEN REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`INDEX x (list:(A)list)`; `list:(A)list`] EL_SHIFT_LEFT) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[NEXT_EL; EL]);; + + +let PREV_EL_ALT = prove(`!(x:A) list. MEM x list ==> PREV_EL x list = EL (INDEX x list) (shift_right list)`, + REWRITE_TAC[INDEX_LT_LENGTH] THEN REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`INDEX x (list:(A)list)`; `list:(A)list`] EL_SHIFT_RIGHT) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[PREV_EL] THEN + AP_THM_TAC THEN AP_TERM_TAC THEN + MATCH_MP_TAC LAST_EL THEN + DISCH_TAC THEN UNDISCH_TAC `INDEX x (list:(A)list) < LENGTH (list:(A)list)` THEN + ASM_REWRITE_TAC[LENGTH; LT]);; + + +let MEM_NEXT_EL = prove(`!(x:A) list. MEM x list ==> MEM (NEXT_EL x list) list`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[NEXT_EL_ALT] THEN + ONCE_REWRITE_TAC[MEM_SHIFT_LEFT] THEN + REWRITE_TAC[MEM_EXISTS_EL] THEN + EXISTS_TAC `INDEX (x:A) list` THEN + ASM_REWRITE_TAC[LENGTH_SHIFT_LEFT; GSYM INDEX_LT_LENGTH]);; + + +let MEM_PREV_EL = prove(`!(x:A) list. MEM x list ==> MEM (PREV_EL x list) list`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[PREV_EL_ALT] THEN + ONCE_REWRITE_TAC[MEM_SHIFT_RIGHT] THEN + REWRITE_TAC[MEM_EXISTS_EL] THEN + EXISTS_TAC `INDEX (x:A) list` THEN + ASM_REWRITE_TAC[LENGTH_SHIFT_RIGHT; GSYM INDEX_LT_LENGTH]);; + + + +let INDEX_HD = prove(`!list:(A)list. ~(list = []) ==> INDEX (HD list) list = 0`, + LIST_INDUCT_TAC THEN ASM_REWRITE_TAC[NOT_CONS_NIL; INDEX; HD]);; + + +let PREV_NEXT_ID = prove(`!(x:A) list. ALL_DISTINCT list /\ MEM x list ==> PREV_EL (NEXT_EL x list) list = x`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[NEXT_EL] THEN + SUBGOAL_THEN `~(list = []:(A)list)` ASSUME_TAC THENL + [ + DISCH_TAC THEN UNDISCH_TAC `MEM (x:A) list` THEN + ASM_REWRITE_TAC[MEM]; + ALL_TAC + ] THEN + COND_CASES_TAC THENL + [ + REWRITE_TAC[PREV_EL] THEN + ASM_SIMP_TAC[INDEX_HD; LAST_EL] THEN + MP_TAC (SPECL [`x:A`; `list:(A)list`] EL_INDEX) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[PREV_EL] THEN + ABBREV_TAC `i = INDEX (x:A) list` THEN + SUBGOAL_THEN `i + 1 < LENGTH (list:(A)list)` ASSUME_TAC THENL + [ + REWRITE_TAC[ARITH_RULE `i + 1 < n <=> i < n /\ ~(i = n - 1)`] THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[GSYM INDEX_LT_LENGTH]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`i + 1`; `list:(A)list`] INDEX_EL) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[ARITH_RULE `~(i + 1 = 0)`; ARITH_RULE `(i + 1) - 1 = i`] THEN + MP_TAC (SPECL [`x:A`; `list:(A)list`] EL_INDEX) THEN + ASM_SIMP_TAC[]);; + + + +let NEXT_PREV_ID = prove(`!(x:A) list. ALL_DISTINCT list /\ MEM x list ==> NEXT_EL (PREV_EL x list) list = x`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[PREV_EL] THEN + SUBGOAL_THEN `~(list = []:(A)list)` ASSUME_TAC THENL + [ + DISCH_TAC THEN UNDISCH_TAC `MEM (x:A) list` THEN + ASM_REWRITE_TAC[MEM]; + ALL_TAC + ] THEN + SUBGOAL_THEN `0 < LENGTH (list:(A)list)` ASSUME_TAC THENL + [ + UNDISCH_TAC `~(list = []:(A)list)` THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[NOT_LT; LE; LENGTH_EQ_NIL]; + ALL_TAC + ] THEN + + COND_CASES_TAC THENL + [ + REWRITE_TAC[NEXT_EL] THEN + SUBGOAL_THEN `INDEX (LAST list) (list:(A)list) = LENGTH list - 1` ASSUME_TAC THENL + [ + ASM_SIMP_TAC[LAST_EL] THEN + MATCH_MP_TAC INDEX_EL THEN + ASM_REWRITE_TAC[ARITH_RULE `n - 1 < n <=> 0 < n`]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL [`x:A`; `list:(A)list`] EL_INDEX) THEN + ASM_REWRITE_TAC[EL]; + ALL_TAC + ] THEN + + REWRITE_TAC[NEXT_EL] THEN + ABBREV_TAC `i = INDEX (x:A) list` THEN + SUBGOAL_THEN `0 < i /\ i - 1 < LENGTH (list:(A)list)` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[LT_NZ] THEN + MATCH_MP_TAC (ARITH_RULE `i < n ==> i - 1 < n`) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[GSYM INDEX_LT_LENGTH]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`i - 1`; `list:(A)list`] INDEX_EL) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ASM_SIMP_TAC[ARITH_RULE `0 < i /\ 0 < n ==> (i - 1 = n - 1 <=> i = n)`] THEN + ASM_SIMP_TAC[ARITH_RULE `0 < i ==> i - 1 + 1 = i`] THEN + EXPAND_TAC "i" THEN ASM_REWRITE_TAC[GSYM INDEX_EQ_LENGTH] THEN + MP_TAC (SPECL [`x:A`; `list:(A)list`] EL_INDEX) THEN + ASM_SIMP_TAC[]);; + + + +(* FLATTEN, REMOVE_DUPLICATES *) + +let MEM_REMOVE_DUPLICATES = prove(`!(x:A) list. MEM x (REMOVE_DUPLICATES list) <=> MEM x list`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[REMOVE_DUPLICATES; MEM] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[MEM] THEN + EQ_TAC THEN SIMP_TAC[] THEN STRIP_TAC THEN ASM_REWRITE_TAC[]);; + + +let ALL_DISTINCT_REMOVE_DUPLICATES = prove(`!list:(A)list. ALL_DISTINCT (REMOVE_DUPLICATES list)`, + LIST_INDUCT_TAC THEN REWRITE_TAC[ALL_DISTINCT_ALT; REMOVE_DUPLICATES] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_REWRITE_TAC[ALL_DISTINCT_ALT; MEM_REMOVE_DUPLICATES]);; + + +let MEM_FLATTEN = prove(`!(x:A) ll. MEM x (FLATTEN ll) <=> ?l. MEM l ll /\ MEM x l`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[MEM; FLATTEN; ITLIST] THEN + REWRITE_TAC[MEM_APPEND; GSYM FLATTEN] THEN + EQ_TAC THENL + [ + STRIP_TAC THENL + [ + EXISTS_TAC `h:(A)list` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + EXISTS_TAC `l:(A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + STRIP_TAC THENL + [ + UNDISCH_TAC `l = h:(A)list` THEN DISCH_THEN (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + DISJ2_TAC THEN ASM_REWRITE_TAC[] THEN + EXISTS_TAC `l:(A)list` THEN ASM_REWRITE_TAC[]);; + + +(* lists *) + + +let LIST_PAIRS_EMPTY = prove(`!list:(A)list. list_pairs list = [] <=> list = []`, + REWRITE_TAC[list_pairs; GSYM LENGTH_EQ_NIL] THEN + SIMP_TAC[LENGTH_ZIP; LENGTH_SHIFT_LEFT]);; + + + + +let LIST_OF_DARTS = prove(`!ll:((A)list)list. list_of_darts ll = FLATTEN (list_of_faces ll)`, + REWRITE_TAC[list_of_darts; FLATTEN; list_of_faces] THEN + LIST_INDUCT_TAC THEN ASM_REWRITE_TAC[ITLIST; MAP]);; + + +(* Faces *) + + +let FIND_FACE = prove(`!(d:A#A) ll. find_face d ll = list_pairs (find_pair_list d ll)`, + REWRITE_TAC[find_face; list_of_faces] THEN + GEN_TAC THEN LIST_INDUCT_TAC THENL + [ + REWRITE_TAC[MAP; find_list; find_pair_list; list_pairs; shift_left; ZIP]; + ALL_TAC + ] THEN + REWRITE_TAC[MAP; find_pair_list; find_list] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[]);; + + +let MEM_FIND_LIST = prove(`!(x:A) ll. MEM x (FLATTEN ll) ==> + MEM (find_list x ll) ll`, + REWRITE_TAC[MEM_FLATTEN] THEN + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[MEM] THEN + STRIP_TAC THENL + [ + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[find_list] THEN DISCH_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_CASES_TAC `MEM (x:A) h` THEN ASM_REWRITE_TAC[find_list] THEN + DISJ2_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + EXISTS_TAC `l:(A)list` THEN + ASM_REWRITE_TAC[]);; + + + +let MEM_FIND_FACE = prove(`!(d:A#A) ll. MEM d (list_of_darts ll) + ==> MEM (find_face d ll) (list_of_faces ll)`, + REWRITE_TAC[LIST_OF_DARTS] THEN REPEAT STRIP_TAC THEN + REWRITE_TAC[find_face] THEN + MATCH_MP_TAC MEM_FIND_LIST THEN + ASM_REWRITE_TAC[]);; + + + +let MEM_FIND_LIST_NONEMPTY = prove(`!(x:A) ll. ALL (\l. ~(l = [])) ll ==> + (MEM x (FLATTEN ll) <=> MEM (find_list x ll) ll)`, + REWRITE_TAC[GSYM ALL_MEM] THEN + REPEAT STRIP_TAC THEN + EQ_TAC THENL + [ + ASM_REWRITE_TAC[MEM_FIND_LIST]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN SPEC_TAC (`ll:((A)list)list`, `ll:((A)list)list`) THEN + LIST_INDUCT_TAC THEN REWRITE_TAC[MEM] THEN + DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o check(is_imp o concl)) THEN + ANTS_TAC THENL + [ + GEN_TAC THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:(A)list`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_TAC THEN + REWRITE_TAC[find_list] THEN + SUBGOAL_THEN `!t. find_list x t = h ==> MEM (x:A) h` ASSUME_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `h:(A)list`) THEN + REWRITE_TAC[] THEN DISCH_TAC THEN + LIST_INDUCT_TAC THEN ASM_REWRITE_TAC[find_list] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + ASM_CASES_TAC `MEM (x:A) h` THEN ASM_REWRITE_TAC[] THENL + [ + REWRITE_TAC[MEM_FLATTEN; MEM] THEN + EXISTS_TAC `h:(A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `t:((A)list)list`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[FLATTEN; ITLIST; MEM_APPEND] THEN + ASM_REWRITE_TAC[GSYM FLATTEN] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]);; + + +let MEM_FIND_FACE_NONEMPTY = prove(`!(d:A#A) ll. ALL (\l. ~(l = [])) ll + ==> (MEM d (list_of_darts ll) <=> MEM (find_face d ll) (list_of_faces ll))`, + REWRITE_TAC[find_face; LIST_OF_DARTS] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC MEM_FIND_LIST_NONEMPTY THEN + REWRITE_TAC[list_of_faces] THEN + REWRITE_TAC[ALL_MAP] THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[GSYM ALL_MEM; o_THM] THEN + DISCH_TAC THEN GEN_TAC THEN DISCH_TAC THEN + REWRITE_TAC[list_pairs] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:(A)list`) THEN + ASM_REWRITE_TAC[CONTRAPOS_THM] THEN + REWRITE_TAC[GSYM LENGTH_EQ_NIL] THEN + SIMP_TAC[LENGTH_ZIP; LENGTH_SHIFT_LEFT]);; + + + +(* Hypermap maps properties *) + + +(* e_list_ext permutes darts *) + +let E_LIST_EXT_INVOLUTION = prove(`!ll:((A)list)list. good_list ll ==> e_list_ext ll o e_list_ext ll = I`, + REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM; e_list_ext; good_list] THEN + REPEAT STRIP_TAC THEN + MP_TAC (ISPEC `x:A#A` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `i:A` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `j:A` ASSUME_TAC) THEN + ASM_REWRITE_TAC[res; e_list] THEN + ASM_CASES_TAC `i,j:A IN darts_of_list ll` THENL + [ + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC (`i:A,j:A`)) THEN + POP_ASSUM MP_TAC THEN + SIMP_TAC[darts_of_list; IN_SET_OF_LIST]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]);; + + +let LEFT_RIGHT_INVERSES_COINSIDE = prove(`!(f:A->B) l r. f o r = I /\ l o f = I ==> r = l`, + REPEAT STRIP_TAC THEN + POP_ASSUM (MP_TAC o (AP_TERM `\tm:(A->A). tm o (r:B->A)`)) THEN + ASM_REWRITE_TAC[I_O_ID; GSYM o_ASSOC] THEN + SIMP_TAC[]);; + + +let INVERSE_EXISTS_IMP_BIJECTIVE = prove(`!(f:A->B) g. f o g = I /\ g o f = I ==> (!y. ?!x. f x = y)`, + REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM] THEN + REPEAT STRIP_TAC THEN REWRITE_TAC[EXISTS_UNIQUE] THEN + EXISTS_TAC `(g:B->A) y` THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + POP_ASSUM (MP_TAC o AP_TERM `g:B->A`) THEN + ASM_REWRITE_TAC[]);; + + + + + +let E_LIST_EXT_PERMUTES_DARTS = prove(`!ll:((A)list)list. good_list ll ==> (e_list_ext ll) permutes (darts_of_list ll)`, + REWRITE_TAC[ permutes] THEN + GEN_TAC THEN STRIP_TAC THEN STRIP_TAC THENL + [ + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[e_list_ext; res]; + ALL_TAC + ] THEN + MATCH_MP_TAC INVERSE_EXISTS_IMP_BIJECTIVE THEN + EXISTS_TAC `e_list_ext (ll:((A)list)list)` THEN + REWRITE_TAC[ETA_AX] THEN + ASM_SIMP_TAC[E_LIST_EXT_INVOLUTION]);; + + + +(* f_list_ext permutes darts *) + +let DART_IN_DARTS = prove(`!(d:A#A) l ll. MEM d (list_pairs l) /\ MEM l ll ==> MEM d (list_of_darts ll)`, + GEN_TAC THEN GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[MEM] THEN + REPEAT STRIP_TAC THEN REWRITE_TAC[list_of_darts; ITLIST; MEM_APPEND] THENL + [ + DISJ1_TAC THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + DISJ2_TAC THEN + REWRITE_TAC[GSYM list_of_darts] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]);; + + + +let MEM_FIND_PAIR_LIST = prove(`!(d:A#A) ll. MEM d (list_of_darts ll) ==> MEM (find_pair_list d ll) ll`, + GEN_TAC THEN LIST_INDUCT_TAC THENL + [ + ASM_REWRITE_TAC[list_of_darts; ITLIST; MEM]; + ALL_TAC + ] THEN + REWRITE_TAC[list_of_darts; find_pair_list; ITLIST; MEM] THEN + COND_CASES_TAC THEN REWRITE_TAC[] THEN + ASM_REWRITE_TAC[MEM_APPEND; GSYM list_of_darts] THEN + DISCH_TAC THEN DISJ2_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]);; + + +let DART_IN_FIND_PAIR_LIST = prove(`!(d:A#A) ll. MEM d (list_of_darts ll) <=> MEM d (list_pairs (find_pair_list d ll))`, + GEN_TAC THEN LIST_INDUCT_TAC THENL + [ + ASM_REWRITE_TAC[list_of_darts; ITLIST; MEM; find_pair_list; list_pairs; shift_left; ZIP]; + ALL_TAC + ] THEN + REWRITE_TAC[list_of_darts; find_pair_list; ITLIST; MEM] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[MEM_APPEND] THEN + ASM_REWRITE_TAC[GSYM list_of_darts]);; + + + + +let DART_IN_FACE = prove(`!(d:A#A) ll. MEM d (list_of_darts ll) <=> MEM d (find_face d ll)`, + REWRITE_TAC[FIND_FACE; DART_IN_FIND_PAIR_LIST]);; + + + + + + +let MEM_IMP_NOT_ALL_DISTINCT_APPEND = prove(`!(x:A) l1 l2. MEM x l1 /\ MEM x l2 ==> ~ALL_DISTINCT (APPEND l1 l2)`, + REWRITE_TAC[ALL_DISTINCT; NOT_FORALL_THM; LENGTH_APPEND; EL_APPEND] THEN + REWRITE_TAC[MEM_EXISTS_EL] THEN + REPEAT STRIP_TAC THEN + EXISTS_TAC `i:num` THEN EXISTS_TAC `LENGTH (l1:(A)list) + i'` THEN + REWRITE_TAC[NOT_IMP] THEN + ASM_SIMP_TAC[ARITH_RULE `i < l1 ==> i < l1 + l2:num`; ARITH_RULE `i' < l2 ==> l1 + i' < l1 + l2:num`; ARITH_RULE `i < l1 ==> ~(i = l1 + i':num)`] THEN + REWRITE_TAC[ARITH_RULE `(l1 + i') - l1 = i':num`] THEN + REWRITE_TAC[ARITH_RULE `~(l1 + i' < l1:num)`] THEN + REPEAT (FIRST_X_ASSUM (fun th -> REWRITE_TAC[SYM th])));; + + + + + +let ALL_DISTINCT_IMP_UNIQUE_LIST = prove(`!l1 l2 (d:A#A) ll. ALL_DISTINCT (list_of_darts ll) /\ MEM l1 ll /\ MEM l2 ll + /\ MEM d (list_pairs l1) /\ MEM d (list_pairs l2) ==> l1 = l2`, + GEN_TAC THEN GEN_TAC THEN GEN_TAC THEN LIST_INDUCT_TAC THENL + [ + REWRITE_TAC[MEM]; + ALL_TAC + ] THEN + REWRITE_TAC[MEM; list_of_darts; ITLIST] THEN + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + FIRST_X_ASSUM (MP_TAC o check (fun th -> (rator o concl) th = `ALL_DISTINCT:(A#A)list->bool`)) THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + DISCH_TAC THEN + MATCH_MP_TAC MEM_IMP_NOT_ALL_DISTINCT_APPEND THEN + EXISTS_TAC `d:A#A` THEN + FIRST_X_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[GSYM list_of_darts] THEN + MATCH_MP_TAC DART_IN_DARTS THEN + EXISTS_TAC `l2:(A)list` THEN + ASM_REWRITE_TAC[]; + + FIRST_X_ASSUM (MP_TAC o check (fun th -> (rator o concl) th = `ALL_DISTINCT:(A#A)list->bool`)) THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + DISCH_TAC THEN + MATCH_MP_TAC MEM_IMP_NOT_ALL_DISTINCT_APPEND THEN + EXISTS_TAC `d:A#A` THEN + FIRST_X_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[GSYM list_of_darts] THEN + MATCH_MP_TAC DART_IN_DARTS THEN + EXISTS_TAC `l1:(A)list` THEN + ASM_REWRITE_TAC[]; + + ALL_TAC + ] THEN + + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o (fun th -> MATCH_MP ALL_DISTINCT_APPEND th)) THEN + SIMP_TAC[GSYM list_of_darts]);; + + + + +let FIND_PAIR_LIST_UNIQUE = prove(`!l d (ll:((A)list)list). ALL_DISTINCT (list_of_darts ll) /\ + MEM l ll /\ MEM d (list_pairs l) ==> l = find_pair_list d ll`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC ALL_DISTINCT_IMP_UNIQUE_LIST THEN + MAP_EVERY EXISTS_TAC [`d:A#A`; `ll:((A)list)list`] THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `MEM (d:A#A) (list_of_darts ll)` ASSUME_TAC THENL + [ + MATCH_MP_TAC DART_IN_DARTS THEN + EXISTS_TAC `l:(A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[MEM_FIND_PAIR_LIST] THEN + ASM_REWRITE_TAC[GSYM DART_IN_FIND_PAIR_LIST]);; + + + +let ALL_DISTINCT_FIND_FACE = prove(`!(d:A#A) ll. ALL_DISTINCT (list_of_darts ll) ==> ALL_DISTINCT (find_face d ll)`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[list_of_darts; ALL_DISTINCT_ALT; ITLIST; find_face; list_of_faces; find_list; MAP] THEN + REWRITE_TAC[GSYM list_of_darts; GSYM find_face; GSYM list_of_faces] THEN + DISCH_THEN (MP_TAC o (fun th -> MATCH_MP ALL_DISTINCT_APPEND th)) THEN + STRIP_TAC THEN + COND_CASES_TAC THEN ASM_SIMP_TAC[]);; + + + + + + + + +let LENGTH_LIST_PAIRS = prove(`!l:(A)list. LENGTH (list_pairs l) = LENGTH l`, + GEN_TAC THEN REWRITE_TAC[list_pairs] THEN + MATCH_MP_TAC LENGTH_ZIP THEN + REWRITE_TAC[LENGTH_SHIFT_LEFT]);; + + + + +let MEM_LIST_PAIRS = prove(`!(x:A) y l. MEM (x,y) (list_pairs l) ==> MEM x l /\ MEM y l`, + REWRITE_TAC[list_pairs] THEN + REPEAT GEN_TAC THEN DISCH_TAC THEN + MP_TAC (ISPECL [`x:A`; `y:A`; `l:(A)list`; `shift_left (l:(A)list)`] MEM_ZIP) THEN + ASM_REWRITE_TAC[LENGTH_SHIFT_LEFT; GSYM MEM_SHIFT_LEFT]);; + + + +let MEM_F_LIST = prove(`!(d:A#A) ll. MEM d (list_of_darts ll) ==> MEM (f_list ll d) (find_face d ll)`, + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[f_list] THEN + MATCH_MP_TAC MEM_NEXT_EL THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]);; + + + + +let EL_LIST_PAIRS = prove(`!i (list:(A)list). i < LENGTH list ==> EL i (list_pairs list) = (EL i list, EL (if i = LENGTH list - 1 then 0 else i + 1) list)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[list_pairs] THEN + MP_TAC (ISPECL [`list:(A)list`; `shift_left (list:(A)list)`; `i:num`] EL_ZIP) THEN + ASM_REWRITE_TAC[LENGTH_SHIFT_LEFT] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; PAIR_EQ]) THEN + ASM_SIMP_TAC[EL_SHIFT_LEFT] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[]);; + + + +let ALL_DISTINCT_LIST_PAIRS = prove(`!list:(A)list. ALL_DISTINCT list ==> ALL_DISTINCT (list_pairs list)`, + REWRITE_TAC[ALL_DISTINCT; LENGTH_LIST_PAIRS] THEN + GEN_TAC THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[NOT_FORALL_THM; NOT_IMP] THEN + STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`i:num`; `j:num`] THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN ASM_SIMP_TAC[EL_LIST_PAIRS; PAIR_EQ]);; + + + +let ALL_DISTINCT_SHIFT_LEFT = prove(`!list:(A)list. ALL_DISTINCT list ==> ALL_DISTINCT (shift_left list)`, + LIST_INDUCT_TAC THEN REWRITE_TAC[shift_left] THEN + POP_ASSUM (fun th -> ALL_TAC) THEN + ASM_REWRITE_TAC[ALL_DISTINCT] THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[NOT_FORALL_THM; NOT_IMP; EL_APPEND; LENGTH_APPEND; LENGTH; ARITH_SUC] THEN + STRIP_TAC THEN POP_ASSUM MP_TAC THEN + ABBREV_TAC `m = LENGTH (t:(A)list)` THEN + ASSUME_TAC (ARITH_RULE `!n. n < m + 1 /\ ~(n < m) ==> n = m`) THEN + REPEAT COND_CASES_TAC THENL + [ + DISCH_TAC THEN + MAP_EVERY EXISTS_TAC [`SUC i`; `SUC j`] THEN + ASM_REWRITE_TAC[LT_SUC; SUC_INJ; EL; TL]; + FIRST_X_ASSUM (MP_TAC o SPEC `j:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; SUB_REFL]) THEN + REWRITE_TAC[EL; HD] THEN DISCH_TAC THEN + MAP_EVERY EXISTS_TAC [`SUC i`; `0`] THEN + ASM_REWRITE_TAC[LT_SUC; NOT_SUC; LT_0; EL; TL; HD]; + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; SUB_REFL]) THEN + REWRITE_TAC[EL; HD] THEN DISCH_TAC THEN + MAP_EVERY EXISTS_TAC [`0`; `SUC j`] THEN + ASM_REWRITE_TAC[LT_SUC; NOT_SUC; LT_0; EL; TL; HD]; + UNDISCH_TAC `~(i = j:num)` THEN + FIRST_ASSUM (MP_TAC o SPEC `i:num`) THEN FIRST_X_ASSUM (MP_TAC o SPEC `j:num`) THEN + ASM_SIMP_TAC[] + ]);; + + + +let MEM_LIST_PAIRS_EXPLICIT = prove(`!(d:A#A) list. ALL_DISTINCT list /\ MEM d (list_pairs list) + ==> d = (FST d, NEXT_EL (FST d) list)`, + REWRITE_TAC[MEM_EXISTS_EL] THEN + REWRITE_TAC[LENGTH_LIST_PAIRS] THEN + REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[list_pairs] THEN + MP_TAC (ISPECL [`list:(A)list`; `shift_left list:(A)list`; `i:num`] EL_ZIP) THEN + ASM_REWRITE_TAC[LENGTH_SHIFT_LEFT] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; PAIR_EQ]) THEN + MP_TAC (SPECL [`EL i list:A`; `list:(A)list`] NEXT_EL_ALT) THEN + ASM_SIMP_TAC[MEM_EL] THEN + DISCH_TAC THEN + MP_TAC (SPEC_ALL INDEX_EL) THEN + ASM_SIMP_TAC[]);; + + + + + +let INDEX_FST_SND = prove(`!i (d:A#A) list. ALL_DISTINCT list /\ i < LENGTH list /\ EL i (list_pairs list) = d ==> + INDEX (FST d) list = i /\ INDEX (SND d) list = if (i = LENGTH list - 1) then 0 else i + 1`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + ASM_SIMP_TAC[EL_LIST_PAIRS] THEN + MP_TAC (ISPEC `d:A#A` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[PAIR_EQ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + CONJ_TAC THEN MATCH_MP_TAC INDEX_EL THEN ASM_REWRITE_TAC[] THEN + ABBREV_TAC `n = LENGTH (list:(A)list)` THEN + UNDISCH_TAC `i < n:num` THEN COND_CASES_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC);; + + + + +let NEXT_EL_LIST_PAIRS = prove(`!(d:A#A) list. ALL_DISTINCT list /\ MEM d (list_pairs list) ==> NEXT_EL d (list_pairs list) = (SND d, NEXT_EL (SND d) list)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[NEXT_EL; LENGTH_LIST_PAIRS] THEN + MP_TAC (SPEC `list:(A)list` ALL_DISTINCT_LIST_PAIRS) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ABBREV_TAC `i = INDEX (d:A#A) (list_pairs list)` THEN + ABBREV_TAC `n = LENGTH (list:(A)list)` THEN + SUBGOAL_THEN `i < n:num` ASSUME_TAC THENL + [ + EXPAND_TAC "n" THEN EXPAND_TAC "i" THEN + ONCE_REWRITE_TAC[GSYM LENGTH_LIST_PAIRS] THEN + ASM_REWRITE_TAC[GSYM INDEX_LT_LENGTH]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `EL i (list_pairs list) = d:A#A` ASSUME_TAC THENL + [ + EXPAND_TAC "i" THEN + MATCH_MP_TAC EL_INDEX THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`i:num`; `d:A#A`; `list:(A)list`] INDEX_FST_SND) THEN + ASM_REWRITE_TAC[] THEN + + COND_CASES_TAC THEN ASM_REWRITE_TAC[] THENL + [ + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPEC_ALL EL_LIST_PAIRS) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC (ARITH_RULE `i < n ==> n - 1 < n`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ONCE_REWRITE_TAC[GSYM EL] THEN + MP_TAC (SPECL [`0`; `list:(A)list`] EL_LIST_PAIRS) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL [ MATCH_MP_TAC (ARITH_RULE `i < n ==> 0 < n`) THEN ASM_REWRITE_TAC[]; ALL_TAC ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; PAIR_EQ]) THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MP_TAC (SPECL [`i + 1`; `list:(A)list`] EL_LIST_PAIRS) THEN + SUBGOAL_THEN `i + 1 < n` ASSUME_TAC THENL + [ + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN ARITH_TAC; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ONCE_REWRITE_TAC[GSYM EL] THEN + MP_TAC (SPECL [`i:num`; `list:(A)list`] EL_LIST_PAIRS) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; PAIR_EQ]) THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[PAIR_EQ]);; + + + + +let PREV_EL_LIST_PAIRS = prove(`!(d:A#A) list. ALL_DISTINCT list /\ MEM d (list_pairs list) ==> + PREV_EL d (list_pairs list) = (PREV_EL (FST d) list, FST d)`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `t = PREV_EL (d:A#A) (list_pairs list)` THEN + SUBGOAL_THEN `MEM (t:A#A) (list_pairs list)` ASSUME_TAC THENL + [ + EXPAND_TAC "t" THEN + MATCH_MP_TAC MEM_PREV_EL THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MP_TAC (SPECL [`t:A#A`; `list:(A)list`] MEM_LIST_PAIRS_EXPLICIT) THEN + ASM_REWRITE_TAC[] THEN + + MP_TAC (ISPEC `t:A#A` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[PAIR_EQ] THEN + DISCH_THEN (MP_TAC o AP_TERM `(\tm:A. PREV_EL tm list)`) THEN + REWRITE_TAC[] THEN + MP_TAC (SPEC_ALL PREV_NEXT_ID) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL [`x:A`; `y:A`; `list:(A)list`] MEM_LIST_PAIRS) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + SUBGOAL_THEN `y = FST (d:A#A)` ASSUME_TAC THENL + [ + UNDISCH_TAC `PREV_EL d (list_pairs list) = t:A#A` THEN + DISCH_THEN (MP_TAC o AP_TERM `\tm:A#A. NEXT_EL tm (list_pairs list)`) THEN + MP_TAC (ISPECL [`d:A#A`; `list_pairs (list:(A)list)`] NEXT_PREV_ID) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC ALL_DISTINCT_LIST_PAIRS THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MP_TAC (SPECL [`t:A#A`; `list:(A)list`] NEXT_EL_LIST_PAIRS) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; PAIR_EQ]); + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> ASM_REWRITE_TAC[SYM th]));; + + + +let F_LIST_INVERSE = prove(`!(d:A#A) ll. ALL_DISTINCT (list_of_darts ll) /\ MEM d (list_of_darts ll) ==> + let g = (\x:A#A. PREV_EL x (find_face x ll)) in + f_list ll (g d) = d /\ g (f_list ll d) = d`, + REWRITE_TAC[LET_DEF; LET_END_DEF; f_list] THEN + REPEAT STRIP_TAC THENL + [ + ABBREV_TAC `f = find_face (d:A#A) ll` THEN + SUBGOAL_THEN `find_face (PREV_EL (d:A#A) f) ll = f` ASSUME_TAC THENL + [ + EXPAND_TAC "f" THEN REWRITE_TAC[FIND_FACE] THEN + AP_TERM_TAC THEN + REWRITE_TAC[GSYM FIND_FACE] THEN + + MATCH_MP_TAC (GSYM FIND_PAIR_LIST_UNIQUE) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPEC_ALL MEM_FIND_PAIR_LIST) THEN + ASM_REWRITE_TAC[darts_of_list; IN_SET_OF_LIST] THEN + DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_REWRITE_TAC[GSYM FIND_FACE] THEN + MATCH_MP_TAC MEM_PREV_EL THEN + EXPAND_TAC "f" THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC NEXT_PREV_ID THEN + MP_TAC (SPEC_ALL ALL_DISTINCT_FIND_FACE) THEN + ASM_SIMP_TAC[] THEN + DISCH_TAC THEN + POP_ASSUM (fun th -> ALL_TAC) THEN POP_ASSUM (fun th -> ALL_TAC) THEN + EXPAND_TAC "f" THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + ABBREV_TAC `f = find_face (d:A#A) ll` THEN + SUBGOAL_THEN `find_face (NEXT_EL (d:A#A) f) ll = f` ASSUME_TAC THENL + [ + EXPAND_TAC "f" THEN REWRITE_TAC[FIND_FACE] THEN + AP_TERM_TAC THEN + REWRITE_TAC[GSYM FIND_FACE] THEN + + MATCH_MP_TAC (GSYM FIND_PAIR_LIST_UNIQUE) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPEC_ALL MEM_FIND_PAIR_LIST) THEN + ASM_REWRITE_TAC[darts_of_list; IN_SET_OF_LIST] THEN + DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_REWRITE_TAC[GSYM FIND_FACE] THEN + MATCH_MP_TAC MEM_NEXT_EL THEN + EXPAND_TAC "f" THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC PREV_NEXT_ID THEN + MP_TAC (SPEC_ALL ALL_DISTINCT_FIND_FACE) THEN + ASM_SIMP_TAC[] THEN + DISCH_TAC THEN + POP_ASSUM (fun th -> ALL_TAC) THEN POP_ASSUM (fun th -> ALL_TAC) THEN + EXPAND_TAC "f" THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]);; + + + + +let FIND_FACE_F_LIST = prove(`!(d:A#A) ll. ALL_DISTINCT (list_of_darts ll) /\ MEM d (list_of_darts ll) ==> + find_face (f_list ll d) ll = find_face d ll`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[FIND_FACE] THEN + AP_TERM_TAC THEN + MATCH_MP_TAC (GSYM FIND_PAIR_LIST_UNIQUE) THEN + ASM_SIMP_TAC[MEM_FIND_PAIR_LIST] THEN + REWRITE_TAC[GSYM FIND_FACE] THEN + ASM_SIMP_TAC[MEM_F_LIST]);; + + + + +let F_LIST_EXT_PERMUTES_DARTS = prove(`!ll:((A)list)list. ALL_DISTINCT (list_of_darts ll) ==> (f_list_ext ll) permutes (darts_of_list ll)`, + REWRITE_TAC[f_list_ext; permutes; res] THEN + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[EXISTS_UNIQUE] THEN + ASM_CASES_TAC `y:A#A IN darts_of_list ll` THENL + [ + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[darts_of_list; IN_SET_OF_LIST] THEN DISCH_TAC THEN + MP_TAC (SPECL [`y:A#A`; `ll:((A)list)list`] F_LIST_INVERSE) THEN + ASM_REWRITE_TAC[LET_DEF; LET_END_DEF] THEN + ABBREV_TAC `x:A#A = PREV_EL y (find_face y ll)` THEN + STRIP_TAC THEN + EXISTS_TAC `x:A#A` THEN + CONJ_TAC THENL + [ + SUBGOAL_THEN `MEM (x:A#A) (list_of_darts ll)` ASSUME_TAC THENL + [ + REWRITE_TAC[DART_IN_FACE] THEN + EXPAND_TAC "x" THEN + SUBGOAL_THEN `find_face (PREV_EL y (find_face y ll)) ll = find_face (y:A#A) ll` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[FIND_FACE] THEN AP_TERM_TAC THEN + MATCH_MP_TAC (GSYM FIND_PAIR_LIST_UNIQUE) THEN + REWRITE_TAC[GSYM FIND_FACE] THEN + ASM_SIMP_TAC[MEM_FIND_PAIR_LIST] THEN + EXPAND_TAC "x" THEN + MATCH_MP_TAC MEM_PREV_EL THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + MATCH_MP_TAC MEM_PREV_EL THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + X_GEN_TAC `d:A#A` THEN + COND_CASES_TAC THENL + [ + DISCH_TAC THEN + MP_TAC (SPEC_ALL F_LIST_INVERSE) THEN + ASM_REWRITE_TAC[LET_DEF; LET_END_DEF] THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> POP_ASSUM (MP_TAC o REWRITE_RULE[th])) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + EXISTS_TAC `y:A#A` THEN + ASM_REWRITE_TAC[] THEN + X_GEN_TAC `z:A#A` THEN + COND_CASES_TAC THENL + [ + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[darts_of_list; IN_SET_OF_LIST] THEN DISCH_TAC THEN + DISCH_THEN (ASSUME_TAC o SYM) THEN + MP_TAC (SPECL [`z:A#A`; `ll:((A)list)list`] MEM_F_LIST) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL [`z:A#A`; `ll:((A)list)list`] FIND_FACE_F_LIST) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + REWRITE_TAC[GSYM DART_IN_FACE] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[GSYM IN_SET_OF_LIST; GSYM darts_of_list]; + ALL_TAC + ] THEN + + REWRITE_TAC[]);; + + + + + + +(* e o n o f = I *) + + +let FIND_FACE_EMPTY = prove(`!(d:A#A) ll. find_face d ll = [] <=> ~MEM d (list_of_darts ll)`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[find_face; MAP; list_of_faces; find_list; list_of_darts; ITLIST; MEM] THEN + COND_CASES_TAC THENL + [ + ASM_REWRITE_TAC[MEM_APPEND] THEN + DISCH_TAC THEN UNDISCH_TAC `MEM (d:A#A) (list_pairs h)` THEN + ASM_REWRITE_TAC[MEM]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[GSYM list_of_faces; GSYM find_face; GSYM list_of_darts; MEM_APPEND]);; + + + + +let MEM_FIND_FACE_IMP_FACES_EQ = prove(`!(x:A#A) y ll. ALL_DISTINCT (list_of_darts ll) /\ MEM y (find_face x ll) + ==> find_face y ll = find_face x ll`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[FIND_FACE] THEN AP_TERM_TAC THEN + MATCH_MP_TAC (GSYM FIND_PAIR_LIST_UNIQUE) THEN + ASM_REWRITE_TAC[GSYM FIND_FACE] THEN + MATCH_MP_TAC MEM_FIND_PAIR_LIST THEN + POP_ASSUM MP_TAC THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[GSYM FIND_FACE_EMPTY] THEN + DISCH_TAC THEN ASM_REWRITE_TAC[MEM]);; + + + +let MEM_FIND_FACE_IMP_MEM_DARTS = prove(`!(d:A#A) x ll. MEM d (find_face x ll) ==> MEM d (list_of_darts ll)`, + GEN_TAC THEN GEN_TAC THEN LIST_INDUCT_TAC THENL + [ + REWRITE_TAC[find_face; list_of_darts; ITLIST; MEM; list_of_faces; MAP; find_list]; + ALL_TAC + ] THEN + REWRITE_TAC[find_face; list_of_darts; ITLIST; MEM_APPEND; list_of_faces; MAP; find_list] THEN + COND_CASES_TAC THENL + [ + DISCH_THEN (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + ASM_SIMP_TAC[GSYM list_of_faces; GSYM find_face; GSYM list_of_darts]);; + + + + + + +let F_LIST_EXT_INVERSE = prove(`!ll:((A)list)list. ALL_DISTINCT (list_of_darts ll) ==> + inverse (f_list_ext ll) = res (\d. PREV_EL d (find_face d ll)) (darts_of_list ll)`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC INVERSE_UNIQUE_o THEN + REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM; f_list_ext; res] THEN + REWRITE_TAC[darts_of_list; IN_SET_OF_LIST] THEN + CONJ_TAC THEN GEN_TAC THENL + [ + ASM_CASES_TAC `MEM (x:A#A) (list_of_darts ll)` THEN ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `MEM (PREV_EL (x:A#A) (find_face x ll)) (list_of_darts ll)` ASSUME_TAC THENL + [ + MATCH_MP_TAC MEM_FIND_FACE_IMP_MEM_DARTS THEN + EXISTS_TAC `x:A#A` THEN + MATCH_MP_TAC MEM_PREV_EL THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[f_list] THEN + SUBGOAL_THEN `find_face (PREV_EL x (find_face x ll)) ll = find_face (x:A#A) ll` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[FIND_FACE] THEN AP_TERM_TAC THEN + MATCH_MP_TAC (GSYM FIND_PAIR_LIST_UNIQUE) THEN + REWRITE_TAC[GSYM FIND_FACE] THEN + ASM_SIMP_TAC[MEM_FIND_PAIR_LIST] THEN + MATCH_MP_TAC MEM_PREV_EL THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + MATCH_MP_TAC NEXT_PREV_ID THEN + ASM_SIMP_TAC[ALL_DISTINCT_FIND_FACE] THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + ASM_CASES_TAC `MEM (x:A#A) (list_of_darts ll)` THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[f_list] THEN + SUBGOAL_THEN `MEM (NEXT_EL (x:A#A) (find_face x ll)) (list_of_darts ll)` ASSUME_TAC THENL + [ + MATCH_MP_TAC MEM_FIND_FACE_IMP_MEM_DARTS THEN + EXISTS_TAC `x:A#A` THEN + MATCH_MP_TAC MEM_NEXT_EL THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `find_face (NEXT_EL x (find_face x ll)) ll = find_face (x:A#A) ll` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[FIND_FACE] THEN AP_TERM_TAC THEN + MATCH_MP_TAC (GSYM FIND_PAIR_LIST_UNIQUE) THEN + REWRITE_TAC[GSYM FIND_FACE] THEN + ASM_SIMP_TAC[MEM_FIND_PAIR_LIST] THEN + MATCH_MP_TAC MEM_NEXT_EL THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + MATCH_MP_TAC PREV_NEXT_ID THEN + ASM_SIMP_TAC[ALL_DISTINCT_FIND_FACE] THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]);; + + +let F_LIST_EXT_INVERSE_WORKS = prove(`!ll:((A)list)list. ALL_DISTINCT (list_of_darts ll) ==> + f_list_ext ll o inverse (f_list_ext ll) = I /\ inverse (f_list_ext ll) o f_list_ext ll = I`, + GEN_TAC THEN DISCH_TAC THEN + MATCH_MP_TAC PERMUTES_INVERSES_o THEN + EXISTS_TAC `(darts_of_list ll):(A#A)->bool` THEN + MATCH_MP_TAC F_LIST_EXT_PERMUTES_DARTS THEN + ASM_REWRITE_TAC[]);; + + + + +let N_EQ_E_FI = prove(`!ll:((A)list)list. ALL_DISTINCT (list_of_darts ll) ==> + n_list_ext ll = e_list_ext ll o (inverse (f_list_ext ll))`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[F_LIST_EXT_INVERSE] THEN + REWRITE_TAC[FUN_EQ_THM; o_THM] THEN GEN_TAC THEN + REWRITE_TAC[n_list_ext; e_list_ext; res] THEN + REWRITE_TAC[darts_of_list; IN_SET_OF_LIST] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `MEM (PREV_EL (x:A#A) (find_face x ll)) (list_of_darts ll)` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC MEM_FIND_FACE_IMP_MEM_DARTS THEN + EXISTS_TAC `x:A#A` THEN + MATCH_MP_TAC MEM_PREV_EL THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + + REWRITE_TAC[n_list]);; + + + +let N_LIST_EXT_PERMUTES_DARTS = prove(`!ll:((A)list)list. good_list ll ==> + (n_list_ext ll) permutes (darts_of_list ll)`, + REPEAT STRIP_TAC THEN FIRST_ASSUM MP_TAC THEN REWRITE_TAC[good_list] THEN STRIP_TAC THEN + ASM_SIMP_TAC[N_EQ_E_FI] THEN + MATCH_MP_TAC PERMUTES_COMPOSE THEN + ASM_SIMP_TAC[E_LIST_EXT_PERMUTES_DARTS] THEN + MATCH_MP_TAC PERMUTES_INVERSE THEN + ASM_SIMP_TAC[F_LIST_EXT_PERMUTES_DARTS]);; + + + +let E_N_F_ID = prove(`!ll:((A)list)list. good_list ll ==> + e_list_ext ll o n_list_ext ll o f_list_ext ll = I`, + REPEAT STRIP_TAC THEN FIRST_ASSUM MP_TAC THEN REWRITE_TAC[good_list] THEN STRIP_TAC THEN + ASM_SIMP_TAC[N_EQ_E_FI] THEN + SUBGOAL_THEN `!e (f:A#A->A#A) fi:(A#A)->(A#A). e o (e o fi) o f = (e o e) o (fi o f)` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[o_ASSOC]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[E_LIST_EXT_INVOLUTION; F_LIST_EXT_INVERSE_WORKS] THEN + REWRITE_TAC[I_O_ID]);; + + + +(* hypermap_of_list is a hypermap *) + +let HYPERMAP_OF_LIST = prove(`!ll:((A)list)list. good_list ll ==> + tuple_hypermap (hypermap_of_list ll) = + darts_of_list ll, e_list_ext ll, n_list_ext ll, f_list_ext ll`, + REWRITE_TAC[hypermap_of_list; GSYM Hypermap.hypermap_tybij] THEN + GEN_TAC THEN DISCH_TAC THEN FIRST_ASSUM MP_TAC THEN REWRITE_TAC[good_list] THEN STRIP_TAC THEN + ASM_SIMP_TAC[E_LIST_EXT_PERMUTES_DARTS; N_LIST_EXT_PERMUTES_DARTS; F_LIST_EXT_PERMUTES_DARTS; E_N_F_ID] THEN + REWRITE_TAC[darts_of_list; FINITE_SET_OF_LIST]);; + + +(* Set of faces *) + + + + +let NEXT_EL_MOD = prove(`!list (x:A). MEM x list ==> + NEXT_EL x list = EL ((INDEX x list + 1) MOD LENGTH list) list`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[NEXT_EL] THEN + ABBREV_TAC `n = LENGTH (list:(A)list)` THEN + SUBGOAL_THEN `1 <= n` ASSUME_TAC THENL + [ + UNDISCH_TAC `MEM (x:A) list` THEN + ASM_REWRITE_TAC[MEM_EXISTS_EL] THEN + STRIP_TAC THEN UNDISCH_TAC `i < n:num` THEN + ARITH_TAC; + ALL_TAC + ] THEN + COND_CASES_TAC THENL + [ + ASM_SIMP_TAC[ARITH_RULE `1 <= n ==> n - 1 + 1 = n`] THEN + MP_TAC (SPECL [`n:num`; `1`] MOD_MULT) THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= n ==> ~(n = 0)`; MULT_CLAUSES; EL]; + ALL_TAC + ] THEN + AP_THM_TAC THEN AP_TERM_TAC THEN + MATCH_MP_TAC (GSYM MOD_LT) THEN + MP_TAC (SPEC_ALL INDEX_LT_LENGTH) THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN ARITH_TAC);; + + + + +let NEXT_EL_POWER = prove(`!list (x:A) i. ALL_DISTINCT list /\ MEM x list ==> + ((\t. NEXT_EL t list) POWER i) x = EL ((INDEX x list + i) MOD (LENGTH list)) list`, + GEN_TAC THEN GEN_TAC THEN + ABBREV_TAC `n = LENGTH (list:(A)list)` THEN + ABBREV_TAC `k = INDEX (x:A) list` THEN + INDUCT_TAC THENL + [ + REWRITE_TAC[ADD_0; Hypermap.POWER_0; I_THM] THEN + STRIP_TAC THEN + SUBGOAL_THEN `k MOD n = k` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC MOD_LT THEN + EXPAND_TAC "k" THEN EXPAND_TAC "n" THEN + ASM_REWRITE_TAC[GSYM INDEX_LT_LENGTH]; + ALL_TAC + ] THEN + + EXPAND_TAC "k" THEN + MATCH_MP_TAC (GSYM EL_INDEX) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + SUBGOAL_THEN `~(n = 0)` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[MEM_EXISTS_EL] THEN + STRIP_TAC THEN UNDISCH_TAC `i' < n:num` THEN + ARITH_TAC; + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o check(is_imp o concl)) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_REWRITE_TAC[Hypermap.COM_POWER; o_THM] THEN + ABBREV_TAC `y:A = EL ((k + i) MOD n) list` THEN + MP_TAC (SPECL [`list:(A)list`; `y:A`] NEXT_EL_MOD) THEN + ANTS_TAC THENL + [ + REWRITE_TAC[MEM_EXISTS_EL] THEN + EXISTS_TAC `(k + i) MOD n` THEN + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[DIVISION]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> ASM_REWRITE_TAC[th]) THEN + SUBGOAL_THEN `INDEX (y:A) list = (k + i) MOD n` (fun th -> REWRITE_TAC[th]) THENL + [ + EXPAND_TAC "y" THEN + MATCH_MP_TAC INDEX_EL THEN + ASM_SIMP_TAC[DIVISION]; + ALL_TAC + ] THEN + + AP_THM_TAC THEN AP_TERM_TAC THEN + ASM_CASES_TAC `n = 1` THENL + [ + ASM_REWRITE_TAC[MOD_1]; + ALL_TAC + ] THEN + SUBGOAL_THEN `1 = 1 MOD n` (fun th -> ONCE_REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC (GSYM MOD_LT) THEN + ASM_REWRITE_TAC[ARITH_RULE `1 < n <=> ~(n = 0) /\ ~(n = 1)`]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[MOD_ADD_MOD] THEN + AP_THM_TAC THEN AP_TERM_TAC THEN + ARITH_TAC);; + + + + +let NEXT_EL_ORBIT = prove(`!(list:(A)list) x. ALL_DISTINCT list /\ MEM x list ==> + orbit_map (\t. NEXT_EL t list) x = set_of_list list`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `n = LENGTH (list:(A)list)` THEN + SUBGOAL_THEN `~(n = 0)` ASSUME_TAC THENL + [ + UNDISCH_TAC `MEM (x:A) list` THEN + ASM_REWRITE_TAC[MEM_EXISTS_EL] THEN + STRIP_TAC THEN UNDISCH_TAC `i < n:num` THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[Hypermap.orbit_map; EXTENSION; IN_SET_OF_LIST; IN_ELIM_THM] THEN + GEN_TAC THEN EQ_TAC THENL + [ + STRIP_TAC THEN POP_ASSUM MP_TAC THEN + ASM_SIMP_TAC[NEXT_EL_POWER] THEN DISCH_TAC THEN + MATCH_MP_TAC MEM_EL THEN + ASM_SIMP_TAC[DIVISION]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[MEM_EXISTS_EL] THEN + STRIP_TAC THEN + ASM_SIMP_TAC[NEXT_EL_POWER] THEN + ABBREV_TAC `k = INDEX (x:A) list` THEN + EXISTS_TAC `n - k + i:num` THEN + SUBGOAL_THEN `k < n:num` ASSUME_TAC THENL + [ + EXPAND_TAC "k" THEN EXPAND_TAC "n" THEN + ASM_REWRITE_TAC[GSYM INDEX_LT_LENGTH]; + ALL_TAC + ] THEN + REWRITE_TAC[GE; LE_0] THEN + AP_THM_TAC THEN AP_TERM_TAC THEN + ASM_SIMP_TAC[ARITH_RULE `k < n ==> k + n - k + i = n + i:num`] THEN + MP_TAC (SPECL [`1`; `n:num`; `i:num`] MOD_MULT_ADD) THEN + REWRITE_TAC[MULT_CLAUSES] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MATCH_MP_TAC (GSYM MOD_LT) THEN + ASM_REWRITE_TAC[]);; + + + + +let ORBIT_MAP_RES_LEMMA = prove(`!f (x:A) s. orbit_map f x SUBSET s ==> + orbit_map (res f s) x = orbit_map f x`, + REWRITE_TAC[SUBSET; Hypermap.orbit_map; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN + SUBGOAL_THEN `!n. (res f s POWER n) x = (f POWER n) (x:A)` ASSUME_TAC THENL + [ + INDUCT_TAC THEN REWRITE_TAC[Hypermap.POWER_0] THEN + ASM_REWRITE_TAC[Hypermap.COM_POWER; o_THM] THEN + REWRITE_TAC[res] THEN + SUBGOAL_THEN `(f POWER n) (x:A) IN s` (fun th -> REWRITE_TAC[th]) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + EXISTS_TAC `n:num` THEN + REWRITE_TAC[GE; LE_0]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[]);; + + + +let ORBIT_SUBSET_LEMMA = prove(`!f s (x:A). x IN s /\ (!y. y IN s ==> f y IN s) + ==> orbit_map f x SUBSET s`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[Hypermap.orbit_map; SUBSET; IN_ELIM_THM] THEN + GEN_TAC THEN DISCH_THEN CHOOSE_TAC THEN POP_ASSUM MP_TAC THEN + SPEC_TAC (`x':A`, `y:A`) THEN + SPEC_TAC (`n:num`, `n:num`) THEN + INDUCT_TAC THEN ASM_SIMP_TAC[GE; LE_0; Hypermap.POWER_0; I_THM] THEN + GEN_TAC THEN REWRITE_TAC[Hypermap.COM_POWER; o_THM] THEN + DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `(f POWER n) (x:A)`) THEN + ASM_REWRITE_TAC[GE; LE_0]);; + + + + +let ORBIT_MAP_RES = prove(`!f (x:A) s. x IN s /\ (res f s) permutes s + ==> orbit_map (res f s) x = orbit_map f x`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC ORBIT_MAP_RES_LEMMA THEN + MATCH_MP_TAC ORBIT_SUBSET_LEMMA THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `(f:A->A) y = (res f s) y` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[res]; + ALL_TAC + ] THEN + MP_TAC (ISPECL [`res (f:A->A) s`; `s:A->bool`] Hypermap_and_fan.PERMUTES_IMP_INSIDE) THEN + ASM_SIMP_TAC[]);; + + + + +let F_LIST_EXT_ORBIT = prove(`!ll (x:A#A). MEM x (list_of_darts ll) /\ ALL_DISTINCT (list_of_darts ll) ==> + orbit_map (f_list_ext ll) x = set_of_list (find_face x ll)`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL F_LIST_EXT_PERMUTES_DARTS) THEN + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[f_list_ext] THEN + DISCH_TAC THEN + SUBGOAL_THEN `x:A#A IN darts_of_list ll` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[darts_of_list; IN_SET_OF_LIST]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[ORBIT_MAP_RES] THEN + + REWRITE_TAC[Hypermap.orbit_map] THEN + SUBGOAL_THEN `!n. (f_list ll POWER n) x = ((\d:A#A. NEXT_EL d (find_face x ll)) POWER n) x` ASSUME_TAC THENL + [ + INDUCT_TAC THENL + [ + REWRITE_TAC[Hypermap.POWER_0; I_THM]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[Hypermap.COM_POWER; o_THM] THEN + REWRITE_TAC[f_list] THEN + AP_TERM_TAC THEN + MATCH_MP_TAC MEM_FIND_FACE_IMP_FACES_EQ THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (ISPECL [`find_face (x:A#A) ll`; `x:A#A`; `n:num`] NEXT_EL_POWER) THEN + ANTS_TAC THENL + [ + ASM_SIMP_TAC[ALL_DISTINCT_FIND_FACE] THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[MEM_EXISTS_EL] THEN + ABBREV_TAC `f:(A#A)list = find_face x ll` THEN + EXISTS_TAC `(INDEX (x:A#A) f + n) MOD LENGTH f` THEN + REWRITE_TAC[] THEN + SUBGOAL_THEN `~(LENGTH (f:(A#A)list) = 0)` ASSUME_TAC THENL + [ + MP_TAC (SPEC_ALL (SPECL [`x:A#A`] DART_IN_FACE)) THEN + ASM_REWRITE_TAC[MEM_EXISTS_EL] THEN + STRIP_TAC THEN UNDISCH_TAC `i < LENGTH (f:(A#A)list)` THEN + ARITH_TAC; + ALL_TAC + ] THEN + ASM_SIMP_TAC[DIVISION]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[GSYM Hypermap.orbit_map] THEN + MATCH_MP_TAC NEXT_EL_ORBIT THEN + ASM_SIMP_TAC[ALL_DISTINCT_FIND_FACE; GSYM DART_IN_FACE]);; + + + +let ALL_DISTINCT_FLATTEN = prove(`!ll:((A)list)list. + ALL_DISTINCT (FLATTEN ll) /\ ALL (\l. ~(l = [])) ll ==> ALL_DISTINCT ll`, + LIST_INDUCT_TAC THEN REWRITE_TAC[FLATTEN; ALL_DISTINCT_ALT] THEN + REWRITE_TAC[ITLIST; ALL] THEN + REWRITE_TAC[GSYM FLATTEN; ALL_DISTINCT_APPEND] THEN + STRIP_TAC THEN + MP_TAC (SPECL [`h:(A)list`; `FLATTEN t:(A)list`] ALL_DISTINCT_APPEND) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + ASM_SIMP_TAC[] THEN + REPLICATE_TAC 5 (POP_ASSUM MP_TAC) THEN POP_ASSUM (fun th -> ALL_TAC) THEN + SPEC_TAC (`t:((A)list)list`, `t:((A)list)list`) THEN + LIST_INDUCT_TAC THEN REWRITE_TAC[MEM] THEN + REWRITE_TAC[ALL; FLATTEN; ITLIST] THEN + REWRITE_TAC[GSYM FLATTEN] THEN + REWRITE_TAC[APPEND_ASSOC; DE_MORGAN_THM] THEN + REPEAT STRIP_TAC THENL + [ + MP_TAC (SPECL [`APPEND h h':(A)list`; `FLATTEN t:(A)list`] ALL_DISTINCT_APPEND) THEN + ASM_REWRITE_TAC[DE_MORGAN_THM] THEN + DISJ1_TAC THEN MATCH_MP_TAC MEM_IMP_NOT_ALL_DISTINCT_APPEND THEN + MP_TAC (ISPEC `h':(A)list` list_CASES) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + EXISTS_TAC `h'':A` THEN + ASM_REWRITE_TAC[MEM]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) THEN + REPEAT ANTS_TAC THEN ASM_REWRITE_TAC[] THENL + [ + REPLICATE_TAC 5 REMOVE_ASSUM THEN + POP_ASSUM MP_TAC THEN + ONCE_REWRITE_TAC[ALL_DISTINCT_APPEND_SYM] THEN + REWRITE_TAC[APPEND_ASSOC] THEN + DISCH_TAC THEN + MP_TAC (SPECL [`APPEND (FLATTEN t) h:(A)list`; `h':(A)list`] ALL_DISTINCT_APPEND) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + MP_TAC (SPECL [`h':(A)list`; `FLATTEN t:(A)list`] ALL_DISTINCT_APPEND) THEN + ASM_SIMP_TAC[]);; + + + +let FLATTEN_FILTER_EMPTY = prove(`!ll:((A)list)list. + FLATTEN (FILTER (\l. ~(l = [])) ll) = FLATTEN ll`, + LIST_INDUCT_TAC THEN REWRITE_TAC[FLATTEN; FILTER; ITLIST] THEN + REWRITE_TAC[GSYM FLATTEN] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[APPEND] THEN + REWRITE_TAC[FLATTEN; ITLIST] THEN + ASM_REWRITE_TAC[GSYM FLATTEN]);; + + +let ALL_FILTER = prove(`!P list:(A)list. ALL P (FILTER P list)`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[FILTER; ALL] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[ALL]);; + + + + + +let ALL_DISTINCT_SUBLIST_UNIQUE = prove(`!l1 l2 (x:A) ll. ALL_DISTINCT (FLATTEN ll) /\ + MEM l1 ll /\ MEM l2 ll /\ MEM x l1 /\ MEM x l2 + ==> l1 = l2`, + GEN_TAC THEN GEN_TAC THEN GEN_TAC THEN + LIST_INDUCT_TAC THEN REWRITE_TAC[MEM] THEN + REWRITE_TAC[FLATTEN; ITLIST] THEN + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + FIRST_X_ASSUM (MP_TAC o check (fun th -> (rator o concl) th = `ALL_DISTINCT:(A)list->bool`)) THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + DISCH_TAC THEN + MATCH_MP_TAC MEM_IMP_NOT_ALL_DISTINCT_APPEND THEN + EXISTS_TAC `x:A` THEN + FIRST_X_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[GSYM FLATTEN] THEN + REWRITE_TAC[MEM_FLATTEN] THEN + EXISTS_TAC `l2:(A)list` THEN + ASM_REWRITE_TAC[]; + + FIRST_X_ASSUM (MP_TAC o check (fun th -> (rator o concl) th = `ALL_DISTINCT:(A)list->bool`)) THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + DISCH_TAC THEN + MATCH_MP_TAC MEM_IMP_NOT_ALL_DISTINCT_APPEND THEN + EXISTS_TAC `x:A` THEN + FIRST_X_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[GSYM FLATTEN] THEN + REWRITE_TAC[MEM_FLATTEN] THEN + EXISTS_TAC `l1:(A)list` THEN + ASM_REWRITE_TAC[]; + + ALL_TAC + ] THEN + + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o (fun th -> MATCH_MP ALL_DISTINCT_APPEND th)) THEN + SIMP_TAC[GSYM FLATTEN]);; + + + + + +let ALL_DISTINCT_FACE_UNIQUE = prove(`!f1 f2 d (ll:((A)list)list). + ALL_DISTINCT (list_of_darts ll) /\ MEM f1 (list_of_faces ll) /\ + MEM f2 (list_of_faces ll) /\ MEM d f1 /\ MEM d f2 ==> f1 = f2`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC ALL_DISTINCT_SUBLIST_UNIQUE THEN + EXISTS_TAC `d:A#A` THEN + EXISTS_TAC `list_of_faces ll:((A#A)list)list` THEN + ASM_REWRITE_TAC[GSYM LIST_OF_DARTS]);; + + + + +let MEM_FACE_LEMMA = prove(`!f (ll:((A)list)list). good_list ll /\ + MEM f (list_of_faces ll) ==> + ?d. MEM d (list_of_darts ll) /\ f = find_face d ll`, + REWRITE_TAC[good_list] THEN REPEAT STRIP_TAC THEN + EXISTS_TAC `HD f:A#A` THEN + POP_ASSUM MP_TAC THEN + MP_TAC (ISPEC `f:(A#A)list` list_CASES) THEN + STRIP_TAC THENL + [ + ASM_REWRITE_TAC[list_of_faces; MEM_MAP] THEN + STRIP_TAC THEN POP_ASSUM (MP_TAC o SYM) THEN + REWRITE_TAC[LIST_PAIRS_EMPTY] THEN DISCH_TAC THEN + UNDISCH_TAC `ALL (\l:(A)list. ~(l = [])) ll` THEN + REWRITE_TAC[GSYM ALL_MEM] THEN + DISCH_THEN (MP_TAC o SPEC `x:(A)list`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[HD] THEN DISCH_TAC THEN + SUBGOAL_THEN `MEM (h:A#A) (list_of_darts ll)` ASSUME_TAC THENL + [ + REWRITE_TAC[LIST_OF_DARTS; MEM_FLATTEN] THEN + EXISTS_TAC `f:(A#A)list` THEN + ASM_REWRITE_TAC[MEM]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC ALL_DISTINCT_FACE_UNIQUE THEN + EXISTS_TAC `h:A#A` THEN + EXISTS_TAC `ll:((A)list)list` THEN + ASM_REWRITE_TAC[MEM] THEN + ASM_SIMP_TAC[MEM_FIND_FACE] THEN + ASM_REWRITE_TAC[GSYM DART_IN_FACE]);; + + + + + + + + +let FACE_SET_EQ_LIST = prove(`!ll:((A)list)list. good_list ll ==> + face_set (hypermap_of_list ll) = set_of_list (faces_of_list ll)`, + REPEAT STRIP_TAC THEN FIRST_ASSUM MP_TAC THEN REWRITE_TAC[good_list] THEN STRIP_TAC THEN + ASM_SIMP_TAC[Hypermap.face_set; Hypermap.face_map; Hypermap.dart; HYPERMAP_OF_LIST] THEN + REWRITE_TAC[Hypermap.set_of_orbits] THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_SET_OF_LIST] THEN + + X_GEN_TAC `f:(A#A->bool)` THEN + REWRITE_TAC[GSYM EXTENSION] THEN + EQ_TAC THENL + [ + DISCH_THEN (X_CHOOSE_THEN `d:A#A` MP_TAC) THEN + REWRITE_TAC[darts_of_list; IN_SET_OF_LIST] THEN + STRIP_TAC THEN POP_ASSUM MP_TAC THEN + ASM_SIMP_TAC[F_LIST_EXT_ORBIT] THEN + DISCH_TAC THEN + REWRITE_TAC[faces_of_list; MEM_MAP] THEN + EXISTS_TAC `find_face (d:A#A) ll` THEN + ASM_SIMP_TAC[MEM_FIND_FACE]; + ALL_TAC + ] THEN + + REWRITE_TAC[faces_of_list; MEM_MAP] THEN + DISCH_THEN (X_CHOOSE_THEN `ff:(A#A)list` ASSUME_TAC) THEN + MP_TAC (SPECL [`ff:(A#A)list`; `ll:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + EXISTS_TAC `d:A#A` THEN + ASM_REWRITE_TAC[darts_of_list; IN_SET_OF_LIST] THEN + ASM_SIMP_TAC[F_LIST_EXT_ORBIT]);; + + +(* Define nodes of a good hypermap *) +let good_list_nodes = new_definition `good_list_nodes L <=> + node_set (hypermap_of_list L) = set_of_list (nodes_of_list L)`;; + + + + +let COMPONENTS_HYPERMAP_OF_LIST = prove(`!L:((A)list)list. good_list L ==> + dart (hypermap_of_list L) = darts_of_list L /\ + edge_map (hypermap_of_list L) = e_list_ext L /\ + node_map (hypermap_of_list L) = n_list_ext L /\ + face_map (hypermap_of_list L) = f_list_ext L`, + GEN_TAC THEN DISCH_TAC THEN + REWRITE_TAC[Hypermap.dart; Hypermap.edge_map; Hypermap.node_map; Hypermap.face_map] THEN + ASM_SIMP_TAC[HYPERMAP_OF_LIST]);; + + + + +let SET_OF_LIST_FILTER = prove(`!P list:(A)list. + set_of_list (FILTER P list) = {x | MEM x list /\ P x}`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[FILTER; MEM] THENL + [ + REWRITE_TAC[set_of_list] THEN SET_TAC[]; + ALL_TAC + ] THEN + COND_CASES_TAC THENL + [ + ASM_REWRITE_TAC[set_of_list] THEN + POP_ASSUM MP_TAC THEN SET_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN SET_TAC[]);; + + + +let SET_OF_LIST_REMOVE_DUPLICATES = prove(`!list:(A)list. + set_of_list (REMOVE_DUPLICATES list) = set_of_list list`, + LIST_INDUCT_TAC THEN REWRITE_TAC[REMOVE_DUPLICATES; set_of_list] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM IN_SET_OF_LIST] THEN + SET_TAC[]);; + + + + +let SET_OF_LIST_FLATTEN = prove(`!list:((A)list)list. + set_of_list (FLATTEN list) = UNIONS {set_of_list l | MEM l list}`, + LIST_INDUCT_TAC THEN REWRITE_TAC[FLATTEN; ITLIST; MEM] THENL + [ + SET_TAC[set_of_list]; + ALL_TAC + ] THEN + REWRITE_TAC[GSYM FLATTEN] THEN + ASM_REWRITE_TAC[SET_OF_LIST_APPEND] THEN + SET_TAC[]);; + + + + +let NODE_OF_LIST_LEMMA = prove(`!(x:A) L. + set_of_list (FILTER (\d. FST d = x) (list_of_darts L)) + = {(x, y) | y | (x, y) IN darts_of_list L}`, + REWRITE_TAC[SET_OF_LIST_FILTER; darts_of_list; IN_SET_OF_LIST] THEN + REPEAT GEN_TAC THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN + X_GEN_TAC `d:A#A` THEN + EQ_TAC THEN STRIP_TAC THENL + [ + EXISTS_TAC `SND (d:A#A)` THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ASM_REWRITE_TAC[] + ]);; + + + + +let NODES_OF_LIST = prove(`!L:((A)list)list. set_of_list (nodes_of_list L) + = {{(x, y) | y | (x, y) IN darts_of_list L} | x | x IN elements_of_list L}`, + REWRITE_TAC[nodes_of_list; list_of_nodes] THEN + REWRITE_TAC[SET_OF_LIST_MAP] THEN + REWRITE_TAC[GSYM IMAGE_LEMMA; IN_ELIM_THM; GSYM elements_of_list] THEN + GEN_TAC THEN + REWRITE_TAC[EXTENSION] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + X_GEN_TAC `y:A#A->bool` THEN + EQ_TAC THEN STRIP_TAC THENL + [ + POP_ASSUM MP_TAC THEN + ASM_REWRITE_TAC[NODE_OF_LIST_LEMMA] THEN + DISCH_TAC THEN + EXISTS_TAC `x':A` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + EXISTS_TAC `FILTER (\d. FST d = x:A) (list_of_darts L)` THEN + ASM_REWRITE_TAC[NODE_OF_LIST_LEMMA] THEN + EXISTS_TAC `x:A` THEN + ASM_REWRITE_TAC[]);; + + + +let GOOD_LIST_NODE = prove(`!L (d:A#A). good_list L /\ good_list_nodes L /\ d IN darts_of_list L + ==> node (hypermap_of_list L) d = {(FST d, x) | x | (FST d, x) IN darts_of_list L}`, + REWRITE_TAC[good_list_nodes; Hypermap.node_set; Hypermap.set_of_orbits] THEN + REWRITE_TAC[GSYM Hypermap.node] THEN + REWRITE_TAC[NODES_OF_LIST] THEN + REPEAT GEN_TAC THEN + GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [EXTENSION] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `node (hypermap_of_list L) (d:A#A)`) THEN + SUBGOAL_THEN `?x:A#A. x IN dart (hypermap_of_list L) /\ node (hypermap_of_list L) d = node (hypermap_of_list L) x` ASSUME_TAC THENL + [ + EXISTS_TAC `d:A#A` THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (ISPECL [`hypermap_of_list (L:((A)list)list)`; `d:A#A`] Hypermap.node_refl) THEN + ASM_REWRITE_TAC[IN_ELIM_THM] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[]);; + + +let PREV_EL_LIST_PAIRS_GENERAL = prove(`!x (y:A) list. MEM (x,y) (list_pairs list) + ==> ?z. PREV_EL (x,y) (list_pairs list) = (z, x) /\ MEM (z,x) (list_pairs list)`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `z = FST (PREV_EL (x:A,y) (list_pairs list))` THEN + EXISTS_TAC `z:A` THEN + SUBGOAL_THEN `PREV_EL (x:A,y) (list_pairs list) = z,x` ASSUME_TAC THENL + [ + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[PREV_EL] THEN + ABBREV_TAC `k = INDEX (x:A,y) (list_pairs list)` THEN + ABBREV_TAC `n = LENGTH (list:(A)list)` THEN + SUBGOAL_THEN `k < n:num` ASSUME_TAC THENL + [ + MP_TAC (SPEC `list:(A)list` LENGTH_LIST_PAIRS) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + EXPAND_TAC "k" THEN + ASM_REWRITE_TAC[GSYM INDEX_LT_LENGTH]; + ALL_TAC + ] THEN + + COND_CASES_TAC THENL + [ + MP_TAC (ISPEC `list_pairs (list:(A)list)` LAST_EL) THEN + ANTS_TAC THENL + [ + DISCH_TAC THEN + UNDISCH_TAC `MEM (x:A,y) (list_pairs list)` THEN + ASM_REWRITE_TAC[MEM]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ASM_REWRITE_TAC[LENGTH_LIST_PAIRS] THEN + MP_TAC (SPECL [`n - 1`; `list:(A)list`] EL_LIST_PAIRS) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC (ARITH_RULE `k < n ==> n - 1 < n`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th; PAIR_EQ]) THEN + MP_TAC (ISPECL [`(x:A,y:A)`; `list_pairs (list:(A)list)`] EL_INDEX) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL [`0`; `list:(A)list`] EL_LIST_PAIRS) THEN + ANTS_TAC THENL + [ + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> SIMP_TAC[th; PAIR_EQ]); + ALL_TAC + ] THEN + + MP_TAC (SPECL [`k - 1`; `list:(A)list`] EL_LIST_PAIRS) THEN + ASM_SIMP_TAC[ARITH_RULE `k < n ==> k - 1 < n`; PAIR_EQ] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + ASM_SIMP_TAC[ARITH_RULE `k < n /\ ~(k = 0) ==> ~(k - 1 = n - 1)`] THEN + ASM_SIMP_TAC[ARITH_RULE `~(k = 0) ==> k - 1 + 1 = k`] THEN + EXPAND_TAC "k" THEN + MP_TAC (ISPECL [`(x:A,y:A)`; `list_pairs (list:(A)list)`] EL_INDEX) THEN + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[EL_LIST_PAIRS; PAIR_EQ]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC MEM_PREV_EL THEN + ASM_REWRITE_TAC[]);; + + + +let N_LIST_EXT_FST = prove(`!(x:A) y L. good_list L /\ (x,y) IN darts_of_list L + ==> ?z. n_list_ext L (x,y) = (x,z) /\ (x,z) IN darts_of_list L`, + REPEAT STRIP_TAC THEN FIRST_ASSUM MP_TAC THEN + REWRITE_TAC[darts_of_list; IN_SET_OF_LIST] THEN + GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV)[DART_IN_FACE] THEN + REWRITE_TAC[FIND_FACE] THEN + STRIP_TAC THEN + MP_TAC (SPECL[`x:A`; `y:A`; `find_pair_list (x:A,y) L`] PREV_EL_LIST_PAIRS_GENERAL) THEN + ASM_REWRITE_TAC[] THEN + + STRIP_TAC THEN + EXISTS_TAC `z:A` THEN + SUBGOAL_THEN `n_list_ext L (x,y) = x,z:A` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[n_list_ext; res; n_list; FIND_FACE; e_list]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[GSYM IN_SET_OF_LIST; GSYM darts_of_list] THEN + MP_TAC (ISPECL[`n_list_ext (L:((A)list)list)`; `darts_of_list (L:((A)list)list)`] PERMUTES_IMP_INSIDE) THEN + ASM_SIMP_TAC[N_LIST_EXT_PERMUTES_DARTS] THEN + DISCH_THEN (MP_TAC o SPEC `x:A,y:A`) THEN + ASM_SIMP_TAC[]);; + + + + + +let LIST_EXT_POWER_IN_DARTS = prove(`!(d:A#A) L n. good_list L /\ d IN darts_of_list L + ==> (e_list_ext L POWER n) d IN darts_of_list L /\ + (n_list_ext L POWER n) d IN darts_of_list L /\ + (f_list_ext L POWER n) d IN darts_of_list L`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + ABBREV_TAC `H = hypermap_of_list (L:((A)list)list)` THEN + MP_TAC (SPEC_ALL COMPONENTS_HYPERMAP_OF_LIST) THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THENL + [ + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `edge H (d:A#A)` THEN + MP_TAC (ISPECL [`H:(A#A)hypermap`; `d:A#A`] Hypermap.lemma_edge_subset) THEN + ASM_SIMP_TAC[Hypermap.edge; Hypermap.orbit_map] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + DISCH_TAC THEN + EXISTS_TAC `n:num` THEN + REWRITE_TAC[GE; LE_0]; + + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `node H (d:A#A)` THEN + MP_TAC (ISPECL [`H:(A#A)hypermap`; `d:A#A`] Hypermap.lemma_node_subset) THEN + ASM_SIMP_TAC[Hypermap.node; Hypermap.orbit_map] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + DISCH_TAC THEN + EXISTS_TAC `n:num` THEN + REWRITE_TAC[GE; LE_0]; + + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `face H (d:A#A)` THEN + MP_TAC (ISPECL [`H:(A#A)hypermap`; `d:A#A`] Hypermap.lemma_face_subset) THEN + ASM_SIMP_TAC[Hypermap.face; Hypermap.orbit_map] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + DISCH_TAC THEN + EXISTS_TAC `n:num` THEN + REWRITE_TAC[GE; LE_0]; + ]);; + + + +let FST_N_LIST_EXT_POWER = prove(`!x (y:A) L n. good_list L /\ x,y IN darts_of_list L + ==> FST ((n_list_ext L POWER n) (x,y)) = x`, + GEN_TAC THEN GEN_TAC THEN GEN_TAC THEN + INDUCT_TAC THEN REWRITE_TAC[Hypermap.POWER_0; I_THM] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ABBREV_TAC `d = (n_list_ext L POWER n) (x:A,y)` THEN + ASM_REWRITE_TAC[Hypermap.COM_POWER; o_THM] THEN + MP_TAC (SPECL [`FST (d:A#A)`; `SND (d:A#A)`; `L:((A)list)list`] N_LIST_EXT_FST) THEN + ASM_REWRITE_TAC[PAIR] THEN + ANTS_TAC THENL + [ + EXPAND_TAC "d" THEN + ASM_SIMP_TAC[LIST_EXT_POWER_IN_DARTS]; + ALL_TAC + ] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[]);; + + + + +let MEM_LIST_PAIRS_EXISTS = prove(`!x l. MEM x l <=> ?y:A. MEM (x,y) (list_pairs l)`, + REPEAT GEN_TAC THEN + EQ_TAC THENL + [ + DISCH_TAC THEN + EXISTS_TAC `NEXT_EL (x:A) l` THEN + REWRITE_TAC[MEM_EXISTS_EL] THEN + EXISTS_TAC `INDEX (x:A) l` THEN + REWRITE_TAC[LENGTH_LIST_PAIRS] THEN + ASM_REWRITE_TAC[GSYM INDEX_LT_LENGTH] THEN + ASM_SIMP_TAC[GSYM INDEX_LT_LENGTH; EL_LIST_PAIRS] THEN + ASM_SIMP_TAC[EL_INDEX; PAIR_EQ; NEXT_EL] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[EL]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[MEM_LIST_PAIRS]);; + + + + +let MEM_LIST_OF_DARTS = prove(`!d L. MEM d (list_of_darts L) <=> + ?l:(A)list. MEM l L /\ MEM d (list_pairs l)`, + REPEAT GEN_TAC THEN EQ_TAC THENL + [ + SPEC_TAC (`L:((A)list)list`, `L:((A)list)list`) THEN + LIST_INDUCT_TAC THEN REWRITE_TAC[list_of_darts; ITLIST; MEM] THEN + REWRITE_TAC[GSYM list_of_darts; MEM_APPEND] THEN + STRIP_TAC THENL + [ + EXISTS_TAC `h:(A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + EXISTS_TAC `l:(A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + STRIP_TAC THEN + MATCH_MP_TAC DART_IN_DARTS THEN + EXISTS_TAC `l:(A)list` THEN ASM_REWRITE_TAC[]);; + + + + +let MEM_LIST_OF_ELEMENTS = prove(`!x L. MEM x (list_of_elements L) <=> + ?y:A. MEM (x,y) (list_of_darts L)`, + REWRITE_TAC[list_of_elements; MEM_REMOVE_DUPLICATES; MEM_FLATTEN] THEN + REWRITE_TAC[MEM_LIST_OF_DARTS] THEN + ONCE_REWRITE_TAC[SWAP_EXISTS_THM] THEN + REWRITE_TAC[RIGHT_EXISTS_AND_THM] THEN + REWRITE_TAC[GSYM MEM_LIST_PAIRS_EXISTS]);; + + + + + +let ALL_DISTINCT_FILTER = prove(`!(P:A->bool) l. ALL_DISTINCT l ==> ALL_DISTINCT (FILTER P l)`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[ALL_DISTINCT_ALT; FILTER] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[ALL_DISTINCT_ALT; MEM_FILTER]);; + + + + +let ALL_DISTINCT_NODE = prove(`!L (n:(A#A)list). good_list L /\ MEM n (list_of_nodes L) + ==> ALL_DISTINCT n`, + REWRITE_TAC[good_list; list_of_nodes; MEM_MAP] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC ALL_DISTINCT_FILTER THEN + ASM_REWRITE_TAC[]);; + + + + +let ALL_DISTINCT_FACE = prove(`!L (f:(A#A)list). good_list L /\ MEM f (list_of_faces L) + ==> ALL_DISTINCT f`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`f:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC ALL_DISTINCT_FIND_FACE THEN + UNDISCH_TAC `good_list (L:((A)list)list)` THEN + SIMP_TAC[good_list]);; + + + + + +let LIST_OF_EDGES = prove(`!L:((A)list)list. good_list L ==> + hyp_edge_pairs (hypermap_of_list L) = set_of_list (list_of_edges L)`, + REWRITE_TAC[hyp_edge_pairs; list_of_edges] THEN + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST] THEN + REWRITE_TAC[darts_of_list; e_list_ext; e_list; res; IN_SET_OF_LIST] THEN + REWRITE_TAC[EXTENSION; IN_SET_OF_LIST; IN_ELIM_THM; MEM_MAP] THEN + GEN_TAC THEN EQ_TAC THEN STRIP_TAC THENL + [ + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + EXISTS_TAC `x':A#A` THEN + ASM_REWRITE_TAC[]; + EXISTS_TAC `x':A#A` THEN + ASM_REWRITE_TAC[] + ]);; + + +(* Theorems for special lists *) + +let FACE_OF_LIST = prove(`!L (x:A#A). good_list L /\ MEM x (list_of_darts L) ==> + face (hypermap_of_list L) x = set_of_list (find_face x L)`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC `L:((A)list)list` FACE_SET_EQ_LIST) THEN + ASM_REWRITE_TAC[Hypermap.face_set; Hypermap.set_of_orbits; GSYM Hypermap.face] THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST; darts_of_list; IN_SET_OF_LIST] THEN + GEN_REWRITE_TAC LAND_CONV [EXTENSION] THEN + DISCH_THEN (MP_TAC o SPEC `face (hypermap_of_list L) (x:A#A)`) THEN + REWRITE_TAC[IN_ELIM_THM] THEN + DISCH_THEN (MP_TAC o MATCH_MP (TAUT `(A <=> B) ==> (A ==> B)`)) THEN + ANTS_TAC THENL + [ + EXISTS_TAC `x:A#A` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[IN_SET_OF_LIST; faces_of_list; MEM_MAP] THEN + DISCH_THEN (X_CHOOSE_THEN `f:(A#A)list` STRIP_ASSUME_TAC) THEN + + MP_TAC (SPECL [`f:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + AP_TERM_TAC THEN + MATCH_MP_TAC (GSYM MEM_FIND_FACE_IMP_FACES_EQ) THEN + CONJ_TAC THENL + [ + UNDISCH_TAC `good_list (L:((A)list)list)` THEN + SIMP_TAC[good_list]; + ALL_TAC + ] THEN + + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REMOVE_ASSUM THEN + REWRITE_TAC[GSYM IN_SET_OF_LIST] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[Hypermap.face_refl]);; + + + +let CARD_FACE_OF_LIST = prove(`!L (x:A#A). good_list L /\ MEM x (list_of_darts L) ==> + CARD (face (hypermap_of_list L) x) = LENGTH (find_face x L)`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[FACE_OF_LIST] THEN + MATCH_MP_TAC CARD_SET_OF_LIST_ALL_DISTINCT THEN + MATCH_MP_TAC ALL_DISTINCT_FIND_FACE THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[good_list]);; + + +let LIST_OF_FACES_n = prove(`!(L:((A)list)list) n. good_list L ==> + {f | f IN face_set (hypermap_of_list L) /\ CARD f = n} = + set_of_list (MAP set_of_list (FILTER (\f. LENGTH f = n) (list_of_faces L)))`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[good_list] THEN STRIP_TAC THEN + REWRITE_TAC[Hypermap.face_set; Hypermap.set_of_orbits; GSYM Hypermap.face] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST] THEN + REWRITE_TAC[darts_of_list; IN_SET_OF_LIST] THEN + REWRITE_TAC[EXTENSION] THEN + X_GEN_TAC `f:A#A->bool` THEN + REWRITE_TAC[GSYM EXTENSION] THEN + REWRITE_TAC[IN_ELIM_THM; IN_SET_OF_LIST; MEM_MAP; MEM_FILTER] THEN + EQ_TAC THENL + [ + STRIP_TAC THEN + EXISTS_TAC `find_face (x:A#A) L` THEN + ASM_SIMP_TAC[MEM_FIND_FACE; FACE_OF_LIST] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[CARD_FACE_OF_LIST]; + DISCH_THEN (X_CHOOSE_THEN `l:(A#A)list` STRIP_ASSUME_TAC) THEN + MP_TAC (SPECL[`l:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + CONJ_TAC THENL + [ + EXISTS_TAC `d:A#A` THEN + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[FACE_OF_LIST]; + ALL_TAC + ] THEN + + UNDISCH_TAC `LENGTH (l:(A#A)list) = n` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC CARD_SET_OF_LIST_ALL_DISTINCT THEN + MATCH_MP_TAC ALL_DISTINCT_FIND_FACE THEN + ASM_REWRITE_TAC[] + ]);; + + + + +let LIST_OF_FACES3 = prove(`!L:((A)list)list. good_list L ==> + hyp_face3 (hypermap_of_list L) = + set_of_list (MAP set_of_list (list_of_faces3 L))`, + REWRITE_TAC[hyp_face3; list_of_faces3] THEN + REWRITE_TAC[LIST_OF_FACES_n]);; + + + +let LIST_OF_FACES4 = prove(`!L:((A)list)list. good_list L ==> + hyp_face4 (hypermap_of_list L) = + set_of_list (MAP set_of_list (list_of_faces4 L))`, + REWRITE_TAC[hyp_face4; list_of_faces4] THEN + REWRITE_TAC[LIST_OF_FACES_n]);; + + + +let LIST_OF_FACES5 = prove(`!L:((A)list)list. good_list L ==> + hyp_face5 (hypermap_of_list L) = + set_of_list (MAP set_of_list (list_of_faces5 L))`, + REWRITE_TAC[hyp_face5; list_of_faces5] THEN + REWRITE_TAC[LIST_OF_FACES_n]);; + + + +let LIST_OF_FACES6 = prove(`!L:((A)list)list. good_list L ==> + hyp_face6 (hypermap_of_list L) = + set_of_list (MAP set_of_list (list_of_faces6 L))`, + REWRITE_TAC[hyp_face6; list_of_faces6] THEN + REWRITE_TAC[LIST_OF_FACES_n]);; + + + + +let LIST_OF_DARTS3 = prove(`!L:((A)list)list. good_list L ==> + hyp_dart3 (hypermap_of_list L) = set_of_list (list_of_darts3 L)`, + REWRITE_TAC[hyp_dart3; list_of_darts3; list_of_faces3] THEN + REPEAT STRIP_TAC THEN + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[good_list] THEN STRIP_TAC THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST] THEN + REWRITE_TAC[darts_of_list; IN_SET_OF_LIST; LIST_OF_DARTS] THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_SET_OF_LIST] THEN + REWRITE_TAC[MEM_FLATTEN; MEM_FILTER] THEN + GEN_TAC THEN EQ_TAC THEN STRIP_TAC THENL + [ + EXISTS_TAC `l:(A#A)list` THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL [`l:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `MEM (x:A#A) (list_of_darts L)` ASSUME_TAC THENL + [ + MATCH_MP_TAC MEM_FIND_FACE_IMP_MEM_DARTS THEN + EXISTS_TAC `d:A#A` THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + ASM_SIMP_TAC[CARD_FACE_OF_LIST] THEN + AP_TERM_TAC THEN + MATCH_MP_TAC (GSYM MEM_FIND_FACE_IMP_FACES_EQ) THEN + ASM_REWRITE_TAC[] THEN + REMOVE_ASSUM THEN POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + EXISTS_TAC `l:(A#A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`l:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + + SUBGOAL_THEN `MEM (x:A#A) (list_of_darts L)` ASSUME_TAC THENL + [ + MATCH_MP_TAC MEM_FIND_FACE_IMP_MEM_DARTS THEN + EXISTS_TAC `d:A#A` THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + ASM_SIMP_TAC[CARD_FACE_OF_LIST] THEN + UNDISCH_TAC `LENGTH (l:(A#A)list) = 3` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + AP_TERM_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC (MEM_FIND_FACE_IMP_FACES_EQ) THEN + ASM_REWRITE_TAC[] THEN + REMOVE_ASSUM THEN POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]));; + + + +let LIST_OF_DARTS4 = prove(`!L:((A)list)list. good_list L ==> + hyp_dart4 (hypermap_of_list L) = set_of_list (list_of_darts4 L)`, + REWRITE_TAC[hyp_dart4; list_of_darts4; list_of_faces4] THEN + REPEAT STRIP_TAC THEN + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[good_list] THEN STRIP_TAC THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST] THEN + REWRITE_TAC[darts_of_list; IN_SET_OF_LIST; LIST_OF_DARTS] THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_SET_OF_LIST] THEN + REWRITE_TAC[MEM_FLATTEN; MEM_FILTER] THEN + GEN_TAC THEN EQ_TAC THEN STRIP_TAC THENL + [ + EXISTS_TAC `l:(A#A)list` THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL [`l:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `MEM (x:A#A) (list_of_darts L)` ASSUME_TAC THENL + [ + MATCH_MP_TAC MEM_FIND_FACE_IMP_MEM_DARTS THEN + EXISTS_TAC `d:A#A` THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + ASM_SIMP_TAC[CARD_FACE_OF_LIST] THEN + AP_TERM_TAC THEN + MATCH_MP_TAC (GSYM MEM_FIND_FACE_IMP_FACES_EQ) THEN + ASM_REWRITE_TAC[] THEN + REMOVE_ASSUM THEN POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + EXISTS_TAC `l:(A#A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`l:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + + SUBGOAL_THEN `MEM (x:A#A) (list_of_darts L)` ASSUME_TAC THENL + [ + MATCH_MP_TAC MEM_FIND_FACE_IMP_MEM_DARTS THEN + EXISTS_TAC `d:A#A` THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + ASM_SIMP_TAC[CARD_FACE_OF_LIST] THEN + UNDISCH_TAC `LENGTH (l:(A#A)list) = 4` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + AP_TERM_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC (MEM_FIND_FACE_IMP_FACES_EQ) THEN + ASM_REWRITE_TAC[] THEN + REMOVE_ASSUM THEN POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]));; + + + +let LIST_OF_DARTS_X = prove(`!L:((A)list)list. good_list L ==> + hyp_dartX (hypermap_of_list L) = set_of_list (list_of_dartsX L)`, + REWRITE_TAC[hyp_dartX; list_of_dartsX; list_of_faces456] THEN + REPEAT STRIP_TAC THEN + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[good_list] THEN STRIP_TAC THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST] THEN + REWRITE_TAC[darts_of_list; IN_SET_OF_LIST; LIST_OF_DARTS] THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_SET_OF_LIST] THEN + REWRITE_TAC[MEM_FLATTEN; MEM_FILTER] THEN + GEN_TAC THEN EQ_TAC THEN STRIP_TAC THENL + [ + EXISTS_TAC `l:(A#A)list` THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN + MP_TAC (SPECL [`l:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `MEM (x:A#A) (list_of_darts L)` ASSUME_TAC THENL + [ + MATCH_MP_TAC MEM_FIND_FACE_IMP_MEM_DARTS THEN + EXISTS_TAC `d:A#A` THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + ASM_SIMP_TAC[CARD_FACE_OF_LIST] THEN + SUBGOAL_THEN `find_face (x:A#A) L = find_face d L` (fun th -> SIMP_TAC[th]) THEN + MATCH_MP_TAC MEM_FIND_FACE_IMP_FACES_EQ THEN + ASM_REWRITE_TAC[] THEN + REMOVE_ASSUM THEN POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + EXISTS_TAC `l:(A#A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`l:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + + SUBGOAL_THEN `MEM (x:A#A) (list_of_darts L)` ASSUME_TAC THENL + [ + MATCH_MP_TAC MEM_FIND_FACE_IMP_MEM_DARTS THEN + EXISTS_TAC `d:A#A` THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + ASM_SIMP_TAC[CARD_FACE_OF_LIST] THEN + UNDISCH_TAC `4 <= LENGTH (l:(A#A)list)` THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `find_face (x:A#A) L = find_face d L` (fun th -> SIMP_TAC[th]) THEN + MATCH_MP_TAC (MEM_FIND_FACE_IMP_FACES_EQ) THEN + ASM_REWRITE_TAC[] THEN + REMOVE_ASSUM THEN POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]));; + + diff --git a/formal_lp/old/ineqs/list_hypermap_computations.hl b/formal_lp/old/ineqs/list_hypermap_computations.hl new file mode 100644 index 0000000..993463d --- /dev/null +++ b/formal_lp/old/ineqs/list_hypermap_computations.hl @@ -0,0 +1,1712 @@ +(* Explicit computations for hypermap_of_list *) + +#load "str.cma";; + +open Str;; +open List;; + + +needs "../formal_lp/ineqs/list_hypermap.hl";; +needs "../formal_lp/ineqs/list_conversions.hl";; + + +let MY_PROVE_HYP hyp th = EQ_MP (DEDUCT_ANTISYM_RULE hyp th) hyp;; + + +let test n f x = + let start = Sys.time() in + for i = 1 to n do + let _ = f x in () + done; + Sys.time() -. start;; + + +(* Constants and variables *) +let hd_var_num = `hd:num` and + h_var_num = `h:num` and + h1_var_num = `h1:num` and + h2_var_num = `h2:num` and + t_var = `t:(num)list` and + x_var_pair = `x:num#num` and + acc_var = `acc:(num#num)list` and + f_var_fun = `f:num#num->num#num`;; + +let num_type = `:num`;; +let num_list_type = `:(num)list`;; +let num_list_list_type = `:((num)list)list`;; + +let mem_const = `MEM:(num#num)->(num#num)list->bool` and + f_const = `F`;; + + +let hypermap_of_list_const = `hypermap_of_list:((num)list)list->(num#num)hypermap` and + list_of_darts_const = `list_of_darts:((num)list)list->(num#num)list` and + list_of_edges_const = `list_of_edges:((num)list)list->((num#num)#(num#num))list` and + list_of_faces_const = `list_of_faces:((num)list)list->((num#num)list)list` and + list_of_nodes_const = `list_of_nodes:((num)list)list->((num#num)list)list` and + list_of_elements_const = `list_of_elements:((num)list)list->(num)list` and + list_of_faces3_const = `list_of_faces3:((num)list)list->((num#num)list)list` and + list_of_faces4_const = `list_of_faces4:((num)list)list->((num#num)list)list` and + list_of_faces5_const = `list_of_faces5:((num)list)list->((num#num)list)list` and + list_of_faces6_const = `list_of_faces6:((num)list)list->((num#num)list)list` and + list_of_darts3_const = `list_of_darts3:((num)list)list->(num#num)list` and + list_of_darts4_const = `list_of_darts4:((num)list)list->(num#num)list` and + list_of_dartsX_const = `list_of_dartsX:((num)list)list->(num#num)list` and + good_list_const = `good_list:((num)list)list->bool` and + good_list_nodes_const = `good_list_nodes:((num)list)list->bool`;; + + + +(* example of java style string from hypermap generator. *) +let pentstring = "13_150834109178 18 3 0 1 2 3 3 2 7 3 3 0 2 4 5 4 0 3 4 6 1 0 4 3 7 2 8 3 8 2 1 4 8 1 6 9 3 9 6 10 3 10 6 4 3 10 4 5 4 5 3 7 11 3 10 5 11 3 11 7 12 3 12 7 8 3 12 8 9 3 9 10 11 3 11 12 9 ";; +let test_string = "149438122187 18 6 0 1 2 3 4 5 4 0 5 6 7 3 6 5 4 3 6 4 8 3 8 4 3 3 8 3 9 3 9 3 2 3 9 2 10 3 10 2 11 3 11 2 1 3 11 1 0 3 11 0 7 3 10 11 7 3 10 7 12 3 12 7 6 3 12 6 8 3 12 8 9 3 9 10 12 ";; + +(* conversion to list. e.g. convert_to_list pentstring *) + +let convert_to_list = + let split_sp= Str.split (regexp " +") in + let strip_ = global_replace (regexp "_") "" in + let rec movelist n (x,a) = + if n=0 then (x,a) else match x with y::ys -> movelist (n-1) (ys, y::a) in + let getone (x,a) = match x with + | [] -> ([],a) + | y::ys -> let (u,v) = movelist y (ys,[]) in (u,v::a) in + let rec getall (x,a) = + if (x=[]) then (x,a) else getall (getone (x,a)) in + fun s -> + let h::ss = (split_sp (strip_ s)) in + let _::ns = map int_of_string ss in + let (_,a) = getall (ns,[]) in + (h,rev (map rev a));; + + + +let create_hol_list str = + let ll = snd (convert_to_list str) in + let s1 = map (map mk_small_numeral) ll in + let s2 = map (fun l -> mk_list (l, num_type)) s1 in + mk_list (s2, num_list_type);; + + + +(********************************************) + +(* MEM_CONV and related conversions *) + + +(* MY_NUM_EQ_CONV *) + +let NUMERAL_EQ = prove(`NUMERAL m = NUMERAL n <=> m = n`, REWRITE_TAC[NUMERAL]) and + NUM_EQ_00 = prove(`BIT0 m = BIT0 n <=> m = n`, REWRITE_TAC[BIT0] THEN ARITH_TAC) and + NUM_EQ_10 = prove(`BIT1 m = BIT0 n <=> F`, REWRITE_TAC[ARITH]) and + NUM_EQ_01 = prove(`BIT0 m = BIT1 n <=> F`, REWRITE_TAC[ARITH]) and + NUM_EQ_11 = prove(`BIT1 m = BIT1 n <=> m = n`, REWRITE_TAC[ARITH]) and + NUM_EQ_ZERO_B0 = prove(`_0 = BIT0 n <=> _0 = n`, REWRITE_TAC[ARITH]) and + NUM_EQ_B0_ZERO = prove(`BIT0 n = _0 <=> n = _0`, REWRITE_TAC[ARITH]) and + NUM_EQ_ZERO_B1 = prove(`_0 = BIT1 n <=> F`, REWRITE_TAC[ARITH]) and + NUM_EQ_B1_ZERO = prove(`BIT1 n = _0 <=> F`, REWRITE_TAC[ARITH]) and + NUM_EQ_ZERO_ZERO = prove(`_0 = _0 <=> T`, REWRITE_TAC[ARITH]);; + + +let zero_const = `_0` and + numeral_const = `NUMERAL` and + n_var_num = `n:num` and + m_var_num = `m:num`;; + +let rec raw_num_eq_conv tm = + let lhs, rhs = dest_eq tm in + if (is_comb lhs) then + let bm, m_tm = dest_comb lhs in + let bm_c = fst(dest_const bm) in + if (is_comb rhs) then + let bn, n_tm = dest_comb rhs in + let bn_c = fst(dest_const bn) in + if (bm_c = bn_c) then + let th0 = INST[m_tm, m_var_num; n_tm, n_var_num] + (if (bm_c = "BIT0") then NUM_EQ_00 else NUM_EQ_11) in + let th1 = raw_num_eq_conv (mk_eq (m_tm, n_tm)) in + TRANS th0 th1 + else + INST[m_tm, m_var_num; n_tm, n_var_num] + (if (bm_c = "BIT0") then NUM_EQ_01 else NUM_EQ_10) + else + if bm_c = "BIT0" then + let th0 = INST[m_tm, n_var_num] NUM_EQ_B0_ZERO in + let th1 = raw_num_eq_conv (mk_eq (m_tm, zero_const)) in + TRANS th0 th1 + else + INST[m_tm, n_var_num] NUM_EQ_B1_ZERO + else + if (is_comb rhs) then + let bn, n_tm = dest_comb rhs in + let bn_c = fst(dest_const bn) in + if (bn_c = "BIT0") then + let th0 = INST[n_tm, n_var_num] NUM_EQ_ZERO_B0 in + let th1 = raw_num_eq_conv (mk_eq (zero_const, n_tm)) in + TRANS th0 th1 + else + INST[n_tm, n_var_num] NUM_EQ_ZERO_B1 + else + NUM_EQ_ZERO_ZERO;; + + +let MY_NUM_EQ_CONV tm = + let lhs, rhs = dest_eq tm in + if lhs = rhs then EQT_INTRO (REFL lhs) else + let th0 = INST[rand lhs, m_var_num; rand rhs, n_var_num] NUMERAL_EQ in + let ltm, rtm = dest_eq (concl th0) in + if ltm <> tm then + failwith "MY_NUM_EQ_CONV" + else + TRANS th0 (raw_num_eq_conv rtm);; + +(* +let tm1 = `65535 = 32767`;; +let tm2 = `65535 = 65535`;; + +test 1000 NUM_EQ_CONV tm1;; (* 0.448 *) +test 1000 NUM_EQ_CONV tm2;; (* 0.488 *) + +test 1000 MY_NUM_EQ_CONV tm1;; (* 0.144 *) +test 1000 MY_NUM_EQ_CONV tm2;; (* 0.136 *) +*) + +(* NUM_PAIR_EQ_CONV *) + +let NUM_PAIR_EQ = UNDISCH_ALL (prove(`(n:num = x <=> T) ==> (m:num = y <=> T) ==> (n, m = x, y <=> T)`, SIMP_TAC[PAIR_EQ])) and + NUM_PAIR_NOT_EQ1 = UNDISCH_ALL (prove(`(n = x <=> F) ==> (n:num,m:num = x,y <=> F)`, SIMP_TAC[PAIR_EQ])) and + NUM_PAIR_NOT_EQ2 = UNDISCH_ALL (prove(`(m = y <=> F) ==> (n:num,m:num = x,y <=> F)`, SIMP_TAC[PAIR_EQ]));; + + +let t_const = `T` and f_const = `F` and + x_var_num = `x:num` and y_var_num = `y:num`;; + + +let NUM_PAIR_EQ_CONV tm = + let lhs, rhs = dest_eq tm in + if (lhs = rhs) then + EQT_INTRO (REFL lhs) + else + let n_tm, m_tm = dest_pair lhs in + let x_tm, y_tm = dest_pair rhs in + let inst = INST[n_tm, n_var_num; m_tm, m_var_num; x_tm, x_var_num; y_tm, y_var_num] in + let fst_th = MY_NUM_EQ_CONV (mk_eq (n_tm, x_tm)) in + if (rand(concl fst_th) = t_const) then + let snd_th = MY_NUM_EQ_CONV (mk_eq (m_tm, y_tm)) in + if (rand(concl snd_th) = t_const) then + let th0 = inst NUM_PAIR_EQ in + MY_PROVE_HYP fst_th (MY_PROVE_HYP snd_th th0) + else + let th0 = inst NUM_PAIR_NOT_EQ2 in + MY_PROVE_HYP snd_th th0 + else + let th0 = inst NUM_PAIR_NOT_EQ1 in + MY_PROVE_HYP fst_th th0;; + + + + +(* +let tm1 = `(12,4) = (12,4)` and + tm2 = `(12,4) = (12,5)`;; + +NUM_PAIR_EQ_CONV tm1;; +NUM_PAIR_EQ_CONV tm2;; +test 1000 NUM_PAIR_EQ_CONV tm1;; (* 0.016 *) +test 1000 NUM_PAIR_EQ_CONV tm2;; (* 0.040 *) +*) + + +(* MEM_NUM_CONV *) + +let MEM_NUM_EMPTY = prove(`MEM (n:num) [] <=> F`, REWRITE_TAC[MEM]) and + MEM_NUM_HD = UNDISCH_ALL (prove(`(n = h <=> T) ==> (MEM (n:num) (CONS h t) <=> T)`,SIMP_TAC[MEM])) and + MEM_NUM_TL = UNDISCH_ALL (prove(`(n = h <=> F) ==> (MEM (n:num) (CONS h t) <=> MEM n t)`, SIMP_TAC[MEM]));; + + +let h_var_num = `h:num` and + t_var_numlist = `t:(num)list`;; + + +let rec MEM_NUM_CONV tm = + let ltm, list_tm = dest_comb tm in + let n_tm = rand ltm in + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let eq_th = MY_NUM_EQ_CONV (mk_eq (n_tm, h_tm)) in + if (rand(concl eq_th) = t_const) then + let th0' = INST[n_tm, n_var_num; h_tm, h_var_num; t_tm, t_var_numlist] MEM_NUM_HD in + MY_PROVE_HYP eq_th th0' + else + let th0' = INST[n_tm, n_var_num; h_tm, h_var_num; t_tm, t_var_numlist] MEM_NUM_TL in + let th0 = MY_PROVE_HYP eq_th th0' in + let th1 = MEM_NUM_CONV (rand(concl th0)) in + TRANS th0 th1 + else + INST[n_tm, n_var_num] MEM_NUM_EMPTY;; + + + +(* MEM_NUM_PAIR_CONV *) + +let MEM_NUM_PAIR_EMPTY = prove(`MEM (n:num#num) [] <=> F`, REWRITE_TAC[MEM]) and + MEM_NUM_PAIR_HD = UNDISCH_ALL (prove(`(n = h <=> T) ==> (MEM (n:num#num) (CONS h t) <=> T)`,SIMP_TAC[MEM])) and + MEM_NUM_PAIR_TL = UNDISCH_ALL (prove(`(n = h <=> F) ==> (MEM (n:num#num) (CONS h t) <=> MEM n t)`, SIMP_TAC[MEM]));; + + +let n_var_numnum = `n:num#num` and + h_var_numnum = `h:num#num` and + t_var_numnumlist = `t:(num#num)list`;; + + +let rec MEM_NUM_PAIR_CONV tm = + let ltm, list_tm = dest_comb tm in + let n_tm = rand ltm in + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let eq_th = NUM_PAIR_EQ_CONV (mk_eq (n_tm, h_tm)) in + if (rand(concl eq_th) = t_const) then + let th0' = INST[n_tm, n_var_numnum; h_tm, h_var_numnum; t_tm, t_var_numnumlist] MEM_NUM_PAIR_HD in + MY_PROVE_HYP eq_th th0' + else + let th0' = INST[n_tm, n_var_numnum; h_tm, h_var_numnum; t_tm, t_var_numnumlist] MEM_NUM_PAIR_TL in + let th0 = MY_PROVE_HYP eq_th th0' in + let th1 = MEM_NUM_PAIR_CONV (rand(concl th0)) in + TRANS th0 th1 + else + INST[n_tm, n_var_numnum] MEM_NUM_PAIR_EMPTY;; + + +let MEM_REWRITE_CONV = REWRITE_CONV[MEM; PAIR_EQ; ARITH_EQ];; + + +(* +test 1000 MEM_NUM_PAIR_CONV `MEM (1,1) [1,2; 3,4; 2,1]`;; (* 0.140 *) +test 1000 MEM_REWRITE_CONV `MEM (1,1) [1,2; 3,4; 2,1]`;; (* 1.276 *) +*) + + + +(* LIST_PAIRS_CONV *) + +let LIST_PAIRS_REWRITE_CONV = REWRITE_CONV[list_pairs; shift_left; APPEND; ZIP];; + + +let list_pairs2 = define `list_pairs2 [] (hd:A) = [] /\ + list_pairs2 (CONS h []) hd = [h,hd] /\ + list_pairs2 (CONS h1 (CONS h2 t)) hd = CONS (h1,h2) (list_pairs2 (CONS h2 t) hd)`;; + + +let [list_pairs2_0; list_pairs2_1; list_pairs2_2] = map (INST_TYPE [`:num`, aty]) (CONJUNCTS list_pairs2);; + +let rec list_pairs2_raw_conv tm = + let ltm, h = dest_comb tm in + let list = rand ltm in + if (is_comb list) then + let h_list, t_list = dest_comb list in + let h_list = rand h_list in + if (is_comb t_list) then + let h2,t2 = dest_comb t_list in + let h2 = rand h2 in + let th0 = INST[h_list, h1_var_num; h2, h2_var_num; t2, t_var; h, hd_var_num] list_pairs2_2 in + let ltm, rtm = dest_comb (rand(concl th0)) in + let th1 = list_pairs2_raw_conv rtm in + TRANS th0 (AP_TERM ltm th1) + else + INST[h_list, h_var_num; h, hd_var_num] list_pairs2_1 + else + INST[h, hd_var_num] list_pairs2_0;; + + +(* +list_pairs2_raw_conv `list_pairs2 [1;2;3;4;5;6] 1`;; +test 1000 (list_pairs2_raw_conv) `list_pairs2 [1;2;3;4;5;6] 1`;; (* 0.072 *) +*) + +let EL_EQ_IMP_EQ = prove(`!l1 l2:(A)list. LENGTH l1 = LENGTH l2 /\ + (!i. i < LENGTH l1 ==> EL i l1 = EL i l2) ==> l1 = l2`, + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[LENGTH; NOT_SUC] THEN + REWRITE_TAC[SUC_INJ; injectivity "list"] THEN + REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `0`) THEN + REWRITE_TAC[LT_0; EL; HD]; + ALL_TAC + ] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `SUC i`) THEN + ASM_REWRITE_TAC[LT_SUC; EL; TL]);; + + +let LENGTH_LIST_PAIRS2 = prove(`!(x:A) list. LENGTH (list_pairs2 list x) = LENGTH list`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[list_pairs2; LENGTH] THEN + DISJ_CASES_TAC (ISPEC `t:(A)list` list_CASES) THENL + [ + ASM_REWRITE_TAC[list_pairs2; LENGTH]; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o check (is_eq o concl)) THEN + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + ASM_REWRITE_TAC[list_pairs2; LENGTH; SUC_INJ]);; + + +let EL_LIST_PAIRS2 = prove(`!(x:A) list i. i < LENGTH list ==> + EL i (list_pairs2 list x) = + EL i list, if i = LENGTH list - 1 then x else EL (i + 1) list`, + GEN_TAC THEN LIST_INDUCT_TAC THEN REWRITE_TAC[LENGTH; LT] THEN + REPEAT STRIP_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + DISJ_CASES_TAC (ISPEC `t:(A)list` list_CASES) THENL + [ + ASM_REWRITE_TAC[LENGTH; list_pairs2; EL; HD; ARITH_RULE `SUC 0 - 1 = 0`]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + ASM_REWRITE_TAC[LENGTH; list_pairs2; EL; TL; ARITH_RULE `SUC (SUC n) - 1 = SUC n`] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `LENGTH (t':(A)list)`) THEN + ASM_REWRITE_TAC[LENGTH; ARITH_RULE `SUC n - 1 = n`; ARITH_RULE `n < SUC n`]; + ALL_TAC + ] THEN + + DISJ_CASES_TAC (ISPEC `t:(A)list` list_CASES) THENL + [ + UNDISCH_TAC `i < LENGTH (t:(A)list)` THEN + ASM_REWRITE_TAC[LENGTH; LT]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + ASM_REWRITE_TAC[list_pairs2; ARITH_RULE `i + 1 = SUC i`; EL; TL] THEN + + DISJ_CASES_TAC (SPEC `i:num` num_CASES) THENL + [ + ASM_REWRITE_TAC[EL; HD; LENGTH; ARITH_RULE `~(0 = SUC(SUC n) - 1)`]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + ASM_REWRITE_TAC[EL; TL] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `n:num`) THEN + ASM_REWRITE_TAC[LENGTH; ARITH_RULE `n + 1 = SUC n`; EL; TL] THEN + REWRITE_TAC[ARITH_RULE `SUC n = SUC (SUC k) - 1 <=> n = SUC k - 1`] THEN + DISCH_THEN MATCH_MP_TAC THEN + UNDISCH_TAC `i < LENGTH (t:(A)list)` THEN + ASM_REWRITE_TAC[LENGTH; LT_SUC] THEN + ARITH_TAC);; + + +let LIST_PAIRS2 = prove(`!list:(A)list. list_pairs list = list_pairs2 list (HD list)`, + GEN_TAC THEN MATCH_MP_TAC EL_EQ_IMP_EQ THEN + REWRITE_TAC[LENGTH_LIST_PAIRS; LENGTH_LIST_PAIRS2] THEN + ASM_SIMP_TAC[EL_LIST_PAIRS; EL_LIST_PAIRS2] THEN + REPEAT STRIP_TAC THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[EL]);; + + +let LIST_PAIRS_NUM_EMPTY = prove(`list_pairs ([]:(num)list) = []`, CONV_TAC LIST_PAIRS_REWRITE_CONV);; +let LIST_PAIRS_NUM_CONS = prove(`list_pairs (CONS (h:num) t) = list_pairs2 (CONS h t) h`, REWRITE_TAC[LIST_PAIRS2; HD]);; + + +let LIST_PAIRS_CONV tm = + let list_tm = rand tm in + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let th0 = INST[h_tm, h_var_num; t_tm, t_var_numlist] LIST_PAIRS_NUM_CONS in + let th1 = list_pairs2_raw_conv (rand(concl th0)) in + TRANS th0 th1 + else + LIST_PAIRS_NUM_EMPTY;; + + + +(* +let z = `list_pairs [1;2;3;4;5;6]`;; +LIST_PAIRS_REWRITE_CONV z;; +test 1000 LIST_PAIRS_REWRITE_CONV z;; (* 2.484 *) + +LIST_PAIRS_CONV z;; +test 1000 LIST_PAIRS_CONV z;; (* 0.08 *) +*) + + +(***********************************************) + +(* LIST_OF_FACES_CONV *) + +let LIST_OF_FACES_REWRITE_CONV = REWRITE_CONV[list_of_faces; MAP; LIST_PAIRS2; list_pairs2; HD];; + +let LIST_OF_FACES_REWRITE_CONV' = REWRITE_CONV[list_of_faces; MAP; list_pairs; shift_left; APPEND; ZIP];; + +(* +let y = mk_comb(list_of_faces_const, hol_list);; +LIST_OF_FACES_CONV y;; +test 10 LIST_OF_FACES_CONV y;; (* 0.304 *) + +LIST_OF_FACES_CONV2 y;; +test 10 LIST_OF_FACES_CONV2 y;; (* 0.172 *) +*) + +(* +LIST_OF_DARTS_CONV' y;; +test 10 LIST_OF_DARTS_CONV' y;; (* 0.920 *) +*) + + +(* LIST_OF_DARTS_CONV *) +let LIST_OF_DARTS_REWRITE_CONV = REWRITE_CONV[list_of_darts; ITLIST; list_pairs; shift_left; APPEND; ZIP];; + + +(* +let x = create_hol_list pentstring;; +let y = mk_comb (list_of_darts_const, hol_list);; +test 10 LIST_OF_DARTS_CONV y;; (* 1.168 *) +*) + + +(**************************************) + + +(* ALL_DISTINCT_CONV *) +let ALL_DISTINCT_REWRITE_CONV = REWRITE_CONV[ALL_DISTINCT_ALT; MEM; PAIR_EQ; ARITH];; + + +let ALL_DISTINCT_NUM_PAIR_EMPTY = prove(`ALL_DISTINCT ([]:(num#num)list) <=> T`, REWRITE_TAC[ALL_DISTINCT_ALT]) and + ALL_DISTINCT_NUM_PAIR_CONS_F = UNDISCH_ALL (prove(`(MEM (h:num#num) t <=> F) ==> (ALL_DISTINCT (CONS h t) <=> ALL_DISTINCT t)`, SIMP_TAC[ALL_DISTINCT_ALT])) and + ALL_DISTINCT_NUM_PAIR_CONS_T = UNDISCH_ALL (prove(`(MEM (h:num#num) t <=> T) ==> (ALL_DISTINCT (CONS h t) <=> F)`, SIMP_TAC[ALL_DISTINCT_ALT]));; + +let mem_numnum_const = `MEM:(num#num)->(num#num)list->bool`;; + +let rec ALL_DISTINCT_NUM_PAIR_CONV tm = + let list_tm = rand tm in + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let inst = INST[h_tm, h_var_numnum; t_tm, t_var_numnumlist] in + let mem_th = MEM_NUM_PAIR_CONV (mk_binop mem_numnum_const h_tm t_tm) in + if (rand (concl mem_th) = t_const) then + MY_PROVE_HYP mem_th (inst ALL_DISTINCT_NUM_PAIR_CONS_T) + else + let th0 = MY_PROVE_HYP mem_th (inst ALL_DISTINCT_NUM_PAIR_CONS_F) in + let th1 = ALL_DISTINCT_NUM_PAIR_CONV (rand(concl th0)) in + TRANS th0 th1 + else + ALL_DISTINCT_NUM_PAIR_EMPTY;; + + +(* +let z = mk_comb(`ALL_DISTINCT:(num#num)list->bool`, rand(concl (LIST_OF_DARTS_CONV y)));; +ALL_DISTINCT_REWRITE_CONV z;; +ALL_DISTINCT_NUM_PAIR_CONV z;; +test 1 ALL_DISTINCT_REWRITE_CONV z;; (* 0.808 *) +test 1 ALL_DISTINCT_NUM_PAIR_CONV z;; (* 0.084 *) +*) + +(*********************************************) + +(* GOOD_LIST_CONV *) + +let GOOD_LIST_COND3_EMPTY = prove(`ALL (\d:num#num. MEM (SND d,FST d) list) [] <=> T`, REWRITE_TAC[ALL]);; +let GOOD_LIST_COND3_CONS_T = UNDISCH_ALL (prove(`(MEM (y,x) list <=> T) ==> + (ALL (\d:num#num. MEM (SND d,FST d) list) (CONS (x,y) t) <=> + ALL (\d:num#num. MEM (SND d,FST d) list) t)`, SIMP_TAC[ALL]));; +let GOOD_LIST_COND3_CONS_F = UNDISCH_ALL (prove(`(MEM (y,x) list <=> F) ==> + (ALL (\d:num#num. MEM (SND d,FST d) list) (CONS (x,y) t) <=> + F)`, SIMP_TAC[ALL]));; + +let list_var_numnumlist = `list:(num#num)list`;; + +let rec GOOD_LIST_COND3_CONV tm = + let ltm, list_tm = dest_comb tm in + let f_tm = rand ltm in + let list2_tm = rand(snd(dest_abs f_tm)) in + if (is_comb list_tm) then + let h_tm, t_tm = dest_comb list_tm in + let x_tm, y_tm = dest_pair (rand h_tm) in + let inst = INST[list2_tm, list_var_numnumlist; x_tm, x_var_num; y_tm, y_var_num; t_tm, t_var_numnumlist] in + let mem_th = MEM_NUM_PAIR_CONV (mk_binop mem_numnum_const (mk_pair (y_tm,x_tm)) list2_tm) in + if (rand(concl mem_th) = t_const) then + let th0 = MY_PROVE_HYP mem_th (inst GOOD_LIST_COND3_CONS_T) in + let th1 = GOOD_LIST_COND3_CONV (rand(concl th0)) in + TRANS th0 th1 + else + MY_PROVE_HYP mem_th (inst GOOD_LIST_COND3_CONS_F) + else + INST[list2_tm, list_var_numnumlist] GOOD_LIST_COND3_EMPTY;; + + +(* +good_list;; +let z = mk_comb(`\ll. !d:num#num. MEM d (list_of_darts ll) ==> MEM (SND d,FST d) (list_of_darts ll)`, x);; +let s1 = rand(concl(REWRITE_CONV[darts; ALL_MEM] z));; +let s2 = REWRITE_CONV[ALL; MEM] s1;; +test 1 (REWRITE_CONV[ALL;MEM]) s1;; (* 1.668 *) + + +GOOD_LIST_COND3_CONV s1;; +test 1 GOOD_LIST_COND3_CONV s1;; (* 0.108 *) +*) + + + + +(*****************************************) + +(* FLATTEN_CONV *) + +let FLATTEN_CLAUSES = prove(`!(h:A) t tt. + FLATTEN ([]:((A)list)list) = [] /\ + FLATTEN (CONS [] tt) = FLATTEN tt /\ + FLATTEN (CONS (CONS h t) tt) = CONS h (FLATTEN (CONS t tt))`, + REPEAT STRIP_TAC THEN REWRITE_TAC[FLATTEN; ITLIST; APPEND]);; + + +let FLATTEN_REWRITE_CONV = REWRITE_CONV[FLATTEN_CLAUSES];; + + +let FLATTEN_NUM_CLAUSES = INST_TYPE[`:num`, aty] (SPEC_ALL FLATTEN_CLAUSES);; + +let [flatten_0; flatten_01; flatten_11] = + CONJUNCTS (FLATTEN_NUM_CLAUSES);; +let tt_var_numlistlist = `tt:((num)list)list`;; +let h_var_num = `h:num`;; +let t_var_numlist = `t:(num)list`;; + + + +let rec FLATTEN_NUM_CONV tm = + let arg = rand tm in + if (is_comb arg) then + let hh_tm', tt_tm = dest_comb arg in + let hh_tm = rand hh_tm' in + if (is_comb hh_tm) then + let h_tm', t_tm = dest_comb hh_tm in + let h_tm = rand h_tm' in + let th0 = INST[h_tm, h_var_num; t_tm, t_var_numlist; tt_tm, tt_var_numlistlist] flatten_11 in + let ltm, rtm = dest_comb(rand(concl th0)) in + let th1 = AP_TERM ltm (FLATTEN_NUM_CONV rtm) in + TRANS th0 th1 + else + let th0 = INST[tt_tm, tt_var_numlistlist] flatten_01 in + let th1 = FLATTEN_NUM_CONV (rand(concl th0)) in + TRANS th0 th1 + else + flatten_0;; + + +let [flattenA_0; flattenA_01; flattenA_11] + = CONJUNCTS (SPEC_ALL FLATTEN_CLAUSES);; + + +(* Works for any list of lists *) +let FLATTEN_CONV tm = + let tm_ty = hd (snd (dest_type (type_of tm))) in + let f0_th = INST_TYPE[tm_ty, aty] flattenA_0 in + let f01_th = INST_TYPE[tm_ty, aty] flattenA_01 in + let f11_th = INST_TYPE[tm_ty, aty] flattenA_11 in + let t_var = mk_var("t", mk_type("list", [tm_ty])) in + let tt_var = mk_var("tt", mk_type("list", [type_of t_var])) in + let h_var = mk_var("h", tm_ty) in + + let rec f_conv tm = + let arg = rand tm in + if (is_comb arg) then + let hh_tm', tt_tm = dest_comb arg in + let hh_tm = rand hh_tm' in + if (is_comb hh_tm) then + let h_tm', t_tm = dest_comb hh_tm in + let h_tm = rand h_tm' in + let th0 = INST[h_tm, h_var; t_tm, t_var; tt_tm, tt_var] f11_th in + let ltm, rtm = dest_comb(rand(concl th0)) in + let th1 = AP_TERM ltm (f_conv rtm) in + TRANS th0 th1 + else + let th0 = INST[tt_tm, tt_var] f01_th in + let th1 = f_conv (rand(concl th0)) in + TRANS th0 th1 + else + f0_th in + + f_conv tm;; + + +(* +let tm = `FLATTEN [[1;2;3]; [4;3;2;1]]`;; +flatten_conv tm;; +test 1000 flatten_conv tm;; (* 0.080 *) + +flatten_conv2 tm;; +test 1000 flatten_conv2 tm;; (* 0.112 *) + +FLATTEN_REWRITE_CONV tm;; +test 1000 FLATTEN_REWRITE_CONV2 tm;; (* 1.11 *) + +let y = mk_comb(`FLATTEN:((num)list)list->(num)list`, x);; +FLATTEN_CONV y;; +test 100 FLATTEN_CONV y;; (* 0.084 *) +test 100 FLATTEN_REWRITE_CONV y;; (* 4.524 *) +*) + + +(**********************************) + +(* REMOVE_DUPLICATES_CONV *) +let remove_duplicates2 = define `remove_duplicates2 [] acc = acc /\ + remove_duplicates2 (CONS (h:A) t) acc = if (MEM h acc) then remove_duplicates2 t acc + else remove_duplicates2 t (CONS h acc)`;; + +let REMOVE_DUPLICATES_REWRITE_CONV = REWRITE_CONV[REMOVE_DUPLICATES; MEM; ARITH_EQ];; + + +let REMOVE_DUPLICATES_NUM_EMPTY = prove(`REMOVE_DUPLICATES ([]:(num)list) = []`, REWRITE_TAC[REMOVE_DUPLICATES]);; +let REMOVE_DUPLICATES_MEM_NUM_T = UNDISCH_ALL(prove(`(MEM (h:num) t <=> T) ==> + REMOVE_DUPLICATES (CONS h t) = REMOVE_DUPLICATES t`, SIMP_TAC[REMOVE_DUPLICATES]));; +let REMOVE_DUPLICATES_MEM_NUM_F = UNDISCH_ALL(prove(`(MEM (h:num) t <=> F) ==> + REMOVE_DUPLICATES (CONS h t) = CONS h (REMOVE_DUPLICATES t)`, SIMP_TAC[REMOVE_DUPLICATES]));; + +let mem_num_const = `MEM:num->(num)list->bool`;; + + +let rec REMOVE_DUPLICATES_NUM_CONV tm = + let list_tm = rand tm in + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let inst = INST[h_tm, h_var_num; t_tm, t_var_numlist] in + let mem_th = MEM_NUM_CONV (mk_binop mem_num_const h_tm t_tm) in + if (rand(concl mem_th) = t_const) then + let th0 = MY_PROVE_HYP mem_th (inst REMOVE_DUPLICATES_MEM_NUM_T) in + let th1 = REMOVE_DUPLICATES_NUM_CONV (rand(concl th0)) in + TRANS th0 th1 + else + let th0 = MY_PROVE_HYP mem_th (inst REMOVE_DUPLICATES_MEM_NUM_F) in + let ltm, rtm = dest_comb (rand(concl th0)) in + let th1 = REMOVE_DUPLICATES_NUM_CONV rtm in + TRANS th0 (AP_TERM ltm th1) + else + REMOVE_DUPLICATES_NUM_EMPTY;; + + +(* +let tm = `REMOVE_DUPLICATES [1;2;3;4;2;1;3]`;; + +REMOVE_DUPLICATES_REWRITE_CONV tm;; +test 10 REMOVE_DUPLICATES_CONV tm;; (* 0.776 *) + +REMOVE_DUPLICATES_NUM_CONV tm;; +test 1000 REMOVE_DUPLICATES_NUM_CONV tm;; (* 0.548 *) +*) + + +(* +let y = mk_comb(list_of_elements_const, hol_list);; + + +let xxx =(REWRITE_CONV[list_of_elements] THENC + REWRITE_CONV[FLATTEN; ITLIST; APPEND]) +y;; + +let zz = `remove_duplicates2 [1;2;3;4;2;1] []`;; +REWRITE_CONV[remove_duplicates2; MEM; ARITH] zz;; + +let zz = rand(concl xxx);; + +REMOVE_DUPLICATES_REWRITE_CONV zz;; (* infty *) +REMOVE_DUPLICATES_NUM_CONV zz;; +test 10 REMOVE_DUPLICATES_NUM_CONV zz;; (* 0.176 *) + +*) + + + +(**************************************) + +(* LIST_OF_ELEMENTS_CONV *) + +let LIST_OF_ELEMENTS_CONV = + ONCE_REWRITE_CONV[list_of_elements] THENC + ONCE_DEPTH_CONV FLATTEN_CONV THENC + REMOVE_DUPLICATES_NUM_CONV;; + +(* +let y = mk_comb(list_of_elements_const, hol_list);; +test 10 LIST_OF_ELEMENTS_CONV y;; (* 0.184 *) +*) + + +(**********************************) + +(* LIST_OF_NODES_CONV *) + + +let FILTER_NODE_EMPTY = prove(`FILTER (\d:num#num. FST d = x) [] = []`, REWRITE_TAC[FILTER]);; +let FILTER_NODE_CONS_EQ = UNDISCH_ALL (prove(`(n = x <=> T) ==> FILTER (\d:num#num. FST d = x) (CONS (n,m) t) = + CONS (n,m) (FILTER (\d. FST d = x) t)`, SIMP_TAC[FILTER]));; +let FILTER_NODE_CONS_NEQ = UNDISCH_ALL (prove(`(n = x <=> F) ==> FILTER (\d:num#num. FST d = x) (CONS (n,m) t) = + FILTER (\d. FST d = x) t`, SIMP_TAC[FILTER]));; + + + +let rec FILTER_NODE_CONV tm = + let ltm, list_tm = dest_comb tm in + let x_tm = (rand o snd o dest_abs o rand) ltm in + if (is_comb list_tm) then + let h_tm, t_tm = dest_comb list_tm in + let n_tm, m_tm = dest_pair (rand h_tm) in + let inst = INST[n_tm, n_var_num; m_tm, m_var_num; t_tm, t_var_numnumlist; x_tm, x_var_num] in + let eq_th = MY_NUM_EQ_CONV (mk_eq (n_tm, x_tm)) in + if (rand(concl eq_th) = t_const) then + let th0 = MY_PROVE_HYP eq_th (inst FILTER_NODE_CONS_EQ) in + let ltm, rtm = dest_comb (rand(concl th0)) in + let th1 = FILTER_NODE_CONV rtm in + TRANS th0 (AP_TERM ltm th1) + else + let th0 = MY_PROVE_HYP eq_th (inst FILTER_NODE_CONS_NEQ) in + let th1 = FILTER_NODE_CONV (rand(concl th0)) in + TRANS th0 th1 + else + INST[x_tm, x_var_num] FILTER_NODE_EMPTY;; + + + +(* +test 10 LIST_OF_NODES_CONV y;; (* 0.992 *) +*) + + + +(****************************************************) + +(* `node (hypermap_of_list L) x` table construction *) + + +let NODE_HYPERMAP_OF_LIST_EXPLICIT = prove(`!(L:((A)list)list) n d. good_list_nodes L /\ + MEM n (list_of_nodes L) /\ MEM d n + ==> node (hypermap_of_list L) d = set_of_list n`, + REWRITE_TAC[good_list_nodes] THEN REPEAT STRIP_TAC THEN + SUBGOAL_THEN `set_of_list n IN node_set (hypermap_of_list (L:((A)list)list))` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[IN_SET_OF_LIST; nodes_of_list; MEM_MAP] THEN + EXISTS_TAC `n:(A#A)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MP_TAC (ISPECL [`hypermap_of_list L:(A#A)hypermap`; `set_of_list n:A#A->bool`] Hypermap.lemma_node_representation) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC (GSYM Hypermap.lemma_node_identity) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[IN_SET_OF_LIST]);; + + +let NODES_HYPERMAP_OF_LIST_ALL = prove(`!(L:((A)list)list). good_list_nodes L ==> + ALL (\n. ALL(\d. node (hypermap_of_list L) d = set_of_list n) n) (list_of_nodes L)`, + REWRITE_TAC[GSYM ALL_MEM] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC NODE_HYPERMAP_OF_LIST_EXPLICIT THEN + ASM_REWRITE_TAC[]);; + + + + +let build_table_of_nodes hyp_list nodes_th = + let table_of_nodes = Hashtbl.create 100 in + let th0 = (UNDISCH_ALL o ISPEC hyp_list) NODES_HYPERMAP_OF_LIST_ALL in + let all_tm = rator (concl th0) in + let th1 = EQ_MP (AP_TERM all_tm nodes_th) th0 in + let th1_list = get_all th1 in + + let build1 = fun th -> + let th = BETA_RULE th in + let list_tm = dest_list(rand(concl th)) in + let ths = get_all th in + let r = CONV_RULE (BETA_CONV THENC RAND_CONV set_of_list_conv) in + map (fun tm, th -> Hashtbl.add table_of_nodes tm (r th)) (zip list_tm ths) in + + let _ = map build1 th1_list in + table_of_nodes;; + + + + +(* +let hol_list, th_table = compute_all pentstring;; +let nodes = Hashtbl.find th_table "nodes";; + + +let MEM_h_CONS_h_t = prove(`!(h:A) t. MEM h (CONS h t)`, REWRITE_TAC[MEM]);; + + + +let th = ISPEC hol_list NODES_HYPERMAP_OF_LIST_ALL;; +let nodes_th = UNDISCH_ALL (REWRITE_RULE[nodes; ALL; set_of_list] th);; +CONJUNCTS nodes_th;; +*) + + +(****************************************************) + +(* `face (hypermap_of_list L) x` table construction *) + + +let FACE_HYPERMAP_OF_LIST_EXPLICIT = prove(`!(L:((A)list)list) f d. good_list L /\ + MEM f (list_of_faces L) /\ MEM d f + ==> face (hypermap_of_list L) d = set_of_list f`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`f:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (X_CHOOSE_THEN `x:A#A` STRIP_ASSUME_TAC) THEN + + SUBGOAL_THEN `MEM (d:A#A) (list_of_darts L)` ASSUME_TAC THENL + [ + MATCH_MP_TAC MEM_FIND_FACE_IMP_MEM_DARTS THEN + EXISTS_TAC `x:A#A` THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + ASM_SIMP_TAC[FACE_OF_LIST] THEN + AP_TERM_TAC THEN + MATCH_MP_TAC MEM_FIND_FACE_IMP_FACES_EQ THEN + CONJ_TAC THENL + [ + UNDISCH_TAC `good_list (L:((A)list)list)` THEN + SIMP_TAC[good_list]; + ALL_TAC + ] THEN + + REMOVE_ASSUM THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]));; + + + +let FACES_HYPERMAP_OF_LIST_ALL = prove(`!(L:((A)list)list). good_list L ==> + ALL (\f. ALL(\d. face (hypermap_of_list L) d = set_of_list f) f) (list_of_faces L)`, + REWRITE_TAC[GSYM ALL_MEM] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC FACE_HYPERMAP_OF_LIST_EXPLICIT THEN + ASM_REWRITE_TAC[]);; + + +let build_table_of_faces hyp_list good_list_th faces_th = + let table_of_faces = Hashtbl.create 100 in + let th0 = MY_PROVE_HYP good_list_th ((UNDISCH_ALL o ISPEC hyp_list) FACES_HYPERMAP_OF_LIST_ALL) in + let all_tm = rator (concl th0) in + let th1 = EQ_MP (AP_TERM all_tm faces_th) th0 in + let th1_list = get_all th1 in + + let build1 = fun th -> + let th = BETA_RULE th in + let list_tm = dest_list(rand(concl th)) in + let ths = get_all th in + let r = CONV_RULE (BETA_CONV THENC RAND_CONV set_of_list_conv) in + map (fun tm, th -> Hashtbl.add table_of_faces tm (r th)) (zip list_tm ths) in + + let _ = map build1 th1_list in + table_of_faces;; + + + + + + + + +(********************************************) + +(* face_map H and inverse (face_map H) tables *) + +let f_list_ext_table = define `(f_list_ext_table L [] (first:A#A) <=> T) + /\ (f_list_ext_table L (CONS h1 (CONS h2 t)) first + <=> f_list_ext L h1 = h2 /\ + inverse (f_list_ext L) h2 = h1 /\ + f_list_ext_table L (CONS h2 t) first) + /\ (f_list_ext_table L [h1] first <=> f_list_ext L h1 = first /\ + inverse (f_list_ext L) first = h1)`;; + + +let list_to_pair list = hd list, hd(tl list);; + + +let F_LIST_EXT_SINGLE, INV_F_LIST_EXT_SINGLE = (list_to_pair o CONJUNCTS o UNDISCH_ALL) + (prove(`f_list_ext_table L [h1:num#num] first + ==> f_list_ext L h1 = first /\ + inverse (f_list_ext L) first = h1`, SIMP_TAC[f_list_ext_table])) and +F_LIST_EXT_CONS, INV_F_LIST_EXT_CONS = (list_to_pair o CONJUNCTS o UNDISCH_ALL) + (prove(`f_list_ext_table L (CONS (h1:num#num) (CONS h2 t)) first + ==> f_list_ext L h1 = h2 /\ + inverse (f_list_ext L) h2 = h1`, SIMP_TAC[f_list_ext_table])) and +F_LIST_EXT_TABLE_CONS = UNDISCH_ALL (prove(`f_list_ext_table L (CONS (h1:num#num) t) first + ==> f_list_ext_table L t first`, + DISJ_CASES_TAC (ISPEC `t:(num#num)list` list_CASES) THENL + [ + ASM_REWRITE_TAC[f_list_ext_table]; + POP_ASSUM STRIP_ASSUME_TAC THEN + ASM_SIMP_TAC[f_list_ext_table] + ]));; + + +let h1_var = `h1:num#num` and + h2_var = `h2:num#num` and + t_var = `t:(num#num)list` and + first_var = `first:num#num` and + l_var = `L:((num)list)list`;; + + +let f_list_ext_table_all th = + let ltm, first_tm = dest_comb(concl th) in + let ltm, list_tm = dest_comb ltm in + let l_tm = rand ltm in + let inst_t = INST[l_tm, l_var; first_tm, first_var] in + let f_single, inv_f_single = inst_t F_LIST_EXT_SINGLE, inst_t INV_F_LIST_EXT_SINGLE in + let f_cons, inv_f_cons = inst_t F_LIST_EXT_CONS, inst_t INV_F_LIST_EXT_CONS in + let f_table = inst_t F_LIST_EXT_TABLE_CONS in + + let rec f_list_raw = fun f_table_th h1_tm t1_tm -> + if (is_comb t1_tm) then + let h2_tm', t2_tm = dest_comb t1_tm in + let h2_tm = rand h2_tm' in + let inst_t = MY_PROVE_HYP f_table_th o INST[h1_tm, h1_var; h2_tm, h2_var; t2_tm, t_var] in + + let f_th, inv_f_th = inst_t f_cons, inst_t inv_f_cons in + let th0 = (MY_PROVE_HYP f_table_th o INST[h1_tm, h1_var; t1_tm, t_var]) f_table in + let f_list, inv_f_list = f_list_raw th0 h2_tm t2_tm in + (h1_tm, f_th) :: f_list, (h2_tm, inv_f_th) :: inv_f_list + + else + let inst_t = MY_PROVE_HYP f_table_th o INST[h1_tm, h1_var] in + let f_th, inv_f_th = inst_t f_single, inst_t inv_f_single in + [h1_tm, f_th], [first_tm, inv_f_th] in + + if (is_comb list_tm) then + let h1_tm, t1_tm = dest_comb list_tm in + f_list_raw th (rand h1_tm) t1_tm + else + [], [];; + + + + +(**********************) + + +let FIND_FACE_LEMMA_EXPLICIT = prove(`!(L:((A)list)list) f d. good_list L /\ + MEM f (list_of_faces L) /\ MEM d f + ==> find_face d L = f`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL[`f:(A#A)list`; `L:((A)list)list`] MEM_FACE_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + UNDISCH_TAC `MEM (d:A#A) f` THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MATCH_MP_TAC MEM_FIND_FACE_IMP_FACES_EQ THEN + UNDISCH_TAC `good_list (L:((A)list)list)` THEN + ASM_SIMP_TAC[good_list]);; + + + +let INVERSE_F_LIST_EXT_LEMMA = prove(`!(L:((A)list)list) d. good_list L ==> + inverse (f_list_ext L) (f_list_ext L d) = d`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `H = hypermap_of_list L:(A#A)hypermap` THEN + MP_TAC (ISPECL [`face_map (H:(A#A)hypermap)`; `dart H:A#A->bool`] PERMUTES_INVERSES) THEN + ASM_SIMP_TAC[Hypermap.hypermap_lemma] THEN + EXPAND_TAC "H" THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST]);; + + + +let NEXT_EL_APPEND_lemma = prove(`!l t1 (h:A) h' t2. ALL_DISTINCT l /\ + l = CONS h (APPEND t1 (CONS h' t2)) ==> + NEXT_EL h' l = if (t2 = []) then h else HD t2`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[NEXT_EL] THEN + ABBREV_TAC `n1 = LENGTH (t1:(A)list)` THEN + SUBGOAL_THEN `INDEX (h':A) l = SUC n1` ASSUME_TAC THENL + [ + SUBGOAL_THEN `h':A = EL (SUC n1) l` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[EL; TL; EL_APPEND; LT_REFL; SUB_REFL; HD]; + ALL_TAC + ] THEN + MATCH_MP_TAC INDEX_EL THEN + ASM_REWRITE_TAC[LENGTH; LENGTH_APPEND] THEN + ARITH_TAC; + ALL_TAC + ] THEN + DISJ_CASES_TAC (ISPEC `t2:(A)list` list_CASES) THENL + [ + ASM_REWRITE_TAC[LENGTH; LENGTH_APPEND; HD] THEN + ARITH_TAC; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + ASM_REWRITE_TAC[LENGTH; LENGTH_APPEND; NOT_CONS_NIL; HD] THEN + REWRITE_TAC[ARITH_RULE `~(SUC n1 = SUC (n1 + SUC (SUC n)) - 1)`] THEN + REWRITE_TAC[ARITH_RULE `SUC n1 + 1 = SUC (n1 + 1)`; EL; TL] THEN + ASM_REWRITE_TAC[EL_APPEND; ARITH_RULE `~(n1 + 1 < n1)`; ARITH_RULE `(n1 + 1) - n1 = 1`] THEN + REWRITE_TAC[ARITH_RULE `1 = SUC 0`; EL; TL; HD]);; + + + + +let F_LIST_EXT_TABLE = prove(`!L:((A)list)list. good_list L + ==> ALL (\f. f_list_ext_table L f (HD f)) (list_of_faces L)`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[good_list] THEN STRIP_TAC THEN + REWRITE_TAC[GSYM ALL_MEM] THEN + X_GEN_TAC `f:(A#A)list` THEN DISCH_TAC THEN + + DISJ_CASES_TAC (ISPEC `f:(A#A)list` list_CASES) THENL + [ + ASM_REWRITE_TAC[f_list_ext_table]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + ASM_REWRITE_TAC[HD] THEN + SUBGOAL_THEN `(!t2 t1. t = APPEND t1 t2 ==> f_list_ext_table L t2 (h:A#A)) ==> f_list_ext_table L (CONS h t) h` MP_TAC THENL + [ + DISCH_THEN (MP_TAC o SPECL [`t:(A#A)list`; `[]:(A#A)list`]) THEN + REWRITE_TAC[APPEND] THEN + DISJ_CASES_TAC (ISPEC `t:(A#A)list` list_CASES) THENL + [ + ASM_REWRITE_TAC[f_list_ext_table] THEN + SUBGOAL_THEN `f_list_ext L (h:A#A) = h` ASSUME_TAC THENL + [ + REWRITE_TAC[f_list_ext; res; f_list] THEN + SUBGOAL_THEN `find_face (h:A#A) L = f` ASSUME_TAC THENL + [ + MATCH_MP_TAC FIND_FACE_LEMMA_EXPLICIT THEN + ASM_REWRITE_TAC[MEM]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `h:A#A IN darts_of_list L` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[darts_of_list; IN_SET_OF_LIST; DART_IN_FACE; MEM]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[NEXT_EL; INDEX; LENGTH; ARITH_RULE `SUC 0 - 1 = 0`; HD]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + FIRST_ASSUM (fun th -> ONCE_REWRITE_TAC[SYM th]) THEN + MP_TAC (SPECL [`L:((A)list)list`; `h:A#A`] INVERSE_F_LIST_EXT_LEMMA) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + ASM_REWRITE_TAC[f_list_ext_table] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + + SUBGOAL_THEN `f_list_ext L h = h':A#A` ASSUME_TAC THENL + [ + REWRITE_TAC[f_list_ext; res; f_list] THEN + SUBGOAL_THEN `find_face (h:A#A) L = f` ASSUME_TAC THENL + [ + MATCH_MP_TAC FIND_FACE_LEMMA_EXPLICIT THEN + ASM_REWRITE_TAC[MEM]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `h:A#A IN darts_of_list L` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[darts_of_list; IN_SET_OF_LIST; DART_IN_FACE; MEM]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[NEXT_EL; INDEX; LENGTH; ARITH_RULE `~(0 = SUC(SUC n) - 1)`] THEN + REWRITE_TAC[ARITH_RULE `0 + 1 = SUC 0`; EL; TL; HD]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + POP_ASSUM (fun th -> ONCE_REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[INVERSE_F_LIST_EXT_LEMMA]; + ALL_TAC + ] THEN + + DISCH_THEN MATCH_MP_TAC THEN + LIST_INDUCT_TAC THENL + [ + REWRITE_TAC[f_list_ext_table]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN + + SUBGOAL_THEN `MEM (h':A#A) f` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[MEM; MEM_APPEND]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `ALL_DISTINCT (f:(A#A)list)` ASSUME_TAC THENL + [ + MATCH_MP_TAC ALL_DISTINCT_FACE THEN + EXISTS_TAC `L:((A)list)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + UNDISCH_TAC `t = APPEND t1 (CONS (h':A#A) t')` THEN + DISJ_CASES_TAC (ISPEC `t':(A#A)list` list_CASES) THENL + [ + ASM_REWRITE_TAC[f_list_ext_table] THEN DISCH_TAC THEN + SUBGOAL_THEN `f_list_ext L (h':A#A) = h` ASSUME_TAC THENL + [ + REWRITE_TAC[f_list_ext; res; f_list] THEN + SUBGOAL_THEN `find_face (h':A#A) L = f` ASSUME_TAC THENL + [ + MATCH_MP_TAC FIND_FACE_LEMMA_EXPLICIT THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `h':A#A IN darts_of_list L` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[darts_of_list; IN_SET_OF_LIST; DART_IN_FACE] THEN + REWRITE_TAC[MEM; MEM_APPEND]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + MP_TAC (ISPECL [`f:(A#A)list`; `t1:(A#A)list`; `h:A#A`; `h':A#A`; `t':(A#A)list`] NEXT_EL_APPEND_lemma) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + POP_ASSUM (fun th -> ONCE_REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[INVERSE_F_LIST_EXT_LEMMA]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + ASM_REWRITE_TAC[f_list_ext_table] THEN + DISCH_TAC THEN + + SUBGOAL_THEN `f_list_ext L (h':A#A) = h''` ASSUME_TAC THENL + [ + REWRITE_TAC[f_list_ext; res; f_list] THEN + SUBGOAL_THEN `find_face (h':A#A) L = f` ASSUME_TAC THENL + [ + MATCH_MP_TAC FIND_FACE_LEMMA_EXPLICIT THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `h':A#A IN darts_of_list L` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[darts_of_list; IN_SET_OF_LIST; DART_IN_FACE] THEN + REWRITE_TAC[MEM; MEM_APPEND]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + MP_TAC (ISPECL [`f:(A#A)list`; `t1:(A#A)list`; `h:A#A`; `h':A#A`; `t':(A#A)list`] NEXT_EL_APPEND_lemma) THEN + ASM_REWRITE_TAC[NOT_CONS_NIL; HD]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + POP_ASSUM (fun th -> ONCE_REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[INVERSE_F_LIST_EXT_LEMMA]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `APPEND t1 [h':A#A]`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN MATCH_MP_TAC THEN + + UNDISCH_TAC `t':(A#A)list = CONS h'' t''` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + REPEAT REMOVE_ASSUM THEN + SPEC_TAC (`t1:(A#A)list`, `t1:(A#A)list`) THEN + LIST_INDUCT_TAC THEN ASM_REWRITE_TAC[APPEND]);; + + + + +let build_f_list_ext_table hol_list good_list_th faces_th = + let f_table, inv_f_table = Hashtbl.create 100, Hashtbl.create 100 in + let th0 = (MY_PROVE_HYP good_list_th o UNDISCH_ALL o ISPEC hol_list) F_LIST_EXT_TABLE in + let all_tm = rator(concl th0) in + let th1 = EQ_MP (AP_TERM all_tm faces_th) th0 in + let th1_list = get_all th1 in + + let step = fun th -> + let th = BETA_RULE th in + let ltm, rtm = dest_comb(concl th) in + let first_th = hd_conv rtm in + let f_table_th = EQ_MP (AP_TERM ltm first_th) th in + let f_list, inv_f_list = f_list_ext_table_all f_table_th in + let _ = map (fun tm, th -> Hashtbl.add f_table tm th) f_list in + let _ = map (fun tm, th -> Hashtbl.add inv_f_table tm th) inv_f_list in + () in + + let _ = map step th1_list in + f_table, inv_f_table;; + + + + +(************************************) + +(* Final conversion *) + + +let compute_all hyp_str = + let thm_table = Hashtbl.create 10 in + let fun_table = Hashtbl.create 10 in + let hol_list = create_hol_list hyp_str in + let faces = LIST_OF_FACES_REWRITE_CONV (mk_comb (list_of_faces_const, hol_list)) in + let LIST_OF_DARTS_CONV = REWRITE_CONV[LIST_OF_DARTS; faces; FLATTEN; ITLIST; APPEND] in + let darts = LIST_OF_DARTS_CONV (mk_comb (list_of_darts_const, hol_list)) in + + let GOOD_LIST_CONV tm = + let th0 = REWRITE_CONV[good_list; darts] tm in + let [c1;c2;c3] = conjuncts (rand(concl th0)) in + let th1 = ALL_DISTINCT_NUM_PAIR_CONV c1 in + let th2 = REWRITE_CONV[ALL; NOT_CONS_NIL] c2 in + let th3 = (REWRITE_CONV[ALL_MEM] THENC GOOD_LIST_COND3_CONV) c3 in + let th = CONJ (EQT_ELIM th1) (CONJ (EQT_ELIM th2) (EQT_ELIM th3)) in + EQ_MP (SYM th0) th in + + let y = mk_comb(good_list_const, hol_list) in + let good_list_th = GOOD_LIST_CONV y in + +(* +test 1 GOOD_LIST_CONV y;; (* 2.448; (ALL_DISTINCT_NUM_PAIR_CONV) 1.748; (COND3) 0.244 *) +*) + + let components_th = MATCH_MP COMPONENTS_HYPERMAP_OF_LIST good_list_th in + let darts_th = REWRITE_RULE[darts_of_list; darts] (CONJUNCT1 components_th) in + let faces_th = REWRITE_RULE[faces_of_list; faces] (MATCH_MP FACE_SET_EQ_LIST good_list_th) in + (*REWRITE_RULE[MAP; set_of_list] faces_th;; *) + + let y = mk_comb(list_of_elements_const, hol_list) in + let elements = LIST_OF_ELEMENTS_CONV y in + + let LIST_OF_NODES_CONV = ONCE_REWRITE_CONV[list_of_nodes] THENC + ONCE_REWRITE_CONV[darts] THENC ONCE_REWRITE_CONV[elements] THENC + map_conv_univ (BETA_CONV THENC FILTER_NODE_CONV) in + + let y = mk_comb(list_of_nodes_const, hol_list) in + let nodes = LIST_OF_NODES_CONV y in + + let good_nodes_th = ASSUME (mk_comb(`good_list_nodes:((num)list)list->bool`, hol_list)) in + let hyp_nodes = REWRITE_RULE[good_list_nodes; nodes_of_list; nodes; MAP; set_of_list] good_nodes_th in + + (* Table of node L x *) + let table_of_nodes = build_table_of_nodes hol_list nodes in + + (* Table of face L x *) + let table_of_faces = build_table_of_faces hol_list good_list_th faces in + + (* Table of face_map and inverses *) +(* + let f_list_th1 = MP (ISPEC hol_list F_LIST_EXT_TABLE) good_list_th in + let f_list_th2 = REWRITE_RULE[faces; ALL] f_list_th1 in + let f_list_ext_table_th = REWRITE_RULE[f_list_ext_table; HD] f_list_th2 in +*) + let f_list_ext_table, inv_f_list_ext_table = build_f_list_ext_table hol_list good_list_th faces in + + (* List of edges *) + let y = mk_comb(list_of_edges_const, hol_list) in + let edges = REWRITE_CONV[list_of_edges; darts; MAP] y in + + (* faces3, face4, face5, faces6 *) + let faces3_tm = mk_comb(list_of_faces3_const, hol_list) in + let faces4_tm = mk_comb(list_of_faces4_const, hol_list) in + let faces5_tm = mk_comb(list_of_faces5_const, hol_list) in + let faces6_tm = mk_comb(list_of_faces6_const, hol_list) in + + let filter = filter_conv_univ (BETA_CONV THENC + LAND_CONV (length_conv_univ NUM_SUC_CONV) THENC + MY_NUM_EQ_CONV) in + + let faces3 = (REWRITE_CONV[list_of_faces3; faces] THENC filter) faces3_tm in + let faces4 = (REWRITE_CONV[list_of_faces4; faces] THENC filter) faces4_tm in + let faces5 = (REWRITE_CONV[list_of_faces5; faces] THENC filter) faces5_tm in + let faces6 = (REWRITE_CONV[list_of_faces6; faces] THENC filter) faces6_tm in + + (* darts3, darts4, dartsX *) + let darts3_tm = mk_comb(list_of_darts3_const, hol_list) in + let darts4_tm = mk_comb(list_of_darts4_const, hol_list) in + + let darts3 = (REWRITE_CONV[list_of_darts3; faces3] THENC flatten_conv_univ) darts3_tm in + let darts4 = (REWRITE_CONV[list_of_darts4; faces4] THENC flatten_conv_univ) darts4_tm in + + let filter = filter_conv_univ (BETA_CONV THENC + RAND_CONV (length_conv_univ NUM_SUC_CONV) THENC + NUM_LE_CONV) in + let dartsX_tm = mk_comb(list_of_dartsX_const, hol_list) in + let dartsX = (REWRITE_CONV[list_of_dartsX; list_of_faces456; faces] THENC + RAND_CONV filter THENC flatten_conv_univ) dartsX_tm in + + (* add everything to the table *) + let add = fun str thm -> Hashtbl.add thm_table str thm in + let _ = + add "faces" faces; + add "darts" darts; + add "good_list" good_list_th; + add "edges" edges; + add "nodes" nodes; + add "elements" elements; + add "darts3" darts3; + add "darts4" darts4; + add "dartsX" dartsX; + add "faces3" faces3; + add "faces4" faces4; + add "faces5" faces5; + add "faces6" faces6 in + + let add = fun str table -> Hashtbl.add fun_table str table in + let _ = + add "face" table_of_faces; + add "node" table_of_nodes; + add "inverse" inv_f_list_ext_table; + add "f_list_ext" f_list_ext_table in + + hol_list, thm_table, fun_table;; + + + +(* +let hol_list, thm_table, fun_table = compute_all pentstring;; + +let table = Hashtbl.find fun_table "f_list_ext";; +Hashtbl.find table `0,2`;; + +(* (1): 0.560; (2): 0.640; (3): 1.424; (4): 1.448; (5): 0.748 *) +test 1 compute_all pentstring;; + +Hashtbl.find list_thm "faces_table";; +Hashtbl.find list_thm "darts4";; +Hashtbl.find list_thm "edges";; +*) + + + + + + + + + + + + + + + + +(* +let hol_list, list_thm = compute_all pentstring;; +let th1 = MP (ISPEC hol_list FACE_MAP_TABLE) (Hashtbl.find list_thm "good_list");; +let th2 = REWRITE_RULE[Hashtbl.find list_thm "faces"; ALL] th1;; +let th3 = REWRITE_RULE[face_map_table; HD] th2;; +*) + + +(* Explicit orbit computation *) +(* Orbits for lists *) + +let list_orbit = define `list_orbit f x acc = if (MEM x acc) then acc else list_orbit f (f x) (CONS x acc)`;; + + +(* The same definitions as in "pack_defs.hl" *) +let REVERSE_TABLE = define `(REVERSE_TABLE (f:num->A) 0 = []) /\ + (REVERSE_TABLE f (SUC i) = CONS (f i) ( REVERSE_TABLE f i))`;; + +let TABLE = new_definition `!(f:num->A) k. TABLE f k = REVERSE (REVERSE_TABLE f k)`;; + + +let LENGTH_REVERSE = prove(`!l:(A)list. LENGTH (REVERSE l) = LENGTH l`, + LIST_INDUCT_TAC THEN ASM_REWRITE_TAC[REVERSE; LENGTH; LENGTH_APPEND] THEN ARITH_TAC);; + + +let LENGTH_REVERSE_TABLE = prove(`!(f:num->A) n. LENGTH (REVERSE_TABLE f n) = n`, + GEN_TAC THEN INDUCT_TAC THEN ASM_REWRITE_TAC[REVERSE_TABLE; LENGTH]);; + + +let LENGTH_TABLE = prove(`!(f:num->A) n. LENGTH(TABLE f n) = n`, + REWRITE_TAC[TABLE; LENGTH_REVERSE; LENGTH_REVERSE_TABLE]);; + + +let EL_REVERSE_TABLE = prove(`!(f:num->A) n i. i < n ==> EL i (REVERSE_TABLE f n) = f (n - i - 1)`, + GEN_TAC THEN INDUCT_TAC THEN GEN_TAC THEN REWRITE_TAC[ARITH_RULE `~(i < 0)`] THEN + DISCH_TAC THEN + MP_TAC (SPEC `i:num` num_CASES) THEN + DISCH_THEN DISJ_CASES_TAC THENL + [ + ASM_REWRITE_TAC[REVERSE_TABLE; EL; HD; ARITH_RULE `SUC n - 0 - 1 = n`]; + ALL_TAC + ] THEN + POP_ASSUM CHOOSE_TAC THEN + UNDISCH_TAC `i < SUC n` THEN ASM_REWRITE_TAC[LT_SUC; EL] THEN + REWRITE_TAC[REVERSE_TABLE; TL; ARITH_RULE `SUC n - SUC n' = n - n'`] THEN + DISCH_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]);; + + +let EL_REVERSE = prove(`!(l:(A)list) i. i < LENGTH l ==> EL i (REVERSE l) = EL (LENGTH l - i - 1) l`, + LIST_INDUCT_TAC THEN REWRITE_TAC[LENGTH; REVERSE; LT] THEN + REPEAT STRIP_TAC THENL + [ + ASM_REWRITE_TAC[EL_APPEND; LENGTH_REVERSE; LT_REFL; SUB_REFL] THEN + REWRITE_TAC[ARITH_RULE `SUC n - n - 1 = 0`] THEN + REWRITE_TAC[EL; HD]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[EL_APPEND; LENGTH_REVERSE] THEN + ASM_SIMP_TAC[ARITH_RULE `i < n ==> SUC n - i - 1 = SUC(n - i - 1)`] THEN + REWRITE_TAC[EL; TL]);; + + +let EL_TABLE = prove(`!(f:num->A) n i. i < n ==> EL i (TABLE f n) = f i`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[TABLE] THEN + MP_TAC (SPECL [`REVERSE_TABLE (f:num->A) n`; `i:num`] EL_REVERSE) THEN + ASM_REWRITE_TAC[LENGTH_REVERSE_TABLE] THEN + MP_TAC (SPECL [`f:(num->A)`; `n:num`; `n - i - 1`] EL_REVERSE_TABLE) THEN + ASM_SIMP_TAC[ARITH_RULE `i < n ==> n - (n - i - 1) - 1 = i`] THEN + ASM_SIMP_TAC[ARITH_RULE `i < n ==> n - i - 1 < n`]);; + + + + +let LIST_ORBIT_LEMMA = prove(`!f (x:A) n. 1 <= n /\ (f POWER n) x = x /\ + (!i j. ~(i = j) /\ i < n /\ j < n ==> ~((f POWER i) x = (f POWER j) x)) + ==> (!k. k <= n ==> list_orbit f ((f POWER (n - k)) x) + (REVERSE_TABLE (\i. (f POWER i) x) (n - k)) = REVERSE_TABLE (\i. (f POWER i) x) n)`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + INDUCT_TAC THEN DISCH_TAC THENL + [ + REWRITE_TAC[SUB_0] THEN + ONCE_REWRITE_TAC[list_orbit] THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `MEM (x:A) (REVERSE_TABLE (\i. (f POWER i) x) n)` ASSUME_TAC THENL + [ + REWRITE_TAC[MEM_EXISTS_EL] THEN + EXISTS_TAC `n - 1` THEN + REWRITE_TAC[LENGTH_REVERSE_TABLE] THEN + MP_TAC (ARITH_RULE `1 <= n ==> n - 1 < n`) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_SIMP_TAC[EL_REVERSE_TABLE] THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= n ==> n - (n - 1) - 1 = 0`] THEN + REWRITE_TAC[Hypermap.POWER_0; I_THM]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ONCE_REWRITE_TAC[list_orbit] THEN + COND_CASES_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REWRITE_TAC[MEM_EXISTS_EL] THEN + REWRITE_TAC[LENGTH_REVERSE_TABLE] THEN + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + ASM_SIMP_TAC[EL_REVERSE_TABLE] THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`n - SUC k`; `n - SUC k - i - 1`]) THEN + ANTS_TAC THENL + [ + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + UNDISCH_TAC `1 <= n` THEN + ARITH_TAC; + ALL_TAC + ] THEN + + SIMP_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `f ((f POWER (n - SUC k)) (x:A)) = (f POWER (n - k)) x` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_SIMP_TAC[ARITH_RULE `SUC k <= n ==> n - k = SUC(n - SUC k)`] THEN + REWRITE_TAC[Hypermap.COM_POWER; o_THM]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `CONS ((f POWER (n - SUC k)) (x:A)) (REVERSE_TABLE (\i. (f POWER i) x) (n - SUC k)) = REVERSE_TABLE (\i. (f POWER i) x) (n - k)` ASSUME_TAC THENL + [ + ASM_SIMP_TAC[ARITH_RULE `SUC k <= n ==> n - k = SUC(n - SUC k)`] THEN + REWRITE_TAC[REVERSE_TABLE]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + UNDISCH_TAC `SUC k <= n` THEN ARITH_TAC);; + + + +let LIST_ORBIT_EXPLICIT = prove(`!f (x:A) n. 1 <= n /\ (f POWER n) x = x /\ + (!i j. ~(i = j) /\ i < n /\ j < n ==> ~((f POWER i) x = (f POWER j) x)) + ==> list_orbit f x [] = REVERSE_TABLE (\i. (f POWER i) x) n`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL LIST_ORBIT_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `n:num`) THEN + REWRITE_TAC[LE_REFL; SUB_REFL; Hypermap.POWER; I_THM] THEN + REWRITE_TAC[REVERSE_TABLE]);; + + +let FINITE_ORBIT_MAP_EXPLICIT = prove(`!s f (x:A). f permutes s /\ FINITE s ==> + ?n. 1 <= n /\ + orbit_map f x = {(f POWER k) x | k < n} /\ + (f POWER n) x = x /\ + (!i j. ~(i = j) /\ i < n /\ j < n ==> ~((f POWER i) x = (f POWER j) x))`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `n = CARD (orbit_map f (x:A))` THEN + EXISTS_TAC `n:num` THEN + MP_TAC (SPEC_ALL Hypermap_and_fan.FINITE_ORBIT_MAP) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REPEAT CONJ_TAC THENL + [ + MP_TAC (SPEC_ALL Hypermap_and_fan.ORBIT_MAP_CARD_POS) THEN + ASM_REWRITE_TAC[] THEN + ARITH_TAC; + EXPAND_TAC "n" THEN + MATCH_MP_TAC Hypermap.lemma_cycle_orbit THEN + EXISTS_TAC `s:A->bool` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REPEAT STRIP_TAC THEN + MP_TAC (INST[`n:num`, `k:num`] (SPEC_ALL Hypermap_and_fan.ORBIT_MAP_INJ)) THEN + ASM_REWRITE_TAC[]);; + + + +let ORBIT_EQ_LIST_ORBIT = prove(`!f s (x:A). f permutes s /\ FINITE s + ==> orbit_map f x = set_of_list (list_orbit f x [])`, + REPEAT GEN_TAC THEN + DISCH_THEN (MP_TAC o MATCH_MP FINITE_ORBIT_MAP_EXPLICIT) THEN + DISCH_THEN (STRIP_ASSUME_TAC o SPEC `x:A`) THEN + ASM_SIMP_TAC[LIST_ORBIT_EXPLICIT] THEN + + REWRITE_TAC[EXTENSION] THEN X_GEN_TAC `y:A` THEN + REWRITE_TAC[IN_ELIM_THM; IN_SET_OF_LIST; MEM_EXISTS_EL] THEN + REWRITE_TAC[LENGTH_REVERSE_TABLE] THEN + EQ_TAC THEN STRIP_TAC THENL + [ + EXISTS_TAC `n - k - 1` THEN + MP_TAC (ARITH_RULE `k < n ==> n - k - 1 < n`) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_SIMP_TAC[EL_REVERSE_TABLE] THEN + ASM_SIMP_TAC[ARITH_RULE `k < n ==> n - (n - k - 1) - 1 = k`]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN + ASM_SIMP_TAC[EL_REVERSE_TABLE] THEN DISCH_TAC THEN + EXISTS_TAC `n - i - 1` THEN + ASM_SIMP_TAC[ARITH_RULE `i < n ==> n - i - 1 < n`]);; + + +(**************) + + +(* PREV_EL_CONV *) + +let [el_0_th; el_suc_th] = CONJUNCTS (ISPECL[`n:num`; `l:(num#num)list`] (GEN_ALL EL));; +let n_var_num = `n:num`;; +let l_list = `l:(num#num)list`;; +let zero_const = `_0`;; + +let rec el_conv tm = + let ltm, l_tm = dest_comb tm in + let el_tm, n_tm = dest_comb ltm in + if (rand n_tm <> zero_const) then + let n_suc_th = num_CONV n_tm in + let m_tm = rand (rand (concl n_suc_th)) in + let th0 = AP_THM (AP_TERM el_tm n_suc_th) l_tm in + let th1' = INST[m_tm, n_var_num; l_tm, l_list] el_suc_th in + let th1 = REWRITE_RULE[TL] th1' in + let th2 = el_conv (rand(concl th1)) in + TRANS th0 (TRANS th1 th2) + else + let th0' = INST[l_tm, l_list] el_0_th in + REWRITE_RULE[HD] th0';; + + + +let prev_hd_th = prove(`PREV_EL (x:A) (CONS x t) = LAST (CONS x t)`, + REWRITE_TAC[PREV_EL; INDEX]);; + + + +let PREV_EL_CONV = REWRITE_CONV[PREV_EL; INDEX; PAIR_EQ; ARITH; LAST; NOT_CONS_NIL] THENC + TRY_CONV (ONCE_DEPTH_CONV el_conv);; + + +(* +let N_LIST_CONV = (REWRITE_CONV[n_list] THENC + REWRITE_CONV[find_face; find_list; faces; MEM; PAIR_EQ; ARITH] THENC + ONCE_DEPTH_CONV PREV_EL_CONV THENC + REWRITE_CONV[e_list]);; +*) +(* +let z = mk_comb (`n_list:((num)list)list->num#num->num#num`, x);; +let zz = mk_comb (z, `2,0`);; + + +N_LIST_CONV zz;; +test 10 N_LIST_CONV zz;; (* 0.704 *) +*) + + +let list_orbit_mem = UNDISCH_ALL (prove(`(MEM (x:num#num) acc <=> T) ==> list_orbit f x acc = acc`, + ONCE_REWRITE_TAC[list_orbit] THEN + SIMP_TAC[]));; +let list_orbit_not_mem = UNDISCH_ALL (prove(`(MEM (x:num#num) acc <=> F) + ==> list_orbit f x acc = list_orbit f (f x) (CONS x acc)`, + DISCH_TAC THEN + GEN_REWRITE_TAC LAND_CONV[list_orbit] THEN + ASM_REWRITE_TAC[]));; + + + +let rec list_orbit_conv f_conv tm = + let ltm, acc = dest_comb tm in + let ltm, x_arg = dest_comb ltm in + let ltm, f_arg = dest_comb ltm in + let mem_th = REWRITE_CONV[MEM; PAIR_EQ; ARITH] (mk_binop mem_const x_arg acc) in + if (rand(concl mem_th) = f_const) then + let th0' = INST[x_arg, x_var_pair; f_arg, f_var_fun; acc, acc_var] list_orbit_not_mem in + let th0 = PROVE_HYP mem_th th0' in + let tm1 = rand(concl th0) in + let ltm, acc1 = dest_comb tm1 in + let ltm, x_arg1 = dest_comb ltm in + let x_th = f_conv x_arg1 in + let th1 = TRANS th0 (AP_THM (AP_TERM ltm x_th) acc1) in + let th2 = list_orbit_conv f_conv (rand(concl th1)) in + TRANS th1 th2 + else + let th0 = INST[x_arg, x_var_pair; f_arg, f_var_fun; acc, acc_var] list_orbit_mem in + PROVE_HYP mem_th th0;; + + +(* +let zzz = + let t1 = mk_comb (`list_orbit:(num#num->num#num)->(num#num)->(num#num)list->(num#num)list`, z) in + mk_comb(mk_comb(t1, `12,7`), `[]:(num#num)list`);; + +list_orbit_conv N_LIST_CONV zzz;; +*) diff --git a/formal_lp/old/ineqs/list_hypermap_defs.hl b/formal_lp/old/ineqs/list_hypermap_defs.hl new file mode 100644 index 0000000..2cba3d6 --- /dev/null +++ b/formal_lp/old/ineqs/list_hypermap_defs.hl @@ -0,0 +1,219 @@ +(* Sets *) + +let hyp_edge_pairs = new_definition `hyp_edge_pairs H = {x, edge_map H x | x | x IN dart H}`;; + +let hyp_dart3 = new_definition `hyp_dart3 H = {x | x IN dart H /\ CARD (face H x) = 3}`;; +let hyp_dart4 = new_definition `hyp_dart4 H = {x | x IN dart H /\ CARD (face H x) = 4}`;; +let hyp_dartX = new_definition `hyp_dartX H = {x | x IN dart H /\ 4 <= CARD (face H x)}`;; + +let hyp_face3 = new_definition `hyp_face3 H = {f | f IN face_set H /\ CARD f = 3}`;; +let hyp_face4 = new_definition `hyp_face4 H = {f | f IN face_set H /\ CARD f = 4}`;; +let hyp_face5 = new_definition `hyp_face5 H = {f | f IN face_set H /\ CARD f = 5}`;; +let hyp_face6 = new_definition `hyp_face6 H = {f | f IN face_set H /\ CARD f = 6}`;; + + +(* List operations *) + +let FLATTEN = new_definition `FLATTEN ll = ITLIST (\list all. APPEND list all) ll []`;; + +let REMOVE_DUPLICATES = define `REMOVE_DUPLICATES [] = [] /\ + REMOVE_DUPLICATES (CONS h t) = if (MEM h t) then REMOVE_DUPLICATES t else CONS h (REMOVE_DUPLICATES t)`;; + + +(* INDEX 2 [1;3;4;2] = 3 *) +let INDEX = define `INDEX i [] = 0 /\ INDEX i (CONS h t) = if (i = h) then 0 else SUC (INDEX i t)`;; + +let ALL_DISTINCT = new_definition `ALL_DISTINCT list = (!i j. i < LENGTH list /\ j < LENGTH list /\ ~(i = j) ==> ~(EL i list = EL j list))`;; + + +(* Sum of the list elements *) +let list_sum = new_definition `list_sum list f = ITLIST (\t1 t2. f t1 + t2) list (&0)`;; + + + +(* shift_left [1;2;3] = [2;3;1] *) +let shift_left = define `shift_left [] = [] /\ shift_left (CONS h t) = APPEND t [h]`;; + +let shift_right = new_definition `shift_right list = if (list = []) then [] else CONS (LAST list) (BUTLAST list)`;; + + +(* Returns the next element in the cyclic order: + NEXT_EL [1;3;2] 3 = 2 + NEXT_EL [1;3;2] 2 = 1 *) + +let NEXT_EL = new_definition `NEXT_EL x list = + if (INDEX x list = LENGTH list - 1) then HD list else EL (INDEX x list + 1) list`;; + +let PREV_EL = new_definition `PREV_EL x list = + if (INDEX x list = 0) then LAST list else EL (INDEX x list - 1) list`;; + + + +(* list_pairs [1;2;3] = {(1,2), (2,3), (3,1)} *) +let list_pairs = new_definition `list_pairs list = ZIP list (shift_left list)`;; + + +let list_of_darts = new_definition `list_of_darts ll = ITLIST (\list all. APPEND (list_pairs list) all) ll []`;; + +let darts_of_list = new_definition `darts_of_list ll = set_of_list (list_of_darts ll)`;; + +let list_of_edges = new_definition `list_of_edges L = MAP (\d:A#A. d, (SND d,FST d)) (list_of_darts L)`;; + +let list_of_faces = new_definition `list_of_faces ll = MAP list_pairs ll`;; + +let faces_of_list = new_definition `faces_of_list ll = MAP set_of_list (list_of_faces ll)`;; + +let list_of_elements = new_definition `list_of_elements ll = REMOVE_DUPLICATES (FLATTEN ll)`;; + +let elements_of_list = new_definition `elements_of_list ll = set_of_list (list_of_elements ll)`;; + +let list_of_nodes = new_definition `list_of_nodes ll = MAP (\x. FILTER (\d. FST d = x) (list_of_darts ll)) (list_of_elements ll)`;; + +let nodes_of_list = new_definition `nodes_of_list ll = MAP set_of_list (list_of_nodes ll)`;; + + +(* Special lists *) + +let list_of_faces3 = new_definition `list_of_faces3 (L:((A)list)list) = + FILTER (\f. LENGTH f = 3) (list_of_faces L)`;; + +let list_of_faces4 = new_definition `list_of_faces4 (L:((A)list)list) = + FILTER (\f. LENGTH f = 4) (list_of_faces L)`;; + +let list_of_faces5 = new_definition `list_of_faces5 (L:((A)list)list) = + FILTER (\f. LENGTH f = 5) (list_of_faces L)`;; + +let list_of_faces6 = new_definition `list_of_faces6 (L:((A)list)list) = + FILTER (\f. LENGTH f = 6) (list_of_faces L)`;; + +let list_of_faces456 = new_definition `list_of_faces456 (L:((A)list)list) = + FILTER (\f. 4 <= LENGTH f) (list_of_faces L)`;; + + +let list_of_darts3 = new_definition `list_of_darts3 (L:((A)list)list) = + FLATTEN (list_of_faces3 L)`;; + +let list_of_darts4 = new_definition `list_of_darts4 (L:((A)list)list) = + FLATTEN (list_of_faces4 L)`;; + +let list_of_dartsX = new_definition `list_of_dartsX (L:((A)list)list) = + FLATTEN (list_of_faces456 L)`;; + + +(* Faces *) + +let find_list = define `find_list x [] = [] /\ find_list x (CONS h t) = if (MEM x h) then h else find_list x t`;; + +let find_pair_list = define `find_pair_list d [] = [] /\ find_pair_list d (CONS h t) = if (MEM d (list_pairs h)) then h else find_pair_list d t`;; + +let find_face = new_definition `find_face d ll = find_list d (list_of_faces ll)`;; + + +(* Hypermap maps *) + +let f_list = new_definition `f_list ll d = NEXT_EL d (find_face d ll)`;; + +let e_list = new_definition `e_list ll d = (SND d, FST d)`;; + +(* let n_list = new_definition `n_list ll d = (FST d, PREV_EL (FST d) (find_pair_list d ll))`;; *) +let n_list = new_definition `n_list ll d = e_list ll (PREV_EL d (find_face d ll))`;; + + + + +(* Hypermap definition *) + +let f_list_ext = new_definition `f_list_ext ll = res (f_list ll) (darts_of_list ll)`;; +let e_list_ext = new_definition `e_list_ext ll = res (e_list ll) (darts_of_list ll)`;; +let n_list_ext = new_definition `n_list_ext ll = res (n_list ll) (darts_of_list ll)`;; + + +let hypermap_of_list = new_definition `hypermap_of_list (ll:((A)list)list) = hypermap (darts_of_list ll, e_list_ext ll, n_list_ext ll, f_list_ext ll)`;; + + + +(* Define "good" lists *) +let good_list = new_definition `good_list ll <=> ALL_DISTINCT (list_of_darts ll) /\ + ALL (\l. ~(l = [])) ll /\ + (!d. MEM d (list_of_darts ll) ==> MEM (SND d, FST d) (list_of_darts ll))`;; + + + + + + + +(* Some general theorems *) + +let ALL_DISTINCT_ALT = prove(`!(h:A) t. (ALL_DISTINCT ([]:(A)list) <=> T) /\ (ALL_DISTINCT (CONS h t) <=> ALL_DISTINCT t /\ ~(MEM h t))`, + REPEAT STRIP_TAC THENL + [ + REWRITE_TAC[ALL_DISTINCT; LENGTH] THEN + REWRITE_TAC[ARITH_RULE `~(i < 0)`]; + ALL_TAC + ] THEN + + REWRITE_TAC[ALL_DISTINCT] THEN + EQ_TAC THENL + [ + REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPECL [`SUC i`; `SUC j`]) THEN + ASM_REWRITE_TAC[LENGTH; LT_SUC; SUC_INJ] THEN + ASM_REWRITE_TAC[EL; TL]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN REWRITE_TAC[MEM_EXISTS_EL] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`0`; `SUC i`]) THEN + ASM_REWRITE_TAC[LENGTH; LT_SUC; LT_0; GSYM NOT_SUC] THEN + REWRITE_TAC[EL; HD; TL]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + DISJ_CASES_TAC (SPEC `i:num` num_CASES) THENL + [ + DISJ_CASES_TAC (SPEC `j:num` num_CASES) THENL + [ + UNDISCH_TAC `~(i = j:num)` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + POP_ASSUM CHOOSE_TAC THEN + ASM_REWRITE_TAC[EL; HD; TL] THEN + DISCH_TAC THEN UNDISCH_TAC `~MEM (h:A) t` THEN + REWRITE_TAC[MEM_EXISTS_EL] THEN + EXISTS_TAC `n:num` THEN ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `j < LENGTH (CONS (h:A) t)` THEN + ASM_REWRITE_TAC[LENGTH; LT_SUC]; + ALL_TAC + ] THEN + + POP_ASSUM CHOOSE_TAC THEN + DISJ_CASES_TAC (SPEC `j:num` num_CASES) THENL + [ + ASM_REWRITE_TAC[EL; HD; TL] THEN + DISCH_TAC THEN UNDISCH_TAC `~MEM (h:A) t` THEN + REWRITE_TAC[MEM_EXISTS_EL] THEN + EXISTS_TAC `n:num` THEN ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `i < LENGTH (CONS (h:A) t)` THEN + ASM_REWRITE_TAC[LENGTH; LT_SUC]; + ALL_TAC + ] THEN + + POP_ASSUM CHOOSE_TAC THEN + ASM_REWRITE_TAC[EL; TL] THEN + DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`n:num`; `n':num`]) THEN + ANTS_TAC THENL + [ + UNDISCH_TAC `i < LENGTH (CONS (h:A) t)` THEN UNDISCH_TAC `j < LENGTH (CONS (h:A) t)` THEN + UNDISCH_TAC `~(i = j:num)` THEN + ASM_SIMP_TAC[LENGTH; LT_SUC; SUC_INJ]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[]);; diff --git a/formal_lp/old/ineqs/list_hypermap_iso.hl b/formal_lp/old/ineqs/list_hypermap_iso.hl new file mode 100644 index 0000000..5f8dd36 --- /dev/null +++ b/formal_lp/old/ineqs/list_hypermap_iso.hl @@ -0,0 +1,672 @@ +needs "../formal_lp/hypermap/list_hypermap.hl";; +needs "tame/tame_defs.hl";; + +open Hypermap_and_fan;; +open Tame_defs;; + + +let IN_TRANS = prove(`!(x:A) s t. t SUBSET s /\ x IN t ==> x IN s`, + SET_TAC[]);; + + + + +(* TODO: move to HypermapAndFan.hl *) +let FST_NODE_HYPERMAP_OF_FAN = prove(`!V E x y. FAN (vec 0,V,E) /\ + x IN node (hypermap_of_fan (V,E)) y + ==> FST x = FST y`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC FAN_NODE_EQ_lemma THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `E:(real^3->bool)->bool`] THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC EQ_SYM THEN + MATCH_MP_TAC Hypermap.lemma_node_identity THEN + ASM_REWRITE_TAC[]);; + +let E_FAN_PAIR_EXT_EXPLICIT = prove(`!V E v w. (v,w) IN dart_of_fan (V,E) + ==> e_fan_pair_ext (V,E) (v,w) = (w,v)`, + REWRITE_TAC[dart_of_fan; GSYM dart1_of_fan; IN_UNION] THEN + REPEAT GEN_TAC THEN + REWRITE_TAC[Fan_defs.e_fan_pair_ext] THEN + COND_CASES_TAC THEN REWRITE_TAC[Fan_defs.e_fan_pair] THEN + REWRITE_TAC[IN_ELIM_THM; PAIR_EQ] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[]);; + +let DART_OF_FAN_SYM = prove(`!V E v w. (v,w) IN dart_of_fan (V,E) <=> (w,v) IN dart_of_fan (V,E)`, + GEN_TAC THEN GEN_TAC THEN + SUBGOAL_THEN `!v w. (v,w) IN dart_of_fan (V,E) ==> (w,v) IN dart_of_fan (V,E)` ASSUME_TAC THENL + [ + REWRITE_TAC[dart_of_fan; IN_UNION; IN_ELIM_THM; PAIR_EQ] THEN + REPEAT STRIP_TAC THENL + [ + DISJ1_TAC THEN + EXISTS_TAC `v':real^3` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + DISJ2_TAC THEN + MAP_EVERY EXISTS_TAC [`w':real^3`; `v':real^3`] THEN + ASM_REWRITE_TAC[Collect_geom.PER_SET2]; + ALL_TAC + ] THEN + REPEAT GEN_TAC THEN EQ_TAC THEN ASM_REWRITE_TAC[]);; + + + + + +(* Isomorphism between hypermap_of_fan and hypermap_of_list *) + +let isomorphism = new_definition `isomorphism f (H, G) <=> + BIJ f (dart H) (dart G) /\ + (!x. x IN dart H ==> + edge_map G (f x) = f (edge_map H x) /\ + node_map G (f x) = f (node_map H x) /\ + face_map G (f x) = f (face_map H x))`;; + + +let res_inverse = new_definition `res_inverse f s = (\y. @x. f x = y /\ x IN s)`;; + + +let INJ_IMP_RES_INVERSE = prove(`!(f:A->B) s t. INJ f s t ==> + (!x. x IN s ==> res_inverse f s (f x) = x)`, + REWRITE_TAC[INJ] THEN + REPEAT STRIP_TAC THEN + REWRITE_TAC[res_inverse] THEN + MATCH_MP_TAC SELECT_UNIQUE THEN + REWRITE_TAC[] THEN + GEN_TAC THEN EQ_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]);; + + +let SURJ_IMP_RES_INVERSE = prove(`!(f:A->B) s t. SURJ f s t ==> + (!y. y IN t ==> f (res_inverse f s y) = y /\ res_inverse f s y IN s)`, + REWRITE_TAC[SURJ; res_inverse] THEN + REPEAT GEN_TAC THEN STRIP_TAC THEN STRIP_TAC THEN STRIP_TAC THEN + MP_TAC (ISPEC `\x. (f:A->B) x = y /\ x IN s` SELECT_AX) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `y:B`) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + DISCH_THEN (MP_TAC o SPEC `y':A`) THEN + ASM_SIMP_TAC[]);; + + +let BIJ_IMP_RES_INVERSE = prove(`!(f:A->B) s t. BIJ f s t ==> + (!x. x IN s ==> res_inverse f s (f x) = x) /\ + (!y. y IN t ==> f (res_inverse f s y) = y) /\ + (!y. y IN t ==> res_inverse f s y IN s)`, + REWRITE_TAC[BIJ] THEN REPEAT GEN_TAC THEN STRIP_TAC THEN + MP_TAC (SPEC_ALL INJ_IMP_RES_INVERSE) THEN + MP_TAC (SPEC_ALL SURJ_IMP_RES_INVERSE) THEN + ASM_SIMP_TAC[]);; + + + + +let INJ_ALT = prove(`!(f:A->B) s t. INJ f s t <=> (!x. x IN s ==> f x IN t) /\ + ?g. !x. x IN s ==> g (f x) = x`, + REPEAT GEN_TAC THEN + EQ_TAC THEN STRIP_TAC THENL + [ + CONJ_TAC THENL + [ + POP_ASSUM MP_TAC THEN SIMP_TAC[INJ]; + ALL_TAC + ] THEN + + EXISTS_TAC `res_inverse (f:A->B) s` THEN + MP_TAC (SPEC_ALL INJ_IMP_RES_INVERSE) THEN + ASM_REWRITE_TAC[]; + ASM_REWRITE_TAC[INJ] THEN + REPEAT STRIP_TAC THEN + POP_ASSUM (MP_TAC o AP_TERM `g:B->A`) THEN + ASM_SIMP_TAC[] + ]);; + + +let SURJ_ALT = prove(`!(f:A->B) s t. SURJ f s t <=> (!x. x IN s ==> f x IN t) /\ + ?g. !y. y IN t ==> f (g y) = y /\ g y IN s`, + REPEAT GEN_TAC THEN + EQ_TAC THEN STRIP_TAC THENL + [ + CONJ_TAC THENL [ POP_ASSUM MP_TAC THEN SIMP_TAC[SURJ]; ALL_TAC ] THEN + EXISTS_TAC `res_inverse (f:A->B) s` THEN + MP_TAC (SPEC_ALL SURJ_IMP_RES_INVERSE) THEN + ASM_SIMP_TAC[]; + ASM_REWRITE_TAC[SURJ] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:B`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + EXISTS_TAC `(g:B->A) x` THEN + ASM_REWRITE_TAC[] + ]);; + + +let BIJ_ALT = prove(`!(f:A->B) s t. BIJ f s t <=> (!x. x IN s ==> f x IN t) /\ + ?g. (!x. x IN s ==> g (f x) = x) /\ + (!y. y IN t ==> f (g y) = y /\ g y IN s)`, + REWRITE_TAC[BIJ] THEN + REPEAT GEN_TAC THEN EQ_TAC THENL + [ + STRIP_TAC THEN + MP_TAC (SPEC_ALL INJ_IMP_RES_INVERSE) THEN + MP_TAC (SPEC_ALL SURJ_IMP_RES_INVERSE) THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN SIMP_TAC[SURJ] THEN + REPEAT STRIP_TAC THEN + EXISTS_TAC `res_inverse (f:A->B) s` THEN + ASM_SIMP_TAC[]; + STRIP_TAC THEN + ASM_REWRITE_TAC[INJ_ALT; SURJ_ALT] THEN + CONJ_TAC THEN EXISTS_TAC `g:B->A` THEN ASM_REWRITE_TAC[] + ]);; + + +let BIJ_RES_INVERSE = prove(`!(f:A->B) s t. BIJ f s t ==> BIJ (res_inverse f s) t s`, + REWRITE_TAC[BIJ] THEN + REPEAT GEN_TAC THEN STRIP_TAC THEN + MP_TAC (SPEC_ALL INJ_IMP_RES_INVERSE) THEN + MP_TAC (SPEC_ALL SURJ_IMP_RES_INVERSE) THEN + ASM_REWRITE_TAC[] THEN + + REPEAT STRIP_TAC THENL + [ + REWRITE_TAC[INJ_ALT] THEN + ASM_SIMP_TAC[] THEN + EXISTS_TAC `f:A->B` THEN + ASM_SIMP_TAC[]; + REWRITE_TAC[SURJ_ALT] THEN + ASM_SIMP_TAC[] THEN + EXISTS_TAC `f:A->B` THEN + ASM_SIMP_TAC[] THEN + UNDISCH_TAC `INJ (f:A->B) s t` THEN + SIMP_TAC[INJ] + ]);; + + + + +let RES_INVERSE = prove(`!(f:A->B) g s t. (!y. y IN t ==> g y IN s) /\ + (!x. x IN s ==> g (f x) = x) /\ + (!y. y IN t ==> f (g y) = y) + ==> (!y. y IN t ==> res_inverse f s y = g y)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[res_inverse] THEN + MATCH_MP_TAC SELECT_UNIQUE THEN + X_GEN_TAC `v:A` THEN + REWRITE_TAC[] THEN + EQ_TAC THEN STRIP_TAC THENL + [ + UNDISCH_TAC `(f:A->B) v = y` THEN + DISCH_THEN (MP_TAC o AP_TERM `g:B->A`) THEN + ASM_SIMP_TAC[]; + ASM_SIMP_TAC[] + ]);; + + + +let COMM_RES_INVERSE_LEMMA = prove(`!(f:A->B) s t g1 g2. BIJ f s t /\ + (!x. x IN s ==> g1 x IN s) /\ + (!y. y IN t ==> g2 y IN t) /\ + (!x. x IN s ==> f (g1 x) = g2 (f x)) + ==> (!y. y IN t ==> res_inverse f s (g2 y) = g1 (res_inverse f s y))`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL BIJ_IMP_RES_INVERSE) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + POP_ASSUM (MP_TAC o SPEC `y:B`) THEN + POP_ASSUM (MP_TAC o SPEC `y:B`) THEN + POP_ASSUM (MP_TAC o SPEC `g1 (res_inverse (f:A->B) s y):A`) THEN + ASM_REWRITE_TAC[] THEN + REPEAT DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `res_inverse (f:A->B) s y`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o AP_TERM `res_inverse (f:A->B) s`) THEN + FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `res_inverse (f:A->B) s y`) THEN + ASM_SIMP_TAC[]);; + + +let COMM_RES_INVERSE_LEMMA' = prove(`!(f:A->B) s t g1 g2. BIJ f s t /\ + g1 permutes s /\ g2 permutes t /\ + (!x. x IN s ==> f (g1 x) = g2 (f x)) + ==> (!y. y IN t ==> res_inverse f s (g2 y) = g1 (res_inverse f s y))`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + MATCH_MP_TAC COMM_RES_INVERSE_LEMMA THEN + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[PERMUTES_IMP_INSIDE]);; + + + +let ISOMORPHISM_INVERSE = prove(`!(f:A->B) H G. isomorphism f (H, G) ==> + isomorphism (res_inverse f (dart H)) (G, H)`, + REWRITE_TAC[isomorphism] THEN + REPEAT GEN_TAC THEN STRIP_TAC THEN CONJ_TAC THENL + [ + ASM_SIMP_TAC[BIJ_RES_INVERSE]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN SPEC_TAC (`x:B`, `x:B`) THEN + MATCH_MP_TAC (GSYM COMM_RES_INVERSE_LEMMA') THEN + REWRITE_TAC[ETA_AX] THEN + ASM_SIMP_TAC[Hypermap.hypermap_lemma]);; + + + +let POWER_IN_LEMMA = prove(`!g s. (!x:A. x IN s ==> g x IN s) + ==> (!x n. x IN s ==> (g POWER n) x IN s)`, + REPEAT GEN_TAC THEN STRIP_TAC THEN GEN_TAC THEN + INDUCT_TAC THENL + [ + REWRITE_TAC[Hypermap.POWER_0; I_THM]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[Hypermap.COM_POWER; o_THM]);; + + + + +let COMM_POWER_LEMMA = prove(`!(f:A->B) g1 g2 s. (!x. x IN s ==> g1 x IN s) /\ + (!x. x IN s ==> f (g1 x) = g2 (f x)) + ==> (!x n. x IN s ==> f ((g1 POWER n) x) = (g2 POWER n) (f x))`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + GEN_TAC THEN INDUCT_TAC THENL + [ + REWRITE_TAC[Hypermap.POWER_0; I_THM]; + ALL_TAC + ] THEN + DISCH_TAC THEN FIRST_X_ASSUM (MP_TAC o check(is_imp o concl)) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + REWRITE_TAC[Hypermap.COM_POWER; o_THM] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `(g1 POWER n) (x:A)`) THEN + ASM_SIMP_TAC[POWER_IN_LEMMA]);; + + + +let COMM_POWER_LEMMA_PERMUTES = prove(`!(f:A->B) g1 g2 s. g1 permutes s /\ + (!x. x IN s ==> f (g1 x) = g2 (f x)) + ==> (!x n. x IN s ==> f ((g1 POWER n) x) = (g2 POWER n) (f x))`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + MATCH_MP_TAC COMM_POWER_LEMMA THEN + ASM_SIMP_TAC[PERMUTES_IMP_INSIDE]);; + + + +let COMM_INVERSE_LEMMA = prove(`!(f:A->B) g1 g2 s t x. FINITE s /\ + g1 permutes s /\ g2 permutes t /\ + (!x. x IN s ==> f (g1 x) = g2 (f x)) /\ x IN s + ==> f (inverse g1 x) = inverse g2 (f x)`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL[`s:A->bool`; `g1:A->A`] Hypermap.inverse_element_lemma) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `inverse g2 (f x) = (g2 POWER j) ((f:A->B) x)` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC (GSYM Hypermap.inverse_function) THEN + EXISTS_TAC `t:B->bool` THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPEC_ALL COMM_POWER_LEMMA_PERMUTES) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPECL [`x:A`; `j:num`]) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `inverse (g1:A->A) (x:A)`) THEN + ANTS_TAC THENL + [ + MP_TAC (ISPECL [`inverse (g1:A->A)`; `s:A->bool`] Hypermap_and_fan.PERMUTES_IMP_INSIDE) THEN + ASM_SIMP_TAC[PERMUTES_INVERSE]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MP_TAC (ISPECL [`g1:A->A`; `s:A->bool`] PERMUTES_INVERSES) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + MP_TAC (SPEC_ALL COMM_POWER_LEMMA_PERMUTES) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]);; + + + + + + +let COMM_ORBIT_IMAGE_LEMMA = prove(`!(f:A->B) s g1 g2. (!x. x IN s ==> g1 x IN s) /\ + (!x. x IN s ==> f (g1 x) = g2 (f x)) + ==> (!x. x IN s ==> orbit_map g2 (f x) = IMAGE f (orbit_map g1 x))`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[Hypermap.orbit_map] THEN + MP_TAC (SPEC_ALL COMM_POWER_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `x:A`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + REWRITE_TAC[GSYM IMAGE_LEMMA; IN_ELIM_THM] THEN + SET_TAC[]);; + + + +let COMM_ORBIT_IMAGE_LEMMA_PERMUTES = prove(`!(f:A->B) s g1 g2 y. y IN s /\ g1 permutes s /\ + (!x. x IN s ==> f (g1 x) = g2 (f x)) + ==> orbit_map g2 (f y) = IMAGE f (orbit_map g1 y)`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + MP_TAC (SPEC_ALL COMM_ORBIT_IMAGE_LEMMA) THEN + ASM_SIMP_TAC[PERMUTES_IMP_INSIDE]);; + + + +let ISOMORPHISM_COMPONENT_IMAGE = prove(`!(f:A->B) H G d. isomorphism f (H,G) /\ d IN dart H + ==> node G (f d) = IMAGE f (node H d) /\ + edge G (f d) = IMAGE f (edge H d) /\ + face G (f d) = IMAGE f (face H d)`, + REWRITE_TAC[isomorphism] THEN + REPEAT GEN_TAC THEN STRIP_TAC THEN + REWRITE_TAC[Hypermap.node; Hypermap.edge; Hypermap.face] THEN + REPEAT CONJ_TAC THEN MATCH_MP_TAC COMM_ORBIT_IMAGE_LEMMA_PERMUTES THEN + EXISTS_TAC `dart H:A->bool` THEN + ASM_SIMP_TAC[Hypermap.hypermap_lemma]);; + + + + +let ISOMORPHISM_IMP_ISO = prove(`!(f:A->B) H G. isomorphism f (H, G) + ==> iso H G`, + REWRITE_TAC[isomorphism; Hypermap.iso] THEN + REPEAT STRIP_TAC THEN + EXISTS_TAC `f:A->B` THEN + ASM_REWRITE_TAC[] THEN + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN + REWRITE_TAC[FUN_EQ_THM; o_THM] THEN + SIMP_TAC[]);; + + +let ISO_IMP_ISOMORPHISM = prove(`!H G. iso H G ==> ?f:A->B. isomorphism f (H, G)`, + REWRITE_TAC[Hypermap.iso; isomorphism]);; + + + + + + + + +let ISOMORPHISM_FAN_LIST = prove(`!V E L (f:real^3#real^3->A#A). FAN (vec 0,V,E) /\ + good_list L /\ good_list_nodes L /\ + isomorphism f (hypermap_of_fan (V,E), hypermap_of_list L) + ==> ?h. BIJ h V (elements_of_list L) /\ + (!d. d IN dart_of_fan (V,E) ==> f d = (h (FST d), h (SND d)))`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[isomorphism] THEN STRIP_TAC THEN + SUBGOAL_THEN `!d:real^3#real^3. d IN dart_of_fan (V,E) ==> (f d):A#A IN darts_of_list L` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o check(fun th -> (fst o dest_const o rator o rator o rator o concl) th = "BIJ")) THEN + REWRITE_TAC[BIJ; INJ] THEN + DISCH_THEN (CONJUNCTS_THEN2 MP_TAC (fun th -> ALL_TAC)) THEN + DISCH_THEN (CONJUNCTS_THEN2 MP_TAC (fun th -> ALL_TAC)) THEN + DISCH_THEN (MP_TAC o SPEC `d:real^3#real^3`) THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_FAN; COMPONENTS_HYPERMAP_OF_LIST]; + ALL_TAC + ] THEN + + ABBREV_TAC `h = (\v. FST ((f:real^3#real^3->A#A) (v, if (v,v) IN dart_of_fan (V,E) then v else CHOICE (set_of_edge v V E))))` THEN + EXISTS_TAC `h:real^3->A` THEN + SUBGOAL_THEN `?g. !v w:real^3. (v,w) IN dart_of_fan (V,E) ==> f(v,w) = (h v:A, g (v,w):A)` ASSUME_TAC THENL + [ + EXISTS_TAC `\d:real^3#real^3. SND (f d:A#A)` THEN + REPEAT STRIP_TAC THEN + REWRITE_TAC[] THEN + MP_TAC (ISPEC `(f:real^3#real^3->A#A) (v,w)` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[PAIR_EQ] THEN + EXPAND_TAC "h" THEN + COND_CASES_TAC THENL + [ + SUBGOAL_THEN `set_of_edge (v:real^3) V E = {}` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REWRITE_TAC[dart_of_fan; GSYM dart1_of_fan; IN_UNION; IN_ELIM_THM] THEN + STRIP_TAC THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[PAIR_EQ] THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `v:real^3`] PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + UNDISCH_TAC `v,w IN dart_of_fan (V:real^3->bool, E)` THEN + REWRITE_TAC[dart_of_fan; GSYM dart1_of_fan; IN_UNION; IN_ELIM_THM] THEN + STRIP_TAC THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[PAIR_EQ] THEN + DISCH_TAC THEN + UNDISCH_TAC `f(v:real^3,w:real^3) = x:A,y:A` THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`] PAIR_IN_DART1_OF_FAN) THEN + ASM_REWRITE_TAC[NOT_IN_EMPTY]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `v,w IN dart1_of_fan (V:real^3->bool,E)` ASSUME_TAC THENL + [ + UNDISCH_TAC `v,w IN dart_of_fan (V:real^3->bool,E)` THEN + DISCH_TAC THEN FIRST_ASSUM MP_TAC THEN + REWRITE_TAC[dart_of_fan; GSYM dart1_of_fan; IN_ELIM_THM; IN_UNION] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[PAIR_EQ] THEN + DISCH_TAC THEN + UNDISCH_TAC `v,w IN dart_of_fan (V:real^3->bool,E)` THEN + UNDISCH_TAC `~(v,v IN dart_of_fan (V:real^3->bool,E))` THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + ABBREV_TAC `w' = CHOICE (set_of_edge (v:real^3) V E)` THEN + + SUBGOAL_THEN `(v,w') IN node (hypermap_of_fan (V,E)) (v,w)` MP_TAC THENL + [ + ASM_SIMP_TAC[Hypermap_and_fan.NODE_HYPERMAP_OF_FAN_ALT] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + EXISTS_TAC `w':real^3` THEN + REWRITE_TAC[] THEN + EXPAND_TAC "w'" THEN + MATCH_MP_TAC CHOICE_DEF THEN + DISCH_TAC THEN + MP_TAC (ISPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`] PAIR_IN_DART1_OF_FAN) THEN + ASM_REWRITE_TAC[NOT_IN_EMPTY]; + ALL_TAC + ] THEN + + REWRITE_TAC[Hypermap.node; Hypermap.node_map] THEN + ASM_SIMP_TAC[HYPERMAP_OF_FAN] THEN + REWRITE_TAC[Hypermap.orbit_map; IN_ELIM_THM] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (ISPECL [`f:real^3#real^3->A#A`; `node_map (hypermap_of_fan (V,E))`; `node_map (hypermap_of_list (L:((A)list)list))`; `dart (hypermap_of_fan (V,E))`] COMM_POWER_LEMMA_PERMUTES) THEN + ASM_SIMP_TAC[Hypermap.hypermap_lemma] THEN + DISCH_THEN (MP_TAC o SPEC `v:real^3,w:real^3`) THEN + DISCH_THEN (MP_TAC o SPEC `n:num`) THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_FAN] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + ASM_SIMP_TAC[Hypermap.node_map; HYPERMAP_OF_LIST] THEN + + MATCH_MP_TAC (GSYM FST_N_LIST_EXT_POWER) THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `v:real^3,w:real^3`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + + REPEAT STRIP_TAC THENL + [ + REWRITE_TAC[BIJ; INJ; SURJ] THEN + SUBGOAL_THEN `!x:real^3. x IN V ==> (h x):A IN elements_of_list L` ASSUME_TAC THENL + [ + REWRITE_TAC[elements_of_list; IN_SET_OF_LIST] THEN + REWRITE_TAC[MEM_LIST_OF_ELEMENTS] THEN + X_GEN_TAC `v:real^3` THEN DISCH_TAC THEN + MP_TAC (SPEC_ALL DART_EXISTS) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL[`v:real^3`; `w:real^3`]) THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + EXISTS_TAC `g (v:real^3,w:real^3):A` THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[GSYM IN_SET_OF_LIST; GSYM darts_of_list] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + MAP_EVERY X_GEN_TAC [`v1:real^3`; `v2:real^3`] THEN + STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v1:real^3`] DART_EXISTS) THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v2:real^3`] DART_EXISTS) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (X_CHOOSE_THEN `w2:real^3` ASSUME_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `w1:real^3` ASSUME_TAC) THEN + ABBREV_TAC `d1:A#A = f (v1:real^3,w1:real^3)` THEN + ABBREV_TAC `d2:A#A = f (v2:real^3,w2:real^3)` THEN + SUBGOAL_THEN `MEM (d1:A#A) (list_of_darts L) /\ MEM (d2:A#A) (list_of_darts L)` ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM IN_SET_OF_LIST; GSYM darts_of_list] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `d1:A#A IN node (hypermap_of_list L) d2` MP_TAC THENL + [ + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[GSYM IN_SET_OF_LIST; GSYM darts_of_list] THEN + DISCH_TAC THEN + ASM_SIMP_TAC[GOOD_LIST_NODE] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + EXISTS_TAC `SND (d1:A#A)` THEN + SUBGOAL_THEN `FST (d2:A#A) = FST (d1:A#A)` ASSUME_TAC THENL + [ + FIRST_ASSUM (MP_TAC o SPECL [`v2:real^3`; `w2:real^3`]) THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`v1:real^3`; `w1:real^3`]) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`f:real^3#real^3->A#A`; `hypermap_of_fan (V,E)`; `hypermap_of_list (L:((A)list)list)`; `(v2:real^3,w2:real^3)`] ISOMORPHISM_COMPONENT_IMAGE) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_FAN]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + + REWRITE_TAC[IN_IMAGE] THEN + STRIP_TAC THEN + SUBGOAL_THEN `x = (v1:real^3,w1:real^3)` ASSUME_TAC THENL + [ + UNDISCH_TAC `BIJ f (dart (hypermap_of_fan (V,E))) (dart (hypermap_of_list (L:((A)list)list)))` THEN + REWRITE_TAC[BIJ; INJ] THEN + STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `node (hypermap_of_fan (V,E)) (v2,w2)` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC Hypermap.lemma_node_subset THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_FAN]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_FAN]; + ALL_TAC + ] THEN + + UNDISCH_TAC `x IN node (hypermap_of_fan (V,E)) (v2,w2)` THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + DISCH_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v1:real^3,w1:real^3`; `v2:real^3,w2:real^3`] FST_NODE_HYPERMAP_OF_FAN) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[elements_of_list; IN_SET_OF_LIST; MEM_LIST_OF_ELEMENTS] THEN + REWRITE_TAC[GSYM IN_SET_OF_LIST; GSYM darts_of_list] THEN + REPEAT STRIP_TAC THEN + UNDISCH_TAC `BIJ f (dart (hypermap_of_fan (V,E))) (dart (hypermap_of_list (L:((A)list)list)))` THEN + REWRITE_TAC[BIJ; SURJ] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:A,y:A`) THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST; COMPONENTS_HYPERMAP_OF_FAN] THEN + DISCH_THEN (X_CHOOSE_THEN `d:real^3#real^3` MP_TAC) THEN STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `d:real^3#real^3`] IN_DART_OF_FAN) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + EXISTS_TAC `v:real^3` THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`v:real^3`; `w:real^3`]) THEN + UNDISCH_TAC `f (d:real^3#real^3) = x:A,y:A` THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> SIMP_TAC[th; PAIR_EQ]); + ALL_TAC + ] THEN + + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `d:real^3#real^3`] IN_DART_OF_FAN) THEN + ASM_REWRITE_TAC[] THEN REMOVE_ASSUM THEN STRIP_TAC THEN + FIRST_ASSUM (MP_TAC o SPECL [`v:real^3`; `w:real^3`]) THEN + UNDISCH_TAC `v:real^3,w:real^3 IN dart_of_fan (V,E)` THEN + DISCH_TAC THEN FIRST_ASSUM (fun th -> REWRITE_TAC[th]) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_REWRITE_TAC[PAIR_EQ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `v:real^3,w:real^3`) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `v:real^3,w:real^3`) THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_FAN] THEN + + DISCH_THEN (MP_TAC o CONJUNCT1) THEN + ASM_SIMP_TAC[COMPONENTS_HYPERMAP_OF_LIST] THEN + ASM_REWRITE_TAC[e_list_ext; res] THEN + ASM_SIMP_TAC[E_FAN_PAIR_EXT_EXPLICIT] THEN + REWRITE_TAC[e_list] THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`w:real^3`; `v:real^3`]) THEN + ASM_REWRITE_TAC[DART_OF_FAN_SYM] THEN + SIMP_TAC[PAIR_EQ]);; + + + +(* +prove(`!(H:(A)hypermap) P k. is_no_double_joints H /\ connected_hypermap H /\ + plain_hypermap H /\ + (!x. x IN dart H ==> P x (node_map H x) /\ ~(P x (edge_map H x))) + ==> + (!x y g n. x IN dart H /\ y IN dart H /\ n <= k /\ P x y /\ + x = g 0 /\ y = g n /\ is_path H g n + ==> y IN node H x) /\ + (!x y g n t. x IN dart H /\ y IN dart H /\ n <= k /\ P x y /\ + x = g 0 /\ y = (edge_map H o (node_map H POWER t) o g) n /\ is_path H g n + ==> y IN node H x)`, + REWRITE_TAC[is_no_double_joints] + +*) diff --git a/formal_lp/old/ineqs/list_hypermap_vars.hl b/formal_lp/old/ineqs/list_hypermap_vars.hl new file mode 100644 index 0000000..8b51db9 --- /dev/null +++ b/formal_lp/old/ineqs/list_hypermap_vars.hl @@ -0,0 +1,116 @@ +needs "list_hypermap_iso.hl";; + +(* Basic variables *) + + +let inv_iso = new_definition `inv_iso (V,E) f = res_inverse f (dart_of_fan (V,E))`;; + + +let INV_ISO = prove(`!V E L f. FAN (vec 0,V,E) /\ good_list L /\ + isomorphism f (hypermap_of_fan (V,E), hypermap_of_list L) + ==> isomorphism (inv_iso (V,E) f) (hypermap_of_list L, hypermap_of_fan (V,E)) /\ + (!d. d IN dart_of_fan (V,E) ==> inv_iso (V,E) f (f d) = d) /\ + (!d. d IN darts_of_list L ==> f (inv_iso (V,E) f d) = d) /\ + (!d:A#A. d IN darts_of_list L ==> inv_iso (V,E) f d IN dart_of_fan (V,E))`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + SUBGOAL_THEN `isomorphism (inv_iso (V,E) f) (hypermap_of_list (L:((A)list)list), hypermap_of_fan (V,E))` ASSUME_TAC THENL + [ + REWRITE_TAC[inv_iso] THEN + ASM_SIMP_TAC[GSYM COMPONENTS_HYPERMAP_OF_FAN] THEN + MATCH_MP_TAC ISOMORPHISM_INVERSE THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[inv_iso] THEN + MATCH_MP_TAC BIJ_IMP_RES_INVERSE THEN + REMOVE_ASSUM THEN + POP_ASSUM MP_TAC THEN + ASM_SIMP_TAC[isomorphism; COMPONENTS_HYPERMAP_OF_FAN; COMPONENTS_HYPERMAP_OF_LIST]);; + + + + +(* azim *) +let azim_list = new_definition `azim_list (V,E,g) = azim_dart (V,E) o g`;; + + +let SUM_ISOMORPHISM = prove(`!G H (g:B->A) (r:A->real). isomorphism g (G,H) + ==> (!d. d IN dart G ==> sum(node G d) (r o g) = sum(node H (g d)) r)`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `sum(node G d) (r o (g:B->A)) = sum(IMAGE g (node G d)) r` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC (GSYM SUM_IMAGE) THEN + REPEAT STRIP_TAC THEN + UNDISCH_TAC `isomorphism (g:B->A) (G,H)` THEN + REWRITE_TAC[isomorphism; BIJ; INJ] THEN + DISCH_THEN (MP_TAC o CONJUNCT1) THEN + DISCH_THEN (MP_TAC o CONJUNCT1) THEN + DISCH_THEN (MATCH_MP_TAC o CONJUNCT2) THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THEN MATCH_MP_TAC IN_TRANS THEN EXISTS_TAC `node G (d:B)` THEN ASM_SIMP_TAC[Hypermap.lemma_node_subset]; + ALL_TAC + ] THEN + MP_TAC (ISPECL [`g:B->A`; `G:(B)hypermap`; `H:(A)hypermap`; `d:B`] ISOMORPHISM_COMPONENT_IMAGE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]));; + + + + + +search [`sum`; `azim_dart`];; + + +let yn = `yn_list (V,E,f) = norm o FST o inv_iso (V,E) f`;; + +let y1_list = new_definition `y1_list (V,E,f) = norm o FST o inv_iso (V,E) f`;; +let y2 = new_definition `y2_list (V,E,f) = norm o SND o inv_iso (V,E) f`;; +let y3 = new_definition `y3_list (V,E,f) = norm o SND o n_fan_pair_ext (V,E) o inv_iso (V,E) f`;; +let y4 = new_definition `y4_list (V,E,f) = `;; +let y5 = v13;; +let y6 = v23;; + + + +let DART_EXISTS_EQ = prove(`!V E v. FAN (vec 0,V,E) ==> + (v IN V <=> (?w. v,w IN dart_of_fan (V,E)))`, + REPEAT STRIP_TAC THEN EQ_TAC THENL + [ + REWRITE_TAC[DART_EXISTS]; + ALL_TAC + ] THEN + STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3,w:real^3`] IN_DART_OF_FAN) THEN + ASM_REWRITE_TAC[PAIR_EQ] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[]);; + + + + + +prove(`!V f (L:((A)list)list). contravening V /\ good_list L /\ + isomorphism f (hypermap_of_fan (V,ESTD V), hypermap_of_list L) + ==> (!d. d IN darts_of_list L ==> + #2.0 <= y1_list (V,ESTD V,f) d /\ y1_list (V,ESTD V,f) d <= #2.52)`, + REWRITE_TAC[y1_list; o_THM] THEN + REPEAT GEN_TAC THEN STRIP_TAC THEN GEN_TAC THEN DISCH_TAC THEN + MP_TAC (SPEC_ALL Tame_general.CONTRAVENING_FAN) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + SUBGOAL_THEN `FST (inv_iso (V,ESTD V) f (d:A#A)) IN V` ASSUME_TAC THENL + [ + MP_TAC (SPECL [`V:real^3->bool`; `ESTD V`; `FST (inv_iso (V,ESTD V) f (d:A#A))`] DART_EXISTS_EQ) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + EXISTS_TAC `SND (inv_iso (V,ESTD V) f (d:A#A))` THEN + REWRITE_TAC[PAIR] THEN + MP_TAC (SPECL [`V:real^3->bool`; `ESTD V`; `L:((A)list)list`; `f:real^3#real^3->A#A`] INV_ISO) THEN + ASM_SIMP_TAC[INV_ISO]; + ALL_TAC + ] THEN + REWRITE_TAC[GSYM DIST_0] THEN + ABBREV_TAC `v = FST (inv_iso (V,ESTD V) f (d:A#A))` THEN + MP_TAC (SPEC_ALL Tame_general.CONTRAVENING_DIST) THEN + ASM_SIMP_TAC[]);; + + diff --git a/formal_lp/old/ineqs/nobranching_lp.hl b/formal_lp/old/ineqs/nobranching_lp.hl new file mode 100644 index 0000000..63becc8 --- /dev/null +++ b/formal_lp/old/ineqs/nobranching_lp.hl @@ -0,0 +1,279 @@ +needs "contravening_ineqs.hl";; +needs "list_hypermap_computations.hl";; +needs "arith/prove_lp.hl";; + + +let plus_op_real = `(+):real->real->real` and + mul_op_real = `( * ):real->real->real`;; + + +let REAL_ADD_ASSOC' = (SYM o SPEC_ALL) REAL_ADD_ASSOC;; +let x_var_real = `x:real` and + y_var_real = `y:real` and + z_var_real = `z:real`;; + +(* Performs the following conversions: + (a + ... + c) + d = a + ... + c + d *) +let rec plus_assoc_conv tm = + if (is_binop plus_op_real tm) then + let lhs, rhs = dest_binop plus_op_real tm in + if (is_binop plus_op_real lhs) then + let x_tm, y_tm = dest_binop plus_op_real lhs in + let th0 = INST[x_tm, x_var_real; y_tm, y_var_real; rhs, z_var_real] REAL_ADD_ASSOC' in + let ltm, rtm = dest_comb(rand(concl th0)) in + TRANS th0 (AP_TERM ltm (plus_assoc_conv rtm)) + else + REFL tm + else + REFL tm;; + +(* +let tm = `(&1 + x + y + &2) + (z + t)`;; +plus_assoc_conv tm;; +(* 0.252 *) +test 1000 (REWRITE_CONV[GSYM REAL_ADD_ASSOC]) tm;; +(* 0.036 *) +test 1000 plus_assoc_conv tm;; +*) + + + + +let prove_hypermap_lp hyp_str precision constraints target_var_bounds var_bounds = + let list_hyp, list_thm, fun_table = compute_all hyp_str in + + let table_set_rewrites = + let hyp = Hashtbl.create 10 in + let _ = map (fun set, name -> Hashtbl.add hyp set (Hashtbl.find list_thm name)) + [ + "list_of_darts", "darts"; + "list_of_darts3", "darts3"; + "list_of_darts4", "darts4"; + "list_of_dartsX", "dartsX"; + "list_of_nodes", "nodes"; + "list_of_edges", "edges"; + "list_of_faces", "faces"; + "list_of_faces3", "faces3"; + "list_of_faces4", "faces4"; + "list_of_faces5", "faces5"; + "list_of_faces6", "faces6"; + ] in + hyp in + + let l_var_list = `L:((num)list)list` in + + (* Rewrites subterms in the inequality *) + let rewrite_ineq ineq = + let rec rewrite_lhs = fun tm -> + let rewrite_one = fun tm -> + if (is_binop mul_op_real tm) then + let mul_tm, var_tm = dest_comb tm in + let var_f, arg = dest_comb var_tm in + + let rec convert_arg = fun arg -> + if (is_comb arg) then + let ltm, sub_arg' = dest_comb arg in + let const_name = (fst o dest_const) (if (is_const ltm) then ltm else rator ltm) in + if (const_name = "CONS" or const_name = ",") then + REFL arg + else + try + let sub_arg_th = convert_arg sub_arg' in + let th0 = AP_TERM ltm sub_arg_th in + let rtm = rand(concl th0) in + let th1 = + if (const_name = "set_of_list") then + set_of_list_conv rtm + else if (const_name = "FST") then + fst_conv rtm + else if (const_name = "SND") then + snd_conv rtm + else + let table = Hashtbl.find fun_table const_name in + Hashtbl.find table (rand rtm) in + TRANS th0 th1 + with e -> + failwith ("convert_arg: "^const_name) + else + REFL arg in + + let arg_th = convert_arg arg in + AP_TERM mul_tm (AP_TERM var_f arg_th) + + else + (* tm should be list_sum *) + list_sum_conv BETA_CONV tm in + + if (is_binop plus_op_real tm) then + let lhs, rhs = dest_binop plus_op_real tm in + let lhs_th = rewrite_one lhs in + let rhs_th = rewrite_lhs rhs in + let th1 = MK_COMB(AP_TERM plus_op_real lhs_th, rhs_th) in + if (is_binop plus_op_real (rand(concl lhs_th))) then + let th2 = plus_assoc_conv (rand(concl th1)) in + TRANS th1 th2 + else + th1 + else + rewrite_one tm in + + let th0 = BETA_RULE ineq in + let ltm, rtm = dest_comb(concl th0) in + let op_tm, l_tm = dest_comb ltm in + let lhs_th = rewrite_lhs l_tm in + EQ_MP (AP_THM (AP_TERM op_tm lhs_th) rtm) th0 in + + (* This function generates all inequalities from a given base inequality *) + let get_ineqs = fun ineq indices -> + let t0 = INST[list_hyp, l_var_list] ineq in + let t1 = MY_PROVE_HYP (Hashtbl.find list_thm "good_list") t0 in + let all_tm, set_tm = dest_comb (concl t1) in + let set_th = Hashtbl.find table_set_rewrites ((fst o dest_const o rator) set_tm) in + let t2 = EQ_MP (AP_TERM all_tm set_th) t1 in + let ths = select_all t2 indices in + map rewrite_ineq ths in + + + let precision_constant = Int 10 **/ (Int precision) and + target_bound = `&12` in + + (* This function generates all inequalities with the given name and indices, + multiplies these inequalities by given coefficients, and adds up the obtained + inequalities *) + let sum_step = fun (name, indices, c) -> + try + let ineq = find_ineq precision name in + let ineqs = get_ineqs ineq indices in + let s1 = map transform_le_ineq (zip ineqs c) in + List.fold_left add_step' dummy s1 + with e -> + failwith ("Problem: "^name) in + + (* Find all sums *) + let s1' = List.fold_left add_step' dummy (map sum_step constraints) in + let s1 = mul_step s1' (mk_real_int precision_constant) in + let s2 = List.fold_left add_step' dummy (map sum_step target_var_bounds) in + let s3 = List.fold_left add_step' dummy (map sum_step var_bounds) in + let s4 = add_step' (add_step' s1 s2) s3 in + + (* Final transformations *) + let r6 = CONV_RULE (DEPTH_CONV NUM_TO_NUMERAL_CONV) s4 in + let m = term_of_rat (precision_constant */ precision_constant */ precision_constant) in + let r7 = mul_rat_step r6 (mk_comb (`(/) (&1)`, m)) in + let r8 = REWRITE_RULE[lin_f; ITLIST; REAL_ADD_RID] r7 in + let r9 = EQT_ELIM (REAL_RAT_LE_CONV (mk_binop le_op ((rand o concl) r8) target_bound)) in + MATCH_MP REAL_LE_TRANS (CONJ r8 r9);; + + + + +(*******************************************) + +(* +needs "test_out.hl";; +prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; + +(* 3.060 *) +test 1 +(prove_hypermap_lp hypermap_string precision constraints target_variables) variable_bounds;; + + +let x = 1;; +*) + + +(*************************************) + + +(* +let prove_hypermap_lp hyp_str precision constraints target_var_bounds var_bounds = + (* Compute all components of the hypermap *) + let list_hyp, list_thm = compute_all hyp_str in + let hyp_rewrites1 = map (Hashtbl.find list_thm) + [ + "darts"; "darts3"; "darts4"; "dartsX"; + "nodes"; "edges"; + "faces"; "faces3"; "faces4"; "faces5"; "faces6" + ] in + let hyp_rewrites2 = map (Hashtbl.find list_thm) + [ + "f_list_ext"; + "nodes_table"; + "faces_table"; + ] in + let l_var_list = `L:((num)list)list` in + + (* This function generates all inequalities from a given base inequality *) + let get_ineqs = fun ineq indices -> + let t0 = INST[list_hyp, l_var_list] ineq in + let t1 = MY_PROVE_HYP (Hashtbl.find list_thm "good_list") t0 in + let t2 = REWRITE_RULE hyp_rewrites1 t1 in + let ths = select_all t2 indices in + let ineqs = map (REWRITE_RULE ([list_sum; ITLIST; REAL_ADD_RID; set_of_list; GSYM REAL_ADD_ASSOC] @ hyp_rewrites2)) ths in + ineqs in + + let precision_constant = Int 10 **/ (Int precision) in + let target_bound = `&12` in + + (* This function generates all inequalities with the given name and indices, + multiplies these inequalities by given coefficients, and adds up the obtained + inequalities *) + let sum_step = fun (name, indices, c) -> + try + let ineq = find_ineq precision name in + let ineqs = get_ineqs ineq indices in + let s1 = map transform_le_ineq (zip ineqs c) in + List.fold_left add_step' dummy s1 + with e -> + failwith ("Problem: "^name) in + + (* Find all sums *) + let s1' = List.fold_left add_step' dummy (map sum_step constraints) in + let s1 = mul_step s1' (mk_real_int precision_constant) in + let s2 = List.fold_left add_step' dummy (map sum_step target_var_bounds) in + let s3 = List.fold_left add_step' dummy (map sum_step var_bounds) in + let s4 = add_step' (add_step' s1 s2) s3 in + + (* Final transformations *) + let r6 = CONV_RULE (DEPTH_CONV NUM_TO_NUMERAL_CONV) s4 in + let m = term_of_rat (precision_constant */ precision_constant */ precision_constant) in + let r7 = mul_rat_step r6 (mk_comb (`(/) (&1)`, m)) in + let r8 = REWRITE_RULE[lin_f; ITLIST; REAL_ADD_RID] r7 in + let r9 = EQT_ELIM (REAL_RAT_LE_CONV (mk_binop le_op ((rand o concl) r8) target_bound)) in + MATCH_MP REAL_LE_TRANS (CONJ r8 r9);; +*) + + +(***********************************) + +(* +needs "test_out.hl";; + +(* 18.821 *) +test 1 +(prove_hypermap_lp hypermap_string precision constraints target_variables) variable_bounds;; +*) + +(* +(* Compute all components of the hypermap *) +let hyp_str = hypermap_string and + target_var_bounds = target_variables and + var_bounds = variable_bounds;; + +(* 0.736 *) +test 1 (compute_all) hyp_str;; + + +(**************************) + +(* + +(* 2.340 *) +test 10 (get_ineqs ineq) indices;; + +(* 2.136 *) +test 10 (get_ineqs2 ineq) indices;; + +*) + +*) diff --git a/formal_lp/old/ineqs/tests/149438122187_out.hl b/formal_lp/old/ineqs/tests/149438122187_out.hl new file mode 100644 index 0000000..16c3a74 --- /dev/null +++ b/formal_lp/old/ineqs/tests/149438122187_out.hl @@ -0,0 +1,89 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "149438122187 18 6 0 1 2 3 4 5 4 0 5 6 7 3 6 5 4 3 6 4 8 3 8 4 3 3 8 3 9 3 9 3 2 3 9 2 10 3 10 2 11 3 11 2 1 3 11 1 0 3 11 0 7 3 10 11 7 3 10 7 12 3 12 7 6 3 12 6 8 3 12 8 9 3 9 10 12 ";; +let precision = 5;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum_neg", [4; 6; 10; ], [(mk_real_int64 57218L); (mk_real_int64 11912L); (mk_real_int64 11015L); ]); +("azim_sum", [7; 8; 9; 11; 12; ], [(mk_real_int64 19865L); (mk_real_int64 49527L); (mk_real_int64 2847L); (mk_real_int64 5243L); (mk_real_int64 18828L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 91631L); (mk_real_int64 91631L); (mk_real_int64 91631L); (mk_real_int64 91631L); (mk_real_int64 78850L); (mk_real_int64 91631L); (mk_real_int64 78850L); (mk_real_int64 91631L); (mk_real_int64 91631L); (mk_real_int64 83199L); (mk_real_int64 86012L); (mk_real_int64 88030L); (mk_real_int64 76255L); ]); +("sol_sum3_neg", [1; 2; 5; 6; 9; 11; 12; 13; ], [(mk_real_int64 8432L); (mk_real_int64 2847L); (mk_real_int64 5619L); (mk_real_int64 27495L); (mk_real_int64 14739L); (mk_real_int64 27863L); (mk_real_int64 35241L); (mk_real_int64 11336L); ]); +("sol_sum3", [3; 7; 8; ], [(mk_real_int64 1073L); (mk_real_int64 11912L); (mk_real_int64 11912L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; ], [(mk_real_int64 89870L); (mk_real_int64 83199L); (mk_real_int64 82410L); (mk_real_int64 83199L); (mk_real_int64 74997L); (mk_real_int64 86012L); (mk_real_int64 39444L); (mk_real_int64 78850L); (mk_real_int64 78850L); (mk_real_int64 52200L); (mk_real_int64 78850L); (mk_real_int64 57649L); (mk_real_int64 76255L); (mk_real_int64 76255L); (mk_real_int64 76255L); (mk_real_int64 76255L); ]); +("tau_sum4_neg", [0; ], [(mk_real_int64 91631L); ]); +("tau_sum6_neg", [0; ], [(mk_real_int64 91631L); ]); +("ln_def_neg", [0; 1; 2; 3; 5; 7; 8; ], [(mk_real_int64 1029L); (mk_real_int64 1029L); (mk_real_int64 1029L); (mk_real_int64 1029L); (mk_real_int64 1029L); (mk_real_int64 1029L); (mk_real_int64 1029L); ]); +("ln_def", [4; 6; 9; 10; 11; 12; ], [(mk_real_int64 13062L); (mk_real_int64 13062L); (mk_real_int64 8267L); (mk_real_int64 5166L); (mk_real_int64 2941L); (mk_real_int64 15924L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 575732L); (mk_real_int64 575732L); (mk_real_int64 575732L); (mk_real_int64 575732L); (mk_real_int64 495431L); (mk_real_int64 575732L); (mk_real_int64 495431L); (mk_real_int64 575732L); (mk_real_int64 575732L); (mk_real_int64 522753L); (mk_real_int64 540428L); (mk_real_int64 553110L); (mk_real_int64 479122L); ]); +("edge_sym_neg", [9; 12; 14; 15; 18; 20; 21; 26; 27; 29; 44; 45; 48; 51; 54; ], [(mk_real_int64 11731L); (mk_real_int64 1847L); (mk_real_int64 2341L); (mk_real_int64 2341L); (mk_real_int64 5858L); (mk_real_int64 737L); (mk_real_int64 737L); (mk_real_int64 4194L); (mk_real_int64 580L); (mk_real_int64 23428L); (mk_real_int64 1307L); (mk_real_int64 3242L); (mk_real_int64 8265L); (mk_real_int64 31033L); (mk_real_int64 2078L); ]); +("edge_sym", [24; 30; 36; 39; 42; ], [(mk_real_int64 580L); (mk_real_int64 4194L); (mk_real_int64 35005L); (mk_real_int64 11731L); (mk_real_int64 11346L); ]); +("y1_def_neg", [11; 16; 17; 24; 25; 26; 28; 34; 36; 39; 40; 42; 44; 45; 50; 52; 53; 57; ], [(mk_real_int64 1979L); (mk_real_int64 473L); (mk_real_int64 5582L); (mk_real_int64 18697L); (mk_real_int64 810L); (mk_real_int64 1054L); (mk_real_int64 15801L); (mk_real_int64 1799L); (mk_real_int64 12813L); (mk_real_int64 21558L); (mk_real_int64 7906L); (mk_real_int64 2587L); (mk_real_int64 1107L); (mk_real_int64 5743L); (mk_real_int64 21879L); (mk_real_int64 1853L); (mk_real_int64 4166L); (mk_real_int64 1466L); ]); +("y1_def", [15; 18; 21; 27; 30; 33; 35; 41; 43; 46; 47; 49; 51; 54; 55; ], [(mk_real_int64 5468L); (mk_real_int64 1082L); (mk_real_int64 3403L); (mk_real_int64 2135L); (mk_real_int64 10448L); (mk_real_int64 10865L); (mk_real_int64 22653L); (mk_real_int64 5956L); (mk_real_int64 10588L); (mk_real_int64 4468L); (mk_real_int64 13391L); (mk_real_int64 3301L); (mk_real_int64 773L); (mk_real_int64 629L); (mk_real_int64 629L); ]); +("y2_def_neg", [11; 21; 24; 26; 33; 34; 35; 36; 40; 41; 46; 51; 54; 55; ], [(mk_real_int64 282L); (mk_real_int64 1246L); (mk_real_int64 2663L); (mk_real_int64 1054L); (mk_real_int64 5648L); (mk_real_int64 1799L); (mk_real_int64 6887L); (mk_real_int64 6601L); (mk_real_int64 1021L); (mk_real_int64 1811L); (mk_real_int64 1358L); (mk_real_int64 235L); (mk_real_int64 191L); (mk_real_int64 191L); ]); +("y2_def", [15; 16; 17; 18; 25; 27; 28; 30; 39; 42; 43; 44; 45; 47; 49; 50; 52; 53; 57; ], [(mk_real_int64 2516L); (mk_real_int64 287L); (mk_real_int64 561L); (mk_real_int64 1082L); (mk_real_int64 1254L); (mk_real_int64 2135L); (mk_real_int64 9583L); (mk_real_int64 10448L); (mk_real_int64 19519L); (mk_real_int64 1569L); (mk_real_int64 10588L); (mk_real_int64 671L); (mk_real_int64 3483L); (mk_real_int64 13391L); (mk_real_int64 5867L); (mk_real_int64 5355L); (mk_real_int64 2869L); (mk_real_int64 2527L); (mk_real_int64 2270L); ]); +("y3_def_neg", [11; 21; 24; 26; 33; 34; 35; 36; 40; 41; 46; 51; 54; 55; ], [(mk_real_int64 282L); (mk_real_int64 1246L); (mk_real_int64 2663L); (mk_real_int64 1054L); (mk_real_int64 5648L); (mk_real_int64 1799L); (mk_real_int64 6887L); (mk_real_int64 6601L); (mk_real_int64 1021L); (mk_real_int64 1811L); (mk_real_int64 1358L); (mk_real_int64 235L); (mk_real_int64 191L); (mk_real_int64 191L); ]); +("y3_def", [15; 16; 17; 18; 25; 27; 28; 30; 39; 42; 43; 44; 45; 47; 49; 50; 52; 53; 57; ], [(mk_real_int64 2516L); (mk_real_int64 287L); (mk_real_int64 561L); (mk_real_int64 1082L); (mk_real_int64 1254L); (mk_real_int64 2135L); (mk_real_int64 9583L); (mk_real_int64 10448L); (mk_real_int64 19519L); (mk_real_int64 1569L); (mk_real_int64 10588L); (mk_real_int64 671L); (mk_real_int64 3483L); (mk_real_int64 13391L); (mk_real_int64 5867L); (mk_real_int64 5355L); (mk_real_int64 2869L); (mk_real_int64 2527L); (mk_real_int64 2270L); ]); +("y4_def_neg", [1; 6; 7; 8; 14; 15; 16; 17; 18; 20; 26; 29; 30; 32; 33; 34; 35; 37; 39; 40; 42; 43; 47; ], [(mk_real_int64 1847L); (mk_real_int64 540L); (mk_real_int64 5587L); (mk_real_int64 558L); (mk_real_int64 17447L); (mk_real_int64 2361L); (mk_real_int64 732L); (mk_real_int64 1101L); (mk_real_int64 18039L); (mk_real_int64 5389L); (mk_real_int64 10627L); (mk_real_int64 35005L); (mk_real_int64 11489L); (mk_real_int64 2953L); (mk_real_int64 5461L); (mk_real_int64 1264L); (mk_real_int64 6556L); (mk_real_int64 6907L); (mk_real_int64 5158L); (mk_real_int64 30135L); (mk_real_int64 5401L); (mk_real_int64 4757L); (mk_real_int64 4272L); ]); +("y4_def", [5; 11; 23; 24; 25; 31; 36; 41; 44; 45; ], [(mk_real_int64 1847L); (mk_real_int64 5858L); (mk_real_int64 23428L); (mk_real_int64 3850L); (mk_real_int64 35022L); (mk_real_int64 9208L); (mk_real_int64 6907L); (mk_real_int64 1194L); (mk_real_int64 972L); (mk_real_int64 972L); ]); +("y5_def_neg", [6; 15; 18; 21; 26; 27; 30; 35; 36; 41; 43; 46; 47; 49; 51; 54; 55; ], [(mk_real_int64 11731L); (mk_real_int64 2341L); (mk_real_int64 558L); (mk_real_int64 737L); (mk_real_int64 732L); (mk_real_int64 1101L); (mk_real_int64 5389L); (mk_real_int64 6887L); (mk_real_int64 3867L); (mk_real_int64 1811L); (mk_real_int64 5461L); (mk_real_int64 1358L); (mk_real_int64 6907L); (mk_real_int64 662L); (mk_real_int64 235L); (mk_real_int64 191L); (mk_real_int64 191L); ]); +("y5_def", [16; 17; 25; 28; 34; 39; 40; 42; 44; 45; 50; 52; 53; 57; ], [(mk_real_int64 287L); (mk_real_int64 1098L); (mk_real_int64 1254L); (mk_real_int64 9583L); (mk_real_int64 3850L); (mk_real_int64 11731L); (mk_real_int64 569L); (mk_real_int64 1569L); (mk_real_int64 671L); (mk_real_int64 3483L); (mk_real_int64 7733L); (mk_real_int64 2869L); (mk_real_int64 2527L); (mk_real_int64 2270L); ]); +("y6_def_neg", [15; 18; 21; 26; 27; 30; 36; 41; 43; 47; 49; 51; 54; ], [(mk_real_int64 2341L); (mk_real_int64 558L); (mk_real_int64 737L); (mk_real_int64 732L); (mk_real_int64 1101L); (mk_real_int64 5389L); (mk_real_int64 3867L); (mk_real_int64 1811L); (mk_real_int64 5461L); (mk_real_int64 6907L); (mk_real_int64 662L); (mk_real_int64 235L); (mk_real_int64 191L); ]); +("y6_def", [16; 17; 22; 25; 28; 34; 35; 39; 40; 42; 44; 45; 46; 50; 52; 53; 55; 57; ], [(mk_real_int64 1801L); (mk_real_int64 1098L); (mk_real_int64 18184L); (mk_real_int64 1254L); (mk_real_int64 9583L); (mk_real_int64 17514L); (mk_real_int64 18L); (mk_real_int64 11731L); (mk_real_int64 569L); (mk_real_int64 1569L); (mk_real_int64 671L); (mk_real_int64 3483L); (mk_real_int64 8214L); (mk_real_int64 7733L); (mk_real_int64 27533L); (mk_real_int64 6330L); (mk_real_int64 4852L); (mk_real_int64 2270L); ]); +("y8_def_neg", [1; ], [(mk_real_int64 11731L); ]); +("RHA", [10; 12; 13; 14; 17; 18; 20; 21; 22; 23; 26; 27; 28; 29; 30; 32; 36; 37; 38; 40; 42; 43; 44; 45; 47; 48; 51; 54; 55; 56; ], [(mk_real_int64 1761L); (mk_real_int64 1761L); (mk_real_int64 8432L); (mk_real_int64 8432L); (mk_real_int64 2847L); (mk_real_int64 9220L); (mk_real_int64 8432L); (mk_real_int64 2813L); (mk_real_int64 11015L); (mk_real_int64 16634L); (mk_real_int64 5619L); (mk_real_int64 2018L); (mk_real_int64 22252L); (mk_real_int64 52187L); (mk_real_int64 39406L); (mk_real_int64 12780L); (mk_real_int64 6336L); (mk_real_int64 26651L); (mk_real_int64 39431L); (mk_real_int64 9180L); (mk_real_int64 8469L); (mk_real_int64 30381L); (mk_real_int64 32137L); (mk_real_int64 9035L); (mk_real_int64 15376L); (mk_real_int64 15376L); (mk_real_int64 6944L); (mk_real_int64 9757L); (mk_real_int64 9757L); (mk_real_int64 11775L); ]); +("tau6", [0; ], [(mk_real_int64 91631L); ]); +("ineq106", [1; 6; 7; 14; 18; 26; 29; 32; 34; 35; 40; 43; ], [(mk_real_int64 1761L); (mk_real_int64 788L); (mk_real_int64 6373L); (mk_real_int64 16634L); (mk_real_int64 26335L); (mk_real_int64 6445L); (mk_real_int64 39431L); (mk_real_int64 4311L); (mk_real_int64 1845L); (mk_real_int64 9571L); (mk_real_int64 15376L); (mk_real_int64 6944L); ]); +("ineq107", [5; 11; 23; 25; 31; 36; 41; 44; 45; ], [(mk_real_int64 4527L); (mk_real_int64 7130L); (mk_real_int64 25328L); (mk_real_int64 45307L); (mk_real_int64 11912L); (mk_real_int64 8936L); (mk_real_int64 1545L); (mk_real_int64 1258L); (mk_real_int64 1258L); ]); +("ineq108", [15; 29; 30; 39; 40; 42; 47; ], [(mk_real_int64 3446L); (mk_real_int64 5126L); (mk_real_int64 11496L); (mk_real_int64 4286L); (mk_real_int64 20727L); (mk_real_int64 7885L); (mk_real_int64 6237L); ]); +("ineq109", [11; 23; 24; ], [(mk_real_int64 1073L); (mk_real_int64 11912L); (mk_real_int64 11912L); ]); +("ineq110", [5; 8; 17; 20; 29; 33; 37; 39; ], [(mk_real_int64 8432L); (mk_real_int64 2847L); (mk_real_int64 5619L); (mk_real_int64 27495L); (mk_real_int64 14739L); (mk_real_int64 27863L); (mk_real_int64 35241L); (mk_real_int64 11336L); ]); +("ineq111", [1; 7; 14; 16; 26; 29; 30; 40; ], [(mk_real_int64 5127L); (mk_real_int64 9769L); (mk_real_int64 48425L); (mk_real_int64 5858L); (mk_real_int64 49701L); (mk_real_int64 12756L); (mk_real_int64 28913L); (mk_real_int64 43237L); ]); +("ineq112", [23; ], [(mk_real_int64 39406L); ]); +("ineq113", [5; 15; 36; ], [(mk_real_int64 4082L); (mk_real_int64 77529L); (mk_real_int64 28870L); ]); +("ineq114", [0; 2; 3; 8; 9; 10; 13; 17; 19; 22; 26; 28; 30; 32; 33; 34; 38; 39; 40; 42; 43; 46; 47; ], [(mk_real_int64 81930L); (mk_real_int64 2813L); (mk_real_int64 79117L); (mk_real_int64 10181L); (mk_real_int64 6262L); (mk_real_int64 15183L); (mk_real_int64 26572L); (mk_real_int64 2624L); (mk_real_int64 39444L); (mk_real_int64 39444L); (mk_real_int64 29149L); (mk_real_int64 39444L); (mk_real_int64 4676L); (mk_real_int64 45262L); (mk_real_int64 12399L); (mk_real_int64 38560L); (mk_real_int64 47384L); (mk_real_int64 5121L); (mk_real_int64 27897L); (mk_real_int64 17480L); (mk_real_int64 4548L); (mk_real_int64 27187L); (mk_real_int64 20113L); ]); +("ineq120", [2; 3; ], [(mk_real_int64 65400L); (mk_real_int64 26231L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 530596L); (mk_real_int64 530596L); (mk_real_int64 530596L); (mk_real_int64 530596L); (mk_real_int64 472243L); (mk_real_int64 530596L); (mk_real_int64 472243L); (mk_real_int64 530596L); (mk_real_int64 530596L); (mk_real_int64 553109L); (mk_real_int64 509884L); (mk_real_int64 478830L); (mk_real_int64 446266L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_lo", [9; 12; 20; 21; 25; 29; 32; 33; 35; 36; 38; 44; 46; 49; 50; 52; 57; ], [(mk_real_int64 26370L); (mk_real_int64 6200L); (mk_real_int64 44200L); (mk_real_int64 100000L); (mk_real_int64 1100L); (mk_real_int64 5600L); (mk_real_int64 5600L); (mk_real_int64 84200L); (mk_real_int64 100000L); (mk_real_int64 72600L); (mk_real_int64 5600L); (mk_real_int64 44000L); (mk_real_int64 33000L); (mk_real_int64 25400L); (mk_real_int64 47800L); (mk_real_int64 52000L); (mk_real_int64 26200L); ]); +("azim_hi", [1; 8; 10; 13; 15; 18; 19; 23; 27; 30; 40; 42; 43; 48; 53; 56; ], [(mk_real_int64 5721800000L); (mk_real_int64 42000L); (mk_real_int64 18000L); (mk_real_int64 24200L); (mk_real_int64 76200L); (mk_real_int64 30600L); (mk_real_int64 1200L); (mk_real_int64 7200L); (mk_real_int64 62400L); (mk_real_int64 100000L); (mk_real_int64 17600L); (mk_real_int64 1200L); (mk_real_int64 77400L); (mk_real_int64 38400L); (mk_real_int64 4800L); (mk_real_int64 106200L); ]); +("rhazim_hi", [1; 28; 37; ], [(mk_real_int64 1278100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); ]); +("rhazim_lo", [16; 17; 18; 32; 42; ], [(mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); ]); +("rho_hi", [0; 1; 2; 3; 5; 7; 8; 9; 10; 12; ], [(mk_real_int64 298289L); (mk_real_int64 298289L); (mk_real_int64 298289L); (mk_real_int64 298289L); (mk_real_int64 298289L); (mk_real_int64 298289L); (mk_real_int64 298289L); (mk_real_int64 212481L); (mk_real_int64 173828L); (mk_real_int64 265345L); ]); +("rho_lo", [4; 6; 11; ], [(mk_real_int64 146850L); (mk_real_int64 146850L); (mk_real_int64 78430L); ]); +("tau_hi", [4; 12; ], [(mk_real_int64 100000L); (mk_real_int64 100000L); ]); +("tau_lo", [4; 5; 7; 13; 14; 16; 17; ], [(mk_real_int64 6246100000L); (mk_real_int64 6175400000L); (mk_real_int64 100000L); (mk_real_int64 669000000L); (mk_real_int64 100000L); (mk_real_int64 5422700000L); (mk_real_int64 2895500000L); ]); +("y1_lo", [11; 15; 17; 18; 21; 26; 36; 39; 43; 49; 50; 51; 53; ], [(mk_real_int64 46000L); (mk_real_int64 34000L); (mk_real_int64 22000L); (mk_real_int64 14000L); (mk_real_int64 2300L); (mk_real_int64 44000L); (mk_real_int64 18000L); (mk_real_int64 47000L); (mk_real_int64 6000L); (mk_real_int64 53000L); (mk_real_int64 10500L); (mk_real_int64 50000L); (mk_real_int64 40000L); ]); +("y1_hi", [16; 24; 25; 27; 30; 33; 34; 35; 40; 42; 45; 47; 52; 57; ], [(mk_real_int64 20000L); (mk_real_int64 10000L); (mk_real_int64 19000L); (mk_real_int64 22000L); (mk_real_int64 10000L); (mk_real_int64 28800L); (mk_real_int64 28800L); (mk_real_int64 50000L); (mk_real_int64 10000L); (mk_real_int64 40000L); (mk_real_int64 40000L); (mk_real_int64 58000L); (mk_real_int64 2500L); (mk_real_int64 30500L); ]); +("y2_hi", [15; 21; 27; 28; 30; 34; 35; 36; 39; 40; 41; 44; 47; 49; 50; 51; 52; ], [(mk_real_int64 5600L); (mk_real_int64 21700L); (mk_real_int64 22000L); (mk_real_int64 30650L); (mk_real_int64 10000L); (mk_real_int64 28800L); (mk_real_int64 33600L); (mk_real_int64 15550L); (mk_real_int64 3230L); (mk_real_int64 5440L); (mk_real_int64 37600L); (mk_real_int64 39550L); (mk_real_int64 58000L); (mk_real_int64 35540L); (mk_real_int64 22170L); (mk_real_int64 16000L); (mk_real_int64 35150L); ]); +("y2_lo", [11; 16; 17; 18; 24; 25; 26; 33; 42; 43; 45; 46; 53; 54; 55; 57; ], [(mk_real_int64 3210L); (mk_real_int64 24680L); (mk_real_int64 28530L); (mk_real_int64 14000L); (mk_real_int64 38740L); (mk_real_int64 60L); (mk_real_int64 44000L); (mk_real_int64 56800L); (mk_real_int64 22710L); (mk_real_int64 6000L); (mk_real_int64 11310L); (mk_real_int64 27200L); (mk_real_int64 7840L); (mk_real_int64 21600L); (mk_real_int64 21600L); (mk_real_int64 35570L); ]); +("y3_hi", [15; 21; 27; 28; 30; 34; 35; 36; 39; 40; 41; 44; 47; 49; 50; 51; 52; ], [(mk_real_int64 5600L); (mk_real_int64 21700L); (mk_real_int64 22000L); (mk_real_int64 30650L); (mk_real_int64 10000L); (mk_real_int64 28800L); (mk_real_int64 33600L); (mk_real_int64 15550L); (mk_real_int64 3230L); (mk_real_int64 5440L); (mk_real_int64 37600L); (mk_real_int64 39550L); (mk_real_int64 58000L); (mk_real_int64 35540L); (mk_real_int64 22170L); (mk_real_int64 16000L); (mk_real_int64 35150L); ]); +("y3_lo", [11; 16; 17; 18; 24; 25; 26; 33; 42; 43; 45; 46; 53; 54; 55; 57; ], [(mk_real_int64 3210L); (mk_real_int64 24680L); (mk_real_int64 28530L); (mk_real_int64 14000L); (mk_real_int64 38740L); (mk_real_int64 60L); (mk_real_int64 44000L); (mk_real_int64 56800L); (mk_real_int64 22710L); (mk_real_int64 6000L); (mk_real_int64 11310L); (mk_real_int64 27200L); (mk_real_int64 7840L); (mk_real_int64 21600L); (mk_real_int64 21600L); (mk_real_int64 35570L); ]); +("y4_lo", [1; 5; 8; 14; 16; 17; 18; 20; 24; 26; 31; 32; 33; 35; 37; 40; 42; 47; ], [(mk_real_int64 16000L); (mk_real_int64 30100L); (mk_real_int64 1200L); (mk_real_int64 41500L); (mk_real_int64 25000L); (mk_real_int64 32400L); (mk_real_int64 47500L); (mk_real_int64 2000L); (mk_real_int64 4160L); (mk_real_int64 45000L); (mk_real_int64 2400L); (mk_real_int64 3500L); (mk_real_int64 14800L); (mk_real_int64 13500L); (mk_real_int64 23600L); (mk_real_int64 18000L); (mk_real_int64 22500L); (mk_real_int64 34500L); ]); +("y4_hi", [6; 7; 11; 15; 23; 25; 29; 30; 34; 36; 39; 41; 43; 44; 45; ], [(mk_real_int64 22000L); (mk_real_int64 37000L); (mk_real_int64 28360L); (mk_real_int64 49000L); (mk_real_int64 50240L); (mk_real_int64 31100L); (mk_real_int64 11100L); (mk_real_int64 11500L); (mk_real_int64 17500L); (mk_real_int64 52800L); (mk_real_int64 23400L); (mk_real_int64 28500L); (mk_real_int64 36000L); (mk_real_int64 43400L); (mk_real_int64 43400L); ]); +("y5_lo", [11; 16; 18; 24; 25; 26; 27; 30; 34; 36; 39; 42; 43; 45; 46; 47; 49; 53; 54; 55; 57; ], [(mk_real_int64 4710L); (mk_real_int64 24680L); (mk_real_int64 1200L); (mk_real_int64 1240L); (mk_real_int64 60L); (mk_real_int64 25000L); (mk_real_int64 32400L); (mk_real_int64 2000L); (mk_real_int64 4160L); (mk_real_int64 28950L); (mk_real_int64 5170L); (mk_real_int64 22710L); (mk_real_int64 14800L); (mk_real_int64 11310L); (mk_real_int64 27200L); (mk_real_int64 23600L); (mk_real_int64 18060L); (mk_real_int64 7840L); (mk_real_int64 21600L); (mk_real_int64 21600L); (mk_real_int64 35570L); ]); +("y5_hi", [15; 17; 21; 28; 33; 35; 40; 41; 44; 50; 51; 52; ], [(mk_real_int64 22400L); (mk_real_int64 970L); (mk_real_int64 3360L); (mk_real_int64 30650L); (mk_real_int64 10240L); (mk_real_int64 33600L); (mk_real_int64 26940L); (mk_real_int64 37600L); (mk_real_int64 39550L); (mk_real_int64 25670L); (mk_real_int64 16000L); (mk_real_int64 35150L); ]); +("y6_lo", [11; 16; 18; 22; 24; 25; 26; 27; 30; 34; 35; 36; 39; 42; 43; 45; 46; 47; 49; 52; 53; 54; 55; 57; ], [(mk_real_int64 4710L); (mk_real_int64 151424680L); (mk_real_int64 1200L); (mk_real_int64 1818400000L); (mk_real_int64 1240L); (mk_real_int64 60L); (mk_real_int64 25000L); (mk_real_int64 32400L); (mk_real_int64 2000L); (mk_real_int64 1366404160L); (mk_real_int64 690466400L); (mk_real_int64 28950L); (mk_real_int64 5170L); (mk_real_int64 22710L); (mk_real_int64 14800L); (mk_real_int64 11310L); (mk_real_int64 957227200L); (mk_real_int64 23600L); (mk_real_int64 18060L); (mk_real_int64 2466400000L); (mk_real_int64 380307840L); (mk_real_int64 21600L); (mk_real_int64 504321600L); (mk_real_int64 35570L); ]); +("y6_hi", [15; 17; 21; 28; 33; 40; 41; 44; 50; 51; 52; ], [(mk_real_int64 22400L); (mk_real_int64 970L); (mk_real_int64 3360L); (mk_real_int64 30650L); (mk_real_int64 10240L); (mk_real_int64 26940L); (mk_real_int64 37600L); (mk_real_int64 39550L); (mk_real_int64 25670L); (mk_real_int64 16000L); (mk_real_int64 35150L); ]); +("y8_hi", [1; ], [(mk_real_int64 1173100000L); ]); +("ye_hi", [25; 27; 35; 51; 53; 57; ], [(mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); ]); +("ye_lo", [24; 40; 50; 52; 54; ], [(mk_real_int64 58000000L); (mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); ]); +("yn_lo", [0; 1; 2; 3; 4; 5; 6; 7; 8; 11; 12; ], [(mk_real_int64 15068L); (mk_real_int64 15068L); (mk_real_int64 15068L); (mk_real_int64 15068L); (mk_real_int64 114034L); (mk_real_int64 115068L); (mk_real_int64 14034L); (mk_real_int64 115068L); (mk_real_int64 115068L); (mk_real_int64 74887L); (mk_real_int64 96668L); ]); +("yn_hi", [9; 10; ], [(mk_real_int64 98031L); (mk_real_int64 42038L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests/156588677070_out.hl b/formal_lp/old/ineqs/tests/156588677070_out.hl new file mode 100644 index 0000000..f7260f2 --- /dev/null +++ b/formal_lp/old/ineqs/tests/156588677070_out.hl @@ -0,0 +1,90 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "156588677070 21 6 0 1 2 3 4 5 4 0 5 6 7 3 6 5 4 3 6 4 8 3 8 4 9 3 9 4 3 3 9 3 10 3 10 3 11 3 11 3 2 3 11 2 1 3 11 1 12 3 12 1 13 3 13 1 0 3 13 0 7 3 13 7 14 3 14 7 8 3 7 6 8 3 14 8 9 4 14 9 10 12 3 10 11 12 3 12 13 14 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [5; 9; 14; ], [(mk_real_int64 202L); (mk_real_int64 91L); (mk_real_int64 506L); ]); +("azim_sum_neg", [0; 3; 7; 8; 10; 11; ], [(mk_real_int64 38L); (mk_real_int64 167L); (mk_real_int64 38L); (mk_real_int64 38L); (mk_real_int64 50L); (mk_real_int64 50L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 940L); (mk_real_int64 1283L); (mk_real_int64 1283L); (mk_real_int64 857L); (mk_real_int64 1283L); (mk_real_int64 1111L); (mk_real_int64 1111L); (mk_real_int64 902L); (mk_real_int64 1109L); (mk_real_int64 1111L); (mk_real_int64 1046L); (mk_real_int64 901L); (mk_real_int64 1111L); (mk_real_int64 1111L); (mk_real_int64 1111L); ]); +("sol_sum3", [0; 5; 6; 7; ], [(mk_real_int64 38L); (mk_real_int64 50L); (mk_real_int64 6L); (mk_real_int64 6L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; ], [(mk_real_int64 902L); (mk_real_int64 902L); (mk_real_int64 1109L); (mk_real_int64 1111L); (mk_real_int64 1046L); (mk_real_int64 901L); (mk_real_int64 857L); (mk_real_int64 857L); (mk_real_int64 901L); (mk_real_int64 1111L); (mk_real_int64 1111L); (mk_real_int64 1111L); (mk_real_int64 1111L); (mk_real_int64 1109L); (mk_real_int64 902L); (mk_real_int64 1109L); (mk_real_int64 901L); (mk_real_int64 1111L); ]); +("tau_sum4_neg", [0; 1; ], [(mk_real_int64 902L); (mk_real_int64 1111L); ]); +("tau_sum6_neg", [0; ], [(mk_real_int64 1283L); ]); +("ln_def_neg", [0; 1; 2; 4; 5; 6; 8; 9; 10; 12; 13; 14; ], [(mk_real_int64 37L); (mk_real_int64 414L); (mk_real_int64 414L); (mk_real_int64 414L); (mk_real_int64 225L); (mk_real_int64 225L); (mk_real_int64 223L); (mk_real_int64 225L); (mk_real_int64 153L); (mk_real_int64 225L); (mk_real_int64 225L); (mk_real_int64 225L); ]); +("ln_def", [3; 7; 11; ], [(mk_real_int64 55L); (mk_real_int64 5L); (mk_real_int64 7L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 5908L); (mk_real_int64 8059L); (mk_real_int64 8059L); (mk_real_int64 5385L); (mk_real_int64 8059L); (mk_real_int64 6980L); (mk_real_int64 6980L); (mk_real_int64 5668L); (mk_real_int64 6968L); (mk_real_int64 6980L); (mk_real_int64 6572L); (mk_real_int64 5658L); (mk_real_int64 6980L); (mk_real_int64 6980L); (mk_real_int64 6980L); ]); +("edge_sym_neg", [12; 15; 17; 18; 21; 23; 26; 27; 30; 36; 38; 39; 42; 47; 48; 50; 60; ], [(mk_real_int64 43L); (mk_real_int64 262L); (mk_real_int64 12L); (mk_real_int64 230L); (mk_real_int64 161L); (mk_real_int64 159L); (mk_real_int64 56L); (mk_real_int64 250L); (mk_real_int64 20L); (mk_real_int64 110L); (mk_real_int64 105L); (mk_real_int64 105L); (mk_real_int64 183L); (mk_real_int64 38L); (mk_real_int64 38L); (mk_real_int64 284L); (mk_real_int64 3L); ]); +("edge_sym", [14; 33; 35; 45; 51; ], [(mk_real_int64 106L); (mk_real_int64 149L); (mk_real_int64 105L); (mk_real_int64 38L); (mk_real_int64 1L); ]); +("y1_def_neg", [11; 12; 13; 14; 15; 17; 18; 19; 20; 21; 22; 23; 24; 25; 26; 27; 29; 31; 33; 34; 35; 36; 38; 41; 42; 44; 48; 49; 50; 51; 52; 54; 55; 62; 63; 67; ], [(mk_real_int64 65L); (mk_real_int64 6L); (mk_real_int64 125L); (mk_real_int64 191L); (mk_real_int64 101L); (mk_real_int64 104L); (mk_real_int64 222L); (mk_real_int64 21L); (mk_real_int64 303L); (mk_real_int64 103L); (mk_real_int64 60L); (mk_real_int64 142L); (mk_real_int64 163L); (mk_real_int64 87L); (mk_real_int64 331L); (mk_real_int64 8L); (mk_real_int64 12L); (mk_real_int64 107L); (mk_real_int64 158L); (mk_real_int64 73L); (mk_real_int64 97L); (mk_real_int64 124L); (mk_real_int64 151L); (mk_real_int64 103L); (mk_real_int64 247L); (mk_real_int64 247L); (mk_real_int64 54L); (mk_real_int64 65L); (mk_real_int64 1L); (mk_real_int64 113L); (mk_real_int64 112L); (mk_real_int64 257L); (mk_real_int64 1L); (mk_real_int64 57L); (mk_real_int64 77L); (mk_real_int64 175L); ]); +("y1_def", [16; 30; 32; 53; 56; ], [(mk_real_int64 19L); (mk_real_int64 29L); (mk_real_int64 80L); (mk_real_int64 19L); (mk_real_int64 1L); ]); +("y2_def_neg", [11; 12; 13; 16; 18; 20; 24; 26; 27; 30; 31; 32; 34; 38; 42; 44; 48; 51; 53; 54; 55; 63; 67; ], [(mk_real_int64 28L); (mk_real_int64 6L); (mk_real_int64 150L); (mk_real_int64 6L); (mk_real_int64 166L); (mk_real_int64 137L); (mk_real_int64 196L); (mk_real_int64 13L); (mk_real_int64 8L); (mk_real_int64 10L); (mk_real_int64 107L); (mk_real_int64 24L); (mk_real_int64 105L); (mk_real_int64 151L); (mk_real_int64 126L); (mk_real_int64 126L); (mk_real_int64 54L); (mk_real_int64 138L); (mk_real_int64 6L); (mk_real_int64 94L); (mk_real_int64 1L); (mk_real_int64 109L); (mk_real_int64 37L); ]); +("y2_def", [14; 15; 17; 19; 21; 22; 23; 25; 29; 33; 35; 36; 41; 49; 50; 52; 62; ], [(mk_real_int64 116L); (mk_real_int64 61L); (mk_real_int64 63L); (mk_real_int64 33L); (mk_real_int64 62L); (mk_real_int64 57L); (mk_real_int64 86L); (mk_real_int64 53L); (mk_real_int64 7L); (mk_real_int64 96L); (mk_real_int64 59L); (mk_real_int64 75L); (mk_real_int64 62L); (mk_real_int64 99L); (mk_real_int64 1L); (mk_real_int64 68L); (mk_real_int64 35L); ]); +("y3_def_neg", [11; 12; 13; 16; 18; 20; 24; 26; 27; 30; 31; 32; 34; 38; 42; 44; 48; 51; 53; 54; 55; 63; 67; ], [(mk_real_int64 28L); (mk_real_int64 6L); (mk_real_int64 150L); (mk_real_int64 6L); (mk_real_int64 166L); (mk_real_int64 137L); (mk_real_int64 196L); (mk_real_int64 13L); (mk_real_int64 8L); (mk_real_int64 10L); (mk_real_int64 107L); (mk_real_int64 24L); (mk_real_int64 105L); (mk_real_int64 151L); (mk_real_int64 126L); (mk_real_int64 126L); (mk_real_int64 54L); (mk_real_int64 138L); (mk_real_int64 6L); (mk_real_int64 94L); (mk_real_int64 1L); (mk_real_int64 109L); (mk_real_int64 37L); ]); +("y3_def", [14; 15; 17; 19; 21; 22; 23; 25; 29; 33; 35; 36; 41; 49; 50; 52; 62; ], [(mk_real_int64 116L); (mk_real_int64 61L); (mk_real_int64 63L); (mk_real_int64 33L); (mk_real_int64 62L); (mk_real_int64 57L); (mk_real_int64 86L); (mk_real_int64 53L); (mk_real_int64 7L); (mk_real_int64 96L); (mk_real_int64 59L); (mk_real_int64 75L); (mk_real_int64 62L); (mk_real_int64 99L); (mk_real_int64 1L); (mk_real_int64 68L); (mk_real_int64 35L); ]); +("y4_def_neg", [1; 3; 4; 5; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 19; 21; 23; 24; 25; 26; 28; 31; 32; 34; 38; 39; 40; 41; 42; 44; 45; 48; 49; 53; ], [(mk_real_int64 55L); (mk_real_int64 71L); (mk_real_int64 218L); (mk_real_int64 116L); (mk_real_int64 119L); (mk_real_int64 202L); (mk_real_int64 62L); (mk_real_int64 256L); (mk_real_int64 118L); (mk_real_int64 107L); (mk_real_int64 162L); (mk_real_int64 92L); (mk_real_int64 100L); (mk_real_int64 319L); (mk_real_int64 13L); (mk_real_int64 72L); (mk_real_int64 181L); (mk_real_int64 29L); (mk_real_int64 110L); (mk_real_int64 142L); (mk_real_int64 105L); (mk_real_int64 118L); (mk_real_int64 277L); (mk_real_int64 277L); (mk_real_int64 38L); (mk_real_int64 187L); (mk_real_int64 1L); (mk_real_int64 62L); (mk_real_int64 127L); (mk_real_int64 224L); (mk_real_int64 1L); (mk_real_int64 66L); (mk_real_int64 32L); (mk_real_int64 241L); ]); +("y4_def", [2; 6; 17; 20; 22; 43; 46; ], [(mk_real_int64 12L); (mk_real_int64 29L); (mk_real_int64 16L); (mk_real_int64 49L); (mk_real_int64 124L); (mk_real_int64 30L); (mk_real_int64 1L); ]); +("y5_def_neg", [11; 13; 16; 18; 20; 24; 30; 31; 32; 34; 38; 42; 44; 48; 51; 53; 54; 55; 61; 63; ], [(mk_real_int64 15L); (mk_real_int64 106L); (mk_real_int64 6L); (mk_real_int64 105L); (mk_real_int64 76L); (mk_real_int64 138L); (mk_real_int64 7L); (mk_real_int64 72L); (mk_real_int64 24L); (mk_real_int64 75L); (mk_real_int64 105L); (mk_real_int64 65L); (mk_real_int64 65L); (mk_real_int64 38L); (mk_real_int64 97L); (mk_real_int64 6L); (mk_real_int64 47L); (mk_real_int64 1L); (mk_real_int64 3L); (mk_real_int64 78L); ]); +("y5_def", [12; 14; 15; 17; 19; 21; 22; 23; 25; 26; 27; 29; 33; 35; 36; 41; 49; 50; 52; 62; ], [(mk_real_int64 12L); (mk_real_int64 116L); (mk_real_int64 61L); (mk_real_int64 63L); (mk_real_int64 33L); (mk_real_int64 62L); (mk_real_int64 57L); (mk_real_int64 86L); (mk_real_int64 53L); (mk_real_int64 28L); (mk_real_int64 16L); (mk_real_int64 7L); (mk_real_int64 96L); (mk_real_int64 59L); (mk_real_int64 75L); (mk_real_int64 62L); (mk_real_int64 99L); (mk_real_int64 1L); (mk_real_int64 68L); (mk_real_int64 35L); ]); +("y6_def_neg", [11; 13; 16; 18; 30; 32; 34; 38; 42; 48; 51; ], [(mk_real_int64 12L); (mk_real_int64 106L); (mk_real_int64 6L); (mk_real_int64 105L); (mk_real_int64 7L); (mk_real_int64 24L); (mk_real_int64 66L); (mk_real_int64 105L); (mk_real_int64 65L); (mk_real_int64 38L); (mk_real_int64 97L); ]); +("y6_def", [10; 12; 14; 15; 17; 19; 21; 22; 23; 24; 25; 26; 27; 29; 31; 33; 35; 36; 40; 41; 43; 49; 50; 52; 53; 54; 56; 62; 63; 65; 66; ], [(mk_real_int64 3L); (mk_real_int64 12L); (mk_real_int64 116L); (mk_real_int64 61L); (mk_real_int64 63L); (mk_real_int64 206L); (mk_real_int64 62L); (mk_real_int64 167L); (mk_real_int64 86L); (mk_real_int64 105L); (mk_real_int64 115L); (mk_real_int64 28L); (mk_real_int64 16L); (mk_real_int64 7L); (mk_real_int64 226L); (mk_real_int64 96L); (mk_real_int64 59L); (mk_real_int64 75L); (mk_real_int64 319L); (mk_real_int64 65L); (mk_real_int64 248L); (mk_real_int64 99L); (mk_real_int64 1L); (mk_real_int64 230L); (mk_real_int64 436L); (mk_real_int64 187L); (mk_real_int64 230L); (mk_real_int64 328L); (mk_real_int64 176L); (mk_real_int64 346L); (mk_real_int64 38L); ]); +("y8_def_neg", [4; ], [(mk_real_int64 3L); ]); +("RHA", [6; 7; 9; 12; 14; 15; 26; 28; 29; 31; 33; 35; 36; 38; 52; 54; 55; 57; 62; 64; ], [(mk_real_int64 209L); (mk_real_int64 38L); (mk_real_int64 209L); (mk_real_int64 380L); (mk_real_int64 63L); (mk_real_int64 38L); (mk_real_int64 51L); (mk_real_int64 43L); (mk_real_int64 406L); (mk_real_int64 43L); (mk_real_int64 162L); (mk_real_int64 221L); (mk_real_int64 4L); (mk_real_int64 172L); (mk_real_int64 23L); (mk_real_int64 38L); (mk_real_int64 2L); (mk_real_int64 2L); (mk_real_int64 50L); (mk_real_int64 210L); ]); +("RHB", [0; 2; 60; ], [(mk_real_int64 172L); (mk_real_int64 425L); (mk_real_int64 65L); ]); +("tau4", [1; ], [(mk_real_int64 44L); ]); +("tau6", [0; ], [(mk_real_int64 1283L); ]); +("ineq106", [1; 4; 5; 7; 8; 10; 11; 12; 13; 15; 16; 19; 23; 25; 26; 31; 39; 40; 42; 44; 48; ], [(mk_real_int64 38L); (mk_real_int64 318L); (mk_real_int64 169L); (mk_real_int64 174L); (mk_real_int64 2L); (mk_real_int64 172L); (mk_real_int64 172L); (mk_real_int64 65L); (mk_real_int64 237L); (mk_real_int64 145L); (mk_real_int64 331L); (mk_real_int64 20L); (mk_real_int64 264L); (mk_real_int64 161L); (mk_real_int64 207L); (mk_real_int64 172L); (mk_real_int64 2L); (mk_real_int64 2L); (mk_real_int64 186L); (mk_real_int64 169L); (mk_real_int64 96L); ]); +("ineq107", [3; 6; 14; 20; 22; 24; 41; 43; 46; 49; ], [(mk_real_int64 38L); (mk_real_int64 38L); (mk_real_int64 50L); (mk_real_int64 60L); (mk_real_int64 161L); (mk_real_int64 50L); (mk_real_int64 38L); (mk_real_int64 38L); (mk_real_int64 1L); (mk_real_int64 50L); ]); +("ineq108", [8; 9; 12; 32; 34; 39; 53; ], [(mk_real_int64 91L); (mk_real_int64 91L); (mk_real_int64 91L); (mk_real_int64 202L); (mk_real_int64 202L); (mk_real_int64 271L); (mk_real_int64 230L); ]); +("ineq109", [2; 17; 20; 21; ], [(mk_real_int64 38L); (mk_real_int64 50L); (mk_real_int64 6L); (mk_real_int64 6L); ]); +("ineq111", [1; 3; 8; 10; 14; 16; 21; 24; 28; 32; 34; 38; 41; 44; 45; 49; 53; ], [(mk_real_int64 233L); (mk_real_int64 802L); (mk_real_int64 1109L); (mk_real_int64 1111L); (mk_real_int64 1046L); (mk_real_int64 739L); (mk_real_int64 589L); (mk_real_int64 542L); (mk_real_int64 837L); (mk_real_int64 1111L); (mk_real_int64 1111L); (mk_real_int64 302L); (mk_real_int64 734L); (mk_real_int64 866L); (mk_real_int64 6L); (mk_real_int64 565L); (mk_real_int64 670L); ]); +("ineq112", [20; ], [(mk_real_int64 199L); ]); +("ineq113", [46; ], [(mk_real_int64 143L); ]); +("ineq114", [2; 4; 16; 19; 23; 25; 26; 28; 38; 39; 42; 45; 47; 50; 53; ], [(mk_real_int64 669L); (mk_real_int64 100L); (mk_real_int64 161L); (mk_real_int64 659L); (mk_real_int64 268L); (mk_real_int64 353L); (mk_real_int64 6L); (mk_real_int64 274L); (mk_real_int64 809L); (mk_real_int64 375L); (mk_real_int64 36L); (mk_real_int64 812L); (mk_real_int64 148L); (mk_real_int64 336L); (mk_real_int64 441L); ]); +("ineq119", [2; 6; ], [(mk_real_int64 84L); (mk_real_int64 278L); ]); +("ineq120", [0; 3; 4; 5; ], [(mk_real_int64 542L); (mk_real_int64 276L); (mk_real_int64 668L); (mk_real_int64 120L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 3100L); (mk_real_int64 3675L); (mk_real_int64 3675L); (mk_real_int64 2625L); (mk_real_int64 3675L); (mk_real_int64 3500L); (mk_real_int64 3500L); (mk_real_int64 3100L); (mk_real_int64 3600L); (mk_real_int64 3500L); (mk_real_int64 2900L); (mk_real_int64 2850L); (mk_real_int64 3500L); (mk_real_int64 3500L); (mk_real_int64 3500L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [0; 2; 5; 9; 12; 28; 29; 30; 31; 48; 55; 58; 60; 64; 67; ], [(mk_real_int64 272L); (mk_real_int64 667000L); (mk_real_int64 38000L); (mk_real_int64 208L); (mk_real_int64 794L); (mk_real_int64 1000L); (mk_real_int64 534L); (mk_real_int64 107L); (mk_real_int64 1000L); (mk_real_int64 434L); (mk_real_int64 312L); (mk_real_int64 344L); (mk_real_int64 506L); (mk_real_int64 336L); (mk_real_int64 66L); ]); +("azim_lo", [2; 6; 8; 14; 26; 33; 35; 36; 38; 49; 52; 56; 57; 59; ], [(mk_real_int64 200L); (mk_real_int64 164L); (mk_real_int64 52L); (mk_real_int64 400L); (mk_real_int64 214L); (mk_real_int64 232L); (mk_real_int64 22L); (mk_real_int64 244L); (mk_real_int64 476L); (mk_real_int64 250L); (mk_real_int64 464L); (mk_real_int64 37L); (mk_real_int64 352L); (mk_real_int64 40L); ]); +("rhazim_hi", [2; 5; 36; 62; ], [(mk_real_int64 1000L); (mk_real_int64 343000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_lo", [12; 28; 31; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_hi", [1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 3372L); (mk_real_int64 3372L); (mk_real_int64 388L); (mk_real_int64 3372L); (mk_real_int64 1524L); (mk_real_int64 1524L); (mk_real_int64 168L); (mk_real_int64 956L); (mk_real_int64 1524L); (mk_real_int64 1064L); (mk_real_int64 3884L); (mk_real_int64 1524L); (mk_real_int64 1524L); (mk_real_int64 1524L); ]); +("rho_lo", [0; ], [(mk_real_int64 1040L); ]); +("tau_lo", [7; 18; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("tau_hi", [8; ], [(mk_real_int64 1000L); ]); +("y1_lo", [13; 15; 17; 18; 19; 20; 21; 22; 23; 24; 26; 33; 36; 41; 42; 44; 48; 50; 51; 54; 55; 56; 62; ], [(mk_real_int64 360L); (mk_real_int64 400L); (mk_real_int64 400L); (mk_real_int64 205L); (mk_real_int64 385L); (mk_real_int64 180L); (mk_real_int64 200L); (mk_real_int64 385L); (mk_real_int64 200L); (mk_real_int64 280L); (mk_real_int64 620L); (mk_real_int64 400L); (mk_real_int64 200L); (mk_real_int64 200L); (mk_real_int64 450L); (mk_real_int64 450L); (mk_real_int64 360L); (mk_real_int64 200L); (mk_real_int64 120L); (mk_real_int64 280L); (mk_real_int64 80L); (mk_real_int64 500L); (mk_real_int64 600L); ]); +("y1_hi", [11; 12; 14; 27; 30; 31; 32; 34; 35; 38; 49; 52; 63; 67; ], [(mk_real_int64 260L); (mk_real_int64 262L); (mk_real_int64 200L); (mk_real_int64 450L); (mk_real_int64 94L); (mk_real_int64 74L); (mk_real_int64 500L); (mk_real_int64 440L); (mk_real_int64 400L); (mk_real_int64 340L); (mk_real_int64 115L); (mk_real_int64 400L); (mk_real_int64 300L); (mk_real_int64 350L); ]); +("y2_lo", [11; 13; 14; 20; 22; 25; 30; 32; 34; 35; 42; 44; 48; 50; 52; 54; 55; 56; 62; 63; ], [(mk_real_int64 108L); (mk_real_int64 136L); (mk_real_int64 248L); (mk_real_int64 372L); (mk_real_int64 216L); (mk_real_int64 220L); (mk_real_int64 26L); (mk_real_int64 472L); (mk_real_int64 160L); (mk_real_int64 396L); (mk_real_int64 452L); (mk_real_int64 452L); (mk_real_int64 360L); (mk_real_int64 272L); (mk_real_int64 296L); (mk_real_int64 364L); (mk_real_int64 80L); (mk_real_int64 152L); (mk_real_int64 56L); (mk_real_int64 300L); ]); +("y2_hi", [12; 15; 16; 17; 18; 19; 21; 23; 24; 26; 27; 29; 31; 33; 36; 38; 41; 49; 51; 53; 67; ], [(mk_real_int64 262L); (mk_real_int64 516L); (mk_real_int64 224L); (mk_real_int64 336L); (mk_real_int64 232L); (mk_real_int64 124L); (mk_real_int64 608L); (mk_real_int64 268L); (mk_real_int64 120L); (mk_real_int64 464L); (mk_real_int64 450L); (mk_real_int64 280L); (mk_real_int64 74L); (mk_real_int64 96L); (mk_real_int64 348L); (mk_real_int64 340L); (mk_real_int64 608L); (mk_real_int64 372L); (mk_real_int64 104L); (mk_real_int64 224L); (mk_real_int64 120L); ]); +("y3_lo", [11; 13; 14; 20; 22; 25; 30; 32; 34; 35; 42; 44; 48; 50; 52; 54; 55; 56; 62; 63; ], [(mk_real_int64 108L); (mk_real_int64 136L); (mk_real_int64 248L); (mk_real_int64 372L); (mk_real_int64 216L); (mk_real_int64 220L); (mk_real_int64 26L); (mk_real_int64 472L); (mk_real_int64 160L); (mk_real_int64 396L); (mk_real_int64 452L); (mk_real_int64 452L); (mk_real_int64 360L); (mk_real_int64 272L); (mk_real_int64 296L); (mk_real_int64 364L); (mk_real_int64 80L); (mk_real_int64 152L); (mk_real_int64 56L); (mk_real_int64 300L); ]); +("y3_hi", [12; 15; 16; 17; 18; 19; 21; 23; 24; 26; 27; 29; 31; 33; 36; 38; 41; 49; 51; 53; 67; ], [(mk_real_int64 262L); (mk_real_int64 516L); (mk_real_int64 224L); (mk_real_int64 336L); (mk_real_int64 232L); (mk_real_int64 124L); (mk_real_int64 608L); (mk_real_int64 268L); (mk_real_int64 120L); (mk_real_int64 464L); (mk_real_int64 450L); (mk_real_int64 280L); (mk_real_int64 74L); (mk_real_int64 96L); (mk_real_int64 348L); (mk_real_int64 340L); (mk_real_int64 608L); (mk_real_int64 372L); (mk_real_int64 104L); (mk_real_int64 224L); (mk_real_int64 120L); ]); +("y4_lo", [1; 7; 8; 9; 10; 13; 14; 16; 19; 20; 24; 25; 32; 34; 39; 40; 41; 42; 43; 44; 46; 53; ], [(mk_real_int64 155L); (mk_real_int64 190L); (mk_real_int64 330L); (mk_real_int64 335L); (mk_real_int64 695L); (mk_real_int64 345L); (mk_real_int64 100L); (mk_real_int64 110L); (mk_real_int64 700L); (mk_real_int64 676L); (mk_real_int64 100L); (mk_real_int64 285L); (mk_real_int64 245L); (mk_real_int64 245L); (mk_real_int64 5L); (mk_real_int64 370L); (mk_real_int64 376L); (mk_real_int64 410L); (mk_real_int64 626L); (mk_real_int64 15L); (mk_real_int64 227L); (mk_real_int64 300L); ]); +("y4_hi", [2; 3; 4; 5; 6; 11; 12; 15; 17; 21; 22; 23; 26; 28; 31; 38; 45; 48; 49; ], [(mk_real_int64 312L); (mk_real_int64 124L); (mk_real_int64 170L); (mk_real_int64 235L); (mk_real_int64 374L); (mk_real_int64 180L); (mk_real_int64 140L); (mk_real_int64 675L); (mk_real_int64 200L); (mk_real_int64 319L); (mk_real_int64 453L); (mk_real_int64 160L); (mk_real_int64 205L); (mk_real_int64 375L); (mk_real_int64 180L); (mk_real_int64 250L); (mk_real_int64 250L); (mk_real_int64 240L); (mk_real_int64 25L); ]); +("y5_lo", [11; 13; 14; 20; 22; 24; 25; 30; 32; 34; 35; 42; 44; 50; 51; 52; 56; 62; 63; 67; ], [(mk_real_int64 293L); (mk_real_int64 26L); (mk_real_int64 248L); (mk_real_int64 267L); (mk_real_int64 216L); (mk_real_int64 350L); (mk_real_int64 220L); (mk_real_int64 176L); (mk_real_int64 472L); (mk_real_int64 350L); (mk_real_int64 396L); (mk_real_int64 347L); (mk_real_int64 347L); (mk_real_int64 272L); (mk_real_int64 526L); (mk_real_int64 296L); (mk_real_int64 152L); (mk_real_int64 56L); (mk_real_int64 225L); (mk_real_int64 30L); ]); +("y5_hi", [12; 15; 16; 17; 18; 19; 21; 23; 26; 27; 29; 31; 33; 36; 38; 41; 48; 49; 53; 54; 55; ], [(mk_real_int64 312L); (mk_real_int64 516L); (mk_real_int64 224L); (mk_real_int64 336L); (mk_real_int64 227L); (mk_real_int64 124L); (mk_real_int64 608L); (mk_real_int64 268L); (mk_real_int64 109L); (mk_real_int64 200L); (mk_real_int64 280L); (mk_real_int64 319L); (mk_real_int64 96L); (mk_real_int64 348L); (mk_real_int64 375L); (mk_real_int64 608L); (mk_real_int64 250L); (mk_real_int64 372L); (mk_real_int64 224L); (mk_real_int64 266L); (mk_real_int64 250L); ]); +("y6_lo", [10; 11; 13; 14; 19; 20; 22; 24; 25; 30; 31; 32; 34; 35; 40; 41; 42; 43; 44; 50; 51; 52; 53; 54; 55; 56; 62; 63; 65; 66; 67; ], [(mk_real_int64 3000L); (mk_real_int64 3293L); (mk_real_int64 26L); (mk_real_int64 248L); (mk_real_int64 173000L); (mk_real_int64 76267L); (mk_real_int64 111000L); (mk_real_int64 244000L); (mk_real_int64 62220L); (mk_real_int64 176L); (mk_real_int64 297681L); (mk_real_int64 472L); (mk_real_int64 10000L); (mk_real_int64 396L); (mk_real_int64 319000L); (mk_real_int64 3000L); (mk_real_int64 347L); (mk_real_int64 248000L); (mk_real_int64 65347L); (mk_real_int64 272L); (mk_real_int64 526L); (mk_real_int64 162296L); (mk_real_int64 442000L); (mk_real_int64 233734L); (mk_real_int64 750L); (mk_real_int64 231000L); (mk_real_int64 293056L); (mk_real_int64 254225L); (mk_real_int64 346000L); (mk_real_int64 38000L); (mk_real_int64 30L); ]); +("y6_hi", [12; 15; 16; 17; 18; 19; 21; 22; 23; 24; 26; 27; 29; 33; 34; 36; 38; 41; 48; 49; 53; 56; ], [(mk_real_int64 312L); (mk_real_int64 516L); (mk_real_int64 224L); (mk_real_int64 336L); (mk_real_int64 227L); (mk_real_int64 124L); (mk_real_int64 608L); (mk_real_int64 784L); (mk_real_int64 268L); (mk_real_int64 650L); (mk_real_int64 109L); (mk_real_int64 200L); (mk_real_int64 280L); (mk_real_int64 96L); (mk_real_int64 650L); (mk_real_int64 348L); (mk_real_int64 375L); (mk_real_int64 608L); (mk_real_int64 250L); (mk_real_int64 372L); (mk_real_int64 224L); (mk_real_int64 848L); ]); +("y8_hi", [4; ], [(mk_real_int64 3000L); ]); +("ye_lo", [13; 15; 16; 17; 33; 40; 45; 56; ], [(mk_real_int64 149000L); (mk_real_int64 1000L); (mk_real_int64 39000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 315000L); (mk_real_int64 1000L); ]); +("ye_hi", [31; 50; 54; 55; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_hi", [0; 2; 4; 5; 6; 7; 8; 9; 10; 12; 13; 14; ], [(mk_real_int64 188L); (mk_real_int64 536L); (mk_real_int64 536L); (mk_real_int64 900L); (mk_real_int64 900L); (mk_real_int64 1385L); (mk_real_int64 2052L); (mk_real_int64 900L); (mk_real_int64 372L); (mk_real_int64 900L); (mk_real_int64 900L); (mk_real_int64 900L); ]); +("yn_lo", [1; 3; 11; ], [(mk_real_int64 1464L); (mk_real_int64 765L); (mk_real_int64 461L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests/168941837467_out.hl b/formal_lp/old/ineqs/tests/168941837467_out.hl new file mode 100644 index 0000000..694f176 --- /dev/null +++ b/formal_lp/old/ineqs/tests/168941837467_out.hl @@ -0,0 +1,91 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "168941837467 17 6 0 1 2 3 4 5 4 0 5 6 7 3 6 5 8 3 8 5 4 3 8 4 3 3 8 3 9 4 9 3 10 11 3 10 3 2 3 10 2 12 3 12 2 1 3 12 1 0 3 12 0 11 3 6 8 9 3 11 10 12 3 11 0 7 3 9 11 7 3 7 6 9 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [8; 12; ], [(mk_real_int64 91L); (mk_real_int64 74L); ]); +("azim_sum_neg", [1; 3; 4; 5; 6; 7; 10; 11; ], [(mk_real_int64 363L); (mk_real_int64 19L); (mk_real_int64 422L); (mk_real_int64 79L); (mk_real_int64 180L); (mk_real_int64 112L); (mk_real_int64 64L); (mk_real_int64 223L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 884L); (mk_real_int64 826L); (mk_real_int64 1064L); (mk_real_int64 903L); (mk_real_int64 788L); (mk_real_int64 877L); (mk_real_int64 1064L); (mk_real_int64 884L); (mk_real_int64 914L); (mk_real_int64 1064L); (mk_real_int64 914L); (mk_real_int64 850L); (mk_real_int64 1064L); ]); +("sol_sum3", [2; 6; 7; 9; ], [(mk_real_int64 27L); (mk_real_int64 91L); (mk_real_int64 84L); (mk_real_int64 23L); ]); +("sol_sum3_neg", [3; 8; 11; 12; ], [(mk_real_int64 465L); (mk_real_int64 191L); (mk_real_int64 66L); (mk_real_int64 57L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 798L); (mk_real_int64 798L); (mk_real_int64 826L); (mk_real_int64 598L); (mk_real_int64 884L); (mk_real_int64 772L); (mk_real_int64 788L); (mk_real_int64 788L); (mk_real_int64 581L); (mk_real_int64 821L); (mk_real_int64 884L); (mk_real_int64 914L); (mk_real_int64 914L); (mk_real_int64 796L); ]); +("tau_sum4_neg", [0; 1; ], [(mk_real_int64 850L); (mk_real_int64 1064L); ]); +("tau_sum6_neg", [0; ], [(mk_real_int64 884L); ]); +("ln_def_neg", [2; 6; 8; 9; 10; 12; ], [(mk_real_int64 173L); (mk_real_int64 173L); (mk_real_int64 7L); (mk_real_int64 173L); (mk_real_int64 7L); (mk_real_int64 173L); ]); +("ln_def", [0; 1; 3; 4; 5; 7; 11; ], [(mk_real_int64 25L); (mk_real_int64 90L); (mk_real_int64 4L); (mk_real_int64 131L); (mk_real_int64 32L); (mk_real_int64 25L); (mk_real_int64 63L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 5555L); (mk_real_int64 5187L); (mk_real_int64 6683L); (mk_real_int64 5674L); (mk_real_int64 4951L); (mk_real_int64 5513L); (mk_real_int64 6683L); (mk_real_int64 5555L); (mk_real_int64 5741L); (mk_real_int64 6683L); (mk_real_int64 5741L); (mk_real_int64 5341L); (mk_real_int64 6683L); ]); +("edge_sym", [0; 2; 3; 5; 8; 18; 31; 34; 37; 39; 40; 43; ], [(mk_real_int64 49L); (mk_real_int64 72L); (mk_real_int64 72L); (mk_real_int64 49L); (mk_real_int64 19L); (mk_real_int64 238L); (mk_real_int64 88L); (mk_real_int64 49L); (mk_real_int64 263L); (mk_real_int64 43L); (mk_real_int64 43L); (mk_real_int64 2L); ]); +("edge_sym_neg", [21; 28; 30; 49; 52; ], [(mk_real_int64 161L); (mk_real_int64 88L); (mk_real_int64 180L); (mk_real_int64 43L); (mk_real_int64 98L); ]); +("y1_def_neg", [0; 3; 18; 26; 27; 29; 30; 35; 39; 40; 42; 43; 44; 46; 48; 51; ], [(mk_real_int64 38L); (mk_real_int64 57L); (mk_real_int64 181L); (mk_real_int64 112L); (mk_real_int64 9L); (mk_real_int64 153L); (mk_real_int64 7L); (mk_real_int64 35L); (mk_real_int64 38L); (mk_real_int64 175L); (mk_real_int64 148L); (mk_real_int64 172L); (mk_real_int64 26L); (mk_real_int64 51L); (mk_real_int64 43L); (mk_real_int64 67L); ]); +("y1_def", [17; 19; 21; 34; 36; 38; 41; 47; 54; ], [(mk_real_int64 163L); (mk_real_int64 31L); (mk_real_int64 133L); (mk_real_int64 83L); (mk_real_int64 156L); (mk_real_int64 72L); (mk_real_int64 86L); (mk_real_int64 25L); (mk_real_int64 63L); ]); +("y2_def", [0; 3; 21; 27; 29; 38; 40; 43; 44; 47; 51; ], [(mk_real_int64 49L); (mk_real_int64 72L); (mk_real_int64 204L); (mk_real_int64 5L); (mk_real_int64 93L); (mk_real_int64 72L); (mk_real_int64 106L); (mk_real_int64 120L); (mk_real_int64 16L); (mk_real_int64 25L); (mk_real_int64 23L); ]); +("y2_def_neg", [17; 18; 19; 26; 30; 34; 35; 36; 39; 41; 42; 46; 48; 54; ], [(mk_real_int64 55L); (mk_real_int64 63L); (mk_real_int64 123L); (mk_real_int64 112L); (mk_real_int64 7L); (mk_real_int64 43L); (mk_real_int64 35L); (mk_real_int64 64L); (mk_real_int64 38L); (mk_real_int64 26L); (mk_real_int64 148L); (mk_real_int64 81L); (mk_real_int64 43L); (mk_real_int64 19L); ]); +("y3_def", [0; 3; 21; 27; 29; 38; 40; 43; 44; 47; 51; ], [(mk_real_int64 49L); (mk_real_int64 72L); (mk_real_int64 204L); (mk_real_int64 5L); (mk_real_int64 93L); (mk_real_int64 72L); (mk_real_int64 106L); (mk_real_int64 120L); (mk_real_int64 16L); (mk_real_int64 25L); (mk_real_int64 23L); ]); +("y3_def_neg", [17; 18; 19; 26; 30; 34; 35; 36; 39; 41; 42; 46; 48; 54; ], [(mk_real_int64 55L); (mk_real_int64 63L); (mk_real_int64 123L); (mk_real_int64 112L); (mk_real_int64 7L); (mk_real_int64 43L); (mk_real_int64 35L); (mk_real_int64 64L); (mk_real_int64 38L); (mk_real_int64 26L); (mk_real_int64 148L); (mk_real_int64 81L); (mk_real_int64 43L); (mk_real_int64 19L); ]); +("y4_def", [7; 9; 20; 22; 27; 40; ], [(mk_real_int64 268L); (mk_real_int64 122L); (mk_real_int64 180L); (mk_real_int64 288L); (mk_real_int64 132L); (mk_real_int64 98L); ]); +("y4_def_neg", [8; 11; 12; 13; 15; 16; 21; 24; 25; 26; 28; 29; 30; 32; 33; 34; 37; ], [(mk_real_int64 158L); (mk_real_int64 142L); (mk_real_int64 78L); (mk_real_int64 10L); (mk_real_int64 175L); (mk_real_int64 5L); (mk_real_int64 25L); (mk_real_int64 37L); (mk_real_int64 26L); (mk_real_int64 200L); (mk_real_int64 103L); (mk_real_int64 225L); (mk_real_int64 30L); (mk_real_int64 16L); (mk_real_int64 13L); (mk_real_int64 30L); (mk_real_int64 98L); ]); +("y5_def", [0; 3; 27; 29; 40; 43; 44; ], [(mk_real_int64 49L); (mk_real_int64 72L); (mk_real_int64 5L); (mk_real_int64 93L); (mk_real_int64 106L); (mk_real_int64 131L); (mk_real_int64 16L); ]); +("y5_def_neg", [17; 18; 19; 21; 26; 30; 35; 36; 38; 39; 41; 42; 46; 47; 48; 54; ], [(mk_real_int64 42L); (mk_real_int64 30L); (mk_real_int64 96L); (mk_real_int64 64L); (mk_real_int64 78L); (mk_real_int64 5L); (mk_real_int64 25L); (mk_real_int64 24L); (mk_real_int64 37L); (mk_real_int64 26L); (mk_real_int64 26L); (mk_real_int64 103L); (mk_real_int64 58L); (mk_real_int64 13L); (mk_real_int64 30L); (mk_real_int64 19L); ]); +("y6_def", [0; 3; 16; 27; 29; 34; 40; 41; 43; 44; 48; 51; ], [(mk_real_int64 49L); (mk_real_int64 72L); (mk_real_int64 200L); (mk_real_int64 5L); (mk_real_int64 93L); (mk_real_int64 49L); (mk_real_int64 106L); (mk_real_int64 327L); (mk_real_int64 131L); (mk_real_int64 16L); (mk_real_int64 13L); (mk_real_int64 43L); ]); +("y6_def_neg", [17; 18; 19; 21; 26; 30; 35; 36; 38; 39; 42; 46; 47; 54; ], [(mk_real_int64 42L); (mk_real_int64 30L); (mk_real_int64 96L); (mk_real_int64 64L); (mk_real_int64 5L); (mk_real_int64 5L); (mk_real_int64 25L); (mk_real_int64 24L); (mk_real_int64 37L); (mk_real_int64 26L); (mk_real_int64 103L); (mk_real_int64 58L); (mk_real_int64 13L); (mk_real_int64 2L); ]); +("RHA", [0; 2; 3; 6; 7; 9; 10; 11; 12; 13; 14; 15; 16; 18; 19; 20; 21; 26; 27; 28; 29; 30; 31; 32; 33; 35; 37; 38; 39; 40; 41; 42; 44; 45; 47; 50; 51; 53; 54; 55; ], [(mk_real_int64 30L); (mk_real_int64 19L); (mk_real_int64 180L); (mk_real_int64 64L); (mk_real_int64 34L); (mk_real_int64 64L); (mk_real_int64 52L); (mk_real_int64 86L); (mk_real_int64 79L); (mk_real_int64 79L); (mk_real_int64 86L); (mk_real_int64 27L); (mk_real_int64 52L); (mk_real_int64 116L); (mk_real_int64 279L); (mk_real_int64 465L); (mk_real_int64 392L); (mk_real_int64 180L); (mk_real_int64 165L); (mk_real_int64 19L); (mk_real_int64 36L); (mk_real_int64 131L); (mk_real_int64 112L); (mk_real_int64 96L); (mk_real_int64 115L); (mk_real_int64 96L); (mk_real_int64 126L); (mk_real_int64 303L); (mk_real_int64 333L); (mk_real_int64 191L); (mk_real_int64 29L); (mk_real_int64 56L); (mk_real_int64 136L); (mk_real_int64 180L); (mk_real_int64 150L); (mk_real_int64 150L); (mk_real_int64 57L); (mk_real_int64 118L); (mk_real_int64 54L); (mk_real_int64 268L); ]); +("yy10", [6; 20; ], [(mk_real_int64 49L); (mk_real_int64 57L); ]); +("tau4", [0; 1; ], [(mk_real_int64 108L); (mk_real_int64 570L); ]); +("tau6", [0; ], [(mk_real_int64 884L); ]); +("ineq105", [0; 3; ], [(mk_real_int64 121L); (mk_real_int64 180L); ]); +("ineq106", [8; 11; 13; 15; 26; 29; 30; 37; ], [(mk_real_int64 122L); (mk_real_int64 74L); (mk_real_int64 15L); (mk_real_int64 255L); (mk_real_int64 292L); (mk_real_int64 242L); (mk_real_int64 43L); (mk_real_int64 93L); ]); +("ineq107", [7; 9; 20; 22; 27; 32; 40; ], [(mk_real_int64 335L); (mk_real_int64 236L); (mk_real_int64 194L); (mk_real_int64 337L); (mk_real_int64 171L); (mk_real_int64 46L); (mk_real_int64 126L); ]); +("ineq108", [29; ], [(mk_real_int64 97L); ]); +("ineq109", [7; 20; 22; 29; ], [(mk_real_int64 27L); (mk_real_int64 91L); (mk_real_int64 84L); (mk_real_int64 23L); ]); +("ineq110", [11; 24; 33; 37; ], [(mk_real_int64 465L); (mk_real_int64 191L); (mk_real_int64 66L); (mk_real_int64 57L); ]); +("ineq111", [8; 9; 12; 16; 21; 25; 28; 32; 34; 37; ], [(mk_real_int64 596L); (mk_real_int64 483L); (mk_real_int64 621L); (mk_real_int64 40L); (mk_real_int64 197L); (mk_real_int64 209L); (mk_real_int64 821L); (mk_real_int64 411L); (mk_real_int64 238L); (mk_real_int64 182L); ]); +("ineq112", [5; 20; ], [(mk_real_int64 661L); (mk_real_int64 163L); ]); +("ineq113", [0; 9; 15; 20; 32; 35; 38; 40; ], [(mk_real_int64 661L); (mk_real_int64 116L); (mk_real_int64 553L); (mk_real_int64 205L); (mk_real_int64 255L); (mk_real_int64 501L); (mk_real_int64 465L); (mk_real_int64 164L); ]); +("ineq114", [1; 4; 8; 13; 16; 18; 19; 21; 23; 25; 30; 33; 34; 36; 39; 41; ], [(mk_real_int64 137L); (mk_real_int64 137L); (mk_real_int64 229L); (mk_real_int64 263L); (mk_real_int64 179L); (mk_real_int64 120L); (mk_real_int64 300L); (mk_real_int64 109L); (mk_real_int64 482L); (mk_real_int64 373L); (mk_real_int64 218L); (mk_real_int64 134L); (mk_real_int64 40L); (mk_real_int64 266L); (mk_real_int64 86L); (mk_real_int64 545L); ]); +("ineq119", [2; 6; ], [(mk_real_int64 492L); (mk_real_int64 396L); ]); +("ineq120", [0; 1; 4; ], [(mk_real_int64 205L); (mk_real_int64 45L); (mk_real_int64 97L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 2875L); (mk_real_int64 2275L); (mk_real_int64 3475L); (mk_real_int64 3050L); (mk_real_int64 2575L); (mk_real_int64 3225L); (mk_real_int64 3475L); (mk_real_int64 2875L); (mk_real_int64 2325L); (mk_real_int64 3475L); (mk_real_int64 2325L); (mk_real_int64 2325L); (mk_real_int64 3475L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [1; 4; 6; 7; 8; 15; 17; 18; 24; 29; 30; 32; 33; 34; 35; 36; 37; 39; 44; 48; 49; 52; 54; ], [(mk_real_int64 422000L); (mk_real_int64 363000L); (mk_real_int64 390L); (mk_real_int64 110L); (mk_real_int64 124L); (mk_real_int64 873L); (mk_real_int64 1000L); (mk_real_int64 354L); (mk_real_int64 612L); (mk_real_int64 773L); (mk_real_int64 54L); (mk_real_int64 120L); (mk_real_int64 800L); (mk_real_int64 1264L); (mk_real_int64 234L); (mk_real_int64 1000L); (mk_real_int64 732L); (mk_real_int64 498L); (mk_real_int64 468L); (mk_real_int64 40L); (mk_real_int64 241L); (mk_real_int64 565L); (mk_real_int64 524L); ]); +("azim_lo", [10; 11; 14; 19; 21; 22; 27; 46; 47; 50; 53; 55; ], [(mk_real_int64 199L); (mk_real_int64 238L); (mk_real_int64 238L); (mk_real_int64 1044L); (mk_real_int64 1000L); (mk_real_int64 474L); (mk_real_int64 362L); (mk_real_int64 45L); (mk_real_int64 116L); (mk_real_int64 484L); (mk_real_int64 164L); (mk_real_int64 830L); ]); +("rhazim_hi", [1; 4; 16; ], [(mk_real_int64 96000L); (mk_real_int64 58000L); (mk_real_int64 1000L); ]); +("rhazim_lo", [15; 20; 29; 43; 44; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_hi", [0; 1; 2; 3; 4; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 56L); (mk_real_int64 3584L); (mk_real_int64 3176L); (mk_real_int64 452L); (mk_real_int64 792L); (mk_real_int64 3176L); (mk_real_int64 56L); (mk_real_int64 2576L); (mk_real_int64 3176L); (mk_real_int64 2576L); (mk_real_int64 400L); (mk_real_int64 3176L); ]); +("rho_lo", [5; ], [(mk_real_int64 1932L); ]); +("tau_lo", [4; 6; 14; 15; 16; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("tau_hi", [5; 11; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("y1_lo", [0; 21; 30; 35; 36; 40; 41; ], [(mk_real_int64 115L); (mk_real_int64 700L); (mk_real_int64 200L); (mk_real_int64 460L); (mk_real_int64 184L); (mk_real_int64 200L); (mk_real_int64 500L); ]); +("y1_hi", [3; 17; 18; 19; 26; 34; 38; 39; 42; 43; 44; 46; 47; 48; 51; ], [(mk_real_int64 300L); (mk_real_int64 423L); (mk_real_int64 520L); (mk_real_int64 60L); (mk_real_int64 220L); (mk_real_int64 259L); (mk_real_int64 580L); (mk_real_int64 380L); (mk_real_int64 220L); (mk_real_int64 532L); (mk_real_int64 200L); (mk_real_int64 20L); (mk_real_int64 80L); (mk_real_int64 160L); (mk_real_int64 100L); ]); +("y2_lo", [0; 21; 29; 30; 34; 35; 43; 44; 51; 54; ], [(mk_real_int64 358L); (mk_real_int64 364L); (mk_real_int64 180L); (mk_real_int64 200L); (mk_real_int64 229L); (mk_real_int64 460L); (mk_real_int64 77L); (mk_real_int64 348L); (mk_real_int64 248L); (mk_real_int64 152L); ]); +("y2_hi", [3; 17; 18; 19; 26; 27; 36; 38; 39; 40; 41; 42; 46; 47; 48; ], [(mk_real_int64 360L); (mk_real_int64 3L); (mk_real_int64 128L); (mk_real_int64 188L); (mk_real_int64 220L); (mk_real_int64 460L); (mk_real_int64 92L); (mk_real_int64 580L); (mk_real_int64 380L); (mk_real_int64 288L); (mk_real_int64 8L); (mk_real_int64 220L); (mk_real_int64 28L); (mk_real_int64 80L); (mk_real_int64 160L); ]); +("y3_lo", [0; 21; 29; 30; 34; 35; 43; 44; 51; 54; ], [(mk_real_int64 358L); (mk_real_int64 364L); (mk_real_int64 180L); (mk_real_int64 200L); (mk_real_int64 229L); (mk_real_int64 460L); (mk_real_int64 77L); (mk_real_int64 348L); (mk_real_int64 248L); (mk_real_int64 152L); ]); +("y3_hi", [3; 17; 18; 19; 26; 27; 36; 38; 39; 40; 41; 42; 46; 47; 48; ], [(mk_real_int64 360L); (mk_real_int64 3L); (mk_real_int64 128L); (mk_real_int64 188L); (mk_real_int64 220L); (mk_real_int64 460L); (mk_real_int64 92L); (mk_real_int64 580L); (mk_real_int64 380L); (mk_real_int64 288L); (mk_real_int64 8L); (mk_real_int64 220L); (mk_real_int64 28L); (mk_real_int64 80L); (mk_real_int64 160L); ]); +("y4_lo", [7; 8; 13; 20; 22; 24; 25; 26; 40; ], [(mk_real_int64 297L); (mk_real_int64 70L); (mk_real_int64 275L); (mk_real_int64 554L); (mk_real_int64 283L); (mk_real_int64 436L); (mk_real_int64 125L); (mk_real_int64 20L); (mk_real_int64 602L); ]); +("y4_hi", [9; 11; 12; 15; 21; 27; 28; 29; 30; 32; 33; 34; 37; ], [(mk_real_int64 53L); (mk_real_int64 170L); (mk_real_int64 375L); (mk_real_int64 325L); (mk_real_int64 375L); (mk_real_int64 183L); (mk_real_int64 375L); (mk_real_int64 237L); (mk_real_int64 545L); (mk_real_int64 183L); (mk_real_int64 64L); (mk_real_int64 250L); (mk_real_int64 373L); ]); +("y5_lo", [0; 17; 18; 19; 21; 29; 34; 36; 38; 39; 43; 44; 46; 51; 54; ], [(mk_real_int64 358L); (mk_real_int64 172L); (mk_real_int64 92L); (mk_real_int64 247L); (mk_real_int64 204L); (mk_real_int64 180L); (mk_real_int64 4L); (mk_real_int64 8L); (mk_real_int64 436L); (mk_real_int64 125L); (mk_real_int64 152L); (mk_real_int64 348L); (mk_real_int64 367L); (mk_real_int64 70L); (mk_real_int64 152L); ]); +("y5_hi", [3; 26; 27; 35; 40; 41; 42; 47; 48; ], [(mk_real_int64 360L); (mk_real_int64 375L); (mk_real_int64 460L); (mk_real_int64 375L); (mk_real_int64 288L); (mk_real_int64 8L); (mk_real_int64 375L); (mk_real_int64 64L); (mk_real_int64 250L); ]); +("y6_lo", [0; 16; 17; 18; 19; 21; 26; 29; 34; 36; 38; 39; 41; 43; 44; 46; 48; 51; 54; ], [(mk_real_int64 358L); (mk_real_int64 200000L); (mk_real_int64 172L); (mk_real_int64 92L); (mk_real_int64 247L); (mk_real_int64 204L); (mk_real_int64 72625L); (mk_real_int64 180L); (mk_real_int64 49004L); (mk_real_int64 8L); (mk_real_int64 436L); (mk_real_int64 125L); (mk_real_int64 353000L); (mk_real_int64 152L); (mk_real_int64 348L); (mk_real_int64 367L); (mk_real_int64 43000L); (mk_real_int64 43070L); (mk_real_int64 17152L); ]); +("y6_hi", [3; 27; 35; 40; 41; 42; 47; 48; ], [(mk_real_int64 360L); (mk_real_int64 460L); (mk_real_int64 375L); (mk_real_int64 288L); (mk_real_int64 8L); (mk_real_int64 375L); (mk_real_int64 64L); (mk_real_int64 250L); ]); +("ye_hi", [20; 21; 46; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_lo", [8; 27; 41; 42; ], [(mk_real_int64 19000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_lo", [1; 2; 8; 9; 10; 11; ], [(mk_real_int64 1070L); (mk_real_int64 148L); (mk_real_int64 1532L); (mk_real_int64 148L); (mk_real_int64 532L); (mk_real_int64 149L); ]); +("yn_hi", [0; 3; 4; 5; 6; 7; 12; ], [(mk_real_int64 925L); (mk_real_int64 308L); (mk_real_int64 1087L); (mk_real_int64 1464L); (mk_real_int64 852L); (mk_real_int64 925L); (mk_real_int64 852L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests/176747399778_out.hl b/formal_lp/old/ineqs/tests/176747399778_out.hl new file mode 100644 index 0000000..d8ea2ca --- /dev/null +++ b/formal_lp/old/ineqs/tests/176747399778_out.hl @@ -0,0 +1,87 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "176747399778 21 6 0 1 2 3 4 5 3 0 5 6 3 6 5 4 3 6 4 7 3 7 4 3 3 7 3 8 3 8 3 9 3 9 3 2 3 9 2 10 3 10 2 11 3 11 2 1 3 11 1 12 3 12 1 0 3 12 0 13 3 13 0 6 4 13 6 7 8 3 13 8 14 3 14 8 9 3 14 9 10 4 14 10 11 12 3 12 13 14 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum_neg", [0; 10; ], [(mk_real_int64 14L); (mk_real_int64 52L); ]); +("azim_sum", [8; 13; 14; ], [(mk_real_int64 247L); (mk_real_int64 469L); (mk_real_int64 106L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 773L); (mk_real_int64 1169L); (mk_real_int64 1169L); (mk_real_int64 1169L); (mk_real_int64 1169L); (mk_real_int64 1169L); (mk_real_int64 1169L); (mk_real_int64 1169L); (mk_real_int64 1169L); (mk_real_int64 979L); (mk_real_int64 826L); (mk_real_int64 826L); (mk_real_int64 1169L); (mk_real_int64 1169L); (mk_real_int64 1169L); ]); +("sol_sum3_neg", [14; ], [(mk_real_int64 106L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; ], [(mk_real_int64 773L); (mk_real_int64 773L); (mk_real_int64 1169L); (mk_real_int64 1169L); (mk_real_int64 1169L); (mk_real_int64 979L); (mk_real_int64 979L); (mk_real_int64 826L); (mk_real_int64 826L); (mk_real_int64 826L); (mk_real_int64 826L); (mk_real_int64 1169L); (mk_real_int64 1169L); (mk_real_int64 1169L); (mk_real_int64 1169L); (mk_real_int64 979L); (mk_real_int64 826L); (mk_real_int64 1169L); ]); +("tau_sum4_neg", [0; 1; ], [(mk_real_int64 1169L); (mk_real_int64 826L); ]); +("tau_sum6_neg", [0; ], [(mk_real_int64 1169L); ]); +("ln_def_neg", [1; 2; 3; 4; 5; 6; 7; 8; 9; 12; 13; 14; ], [(mk_real_int64 289L); (mk_real_int64 289L); (mk_real_int64 289L); (mk_real_int64 289L); (mk_real_int64 289L); (mk_real_int64 289L); (mk_real_int64 289L); (mk_real_int64 289L); (mk_real_int64 80L); (mk_real_int64 289L); (mk_real_int64 289L); (mk_real_int64 289L); ]); +("ln_def", [0; 10; 11; ], [(mk_real_int64 148L); (mk_real_int64 89L); (mk_real_int64 89L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 4856L); (mk_real_int64 7345L); (mk_real_int64 7345L); (mk_real_int64 7345L); (mk_real_int64 7345L); (mk_real_int64 7345L); (mk_real_int64 7345L); (mk_real_int64 7345L); (mk_real_int64 7345L); (mk_real_int64 6154L); (mk_real_int64 5191L); (mk_real_int64 5191L); (mk_real_int64 7345L); (mk_real_int64 7345L); (mk_real_int64 7345L); ]); +("edge_sym_neg", [1; 7; 13; 17; 19; 22; 23; 26; 28; 29; 38; 41; 43; 44; 53; 54; 57; 60; ], [(mk_real_int64 64L); (mk_real_int64 210L); (mk_real_int64 146L); (mk_real_int64 146L); (mk_real_int64 87L); (mk_real_int64 151L); (mk_real_int64 42L); (mk_real_int64 117L); (mk_real_int64 91L); (mk_real_int64 290L); (mk_real_int64 63L); (mk_real_int64 146L); (mk_real_int64 52L); (mk_real_int64 52L); (mk_real_int64 272L); (mk_real_int64 149L); (mk_real_int64 155L); (mk_real_int64 39L); ]); +("edge_sym", [4; 8; 11; 31; 35; 37; 64; ], [(mk_real_int64 61L); (mk_real_int64 199L); (mk_real_int64 146L); (mk_real_int64 130L); (mk_real_int64 64L); (mk_real_int64 146L); (mk_real_int64 101L); ]); +("y1_def", [7; 29; 30; ], [(mk_real_int64 7L); (mk_real_int64 26L); (mk_real_int64 26L); ]); +("y1_def_neg", [6; 8; 9; 10; 11; 12; 15; 20; 21; 22; 25; 26; 27; 28; 31; 34; 35; 37; 38; 41; 43; 45; 47; 52; 53; 54; 55; 56; 58; 59; 60; 61; 64; 66; 67; ], [(mk_real_int64 227L); (mk_real_int64 372L); (mk_real_int64 111L); (mk_real_int64 34L); (mk_real_int64 159L); (mk_real_int64 210L); (mk_real_int64 210L); (mk_real_int64 171L); (mk_real_int64 114L); (mk_real_int64 126L); (mk_real_int64 67L); (mk_real_int64 253L); (mk_real_int64 92L); (mk_real_int64 354L); (mk_real_int64 91L); (mk_real_int64 5L); (mk_real_int64 111L); (mk_real_int64 354L); (mk_real_int64 206L); (mk_real_int64 210L); (mk_real_int64 75L); (mk_real_int64 75L); (mk_real_int64 167L); (mk_real_int64 61L); (mk_real_int64 33L); (mk_real_int64 140L); (mk_real_int64 139L); (mk_real_int64 254L); (mk_real_int64 230L); (mk_real_int64 92L); (mk_real_int64 123L); (mk_real_int64 30L); (mk_real_int64 49L); (mk_real_int64 127L); (mk_real_int64 25L); ]); +("y2_def_neg", [7; 10; 12; 15; 20; 22; 26; 28; 29; 30; 31; 34; 37; 41; 43; 47; 54; 56; 60; 66; ], [(mk_real_int64 2L); (mk_real_int64 43L); (mk_real_int64 210L); (mk_real_int64 210L); (mk_real_int64 135L); (mk_real_int64 44L); (mk_real_int64 86L); (mk_real_int64 24L); (mk_real_int64 8L); (mk_real_int64 8L); (mk_real_int64 47L); (mk_real_int64 5L); (mk_real_int64 24L); (mk_real_int64 210L); (mk_real_int64 75L); (mk_real_int64 167L); (mk_real_int64 140L); (mk_real_int64 31L); (mk_real_int64 157L); (mk_real_int64 68L); ]); +("y2_def", [6; 8; 9; 11; 21; 25; 27; 35; 38; 45; 52; 53; 55; 58; 59; 61; 64; 67; ], [(mk_real_int64 138L); (mk_real_int64 10L); (mk_real_int64 68L); (mk_real_int64 97L); (mk_real_int64 69L); (mk_real_int64 41L); (mk_real_int64 56L); (mk_real_int64 67L); (mk_real_int64 125L); (mk_real_int64 116L); (mk_real_int64 94L); (mk_real_int64 52L); (mk_real_int64 107L); (mk_real_int64 163L); (mk_real_int64 56L); (mk_real_int64 39L); (mk_real_int64 63L); (mk_real_int64 38L); ]); +("y3_def_neg", [7; 10; 12; 15; 20; 22; 26; 28; 29; 30; 31; 34; 37; 41; 43; 47; 54; 56; 60; 66; ], [(mk_real_int64 2L); (mk_real_int64 43L); (mk_real_int64 210L); (mk_real_int64 210L); (mk_real_int64 135L); (mk_real_int64 44L); (mk_real_int64 86L); (mk_real_int64 24L); (mk_real_int64 8L); (mk_real_int64 8L); (mk_real_int64 47L); (mk_real_int64 5L); (mk_real_int64 24L); (mk_real_int64 210L); (mk_real_int64 75L); (mk_real_int64 167L); (mk_real_int64 140L); (mk_real_int64 31L); (mk_real_int64 157L); (mk_real_int64 68L); ]); +("y3_def", [6; 8; 9; 11; 21; 25; 27; 35; 38; 45; 52; 53; 55; 58; 59; 61; 64; 67; ], [(mk_real_int64 138L); (mk_real_int64 10L); (mk_real_int64 68L); (mk_real_int64 97L); (mk_real_int64 69L); (mk_real_int64 41L); (mk_real_int64 56L); (mk_real_int64 67L); (mk_real_int64 125L); (mk_real_int64 116L); (mk_real_int64 94L); (mk_real_int64 52L); (mk_real_int64 107L); (mk_real_int64 163L); (mk_real_int64 56L); (mk_real_int64 39L); (mk_real_int64 63L); (mk_real_int64 38L); ]); +("y4_def", [1; 23; 24; ], [(mk_real_int64 10L); (mk_real_int64 40L); (mk_real_int64 40L); ]); +("y4_def_neg", [0; 2; 3; 4; 5; 6; 9; 14; 15; 16; 19; 20; 21; 22; 25; 28; 29; 31; 32; 35; 37; 39; 41; 42; 43; 44; 45; 46; 48; 49; 50; 52; 53; ], [(mk_real_int64 259L); (mk_real_int64 364L); (mk_real_int64 127L); (mk_real_int64 18L); (mk_real_int64 182L); (mk_real_int64 146L); (mk_real_int64 146L); (mk_real_int64 151L); (mk_real_int64 130L); (mk_real_int64 110L); (mk_real_int64 76L); (mk_real_int64 222L); (mk_real_int64 105L); (mk_real_int64 338L); (mk_real_int64 76L); (mk_real_int64 3L); (mk_real_int64 126L); (mk_real_int64 338L); (mk_real_int64 235L); (mk_real_int64 146L); (mk_real_int64 52L); (mk_real_int64 218L); (mk_real_int64 116L); (mk_real_int64 178L); (mk_real_int64 97L); (mk_real_int64 146L); (mk_real_int64 202L); (mk_real_int64 263L); (mk_real_int64 307L); (mk_real_int64 105L); (mk_real_int64 63L); (mk_real_int64 140L); (mk_real_int64 72L); ]); +("y5_def_neg", [7; 10; 12; 15; 20; 22; 26; 29; 30; 31; 34; 41; 43; 47; 54; 60; 66; ], [(mk_real_int64 2L); (mk_real_int64 31L); (mk_real_int64 146L); (mk_real_int64 146L); (mk_real_int64 87L); (mk_real_int64 21L); (mk_real_int64 41L); (mk_real_int64 8L); (mk_real_int64 8L); (mk_real_int64 27L); (mk_real_int64 3L); (mk_real_int64 146L); (mk_real_int64 52L); (mk_real_int64 116L); (mk_real_int64 146L); (mk_real_int64 111L); (mk_real_int64 36L); ]); +("y5_def", [6; 8; 9; 11; 21; 25; 27; 28; 35; 37; 38; 45; 52; 53; 55; 56; 58; 59; 61; 64; 67; ], [(mk_real_int64 138L); (mk_real_int64 51L); (mk_real_int64 68L); (mk_real_int64 97L); (mk_real_int64 69L); (mk_real_int64 41L); (mk_real_int64 56L); (mk_real_int64 21L); (mk_real_int64 67L); (mk_real_int64 21L); (mk_real_int64 125L); (mk_real_int64 116L); (mk_real_int64 94L); (mk_real_int64 52L); (mk_real_int64 107L); (mk_real_int64 7L); (mk_real_int64 163L); (mk_real_int64 56L); (mk_real_int64 39L); (mk_real_int64 63L); (mk_real_int64 38L); ]); +("y6_def_neg", [7; 10; 12; 22; 26; 29; 34; 41; 43; 47; 54; 60; ], [(mk_real_int64 2L); (mk_real_int64 31L); (mk_real_int64 146L); (mk_real_int64 21L); (mk_real_int64 41L); (mk_real_int64 8L); (mk_real_int64 3L); (mk_real_int64 146L); (mk_real_int64 52L); (mk_real_int64 116L); (mk_real_int64 146L); (mk_real_int64 97L); ]); +("y6_def", [6; 8; 9; 11; 14; 15; 16; 18; 21; 24; 25; 27; 28; 30; 31; 32; 35; 36; 37; 38; 40; 42; 45; 46; 52; 53; 55; 56; 58; 59; 61; 64; 65; 66; 67; ], [(mk_real_int64 366L); (mk_real_int64 51L); (mk_real_int64 422L); (mk_real_int64 97L); (mk_real_int64 146L); (mk_real_int64 146L); (mk_real_int64 146L); (mk_real_int64 297L); (mk_real_int64 108L); (mk_real_int64 332L); (mk_real_int64 41L); (mk_real_int64 56L); (mk_real_int64 21L); (mk_real_int64 119L); (mk_real_int64 90L); (mk_real_int64 84L); (mk_real_int64 67L); (mk_real_int64 149L); (mk_real_int64 21L); (mk_real_int64 275L); (mk_real_int64 146L); (mk_real_int64 198L); (mk_real_int64 168L); (mk_real_int64 135L); (mk_real_int64 94L); (mk_real_int64 52L); (mk_real_int64 265L); (mk_real_int64 244L); (mk_real_int64 163L); (mk_real_int64 708L); (mk_real_int64 39L); (mk_real_int64 63L); (mk_real_int64 161L); (mk_real_int64 110L); (mk_real_int64 38L); ]); +("RHA", [6; 9; 11; 22; 25; 26; 31; 34; 35; 61; 64; ], [(mk_real_int64 18L); (mk_real_int64 210L); (mk_real_int64 131L); (mk_real_int64 104L); (mk_real_int64 78L); (mk_real_int64 17L); (mk_real_int64 296L); (mk_real_int64 343L); (mk_real_int64 158L); (mk_real_int64 343L); (mk_real_int64 343L); ]); +("RHB", [5; ], [(mk_real_int64 396L); ]); +("yy10", [1; ], [(mk_real_int64 64L); ]); +("tau4", [0; ], [(mk_real_int64 222L); ]); +("tau6", [0; ], [(mk_real_int64 1169L); ]); +("ineq105", [10; 13; ], [(mk_real_int64 96L); (mk_real_int64 156L); ]); +("ineq106", [0; 2; 3; 5; 15; 16; 19; 20; 21; 22; 25; 29; 31; 32; 45; 46; 48; 49; ], [(mk_real_int64 378L); (mk_real_int64 396L); (mk_real_int64 186L); (mk_real_int64 265L); (mk_real_int64 190L); (mk_real_int64 85L); (mk_real_int64 112L); (mk_real_int64 173L); (mk_real_int64 153L); (mk_real_int64 343L); (mk_real_int64 46L); (mk_real_int64 184L); (mk_real_int64 343L); (mk_real_int64 343L); (mk_real_int64 190L); (mk_real_int64 190L); (mk_real_int64 343L); (mk_real_int64 153L); ]); +("ineq107", [1; 4; 23; 24; 50; ], [(mk_real_int64 14L); (mk_real_int64 14L); (mk_real_int64 52L); (mk_real_int64 52L); (mk_real_int64 52L); ]); +("ineq108", [14; 39; 42; 43; 45; 46; 48; 52; 53; ], [(mk_real_int64 61L); (mk_real_int64 319L); (mk_real_int64 259L); (mk_real_int64 142L); (mk_real_int64 106L); (mk_real_int64 68L); (mk_real_int64 106L); (mk_real_int64 99L); (mk_real_int64 106L); ]); +("ineq110", [44; ], [(mk_real_int64 106L); ]); +("ineq111", [2; 4; 6; 9; 14; 16; 20; 22; 25; 28; 31; 35; 37; 41; 44; 46; 50; 52; ], [(mk_real_int64 744L); (mk_real_int64 228L); (mk_real_int64 1169L); (mk_real_int64 1169L); (mk_real_int64 872L); (mk_real_int64 418L); (mk_real_int64 828L); (mk_real_int64 826L); (mk_real_int64 353L); (mk_real_int64 26L); (mk_real_int64 826L); (mk_real_int64 1169L); (mk_real_int64 419L); (mk_real_int64 928L); (mk_real_int64 1002L); (mk_real_int64 693L); (mk_real_int64 826L); (mk_real_int64 576L); ]); +("ineq114", [0; 3; 5; 14; 15; 16; 19; 20; 25; 28; 29; 38; 39; 42; 46; 52; ], [(mk_real_int64 29L); (mk_real_int64 336L); (mk_real_int64 209L); (mk_real_int64 297L); (mk_real_int64 395L); (mk_real_int64 167L); (mk_real_int64 124L); (mk_real_int64 26L); (mk_real_int64 473L); (mk_real_int64 547L); (mk_real_int64 253L); (mk_real_int64 750L); (mk_real_int64 241L); (mk_real_int64 167L); (mk_real_int64 287L); (mk_real_int64 593L); ]); +("ineq119", [5; ], [(mk_real_int64 114L); ]); +("ineq120", [0; 3; 4; 7; ], [(mk_real_int64 620L); (mk_real_int64 327L); (mk_real_int64 465L); (mk_real_int64 247L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 2200L); (mk_real_int64 3625L); (mk_real_int64 3625L); (mk_real_int64 3625L); (mk_real_int64 3625L); (mk_real_int64 3625L); (mk_real_int64 3625L); (mk_real_int64 3625L); (mk_real_int64 3625L); (mk_real_int64 3050L); (mk_real_int64 2575L); (mk_real_int64 2575L); (mk_real_int64 3625L); (mk_real_int64 3625L); (mk_real_int64 3625L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [5; 6; 9; 21; 22; 31; 35; 44; 45; 48; 51; 52; 53; 56; 62; 64; 66; ], [(mk_real_int64 479696L); (mk_real_int64 154L); (mk_real_int64 336L); (mk_real_int64 270L); (mk_real_int64 542L); (mk_real_int64 98L); (mk_real_int64 378L); (mk_real_int64 500L); (mk_real_int64 866L); (mk_real_int64 960L); (mk_real_int64 866L); (mk_real_int64 542L); (mk_real_int64 1000L); (mk_real_int64 662L); (mk_real_int64 358L); (mk_real_int64 226L); (mk_real_int64 1218L); ]); +("azim_lo", [11; 20; 25; 26; 34; 61; ], [(mk_real_int64 166L); (mk_real_int64 78L); (mk_real_int64 376L); (mk_real_int64 724L); (mk_real_int64 578L); (mk_real_int64 530L); ]); +("rhazim_lo", [22; 31; 35; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 12; 13; 14; ], [(mk_real_int64 1532L); (mk_real_int64 996L); (mk_real_int64 996L); (mk_real_int64 996L); (mk_real_int64 996L); (mk_real_int64 996L); (mk_real_int64 996L); (mk_real_int64 996L); (mk_real_int64 996L); (mk_real_int64 996L); (mk_real_int64 996L); (mk_real_int64 996L); ]); +("rho_lo", [9; 10; 11; ], [(mk_real_int64 1964L); (mk_real_int64 416L); (mk_real_int64 416L); ]); +("tau_hi", [6; 17; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("tau_lo", [7; ], [(mk_real_int64 1000L); ]); +("y1_lo", [9; 10; 12; 15; 20; 22; 25; 28; 31; 37; 41; 43; 47; 53; 54; 56; 58; 61; 64; ], [(mk_real_int64 600L); (mk_real_int64 40L); (mk_real_int64 420L); (mk_real_int64 420L); (mk_real_int64 295L); (mk_real_int64 240L); (mk_real_int64 200L); (mk_real_int64 480L); (mk_real_int64 140L); (mk_real_int64 480L); (mk_real_int64 420L); (mk_real_int64 420L); (mk_real_int64 40L); (mk_real_int64 370L); (mk_real_int64 80L); (mk_real_int64 720L); (mk_real_int64 710L); (mk_real_int64 240L); (mk_real_int64 140L); ]); +("y1_hi", [6; 8; 26; 27; 34; 35; 38; 45; 52; 55; 59; 60; 66; 67; ], [(mk_real_int64 200L); (mk_real_int64 480L); (mk_real_int64 160L); (mk_real_int64 200L); (mk_real_int64 320L); (mk_real_int64 600L); (mk_real_int64 200L); (mk_real_int64 35L); (mk_real_int64 135L); (mk_real_int64 90L); (mk_real_int64 200L); (mk_real_int64 320L); (mk_real_int64 55L); (mk_real_int64 90L); ]); +("y2_lo", [6; 7; 9; 10; 11; 12; 15; 22; 25; 26; 27; 35; 38; 41; 43; 47; 53; 54; 59; 61; 64; ], [(mk_real_int64 408L); (mk_real_int64 128L); (mk_real_int64 296L); (mk_real_int64 168L); (mk_real_int64 540L); (mk_real_int64 420L); (mk_real_int64 420L); (mk_real_int64 300L); (mk_real_int64 232L); (mk_real_int64 68L); (mk_real_int64 308L); (mk_real_int64 24L); (mk_real_int64 148L); (mk_real_int64 420L); (mk_real_int64 420L); (mk_real_int64 40L); (mk_real_int64 312L); (mk_real_int64 80L); (mk_real_int64 308L); (mk_real_int64 408L); (mk_real_int64 288L); ]); +("y2_hi", [8; 20; 21; 28; 29; 30; 31; 34; 37; 45; 52; 55; 56; 58; 60; 66; 67; ], [(mk_real_int64 224L); (mk_real_int64 244L); (mk_real_int64 160L); (mk_real_int64 172L); (mk_real_int64 96L); (mk_real_int64 96L); (mk_real_int64 204L); (mk_real_int64 320L); (mk_real_int64 172L); (mk_real_int64 116L); (mk_real_int64 276L); (mk_real_int64 744L); (mk_real_int64 172L); (mk_real_int64 436L); (mk_real_int64 416L); (mk_real_int64 356L); (mk_real_int64 584L); ]); +("y3_lo", [6; 7; 9; 10; 11; 12; 15; 22; 25; 26; 27; 35; 38; 41; 43; 47; 53; 54; 59; 61; 64; ], [(mk_real_int64 408L); (mk_real_int64 128L); (mk_real_int64 296L); (mk_real_int64 168L); (mk_real_int64 540L); (mk_real_int64 420L); (mk_real_int64 420L); (mk_real_int64 300L); (mk_real_int64 232L); (mk_real_int64 68L); (mk_real_int64 308L); (mk_real_int64 24L); (mk_real_int64 148L); (mk_real_int64 420L); (mk_real_int64 420L); (mk_real_int64 40L); (mk_real_int64 312L); (mk_real_int64 80L); (mk_real_int64 308L); (mk_real_int64 408L); (mk_real_int64 288L); ]); +("y3_hi", [8; 20; 21; 28; 29; 30; 31; 34; 37; 45; 52; 55; 56; 58; 60; 66; 67; ], [(mk_real_int64 224L); (mk_real_int64 244L); (mk_real_int64 160L); (mk_real_int64 172L); (mk_real_int64 96L); (mk_real_int64 96L); (mk_real_int64 204L); (mk_real_int64 320L); (mk_real_int64 172L); (mk_real_int64 116L); (mk_real_int64 276L); (mk_real_int64 744L); (mk_real_int64 172L); (mk_real_int64 436L); (mk_real_int64 416L); (mk_real_int64 356L); (mk_real_int64 584L); ]); +("y4_lo", [2; 3; 6; 9; 15; 16; 19; 20; 22; 28; 29; 31; 35; 37; 39; 43; 44; 45; 46; 48; 50; 53; ], [(mk_real_int64 260L); (mk_real_int64 410L); (mk_real_int64 125L); (mk_real_int64 125L); (mk_real_int64 150L); (mk_real_int64 475L); (mk_real_int64 720L); (mk_real_int64 5L); (mk_real_int64 205L); (mk_real_int64 250L); (mk_real_int64 40L); (mk_real_int64 205L); (mk_real_int64 125L); (mk_real_int64 375L); (mk_real_int64 515L); (mk_real_int64 270L); (mk_real_int64 26L); (mk_real_int64 760L); (mk_real_int64 355L); (mk_real_int64 565L); (mk_real_int64 54L); (mk_real_int64 610L); ]); +("y4_hi", [0; 1; 4; 5; 14; 21; 23; 24; 25; 32; 42; 49; 52; ], [(mk_real_int64 70L); (mk_real_int64 822L); (mk_real_int64 322L); (mk_real_int64 475L); (mk_real_int64 215L); (mk_real_int64 195L); (mk_real_int64 196L); (mk_real_int64 196L); (mk_real_int64 365L); (mk_real_int64 45L); (mk_real_int64 585L); (mk_real_int64 195L); (mk_real_int64 185L); ]); +("y5_lo", [6; 7; 9; 11; 12; 15; 22; 25; 27; 31; 34; 35; 38; 41; 43; 53; 54; 59; 60; 61; 64; ], [(mk_real_int64 408L); (mk_real_int64 128L); (mk_real_int64 296L); (mk_real_int64 540L); (mk_real_int64 125L); (mk_real_int64 125L); (mk_real_int64 310L); (mk_real_int64 232L); (mk_real_int64 308L); (mk_real_int64 381L); (mk_real_int64 250L); (mk_real_int64 24L); (mk_real_int64 148L); (mk_real_int64 125L); (mk_real_int64 375L); (mk_real_int64 312L); (mk_real_int64 26L); (mk_real_int64 308L); (mk_real_int64 154L); (mk_real_int64 408L); (mk_real_int64 288L); ]); +("y5_hi", [8; 10; 20; 21; 26; 28; 29; 30; 37; 45; 52; 55; 56; 58; 66; 67; ], [(mk_real_int64 144L); (mk_real_int64 372L); (mk_real_int64 204L); (mk_real_int64 160L); (mk_real_int64 472L); (mk_real_int64 602L); (mk_real_int64 96L); (mk_real_int64 96L); (mk_real_int64 602L); (mk_real_int64 116L); (mk_real_int64 276L); (mk_real_int64 744L); (mk_real_int64 287L); (mk_real_int64 436L); (mk_real_int64 36L); (mk_real_int64 584L); ]); +("y6_lo", [6; 7; 9; 11; 12; 14; 15; 16; 18; 20; 21; 22; 24; 25; 27; 30; 31; 32; 34; 35; 36; 38; 40; 41; 42; 43; 45; 46; 53; 54; 55; 56; 59; 60; 61; 64; 65; 66; ], [(mk_real_int64 229000L); (mk_real_int64 128L); (mk_real_int64 354296L); (mk_real_int64 540L); (mk_real_int64 125L); (mk_real_int64 146000L); (mk_real_int64 292125L); (mk_real_int64 146000L); (mk_real_int64 297000L); (mk_real_int64 87000L); (mk_real_int64 39000L); (mk_real_int64 310L); (mk_real_int64 332000L); (mk_real_int64 232L); (mk_real_int64 308L); (mk_real_int64 126904L); (mk_real_int64 117381L); (mk_real_int64 84000L); (mk_real_int64 250L); (mk_real_int64 24L); (mk_real_int64 149000L); (mk_real_int64 151000L); (mk_real_int64 146000L); (mk_real_int64 125L); (mk_real_int64 198000L); (mk_real_int64 375L); (mk_real_int64 52000L); (mk_real_int64 135000L); (mk_real_int64 312L); (mk_real_int64 26L); (mk_real_int64 157256L); (mk_real_int64 237000L); (mk_real_int64 653000L); (mk_real_int64 14154L); (mk_real_int64 408L); (mk_real_int64 288L); (mk_real_int64 161000L); (mk_real_int64 146000L); ]); +("y6_hi", [6; 8; 10; 20; 21; 26; 28; 29; 37; 38; 45; 52; 56; 58; 59; 66; 67; ], [(mk_real_int64 592L); (mk_real_int64 144L); (mk_real_int64 372L); (mk_real_int64 204L); (mk_real_int64 160L); (mk_real_int64 472L); (mk_real_int64 602L); (mk_real_int64 96L); (mk_real_int64 602L); (mk_real_int64 852L); (mk_real_int64 116L); (mk_real_int64 276L); (mk_real_int64 287L); (mk_real_int64 436L); (mk_real_int64 692L); (mk_real_int64 36L); (mk_real_int64 584L); ]); +("ye_hi", [11; 23; 30; 33; 58; 64; 65; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_lo", [4; 9; 28; 36; 57; 66; 67; ], [(mk_real_int64 61000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 10; 12; 13; 14; ], [(mk_real_int64 1396L); (mk_real_int64 2036L); (mk_real_int64 1036L); (mk_real_int64 1036L); (mk_real_int64 1036L); (mk_real_int64 1036L); (mk_real_int64 2036L); (mk_real_int64 1036L); (mk_real_int64 1036L); (mk_real_int64 853L); (mk_real_int64 1036L); (mk_real_int64 1036L); (mk_real_int64 1036L); ]); +("yn_lo", [9; 11; ], [(mk_real_int64 80L); (mk_real_int64 147L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests/196565289721_out.hl b/formal_lp/old/ineqs/tests/196565289721_out.hl new file mode 100644 index 0000000..86d9f57 --- /dev/null +++ b/formal_lp/old/ineqs/tests/196565289721_out.hl @@ -0,0 +1,91 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "196565289721 17 6 0 1 2 3 4 5 3 0 5 6 4 6 5 7 8 3 7 5 4 3 7 4 3 3 8 7 3 3 8 3 9 3 9 3 2 3 9 2 10 3 10 2 1 3 10 1 11 3 11 1 0 4 11 0 6 12 3 12 6 8 3 12 8 9 3 12 9 10 3 10 11 12 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum_neg", [0; 1; 2; 4; 5; 6; 10; 11; ], [(mk_real_int64 111L); (mk_real_int64 626L); (mk_real_int64 385L); (mk_real_int64 41L); (mk_real_int64 39L); (mk_real_int64 56L); (mk_real_int64 145L); (mk_real_int64 235L); ]); +("azim_sum", [8; 9; 12; ], [(mk_real_int64 256L); (mk_real_int64 253L); (mk_real_int64 349L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 1046L); (mk_real_int64 792L); (mk_real_int64 931L); (mk_real_int64 934L); (mk_real_int64 976L); (mk_real_int64 974L); (mk_real_int64 990L); (mk_real_int64 934L); (mk_real_int64 934L); (mk_real_int64 934L); (mk_real_int64 934L); (mk_real_int64 934L); (mk_real_int64 934L); ]); +("sol_sum3", [1; 2; 6; 8; 9; ], [(mk_real_int64 245L); (mk_real_int64 245L); (mk_real_int64 83L); (mk_real_int64 221L); (mk_real_int64 14L); ]); +("sol_sum3_neg", [4; 11; ], [(mk_real_int64 525L); (mk_real_int64 218L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 934L); (mk_real_int64 792L); (mk_real_int64 792L); (mk_real_int64 931L); (mk_real_int64 409L); (mk_real_int64 922L); (mk_real_int64 934L); (mk_real_int64 799L); (mk_real_int64 934L); (mk_real_int64 934L); (mk_real_int64 934L); (mk_real_int64 901L); (mk_real_int64 934L); (mk_real_int64 789L); ]); +("tau_sum4_neg", [0; 1; ], [(mk_real_int64 934L); (mk_real_int64 934L); ]); +("tau_sum6_neg", [0; ], [(mk_real_int64 934L); ]); +("ln_def_neg", [0; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 153L); (mk_real_int64 27L); (mk_real_int64 30L); (mk_real_int64 76L); (mk_real_int64 74L); (mk_real_int64 92L); (mk_real_int64 30L); (mk_real_int64 34L); (mk_real_int64 30L); (mk_real_int64 30L); (mk_real_int64 30L); (mk_real_int64 30L); ]); +("ln_def", [1; ], [(mk_real_int64 127L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 6570L); (mk_real_int64 4973L); (mk_real_int64 5851L); (mk_real_int64 5871L); (mk_real_int64 6131L); (mk_real_int64 6118L); (mk_real_int64 6222L); (mk_real_int64 5871L); (mk_real_int64 5871L); (mk_real_int64 5871L); (mk_real_int64 5871L); (mk_real_int64 5871L); (mk_real_int64 5871L); ]); +("edge_sym", [5; 11; 12; 18; 21; 24; 29; 30; 36; 42; 43; 46; ], [(mk_real_int64 117L); (mk_real_int64 80L); (mk_real_int64 80L); (mk_real_int64 352L); (mk_real_int64 276L); (mk_real_int64 85L); (mk_real_int64 9L); (mk_real_int64 9L); (mk_real_int64 14L); (mk_real_int64 14L); (mk_real_int64 14L); (mk_real_int64 27L); ]); +("edge_sym_neg", [10; 23; 27; 33; 49; 52; ], [(mk_real_int64 352L); (mk_real_int64 11L); (mk_real_int64 68L); (mk_real_int64 27L); (mk_real_int64 125L); (mk_real_int64 69L); ]); +("y1_def_neg", [8; 12; 13; 18; 19; 26; 29; 31; 32; 34; 35; 38; 39; 43; 44; 46; 47; 48; 51; ], [(mk_real_int64 168L); (mk_real_int64 63L); (mk_real_int64 31L); (mk_real_int64 68L); (mk_real_int64 62L); (mk_real_int64 93L); (mk_real_int64 11L); (mk_real_int64 15L); (mk_real_int64 10L); (mk_real_int64 90L); (mk_real_int64 33L); (mk_real_int64 6L); (mk_real_int64 2L); (mk_real_int64 11L); (mk_real_int64 24L); (mk_real_int64 44L); (mk_real_int64 85L); (mk_real_int64 29L); (mk_real_int64 13L); ]); +("y1_def", [15; 17; 20; 24; 30; 36; 49; 52; 54; ], [(mk_real_int64 153L); (mk_real_int64 190L); (mk_real_int64 26L); (mk_real_int64 48L); (mk_real_int64 19L); (mk_real_int64 7L); (mk_real_int64 83L); (mk_real_int64 61L); (mk_real_int64 45L); ]); +("y2_def_neg", [8; 13; 15; 17; 18; 20; 26; 29; 30; 31; 34; 35; 36; 38; 39; 46; 47; 52; 54; ], [(mk_real_int64 168L); (mk_real_int64 31L); (mk_real_int64 95L); (mk_real_int64 58L); (mk_real_int64 68L); (mk_real_int64 225L); (mk_real_int64 81L); (mk_real_int64 11L); (mk_real_int64 22L); (mk_real_int64 22L); (mk_real_int64 82L); (mk_real_int64 33L); (mk_real_int64 2L); (mk_real_int64 6L); (mk_real_int64 2L); (mk_real_int64 21L); (mk_real_int64 53L); (mk_real_int64 34L); (mk_real_int64 14L); ]); +("y2_def", [12; 19; 24; 32; 43; 44; 48; 49; 51; ], [(mk_real_int64 80L); (mk_real_int64 94L); (mk_real_int64 292L); (mk_real_int64 6L); (mk_real_int64 14L); (mk_real_int64 37L); (mk_real_int64 26L); (mk_real_int64 83L); (mk_real_int64 21L); ]); +("y3_def_neg", [8; 13; 15; 17; 18; 20; 26; 29; 30; 31; 34; 35; 36; 38; 39; 46; 47; 52; 54; ], [(mk_real_int64 168L); (mk_real_int64 31L); (mk_real_int64 95L); (mk_real_int64 58L); (mk_real_int64 68L); (mk_real_int64 225L); (mk_real_int64 81L); (mk_real_int64 11L); (mk_real_int64 22L); (mk_real_int64 22L); (mk_real_int64 82L); (mk_real_int64 33L); (mk_real_int64 2L); (mk_real_int64 6L); (mk_real_int64 2L); (mk_real_int64 21L); (mk_real_int64 53L); (mk_real_int64 34L); (mk_real_int64 14L); ]); +("y3_def", [12; 19; 24; 32; 43; 44; 48; 49; 51; ], [(mk_real_int64 80L); (mk_real_int64 94L); (mk_real_int64 292L); (mk_real_int64 6L); (mk_real_int64 14L); (mk_real_int64 37L); (mk_real_int64 26L); (mk_real_int64 83L); (mk_real_int64 21L); ]); +("y4_def_neg", [2; 3; 9; 14; 16; 19; 21; 22; 24; 28; 30; 32; 33; 34; 35; 37; ], [(mk_real_int64 117L); (mk_real_int64 21L); (mk_real_int64 178L); (mk_real_int64 276L); (mk_real_int64 68L); (mk_real_int64 8L); (mk_real_int64 6L); (mk_real_int64 11L); (mk_real_int64 69L); (mk_real_int64 4L); (mk_real_int64 70L); (mk_real_int64 51L); (mk_real_int64 68L); (mk_real_int64 49L); (mk_real_int64 43L); (mk_real_int64 39L); ]); +("y4_def", [5; 7; 8; 10; 20; 25; 26; 29; 38; 40; ], [(mk_real_int64 373L); (mk_real_int64 294L); (mk_real_int64 58L); (mk_real_int64 182L); (mk_real_int64 75L); (mk_real_int64 71L); (mk_real_int64 11L); (mk_real_int64 4L); (mk_real_int64 104L); (mk_real_int64 69L); ]); +("y5_def_neg", [8; 11; 13; 17; 20; 24; 26; 29; 31; 34; 36; 38; 46; 47; 49; 52; 54; ], [(mk_real_int64 117L); (mk_real_int64 352L); (mk_real_int64 21L); (mk_real_int64 58L); (mk_real_int64 174L); (mk_real_int64 11L); (mk_real_int64 55L); (mk_real_int64 8L); (mk_real_int64 15L); (mk_real_int64 56L); (mk_real_int64 2L); (mk_real_int64 4L); (mk_real_int64 10L); (mk_real_int64 33L); (mk_real_int64 43L); (mk_real_int64 30L); (mk_real_int64 14L); ]); +("y5_def", [12; 15; 18; 19; 30; 32; 35; 39; 43; 44; 48; 51; ], [(mk_real_int64 80L); (mk_real_int64 21L); (mk_real_int64 58L); (mk_real_int64 94L); (mk_real_int64 17L); (mk_real_int64 6L); (mk_real_int64 71L); (mk_real_int64 4L); (mk_real_int64 14L); (mk_real_int64 37L); (mk_real_int64 26L); (mk_real_int64 21L); ]); +("y6_def", [7; 12; 15; 18; 19; 25; 28; 30; 32; 35; 39; 43; 44; 48; 51; ], [(mk_real_int64 117L); (mk_real_int64 80L); (mk_real_int64 21L); (mk_real_int64 58L); (mk_real_int64 94L); (mk_real_int64 66L); (mk_real_int64 1L); (mk_real_int64 17L); (mk_real_int64 6L); (mk_real_int64 71L); (mk_real_int64 4L); (mk_real_int64 14L); (mk_real_int64 37L); (mk_real_int64 26L); (mk_real_int64 21L); ]); +("y6_def_neg", [13; 17; 20; 24; 29; 31; 34; 36; 38; 46; 47; 49; 52; 54; ], [(mk_real_int64 21L); (mk_real_int64 58L); (mk_real_int64 174L); (mk_real_int64 11L); (mk_real_int64 8L); (mk_real_int64 15L); (mk_real_int64 56L); (mk_real_int64 2L); (mk_real_int64 4L); (mk_real_int64 10L); (mk_real_int64 10L); (mk_real_int64 43L); (mk_real_int64 30L); (mk_real_int64 14L); ]); +("y8_def_neg", [3; ], [(mk_real_int64 352L); ]); +("RHA", [0; 1; 2; 5; 6; 7; 10; 13; 14; 16; 18; 21; 22; 23; 24; 25; 27; 29; 31; 32; 33; 35; 38; 39; 41; 49; 53; 54; 55; ], [(mk_real_int64 56L); (mk_real_int64 39L); (mk_real_int64 41L); (mk_real_int64 111L); (mk_real_int64 56L); (mk_real_int64 111L); (mk_real_int64 111L); (mk_real_int64 140L); (mk_real_int64 254L); (mk_real_int64 140L); (mk_real_int64 143L); (mk_real_int64 3L); (mk_real_int64 525L); (mk_real_int64 525L); (mk_real_int64 272L); (mk_real_int64 13L); (mk_real_int64 54L); (mk_real_int64 41L); (mk_real_int64 135L); (mk_real_int64 160L); (mk_real_int64 175L); (mk_real_int64 39L); (mk_real_int64 39L); (mk_real_int64 56L); (mk_real_int64 56L); (mk_real_int64 33L); (mk_real_int64 145L); (mk_real_int64 145L); (mk_real_int64 145L); ]); +("RHB", [11; ], [(mk_real_int64 3L); ]); +("tau6", [0; ], [(mk_real_int64 934L); ]); +("ineq105", [9; 13; ], [(mk_real_int64 199L); (mk_real_int64 34L); ]); +("ineq106", [9; 14; 16; 22; 33; 34; ], [(mk_real_int64 3L); (mk_real_int64 253L); (mk_real_int64 13L); (mk_real_int64 17L); (mk_real_int64 33L); (mk_real_int64 33L); ]); +("ineq107", [5; 7; 10; 20; 21; 26; 38; 40; ], [(mk_real_int64 381L); (mk_real_int64 381L); (mk_real_int64 385L); (mk_real_int64 63L); (mk_real_int64 10L); (mk_real_int64 14L); (mk_real_int64 145L); (mk_real_int64 90L); ]); +("ineq108", [9; 24; 30; 32; 34; 37; ], [(mk_real_int64 256L); (mk_real_int64 13L); (mk_real_int64 102L); (mk_real_int64 39L); (mk_real_int64 39L); (mk_real_int64 57L); ]); +("ineq109", [5; 8; 20; 25; 29; ], [(mk_real_int64 245L); (mk_real_int64 245L); (mk_real_int64 83L); (mk_real_int64 221L); (mk_real_int64 14L); ]); +("ineq110", [14; 35; ], [(mk_real_int64 525L); (mk_real_int64 218L); ]); +("ineq111", [2; 3; 8; 10; 16; 19; 21; 24; 28; 32; 33; 38; ], [(mk_real_int64 934L); (mk_real_int64 171L); (mk_real_int64 171L); (mk_real_int64 926L); (mk_real_int64 477L); (mk_real_int64 62L); (mk_real_int64 111L); (mk_real_int64 482L); (mk_real_int64 36L); (mk_real_int64 193L); (mk_real_int64 363L); (mk_real_int64 65L); ]); +("ineq113", [27; ], [(mk_real_int64 854L); ]); +("ineq114", [4; 8; 11; 12; 15; 17; 18; 19; 22; 23; 24; 25; 28; 29; 30; 32; 33; 35; 36; 37; 41; ], [(mk_real_int64 620L); (mk_real_int64 620L); (mk_real_int64 5L); (mk_real_int64 409L); (mk_real_int64 425L); (mk_real_int64 20L); (mk_real_int64 536L); (mk_real_int64 132L); (mk_real_int64 189L); (mk_real_int64 216L); (mk_real_int64 100L); (mk_real_int64 353L); (mk_real_int64 22L); (mk_real_int64 22L); (mk_real_int64 394L); (mk_real_int64 347L); (mk_real_int64 209L); (mk_real_int64 109L); (mk_real_int64 557L); (mk_real_int64 313L); (mk_real_int64 789L); ]); +("ineq119", [2; 4; ], [(mk_real_int64 858L); (mk_real_int64 519L); ]); +("ineq120", [3; 7; ], [(mk_real_int64 76L); (mk_real_int64 415L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 3250L); (mk_real_int64 2725L); (mk_real_int64 3075L); (mk_real_int64 2575L); (mk_real_int64 3075L); (mk_real_int64 3350L); (mk_real_int64 3150L); (mk_real_int64 2575L); (mk_real_int64 6575L); (mk_real_int64 2575L); (mk_real_int64 2575L); (mk_real_int64 2575L); (mk_real_int64 2575L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_lo", [11; 27; 28; 29; 30; 32; 33; 34; 35; 37; 38; 39; 40; 43; 44; 47; 50; 51; 55; ], [(mk_real_int64 146L); (mk_real_int64 480L); (mk_real_int64 464L); (mk_real_int64 368L); (mk_real_int64 1000L); (mk_real_int64 686L); (mk_real_int64 784L); (mk_real_int64 400L); (mk_real_int64 22L); (mk_real_int64 186L); (mk_real_int64 228L); (mk_real_int64 228L); (mk_real_int64 107L); (mk_real_int64 430L); (mk_real_int64 356L); (mk_real_int64 166L); (mk_real_int64 318L); (mk_real_int64 62L); (mk_real_int64 86L); ]); +("azim_hi", [4; 12; 14; 18; 21; 22; 25; 46; 48; 49; ], [(mk_real_int64 626000L); (mk_real_int64 608L); (mk_real_int64 120L); (mk_real_int64 120L); (mk_real_int64 130L); (mk_real_int64 34L); (mk_real_int64 50L); (mk_real_int64 222L); (mk_real_int64 1000L); (mk_real_int64 234L); ]); +("rhazim_lo", [1; 2; 4; 5; 7; 10; 29; 35; 38; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_hi", [4; 13; 16; 18; 25; 26; ], [(mk_real_int64 143000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_lo", [2; 3; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 596L); (mk_real_int64 1744L); (mk_real_int64 840L); (mk_real_int64 1744L); (mk_real_int64 1744L); (mk_real_int64 1744L); (mk_real_int64 1744L); (mk_real_int64 1744L); (mk_real_int64 1744L); ]); +("rho_hi", [0; 1; 4; 5; ], [(mk_real_int64 3064L); (mk_real_int64 3928L); (mk_real_int64 2184L); (mk_real_int64 2616L); ]); +("tau_hi", [10; 15; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("tau_lo", [3; 4; 8; 9; 14; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 204000L); (mk_real_int64 283000L); (mk_real_int64 220000L); ]); +("y1_lo", [8; 20; 24; 26; 29; 30; 32; 35; 38; 39; 47; 49; 51; 52; ], [(mk_real_int64 120L); (mk_real_int64 180L); (mk_real_int64 300L); (mk_real_int64 660L); (mk_real_int64 160L); (mk_real_int64 33L); (mk_real_int64 200L); (mk_real_int64 371L); (mk_real_int64 480L); (mk_real_int64 114L); (mk_real_int64 140L); (mk_real_int64 160L); (mk_real_int64 395L); (mk_real_int64 200L); ]); +("y1_hi", [12; 13; 15; 17; 18; 19; 31; 34; 43; 44; 46; 48; ], [(mk_real_int64 315L); (mk_real_int64 220L); (mk_real_int64 505L); (mk_real_int64 500L); (mk_real_int64 225L); (mk_real_int64 40L); (mk_real_int64 20L); (mk_real_int64 185L); (mk_real_int64 290L); (mk_real_int64 30L); (mk_real_int64 95L); (mk_real_int64 35L); ]); +("y2_lo", [8; 12; 20; 24; 26; 29; 30; 34; 35; 36; 38; 39; 43; 47; 49; 51; ], [(mk_real_int64 120L); (mk_real_int64 2L); (mk_real_int64 200L); (mk_real_int64 408L); (mk_real_int64 128L); (mk_real_int64 160L); (mk_real_int64 109L); (mk_real_int64 28L); (mk_real_int64 371L); (mk_real_int64 128L); (mk_real_int64 480L); (mk_real_int64 114L); (mk_real_int64 332L); (mk_real_int64 328L); (mk_real_int64 160L); (mk_real_int64 252L); ]); +("y2_hi", [13; 15; 17; 18; 19; 31; 32; 44; 46; 48; 52; 54; ], [(mk_real_int64 220L); (mk_real_int64 93L); (mk_real_int64 88L); (mk_real_int64 225L); (mk_real_int64 276L); (mk_real_int64 500L); (mk_real_int64 188L); (mk_real_int64 128L); (mk_real_int64 456L); (mk_real_int64 208L); (mk_real_int64 260L); (mk_real_int64 320L); ]); +("y3_lo", [8; 12; 20; 24; 26; 29; 30; 34; 35; 36; 38; 39; 43; 47; 49; 51; ], [(mk_real_int64 120L); (mk_real_int64 2L); (mk_real_int64 200L); (mk_real_int64 408L); (mk_real_int64 128L); (mk_real_int64 160L); (mk_real_int64 109L); (mk_real_int64 28L); (mk_real_int64 371L); (mk_real_int64 128L); (mk_real_int64 480L); (mk_real_int64 114L); (mk_real_int64 332L); (mk_real_int64 328L); (mk_real_int64 160L); (mk_real_int64 252L); ]); +("y3_hi", [13; 15; 17; 18; 19; 31; 32; 44; 46; 48; 52; 54; ], [(mk_real_int64 220L); (mk_real_int64 93L); (mk_real_int64 88L); (mk_real_int64 225L); (mk_real_int64 276L); (mk_real_int64 500L); (mk_real_int64 188L); (mk_real_int64 128L); (mk_real_int64 456L); (mk_real_int64 208L); (mk_real_int64 260L); (mk_real_int64 320L); ]); +("y4_hi", [2; 5; 7; 8; 9; 19; 20; 25; 29; 30; 32; 33; 35; 40; ], [(mk_real_int64 250L); (mk_real_int64 893L); (mk_real_int64 513L); (mk_real_int64 5L); (mk_real_int64 585L); (mk_real_int64 250L); (mk_real_int64 591L); (mk_real_int64 604L); (mk_real_int64 536L); (mk_real_int64 130L); (mk_real_int64 160L); (mk_real_int64 20L); (mk_real_int64 272L); (mk_real_int64 570L); ]); +("y4_lo", [3; 10; 14; 16; 21; 22; 24; 26; 28; 34; 37; 38; ], [(mk_real_int64 375L); (mk_real_int64 145L); (mk_real_int64 205L); (mk_real_int64 530L); (mk_real_int64 145L); (mk_real_int64 645L); (mk_real_int64 155L); (mk_real_int64 178L); (mk_real_int64 500L); (mk_real_int64 320L); (mk_real_int64 45L); (mk_real_int64 40L); ]); +("y5_hi", [8; 15; 17; 18; 19; 24; 26; 29; 30; 32; 34; 35; 39; 44; 46; 48; 49; 54; ], [(mk_real_int64 250L); (mk_real_int64 468L); (mk_real_int64 88L); (mk_real_int64 5L); (mk_real_int64 276L); (mk_real_int64 192L); (mk_real_int64 107L); (mk_real_int64 250L); (mk_real_int64 316L); (mk_real_int64 188L); (mk_real_int64 482L); (mk_real_int64 604L); (mk_real_int64 536L); (mk_real_int64 128L); (mk_real_int64 71L); (mk_real_int64 208L); (mk_real_int64 272L); (mk_real_int64 320L); ]); +("y5_lo", [12; 13; 20; 31; 36; 38; 43; 47; 51; 52; ], [(mk_real_int64 2L); (mk_real_int64 375L); (mk_real_int64 270L); (mk_real_int64 395L); (mk_real_int64 128L); (mk_real_int64 500L); (mk_real_int64 332L); (mk_real_int64 363L); (mk_real_int64 252L); (mk_real_int64 165L); ]); +("y6_hi", [8; 15; 17; 18; 19; 24; 26; 29; 30; 32; 34; 35; 39; 44; 46; 48; 49; 54; ], [(mk_real_int64 250L); (mk_real_int64 468L); (mk_real_int64 88L); (mk_real_int64 5L); (mk_real_int64 276L); (mk_real_int64 192L); (mk_real_int64 107L); (mk_real_int64 250L); (mk_real_int64 316L); (mk_real_int64 188L); (mk_real_int64 482L); (mk_real_int64 604L); (mk_real_int64 536L); (mk_real_int64 128L); (mk_real_int64 71L); (mk_real_int64 208L); (mk_real_int64 272L); (mk_real_int64 320L); ]); +("y6_lo", [7; 8; 12; 13; 20; 25; 26; 28; 31; 36; 38; 43; 47; 51; 52; ], [(mk_real_int64 117000L); (mk_real_int64 117000L); (mk_real_int64 2L); (mk_real_int64 375L); (mk_real_int64 270L); (mk_real_int64 66000L); (mk_real_int64 55000L); (mk_real_int64 1000L); (mk_real_int64 395L); (mk_real_int64 128L); (mk_real_int64 500L); (mk_real_int64 332L); (mk_real_int64 23363L); (mk_real_int64 252L); (mk_real_int64 165L); ]); +("y8_hi", [3; ], [(mk_real_int64 352000L); ]); +("ye_hi", [33; ], [(mk_real_int64 1000L); ]); +("ye_lo", [5; 24; 34; 36; ], [(mk_real_int64 117000L); (mk_real_int64 96000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_hi", [0; 4; 5; 6; 8; 9; 11; ], [(mk_real_int64 372L); (mk_real_int64 224L); (mk_real_int64 1376L); (mk_real_int64 1008L); (mk_real_int64 1416L); (mk_real_int64 720L); (mk_real_int64 720L); ]); +("yn_lo", [1; 2; 3; 7; 10; 12; ], [(mk_real_int64 221L); (mk_real_int64 52L); (mk_real_int64 280L); (mk_real_int64 280L); (mk_real_int64 280L); (mk_real_int64 1280L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests/202328731904_out.hl b/formal_lp/old/ineqs/tests/202328731904_out.hl new file mode 100644 index 0000000..e29e245 --- /dev/null +++ b/formal_lp/old/ineqs/tests/202328731904_out.hl @@ -0,0 +1,88 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "202328731904 17 6 0 1 2 3 4 5 4 0 5 6 7 3 6 5 4 3 6 4 3 3 6 3 8 3 8 3 9 3 9 3 2 3 9 2 10 3 10 2 1 3 10 1 11 3 11 1 0 3 11 0 7 4 11 7 8 12 3 7 6 8 3 12 8 9 3 12 9 10 3 10 11 12 ";; +let precision = 4;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum_neg", [1; 5; 9; 10; 12; ], [(mk_real_int64 4140L); (mk_real_int64 330L); (mk_real_int64 2339L); (mk_real_int64 2357L); (mk_real_int64 3543L); ]); +("azim_sum", [8; 11; ], [(mk_real_int64 1199L); (mk_real_int64 1242L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 9070L); (mk_real_int64 8854L); (mk_real_int64 9070L); (mk_real_int64 9070L); (mk_real_int64 9070L); (mk_real_int64 9399L); (mk_real_int64 9070L); (mk_real_int64 9070L); (mk_real_int64 9113L); (mk_real_int64 9070L); (mk_real_int64 9088L); (mk_real_int64 9070L); (mk_real_int64 9070L); ]); +("sol_sum3", [1; 12; ], [(mk_real_int64 1887L); (mk_real_int64 3334L); ]); +("sol_sum3_neg", [2; 4; 6; 8; ], [(mk_real_int64 4100L); (mk_real_int64 1861L); (mk_real_int64 1861L); (mk_real_int64 494L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 8854L); (mk_real_int64 8854L); (mk_real_int64 4970L); (mk_real_int64 7104L); (mk_real_int64 7208L); (mk_real_int64 6731L); (mk_real_int64 7208L); (mk_real_int64 6731L); (mk_real_int64 7984L); (mk_real_int64 8775L); (mk_real_int64 8775L); (mk_real_int64 6731L); (mk_real_int64 9070L); (mk_real_int64 6731L); ]); +("tau_sum4_neg", [0; 1; ], [(mk_real_int64 9070L); (mk_real_int64 9070L); ]); +("tau_sum6_neg", [0; ], [(mk_real_int64 9070L); ]); +("ln_def_neg", [5; 8; 10; ], [(mk_real_int64 364L); (mk_real_int64 48L); (mk_real_int64 20L); ]); +("ln_def", [1; ], [(mk_real_int64 238L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 56987L); (mk_real_int64 55633L); (mk_real_int64 56987L); (mk_real_int64 56987L); (mk_real_int64 56987L); (mk_real_int64 59059L); (mk_real_int64 56987L); (mk_real_int64 56987L); (mk_real_int64 57259L); (mk_real_int64 56987L); (mk_real_int64 57100L); (mk_real_int64 56987L); (mk_real_int64 56987L); ]); +("edge_sym", [15; 20; 26; 32; 41; 42; 43; 52; ], [(mk_real_int64 2084L); (mk_real_int64 437L); (mk_real_int64 437L); (mk_real_int64 621L); (mk_real_int64 309L); (mk_real_int64 309L); (mk_real_int64 309L); (mk_real_int64 309L); ]); +("edge_sym_neg", [17; 18; 21; 24; 27; 30; 33; 36; 39; 49; ], [(mk_real_int64 782L); (mk_real_int64 782L); (mk_real_int64 805L); (mk_real_int64 437L); (mk_real_int64 1336L); (mk_real_int64 437L); (mk_real_int64 985L); (mk_real_int64 13L); (mk_real_int64 309L); (mk_real_int64 309L); ]); +("y1_def", [14; 18; 21; 22; 24; 28; 29; 34; 47; 50; 55; ], [(mk_real_int64 1127L); (mk_real_int64 813L); (mk_real_int64 119L); (mk_real_int64 236L); (mk_real_int64 707L); (mk_real_int64 236L); (mk_real_int64 707L); (mk_real_int64 188L); (mk_real_int64 420L); (mk_real_int64 105L); (mk_real_int64 420L); ]); +("y1_def_neg", [13; 15; 16; 20; 26; 27; 32; 33; 35; 36; 37; 38; 39; 40; 42; 44; 45; 51; 52; ], [(mk_real_int64 285L); (mk_real_int64 385L); (mk_real_int64 619L); (mk_real_int64 890L); (mk_real_int64 1014L); (mk_real_int64 257L); (mk_real_int64 918L); (mk_real_int64 105L); (mk_real_int64 184L); (mk_real_int64 355L); (mk_real_int64 244L); (mk_real_int64 177L); (mk_real_int64 103L); (mk_real_int64 242L); (mk_real_int64 242L); (mk_real_int64 177L); (mk_real_int64 486L); (mk_real_int64 1060L); (mk_real_int64 503L); ]); +("y2_def_neg", [13; 14; 15; 16; 21; 22; 27; 28; 35; 37; 45; 47; 50; 51; 52; 55; ], [(mk_real_int64 285L); (mk_real_int64 343L); (mk_real_int64 385L); (mk_real_int64 619L); (mk_real_int64 124L); (mk_real_int64 72L); (mk_real_int64 257L); (mk_real_int64 72L); (mk_real_int64 173L); (mk_real_int64 244L); (mk_real_int64 202L); (mk_real_int64 365L); (mk_real_int64 32L); (mk_real_int64 1060L); (mk_real_int64 503L); (mk_real_int64 365L); ]); +("y2_def", [18; 20; 24; 26; 29; 32; 33; 34; 36; 38; 39; 40; 42; 44; ], [(mk_real_int64 2010L); (mk_real_int64 540L); (mk_real_int64 707L); (mk_real_int64 615L); (mk_real_int64 707L); (mk_real_int64 557L); (mk_real_int64 64L); (mk_real_int64 188L); (mk_real_int64 215L); (mk_real_int64 107L); (mk_real_int64 62L); (mk_real_int64 309L); (mk_real_int64 309L); (mk_real_int64 107L); ]); +("y3_def_neg", [13; 14; 15; 16; 21; 22; 27; 28; 35; 37; 45; 47; 50; 51; 52; 55; ], [(mk_real_int64 285L); (mk_real_int64 343L); (mk_real_int64 385L); (mk_real_int64 619L); (mk_real_int64 124L); (mk_real_int64 72L); (mk_real_int64 257L); (mk_real_int64 72L); (mk_real_int64 173L); (mk_real_int64 244L); (mk_real_int64 202L); (mk_real_int64 365L); (mk_real_int64 32L); (mk_real_int64 1060L); (mk_real_int64 503L); (mk_real_int64 365L); ]); +("y3_def", [18; 20; 24; 26; 29; 32; 33; 34; 36; 38; 39; 40; 42; 44; ], [(mk_real_int64 2010L); (mk_real_int64 540L); (mk_real_int64 707L); (mk_real_int64 615L); (mk_real_int64 707L); (mk_real_int64 557L); (mk_real_int64 64L); (mk_real_int64 188L); (mk_real_int64 215L); (mk_real_int64 107L); (mk_real_int64 62L); (mk_real_int64 309L); (mk_real_int64 309L); (mk_real_int64 107L); ]); +("y4_def", [3; 4; 11; 12; 18; 33; 36; 38; 41; ], [(mk_real_int64 610L); (mk_real_int64 1742L); (mk_real_int64 242L); (mk_real_int64 365L); (mk_real_int64 365L); (mk_real_int64 805L); (mk_real_int64 162L); (mk_real_int64 1078L); (mk_real_int64 805L); ]); +("y4_def_neg", [5; 6; 8; 10; 14; 16; 17; 19; 22; 23; 24; 25; 26; 27; 28; 29; 30; 31; 37; ], [(mk_real_int64 267L); (mk_real_int64 430L); (mk_real_int64 1654L); (mk_real_int64 1016L); (mk_real_int64 365L); (mk_real_int64 1158L); (mk_real_int64 179L); (mk_real_int64 365L); (mk_real_int64 1049L); (mk_real_int64 120L); (mk_real_int64 97L); (mk_real_int64 131L); (mk_real_int64 406L); (mk_real_int64 170L); (mk_real_int64 202L); (mk_real_int64 117L); (mk_real_int64 202L); (mk_real_int64 417L); (mk_real_int64 736L); ]); +("y5_def_neg", [14; 15; 16; 18; 21; 22; 24; 27; 28; 29; 34; 35; 37; 45; 47; 50; 51; 55; ], [(mk_real_int64 343L); (mk_real_int64 267L); (mk_real_int64 430L); (mk_real_int64 352L); (mk_real_int64 103L); (mk_real_int64 72L); (mk_real_int64 365L); (mk_real_int64 179L); (mk_real_int64 72L); (mk_real_int64 365L); (mk_real_int64 97L); (mk_real_int64 119L); (mk_real_int64 170L); (mk_real_int64 107L); (mk_real_int64 309L); (mk_real_int64 32L); (mk_real_int64 736L); (mk_real_int64 309L); ]); +("y5_def", [13; 20; 26; 32; 33; 36; 38; 39; 40; 42; 44; 52; ], [(mk_real_int64 610L); (mk_real_int64 540L); (mk_real_int64 615L); (mk_real_int64 557L); (mk_real_int64 64L); (mk_real_int64 215L); (mk_real_int64 107L); (mk_real_int64 62L); (mk_real_int64 309L); (mk_real_int64 309L); (mk_real_int64 107L); (mk_real_int64 1078L); ]); +("y6_def_neg", [14; 15; 16; 18; 21; 22; 24; 27; 28; 29; 34; 35; 47; 50; 55; ], [(mk_real_int64 343L); (mk_real_int64 267L); (mk_real_int64 430L); (mk_real_int64 352L); (mk_real_int64 103L); (mk_real_int64 72L); (mk_real_int64 365L); (mk_real_int64 179L); (mk_real_int64 72L); (mk_real_int64 365L); (mk_real_int64 97L); (mk_real_int64 119L); (mk_real_int64 309L); (mk_real_int64 32L); (mk_real_int64 309L); ]); +("y6_def", [13; 20; 26; 32; 33; 36; 37; 38; 39; 40; 42; 44; 45; 51; 52; 53; ], [(mk_real_int64 610L); (mk_real_int64 540L); (mk_real_int64 615L); (mk_real_int64 557L); (mk_real_int64 64L); (mk_real_int64 215L); (mk_real_int64 23L); (mk_real_int64 107L); (mk_real_int64 62L); (mk_real_int64 309L); (mk_real_int64 309L); (mk_real_int64 107L); (mk_real_int64 984L); (mk_real_int64 97L); (mk_real_int64 1078L); (mk_real_int64 180L); ]); +("RHA", [0; 6; 10; 11; 13; 15; 16; 17; 18; 19; 20; 21; 22; 23; 24; 25; 26; 27; 28; 29; 30; 31; 32; 33; 34; 35; 36; 37; 38; 39; 42; 46; 47; 48; 49; 52; 53; 54; 55; ], [(mk_real_int64 330L); (mk_real_int64 330L); (mk_real_int64 216L); (mk_real_int64 216L); (mk_real_int64 216L); (mk_real_int64 216L); (mk_real_int64 4100L); (mk_real_int64 4100L); (mk_real_int64 2901L); (mk_real_int64 2009L); (mk_real_int64 482L); (mk_real_int64 1966L); (mk_real_int64 1861L); (mk_real_int64 1861L); (mk_real_int64 1861L); (mk_real_int64 2339L); (mk_real_int64 649L); (mk_real_int64 2357L); (mk_real_int64 1879L); (mk_real_int64 1861L); (mk_real_int64 1861L); (mk_real_int64 2357L); (mk_real_int64 808L); (mk_real_int64 2163L); (mk_real_int64 1086L); (mk_real_int64 1074L); (mk_real_int64 824L); (mk_real_int64 295L); (mk_real_int64 330L); (mk_real_int64 123L); (mk_real_int64 43L); (mk_real_int64 338L); (mk_real_int64 2339L); (mk_real_int64 2382L); (mk_real_int64 2339L); (mk_real_int64 18L); (mk_real_int64 2357L); (mk_real_int64 2339L); (mk_real_int64 2339L); ]); +("tau4", [0; ], [(mk_real_int64 9070L); ]); +("tau6", [0; ], [(mk_real_int64 9070L); ]); +("ineq105", [10; 12; ], [(mk_real_int64 769L); (mk_real_int64 769L); ]); +("ineq106", [8; 10; 16; 22; 23; 25; 26; 28; 29; 30; 31; ], [(mk_real_int64 1242L); (mk_real_int64 1484L); (mk_real_int64 1690L); (mk_real_int64 1531L); (mk_real_int64 176L); (mk_real_int64 12L); (mk_real_int64 592L); (mk_real_int64 295L); (mk_real_int64 171L); (mk_real_int64 295L); (mk_real_int64 295L); ]); +("ineq107", [4; 11; 12; 18; 33; 36; 41; ], [(mk_real_int64 2253L); (mk_real_int64 373L); (mk_real_int64 472L); (mk_real_int64 472L); (mk_real_int64 1204L); (mk_real_int64 209L); (mk_real_int64 1204L); ]); +("ineq109", [3; 38; ], [(mk_real_int64 1887L); (mk_real_int64 3334L); ]); +("ineq110", [8; 14; 19; 24; ], [(mk_real_int64 4100L); (mk_real_int64 1861L); (mk_real_int64 1861L); (mk_real_int64 494L); ]); +("ineq111", [5; 6; 11; 17; 25; 27; 31; 33; 37; 41; ], [(mk_real_int64 2138L); (mk_real_int64 3439L); (mk_real_int64 374L); (mk_real_int64 1428L); (mk_real_int64 984L); (mk_real_int64 1358L); (mk_real_int64 1717L); (mk_real_int64 1010L); (mk_real_int64 5891L); (mk_real_int64 1010L); ]); +("ineq112", [2; ], [(mk_real_int64 8166L); ]); +("ineq113", [12; 18; ], [(mk_real_int64 7208L); (mk_real_int64 7208L); ]); +("ineq114", [0; 1; 3; 5; 9; 10; 16; 22; 23; 24; 25; 27; 29; 32; 34; 37; 38; 40; ], [(mk_real_int64 344L); (mk_real_int64 344L); (mk_real_int64 3358L); (mk_real_int64 3358L); (mk_real_int64 5125L); (mk_real_int64 770L); (mk_real_int64 1036L); (mk_real_int64 1291L); (mk_real_int64 5440L); (mk_real_int64 2930L); (mk_real_int64 927L); (mk_real_int64 2455L); (mk_real_int64 197L); (mk_real_int64 2455L); (mk_real_int64 5720L); (mk_real_int64 1589L); (mk_real_int64 1589L); (mk_real_int64 5720L); ]); +("ineq119", [7; ], [(mk_real_int64 7821L); ]); +("ineq120", [4; 6; ], [(mk_real_int64 624L); (mk_real_int64 624L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 44802L); (mk_real_int64 39718L); (mk_real_int64 44802L); (mk_real_int64 44802L); (mk_real_int64 44802L); (mk_real_int64 50514L); (mk_real_int64 44802L); (mk_real_int64 44802L); (mk_real_int64 47714L); (mk_real_int64 44802L); (mk_real_int64 46600L); (mk_real_int64 44802L); (mk_real_int64 44802L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [4; 19; 20; 22; 28; 32; 33; 34; 35; 39; 43; ], [(mk_real_int64 41400000L); (mk_real_int64 2500L); (mk_real_int64 200L); (mk_real_int64 1280L); (mk_real_int64 1280L); (mk_real_int64 1660L); (mk_real_int64 4400L); (mk_real_int64 1800L); (mk_real_int64 3020L); (mk_real_int64 3220L); (mk_real_int64 870L); ]); +("azim_lo", [10; 11; 12; 13; 15; 26; 37; 40; 42; 46; 48; 51; 52; 54; ], [(mk_real_int64 6560L); (mk_real_int64 6560L); (mk_real_int64 1620L); (mk_real_int64 8920L); (mk_real_int64 8920L); (mk_real_int64 4640L); (mk_real_int64 1700L); (mk_real_int64 4448L); (mk_real_int64 4448L); (mk_real_int64 1700L); (mk_real_int64 2800L); (mk_real_int64 2860L); (mk_real_int64 2860L); (mk_real_int64 2800L); ]); +("rhazim_hi", [0; 4; 6; 36; 38; ], [(mk_real_int64 10000L); (mk_real_int64 2160000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("rhazim_lo", [22; 23; 24; 28; 29; 30; 39; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("rho_lo", [1; 5; 8; ], [(mk_real_int64 15472L); (mk_real_int64 32032L); (mk_real_int64 1984L); ]); +("rho_hi", [0; 2; 3; 4; 6; 7; 9; 10; 11; 12; ], [(mk_real_int64 16240L); (mk_real_int64 16240L); (mk_real_int64 16240L); (mk_real_int64 16240L); (mk_real_int64 16240L); (mk_real_int64 16240L); (mk_real_int64 16240L); (mk_real_int64 17216L); (mk_real_int64 16240L); (mk_real_int64 16240L); ]); +("tau_lo", [4; 5; 7; 10; 11; 12; 13; 14; 15; 16; ], [(mk_real_int64 15310000L); (mk_real_int64 8350000L); (mk_real_int64 42670000L); (mk_real_int64 31430000L); (mk_real_int64 47650000L); (mk_real_int64 10000L); (mk_real_int64 46030000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("y1_lo", [14; 16; 18; 20; 27; 32; 33; 34; 35; 36; 37; 40; 42; 45; 50; 51; 52; ], [(mk_real_int64 5000L); (mk_real_int64 200L); (mk_real_int64 2000L); (mk_real_int64 4000L); (mk_real_int64 400L); (mk_real_int64 6000L); (mk_real_int64 6000L); (mk_real_int64 2800L); (mk_real_int64 3200L); (mk_real_int64 2000L); (mk_real_int64 4400L); (mk_real_int64 2350L); (mk_real_int64 2350L); (mk_real_int64 600L); (mk_real_int64 5000L); (mk_real_int64 3800L); (mk_real_int64 4340L); ]); +("y1_hi", [13; 15; 21; 24; 29; 39; 47; 55; ], [(mk_real_int64 630L); (mk_real_int64 1600L); (mk_real_int64 1800L); (mk_real_int64 1800L); (mk_real_int64 1800L); (mk_real_int64 4000L); (mk_real_int64 2000L); (mk_real_int64 2000L); ]); +("y2_hi", [13; 14; 15; 20; 22; 24; 28; 29; 32; 33; 35; 36; 38; 39; 40; 42; 44; 45; 47; 50; 55; ], [(mk_real_int64 630L); (mk_real_int64 5440L); (mk_real_int64 1600L); (mk_real_int64 276L); (mk_real_int64 2560L); (mk_real_int64 1800L); (mk_real_int64 2560L); (mk_real_int64 1800L); (mk_real_int64 1309L); (mk_real_int64 464L); (mk_real_int64 2468L); (mk_real_int64 4288L); (mk_real_int64 3505L); (mk_real_int64 2269L); (mk_real_int64 1380L); (mk_real_int64 1380L); (mk_real_int64 3505L); (mk_real_int64 2905L); (mk_real_int64 1920L); (mk_real_int64 2320L); (mk_real_int64 1920L); ]); +("y2_lo", [16; 18; 21; 26; 27; 34; 37; 51; 52; ], [(mk_real_int64 200L); (mk_real_int64 362L); (mk_real_int64 160L); (mk_real_int64 90L); (mk_real_int64 400L); (mk_real_int64 2800L); (mk_real_int64 4400L); (mk_real_int64 3800L); (mk_real_int64 4340L); ]); +("y3_hi", [13; 14; 15; 20; 22; 24; 28; 29; 32; 33; 35; 36; 38; 39; 40; 42; 44; 45; 47; 50; 55; ], [(mk_real_int64 630L); (mk_real_int64 5440L); (mk_real_int64 1600L); (mk_real_int64 276L); (mk_real_int64 2560L); (mk_real_int64 1800L); (mk_real_int64 2560L); (mk_real_int64 1800L); (mk_real_int64 1309L); (mk_real_int64 464L); (mk_real_int64 2468L); (mk_real_int64 4288L); (mk_real_int64 3505L); (mk_real_int64 2269L); (mk_real_int64 1380L); (mk_real_int64 1380L); (mk_real_int64 3505L); (mk_real_int64 2905L); (mk_real_int64 1920L); (mk_real_int64 2320L); (mk_real_int64 1920L); ]); +("y3_lo", [16; 18; 21; 26; 27; 34; 37; 51; 52; ], [(mk_real_int64 200L); (mk_real_int64 362L); (mk_real_int64 160L); (mk_real_int64 90L); (mk_real_int64 400L); (mk_real_int64 2800L); (mk_real_int64 4400L); (mk_real_int64 3800L); (mk_real_int64 4340L); ]); +("y4_hi", [6; 14; 16; 17; 19; 22; 24; 26; 27; 31; ], [(mk_real_int64 1250L); (mk_real_int64 2440L); (mk_real_int64 3500L); (mk_real_int64 5000L); (mk_real_int64 2440L); (mk_real_int64 2650L); (mk_real_int64 1760L); (mk_real_int64 4800L); (mk_real_int64 2500L); (mk_real_int64 3000L); ]); +("y4_lo", [3; 4; 5; 8; 10; 11; 12; 18; 23; 25; 28; 29; 30; 33; 36; 37; 38; 41; ], [(mk_real_int64 1216L); (mk_real_int64 4310L); (mk_real_int64 2500L); (mk_real_int64 3700L); (mk_real_int64 5400L); (mk_real_int64 4210L); (mk_real_int64 1440L); (mk_real_int64 1440L); (mk_real_int64 5600L); (mk_real_int64 2200L); (mk_real_int64 750L); (mk_real_int64 1350L); (mk_real_int64 750L); (mk_real_int64 5580L); (mk_real_int64 4430L); (mk_real_int64 3750L); (mk_real_int64 4512L); (mk_real_int64 5580L); ]); +("y5_hi", [14; 16; 18; 20; 22; 24; 27; 28; 29; 32; 33; 34; 35; 36; 37; 38; 39; 40; 42; 44; 50; ], [(mk_real_int64 5440L); (mk_real_int64 1250L); (mk_real_int64 3638L); (mk_real_int64 276L); (mk_real_int64 2560L); (mk_real_int64 2440L); (mk_real_int64 5000L); (mk_real_int64 2560L); (mk_real_int64 2440L); (mk_real_int64 1309L); (mk_real_int64 464L); (mk_real_int64 1760L); (mk_real_int64 3668L); (mk_real_int64 4288L); (mk_real_int64 2500L); (mk_real_int64 3505L); (mk_real_int64 2269L); (mk_real_int64 1380L); (mk_real_int64 1380L); (mk_real_int64 3505L); (mk_real_int64 2320L); ]); +("y5_lo", [13; 15; 21; 26; 45; 47; 51; 52; 55; ], [(mk_real_int64 1216L); (mk_real_int64 2500L); (mk_real_int64 4460L); (mk_real_int64 90L); (mk_real_int64 2745L); (mk_real_int64 2580L); (mk_real_int64 3750L); (mk_real_int64 4512L); (mk_real_int64 2580L); ]); +("y6_hi", [14; 16; 18; 20; 22; 24; 27; 28; 29; 32; 33; 34; 35; 36; 38; 39; 40; 42; 44; 50; ], [(mk_real_int64 5440L); (mk_real_int64 1250L); (mk_real_int64 3638L); (mk_real_int64 276L); (mk_real_int64 2560L); (mk_real_int64 2440L); (mk_real_int64 5000L); (mk_real_int64 2560L); (mk_real_int64 2440L); (mk_real_int64 1309L); (mk_real_int64 464L); (mk_real_int64 1760L); (mk_real_int64 3668L); (mk_real_int64 4288L); (mk_real_int64 3505L); (mk_real_int64 2269L); (mk_real_int64 1380L); (mk_real_int64 1380L); (mk_real_int64 3505L); (mk_real_int64 2320L); ]); +("y6_lo", [13; 15; 21; 26; 37; 45; 47; 51; 52; 53; 55; ], [(mk_real_int64 1216L); (mk_real_int64 2500L); (mk_real_int64 4460L); (mk_real_int64 90L); (mk_real_int64 1927500L); (mk_real_int64 10912745L); (mk_real_int64 2580L); (mk_real_int64 8333750L); (mk_real_int64 4512L); (mk_real_int64 1800000L); (mk_real_int64 2580L); ]); +("ye_lo", [21; 25; 26; 27; 34; 35; 38; 39; 46; ], [(mk_real_int64 3150000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("ye_hi", [15; 21; 50; 51; 52; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("yn_hi", [5; 8; 10; ], [(mk_real_int64 10084L); (mk_real_int64 3088L); (mk_real_int64 4620L); ]); +("yn_lo", [1; 2; 3; 6; 7; ], [(mk_real_int64 6740L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests/204898223616_out.hl b/formal_lp/old/ineqs/tests/204898223616_out.hl new file mode 100644 index 0000000..3ae3149 --- /dev/null +++ b/formal_lp/old/ineqs/tests/204898223616_out.hl @@ -0,0 +1,90 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "204898223616 19 6 0 1 2 3 4 5 4 0 5 6 7 3 6 5 4 3 6 4 3 3 6 3 8 3 8 3 9 3 9 3 2 4 9 2 10 11 3 7 6 8 3 10 2 12 3 12 2 1 3 12 1 0 3 12 0 13 3 10 12 13 3 13 0 7 3 13 7 11 3 11 7 8 3 11 10 13 3 8 9 11 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [7; 8; 10; 11; 13; ], [(mk_real_int64 14L); (mk_real_int64 668L); (mk_real_int64 124L); (mk_real_int64 280L); (mk_real_int64 385L); ]); +("azim_sum_neg", [1; 5; 6; 9; ], [(mk_real_int64 173L); (mk_real_int64 505L); (mk_real_int64 315L); (mk_real_int64 130L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 1002L); (mk_real_int64 1002L); (mk_real_int64 1002L); (mk_real_int64 1002L); (mk_real_int64 1002L); (mk_real_int64 830L); (mk_real_int64 941L); (mk_real_int64 1002L); (mk_real_int64 1002L); (mk_real_int64 765L); (mk_real_int64 1002L); (mk_real_int64 833L); (mk_real_int64 765L); (mk_real_int64 833L); ]); +("sol_sum3", [1; 7; 8; 10; ], [(mk_real_int64 173L); (mk_real_int64 204L); (mk_real_int64 204L); (mk_real_int64 130L); ]); +("sol_sum3_neg", [4; 5; 11; 12; 13; ], [(mk_real_int64 20L); (mk_real_int64 280L); (mk_real_int64 100L); (mk_real_int64 385L); (mk_real_int64 385L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; ], [(mk_real_int64 1002L); (mk_real_int64 1002L); (mk_real_int64 833L); (mk_real_int64 765L); (mk_real_int64 765L); (mk_real_int64 833L); (mk_real_int64 626L); (mk_real_int64 830L); (mk_real_int64 830L); (mk_real_int64 756L); (mk_real_int64 765L); (mk_real_int64 1002L); (mk_real_int64 833L); (mk_real_int64 833L); (mk_real_int64 765L); (mk_real_int64 765L); ]); +("tau_sum4_neg", [0; 1; ], [(mk_real_int64 1002L); (mk_real_int64 765L); ]); +("tau_sum6_neg", [0; ], [(mk_real_int64 1002L); ]); +("ln_def_neg", [0; 1; 2; 3; 4; 6; 7; 8; 10; ], [(mk_real_int64 104L); (mk_real_int64 104L); (mk_real_int64 104L); (mk_real_int64 104L); (mk_real_int64 104L); (mk_real_int64 37L); (mk_real_int64 104L); (mk_real_int64 104L); (mk_real_int64 104L); ]); +("ln_def", [5; 9; 11; 12; 13; ], [(mk_real_int64 85L); (mk_real_int64 157L); (mk_real_int64 81L); (mk_real_int64 157L); (mk_real_int64 81L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 6294L); (mk_real_int64 6294L); (mk_real_int64 6294L); (mk_real_int64 6294L); (mk_real_int64 6294L); (mk_real_int64 5213L); (mk_real_int64 5911L); (mk_real_int64 6294L); (mk_real_int64 6294L); (mk_real_int64 4805L); (mk_real_int64 6294L); (mk_real_int64 5237L); (mk_real_int64 4805L); (mk_real_int64 5237L); ]); +("edge_sym", [0; 5; 20; 27; 28; 31; 40; 42; 46; 49; 51; ], [(mk_real_int64 6L); (mk_real_int64 6L); (mk_real_int64 100L); (mk_real_int64 133L); (mk_real_int64 133L); (mk_real_int64 103L); (mk_real_int64 273L); (mk_real_int64 235L); (mk_real_int64 60L); (mk_real_int64 80L); (mk_real_int64 6L); ]); +("edge_sym_neg", [7; 12; 17; 18; 21; 33; 43; 52; 55; ], [(mk_real_int64 8L); (mk_real_int64 151L); (mk_real_int64 60L); (mk_real_int64 38L); (mk_real_int64 29L); (mk_real_int64 9L); (mk_real_int64 158L); (mk_real_int64 233L); (mk_real_int64 118L); ]); +("y1_def_neg", [0; 10; 14; 15; 16; 17; 18; 19; 20; 21; 23; 24; 28; 29; 30; 32; 34; 36; 38; 42; 43; 44; 46; 48; 49; 50; 51; 56; 58; 59; 61; ], [(mk_real_int64 4L); (mk_real_int64 180L); (mk_real_int64 81L); (mk_real_int64 26L); (mk_real_int64 101L); (mk_real_int64 232L); (mk_real_int64 66L); (mk_real_int64 30L); (mk_real_int64 39L); (mk_real_int64 2L); (mk_real_int64 33L); (mk_real_int64 57L); (mk_real_int64 104L); (mk_real_int64 154L); (mk_real_int64 48L); (mk_real_int64 5L); (mk_real_int64 4L); (mk_real_int64 34L); (mk_real_int64 68L); (mk_real_int64 287L); (mk_real_int64 177L); (mk_real_int64 11L); (mk_real_int64 50L); (mk_real_int64 37L); (mk_real_int64 57L); (mk_real_int64 16L); (mk_real_int64 88L); (mk_real_int64 81L); (mk_real_int64 140L); (mk_real_int64 81L); (mk_real_int64 45L); ]); +("y1_def", [12; 22; 31; 37; 39; 41; 45; 47; 52; 54; 55; 57; ], [(mk_real_int64 86L); (mk_real_int64 10L); (mk_real_int64 106L); (mk_real_int64 109L); (mk_real_int64 151L); (mk_real_int64 65L); (mk_real_int64 4L); (mk_real_int64 38L); (mk_real_int64 146L); (mk_real_int64 114L); (mk_real_int64 53L); (mk_real_int64 65L); ]); +("y2_def", [0; 16; 18; 19; 20; 24; 28; 29; 31; 32; 43; 47; 49; 51; 52; 54; 56; 58; 59; 61; ], [(mk_real_int64 6L); (mk_real_int64 61L); (mk_real_int64 102L); (mk_real_int64 18L); (mk_real_int64 24L); (mk_real_int64 35L); (mk_real_int64 133L); (mk_real_int64 144L); (mk_real_int64 106L); (mk_real_int64 3L); (mk_real_int64 135L); (mk_real_int64 38L); (mk_real_int64 88L); (mk_real_int64 53L); (mk_real_int64 146L); (mk_real_int64 127L); (mk_real_int64 42L); (mk_real_int64 85L); (mk_real_int64 87L); (mk_real_int64 31L); ]); +("y2_def_neg", [10; 12; 14; 15; 17; 21; 22; 23; 30; 34; 36; 37; 38; 39; 41; 42; 44; 45; 46; 48; 50; 55; 57; ], [(mk_real_int64 180L); (mk_real_int64 26L); (mk_real_int64 81L); (mk_real_int64 26L); (mk_real_int64 90L); (mk_real_int64 2L); (mk_real_int64 3L); (mk_real_int64 33L); (mk_real_int64 121L); (mk_real_int64 4L); (mk_real_int64 34L); (mk_real_int64 73L); (mk_real_int64 68L); (mk_real_int64 46L); (mk_real_int64 20L); (mk_real_int64 41L); (mk_real_int64 11L); (mk_real_int64 1L); (mk_real_int64 2L); (mk_real_int64 93L); (mk_real_int64 77L); (mk_real_int64 16L); (mk_real_int64 20L); ]); +("y3_def", [0; 16; 18; 19; 20; 24; 28; 29; 31; 32; 43; 47; 49; 51; 52; 54; 56; 58; 59; 61; ], [(mk_real_int64 6L); (mk_real_int64 61L); (mk_real_int64 102L); (mk_real_int64 18L); (mk_real_int64 24L); (mk_real_int64 35L); (mk_real_int64 133L); (mk_real_int64 144L); (mk_real_int64 106L); (mk_real_int64 3L); (mk_real_int64 135L); (mk_real_int64 38L); (mk_real_int64 88L); (mk_real_int64 53L); (mk_real_int64 146L); (mk_real_int64 127L); (mk_real_int64 42L); (mk_real_int64 85L); (mk_real_int64 87L); (mk_real_int64 31L); ]); +("y3_def_neg", [10; 12; 14; 15; 17; 21; 22; 23; 30; 34; 36; 37; 38; 39; 41; 42; 44; 45; 46; 48; 50; 55; 57; ], [(mk_real_int64 180L); (mk_real_int64 26L); (mk_real_int64 81L); (mk_real_int64 26L); (mk_real_int64 90L); (mk_real_int64 2L); (mk_real_int64 3L); (mk_real_int64 33L); (mk_real_int64 121L); (mk_real_int64 4L); (mk_real_int64 34L); (mk_real_int64 73L); (mk_real_int64 68L); (mk_real_int64 46L); (mk_real_int64 20L); (mk_real_int64 41L); (mk_real_int64 11L); (mk_real_int64 1L); (mk_real_int64 2L); (mk_real_int64 93L); (mk_real_int64 77L); (mk_real_int64 16L); (mk_real_int64 20L); ]); +("y4_def", [2; 5; 12; 16; 23; 24; 25; 27; 31; 32; 34; 36; 41; 43; ], [(mk_real_int64 134L); (mk_real_int64 56L); (mk_real_int64 15L); (mk_real_int64 14L); (mk_real_int64 282L); (mk_real_int64 40L); (mk_real_int64 233L); (mk_real_int64 101L); (mk_real_int64 7L); (mk_real_int64 8L); (mk_real_int64 11L); (mk_real_int64 28L); (mk_real_int64 81L); (mk_real_int64 101L); ]); +("y4_def_neg", [0; 4; 6; 7; 8; 9; 10; 11; 13; 14; 15; 17; 18; 20; 22; 28; 29; 30; 33; 35; 37; 38; 40; 42; 44; 45; 47; ], [(mk_real_int64 125L); (mk_real_int64 56L); (mk_real_int64 115L); (mk_real_int64 201L); (mk_real_int64 192L); (mk_real_int64 34L); (mk_real_int64 45L); (mk_real_int64 2L); (mk_real_int64 32L); (mk_real_int64 65L); (mk_real_int64 271L); (mk_real_int64 55L); (mk_real_int64 6L); (mk_real_int64 3L); (mk_real_int64 23L); (mk_real_int64 273L); (mk_real_int64 254L); (mk_real_int64 7L); (mk_real_int64 20L); (mk_real_int64 166L); (mk_real_int64 100L); (mk_real_int64 75L); (mk_real_int64 102L); (mk_real_int64 125L); (mk_real_int64 160L); (mk_real_int64 163L); (mk_real_int64 58L); ]); +("y5_def", [0; 15; 16; 18; 19; 20; 24; 28; 29; 32; 37; 38; 43; 46; 49; 51; 56; 58; 59; 61; ], [(mk_real_int64 6L); (mk_real_int64 56L); (mk_real_int64 61L); (mk_real_int64 102L); (mk_real_int64 18L); (mk_real_int64 24L); (mk_real_int64 35L); (mk_real_int64 133L); (mk_real_int64 144L); (mk_real_int64 3L); (mk_real_int64 23L); (mk_real_int64 40L); (mk_real_int64 135L); (mk_real_int64 60L); (mk_real_int64 88L); (mk_real_int64 53L); (mk_real_int64 47L); (mk_real_int64 85L); (mk_real_int64 87L); (mk_real_int64 31L); ]); +("y5_def_neg", [10; 12; 14; 17; 21; 22; 23; 30; 31; 34; 36; 39; 41; 44; 45; 47; 48; 50; 52; 54; 55; 57; ], [(mk_real_int64 125L); (mk_real_int64 26L); (mk_real_int64 56L); (mk_real_int64 46L); (mk_real_int64 2L); (mk_real_int64 3L); (mk_real_int64 32L); (mk_real_int64 89L); (mk_real_int64 55L); (mk_real_int64 3L); (mk_real_int64 23L); (mk_real_int64 46L); (mk_real_int64 20L); (mk_real_int64 7L); (mk_real_int64 1L); (mk_real_int64 20L); (mk_real_int64 68L); (mk_real_int64 57L); (mk_real_int64 75L); (mk_real_int64 87L); (mk_real_int64 16L); (mk_real_int64 20L); ]); +("y6_def", [0; 11; 13; 15; 16; 18; 19; 20; 24; 28; 29; 30; 32; 37; 38; 43; 45; 46; 49; 51; 56; 58; 59; 61; ], [(mk_real_int64 6L); (mk_real_int64 151L); (mk_real_int64 152L); (mk_real_int64 56L); (mk_real_int64 238L); (mk_real_int64 102L); (mk_real_int64 38L); (mk_real_int64 24L); (mk_real_int64 35L); (mk_real_int64 133L); (mk_real_int64 144L); (mk_real_int64 363L); (mk_real_int64 3L); (mk_real_int64 23L); (mk_real_int64 46L); (mk_real_int64 135L); (mk_real_int64 105L); (mk_real_int64 60L); (mk_real_int64 88L); (mk_real_int64 53L); (mk_real_int64 47L); (mk_real_int64 85L); (mk_real_int64 87L); (mk_real_int64 31L); ]); +("y6_def_neg", [10; 12; 14; 17; 21; 22; 23; 31; 34; 36; 39; 41; 44; 47; 48; 50; 52; 54; 55; 57; ], [(mk_real_int64 125L); (mk_real_int64 26L); (mk_real_int64 56L); (mk_real_int64 46L); (mk_real_int64 2L); (mk_real_int64 3L); (mk_real_int64 32L); (mk_real_int64 55L); (mk_real_int64 3L); (mk_real_int64 23L); (mk_real_int64 46L); (mk_real_int64 20L); (mk_real_int64 7L); (mk_real_int64 1L); (mk_real_int64 68L); (mk_real_int64 57L); (mk_real_int64 75L); (mk_real_int64 87L); (mk_real_int64 16L); (mk_real_int64 20L); ]); +("RHA", [17; 19; 20; 23; 24; 26; 28; 30; 32; 33; 34; 35; 36; 38; 40; 41; 45; 46; 50; 51; 54; 58; ], [(mk_real_int64 21L); (mk_real_int64 20L); (mk_real_int64 171L); (mk_real_int64 237L); (mk_real_int64 142L); (mk_real_int64 237L); (mk_real_int64 69L); (mk_real_int64 168L); (mk_real_int64 130L); (mk_real_int64 376L); (mk_real_int64 315L); (mk_real_int64 111L); (mk_real_int64 172L); (mk_real_int64 111L); (mk_real_int64 172L); (mk_real_int64 185L); (mk_real_int64 176L); (mk_real_int64 187L); (mk_real_int64 168L); (mk_real_int64 22L); (mk_real_int64 154L); (mk_real_int64 3L); ]); +("yy10", [6; 7; 23; 35; ], [(mk_real_int64 6L); (mk_real_int64 8L); (mk_real_int64 18L); (mk_real_int64 250L); ]); +("tau4", [0; ], [(mk_real_int64 101L); ]); +("tau6", [0; ], [(mk_real_int64 1002L); ]); +("ineq105", [0; 13; ], [(mk_real_int64 14L); (mk_real_int64 330L); ]); +("ineq106", [6; 7; 9; 10; 14; 15; 18; 28; 29; 32; 37; 40; 42; 44; 45; 47; ], [(mk_real_int64 168L); (mk_real_int64 147L); (mk_real_int64 49L); (mk_real_int64 66L); (mk_real_int64 95L); (mk_real_int64 168L); (mk_real_int64 9L); (mk_real_int64 246L); (mk_real_int64 246L); (mk_real_int64 50L); (mk_real_int64 147L); (mk_real_int64 14L); (mk_real_int64 69L); (mk_real_int64 234L); (mk_real_int64 69L); (mk_real_int64 69L); ]); +("ineq107", [2; 12; 16; 23; 25; 27; 31; 34; 36; 41; 43; ], [(mk_real_int64 173L); (mk_real_int64 20L); (mk_real_int64 112L); (mk_real_int64 280L); (mk_real_int64 301L); (mk_real_int64 130L); (mk_real_int64 9L); (mk_real_int64 86L); (mk_real_int64 93L); (mk_real_int64 105L); (mk_real_int64 130L); ]); +("ineq108", [8; 15; 28; 29; 35; 42; 45; 47; ], [(mk_real_int64 280L); (mk_real_int64 227L); (mk_real_int64 14L); (mk_real_int64 124L); (mk_real_int64 242L); (mk_real_int64 95L); (mk_real_int64 170L); (mk_real_int64 16L); ]); +("ineq109", [5; 23; 24; 32; ], [(mk_real_int64 173L); (mk_real_int64 204L); (mk_real_int64 204L); (mk_real_int64 130L); ]); +("ineq110", [13; 17; 33; 38; 40; ], [(mk_real_int64 20L); (mk_real_int64 280L); (mk_real_int64 100L); (mk_real_int64 385L); (mk_real_int64 385L); ]); +("ineq111", [0; 4; 7; 11; 13; 16; 20; 22; 24; 28; 30; 34; 36; 40; 42; ], [(mk_real_int64 1002L); (mk_real_int64 449L); (mk_real_int64 800L); (mk_real_int64 13L); (mk_real_int64 222L); (mk_real_int64 577L); (mk_real_int64 25L); (mk_real_int64 187L); (mk_real_int64 206L); (mk_real_int64 756L); (mk_real_int64 59L); (mk_real_int64 443L); (mk_real_int64 347L); (mk_real_int64 135L); (mk_real_int64 99L); ]); +("ineq112", [23; ], [(mk_real_int64 42L); ]); +("ineq114", [3; 5; 7; 9; 10; 13; 14; 15; 19; 22; 26; 32; 33; 35; 37; 40; 42; 44; 45; 47; ], [(mk_real_int64 276L); (mk_real_int64 276L); (mk_real_int64 34L); (mk_real_int64 478L); (mk_real_int64 274L); (mk_real_int64 347L); (mk_real_int64 195L); (mk_real_int64 257L); (mk_real_int64 601L); (mk_real_int64 601L); (mk_real_int64 623L); (mk_real_int64 706L); (mk_real_int64 38L); (mk_real_int64 520L); (mk_real_int64 487L); (mk_real_int64 699L); (mk_real_int64 462L); (mk_real_int64 204L); (mk_real_int64 176L); (mk_real_int64 589L); ]); +("ineq119", [6; ], [(mk_real_int64 288L); ]); +("ineq120", [0; 3; 5; 7; ], [(mk_real_int64 19L); (mk_real_int64 882L); (mk_real_int64 313L); (mk_real_int64 164L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 2550L); (mk_real_int64 2550L); (mk_real_int64 2550L); (mk_real_int64 2550L); (mk_real_int64 2550L); (mk_real_int64 2725L); (mk_real_int64 2575L); (mk_real_int64 2550L); (mk_real_int64 2550L); (mk_real_int64 2125L); (mk_real_int64 2550L); (mk_real_int64 2525L); (mk_real_int64 2125L); (mk_real_int64 2525L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_lo", [13; 15; 19; 27; 29; 37; 40; 47; 49; 51; 56; 61; ], [(mk_real_int64 224L); (mk_real_int64 224L); (mk_real_int64 772L); (mk_real_int64 464L); (mk_real_int64 118L); (mk_real_int64 294L); (mk_real_int64 2L); (mk_real_int64 212L); (mk_real_int64 480L); (mk_real_int64 138L); (mk_real_int64 788L); (mk_real_int64 286L); ]); +("azim_hi", [1; 4; 6; 9; 17; 20; 23; 24; 26; 28; 33; 36; 46; 54; 58; 59; ], [(mk_real_int64 505000L); (mk_real_int64 173000L); (mk_real_int64 402L); (mk_real_int64 556L); (mk_real_int64 284L); (mk_real_int64 524L); (mk_real_int64 222L); (mk_real_int64 70L); (mk_real_int64 254L); (mk_real_int64 312L); (mk_real_int64 226L); (mk_real_int64 226L); (mk_real_int64 956L); (mk_real_int64 574L); (mk_real_int64 704L); (mk_real_int64 176L); ]); +("rhazim_hi", [1; 19; 28; 56; 59; 61; ], [(mk_real_int64 172000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_lo", [16; 17; 29; 30; 50; 54; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 12; ], [(mk_real_int64 2568L); (mk_real_int64 2568L); (mk_real_int64 2568L); (mk_real_int64 2568L); (mk_real_int64 2568L); (mk_real_int64 2720L); (mk_real_int64 2244L); (mk_real_int64 2568L); (mk_real_int64 2568L); (mk_real_int64 2260L); (mk_real_int64 2568L); (mk_real_int64 2260L); ]); +("rho_lo", [11; 13; ], [(mk_real_int64 2428L); (mk_real_int64 2428L); ]); +("tau_hi", [4; 8; 15; 16; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("tau_lo", [3; 6; 11; 14; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("y1_lo", [0; 10; 15; 17; 20; 21; 29; 32; 34; 39; 51; 54; 55; 56; 58; 59; 61; ], [(mk_real_int64 410L); (mk_real_int64 360L); (mk_real_int64 123L); (mk_real_int64 200L); (mk_real_int64 600L); (mk_real_int64 340L); (mk_real_int64 145L); (mk_real_int64 400L); (mk_real_int64 500L); (mk_real_int64 500L); (mk_real_int64 200L); (mk_real_int64 400L); (mk_real_int64 500L); (mk_real_int64 545L); (mk_real_int64 400L); (mk_real_int64 350L); (mk_real_int64 160L); ]); +("y1_hi", [12; 14; 16; 18; 19; 23; 28; 30; 31; 36; 37; 38; 42; 43; 44; 45; 46; 48; 49; 50; 52; ], [(mk_real_int64 500L); (mk_real_int64 180L); (mk_real_int64 200L); (mk_real_int64 200L); (mk_real_int64 600L); (mk_real_int64 640L); (mk_real_int64 50L); (mk_real_int64 140L); (mk_real_int64 400L); (mk_real_int64 340L); (mk_real_int64 196L); (mk_real_int64 116L); (mk_real_int64 30L); (mk_real_int64 260L); (mk_real_int64 380L); (mk_real_int64 500L); (mk_real_int64 370L); (mk_real_int64 260L); (mk_real_int64 130L); (mk_real_int64 40L); (mk_real_int64 300L); ]); +("y2_lo", [0; 10; 12; 15; 17; 18; 19; 21; 22; 24; 28; 29; 34; 37; 42; 43; 45; 56; 59; 61; ], [(mk_real_int64 372L); (mk_real_int64 360L); (mk_real_int64 296L); (mk_real_int64 123L); (mk_real_int64 492L); (mk_real_int64 80L); (mk_real_int64 164L); (mk_real_int64 340L); (mk_real_int64 40L); (mk_real_int64 420L); (mk_real_int64 340L); (mk_real_int64 220L); (mk_real_int64 500L); (mk_real_int64 364L); (mk_real_int64 440L); (mk_real_int64 320L); (mk_real_int64 368L); (mk_real_int64 124L); (mk_real_int64 4L); (mk_real_int64 60L); ]); +("y2_hi", [14; 16; 20; 23; 30; 31; 32; 36; 38; 39; 41; 44; 46; 48; 49; 50; 51; 52; 54; 55; 57; 58; ], [(mk_real_int64 180L); (mk_real_int64 152L); (mk_real_int64 24L); (mk_real_int64 640L); (mk_real_int64 116L); (mk_real_int64 400L); (mk_real_int64 276L); (mk_real_int64 340L); (mk_real_int64 116L); (mk_real_int64 248L); (mk_real_int64 240L); (mk_real_int64 380L); (mk_real_int64 570L); (mk_real_int64 188L); (mk_real_int64 88L); (mk_real_int64 404L); (mk_real_int64 508L); (mk_real_int64 300L); (mk_real_int64 96L); (mk_real_int64 40L); (mk_real_int64 240L); (mk_real_int64 176L); ]); +("y3_lo", [0; 10; 12; 15; 17; 18; 19; 21; 22; 24; 28; 29; 34; 37; 42; 43; 45; 56; 59; 61; ], [(mk_real_int64 372L); (mk_real_int64 360L); (mk_real_int64 296L); (mk_real_int64 123L); (mk_real_int64 492L); (mk_real_int64 80L); (mk_real_int64 164L); (mk_real_int64 340L); (mk_real_int64 40L); (mk_real_int64 420L); (mk_real_int64 340L); (mk_real_int64 220L); (mk_real_int64 500L); (mk_real_int64 364L); (mk_real_int64 440L); (mk_real_int64 320L); (mk_real_int64 368L); (mk_real_int64 124L); (mk_real_int64 4L); (mk_real_int64 60L); ]); +("y3_hi", [14; 16; 20; 23; 30; 31; 32; 36; 38; 39; 41; 44; 46; 48; 49; 50; 51; 52; 54; 55; 57; 58; ], [(mk_real_int64 180L); (mk_real_int64 152L); (mk_real_int64 24L); (mk_real_int64 640L); (mk_real_int64 116L); (mk_real_int64 400L); (mk_real_int64 276L); (mk_real_int64 340L); (mk_real_int64 116L); (mk_real_int64 248L); (mk_real_int64 240L); (mk_real_int64 380L); (mk_real_int64 570L); (mk_real_int64 188L); (mk_real_int64 88L); (mk_real_int64 404L); (mk_real_int64 508L); (mk_real_int64 300L); (mk_real_int64 96L); (mk_real_int64 40L); (mk_real_int64 240L); (mk_real_int64 176L); ]); +("y4_hi", [5; 7; 8; 9; 11; 12; 13; 15; 16; 17; 23; 24; 28; 29; 33; 34; 35; 36; 40; 41; 42; ], [(mk_real_int64 52L); (mk_real_int64 305L); (mk_real_int64 200L); (mk_real_int64 435L); (mk_real_int64 375L); (mk_real_int64 460L); (mk_real_int64 330L); (mk_real_int64 425L); (mk_real_int64 451L); (mk_real_int64 120L); (mk_real_int64 536L); (mk_real_int64 346L); (mk_real_int64 400L); (mk_real_int64 550L); (mk_real_int64 400L); (mk_real_int64 103L); (mk_real_int64 230L); (mk_real_int64 514L); (mk_real_int64 75L); (mk_real_int64 165L); (mk_real_int64 285L); ]); +("y4_lo", [0; 2; 4; 6; 10; 14; 18; 20; 22; 25; 27; 30; 31; 32; 37; 38; 43; 44; 45; 47; ], [(mk_real_int64 250L); (mk_real_int64 271L); (mk_real_int64 125L); (mk_real_int64 80L); (mk_real_int64 210L); (mk_real_int64 75L); (mk_real_int64 165L); (mk_real_int64 125L); (mk_real_int64 375L); (mk_real_int64 327L); (mk_real_int64 510L); (mk_real_int64 375L); (mk_real_int64 43L); (mk_real_int64 130L); (mk_real_int64 695L); (mk_real_int64 460L); (mk_real_int64 510L); (mk_real_int64 290L); (mk_real_int64 715L); (mk_real_int64 225L); ]); +("y5_lo", [0; 10; 12; 14; 17; 18; 19; 22; 24; 28; 29; 30; 34; 36; 43; 44; 45; 48; 50; 52; 54; 59; 61; ], [(mk_real_int64 372L); (mk_real_int64 250L); (mk_real_int64 296L); (mk_real_int64 125L); (mk_real_int64 492L); (mk_real_int64 80L); (mk_real_int64 164L); (mk_real_int64 40L); (mk_real_int64 420L); (mk_real_int64 340L); (mk_real_int64 220L); (mk_real_int64 149L); (mk_real_int64 125L); (mk_real_int64 375L); (mk_real_int64 320L); (mk_real_int64 375L); (mk_real_int64 368L); (mk_real_int64 447L); (mk_real_int64 511L); (mk_real_int64 460L); (mk_real_int64 239L); (mk_real_int64 4L); (mk_real_int64 60L); ]); +("y5_hi", [15; 16; 20; 21; 23; 31; 32; 37; 38; 39; 41; 42; 46; 47; 49; 51; 55; 56; 57; 58; ], [(mk_real_int64 52L); (mk_real_int64 152L); (mk_real_int64 24L); (mk_real_int64 375L); (mk_real_int64 330L); (mk_real_int64 120L); (mk_real_int64 276L); (mk_real_int64 536L); (mk_real_int64 346L); (mk_real_int64 248L); (mk_real_int64 240L); (mk_real_int64 140L); (mk_real_int64 320L); (mk_real_int64 400L); (mk_real_int64 88L); (mk_real_int64 508L); (mk_real_int64 40L); (mk_real_int64 321L); (mk_real_int64 240L); (mk_real_int64 176L); ]); +("y6_lo", [0; 10; 11; 12; 13; 14; 16; 17; 18; 19; 22; 24; 28; 29; 30; 34; 36; 38; 43; 44; 45; 47; 48; 50; 52; 54; 59; 61; ], [(mk_real_int64 372L); (mk_real_int64 250L); (mk_real_int64 151000L); (mk_real_int64 296L); (mk_real_int64 152000L); (mk_real_int64 125L); (mk_real_int64 177000L); (mk_real_int64 492L); (mk_real_int64 80L); (mk_real_int64 20164L); (mk_real_int64 40L); (mk_real_int64 420L); (mk_real_int64 340L); (mk_real_int64 220L); (mk_real_int64 452149L); (mk_real_int64 125L); (mk_real_int64 375L); (mk_real_int64 6000L); (mk_real_int64 320L); (mk_real_int64 1000L); (mk_real_int64 106368L); (mk_real_int64 18600L); (mk_real_int64 447L); (mk_real_int64 511L); (mk_real_int64 460L); (mk_real_int64 239L); (mk_real_int64 4L); (mk_real_int64 60L); ]); +("y6_hi", [15; 16; 20; 21; 23; 31; 32; 37; 38; 39; 41; 42; 44; 46; 49; 51; 55; 56; 57; 58; ], [(mk_real_int64 52L); (mk_real_int64 152L); (mk_real_int64 24L); (mk_real_int64 375L); (mk_real_int64 330L); (mk_real_int64 120L); (mk_real_int64 276L); (mk_real_int64 536L); (mk_real_int64 346L); (mk_real_int64 248L); (mk_real_int64 240L); (mk_real_int64 140L); (mk_real_int64 625L); (mk_real_int64 320L); (mk_real_int64 88L); (mk_real_int64 508L); (mk_real_int64 40L); (mk_real_int64 321L); (mk_real_int64 240L); (mk_real_int64 176L); ]); +("ye_hi", [10; 13; 17; 42; 50; 52; 60; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_lo", [20; 30; 41; 49; ], [(mk_real_int64 112000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_lo", [1; 4; 6; 7; 8; 10; 13; ], [(mk_real_int64 904L); (mk_real_int64 904L); (mk_real_int64 812L); (mk_real_int64 904L); (mk_real_int64 1904L); (mk_real_int64 1904L); (mk_real_int64 763L); ]); +("yn_hi", [0; 2; 3; 5; 9; 11; 12; ], [(mk_real_int64 96L); (mk_real_int64 96L); (mk_real_int64 96L); (mk_real_int64 545L); (mk_real_int64 89L); (mk_real_int64 237L); (mk_real_int64 1089L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests/206221606034_out.hl b/formal_lp/old/ineqs/tests/206221606034_out.hl new file mode 100644 index 0000000..764516a --- /dev/null +++ b/formal_lp/old/ineqs/tests/206221606034_out.hl @@ -0,0 +1,89 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "206221606034 17 6 0 1 2 3 4 5 4 0 5 6 7 3 6 5 8 3 8 5 4 3 8 4 3 4 6 8 3 9 3 9 3 10 3 10 3 2 3 10 2 11 3 11 2 1 3 11 1 0 3 11 0 12 3 10 11 12 3 9 10 12 3 12 0 7 3 9 12 7 3 7 6 9 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum_neg", [1; 2; 5; 6; 7; 10; ], [(mk_real_int64 277L); (mk_real_int64 236L); (mk_real_int64 440L); (mk_real_int64 181L); (mk_real_int64 101L); (mk_real_int64 94L); ]); +("azim_sum", [3; 12; ], [(mk_real_int64 61L); (mk_real_int64 293L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 988L); (mk_real_int64 945L); (mk_real_int64 988L); (mk_real_int64 988L); (mk_real_int64 988L); (mk_real_int64 845L); (mk_real_int64 775L); (mk_real_int64 974L); (mk_real_int64 988L); (mk_real_int64 830L); (mk_real_int64 988L); (mk_real_int64 988L); (mk_real_int64 988L); ]); +("sol_sum3", [1; 6; 7; 12; ], [(mk_real_int64 211L); (mk_real_int64 124L); (mk_real_int64 79L); (mk_real_int64 29L); ]); +("sol_sum3_neg", [3; 9; 10; ], [(mk_real_int64 135L); (mk_real_int64 122L); (mk_real_int64 96L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 929L); (mk_real_int64 945L); (mk_real_int64 752L); (mk_real_int64 914L); (mk_real_int64 974L); (mk_real_int64 594L); (mk_real_int64 719L); (mk_real_int64 673L); (mk_real_int64 607L); (mk_real_int64 708L); (mk_real_int64 734L); (mk_real_int64 830L); (mk_real_int64 814L); (mk_real_int64 893L); ]); +("tau_sum4_neg", [0; 1; ], [(mk_real_int64 988L); (mk_real_int64 988L); ]); +("tau_sum6_neg", [0; ], [(mk_real_int64 988L); ]); +("ln_def_neg", [0; 1; 2; 3; 4; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 89L); (mk_real_int64 41L); (mk_real_int64 89L); (mk_real_int64 89L); (mk_real_int64 89L); (mk_real_int64 74L); (mk_real_int64 89L); (mk_real_int64 13L); (mk_real_int64 89L); (mk_real_int64 89L); (mk_real_int64 89L); ]); +("ln_def", [5; 6; ], [(mk_real_int64 68L); (mk_real_int64 145L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 6206L); (mk_real_int64 5935L); (mk_real_int64 6206L); (mk_real_int64 6206L); (mk_real_int64 6206L); (mk_real_int64 5308L); (mk_real_int64 4870L); (mk_real_int64 6122L); (mk_real_int64 6206L); (mk_real_int64 5217L); (mk_real_int64 6206L); (mk_real_int64 6206L); (mk_real_int64 6206L); ]); +("edge_sym", [2; 3; 15; 24; 31; 37; 39; 40; 43; 46; 52; ], [(mk_real_int64 24L); (mk_real_int64 24L); (mk_real_int64 24L); (mk_real_int64 131L); (mk_real_int64 44L); (mk_real_int64 155L); (mk_real_int64 91L); (mk_real_int64 79L); (mk_real_int64 174L); (mk_real_int64 15L); (mk_real_int64 99L); ]); +("edge_sym_neg", [7; 11; 25; 28; 30; 49; ], [(mk_real_int64 3L); (mk_real_int64 61L); (mk_real_int64 32L); (mk_real_int64 117L); (mk_real_int64 176L); (mk_real_int64 181L); ]); +("y1_def_neg", [3; 10; 11; 13; 14; 15; 17; 28; 29; 30; 33; 37; 40; 41; 44; 45; 48; 49; 50; 52; 54; 55; ], [(mk_real_int64 19L); (mk_real_int64 35L); (mk_real_int64 30L); (mk_real_int64 32L); (mk_real_int64 19L); (mk_real_int64 68L); (mk_real_int64 16L); (mk_real_int64 162L); (mk_real_int64 182L); (mk_real_int64 42L); (mk_real_int64 35L); (mk_real_int64 12L); (mk_real_int64 134L); (mk_real_int64 26L); (mk_real_int64 156L); (mk_real_int64 10L); (mk_real_int64 89L); (mk_real_int64 185L); (mk_real_int64 123L); (mk_real_int64 69L); (mk_real_int64 57L); (mk_real_int64 49L); ]); +("y1_def", [12; 23; 25; 26; 34; 36; 38; 42; 43; 46; ], [(mk_real_int64 2L); (mk_real_int64 51L); (mk_real_int64 17L); (mk_real_int64 50L); (mk_real_int64 95L); (mk_real_int64 84L); (mk_real_int64 7L); (mk_real_int64 118L); (mk_real_int64 46L); (mk_real_int64 36L); ]); +("y2_def", [3; 10; 14; 23; 29; 30; 40; 41; 43; 44; 45; 46; 48; 50; 52; 54; ], [(mk_real_int64 24L); (mk_real_int64 21L); (mk_real_int64 12L); (mk_real_int64 51L); (mk_real_int64 88L); (mk_real_int64 25L); (mk_real_int64 81L); (mk_real_int64 16L); (mk_real_int64 46L); (mk_real_int64 33L); (mk_real_int64 6L); (mk_real_int64 36L); (mk_real_int64 54L); (mk_real_int64 44L); (mk_real_int64 35L); (mk_real_int64 34L); ]); +("y2_def_neg", [11; 12; 13; 15; 17; 25; 26; 28; 33; 34; 36; 37; 38; 42; 49; 55; ], [(mk_real_int64 30L); (mk_real_int64 1L); (mk_real_int64 32L); (mk_real_int64 111L); (mk_real_int64 33L); (mk_real_int64 5L); (mk_real_int64 15L); (mk_real_int64 149L); (mk_real_int64 35L); (mk_real_int64 29L); (mk_real_int64 25L); (mk_real_int64 12L); (mk_real_int64 2L); (mk_real_int64 36L); (mk_real_int64 124L); (mk_real_int64 49L); ]); +("y3_def", [3; 10; 14; 23; 29; 30; 40; 41; 43; 44; 45; 46; 48; 50; 52; 54; ], [(mk_real_int64 24L); (mk_real_int64 21L); (mk_real_int64 12L); (mk_real_int64 51L); (mk_real_int64 88L); (mk_real_int64 25L); (mk_real_int64 81L); (mk_real_int64 16L); (mk_real_int64 46L); (mk_real_int64 33L); (mk_real_int64 6L); (mk_real_int64 36L); (mk_real_int64 54L); (mk_real_int64 44L); (mk_real_int64 35L); (mk_real_int64 34L); ]); +("y3_def_neg", [11; 12; 13; 15; 17; 25; 26; 28; 33; 34; 36; 37; 38; 42; 49; 55; ], [(mk_real_int64 30L); (mk_real_int64 1L); (mk_real_int64 32L); (mk_real_int64 111L); (mk_real_int64 33L); (mk_real_int64 5L); (mk_real_int64 15L); (mk_real_int64 149L); (mk_real_int64 35L); (mk_real_int64 29L); (mk_real_int64 25L); (mk_real_int64 12L); (mk_real_int64 2L); (mk_real_int64 36L); (mk_real_int64 124L); (mk_real_int64 49L); ]); +("y4_def_neg", [0; 1; 4; 5; 9; 14; 15; 16; 26; 27; 29; 30; 31; 32; 34; 35; 36; 38; 40; 41; ], [(mk_real_int64 40L); (mk_real_int64 21L); (mk_real_int64 22L); (mk_real_int64 19L); (mk_real_int64 26L); (mk_real_int64 116L); (mk_real_int64 201L); (mk_real_int64 48L); (mk_real_int64 153L); (mk_real_int64 30L); (mk_real_int64 24L); (mk_real_int64 161L); (mk_real_int64 11L); (mk_real_int64 19L); (mk_real_int64 102L); (mk_real_int64 145L); (mk_real_int64 132L); (mk_real_int64 65L); (mk_real_int64 65L); (mk_real_int64 34L); ]); +("y4_def", [2; 3; 11; 12; 19; 20; 22; 23; 24; 28; ], [(mk_real_int64 3L); (mk_real_int64 68L); (mk_real_int64 26L); (mk_real_int64 78L); (mk_real_int64 29L); (mk_real_int64 147L); (mk_real_int64 129L); (mk_real_int64 25L); (mk_real_int64 10L); (mk_real_int64 182L); ]); +("y5_def", [3; 10; 13; 14; 29; 30; 33; 37; 40; 41; 44; 45; 48; 50; 52; 54; ], [(mk_real_int64 24L); (mk_real_int64 21L); (mk_real_int64 68L); (mk_real_int64 12L); (mk_real_int64 92L); (mk_real_int64 25L); (mk_real_int64 29L); (mk_real_int64 25L); (mk_real_int64 81L); (mk_real_int64 16L); (mk_real_int64 45L); (mk_real_int64 6L); (mk_real_int64 54L); (mk_real_int64 50L); (mk_real_int64 49L); (mk_real_int64 34L); ]); +("y5_def_neg", [11; 12; 15; 17; 23; 25; 26; 28; 34; 36; 38; 42; 43; 46; 49; 55; ], [(mk_real_int64 21L); (mk_real_int64 1L); (mk_real_int64 80L); (mk_real_int64 24L); (mk_real_int64 26L); (mk_real_int64 5L); (mk_real_int64 15L); (mk_real_int64 102L); (mk_real_int64 29L); (mk_real_int64 25L); (mk_real_int64 2L); (mk_real_int64 36L); (mk_real_int64 24L); (mk_real_int64 19L); (mk_real_int64 79L); (mk_real_int64 34L); ]); +("y6_def", [3; 10; 13; 14; 29; 30; 33; 37; 40; 41; 44; 45; 48; 50; 51; 52; 54; ], [(mk_real_int64 24L); (mk_real_int64 21L); (mk_real_int64 68L); (mk_real_int64 12L); (mk_real_int64 92L); (mk_real_int64 25L); (mk_real_int64 29L); (mk_real_int64 25L); (mk_real_int64 81L); (mk_real_int64 16L); (mk_real_int64 45L); (mk_real_int64 6L); (mk_real_int64 79L); (mk_real_int64 50L); (mk_real_int64 264L); (mk_real_int64 49L); (mk_real_int64 34L); ]); +("y6_def_neg", [11; 12; 15; 17; 23; 25; 26; 28; 34; 36; 38; 42; 43; 46; 49; 55; ], [(mk_real_int64 21L); (mk_real_int64 1L); (mk_real_int64 80L); (mk_real_int64 24L); (mk_real_int64 26L); (mk_real_int64 5L); (mk_real_int64 15L); (mk_real_int64 102L); (mk_real_int64 29L); (mk_real_int64 25L); (mk_real_int64 2L); (mk_real_int64 25L); (mk_real_int64 24L); (mk_real_int64 19L); (mk_real_int64 79L); (mk_real_int64 34L); ]); +("RHA", [11; 12; 13; 14; 16; 17; 18; 23; 24; 25; 27; 29; 30; 31; 32; 33; 34; 35; 36; 37; 38; 39; 41; 42; 43; 44; 45; 46; 48; 49; 51; 52; 53; 55; ], [(mk_real_int64 58L); (mk_real_int64 58L); (mk_real_int64 43L); (mk_real_int64 11L); (mk_real_int64 236L); (mk_real_int64 192L); (mk_real_int64 236L); (mk_real_int64 74L); (mk_real_int64 74L); (mk_real_int64 60L); (mk_real_int64 13L); (mk_real_int64 101L); (mk_real_int64 323L); (mk_real_int64 181L); (mk_real_int64 56L); (mk_real_int64 269L); (mk_real_int64 126L); (mk_real_int64 102L); (mk_real_int64 172L); (mk_real_int64 315L); (mk_real_int64 168L); (mk_real_int64 380L); (mk_real_int64 223L); (mk_real_int64 67L); (mk_real_int64 122L); (mk_real_int64 57L); (mk_real_int64 224L); (mk_real_int64 96L); (mk_real_int64 9L); (mk_real_int64 94L); (mk_real_int64 16L); (mk_real_int64 65L); (mk_real_int64 94L); (mk_real_int64 94L); ]); +("yy10", [7; ], [(mk_real_int64 3L); ]); +("tau4", [0; ], [(mk_real_int64 780L); ]); +("tau6", [0; ], [(mk_real_int64 988L); ]); +("ineq105", [3; ], [(mk_real_int64 61L); ]); +("ineq106", [0; 4; 14; 15; 16; 26; 27; 30; 31; 34; 35; 36; 38; 40; ], [(mk_real_int64 58L); (mk_real_int64 32L); (mk_real_int64 13L); (mk_real_int64 279L); (mk_real_int64 70L); (mk_real_int64 223L); (mk_real_int64 43L); (mk_real_int64 196L); (mk_real_int64 16L); (mk_real_int64 148L); (mk_real_int64 63L); (mk_real_int64 173L); (mk_real_int64 108L); (mk_real_int64 94L); ]); +("ineq107", [2; 5; 7; 11; 12; 20; 22; 24; 28; ], [(mk_real_int64 4L); (mk_real_int64 66L); (mk_real_int64 26L); (mk_real_int64 34L); (mk_real_int64 101L); (mk_real_int64 190L); (mk_real_int64 167L); (mk_real_int64 13L); (mk_real_int64 236L); ]); +("ineq109", [3; 19; 23; 38; ], [(mk_real_int64 211L); (mk_real_int64 124L); (mk_real_int64 79L); (mk_real_int64 29L); ]); +("ineq110", [9; 29; 32; ], [(mk_real_int64 135L); (mk_real_int64 122L); (mk_real_int64 96L); ]); +("ineq111", [1; 5; 7; 14; 15; 19; 30; 35; 36; 41; ], [(mk_real_int64 165L); (mk_real_int64 560L); (mk_real_int64 163L); (mk_real_int64 856L); (mk_real_int64 78L); (mk_real_int64 90L); (mk_real_int64 215L); (mk_real_int64 816L); (mk_real_int64 105L); (mk_real_int64 274L); ]); +("ineq112", [7; 22; ], [(mk_real_int64 115L); (mk_real_int64 45L); ]); +("ineq113", [2; 11; ], [(mk_real_int64 671L); (mk_real_int64 543L); ]); +("ineq114", [1; 3; 4; 8; 9; 13; 16; 19; 23; 25; 30; 31; 34; 36; 37; 41; ], [(mk_real_int64 93L); (mk_real_int64 30L); (mk_real_int64 355L); (mk_real_int64 474L); (mk_real_int64 371L); (mk_real_int64 118L); (mk_real_int64 516L); (mk_real_int64 628L); (mk_real_int64 628L); (mk_real_int64 607L); (mk_real_int64 406L); (mk_real_int64 44L); (mk_real_int64 14L); (mk_real_int64 515L); (mk_real_int64 72L); (mk_real_int64 619L); ]); +("ineq119", [3; 5; ], [(mk_real_int64 208L); (mk_real_int64 520L); ]); +("ineq120", [6; 7; ], [(mk_real_int64 80L); (mk_real_int64 387L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 2950L); (mk_real_int64 2375L); (mk_real_int64 2950L); (mk_real_int64 2950L); (mk_real_int64 2950L); (mk_real_int64 3100L); (mk_real_int64 2750L); (mk_real_int64 2650L); (mk_real_int64 2950L); (mk_real_int64 100025L); (mk_real_int64 2950L); (mk_real_int64 2950L); (mk_real_int64 2950L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_lo", [9; 18; 21; 27; 36; 37; 39; 48; ], [(mk_real_int64 224L); (mk_real_int64 276L); (mk_real_int64 360L); (mk_real_int64 132L); (mk_real_int64 815L); (mk_real_int64 872L); (mk_real_int64 18L); (mk_real_int64 236L); ]); +("azim_hi", [1; 4; 11; 12; 13; 14; 17; 20; 22; 23; 25; 30; 32; 33; 44; 45; 50; 51; 55; ], [(mk_real_int64 440000L); (mk_real_int64 277000L); (mk_real_int64 218L); (mk_real_int64 211L); (mk_real_int64 780L); (mk_real_int64 230L); (mk_real_int64 695L); (mk_real_int64 440L); (mk_real_int64 346L); (mk_real_int64 246L); (mk_real_int64 1363L); (mk_real_int64 16L); (mk_real_int64 1000L); (mk_real_int64 128L); (mk_real_int64 156L); (mk_real_int64 544L); (mk_real_int64 390L); (mk_real_int64 72L); (mk_real_int64 494L); ]); +("rhazim_lo", [10; 11; 12; 17; 27; 28; 30; 39; 44; 48; 49; 50; 52; 53; 54; 55; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_hi", [1; 4; ], [(mk_real_int64 143000L); (mk_real_int64 43000L); ]); +("rho_hi", [0; 1; 2; 3; 4; 5; 6; 8; 10; 11; 12; ], [(mk_real_int64 2592L); (mk_real_int64 3380L); (mk_real_int64 2592L); (mk_real_int64 2592L); (mk_real_int64 2592L); (mk_real_int64 1980L); (mk_real_int64 100L); (mk_real_int64 2592L); (mk_real_int64 2592L); (mk_real_int64 2592L); (mk_real_int64 2592L); ]); +("rho_lo", [7; 9; ], [(mk_real_int64 1384L); (mk_real_int64 1280L); ]); +("tau_lo", [5; 9; 12; 13; 15; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 708000L); (mk_real_int64 69000L); (mk_real_int64 122000L); ]); +("y1_hi", [10; 11; 13; 15; 23; 26; 28; 29; 33; 37; 40; 41; 43; 45; 46; 48; 49; 50; 54; ], [(mk_real_int64 200L); (mk_real_int64 300L); (mk_real_int64 139L); (mk_real_int64 200L); (mk_real_int64 300L); (mk_real_int64 500L); (mk_real_int64 120L); (mk_real_int64 560L); (mk_real_int64 76L); (mk_real_int64 71L); (mk_real_int64 200L); (mk_real_int64 200L); (mk_real_int64 360L); (mk_real_int64 400L); (mk_real_int64 480L); (mk_real_int64 200L); (mk_real_int64 320L); (mk_real_int64 300L); (mk_real_int64 600L); ]); +("y1_lo", [3; 14; 17; 36; 38; 44; 52; 55; ], [(mk_real_int64 215L); (mk_real_int64 200L); (mk_real_int64 340L); (mk_real_int64 500L); (mk_real_int64 500L); (mk_real_int64 300L); (mk_real_int64 179L); (mk_real_int64 320L); ]); +("y2_hi", [3; 10; 11; 12; 13; 15; 23; 30; 33; 34; 37; 38; 40; 42; 43; 46; 49; 50; 54; ], [(mk_real_int64 522L); (mk_real_int64 112L); (mk_real_int64 300L); (mk_real_int64 392L); (mk_real_int64 139L); (mk_real_int64 168L); (mk_real_int64 300L); (mk_real_int64 480L); (mk_real_int64 76L); (mk_real_int64 120L); (mk_real_int64 71L); (mk_real_int64 24L); (mk_real_int64 172L); (mk_real_int64 128L); (mk_real_int64 360L); (mk_real_int64 480L); (mk_real_int64 52L); (mk_real_int64 72L); (mk_real_int64 216L); ]); +("y2_lo", [14; 17; 25; 26; 28; 29; 36; 41; 44; 45; 48; 52; 55; ], [(mk_real_int64 352L); (mk_real_int64 292L); (mk_real_int64 168L); (mk_real_int64 352L); (mk_real_int64 348L); (mk_real_int64 484L); (mk_real_int64 384L); (mk_real_int64 348L); (mk_real_int64 356L); (mk_real_int64 176L); (mk_real_int64 128L); (mk_real_int64 67L); (mk_real_int64 320L); ]); +("y3_hi", [3; 10; 11; 12; 13; 15; 23; 30; 33; 34; 37; 38; 40; 42; 43; 46; 49; 50; 54; ], [(mk_real_int64 522L); (mk_real_int64 112L); (mk_real_int64 300L); (mk_real_int64 392L); (mk_real_int64 139L); (mk_real_int64 168L); (mk_real_int64 300L); (mk_real_int64 480L); (mk_real_int64 76L); (mk_real_int64 120L); (mk_real_int64 71L); (mk_real_int64 24L); (mk_real_int64 172L); (mk_real_int64 128L); (mk_real_int64 360L); (mk_real_int64 480L); (mk_real_int64 52L); (mk_real_int64 72L); (mk_real_int64 216L); ]); +("y3_lo", [14; 17; 25; 26; 28; 29; 36; 41; 44; 45; 48; 52; 55; ], [(mk_real_int64 352L); (mk_real_int64 292L); (mk_real_int64 168L); (mk_real_int64 352L); (mk_real_int64 348L); (mk_real_int64 484L); (mk_real_int64 384L); (mk_real_int64 348L); (mk_real_int64 356L); (mk_real_int64 176L); (mk_real_int64 128L); (mk_real_int64 67L); (mk_real_int64 320L); ]); +("y4_hi", [0; 1; 2; 3; 4; 5; 11; 12; 14; 15; 16; 22; 23; 24; 26; 27; 28; 29; 31; 32; 34; 36; 38; 40; ], [(mk_real_int64 270L); (mk_real_int64 375L); (mk_real_int64 92L); (mk_real_int64 364L); (mk_real_int64 80L); (mk_real_int64 18L); (mk_real_int64 282L); (mk_real_int64 73L); (mk_real_int64 95L); (mk_real_int64 135L); (mk_real_int64 50L); (mk_real_int64 91L); (mk_real_int64 596L); (mk_real_int64 49L); (mk_real_int64 245L); (mk_real_int64 545L); (mk_real_int64 428L); (mk_real_int64 88L); (mk_real_int64 40L); (mk_real_int64 184L); (mk_real_int64 620L); (mk_real_int64 370L); (mk_real_int64 416L); (mk_real_int64 610L); ]); +("y4_lo", [7; 9; 19; 20; 30; 35; 41; ], [(mk_real_int64 277L); (mk_real_int64 460L); (mk_real_int64 74L); (mk_real_int64 130L); (mk_real_int64 135L); (mk_real_int64 155L); (mk_real_int64 250L); ]); +("y5_hi", [3; 10; 11; 12; 13; 30; 34; 37; 38; 40; 42; 43; 46; 54; ], [(mk_real_int64 522L); (mk_real_int64 112L); (mk_real_int64 375L); (mk_real_int64 392L); (mk_real_int64 364L); (mk_real_int64 480L); (mk_real_int64 120L); (mk_real_int64 596L); (mk_real_int64 24L); (mk_real_int64 172L); (mk_real_int64 128L); (mk_real_int64 88L); (mk_real_int64 184L); (mk_real_int64 216L); ]); +("y5_lo", [14; 15; 17; 23; 25; 26; 28; 29; 33; 36; 41; 44; 45; 48; 49; 50; 52; 55; ], [(mk_real_int64 352L); (mk_real_int64 32L); (mk_real_int64 327L); (mk_real_int64 460L); (mk_real_int64 168L); (mk_real_int64 352L); (mk_real_int64 268L); (mk_real_int64 194L); (mk_real_int64 74L); (mk_real_int64 384L); (mk_real_int64 348L); (mk_real_int64 531L); (mk_real_int64 176L); (mk_real_int64 128L); (mk_real_int64 68L); (mk_real_int64 153L); (mk_real_int64 292L); (mk_real_int64 250L); ]); +("y6_hi", [3; 10; 11; 12; 13; 30; 34; 37; 38; 40; 43; 46; 54; ], [(mk_real_int64 522L); (mk_real_int64 112L); (mk_real_int64 375L); (mk_real_int64 392L); (mk_real_int64 364L); (mk_real_int64 480L); (mk_real_int64 120L); (mk_real_int64 596L); (mk_real_int64 24L); (mk_real_int64 172L); (mk_real_int64 88L); (mk_real_int64 184L); (mk_real_int64 216L); ]); +("y6_lo", [14; 15; 17; 23; 25; 26; 28; 29; 33; 36; 41; 42; 44; 45; 48; 49; 50; 51; 52; 55; ], [(mk_real_int64 352L); (mk_real_int64 32L); (mk_real_int64 327L); (mk_real_int64 460L); (mk_real_int64 168L); (mk_real_int64 352L); (mk_real_int64 268L); (mk_real_int64 194L); (mk_real_int64 74L); (mk_real_int64 384L); (mk_real_int64 348L); (mk_real_int64 10872L); (mk_real_int64 531L); (mk_real_int64 176L); (mk_real_int64 25128L); (mk_real_int64 68L); (mk_real_int64 153L); (mk_real_int64 264000L); (mk_real_int64 292L); (mk_real_int64 250L); ]); +("ye_lo", [11; 12; 15; 24; 37; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 58000L); (mk_real_int64 163000L); (mk_real_int64 1000L); ]); +("ye_hi", [24; 25; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_hi", [2; 3; 4; 5; 6; 8; 10; 12; ], [(mk_real_int64 236L); (mk_real_int64 1236L); (mk_real_int64 236L); (mk_real_int64 1236L); (mk_real_int64 1165L); (mk_real_int64 236L); (mk_real_int64 236L); (mk_real_int64 236L); ]); +("yn_lo", [0; 1; 7; 9; 11; ], [(mk_real_int64 764L); (mk_real_int64 1116L); (mk_real_int64 2624L); (mk_real_int64 988L); (mk_real_int64 764L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests/209986500083_out.hl b/formal_lp/old/ineqs/tests/209986500083_out.hl new file mode 100644 index 0000000..1321219 --- /dev/null +++ b/formal_lp/old/ineqs/tests/209986500083_out.hl @@ -0,0 +1,90 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "209986500083 17 6 0 1 2 3 4 5 5 0 5 6 7 8 3 6 5 4 3 6 4 9 3 9 4 10 3 10 4 3 3 10 3 11 3 11 3 12 3 12 3 2 3 12 2 1 3 12 1 0 3 11 12 0 3 11 0 8 3 10 11 8 3 9 10 8 3 9 8 7 3 7 6 9 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum_neg", [3; 4; 5; 10; 11; ], [(mk_real_int64 1122L); (mk_real_int64 1122L); (mk_real_int64 201L); (mk_real_int64 423L); (mk_real_int64 17L); ]); +("azim_sum", [1; 7; 8; 9; ], [(mk_real_int64 68L); (mk_real_int64 188L); (mk_real_int64 234L); (mk_real_int64 171L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 952L); (mk_real_int64 993L); (mk_real_int64 952L); (mk_real_int64 623L); (mk_real_int64 623L); (mk_real_int64 623L); (mk_real_int64 952L); (mk_real_int64 927L); (mk_real_int64 927L); (mk_real_int64 952L); (mk_real_int64 711L); (mk_real_int64 970L); (mk_real_int64 711L); ]); +("sol_sum3_neg", [2; 3; 4; 9; 10; 11; 12; ], [(mk_real_int64 350L); (mk_real_int64 307L); (mk_real_int64 180L); (mk_real_int64 909L); (mk_real_int64 171L); (mk_real_int64 196L); (mk_real_int64 188L); ]); +("sol_sum3", [7; 14; ], [(mk_real_int64 1122L); (mk_real_int64 102L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 952L); (mk_real_int64 711L); (mk_real_int64 711L); (mk_real_int64 754L); (mk_real_int64 772L); (mk_real_int64 586L); (mk_real_int64 423L); (mk_real_int64 623L); (mk_real_int64 423L); (mk_real_int64 27L); (mk_real_int64 782L); (mk_real_int64 927L); (mk_real_int64 575L); (mk_real_int64 711L); (mk_real_int64 711L); ]); +("tau_sum5_neg", [0; ], [(mk_real_int64 952L); ]); +("tau_sum6_neg", [0; ], [(mk_real_int64 952L); ]); +("ln_def_neg", [0; 1; 2; 6; 7; 8; 9; 11; ], [(mk_real_int64 50L); (mk_real_int64 95L); (mk_real_int64 50L); (mk_real_int64 50L); (mk_real_int64 22L); (mk_real_int64 35L); (mk_real_int64 50L); (mk_real_int64 69L); ]); +("ln_def", [3; 4; 5; 10; 12; ], [(mk_real_int64 313L); (mk_real_int64 313L); (mk_real_int64 313L); (mk_real_int64 216L); (mk_real_int64 216L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 5985L); (mk_real_int64 6239L); (mk_real_int64 5985L); (mk_real_int64 3917L); (mk_real_int64 3917L); (mk_real_int64 3917L); (mk_real_int64 5985L); (mk_real_int64 5825L); (mk_real_int64 5825L); (mk_real_int64 5985L); (mk_real_int64 4470L); (mk_real_int64 6093L); (mk_real_int64 4470L); ]); +("edge_sym", [3; 4; 9; 10; 15; 18; 25; 28; 34; 37; 40; ], [(mk_real_int64 44L); (mk_real_int64 44L); (mk_real_int64 69L); (mk_real_int64 69L); (mk_real_int64 100L); (mk_real_int64 91L); (mk_real_int64 44L); (mk_real_int64 191L); (mk_real_int64 556L); (mk_real_int64 852L); (mk_real_int64 210L); ]); +("edge_sym_neg", [13; 16; 19; 22; 24; 27; 31; 43; 46; 49; 52; ], [(mk_real_int64 89L); (mk_real_int64 281L); (mk_real_int64 100L); (mk_real_int64 44L); (mk_real_int64 319L); (mk_real_int64 388L); (mk_real_int64 556L); (mk_real_int64 30L); (mk_real_int64 148L); (mk_real_int64 317L); (mk_real_int64 69L); ]); +("y1_def_neg", [4; 10; 11; 15; 16; 22; 23; 25; 26; 30; 32; 34; 37; 38; 41; 43; 45; 48; 50; ], [(mk_real_int64 34L); (mk_real_int64 54L); (mk_real_int64 140L); (mk_real_int64 186L); (mk_real_int64 57L); (mk_real_int64 27L); (mk_real_int64 56L); (mk_real_int64 37L); (mk_real_int64 249L); (mk_real_int64 394L); (mk_real_int64 125L); (mk_real_int64 169L); (mk_real_int64 394L); (mk_real_int64 108L); (mk_real_int64 22L); (mk_real_int64 207L); (mk_real_int64 65L); (mk_real_int64 150L); (mk_real_int64 8L); ]); +("y1_def", [17; 19; 20; 28; 31; 36; 39; 42; 47; 52; 53; ], [(mk_real_int64 103L); (mk_real_int64 133L); (mk_real_int64 117L); (mk_real_int64 82L); (mk_real_int64 461L); (mk_real_int64 461L); (mk_real_int64 602L); (mk_real_int64 65L); (mk_real_int64 26L); (mk_real_int64 209L); (mk_real_int64 145L); ]); +("y2_def", [4; 10; 15; 19; 20; 22; 23; 26; 30; 32; 37; 38; 39; 41; 42; 48; ], [(mk_real_int64 44L); (mk_real_int64 69L); (mk_real_int64 128L); (mk_real_int64 133L); (mk_real_int64 117L); (mk_real_int64 16L); (mk_real_int64 173L); (mk_real_int64 193L); (mk_real_int64 117L); (mk_real_int64 193L); (mk_real_int64 117L); (mk_real_int64 66L); (mk_real_int64 267L); (mk_real_int64 13L); (mk_real_int64 65L); (mk_real_int64 216L); ]); +("y2_def_neg", [11; 16; 17; 25; 28; 31; 34; 36; 43; 45; 47; 50; 52; 53; ], [(mk_real_int64 140L); (mk_real_int64 57L); (mk_real_int64 31L); (mk_real_int64 37L); (mk_real_int64 25L); (mk_real_int64 140L); (mk_real_int64 169L); (mk_real_int64 140L); (mk_real_int64 42L); (mk_real_int64 51L); (mk_real_int64 8L); (mk_real_int64 8L); (mk_real_int64 63L); (mk_real_int64 64L); ]); +("y3_def", [4; 10; 15; 19; 20; 22; 23; 26; 30; 32; 37; 38; 39; 41; 42; 48; ], [(mk_real_int64 44L); (mk_real_int64 69L); (mk_real_int64 128L); (mk_real_int64 133L); (mk_real_int64 117L); (mk_real_int64 16L); (mk_real_int64 173L); (mk_real_int64 193L); (mk_real_int64 117L); (mk_real_int64 193L); (mk_real_int64 117L); (mk_real_int64 66L); (mk_real_int64 267L); (mk_real_int64 13L); (mk_real_int64 65L); (mk_real_int64 216L); ]); +("y3_def_neg", [11; 16; 17; 25; 28; 31; 34; 36; 43; 45; 47; 50; 52; 53; ], [(mk_real_int64 140L); (mk_real_int64 57L); (mk_real_int64 31L); (mk_real_int64 37L); (mk_real_int64 25L); (mk_real_int64 140L); (mk_real_int64 169L); (mk_real_int64 140L); (mk_real_int64 42L); (mk_real_int64 51L); (mk_real_int64 8L); (mk_real_int64 8L); (mk_real_int64 63L); (mk_real_int64 64L); ]); +("y4_def_neg", [0; 4; 5; 8; 9; 11; 12; 14; 15; 19; 21; 26; 27; 30; 31; 32; 34; 37; 39; ], [(mk_real_int64 97L); (mk_real_int64 241L); (mk_real_int64 40L); (mk_real_int64 69L); (mk_real_int64 60L); (mk_real_int64 31L); (mk_real_int64 232L); (mk_real_int64 26L); (mk_real_int64 363L); (mk_real_int64 416L); (mk_real_int64 364L); (mk_real_int64 416L); (mk_real_int64 123L); (mk_real_int64 25L); (mk_real_int64 33L); (mk_real_int64 189L); (mk_real_int64 148L); (mk_real_int64 309L); (mk_real_int64 5L); ]); +("y4_def", [6; 17; 20; 23; 25; 28; 36; 41; 42; ], [(mk_real_int64 160L); (mk_real_int64 126L); (mk_real_int64 712L); (mk_real_int64 363L); (mk_real_int64 712L); (mk_real_int64 218L); (mk_real_int64 40L); (mk_real_int64 322L); (mk_real_int64 281L); ]); +("y5_def", [4; 10; 15; 22; 23; 26; 30; 32; 34; 37; 38; 41; 48; ], [(mk_real_int64 44L); (mk_real_int64 69L); (mk_real_int64 128L); (mk_real_int64 16L); (mk_real_int64 69L); (mk_real_int64 193L); (mk_real_int64 140L); (mk_real_int64 193L); (mk_real_int64 363L); (mk_real_int64 140L); (mk_real_int64 66L); (mk_real_int64 13L); (mk_real_int64 108L); ]); +("y5_def_neg", [11; 16; 17; 19; 20; 25; 28; 31; 36; 39; 42; 43; 45; 47; 50; 52; 53; ], [(mk_real_int64 97L); (mk_real_int64 40L); (mk_real_int64 31L); (mk_real_int64 69L); (mk_real_int64 60L); (mk_real_int64 26L); (mk_real_int64 25L); (mk_real_int64 140L); (mk_real_int64 140L); (mk_real_int64 256L); (mk_real_int64 33L); (mk_real_int64 10L); (mk_real_int64 123L); (mk_real_int64 8L); (mk_real_int64 5L); (mk_real_int64 63L); (mk_real_int64 16L); ]); +("y6_def", [4; 10; 12; 15; 22; 23; 26; 30; 32; 33; 34; 37; 38; 41; 44; 48; 55; ], [(mk_real_int64 44L); (mk_real_int64 69L); (mk_real_int64 54L); (mk_real_int64 128L); (mk_real_int64 16L); (mk_real_int64 69L); (mk_real_int64 193L); (mk_real_int64 140L); (mk_real_int64 193L); (mk_real_int64 1L); (mk_real_int64 363L); (mk_real_int64 140L); (mk_real_int64 66L); (mk_real_int64 13L); (mk_real_int64 80L); (mk_real_int64 108L); (mk_real_int64 84L); ]); +("y6_def_neg", [16; 17; 19; 20; 25; 28; 31; 36; 39; 42; 43; 45; 47; 50; 52; ], [(mk_real_int64 40L); (mk_real_int64 31L); (mk_real_int64 69L); (mk_real_int64 60L); (mk_real_int64 26L); (mk_real_int64 25L); (mk_real_int64 140L); (mk_real_int64 140L); (mk_real_int64 256L); (mk_real_int64 33L); (mk_real_int64 10L); (mk_real_int64 123L); (mk_real_int64 8L); (mk_real_int64 5L); (mk_real_int64 63L); ]); +("RHA", [4; 8; 11; 13; 14; 18; 19; 20; 21; 22; 24; 25; 27; 28; 29; 31; 35; 36; 38; 39; 40; 41; 42; 46; 47; 49; 51; 54; ], [(mk_real_int64 40L); (mk_real_int64 17L); (mk_real_int64 17L); (mk_real_int64 40L); (mk_real_int64 258L); (mk_real_int64 281L); (mk_real_int64 216L); (mk_real_int64 173L); (mk_real_int64 239L); (mk_real_int64 153L); (mk_real_int64 180L); (mk_real_int64 155L); (mk_real_int64 367L); (mk_real_int64 38L); (mk_real_int64 201L); (mk_real_int64 201L); (mk_real_int64 201L); (mk_real_int64 201L); (mk_real_int64 720L); (mk_real_int64 597L); (mk_real_int64 926L); (mk_real_int64 109L); (mk_real_int64 171L); (mk_real_int64 25L); (mk_real_int64 136L); (mk_real_int64 377L); (mk_real_int64 241L); (mk_real_int64 258L); ]); +("RHB", [1; 2; ], [(mk_real_int64 329L); (mk_real_int64 329L); ]); +("yy10", [24; 29; 39; 40; ], [(mk_real_int64 61L); (mk_real_int64 464L); (mk_real_int64 473L); (mk_real_int64 74L); ]); +("tau5", [0; ], [(mk_real_int64 952L); ]); +("tau6", [0; ], [(mk_real_int64 952L); ]); +("ineq105", [4; 10; ], [(mk_real_int64 109L); (mk_real_int64 171L); ]); +("ineq106", [4; 11; 12; 15; 19; 26; 27; 30; 32; 37; ], [(mk_real_int64 281L); (mk_real_int64 45L); (mk_real_int64 155L); (mk_real_int64 341L); (mk_real_int64 530L); (mk_real_int64 530L); (mk_real_int64 180L); (mk_real_int64 36L); (mk_real_int64 171L); (mk_real_int64 352L); ]); +("ineq107", [6; 17; 20; 25; 28; 36; 41; 42; ], [(mk_real_int64 207L); (mk_real_int64 163L); (mk_real_int64 921L); (mk_real_int64 921L); (mk_real_int64 513L); (mk_real_int64 52L); (mk_real_int64 417L); (mk_real_int64 321L); ]); +("ineq108", [4; 12; 15; 21; 34; 37; ], [(mk_real_int64 71L); (mk_real_int64 133L); (mk_real_int64 188L); (mk_real_int64 531L); (mk_real_int64 23L); (mk_real_int64 46L); ]); +("ineq109", [23; 42; ], [(mk_real_int64 1122L); (mk_real_int64 102L); ]); +("ineq110", [8; 9; 12; 28; 31; 34; 37; ], [(mk_real_int64 350L); (mk_real_int64 307L); (mk_real_int64 180L); (mk_real_int64 909L); (mk_real_int64 171L); (mk_real_int64 196L); (mk_real_int64 188L); ]); +("ineq111", [0; 5; 14; 19; 26; 32; 34; 39; ], [(mk_real_int64 779L); (mk_real_int64 316L); (mk_real_int64 205L); (mk_real_int64 423L); (mk_real_int64 423L); (mk_real_int64 579L); (mk_real_int64 747L); (mk_real_int64 42L); ]); +("ineq112", [41; ], [(mk_real_int64 11L); ]); +("ineq113", [4; 6; 11; 12; 34; ], [(mk_real_int64 10L); (mk_real_int64 552L); (mk_real_int64 595L); (mk_real_int64 306L); (mk_real_int64 120L); ]); +("ineq114", [2; 3; 8; 9; 14; 16; 21; 29; 30; 33; 38; 40; 43; 44; ], [(mk_real_int64 174L); (mk_real_int64 385L); (mk_real_int64 159L); (mk_real_int64 159L); (mk_real_int64 261L); (mk_real_int64 586L); (mk_real_int64 623L); (mk_real_int64 27L); (mk_real_int64 202L); (mk_real_int64 60L); (mk_real_int64 575L); (mk_real_int64 658L); (mk_real_int64 548L); (mk_real_int64 163L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 2625L); (mk_real_int64 3175L); (mk_real_int64 2625L); (mk_real_int64 1525L); (mk_real_int64 1525L); (mk_real_int64 1525L); (mk_real_int64 2625L); (mk_real_int64 2625L); (mk_real_int64 15625L); (mk_real_int64 2625L); (mk_real_int64 1750L); (mk_real_int64 2725L); (mk_real_int64 1750L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_lo", [1; 2; 19; 20; 22; 23; 27; 32; 40; 44; 45; 49; 51; ], [(mk_real_int64 96L); (mk_real_int64 96L); (mk_real_int64 466L); (mk_real_int64 466L); (mk_real_int64 105L); (mk_real_int64 254L); (mk_real_int64 164L); (mk_real_int64 2L); (mk_real_int64 98L); (mk_real_int64 440L); (mk_real_int64 80L); (mk_real_int64 50L); (mk_real_int64 92L); ]); +("azim_hi", [1; 2; 4; 9; 13; 14; 15; 17; 18; 25; 38; 41; 52; 54; 55; ], [(mk_real_int64 1509000L); (mk_real_int64 1509000L); (mk_real_int64 1000L); (mk_real_int64 423000L); (mk_real_int64 924L); (mk_real_int64 10L); (mk_real_int64 410L); (mk_real_int64 32L); (mk_real_int64 1000L); (mk_real_int64 386L); (mk_real_int64 1000L); (mk_real_int64 452L); (mk_real_int64 423L); (mk_real_int64 48L); (mk_real_int64 38L); ]); +("rhazim_hi", [9; 27; 28; 29; 30; 31; 35; 36; 37; 39; 40; 42; 43; ], [(mk_real_int64 241000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_lo", [4; 8; 11; 13; 14; 15; 18; 54; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_lo", [0; 2; 3; 4; 5; 6; 9; 10; 12; ], [(mk_real_int64 2632L); (mk_real_int64 2632L); (mk_real_int64 2068L); (mk_real_int64 2068L); (mk_real_int64 2068L); (mk_real_int64 2632L); (mk_real_int64 2632L); (mk_real_int64 2076L); (mk_real_int64 2076L); ]); +("rho_hi", [1; 7; 8; 11; ], [(mk_real_int64 1012L); (mk_real_int64 268L); (mk_real_int64 268L); (mk_real_int64 2480L); ]); +("tau_lo", [12; ], [(mk_real_int64 1000L); ]); +("tau_hi", [2; ], [(mk_real_int64 1000L); ]); +("y1_lo", [4; 11; 20; 28; 30; 31; 34; 36; 37; 39; 42; 45; 48; 52; ], [(mk_real_int64 335L); (mk_real_int64 220L); (mk_real_int64 340L); (mk_real_int64 500L); (mk_real_int64 140L); (mk_real_int64 500L); (mk_real_int64 422L); (mk_real_int64 500L); (mk_real_int64 140L); (mk_real_int64 80L); (mk_real_int64 20L); (mk_real_int64 385L); (mk_real_int64 570L); (mk_real_int64 500L); ]); +("y1_hi", [10; 15; 16; 17; 23; 25; 26; 32; 41; 43; 50; 53; ], [(mk_real_int64 135L); (mk_real_int64 715L); (mk_real_int64 120L); (mk_real_int64 500L); (mk_real_int64 145L); (mk_real_int64 100L); (mk_real_int64 220L); (mk_real_int64 215L); (mk_real_int64 400L); (mk_real_int64 180L); (mk_real_int64 440L); (mk_real_int64 98L); ]); +("y2_lo", [4; 10; 11; 17; 20; 26; 30; 34; 37; 38; 42; 45; 52; 53; ], [(mk_real_int64 182L); (mk_real_int64 258L); (mk_real_int64 220L); (mk_real_int64 464L); (mk_real_int64 340L); (mk_real_int64 444L); (mk_real_int64 220L); (mk_real_int64 422L); (mk_real_int64 220L); (mk_real_int64 480L); (mk_real_int64 20L); (mk_real_int64 608L); (mk_real_int64 384L); (mk_real_int64 194L); ]); +("y2_hi", [15; 16; 22; 23; 25; 28; 31; 32; 36; 39; 41; 43; 47; 48; 50; ], [(mk_real_int64 128L); (mk_real_int64 120L); (mk_real_int64 380L); (mk_real_int64 232L); (mk_real_int64 100L); (mk_real_int64 224L); (mk_real_int64 8L); (mk_real_int64 284L); (mk_real_int64 8L); (mk_real_int64 444L); (mk_real_int64 104L); (mk_real_int64 24L); (mk_real_int64 96L); (mk_real_int64 312L); (mk_real_int64 440L); ]); +("y3_lo", [4; 10; 11; 17; 20; 26; 30; 34; 37; 38; 42; 45; 52; 53; ], [(mk_real_int64 182L); (mk_real_int64 258L); (mk_real_int64 220L); (mk_real_int64 464L); (mk_real_int64 340L); (mk_real_int64 444L); (mk_real_int64 220L); (mk_real_int64 422L); (mk_real_int64 220L); (mk_real_int64 480L); (mk_real_int64 20L); (mk_real_int64 608L); (mk_real_int64 384L); (mk_real_int64 194L); ]); +("y3_hi", [15; 16; 22; 23; 25; 28; 31; 32; 36; 39; 41; 43; 47; 48; 50; ], [(mk_real_int64 128L); (mk_real_int64 120L); (mk_real_int64 380L); (mk_real_int64 232L); (mk_real_int64 100L); (mk_real_int64 224L); (mk_real_int64 8L); (mk_real_int64 284L); (mk_real_int64 8L); (mk_real_int64 444L); (mk_real_int64 104L); (mk_real_int64 24L); (mk_real_int64 96L); (mk_real_int64 312L); (mk_real_int64 440L); ]); +("y4_hi", [5; 6; 8; 11; 14; 15; 19; 21; 23; 26; 28; 30; 34; 36; 41; 42; ], [(mk_real_int64 500L); (mk_real_int64 11L); (mk_real_int64 400L); (mk_real_int64 175L); (mk_real_int64 375L); (mk_real_int64 635L); (mk_real_int64 75L); (mk_real_int64 265L); (mk_real_int64 528L); (mk_real_int64 75L); (mk_real_int64 385L); (mk_real_int64 340L); (mk_real_int64 454L); (mk_real_int64 196L); (mk_real_int64 341L); (mk_real_int64 181L); ]); +("y4_lo", [0; 4; 9; 12; 17; 20; 25; 27; 31; 32; 37; 39; ], [(mk_real_int64 375L); (mk_real_int64 120L); (mk_real_int64 172L); (mk_real_int64 560L); (mk_real_int64 1L); (mk_real_int64 67L); (mk_real_int64 67L); (mk_real_int64 300L); (mk_real_int64 516L); (mk_real_int64 510L); (mk_real_int64 478L); (mk_real_int64 250L); ]); +("y5_hi", [15; 16; 19; 22; 23; 25; 28; 30; 31; 32; 34; 36; 37; 41; 47; 48; 53; ], [(mk_real_int64 128L); (mk_real_int64 500L); (mk_real_int64 400L); (mk_real_int64 380L); (mk_real_int64 552L); (mk_real_int64 375L); (mk_real_int64 224L); (mk_real_int64 45L); (mk_real_int64 8L); (mk_real_int64 284L); (mk_real_int64 528L); (mk_real_int64 8L); (mk_real_int64 45L); (mk_real_int64 104L); (mk_real_int64 96L); (mk_real_int64 24L); (mk_real_int64 256L); ]); +("y5_lo", [4; 10; 11; 17; 20; 26; 38; 39; 42; 43; 45; 50; 52; ], [(mk_real_int64 182L); (mk_real_int64 258L); (mk_real_int64 375L); (mk_real_int64 464L); (mk_real_int64 172L); (mk_real_int64 444L); (mk_real_int64 480L); (mk_real_int64 140L); (mk_real_int64 516L); (mk_real_int64 131L); (mk_real_int64 419L); (mk_real_int64 250L); (mk_real_int64 384L); ]); +("y6_hi", [15; 16; 19; 22; 23; 25; 28; 30; 31; 32; 34; 36; 37; 41; 47; 48; 53; ], [(mk_real_int64 128L); (mk_real_int64 500L); (mk_real_int64 400L); (mk_real_int64 380L); (mk_real_int64 552L); (mk_real_int64 375L); (mk_real_int64 224L); (mk_real_int64 45L); (mk_real_int64 8L); (mk_real_int64 284L); (mk_real_int64 528L); (mk_real_int64 8L); (mk_real_int64 45L); (mk_real_int64 104L); (mk_real_int64 96L); (mk_real_int64 24L); (mk_real_int64 256L); ]); +("y6_lo", [4; 10; 11; 12; 17; 20; 26; 33; 38; 39; 42; 43; 44; 45; 50; 52; 53; 55; ], [(mk_real_int64 182L); (mk_real_int64 258L); (mk_real_int64 97375L); (mk_real_int64 54000L); (mk_real_int64 464L); (mk_real_int64 172L); (mk_real_int64 444L); (mk_real_int64 1000L); (mk_real_int64 480L); (mk_real_int64 140L); (mk_real_int64 516L); (mk_real_int64 131L); (mk_real_int64 80000L); (mk_real_int64 419L); (mk_real_int64 250L); (mk_real_int64 384L); (mk_real_int64 16000L); (mk_real_int64 84000L); ]); +("ye_hi", [12; 13; 38; 41; 42; 44; 45; 51; 52; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_lo", [13; 14; 15; 23; 25; 28; 45; 55; ], [(mk_real_int64 9000L); (mk_real_int64 1000L); (mk_real_int64 12000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 23000L); (mk_real_int64 154000L); (mk_real_int64 1000L); ]); +("yn_hi", [0; 1; 2; 3; 4; 5; 6; 8; ], [(mk_real_int64 200L); (mk_real_int64 780L); (mk_real_int64 200L); (mk_real_int64 101L); (mk_real_int64 101L); (mk_real_int64 1101L); (mk_real_int64 200L); (mk_real_int64 340L); ]); +("yn_lo", [7; 9; 10; 11; 12; ], [(mk_real_int64 672L); (mk_real_int64 800L); (mk_real_int64 368L); (mk_real_int64 244L); (mk_real_int64 1368L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests/234860659776_out.hl b/formal_lp/old/ineqs/tests/234860659776_out.hl new file mode 100644 index 0000000..b5e6c73 --- /dev/null +++ b/formal_lp/old/ineqs/tests/234860659776_out.hl @@ -0,0 +1,88 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "234860659776 17 6 0 1 2 3 4 5 4 0 5 6 7 3 6 5 4 3 6 4 8 4 8 4 3 9 3 9 3 10 3 10 3 2 3 10 2 11 3 11 2 1 3 11 1 0 3 11 0 12 3 12 0 7 3 12 7 9 3 8 9 7 3 12 9 10 3 7 6 8 3 10 11 12 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [5; 6; 7; 10; 12; ], [(mk_real_int64 54L); (mk_real_int64 451L); (mk_real_int64 337L); (mk_real_int64 8L); (mk_real_int64 280L); ]); +("azim_sum_neg", [1; 2; 3; 4; 8; 9; 11; ], [(mk_real_int64 3L); (mk_real_int64 16L); (mk_real_int64 17L); (mk_real_int64 592L); (mk_real_int64 211L); (mk_real_int64 118L); (mk_real_int64 160L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 953L); (mk_real_int64 956L); (mk_real_int64 969L); (mk_real_int64 953L); (mk_real_int64 743L); (mk_real_int64 953L); (mk_real_int64 953L); (mk_real_int64 953L); (mk_real_int64 963L); (mk_real_int64 953L); (mk_real_int64 936L); (mk_real_int64 743L); (mk_real_int64 953L); ]); +("sol_sum3", [1; 5; 6; 12; ], [(mk_real_int64 118L); (mk_real_int64 160L); (mk_real_int64 160L); (mk_real_int64 118L); ]); +("sol_sum3_neg", [2; 4; 7; 8; 9; 10; 11; ], [(mk_real_int64 134L); (mk_real_int64 19L); (mk_real_int64 83L); (mk_real_int64 54L); (mk_real_int64 345L); (mk_real_int64 73L); (mk_real_int64 346L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 847L); (mk_real_int64 870L); (mk_real_int64 819L); (mk_real_int64 936L); (mk_real_int64 564L); (mk_real_int64 743L); (mk_real_int64 743L); (mk_real_int64 743L); (mk_real_int64 953L); (mk_real_int64 945L); (mk_real_int64 953L); (mk_real_int64 666L); (mk_real_int64 953L); (mk_real_int64 743L); ]); +("tau_sum4_neg", [0; 1; ], [(mk_real_int64 953L); (mk_real_int64 953L); ]); +("tau_sum6_neg", [0; ], [(mk_real_int64 953L); ]); +("ln_def_neg", [0; 1; 2; 3; 5; 6; 7; 8; 9; 10; 12; ], [(mk_real_int64 51L); (mk_real_int64 54L); (mk_real_int64 68L); (mk_real_int64 51L); (mk_real_int64 51L); (mk_real_int64 51L); (mk_real_int64 51L); (mk_real_int64 61L); (mk_real_int64 51L); (mk_real_int64 32L); (mk_real_int64 51L); ]); +("ln_def", [4; 11; ], [(mk_real_int64 181L); (mk_real_int64 181L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 5987L); (mk_real_int64 6005L); (mk_real_int64 6085L); (mk_real_int64 5987L); (mk_real_int64 4668L); (mk_real_int64 5987L); (mk_real_int64 5987L); (mk_real_int64 5987L); (mk_real_int64 6048L); (mk_real_int64 5987L); (mk_real_int64 5878L); (mk_real_int64 4668L); (mk_real_int64 5987L); ]); +("edge_sym", [0; 8; 9; 28; 34; 36; 40; ], [(mk_real_int64 22L); (mk_real_int64 3L); (mk_real_int64 3L); (mk_real_int64 127L); (mk_real_int64 377L); (mk_real_int64 274L); (mk_real_int64 22L); ]); +("edge_sym_neg", [12; 21; 22; 25; 27; 37; 42; 43; 46; 49; ], [(mk_real_int64 111L); (mk_real_int64 206L); (mk_real_int64 9L); (mk_real_int64 127L); (mk_real_int64 315L); (mk_real_int64 6L); (mk_real_int64 150L); (mk_real_int64 73L); (mk_real_int64 74L); (mk_real_int64 300L); ]); +("y1_def_neg", [0; 9; 11; 12; 13; 14; 15; 20; 22; 24; 25; 26; 32; 36; 37; 39; 40; 41; 45; 48; 51; 53; 55; ], [(mk_real_int64 17L); (mk_real_int64 2L); (mk_real_int64 64L); (mk_real_int64 56L); (mk_real_int64 18L); (mk_real_int64 99L); (mk_real_int64 50L); (mk_real_int64 93L); (mk_real_int64 16L); (mk_real_int64 10L); (mk_real_int64 166L); (mk_real_int64 209L); (mk_real_int64 36L); (mk_real_int64 9L); (mk_real_int64 274L); (mk_real_int64 113L); (mk_real_int64 66L); (mk_real_int64 67L); (mk_real_int64 11L); (mk_real_int64 42L); (mk_real_int64 17L); (mk_real_int64 29L); (mk_real_int64 106L); ]); +("y1_def", [31; 33; 35; 38; 43; 44; 49; 54; ], [(mk_real_int64 146L); (mk_real_int64 216L); (mk_real_int64 122L); (mk_real_int64 15L); (mk_real_int64 131L); (mk_real_int64 124L); (mk_real_int64 6L); (mk_real_int64 80L); ]); +("y2_def", [0; 9; 11; 15; 20; 24; 26; 36; 37; 38; 40; 43; 45; 48; 53; 55; ], [(mk_real_int64 22L); (mk_real_int64 3L); (mk_real_int64 39L); (mk_real_int64 30L); (mk_real_int64 68L); (mk_real_int64 6L); (mk_real_int64 138L); (mk_real_int64 57L); (mk_real_int64 47L); (mk_real_int64 29L); (mk_real_int64 103L); (mk_real_int64 131L); (mk_real_int64 16L); (mk_real_int64 239L); (mk_real_int64 18L); (mk_real_int64 64L); ]); +("y2_def_neg", [12; 13; 14; 22; 25; 31; 32; 33; 35; 39; 41; 44; 49; 51; 54; ], [(mk_real_int64 56L); (mk_real_int64 18L); (mk_real_int64 99L); (mk_real_int64 22L); (mk_real_int64 166L); (mk_real_int64 76L); (mk_real_int64 36L); (mk_real_int64 66L); (mk_real_int64 37L); (mk_real_int64 113L); (mk_real_int64 20L); (mk_real_int64 1L); (mk_real_int64 39L); (mk_real_int64 71L); (mk_real_int64 24L); ]); +("y3_def", [0; 9; 11; 15; 20; 24; 26; 36; 37; 38; 40; 43; 45; 48; 53; 55; ], [(mk_real_int64 22L); (mk_real_int64 3L); (mk_real_int64 39L); (mk_real_int64 30L); (mk_real_int64 68L); (mk_real_int64 6L); (mk_real_int64 138L); (mk_real_int64 57L); (mk_real_int64 47L); (mk_real_int64 29L); (mk_real_int64 103L); (mk_real_int64 131L); (mk_real_int64 16L); (mk_real_int64 239L); (mk_real_int64 18L); (mk_real_int64 64L); ]); +("y3_def_neg", [12; 13; 14; 22; 25; 31; 32; 33; 35; 39; 41; 44; 49; 51; 54; ], [(mk_real_int64 56L); (mk_real_int64 18L); (mk_real_int64 99L); (mk_real_int64 22L); (mk_real_int64 166L); (mk_real_int64 76L); (mk_real_int64 36L); (mk_real_int64 66L); (mk_real_int64 37L); (mk_real_int64 113L); (mk_real_int64 20L); (mk_real_int64 1L); (mk_real_int64 39L); (mk_real_int64 71L); (mk_real_int64 24L); ]); +("y4_def_neg", [1; 2; 4; 5; 6; 8; 10; 11; 12; 22; 23; 24; 25; 26; 27; 29; 31; 34; 39; 41; ], [(mk_real_int64 73L); (mk_real_int64 39L); (mk_real_int64 69L); (mk_real_int64 57L); (mk_real_int64 129L); (mk_real_int64 68L); (mk_real_int64 12L); (mk_real_int64 115L); (mk_real_int64 251L); (mk_real_int64 63L); (mk_real_int64 349L); (mk_real_int64 27L); (mk_real_int64 79L); (mk_real_int64 193L); (mk_real_int64 83L); (mk_real_int64 68L); (mk_real_int64 31L); (mk_real_int64 270L); (mk_real_int64 33L); (mk_real_int64 121L); ]); +("y4_def", [3; 17; 18; 19; 21; 30; 35; 37; 40; ], [(mk_real_int64 38L); (mk_real_int64 315L); (mk_real_int64 44L); (mk_real_int64 334L); (mk_real_int64 188L); (mk_real_int64 134L); (mk_real_int64 34L); (mk_real_int64 74L); (mk_real_int64 124L); ]); +("y5_def", [0; 9; 11; 13; 15; 20; 24; 26; 32; 36; 37; 40; 45; 48; 53; 55; ], [(mk_real_int64 22L); (mk_real_int64 3L); (mk_real_int64 39L); (mk_real_int64 38L); (mk_real_int64 30L); (mk_real_int64 68L); (mk_real_int64 6L); (mk_real_int64 127L); (mk_real_int64 44L); (mk_real_int64 9L); (mk_real_int64 78L); (mk_real_int64 103L); (mk_real_int64 16L); (mk_real_int64 39L); (mk_real_int64 18L); (mk_real_int64 64L); ]); +("y5_def_neg", [12; 14; 22; 25; 33; 35; 38; 39; 41; 43; 44; 49; 51; 54; ], [(mk_real_int64 39L); (mk_real_int64 69L); (mk_real_int64 78L); (mk_real_int64 115L); (mk_real_int64 66L); (mk_real_int64 37L); (mk_real_int64 2L); (mk_real_int64 79L); (mk_real_int64 5L); (mk_real_int64 68L); (mk_real_int64 44L); (mk_real_int64 30L); (mk_real_int64 3L); (mk_real_int64 24L); ]); +("y6_def", [0; 9; 11; 13; 15; 20; 23; 24; 26; 32; 36; 37; 40; 41; 45; 48; 53; 55; ], [(mk_real_int64 22L); (mk_real_int64 3L); (mk_real_int64 39L); (mk_real_int64 237L); (mk_real_int64 30L); (mk_real_int64 68L); (mk_real_int64 316L); (mk_real_int64 115L); (mk_real_int64 127L); (mk_real_int64 66L); (mk_real_int64 9L); (mk_real_int64 94L); (mk_real_int64 103L); (mk_real_int64 46L); (mk_real_int64 16L); (mk_real_int64 39L); (mk_real_int64 18L); (mk_real_int64 159L); ]); +("y6_def_neg", [12; 14; 22; 25; 33; 35; 38; 39; 43; 44; 49; 54; ], [(mk_real_int64 39L); (mk_real_int64 69L); (mk_real_int64 78L); (mk_real_int64 115L); (mk_real_int64 66L); (mk_real_int64 37L); (mk_real_int64 2L); (mk_real_int64 79L); (mk_real_int64 68L); (mk_real_int64 16L); (mk_real_int64 30L); (mk_real_int64 24L); ]); +("RHA", [3; 4; 8; 10; 12; 13; 14; 17; 18; 21; 22; 24; 25; 26; 27; 28; 30; 34; 36; 42; 43; 47; 49; 51; 53; 55; ], [(mk_real_int64 16L); (mk_real_int64 3L); (mk_real_int64 10L); (mk_real_int64 116L); (mk_real_int64 109L); (mk_real_int64 93L); (mk_real_int64 86L); (mk_real_int64 3L); (mk_real_int64 16L); (mk_real_int64 150L); (mk_real_int64 117L); (mk_real_int64 16L); (mk_real_int64 17L); (mk_real_int64 12L); (mk_real_int64 389L); (mk_real_int64 179L); (mk_real_int64 210L); (mk_real_int64 210L); (mk_real_int64 142L); (mk_real_int64 8L); (mk_real_int64 8L); (mk_real_int64 287L); (mk_real_int64 270L); (mk_real_int64 10L); (mk_real_int64 144L); (mk_real_int64 34L); ]); +("yy10", [5; 27; ], [(mk_real_int64 22L); (mk_real_int64 64L); ]); +("tau4", [1; ], [(mk_real_int64 95L); ]); +("tau6", [0; ], [(mk_real_int64 953L); ]); +("ineq105", [0; 9; ], [(mk_real_int64 54L); (mk_real_int64 6L); ]); +("ineq106", [1; 5; 6; 10; 12; 22; 23; 27; 34; 39; 41; ], [(mk_real_int64 106L); (mk_real_int64 83L); (mk_real_int64 134L); (mk_real_int64 17L); (mk_real_int64 360L); (mk_real_int64 69L); (mk_real_int64 210L); (mk_real_int64 8L); (mk_real_int64 287L); (mk_real_int64 49L); (mk_real_int64 176L); ]); +("ineq107", [8; 17; 19; 21; 30; 35; 37; 40; ], [(mk_real_int64 10L); (mk_real_int64 341L); (mk_real_int64 431L); (mk_real_int64 243L); (mk_real_int64 192L); (mk_real_int64 69L); (mk_real_int64 83L); (mk_real_int64 160L); ]); +("ineq108", [6; 23; 24; 26; 27; 31; 34; ], [(mk_real_int64 54L); (mk_real_int64 196L); (mk_real_int64 23L); (mk_real_int64 282L); (mk_real_int64 66L); (mk_real_int64 45L); (mk_real_int64 8L); ]); +("ineq109", [3; 17; 18; 37; ], [(mk_real_int64 118L); (mk_real_int64 160L); (mk_real_int64 160L); (mk_real_int64 118L); ]); +("ineq110", [8; 12; 22; 24; 29; 30; 34; ], [(mk_real_int64 134L); (mk_real_int64 19L); (mk_real_int64 83L); (mk_real_int64 54L); (mk_real_int64 345L); (mk_real_int64 73L); (mk_real_int64 346L); ]); +("ineq111", [2; 4; 8; 11; 18; 23; 25; 27; 35; 37; ], [(mk_real_int64 309L); (mk_real_int64 548L); (mk_real_int64 398L); (mk_real_int64 924L); (mk_real_int64 65L); (mk_real_int64 563L); (mk_real_int64 630L); (mk_real_int64 258L); (mk_real_int64 158L); (mk_real_int64 226L); ]); +("ineq112", [17; ], [(mk_real_int64 179L); ]); +("ineq113", [0; 27; ], [(mk_real_int64 368L); (mk_real_int64 504L); ]); +("ineq114", [2; 4; 6; 9; 13; 16; 20; 22; 24; 29; 31; 32; 33; 34; 36; 39; 41; ], [(mk_real_int64 170L); (mk_real_int64 322L); (mk_real_int64 420L); (mk_real_int64 12L); (mk_real_int64 564L); (mk_real_int64 564L); (mk_real_int64 678L); (mk_real_int64 180L); (mk_real_int64 323L); (mk_real_int64 183L); (mk_real_int64 532L); (mk_real_int64 421L); (mk_real_int64 352L); (mk_real_int64 155L); (mk_real_int64 727L); (mk_real_int64 242L); (mk_real_int64 501L); ]); +("ineq119", [2; 4; ], [(mk_real_int64 445L); (mk_real_int64 262L); ]); +("ineq120", [0; 3; 7; ], [(mk_real_int64 72L); (mk_real_int64 436L); (mk_real_int64 596L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 3275L); (mk_real_int64 3125L); (mk_real_int64 3125L); (mk_real_int64 3275L); (mk_real_int64 2100L); (mk_real_int64 3275L); (mk_real_int64 3275L); (mk_real_int64 3275L); (mk_real_int64 2600L); (mk_real_int64 3275L); (mk_real_int64 3350L); (mk_real_int64 2100L); (mk_real_int64 3275L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [1; 2; 6; 12; 14; 19; 27; 30; 31; 33; 34; 41; 43; 45; 48; 50; ], [(mk_real_int64 592000L); (mk_real_int64 17000L); (mk_real_int64 576L); (mk_real_int64 420L); (mk_real_int64 572L); (mk_real_int64 768L); (mk_real_int64 64L); (mk_real_int64 64L); (mk_real_int64 247L); (mk_real_int64 1000L); (mk_real_int64 428L); (mk_real_int64 464L); (mk_real_int64 558L); (mk_real_int64 32L); (mk_real_int64 30L); (mk_real_int64 102L); ]); +("azim_lo", [8; 9; 10; 16; 20; 22; 23; 26; 36; 37; 38; 40; 44; 46; 47; 49; 53; 55; ], [(mk_real_int64 585L); (mk_real_int64 512L); (mk_real_int64 312L); (mk_real_int64 686L); (mk_real_int64 80L); (mk_real_int64 1000L); (mk_real_int64 488L); (mk_real_int64 1000L); (mk_real_int64 320L); (mk_real_int64 1000L); (mk_real_int64 802L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 454L); (mk_real_int64 648L); (mk_real_int64 1000L); (mk_real_int64 508L); (mk_real_int64 374L); ]); +("rhazim_hi", [1; 36; ], [(mk_real_int64 210000L); (mk_real_int64 1000L); ]); +("rho_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 1652L); (mk_real_int64 2504L); (mk_real_int64 4196L); (mk_real_int64 1652L); (mk_real_int64 1012L); (mk_real_int64 1652L); (mk_real_int64 1652L); (mk_real_int64 1652L); (mk_real_int64 3492L); (mk_real_int64 1652L); (mk_real_int64 3824L); (mk_real_int64 1012L); (mk_real_int64 1652L); ]); +("tau_lo", [5; 14; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("y1_lo", [0; 20; 24; 25; 33; 35; 36; 39; 40; 44; 48; 53; ], [(mk_real_int64 10L); (mk_real_int64 90L); (mk_real_int64 200L); (mk_real_int64 320L); (mk_real_int64 500L); (mk_real_int64 500L); (mk_real_int64 860L); (mk_real_int64 400L); (mk_real_int64 270L); (mk_real_int64 260L); (mk_real_int64 600L); (mk_real_int64 400L); ]); +("y1_hi", [9; 11; 12; 13; 14; 15; 22; 26; 31; 32; 37; 38; 41; 43; 45; 49; 51; 55; ], [(mk_real_int64 110L); (mk_real_int64 400L); (mk_real_int64 380L); (mk_real_int64 182L); (mk_real_int64 360L); (mk_real_int64 200L); (mk_real_int64 280L); (mk_real_int64 220L); (mk_real_int64 340L); (mk_real_int64 140L); (mk_real_int64 600L); (mk_real_int64 115L); (mk_real_int64 250L); (mk_real_int64 100L); (mk_real_int64 425L); (mk_real_int64 60L); (mk_real_int64 2L); (mk_real_int64 400L); ]); +("y2_lo", [0; 9; 11; 22; 25; 36; 37; 38; 39; 40; 44; 48; 51; 53; 54; ], [(mk_real_int64 292L); (mk_real_int64 588L); (mk_real_int64 416L); (mk_real_int64 240L); (mk_real_int64 320L); (mk_real_int64 344L); (mk_real_int64 556L); (mk_real_int64 108L); (mk_real_int64 400L); (mk_real_int64 352L); (mk_real_int64 444L); (mk_real_int64 140L); (mk_real_int64 114L); (mk_real_int64 164L); (mk_real_int64 320L); ]); +("y2_hi", [12; 13; 14; 15; 20; 24; 26; 31; 32; 33; 35; 41; 43; 45; 49; 55; ], [(mk_real_int64 380L); (mk_real_int64 182L); (mk_real_int64 360L); (mk_real_int64 212L); (mk_real_int64 432L); (mk_real_int64 188L); (mk_real_int64 260L); (mk_real_int64 8L); (mk_real_int64 140L); (mk_real_int64 488L); (mk_real_int64 64L); (mk_real_int64 496L); (mk_real_int64 100L); (mk_real_int64 380L); (mk_real_int64 72L); (mk_real_int64 64L); ]); +("y3_lo", [0; 9; 11; 22; 25; 36; 37; 38; 39; 40; 44; 48; 51; 53; 54; ], [(mk_real_int64 292L); (mk_real_int64 588L); (mk_real_int64 416L); (mk_real_int64 240L); (mk_real_int64 320L); (mk_real_int64 344L); (mk_real_int64 556L); (mk_real_int64 108L); (mk_real_int64 400L); (mk_real_int64 352L); (mk_real_int64 444L); (mk_real_int64 140L); (mk_real_int64 114L); (mk_real_int64 164L); (mk_real_int64 320L); ]); +("y3_hi", [12; 13; 14; 15; 20; 24; 26; 31; 32; 33; 35; 41; 43; 45; 49; 55; ], [(mk_real_int64 380L); (mk_real_int64 182L); (mk_real_int64 360L); (mk_real_int64 212L); (mk_real_int64 432L); (mk_real_int64 188L); (mk_real_int64 260L); (mk_real_int64 8L); (mk_real_int64 140L); (mk_real_int64 488L); (mk_real_int64 64L); (mk_real_int64 496L); (mk_real_int64 100L); (mk_real_int64 380L); (mk_real_int64 72L); (mk_real_int64 64L); ]); +("y4_lo", [8; 11; 18; 19; 21; 22; 26; 35; 39; 40; ], [(mk_real_int64 284L); (mk_real_int64 500L); (mk_real_int64 285L); (mk_real_int64 837L); (mk_real_int64 161L); (mk_real_int64 533L); (mk_real_int64 170L); (mk_real_int64 413L); (mk_real_int64 565L); (mk_real_int64 320L); ]); +("y4_hi", [1; 2; 3; 4; 5; 6; 10; 12; 17; 23; 24; 25; 27; 29; 30; 31; 34; 37; 41; ], [(mk_real_int64 390L); (mk_real_int64 375L); (mk_real_int64 232L); (mk_real_int64 500L); (mk_real_int64 145L); (mk_real_int64 220L); (mk_real_int64 355L); (mk_real_int64 676L); (mk_real_int64 433L); (mk_real_int64 515L); (mk_real_int64 661L); (mk_real_int64 250L); (mk_real_int64 60L); (mk_real_int64 380L); (mk_real_int64 108L); (mk_real_int64 175L); (mk_real_int64 109L); (mk_real_int64 141L); (mk_real_int64 440L); ]); +("y5_lo", [0; 9; 11; 25; 32; 36; 37; 38; 40; 41; 49; 53; 54; ], [(mk_real_int64 292L); (mk_real_int64 588L); (mk_real_int64 416L); (mk_real_int64 500L); (mk_real_int64 285L); (mk_real_int64 152L); (mk_real_int64 591L); (mk_real_int64 212L); (mk_real_int64 352L); (mk_real_int64 314L); (mk_real_int64 238L); (mk_real_int64 164L); (mk_real_int64 320L); ]); +("y5_hi", [12; 13; 14; 15; 20; 22; 24; 26; 31; 33; 35; 39; 43; 44; 45; 48; 51; 55; ], [(mk_real_int64 375L); (mk_real_int64 232L); (mk_real_int64 500L); (mk_real_int64 212L); (mk_real_int64 432L); (mk_real_int64 466L); (mk_real_int64 188L); (mk_real_int64 316L); (mk_real_int64 8L); (mk_real_int64 488L); (mk_real_int64 64L); (mk_real_int64 250L); (mk_real_int64 380L); (mk_real_int64 508L); (mk_real_int64 380L); (mk_real_int64 564L); (mk_real_int64 366L); (mk_real_int64 64L); ]); +("y6_lo", [0; 9; 11; 13; 23; 24; 25; 32; 36; 37; 38; 40; 41; 44; 49; 51; 53; 54; 55; ], [(mk_real_int64 292L); (mk_real_int64 588L); (mk_real_int64 416L); (mk_real_int64 198768L); (mk_real_int64 316000L); (mk_real_int64 109000L); (mk_real_int64 500L); (mk_real_int64 22285L); (mk_real_int64 152L); (mk_real_int64 16591L); (mk_real_int64 212L); (mk_real_int64 352L); (mk_real_int64 51314L); (mk_real_int64 27492L); (mk_real_int64 238L); (mk_real_int64 3000L); (mk_real_int64 164L); (mk_real_int64 320L); (mk_real_int64 95000L); ]); +("y6_hi", [12; 14; 15; 20; 22; 24; 26; 31; 33; 35; 39; 43; 45; 48; 51; 55; ], [(mk_real_int64 375L); (mk_real_int64 500L); (mk_real_int64 212L); (mk_real_int64 432L); (mk_real_int64 466L); (mk_real_int64 188L); (mk_real_int64 316L); (mk_real_int64 8L); (mk_real_int64 488L); (mk_real_int64 64L); (mk_real_int64 250L); (mk_real_int64 380L); (mk_real_int64 380L); (mk_real_int64 564L); (mk_real_int64 366L); (mk_real_int64 64L); ]); +("ye_hi", [23; 34; 36; 54; 55; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_lo", [12; 14; 15; 21; 22; 42; 46; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_hi", [0; 2; 3; 5; 6; 7; 9; 10; 12; ], [(mk_real_int64 124L); (mk_real_int64 832L); (mk_real_int64 124L); (mk_real_int64 2124L); (mk_real_int64 1124L); (mk_real_int64 1124L); (mk_real_int64 124L); (mk_real_int64 568L); (mk_real_int64 1124L); ]); +("yn_lo", [1; 4; 8; 11; ], [(mk_real_int64 104L); (mk_real_int64 63L); (mk_real_int64 636L); (mk_real_int64 63L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests/241242841715_out.hl b/formal_lp/old/ineqs/tests/241242841715_out.hl new file mode 100644 index 0000000..defa3f2 --- /dev/null +++ b/formal_lp/old/ineqs/tests/241242841715_out.hl @@ -0,0 +1,88 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "241242841715 21 6 0 1 2 3 4 5 4 0 5 6 7 3 6 5 8 3 8 5 4 3 8 4 3 3 8 3 9 3 9 3 10 3 10 3 2 3 10 2 11 3 11 2 12 3 12 2 1 3 12 1 0 3 12 0 13 3 13 0 7 3 13 7 14 4 14 7 6 9 3 6 8 9 3 14 9 10 3 14 10 11 3 11 12 13 3 13 14 11 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum_neg", [1; 4; 8; 10; 11; 12; 14; ], [(mk_real_int64 207L); (mk_real_int64 356L); (mk_real_int64 102L); (mk_real_int64 90L); (mk_real_int64 210L); (mk_real_int64 77L); (mk_real_int64 67L); ]); +("azim_sum", [6; 7; 9; 13; ], [(mk_real_int64 120L); (mk_real_int64 22L); (mk_real_int64 43L); (mk_real_int64 380L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 1131L); (mk_real_int64 825L); (mk_real_int64 1131L); (mk_real_int64 1131L); (mk_real_int64 861L); (mk_real_int64 1131L); (mk_real_int64 1029L); (mk_real_int64 1112L); (mk_real_int64 1042L); (mk_real_int64 1131L); (mk_real_int64 1109L); (mk_real_int64 903L); (mk_real_int64 1121L); (mk_real_int64 1131L); (mk_real_int64 1019L); ]); +("sol_sum3", [2; 3; 8; 9; 16; ], [(mk_real_int64 83L); (mk_real_int64 31L); (mk_real_int64 139L); (mk_real_int64 139L); (mk_real_int64 160L); ]); +("sol_sum3_neg", [14; 17; ], [(mk_real_int64 46L); (mk_real_int64 55L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; ], [(mk_real_int64 1042L); (mk_real_int64 825L); (mk_real_int64 825L); (mk_real_int64 1042L); (mk_real_int64 1081L); (mk_real_int64 1109L); (mk_real_int64 1019L); (mk_real_int64 709L); (mk_real_int64 832L); (mk_real_int64 832L); (mk_real_int64 903L); (mk_real_int64 1044L); (mk_real_int64 1044L); (mk_real_int64 940L); (mk_real_int64 1089L); (mk_real_int64 1019L); (mk_real_int64 903L); (mk_real_int64 975L); ]); +("tau_sum4_neg", [0; 1; ], [(mk_real_int64 1131L); (mk_real_int64 1131L); ]); +("tau_sum6_neg", [0; ], [(mk_real_int64 1131L); ]); +("ln_def_neg", [0; 2; 3; 5; 6; 7; 8; 9; 10; 12; 13; 14; ], [(mk_real_int64 247L); (mk_real_int64 247L); (mk_real_int64 247L); (mk_real_int64 247L); (mk_real_int64 134L); (mk_real_int64 226L); (mk_real_int64 149L); (mk_real_int64 247L); (mk_real_int64 223L); (mk_real_int64 236L); (mk_real_int64 247L); (mk_real_int64 124L); ]); +("ln_def", [1; 4; 11; ], [(mk_real_int64 91L); (mk_real_int64 51L); (mk_real_int64 5L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 7105L); (mk_real_int64 5181L); (mk_real_int64 7105L); (mk_real_int64 7105L); (mk_real_int64 5408L); (mk_real_int64 7105L); (mk_real_int64 6463L); (mk_real_int64 6988L); (mk_real_int64 6549L); (mk_real_int64 7105L); (mk_real_int64 6967L); (mk_real_int64 5672L); (mk_real_int64 7041L); (mk_real_int64 7105L); (mk_real_int64 6403L); ]); +("edge_sym_neg", [11; 12; 15; 21; 23; 24; 29; 32; 42; 45; 48; 58; 61; ], [(mk_real_int64 191L); (mk_real_int64 95L); (mk_real_int64 321L); (mk_real_int64 60L); (mk_real_int64 198L); (mk_real_int64 100L); (mk_real_int64 97L); (mk_real_int64 173L); (mk_real_int64 169L); (mk_real_int64 153L); (mk_real_int64 107L); (mk_real_int64 41L); (mk_real_int64 21L); ]); +("edge_sym", [18; 20; 27; 30; 33; 39; 41; 64; ], [(mk_real_int64 148L); (mk_real_int64 6L); (mk_real_int64 35L); (mk_real_int64 138L); (mk_real_int64 81L); (mk_real_int64 173L); (mk_real_int64 169L); (mk_real_int64 101L); ]); +("y1_def_neg", [10; 12; 14; 15; 16; 18; 19; 20; 21; 22; 23; 25; 27; 29; 31; 32; 34; 41; 42; 43; 44; 45; 47; 53; 55; 57; 59; 61; 64; 65; 66; ], [(mk_real_int64 47L); (mk_real_int64 111L); (mk_real_int64 184L); (mk_real_int64 12L); (mk_real_int64 43L); (mk_real_int64 13L); (mk_real_int64 96L); (mk_real_int64 5L); (mk_real_int64 53L); (mk_real_int64 40L); (mk_real_int64 180L); (mk_real_int64 148L); (mk_real_int64 13L); (mk_real_int64 250L); (mk_real_int64 146L); (mk_real_int64 7L); (mk_real_int64 24L); (mk_real_int64 82L); (mk_real_int64 221L); (mk_real_int64 188L); (mk_real_int64 52L); (mk_real_int64 24L); (mk_real_int64 78L); (mk_real_int64 109L); (mk_real_int64 102L); (mk_real_int64 31L); (mk_real_int64 67L); (mk_real_int64 41L); (mk_real_int64 83L); (mk_real_int64 184L); (mk_real_int64 170L); ]); +("y1_def", [17; 24; 30; 33; 36; 38; 40; 56; 63; 67; ], [(mk_real_int64 62L); (mk_real_int64 31L); (mk_real_int64 33L); (mk_real_int64 8L); (mk_real_int64 73L); (mk_real_int64 49L); (mk_real_int64 105L); (mk_real_int64 18L); (mk_real_int64 1L); (mk_real_int64 60L); ]); +("y2_def_neg", [12; 15; 17; 18; 19; 20; 23; 24; 25; 29; 30; 32; 33; 34; 36; 38; 40; 42; 43; 47; 55; 61; 63; 64; 65; ], [(mk_real_int64 178L); (mk_real_int64 147L); (mk_real_int64 19L); (mk_real_int64 13L); (mk_real_int64 143L); (mk_real_int64 5L); (mk_real_int64 180L); (mk_real_int64 9L); (mk_real_int64 207L); (mk_real_int64 143L); (mk_real_int64 10L); (mk_real_int64 7L); (mk_real_int64 3L); (mk_real_int64 24L); (mk_real_int64 50L); (mk_real_int64 73L); (mk_real_int64 32L); (mk_real_int64 85L); (mk_real_int64 188L); (mk_real_int64 16L); (mk_real_int64 102L); (mk_real_int64 84L); (mk_real_int64 32L); (mk_real_int64 6L); (mk_real_int64 171L); ]); +("y2_def", [10; 14; 16; 21; 22; 27; 31; 41; 44; 45; 53; 56; 57; 59; 66; 67; ], [(mk_real_int64 33L); (mk_real_int64 111L); (mk_real_int64 26L); (mk_real_int64 32L); (mk_real_int64 34L); (mk_real_int64 8L); (mk_real_int64 88L); (mk_real_int64 50L); (mk_real_int64 32L); (mk_real_int64 37L); (mk_real_int64 71L); (mk_real_int64 18L); (mk_real_int64 7L); (mk_real_int64 41L); (mk_real_int64 175L); (mk_real_int64 9L); ]); +("y3_def_neg", [12; 15; 17; 18; 19; 20; 23; 24; 25; 29; 30; 32; 33; 34; 36; 38; 40; 42; 43; 47; 55; 61; 63; 64; 65; ], [(mk_real_int64 178L); (mk_real_int64 147L); (mk_real_int64 19L); (mk_real_int64 13L); (mk_real_int64 143L); (mk_real_int64 5L); (mk_real_int64 180L); (mk_real_int64 9L); (mk_real_int64 207L); (mk_real_int64 143L); (mk_real_int64 10L); (mk_real_int64 7L); (mk_real_int64 3L); (mk_real_int64 24L); (mk_real_int64 50L); (mk_real_int64 73L); (mk_real_int64 32L); (mk_real_int64 85L); (mk_real_int64 188L); (mk_real_int64 16L); (mk_real_int64 102L); (mk_real_int64 84L); (mk_real_int64 32L); (mk_real_int64 6L); (mk_real_int64 171L); ]); +("y3_def", [10; 14; 16; 21; 22; 27; 31; 41; 44; 45; 53; 56; 57; 59; 66; 67; ], [(mk_real_int64 33L); (mk_real_int64 111L); (mk_real_int64 26L); (mk_real_int64 32L); (mk_real_int64 34L); (mk_real_int64 8L); (mk_real_int64 88L); (mk_real_int64 50L); (mk_real_int64 32L); (mk_real_int64 37L); (mk_real_int64 71L); (mk_real_int64 18L); (mk_real_int64 7L); (mk_real_int64 41L); (mk_real_int64 175L); (mk_real_int64 9L); ]); +("y4_def_neg", [0; 2; 4; 6; 9; 11; 12; 13; 15; 17; 19; 21; 22; 24; 31; 32; 33; 34; 35; 37; 39; 41; 42; 43; 45; 50; 51; 52; ], [(mk_real_int64 63L); (mk_real_int64 33L); (mk_real_int64 210L); (mk_real_int64 49L); (mk_real_int64 36L); (mk_real_int64 61L); (mk_real_int64 64L); (mk_real_int64 125L); (mk_real_int64 65L); (mk_real_int64 15L); (mk_real_int64 204L); (mk_real_int64 166L); (mk_real_int64 5L); (mk_real_int64 16L); (mk_real_int64 93L); (mk_real_int64 191L); (mk_real_int64 130L); (mk_real_int64 60L); (mk_real_int64 70L); (mk_real_int64 107L); (mk_real_int64 133L); (mk_real_int64 71L); (mk_real_int64 9L); (mk_real_int64 32L); (mk_real_int64 77L); (mk_real_int64 125L); (mk_real_int64 131L); (mk_real_int64 329L); ]); +("y4_def", [5; 7; 8; 10; 14; 20; 23; 26; 28; 30; 49; 53; ], [(mk_real_int64 80L); (mk_real_int64 95L); (mk_real_int64 27L); (mk_real_int64 10L); (mk_real_int64 48L); (mk_real_int64 52L); (mk_real_int64 13L); (mk_real_int64 190L); (mk_real_int64 173L); (mk_real_int64 162L); (mk_real_int64 91L); (mk_real_int64 49L); ]); +("y5_def_neg", [12; 15; 17; 19; 23; 24; 25; 29; 30; 32; 33; 34; 40; 42; 43; 55; 56; 61; 65; 67; ], [(mk_real_int64 128L); (mk_real_int64 111L); (mk_real_int64 19L); (mk_real_int64 103L); (mk_real_int64 125L); (mk_real_int64 9L); (mk_real_int64 148L); (mk_real_int64 87L); (mk_real_int64 10L); (mk_real_int64 5L); (mk_real_int64 3L); (mk_real_int64 16L); (mk_real_int64 32L); (mk_real_int64 43L); (mk_real_int64 130L); (mk_real_int64 71L); (mk_real_int64 9L); (mk_real_int64 62L); (mk_real_int64 117L); (mk_real_int64 23L); ]); +("y5_def", [10; 14; 16; 18; 20; 21; 22; 27; 31; 36; 41; 44; 45; 53; 57; 59; 63; 64; 66; ], [(mk_real_int64 33L); (mk_real_int64 111L); (mk_real_int64 26L); (mk_real_int64 27L); (mk_real_int64 10L); (mk_real_int64 32L); (mk_real_int64 34L); (mk_real_int64 8L); (mk_real_int64 88L); (mk_real_int64 16L); (mk_real_int64 50L); (mk_real_int64 32L); (mk_real_int64 37L); (mk_real_int64 71L); (mk_real_int64 9L); (mk_real_int64 41L); (mk_real_int64 44L); (mk_real_int64 10L); (mk_real_int64 175L); ]); +("y6_def_neg", [12; 15; 19; 23; 24; 29; 30; 32; 33; 34; 40; 42; 43; 55; 56; 61; 65; ], [(mk_real_int64 128L); (mk_real_int64 111L); (mk_real_int64 98L); (mk_real_int64 125L); (mk_real_int64 9L); (mk_real_int64 87L); (mk_real_int64 10L); (mk_real_int64 5L); (mk_real_int64 3L); (mk_real_int64 16L); (mk_real_int64 32L); (mk_real_int64 43L); (mk_real_int64 130L); (mk_real_int64 71L); (mk_real_int64 9L); (mk_real_int64 62L); (mk_real_int64 117L); ]); +("y6_def", [10; 14; 16; 17; 18; 20; 21; 22; 25; 26; 27; 31; 36; 41; 44; 45; 46; 53; 54; 57; 59; 63; 64; 66; 67; ], [(mk_real_int64 33L); (mk_real_int64 111L); (mk_real_int64 313L); (mk_real_int64 22L); (mk_real_int64 27L); (mk_real_int64 10L); (mk_real_int64 32L); (mk_real_int64 72L); (mk_real_int64 214L); (mk_real_int64 57L); (mk_real_int64 8L); (mk_real_int64 88L); (mk_real_int64 16L); (mk_real_int64 50L); (mk_real_int64 93L); (mk_real_int64 37L); (mk_real_int64 153L); (mk_real_int64 165L); (mk_real_int64 264L); (mk_real_int64 109L); (mk_real_int64 41L); (mk_real_int64 158L); (mk_real_int64 10L); (mk_real_int64 175L); (mk_real_int64 345L); ]); +("RHA", [11; 13; 16; 18; 20; 23; 24; 26; 28; 31; 32; 33; 34; 35; 36; 37; 38; 39; 41; 42; 43; 46; 48; 54; 55; 56; 57; 58; 60; 62; 64; 65; 67; ], [(mk_real_int64 89L); (mk_real_int64 218L); (mk_real_int64 146L); (mk_real_int64 306L); (mk_real_int64 89L); (mk_real_int64 50L); (mk_real_int64 28L); (mk_real_int64 22L); (mk_real_int64 90L); (mk_real_int64 67L); (mk_real_int64 421L); (mk_real_int64 193L); (mk_real_int64 71L); (mk_real_int64 299L); (mk_real_int64 29L); (mk_real_int64 71L); (mk_real_int64 29L); (mk_real_int64 299L); (mk_real_int64 92L); (mk_real_int64 77L); (mk_real_int64 77L); (mk_real_int64 77L); (mk_real_int64 87L); (mk_real_int64 102L); (mk_real_int64 191L); (mk_real_int64 42L); (mk_real_int64 3L); (mk_real_int64 20L); (mk_real_int64 90L); (mk_real_int64 116L); (mk_real_int64 218L); (mk_real_int64 132L); (mk_real_int64 44L); ]); +("RHB", [8; 9; 45; 47; 50; 51; ], [(mk_real_int64 19L); (mk_real_int64 102L); (mk_real_int64 15L); (mk_real_int64 15L); (mk_real_int64 102L); (mk_real_int64 19L); ]); +("tau4", [0; 1; ], [(mk_real_int64 1131L); (mk_real_int64 572L); ]); +("tau6", [0; ], [(mk_real_int64 1131L); ]); +("ineq106", [0; 4; 6; 11; 12; 17; 19; 21; 31; 32; 34; 39; 43; 45; 51; 52; ], [(mk_real_int64 70L); (mk_real_int64 306L); (mk_real_int64 72L); (mk_real_int64 89L); (mk_real_int64 50L); (mk_real_int64 22L); (mk_real_int64 112L); (mk_real_int64 243L); (mk_real_int64 136L); (mk_real_int64 141L); (mk_real_int64 87L); (mk_real_int64 172L); (mk_real_int64 39L); (mk_real_int64 112L); (mk_real_int64 14L); (mk_real_int64 156L); ]); +("ineq107", [2; 5; 7; 9; 14; 15; 20; 23; 26; 28; 30; 47; 49; 53; ], [(mk_real_int64 102L); (mk_real_int64 207L); (mk_real_int64 123L); (mk_real_int64 72L); (mk_real_int64 61L); (mk_real_int64 90L); (mk_real_int64 67L); (mk_real_int64 17L); (mk_real_int64 188L); (mk_real_int64 188L); (mk_real_int64 210L); (mk_real_int64 67L); (mk_real_int64 50L); (mk_real_int64 78L); ]); +("ineq108", [0; 12; 35; 37; 39; 50; 52; ], [(mk_real_int64 22L); (mk_real_int64 43L); (mk_real_int64 102L); (mk_real_int64 102L); (mk_real_int64 22L); (mk_real_int64 129L); (mk_real_int64 325L); ]); +("ineq109", [8; 10; 26; 28; 49; ], [(mk_real_int64 83L); (mk_real_int64 31L); (mk_real_int64 139L); (mk_real_int64 139L); (mk_real_int64 160L); ]); +("ineq110", [42; 53; ], [(mk_real_int64 46L); (mk_real_int64 55L); ]); +("ineq111", [2; 5; 9; 13; 15; 19; 22; 24; 28; 32; 33; 37; 41; 43; 47; 50; 51; ], [(mk_real_int64 901L); (mk_real_int64 640L); (mk_real_int64 733L); (mk_real_int64 1000L); (mk_real_int64 1074L); (mk_real_int64 1019L); (mk_real_int64 36L); (mk_real_int64 132L); (mk_real_int64 132L); (mk_real_int64 756L); (mk_real_int64 1044L); (mk_real_int64 298L); (mk_real_int64 566L); (mk_real_int64 41L); (mk_real_int64 412L); (mk_real_int64 294L); (mk_real_int64 975L); ]); +("ineq113", [44; ], [(mk_real_int64 449L); ]); +("ineq114", [1; 3; 6; 8; 10; 11; 13; 16; 22; 25; 29; 31; 38; 41; 42; 45; 48; 50; ], [(mk_real_int64 142L); (mk_real_int64 184L); (mk_real_int64 202L); (mk_real_int64 622L); (mk_real_int64 191L); (mk_real_int64 118L); (mk_real_int64 80L); (mk_real_int64 35L); (mk_real_int64 673L); (mk_real_int64 700L); (mk_real_int64 700L); (mk_real_int64 146L); (mk_real_int64 746L); (mk_real_int64 374L); (mk_real_int64 600L); (mk_real_int64 607L); (mk_real_int64 335L); (mk_real_int64 274L); ]); +("ineq120", [4; 7; ], [(mk_real_int64 502L); (mk_real_int64 57L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 3625L); (mk_real_int64 2325L); (mk_real_int64 3625L); (mk_real_int64 3625L); (mk_real_int64 2600L); (mk_real_int64 3625L); (mk_real_int64 2975L); (mk_real_int64 3100L); (mk_real_int64 2925L); (mk_real_int64 3625L); (mk_real_int64 3775L); (mk_real_int64 2400L); (mk_real_int64 3825L); (mk_real_int64 3625L); (mk_real_int64 3475L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [1; 4; 8; 17; 18; 23; 24; 32; 35; 39; 49; 51; 52; 55; 62; ], [(mk_real_int64 356000L); (mk_real_int64 207000L); (mk_real_int64 344L); (mk_real_int64 1000L); (mk_real_int64 372L); (mk_real_int64 80L); (mk_real_int64 1000L); (mk_real_int64 298L); (mk_real_int64 200L); (mk_real_int64 200L); (mk_real_int64 516L); (mk_real_int64 344L); (mk_real_int64 206L); (mk_real_int64 124L); (mk_real_int64 710L); ]); +("azim_lo", [9; 11; 13; 16; 19; 20; 21; 26; 41; 45; 47; 48; 50; 56; 58; 59; 64; ], [(mk_real_int64 48L); (mk_real_int64 108L); (mk_real_int64 816L); (mk_real_int64 548L); (mk_real_int64 1000L); (mk_real_int64 434L); (mk_real_int64 132L); (mk_real_int64 90L); (mk_real_int64 604L); (mk_real_int64 360L); (mk_real_int64 360L); (mk_real_int64 4L); (mk_real_int64 48L); (mk_real_int64 400L); (mk_real_int64 291L); (mk_real_int64 18L); (mk_real_int64 476L); ]); +("rhazim_hi", [1; 4; 13; 16; ], [(mk_real_int64 270000L); (mk_real_int64 306000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_lo", [32; 33; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_hi", [0; 1; 2; 3; 4; 5; 6; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 2204L); (mk_real_int64 3300L); (mk_real_int64 2204L); (mk_real_int64 2204L); (mk_real_int64 2524L); (mk_real_int64 2204L); (mk_real_int64 3236L); (mk_real_int64 2204L); (mk_real_int64 1956L); (mk_real_int64 2452L); (mk_real_int64 3364L); (mk_real_int64 2204L); (mk_real_int64 396L); ]); +("rho_lo", [7; 8; ], [(mk_real_int64 192L); (mk_real_int64 1072L); ]); +("tau_lo", [3; 4; 6; 12; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("tau_hi", [2; 17; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("y1_hi", [14; 15; 18; 19; 20; 30; 31; 32; 33; 34; 36; 38; 41; 42; 43; 45; 47; 53; 55; 57; 61; 65; 66; ], [(mk_real_int64 400L); (mk_real_int64 300L); (mk_real_int64 467L); (mk_real_int64 60L); (mk_real_int64 319L); (mk_real_int64 500L); (mk_real_int64 200L); (mk_real_int64 520L); (mk_real_int64 500L); (mk_real_int64 240L); (mk_real_int64 11L); (mk_real_int64 251L); (mk_real_int64 400L); (mk_real_int64 320L); (mk_real_int64 80L); (mk_real_int64 30L); (mk_real_int64 390L); (mk_real_int64 630L); (mk_real_int64 120L); (mk_real_int64 220L); (mk_real_int64 340L); (mk_real_int64 100L); (mk_real_int64 25L); ]); +("y1_lo", [10; 12; 16; 17; 21; 22; 24; 25; 27; 29; 44; 56; 59; 63; 64; 67; ], [(mk_real_int64 170L); (mk_real_int64 180L); (mk_real_int64 200L); (mk_real_int64 500L); (mk_real_int64 400L); (mk_real_int64 105L); (mk_real_int64 500L); (mk_real_int64 320L); (mk_real_int64 200L); (mk_real_int64 620L); (mk_real_int64 200L); (mk_real_int64 520L); (mk_real_int64 200L); (mk_real_int64 160L); (mk_real_int64 235L); (mk_real_int64 100L); ]); +("y2_lo", [22; 24; 30; 38; 41; 44; 47; 53; 56; 57; 59; 61; ], [(mk_real_int64 148L); (mk_real_int64 272L); (mk_real_int64 184L); (mk_real_int64 325L); (mk_real_int64 496L); (mk_real_int64 332L); (mk_real_int64 512L); (mk_real_int64 384L); (mk_real_int64 520L); (mk_real_int64 184L); (mk_real_int64 232L); (mk_real_int64 344L); ]); +("y2_hi", [10; 12; 14; 15; 16; 17; 18; 19; 20; 21; 27; 29; 31; 32; 33; 34; 36; 40; 42; 43; 45; 55; 63; 64; 65; 66; 67; ], [(mk_real_int64 488L); (mk_real_int64 316L); (mk_real_int64 384L); (mk_real_int64 336L); (mk_real_int64 208L); (mk_real_int64 304L); (mk_real_int64 467L); (mk_real_int64 116L); (mk_real_int64 319L); (mk_real_int64 396L); (mk_real_int64 8L); (mk_real_int64 348L); (mk_real_int64 452L); (mk_real_int64 520L); (mk_real_int64 416L); (mk_real_int64 240L); (mk_real_int64 435L); (mk_real_int64 80L); (mk_real_int64 244L); (mk_real_int64 80L); (mk_real_int64 128L); (mk_real_int64 120L); (mk_real_int64 240L); (mk_real_int64 36L); (mk_real_int64 596L); (mk_real_int64 84L); (mk_real_int64 44L); ]); +("y3_lo", [22; 24; 30; 38; 41; 44; 47; 53; 56; 57; 59; 61; ], [(mk_real_int64 148L); (mk_real_int64 272L); (mk_real_int64 184L); (mk_real_int64 325L); (mk_real_int64 496L); (mk_real_int64 332L); (mk_real_int64 512L); (mk_real_int64 384L); (mk_real_int64 520L); (mk_real_int64 184L); (mk_real_int64 232L); (mk_real_int64 344L); ]); +("y3_hi", [10; 12; 14; 15; 16; 17; 18; 19; 20; 21; 27; 29; 31; 32; 33; 34; 36; 40; 42; 43; 45; 55; 63; 64; 65; 66; 67; ], [(mk_real_int64 488L); (mk_real_int64 316L); (mk_real_int64 384L); (mk_real_int64 336L); (mk_real_int64 208L); (mk_real_int64 304L); (mk_real_int64 467L); (mk_real_int64 116L); (mk_real_int64 319L); (mk_real_int64 396L); (mk_real_int64 8L); (mk_real_int64 348L); (mk_real_int64 452L); (mk_real_int64 520L); (mk_real_int64 416L); (mk_real_int64 240L); (mk_real_int64 435L); (mk_real_int64 80L); (mk_real_int64 244L); (mk_real_int64 80L); (mk_real_int64 128L); (mk_real_int64 120L); (mk_real_int64 240L); (mk_real_int64 36L); (mk_real_int64 596L); (mk_real_int64 84L); (mk_real_int64 44L); ]); +("y4_lo", [0; 2; 6; 8; 14; 17; 19; 20; 21; 24; 31; 32; 33; 37; 42; 49; 50; 51; 52; ], [(mk_real_int64 20L); (mk_real_int64 779L); (mk_real_int64 320L); (mk_real_int64 108L); (mk_real_int64 847L); (mk_real_int64 70L); (mk_real_int64 95L); (mk_real_int64 209L); (mk_real_int64 455L); (mk_real_int64 500L); (mk_real_int64 160L); (mk_real_int64 85L); (mk_real_int64 500L); (mk_real_int64 120L); (mk_real_int64 16L); (mk_real_int64 510L); (mk_real_int64 115L); (mk_real_int64 465L); (mk_real_int64 485L); ]); +("y4_hi", [4; 5; 7; 9; 10; 11; 12; 15; 22; 23; 26; 28; 30; 34; 35; 39; 41; 43; 45; 47; 53; ], [(mk_real_int64 390L); (mk_real_int64 11L); (mk_real_int64 79L); (mk_real_int64 31L); (mk_real_int64 44L); (mk_real_int64 35L); (mk_real_int64 295L); (mk_real_int64 320L); (mk_real_int64 500L); (mk_real_int64 141L); (mk_real_int64 360L); (mk_real_int64 860L); (mk_real_int64 330L); (mk_real_int64 405L); (mk_real_int64 130L); (mk_real_int64 110L); (mk_real_int64 250L); (mk_real_int64 160L); (mk_real_int64 280L); (mk_real_int64 291L); (mk_real_int64 514L); ]); +("y5_lo", [12; 15; 18; 22; 24; 30; 34; 38; 41; 42; 43; 44; 47; 53; 56; 59; ], [(mk_real_int64 129L); (mk_real_int64 464L); (mk_real_int64 108L); (mk_real_int64 148L); (mk_real_int64 272L); (mk_real_int64 184L); (mk_real_int64 500L); (mk_real_int64 40L); (mk_real_int64 496L); (mk_real_int64 176L); (mk_real_int64 500L); (mk_real_int64 332L); (mk_real_int64 122L); (mk_real_int64 384L); (mk_real_int64 16L); (mk_real_int64 232L); ]); +("y5_hi", [10; 14; 16; 17; 19; 20; 21; 25; 27; 29; 31; 32; 33; 36; 40; 45; 55; 57; 61; 63; 64; 65; 66; 67; ], [(mk_real_int64 488L); (mk_real_int64 384L); (mk_real_int64 208L); (mk_real_int64 304L); (mk_real_int64 431L); (mk_real_int64 44L); (mk_real_int64 396L); (mk_real_int64 70L); (mk_real_int64 8L); (mk_real_int64 393L); (mk_real_int64 452L); (mk_real_int64 500L); (mk_real_int64 416L); (mk_real_int64 460L); (mk_real_int64 80L); (mk_real_int64 128L); (mk_real_int64 250L); (mk_real_int64 71L); (mk_real_int64 316L); (mk_real_int64 240L); (mk_real_int64 206L); (mk_real_int64 221L); (mk_real_int64 84L); (mk_real_int64 364L); ]); +("y6_lo", [12; 15; 16; 17; 18; 19; 22; 24; 25; 26; 30; 34; 38; 41; 42; 43; 44; 46; 47; 53; 54; 56; 57; 59; 63; 67; ], [(mk_real_int64 129L); (mk_real_int64 464L); (mk_real_int64 287000L); (mk_real_int64 41000L); (mk_real_int64 108L); (mk_real_int64 5000L); (mk_real_int64 38148L); (mk_real_int64 272L); (mk_real_int64 361930L); (mk_real_int64 57000L); (mk_real_int64 184L); (mk_real_int64 500L); (mk_real_int64 40L); (mk_real_int64 496L); (mk_real_int64 176L); (mk_real_int64 500L); (mk_real_int64 62000L); (mk_real_int64 153000L); (mk_real_int64 122L); (mk_real_int64 95000L); (mk_real_int64 264000L); (mk_real_int64 16L); (mk_real_int64 100000L); (mk_real_int64 232L); (mk_real_int64 114000L); (mk_real_int64 368000L); ]); +("y6_hi", [10; 14; 16; 17; 19; 20; 21; 27; 29; 31; 32; 33; 36; 40; 44; 45; 53; 55; 57; 61; 63; 64; 65; 66; 67; ], [(mk_real_int64 488L); (mk_real_int64 384L); (mk_real_int64 208L); (mk_real_int64 304L); (mk_real_int64 431L); (mk_real_int64 44L); (mk_real_int64 396L); (mk_real_int64 8L); (mk_real_int64 393L); (mk_real_int64 452L); (mk_real_int64 500L); (mk_real_int64 416L); (mk_real_int64 460L); (mk_real_int64 80L); (mk_real_int64 668L); (mk_real_int64 128L); (mk_real_int64 616L); (mk_real_int64 250L); (mk_real_int64 71L); (mk_real_int64 316L); (mk_real_int64 240L); (mk_real_int64 206L); (mk_real_int64 221L); (mk_real_int64 84L); (mk_real_int64 364L); ]); +("ye_lo", [19; 21; 27; 30; 31; 32; 33; 53; 60; 63; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 175000L); (mk_real_int64 352000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_hi", [22; 25; 34; 42; 43; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_hi", [5; 9; 10; 12; 13; ], [(mk_real_int64 228L); (mk_real_int64 1228L); (mk_real_int64 3052L); (mk_real_int64 1064L); (mk_real_int64 1228L); ]); +("yn_lo", [0; 1; 2; 3; 4; 6; 7; 8; 11; 14; ], [(mk_real_int64 772L); (mk_real_int64 993L); (mk_real_int64 772L); (mk_real_int64 772L); (mk_real_int64 73L); (mk_real_int64 184L); (mk_real_int64 1176L); (mk_real_int64 2324L); (mk_real_int64 2615L); (mk_real_int64 1424L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests/241966209046_out.hl b/formal_lp/old/ineqs/tests/241966209046_out.hl new file mode 100644 index 0000000..e48a910 --- /dev/null +++ b/formal_lp/old/ineqs/tests/241966209046_out.hl @@ -0,0 +1,89 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "241966209046 19 6 0 1 2 3 4 5 3 0 5 6 3 6 5 4 3 6 4 3 3 6 3 7 3 7 3 8 3 8 3 2 3 8 2 9 3 9 2 1 3 9 1 10 3 10 1 0 3 10 0 11 4 11 0 6 7 3 11 7 12 3 12 7 8 4 12 8 9 13 3 13 9 10 3 13 10 11 3 11 12 13 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum_neg", [0; 1; 2; 6; 10; 13; ], [(mk_real_int64 504L); (mk_real_int64 564L); (mk_real_int64 49L); (mk_real_int64 232L); (mk_real_int64 130L); (mk_real_int64 144L); ]); +("azim_sum", [7; 8; 9; ], [(mk_real_int64 291L); (mk_real_int64 64L); (mk_real_int64 390L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 792L); (mk_real_int64 792L); (mk_real_int64 1061L); (mk_real_int64 1013L); (mk_real_int64 1013L); (mk_real_int64 1121L); (mk_real_int64 1121L); (mk_real_int64 1121L); (mk_real_int64 1061L); (mk_real_int64 1013L); (mk_real_int64 1036L); (mk_real_int64 1121L); (mk_real_int64 970L); (mk_real_int64 970L); ]); +("sol_sum3", [1; 13; 14; ], [(mk_real_int64 504L); (mk_real_int64 64L); (mk_real_int64 144L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; ], [(mk_real_int64 792L); (mk_real_int64 792L); (mk_real_int64 792L); (mk_real_int64 1013L); (mk_real_int64 1061L); (mk_real_int64 1013L); (mk_real_int64 1002L); (mk_real_int64 1013L); (mk_real_int64 1013L); (mk_real_int64 964L); (mk_real_int64 1015L); (mk_real_int64 970L); (mk_real_int64 970L); (mk_real_int64 970L); (mk_real_int64 970L); (mk_real_int64 970L); ]); +("tau_sum4_neg", [0; 1; ], [(mk_real_int64 1121L); (mk_real_int64 970L); ]); +("tau_sum6_neg", [0; ], [(mk_real_int64 1013L); ]); +("ln_def_neg", [2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 247L); (mk_real_int64 116L); (mk_real_int64 116L); (mk_real_int64 236L); (mk_real_int64 236L); (mk_real_int64 236L); (mk_real_int64 170L); (mk_real_int64 116L); (mk_real_int64 142L); (mk_real_int64 236L); (mk_real_int64 70L); (mk_real_int64 70L); ]); +("ln_def", [0; 1; ], [(mk_real_int64 127L); (mk_real_int64 127L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 4974L); (mk_real_int64 4974L); (mk_real_int64 6667L); (mk_real_int64 6362L); (mk_real_int64 6362L); (mk_real_int64 7044L); (mk_real_int64 7044L); (mk_real_int64 7044L); (mk_real_int64 6667L); (mk_real_int64 6362L); (mk_real_int64 6511L); (mk_real_int64 7044L); (mk_real_int64 6097L); (mk_real_int64 6097L); ]); +("edge_sym", [0; 5; 11; 14; 16; 25; 51; 58; ], [(mk_real_int64 44L); (mk_real_int64 44L); (mk_real_int64 220L); (mk_real_int64 419L); (mk_real_int64 114L); (mk_real_int64 20L); (mk_real_int64 14L); (mk_real_int64 4L); ]); +("edge_sym_neg", [7; 19; 20; 23; 26; 29; 31; 32; 35; 38; 45; 48; 55; ], [(mk_real_int64 275L); (mk_real_int64 47L); (mk_real_int64 2L); (mk_real_int64 86L); (mk_real_int64 37L); (mk_real_int64 40L); (mk_real_int64 92L); (mk_real_int64 60L); (mk_real_int64 95L); (mk_real_int64 4L); (mk_real_int64 20L); (mk_real_int64 23L); (mk_real_int64 14L); ]); +("y1_def_neg", [0; 6; 8; 9; 11; 12; 14; 16; 17; 20; 21; 23; 25; 27; 29; 30; 32; 34; 37; 38; 44; 45; 46; 47; 48; 50; 51; 55; 57; 58; 61; ], [(mk_real_int64 34L); (mk_real_int64 191L); (mk_real_int64 126L); (mk_real_int64 238L); (mk_real_int64 17L); (mk_real_int64 83L); (mk_real_int64 67L); (mk_real_int64 182L); (mk_real_int64 133L); (mk_real_int64 105L); (mk_real_int64 44L); (mk_real_int64 182L); (mk_real_int64 17L); (mk_real_int64 13L); (mk_real_int64 86L); (mk_real_int64 7L); (mk_real_int64 26L); (mk_real_int64 118L); (mk_real_int64 112L); (mk_real_int64 63L); (mk_real_int64 11L); (mk_real_int64 10L); (mk_real_int64 11L); (mk_real_int64 14L); (mk_real_int64 1L); (mk_real_int64 18L); (mk_real_int64 11L); (mk_real_int64 32L); (mk_real_int64 22L); (mk_real_int64 93L); (mk_real_int64 60L); ]); +("y1_def", [7; 13; 15; 19; 36; 53; ], [(mk_real_int64 150L); (mk_real_int64 282L); (mk_real_int64 61L); (mk_real_int64 24L); (mk_real_int64 25L); (mk_real_int64 30L); ]); +("y2_def", [0; 6; 9; 14; 17; 21; 25; 27; 30; 38; 44; 47; 48; 50; 51; ], [(mk_real_int64 44L); (mk_real_int64 116L); (mk_real_int64 22L); (mk_real_int64 41L); (mk_real_int64 145L); (mk_real_int64 41L); (mk_real_int64 20L); (mk_real_int64 20L); (mk_real_int64 11L); (mk_real_int64 39L); (mk_real_int64 7L); (mk_real_int64 9L); (mk_real_int64 1L); (mk_real_int64 23L); (mk_real_int64 14L); ]); +("y2_def_neg", [7; 8; 11; 12; 13; 15; 16; 19; 20; 23; 29; 32; 34; 36; 37; 45; 46; 53; 55; 57; 58; 61; ], [(mk_real_int64 46L); (mk_real_int64 31L); (mk_real_int64 56L); (mk_real_int64 83L); (mk_real_int64 86L); (mk_real_int64 19L); (mk_real_int64 182L); (mk_real_int64 7L); (mk_real_int64 67L); (mk_real_int64 182L); (mk_real_int64 86L); (mk_real_int64 95L); (mk_real_int64 71L); (mk_real_int64 8L); (mk_real_int64 112L); (mk_real_int64 10L); (mk_real_int64 11L); (mk_real_int64 22L); (mk_real_int64 32L); (mk_real_int64 22L); (mk_real_int64 65L); (mk_real_int64 153L); ]); +("y3_def", [0; 6; 9; 14; 17; 21; 25; 27; 30; 38; 44; 47; 48; 50; 51; ], [(mk_real_int64 44L); (mk_real_int64 116L); (mk_real_int64 22L); (mk_real_int64 41L); (mk_real_int64 145L); (mk_real_int64 41L); (mk_real_int64 20L); (mk_real_int64 20L); (mk_real_int64 11L); (mk_real_int64 39L); (mk_real_int64 7L); (mk_real_int64 9L); (mk_real_int64 1L); (mk_real_int64 23L); (mk_real_int64 14L); ]); +("y3_def_neg", [7; 8; 11; 12; 13; 15; 16; 19; 20; 23; 29; 32; 34; 36; 37; 45; 46; 53; 55; 57; 58; 61; ], [(mk_real_int64 46L); (mk_real_int64 31L); (mk_real_int64 56L); (mk_real_int64 83L); (mk_real_int64 86L); (mk_real_int64 19L); (mk_real_int64 182L); (mk_real_int64 7L); (mk_real_int64 67L); (mk_real_int64 182L); (mk_real_int64 86L); (mk_real_int64 95L); (mk_real_int64 71L); (mk_real_int64 8L); (mk_real_int64 112L); (mk_real_int64 10L); (mk_real_int64 11L); (mk_real_int64 22L); (mk_real_int64 32L); (mk_real_int64 22L); (mk_real_int64 65L); (mk_real_int64 153L); ]); +("y4_def", [1; 5; 7; 9; 13; 26; 30; 39; 43; 47; ], [(mk_real_int64 233L); (mk_real_int64 13L); (mk_real_int64 436L); (mk_real_int64 95L); (mk_real_int64 38L); (mk_real_int64 27L); (mk_real_int64 39L); (mk_real_int64 82L); (mk_real_int64 46L); (mk_real_int64 20L); ]); +("y4_def_neg", [0; 2; 3; 6; 8; 10; 11; 14; 15; 17; 19; 21; 23; 24; 28; 31; 32; 34; 35; 36; 37; 38; 41; 44; ], [(mk_real_int64 218L); (mk_real_int64 114L); (mk_real_int64 22L); (mk_real_int64 58L); (mk_real_int64 76L); (mk_real_int64 127L); (mk_real_int64 273L); (mk_real_int64 106L); (mk_real_int64 77L); (mk_real_int64 127L); (mk_real_int64 37L); (mk_real_int64 38L); (mk_real_int64 60L); (mk_real_int64 21L); (mk_real_int64 95L); (mk_real_int64 78L); (mk_real_int64 72L); (mk_real_int64 13L); (mk_real_int64 7L); (mk_real_int64 7L); (mk_real_int64 16L); (mk_real_int64 1L); (mk_real_int64 22L); (mk_real_int64 73L); ]); +("y5_def", [0; 6; 9; 14; 17; 21; 25; 27; 30; 38; 44; 47; 48; 50; 51; 53; 57; ], [(mk_real_int64 44L); (mk_real_int64 116L); (mk_real_int64 261L); (mk_real_int64 41L); (mk_real_int64 145L); (mk_real_int64 41L); (mk_real_int64 20L); (mk_real_int64 20L); (mk_real_int64 11L); (mk_real_int64 39L); (mk_real_int64 7L); (mk_real_int64 9L); (mk_real_int64 1L); (mk_real_int64 23L); (mk_real_int64 14L); (mk_real_int64 9L); (mk_real_int64 46L); ]); +("y5_def_neg", [7; 8; 11; 12; 13; 15; 16; 19; 20; 23; 29; 32; 34; 36; 37; 45; 46; 55; 58; 61; ], [(mk_real_int64 46L); (mk_real_int64 11L); (mk_real_int64 42L); (mk_real_int64 58L); (mk_real_int64 86L); (mk_real_int64 19L); (mk_real_int64 127L); (mk_real_int64 7L); (mk_real_int64 39L); (mk_real_int64 127L); (mk_real_int64 60L); (mk_real_int64 71L); (mk_real_int64 44L); (mk_real_int64 8L); (mk_real_int64 78L); (mk_real_int64 7L); (mk_real_int64 7L); (mk_real_int64 22L); (mk_real_int64 42L); (mk_real_int64 113L); ]); +("y6_def", [0; 6; 9; 10; 14; 17; 21; 22; 24; 25; 27; 28; 30; 33; 36; 38; 44; 47; 48; 50; 51; 53; 56; 57; 60; ], [(mk_real_int64 44L); (mk_real_int64 116L); (mk_real_int64 261L); (mk_real_int64 64L); (mk_real_int64 41L); (mk_real_int64 145L); (mk_real_int64 173L); (mk_real_int64 204L); (mk_real_int64 66L); (mk_real_int64 20L); (mk_real_int64 40L); (mk_real_int64 98L); (mk_real_int64 12L); (mk_real_int64 136L); (mk_real_int64 245L); (mk_real_int64 81L); (mk_real_int64 7L); (mk_real_int64 9L); (mk_real_int64 1L); (mk_real_int64 23L); (mk_real_int64 14L); (mk_real_int64 9L); (mk_real_int64 40L); (mk_real_int64 46L); (mk_real_int64 113L); ]); +("y6_def_neg", [7; 8; 11; 12; 13; 15; 16; 19; 20; 23; 29; 32; 34; 37; 45; 46; 55; 58; 61; ], [(mk_real_int64 46L); (mk_real_int64 11L); (mk_real_int64 42L); (mk_real_int64 58L); (mk_real_int64 86L); (mk_real_int64 19L); (mk_real_int64 127L); (mk_real_int64 7L); (mk_real_int64 39L); (mk_real_int64 127L); (mk_real_int64 60L); (mk_real_int64 71L); (mk_real_int64 44L); (mk_real_int64 78L); (mk_real_int64 7L); (mk_real_int64 7L); (mk_real_int64 22L); (mk_real_int64 42L); (mk_real_int64 4L); ]); +("RHA", [0; 3; 6; 8; 9; 12; 14; 15; 16; 18; 22; 24; 26; 32; 33; 35; 36; 37; 43; 44; 47; 48; 50; 51; 54; 55; 57; 58; 59; ], [(mk_real_int64 109L); (mk_real_int64 49L); (mk_real_int64 11L); (mk_real_int64 232L); (mk_real_int64 59L); (mk_real_int64 329L); (mk_real_int64 158L); (mk_real_int64 109L); (mk_real_int64 49L); (mk_real_int64 60L); (mk_real_int64 49L); (mk_real_int64 60L); (mk_real_int64 11L); (mk_real_int64 24L); (mk_real_int64 72L); (mk_real_int64 157L); (mk_real_int64 21L); (mk_real_int64 106L); (mk_real_int64 151L); (mk_real_int64 132L); (mk_real_int64 127L); (mk_real_int64 89L); (mk_real_int64 91L); (mk_real_int64 42L); (mk_real_int64 42L); (mk_real_int64 66L); (mk_real_int64 66L); (mk_real_int64 121L); (mk_real_int64 151L); ]); +("yy10", [8; ], [(mk_real_int64 337L); ]); +("tau4", [0; ], [(mk_real_int64 226L); ]); +("tau6", [0; ], [(mk_real_int64 1013L); ]); +("ineq105", [0; 11; 12; ], [(mk_real_int64 109L); (mk_real_int64 57L); (mk_real_int64 34L); ]); +("ineq106", [0; 2; 3; 8; 11; 15; 19; 28; 32; 34; 37; 38; 44; ], [(mk_real_int64 318L); (mk_real_int64 98L); (mk_real_int64 271L); (mk_real_int64 111L); (mk_real_int64 109L); (mk_real_int64 49L); (mk_real_int64 11L); (mk_real_int64 49L); (mk_real_int64 106L); (mk_real_int64 19L); (mk_real_int64 24L); (mk_real_int64 2L); (mk_real_int64 29L); ]); +("ineq107", [1; 5; 7; 9; 13; 26; 30; 39; 47; ], [(mk_real_int64 301L); (mk_real_int64 60L); (mk_real_int64 564L); (mk_real_int64 123L); (mk_real_int64 49L); (mk_real_int64 106L); (mk_real_int64 51L); (mk_real_int64 80L); (mk_real_int64 144L); ]); +("ineq108", [11; 14; 15; 19; 21; 24; ], [(mk_real_int64 291L); (mk_real_int64 64L); (mk_real_int64 64L); (mk_real_int64 43L); (mk_real_int64 56L); (mk_real_int64 31L); ]); +("ineq109", [3; 39; 43; ], [(mk_real_int64 504L); (mk_real_int64 64L); (mk_real_int64 144L); ]); +("ineq111", [2; 5; 6; 10; 14; 17; 23; 26; 28; 31; 35; 36; 41; 44; 47; ], [(mk_real_int64 373L); (mk_real_int64 262L); (mk_real_int64 460L); (mk_real_int64 1013L); (mk_real_int64 501L); (mk_real_int64 1013L); (mk_real_int64 479L); (mk_real_int64 439L); (mk_real_int64 491L); (mk_real_int64 622L); (mk_real_int64 55L); (mk_real_int64 59L); (mk_real_int64 178L); (mk_real_int64 420L); (mk_real_int64 730L); ]); +("ineq112", [1; ], [(mk_real_int64 401L); ]); +("ineq113", [19; 27; 30; ], [(mk_real_int64 165L); (mk_real_int64 222L); (mk_real_int64 224L); ]); +("ineq114", [0; 3; 6; 8; 12; 18; 20; 21; 24; 29; 31; 33; 34; 37; 38; 40; 43; 44; 45; ], [(mk_real_int64 18L); (mk_real_int64 529L); (mk_real_int64 156L); (mk_real_int64 175L); (mk_real_int64 560L); (mk_real_int64 197L); (mk_real_int64 640L); (mk_real_int64 533L); (mk_real_int64 573L); (mk_real_int64 251L); (mk_real_int64 169L); (mk_real_int64 241L); (mk_real_int64 675L); (mk_real_int64 667L); (mk_real_int64 244L); (mk_real_int64 792L); (mk_real_int64 127L); (mk_real_int64 423L); (mk_real_int64 241L); ]); +("ineq119", [2; 7; ], [(mk_real_int64 511L); (mk_real_int64 317L); ]); +("ineq120", [3; 5; 6; ], [(mk_real_int64 384L); (mk_real_int64 129L); (mk_real_int64 525L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 2550L); (mk_real_int64 2550L); (mk_real_int64 80275L); (mk_real_int64 2650L); (mk_real_int64 2650L); (mk_real_int64 3300L); (mk_real_int64 3300L); (mk_real_int64 3300L); (mk_real_int64 3275L); (mk_real_int64 2650L); (mk_real_int64 2575L); (mk_real_int64 3300L); (mk_real_int64 3025L); (mk_real_int64 3025L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [4; 5; 6; 9; 12; 14; 25; 33; 35; 41; 42; 52; ], [(mk_real_int64 564000L); (mk_real_int64 504000L); (mk_real_int64 268L); (mk_real_int64 154L); (mk_real_int64 656L); (mk_real_int64 550L); (mk_real_int64 265L); (mk_real_int64 502L); (mk_real_int64 126L); (mk_real_int64 517L); (mk_real_int64 72L); (mk_real_int64 399L); ]); +("azim_lo", [7; 18; 24; 26; 27; 30; 36; 37; 43; 44; 47; 48; 50; 51; 54; 57; 58; 59; ], [(mk_real_int64 307L); (mk_real_int64 440L); (mk_real_int64 678L); (mk_real_int64 360L); (mk_real_int64 342L); (mk_real_int64 302L); (mk_real_int64 16L); (mk_real_int64 206L); (mk_real_int64 134L); (mk_real_int64 450L); (mk_real_int64 458L); (mk_real_int64 256L); (mk_real_int64 218L); (mk_real_int64 50L); (mk_real_int64 208L); (mk_real_int64 498L); (mk_real_int64 202L); (mk_real_int64 134L); ]); +("rhazim_hi", [0; 3; 4; 5; 8; 9; 15; 16; 17; 21; 22; 24; 32; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 221000L); (mk_real_int64 221000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_lo", [51; 54; 58; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 11; ], [(mk_real_int64 2928L); (mk_real_int64 2928L); (mk_real_int64 324L); (mk_real_int64 3692L); (mk_real_int64 3692L); (mk_real_int64 364L); (mk_real_int64 364L); (mk_real_int64 364L); (mk_real_int64 324L); (mk_real_int64 3692L); (mk_real_int64 364L); ]); +("rho_lo", [10; 12; 13; ], [(mk_real_int64 776L); (mk_real_int64 1520L); (mk_real_int64 1520L); ]); +("tau_hi", [13; 15; 18; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("tau_lo", [2; 3; 8; 9; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("y1_lo", [0; 9; 11; 16; 17; 20; 21; 23; 27; 29; 30; 32; 38; 44; 47; 48; 55; ], [(mk_real_int64 335L); (mk_real_int64 704L); (mk_real_int64 160L); (mk_real_int64 340L); (mk_real_int64 785L); (mk_real_int64 220L); (mk_real_int64 440L); (mk_real_int64 340L); (mk_real_int64 160L); (mk_real_int64 220L); (mk_real_int64 285L); (mk_real_int64 20L); (mk_real_int64 600L); (mk_real_int64 400L); (mk_real_int64 400L); (mk_real_int64 200L); (mk_real_int64 40L); ]); +("y1_hi", [6; 7; 8; 12; 14; 15; 19; 25; 34; 36; 37; 45; 46; 50; 51; 53; 57; 61; ], [(mk_real_int64 200L); (mk_real_int64 500L); (mk_real_int64 60L); (mk_real_int64 200L); (mk_real_int64 400L); (mk_real_int64 500L); (mk_real_int64 500L); (mk_real_int64 295L); (mk_real_int64 220L); (mk_real_int64 500L); (mk_real_int64 40L); (mk_real_int64 100L); (mk_real_int64 380L); (mk_real_int64 45L); (mk_real_int64 290L); (mk_real_int64 336L); (mk_real_int64 256L); (mk_real_int64 600L); ]); +("y2_lo", [0; 6; 8; 11; 14; 16; 19; 23; 25; 29; 32; 38; 44; 47; 48; 50; 51; 55; 58; 61; ], [(mk_real_int64 182L); (mk_real_int64 248L); (mk_real_int64 468L); (mk_real_int64 280L); (mk_real_int64 596L); (mk_real_int64 340L); (mk_real_int64 448L); (mk_real_int64 340L); (mk_real_int64 344L); (mk_real_int64 220L); (mk_real_int64 132L); (mk_real_int64 416L); (mk_real_int64 84L); (mk_real_int64 264L); (mk_real_int64 272L); (mk_real_int64 86L); (mk_real_int64 332L); (mk_real_int64 40L); (mk_real_int64 44L); (mk_real_int64 288L); ]); +("y2_hi", [7; 9; 12; 13; 15; 17; 20; 21; 27; 30; 34; 36; 37; 45; 46; 53; 57; ], [(mk_real_int64 248L); (mk_real_int64 540L); (mk_real_int64 200L); (mk_real_int64 272L); (mk_real_int64 304L); (mk_real_int64 600L); (mk_real_int64 116L); (mk_real_int64 132L); (mk_real_int64 384L); (mk_real_int64 284L); (mk_real_int64 456L); (mk_real_int64 248L); (mk_real_int64 40L); (mk_real_int64 100L); (mk_real_int64 380L); (mk_real_int64 176L); (mk_real_int64 256L); ]); +("y3_lo", [0; 6; 8; 11; 14; 16; 19; 23; 25; 29; 32; 38; 44; 47; 48; 50; 51; 55; 58; 61; ], [(mk_real_int64 182L); (mk_real_int64 248L); (mk_real_int64 468L); (mk_real_int64 280L); (mk_real_int64 596L); (mk_real_int64 340L); (mk_real_int64 448L); (mk_real_int64 340L); (mk_real_int64 344L); (mk_real_int64 220L); (mk_real_int64 132L); (mk_real_int64 416L); (mk_real_int64 84L); (mk_real_int64 264L); (mk_real_int64 272L); (mk_real_int64 86L); (mk_real_int64 332L); (mk_real_int64 40L); (mk_real_int64 44L); (mk_real_int64 288L); ]); +("y3_hi", [7; 9; 12; 13; 15; 17; 20; 21; 27; 30; 34; 36; 37; 45; 46; 53; 57; ], [(mk_real_int64 248L); (mk_real_int64 540L); (mk_real_int64 200L); (mk_real_int64 272L); (mk_real_int64 304L); (mk_real_int64 600L); (mk_real_int64 116L); (mk_real_int64 132L); (mk_real_int64 384L); (mk_real_int64 284L); (mk_real_int64 456L); (mk_real_int64 248L); (mk_real_int64 40L); (mk_real_int64 100L); (mk_real_int64 380L); (mk_real_int64 176L); (mk_real_int64 256L); ]); +("y4_hi", [0; 2; 5; 6; 9; 10; 17; 19; 23; 26; 28; 30; 31; 35; 39; 43; 44; 47; ], [(mk_real_int64 170L); (mk_real_int64 245L); (mk_real_int64 630L); (mk_real_int64 500L); (mk_real_int64 79L); (mk_real_int64 375L); (mk_real_int64 375L); (mk_real_int64 10L); (mk_real_int64 125L); (mk_real_int64 63L); (mk_real_int64 60L); (mk_real_int64 423L); (mk_real_int64 250L); (mk_real_int64 125L); (mk_real_int64 576L); (mk_real_int64 656L); (mk_real_int64 635L); (mk_real_int64 62L); ]); +("y4_lo", [1; 3; 7; 8; 11; 13; 14; 15; 21; 24; 32; 34; 36; 37; 38; 41; ], [(mk_real_int64 327L); (mk_real_int64 339L); (mk_real_int64 28L); (mk_real_int64 35L); (mk_real_int64 1000L); (mk_real_int64 123L); (mk_real_int64 465L); (mk_real_int64 405L); (mk_real_int64 360L); (mk_real_int64 235L); (mk_real_int64 610L); (mk_real_int64 15L); (mk_real_int64 375L); (mk_real_int64 440L); (mk_real_int64 370L); (mk_real_int64 250L); ]); +("y5_lo", [0; 6; 14; 19; 20; 25; 38; 44; 46; 47; 48; 50; 51; 53; 55; 61; ], [(mk_real_int64 182L); (mk_real_int64 248L); (mk_real_int64 596L); (mk_real_int64 448L); (mk_real_int64 329L); (mk_real_int64 344L); (mk_real_int64 416L); (mk_real_int64 84L); (mk_real_int64 375L); (mk_real_int64 264L); (mk_real_int64 272L); (mk_real_int64 86L); (mk_real_int64 332L); (mk_real_int64 424L); (mk_real_int64 250L); (mk_real_int64 138L); ]); +("y5_hi", [7; 8; 9; 11; 12; 13; 15; 16; 17; 21; 23; 27; 29; 30; 32; 34; 36; 37; 45; 57; 58; ], [(mk_real_int64 248L); (mk_real_int64 47L); (mk_real_int64 940L); (mk_real_int64 130L); (mk_real_int64 500L); (mk_real_int64 272L); (mk_real_int64 304L); (mk_real_int64 375L); (mk_real_int64 600L); (mk_real_int64 132L); (mk_real_int64 375L); (mk_real_int64 384L); (mk_real_int64 125L); (mk_real_int64 284L); (mk_real_int64 13L); (mk_real_int64 461L); (mk_real_int64 248L); (mk_real_int64 250L); (mk_real_int64 125L); (mk_real_int64 656L); (mk_real_int64 56L); ]); +("y6_lo", [0; 6; 10; 14; 19; 20; 21; 22; 24; 25; 27; 28; 30; 33; 36; 38; 44; 46; 47; 48; 50; 51; 53; 55; 56; 60; 61; ], [(mk_real_int64 182L); (mk_real_int64 248L); (mk_real_int64 64000L); (mk_real_int64 596L); (mk_real_int64 448L); (mk_real_int64 329L); (mk_real_int64 132000L); (mk_real_int64 204000L); (mk_real_int64 66000L); (mk_real_int64 344L); (mk_real_int64 20000L); (mk_real_int64 98000L); (mk_real_int64 1000L); (mk_real_int64 136000L); (mk_real_int64 253000L); (mk_real_int64 42416L); (mk_real_int64 84L); (mk_real_int64 375L); (mk_real_int64 264L); (mk_real_int64 272L); (mk_real_int64 86L); (mk_real_int64 332L); (mk_real_int64 424L); (mk_real_int64 250L); (mk_real_int64 40000L); (mk_real_int64 113000L); (mk_real_int64 109138L); ]); +("y6_hi", [7; 8; 9; 11; 12; 13; 15; 16; 17; 21; 23; 27; 29; 30; 32; 34; 36; 37; 45; 57; 58; ], [(mk_real_int64 248L); (mk_real_int64 47L); (mk_real_int64 940L); (mk_real_int64 130L); (mk_real_int64 500L); (mk_real_int64 272L); (mk_real_int64 304L); (mk_real_int64 375L); (mk_real_int64 600L); (mk_real_int64 132L); (mk_real_int64 375L); (mk_real_int64 384L); (mk_real_int64 125L); (mk_real_int64 284L); (mk_real_int64 13L); (mk_real_int64 461L); (mk_real_int64 248L); (mk_real_int64 250L); (mk_real_int64 125L); (mk_real_int64 656L); (mk_real_int64 56L); ]); +("ye_hi", [8; 18; 19; 20; 46; 47; 48; 53; 55; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_lo", [9; 11; 13; 16; 17; 21; 30; 38; 56; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 103000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_hi", [0; 1; 5; 6; 7; 8; 9; 11; 12; ], [(mk_real_int64 779L); (mk_real_int64 779L); (mk_real_int64 64L); (mk_real_int64 64L); (mk_real_int64 1064L); (mk_real_int64 2080L); (mk_real_int64 184L); (mk_real_int64 64L); (mk_real_int64 680L); ]); +("yn_lo", [2; 3; 4; 10; 13; ], [(mk_real_int64 772L); (mk_real_int64 816L); (mk_real_int64 816L); (mk_real_int64 1792L); (mk_real_int64 320L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests/28820130324_out.hl b/formal_lp/old/ineqs/tests/28820130324_out.hl new file mode 100644 index 0000000..2d4f206 --- /dev/null +++ b/formal_lp/old/ineqs/tests/28820130324_out.hl @@ -0,0 +1,89 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "28820130324 20 6 0 1 2 3 4 5 3 0 5 6 3 6 5 4 3 6 4 3 3 6 3 7 3 7 3 8 3 8 3 2 3 8 2 9 3 9 2 10 3 10 2 1 3 10 1 11 3 11 1 0 4 11 0 7 12 3 0 6 7 3 12 7 8 3 12 8 9 3 12 9 13 3 13 9 10 3 13 10 11 3 11 12 13 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum_neg", [0; 1; 9; 10; ], [(mk_real_int64 2198L); (mk_real_int64 2199L); (mk_real_int64 85L); (mk_real_int64 49L); ]); +("azim_sum", [7; 8; 13; ], [(mk_real_int64 666L); (mk_real_int64 68L); (mk_real_int64 87L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 249L); (mk_real_int64 249L); (mk_real_int64 1210L); (mk_real_int64 1210L); (mk_real_int64 1210L); (mk_real_int64 1210L); (mk_real_int64 226L); (mk_real_int64 1210L); (mk_real_int64 1159L); (mk_real_int64 880L); (mk_real_int64 880L); (mk_real_int64 1210L); (mk_real_int64 1210L); (mk_real_int64 453L); ]); +("sol_sum3", [1; 7; ], [(mk_real_int64 2175L); (mk_real_int64 49L); ]); +("sol_sum3_neg", [3; 4; 5; 11; 12; ], [(mk_real_int64 843L); (mk_real_int64 68L); (mk_real_int64 50L); (mk_real_int64 844L); (mk_real_int64 68L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; ], [(mk_real_int64 226L); (mk_real_int64 226L); (mk_real_int64 226L); (mk_real_int64 226L); (mk_real_int64 1141L); (mk_real_int64 1159L); (mk_real_int64 880L); (mk_real_int64 880L); (mk_real_int64 880L); (mk_real_int64 880L); (mk_real_int64 1210L); (mk_real_int64 226L); (mk_real_int64 1159L); (mk_real_int64 880L); (mk_real_int64 526L); (mk_real_int64 526L); (mk_real_int64 526L); (mk_real_int64 526L); ]); +("tau_sum4_neg", [0; ], [(mk_real_int64 1210L); ]); +("tau_sum6_neg", [0; ], [(mk_real_int64 1210L); ]); +("ln_def_neg", [2; 3; 4; 5; 7; 8; 11; 12; ], [(mk_real_int64 334L); (mk_real_int64 334L); (mk_real_int64 334L); (mk_real_int64 361L); (mk_real_int64 346L); (mk_real_int64 278L); (mk_real_int64 334L); (mk_real_int64 334L); ]); +("ln_def", [0; 1; 6; 9; 10; 13; ], [(mk_real_int64 725L); (mk_real_int64 725L); (mk_real_int64 751L); (mk_real_int64 30L); (mk_real_int64 30L); (mk_real_int64 501L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 1566L); (mk_real_int64 1566L); (mk_real_int64 7600L); (mk_real_int64 7600L); (mk_real_int64 7600L); (mk_real_int64 7605L); (mk_real_int64 1417L); (mk_real_int64 7600L); (mk_real_int64 7283L); (mk_real_int64 5528L); (mk_real_int64 5528L); (mk_real_int64 7600L); (mk_real_int64 7600L); (mk_real_int64 2843L); ]); +("edge_sym_neg", [1; 7; 19; 20; 23; 25; 26; 29; 35; 40; 42; 48; 51; 53; 54; 57; ], [(mk_real_int64 96L); (mk_real_int64 1033L); (mk_real_int64 17L); (mk_real_int64 17L); (mk_real_int64 151L); (mk_real_int64 38L); (mk_real_int64 111L); (mk_real_int64 359L); (mk_real_int64 239L); (mk_real_int64 780L); (mk_real_int64 377L); (mk_real_int64 202L); (mk_real_int64 241L); (mk_real_int64 224L); (mk_real_int64 40L); (mk_real_int64 139L); ]); +("edge_sym", [8; 11; 14; 16; 28; 32; 34; 60; ], [(mk_real_int64 846L); (mk_real_int64 1033L); (mk_real_int64 2011L); (mk_real_int64 35L); (mk_real_int64 72L); (mk_real_int64 51L); (mk_real_int64 152L); (mk_real_int64 87L); ]); +("y1_def", [7; 13; 15; 19; 21; 27; 30; 33; 44; ], [(mk_real_int64 1087L); (mk_real_int64 1088L); (mk_real_int64 742L); (mk_real_int64 12L); (mk_real_int64 19L); (mk_real_int64 11L); (mk_real_int64 24L); (mk_real_int64 24L); (mk_real_int64 422L); ]); +("y1_def_neg", [6; 8; 9; 10; 14; 17; 20; 23; 24; 25; 26; 28; 32; 34; 35; 37; 45; 46; 47; 49; 50; 51; 52; 53; 54; 55; 56; 57; 59; 60; 61; 62; ], [(mk_real_int64 591L); (mk_real_int64 41L); (mk_real_int64 272L); (mk_real_int64 328L); (mk_real_int64 631L); (mk_real_int64 484L); (mk_real_int64 11L); (mk_real_int64 203L); (mk_real_int64 114L); (mk_real_int64 105L); (mk_real_int64 26L); (mk_real_int64 368L); (mk_real_int64 166L); (mk_real_int64 198L); (mk_real_int64 269L); (mk_real_int64 218L); (mk_real_int64 163L); (mk_real_int64 69L); (mk_real_int64 19L); (mk_real_int64 198L); (mk_real_int64 184L); (mk_real_int64 116L); (mk_real_int64 266L); (mk_real_int64 161L); (mk_real_int64 26L); (mk_real_int64 95L); (mk_real_int64 161L); (mk_real_int64 183L); (mk_real_int64 87L); (mk_real_int64 308L); (mk_real_int64 243L); (mk_real_int64 379L); ]); +("y2_def_neg", [7; 8; 10; 13; 23; 26; 27; 28; 30; 33; 35; 37; 44; 46; 51; 54; 55; ], [(mk_real_int64 331L); (mk_real_int64 41L); (mk_real_int64 328L); (mk_real_int64 331L); (mk_real_int64 203L); (mk_real_int64 82L); (mk_real_int64 13L); (mk_real_int64 21L); (mk_real_int64 7L); (mk_real_int64 7L); (mk_real_int64 46L); (mk_real_int64 218L); (mk_real_int64 128L); (mk_real_int64 81L); (mk_real_int64 171L); (mk_real_int64 26L); (mk_real_int64 95L); ]); +("y2_def", [6; 9; 14; 15; 17; 19; 20; 21; 24; 25; 32; 34; 45; 47; 49; 50; 52; 53; 56; 57; 59; 60; 61; 62; ], [(mk_real_int64 358L); (mk_real_int64 318L); (mk_real_int64 318L); (mk_real_int64 192L); (mk_real_int64 294L); (mk_real_int64 12L); (mk_real_int64 7L); (mk_real_int64 19L); (mk_real_int64 69L); (mk_real_int64 64L); (mk_real_int64 48L); (mk_real_int64 120L); (mk_real_int64 614L); (mk_real_int64 96L); (mk_real_int64 120L); (mk_real_int64 127L); (mk_real_int64 162L); (mk_real_int64 98L); (mk_real_int64 98L); (mk_real_int64 111L); (mk_real_int64 53L); (mk_real_int64 187L); (mk_real_int64 147L); (mk_real_int64 230L); ]); +("y3_def_neg", [7; 8; 10; 13; 23; 26; 27; 28; 30; 33; 35; 37; 44; 46; 51; 54; 55; ], [(mk_real_int64 331L); (mk_real_int64 41L); (mk_real_int64 328L); (mk_real_int64 331L); (mk_real_int64 203L); (mk_real_int64 82L); (mk_real_int64 13L); (mk_real_int64 21L); (mk_real_int64 7L); (mk_real_int64 7L); (mk_real_int64 46L); (mk_real_int64 218L); (mk_real_int64 128L); (mk_real_int64 81L); (mk_real_int64 171L); (mk_real_int64 26L); (mk_real_int64 95L); ]); +("y3_def", [6; 9; 14; 15; 17; 19; 20; 21; 24; 25; 32; 34; 45; 47; 49; 50; 52; 53; 56; 57; 59; 60; 61; 62; ], [(mk_real_int64 358L); (mk_real_int64 318L); (mk_real_int64 318L); (mk_real_int64 192L); (mk_real_int64 294L); (mk_real_int64 12L); (mk_real_int64 7L); (mk_real_int64 19L); (mk_real_int64 69L); (mk_real_int64 64L); (mk_real_int64 48L); (mk_real_int64 120L); (mk_real_int64 614L); (mk_real_int64 96L); (mk_real_int64 120L); (mk_real_int64 127L); (mk_real_int64 162L); (mk_real_int64 98L); (mk_real_int64 98L); (mk_real_int64 111L); (mk_real_int64 53L); (mk_real_int64 187L); (mk_real_int64 147L); (mk_real_int64 230L); ]); +("y4_def", [1; 4; 7; 9; 20; 21; 24; 27; 34; ], [(mk_real_int64 1681L); (mk_real_int64 703L); (mk_real_int64 1681L); (mk_real_int64 486L); (mk_real_int64 18L); (mk_real_int64 44L); (mk_real_int64 38L); (mk_real_int64 38L); (mk_real_int64 652L); ]); +("y4_def_neg", [0; 2; 3; 8; 11; 13; 14; 15; 17; 18; 19; 22; 26; 28; 29; 31; 32; 35; 36; 37; 39; 40; 41; 42; 43; 44; 45; 46; 47; 49; 50; 51; 52; ], [(mk_real_int64 675L); (mk_real_int64 28L); (mk_real_int64 703L); (mk_real_int64 702L); (mk_real_int64 553L); (mk_real_int64 23L); (mk_real_int64 12L); (mk_real_int64 10L); (mk_real_int64 141L); (mk_real_int64 131L); (mk_real_int64 120L); (mk_real_int64 369L); (mk_real_int64 175L); (mk_real_int64 226L); (mk_real_int64 249L); (mk_real_int64 151L); (mk_real_int64 1L); (mk_real_int64 718L); (mk_real_int64 40L); (mk_real_int64 146L); (mk_real_int64 226L); (mk_real_int64 238L); (mk_real_int64 44L); (mk_real_int64 304L); (mk_real_int64 184L); (mk_real_int64 18L); (mk_real_int64 66L); (mk_real_int64 184L); (mk_real_int64 209L); (mk_real_int64 100L); (mk_real_int64 351L); (mk_real_int64 277L); (mk_real_int64 433L); ]); +("y5_def_neg", [7; 8; 13; 15; 19; 21; 23; 26; 30; 33; 35; 37; 44; 46; 51; 54; 55; ], [(mk_real_int64 331L); (mk_real_int64 28L); (mk_real_int64 331L); (mk_real_int64 293L); (mk_real_int64 23L); (mk_real_int64 10L); (mk_real_int64 141L); (mk_real_int64 61L); (mk_real_int64 7L); (mk_real_int64 7L); (mk_real_int64 6L); (mk_real_int64 151L); (mk_real_int64 128L); (mk_real_int64 57L); (mk_real_int64 123L); (mk_real_int64 18L); (mk_real_int64 66L); ]); +("y5_def", [6; 9; 10; 14; 17; 20; 24; 25; 27; 28; 32; 34; 45; 47; 49; 50; 52; 53; 56; 57; 59; 60; 61; 62; ], [(mk_real_int64 358L); (mk_real_int64 330L); (mk_real_int64 703L); (mk_real_int64 330L); (mk_real_int64 294L); (mk_real_int64 7L); (mk_real_int64 69L); (mk_real_int64 64L); (mk_real_int64 10L); (mk_real_int64 28L); (mk_real_int64 58L); (mk_real_int64 120L); (mk_real_int64 128L); (mk_real_int64 57L); (mk_real_int64 120L); (mk_real_int64 127L); (mk_real_int64 162L); (mk_real_int64 98L); (mk_real_int64 98L); (mk_real_int64 111L); (mk_real_int64 53L); (mk_real_int64 187L); (mk_real_int64 147L); (mk_real_int64 230L); ]); +("y6_def_neg", [7; 8; 13; 15; 19; 23; 26; 33; 35; 37; 44; 46; 51; 54; ], [(mk_real_int64 331L); (mk_real_int64 28L); (mk_real_int64 330L); (mk_real_int64 293L); (mk_real_int64 23L); (mk_real_int64 141L); (mk_real_int64 61L); (mk_real_int64 7L); (mk_real_int64 6L); (mk_real_int64 1L); (mk_real_int64 128L); (mk_real_int64 57L); (mk_real_int64 123L); (mk_real_int64 18L); ]); +("y6_def", [6; 9; 10; 14; 17; 20; 21; 22; 24; 25; 27; 28; 30; 32; 34; 38; 45; 47; 49; 50; 52; 53; 55; 56; 57; 58; 59; 60; 61; 62; 63; ], [(mk_real_int64 358L); (mk_real_int64 330L); (mk_real_int64 703L); (mk_real_int64 330L); (mk_real_int64 294L); (mk_real_int64 7L); (mk_real_int64 158L); (mk_real_int64 151L); (mk_real_int64 69L); (mk_real_int64 64L); (mk_real_int64 10L); (mk_real_int64 28L); (mk_real_int64 103L); (mk_real_int64 58L); (mk_real_int64 120L); (mk_real_int64 151L); (mk_real_int64 128L); (mk_real_int64 57L); (mk_real_int64 120L); (mk_real_int64 460L); (mk_real_int64 162L); (mk_real_int64 98L); (mk_real_int64 335L); (mk_real_int64 314L); (mk_real_int64 111L); (mk_real_int64 437L); (mk_real_int64 53L); (mk_real_int64 187L); (mk_real_int64 147L); (mk_real_int64 318L); (mk_real_int64 198L); ]); +("RHA", [0; 7; 10; 11; 13; 16; 17; 18; 19; 22; 23; 24; 25; 31; 32; 35; 40; 43; 45; 46; 47; 52; 53; 56; 57; 59; 60; 61; 62; ], [(mk_real_int64 1L); (mk_real_int64 24L); (mk_real_int64 24L); (mk_real_int64 24L); (mk_real_int64 24L); (mk_real_int64 984L); (mk_real_int64 177L); (mk_real_int64 68L); (mk_real_int64 68L); (mk_real_int64 50L); (mk_real_int64 50L); (mk_real_int64 89L); (mk_real_int64 155L); (mk_real_int64 330L); (mk_real_int64 108L); (mk_real_int64 98L); (mk_real_int64 1L); (mk_real_int64 985L); (mk_real_int64 178L); (mk_real_int64 50L); (mk_real_int64 50L); (mk_real_int64 239L); (mk_real_int64 85L); (mk_real_int64 85L); (mk_real_int64 49L); (mk_real_int64 208L); (mk_real_int64 170L); (mk_real_int64 278L); (mk_real_int64 51L); ]); +("RHB", [54; 55; 58; 63; ], [(mk_real_int64 74L); (mk_real_int64 74L); (mk_real_int64 74L); (mk_real_int64 74L); ]); +("yy10", [1; 8; 15; 16; 40; 42; ], [(mk_real_int64 96L); (mk_real_int64 1165L); (mk_real_int64 1165L); (mk_real_int64 745L); (mk_real_int64 780L); (mk_real_int64 377L); ]); +("tau4", [0; ], [(mk_real_int64 330L); ]); +("tau6", [0; ], [(mk_real_int64 1210L); ]); +("ineq105", [0; ], [(mk_real_int64 1L); ]); +("ineq106", [0; 8; 11; 14; 18; 19; 22; 26; 28; 29; 32; 35; 39; 40; 42; 43; 46; 47; 49; 50; 51; 52; ], [(mk_real_int64 985L); (mk_real_int64 984L); (mk_real_int64 807L); (mk_real_int64 18L); (mk_real_int64 191L); (mk_real_int64 175L); (mk_real_int64 330L); (mk_real_int64 222L); (mk_real_int64 330L); (mk_real_int64 231L); (mk_real_int64 1L); (mk_real_int64 806L); (mk_real_int64 330L); (mk_real_int64 279L); (mk_real_int64 444L); (mk_real_int64 268L); (mk_real_int64 268L); (mk_real_int64 304L); (mk_real_int64 145L); (mk_real_int64 513L); (mk_real_int64 405L); (mk_real_int64 632L); ]); +("ineq107", [1; 5; 7; 9; 20; 21; 24; 27; 34; 36; 41; ], [(mk_real_int64 2175L); (mk_real_int64 1L); (mk_real_int64 2175L); (mk_real_int64 843L); (mk_real_int64 85L); (mk_real_int64 36L); (mk_real_int64 49L); (mk_real_int64 49L); (mk_real_int64 844L); (mk_real_int64 18L); (mk_real_int64 85L); ]); +("ineq108", [3; 22; 37; 40; ], [(mk_real_int64 985L); (mk_real_int64 49L); (mk_real_int64 193L); (mk_real_int64 68L); ]); +("ineq109", [4; 21; ], [(mk_real_int64 2175L); (mk_real_int64 49L); ]); +("ineq110", [9; 13; 15; 35; 37; ], [(mk_real_int64 843L); (mk_real_int64 68L); (mk_real_int64 50L); (mk_real_int64 844L); (mk_real_int64 68L); ]); +("ineq111", [2; 3; 8; 13; 17; 20; 22; 26; 29; 31; 36; 41; 44; 45; ], [(mk_real_int64 226L); (mk_real_int64 226L); (mk_real_int64 226L); (mk_real_int64 78L); (mk_real_int64 1131L); (mk_real_int64 382L); (mk_real_int64 880L); (mk_real_int64 181L); (mk_real_int64 723L); (mk_real_int64 1210L); (mk_real_int64 433L); (mk_real_int64 880L); (mk_real_int64 144L); (mk_real_int64 526L); ]); +("ineq114", [10; 12; 15; 18; 19; 25; 26; 29; 33; 37; 42; 49; 50; 51; 52; ], [(mk_real_int64 226L); (mk_real_int64 1063L); (mk_real_int64 29L); (mk_real_int64 251L); (mk_real_int64 247L); (mk_real_int64 527L); (mk_real_int64 172L); (mk_real_int64 157L); (mk_real_int64 226L); (mk_real_int64 727L); (mk_real_int64 382L); (mk_real_int64 254L); (mk_real_int64 272L); (mk_real_int64 444L); (mk_real_int64 82L); ]); +("ineq116", [3; ], [(mk_real_int64 1190L); ]); +("ineq120", [1; 2; ], [(mk_real_int64 1L); (mk_real_int64 879L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 950L); (mk_real_int64 950L); (mk_real_int64 4000L); (mk_real_int64 4000L); (mk_real_int64 4000L); (mk_real_int64 30125L); (mk_real_int64 1025L); (mk_real_int64 16000L); (mk_real_int64 3475L); (mk_real_int64 2600L); (mk_real_int64 2600L); (mk_real_int64 4000L); (mk_real_int64 4000L); (mk_real_int64 1475L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [4; 5; 16; 21; 24; 35; 41; 43; 47; 52; 54; 55; 58; 59; 60; 62; 63; ], [(mk_real_int64 2199000L); (mk_real_int64 2198000L); (mk_real_int64 476L); (mk_real_int64 154L); (mk_real_int64 126L); (mk_real_int64 282L); (mk_real_int64 282L); (mk_real_int64 476L); (mk_real_int64 102L); (mk_real_int64 132L); (mk_real_int64 24L); (mk_real_int64 24L); (mk_real_int64 24L); (mk_real_int64 4L); (mk_real_int64 272L); (mk_real_int64 332L); (mk_real_int64 24L); ]); +("azim_lo", [7; 10; 11; 18; 25; 31; 32; 40; 61; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 562L); (mk_real_int64 378L); (mk_real_int64 98L); (mk_real_int64 328L); (mk_real_int64 242L); (mk_real_int64 56L); ]); +("rhazim_hi", [0; 4; 5; 6; 7; 10; 11; 13; 24; 38; 40; 43; ], [(mk_real_int64 1000L); (mk_real_int64 961000L); (mk_real_int64 961000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_lo", [18; 19; 22; 23; 35; 46; 47; 52; 53; 54; 55; 56; 57; 58; 59; 60; 61; 62; 63; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_lo", [0; 1; 5; ], [(mk_real_int64 1284L); (mk_real_int64 1284L); (mk_real_int64 1360L); ]); +("rho_hi", [2; 3; 4; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 3640L); (mk_real_int64 3640L); (mk_real_int64 3640L); (mk_real_int64 3184L); (mk_real_int64 3640L); (mk_real_int64 156L); (mk_real_int64 1920L); (mk_real_int64 1920L); (mk_real_int64 3640L); (mk_real_int64 3640L); (mk_real_int64 3652L); ]); +("tau_hi", [6; 14; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("y1_lo", [0; 9; 10; 13; 14; 15; 17; 19; 23; 24; 26; 27; 38; 47; 52; 62; ], [(mk_real_int64 315L); (mk_real_int64 155L); (mk_real_int64 425L); (mk_real_int64 500L); (mk_real_int64 80L); (mk_real_int64 160L); (mk_real_int64 200L); (mk_real_int64 200L); (mk_real_int64 580L); (mk_real_int64 600L); (mk_real_int64 260L); (mk_real_int64 399L); (mk_real_int64 600L); (mk_real_int64 515L); (mk_real_int64 400L); (mk_real_int64 200L); ]); +("y1_hi", [7; 8; 11; 20; 28; 30; 32; 33; 35; 37; 45; 46; 50; 51; 53; 54; 55; 56; 57; 60; ], [(mk_real_int64 500L); (mk_real_int64 320L); (mk_real_int64 500L); (mk_real_int64 200L); (mk_real_int64 85L); (mk_real_int64 500L); (mk_real_int64 220L); (mk_real_int64 500L); (mk_real_int64 260L); (mk_real_int64 200L); (mk_real_int64 120L); (mk_real_int64 60L); (mk_real_int64 620L); (mk_real_int64 100L); (mk_real_int64 200L); (mk_real_int64 80L); (mk_real_int64 320L); (mk_real_int64 200L); (mk_real_int64 600L); (mk_real_int64 200L); ]); +("y2_hi", [0; 6; 7; 8; 13; 15; 24; 26; 27; 28; 32; 34; 37; 38; 45; 46; 47; 49; 54; 55; 61; 62; ], [(mk_real_int64 402L); (mk_real_int64 540L); (mk_real_int64 400L); (mk_real_int64 320L); (mk_real_int64 400L); (mk_real_int64 204L); (mk_real_int64 524L); (mk_real_int64 320L); (mk_real_int64 129L); (mk_real_int64 556L); (mk_real_int64 228L); (mk_real_int64 120L); (mk_real_int64 200L); (mk_real_int64 364L); (mk_real_int64 104L); (mk_real_int64 324L); (mk_real_int64 92L); (mk_real_int64 120L); (mk_real_int64 80L); (mk_real_int64 320L); (mk_real_int64 420L); (mk_real_int64 48L); ]); +("y2_lo", [9; 10; 11; 14; 17; 19; 20; 23; 25; 30; 33; 35; 44; 50; 51; 52; 53; 56; 57; 59; 60; ], [(mk_real_int64 140L); (mk_real_int64 425L); (mk_real_int64 152L); (mk_real_int64 504L); (mk_real_int64 252L); (mk_real_int64 200L); (mk_real_int64 448L); (mk_real_int64 580L); (mk_real_int64 300L); (mk_real_int64 448L); (mk_real_int64 448L); (mk_real_int64 56L); (mk_real_int64 288L); (mk_real_int64 692L); (mk_real_int64 320L); (mk_real_int64 384L); (mk_real_int64 448L); (mk_real_int64 448L); (mk_real_int64 344L); (mk_real_int64 220L); (mk_real_int64 268L); ]); +("y3_hi", [0; 6; 7; 8; 13; 15; 24; 26; 27; 28; 32; 34; 37; 38; 45; 46; 47; 49; 54; 55; 61; 62; ], [(mk_real_int64 402L); (mk_real_int64 540L); (mk_real_int64 400L); (mk_real_int64 320L); (mk_real_int64 400L); (mk_real_int64 204L); (mk_real_int64 524L); (mk_real_int64 320L); (mk_real_int64 129L); (mk_real_int64 556L); (mk_real_int64 228L); (mk_real_int64 120L); (mk_real_int64 200L); (mk_real_int64 364L); (mk_real_int64 104L); (mk_real_int64 324L); (mk_real_int64 92L); (mk_real_int64 120L); (mk_real_int64 80L); (mk_real_int64 320L); (mk_real_int64 420L); (mk_real_int64 48L); ]); +("y3_lo", [9; 10; 11; 14; 17; 19; 20; 23; 25; 30; 33; 35; 44; 50; 51; 52; 53; 56; 57; 59; 60; ], [(mk_real_int64 140L); (mk_real_int64 425L); (mk_real_int64 152L); (mk_real_int64 504L); (mk_real_int64 252L); (mk_real_int64 200L); (mk_real_int64 448L); (mk_real_int64 580L); (mk_real_int64 300L); (mk_real_int64 448L); (mk_real_int64 448L); (mk_real_int64 56L); (mk_real_int64 288L); (mk_real_int64 692L); (mk_real_int64 320L); (mk_real_int64 384L); (mk_real_int64 448L); (mk_real_int64 448L); (mk_real_int64 344L); (mk_real_int64 220L); (mk_real_int64 268L); ]); +("y4_hi", [0; 1; 3; 4; 5; 7; 9; 11; 15; 18; 19; 26; 29; 32; 34; 35; 37; 40; 43; 45; 46; 47; 49; 52; ], [(mk_real_int64 275L); (mk_real_int64 275L); (mk_real_int64 25L); (mk_real_int64 1700L); (mk_real_int64 773L); (mk_real_int64 275L); (mk_real_int64 411L); (mk_real_int64 205L); (mk_real_int64 200L); (mk_real_int64 165L); (mk_real_int64 125L); (mk_real_int64 305L); (mk_real_int64 390L); (mk_real_int64 315L); (mk_real_int64 412L); (mk_real_int64 466L); (mk_real_int64 467L); (mk_real_int64 305L); (mk_real_int64 420L); (mk_real_int64 250L); (mk_real_int64 420L); (mk_real_int64 760L); (mk_real_int64 675L); (mk_real_int64 80L); ]); +("y4_lo", [2; 8; 13; 14; 17; 20; 21; 22; 24; 27; 28; 31; 36; 39; 41; 42; 50; 51; ], [(mk_real_int64 250L); (mk_real_int64 290L); (mk_real_int64 78L); (mk_real_int64 330L); (mk_real_int64 375L); (mk_real_int64 45L); (mk_real_int64 296L); (mk_real_int64 615L); (mk_real_int64 123L); (mk_real_int64 123L); (mk_real_int64 50L); (mk_real_int64 250L); (mk_real_int64 211L); (mk_real_int64 50L); (mk_real_int64 295L); (mk_real_int64 140L); (mk_real_int64 405L); (mk_real_int64 425L); ]); +("y5_hi", [0; 6; 7; 9; 10; 13; 21; 24; 26; 27; 32; 34; 38; 46; 49; 51; 55; 61; 62; ], [(mk_real_int64 402L); (mk_real_int64 540L); (mk_real_int64 400L); (mk_real_int64 290L); (mk_real_int64 1700L); (mk_real_int64 400L); (mk_real_int64 200L); (mk_real_int64 524L); (mk_real_int64 330L); (mk_real_int64 404L); (mk_real_int64 183L); (mk_real_int64 120L); (mk_real_int64 364L); (mk_real_int64 139L); (mk_real_int64 120L); (mk_real_int64 80L); (mk_real_int64 250L); (mk_real_int64 420L); (mk_real_int64 48L); ]); +("y5_lo", [8; 11; 14; 15; 17; 19; 20; 23; 25; 28; 30; 33; 35; 37; 44; 45; 47; 50; 52; 53; 56; 57; 59; 60; ], [(mk_real_int64 250L); (mk_real_int64 152L); (mk_real_int64 74L); (mk_real_int64 364L); (mk_real_int64 252L); (mk_real_int64 78L); (mk_real_int64 448L); (mk_real_int64 375L); (mk_real_int64 300L); (mk_real_int64 44L); (mk_real_int64 448L); (mk_real_int64 448L); (mk_real_int64 291L); (mk_real_int64 250L); (mk_real_int64 288L); (mk_real_int64 40L); (mk_real_int64 76L); (mk_real_int64 692L); (mk_real_int64 384L); (mk_real_int64 448L); (mk_real_int64 448L); (mk_real_int64 344L); (mk_real_int64 220L); (mk_real_int64 268L); ]); +("y6_hi", [0; 6; 7; 9; 10; 13; 21; 24; 26; 27; 30; 32; 34; 37; 38; 46; 49; 50; 51; 55; 56; 61; 62; ], [(mk_real_int64 402L); (mk_real_int64 540L); (mk_real_int64 400L); (mk_real_int64 290L); (mk_real_int64 1700L); (mk_real_int64 400L); (mk_real_int64 200L); (mk_real_int64 524L); (mk_real_int64 330L); (mk_real_int64 404L); (mk_real_int64 552L); (mk_real_int64 183L); (mk_real_int64 120L); (mk_real_int64 750L); (mk_real_int64 364L); (mk_real_int64 139L); (mk_real_int64 120L); (mk_real_int64 308L); (mk_real_int64 80L); (mk_real_int64 250L); (mk_real_int64 552L); (mk_real_int64 420L); (mk_real_int64 48L); ]); +("y6_lo", [8; 11; 13; 14; 15; 17; 19; 20; 21; 22; 23; 25; 28; 30; 33; 35; 37; 38; 44; 45; 47; 50; 52; 53; 55; 56; 57; 58; 59; 60; 62; 63; ], [(mk_real_int64 250L); (mk_real_int64 152L); (mk_real_int64 1000L); (mk_real_int64 74L); (mk_real_int64 364L); (mk_real_int64 252L); (mk_real_int64 78L); (mk_real_int64 448L); (mk_real_int64 168000L); (mk_real_int64 151000L); (mk_real_int64 375L); (mk_real_int64 300L); (mk_real_int64 44L); (mk_real_int64 111000L); (mk_real_int64 448L); (mk_real_int64 291L); (mk_real_int64 151000L); (mk_real_int64 151000L); (mk_real_int64 288L); (mk_real_int64 40L); (mk_real_int64 76L); (mk_real_int64 334000L); (mk_real_int64 384L); (mk_real_int64 448L); (mk_real_int64 401000L); (mk_real_int64 217000L); (mk_real_int64 344L); (mk_real_int64 437000L); (mk_real_int64 220L); (mk_real_int64 268L); (mk_real_int64 88000L); (mk_real_int64 198000L); ]); +("ye_lo", [6; 7; 25; 26; 33; 37; 48; 63; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 90000L); (mk_real_int64 1000L); (mk_real_int64 86000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_hi", [17; 19; 20; 33; 49; 52; 59; 62; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_lo", [0; 5; 8; 10; ], [(mk_real_int64 175L); (mk_real_int64 436L); (mk_real_int64 128L); (mk_real_int64 1690L); ]); +("yn_hi", [1; 2; 3; 4; 6; 7; 9; 11; 12; 13; ], [(mk_real_int64 1825L); (mk_real_int64 1616L); (mk_real_int64 616L); (mk_real_int64 616L); (mk_real_int64 827L); (mk_real_int64 1704L); (mk_real_int64 310L); (mk_real_int64 616L); (mk_real_int64 1616L); (mk_real_int64 1577L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests/62059307362_out.hl b/formal_lp/old/ineqs/tests/62059307362_out.hl new file mode 100644 index 0000000..d40ec5e --- /dev/null +++ b/formal_lp/old/ineqs/tests/62059307362_out.hl @@ -0,0 +1,86 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "62059307362 17 6 0 1 2 3 4 5 3 0 5 6 3 6 5 4 3 6 4 7 3 7 4 8 3 8 4 3 3 8 3 9 3 9 3 2 3 9 2 10 3 10 2 1 3 10 1 11 3 11 1 0 5 11 0 6 7 12 3 12 7 8 3 12 8 9 3 12 9 10 3 10 11 12 ";; +let precision = 4;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum_neg", [0; 8; ], [(mk_real_int64 1953L); (mk_real_int64 253L); ]); +("azim_sum", [12; ], [(mk_real_int64 941L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 9142L); (mk_real_int64 10429L); (mk_real_int64 10429L); (mk_real_int64 10429L); (mk_real_int64 10429L); (mk_real_int64 10429L); (mk_real_int64 10429L); (mk_real_int64 10429L); (mk_real_int64 8871L); (mk_real_int64 7743L); (mk_real_int64 8617L); (mk_real_int64 10429L); (mk_real_int64 10429L); ]); +("sol_sum3", [1; ], [(mk_real_int64 1953L); ]); +("sol_sum3_neg", [4; 6; 8; 11; 13; 14; ], [(mk_real_int64 544L); (mk_real_int64 2687L); (mk_real_int64 531L); (mk_real_int64 1931L); (mk_real_int64 301L); (mk_real_int64 1931L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 9142L); (mk_real_int64 9142L); (mk_real_int64 10429L); (mk_real_int64 8617L); (mk_real_int64 8073L); (mk_real_int64 7743L); (mk_real_int64 7743L); (mk_real_int64 7743L); (mk_real_int64 8087L); (mk_real_int64 8617L); (mk_real_int64 10429L); (mk_real_int64 8499L); (mk_real_int64 7743L); (mk_real_int64 7442L); (mk_real_int64 8499L); ]); +("tau_sum5_neg", [0; ], [(mk_real_int64 10429L); ]); +("tau_sum6_neg", [0; ], [(mk_real_int64 10429L); ]); +("ln_def_neg", [0; 1; 2; 3; 4; 5; 6; 7; 11; 12; ], [(mk_real_int64 79L); (mk_real_int64 1499L); (mk_real_int64 1499L); (mk_real_int64 1499L); (mk_real_int64 1499L); (mk_real_int64 1499L); (mk_real_int64 1499L); (mk_real_int64 1499L); (mk_real_int64 1499L); (mk_real_int64 1499L); ]); +("ln_def", [8; 9; 10; ], [(mk_real_int64 219L); (mk_real_int64 1463L); (mk_real_int64 499L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 57438L); (mk_real_int64 65528L); (mk_real_int64 65528L); (mk_real_int64 65528L); (mk_real_int64 65528L); (mk_real_int64 65528L); (mk_real_int64 65528L); (mk_real_int64 65528L); (mk_real_int64 55737L); (mk_real_int64 48648L); (mk_real_int64 54145L); (mk_real_int64 65528L); (mk_real_int64 65528L); ]); +("edge_sym_neg", [7; 13; 17; 20; 23; 26; 29; 32; 34; 35; 46; 49; ], [(mk_real_int64 928L); (mk_real_int64 1304L); (mk_real_int64 56L); (mk_real_int64 656L); (mk_real_int64 2161L); (mk_real_int64 630L); (mk_real_int64 2160L); (mk_real_int64 1842L); (mk_real_int64 56L); (mk_real_int64 56L); (mk_real_int64 378L); (mk_real_int64 182L); ]); +("edge_sym", [11; 16; 22; 28; 42; 43; 52; ], [(mk_real_int64 1304L); (mk_real_int64 1849L); (mk_real_int64 630L); (mk_real_int64 658L); (mk_real_int64 378L); (mk_real_int64 378L); (mk_real_int64 378L); ]); +("y1_def_neg", [6; 7; 9; 11; 14; 15; 17; 19; 20; 21; 22; 23; 28; 29; 30; 31; 32; 33; 35; 37; 43; 47; 48; 50; 52; ], [(mk_real_int64 537L); (mk_real_int64 469L); (mk_real_int64 567L); (mk_real_int64 295L); (mk_real_int64 1877L); (mk_real_int64 1087L); (mk_real_int64 1030L); (mk_real_int64 1267L); (mk_real_int64 1058L); (mk_real_int64 15L); (mk_real_int64 1612L); (mk_real_int64 476L); (mk_real_int64 1612L); (mk_real_int64 490L); (mk_real_int64 897L); (mk_real_int64 1054L); (mk_real_int64 376L); (mk_real_int64 1030L); (mk_real_int64 1087L); (mk_real_int64 1877L); (mk_real_int64 296L); (mk_real_int64 1313L); (mk_real_int64 1202L); (mk_real_int64 1477L); (mk_real_int64 871L); ]); +("y1_def", [24; 26; 45; 51; 53; ], [(mk_real_int64 341L); (mk_real_int64 1021L); (mk_real_int64 734L); (mk_real_int64 114L); (mk_real_int64 734L); ]); +("y2_def_neg", [7; 11; 14; 17; 19; 23; 24; 29; 30; 33; 37; 48; 52; ], [(mk_real_int64 469L); (mk_real_int64 295L); (mk_real_int64 1877L); (mk_real_int64 1030L); (mk_real_int64 664L); (mk_real_int64 476L); (mk_real_int64 104L); (mk_real_int64 465L); (mk_real_int64 897L); (mk_real_int64 1030L); (mk_real_int64 1877L); (mk_real_int64 688L); (mk_real_int64 690L); ]); +("y2_def", [6; 9; 15; 20; 21; 22; 26; 28; 31; 32; 35; 43; 45; 47; 50; 51; 53; ], [(mk_real_int64 325L); (mk_real_int64 286L); (mk_real_int64 659L); (mk_real_int64 642L); (mk_real_int64 9L); (mk_real_int64 978L); (mk_real_int64 1021L); (mk_real_int64 978L); (mk_real_int64 639L); (mk_real_int64 228L); (mk_real_int64 659L); (mk_real_int64 378L); (mk_real_int64 734L); (mk_real_int64 797L); (mk_real_int64 896L); (mk_real_int64 114L); (mk_real_int64 734L); ]); +("y3_def_neg", [7; 11; 14; 17; 19; 23; 24; 29; 30; 33; 37; 48; 52; ], [(mk_real_int64 469L); (mk_real_int64 295L); (mk_real_int64 1877L); (mk_real_int64 1030L); (mk_real_int64 664L); (mk_real_int64 476L); (mk_real_int64 104L); (mk_real_int64 465L); (mk_real_int64 897L); (mk_real_int64 1030L); (mk_real_int64 1877L); (mk_real_int64 688L); (mk_real_int64 690L); ]); +("y3_def", [6; 9; 15; 20; 21; 22; 26; 28; 31; 32; 35; 43; 45; 47; 50; 51; 53; ], [(mk_real_int64 325L); (mk_real_int64 286L); (mk_real_int64 659L); (mk_real_int64 642L); (mk_real_int64 9L); (mk_real_int64 978L); (mk_real_int64 1021L); (mk_real_int64 978L); (mk_real_int64 639L); (mk_real_int64 228L); (mk_real_int64 659L); (mk_real_int64 378L); (mk_real_int64 734L); (mk_real_int64 797L); (mk_real_int64 896L); (mk_real_int64 114L); (mk_real_int64 734L); ]); +("y4_def_neg", [0; 1; 3; 8; 9; 11; 13; 14; 15; 16; 17; 20; 22; 23; 24; 25; 26; 27; 29; 31; 34; 36; 37; 39; 40; 41; 42; ], [(mk_real_int64 613L); (mk_real_int64 325L); (mk_real_int64 631L); (mk_real_int64 1304L); (mk_real_int64 1241L); (mk_real_int64 715L); (mk_real_int64 1298L); (mk_real_int64 1208L); (mk_real_int64 17L); (mk_real_int64 1840L); (mk_real_int64 330L); (mk_real_int64 527L); (mk_real_int64 1840L); (mk_real_int64 348L); (mk_real_int64 867L); (mk_real_int64 1203L); (mk_real_int64 429L); (mk_real_int64 715L); (mk_real_int64 1241L); (mk_real_int64 1304L); (mk_real_int64 378L); (mk_real_int64 1499L); (mk_real_int64 978L); (mk_real_int64 1686L); (mk_real_int64 59L); (mk_real_int64 655L); (mk_real_int64 378L); ]); +("y4_def", [5; 18; ], [(mk_real_int64 631L); (mk_real_int64 527L); ]); +("y5_def_neg", [7; 14; 17; 19; 23; 24; 26; 29; 30; 33; 37; 45; 48; 51; 52; 53; ], [(mk_real_int64 325L); (mk_real_int64 1304L); (mk_real_int64 715L); (mk_real_int64 642L); (mk_real_int64 330L); (mk_real_int64 104L); (mk_real_int64 527L); (mk_real_int64 320L); (mk_real_int64 867L); (mk_real_int64 715L); (mk_real_int64 1304L); (mk_real_int64 378L); (mk_real_int64 418L); (mk_real_int64 59L); (mk_real_int64 458L); (mk_real_int64 378L); ]); +("y5_def", [6; 9; 11; 15; 20; 21; 22; 28; 31; 32; 35; 43; 47; 50; ], [(mk_real_int64 325L); (mk_real_int64 297L); (mk_real_int64 631L); (mk_real_int64 659L); (mk_real_int64 642L); (mk_real_int64 9L); (mk_real_int64 978L); (mk_real_int64 978L); (mk_real_int64 639L); (mk_real_int64 228L); (mk_real_int64 659L); (mk_real_int64 378L); (mk_real_int64 797L); (mk_real_int64 896L); ]); +("y6_def_neg", [7; 17; 19; 23; 24; 26; 29; 30; 52; ], [(mk_real_int64 325L); (mk_real_int64 715L); (mk_real_int64 642L); (mk_real_int64 330L); (mk_real_int64 104L); (mk_real_int64 527L); (mk_real_int64 320L); (mk_real_int64 867L); (mk_real_int64 458L); ]); +("y6_def", [6; 9; 11; 15; 20; 21; 22; 28; 31; 32; 33; 35; 36; 38; 43; 45; 47; 48; 50; 51; 53; ], [(mk_real_int64 325L); (mk_real_int64 297L); (mk_real_int64 631L); (mk_real_int64 2019L); (mk_real_int64 642L); (mk_real_int64 9L); (mk_real_int64 978L); (mk_real_int64 978L); (mk_real_int64 639L); (mk_real_int64 228L); (mk_real_int64 3083L); (mk_real_int64 659L); (mk_real_int64 1360L); (mk_real_int64 1304L); (mk_real_int64 378L); (mk_real_int64 56L); (mk_real_int64 797L); (mk_real_int64 3661L); (mk_real_int64 896L); (mk_real_int64 4304L); (mk_real_int64 56L); ]); +("RHA", [6; 8; 9; 11; 16; 17; 18; 19; 20; 21; 25; 26; 29; 30; 31; 32; 34; 44; 45; 46; 47; 48; 50; 51; 52; 53; 54; 55; ], [(mk_real_int64 393L); (mk_real_int64 1288L); (mk_real_int64 403L); (mk_real_int64 1288L); (mk_real_int64 1812L); (mk_real_int64 253L); (mk_real_int64 798L); (mk_real_int64 1730L); (mk_real_int64 593L); (mk_real_int64 1103L); (mk_real_int64 2687L); (mk_real_int64 2687L); (mk_real_int64 849L); (mk_real_int64 531L); (mk_real_int64 586L); (mk_real_int64 1716L); (mk_real_int64 1812L); (mk_real_int64 1931L); (mk_real_int64 1931L); (mk_real_int64 372L); (mk_real_int64 498L); (mk_real_int64 594L); (mk_real_int64 526L); (mk_real_int64 301L); (mk_real_int64 988L); (mk_real_int64 119L); (mk_real_int64 1931L); (mk_real_int64 1931L); ]); +("tau5", [0; ], [(mk_real_int64 10429L); ]); +("tau6", [0; ], [(mk_real_int64 10429L); ]); +("ineq105", [10; ], [(mk_real_int64 941L); ]); +("ineq106", [0; 3; 9; 13; 14; 15; 16; 22; 23; 25; 26; 29; 36; 37; 39; 41; ], [(mk_real_int64 894L); (mk_real_int64 885L); (mk_real_int64 1812L); (mk_real_int64 626L); (mk_real_int64 1763L); (mk_real_int64 25L); (mk_real_int64 2687L); (mk_real_int64 2687L); (mk_real_int64 26L); (mk_real_int64 1756L); (mk_real_int64 627L); (mk_real_int64 1812L); (mk_real_int64 2189L); (mk_real_int64 534L); (mk_real_int64 2461L); (mk_real_int64 188L); ]); +("ineq107", [18; ], [(mk_real_int64 681L); ]); +("ineq109", [5; ], [(mk_real_int64 1953L); ]); +("ineq110", [13; 20; 24; 34; 40; 42; ], [(mk_real_int64 544L); (mk_real_int64 2687L); (mk_real_int64 531L); (mk_real_int64 1931L); (mk_real_int64 301L); (mk_real_int64 1931L); ]); +("ineq111", [1; 3; 8; 11; 13; 17; 23; 24; 27; 31; 37; 41; ], [(mk_real_int64 2604L); (mk_real_int64 201L); (mk_real_int64 10429L); (mk_real_int64 5723L); (mk_real_int64 6101L); (mk_real_int64 2643L); (mk_real_int64 2637L); (mk_real_int64 6105L); (mk_real_int64 5723L); (mk_real_int64 10429L); (mk_real_int64 4899L); (mk_real_int64 4212L); ]); +("ineq112", [1; ], [(mk_real_int64 3853L); ]); +("ineq113", [18; 35; 42; ], [(mk_real_int64 7743L); (mk_real_int64 6995L); (mk_real_int64 6995L); ]); +("ineq114", [0; 2; 3; 5; 10; 13; 14; 15; 23; 25; 26; 28; 33; 36; 37; 39; 41; 44; ], [(mk_real_int64 628L); (mk_real_int64 2057L); (mk_real_int64 3764L); (mk_real_int64 5177L); (mk_real_int64 2894L); (mk_real_int64 1894L); (mk_real_int64 78L); (mk_real_int64 1357L); (mk_real_int64 1356L); (mk_real_int64 89L); (mk_real_int64 1893L); (mk_real_int64 2894L); (mk_real_int64 1504L); (mk_real_int64 2299L); (mk_real_int64 545L); (mk_real_int64 1864L); (mk_real_int64 1098L); (mk_real_int64 1504L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 43748L); (mk_real_int64 53888L); (mk_real_int64 53888L); (mk_real_int64 53888L); (mk_real_int64 53888L); (mk_real_int64 53888L); (mk_real_int64 53888L); (mk_real_int64 53888L); (mk_real_int64 47302L); (mk_real_int64 41408L); (mk_real_int64 39670L); (mk_real_int64 53888L); (mk_real_int64 53888L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [5; 6; 9; 24; 31; 32; 44; 46; 47; 48; 50; 52; 53; 55; ], [(mk_real_int64 19530000L); (mk_real_int64 1280L); (mk_real_int64 2640L); (mk_real_int64 5630L); (mk_real_int64 7140L); (mk_real_int64 180L); (mk_real_int64 5040L); (mk_real_int64 2950L); (mk_real_int64 1740L); (mk_real_int64 1700L); (mk_real_int64 8640L); (mk_real_int64 3480L); (mk_real_int64 2950L); (mk_real_int64 5040L); ]); +("azim_lo", [7; 8; 11; 16; 18; 19; 20; 21; 29; 34; ], [(mk_real_int64 4710L); (mk_real_int64 3180L); (mk_real_int64 1980L); (mk_real_int64 3560L); (mk_real_int64 10000L); (mk_real_int64 3560L); (mk_real_int64 1720L); (mk_real_int64 5180L); (mk_real_int64 1440L); (mk_real_int64 3560L); ]); +("rhazim_hi", [5; 8; 9; 11; 22; 25; 26; 28; 29; 30; 32; 44; 45; 47; 52; 53; 54; 55; ], [(mk_real_int64 12880000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("rhazim_lo", [5; 17; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("rho_lo", [1; 2; 3; 4; 5; 6; 7; 10; 11; 12; ], [(mk_real_int64 5072L); (mk_real_int64 5072L); (mk_real_int64 5072L); (mk_real_int64 5072L); (mk_real_int64 5072L); (mk_real_int64 5072L); (mk_real_int64 5072L); (mk_real_int64 26656L); (mk_real_int64 5072L); (mk_real_int64 5072L); ]); +("rho_hi", [0; 8; 9; ], [(mk_real_int64 30144L); (mk_real_int64 12672L); (mk_real_int64 28176L); ]); +("tau_lo", [6; 8; 15; ], [(mk_real_int64 37430000L); (mk_real_int64 37500000L); (mk_real_int64 2680000L); ]); +("y1_hi", [6; 7; 11; 20; 23; 26; 31; 50; 51; 52; ], [(mk_real_int64 6000L); (mk_real_int64 2800L); (mk_real_int64 970L); (mk_real_int64 2000L); (mk_real_int64 2600L); (mk_real_int64 600L); (mk_real_int64 4000L); (mk_real_int64 4000L); (mk_real_int64 3800L); (mk_real_int64 400L); ]); +("y1_lo", [9; 14; 15; 17; 19; 22; 24; 28; 29; 30; 32; 33; 35; 37; 43; 45; 47; 48; 53; ], [(mk_real_int64 1800L); (mk_real_int64 2200L); (mk_real_int64 2000L); (mk_real_int64 1400L); (mk_real_int64 600L); (mk_real_int64 2000L); (mk_real_int64 5000L); (mk_real_int64 2000L); (mk_real_int64 2600L); (mk_real_int64 1200L); (mk_real_int64 2000L); (mk_real_int64 1400L); (mk_real_int64 2000L); (mk_real_int64 2200L); (mk_real_int64 4150L); (mk_real_int64 2200L); (mk_real_int64 4000L); (mk_real_int64 2200L); (mk_real_int64 2200L); ]); +("y2_hi", [6; 7; 11; 15; 19; 21; 23; 24; 26; 31; 32; 35; 43; 48; 51; 52; ], [(mk_real_int64 3266L); (mk_real_int64 2800L); (mk_real_int64 970L); (mk_real_int64 3868L); (mk_real_int64 3414L); (mk_real_int64 975L); (mk_real_int64 2600L); (mk_real_int64 4880L); (mk_real_int64 600L); (mk_real_int64 84L); (mk_real_int64 1653L); (mk_real_int64 3868L); (mk_real_int64 2820L); (mk_real_int64 5026L); (mk_real_int64 3800L); (mk_real_int64 2532L); ]); +("y2_lo", [9; 14; 17; 20; 22; 28; 29; 30; 33; 37; 45; 47; 50; 53; ], [(mk_real_int64 1285L); (mk_real_int64 2200L); (mk_real_int64 1400L); (mk_real_int64 4443L); (mk_real_int64 2007L); (mk_real_int64 2007L); (mk_real_int64 1986L); (mk_real_int64 1200L); (mk_real_int64 1400L); (mk_real_int64 2200L); (mk_real_int64 2200L); (mk_real_int64 4229L); (mk_real_int64 4421L); (mk_real_int64 2200L); ]); +("y3_hi", [6; 7; 11; 15; 19; 21; 23; 24; 26; 31; 32; 35; 43; 48; 51; 52; ], [(mk_real_int64 3266L); (mk_real_int64 2800L); (mk_real_int64 970L); (mk_real_int64 3868L); (mk_real_int64 3414L); (mk_real_int64 975L); (mk_real_int64 2600L); (mk_real_int64 4880L); (mk_real_int64 600L); (mk_real_int64 84L); (mk_real_int64 1653L); (mk_real_int64 3868L); (mk_real_int64 2820L); (mk_real_int64 5026L); (mk_real_int64 3800L); (mk_real_int64 2532L); ]); +("y3_lo", [9; 14; 17; 20; 22; 28; 29; 30; 33; 37; 45; 47; 50; 53; ], [(mk_real_int64 1285L); (mk_real_int64 2200L); (mk_real_int64 1400L); (mk_real_int64 4443L); (mk_real_int64 2007L); (mk_real_int64 2007L); (mk_real_int64 1986L); (mk_real_int64 1200L); (mk_real_int64 1400L); (mk_real_int64 2200L); (mk_real_int64 2200L); (mk_real_int64 4229L); (mk_real_int64 4421L); (mk_real_int64 2200L); ]); +("y4_hi", [0; 5; 8; 14; 20; 23; 25; 31; 39; 40; ], [(mk_real_int64 6100L); (mk_real_int64 2096L); (mk_real_int64 3750L); (mk_real_int64 3450L); (mk_real_int64 3480L); (mk_real_int64 5650L); (mk_real_int64 1400L); (mk_real_int64 3750L); (mk_real_int64 2150L); (mk_real_int64 40L); ]); +("y4_lo", [1; 3; 9; 11; 13; 15; 16; 17; 18; 22; 24; 26; 27; 29; 34; 36; 37; 41; 42; ], [(mk_real_int64 5000L); (mk_real_int64 3500L); (mk_real_int64 2200L); (mk_real_int64 3750L); (mk_real_int64 590L); (mk_real_int64 1250L); (mk_real_int64 5950L); (mk_real_int64 3750L); (mk_real_int64 5870L); (mk_real_int64 5950L); (mk_real_int64 2010L); (mk_real_int64 4950L); (mk_real_int64 3750L); (mk_real_int64 2200L); (mk_real_int64 4760L); (mk_real_int64 4650L); (mk_real_int64 1650L); (mk_real_int64 2800L); (mk_real_int64 4760L); ]); +("y5_hi", [6; 11; 14; 15; 19; 21; 24; 26; 31; 32; 35; 37; 43; 51; ], [(mk_real_int64 3266L); (mk_real_int64 2096L); (mk_real_int64 3750L); (mk_real_int64 3868L); (mk_real_int64 5524L); (mk_real_int64 975L); (mk_real_int64 4880L); (mk_real_int64 3480L); (mk_real_int64 84L); (mk_real_int64 1653L); (mk_real_int64 3868L); (mk_real_int64 3750L); (mk_real_int64 2820L); (mk_real_int64 40L); ]); +("y5_lo", [7; 9; 17; 20; 22; 23; 28; 29; 30; 33; 45; 47; 48; 50; 52; 53; ], [(mk_real_int64 5000L); (mk_real_int64 735L); (mk_real_int64 3750L); (mk_real_int64 4443L); (mk_real_int64 2007L); (mk_real_int64 3750L); (mk_real_int64 2007L); (mk_real_int64 1636L); (mk_real_int64 2010L); (mk_real_int64 3750L); (mk_real_int64 4760L); (mk_real_int64 4229L); (mk_real_int64 524L); (mk_real_int64 4421L); (mk_real_int64 868L); (mk_real_int64 4760L); ]); +("y6_lo", [7; 9; 14; 15; 17; 20; 22; 23; 28; 29; 30; 33; 36; 37; 38; 45; 47; 48; 50; 51; 52; 53; ], [(mk_real_int64 5000L); (mk_real_int64 735L); (mk_real_int64 13040000L); (mk_real_int64 13600000L); (mk_real_int64 3750L); (mk_real_int64 4443L); (mk_real_int64 2007L); (mk_real_int64 3750L); (mk_real_int64 2007L); (mk_real_int64 1636L); (mk_real_int64 2010L); (mk_real_int64 37983750L); (mk_real_int64 13600000L); (mk_real_int64 13040000L); (mk_real_int64 13040000L); (mk_real_int64 4350000L); (mk_real_int64 4229L); (mk_real_int64 40790524L); (mk_real_int64 4421L); (mk_real_int64 43630000L); (mk_real_int64 868L); (mk_real_int64 4350000L); ]); +("y6_hi", [6; 11; 14; 15; 19; 21; 24; 26; 31; 32; 35; 37; 43; 45; 51; 53; ], [(mk_real_int64 3266L); (mk_real_int64 2096L); (mk_real_int64 3750L); (mk_real_int64 3868L); (mk_real_int64 5524L); (mk_real_int64 975L); (mk_real_int64 4880L); (mk_real_int64 3480L); (mk_real_int64 84L); (mk_real_int64 1653L); (mk_real_int64 3868L); (mk_real_int64 3750L); (mk_real_int64 2820L); (mk_real_int64 5240L); (mk_real_int64 40L); (mk_real_int64 5240L); ]); +("ye_hi", [16; 21; 22; 30; 47; 48; 49; 52; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("ye_lo", [7; 11; 16; 18; 24; 26; ], [(mk_real_int64 100000L); (mk_real_int64 3760000L); (mk_real_int64 38060000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("yn_lo", [0; 2; 3; 5; 6; ], [(mk_real_int64 10751L); (mk_real_int64 12731L); (mk_real_int64 2731L); (mk_real_int64 2731L); (mk_real_int64 2731L); ]); +("yn_hi", [1; 4; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 7269L); (mk_real_int64 7269L); (mk_real_int64 7269L); (mk_real_int64 18630L); (mk_real_int64 16510L); (mk_real_int64 4230L); (mk_real_int64 7269L); (mk_real_int64 7269L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests/63917576180_out.hl b/formal_lp/old/ineqs/tests/63917576180_out.hl new file mode 100644 index 0000000..e4627cf --- /dev/null +++ b/formal_lp/old/ineqs/tests/63917576180_out.hl @@ -0,0 +1,90 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "63917576180 21 6 0 1 2 3 4 5 3 0 5 6 3 6 5 4 3 6 4 7 3 7 4 8 3 8 4 3 3 8 3 9 3 9 3 2 4 9 2 10 11 3 10 2 1 3 10 1 12 3 12 1 0 3 12 0 13 4 13 0 6 7 3 13 7 14 3 14 7 8 3 14 8 9 3 14 9 11 3 13 14 11 3 12 13 11 3 11 10 12 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [3; 9; 11; 12; ], [(mk_real_int64 84L); (mk_real_int64 242L); (mk_real_int64 182L); (mk_real_int64 322L); ]); +("azim_sum_neg", [0; 6; 8; 13; 14; ], [(mk_real_int64 280L); (mk_real_int64 229L); (mk_real_int64 90L); (mk_real_int64 49L); (mk_real_int64 93L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 939L); (mk_real_int64 1146L); (mk_real_int64 1146L); (mk_real_int64 1075L); (mk_real_int64 1146L); (mk_real_int64 1146L); (mk_real_int64 992L); (mk_real_int64 1146L); (mk_real_int64 1146L); (mk_real_int64 1146L); (mk_real_int64 1146L); (mk_real_int64 1146L); (mk_real_int64 1096L); (mk_real_int64 1052L); (mk_real_int64 1096L); ]); +("sol_sum3", [0; 1; 8; 17; ], [(mk_real_int64 176L); (mk_real_int64 183L); (mk_real_int64 49L); (mk_real_int64 49L); ]); +("sol_sum3_neg", [14; 15; ], [(mk_real_int64 51L); (mk_real_int64 90L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; ], [(mk_real_int64 939L); (mk_real_int64 939L); (mk_real_int64 992L); (mk_real_int64 1146L); (mk_real_int64 1146L); (mk_real_int64 1146L); (mk_real_int64 1146L); (mk_real_int64 1052L); (mk_real_int64 1052L); (mk_real_int64 1096L); (mk_real_int64 1096L); (mk_real_int64 1146L); (mk_real_int64 1051L); (mk_real_int64 1056L); (mk_real_int64 1096L); (mk_real_int64 1096L); (mk_real_int64 1096L); (mk_real_int64 1052L); ]); +("tau_sum4_neg", [0; 1; ], [(mk_real_int64 1075L); (mk_real_int64 1146L); ]); +("tau_sum6_neg", [0; ], [(mk_real_int64 1146L); ]); +("ln_def_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 35L); (mk_real_int64 264L); (mk_real_int64 264L); (mk_real_int64 185L); (mk_real_int64 264L); (mk_real_int64 264L); (mk_real_int64 94L); (mk_real_int64 264L); (mk_real_int64 264L); (mk_real_int64 264L); (mk_real_int64 264L); (mk_real_int64 264L); (mk_real_int64 208L); (mk_real_int64 160L); (mk_real_int64 208L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 5898L); (mk_real_int64 7202L); (mk_real_int64 7202L); (mk_real_int64 6756L); (mk_real_int64 7202L); (mk_real_int64 7202L); (mk_real_int64 6236L); (mk_real_int64 7202L); (mk_real_int64 7202L); (mk_real_int64 7202L); (mk_real_int64 7202L); (mk_real_int64 7202L); (mk_real_int64 6883L); (mk_real_int64 6608L); (mk_real_int64 6883L); ]); +("edge_sym", [0; 1; 11; 13; 28; 35; 39; 52; 55; ], [(mk_real_int64 28L); (mk_real_int64 36L); (mk_real_int64 98L); (mk_real_int64 115L); (mk_real_int64 81L); (mk_real_int64 168L); (mk_real_int64 86L); (mk_real_int64 264L); (mk_real_int64 10L); ]); +("edge_sym_neg", [7; 16; 17; 20; 22; 23; 26; 33; 36; 42; 48; 49; 61; 64; ], [(mk_real_int64 7L); (mk_real_int64 37L); (mk_real_int64 37L); (mk_real_int64 157L); (mk_real_int64 25L); (mk_real_int64 109L); (mk_real_int64 21L); (mk_real_int64 193L); (mk_real_int64 87L); (mk_real_int64 139L); (mk_real_int64 268L); (mk_real_int64 77L); (mk_real_int64 46L); (mk_real_int64 40L); ]); +("y1_def", [7; 10; 12; 18; 21; 31; 57; 60; 62; ], [(mk_real_int64 26L); (mk_real_int64 49L); (mk_real_int64 115L); (mk_real_int64 45L); (mk_real_int64 45L); (mk_real_int64 25L); (mk_real_int64 19L); (mk_real_int64 20L); (mk_real_int64 9L); ]); +("y1_def_neg", [6; 9; 11; 13; 16; 17; 20; 23; 25; 28; 32; 33; 34; 36; 37; 38; 39; 40; 41; 47; 48; 50; 51; 53; 55; 58; 59; 65; 66; ], [(mk_real_int64 67L); (mk_real_int64 61L); (mk_real_int64 28L); (mk_real_int64 90L); (mk_real_int64 92L); (mk_real_int64 17L); (mk_real_int64 206L); (mk_real_int64 137L); (mk_real_int64 137L); (mk_real_int64 17L); (mk_real_int64 34L); (mk_real_int64 162L); (mk_real_int64 7L); (mk_real_int64 148L); (mk_real_int64 150L); (mk_real_int64 29L); (mk_real_int64 30L); (mk_real_int64 84L); (mk_real_int64 30L); (mk_real_int64 43L); (mk_real_int64 206L); (mk_real_int64 223L); (mk_real_int64 46L); (mk_real_int64 54L); (mk_real_int64 264L); (mk_real_int64 191L); (mk_real_int64 75L); (mk_real_int64 26L); (mk_real_int64 90L); ]); +("y2_def_neg", [6; 7; 9; 10; 11; 12; 13; 16; 18; 20; 21; 23; 25; 31; 33; 34; 36; 37; 40; 48; 50; 55; 58; 59; 60; 62; 66; ], [(mk_real_int64 60L); (mk_real_int64 42L); (mk_real_int64 54L); (mk_real_int64 15L); (mk_real_int64 28L); (mk_real_int64 35L); (mk_real_int64 90L); (mk_real_int64 92L); (mk_real_int64 14L); (mk_real_int64 206L); (mk_real_int64 14L); (mk_real_int64 137L); (mk_real_int64 137L); (mk_real_int64 7L); (mk_real_int64 162L); (mk_real_int64 7L); (mk_real_int64 148L); (mk_real_int64 211L); (mk_real_int64 144L); (mk_real_int64 206L); (mk_real_int64 131L); (mk_real_int64 75L); (mk_real_int64 29L); (mk_real_int64 54L); (mk_real_int64 6L); (mk_real_int64 52L); (mk_real_int64 90L); ]); +("y2_def", [17; 28; 32; 38; 39; 41; 47; 51; 53; 57; 65; ], [(mk_real_int64 27L); (mk_real_int64 21L); (mk_real_int64 39L); (mk_real_int64 18L); (mk_real_int64 18L); (mk_real_int64 18L); (mk_real_int64 66L); (mk_real_int64 28L); (mk_real_int64 33L); (mk_real_int64 19L); (mk_real_int64 16L); ]); +("y3_def_neg", [6; 7; 9; 10; 11; 12; 13; 16; 18; 20; 21; 23; 25; 31; 33; 34; 36; 37; 40; 48; 50; 55; 58; 59; 60; 62; 66; ], [(mk_real_int64 60L); (mk_real_int64 42L); (mk_real_int64 54L); (mk_real_int64 15L); (mk_real_int64 28L); (mk_real_int64 35L); (mk_real_int64 90L); (mk_real_int64 92L); (mk_real_int64 14L); (mk_real_int64 206L); (mk_real_int64 14L); (mk_real_int64 137L); (mk_real_int64 137L); (mk_real_int64 7L); (mk_real_int64 162L); (mk_real_int64 7L); (mk_real_int64 148L); (mk_real_int64 211L); (mk_real_int64 144L); (mk_real_int64 206L); (mk_real_int64 131L); (mk_real_int64 75L); (mk_real_int64 29L); (mk_real_int64 54L); (mk_real_int64 6L); (mk_real_int64 52L); (mk_real_int64 90L); ]); +("y3_def", [17; 28; 32; 38; 39; 41; 47; 51; 53; 57; 65; ], [(mk_real_int64 27L); (mk_real_int64 21L); (mk_real_int64 39L); (mk_real_int64 18L); (mk_real_int64 18L); (mk_real_int64 18L); (mk_real_int64 66L); (mk_real_int64 28L); (mk_real_int64 33L); (mk_real_int64 19L); (mk_real_int64 16L); ]); +("y4_def", [1; 4; 5; 6; 12; 15; 21; 24; 46; 48; ], [(mk_real_int64 138L); (mk_real_int64 75L); (mk_real_int64 59L); (mk_real_int64 177L); (mk_real_int64 70L); (mk_real_int64 70L); (mk_real_int64 38L); (mk_real_int64 16L); (mk_real_int64 30L); (mk_real_int64 46L); ]); +("y4_def_neg", [0; 3; 7; 10; 11; 14; 17; 19; 22; 23; 26; 27; 28; 29; 30; 31; 33; 34; 36; 37; 39; 41; 43; 44; 45; 51; 52; ], [(mk_real_int64 48L); (mk_real_int64 44L); (mk_real_int64 63L); (mk_real_int64 64L); (mk_real_int64 50L); (mk_real_int64 143L); (mk_real_int64 95L); (mk_real_int64 95L); (mk_real_int64 73L); (mk_real_int64 113L); (mk_real_int64 103L); (mk_real_int64 65L); (mk_real_int64 33L); (mk_real_int64 35L); (mk_real_int64 18L); (mk_real_int64 35L); (mk_real_int64 125L); (mk_real_int64 143L); (mk_real_int64 180L); (mk_real_int64 53L); (mk_real_int64 62L); (mk_real_int64 297L); (mk_real_int64 10L); (mk_real_int64 274L); (mk_real_int64 99L); (mk_real_int64 30L); (mk_real_int64 41L); ]); +("y5_def", [7; 11; 17; 28; 32; 34; 38; 39; 41; 47; 51; 53; 58; 65; ], [(mk_real_int64 41L); (mk_real_int64 59L); (mk_real_int64 27L); (mk_real_int64 21L); (mk_real_int64 39L); (mk_real_int64 16L); (mk_real_int64 18L); (mk_real_int64 18L); (mk_real_int64 18L); (mk_real_int64 66L); (mk_real_int64 28L); (mk_real_int64 33L); (mk_real_int64 10L); (mk_real_int64 16L); ]); +("y5_def_neg", [6; 9; 10; 12; 13; 16; 18; 20; 21; 23; 25; 31; 33; 36; 37; 40; 48; 50; 55; 57; 59; 60; 62; 66; ], [(mk_real_int64 41L); (mk_real_int64 37L); (mk_real_int64 15L); (mk_real_int64 35L); (mk_real_int64 63L); (mk_real_int64 64L); (mk_real_int64 14L); (mk_real_int64 143L); (mk_real_int64 14L); (mk_real_int64 95L); (mk_real_int64 95L); (mk_real_int64 7L); (mk_real_int64 113L); (mk_real_int64 103L); (mk_real_int64 151L); (mk_real_int64 105L); (mk_real_int64 143L); (mk_real_int64 80L); (mk_real_int64 23L); (mk_real_int64 10L); (mk_real_int64 76L); (mk_real_int64 6L); (mk_real_int64 40L); (mk_real_int64 41L); ]); +("y6_def", [7; 11; 14; 17; 18; 19; 21; 24; 26; 28; 32; 34; 38; 39; 41; 47; 50; 51; 53; 54; 56; 58; 59; 60; 62; 65; 66; ], [(mk_real_int64 41L); (mk_real_int64 59L); (mk_real_int64 98L); (mk_real_int64 27L); (mk_real_int64 181L); (mk_real_int64 74L); (mk_real_int64 252L); (mk_real_int64 120L); (mk_real_int64 74L); (mk_real_int64 81L); (mk_real_int64 39L); (mk_real_int64 296L); (mk_real_int64 18L); (mk_real_int64 270L); (mk_real_int64 18L); (mk_real_int64 143L); (mk_real_int64 240L); (mk_real_int64 218L); (mk_real_int64 33L); (mk_real_int64 193L); (mk_real_int64 274L); (mk_real_int64 10L); (mk_real_int64 83L); (mk_real_int64 99L); (mk_real_int64 139L); (mk_real_int64 41L); (mk_real_int64 117L); ]); +("y6_def_neg", [6; 9; 10; 12; 13; 16; 20; 23; 31; 33; 36; 37; 40; 48; 55; 57; ], [(mk_real_int64 41L); (mk_real_int64 37L); (mk_real_int64 15L); (mk_real_int64 35L); (mk_real_int64 63L); (mk_real_int64 64L); (mk_real_int64 143L); (mk_real_int64 95L); (mk_real_int64 7L); (mk_real_int64 113L); (mk_real_int64 103L); (mk_real_int64 151L); (mk_real_int64 105L); (mk_real_int64 143L); (mk_real_int64 23L); (mk_real_int64 10L); ]); +("RHA", [6; 8; 9; 11; 13; 14; 27; 30; 33; 35; 36; 38; 42; 51; 52; 54; 56; 57; 59; 60; 63; 67; ], [(mk_real_int64 201L); (mk_real_int64 54L); (mk_real_int64 47L); (mk_real_int64 208L); (mk_real_int64 154L); (mk_real_int64 154L); (mk_real_int64 71L); (mk_real_int64 20L); (mk_real_int64 95L); (mk_real_int64 95L); (mk_real_int64 44L); (mk_real_int64 2L); (mk_real_int64 51L); (mk_real_int64 19L); (mk_real_int64 96L); (mk_real_int64 90L); (mk_real_int64 51L); (mk_real_int64 51L); (mk_real_int64 29L); (mk_real_int64 51L); (mk_real_int64 51L); (mk_real_int64 44L); ]); +("RHB", [2; 5; 26; 29; 45; ], [(mk_real_int64 71L); (mk_real_int64 208L); (mk_real_int64 71L); (mk_real_int64 23L); (mk_real_int64 154L); ]); +("yy10", [8; ], [(mk_real_int64 97L); ]); +("tau6", [0; ], [(mk_real_int64 1146L); ]); +("ineq105", [7; ], [(mk_real_int64 53L); ]); +("ineq106", [0; 3; 22; 28; 29; 31; 36; 37; 39; 41; 45; 51; ], [(mk_real_int64 7L); (mk_real_int64 7L); (mk_real_int64 23L); (mk_real_int64 48L); (mk_real_int64 51L); (mk_real_int64 51L); (mk_real_int64 96L); (mk_real_int64 77L); (mk_real_int64 90L); (mk_real_int64 90L); (mk_real_int64 22L); (mk_real_int64 44L); ]); +("ineq107", [1; 4; 6; 12; 15; 21; 27; 30; 46; 48; ], [(mk_real_int64 104L); (mk_real_int64 98L); (mk_real_int64 229L); (mk_real_int64 90L); (mk_real_int64 90L); (mk_real_int64 49L); (mk_real_int64 93L); (mk_real_int64 93L); (mk_real_int64 39L); (mk_real_int64 93L); ]); +("ineq108", [11; 22; 33; 41; 44; ], [(mk_real_int64 74L); (mk_real_int64 84L); (mk_real_int64 182L); (mk_real_int64 171L); (mk_real_int64 271L); ]); +("ineq109", [1; 5; 24; 52; ], [(mk_real_int64 176L); (mk_real_int64 183L); (mk_real_int64 49L); (mk_real_int64 49L); ]); +("ineq110", [43; 45; ], [(mk_real_int64 51L); (mk_real_int64 90L); ]); +("ineq111", [0; 3; 7; 10; 14; 17; 19; 23; 26; 27; 30; 34; 36; 41; 44; 45; 48; 52; ], [(mk_real_int64 347L); (mk_real_int64 315L); (mk_real_int64 501L); (mk_real_int64 514L); (mk_real_int64 1146L); (mk_real_int64 760L); (mk_real_int64 760L); (mk_real_int64 901L); (mk_real_int64 822L); (mk_real_int64 1092L); (mk_real_int64 723L); (mk_real_int64 1146L); (mk_real_int64 919L); (mk_real_int64 944L); (mk_real_int64 709L); (mk_real_int64 532L); (mk_real_int64 209L); (mk_real_int64 459L); ]); +("ineq113", [11; ], [(mk_real_int64 633L); ]); +("ineq114", [0; 5; 7; 8; 17; 18; 23; 25; 28; 32; 37; 38; 41; 43; 45; 47; 49; 50; 51; ], [(mk_real_int64 591L); (mk_real_int64 623L); (mk_real_int64 246L); (mk_real_int64 246L); (mk_real_int64 386L); (mk_real_int64 386L); (mk_real_int64 151L); (mk_real_int64 230L); (mk_real_int64 4L); (mk_real_int64 372L); (mk_real_int64 30L); (mk_real_int64 9L); (mk_real_int64 112L); (mk_real_int64 386L); (mk_real_int64 193L); (mk_real_int64 370L); (mk_real_int64 372L); (mk_real_int64 514L); (mk_real_int64 593L); ]); +("ineq116", [0; ], [(mk_real_int64 6L); ]); +("ineq119", [2; 6; ], [(mk_real_int64 170L); (mk_real_int64 905L); ]); +("ineq120", [0; 1; 3; 4; ], [(mk_real_int64 413L); (mk_real_int64 41L); (mk_real_int64 452L); (mk_real_int64 241L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 2850L); (mk_real_int64 3650L); (mk_real_int64 3650L); (mk_real_int64 2700L); (mk_real_int64 3650L); (mk_real_int64 3650L); (mk_real_int64 2700L); (mk_real_int64 3650L); (mk_real_int64 3650L); (mk_real_int64 3650L); (mk_real_int64 3650L); (mk_real_int64 3650L); (mk_real_int64 3475L); (mk_real_int64 3600L); (mk_real_int64 3475L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_lo", [2; 6; 8; 9; 10; 11; 13; 14; 23; 24; 26; 29; 33; 35; 42; 51; 52; 55; 57; 59; 61; 63; 64; ], [(mk_real_int64 504L); (mk_real_int64 1034L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1002L); (mk_real_int64 4L); (mk_real_int64 4L); (mk_real_int64 364L); (mk_real_int64 364L); (mk_real_int64 504L); (mk_real_int64 962L); (mk_real_int64 474L); (mk_real_int64 20L); (mk_real_int64 128L); (mk_real_int64 220L); (mk_real_int64 366L); (mk_real_int64 888L); (mk_real_int64 364L); (mk_real_int64 182L); (mk_real_int64 380L); (mk_real_int64 128L); (mk_real_int64 236L); ]); +("azim_hi", [5; 17; 27; 28; 30; 38; 43; 45; 65; ], [(mk_real_int64 524608L); (mk_real_int64 53L); (mk_real_int64 54L); (mk_real_int64 78L); (mk_real_int64 616L); (mk_real_int64 504L); (mk_real_int64 678L); (mk_real_int64 139L); (mk_real_int64 218L); ]); +("rhazim_hi", [6; 8; 9; 11; 33; 35; 39; 41; 42; 50; 51; 52; 56; 57; 59; 60; 63; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_lo", [5; 30; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_lo", [1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; ], [(mk_real_int64 536L); (mk_real_int64 536L); (mk_real_int64 700L); (mk_real_int64 536L); (mk_real_int64 536L); (mk_real_int64 2272L); (mk_real_int64 536L); (mk_real_int64 536L); (mk_real_int64 536L); (mk_real_int64 536L); (mk_real_int64 536L); ]); +("rho_hi", [0; 12; 13; 14; ], [(mk_real_int64 2676L); (mk_real_int64 4264L); (mk_real_int64 2768L); (mk_real_int64 4264L); ]); +("tau_lo", [1; 2; 12; 15; 17; 18; 19; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 93000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("tau_hi", [3; 4; 8; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("y1_lo", [7; 12; 13; 16; 17; 20; 31; 33; 34; 37; 39; 41; 48; 50; 51; 55; 58; 60; 62; 65; 66; ], [(mk_real_int64 576L); (mk_real_int64 500L); (mk_real_int64 180L); (mk_real_int64 520L); (mk_real_int64 390L); (mk_real_int64 280L); (mk_real_int64 500L); (mk_real_int64 180L); (mk_real_int64 399L); (mk_real_int64 60L); (mk_real_int64 600L); (mk_real_int64 600L); (mk_real_int64 280L); (mk_real_int64 20L); (mk_real_int64 200L); (mk_real_int64 105L); (mk_real_int64 305L); (mk_real_int64 500L); (mk_real_int64 120L); (mk_real_int64 400L); (mk_real_int64 19L); ]); +("y1_hi", [6; 9; 11; 23; 25; 28; 32; 36; 38; 40; 47; 57; 59; ], [(mk_real_int64 340L); (mk_real_int64 100L); (mk_real_int64 367L); (mk_real_int64 200L); (mk_real_int64 200L); (mk_real_int64 305L); (mk_real_int64 460L); (mk_real_int64 40L); (mk_real_int64 200L); (mk_real_int64 360L); (mk_real_int64 230L); (mk_real_int64 380L); (mk_real_int64 240L); ]); +("y2_hi", [6; 10; 11; 12; 18; 21; 23; 25; 28; 36; 37; 39; 41; 47; 50; 51; 55; 57; 58; 59; 60; 62; 65; ], [(mk_real_int64 88L); (mk_real_int64 104L); (mk_real_int64 367L); (mk_real_int64 192L); (mk_real_int64 320L); (mk_real_int64 320L); (mk_real_int64 200L); (mk_real_int64 200L); (mk_real_int64 306L); (mk_real_int64 40L); (mk_real_int64 304L); (mk_real_int64 564L); (mk_real_int64 564L); (mk_real_int64 248L); (mk_real_int64 524L); (mk_real_int64 28L); (mk_real_int64 84L); (mk_real_int64 380L); (mk_real_int64 24L); (mk_real_int64 448L); (mk_real_int64 72L); (mk_real_int64 244L); (mk_real_int64 16L); ]); +("y2_lo", [7; 9; 13; 16; 17; 20; 31; 32; 33; 34; 38; 40; 48; 53; 66; ], [(mk_real_int64 384L); (mk_real_int64 152L); (mk_real_int64 180L); (mk_real_int64 520L); (mk_real_int64 64L); (mk_real_int64 280L); (mk_real_int64 448L); (mk_real_int64 52L); (mk_real_int64 180L); (mk_real_int64 399L); (mk_real_int64 528L); (mk_real_int64 276L); (mk_real_int64 280L); (mk_real_int64 240L); (mk_real_int64 19L); ]); +("y3_hi", [6; 10; 11; 12; 18; 21; 23; 25; 28; 36; 37; 39; 41; 47; 50; 51; 55; 57; 58; 59; 60; 62; 65; ], [(mk_real_int64 88L); (mk_real_int64 104L); (mk_real_int64 367L); (mk_real_int64 192L); (mk_real_int64 320L); (mk_real_int64 320L); (mk_real_int64 200L); (mk_real_int64 200L); (mk_real_int64 306L); (mk_real_int64 40L); (mk_real_int64 304L); (mk_real_int64 564L); (mk_real_int64 564L); (mk_real_int64 248L); (mk_real_int64 524L); (mk_real_int64 28L); (mk_real_int64 84L); (mk_real_int64 380L); (mk_real_int64 24L); (mk_real_int64 448L); (mk_real_int64 72L); (mk_real_int64 244L); (mk_real_int64 16L); ]); +("y3_lo", [7; 9; 13; 16; 17; 20; 31; 32; 33; 34; 38; 40; 48; 53; 66; ], [(mk_real_int64 384L); (mk_real_int64 152L); (mk_real_int64 180L); (mk_real_int64 520L); (mk_real_int64 64L); (mk_real_int64 280L); (mk_real_int64 448L); (mk_real_int64 52L); (mk_real_int64 180L); (mk_real_int64 399L); (mk_real_int64 528L); (mk_real_int64 276L); (mk_real_int64 280L); (mk_real_int64 240L); (mk_real_int64 19L); ]); +("y4_hi", [4; 5; 6; 7; 23; 26; 27; 28; 29; 31; 33; 37; 39; 41; 43; 46; ], [(mk_real_int64 754L); (mk_real_int64 292L); (mk_real_int64 17L); (mk_real_int64 375L); (mk_real_int64 375L); (mk_real_int64 250L); (mk_real_int64 389L); (mk_real_int64 120L); (mk_real_int64 65L); (mk_real_int64 65L); (mk_real_int64 330L); (mk_real_int64 255L); (mk_real_int64 350L); (mk_real_int64 215L); (mk_real_int64 4L); (mk_real_int64 147L); ]); +("y4_lo", [0; 1; 3; 10; 11; 12; 14; 15; 21; 22; 24; 30; 34; 36; 44; 45; 48; 51; 52; ], [(mk_real_int64 170L); (mk_real_int64 584L); (mk_real_int64 170L); (mk_real_int64 250L); (mk_real_int64 690L); (mk_real_int64 430L); (mk_real_int64 250L); (mk_real_int64 430L); (mk_real_int64 123L); (mk_real_int64 295L); (mk_real_int64 124L); (mk_real_int64 486L); (mk_real_int64 250L); (mk_real_int64 635L); (mk_real_int64 260L); (mk_real_int64 210L); (mk_real_int64 236L); (mk_real_int64 140L); (mk_real_int64 499L); ]); +("y5_hi", [6; 7; 9; 10; 11; 12; 13; 18; 21; 28; 33; 36; 37; 39; 40; 41; 47; 50; 51; 55; 57; 58; 60; 65; ], [(mk_real_int64 173L); (mk_real_int64 216L); (mk_real_int64 173L); (mk_real_int64 104L); (mk_real_int64 292L); (mk_real_int64 192L); (mk_real_int64 375L); (mk_real_int64 320L); (mk_real_int64 320L); (mk_real_int64 306L); (mk_real_int64 375L); (mk_real_int64 250L); (mk_real_int64 364L); (mk_real_int64 564L); (mk_real_int64 489L); (mk_real_int64 564L); (mk_real_int64 248L); (mk_real_int64 69L); (mk_real_int64 28L); (mk_real_int64 4L); (mk_real_int64 4L); (mk_real_int64 19L); (mk_real_int64 72L); (mk_real_int64 16L); ]); +("y5_lo", [16; 17; 20; 31; 32; 34; 38; 48; 53; 59; 62; 66; ], [(mk_real_int64 250L); (mk_real_int64 64L); (mk_real_int64 250L); (mk_real_int64 448L); (mk_real_int64 52L); (mk_real_int64 124L); (mk_real_int64 528L); (mk_real_int64 250L); (mk_real_int64 240L); (mk_real_int64 132L); (mk_real_int64 261L); (mk_real_int64 499L); ]); +("y6_lo", [14; 16; 17; 18; 19; 20; 21; 24; 25; 26; 28; 31; 32; 34; 38; 39; 47; 48; 50; 51; 53; 54; 56; 59; 60; 62; 65; 66; ], [(mk_real_int64 98000L); (mk_real_int64 250L); (mk_real_int64 64L); (mk_real_int64 194680L); (mk_real_int64 74000L); (mk_real_int64 250L); (mk_real_int64 266000L); (mk_real_int64 120000L); (mk_real_int64 95000L); (mk_real_int64 74000L); (mk_real_int64 60000L); (mk_real_int64 448L); (mk_real_int64 52L); (mk_real_int64 280124L); (mk_real_int64 528L); (mk_real_int64 251436L); (mk_real_int64 77000L); (mk_real_int64 250L); (mk_real_int64 320000L); (mk_real_int64 190000L); (mk_real_int64 240L); (mk_real_int64 193000L); (mk_real_int64 274000L); (mk_real_int64 159132L); (mk_real_int64 105000L); (mk_real_int64 180000L); (mk_real_int64 26000L); (mk_real_int64 158499L); ]); +("y6_hi", [6; 7; 9; 10; 11; 12; 13; 21; 28; 33; 36; 37; 40; 41; 47; 50; 51; 55; 57; 58; 60; 62; 65; ], [(mk_real_int64 173L); (mk_real_int64 216L); (mk_real_int64 173L); (mk_real_int64 104L); (mk_real_int64 292L); (mk_real_int64 192L); (mk_real_int64 375L); (mk_real_int64 320L); (mk_real_int64 306L); (mk_real_int64 375L); (mk_real_int64 250L); (mk_real_int64 364L); (mk_real_int64 489L); (mk_real_int64 564L); (mk_real_int64 248L); (mk_real_int64 69L); (mk_real_int64 28L); (mk_real_int64 4L); (mk_real_int64 4L); (mk_real_int64 19L); (mk_real_int64 72L); (mk_real_int64 739L); (mk_real_int64 1016L); ]); +("ye_lo", [0; 1; 11; 13; 35; 38; 40; 42; 52; 54; 67; ], [(mk_real_int64 28000L); (mk_real_int64 36000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 255000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 397000L); (mk_real_int64 1000L); (mk_real_int64 66000L); ]); +("ye_hi", [15; 18; 19; 51; 67; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_hi", [0; 1; 4; 5; 7; 8; 12; 13; 14; ], [(mk_real_int64 340L); (mk_real_int64 936L); (mk_real_int64 936L); (mk_real_int64 1936L); (mk_real_int64 936L); (mk_real_int64 936L); (mk_real_int64 192L); (mk_real_int64 1840L); (mk_real_int64 192L); ]); +("yn_lo", [2; 3; 6; 9; 10; 11; ], [(mk_real_int64 64L); (mk_real_int64 1060L); (mk_real_int64 144L); (mk_real_int64 64L); (mk_real_int64 64L); (mk_real_int64 64L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests/72977109430_out.hl b/formal_lp/old/ineqs/tests/72977109430_out.hl new file mode 100644 index 0000000..346e76a --- /dev/null +++ b/formal_lp/old/ineqs/tests/72977109430_out.hl @@ -0,0 +1,88 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "72977109430 19 6 0 1 2 3 4 5 3 0 5 6 3 6 5 7 3 7 5 4 3 7 4 8 3 8 4 3 3 8 3 2 3 8 2 9 3 9 2 1 3 9 1 10 3 10 1 11 3 11 1 0 4 11 0 6 12 3 12 6 13 3 13 6 7 4 13 7 8 9 3 13 9 10 3 12 13 10 3 10 11 12 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum_neg", [2; 8; 13; ], [(mk_real_int64 99L); (mk_real_int64 130L); (mk_real_int64 10L); ]); +("azim_sum", [6; 7; 9; 11; ], [(mk_real_int64 44L); (mk_real_int64 116L); (mk_real_int64 116L); (mk_real_int64 25L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 1082L); (mk_real_int64 1082L); (mk_real_int64 660L); (mk_real_int64 1082L); (mk_real_int64 1082L); (mk_real_int64 1082L); (mk_real_int64 1082L); (mk_real_int64 1279L); (mk_real_int64 1279L); (mk_real_int64 1279L); (mk_real_int64 1279L); (mk_real_int64 1032L); (mk_real_int64 699L); (mk_real_int64 699L); ]); +("sol_sum3_neg", [8; 10; 12; 13; ], [(mk_real_int64 7L); (mk_real_int64 271L); (mk_real_int64 44L); (mk_real_int64 247L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; ], [(mk_real_int64 1082L); (mk_real_int64 1082L); (mk_real_int64 1082L); (mk_real_int64 1082L); (mk_real_int64 660L); (mk_real_int64 660L); (mk_real_int64 1082L); (mk_real_int64 1082L); (mk_real_int64 1032L); (mk_real_int64 699L); (mk_real_int64 699L); (mk_real_int64 699L); (mk_real_int64 1082L); (mk_real_int64 1032L); (mk_real_int64 699L); (mk_real_int64 699L); ]); +("tau_sum4_neg", [0; 1; ], [(mk_real_int64 699L); (mk_real_int64 1279L); ]); +("tau_sum6_neg", [0; ], [(mk_real_int64 1082L); ]); +("ln_def_neg", [0; 1; 3; 4; 5; 6; 7; 8; 9; 10; 11; ], [(mk_real_int64 193L); (mk_real_int64 193L); (mk_real_int64 193L); (mk_real_int64 193L); (mk_real_int64 193L); (mk_real_int64 193L); (mk_real_int64 410L); (mk_real_int64 410L); (mk_real_int64 410L); (mk_real_int64 410L); (mk_real_int64 138L); ]); +("ln_def", [2; 12; 13; ], [(mk_real_int64 273L); (mk_real_int64 229L); (mk_real_int64 229L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 6798L); (mk_real_int64 6798L); (mk_real_int64 4146L); (mk_real_int64 6798L); (mk_real_int64 6798L); (mk_real_int64 6798L); (mk_real_int64 6798L); (mk_real_int64 8033L); (mk_real_int64 8033L); (mk_real_int64 8033L); (mk_real_int64 8033L); (mk_real_int64 6484L); (mk_real_int64 4395L); (mk_real_int64 4392L); ]); +("edge_sym", [1; 2; 23; 25; 29; 44; ], [(mk_real_int64 73L); (mk_real_int64 278L); (mk_real_int64 325L); (mk_real_int64 73L); (mk_real_int64 15L); (mk_real_int64 282L); ]); +("edge_sym_neg", [7; 8; 10; 11; 14; 16; 20; 31; 32; 34; 35; 38; 45; 55; 58; ], [(mk_real_int64 119L); (mk_real_int64 119L); (mk_real_int64 100L); (mk_real_int64 54L); (mk_real_int64 73L); (mk_real_int64 325L); (mk_real_int64 209L); (mk_real_int64 176L); (mk_real_int64 42L); (mk_real_int64 199L); (mk_real_int64 187L); (mk_real_int64 119L); (mk_real_int64 146L); (mk_real_int64 211L); (mk_real_int64 23L); ]); +("y1_def_neg", [6; 8; 9; 10; 11; 12; 15; 17; 18; 19; 20; 21; 23; 24; 25; 26; 27; 30; 31; 32; 33; 34; 37; 38; 40; 44; 45; 46; 48; 54; 56; 57; 58; 59; 60; ], [(mk_real_int64 195L); (mk_real_int64 10L); (mk_real_int64 10L); (mk_real_int64 110L); (mk_real_int64 11L); (mk_real_int64 105L); (mk_real_int64 340L); (mk_real_int64 40L); (mk_real_int64 293L); (mk_real_int64 253L); (mk_real_int64 69L); (mk_real_int64 293L); (mk_real_int64 372L); (mk_real_int64 40L); (mk_real_int64 195L); (mk_real_int64 145L); (mk_real_int64 105L); (mk_real_int64 148L); (mk_real_int64 23L); (mk_real_int64 159L); (mk_real_int64 321L); (mk_real_int64 208L); (mk_real_int64 94L); (mk_real_int64 67L); (mk_real_int64 93L); (mk_real_int64 352L); (mk_real_int64 348L); (mk_real_int64 57L); (mk_real_int64 296L); (mk_real_int64 70L); (mk_real_int64 33L); (mk_real_int64 348L); (mk_real_int64 32L); (mk_real_int64 149L); (mk_real_int64 94L); ]); +("y1_def", [22; 36; 43; 55; 61; ], [(mk_real_int64 49L); (mk_real_int64 239L); (mk_real_int64 5L); (mk_real_int64 43L); (mk_real_int64 5L); ]); +("y2_def", [8; 9; 11; 17; 18; 19; 21; 23; 24; 26; 30; 31; 33; 34; 36; 38; 40; 44; 45; 46; 54; 57; 58; 59; ], [(mk_real_int64 16L); (mk_real_int64 16L); (mk_real_int64 7L); (mk_real_int64 24L); (mk_real_int64 178L); (mk_real_int64 154L); (mk_real_int64 178L); (mk_real_int64 35L); (mk_real_int64 24L); (mk_real_int64 114L); (mk_real_int64 90L); (mk_real_int64 18L); (mk_real_int64 15L); (mk_real_int64 126L); (mk_real_int64 62L); (mk_real_int64 40L); (mk_real_int64 119L); (mk_real_int64 27L); (mk_real_int64 211L); (mk_real_int64 34L); (mk_real_int64 42L); (mk_real_int64 211L); (mk_real_int64 19L); (mk_real_int64 90L); ]); +("y2_def_neg", [6; 10; 12; 15; 20; 22; 25; 27; 32; 37; 43; 48; 55; 56; 60; 61; ], [(mk_real_int64 195L); (mk_real_int64 110L); (mk_real_int64 105L); (mk_real_int64 81L); (mk_real_int64 134L); (mk_real_int64 15L); (mk_real_int64 195L); (mk_real_int64 105L); (mk_real_int64 148L); (mk_real_int64 94L); (mk_real_int64 1L); (mk_real_int64 64L); (mk_real_int64 20L); (mk_real_int64 40L); (mk_real_int64 94L); (mk_real_int64 1L); ]); +("y3_def", [8; 9; 11; 17; 18; 19; 21; 23; 24; 26; 30; 31; 33; 34; 36; 38; 40; 44; 45; 46; 54; 57; 58; 59; ], [(mk_real_int64 16L); (mk_real_int64 16L); (mk_real_int64 7L); (mk_real_int64 24L); (mk_real_int64 178L); (mk_real_int64 154L); (mk_real_int64 178L); (mk_real_int64 35L); (mk_real_int64 24L); (mk_real_int64 114L); (mk_real_int64 90L); (mk_real_int64 18L); (mk_real_int64 15L); (mk_real_int64 126L); (mk_real_int64 62L); (mk_real_int64 40L); (mk_real_int64 119L); (mk_real_int64 27L); (mk_real_int64 211L); (mk_real_int64 34L); (mk_real_int64 42L); (mk_real_int64 211L); (mk_real_int64 19L); (mk_real_int64 90L); ]); +("y3_def_neg", [6; 10; 12; 15; 20; 22; 25; 27; 32; 37; 43; 48; 55; 56; 60; 61; ], [(mk_real_int64 195L); (mk_real_int64 110L); (mk_real_int64 105L); (mk_real_int64 81L); (mk_real_int64 134L); (mk_real_int64 15L); (mk_real_int64 195L); (mk_real_int64 105L); (mk_real_int64 148L); (mk_real_int64 94L); (mk_real_int64 1L); (mk_real_int64 64L); (mk_real_int64 20L); (mk_real_int64 40L); (mk_real_int64 94L); (mk_real_int64 1L); ]); +("y4_def_neg", [0; 2; 3; 4; 5; 6; 9; 11; 12; 13; 14; 15; 17; 18; 19; 20; 21; 24; 25; 26; 27; 28; 31; 32; 34; 35; 36; 38; 40; 41; 42; 43; 44; 45; 46; ], [(mk_real_int64 135L); (mk_real_int64 30L); (mk_real_int64 30L); (mk_real_int64 77L); (mk_real_int64 13L); (mk_real_int64 73L); (mk_real_int64 349L); (mk_real_int64 45L); (mk_real_int64 335L); (mk_real_int64 289L); (mk_real_int64 6L); (mk_real_int64 335L); (mk_real_int64 372L); (mk_real_int64 45L); (mk_real_int64 135L); (mk_real_int64 214L); (mk_real_int64 73L); (mk_real_int64 169L); (mk_real_int64 31L); (mk_real_int64 119L); (mk_real_int64 325L); (mk_real_int64 237L); (mk_real_int64 65L); (mk_real_int64 76L); (mk_real_int64 356L); (mk_real_int64 397L); (mk_real_int64 65L); (mk_real_int64 316L); (mk_real_int64 80L); (mk_real_int64 42L); (mk_real_int64 19L); (mk_real_int64 397L); (mk_real_int64 36L); (mk_real_int64 170L); (mk_real_int64 66L); ]); +("y4_def", [16; 30; 33; 47; ], [(mk_real_int64 76L); (mk_real_int64 157L); (mk_real_int64 8L); (mk_real_int64 7L); ]); +("y5_def", [8; 9; 11; 17; 18; 19; 21; 23; 24; 26; 30; 31; 33; 34; 37; 38; 40; 44; 45; 46; 54; 57; 58; 59; ], [(mk_real_int64 16L); (mk_real_int64 16L); (mk_real_int64 7L); (mk_real_int64 24L); (mk_real_int64 178L); (mk_real_int64 154L); (mk_real_int64 178L); (mk_real_int64 71L); (mk_real_int64 24L); (mk_real_int64 114L); (mk_real_int64 90L); (mk_real_int64 14L); (mk_real_int64 50L); (mk_real_int64 126L); (mk_real_int64 370L); (mk_real_int64 40L); (mk_real_int64 119L); (mk_real_int64 64L); (mk_real_int64 211L); (mk_real_int64 34L); (mk_real_int64 42L); (mk_real_int64 211L); (mk_real_int64 19L); (mk_real_int64 90L); ]); +("y5_def_neg", [6; 10; 12; 15; 20; 22; 25; 27; 32; 36; 43; 48; 55; 56; 60; 61; ], [(mk_real_int64 135L); (mk_real_int64 77L); (mk_real_int64 73L); (mk_real_int64 21L); (mk_real_int64 98L); (mk_real_int64 15L); (mk_real_int64 135L); (mk_real_int64 73L); (mk_real_int64 101L); (mk_real_int64 94L); (mk_real_int64 1L); (mk_real_int64 34L); (mk_real_int64 132L); (mk_real_int64 28L); (mk_real_int64 65L); (mk_real_int64 1L); ]); +("y6_def", [1; 6; 8; 9; 11; 12; 13; 15; 17; 18; 19; 21; 23; 24; 26; 30; 31; 33; 34; 38; 40; 43; 44; 45; 46; 47; 54; 57; 58; 59; 60; ], [(mk_real_int64 73L); (mk_real_int64 30L); (mk_real_int64 16L); (mk_real_int64 208L); (mk_real_int64 7L); (mk_real_int64 100L); (mk_real_int64 73L); (mk_real_int64 118L); (mk_real_int64 24L); (mk_real_int64 178L); (mk_real_int64 432L); (mk_real_int64 596L); (mk_real_int64 71L); (mk_real_int64 24L); (mk_real_int64 114L); (mk_real_int64 90L); (mk_real_int64 14L); (mk_real_int64 50L); (mk_real_int64 126L); (mk_real_int64 40L); (mk_real_int64 119L); (mk_real_int64 333L); (mk_real_int64 64L); (mk_real_int64 211L); (mk_real_int64 34L); (mk_real_int64 153L); (mk_real_int64 173L); (mk_real_int64 211L); (mk_real_int64 19L); (mk_real_int64 245L); (mk_real_int64 171L); ]); +("y6_def_neg", [10; 20; 22; 25; 27; 32; 36; 37; 48; 55; 56; 61; ], [(mk_real_int64 77L); (mk_real_int64 98L); (mk_real_int64 15L); (mk_real_int64 135L); (mk_real_int64 73L); (mk_real_int64 101L); (mk_real_int64 94L); (mk_real_int64 65L); (mk_real_int64 34L); (mk_real_int64 132L); (mk_real_int64 28L); (mk_real_int64 1L); ]); +("RHA", [11; 12; 17; 18; 21; 24; 27; 31; 34; 37; 38; 40; 41; 46; 53; 54; 58; 59; ], [(mk_real_int64 178L); (mk_real_int64 197L); (mk_real_int64 130L); (mk_real_int64 130L); (mk_real_int64 130L); (mk_real_int64 130L); (mk_real_int64 197L); (mk_real_int64 7L); (mk_real_int64 36L); (mk_real_int64 383L); (mk_real_int64 271L); (mk_real_int64 383L); (mk_real_int64 383L); (mk_real_int64 102L); (mk_real_int64 247L); (mk_real_int64 130L); (mk_real_int64 280L); (mk_real_int64 85L); ]); +("yy10", [17; 26; 37; ], [(mk_real_int64 3L); (mk_real_int64 3L); (mk_real_int64 132L); ]); +("tau4", [1; ], [(mk_real_int64 684L); ]); +("tau6", [0; ], [(mk_real_int64 1082L); ]); +("ineq105", [7; ], [(mk_real_int64 297L); ]); +("ineq106", [5; 9; 11; 12; 13; 15; 17; 18; 20; 24; 25; 27; 28; 32; 34; 35; 36; 38; 40; 43; 44; 45; ], [(mk_real_int64 18L); (mk_real_int64 197L); (mk_real_int64 66L); (mk_real_int64 488L); (mk_real_int64 422L); (mk_real_int64 488L); (mk_real_int64 422L); (mk_real_int64 66L); (mk_real_int64 197L); (mk_real_int64 247L); (mk_real_int64 43L); (mk_real_int64 332L); (mk_real_int64 346L); (mk_real_int64 111L); (mk_real_int64 383L); (mk_real_int64 580L); (mk_real_int64 95L); (mk_real_int64 197L); (mk_real_int64 116L); (mk_real_int64 580L); (mk_real_int64 53L); (mk_real_int64 248L); ]); +("ineq107", [14; 16; 30; 33; 41; 42; 47; ], [(mk_real_int64 99L); (mk_real_int64 99L); (mk_real_int64 272L); (mk_real_int64 10L); (mk_real_int64 97L); (mk_real_int64 10L); (mk_real_int64 9L); ]); +("ineq108", [2; 3; 9; 20; 26; 27; 34; 38; ], [(mk_real_int64 44L); (mk_real_int64 44L); (mk_real_int64 116L); (mk_real_int64 116L); (mk_real_int64 18L); (mk_real_int64 25L); (mk_real_int64 17L); (mk_real_int64 72L); ]); +("ineq110", [25; 30; 38; 41; ], [(mk_real_int64 7L); (mk_real_int64 271L); (mk_real_int64 44L); (mk_real_int64 247L); ]); +("ineq111", [0; 4; 6; 9; 14; 17; 19; 21; 26; 27; 31; 34; 38; 41; 42; 46; ], [(mk_real_int64 1082L); (mk_real_int64 612L); (mk_real_int64 582L); (mk_real_int64 1082L); (mk_real_int64 660L); (mk_real_int64 660L); (mk_real_int64 1082L); (mk_real_int64 582L); (mk_real_int64 858L); (mk_real_int64 642L); (mk_real_int64 522L); (mk_real_int64 656L); (mk_real_int64 990L); (mk_real_int64 549L); (mk_real_int64 212L); (mk_real_int64 523L); ]); +("ineq113", [41; ], [(mk_real_int64 483L); ]); +("ineq114", [5; 6; 21; 24; 28; 31; 34; 36; 44; 45; ], [(mk_real_int64 470L); (mk_real_int64 499L); (mk_real_int64 499L); (mk_real_int64 174L); (mk_real_int64 58L); (mk_real_int64 178L); (mk_real_int64 43L); (mk_real_int64 92L); (mk_real_int64 487L); (mk_real_int64 176L); ]); +("ineq119", [3; 6; ], [(mk_real_int64 21L); (mk_real_int64 288L); ]); +("ineq120", [1; 2; 5; 7; ], [(mk_real_int64 114L); (mk_real_int64 564L); (mk_real_int64 153L); (mk_real_int64 153L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 3350L); (mk_real_int64 3350L); (mk_real_int64 1450L); (mk_real_int64 3350L); (mk_real_int64 3350L); (mk_real_int64 3350L); (mk_real_int64 3350L); (mk_real_int64 4225L); (mk_real_int64 4225L); (mk_real_int64 4225L); (mk_real_int64 4225L); (mk_real_int64 3300L); (mk_real_int64 1875L); (mk_real_int64 2400L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [3; 11; 34; 40; 41; 42; 54; 59; 61; ], [(mk_real_int64 99000L); (mk_real_int64 220L); (mk_real_int64 308L); (mk_real_int64 412L); (mk_real_int64 512L); (mk_real_int64 487L); (mk_real_int64 1000L); (mk_real_int64 176L); (mk_real_int64 1000L); ]); +("azim_lo", [12; 27; 30; 36; 37; 44; 46; 50; 51; 52; 55; 58; ], [(mk_real_int64 626L); (mk_real_int64 626L); (mk_real_int64 76L); (mk_real_int64 1000L); (mk_real_int64 572L); (mk_real_int64 82L); (mk_real_int64 408L); (mk_real_int64 26L); (mk_real_int64 464L); (mk_real_int64 26L); (mk_real_int64 97L); (mk_real_int64 138L); ]); +("rhazim_lo", [11; 17; 18; 21; 24; 33; 34; 38; 54; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_hi", [3; ], [(mk_real_int64 422000L); ]); +("rho_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 13; ], [(mk_real_int64 1288L); (mk_real_int64 1288L); (mk_real_int64 1440L); (mk_real_int64 1288L); (mk_real_int64 1288L); (mk_real_int64 1288L); (mk_real_int64 1288L); (mk_real_int64 4236L); (mk_real_int64 4236L); (mk_real_int64 4236L); (mk_real_int64 4236L); (mk_real_int64 1088L); (mk_real_int64 516L); ]); +("rho_lo", [12; ], [(mk_real_int64 2484L); ]); +("tau_hi", [10; 11; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("tau_lo", [3; 8; 15; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("y1_hi", [6; 11; 12; 17; 18; 21; 22; 24; 25; 27; 32; 33; 34; 37; 38; 44; 54; 55; 58; 59; ], [(mk_real_int64 240L); (mk_real_int64 200L); (mk_real_int64 240L); (mk_real_int64 400L); (mk_real_int64 200L); (mk_real_int64 200L); (mk_real_int64 500L); (mk_real_int64 400L); (mk_real_int64 240L); (mk_real_int64 240L); (mk_real_int64 330L); (mk_real_int64 365L); (mk_real_int64 400L); (mk_real_int64 40L); (mk_real_int64 400L); (mk_real_int64 125L); (mk_real_int64 400L); (mk_real_int64 540L); (mk_real_int64 200L); (mk_real_int64 200L); ]); +("y1_lo", [8; 9; 10; 15; 19; 20; 26; 30; 31; 36; 40; 48; 56; 60; 61; ], [(mk_real_int64 340L); (mk_real_int64 340L); (mk_real_int64 160L); (mk_real_int64 220L); (mk_real_int64 200L); (mk_real_int64 300L); (mk_real_int64 460L); (mk_real_int64 200L); (mk_real_int64 140L); (mk_real_int64 20L); (mk_real_int64 555L); (mk_real_int64 600L); (mk_real_int64 160L); (mk_real_int64 140L); (mk_real_int64 500L); ]); +("y2_hi", [6; 8; 9; 12; 15; 17; 20; 24; 25; 27; 31; 32; 37; 38; 40; 44; 45; 46; 48; 54; 55; 56; 57; 58; 59; ], [(mk_real_int64 240L); (mk_real_int64 16L); (mk_real_int64 16L); (mk_real_int64 240L); (mk_real_int64 172L); (mk_real_int64 24L); (mk_real_int64 152L); (mk_real_int64 24L); (mk_real_int64 240L); (mk_real_int64 240L); (mk_real_int64 312L); (mk_real_int64 112L); (mk_real_int64 40L); (mk_real_int64 404L); (mk_real_int64 394L); (mk_real_int64 520L); (mk_real_int64 120L); (mk_real_int64 580L); (mk_real_int64 436L); (mk_real_int64 224L); (mk_real_int64 296L); (mk_real_int64 320L); (mk_real_int64 120L); (mk_real_int64 292L); (mk_real_int64 272L); ]); +("y2_lo", [10; 11; 18; 19; 21; 22; 23; 26; 30; 33; 34; 36; 43; 60; 61; ], [(mk_real_int64 160L); (mk_real_int64 448L); (mk_real_int64 368L); (mk_real_int64 392L); (mk_real_int64 368L); (mk_real_int64 48L); (mk_real_int64 192L); (mk_real_int64 68L); (mk_real_int64 92L); (mk_real_int64 612L); (mk_real_int64 56L); (mk_real_int64 364L); (mk_real_int64 520L); (mk_real_int64 140L); (mk_real_int64 368L); ]); +("y3_hi", [6; 8; 9; 12; 15; 17; 20; 24; 25; 27; 31; 32; 37; 38; 40; 44; 45; 46; 48; 54; 55; 56; 57; 58; 59; ], [(mk_real_int64 240L); (mk_real_int64 16L); (mk_real_int64 16L); (mk_real_int64 240L); (mk_real_int64 172L); (mk_real_int64 24L); (mk_real_int64 152L); (mk_real_int64 24L); (mk_real_int64 240L); (mk_real_int64 240L); (mk_real_int64 312L); (mk_real_int64 112L); (mk_real_int64 40L); (mk_real_int64 404L); (mk_real_int64 394L); (mk_real_int64 520L); (mk_real_int64 120L); (mk_real_int64 580L); (mk_real_int64 436L); (mk_real_int64 224L); (mk_real_int64 296L); (mk_real_int64 320L); (mk_real_int64 120L); (mk_real_int64 292L); (mk_real_int64 272L); ]); +("y3_lo", [10; 11; 18; 19; 21; 22; 23; 26; 30; 33; 34; 36; 43; 60; 61; ], [(mk_real_int64 160L); (mk_real_int64 448L); (mk_real_int64 368L); (mk_real_int64 392L); (mk_real_int64 368L); (mk_real_int64 48L); (mk_real_int64 192L); (mk_real_int64 68L); (mk_real_int64 92L); (mk_real_int64 612L); (mk_real_int64 56L); (mk_real_int64 364L); (mk_real_int64 520L); (mk_real_int64 140L); (mk_real_int64 368L); ]); +("y4_lo", [0; 2; 3; 9; 11; 13; 18; 19; 20; 24; 26; 28; 31; 32; 33; 35; 36; 38; 41; 43; 44; 47; ], [(mk_real_int64 250L); (mk_real_int64 140L); (mk_real_int64 140L); (mk_real_int64 655L); (mk_real_int64 210L); (mk_real_int64 70L); (mk_real_int64 210L); (mk_real_int64 250L); (mk_real_int64 405L); (mk_real_int64 195L); (mk_real_int64 580L); (mk_real_int64 10L); (mk_real_int64 250L); (mk_real_int64 35L); (mk_real_int64 270L); (mk_real_int64 300L); (mk_real_int64 75L); (mk_real_int64 639L); (mk_real_int64 56L); (mk_real_int64 300L); (mk_real_int64 305L); (mk_real_int64 43L); ]); +("y4_hi", [4; 5; 6; 12; 14; 15; 16; 17; 21; 25; 27; 30; 40; 42; 45; 46; ], [(mk_real_int64 500L); (mk_real_int64 670L); (mk_real_int64 250L); (mk_real_int64 720L); (mk_real_int64 27L); (mk_real_int64 720L); (mk_real_int64 527L); (mk_real_int64 430L); (mk_real_int64 250L); (mk_real_int64 173L); (mk_real_int64 205L); (mk_real_int64 140L); (mk_real_int64 540L); (mk_real_int64 230L); (mk_real_int64 120L); (mk_real_int64 625L); ]); +("y5_hi", [8; 9; 10; 12; 17; 20; 23; 24; 27; 31; 32; 38; 40; 45; 46; 54; 55; 57; 58; 59; ], [(mk_real_int64 16L); (mk_real_int64 16L); (mk_real_int64 500L); (mk_real_int64 250L); (mk_real_int64 24L); (mk_real_int64 452L); (mk_real_int64 108L); (mk_real_int64 24L); (mk_real_int64 250L); (mk_real_int64 280L); (mk_real_int64 302L); (mk_real_int64 404L); (mk_real_int64 394L); (mk_real_int64 120L); (mk_real_int64 580L); (mk_real_int64 224L); (mk_real_int64 219L); (mk_real_int64 120L); (mk_real_int64 292L); (mk_real_int64 272L); ]); +("y5_lo", [6; 11; 15; 18; 19; 21; 22; 25; 26; 30; 33; 34; 36; 37; 43; 44; 48; 56; 60; 61; ], [(mk_real_int64 250L); (mk_real_int64 448L); (mk_real_int64 318L); (mk_real_int64 368L); (mk_real_int64 392L); (mk_real_int64 368L); (mk_real_int64 48L); (mk_real_int64 250L); (mk_real_int64 68L); (mk_real_int64 92L); (mk_real_int64 302L); (mk_real_int64 56L); (mk_real_int64 460L); (mk_real_int64 435250L); (mk_real_int64 520L); (mk_real_int64 400L); (mk_real_int64 458L); (mk_real_int64 20L); (mk_real_int64 375L); (mk_real_int64 368L); ]); +("y6_hi", [8; 9; 10; 12; 15; 17; 20; 23; 24; 27; 31; 32; 38; 40; 43; 45; 46; 54; 55; 57; 58; 59; ], [(mk_real_int64 16L); (mk_real_int64 16L); (mk_real_int64 500L); (mk_real_int64 250L); (mk_real_int64 682L); (mk_real_int64 24L); (mk_real_int64 452L); (mk_real_int64 108L); (mk_real_int64 24L); (mk_real_int64 250L); (mk_real_int64 280L); (mk_real_int64 302L); (mk_real_int64 404L); (mk_real_int64 394L); (mk_real_int64 480L); (mk_real_int64 120L); (mk_real_int64 580L); (mk_real_int64 224L); (mk_real_int64 219L); (mk_real_int64 120L); (mk_real_int64 292L); (mk_real_int64 272L); ]); +("y6_lo", [1; 6; 9; 11; 12; 13; 15; 18; 19; 21; 22; 25; 26; 30; 33; 34; 36; 37; 43; 44; 47; 48; 54; 56; 59; 60; 61; ], [(mk_real_int64 73000L); (mk_real_int64 165250L); (mk_real_int64 192000L); (mk_real_int64 448L); (mk_real_int64 173000L); (mk_real_int64 73000L); (mk_real_int64 140000L); (mk_real_int64 368L); (mk_real_int64 278392L); (mk_real_int64 418368L); (mk_real_int64 48L); (mk_real_int64 250L); (mk_real_int64 68L); (mk_real_int64 92L); (mk_real_int64 302L); (mk_real_int64 56L); (mk_real_int64 460L); (mk_real_int64 250L); (mk_real_int64 335000L); (mk_real_int64 400L); (mk_real_int64 153000L); (mk_real_int64 458L); (mk_real_int64 131000L); (mk_real_int64 20L); (mk_real_int64 155000L); (mk_real_int64 236375L); (mk_real_int64 368L); ]); +("ye_lo", [2; 9; 19; 22; 25; 29; 31; 54; 55; 58; ], [(mk_real_int64 278000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 140000L); (mk_real_int64 88000L); (mk_real_int64 80000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 383000L); ]); +("ye_hi", [18; 25; 36; 44; 56; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 13; ], [(mk_real_int64 332L); (mk_real_int64 332L); (mk_real_int64 21L); (mk_real_int64 332L); (mk_real_int64 332L); (mk_real_int64 332L); (mk_real_int64 332L); (mk_real_int64 840L); (mk_real_int64 840L); (mk_real_int64 633L); ]); +("yn_lo", [9; 10; 11; 12; ], [(mk_real_int64 160L); (mk_real_int64 1160L); (mk_real_int64 488L); (mk_real_int64 367L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests/75655754509_out.hl b/formal_lp/old/ineqs/tests/75655754509_out.hl new file mode 100644 index 0000000..76af71c --- /dev/null +++ b/formal_lp/old/ineqs/tests/75655754509_out.hl @@ -0,0 +1,88 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "75655754509 17 6 0 1 2 3 4 5 3 0 5 6 3 6 5 4 3 6 4 7 4 7 4 8 9 3 8 4 3 3 8 3 10 3 10 3 2 3 10 2 1 3 10 1 11 3 11 1 0 4 11 0 12 9 3 12 0 6 3 11 9 8 3 8 10 11 3 12 6 7 3 7 9 12 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum_neg", [0; 3; 7; 9; 10; 12; ], [(mk_real_int64 249L); (mk_real_int64 600L); (mk_real_int64 58L); (mk_real_int64 302L); (mk_real_int64 327L); (mk_real_int64 327L); ]); +("azim_sum", [6; 8; ], [(mk_real_int64 160L); (mk_real_int64 160L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 849L); (mk_real_int64 1009L); (mk_real_int64 884L); (mk_real_int64 740L); (mk_real_int64 884L); (mk_real_int64 1009L); (mk_real_int64 1009L); (mk_real_int64 740L); (mk_real_int64 1009L); (mk_real_int64 955L); (mk_real_int64 1009L); (mk_real_int64 1009L); (mk_real_int64 1009L); ]); +("sol_sum3_neg", [4; 7; 11; ], [(mk_real_int64 10L); (mk_real_int64 10L); (mk_real_int64 499L); ]); +("sol_sum3", [5; 6; 12; ], [(mk_real_int64 189L); (mk_real_int64 189L); (mk_real_int64 311L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 653L); (mk_real_int64 653L); (mk_real_int64 653L); (mk_real_int64 884L); (mk_real_int64 672L); (mk_real_int64 740L); (mk_real_int64 740L); (mk_real_int64 672L); (mk_real_int64 884L); (mk_real_int64 653L); (mk_real_int64 939L); (mk_real_int64 670L); (mk_real_int64 871L); (mk_real_int64 682L); ]); +("tau_sum4_neg", [0; 1; ], [(mk_real_int64 1009L); (mk_real_int64 1009L); ]); +("tau_sum6_neg", [0; ], [(mk_real_int64 884L); ]); +("ln_def_neg", [1; 5; 6; 8; 9; 10; 11; 12; ], [(mk_real_int64 112L); (mk_real_int64 112L); (mk_real_int64 112L); (mk_real_int64 112L); (mk_real_int64 53L); (mk_real_int64 112L); (mk_real_int64 112L); (mk_real_int64 112L); ]); +("ln_def", [0; 2; 3; 4; 7; ], [(mk_real_int64 64L); (mk_real_int64 26L); (mk_real_int64 184L); (mk_real_int64 26L); (mk_real_int64 184L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 5333L); (mk_real_int64 6339L); (mk_real_int64 5551L); (mk_real_int64 4648L); (mk_real_int64 5551L); (mk_real_int64 6339L); (mk_real_int64 6339L); (mk_real_int64 4648L); (mk_real_int64 6339L); (mk_real_int64 6001L); (mk_real_int64 6339L); (mk_real_int64 6339L); (mk_real_int64 6339L); ]); +("edge_sym", [0; 3; 4; 5; 8; 11; 24; 30; 32; 33; 52; ], [(mk_real_int64 50L); (mk_real_int64 50L); (mk_real_int64 19L); (mk_real_int64 50L); (mk_real_int64 31L); (mk_real_int64 31L); (mk_real_int64 132L); (mk_real_int64 379L); (mk_real_int64 132L); (mk_real_int64 132L); (mk_real_int64 128L); ]); +("edge_sym_neg", [7; 21; 23; 27; 46; ], [(mk_real_int64 19L); (mk_real_int64 132L); (mk_real_int64 379L); (mk_real_int64 2L); (mk_real_int64 74L); ]); +("y1_def_neg", [0; 4; 8; 12; 14; 19; 20; 21; 22; 23; 26; 30; 31; 33; 34; 35; 36; 41; 42; 45; 50; 51; 52; 54; 55; ], [(mk_real_int64 39L); (mk_real_int64 39L); (mk_real_int64 15L); (mk_real_int64 15L); (mk_real_int64 17L); (mk_real_int64 19L); (mk_real_int64 75L); (mk_real_int64 91L); (mk_real_int64 238L); (mk_real_int64 59L); (mk_real_int64 28L); (mk_real_int64 28L); (mk_real_int64 59L); (mk_real_int64 228L); (mk_real_int64 29L); (mk_real_int64 91L); (mk_real_int64 75L); (mk_real_int64 17L); (mk_real_int64 15L); (mk_real_int64 79L); (mk_real_int64 73L); (mk_real_int64 88L); (mk_real_int64 120L); (mk_real_int64 73L); (mk_real_int64 64L); ]); +("y1_def", [7; 10; 27; 29; 47; 48; ], [(mk_real_int64 27L); (mk_real_int64 11L); (mk_real_int64 206L); (mk_real_int64 206L); (mk_real_int64 190L); (mk_real_int64 111L); ]); +("y2_def", [0; 4; 14; 19; 20; 22; 33; 34; 36; 41; 47; 50; 54; ], [(mk_real_int64 50L); (mk_real_int64 50L); (mk_real_int64 11L); (mk_real_int64 17L); (mk_real_int64 46L); (mk_real_int64 177L); (mk_real_int64 177L); (mk_real_int64 17L); (mk_real_int64 46L); (mk_real_int64 11L); (mk_real_int64 190L); (mk_real_int64 44L); (mk_real_int64 44L); ]); +("y2_def_neg", [7; 8; 10; 12; 21; 23; 26; 27; 29; 30; 31; 35; 42; 45; 48; 51; 52; 55; ], [(mk_real_int64 8L); (mk_real_int64 15L); (mk_real_int64 23L); (mk_real_int64 15L); (mk_real_int64 91L); (mk_real_int64 59L); (mk_real_int64 28L); (mk_real_int64 63L); (mk_real_int64 63L); (mk_real_int64 28L); (mk_real_int64 59L); (mk_real_int64 91L); (mk_real_int64 15L); (mk_real_int64 11L); (mk_real_int64 34L); (mk_real_int64 88L); (mk_real_int64 2L); (mk_real_int64 64L); ]); +("y3_def", [0; 4; 14; 19; 20; 22; 33; 34; 36; 41; 47; 50; 54; ], [(mk_real_int64 50L); (mk_real_int64 50L); (mk_real_int64 11L); (mk_real_int64 17L); (mk_real_int64 46L); (mk_real_int64 177L); (mk_real_int64 177L); (mk_real_int64 17L); (mk_real_int64 46L); (mk_real_int64 11L); (mk_real_int64 190L); (mk_real_int64 44L); (mk_real_int64 44L); ]); +("y3_def_neg", [7; 8; 10; 12; 21; 23; 26; 27; 29; 30; 31; 35; 42; 45; 48; 51; 52; 55; ], [(mk_real_int64 8L); (mk_real_int64 15L); (mk_real_int64 23L); (mk_real_int64 15L); (mk_real_int64 91L); (mk_real_int64 59L); (mk_real_int64 28L); (mk_real_int64 63L); (mk_real_int64 63L); (mk_real_int64 28L); (mk_real_int64 59L); (mk_real_int64 91L); (mk_real_int64 15L); (mk_real_int64 11L); (mk_real_int64 34L); (mk_real_int64 88L); (mk_real_int64 2L); (mk_real_int64 64L); ]); +("y4_def", [1; 4; 16; 17; 19; 20; 34; 38; ], [(mk_real_int64 41L); (mk_real_int64 31L); (mk_real_int64 61L); (mk_real_int64 318L); (mk_real_int64 318L); (mk_real_int64 61L); (mk_real_int64 171L); (mk_real_int64 17L); ]); +("y4_def_neg", [2; 6; 8; 9; 10; 11; 12; 13; 21; 23; 24; 25; 26; 27; 28; 31; 33; 36; 37; 40; 41; ], [(mk_real_int64 11L); (mk_real_int64 11L); (mk_real_int64 20L); (mk_real_int64 33L); (mk_real_int64 86L); (mk_real_int64 63L); (mk_real_int64 333L); (mk_real_int64 46L); (mk_real_int64 46L); (mk_real_int64 333L); (mk_real_int64 33L); (mk_real_int64 63L); (mk_real_int64 86L); (mk_real_int64 20L); (mk_real_int64 11L); (mk_real_int64 74L); (mk_real_int64 98L); (mk_real_int64 84L); (mk_real_int64 61L); (mk_real_int64 84L); (mk_real_int64 44L); ]); +("y5_def", [0; 4; 14; 19; 20; 22; 26; 30; 33; 34; 36; 41; 50; 52; 54; ], [(mk_real_int64 50L); (mk_real_int64 50L); (mk_real_int64 11L); (mk_real_int64 17L); (mk_real_int64 46L); (mk_real_int64 177L); (mk_real_int64 61L); (mk_real_int64 61L); (mk_real_int64 177L); (mk_real_int64 17L); (mk_real_int64 46L); (mk_real_int64 11L); (mk_real_int64 44L); (mk_real_int64 145L); (mk_real_int64 44L); ]); +("y5_def_neg", [7; 8; 10; 12; 21; 23; 27; 29; 31; 35; 42; 47; 48; 51; 55; ], [(mk_real_int64 8L); (mk_real_int64 11L); (mk_real_int64 19L); (mk_real_int64 11L); (mk_real_int64 63L); (mk_real_int64 46L); (mk_real_int64 63L); (mk_real_int64 63L); (mk_real_int64 46L); (mk_real_int64 63L); (mk_real_int64 11L); (mk_real_int64 98L); (mk_real_int64 34L); (mk_real_int64 61L); (mk_real_int64 44L); ]); +("y6_def", [0; 4; 9; 14; 19; 20; 22; 26; 28; 30; 33; 34; 36; 41; 50; 52; 54; ], [(mk_real_int64 50L); (mk_real_int64 50L); (mk_real_int64 37L); (mk_real_int64 11L); (mk_real_int64 17L); (mk_real_int64 46L); (mk_real_int64 177L); (mk_real_int64 63L); (mk_real_int64 3L); (mk_real_int64 61L); (mk_real_int64 177L); (mk_real_int64 17L); (mk_real_int64 46L); (mk_real_int64 11L); (mk_real_int64 44L); (mk_real_int64 145L); (mk_real_int64 44L); ]); +("y6_def_neg", [7; 8; 10; 12; 21; 23; 27; 29; 31; 35; 42; 47; 48; 51; 55; ], [(mk_real_int64 8L); (mk_real_int64 11L); (mk_real_int64 19L); (mk_real_int64 11L); (mk_real_int64 63L); (mk_real_int64 46L); (mk_real_int64 63L); (mk_real_int64 61L); (mk_real_int64 46L); (mk_real_int64 63L); (mk_real_int64 11L); (mk_real_int64 98L); (mk_real_int64 34L); (mk_real_int64 61L); (mk_real_int64 44L); ]); +("RHA", [0; 4; 6; 7; 8; 9; 10; 11; 12; 13; 14; 19; 23; 24; 26; 30; 31; 32; 33; 34; 41; 42; 43; 44; 46; 47; 48; 49; 50; 51; 52; 53; 54; 55; ], [(mk_real_int64 125L); (mk_real_int64 125L); (mk_real_int64 356L); (mk_real_int64 196L); (mk_real_int64 302L); (mk_real_int64 302L); (mk_real_int64 196L); (mk_real_int64 356L); (mk_real_int64 302L); (mk_real_int64 356L); (mk_real_int64 327L); (mk_real_int64 104L); (mk_real_int64 212L); (mk_real_int64 68L); (mk_real_int64 144L); (mk_real_int64 144L); (mk_real_int64 68L); (mk_real_int64 212L); (mk_real_int64 27L); (mk_real_int64 77L); (mk_real_int64 327L); (mk_real_int64 356L); (mk_real_int64 302L); (mk_real_int64 70L); (mk_real_int64 70L); (mk_real_int64 339L); (mk_real_int64 70L); (mk_real_int64 339L); (mk_real_int64 16L); (mk_real_int64 84L); (mk_real_int64 16L); (mk_real_int64 327L); (mk_real_int64 205L); (mk_real_int64 327L); ]); +("yy10", [4; 6; ], [(mk_real_int64 32L); (mk_real_int64 32L); ]); +("tau4", [0; 1; ], [(mk_real_int64 77L); (mk_real_int64 77L); ]); +("tau6", [0; ], [(mk_real_int64 884L); ]); +("ineq105", [0; 4; ], [(mk_real_int64 125L); (mk_real_int64 125L); ]); +("ineq106", [8; 9; 10; 12; 23; 24; 26; 27; 31; 36; 38; 40; ], [(mk_real_int64 29L); (mk_real_int64 21L); (mk_real_int64 125L); (mk_real_int64 337L); (mk_real_int64 310L); (mk_real_int64 48L); (mk_real_int64 125L); (mk_real_int64 29L); (mk_real_int64 70L); (mk_real_int64 122L); (mk_real_int64 122L); (mk_real_int64 122L); ]); +("ineq107", [1; 4; 17; 19; 34; ], [(mk_real_int64 53L); (mk_real_int64 53L); (mk_real_int64 412L); (mk_real_int64 412L); (mk_real_int64 222L); ]); +("ineq108", [9; 12; 23; ], [(mk_real_int64 27L); (mk_real_int64 150L); (mk_real_int64 176L); ]); +("ineq109", [16; 20; 38; ], [(mk_real_int64 189L); (mk_real_int64 189L); (mk_real_int64 311L); ]); +("ineq110", [13; 21; 33; ], [(mk_real_int64 10L); (mk_real_int64 10L); (mk_real_int64 499L); ]); +("ineq111", [2; 4; 6; 11; 13; 21; 25; 28; 31; 37; 41; ], [(mk_real_int64 85L); (mk_real_int64 85L); (mk_real_int64 85L); (mk_real_int64 505L); (mk_real_int64 349L); (mk_real_int64 349L); (mk_real_int64 505L); (mk_real_int64 85L); (mk_real_int64 204L); (mk_real_int64 490L); (mk_real_int64 355L); ]); +("ineq112", [34; ], [(mk_real_int64 370L); ]); +("ineq113", [34; ], [(mk_real_int64 300L); ]); +("ineq114", [0; 5; 7; 9; 13; 15; 16; 18; 20; 22; 24; 28; 30; 32; 37; 40; ], [(mk_real_int64 568L); (mk_real_int64 568L); (mk_real_int64 568L); (mk_real_int64 379L); (mk_real_int64 322L); (mk_real_int64 209L); (mk_real_int64 531L); (mk_real_int64 209L); (mk_real_int64 531L); (mk_real_int64 322L); (mk_real_int64 379L); (mk_real_int64 568L); (mk_real_int64 367L); (mk_real_int64 367L); (mk_real_int64 149L); (mk_real_int64 327L); ]); +("ineq119", [0; 6; ], [(mk_real_int64 721L); (mk_real_int64 721L); ]); +("ineq120", [2; 4; ], [(mk_real_int64 211L); (mk_real_int64 211L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 2725L); (mk_real_int64 2675L); (mk_real_int64 2575L); (mk_real_int64 2600L); (mk_real_int64 2575L); (mk_real_int64 2675L); (mk_real_int64 2675L); (mk_real_int64 2600L); (mk_real_int64 2675L); (mk_real_int64 2825L); (mk_real_int64 2675L); (mk_real_int64 2675L); (mk_real_int64 2675L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_lo", [6; 11; 13; 17; 23; 25; 26; 27; 28; 29; 30; 32; 33; 37; 42; 44; 46; 48; 54; ], [(mk_real_int64 432L); (mk_real_int64 432L); (mk_real_int64 432L); (mk_real_int64 62L); (mk_real_int64 428L); (mk_real_int64 166L); (mk_real_int64 594L); (mk_real_int64 1000L); (mk_real_int64 166L); (mk_real_int64 1000L); (mk_real_int64 594L); (mk_real_int64 428L); (mk_real_int64 1000L); (mk_real_int64 62L); (mk_real_int64 432L); (mk_real_int64 258L); (mk_real_int64 258L); (mk_real_int64 290L); (mk_real_int64 298L); ]); +("azim_hi", [2; 5; 15; 19; 34; 39; 51; ], [(mk_real_int64 600000L); (mk_real_int64 249000L); (mk_real_int64 387L); (mk_real_int64 254L); (mk_real_int64 254L); (mk_real_int64 387L); (mk_real_int64 274L); ]); +("rhazim_hi", [2; 5; ], [(mk_real_int64 144000L); (mk_real_int64 35000L); ]); +("rho_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 2116L); (mk_real_int64 1556L); (mk_real_int64 4056L); (mk_real_int64 2160L); (mk_real_int64 4056L); (mk_real_int64 1556L); (mk_real_int64 1556L); (mk_real_int64 2160L); (mk_real_int64 1556L); (mk_real_int64 220L); (mk_real_int64 1556L); (mk_real_int64 1556L); (mk_real_int64 1556L); ]); +("tau_lo", [6; 9; 13; 15; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 233000L); ]); +("tau_hi", [15; ], [(mk_real_int64 1000L); ]); +("y1_lo", [0; 4; 7; 8; 12; 14; 23; 26; 30; 31; 41; 42; 47; 50; 51; 52; 54; ], [(mk_real_int64 375L); (mk_real_int64 375L); (mk_real_int64 500L); (mk_real_int64 300L); (mk_real_int64 300L); (mk_real_int64 400L); (mk_real_int64 20L); (mk_real_int64 539L); (mk_real_int64 539L); (mk_real_int64 20L); (mk_real_int64 400L); (mk_real_int64 300L); (mk_real_int64 380L); (mk_real_int64 200L); (mk_real_int64 200L); (mk_real_int64 161L); (mk_real_int64 200L); ]); +("y1_hi", [10; 19; 21; 22; 33; 34; 35; 45; 55; ], [(mk_real_int64 200L); (mk_real_int64 55L); (mk_real_int64 100L); (mk_real_int64 550L); (mk_real_int64 640L); (mk_real_int64 200L); (mk_real_int64 100L); (mk_real_int64 280L); (mk_real_int64 100L); ]); +("y2_hi", [0; 4; 19; 21; 22; 27; 29; 34; 35; 48; 50; 54; 55; ], [(mk_real_int64 250L); (mk_real_int64 250L); (mk_real_int64 472L); (mk_real_int64 100L); (mk_real_int64 268L); (mk_real_int64 376L); (mk_real_int64 376L); (mk_real_int64 472L); (mk_real_int64 100L); (mk_real_int64 256L); (mk_real_int64 408L); (mk_real_int64 408L); (mk_real_int64 100L); ]); +("y2_lo", [7; 8; 10; 12; 14; 20; 23; 26; 30; 31; 33; 36; 41; 42; 45; 47; 51; 52; ], [(mk_real_int64 56L); (mk_real_int64 300L); (mk_real_int64 356L); (mk_real_int64 300L); (mk_real_int64 444L); (mk_real_int64 500L); (mk_real_int64 20L); (mk_real_int64 539L); (mk_real_int64 539L); (mk_real_int64 20L); (mk_real_int64 96L); (mk_real_int64 500L); (mk_real_int64 444L); (mk_real_int64 300L); (mk_real_int64 240L); (mk_real_int64 380L); (mk_real_int64 200L); (mk_real_int64 553L); ]); +("y3_hi", [0; 4; 19; 21; 22; 27; 29; 34; 35; 48; 50; 54; 55; ], [(mk_real_int64 250L); (mk_real_int64 250L); (mk_real_int64 472L); (mk_real_int64 100L); (mk_real_int64 268L); (mk_real_int64 376L); (mk_real_int64 376L); (mk_real_int64 472L); (mk_real_int64 100L); (mk_real_int64 256L); (mk_real_int64 408L); (mk_real_int64 408L); (mk_real_int64 100L); ]); +("y3_lo", [7; 8; 10; 12; 14; 20; 23; 26; 30; 31; 33; 36; 41; 42; 45; 47; 51; 52; ], [(mk_real_int64 56L); (mk_real_int64 300L); (mk_real_int64 356L); (mk_real_int64 300L); (mk_real_int64 444L); (mk_real_int64 500L); (mk_real_int64 20L); (mk_real_int64 539L); (mk_real_int64 539L); (mk_real_int64 20L); (mk_real_int64 96L); (mk_real_int64 500L); (mk_real_int64 444L); (mk_real_int64 300L); (mk_real_int64 240L); (mk_real_int64 380L); (mk_real_int64 200L); (mk_real_int64 553L); ]); +("y4_hi", [2; 6; 8; 9; 10; 13; 16; 17; 19; 20; 21; 23; 24; 26; 27; 28; 31; 33; 34; 36; 38; 40; ], [(mk_real_int64 375L); (mk_real_int64 375L); (mk_real_int64 135L); (mk_real_int64 120L); (mk_real_int64 375L); (mk_real_int64 415L); (mk_real_int64 236L); (mk_real_int64 476L); (mk_real_int64 476L); (mk_real_int64 236L); (mk_real_int64 415L); (mk_real_int64 90L); (mk_real_int64 120L); (mk_real_int64 375L); (mk_real_int64 135L); (mk_real_int64 375L); (mk_real_int64 550L); (mk_real_int64 196L); (mk_real_int64 606L); (mk_real_int64 430L); (mk_real_int64 194L); (mk_real_int64 430L); ]); +("y4_lo", [1; 4; 11; 12; 25; 37; 41; ], [(mk_real_int64 31L); (mk_real_int64 656L); (mk_real_int64 125L); (mk_real_int64 595L); (mk_real_int64 125L); (mk_real_int64 250L); (mk_real_int64 375L); ]); +("y5_hi", [0; 4; 8; 10; 12; 19; 22; 23; 26; 27; 29; 30; 31; 34; 42; 47; 48; 50; 52; 54; ], [(mk_real_int64 250L); (mk_real_int64 250L); (mk_real_int64 375L); (mk_real_int64 319L); (mk_real_int64 375L); (mk_real_int64 472L); (mk_real_int64 268L); (mk_real_int64 415L); (mk_real_int64 236L); (mk_real_int64 376L); (mk_real_int64 376L); (mk_real_int64 236L); (mk_real_int64 415L); (mk_real_int64 472L); (mk_real_int64 375L); (mk_real_int64 196L); (mk_real_int64 256L); (mk_real_int64 408L); (mk_real_int64 172L); (mk_real_int64 408L); ]); +("y5_lo", [7; 14; 20; 21; 33; 35; 36; 41; 45; 51; 55; ], [(mk_real_int64 56L); (mk_real_int64 444L); (mk_real_int64 500L); (mk_real_int64 125L); (mk_real_int64 96L); (mk_real_int64 125L); (mk_real_int64 500L); (mk_real_int64 444L); (mk_real_int64 20L); (mk_real_int64 250L); (mk_real_int64 375L); ]); +("y6_hi", [0; 4; 8; 10; 12; 19; 22; 23; 26; 27; 29; 30; 31; 34; 42; 47; 48; 50; 52; 54; ], [(mk_real_int64 250L); (mk_real_int64 250L); (mk_real_int64 375L); (mk_real_int64 319L); (mk_real_int64 375L); (mk_real_int64 472L); (mk_real_int64 268L); (mk_real_int64 415L); (mk_real_int64 236L); (mk_real_int64 376L); (mk_real_int64 376L); (mk_real_int64 236L); (mk_real_int64 415L); (mk_real_int64 472L); (mk_real_int64 375L); (mk_real_int64 196L); (mk_real_int64 256L); (mk_real_int64 408L); (mk_real_int64 172L); (mk_real_int64 408L); ]); +("y6_lo", [7; 9; 14; 20; 21; 26; 28; 29; 33; 35; 36; 41; 45; 51; 55; ], [(mk_real_int64 56L); (mk_real_int64 37000L); (mk_real_int64 444L); (mk_real_int64 500L); (mk_real_int64 125L); (mk_real_int64 2000L); (mk_real_int64 3000L); (mk_real_int64 2000L); (mk_real_int64 96L); (mk_real_int64 125L); (mk_real_int64 500L); (mk_real_int64 444L); (mk_real_int64 20L); (mk_real_int64 250L); (mk_real_int64 375L); ]); +("ye_lo", [4; 6; 8; 9; 22; 24; 28; 32; 33; 49; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_hi", [1; 3; 5; 7; 9; 12; ], [(mk_real_int64 488L); (mk_real_int64 2168L); (mk_real_int64 488L); (mk_real_int64 1168L); (mk_real_int64 1972L); (mk_real_int64 488L); ]); +("yn_lo", [0; 2; 4; 6; 8; 10; 11; ], [(mk_real_int64 72L); (mk_real_int64 998L); (mk_real_int64 998L); (mk_real_int64 512L); (mk_real_int64 512L); (mk_real_int64 512L); (mk_real_int64 512L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests/86324340346_out.hl b/formal_lp/old/ineqs/tests/86324340346_out.hl new file mode 100644 index 0000000..962348f --- /dev/null +++ b/formal_lp/old/ineqs/tests/86324340346_out.hl @@ -0,0 +1,90 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "86324340346 19 6 0 1 2 3 4 5 4 0 5 6 7 3 6 5 4 3 6 4 8 3 8 4 3 4 8 3 9 10 3 9 3 2 3 9 2 11 3 11 2 12 3 12 2 1 3 12 1 0 3 12 0 13 3 13 0 7 3 13 7 10 3 8 10 7 3 11 12 13 3 7 6 8 3 11 13 10 3 10 9 11 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [5; 7; 9; 10; 11; ], [(mk_real_int64 54L); (mk_real_int64 458L); (mk_real_int64 216L); (mk_real_int64 137L); (mk_real_int64 543L); ]); +("azim_sum_neg", [0; 1; 4; 6; 8; 12; 13; ], [(mk_real_int64 26L); (mk_real_int64 19L); (mk_real_int64 460L); (mk_real_int64 137L); (mk_real_int64 26L); (mk_real_int64 93L); (mk_real_int64 50L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 972L); (mk_real_int64 1045L); (mk_real_int64 1026L); (mk_real_int64 1026L); (mk_real_int64 799L); (mk_real_int64 1026L); (mk_real_int64 799L); (mk_real_int64 1026L); (mk_real_int64 946L); (mk_real_int64 1026L); (mk_real_int64 1026L); (mk_real_int64 1026L); (mk_real_int64 1026L); (mk_real_int64 1015L); ]); +("sol_sum3", [0; 1; 6; 7; ], [(mk_real_int64 26L); (mk_real_int64 26L); (mk_real_int64 137L); (mk_real_int64 137L); ]); +("sol_sum3_neg", [5; 9; 10; 11; ], [(mk_real_int64 83L); (mk_real_int64 54L); (mk_real_int64 458L); (mk_real_int64 234L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; ], [(mk_real_int64 946L); (mk_real_int64 946L); (mk_real_int64 1026L); (mk_real_int64 1026L); (mk_real_int64 966L); (mk_real_int64 580L); (mk_real_int64 799L); (mk_real_int64 799L); (mk_real_int64 799L); (mk_real_int64 1026L); (mk_real_int64 1026L); (mk_real_int64 1026L); (mk_real_int64 799L); (mk_real_int64 946L); (mk_real_int64 1015L); (mk_real_int64 966L); ]); +("tau_sum4_neg", [0; 1; ], [(mk_real_int64 946L); (mk_real_int64 1026L); ]); +("tau_sum6_neg", [0; ], [(mk_real_int64 1026L); ]); +("ln_def_neg", [0; 1; 2; 3; 5; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 72L); (mk_real_int64 152L); (mk_real_int64 131L); (mk_real_int64 131L); (mk_real_int64 131L); (mk_real_int64 131L); (mk_real_int64 43L); (mk_real_int64 131L); (mk_real_int64 131L); (mk_real_int64 131L); (mk_real_int64 131L); (mk_real_int64 119L); ]); +("ln_def", [4; 6; ], [(mk_real_int64 119L); (mk_real_int64 119L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 6107L); (mk_real_int64 6564L); (mk_real_int64 6446L); (mk_real_int64 6446L); (mk_real_int64 5023L); (mk_real_int64 6446L); (mk_real_int64 5023L); (mk_real_int64 6446L); (mk_real_int64 5942L); (mk_real_int64 6446L); (mk_real_int64 6446L); (mk_real_int64 6446L); (mk_real_int64 6446L); (mk_real_int64 6379L); ]); +("edge_sym", [0; 5; 7; 22; 31; 37; 39; 43; 45; 52; ], [(mk_real_int64 22L); (mk_real_int64 22L); (mk_real_int64 79L); (mk_real_int64 55L); (mk_real_int64 94L); (mk_real_int64 277L); (mk_real_int64 231L); (mk_real_int64 30L); (mk_real_int64 47L); (mk_real_int64 148L); ]); +("edge_sym_neg", [12; 14; 15; 18; 25; 27; 28; 30; 40; 46; 49; 58; ], [(mk_real_int64 106L); (mk_real_int64 21L); (mk_real_int64 21L); (mk_real_int64 55L); (mk_real_int64 142L); (mk_real_int64 94L); (mk_real_int64 87L); (mk_real_int64 224L); (mk_real_int64 130L); (mk_real_int64 166L); (mk_real_int64 109L); (mk_real_int64 31L); ]); +("y1_def_neg", [0; 11; 12; 13; 15; 16; 18; 19; 25; 26; 28; 29; 32; 37; 39; 40; 41; 42; 43; 46; 50; 52; 53; 55; 57; 58; 59; 61; ], [(mk_real_int64 17L); (mk_real_int64 16L); (mk_real_int64 144L); (mk_real_int64 4L); (mk_real_int64 64L); (mk_real_int64 42L); (mk_real_int64 175L); (mk_real_int64 43L); (mk_real_int64 185L); (mk_real_int64 4L); (mk_real_int64 129L); (mk_real_int64 182L); (mk_real_int64 11L); (mk_real_int64 24L); (mk_real_int64 134L); (mk_real_int64 296L); (mk_real_int64 7L); (mk_real_int64 169L); (mk_real_int64 74L); (mk_real_int64 160L); (mk_real_int64 87L); (mk_real_int64 101L); (mk_real_int64 67L); (mk_real_int64 48L); (mk_real_int64 219L); (mk_real_int64 134L); (mk_real_int64 19L); (mk_real_int64 10L); ]); +("y1_def", [23; 31; 34; 36; 38; 44; 47; 48; 51; 54; 56; 60; ], [(mk_real_int64 47L); (mk_real_int64 31L); (mk_real_int64 100L); (mk_real_int64 141L); (mk_real_int64 68L); (mk_real_int64 334L); (mk_real_int64 9L); (mk_real_int64 35L); (mk_real_int64 68L); (mk_real_int64 13L); (mk_real_int64 25L); (mk_real_int64 17L); ]); +("y2_def", [0; 11; 16; 19; 26; 29; 31; 39; 40; 41; 43; 44; 48; 52; 53; 55; 58; 59; ], [(mk_real_int64 22L); (mk_real_int64 10L); (mk_real_int64 66L); (mk_real_int64 55L); (mk_real_int64 2L); (mk_real_int64 110L); (mk_real_int64 31L); (mk_real_int64 82L); (mk_real_int64 5L); (mk_real_int64 10L); (mk_real_int64 167L); (mk_real_int64 125L); (mk_real_int64 61L); (mk_real_int64 61L); (mk_real_int64 59L); (mk_real_int64 29L); (mk_real_int64 201L); (mk_real_int64 12L); ]); +("y2_def_neg", [12; 13; 15; 18; 23; 25; 28; 32; 34; 36; 37; 38; 42; 46; 47; 50; 51; 54; 56; 57; 60; 61; ], [(mk_real_int64 144L); (mk_real_int64 4L); (mk_real_int64 45L); (mk_real_int64 175L); (mk_real_int64 14L); (mk_real_int64 185L); (mk_real_int64 129L); (mk_real_int64 11L); (mk_real_int64 57L); (mk_real_int64 70L); (mk_real_int64 24L); (mk_real_int64 21L); (mk_real_int64 169L); (mk_real_int64 160L); (mk_real_int64 3L); (mk_real_int64 36L); (mk_real_int64 21L); (mk_real_int64 4L); (mk_real_int64 8L); (mk_real_int64 129L); (mk_real_int64 5L); (mk_real_int64 10L); ]); +("y3_def", [0; 11; 16; 19; 26; 29; 31; 39; 40; 41; 43; 44; 48; 52; 53; 55; 58; 59; ], [(mk_real_int64 22L); (mk_real_int64 10L); (mk_real_int64 66L); (mk_real_int64 55L); (mk_real_int64 2L); (mk_real_int64 110L); (mk_real_int64 31L); (mk_real_int64 82L); (mk_real_int64 5L); (mk_real_int64 10L); (mk_real_int64 167L); (mk_real_int64 125L); (mk_real_int64 61L); (mk_real_int64 61L); (mk_real_int64 59L); (mk_real_int64 29L); (mk_real_int64 201L); (mk_real_int64 12L); ]); +("y3_def_neg", [12; 13; 15; 18; 23; 25; 28; 32; 34; 36; 37; 38; 42; 46; 47; 50; 51; 54; 56; 57; 60; 61; ], [(mk_real_int64 144L); (mk_real_int64 4L); (mk_real_int64 45L); (mk_real_int64 175L); (mk_real_int64 14L); (mk_real_int64 185L); (mk_real_int64 129L); (mk_real_int64 11L); (mk_real_int64 57L); (mk_real_int64 70L); (mk_real_int64 24L); (mk_real_int64 21L); (mk_real_int64 169L); (mk_real_int64 160L); (mk_real_int64 3L); (mk_real_int64 36L); (mk_real_int64 21L); (mk_real_int64 4L); (mk_real_int64 8L); (mk_real_int64 129L); (mk_real_int64 5L); (mk_real_int64 10L); ]); +("y4_def_neg", [1; 2; 5; 6; 8; 11; 12; 14; 15; 17; 18; 23; 25; 26; 27; 28; 29; 32; 34; 36; 38; 39; 41; 43; 44; 45; 47; ], [(mk_real_int64 18L); (mk_real_int64 88L); (mk_real_int64 50L); (mk_real_int64 124L); (mk_real_int64 121L); (mk_real_int64 128L); (mk_real_int64 4L); (mk_real_int64 90L); (mk_real_int64 207L); (mk_real_int64 16L); (mk_real_int64 7L); (mk_real_int64 17L); (mk_real_int64 153L); (mk_real_int64 338L); (mk_real_int64 19L); (mk_real_int64 117L); (mk_real_int64 287L); (mk_real_int64 111L); (mk_real_int64 106L); (mk_real_int64 75L); (mk_real_int64 115L); (mk_real_int64 111L); (mk_real_int64 55L); (mk_real_int64 224L); (mk_real_int64 379L); (mk_real_int64 22L); (mk_real_int64 7L); ]); +("y4_def", [3; 9; 20; 22; 24; 30; 33; 37; 40; 42; 46; ], [(mk_real_int64 8L); (mk_real_int64 72L); (mk_real_int64 231L); (mk_real_int64 294L); (mk_real_int64 106L); (mk_real_int64 158L); (mk_real_int64 14L); (mk_real_int64 106L); (mk_real_int64 20L); (mk_real_int64 38L); (mk_real_int64 26L); ]); +("y5_def", [0; 11; 13; 16; 19; 26; 29; 34; 39; 40; 41; 43; 52; 53; 55; 58; 59; ], [(mk_real_int64 22L); (mk_real_int64 10L); (mk_real_int64 8L); (mk_real_int64 66L); (mk_real_int64 55L); (mk_real_int64 2L); (mk_real_int64 110L); (mk_real_int64 7L); (mk_real_int64 82L); (mk_real_int64 44L); (mk_real_int64 10L); (mk_real_int64 136L); (mk_real_int64 61L); (mk_real_int64 59L); (mk_real_int64 29L); (mk_real_int64 201L); (mk_real_int64 12L); ]); +("y5_def_neg", [12; 15; 18; 23; 25; 28; 31; 32; 36; 37; 38; 42; 44; 46; 47; 48; 50; 51; 54; 56; 57; 60; 61; ], [(mk_real_int64 88L); (mk_real_int64 29L); (mk_real_int64 121L); (mk_real_int64 14L); (mk_real_int64 128L); (mk_real_int64 90L); (mk_real_int64 16L); (mk_real_int64 7L); (mk_real_int64 5L); (mk_real_int64 17L); (mk_real_int64 21L); (mk_real_int64 117L); (mk_real_int64 138L); (mk_real_int64 111L); (mk_real_int64 3L); (mk_real_int64 61L); (mk_real_int64 19L); (mk_real_int64 21L); (mk_real_int64 4L); (mk_real_int64 8L); (mk_real_int64 74L); (mk_real_int64 5L); (mk_real_int64 7L); ]); +("y6_def", [0; 11; 13; 16; 17; 19; 23; 24; 26; 29; 34; 35; 39; 40; 41; 43; 44; 47; 50; 51; 52; 53; 54; 55; 56; 58; 59; 60; ], [(mk_real_int64 22L); (mk_real_int64 88L); (mk_real_int64 156L); (mk_real_int64 142L); (mk_real_int64 245L); (mk_real_int64 55L); (mk_real_int64 128L); (mk_real_int64 56L); (mk_real_int64 232L); (mk_real_int64 110L); (mk_real_int64 7L); (mk_real_int64 22L); (mk_real_int64 82L); (mk_real_int64 44L); (mk_real_int64 174L); (mk_real_int64 136L); (mk_real_int64 82L); (mk_real_int64 5L); (mk_real_int64 42L); (mk_real_int64 144L); (mk_real_int64 61L); (mk_real_int64 59L); (mk_real_int64 103L); (mk_real_int64 29L); (mk_real_int64 305L); (mk_real_int64 201L); (mk_real_int64 12L); (mk_real_int64 116L); ]); +("y6_def_neg", [12; 15; 18; 25; 28; 31; 32; 36; 37; 38; 42; 46; 48; 57; 61; ], [(mk_real_int64 88L); (mk_real_int64 29L); (mk_real_int64 121L); (mk_real_int64 128L); (mk_real_int64 90L); (mk_real_int64 16L); (mk_real_int64 7L); (mk_real_int64 5L); (mk_real_int64 17L); (mk_real_int64 21L); (mk_real_int64 117L); (mk_real_int64 111L); (mk_real_int64 61L); (mk_real_int64 74L); (mk_real_int64 7L); ]); +("RHA", [4; 6; 7; 9; 12; 14; 15; 17; 26; 27; 28; 29; 30; 31; 33; 37; 39; 50; 52; 59; 60; 61; ], [(mk_real_int64 19L); (mk_real_int64 80L); (mk_real_int64 26L); (mk_real_int64 80L); (mk_real_int64 99L); (mk_real_int64 99L); (mk_real_int64 61L); (mk_real_int64 19L); (mk_real_int64 54L); (mk_real_int64 60L); (mk_real_int64 50L); (mk_real_int64 133L); (mk_real_int64 446L); (mk_real_int64 219L); (mk_real_int64 227L); (mk_real_int64 227L); (mk_real_int64 3L); (mk_real_int64 163L); (mk_real_int64 58L); (mk_real_int64 28L); (mk_real_int64 60L); (mk_real_int64 50L); ]); +("RHB", [1; ], [(mk_real_int64 227L); ]); +("yy10", [6; ], [(mk_real_int64 22L); ]); +("tau6", [0; ], [(mk_real_int64 1026L); ]); +("ineq105", [0; 10; ], [(mk_real_int64 54L); (mk_real_int64 138L); ]); +("ineq106", [1; 5; 12; 15; 25; 26; 36; 38; 39; 41; 43; 44; 45; ], [(mk_real_int64 26L); (mk_real_int64 20L); (mk_real_int64 6L); (mk_real_int64 303L); (mk_real_int64 224L); (mk_real_int64 227L); (mk_real_int64 53L); (mk_real_int64 169L); (mk_real_int64 80L); (mk_real_int64 80L); (mk_real_int64 11L); (mk_real_int64 11L); (mk_real_int64 32L); ]); +("ineq107", [9; 20; 22; 24; 30; 33; 37; 40; 42; 46; ], [(mk_real_int64 93L); (mk_real_int64 242L); (mk_real_int64 323L); (mk_real_int64 137L); (mk_real_int64 321L); (mk_real_int64 18L); (mk_real_int64 137L); (mk_real_int64 26L); (mk_real_int64 50L); (mk_real_int64 33L); ]); +("ineq108", [6; 26; 27; 29; 34; 39; 43; 44; ], [(mk_real_int64 181L); (mk_real_int64 137L); (mk_real_int64 28L); (mk_real_int64 404L); (mk_real_int64 43L); (mk_real_int64 82L); (mk_real_int64 133L); (mk_real_int64 543L); ]); +("ineq109", [2; 3; 20; 22; ], [(mk_real_int64 26L); (mk_real_int64 26L); (mk_real_int64 137L); (mk_real_int64 137L); ]); +("ineq110", [17; 29; 30; 34; ], [(mk_real_int64 83L); (mk_real_int64 54L); (mk_real_int64 458L); (mk_real_int64 234L); ]); +("ineq111", [2; 5; 8; 11; 14; 18; 23; 26; 28; 32; 34; 36; 43; 47; ], [(mk_real_int64 775L); (mk_real_int64 292L); (mk_real_int64 970L); (mk_real_int64 1026L); (mk_real_int64 718L); (mk_real_int64 59L); (mk_real_int64 133L); (mk_real_int64 709L); (mk_real_int64 938L); (mk_real_int64 890L); (mk_real_int64 243L); (mk_real_int64 307L); (mk_real_int64 1008L); (mk_real_int64 54L); ]); +("ineq112", [20; ], [(mk_real_int64 160L); ]); +("ineq113", [12; ], [(mk_real_int64 151L); ]); +("ineq114", [2; 4; 5; 6; 13; 16; 19; 23; 25; 27; 32; 34; 35; 36; 38; 39; 41; 43; 45; ], [(mk_real_int64 170L); (mk_real_int64 170L); (mk_real_int64 484L); (mk_real_int64 56L); (mk_real_int64 96L); (mk_real_int64 580L); (mk_real_int64 580L); (mk_real_int64 666L); (mk_real_int64 90L); (mk_real_int64 88L); (mk_real_int64 136L); (mk_real_int64 425L); (mk_real_int64 358L); (mk_real_int64 181L); (mk_real_int64 312L); (mk_real_int64 601L); (mk_real_int64 345L); (mk_real_int64 7L); (mk_real_int64 912L); ]); +("ineq119", [2; 6; ], [(mk_real_int64 58L); (mk_real_int64 206L); ]); +("ineq120", [0; 3; 4; 7; ], [(mk_real_int64 177L); (mk_real_int64 711L); (mk_real_int64 103L); (mk_real_int64 717L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 3275L); (mk_real_int64 3300L); (mk_real_int64 2950L); (mk_real_int64 2950L); (mk_real_int64 1975L); (mk_real_int64 2950L); (mk_real_int64 1975L); (mk_real_int64 2950L); (mk_real_int64 3150L); (mk_real_int64 2950L); (mk_real_int64 2950L); (mk_real_int64 2950L); (mk_real_int64 2950L); (mk_real_int64 2675L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_lo", [8; 15; 21; 26; 33; 34; 37; 39; 55; 59; ], [(mk_real_int64 274L); (mk_real_int64 16L); (mk_real_int64 318L); (mk_real_int64 109L); (mk_real_int64 920L); (mk_real_int64 120L); (mk_real_int64 1084L); (mk_real_int64 660L); (mk_real_int64 30L); (mk_real_int64 88L); ]); +("azim_hi", [1; 5; 6; 9; 12; 14; 16; 19; 22; 27; 30; 31; 41; 46; 48; 49; 50; 52; 53; 57; ], [(mk_real_int64 726952L); (mk_real_int64 26000L); (mk_real_int64 166L); (mk_real_int64 938L); (mk_real_int64 420L); (mk_real_int64 420L); (mk_real_int64 56L); (mk_real_int64 74L); (mk_real_int64 486L); (mk_real_int64 96L); (mk_real_int64 80L); (mk_real_int64 1000L); (mk_real_int64 88L); (mk_real_int64 136L); (mk_real_int64 50L); (mk_real_int64 108L); (mk_real_int64 306L); (mk_real_int64 312L); (mk_real_int64 226L); (mk_real_int64 382L); ]); +("rhazim_hi", [5; 15; 28; 29; 61; ], [(mk_real_int64 54000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_hi", [0; 1; 2; 3; 5; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 1048L); (mk_real_int64 2780L); (mk_real_int64 1384L); (mk_real_int64 1384L); (mk_real_int64 1384L); (mk_real_int64 1384L); (mk_real_int64 2664L); (mk_real_int64 1384L); (mk_real_int64 1384L); (mk_real_int64 1384L); (mk_real_int64 1384L); ]); +("rho_lo", [4; 6; 13; ], [(mk_real_int64 2084L); (mk_real_int64 2084L); (mk_real_int64 740L); ]); +("tau_hi", [15; ], [(mk_real_int64 1000L); ]); +("tau_lo", [2; 7; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("y1_lo", [0; 15; 16; 19; 23; 28; 36; 39; 40; 43; 46; 50; 52; 53; 57; 58; 59; 60; ], [(mk_real_int64 10L); (mk_real_int64 560L); (mk_real_int64 535L); (mk_real_int64 470L); (mk_real_int64 500L); (mk_real_int64 240L); (mk_real_int64 187L); (mk_real_int64 400L); (mk_real_int64 15L); (mk_real_int64 420L); (mk_real_int64 200L); (mk_real_int64 60L); (mk_real_int64 400L); (mk_real_int64 270L); (mk_real_int64 295L); (mk_real_int64 205L); (mk_real_int64 200L); (mk_real_int64 500L); ]); +("y1_hi", [11; 12; 13; 18; 25; 26; 29; 31; 32; 34; 37; 38; 41; 42; 44; 48; 51; 61; ], [(mk_real_int64 400L); (mk_real_int64 574L); (mk_real_int64 74L); (mk_real_int64 400L); (mk_real_int64 320L); (mk_real_int64 400L); (mk_real_int64 200L); (mk_real_int64 540L); (mk_real_int64 380L); (mk_real_int64 313L); (mk_real_int64 60L); (mk_real_int64 500L); (mk_real_int64 420L); (mk_real_int64 160L); (mk_real_int64 540L); (mk_real_int64 75L); (mk_real_int64 500L); (mk_real_int64 280L); ]); +("y2_lo", [0; 11; 15; 16; 23; 28; 34; 39; 40; 46; 48; 53; 57; 59; 60; ], [(mk_real_int64 292L); (mk_real_int64 536L); (mk_real_int64 280L); (mk_real_int64 116L); (mk_real_int64 136L); (mk_real_int64 240L); (mk_real_int64 471L); (mk_real_int64 464L); (mk_real_int64 124L); (mk_real_int64 200L); (mk_real_int64 168L); (mk_real_int64 32L); (mk_real_int64 24L); (mk_real_int64 352L); (mk_real_int64 16L); ]); +("y2_hi", [12; 13; 18; 19; 25; 26; 29; 31; 32; 36; 37; 38; 41; 42; 43; 44; 47; 50; 51; 52; 54; 55; 56; 58; 61; ], [(mk_real_int64 574L); (mk_real_int64 74L); (mk_real_int64 400L); (mk_real_int64 476L); (mk_real_int64 320L); (mk_real_int64 184L); (mk_real_int64 292L); (mk_real_int64 540L); (mk_real_int64 380L); (mk_real_int64 217L); (mk_real_int64 60L); (mk_real_int64 176L); (mk_real_int64 192L); (mk_real_int64 160L); (mk_real_int64 576L); (mk_real_int64 248L); (mk_real_int64 264L); (mk_real_int64 32L); (mk_real_int64 176L); (mk_real_int64 516L); (mk_real_int64 48L); (mk_real_int64 120L); (mk_real_int64 400L); (mk_real_int64 656L); (mk_real_int64 280L); ]); +("y3_lo", [0; 11; 15; 16; 23; 28; 34; 39; 40; 46; 48; 53; 57; 59; 60; ], [(mk_real_int64 292L); (mk_real_int64 536L); (mk_real_int64 280L); (mk_real_int64 116L); (mk_real_int64 136L); (mk_real_int64 240L); (mk_real_int64 471L); (mk_real_int64 464L); (mk_real_int64 124L); (mk_real_int64 200L); (mk_real_int64 168L); (mk_real_int64 32L); (mk_real_int64 24L); (mk_real_int64 352L); (mk_real_int64 16L); ]); +("y3_hi", [12; 13; 18; 19; 25; 26; 29; 31; 32; 36; 37; 38; 41; 42; 43; 44; 47; 50; 51; 52; 54; 55; 56; 58; 61; ], [(mk_real_int64 574L); (mk_real_int64 74L); (mk_real_int64 400L); (mk_real_int64 476L); (mk_real_int64 320L); (mk_real_int64 184L); (mk_real_int64 292L); (mk_real_int64 540L); (mk_real_int64 380L); (mk_real_int64 217L); (mk_real_int64 60L); (mk_real_int64 176L); (mk_real_int64 192L); (mk_real_int64 160L); (mk_real_int64 576L); (mk_real_int64 248L); (mk_real_int64 264L); (mk_real_int64 32L); (mk_real_int64 176L); (mk_real_int64 516L); (mk_real_int64 48L); (mk_real_int64 120L); (mk_real_int64 400L); (mk_real_int64 656L); (mk_real_int64 280L); ]); +("y4_hi", [1; 3; 6; 14; 20; 22; 23; 26; 30; 34; 36; 39; 40; 41; 42; 45; 47; ], [(mk_real_int64 190L); (mk_real_int64 424L); (mk_real_int64 15L); (mk_real_int64 250L); (mk_real_int64 454L); (mk_real_int64 67L); (mk_real_int64 375L); (mk_real_int64 35L); (mk_real_int64 365L); (mk_real_int64 306L); (mk_real_int64 320L); (mk_real_int64 30L); (mk_real_int64 98L); (mk_real_int64 200L); (mk_real_int64 650L); (mk_real_int64 80L); (mk_real_int64 250L); ]); +("y4_lo", [2; 5; 8; 9; 11; 12; 15; 17; 18; 24; 25; 27; 28; 29; 32; 33; 37; 38; 43; 44; 46; ], [(mk_real_int64 451L); (mk_real_int64 200L); (mk_real_int64 250L); (mk_real_int64 111L); (mk_real_int64 250L); (mk_real_int64 110L); (mk_real_int64 555L); (mk_real_int64 268L); (mk_real_int64 375L); (mk_real_int64 99L); (mk_real_int64 440L); (mk_real_int64 180L); (mk_real_int64 250L); (mk_real_int64 324L); (mk_real_int64 250L); (mk_real_int64 86L); (mk_real_int64 99L); (mk_real_int64 765L); (mk_real_int64 640L); (mk_real_int64 490L); (mk_real_int64 491L); ]); +("y5_lo", [0; 11; 12; 15; 16; 18; 23; 25; 31; 32; 39; 40; 42; 44; 46; 50; 53; 59; 60; ], [(mk_real_int64 292L); (mk_real_int64 536L); (mk_real_int64 451L); (mk_real_int64 220L); (mk_real_int64 116L); (mk_real_int64 250L); (mk_real_int64 136L); (mk_real_int64 250L); (mk_real_int64 268L); (mk_real_int64 375L); (mk_real_int64 464L); (mk_real_int64 129L); (mk_real_int64 250L); (mk_real_int64 560L); (mk_real_int64 250L); (mk_real_int64 83L); (mk_real_int64 32L); (mk_real_int64 352L); (mk_real_int64 16L); ]); +("y5_hi", [13; 19; 26; 28; 29; 34; 36; 37; 38; 41; 43; 47; 48; 51; 52; 54; 55; 56; 57; 58; 61; ], [(mk_real_int64 424L); (mk_real_int64 476L); (mk_real_int64 184L); (mk_real_int64 250L); (mk_real_int64 292L); (mk_real_int64 604L); (mk_real_int64 292L); (mk_real_int64 375L); (mk_real_int64 176L); (mk_real_int64 192L); (mk_real_int64 472L); (mk_real_int64 264L); (mk_real_int64 413L); (mk_real_int64 176L); (mk_real_int64 516L); (mk_real_int64 48L); (mk_real_int64 120L); (mk_real_int64 400L); (mk_real_int64 416L); (mk_real_int64 656L); (mk_real_int64 250L); ]); +("y6_lo", [0; 11; 12; 13; 15; 16; 17; 18; 23; 24; 25; 26; 31; 32; 35; 39; 40; 41; 42; 44; 46; 47; 50; 51; 53; 54; 56; 59; 60; ], [(mk_real_int64 292L); (mk_real_int64 79000L); (mk_real_int64 451L); (mk_real_int64 148000L); (mk_real_int64 220L); (mk_real_int64 76116L); (mk_real_int64 245000L); (mk_real_int64 250L); (mk_real_int64 142136L); (mk_real_int64 56000L); (mk_real_int64 250L); (mk_real_int64 230000L); (mk_real_int64 268L); (mk_real_int64 375L); (mk_real_int64 22000L); (mk_real_int64 464L); (mk_real_int64 129L); (mk_real_int64 163808L); (mk_real_int64 250L); (mk_real_int64 220560L); (mk_real_int64 250L); (mk_real_int64 8000L); (mk_real_int64 61083L); (mk_real_int64 165000L); (mk_real_int64 32L); (mk_real_int64 107000L); (mk_real_int64 313000L); (mk_real_int64 352L); (mk_real_int64 121016L); ]); +("y6_hi", [11; 13; 19; 26; 28; 29; 34; 36; 37; 38; 43; 47; 48; 51; 52; 54; 55; 56; 57; 58; 61; ], [(mk_real_int64 464L); (mk_real_int64 424L); (mk_real_int64 476L); (mk_real_int64 184L); (mk_real_int64 250L); (mk_real_int64 292L); (mk_real_int64 604L); (mk_real_int64 292L); (mk_real_int64 375L); (mk_real_int64 176L); (mk_real_int64 472L); (mk_real_int64 264L); (mk_real_int64 413L); (mk_real_int64 176L); (mk_real_int64 516L); (mk_real_int64 48L); (mk_real_int64 120L); (mk_real_int64 400L); (mk_real_int64 416L); (mk_real_int64 656L); (mk_real_int64 250L); ]); +("ye_hi", [10; 30; 39; 41; 44; 46; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_lo", [7; 28; 43; 46; 47; 55; 57; ], [(mk_real_int64 79000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 84000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_lo", [2; 3; 4; 5; 6; 10; 11; 13; ], [(mk_real_int64 956L); (mk_real_int64 956L); (mk_real_int64 837L); (mk_real_int64 956L); (mk_real_int64 1837L); (mk_real_int64 1956L); (mk_real_int64 956L); (mk_real_int64 2044L); ]); +("yn_hi", [0; 1; 7; 8; 9; 12; ], [(mk_real_int64 528L); (mk_real_int64 448L); (mk_real_int64 44L); (mk_real_int64 732L); (mk_real_int64 1044L); (mk_real_int64 44L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests/95170601659_out.hl b/formal_lp/old/ineqs/tests/95170601659_out.hl new file mode 100644 index 0000000..42b87dd --- /dev/null +++ b/formal_lp/old/ineqs/tests/95170601659_out.hl @@ -0,0 +1,90 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "95170601659 18 6 0 1 2 3 4 5 3 0 5 6 3 6 5 4 3 6 4 7 3 7 4 3 3 7 3 8 3 8 3 9 3 9 3 2 3 9 2 10 3 10 2 1 3 10 1 0 4 10 0 11 12 3 11 0 6 3 11 6 7 3 11 7 8 3 12 11 8 3 12 8 9 3 9 10 12 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum_neg", [0; 4; 6; 7; 9; 10; 12; ], [(mk_real_int64 476L); (mk_real_int64 362L); (mk_real_int64 181L); (mk_real_int64 52L); (mk_real_int64 234L); (mk_real_int64 18L); (mk_real_int64 408L); ]); +("azim_sum", [2; 8; ], [(mk_real_int64 83L); (mk_real_int64 13L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 885L); (mk_real_int64 885L); (mk_real_int64 1014L); (mk_real_int64 885L); (mk_real_int64 885L); (mk_real_int64 919L); (mk_real_int64 885L); (mk_real_int64 955L); (mk_real_int64 919L); (mk_real_int64 919L); (mk_real_int64 923L); (mk_real_int64 919L); (mk_real_int64 919L); ]); +("sol_sum3", [0; 1; 13; 14; 15; ], [(mk_real_int64 181L); (mk_real_int64 251L); (mk_real_int64 238L); (mk_real_int64 267L); (mk_real_int64 51L); ]); +("sol_sum3_neg", [2; 3; 6; 7; 10; 11; 12; ], [(mk_real_int64 256L); (mk_real_int64 70L); (mk_real_int64 48L); (mk_real_int64 576L); (mk_real_int64 337L); (mk_real_int64 19L); (mk_real_int64 278L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; ], [(mk_real_int64 885L); (mk_real_int64 885L); (mk_real_int64 448L); (mk_real_int64 815L); (mk_real_int64 742L); (mk_real_int64 906L); (mk_real_int64 837L); (mk_real_int64 309L); (mk_real_int64 885L); (mk_real_int64 885L); (mk_real_int64 370L); (mk_real_int64 885L); (mk_real_int64 499L); (mk_real_int64 919L); (mk_real_int64 919L); (mk_real_int64 919L); ]); +("tau_sum4_neg", [0; ], [(mk_real_int64 919L); ]); +("tau_sum6_neg", [0; ], [(mk_real_int64 885L); ]); +("ln_def_neg", [2; 5; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 118L); (mk_real_int64 13L); (mk_real_int64 53L); (mk_real_int64 13L); (mk_real_int64 13L); (mk_real_int64 18L); (mk_real_int64 13L); (mk_real_int64 13L); ]); +("ln_def", [0; 1; 3; 4; 6; ], [(mk_real_int64 25L); (mk_real_int64 25L); (mk_real_int64 25L); (mk_real_int64 25L); (mk_real_int64 25L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 5558L); (mk_real_int64 5558L); (mk_real_int64 6374L); (mk_real_int64 5558L); (mk_real_int64 5558L); (mk_real_int64 5773L); (mk_real_int64 5558L); (mk_real_int64 6003L); (mk_real_int64 5773L); (mk_real_int64 5773L); (mk_real_int64 5802L); (mk_real_int64 5773L); (mk_real_int64 5773L); ]); +("edge_sym", [0; 2; 3; 5; 8; 11; 13; 14; 20; 22; 39; 42; 54; ], [(mk_real_int64 14L); (mk_real_int64 86L); (mk_real_int64 86L); (mk_real_int64 14L); (mk_real_int64 225L); (mk_real_int64 209L); (mk_real_int64 12L); (mk_real_int64 12L); (mk_real_int64 13L); (mk_real_int64 64L); (mk_real_int64 7L); (mk_real_int64 12L); (mk_real_int64 7L); ]); +("edge_sym_neg", [17; 19; 23; 26; 28; 29; 32; 37; 45; 48; 51; ], [(mk_real_int64 66L); (mk_real_int64 60L); (mk_real_int64 138L); (mk_real_int64 64L); (mk_real_int64 159L); (mk_real_int64 137L); (mk_real_int64 122L); (mk_real_int64 14L); (mk_real_int64 12L); (mk_real_int64 145L); (mk_real_int64 13L); ]); +("y1_def_neg", [0; 3; 6; 8; 14; 17; 18; 19; 22; 23; 24; 27; 31; 35; 40; 41; 45; 50; 51; 53; 54; 56; ], [(mk_real_int64 11L); (mk_real_int64 67L); (mk_real_int64 128L); (mk_real_int64 27L); (mk_real_int64 147L); (mk_real_int64 85L); (mk_real_int64 42L); (mk_real_int64 5L); (mk_real_int64 44L); (mk_real_int64 11L); (mk_real_int64 76L); (mk_real_int64 13L); (mk_real_int64 109L); (mk_real_int64 16L); (mk_real_int64 8L); (mk_real_int64 5L); (mk_real_int64 12L); (mk_real_int64 92L); (mk_real_int64 36L); (mk_real_int64 40L); (mk_real_int64 83L); (mk_real_int64 8L); ]); +("y1_def", [7; 10; 13; 15; 20; 21; 29; 32; 34; 42; 43; 47; 48; 49; 52; 57; ], [(mk_real_int64 148L); (mk_real_int64 8L); (mk_real_int64 97L); (mk_real_int64 22L); (mk_real_int64 29L); (mk_real_int64 2L); (mk_real_int64 173L); (mk_real_int64 152L); (mk_real_int64 7L); (mk_real_int64 1L); (mk_real_int64 7L); (mk_real_int64 76L); (mk_real_int64 14L); (mk_real_int64 85L); (mk_real_int64 71L); (mk_real_int64 78L); ]); +("y2_def", [0; 3; 13; 14; 15; 18; 22; 27; 29; 40; 43; 47; ], [(mk_real_int64 14L); (mk_real_int64 86L); (mk_real_int64 97L); (mk_real_int64 56L); (mk_real_int64 33L); (mk_real_int64 25L); (mk_real_int64 69L); (mk_real_int64 8L); (mk_real_int64 173L); (mk_real_int64 210L); (mk_real_int64 7L); (mk_real_int64 151L); ]); +("y2_def_neg", [6; 7; 8; 10; 17; 19; 20; 21; 23; 24; 31; 32; 34; 35; 41; 45; 48; 49; 50; 51; 52; 53; 54; 56; 57; ], [(mk_real_int64 95L); (mk_real_int64 45L); (mk_real_int64 27L); (mk_real_int64 139L); (mk_real_int64 85L); (mk_real_int64 5L); (mk_real_int64 9L); (mk_real_int64 1L); (mk_real_int64 11L); (mk_real_int64 64L); (mk_real_int64 109L); (mk_real_int64 46L); (mk_real_int64 2L); (mk_real_int64 16L); (mk_real_int64 5L); (mk_real_int64 12L); (mk_real_int64 4L); (mk_real_int64 26L); (mk_real_int64 92L); (mk_real_int64 36L); (mk_real_int64 21L); (mk_real_int64 40L); (mk_real_int64 83L); (mk_real_int64 8L); (mk_real_int64 24L); ]); +("y3_def", [0; 3; 13; 14; 15; 18; 22; 27; 29; 40; 43; 47; ], [(mk_real_int64 14L); (mk_real_int64 86L); (mk_real_int64 97L); (mk_real_int64 56L); (mk_real_int64 33L); (mk_real_int64 25L); (mk_real_int64 69L); (mk_real_int64 8L); (mk_real_int64 173L); (mk_real_int64 210L); (mk_real_int64 7L); (mk_real_int64 151L); ]); +("y3_def_neg", [6; 7; 8; 10; 17; 19; 20; 21; 23; 24; 31; 32; 34; 35; 41; 45; 48; 49; 50; 51; 52; 53; 54; 56; 57; ], [(mk_real_int64 95L); (mk_real_int64 45L); (mk_real_int64 27L); (mk_real_int64 139L); (mk_real_int64 85L); (mk_real_int64 5L); (mk_real_int64 9L); (mk_real_int64 1L); (mk_real_int64 11L); (mk_real_int64 64L); (mk_real_int64 109L); (mk_real_int64 46L); (mk_real_int64 2L); (mk_real_int64 16L); (mk_real_int64 5L); (mk_real_int64 12L); (mk_real_int64 4L); (mk_real_int64 26L); (mk_real_int64 92L); (mk_real_int64 36L); (mk_real_int64 21L); (mk_real_int64 40L); (mk_real_int64 83L); (mk_real_int64 8L); (mk_real_int64 24L); ]); +("y4_def", [1; 2; 4; 14; 15; 26; 28; 32; 38; 39; 41; 42; 43; 46; 47; ], [(mk_real_int64 228L); (mk_real_int64 58L); (mk_real_int64 209L); (mk_real_int64 44L); (mk_real_int64 3L); (mk_real_int64 235L); (mk_real_int64 11L); (mk_real_int64 2L); (mk_real_int64 21L); (mk_real_int64 131L); (mk_real_int64 77L); (mk_real_int64 109L); (mk_real_int64 86L); (mk_real_int64 16L); (mk_real_int64 121L); ]); +("y4_def_neg", [0; 7; 8; 9; 11; 12; 13; 16; 17; 18; 21; 23; 25; 29; 30; 31; 33; 35; 37; 40; 44; ], [(mk_real_int64 98L); (mk_real_int64 50L); (mk_real_int64 159L); (mk_real_int64 26L); (mk_real_int64 59L); (mk_real_int64 48L); (mk_real_int64 4L); (mk_real_int64 129L); (mk_real_int64 8L); (mk_real_int64 86L); (mk_real_int64 14L); (mk_real_int64 145L); (mk_real_int64 76L); (mk_real_int64 11L); (mk_real_int64 221L); (mk_real_int64 4L); (mk_real_int64 4L); (mk_real_int64 9L); (mk_real_int64 141L); (mk_real_int64 64L); (mk_real_int64 58L); ]); +("y5_def", [0; 3; 8; 14; 18; 22; 27; 36; 40; 51; 53; 56; ], [(mk_real_int64 14L); (mk_real_int64 86L); (mk_real_int64 58L); (mk_real_int64 62L); (mk_real_int64 25L); (mk_real_int64 69L); (mk_real_int64 8L); (mk_real_int64 7L); (mk_real_int64 16L); (mk_real_int64 77L); (mk_real_int64 86L); (mk_real_int64 16L); ]); +("y5_def_neg", [6; 7; 13; 15; 17; 19; 20; 21; 23; 24; 29; 31; 32; 34; 35; 41; 43; 45; 47; 48; 49; 50; 52; 54; 57; ], [(mk_real_int64 62L); (mk_real_int64 45L); (mk_real_int64 50L); (mk_real_int64 7L); (mk_real_int64 59L); (mk_real_int64 4L); (mk_real_int64 9L); (mk_real_int64 1L); (mk_real_int64 8L); (mk_real_int64 64L); (mk_real_int64 145L); (mk_real_int64 76L); (mk_real_int64 46L); (mk_real_int64 2L); (mk_real_int64 11L); (mk_real_int64 4L); (mk_real_int64 4L); (mk_real_int64 9L); (mk_real_int64 9L); (mk_real_int64 4L); (mk_real_int64 26L); (mk_real_int64 64L); (mk_real_int64 21L); (mk_real_int64 58L); (mk_real_int64 24L); ]); +("y6_def", [0; 3; 8; 14; 15; 18; 22; 27; 31; 33; 40; 51; 53; 56; ], [(mk_real_int64 14L); (mk_real_int64 86L); (mk_real_int64 58L); (mk_real_int64 62L); (mk_real_int64 47L); (mk_real_int64 25L); (mk_real_int64 69L); (mk_real_int64 208L); (mk_real_int64 46L); (mk_real_int64 136L); (mk_real_int64 16L); (mk_real_int64 77L); (mk_real_int64 86L); (mk_real_int64 16L); ]); +("y6_def_neg", [6; 7; 13; 17; 19; 20; 21; 23; 24; 29; 32; 34; 35; 41; 43; 45; 47; 48; 49; 50; 52; 54; 57; ], [(mk_real_int64 27L); (mk_real_int64 45L); (mk_real_int64 50L); (mk_real_int64 59L); (mk_real_int64 4L); (mk_real_int64 9L); (mk_real_int64 1L); (mk_real_int64 8L); (mk_real_int64 64L); (mk_real_int64 145L); (mk_real_int64 46L); (mk_real_int64 2L); (mk_real_int64 11L); (mk_real_int64 4L); (mk_real_int64 4L); (mk_real_int64 9L); (mk_real_int64 9L); (mk_real_int64 4L); (mk_real_int64 13L); (mk_real_int64 64L); (mk_real_int64 16L); (mk_real_int64 58L); (mk_real_int64 24L); ]); +("RHA", [0; 3; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; 22; 23; 24; 25; 26; 27; 28; 29; 30; 33; 35; 40; 41; 42; 43; 45; 46; 47; 48; 54; 55; ], [(mk_real_int64 34L); (mk_real_int64 130L); (mk_real_int64 436L); (mk_real_int64 436L); (mk_real_int64 296L); (mk_real_int64 140L); (mk_real_int64 70L); (mk_real_int64 199L); (mk_real_int64 143L); (mk_real_int64 272L); (mk_real_int64 176L); (mk_real_int64 13L); (mk_real_int64 109L); (mk_real_int64 18L); (mk_real_int64 87L); (mk_real_int64 178L); (mk_real_int64 48L); (mk_real_int64 593L); (mk_real_int64 576L); (mk_real_int64 610L); (mk_real_int64 34L); (mk_real_int64 34L); (mk_real_int64 34L); (mk_real_int64 323L); (mk_real_int64 549L); (mk_real_int64 515L); (mk_real_int64 34L); (mk_real_int64 71L); (mk_real_int64 419L); (mk_real_int64 456L); (mk_real_int64 419L); (mk_real_int64 5L); (mk_real_int64 5L); ]); +("yy10", [37; ], [(mk_real_int64 14L); ]); +("tau6", [0; ], [(mk_real_int64 885L); ]); +("ineq105", [0; 3; ], [(mk_real_int64 34L); (mk_real_int64 213L); ]); +("ineq106", [0; 8; 12; 21; 30; ], [(mk_real_int64 34L); (mk_real_int64 211L); (mk_real_int64 70L); (mk_real_int64 21L); (mk_real_int64 226L); ]); +("ineq107", [1; 4; 14; 15; 26; 28; 32; 38; 39; 42; 47; ], [(mk_real_int64 296L); (mk_real_int64 226L); (mk_real_int64 57L); (mk_real_int64 4L); (mk_real_int64 304L); (mk_real_int64 15L); (mk_real_int64 2L); (mk_real_int64 27L); (mk_real_int64 170L); (mk_real_int64 141L); (mk_real_int64 156L); ]); +("ineq108", [9; 16; 18; 37; ], [(mk_real_int64 19L); (mk_real_int64 189L); (mk_real_int64 21L); (mk_real_int64 125L); ]); +("ineq109", [2; 4; 41; 43; 46; ], [(mk_real_int64 181L); (mk_real_int64 251L); (mk_real_int64 238L); (mk_real_int64 267L); (mk_real_int64 51L); ]); +("ineq110", [7; 9; 18; 23; 30; 33; 37; ], [(mk_real_int64 256L); (mk_real_int64 70L); (mk_real_int64 48L); (mk_real_int64 576L); (mk_real_int64 337L); (mk_real_int64 19L); (mk_real_int64 278L); ]); +("ineq111", [0; 4; 8; 11; 13; 17; 18; 23; 25; 29; 31; 35; 40; 44; ], [(mk_real_int64 596L); (mk_real_int64 373L); (mk_real_int64 115L); (mk_real_int64 474L); (mk_real_int64 29L); (mk_real_int64 63L); (mk_real_int64 496L); (mk_real_int64 255L); (mk_real_int64 606L); (mk_real_int64 92L); (mk_real_int64 30L); (mk_real_int64 69L); (mk_real_int64 510L); (mk_real_int64 460L); ]); +("ineq112", [28; ], [(mk_real_int64 684L); ]); +("ineq113", [8; 15; 26; 34; 38; 47; ], [(mk_real_int64 44L); (mk_real_int64 837L); (mk_real_int64 224L); (mk_real_int64 770L); (mk_real_int64 253L); (mk_real_int64 777L); ]); +("ineq114", [0; 3; 5; 7; 11; 12; 13; 16; 19; 23; 24; 27; 29; 31; 33; 36; 40; 41; 43; 44; 45; 46; ], [(mk_real_int64 289L); (mk_real_int64 111L); (mk_real_int64 400L); (mk_real_int64 289L); (mk_real_int64 341L); (mk_real_int64 145L); (mk_real_int64 568L); (mk_real_int64 5L); (mk_real_int64 341L); (mk_real_int64 54L); (mk_real_int64 54L); (mk_real_int64 54L); (mk_real_int64 54L); (mk_real_int64 340L); (mk_real_int64 46L); (mk_real_int64 247L); (mk_real_int64 402L); (mk_real_int64 7L); (mk_real_int64 53L); (mk_real_int64 405L); (mk_real_int64 60L); (mk_real_int64 81L); ]); +("ineq119", [3; ], [(mk_real_int64 901L); ]); +("ineq120", [2; ], [(mk_real_int64 18L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 2350L); (mk_real_int64 2350L); (mk_real_int64 2550L); (mk_real_int64 2350L); (mk_real_int64 2350L); (mk_real_int64 2725L); (mk_real_int64 2350L); (mk_real_int64 2475L); (mk_real_int64 2725L); (mk_real_int64 2725L); (mk_real_int64 2650L); (mk_real_int64 2725L); (mk_real_int64 2725L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_lo", [6; 7; 9; 10; 11; 18; 29; 30; 32; 33; 35; 39; 47; 54; 55; 56; 57; ], [(mk_real_int64 86L); (mk_real_int64 1000L); (mk_real_int64 514L); (mk_real_int64 1000L); (mk_real_int64 600L); (mk_real_int64 230L); (mk_real_int64 196L); (mk_real_int64 196L); (mk_real_int64 16L); (mk_real_int64 196L); (mk_real_int64 196L); (mk_real_int64 153L); (mk_real_int64 1000L); (mk_real_int64 470L); (mk_real_int64 440L); (mk_real_int64 294L); (mk_real_int64 243L); ]); +("azim_hi", [1; 5; 12; 13; 14; 15; 17; 19; 20; 21; 22; 25; 27; 34; 38; 40; 41; 42; 43; 44; 46; 48; 50; 51; 53; ], [(mk_real_int64 362000L); (mk_real_int64 476000L); (mk_real_int64 1000L); (mk_real_int64 914L); (mk_real_int64 604L); (mk_real_int64 1000L); (mk_real_int64 1466L); (mk_real_int64 568L); (mk_real_int64 1000L); (mk_real_int64 217L); (mk_real_int64 130L); (mk_real_int64 466L); (mk_real_int64 1000L); (mk_real_int64 212L); (mk_real_int64 644L); (mk_real_int64 1000L); (mk_real_int64 840L); (mk_real_int64 1000L); (mk_real_int64 796L); (mk_real_int64 570L); (mk_real_int64 622L); (mk_real_int64 473L); (mk_real_int64 652L); (mk_real_int64 382L); (mk_real_int64 178L); ]); +("rhazim_lo", [12; 13; 20; 46; 48; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_hi", [3; 22; 23; 24; 25; 45; 54; 55; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_hi", [0; 1; 3; 4; 5; 6; 8; 9; 11; 12; ], [(mk_real_int64 3340L); (mk_real_int64 3340L); (mk_real_int64 3340L); (mk_real_int64 3340L); (mk_real_int64 1996L); (mk_real_int64 3340L); (mk_real_int64 1996L); (mk_real_int64 1996L); (mk_real_int64 1996L); (mk_real_int64 1996L); ]); +("rho_lo", [2; 7; 10; ], [(mk_real_int64 2024L); (mk_real_int64 1780L); (mk_real_int64 1868L); ]); +("tau_lo", [2; 6; 9; 10; 16; 17; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("tau_hi", [14; ], [(mk_real_int64 1000L); ]); +("y1_hi", [0; 6; 13; 15; 24; 27; 34; 40; 43; 47; 50; 51; 54; 56; ], [(mk_real_int64 290L); (mk_real_int64 320L); (mk_real_int64 280L); (mk_real_int64 135L); (mk_real_int64 25L); (mk_real_int64 400L); (mk_real_int64 500L); (mk_real_int64 460L); (mk_real_int64 220L); (mk_real_int64 265L); (mk_real_int64 200L); (mk_real_int64 62L); (mk_real_int64 200L); (mk_real_int64 299L); ]); +("y1_lo", [3; 8; 10; 14; 17; 19; 20; 22; 23; 29; 31; 35; 41; 45; 48; 52; 53; ], [(mk_real_int64 95L); (mk_real_int64 331L); (mk_real_int64 41L); (mk_real_int64 300L); (mk_real_int64 320L); (mk_real_int64 220L); (mk_real_int64 500L); (mk_real_int64 415L); (mk_real_int64 340L); (mk_real_int64 20L); (mk_real_int64 80L); (mk_real_int64 560L); (mk_real_int64 400L); (mk_real_int64 420L); (mk_real_int64 500L); (mk_real_int64 500L); (mk_real_int64 317L); ]); +("y2_lo", [0; 3; 8; 10; 17; 19; 22; 23; 27; 29; 31; 32; 34; 35; 41; 42; 45; 48; 52; 53; ], [(mk_real_int64 332L); (mk_real_int64 374L); (mk_real_int64 331L); (mk_real_int64 393L); (mk_real_int64 320L); (mk_real_int64 220L); (mk_real_int64 204L); (mk_real_int64 340L); (mk_real_int64 356L); (mk_real_int64 20L); (mk_real_int64 80L); (mk_real_int64 208L); (mk_real_int64 280L); (mk_real_int64 560L); (mk_real_int64 400L); (mk_real_int64 304L); (mk_real_int64 420L); (mk_real_int64 104L); (mk_real_int64 432L); (mk_real_int64 317L); ]); +("y2_hi", [6; 7; 13; 14; 15; 18; 20; 21; 24; 40; 43; 47; 49; 50; 51; 54; 56; 57; ], [(mk_real_int64 96L); (mk_real_int64 8L); (mk_real_int64 280L); (mk_real_int64 104L); (mk_real_int64 516L); (mk_real_int64 480L); (mk_real_int64 336L); (mk_real_int64 392L); (mk_real_int64 604L); (mk_real_int64 324L); (mk_real_int64 220L); (mk_real_int64 140L); (mk_real_int64 160L); (mk_real_int64 200L); (mk_real_int64 62L); (mk_real_int64 200L); (mk_real_int64 299L); (mk_real_int64 288L); ]); +("y3_lo", [0; 3; 8; 10; 17; 19; 22; 23; 27; 29; 31; 32; 34; 35; 41; 42; 45; 48; 52; 53; ], [(mk_real_int64 332L); (mk_real_int64 374L); (mk_real_int64 331L); (mk_real_int64 393L); (mk_real_int64 320L); (mk_real_int64 220L); (mk_real_int64 204L); (mk_real_int64 340L); (mk_real_int64 356L); (mk_real_int64 20L); (mk_real_int64 80L); (mk_real_int64 208L); (mk_real_int64 280L); (mk_real_int64 560L); (mk_real_int64 400L); (mk_real_int64 304L); (mk_real_int64 420L); (mk_real_int64 104L); (mk_real_int64 432L); (mk_real_int64 317L); ]); +("y3_hi", [6; 7; 13; 14; 15; 18; 20; 21; 24; 40; 43; 47; 49; 50; 51; 54; 56; 57; ], [(mk_real_int64 96L); (mk_real_int64 8L); (mk_real_int64 280L); (mk_real_int64 104L); (mk_real_int64 516L); (mk_real_int64 480L); (mk_real_int64 336L); (mk_real_int64 392L); (mk_real_int64 604L); (mk_real_int64 324L); (mk_real_int64 220L); (mk_real_int64 140L); (mk_real_int64 160L); (mk_real_int64 200L); (mk_real_int64 62L); (mk_real_int64 200L); (mk_real_int64 299L); (mk_real_int64 288L); ]); +("y4_lo", [7; 9; 11; 16; 21; 26; 29; 32; 38; 42; 47; ], [(mk_real_int64 176L); (mk_real_int64 735L); (mk_real_int64 250L); (mk_real_int64 465L); (mk_real_int64 385L); (mk_real_int64 8L); (mk_real_int64 500L); (mk_real_int64 454L); (mk_real_int64 129L); (mk_real_int64 7L); (mk_real_int64 412L); ]); +("y4_hi", [0; 1; 2; 4; 8; 12; 13; 14; 15; 17; 18; 23; 25; 28; 30; 31; 33; 35; 37; 39; 40; 41; 43; 44; 46; ], [(mk_real_int64 210L); (mk_real_int64 808L); (mk_real_int64 644L); (mk_real_int64 397L); (mk_real_int64 90L); (mk_real_int64 50L); (mk_real_int64 375L); (mk_real_int64 61L); (mk_real_int64 92L); (mk_real_int64 125L); (mk_real_int64 207L); (mk_real_int64 229L); (mk_real_int64 250L); (mk_real_int64 595L); (mk_real_int64 138L); (mk_real_int64 250L); (mk_real_int64 276L); (mk_real_int64 375L); (mk_real_int64 887L); (mk_real_int64 410L); (mk_real_int64 250L); (mk_real_int64 112L); (mk_real_int64 508L); (mk_real_int64 500L); (mk_real_int64 524L); ]); +("y5_lo", [0; 3; 6; 13; 17; 22; 27; 32; 34; 35; 36; 42; 48; 52; ], [(mk_real_int64 332L); (mk_real_int64 374L); (mk_real_int64 124L); (mk_real_int64 176L); (mk_real_int64 250L); (mk_real_int64 204L); (mk_real_int64 356L); (mk_real_int64 208L); (mk_real_int64 280L); (mk_real_int64 500L); (mk_real_int64 7000L); (mk_real_int64 304L); (mk_real_int64 104L); (mk_real_int64 432L); ]); +("y5_hi", [7; 8; 10; 14; 15; 18; 19; 20; 21; 23; 24; 29; 31; 40; 41; 43; 45; 47; 49; 50; 51; 53; 54; 56; 57; ], [(mk_real_int64 8L); (mk_real_int64 644L); (mk_real_int64 347L); (mk_real_int64 429L); (mk_real_int64 196L); (mk_real_int64 480L); (mk_real_int64 375L); (mk_real_int64 336L); (mk_real_int64 392L); (mk_real_int64 125L); (mk_real_int64 236L); (mk_real_int64 229L); (mk_real_int64 250L); (mk_real_int64 212L); (mk_real_int64 250L); (mk_real_int64 276L); (mk_real_int64 375L); (mk_real_int64 12L); (mk_real_int64 160L); (mk_real_int64 250L); (mk_real_int64 112L); (mk_real_int64 508L); (mk_real_int64 500L); (mk_real_int64 524L); (mk_real_int64 288L); ]); +("y6_lo", [0; 3; 6; 13; 15; 17; 22; 27; 31; 32; 33; 34; 35; 42; 48; 49; 52; ], [(mk_real_int64 332L); (mk_real_int64 374L); (mk_real_int64 35124L); (mk_real_int64 176L); (mk_real_int64 54000L); (mk_real_int64 250L); (mk_real_int64 204L); (mk_real_int64 201000L); (mk_real_int64 122000L); (mk_real_int64 208L); (mk_real_int64 136000L); (mk_real_int64 280L); (mk_real_int64 500L); (mk_real_int64 304L); (mk_real_int64 104L); (mk_real_int64 13000L); (mk_real_int64 5432L); ]); +("y6_hi", [7; 8; 10; 14; 15; 18; 19; 20; 21; 23; 24; 27; 29; 31; 40; 41; 43; 45; 47; 49; 50; 51; 53; 54; 56; 57; ], [(mk_real_int64 8L); (mk_real_int64 644L); (mk_real_int64 347L); (mk_real_int64 429L); (mk_real_int64 196L); (mk_real_int64 480L); (mk_real_int64 375L); (mk_real_int64 336L); (mk_real_int64 392L); (mk_real_int64 125L); (mk_real_int64 236L); (mk_real_int64 644L); (mk_real_int64 229L); (mk_real_int64 250L); (mk_real_int64 212L); (mk_real_int64 250L); (mk_real_int64 276L); (mk_real_int64 375L); (mk_real_int64 12L); (mk_real_int64 160L); (mk_real_int64 250L); (mk_real_int64 112L); (mk_real_int64 508L); (mk_real_int64 500L); (mk_real_int64 524L); (mk_real_int64 288L); ]); +("ye_hi", [16; 33; 34; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_lo", [7; 8; 18; 19; 20; 27; 43; 44; 45; 50; 52; 53; 56; 57; ], [(mk_real_int64 85000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_hi", [5; 8; 9; 11; 12; ], [(mk_real_int64 1012L); (mk_real_int64 12L); (mk_real_int64 1012L); (mk_real_int64 1012L); (mk_real_int64 12L); ]); +("yn_lo", [0; 1; 2; 3; 4; 6; 7; 10; ], [(mk_real_int64 75L); (mk_real_int64 75L); (mk_real_int64 968L); (mk_real_int64 75L); (mk_real_int64 75L); (mk_real_int64 75L); (mk_real_int64 28L); (mk_real_int64 368L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests/97685954266_out.hl b/formal_lp/old/ineqs/tests/97685954266_out.hl new file mode 100644 index 0000000..9a2e00d --- /dev/null +++ b/formal_lp/old/ineqs/tests/97685954266_out.hl @@ -0,0 +1,86 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "97685954266 21 6 0 1 2 3 4 5 4 0 5 6 7 3 6 5 4 3 6 4 8 3 8 4 9 3 9 4 3 3 9 3 10 3 10 3 11 3 11 3 2 3 11 2 1 3 11 1 12 3 12 1 0 3 12 0 13 3 13 0 7 3 13 7 14 3 14 7 8 3 7 6 8 3 14 8 9 3 14 9 10 4 12 13 14 10 3 10 11 12 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum_neg", [3; 7; 8; 9; ], [(mk_real_int64 162L); (mk_real_int64 137L); (mk_real_int64 53L); (mk_real_int64 120L); ]); +("azim_sum", [10; 11; 14; ], [(mk_real_int64 53L); (mk_real_int64 279L); (mk_real_int64 56L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 961L); (mk_real_int64 1227L); (mk_real_int64 1227L); (mk_real_int64 750L); (mk_real_int64 1227L); (mk_real_int64 1227L); (mk_real_int64 1101L); (mk_real_int64 961L); (mk_real_int64 961L); (mk_real_int64 1196L); (mk_real_int64 1101L); (mk_real_int64 1196L); (mk_real_int64 1196L); (mk_real_int64 932L); (mk_real_int64 1196L); ]); +("sol_sum3", [1; 2; 14; 15; ], [(mk_real_int64 53L); (mk_real_int64 53L); (mk_real_int64 53L); (mk_real_int64 22L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; ], [(mk_real_int64 857L); (mk_real_int64 961L); (mk_real_int64 961L); (mk_real_int64 1196L); (mk_real_int64 1196L); (mk_real_int64 932L); (mk_real_int64 750L); (mk_real_int64 750L); (mk_real_int64 932L); (mk_real_int64 1196L); (mk_real_int64 1146L); (mk_real_int64 1101L); (mk_real_int64 1101L); (mk_real_int64 961L); (mk_real_int64 961L); (mk_real_int64 961L); (mk_real_int64 1196L); (mk_real_int64 932L); ]); +("tau_sum4_neg", [0; 1; ], [(mk_real_int64 961L); (mk_real_int64 1196L); ]); +("tau_sum6_neg", [0; ], [(mk_real_int64 1227L); ]); +("ln_def_neg", [0; 1; 2; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 60L); (mk_real_int64 353L); (mk_real_int64 353L); (mk_real_int64 353L); (mk_real_int64 353L); (mk_real_int64 214L); (mk_real_int64 60L); (mk_real_int64 60L); (mk_real_int64 318L); (mk_real_int64 214L); (mk_real_int64 318L); (mk_real_int64 318L); (mk_real_int64 28L); (mk_real_int64 318L); ]); +("ln_def", [3; ], [(mk_real_int64 173L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 6041L); (mk_real_int64 7712L); (mk_real_int64 7712L); (mk_real_int64 4711L); (mk_real_int64 7712L); (mk_real_int64 7712L); (mk_real_int64 6918L); (mk_real_int64 6041L); (mk_real_int64 6041L); (mk_real_int64 7513L); (mk_real_int64 6918L); (mk_real_int64 7513L); (mk_real_int64 7513L); (mk_real_int64 5856L); (mk_real_int64 7513L); ]); +("edge_sym", [12; 14; 17; 33; 35; 57; ], [(mk_real_int64 41L); (mk_real_int64 36L); (mk_real_int64 66L); (mk_real_int64 228L); (mk_real_int64 107L); (mk_real_int64 111L); ]); +("edge_sym_neg", [15; 18; 21; 23; 24; 26; 30; 39; 41; 45; 47; 50; 51; ], [(mk_real_int64 109L); (mk_real_int64 213L); (mk_real_int64 178L); (mk_real_int64 46L); (mk_real_int64 189L); (mk_real_int64 231L); (mk_real_int64 161L); (mk_real_int64 139L); (mk_real_int64 121L); (mk_real_int64 205L); (mk_real_int64 99L); (mk_real_int64 196L); (mk_real_int64 10L); ]); +("y1_def_neg", [11; 12; 14; 17; 18; 20; 21; 23; 25; 26; 28; 29; 31; 33; 35; 36; 37; 38; 39; 40; 41; 42; 43; 44; 46; 48; 49; 50; 52; 54; 55; 57; 58; 59; ], [(mk_real_int64 63L); (mk_real_int64 48L); (mk_real_int64 147L); (mk_real_int64 317L); (mk_real_int64 109L); (mk_real_int64 19L); (mk_real_int64 234L); (mk_real_int64 234L); (mk_real_int64 158L); (mk_real_int64 121L); (mk_real_int64 109L); (mk_real_int64 202L); (mk_real_int64 45L); (mk_real_int64 251L); (mk_real_int64 345L); (mk_real_int64 171L); (mk_real_int64 13L); (mk_real_int64 234L); (mk_real_int64 19L); (mk_real_int64 20L); (mk_real_int64 49L); (mk_real_int64 185L); (mk_real_int64 12L); (mk_real_int64 274L); (mk_real_int64 12L); (mk_real_int64 91L); (mk_real_int64 141L); (mk_real_int64 103L); (mk_real_int64 160L); (mk_real_int64 8L); (mk_real_int64 141L); (mk_real_int64 172L); (mk_real_int64 2L); (mk_real_int64 78L); ]); +("y1_def", [10; 13; 19; 22; 30; 32; 51; 53; 56; ], [(mk_real_int64 16L); (mk_real_int64 42L); (mk_real_int64 60L); (mk_real_int64 60L); (mk_real_int64 81L); (mk_real_int64 81L); (mk_real_int64 27L); (mk_real_int64 42L); (mk_real_int64 16L); ]); +("y2_def", [11; 18; 20; 25; 28; 29; 31; 33; 36; 37; 39; 40; 41; 43; 46; 49; 55; 58; ], [(mk_real_int64 38L); (mk_real_int64 53L); (mk_real_int64 11L); (mk_real_int64 96L); (mk_real_int64 66L); (mk_real_int64 20L); (mk_real_int64 27L); (mk_real_int64 58L); (mk_real_int64 116L); (mk_real_int64 20L); (mk_real_int64 11L); (mk_real_int64 12L); (mk_real_int64 30L); (mk_real_int64 19L); (mk_real_int64 19L); (mk_real_int64 85L); (mk_real_int64 85L); (mk_real_int64 3L); ]); +("y2_def_neg", [10; 12; 13; 14; 17; 19; 21; 22; 23; 26; 30; 32; 35; 38; 42; 44; 48; 50; 51; 52; 53; 54; 56; 57; 59; ], [(mk_real_int64 5L); (mk_real_int64 48L); (mk_real_int64 13L); (mk_real_int64 84L); (mk_real_int64 61L); (mk_real_int64 18L); (mk_real_int64 204L); (mk_real_int64 18L); (mk_real_int64 204L); (mk_real_int64 80L); (mk_real_int64 25L); (mk_real_int64 25L); (mk_real_int64 60L); (mk_real_int64 204L); (mk_real_int64 185L); (mk_real_int64 152L); (mk_real_int64 91L); (mk_real_int64 48L); (mk_real_int64 8L); (mk_real_int64 114L); (mk_real_int64 13L); (mk_real_int64 8L); (mk_real_int64 5L); (mk_real_int64 40L); (mk_real_int64 156L); ]); +("y3_def", [11; 18; 20; 25; 28; 29; 31; 33; 36; 37; 39; 40; 41; 43; 46; 49; 55; 58; ], [(mk_real_int64 38L); (mk_real_int64 53L); (mk_real_int64 11L); (mk_real_int64 96L); (mk_real_int64 66L); (mk_real_int64 20L); (mk_real_int64 27L); (mk_real_int64 58L); (mk_real_int64 116L); (mk_real_int64 20L); (mk_real_int64 11L); (mk_real_int64 12L); (mk_real_int64 30L); (mk_real_int64 19L); (mk_real_int64 19L); (mk_real_int64 85L); (mk_real_int64 85L); (mk_real_int64 3L); ]); +("y3_def_neg", [10; 12; 13; 14; 17; 19; 21; 22; 23; 26; 30; 32; 35; 38; 42; 44; 48; 50; 51; 52; 53; 54; 56; 57; 59; ], [(mk_real_int64 5L); (mk_real_int64 48L); (mk_real_int64 13L); (mk_real_int64 84L); (mk_real_int64 61L); (mk_real_int64 18L); (mk_real_int64 204L); (mk_real_int64 18L); (mk_real_int64 204L); (mk_real_int64 80L); (mk_real_int64 25L); (mk_real_int64 25L); (mk_real_int64 60L); (mk_real_int64 204L); (mk_real_int64 185L); (mk_real_int64 152L); (mk_real_int64 91L); (mk_real_int64 48L); (mk_real_int64 8L); (mk_real_int64 114L); (mk_real_int64 13L); (mk_real_int64 8L); (mk_real_int64 5L); (mk_real_int64 40L); (mk_real_int64 156L); ]); +("y4_def_neg", [1; 2; 4; 7; 8; 10; 11; 13; 15; 16; 18; 19; 21; 23; 25; 26; 27; 28; 29; 30; 31; 32; 33; 34; 36; 38; 39; 40; 42; 45; 47; 48; 49; ], [(mk_real_int64 72L); (mk_real_int64 33L); (mk_real_int64 97L); (mk_real_int64 292L); (mk_real_int64 98L); (mk_real_int64 22L); (mk_real_int64 171L); (mk_real_int64 171L); (mk_real_int64 181L); (mk_real_int64 96L); (mk_real_int64 125L); (mk_real_int64 202L); (mk_real_int64 51L); (mk_real_int64 260L); (mk_real_int64 319L); (mk_real_int64 219L); (mk_real_int64 38L); (mk_real_int64 171L); (mk_real_int64 22L); (mk_real_int64 22L); (mk_real_int64 56L); (mk_real_int64 129L); (mk_real_int64 36L); (mk_real_int64 224L); (mk_real_int64 36L); (mk_real_int64 63L); (mk_real_int64 161L); (mk_real_int64 87L); (mk_real_int64 124L); (mk_real_int64 161L); (mk_real_int64 147L); (mk_real_int64 6L); (mk_real_int64 3L); ]); +("y4_def", [0; 3; 9; 12; 20; 22; 41; 43; 44; 46; ], [(mk_real_int64 25L); (mk_real_int64 65L); (mk_real_int64 92L); (mk_real_int64 92L); (mk_real_int64 125L); (mk_real_int64 125L); (mk_real_int64 41L); (mk_real_int64 65L); (mk_real_int64 17L); (mk_real_int64 25L); ]); +("y5_def", [11; 18; 20; 25; 28; 29; 31; 33; 36; 37; 39; 40; 41; 43; 46; 49; 54; 55; 58; ], [(mk_real_int64 38L); (mk_real_int64 78L); (mk_real_int64 11L); (mk_real_int64 96L); (mk_real_int64 66L); (mk_real_int64 39L); (mk_real_int64 27L); (mk_real_int64 76L); (mk_real_int64 116L); (mk_real_int64 20L); (mk_real_int64 11L); (mk_real_int64 12L); (mk_real_int64 30L); (mk_real_int64 19L); (mk_real_int64 19L); (mk_real_int64 85L); (mk_real_int64 17L); (mk_real_int64 85L); (mk_real_int64 3L); ]); +("y5_def_neg", [10; 12; 13; 14; 17; 19; 21; 22; 23; 26; 30; 32; 35; 38; 42; 44; 48; 50; 51; 52; 53; 56; 57; 59; ], [(mk_real_int64 5L); (mk_real_int64 33L); (mk_real_int64 13L); (mk_real_int64 29L); (mk_real_int64 13L); (mk_real_int64 18L); (mk_real_int64 138L); (mk_real_int64 18L); (mk_real_int64 138L); (mk_real_int64 50L); (mk_real_int64 25L); (mk_real_int64 25L); (mk_real_int64 9L); (mk_real_int64 138L); (mk_real_int64 129L); (mk_real_int64 92L); (mk_real_int64 63L); (mk_real_int64 27L); (mk_real_int64 8L); (mk_real_int64 74L); (mk_real_int64 13L); (mk_real_int64 5L); (mk_real_int64 4L); (mk_real_int64 114L); ]); +("y6_def", [11; 16; 18; 19; 20; 22; 25; 28; 29; 31; 33; 36; 37; 38; 39; 40; 41; 42; 43; 44; 46; 49; 53; 54; 55; 56; 57; 58; 59; ], [(mk_real_int64 38L); (mk_real_int64 74L); (mk_real_int64 78L); (mk_real_int64 94L); (mk_real_int64 46L); (mk_real_int64 316L); (mk_real_int64 96L); (mk_real_int64 66L); (mk_real_int64 149L); (mk_real_int64 445L); (mk_real_int64 76L); (mk_real_int64 116L); (mk_real_int64 52L); (mk_real_int64 27L); (mk_real_int64 11L); (mk_real_int64 238L); (mk_real_int64 30L); (mk_real_int64 44L); (mk_real_int64 213L); (mk_real_int64 36L); (mk_real_int64 268L); (mk_real_int64 85L); (mk_real_int64 216L); (mk_real_int64 205L); (mk_real_int64 161L); (mk_real_int64 377L); (mk_real_int64 1L); (mk_real_int64 3L); (mk_real_int64 195L); ]); +("y6_def_neg", [10; 12; 13; 14; 17; 21; 23; 26; 30; 32; 35; 48; 50; 51; 52; ], [(mk_real_int64 5L); (mk_real_int64 33L); (mk_real_int64 13L); (mk_real_int64 29L); (mk_real_int64 13L); (mk_real_int64 138L); (mk_real_int64 138L); (mk_real_int64 50L); (mk_real_int64 25L); (mk_real_int64 25L); (mk_real_int64 9L); (mk_real_int64 19L); (mk_real_int64 27L); (mk_real_int64 8L); (mk_real_int64 4L); ]); +("RHA", [6; 9; 10; 12; 14; 18; 26; 29; 31; 33; 40; 48; 50; 52; 57; 65; 67; ], [(mk_real_int64 266L); (mk_real_int64 140L); (mk_real_int64 105L); (mk_real_int64 371L); (mk_real_int64 201L); (mk_real_int64 66L); (mk_real_int64 252L); (mk_real_int64 247L); (mk_real_int64 108L); (mk_real_int64 157L); (mk_real_int64 17L); (mk_real_int64 95L); (mk_real_int64 83L); (mk_real_int64 92L); (mk_real_int64 98L); (mk_real_int64 264L); (mk_real_int64 264L); ]); +("RHB", [5; 42; 62; ], [(mk_real_int64 266L); (mk_real_int64 45L); (mk_real_int64 95L); ]); +("yy10", [11; ], [(mk_real_int64 30L); ]); +("tau4", [0; 1; ], [(mk_real_int64 123L); (mk_real_int64 624L); ]); +("tau6", [0; ], [(mk_real_int64 1227L); ]); +("ineq106", [1; 4; 7; 8; 10; 11; 13; 15; 16; 18; 19; 21; 23; 25; 26; 28; 29; 30; 31; 34; 39; 40; 42; 45; 47; ], [(mk_real_int64 105L); (mk_real_int64 65L); (mk_real_int64 266L); (mk_real_int64 168L); (mk_real_int64 32L); (mk_real_int64 32L); (mk_real_int64 32L); (mk_real_int64 264L); (mk_real_int64 43L); (mk_real_int64 182L); (mk_real_int64 231L); (mk_real_int64 75L); (mk_real_int64 320L); (mk_real_int64 295L); (mk_real_int64 264L); (mk_real_int64 32L); (mk_real_int64 32L); (mk_real_int64 33L); (mk_real_int64 82L); (mk_real_int64 126L); (mk_real_int64 234L); (mk_real_int64 57L); (mk_real_int64 48L); (mk_real_int64 234L); (mk_real_int64 136L); ]); +("ineq107", [0; 3; 9; 12; 20; 22; 41; 43; 46; 49; ], [(mk_real_int64 33L); (mk_real_int64 84L); (mk_real_int64 120L); (mk_real_int64 120L); (mk_real_int64 162L); (mk_real_int64 162L); (mk_real_int64 53L); (mk_real_int64 84L); (mk_real_int64 32L); (mk_real_int64 120L); ]); +("ineq108", [26; 27; 33; 36; 48; ], [(mk_real_int64 56L); (mk_real_int64 56L); (mk_real_int64 53L); (mk_real_int64 53L); (mk_real_int64 8L); ]); +("ineq109", [4; 8; 44; 47; ], [(mk_real_int64 53L); (mk_real_int64 53L); (mk_real_int64 53L); (mk_real_int64 22L); ]); +("ineq111", [2; 4; 7; 11; 13; 16; 19; 23; 25; 28; 32; 34; 38; 40; 42; 47; 49; ], [(mk_real_int64 265L); (mk_real_int64 555L); (mk_real_int64 876L); (mk_real_int64 1196L); (mk_real_int64 1196L); (mk_real_int64 530L); (mk_real_int64 355L); (mk_real_int64 327L); (mk_real_int64 932L); (mk_real_int64 1196L); (mk_real_int64 1029L); (mk_real_int64 1101L); (mk_real_int64 504L); (mk_real_int64 384L); (mk_real_int64 730L); (mk_real_int64 482L); (mk_real_int64 764L); ]); +("ineq114", [2; 4; 7; 16; 19; 21; 23; 30; 38; 39; 40; 42; 45; 48; 51; 53; ], [(mk_real_int64 592L); (mk_real_int64 406L); (mk_real_int64 85L); (mk_real_int64 402L); (mk_real_int64 394L); (mk_real_int64 172L); (mk_real_int64 251L); (mk_real_int64 117L); (mk_real_int64 597L); (mk_real_int64 445L); (mk_real_int64 133L); (mk_real_int64 232L); (mk_real_int64 480L); (mk_real_int64 432L); (mk_real_int64 421L); (mk_real_int64 511L); ]); +("ineq119", [2; 5; ], [(mk_real_int64 303L); (mk_real_int64 130L); ]); +("ineq120", [0; 3; 4; 6; ], [(mk_real_int64 351L); (mk_real_int64 184L); (mk_real_int64 74L); (mk_real_int64 368L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 2825L); (mk_real_int64 3400L); (mk_real_int64 3400L); (mk_real_int64 2575L); (mk_real_int64 3400L); (mk_real_int64 3400L); (mk_real_int64 3350L); (mk_real_int64 2825L); (mk_real_int64 2825L); (mk_real_int64 3225L); (mk_real_int64 3350L); (mk_real_int64 3225L); (mk_real_int64 3225L); (mk_real_int64 3200L); (mk_real_int64 3225L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [2; 5; 6; 14; 17; 18; 33; 40; 50; 52; 61; ], [(mk_real_int64 162000L); (mk_real_int64 313000L); (mk_real_int64 58L); (mk_real_int64 156L); (mk_real_int64 210L); (mk_real_int64 1000L); (mk_real_int64 126L); (mk_real_int64 242L); (mk_real_int64 258L); (mk_real_int64 232L); (mk_real_int64 92L); ]); +("azim_lo", [5; 8; 9; 10; 12; 26; 29; 31; 42; 48; 49; 55; 56; 58; 62; 63; 65; 67; ], [(mk_real_int64 184L); (mk_real_int64 259L); (mk_real_int64 528L); (mk_real_int64 1000L); (mk_real_int64 408L); (mk_real_int64 348L); (mk_real_int64 356L); (mk_real_int64 328L); (mk_real_int64 80L); (mk_real_int64 278L); (mk_real_int64 430L); (mk_real_int64 520L); (mk_real_int64 1000L); (mk_real_int64 568L); (mk_real_int64 170L); (mk_real_int64 56L); (mk_real_int64 454L); (mk_real_int64 114L); ]); +("rhazim_hi", [2; 10; 11; 12; 20; 21; 23; 29; 31; 38; 39; 41; ], [(mk_real_int64 477000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_lo", [18; 49; 55; 57; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_lo", [0; 1; 2; 4; 5; 7; 8; ], [(mk_real_int64 2076L); (mk_real_int64 1532L); (mk_real_int64 1532L); (mk_real_int64 1532L); (mk_real_int64 1532L); (mk_real_int64 2076L); (mk_real_int64 2076L); ]); +("rho_hi", [3; 6; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 2000L); (mk_real_int64 684L); (mk_real_int64 2664L); (mk_real_int64 684L); (mk_real_int64 2664L); (mk_real_int64 2664L); (mk_real_int64 688L); (mk_real_int64 2664L); ]); +("tau_lo", [8; ], [(mk_real_int64 1000L); ]); +("tau_hi", [15; 16; 17; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("y1_lo", [17; 20; 21; 23; 25; 26; 28; 29; 36; 37; 38; 39; 41; 42; 43; 46; 50; 51; 52; 54; ], [(mk_real_int64 280L); (mk_real_int64 200L); (mk_real_int64 480L); (mk_real_int64 480L); (mk_real_int64 400L); (mk_real_int64 200L); (mk_real_int64 200L); (mk_real_int64 500L); (mk_real_int64 560L); (mk_real_int64 160L); (mk_real_int64 480L); (mk_real_int64 200L); (mk_real_int64 200L); (mk_real_int64 220L); (mk_real_int64 455L); (mk_real_int64 455L); (mk_real_int64 320L); (mk_real_int64 500L); (mk_real_int64 200L); (mk_real_int64 3L); ]); +("y1_hi", [10; 12; 14; 18; 33; 35; 40; 44; 48; 49; 55; 57; 58; 59; ], [(mk_real_int64 500L); (mk_real_int64 300L); (mk_real_int64 97L); (mk_real_int64 197L); (mk_real_int64 140L); (mk_real_int64 240L); (mk_real_int64 200L); (mk_real_int64 220L); (mk_real_int64 280L); (mk_real_int64 600L); (mk_real_int64 600L); (mk_real_int64 318L); (mk_real_int64 120L); (mk_real_int64 480L); ]); +("y2_hi", [11; 12; 13; 17; 18; 20; 21; 23; 25; 26; 28; 29; 30; 31; 32; 36; 37; 38; 39; 40; 43; 46; 48; 49; 52; 53; 55; 56; 59; ], [(mk_real_int64 220L); (mk_real_int64 300L); (mk_real_int64 232L); (mk_real_int64 144L); (mk_real_int64 149L); (mk_real_int64 648L); (mk_real_int64 368L); (mk_real_int64 368L); (mk_real_int64 96L); (mk_real_int64 252L); (mk_real_int64 248L); (mk_real_int64 184L); (mk_real_int64 376L); (mk_real_int64 300L); (mk_real_int64 376L); (mk_real_int64 480L); (mk_real_int64 384L); (mk_real_int64 368L); (mk_real_int64 648L); (mk_real_int64 12L); (mk_real_int64 292L); (mk_real_int64 292L); (mk_real_int64 280L); (mk_real_int64 176L); (mk_real_int64 72L); (mk_real_int64 232L); (mk_real_int64 176L); (mk_real_int64 136L); (mk_real_int64 240L); ]); +("y2_lo", [10; 14; 19; 22; 33; 35; 41; 42; 44; 50; 51; 54; 57; 58; ], [(mk_real_int64 16L); (mk_real_int64 243L); (mk_real_int64 240L); (mk_real_int64 240L); (mk_real_int64 380L); (mk_real_int64 380L); (mk_real_int64 152L); (mk_real_int64 220L); (mk_real_int64 316L); (mk_real_int64 372L); (mk_real_int64 56L); (mk_real_int64 3L); (mk_real_int64 578L); (mk_real_int64 88L); ]); +("y3_hi", [11; 12; 13; 17; 18; 20; 21; 23; 25; 26; 28; 29; 30; 31; 32; 36; 37; 38; 39; 40; 43; 46; 48; 49; 52; 53; 55; 56; 59; ], [(mk_real_int64 220L); (mk_real_int64 300L); (mk_real_int64 232L); (mk_real_int64 144L); (mk_real_int64 149L); (mk_real_int64 648L); (mk_real_int64 368L); (mk_real_int64 368L); (mk_real_int64 96L); (mk_real_int64 252L); (mk_real_int64 248L); (mk_real_int64 184L); (mk_real_int64 376L); (mk_real_int64 300L); (mk_real_int64 376L); (mk_real_int64 480L); (mk_real_int64 384L); (mk_real_int64 368L); (mk_real_int64 648L); (mk_real_int64 12L); (mk_real_int64 292L); (mk_real_int64 292L); (mk_real_int64 280L); (mk_real_int64 176L); (mk_real_int64 72L); (mk_real_int64 232L); (mk_real_int64 176L); (mk_real_int64 136L); (mk_real_int64 240L); ]); +("y3_lo", [10; 14; 19; 22; 33; 35; 41; 42; 44; 50; 51; 54; 57; 58; ], [(mk_real_int64 16L); (mk_real_int64 243L); (mk_real_int64 240L); (mk_real_int64 240L); (mk_real_int64 380L); (mk_real_int64 380L); (mk_real_int64 152L); (mk_real_int64 220L); (mk_real_int64 316L); (mk_real_int64 372L); (mk_real_int64 56L); (mk_real_int64 3L); (mk_real_int64 578L); (mk_real_int64 88L); ]); +("y4_hi", [0; 1; 4; 7; 8; 9; 10; 12; 15; 16; 18; 20; 22; 25; 29; 32; 34; 39; 44; 45; 47; 48; 49; ], [(mk_real_int64 509L); (mk_real_int64 75L); (mk_real_int64 272L); (mk_real_int64 290L); (mk_real_int64 92L); (mk_real_int64 760L); (mk_real_int64 80L); (mk_real_int64 760L); (mk_real_int64 160L); (mk_real_int64 295L); (mk_real_int64 330L); (mk_real_int64 226L); (mk_real_int64 226L); (mk_real_int64 425L); (mk_real_int64 80L); (mk_real_int64 375L); (mk_real_int64 65L); (mk_real_int64 710L); (mk_real_int64 172L); (mk_real_int64 710L); (mk_real_int64 718L); (mk_real_int64 520L); (mk_real_int64 260L); ]); +("y4_lo", [2; 3; 11; 13; 19; 21; 23; 26; 27; 28; 30; 31; 33; 36; 40; 41; 42; 43; 46; ], [(mk_real_int64 125L); (mk_real_int64 68L); (mk_real_int64 420L); (mk_real_int64 420L); (mk_real_int64 610L); (mk_real_int64 375L); (mk_real_int64 75L); (mk_real_int64 200L); (mk_real_int64 360L); (mk_real_int64 420L); (mk_real_int64 605L); (mk_real_int64 170L); (mk_real_int64 305L); (mk_real_int64 305L); (mk_real_int64 45L); (mk_real_int64 31L); (mk_real_int64 130L); (mk_real_int64 68L); (mk_real_int64 264L); ]); +("y5_hi", [11; 13; 14; 17; 18; 20; 21; 23; 25; 28; 29; 30; 31; 32; 36; 37; 38; 39; 40; 42; 43; 44; 46; 49; 52; 53; 54; 55; 56; 57; 59; ], [(mk_real_int64 220L); (mk_real_int64 232L); (mk_real_int64 457L); (mk_real_int64 324L); (mk_real_int64 324L); (mk_real_int64 648L); (mk_real_int64 148L); (mk_real_int64 148L); (mk_real_int64 96L); (mk_real_int64 248L); (mk_real_int64 709L); (mk_real_int64 376L); (mk_real_int64 300L); (mk_real_int64 376L); (mk_real_int64 480L); (mk_real_int64 384L); (mk_real_int64 148L); (mk_real_int64 648L); (mk_real_int64 12L); (mk_real_int64 375L); (mk_real_int64 292L); (mk_real_int64 239L); (mk_real_int64 292L); (mk_real_int64 176L); (mk_real_int64 222L); (mk_real_int64 232L); (mk_real_int64 172L); (mk_real_int64 176L); (mk_real_int64 136L); (mk_real_int64 382L); (mk_real_int64 260L); ]); +("y5_lo", [10; 12; 19; 22; 26; 33; 35; 41; 50; 51; 58; ], [(mk_real_int64 16L); (mk_real_int64 125L); (mk_real_int64 240L); (mk_real_int64 240L); (mk_real_int64 598L); (mk_real_int64 395L); (mk_real_int64 120L); (mk_real_int64 152L); (mk_real_int64 252L); (mk_real_int64 56L); (mk_real_int64 88L); ]); +("y6_hi", [11; 13; 14; 17; 18; 21; 23; 25; 28; 29; 30; 31; 32; 36; 37; 38; 39; 40; 42; 43; 44; 46; 49; 53; 54; 55; 56; 59; ], [(mk_real_int64 220L); (mk_real_int64 232L); (mk_real_int64 457L); (mk_real_int64 324L); (mk_real_int64 324L); (mk_real_int64 148L); (mk_real_int64 148L); (mk_real_int64 96L); (mk_real_int64 248L); (mk_real_int64 709L); (mk_real_int64 376L); (mk_real_int64 300L); (mk_real_int64 376L); (mk_real_int64 480L); (mk_real_int64 384L); (mk_real_int64 148L); (mk_real_int64 648L); (mk_real_int64 12L); (mk_real_int64 375L); (mk_real_int64 292L); (mk_real_int64 239L); (mk_real_int64 292L); (mk_real_int64 176L); (mk_real_int64 232L); (mk_real_int64 172L); (mk_real_int64 176L); (mk_real_int64 136L); (mk_real_int64 260L); ]); +("y6_lo", [10; 12; 16; 19; 20; 22; 26; 29; 31; 33; 35; 37; 38; 40; 41; 42; 43; 44; 46; 48; 50; 51; 52; 53; 54; 55; 56; 57; 58; 59; ], [(mk_real_int64 16L); (mk_real_int64 125L); (mk_real_int64 74000L); (mk_real_int64 112240L); (mk_real_int64 34352L); (mk_real_int64 334240L); (mk_real_int64 598L); (mk_real_int64 110000L); (mk_real_int64 418000L); (mk_real_int64 395L); (mk_real_int64 120L); (mk_real_int64 32000L); (mk_real_int64 165000L); (mk_real_int64 226000L); (mk_real_int64 152L); (mk_real_int64 173000L); (mk_real_int64 194000L); (mk_real_int64 128000L); (mk_real_int64 249000L); (mk_real_int64 44000L); (mk_real_int64 252L); (mk_real_int64 56L); (mk_real_int64 69778L); (mk_real_int64 229000L); (mk_real_int64 188000L); (mk_real_int64 76000L); (mk_real_int64 382000L); (mk_real_int64 4618L); (mk_real_int64 88L); (mk_real_int64 309000L); ]); +("ye_lo", [12; 13; 15; 16; 17; 18; 28; 29; 31; 36; 37; 39; 55; 56; ], [(mk_real_int64 151000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 203000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_lo", [0; 1; 4; 5; 6; 7; 9; 11; 12; 13; 14; ], [(mk_real_int64 560L); (mk_real_int64 828L); (mk_real_int64 1828L); (mk_real_int64 828L); (mk_real_int64 264L); (mk_real_int64 560L); (mk_real_int64 2168L); (mk_real_int64 1168L); (mk_real_int64 1168L); (mk_real_int64 128L); (mk_real_int64 168L); ]); +("yn_hi", [2; 3; 8; 10; ], [(mk_real_int64 172L); (mk_real_int64 321L); (mk_real_int64 440L); (mk_real_int64 1736L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests/all.hl b/formal_lp/old/ineqs/tests/all.hl new file mode 100644 index 0000000..8f0e15a --- /dev/null +++ b/formal_lp/old/ineqs/tests/all.hl @@ -0,0 +1,5 @@ +load_path := "/mnt/Repository/formal_lp/ineqs/tests" :: "/mnt/Repository/formal_lp/hypermap" :: !load_path;; + +needs "nobranching_lp.hl";; + +needs "all_tests.hl";; diff --git a/formal_lp/old/ineqs/tests/all_tests.hl b/formal_lp/old/ineqs/tests/all_tests.hl new file mode 100644 index 0000000..ea6f527 --- /dev/null +++ b/formal_lp/old/ineqs/tests/all_tests.hl @@ -0,0 +1,43 @@ + + +let start = Sys.time();; +"Case: 1/20";; +let _ = needs "149438122187_out.hl" in Sys.time() -. start;; +"Case: 2/20";; +let _ = needs "156588677070_out.hl" in Sys.time() -. start;; +"Case: 3/20";; +let _ = needs "168941837467_out.hl" in Sys.time() -. start;; +"Case: 4/20";; +let _ = needs "176747399778_out.hl" in Sys.time() -. start;; +"Case: 5/20";; +let _ = needs "196565289721_out.hl" in Sys.time() -. start;; +"Case: 6/20";; +let _ = needs "202328731904_out.hl" in Sys.time() -. start;; +"Case: 7/20";; +let _ = needs "204898223616_out.hl" in Sys.time() -. start;; +"Case: 8/20";; +let _ = needs "206221606034_out.hl" in Sys.time() -. start;; +"Case: 9/20";; +let _ = needs "209986500083_out.hl" in Sys.time() -. start;; +"Case: 10/20";; +let _ = needs "234860659776_out.hl" in Sys.time() -. start;; +"Case: 11/20";; +let _ = needs "241242841715_out.hl" in Sys.time() -. start;; +"Case: 12/20";; +let _ = needs "241966209046_out.hl" in Sys.time() -. start;; +"Case: 13/20";; +let _ = needs "28820130324_out.hl" in Sys.time() -. start;; +"Case: 14/20";; +let _ = needs "62059307362_out.hl" in Sys.time() -. start;; +"Case: 15/20";; +let _ = needs "63917576180_out.hl" in Sys.time() -. start;; +"Case: 16/20";; +let _ = needs "72977109430_out.hl" in Sys.time() -. start;; +"Case: 17/20";; +let _ = needs "75655754509_out.hl" in Sys.time() -. start;; +"Case: 18/20";; +let _ = needs "86324340346_out.hl" in Sys.time() -. start;; +"Case: 19/20";; +let _ = needs "95170601659_out.hl" in Sys.time() -. start;; +"Case: 20/20";; +let _ = needs "97685954266_out.hl" in Sys.time() -. start;; diff --git a/formal_lp/old/ineqs/tests2/118343205068_out.hl b/formal_lp/old/ineqs/tests2/118343205068_out.hl new file mode 100644 index 0000000..91725c5 --- /dev/null +++ b/formal_lp/old/ineqs/tests2/118343205068_out.hl @@ -0,0 +1,84 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "118343205068 23 4 0 1 2 3 3 0 3 4 3 4 3 5 3 5 3 2 3 5 2 6 4 6 2 7 8 3 7 2 1 3 7 1 9 3 9 1 10 3 10 1 0 4 10 0 11 12 3 11 0 4 3 11 4 13 3 13 4 5 3 13 5 6 3 13 6 14 3 14 6 8 3 8 7 9 3 8 9 12 3 9 10 12 3 14 8 12 3 14 12 11 3 11 13 14 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [0; 1; 3; 6; 10; 11; 12; ], [(mk_real_int64 87L); (mk_real_int64 409L); (mk_real_int64 409L); (mk_real_int64 246L); (mk_real_int64 139L); (mk_real_int64 139L); (mk_real_int64 246L); ]); +("azim_sum_neg", [2; 8; 13; ], [(mk_real_int64 22L); (mk_real_int64 136L); (mk_real_int64 50L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 1054L); (mk_real_int64 1147L); (mk_real_int64 1151L); (mk_real_int64 1147L); (mk_real_int64 1128L); (mk_real_int64 1128L); (mk_real_int64 1147L); (mk_real_int64 1108L); (mk_real_int64 1111L); (mk_real_int64 1108L); (mk_real_int64 1147L); (mk_real_int64 1147L); (mk_real_int64 1147L); (mk_real_int64 1069L); (mk_real_int64 1082L); ]); +("sol_sum3", [10; ], [(mk_real_int64 50L); ]); +("sol_sum3_neg", [15; ], [(mk_real_int64 36L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; ], [(mk_real_int64 1128L); (mk_real_int64 1128L); (mk_real_int64 1128L); (mk_real_int64 1128L); (mk_real_int64 1108L); (mk_real_int64 1108L); (mk_real_int64 1108L); (mk_real_int64 1108L); (mk_real_int64 1128L); (mk_real_int64 1069L); (mk_real_int64 1069L); (mk_real_int64 1069L); (mk_real_int64 1069L); (mk_real_int64 1082L); (mk_real_int64 1108L); (mk_real_int64 1111L); (mk_real_int64 1108L); (mk_real_int64 1082L); (mk_real_int64 1082L); (mk_real_int64 1069L); ]); +("tau_sum4_neg", [0; 1; 2; ], [(mk_real_int64 1128L); (mk_real_int64 1147L); (mk_real_int64 1147L); ]); +("ln_def_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 162L); (mk_real_int64 264L); (mk_real_int64 269L); (mk_real_int64 264L); (mk_real_int64 244L); (mk_real_int64 244L); (mk_real_int64 264L); (mk_real_int64 222L); (mk_real_int64 225L); (mk_real_int64 222L); (mk_real_int64 264L); (mk_real_int64 264L); (mk_real_int64 264L); (mk_real_int64 178L); (mk_real_int64 193L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 6623L); (mk_real_int64 7205L); (mk_real_int64 7229L); (mk_real_int64 7205L); (mk_real_int64 7089L); (mk_real_int64 7089L); (mk_real_int64 7205L); (mk_real_int64 6964L); (mk_real_int64 6982L); (mk_real_int64 6964L); (mk_real_int64 7205L); (mk_real_int64 7205L); (mk_real_int64 7205L); (mk_real_int64 6714L); (mk_real_int64 6801L); ]); +("edge_sym_neg", [5; 8; 9; 15; 22; 24; 25; 27; 28; 38; 40; 41; 47; 49; 50; 56; 58; 65; 68; ], [(mk_real_int64 356L); (mk_real_int64 141L); (mk_real_int64 141L); (mk_real_int64 19L); (mk_real_int64 289L); (mk_real_int64 155L); (mk_real_int64 155L); (mk_real_int64 31L); (mk_real_int64 155L); (mk_real_int64 19L); (mk_real_int64 267L); (mk_real_int64 27L); (mk_real_int64 27L); (mk_real_int64 13L); (mk_real_int64 138L); (mk_real_int64 123L); (mk_real_int64 143L); (mk_real_int64 54L); (mk_real_int64 79L); ]); +("edge_sym", [44; 53; 59; ], [(mk_real_int64 267L); (mk_real_int64 54L); (mk_real_int64 54L); ]); +("y1_def_neg", [4; 9; 12; 14; 21; 22; 25; 28; 29; 31; 37; 38; 39; 40; 43; 44; 45; 47; 49; 50; 52; 53; 56; 57; 58; 59; 61; 65; 67; 68; 69; 70; 71; ], [(mk_real_int64 264L); (mk_real_int64 203L); (mk_real_int64 264L); (mk_real_int64 21L); (mk_real_int64 79L); (mk_real_int64 145L); (mk_real_int64 127L); (mk_real_int64 194L); (mk_real_int64 145L); (mk_real_int64 79L); (mk_real_int64 11L); (mk_real_int64 10L); (mk_real_int64 82L); (mk_real_int64 148L); (mk_real_int64 129L); (mk_real_int64 8L); (mk_real_int64 123L); (mk_real_int64 82L); (mk_real_int64 166L); (mk_real_int64 8L); (mk_real_int64 39L); (mk_real_int64 123L); (mk_real_int64 82L); (mk_real_int64 21L); (mk_real_int64 55L); (mk_real_int64 8L); (mk_real_int64 149L); (mk_real_int64 78L); (mk_real_int64 123L); (mk_real_int64 39L); (mk_real_int64 45L); (mk_real_int64 96L); (mk_real_int64 8L); ]); +("y1_def", [26; 41; 48; 60; ], [(mk_real_int64 67L); (mk_real_int64 25L); (mk_real_int64 25L); (mk_real_int64 67L); ]); +("y2_def_neg", [4; 9; 12; 14; 22; 25; 26; 28; 29; 38; 40; 41; 43; 44; 45; 48; 49; 53; 56; 58; 60; 61; 65; 67; 70; ], [(mk_real_int64 54L); (mk_real_int64 203L); (mk_real_int64 54L); (mk_real_int64 3L); (mk_real_int64 145L); (mk_real_int64 214L); (mk_real_int64 20L); (mk_real_int64 194L); (mk_real_int64 145L); (mk_real_int64 10L); (mk_real_int64 148L); (mk_real_int64 8L); (mk_real_int64 129L); (mk_real_int64 8L); (mk_real_int64 155L); (mk_real_int64 8L); (mk_real_int64 94L); (mk_real_int64 61L); (mk_real_int64 169L); (mk_real_int64 167L); (mk_real_int64 20L); (mk_real_int64 149L); (mk_real_int64 78L); (mk_real_int64 61L); (mk_real_int64 128L); ]); +("y2_def", [21; 31; 37; 39; 47; 50; 52; 57; 59; 68; 69; 71; ], [(mk_real_int64 100L); (mk_real_int64 100L); (mk_real_int64 7L); (mk_real_int64 83L); (mk_real_int64 83L); (mk_real_int64 5L); (mk_real_int64 23L); (mk_real_int64 13L); (mk_real_int64 27L); (mk_real_int64 23L); (mk_real_int64 27L); (mk_real_int64 5L); ]); +("y3_def_neg", [4; 9; 12; 14; 22; 25; 26; 28; 29; 38; 40; 41; 43; 44; 45; 48; 49; 53; 56; 58; 60; 61; 65; 67; 70; ], [(mk_real_int64 54L); (mk_real_int64 203L); (mk_real_int64 54L); (mk_real_int64 3L); (mk_real_int64 145L); (mk_real_int64 214L); (mk_real_int64 20L); (mk_real_int64 194L); (mk_real_int64 145L); (mk_real_int64 10L); (mk_real_int64 148L); (mk_real_int64 8L); (mk_real_int64 129L); (mk_real_int64 8L); (mk_real_int64 155L); (mk_real_int64 8L); (mk_real_int64 94L); (mk_real_int64 61L); (mk_real_int64 169L); (mk_real_int64 167L); (mk_real_int64 20L); (mk_real_int64 149L); (mk_real_int64 78L); (mk_real_int64 61L); (mk_real_int64 128L); ]); +("y3_def", [21; 31; 37; 39; 47; 50; 52; 57; 59; 68; 69; 71; ], [(mk_real_int64 100L); (mk_real_int64 100L); (mk_real_int64 7L); (mk_real_int64 83L); (mk_real_int64 83L); (mk_real_int64 5L); (mk_real_int64 23L); (mk_real_int64 13L); (mk_real_int64 27L); (mk_real_int64 23L); (mk_real_int64 27L); (mk_real_int64 5L); ]); +("y4_def_neg", [0; 5; 8; 10; 13; 14; 17; 20; 21; 25; 26; 27; 28; 31; 33; 35; 37; 38; 40; 41; 45; 47; 49; 53; 55; 56; 57; 58; 59; ], [(mk_real_int64 356L); (mk_real_int64 141L); (mk_real_int64 356L); (mk_real_int64 19L); (mk_real_int64 189L); (mk_real_int64 100L); (mk_real_int64 31L); (mk_real_int64 135L); (mk_real_int64 100L); (mk_real_int64 13L); (mk_real_int64 7L); (mk_real_int64 156L); (mk_real_int64 103L); (mk_real_int64 90L); (mk_real_int64 64L); (mk_real_int64 156L); (mk_real_int64 135L); (mk_real_int64 9L); (mk_real_int64 44L); (mk_real_int64 103L); (mk_real_int64 24L); (mk_real_int64 31L); (mk_real_int64 103L); (mk_real_int64 54L); (mk_real_int64 103L); (mk_real_int64 44L); (mk_real_int64 51L); (mk_real_int64 45L); (mk_real_int64 9L); ]); +("y4_def", [18; 23; 29; 32; 36; 46; 48; ], [(mk_real_int64 103L); (mk_real_int64 132L); (mk_real_int64 39L); (mk_real_int64 16L); (mk_real_int64 39L); (mk_real_int64 35L); (mk_real_int64 103L); ]); +("y5_def_neg", [9; 22; 25; 26; 28; 29; 38; 40; 41; 43; 45; 48; 49; 53; 56; 58; 60; 61; 65; 67; 70; ], [(mk_real_int64 141L); (mk_real_int64 100L); (mk_real_int64 155L); (mk_real_int64 20L); (mk_real_int64 135L); (mk_real_int64 100L); (mk_real_int64 7L); (mk_real_int64 103L); (mk_real_int64 8L); (mk_real_int64 90L); (mk_real_int64 110L); (mk_real_int64 8L); (mk_real_int64 57L); (mk_real_int64 35L); (mk_real_int64 123L); (mk_real_int64 124L); (mk_real_int64 20L); (mk_real_int64 103L); (mk_real_int64 54L); (mk_real_int64 35L); (mk_real_int64 92L); ]); +("y5_def", [21; 31; 37; 39; 44; 47; 50; 52; 57; 59; 68; 69; 71; ], [(mk_real_int64 100L); (mk_real_int64 100L); (mk_real_int64 7L); (mk_real_int64 83L); (mk_real_int64 16L); (mk_real_int64 83L); (mk_real_int64 5L); (mk_real_int64 23L); (mk_real_int64 13L); (mk_real_int64 6L); (mk_real_int64 23L); (mk_real_int64 27L); (mk_real_int64 5L); ]); +("y6_def_neg", [9; 22; 25; 28; 29; 38; 40; 41; 45; 49; 53; 56; 58; 61; 65; 67; ], [(mk_real_int64 141L); (mk_real_int64 100L); (mk_real_int64 155L); (mk_real_int64 135L); (mk_real_int64 100L); (mk_real_int64 7L); (mk_real_int64 103L); (mk_real_int64 8L); (mk_real_int64 110L); (mk_real_int64 57L); (mk_real_int64 35L); (mk_real_int64 123L); (mk_real_int64 124L); (mk_real_int64 103L); (mk_real_int64 54L); (mk_real_int64 23L); ]); +("y6_def", [7; 10; 21; 23; 26; 31; 37; 39; 42; 43; 44; 47; 48; 50; 51; 52; 55; 57; 59; 60; 62; 66; 68; 69; 70; 71; ], [(mk_real_int64 497L); (mk_real_int64 497L); (mk_real_int64 100L); (mk_real_int64 321L); (mk_real_int64 289L); (mk_real_int64 100L); (mk_real_int64 7L); (mk_real_int64 83L); (mk_real_int64 340L); (mk_real_int64 125L); (mk_real_int64 16L); (mk_real_int64 83L); (mk_real_int64 93L); (mk_real_int64 5L); (mk_real_int64 92L); (mk_real_int64 35L); (mk_real_int64 278L); (mk_real_int64 279L); (mk_real_int64 6L); (mk_real_int64 258L); (mk_real_int64 266L); (mk_real_int64 133L); (mk_real_int64 23L); (mk_real_int64 128L); (mk_real_int64 184L); (mk_real_int64 97L); ]); +("RHA", [0; 1; 2; 15; 22; 24; 25; 26; 27; 30; 36; 40; 43; 44; 46; 49; 54; 56; 60; 62; 64; 65; 69; ], [(mk_real_int64 18L); (mk_real_int64 22L); (mk_real_int64 18L); (mk_real_int64 18L); (mk_real_int64 42L); (mk_real_int64 42L); (mk_real_int64 3L); (mk_real_int64 3L); (mk_real_int64 42L); (mk_real_int64 42L); (mk_real_int64 18L); (mk_real_int64 60L); (mk_real_int64 60L); (mk_real_int64 60L); (mk_real_int64 60L); (mk_real_int64 3L); (mk_real_int64 38L); (mk_real_int64 3L); (mk_real_int64 3L); (mk_real_int64 38L); (mk_real_int64 64L); (mk_real_int64 64L); (mk_real_int64 3L); ]); +("RHB", [3; 5; 8; 11; 18; 32; ], [(mk_real_int64 74L); (mk_real_int64 74L); (mk_real_int64 74L); (mk_real_int64 74L); (mk_real_int64 38L); (mk_real_int64 38L); ]); +("ineq106", [0; 8; 10; 13; 23; 25; 27; 35; 37; 38; 40; 41; 45; 47; 55; 56; 57; 59; ], [(mk_real_int64 18L); (mk_real_int64 18L); (mk_real_int64 18L); (mk_real_int64 38L); (mk_real_int64 38L); (mk_real_int64 18L); (mk_real_int64 78L); (mk_real_int64 78L); (mk_real_int64 75L); (mk_real_int64 14L); (mk_real_int64 64L); (mk_real_int64 64L); (mk_real_int64 36L); (mk_real_int64 36L); (mk_real_int64 64L); (mk_real_int64 64L); (mk_real_int64 75L); (mk_real_int64 14L); ]); +("ineq107", [17; 18; 29; 33; 36; 44; 46; 48; 58; ], [(mk_real_int64 134L); (mk_real_int64 134L); (mk_real_int64 50L); (mk_real_int64 50L); (mk_real_int64 50L); (mk_real_int64 134L); (mk_real_int64 173L); (mk_real_int64 134L); (mk_real_int64 50L); ]); +("ineq108", [0; 8; 13; 23; 27; 35; ], [(mk_real_int64 321L); (mk_real_int64 321L); (mk_real_int64 238L); (mk_real_int64 238L); (mk_real_int64 150L); (mk_real_int64 150L); ]); +("ineq109", [32; ], [(mk_real_int64 50L); ]); +("ineq110", [47; ], [(mk_real_int64 36L); ]); +("ineq111", [0; 5; 8; 10; 14; 17; 20; 21; 26; 28; 31; 33; 37; 41; 44; 46; 49; 53; 55; 58; ], [(mk_real_int64 988L); (mk_real_int64 1128L); (mk_real_int64 988L); (mk_real_int64 54L); (mk_real_int64 803L); (mk_real_int64 1077L); (mk_real_int64 1077L); (mk_real_int64 803L); (mk_real_int64 54L); (mk_real_int64 821L); (mk_real_int64 717L); (mk_real_int64 821L); (mk_real_int64 671L); (mk_real_int64 468L); (mk_real_int64 826L); (mk_real_int64 784L); (mk_real_int64 826L); (mk_real_int64 433L); (mk_real_int64 468L); (mk_real_int64 671L); ]); +("ineq114", [0; 8; 10; 11; 13; 14; 16; 19; 22; 23; 24; 25; 27; 28; 31; 32; 34; 35; 37; 40; 41; 42; 45; 47; 50; 52; 53; 55; 56; 57; ], [(mk_real_int64 140L); (mk_real_int64 140L); (mk_real_int64 653L); (mk_real_int64 422L); (mk_real_int64 274L); (mk_real_int64 32L); (mk_real_int64 32L); (mk_real_int64 32L); (mk_real_int64 32L); (mk_real_int64 274L); (mk_real_int64 422L); (mk_real_int64 653L); (mk_real_int64 152L); (mk_real_int64 95L); (mk_real_int64 176L); (mk_real_int64 176L); (mk_real_int64 95L); (mk_real_int64 152L); (mk_real_int64 397L); (mk_real_int64 392L); (mk_real_int64 222L); (mk_real_int64 283L); (mk_real_int64 164L); (mk_real_int64 164L); (mk_real_int64 283L); (mk_real_int64 324L); (mk_real_int64 324L); (mk_real_int64 222L); (mk_real_int64 392L); (mk_real_int64 397L); ]); +("ineq119", [6; 8; ], [(mk_real_int64 99L); (mk_real_int64 99L); ]); +("ineq120", [0; 2; 4; 5; 7; 9; 10; 11; ], [(mk_real_int64 564L); (mk_real_int64 564L); (mk_real_int64 324L); (mk_real_int64 540L); (mk_real_int64 183L); (mk_real_int64 540L); (mk_real_int64 324L); (mk_real_int64 183L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 2975L); (mk_real_int64 3125L); (mk_real_int64 3925L); (mk_real_int64 3125L); (mk_real_int64 3425L); (mk_real_int64 3425L); (mk_real_int64 3125L); (mk_real_int64 3300L); (mk_real_int64 3150L); (mk_real_int64 3300L); (mk_real_int64 3125L); (mk_real_int64 3125L); (mk_real_int64 3125L); (mk_real_int64 3050L); (mk_real_int64 2825L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [0; 2; 3; 5; 8; 11; 15; 17; 21; 22; 24; 27; 30; 31; 33; 36; 43; 44; 54; 62; ], [(mk_real_int64 512L); (mk_real_int64 512L); (mk_real_int64 24L); (mk_real_int64 24L); (mk_real_int64 24L); (mk_real_int64 24L); (mk_real_int64 172L); (mk_real_int64 320L); (mk_real_int64 524L); (mk_real_int64 32L); (mk_real_int64 32L); (mk_real_int64 32L); (mk_real_int64 32L); (mk_real_int64 524L); (mk_real_int64 320L); (mk_real_int64 172L); (mk_real_int64 176L); (mk_real_int64 176L); (mk_real_int64 158L); (mk_real_int64 158L); ]); +("azim_lo", [4; 12; 14; 16; 18; 19; 25; 26; 32; 34; 35; 37; 39; 40; 46; 47; 49; 52; 53; 56; 57; 58; 59; 60; 64; 65; 67; 68; 69; ], [(mk_real_int64 360L); (mk_real_int64 360L); (mk_real_int64 222L); (mk_real_int64 408L); (mk_real_int64 159L); (mk_real_int64 286L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 159L); (mk_real_int64 408L); (mk_real_int64 286L); (mk_real_int64 222L); (mk_real_int64 848L); (mk_real_int64 530L); (mk_real_int64 530L); (mk_real_int64 848L); (mk_real_int64 478L); (mk_real_int64 608L); (mk_real_int64 28L); (mk_real_int64 1000L); (mk_real_int64 336L); (mk_real_int64 1000L); (mk_real_int64 336L); (mk_real_int64 1000L); (mk_real_int64 176L); (mk_real_int64 176L); (mk_real_int64 28L); (mk_real_int64 608L); (mk_real_int64 478L); ]); +("rhazim_lo", [0; 1; 2; 4; 12; 14; 15; 21; 22; 24; 27; 30; 31; 36; 37; 52; 53; 54; 62; 64; 65; 67; 68; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_hi", [18; 32; 40; 43; 44; 46; 50; 71; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_hi", [0; 1; 2; 3; 6; 10; 11; 12; 13; ], [(mk_real_int64 336L); (mk_real_int64 2748L); (mk_real_int64 3884L); (mk_real_int64 2748L); (mk_real_int64 2748L); (mk_real_int64 2748L); (mk_real_int64 2748L); (mk_real_int64 2748L); (mk_real_int64 3596L); ]); +("rho_lo", [4; 5; 7; 8; 9; 14; ], [(mk_real_int64 648L); (mk_real_int64 648L); (mk_real_int64 1328L); (mk_real_int64 476L); (mk_real_int64 1328L); (mk_real_int64 1712L); ]); +("tau_lo", [5; 10; 12; 14; 15; 20; 22; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("tau_hi", [4; 6; 7; 8; 9; 11; 17; 18; 19; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("y1_lo", [4; 9; 12; 39; 43; 47; 50; 57; 71; ], [(mk_real_int64 75L); (mk_real_int64 40L); (mk_real_int64 75L); (mk_real_int64 50L); (mk_real_int64 60L); (mk_real_int64 50L); (mk_real_int64 400L); (mk_real_int64 600L); (mk_real_int64 400L); ]); +("y1_hi", [14; 21; 22; 25; 28; 29; 31; 37; 38; 40; 44; 45; 49; 52; 53; 56; 58; 59; 61; 65; 67; 68; 70; ], [(mk_real_int64 480L); (mk_real_int64 270L); (mk_real_int64 460L); (mk_real_int64 140L); (mk_real_int64 140L); (mk_real_int64 460L); (mk_real_int64 270L); (mk_real_int64 200L); (mk_real_int64 280L); (mk_real_int64 220L); (mk_real_int64 450L); (mk_real_int64 220L); (mk_real_int64 220L); (mk_real_int64 600L); (mk_real_int64 360L); (mk_real_int64 320L); (mk_real_int64 380L); (mk_real_int64 80L); (mk_real_int64 320L); (mk_real_int64 60L); (mk_real_int64 360L); (mk_real_int64 600L); (mk_real_int64 220L); ]); +("y2_lo", [4; 9; 12; 14; 25; 26; 37; 39; 43; 45; 47; 56; 58; 59; 60; 70; ], [(mk_real_int64 444L); (mk_real_int64 40L); (mk_real_int64 444L); (mk_real_int64 168L); (mk_real_int64 228L); (mk_real_int64 368L); (mk_real_int64 448L); (mk_real_int64 8L); (mk_real_int64 60L); (mk_real_int64 380L); (mk_real_int64 8L); (mk_real_int64 48L); (mk_real_int64 416L); (mk_real_int64 216L); (mk_real_int64 368L); (mk_real_int64 380L); ]); +("y2_hi", [21; 22; 28; 29; 31; 38; 40; 41; 44; 48; 49; 50; 52; 53; 57; 61; 65; 67; 68; 69; 71; ], [(mk_real_int64 464L); (mk_real_int64 460L); (mk_real_int64 140L); (mk_real_int64 460L); (mk_real_int64 464L); (mk_real_int64 280L); (mk_real_int64 220L); (mk_real_int64 400L); (mk_real_int64 450L); (mk_real_int64 400L); (mk_real_int64 520L); (mk_real_int64 96L); (mk_real_int64 296L); (mk_real_int64 56L); (mk_real_int64 104L); (mk_real_int64 320L); (mk_real_int64 60L); (mk_real_int64 56L); (mk_real_int64 296L); (mk_real_int64 300L); (mk_real_int64 96L); ]); +("y3_lo", [4; 9; 12; 14; 25; 26; 37; 39; 43; 45; 47; 56; 58; 59; 60; 70; ], [(mk_real_int64 444L); (mk_real_int64 40L); (mk_real_int64 444L); (mk_real_int64 168L); (mk_real_int64 228L); (mk_real_int64 368L); (mk_real_int64 448L); (mk_real_int64 8L); (mk_real_int64 60L); (mk_real_int64 380L); (mk_real_int64 8L); (mk_real_int64 48L); (mk_real_int64 416L); (mk_real_int64 216L); (mk_real_int64 368L); (mk_real_int64 380L); ]); +("y3_hi", [21; 22; 28; 29; 31; 38; 40; 41; 44; 48; 49; 50; 52; 53; 57; 61; 65; 67; 68; 69; 71; ], [(mk_real_int64 464L); (mk_real_int64 460L); (mk_real_int64 140L); (mk_real_int64 460L); (mk_real_int64 464L); (mk_real_int64 280L); (mk_real_int64 220L); (mk_real_int64 400L); (mk_real_int64 450L); (mk_real_int64 400L); (mk_real_int64 520L); (mk_real_int64 96L); (mk_real_int64 296L); (mk_real_int64 56L); (mk_real_int64 104L); (mk_real_int64 320L); (mk_real_int64 60L); (mk_real_int64 56L); (mk_real_int64 296L); (mk_real_int64 300L); (mk_real_int64 96L); ]); +("y4_hi", [0; 8; 18; 20; 25; 26; 28; 31; 32; 33; 40; 41; 44; 46; 48; 55; 56; ], [(mk_real_int64 285L); (mk_real_int64 285L); (mk_real_int64 582L); (mk_real_int64 375L); (mk_real_int64 670L); (mk_real_int64 250L); (mk_real_int64 375L); (mk_real_int64 375L); (mk_real_int64 200L); (mk_real_int64 25L); (mk_real_int64 160L); (mk_real_int64 660L); (mk_real_int64 332L); (mk_real_int64 729L); (mk_real_int64 582L); (mk_real_int64 660L); (mk_real_int64 160L); ]); +("y4_lo", [10; 13; 14; 17; 21; 23; 27; 29; 35; 36; 37; 38; 45; 47; 49; 53; 57; 58; 59; ], [(mk_real_int64 80L); (mk_real_int64 60L); (mk_real_int64 375L); (mk_real_int64 43L); (mk_real_int64 375L); (mk_real_int64 321060L); (mk_real_int64 180L); (mk_real_int64 350L); (mk_real_int64 180L); (mk_real_int64 350L); (mk_real_int64 250L); (mk_real_int64 590L); (mk_real_int64 660L); (mk_real_int64 716L); (mk_real_int64 250L); (mk_real_int64 125L); (mk_real_int64 375L); (mk_real_int64 225L); (mk_real_int64 590L); ]); +("y5_lo", [4; 12; 14; 22; 26; 29; 37; 39; 45; 47; 53; 56; 58; 60; 61; 65; 67; ], [(mk_real_int64 104L); (mk_real_int64 104L); (mk_real_int64 198L); (mk_real_int64 375L); (mk_real_int64 368L); (mk_real_int64 375L); (mk_real_int64 448L); (mk_real_int64 8L); (mk_real_int64 225L); (mk_real_int64 8L); (mk_real_int64 204L); (mk_real_int64 618L); (mk_real_int64 296L); (mk_real_int64 368L); (mk_real_int64 250L); (mk_real_int64 125L); (mk_real_int64 204L); ]); +("y5_hi", [21; 25; 28; 31; 38; 40; 41; 43; 44; 48; 49; 50; 52; 57; 59; 68; 69; 70; 71; ], [(mk_real_int64 464L); (mk_real_int64 7L); (mk_real_int64 375L); (mk_real_int64 464L); (mk_real_int64 250L); (mk_real_int64 375L); (mk_real_int64 400L); (mk_real_int64 375L); (mk_real_int64 200L); (mk_real_int64 400L); (mk_real_int64 425L); (mk_real_int64 96L); (mk_real_int64 296L); (mk_real_int64 104L); (mk_real_int64 48L); (mk_real_int64 296L); (mk_real_int64 300L); (mk_real_int64 525L); (mk_real_int64 96L); ]); +("y6_lo", [4; 7; 10; 12; 14; 22; 23; 26; 29; 37; 39; 42; 43; 45; 47; 48; 51; 52; 53; 55; 56; 57; 58; 60; 61; 62; 65; 66; 67; 69; 70; 71; ], [(mk_real_int64 104L); (mk_real_int64 497000L); (mk_real_int64 497000L); (mk_real_int64 104L); (mk_real_int64 198L); (mk_real_int64 375L); (mk_real_int64 321000L); (mk_real_int64 310000L); (mk_real_int64 375L); (mk_real_int64 448L); (mk_real_int64 8L); (mk_real_int64 340000L); (mk_real_int64 214625L); (mk_real_int64 225L); (mk_real_int64 8L); (mk_real_int64 101000L); (mk_real_int64 92000L); (mk_real_int64 12000L); (mk_real_int64 204L); (mk_real_int64 278000L); (mk_real_int64 618L); (mk_real_int64 266000L); (mk_real_int64 296L); (mk_real_int64 278368L); (mk_real_int64 250L); (mk_real_int64 266000L); (mk_real_int64 125L); (mk_real_int64 133000L); (mk_real_int64 12204L); (mk_real_int64 101000L); (mk_real_int64 276000L); (mk_real_int64 92000L); ]); +("y6_hi", [21; 25; 26; 28; 31; 38; 40; 41; 44; 48; 49; 50; 52; 57; 59; 68; 69; 70; 71; ], [(mk_real_int64 464L); (mk_real_int64 7L); (mk_real_int64 632L); (mk_real_int64 375L); (mk_real_int64 464L); (mk_real_int64 250L); (mk_real_int64 375L); (mk_real_int64 400L); (mk_real_int64 200L); (mk_real_int64 400L); (mk_real_int64 425L); (mk_real_int64 96L); (mk_real_int64 296L); (mk_real_int64 104L); (mk_real_int64 48L); (mk_real_int64 296L); (mk_real_int64 300L); (mk_real_int64 525L); (mk_real_int64 96L); ]); +("ye_hi", [23; 29; 45; 57; 58; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_lo", [26; 27; 38; 41; 42; 44; 51; 53; 68; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 341000L); (mk_real_int64 1000L); (mk_real_int64 133000L); (mk_real_int64 1000L); ]); +("yn_lo", [1; 2; 3; 4; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 1064L); (mk_real_int64 444L); (mk_real_int64 1064L); (mk_real_int64 544L); (mk_real_int64 1064L); (mk_real_int64 872L); (mk_real_int64 100L); (mk_real_int64 872L); (mk_real_int64 64L); (mk_real_int64 1064L); (mk_real_int64 1064L); (mk_real_int64 2528L); (mk_real_int64 1668L); ]); +("yn_hi", [0; 5; ], [(mk_real_int64 688L); (mk_real_int64 456L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/118760185161_out.hl b/formal_lp/old/ineqs/tests2/118760185161_out.hl new file mode 100644 index 0000000..cfb167b --- /dev/null +++ b/formal_lp/old/ineqs/tests2/118760185161_out.hl @@ -0,0 +1,88 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "118760185161 20 4 0 1 2 3 4 0 3 4 5 3 4 3 2 3 4 2 6 4 6 2 7 8 3 7 2 1 3 7 1 9 3 9 1 10 3 10 1 0 3 10 0 11 3 11 0 5 3 11 5 12 3 12 5 4 3 12 4 6 3 12 6 13 3 13 6 8 3 8 7 9 4 13 8 9 10 3 13 10 11 3 11 12 13 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [1; 3; 5; 6; 10; 13; ], [(mk_real_int64 12L); (mk_real_int64 270L); (mk_real_int64 3L); (mk_real_int64 310L); (mk_real_int64 156L); (mk_real_int64 324L); ]); +("azim_sum_neg", [4; 7; 9; 11; 12; ], [(mk_real_int64 46L); (mk_real_int64 185L); (mk_real_int64 171L); (mk_real_int64 45L); (mk_real_int64 11L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 869L); (mk_real_int64 1180L); (mk_real_int64 1180L); (mk_real_int64 1180L); (mk_real_int64 869L); (mk_real_int64 1035L); (mk_real_int64 1035L); (mk_real_int64 1026L); (mk_real_int64 1026L); (mk_real_int64 1026L); (mk_real_int64 1038L); (mk_real_int64 1022L); (mk_real_int64 1026L); (mk_real_int64 1026L); ]); +("sol_sum3_neg", [1; 5; 11; ], [(mk_real_int64 12L); (mk_real_int64 143L); (mk_real_int64 132L); ]); +("sol_sum3", [3; 8; 13; 15; ], [(mk_real_int64 171L); (mk_real_int64 45L); (mk_real_int64 171L); (mk_real_int64 6L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; ], [(mk_real_int64 869L); (mk_real_int64 1035L); (mk_real_int64 1026L); (mk_real_int64 1026L); (mk_real_int64 1026L); (mk_real_int64 1038L); (mk_real_int64 1022L); (mk_real_int64 869L); (mk_real_int64 869L); (mk_real_int64 869L); (mk_real_int64 1026L); (mk_real_int64 1026L); (mk_real_int64 1026L); (mk_real_int64 1026L); (mk_real_int64 1022L); (mk_real_int64 1022L); ]); +("tau_sum4_neg", [0; 1; 2; 3; ], [(mk_real_int64 1180L); (mk_real_int64 869L); (mk_real_int64 1026L); (mk_real_int64 1026L); ]); +("ln_def_neg", [1; 2; 3; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 301L); (mk_real_int64 301L); (mk_real_int64 301L); (mk_real_int64 141L); (mk_real_int64 141L); (mk_real_int64 131L); (mk_real_int64 131L); (mk_real_int64 131L); (mk_real_int64 144L); (mk_real_int64 127L); (mk_real_int64 131L); (mk_real_int64 131L); ]); +("ln_def", [0; 4; ], [(mk_real_int64 42L); (mk_real_int64 42L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 5457L); (mk_real_int64 7416L); (mk_real_int64 7416L); (mk_real_int64 7416L); (mk_real_int64 5457L); (mk_real_int64 6501L); (mk_real_int64 6501L); (mk_real_int64 6448L); (mk_real_int64 6448L); (mk_real_int64 6448L); (mk_real_int64 6520L); (mk_real_int64 6421L); (mk_real_int64 6448L); (mk_real_int64 6448L); ]); +("edge_sym", [5; 6; 10; 15; 22; 25; 38; 41; ], [(mk_real_int64 68L); (mk_real_int64 68L); (mk_real_int64 51L); (mk_real_int64 7L); (mk_real_int64 28L); (mk_real_int64 93L); (mk_real_int64 1L); (mk_real_int64 3L); ]); +("edge_sym_neg", [12; 13; 20; 23; 29; 31; 32; 35; 37; 44; 47; 60; ], [(mk_real_int64 7L); (mk_real_int64 167L); (mk_real_int64 15L); (mk_real_int64 146L); (mk_real_int64 78L); (mk_real_int64 144L); (mk_real_int64 109L); (mk_real_int64 304L); (mk_real_int64 161L); (mk_real_int64 22L); (mk_real_int64 31L); (mk_real_int64 20L); ]); +("y1_def_neg", [6; 8; 9; 10; 12; 13; 15; 19; 22; 23; 25; 28; 29; 30; 31; 33; 34; 36; 37; 39; 40; 41; 43; 44; 51; 53; 60; 62; 63; ], [(mk_real_int64 53L); (mk_real_int64 29L); (mk_real_int64 122L); (mk_real_int64 190L); (mk_real_int64 83L); (mk_real_int64 118L); (mk_real_int64 5L); (mk_real_int64 96L); (mk_real_int64 118L); (mk_real_int64 136L); (mk_real_int64 229L); (mk_real_int64 146L); (mk_real_int64 86L); (mk_real_int64 46L); (mk_real_int64 184L); (mk_real_int64 58L); (mk_real_int64 302L); (mk_real_int64 92L); (mk_real_int64 108L); (mk_real_int64 45L); (mk_real_int64 66L); (mk_real_int64 4L); (mk_real_int64 6L); (mk_real_int64 263L); (mk_real_int64 225L); (mk_real_int64 26L); (mk_real_int64 13L); (mk_real_int64 184L); (mk_real_int64 81L); ]); +("y1_def", [11; 18; 21; 24; 27; 32; 35; 42; 45; 52; 61; ], [(mk_real_int64 4L); (mk_real_int64 7L); (mk_real_int64 7L); (mk_real_int64 86L); (mk_real_int64 54L); (mk_real_int64 23L); (mk_real_int64 23L); (mk_real_int64 5L); (mk_real_int64 67L); (mk_real_int64 7L); (mk_real_int64 19L); ]); +("y2_def", [6; 8; 10; 12; 15; 22; 27; 29; 30; 33; 34; 36; 39; 41; 43; 45; 63; ], [(mk_real_int64 68L); (mk_real_int64 18L); (mk_real_int64 118L); (mk_real_int64 57L); (mk_real_int64 7L); (mk_real_int64 30L); (mk_real_int64 54L); (mk_real_int64 52L); (mk_real_int64 62L); (mk_real_int64 35L); (mk_real_int64 44L); (mk_real_int64 56L); (mk_real_int64 28L); (mk_real_int64 2L); (mk_real_int64 4L); (mk_real_int64 45L); (mk_real_int64 121L); ]); +("y2_def_neg", [9; 11; 13; 18; 19; 21; 23; 24; 25; 28; 31; 32; 35; 37; 40; 42; 44; 51; 52; 53; 60; 61; 62; ], [(mk_real_int64 122L); (mk_real_int64 1L); (mk_real_int64 98L); (mk_real_int64 2L); (mk_real_int64 26L); (mk_real_int64 2L); (mk_real_int64 136L); (mk_real_int64 26L); (mk_real_int64 81L); (mk_real_int64 146L); (mk_real_int64 50L); (mk_real_int64 7L); (mk_real_int64 7L); (mk_real_int64 108L); (mk_real_int64 96L); (mk_real_int64 2L); (mk_real_int64 69L); (mk_real_int64 122L); (mk_real_int64 2L); (mk_real_int64 26L); (mk_real_int64 27L); (mk_real_int64 6L); (mk_real_int64 184L); ]); +("y3_def", [6; 8; 10; 12; 15; 22; 27; 29; 30; 33; 34; 36; 39; 41; 43; 45; 63; ], [(mk_real_int64 68L); (mk_real_int64 18L); (mk_real_int64 118L); (mk_real_int64 57L); (mk_real_int64 7L); (mk_real_int64 30L); (mk_real_int64 54L); (mk_real_int64 52L); (mk_real_int64 62L); (mk_real_int64 35L); (mk_real_int64 44L); (mk_real_int64 56L); (mk_real_int64 28L); (mk_real_int64 2L); (mk_real_int64 4L); (mk_real_int64 45L); (mk_real_int64 121L); ]); +("y3_def_neg", [9; 11; 13; 18; 19; 21; 23; 24; 25; 28; 31; 32; 35; 37; 40; 42; 44; 51; 52; 53; 60; 61; 62; ], [(mk_real_int64 122L); (mk_real_int64 1L); (mk_real_int64 98L); (mk_real_int64 2L); (mk_real_int64 26L); (mk_real_int64 2L); (mk_real_int64 136L); (mk_real_int64 26L); (mk_real_int64 81L); (mk_real_int64 146L); (mk_real_int64 50L); (mk_real_int64 7L); (mk_real_int64 7L); (mk_real_int64 108L); (mk_real_int64 96L); (mk_real_int64 2L); (mk_real_int64 69L); (mk_real_int64 122L); (mk_real_int64 2L); (mk_real_int64 26L); (mk_real_int64 27L); (mk_real_int64 6L); (mk_real_int64 184L); ]); +("y4_def_neg", [0; 1; 2; 4; 5; 7; 10; 11; 13; 15; 16; 17; 18; 19; 21; 22; 24; 25; 27; 28; 29; 31; 32; 39; 46; 47; ], [(mk_real_int64 33L); (mk_real_int64 85L); (mk_real_int64 221L); (mk_real_int64 102L); (mk_real_int64 100L); (mk_real_int64 87L); (mk_real_int64 50L); (mk_real_int64 94L); (mk_real_int64 200L); (mk_real_int64 28L); (mk_real_int64 102L); (mk_real_int64 98L); (mk_real_int64 118L); (mk_real_int64 165L); (mk_real_int64 66L); (mk_real_int64 333L); (mk_real_int64 105L); (mk_real_int64 55L); (mk_real_int64 52L); (mk_real_int64 27L); (mk_real_int64 4L); (mk_real_int64 8L); (mk_real_int64 346L); (mk_real_int64 245L); (mk_real_int64 128L); (mk_real_int64 227L); ]); +("y4_def", [3; 6; 9; 12; 20; 23; 30; 40; 41; 45; ], [(mk_real_int64 7L); (mk_real_int64 10L); (mk_real_int64 11L); (mk_real_int64 132L); (mk_real_int64 35L); (mk_real_int64 35L); (mk_real_int64 8L); (mk_real_int64 11L); (mk_real_int64 55L); (mk_real_int64 30L); ]); +("y5_def", [6; 8; 10; 12; 15; 22; 29; 30; 33; 34; 36; 39; 41; 43; 53; 63; ], [(mk_real_int64 68L); (mk_real_int64 18L); (mk_real_int64 118L); (mk_real_int64 51L); (mk_real_int64 7L); (mk_real_int64 111L); (mk_real_int64 52L); (mk_real_int64 62L); (mk_real_int64 35L); (mk_real_int64 73L); (mk_real_int64 56L); (mk_real_int64 28L); (mk_real_int64 2L); (mk_real_int64 4L); (mk_real_int64 55L); (mk_real_int64 124L); ]); +("y5_def_neg", [9; 11; 13; 18; 19; 21; 23; 24; 25; 27; 28; 31; 32; 35; 37; 40; 42; 44; 45; 51; 52; 60; 61; 62; ], [(mk_real_int64 85L); (mk_real_int64 1L); (mk_real_int64 64L); (mk_real_int64 2L); (mk_real_int64 10L); (mk_real_int64 2L); (mk_real_int64 94L); (mk_real_int64 26L); (mk_real_int64 39L); (mk_real_int64 28L); (mk_real_int64 102L); (mk_real_int64 20L); (mk_real_int64 7L); (mk_real_int64 7L); (mk_real_int64 56L); (mk_real_int64 69L); (mk_real_int64 2L); (mk_real_int64 12L); (mk_real_int64 31L); (mk_real_int64 66L); (mk_real_int64 2L); (mk_real_int64 20L); (mk_real_int64 6L); (mk_real_int64 128L); ]); +("y6_def", [6; 8; 10; 12; 15; 18; 22; 24; 26; 27; 29; 30; 33; 34; 36; 39; 41; 42; 43; 45; 52; 53; 59; 61; 63; ], [(mk_real_int64 68L); (mk_real_int64 238L); (mk_real_int64 118L); (mk_real_int64 51L); (mk_real_int64 7L); (mk_real_int64 4L); (mk_real_int64 111L); (mk_real_int64 11L); (mk_real_int64 226L); (mk_real_int64 106L); (mk_real_int64 52L); (mk_real_int64 62L); (mk_real_int64 35L); (mk_real_int64 73L); (mk_real_int64 360L); (mk_real_int64 234L); (mk_real_int64 2L); (mk_real_int64 339L); (mk_real_int64 172L); (mk_real_int64 22L); (mk_real_int64 337L); (mk_real_int64 55L); (mk_real_int64 129L); (mk_real_int64 354L); (mk_real_int64 153L); ]); +("y6_def_neg", [9; 11; 13; 19; 21; 23; 25; 28; 31; 32; 35; 37; 40; 44; 51; 60; 62; ], [(mk_real_int64 85L); (mk_real_int64 1L); (mk_real_int64 64L); (mk_real_int64 10L); (mk_real_int64 2L); (mk_real_int64 94L); (mk_real_int64 39L); (mk_real_int64 24L); (mk_real_int64 20L); (mk_real_int64 7L); (mk_real_int64 7L); (mk_real_int64 56L); (mk_real_int64 18L); (mk_real_int64 12L); (mk_real_int64 53L); (mk_real_int64 20L); (mk_real_int64 123L); ]); +("RHA", [4; 6; 8; 14; 15; 19; 20; 26; 28; 31; 33; 38; 39; 41; 46; 49; 57; 58; 59; 62; ], [(mk_real_int64 312L); (mk_real_int64 166L); (mk_real_int64 118L); (mk_real_int64 9L); (mk_real_int64 154L); (mk_real_int64 81L); (mk_real_int64 154L); (mk_real_int64 11L); (mk_real_int64 143L); (mk_real_int64 20L); (mk_real_int64 56L); (mk_real_int64 158L); (mk_real_int64 82L); (mk_real_int64 160L); (mk_real_int64 9L); (mk_real_int64 9L); (mk_real_int64 11L); (mk_real_int64 4L); (mk_real_int64 16L); (mk_real_int64 4L); ]); +("RHB", [3; ], [(mk_real_int64 312L); ]); +("ineq105", [6; 9; ], [(mk_real_int64 169L); (mk_real_int64 16L); ]); +("ineq106", [0; 2; 4; 7; 10; 13; 17; 18; 19; 21; 22; 24; 27; 29; 31; 32; 47; ], [(mk_real_int64 48L); (mk_real_int64 312L); (mk_real_int64 146L); (mk_real_int64 73L); (mk_real_int64 154L); (mk_real_int64 154L); (mk_real_int64 143L); (mk_real_int64 16L); (mk_real_int64 138L); (mk_real_int64 97L); (mk_real_int64 312L); (mk_real_int64 153L); (mk_real_int64 76L); (mk_real_int64 7L); (mk_real_int64 9L); (mk_real_int64 9L); (mk_real_int64 4L); ]); +("ineq107", [3; 6; 9; 12; 20; 23; 25; 28; 30; 33; 40; 44; 45; ], [(mk_real_int64 9L); (mk_real_int64 13L); (mk_real_int64 14L); (mk_real_int64 171L); (mk_real_int64 45L); (mk_real_int64 46L); (mk_real_int64 1L); (mk_real_int64 46L); (mk_real_int64 11L); (mk_real_int64 34L); (mk_real_int64 14L); (mk_real_int64 21L); (mk_real_int64 39L); ]); +("ineq108", [2; 5; 18; 22; 31; 32; 39; 47; ], [(mk_real_int64 12L); (mk_real_int64 34L); (mk_real_int64 156L); (mk_real_int64 75L); (mk_real_int64 3L); (mk_real_int64 310L); (mk_real_int64 171L); (mk_real_int64 330L); ]); +("ineq109", [10; 25; 41; 47; ], [(mk_real_int64 171L); (mk_real_int64 45L); (mk_real_int64 171L); (mk_real_int64 6L); ]); +("ineq110", [4; 15; 33; ], [(mk_real_int64 12L); (mk_real_int64 143L); (mk_real_int64 132L); ]); +("ineq111", [1; 5; 7; 11; 13; 16; 19; 22; 25; 28; 32; 39; 44; 46; ], [(mk_real_int64 676L); (mk_real_int64 613L); (mk_real_int64 293L); (mk_real_int64 753L); (mk_real_int64 759L); (mk_real_int64 813L); (mk_real_int64 559L); (mk_real_int64 540L); (mk_real_int64 562L); (mk_real_int64 496L); (mk_real_int64 1026L); (mk_real_int64 1026L); (mk_real_int64 132L); (mk_real_int64 1022L); ]); +("ineq112", [6; ], [(mk_real_int64 339L); ]); +("ineq113", [33; 44; ], [(mk_real_int64 422L); (mk_real_int64 92L); ]); +("ineq114", [0; 5; 7; 8; 10; 14; 15; 17; 19; 21; 22; 26; 27; 29; 34; 35; 36; 37; 42; 43; ], [(mk_real_int64 192L); (mk_real_int64 422L); (mk_real_int64 148L); (mk_real_int64 246L); (mk_real_int64 273L); (mk_real_int64 267L); (mk_real_int64 21L); (mk_real_int64 203L); (mk_real_int64 463L); (mk_real_int64 18L); (mk_real_int64 310L); (mk_real_int64 307L); (mk_real_int64 114L); (mk_real_int64 259L); (mk_real_int64 298L); (mk_real_int64 306L); (mk_real_int64 517L); (mk_real_int64 509L); (mk_real_int64 524L); (mk_real_int64 274L); ]); +("ineq119", [3; 7; 10; 14; ], [(mk_real_int64 809L); (mk_real_int64 101L); (mk_real_int64 408L); (mk_real_int64 378L); ]); +("ineq120", [0; 2; 4; 8; 9; 12; 15; ], [(mk_real_int64 356L); (mk_real_int64 15L); (mk_real_int64 768L); (mk_real_int64 421L); (mk_real_int64 197L); (mk_real_int64 428L); (mk_real_int64 221L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 3025L); (mk_real_int64 3200L); (mk_real_int64 3200L); (mk_real_int64 3200L); (mk_real_int64 3025L); (mk_real_int64 3325L); (mk_real_int64 3325L); (mk_real_int64 2600L); (mk_real_int64 2600L); (mk_real_int64 2600L); (mk_real_int64 3000L); (mk_real_int64 3325L); (mk_real_int64 2600L); (mk_real_int64 2600L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_lo", [0; 2; 8; 15; 19; 20; 22; 31; 34; 41; 45; 46; 47; 48; 49; 56; 59; ], [(mk_real_int64 152L); (mk_real_int64 630L); (mk_real_int64 808L); (mk_real_int64 674L); (mk_real_int64 352L); (mk_real_int64 4L); (mk_real_int64 102L); (mk_real_int64 162L); (mk_real_int64 940L); (mk_real_int64 866L); (mk_real_int64 298L); (mk_real_int64 452L); (mk_real_int64 444L); (mk_real_int64 358L); (mk_real_int64 366L); (mk_real_int64 234L); (mk_real_int64 476L); ]); +("azim_hi", [3; 4; 7; 13; 14; 16; 18; 26; 27; 29; 33; 38; 39; 54; 57; 58; 60; 62; ], [(mk_real_int64 435L); (mk_real_int64 144L); (mk_real_int64 247L); (mk_real_int64 172L); (mk_real_int64 118L); (mk_real_int64 176L); (mk_real_int64 127L); (mk_real_int64 142L); (mk_real_int64 146L); (mk_real_int64 78L); (mk_real_int64 268L); (mk_real_int64 182L); (mk_real_int64 364L); (mk_real_int64 424L); (mk_real_int64 518L); (mk_real_int64 24L); (mk_real_int64 172L); (mk_real_int64 1000L); ]); +("rhazim_hi", [4; 10; 12; 28; 29; 34; 38; 39; 41; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_lo", [3; 26; 57; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_lo", [1; 2; 3; 7; 8; 9; 12; 13; ], [(mk_real_int64 880L); (mk_real_int64 880L); (mk_real_int64 880L); (mk_real_int64 616L); (mk_real_int64 616L); (mk_real_int64 616L); (mk_real_int64 616L); (mk_real_int64 616L); ]); +("rho_hi", [0; 4; 5; 6; 10; 11; ], [(mk_real_int64 3796L); (mk_real_int64 3796L); (mk_real_int64 2940L); (mk_real_int64 2940L); (mk_real_int64 2792L); (mk_real_int64 1248L); ]); +("tau_lo", [2; 8; 10; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("tau_hi", [17; ], [(mk_real_int64 1000L); ]); +("y1_lo", [6; 10; 12; 13; 15; 18; 19; 22; 24; 25; 28; 30; 32; 33; 34; 39; 40; 41; 43; 60; ], [(mk_real_int64 235L); (mk_real_int64 20L); (mk_real_int64 40L); (mk_real_int64 330L); (mk_real_int64 40L); (mk_real_int64 500L); (mk_real_int64 540L); (mk_real_int64 221L); (mk_real_int64 500L); (mk_real_int64 20L); (mk_real_int64 340L); (mk_real_int64 260L); (mk_real_int64 500L); (mk_real_int64 200L); (mk_real_int64 25L); (mk_real_int64 600L); (mk_real_int64 280L); (mk_real_int64 200L); (mk_real_int64 105L); (mk_real_int64 260L); ]); +("y1_hi", [8; 9; 11; 23; 27; 29; 31; 36; 37; 42; 44; 45; 51; 53; 61; 62; 63; ], [(mk_real_int64 200L); (mk_real_int64 320L); (mk_real_int64 500L); (mk_real_int64 460L); (mk_real_int64 340L); (mk_real_int64 200L); (mk_real_int64 580L); (mk_real_int64 200L); (mk_real_int64 545L); (mk_real_int64 500L); (mk_real_int64 70L); (mk_real_int64 160L); (mk_real_int64 135L); (mk_real_int64 179L); (mk_real_int64 500L); (mk_real_int64 40L); (mk_real_int64 144L); ]); +("y2_lo", [6; 8; 10; 11; 15; 19; 21; 28; 31; 34; 36; 37; 39; 40; 45; 51; 52; 63; ], [(mk_real_int64 62L); (mk_real_int64 528L); (mk_real_int64 64L); (mk_real_int64 368L); (mk_real_int64 568L); (mk_real_int64 168L); (mk_real_int64 128L); (mk_real_int64 340L); (mk_real_int64 388L); (mk_real_int64 332L); (mk_real_int64 308L); (mk_real_int64 107L); (mk_real_int64 336L); (mk_real_int64 272L); (mk_real_int64 8L); (mk_real_int64 436L); (mk_real_int64 128L); (mk_real_int64 330L); ]); +("y2_hi", [9; 12; 13; 18; 22; 23; 24; 25; 27; 29; 30; 32; 33; 35; 41; 42; 43; 44; 53; 60; 61; 62; ], [(mk_real_int64 320L); (mk_real_int64 704L); (mk_real_int64 36L); (mk_real_int64 24L); (mk_real_int64 235L); (mk_real_int64 460L); (mk_real_int64 8L); (mk_real_int64 436L); (mk_real_int64 340L); (mk_real_int64 52L); (mk_real_int64 608L); (mk_real_int64 160L); (mk_real_int64 308L); (mk_real_int64 8L); (mk_real_int64 548L); (mk_real_int64 328L); (mk_real_int64 368L); (mk_real_int64 436L); (mk_real_int64 179L); (mk_real_int64 48L); (mk_real_int64 72L); (mk_real_int64 40L); ]); +("y3_lo", [6; 8; 10; 11; 15; 19; 21; 28; 31; 34; 36; 37; 39; 40; 45; 51; 52; 63; ], [(mk_real_int64 62L); (mk_real_int64 528L); (mk_real_int64 64L); (mk_real_int64 368L); (mk_real_int64 568L); (mk_real_int64 168L); (mk_real_int64 128L); (mk_real_int64 340L); (mk_real_int64 388L); (mk_real_int64 332L); (mk_real_int64 308L); (mk_real_int64 107L); (mk_real_int64 336L); (mk_real_int64 272L); (mk_real_int64 8L); (mk_real_int64 436L); (mk_real_int64 128L); (mk_real_int64 330L); ]); +("y3_hi", [9; 12; 13; 18; 22; 23; 24; 25; 27; 29; 30; 32; 33; 35; 41; 42; 43; 44; 53; 60; 61; 62; ], [(mk_real_int64 320L); (mk_real_int64 704L); (mk_real_int64 36L); (mk_real_int64 24L); (mk_real_int64 235L); (mk_real_int64 460L); (mk_real_int64 8L); (mk_real_int64 436L); (mk_real_int64 340L); (mk_real_int64 52L); (mk_real_int64 608L); (mk_real_int64 160L); (mk_real_int64 308L); (mk_real_int64 8L); (mk_real_int64 548L); (mk_real_int64 328L); (mk_real_int64 368L); (mk_real_int64 436L); (mk_real_int64 179L); (mk_real_int64 48L); (mk_real_int64 72L); (mk_real_int64 40L); ]); +("y4_hi", [0; 1; 5; 6; 7; 12; 16; 17; 18; 19; 22; 23; 24; 25; 28; 30; 33; 41; 45; 46; 47; ], [(mk_real_int64 120L); (mk_real_int64 500L); (mk_real_int64 85L); (mk_real_int64 49L); (mk_real_int64 370L); (mk_real_int64 183L); (mk_real_int64 375L); (mk_real_int64 45L); (mk_real_int64 180L); (mk_real_int64 595L); (mk_real_int64 405L); (mk_real_int64 558L); (mk_real_int64 195L); (mk_real_int64 103L); (mk_real_int64 558L); (mk_real_int64 503L); (mk_real_int64 410L); (mk_real_int64 404L); (mk_real_int64 147L); (mk_real_int64 250L); (mk_real_int64 154L); ]); +("y4_lo", [2; 3; 4; 9; 10; 11; 13; 15; 20; 21; 27; 29; 31; 32; 39; 40; 44; ], [(mk_real_int64 940L); (mk_real_int64 43L); (mk_real_int64 362L); (mk_real_int64 178L); (mk_real_int64 86L); (mk_real_int64 125L); (mk_real_int64 365L); (mk_real_int64 28L); (mk_real_int64 215L); (mk_real_int64 445L); (mk_real_int64 60L); (mk_real_int64 795L); (mk_real_int64 220L); (mk_real_int64 765L); (mk_real_int64 385L); (mk_real_int64 178L); (mk_real_int64 267L); ]); +("y5_hi", [9; 18; 22; 24; 25; 28; 29; 30; 31; 32; 33; 34; 35; 37; 40; 41; 42; 43; 53; 60; 61; 62; ], [(mk_real_int64 500L); (mk_real_int64 24L); (mk_real_int64 460L); (mk_real_int64 8L); (mk_real_int64 181L); (mk_real_int64 375L); (mk_real_int64 52L); (mk_real_int64 608L); (mk_real_int64 357L); (mk_real_int64 160L); (mk_real_int64 308L); (mk_real_int64 368L); (mk_real_int64 8L); (mk_real_int64 178L); (mk_real_int64 8L); (mk_real_int64 548L); (mk_real_int64 328L); (mk_real_int64 368L); (mk_real_int64 404L); (mk_real_int64 308L); (mk_real_int64 72L); (mk_real_int64 250L); ]); +("y5_lo", [6; 8; 10; 11; 12; 13; 15; 19; 21; 23; 27; 36; 39; 44; 45; 51; 52; 63; ], [(mk_real_int64 62L); (mk_real_int64 528L); (mk_real_int64 64L); (mk_real_int64 368L); (mk_real_int64 208L); (mk_real_int64 249L); (mk_real_int64 568L); (mk_real_int64 53L); (mk_real_int64 128L); (mk_real_int64 125L); (mk_real_int64 28L); (mk_real_int64 308L); (mk_real_int64 336L); (mk_real_int64 134L); (mk_real_int64 40L); (mk_real_int64 6L); (mk_real_int64 128L); (mk_real_int64 480L); ]); +("y6_hi", [8; 9; 18; 22; 24; 25; 28; 29; 30; 31; 32; 33; 34; 35; 37; 39; 40; 41; 42; 53; 60; 61; 62; 63; ], [(mk_real_int64 472L); (mk_real_int64 500L); (mk_real_int64 24L); (mk_real_int64 460L); (mk_real_int64 8L); (mk_real_int64 181L); (mk_real_int64 375L); (mk_real_int64 52L); (mk_real_int64 608L); (mk_real_int64 357L); (mk_real_int64 160L); (mk_real_int64 308L); (mk_real_int64 368L); (mk_real_int64 8L); (mk_real_int64 178L); (mk_real_int64 664L); (mk_real_int64 8L); (mk_real_int64 548L); (mk_real_int64 328L); (mk_real_int64 404L); (mk_real_int64 308L); (mk_real_int64 72L); (mk_real_int64 250L); (mk_real_int64 520L); ]); +("y6_lo", [6; 8; 10; 11; 12; 13; 15; 18; 19; 21; 23; 24; 26; 27; 28; 36; 39; 40; 42; 43; 44; 45; 51; 52; 59; 61; 62; 63; ], [(mk_real_int64 62L); (mk_real_int64 221000L); (mk_real_int64 64L); (mk_real_int64 368L); (mk_real_int64 208L); (mk_real_int64 249L); (mk_real_int64 568L); (mk_real_int64 6000L); (mk_real_int64 53L); (mk_real_int64 128L); (mk_real_int64 125L); (mk_real_int64 37000L); (mk_real_int64 226000L); (mk_real_int64 134028L); (mk_real_int64 78000L); (mk_real_int64 304308L); (mk_real_int64 207000L); (mk_real_int64 51000L); (mk_real_int64 341000L); (mk_real_int64 167632L); (mk_real_int64 134L); (mk_real_int64 53040L); (mk_real_int64 13006L); (mk_real_int64 339128L); (mk_real_int64 129000L); (mk_real_int64 360000L); (mk_real_int64 5000L); (mk_real_int64 30000L); ]); +("ye_lo", [20; 27; 30; 31; 32; 33; 35; 63; ], [(mk_real_int64 74000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_hi", [11; 12; 18; 43; 52; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_lo", [3; 5; 8; 9; 12; 13; ], [(mk_real_int64 1876L); (mk_real_int64 716L); (mk_real_int64 956L); (mk_real_int64 956L); (mk_real_int64 956L); (mk_real_int64 956L); ]); +("yn_hi", [0; 1; 2; 4; 6; 7; 10; 11; ], [(mk_real_int64 1234L); (mk_real_int64 124L); (mk_real_int64 124L); (mk_real_int64 1234L); (mk_real_int64 284L); (mk_real_int64 44L); (mk_real_int64 56L); (mk_real_int64 1348L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/119040238600_out.hl b/formal_lp/old/ineqs/tests2/119040238600_out.hl new file mode 100644 index 0000000..454ec5a --- /dev/null +++ b/formal_lp/old/ineqs/tests2/119040238600_out.hl @@ -0,0 +1,83 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "119040238600 20 4 0 1 2 3 3 0 3 4 3 4 3 5 3 5 3 2 3 5 2 6 3 6 2 1 3 6 1 7 3 7 1 0 3 7 0 8 3 8 0 4 4 8 4 9 10 3 9 4 5 3 9 5 11 3 11 5 6 3 11 6 12 3 12 6 7 3 12 7 8 3 12 8 10 3 11 12 10 3 10 9 11 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [1; 3; 4; 5; 6; 7; 8; 9; 12; ], [(mk_real_int64 6L); (mk_real_int64 636L); (mk_real_int64 172L); (mk_real_int64 561L); (mk_real_int64 610L); (mk_real_int64 221L); (mk_real_int64 324L); (mk_real_int64 160L); (mk_real_int64 544L); ]); +("azim_sum_neg", [10; ], [(mk_real_int64 115L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 621L); (mk_real_int64 621L); (mk_real_int64 621L); (mk_real_int64 621L); (mk_real_int64 724L); (mk_real_int64 724L); (mk_real_int64 676L); (mk_real_int64 676L); (mk_real_int64 762L); (mk_real_int64 724L); (mk_real_int64 724L); (mk_real_int64 724L); (mk_real_int64 724L); ]); +("sol_sum3_neg", [0; 1; 3; 5; 7; 8; 9; 11; 12; 13; 14; 15; ], [(mk_real_int64 18L); (mk_real_int64 275L); (mk_real_int64 470L); (mk_real_int64 276L); (mk_real_int64 535L); (mk_real_int64 474L); (mk_real_int64 147L); (mk_real_int64 971L); (mk_real_int64 160L); (mk_real_int64 221L); (mk_real_int64 207L); (mk_real_int64 5L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; ], [(mk_real_int64 621L); (mk_real_int64 621L); (mk_real_int64 621L); (mk_real_int64 621L); (mk_real_int64 621L); (mk_real_int64 621L); (mk_real_int64 621L); (mk_real_int64 444L); (mk_real_int64 502L); (mk_real_int64 724L); (mk_real_int64 724L); (mk_real_int64 296L); (mk_real_int64 676L); (mk_real_int64 676L); (mk_real_int64 676L); (mk_real_int64 724L); (mk_real_int64 724L); (mk_real_int64 724L); ]); +("tau_sum4_neg", [0; 1; ], [(mk_real_int64 621L); (mk_real_int64 724L); ]); +("ln_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 315L); (mk_real_int64 315L); (mk_real_int64 315L); (mk_real_int64 240L); (mk_real_int64 202L); (mk_real_int64 202L); (mk_real_int64 255L); (mk_real_int64 255L); (mk_real_int64 160L); (mk_real_int64 202L); (mk_real_int64 202L); (mk_real_int64 202L); (mk_real_int64 202L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 3904L); (mk_real_int64 3904L); (mk_real_int64 3904L); (mk_real_int64 3904L); (mk_real_int64 4548L); (mk_real_int64 4548L); (mk_real_int64 4248L); (mk_real_int64 4248L); (mk_real_int64 4789L); (mk_real_int64 4548L); (mk_real_int64 4548L); (mk_real_int64 4548L); (mk_real_int64 4548L); ]); +("edge_sym", [0; 1; 2; 3; 5; 6; 9; 12; 15; 18; 21; 24; 32; 33; 34; 39; 55; ], [(mk_real_int64 67L); (mk_real_int64 3L); (mk_real_int64 3L); (mk_real_int64 67L); (mk_real_int64 96L); (mk_real_int64 187L); (mk_real_int64 158L); (mk_real_int64 102L); (mk_real_int64 217L); (mk_real_int64 96L); (mk_real_int64 43L); (mk_real_int64 191L); (mk_real_int64 49L); (mk_real_int64 79L); (mk_real_int64 59L); (mk_real_int64 237L); (mk_real_int64 2L); ]); +("edge_sym_neg", [8; 14; 20; 26; 27; 30; 37; 40; 43; 45; 46; 49; 52; 58; ], [(mk_real_int64 96L); (mk_real_int64 163L); (mk_real_int64 96L); (mk_real_int64 3L); (mk_real_int64 79L); (mk_real_int64 71L); (mk_real_int64 49L); (mk_real_int64 259L); (mk_real_int64 217L); (mk_real_int64 230L); (mk_real_int64 196L); (mk_real_int64 43L); (mk_real_int64 113L); (mk_real_int64 78L); ]); +("y1_def_neg", [0; 2; 4; 6; 10; 12; 16; 17; 22; 24; 28; 31; 32; 39; 40; 44; 45; 46; 51; 53; 56; 57; 61; ], [(mk_real_int64 52L); (mk_real_int64 2L); (mk_real_int64 54L); (mk_real_int64 91L); (mk_real_int64 102L); (mk_real_int64 1L); (mk_real_int64 85L); (mk_real_int64 1L); (mk_real_int64 85L); (mk_real_int64 58L); (mk_real_int64 66L); (mk_real_int64 46L); (mk_real_int64 10L); (mk_real_int64 111L); (mk_real_int64 42L); (mk_real_int64 119L); (mk_real_int64 45L); (mk_real_int64 150L); (mk_real_int64 25L); (mk_real_int64 14L); (mk_real_int64 73L); (mk_real_int64 37L); (mk_real_int64 21L); ]); +("y1_def", [5; 8; 14; 15; 20; 21; 25; 27; 29; 30; 35; 43; 47; 52; 54; 55; 58; 59; ], [(mk_real_int64 9L); (mk_real_int64 242L); (mk_real_int64 232L); (mk_real_int64 179L); (mk_real_int64 138L); (mk_real_int64 105L); (mk_real_int64 41L); (mk_real_int64 139L); (mk_real_int64 170L); (mk_real_int64 40L); (mk_real_int64 124L); (mk_real_int64 309L); (mk_real_int64 84L); (mk_real_int64 79L); (mk_real_int64 2L); (mk_real_int64 60L); (mk_real_int64 57L); (mk_real_int64 57L); ]); +("y2_def", [0; 2; 4; 6; 8; 10; 12; 15; 16; 17; 21; 22; 24; 27; 28; 29; 31; 32; 35; 39; 40; 43; 44; 45; 47; 51; 52; 53; 54; 56; 57; 61; ], [(mk_real_int64 67L); (mk_real_int64 3L); (mk_real_int64 83L); (mk_real_int64 100L); (mk_real_int64 63L); (mk_real_int64 100L); (mk_real_int64 2L); (mk_real_int64 179L); (mk_real_int64 101L); (mk_real_int64 2L); (mk_real_int64 105L); (mk_real_int64 101L); (mk_real_int64 90L); (mk_real_int64 242L); (mk_real_int64 40L); (mk_real_int64 170L); (mk_real_int64 59L); (mk_real_int64 12L); (mk_real_int64 35L); (mk_real_int64 172L); (mk_real_int64 65L); (mk_real_int64 328L); (mk_real_int64 157L); (mk_real_int64 225L); (mk_real_int64 84L); (mk_real_int64 38L); (mk_real_int64 79L); (mk_real_int64 21L); (mk_real_int64 2L); (mk_real_int64 40L); (mk_real_int64 58L); (mk_real_int64 33L); ]); +("y2_def_neg", [5; 14; 20; 25; 30; 46; 55; 58; 59; ], [(mk_real_int64 3L); (mk_real_int64 70L); (mk_real_int64 42L); (mk_real_int64 12L); (mk_real_int64 12L); (mk_real_int64 104L); (mk_real_int64 18L); (mk_real_int64 17L); (mk_real_int64 17L); ]); +("y3_def", [0; 2; 4; 6; 8; 10; 12; 15; 16; 17; 21; 22; 24; 27; 28; 29; 31; 32; 35; 39; 40; 43; 44; 45; 47; 51; 52; 53; 54; 56; 57; 61; ], [(mk_real_int64 67L); (mk_real_int64 3L); (mk_real_int64 83L); (mk_real_int64 100L); (mk_real_int64 63L); (mk_real_int64 100L); (mk_real_int64 2L); (mk_real_int64 179L); (mk_real_int64 101L); (mk_real_int64 2L); (mk_real_int64 105L); (mk_real_int64 101L); (mk_real_int64 90L); (mk_real_int64 242L); (mk_real_int64 40L); (mk_real_int64 170L); (mk_real_int64 59L); (mk_real_int64 12L); (mk_real_int64 35L); (mk_real_int64 172L); (mk_real_int64 65L); (mk_real_int64 328L); (mk_real_int64 157L); (mk_real_int64 225L); (mk_real_int64 84L); (mk_real_int64 38L); (mk_real_int64 79L); (mk_real_int64 21L); (mk_real_int64 2L); (mk_real_int64 40L); (mk_real_int64 58L); (mk_real_int64 33L); ]); +("y3_def_neg", [5; 14; 20; 25; 30; 46; 55; 58; 59; ], [(mk_real_int64 3L); (mk_real_int64 70L); (mk_real_int64 42L); (mk_real_int64 12L); (mk_real_int64 12L); (mk_real_int64 104L); (mk_real_int64 18L); (mk_real_int64 17L); (mk_real_int64 17L); ]); +("y4_def", [1; 4; 10; 16; 21; 26; 27; 47; 50; 51; ], [(mk_real_int64 14L); (mk_real_int64 158L); (mk_real_int64 358L); (mk_real_int64 214L); (mk_real_int64 63L); (mk_real_int64 62L); (mk_real_int64 76L); (mk_real_int64 93L); (mk_real_int64 89L); (mk_real_int64 89L); ]); +("y4_def_neg", [0; 2; 6; 8; 11; 12; 13; 17; 18; 20; 23; 24; 25; 31; 32; 35; 36; 37; 38; 39; 43; 44; 45; 46; 48; 49; 53; ], [(mk_real_int64 157L); (mk_real_int64 179L); (mk_real_int64 188L); (mk_real_int64 4L); (mk_real_int64 92L); (mk_real_int64 189L); (mk_real_int64 4L); (mk_real_int64 54L); (mk_real_int64 189L); (mk_real_int64 169L); (mk_real_int64 178L); (mk_real_int64 76L); (mk_real_int64 99L); (mk_real_int64 324L); (mk_real_int64 123L); (mk_real_int64 237L); (mk_real_int64 296L); (mk_real_int64 340L); (mk_real_int64 117L); (mk_real_int64 43L); (mk_real_int64 72L); (mk_real_int64 41L); (mk_real_int64 40L); (mk_real_int64 1L); (mk_real_int64 149L); (mk_real_int64 109L); (mk_real_int64 62L); ]); +("y5_def", [0; 2; 4; 6; 10; 12; 16; 17; 22; 24; 28; 31; 32; 39; 40; 44; 45; 51; 53; 56; 57; 61; ], [(mk_real_int64 67L); (mk_real_int64 3L); (mk_real_int64 83L); (mk_real_int64 90L); (mk_real_int64 100L); (mk_real_int64 2L); (mk_real_int64 101L); (mk_real_int64 2L); (mk_real_int64 101L); (mk_real_int64 90L); (mk_real_int64 40L); (mk_real_int64 59L); (mk_real_int64 12L); (mk_real_int64 172L); (mk_real_int64 65L); (mk_real_int64 157L); (mk_real_int64 133L); (mk_real_int64 38L); (mk_real_int64 21L); (mk_real_int64 49L); (mk_real_int64 58L); (mk_real_int64 33L); ]); +("y5_def_neg", [5; 8; 14; 15; 20; 21; 25; 27; 29; 30; 35; 43; 46; 47; 52; 54; 55; 58; 59; ], [(mk_real_int64 3L); (mk_real_int64 96L); (mk_real_int64 70L); (mk_real_int64 92L); (mk_real_int64 42L); (mk_real_int64 54L); (mk_real_int64 12L); (mk_real_int64 66L); (mk_real_int64 99L); (mk_real_int64 12L); (mk_real_int64 49L); (mk_real_int64 217L); (mk_real_int64 67L); (mk_real_int64 43L); (mk_real_int64 41L); (mk_real_int64 1L); (mk_real_int64 18L); (mk_real_int64 17L); (mk_real_int64 17L); ]); +("y6_def", [0; 2; 4; 6; 10; 11; 12; 13; 16; 17; 22; 23; 24; 28; 31; 32; 39; 40; 44; 45; 47; 50; 51; 53; 56; 57; 60; 61; ], [(mk_real_int64 67L); (mk_real_int64 3L); (mk_real_int64 115L); (mk_real_int64 90L); (mk_real_int64 100L); (mk_real_int64 183L); (mk_real_int64 2L); (mk_real_int64 60L); (mk_real_int64 160L); (mk_real_int64 187L); (mk_real_int64 266L); (mk_real_int64 33L); (mk_real_int64 90L); (mk_real_int64 40L); (mk_real_int64 59L); (mk_real_int64 12L); (mk_real_int64 172L); (mk_real_int64 65L); (mk_real_int64 201L); (mk_real_int64 133L); (mk_real_int64 230L); (mk_real_int64 46L); (mk_real_int64 119L); (mk_real_int64 21L); (mk_real_int64 49L); (mk_real_int64 165L); (mk_real_int64 137L); (mk_real_int64 95L); ]); +("y6_def_neg", [5; 8; 14; 15; 20; 21; 25; 27; 29; 30; 35; 43; 46; 52; 54; 55; 58; 59; ], [(mk_real_int64 3L); (mk_real_int64 96L); (mk_real_int64 70L); (mk_real_int64 92L); (mk_real_int64 42L); (mk_real_int64 54L); (mk_real_int64 12L); (mk_real_int64 66L); (mk_real_int64 99L); (mk_real_int64 12L); (mk_real_int64 49L); (mk_real_int64 217L); (mk_real_int64 67L); (mk_real_int64 41L); (mk_real_int64 1L); (mk_real_int64 18L); (mk_real_int64 17L); (mk_real_int64 17L); ]); +("RHA", [7; 9; 13; 15; 19; 21; 25; 26; 27; 28; 29; 30; 31; 41; 42; 43; 47; 50; 52; 54; ], [(mk_real_int64 103L); (mk_real_int64 103L); (mk_real_int64 103L); (mk_real_int64 55L); (mk_real_int64 55L); (mk_real_int64 55L); (mk_real_int64 232L); (mk_real_int64 177L); (mk_real_int64 211L); (mk_real_int64 149L); (mk_real_int64 119L); (mk_real_int64 221L); (mk_real_int64 38L); (mk_real_int64 428L); (mk_real_int64 428L); (mk_real_int64 361L); (mk_real_int64 48L); (mk_real_int64 48L); (mk_real_int64 86L); (mk_real_int64 38L); ]); +("yy10", [15; 21; 36; ], [(mk_real_int64 49L); (mk_real_int64 116L); (mk_real_int64 234L); ]); +("ineq105", [0; 2; 4; 5; ], [(mk_real_int64 166L); (mk_real_int64 6L); (mk_real_int64 147L); (mk_real_int64 30L); ]); +("ineq106", [2; 6; 12; 18; 23; 24; 35; 36; 38; ], [(mk_real_int64 103L); (mk_real_int64 103L); (mk_real_int64 55L); (mk_real_int64 55L); (mk_real_int64 107L); (mk_real_int64 110L); (mk_real_int64 19L); (mk_real_int64 48L); (mk_real_int64 48L); ]); +("ineq107", [1; 4; 10; 16; 21; 26; 27; 47; 50; 51; ], [(mk_real_int64 18L); (mk_real_int64 275L); (mk_real_int64 463L); (mk_real_int64 276L); (mk_real_int64 82L); (mk_real_int64 80L); (mk_real_int64 135L); (mk_real_int64 120L); (mk_real_int64 115L); (mk_real_int64 115L); ]); +("ineq108", [0; 2; 6; 8; 12; 13; 18; 20; 31; 32; 36; 37; 43; 45; 48; 49; 53; ], [(mk_real_int64 229L); (mk_real_int64 154L); (mk_real_int64 172L); (mk_real_int64 6L); (mk_real_int64 221L); (mk_real_int64 6L); (mk_real_int64 221L); (mk_real_int64 247L); (mk_real_int64 472L); (mk_real_int64 179L); (mk_real_int64 384L); (mk_real_int64 451L); (mk_real_int64 105L); (mk_real_int64 58L); (mk_real_int64 189L); (mk_real_int64 160L); (mk_real_int64 90L); ]); +("ineq110", [2; 4; 11; 17; 23; 25; 27; 35; 37; 39; 44; 46; ], [(mk_real_int64 18L); (mk_real_int64 275L); (mk_real_int64 470L); (mk_real_int64 276L); (mk_real_int64 535L); (mk_real_int64 474L); (mk_real_int64 147L); (mk_real_int64 971L); (mk_real_int64 160L); (mk_real_int64 221L); (mk_real_int64 207L); (mk_real_int64 5L); ]); +("ineq111", [25; 35; 38; 48; ], [(mk_real_int64 53L); (mk_real_int64 268L); (mk_real_int64 676L); (mk_real_int64 158L); ]); +("ineq112", [27; ], [(mk_real_int64 23L); ]); +("ineq113", [39; 43; ], [(mk_real_int64 55L); (mk_real_int64 352L); ]); +("ineq114", [0; 5; 6; 9; 11; 12; 15; 20; 22; 25; 28; 29; 31; 32; 34; 40; 44; 45; 46; 48; 53; ], [(mk_real_int64 621L); (mk_real_int64 621L); (mk_real_int64 621L); (mk_real_int64 309L); (mk_real_int64 312L); (mk_real_int64 621L); (mk_real_int64 621L); (mk_real_int64 621L); (mk_real_int64 444L); (mk_real_int64 450L); (mk_real_int64 40L); (mk_real_int64 661L); (mk_real_int64 141L); (mk_real_int64 583L); (mk_real_int64 28L); (mk_real_int64 621L); (mk_real_int64 324L); (mk_real_int64 153L); (mk_real_int64 571L); (mk_real_int64 566L); (mk_real_int64 724L); ]); +("ineq119", [7; ], [(mk_real_int64 253L); ]); +("ineq120", [0; 4; 5; ], [(mk_real_int64 621L); (mk_real_int64 284L); (mk_real_int64 187L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 1800L); (mk_real_int64 1800L); (mk_real_int64 1800L); (mk_real_int64 76800L); (mk_real_int64 2100L); (mk_real_int64 2100L); (mk_real_int64 1600L); (mk_real_int64 1600L); (mk_real_int64 1925L); (mk_real_int64 2100L); (mk_real_int64 2100L); (mk_real_int64 2100L); (mk_real_int64 2100L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [0; 14; 15; 28; 29; 30; 31; 34; 35; 36; 45; 54; ], [(mk_real_int64 718L); (mk_real_int64 1000L); (mk_real_int64 312L); (mk_real_int64 1000L); (mk_real_int64 700L); (mk_real_int64 1000L); (mk_real_int64 272L); (mk_real_int64 391L); (mk_real_int64 339L); (mk_real_int64 40L); (mk_real_int64 1000L); (mk_real_int64 446L); ]); +("azim_lo", [4; 9; 10; 13; 16; 19; 24; 26; 32; 37; 39; 40; 41; 42; 47; 48; 50; 51; 52; 53; 56; 61; ], [(mk_real_int64 254L); (mk_real_int64 254L); (mk_real_int64 254L); (mk_real_int64 566L); (mk_real_int64 254L); (mk_real_int64 254L); (mk_real_int64 254L); (mk_real_int64 56L); (mk_real_int64 254L); (mk_real_int64 214L); (mk_real_int64 734L); (mk_real_int64 42L); (mk_real_int64 1000L); (mk_real_int64 472L); (mk_real_int64 1245L); (mk_real_int64 254L); (mk_real_int64 1000L); (mk_real_int64 168L); (mk_real_int64 176L); (mk_real_int64 1222L); (mk_real_int64 684L); (mk_real_int64 776L); ]); +("rhazim_lo", [28; 30; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_lo", [0; 1; 2; 3; 6; 7; 8; ], [(mk_real_int64 1636L); (mk_real_int64 1636L); (mk_real_int64 1636L); (mk_real_int64 1636L); (mk_real_int64 16L); (mk_real_int64 16L); (mk_real_int64 592L); ]); +("rho_hi", [4; 5; 9; 10; 11; 12; ], [(mk_real_int64 1616L); (mk_real_int64 1616L); (mk_real_int64 1616L); (mk_real_int64 1616L); (mk_real_int64 1616L); (mk_real_int64 1616L); ]); +("tau_hi", [9; ], [(mk_real_int64 1000L); ]); +("y1_lo", [0; 6; 10; 12; 14; 15; 17; 21; 24; 31; 35; 40; 44; 45; 46; 47; 52; 54; 57; 61; ], [(mk_real_int64 290L); (mk_real_int64 150L); (mk_real_int64 220L); (mk_real_int64 410L); (mk_real_int64 500L); (mk_real_int64 400L); (mk_real_int64 410L); (mk_real_int64 120L); (mk_real_int64 45L); (mk_real_int64 305L); (mk_real_int64 640L); (mk_real_int64 65L); (mk_real_int64 40L); (mk_real_int64 185L); (mk_real_int64 480L); (mk_real_int64 20L); (mk_real_int64 340L); (mk_real_int64 100L); (mk_real_int64 600L); (mk_real_int64 150L); ]); +("y1_hi", [2; 4; 16; 22; 27; 29; 32; 39; 43; 51; 53; 56; 58; 59; ], [(mk_real_int64 110L); (mk_real_int64 185L); (mk_real_int64 65L); (mk_real_int64 65L); (mk_real_int64 100L); (mk_real_int64 580L); (mk_real_int64 550L); (mk_real_int64 80L); (mk_real_int64 340L); (mk_real_int64 325L); (mk_real_int64 370L); (mk_real_int64 145L); (mk_real_int64 500L); (mk_real_int64 500L); ]); +("y2_lo", [0; 2; 8; 14; 15; 16; 21; 22; 24; 25; 30; 39; 43; 45; 46; 47; 52; 54; 55; 58; 59; 61; ], [(mk_real_int64 268L); (mk_real_int64 588L); (mk_real_int64 300L); (mk_real_int64 376L); (mk_real_int64 400L); (mk_real_int64 536L); (mk_real_int64 120L); (mk_real_int64 536L); (mk_real_int64 92L); (mk_real_int64 464L); (mk_real_int64 160L); (mk_real_int64 192L); (mk_real_int64 344L); (mk_real_int64 36L); (mk_real_int64 208L); (mk_real_int64 20L); (mk_real_int64 340L); (mk_real_int64 100L); (mk_real_int64 240L); (mk_real_int64 480L); (mk_real_int64 480L); (mk_real_int64 240L); ]); +("y2_hi", [4; 5; 6; 10; 12; 17; 20; 27; 28; 29; 31; 32; 35; 40; 44; 51; 53; 56; 57; ], [(mk_real_int64 356L); (mk_real_int64 264L); (mk_real_int64 388L); (mk_real_int64 100L); (mk_real_int64 184L); (mk_real_int64 184L); (mk_real_int64 48L); (mk_real_int64 248L); (mk_real_int64 40L); (mk_real_int64 580L); (mk_real_int64 94L); (mk_real_int64 60L); (mk_real_int64 340L); (mk_real_int64 156L); (mk_real_int64 248L); (mk_real_int64 220L); (mk_real_int64 112L); (mk_real_int64 356L); (mk_real_int64 240L); ]); +("y3_lo", [0; 2; 8; 14; 15; 16; 21; 22; 24; 25; 30; 39; 43; 45; 46; 47; 52; 54; 55; 58; 59; 61; ], [(mk_real_int64 268L); (mk_real_int64 588L); (mk_real_int64 300L); (mk_real_int64 376L); (mk_real_int64 400L); (mk_real_int64 536L); (mk_real_int64 120L); (mk_real_int64 536L); (mk_real_int64 92L); (mk_real_int64 464L); (mk_real_int64 160L); (mk_real_int64 192L); (mk_real_int64 344L); (mk_real_int64 36L); (mk_real_int64 208L); (mk_real_int64 20L); (mk_real_int64 340L); (mk_real_int64 100L); (mk_real_int64 240L); (mk_real_int64 480L); (mk_real_int64 480L); (mk_real_int64 240L); ]); +("y3_hi", [4; 5; 6; 10; 12; 17; 20; 27; 28; 29; 31; 32; 35; 40; 44; 51; 53; 56; 57; ], [(mk_real_int64 356L); (mk_real_int64 264L); (mk_real_int64 388L); (mk_real_int64 100L); (mk_real_int64 184L); (mk_real_int64 184L); (mk_real_int64 48L); (mk_real_int64 248L); (mk_real_int64 40L); (mk_real_int64 580L); (mk_real_int64 94L); (mk_real_int64 60L); (mk_real_int64 340L); (mk_real_int64 156L); (mk_real_int64 248L); (mk_real_int64 220L); (mk_real_int64 112L); (mk_real_int64 356L); (mk_real_int64 240L); ]); +("y4_hi", [0; 4; 21; 24; 31; 32; 35; 36; 43; 44; 45; 46; 53; ], [(mk_real_int64 135L); (mk_real_int64 675L); (mk_real_int64 386L); (mk_real_int64 650L); (mk_real_int64 680L); (mk_real_int64 385L); (mk_real_int64 169L); (mk_real_int64 80L); (mk_real_int64 75L); (mk_real_int64 428L); (mk_real_int64 270L); (mk_real_int64 20L); (mk_real_int64 350L); ]); +("y4_lo", [1; 2; 6; 8; 10; 11; 12; 13; 16; 17; 18; 20; 23; 25; 26; 27; 37; 38; 39; 47; 48; 49; 50; 51; ], [(mk_real_int64 86L); (mk_real_int64 573L); (mk_real_int64 375L); (mk_real_int64 110L); (mk_real_int64 101L); (mk_real_int64 120L); (mk_real_int64 60L); (mk_real_int64 110L); (mk_real_int64 652L); (mk_real_int64 96L); (mk_real_int64 60L); (mk_real_int64 195L); (mk_real_int64 155L); (mk_real_int64 529L); (mk_real_int64 160L); (mk_real_int64 457L); (mk_real_int64 295L); (mk_real_int64 380L); (mk_real_int64 316L); (mk_real_int64 240L); (mk_real_int64 215L); (mk_real_int64 600L); (mk_real_int64 105L); (mk_real_int64 105L); ]); +("y5_lo", [0; 2; 14; 15; 16; 21; 22; 24; 25; 29; 30; 35; 39; 45; 46; 47; 55; 58; 59; 61; ], [(mk_real_int64 268L); (mk_real_int64 588L); (mk_real_int64 376L); (mk_real_int64 120L); (mk_real_int64 536L); (mk_real_int64 96L); (mk_real_int64 536L); (mk_real_int64 92L); (mk_real_int64 464L); (mk_real_int64 529L); (mk_real_int64 160L); (mk_real_int64 332L); (mk_real_int64 192L); (mk_real_int64 196L); (mk_real_int64 28L); (mk_real_int64 316L); (mk_real_int64 240L); (mk_real_int64 480L); (mk_real_int64 480L); (mk_real_int64 240L); ]); +("y5_hi", [4; 5; 6; 8; 10; 12; 17; 20; 27; 28; 31; 32; 40; 43; 44; 51; 52; 53; 54; 56; 57; ], [(mk_real_int64 356L); (mk_real_int64 264L); (mk_real_int64 20L); (mk_real_int64 300L); (mk_real_int64 100L); (mk_real_int64 184L); (mk_real_int64 184L); (mk_real_int64 48L); (mk_real_int64 88L); (mk_real_int64 40L); (mk_real_int64 94L); (mk_real_int64 60L); (mk_real_int64 156L); (mk_real_int64 100L); (mk_real_int64 248L); (mk_real_int64 220L); (mk_real_int64 428L); (mk_real_int64 112L); (mk_real_int64 20L); (mk_real_int64 46L); (mk_real_int64 240L); ]); +("y6_lo", [0; 2; 4; 11; 13; 14; 15; 16; 17; 21; 22; 23; 24; 25; 29; 30; 35; 39; 44; 45; 46; 47; 50; 51; 55; 57; 58; 59; 60; 61; ], [(mk_real_int64 268L); (mk_real_int64 588L); (mk_real_int64 32000L); (mk_real_int64 183000L); (mk_real_int64 60000L); (mk_real_int64 376L); (mk_real_int64 120L); (mk_real_int64 60000L); (mk_real_int64 184816L); (mk_real_int64 96L); (mk_real_int64 165536L); (mk_real_int64 33000L); (mk_real_int64 92L); (mk_real_int64 464L); (mk_real_int64 529L); (mk_real_int64 160L); (mk_real_int64 332L); (mk_real_int64 192L); (mk_real_int64 44000L); (mk_real_int64 196L); (mk_real_int64 28L); (mk_real_int64 273316L); (mk_real_int64 46000L); (mk_real_int64 81000L); (mk_real_int64 240L); (mk_real_int64 107000L); (mk_real_int64 480L); (mk_real_int64 480L); (mk_real_int64 137000L); (mk_real_int64 62240L); ]); +("y6_hi", [4; 5; 6; 8; 10; 12; 16; 20; 27; 28; 31; 32; 40; 43; 44; 51; 52; 53; 54; 56; 57; ], [(mk_real_int64 356L); (mk_real_int64 264L); (mk_real_int64 20L); (mk_real_int64 300L); (mk_real_int64 100L); (mk_real_int64 184L); (mk_real_int64 464L); (mk_real_int64 48L); (mk_real_int64 88L); (mk_real_int64 40L); (mk_real_int64 94L); (mk_real_int64 60L); (mk_real_int64 156L); (mk_real_int64 100L); (mk_real_int64 248L); (mk_real_int64 220L); (mk_real_int64 428L); (mk_real_int64 112L); (mk_real_int64 20L); (mk_real_int64 46L); (mk_real_int64 240L); ]); +("ye_hi", [14; 17; 18; 21; 22; 23; 25; 27; 57; 58; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_lo", [5; 16; 32; 33; 46; 51; ], [(mk_real_int64 166000L); (mk_real_int64 1000L); (mk_real_int64 37000L); (mk_real_int64 79000L); (mk_real_int64 54000L); (mk_real_int64 1000L); ]); +("yn_hi", [0; 1; 2; 3; 5; 9; 11; 12; ], [(mk_real_int64 255L); (mk_real_int64 2255L); (mk_real_int64 1255L); (mk_real_int64 480L); (mk_real_int64 554L); (mk_real_int64 554L); (mk_real_int64 554L); (mk_real_int64 1554L); ]); +("yn_lo", [4; 6; 7; 8; 10; ], [(mk_real_int64 2446L); (mk_real_int64 365L); (mk_real_int64 1365L); (mk_real_int64 680L); (mk_real_int64 1446L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/122526068934_out.hl b/formal_lp/old/ineqs/tests2/122526068934_out.hl new file mode 100644 index 0000000..a3137d8 --- /dev/null +++ b/formal_lp/old/ineqs/tests2/122526068934_out.hl @@ -0,0 +1,90 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "122526068934 19 4 0 1 2 3 3 0 3 4 3 4 3 5 3 5 3 2 4 5 2 6 7 3 6 2 8 3 8 2 1 3 8 1 9 3 9 1 0 4 9 0 10 11 3 10 0 4 3 10 4 7 3 4 5 7 3 7 6 11 3 11 6 12 3 11 10 7 3 12 6 8 3 12 8 9 3 9 11 12 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [1; 3; 7; 9; 11; ], [(mk_real_int64 222L); (mk_real_int64 386L); (mk_real_int64 257L); (mk_real_int64 65L); (mk_real_int64 5L); ]); +("azim_sum_neg", [0; 4; 5; 6; 12; ], [(mk_real_int64 73L); (mk_real_int64 152L); (mk_real_int64 184L); (mk_real_int64 118L); (mk_real_int64 140L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 903L); (mk_real_int64 1038L); (mk_real_int64 872L); (mk_real_int64 929L); (mk_real_int64 982L); (mk_real_int64 1038L); (mk_real_int64 929L); (mk_real_int64 1038L); (mk_real_int64 1038L); (mk_real_int64 841L); (mk_real_int64 929L); (mk_real_int64 929L); (mk_real_int64 674L); ]); +("sol_sum3_neg", [0; 3; 4; 5; 6; 10; 15; ], [(mk_real_int64 56L); (mk_real_int64 162L); (mk_real_int64 30L); (mk_real_int64 198L); (mk_real_int64 5L); (mk_real_int64 109L); (mk_real_int64 28L); ]); +("sol_sum3", [1; 7; 8; 9; ], [(mk_real_int64 138L); (mk_real_int64 25L); (mk_real_int64 98L); (mk_real_int64 12L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; ], [(mk_real_int64 774L); (mk_real_int64 903L); (mk_real_int64 830L); (mk_real_int64 841L); (mk_real_int64 841L); (mk_real_int64 709L); (mk_real_int64 867L); (mk_real_int64 855L); (mk_real_int64 929L); (mk_real_int64 843L); (mk_real_int64 929L); (mk_real_int64 674L); (mk_real_int64 929L); (mk_real_int64 674L); (mk_real_int64 674L); (mk_real_int64 674L); ]); +("tau_sum4_neg", [0; 1; 2; ], [(mk_real_int64 872L); (mk_real_int64 1038L); (mk_real_int64 929L); ]); +("ln_def_neg", [1; 3; 4; 5; 6; 7; 8; 10; 11; ], [(mk_real_int64 144L); (mk_real_int64 24L); (mk_real_int64 83L); (mk_real_int64 144L); (mk_real_int64 24L); (mk_real_int64 144L); (mk_real_int64 144L); (mk_real_int64 24L); (mk_real_int64 24L); ]); +("ln_def", [0; 2; 9; 12; ], [(mk_real_int64 4L); (mk_real_int64 39L); (mk_real_int64 72L); (mk_real_int64 256L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 5673L); (mk_real_int64 6520L); (mk_real_int64 5477L); (mk_real_int64 5835L); (mk_real_int64 6171L); (mk_real_int64 6520L); (mk_real_int64 5835L); (mk_real_int64 6520L); (mk_real_int64 6520L); (mk_real_int64 5286L); (mk_real_int64 5835L); (mk_real_int64 5835L); (mk_real_int64 4237L); ]); +("edge_sym", [0; 1; 2; 3; 37; 38; 46; 47; 56; ], [(mk_real_int64 60L); (mk_real_int64 37L); (mk_real_int64 37L); (mk_real_int64 11L); (mk_real_int64 25L); (mk_real_int64 6L); (mk_real_int64 11L); (mk_real_int64 56L); (mk_real_int64 2L); ]); +("edge_sym_neg", [5; 6; 19; 22; 25; 32; 43; 44; 53; ], [(mk_real_int64 11L); (mk_real_int64 11L); (mk_real_int64 206L); (mk_real_int64 134L); (mk_real_int64 131L); (mk_real_int64 137L); (mk_real_int64 181L); (mk_real_int64 49L); (mk_real_int64 240L); ]); +("y1_def_neg", [0; 2; 7; 9; 10; 12; 18; 20; 21; 24; 26; 34; 35; 38; 40; 41; 42; 43; 45; 46; 50; 52; 53; 56; 57; ], [(mk_real_int64 47L); (mk_real_int64 29L); (mk_real_int64 125L); (mk_real_int64 79L); (mk_real_int64 21L); (mk_real_int64 18L); (mk_real_int64 175L); (mk_real_int64 73L); (mk_real_int64 77L); (mk_real_int64 85L); (mk_real_int64 63L); (mk_real_int64 9L); (mk_real_int64 4L); (mk_real_int64 54L); (mk_real_int64 32L); (mk_real_int64 2L); (mk_real_int64 69L); (mk_real_int64 95L); (mk_real_int64 23L); (mk_real_int64 97L); (mk_real_int64 60L); (mk_real_int64 181L); (mk_real_int64 111L); (mk_real_int64 39L); (mk_real_int64 22L); ]); +("y1_def", [6; 17; 25; 28; 33; 36; 44; 47; 49; 51; 54; 58; 59; ], [(mk_real_int64 21L); (mk_real_int64 61L); (mk_real_int64 75L); (mk_real_int64 2L); (mk_real_int64 6L); (mk_real_int64 10L); (mk_real_int64 68L); (mk_real_int64 70L); (mk_real_int64 59L); (mk_real_int64 70L); (mk_real_int64 70L); (mk_real_int64 11L); (mk_real_int64 84L); ]); +("y2_def", [0; 2; 6; 9; 10; 17; 18; 21; 24; 25; 28; 42; 44; 45; 46; 52; 56; 57; 58; ], [(mk_real_int64 60L); (mk_real_int64 37L); (mk_real_int64 21L); (mk_real_int64 21L); (mk_real_int64 13L); (mk_real_int64 61L); (mk_real_int64 14L); (mk_real_int64 47L); (mk_real_int64 36L); (mk_real_int64 75L); (mk_real_int64 2L); (mk_real_int64 46L); (mk_real_int64 33L); (mk_real_int64 14L); (mk_real_int64 59L); (mk_real_int64 110L); (mk_real_int64 23L); (mk_real_int64 13L); (mk_real_int64 11L); ]); +("y2_def_neg", [7; 12; 20; 26; 33; 34; 35; 36; 38; 40; 41; 43; 47; 49; 50; 51; 53; 54; 59; ], [(mk_real_int64 125L); (mk_real_int64 18L); (mk_real_int64 53L); (mk_real_int64 8L); (mk_real_int64 2L); (mk_real_int64 9L); (mk_real_int64 4L); (mk_real_int64 3L); (mk_real_int64 48L); (mk_real_int64 9L); (mk_real_int64 2L); (mk_real_int64 95L); (mk_real_int64 21L); (mk_real_int64 18L); (mk_real_int64 60L); (mk_real_int64 21L); (mk_real_int64 30L); (mk_real_int64 21L); (mk_real_int64 26L); ]); +("y3_def", [0; 2; 6; 9; 10; 17; 18; 21; 24; 25; 28; 42; 44; 45; 46; 52; 56; 57; 58; ], [(mk_real_int64 60L); (mk_real_int64 37L); (mk_real_int64 21L); (mk_real_int64 21L); (mk_real_int64 13L); (mk_real_int64 61L); (mk_real_int64 14L); (mk_real_int64 47L); (mk_real_int64 36L); (mk_real_int64 75L); (mk_real_int64 2L); (mk_real_int64 46L); (mk_real_int64 33L); (mk_real_int64 14L); (mk_real_int64 59L); (mk_real_int64 110L); (mk_real_int64 23L); (mk_real_int64 13L); (mk_real_int64 11L); ]); +("y3_def_neg", [7; 12; 20; 26; 33; 34; 35; 36; 38; 40; 41; 43; 47; 49; 50; 51; 53; 54; 59; ], [(mk_real_int64 125L); (mk_real_int64 18L); (mk_real_int64 53L); (mk_real_int64 8L); (mk_real_int64 2L); (mk_real_int64 9L); (mk_real_int64 4L); (mk_real_int64 3L); (mk_real_int64 48L); (mk_real_int64 9L); (mk_real_int64 2L); (mk_real_int64 95L); (mk_real_int64 21L); (mk_real_int64 18L); (mk_real_int64 60L); (mk_real_int64 21L); (mk_real_int64 30L); (mk_real_int64 21L); (mk_real_int64 26L); ]); +("y4_def_neg", [2; 3; 5; 6; 8; 9; 10; 12; 13; 16; 17; 18; 20; 22; 28; 30; 31; 33; 34; 38; 40; 41; 44; 45; 46; ], [(mk_real_int64 11L); (mk_real_int64 87L); (mk_real_int64 12L); (mk_real_int64 24L); (mk_real_int64 13L); (mk_real_int64 32L); (mk_real_int64 174L); (mk_real_int64 83L); (mk_real_int64 88L); (mk_real_int64 93L); (mk_real_int64 39L); (mk_real_int64 59L); (mk_real_int64 1L); (mk_real_int64 6L); (mk_real_int64 29L); (mk_real_int64 86L); (mk_real_int64 66L); (mk_real_int64 26L); (mk_real_int64 111L); (mk_real_int64 42L); (mk_real_int64 207L); (mk_real_int64 100L); (mk_real_int64 44L); (mk_real_int64 25L); (mk_real_int64 5L); ]); +("y4_def", [21; 23; 24; 26; 29; 32; 35; 37; 39; 42; 47; ], [(mk_real_int64 9L); (mk_real_int64 8L); (mk_real_int64 15L); (mk_real_int64 3L); (mk_real_int64 4L); (mk_real_int64 20L); (mk_real_int64 108L); (mk_real_int64 91L); (mk_real_int64 108L); (mk_real_int64 108L); (mk_real_int64 130L); ]); +("y5_def", [0; 2; 9; 10; 18; 21; 24; 26; 35; 38; 41; 42; 45; 46; 52; 56; 57; ], [(mk_real_int64 11L); (mk_real_int64 37L); (mk_real_int64 87L); (mk_real_int64 13L); (mk_real_int64 32L); (mk_real_int64 47L); (mk_real_int64 39L); (mk_real_int64 1L); (mk_real_int64 8L); (mk_real_int64 9L); (mk_real_int64 4L); (mk_real_int64 46L); (mk_real_int64 14L); (mk_real_int64 59L); (mk_real_int64 110L); (mk_real_int64 23L); (mk_real_int64 13L); ]); +("y5_def_neg", [6; 7; 12; 17; 20; 25; 28; 33; 34; 36; 40; 43; 44; 47; 49; 50; 51; 53; 54; 58; 59; ], [(mk_real_int64 11L); (mk_real_int64 87L); (mk_real_int64 13L); (mk_real_int64 32L); (mk_real_int64 47L); (mk_real_int64 39L); (mk_real_int64 1L); (mk_real_int64 2L); (mk_real_int64 6L); (mk_real_int64 3L); (mk_real_int64 4L); (mk_real_int64 66L); (mk_real_int64 29L); (mk_real_int64 21L); (mk_real_int64 18L); (mk_real_int64 42L); (mk_real_int64 21L); (mk_real_int64 12L); (mk_real_int64 21L); (mk_real_int64 5L); (mk_real_int64 26L); ]); +("y6_def", [0; 2; 7; 9; 10; 18; 21; 23; 24; 26; 35; 38; 41; 42; 45; 46; 48; 49; 52; 54; 56; 57; ], [(mk_real_int64 60L); (mk_real_int64 37L); (mk_real_int64 23L); (mk_real_int64 87L); (mk_real_int64 13L); (mk_real_int64 32L); (mk_real_int64 47L); (mk_real_int64 134L); (mk_real_int64 39L); (mk_real_int64 1L); (mk_real_int64 8L); (mk_real_int64 9L); (mk_real_int64 4L); (mk_real_int64 46L); (mk_real_int64 14L); (mk_real_int64 59L); (mk_real_int64 60L); (mk_real_int64 35L); (mk_real_int64 110L); (mk_real_int64 284L); (mk_real_int64 23L); (mk_real_int64 13L); ]); +("y6_def_neg", [6; 12; 17; 20; 25; 28; 33; 34; 36; 40; 43; 44; 47; 50; 51; 53; 58; 59; ], [(mk_real_int64 11L); (mk_real_int64 13L); (mk_real_int64 32L); (mk_real_int64 47L); (mk_real_int64 39L); (mk_real_int64 1L); (mk_real_int64 2L); (mk_real_int64 6L); (mk_real_int64 3L); (mk_real_int64 4L); (mk_real_int64 66L); (mk_real_int64 29L); (mk_real_int64 21L); (mk_real_int64 42L); (mk_real_int64 21L); (mk_real_int64 12L); (mk_real_int64 5L); (mk_real_int64 10L); ]); +("y8_def_neg", [1; ], [(mk_real_int64 49L); ]); +("RHA", [0; 2; 3; 4; 5; 6; 7; 10; 11; 12; 17; 21; 22; 23; 24; 25; 26; 27; 28; 33; 34; 35; 37; 38; 39; 40; 41; 43; 45; 46; 50; 52; 53; 55; 56; 57; 58; ], [(mk_real_int64 57L); (mk_real_int64 166L); (mk_real_int64 31L); (mk_real_int64 154L); (mk_real_int64 129L); (mk_real_int64 208L); (mk_real_int64 79L); (mk_real_int64 172L); (mk_real_int64 73L); (mk_real_int64 207L); (mk_real_int64 196L); (mk_real_int64 68L); (mk_real_int64 30L); (mk_real_int64 133L); (mk_real_int64 38L); (mk_real_int64 220L); (mk_real_int64 5L); (mk_real_int64 5L); (mk_real_int64 62L); (mk_real_int64 73L); (mk_real_int64 73L); (mk_real_int64 127L); (mk_real_int64 53L); (mk_real_int64 103L); (mk_real_int64 139L); (mk_real_int64 171L); (mk_real_int64 195L); (mk_real_int64 109L); (mk_real_int64 216L); (mk_real_int64 201L); (mk_real_int64 109L); (mk_real_int64 62L); (mk_real_int64 83L); (mk_real_int64 167L); (mk_real_int64 190L); (mk_real_int64 218L); (mk_real_int64 254L); ]); +("yy10", [32; ], [(mk_real_int64 137L); ]); +("tau4", [2; ], [(mk_real_int64 150L); ]); +("ineq105", [0; 2; ], [(mk_real_int64 149L); (mk_real_int64 91L); ]); +("ineq106", [5; 6; 10; 13; 16; 18; 26; 28; 30; 33; 34; 40; 41; 44; 45; ], [(mk_real_int64 135L); (mk_real_int64 35L); (mk_real_int64 196L); (mk_real_int64 128L); (mk_real_int64 125L); (mk_real_int64 57L); (mk_real_int64 6L); (mk_real_int64 24L); (mk_real_int64 109L); (mk_real_int64 39L); (mk_real_int64 162L); (mk_real_int64 302L); (mk_real_int64 84L); (mk_real_int64 64L); (mk_real_int64 36L); ]); +("ineq107", [5; 21; 24; 32; 35; 37; 39; 42; 47; ], [(mk_real_int64 46L); (mk_real_int64 12L); (mk_real_int64 20L); (mk_real_int64 54L); (mk_real_int64 140L); (mk_real_int64 118L); (mk_real_int64 140L); (mk_real_int64 140L); (mk_real_int64 168L); ]); +("ineq108", [12; 30; ], [(mk_real_int64 35L); (mk_real_int64 17L); ]); +("ineq109", [5; 23; 26; 29; ], [(mk_real_int64 138L); (mk_real_int64 25L); (mk_real_int64 98L); (mk_real_int64 12L); ]); +("ineq110", [2; 9; 12; 17; 20; 32; 46; ], [(mk_real_int64 56L); (mk_real_int64 162L); (mk_real_int64 30L); (mk_real_int64 198L); (mk_real_int64 5L); (mk_real_int64 109L); (mk_real_int64 28L); ]); +("ineq111", [3; 8; 10; 12; 16; 18; 22; 26; 28; 31; 38; 41; ], [(mk_real_int64 694L); (mk_real_int64 102L); (mk_real_int64 318L); (mk_real_int64 427L); (mk_real_int64 54L); (mk_real_int64 158L); (mk_real_int64 50L); (mk_real_int64 197L); (mk_real_int64 101L); (mk_real_int64 526L); (mk_real_int64 335L); (mk_real_int64 339L); ]); +("ineq113", [6; 11; 16; 21; 32; ], [(mk_real_int64 44L); (mk_real_int64 373L); (mk_real_int64 619L); (mk_real_int64 31L); (mk_real_int64 193L); ]); +("ineq114", [0; 3; 4; 8; 9; 10; 13; 17; 20; 22; 26; 29; 30; 33; 34; 36; 38; 40; 41; 43; 44; 45; 46; ], [(mk_real_int64 774L); (mk_real_int64 105L); (mk_real_int64 105L); (mk_real_int64 685L); (mk_real_int64 55L); (mk_real_int64 95L); (mk_real_int64 415L); (mk_real_int64 35L); (mk_real_int64 708L); (mk_real_int64 774L); (mk_real_int64 732L); (mk_real_int64 742L); (mk_real_int64 210L); (mk_real_int64 353L); (mk_real_int64 321L); (mk_real_int64 9L); (mk_real_int64 585L); (mk_real_int64 99L); (mk_real_int64 237L); (mk_real_int64 371L); (mk_real_int64 303L); (mk_real_int64 304L); (mk_real_int64 370L); ]); +("ineq119", [3; 4; 10; ], [(mk_real_int64 91L); (mk_real_int64 405L); (mk_real_int64 261L); ]); +("ineq120", [0; 2; 5; 7; 9; 11; ], [(mk_real_int64 389L); (mk_real_int64 391L); (mk_real_int64 293L); (mk_real_int64 340L); (mk_real_int64 510L); (mk_real_int64 7L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 3225L); (mk_real_int64 3000L); (mk_real_int64 2525L); (mk_real_int64 2875L); (mk_real_int64 3075L); (mk_real_int64 3000L); (mk_real_int64 2875L); (mk_real_int64 3000L); (mk_real_int64 3000L); (mk_real_int64 2950L); (mk_real_int64 2875L); (mk_real_int64 2875L); (mk_real_int64 2525L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [0; 3; 4; 7; 8; 10; 13; 14; 16; 17; 19; 28; 30; 32; 34; 37; 38; 39; 40; 41; 42; 44; 48; 50; 53; 55; 57; 58; ], [(mk_real_int64 862L); (mk_real_int64 777L); (mk_real_int64 524L); (mk_real_int64 730L); (mk_real_int64 730L); (mk_real_int64 604L); (mk_real_int64 535L); (mk_real_int64 94L); (mk_real_int64 720L); (mk_real_int64 430L); (mk_real_int64 393L); (mk_real_int64 208L); (mk_real_int64 580L); (mk_real_int64 306L); (mk_real_int64 524L); (mk_real_int64 1000L); (mk_real_int64 232L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 492L); (mk_real_int64 460L); (mk_real_int64 13L); (mk_real_int64 634L); (mk_real_int64 210L); (mk_real_int64 362L); (mk_real_int64 246L); (mk_real_int64 304L); (mk_real_int64 620L); ]); +("azim_lo", [2; 12; 18; 21; 24; 25; 31; 33; 45; 46; 52; 56; ], [(mk_real_int64 622L); (mk_real_int64 190L); (mk_real_int64 530L); (mk_real_int64 210L); (mk_real_int64 321L); (mk_real_int64 90L); (mk_real_int64 233L); (mk_real_int64 29L); (mk_real_int64 22L); (mk_real_int64 54L); (mk_real_int64 26L); (mk_real_int64 322L); ]); +("rhazim_lo", [4; 10; 12; 17; 18; 21; 22; 33; 34; 46; 56; 57; 58; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_hi", [23; ], [(mk_real_int64 1000L); ]); +("rho_hi", [0; 1; 2; 3; 5; 6; 7; 8; 10; 11; ], [(mk_real_int64 1452L); (mk_real_int64 2792L); (mk_real_int64 2648L); (mk_real_int64 2836L); (mk_real_int64 2792L); (mk_real_int64 2836L); (mk_real_int64 2792L); (mk_real_int64 2792L); (mk_real_int64 2836L); (mk_real_int64 2836L); ]); +("rho_lo", [4; 9; 12; ], [(mk_real_int64 112L); (mk_real_int64 1156L); (mk_real_int64 1584L); ]); +("tau_lo", [0; 7; 8; 9; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("tau_hi", [2; 3; 6; 16; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("y1_hi", [0; 2; 6; 7; 9; 17; 18; 21; 24; 25; 26; 35; 38; 41; 43; 44; 56; 57; ], [(mk_real_int64 65L); (mk_real_int64 335L); (mk_real_int64 280L); (mk_real_int64 80L); (mk_real_int64 162L); (mk_real_int64 560L); (mk_real_int64 160L); (mk_real_int64 200L); (mk_real_int64 280L); (mk_real_int64 240L); (mk_real_int64 360L); (mk_real_int64 225L); (mk_real_int64 142L); (mk_real_int64 188L); (mk_real_int64 320L); (mk_real_int64 420L); (mk_real_int64 600L); (mk_real_int64 400L); ]); +("y1_lo", [12; 20; 28; 40; 42; 45; 46; 50; 52; 53; 58; ], [(mk_real_int64 360L); (mk_real_int64 685L); (mk_real_int64 100L); (mk_real_int64 580L); (mk_real_int64 395L); (mk_real_int64 400L); (mk_real_int64 200L); (mk_real_int64 300L); (mk_real_int64 200L); (mk_real_int64 420L); (mk_real_int64 360L); ]); +("y2_lo", [0; 2; 10; 12; 21; 24; 28; 36; 38; 40; 42; 46; 47; 50; 51; 52; 53; 54; 58; ], [(mk_real_int64 102L); (mk_real_int64 418L); (mk_real_int64 260L); (mk_real_int64 360L); (mk_real_int64 408L); (mk_real_int64 220L); (mk_real_int64 100L); (mk_real_int64 40L); (mk_real_int64 74L); (mk_real_int64 444L); (mk_real_int64 136L); (mk_real_int64 32L); (mk_real_int64 280L); (mk_real_int64 300L); (mk_real_int64 280L); (mk_real_int64 72L); (mk_real_int64 444L); (mk_real_int64 280L); (mk_real_int64 360L); ]); +("y2_hi", [6; 7; 9; 17; 18; 20; 25; 26; 33; 35; 41; 43; 44; 45; 49; 56; 57; 59; ], [(mk_real_int64 280L); (mk_real_int64 80L); (mk_real_int64 310L); (mk_real_int64 560L); (mk_real_int64 104L); (mk_real_int64 280L); (mk_real_int64 240L); (mk_real_int64 308L); (mk_real_int64 176L); (mk_real_int64 225L); (mk_real_int64 188L); (mk_real_int64 320L); (mk_real_int64 212L); (mk_real_int64 196L); (mk_real_int64 64L); (mk_real_int64 296L); (mk_real_int64 104L); (mk_real_int64 464L); ]); +("y3_lo", [0; 2; 10; 12; 21; 24; 28; 36; 38; 40; 42; 46; 47; 50; 51; 52; 53; 54; 58; ], [(mk_real_int64 102L); (mk_real_int64 418L); (mk_real_int64 260L); (mk_real_int64 360L); (mk_real_int64 408L); (mk_real_int64 220L); (mk_real_int64 100L); (mk_real_int64 40L); (mk_real_int64 74L); (mk_real_int64 444L); (mk_real_int64 136L); (mk_real_int64 32L); (mk_real_int64 280L); (mk_real_int64 300L); (mk_real_int64 280L); (mk_real_int64 72L); (mk_real_int64 444L); (mk_real_int64 280L); (mk_real_int64 360L); ]); +("y3_hi", [6; 7; 9; 17; 18; 20; 25; 26; 33; 35; 41; 43; 44; 45; 49; 56; 57; 59; ], [(mk_real_int64 280L); (mk_real_int64 80L); (mk_real_int64 310L); (mk_real_int64 560L); (mk_real_int64 104L); (mk_real_int64 280L); (mk_real_int64 240L); (mk_real_int64 308L); (mk_real_int64 176L); (mk_real_int64 225L); (mk_real_int64 188L); (mk_real_int64 320L); (mk_real_int64 212L); (mk_real_int64 196L); (mk_real_int64 64L); (mk_real_int64 296L); (mk_real_int64 104L); (mk_real_int64 464L); ]); +("y4_lo", [5; 10; 12; 22; 28; 29; 30; 33; 46; 47; ], [(mk_real_int64 205L); (mk_real_int64 10L); (mk_real_int64 230L); (mk_real_int64 250L); (mk_real_int64 65L); (mk_real_int64 112L); (mk_real_int64 310L); (mk_real_int64 715L); (mk_real_int64 488L); (mk_real_int64 136L); ]); +("y4_hi", [2; 3; 6; 8; 9; 13; 16; 17; 18; 20; 21; 23; 24; 26; 31; 32; 34; 35; 37; 38; 39; 40; 41; 42; 44; 45; ], [(mk_real_int64 24L); (mk_real_int64 250L); (mk_real_int64 25L); (mk_real_int64 250L); (mk_real_int64 248L); (mk_real_int64 320L); (mk_real_int64 625L); (mk_real_int64 192L); (mk_real_int64 205L); (mk_real_int64 20L); (mk_real_int64 276L); (mk_real_int64 100L); (mk_real_int64 460L); (mk_real_int64 17L); (mk_real_int64 250L); (mk_real_int64 378L); (mk_real_int64 30L); (mk_real_int64 220L); (mk_real_int64 214L); (mk_real_int64 125L); (mk_real_int64 220L); (mk_real_int64 130L); (mk_real_int64 85L); (mk_real_int64 220L); (mk_real_int64 160L); (mk_real_int64 340L); ]); +("y5_lo", [0; 2; 9; 10; 18; 21; 24; 26; 34; 36; 41; 42; 44; 46; 47; 51; 52; 54; 58; ], [(mk_real_int64 102L); (mk_real_int64 418L); (mk_real_int64 140L); (mk_real_int64 260L); (mk_real_int64 406L); (mk_real_int64 408L); (mk_real_int64 250L); (mk_real_int64 2L); (mk_real_int64 250L); (mk_real_int64 40L); (mk_real_int64 112L); (mk_real_int64 136L); (mk_real_int64 572L); (mk_real_int64 32L); (mk_real_int64 280L); (mk_real_int64 280L); (mk_real_int64 72L); (mk_real_int64 280L); (mk_real_int64 488L); ]); +("y5_hi", [6; 7; 12; 17; 20; 25; 28; 33; 35; 38; 40; 43; 45; 49; 50; 53; 56; 57; 59; ], [(mk_real_int64 24L); (mk_real_int64 250L); (mk_real_int64 250L); (mk_real_int64 248L); (mk_real_int64 485L); (mk_real_int64 192L); (mk_real_int64 20L); (mk_real_int64 176L); (mk_real_int64 100L); (mk_real_int64 311L); (mk_real_int64 111L); (mk_real_int64 250L); (mk_real_int64 196L); (mk_real_int64 64L); (mk_real_int64 125L); (mk_real_int64 201L); (mk_real_int64 296L); (mk_real_int64 104L); (mk_real_int64 464L); ]); +("y6_lo", [0; 2; 7; 9; 10; 18; 21; 23; 24; 26; 34; 36; 41; 42; 44; 46; 47; 48; 49; 51; 52; 54; 58; 59; ], [(mk_real_int64 102L); (mk_real_int64 418L); (mk_real_int64 110000L); (mk_real_int64 140L); (mk_real_int64 260L); (mk_real_int64 406L); (mk_real_int64 408L); (mk_real_int64 134000L); (mk_real_int64 250L); (mk_real_int64 2L); (mk_real_int64 250L); (mk_real_int64 40L); (mk_real_int64 112L); (mk_real_int64 136L); (mk_real_int64 572L); (mk_real_int64 32L); (mk_real_int64 280L); (mk_real_int64 60000L); (mk_real_int64 53000L); (mk_real_int64 280L); (mk_real_int64 72L); (mk_real_int64 305280L); (mk_real_int64 488L); (mk_real_int64 16000L); ]); +("y6_hi", [6; 7; 12; 17; 20; 25; 28; 33; 35; 38; 40; 43; 45; 49; 50; 53; 56; 57; 59; ], [(mk_real_int64 24L); (mk_real_int64 250L); (mk_real_int64 250L); (mk_real_int64 248L); (mk_real_int64 485L); (mk_real_int64 192L); (mk_real_int64 20L); (mk_real_int64 176L); (mk_real_int64 100L); (mk_real_int64 311L); (mk_real_int64 111L); (mk_real_int64 250L); (mk_real_int64 196L); (mk_real_int64 64L); (mk_real_int64 125L); (mk_real_int64 201L); (mk_real_int64 296L); (mk_real_int64 104L); (mk_real_int64 464L); ]); +("y8_hi", [1; ], [(mk_real_int64 49000L); ]); +("ye_lo", [22; 25; 37; 47; 49; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 174000L); (mk_real_int64 1000L); ]); +("ye_hi", [21; 46; 57; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_lo", [1; 3; 4; 10; ], [(mk_real_int64 944L); (mk_real_int64 824L); (mk_real_int64 308L); (mk_real_int64 824L); ]); +("yn_hi", [0; 2; 5; 6; 7; 8; 9; 11; 12; ], [(mk_real_int64 1308L); (mk_real_int64 3L); (mk_real_int64 56L); (mk_real_int64 176L); (mk_real_int64 56L); (mk_real_int64 56L); (mk_real_int64 1544L); (mk_real_int64 176L); (mk_real_int64 1712L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/123040027899_out.hl b/formal_lp/old/ineqs/tests2/123040027899_out.hl new file mode 100644 index 0000000..d5c05e4 --- /dev/null +++ b/formal_lp/old/ineqs/tests2/123040027899_out.hl @@ -0,0 +1,87 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "123040027899 25 4 0 1 2 3 3 0 3 4 3 4 3 5 3 5 3 6 3 6 3 2 3 6 2 7 3 7 2 8 3 8 2 1 3 8 1 9 3 9 1 10 3 10 1 0 3 10 0 11 3 11 0 4 3 11 4 5 3 11 5 12 3 12 5 6 3 12 6 7 3 12 7 13 3 13 7 8 3 13 8 9 3 13 9 14 3 14 9 10 3 14 10 11 3 14 11 12 3 12 13 14 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [1; 2; 4; 5; 11; 12; 14; ], [(mk_real_int64 130L); (mk_real_int64 446L); (mk_real_int64 142L); (mk_real_int64 11L); (mk_real_int64 207L); (mk_real_int64 646L); (mk_real_int64 116L); ]); +("azim_sum_neg", [7; 8; 9; ], [(mk_real_int64 8L); (mk_real_int64 55L); (mk_real_int64 46L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 1190L); (mk_real_int64 1190L); (mk_real_int64 1190L); (mk_real_int64 1190L); (mk_real_int64 789L); (mk_real_int64 1190L); (mk_real_int64 1190L); (mk_real_int64 1190L); (mk_real_int64 1190L); (mk_real_int64 1188L); (mk_real_int64 1190L); (mk_real_int64 1190L); (mk_real_int64 1190L); (mk_real_int64 1190L); (mk_real_int64 1190L); ]); +("sol_sum3", [5; 7; 17; 18; ], [(mk_real_int64 8L); (mk_real_int64 46L); (mk_real_int64 8L); (mk_real_int64 46L); ]); +("sol_sum3_neg", [13; 22; 23; ], [(mk_real_int64 48L); (mk_real_int64 116L); (mk_real_int64 3L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; 22; 23; ], [(mk_real_int64 910L); (mk_real_int64 910L); (mk_real_int64 1190L); (mk_real_int64 1190L); (mk_real_int64 1190L); (mk_real_int64 1190L); (mk_real_int64 1190L); (mk_real_int64 1188L); (mk_real_int64 1188L); (mk_real_int64 1190L); (mk_real_int64 1190L); (mk_real_int64 910L); (mk_real_int64 910L); (mk_real_int64 1190L); (mk_real_int64 1190L); (mk_real_int64 1190L); (mk_real_int64 1190L); (mk_real_int64 1190L); (mk_real_int64 1188L); (mk_real_int64 1188L); (mk_real_int64 1188L); (mk_real_int64 1190L); (mk_real_int64 1190L); (mk_real_int64 1190L); ]); +("tau_sum4_neg", [0; ], [(mk_real_int64 1190L); ]); +("ln_def_neg", [0; 1; 2; 3; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 312L); (mk_real_int64 312L); (mk_real_int64 312L); (mk_real_int64 312L); (mk_real_int64 312L); (mk_real_int64 312L); (mk_real_int64 312L); (mk_real_int64 312L); (mk_real_int64 310L); (mk_real_int64 312L); (mk_real_int64 312L); (mk_real_int64 312L); (mk_real_int64 312L); (mk_real_int64 312L); ]); +("ln_def", [4; ], [(mk_real_int64 130L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 7477L); (mk_real_int64 7477L); (mk_real_int64 7477L); (mk_real_int64 7477L); (mk_real_int64 4958L); (mk_real_int64 7477L); (mk_real_int64 7477L); (mk_real_int64 7477L); (mk_real_int64 7477L); (mk_real_int64 7465L); (mk_real_int64 7477L); (mk_real_int64 7477L); (mk_real_int64 7477L); (mk_real_int64 7477L); (mk_real_int64 7477L); ]); +("edge_sym_neg", [3; 5; 9; 11; 12; 15; 17; 18; 20; 21; 24; 27; 35; 36; 39; 48; 54; 57; 60; 62; 63; 69; 72; ], [(mk_real_int64 31L); (mk_real_int64 176L); (mk_real_int64 200L); (mk_real_int64 157L); (mk_real_int64 145L); (mk_real_int64 123L); (mk_real_int64 124L); (mk_real_int64 124L); (mk_real_int64 116L); (mk_real_int64 176L); (mk_real_int64 24L); (mk_real_int64 360L); (mk_real_int64 107L); (mk_real_int64 107L); (mk_real_int64 187L); (mk_real_int64 22L); (mk_real_int64 7L); (mk_real_int64 150L); (mk_real_int64 111L); (mk_real_int64 114L); (mk_real_int64 70L); (mk_real_int64 48L); (mk_real_int64 128L); ]); +("edge_sym", [6; 8; 26; 29; 30; 33; 42; 44; 45; 51; 53; 66; ], [(mk_real_int64 31L); (mk_real_int64 95L); (mk_real_int64 30L); (mk_real_int64 14L); (mk_real_int64 236L); (mk_real_int64 107L); (mk_real_int64 136L); (mk_real_int64 10L); (mk_real_int64 44L); (mk_real_int64 14L); (mk_real_int64 107L); (mk_real_int64 265L); ]); +("y1_def_neg", [4; 6; 8; 9; 10; 14; 16; 19; 20; 23; 25; 26; 29; 30; 31; 36; 37; 38; 40; 41; 42; 44; 45; 46; 47; 48; 49; 52; 54; 55; 56; 58; 59; 60; 61; 62; 63; 64; 65; 66; 67; 69; 71; 72; 73; 75; ], [(mk_real_int64 119L); (mk_real_int64 59L); (mk_real_int64 332L); (mk_real_int64 171L); (mk_real_int64 217L); (mk_real_int64 177L); (mk_real_int64 177L); (mk_real_int64 192L); (mk_real_int64 13L); (mk_real_int64 29L); (mk_real_int64 3L); (mk_real_int64 264L); (mk_real_int64 203L); (mk_real_int64 1L); (mk_real_int64 86L); (mk_real_int64 155L); (mk_real_int64 79L); (mk_real_int64 230L); (mk_real_int64 168L); (mk_real_int64 104L); (mk_real_int64 171L); (mk_real_int64 18L); (mk_real_int64 14L); (mk_real_int64 8L); (mk_real_int64 3L); (mk_real_int64 38L); (mk_real_int64 141L); (mk_real_int64 10L); (mk_real_int64 40L); (mk_real_int64 2L); (mk_real_int64 214L); (mk_real_int64 12L); (mk_real_int64 3L); (mk_real_int64 214L); (mk_real_int64 1L); (mk_real_int64 191L); (mk_real_int64 28L); (mk_real_int64 28L); (mk_real_int64 191L); (mk_real_int64 1L); (mk_real_int64 3L); (mk_real_int64 233L); (mk_real_int64 21L); (mk_real_int64 62L); (mk_real_int64 365L); (mk_real_int64 27L); ]); +("y1_def", [18; 21; 22; 28; 51; 53; 57; 70; 74; ], [(mk_real_int64 4L); (mk_real_int64 23L); (mk_real_int64 13L); (mk_real_int64 23L); (mk_real_int64 4L); (mk_real_int64 4L); (mk_real_int64 22L); (mk_real_int64 44L); (mk_real_int64 3L); ]); +("y2_def_neg", [6; 8; 10; 14; 16; 18; 19; 21; 22; 23; 25; 26; 28; 29; 31; 36; 41; 44; 48; 49; 51; 53; 54; 56; 57; 59; 60; 62; 65; 69; 72; ], [(mk_real_int64 59L); (mk_real_int64 62L); (mk_real_int64 210L); (mk_real_int64 177L); (mk_real_int64 177L); (mk_real_int64 1L); (mk_real_int64 192L); (mk_real_int64 7L); (mk_real_int64 4L); (mk_real_int64 29L); (mk_real_int64 8L); (mk_real_int64 44L); (mk_real_int64 7L); (mk_real_int64 68L); (mk_real_int64 86L); (mk_real_int64 155L); (mk_real_int64 104L); (mk_real_int64 42L); (mk_real_int64 38L); (mk_real_int64 12L); (mk_real_int64 1L); (mk_real_int64 1L); (mk_real_int64 40L); (mk_real_int64 214L); (mk_real_int64 8L); (mk_real_int64 8L); (mk_real_int64 214L); (mk_real_int64 221L); (mk_real_int64 221L); (mk_real_int64 109L); (mk_real_int64 62L); ]); +("y2_def", [4; 9; 20; 30; 37; 38; 40; 42; 45; 46; 47; 52; 55; 58; 61; 63; 64; 66; 67; 70; 71; 73; 74; 75; ], [(mk_real_int64 72L); (mk_real_int64 106L); (mk_real_int64 21L); (mk_real_int64 1L); (mk_real_int64 48L); (mk_real_int64 41L); (mk_real_int64 102L); (mk_real_int64 106L); (mk_real_int64 69L); (mk_real_int64 13L); (mk_real_int64 4L); (mk_real_int64 15L); (mk_real_int64 3L); (mk_real_int64 17L); (mk_real_int64 1L); (mk_real_int64 43L); (mk_real_int64 43L); (mk_real_int64 1L); (mk_real_int64 5L); (mk_real_int64 44L); (mk_real_int64 33L); (mk_real_int64 20L); (mk_real_int64 1L); (mk_real_int64 41L); ]); +("y3_def_neg", [6; 8; 10; 14; 16; 18; 19; 21; 22; 23; 25; 26; 28; 29; 31; 36; 41; 44; 48; 49; 51; 53; 54; 56; 57; 59; 60; 62; 65; 69; 72; ], [(mk_real_int64 59L); (mk_real_int64 62L); (mk_real_int64 210L); (mk_real_int64 177L); (mk_real_int64 177L); (mk_real_int64 1L); (mk_real_int64 192L); (mk_real_int64 7L); (mk_real_int64 4L); (mk_real_int64 29L); (mk_real_int64 8L); (mk_real_int64 44L); (mk_real_int64 7L); (mk_real_int64 68L); (mk_real_int64 86L); (mk_real_int64 155L); (mk_real_int64 104L); (mk_real_int64 42L); (mk_real_int64 38L); (mk_real_int64 12L); (mk_real_int64 1L); (mk_real_int64 1L); (mk_real_int64 40L); (mk_real_int64 214L); (mk_real_int64 8L); (mk_real_int64 8L); (mk_real_int64 214L); (mk_real_int64 221L); (mk_real_int64 221L); (mk_real_int64 109L); (mk_real_int64 62L); ]); +("y3_def", [4; 9; 20; 30; 37; 38; 40; 42; 45; 46; 47; 52; 55; 58; 61; 63; 64; 66; 67; 70; 71; 73; 74; 75; ], [(mk_real_int64 72L); (mk_real_int64 106L); (mk_real_int64 21L); (mk_real_int64 1L); (mk_real_int64 48L); (mk_real_int64 41L); (mk_real_int64 102L); (mk_real_int64 106L); (mk_real_int64 69L); (mk_real_int64 13L); (mk_real_int64 4L); (mk_real_int64 15L); (mk_real_int64 3L); (mk_real_int64 17L); (mk_real_int64 1L); (mk_real_int64 43L); (mk_real_int64 43L); (mk_real_int64 1L); (mk_real_int64 5L); (mk_real_int64 44L); (mk_real_int64 33L); (mk_real_int64 20L); (mk_real_int64 1L); (mk_real_int64 41L); ]); +("y4_def_neg", [0; 2; 4; 5; 6; 10; 12; 15; 16; 19; 22; 25; 26; 27; 32; 33; 34; 36; 37; 38; 41; 42; 43; 44; 45; 48; 50; 51; 52; 54; 56; 57; 58; 59; 60; 61; 62; 63; 65; 66; 67; 68; 69; 71; ], [(mk_real_int64 135L); (mk_real_int64 41L); (mk_real_int64 306L); (mk_real_int64 200L); (mk_real_int64 157L); (mk_real_int64 123L); (mk_real_int64 123L); (mk_real_int64 130L); (mk_real_int64 39L); (mk_real_int64 20L); (mk_real_int64 374L); (mk_real_int64 258L); (mk_real_int64 1L); (mk_real_int64 60L); (mk_real_int64 107L); (mk_real_int64 90L); (mk_real_int64 235L); (mk_real_int64 192L); (mk_real_int64 72L); (mk_real_int64 200L); (mk_real_int64 105L); (mk_real_int64 24L); (mk_real_int64 8L); (mk_real_int64 27L); (mk_real_int64 210L); (mk_real_int64 28L); (mk_real_int64 28L); (mk_real_int64 6L); (mk_real_int64 149L); (mk_real_int64 33L); (mk_real_int64 149L); (mk_real_int64 1L); (mk_real_int64 113L); (mk_real_int64 81L); (mk_real_int64 81L); (mk_real_int64 113L); (mk_real_int64 1L); (mk_real_int64 9L); (mk_real_int64 270L); (mk_real_int64 23L); (mk_real_int64 62L); (mk_real_int64 43L); (mk_real_int64 589L); (mk_real_int64 77L); ]); +("y4_def", [14; 17; 18; 21; 24; 40; 47; 49; 53; 55; 70; ], [(mk_real_int64 6L); (mk_real_int64 36L); (mk_real_int64 20L); (mk_real_int64 20L); (mk_real_int64 35L); (mk_real_int64 3L); (mk_real_int64 6L); (mk_real_int64 6L); (mk_real_int64 39L); (mk_real_int64 20L); (mk_real_int64 2L); ]); +("y5_def_neg", [0; 6; 8; 10; 14; 16; 18; 19; 21; 22; 23; 28; 29; 31; 36; 41; 44; 48; 51; 53; 54; 56; 57; 60; 62; 65; 69; 70; 72; 74; ], [(mk_real_int64 31L); (mk_real_int64 41L); (mk_real_int64 12L); (mk_real_int64 145L); (mk_real_int64 123L); (mk_real_int64 123L); (mk_real_int64 1L); (mk_real_int64 130L); (mk_real_int64 7L); (mk_real_int64 4L); (mk_real_int64 20L); (mk_real_int64 7L); (mk_real_int64 22L); (mk_real_int64 60L); (mk_real_int64 107L); (mk_real_int64 72L); (mk_real_int64 31L); (mk_real_int64 27L); (mk_real_int64 1L); (mk_real_int64 1L); (mk_real_int64 28L); (mk_real_int64 149L); (mk_real_int64 4L); (mk_real_int64 149L); (mk_real_int64 155L); (mk_real_int64 155L); (mk_real_int64 53L); (mk_real_int64 23L); (mk_real_int64 43L); (mk_real_int64 1L); ]); +("y5_def", [4; 9; 20; 25; 26; 30; 37; 38; 40; 42; 45; 46; 47; 49; 52; 55; 58; 59; 61; 63; 64; 66; 67; 71; 73; 75; ], [(mk_real_int64 72L); (mk_real_int64 106L); (mk_real_int64 21L); (mk_real_int64 14L); (mk_real_int64 10L); (mk_real_int64 1L); (mk_real_int64 48L); (mk_real_int64 59L); (mk_real_int64 102L); (mk_real_int64 106L); (mk_real_int64 41L); (mk_real_int64 13L); (mk_real_int64 4L); (mk_real_int64 16L); (mk_real_int64 15L); (mk_real_int64 3L); (mk_real_int64 17L); (mk_real_int64 14L); (mk_real_int64 1L); (mk_real_int64 43L); (mk_real_int64 43L); (mk_real_int64 1L); (mk_real_int64 5L); (mk_real_int64 33L); (mk_real_int64 85L); (mk_real_int64 41L); ]); +("y6_def_neg", [6; 8; 10; 18; 21; 23; 28; 29; 31; 36; 44; 48; 51; 53; 54; 57; 60; 62; 65; 69; 72; ], [(mk_real_int64 41L); (mk_real_int64 12L); (mk_real_int64 95L); (mk_real_int64 1L); (mk_real_int64 7L); (mk_real_int64 20L); (mk_real_int64 7L); (mk_real_int64 22L); (mk_real_int64 14L); (mk_real_int64 107L); (mk_real_int64 31L); (mk_real_int64 27L); (mk_real_int64 1L); (mk_real_int64 1L); (mk_real_int64 28L); (mk_real_int64 4L); (mk_real_int64 149L); (mk_real_int64 155L); (mk_real_int64 155L); (mk_real_int64 53L); (mk_real_int64 43L); ]); +("y6_def", [4; 7; 9; 13; 16; 19; 20; 22; 25; 26; 30; 32; 37; 38; 40; 41; 42; 45; 46; 47; 49; 50; 52; 55; 56; 58; 59; 61; 63; 64; 66; 67; 68; 70; 71; 73; 74; 75; ], [(mk_real_int64 72L); (mk_real_int64 388L); (mk_real_int64 106L); (mk_real_int64 279L); (mk_real_int64 117L); (mk_real_int64 67L); (mk_real_int64 21L); (mk_real_int64 136L); (mk_real_int64 14L); (mk_real_int64 10L); (mk_real_int64 501L); (mk_real_int64 60L); (mk_real_int64 48L); (mk_real_int64 59L); (mk_real_int64 459L); (mk_real_int64 286L); (mk_real_int64 106L); (mk_real_int64 41L); (mk_real_int64 13L); (mk_real_int64 195L); (mk_real_int64 16L); (mk_real_int64 335L); (mk_real_int64 15L); (mk_real_int64 3L); (mk_real_int64 186L); (mk_real_int64 285L); (mk_real_int64 541L); (mk_real_int64 347L); (mk_real_int64 43L); (mk_real_int64 271L); (mk_real_int64 1L); (mk_real_int64 5L); (mk_real_int64 169L); (mk_real_int64 58L); (mk_real_int64 33L); (mk_real_int64 85L); (mk_real_int64 618L); (mk_real_int64 41L); ]); +("y8_def_neg", [1; ], [(mk_real_int64 31L); ]); +("RHA", [4; 5; 25; 37; 59; ], [(mk_real_int64 83L); (mk_real_int64 280L); (mk_real_int64 2L); (mk_real_int64 149L); (mk_real_int64 2L); ]); +("RHB", [6; 7; 39; 41; ], [(mk_real_int64 120L); (mk_real_int64 120L); (mk_real_int64 120L); (mk_real_int64 120L); ]); +("yy10", [71; ], [(mk_real_int64 12L); ]); +("tau4", [0; ], [(mk_real_int64 430L); ]); +("ineq106", [0; 4; 5; 22; 25; 26; 33; 34; 36; 38; 54; 57; 59; 60; 62; ], [(mk_real_int64 198L); (mk_real_int64 280L); (mk_real_int64 280L); (mk_real_int64 2L); (mk_real_int64 2L); (mk_real_int64 2L); (mk_real_int64 132L); (mk_real_int64 280L); (mk_real_int64 280L); (mk_real_int64 280L); (mk_real_int64 2L); (mk_real_int64 2L); (mk_real_int64 2L); (mk_real_int64 2L); (mk_real_int64 2L); ]); +("ineq107", [14; 17; 18; 21; 24; 40; 47; 49; 53; 55; 58; 61; 70; ], [(mk_real_int64 8L); (mk_real_int64 47L); (mk_real_int64 26L); (mk_real_int64 7L); (mk_real_int64 46L); (mk_real_int64 37L); (mk_real_int64 8L); (mk_real_int64 8L); (mk_real_int64 47L); (mk_real_int64 7L); (mk_real_int64 46L); (mk_real_int64 46L); (mk_real_int64 3L); ]); +("ineq108", [5; 6; 16; 22; 25; 38; 41; 42; 43; 45; 48; 51; 54; 59; 60; 63; 65; 67; 69; 71; ], [(mk_real_int64 11L); (mk_real_int64 11L); (mk_real_int64 57L); (mk_real_int64 364L); (mk_real_int64 223L); (mk_real_int64 11L); (mk_real_int64 139L); (mk_real_int64 35L); (mk_real_int64 11L); (mk_real_int64 215L); (mk_real_int64 41L); (mk_real_int64 8L); (mk_real_int64 46L); (mk_real_int64 116L); (mk_real_int64 116L); (mk_real_int64 13L); (mk_real_int64 207L); (mk_real_int64 91L); (mk_real_int64 643L); (mk_real_int64 113L); ]); +("ineq109", [15; 21; 53; 55; ], [(mk_real_int64 8L); (mk_real_int64 46L); (mk_real_int64 8L); (mk_real_int64 46L); ]); +("ineq110", [41; 66; 70; ], [(mk_real_int64 48L); (mk_real_int64 116L); (mk_real_int64 3L); ]); +("ineq111", [2; 4; 6; 10; 12; 15; 19; 22; 25; 27; 32; 34; 37; 40; 44; 45; 50; 52; 56; 58; 61; 65; 68; 69; ], [(mk_real_int64 329L); (mk_real_int64 910L); (mk_real_int64 1190L); (mk_real_int64 983L); (mk_real_int64 983L); (mk_real_int64 1061L); (mk_real_int64 158L); (mk_real_int64 985L); (mk_real_int64 832L); (mk_real_int64 478L); (mk_real_int64 859L); (mk_real_int64 341L); (mk_real_int64 579L); (mk_real_int64 204L); (mk_real_int64 213L); (mk_real_int64 501L); (mk_real_int64 223L); (mk_real_int64 1190L); (mk_real_int64 1188L); (mk_real_int64 1188L); (mk_real_int64 1188L); (mk_real_int64 1026L); (mk_real_int64 344L); (mk_real_int64 1190L); ]); +("ineq113", [18; ], [(mk_real_int64 113L); ]); +("ineq114", [0; 1; 11; 13; 16; 19; 20; 22; 25; 28; 32; 33; 36; 39; 41; 42; 45; 48; 63; 68; ], [(mk_real_int64 132L); (mk_real_int64 448L); (mk_real_int64 207L); (mk_real_int64 207L); (mk_real_int64 129L); (mk_real_int64 207L); (mk_real_int64 712L); (mk_real_int64 203L); (mk_real_int64 356L); (mk_real_int64 712L); (mk_real_int64 331L); (mk_real_int64 569L); (mk_real_int64 331L); (mk_real_int64 254L); (mk_real_int64 732L); (mk_real_int64 977L); (mk_real_int64 689L); (mk_real_int64 967L); (mk_real_int64 164L); (mk_real_int64 847L); ]); +("ineq120", [1; 2; ], [(mk_real_int64 588L); (mk_real_int64 171L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 3525L); (mk_real_int64 3525L); (mk_real_int64 3525L); (mk_real_int64 3525L); (mk_real_int64 2350L); (mk_real_int64 3525L); (mk_real_int64 3525L); (mk_real_int64 3525L); (mk_real_int64 3525L); (mk_real_int64 3625L); (mk_real_int64 3525L); (mk_real_int64 3525L); (mk_real_int64 3525L); (mk_real_int64 3525L); (mk_real_int64 3525L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_lo", [1; 2; 4; 6; 7; 15; 17; 20; 22; 23; 24; 26; 29; 32; 39; 41; 45; 67; ], [(mk_real_int64 296L); (mk_real_int64 382L); (mk_real_int64 368L); (mk_real_int64 880L); (mk_real_int64 880L); (mk_real_int64 418L); (mk_real_int64 418L); (mk_real_int64 246L); (mk_real_int64 267L); (mk_real_int64 418L); (mk_real_int64 288L); (mk_real_int64 922L); (mk_real_int64 144L); (mk_real_int64 288L); (mk_real_int64 880L); (mk_real_int64 880L); (mk_real_int64 768L); (mk_real_int64 336L); ]); +("azim_hi", [5; 36; 37; 40; 43; 46; 49; 52; 72; ], [(mk_real_int64 448L); (mk_real_int64 206L); (mk_real_int64 194L); (mk_real_int64 206L); (mk_real_int64 4L); (mk_real_int64 602L); (mk_real_int64 314L); (mk_real_int64 342L); (mk_real_int64 222L); ]); +("rhazim_hi", [4; 6; 7; 37; 39; 41; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 960L); (mk_real_int64 960L); (mk_real_int64 960L); (mk_real_int64 960L); (mk_real_int64 76L); (mk_real_int64 960L); (mk_real_int64 960L); (mk_real_int64 960L); (mk_real_int64 960L); (mk_real_int64 392L); (mk_real_int64 960L); (mk_real_int64 960L); (mk_real_int64 960L); (mk_real_int64 960L); (mk_real_int64 960L); ]); +("tau_lo", [0; 1; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("tau_hi", [23; ], [(mk_real_int64 1000L); ]); +("y1_hi", [4; 8; 9; 10; 14; 16; 21; 23; 36; 38; 42; 47; 49; 52; 55; 57; 60; 62; 65; 70; 72; 75; ], [(mk_real_int64 200L); (mk_real_int64 200L); (mk_real_int64 415L); (mk_real_int64 215L); (mk_real_int64 60L); (mk_real_int64 60L); (mk_real_int64 500L); (mk_real_int64 560L); (mk_real_int64 380L); (mk_real_int64 620L); (mk_real_int64 415L); (mk_real_int64 415L); (mk_real_int64 295L); (mk_real_int64 365L); (mk_real_int64 120L); (mk_real_int64 292L); (mk_real_int64 160L); (mk_real_int64 160L); (mk_real_int64 160L); (mk_real_int64 80L); (mk_real_int64 80L); (mk_real_int64 445L); ]); +("y1_lo", [6; 19; 20; 25; 26; 29; 30; 31; 37; 41; 44; 45; 46; 48; 54; 56; 58; 59; 61; 63; 64; 66; 67; 69; 71; 73; 74; ], [(mk_real_int64 220L); (mk_real_int64 188L); (mk_real_int64 395L); (mk_real_int64 446L); (mk_real_int64 40L); (mk_real_int64 365L); (mk_real_int64 200L); (mk_real_int64 40L); (mk_real_int64 200L); (mk_real_int64 220L); (mk_real_int64 220L); (mk_real_int64 425L); (mk_real_int64 225L); (mk_real_int64 340L); (mk_real_int64 140L); (mk_real_int64 200L); (mk_real_int64 10L); (mk_real_int64 446L); (mk_real_int64 200L); (mk_real_int64 460L); (mk_real_int64 460L); (mk_real_int64 200L); (mk_real_int64 55L); (mk_real_int64 325L); (mk_real_int64 385L); (mk_real_int64 305L); (mk_real_int64 360L); ]); +("y2_hi", [4; 8; 14; 16; 22; 23; 28; 29; 36; 37; 47; 49; 58; 60; 62; 65; 70; 71; 72; 75; ], [(mk_real_int64 72L); (mk_real_int64 120L); (mk_real_int64 60L); (mk_real_int64 60L); (mk_real_int64 48L); (mk_real_int64 560L); (mk_real_int64 8L); (mk_real_int64 140L); (mk_real_int64 380L); (mk_real_int64 48L); (mk_real_int64 4L); (mk_real_int64 80L); (mk_real_int64 472L); (mk_real_int64 160L); (mk_real_int64 168L); (mk_real_int64 168L); (mk_real_int64 80L); (mk_real_int64 124L); (mk_real_int64 80L); (mk_real_int64 132L); ]); +("y2_lo", [6; 9; 10; 18; 19; 20; 21; 25; 26; 30; 31; 38; 40; 41; 42; 44; 45; 46; 48; 51; 52; 53; 54; 55; 56; 57; 59; 61; 63; 64; 66; 67; 69; 73; 74; ], [(mk_real_int64 220L); (mk_real_int64 76L); (mk_real_int64 196L); (mk_real_int64 216L); (mk_real_int64 188L); (mk_real_int64 252L); (mk_real_int64 144L); (mk_real_int64 10L); (mk_real_int64 76L); (mk_real_int64 272L); (mk_real_int64 40L); (mk_real_int64 460L); (mk_real_int64 80L); (mk_real_int64 220L); (mk_real_int64 76L); (mk_real_int64 344L); (mk_real_int64 164L); (mk_real_int64 260L); (mk_real_int64 340L); (mk_real_int64 216L); (mk_real_int64 76L); (mk_real_int64 216L); (mk_real_int64 140L); (mk_real_int64 88L); (mk_real_int64 200L); (mk_real_int64 352L); (mk_real_int64 10L); (mk_real_int64 272L); (mk_real_int64 48L); (mk_real_int64 48L); (mk_real_int64 272L); (mk_real_int64 268L); (mk_real_int64 332L); (mk_real_int64 148L); (mk_real_int64 316L); ]); +("y3_hi", [4; 8; 14; 16; 22; 23; 28; 29; 36; 37; 47; 49; 58; 60; 62; 65; 70; 71; 72; 75; ], [(mk_real_int64 72L); (mk_real_int64 120L); (mk_real_int64 60L); (mk_real_int64 60L); (mk_real_int64 48L); (mk_real_int64 560L); (mk_real_int64 8L); (mk_real_int64 140L); (mk_real_int64 380L); (mk_real_int64 48L); (mk_real_int64 4L); (mk_real_int64 80L); (mk_real_int64 472L); (mk_real_int64 160L); (mk_real_int64 168L); (mk_real_int64 168L); (mk_real_int64 80L); (mk_real_int64 124L); (mk_real_int64 80L); (mk_real_int64 132L); ]); +("y3_lo", [6; 9; 10; 18; 19; 20; 21; 25; 26; 30; 31; 38; 40; 41; 42; 44; 45; 46; 48; 51; 52; 53; 54; 55; 56; 57; 59; 61; 63; 64; 66; 67; 69; 73; 74; ], [(mk_real_int64 220L); (mk_real_int64 76L); (mk_real_int64 196L); (mk_real_int64 216L); (mk_real_int64 188L); (mk_real_int64 252L); (mk_real_int64 144L); (mk_real_int64 10L); (mk_real_int64 76L); (mk_real_int64 272L); (mk_real_int64 40L); (mk_real_int64 460L); (mk_real_int64 80L); (mk_real_int64 220L); (mk_real_int64 76L); (mk_real_int64 344L); (mk_real_int64 164L); (mk_real_int64 260L); (mk_real_int64 340L); (mk_real_int64 216L); (mk_real_int64 76L); (mk_real_int64 216L); (mk_real_int64 140L); (mk_real_int64 88L); (mk_real_int64 200L); (mk_real_int64 352L); (mk_real_int64 10L); (mk_real_int64 272L); (mk_real_int64 48L); (mk_real_int64 48L); (mk_real_int64 272L); (mk_real_int64 268L); (mk_real_int64 332L); (mk_real_int64 148L); (mk_real_int64 316L); ]); +("y4_lo", [0; 2; 15; 16; 25; 26; 32; 33; 37; 48; 53; 57; 62; 65; 67; 69; 70; 71; ], [(mk_real_int64 630L); (mk_real_int64 125L); (mk_real_int64 33L); (mk_real_int64 45L); (mk_real_int64 125L); (mk_real_int64 370L); (mk_real_int64 375L); (mk_real_int64 420L); (mk_real_int64 375L); (mk_real_int64 85L); (mk_real_int64 77L); (mk_real_int64 370L); (mk_real_int64 370L); (mk_real_int64 45L); (mk_real_int64 335L); (mk_real_int64 205L); (mk_real_int64 269L); (mk_real_int64 405L); ]); +("y4_hi", [4; 5; 6; 10; 12; 14; 17; 18; 19; 21; 22; 24; 27; 34; 36; 38; 40; 41; 42; 43; 44; 45; 47; 49; 50; 51; 52; 54; 55; 56; 58; 59; 60; 61; 63; 66; ], [(mk_real_int64 450L); (mk_real_int64 665L); (mk_real_int64 715L); (mk_real_int64 125L); (mk_real_int64 125L); (mk_real_int64 184L); (mk_real_int64 331L); (mk_real_int64 98L); (mk_real_int64 250L); (mk_real_int64 315L); (mk_real_int64 165L); (mk_real_int64 558L); (mk_real_int64 250L); (mk_real_int64 575L); (mk_real_int64 200L); (mk_real_int64 665L); (mk_real_int64 101L); (mk_real_int64 377L); (mk_real_int64 25L); (mk_real_int64 465L); (mk_real_int64 375L); (mk_real_int64 100L); (mk_real_int64 184L); (mk_real_int64 184L); (mk_real_int64 125L); (mk_real_int64 520L); (mk_real_int64 250L); (mk_real_int64 120L); (mk_real_int64 315L); (mk_real_int64 500L); (mk_real_int64 58L); (mk_real_int64 170L); (mk_real_int64 170L); (mk_real_int64 58L); (mk_real_int64 95L); (mk_real_int64 264L); ]); +("y5_hi", [4; 8; 10; 14; 16; 22; 23; 26; 28; 31; 37; 38; 45; 47; 48; 54; 56; 58; 60; 69; 70; 71; 73; 75; ], [(mk_real_int64 72L); (mk_real_int64 170L); (mk_real_int64 254L); (mk_real_int64 125L); (mk_real_int64 125L); (mk_real_int64 48L); (mk_real_int64 250L); (mk_real_int64 99L); (mk_real_int64 8L); (mk_real_int64 250L); (mk_real_int64 48L); (mk_real_int64 295L); (mk_real_int64 188L); (mk_real_int64 4L); (mk_real_int64 375L); (mk_real_int64 125L); (mk_real_int64 250L); (mk_real_int64 472L); (mk_real_int64 500L); (mk_real_int64 98L); (mk_real_int64 264L); (mk_real_int64 124L); (mk_real_int64 302L); (mk_real_int64 132L); ]); +("y5_lo", [6; 9; 18; 19; 20; 21; 25; 29; 30; 36; 40; 41; 42; 44; 46; 49; 51; 52; 53; 55; 57; 59; 61; 62; 63; 64; 65; 66; 67; 74; ], [(mk_real_int64 125L); (mk_real_int64 76L); (mk_real_int64 216L); (mk_real_int64 33L); (mk_real_int64 252L); (mk_real_int64 144L); (mk_real_int64 160L); (mk_real_int64 100L); (mk_real_int64 272L); (mk_real_int64 375L); (mk_real_int64 80L); (mk_real_int64 375L); (mk_real_int64 76L); (mk_real_int64 124L); (mk_real_int64 260L); (mk_real_int64 365L); (mk_real_int64 216L); (mk_real_int64 76L); (mk_real_int64 216L); (mk_real_int64 88L); (mk_real_int64 552L); (mk_real_int64 160L); (mk_real_int64 272L); (mk_real_int64 492L); (mk_real_int64 48L); (mk_real_int64 48L); (mk_real_int64 492L); (mk_real_int64 272L); (mk_real_int64 268L); (mk_real_int64 44L); ]); +("y6_hi", [4; 8; 10; 14; 22; 23; 26; 28; 31; 37; 38; 45; 47; 48; 54; 56; 58; 59; 60; 69; 71; 73; 75; ], [(mk_real_int64 72L); (mk_real_int64 170L); (mk_real_int64 254L); (mk_real_int64 125L); (mk_real_int64 48L); (mk_real_int64 250L); (mk_real_int64 99L); (mk_real_int64 8L); (mk_real_int64 250L); (mk_real_int64 48L); (mk_real_int64 295L); (mk_real_int64 188L); (mk_real_int64 4L); (mk_real_int64 375L); (mk_real_int64 125L); (mk_real_int64 250L); (mk_real_int64 472L); (mk_real_int64 840L); (mk_real_int64 500L); (mk_real_int64 98L); (mk_real_int64 124L); (mk_real_int64 302L); (mk_real_int64 132L); ]); +("y6_lo", [6; 7; 9; 10; 13; 14; 16; 18; 19; 20; 21; 22; 25; 29; 30; 31; 32; 36; 40; 41; 42; 44; 46; 47; 49; 50; 51; 52; 53; 55; 56; 57; 58; 59; 61; 62; 63; 64; 65; 66; 67; 68; 70; 74; ], [(mk_real_int64 125L); (mk_real_int64 388000L); (mk_real_int64 76L); (mk_real_int64 50000L); (mk_real_int64 279000L); (mk_real_int64 123000L); (mk_real_int64 239875L); (mk_real_int64 216L); (mk_real_int64 197033L); (mk_real_int64 252L); (mk_real_int64 144L); (mk_real_int64 140000L); (mk_real_int64 160L); (mk_real_int64 100L); (mk_real_int64 500272L); (mk_real_int64 46000L); (mk_real_int64 60000L); (mk_real_int64 375L); (mk_real_int64 357080L); (mk_real_int64 358375L); (mk_real_int64 76L); (mk_real_int64 124L); (mk_real_int64 260L); (mk_real_int64 191000L); (mk_real_int64 365L); (mk_real_int64 335000L); (mk_real_int64 216L); (mk_real_int64 76L); (mk_real_int64 216L); (mk_real_int64 88L); (mk_real_int64 335000L); (mk_real_int64 552L); (mk_real_int64 268000L); (mk_real_int64 528000L); (mk_real_int64 346272L); (mk_real_int64 492L); (mk_real_int64 48L); (mk_real_int64 228048L); (mk_real_int64 492L); (mk_real_int64 272L); (mk_real_int64 268L); (mk_real_int64 169000L); (mk_real_int64 80736L); (mk_real_int64 619044L); ]); +("y8_hi", [1; ], [(mk_real_int64 31000L); ]); +("ye_lo", [8; 13; 33; 47; 53; 59; 60; 66; 71; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 167000L); (mk_real_int64 1000L); (mk_real_int64 164000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 335000L); (mk_real_int64 1000L); ]); +("ye_hi", [51; 62; 63; 64; 65; 66; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_lo", [3; ], [(mk_real_int64 712L); ]); +("yn_hi", [0; 1; 2; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 288L); (mk_real_int64 288L); (mk_real_int64 288L); (mk_real_int64 10L); (mk_real_int64 288L); (mk_real_int64 1288L); (mk_real_int64 1288L); (mk_real_int64 288L); (mk_real_int64 1440L); (mk_real_int64 288L); (mk_real_int64 1288L); (mk_real_int64 1288L); (mk_real_int64 1288L); (mk_real_int64 1288L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/125719999821_out.hl b/formal_lp/old/ineqs/tests2/125719999821_out.hl new file mode 100644 index 0000000..9ddfe72 --- /dev/null +++ b/formal_lp/old/ineqs/tests2/125719999821_out.hl @@ -0,0 +1,89 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "125719999821 19 4 0 1 2 3 4 0 3 4 5 3 4 3 6 3 6 3 7 3 7 3 2 3 7 2 8 3 8 2 1 3 8 1 9 3 9 1 0 3 9 0 10 3 10 0 5 3 10 5 11 3 11 5 4 3 11 4 12 3 12 4 6 3 12 6 7 3 12 7 8 4 11 12 8 9 3 9 10 11 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum_neg", [1; 2; 4; 6; 7; 11; ], [(mk_real_int64 244L); (mk_real_int64 94L); (mk_real_int64 339L); (mk_real_int64 120L); (mk_real_int64 157L); (mk_real_int64 249L); ]); +("azim_sum", [0; ], [(mk_real_int64 113L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 929L); (mk_real_int64 925L); (mk_real_int64 1019L); (mk_real_int64 953L); (mk_real_int64 929L); (mk_real_int64 929L); (mk_real_int64 663L); (mk_real_int64 819L); (mk_real_int64 1131L); (mk_real_int64 1131L); (mk_real_int64 1131L); (mk_real_int64 822L); (mk_real_int64 1131L); ]); +("sol_sum3_neg", [0; 11; 12; 14; ], [(mk_real_int64 153L); (mk_real_int64 200L); (mk_real_int64 156L); (mk_real_int64 175L); ]); +("sol_sum3", [3; 4; 8; 9; ], [(mk_real_int64 157L); (mk_real_int64 29L); (mk_real_int64 249L); (mk_real_int64 249L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; ], [(mk_real_int64 663L); (mk_real_int64 663L); (mk_real_int64 663L); (mk_real_int64 819L); (mk_real_int64 925L); (mk_real_int64 925L); (mk_real_int64 953L); (mk_real_int64 822L); (mk_real_int64 822L); (mk_real_int64 822L); (mk_real_int64 929L); (mk_real_int64 929L); (mk_real_int64 663L); (mk_real_int64 663L); (mk_real_int64 819L); (mk_real_int64 822L); ]); +("tau_sum4_neg", [0; 1; 2; ], [(mk_real_int64 925L); (mk_real_int64 929L); (mk_real_int64 1131L); ]); +("ln_def_neg", [0; 1; 2; 3; 4; 5; 8; 9; 10; 12; ], [(mk_real_int64 25L); (mk_real_int64 20L); (mk_real_int64 124L); (mk_real_int64 51L); (mk_real_int64 25L); (mk_real_int64 25L); (mk_real_int64 247L); (mk_real_int64 247L); (mk_real_int64 247L); (mk_real_int64 247L); ]); +("ln_def", [6; 7; 11; ], [(mk_real_int64 270L); (mk_real_int64 97L); (mk_real_int64 94L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 5840L); (mk_real_int64 5814L); (mk_real_int64 6404L); (mk_real_int64 5987L); (mk_real_int64 5840L); (mk_real_int64 5840L); (mk_real_int64 4163L); (mk_real_int64 5146L); (mk_real_int64 7103L); (mk_real_int64 7103L); (mk_real_int64 7103L); (mk_real_int64 5163L); (mk_real_int64 7103L); ]); +("edge_sym_neg", [5; 7; 9; 10; 13; 28; 30; 42; 46; 56; ], [(mk_real_int64 104L); (mk_real_int64 60L); (mk_real_int64 5L); (mk_real_int64 129L); (mk_real_int64 14L); (mk_real_int64 130L); (mk_real_int64 62L); (mk_real_int64 186L); (mk_real_int64 69L); (mk_real_int64 230L); ]); +("edge_sym", [12; 18; 19; 22; 34; 36; 37; 40; 49; ], [(mk_real_int64 20L); (mk_real_int64 58L); (mk_real_int64 38L); (mk_real_int64 215L); (mk_real_int64 60L); (mk_real_int64 128L); (mk_real_int64 109L); (mk_real_int64 186L); (mk_real_int64 181L); ]); +("y1_def_neg", [9; 15; 16; 18; 19; 20; 21; 25; 26; 27; 29; 32; 33; 34; 36; 37; 41; 43; 47; 48; 52; 57; ], [(mk_real_int64 13L); (mk_real_int64 10L); (mk_real_int64 11L); (mk_real_int64 11L); (mk_real_int64 85L); (mk_real_int64 107L); (mk_real_int64 39L); (mk_real_int64 231L); (mk_real_int64 110L); (mk_real_int64 39L); (mk_real_int64 36L); (mk_real_int64 38L); (mk_real_int64 39L); (mk_real_int64 11L); (mk_real_int64 54L); (mk_real_int64 154L); (mk_real_int64 1L); (mk_real_int64 168L); (mk_real_int64 281L); (mk_real_int64 59L); (mk_real_int64 15L); (mk_real_int64 62L); ]); +("y1_def", [10; 11; 31; 39; 42; 44; 46; 51; 58; ], [(mk_real_int64 59L); (mk_real_int64 46L); (mk_real_int64 70L); (mk_real_int64 60L); (mk_real_int64 176L); (mk_real_int64 54L); (mk_real_int64 138L); (mk_real_int64 80L); (mk_real_int64 125L); ]); +("y2_def", [9; 16; 18; 20; 27; 29; 34; 37; 42; 44; 47; 52; 57; ], [(mk_real_int64 101L); (mk_real_int64 7L); (mk_real_int64 7L); (mk_real_int64 65L); (mk_real_int64 24L); (mk_real_int64 22L); (mk_real_int64 6L); (mk_real_int64 33L); (mk_real_int64 46L); (mk_real_int64 62L); (mk_real_int64 170L); (mk_real_int64 116L); (mk_real_int64 38L); ]); +("y2_def_neg", [10; 11; 15; 19; 21; 25; 26; 31; 32; 33; 36; 39; 43; 46; 48; 51; 58; ], [(mk_real_int64 18L); (mk_real_int64 14L); (mk_real_int64 10L); (mk_real_int64 32L); (mk_real_int64 179L); (mk_real_int64 33L); (mk_real_int64 52L); (mk_real_int64 21L); (mk_real_int64 38L); (mk_real_int64 39L); (mk_real_int64 37L); (mk_real_int64 161L); (mk_real_int64 167L); (mk_real_int64 42L); (mk_real_int64 138L); (mk_real_int64 62L); (mk_real_int64 38L); ]); +("y3_def", [9; 16; 18; 20; 27; 29; 34; 37; 42; 44; 47; 52; 57; ], [(mk_real_int64 101L); (mk_real_int64 7L); (mk_real_int64 7L); (mk_real_int64 65L); (mk_real_int64 24L); (mk_real_int64 22L); (mk_real_int64 6L); (mk_real_int64 33L); (mk_real_int64 46L); (mk_real_int64 62L); (mk_real_int64 170L); (mk_real_int64 116L); (mk_real_int64 38L); ]); +("y3_def_neg", [10; 11; 15; 19; 21; 25; 26; 31; 32; 33; 36; 39; 43; 46; 48; 51; 58; ], [(mk_real_int64 18L); (mk_real_int64 14L); (mk_real_int64 10L); (mk_real_int64 32L); (mk_real_int64 179L); (mk_real_int64 33L); (mk_real_int64 52L); (mk_real_int64 21L); (mk_real_int64 38L); (mk_real_int64 39L); (mk_real_int64 37L); (mk_real_int64 161L); (mk_real_int64 167L); (mk_real_int64 42L); (mk_real_int64 138L); (mk_real_int64 62L); (mk_real_int64 38L); ]); +("y4_def_neg", [1; 7; 8; 10; 11; 12; 17; 18; 19; 21; 25; 26; 28; 29; 33; 35; 36; 39; 44; 45; ], [(mk_real_int64 111L); (mk_real_int64 7L); (mk_real_int64 13L); (mk_real_int64 13L); (mk_real_int64 7L); (mk_real_int64 122L); (mk_real_int64 215L); (mk_real_int64 92L); (mk_real_int64 44L); (mk_real_int64 41L); (mk_real_int64 27L); (mk_real_int64 12L); (mk_real_int64 42L); (mk_real_int64 52L); (mk_real_int64 1L); (mk_real_int64 117L); (mk_real_int64 37L); (mk_real_int64 321L); (mk_real_int64 128L); (mk_real_int64 71L); ]); +("y4_def", [2; 3; 13; 23; 24; 31; 34; 38; 40; 43; 46; ], [(mk_real_int64 91L); (mk_real_int64 72L); (mk_real_int64 77L); (mk_real_int64 109L); (mk_real_int64 81L); (mk_real_int64 186L); (mk_real_int64 115L); (mk_real_int64 213L); (mk_real_int64 10L); (mk_real_int64 148L); (mk_real_int64 193L); ]); +("y5_def", [9; 16; 18; 19; 20; 27; 29; 32; 34; 37; 47; 52; 57; ], [(mk_real_int64 13L); (mk_real_int64 7L); (mk_real_int64 7L); (mk_real_int64 51L); (mk_real_int64 65L); (mk_real_int64 24L); (mk_real_int64 22L); (mk_real_int64 81L); (mk_real_int64 6L); (mk_real_int64 151L); (mk_real_int64 170L); (mk_real_int64 15L); (mk_real_int64 38L); ]); +("y5_def_neg", [10; 11; 15; 21; 26; 31; 33; 36; 39; 42; 43; 44; 46; 48; 51; 53; 58; ], [(mk_real_int64 18L); (mk_real_int64 14L); (mk_real_int64 7L); (mk_real_int64 122L); (mk_real_int64 29L); (mk_real_int64 21L); (mk_real_int64 27L); (mk_real_int64 24L); (mk_real_int64 128L); (mk_real_int64 70L); (mk_real_int64 116L); (mk_real_int64 27L); (mk_real_int64 42L); (mk_real_int64 101L); (mk_real_int64 53L); (mk_real_int64 230L); (mk_real_int64 38L); ]); +("y6_def", [9; 11; 16; 18; 19; 20; 21; 27; 29; 32; 34; 35; 37; 45; 47; 48; 52; 57; ], [(mk_real_int64 13L); (mk_real_int64 5L); (mk_real_int64 7L); (mk_real_int64 7L); (mk_real_int64 51L); (mk_real_int64 65L); (mk_real_int64 122L); (mk_real_int64 92L); (mk_real_int64 22L); (mk_real_int64 101L); (mk_real_int64 6L); (mk_real_int64 16L); (mk_real_int64 151L); (mk_real_int64 208L); (mk_real_int64 170L); (mk_real_int64 335L); (mk_real_int64 15L); (mk_real_int64 38L); ]); +("y6_def_neg", [10; 15; 26; 31; 33; 36; 42; 43; 44; 46; 51; 58; ], [(mk_real_int64 18L); (mk_real_int64 7L); (mk_real_int64 24L); (mk_real_int64 21L); (mk_real_int64 27L); (mk_real_int64 24L); (mk_real_int64 70L); (mk_real_int64 116L); (mk_real_int64 27L); (mk_real_int64 42L); (mk_real_int64 53L); (mk_real_int64 38L); ]); +("y8_def_neg", [9; ], [(mk_real_int64 230L); ]); +("RHA", [0; 1; 3; 4; 8; 9; 12; 13; 14; 15; 16; 18; 19; 20; 22; 23; 24; 26; 27; 29; 30; 33; 34; 36; 37; 38; 41; 43; 44; 45; 49; 50; 52; 57; 59; ], [(mk_real_int64 28L); (mk_real_int64 94L); (mk_real_int64 4L); (mk_real_int64 23L); (mk_real_int64 267L); (mk_real_int64 149L); (mk_real_int64 267L); (mk_real_int64 157L); (mk_real_int64 157L); (mk_real_int64 267L); (mk_real_int64 244L); (mk_real_int64 87L); (mk_real_int64 257L); (mk_real_int64 27L); (mk_real_int64 94L); (mk_real_int64 205L); (mk_real_int64 94L); (mk_real_int64 117L); (mk_real_int64 1L); (mk_real_int64 249L); (mk_real_int64 131L); (mk_real_int64 131L); (mk_real_int64 90L); (mk_real_int64 90L); (mk_real_int64 115L); (mk_real_int64 201L); (mk_real_int64 200L); (mk_real_int64 200L); (mk_real_int64 459L); (mk_real_int64 267L); (mk_real_int64 157L); (mk_real_int64 311L); (mk_real_int64 175L); (mk_real_int64 205L); (mk_real_int64 309L); ]); +("yy10", [5; 7; 12; 28; 52; ], [(mk_real_int64 104L); (mk_real_int64 60L); (mk_real_int64 52L); (mk_real_int64 57L); (mk_real_int64 163L); ]); +("tau4", [0; 2; ], [(mk_real_int64 195L); (mk_real_int64 1131L); ]); +("ineq106", [1; 8; 10; 11; 12; 17; 18; 19; 21; 26; 28; 29; 33; 35; 36; 39; 44; 45; ], [(mk_real_int64 118L); (mk_real_int64 19L); (mk_real_int64 19L); (mk_real_int64 55L); (mk_real_int64 178L); (mk_real_int64 205L); (mk_real_int64 60L); (mk_real_int64 65L); (mk_real_int64 59L); (mk_real_int64 18L); (mk_real_int64 18L); (mk_real_int64 194L); (mk_real_int64 1L); (mk_real_int64 1L); (mk_real_int64 9L); (mk_real_int64 468L); (mk_real_int64 136L); (mk_real_int64 104L); ]); +("ineq107", [2; 3; 13; 23; 31; 34; 38; 40; 43; 46; ], [(mk_real_int64 118L); (mk_real_int64 93L); (mk_real_int64 215L); (mk_real_int64 141L); (mk_real_int64 339L); (mk_real_int64 200L); (mk_real_int64 276L); (mk_real_int64 120L); (mk_real_int64 217L); (mk_real_int64 249L); ]); +("ineq109", [11; 13; 24; 29; ], [(mk_real_int64 157L); (mk_real_int64 29L); (mk_real_int64 249L); (mk_real_int64 249L); ]); +("ineq110", [1; 34; 36; 44; ], [(mk_real_int64 153L); (mk_real_int64 200L); (mk_real_int64 156L); (mk_real_int64 175L); ]); +("ineq111", [7; 11; 13; 17; 18; 25; 28; 31; 35; 40; 43; 47; ], [(mk_real_int64 55L); (mk_real_int64 159L); (mk_real_int64 790L); (mk_real_int64 597L); (mk_real_int64 409L); (mk_real_int64 214L); (mk_real_int64 240L); (mk_real_int64 608L); (mk_real_int64 929L); (mk_real_int64 663L); (mk_real_int64 159L); (mk_real_int64 1L); ]); +("ineq112", [2; 3; 23; ], [(mk_real_int64 307L); (mk_real_int64 55L); (mk_real_int64 214L); ]); +("ineq113", [19; 43; ], [(mk_real_int64 357L); (mk_real_int64 442L); ]); +("ineq114", [0; 1; 4; 7; 11; 12; 14; 15; 18; 21; 22; 25; 29; 30; 36; 37; 42; 45; 47; ], [(mk_real_int64 181L); (mk_real_int64 174L); (mk_real_int64 608L); (mk_real_int64 608L); (mk_real_int64 660L); (mk_real_int64 89L); (mk_real_int64 46L); (mk_real_int64 328L); (mk_real_int64 187L); (mk_real_int64 398L); (mk_real_int64 210L); (mk_real_int64 608L); (mk_real_int64 582L); (mk_real_int64 321L); (mk_real_int64 485L); (mk_real_int64 178L); (mk_real_int64 217L); (mk_real_int64 328L); (mk_real_int64 493L); ]); +("ineq119", [2; 7; ], [(mk_real_int64 539L); (mk_real_int64 749L); ]); +("ineq120", [0; 3; 4; 5; ], [(mk_real_int64 36L); (mk_real_int64 155L); (mk_real_int64 31L); (mk_real_int64 150L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 3000L); (mk_real_int64 2550L); (mk_real_int64 3300L); (mk_real_int64 3275L); (mk_real_int64 3000L); (mk_real_int64 3000L); (mk_real_int64 1475L); (mk_real_int64 2450L); (mk_real_int64 3975L); (mk_real_int64 3975L); (mk_real_int64 3975L); (mk_real_int64 2475L); (mk_real_int64 3975L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_lo", [0; 2; 7; 8; 9; 10; 11; 19; 20; 22; 31; 38; 50; 59; ], [(mk_real_int64 712L); (mk_real_int64 167L); (mk_real_int64 297L); (mk_real_int64 694L); (mk_real_int64 76L); (mk_real_int64 649L); (mk_real_int64 885L); (mk_real_int64 840L); (mk_real_int64 286L); (mk_real_int64 204L); (mk_real_int64 498L); (mk_real_int64 54L); (mk_real_int64 158L); (mk_real_int64 382L); ]); +("azim_hi", [3; 4; 5; 12; 15; 23; 26; 27; 29; 30; 33; 37; 44; 45; 51; 57; ], [(mk_real_int64 490L); (mk_real_int64 498L); (mk_real_int64 700L); (mk_real_int64 608L); (mk_real_int64 608L); (mk_real_int64 328L); (mk_real_int64 62L); (mk_real_int64 537L); (mk_real_int64 148L); (mk_real_int64 460L); (mk_real_int64 608L); (mk_real_int64 332L); (mk_real_int64 610L); (mk_real_int64 428L); (mk_real_int64 522L); (mk_real_int64 328L); ]); +("rhazim_lo", [4; 20; 23; 25; 26; 29; 38; 41; 43; 50; 52; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_hi", [8; 9; 12; 13; 14; 15; 16; 34; 36; 45; 49; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_hi", [3; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 1652L); (mk_real_int64 3292L); (mk_real_int64 596L); (mk_real_int64 4204L); (mk_real_int64 4204L); (mk_real_int64 4204L); (mk_real_int64 2448L); (mk_real_int64 4204L); ]); +("rho_lo", [0; 1; 2; 4; 5; ], [(mk_real_int64 2164L); (mk_real_int64 1300L); (mk_real_int64 604L); (mk_real_int64 2164L); (mk_real_int64 2164L); ]); +("tau_hi", [1; ], [(mk_real_int64 1000L); ]); +("tau_lo", [2; 16; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("y1_hi", [9; 11; 15; 20; 25; 26; 29; 31; 32; 33; 34; 37; 39; 41; 43; 47; ], [(mk_real_int64 340L); (mk_real_int64 500L); (mk_real_int64 100L); (mk_real_int64 200L); (mk_real_int64 540L); (mk_real_int64 380L); (mk_real_int64 600L); (mk_real_int64 500L); (mk_real_int64 401L); (mk_real_int64 480L); (mk_real_int64 200L); (mk_real_int64 1L); (mk_real_int64 60L); (mk_real_int64 400L); (mk_real_int64 180L); (mk_real_int64 200L); ]); +("y1_lo", [16; 18; 19; 21; 44; 48; 51; 52; 57; 58; 59; ], [(mk_real_int64 400L); (mk_real_int64 400L); (mk_real_int64 327L); (mk_real_int64 79L); (mk_real_int64 120L); (mk_real_int64 340L); (mk_real_int64 120L); (mk_real_int64 100L); (mk_real_int64 400L); (mk_real_int64 500L); (mk_real_int64 180L); ]); +("y2_hi", [9; 10; 15; 25; 26; 32; 33; 34; 36; 37; 39; 41; 43; 44; 46; 47; 48; 51; 52; 58; ], [(mk_real_int64 92L); (mk_real_int64 64L); (mk_real_int64 100L); (mk_real_int64 160L); (mk_real_int64 220L); (mk_real_int64 401L); (mk_real_int64 480L); (mk_real_int64 552L); (mk_real_int64 352L); (mk_real_int64 17L); (mk_real_int64 32L); (mk_real_int64 364L); (mk_real_int64 144L); (mk_real_int64 556L); (mk_real_int64 48L); (mk_real_int64 352L); (mk_real_int64 420L); (mk_real_int64 396L); (mk_real_int64 4L); (mk_real_int64 152L); ]); +("y2_lo", [11; 16; 18; 19; 20; 21; 27; 29; 31; 42; 57; 59; ], [(mk_real_int64 136L); (mk_real_int64 84L); (mk_real_int64 84L); (mk_real_int64 307L); (mk_real_int64 208L); (mk_real_int64 259L); (mk_real_int64 340L); (mk_real_int64 524L); (mk_real_int64 432L); (mk_real_int64 400L); (mk_real_int64 144L); (mk_real_int64 180L); ]); +("y3_hi", [9; 10; 15; 25; 26; 32; 33; 34; 36; 37; 39; 41; 43; 44; 46; 47; 48; 51; 52; 58; ], [(mk_real_int64 92L); (mk_real_int64 64L); (mk_real_int64 100L); (mk_real_int64 160L); (mk_real_int64 220L); (mk_real_int64 401L); (mk_real_int64 480L); (mk_real_int64 552L); (mk_real_int64 352L); (mk_real_int64 17L); (mk_real_int64 32L); (mk_real_int64 364L); (mk_real_int64 144L); (mk_real_int64 556L); (mk_real_int64 48L); (mk_real_int64 352L); (mk_real_int64 420L); (mk_real_int64 396L); (mk_real_int64 4L); (mk_real_int64 152L); ]); +("y3_lo", [11; 16; 18; 19; 20; 21; 27; 29; 31; 42; 57; 59; ], [(mk_real_int64 136L); (mk_real_int64 84L); (mk_real_int64 84L); (mk_real_int64 307L); (mk_real_int64 208L); (mk_real_int64 259L); (mk_real_int64 340L); (mk_real_int64 524L); (mk_real_int64 432L); (mk_real_int64 400L); (mk_real_int64 144L); (mk_real_int64 180L); ]); +("y4_hi", [1; 2; 7; 11; 12; 21; 25; 31; 33; 34; 35; 36; 38; 39; 44; ], [(mk_real_int64 182L); (mk_real_int64 214L); (mk_real_int64 125L); (mk_real_int64 318L); (mk_real_int64 70L); (mk_real_int64 585L); (mk_real_int64 250L); (mk_real_int64 47L); (mk_real_int64 315L); (mk_real_int64 400L); (mk_real_int64 190L); (mk_real_int64 259L); (mk_real_int64 348L); (mk_real_int64 420L); (mk_real_int64 540L); ]); +("y4_lo", [3; 8; 10; 13; 17; 18; 19; 23; 24; 26; 28; 29; 40; 43; 45; 46; 47; ], [(mk_real_int64 111L); (mk_real_int64 15L); (mk_real_int64 15L); (mk_real_int64 159L); (mk_real_int64 50L); (mk_real_int64 225L); (mk_real_int64 525L); (mk_real_int64 7L); (mk_real_int64 324L); (mk_real_int64 330L); (mk_real_int64 330L); (mk_real_int64 214L); (mk_real_int64 115L); (mk_real_int64 134L); (mk_real_int64 240L); (mk_real_int64 523L); (mk_real_int64 125L); ]); +("y5_hi", [10; 15; 19; 33; 34; 36; 37; 39; 41; 42; 43; 46; 47; 51; 52; 58; ], [(mk_real_int64 64L); (mk_real_int64 125L); (mk_real_int64 13L); (mk_real_int64 250L); (mk_real_int64 552L); (mk_real_int64 552L); (mk_real_int64 292L); (mk_real_int64 472L); (mk_real_int64 364L); (mk_real_int64 400L); (mk_real_int64 239L); (mk_real_int64 48L); (mk_real_int64 352L); (mk_real_int64 141L); (mk_real_int64 204L); (mk_real_int64 152L); ]); +("y5_lo", [9; 11; 16; 18; 20; 21; 25; 26; 27; 29; 31; 32; 44; 48; 57; 59; ], [(mk_real_int64 36L); (mk_real_int64 136L); (mk_real_int64 84L); (mk_real_int64 84L); (mk_real_int64 208L); (mk_real_int64 34L); (mk_real_int64 5L); (mk_real_int64 285L); (mk_real_int64 340L); (mk_real_int64 524L); (mk_real_int64 432L); (mk_real_int64 324L); (mk_real_int64 300L); (mk_real_int64 115L); (mk_real_int64 144L); (mk_real_int64 125L); ]); +("y6_hi", [10; 15; 19; 27; 32; 33; 34; 36; 37; 39; 41; 42; 43; 46; 47; 51; 52; 58; ], [(mk_real_int64 64L); (mk_real_int64 125L); (mk_real_int64 13L); (mk_real_int64 660L); (mk_real_int64 676L); (mk_real_int64 250L); (mk_real_int64 552L); (mk_real_int64 552L); (mk_real_int64 292L); (mk_real_int64 472L); (mk_real_int64 364L); (mk_real_int64 400L); (mk_real_int64 239L); (mk_real_int64 48L); (mk_real_int64 352L); (mk_real_int64 141L); (mk_real_int64 204L); (mk_real_int64 152L); ]); +("y6_lo", [9; 11; 16; 18; 20; 21; 25; 26; 27; 29; 31; 32; 35; 39; 44; 45; 48; 57; 59; ], [(mk_real_int64 36L); (mk_real_int64 19136L); (mk_real_int64 84L); (mk_real_int64 84L); (mk_real_int64 208L); (mk_real_int64 244034L); (mk_real_int64 5L); (mk_real_int64 5285L); (mk_real_int64 69000L); (mk_real_int64 524L); (mk_real_int64 432L); (mk_real_int64 21000L); (mk_real_int64 16000L); (mk_real_int64 128000L); (mk_real_int64 300L); (mk_real_int64 208000L); (mk_real_int64 436115L); (mk_real_int64 144L); (mk_real_int64 125L); ]); +("y8_hi", [9; ], [(mk_real_int64 230000L); ]); +("ye_hi", [20; 22; 29; 31; 59; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_lo", [22; 36; 41; 42; 43; 49; ], [(mk_real_int64 74000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_hi", [0; 1; 2; 3; 8; 9; 10; 12; ], [(mk_real_int64 100L); (mk_real_int64 480L); (mk_real_int64 576L); (mk_real_int64 124L); (mk_real_int64 228L); (mk_real_int64 1228L); (mk_real_int64 1228L); (mk_real_int64 1228L); ]); +("yn_lo", [4; 5; 6; 7; 11; ], [(mk_real_int64 900L); (mk_real_int64 900L); (mk_real_int64 2210L); (mk_real_int64 531L); (mk_real_int64 762L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/147671934133_out.hl b/formal_lp/old/ineqs/tests2/147671934133_out.hl new file mode 100644 index 0000000..ca0682c --- /dev/null +++ b/formal_lp/old/ineqs/tests2/147671934133_out.hl @@ -0,0 +1,89 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "147671934133 19 4 0 1 2 3 3 0 3 4 3 4 3 5 3 5 3 2 3 5 2 6 4 6 2 7 8 3 7 2 1 3 7 1 9 3 9 1 10 3 10 1 0 4 10 0 11 12 3 11 0 4 3 11 4 6 3 4 5 6 3 11 6 8 3 12 11 8 3 8 7 9 3 12 8 9 3 9 10 12 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum_neg", [0; 4; 5; 8; 10; 11; 12; ], [(mk_real_int64 443L); (mk_real_int64 112L); (mk_real_int64 255L); (mk_real_int64 248L); (mk_real_int64 285L); (mk_real_int64 225L); (mk_real_int64 167L); ]); +("azim_sum", [7; 9; ], [(mk_real_int64 65L); (mk_real_int64 187L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 979L); (mk_real_int64 979L); (mk_real_int64 979L); (mk_real_int64 979L); (mk_real_int64 801L); (mk_real_int64 563L); (mk_real_int64 979L); (mk_real_int64 979L); (mk_real_int64 979L); (mk_real_int64 979L); (mk_real_int64 1010L); (mk_real_int64 959L); (mk_real_int64 901L); ]); +("sol_sum3", [0; 1; 2; 5; 15; ], [(mk_real_int64 112L); (mk_real_int64 255L); (mk_real_int64 27L); (mk_real_int64 248L); (mk_real_int64 148L); ]); +("sol_sum3_neg", [3; 8; 11; 12; ], [(mk_real_int64 181L); (mk_real_int64 354L); (mk_real_int64 35L); (mk_real_int64 144L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; ], [(mk_real_int64 801L); (mk_real_int64 563L); (mk_real_int64 563L); (mk_real_int64 563L); (mk_real_int64 968L); (mk_real_int64 979L); (mk_real_int64 716L); (mk_real_int64 959L); (mk_real_int64 625L); (mk_real_int64 689L); (mk_real_int64 563L); (mk_real_int64 979L); (mk_real_int64 901L); (mk_real_int64 731L); (mk_real_int64 725L); (mk_real_int64 872L); ]); +("tau_sum4_neg", [0; 1; 2; ], [(mk_real_int64 979L); (mk_real_int64 979L); (mk_real_int64 734L); ]); +("ln_def_neg", [0; 1; 2; 3; 6; 7; 8; 9; 10; 11; ], [(mk_real_int64 79L); (mk_real_int64 79L); (mk_real_int64 79L); (mk_real_int64 79L); (mk_real_int64 79L); (mk_real_int64 109L); (mk_real_int64 79L); (mk_real_int64 79L); (mk_real_int64 114L); (mk_real_int64 58L); ]); +("ln_def", [4; 5; 12; ], [(mk_real_int64 117L); (mk_real_int64 380L); (mk_real_int64 7L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 6151L); (mk_real_int64 6151L); (mk_real_int64 6151L); (mk_real_int64 6151L); (mk_real_int64 5033L); (mk_real_int64 3535L); (mk_real_int64 6151L); (mk_real_int64 6151L); (mk_real_int64 6151L); (mk_real_int64 6151L); (mk_real_int64 6346L); (mk_real_int64 6027L); (mk_real_int64 5659L); ]); +("edge_sym_neg", [2; 5; 9; 15; 22; 28; 33; 38; 40; 47; 50; 53; 56; ], [(mk_real_int64 218L); (mk_real_int64 187L); (mk_real_int64 53L); (mk_real_int64 31L); (mk_real_int64 12L); (mk_real_int64 4L); (mk_real_int64 57L); (mk_real_int64 73L); (mk_real_int64 267L); (mk_real_int64 70L); (mk_real_int64 48L); (mk_real_int64 5L); (mk_real_int64 75L); ]); +("edge_sym", [6; 8; 12; 17; 24; 25; 27; 41; ], [(mk_real_int64 142L); (mk_real_int64 88L); (mk_real_int64 7L); (mk_real_int64 1L); (mk_real_int64 7L); (mk_real_int64 5L); (mk_real_int64 12L); (mk_real_int64 106L); ]); +("y1_def", [5; 10; 13; 15; 36; 38; 43; 48; ], [(mk_real_int64 60L); (mk_real_int64 114L); (mk_real_int64 218L); (mk_real_int64 55L); (mk_real_int64 87L); (mk_real_int64 70L); (mk_real_int64 128L); (mk_real_int64 118L); ]); +("y1_def_neg", [4; 6; 7; 8; 12; 14; 20; 21; 24; 25; 27; 28; 30; 31; 39; 41; 44; 47; 53; 54; 55; 56; 57; 58; 59; ], [(mk_real_int64 107L); (mk_real_int64 112L); (mk_real_int64 95L); (mk_real_int64 155L); (mk_real_int64 59L); (mk_real_int64 57L); (mk_real_int64 6L); (mk_real_int64 6L); (mk_real_int64 106L); (mk_real_int64 35L); (mk_real_int64 9L); (mk_real_int64 11L); (mk_real_int64 10L); (mk_real_int64 12L); (mk_real_int64 239L); (mk_real_int64 19L); (mk_real_int64 114L); (mk_real_int64 104L); (mk_real_int64 4L); (mk_real_int64 5L); (mk_real_int64 52L); (mk_real_int64 28L); (mk_real_int64 78L); (mk_real_int64 28L); (mk_real_int64 5L); ]); +("y2_def_neg", [5; 6; 7; 10; 13; 20; 24; 25; 30; 38; 43; 47; 53; 56; 57; 58; ], [(mk_real_int64 40L); (mk_real_int64 112L); (mk_real_int64 4L); (mk_real_int64 35L); (mk_real_int64 66L); (mk_real_int64 7L); (mk_real_int64 105L); (mk_real_int64 38L); (mk_real_int64 10L); (mk_real_int64 21L); (mk_real_int64 39L); (mk_real_int64 83L); (mk_real_int64 7L); (mk_real_int64 28L); (mk_real_int64 78L); (mk_real_int64 19L); ]); +("y2_def", [4; 8; 12; 14; 15; 21; 27; 28; 31; 36; 39; 41; 44; 48; 54; 55; 59; ], [(mk_real_int64 65L); (mk_real_int64 64L); (mk_real_int64 29L); (mk_real_int64 35L); (mk_real_int64 77L); (mk_real_int64 4L); (mk_real_int64 6L); (mk_real_int64 7L); (mk_real_int64 7L); (mk_real_int64 150L); (mk_real_int64 80L); (mk_real_int64 12L); (mk_real_int64 69L); (mk_real_int64 35L); (mk_real_int64 3L); (mk_real_int64 31L); (mk_real_int64 3L); ]); +("y3_def_neg", [5; 6; 7; 10; 13; 20; 24; 25; 30; 38; 43; 47; 53; 56; 57; 58; ], [(mk_real_int64 40L); (mk_real_int64 112L); (mk_real_int64 4L); (mk_real_int64 35L); (mk_real_int64 66L); (mk_real_int64 7L); (mk_real_int64 105L); (mk_real_int64 38L); (mk_real_int64 10L); (mk_real_int64 21L); (mk_real_int64 39L); (mk_real_int64 83L); (mk_real_int64 7L); (mk_real_int64 28L); (mk_real_int64 78L); (mk_real_int64 19L); ]); +("y3_def", [4; 8; 12; 14; 15; 21; 27; 28; 31; 36; 39; 41; 44; 48; 54; 55; 59; ], [(mk_real_int64 65L); (mk_real_int64 64L); (mk_real_int64 29L); (mk_real_int64 35L); (mk_real_int64 77L); (mk_real_int64 4L); (mk_real_int64 6L); (mk_real_int64 7L); (mk_real_int64 7L); (mk_real_int64 150L); (mk_real_int64 80L); (mk_real_int64 12L); (mk_real_int64 69L); (mk_real_int64 35L); (mk_real_int64 3L); (mk_real_int64 31L); (mk_real_int64 3L); ]); +("y4_def", [1; 3; 6; 9; 17; 26; 31; 36; 46; ], [(mk_real_int64 155L); (mk_real_int64 18L); (mk_real_int64 176L); (mk_real_int64 337L); (mk_real_int64 85L); (mk_real_int64 109L); (mk_real_int64 197L); (mk_real_int64 70L); (mk_real_int64 42L); ]); +("y4_def_neg", [0; 2; 4; 8; 10; 11; 12; 13; 16; 19; 20; 22; 23; 24; 27; 29; 32; 35; 42; 43; 44; 45; 47; ], [(mk_real_int64 122L); (mk_real_int64 78L); (mk_real_int64 169L); (mk_real_int64 54L); (mk_real_int64 65L); (mk_real_int64 51L); (mk_real_int64 4L); (mk_real_int64 7L); (mk_real_int64 74L); (mk_real_int64 10L); (mk_real_int64 12L); (mk_real_int64 7L); (mk_real_int64 14L); (mk_real_int64 120L); (mk_real_int64 278L); (mk_real_int64 22L); (mk_real_int64 131L); (mk_real_int64 106L); (mk_real_int64 6L); (mk_real_int64 59L); (mk_real_int64 20L); (mk_real_int64 54L); (mk_real_int64 6L); ]); +("y5_def", [4; 5; 7; 8; 12; 14; 21; 25; 27; 28; 31; 39; 41; 44; 54; 55; 58; 59; ], [(mk_real_int64 65L); (mk_real_int64 13L); (mk_real_int64 117L); (mk_real_int64 70L); (mk_real_int64 42L); (mk_real_int64 35L); (mk_real_int64 4L); (mk_real_int64 79L); (mk_real_int64 6L); (mk_real_int64 7L); (mk_real_int64 7L); (mk_real_int64 95L); (mk_real_int64 12L); (mk_real_int64 69L); (mk_real_int64 3L); (mk_real_int64 31L); (mk_real_int64 51L); (mk_real_int64 3L); ]); +("y5_def_neg", [6; 10; 13; 15; 20; 24; 30; 34; 36; 38; 43; 47; 48; 53; 56; 57; ], [(mk_real_int64 78L); (mk_real_int64 35L); (mk_real_int64 66L); (mk_real_int64 27L); (mk_real_int64 5L); (mk_real_int64 73L); (mk_real_int64 7L); (mk_real_int64 57L); (mk_real_int64 52L); (mk_real_int64 21L); (mk_real_int64 39L); (mk_real_int64 70L); (mk_real_int64 48L); (mk_real_int64 5L); (mk_real_int64 20L); (mk_real_int64 54L); ]); +("y6_def", [4; 5; 7; 8; 12; 13; 14; 21; 25; 27; 28; 29; 31; 39; 41; 42; 44; 46; 54; 55; 58; 59; ], [(mk_real_int64 65L); (mk_real_int64 13L); (mk_real_int64 117L); (mk_real_int64 70L); (mk_real_int64 42L); (mk_real_int64 10L); (mk_real_int64 35L); (mk_real_int64 4L); (mk_real_int64 79L); (mk_real_int64 6L); (mk_real_int64 7L); (mk_real_int64 9L); (mk_real_int64 7L); (mk_real_int64 95L); (mk_real_int64 12L); (mk_real_int64 222L); (mk_real_int64 69L); (mk_real_int64 70L); (mk_real_int64 36L); (mk_real_int64 31L); (mk_real_int64 51L); (mk_real_int64 88L); ]); +("y6_def_neg", [6; 10; 15; 20; 24; 30; 36; 38; 43; 47; 53; 56; 57; ], [(mk_real_int64 78L); (mk_real_int64 35L); (mk_real_int64 27L); (mk_real_int64 5L); (mk_real_int64 73L); (mk_real_int64 7L); (mk_real_int64 52L); (mk_real_int64 21L); (mk_real_int64 39L); (mk_real_int64 70L); (mk_real_int64 5L); (mk_real_int64 20L); (mk_real_int64 41L); ]); +("y8_def_neg", [11; ], [(mk_real_int64 57L); ]); +("RHA", [5; 7; 8; 11; 12; 14; 15; 20; 22; 25; 26; 27; 28; 30; 32; 33; 34; 35; 36; 37; 38; 40; 41; 42; 44; 49; 50; 51; 52; 53; 54; 55; 56; 57; 58; 59; ], [(mk_real_int64 178L); (mk_real_int64 145L); (mk_real_int64 188L); (mk_real_int64 416L); (mk_real_int64 325L); (mk_real_int64 322L); (mk_real_int64 393L); (mk_real_int64 11L); (mk_real_int64 11L); (mk_real_int64 31L); (mk_real_int64 294L); (mk_real_int64 248L); (mk_real_int64 225L); (mk_real_int64 20L); (mk_real_int64 225L); (mk_real_int64 245L); (mk_real_int64 245L); (mk_real_int64 167L); (mk_real_int64 289L); (mk_real_int64 354L); (mk_real_int64 176L); (mk_real_int64 112L); (mk_real_int64 258L); (mk_real_int64 239L); (mk_real_int64 226L); (mk_real_int64 78L); (mk_real_int64 78L); (mk_real_int64 248L); (mk_real_int64 248L); (mk_real_int64 279L); (mk_real_int64 167L); (mk_real_int64 168L); (mk_real_int64 285L); (mk_real_int64 138L); (mk_real_int64 78L); (mk_real_int64 19L); ]); +("yy10", [2; 14; ], [(mk_real_int64 218L); (mk_real_int64 345L); ]); +("tau4", [1; ], [(mk_real_int64 184L); ]); +("ineq106", [0; 3; 4; 8; 10; 11; 13; 19; 20; 23; 24; 27; 29; 32; 42; 43; 46; 47; ], [(mk_real_int64 178L); (mk_real_int64 94L); (mk_real_int64 228L); (mk_real_int64 91L); (mk_real_int64 95L); (mk_real_int64 23L); (mk_real_int64 11L); (mk_real_int64 15L); (mk_real_int64 18L); (mk_real_int64 20L); (mk_real_int64 65L); (mk_real_int64 290L); (mk_real_int64 32L); (mk_real_int64 191L); (mk_real_int64 9L); (mk_real_int64 86L); (mk_real_int64 9L); (mk_real_int64 9L); ]); +("ineq107", [1; 6; 9; 12; 17; 26; 31; 36; 41; ], [(mk_real_int64 153L); (mk_real_int64 228L); (mk_real_int64 436L); (mk_real_int64 1L); (mk_real_int64 6L); (mk_real_int64 141L); (mk_real_int64 255L); (mk_real_int64 127L); (mk_real_int64 6L); ]); +("ineq108", [16; 27; 35; ], [(mk_real_int64 1L); (mk_real_int64 65L); (mk_real_int64 34L); ]); +("ineq109", [1; 3; 8; 17; 46; ], [(mk_real_int64 112L); (mk_real_int64 255L); (mk_real_int64 27L); (mk_real_int64 248L); (mk_real_int64 148L); ]); +("ineq110", [11; 24; 35; 36; ], [(mk_real_int64 181L); (mk_real_int64 354L); (mk_real_int64 35L); (mk_real_int64 144L); ]); +("ineq111", [2; 4; 12; 16; 22; 24; 27; 35; 41; 44; 45; ], [(mk_real_int64 622L); (mk_real_int64 103L); (mk_real_int64 38L); (mk_real_int64 585L); (mk_real_int64 57L); (mk_real_int64 49L); (mk_real_int64 276L); (mk_real_int64 608L); (mk_real_int64 36L); (mk_real_int64 158L); (mk_real_int64 434L); ]); +("ineq113", [12; 21; 26; 34; 36; ], [(mk_real_int64 914L); (mk_real_int64 870L); (mk_real_int64 576L); (mk_real_int64 136L); (mk_real_int64 707L); ]); +("ineq114", [0; 3; 8; 10; 11; 14; 16; 18; 19; 22; 29; 30; 32; 33; 35; 38; 39; 43; ], [(mk_real_int64 179L); (mk_real_int64 460L); (mk_real_int64 563L); (mk_real_int64 224L); (mk_real_int64 338L); (mk_real_int64 17L); (mk_real_int64 394L); (mk_real_int64 15L); (mk_real_int64 396L); (mk_real_int64 32L); (mk_real_int64 413L); (mk_real_int64 202L); (mk_real_int64 361L); (mk_real_int64 48L); (mk_real_int64 187L); (mk_real_int64 194L); (mk_real_int64 695L); (mk_real_int64 567L); ]); +("ineq119", [3; 6; ], [(mk_real_int64 979L); (mk_real_int64 548L); ]); +("ineq120", [7; 9; 10; ], [(mk_real_int64 246L); (mk_real_int64 324L); (mk_real_int64 410L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 2575L); (mk_real_int64 2575L); (mk_real_int64 2575L); (mk_real_int64 2575L); (mk_real_int64 2225L); (mk_real_int64 1375L); (mk_real_int64 2575L); (mk_real_int64 32575L); (mk_real_int64 2575L); (mk_real_int64 2575L); (mk_real_int64 3450L); (mk_real_int64 3275L); (mk_real_int64 2675L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [4; 12; 26; 30; 33; 34; 41; 45; 48; 49; 50; 51; ], [(mk_real_int64 54L); (mk_real_int64 438L); (mk_real_int64 390L); (mk_real_int64 32L); (mk_real_int64 592L); (mk_real_int64 780L); (mk_real_int64 538L); (mk_real_int64 48L); (mk_real_int64 887L); (mk_real_int64 1000L); (mk_real_int64 444L); (mk_real_int64 70L); ]); +("azim_lo", [3; 7; 14; 15; 18; 19; 20; 22; 24; 27; 29; 38; 42; 44; 46; 47; 55; 57; 58; ], [(mk_real_int64 487L); (mk_real_int64 40L); (mk_real_int64 776L); (mk_real_int64 412L); (mk_real_int64 244L); (mk_real_int64 532L); (mk_real_int64 726L); (mk_real_int64 358L); (mk_real_int64 356L); (mk_real_int64 104L); (mk_real_int64 330L); (mk_real_int64 184L); (mk_real_int64 548L); (mk_real_int64 14L); (mk_real_int64 224L); (mk_real_int64 938L); (mk_real_int64 58L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_lo", [59; ], [(mk_real_int64 1000L); ]); +("rhazim_hi", [7; 14; 42; 44; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 12; ], [(mk_real_int64 1036L); (mk_real_int64 1036L); (mk_real_int64 1036L); (mk_real_int64 1036L); (mk_real_int64 484L); (mk_real_int64 2892L); (mk_real_int64 1036L); (mk_real_int64 1036L); (mk_real_int64 1036L); (mk_real_int64 1036L); (mk_real_int64 840L); (mk_real_int64 2884L); ]); +("rho_lo", [11; ], [(mk_real_int64 644L); ]); +("tau_hi", [6; 18; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("tau_lo", [4; 5; 8; 18; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 305000L); (mk_real_int64 439000L); ]); +("y1_hi", [4; 6; 7; 12; 24; 25; 28; 38; 39; 48; 53; 55; 58; ], [(mk_real_int64 200L); (mk_real_int64 40L); (mk_real_int64 95L); (mk_real_int64 323L); (mk_real_int64 465L); (mk_real_int64 552L); (mk_real_int64 200L); (mk_real_int64 500L); (mk_real_int64 45L); (mk_real_int64 220L); (mk_real_int64 520L); (mk_real_int64 400L); (mk_real_int64 252L); ]); +("y1_lo", [5; 8; 15; 20; 21; 30; 36; 41; 43; 44; 47; 54; 56; 57; 59; ], [(mk_real_int64 412L); (mk_real_int64 340L); (mk_real_int64 20L); (mk_real_int64 340L); (mk_real_int64 600L); (mk_real_int64 260L); (mk_real_int64 300L); (mk_real_int64 200L); (mk_real_int64 500L); (mk_real_int64 600L); (mk_real_int64 130L); (mk_real_int64 400L); (mk_real_int64 440L); (mk_real_int64 120L); (mk_real_int64 400L); ]); +("y2_lo", [4; 5; 7; 13; 14; 25; 27; 28; 30; 36; 38; 39; 41; 47; 53; 56; 57; 58; ], [(mk_real_int64 208L); (mk_real_int64 168L); (mk_real_int64 289L); (mk_real_int64 272L); (mk_real_int64 420L); (mk_real_int64 360L); (mk_real_int64 540L); (mk_real_int64 448L); (mk_real_int64 260L); (mk_real_int64 640L); (mk_real_int64 432L); (mk_real_int64 460L); (mk_real_int64 352L); (mk_real_int64 764L); (mk_real_int64 392L); (mk_real_int64 440L); (mk_real_int64 120L); (mk_real_int64 72L); ]); +("y2_hi", [6; 8; 10; 12; 15; 20; 21; 24; 31; 43; 44; 48; 54; 55; 59; ], [(mk_real_int64 40L); (mk_real_int64 452L); (mk_real_int64 344L); (mk_real_int64 47L); (mk_real_int64 152L); (mk_real_int64 8L); (mk_real_int64 4L); (mk_real_int64 64L); (mk_real_int64 280L); (mk_real_int64 240L); (mk_real_int64 524L); (mk_real_int64 416L); (mk_real_int64 276L); (mk_real_int64 304L); (mk_real_int64 276L); ]); +("y3_lo", [4; 5; 7; 13; 14; 25; 27; 28; 30; 36; 38; 39; 41; 47; 53; 56; 57; 58; ], [(mk_real_int64 208L); (mk_real_int64 168L); (mk_real_int64 289L); (mk_real_int64 272L); (mk_real_int64 420L); (mk_real_int64 360L); (mk_real_int64 540L); (mk_real_int64 448L); (mk_real_int64 260L); (mk_real_int64 640L); (mk_real_int64 432L); (mk_real_int64 460L); (mk_real_int64 352L); (mk_real_int64 764L); (mk_real_int64 392L); (mk_real_int64 440L); (mk_real_int64 120L); (mk_real_int64 72L); ]); +("y3_hi", [6; 8; 10; 12; 15; 20; 21; 24; 31; 43; 44; 48; 54; 55; 59; ], [(mk_real_int64 40L); (mk_real_int64 452L); (mk_real_int64 344L); (mk_real_int64 47L); (mk_real_int64 152L); (mk_real_int64 8L); (mk_real_int64 4L); (mk_real_int64 64L); (mk_real_int64 280L); (mk_real_int64 240L); (mk_real_int64 524L); (mk_real_int64 416L); (mk_real_int64 276L); (mk_real_int64 304L); (mk_real_int64 276L); ]); +("y4_hi", [0; 2; 3; 6; 8; 9; 12; 16; 23; 27; 29; 31; 32; 41; 43; 44; ], [(mk_real_int64 70L); (mk_real_int64 250L); (mk_real_int64 230L); (mk_real_int64 244L); (mk_real_int64 413L); (mk_real_int64 28L); (mk_real_int64 23L); (mk_real_int64 190L); (mk_real_int64 300L); (mk_real_int64 325L); (mk_real_int64 80L); (mk_real_int64 115L); (mk_real_int64 165L); (mk_real_int64 138L); (mk_real_int64 90L); (mk_real_int64 250L); ]); +("y4_lo", [1; 4; 10; 11; 13; 17; 19; 20; 22; 24; 26; 35; 36; 42; 45; 46; 47; ], [(mk_real_int64 443L); (mk_real_int64 55L); (mk_real_int64 75L); (mk_real_int64 231L); (mk_real_int64 535L); (mk_real_int64 10L); (mk_real_int64 275L); (mk_real_int64 330L); (mk_real_int64 125L); (mk_real_int64 34L); (mk_real_int64 7L); (mk_real_int64 150L); (mk_real_int64 53L); (mk_real_int64 165L); (mk_real_int64 250L); (mk_real_int64 213L); (mk_real_int64 165L); ]); +("y5_lo", [4; 7; 12; 13; 14; 15; 27; 28; 30; 38; 39; 41; 47; 53; 57; ], [(mk_real_int64 208L); (mk_real_int64 164L); (mk_real_int64 128L); (mk_real_int64 272L); (mk_real_int64 420L); (mk_real_int64 104L); (mk_real_int64 540L); (mk_real_int64 448L); (mk_real_int64 125L); (mk_real_int64 432L); (mk_real_int64 280L); (mk_real_int64 352L); (mk_real_int64 484L); (mk_real_int64 412L); (mk_real_int64 250L); ]); +("y5_hi", [5; 6; 8; 10; 20; 21; 24; 25; 31; 36; 43; 44; 48; 54; 55; 56; 58; 59; ], [(mk_real_int64 32L); (mk_real_int64 250L); (mk_real_int64 117L); (mk_real_int64 344L); (mk_real_int64 98L); (mk_real_int64 4L); (mk_real_int64 239L); (mk_real_int64 440L); (mk_real_int64 280L); (mk_real_int64 151L); (mk_real_int64 240L); (mk_real_int64 524L); (mk_real_int64 472L); (mk_real_int64 276L); (mk_real_int64 304L); (mk_real_int64 250L); (mk_real_int64 228L); (mk_real_int64 276L); ]); +("y6_lo", [4; 7; 12; 13; 14; 15; 27; 28; 29; 30; 38; 39; 41; 42; 46; 47; 48; 53; 54; 57; 59; ], [(mk_real_int64 208L); (mk_real_int64 164L); (mk_real_int64 128L); (mk_real_int64 76272L); (mk_real_int64 420L); (mk_real_int64 104L); (mk_real_int64 540L); (mk_real_int64 448L); (mk_real_int64 9000L); (mk_real_int64 125L); (mk_real_int64 432L); (mk_real_int64 280L); (mk_real_int64 352L); (mk_real_int64 222000L); (mk_real_int64 70000L); (mk_real_int64 484L); (mk_real_int64 48000L); (mk_real_int64 412L); (mk_real_int64 33000L); (mk_real_int64 13250L); (mk_real_int64 85000L); ]); +("y6_hi", [5; 6; 8; 10; 20; 21; 24; 25; 31; 36; 43; 44; 48; 54; 55; 56; 58; 59; ], [(mk_real_int64 32L); (mk_real_int64 250L); (mk_real_int64 117L); (mk_real_int64 344L); (mk_real_int64 98L); (mk_real_int64 4L); (mk_real_int64 239L); (mk_real_int64 440L); (mk_real_int64 280L); (mk_real_int64 151L); (mk_real_int64 240L); (mk_real_int64 524L); (mk_real_int64 472L); (mk_real_int64 276L); (mk_real_int64 304L); (mk_real_int64 250L); (mk_real_int64 228L); (mk_real_int64 276L); ]); +("y8_hi", [11; ], [(mk_real_int64 57000L); ]); +("ye_hi", [9; 13; 15; 26; 27; 28; 37; 40; 41; 59; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_lo", [10; 15; 17; 24; 42; 43; 44; 54; 56; ], [(mk_real_int64 1000L); (mk_real_int64 128000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_lo", [0; 1; 2; 3; 4; 5; 8; 9; ], [(mk_real_int64 4L); (mk_real_int64 1004L); (mk_real_int64 4L); (mk_real_int64 4L); (mk_real_int64 991L); (mk_real_int64 740L); (mk_real_int64 4L); (mk_real_int64 1004L); ]); +("yn_hi", [6; 7; 10; 11; 12; ], [(mk_real_int64 996L); (mk_real_int64 716L); (mk_real_int64 336L); (mk_real_int64 592L); (mk_real_int64 539L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/156401568298_out.hl b/formal_lp/old/ineqs/tests2/156401568298_out.hl new file mode 100644 index 0000000..a9ba005 --- /dev/null +++ b/formal_lp/old/ineqs/tests2/156401568298_out.hl @@ -0,0 +1,82 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "156401568298 24 4 0 1 2 3 3 0 3 4 3 4 3 5 3 5 3 2 3 5 2 6 3 6 2 7 3 7 2 1 3 7 1 8 3 8 1 9 3 9 1 0 3 9 0 10 3 10 0 4 3 10 4 11 3 11 4 5 3 11 5 6 3 11 6 12 4 12 6 7 13 3 13 7 8 3 13 8 14 3 14 8 9 3 14 9 10 3 14 10 12 3 10 11 12 3 12 13 14 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [1; 2; 3; 6; 7; 10; 12; ], [(mk_real_int64 233L); (mk_real_int64 233L); (mk_real_int64 58L); (mk_real_int64 233L); (mk_real_int64 233L); (mk_real_int64 650L); (mk_real_int64 58L); ]); +("azim_sum_neg", [0; 4; 5; 8; 13; 14; ], [(mk_real_int64 110L); (mk_real_int64 4L); (mk_real_int64 104L); (mk_real_int64 104L); (mk_real_int64 110L); (mk_real_int64 4L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 1055L); (mk_real_int64 1131L); (mk_real_int64 1131L); (mk_real_int64 1131L); (mk_real_int64 1110L); (mk_real_int64 1055L); (mk_real_int64 1131L); (mk_real_int64 1131L); (mk_real_int64 1055L); (mk_real_int64 1110L); (mk_real_int64 1110L); (mk_real_int64 1110L); (mk_real_int64 1131L); (mk_real_int64 1055L); (mk_real_int64 1110L); ]); +("sol_sum3", [1; 2; 15; 16; ], [(mk_real_int64 104L); (mk_real_int64 104L); (mk_real_int64 104L); (mk_real_int64 104L); ]); +("sol_sum3_neg", [4; 5; 10; 19; ], [(mk_real_int64 233L); (mk_real_int64 233L); (mk_real_int64 33L); (mk_real_int64 33L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; ], [(mk_real_int64 1055L); (mk_real_int64 1055L); (mk_real_int64 1055L); (mk_real_int64 1055L); (mk_real_int64 1131L); (mk_real_int64 1131L); (mk_real_int64 1055L); (mk_real_int64 1055L); (mk_real_int64 1110L); (mk_real_int64 1110L); (mk_real_int64 1110L); (mk_real_int64 1110L); (mk_real_int64 1055L); (mk_real_int64 1055L); (mk_real_int64 1110L); (mk_real_int64 1055L); (mk_real_int64 1055L); (mk_real_int64 1055L); (mk_real_int64 1110L); (mk_real_int64 1110L); (mk_real_int64 1110L); (mk_real_int64 1055L); ]); +("tau_sum4_neg", [0; 1; ], [(mk_real_int64 1131L); (mk_real_int64 1131L); ]); +("ln_def_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 164L); (mk_real_int64 247L); (mk_real_int64 247L); (mk_real_int64 247L); (mk_real_int64 224L); (mk_real_int64 164L); (mk_real_int64 247L); (mk_real_int64 247L); (mk_real_int64 164L); (mk_real_int64 224L); (mk_real_int64 224L); (mk_real_int64 224L); (mk_real_int64 247L); (mk_real_int64 164L); (mk_real_int64 224L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 6632L); (mk_real_int64 7107L); (mk_real_int64 7107L); (mk_real_int64 7107L); (mk_real_int64 6975L); (mk_real_int64 6632L); (mk_real_int64 7107L); (mk_real_int64 7107L); (mk_real_int64 6632L); (mk_real_int64 6975L); (mk_real_int64 6975L); (mk_real_int64 6975L); (mk_real_int64 7107L); (mk_real_int64 6632L); (mk_real_int64 6975L); ]); +("edge_sym_neg", [5; 8; 9; 12; 15; 17; 21; 23; 27; 30; 32; 33; 36; 38; 42; 48; 55; 58; 66; 67; ], [(mk_real_int64 230L); (mk_real_int64 68L); (mk_real_int64 63L); (mk_real_int64 11L); (mk_real_int64 195L); (mk_real_int64 187L); (mk_real_int64 119L); (mk_real_int64 195L); (mk_real_int64 133L); (mk_real_int64 78L); (mk_real_int64 23L); (mk_real_int64 63L); (mk_real_int64 59L); (mk_real_int64 379L); (mk_real_int64 118L); (mk_real_int64 78L); (mk_real_int64 16L); (mk_real_int64 68L); (mk_real_int64 20L); (mk_real_int64 11L); ]); +("edge_sym", [6; 14; 24; 26; 39; 45; 57; 61; 64; ], [(mk_real_int64 11L); (mk_real_int64 119L); (mk_real_int64 11L); (mk_real_int64 43L); (mk_real_int64 63L); (mk_real_int64 43L); (mk_real_int64 175L); (mk_real_int64 379L); (mk_real_int64 59L); ]); +("y1_def", [5; 13; 21; 24; 25; 36; 44; 53; 65; ], [(mk_real_int64 55L); (mk_real_int64 52L); (mk_real_int64 89L); (mk_real_int64 52L); (mk_real_int64 52L); (mk_real_int64 19L); (mk_real_int64 52L); (mk_real_int64 3L); (mk_real_int64 19L); ]); +("y1_def_neg", [4; 6; 8; 9; 11; 14; 15; 18; 20; 22; 23; 26; 27; 29; 30; 31; 32; 35; 37; 38; 40; 42; 43; 45; 47; 48; 55; 56; 58; 60; 61; 62; 64; 66; 67; 69; 70; 71; 72; ], [(mk_real_int64 59L); (mk_real_int64 175L); (mk_real_int64 13L); (mk_real_int64 145L); (mk_real_int64 84L); (mk_real_int64 170L); (mk_real_int64 45L); (mk_real_int64 115L); (mk_real_int64 204L); (mk_real_int64 76L); (mk_real_int64 139L); (mk_real_int64 168L); (mk_real_int64 33L); (mk_real_int64 145L); (mk_real_int64 26L); (mk_real_int64 13L); (mk_real_int64 26L); (mk_real_int64 28L); (mk_real_int64 98L); (mk_real_int64 131L); (mk_real_int64 33L); (mk_real_int64 123L); (mk_real_int64 156L); (mk_real_int64 45L); (mk_real_int64 145L); (mk_real_int64 26L); (mk_real_int64 87L); (mk_real_int64 13L); (mk_real_int64 145L); (mk_real_int64 123L); (mk_real_int64 33L); (mk_real_int64 131L); (mk_real_int64 98L); (mk_real_int64 10L); (mk_real_int64 18L); (mk_real_int64 13L); (mk_real_int64 26L); (mk_real_int64 59L); (mk_real_int64 121L); ]); +("y2_def_neg", [5; 6; 8; 9; 11; 13; 14; 18; 20; 23; 24; 25; 26; 29; 31; 36; 38; 42; 43; 44; 47; 53; 55; 56; 58; 60; 62; 65; 66; 69; 72; ], [(mk_real_int64 17L); (mk_real_int64 175L); (mk_real_int64 17L); (mk_real_int64 145L); (mk_real_int64 88L); (mk_real_int64 16L); (mk_real_int64 18L); (mk_real_int64 115L); (mk_real_int64 204L); (mk_real_int64 66L); (mk_real_int64 16L); (mk_real_int64 16L); (mk_real_int64 95L); (mk_real_int64 125L); (mk_real_int64 13L); (mk_real_int64 6L); (mk_real_int64 134L); (mk_real_int64 191L); (mk_real_int64 103L); (mk_real_int64 16L); (mk_real_int64 125L); (mk_real_int64 1L); (mk_real_int64 87L); (mk_real_int64 17L); (mk_real_int64 145L); (mk_real_int64 191L); (mk_real_int64 134L); (mk_real_int64 6L); (mk_real_int64 10L); (mk_real_int64 13L); (mk_real_int64 192L); ]); +("y2_def", [4; 15; 21; 22; 27; 30; 32; 35; 37; 40; 45; 48; 61; 64; 67; 70; 71; ], [(mk_real_int64 48L); (mk_real_int64 28L); (mk_real_int64 89L); (mk_real_int64 75L); (mk_real_int64 20L); (mk_real_int64 29L); (mk_real_int64 29L); (mk_real_int64 7L); (mk_real_int64 152L); (mk_real_int64 20L); (mk_real_int64 28L); (mk_real_int64 29L); (mk_real_int64 20L); (mk_real_int64 152L); (mk_real_int64 16L); (mk_real_int64 29L); (mk_real_int64 48L); ]); +("y3_def_neg", [5; 6; 8; 9; 11; 13; 14; 18; 20; 23; 24; 25; 26; 29; 31; 36; 38; 42; 43; 44; 47; 53; 55; 56; 58; 60; 62; 65; 66; 69; 72; ], [(mk_real_int64 17L); (mk_real_int64 175L); (mk_real_int64 17L); (mk_real_int64 145L); (mk_real_int64 88L); (mk_real_int64 16L); (mk_real_int64 18L); (mk_real_int64 115L); (mk_real_int64 204L); (mk_real_int64 66L); (mk_real_int64 16L); (mk_real_int64 16L); (mk_real_int64 95L); (mk_real_int64 125L); (mk_real_int64 13L); (mk_real_int64 6L); (mk_real_int64 134L); (mk_real_int64 191L); (mk_real_int64 103L); (mk_real_int64 16L); (mk_real_int64 125L); (mk_real_int64 1L); (mk_real_int64 87L); (mk_real_int64 17L); (mk_real_int64 145L); (mk_real_int64 191L); (mk_real_int64 134L); (mk_real_int64 6L); (mk_real_int64 10L); (mk_real_int64 13L); (mk_real_int64 192L); ]); +("y3_def", [4; 15; 21; 22; 27; 30; 32; 35; 37; 40; 45; 48; 61; 64; 67; 70; 71; ], [(mk_real_int64 48L); (mk_real_int64 28L); (mk_real_int64 89L); (mk_real_int64 75L); (mk_real_int64 20L); (mk_real_int64 29L); (mk_real_int64 29L); (mk_real_int64 7L); (mk_real_int64 152L); (mk_real_int64 20L); (mk_real_int64 28L); (mk_real_int64 29L); (mk_real_int64 20L); (mk_real_int64 152L); (mk_real_int64 16L); (mk_real_int64 29L); (mk_real_int64 48L); ]); +("y4_def", [1; 4; 9; 20; 21; 32; 40; 45; 48; 57; ], [(mk_real_int64 85L); (mk_real_int64 38L); (mk_real_int64 81L); (mk_real_int64 81L); (mk_real_int64 81L); (mk_real_int64 29L); (mk_real_int64 81L); (mk_real_int64 4L); (mk_real_int64 38L); (mk_real_int64 29L); ]); +("y4_def_neg", [0; 2; 5; 7; 10; 11; 14; 16; 17; 18; 19; 22; 23; 25; 26; 27; 28; 31; 33; 34; 36; 38; 39; 41; 43; 44; 47; 50; 52; 53; 54; 56; 58; 59; 61; 62; 63; 64; ], [(mk_real_int64 91L); (mk_real_int64 122L); (mk_real_int64 101L); (mk_real_int64 11L); (mk_real_int64 206L); (mk_real_int64 52L); (mk_real_int64 187L); (mk_real_int64 141L); (mk_real_int64 46L); (mk_real_int64 141L); (mk_real_int64 117L); (mk_real_int64 137L); (mk_real_int64 37L); (mk_real_int64 107L); (mk_real_int64 54L); (mk_real_int64 9L); (mk_real_int64 54L); (mk_real_int64 53L); (mk_real_int64 286L); (mk_real_int64 89L); (mk_real_int64 37L); (mk_real_int64 41L); (mk_real_int64 123L); (mk_real_int64 52L); (mk_real_int64 107L); (mk_real_int64 54L); (mk_real_int64 16L); (mk_real_int64 101L); (mk_real_int64 41L); (mk_real_int64 37L); (mk_real_int64 89L); (mk_real_int64 286L); (mk_real_int64 22L); (mk_real_int64 31L); (mk_real_int64 9L); (mk_real_int64 54L); (mk_real_int64 91L); (mk_real_int64 37L); ]); +("y5_def_neg", [5; 6; 9; 11; 13; 18; 20; 21; 23; 24; 25; 26; 29; 31; 35; 36; 38; 42; 43; 44; 47; 53; 55; 58; 60; 62; 65; 66; 69; 72; ], [(mk_real_int64 17L); (mk_real_int64 122L); (mk_real_int64 101L); (mk_real_int64 16L); (mk_real_int64 16L); (mk_real_int64 187L); (mk_real_int64 141L); (mk_real_int64 46L); (mk_real_int64 37L); (mk_real_int64 16L); (mk_real_int64 16L); (mk_real_int64 58L); (mk_real_int64 85L); (mk_real_int64 9L); (mk_real_int64 6L); (mk_real_int64 6L); (mk_real_int64 93L); (mk_real_int64 138L); (mk_real_int64 65L); (mk_real_int64 16L); (mk_real_int64 85L); (mk_real_int64 1L); (mk_real_int64 16L); (mk_real_int64 101L); (mk_real_int64 138L); (mk_real_int64 93L); (mk_real_int64 6L); (mk_real_int64 22L); (mk_real_int64 9L); (mk_real_int64 139L); ]); +("y5_def", [4; 8; 14; 15; 22; 27; 30; 32; 37; 40; 45; 48; 56; 61; 64; 67; 70; 71; ], [(mk_real_int64 48L); (mk_real_int64 33L); (mk_real_int64 10L); (mk_real_int64 28L); (mk_real_int64 75L); (mk_real_int64 20L); (mk_real_int64 29L); (mk_real_int64 29L); (mk_real_int64 152L); (mk_real_int64 20L); (mk_real_int64 28L); (mk_real_int64 29L); (mk_real_int64 33L); (mk_real_int64 20L); (mk_real_int64 152L); (mk_real_int64 16L); (mk_real_int64 29L); (mk_real_int64 48L); ]); +("y6_def_neg", [5; 6; 9; 20; 21; 23; 24; 26; 29; 35; 36; 38; 42; 47; 55; 58; 62; 65; 66; ], [(mk_real_int64 17L); (mk_real_int64 122L); (mk_real_int64 101L); (mk_real_int64 141L); (mk_real_int64 46L); (mk_real_int64 37L); (mk_real_int64 16L); (mk_real_int64 58L); (mk_real_int64 29L); (mk_real_int64 6L); (mk_real_int64 6L); (mk_real_int64 93L); (mk_real_int64 138L); (mk_real_int64 29L); (mk_real_int64 16L); (mk_real_int64 101L); (mk_real_int64 93L); (mk_real_int64 6L); (mk_real_int64 22L); ]); +("y6_def", [4; 7; 8; 10; 13; 14; 15; 16; 19; 22; 25; 27; 28; 30; 31; 32; 37; 40; 41; 43; 44; 45; 46; 48; 53; 56; 60; 61; 64; 67; 69; 70; 71; 72; ], [(mk_real_int64 139L); (mk_real_int64 298L); (mk_real_int64 33L); (mk_real_int64 85L); (mk_real_int64 53L); (mk_real_int64 10L); (mk_real_int64 28L); (mk_real_int64 69L); (mk_real_int64 374L); (mk_real_int64 75L); (mk_real_int64 290L); (mk_real_int64 20L); (mk_real_int64 96L); (mk_real_int64 29L); (mk_real_int64 49L); (mk_real_int64 29L); (mk_real_int64 152L); (mk_real_int64 420L); (mk_real_int64 238L); (mk_real_int64 186L); (mk_real_int64 290L); (mk_real_int64 28L); (mk_real_int64 96L); (mk_real_int64 29L); (mk_real_int64 16L); (mk_real_int64 117L); (mk_real_int64 113L); (mk_real_int64 20L); (mk_real_int64 152L); (mk_real_int64 16L); (mk_real_int64 49L); (mk_real_int64 29L); (mk_real_int64 139L); (mk_real_int64 159L); ]); +("RHA", [6; 7; 12; 41; 54; 58; 59; 73; ], [(mk_real_int64 55L); (mk_real_int64 55L); (mk_real_int64 76L); (mk_real_int64 55L); (mk_real_int64 76L); (mk_real_int64 55L); (mk_real_int64 55L); (mk_real_int64 55L); ]); +("RHB", [3; 52; ], [(mk_real_int64 76L); (mk_real_int64 76L); ]); +("yy10", [32; 66; ], [(mk_real_int64 43L); (mk_real_int64 43L); ]); +("ineq106", [0; 10; 11; 18; 19; 22; 23; 25; 26; 28; 31; 36; 39; 41; 43; 44; 53; 59; 62; 63; ], [(mk_real_int64 76L); (mk_real_int64 76L); (mk_real_int64 76L); (mk_real_int64 76L); (mk_real_int64 76L); (mk_real_int64 76L); (mk_real_int64 55L); (mk_real_int64 21L); (mk_real_int64 21L); (mk_real_int64 21L); (mk_real_int64 21L); (mk_real_int64 55L); (mk_real_int64 55L); (mk_real_int64 76L); (mk_real_int64 21L); (mk_real_int64 21L); (mk_real_int64 55L); (mk_real_int64 21L); (mk_real_int64 21L); (mk_real_int64 76L); ]); +("ineq107", [1; 4; 7; 9; 20; 21; 32; 34; 38; 40; 45; 48; 52; 54; 57; 64; ], [(mk_real_int64 110L); (mk_real_int64 5L); (mk_real_int64 5L); (mk_real_int64 104L); (mk_real_int64 104L); (mk_real_int64 104L); (mk_real_int64 38L); (mk_real_int64 4L); (mk_real_int64 104L); (mk_real_int64 104L); (mk_real_int64 5L); (mk_real_int64 5L); (mk_real_int64 104L); (mk_real_int64 4L); (mk_real_int64 38L); (mk_real_int64 110L); ]); +("ineq108", [0; 10; 18; 26; 28; 31; 33; 44; 56; 59; 62; 63; ], [(mk_real_int64 58L); (mk_real_int64 131L); (mk_real_int64 131L); (mk_real_int64 58L); (mk_real_int64 58L); (mk_real_int64 24L); (mk_real_int64 418L); (mk_real_int64 58L); (mk_real_int64 418L); (mk_real_int64 24L); (mk_real_int64 58L); (mk_real_int64 58L); ]); +("ineq109", [4; 7; 47; 48; ], [(mk_real_int64 104L); (mk_real_int64 104L); (mk_real_int64 104L); (mk_real_int64 104L); ]); +("ineq110", [14; 17; 31; 58; ], [(mk_real_int64 233L); (mk_real_int64 233L); (mk_real_int64 33L); (mk_real_int64 33L); ]); +("ineq111", [2; 5; 7; 10; 14; 16; 19; 22; 25; 27; 31; 34; 38; 39; 43; 47; 50; 52; 54; 58; 61; 64; ], [(mk_real_int64 975L); (mk_real_int64 808L); (mk_real_int64 395L); (mk_real_int64 519L); (mk_real_int64 1131L); (mk_real_int64 1131L); (mk_real_int64 519L); (mk_real_int64 683L); (mk_real_int64 737L); (mk_real_int64 72L); (mk_real_int64 125L); (mk_real_int64 739L); (mk_real_int64 975L); (mk_real_int64 683L); (mk_real_int64 737L); (mk_real_int64 395L); (mk_real_int64 808L); (mk_real_int64 975L); (mk_real_int64 739L); (mk_real_int64 125L); (mk_real_int64 72L); (mk_real_int64 975L); ]); +("ineq114", [2; 3; 8; 10; 11; 18; 19; 22; 25; 29; 30; 33; 37; 41; 43; 46; 50; 51; 56; 58; 60; 65; ], [(mk_real_int64 81L); (mk_real_int64 247L); (mk_real_int64 661L); (mk_real_int64 164L); (mk_real_int64 373L); (mk_real_int64 164L); (mk_real_int64 373L); (mk_real_int64 373L); (mk_real_int64 373L); (mk_real_int64 1038L); (mk_real_int64 985L); (mk_real_int64 371L); (mk_real_int64 81L); (mk_real_int64 373L); (mk_real_int64 373L); (mk_real_int64 661L); (mk_real_int64 247L); (mk_real_int64 81L); (mk_real_int64 371L); (mk_real_int64 985L); (mk_real_int64 1038L); (mk_real_int64 81L); ]); +("ineq119", [3; 7; ], [(mk_real_int64 439L); (mk_real_int64 439L); ]); +("ineq120", [0; 1; 2; 4; 5; 6; ], [(mk_real_int64 76L); (mk_real_int64 308L); (mk_real_int64 308L); (mk_real_int64 76L); (mk_real_int64 308L); (mk_real_int64 308L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 3400L); (mk_real_int64 3275L); (mk_real_int64 3275L); (mk_real_int64 3275L); (mk_real_int64 3375L); (mk_real_int64 3400L); (mk_real_int64 3275L); (mk_real_int64 3275L); (mk_real_int64 3400L); (mk_real_int64 3375L); (mk_real_int64 3375L); (mk_real_int64 3375L); (mk_real_int64 3275L); (mk_real_int64 3400L); (mk_real_int64 3375L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_lo", [0; 6; 7; 33; 34; 35; 36; 41; 49; 58; 59; 65; 66; 67; 68; 73; ], [(mk_real_int64 392L); (mk_real_int64 294L); (mk_real_int64 378L); (mk_real_int64 212L); (mk_real_int64 390L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 294L); (mk_real_int64 392L); (mk_real_int64 378L); (mk_real_int64 294L); (mk_real_int64 1000L); (mk_real_int64 390L); (mk_real_int64 1000L); (mk_real_int64 212L); (mk_real_int64 294L); ]); +("azim_hi", [1; 2; 3; 8; 11; 12; 14; 15; 22; 23; 26; 29; 37; 45; 47; 50; 51; 52; 53; 54; 56; 64; ], [(mk_real_int64 464L); (mk_real_int64 464L); (mk_real_int64 509L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 786L); (mk_real_int64 664L); (mk_real_int64 498L); (mk_real_int64 664L); (mk_real_int64 498L); (mk_real_int64 498L); (mk_real_int64 498L); (mk_real_int64 246L); (mk_real_int64 498L); (mk_real_int64 498L); (mk_real_int64 464L); (mk_real_int64 464L); (mk_real_int64 509L); (mk_real_int64 1000L); (mk_real_int64 786L); (mk_real_int64 1000L); (mk_real_int64 246L); ]); +("rho_hi", [1; 2; 3; 4; 6; 7; 9; 10; 11; 12; 14; ], [(mk_real_int64 204L); (mk_real_int64 204L); (mk_real_int64 204L); (mk_real_int64 240L); (mk_real_int64 204L); (mk_real_int64 204L); (mk_real_int64 240L); (mk_real_int64 240L); (mk_real_int64 240L); (mk_real_int64 204L); (mk_real_int64 240L); ]); +("rho_lo", [0; 5; 8; 13; ], [(mk_real_int64 2380L); (mk_real_int64 2380L); (mk_real_int64 2380L); (mk_real_int64 2380L); ]); +("tau_hi", [1; 3; 4; 7; 8; 13; 14; 17; 19; 23; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("y1_lo", [4; 6; 8; 9; 11; 15; 18; 21; 22; 23; 26; 29; 30; 32; 35; 37; 38; 42; 45; 47; 48; 53; 56; 58; 60; 62; 64; 67; 70; 71; ], [(mk_real_int64 230L); (mk_real_int64 500L); (mk_real_int64 204L); (mk_real_int64 440L); (mk_real_int64 304L); (mk_real_int64 600L); (mk_real_int64 40L); (mk_real_int64 460L); (mk_real_int64 385L); (mk_real_int64 20L); (mk_real_int64 540L); (mk_real_int64 260L); (mk_real_int64 230L); (mk_real_int64 230L); (mk_real_int64 200L); (mk_real_int64 230L); (mk_real_int64 20L); (mk_real_int64 500L); (mk_real_int64 600L); (mk_real_int64 260L); (mk_real_int64 230L); (mk_real_int64 500L); (mk_real_int64 204L); (mk_real_int64 440L); (mk_real_int64 500L); (mk_real_int64 20L); (mk_real_int64 230L); (mk_real_int64 240L); (mk_real_int64 230L); (mk_real_int64 230L); ]); +("y1_hi", [14; 20; 31; 43; 55; 66; 69; 72; ], [(mk_real_int64 195L); (mk_real_int64 420L); (mk_real_int64 40L); (mk_real_int64 60L); (mk_real_int64 196L); (mk_real_int64 40L); (mk_real_int64 40L); (mk_real_int64 500L); ]); +("y2_hi", [4; 5; 8; 11; 13; 20; 22; 23; 24; 25; 27; 31; 36; 37; 38; 40; 43; 44; 53; 55; 56; 61; 62; 64; 65; 66; 67; 69; 71; ], [(mk_real_int64 776L); (mk_real_int64 280L); (mk_real_int64 536L); (mk_real_int64 436L); (mk_real_int64 192L); (mk_real_int64 420L); (mk_real_int64 348L); (mk_real_int64 244L); (mk_real_int64 192L); (mk_real_int64 192L); (mk_real_int64 20L); (mk_real_int64 40L); (mk_real_int64 224L); (mk_real_int64 152L); (mk_real_int64 372L); (mk_real_int64 20L); (mk_real_int64 80L); (mk_real_int64 192L); (mk_real_int64 240L); (mk_real_int64 196L); (mk_real_int64 536L); (mk_real_int64 20L); (mk_real_int64 372L); (mk_real_int64 152L); (mk_real_int64 224L); (mk_real_int64 40L); (mk_real_int64 380L); (mk_real_int64 40L); (mk_real_int64 776L); ]); +("y2_lo", [6; 9; 14; 15; 18; 21; 26; 29; 30; 32; 35; 42; 45; 47; 48; 58; 60; 70; 72; ], [(mk_real_int64 500L); (mk_real_int64 440L); (mk_real_int64 72L); (mk_real_int64 336L); (mk_real_int64 40L); (mk_real_int64 460L); (mk_real_int64 276L); (mk_real_int64 16L); (mk_real_int64 244L); (mk_real_int64 244L); (mk_real_int64 580L); (mk_real_int64 308L); (mk_real_int64 336L); (mk_real_int64 16L); (mk_real_int64 244L); (mk_real_int64 440L); (mk_real_int64 308L); (mk_real_int64 244L); (mk_real_int64 220L); ]); +("y3_hi", [4; 5; 8; 11; 13; 20; 22; 23; 24; 25; 27; 31; 36; 37; 38; 40; 43; 44; 53; 55; 56; 61; 62; 64; 65; 66; 67; 69; 71; ], [(mk_real_int64 776L); (mk_real_int64 280L); (mk_real_int64 536L); (mk_real_int64 436L); (mk_real_int64 192L); (mk_real_int64 420L); (mk_real_int64 348L); (mk_real_int64 244L); (mk_real_int64 192L); (mk_real_int64 192L); (mk_real_int64 20L); (mk_real_int64 40L); (mk_real_int64 224L); (mk_real_int64 152L); (mk_real_int64 372L); (mk_real_int64 20L); (mk_real_int64 80L); (mk_real_int64 192L); (mk_real_int64 240L); (mk_real_int64 196L); (mk_real_int64 536L); (mk_real_int64 20L); (mk_real_int64 372L); (mk_real_int64 152L); (mk_real_int64 224L); (mk_real_int64 40L); (mk_real_int64 380L); (mk_real_int64 40L); (mk_real_int64 776L); ]); +("y3_lo", [6; 9; 14; 15; 18; 21; 26; 29; 30; 32; 35; 42; 45; 47; 48; 58; 60; 70; 72; ], [(mk_real_int64 500L); (mk_real_int64 440L); (mk_real_int64 72L); (mk_real_int64 336L); (mk_real_int64 40L); (mk_real_int64 460L); (mk_real_int64 276L); (mk_real_int64 16L); (mk_real_int64 244L); (mk_real_int64 244L); (mk_real_int64 580L); (mk_real_int64 308L); (mk_real_int64 336L); (mk_real_int64 16L); (mk_real_int64 244L); (mk_real_int64 440L); (mk_real_int64 308L); (mk_real_int64 244L); (mk_real_int64 220L); ]); +("y4_lo", [0; 4; 7; 9; 10; 11; 14; 16; 18; 20; 21; 22; 23; 26; 28; 33; 34; 36; 38; 39; 40; 41; 44; 45; 48; 52; 53; 54; 56; 58; 62; 63; ], [(mk_real_int64 790L); (mk_real_int64 439L); (mk_real_int64 814L); (mk_real_int64 608L); (mk_real_int64 670L); (mk_real_int64 60L); (mk_real_int64 43L); (mk_real_int64 375L); (mk_real_int64 795L); (mk_real_int64 608L); (mk_real_int64 608L); (mk_real_int64 435L); (mk_real_int64 675L); (mk_real_int64 115L); (mk_real_int64 115L); (mk_real_int64 330L); (mk_real_int64 283L); (mk_real_int64 675L); (mk_real_int64 483L); (mk_real_int64 50L); (mk_real_int64 608L); (mk_real_int64 60L); (mk_real_int64 115L); (mk_real_int64 135L); (mk_real_int64 439L); (mk_real_int64 483L); (mk_real_int64 675L); (mk_real_int64 283L); (mk_real_int64 330L); (mk_real_int64 93L); (mk_real_int64 115L); (mk_real_int64 790L); ]); +("y4_hi", [1; 2; 17; 19; 25; 31; 32; 43; 47; 57; 59; 64; ], [(mk_real_int64 30L); (mk_real_int64 125L); (mk_real_int64 332L); (mk_real_int64 65L); (mk_real_int64 490L); (mk_real_int64 82L); (mk_real_int64 374L); (mk_real_int64 490L); (mk_real_int64 321L); (mk_real_int64 374L); (mk_real_int64 175L); (mk_real_int64 155L); ]); +("y5_hi", [4; 5; 6; 13; 14; 21; 22; 24; 25; 26; 27; 29; 35; 36; 37; 38; 40; 42; 44; 47; 53; 55; 60; 61; 62; 64; 65; 67; 71; 72; ], [(mk_real_int64 776L); (mk_real_int64 280L); (mk_real_int64 125L); (mk_real_int64 192L); (mk_real_int64 473L); (mk_real_int64 332L); (mk_real_int64 348L); (mk_real_int64 192L); (mk_real_int64 192L); (mk_real_int64 289L); (mk_real_int64 20L); (mk_real_int64 519L); (mk_real_int64 287L); (mk_real_int64 224L); (mk_real_int64 152L); (mk_real_int64 17L); (mk_real_int64 20L); (mk_real_int64 317L); (mk_real_int64 192L); (mk_real_int64 519L); (mk_real_int64 240L); (mk_real_int64 321L); (mk_real_int64 317L); (mk_real_int64 20L); (mk_real_int64 17L); (mk_real_int64 152L); (mk_real_int64 224L); (mk_real_int64 380L); (mk_real_int64 776L); (mk_real_int64 405L); ]); +("y5_lo", [8; 11; 15; 18; 20; 23; 30; 32; 43; 45; 48; 56; 66; 70; ], [(mk_real_int64 64L); (mk_real_int64 439L); (mk_real_int64 336L); (mk_real_int64 43L); (mk_real_int64 375L); (mk_real_int64 211L); (mk_real_int64 244L); (mk_real_int64 244L); (mk_real_int64 355L); (mk_real_int64 336L); (mk_real_int64 244L); (mk_real_int64 64L); (mk_real_int64 93L); (mk_real_int64 244L); ]); +("y6_lo", [4; 7; 8; 10; 11; 13; 15; 16; 18; 19; 20; 23; 25; 28; 29; 30; 31; 32; 40; 41; 43; 44; 45; 46; 47; 48; 53; 56; 60; 66; 69; 70; 71; 72; ], [(mk_real_int64 90224L); (mk_real_int64 298000L); (mk_real_int64 64L); (mk_real_int64 85000L); (mk_real_int64 16439L); (mk_real_int64 69000L); (mk_real_int64 336L); (mk_real_int64 69000L); (mk_real_int64 187043L); (mk_real_int64 374000L); (mk_real_int64 375L); (mk_real_int64 211L); (mk_real_int64 306000L); (mk_real_int64 96000L); (mk_real_int64 56000L); (mk_real_int64 244L); (mk_real_int64 58000L); (mk_real_int64 244L); (mk_real_int64 400000L); (mk_real_int64 238000L); (mk_real_int64 251355L); (mk_real_int64 306000L); (mk_real_int64 336L); (mk_real_int64 96000L); (mk_real_int64 56000L); (mk_real_int64 244L); (mk_real_int64 16760L); (mk_real_int64 85000L); (mk_real_int64 251000L); (mk_real_int64 93L); (mk_real_int64 58000L); (mk_real_int64 244L); (mk_real_int64 90224L); (mk_real_int64 298000L); ]); +("y6_hi", [5; 6; 13; 14; 21; 22; 24; 25; 26; 27; 29; 35; 36; 37; 38; 40; 42; 44; 47; 55; 56; 60; 61; 62; 64; 65; 67; 72; ], [(mk_real_int64 280L); (mk_real_int64 125L); (mk_real_int64 192L); (mk_real_int64 473L); (mk_real_int64 332L); (mk_real_int64 348L); (mk_real_int64 192L); (mk_real_int64 192L); (mk_real_int64 289L); (mk_real_int64 20L); (mk_real_int64 519L); (mk_real_int64 287L); (mk_real_int64 224L); (mk_real_int64 152L); (mk_real_int64 17L); (mk_real_int64 20L); (mk_real_int64 317L); (mk_real_int64 192L); (mk_real_int64 519L); (mk_real_int64 321L); (mk_real_int64 936L); (mk_real_int64 317L); (mk_real_int64 20L); (mk_real_int64 17L); (mk_real_int64 152L); (mk_real_int64 224L); (mk_real_int64 380L); (mk_real_int64 405L); ]); +("ye_lo", [20; 21; 24; 35; 54; 55; 57; 61; 67; ], [(mk_real_int64 187000L); (mk_real_int64 69000L); (mk_real_int64 69000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 238000L); (mk_real_int64 400000L); (mk_real_int64 1000L); ]); +("ye_hi", [10; 15; 16; 21; 23; 45; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_hi", [0; 2; 3; 4; 5; 6; 8; 9; 11; 12; 13; ], [(mk_real_int64 1536L); (mk_real_int64 228L); (mk_real_int64 228L); (mk_real_int64 976L); (mk_real_int64 1536L); (mk_real_int64 1228L); (mk_real_int64 536L); (mk_real_int64 976L); (mk_real_int64 976L); (mk_real_int64 228L); (mk_real_int64 536L); ]); +("yn_lo", [1; 7; 10; 14; ], [(mk_real_int64 772L); (mk_real_int64 772L); (mk_real_int64 24L); (mk_real_int64 24L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/156615503428_out.hl b/formal_lp/old/ineqs/tests2/156615503428_out.hl new file mode 100644 index 0000000..100c356 --- /dev/null +++ b/formal_lp/old/ineqs/tests2/156615503428_out.hl @@ -0,0 +1,87 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "156615503428 20 4 0 1 2 3 3 0 3 4 3 4 3 5 3 5 3 2 3 5 2 6 3 6 2 1 3 6 1 7 3 7 1 8 3 8 1 0 3 8 0 9 3 9 0 4 3 9 4 10 3 10 4 5 3 10 5 6 3 10 6 11 3 11 6 7 3 11 7 12 3 12 7 8 3 12 8 9 4 9 10 11 12 ";; +let precision = 5;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [2; 3; 6; 9; 10; ], [(mk_real_int64 7251L); (mk_real_int64 2090L); (mk_real_int64 68046L); (mk_real_int64 2090L); (mk_real_int64 7251L); ]); +("azim_sum_neg", [0; 4; 5; 8; 12; ], [(mk_real_int64 38048L); (mk_real_int64 20368L); (mk_real_int64 3914L); (mk_real_int64 20368L); (mk_real_int64 38048L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 94972L); (mk_real_int64 94972L); (mk_real_int64 94972L); (mk_real_int64 94972L); (mk_real_int64 94972L); (mk_real_int64 98886L); (mk_real_int64 89946L); (mk_real_int64 94972L); (mk_real_int64 94972L); (mk_real_int64 94972L); (mk_real_int64 94972L); (mk_real_int64 94972L); (mk_real_int64 94972L); ]); +("sol_sum3", [0; 1; 16; 17; ], [(mk_real_int64 20368L); (mk_real_int64 38017L); (mk_real_int64 38017L); (mk_real_int64 20368L); ]); +("sol_sum3_neg", [3; 4; 5; 7; 8; 9; 10; 12; 13; 14; ], [(mk_real_int64 5027L); (mk_real_int64 11768L); (mk_real_int64 13137L); (mk_real_int64 2093L); (mk_real_int64 21477L); (mk_real_int64 21477L); (mk_real_int64 2093L); (mk_real_int64 13137L); (mk_real_int64 11768L); (mk_real_int64 5027L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; ], [(mk_real_int64 94972L); (mk_real_int64 94972L); (mk_real_int64 94972L); (mk_real_int64 89946L); (mk_real_int64 89946L); (mk_real_int64 89086L); (mk_real_int64 78136L); (mk_real_int64 94969L); (mk_real_int64 61901L); (mk_real_int64 61901L); (mk_real_int64 94969L); (mk_real_int64 78136L); (mk_real_int64 89086L); (mk_real_int64 89946L); (mk_real_int64 89946L); (mk_real_int64 94972L); (mk_real_int64 94972L); (mk_real_int64 94972L); ]); +("tau_sum4_neg", [0; 1; ], [(mk_real_int64 94972L); (mk_real_int64 94972L); ]); +("ln_def_neg", [0; 1; 2; 3; 4; 5; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 4714L); (mk_real_int64 4714L); (mk_real_int64 4714L); (mk_real_int64 4714L); (mk_real_int64 4714L); (mk_real_int64 9028L); (mk_real_int64 9028L); (mk_real_int64 4714L); (mk_real_int64 4714L); (mk_real_int64 4714L); (mk_real_int64 4714L); (mk_real_int64 4714L); ]); +("ln_def", [6; ], [(mk_real_int64 829L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 596727L); (mk_real_int64 596727L); (mk_real_int64 596727L); (mk_real_int64 596727L); (mk_real_int64 596727L); (mk_real_int64 621317L); (mk_real_int64 565145L); (mk_real_int64 596727L); (mk_real_int64 596727L); (mk_real_int64 596727L); (mk_real_int64 596727L); (mk_real_int64 596727L); (mk_real_int64 596727L); ]); +("edge_sym", [0; 1; 3; 6; 8; 9; 12; 14; 15; 18; 23; 39; 42; 54; ], [(mk_real_int64 412L); (mk_real_int64 412L); (mk_real_int64 2000L); (mk_real_int64 14354L); (mk_real_int64 11526L); (mk_real_int64 15826L); (mk_real_int64 17540L); (mk_real_int64 3677L); (mk_real_int64 3677L); (mk_real_int64 3073L); (mk_real_int64 409L); (mk_real_int64 3677L); (mk_real_int64 3030L); (mk_real_int64 11526L); ]); +("edge_sym_neg", [5; 20; 21; 24; 27; 30; 35; 36; 44; 45; 48; 50; ], [(mk_real_int64 11526L); (mk_real_int64 3677L); (mk_real_int64 3677L); (mk_real_int64 15826L); (mk_real_int64 409L); (mk_real_int64 14354L); (mk_real_int64 409L); (mk_real_int64 412L); (mk_real_int64 3677L); (mk_real_int64 412L); (mk_real_int64 17540L); (mk_real_int64 17655L); ]); +("y1_def_neg", [1; 4; 5; 6; 7; 8; 12; 15; 18; 23; 25; 29; 31; 33; 35; 37; 39; 43; 47; 48; 52; 54; 56; 57; 59; ], [(mk_real_int64 323L); (mk_real_int64 2134L); (mk_real_int64 4409L); (mk_real_int64 3076L); (mk_real_int64 5741L); (mk_real_int64 1073L); (mk_real_int64 17095L); (mk_real_int64 8639L); (mk_real_int64 306L); (mk_real_int64 16035L); (mk_real_int64 2L); (mk_real_int64 9320L); (mk_real_int64 8211L); (mk_real_int64 1109L); (mk_real_int64 2L); (mk_real_int64 9287L); (mk_real_int64 6748L); (mk_real_int64 306L); (mk_real_int64 4753L); (mk_real_int64 3886L); (mk_real_int64 1073L); (mk_real_int64 5741L); (mk_real_int64 3076L); (mk_real_int64 15383L); (mk_real_int64 323L); ]); +("y1_def", [11; 13; 17; 20; 21; 24; 27; 30; 32; 36; 38; 41; 45; 46; 51; 55; ], [(mk_real_int64 19024L); (mk_real_int64 1910L); (mk_real_int64 7831L); (mk_real_int64 4992L); (mk_real_int64 3626L); (mk_real_int64 1766L); (mk_real_int64 795L); (mk_real_int64 8161L); (mk_real_int64 8161L); (mk_real_int64 795L); (mk_real_int64 1766L); (mk_real_int64 8618L); (mk_real_int64 7831L); (mk_real_int64 1910L); (mk_real_int64 1929L); (mk_real_int64 8840L); ]); +("y2_def", [1; 4; 13; 15; 17; 18; 20; 25; 27; 29; 30; 31; 32; 35; 36; 37; 41; 43; 45; 46; 47; 59; ], [(mk_real_int64 412L); (mk_real_int64 3305L); (mk_real_int64 1910L); (mk_real_int64 3475L); (mk_real_int64 3450L); (mk_real_int64 186L); (mk_real_int64 4992L); (mk_real_int64 1L); (mk_real_int64 795L); (mk_real_int64 3871L); (mk_real_int64 8161L); (mk_real_int64 4980L); (mk_real_int64 8161L); (mk_real_int64 1L); (mk_real_int64 795L); (mk_real_int64 5633L); (mk_real_int64 3890L); (mk_real_int64 186L); (mk_real_int64 3450L); (mk_real_int64 1910L); (mk_real_int64 7361L); (mk_real_int64 412L); ]); +("y2_def_neg", [5; 6; 7; 8; 11; 12; 21; 23; 24; 33; 38; 39; 48; 51; 52; 54; 55; 56; 57; ], [(mk_real_int64 15936L); (mk_real_int64 3076L); (mk_real_int64 5741L); (mk_real_int64 1093L); (mk_real_int64 5783L); (mk_real_int64 17095L); (mk_real_int64 1102L); (mk_real_int64 1116L); (mk_real_int64 537L); (mk_real_int64 1109L); (mk_real_int64 537L); (mk_real_int64 6748L); (mk_real_int64 3886L); (mk_real_int64 22878L); (mk_real_int64 1093L); (mk_real_int64 5741L); (mk_real_int64 2687L); (mk_real_int64 3076L); (mk_real_int64 9944L); ]); +("y3_def", [1; 4; 13; 15; 17; 18; 20; 25; 27; 29; 30; 31; 32; 35; 36; 37; 41; 43; 45; 46; 47; 59; ], [(mk_real_int64 412L); (mk_real_int64 3305L); (mk_real_int64 1910L); (mk_real_int64 3475L); (mk_real_int64 3450L); (mk_real_int64 186L); (mk_real_int64 4992L); (mk_real_int64 1L); (mk_real_int64 795L); (mk_real_int64 3871L); (mk_real_int64 8161L); (mk_real_int64 4980L); (mk_real_int64 8161L); (mk_real_int64 1L); (mk_real_int64 795L); (mk_real_int64 5633L); (mk_real_int64 3890L); (mk_real_int64 186L); (mk_real_int64 3450L); (mk_real_int64 1910L); (mk_real_int64 7361L); (mk_real_int64 412L); ]); +("y3_def_neg", [5; 6; 7; 8; 11; 12; 21; 23; 24; 33; 38; 39; 48; 51; 52; 54; 55; 56; 57; ], [(mk_real_int64 15936L); (mk_real_int64 3076L); (mk_real_int64 5741L); (mk_real_int64 1093L); (mk_real_int64 5783L); (mk_real_int64 17095L); (mk_real_int64 1102L); (mk_real_int64 1116L); (mk_real_int64 537L); (mk_real_int64 1109L); (mk_real_int64 537L); (mk_real_int64 6748L); (mk_real_int64 3886L); (mk_real_int64 22878L); (mk_real_int64 1093L); (mk_real_int64 5741L); (mk_real_int64 2687L); (mk_real_int64 3076L); (mk_real_int64 9944L); ]); +("y4_def", [1; 2; 3; 7; 13; 17; 20; 34; 37; 41; 47; 50; 51; 52; ], [(mk_real_int64 4466L); (mk_real_int64 6583L); (mk_real_int64 12287L); (mk_real_int64 29411L); (mk_real_int64 2887L); (mk_real_int64 5605L); (mk_real_int64 2731L); (mk_real_int64 2731L); (mk_real_int64 3030L); (mk_real_int64 2887L); (mk_real_int64 17540L); (mk_real_int64 12287L); (mk_real_int64 13666L); (mk_real_int64 6583L); ]); +("y4_def_neg", [0; 4; 8; 9; 11; 14; 16; 19; 21; 23; 25; 26; 27; 28; 29; 31; 32; 33; 35; 39; 42; 43; 44; 48; 53; ], [(mk_real_int64 6222L); (mk_real_int64 732L); (mk_real_int64 11872L); (mk_real_int64 985L); (mk_real_int64 16554L); (mk_real_int64 349L); (mk_real_int64 2575L); (mk_real_int64 15289L); (mk_real_int64 2L); (mk_real_int64 410L); (mk_real_int64 10145L); (mk_real_int64 4209L); (mk_real_int64 9374L); (mk_real_int64 4209L); (mk_real_int64 770L); (mk_real_int64 2L); (mk_real_int64 410L); (mk_real_int64 10603L); (mk_real_int64 4686L); (mk_real_int64 349L); (mk_real_int64 985L); (mk_real_int64 13856L); (mk_real_int64 2699L); (mk_real_int64 732L); (mk_real_int64 15422L); ]); +("y5_def", [1; 4; 6; 7; 15; 18; 23; 25; 29; 31; 35; 37; 43; 47; 54; 56; 59; ], [(mk_real_int64 412L); (mk_real_int64 3305L); (mk_real_int64 6583L); (mk_real_int64 12287L); (mk_real_int64 4662L); (mk_real_int64 186L); (mk_real_int64 946L); (mk_real_int64 1L); (mk_real_int64 4209L); (mk_real_int64 4980L); (mk_real_int64 1L); (mk_real_int64 5633L); (mk_real_int64 186L); (mk_real_int64 7361L); (mk_real_int64 12287L); (mk_real_int64 6583L); (mk_real_int64 412L); ]); +("y5_def_neg", [5; 8; 11; 12; 13; 17; 20; 21; 24; 27; 30; 32; 33; 36; 38; 39; 41; 45; 46; 48; 51; 52; 55; 57; ], [(mk_real_int64 11888L); (mk_real_int64 761L); (mk_real_int64 5783L); (mk_real_int64 11872L); (mk_real_int64 985L); (mk_real_int64 3328L); (mk_real_int64 2575L); (mk_real_int64 1102L); (mk_real_int64 537L); (mk_real_int64 410L); (mk_real_int64 4209L); (mk_real_int64 4209L); (mk_real_int64 770L); (mk_real_int64 410L); (mk_real_int64 537L); (mk_real_int64 4686L); (mk_real_int64 3677L); (mk_real_int64 3328L); (mk_real_int64 985L); (mk_real_int64 2699L); (mk_real_int64 17655L); (mk_real_int64 761L); (mk_real_int64 2687L); (mk_real_int64 5895L); ]); +("y6_def", [1; 4; 6; 7; 10; 11; 15; 18; 23; 25; 28; 29; 31; 34; 35; 37; 43; 47; 52; 53; 54; 56; 59; ], [(mk_real_int64 412L); (mk_real_int64 3305L); (mk_real_int64 6583L); (mk_real_int64 12287L); (mk_real_int64 6128L); (mk_real_int64 11872L); (mk_real_int64 4662L); (mk_real_int64 186L); (mk_real_int64 946L); (mk_real_int64 1L); (mk_real_int64 409L); (mk_real_int64 4209L); (mk_real_int64 4980L); (mk_real_int64 409L); (mk_real_int64 1L); (mk_real_int64 5633L); (mk_real_int64 186L); (mk_real_int64 7361L); (mk_real_int64 5368L); (mk_real_int64 4271L); (mk_real_int64 12287L); (mk_real_int64 6583L); (mk_real_int64 412L); ]); +("y6_def_neg", [5; 8; 12; 13; 17; 20; 21; 24; 27; 30; 32; 33; 36; 38; 39; 41; 45; 46; 48; 55; 57; ], [(mk_real_int64 11888L); (mk_real_int64 761L); (mk_real_int64 11872L); (mk_real_int64 985L); (mk_real_int64 598L); (mk_real_int64 2575L); (mk_real_int64 1102L); (mk_real_int64 537L); (mk_real_int64 410L); (mk_real_int64 4209L); (mk_real_int64 4209L); (mk_real_int64 770L); (mk_real_int64 410L); (mk_real_int64 537L); (mk_real_int64 4686L); (mk_real_int64 3677L); (mk_real_int64 598L); (mk_real_int64 985L); (mk_real_int64 2699L); (mk_real_int64 2687L); (mk_real_int64 3896L); ]); +("RHA", [9; 10; 13; 14; 17; 18; 19; 20; 21; 22; 23; 24; 26; 27; 28; 29; 30; 31; 32; 33; 34; 36; 37; 38; 39; 40; 41; 42; 43; 45; 46; 48; ], [(mk_real_int64 3914L); (mk_real_int64 3914L); (mk_real_int64 8940L); (mk_real_int64 5027L); (mk_real_int64 5027L); (mk_real_int64 4516L); (mk_real_int64 859L); (mk_real_int64 5886L); (mk_real_int64 5886L); (mk_real_int64 16836L); (mk_real_int64 1357L); (mk_real_int64 16836L); (mk_real_int64 3L); (mk_real_int64 3L); (mk_real_int64 33071L); (mk_real_int64 19387L); (mk_real_int64 33071L); (mk_real_int64 19387L); (mk_real_int64 33071L); (mk_real_int64 33071L); (mk_real_int64 3L); (mk_real_int64 3L); (mk_real_int64 1357L); (mk_real_int64 16836L); (mk_real_int64 20749L); (mk_real_int64 5886L); (mk_real_int64 9799L); (mk_real_int64 859L); (mk_real_int64 4516L); (mk_real_int64 5027L); (mk_real_int64 5027L); (mk_real_int64 5027L); ]); +("yy10", [19; 43; ], [(mk_real_int64 6103L); (mk_real_int64 6103L); ]); +("ineq105", [1; 5; ], [(mk_real_int64 1026L); (mk_real_int64 1026L); ]); +("ineq106", [14; 19; 21; 25; 27; 31; 33; 39; ], [(mk_real_int64 510L); (mk_real_int64 15478L); (mk_real_int64 3L); (mk_real_int64 13685L); (mk_real_int64 13685L); (mk_real_int64 3L); (mk_real_int64 15478L); (mk_real_int64 510L); ]); +("ineq107", [1; 4; 7; 13; 17; 20; 34; 37; 41; 47; 48; 51; ], [(mk_real_int64 17680L); (mk_real_int64 31L); (mk_real_int64 38048L); (mk_real_int64 6718L); (mk_real_int64 7251L); (mk_real_int64 3533L); (mk_real_int64 3533L); (mk_real_int64 7251L); (mk_real_int64 6718L); (mk_real_int64 38048L); (mk_real_int64 31L); (mk_real_int64 17680L); ]); +("ineq108", [0; 11; 43; 53; ], [(mk_real_int64 9083L); (mk_real_int64 20227L); (mk_real_int64 20227L); (mk_real_int64 9083L); ]); +("ineq109", [2; 3; 50; 52; ], [(mk_real_int64 20368L); (mk_real_int64 38017L); (mk_real_int64 38017L); (mk_real_int64 20368L); ]); +("ineq110", [9; 13; 16; 23; 26; 28; 32; 37; 41; 42; ], [(mk_real_int64 5027L); (mk_real_int64 11768L); (mk_real_int64 13137L); (mk_real_int64 2093L); (mk_real_int64 21477L); (mk_real_int64 21477L); (mk_real_int64 2093L); (mk_real_int64 13137L); (mk_real_int64 11768L); (mk_real_int64 5027L); ]); +("ineq111", [1; 4; 8; 11; 19; 25; 29; 35; 44; 47; 48; 53; ], [(mk_real_int64 73604L); (mk_real_int64 6049L); (mk_real_int64 94972L); (mk_real_int64 21588L); (mk_real_int64 37491L); (mk_real_int64 6163L); (mk_real_int64 6163L); (mk_real_int64 37491L); (mk_real_int64 21588L); (mk_real_int64 94972L); (mk_real_int64 6049L); (mk_real_int64 73604L); ]); +("ineq112", [13; 41; ], [(mk_real_int64 45L); (mk_real_int64 45L); ]); +("ineq113", [21; 24; 29; 31; ], [(mk_real_int64 86725L); (mk_real_int64 33877L); (mk_real_int64 33877L); (mk_real_int64 86725L); ]); +("ineq114", [0; 3; 5; 11; 12; 15; 18; 19; 22; 26; 28; 32; 33; 35; 38; 40; 43; 49; 50; 53; ], [(mk_real_int64 21368L); (mk_real_int64 28193L); (mk_real_int64 60730L); (mk_real_int64 68357L); (mk_real_int64 89901L); (mk_real_int64 89086L); (mk_real_int64 26894L); (mk_real_int64 13752L); (mk_real_int64 8244L); (mk_real_int64 21861L); (mk_real_int64 21861L); (mk_real_int64 8244L); (mk_real_int64 13752L); (mk_real_int64 26894L); (mk_real_int64 89086L); (mk_real_int64 89901L); (mk_real_int64 68357L); (mk_real_int64 60730L); (mk_real_int64 28193L); (mk_real_int64 21368L); ]); +("ineq119", [3; 7; ], [(mk_real_int64 83991L); (mk_real_int64 83991L); ]); +("ineq120", [0; 1; 4; 5; ], [(mk_real_int64 2760L); (mk_real_int64 8221L); (mk_real_int64 2760L); (mk_real_int64 8221L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 631331L); (mk_real_int64 631331L); (mk_real_int64 631331L); (mk_real_int64 631331L); (mk_real_int64 631331L); (mk_real_int64 550601L); (mk_real_int64 500685L); (mk_real_int64 432031331L); (mk_real_int64 631331L); (mk_real_int64 631331L); (mk_real_int64 631331L); (mk_real_int64 631331L); (mk_real_int64 631331L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [0; 1; 3; 4; 13; 16; 17; 18; 23; 30; 32; 37; 39; 41; 43; 44; 45; 57; 58; 59; 61; ], [(mk_real_int64 14800L); (mk_real_int64 76330L); (mk_real_int64 7700L); (mk_real_int64 136800L); (mk_real_int64 100000L); (mk_real_int64 2600L); (mk_real_int64 18500L); (mk_real_int64 100000L); (mk_real_int64 75200L); (mk_real_int64 98600L); (mk_real_int64 98600L); (mk_real_int64 75200L); (mk_real_int64 64400L); (mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 2600L); (mk_real_int64 18500L); (mk_real_int64 136800L); (mk_real_int64 14800L); (mk_real_int64 76330L); (mk_real_int64 7700L); ]); +("azim_lo", [7; 9; 15; 19; 22; 24; 25; 26; 28; 33; 35; 36; 38; 42; 47; 53; 54; ], [(mk_real_int64 18200L); (mk_real_int64 2000L); (mk_real_int64 51800L); (mk_real_int64 16400L); (mk_real_int64 35600L); (mk_real_int64 100000L); (mk_real_int64 77500L); (mk_real_int64 25600L); (mk_real_int64 14300L); (mk_real_int64 14300L); (mk_real_int64 77500L); (mk_real_int64 25600L); (mk_real_int64 100000L); (mk_real_int64 16400L); (mk_real_int64 51800L); (mk_real_int64 2000L); (mk_real_int64 18200L); ]); +("rhazim_hi", [14; 17; 29; 31; 45; 46; 48; ], [(mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); ]); +("rhazim_lo", [19; 23; 37; 39; 41; 42; ], [(mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); ]); +("rho_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 12068L); (mk_real_int64 12068L); (mk_real_int64 12068L); (mk_real_int64 12068L); (mk_real_int64 12068L); (mk_real_int64 252634L); (mk_real_int64 280774L); (mk_real_int64 12068L); (mk_real_int64 12068L); (mk_real_int64 12068L); (mk_real_int64 12068L); (mk_real_int64 12068L); (mk_real_int64 12068L); ]); +("tau_hi", [7; 12; ], [(mk_real_int64 100000L); (mk_real_int64 100000L); ]); +("tau_lo", [4; 15; ], [(mk_real_int64 100000L); (mk_real_int64 100000L); ]); +("y1_lo", [1; 4; 8; 15; 17; 21; 23; 29; 33; 39; 41; 45; 47; 52; 57; 59; ], [(mk_real_int64 19000L); (mk_real_int64 50500L); (mk_real_int64 32000L); (mk_real_int64 18500L); (mk_real_int64 16000L); (mk_real_int64 50000L); (mk_real_int64 18000L); (mk_real_int64 34000L); (mk_real_int64 34000L); (mk_real_int64 38000L); (mk_real_int64 44000L); (mk_real_int64 16000L); (mk_real_int64 34500L); (mk_real_int64 32000L); (mk_real_int64 22500L); (mk_real_int64 19000L); ]); +("y1_hi", [5; 6; 7; 12; 13; 20; 24; 25; 27; 30; 32; 35; 36; 37; 38; 46; 48; 51; 54; 56; ], [(mk_real_int64 28000L); (mk_real_int64 43200L); (mk_real_int64 43300L); (mk_real_int64 4000L); (mk_real_int64 26000L); (mk_real_int64 6000L); (mk_real_int64 50000L); (mk_real_int64 20000L); (mk_real_int64 34000L); (mk_real_int64 26000L); (mk_real_int64 26000L); (mk_real_int64 20000L); (mk_real_int64 34000L); (mk_real_int64 20000L); (mk_real_int64 50000L); (mk_real_int64 26000L); (mk_real_int64 16000L); (mk_real_int64 4000L); (mk_real_int64 43300L); (mk_real_int64 43200L); ]); +("y2_hi", [1; 4; 6; 7; 12; 13; 17; 20; 23; 25; 27; 30; 32; 35; 36; 45; 46; 48; 54; 56; 57; 59; ], [(mk_real_int64 45200L); (mk_real_int64 30370L); (mk_real_int64 43200L); (mk_real_int64 43300L); (mk_real_int64 4000L); (mk_real_int64 26000L); (mk_real_int64 70400L); (mk_real_int64 6000L); (mk_real_int64 6420L); (mk_real_int64 9170L); (mk_real_int64 34000L); (mk_real_int64 26000L); (mk_real_int64 26000L); (mk_real_int64 9170L); (mk_real_int64 34000L); (mk_real_int64 70400L); (mk_real_int64 26000L); (mk_real_int64 16000L); (mk_real_int64 43300L); (mk_real_int64 43200L); (mk_real_int64 58370L); (mk_real_int64 45200L); ]); +("y2_lo", [5; 8; 11; 15; 18; 21; 24; 29; 31; 33; 37; 38; 39; 41; 43; 47; 51; 52; 55; ], [(mk_real_int64 8000L); (mk_real_int64 53200L); (mk_real_int64 29600L); (mk_real_int64 23470L); (mk_real_int64 41100L); (mk_real_int64 15200L); (mk_real_int64 1600L); (mk_real_int64 36850L); (mk_real_int64 2850L); (mk_real_int64 34000L); (mk_real_int64 55580L); (mk_real_int64 1600L); (mk_real_int64 38000L); (mk_real_int64 9200L); (mk_real_int64 41100L); (mk_real_int64 39470L); (mk_real_int64 25600L); (mk_real_int64 53200L); (mk_real_int64 36000L); ]); +("y3_hi", [1; 4; 6; 7; 12; 13; 17; 20; 23; 25; 27; 30; 32; 35; 36; 45; 46; 48; 54; 56; 57; 59; ], [(mk_real_int64 45200L); (mk_real_int64 30370L); (mk_real_int64 43200L); (mk_real_int64 43300L); (mk_real_int64 4000L); (mk_real_int64 26000L); (mk_real_int64 70400L); (mk_real_int64 6000L); (mk_real_int64 6420L); (mk_real_int64 9170L); (mk_real_int64 34000L); (mk_real_int64 26000L); (mk_real_int64 26000L); (mk_real_int64 9170L); (mk_real_int64 34000L); (mk_real_int64 70400L); (mk_real_int64 26000L); (mk_real_int64 16000L); (mk_real_int64 43300L); (mk_real_int64 43200L); (mk_real_int64 58370L); (mk_real_int64 45200L); ]); +("y3_lo", [5; 8; 11; 15; 18; 21; 24; 29; 31; 33; 37; 38; 39; 41; 43; 47; 51; 52; 55; ], [(mk_real_int64 8000L); (mk_real_int64 53200L); (mk_real_int64 29600L); (mk_real_int64 23470L); (mk_real_int64 41100L); (mk_real_int64 15200L); (mk_real_int64 1600L); (mk_real_int64 36850L); (mk_real_int64 2850L); (mk_real_int64 34000L); (mk_real_int64 55580L); (mk_real_int64 1600L); (mk_real_int64 38000L); (mk_real_int64 9200L); (mk_real_int64 41100L); (mk_real_int64 39470L); (mk_real_int64 25600L); (mk_real_int64 53200L); (mk_real_int64 36000L); ]); +("y4_hi", [0; 1; 3; 7; 8; 11; 16; 17; 19; 20; 25; 33; 34; 37; 43; 44; 50; 51; ], [(mk_real_int64 14500L); (mk_real_int64 14000L); (mk_real_int64 9440L); (mk_real_int64 10400L); (mk_real_int64 50000L); (mk_real_int64 500L); (mk_real_int64 14800L); (mk_real_int64 2300L); (mk_real_int64 19500L); (mk_real_int64 900L); (mk_real_int64 40000L); (mk_real_int64 57000L); (mk_real_int64 900L); (mk_real_int64 17100L); (mk_real_int64 50500L); (mk_real_int64 50000L); (mk_real_int64 9440L); (mk_real_int64 64000L); ]); +("y4_lo", [2; 4; 9; 13; 14; 21; 23; 26; 27; 28; 29; 31; 32; 35; 39; 41; 42; 47; 48; 52; 53; ], [(mk_real_int64 6240L); (mk_real_int64 16200L); (mk_real_int64 29200L); (mk_real_int64 51400L); (mk_real_int64 35000L); (mk_real_int64 5500L); (mk_real_int64 22800L); (mk_real_int64 49200L); (mk_real_int64 22500L); (mk_real_int64 49200L); (mk_real_int64 37500L); (mk_real_int64 5500L); (mk_real_int64 22800L); (mk_real_int64 37500L); (mk_real_int64 35000L); (mk_real_int64 51400L); (mk_real_int64 29200L); (mk_real_int64 39600L); (mk_real_int64 16200L); (mk_real_int64 6240L); (mk_real_int64 35500L); ]); +("y5_hi", [1; 4; 5; 7; 8; 12; 15; 17; 20; 23; 25; 29; 35; 45; 48; 51; 52; 54; 59; ], [(mk_real_int64 45200L); (mk_real_int64 30370L); (mk_real_int64 14000L); (mk_real_int64 9440L); (mk_real_int64 16300L); (mk_real_int64 50000L); (mk_real_int64 10530L); (mk_real_int64 33600L); (mk_real_int64 14800L); (mk_real_int64 6920L); (mk_real_int64 9170L); (mk_real_int64 59650L); (mk_real_int64 9170L); (mk_real_int64 33600L); (mk_real_int64 50000L); (mk_real_int64 20400L); (mk_real_int64 16300L); (mk_real_int64 9440L); (mk_real_int64 45200L); ]); +("y5_lo", [6; 11; 13; 18; 21; 24; 27; 30; 31; 32; 33; 36; 37; 38; 39; 41; 43; 46; 47; 55; 56; 57; ], [(mk_real_int64 6240L); (mk_real_int64 29600L); (mk_real_int64 29200L); (mk_real_int64 41100L); (mk_real_int64 15200L); (mk_real_int64 1600L); (mk_real_int64 22800L); (mk_real_int64 49200L); (mk_real_int64 2850L); (mk_real_int64 49200L); (mk_real_int64 37500L); (mk_real_int64 22800L); (mk_real_int64 55580L); (mk_real_int64 1600L); (mk_real_int64 37500L); (mk_real_int64 400L); (mk_real_int64 41100L); (mk_real_int64 29200L); (mk_real_int64 39470L); (mk_real_int64 36000L); (mk_real_int64 6240L); (mk_real_int64 19630L); ]); +("y6_hi", [1; 4; 5; 7; 8; 12; 15; 17; 20; 23; 25; 29; 35; 45; 48; 51; 54; 57; 59; ], [(mk_real_int64 45200L); (mk_real_int64 30370L); (mk_real_int64 14000L); (mk_real_int64 9440L); (mk_real_int64 16300L); (mk_real_int64 50000L); (mk_real_int64 10530L); (mk_real_int64 33600L); (mk_real_int64 14800L); (mk_real_int64 6920L); (mk_real_int64 9170L); (mk_real_int64 59650L); (mk_real_int64 9170L); (mk_real_int64 33600L); (mk_real_int64 50000L); (mk_real_int64 20400L); (mk_real_int64 9440L); (mk_real_int64 80370L); (mk_real_int64 45200L); ]); +("y6_lo", [6; 10; 11; 13; 17; 18; 21; 24; 27; 28; 30; 31; 32; 33; 34; 36; 37; 38; 39; 41; 43; 45; 46; 47; 51; 52; 53; 55; 56; 57; ], [(mk_real_int64 6240L); (mk_real_int64 612800000L); (mk_real_int64 1765529600L); (mk_real_int64 29200L); (mk_real_int64 273000000L); (mk_real_int64 41100L); (mk_real_int64 15200L); (mk_real_int64 1600L); (mk_real_int64 22800L); (mk_real_int64 40900000L); (mk_real_int64 49200L); (mk_real_int64 2850L); (mk_real_int64 49200L); (mk_real_int64 37500L); (mk_real_int64 40900000L); (mk_real_int64 22800L); (mk_real_int64 55580L); (mk_real_int64 1600L); (mk_real_int64 37500L); (mk_real_int64 400L); (mk_real_int64 41100L); (mk_real_int64 273000000L); (mk_real_int64 29200L); (mk_real_int64 39470L); (mk_real_int64 1765500000L); (mk_real_int64 612883700L); (mk_real_int64 427100000L); (mk_real_int64 36000L); (mk_real_int64 6240L); (mk_real_int64 200000000L); ]); +("ye_hi", [13; 31; 32; 33; 37; 39; ], [(mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); ]); +("ye_lo", [3; 5; 9; 10; 12; ], [(mk_real_int64 200000000L); (mk_real_int64 100000L); (mk_real_int64 427100000L); (mk_real_int64 100000L); (mk_real_int64 100000L); ]); +("yn_hi", [0; 1; 2; 3; 4; 5; 9; 10; 11; 12; ], [(mk_real_int64 39912L); (mk_real_int64 139912L); (mk_real_int64 39912L); (mk_real_int64 39912L); (mk_real_int64 39912L); (mk_real_int64 56624L); (mk_real_int64 39912L); (mk_real_int64 39912L); (mk_real_int64 139912L); (mk_real_int64 39912L); ]); +("yn_lo", [6; 7; 8; ], [(mk_real_int64 22503L); (mk_real_int64 43376L); (mk_real_int64 60088L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/158856256118_out.hl b/formal_lp/old/ineqs/tests2/158856256118_out.hl new file mode 100644 index 0000000..57e0919 --- /dev/null +++ b/formal_lp/old/ineqs/tests2/158856256118_out.hl @@ -0,0 +1,86 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "158856256118 24 4 0 1 2 3 3 0 3 4 3 4 3 5 3 5 3 2 3 5 2 6 3 6 2 7 3 7 2 1 3 7 1 8 3 8 1 9 3 9 1 0 4 9 0 4 10 3 10 4 11 3 11 4 5 3 11 5 12 3 12 5 6 3 12 6 13 3 13 6 7 3 13 7 8 3 13 8 14 3 12 13 14 3 14 8 9 3 14 9 10 3 12 14 10 3 10 11 12 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [0; 1; 2; 5; 6; 8; 10; 13; 14; ], [(mk_real_int64 66L); (mk_real_int64 246L); (mk_real_int64 88L); (mk_real_int64 570L); (mk_real_int64 540L); (mk_real_int64 59L); (mk_real_int64 486L); (mk_real_int64 114L); (mk_real_int64 625L); ]); +("azim_sum_neg", [4; 7; 9; ], [(mk_real_int64 88L); (mk_real_int64 26L); (mk_real_int64 142L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 942L); (mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 1087L); (mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 1107L); (mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 901L); (mk_real_int64 999L); ]); +("sol_sum3_neg", [3; 12; 13; ], [(mk_real_int64 246L); (mk_real_int64 540L); (mk_real_int64 59L); ]); +("sol_sum3", [6; ], [(mk_real_int64 26L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; ], [(mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 973L); (mk_real_int64 975L); (mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 973L); (mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 999L); (mk_real_int64 999L); ]); +("tau_sum4_neg", [0; 1; ], [(mk_real_int64 999L); (mk_real_int64 999L); ]); +("ln_def_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 14; ], [(mk_real_int64 39L); (mk_real_int64 101L); (mk_real_int64 101L); (mk_real_int64 101L); (mk_real_int64 198L); (mk_real_int64 101L); (mk_real_int64 101L); (mk_real_int64 101L); (mk_real_int64 101L); (mk_real_int64 220L); (mk_real_int64 101L); (mk_real_int64 101L); (mk_real_int64 108L); (mk_real_int64 101L); ]); +("ln_def", [13; ], [(mk_real_int64 6L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 5922L); (mk_real_int64 6275L); (mk_real_int64 6275L); (mk_real_int64 6275L); (mk_real_int64 6827L); (mk_real_int64 6275L); (mk_real_int64 6275L); (mk_real_int64 6275L); (mk_real_int64 6275L); (mk_real_int64 6953L); (mk_real_int64 6275L); (mk_real_int64 6275L); (mk_real_int64 6275L); (mk_real_int64 5663L); (mk_real_int64 6275L); ]); +("edge_sym_neg", [5; 14; 18; 21; 23; 24; 27; 36; 43; 46; 48; 49; 52; 55; 57; 58; 67; ], [(mk_real_int64 125L); (mk_real_int64 307L); (mk_real_int64 158L); (mk_real_int64 285L); (mk_real_int64 98L); (mk_real_int64 82L); (mk_real_int64 2L); (mk_real_int64 125L); (mk_real_int64 5L); (mk_real_int64 208L); (mk_real_int64 386L); (mk_real_int64 62L); (mk_real_int64 477L); (mk_real_int64 92L); (mk_real_int64 171L); (mk_real_int64 77L); (mk_real_int64 177L); ]); +("edge_sym", [8; 9; 12; 15; 26; 40; 42; ], [(mk_real_int64 11L); (mk_real_int64 11L); (mk_real_int64 157L); (mk_real_int64 34L); (mk_real_int64 10L); (mk_real_int64 178L); (mk_real_int64 208L); ]); +("y1_def_neg", [4; 8; 9; 10; 12; 13; 15; 16; 17; 18; 20; 21; 22; 23; 30; 37; 39; 42; 43; 45; 47; 48; 49; 50; 51; 53; 55; 56; 57; 59; 60; 63; 64; 66; 67; ], [(mk_real_int64 180L); (mk_real_int64 54L); (mk_real_int64 31L); (mk_real_int64 112L); (mk_real_int64 210L); (mk_real_int64 76L); (mk_real_int64 190L); (mk_real_int64 45L); (mk_real_int64 58L); (mk_real_int64 66L); (mk_real_int64 73L); (mk_real_int64 142L); (mk_real_int64 18L); (mk_real_int64 139L); (mk_real_int64 15L); (mk_real_int64 180L); (mk_real_int64 16L); (mk_real_int64 48L); (mk_real_int64 86L); (mk_real_int64 147L); (mk_real_int64 133L); (mk_real_int64 60L); (mk_real_int64 93L); (mk_real_int64 14L); (mk_real_int64 307L); (mk_real_int64 29L); (mk_real_int64 171L); (mk_real_int64 14L); (mk_real_int64 163L); (mk_real_int64 58L); (mk_real_int64 85L); (mk_real_int64 25L); (mk_real_int64 2L); (mk_real_int64 40L); (mk_real_int64 89L); ]); +("y1_def", [14; 25; 46; 52; ], [(mk_real_int64 93L); (mk_real_int64 7L); (mk_real_int64 205L); (mk_real_int64 13L); ]); +("y2_def_neg", [4; 8; 12; 15; 18; 21; 23; 25; 30; 37; 39; 45; 49; 52; 55; 57; 60; 63; 67; ], [(mk_real_int64 180L); (mk_real_int64 54L); (mk_real_int64 63L); (mk_real_int64 81L); (mk_real_int64 83L); (mk_real_int64 142L); (mk_real_int64 131L); (mk_real_int64 2L); (mk_real_int64 15L); (mk_real_int64 180L); (mk_real_int64 16L); (mk_real_int64 147L); (mk_real_int64 93L); (mk_real_int64 4L); (mk_real_int64 176L); (mk_real_int64 185L); (mk_real_int64 50L); (mk_real_int64 48L); (mk_real_int64 89L); ]); +("y2_def", [9; 10; 13; 14; 16; 17; 20; 22; 42; 43; 46; 47; 48; 50; 51; 53; 56; 59; 64; 66; ], [(mk_real_int64 48L); (mk_real_int64 173L); (mk_real_int64 118L); (mk_real_int64 93L); (mk_real_int64 69L); (mk_real_int64 90L); (mk_real_int64 99L); (mk_real_int64 5L); (mk_real_int64 74L); (mk_real_int64 134L); (mk_real_int64 205L); (mk_real_int64 206L); (mk_real_int64 94L); (mk_real_int64 22L); (mk_real_int64 17L); (mk_real_int64 31L); (mk_real_int64 22L); (mk_real_int64 90L); (mk_real_int64 3L); (mk_real_int64 62L); ]); +("y3_def_neg", [4; 8; 12; 15; 18; 21; 23; 25; 30; 37; 39; 45; 49; 52; 55; 57; 60; 63; 67; ], [(mk_real_int64 180L); (mk_real_int64 54L); (mk_real_int64 63L); (mk_real_int64 81L); (mk_real_int64 83L); (mk_real_int64 142L); (mk_real_int64 131L); (mk_real_int64 2L); (mk_real_int64 15L); (mk_real_int64 180L); (mk_real_int64 16L); (mk_real_int64 147L); (mk_real_int64 93L); (mk_real_int64 4L); (mk_real_int64 176L); (mk_real_int64 185L); (mk_real_int64 50L); (mk_real_int64 48L); (mk_real_int64 89L); ]); +("y3_def", [9; 10; 13; 14; 16; 17; 20; 22; 42; 43; 46; 47; 48; 50; 51; 53; 56; 59; 64; 66; ], [(mk_real_int64 48L); (mk_real_int64 173L); (mk_real_int64 118L); (mk_real_int64 93L); (mk_real_int64 69L); (mk_real_int64 90L); (mk_real_int64 99L); (mk_real_int64 5L); (mk_real_int64 74L); (mk_real_int64 134L); (mk_real_int64 205L); (mk_real_int64 206L); (mk_real_int64 94L); (mk_real_int64 22L); (mk_real_int64 17L); (mk_real_int64 31L); (mk_real_int64 22L); (mk_real_int64 90L); (mk_real_int64 3L); (mk_real_int64 62L); ]); +("y4_def_neg", [0; 4; 5; 6; 8; 9; 10; 11; 12; 13; 14; 16; 17; 18; 19; 26; 29; 31; 34; 35; 37; 38; 39; 40; 41; 42; 43; 45; 47; 48; 49; 51; 52; 55; 56; 58; 59; ], [(mk_real_int64 125L); (mk_real_int64 37L); (mk_real_int64 91L); (mk_real_int64 325L); (mk_real_int64 274L); (mk_real_int64 222L); (mk_real_int64 48L); (mk_real_int64 226L); (mk_real_int64 130L); (mk_real_int64 168L); (mk_real_int64 35L); (mk_real_int64 186L); (mk_real_int64 99L); (mk_real_int64 8L); (mk_real_int64 99L); (mk_real_int64 10L); (mk_real_int64 125L); (mk_real_int64 11L); (mk_real_int64 139L); (mk_real_int64 252L); (mk_real_int64 102L); (mk_real_int64 106L); (mk_real_int64 388L); (mk_real_int64 176L); (mk_real_int64 92L); (mk_real_int64 41L); (mk_real_int64 495L); (mk_real_int64 58L); (mk_real_int64 115L); (mk_real_int64 41L); (mk_real_int64 98L); (mk_real_int64 170L); (mk_real_int64 90L); (mk_real_int64 3L); (mk_real_int64 6L); (mk_real_int64 116L); (mk_real_int64 62L); ]); +("y4_def", [21; 44; ], [(mk_real_int64 10L); (mk_real_int64 20L); ]); +("y5_def_neg", [4; 8; 12; 14; 15; 18; 21; 23; 25; 30; 37; 39; 45; 46; 49; 52; 55; 57; 60; 63; 67; ], [(mk_real_int64 125L); (mk_real_int64 37L); (mk_real_int64 16L); (mk_real_int64 48L); (mk_real_int64 36L); (mk_real_int64 59L); (mk_real_int64 99L); (mk_real_int64 90L); (mk_real_int64 2L); (mk_real_int64 10L); (mk_real_int64 125L); (mk_real_int64 11L); (mk_real_int64 102L); (mk_real_int64 106L); (mk_real_int64 92L); (mk_real_int64 4L); (mk_real_int64 123L); (mk_real_int64 130L); (mk_real_int64 28L); (mk_real_int64 35L); (mk_real_int64 62L); ]); +("y5_def", [9; 10; 13; 16; 17; 20; 22; 42; 43; 47; 48; 50; 51; 53; 56; 59; 64; 66; ], [(mk_real_int64 48L); (mk_real_int64 173L); (mk_real_int64 118L); (mk_real_int64 69L); (mk_real_int64 90L); (mk_real_int64 99L); (mk_real_int64 17L); (mk_real_int64 74L); (mk_real_int64 134L); (mk_real_int64 206L); (mk_real_int64 94L); (mk_real_int64 22L); (mk_real_int64 72L); (mk_real_int64 31L); (mk_real_int64 22L); (mk_real_int64 90L); (mk_real_int64 3L); (mk_real_int64 62L); ]); +("y6_def", [6; 7; 9; 10; 11; 13; 16; 17; 20; 22; 29; 35; 38; 42; 43; 45; 47; 48; 50; 51; 53; 54; 56; 59; 60; 62; 64; 66; 69; 72; ], [(mk_real_int64 125L); (mk_real_int64 253L); (mk_real_int64 48L); (mk_real_int64 263L); (mk_real_int64 342L); (mk_real_int64 118L); (mk_real_int64 69L); (mk_real_int64 90L); (mk_real_int64 99L); (mk_real_int64 375L); (mk_real_int64 10L); (mk_real_int64 125L); (mk_real_int64 136L); (mk_real_int64 74L); (mk_real_int64 134L); (mk_real_int64 72L); (mk_real_int64 206L); (mk_real_int64 94L); (mk_real_int64 294L); (mk_real_int64 203L); (mk_real_int64 592L); (mk_real_int64 263L); (mk_real_int64 222L); (mk_real_int64 90L); (mk_real_int64 247L); (mk_real_int64 211L); (mk_real_int64 3L); (mk_real_int64 62L); (mk_real_int64 177L); (mk_real_int64 5L); ]); +("y6_def_neg", [8; 12; 14; 15; 18; 21; 23; 25; 39; 46; 49; 52; 55; 57; 63; 67; ], [(mk_real_int64 37L); (mk_real_int64 16L); (mk_real_int64 48L); (mk_real_int64 36L); (mk_real_int64 59L); (mk_real_int64 99L); (mk_real_int64 90L); (mk_real_int64 2L); (mk_real_int64 11L); (mk_real_int64 106L); (mk_real_int64 92L); (mk_real_int64 4L); (mk_real_int64 123L); (mk_real_int64 130L); (mk_real_int64 1L); (mk_real_int64 62L); ]); +("RHA", [6; 7; 19; 21; 23; 24; 25; 33; 36; 39; 54; 55; 57; 63; ], [(mk_real_int64 88L); (mk_real_int64 88L); (mk_real_int64 26L); (mk_real_int64 26L); (mk_real_int64 15L); (mk_real_int64 131L); (mk_real_int64 108L); (mk_real_int64 88L); (mk_real_int64 88L); (mk_real_int64 88L); (mk_real_int64 26L); (mk_real_int64 134L); (mk_real_int64 108L); (mk_real_int64 108L); ]); +("RHB", [3; 5; 8; 11; 37; 38; 41; 72; ], [(mk_real_int64 56L); (mk_real_int64 56L); (mk_real_int64 56L); (mk_real_int64 56L); (mk_real_int64 97L); (mk_real_int64 97L); (mk_real_int64 97L); (mk_real_int64 97L); ]); +("tau4", [0; 1; ], [(mk_real_int64 557L); (mk_real_int64 357L); ]); +("ineq106", [16; 18; 19; 45; ], [(mk_real_int64 26L); (mk_real_int64 23L); (mk_real_int64 8L); (mk_real_int64 26L); ]); +("ineq107", [14; 21; 44; 47; 49; 55; ], [(mk_real_int64 26L); (mk_real_int64 13L); (mk_real_int64 26L); (mk_real_int64 8L); (mk_real_int64 34L); (mk_real_int64 34L); ]); +("ineq108", [5; 6; 8; 9; 11; 12; 13; 16; 34; 35; 39; 40; 42; 43; 45; 48; 51; 52; 56; 58; ], [(mk_real_int64 133L); (mk_real_int64 475L); (mk_real_int64 246L); (mk_real_int64 324L); (mk_real_int64 181L); (mk_real_int64 190L); (mk_real_int64 246L); (mk_real_int64 246L); (mk_real_int64 202L); (mk_real_int64 368L); (mk_real_int64 566L); (mk_real_int64 257L); (mk_real_int64 59L); (mk_real_int64 540L); (mk_real_int64 59L); (mk_real_int64 59L); (mk_real_int64 248L); (mk_real_int64 59L); (mk_real_int64 8L); (mk_real_int64 169L); ]); +("ineq109", [18; ], [(mk_real_int64 26L); ]); +("ineq110", [10; 38; 41; ], [(mk_real_int64 246L); (mk_real_int64 540L); (mk_real_int64 59L); ]); +("ineq111", [0; 4; 8; 11; 14; 17; 19; 26; 29; 31; 37; 41; 43; 47; 49; 52; 55; 59; ], [(mk_real_int64 999L); (mk_real_int64 300L); (mk_real_int64 846L); (mk_real_int64 818L); (mk_real_int64 440L); (mk_real_int64 791L); (mk_real_int64 745L); (mk_real_int64 81L); (mk_real_int64 999L); (mk_real_int64 87L); (mk_real_int64 814L); (mk_real_int64 642L); (mk_real_int64 999L); (mk_real_int64 973L); (mk_real_int64 999L); (mk_real_int64 396L); (mk_real_int64 235L); (mk_real_int64 492L); ]); +("ineq113", [21; ], [(mk_real_int64 81L); ]); +("ineq114", [5; 6; 11; 12; 17; 19; 20; 22; 23; 24; 25; 32; 34; 35; 36; 37; 40; 51; 56; 58; 60; 65; ], [(mk_real_int64 699L); (mk_real_int64 153L); (mk_real_int64 180L); (mk_real_int64 559L); (mk_real_int64 182L); (mk_real_int64 207L); (mk_real_int64 24L); (mk_real_int64 141L); (mk_real_int64 776L); (mk_real_int64 776L); (mk_real_int64 141L); (mk_real_int64 911L); (mk_real_int64 588L); (mk_real_int64 411L); (mk_real_int64 136L); (mk_real_int64 49L); (mk_real_int64 357L); (mk_real_int64 602L); (mk_real_int64 764L); (mk_real_int64 506L); (mk_real_int64 999L); (mk_real_int64 999L); ]); +("ineq120", [1; 2; 4; ], [(mk_real_int64 116L); (mk_real_int64 325L); (mk_real_int64 642L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 2650L); (mk_real_int64 2875L); (mk_real_int64 2875L); (mk_real_int64 2875L); (mk_real_int64 3275L); (mk_real_int64 2875L); (mk_real_int64 2875L); (mk_real_int64 2875L); (mk_real_int64 2875L); (mk_real_int64 3225L); (mk_real_int64 2875L); (mk_real_int64 2875L); (mk_real_int64 9875L); (mk_real_int64 2975L); (mk_real_int64 2875L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [2; 9; 10; 23; 24; 25; 26; 29; 31; 37; 38; 40; 41; 42; 43; 44; 45; 64; 68; 72; 73; ], [(mk_real_int64 350L); (mk_real_int64 574L); (mk_real_int64 778L); (mk_real_int64 582L); (mk_real_int64 24L); (mk_real_int64 21L); (mk_real_int64 266L); (mk_real_int64 266L); (mk_real_int64 636L); (mk_real_int64 72L); (mk_real_int64 72L); (mk_real_int64 286L); (mk_real_int64 72L); (mk_real_int64 88L); (mk_real_int64 286L); (mk_real_int64 136L); (mk_real_int64 674L); (mk_real_int64 264L); (mk_real_int64 374L); (mk_real_int64 72L); (mk_real_int64 374L); ]); +("azim_lo", [1; 3; 5; 8; 11; 15; 16; 21; 27; 28; 48; 59; 66; ], [(mk_real_int64 72L); (mk_real_int64 144L); (mk_real_int64 144L); (mk_real_int64 144L); (mk_real_int64 144L); (mk_real_int64 320L); (mk_real_int64 66L); (mk_real_int64 68L); (mk_real_int64 224L); (mk_real_int64 224L); (mk_real_int64 518L); (mk_real_int64 148L); (mk_real_int64 244L); ]); +("rhazim_hi", [3; 5; 8; 11; 37; 38; 41; 72; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_lo", [22; 23; 24; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_hi", [1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 14; ], [(mk_real_int64 2716L); (mk_real_int64 2716L); (mk_real_int64 2716L); (mk_real_int64 3708L); (mk_real_int64 2716L); (mk_real_int64 2716L); (mk_real_int64 2716L); (mk_real_int64 2716L); (mk_real_int64 3388L); (mk_real_int64 2716L); (mk_real_int64 2716L); (mk_real_int64 2716L); (mk_real_int64 2716L); ]); +("rho_lo", [0; 13; ], [(mk_real_int64 2472L); (mk_real_int64 1116L); ]); +("tau_lo", [0; 4; 8; 9; 12; 19; 21; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("tau_hi", [7; ], [(mk_real_int64 1000L); ]); +("y1_hi", [4; 10; 14; 15; 16; 17; 22; 23; 30; 37; 39; 42; 45; 46; 50; 51; 56; 57; 64; 66; 67; ], [(mk_real_int64 180L); (mk_real_int64 375L); (mk_real_int64 480L); (mk_real_int64 225L); (mk_real_int64 350L); (mk_real_int64 190L); (mk_real_int64 274L); (mk_real_int64 100L); (mk_real_int64 420L); (mk_real_int64 180L); (mk_real_int64 340L); (mk_real_int64 530L); (mk_real_int64 480L); (mk_real_int64 200L); (mk_real_int64 135L); (mk_real_int64 280L); (mk_real_int64 135L); (mk_real_int64 180L); (mk_real_int64 120L); (mk_real_int64 285L); (mk_real_int64 440L); ]); +("y1_lo", [9; 12; 13; 18; 20; 21; 25; 43; 47; 48; 49; 53; 55; 59; 60; 63; ], [(mk_real_int64 255L); (mk_real_int64 90L); (mk_real_int64 140L); (mk_real_int64 200L); (mk_real_int64 410L); (mk_real_int64 380L); (mk_real_int64 500L); (mk_real_int64 480L); (mk_real_int64 10L); (mk_real_int64 395L); (mk_real_int64 140L); (mk_real_int64 465L); (mk_real_int64 140L); (mk_real_int64 280L); (mk_real_int64 145L); (mk_real_int64 300L); ]); +("y2_hi", [4; 9; 12; 14; 16; 20; 25; 30; 37; 39; 45; 46; 47; 52; 57; 59; 60; 63; 67; ], [(mk_real_int64 180L); (mk_real_int64 412L); (mk_real_int64 264L); (mk_real_int64 480L); (mk_real_int64 160L); (mk_real_int64 8L); (mk_real_int64 24L); (mk_real_int64 420L); (mk_real_int64 180L); (mk_real_int64 340L); (mk_real_int64 480L); (mk_real_int64 200L); (mk_real_int64 24L); (mk_real_int64 48L); (mk_real_int64 12L); (mk_real_int64 272L); (mk_real_int64 196L); (mk_real_int64 532L); (mk_real_int64 440L); ]); +("y2_lo", [10; 13; 15; 17; 18; 21; 22; 23; 42; 43; 48; 49; 50; 51; 53; 55; 56; 64; 66; ], [(mk_real_int64 100L); (mk_real_int64 64L); (mk_real_int64 356L); (mk_real_int64 456L); (mk_real_int64 152L); (mk_real_int64 380L); (mk_real_int64 554L); (mk_real_int64 188L); (mk_real_int64 472L); (mk_real_int64 48L); (mk_real_int64 452L); (mk_real_int64 140L); (mk_real_int64 524L); (mk_real_int64 260L); (mk_real_int64 60L); (mk_real_int64 356L); (mk_real_int64 524L); (mk_real_int64 88L); (mk_real_int64 484L); ]); +("y3_hi", [4; 9; 12; 14; 16; 20; 25; 30; 37; 39; 45; 46; 47; 52; 57; 59; 60; 63; 67; ], [(mk_real_int64 180L); (mk_real_int64 412L); (mk_real_int64 264L); (mk_real_int64 480L); (mk_real_int64 160L); (mk_real_int64 8L); (mk_real_int64 24L); (mk_real_int64 420L); (mk_real_int64 180L); (mk_real_int64 340L); (mk_real_int64 480L); (mk_real_int64 200L); (mk_real_int64 24L); (mk_real_int64 48L); (mk_real_int64 12L); (mk_real_int64 272L); (mk_real_int64 196L); (mk_real_int64 532L); (mk_real_int64 440L); ]); +("y3_lo", [10; 13; 15; 17; 18; 21; 22; 23; 42; 43; 48; 49; 50; 51; 53; 55; 56; 64; 66; ], [(mk_real_int64 100L); (mk_real_int64 64L); (mk_real_int64 356L); (mk_real_int64 456L); (mk_real_int64 152L); (mk_real_int64 380L); (mk_real_int64 554L); (mk_real_int64 188L); (mk_real_int64 472L); (mk_real_int64 48L); (mk_real_int64 452L); (mk_real_int64 140L); (mk_real_int64 524L); (mk_real_int64 260L); (mk_real_int64 60L); (mk_real_int64 356L); (mk_real_int64 524L); (mk_real_int64 88L); (mk_real_int64 484L); ]); +("y4_hi", [0; 9; 14; 17; 18; 19; 21; 29; 31; 34; 37; 38; 39; 41; 42; 43; 44; 48; 51; 52; 56; 58; 59; ], [(mk_real_int64 125L); (mk_real_int64 60L); (mk_real_int64 98L); (mk_real_int64 125L); (mk_real_int64 669L); (mk_real_int64 395L); (mk_real_int64 49L); (mk_real_int64 125L); (mk_real_int64 125L); (mk_real_int64 630L); (mk_real_int64 250L); (mk_real_int64 160L); (mk_real_int64 290L); (mk_real_int64 186L); (mk_real_int64 585L); (mk_real_int64 225L); (mk_real_int64 98L); (mk_real_int64 585L); (mk_real_int64 120L); (mk_real_int64 85L); (mk_real_int64 520L); (mk_real_int64 235L); (mk_real_int64 500L); ]); +("y4_lo", [4; 5; 6; 8; 10; 11; 12; 13; 16; 26; 35; 40; 45; 47; 49; 55; ], [(mk_real_int64 500L); (mk_real_int64 105L); (mk_real_int64 375L); (mk_real_int64 260L); (mk_real_int64 216L); (mk_real_int64 235L); (mk_real_int64 150L); (mk_real_int64 510L); (mk_real_int64 320L); (mk_real_int64 125L); (mk_real_int64 80L); (mk_real_int64 45L); (mk_real_int64 225L); (mk_real_int64 441L); (mk_real_int64 593L); (mk_real_int64 93L); ]); +("y5_hi", [4; 9; 16; 18; 20; 21; 25; 37; 39; 45; 46; 47; 49; 52; 55; 59; 63; 67; ], [(mk_real_int64 125L); (mk_real_int64 412L); (mk_real_int64 160L); (mk_real_int64 48L); (mk_real_int64 8L); (mk_real_int64 125L); (mk_real_int64 24L); (mk_real_int64 125L); (mk_real_int64 125L); (mk_real_int64 250L); (mk_real_int64 160L); (mk_real_int64 24L); (mk_real_int64 186L); (mk_real_int64 48L); (mk_real_int64 159L); (mk_real_int64 272L); (mk_real_int64 457L); (mk_real_int64 500L); ]); +("y5_lo", [8; 10; 12; 13; 14; 15; 17; 22; 23; 30; 42; 43; 48; 50; 51; 53; 56; 57; 60; 64; 66; ], [(mk_real_int64 500L); (mk_real_int64 100L); (mk_real_int64 206L); (mk_real_int64 64L); (mk_real_int64 216L); (mk_real_int64 366L); (mk_real_int64 456L); (mk_real_int64 204L); (mk_real_int64 213L); (mk_real_int64 125L); (mk_real_int64 472L); (mk_real_int64 48L); (mk_real_int64 452L); (mk_real_int64 524L); (mk_real_int64 315L); (mk_real_int64 60L); (mk_real_int64 524L); (mk_real_int64 43L); (mk_real_int64 24L); (mk_real_int64 88L); (mk_real_int64 484L); ]); +("y6_lo", [4; 6; 7; 8; 10; 11; 12; 13; 14; 15; 17; 22; 23; 29; 30; 35; 37; 38; 42; 43; 45; 48; 50; 51; 53; 54; 56; 57; 60; 62; 63; 64; 66; 69; 72; ], [(mk_real_int64 125000L); (mk_real_int64 125000L); (mk_real_int64 253000L); (mk_real_int64 500L); (mk_real_int64 91000L); (mk_real_int64 342000L); (mk_real_int64 206L); (mk_real_int64 64L); (mk_real_int64 216L); (mk_real_int64 366L); (mk_real_int64 456L); (mk_real_int64 359000L); (mk_real_int64 213L); (mk_real_int64 10000L); (mk_real_int64 10125L); (mk_real_int64 125000L); (mk_real_int64 125000L); (mk_real_int64 136000L); (mk_real_int64 472L); (mk_real_int64 48L); (mk_real_int64 174000L); (mk_real_int64 452L); (mk_real_int64 273000L); (mk_real_int64 131315L); (mk_real_int64 561060L); (mk_real_int64 263000L); (mk_real_int64 200524L); (mk_real_int64 43L); (mk_real_int64 275024L); (mk_real_int64 211000L); (mk_real_int64 34000L); (mk_real_int64 88L); (mk_real_int64 484L); (mk_real_int64 177000L); (mk_real_int64 5000L); ]); +("y6_hi", [4; 9; 10; 16; 18; 20; 21; 22; 25; 37; 39; 45; 46; 47; 49; 50; 52; 55; 59; 63; 67; ], [(mk_real_int64 125L); (mk_real_int64 412L); (mk_real_int64 900L); (mk_real_int64 160L); (mk_real_int64 48L); (mk_real_int64 8L); (mk_real_int64 125L); (mk_real_int64 796L); (mk_real_int64 24L); (mk_real_int64 125L); (mk_real_int64 125L); (mk_real_int64 250L); (mk_real_int64 160L); (mk_real_int64 24L); (mk_real_int64 186L); (mk_real_int64 476L); (mk_real_int64 48L); (mk_real_int64 159L); (mk_real_int64 272L); (mk_real_int64 457L); (mk_real_int64 500L); ]); +("ye_lo", [16; 17; 25; 40; 62; 67; ], [(mk_real_int64 183000L); (mk_real_int64 100000L); (mk_real_int64 100000L); (mk_real_int64 189000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_hi", [11; 13; 14; 17; 58; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_lo", [0; 3; 4; 5; 6; 10; 11; ], [(mk_real_int64 964L); (mk_real_int64 676L); (mk_real_int64 1048L); (mk_real_int64 1676L); (mk_real_int64 676L); (mk_real_int64 1676L); (mk_real_int64 676L); ]); +("yn_hi", [1; 2; 7; 8; 9; 12; 13; 14; ], [(mk_real_int64 324L); (mk_real_int64 324L); (mk_real_int64 2324L); (mk_real_int64 1324L); (mk_real_int64 1280L); (mk_real_int64 792L); (mk_real_int64 462L); (mk_real_int64 324L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/165950391005_out.hl b/formal_lp/old/ineqs/tests2/165950391005_out.hl new file mode 100644 index 0000000..5f5ccfb --- /dev/null +++ b/formal_lp/old/ineqs/tests2/165950391005_out.hl @@ -0,0 +1,88 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "165950391005 21 4 0 1 2 3 3 0 3 4 3 4 3 5 3 5 3 2 4 5 2 6 7 3 6 2 1 3 6 1 8 3 8 1 0 4 8 0 9 10 3 9 0 4 3 9 4 11 3 11 4 5 3 11 5 7 3 7 6 12 3 12 6 8 3 12 8 10 3 10 9 13 3 13 9 11 3 13 11 7 3 13 7 12 3 12 10 13 ";; +let precision = 4;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [3; 10; ], [(mk_real_int64 3244L); (mk_real_int64 983L); ]); +("azim_sum_neg", [0; 1; 4; 9; 11; 12; 13; ], [(mk_real_int64 251L); (mk_real_int64 439L); (mk_real_int64 690L); (mk_real_int64 526L); (mk_real_int64 1768L); (mk_real_int64 2932L); (mk_real_int64 2652L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 9018L); (mk_real_int64 9966L); (mk_real_int64 9018L); (mk_real_int64 10756L); (mk_real_int64 10524L); (mk_real_int64 12623L); (mk_real_int64 12623L); (mk_real_int64 10756L); (mk_real_int64 10756L); (mk_real_int64 10985L); (mk_real_int64 12623L); (mk_real_int64 12160L); (mk_real_int64 10756L); (mk_real_int64 10756L); ]); +("sol_sum3", [2; 7; 8; 12; 13; 14; 15; 16; 17; ], [(mk_real_int64 251L); (mk_real_int64 690L); (mk_real_int64 65L); (mk_real_int64 363L); (mk_real_int64 2652L); (mk_real_int64 2652L); (mk_real_int64 297L); (mk_real_int64 363L); (mk_real_int64 2652L); ]); +("sol_sum3_neg", [6; ], [(mk_real_int64 232L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; ], [(mk_real_int64 9018L); (mk_real_int64 9018L); (mk_real_int64 9018L); (mk_real_int64 9018L); (mk_real_int64 9018L); (mk_real_int64 9018L); (mk_real_int64 10524L); (mk_real_int64 9239L); (mk_real_int64 10524L); (mk_real_int64 10985L); (mk_real_int64 11141L); (mk_real_int64 10756L); (mk_real_int64 10756L); (mk_real_int64 10756L); (mk_real_int64 10756L); (mk_real_int64 10756L); (mk_real_int64 10756L); (mk_real_int64 10756L); ]); +("tau_sum4_neg", [0; 1; 2; ], [(mk_real_int64 9018L); (mk_real_int64 12623L); (mk_real_int64 10756L); ]); +("ln_def_neg", [1; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 989L); (mk_real_int64 1859L); (mk_real_int64 1603L); (mk_real_int64 3917L); (mk_real_int64 3917L); (mk_real_int64 1859L); (mk_real_int64 1859L); (mk_real_int64 2194L); (mk_real_int64 3917L); (mk_real_int64 3407L); (mk_real_int64 1859L); (mk_real_int64 1859L); ]); +("ln_def", [0; 2; ], [(mk_real_int64 57L); (mk_real_int64 57L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 56665L); (mk_real_int64 62621L); (mk_real_int64 56665L); (mk_real_int64 67581L); (mk_real_int64 66122L); (mk_real_int64 79310L); (mk_real_int64 79310L); (mk_real_int64 67581L); (mk_real_int64 67581L); (mk_real_int64 69022L); (mk_real_int64 79310L); (mk_real_int64 76405L); (mk_real_int64 67581L); (mk_real_int64 67581L); ]); +("edge_sym_neg", [5; 19; 21; 32; 35; 38; 41; 44; 47; 59; 62; ], [(mk_real_int64 2777L); (mk_real_int64 757L); (mk_real_int64 2308L); (mk_real_int64 853L); (mk_real_int64 990L); (mk_real_int64 24L); (mk_real_int64 1718L); (mk_real_int64 1554L); (mk_real_int64 2678L); (mk_real_int64 461L); (mk_real_int64 2927L); ]); +("edge_sym", [6; 8; 9; 22; 25; 34; 50; 52; 56; ], [(mk_real_int64 853L); (mk_real_int64 41L); (mk_real_int64 273L); (mk_real_int64 384L); (mk_real_int64 391L); (mk_real_int64 358L); (mk_real_int64 73L); (mk_real_int64 258L); (mk_real_int64 656L); ]); +("y1_def", [5; 8; 30; 57; 60; 64; ], [(mk_real_int64 125L); (mk_real_int64 125L); (mk_real_int64 88L); (mk_real_int64 1178L); (mk_real_int64 1145L); (mk_real_int64 140L); ]); +("y1_def_neg", [4; 6; 9; 11; 12; 18; 20; 22; 23; 25; 32; 33; 34; 36; 37; 38; 40; 43; 44; 45; 46; 50; 51; 53; 55; 56; 58; 59; 61; 62; 63; 65; ], [(mk_real_int64 1396L); (mk_real_int64 1414L); (mk_real_int64 2105L); (mk_real_int64 515L); (mk_real_int64 494L); (mk_real_int64 893L); (mk_real_int64 1540L); (mk_real_int64 952L); (mk_real_int64 224L); (mk_real_int64 421L); (mk_real_int64 500L); (mk_real_int64 104L); (mk_real_int64 1250L); (mk_real_int64 10L); (mk_real_int64 1581L); (mk_real_int64 1275L); (mk_real_int64 1841L); (mk_real_int64 889L); (mk_real_int64 776L); (mk_real_int64 1754L); (mk_real_int64 1120L); (mk_real_int64 602L); (mk_real_int64 261L); (mk_real_int64 1173L); (mk_real_int64 747L); (mk_real_int64 689L); (mk_real_int64 1936L); (mk_real_int64 1466L); (mk_real_int64 2871L); (mk_real_int64 55L); (mk_real_int64 1278L); (mk_real_int64 401L); ]); +("y2_def_neg", [5; 6; 8; 9; 11; 18; 22; 32; 33; 34; 36; 37; 40; 44; 45; 50; 51; 53; 55; 56; 57; 58; 60; 61; 62; 63; 64; 65; ], [(mk_real_int64 38L); (mk_real_int64 843L); (mk_real_int64 38L); (mk_real_int64 202L); (mk_real_int64 515L); (mk_real_int64 402L); (mk_real_int64 815L); (mk_real_int64 1102L); (mk_real_int64 104L); (mk_real_int64 11L); (mk_real_int64 10L); (mk_real_int64 1989L); (mk_real_int64 262L); (mk_real_int64 776L); (mk_real_int64 1991L); (mk_real_int64 2277L); (mk_real_int64 443L); (mk_real_int64 1173L); (mk_real_int64 747L); (mk_real_int64 83L); (mk_real_int64 358L); (mk_real_int64 1936L); (mk_real_int64 348L); (mk_real_int64 840L); (mk_real_int64 55L); (mk_real_int64 1278L); (mk_real_int64 42L); (mk_real_int64 401L); ]); +("y2_def", [4; 12; 20; 23; 25; 30; 38; 43; 46; 59; ], [(mk_real_int64 1179L); (mk_real_int64 239L); (mk_real_int64 934L); (mk_real_int64 136L); (mk_real_int64 255L); (mk_real_int64 88L); (mk_real_int64 787L); (mk_real_int64 539L); (mk_real_int64 679L); (mk_real_int64 1100L); ]); +("y3_def_neg", [5; 6; 8; 9; 11; 18; 22; 32; 33; 34; 36; 37; 40; 44; 45; 50; 51; 53; 55; 56; 57; 58; 60; 61; 62; 63; 64; 65; ], [(mk_real_int64 38L); (mk_real_int64 843L); (mk_real_int64 38L); (mk_real_int64 202L); (mk_real_int64 515L); (mk_real_int64 402L); (mk_real_int64 815L); (mk_real_int64 1102L); (mk_real_int64 104L); (mk_real_int64 11L); (mk_real_int64 10L); (mk_real_int64 1989L); (mk_real_int64 262L); (mk_real_int64 776L); (mk_real_int64 1991L); (mk_real_int64 2277L); (mk_real_int64 443L); (mk_real_int64 1173L); (mk_real_int64 747L); (mk_real_int64 83L); (mk_real_int64 358L); (mk_real_int64 1936L); (mk_real_int64 348L); (mk_real_int64 840L); (mk_real_int64 55L); (mk_real_int64 1278L); (mk_real_int64 42L); (mk_real_int64 401L); ]); +("y3_def", [4; 12; 20; 23; 25; 30; 38; 43; 46; 59; ], [(mk_real_int64 1179L); (mk_real_int64 239L); (mk_real_int64 934L); (mk_real_int64 136L); (mk_real_int64 255L); (mk_real_int64 88L); (mk_real_int64 787L); (mk_real_int64 539L); (mk_real_int64 679L); (mk_real_int64 1100L); ]); +("y4_def", [1; 4; 20; 21; 24; 38; 39; 44; 45; 48; 50; 52; 53; ], [(mk_real_int64 194L); (mk_real_int64 194L); (mk_real_int64 46L); (mk_real_int64 223L); (mk_real_int64 21L); (mk_real_int64 831L); (mk_real_int64 1073L); (mk_real_int64 260L); (mk_real_int64 1821L); (mk_real_int64 1770L); (mk_real_int64 117L); (mk_real_int64 216L); (mk_real_int64 857L); ]); +("y4_def_neg", [0; 2; 5; 7; 8; 10; 12; 14; 15; 17; 18; 22; 25; 26; 28; 31; 32; 33; 34; 41; 43; 46; 47; 49; 51; ], [(mk_real_int64 2220L); (mk_real_int64 1141L); (mk_real_int64 1991L); (mk_real_int64 358L); (mk_real_int64 440L); (mk_real_int64 757L); (mk_real_int64 1758L); (mk_real_int64 700L); (mk_real_int64 255L); (mk_real_int64 480L); (mk_real_int64 46L); (mk_real_int64 1213L); (mk_real_int64 832L); (mk_real_int64 1482L); (mk_real_int64 1718L); (mk_real_int64 1015L); (mk_real_int64 539L); (mk_real_int64 1064L); (mk_real_int64 1279L); (mk_real_int64 815L); (mk_real_int64 519L); (mk_real_int64 1344L); (mk_real_int64 2060L); (mk_real_int64 2697L); (mk_real_int64 887L); ]); +("y5_def_neg", [5; 6; 8; 11; 18; 22; 27; 30; 32; 37; 44; 45; 50; 53; 55; 57; 58; 60; 61; 63; 64; ], [(mk_real_int64 38L); (mk_real_int64 520L); (mk_real_int64 38L); (mk_real_int64 358L); (mk_real_int64 222L); (mk_real_int64 550L); (mk_real_int64 391L); (mk_real_int64 46L); (mk_real_int64 808L); (mk_real_int64 1411L); (mk_real_int64 539L); (mk_real_int64 1400L); (mk_real_int64 1545L); (mk_real_int64 815L); (mk_real_int64 519L); (mk_real_int64 358L); (mk_real_int64 1344L); (mk_real_int64 348L); (mk_real_int64 333L); (mk_real_int64 887L); (mk_real_int64 42L); ]); +("y5_def", [4; 9; 12; 20; 23; 25; 33; 34; 36; 38; 43; 46; 51; 56; 59; 62; 65; ], [(mk_real_int64 1179L); (mk_real_int64 79L); (mk_real_int64 358L); (mk_real_int64 934L); (mk_real_int64 136L); (mk_real_int64 255L); (mk_real_int64 223L); (mk_real_int64 135L); (mk_real_int64 21L); (mk_real_int64 787L); (mk_real_int64 539L); (mk_real_int64 679L); (mk_real_int64 815L); (mk_real_int64 1174L); (mk_real_int64 1241L); (mk_real_int64 117L); (mk_real_int64 857L); ]); +("y6_def_neg", [5; 6; 8; 11; 22; 30; 32; 37; 44; 45; 50; 53; 55; 58; 61; 63; ], [(mk_real_int64 38L); (mk_real_int64 520L); (mk_real_int64 38L); (mk_real_int64 358L); (mk_real_int64 550L); (mk_real_int64 46L); (mk_real_int64 808L); (mk_real_int64 1081L); (mk_real_int64 539L); (mk_real_int64 679L); (mk_real_int64 1545L); (mk_real_int64 815L); (mk_real_int64 185L); (mk_real_int64 1344L); (mk_real_int64 333L); (mk_real_int64 887L); ]); +("y6_def", [4; 7; 9; 10; 12; 17; 20; 23; 25; 33; 34; 36; 38; 39; 43; 46; 48; 49; 51; 56; 57; 59; 60; 62; 64; 65; ], [(mk_real_int64 1179L); (mk_real_int64 4807L); (mk_real_int64 79L); (mk_real_int64 756L); (mk_real_int64 358L); (mk_real_int64 222L); (mk_real_int64 1456L); (mk_real_int64 2789L); (mk_real_int64 255L); (mk_real_int64 718L); (mk_real_int64 135L); (mk_real_int64 2535L); (mk_real_int64 787L); (mk_real_int64 24L); (mk_real_int64 539L); (mk_real_int64 679L); (mk_real_int64 1848L); (mk_real_int64 1545L); (mk_real_int64 815L); (mk_real_int64 1174L); (mk_real_int64 2748L); (mk_real_int64 1241L); (mk_real_int64 677L); (mk_real_int64 117L); (mk_real_int64 30L); (mk_real_int64 3599L); ]); +("y8_def_neg", [10; ], [(mk_real_int64 391L); ]); +("RHA", [0; 2; 6; 7; 9; 10; 12; 17; 18; 20; 22; 23; 25; 30; 31; 33; 35; 36; 41; 42; 44; 45; 48; 58; 62; 63; ], [(mk_real_int64 1737L); (mk_real_int64 948L); (mk_real_int64 913L); (mk_real_int64 1505L); (mk_real_int64 1630L); (mk_real_int64 3604L); (mk_real_int64 188L); (mk_real_int64 3604L); (mk_real_int64 439L); (mk_real_int64 1037L); (mk_real_int64 1595L); (mk_real_int64 1365L); (mk_real_int64 1036L); (mk_real_int64 232L); (mk_real_int64 232L); (mk_real_int64 1517L); (mk_real_int64 1746L); (mk_real_int64 462L); (mk_real_int64 1637L); (mk_real_int64 1482L); (mk_real_int64 1019L); (mk_real_int64 1404L); (mk_real_int64 1404L); (mk_real_int64 229L); (mk_real_int64 1404L); (mk_real_int64 1404L); ]); +("RHB", [14; ], [(mk_real_int64 2656L); ]); +("tau4", [0; 1; ], [(mk_real_int64 1214L); (mk_real_int64 3463L); ]); +("ineq106", [0; 2; 5; 8; 10; 12; 14; 15; 17; 22; 26; 28; 31; 34; 44; 47; 49; ], [(mk_real_int64 1737L); (mk_real_int64 593L); (mk_real_int64 1974L); (mk_real_int64 760L); (mk_real_int64 509L); (mk_real_int64 2567L); (mk_real_int64 143L); (mk_real_int64 373L); (mk_real_int64 701L); (mk_real_int64 1285L); (mk_real_int64 2099L); (mk_real_int64 1637L); (mk_real_int64 1482L); (mk_real_int64 1867L); (mk_real_int64 229L); (mk_real_int64 1867L); (mk_real_int64 1867L); ]); +("ineq107", [1; 4; 20; 25; 33; 38; 39; 45; 48; 52; ], [(mk_real_int64 251L); (mk_real_int64 251L); (mk_real_int64 923L); (mk_real_int64 626L); (mk_real_int64 363L); (mk_real_int64 2568L); (mk_real_int64 279L); (mk_real_int64 2356L); (mk_real_int64 2289L); (mk_real_int64 279L); ]); +("ineq108", [0; 26; 44; 47; 49; ], [(mk_real_int64 1503L); (mk_real_int64 65L); (mk_real_int64 642L); (mk_real_int64 1280L); (mk_real_int64 387L); ]); +("ineq109", [8; 21; 24; 38; 39; 44; 47; 50; 53; ], [(mk_real_int64 251L); (mk_real_int64 690L); (mk_real_int64 65L); (mk_real_int64 363L); (mk_real_int64 2652L); (mk_real_int64 2652L); (mk_real_int64 297L); (mk_real_int64 363L); (mk_real_int64 2652L); ]); +("ineq110", [18; ], [(mk_real_int64 232L); ]); +("ineq111", [2; 5; 7; 10; 14; 20; 22; 25; 28; 32; 33; 38; 41; 43; 46; 49; 51; ], [(mk_real_int64 5881L); (mk_real_int64 5113L); (mk_real_int64 2861L); (mk_real_int64 3261L); (mk_real_int64 4814L); (mk_real_int64 5341L); (mk_real_int64 2661L); (mk_real_int64 10524L); (mk_real_int64 4767L); (mk_real_int64 4314L); (mk_real_int64 10756L); (mk_real_int64 10176L); (mk_real_int64 6519L); (mk_real_int64 4148L); (mk_real_int64 10756L); (mk_real_int64 9223L); (mk_real_int64 7099L); ]); +("ineq113", [27; 32; ], [(mk_real_int64 2032L); (mk_real_int64 2889L); ]); +("ineq114", [0; 2; 3; 5; 6; 9; 12; 14; 15; 17; 19; 21; 23; 29; 30; 37; 40; 43; 44; 49; 51; ], [(mk_real_int64 2782L); (mk_real_int64 355L); (mk_real_int64 1302L); (mk_real_int64 2604L); (mk_real_int64 6158L); (mk_real_int64 5757L); (mk_real_int64 1657L); (mk_real_int64 2547L); (mk_real_int64 2180L); (mk_real_int64 6838L); (mk_real_int64 5183L); (mk_real_int64 3526L); (mk_real_int64 3052L); (mk_real_int64 4187L); (mk_real_int64 3938L); (mk_real_int64 580L); (mk_real_int64 4237L); (mk_real_int64 4237L); (mk_real_int64 2371L); (mk_real_int64 1533L); (mk_real_int64 3657L); ]); +("ineq119", [3; 5; 11; ], [(mk_real_int64 553L); (mk_real_int64 7861L); (mk_real_int64 6472L); ]); +("ineq120", [0; 2; 7; 9; ], [(mk_real_int64 6578L); (mk_real_int64 673L); (mk_real_int64 1299L); (mk_real_int64 4284L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 39590L); (mk_real_int64 52766L); (mk_real_int64 39590L); (mk_real_int64 52926L); (mk_real_int64 52012L); (mk_real_int64 60260L); (mk_real_int64 60260L); (mk_real_int64 52926L); (mk_real_int64 52926L); (mk_real_int64 875412L); (mk_real_int64 60260L); (mk_real_int64 55630L); (mk_real_int64 52926L); (mk_real_int64 52926L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [0; 2; 3; 4; 7; 9; 14; 16; 20; 25; 27; 29; 31; 33; 35; 41; 42; 44; 45; 48; 49; 50; 51; 52; 55; 56; 61; 62; 63; 64; ], [(mk_real_int64 5194L); (mk_real_int64 6629L); (mk_real_int64 4910L); (mk_real_int64 5320L); (mk_real_int64 520L); (mk_real_int64 1040L); (mk_real_int64 950L); (mk_real_int64 7327L); (mk_real_int64 2820L); (mk_real_int64 5880L); (mk_real_int64 2732L); (mk_real_int64 1840L); (mk_real_int64 5580L); (mk_real_int64 2760L); (mk_real_int64 5520L); (mk_real_int64 10620L); (mk_real_int64 1880L); (mk_real_int64 7490L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 800L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 3620L); (mk_real_int64 3620L); (mk_real_int64 2460L); (mk_real_int64 6580L); (mk_real_int64 10000L); (mk_real_int64 12820L); (mk_real_int64 10000L); ]); +("azim_lo", [6; 10; 17; 22; 23; 32; 36; 37; 39; 57; ], [(mk_real_int64 7700L); (mk_real_int64 920L); (mk_real_int64 1180L); (mk_real_int64 5780L); (mk_real_int64 3200L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 2880L); (mk_real_int64 10000L); ]); +("rhazim_lo", [0; 4; 7; 9; 10; 17; 20; 25; 40; 41; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("rhazim_hi", [14; 36; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("rho_hi", [3; 4; 5; 6; 7; 8; 10; 12; 13; ], [(mk_real_int64 10992L); (mk_real_int64 23968L); (mk_real_int64 28336L); (mk_real_int64 28336L); (mk_real_int64 10992L); (mk_real_int64 10992L); (mk_real_int64 28336L); (mk_real_int64 10992L); (mk_real_int64 10992L); ]); +("rho_lo", [0; 1; 2; 9; 11; ], [(mk_real_int64 31024L); (mk_real_int64 26288L); (mk_real_int64 31024L); (mk_real_int64 10480L); (mk_real_int64 12880L); ]); +("tau_hi", [2; 3; 12; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("y1_hi", [4; 5; 8; 9; 11; 12; 18; 23; 25; 30; 32; 34; 36; 38; 40; 51; 55; 56; 59; 62; 63; 65; ], [(mk_real_int64 5950L); (mk_real_int64 5000L); (mk_real_int64 5000L); (mk_real_int64 2600L); (mk_real_int64 200L); (mk_real_int64 990L); (mk_real_int64 6200L); (mk_real_int64 2000L); (mk_real_int64 4000L); (mk_real_int64 1600L); (mk_real_int64 1200L); (mk_real_int64 200L); (mk_real_int64 1850L); (mk_real_int64 3250L); (mk_real_int64 7400L); (mk_real_int64 480L); (mk_real_int64 3600L); (mk_real_int64 2780L); (mk_real_int64 1530L); (mk_real_int64 1870L); (mk_real_int64 1800L); (mk_real_int64 5480L); ]); +("y1_lo", [6; 20; 22; 33; 37; 43; 44; 45; 46; 50; 53; 58; 60; 61; 64; ], [(mk_real_int64 3800L); (mk_real_int64 2000L); (mk_real_int64 3200L); (mk_real_int64 1900L); (mk_real_int64 3200L); (mk_real_int64 2000L); (mk_real_int64 5200L); (mk_real_int64 5800L); (mk_real_int64 2000L); (mk_real_int64 4930L); (mk_real_int64 4200L); (mk_real_int64 800L); (mk_real_int64 5000L); (mk_real_int64 2850L); (mk_real_int64 5000L); ]); +("y2_hi", [4; 6; 11; 18; 20; 22; 25; 30; 32; 36; 38; 43; 46; 50; 51; 55; 59; 60; 61; 62; 63; 65; ], [(mk_real_int64 360L); (mk_real_int64 2127L); (mk_real_int64 200L); (mk_real_int64 2451L); (mk_real_int64 1313L); (mk_real_int64 5177L); (mk_real_int64 939L); (mk_real_int64 1600L); (mk_real_int64 3240L); (mk_real_int64 1850L); (mk_real_int64 4796L); (mk_real_int64 2998L); (mk_real_int64 4013L); (mk_real_int64 1710L); (mk_real_int64 1400L); (mk_real_int64 3600L); (mk_real_int64 3463L); (mk_real_int64 720L); (mk_real_int64 906L); (mk_real_int64 1870L); (mk_real_int64 1800L); (mk_real_int64 5480L); ]); +("y2_lo", [5; 8; 9; 12; 23; 33; 34; 37; 40; 44; 45; 53; 56; 57; 58; 64; ], [(mk_real_int64 1520L); (mk_real_int64 1520L); (mk_real_int64 14L); (mk_real_int64 3370L); (mk_real_int64 2653L); (mk_real_int64 1900L); (mk_real_int64 3685L); (mk_real_int64 4720L); (mk_real_int64 3557L); (mk_real_int64 5200L); (mk_real_int64 2560L); (mk_real_int64 4200L); (mk_real_int64 4951L); (mk_real_int64 1120L); (mk_real_int64 800L); (mk_real_int64 4080L); ]); +("y3_hi", [4; 6; 11; 18; 20; 22; 25; 30; 32; 36; 38; 43; 46; 50; 51; 55; 59; 60; 61; 62; 63; 65; ], [(mk_real_int64 360L); (mk_real_int64 2127L); (mk_real_int64 200L); (mk_real_int64 2451L); (mk_real_int64 1313L); (mk_real_int64 5177L); (mk_real_int64 939L); (mk_real_int64 1600L); (mk_real_int64 3240L); (mk_real_int64 1850L); (mk_real_int64 4796L); (mk_real_int64 2998L); (mk_real_int64 4013L); (mk_real_int64 1710L); (mk_real_int64 1400L); (mk_real_int64 3600L); (mk_real_int64 3463L); (mk_real_int64 720L); (mk_real_int64 906L); (mk_real_int64 1870L); (mk_real_int64 1800L); (mk_real_int64 5480L); ]); +("y3_lo", [5; 8; 9; 12; 23; 33; 34; 37; 40; 44; 45; 53; 56; 57; 58; 64; ], [(mk_real_int64 1520L); (mk_real_int64 1520L); (mk_real_int64 14L); (mk_real_int64 3370L); (mk_real_int64 2653L); (mk_real_int64 1900L); (mk_real_int64 3685L); (mk_real_int64 4720L); (mk_real_int64 3557L); (mk_real_int64 5200L); (mk_real_int64 2560L); (mk_real_int64 4200L); (mk_real_int64 4951L); (mk_real_int64 1120L); (mk_real_int64 800L); (mk_real_int64 4080L); ]); +("y4_hi", [0; 1; 4; 7; 8; 10; 14; 18; 21; 22; 24; 25; 28; 33; 34; 41; 43; 44; 45; 47; 49; 50; 53; ], [(mk_real_int64 6000L); (mk_real_int64 230L); (mk_real_int64 230L); (mk_real_int64 3750L); (mk_real_int64 5232L); (mk_real_int64 7100L); (mk_real_int64 2950L); (mk_real_int64 5280L); (mk_real_int64 80L); (mk_real_int64 1500L); (mk_real_int64 80L); (mk_real_int64 3980L); (mk_real_int64 7800L); (mk_real_int64 990L); (mk_real_int64 1050L); (mk_real_int64 1250L); (mk_real_int64 5000L); (mk_real_int64 4914L); (mk_real_int64 1880L); (mk_real_int64 2954L); (mk_real_int64 1350L); (mk_real_int64 3216L); (mk_real_int64 1264L); ]); +("y4_lo", [2; 5; 12; 15; 17; 20; 26; 31; 32; 38; 39; 46; 48; 51; 52; ], [(mk_real_int64 3300L); (mk_real_int64 3150L); (mk_real_int64 3950L); (mk_real_int64 5050L); (mk_real_int64 1850L); (mk_real_int64 1460L); (mk_real_int64 3400L); (mk_real_int64 1700L); (mk_real_int64 2500L); (mk_real_int64 6144L); (mk_real_int64 2066L); (mk_real_int64 5000L); (mk_real_int64 6030L); (mk_real_int64 3750L); (mk_real_int64 3330L); ]); +("y5_hi", [4; 6; 9; 11; 20; 22; 25; 30; 32; 33; 36; 37; 38; 43; 45; 46; 53; 55; 56; 59; 60; 61; 62; 65; ], [(mk_real_int64 360L); (mk_real_int64 6677L); (mk_real_int64 2136L); (mk_real_int64 3750L); (mk_real_int64 1313L); (mk_real_int64 2877L); (mk_real_int64 939L); (mk_real_int64 5280L); (mk_real_int64 790L); (mk_real_int64 80L); (mk_real_int64 80L); (mk_real_int64 3480L); (mk_real_int64 4796L); (mk_real_int64 2998L); (mk_real_int64 3240L); (mk_real_int64 4013L); (mk_real_int64 1250L); (mk_real_int64 5000L); (mk_real_int64 833L); (mk_real_int64 1837L); (mk_real_int64 720L); (mk_real_int64 3556L); (mk_real_int64 3216L); (mk_real_int64 1264L); ]); +("y5_lo", [5; 8; 12; 18; 23; 34; 40; 44; 50; 51; 57; 58; 63; 64; ], [(mk_real_int64 1520L); (mk_real_int64 1520L); (mk_real_int64 3128L); (mk_real_int64 3999L); (mk_real_int64 2653L); (mk_real_int64 135L); (mk_real_int64 1707L); (mk_real_int64 2500L); (mk_real_int64 144L); (mk_real_int64 2816L); (mk_real_int64 1120L); (mk_real_int64 5000L); (mk_real_int64 3750L); (mk_real_int64 4080L); ]); +("y6_hi", [4; 6; 9; 11; 20; 22; 25; 30; 32; 33; 36; 38; 43; 46; 53; 55; 56; 59; 60; 61; 62; 64; 65; ], [(mk_real_int64 360L); (mk_real_int64 6677L); (mk_real_int64 2136L); (mk_real_int64 3750L); (mk_real_int64 1313L); (mk_real_int64 2877L); (mk_real_int64 939L); (mk_real_int64 5280L); (mk_real_int64 790L); (mk_real_int64 80L); (mk_real_int64 80L); (mk_real_int64 4796L); (mk_real_int64 2998L); (mk_real_int64 4013L); (mk_real_int64 1250L); (mk_real_int64 5000L); (mk_real_int64 833L); (mk_real_int64 1837L); (mk_real_int64 720L); (mk_real_int64 3556L); (mk_real_int64 3216L); (mk_real_int64 5920L); (mk_real_int64 1264L); ]); +("y6_lo", [5; 7; 8; 10; 12; 17; 18; 20; 23; 33; 34; 36; 37; 39; 40; 44; 45; 48; 49; 50; 51; 55; 57; 58; 60; 63; 64; 65; ], [(mk_real_int64 1520L); (mk_real_int64 48070000L); (mk_real_int64 1520L); (mk_real_int64 7560000L); (mk_real_int64 3128L); (mk_real_int64 2220000L); (mk_real_int64 2223999L); (mk_real_int64 5220000L); (mk_real_int64 26532653L); (mk_real_int64 4950000L); (mk_real_int64 135L); (mk_real_int64 25140000L); (mk_real_int64 3296520L); (mk_real_int64 240000L); (mk_real_int64 1707L); (mk_real_int64 2500L); (mk_real_int64 7206760L); (mk_real_int64 18480000L); (mk_real_int64 15450000L); (mk_real_int64 144L); (mk_real_int64 2816L); (mk_real_int64 3340000L); (mk_real_int64 31061120L); (mk_real_int64 5000L); (mk_real_int64 10250000L); (mk_real_int64 3750L); (mk_real_int64 730000L); (mk_real_int64 27420000L); ]); +("y8_hi", [10; ], [(mk_real_int64 3910000L); ]); +("ye_lo", [5; 10; 20; 31; 32; 46; 47; 50; 54; 55; 56; 62; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 16180000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("ye_hi", [7; 23; 48; 63; 65; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("yn_lo", [0; 1; 2; 3; 4; 5; 6; 7; 10; 11; ], [(mk_real_int64 16110L); (mk_real_int64 541L); (mk_real_int64 16110L); (mk_real_int64 9571L); (mk_real_int64 2707L); (mk_real_int64 12173L); (mk_real_int64 2173L); (mk_real_int64 9571L); (mk_real_int64 2173L); (mk_real_int64 9983L); ]); +("yn_hi", [8; 9; 12; 13; ], [(mk_real_int64 429L); (mk_real_int64 2814L); (mk_real_int64 429L); (mk_real_int64 429L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/168156828154_out.hl b/formal_lp/old/ineqs/tests2/168156828154_out.hl new file mode 100644 index 0000000..90a1a45 --- /dev/null +++ b/formal_lp/old/ineqs/tests2/168156828154_out.hl @@ -0,0 +1,85 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "168156828154 21 4 0 1 2 3 3 0 3 4 3 4 3 5 4 5 3 6 7 3 6 3 2 3 6 2 8 3 8 2 1 3 8 1 9 3 9 1 0 4 9 0 10 11 3 10 0 4 3 10 4 12 3 12 4 5 3 12 5 7 3 7 6 13 3 13 6 8 3 13 8 9 3 13 9 11 3 11 10 12 3 11 12 7 3 7 13 11 ";; +let precision = 4;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [0; 3; 6; 8; ], [(mk_real_int64 2872L); (mk_real_int64 2872L); (mk_real_int64 580L); (mk_real_int64 580L); ]); +("azim_sum_neg", [4; 5; 7; 9; 10; 12; ], [(mk_real_int64 1531L); (mk_real_int64 1450L); (mk_real_int64 1073L); (mk_real_int64 1450L); (mk_real_int64 2874L); (mk_real_int64 1747L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 11731L); (mk_real_int64 10592L); (mk_real_int64 10592L); (mk_real_int64 11731L); (mk_real_int64 11731L); (mk_real_int64 10200L); (mk_real_int64 11731L); (mk_real_int64 9649L); (mk_real_int64 11731L); (mk_real_int64 10200L); (mk_real_int64 11351L); (mk_real_int64 11731L); (mk_real_int64 11731L); (mk_real_int64 11731L); ]); +("sol_sum3_neg", [0; 2; 6; ], [(mk_real_int64 1055L); (mk_real_int64 10L); (mk_real_int64 10L); ]); +("sol_sum3", [8; 9; 10; 15; ], [(mk_real_int64 1450L); (mk_real_int64 1450L); (mk_real_int64 1450L); (mk_real_int64 1450L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; ], [(mk_real_int64 11731L); (mk_real_int64 10200L); (mk_real_int64 10592L); (mk_real_int64 9649L); (mk_real_int64 9649L); (mk_real_int64 9649L); (mk_real_int64 10592L); (mk_real_int64 10200L); (mk_real_int64 10200L); (mk_real_int64 10200L); (mk_real_int64 10200L); (mk_real_int64 11731L); (mk_real_int64 9649L); (mk_real_int64 9649L); (mk_real_int64 11731L); (mk_real_int64 10200L); (mk_real_int64 11351L); (mk_real_int64 11731L); ]); +("tau_sum4_neg", [0; 1; 2; ], [(mk_real_int64 10592L); (mk_real_int64 11731L); (mk_real_int64 11731L); ]); +("ln_def_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 2934L); (mk_real_int64 1678L); (mk_real_int64 1678L); (mk_real_int64 2934L); (mk_real_int64 2934L); (mk_real_int64 1246L); (mk_real_int64 2934L); (mk_real_int64 638L); (mk_real_int64 2934L); (mk_real_int64 1246L); (mk_real_int64 2515L); (mk_real_int64 2934L); (mk_real_int64 2934L); (mk_real_int64 2934L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 73705L); (mk_real_int64 66550L); (mk_real_int64 66550L); (mk_real_int64 73705L); (mk_real_int64 73705L); (mk_real_int64 64086L); (mk_real_int64 73705L); (mk_real_int64 60625L); (mk_real_int64 73705L); (mk_real_int64 64086L); (mk_real_int64 71320L); (mk_real_int64 73705L); (mk_real_int64 73705L); (mk_real_int64 73705L); ]); +("edge_sym_neg", [3; 5; 6; 9; 11; 16; 18; 19; 22; 25; 35; 38; 41; 44; 46; 47; 50; 56; ], [(mk_real_int64 1051L); (mk_real_int64 1341L); (mk_real_int64 1341L); (mk_real_int64 3935L); (mk_real_int64 9L); (mk_real_int64 1195L); (mk_real_int64 495L); (mk_real_int64 1484L); (mk_real_int64 993L); (mk_real_int64 1484L); (mk_real_int64 3935L); (mk_real_int64 1507L); (mk_real_int64 1507L); (mk_real_int64 253L); (mk_real_int64 1616L); (mk_real_int64 1616L); (mk_real_int64 2174L); (mk_real_int64 1616L); ]); +("edge_sym", [24; 28; 37; 53; 59; 62; ], [(mk_real_int64 498L); (mk_real_int64 9L); (mk_real_int64 383L); (mk_real_int64 545L); (mk_real_int64 38L); (mk_real_int64 192L); ]); +("y1_def", [5; 6; 9; 16; 19; 20; 23; 33; 39; 42; 47; 50; 52; 54; 61; 64; ], [(mk_real_int64 401L); (mk_real_int64 226L); (mk_real_int64 725L); (mk_real_int64 8L); (mk_real_int64 537L); (mk_real_int64 537L); (mk_real_int64 537L); (mk_real_int64 725L); (mk_real_int64 137L); (mk_real_int64 137L); (mk_real_int64 874L); (mk_real_int64 537L); (mk_real_int64 537L); (mk_real_int64 874L); (mk_real_int64 124L); (mk_real_int64 742L); ]); +("y1_def_neg", [7; 8; 14; 15; 18; 22; 24; 25; 27; 28; 34; 35; 37; 38; 40; 41; 44; 45; 48; 49; 51; 53; 56; 58; 59; 65; ], [(mk_real_int64 1649L); (mk_real_int64 1441L); (mk_real_int64 592L); (mk_real_int64 683L); (mk_real_int64 1537L); (mk_real_int64 1195L); (mk_real_int64 566L); (mk_real_int64 971L); (mk_real_int64 587L); (mk_real_int64 680L); (mk_real_int64 1441L); (mk_real_int64 1649L); (mk_real_int64 2370L); (mk_real_int64 82L); (mk_real_int64 862L); (mk_real_int64 1727L); (mk_real_int64 1198L); (mk_real_int64 1945L); (mk_real_int64 127L); (mk_real_int64 2379L); (mk_real_int64 201L); (mk_real_int64 2423L); (mk_real_int64 1945L); (mk_real_int64 979L); (mk_real_int64 82L); (mk_real_int64 1929L); ]); +("y2_def", [5; 8; 15; 16; 24; 28; 34; 40; 48; 51; ], [(mk_real_int64 401L); (mk_real_int64 1365L); (mk_real_int64 414L); (mk_real_int64 2L); (mk_real_int64 343L); (mk_real_int64 418L); (mk_real_int64 1365L); (mk_real_int64 171L); (mk_real_int64 77L); (mk_real_int64 122L); ]); +("y2_def_neg", [6; 7; 9; 14; 18; 19; 20; 22; 23; 25; 27; 33; 35; 37; 38; 39; 41; 42; 44; 45; 47; 49; 50; 52; 53; 54; 56; 58; 59; 61; 64; 65; ], [(mk_real_int64 1460L); (mk_real_int64 1649L); (mk_real_int64 220L); (mk_real_int64 592L); (mk_real_int64 628L); (mk_real_int64 163L); (mk_real_int64 163L); (mk_real_int64 1195L); (mk_real_int64 163L); (mk_real_int64 971L); (mk_real_int64 593L); (mk_real_int64 220L); (mk_real_int64 1649L); (mk_real_int64 1337L); (mk_real_int64 260L); (mk_real_int64 42L); (mk_real_int64 1727L); (mk_real_int64 42L); (mk_real_int64 1198L); (mk_real_int64 1945L); (mk_real_int64 266L); (mk_real_int64 812L); (mk_real_int64 163L); (mk_real_int64 163L); (mk_real_int64 846L); (mk_real_int64 266L); (mk_real_int64 1945L); (mk_real_int64 979L); (mk_real_int64 260L); (mk_real_int64 38L); (mk_real_int64 226L); (mk_real_int64 1929L); ]); +("y3_def", [5; 8; 15; 16; 24; 28; 34; 40; 48; 51; ], [(mk_real_int64 401L); (mk_real_int64 1365L); (mk_real_int64 414L); (mk_real_int64 2L); (mk_real_int64 343L); (mk_real_int64 418L); (mk_real_int64 1365L); (mk_real_int64 171L); (mk_real_int64 77L); (mk_real_int64 122L); ]); +("y3_def_neg", [6; 7; 9; 14; 18; 19; 20; 22; 23; 25; 27; 33; 35; 37; 38; 39; 41; 42; 44; 45; 47; 49; 50; 52; 53; 54; 56; 58; 59; 61; 64; 65; ], [(mk_real_int64 1460L); (mk_real_int64 1649L); (mk_real_int64 220L); (mk_real_int64 592L); (mk_real_int64 628L); (mk_real_int64 163L); (mk_real_int64 163L); (mk_real_int64 1195L); (mk_real_int64 163L); (mk_real_int64 971L); (mk_real_int64 593L); (mk_real_int64 220L); (mk_real_int64 1649L); (mk_real_int64 1337L); (mk_real_int64 260L); (mk_real_int64 42L); (mk_real_int64 1727L); (mk_real_int64 42L); (mk_real_int64 1198L); (mk_real_int64 1945L); (mk_real_int64 266L); (mk_real_int64 812L); (mk_real_int64 163L); (mk_real_int64 163L); (mk_real_int64 846L); (mk_real_int64 266L); (mk_real_int64 1945L); (mk_real_int64 979L); (mk_real_int64 260L); (mk_real_int64 38L); (mk_real_int64 226L); (mk_real_int64 1929L); ]); +("y4_def_neg", [1; 3; 4; 6; 7; 10; 14; 16; 17; 19; 20; 22; 23; 25; 28; 29; 32; 33; 36; 37; 39; 41; 44; 46; 53; ], [(mk_real_int64 207L); (mk_real_int64 1145L); (mk_real_int64 2570L); (mk_real_int64 411L); (mk_real_int64 780L); (mk_real_int64 1320L); (mk_real_int64 830L); (mk_real_int64 646L); (mk_real_int64 675L); (mk_real_int64 404L); (mk_real_int64 782L); (mk_real_int64 2570L); (mk_real_int64 1145L); (mk_real_int64 1934L); (mk_real_int64 266L); (mk_real_int64 1199L); (mk_real_int64 211L); (mk_real_int64 1351L); (mk_real_int64 145L); (mk_real_int64 2088L); (mk_real_int64 229L); (mk_real_int64 2122L); (mk_real_int64 1351L); (mk_real_int64 680L); (mk_real_int64 1340L); ]); +("y4_def", [2; 5; 8; 11; 12; 15; 21; 26; 27; 30; 35; 38; 40; 42; 47; 49; 52; ], [(mk_real_int64 1258L); (mk_real_int64 1121L); (mk_real_int64 5L); (mk_real_int64 830L); (mk_real_int64 830L); (mk_real_int64 830L); (mk_real_int64 1121L); (mk_real_int64 680L); (mk_real_int64 211L); (mk_real_int64 211L); (mk_real_int64 1351L); (mk_real_int64 830L); (mk_real_int64 830L); (mk_real_int64 1351L); (mk_real_int64 680L); (mk_real_int64 192L); (mk_real_int64 1147L); ]); +("y5_def_neg", [5; 6; 7; 9; 12; 14; 16; 18; 19; 20; 22; 23; 25; 27; 30; 33; 35; 37; 39; 41; 42; 44; 45; 47; 49; 50; 52; 53; 54; 56; 58; 61; 64; 65; ], [(mk_real_int64 207L); (mk_real_int64 1134L); (mk_real_int64 1145L); (mk_real_int64 220L); (mk_real_int64 9L); (mk_real_int64 411L); (mk_real_int64 3L); (mk_real_int64 331L); (mk_real_int64 163L); (mk_real_int64 163L); (mk_real_int64 830L); (mk_real_int64 163L); (mk_real_int64 675L); (mk_real_int64 413L); (mk_real_int64 9L); (mk_real_int64 220L); (mk_real_int64 1145L); (mk_real_int64 809L); (mk_real_int64 42L); (mk_real_int64 1199L); (mk_real_int64 42L); (mk_real_int64 211L); (mk_real_int64 1351L); (mk_real_int64 266L); (mk_real_int64 383L); (mk_real_int64 163L); (mk_real_int64 163L); (mk_real_int64 406L); (mk_real_int64 266L); (mk_real_int64 1351L); (mk_real_int64 680L); (mk_real_int64 38L); (mk_real_int64 226L); (mk_real_int64 1340L); ]); +("y5_def", [8; 15; 24; 28; 34; 38; 40; 48; 51; 59; ], [(mk_real_int64 1365L); (mk_real_int64 414L); (mk_real_int64 343L); (mk_real_int64 413L); (mk_real_int64 1365L); (mk_real_int64 427L); (mk_real_int64 859L); (mk_real_int64 77L); (mk_real_int64 122L); (mk_real_int64 427L); ]); +("y6_def_neg", [5; 6; 7; 9; 14; 16; 18; 19; 22; 25; 27; 33; 35; 37; 39; 41; 44; 45; 47; 50; 53; 56; 65; ], [(mk_real_int64 207L); (mk_real_int64 1134L); (mk_real_int64 1145L); (mk_real_int64 220L); (mk_real_int64 411L); (mk_real_int64 3L); (mk_real_int64 331L); (mk_real_int64 163L); (mk_real_int64 830L); (mk_real_int64 675L); (mk_real_int64 413L); (mk_real_int64 220L); (mk_real_int64 1145L); (mk_real_int64 44L); (mk_real_int64 42L); (mk_real_int64 1199L); (mk_real_int64 211L); (mk_real_int64 1351L); (mk_real_int64 266L); (mk_real_int64 163L); (mk_real_int64 406L); (mk_real_int64 1351L); (mk_real_int64 1340L); ]); +("y6_def", [8; 15; 20; 23; 24; 26; 28; 34; 36; 38; 40; 42; 48; 49; 51; 52; 54; 58; 59; 61; 63; 64; ], [(mk_real_int64 1365L); (mk_real_int64 414L); (mk_real_int64 1324L); (mk_real_int64 1324L); (mk_real_int64 343L); (mk_real_int64 696L); (mk_real_int64 413L); (mk_real_int64 1365L); (mk_real_int64 4065L); (mk_real_int64 427L); (mk_real_int64 4924L); (mk_real_int64 1718L); (mk_real_int64 1170L); (mk_real_int64 1792L); (mk_real_int64 4459L); (mk_real_int64 2119L); (mk_real_int64 805L); (mk_real_int64 1080L); (mk_real_int64 427L); (mk_real_int64 253L); (mk_real_int64 3181L); (mk_real_int64 2956L); ]); +("y8_def_neg", [7; 10; ], [(mk_real_int64 9L); (mk_real_int64 9L); ]); +("RHA", [0; 3; 7; 14; 17; 21; 22; 25; 26; 35; 37; 38; 39; 40; 42; 44; 48; 49; 51; 53; 57; 59; 60; 62; ], [(mk_real_int64 1139L); (mk_real_int64 1139L); (mk_real_int64 1531L); (mk_real_int64 1139L); (mk_real_int64 2082L); (mk_real_int64 943L); (mk_real_int64 943L); (mk_real_int64 2082L); (mk_real_int64 1139L); (mk_real_int64 1531L); (mk_real_int64 459L); (mk_real_int64 1151L); (mk_real_int64 1151L); (mk_real_int64 459L); (mk_real_int64 1151L); (mk_real_int64 1531L); (mk_real_int64 1870L); (mk_real_int64 456L); (mk_real_int64 1747L); (mk_real_int64 446L); (mk_real_int64 1531L); (mk_real_int64 1151L); (mk_real_int64 380L); (mk_real_int64 380L); ]); +("RHB", [10; 31; ], [(mk_real_int64 1531L); (mk_real_int64 1531L); ]); +("yy10", [3; ], [(mk_real_int64 1051L); ]); +("ineq106", [4; 7; 10; 16; 20; 22; 25; 28; 36; 37; 39; 41; ], [(mk_real_int64 1531L); (mk_real_int64 1139L); (mk_real_int64 943L); (mk_real_int64 943L); (mk_real_int64 1139L); (mk_real_int64 1531L); (mk_real_int64 1072L); (mk_real_int64 1072L); (mk_real_int64 212L); (mk_real_int64 1625L); (mk_real_int64 335L); (mk_real_int64 1636L); ]); +("ineq107", [2; 5; 8; 11; 12; 15; 19; 21; 26; 27; 30; 35; 38; 40; 42; 47; 49; 52; ], [(mk_real_int64 2586L); (mk_real_int64 1450L); (mk_real_int64 10L); (mk_real_int64 1073L); (mk_real_int64 1073L); (mk_real_int64 1073L); (mk_real_int64 10L); (mk_real_int64 1450L); (mk_real_int64 273L); (mk_real_int64 273L); (mk_real_int64 273L); (mk_real_int64 1747L); (mk_real_int64 1073L); (mk_real_int64 1073L); (mk_real_int64 1747L); (mk_real_int64 273L); (mk_real_int64 249L); (mk_real_int64 1484L); ]); +("ineq108", [4; 22; ], [(mk_real_int64 2221L); (mk_real_int64 2221L); ]); +("ineq109", [26; 28; 32; 47; ], [(mk_real_int64 1450L); (mk_real_int64 1450L); (mk_real_int64 1450L); (mk_real_int64 1450L); ]); +("ineq110", [1; 8; 20; ], [(mk_real_int64 1055L); (mk_real_int64 10L); (mk_real_int64 10L); ]); +("ineq111", [2; 3; 6; 10; 14; 17; 19; 23; 25; 29; 32; 33; 37; 41; 44; 46; 53; ], [(mk_real_int64 5927L); (mk_real_int64 9160L); (mk_real_int64 3289L); (mk_real_int64 5397L); (mk_real_int64 6636L); (mk_real_int64 5397L); (mk_real_int64 3289L); (mk_real_int64 9160L); (mk_real_int64 9596L); (mk_real_int64 9596L); (mk_real_int64 5438L); (mk_real_int64 10804L); (mk_real_int64 7798L); (mk_real_int64 8010L); (mk_real_int64 10804L); (mk_real_int64 5438L); (mk_real_int64 10716L); ]); +("ineq113", [49; 52; ], [(mk_real_int64 10138L); (mk_real_int64 1014L); ]); +("ineq114", [0; 1; 4; 6; 7; 9; 13; 14; 17; 18; 20; 22; 25; 28; 32; 34; 36; 37; 41; 43; 45; 48; 50; ], [(mk_real_int64 2902L); (mk_real_int64 2902L); (mk_real_int64 1039L); (mk_real_int64 2731L); (mk_real_int64 4572L); (mk_real_int64 4252L); (mk_real_int64 1506L); (mk_real_int64 1506L); (mk_real_int64 4252L); (mk_real_int64 2731L); (mk_real_int64 4572L); (mk_real_int64 1039L); (mk_real_int64 604L); (mk_real_int64 604L); (mk_real_int64 4761L); (mk_real_int64 926L); (mk_real_int64 196L); (mk_real_int64 1655L); (mk_real_int64 1639L); (mk_real_int64 926L); (mk_real_int64 4761L); (mk_real_int64 606L); (mk_real_int64 606L); ]); +("ineq119", [4; 10; ], [(mk_real_int64 7173L); (mk_real_int64 7173L); ]); +("ineq120", [0; 3; 5; 6; 8; 9; ], [(mk_real_int64 5296L); (mk_real_int64 5296L); (mk_real_int64 3792L); (mk_real_int64 766L); (mk_real_int64 766L); (mk_real_int64 3792L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 61430L); (mk_real_int64 51300L); (mk_real_int64 51300L); (mk_real_int64 61430L); (mk_real_int64 61430L); (mk_real_int64 53156L); (mk_real_int64 61430L); (mk_real_int64 43750L); (mk_real_int64 61430L); (mk_real_int64 53156L); (mk_real_int64 54720L); (mk_real_int64 61430L); (mk_real_int64 61430L); (mk_real_int64 61430L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_lo", [0; 3; 4; 5; 8; 11; 17; 21; 22; 25; 30; 34; 44; 46; 48; 55; 57; 60; 61; 62; ], [(mk_real_int64 3392L); (mk_real_int64 3392L); (mk_real_int64 3480L); (mk_real_int64 3480L); (mk_real_int64 5860L); (mk_real_int64 3184L); (mk_real_int64 2480L); (mk_real_int64 2440L); (mk_real_int64 2440L); (mk_real_int64 2480L); (mk_real_int64 3184L); (mk_real_int64 5860L); (mk_real_int64 6140L); (mk_real_int64 3240L); (mk_real_int64 3040L); (mk_real_int64 3240L); (mk_real_int64 6140L); (mk_real_int64 6440L); (mk_real_int64 7420L); (mk_real_int64 6440L); ]); +("azim_hi", [10; 12; 14; 15; 26; 28; 29; 31; 37; 40; 49; 53; 64; ], [(mk_real_int64 3215L); (mk_real_int64 918L); (mk_real_int64 6060L); (mk_real_int64 720L); (mk_real_int64 6060L); (mk_real_int64 720L); (mk_real_int64 918L); (mk_real_int64 3215L); (mk_real_int64 1040L); (mk_real_int64 1040L); (mk_real_int64 300L); (mk_real_int64 140L); (mk_real_int64 3740L); ]); +("rhazim_lo", [49; ], [(mk_real_int64 10000L); ]); +("rho_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 32192L); (mk_real_int64 16544L); (mk_real_int64 16544L); (mk_real_int64 32192L); (mk_real_int64 32192L); (mk_real_int64 26400L); (mk_real_int64 32192L); (mk_real_int64 15968L); (mk_real_int64 32192L); (mk_real_int64 26400L); (mk_real_int64 6032L); (mk_real_int64 32192L); (mk_real_int64 32192L); (mk_real_int64 32192L); ]); +("tau_lo", [2; 6; 10; 13; 14; 17; 18; 19; 20; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("y1_hi", [6; 7; 8; 16; 22; 24; 28; 34; 35; 44; 45; 49; 56; 58; 61; 65; ], [(mk_real_int64 1400L); (mk_real_int64 2000L); (mk_real_int64 4650L); (mk_real_int64 8000L); (mk_real_int64 5200L); (mk_real_int64 2000L); (mk_real_int64 4000L); (mk_real_int64 4650L); (mk_real_int64 2000L); (mk_real_int64 2100L); (mk_real_int64 2800L); (mk_real_int64 3600L); (mk_real_int64 2800L); (mk_real_int64 1600L); (mk_real_int64 5000L); (mk_real_int64 1200L); ]); +("y1_lo", [5; 14; 15; 18; 19; 20; 23; 25; 27; 37; 38; 39; 40; 41; 42; 47; 48; 50; 52; 53; 54; 59; ], [(mk_real_int64 1000L); (mk_real_int64 200L); (mk_real_int64 4000L); (mk_real_int64 2600L); (mk_real_int64 5000L); (mk_real_int64 5000L); (mk_real_int64 5000L); (mk_real_int64 4600L); (mk_real_int64 200L); (mk_real_int64 4800L); (mk_real_int64 4500L); (mk_real_int64 5000L); (mk_real_int64 1500L); (mk_real_int64 2800L); (mk_real_int64 5000L); (mk_real_int64 5000L); (mk_real_int64 2000L); (mk_real_int64 5000L); (mk_real_int64 5000L); (mk_real_int64 4000L); (mk_real_int64 5000L); (mk_real_int64 4500L); ]); +("y2_hi", [6; 7; 8; 15; 16; 22; 24; 28; 34; 35; 39; 40; 42; 44; 45; 47; 48; 54; 56; 58; 61; 64; 65; ], [(mk_real_int64 680L); (mk_real_int64 2000L); (mk_real_int64 3528L); (mk_real_int64 4821L); (mk_real_int64 2800L); (mk_real_int64 5200L); (mk_real_int64 1577L); (mk_real_int64 2821L); (mk_real_int64 3528L); (mk_real_int64 2000L); (mk_real_int64 5040L); (mk_real_int64 1508L); (mk_real_int64 5040L); (mk_real_int64 2100L); (mk_real_int64 2800L); (mk_real_int64 4560L); (mk_real_int64 1468L); (mk_real_int64 4560L); (mk_real_int64 2800L); (mk_real_int64 1600L); (mk_real_int64 1520L); (mk_real_int64 4320L); (mk_real_int64 1200L); ]); +("y2_lo", [5; 9; 14; 18; 19; 20; 23; 25; 27; 33; 37; 38; 41; 49; 50; 51; 52; 53; 59; ], [(mk_real_int64 1000L); (mk_real_int64 4000L); (mk_real_int64 200L); (mk_real_int64 3023L); (mk_real_int64 960L); (mk_real_int64 960L); (mk_real_int64 960L); (mk_real_int64 4600L); (mk_real_int64 5400L); (mk_real_int64 4000L); (mk_real_int64 1792L); (mk_real_int64 4460L); (mk_real_int64 2800L); (mk_real_int64 3025L); (mk_real_int64 960L); (mk_real_int64 935L); (mk_real_int64 960L); (mk_real_int64 4596L); (mk_real_int64 4460L); ]); +("y3_hi", [6; 7; 8; 15; 16; 22; 24; 28; 34; 35; 39; 40; 42; 44; 45; 47; 48; 54; 56; 58; 61; 64; 65; ], [(mk_real_int64 680L); (mk_real_int64 2000L); (mk_real_int64 3528L); (mk_real_int64 4821L); (mk_real_int64 2800L); (mk_real_int64 5200L); (mk_real_int64 1577L); (mk_real_int64 2821L); (mk_real_int64 3528L); (mk_real_int64 2000L); (mk_real_int64 5040L); (mk_real_int64 1508L); (mk_real_int64 5040L); (mk_real_int64 2100L); (mk_real_int64 2800L); (mk_real_int64 4560L); (mk_real_int64 1468L); (mk_real_int64 4560L); (mk_real_int64 2800L); (mk_real_int64 1600L); (mk_real_int64 1520L); (mk_real_int64 4320L); (mk_real_int64 1200L); ]); +("y3_lo", [5; 9; 14; 18; 19; 20; 23; 25; 27; 33; 37; 38; 41; 49; 50; 51; 52; 53; 59; ], [(mk_real_int64 1000L); (mk_real_int64 4000L); (mk_real_int64 200L); (mk_real_int64 3023L); (mk_real_int64 960L); (mk_real_int64 960L); (mk_real_int64 960L); (mk_real_int64 4600L); (mk_real_int64 5400L); (mk_real_int64 4000L); (mk_real_int64 1792L); (mk_real_int64 4460L); (mk_real_int64 2800L); (mk_real_int64 3025L); (mk_real_int64 960L); (mk_real_int64 935L); (mk_real_int64 960L); (mk_real_int64 4596L); (mk_real_int64 4460L); ]); +("y4_lo", [4; 5; 6; 7; 10; 11; 12; 15; 20; 21; 22; 26; 29; 32; 35; 36; 38; 39; 40; 42; 47; ], [(mk_real_int64 1200L); (mk_real_int64 1500L); (mk_real_int64 1250L); (mk_real_int64 2150L); (mk_real_int64 5800L); (mk_real_int64 5710L); (mk_real_int64 5710L); (mk_real_int64 5710L); (mk_real_int64 1750L); (mk_real_int64 1500L); (mk_real_int64 1200L); (mk_real_int64 3310L); (mk_real_int64 5000L); (mk_real_int64 1100L); (mk_real_int64 5690L); (mk_real_int64 2200L); (mk_real_int64 5710L); (mk_real_int64 4750L); (mk_real_int64 5710L); (mk_real_int64 5690L); (mk_real_int64 3310L); ]); +("y4_hi", [1; 2; 8; 14; 16; 17; 19; 25; 27; 28; 30; 33; 37; 41; 44; 46; 49; 52; 53; ], [(mk_real_int64 2200L); (mk_real_int64 1030L); (mk_real_int64 7700L); (mk_real_int64 5000L); (mk_real_int64 450L); (mk_real_int64 3750L); (mk_real_int64 6050L); (mk_real_int64 1800L); (mk_real_int64 290L); (mk_real_int64 3200L); (mk_real_int64 290L); (mk_real_int64 5000L); (mk_real_int64 1250L); (mk_real_int64 900L); (mk_real_int64 5000L); (mk_real_int64 2500L); (mk_real_int64 4770L); (mk_real_int64 1320L); (mk_real_int64 5000L); ]); +("y5_hi", [5; 6; 8; 15; 22; 24; 25; 27; 34; 38; 39; 42; 45; 47; 48; 53; 54; 56; 58; 59; 61; 64; 65; ], [(mk_real_int64 2200L); (mk_real_int64 530L); (mk_real_int64 3528L); (mk_real_int64 4821L); (mk_real_int64 5000L); (mk_real_int64 1577L); (mk_real_int64 3750L); (mk_real_int64 3550L); (mk_real_int64 3528L); (mk_real_int64 1440L); (mk_real_int64 5040L); (mk_real_int64 5040L); (mk_real_int64 5000L); (mk_real_int64 4560L); (mk_real_int64 1468L); (mk_real_int64 904L); (mk_real_int64 4560L); (mk_real_int64 5000L); (mk_real_int64 2500L); (mk_real_int64 1440L); (mk_real_int64 1520L); (mk_real_int64 4320L); (mk_real_int64 5000L); ]); +("y5_lo", [9; 14; 16; 18; 19; 20; 23; 28; 33; 37; 40; 41; 44; 49; 50; 51; 52; ], [(mk_real_int64 4000L); (mk_real_int64 1250L); (mk_real_int64 4800L); (mk_real_int64 4673L); (mk_real_int64 960L); (mk_real_int64 960L); (mk_real_int64 960L); (mk_real_int64 4779L); (mk_real_int64 4000L); (mk_real_int64 3992L); (mk_real_int64 2592L); (mk_real_int64 5000L); (mk_real_int64 1100L); (mk_real_int64 4125L); (mk_real_int64 960L); (mk_real_int64 935L); (mk_real_int64 960L); ]); +("y6_hi", [5; 6; 8; 15; 22; 24; 25; 27; 34; 38; 39; 45; 47; 48; 53; 54; 56; 59; 61; 65; ], [(mk_real_int64 2200L); (mk_real_int64 530L); (mk_real_int64 3528L); (mk_real_int64 4821L); (mk_real_int64 5000L); (mk_real_int64 1577L); (mk_real_int64 3750L); (mk_real_int64 3550L); (mk_real_int64 3528L); (mk_real_int64 1440L); (mk_real_int64 5040L); (mk_real_int64 5000L); (mk_real_int64 4560L); (mk_real_int64 1468L); (mk_real_int64 904L); (mk_real_int64 4560L); (mk_real_int64 5000L); (mk_real_int64 1440L); (mk_real_int64 1520L); (mk_real_int64 5000L); ]); +("y6_lo", [9; 14; 16; 18; 19; 20; 23; 26; 28; 33; 36; 37; 40; 41; 42; 44; 48; 49; 50; 51; 52; 54; 58; 61; 63; 64; ], [(mk_real_int64 4000L); (mk_real_int64 1250L); (mk_real_int64 4800L); (mk_real_int64 4673L); (mk_real_int64 960L); (mk_real_int64 14870960L); (mk_real_int64 14870960L); (mk_real_int64 6960000L); (mk_real_int64 4779L); (mk_real_int64 4000L); (mk_real_int64 40650000L); (mk_real_int64 7653992L); (mk_real_int64 40652592L); (mk_real_int64 5000L); (mk_real_int64 17594960L); (mk_real_int64 1100L); (mk_real_int64 10930000L); (mk_real_int64 21754125L); (mk_real_int64 960L); (mk_real_int64 43370935L); (mk_real_int64 22820960L); (mk_real_int64 10710000L); (mk_real_int64 17597500L); (mk_real_int64 2910000L); (mk_real_int64 31810000L); (mk_real_int64 31815680L); ]); +("y8_hi", [7; 10; ], [(mk_real_int64 90000L); (mk_real_int64 90000L); ]); +("ye_hi", [16; 18; 19; 36; 39; 40; 48; 53; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("ye_lo", [14; 17; 20; 23; 26; 46; 47; 54; 56; 59; 63; 65; ], [(mk_real_int64 10000L); (mk_real_int64 6960000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 2910000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("yn_hi", [0; 3; 4; 7; 8; 9; 10; 12; ], [(mk_real_int64 3754L); (mk_real_int64 3754L); (mk_real_int64 3754L); (mk_real_int64 19378L); (mk_real_int64 13754L); (mk_real_int64 11826L); (mk_real_int64 5965L); (mk_real_int64 13754L); ]); +("yn_lo", [1; 2; 5; 6; 11; 13; ], [(mk_real_int64 10382L); (mk_real_int64 382L); (mk_real_int64 8174L); (mk_real_int64 6246L); (mk_real_int64 16246L); (mk_real_int64 6246L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/17272290668_out.hl b/formal_lp/old/ineqs/tests2/17272290668_out.hl new file mode 100644 index 0000000..0ae784b --- /dev/null +++ b/formal_lp/old/ineqs/tests2/17272290668_out.hl @@ -0,0 +1,89 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "17272290668 20 4 0 1 2 3 3 0 3 4 3 4 3 5 3 5 3 2 3 5 2 6 3 6 2 7 3 7 2 1 3 7 1 8 3 8 1 9 3 9 1 0 3 9 0 10 3 10 0 4 4 10 4 5 11 3 11 5 6 3 11 6 8 3 6 7 8 3 11 8 12 3 12 8 9 3 12 9 10 3 10 11 12 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [3; 5; 6; 8; 9; ], [(mk_real_int64 59L); (mk_real_int64 59L); (mk_real_int64 128L); (mk_real_int64 205L); (mk_real_int64 128L); ]); +("azim_sum_neg", [0; 4; 7; 12; ], [(mk_real_int64 294L); (mk_real_int64 294L); (mk_real_int64 246L); (mk_real_int64 246L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 890L); (mk_real_int64 890L); (mk_real_int64 890L); (mk_real_int64 910L); (mk_real_int64 890L); (mk_real_int64 910L); (mk_real_int64 731L); (mk_real_int64 654L); (mk_real_int64 654L); (mk_real_int64 731L); (mk_real_int64 890L); (mk_real_int64 890L); (mk_real_int64 654L); ]); +("sol_sum3", [2; 10; ], [(mk_real_int64 51L); (mk_real_int64 51L); ]); +("sol_sum3_neg", [3; 6; 7; 9; 12; 14; ], [(mk_real_int64 349L); (mk_real_int64 13L); (mk_real_int64 859L); (mk_real_int64 349L); (mk_real_int64 859L); (mk_real_int64 13L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 8; 9; 10; 11; 13; 14; 15; 16; 17; ], [(mk_real_int64 596L); (mk_real_int64 596L); (mk_real_int64 890L); (mk_real_int64 509L); (mk_real_int64 654L); (mk_real_int64 654L); (mk_real_int64 654L); (mk_real_int64 731L); (mk_real_int64 509L); (mk_real_int64 890L); (mk_real_int64 731L); (mk_real_int64 654L); (mk_real_int64 654L); (mk_real_int64 654L); (mk_real_int64 654L); (mk_real_int64 654L); ]); +("tau_sum4_neg", [0; 1; ], [(mk_real_int64 890L); (mk_real_int64 890L); ]); +("ln_def_neg", [3; 5; ], [(mk_real_int64 3L); (mk_real_int64 3L); ]); +("ln_def", [0; 1; 2; 4; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 18L); (mk_real_int64 18L); (mk_real_int64 18L); (mk_real_int64 18L); (mk_real_int64 194L); (mk_real_int64 279L); (mk_real_int64 279L); (mk_real_int64 194L); (mk_real_int64 18L); (mk_real_int64 18L); (mk_real_int64 279L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 5594L); (mk_real_int64 5594L); (mk_real_int64 5594L); (mk_real_int64 5717L); (mk_real_int64 5594L); (mk_real_int64 5717L); (mk_real_int64 4592L); (mk_real_int64 4109L); (mk_real_int64 4109L); (mk_real_int64 4592L); (mk_real_int64 5594L); (mk_real_int64 5594L); (mk_real_int64 4109L); ]); +("edge_sym_neg", [1; 14; 15; 17; 18; 24; 26; 27; 30; 32; 33; 40; 45; 46; 51; 52; 58; ], [(mk_real_int64 191L); (mk_real_int64 202L); (mk_real_int64 85L); (mk_real_int64 26L); (mk_real_int64 59L); (mk_real_int64 46L); (mk_real_int64 47L); (mk_real_int64 190L); (mk_real_int64 120L); (mk_real_int64 85L); (mk_real_int64 202L); (mk_real_int64 191L); (mk_real_int64 190L); (mk_real_int64 200L); (mk_real_int64 46L); (mk_real_int64 39L); (mk_real_int64 26L); ]); +("edge_sym", [12; 21; 23; 43; 55; ], [(mk_real_int64 85L); (mk_real_int64 26L); (mk_real_int64 157L); (mk_real_int64 47L); (mk_real_int64 59L); ]); +("y1_def", [11; 15; 18; 19; 22; 24; 25; 33; 36; 46; 48; 52; 53; 56; 61; ], [(mk_real_int64 35L); (mk_real_int64 133L); (mk_real_int64 123L); (mk_real_int64 89L); (mk_real_int64 129L); (mk_real_int64 5L); (mk_real_int64 326L); (mk_real_int64 133L); (mk_real_int64 39L); (mk_real_int64 326L); (mk_real_int64 123L); (mk_real_int64 134L); (mk_real_int64 123L); (mk_real_int64 123L); (mk_real_int64 89L); ]); +("y1_def_neg", [13; 17; 21; 23; 26; 28; 29; 32; 35; 41; 42; 43; 44; 50; 58; 60; ], [(mk_real_int64 149L); (mk_real_int64 19L); (mk_real_int64 88L); (mk_real_int64 4L); (mk_real_int64 19L); (mk_real_int64 50L); (mk_real_int64 96L); (mk_real_int64 149L); (mk_real_int64 3L); (mk_real_int64 96L); (mk_real_int64 39L); (mk_real_int64 11L); (mk_real_int64 19L); (mk_real_int64 4L); (mk_real_int64 19L); (mk_real_int64 88L); ]); +("y2_def_neg", [11; 13; 18; 19; 22; 28; 32; 35; 36; 42; 48; 52; 53; 56; 61; ], [(mk_real_int64 25L); (mk_real_int64 42L); (mk_real_int64 37L); (mk_real_int64 27L); (mk_real_int64 39L); (mk_real_int64 23L); (mk_real_int64 42L); (mk_real_int64 3L); (mk_real_int64 22L); (mk_real_int64 39L); (mk_real_int64 37L); (mk_real_int64 34L); (mk_real_int64 37L); (mk_real_int64 37L); (mk_real_int64 27L); ]); +("y2_def", [15; 17; 21; 23; 24; 25; 26; 29; 33; 41; 43; 44; 46; 50; 58; 60; ], [(mk_real_int64 133L); (mk_real_int64 12L); (mk_real_int64 53L); (mk_real_int64 2L); (mk_real_int64 5L); (mk_real_int64 326L); (mk_real_int64 12L); (mk_real_int64 58L); (mk_real_int64 133L); (mk_real_int64 58L); (mk_real_int64 16L); (mk_real_int64 12L); (mk_real_int64 326L); (mk_real_int64 2L); (mk_real_int64 12L); (mk_real_int64 53L); ]); +("y3_def_neg", [11; 13; 18; 19; 22; 28; 32; 35; 36; 42; 48; 52; 53; 56; 61; ], [(mk_real_int64 25L); (mk_real_int64 42L); (mk_real_int64 37L); (mk_real_int64 27L); (mk_real_int64 39L); (mk_real_int64 23L); (mk_real_int64 42L); (mk_real_int64 3L); (mk_real_int64 22L); (mk_real_int64 39L); (mk_real_int64 37L); (mk_real_int64 34L); (mk_real_int64 37L); (mk_real_int64 37L); (mk_real_int64 27L); ]); +("y3_def", [15; 17; 21; 23; 24; 25; 26; 29; 33; 41; 43; 44; 46; 50; 58; 60; ], [(mk_real_int64 133L); (mk_real_int64 12L); (mk_real_int64 53L); (mk_real_int64 2L); (mk_real_int64 5L); (mk_real_int64 326L); (mk_real_int64 12L); (mk_real_int64 58L); (mk_real_int64 133L); (mk_real_int64 58L); (mk_real_int64 16L); (mk_real_int64 12L); (mk_real_int64 326L); (mk_real_int64 2L); (mk_real_int64 12L); (mk_real_int64 53L); ]); +("y4_def", [7; 14; 15; 18; 32; 40; 44; 45; 48; 53; ], [(mk_real_int64 85L); (mk_real_int64 190L); (mk_real_int64 138L); (mk_real_int64 200L); (mk_real_int64 88L); (mk_real_int64 190L); (mk_real_int64 197L); (mk_real_int64 190L); (mk_real_int64 190L); (mk_real_int64 138L); ]); +("y4_def_neg", [9; 11; 13; 17; 19; 20; 21; 22; 24; 25; 28; 29; 31; 33; 34; 35; 36; 38; 42; 50; 52; ], [(mk_real_int64 133L); (mk_real_int64 68L); (mk_real_int64 22L); (mk_real_int64 100L); (mk_real_int64 4L); (mk_real_int64 2L); (mk_real_int64 168L); (mk_real_int64 22L); (mk_real_int64 58L); (mk_real_int64 109L); (mk_real_int64 133L); (mk_real_int64 68L); (mk_real_int64 2L); (mk_real_int64 109L); (mk_real_int64 27L); (mk_real_int64 31L); (mk_real_int64 22L); (mk_real_int64 168L); (mk_real_int64 4L); (mk_real_int64 22L); (mk_real_int64 100L); ]); +("y5_def_neg", [13; 15; 18; 19; 22; 24; 25; 28; 32; 33; 35; 37; 42; 46; 48; 52; 53; 56; 61; ], [(mk_real_int64 17L); (mk_real_int64 68L); (mk_real_int64 37L); (mk_real_int64 27L); (mk_real_int64 39L); (mk_real_int64 2L); (mk_real_int64 168L); (mk_real_int64 11L); (mk_real_int64 17L); (mk_real_int64 68L); (mk_real_int64 2L); (mk_real_int64 191L); (mk_real_int64 27L); (mk_real_int64 168L); (mk_real_int64 37L); (mk_real_int64 42L); (mk_real_int64 37L); (mk_real_int64 37L); (mk_real_int64 27L); ]); +("y5_def", [17; 21; 23; 26; 29; 36; 41; 43; 44; 50; 58; 60; ], [(mk_real_int64 12L); (mk_real_int64 53L); (mk_real_int64 2L); (mk_real_int64 12L); (mk_real_int64 58L); (mk_real_int64 2L); (mk_real_int64 58L); (mk_real_int64 16L); (mk_real_int64 12L); (mk_real_int64 2L); (mk_real_int64 12L); (mk_real_int64 53L); ]); +("y6_def_neg", [13; 15; 18; 22; 24; 25; 28; 32; 33; 35; 46; 52; 56; ], [(mk_real_int64 17L); (mk_real_int64 68L); (mk_real_int64 37L); (mk_real_int64 26L); (mk_real_int64 2L); (mk_real_int64 168L); (mk_real_int64 11L); (mk_real_int64 17L); (mk_real_int64 68L); (mk_real_int64 2L); (mk_real_int64 168L); (mk_real_int64 42L); (mk_real_int64 37L); ]); +("y6_def", [17; 19; 21; 23; 26; 29; 31; 36; 41; 42; 43; 44; 48; 50; 53; 58; 60; 61; ], [(mk_real_int64 12L); (mk_real_int64 126L); (mk_real_int64 53L); (mk_real_int64 2L); (mk_real_int64 121L); (mk_real_int64 58L); (mk_real_int64 206L); (mk_real_int64 2L); (mk_real_int64 58L); (mk_real_int64 178L); (mk_real_int64 16L); (mk_real_int64 121L); (mk_real_int64 46L); (mk_real_int64 2L); (mk_real_int64 46L); (mk_real_int64 12L); (mk_real_int64 67L); (mk_real_int64 126L); ]); +("y8_def_neg", [5; ], [(mk_real_int64 191L); ]); +("RHA", [0; 4; 5; 6; 7; 8; 9; 10; 13; 14; 15; 16; 17; 20; 21; 23; 25; 26; 27; 30; 31; 32; 33; 35; 39; 42; 44; 45; 46; 47; 50; 55; 57; 58; 59; 60; ], [(mk_real_int64 19L); (mk_real_int64 314L); (mk_real_int64 294L); (mk_real_int64 294L); (mk_real_int64 294L); (mk_real_int64 294L); (mk_real_int64 314L); (mk_real_int64 19L); (mk_real_int64 290L); (mk_real_int64 381L); (mk_real_int64 221L); (mk_real_int64 77L); (mk_real_int64 205L); (mk_real_int64 236L); (mk_real_int64 90L); (mk_real_int64 230L); (mk_real_int64 654L); (mk_real_int64 859L); (mk_real_int64 731L); (mk_real_int64 179L); (mk_real_int64 221L); (mk_real_int64 290L); (mk_real_int64 381L); (mk_real_int64 19L); (mk_real_int64 19L); (mk_real_int64 179L); (mk_real_int64 859L); (mk_real_int64 731L); (mk_real_int64 654L); (mk_real_int64 77L); (mk_real_int64 230L); (mk_real_int64 77L); (mk_real_int64 77L); (mk_real_int64 205L); (mk_real_int64 236L); (mk_real_int64 90L); ]); +("yy10", [1; 23; 46; ], [(mk_real_int64 191L); (mk_real_int64 43L); (mk_real_int64 43L); ]); +("tau4", [0; 1; ], [(mk_real_int64 137L); (mk_real_int64 137L); ]); +("ineq106", [9; 13; 17; 19; 22; 25; 28; 33; 36; 42; 50; 52; ], [(mk_real_int64 111L); (mk_real_int64 32L); (mk_real_int64 147L); (mk_real_int64 6L); (mk_real_int64 32L); (mk_real_int64 160L); (mk_real_int64 111L); (mk_real_int64 160L); (mk_real_int64 32L); (mk_real_int64 6L); (mk_real_int64 32L); (mk_real_int64 147L); ]); +("ineq107", [7; 14; 15; 18; 32; 40; 44; 45; 48; 53; ], [(mk_real_int64 92L); (mk_real_int64 246L); (mk_real_int64 179L); (mk_real_int64 259L); (mk_real_int64 92L); (mk_real_int64 246L); (mk_real_int64 259L); (mk_real_int64 246L); (mk_real_int64 246L); (mk_real_int64 179L); ]); +("ineq108", [24; 35; ], [(mk_real_int64 45L); (mk_real_int64 45L); ]); +("ineq109", [7; 32; ], [(mk_real_int64 51L); (mk_real_int64 51L); ]); +("ineq110", [11; 20; 21; 29; 38; 44; ], [(mk_real_int64 349L); (mk_real_int64 13L); (mk_real_int64 859L); (mk_real_int64 349L); (mk_real_int64 859L); (mk_real_int64 13L); ]); +("ineq111", [7; 9; 24; 28; 31; 34; ], [(mk_real_int64 19L); (mk_real_int64 459L); (mk_real_int64 218L); (mk_real_int64 459L); (mk_real_int64 19L); (mk_real_int64 218L); ]); +("ineq112", [15; 53; ], [(mk_real_int64 133L); (mk_real_int64 133L); ]); +("ineq113", [7; 32; ], [(mk_real_int64 584L); (mk_real_int64 584L); ]); +("ineq114", [0; 5; 6; 8; 10; 12; 13; 16; 17; 19; 20; 24; 26; 29; 30; 31; 34; 35; 39; 41; 42; 43; 46; 47; 49; 50; 51; 52; ], [(mk_real_int64 596L); (mk_real_int64 596L); (mk_real_int64 207L); (mk_real_int64 81L); (mk_real_int64 51L); (mk_real_int64 327L); (mk_real_int64 327L); (mk_real_int64 378L); (mk_real_int64 143L); (mk_real_int64 347L); (mk_real_int64 307L); (mk_real_int64 132L); (mk_real_int64 381L); (mk_real_int64 51L); (mk_real_int64 81L); (mk_real_int64 207L); (mk_real_int64 381L); (mk_real_int64 132L); (mk_real_int64 327L); (mk_real_int64 327L); (mk_real_int64 347L); (mk_real_int64 307L); (mk_real_int64 327L); (mk_real_int64 327L); (mk_real_int64 327L); (mk_real_int64 327L); (mk_real_int64 378L); (mk_real_int64 143L); ]); +("ineq119", [3; 5; ], [(mk_real_int64 650L); (mk_real_int64 650L); ]); +("ineq120", [0; 6; ], [(mk_real_int64 104L); (mk_real_int64 104L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 3050L); (mk_real_int64 3050L); (mk_real_int64 3050L); (mk_real_int64 2525L); (mk_real_int64 3050L); (mk_real_int64 2525L); (mk_real_int64 2400L); (mk_real_int64 1925L); (mk_real_int64 1925L); (mk_real_int64 2400L); (mk_real_int64 3050L); (mk_real_int64 3050L); (mk_real_int64 1925L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [0; 4; 9; 10; 20; 23; 24; 30; 35; 39; 42; 50; 51; 59; ], [(mk_real_int64 832L); (mk_real_int64 96L); (mk_real_int64 96L); (mk_real_int64 582L); (mk_real_int64 628L); (mk_real_int64 222L); (mk_real_int64 182L); (mk_real_int64 506L); (mk_real_int64 582L); (mk_real_int64 832L); (mk_real_int64 506L); (mk_real_int64 222L); (mk_real_int64 182L); (mk_real_int64 628L); ]); +("azim_lo", [3; 11; 12; 14; 16; 17; 19; 21; 28; 33; 34; 36; 38; 43; 47; 49; 54; 55; 57; 58; 60; 61; ], [(mk_real_int64 450L); (mk_real_int64 256L); (mk_real_int64 294L); (mk_real_int64 74L); (mk_real_int64 298L); (mk_real_int64 298L); (mk_real_int64 431L); (mk_real_int64 482L); (mk_real_int64 368L); (mk_real_int64 74L); (mk_real_int64 294L); (mk_real_int64 256L); (mk_real_int64 450L); (mk_real_int64 368L); (mk_real_int64 298L); (mk_real_int64 298L); (mk_real_int64 298L); (mk_real_int64 298L); (mk_real_int64 298L); (mk_real_int64 298L); (mk_real_int64 482L); (mk_real_int64 431L); ]); +("rhazim_lo", [0; 10; 15; 31; 35; 39; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_hi", [17; 21; 26; 29; 41; 44; 58; 60; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_hi", [3; 5; 6; 7; 8; 9; 12; ], [(mk_real_int64 1440L); (mk_real_int64 1440L); (mk_real_int64 1604L); (mk_real_int64 736L); (mk_real_int64 736L); (mk_real_int64 1604L); (mk_real_int64 736L); ]); +("rho_lo", [0; 1; 2; 4; 10; 11; ], [(mk_real_int64 1240L); (mk_real_int64 1240L); (mk_real_int64 1240L); (mk_real_int64 1240L); (mk_real_int64 1240L); (mk_real_int64 1240L); ]); +("tau_hi", [0; 3; 4; 10; 11; 12; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("y1_lo", [11; 13; 15; 17; 21; 24; 26; 32; 33; 35; 36; 42; 44; 58; 60; ], [(mk_real_int64 121L); (mk_real_int64 220L); (mk_real_int64 380L); (mk_real_int64 200L); (mk_real_int64 200L); (mk_real_int64 60L); (mk_real_int64 200L); (mk_real_int64 220L); (mk_real_int64 380L); (mk_real_int64 420L); (mk_real_int64 701L); (mk_real_int64 240L); (mk_real_int64 200L); (mk_real_int64 200L); (mk_real_int64 200L); ]); +("y1_hi", [19; 22; 23; 25; 28; 43; 46; 50; 52; 61; ], [(mk_real_int64 500L); (mk_real_int64 500L); (mk_real_int64 400L); (mk_real_int64 420L); (mk_real_int64 185L); (mk_real_int64 425L); (mk_real_int64 420L); (mk_real_int64 400L); (mk_real_int64 440L); (mk_real_int64 500L); ]); +("y2_lo", [11; 13; 15; 17; 18; 19; 22; 24; 26; 32; 33; 35; 42; 44; 48; 52; 53; 56; 58; 61; ], [(mk_real_int64 105L); (mk_real_int64 216L); (mk_real_int64 380L); (mk_real_int64 352L); (mk_real_int64 392L); (mk_real_int64 208L); (mk_real_int64 368L); (mk_real_int64 60L); (mk_real_int64 352L); (mk_real_int64 216L); (mk_real_int64 380L); (mk_real_int64 420L); (mk_real_int64 240L); (mk_real_int64 352L); (mk_real_int64 392L); (mk_real_int64 428L); (mk_real_int64 392L); (mk_real_int64 392L); (mk_real_int64 352L); (mk_real_int64 208L); ]); +("y2_hi", [21; 23; 25; 28; 29; 36; 41; 43; 46; 50; 60; ], [(mk_real_int64 508L); (mk_real_int64 184L); (mk_real_int64 420L); (mk_real_int64 140L); (mk_real_int64 240L); (mk_real_int64 315L); (mk_real_int64 240L); (mk_real_int64 380L); (mk_real_int64 420L); (mk_real_int64 184L); (mk_real_int64 508L); ]); +("y3_lo", [11; 13; 15; 17; 18; 19; 22; 24; 26; 32; 33; 35; 42; 44; 48; 52; 53; 56; 58; 61; ], [(mk_real_int64 105L); (mk_real_int64 216L); (mk_real_int64 380L); (mk_real_int64 352L); (mk_real_int64 392L); (mk_real_int64 208L); (mk_real_int64 368L); (mk_real_int64 60L); (mk_real_int64 352L); (mk_real_int64 216L); (mk_real_int64 380L); (mk_real_int64 420L); (mk_real_int64 240L); (mk_real_int64 352L); (mk_real_int64 392L); (mk_real_int64 428L); (mk_real_int64 392L); (mk_real_int64 392L); (mk_real_int64 352L); (mk_real_int64 208L); ]); +("y3_hi", [21; 23; 25; 28; 29; 36; 41; 43; 46; 50; 60; ], [(mk_real_int64 508L); (mk_real_int64 184L); (mk_real_int64 420L); (mk_real_int64 140L); (mk_real_int64 240L); (mk_real_int64 315L); (mk_real_int64 240L); (mk_real_int64 380L); (mk_real_int64 420L); (mk_real_int64 184L); (mk_real_int64 508L); ]); +("y4_lo", [9; 11; 17; 19; 20; 21; 24; 25; 28; 29; 31; 32; 33; 34; 38; 42; 52; ], [(mk_real_int64 410L); (mk_real_int64 404L); (mk_real_int64 695L); (mk_real_int64 110L); (mk_real_int64 548L); (mk_real_int64 364L); (mk_real_int64 75L); (mk_real_int64 600L); (mk_real_int64 410L); (mk_real_int64 404L); (mk_real_int64 375L); (mk_real_int64 360L); (mk_real_int64 600L); (mk_real_int64 250L); (mk_real_int64 364L); (mk_real_int64 110L); (mk_real_int64 695L); ]); +("y4_hi", [7; 13; 14; 15; 18; 22; 35; 36; 40; 44; 45; 48; 50; 53; ], [(mk_real_int64 265L); (mk_real_int64 80L); (mk_real_int64 158L); (mk_real_int64 367L); (mk_real_int64 207L); (mk_real_int64 80L); (mk_real_int64 175L); (mk_real_int64 80L); (mk_real_int64 158L); (mk_real_int64 659L); (mk_real_int64 158L); (mk_real_int64 158L); (mk_real_int64 80L); (mk_real_int64 367L); ]); +("y5_hi", [11; 13; 21; 23; 28; 29; 32; 36; 41; 43; 50; 52; 60; ], [(mk_real_int64 165L); (mk_real_int64 29L); (mk_real_int64 508L); (mk_real_int64 184L); (mk_real_int64 130L); (mk_real_int64 240L); (mk_real_int64 29L); (mk_real_int64 540L); (mk_real_int64 240L); (mk_real_int64 380L); (mk_real_int64 184L); (mk_real_int64 84L); (mk_real_int64 508L); ]); +("y5_lo", [15; 17; 18; 19; 22; 24; 25; 26; 33; 35; 42; 44; 46; 48; 53; 56; 58; 61; ], [(mk_real_int64 404L); (mk_real_int64 352L); (mk_real_int64 392L); (mk_real_int64 208L); (mk_real_int64 368L); (mk_real_int64 548L); (mk_real_int64 364L); (mk_real_int64 352L); (mk_real_int64 404L); (mk_real_int64 375L); (mk_real_int64 250L); (mk_real_int64 352L); (mk_real_int64 364L); (mk_real_int64 392L); (mk_real_int64 392L); (mk_real_int64 392L); (mk_real_int64 352L); (mk_real_int64 208L); ]); +("y6_hi", [11; 13; 21; 23; 26; 28; 29; 32; 36; 41; 42; 43; 44; 48; 50; 52; 53; ], [(mk_real_int64 165L); (mk_real_int64 29L); (mk_real_int64 508L); (mk_real_int64 184L); (mk_real_int64 648L); (mk_real_int64 130L); (mk_real_int64 240L); (mk_real_int64 29L); (mk_real_int64 540L); (mk_real_int64 240L); (mk_real_int64 750L); (mk_real_int64 380L); (mk_real_int64 648L); (mk_real_int64 608L); (mk_real_int64 184L); (mk_real_int64 84L); (mk_real_int64 608L); ]); +("y6_lo", [15; 17; 18; 19; 22; 24; 25; 26; 31; 33; 35; 42; 44; 46; 48; 53; 56; 58; 60; 61; ], [(mk_real_int64 404L); (mk_real_int64 352L); (mk_real_int64 392L); (mk_real_int64 153208L); (mk_real_int64 13368L); (mk_real_int64 548L); (mk_real_int64 364L); (mk_real_int64 110000L); (mk_real_int64 206000L); (mk_real_int64 404L); (mk_real_int64 375L); (mk_real_int64 206000L); (mk_real_int64 110000L); (mk_real_int64 364L); (mk_real_int64 84000L); (mk_real_int64 84000L); (mk_real_int64 392L); (mk_real_int64 352L); (mk_real_int64 13492L); (mk_real_int64 153208L); ]); +("y8_hi", [5; ], [(mk_real_int64 191000L); ]); +("ye_hi", [14; 17; 24; 25; 31; 33; 34; 46; 47; 55; 58; 60; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_lo", [47; 50; 52; 55; ], [(mk_real_int64 97000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 97000L); ]); +("yn_lo", [3; 5; 7; 12; ], [(mk_real_int64 228L); (mk_real_int64 228L); (mk_real_int64 517L); (mk_real_int64 517L); ]); +("yn_hi", [0; 1; 2; 4; 6; 8; 9; 10; 11; ], [(mk_real_int64 386L); (mk_real_int64 1386L); (mk_real_int64 386L); (mk_real_int64 1386L); (mk_real_int64 1938L); (mk_real_int64 1483L); (mk_real_int64 1938L); (mk_real_int64 1386L); (mk_real_int64 386L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/195482381558_out.hl b/formal_lp/old/ineqs/tests2/195482381558_out.hl new file mode 100644 index 0000000..a240752 --- /dev/null +++ b/formal_lp/old/ineqs/tests2/195482381558_out.hl @@ -0,0 +1,86 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "195482381558 18 4 0 1 2 3 4 0 3 4 5 3 4 3 6 3 6 3 7 3 7 3 2 3 7 2 8 3 8 2 1 3 8 1 9 3 9 1 0 3 9 0 10 3 10 0 5 3 10 5 11 3 11 5 4 3 11 4 6 4 10 11 6 12 3 12 6 7 3 9 10 12 4 12 7 8 9 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [0; 3; 7; 8; 10; 12; ], [(mk_real_int64 408L); (mk_real_int64 406L); (mk_real_int64 101L); (mk_real_int64 101L); (mk_real_int64 101L); (mk_real_int64 101L); ]); +("azim_sum_neg", [1; 2; 4; 5; 6; 11; ], [(mk_real_int64 172L); (mk_real_int64 172L); (mk_real_int64 172L); (mk_real_int64 172L); (mk_real_int64 344L); (mk_real_int64 344L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 882L); (mk_real_int64 934L); (mk_real_int64 934L); (mk_real_int64 884L); (mk_real_int64 934L); (mk_real_int64 934L); (mk_real_int64 1026L); (mk_real_int64 1026L); (mk_real_int64 1026L); (mk_real_int64 1026L); (mk_real_int64 1026L); (mk_real_int64 1026L); (mk_real_int64 1026L); ]); +("sol_sum3_neg", [0; 1; 2; 6; 7; 8; ], [(mk_real_int64 164L); (mk_real_int64 245L); (mk_real_int64 164L); (mk_real_int64 162L); (mk_real_int64 249L); (mk_real_int64 162L); ]); +("sol_sum3", [3; 4; 5; 9; 10; 11; ], [(mk_real_int64 172L); (mk_real_int64 172L); (mk_real_int64 172L); (mk_real_int64 172L); (mk_real_int64 172L); (mk_real_int64 172L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 882L); (mk_real_int64 882L); (mk_real_int64 882L); (mk_real_int64 934L); (mk_real_int64 934L); (mk_real_int64 934L); (mk_real_int64 884L); (mk_real_int64 878L); (mk_real_int64 884L); (mk_real_int64 934L); (mk_real_int64 934L); (mk_real_int64 934L); (mk_real_int64 1026L); (mk_real_int64 1026L); ]); +("tau_sum4_neg", [0; 1; 2; 3; ], [(mk_real_int64 761L); (mk_real_int64 761L); (mk_real_int64 1026L); (mk_real_int64 1026L); ]); +("ln_def", [0; 3; ], [(mk_real_int64 27L); (mk_real_int64 26L); ]); +("ln_def_neg", [1; 2; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 29L); (mk_real_int64 29L); (mk_real_int64 29L); (mk_real_int64 29L); (mk_real_int64 132L); (mk_real_int64 132L); (mk_real_int64 132L); (mk_real_int64 132L); (mk_real_int64 132L); (mk_real_int64 132L); (mk_real_int64 132L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 5542L); (mk_real_int64 5866L); (mk_real_int64 5866L); (mk_real_int64 5553L); (mk_real_int64 5866L); (mk_real_int64 5866L); (mk_real_int64 6449L); (mk_real_int64 6449L); (mk_real_int64 6449L); (mk_real_int64 6449L); (mk_real_int64 6449L); (mk_real_int64 6449L); (mk_real_int64 6449L); ]); +("edge_sym", [0; 2; 3; 5; 7; 9; 24; 28; ], [(mk_real_int64 97L); (mk_real_int64 96L); (mk_real_int64 193L); (mk_real_int64 96L); (mk_real_int64 97L); (mk_real_int64 126L); (mk_real_int64 73L); (mk_real_int64 126L); ]); +("edge_sym_neg", [10; 12; 13; 16; 22; 30; 31; 34; 40; ], [(mk_real_int64 73L); (mk_real_int64 126L); (mk_real_int64 126L); (mk_real_int64 73L); (mk_real_int64 73L); (mk_real_int64 126L); (mk_real_int64 126L); (mk_real_int64 73L); (mk_real_int64 73L); ]); +("y1_def_neg", [0; 3; 4; 5; 10; 12; 19; 22; 24; 26; 30; 36; 39; 40; 42; 43; 50; 51; ], [(mk_real_int64 76L); (mk_real_int64 75L); (mk_real_int64 76L); (mk_real_int64 75L); (mk_real_int64 13L); (mk_real_int64 19L); (mk_real_int64 49L); (mk_real_int64 194L); (mk_real_int64 89L); (mk_real_int64 14L); (mk_real_int64 112L); (mk_real_int64 63L); (mk_real_int64 168L); (mk_real_int64 26L); (mk_real_int64 63L); (mk_real_int64 26L); (mk_real_int64 127L); (mk_real_int64 127L); ]); +("y1_def", [8; 9; 14; 16; 20; 23; 27; 28; 31; 32; 34; 37; 38; 41; ], [(mk_real_int64 108L); (mk_real_int64 39L); (mk_real_int64 26L); (mk_real_int64 108L); (mk_real_int64 40L); (mk_real_int64 40L); (mk_real_int64 108L); (mk_real_int64 38L); (mk_real_int64 95L); (mk_real_int64 24L); (mk_real_int64 108L); (mk_real_int64 14L); (mk_real_int64 40L); (mk_real_int64 40L); ]); +("y2_def", [0; 3; 4; 5; 9; 10; 14; 26; 28; 31; 32; ], [(mk_real_int64 97L); (mk_real_int64 96L); (mk_real_int64 97L); (mk_real_int64 96L); (mk_real_int64 39L); (mk_real_int64 8L); (mk_real_int64 47L); (mk_real_int64 8L); (mk_real_int64 38L); (mk_real_int64 95L); (mk_real_int64 46L); ]); +("y2_def_neg", [8; 12; 16; 19; 20; 22; 23; 24; 27; 30; 34; 36; 37; 38; 39; 40; 41; 42; 43; 50; 51; ], [(mk_real_int64 33L); (mk_real_int64 19L); (mk_real_int64 33L); (mk_real_int64 101L); (mk_real_int64 12L); (mk_real_int64 194L); (mk_real_int64 12L); (mk_real_int64 89L); (mk_real_int64 33L); (mk_real_int64 112L); (mk_real_int64 33L); (mk_real_int64 63L); (mk_real_int64 38L); (mk_real_int64 12L); (mk_real_int64 168L); (mk_real_int64 26L); (mk_real_int64 12L); (mk_real_int64 63L); (mk_real_int64 26L); (mk_real_int64 127L); (mk_real_int64 127L); ]); +("y3_def", [0; 3; 4; 5; 9; 10; 14; 26; 28; 31; 32; ], [(mk_real_int64 97L); (mk_real_int64 96L); (mk_real_int64 97L); (mk_real_int64 96L); (mk_real_int64 39L); (mk_real_int64 8L); (mk_real_int64 47L); (mk_real_int64 8L); (mk_real_int64 38L); (mk_real_int64 95L); (mk_real_int64 46L); ]); +("y3_def_neg", [8; 12; 16; 19; 20; 22; 23; 24; 27; 30; 34; 36; 37; 38; 39; 40; 41; 42; 43; 50; 51; ], [(mk_real_int64 33L); (mk_real_int64 19L); (mk_real_int64 33L); (mk_real_int64 101L); (mk_real_int64 12L); (mk_real_int64 194L); (mk_real_int64 12L); (mk_real_int64 89L); (mk_real_int64 33L); (mk_real_int64 112L); (mk_real_int64 33L); (mk_real_int64 63L); (mk_real_int64 38L); (mk_real_int64 12L); (mk_real_int64 168L); (mk_real_int64 26L); (mk_real_int64 12L); (mk_real_int64 63L); (mk_real_int64 26L); (mk_real_int64 127L); (mk_real_int64 127L); ]); +("y4_def_neg", [1; 2; 4; 6; 14; 18; 20; 22; 23; 24; 28; 31; 34; 38; 39; ], [(mk_real_int64 48L); (mk_real_int64 15L); (mk_real_int64 126L); (mk_real_int64 63L); (mk_real_int64 61L); (mk_real_int64 16L); (mk_real_int64 49L); (mk_real_int64 77L); (mk_real_int64 49L); (mk_real_int64 64L); (mk_real_int64 44L); (mk_real_int64 117L); (mk_real_int64 44L); (mk_real_int64 88L); (mk_real_int64 88L); ]); +("y4_def", [0; 8; 11; 12; 15; 16; 19; 26; 29; 30; 32; 33; 35; ], [(mk_real_int64 166L); (mk_real_int64 166L); (mk_real_int64 73L); (mk_real_int64 61L); (mk_real_int64 61L); (mk_real_int64 12L); (mk_real_int64 167L); (mk_real_int64 167L); (mk_real_int64 117L); (mk_real_int64 61L); (mk_real_int64 56L); (mk_real_int64 61L); (mk_real_int64 56L); ]); +("y5_def", [0; 3; 4; 5; 10; 24; 26; 37; 40; 43; ], [(mk_real_int64 97L); (mk_real_int64 96L); (mk_real_int64 97L); (mk_real_int64 96L); (mk_real_int64 8L); (mk_real_int64 12L); (mk_real_int64 8L); (mk_real_int64 44L); (mk_real_int64 56L); (mk_real_int64 56L); ]); +("y5_def_neg", [8; 9; 12; 14; 16; 20; 22; 23; 27; 28; 30; 31; 32; 34; 36; 38; 39; 41; 42; 50; 51; ], [(mk_real_int64 33L); (mk_real_int64 48L); (mk_real_int64 126L); (mk_real_int64 40L); (mk_real_int64 33L); (mk_real_int64 12L); (mk_real_int64 61L); (mk_real_int64 12L); (mk_real_int64 33L); (mk_real_int64 49L); (mk_real_int64 77L); (mk_real_int64 49L); (mk_real_int64 40L); (mk_real_int64 33L); (mk_real_int64 44L); (mk_real_int64 12L); (mk_real_int64 117L); (mk_real_int64 12L); (mk_real_int64 44L); (mk_real_int64 88L); (mk_real_int64 88L); ]); +("y6_def", [0; 3; 4; 5; 10; 20; 23; 24; 26; 37; 38; 40; 41; 43; 48; 49; 51; 52; 53; ], [(mk_real_int64 97L); (mk_real_int64 96L); (mk_real_int64 97L); (mk_real_int64 96L); (mk_real_int64 8L); (mk_real_int64 61L); (mk_real_int64 61L); (mk_real_int64 12L); (mk_real_int64 8L); (mk_real_int64 44L); (mk_real_int64 61L); (mk_real_int64 56L); (mk_real_int64 61L); (mk_real_int64 56L); (mk_real_int64 88L); (mk_real_int64 214L); (mk_real_int64 126L); (mk_real_int64 88L); (mk_real_int64 88L); ]); +("y6_def_neg", [8; 9; 12; 14; 16; 22; 27; 28; 30; 31; 32; 34; 36; 39; 42; ], [(mk_real_int64 33L); (mk_real_int64 48L); (mk_real_int64 126L); (mk_real_int64 40L); (mk_real_int64 33L); (mk_real_int64 61L); (mk_real_int64 33L); (mk_real_int64 49L); (mk_real_int64 77L); (mk_real_int64 49L); (mk_real_int64 40L); (mk_real_int64 33L); (mk_real_int64 44L); (mk_real_int64 117L); (mk_real_int64 44L); ]); +("RHA", [0; 1; 2; 3; 4; 5; 6; 7; 8; 10; 11; 13; 14; 16; 17; 19; 20; 23; 25; 26; 27; 29; 30; 31; 32; 34; 35; 37; 38; 41; 43; ], [(mk_real_int64 122L); (mk_real_int64 172L); (mk_real_int64 172L); (mk_real_int64 121L); (mk_real_int64 122L); (mk_real_int64 121L); (mk_real_int64 172L); (mk_real_int64 172L); (mk_real_int64 52L); (mk_real_int64 122L); (mk_real_int64 144L); (mk_real_int64 144L); (mk_real_int64 122L); (mk_real_int64 52L); (mk_real_int64 93L); (mk_real_int64 93L); (mk_real_int64 93L); (mk_real_int64 93L); (mk_real_int64 93L); (mk_real_int64 120L); (mk_real_int64 50L); (mk_real_int64 148L); (mk_real_int64 5L); (mk_real_int64 148L); (mk_real_int64 120L); (mk_real_int64 50L); (mk_real_int64 93L); (mk_real_int64 93L); (mk_real_int64 93L); (mk_real_int64 93L); (mk_real_int64 93L); ]); +("yy10", [4; ], [(mk_real_int64 386L); ]); +("ineq105", [0; 3; 4; 5; ], [(mk_real_int64 241L); (mk_real_int64 239L); (mk_real_int64 241L); (mk_real_int64 239L); ]); +("ineq106", [2; 6; 18; 24; ], [(mk_real_int64 22L); (mk_real_int64 22L); (mk_real_int64 23L); (mk_real_int64 23L); ]); +("ineq107", [0; 8; 11; 12; 15; 19; 26; 29; 30; 33; ], [(mk_real_int64 215L); (mk_real_int64 215L); (mk_real_int64 79L); (mk_real_int64 79L); (mk_real_int64 79L); (mk_real_int64 216L); (mk_real_int64 216L); (mk_real_int64 79L); (mk_real_int64 79L); (mk_real_int64 79L); ]); +("ineq109", [11; 14; 16; 29; 32; 35; ], [(mk_real_int64 172L); (mk_real_int64 172L); (mk_real_int64 172L); (mk_real_int64 172L); (mk_real_int64 172L); (mk_real_int64 172L); ]); +("ineq110", [1; 4; 6; 20; 23; 24; ], [(mk_real_int64 164L); (mk_real_int64 245L); (mk_real_int64 164L); (mk_real_int64 162L); (mk_real_int64 249L); (mk_real_int64 162L); ]); +("ineq111", [1; 4; 6; 11; 14; 16; 20; 22; 24; 28; 31; 34; 38; 39; ], [(mk_real_int64 130L); (mk_real_int64 623L); (mk_real_int64 130L); (mk_real_int64 349L); (mk_real_int64 934L); (mk_real_int64 349L); (mk_real_int64 134L); (mk_real_int64 620L); (mk_real_int64 134L); (mk_real_int64 349L); (mk_real_int64 934L); (mk_real_int64 349L); (mk_real_int64 703L); (mk_real_int64 703L); ]); +("ineq113", [0; 8; 19; 26; ], [(mk_real_int64 267L); (mk_real_int64 267L); (mk_real_int64 266L); (mk_real_int64 266L); ]); +("ineq114", [1; 2; 4; 6; 7; 9; 17; 18; 20; 22; 24; 25; 27; 35; 37; 38; 39; 40; ], [(mk_real_int64 390L); (mk_real_int64 96L); (mk_real_int64 259L); (mk_real_int64 96L); (mk_real_int64 390L); (mk_real_int64 585L); (mk_real_int64 585L); (mk_real_int64 94L); (mk_real_int64 389L); (mk_real_int64 259L); (mk_real_int64 94L); (mk_real_int64 389L); (mk_real_int64 585L); (mk_real_int64 585L); (mk_real_int64 162L); (mk_real_int64 162L); (mk_real_int64 162L); (mk_real_int64 162L); ]); +("ineq119", [9; 14; ], [(mk_real_int64 759L); (mk_real_int64 759L); ]); +("ineq120", [0; 3; 4; 5; 8; 10; 13; 15; ], [(mk_real_int64 379L); (mk_real_int64 382L); (mk_real_int64 379L); (mk_real_int64 382L); (mk_real_int64 134L); (mk_real_int64 134L); (mk_real_int64 134L); (mk_real_int64 134L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 3150L); (mk_real_int64 2450L); (mk_real_int64 2450L); (mk_real_int64 2225L); (mk_real_int64 2450L); (mk_real_int64 2450L); (mk_real_int64 3425L); (mk_real_int64 3425L); (mk_real_int64 3425L); (mk_real_int64 3425L); (mk_real_int64 3425L); (mk_real_int64 3425L); (mk_real_int64 3425L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [0; 4; 9; 10; 14; 15; 17; 25; 30; 35; 43; 44; 45; 46; 49; 50; 51; 52; 55; 56; 57; ], [(mk_real_int64 282L); (mk_real_int64 282L); (mk_real_int64 140L); (mk_real_int64 1096L); (mk_real_int64 1096L); (mk_real_int64 140L); (mk_real_int64 210L); (mk_real_int64 210L); (mk_real_int64 134L); (mk_real_int64 210L); (mk_real_int64 210L); (mk_real_int64 572L); (mk_real_int64 173L); (mk_real_int64 572L); (mk_real_int64 412L); (mk_real_int64 412L); (mk_real_int64 412L); (mk_real_int64 412L); (mk_real_int64 572L); (mk_real_int64 173L); (mk_real_int64 572L); ]); +("azim_lo", [3; 5; 8; 12; 16; 26; 27; 28; 32; 33; 34; ], [(mk_real_int64 444L); (mk_real_int64 444L); (mk_real_int64 153L); (mk_real_int64 866L); (mk_real_int64 153L); (mk_real_int64 156L); (mk_real_int64 894L); (mk_real_int64 486L); (mk_real_int64 156L); (mk_real_int64 486L); (mk_real_int64 894L); ]); +("rhazim_lo", [0; 1; 2; 4; 6; 7; 30; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_hi", [17; 19; 20; 23; 25; 26; 32; 35; 37; 38; 41; 43; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_hi", [0; 1; 2; 3; 4; 5; ], [(mk_real_int64 488L); (mk_real_int64 3256L); (mk_real_int64 3256L); (mk_real_int64 2056L); (mk_real_int64 3256L); (mk_real_int64 3256L); ]); +("rho_lo", [6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 1616L); (mk_real_int64 1616L); (mk_real_int64 1616L); (mk_real_int64 1616L); (mk_real_int64 1616L); (mk_real_int64 1616L); (mk_real_int64 1616L); ]); +("tau_lo", [8; 10; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("tau_hi", [2; 4; 9; 14; 15; 16; 17; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("y1_hi", [0; 4; 24; 26; 30; 36; 40; 42; 43; 50; 51; ], [(mk_real_int64 85L); (mk_real_int64 85L); (mk_real_int64 208L); (mk_real_int64 200L); (mk_real_int64 400L); (mk_real_int64 180L); (mk_real_int64 28L); (mk_real_int64 180L); (mk_real_int64 28L); (mk_real_int64 460L); (mk_real_int64 460L); ]); +("y1_lo", [3; 5; 8; 9; 10; 12; 14; 16; 19; 20; 22; 23; 28; 31; 32; 37; 38; 39; 41; ], [(mk_real_int64 285L); (mk_real_int64 285L); (mk_real_int64 500L); (mk_real_int64 80L); (mk_real_int64 200L); (mk_real_int64 40L); (mk_real_int64 280L); (mk_real_int64 500L); (mk_real_int64 292L); (mk_real_int64 500L); (mk_real_int64 92L); (mk_real_int64 500L); (mk_real_int64 560L); (mk_real_int64 380L); (mk_real_int64 360L); (mk_real_int64 472L); (mk_real_int64 500L); (mk_real_int64 120L); (mk_real_int64 500L); ]); +("y2_lo", [0; 4; 9; 12; 14; 20; 22; 23; 28; 31; 32; 38; 39; 41; ], [(mk_real_int64 118L); (mk_real_int64 118L); (mk_real_int64 80L); (mk_real_int64 40L); (mk_real_int64 72L); (mk_real_int64 8L); (mk_real_int64 92L); (mk_real_int64 8L); (mk_real_int64 560L); (mk_real_int64 380L); (mk_real_int64 188L); (mk_real_int64 8L); (mk_real_int64 120L); (mk_real_int64 8L); ]); +("y2_hi", [3; 5; 8; 10; 16; 19; 24; 26; 27; 30; 34; 36; 37; 40; 42; 43; 50; 51; ], [(mk_real_int64 78L); (mk_real_int64 78L); (mk_real_int64 320L); (mk_real_int64 8L); (mk_real_int64 320L); (mk_real_int64 200L); (mk_real_int64 208L); (mk_real_int64 372L); (mk_real_int64 168L); (mk_real_int64 400L); (mk_real_int64 168L); (mk_real_int64 180L); (mk_real_int64 20L); (mk_real_int64 28L); (mk_real_int64 180L); (mk_real_int64 28L); (mk_real_int64 460L); (mk_real_int64 460L); ]); +("y3_lo", [0; 4; 9; 12; 14; 20; 22; 23; 28; 31; 32; 38; 39; 41; ], [(mk_real_int64 118L); (mk_real_int64 118L); (mk_real_int64 80L); (mk_real_int64 40L); (mk_real_int64 72L); (mk_real_int64 8L); (mk_real_int64 92L); (mk_real_int64 8L); (mk_real_int64 560L); (mk_real_int64 380L); (mk_real_int64 188L); (mk_real_int64 8L); (mk_real_int64 120L); (mk_real_int64 8L); ]); +("y3_hi", [3; 5; 8; 10; 16; 19; 24; 26; 27; 30; 34; 36; 37; 40; 42; 43; 50; 51; ], [(mk_real_int64 78L); (mk_real_int64 78L); (mk_real_int64 320L); (mk_real_int64 8L); (mk_real_int64 320L); (mk_real_int64 200L); (mk_real_int64 208L); (mk_real_int64 372L); (mk_real_int64 168L); (mk_real_int64 400L); (mk_real_int64 168L); (mk_real_int64 180L); (mk_real_int64 20L); (mk_real_int64 28L); (mk_real_int64 180L); (mk_real_int64 28L); (mk_real_int64 460L); (mk_real_int64 460L); ]); +("y4_hi", [0; 4; 8; 11; 12; 15; 16; 18; 20; 23; 28; 30; 31; 33; 34; 38; 39; ], [(mk_real_int64 195L); (mk_real_int64 105L); (mk_real_int64 195L); (mk_real_int64 170L); (mk_real_int64 67L); (mk_real_int64 67L); (mk_real_int64 103L); (mk_real_int64 245L); (mk_real_int64 498L); (mk_real_int64 196L); (mk_real_int64 375L); (mk_real_int64 67L); (mk_real_int64 250L); (mk_real_int64 67L); (mk_real_int64 375L); (mk_real_int64 125L); (mk_real_int64 125L); ]); +("y4_lo", [1; 2; 6; 14; 19; 22; 24; 26; 29; 32; 35; ], [(mk_real_int64 394L); (mk_real_int64 70L); (mk_real_int64 464L); (mk_real_int64 22L); (mk_real_int64 32L); (mk_real_int64 500L); (mk_real_int64 257L); (mk_real_int64 32L); (mk_real_int64 205L); (mk_real_int64 272L); (mk_real_int64 272L); ]); +("y5_lo", [0; 4; 9; 14; 20; 22; 23; 30; 32; 37; 38; 40; 41; 43; ], [(mk_real_int64 118L); (mk_real_int64 118L); (mk_real_int64 394L); (mk_real_int64 386L); (mk_real_int64 8L); (mk_real_int64 22L); (mk_real_int64 8L); (mk_real_int64 500L); (mk_real_int64 130L); (mk_real_int64 280L); (mk_real_int64 8L); (mk_real_int64 272L); (mk_real_int64 8L); (mk_real_int64 272L); ]); +("y5_hi", [3; 5; 8; 10; 12; 16; 19; 24; 26; 27; 28; 31; 34; 36; 39; 42; 50; 51; ], [(mk_real_int64 78L); (mk_real_int64 78L); (mk_real_int64 320L); (mk_real_int64 8L); (mk_real_int64 105L); (mk_real_int64 320L); (mk_real_int64 95L); (mk_real_int64 103L); (mk_real_int64 372L); (mk_real_int64 168L); (mk_real_int64 498L); (mk_real_int64 196L); (mk_real_int64 168L); (mk_real_int64 375L); (mk_real_int64 250L); (mk_real_int64 375L); (mk_real_int64 125L); (mk_real_int64 125L); ]); +("y6_lo", [0; 4; 9; 14; 20; 22; 23; 30; 32; 37; 38; 40; 41; 43; 48; 49; 50; 51; 52; 53; ], [(mk_real_int64 118L); (mk_real_int64 118L); (mk_real_int64 394L); (mk_real_int64 386L); (mk_real_int64 73008L); (mk_real_int64 22L); (mk_real_int64 73008L); (mk_real_int64 500L); (mk_real_int64 130L); (mk_real_int64 280L); (mk_real_int64 73008L); (mk_real_int64 272L); (mk_real_int64 73008L); (mk_real_int64 272L); (mk_real_int64 88000L); (mk_real_int64 214000L); (mk_real_int64 88000L); (mk_real_int64 214000L); (mk_real_int64 88000L); (mk_real_int64 88000L); ]); +("y6_hi", [3; 5; 8; 10; 12; 16; 19; 24; 26; 27; 28; 31; 34; 36; 39; 42; 50; 51; ], [(mk_real_int64 78L); (mk_real_int64 78L); (mk_real_int64 320L); (mk_real_int64 8L); (mk_real_int64 105L); (mk_real_int64 320L); (mk_real_int64 95L); (mk_real_int64 103L); (mk_real_int64 372L); (mk_real_int64 168L); (mk_real_int64 498L); (mk_real_int64 196L); (mk_real_int64 168L); (mk_real_int64 375L); (mk_real_int64 250L); (mk_real_int64 375L); (mk_real_int64 125L); (mk_real_int64 125L); ]); +("ye_hi", [32; ], [(mk_real_int64 1000L); ]); +("ye_lo", [26; 27; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_lo", [1; 2; 3; 4; 5; 7; 8; 9; 10; 12; ], [(mk_real_int64 204L); (mk_real_int64 204L); (mk_real_int64 998L); (mk_real_int64 204L); (mk_real_int64 204L); (mk_real_int64 32L); (mk_real_int64 32L); (mk_real_int64 32L); (mk_real_int64 32L); (mk_real_int64 32L); ]); +("yn_hi", [0; 6; 11; ], [(mk_real_int64 1079L); (mk_real_int64 1968L); (mk_real_int64 1968L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/196021155893_out.hl b/formal_lp/old/ineqs/tests2/196021155893_out.hl new file mode 100644 index 0000000..0d64948 --- /dev/null +++ b/formal_lp/old/ineqs/tests2/196021155893_out.hl @@ -0,0 +1,85 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "196021155893 18 4 0 1 2 3 3 0 3 4 3 4 3 5 4 5 3 2 6 3 6 2 1 3 6 1 7 3 7 1 8 3 8 1 0 3 8 0 9 4 9 0 4 10 3 10 4 5 3 10 5 11 3 11 5 6 3 11 6 7 3 11 7 12 3 12 7 8 3 12 8 9 4 9 10 11 12 ";; +let precision = 4;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [3; 5; 6; 8; 11; ], [(mk_real_int64 5101L); (mk_real_int64 4000L); (mk_real_int64 2703L); (mk_real_int64 175L); (mk_real_int64 2818L); ]); +("azim_sum_neg", [1; 4; 7; 9; 12; ], [(mk_real_int64 1027L); (mk_real_int64 617L); (mk_real_int64 524L); (mk_real_int64 374L); (mk_real_int64 3149L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 9004L); (mk_real_int64 9004L); (mk_real_int64 9004L); (mk_real_int64 9004L); (mk_real_int64 9187L); (mk_real_int64 9004L); (mk_real_int64 9004L); (mk_real_int64 8570L); (mk_real_int64 8612L); (mk_real_int64 8944L); (mk_real_int64 8570L); (mk_real_int64 8570L); (mk_real_int64 8570L); ]); +("sol_sum3", [2; 11; 12; 13; ], [(mk_real_int64 287L); (mk_real_int64 1134L); (mk_real_int64 1842L); (mk_real_int64 1723L); ]); +("sol_sum3_neg", [3; 4; 5; 6; 9; 10; ], [(mk_real_int64 990L); (mk_real_int64 2198L); (mk_real_int64 855L); (mk_real_int64 1930L); (mk_real_int64 3546L); (mk_real_int64 399L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 9004L); (mk_real_int64 9004L); (mk_real_int64 9004L); (mk_real_int64 8014L); (mk_real_int64 5469L); (mk_real_int64 8149L); (mk_real_int64 6857L); (mk_real_int64 8570L); (mk_real_int64 8570L); (mk_real_int64 7889L); (mk_real_int64 8570L); (mk_real_int64 8570L); (mk_real_int64 8570L); (mk_real_int64 8570L); ]); +("tau_sum4_neg", [0; 1; 2; 3; ], [(mk_real_int64 9004L); (mk_real_int64 9004L); (mk_real_int64 8570L); (mk_real_int64 8570L); ]); +("ln_def", [0; 1; 2; 3; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 72L); (mk_real_int64 72L); (mk_real_int64 72L); (mk_real_int64 72L); (mk_real_int64 72L); (mk_real_int64 7L); (mk_real_int64 551L); (mk_real_int64 504L); (mk_real_int64 139L); (mk_real_int64 551L); (mk_real_int64 551L); (mk_real_int64 551L); ]); +("ln_def_neg", [4; ], [(mk_real_int64 130L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 56574L); (mk_real_int64 56574L); (mk_real_int64 56574L); (mk_real_int64 56574L); (mk_real_int64 57726L); (mk_real_int64 56574L); (mk_real_int64 56574L); (mk_real_int64 53849L); (mk_real_int64 54112L); (mk_real_int64 56197L); (mk_real_int64 53849L); (mk_real_int64 53849L); (mk_real_int64 53849L); ]); +("edge_sym_neg", [3; 5; 8; 18; 19; 21; 22; 25; 28; 35; 38; 41; 44; 47; ], [(mk_real_int64 164L); (mk_real_int64 32L); (mk_real_int64 153L); (mk_real_int64 194L); (mk_real_int64 194L); (mk_real_int64 204L); (mk_real_int64 1208L); (mk_real_int64 201L); (mk_real_int64 1319L); (mk_real_int64 186L); (mk_real_int64 640L); (mk_real_int64 1727L); (mk_real_int64 1864L); (mk_real_int64 640L); ]); +("edge_sym", [9; 12; 13; 16; 31; 37; ], [(mk_real_int64 32L); (mk_real_int64 491L); (mk_real_int64 644L); (mk_real_int64 194L); (mk_real_int64 186L); (mk_real_int64 687L); ]); +("y1_def", [6; 15; 18; 21; 23; 28; 39; 40; 44; 47; 48; 51; ], [(mk_real_int64 106L); (mk_real_int64 327L); (mk_real_int64 376L); (mk_real_int64 167L); (mk_real_int64 433L); (mk_real_int64 108L); (mk_real_int64 23L); (mk_real_int64 752L); (mk_real_int64 613L); (mk_real_int64 1007L); (mk_real_int64 653L); (mk_real_int64 223L); ]); +("y1_def_neg", [7; 8; 10; 13; 16; 20; 26; 27; 34; 37; 38; 41; 42; 43; 46; 49; 50; 53; 56; ], [(mk_real_int64 42L); (mk_real_int64 46L); (mk_real_int64 120L); (mk_real_int64 385L); (mk_real_int64 678L); (mk_real_int64 228L); (mk_real_int64 67L); (mk_real_int64 21L); (mk_real_int64 268L); (mk_real_int64 456L); (mk_real_int64 146L); (mk_real_int64 498L); (mk_real_int64 287L); (mk_real_int64 613L); (mk_real_int64 721L); (mk_real_int64 571L); (mk_real_int64 278L); (mk_real_int64 260L); (mk_real_int64 501L); ]); +("y2_def_neg", [6; 8; 15; 16; 26; 28; 34; 39; 41; 46; 47; 48; 49; 50; 51; 53; ], [(mk_real_int64 32L); (mk_real_int64 46L); (mk_real_int64 156L); (mk_real_int64 678L); (mk_real_int64 67L); (mk_real_int64 33L); (mk_real_int64 268L); (mk_real_int64 7L); (mk_real_int64 498L); (mk_real_int64 355L); (mk_real_int64 306L); (mk_real_int64 199L); (mk_real_int64 571L); (mk_real_int64 278L); (mk_real_int64 706L); (mk_real_int64 260L); ]); +("y2_def", [7; 10; 13; 18; 20; 21; 23; 27; 37; 38; 40; 42; 43; 44; 56; ], [(mk_real_int64 64L); (mk_real_int64 153L); (mk_real_int64 491L); (mk_real_int64 376L); (mk_real_int64 138L); (mk_real_int64 1322L); (mk_real_int64 292L); (mk_real_int64 1191L); (mk_real_int64 460L); (mk_real_int64 226L); (mk_real_int64 1708L); (mk_real_int64 101L); (mk_real_int64 950L); (mk_real_int64 11L); (mk_real_int64 640L); ]); +("y3_def_neg", [6; 8; 15; 16; 26; 28; 34; 39; 41; 46; 47; 48; 49; 50; 51; 53; ], [(mk_real_int64 32L); (mk_real_int64 46L); (mk_real_int64 156L); (mk_real_int64 678L); (mk_real_int64 67L); (mk_real_int64 33L); (mk_real_int64 268L); (mk_real_int64 7L); (mk_real_int64 498L); (mk_real_int64 355L); (mk_real_int64 306L); (mk_real_int64 199L); (mk_real_int64 571L); (mk_real_int64 278L); (mk_real_int64 706L); (mk_real_int64 260L); ]); +("y3_def", [7; 10; 13; 18; 20; 21; 23; 27; 37; 38; 40; 42; 43; 44; 56; ], [(mk_real_int64 64L); (mk_real_int64 153L); (mk_real_int64 491L); (mk_real_int64 376L); (mk_real_int64 138L); (mk_real_int64 1322L); (mk_real_int64 292L); (mk_real_int64 1191L); (mk_real_int64 460L); (mk_real_int64 226L); (mk_real_int64 1708L); (mk_real_int64 101L); (mk_real_int64 950L); (mk_real_int64 11L); (mk_real_int64 640L); ]); +("y4_def", [2; 7; 20; 27; 32; 35; 36; 38; 39; 41; ], [(mk_real_int64 164L); (mk_real_int64 665L); (mk_real_int64 168L); (mk_real_int64 36L); (mk_real_int64 635L); (mk_real_int64 1558L); (mk_real_int64 1010L); (mk_real_int64 595L); (mk_real_int64 762L); (mk_real_int64 557L); ]); +("y4_def_neg", [3; 4; 8; 10; 12; 13; 18; 19; 22; 25; 26; 28; 29; 30; 31; 34; 37; ], [(mk_real_int64 121L); (mk_real_int64 32L); (mk_real_int64 471L); (mk_real_int64 194L); (mk_real_int64 260L); (mk_real_int64 1347L); (mk_real_int64 46L); (mk_real_int64 1240L); (mk_real_int64 186L); (mk_real_int64 866L); (mk_real_int64 426L); (mk_real_int64 1374L); (mk_real_int64 346L); (mk_real_int64 537L); (mk_real_int64 1788L); (mk_real_int64 334L); (mk_real_int64 397L); ]); +("y5_def_neg", [6; 8; 15; 16; 18; 23; 26; 28; 34; 39; 40; 41; 44; 47; 48; 49; 51; ], [(mk_real_int64 32L); (mk_real_int64 32L); (mk_real_int64 20L); (mk_real_int64 471L); (mk_real_int64 194L); (mk_real_int64 201L); (mk_real_int64 46L); (mk_real_int64 33L); (mk_real_int64 186L); (mk_real_int64 7L); (mk_real_int64 334L); (mk_real_int64 346L); (mk_real_int64 219L); (mk_real_int64 306L); (mk_real_int64 199L); (mk_real_int64 397L); (mk_real_int64 557L); ]); +("y5_def", [7; 10; 13; 20; 21; 27; 37; 38; 42; 43; 46; 50; 53; 56; ], [(mk_real_int64 64L); (mk_real_int64 153L); (mk_real_int64 491L); (mk_real_int64 138L); (mk_real_int64 56L); (mk_real_int64 79L); (mk_real_int64 460L); (mk_real_int64 226L); (mk_real_int64 142L); (mk_real_int64 950L); (mk_real_int64 306L); (mk_real_int64 595L); (mk_real_int64 557L); (mk_real_int64 640L); ]); +("y6_def_neg", [8; 16; 18; 26; 28; 34; 39; 40; 41; 44; 47; 48; 49; 51; ], [(mk_real_int64 32L); (mk_real_int64 471L); (mk_real_int64 194L); (mk_real_int64 46L); (mk_real_int64 33L); (mk_real_int64 32L); (mk_real_int64 7L); (mk_real_int64 334L); (mk_real_int64 346L); (mk_real_int64 219L); (mk_real_int64 306L); (mk_real_int64 199L); (mk_real_int64 397L); (mk_real_int64 557L); ]); +("y6_def", [7; 10; 13; 15; 20; 21; 23; 27; 36; 37; 38; 42; 43; 46; 50; 53; 56; ], [(mk_real_int64 64L); (mk_real_int64 153L); (mk_real_int64 491L); (mk_real_int64 471L); (mk_real_int64 138L); (mk_real_int64 56L); (mk_real_int64 204L); (mk_real_int64 79L); (mk_real_int64 152L); (mk_real_int64 460L); (mk_real_int64 226L); (mk_real_int64 142L); (mk_real_int64 950L); (mk_real_int64 306L); (mk_real_int64 595L); (mk_real_int64 557L); (mk_real_int64 640L); ]); +("RHA", [6; 7; 17; 18; 19; 20; 21; 22; 23; 24; 25; 26; 27; 28; 29; 30; 31; 34; 35; 39; 40; 41; 43; 50; 52; 53; 54; ], [(mk_real_int64 183L); (mk_real_int64 183L); (mk_real_int64 990L); (mk_real_int64 990L); (mk_real_int64 556L); (mk_real_int64 2721L); (mk_real_int64 2565L); (mk_real_int64 3143L); (mk_real_int64 463L); (mk_real_int64 855L); (mk_real_int64 855L); (mk_real_int64 1755L); (mk_real_int64 890L); (mk_real_int64 2087L); (mk_real_int64 374L); (mk_real_int64 434L); (mk_real_int64 617L); (mk_real_int64 617L); (mk_real_int64 434L); (mk_real_int64 681L); (mk_real_int64 123L); (mk_real_int64 1115L); (mk_real_int64 434L); (mk_real_int64 42L); (mk_real_int64 42L); (mk_real_int64 374L); (mk_real_int64 374L); ]); +("yy10", [3; ], [(mk_real_int64 164L); ]); +("tau4", [2; ], [(mk_real_int64 1262L); ]); +("ineq105", [4; 7; 14; ], [(mk_real_int64 381L); (mk_real_int64 1221L); (mk_real_int64 1592L); ]); +("ineq106", [12; 13; 19; 25; 28; ], [(mk_real_int64 380L); (mk_real_int64 970L); (mk_real_int64 1258L); (mk_real_int64 434L); (mk_real_int64 992L); ]); +("ineq107", [2; 7; 15; 20; 27; 32; 35; 36; 39; ], [(mk_real_int64 212L); (mk_real_int64 740L); (mk_real_int64 217L); (mk_real_int64 217L); (mk_real_int64 46L); (mk_real_int64 923L); (mk_real_int64 2015L); (mk_real_int64 1306L); (mk_real_int64 1426L); ]); +("ineq108", [3; 13; 25; 26; 30; 31; 34; ], [(mk_real_int64 177L); (mk_real_int64 368L); (mk_real_int64 831L); (mk_real_int64 622L); (mk_real_int64 648L); (mk_real_int64 2610L); (mk_real_int64 610L); ]); +("ineq109", [7; 34; 38; 41; ], [(mk_real_int64 287L); (mk_real_int64 1134L); (mk_real_int64 1842L); (mk_real_int64 1723L); ]); +("ineq110", [10; 13; 15; 19; 28; 32; ], [(mk_real_int64 990L); (mk_real_int64 2198L); (mk_real_int64 855L); (mk_real_int64 1930L); (mk_real_int64 3546L); (mk_real_int64 399L); ]); +("ineq111", [4; 8; 18; 22; 29; 30; 34; 37; 39; ], [(mk_real_int64 257L); (mk_real_int64 3768L); (mk_real_int64 371L); (mk_real_int64 1488L); (mk_real_int64 2766L); (mk_real_int64 747L); (mk_real_int64 2257L); (mk_real_int64 3175L); (mk_real_int64 2720L); ]); +("ineq113", [2; 3; 11; ], [(mk_real_int64 855L); (mk_real_int64 2358L); (mk_real_int64 3697L); ]); +("ineq114", [0; 5; 6; 8; 9; 14; 17; 19; 23; 25; 26; 28; 29; 30; 31; 33; 37; 38; 40; 41; ], [(mk_real_int64 8149L); (mk_real_int64 6390L); (mk_real_int64 4777L); (mk_real_int64 459L); (mk_real_int64 4318L); (mk_real_int64 1789L); (mk_real_int64 8149L); (mk_real_int64 6486L); (mk_real_int64 7083L); (mk_real_int64 5062L); (mk_real_int64 3508L); (mk_real_int64 922L); (mk_real_int64 435L); (mk_real_int64 2829L); (mk_real_int64 204L); (mk_real_int64 6313L); (mk_real_int64 2106L); (mk_real_int64 3289L); (mk_real_int64 3098L); (mk_real_int64 2752L); ]); +("ineq119", [2; 6; 15; ], [(mk_real_int64 2268L); (mk_real_int64 2268L); (mk_real_int64 6951L); ]); +("ineq120", [0; 4; 7; 9; 14; ], [(mk_real_int64 6736L); (mk_real_int64 4779L); (mk_real_int64 1957L); (mk_real_int64 7309L); (mk_real_int64 1620L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 49204L); (mk_real_int64 49204L); (mk_real_int64 49204L); (mk_real_int64 49204L); (mk_real_int64 48596L); (mk_real_int64 49204L); (mk_real_int64 699204L); (mk_real_int64 38854L); (mk_real_int64 47552L); (mk_real_int64 40462L); (mk_real_int64 38854L); (mk_real_int64 38854L); (mk_real_int64 38854L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [0; 4; 6; 7; 9; 10; 13; 14; 16; 17; 19; 20; 21; 25; 30; 38; 39; 40; 41; 48; 49; 56; 57; ], [(mk_real_int64 1728L); (mk_real_int64 2740L); (mk_real_int64 5550L); (mk_real_int64 2780L); (mk_real_int64 1400L); (mk_real_int64 1367L); (mk_real_int64 361L); (mk_real_int64 4020L); (mk_real_int64 3340L); (mk_real_int64 680L); (mk_real_int64 4770L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 2740L); (mk_real_int64 1057L); (mk_real_int64 80L); (mk_real_int64 10000L); (mk_real_int64 1720L); (mk_real_int64 3100L); (mk_real_int64 10000L); (mk_real_int64 3560L); (mk_real_int64 8260L); (mk_real_int64 1970L); ]); +("azim_lo", [2; 12; 22; 27; 35; 37; 42; 43; 45; 50; 52; 53; ], [(mk_real_int64 4040L); (mk_real_int64 4040L); (mk_real_int64 860L); (mk_real_int64 7640L); (mk_real_int64 420L); (mk_real_int64 1880L); (mk_real_int64 460L); (mk_real_int64 2960L); (mk_real_int64 620L); (mk_real_int64 860L); (mk_real_int64 6520L); (mk_real_int64 2480L); ]); +("rhazim_hi", [27; ], [(mk_real_int64 10000L); ]); +("rho_lo", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 672L); (mk_real_int64 672L); (mk_real_int64 672L); (mk_real_int64 672L); (mk_real_int64 22416L); (mk_real_int64 672L); (mk_real_int64 672L); (mk_real_int64 19760L); (mk_real_int64 10816L); (mk_real_int64 592L); (mk_real_int64 19760L); (mk_real_int64 19760L); (mk_real_int64 19760L); ]); +("tau_hi", [2; 5; 9; 10; 17; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("tau_lo", [6; 12; 13; ], [(mk_real_int64 36800000L); (mk_real_int64 37660000L); (mk_real_int64 47900000L); ]); +("y1_lo", [8; 10; 15; 16; 21; 27; 38; 43; 49; 50; 53; 56; ], [(mk_real_int64 2600L); (mk_real_int64 150L); (mk_real_int64 3370L); (mk_real_int64 2400L); (mk_real_int64 2400L); (mk_real_int64 4000L); (mk_real_int64 1700L); (mk_real_int64 3500L); (mk_real_int64 5000L); (mk_real_int64 1420L); (mk_real_int64 1730L); (mk_real_int64 4800L); ]); +("y1_hi", [7; 13; 18; 23; 26; 28; 34; 37; 40; 41; 42; 44; 46; 47; 51; ], [(mk_real_int64 4050L); (mk_real_int64 3850L); (mk_real_int64 2000L); (mk_real_int64 4000L); (mk_real_int64 2200L); (mk_real_int64 5000L); (mk_real_int64 1600L); (mk_real_int64 3150L); (mk_real_int64 2800L); (mk_real_int64 1200L); (mk_real_int64 2600L); (mk_real_int64 1200L); (mk_real_int64 1560L); (mk_real_int64 5000L); (mk_real_int64 4000L); ]); +("y2_hi", [7; 10; 15; 18; 20; 21; 26; 27; 28; 34; 37; 38; 39; 40; 41; 42; 44; 48; ], [(mk_real_int64 4103L); (mk_real_int64 1620L); (mk_real_int64 1830L); (mk_real_int64 2000L); (mk_real_int64 2820L); (mk_real_int64 1382L); (mk_real_int64 2200L); (mk_real_int64 1862L); (mk_real_int64 160L); (mk_real_int64 1600L); (mk_real_int64 3335L); (mk_real_int64 3458L); (mk_real_int64 80L); (mk_real_int64 4688L); (mk_real_int64 1200L); (mk_real_int64 3472L); (mk_real_int64 3240L); (mk_real_int64 4880L); ]); +("y2_lo", [6; 8; 13; 16; 23; 43; 46; 47; 49; 50; 51; 53; 56; ], [(mk_real_int64 2240L); (mk_real_int64 2600L); (mk_real_int64 1580L); (mk_real_int64 2400L); (mk_real_int64 840L); (mk_real_int64 2210L); (mk_real_int64 5150L); (mk_real_int64 2800L); (mk_real_int64 5000L); (mk_real_int64 1420L); (mk_real_int64 3520L); (mk_real_int64 1730L); (mk_real_int64 160L); ]); +("y3_hi", [7; 10; 15; 18; 20; 21; 26; 27; 28; 34; 37; 38; 39; 40; 41; 42; 44; 48; ], [(mk_real_int64 4103L); (mk_real_int64 1620L); (mk_real_int64 1830L); (mk_real_int64 2000L); (mk_real_int64 2820L); (mk_real_int64 1382L); (mk_real_int64 2200L); (mk_real_int64 1862L); (mk_real_int64 160L); (mk_real_int64 1600L); (mk_real_int64 3335L); (mk_real_int64 3458L); (mk_real_int64 80L); (mk_real_int64 4688L); (mk_real_int64 1200L); (mk_real_int64 3472L); (mk_real_int64 3240L); (mk_real_int64 4880L); ]); +("y3_lo", [6; 8; 13; 16; 23; 43; 46; 47; 49; 50; 51; 53; 56; ], [(mk_real_int64 2240L); (mk_real_int64 2600L); (mk_real_int64 1580L); (mk_real_int64 2400L); (mk_real_int64 840L); (mk_real_int64 2210L); (mk_real_int64 5150L); (mk_real_int64 2800L); (mk_real_int64 5000L); (mk_real_int64 1420L); (mk_real_int64 3520L); (mk_real_int64 1730L); (mk_real_int64 160L); ]); +("y4_lo", [2; 3; 4; 7; 10; 12; 13; 18; 19; 20; 25; 26; 27; 28; 30; 35; 36; 41; ], [(mk_real_int64 1240L); (mk_real_int64 2450L); (mk_real_int64 1250L); (mk_real_int64 2216L); (mk_real_int64 400L); (mk_real_int64 3000L); (mk_real_int64 3380L); (mk_real_int64 3750L); (mk_real_int64 100L); (mk_real_int64 2590L); (mk_real_int64 5250L); (mk_real_int64 700L); (mk_real_int64 4420L); (mk_real_int64 5360L); (mk_real_int64 2550L); (mk_real_int64 4050L); (mk_real_int64 4620L); (mk_real_int64 1264L); ]); +("y4_hi", [15; 29; 31; 32; 34; 37; 38; 39; ], [(mk_real_int64 1610L); (mk_real_int64 2500L); (mk_real_int64 1500L); (mk_real_int64 2750L); (mk_real_int64 5338L); (mk_real_int64 1250L); (mk_real_int64 3344L); (mk_real_int64 2980L); ]); +("y5_hi", [7; 10; 15; 20; 21; 23; 27; 28; 37; 38; 39; 41; 42; 44; 46; 48; 49; 50; 51; ], [(mk_real_int64 4103L); (mk_real_int64 1620L); (mk_real_int64 2784L); (mk_real_int64 2820L); (mk_real_int64 902L); (mk_real_int64 4360L); (mk_real_int64 5062L); (mk_real_int64 160L); (mk_real_int64 3335L); (mk_real_int64 3458L); (mk_real_int64 80L); (mk_real_int64 2500L); (mk_real_int64 4322L); (mk_real_int64 5000L); (mk_real_int64 3628L); (mk_real_int64 4880L); (mk_real_int64 1250L); (mk_real_int64 3344L); (mk_real_int64 2480L); ]); +("y5_lo", [6; 8; 13; 18; 26; 40; 43; 47; 53; 56; ], [(mk_real_int64 2240L); (mk_real_int64 1250L); (mk_real_int64 1580L); (mk_real_int64 400L); (mk_real_int64 3750L); (mk_real_int64 272L); (mk_real_int64 2210L); (mk_real_int64 2800L); (mk_real_int64 1264L); (mk_real_int64 160L); ]); +("y6_hi", [7; 10; 15; 20; 21; 23; 27; 28; 37; 38; 39; 41; 42; 44; 46; 48; 49; 50; 51; ], [(mk_real_int64 4103L); (mk_real_int64 1620L); (mk_real_int64 2784L); (mk_real_int64 2820L); (mk_real_int64 902L); (mk_real_int64 4360L); (mk_real_int64 5062L); (mk_real_int64 160L); (mk_real_int64 3335L); (mk_real_int64 3458L); (mk_real_int64 80L); (mk_real_int64 2500L); (mk_real_int64 4322L); (mk_real_int64 5000L); (mk_real_int64 3628L); (mk_real_int64 4880L); (mk_real_int64 1250L); (mk_real_int64 3344L); (mk_real_int64 2480L); ]); +("y6_lo", [6; 8; 13; 15; 18; 23; 26; 34; 36; 40; 43; 47; 53; 56; ], [(mk_real_int64 322240L); (mk_real_int64 1250L); (mk_real_int64 1580L); (mk_real_int64 4910000L); (mk_real_int64 400L); (mk_real_int64 4050000L); (mk_real_int64 3750L); (mk_real_int64 1540000L); (mk_real_int64 1520000L); (mk_real_int64 272L); (mk_real_int64 2210L); (mk_real_int64 2800L); (mk_real_int64 1264L); (mk_real_int64 160L); ]); +("ye_lo", [22; 31; 37; 44; 48; 50; ], [(mk_real_int64 10000L); (mk_real_int64 1860000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("yn_hi", [0; 1; 2; 3; 4; 8; ], [(mk_real_int64 5440L); (mk_real_int64 15440L); (mk_real_int64 5440L); (mk_real_int64 5440L); (mk_real_int64 30L); (mk_real_int64 8080L); ]); +("yn_lo", [5; 6; 7; 9; 10; 11; 12; ], [(mk_real_int64 4560L); (mk_real_int64 14610L); (mk_real_int64 5730L); (mk_real_int64 12970L); (mk_real_int64 15730L); (mk_real_int64 5730L); (mk_real_int64 5730L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/206084941231_out.hl b/formal_lp/old/ineqs/tests2/206084941231_out.hl new file mode 100644 index 0000000..ad34805 --- /dev/null +++ b/formal_lp/old/ineqs/tests2/206084941231_out.hl @@ -0,0 +1,88 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "206084941231 18 4 0 1 2 3 4 0 3 4 5 3 4 3 2 4 4 2 6 7 3 6 2 1 3 6 1 8 3 8 1 0 3 8 0 9 3 9 0 5 3 9 5 10 3 10 5 11 3 11 5 4 3 11 4 7 3 7 6 12 3 12 6 8 4 12 8 9 10 3 12 10 11 3 11 7 12 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [3; 5; 6; 7; 12; ], [(mk_real_int64 238L); (mk_real_int64 247L); (mk_real_int64 419L); (mk_real_int64 116L); (mk_real_int64 298L); ]); +("azim_sum_neg", [0; 8; 9; 10; ], [(mk_real_int64 53L); (mk_real_int64 40L); (mk_real_int64 208L); (mk_real_int64 48L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 916L); (mk_real_int64 914L); (mk_real_int64 914L); (mk_real_int64 1040L); (mk_real_int64 1040L); (mk_real_int64 1040L); (mk_real_int64 914L); (mk_real_int64 954L); (mk_real_int64 954L); (mk_real_int64 914L); (mk_real_int64 948L); (mk_real_int64 914L); (mk_real_int64 914L); ]); +("sol_sum3_neg", [1; 8; 10; 11; ], [(mk_real_int64 24L); (mk_real_int64 92L); (mk_real_int64 58L); (mk_real_int64 156L); ]); +("sol_sum3", [6; 7; 12; ], [(mk_real_int64 60L); (mk_real_int64 156L); (mk_real_int64 2L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 914L); (mk_real_int64 891L); (mk_real_int64 914L); (mk_real_int64 914L); (mk_real_int64 954L); (mk_real_int64 938L); (mk_real_int64 914L); (mk_real_int64 914L); (mk_real_int64 948L); (mk_real_int64 914L); (mk_real_int64 914L); (mk_real_int64 914L); (mk_real_int64 903L); (mk_real_int64 839L); ]); +("tau_sum4_neg", [0; 1; 2; 3; ], [(mk_real_int64 914L); (mk_real_int64 1040L); (mk_real_int64 914L); (mk_real_int64 914L); ]); +("ln_def_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 10L); (mk_real_int64 8L); (mk_real_int64 8L); (mk_real_int64 147L); (mk_real_int64 147L); (mk_real_int64 147L); (mk_real_int64 8L); (mk_real_int64 52L); (mk_real_int64 52L); (mk_real_int64 8L); (mk_real_int64 46L); (mk_real_int64 8L); (mk_real_int64 8L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 5756L); (mk_real_int64 5745L); (mk_real_int64 5745L); (mk_real_int64 6535L); (mk_real_int64 6535L); (mk_real_int64 6535L); (mk_real_int64 5745L); (mk_real_int64 5996L); (mk_real_int64 5996L); (mk_real_int64 5745L); (mk_real_int64 5958L); (mk_real_int64 5745L); (mk_real_int64 5745L); ]); +("edge_sym", [5; 6; 12; 13; 17; 20; 25; 34; 35; 43; 51; 54; ], [(mk_real_int64 12L); (mk_real_int64 12L); (mk_real_int64 40L); (mk_real_int64 40L); (mk_real_int64 84L); (mk_real_int64 34L); (mk_real_int64 2L); (mk_real_int64 61L); (mk_real_int64 13L); (mk_real_int64 44L); (mk_real_int64 13L); (mk_real_int64 70L); ]); +("edge_sym_neg", [19; 23; 26; 29; 31; 38; 41; 44; 47; ], [(mk_real_int64 61L); (mk_real_int64 2L); (mk_real_int64 44L); (mk_real_int64 109L); (mk_real_int64 13L); (mk_real_int64 12L); (mk_real_int64 200L); (mk_real_int64 10L); (mk_real_int64 44L); ]); +("y1_def_neg", [6; 9; 13; 16; 17; 18; 20; 23; 24; 25; 28; 30; 31; 34; 35; 38; 40; 41; 44; 45; 46; 49; 55; 56; ], [(mk_real_int64 10L); (mk_real_int64 32L); (mk_real_int64 31L); (mk_real_int64 13L); (mk_real_int64 18L); (mk_real_int64 21L); (mk_real_int64 99L); (mk_real_int64 71L); (mk_real_int64 42L); (mk_real_int64 52L); (mk_real_int64 117L); (mk_real_int64 9L); (mk_real_int64 205L); (mk_real_int64 24L); (mk_real_int64 43L); (mk_real_int64 44L); (mk_real_int64 88L); (mk_real_int64 109L); (mk_real_int64 7L); (mk_real_int64 29L); (mk_real_int64 84L); (mk_real_int64 34L); (mk_real_int64 26L); (mk_real_int64 45L); ]); +("y1_def", [15; 27; 32; 33; 36; 39; 42; 43; 47; 53; ], [(mk_real_int64 9L); (mk_real_int64 1L); (mk_real_int64 74L); (mk_real_int64 26L); (mk_real_int64 35L); (mk_real_int64 7L); (mk_real_int64 29L); (mk_real_int64 22L); (mk_real_int64 59L); (mk_real_int64 45L); ]); +("y2_def", [6; 13; 15; 17; 18; 25; 36; 38; 40; 43; 44; 45; 47; 49; 56; ], [(mk_real_int64 12L); (mk_real_int64 40L); (mk_real_int64 9L); (mk_real_int64 14L); (mk_real_int64 33L); (mk_real_int64 31L); (mk_real_int64 35L); (mk_real_int64 1L); (mk_real_int64 65L); (mk_real_int64 22L); (mk_real_int64 11L); (mk_real_int64 45L); (mk_real_int64 59L); (mk_real_int64 44L); (mk_real_int64 27L); ]); +("y2_def_neg", [9; 16; 20; 23; 24; 28; 30; 31; 32; 33; 34; 35; 39; 41; 42; 46; 53; 55; ], [(mk_real_int64 65L); (mk_real_int64 13L); (mk_real_int64 17L); (mk_real_int64 10L); (mk_real_int64 42L); (mk_real_int64 19L); (mk_real_int64 9L); (mk_real_int64 84L); (mk_real_int64 22L); (mk_real_int64 8L); (mk_real_int64 24L); (mk_real_int64 43L); (mk_real_int64 2L); (mk_real_int64 109L); (mk_real_int64 9L); (mk_real_int64 84L); (mk_real_int64 14L); (mk_real_int64 26L); ]); +("y3_def", [6; 13; 15; 17; 18; 25; 36; 38; 40; 43; 44; 45; 47; 49; 56; ], [(mk_real_int64 12L); (mk_real_int64 40L); (mk_real_int64 9L); (mk_real_int64 14L); (mk_real_int64 33L); (mk_real_int64 31L); (mk_real_int64 35L); (mk_real_int64 1L); (mk_real_int64 65L); (mk_real_int64 22L); (mk_real_int64 11L); (mk_real_int64 45L); (mk_real_int64 59L); (mk_real_int64 44L); (mk_real_int64 27L); ]); +("y3_def_neg", [9; 16; 20; 23; 24; 28; 30; 31; 32; 33; 34; 35; 39; 41; 42; 46; 53; 55; ], [(mk_real_int64 65L); (mk_real_int64 13L); (mk_real_int64 17L); (mk_real_int64 10L); (mk_real_int64 42L); (mk_real_int64 19L); (mk_real_int64 9L); (mk_real_int64 84L); (mk_real_int64 22L); (mk_real_int64 8L); (mk_real_int64 24L); (mk_real_int64 43L); (mk_real_int64 2L); (mk_real_int64 109L); (mk_real_int64 9L); (mk_real_int64 84L); (mk_real_int64 14L); (mk_real_int64 26L); ]); +("y4_def_neg", [3; 4; 5; 6; 8; 11; 12; 13; 16; 19; 23; 24; 26; 28; 29; 31; 32; 33; 34; 35; 39; 40; ], [(mk_real_int64 5L); (mk_real_int64 9L); (mk_real_int64 26L); (mk_real_int64 62L); (mk_real_int64 117L); (mk_real_int64 66L); (mk_real_int64 29L); (mk_real_int64 59L); (mk_real_int64 109L); (mk_real_int64 176L); (mk_real_int64 30L); (mk_real_int64 18L); (mk_real_int64 43L); (mk_real_int64 122L); (mk_real_int64 75L); (mk_real_int64 11L); (mk_real_int64 20L); (mk_real_int64 85L); (mk_real_int64 58L); (mk_real_int64 31L); (mk_real_int64 18L); (mk_real_int64 52L); ]); +("y4_def", [15; 18; 20; 21; 22; 27; 30; 37; 38; ], [(mk_real_int64 2L); (mk_real_int64 20L); (mk_real_int64 114L); (mk_real_int64 40L); (mk_real_int64 50L); (mk_real_int64 11L); (mk_real_int64 45L); (mk_real_int64 69L); (mk_real_int64 1L); ]); +("y5_def", [6; 13; 17; 18; 20; 25; 30; 34; 38; 40; 44; 45; 49; 54; 56; ], [(mk_real_int64 12L); (mk_real_int64 40L); (mk_real_int64 14L); (mk_real_int64 33L); (mk_real_int64 1L); (mk_real_int64 31L); (mk_real_int64 20L); (mk_real_int64 50L); (mk_real_int64 6L); (mk_real_int64 65L); (mk_real_int64 11L); (mk_real_int64 45L); (mk_real_int64 44L); (mk_real_int64 1L); (mk_real_int64 27L); ]); +("y5_def_neg", [9; 15; 16; 24; 28; 31; 32; 33; 35; 36; 39; 41; 42; 43; 46; 47; 53; 55; ], [(mk_real_int64 48L); (mk_real_int64 5L); (mk_real_int64 9L); (mk_real_int64 29L); (mk_real_int64 2L); (mk_real_int64 44L); (mk_real_int64 22L); (mk_real_int64 8L); (mk_real_int64 30L); (mk_real_int64 18L); (mk_real_int64 2L); (mk_real_int64 75L); (mk_real_int64 9L); (mk_real_int64 11L); (mk_real_int64 58L); (mk_real_int64 31L); (mk_real_int64 14L); (mk_real_int64 18L); ]); +("y6_def", [6; 8; 13; 17; 18; 20; 21; 25; 26; 30; 32; 34; 38; 39; 40; 44; 45; 46; 49; 54; 55; 56; ], [(mk_real_int64 12L); (mk_real_int64 35L); (mk_real_int64 40L); (mk_real_int64 14L); (mk_real_int64 33L); (mk_real_int64 1L); (mk_real_int64 128L); (mk_real_int64 31L); (mk_real_int64 44L); (mk_real_int64 40L); (mk_real_int64 157L); (mk_real_int64 50L); (mk_real_int64 6L); (mk_real_int64 23L); (mk_real_int64 65L); (mk_real_int64 11L); (mk_real_int64 45L); (mk_real_int64 81L); (mk_real_int64 44L); (mk_real_int64 1L); (mk_real_int64 172L); (mk_real_int64 27L); ]); +("y6_def_neg", [15; 16; 24; 28; 31; 33; 35; 36; 41; 42; 43; 47; 53; ], [(mk_real_int64 5L); (mk_real_int64 9L); (mk_real_int64 29L); (mk_real_int64 2L); (mk_real_int64 44L); (mk_real_int64 8L); (mk_real_int64 30L); (mk_real_int64 18L); (mk_real_int64 75L); (mk_real_int64 9L); (mk_real_int64 11L); (mk_real_int64 31L); (mk_real_int64 14L); ]); +("RHA", [0; 3; 8; 9; 11; 15; 16; 21; 23; 27; 29; 30; 34; 35; 37; 38; 39; 47; 49; 50; 52; 53; 54; 55; 57; ], [(mk_real_int64 126L); (mk_real_int64 2L); (mk_real_int64 126L); (mk_real_int64 2L); (mk_real_int64 126L); (mk_real_int64 24L); (mk_real_int64 24L); (mk_real_int64 40L); (mk_real_int64 63L); (mk_real_int64 16L); (mk_real_int64 102L); (mk_real_int64 40L); (mk_real_int64 126L); (mk_real_int64 34L); (mk_real_int64 92L); (mk_real_int64 45L); (mk_real_int64 34L); (mk_real_int64 40L); (mk_real_int64 40L); (mk_real_int64 40L); (mk_real_int64 11L); (mk_real_int64 11L); (mk_real_int64 45L); (mk_real_int64 110L); (mk_real_int64 76L); ]); +("RHB", [5; ], [(mk_real_int64 124L); ]); +("yy10", [23; ], [(mk_real_int64 2L); ]); +("tau4", [0; ], [(mk_real_int64 320L); ]); +("ineq105", [6; 10; 13; ], [(mk_real_int64 31L); (mk_real_int64 100L); (mk_real_int64 109L); ]); +("ineq106", [5; 8; 11; 13; 16; 19; 26; 28; 40; ], [(mk_real_int64 24L); (mk_real_int64 40L); (mk_real_int64 63L); (mk_real_int64 86L); (mk_real_int64 102L); (mk_real_int64 126L); (mk_real_int64 46L); (mk_real_int64 126L); (mk_real_int64 76L); ]); +("ineq107", [1; 15; 20; 21; 27; 30; 37; ], [(mk_real_int64 52L); (mk_real_int64 2L); (mk_real_int64 147L); (mk_real_int64 52L); (mk_real_int64 14L); (mk_real_int64 58L); (mk_real_int64 89L); ]); +("ineq108", [5; 6; 8; 28; 32; 33; ], [(mk_real_int64 14L); (mk_real_int64 91L); (mk_real_int64 72L); (mk_real_int64 52L); (mk_real_int64 29L); (mk_real_int64 124L); ]); +("ineq109", [18; 22; 38; ], [(mk_real_int64 60L); (mk_real_int64 156L); (mk_real_int64 2L); ]); +("ineq110", [3; 24; 31; 35; ], [(mk_real_int64 24L); (mk_real_int64 92L); (mk_real_int64 58L); (mk_real_int64 156L); ]); +("ineq111", [1; 4; 8; 11; 12; 16; 19; 23; 26; 29; 34; 39; ], [(mk_real_int64 319L); (mk_real_int64 74L); (mk_real_int64 320L); (mk_real_int64 184L); (mk_real_int64 233L); (mk_real_int64 312L); (mk_real_int64 721L); (mk_real_int64 237L); (mk_real_int64 89L); (mk_real_int64 603L); (mk_real_int64 466L); (mk_real_int64 144L); ]); +("ineq113", [5; 14; 15; 24; 37; ], [(mk_real_int64 147L); (mk_real_int64 154L); (mk_real_int64 82L); (mk_real_int64 538L); (mk_real_int64 405L); ]); +("ineq114", [0; 3; 6; 8; 9; 11; 12; 13; 16; 17; 18; 19; 22; 23; 26; 28; 31; 32; 33; 34; 36; 39; 41; ], [(mk_real_int64 596L); (mk_real_int64 669L); (mk_real_int64 524L); (mk_real_int64 70L); (mk_real_int64 250L); (mk_real_int64 481L); (mk_real_int64 186L); (mk_real_int64 381L); (mk_real_int64 381L); (mk_real_int64 163L); (mk_real_int64 97L); (mk_real_int64 97L); (mk_real_int64 450L); (mk_real_int64 227L); (mk_real_int64 321L); (mk_real_int64 311L); (mk_real_int64 577L); (mk_real_int64 337L); (mk_real_int64 28L); (mk_real_int64 420L); (mk_real_int64 498L); (mk_real_int64 99L); (mk_real_int64 596L); ]); +("ineq119", [3; 5; 15; ], [(mk_real_int64 114L); (mk_real_int64 439L); (mk_real_int64 459L); ]); +("ineq120", [0; 4; 6; 8; 10; 12; 13; ], [(mk_real_int64 481L); (mk_real_int64 315L); (mk_real_int64 286L); (mk_real_int64 492L); (mk_real_int64 422L); (mk_real_int64 393L); (mk_real_int64 62L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 2700L); (mk_real_int64 2625L); (mk_real_int64 2625L); (mk_real_int64 3375L); (mk_real_int64 3375L); (mk_real_int64 3375L); (mk_real_int64 2625L); (mk_real_int64 2700L); (mk_real_int64 2700L); (mk_real_int64 2625L); (mk_real_int64 3350L); (mk_real_int64 2625L); (mk_real_int64 2625L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [0; 4; 6; 8; 13; 18; 21; 23; 24; 25; 26; 27; 28; 29; 30; 31; 32; 35; 36; 38; 43; 51; 52; 53; 54; ], [(mk_real_int64 598L); (mk_real_int64 770L); (mk_real_int64 788L); (mk_real_int64 96L); (mk_real_int64 876L); (mk_real_int64 24L); (mk_real_int64 500L); (mk_real_int64 106L); (mk_real_int64 436L); (mk_real_int64 506L); (mk_real_int64 114L); (mk_real_int64 762L); (mk_real_int64 506L); (mk_real_int64 38L); (mk_real_int64 722L); (mk_real_int64 722L); (mk_real_int64 1000L); (mk_real_int64 102L); (mk_real_int64 658L); (mk_real_int64 946L); (mk_real_int64 202L); (mk_real_int64 73L); (mk_real_int64 748L); (mk_real_int64 1105L); (mk_real_int64 1000L); ]); +("azim_lo", [3; 5; 9; 11; 15; 17; 20; 34; 40; 44; 45; 46; 48; 49; 55; 57; ], [(mk_real_int64 642L); (mk_real_int64 43L); (mk_real_int64 1000L); (mk_real_int64 64L); (mk_real_int64 206L); (mk_real_int64 73L); (mk_real_int64 180L); (mk_real_int64 300L); (mk_real_int64 314L); (mk_real_int64 38L); (mk_real_int64 472L); (mk_real_int64 80L); (mk_real_int64 106L); (mk_real_int64 4L); (mk_real_int64 26L); (mk_real_int64 904L); ]); +("rhazim_hi", [15; 16; 17; 55; 56; 57; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_lo", [38; ], [(mk_real_int64 1000L); ]); +("rho_hi", [0; 3; 4; 5; ], [(mk_real_int64 144L); (mk_real_int64 360L); (mk_real_int64 360L); (mk_real_int64 360L); ]); +("rho_lo", [1; 2; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 1424L); (mk_real_int64 1424L); (mk_real_int64 1424L); (mk_real_int64 1064L); (mk_real_int64 1064L); (mk_real_int64 1424L); (mk_real_int64 768L); (mk_real_int64 1424L); (mk_real_int64 1424L); ]); +("tau_hi", [0; 2; 6; 9; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("tau_lo", [4; ], [(mk_real_int64 1000L); ]); +("y1_hi", [6; 9; 15; 17; 20; 23; 24; 25; 34; 35; 38; 40; 41; 43; 44; 46; 47; 55; ], [(mk_real_int64 235L); (mk_real_int64 580L); (mk_real_int64 120L); (mk_real_int64 310L); (mk_real_int64 480L); (mk_real_int64 80L); (mk_real_int64 60L); (mk_real_int64 400L); (mk_real_int64 444L); (mk_real_int64 340L); (mk_real_int64 380L); (mk_real_int64 180L); (mk_real_int64 460L); (mk_real_int64 40L); (mk_real_int64 185L); (mk_real_int64 120L); (mk_real_int64 280L); (mk_real_int64 80L); ]); +("y1_lo", [13; 16; 18; 28; 30; 31; 32; 36; 45; 49; 53; 54; 56; ], [(mk_real_int64 500L); (mk_real_int64 320L); (mk_real_int64 385L); (mk_real_int64 360L); (mk_real_int64 60L); (mk_real_int64 380L); (mk_real_int64 500L); (mk_real_int64 40L); (mk_real_int64 140L); (mk_real_int64 335L); (mk_real_int64 500L); (mk_real_int64 302L); (mk_real_int64 600L); ]); +("y2_lo", [9; 16; 17; 23; 27; 28; 30; 32; 36; 38; 39; 40; 44; 49; 54; ], [(mk_real_int64 324L); (mk_real_int64 320L); (mk_real_int64 168L); (mk_real_int64 188L); (mk_real_int64 304L); (mk_real_int64 32L); (mk_real_int64 60L); (mk_real_int64 344L); (mk_real_int64 40L); (mk_real_int64 276L); (mk_real_int64 128L); (mk_real_int64 208L); (mk_real_int64 444L); (mk_real_int64 182L); (mk_real_int64 302L); ]); +("y2_hi", [6; 13; 15; 18; 20; 24; 25; 31; 33; 34; 35; 41; 42; 43; 45; 46; 47; 53; 55; 56; ], [(mk_real_int64 462L); (mk_real_int64 200L); (mk_real_int64 120L); (mk_real_int64 124L); (mk_real_int64 168L); (mk_real_int64 60L); (mk_real_int64 304L); (mk_real_int64 84L); (mk_real_int64 96L); (mk_real_int64 444L); (mk_real_int64 340L); (mk_real_int64 460L); (mk_real_int64 184L); (mk_real_int64 40L); (mk_real_int64 136L); (mk_real_int64 120L); (mk_real_int64 280L); (mk_real_int64 472L); (mk_real_int64 80L); (mk_real_int64 664L); ]); +("y3_lo", [9; 16; 17; 23; 27; 28; 30; 32; 36; 38; 39; 40; 44; 49; 54; ], [(mk_real_int64 324L); (mk_real_int64 320L); (mk_real_int64 168L); (mk_real_int64 188L); (mk_real_int64 304L); (mk_real_int64 32L); (mk_real_int64 60L); (mk_real_int64 344L); (mk_real_int64 40L); (mk_real_int64 276L); (mk_real_int64 128L); (mk_real_int64 208L); (mk_real_int64 444L); (mk_real_int64 182L); (mk_real_int64 302L); ]); +("y3_hi", [6; 13; 15; 18; 20; 24; 25; 31; 33; 34; 35; 41; 42; 43; 45; 46; 47; 53; 55; 56; ], [(mk_real_int64 462L); (mk_real_int64 200L); (mk_real_int64 120L); (mk_real_int64 124L); (mk_real_int64 168L); (mk_real_int64 60L); (mk_real_int64 304L); (mk_real_int64 84L); (mk_real_int64 96L); (mk_real_int64 444L); (mk_real_int64 340L); (mk_real_int64 460L); (mk_real_int64 184L); (mk_real_int64 40L); (mk_real_int64 136L); (mk_real_int64 120L); (mk_real_int64 280L); (mk_real_int64 472L); (mk_real_int64 80L); (mk_real_int64 664L); ]); +("y4_lo", [4; 5; 6; 11; 12; 15; 18; 19; 20; 24; 27; 29; 30; 31; 34; 37; 38; 40; ], [(mk_real_int64 250L); (mk_real_int64 30L); (mk_real_int64 335L); (mk_real_int64 155L); (mk_real_int64 125L); (mk_real_int64 454L); (mk_real_int64 560L); (mk_real_int64 435L); (mk_real_int64 369L); (mk_real_int64 32L); (mk_real_int64 178L); (mk_real_int64 375L); (mk_real_int64 166L); (mk_real_int64 368L); (mk_real_int64 250L); (mk_real_int64 203L); (mk_real_int64 352L); (mk_real_int64 60L); ]); +("y4_hi", [1; 3; 8; 13; 16; 21; 22; 23; 26; 28; 32; 33; 35; ], [(mk_real_int64 321L); (mk_real_int64 296L); (mk_real_int64 280L); (mk_real_int64 90L); (mk_real_int64 130L); (mk_real_int64 196L); (mk_real_int64 544L); (mk_real_int64 375L); (mk_real_int64 365L); (mk_real_int64 70L); (mk_real_int64 135L); (mk_real_int64 60L); (mk_real_int64 424L); ]); +("y5_lo", [16; 17; 20; 23; 24; 27; 30; 31; 32; 36; 38; 39; 40; 41; 43; 44; 46; 49; 54; ], [(mk_real_int64 250L); (mk_real_int64 168L); (mk_real_int64 232L); (mk_real_int64 68L); (mk_real_int64 125L); (mk_real_int64 304L); (mk_real_int64 560L); (mk_real_int64 261L); (mk_real_int64 344L); (mk_real_int64 32L); (mk_real_int64 381L); (mk_real_int64 128L); (mk_real_int64 208L); (mk_real_int64 375L); (mk_real_int64 368L); (mk_real_int64 444L); (mk_real_int64 250L); (mk_real_int64 182L); (mk_real_int64 352L); ]); +("y5_hi", [6; 9; 13; 15; 18; 25; 28; 33; 34; 35; 42; 45; 47; 53; 56; ], [(mk_real_int64 462L); (mk_real_int64 221L); (mk_real_int64 200L); (mk_real_int64 296L); (mk_real_int64 124L); (mk_real_int64 304L); (mk_real_int64 128L); (mk_real_int64 96L); (mk_real_int64 544L); (mk_real_int64 375L); (mk_real_int64 184L); (mk_real_int64 136L); (mk_real_int64 424L); (mk_real_int64 472L); (mk_real_int64 664L); ]); +("y6_lo", [8; 9; 16; 17; 20; 21; 23; 24; 26; 27; 30; 31; 32; 36; 38; 39; 40; 41; 43; 44; 46; 49; 54; 55; ], [(mk_real_int64 35000L); (mk_real_int64 48000L); (mk_real_int64 250L); (mk_real_int64 168L); (mk_real_int64 232L); (mk_real_int64 128000L); (mk_real_int64 68L); (mk_real_int64 125L); (mk_real_int64 44000L); (mk_real_int64 304L); (mk_real_int64 20560L); (mk_real_int64 261L); (mk_real_int64 179344L); (mk_real_int64 32L); (mk_real_int64 381L); (mk_real_int64 25128L); (mk_real_int64 208L); (mk_real_int64 375L); (mk_real_int64 368L); (mk_real_int64 444L); (mk_real_int64 140000L); (mk_real_int64 182L); (mk_real_int64 352L); (mk_real_int64 190000L); ]); +("y6_hi", [6; 9; 13; 15; 18; 25; 28; 33; 34; 35; 42; 45; 46; 47; 53; 56; ], [(mk_real_int64 462L); (mk_real_int64 221L); (mk_real_int64 200L); (mk_real_int64 296L); (mk_real_int64 124L); (mk_real_int64 304L); (mk_real_int64 128L); (mk_real_int64 96L); (mk_real_int64 544L); (mk_real_int64 375L); (mk_real_int64 184L); (mk_real_int64 136L); (mk_real_int64 750L); (mk_real_int64 424L); (mk_real_int64 472L); (mk_real_int64 664L); ]); +("ye_lo", [8; 17; 31; 33; 34; 35; 46; 51; 55; 56; ], [(mk_real_int64 1000L); (mk_real_int64 84000L); (mk_real_int64 34000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 13000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_hi", [21; 30; 31; 32; 39; 40; 41; 43; 44; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_hi", [1; 3; 4; 6; 8; 9; 11; ], [(mk_real_int64 392L); (mk_real_int64 828L); (mk_real_int64 828L); (mk_real_int64 392L); (mk_real_int64 48L); (mk_real_int64 392L); (mk_real_int64 392L); ]); +("yn_lo", [0; 2; 5; 7; 10; 12; ], [(mk_real_int64 760L); (mk_real_int64 608L); (mk_real_int64 172L); (mk_real_int64 952L); (mk_real_int64 496L); (mk_real_int64 1608L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/211626865969_out.hl b/formal_lp/old/ineqs/tests2/211626865969_out.hl new file mode 100644 index 0000000..cb77f0b --- /dev/null +++ b/formal_lp/old/ineqs/tests2/211626865969_out.hl @@ -0,0 +1,90 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "211626865969 19 4 0 1 2 3 4 0 3 4 5 3 4 3 6 3 6 3 2 3 6 2 7 3 7 2 1 3 7 1 8 3 8 1 9 3 9 1 0 3 9 0 10 3 10 0 5 4 9 10 5 11 3 11 5 4 3 11 4 12 3 12 4 6 3 12 6 7 3 12 7 8 3 11 12 8 3 8 9 11 ";; +let precision = 4;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [2; 3; 6; ], [(mk_real_int64 1891L); (mk_real_int64 319L); (mk_real_int64 2854L); ]); +("azim_sum_neg", [1; 4; 5; 7; 8; 9; 10; 12; ], [(mk_real_int64 3198L); (mk_real_int64 3393L); (mk_real_int64 1554L); (mk_real_int64 1828L); (mk_real_int64 2751L); (mk_real_int64 704L); (mk_real_int64 394L); (mk_real_int64 293L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 9935L); (mk_real_int64 9935L); (mk_real_int64 9935L); (mk_real_int64 9935L); (mk_real_int64 7489L); (mk_real_int64 9043L); (mk_real_int64 9935L); (mk_real_int64 10537L); (mk_real_int64 9935L); (mk_real_int64 9365L); (mk_real_int64 8232L); (mk_real_int64 9320L); (mk_real_int64 8433L); ]); +("sol_sum3_neg", [0; 10; 11; 15; ], [(mk_real_int64 1356L); (mk_real_int64 713L); (mk_real_int64 707L); (mk_real_int64 5090L); ]); +("sol_sum3", [1; 2; 9; 12; 13; 14; ], [(mk_real_int64 1227L); (mk_real_int64 2993L); (mk_real_int64 293L); (mk_real_int64 101L); (mk_real_int64 355L); (mk_real_int64 293L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; ], [(mk_real_int64 8579L); (mk_real_int64 9935L); (mk_real_int64 9935L); (mk_real_int64 7273L); (mk_real_int64 7273L); (mk_real_int64 7838L); (mk_real_int64 9320L); (mk_real_int64 7489L); (mk_real_int64 7489L); (mk_real_int64 8433L); (mk_real_int64 7427L); (mk_real_int64 7954L); (mk_real_int64 7285L); (mk_real_int64 7540L); (mk_real_int64 7091L); (mk_real_int64 3050L); ]); +("tau_sum4_neg", [0; 1; 2; ], [(mk_real_int64 9935L); (mk_real_int64 9935L); (mk_real_int64 7489L); ]); +("ln_def_neg", [0; 1; 2; 3; 6; 7; 8; 9; 11; ], [(mk_real_int64 954L); (mk_real_int64 954L); (mk_real_int64 954L); (mk_real_int64 954L); (mk_real_int64 954L); (mk_real_int64 1617L); (mk_real_int64 954L); (mk_real_int64 326L); (mk_real_int64 276L); ]); +("ln_def", [4; 5; 10; 12; ], [(mk_real_int64 1743L); (mk_real_int64 30L); (mk_real_int64 924L); (mk_real_int64 702L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 62425L); (mk_real_int64 62425L); (mk_real_int64 62425L); (mk_real_int64 62425L); (mk_real_int64 47055L); (mk_real_int64 56818L); (mk_real_int64 62425L); (mk_real_int64 66203L); (mk_real_int64 62425L); (mk_real_int64 58842L); (mk_real_int64 51723L); (mk_real_int64 58560L); (mk_real_int64 52986L); ]); +("edge_sym", [0; 1; 6; 15; 16; 19; 21; 22; 24; 25; 37; 38; 41; 43; 44; 53; 56; ], [(mk_real_int64 13L); (mk_real_int64 13L); (mk_real_int64 106L); (mk_real_int64 95L); (mk_real_int64 285L); (mk_real_int64 401L); (mk_real_int64 1198L); (mk_real_int64 192L); (mk_real_int64 356L); (mk_real_int64 356L); (mk_real_int64 262L); (mk_real_int64 998L); (mk_real_int64 496L); (mk_real_int64 50L); (mk_real_int64 50L); (mk_real_int64 278L); (mk_real_int64 998L); ]); +("edge_sym_neg", [7; 9; 13; 28; 30; 31; 47; 50; ], [(mk_real_int64 1457L); (mk_real_int64 1124L); (mk_real_int64 1985L); (mk_real_int64 2642L); (mk_real_int64 497L); (mk_real_int64 736L); (mk_real_int64 1859L); (mk_real_int64 278L); ]); +("y1_def_neg", [1; 8; 12; 13; 15; 16; 22; 24; 25; 27; 28; 30; 35; 38; 39; 41; 44; 46; 47; 48; 49; 50; 51; 54; 55; 56; ], [(mk_real_int64 10L); (mk_real_int64 643L); (mk_real_int64 288L); (mk_real_int64 988L); (mk_real_int64 1109L); (mk_real_int64 452L); (mk_real_int64 339L); (mk_real_int64 264L); (mk_real_int64 889L); (mk_real_int64 814L); (mk_real_int64 1699L); (mk_real_int64 137L); (mk_real_int64 577L); (mk_real_int64 205L); (mk_real_int64 224L); (mk_real_int64 134L); (mk_real_int64 312L); (mk_real_int64 1064L); (mk_real_int64 497L); (mk_real_int64 4L); (mk_real_int64 15L); (mk_real_int64 451L); (mk_real_int64 323L); (mk_real_int64 805L); (mk_real_int64 547L); (mk_real_int64 131L); ]); +("y1_def", [10; 17; 18; 20; 31; 32; 40; 42; 57; ], [(mk_real_int64 336L); (mk_real_int64 44L); (mk_real_int64 268L); (mk_real_int64 44L); (mk_real_int64 1604L); (mk_real_int64 928L); (mk_real_int64 325L); (mk_real_int64 271L); (mk_real_int64 1934L); ]); +("y2_def", [1; 8; 10; 12; 22; 25; 27; 30; 35; 38; 41; 42; 44; 46; 48; 51; 54; 56; 57; ], [(mk_real_int64 13L); (mk_real_int64 390L); (mk_real_int64 336L); (mk_real_int64 447L); (mk_real_int64 206L); (mk_real_int64 539L); (mk_real_int64 912L); (mk_real_int64 83L); (mk_real_int64 736L); (mk_real_int64 262L); (mk_real_int64 10L); (mk_real_int64 271L); (mk_real_int64 190L); (mk_real_int64 645L); (mk_real_int64 2L); (mk_real_int64 109L); (mk_real_int64 488L); (mk_real_int64 90L); (mk_real_int64 1934L); ]); +("y2_def_neg", [13; 15; 16; 17; 18; 20; 24; 28; 31; 32; 39; 40; 47; 49; 50; 55; ], [(mk_real_int64 2273L); (mk_real_int64 1242L); (mk_real_int64 452L); (mk_real_int64 14L); (mk_real_int64 81L); (mk_real_int64 14L); (mk_real_int64 264L); (mk_real_int64 1384L); (mk_real_int64 608L); (mk_real_int64 316L); (mk_real_int64 224L); (mk_real_int64 99L); (mk_real_int64 469L); (mk_real_int64 15L); (mk_real_int64 451L); (mk_real_int64 547L); ]); +("y3_def", [1; 8; 10; 12; 22; 25; 27; 30; 35; 38; 41; 42; 44; 46; 48; 51; 54; 56; 57; ], [(mk_real_int64 13L); (mk_real_int64 390L); (mk_real_int64 336L); (mk_real_int64 447L); (mk_real_int64 206L); (mk_real_int64 539L); (mk_real_int64 912L); (mk_real_int64 83L); (mk_real_int64 736L); (mk_real_int64 262L); (mk_real_int64 10L); (mk_real_int64 271L); (mk_real_int64 190L); (mk_real_int64 645L); (mk_real_int64 2L); (mk_real_int64 109L); (mk_real_int64 488L); (mk_real_int64 90L); (mk_real_int64 1934L); ]); +("y3_def_neg", [13; 15; 16; 17; 18; 20; 24; 28; 31; 32; 39; 40; 47; 49; 50; 55; ], [(mk_real_int64 2273L); (mk_real_int64 1242L); (mk_real_int64 452L); (mk_real_int64 14L); (mk_real_int64 81L); (mk_real_int64 14L); (mk_real_int64 264L); (mk_real_int64 1384L); (mk_real_int64 608L); (mk_real_int64 316L); (mk_real_int64 224L); (mk_real_int64 99L); (mk_real_int64 469L); (mk_real_int64 15L); (mk_real_int64 451L); (mk_real_int64 547L); ]); +("y4_def_neg", [0; 2; 4; 7; 14; 16; 17; 19; 20; 22; 27; 29; 30; 32; 34; 35; 36; 38; 39; 42; 43; 44; 45; ], [(mk_real_int64 734L); (mk_real_int64 390L); (mk_real_int64 841L); (mk_real_int64 683L); (mk_real_int64 387L); (mk_real_int64 183L); (mk_real_int64 1015L); (mk_real_int64 1717L); (mk_real_int64 1268L); (mk_real_int64 156L); (mk_real_int64 155L); (mk_real_int64 7L); (mk_real_int64 140L); (mk_real_int64 357L); (mk_real_int64 1214L); (mk_real_int64 695L); (mk_real_int64 4L); (mk_real_int64 313L); (mk_real_int64 192L); (mk_real_int64 920L); (mk_real_int64 380L); (mk_real_int64 158L); (mk_real_int64 998L); ]); +("y4_def", [5; 8; 9; 10; 12; 23; 24; 28; 37; ], [(mk_real_int64 678L); (mk_real_int64 967L); (mk_real_int64 69L); (mk_real_int64 414L); (mk_real_int64 69L); (mk_real_int64 2558L); (mk_real_int64 1457L); (mk_real_int64 503L); (mk_real_int64 33L); ]); +("y5_def", [1; 8; 12; 16; 22; 25; 27; 30; 35; 38; 41; 44; 46; 48; 49; 51; 54; 56; ], [(mk_real_int64 13L); (mk_real_int64 390L); (mk_real_int64 447L); (mk_real_int64 967L); (mk_real_int64 206L); (mk_real_int64 539L); (mk_real_int64 912L); (mk_real_int64 83L); (mk_real_int64 736L); (mk_real_int64 262L); (mk_real_int64 149L); (mk_real_int64 190L); (mk_real_int64 645L); (mk_real_int64 2L); (mk_real_int64 33L); (mk_real_int64 278L); (mk_real_int64 488L); (mk_real_int64 229L); ]); +("y5_def_neg", [4; 10; 13; 15; 17; 18; 20; 24; 28; 31; 32; 39; 40; 42; 47; 50; 55; 57; ], [(mk_real_int64 1457L); (mk_real_int64 390L); (mk_real_int64 1145L); (mk_real_int64 872L); (mk_real_int64 14L); (mk_real_int64 81L); (mk_real_int64 14L); (mk_real_int64 183L); (mk_real_int64 925L); (mk_real_int64 580L); (mk_real_int64 308L); (mk_real_int64 155L); (mk_real_int64 99L); (mk_real_int64 140L); (mk_real_int64 645L); (mk_real_int64 313L); (mk_real_int64 380L); (mk_real_int64 998L); ]); +("y6_def", [1; 8; 12; 14; 16; 22; 25; 27; 30; 32; 34; 35; 38; 41; 44; 46; 48; 49; 51; 54; 55; 56; ], [(mk_real_int64 13L); (mk_real_int64 390L); (mk_real_int64 1145L); (mk_real_int64 1890L); (mk_real_int64 967L); (mk_real_int64 206L); (mk_real_int64 539L); (mk_real_int64 912L); (mk_real_int64 83L); (mk_real_int64 497L); (mk_real_int64 308L); (mk_real_int64 736L); (mk_real_int64 262L); (mk_real_int64 149L); (mk_real_int64 190L); (mk_real_int64 645L); (mk_real_int64 2140L); (mk_real_int64 33L); (mk_real_int64 278L); (mk_real_int64 488L); (mk_real_int64 413L); (mk_real_int64 229L); ]); +("y6_def_neg", [10; 13; 15; 17; 18; 20; 24; 28; 31; 39; 40; 42; 47; 50; 57; ], [(mk_real_int64 390L); (mk_real_int64 1145L); (mk_real_int64 872L); (mk_real_int64 14L); (mk_real_int64 81L); (mk_real_int64 14L); (mk_real_int64 183L); (mk_real_int64 925L); (mk_real_int64 580L); (mk_real_int64 155L); (mk_real_int64 99L); (mk_real_int64 140L); (mk_real_int64 645L); (mk_real_int64 313L); (mk_real_int64 356L); ]); +("y8_def_neg", [5; ], [(mk_real_int64 1457L); ]); +("RHA", [8; 9; 10; 11; 14; 17; 18; 19; 20; 21; 22; 23; 24; 28; 29; 30; 33; 34; 35; 37; 38; 40; 41; 42; 43; 44; 45; 46; 47; 48; 49; 50; 51; 52; 53; 55; 56; 57; 58; 59; ], [(mk_real_int64 284L); (mk_real_int64 1356L); (mk_real_int64 1957L); (mk_real_int64 601L); (mk_real_int64 601L); (mk_real_int64 2662L); (mk_real_int64 2662L); (mk_real_int64 2662L); (mk_real_int64 2662L); (mk_real_int64 2662L); (mk_real_int64 394L); (mk_real_int64 394L); (mk_real_int64 2097L); (mk_real_int64 288L); (mk_real_int64 1831L); (mk_real_int64 2218L); (mk_real_int64 2446L); (mk_real_int64 1554L); (mk_real_int64 1831L); (mk_real_int64 1554L); (mk_real_int64 944L); (mk_real_int64 610L); (mk_real_int64 1353L); (mk_real_int64 1006L); (mk_real_int64 2508L); (mk_real_int64 1417L); (mk_real_int64 1411L); (mk_real_int64 208L); (mk_real_int64 2582L); (mk_real_int64 2073L); (mk_real_int64 3251L); (mk_real_int64 2650L); (mk_real_int64 1377L); (mk_real_int64 2396L); (mk_real_int64 692L); (mk_real_int64 2274L); (mk_real_int64 1141L); (mk_real_int64 5182L); (mk_real_int64 6270L); (mk_real_int64 5383L); ]); +("RHB", [7; ], [(mk_real_int64 892L); ]); +("ineq105", [1; 8; 11; ], [(mk_real_int64 32L); (mk_real_int64 1831L); (mk_real_int64 651L); ]); +("ineq106", [0; 14; 17; 19; 20; 22; 29; 32; 34; 36; 39; 42; ], [(mk_real_int64 1072L); (mk_real_int64 565L); (mk_real_int64 1482L); (mk_real_int64 615L); (mk_real_int64 327L); (mk_real_int64 228L); (mk_real_int64 149L); (mk_real_int64 521L); (mk_real_int64 1773L); (mk_real_int64 6L); (mk_real_int64 448L); (mk_real_int64 1342L); ]); +("ineq107", [5; 7; 9; 10; 12; 23; 24; 28; ], [(mk_real_int64 1971L); (mk_real_int64 205L); (mk_real_int64 89L); (mk_real_int64 536L); (mk_real_int64 89L); (mk_real_int64 3393L); (mk_real_int64 1908L); (mk_real_int64 651L); ]); +("ineq108", [4; 19; 35; 44; ], [(mk_real_int64 1227L); (mk_real_int64 1891L); (mk_real_int64 47L); (mk_real_int64 369L); ]); +("ineq109", [5; 8; 29; 37; 39; 44; ], [(mk_real_int64 1227L); (mk_real_int64 2993L); (mk_real_int64 293L); (mk_real_int64 101L); (mk_real_int64 355L); (mk_real_int64 293L); ]); +("ineq110", [2; 30; 35; 45; ], [(mk_real_int64 1356L); (mk_real_int64 713L); (mk_real_int64 707L); (mk_real_int64 5090L); ]); +("ineq111", [2; 5; 7; 16; 20; 23; 24; 27; 35; 38; 43; ], [(mk_real_int64 995L); (mk_real_int64 9935L); (mk_real_int64 6729L); (mk_real_int64 1468L); (mk_real_int64 8350L); (mk_real_int64 512L); (mk_real_int64 144L); (mk_real_int64 1244L); (mk_real_int64 4191L); (mk_real_int64 2503L); (mk_real_int64 3041L); ]); +("ineq112", [24; ], [(mk_real_int64 2928L); ]); +("ineq113", [2; 45; ], [(mk_real_int64 4738L); (mk_real_int64 1165L); ]); +("ineq114", [0; 6; 8; 11; 13; 16; 20; 21; 22; 25; 29; 31; 34; 36; 37; 39; 41; 43; 44; 46; ], [(mk_real_int64 2846L); (mk_real_int64 2820L); (mk_real_int64 386L); (mk_real_int64 7273L); (mk_real_int64 7273L); (mk_real_int64 6371L); (mk_real_int64 970L); (mk_real_int64 2925L); (mk_real_int64 4052L); (mk_real_int64 4417L); (mk_real_int64 7189L); (mk_real_int64 7427L); (mk_real_int64 3763L); (mk_real_int64 2348L); (mk_real_int64 2434L); (mk_real_int64 1642L); (mk_real_int64 1045L); (mk_real_int64 2976L); (mk_real_int64 1073L); (mk_real_int64 1885L); ]); +("ineq119", [2; 7; 9; ], [(mk_real_int64 7059L); (mk_real_int64 5746L); (mk_real_int64 7489L); ]); +("ineq120", [0; 1; 4; 6; ], [(mk_real_int64 421L); (mk_real_int64 2455L); (mk_real_int64 421L); (mk_real_int64 3768L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 46550L); (mk_real_int64 46550L); (mk_real_int64 46550L); (mk_real_int64 46550L); (mk_real_int64 35530L); (mk_real_int64 41228L); (mk_real_int64 46550L); (mk_real_int64 49938L); (mk_real_int64 46550L); (mk_real_int64 51132L); (mk_real_int64 37858L); (mk_real_int64 45760L); (mk_real_int64 42556L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_lo", [0; 4; 6; 7; 8; 10; 14; 16; 19; 21; 30; 48; 49; 51; 55; ], [(mk_real_int64 1767L); (mk_real_int64 1767L); (mk_real_int64 4936L); (mk_real_int64 3920L); (mk_real_int64 4040L); (mk_real_int64 1420L); (mk_real_int64 6800L); (mk_real_int64 3640L); (mk_real_int64 1020L); (mk_real_int64 1020L); (mk_real_int64 4480L); (mk_real_int64 1520L); (mk_real_int64 3160L); (mk_real_int64 1080L); (mk_real_int64 240L); ]); +("azim_hi", [1; 2; 24; 28; 29; 32; 33; 36; 41; 43; 46; 53; 56; 57; 58; ], [(mk_real_int64 1715L); (mk_real_int64 2730L); (mk_real_int64 2460L); (mk_real_int64 2200L); (mk_real_int64 500L); (mk_real_int64 5040L); (mk_real_int64 420L); (mk_real_int64 4830L); (mk_real_int64 3140L); (mk_real_int64 3020L); (mk_real_int64 6380L); (mk_real_int64 11700L); (mk_real_int64 6980L); (mk_real_int64 2650L); (mk_real_int64 100L); ]); +("rhazim_lo", [10; 11; 14; 47; 48; 49; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("rhazim_hi", [52; ], [(mk_real_int64 10000L); ]); +("rho_lo", [0; 1; 2; 3; 4; 6; 8; 11; ], [(mk_real_int64 14080L); (mk_real_int64 14080L); (mk_real_int64 14080L); (mk_real_int64 14080L); (mk_real_int64 1152L); (mk_real_int64 14080L); (mk_real_int64 14080L); (mk_real_int64 5760L); ]); +("rho_hi", [5; 7; 9; 10; 12; ], [(mk_real_int64 9776L); (mk_real_int64 30784L); (mk_real_int64 1680L); (mk_real_int64 3024L); (mk_real_int64 2256L); ]); +("tau_lo", [16; 17; ], [(mk_real_int64 48530000L); (mk_real_int64 10000L); ]); +("tau_hi", [7; ], [(mk_real_int64 10000L); ]); +("y1_lo", [1; 8; 12; 13; 24; 25; 28; 38; 42; 44; 49; 54; 55; ], [(mk_real_int64 800L); (mk_real_int64 2000L); (mk_real_int64 3450L); (mk_real_int64 770L); (mk_real_int64 2400L); (mk_real_int64 2000L); (mk_real_int64 2000L); (mk_real_int64 650L); (mk_real_int64 600L); (mk_real_int64 6000L); (mk_real_int64 2510L); (mk_real_int64 2000L); (mk_real_int64 3800L); ]); +("y1_hi", [10; 15; 16; 17; 20; 27; 30; 31; 32; 35; 39; 40; 41; 46; 47; 48; 50; 51; 56; 57; ], [(mk_real_int64 1800L); (mk_real_int64 2800L); (mk_real_int64 570L); (mk_real_int64 5000L); (mk_real_int64 5000L); (mk_real_int64 6150L); (mk_real_int64 2000L); (mk_real_int64 3400L); (mk_real_int64 800L); (mk_real_int64 2350L); (mk_real_int64 800L); (mk_real_int64 5000L); (mk_real_int64 3570L); (mk_real_int64 2000L); (mk_real_int64 2350L); (mk_real_int64 4000L); (mk_real_int64 4600L); (mk_real_int64 5950L); (mk_real_int64 420L); (mk_real_int64 2000L); ]); +("y2_lo", [1; 12; 13; 15; 18; 22; 24; 27; 28; 30; 38; 41; 42; 44; 49; 55; ], [(mk_real_int64 1360L); (mk_real_int64 4947L); (mk_real_int64 1690L); (mk_real_int64 3800L); (mk_real_int64 4720L); (mk_real_int64 3965L); (mk_real_int64 2400L); (mk_real_int64 666L); (mk_real_int64 47L); (mk_real_int64 308L); (mk_real_int64 2980L); (mk_real_int64 219L); (mk_real_int64 600L); (mk_real_int64 4081L); (mk_real_int64 2510L); (mk_real_int64 3800L); ]); +("y2_hi", [8; 10; 16; 17; 20; 25; 31; 32; 35; 39; 40; 46; 47; 48; 50; 51; 54; 56; 57; ], [(mk_real_int64 1008L); (mk_real_int64 1800L); (mk_real_int64 570L); (mk_real_int64 4720L); (mk_real_int64 4720L); (mk_real_int64 2998L); (mk_real_int64 1040L); (mk_real_int64 640L); (mk_real_int64 620L); (mk_real_int64 800L); (mk_real_int64 480L); (mk_real_int64 1947L); (mk_real_int64 3833L); (mk_real_int64 1834L); (mk_real_int64 4600L); (mk_real_int64 4222L); (mk_real_int64 3538L); (mk_real_int64 361L); (mk_real_int64 2000L); ]); +("y3_lo", [1; 12; 13; 15; 18; 22; 24; 27; 28; 30; 38; 41; 42; 44; 49; 55; ], [(mk_real_int64 1360L); (mk_real_int64 4947L); (mk_real_int64 1690L); (mk_real_int64 3800L); (mk_real_int64 4720L); (mk_real_int64 3965L); (mk_real_int64 2400L); (mk_real_int64 666L); (mk_real_int64 47L); (mk_real_int64 308L); (mk_real_int64 2980L); (mk_real_int64 219L); (mk_real_int64 600L); (mk_real_int64 4081L); (mk_real_int64 2510L); (mk_real_int64 3800L); ]); +("y3_hi", [8; 10; 16; 17; 20; 25; 31; 32; 35; 39; 40; 46; 47; 48; 50; 51; 54; 56; 57; ], [(mk_real_int64 1008L); (mk_real_int64 1800L); (mk_real_int64 570L); (mk_real_int64 4720L); (mk_real_int64 4720L); (mk_real_int64 2998L); (mk_real_int64 1040L); (mk_real_int64 640L); (mk_real_int64 620L); (mk_real_int64 800L); (mk_real_int64 480L); (mk_real_int64 1947L); (mk_real_int64 3833L); (mk_real_int64 1834L); (mk_real_int64 4600L); (mk_real_int64 4222L); (mk_real_int64 3538L); (mk_real_int64 361L); (mk_real_int64 2000L); ]); +("y4_hi", [4; 5; 7; 8; 10; 19; 20; 23; 28; 30; 32; 35; 38; 42; 45; ], [(mk_real_int64 5050L); (mk_real_int64 2744L); (mk_real_int64 3400L); (mk_real_int64 3376L); (mk_real_int64 3280L); (mk_real_int64 3900L); (mk_real_int64 2550L); (mk_real_int64 7890L); (mk_real_int64 2230L); (mk_real_int64 2520L); (mk_real_int64 1150L); (mk_real_int64 3580L); (mk_real_int64 1250L); (mk_real_int64 7300L); (mk_real_int64 3600L); ]); +("y4_lo", [0; 2; 9; 12; 14; 16; 17; 22; 24; 27; 29; 34; 36; 37; 39; 43; 44; ], [(mk_real_int64 3200L); (mk_real_int64 1510L); (mk_real_int64 2030L); (mk_real_int64 2030L); (mk_real_int64 250L); (mk_real_int64 5000L); (mk_real_int64 1700L); (mk_real_int64 1800L); (mk_real_int64 1160L); (mk_real_int64 5000L); (mk_real_int64 3674L); (mk_real_int64 5050L); (mk_real_int64 1100L); (mk_real_int64 3568L); (mk_real_int64 1440L); (mk_real_int64 1250L); (mk_real_int64 674L); ]); +("y5_hi", [8; 13; 16; 17; 20; 25; 28; 31; 35; 40; 42; 46; 48; 50; 54; 57; ], [(mk_real_int64 1008L); (mk_real_int64 994L); (mk_real_int64 3376L); (mk_real_int64 4720L); (mk_real_int64 4720L); (mk_real_int64 2998L); (mk_real_int64 2453L); (mk_real_int64 2640L); (mk_real_int64 620L); (mk_real_int64 480L); (mk_real_int64 2520L); (mk_real_int64 1947L); (mk_real_int64 1834L); (mk_real_int64 1250L); (mk_real_int64 3538L); (mk_real_int64 3600L); ]); +("y5_lo", [1; 10; 12; 15; 18; 22; 24; 27; 30; 32; 38; 39; 41; 44; 47; 49; 51; 55; 56; ], [(mk_real_int64 1360L); (mk_real_int64 1510L); (mk_real_int64 4947L); (mk_real_int64 2850L); (mk_real_int64 4720L); (mk_real_int64 3965L); (mk_real_int64 5000L); (mk_real_int64 666L); (mk_real_int64 308L); (mk_real_int64 160L); (mk_real_int64 2980L); (mk_real_int64 5000L); (mk_real_int64 813L); (mk_real_int64 4081L); (mk_real_int64 3437L); (mk_real_int64 3568L); (mk_real_int64 2368L); (mk_real_int64 1250L); (mk_real_int64 233L); ]); +("y6_hi", [8; 13; 16; 17; 20; 25; 28; 31; 35; 40; 42; 46; 50; 54; 57; ], [(mk_real_int64 1008L); (mk_real_int64 994L); (mk_real_int64 3376L); (mk_real_int64 4720L); (mk_real_int64 4720L); (mk_real_int64 2998L); (mk_real_int64 2453L); (mk_real_int64 2640L); (mk_real_int64 620L); (mk_real_int64 480L); (mk_real_int64 2520L); (mk_real_int64 1947L); (mk_real_int64 1250L); (mk_real_int64 3538L); (mk_real_int64 3600L); ]); +("y6_lo", [1; 10; 12; 14; 15; 18; 22; 24; 27; 30; 32; 34; 38; 39; 41; 44; 47; 48; 49; 51; 55; 56; 57; ], [(mk_real_int64 1360L); (mk_real_int64 1510L); (mk_real_int64 6984947L); (mk_real_int64 18900000L); (mk_real_int64 2850L); (mk_real_int64 4720L); (mk_real_int64 3965L); (mk_real_int64 5000L); (mk_real_int64 666L); (mk_real_int64 308L); (mk_real_int64 8050160L); (mk_real_int64 3080000L); (mk_real_int64 2980L); (mk_real_int64 5000L); (mk_real_int64 813L); (mk_real_int64 4081L); (mk_real_int64 3437L); (mk_real_int64 21378166L); (mk_real_int64 3568L); (mk_real_int64 2368L); (mk_real_int64 7931250L); (mk_real_int64 233L); (mk_real_int64 6420000L); ]); +("y8_hi", [5; ], [(mk_real_int64 14570000L); ]); +("ye_hi", [11; 18; 21; 39; 40; 41; 48; 49; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("ye_lo", [6; 13; 16; 19; 21; 29; 42; 56; ], [(mk_real_int64 1060000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 9240000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 6610000L); ]); +("yn_lo", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; ], [(mk_real_int64 3626L); (mk_real_int64 3626L); (mk_real_int64 13626L); (mk_real_int64 3626L); (mk_real_int64 7890L); (mk_real_int64 6900L); (mk_real_int64 13626L); (mk_real_int64 3473L); (mk_real_int64 13626L); (mk_real_int64 694L); (mk_real_int64 18520L); (mk_real_int64 2244L); ]); +("yn_hi", [12; ], [(mk_real_int64 10540L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/219955817888_out.hl b/formal_lp/old/ineqs/tests2/219955817888_out.hl new file mode 100644 index 0000000..2ba23eb --- /dev/null +++ b/formal_lp/old/ineqs/tests2/219955817888_out.hl @@ -0,0 +1,86 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "219955817888 20 4 0 1 2 3 4 0 3 4 5 3 4 3 6 3 6 3 2 3 6 2 7 3 7 2 1 4 7 1 8 9 3 8 1 0 3 8 0 10 3 10 0 5 3 10 5 11 3 11 5 4 3 11 4 12 3 12 4 6 4 12 6 7 9 3 9 8 13 3 13 8 10 3 13 10 11 3 13 11 12 3 12 9 13 ";; +let precision = 4;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [3; 5; 6; 8; 9; 11; ], [(mk_real_int64 5039L); (mk_real_int64 1787L); (mk_real_int64 1787L); (mk_real_int64 1319L); (mk_real_int64 347L); (mk_real_int64 4720L); ]); +("azim_sum_neg", [1; 4; 7; 10; 13; ], [(mk_real_int64 1520L); (mk_real_int64 896L); (mk_real_int64 8L); (mk_real_int64 971L); (mk_real_int64 448L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 10011L); (mk_real_int64 10011L); (mk_real_int64 10011L); (mk_real_int64 10011L); (mk_real_int64 10011L); (mk_real_int64 10011L); (mk_real_int64 10011L); (mk_real_int64 10019L); (mk_real_int64 10011L); (mk_real_int64 10011L); (mk_real_int64 9921L); (mk_real_int64 10011L); (mk_real_int64 10011L); (mk_real_int64 10011L); ]); +("sol_sum3", [2; 7; 8; 13; ], [(mk_real_int64 979L); (mk_real_int64 896L); (mk_real_int64 896L); (mk_real_int64 448L); ]); +("sol_sum3_neg", [4; 5; 6; 9; 10; ], [(mk_real_int64 31L); (mk_real_int64 347L); (mk_real_int64 237L); (mk_real_int64 193L); (mk_real_int64 2548L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; ], [(mk_real_int64 10011L); (mk_real_int64 10011L); (mk_real_int64 9548L); (mk_real_int64 10011L); (mk_real_int64 10011L); (mk_real_int64 10011L); (mk_real_int64 10011L); (mk_real_int64 9921L); (mk_real_int64 9921L); (mk_real_int64 9921L); (mk_real_int64 9249L); (mk_real_int64 10011L); (mk_real_int64 9562L); (mk_real_int64 9480L); (mk_real_int64 9261L); (mk_real_int64 9562L); ]); +("tau_sum4_neg", [0; 1; 2; 3; ], [(mk_real_int64 10011L); (mk_real_int64 10011L); (mk_real_int64 10011L); (mk_real_int64 10011L); ]); +("ln_def_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 1037L); (mk_real_int64 1037L); (mk_real_int64 1037L); (mk_real_int64 1037L); (mk_real_int64 1037L); (mk_real_int64 1037L); (mk_real_int64 1063L); (mk_real_int64 1047L); (mk_real_int64 1115L); (mk_real_int64 1037L); (mk_real_int64 939L); (mk_real_int64 1037L); (mk_real_int64 1037L); (mk_real_int64 1037L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 62898L); (mk_real_int64 62898L); (mk_real_int64 62898L); (mk_real_int64 62898L); (mk_real_int64 62898L); (mk_real_int64 62898L); (mk_real_int64 62898L); (mk_real_int64 62951L); (mk_real_int64 62898L); (mk_real_int64 62898L); (mk_real_int64 62336L); (mk_real_int64 62898L); (mk_real_int64 62898L); (mk_real_int64 62898L); ]); +("edge_sym", [5; 6; 15; 22; 26; 40; 57; 60; ], [(mk_real_int64 299L); (mk_real_int64 299L); (mk_real_int64 485L); (mk_real_int64 641L); (mk_real_int64 29L); (mk_real_int64 895L); (mk_real_int64 49L); (mk_real_int64 470L); ]); +("edge_sym_neg", [9; 10; 13; 28; 29; 32; 34; 35; 38; 41; 50; 51; 54; ], [(mk_real_int64 281L); (mk_real_int64 538L); (mk_real_int64 1126L); (mk_real_int64 1048L); (mk_real_int64 29L); (mk_real_int64 3124L); (mk_real_int64 663L); (mk_real_int64 757L); (mk_real_int64 462L); (mk_real_int64 182L); (mk_real_int64 1056L); (mk_real_int64 1056L); (mk_real_int64 125L); ]); +("y1_def_neg", [6; 10; 12; 14; 15; 19; 26; 27; 29; 31; 32; 33; 34; 35; 37; 38; 41; 42; 43; 50; 53; 55; 56; 57; 60; 62; 63; ], [(mk_real_int64 234L); (mk_real_int64 774L); (mk_real_int64 1288L); (mk_real_int64 148L); (mk_real_int64 277L); (mk_real_int64 1802L); (mk_real_int64 7L); (mk_real_int64 228L); (mk_real_int64 321L); (mk_real_int64 700L); (mk_real_int64 589L); (mk_real_int64 1403L); (mk_real_int64 54L); (mk_real_int64 98L); (mk_real_int64 54L); (mk_real_int64 1165L); (mk_real_int64 54L); (mk_real_int64 529L); (mk_real_int64 1128L); (mk_real_int64 1423L); (mk_real_int64 123L); (mk_real_int64 319L); (mk_real_int64 398L); (mk_real_int64 27L); (mk_real_int64 1030L); (mk_real_int64 269L); (mk_real_int64 235L); ]); +("y1_def", [13; 18; 24; 25; 36; 39; 40; 44; 51; 59; ], [(mk_real_int64 760L); (mk_real_int64 760L); (mk_real_int64 12L); (mk_real_int64 16L); (mk_real_int64 37L); (mk_real_int64 582L); (mk_real_int64 73L); (mk_real_int64 968L); (mk_real_int64 224L); (mk_real_int64 156L); ]); +("y2_def", [6; 15; 24; 26; 27; 31; 34; 37; 40; 41; 42; 44; 53; 55; 60; 62; ], [(mk_real_int64 299L); (mk_real_int64 168L); (mk_real_int64 12L); (mk_real_int64 11L); (mk_real_int64 354L); (mk_real_int64 1084L); (mk_real_int64 33L); (mk_real_int64 33L); (mk_real_int64 73L); (mk_real_int64 33L); (mk_real_int64 388L); (mk_real_int64 968L); (mk_real_int64 18L); (mk_real_int64 193L); (mk_real_int64 101L); (mk_real_int64 163L); ]); +("y2_def_neg", [10; 12; 13; 14; 18; 19; 25; 29; 32; 33; 35; 36; 38; 39; 43; 50; 51; 56; 57; 59; 63; ], [(mk_real_int64 774L); (mk_real_int64 1288L); (mk_real_int64 231L); (mk_real_int64 148L); (mk_real_int64 231L); (mk_real_int64 1802L); (mk_real_int64 5L); (mk_real_int64 321L); (mk_real_int64 1328L); (mk_real_int64 1403L); (mk_real_int64 147L); (mk_real_int64 11L); (mk_real_int64 1120L); (mk_real_int64 177L); (mk_real_int64 1128L); (mk_real_int64 1423L); (mk_real_int64 68L); (mk_real_int64 398L); (mk_real_int64 80L); (mk_real_int64 47L); (mk_real_int64 235L); ]); +("y3_def", [6; 15; 24; 26; 27; 31; 34; 37; 40; 41; 42; 44; 53; 55; 60; 62; ], [(mk_real_int64 299L); (mk_real_int64 168L); (mk_real_int64 12L); (mk_real_int64 11L); (mk_real_int64 354L); (mk_real_int64 1084L); (mk_real_int64 33L); (mk_real_int64 33L); (mk_real_int64 73L); (mk_real_int64 33L); (mk_real_int64 388L); (mk_real_int64 968L); (mk_real_int64 18L); (mk_real_int64 193L); (mk_real_int64 101L); (mk_real_int64 163L); ]); +("y3_def_neg", [10; 12; 13; 14; 18; 19; 25; 29; 32; 33; 35; 36; 38; 39; 43; 50; 51; 56; 57; 59; 63; ], [(mk_real_int64 774L); (mk_real_int64 1288L); (mk_real_int64 231L); (mk_real_int64 148L); (mk_real_int64 231L); (mk_real_int64 1802L); (mk_real_int64 5L); (mk_real_int64 321L); (mk_real_int64 1328L); (mk_real_int64 1403L); (mk_real_int64 147L); (mk_real_int64 11L); (mk_real_int64 1120L); (mk_real_int64 177L); (mk_real_int64 1128L); (mk_real_int64 1423L); (mk_real_int64 68L); (mk_real_int64 398L); (mk_real_int64 80L); (mk_real_int64 47L); (mk_real_int64 235L); ]); +("y4_def_neg", [2; 4; 7; 11; 12; 14; 15; 17; 19; 20; 21; 22; 25; 26; 28; 29; 30; 31; 32; 34; 37; 39; 40; 44; 46; 47; ], [(mk_real_int64 538L); (mk_real_int64 895L); (mk_real_int64 317L); (mk_real_int64 1251L); (mk_real_int64 6L); (mk_real_int64 20L); (mk_real_int64 666L); (mk_real_int64 382L); (mk_real_int64 2040L); (mk_real_int64 36L); (mk_real_int64 974L); (mk_real_int64 61L); (mk_real_int64 61L); (mk_real_int64 438L); (mk_real_int64 38L); (mk_real_int64 61L); (mk_real_int64 731L); (mk_real_int64 784L); (mk_real_int64 499L); (mk_real_int64 988L); (mk_real_int64 125L); (mk_real_int64 364L); (mk_real_int64 276L); (mk_real_int64 1272L); (mk_real_int64 307L); (mk_real_int64 163L); ]); +("y4_def", [5; 6; 10; 13; 23; 24; 27; 35; 41; 43; ], [(mk_real_int64 1175L); (mk_real_int64 317L); (mk_real_int64 1175L); (mk_real_int64 24L); (mk_real_int64 348L); (mk_real_int64 58L); (mk_real_int64 900L); (mk_real_int64 347L); (mk_real_int64 208L); (mk_real_int64 241L); ]); +("y5_def", [6; 14; 15; 26; 27; 31; 34; 35; 37; 41; 42; 53; 55; 57; 60; 62; ], [(mk_real_int64 299L); (mk_real_int64 317L); (mk_real_int64 168L); (mk_real_int64 11L); (mk_real_int64 354L); (mk_real_int64 1084L); (mk_real_int64 33L); (mk_real_int64 278L); (mk_real_int64 33L); (mk_real_int64 33L); (mk_real_int64 388L); (mk_real_int64 29L); (mk_real_int64 193L); (mk_real_int64 133L); (mk_real_int64 230L); (mk_real_int64 163L); ]); +("y5_def_neg", [10; 12; 13; 18; 19; 24; 25; 29; 32; 33; 36; 38; 39; 40; 43; 44; 50; 51; 56; 59; 63; ], [(mk_real_int64 538L); (mk_real_int64 895L); (mk_real_int64 231L); (mk_real_int64 231L); (mk_real_int64 1251L); (mk_real_int64 6L); (mk_real_int64 5L); (mk_real_int64 382L); (mk_real_int64 1084L); (mk_real_int64 974L); (mk_real_int64 11L); (mk_real_int64 389L); (mk_real_int64 177L); (mk_real_int64 38L); (mk_real_int64 784L); (mk_real_int64 499L); (mk_real_int64 988L); (mk_real_int64 68L); (mk_real_int64 276L); (mk_real_int64 47L); (mk_real_int64 163L); ]); +("y6_def", [6; 8; 12; 14; 15; 17; 18; 24; 26; 27; 31; 33; 34; 35; 36; 37; 39; 41; 42; 43; 44; 52; 53; 55; 56; 57; 58; 60; 62; ], [(mk_real_int64 299L); (mk_real_int64 239L); (mk_real_int64 231L); (mk_real_int64 957L); (mk_real_int64 168L); (mk_real_int64 998L); (mk_real_int64 1251L); (mk_real_int64 25L); (mk_real_int64 11L); (mk_real_int64 354L); (mk_real_int64 1084L); (mk_real_int64 2744L); (mk_real_int64 33L); (mk_real_int64 278L); (mk_real_int64 1068L); (mk_real_int64 33L); (mk_real_int64 561L); (mk_real_int64 33L); (mk_real_int64 388L); (mk_real_int64 1768L); (mk_real_int64 395L); (mk_real_int64 1027L); (mk_real_int64 29L); (mk_real_int64 193L); (mk_real_int64 988L); (mk_real_int64 133L); (mk_real_int64 1270L); (mk_real_int64 230L); (mk_real_int64 1219L); ]); +("y6_def_neg", [10; 13; 19; 25; 29; 32; 38; 40; 50; 51; 59; 63; ], [(mk_real_int64 538L); (mk_real_int64 231L); (mk_real_int64 1175L); (mk_real_int64 5L); (mk_real_int64 382L); (mk_real_int64 1084L); (mk_real_int64 389L); (mk_real_int64 38L); (mk_real_int64 988L); (mk_real_int64 68L); (mk_real_int64 47L); (mk_real_int64 163L); ]); +("RHA", [14; 16; 17; 20; 33; 38; 40; 43; 44; 47; 52; 53; 54; 56; 57; 58; 59; 61; 63; ], [(mk_real_int64 462L); (mk_real_int64 471L); (mk_real_int64 8L); (mk_real_int64 8L); (mk_real_int64 89L); (mk_real_int64 43L); (mk_real_int64 89L); (mk_real_int64 762L); (mk_real_int64 762L); (mk_real_int64 8L); (mk_real_int64 448L); (mk_real_int64 302L); (mk_real_int64 448L); (mk_real_int64 531L); (mk_real_int64 442L); (mk_real_int64 749L); (mk_real_int64 660L); (mk_real_int64 448L); (mk_real_int64 448L); ]); +("tau4", [2; 3; ], [(mk_real_int64 8269L); (mk_real_int64 1418L); ]); +("ineq105", [6; ], [(mk_real_int64 743L); ]); +("ineq106", [7; 22; 25; 26; 29; 30; 37; 39; 44; 46; ], [(mk_real_int64 462L); (mk_real_int64 89L); (mk_real_int64 89L); (mk_real_int64 46L); (mk_real_int64 89L); (mk_real_int64 762L); (mk_real_int64 146L); (mk_real_int64 531L); (mk_real_int64 749L); (mk_real_int64 448L); ]); +("ineq107", [5; 10; 13; 20; 23; 24; 27; 35; 41; 43; ], [(mk_real_int64 1520L); (mk_real_int64 1520L); (mk_real_int64 31L); (mk_real_int64 1133L); (mk_real_int64 75L); (mk_real_int64 75L); (mk_real_int64 1164L); (mk_real_int64 448L); (mk_real_int64 81L); (mk_real_int64 312L); ]); +("ineq108", [14; 15; 19; 30; 44; ], [(mk_real_int64 30L); (mk_real_int64 972L); (mk_real_int64 2978L); (mk_real_int64 306L); (mk_real_int64 683L); ]); +("ineq109", [6; 23; 26; 41; ], [(mk_real_int64 979L); (mk_real_int64 896L); (mk_real_int64 896L); (mk_real_int64 448L); ]); +("ineq110", [12; 17; 20; 28; 32; ], [(mk_real_int64 31L); (mk_real_int64 347L); (mk_real_int64 237L); (mk_real_int64 193L); (mk_real_int64 2548L); ]); +("ineq111", [2; 4; 11; 17; 20; 21; 26; 31; 34; 37; 40; 44; 47; ], [(mk_real_int64 4302L); (mk_real_int64 7156L); (mk_real_int64 10011L); (mk_real_int64 2515L); (mk_real_int64 6921L); (mk_real_int64 7792L); (mk_real_int64 5566L); (mk_real_int64 6268L); (mk_real_int64 7903L); (mk_real_int64 196L); (mk_real_int64 2211L); (mk_real_int64 2332L); (mk_real_int64 1306L); ]); +("ineq113", [7; ], [(mk_real_int64 2089L); ]); +("ineq114", [0; 2; 3; 6; 8; 12; 14; 16; 18; 19; 21; 26; 28; 29; 30; 34; 37; 38; 40; 42; 44; 45; ], [(mk_real_int64 2854L); (mk_real_int64 2854L); (mk_real_int64 2854L); (mk_real_int64 5157L); (mk_real_int64 2303L); (mk_real_int64 2058L); (mk_real_int64 7953L); (mk_real_int64 7495L); (mk_real_int64 176L); (mk_real_int64 2914L); (mk_real_int64 2129L); (mk_real_int64 4355L); (mk_real_int64 2689L); (mk_real_int64 7232L); (mk_real_int64 2981L); (mk_real_int64 2107L); (mk_real_int64 2590L); (mk_real_int64 1271L); (mk_real_int64 2119L); (mk_real_int64 480L); (mk_real_int64 6450L); (mk_real_int64 8256L); ]); +("ineq119", [2; 7; ], [(mk_real_int64 3356L); (mk_real_int64 1979L); ]); +("ineq120", [0; 4; 6; 10; 12; 13; ], [(mk_real_int64 6654L); (mk_real_int64 6654L); (mk_real_int64 1378L); (mk_real_int64 1742L); (mk_real_int64 6233L); (mk_real_int64 2359L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 46908L); (mk_real_int64 46908L); (mk_real_int64 46908L); (mk_real_int64 46908L); (mk_real_int64 46908L); (mk_real_int64 46908L); (mk_real_int64 306908L); (mk_real_int64 53946L); (mk_real_int64 826908L); (mk_real_int64 46908L); (mk_real_int64 52656L); (mk_real_int64 46908L); (mk_real_int64 46908L); (mk_real_int64 46908L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [0; 4; 14; 22; 24; 26; 30; 31; 33; 38; 40; 41; 42; 45; 53; 54; 56; 60; 61; ], [(mk_real_int64 742L); (mk_real_int64 742L); (mk_real_int64 2820L); (mk_real_int64 2166L); (mk_real_int64 3080L); (mk_real_int64 5780L); (mk_real_int64 1760L); (mk_real_int64 1640L); (mk_real_int64 7540L); (mk_real_int64 2300L); (mk_real_int64 3140L); (mk_real_int64 2320L); (mk_real_int64 1060L); (mk_real_int64 2509L); (mk_real_int64 3400L); (mk_real_int64 6460L); (mk_real_int64 4940L); (mk_real_int64 7000L); (mk_real_int64 2560L); ]); +("azim_lo", [2; 6; 7; 8; 10; 11; 15; 16; 28; 43; 44; 46; 50; 58; 59; ], [(mk_real_int64 2680L); (mk_real_int64 4406L); (mk_real_int64 4870L); (mk_real_int64 3960L); (mk_real_int64 3960L); (mk_real_int64 3960L); (mk_real_int64 510L); (mk_real_int64 3220L); (mk_real_int64 1300L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 5293L); (mk_real_int64 180L); (mk_real_int64 5200L); (mk_real_int64 10000L); ]); +("rhazim_lo", [14; 15; 33; 34; 37; 38; 40; 41; 52; 53; 54; 58; 60; 61; 62; 63; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("rhazim_hi", [57; ], [(mk_real_int64 10000L); ]); +("rho_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 11; 12; 13; ], [(mk_real_int64 31152L); (mk_real_int64 31152L); (mk_real_int64 31152L); (mk_real_int64 31152L); (mk_real_int64 31152L); (mk_real_int64 31152L); (mk_real_int64 31152L); (mk_real_int64 3808L); (mk_real_int64 31152L); (mk_real_int64 31152L); (mk_real_int64 31152L); (mk_real_int64 31152L); (mk_real_int64 31152L); ]); +("rho_lo", [10; ], [(mk_real_int64 3728L); ]); +("tau_lo", [0; 2; 3; 8; 14; 15; 16; 17; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 55050000L); (mk_real_int64 51500000L); ]); +("tau_hi", [4; 18; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("y1_lo", [6; 10; 12; 15; 24; 25; 26; 27; 32; 42; 43; 57; 63; ], [(mk_real_int64 450L); (mk_real_int64 3600L); (mk_real_int64 800L); (mk_real_int64 2000L); (mk_real_int64 2200L); (mk_real_int64 5000L); (mk_real_int64 500L); (mk_real_int64 4200L); (mk_real_int64 2200L); (mk_real_int64 1100L); (mk_real_int64 2400L); (mk_real_int64 1480L); (mk_real_int64 800L); ]); +("y1_hi", [14; 19; 29; 31; 33; 34; 35; 36; 37; 38; 40; 41; 44; 50; 53; 55; 56; 60; 62; ], [(mk_real_int64 1710L); (mk_real_int64 200L); (mk_real_int64 1600L); (mk_real_int64 1700L); (mk_real_int64 4400L); (mk_real_int64 6000L); (mk_real_int64 2040L); (mk_real_int64 5000L); (mk_real_int64 6000L); (mk_real_int64 2240L); (mk_real_int64 3400L); (mk_real_int64 6000L); (mk_real_int64 2400L); (mk_real_int64 4600L); (mk_real_int64 1200L); (mk_real_int64 4000L); (mk_real_int64 200L); (mk_real_int64 3350L); (mk_real_int64 2000L); ]); +("y2_lo", [6; 10; 12; 13; 18; 24; 26; 27; 31; 34; 36; 37; 38; 41; 43; 51; 53; 59; 63; ], [(mk_real_int64 3140L); (mk_real_int64 3600L); (mk_real_int64 800L); (mk_real_int64 400L); (mk_real_int64 400L); (mk_real_int64 2200L); (mk_real_int64 830L); (mk_real_int64 2892L); (mk_real_int64 3058L); (mk_real_int64 6129L); (mk_real_int64 4000L); (mk_real_int64 6129L); (mk_real_int64 4366L); (mk_real_int64 6129L); (mk_real_int64 2400L); (mk_real_int64 960L); (mk_real_int64 1506L); (mk_real_int64 4240L); (mk_real_int64 800L); ]); +("y2_hi", [14; 15; 19; 25; 29; 32; 33; 35; 39; 40; 42; 44; 50; 55; 56; 57; 60; 62; ], [(mk_real_int64 1710L); (mk_real_int64 1218L); (mk_real_int64 200L); (mk_real_int64 2880L); (mk_real_int64 1600L); (mk_real_int64 640L); (mk_real_int64 4400L); (mk_real_int64 3040L); (mk_real_int64 720L); (mk_real_int64 3400L); (mk_real_int64 6452L); (mk_real_int64 2400L); (mk_real_int64 4600L); (mk_real_int64 2309L); (mk_real_int64 200L); (mk_real_int64 400L); (mk_real_int64 3448L); (mk_real_int64 272L); ]); +("y3_lo", [6; 10; 12; 13; 18; 24; 26; 27; 31; 34; 36; 37; 38; 41; 43; 51; 53; 59; 63; ], [(mk_real_int64 3140L); (mk_real_int64 3600L); (mk_real_int64 800L); (mk_real_int64 400L); (mk_real_int64 400L); (mk_real_int64 2200L); (mk_real_int64 830L); (mk_real_int64 2892L); (mk_real_int64 3058L); (mk_real_int64 6129L); (mk_real_int64 4000L); (mk_real_int64 6129L); (mk_real_int64 4366L); (mk_real_int64 6129L); (mk_real_int64 2400L); (mk_real_int64 960L); (mk_real_int64 1506L); (mk_real_int64 4240L); (mk_real_int64 800L); ]); +("y3_hi", [14; 15; 19; 25; 29; 32; 33; 35; 39; 40; 42; 44; 50; 55; 56; 57; 60; 62; ], [(mk_real_int64 1710L); (mk_real_int64 1218L); (mk_real_int64 200L); (mk_real_int64 2880L); (mk_real_int64 1600L); (mk_real_int64 640L); (mk_real_int64 4400L); (mk_real_int64 3040L); (mk_real_int64 720L); (mk_real_int64 3400L); (mk_real_int64 6452L); (mk_real_int64 2400L); (mk_real_int64 4600L); (mk_real_int64 2309L); (mk_real_int64 200L); (mk_real_int64 400L); (mk_real_int64 3448L); (mk_real_int64 272L); ]); +("y4_lo", [5; 6; 10; 11; 12; 13; 14; 17; 23; 24; 27; 30; 32; 35; 40; 41; 44; 47; ], [(mk_real_int64 400L); (mk_real_int64 5872L); (mk_real_int64 400L); (mk_real_int64 3750L); (mk_real_int64 760L); (mk_real_int64 370L); (mk_real_int64 5500L); (mk_real_int64 3870L); (mk_real_int64 4378L); (mk_real_int64 250L); (mk_real_int64 2280L); (mk_real_int64 5800L); (mk_real_int64 4080L); (mk_real_int64 6960L); (mk_real_int64 3750L); (mk_real_int64 5934L); (mk_real_int64 4200L); (mk_real_int64 2500L); ]); +("y4_hi", [2; 4; 7; 15; 19; 20; 22; 25; 26; 28; 29; 31; 34; 37; 39; 43; 46; ], [(mk_real_int64 2500L); (mk_real_int64 5000L); (mk_real_int64 5300L); (mk_real_int64 1800L); (mk_real_int64 700L); (mk_real_int64 2320L); (mk_real_int64 350L); (mk_real_int64 350L); (mk_real_int64 3272L); (mk_real_int64 1720L); (mk_real_int64 350L); (mk_real_int64 5000L); (mk_real_int64 1250L); (mk_real_int64 4900L); (mk_real_int64 2650L); (mk_real_int64 1760L); (mk_real_int64 1200L); ]); +("y5_lo", [6; 13; 14; 18; 19; 24; 26; 27; 29; 31; 34; 36; 37; 38; 41; 44; 51; 53; 56; 57; 59; 60; 63; ], [(mk_real_int64 3140L); (mk_real_int64 400L); (mk_real_int64 5872L); (mk_real_int64 400L); (mk_real_int64 3750L); (mk_real_int64 760L); (mk_real_int64 830L); (mk_real_int64 2892L); (mk_real_int64 3870L); (mk_real_int64 3058L); (mk_real_int64 6129L); (mk_real_int64 4000L); (mk_real_int64 6129L); (mk_real_int64 4234L); (mk_real_int64 6129L); (mk_real_int64 4080L); (mk_real_int64 960L); (mk_real_int64 3706L); (mk_real_int64 3750L); (mk_real_int64 5184L); (mk_real_int64 4240L); (mk_real_int64 3952L); (mk_real_int64 2500L); ]); +("y5_hi", [10; 12; 15; 25; 32; 35; 39; 40; 42; 43; 50; 55; 62; ], [(mk_real_int64 2500L); (mk_real_int64 5000L); (mk_real_int64 1218L); (mk_real_int64 2880L); (mk_real_int64 2070L); (mk_real_int64 1872L); (mk_real_int64 720L); (mk_real_int64 1720L); (mk_real_int64 6452L); (mk_real_int64 5000L); (mk_real_int64 1250L); (mk_real_int64 2309L); (mk_real_int64 272L); ]); +("y6_lo", [6; 8; 12; 13; 14; 17; 18; 19; 24; 26; 27; 29; 31; 33; 34; 36; 37; 38; 39; 41; 43; 44; 51; 52; 53; 56; 57; 58; 59; 60; 62; 63; ], [(mk_real_int64 3140L); (mk_real_int64 2390000L); (mk_real_int64 11260000L); (mk_real_int64 400L); (mk_real_int64 6410000L); (mk_real_int64 9980000L); (mk_real_int64 14820400L); (mk_real_int64 763750L); (mk_real_int64 310760L); (mk_real_int64 830L); (mk_real_int64 2892L); (mk_real_int64 3870L); (mk_real_int64 3058L); (mk_real_int64 37180000L); (mk_real_int64 6129L); (mk_real_int64 10800000L); (mk_real_int64 6129L); (mk_real_int64 4234L); (mk_real_int64 7380000L); (mk_real_int64 6129L); (mk_real_int64 25520000L); (mk_real_int64 8950000L); (mk_real_int64 960L); (mk_real_int64 10270000L); (mk_real_int64 3706L); (mk_real_int64 12643750L); (mk_real_int64 5184L); (mk_real_int64 12700000L); (mk_real_int64 4240L); (mk_real_int64 3952L); (mk_real_int64 10560000L); (mk_real_int64 2500L); ]); +("y6_hi", [10; 12; 14; 15; 25; 32; 35; 36; 39; 40; 42; 43; 44; 50; 55; 62; ], [(mk_real_int64 2500L); (mk_real_int64 5000L); (mk_real_int64 4128L); (mk_real_int64 1218L); (mk_real_int64 2880L); (mk_real_int64 2070L); (mk_real_int64 1872L); (mk_real_int64 6000L); (mk_real_int64 720L); (mk_real_int64 1720L); (mk_real_int64 6452L); (mk_real_int64 5000L); (mk_real_int64 5920L); (mk_real_int64 1250L); (mk_real_int64 2309L); (mk_real_int64 272L); ]); +("ye_hi", [17; 27; 29; 33; 37; 38; 57; 59; 60; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("ye_lo", [9; 11; 14; 22; 44; ], [(mk_real_int64 2570000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 6410000L); (mk_real_int64 10000L); ]); +("yn_lo", [1; 3; 4; 6; 8; 9; 11; 12; 13; ], [(mk_real_int64 7453L); (mk_real_int64 7453L); (mk_real_int64 7453L); (mk_real_int64 7447L); (mk_real_int64 7435L); (mk_real_int64 7453L); (mk_real_int64 17453L); (mk_real_int64 7453L); (mk_real_int64 17453L); ]); +("yn_hi", [0; 2; 5; 7; 10; ], [(mk_real_int64 2547L); (mk_real_int64 2547L); (mk_real_int64 2547L); (mk_real_int64 4857L); (mk_real_int64 7909L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/245859035526_out.hl b/formal_lp/old/ineqs/tests2/245859035526_out.hl new file mode 100644 index 0000000..13066a2 --- /dev/null +++ b/formal_lp/old/ineqs/tests2/245859035526_out.hl @@ -0,0 +1,84 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "245859035526 23 4 0 1 2 3 3 0 3 4 3 4 3 5 3 5 3 2 4 5 2 6 7 3 6 2 1 3 6 1 8 3 8 1 9 3 9 1 0 3 9 0 10 4 10 0 4 11 3 11 4 5 3 11 5 7 3 7 6 12 3 12 6 8 3 12 8 13 3 13 8 9 3 13 9 10 3 13 10 14 3 14 10 11 3 12 13 14 3 7 12 14 3 14 11 7 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [1; 2; 3; 4; 8; 9; 11; 14; ], [(mk_real_int64 25L); (mk_real_int64 136L); (mk_real_int64 585L); (mk_real_int64 1L); (mk_real_int64 163L); (mk_real_int64 142L); (mk_real_int64 71L); (mk_real_int64 481L); ]); +("azim_sum_neg", [5; 7; 12; ], [(mk_real_int64 80L); (mk_real_int64 3L); (mk_real_int64 41L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 1077L); (mk_real_int64 1077L); (mk_real_int64 1098L); (mk_real_int64 1150L); (mk_real_int64 1076L); (mk_real_int64 1178L); (mk_real_int64 1098L); (mk_real_int64 804L); (mk_real_int64 1098L); (mk_real_int64 1150L); (mk_real_int64 804L); (mk_real_int64 961L); (mk_real_int64 1079L); (mk_real_int64 1150L); (mk_real_int64 1098L); ]); +("sol_sum3_neg", [6; 7; 10; 18; ], [(mk_real_int64 136L); (mk_real_int64 194L); (mk_real_int64 137L); (mk_real_int64 71L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; ], [(mk_real_int64 1077L); (mk_real_int64 1077L); (mk_real_int64 1077L); (mk_real_int64 1098L); (mk_real_int64 804L); (mk_real_int64 804L); (mk_real_int64 1098L); (mk_real_int64 1098L); (mk_real_int64 1077L); (mk_real_int64 1098L); (mk_real_int64 961L); (mk_real_int64 804L); (mk_real_int64 804L); (mk_real_int64 804L); (mk_real_int64 804L); (mk_real_int64 804L); (mk_real_int64 1079L); (mk_real_int64 804L); (mk_real_int64 961L); (mk_real_int64 1079L); ]); +("tau_sum4_neg", [0; 1; 2; ], [(mk_real_int64 1077L); (mk_real_int64 1098L); (mk_real_int64 1150L); ]); +("ln_def_neg", [0; 1; 2; 3; 4; 5; 6; 8; 9; 11; 12; 13; 14; ], [(mk_real_int64 187L); (mk_real_int64 187L); (mk_real_int64 210L); (mk_real_int64 267L); (mk_real_int64 186L); (mk_real_int64 298L); (mk_real_int64 210L); (mk_real_int64 210L); (mk_real_int64 267L); (mk_real_int64 60L); (mk_real_int64 190L); (mk_real_int64 267L); (mk_real_int64 210L); ]); +("ln_def", [7; 10; ], [(mk_real_int64 114L); (mk_real_int64 114L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 6765L); (mk_real_int64 6765L); (mk_real_int64 6896L); (mk_real_int64 7223L); (mk_real_int64 6758L); (mk_real_int64 7399L); (mk_real_int64 6896L); (mk_real_int64 5050L); (mk_real_int64 6896L); (mk_real_int64 7223L); (mk_real_int64 5050L); (mk_real_int64 6038L); (mk_real_int64 6781L); (mk_real_int64 7223L); (mk_real_int64 6896L); ]); +("edge_sym", [1; 2; 21; 24; 28; 50; 53; 58; 62; 65; 68; ], [(mk_real_int64 110L); (mk_real_int64 121L); (mk_real_int64 3L); (mk_real_int64 202L); (mk_real_int64 28L); (mk_real_int64 191L); (mk_real_int64 20L); (mk_real_int64 135L); (mk_real_int64 35L); (mk_real_int64 55L); (mk_real_int64 67L); ]); +("edge_sym_neg", [5; 8; 9; 19; 22; 25; 31; 38; 41; 43; 44; 47; 49; 56; 59; ], [(mk_real_int64 20L); (mk_real_int64 130L); (mk_real_int64 130L); (mk_real_int64 110L); (mk_real_int64 196L); (mk_real_int64 109L); (mk_real_int64 430L); (mk_real_int64 116L); (mk_real_int64 22L); (mk_real_int64 61L); (mk_real_int64 61L); (mk_real_int64 246L); (mk_real_int64 55L); (mk_real_int64 114L); (mk_real_int64 205L); ]); +("y1_def_neg", [2; 4; 6; 9; 12; 19; 20; 21; 22; 24; 25; 26; 28; 30; 38; 39; 40; 43; 45; 46; 48; 51; 53; 55; 56; 58; 59; 61; 62; 63; 65; 66; 68; 70; 71; ], [(mk_real_int64 8L); (mk_real_int64 11L); (mk_real_int64 10L); (mk_real_int64 188L); (mk_real_int64 194L); (mk_real_int64 158L); (mk_real_int64 60L); (mk_real_int64 174L); (mk_real_int64 47L); (mk_real_int64 176L); (mk_real_int64 320L); (mk_real_int64 6L); (mk_real_int64 334L); (mk_real_int64 289L); (mk_real_int64 167L); (mk_real_int64 31L); (mk_real_int64 59L); (mk_real_int64 35L); (mk_real_int64 27L); (mk_real_int64 265L); (mk_real_int64 79L); (mk_real_int64 61L); (mk_real_int64 100L); (mk_real_int64 176L); (mk_real_int64 266L); (mk_real_int64 292L); (mk_real_int64 141L); (mk_real_int64 196L); (mk_real_int64 42L); (mk_real_int64 91L); (mk_real_int64 263L); (mk_real_int64 151L); (mk_real_int64 177L); (mk_real_int64 31L); (mk_real_int64 61L); ]); +("y1_def", [23; 27; 29; 31; 44; 47; 49; 52; 60; 69; ], [(mk_real_int64 1L); (mk_real_int64 52L); (mk_real_int64 15L); (mk_real_int64 74L); (mk_real_int64 85L); (mk_real_int64 1L); (mk_real_int64 1L); (mk_real_int64 1L); (mk_real_int64 21L); (mk_real_int64 21L); ]); +("y2_def", [2; 4; 20; 21; 24; 25; 26; 27; 31; 39; 44; 45; 46; 53; 55; 56; 58; 59; 62; 63; 66; 70; ], [(mk_real_int64 10L); (mk_real_int64 7L); (mk_real_int64 36L); (mk_real_int64 105L); (mk_real_int64 107L); (mk_real_int64 61L); (mk_real_int64 10L); (mk_real_int64 52L); (mk_real_int64 74L); (mk_real_int64 19L); (mk_real_int64 42L); (mk_real_int64 16L); (mk_real_int64 15L); (mk_real_int64 61L); (mk_real_int64 107L); (mk_real_int64 69L); (mk_real_int64 20L); (mk_real_int64 85L); (mk_real_int64 26L); (mk_real_int64 55L); (mk_real_int64 226L); (mk_real_int64 19L); ]); +("y2_def_neg", [6; 9; 12; 19; 22; 28; 29; 30; 38; 40; 43; 48; 51; 60; 61; 65; 68; 69; 71; ], [(mk_real_int64 10L); (mk_real_int64 188L); (mk_real_int64 179L); (mk_real_int64 158L); (mk_real_int64 49L); (mk_real_int64 15L); (mk_real_int64 5L); (mk_real_int64 41L); (mk_real_int64 167L); (mk_real_int64 59L); (mk_real_int64 35L); (mk_real_int64 79L); (mk_real_int64 61L); (mk_real_int64 6L); (mk_real_int64 128L); (mk_real_int64 37L); (mk_real_int64 171L); (mk_real_int64 6L); (mk_real_int64 44L); ]); +("y3_def", [2; 4; 20; 21; 24; 25; 26; 27; 31; 39; 44; 45; 46; 53; 55; 56; 58; 59; 62; 63; 66; 70; ], [(mk_real_int64 10L); (mk_real_int64 7L); (mk_real_int64 36L); (mk_real_int64 105L); (mk_real_int64 107L); (mk_real_int64 61L); (mk_real_int64 10L); (mk_real_int64 52L); (mk_real_int64 74L); (mk_real_int64 19L); (mk_real_int64 42L); (mk_real_int64 16L); (mk_real_int64 15L); (mk_real_int64 61L); (mk_real_int64 107L); (mk_real_int64 69L); (mk_real_int64 20L); (mk_real_int64 85L); (mk_real_int64 26L); (mk_real_int64 55L); (mk_real_int64 226L); (mk_real_int64 19L); ]); +("y3_def_neg", [6; 9; 12; 19; 22; 28; 29; 30; 38; 40; 43; 48; 51; 60; 61; 65; 68; 69; 71; ], [(mk_real_int64 10L); (mk_real_int64 188L); (mk_real_int64 179L); (mk_real_int64 158L); (mk_real_int64 49L); (mk_real_int64 15L); (mk_real_int64 5L); (mk_real_int64 41L); (mk_real_int64 167L); (mk_real_int64 59L); (mk_real_int64 35L); (mk_real_int64 79L); (mk_real_int64 61L); (mk_real_int64 6L); (mk_real_int64 128L); (mk_real_int64 37L); (mk_real_int64 171L); (mk_real_int64 6L); (mk_real_int64 44L); ]); +("y4_def_neg", [0; 2; 5; 8; 11; 12; 13; 14; 16; 17; 18; 19; 20; 22; 23; 26; 27; 28; 31; 33; 34; 36; 39; 41; 43; 44; 46; 47; 49; 50; 51; 53; 54; 56; 58; 59; ], [(mk_real_int64 13L); (mk_real_int64 7L); (mk_real_int64 130L); (mk_real_int64 147L); (mk_real_int64 110L); (mk_real_int64 68L); (mk_real_int64 198L); (mk_real_int64 32L); (mk_real_int64 201L); (mk_real_int64 386L); (mk_real_int64 19L); (mk_real_int64 27L); (mk_real_int64 481L); (mk_real_int64 388L); (mk_real_int64 38L); (mk_real_int64 116L); (mk_real_int64 36L); (mk_real_int64 41L); (mk_real_int64 24L); (mk_real_int64 30L); (mk_real_int64 262L); (mk_real_int64 55L); (mk_real_int64 43L); (mk_real_int64 114L); (mk_real_int64 201L); (mk_real_int64 279L); (mk_real_int64 290L); (mk_real_int64 160L); (mk_real_int64 155L); (mk_real_int64 48L); (mk_real_int64 104L); (mk_real_int64 246L); (mk_real_int64 389L); (mk_real_int64 124L); (mk_real_int64 35L); (mk_real_int64 48L); ]); +("y4_def", [15; 21; 32; 35; 37; 40; 48; 57; ], [(mk_real_int64 2L); (mk_real_int64 24L); (mk_real_int64 24L); (mk_real_int64 2L); (mk_real_int64 2L); (mk_real_int64 2L); (mk_real_int64 32L); (mk_real_int64 32L); ]); +("y5_def", [2; 4; 20; 21; 24; 25; 26; 28; 30; 39; 45; 46; 53; 55; 56; 58; 59; 62; 63; 66; 70; ], [(mk_real_int64 10L); (mk_real_int64 7L); (mk_real_int64 36L); (mk_real_int64 105L); (mk_real_int64 107L); (mk_real_int64 93L); (mk_real_int64 10L); (mk_real_int64 45L); (mk_real_int64 14L); (mk_real_int64 19L); (mk_real_int64 16L); (mk_real_int64 43L); (mk_real_int64 61L); (mk_real_int64 107L); (mk_real_int64 87L); (mk_real_int64 50L); (mk_real_int64 85L); (mk_real_int64 26L); (mk_real_int64 55L); (mk_real_int64 185L); (mk_real_int64 19L); ]); +("y5_def_neg", [6; 9; 12; 19; 22; 27; 29; 31; 38; 40; 43; 44; 48; 51; 60; 61; 68; 69; 71; ], [(mk_real_int64 7L); (mk_real_int64 130L); (mk_real_int64 121L); (mk_real_int64 110L); (mk_real_int64 34L); (mk_real_int64 27L); (mk_real_int64 5L); (mk_real_int64 38L); (mk_real_int64 116L); (mk_real_int64 41L); (mk_real_int64 24L); (mk_real_int64 37L); (mk_real_int64 55L); (mk_real_int64 43L); (mk_real_int64 6L); (mk_real_int64 81L); (mk_real_int64 118L); (mk_real_int64 6L); (mk_real_int64 28L); ]); +("y6_def", [2; 4; 10; 17; 20; 21; 23; 24; 25; 26; 28; 30; 36; 37; 39; 40; 45; 46; 48; 51; 52; 53; 54; 55; 56; 57; 58; 59; 62; 63; 64; 66; 67; 70; ], [(mk_real_int64 10L); (mk_real_int64 7L); (mk_real_int64 278L); (mk_real_int64 110L); (mk_real_int64 36L); (mk_real_int64 105L); (mk_real_int64 277L); (mk_real_int64 107L); (mk_real_int64 93L); (mk_real_int64 305L); (mk_real_int64 45L); (mk_real_int64 14L); (mk_real_int64 116L); (mk_real_int64 246L); (mk_real_int64 157L); (mk_real_int64 36L); (mk_real_int64 16L); (mk_real_int64 227L); (mk_real_int64 247L); (mk_real_int64 170L); (mk_real_int64 91L); (mk_real_int64 61L); (mk_real_int64 152L); (mk_real_int64 343L); (mk_real_int64 87L); (mk_real_int64 225L); (mk_real_int64 50L); (mk_real_int64 85L); (mk_real_int64 26L); (mk_real_int64 55L); (mk_real_int64 308L); (mk_real_int64 185L); (mk_real_int64 451L); (mk_real_int64 19L); ]); +("y6_def_neg", [6; 9; 19; 22; 27; 29; 31; 38; 43; 44; 60; 61; 68; 69; 71; ], [(mk_real_int64 7L); (mk_real_int64 130L); (mk_real_int64 110L); (mk_real_int64 34L); (mk_real_int64 27L); (mk_real_int64 5L); (mk_real_int64 38L); (mk_real_int64 116L); (mk_real_int64 24L); (mk_real_int64 37L); (mk_real_int64 6L); (mk_real_int64 57L); (mk_real_int64 118L); (mk_real_int64 6L); (mk_real_int64 26L); ]); +("RHA", [0; 1; 4; 9; 10; 13; 20; 21; 31; 36; 38; 40; 42; 43; 45; 46; 48; 53; 58; 59; 63; 65; 68; 70; ], [(mk_real_int64 73L); (mk_real_int64 21L); (mk_real_int64 54L); (mk_real_int64 101L); (mk_real_int64 101L); (mk_real_int64 80L); (mk_real_int64 194L); (mk_real_int64 5L); (mk_real_int64 52L); (mk_real_int64 73L); (mk_real_int64 101L); (mk_real_int64 80L); (mk_real_int64 137L); (mk_real_int64 137L); (mk_real_int64 113L); (mk_real_int64 3L); (mk_real_int64 157L); (mk_real_int64 127L); (mk_real_int64 21L); (mk_real_int64 41L); (mk_real_int64 6L); (mk_real_int64 41L); (mk_real_int64 112L); (mk_real_int64 19L); ]); +("RHB", [6; 7; 14; 18; 34; 37; ], [(mk_real_int64 1L); (mk_real_int64 1L); (mk_real_int64 21L); (mk_real_int64 21L); (mk_real_int64 74L); (mk_real_int64 1L); ]); +("tau4", [1; ], [(mk_real_int64 462L); ]); +("ineq105", [2; ], [(mk_real_int64 25L); ]); +("ineq106", [0; 12; 13; 16; 17; 20; 22; 27; 33; 34; 41; 43; 44; 46; 47; 49; 50; 51; 53; 54; 56; 58; 59; ], [(mk_real_int64 19L); (mk_real_int64 100L); (mk_real_int64 289L); (mk_real_int64 294L); (mk_real_int64 294L); (mk_real_int64 52L); (mk_real_int64 52L); (mk_real_int64 52L); (mk_real_int64 44L); (mk_real_int64 290L); (mk_real_int64 167L); (mk_real_int64 294L); (mk_real_int64 346L); (mk_real_int64 324L); (mk_real_int64 234L); (mk_real_int64 70L); (mk_real_int64 70L); (mk_real_int64 151L); (mk_real_int64 234L); (mk_real_int64 137L); (mk_real_int64 6L); (mk_real_int64 51L); (mk_real_int64 18L); ]); +("ineq107", [14; 15; 21; 32; 35; 37; 40; 48; 57; ], [(mk_real_int64 3L); (mk_real_int64 3L); (mk_real_int64 31L); (mk_real_int64 66L); (mk_real_int64 3L); (mk_real_int64 3L); (mk_real_int64 3L); (mk_real_int64 41L); (mk_real_int64 41L); ]); +("ineq108", [8; 17; 18; 20; 22; 44; 54; ], [(mk_real_int64 25L); (mk_real_int64 163L); (mk_real_int64 27L); (mk_real_int64 449L); (mk_real_int64 331L); (mk_real_int64 3L); (mk_real_int64 410L); ]); +("ineq110", [19; 23; 32; 54; ], [(mk_real_int64 136L); (mk_real_int64 194L); (mk_real_int64 137L); (mk_real_int64 71L); ]); +("ineq111", [2; 5; 8; 11; 14; 17; 20; 22; 26; 28; 31; 34; 36; 39; 44; 46; 49; 53; 56; 59; ], [(mk_real_int64 55L); (mk_real_int64 1043L); (mk_real_int64 1043L); (mk_real_int64 880L); (mk_real_int64 269L); (mk_real_int64 586L); (mk_real_int64 1098L); (mk_real_int64 1001L); (mk_real_int64 927L); (mk_real_int64 329L); (mk_real_int64 192L); (mk_real_int64 505L); (mk_real_int64 439L); (mk_real_int64 340L); (mk_real_int64 321L); (mk_real_int64 543L); (mk_real_int64 853L); (mk_real_int64 681L); (mk_real_int64 961L); (mk_real_int64 280L); ]); +("ineq114", [0; 5; 6; 11; 12; 13; 16; 22; 24; 26; 29; 30; 33; 34; 36; 41; 43; 44; 46; 49; 51; 58; 59; ], [(mk_real_int64 1021L); (mk_real_int64 33L); (mk_real_int64 33L); (mk_real_int64 217L); (mk_real_int64 310L); (mk_real_int64 225L); (mk_real_int64 217L); (mk_real_int64 97L); (mk_real_int64 116L); (mk_real_int64 33L); (mk_real_int64 769L); (mk_real_int64 769L); (mk_real_int64 294L); (mk_real_int64 5L); (mk_real_int64 364L); (mk_real_int64 464L); (mk_real_int64 261L); (mk_real_int64 222L); (mk_real_int64 261L); (mk_real_int64 227L); (mk_real_int64 122L); (mk_real_int64 30L); (mk_real_int64 769L); ]); +("ineq119", [10; ], [(mk_real_int64 189L); ]); +("ineq120", [0; 1; 7; 8; 9; ], [(mk_real_int64 869L); (mk_real_int64 207L); (mk_real_int64 635L); (mk_real_int64 187L); (mk_real_int64 773L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 3125L); (mk_real_int64 3125L); (mk_real_int64 3200L); (mk_real_int64 2975L); (mk_real_int64 3350L); (mk_real_int64 3175L); (mk_real_int64 3200L); (mk_real_int64 2250L); (mk_real_int64 3200L); (mk_real_int64 2975L); (mk_real_int64 2250L); (mk_real_int64 3350L); (mk_real_int64 3325L); (mk_real_int64 2975L); (mk_real_int64 3200L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [0; 4; 6; 7; 16; 20; 30; 33; 34; 37; 41; 42; 45; 46; 53; 55; 58; 61; 71; ], [(mk_real_int64 702L); (mk_real_int64 146L); (mk_real_int64 176L); (mk_real_int64 176L); (mk_real_int64 330L); (mk_real_int64 60L); (mk_real_int64 722L); (mk_real_int64 934L); (mk_real_int64 407L); (mk_real_int64 176L); (mk_real_int64 394L); (mk_real_int64 394L); (mk_real_int64 44L); (mk_real_int64 130L); (mk_real_int64 464L); (mk_real_int64 386L); (mk_real_int64 386L); (mk_real_int64 102L); (mk_real_int64 394L); ]); +("azim_lo", [1; 9; 10; 14; 18; 19; 21; 24; 32; 36; 38; 48; 56; 63; 70; ], [(mk_real_int64 94L); (mk_real_int64 342L); (mk_real_int64 342L); (mk_real_int64 304L); (mk_real_int64 304L); (mk_real_int64 158L); (mk_real_int64 150L); (mk_real_int64 158L); (mk_real_int64 254L); (mk_real_int64 384L); (mk_real_int64 342L); (mk_real_int64 136L); (mk_real_int64 28L); (mk_real_int64 628L); (mk_real_int64 220L); ]); +("rhazim_lo", [46; 58; 61; 62; 70; 71; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 13; 14; ], [(mk_real_int64 2868L); (mk_real_int64 2868L); (mk_real_int64 3832L); (mk_real_int64 3600L); (mk_real_int64 3584L); (mk_real_int64 3552L); (mk_real_int64 3832L); (mk_real_int64 2336L); (mk_real_int64 3832L); (mk_real_int64 3600L); (mk_real_int64 2336L); (mk_real_int64 924L); (mk_real_int64 3600L); (mk_real_int64 3832L); ]); +("rho_lo", [12; ], [(mk_real_int64 564L); ]); +("tau_lo", [0; 1; 2; 3; 4; 5; 7; 10; 11; 15; 20; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("tau_hi", [19; ], [(mk_real_int64 1000L); ]); +("y1_lo", [4; 19; 24; 25; 26; 27; 28; 30; 31; 39; 40; 48; 51; 53; 55; 56; 58; 60; 66; 69; 71; ], [(mk_real_int64 400L); (mk_real_int64 400L); (mk_real_int64 400L); (mk_real_int64 185L); (mk_real_int64 345L); (mk_real_int64 320L); (mk_real_int64 355L); (mk_real_int64 165L); (mk_real_int64 280L); (mk_real_int64 200L); (mk_real_int64 220L); (mk_real_int64 20L); (mk_real_int64 200L); (mk_real_int64 200L); (mk_real_int64 400L); (mk_real_int64 85L); (mk_real_int64 140L); (mk_real_int64 500L); (mk_real_int64 570L); (mk_real_int64 500L); (mk_real_int64 200L); ]); +("y1_hi", [2; 6; 9; 12; 21; 22; 23; 29; 38; 43; 44; 45; 46; 47; 49; 52; 59; 61; 63; 65; 68; 70; ], [(mk_real_int64 125L); (mk_real_int64 100L); (mk_real_int64 260L); (mk_real_int64 385L); (mk_real_int64 600L); (mk_real_int64 80L); (mk_real_int64 500L); (mk_real_int64 500L); (mk_real_int64 140L); (mk_real_int64 440L); (mk_real_int64 60L); (mk_real_int64 600L); (mk_real_int64 100L); (mk_real_int64 500L); (mk_real_int64 500L); (mk_real_int64 500L); (mk_real_int64 600L); (mk_real_int64 460L); (mk_real_int64 400L); (mk_real_int64 20L); (mk_real_int64 420L); (mk_real_int64 400L); ]); +("y2_lo", [4; 19; 23; 25; 26; 27; 28; 31; 39; 40; 46; 47; 48; 49; 51; 52; 53; 60; 61; 62; 63; 65; 69; 70; ], [(mk_real_int64 84L); (mk_real_int64 400L); (mk_real_int64 456L); (mk_real_int64 132L); (mk_real_int64 172L); (mk_real_int64 320L); (mk_real_int64 276L); (mk_real_int64 280L); (mk_real_int64 72L); (mk_real_int64 220L); (mk_real_int64 340L); (mk_real_int64 456L); (mk_real_int64 20L); (mk_real_int64 456L); (mk_real_int64 200L); (mk_real_int64 456L); (mk_real_int64 212L); (mk_real_int64 232L); (mk_real_int64 60L); (mk_real_int64 520L); (mk_real_int64 36L); (mk_real_int64 404L); (mk_real_int64 232L); (mk_real_int64 436L); ]); +("y2_hi", [2; 6; 9; 12; 20; 21; 22; 24; 29; 30; 38; 43; 44; 45; 55; 56; 58; 59; 66; 68; 71; ], [(mk_real_int64 50L); (mk_real_int64 100L); (mk_real_int64 260L); (mk_real_int64 360L); (mk_real_int64 400L); (mk_real_int64 196L); (mk_real_int64 124L); (mk_real_int64 16L); (mk_real_int64 288L); (mk_real_int64 232L); (mk_real_int64 140L); (mk_real_int64 440L); (mk_real_int64 28L); (mk_real_int64 16L); (mk_real_int64 16L); (mk_real_int64 256L); (mk_real_int64 196L); (mk_real_int64 176L); (mk_real_int64 88L); (mk_real_int64 204L); (mk_real_int64 152L); ]); +("y3_lo", [4; 19; 23; 25; 26; 27; 28; 31; 39; 40; 46; 47; 48; 49; 51; 52; 53; 60; 61; 62; 63; 65; 69; 70; ], [(mk_real_int64 84L); (mk_real_int64 400L); (mk_real_int64 456L); (mk_real_int64 132L); (mk_real_int64 172L); (mk_real_int64 320L); (mk_real_int64 276L); (mk_real_int64 280L); (mk_real_int64 72L); (mk_real_int64 220L); (mk_real_int64 340L); (mk_real_int64 456L); (mk_real_int64 20L); (mk_real_int64 456L); (mk_real_int64 200L); (mk_real_int64 456L); (mk_real_int64 212L); (mk_real_int64 232L); (mk_real_int64 60L); (mk_real_int64 520L); (mk_real_int64 36L); (mk_real_int64 404L); (mk_real_int64 232L); (mk_real_int64 436L); ]); +("y3_hi", [2; 6; 9; 12; 20; 21; 22; 24; 29; 30; 38; 43; 44; 45; 55; 56; 58; 59; 66; 68; 71; ], [(mk_real_int64 50L); (mk_real_int64 100L); (mk_real_int64 260L); (mk_real_int64 360L); (mk_real_int64 400L); (mk_real_int64 196L); (mk_real_int64 124L); (mk_real_int64 16L); (mk_real_int64 288L); (mk_real_int64 232L); (mk_real_int64 140L); (mk_real_int64 440L); (mk_real_int64 28L); (mk_real_int64 16L); (mk_real_int64 16L); (mk_real_int64 256L); (mk_real_int64 196L); (mk_real_int64 176L); (mk_real_int64 88L); (mk_real_int64 204L); (mk_real_int64 152L); ]); +("y4_lo", [0; 5; 8; 12; 16; 17; 21; 23; 28; 33; 41; 43; 44; 47; 48; 56; 57; ], [(mk_real_int64 15L); (mk_real_int64 375L); (mk_real_int64 500L); (mk_real_int64 500L); (mk_real_int64 390L); (mk_real_int64 295L); (mk_real_int64 37L); (mk_real_int64 24L); (mk_real_int64 125L); (mk_real_int64 140L); (mk_real_int64 395L); (mk_real_int64 390L); (mk_real_int64 190L); (mk_real_int64 290L); (mk_real_int64 307L); (mk_real_int64 235L); (mk_real_int64 307L); ]); +("y4_hi", [2; 13; 14; 15; 18; 19; 20; 22; 26; 27; 32; 34; 35; 36; 37; 39; 40; 46; 49; 50; 51; 53; 54; 58; 59; ], [(mk_real_int64 125L); (mk_real_int64 35L); (mk_real_int64 694L); (mk_real_int64 319L); (mk_real_int64 505L); (mk_real_int64 344L); (mk_real_int64 565L); (mk_real_int64 520L); (mk_real_int64 125L); (mk_real_int64 380L); (mk_real_int64 166L); (mk_real_int64 225L); (mk_real_int64 319L); (mk_real_int64 125L); (mk_real_int64 319L); (mk_real_int64 500L); (mk_real_int64 319L); (mk_real_int64 185L); (mk_real_int64 425L); (mk_real_int64 50L); (mk_real_int64 565L); (mk_real_int64 585L); (mk_real_int64 389L); (mk_real_int64 65L); (mk_real_int64 670L); ]); +("y5_lo", [4; 9; 12; 22; 23; 26; 31; 39; 40; 46; 47; 49; 52; 53; 56; 60; 61; 62; 63; 69; 70; 71; ], [(mk_real_int64 84L); (mk_real_int64 375L); (mk_real_int64 275L); (mk_real_int64 81L); (mk_real_int64 456L); (mk_real_int64 172L); (mk_real_int64 24L); (mk_real_int64 72L); (mk_real_int64 125L); (mk_real_int64 565L); (mk_real_int64 456L); (mk_real_int64 456L); (mk_real_int64 456L); (mk_real_int64 212L); (mk_real_int64 89L); (mk_real_int64 232L); (mk_real_int64 145L); (mk_real_int64 520L); (mk_real_int64 36L); (mk_real_int64 232L); (mk_real_int64 436L); (mk_real_int64 448L); ]); +("y5_hi", [2; 6; 20; 21; 24; 25; 27; 28; 29; 30; 38; 44; 45; 48; 51; 55; 58; 59; 65; 66; 68; ], [(mk_real_int64 50L); (mk_real_int64 125L); (mk_real_int64 400L); (mk_real_int64 196L); (mk_real_int64 16L); (mk_real_int64 98L); (mk_real_int64 344L); (mk_real_int64 114L); (mk_real_int64 288L); (mk_real_int64 287L); (mk_real_int64 125L); (mk_real_int64 116L); (mk_real_int64 16L); (mk_real_int64 125L); (mk_real_int64 500L); (mk_real_int64 16L); (mk_real_int64 61L); (mk_real_int64 176L); (mk_real_int64 51L); (mk_real_int64 192L); (mk_real_int64 59L); ]); +("y6_lo", [4; 9; 10; 12; 17; 22; 23; 26; 31; 36; 37; 39; 40; 46; 47; 48; 49; 51; 52; 53; 54; 55; 56; 57; 60; 61; 62; 63; 64; 67; 69; 70; 71; ], [(mk_real_int64 84L); (mk_real_int64 375L); (mk_real_int64 278000L); (mk_real_int64 121275L); (mk_real_int64 110000L); (mk_real_int64 81L); (mk_real_int64 277456L); (mk_real_int64 295172L); (mk_real_int64 24L); (mk_real_int64 116000L); (mk_real_int64 246000L); (mk_real_int64 138072L); (mk_real_int64 77125L); (mk_real_int64 184565L); (mk_real_int64 456L); (mk_real_int64 302000L); (mk_real_int64 456L); (mk_real_int64 213000L); (mk_real_int64 91456L); (mk_real_int64 212L); (mk_real_int64 152000L); (mk_real_int64 236000L); (mk_real_int64 89L); (mk_real_int64 225000L); (mk_real_int64 232L); (mk_real_int64 24145L); (mk_real_int64 520L); (mk_real_int64 36L); (mk_real_int64 308000L); (mk_real_int64 451000L); (mk_real_int64 232L); (mk_real_int64 436L); (mk_real_int64 3000L); ]); +("y6_hi", [2; 6; 20; 21; 24; 25; 27; 28; 29; 30; 38; 44; 45; 48; 51; 55; 58; 59; 65; 66; 68; 71; ], [(mk_real_int64 50L); (mk_real_int64 125L); (mk_real_int64 400L); (mk_real_int64 196L); (mk_real_int64 16L); (mk_real_int64 98L); (mk_real_int64 344L); (mk_real_int64 114L); (mk_real_int64 288L); (mk_real_int64 287L); (mk_real_int64 125L); (mk_real_int64 116L); (mk_real_int64 16L); (mk_real_int64 125L); (mk_real_int64 500L); (mk_real_int64 16L); (mk_real_int64 61L); (mk_real_int64 176L); (mk_real_int64 51L); (mk_real_int64 192L); (mk_real_int64 59L); (mk_real_int64 552L); ]); +("ye_hi", [2; 10; 23; 25; 46; 48; 51; 57; 61; 62; 70; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_lo", [1; 2; 7; 20; 26; 27; 29; 31; 50; 62; 64; 67; ], [(mk_real_int64 100000L); (mk_real_int64 112000L); (mk_real_int64 150000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 244000L); (mk_real_int64 171000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_hi", [2; 3; 6; 8; 10; 11; 12; 14; ], [(mk_real_int64 1040L); (mk_real_int64 708L); (mk_real_int64 40L); (mk_real_int64 2040L); (mk_real_int64 778L); (mk_real_int64 1440L); (mk_real_int64 560L); (mk_real_int64 1040L); ]); +("yn_lo", [0; 1; 4; 5; 7; 9; 13; ], [(mk_real_int64 212L); (mk_real_int64 212L); (mk_real_int64 136L); (mk_real_int64 648L); (mk_real_int64 1222L); (mk_real_int64 292L); (mk_real_int64 292L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/25168582633_out.hl b/formal_lp/old/ineqs/tests2/25168582633_out.hl new file mode 100644 index 0000000..96074c7 --- /dev/null +++ b/formal_lp/old/ineqs/tests2/25168582633_out.hl @@ -0,0 +1,87 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "25168582633 18 4 0 1 2 3 4 0 3 4 5 3 4 3 2 3 4 2 6 4 6 2 7 8 3 7 2 1 3 7 1 9 4 9 1 0 10 3 10 0 5 3 10 5 11 3 11 5 4 3 11 4 6 3 11 6 12 3 12 6 8 3 10 11 12 3 9 10 12 3 9 12 8 3 8 7 9 ";; +let precision = 4;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [1; 5; 6; 7; 8; 9; 12; ], [(mk_real_int64 4000L); (mk_real_int64 3909L); (mk_real_int64 4411L); (mk_real_int64 47L); (mk_real_int64 2639L); (mk_real_int64 437L); (mk_real_int64 4271L); ]); +("azim_sum_neg", [0; 4; 10; 11; ], [(mk_real_int64 299L); (mk_real_int64 1121L); (mk_real_int64 68L); (mk_real_int64 69L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 7899L); (mk_real_int64 9126L); (mk_real_int64 9126L); (mk_real_int64 9126L); (mk_real_int64 9020L); (mk_real_int64 9126L); (mk_real_int64 9126L); (mk_real_int64 9020L); (mk_real_int64 9126L); (mk_real_int64 8972L); (mk_real_int64 8558L); (mk_real_int64 8627L); (mk_real_int64 9126L); ]); +("sol_sum3_neg", [1; 2; 3; 7; 8; 11; ], [(mk_real_int64 3909L); (mk_real_int64 691L); (mk_real_int64 181L); (mk_real_int64 47L); (mk_real_int64 815L); (mk_real_int64 2793L); ]); +("sol_sum3", [5; 6; ], [(mk_real_int64 973L); (mk_real_int64 132L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 7899L); (mk_real_int64 9126L); (mk_real_int64 7867L); (mk_real_int64 8627L); (mk_real_int64 9020L); (mk_real_int64 9020L); (mk_real_int64 9020L); (mk_real_int64 9020L); (mk_real_int64 8594L); (mk_real_int64 8490L); (mk_real_int64 8972L); (mk_real_int64 8972L); (mk_real_int64 8558L); (mk_real_int64 8558L); ]); +("tau_sum4_neg", [0; 1; 2; 3; ], [(mk_real_int64 9126L); (mk_real_int64 7899L); (mk_real_int64 8558L); (mk_real_int64 9126L); ]); +("ln_def_neg", [1; 2; 3; 5; 6; 8; 12; ], [(mk_real_int64 62L); (mk_real_int64 62L); (mk_real_int64 62L); (mk_real_int64 62L); (mk_real_int64 62L); (mk_real_int64 62L); (mk_real_int64 62L); ]); +("ln_def", [0; 4; 7; 9; 10; 11; ], [(mk_real_int64 1290L); (mk_real_int64 55L); (mk_real_int64 55L); (mk_real_int64 108L); (mk_real_int64 564L); (mk_real_int64 488L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 49633L); (mk_real_int64 57339L); (mk_real_int64 57339L); (mk_real_int64 57339L); (mk_real_int64 56675L); (mk_real_int64 57339L); (mk_real_int64 57339L); (mk_real_int64 56675L); (mk_real_int64 57339L); (mk_real_int64 56372L); (mk_real_int64 53771L); (mk_real_int64 54207L); (mk_real_int64 57339L); ]); +("edge_sym", [5; 6; 10; 15; 17; 20; 32; 33; 36; 45; ], [(mk_real_int64 354L); (mk_real_int64 354L); (mk_real_int64 2218L); (mk_real_int64 596L); (mk_real_int64 683L); (mk_real_int64 42L); (mk_real_int64 111L); (mk_real_int64 247L); (mk_real_int64 561L); (mk_real_int64 281L); ]); +("edge_sym_neg", [12; 13; 23; 30; 39; 41; 42; 48; 51; 54; ], [(mk_real_int64 1278L); (mk_real_int64 1787L); (mk_real_int64 42L); (mk_real_int64 111L); (mk_real_int64 318L); (mk_real_int64 281L); (mk_real_int64 95L); (mk_real_int64 386L); (mk_real_int64 655L); (mk_real_int64 190L); ]); +("y1_def_neg", [6; 8; 10; 12; 13; 14; 15; 19; 20; 29; 30; 32; 33; 36; 38; 39; 40; 43; 47; 48; 52; 53; 55; 57; ], [(mk_real_int64 277L); (mk_real_int64 882L); (mk_real_int64 1307L); (mk_real_int64 22L); (mk_real_int64 275L); (mk_real_int64 535L); (mk_real_int64 467L); (mk_real_int64 102L); (mk_real_int64 78L); (mk_real_int64 63L); (mk_real_int64 55L); (mk_real_int64 187L); (mk_real_int64 147L); (mk_real_int64 63L); (mk_real_int64 468L); (mk_real_int64 1234L); (mk_real_int64 106L); (mk_real_int64 469L); (mk_real_int64 784L); (mk_real_int64 103L); (mk_real_int64 611L); (mk_real_int64 248L); (mk_real_int64 278L); (mk_real_int64 341L); ]); +("y1_def", [9; 21; 22; 35; 42; 49; 51; 54; ], [(mk_real_int64 124L); (mk_real_int64 23L); (mk_real_int64 69L); (mk_real_int64 64L); (mk_real_int64 310L); (mk_real_int64 1061L); (mk_real_int64 354L); (mk_real_int64 34L); ]); +("y2_def", [6; 8; 10; 12; 13; 14; 15; 20; 22; 29; 36; 38; 39; 40; 42; 43; 48; 49; 52; 53; 57; ], [(mk_real_int64 354L); (mk_real_int64 673L); (mk_real_int64 1331L); (mk_real_int64 33L); (mk_real_int64 25L); (mk_real_int64 683L); (mk_real_int64 596L); (mk_real_int64 469L); (mk_real_int64 69L); (mk_real_int64 38L); (mk_real_int64 38L); (mk_real_int64 665L); (mk_real_int64 834L); (mk_real_int64 64L); (mk_real_int64 310L); (mk_real_int64 257L); (mk_real_int64 159L); (mk_real_int64 1061L); (mk_real_int64 32L); (mk_real_int64 151L); (mk_real_int64 207L); ]); +("y2_def_neg", [9; 19; 21; 30; 32; 33; 35; 47; 51; 54; 55; ], [(mk_real_int64 72L); (mk_real_int64 102L); (mk_real_int64 7L); (mk_real_int64 55L); (mk_real_int64 283L); (mk_real_int64 147L); (mk_real_int64 580L); (mk_real_int64 784L); (mk_real_int64 108L); (mk_real_int64 10L); (mk_real_int64 323L); ]); +("y3_def", [6; 8; 10; 12; 13; 14; 15; 20; 22; 29; 36; 38; 39; 40; 42; 43; 48; 49; 52; 53; 57; ], [(mk_real_int64 354L); (mk_real_int64 673L); (mk_real_int64 1331L); (mk_real_int64 33L); (mk_real_int64 25L); (mk_real_int64 683L); (mk_real_int64 596L); (mk_real_int64 469L); (mk_real_int64 69L); (mk_real_int64 38L); (mk_real_int64 38L); (mk_real_int64 665L); (mk_real_int64 834L); (mk_real_int64 64L); (mk_real_int64 310L); (mk_real_int64 257L); (mk_real_int64 159L); (mk_real_int64 1061L); (mk_real_int64 32L); (mk_real_int64 151L); (mk_real_int64 207L); ]); +("y3_def_neg", [9; 19; 21; 30; 32; 33; 35; 47; 51; 54; 55; ], [(mk_real_int64 72L); (mk_real_int64 102L); (mk_real_int64 7L); (mk_real_int64 55L); (mk_real_int64 283L); (mk_real_int64 147L); (mk_real_int64 580L); (mk_real_int64 784L); (mk_real_int64 108L); (mk_real_int64 10L); (mk_real_int64 323L); ]); +("y4_def", [1; 9; 17; 19; 35; 38; ], [(mk_real_int64 213L); (mk_real_int64 35L); (mk_real_int64 315L); (mk_real_int64 522L); (mk_real_int64 547L); (mk_real_int64 53L); ]); +("y4_def_neg", [0; 2; 4; 5; 7; 8; 10; 13; 14; 16; 20; 22; 23; 24; 26; 27; 31; 32; 33; 36; 37; 39; 41; ], [(mk_real_int64 1267L); (mk_real_int64 2505L); (mk_real_int64 63L); (mk_real_int64 2251L); (mk_real_int64 71L); (mk_real_int64 524L); (mk_real_int64 35L); (mk_real_int64 72L); (mk_real_int64 38L); (mk_real_int64 67L); (mk_real_int64 72L); (mk_real_int64 1252L); (mk_real_int64 2620L); (mk_real_int64 121L); (mk_real_int64 160L); (mk_real_int64 683L); (mk_real_int64 545L); (mk_real_int64 299L); (mk_real_int64 547L); (mk_real_int64 661L); (mk_real_int64 284L); (mk_real_int64 164L); (mk_real_int64 389L); ]); +("y5_def", [6; 8; 10; 12; 14; 15; 20; 29; 33; 36; 38; 39; 40; 43; 48; 52; 53; 57; ], [(mk_real_int64 354L); (mk_real_int64 673L); (mk_real_int64 1331L); (mk_real_int64 33L); (mk_real_int64 683L); (mk_real_int64 596L); (mk_real_int64 71L); (mk_real_int64 38L); (mk_real_int64 315L); (mk_real_int64 38L); (mk_real_int64 665L); (mk_real_int64 934L); (mk_real_int64 64L); (mk_real_int64 281L); (mk_real_int64 159L); (mk_real_int64 103L); (mk_real_int64 151L); (mk_real_int64 207L); ]); +("y5_def_neg", [9; 13; 19; 21; 22; 30; 32; 35; 42; 47; 49; 51; 54; 55; ], [(mk_real_int64 64L); (mk_real_int64 1724L); (mk_real_int64 71L); (mk_real_int64 7L); (mk_real_int64 35L); (mk_real_int64 38L); (mk_real_int64 204L); (mk_real_int64 392L); (mk_real_int64 160L); (mk_real_int64 545L); (mk_real_int64 547L); (mk_real_int64 108L); (mk_real_int64 10L); (mk_real_int64 227L); ]); +("y6_def", [6; 8; 10; 12; 14; 15; 20; 29; 33; 34; 36; 37; 38; 39; 40; 43; 46; 48; 50; 52; 53; 55; 57; ], [(mk_real_int64 354L); (mk_real_int64 2215L); (mk_real_int64 1331L); (mk_real_int64 33L); (mk_real_int64 683L); (mk_real_int64 596L); (mk_real_int64 114L); (mk_real_int64 38L); (mk_real_int64 315L); (mk_real_int64 354L); (mk_real_int64 38L); (mk_real_int64 1394L); (mk_real_int64 853L); (mk_real_int64 934L); (mk_real_int64 477L); (mk_real_int64 281L); (mk_real_int64 596L); (mk_real_int64 159L); (mk_real_int64 1041L); (mk_real_int64 452L); (mk_real_int64 390L); (mk_real_int64 389L); (mk_real_int64 418L); ]); +("y6_def_neg", [9; 13; 19; 21; 22; 30; 32; 35; 42; 47; 49; 51; 54; ], [(mk_real_int64 64L); (mk_real_int64 1724L); (mk_real_int64 71L); (mk_real_int64 7L); (mk_real_int64 35L); (mk_real_int64 38L); (mk_real_int64 204L); (mk_real_int64 392L); (mk_real_int64 160L); (mk_real_int64 63L); (mk_real_int64 547L); (mk_real_int64 108L); (mk_real_int64 10L); ]); +("RHA", [4; 6; 7; 14; 15; 16; 18; 19; 20; 22; 23; 28; 31; 40; 41; 42; 44; 45; 46; 47; 49; 50; 56; ], [(mk_real_int64 1226L); (mk_real_int64 1226L); (mk_real_int64 1121L); (mk_real_int64 568L); (mk_real_int64 568L); (mk_real_int64 69L); (mk_real_int64 761L); (mk_real_int64 1259L); (mk_real_int64 691L); (mk_real_int64 498L); (mk_real_int64 498L); (mk_real_int64 106L); (mk_real_int64 106L); (mk_real_int64 250L); (mk_real_int64 532L); (mk_real_int64 378L); (mk_real_int64 636L); (mk_real_int64 68L); (mk_real_int64 154L); (mk_real_int64 48L); (mk_real_int64 154L); (mk_real_int64 154L); (mk_real_int64 69L); ]); +("RHB", [3; ], [(mk_real_int64 1226L); ]); +("ineq105", [6; 8; 9; ], [(mk_real_int64 880L); (mk_real_int64 1698L); (mk_real_int64 1482L); ]); +("ineq106", [0; 2; 8; 13; 20; 22; 23; 24; 27; 36; 37; 41; ], [(mk_real_int64 1226L); (mk_real_int64 1226L); (mk_real_int64 568L); (mk_real_int64 106L); (mk_real_int64 106L); (mk_real_int64 106L); (mk_real_int64 106L); (mk_real_int64 177L); (mk_real_int64 482L); (mk_real_int64 568L); (mk_real_int64 414L); (mk_real_int64 568L); ]); +("ineq107", [1; 9; 16; 19; 35; 38; 39; ], [(mk_real_int64 299L); (mk_real_int64 46L); (mk_real_int64 148L); (mk_real_int64 988L); (mk_real_int64 708L); (mk_real_int64 68L); (mk_real_int64 68L); ]); +("ineq108", [0; 2; 4; 5; 22; 23; 27; 32; 36; ], [(mk_real_int64 624L); (mk_real_int64 2431L); (mk_real_int64 92L); (mk_real_int64 502L); (mk_real_int64 1722L); (mk_real_int64 3283L); (mk_real_int64 437L); (mk_real_int64 437L); (mk_real_int64 161L); ]); +("ineq109", [17; 19; ], [(mk_real_int64 973L); (mk_real_int64 132L); ]); +("ineq110", [5; 8; 10; 23; 26; 33; ], [(mk_real_int64 3909L); (mk_real_int64 691L); (mk_real_int64 181L); (mk_real_int64 47L); (mk_real_int64 815L); (mk_real_int64 2793L); ]); +("ineq111", [1; 5; 7; 14; 16; 19; 23; 27; 31; 36; 39; ], [(mk_real_int64 145L); (mk_real_int64 9126L); (mk_real_int64 569L); (mk_real_int64 308L); (mk_real_int64 1450L); (mk_real_int64 2278L); (mk_real_int64 2316L); (mk_real_int64 428L); (mk_real_int64 4357L); (mk_real_int64 1294L); (mk_real_int64 1734L); ]); +("ineq113", [9; 14; 24; 35; ], [(mk_real_int64 788L); (mk_real_int64 4327L); (mk_real_int64 1999L); (mk_real_int64 6365L); ]); +("ineq114", [0; 2; 7; 10; 11; 12; 15; 17; 18; 20; 22; 23; 25; 28; 30; 31; 33; 36; 37; 41; ], [(mk_real_int64 5248L); (mk_real_int64 2507L); (mk_real_int64 7297L); (mk_real_int64 508L); (mk_real_int64 7331L); (mk_real_int64 4385L); (mk_real_int64 5940L); (mk_real_int64 1630L); (mk_real_int64 287L); (mk_real_int64 6455L); (mk_real_int64 3418L); (mk_real_int64 1727L); (mk_real_int64 6595L); (mk_real_int64 8062L); (mk_real_int64 4462L); (mk_real_int64 153L); (mk_real_int64 2607L); (mk_real_int64 6567L); (mk_real_int64 697L); (mk_real_int64 6823L); ]); +("ineq119", [3; 5; 11; ], [(mk_real_int64 3843L); (mk_real_int64 661L); (mk_real_int64 150L); ]); +("ineq120", [2; 4; 6; 8; 9; 12; 15; ], [(mk_real_int64 5282L); (mk_real_int64 1619L); (mk_real_int64 5619L); (mk_real_int64 4332L); (mk_real_int64 4076L); (mk_real_int64 5640L); (mk_real_int64 3485L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 43718L); (mk_real_int64 47394L); (mk_real_int64 47394L); (mk_real_int64 47394L); (mk_real_int64 42050L); (mk_real_int64 47394L); (mk_real_int64 47394L); (mk_real_int64 42050L); (mk_real_int64 47394L); (mk_real_int64 43512L); (mk_real_int64 45666L); (mk_real_int64 40922L); (mk_real_int64 47394L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [2; 4; 6; 8; 10; 12; 15; 17; 22; 23; 24; 27; 28; 30; 31; 33; 34; 35; 39; 40; 41; 46; 47; 52; 57; ], [(mk_real_int64 586L); (mk_real_int64 687L); (mk_real_int64 2687L); (mk_real_int64 2480L); (mk_real_int64 3820L); (mk_real_int64 10000L); (mk_real_int64 7548L); (mk_real_int64 500L); (mk_real_int64 10080L); (mk_real_int64 12060L); (mk_real_int64 1720L); (mk_real_int64 1905L); (mk_real_int64 100L); (mk_real_int64 3070L); (mk_real_int64 4400L); (mk_real_int64 3800L); (mk_real_int64 6620L); (mk_real_int64 10000L); (mk_real_int64 1020L); (mk_real_int64 2590L); (mk_real_int64 4700L); (mk_real_int64 2120L); (mk_real_int64 7780L); (mk_real_int64 9420L); (mk_real_int64 1980L); ]); +("azim_lo", [3; 5; 14; 18; 19; 21; 36; 38; 44; 49; 51; 53; ], [(mk_real_int64 7160L); (mk_real_int64 4330L); (mk_real_int64 3764L); (mk_real_int64 10000L); (mk_real_int64 780L); (mk_real_int64 920L); (mk_real_int64 1700L); (mk_real_int64 3320L); (mk_real_int64 1880L); (mk_real_int64 180L); (mk_real_int64 5350L); (mk_real_int64 6780L); ]); +("rhazim_lo", [4; 6; 8; 10; 22; 23; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("rhazim_hi", [3; 18; 40; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("rho_hi", [1; 2; 3; 5; 6; 8; 9; 10; 12; ], [(mk_real_int64 14832L); (mk_real_int64 14832L); (mk_real_int64 14832L); (mk_real_int64 14832L); (mk_real_int64 14832L); (mk_real_int64 14832L); (mk_real_int64 8704L); (mk_real_int64 6256L); (mk_real_int64 14832L); ]); +("rho_lo", [0; 4; 7; 11; ], [(mk_real_int64 20032L); (mk_real_int64 5360L); (mk_real_int64 5360L); (mk_real_int64 18336L); ]); +("tau_lo", [0; 5; 7; 11; 17; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 15600000L); (mk_real_int64 10000L); ]); +("tau_hi", [2; 11; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("y1_lo", [6; 8; 9; 13; 19; 20; 22; 29; 30; 36; 38; 39; 40; 42; 47; 52; 53; 55; ], [(mk_real_int64 2000L); (mk_real_int64 2400L); (mk_real_int64 6000L); (mk_real_int64 2300L); (mk_real_int64 4200L); (mk_real_int64 2200L); (mk_real_int64 2200L); (mk_real_int64 6000L); (mk_real_int64 4400L); (mk_real_int64 6000L); (mk_real_int64 2700L); (mk_real_int64 1250L); (mk_real_int64 2000L); (mk_real_int64 3000L); (mk_real_int64 2600L); (mk_real_int64 5550L); (mk_real_int64 4000L); (mk_real_int64 1200L); ]); +("y1_hi", [10; 12; 14; 15; 33; 35; 43; 48; 49; 57; ], [(mk_real_int64 1150L); (mk_real_int64 3800L); (mk_real_int64 1300L); (mk_real_int64 1700L); (mk_real_int64 770L); (mk_real_int64 280L); (mk_real_int64 650L); (mk_real_int64 3050L); (mk_real_int64 3400L); (mk_real_int64 2000L); ]); +("y2_hi", [8; 9; 12; 13; 20; 21; 29; 33; 36; 38; 39; 40; 43; 48; 49; 51; 52; 55; ], [(mk_real_int64 2150L); (mk_real_int64 4520L); (mk_real_int64 4788L); (mk_real_int64 4178L); (mk_real_int64 2752L); (mk_real_int64 80L); (mk_real_int64 5734L); (mk_real_int64 770L); (mk_real_int64 5734L); (mk_real_int64 2092L); (mk_real_int64 2371L); (mk_real_int64 4103L); (mk_real_int64 3841L); (mk_real_int64 243L); (mk_real_int64 3400L); (mk_real_int64 3840L); (mk_real_int64 3631L); (mk_real_int64 5440L); ]); +("y2_lo", [6; 10; 14; 15; 19; 22; 30; 32; 35; 42; 47; 53; 54; 57; ], [(mk_real_int64 2400L); (mk_real_int64 2177L); (mk_real_int64 4040L); (mk_real_int64 2360L); (mk_real_int64 4200L); (mk_real_int64 2200L); (mk_real_int64 4400L); (mk_real_int64 4960L); (mk_real_int64 1480L); (mk_real_int64 3000L); (mk_real_int64 2600L); (mk_real_int64 3454L); (mk_real_int64 3360L); (mk_real_int64 3048L); ]); +("y3_hi", [8; 9; 12; 13; 20; 21; 29; 33; 36; 38; 39; 40; 43; 48; 49; 51; 52; 55; ], [(mk_real_int64 2150L); (mk_real_int64 4520L); (mk_real_int64 4788L); (mk_real_int64 4178L); (mk_real_int64 2752L); (mk_real_int64 80L); (mk_real_int64 5734L); (mk_real_int64 770L); (mk_real_int64 5734L); (mk_real_int64 2092L); (mk_real_int64 2371L); (mk_real_int64 4103L); (mk_real_int64 3841L); (mk_real_int64 243L); (mk_real_int64 3400L); (mk_real_int64 3840L); (mk_real_int64 3631L); (mk_real_int64 5440L); ]); +("y3_lo", [6; 10; 14; 15; 19; 22; 30; 32; 35; 42; 47; 53; 54; 57; ], [(mk_real_int64 2400L); (mk_real_int64 2177L); (mk_real_int64 4040L); (mk_real_int64 2360L); (mk_real_int64 4200L); (mk_real_int64 2200L); (mk_real_int64 4400L); (mk_real_int64 4960L); (mk_real_int64 1480L); (mk_real_int64 3000L); (mk_real_int64 2600L); (mk_real_int64 3454L); (mk_real_int64 3360L); (mk_real_int64 3048L); ]); +("y4_lo", [0; 2; 4; 7; 8; 10; 13; 14; 17; 19; 20; 22; 23; 24; 27; 32; 33; 36; 38; 39; 41; ], [(mk_real_int64 2500L); (mk_real_int64 450L); (mk_real_int64 200L); (mk_real_int64 1250L); (mk_real_int64 5160L); (mk_real_int64 4760L); (mk_real_int64 6100L); (mk_real_int64 5000L); (mk_real_int64 5264L); (mk_real_int64 3636L); (mk_real_int64 6100L); (mk_real_int64 1800L); (mk_real_int64 1770L); (mk_real_int64 2450L); (mk_real_int64 150L); (mk_real_int64 3450L); (mk_real_int64 4280L); (mk_real_int64 1150L); (mk_real_int64 4360L); (mk_real_int64 1860L); (mk_real_int64 800L); ]); +("y4_hi", [1; 5; 9; 16; 26; 31; 35; 37; ], [(mk_real_int64 20L); (mk_real_int64 2160L); (mk_real_int64 5580L); (mk_real_int64 1540L); (mk_real_int64 2600L); (mk_real_int64 3750L); (mk_real_int64 2840L); (mk_real_int64 4100L); ]); +("y5_hi", [8; 9; 12; 20; 21; 29; 32; 36; 38; 39; 40; 42; 47; 48; 51; 52; ], [(mk_real_int64 2150L); (mk_real_int64 4270L); (mk_real_int64 4788L); (mk_real_int64 2592L); (mk_real_int64 80L); (mk_real_int64 5734L); (mk_real_int64 2540L); (mk_real_int64 5734L); (mk_real_int64 2092L); (mk_real_int64 5451L); (mk_real_int64 4103L); (mk_real_int64 2600L); (mk_real_int64 3750L); (mk_real_int64 243L); (mk_real_int64 3840L); (mk_real_int64 5331L); ]); +("y5_lo", [6; 10; 13; 14; 15; 19; 22; 30; 33; 35; 43; 49; 53; 54; 55; 57; ], [(mk_real_int64 2400L); (mk_real_int64 2177L); (mk_real_int64 2362L); (mk_real_int64 4040L); (mk_real_int64 2360L); (mk_real_int64 1250L); (mk_real_int64 4760L); (mk_real_int64 5000L); (mk_real_int64 5264L); (mk_real_int64 2636L); (mk_real_int64 759L); (mk_real_int64 4280L); (mk_real_int64 3454L); (mk_real_int64 3360L); (mk_real_int64 860L); (mk_real_int64 3048L); ]); +("y6_hi", [8; 9; 12; 21; 29; 32; 36; 38; 39; 40; 42; 48; 51; 52; 53; ], [(mk_real_int64 2150L); (mk_real_int64 4270L); (mk_real_int64 4788L); (mk_real_int64 80L); (mk_real_int64 5734L); (mk_real_int64 2540L); (mk_real_int64 5734L); (mk_real_int64 2092L); (mk_real_int64 5451L); (mk_real_int64 4103L); (mk_real_int64 2600L); (mk_real_int64 243L); (mk_real_int64 3840L); (mk_real_int64 5331L); (mk_real_int64 6546L); ]); +("y6_lo", [6; 8; 10; 13; 14; 15; 19; 20; 22; 30; 33; 34; 35; 37; 38; 40; 43; 46; 47; 49; 50; 52; 53; 54; 55; 57; ], [(mk_real_int64 2400L); (mk_real_int64 15420000L); (mk_real_int64 2177L); (mk_real_int64 2362L); (mk_real_int64 4040L); (mk_real_int64 2360L); (mk_real_int64 1250L); (mk_real_int64 427408L); (mk_real_int64 4760L); (mk_real_int64 5000L); (mk_real_int64 5264L); (mk_real_int64 3540000L); (mk_real_int64 2636L); (mk_real_int64 13940000L); (mk_real_int64 1880000L); (mk_real_int64 4130000L); (mk_real_int64 759L); (mk_real_int64 5960000L); (mk_real_int64 4816250L); (mk_real_int64 4280L); (mk_real_int64 10410000L); (mk_real_int64 3490000L); (mk_real_int64 2400000L); (mk_real_int64 3360L); (mk_real_int64 6160860L); (mk_real_int64 2113048L); ]); +("ye_lo", [10; 12; 36; 40; 42; 46; 54; ], [(mk_real_int64 10000L); (mk_real_int64 4130000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("ye_hi", [14; 18; 20; 30; 33; 34; 47; 52; 56; 57; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("yn_hi", [0; 2; 3; 5; 6; 7; 8; 10; 11; 12; ], [(mk_real_int64 13300L); (mk_real_int64 12322L); (mk_real_int64 12322L); (mk_real_int64 2322L); (mk_real_int64 2322L); (mk_real_int64 2350L); (mk_real_int64 2322L); (mk_real_int64 14280L); (mk_real_int64 5760L); (mk_real_int64 2322L); ]); +("yn_lo", [1; 4; 9; ], [(mk_real_int64 7678L); (mk_real_int64 7650L); (mk_real_int64 6840L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/30500231120_out.hl b/formal_lp/old/ineqs/tests2/30500231120_out.hl new file mode 100644 index 0000000..75a9f6f --- /dev/null +++ b/formal_lp/old/ineqs/tests2/30500231120_out.hl @@ -0,0 +1,80 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "30500231120 20 4 0 1 2 3 3 0 3 4 3 4 3 5 3 5 3 6 3 6 3 2 3 6 2 7 3 7 2 1 3 7 1 8 3 8 1 9 3 9 1 0 4 9 0 4 10 3 10 4 11 3 11 4 5 4 11 5 12 13 3 12 5 6 4 12 6 7 8 3 13 12 8 3 13 8 9 3 13 9 10 3 10 11 13 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum_neg", [1; 2; 6; 7; 11; 12; ], [(mk_real_int64 276L); (mk_real_int64 28L); (mk_real_int64 28L); (mk_real_int64 276L); (mk_real_int64 258L); (mk_real_int64 258L); ]); +("azim_sum", [0; 4; 5; 9; 10; 13; ], [(mk_real_int64 291L); (mk_real_int64 18L); (mk_real_int64 292L); (mk_real_int64 291L); (mk_real_int64 292L); (mk_real_int64 18L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 993L); (mk_real_int64 993L); (mk_real_int64 1021L); (mk_real_int64 993L); (mk_real_int64 1003L); (mk_real_int64 993L); (mk_real_int64 1021L); (mk_real_int64 993L); (mk_real_int64 993L); (mk_real_int64 993L); (mk_real_int64 993L); (mk_real_int64 993L); (mk_real_int64 993L); (mk_real_int64 1003L); ]); +("sol_sum3_neg", [1; 2; 7; 13; ], [(mk_real_int64 134L); (mk_real_int64 48L); (mk_real_int64 48L); (mk_real_int64 134L); ]); +("sol_sum3", [3; 4; 5; 6; 9; 10; 14; 15; ], [(mk_real_int64 123L); (mk_real_int64 174L); (mk_real_int64 174L); (mk_real_int64 123L); (mk_real_int64 175L); (mk_real_int64 114L); (mk_real_int64 114L); (mk_real_int64 175L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; ], [(mk_real_int64 993L); (mk_real_int64 886L); (mk_real_int64 945L); (mk_real_int64 993L); (mk_real_int64 891L); (mk_real_int64 891L); (mk_real_int64 993L); (mk_real_int64 945L); (mk_real_int64 993L); (mk_real_int64 909L); (mk_real_int64 993L); (mk_real_int64 993L); (mk_real_int64 993L); (mk_real_int64 886L); (mk_real_int64 993L); (mk_real_int64 909L); ]); +("tau_sum4_neg", [0; 1; 2; 3; ], [(mk_real_int64 993L); (mk_real_int64 993L); (mk_real_int64 993L); (mk_real_int64 993L); ]); +("ln_def_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 94L); (mk_real_int64 94L); (mk_real_int64 125L); (mk_real_int64 94L); (mk_real_int64 106L); (mk_real_int64 94L); (mk_real_int64 125L); (mk_real_int64 94L); (mk_real_int64 94L); (mk_real_int64 94L); (mk_real_int64 94L); (mk_real_int64 94L); (mk_real_int64 94L); (mk_real_int64 106L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 6237L); (mk_real_int64 6237L); (mk_real_int64 6413L); (mk_real_int64 6237L); (mk_real_int64 6301L); (mk_real_int64 6237L); (mk_real_int64 6413L); (mk_real_int64 6237L); (mk_real_int64 6237L); (mk_real_int64 6237L); (mk_real_int64 6237L); (mk_real_int64 6237L); (mk_real_int64 6237L); (mk_real_int64 6301L); ]); +("edge_sym_neg", [5; 8; 9; 11; 54; 57; ], [(mk_real_int64 60L); (mk_real_int64 13L); (mk_real_int64 134L); (mk_real_int64 141L); (mk_real_int64 60L); (mk_real_int64 134L); ]); +("edge_sym", [12; 23; 26; 27; ], [(mk_real_int64 13L); (mk_real_int64 141L); (mk_real_int64 13L); (mk_real_int64 13L); ]); +("y1_def_neg", [5; 8; 10; 11; 13; 14; 16; 18; 21; 24; 27; 30; 36; 39; 40; 46; 53; 55; 56; 63; ], [(mk_real_int64 87L); (mk_real_int64 66L); (mk_real_int64 52L); (mk_real_int64 26L); (mk_real_int64 19L); (mk_real_int64 24L); (mk_real_int64 26L); (mk_real_int64 81L); (mk_real_int64 108L); (mk_real_int64 24L); (mk_real_int64 78L); (mk_real_int64 95L); (mk_real_int64 108L); (mk_real_int64 21L); (mk_real_int64 17L); (mk_real_int64 95L); (mk_real_int64 87L); (mk_real_int64 41L); (mk_real_int64 66L); (mk_real_int64 108L); ]); +("y1_def", [9; 15; 22; 38; 57; 60; ], [(mk_real_int64 10L); (mk_real_int64 76L); (mk_real_int64 58L); (mk_real_int64 72L); (mk_real_int64 51L); (mk_real_int64 34L); ]); +("y2_def_neg", [5; 11; 13; 14; 15; 16; 18; 21; 22; 24; 30; 36; 38; 39; 40; 46; 53; 55; 60; 63; ], [(mk_real_int64 87L); (mk_real_int64 26L); (mk_real_int64 19L); (mk_real_int64 24L); (mk_real_int64 23L); (mk_real_int64 26L); (mk_real_int64 81L); (mk_real_int64 108L); (mk_real_int64 42L); (mk_real_int64 24L); (mk_real_int64 95L); (mk_real_int64 108L); (mk_real_int64 22L); (mk_real_int64 21L); (mk_real_int64 17L); (mk_real_int64 95L); (mk_real_int64 87L); (mk_real_int64 41L); (mk_real_int64 60L); (mk_real_int64 108L); ]); +("y2_def", [8; 9; 10; 27; 56; 57; ], [(mk_real_int64 42L); (mk_real_int64 10L); (mk_real_int64 53L); (mk_real_int64 27L); (mk_real_int64 42L); (mk_real_int64 51L); ]); +("y3_def_neg", [5; 11; 13; 14; 15; 16; 18; 21; 22; 24; 30; 36; 38; 39; 40; 46; 53; 55; 60; 63; ], [(mk_real_int64 87L); (mk_real_int64 26L); (mk_real_int64 19L); (mk_real_int64 24L); (mk_real_int64 23L); (mk_real_int64 26L); (mk_real_int64 81L); (mk_real_int64 108L); (mk_real_int64 42L); (mk_real_int64 24L); (mk_real_int64 95L); (mk_real_int64 108L); (mk_real_int64 22L); (mk_real_int64 21L); (mk_real_int64 17L); (mk_real_int64 95L); (mk_real_int64 87L); (mk_real_int64 41L); (mk_real_int64 60L); (mk_real_int64 108L); ]); +("y3_def", [8; 9; 10; 27; 56; 57; ], [(mk_real_int64 42L); (mk_real_int64 10L); (mk_real_int64 53L); (mk_real_int64 27L); (mk_real_int64 42L); (mk_real_int64 51L); ]); +("y4_def_neg", [1; 4; 5; 6; 7; 10; 14; 20; 23; 26; 31; 34; 37; 39; 40; 41; ], [(mk_real_int64 60L); (mk_real_int64 79L); (mk_real_int64 55L); (mk_real_int64 100L); (mk_real_int64 40L); (mk_real_int64 17L); (mk_real_int64 56L); (mk_real_int64 17L); (mk_real_int64 141L); (mk_real_int64 66L); (mk_real_int64 15L); (mk_real_int64 66L); (mk_real_int64 60L); (mk_real_int64 29L); (mk_real_int64 79L); (mk_real_int64 26L); ]); +("y4_def", [9; 11; 12; 18; 30; 32; 44; ], [(mk_real_int64 40L); (mk_real_int64 118L); (mk_real_int64 56L); (mk_real_int64 158L); (mk_real_int64 112L); (mk_real_int64 37L); (mk_real_int64 134L); ]); +("y5_def_neg", [5; 9; 11; 14; 15; 18; 24; 30; 38; 39; 46; 53; 55; 57; ], [(mk_real_int64 60L); (mk_real_int64 55L); (mk_real_int64 40L); (mk_real_int64 17L); (mk_real_int64 23L); (mk_real_int64 56L); (mk_real_int64 17L); (mk_real_int64 66L); (mk_real_int64 22L); (mk_real_int64 15L); (mk_real_int64 66L); (mk_real_int64 60L); (mk_real_int64 29L); (mk_real_int64 26L); ]); +("y5_def", [8; 10; 13; 16; 22; 27; 40; 56; ], [(mk_real_int64 42L); (mk_real_int64 53L); (mk_real_int64 40L); (mk_real_int64 56L); (mk_real_int64 17L); (mk_real_int64 13L); (mk_real_int64 37L); (mk_real_int64 42L); ]); +("y6_def_neg", [5; 9; 11; 14; 15; 18; 24; 38; 39; 46; 57; ], [(mk_real_int64 60L); (mk_real_int64 55L); (mk_real_int64 40L); (mk_real_int64 17L); (mk_real_int64 23L); (mk_real_int64 56L); (mk_real_int64 17L); (mk_real_int64 22L); (mk_real_int64 15L); (mk_real_int64 13L); (mk_real_int64 26L); ]); +("y6_def", [4; 7; 8; 10; 13; 16; 22; 27; 28; 29; 40; 45; 47; 52; 55; 56; ], [(mk_real_int64 60L); (mk_real_int64 73L); (mk_real_int64 42L); (mk_real_int64 53L); (mk_real_int64 40L); (mk_real_int64 56L); (mk_real_int64 17L); (mk_real_int64 13L); (mk_real_int64 53L); (mk_real_int64 66L); (mk_real_int64 37L); (mk_real_int64 66L); (mk_real_int64 66L); (mk_real_int64 60L); (mk_real_int64 45L); (mk_real_int64 42L); ]); +("RHA", [1; 6; 7; 9; 11; 12; 13; 16; 17; 18; 19; 20; 21; 23; 25; 26; 29; 33; 35; 36; 37; 39; 44; 47; 49; 52; 55; 57; 58; 61; 62; 63; ], [(mk_real_int64 28L); (mk_real_int64 10L); (mk_real_int64 116L); (mk_real_int64 106L); (mk_real_int64 48L); (mk_real_int64 76L); (mk_real_int64 28L); (mk_real_int64 129L); (mk_real_int64 101L); (mk_real_int64 101L); (mk_real_int64 101L); (mk_real_int64 101L); (mk_real_int64 129L); (mk_real_int64 28L); (mk_real_int64 48L); (mk_real_int64 76L); (mk_real_int64 28L); (mk_real_int64 10L); (mk_real_int64 83L); (mk_real_int64 94L); (mk_real_int64 83L); (mk_real_int64 10L); (mk_real_int64 10L); (mk_real_int64 28L); (mk_real_int64 28L); (mk_real_int64 10L); (mk_real_int64 116L); (mk_real_int64 106L); (mk_real_int64 10L); (mk_real_int64 83L); (mk_real_int64 83L); (mk_real_int64 94L); ]); +("ineq106", [4; 6; 23; 40; ], [(mk_real_int64 106L); (mk_real_int64 48L); (mk_real_int64 48L); (mk_real_int64 106L); ]); +("ineq107", [11; 18; 30; 44; ], [(mk_real_int64 152L); (mk_real_int64 152L); (mk_real_int64 145L); (mk_real_int64 145L); ]); +("ineq108", [4; 6; 23; 40; ], [(mk_real_int64 9L); (mk_real_int64 99L); (mk_real_int64 99L); (mk_real_int64 9L); ]); +("ineq109", [9; 12; 17; 18; 28; 32; 44; 47; ], [(mk_real_int64 123L); (mk_real_int64 174L); (mk_real_int64 174L); (mk_real_int64 123L); (mk_real_int64 175L); (mk_real_int64 114L); (mk_real_int64 114L); (mk_real_int64 175L); ]); +("ineq110", [5; 7; 23; 41; ], [(mk_real_int64 134L); (mk_real_int64 48L); (mk_real_int64 48L); (mk_real_int64 134L); ]); +("ineq111", [1; 5; 7; 10; 14; 17; 20; 23; 26; 28; 31; 34; 37; 39; 44; 47; ], [(mk_real_int64 483L); (mk_real_int64 228L); (mk_real_int64 248L); (mk_real_int64 134L); (mk_real_int64 451L); (mk_real_int64 451L); (mk_real_int64 134L); (mk_real_int64 248L); (mk_real_int64 526L); (mk_real_int64 452L); (mk_real_int64 118L); (mk_real_int64 526L); (mk_real_int64 483L); (mk_real_int64 228L); (mk_real_int64 118L); (mk_real_int64 452L); ]); +("ineq114", [1; 2; 4; 5; 6; 7; 9; 10; 12; 17; 19; 20; 21; 23; 24; 28; 31; 32; 34; 36; 38; 40; 41; 42; 43; 47; ], [(mk_real_int64 465L); (mk_real_int64 45L); (mk_real_int64 236L); (mk_real_int64 422L); (mk_real_int64 232L); (mk_real_int64 465L); (mk_real_int64 197L); (mk_real_int64 662L); (mk_real_int64 440L); (mk_real_int64 440L); (mk_real_int64 197L); (mk_real_int64 662L); (mk_real_int64 465L); (mk_real_int64 232L); (mk_real_int64 467L); (mk_real_int64 457L); (mk_real_int64 226L); (mk_real_int64 648L); (mk_real_int64 467L); (mk_real_int64 45L); (mk_real_int64 465L); (mk_real_int64 236L); (mk_real_int64 422L); (mk_real_int64 226L); (mk_real_int64 648L); (mk_real_int64 457L); ]); +("ineq119", [2; 7; 8; 14; ], [(mk_real_int64 609L); (mk_real_int64 570L); (mk_real_int64 570L); (mk_real_int64 609L); ]); +("ineq120", [3; 4; 6; 9; 11; 15; ], [(mk_real_int64 384L); (mk_real_int64 386L); (mk_real_int64 37L); (mk_real_int64 386L); (mk_real_int64 37L); (mk_real_int64 384L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 2525L); (mk_real_int64 2525L); (mk_real_int64 2725L); (mk_real_int64 2525L); (mk_real_int64 3325L); (mk_real_int64 2525L); (mk_real_int64 2725L); (mk_real_int64 2525L); (mk_real_int64 2525L); (mk_real_int64 2525L); (mk_real_int64 2525L); (mk_real_int64 2525L); (mk_real_int64 2525L); (mk_real_int64 3325L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_lo", [8; 34; 36; 38; 39; 40; 41; 56; 58; 59; 60; 63; ], [(mk_real_int64 264L); (mk_real_int64 210L); (mk_real_int64 918L); (mk_real_int64 1000L); (mk_real_int64 524L); (mk_real_int64 352L); (mk_real_int64 210L); (mk_real_int64 264L); (mk_real_int64 524L); (mk_real_int64 352L); (mk_real_int64 1000L); (mk_real_int64 918L); ]); +("azim_hi", [2; 3; 5; 6; 9; 10; 11; 13; 14; 15; 16; 17; 18; 19; 20; 21; 22; 23; 24; 25; 27; 28; 31; 33; 42; 44; 46; 50; 51; 52; 54; 57; ], [(mk_real_int64 123L); (mk_real_int64 72L); (mk_real_int64 90L); (mk_real_int64 170L); (mk_real_int64 172L); (mk_real_int64 232L); (mk_real_int64 90L); (mk_real_int64 322L); (mk_real_int64 412L); (mk_real_int64 1000L); (mk_real_int64 440L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 440L); (mk_real_int64 1000L); (mk_real_int64 322L); (mk_real_int64 412L); (mk_real_int64 90L); (mk_real_int64 232L); (mk_real_int64 342L); (mk_real_int64 588L); (mk_real_int64 46L); (mk_real_int64 588L); (mk_real_int64 46L); (mk_real_int64 342L); (mk_real_int64 123L); (mk_real_int64 72L); (mk_real_int64 170L); (mk_real_int64 90L); (mk_real_int64 172L); ]); +("rhazim_lo", [7; 8; 9; 16; 17; 18; 19; 20; 21; 35; 37; 55; 56; 57; 61; 62; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 3012L); (mk_real_int64 3012L); (mk_real_int64 2964L); (mk_real_int64 3012L); (mk_real_int64 1852L); (mk_real_int64 3012L); (mk_real_int64 2964L); (mk_real_int64 3012L); (mk_real_int64 3012L); (mk_real_int64 3012L); (mk_real_int64 3012L); (mk_real_int64 3012L); (mk_real_int64 3012L); (mk_real_int64 1852L); ]); +("tau_lo", [12; 18; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("y1_hi", [5; 8; 13; 21; 30; 36; 38; 46; 53; 56; 60; 63; ], [(mk_real_int64 60L); (mk_real_int64 285L); (mk_real_int64 427L); (mk_real_int64 546L); (mk_real_int64 320L); (mk_real_int64 215L); (mk_real_int64 500L); (mk_real_int64 320L); (mk_real_int64 60L); (mk_real_int64 285L); (mk_real_int64 46L); (mk_real_int64 215L); ]); +("y1_lo", [9; 10; 11; 14; 16; 18; 22; 24; 27; 39; 40; 55; 57; ], [(mk_real_int64 120L); (mk_real_int64 65L); (mk_real_int64 400L); (mk_real_int64 120L); (mk_real_int64 274L); (mk_real_int64 180L); (mk_real_int64 573L); (mk_real_int64 120L); (mk_real_int64 465L); (mk_real_int64 240L); (mk_real_int64 214L); (mk_real_int64 40L); (mk_real_int64 80L); ]); +("y2_hi", [5; 10; 13; 21; 22; 27; 30; 36; 46; 53; 63; ], [(mk_real_int64 60L); (mk_real_int64 508L); (mk_real_int64 427L); (mk_real_int64 546L); (mk_real_int64 323L); (mk_real_int64 108L); (mk_real_int64 320L); (mk_real_int64 215L); (mk_real_int64 320L); (mk_real_int64 60L); (mk_real_int64 215L); ]); +("y2_lo", [8; 9; 11; 14; 15; 16; 18; 24; 38; 39; 40; 55; 56; 57; 60; ], [(mk_real_int64 140L); (mk_real_int64 120L); (mk_real_int64 400L); (mk_real_int64 120L); (mk_real_int64 104L); (mk_real_int64 274L); (mk_real_int64 180L); (mk_real_int64 120L); (mk_real_int64 40L); (mk_real_int64 240L); (mk_real_int64 214L); (mk_real_int64 40L); (mk_real_int64 140L); (mk_real_int64 80L); (mk_real_int64 494L); ]); +("y3_hi", [5; 10; 13; 21; 22; 27; 30; 36; 46; 53; 63; ], [(mk_real_int64 60L); (mk_real_int64 508L); (mk_real_int64 427L); (mk_real_int64 546L); (mk_real_int64 323L); (mk_real_int64 108L); (mk_real_int64 320L); (mk_real_int64 215L); (mk_real_int64 320L); (mk_real_int64 60L); (mk_real_int64 215L); ]); +("y3_lo", [8; 9; 11; 14; 15; 16; 18; 24; 38; 39; 40; 55; 56; 57; 60; ], [(mk_real_int64 140L); (mk_real_int64 120L); (mk_real_int64 400L); (mk_real_int64 120L); (mk_real_int64 104L); (mk_real_int64 274L); (mk_real_int64 180L); (mk_real_int64 120L); (mk_real_int64 40L); (mk_real_int64 240L); (mk_real_int64 214L); (mk_real_int64 40L); (mk_real_int64 140L); (mk_real_int64 80L); (mk_real_int64 494L); ]); +("y4_hi", [4; 5; 10; 12; 17; 20; 26; 28; 30; 31; 34; 39; 40; 44; 47; ], [(mk_real_int64 225L); (mk_real_int64 236L); (mk_real_int64 250L); (mk_real_int64 376L); (mk_real_int64 1L); (mk_real_int64 250L); (mk_real_int64 250L); (mk_real_int64 200L); (mk_real_int64 85L); (mk_real_int64 250L); (mk_real_int64 250L); (mk_real_int64 500L); (mk_real_int64 225L); (mk_real_int64 271L); (mk_real_int64 200L); ]); +("y4_lo", [1; 6; 7; 9; 11; 14; 18; 23; 32; 37; 41; ], [(mk_real_int64 375L); (mk_real_int64 695L); (mk_real_int64 408L); (mk_real_int64 148L); (mk_real_int64 504L); (mk_real_int64 375L); (mk_real_int64 652L); (mk_real_int64 103L); (mk_real_int64 64L); (mk_real_int64 375L); (mk_real_int64 264L); ]); +("y5_hi", [9; 10; 14; 16; 21; 24; 27; 30; 36; 39; 46; 55; 60; 63; ], [(mk_real_int64 236L); (mk_real_int64 508L); (mk_real_int64 250L); (mk_real_int64 376L); (mk_real_int64 1L); (mk_real_int64 250L); (mk_real_int64 100L); (mk_real_int64 250L); (mk_real_int64 200L); (mk_real_int64 250L); (mk_real_int64 250L); (mk_real_int64 500L); (mk_real_int64 146L); (mk_real_int64 200L); ]); +("y5_lo", [5; 8; 11; 13; 15; 18; 22; 38; 40; 53; 56; 57; ], [(mk_real_int64 375L); (mk_real_int64 140L); (mk_real_int64 408L); (mk_real_int64 148L); (mk_real_int64 104L); (mk_real_int64 375L); (mk_real_int64 252L); (mk_real_int64 40L); (mk_real_int64 64L); (mk_real_int64 375L); (mk_real_int64 140L); (mk_real_int64 264L); ]); +("y6_lo", [4; 5; 7; 8; 11; 13; 15; 18; 22; 28; 29; 30; 38; 40; 45; 46; 47; 52; 53; 55; 56; 57; ], [(mk_real_int64 60000L); (mk_real_int64 375L); (mk_real_int64 73000L); (mk_real_int64 140L); (mk_real_int64 408L); (mk_real_int64 148L); (mk_real_int64 104L); (mk_real_int64 375L); (mk_real_int64 252L); (mk_real_int64 53000L); (mk_real_int64 66000L); (mk_real_int64 66000L); (mk_real_int64 40L); (mk_real_int64 64L); (mk_real_int64 66000L); (mk_real_int64 53000L); (mk_real_int64 66000L); (mk_real_int64 60000L); (mk_real_int64 60375L); (mk_real_int64 73500L); (mk_real_int64 140L); (mk_real_int64 264L); ]); +("y6_hi", [9; 10; 14; 16; 21; 24; 27; 30; 36; 39; 46; 60; 63; ], [(mk_real_int64 236L); (mk_real_int64 508L); (mk_real_int64 250L); (mk_real_int64 376L); (mk_real_int64 1L); (mk_real_int64 250L); (mk_real_int64 100L); (mk_real_int64 250L); (mk_real_int64 200L); (mk_real_int64 250L); (mk_real_int64 250L); (mk_real_int64 146L); (mk_real_int64 200L); ]); +("ye_hi", [11; 55; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_lo", [6; ], [(mk_real_int64 60000L); ]); +("yn_lo", [0; 1; 2; 3; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 1144L); (mk_real_int64 1144L); (mk_real_int64 1500L); (mk_real_int64 1144L); (mk_real_int64 144L); (mk_real_int64 500L); (mk_real_int64 144L); (mk_real_int64 1144L); (mk_real_int64 1144L); (mk_real_int64 144L); (mk_real_int64 1144L); (mk_real_int64 1144L); ]); +("yn_hi", [4; 13; ], [(mk_real_int64 944L); (mk_real_int64 944L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/4436579732_out.hl b/formal_lp/old/ineqs/tests2/4436579732_out.hl new file mode 100644 index 0000000..6a6ab22 --- /dev/null +++ b/formal_lp/old/ineqs/tests2/4436579732_out.hl @@ -0,0 +1,91 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "4436579732 19 4 0 1 2 3 3 0 3 4 3 4 3 5 3 5 3 2 3 5 2 6 3 6 2 1 3 6 1 7 3 7 1 0 4 7 0 8 9 3 8 0 4 3 8 4 10 3 10 4 5 4 10 5 6 11 3 11 6 7 3 11 7 9 3 9 8 12 3 12 8 10 3 12 10 11 3 11 9 12 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [3; 10; ], [(mk_real_int64 141L); (mk_real_int64 2L); ]); +("azim_sum_neg", [0; 1; 2; 4; 8; 11; 12; ], [(mk_real_int64 58L); (mk_real_int64 94L); (mk_real_int64 53L); (mk_real_int64 5L); (mk_real_int64 61L); (mk_real_int64 341L); (mk_real_int64 271L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 605L); (mk_real_int64 642L); (mk_real_int64 601L); (mk_real_int64 940L); (mk_real_int64 940L); (mk_real_int64 1142L); (mk_real_int64 1142L); (mk_real_int64 940L); (mk_real_int64 1001L); (mk_real_int64 1142L); (mk_real_int64 1142L); (mk_real_int64 940L); (mk_real_int64 860L); ]); +("sol_sum3_neg", [0; 1; 3; 5; 6; 10; ], [(mk_real_int64 180L); (mk_real_int64 269L); (mk_real_int64 347L); (mk_real_int64 314L); (mk_real_int64 186L); (mk_real_int64 202L); ]); +("sol_sum3", [12; 15; ], [(mk_real_int64 271L); (mk_real_int64 271L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; ], [(mk_real_int64 605L); (mk_real_int64 605L); (mk_real_int64 548L); (mk_real_int64 642L); (mk_real_int64 548L); (mk_real_int64 601L); (mk_real_int64 601L); (mk_real_int64 935L); (mk_real_int64 940L); (mk_real_int64 935L); (mk_real_int64 940L); (mk_real_int64 940L); (mk_real_int64 860L); (mk_real_int64 860L); (mk_real_int64 860L); (mk_real_int64 860L); ]); +("tau_sum4_neg", [0; 1; 2; ], [(mk_real_int64 548L); (mk_real_int64 940L); (mk_real_int64 1142L); ]); +("ln_def_neg", [3; 4; 5; 6; 7; 8; 9; 10; 11; ], [(mk_real_int64 36L); (mk_real_int64 36L); (mk_real_int64 259L); (mk_real_int64 259L); (mk_real_int64 36L); (mk_real_int64 103L); (mk_real_int64 259L); (mk_real_int64 259L); (mk_real_int64 36L); ]); +("ln_def", [0; 1; 2; 12; ], [(mk_real_int64 332L); (mk_real_int64 292L); (mk_real_int64 338L); (mk_real_int64 52L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 3804L); (mk_real_int64 4034L); (mk_real_int64 3774L); (mk_real_int64 5903L); (mk_real_int64 5903L); (mk_real_int64 7174L); (mk_real_int64 7174L); (mk_real_int64 5903L); (mk_real_int64 6287L); (mk_real_int64 7174L); (mk_real_int64 7174L); (mk_real_int64 5903L); (mk_real_int64 5401L); ]); +("edge_sym", [0; 3; 6; 9; 12; 15; 18; 21; 49; 50; 53; ], [(mk_real_int64 47L); (mk_real_int64 47L); (mk_real_int64 112L); (mk_real_int64 217L); (mk_real_int64 148L); (mk_real_int64 251L); (mk_real_int64 148L); (mk_real_int64 189L); (mk_real_int64 44L); (mk_real_int64 54L); (mk_real_int64 21L); ]); +("edge_sym_neg", [5; 8; 14; 20; 27; 34; 41; 44; 47; 56; ], [(mk_real_int64 116L); (mk_real_int64 148L); (mk_real_int64 148L); (mk_real_int64 137L); (mk_real_int64 54L); (mk_real_int64 77L); (mk_real_int64 229L); (mk_real_int64 187L); (mk_real_int64 123L); (mk_real_int64 113L); ]); +("y1_def_neg", [0; 7; 9; 10; 12; 16; 17; 19; 29; 31; 33; 34; 35; 36; 42; 45; 48; 49; 50; 53; 55; 57; 58; ], [(mk_real_int64 37L); (mk_real_int64 36L); (mk_real_int64 28L); (mk_real_int64 356L); (mk_real_int64 99L); (mk_real_int64 356L); (mk_real_int64 99L); (mk_real_int64 35L); (mk_real_int64 49L); (mk_real_int64 56L); (mk_real_int64 95L); (mk_real_int64 44L); (mk_real_int64 124L); (mk_real_int64 109L); (mk_real_int64 170L); (mk_real_int64 110L); (mk_real_int64 6L); (mk_real_int64 54L); (mk_real_int64 41L); (mk_real_int64 50L); (mk_real_int64 52L); (mk_real_int64 148L); (mk_real_int64 47L); ]); +("y1_def", [4; 5; 8; 14; 15; 20; 21; 23; 24; 44; 47; 51; 54; ], [(mk_real_int64 29L); (mk_real_int64 119L); (mk_real_int64 163L); (mk_real_int64 195L); (mk_real_int64 132L); (mk_real_int64 181L); (mk_real_int64 114L); (mk_real_int64 120L); (mk_real_int64 29L); (mk_real_int64 178L); (mk_real_int64 171L); (mk_real_int64 30L); (mk_real_int64 119L); ]); +("y2_def", [0; 4; 7; 9; 10; 15; 16; 21; 24; 29; 34; 35; 44; 48; 53; 55; 57; ], [(mk_real_int64 47L); (mk_real_int64 92L); (mk_real_int64 22L); (mk_real_int64 79L); (mk_real_int64 216L); (mk_real_int64 132L); (mk_real_int64 216L); (mk_real_int64 123L); (mk_real_int64 96L); (mk_real_int64 39L); (mk_real_int64 27L); (mk_real_int64 75L); (mk_real_int64 46L); (mk_real_int64 4L); (mk_real_int64 30L); (mk_real_int64 32L); (mk_real_int64 18L); ]); +("y2_def_neg", [5; 8; 12; 14; 17; 19; 20; 23; 31; 33; 36; 42; 45; 47; 49; 50; 51; 54; 58; ], [(mk_real_int64 36L); (mk_real_int64 50L); (mk_real_int64 99L); (mk_real_int64 86L); (mk_real_int64 99L); (mk_real_int64 35L); (mk_real_int64 55L); (mk_real_int64 36L); (mk_real_int64 56L); (mk_real_int64 51L); (mk_real_int64 109L); (mk_real_int64 168L); (mk_real_int64 110L); (mk_real_int64 52L); (mk_real_int64 54L); (mk_real_int64 41L); (mk_real_int64 9L); (mk_real_int64 58L); (mk_real_int64 37L); ]); +("y3_def", [0; 4; 7; 9; 10; 15; 16; 21; 24; 29; 34; 35; 44; 48; 53; 55; 57; ], [(mk_real_int64 47L); (mk_real_int64 92L); (mk_real_int64 22L); (mk_real_int64 79L); (mk_real_int64 216L); (mk_real_int64 132L); (mk_real_int64 216L); (mk_real_int64 123L); (mk_real_int64 96L); (mk_real_int64 39L); (mk_real_int64 27L); (mk_real_int64 75L); (mk_real_int64 46L); (mk_real_int64 4L); (mk_real_int64 30L); (mk_real_int64 32L); (mk_real_int64 18L); ]); +("y3_def_neg", [5; 8; 12; 14; 17; 19; 20; 23; 31; 33; 36; 42; 45; 47; 49; 50; 51; 54; 58; ], [(mk_real_int64 36L); (mk_real_int64 50L); (mk_real_int64 99L); (mk_real_int64 86L); (mk_real_int64 99L); (mk_real_int64 35L); (mk_real_int64 55L); (mk_real_int64 36L); (mk_real_int64 56L); (mk_real_int64 51L); (mk_real_int64 109L); (mk_real_int64 168L); (mk_real_int64 110L); (mk_real_int64 52L); (mk_real_int64 54L); (mk_real_int64 41L); (mk_real_int64 9L); (mk_real_int64 58L); (mk_real_int64 37L); ]); +("y4_def", [1; 4; 10; 16; 19; 32; 35; 38; 39; 42; 46; ], [(mk_real_int64 183L); (mk_real_int64 252L); (mk_real_int64 319L); (mk_real_int64 280L); (mk_real_int64 185L); (mk_real_int64 117L); (mk_real_int64 264L); (mk_real_int64 88L); (mk_real_int64 47L); (mk_real_int64 198L); (mk_real_int64 81L); ]); +("y4_def_neg", [0; 3; 5; 6; 8; 11; 12; 13; 15; 17; 20; 21; 23; 25; 26; 27; 28; 30; 33; 36; 37; 41; 43; 45; ], [(mk_real_int64 80L); (mk_real_int64 41L); (mk_real_int64 173L); (mk_real_int64 407L); (mk_real_int64 68L); (mk_real_int64 68L); (mk_real_int64 407L); (mk_real_int64 68L); (mk_real_int64 24L); (mk_real_int64 68L); (mk_real_int64 85L); (mk_real_int64 73L); (mk_real_int64 39L); (mk_real_int64 104L); (mk_real_int64 51L); (mk_real_int64 142L); (mk_real_int64 75L); (mk_real_int64 119L); (mk_real_int64 77L); (mk_real_int64 7L); (mk_real_int64 37L); (mk_real_int64 57L); (mk_real_int64 60L); (mk_real_int64 149L); ]); +("y5_def", [0; 7; 10; 16; 29; 34; 35; 48; 50; 53; 55; 57; 58; ], [(mk_real_int64 47L); (mk_real_int64 22L); (mk_real_int64 216L); (mk_real_int64 216L); (mk_real_int64 39L); (mk_real_int64 27L); (mk_real_int64 75L); (mk_real_int64 4L); (mk_real_int64 88L); (mk_real_int64 30L); (mk_real_int64 32L); (mk_real_int64 32L); (mk_real_int64 91L); ]); +("y5_def_neg", [4; 5; 8; 9; 12; 14; 15; 17; 19; 20; 21; 23; 24; 28; 31; 33; 36; 40; 42; 44; 45; 47; 49; 51; 54; ], [(mk_real_int64 11L); (mk_real_int64 36L); (mk_real_int64 50L); (mk_real_int64 57L); (mk_real_int64 68L); (mk_real_int64 80L); (mk_real_int64 68L); (mk_real_int64 68L); (mk_real_int64 24L); (mk_real_int64 55L); (mk_real_int64 58L); (mk_real_int64 36L); (mk_real_int64 11L); (mk_real_int64 54L); (mk_real_int64 39L); (mk_real_int64 27L); (mk_real_int64 75L); (mk_real_int64 251L); (mk_real_int64 117L); (mk_real_int64 70L); (mk_real_int64 77L); (mk_real_int64 52L); (mk_real_int64 37L); (mk_real_int64 9L); (mk_real_int64 53L); ]); +("y6_def", [0; 7; 10; 11; 16; 17; 22; 29; 32; 34; 35; 46; 48; 50; 51; 53; 55; 57; 58; ], [(mk_real_int64 47L); (mk_real_int64 339L); (mk_real_int64 216L); (mk_real_int64 475L); (mk_real_int64 216L); (mk_real_int64 407L); (mk_real_int64 258L); (mk_real_int64 39L); (mk_real_int64 78L); (mk_real_int64 27L); (mk_real_int64 75L); (mk_real_int64 129L); (mk_real_int64 4L); (mk_real_int64 88L); (mk_real_int64 14L); (mk_real_int64 30L); (mk_real_int64 32L); (mk_real_int64 32L); (mk_real_int64 95L); ]); +("y6_def_neg", [4; 5; 8; 9; 12; 14; 15; 19; 20; 21; 23; 24; 31; 33; 36; 42; 44; 45; 47; 49; 54; ], [(mk_real_int64 11L); (mk_real_int64 36L); (mk_real_int64 50L); (mk_real_int64 57L); (mk_real_int64 68L); (mk_real_int64 80L); (mk_real_int64 68L); (mk_real_int64 24L); (mk_real_int64 55L); (mk_real_int64 58L); (mk_real_int64 36L); (mk_real_int64 11L); (mk_real_int64 39L); (mk_real_int64 27L); (mk_real_int64 75L); (mk_real_int64 117L); (mk_real_int64 70L); (mk_real_int64 77L); (mk_real_int64 46L); (mk_real_int64 37L); (mk_real_int64 53L); ]); +("y8_def_neg", [4; 11; ], [(mk_real_int64 54L); (mk_real_int64 251L); ]); +("RHA", [0; 1; 2; 3; 4; 6; 7; 9; 11; 12; 13; 15; 17; 18; 19; 21; 22; 24; 27; 30; 31; 32; 34; 36; 37; 42; 43; 45; 48; 49; 52; 53; 55; 56; 57; 58; ], [(mk_real_int64 392L); (mk_real_int64 53L); (mk_real_int64 94L); (mk_real_int64 58L); (mk_real_int64 268L); (mk_real_int64 334L); (mk_real_int64 274L); (mk_real_int64 426L); (mk_real_int64 58L); (mk_real_int64 94L); (mk_real_int64 500L); (mk_real_int64 500L); (mk_real_int64 94L); (mk_real_int64 53L); (mk_real_int64 541L); (mk_real_int64 329L); (mk_real_int64 339L); (mk_real_int64 269L); (mk_real_int64 61L); (mk_real_int64 5L); (mk_real_int64 5L); (mk_real_int64 61L); (mk_real_int64 128L); (mk_real_int64 5L); (mk_real_int64 207L); (mk_real_int64 200L); (mk_real_int64 202L); (mk_real_int64 202L); (mk_real_int64 70L); (mk_real_int64 141L); (mk_real_int64 141L); (mk_real_int64 199L); (mk_real_int64 195L); (mk_real_int64 282L); (mk_real_int64 110L); (mk_real_int64 70L); ]); +("yy10", [6; 21; 24; 41; ], [(mk_real_int64 61L); (mk_real_int64 8L); (mk_real_int64 174L); (mk_real_int64 229L); ]); +("tau4", [2; ], [(mk_real_int64 1139L); ]); +("ineq105", [0; ], [(mk_real_int64 118L); ]); +("ineq106", [0; 3; 5; 6; 12; 17; 20; 21; 26; 27; 30; 36; 41; 43; 45; 46; ], [(mk_real_int64 66L); (mk_real_int64 60L); (mk_real_int64 111L); (mk_real_int64 594L); (mk_real_int64 594L); (mk_real_int64 10L); (mk_real_int64 70L); (mk_real_int64 66L); (mk_real_int64 74L); (mk_real_int64 207L); (mk_real_int64 2L); (mk_real_int64 10L); (mk_real_int64 84L); (mk_real_int64 87L); (mk_real_int64 172L); (mk_real_int64 10L); ]); +("ineq107", [1; 4; 10; 16; 19; 32; 35; 39; 42; ], [(mk_real_int64 237L); (mk_real_int64 327L); (mk_real_int64 430L); (mk_real_int64 362L); (mk_real_int64 239L); (mk_real_int64 202L); (mk_real_int64 341L); (mk_real_int64 61L); (mk_real_int64 271L); ]); +("ineq108", [21; 25; ], [(mk_real_int64 40L); (mk_real_int64 74L); ]); +("ineq109", [38; 46; ], [(mk_real_int64 271L); (mk_real_int64 271L); ]); +("ineq110", [0; 5; 11; 17; 20; 32; ], [(mk_real_int64 180L); (mk_real_int64 269L); (mk_real_int64 347L); (mk_real_int64 314L); (mk_real_int64 186L); (mk_real_int64 202L); ]); +("ineq111", [5; 8; 10; 13; 15; 23; 25; 28; 30; 33; 37; 42; 45; ], [(mk_real_int64 355L); (mk_real_int64 548L); (mk_real_int64 113L); (mk_real_int64 548L); (mk_real_int64 194L); (mk_real_int64 310L); (mk_real_int64 431L); (mk_real_int64 603L); (mk_real_int64 940L); (mk_real_int64 613L); (mk_real_int64 299L); (mk_real_int64 94L); (mk_real_int64 247L); ]); +("ineq112", [39; ], [(mk_real_int64 415L); ]); +("ineq113", [10; 16; 21; 25; ], [(mk_real_int64 42L); (mk_real_int64 21L); (mk_real_int64 391L); (mk_real_int64 304L); ]); +("ineq114", [0; 2; 5; 9; 11; 15; 17; 18; 20; 22; 26; 29; 33; 37; 40; 41; 43; 44; 45; ], [(mk_real_int64 367L); (mk_real_int64 239L); (mk_real_int64 250L); (mk_real_int64 244L); (mk_real_int64 244L); (mk_real_int64 362L); (mk_real_int64 24L); (mk_real_int64 244L); (mk_real_int64 357L); (mk_real_int64 233L); (mk_real_int64 205L); (mk_real_int64 331L); (mk_real_int64 326L); (mk_real_int64 561L); (mk_real_int64 128L); (mk_real_int64 317L); (mk_real_int64 312L); (mk_real_int64 454L); (mk_real_int64 612L); ]); +("ineq119", [7; ], [(mk_real_int64 753L); ]); +("ineq120", [0; 5; 11; ], [(mk_real_int64 548L); (mk_real_int64 186L); (mk_real_int64 3L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 2300L); (mk_real_int64 2050L); (mk_real_int64 1550L); (mk_real_int64 2975L); (mk_real_int64 2975L); (mk_real_int64 3550L); (mk_real_int64 3550L); (mk_real_int64 2975L); (mk_real_int64 2775L); (mk_real_int64 3550L); (mk_real_int64 3550L); (mk_real_int64 2975L); (mk_real_int64 2825L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [0; 4; 5; 6; 14; 21; 33; 34; 37; 41; 45; 49; 52; 55; 56; 57; ], [(mk_real_int64 384L); (mk_real_int64 742L); (mk_real_int64 1000L); (mk_real_int64 614L); (mk_real_int64 122L); (mk_real_int64 24L); (mk_real_int64 264L); (mk_real_int64 330L); (mk_real_int64 206L); (mk_real_int64 274L); (mk_real_int64 76L); (mk_real_int64 186L); (mk_real_int64 128L); (mk_real_int64 312L); (mk_real_int64 204L); (mk_real_int64 112L); ]); +("azim_lo", [9; 13; 15; 19; 20; 22; 24; 26; 28; 29; 30; 51; 53; ], [(mk_real_int64 500L); (mk_real_int64 256L); (mk_real_int64 256L); (mk_real_int64 388L); (mk_real_int64 439L); (mk_real_int64 256L); (mk_real_int64 518L); (mk_real_int64 12L); (mk_real_int64 109L); (mk_real_int64 269L); (mk_real_int64 142L); (mk_real_int64 405L); (mk_real_int64 558L); ]); +("rhazim_lo", [4; 6; 7; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_hi", [3; 11; 53; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_hi", [1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 328L); (mk_real_int64 2684L); (mk_real_int64 3960L); (mk_real_int64 3960L); (mk_real_int64 2328L); (mk_real_int64 2328L); (mk_real_int64 3960L); (mk_real_int64 3284L); (mk_real_int64 2328L); (mk_real_int64 2328L); (mk_real_int64 3960L); (mk_real_int64 3240L); ]); +("rho_lo", [0; ], [(mk_real_int64 2180L); ]); +("tau_hi", [1; 4; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("tau_lo", [8; 9; 11; 14; 18; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("y1_lo", [0; 4; 5; 9; 10; 14; 15; 16; 21; 23; 24; 34; 35; 42; 44; 45; 47; 53; 54; 55; ], [(mk_real_int64 170L); (mk_real_int64 200L); (mk_real_int64 500L); (mk_real_int64 280L); (mk_real_int64 400L); (mk_real_int64 340L); (mk_real_int64 140L); (mk_real_int64 400L); (mk_real_int64 680L); (mk_real_int64 500L); (mk_real_int64 320L); (mk_real_int64 400L); (mk_real_int64 200L); (mk_real_int64 400L); (mk_real_int64 240L); (mk_real_int64 340L); (mk_real_int64 500L); (mk_real_int64 400L); (mk_real_int64 420L); (mk_real_int64 200L); ]); +("y1_hi", [8; 12; 17; 19; 31; 33; 36; 49; 50; 51; 57; 58; ], [(mk_real_int64 500L); (mk_real_int64 360L); (mk_real_int64 360L); (mk_real_int64 80L); (mk_real_int64 200L); (mk_real_int64 30L); (mk_real_int64 460L); (mk_real_int64 180L); (mk_real_int64 79L); (mk_real_int64 500L); (mk_real_int64 340L); (mk_real_int64 79L); ]); +("y2_hi", [0; 4; 8; 10; 12; 14; 16; 17; 19; 24; 31; 33; 35; 36; 44; 47; 49; 50; 53; 57; ], [(mk_real_int64 436L); (mk_real_int64 424L); (mk_real_int64 296L); (mk_real_int64 216L); (mk_real_int64 360L); (mk_real_int64 300L); (mk_real_int64 216L); (mk_real_int64 360L); (mk_real_int64 80L); (mk_real_int64 160L); (mk_real_int64 200L); (mk_real_int64 356L); (mk_real_int64 348L); (mk_real_int64 460L); (mk_real_int64 56L); (mk_real_int64 168L); (mk_real_int64 180L); (mk_real_int64 79L); (mk_real_int64 576L); (mk_real_int64 148L); ]); +("y2_lo", [5; 7; 9; 15; 20; 21; 23; 29; 34; 42; 45; 48; 51; 54; 55; 58; ], [(mk_real_int64 24L); (mk_real_int64 160L); (mk_real_int64 276L); (mk_real_int64 140L); (mk_real_int64 24L); (mk_real_int64 40L); (mk_real_int64 328L); (mk_real_int64 416L); (mk_real_int64 64L); (mk_real_int64 472L); (mk_real_int64 340L); (mk_real_int64 360L); (mk_real_int64 272L); (mk_real_int64 112L); (mk_real_int64 332L); (mk_real_int64 281L); ]); +("y3_hi", [0; 4; 8; 10; 12; 14; 16; 17; 19; 24; 31; 33; 35; 36; 44; 47; 49; 50; 53; 57; ], [(mk_real_int64 436L); (mk_real_int64 424L); (mk_real_int64 296L); (mk_real_int64 216L); (mk_real_int64 360L); (mk_real_int64 300L); (mk_real_int64 216L); (mk_real_int64 360L); (mk_real_int64 80L); (mk_real_int64 160L); (mk_real_int64 200L); (mk_real_int64 356L); (mk_real_int64 348L); (mk_real_int64 460L); (mk_real_int64 56L); (mk_real_int64 168L); (mk_real_int64 180L); (mk_real_int64 79L); (mk_real_int64 576L); (mk_real_int64 148L); ]); +("y3_lo", [5; 7; 9; 15; 20; 21; 23; 29; 34; 42; 45; 48; 51; 54; 55; 58; ], [(mk_real_int64 24L); (mk_real_int64 160L); (mk_real_int64 276L); (mk_real_int64 140L); (mk_real_int64 24L); (mk_real_int64 40L); (mk_real_int64 328L); (mk_real_int64 416L); (mk_real_int64 64L); (mk_real_int64 472L); (mk_real_int64 340L); (mk_real_int64 360L); (mk_real_int64 272L); (mk_real_int64 112L); (mk_real_int64 332L); (mk_real_int64 281L); ]); +("y4_lo", [0; 3; 5; 8; 10; 11; 13; 15; 16; 17; 19; 25; 28; 32; 35; 37; 38; 41; 42; 46; ], [(mk_real_int64 490L); (mk_real_int64 100L); (mk_real_int64 134L); (mk_real_int64 500L); (mk_real_int64 735L); (mk_real_int64 12L); (mk_real_int64 500L); (mk_real_int64 250L); (mk_real_int64 174L); (mk_real_int64 394L); (mk_real_int64 253L); (mk_real_int64 565L); (mk_real_int64 375L); (mk_real_int64 446L); (mk_real_int64 407L); (mk_real_int64 375L); (mk_real_int64 196L); (mk_real_int64 540L); (mk_real_int64 267L); (mk_real_int64 46L); ]); +("y4_hi", [1; 4; 6; 12; 20; 21; 23; 26; 27; 30; 33; 36; 39; 43; 45; ], [(mk_real_int64 201L); (mk_real_int64 771L); (mk_real_int64 110L); (mk_real_int64 110L); (mk_real_int64 594L); (mk_real_int64 390L); (mk_real_int64 250L); (mk_real_int64 310L); (mk_real_int64 205L); (mk_real_int64 130L); (mk_real_int64 375L); (mk_real_int64 150L); (mk_real_int64 153L); (mk_real_int64 405L); (mk_real_int64 305L); ]); +("y5_hi", [0; 8; 9; 10; 14; 16; 21; 24; 31; 33; 35; 42; 45; 47; 53; 54; 58; ], [(mk_real_int64 436L); (mk_real_int64 296L); (mk_real_int64 305L); (mk_real_int64 216L); (mk_real_int64 515L); (mk_real_int64 216L); (mk_real_int64 96L); (mk_real_int64 24L); (mk_real_int64 250L); (mk_real_int64 61L); (mk_real_int64 348L); (mk_real_int64 228L); (mk_real_int64 375L); (mk_real_int64 168L); (mk_real_int64 576L); (mk_real_int64 58L); (mk_real_int64 444L); ]); +("y5_lo", [4; 5; 7; 12; 15; 17; 19; 20; 23; 29; 34; 36; 44; 48; 49; 50; 51; 55; 57; ], [(mk_real_int64 256L); (mk_real_int64 24L); (mk_real_int64 160L); (mk_real_int64 500L); (mk_real_int64 12L); (mk_real_int64 500L); (mk_real_int64 250L); (mk_real_int64 24L); (mk_real_int64 328L); (mk_real_int64 416L); (mk_real_int64 64L); (mk_real_int64 375L); (mk_real_int64 296L); (mk_real_int64 360L); (mk_real_int64 375L); (mk_real_int64 196L); (mk_real_int64 272L); (mk_real_int64 332L); (mk_real_int64 267L); ]); +("y6_hi", [0; 8; 9; 10; 14; 16; 21; 24; 31; 33; 35; 42; 45; 47; 53; 54; 58; ], [(mk_real_int64 436L); (mk_real_int64 296L); (mk_real_int64 305L); (mk_real_int64 216L); (mk_real_int64 515L); (mk_real_int64 216L); (mk_real_int64 96L); (mk_real_int64 24L); (mk_real_int64 250L); (mk_real_int64 61L); (mk_real_int64 348L); (mk_real_int64 228L); (mk_real_int64 375L); (mk_real_int64 168L); (mk_real_int64 576L); (mk_real_int64 58L); (mk_real_int64 444L); ]); +("y6_lo", [4; 5; 7; 11; 12; 15; 17; 19; 20; 22; 23; 29; 32; 34; 36; 44; 46; 47; 48; 49; 50; 51; 55; 57; 58; ], [(mk_real_int64 256L); (mk_real_int64 24L); (mk_real_int64 317160L); (mk_real_int64 475000L); (mk_real_int64 500L); (mk_real_int64 12L); (mk_real_int64 475500L); (mk_real_int64 250L); (mk_real_int64 24L); (mk_real_int64 258000L); (mk_real_int64 328L); (mk_real_int64 416L); (mk_real_int64 78000L); (mk_real_int64 64L); (mk_real_int64 375L); (mk_real_int64 296L); (mk_real_int64 129000L); (mk_real_int64 6000L); (mk_real_int64 360L); (mk_real_int64 375L); (mk_real_int64 196L); (mk_real_int64 23272L); (mk_real_int64 332L); (mk_real_int64 267L); (mk_real_int64 4000L); ]); +("y8_hi", [4; 11; ], [(mk_real_int64 54000L); (mk_real_int64 251000L); ]); +("ye_hi", [19; 21; 48; 50; 51; 55; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_lo", [6; ], [(mk_real_int64 1000L); ]); +("yn_hi", [0; 3; 6; 7; 9; 10; 11; 12; ], [(mk_real_int64 564L); (mk_real_int64 1264L); (mk_real_int64 316L); (mk_real_int64 1264L); (mk_real_int64 1316L); (mk_real_int64 1316L); (mk_real_int64 264L); (mk_real_int64 1004L); ]); +("yn_lo", [1; 2; 4; 5; 8; ], [(mk_real_int64 516L); (mk_real_int64 974L); (mk_real_int64 736L); (mk_real_int64 684L); (mk_real_int64 828L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/63626063287_out.hl b/formal_lp/old/ineqs/tests2/63626063287_out.hl new file mode 100644 index 0000000..a37bf45 --- /dev/null +++ b/formal_lp/old/ineqs/tests2/63626063287_out.hl @@ -0,0 +1,84 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "63626063287 22 4 0 1 2 3 3 0 3 4 3 4 3 5 3 5 3 2 3 5 2 6 3 6 2 7 3 7 2 1 3 7 1 8 3 8 1 9 3 9 1 0 4 9 0 4 10 3 10 4 11 3 11 4 5 4 11 5 6 12 3 12 6 13 3 13 6 7 4 13 7 8 14 3 14 8 10 3 8 9 10 3 14 10 11 3 14 11 12 3 12 13 14 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [1; 2; 4; 5; 7; 8; 10; 11; ], [(mk_real_int64 339L); (mk_real_int64 181L); (mk_real_int64 181L); (mk_real_int64 5L); (mk_real_int64 331L); (mk_real_int64 5L); (mk_real_int64 339L); (mk_real_int64 331L); ]); +("azim_sum_neg", [12; 13; ], [(mk_real_int64 187L); (mk_real_int64 187L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 927L); (mk_real_int64 1080L); (mk_real_int64 1080L); (mk_real_int64 927L); (mk_real_int64 1080L); (mk_real_int64 1080L); (mk_real_int64 1080L); (mk_real_int64 1080L); (mk_real_int64 1080L); (mk_real_int64 927L); (mk_real_int64 1080L); (mk_real_int64 1080L); (mk_real_int64 991L); (mk_real_int64 991L); (mk_real_int64 1080L); ]); +("sol_sum3_neg", [5; 6; 9; 10; ], [(mk_real_int64 181L); (mk_real_int64 5L); (mk_real_int64 181L); (mk_real_int64 5L); ]); +("sol_sum3", [11; 17; ], [(mk_real_int64 187L); (mk_real_int64 187L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; ], [(mk_real_int64 927L); (mk_real_int64 927L); (mk_real_int64 927L); (mk_real_int64 1080L); (mk_real_int64 1080L); (mk_real_int64 1080L); (mk_real_int64 1080L); (mk_real_int64 927L); (mk_real_int64 927L); (mk_real_int64 1080L); (mk_real_int64 1080L); (mk_real_int64 991L); (mk_real_int64 991L); (mk_real_int64 1080L); (mk_real_int64 927L); (mk_real_int64 1080L); (mk_real_int64 991L); (mk_real_int64 991L); ]); +("tau_sum4_neg", [0; 1; 2; 3; ], [(mk_real_int64 927L); (mk_real_int64 927L); (mk_real_int64 1080L); (mk_real_int64 1080L); ]); +("ln_def_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 23L); (mk_real_int64 191L); (mk_real_int64 191L); (mk_real_int64 23L); (mk_real_int64 191L); (mk_real_int64 191L); (mk_real_int64 191L); (mk_real_int64 191L); (mk_real_int64 191L); (mk_real_int64 23L); (mk_real_int64 191L); (mk_real_int64 191L); (mk_real_int64 93L); (mk_real_int64 93L); (mk_real_int64 191L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 5827L); (mk_real_int64 6785L); (mk_real_int64 6785L); (mk_real_int64 5827L); (mk_real_int64 6785L); (mk_real_int64 6785L); (mk_real_int64 6785L); (mk_real_int64 6785L); (mk_real_int64 6785L); (mk_real_int64 5827L); (mk_real_int64 6785L); (mk_real_int64 6785L); (mk_real_int64 6230L); (mk_real_int64 6230L); (mk_real_int64 6785L); ]); +("edge_sym", [0; 1; 5; 9; 12; 17; 33; 46; 53; ], [(mk_real_int64 49L); (mk_real_int64 216L); (mk_real_int64 136L); (mk_real_int64 29L); (mk_real_int64 39L); (mk_real_int64 59L); (mk_real_int64 216L); (mk_real_int64 36L); (mk_real_int64 2L); ]); +("edge_sym_neg", [6; 8; 14; 15; 18; 21; 23; 24; 26; 27; 36; 37; 40; 47; 56; 57; 63; 66; ], [(mk_real_int64 49L); (mk_real_int64 106L); (mk_real_int64 44L); (mk_real_int64 2L); (mk_real_int64 266L); (mk_real_int64 224L); (mk_real_int64 295L); (mk_real_int64 2L); (mk_real_int64 136L); (mk_real_int64 39L); (mk_real_int64 47L); (mk_real_int64 59L); (mk_real_int64 2L); (mk_real_int64 54L); (mk_real_int64 39L); (mk_real_int64 44L); (mk_real_int64 266L); (mk_real_int64 36L); ]); +("y1_def_neg", [1; 5; 7; 8; 9; 10; 13; 14; 15; 16; 17; 18; 19; 20; 22; 23; 24; 25; 26; 30; 33; 35; 36; 38; 39; 40; 42; 45; 46; 47; 49; 53; 56; 57; 58; 62; 63; 64; 69; ], [(mk_real_int64 39L); (mk_real_int64 71L); (mk_real_int64 78L); (mk_real_int64 108L); (mk_real_int64 93L); (mk_real_int64 116L); (mk_real_int64 1L); (mk_real_int64 38L); (mk_real_int64 144L); (mk_real_int64 106L); (mk_real_int64 73L); (mk_real_int64 13L); (mk_real_int64 35L); (mk_real_int64 163L); (mk_real_int64 77L); (mk_real_int64 41L); (mk_real_int64 192L); (mk_real_int64 93L); (mk_real_int64 186L); (mk_real_int64 71L); (mk_real_int64 39L); (mk_real_int64 37L); (mk_real_int64 194L); (mk_real_int64 77L); (mk_real_int64 41L); (mk_real_int64 192L); (mk_real_int64 2L); (mk_real_int64 28L); (mk_real_int64 31L); (mk_real_int64 114L); (mk_real_int64 111L); (mk_real_int64 2L); (mk_real_int64 145L); (mk_real_int64 38L); (mk_real_int64 116L); (mk_real_int64 179L); (mk_real_int64 13L); (mk_real_int64 53L); (mk_real_int64 173L); ]); +("y1_def", [37; 48; 66; ], [(mk_real_int64 34L); (mk_real_int64 94L); (mk_real_int64 36L); ]); +("y2_def", [1; 7; 9; 10; 13; 14; 17; 18; 19; 22; 23; 25; 33; 35; 37; 38; 39; 42; 46; 53; 57; 58; 62; 63; 64; ], [(mk_real_int64 49L); (mk_real_int64 47L); (mk_real_int64 57L); (mk_real_int64 31L); (mk_real_int64 2L); (mk_real_int64 59L); (mk_real_int64 113L); (mk_real_int64 20L); (mk_real_int64 55L); (mk_real_int64 119L); (mk_real_int64 64L); (mk_real_int64 57L); (mk_real_int64 49L); (mk_real_int64 57L); (mk_real_int64 123L); (mk_real_int64 119L); (mk_real_int64 64L); (mk_real_int64 2L); (mk_real_int64 19L); (mk_real_int64 2L); (mk_real_int64 59L); (mk_real_int64 31L); (mk_real_int64 6L); (mk_real_int64 20L); (mk_real_int64 32L); ]); +("y2_def_neg", [5; 8; 15; 16; 20; 24; 26; 30; 36; 40; 45; 47; 48; 49; 56; 66; 69; ], [(mk_real_int64 71L); (mk_real_int64 108L); (mk_real_int64 144L); (mk_real_int64 106L); (mk_real_int64 68L); (mk_real_int64 192L); (mk_real_int64 61L); (mk_real_int64 71L); (mk_real_int64 194L); (mk_real_int64 192L); (mk_real_int64 28L); (mk_real_int64 114L); (mk_real_int64 28L); (mk_real_int64 26L); (mk_real_int64 142L); (mk_real_int64 86L); (mk_real_int64 124L); ]); +("y3_def", [1; 7; 9; 10; 13; 14; 17; 18; 19; 22; 23; 25; 33; 35; 37; 38; 39; 42; 46; 53; 57; 58; 62; 63; 64; ], [(mk_real_int64 49L); (mk_real_int64 47L); (mk_real_int64 57L); (mk_real_int64 31L); (mk_real_int64 2L); (mk_real_int64 59L); (mk_real_int64 113L); (mk_real_int64 20L); (mk_real_int64 55L); (mk_real_int64 119L); (mk_real_int64 64L); (mk_real_int64 57L); (mk_real_int64 49L); (mk_real_int64 57L); (mk_real_int64 123L); (mk_real_int64 119L); (mk_real_int64 64L); (mk_real_int64 2L); (mk_real_int64 19L); (mk_real_int64 2L); (mk_real_int64 59L); (mk_real_int64 31L); (mk_real_int64 6L); (mk_real_int64 20L); (mk_real_int64 32L); ]); +("y3_def_neg", [5; 8; 15; 16; 20; 24; 26; 30; 36; 40; 45; 47; 48; 49; 56; 66; 69; ], [(mk_real_int64 71L); (mk_real_int64 108L); (mk_real_int64 144L); (mk_real_int64 106L); (mk_real_int64 68L); (mk_real_int64 192L); (mk_real_int64 61L); (mk_real_int64 71L); (mk_real_int64 194L); (mk_real_int64 192L); (mk_real_int64 28L); (mk_real_int64 114L); (mk_real_int64 28L); (mk_real_int64 26L); (mk_real_int64 142L); (mk_real_int64 86L); (mk_real_int64 124L); ]); +("y4_def_neg", [1; 3; 4; 5; 6; 9; 10; 11; 12; 13; 14; 15; 16; 18; 19; 20; 21; 22; 26; 27; 28; 29; 30; 31; 32; 34; 35; 37; 40; 41; 42; 46; 47; 48; 53; ], [(mk_real_int64 49L); (mk_real_int64 89L); (mk_real_int64 75L); (mk_real_int64 108L); (mk_real_int64 121L); (mk_real_int64 4L); (mk_real_int64 111L); (mk_real_int64 100L); (mk_real_int64 74L); (mk_real_int64 212L); (mk_real_int64 37L); (mk_real_int64 103L); (mk_real_int64 279L); (mk_real_int64 223L); (mk_real_int64 120L); (mk_real_int64 136L); (mk_real_int64 108L); (mk_real_int64 164L); (mk_real_int64 49L); (mk_real_int64 108L); (mk_real_int64 135L); (mk_real_int64 138L); (mk_real_int64 223L); (mk_real_int64 120L); (mk_real_int64 136L); (mk_real_int64 35L); (mk_real_int64 79L); (mk_real_int64 101L); (mk_real_int64 103L); (mk_real_int64 111L); (mk_real_int64 121L); (mk_real_int64 286L); (mk_real_int64 37L); (mk_real_int64 61L); (mk_real_int64 54L); ]); +("y4_def", [33; 36; 50; ], [(mk_real_int64 61L); (mk_real_int64 145L); (mk_real_int64 105L); ]); +("y5_def", [1; 7; 9; 10; 13; 14; 17; 18; 19; 22; 23; 25; 33; 35; 37; 38; 39; 42; 45; 46; 53; 57; 58; 62; 63; 64; ], [(mk_real_int64 49L); (mk_real_int64 47L); (mk_real_int64 57L); (mk_real_int64 39L); (mk_real_int64 2L); (mk_real_int64 59L); (mk_real_int64 113L); (mk_real_int64 20L); (mk_real_int64 55L); (mk_real_int64 119L); (mk_real_int64 64L); (mk_real_int64 57L); (mk_real_int64 49L); (mk_real_int64 57L); (mk_real_int64 19L); (mk_real_int64 119L); (mk_real_int64 64L); (mk_real_int64 2L); (mk_real_int64 61L); (mk_real_int64 19L); (mk_real_int64 2L); (mk_real_int64 59L); (mk_real_int64 39L); (mk_real_int64 39L); (mk_real_int64 20L); (mk_real_int64 32L); ]); +("y5_def_neg", [5; 8; 15; 16; 20; 24; 26; 30; 36; 40; 47; 48; 49; 56; 66; ], [(mk_real_int64 49L); (mk_real_int64 75L); (mk_real_int64 100L); (mk_real_int64 74L); (mk_real_int64 113L); (mk_real_int64 136L); (mk_real_int64 28L); (mk_real_int64 49L); (mk_real_int64 135L); (mk_real_int64 136L); (mk_real_int64 79L); (mk_real_int64 28L); (mk_real_int64 8L); (mk_real_int64 98L); (mk_real_int64 69L); ]); +("y6_def", [1; 4; 7; 9; 10; 11; 13; 14; 17; 18; 19; 22; 23; 25; 27; 28; 33; 35; 37; 38; 39; 42; 45; 46; 49; 50; 53; 55; 57; 58; 59; 61; 62; 63; 64; 65; 67; 69; ], [(mk_real_int64 49L); (mk_real_int64 49L); (mk_real_int64 47L); (mk_real_int64 57L); (mk_real_int64 106L); (mk_real_int64 121L); (mk_real_int64 2L); (mk_real_int64 59L); (mk_real_int64 113L); (mk_real_int64 20L); (mk_real_int64 55L); (mk_real_int64 296L); (mk_real_int64 64L); (mk_real_int64 323L); (mk_real_int64 68L); (mk_real_int64 185L); (mk_real_int64 49L); (mk_real_int64 57L); (mk_real_int64 19L); (mk_real_int64 119L); (mk_real_int64 330L); (mk_real_int64 2L); (mk_real_int64 61L); (mk_real_int64 19L); (mk_real_int64 122L); (mk_real_int64 129L); (mk_real_int64 2L); (mk_real_int64 207L); (mk_real_int64 59L); (mk_real_int64 39L); (mk_real_int64 121L); (mk_real_int64 42L); (mk_real_int64 39L); (mk_real_int64 20L); (mk_real_int64 162L); (mk_real_int64 129L); (mk_real_int64 107L); (mk_real_int64 36L); ]); +("y6_def_neg", [5; 8; 15; 16; 20; 26; 36; 47; 48; 56; 66; ], [(mk_real_int64 49L); (mk_real_int64 75L); (mk_real_int64 100L); (mk_real_int64 31L); (mk_real_int64 113L); (mk_real_int64 28L); (mk_real_int64 135L); (mk_real_int64 79L); (mk_real_int64 28L); (mk_real_int64 98L); (mk_real_int64 69L); ]); +("RHA", [1; 2; 6; 7; 12; 26; 29; 33; 34; 46; 50; 60; 65; 69; ], [(mk_real_int64 152L); (mk_real_int64 152L); (mk_real_int64 152L); (mk_real_int64 23L); (mk_real_int64 152L); (mk_real_int64 23L); (mk_real_int64 152L); (mk_real_int64 152L); (mk_real_int64 152L); (mk_real_int64 37L); (mk_real_int64 88L); (mk_real_int64 152L); (mk_real_int64 88L); (mk_real_int64 37L); ]); +("RHB", [44; 51; ], [(mk_real_int64 88L); (mk_real_int64 88L); ]); +("ineq105", [1; 6; 9; 14; ], [(mk_real_int64 123L); (mk_real_int64 123L); (mk_real_int64 5L); (mk_real_int64 5L); ]); +("ineq106", [3; 5; 6; 21; 22; 34; 37; 42; 48; 53; ], [(mk_real_int64 129L); (mk_real_int64 152L); (mk_real_int64 152L); (mk_real_int64 152L); (mk_real_int64 129L); (mk_real_int64 51L); (mk_real_int64 88L); (mk_real_int64 152L); (mk_real_int64 88L); (mk_real_int64 51L); ]); +("ineq107", [36; 50; ], [(mk_real_int64 187L); (mk_real_int64 187L); ]); +("ineq108", [5; 9; 10; 13; 14; 15; 16; 18; 19; 21; 27; 29; 30; 31; 40; 41; 46; 47; ], [(mk_real_int64 5L); (mk_real_int64 5L); (mk_real_int64 162L); (mk_real_int64 310L); (mk_real_int64 54L); (mk_real_int64 150L); (mk_real_int64 158L); (mk_real_int64 326L); (mk_real_int64 176L); (mk_real_int64 5L); (mk_real_int64 158L); (mk_real_int64 150L); (mk_real_int64 326L); (mk_real_int64 176L); (mk_real_int64 5L); (mk_real_int64 162L); (mk_real_int64 310L); (mk_real_int64 54L); ]); +("ineq109", [33; 53; ], [(mk_real_int64 187L); (mk_real_int64 187L); ]); +("ineq110", [16; 20; 29; 32; ], [(mk_real_int64 181L); (mk_real_int64 5L); (mk_real_int64 181L); (mk_real_int64 5L); ]); +("ineq111", [1; 4; 6; 11; 12; 16; 20; 22; 26; 28; 32; 35; 37; 40; 42; 46; 50; 53; ], [(mk_real_int64 394L); (mk_real_int64 601L); (mk_real_int64 134L); (mk_real_int64 798L); (mk_real_int64 591L); (mk_real_int64 1080L); (mk_real_int64 1080L); (mk_real_int64 601L); (mk_real_int64 394L); (mk_real_int64 1080L); (mk_real_int64 1080L); (mk_real_int64 633L); (mk_real_int64 321L); (mk_real_int64 798L); (mk_real_int64 134L); (mk_real_int64 591L); (mk_real_int64 321L); (mk_real_int64 633L); ]); +("ineq114", [2; 3; 6; 8; 10; 13; 14; 22; 25; 34; 38; 41; 42; 44; 46; 47; 49; 53; ], [(mk_real_int64 533L); (mk_real_int64 326L); (mk_real_int64 8L); (mk_real_int64 785L); (mk_real_int64 282L); (mk_real_int64 47L); (mk_real_int64 443L); (mk_real_int64 326L); (mk_real_int64 533L); (mk_real_int64 359L); (mk_real_int64 670L); (mk_real_int64 282L); (mk_real_int64 8L); (mk_real_int64 785L); (mk_real_int64 47L); (mk_real_int64 443L); (mk_real_int64 670L); (mk_real_int64 359L); ]); +("ineq119", [11; 12; ], [(mk_real_int64 643L); (mk_real_int64 643L); ]); +("ineq120", [1; 2; 6; 7; 8; 13; ], [(mk_real_int64 279L); (mk_real_int64 649L); (mk_real_int64 279L); (mk_real_int64 649L); (mk_real_int64 437L); (mk_real_int64 437L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 3275L); (mk_real_int64 3625L); (mk_real_int64 3625L); (mk_real_int64 3275L); (mk_real_int64 3625L); (mk_real_int64 3625L); (mk_real_int64 3625L); (mk_real_int64 3625L); (mk_real_int64 3625L); (mk_real_int64 3275L); (mk_real_int64 3625L); (mk_real_int64 3625L); (mk_real_int64 2750L); (mk_real_int64 2750L); (mk_real_int64 3625L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [1; 2; 6; 7; 10; 12; 17; 18; 26; 29; 33; 34; 41; 46; 50; 52; 58; 60; 62; 63; 65; 69; ], [(mk_real_int64 1482L); (mk_real_int64 942L); (mk_real_int64 658L); (mk_real_int64 76L); (mk_real_int64 8L); (mk_real_int64 410L); (mk_real_int64 422L); (mk_real_int64 318L); (mk_real_int64 76L); (mk_real_int64 658L); (mk_real_int64 1482L); (mk_real_int64 942L); (mk_real_int64 246L); (mk_real_int64 734L); (mk_real_int64 420L); (mk_real_int64 246L); (mk_real_int64 8L); (mk_real_int64 410L); (mk_real_int64 422L); (mk_real_int64 318L); (mk_real_int64 420L); (mk_real_int64 734L); ]); +("azim_lo", [14; 44; 51; 57; ], [(mk_real_int64 468L); (mk_real_int64 791L); (mk_real_int64 791L); (mk_real_int64 468L); ]); +("rhazim_lo", [1; 2; 6; 7; 9; 10; 12; 25; 26; 29; 33; 34; 46; 49; 50; 58; 60; 64; 65; 69; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_hi", [44; 51; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rho_lo", [0; 3; 9; 12; 13; ], [(mk_real_int64 1732L); (mk_real_int64 1732L); (mk_real_int64 1732L); (mk_real_int64 2556L); (mk_real_int64 2556L); ]); +("rho_hi", [1; 2; 4; 5; 6; 7; 8; 10; 11; 14; ], [(mk_real_int64 1720L); (mk_real_int64 1720L); (mk_real_int64 1720L); (mk_real_int64 1720L); (mk_real_int64 1720L); (mk_real_int64 1720L); (mk_real_int64 1720L); (mk_real_int64 1720L); (mk_real_int64 1720L); (mk_real_int64 1720L); ]); +("tau_hi", [0; 5; 10; 14; 19; 21; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("y1_hi", [1; 5; 7; 9; 10; 15; 17; 18; 20; 22; 25; 26; 30; 33; 38; 42; 46; 47; 49; 53; 56; 58; 63; 64; 69; ], [(mk_real_int64 255L); (mk_real_int64 80L); (mk_real_int64 600L); (mk_real_int64 625L); (mk_real_int64 680L); (mk_real_int64 360L); (mk_real_int64 150L); (mk_real_int64 310L); (mk_real_int64 250L); (mk_real_int64 390L); (mk_real_int64 625L); (mk_real_int64 420L); (mk_real_int64 80L); (mk_real_int64 255L); (mk_real_int64 390L); (mk_real_int64 425L); (mk_real_int64 400L); (mk_real_int64 60L); (mk_real_int64 420L); (mk_real_int64 425L); (mk_real_int64 185L); (mk_real_int64 680L); (mk_real_int64 310L); (mk_real_int64 200L); (mk_real_int64 223L); ]); +("y1_lo", [8; 13; 14; 16; 19; 23; 24; 35; 36; 37; 39; 40; 45; 48; 57; 62; 66; ], [(mk_real_int64 180L); (mk_real_int64 175L); (mk_real_int64 70L); (mk_real_int64 380L); (mk_real_int64 250L); (mk_real_int64 360L); (mk_real_int64 500L); (mk_real_int64 130L); (mk_real_int64 400L); (mk_real_int64 470L); (mk_real_int64 360L); (mk_real_int64 500L); (mk_real_int64 237L); (mk_real_int64 500L); (mk_real_int64 70L); (mk_real_int64 230L); (mk_real_int64 280L); ]); +("y2_hi", [1; 5; 9; 10; 15; 23; 25; 30; 33; 35; 37; 39; 42; 47; 49; 53; 56; 58; 62; 64; 69; ], [(mk_real_int64 446L); (mk_real_int64 80L); (mk_real_int64 148L); (mk_real_int64 208L); (mk_real_int64 360L); (mk_real_int64 64L); (mk_real_int64 148L); (mk_real_int64 80L); (mk_real_int64 446L); (mk_real_int64 512L); (mk_real_int64 380L); (mk_real_int64 64L); (mk_real_int64 10L); (mk_real_int64 60L); (mk_real_int64 252L); (mk_real_int64 10L); (mk_real_int64 180L); (mk_real_int64 208L); (mk_real_int64 460L); (mk_real_int64 32L); (mk_real_int64 387L); ]); +("y2_lo", [7; 8; 13; 14; 16; 17; 18; 19; 20; 22; 24; 26; 36; 38; 40; 45; 46; 48; 57; 63; 66; ], [(mk_real_int64 44L); (mk_real_int64 180L); (mk_real_int64 180L); (mk_real_int64 32L); (mk_real_int64 380L); (mk_real_int64 160L); (mk_real_int64 344L); (mk_real_int64 400L); (mk_real_int64 108L); (mk_real_int64 336L); (mk_real_int64 500L); (mk_real_int64 224L); (mk_real_int64 400L); (mk_real_int64 336L); (mk_real_int64 500L); (mk_real_int64 237L); (mk_real_int64 436L); (mk_real_int64 424L); (mk_real_int64 32L); (mk_real_int64 344L); (mk_real_int64 204L); ]); +("y3_hi", [1; 5; 9; 10; 15; 23; 25; 30; 33; 35; 37; 39; 42; 47; 49; 53; 56; 58; 62; 64; 69; ], [(mk_real_int64 446L); (mk_real_int64 80L); (mk_real_int64 148L); (mk_real_int64 208L); (mk_real_int64 360L); (mk_real_int64 64L); (mk_real_int64 148L); (mk_real_int64 80L); (mk_real_int64 446L); (mk_real_int64 512L); (mk_real_int64 380L); (mk_real_int64 64L); (mk_real_int64 10L); (mk_real_int64 60L); (mk_real_int64 252L); (mk_real_int64 10L); (mk_real_int64 180L); (mk_real_int64 208L); (mk_real_int64 460L); (mk_real_int64 32L); (mk_real_int64 387L); ]); +("y3_lo", [7; 8; 13; 14; 16; 17; 18; 19; 20; 22; 24; 26; 36; 38; 40; 45; 46; 48; 57; 63; 66; ], [(mk_real_int64 44L); (mk_real_int64 180L); (mk_real_int64 180L); (mk_real_int64 32L); (mk_real_int64 380L); (mk_real_int64 160L); (mk_real_int64 344L); (mk_real_int64 400L); (mk_real_int64 108L); (mk_real_int64 336L); (mk_real_int64 500L); (mk_real_int64 224L); (mk_real_int64 400L); (mk_real_int64 336L); (mk_real_int64 500L); (mk_real_int64 237L); (mk_real_int64 436L); (mk_real_int64 424L); (mk_real_int64 32L); (mk_real_int64 344L); (mk_real_int64 204L); ]); +("y4_lo", [1; 4; 13; 18; 19; 26; 27; 29; 30; 31; 33; 35; 36; 40; 46; 50; ], [(mk_real_int64 250L); (mk_real_int64 125L); (mk_real_int64 350L); (mk_real_int64 310L); (mk_real_int64 560L); (mk_real_int64 250L); (mk_real_int64 230L); (mk_real_int64 226L); (mk_real_int64 310L); (mk_real_int64 560L); (mk_real_int64 412L); (mk_real_int64 125L); (mk_real_int64 449L); (mk_real_int64 175L); (mk_real_int64 225L); (mk_real_int64 574L); ]); +("y4_hi", [3; 5; 6; 9; 10; 11; 12; 14; 15; 16; 20; 21; 22; 32; 34; 37; 41; 42; 47; 48; 53; ], [(mk_real_int64 635L); (mk_real_int64 455L); (mk_real_int64 130L); (mk_real_int64 575L); (mk_real_int64 30L); (mk_real_int64 250L); (mk_real_int64 125L); (mk_real_int64 10L); (mk_real_int64 250L); (mk_real_int64 294L); (mk_real_int64 20L); (mk_real_int64 455L); (mk_real_int64 510L); (mk_real_int64 20L); (mk_real_int64 65L); (mk_real_int64 595L); (mk_real_int64 30L); (mk_real_int64 130L); (mk_real_int64 10L); (mk_real_int64 720L); (mk_real_int64 528L); ]); +("y5_lo", [5; 7; 8; 10; 13; 14; 17; 18; 19; 22; 26; 30; 38; 45; 46; 47; 48; 49; 57; 58; 62; 63; ], [(mk_real_int64 250L); (mk_real_int64 44L); (mk_real_int64 125L); (mk_real_int64 422L); (mk_real_int64 180L); (mk_real_int64 32L); (mk_real_int64 160L); (mk_real_int64 344L); (mk_real_int64 400L); (mk_real_int64 336L); (mk_real_int64 169L); (mk_real_int64 250L); (mk_real_int64 336L); (mk_real_int64 412L); (mk_real_int64 436L); (mk_real_int64 125L); (mk_real_int64 424L); (mk_real_int64 93L); (mk_real_int64 32L); (mk_real_int64 422L); (mk_real_int64 35L); (mk_real_int64 344L); ]); +("y5_hi", [1; 9; 15; 16; 20; 23; 24; 25; 33; 35; 37; 39; 40; 42; 53; 56; 64; 66; 69; ], [(mk_real_int64 446L); (mk_real_int64 148L); (mk_real_int64 250L); (mk_real_int64 125L); (mk_real_int64 36L); (mk_real_int64 64L); (mk_real_int64 20L); (mk_real_int64 148L); (mk_real_int64 446L); (mk_real_int64 512L); (mk_real_int64 124L); (mk_real_int64 64L); (mk_real_int64 20L); (mk_real_int64 10L); (mk_real_int64 10L); (mk_real_int64 70L); (mk_real_int64 32L); (mk_real_int64 451L); (mk_real_int64 27L); ]); +("y6_lo", [4; 5; 7; 8; 10; 11; 13; 14; 16; 17; 18; 19; 22; 24; 25; 26; 27; 28; 30; 38; 39; 40; 45; 46; 47; 48; 49; 50; 55; 57; 58; 59; 61; 62; 63; 64; 65; 67; 69; ], [(mk_real_int64 49000L); (mk_real_int64 250L); (mk_real_int64 44L); (mk_real_int64 125L); (mk_real_int64 68000L); (mk_real_int64 121000L); (mk_real_int64 180L); (mk_real_int64 32L); (mk_real_int64 42875L); (mk_real_int64 160L); (mk_real_int64 344L); (mk_real_int64 400L); (mk_real_int64 177336L); (mk_real_int64 136000L); (mk_real_int64 266000L); (mk_real_int64 169L); (mk_real_int64 68000L); (mk_real_int64 185000L); (mk_real_int64 49250L); (mk_real_int64 336L); (mk_real_int64 266000L); (mk_real_int64 136000L); (mk_real_int64 412L); (mk_real_int64 436L); (mk_real_int64 125L); (mk_real_int64 424L); (mk_real_int64 130093L); (mk_real_int64 129000L); (mk_real_int64 207000L); (mk_real_int64 32L); (mk_real_int64 422L); (mk_real_int64 121000L); (mk_real_int64 42000L); (mk_real_int64 35L); (mk_real_int64 344L); (mk_real_int64 130000L); (mk_real_int64 129000L); (mk_real_int64 107000L); (mk_real_int64 36000L); ]); +("y6_hi", [1; 9; 10; 15; 20; 23; 24; 25; 33; 35; 37; 39; 40; 42; 53; 56; 64; 66; 69; ], [(mk_real_int64 446L); (mk_real_int64 148L); (mk_real_int64 578L); (mk_real_int64 250L); (mk_real_int64 36L); (mk_real_int64 64L); (mk_real_int64 20L); (mk_real_int64 148L); (mk_real_int64 446L); (mk_real_int64 512L); (mk_real_int64 124L); (mk_real_int64 64L); (mk_real_int64 20L); (mk_real_int64 10L); (mk_real_int64 10L); (mk_real_int64 70L); (mk_real_int64 32L); (mk_real_int64 451L); (mk_real_int64 27L); ]); +("ye_lo", [1; 5; 8; 14; 15; 33; 36; 46; 65; 66; 67; ], [(mk_real_int64 167000L); (mk_real_int64 185000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 207000L); (mk_real_int64 167000L); (mk_real_int64 177000L); (mk_real_int64 36000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_hi", [16; 19; 24; 40; 45; 46; 47; 49; 64; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 14; ], [(mk_real_int64 252L); (mk_real_int64 484L); (mk_real_int64 1484L); (mk_real_int64 252L); (mk_real_int64 484L); (mk_real_int64 484L); (mk_real_int64 1484L); (mk_real_int64 1484L); (mk_real_int64 484L); (mk_real_int64 252L); (mk_real_int64 484L); (mk_real_int64 484L); (mk_real_int64 484L); ]); +("yn_lo", [12; 13; ], [(mk_real_int64 68L); (mk_real_int64 68L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/69964410750_out.hl b/formal_lp/old/ineqs/tests2/69964410750_out.hl new file mode 100644 index 0000000..b031885 --- /dev/null +++ b/formal_lp/old/ineqs/tests2/69964410750_out.hl @@ -0,0 +1,88 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "69964410750 19 4 0 1 2 3 4 0 3 4 5 3 4 3 6 3 6 3 2 3 6 2 7 3 7 2 1 3 7 1 8 3 8 1 9 3 9 1 0 3 9 0 10 3 10 0 5 3 10 5 11 3 11 5 4 3 11 4 12 3 12 4 6 3 12 6 7 4 11 12 7 8 3 10 11 8 3 8 9 10 ";; +let precision = 4;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [3; 5; 8; ], [(mk_real_int64 728L); (mk_real_int64 904L); (mk_real_int64 1007L); ]); +("azim_sum_neg", [0; 1; 4; 6; 7; 11; 12; ], [(mk_real_int64 319L); (mk_real_int64 2680L); (mk_real_int64 1207L); (mk_real_int64 2513L); (mk_real_int64 2053L); (mk_real_int64 2187L); (mk_real_int64 781L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 9427L); (mk_real_int64 9108L); (mk_real_int64 9108L); (mk_real_int64 9108L); (mk_real_int64 9108L); (mk_real_int64 9987L); (mk_real_int64 10062L); (mk_real_int64 10133L); (mk_real_int64 10300L); (mk_real_int64 10133L); (mk_real_int64 10133L); (mk_real_int64 6683L); (mk_real_int64 7602L); ]); +("sol_sum3_neg", [0; 4; 6; 8; 10; 14; ], [(mk_real_int64 632L); (mk_real_int64 485L); (mk_real_int64 109L); (mk_real_int64 2005L); (mk_real_int64 988L); (mk_real_int64 3891L); ]); +("sol_sum3", [1; 3; 11; 12; ], [(mk_real_int64 2124L); (mk_real_int64 597L); (mk_real_int64 28L); (mk_real_int64 2053L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; ], [(mk_real_int64 8476L); (mk_real_int64 9108L); (mk_real_int64 7549L); (mk_real_int64 9108L); (mk_real_int64 8623L); (mk_real_int64 6683L); (mk_real_int64 6683L); (mk_real_int64 6683L); (mk_real_int64 4816L); (mk_real_int64 7602L); (mk_real_int64 9108L); (mk_real_int64 9987L); (mk_real_int64 9987L); (mk_real_int64 7549L); (mk_real_int64 5108L); (mk_real_int64 6683L); ]); +("tau_sum4_neg", [0; 1; 2; ], [(mk_real_int64 9108L); (mk_real_int64 9108L); (mk_real_int64 10133L); ]); +("ln_def_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; ], [(mk_real_int64 394L); (mk_real_int64 42L); (mk_real_int64 42L); (mk_real_int64 42L); (mk_real_int64 42L); (mk_real_int64 1011L); (mk_real_int64 1094L); (mk_real_int64 1172L); (mk_real_int64 1356L); (mk_real_int64 1172L); (mk_real_int64 1172L); ]); +("ln_def", [11; 12; ], [(mk_real_int64 2632L); (mk_real_int64 1618L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 59232L); (mk_real_int64 57228L); (mk_real_int64 57228L); (mk_real_int64 57228L); (mk_real_int64 57228L); (mk_real_int64 62748L); (mk_real_int64 63224L); (mk_real_int64 63665L); (mk_real_int64 64717L); (mk_real_int64 63665L); (mk_real_int64 63665L); (mk_real_int64 41990L); (mk_real_int64 47768L); ]); +("edge_sym_neg", [0; 9; 15; 21; 24; 31; 37; 42; 53; 56; ], [(mk_real_int64 2182L); (mk_real_int64 515L); (mk_real_int64 110L); (mk_real_int64 2306L); (mk_real_int64 1491L); (mk_real_int64 223L); (mk_real_int64 353L); (mk_real_int64 356L); (mk_real_int64 673L); (mk_real_int64 1740L); ]); +("edge_sym", [10; 16; 19; 25; 28; 30; 34; 36; ], [(mk_real_int64 153L); (mk_real_int64 557L); (mk_real_int64 1075L); (mk_real_int64 283L); (mk_real_int64 223L); (mk_real_int64 1133L); (mk_real_int64 2693L); (mk_real_int64 683L); ]); +("y1_def", [9; 15; 18; 25; 26; 27; 29; 33; 35; 39; 54; 55; 58; ], [(mk_real_int64 240L); (mk_real_int64 360L); (mk_real_int64 581L); (mk_real_int64 1094L); (mk_real_int64 1148L); (mk_real_int64 42L); (mk_real_int64 733L); (mk_real_int64 762L); (mk_real_int64 391L); (mk_real_int64 376L); (mk_real_int64 662L); (mk_real_int64 798L); (mk_real_int64 628L); ]); +("y1_def_neg", [8; 10; 12; 13; 17; 19; 20; 22; 23; 28; 34; 36; 37; 40; 43; 44; 46; 47; 48; 57; ], [(mk_real_int64 393L); (mk_real_int64 88L); (mk_real_int64 867L); (mk_real_int64 42L); (mk_real_int64 24L); (mk_real_int64 90L); (mk_real_int64 944L); (mk_real_int64 2167L); (mk_real_int64 1015L); (mk_real_int64 706L); (mk_real_int64 648L); (mk_real_int64 179L); (mk_real_int64 2887L); (mk_real_int64 453L); (mk_real_int64 253L); (mk_real_int64 1035L); (mk_real_int64 117L); (mk_real_int64 319L); (mk_real_int64 278L); (mk_real_int64 615L); ]); +("y2_def", [8; 9; 10; 20; 23; 27; 28; 33; 34; 36; 39; 40; 47; 55; 57; ], [(mk_real_int64 221L); (mk_real_int64 240L); (mk_real_int64 53L); (mk_real_int64 985L); (mk_real_int64 615L); (mk_real_int64 42L); (mk_real_int64 428L); (mk_real_int64 762L); (mk_real_int64 393L); (mk_real_int64 109L); (mk_real_int64 376L); (mk_real_int64 175L); (mk_real_int64 193L); (mk_real_int64 1891L); (mk_real_int64 373L); ]); +("y2_def_neg", [12; 13; 15; 17; 18; 19; 22; 25; 26; 29; 35; 37; 43; 44; 46; 48; 54; 58; ], [(mk_real_int64 867L); (mk_real_int64 405L); (mk_real_int64 110L); (mk_real_int64 24L); (mk_real_int64 177L); (mk_real_int64 90L); (mk_real_int64 1179L); (mk_real_int64 332L); (mk_real_int64 349L); (mk_real_int64 223L); (mk_real_int64 119L); (mk_real_int64 448L); (mk_real_int64 504L); (mk_real_int64 894L); (mk_real_int64 368L); (mk_real_int64 278L); (mk_real_int64 201L); (mk_real_int64 799L); ]); +("y3_def", [8; 9; 10; 20; 23; 27; 28; 33; 34; 36; 39; 40; 47; 55; 57; ], [(mk_real_int64 221L); (mk_real_int64 240L); (mk_real_int64 53L); (mk_real_int64 985L); (mk_real_int64 615L); (mk_real_int64 42L); (mk_real_int64 428L); (mk_real_int64 762L); (mk_real_int64 393L); (mk_real_int64 109L); (mk_real_int64 376L); (mk_real_int64 175L); (mk_real_int64 193L); (mk_real_int64 1891L); (mk_real_int64 373L); ]); +("y3_def_neg", [12; 13; 15; 17; 18; 19; 22; 25; 26; 29; 35; 37; 43; 44; 46; 48; 54; 58; ], [(mk_real_int64 867L); (mk_real_int64 405L); (mk_real_int64 110L); (mk_real_int64 24L); (mk_real_int64 177L); (mk_real_int64 90L); (mk_real_int64 1179L); (mk_real_int64 332L); (mk_real_int64 349L); (mk_real_int64 223L); (mk_real_int64 119L); (mk_real_int64 448L); (mk_real_int64 504L); (mk_real_int64 894L); (mk_real_int64 368L); (mk_real_int64 278L); (mk_real_int64 201L); (mk_real_int64 799L); ]); +("y4_def_neg", [0; 1; 2; 4; 9; 12; 14; 15; 19; 20; 25; 26; 28; 29; 31; 32; 36; 39; 40; 43; 45; ], [(mk_real_int64 444L); (mk_real_int64 124L); (mk_real_int64 100L); (mk_real_int64 602L); (mk_real_int64 16L); (mk_real_int64 1601L); (mk_real_int64 1780L); (mk_real_int64 1159L); (mk_real_int64 21L); (mk_real_int64 806L); (mk_real_int64 393L); (mk_real_int64 740L); (mk_real_int64 205L); (mk_real_int64 2683L); (mk_real_int64 194L); (mk_real_int64 489L); (mk_real_int64 758L); (mk_real_int64 364L); (mk_real_int64 193L); (mk_real_int64 1539L); (mk_real_int64 703L); ]); +("y4_def", [5; 7; 10; 11; 17; 18; 21; 27; 38; 42; 46; ], [(mk_real_int64 1117L); (mk_real_int64 557L); (mk_real_int64 898L); (mk_real_int64 193L); (mk_real_int64 1691L); (mk_real_int64 1775L); (mk_real_int64 1133L); (mk_real_int64 604L); (mk_real_int64 961L); (mk_real_int64 1023L); (mk_real_int64 1367L); ]); +("y5_def_neg", [1; 9; 12; 15; 17; 18; 22; 25; 26; 27; 29; 33; 35; 37; 39; 43; 44; 48; 50; 54; 55; 58; ], [(mk_real_int64 2182L); (mk_real_int64 124L); (mk_real_int64 602L); (mk_real_int64 110L); (mk_real_int64 16L); (mk_real_int64 177L); (mk_real_int64 705L); (mk_real_int64 332L); (mk_real_int64 349L); (mk_real_int64 21L); (mk_real_int64 223L); (mk_real_int64 393L); (mk_real_int64 119L); (mk_real_int64 30L); (mk_real_int64 194L); (mk_real_int64 356L); (mk_real_int64 605L); (mk_real_int64 193L); (mk_real_int64 673L); (mk_real_int64 201L); (mk_real_int64 350L); (mk_real_int64 656L); ]); +("y5_def", [8; 10; 13; 19; 20; 23; 28; 34; 36; 40; 46; 47; 57; ], [(mk_real_int64 224L); (mk_real_int64 53L); (mk_real_int64 602L); (mk_real_int64 193L); (mk_real_int64 705L); (mk_real_int64 615L); (mk_real_int64 428L); (mk_real_int64 393L); (mk_real_int64 109L); (mk_real_int64 194L); (mk_real_int64 605L); (mk_real_int64 193L); (mk_real_int64 373L); ]); +("y6_def_neg", [9; 12; 15; 18; 22; 25; 27; 29; 33; 35; 37; 39; 44; 48; 55; ], [(mk_real_int64 124L); (mk_real_int64 602L); (mk_real_int64 110L); (mk_real_int64 177L); (mk_real_int64 705L); (mk_real_int64 332L); (mk_real_int64 21L); (mk_real_int64 223L); (mk_real_int64 393L); (mk_real_int64 119L); (mk_real_int64 30L); (mk_real_int64 194L); (mk_real_int64 605L); (mk_real_int64 193L); (mk_real_int64 350L); ]); +("y6_def", [8; 10; 13; 14; 17; 19; 20; 23; 26; 28; 34; 36; 40; 46; 47; 54; 57; 58; ], [(mk_real_int64 224L); (mk_real_int64 53L); (mk_real_int64 602L); (mk_real_int64 110L); (mk_real_int64 93L); (mk_real_int64 193L); (mk_real_int64 705L); (mk_real_int64 615L); (mk_real_int64 2318L); (mk_real_int64 428L); (mk_real_int64 393L); (mk_real_int64 109L); (mk_real_int64 194L); (mk_real_int64 605L); (mk_real_int64 193L); (mk_real_int64 703L); (mk_real_int64 373L); (mk_real_int64 925L); ]); +("y8_def_neg", [2; 9; ], [(mk_real_int64 2182L); (mk_real_int64 673L); ]); +("RHA", [3; 5; 6; 8; 9; 10; 11; 12; 14; 15; 16; 17; 21; 22; 23; 24; 27; 28; 30; 31; 32; 33; 34; 36; 38; 40; 41; 43; 46; 47; 48; 49; 52; 54; 55; 56; 57; 59; ], [(mk_real_int64 319L); (mk_real_int64 319L); (mk_real_int64 879L); (mk_real_int64 874L); (mk_real_int64 951L); (mk_real_int64 1441L); (mk_real_int64 954L); (mk_real_int64 319L); (mk_real_int64 2513L); (mk_real_int64 1559L); (mk_real_int64 2751L); (mk_real_int64 1192L); (mk_real_int64 485L); (mk_real_int64 485L); (mk_real_int64 1758L); (mk_real_int64 2425L); (mk_real_int64 2425L); (mk_real_int64 1249L); (mk_real_int64 2425L); (mk_real_int64 919L); (mk_real_int64 2786L); (mk_real_int64 4292L); (mk_real_int64 3212L); (mk_real_int64 1207L); (mk_real_int64 1024L); (mk_real_int64 227L); (mk_real_int64 146L); (mk_real_int64 146L); (mk_real_int64 76L); (mk_real_int64 2053L); (mk_real_int64 2513L); (mk_real_int64 2751L); (mk_real_int64 167L); (mk_real_int64 2494L); (mk_real_int64 3891L); (mk_real_int64 5024L); (mk_real_int64 2424L); (mk_real_int64 919L); ]); +("tau4", [0; 1; 2; ], [(mk_real_int64 2230L); (mk_real_int64 3128L); (mk_real_int64 4051L); ]); +("ineq106", [0; 2; 12; 14; 15; 20; 26; 28; 29; 32; 36; 39; 43; 45; ], [(mk_real_int64 637L); (mk_real_int64 146L); (mk_real_int64 1677L); (mk_real_int64 1024L); (mk_real_int64 1691L); (mk_real_int64 1177L); (mk_real_int64 1080L); (mk_real_int64 299L); (mk_real_int64 2530L); (mk_real_int64 651L); (mk_real_int64 146L); (mk_real_int64 531L); (mk_real_int64 1134L); (mk_real_int64 1026L); ]); +("ineq107", [5; 7; 10; 17; 18; 21; 27; 35; 38; 42; 46; ], [(mk_real_int64 557L); (mk_real_int64 721L); (mk_real_int64 1162L); (mk_real_int64 2187L); (mk_real_int64 2297L); (mk_real_int64 1465L); (mk_real_int64 781L); (mk_real_int64 385L); (mk_real_int64 385L); (mk_real_int64 1324L); (mk_real_int64 2187L); ]); +("ineq108", [12; ], [(mk_real_int64 522L); ]); +("ineq109", [5; 11; 35; 38; ], [(mk_real_int64 2124L); (mk_real_int64 597L); (mk_real_int64 28L); (mk_real_int64 2053L); ]); +("ineq110", [1; 12; 19; 25; 31; 43; ], [(mk_real_int64 632L); (mk_real_int64 485L); (mk_real_int64 109L); (mk_real_int64 2005L); (mk_real_int64 988L); (mk_real_int64 3891L); ]); +("ineq111", [0; 4; 9; 14; 29; 32; 35; 36; 40; 46; ], [(mk_real_int64 62L); (mk_real_int64 4814L); (mk_real_int64 131L); (mk_real_int64 8623L); (mk_real_int64 7602L); (mk_real_int64 346L); (mk_real_int64 2454L); (mk_real_int64 5264L); (mk_real_int64 1546L); (mk_real_int64 2590L); ]); +("ineq112", [21; ], [(mk_real_int64 1424L); ]); +("ineq113", [2; 7; 10; 31; 35; 42; ], [(mk_real_int64 6583L); (mk_real_int64 1546L); (mk_real_int64 3558L); (mk_real_int64 8476L); (mk_real_int64 5767L); (mk_real_int64 3297L); ]); +("ineq114", [0; 3; 4; 8; 9; 11; 15; 16; 19; 20; 22; 23; 25; 30; 32; 33; 34; 37; 41; 44; 45; 47; ], [(mk_real_int64 1830L); (mk_real_int64 902L); (mk_real_int64 3392L); (mk_real_int64 6003L); (mk_real_int64 4466L); (mk_real_int64 954L); (mk_real_int64 2809L); (mk_real_int64 3874L); (mk_real_int64 3700L); (mk_real_int64 2983L); (mk_real_int64 5037L); (mk_real_int64 221L); (mk_real_int64 4816L); (mk_real_int64 58L); (mk_real_int64 229L); (mk_real_int64 278L); (mk_real_int64 1489L); (mk_real_int64 4723L); (mk_real_int64 6003L); (mk_real_int64 1811L); (mk_real_int64 3872L); (mk_real_int64 221L); ]); +("ineq119", [2; 7; 9; ], [(mk_real_int64 5916L); (mk_real_int64 2664L); (mk_real_int64 4531L); ]); +("ineq120", [0; 4; 6; 10; ], [(mk_real_int64 962L); (mk_real_int64 962L); (mk_real_int64 2354L); (mk_real_int64 1551L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 47072L); (mk_real_int64 42088L); (mk_real_int64 42088L); (mk_real_int64 42088L); (mk_real_int64 42088L); (mk_real_int64 50008L); (mk_real_int64 45104L); (mk_real_int64 51590L); (mk_real_int64 46382L); (mk_real_int64 51590L); (mk_real_int64 51590L); (mk_real_int64 29540L); (mk_real_int64 34928L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [0; 2; 4; 7; 19; 23; 24; 27; 29; 30; 31; 38; 40; 41; 42; 43; 51; 52; 54; 56; 59; ], [(mk_real_int64 5226L); (mk_real_int64 520L); (mk_real_int64 5226L); (mk_real_int64 2080L); (mk_real_int64 2040L); (mk_real_int64 4340L); (mk_real_int64 1240L); (mk_real_int64 2000L); (mk_real_int64 320L); (mk_real_int64 1620L); (mk_real_int64 3460L); (mk_real_int64 3080L); (mk_real_int64 3540L); (mk_real_int64 280L); (mk_real_int64 1140L); (mk_real_int64 3470L); (mk_real_int64 4570L); (mk_real_int64 5723L); (mk_real_int64 770L); (mk_real_int64 6860L); (mk_real_int64 3460L); ]); +("azim_lo", [6; 8; 10; 11; 12; 13; 15; 16; 17; 18; 26; 28; 33; 39; 45; 46; 49; 57; ], [(mk_real_int64 3158L); (mk_real_int64 4200L); (mk_real_int64 9970L); (mk_real_int64 3480L); (mk_real_int64 6080L); (mk_real_int64 10000L); (mk_real_int64 4140L); (mk_real_int64 1220L); (mk_real_int64 2840L); (mk_real_int64 5220L); (mk_real_int64 10000L); (mk_real_int64 6420L); (mk_real_int64 1840L); (mk_real_int64 2840L); (mk_real_int64 4020L); (mk_real_int64 10000L); (mk_real_int64 1220L); (mk_real_int64 1280L); ]); +("rhazim_hi", [10; 28; 46; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("rhazim_lo", [22; 23; 37; 38; 40; 56; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("rho_lo", [0; 1; 2; 3; 4; 6; 8; 12; ], [(mk_real_int64 2736L); (mk_real_int64 6144L); (mk_real_int64 6144L); (mk_real_int64 6144L); (mk_real_int64 6144L); (mk_real_int64 24416L); (mk_real_int64 400L); (mk_real_int64 31136L); ]); +("rho_hi", [5; 7; 9; 10; 11; ], [(mk_real_int64 23184L); (mk_real_int64 26656L); (mk_real_int64 26656L); (mk_real_int64 26656L); (mk_real_int64 6256L); ]); +("tau_hi", [5; 12; 13; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("tau_lo", [2; 9; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("y1_lo", [8; 13; 19; 20; 25; 27; 28; 29; 33; 35; 36; 39; 43; 44; 46; 48; 57; 58; ], [(mk_real_int64 3600L); (mk_real_int64 2240L); (mk_real_int64 1470L); (mk_real_int64 5700L); (mk_real_int64 5000L); (mk_real_int64 5800L); (mk_real_int64 2000L); (mk_real_int64 5000L); (mk_real_int64 1000L); (mk_real_int64 5000L); (mk_real_int64 4000L); (mk_real_int64 5600L); (mk_real_int64 4480L); (mk_real_int64 1200L); (mk_real_int64 5030L); (mk_real_int64 2800L); (mk_real_int64 6000L); (mk_real_int64 7000L); ]); +("y1_hi", [9; 10; 12; 15; 17; 22; 23; 26; 37; 40; 47; 55; ], [(mk_real_int64 1600L); (mk_real_int64 4000L); (mk_real_int64 4800L); (mk_real_int64 5000L); (mk_real_int64 4200L); (mk_real_int64 4600L); (mk_real_int64 4000L); (mk_real_int64 5000L); (mk_real_int64 6400L); (mk_real_int64 1200L); (mk_real_int64 4000L); (mk_real_int64 1800L); ]); +("y2_lo", [8; 13; 19; 20; 22; 25; 26; 27; 33; 36; 39; 40; 43; 44; 46; 48; 54; ], [(mk_real_int64 3557L); (mk_real_int64 3880L); (mk_real_int64 1470L); (mk_real_int64 4839L); (mk_real_int64 5064L); (mk_real_int64 4240L); (mk_real_int64 1440L); (mk_real_int64 5800L); (mk_real_int64 1000L); (mk_real_int64 1939L); (mk_real_int64 5600L); (mk_real_int64 3811L); (mk_real_int64 4680L); (mk_real_int64 3906L); (mk_real_int64 5230L); (mk_real_int64 2800L); (mk_real_int64 2480L); ]); +("y2_hi", [9; 10; 12; 15; 17; 18; 23; 28; 29; 34; 35; 37; 47; 55; 57; 58; ], [(mk_real_int64 1600L); (mk_real_int64 1294L); (mk_real_int64 4800L); (mk_real_int64 4080L); (mk_real_int64 4200L); (mk_real_int64 3760L); (mk_real_int64 3549L); (mk_real_int64 3103L); (mk_real_int64 3200L); (mk_real_int64 120L); (mk_real_int64 2880L); (mk_real_int64 3070L); (mk_real_int64 2309L); (mk_real_int64 2426L); (mk_real_int64 3614L); (mk_real_int64 3760L); ]); +("y3_lo", [8; 13; 19; 20; 22; 25; 26; 27; 33; 36; 39; 40; 43; 44; 46; 48; 54; ], [(mk_real_int64 3557L); (mk_real_int64 3880L); (mk_real_int64 1470L); (mk_real_int64 4839L); (mk_real_int64 5064L); (mk_real_int64 4240L); (mk_real_int64 1440L); (mk_real_int64 5800L); (mk_real_int64 1000L); (mk_real_int64 1939L); (mk_real_int64 5600L); (mk_real_int64 3811L); (mk_real_int64 4680L); (mk_real_int64 3906L); (mk_real_int64 5230L); (mk_real_int64 2800L); (mk_real_int64 2480L); ]); +("y3_hi", [9; 10; 12; 15; 17; 18; 23; 28; 29; 34; 35; 37; 47; 55; 57; 58; ], [(mk_real_int64 1600L); (mk_real_int64 1294L); (mk_real_int64 4800L); (mk_real_int64 4080L); (mk_real_int64 4200L); (mk_real_int64 3760L); (mk_real_int64 3549L); (mk_real_int64 3103L); (mk_real_int64 3200L); (mk_real_int64 120L); (mk_real_int64 2880L); (mk_real_int64 3070L); (mk_real_int64 2309L); (mk_real_int64 2426L); (mk_real_int64 3614L); (mk_real_int64 3760L); ]); +("y4_hi", [1; 4; 5; 7; 10; 14; 15; 18; 25; 26; 28; 31; 38; 39; 42; 45; ], [(mk_real_int64 1280L); (mk_real_int64 2500L); (mk_real_int64 378L); (mk_real_int64 3330L); (mk_real_int64 2260L); (mk_real_int64 6850L); (mk_real_int64 6650L); (mk_real_int64 5810L); (mk_real_int64 200L); (mk_real_int64 2000L); (mk_real_int64 1850L); (mk_real_int64 3520L); (mk_real_int64 1346L); (mk_real_int64 2650L); (mk_real_int64 4520L); (mk_real_int64 1900L); ]); +("y4_lo", [0; 2; 9; 11; 12; 17; 19; 20; 21; 27; 29; 32; 35; 36; 40; 43; 46; ], [(mk_real_int64 950L); (mk_real_int64 100L); (mk_real_int64 3750L); (mk_real_int64 496L); (mk_real_int64 3750L); (mk_real_int64 4490L); (mk_real_int64 3640L); (mk_real_int64 2450L); (mk_real_int64 5550L); (mk_real_int64 2870L); (mk_real_int64 3000L); (mk_real_int64 1850L); (mk_real_int64 954L); (mk_real_int64 100L); (mk_real_int64 2500L); (mk_real_int64 4260L); (mk_real_int64 1990L); ]); +("y5_hi", [8; 9; 10; 12; 15; 18; 20; 23; 28; 29; 33; 34; 35; 37; 39; 44; 46; 47; 55; 57; ], [(mk_real_int64 543L); (mk_real_int64 1280L); (mk_real_int64 1294L); (mk_real_int64 2500L); (mk_real_int64 4080L); (mk_real_int64 3760L); (mk_real_int64 1561L); (mk_real_int64 3549L); (mk_real_int64 3103L); (mk_real_int64 3200L); (mk_real_int64 200L); (mk_real_int64 120L); (mk_real_int64 2880L); (mk_real_int64 4170L); (mk_real_int64 3520L); (mk_real_int64 1294L); (mk_real_int64 96L); (mk_real_int64 2309L); (mk_real_int64 266L); (mk_real_int64 3614L); ]); +("y5_lo", [13; 17; 19; 22; 25; 26; 27; 36; 40; 43; 48; 54; 58; ], [(mk_real_int64 1872L); (mk_real_int64 3750L); (mk_real_int64 496L); (mk_real_int64 2414L); (mk_real_int64 4240L); (mk_real_int64 1440L); (mk_real_int64 3640L); (mk_real_int64 1939L); (mk_real_int64 3511L); (mk_real_int64 2204L); (mk_real_int64 2500L); (mk_real_int64 2480L); (mk_real_int64 1740L); ]); +("y6_hi", [8; 9; 10; 12; 15; 17; 18; 20; 23; 26; 28; 29; 33; 34; 35; 37; 39; 44; 46; 47; 55; 57; 58; ], [(mk_real_int64 543L); (mk_real_int64 1280L); (mk_real_int64 1294L); (mk_real_int64 2500L); (mk_real_int64 4080L); (mk_real_int64 6250L); (mk_real_int64 3760L); (mk_real_int64 1561L); (mk_real_int64 3549L); (mk_real_int64 8560L); (mk_real_int64 3103L); (mk_real_int64 3200L); (mk_real_int64 200L); (mk_real_int64 120L); (mk_real_int64 2880L); (mk_real_int64 4170L); (mk_real_int64 3520L); (mk_real_int64 1294L); (mk_real_int64 96L); (mk_real_int64 2309L); (mk_real_int64 266L); (mk_real_int64 3614L); (mk_real_int64 8260L); ]); +("y6_lo", [13; 14; 17; 19; 22; 25; 26; 27; 36; 40; 43; 48; 54; 58; ], [(mk_real_int64 1872L); (mk_real_int64 1100000L); (mk_real_int64 1100000L); (mk_real_int64 496L); (mk_real_int64 2414L); (mk_real_int64 4240L); (mk_real_int64 26680000L); (mk_real_int64 3640L); (mk_real_int64 1939L); (mk_real_int64 3511L); (mk_real_int64 3562204L); (mk_real_int64 2500L); (mk_real_int64 9042480L); (mk_real_int64 15820000L); ]); +("y8_hi", [2; 9; ], [(mk_real_int64 21820000L); (mk_real_int64 6730000L); ]); +("ye_lo", [17; 28; 34; 37; 58; ], [(mk_real_int64 10000L); (mk_real_int64 1650000L); (mk_real_int64 26930000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("yn_lo", [0; 1; 2; 3; 4; 6; 8; 11; 12; ], [(mk_real_int64 2986L); (mk_real_int64 12298L); (mk_real_int64 2298L); (mk_real_int64 2298L); (mk_real_int64 2298L); (mk_real_int64 11286L); (mk_real_int64 12764L); (mk_real_int64 3360L); (mk_real_int64 4140L); ]); +("yn_hi", [5; 7; 9; 10; ], [(mk_real_int64 12541L); (mk_real_int64 8732L); (mk_real_int64 8732L); (mk_real_int64 8732L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/74394196986_out.hl b/formal_lp/old/ineqs/tests2/74394196986_out.hl new file mode 100644 index 0000000..a27c00c --- /dev/null +++ b/formal_lp/old/ineqs/tests2/74394196986_out.hl @@ -0,0 +1,83 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "74394196986 22 4 0 1 2 3 4 0 3 4 5 3 4 3 6 3 6 3 2 4 6 2 7 8 3 7 2 1 3 7 1 9 3 9 1 10 3 10 1 0 3 10 0 5 3 10 5 11 3 11 5 12 3 12 5 4 3 12 4 13 3 13 4 6 3 13 6 8 3 8 7 14 3 14 7 9 3 14 9 11 3 9 10 11 4 14 11 12 13 3 13 8 14 ";; +let precision = 4;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [1; 2; 5; 7; 10; ], [(mk_real_int64 317L); (mk_real_int64 4116L); (mk_real_int64 1351L); (mk_real_int64 937L); (mk_real_int64 3610L); ]); +("azim_sum_neg", [4; 6; 9; 13; ], [(mk_real_int64 508L); (mk_real_int64 350L); (mk_real_int64 375L); (mk_real_int64 1008L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 10357L); (mk_real_int64 10087L); (mk_real_int64 10357L); (mk_real_int64 10357L); (mk_real_int64 10865L); (mk_real_int64 11244L); (mk_real_int64 11325L); (mk_real_int64 10147L); (mk_real_int64 10091L); (mk_real_int64 10091L); (mk_real_int64 11293L); (mk_real_int64 10357L); (mk_real_int64 11293L); (mk_real_int64 10087L); (mk_real_int64 11293L); ]); +("sol_sum3", [12; 13; ], [(mk_real_int64 1008L); (mk_real_int64 1008L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; ], [(mk_real_int64 10357L); (mk_real_int64 10357L); (mk_real_int64 10147L); (mk_real_int64 10091L); (mk_real_int64 10091L); (mk_real_int64 10091L); (mk_real_int64 10091L); (mk_real_int64 10091L); (mk_real_int64 10357L); (mk_real_int64 10357L); (mk_real_int64 10357L); (mk_real_int64 10975L); (mk_real_int64 10087L); (mk_real_int64 10087L); (mk_real_int64 10091L); (mk_real_int64 10091L); (mk_real_int64 10091L); (mk_real_int64 10087L); ]); +("tau_sum4_neg", [0; 1; 2; 3; ], [(mk_real_int64 10357L); (mk_real_int64 10357L); (mk_real_int64 10087L); (mk_real_int64 11293L); ]); +("ln_def_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 1419L); (mk_real_int64 1122L); (mk_real_int64 1419L); (mk_real_int64 1419L); (mk_real_int64 1979L); (mk_real_int64 2397L); (mk_real_int64 2487L); (mk_real_int64 1187L); (mk_real_int64 1127L); (mk_real_int64 1127L); (mk_real_int64 2451L); (mk_real_int64 1419L); (mk_real_int64 2451L); (mk_real_int64 1122L); (mk_real_int64 2451L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 65075L); (mk_real_int64 63380L); (mk_real_int64 65075L); (mk_real_int64 65075L); (mk_real_int64 68264L); (mk_real_int64 70647L); (mk_real_int64 71158L); (mk_real_int64 63753L); (mk_real_int64 63407L); (mk_real_int64 63407L); (mk_real_int64 70955L); (mk_real_int64 65075L); (mk_real_int64 70955L); (mk_real_int64 63380L); (mk_real_int64 70955L); ]); +("edge_sym", [5; 15; 26; 34; ], [(mk_real_int64 724L); (mk_real_int64 127L); (mk_real_int64 2503L); (mk_real_int64 387L); ]); +("edge_sym_neg", [9; 10; 13; 20; 22; 23; 25; 29; 32; 35; 37; 41; 43; 47; 50; 52; 53; 58; ], [(mk_real_int64 724L); (mk_real_int64 724L); (mk_real_int64 127L); (mk_real_int64 387L); (mk_real_int64 120L); (mk_real_int64 1884L); (mk_real_int64 444L); (mk_real_int64 347L); (mk_real_int64 1447L); (mk_real_int64 41L); (mk_real_int64 387L); (mk_real_int64 848L); (mk_real_int64 661L); (mk_real_int64 933L); (mk_real_int64 114L); (mk_real_int64 89L); (mk_real_int64 89L); (mk_real_int64 388L); ]); +("y1_def_neg", [10; 11; 15; 19; 20; 21; 22; 26; 28; 29; 31; 34; 35; 38; 40; 44; 45; 47; 48; 50; 51; 52; 53; 54; 55; 56; 57; 59; 62; 67; ], [(mk_real_int64 1043L); (mk_real_int64 1686L); (mk_real_int64 100L); (mk_real_int64 58L); (mk_real_int64 313L); (mk_real_int64 88L); (mk_real_int64 1480L); (mk_real_int64 369L); (mk_real_int64 557L); (mk_real_int64 159L); (mk_real_int64 1899L); (mk_real_int64 46L); (mk_real_int64 1873L); (mk_real_int64 557L); (mk_real_int64 1221L); (mk_real_int64 952L); (mk_real_int64 191L); (mk_real_int64 1510L); (mk_real_int64 152L); (mk_real_int64 634L); (mk_real_int64 152L); (mk_real_int64 609L); (mk_real_int64 14L); (mk_real_int64 721L); (mk_real_int64 33L); (mk_real_int64 1547L); (mk_real_int64 222L); (mk_real_int64 194L); (mk_real_int64 2139L); (mk_real_int64 1122L); ]); +("y1_def", [27; 30; 33; 61; 68; ], [(mk_real_int64 188L); (mk_real_int64 188L); (mk_real_int64 188L); (mk_real_int64 188L); (mk_real_int64 504L); ]); +("y2_def_neg", [10; 11; 20; 22; 26; 27; 28; 30; 31; 33; 35; 38; 40; 44; 47; 48; 50; 51; 52; 56; 59; 61; 62; 67; 68; ], [(mk_real_int64 1043L); (mk_real_int64 1686L); (mk_real_int64 313L); (mk_real_int64 204L); (mk_real_int64 614L); (mk_real_int64 57L); (mk_real_int64 557L); (mk_real_int64 57L); (mk_real_int64 1643L); (mk_real_int64 57L); (mk_real_int64 224L); (mk_real_int64 557L); (mk_real_int64 1221L); (mk_real_int64 952L); (mk_real_int64 1510L); (mk_real_int64 152L); (mk_real_int64 634L); (mk_real_int64 152L); (mk_real_int64 609L); (mk_real_int64 1547L); (mk_real_int64 194L); (mk_real_int64 57L); (mk_real_int64 248L); (mk_real_int64 1122L); (mk_real_int64 153L); ]); +("y2_def", [15; 19; 21; 29; 34; 45; 53; 54; 55; 57; ], [(mk_real_int64 127L); (mk_real_int64 90L); (mk_real_int64 105L); (mk_real_int64 97L); (mk_real_int64 28L); (mk_real_int64 116L); (mk_real_int64 8L); (mk_real_int64 437L); (mk_real_int64 20L); (mk_real_int64 134L); ]); +("y3_def_neg", [10; 11; 20; 22; 26; 27; 28; 30; 31; 33; 35; 38; 40; 44; 47; 48; 50; 51; 52; 56; 59; 61; 62; 67; 68; ], [(mk_real_int64 1043L); (mk_real_int64 1686L); (mk_real_int64 313L); (mk_real_int64 204L); (mk_real_int64 614L); (mk_real_int64 57L); (mk_real_int64 557L); (mk_real_int64 57L); (mk_real_int64 1643L); (mk_real_int64 57L); (mk_real_int64 224L); (mk_real_int64 557L); (mk_real_int64 1221L); (mk_real_int64 952L); (mk_real_int64 1510L); (mk_real_int64 152L); (mk_real_int64 634L); (mk_real_int64 152L); (mk_real_int64 609L); (mk_real_int64 1547L); (mk_real_int64 194L); (mk_real_int64 57L); (mk_real_int64 248L); (mk_real_int64 1122L); (mk_real_int64 153L); ]); +("y3_def", [15; 19; 21; 29; 34; 45; 53; 54; 55; 57; ], [(mk_real_int64 127L); (mk_real_int64 90L); (mk_real_int64 105L); (mk_real_int64 97L); (mk_real_int64 28L); (mk_real_int64 116L); (mk_real_int64 8L); (mk_real_int64 437L); (mk_real_int64 20L); (mk_real_int64 134L); ]); +("y4_def_neg", [2; 3; 7; 8; 9; 10; 14; 16; 17; 19; 22; 23; 26; 28; 32; 33; 35; 38; 40; 41; 42; 43; 44; 45; 47; 50; ], [(mk_real_int64 724L); (mk_real_int64 1171L); (mk_real_int64 169L); (mk_real_int64 217L); (mk_real_int64 197L); (mk_real_int64 1988L); (mk_real_int64 97L); (mk_real_int64 387L); (mk_real_int64 182L); (mk_real_int64 1390L); (mk_real_int64 53L); (mk_real_int64 2050L); (mk_real_int64 387L); (mk_real_int64 848L); (mk_real_int64 661L); (mk_real_int64 218L); (mk_real_int64 1049L); (mk_real_int64 440L); (mk_real_int64 423L); (mk_real_int64 15L); (mk_real_int64 823L); (mk_real_int64 38L); (mk_real_int64 1074L); (mk_real_int64 253L); (mk_real_int64 134L); (mk_real_int64 2446L); ]); +("y4_def", [15; 18; 21; 36; 39; 49; 51; 52; ], [(mk_real_int64 290L); (mk_real_int64 290L); (mk_real_int64 290L); (mk_real_int64 326L); (mk_real_int64 326L); (mk_real_int64 290L); (mk_real_int64 242L); (mk_real_int64 779L); ]); +("y5_def_neg", [10; 11; 20; 26; 27; 28; 30; 31; 33; 38; 40; 44; 47; 50; 52; 56; 59; 61; 67; 68; ], [(mk_real_int64 724L); (mk_real_int64 1171L); (mk_real_int64 217L); (mk_real_int64 444L); (mk_real_int64 57L); (mk_real_int64 387L); (mk_real_int64 57L); (mk_real_int64 1112L); (mk_real_int64 57L); (mk_real_int64 387L); (mk_real_int64 848L); (mk_real_int64 661L); (mk_real_int64 1049L); (mk_real_int64 440L); (mk_real_int64 423L); (mk_real_int64 1074L); (mk_real_int64 134L); (mk_real_int64 57L); (mk_real_int64 779L); (mk_real_int64 153L); ]); +("y5_def", [15; 19; 21; 22; 29; 34; 35; 45; 48; 51; 53; 54; 55; 57; 62; ], [(mk_real_int64 127L); (mk_real_int64 90L); (mk_real_int64 105L); (mk_real_int64 77L); (mk_real_int64 97L); (mk_real_int64 28L); (mk_real_int64 69L); (mk_real_int64 116L); (mk_real_int64 326L); (mk_real_int64 326L); (mk_real_int64 8L); (mk_real_int64 437L); (mk_real_int64 20L); (mk_real_int64 134L); (mk_real_int64 98L); ]); +("y6_def_neg", [10; 20; 26; 28; 31; 47; 50; 52; 56; 59; 61; 68; ], [(mk_real_int64 724L); (mk_real_int64 217L); (mk_real_int64 444L); (mk_real_int64 387L); (mk_real_int64 290L); (mk_real_int64 1049L); (mk_real_int64 440L); (mk_real_int64 423L); (mk_real_int64 1074L); (mk_real_int64 134L); (mk_real_int64 57L); (mk_real_int64 153L); ]); +("y6_def", [11; 12; 13; 15; 19; 21; 22; 24; 27; 29; 30; 33; 34; 35; 39; 42; 45; 46; 48; 49; 51; 53; 54; 55; 57; 62; 67; ], [(mk_real_int64 724L); (mk_real_int64 1171L); (mk_real_int64 1044L); (mk_real_int64 127L); (mk_real_int64 217L); (mk_real_int64 309L); (mk_real_int64 77L); (mk_real_int64 216L); (mk_real_int64 1012L); (mk_real_int64 97L); (mk_real_int64 1459L); (mk_real_int64 3470L); (mk_real_int64 28L); (mk_real_int64 69L); (mk_real_int64 1235L); (mk_real_int64 1509L); (mk_real_int64 1709L); (mk_real_int64 1990L); (mk_real_int64 1373L); (mk_real_int64 114L); (mk_real_int64 438L); (mk_real_int64 8L); (mk_real_int64 1143L); (mk_real_int64 3781L); (mk_real_int64 134L); (mk_real_int64 98L); (mk_real_int64 268L); ]); +("RHA", [6; 7; 8; 10; 11; 14; 16; 20; 25; 28; 32; 34; 36; 37; 40; 41; 43; 44; 46; 47; 48; 49; 52; 53; 57; 59; 67; 69; ], [(mk_real_int64 887L); (mk_real_int64 508L); (mk_real_int64 887L); (mk_real_int64 968L); (mk_real_int64 968L); (mk_real_int64 1238L); (mk_real_int64 59L); (mk_real_int64 210L); (mk_real_int64 266L); (mk_real_int64 266L); (mk_real_int64 773L); (mk_real_int64 696L); (mk_real_int64 936L); (mk_real_int64 508L); (mk_real_int64 508L); (mk_real_int64 887L); (mk_real_int64 887L); (mk_real_int64 936L); (mk_real_int64 269L); (mk_real_int64 350L); (mk_real_int64 1206L); (mk_real_int64 1238L); (mk_real_int64 59L); (mk_real_int64 1183L); (mk_real_int64 832L); (mk_real_int64 1201L); (mk_real_int64 1206L); (mk_real_int64 1206L); ]); +("RHB", [2; 13; 19; 65; ], [(mk_real_int64 270L); (mk_real_int64 270L); (mk_real_int64 59L); (mk_real_int64 936L); ]); +("tau4", [0; 1; 2; 3; ], [(mk_real_int64 4922L); (mk_real_int64 7402L); (mk_real_int64 5373L); (mk_real_int64 4097L); ]); +("ineq105", [9; ], [(mk_real_int64 317L); ]); +("ineq106", [9; 10; 17; 19; 22; 23; 33; 41; 42; 43; 45; 50; ], [(mk_real_int64 55L); (mk_real_int64 266L); (mk_real_int64 266L); (mk_real_int64 266L); (mk_real_int64 77L); (mk_real_int64 1201L); (mk_real_int64 318L); (mk_real_int64 23L); (mk_real_int64 1201L); (mk_real_int64 55L); (mk_real_int64 370L); (mk_real_int64 1201L); ]); +("ineq107", [14; 15; 18; 21; 49; 52; ], [(mk_real_int64 375L); (mk_real_int64 375L); (mk_real_int64 375L); (mk_real_int64 375L); (mk_real_int64 375L); (mk_real_int64 1008L); ]); +("ineq108", [7; 9; 10; 23; 50; ], [(mk_real_int64 247L); (mk_real_int64 233L); (mk_real_int64 1704L); (mk_real_int64 819L); (mk_real_int64 1224L); ]); +("ineq109", [36; 39; ], [(mk_real_int64 1008L); (mk_real_int64 1008L); ]); +("ineq111", [2; 3; 8; 10; 14; 16; 19; 23; 26; 28; 32; 35; 38; 40; 44; 47; 50; 51; ], [(mk_real_int64 5795L); (mk_real_int64 9369L); (mk_real_int64 1740L); (mk_real_int64 5114L); (mk_real_int64 3093L); (mk_real_int64 3093L); (mk_real_int64 9667L); (mk_real_int64 5331L); (mk_real_int64 3094L); (mk_real_int64 6782L); (mk_real_int64 5287L); (mk_real_int64 8388L); (mk_real_int64 3521L); (mk_real_int64 3384L); (mk_real_int64 8595L); (mk_real_int64 1076L); (mk_real_int64 6279L); (mk_real_int64 6235L); ]); +("ineq114", [0; 2; 3; 6; 8; 9; 10; 13; 16; 20; 22; 23; 24; 29; 31; 32; 34; 36; 37; 40; 41; 43; 45; 47; 50; 51; 53; ], [(mk_real_int64 3575L); (mk_real_int64 988L); (mk_real_int64 988L); (mk_real_int64 1497L); (mk_real_int64 6911L); (mk_real_int64 1125L); (mk_real_int64 3852L); (mk_real_int64 6999L); (mk_real_int64 6999L); (mk_real_int64 424L); (mk_real_int64 302L); (mk_real_int64 4459L); (mk_real_int64 7263L); (mk_real_int64 3575L); (mk_real_int64 3575L); (mk_real_int64 1495L); (mk_real_int64 2587L); (mk_real_int64 3537L); (mk_real_int64 3029L); (mk_real_int64 3202L); (mk_real_int64 3501L); (mk_real_int64 1497L); (mk_real_int64 1329L); (mk_real_int64 7687L); (mk_real_int64 3812L); (mk_real_int64 1926L); (mk_real_int64 1926L); ]); +("ineq119", [11; 14; ], [(mk_real_int64 2226L); (mk_real_int64 2428L); ]); +("ineq120", [1; 6; 8; 10; 13; ], [(mk_real_int64 5435L); (mk_real_int64 2955L); (mk_real_int64 1173L); (mk_real_int64 1316L); (mk_real_int64 4768L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; ], [(mk_real_int64 48450L); (mk_real_int64 51480L); (mk_real_int64 48450L); (mk_real_int64 48450L); (mk_real_int64 54944L); (mk_real_int64 55162L); (mk_real_int64 58868L); (mk_real_int64 47238L); (mk_real_int64 54122L); (mk_real_int64 54122L); (mk_real_int64 54930L); (mk_real_int64 48450L); (mk_real_int64 54930L); (mk_real_int64 51480L); (mk_real_int64 54930L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [2; 10; 11; 13; 14; 16; 18; 20; 21; 32; 34; 35; 36; 48; 49; 52; 53; 55; 59; 62; 64; 65; ], [(mk_real_int64 3850L); (mk_real_int64 4880L); (mk_real_int64 4880L); (mk_real_int64 3850L); (mk_real_int64 3129L); (mk_real_int64 6068L); (mk_real_int64 1220L); (mk_real_int64 2860L); (mk_real_int64 2500L); (mk_real_int64 4240L); (mk_real_int64 10520L); (mk_real_int64 3340L); (mk_real_int64 6380L); (mk_real_int64 1620L); (mk_real_int64 1540L); (mk_real_int64 4520L); (mk_real_int64 6260L); (mk_real_int64 1220L); (mk_real_int64 10620L); (mk_real_int64 3120L); (mk_real_int64 8064L); (mk_real_int64 3840L); ]); +("azim_lo", [1; 6; 8; 17; 19; 22; 25; 28; 41; 43; 44; 46; 57; 67; 69; ], [(mk_real_int64 745L); (mk_real_int64 1785L); (mk_real_int64 500L); (mk_real_int64 3780L); (mk_real_int64 6455L); (mk_real_int64 6480L); (mk_real_int64 6260L); (mk_real_int64 6260L); (mk_real_int64 500L); (mk_real_int64 500L); (mk_real_int64 1300L); (mk_real_int64 5380L); (mk_real_int64 460L); (mk_real_int64 3240L); (mk_real_int64 3240L); ]); +("rhazim_lo", [16; 21; 32; 34; 35; 52; 54; 55; 59; 62; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("rhazim_hi", [19; ], [(mk_real_int64 10000L); ]); +("rho_hi", [0; 2; 3; 4; 5; 7; 10; 11; 12; 14; ], [(mk_real_int64 1024L); (mk_real_int64 1024L); (mk_real_int64 1024L); (mk_real_int64 29680L); (mk_real_int64 13008L); (mk_real_int64 26304L); (mk_real_int64 11776L); (mk_real_int64 1024L); (mk_real_int64 11776L); (mk_real_int64 11776L); ]); +("rho_lo", [1; 6; 8; 9; 13; ], [(mk_real_int64 13616L); (mk_real_int64 7600L); (mk_real_int64 32288L); (mk_real_int64 32288L); (mk_real_int64 13616L); ]); +("tau_hi", [2; 4; 5; 7; 8; 10; 17; 18; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("y1_lo", [10; 11; 19; 20; 22; 26; 27; 29; 30; 31; 33; 34; 48; 51; 52; 56; 61; 67; ], [(mk_real_int64 1000L); (mk_real_int64 4200L); (mk_real_int64 450L); (mk_real_int64 2000L); (mk_real_int64 5600L); (mk_real_int64 2400L); (mk_real_int64 5000L); (mk_real_int64 6000L); (mk_real_int64 5000L); (mk_real_int64 6600L); (mk_real_int64 5000L); (mk_real_int64 2000L); (mk_real_int64 2080L); (mk_real_int64 2080L); (mk_real_int64 1200L); (mk_real_int64 1000L); (mk_real_int64 5000L); (mk_real_int64 3000L); ]); +("y1_hi", [15; 21; 28; 35; 38; 40; 44; 45; 47; 50; 53; 54; 59; 62; ], [(mk_real_int64 1450L); (mk_real_int64 2450L); (mk_real_int64 2600L); (mk_real_int64 3550L); (mk_real_int64 800L); (mk_real_int64 2400L); (mk_real_int64 3400L); (mk_real_int64 2000L); (mk_real_int64 1600L); (mk_real_int64 2200L); (mk_real_int64 2000L); (mk_real_int64 4000L); (mk_real_int64 3200L); (mk_real_int64 5400L); ]); +("y2_lo", [10; 11; 19; 20; 21; 29; 31; 35; 45; 48; 51; 52; 56; 67; 68; ], [(mk_real_int64 1000L); (mk_real_int64 4200L); (mk_real_int64 1167L); (mk_real_int64 2000L); (mk_real_int64 1968L); (mk_real_int64 2026L); (mk_real_int64 2626L); (mk_real_int64 5020L); (mk_real_int64 2798L); (mk_real_int64 2080L); (mk_real_int64 2080L); (mk_real_int64 1200L); (mk_real_int64 1000L); (mk_real_int64 3000L); (mk_real_int64 2160L); ]); +("y2_hi", [15; 22; 26; 28; 34; 38; 40; 44; 47; 50; 53; 54; 55; 57; 59; 62; ], [(mk_real_int64 4340L); (mk_real_int64 3630L); (mk_real_int64 2600L); (mk_real_int64 2600L); (mk_real_int64 203L); (mk_real_int64 800L); (mk_real_int64 2400L); (mk_real_int64 3400L); (mk_real_int64 1600L); (mk_real_int64 2200L); (mk_real_int64 3697L); (mk_real_int64 439L); (mk_real_int64 145L); (mk_real_int64 6430L); (mk_real_int64 3200L); (mk_real_int64 2375L); ]); +("y3_lo", [10; 11; 19; 20; 21; 29; 31; 35; 45; 48; 51; 52; 56; 67; 68; ], [(mk_real_int64 1000L); (mk_real_int64 4200L); (mk_real_int64 1167L); (mk_real_int64 2000L); (mk_real_int64 1968L); (mk_real_int64 2026L); (mk_real_int64 2626L); (mk_real_int64 5020L); (mk_real_int64 2798L); (mk_real_int64 2080L); (mk_real_int64 2080L); (mk_real_int64 1200L); (mk_real_int64 1000L); (mk_real_int64 3000L); (mk_real_int64 2160L); ]); +("y3_hi", [15; 22; 26; 28; 34; 38; 40; 44; 47; 50; 53; 54; 55; 57; 59; 62; ], [(mk_real_int64 4340L); (mk_real_int64 3630L); (mk_real_int64 2600L); (mk_real_int64 2600L); (mk_real_int64 203L); (mk_real_int64 800L); (mk_real_int64 2400L); (mk_real_int64 3400L); (mk_real_int64 1600L); (mk_real_int64 2200L); (mk_real_int64 3697L); (mk_real_int64 439L); (mk_real_int64 145L); (mk_real_int64 6430L); (mk_real_int64 3200L); (mk_real_int64 2375L); ]); +("y4_lo", [2; 3; 7; 8; 9; 10; 15; 17; 18; 19; 21; 23; 36; 38; 39; 41; 44; 45; 47; 49; 51; ], [(mk_real_int64 3750L); (mk_real_int64 1250L); (mk_real_int64 1950L); (mk_real_int64 5000L); (mk_real_int64 2800L); (mk_real_int64 7000L); (mk_real_int64 1250L); (mk_real_int64 2100L); (mk_real_int64 1250L); (mk_real_int64 5850L); (mk_real_int64 1250L); (mk_real_int64 750L); (mk_real_int64 2144L); (mk_real_int64 1250L); (mk_real_int64 2144L); (mk_real_int64 7550L); (mk_real_int64 3750L); (mk_real_int64 4500L); (mk_real_int64 5000L); (mk_real_int64 1250L); (mk_real_int64 10220000L); ]); +("y4_hi", [14; 16; 22; 26; 28; 32; 33; 35; 42; 43; 51; 52; ], [(mk_real_int64 2500L); (mk_real_int64 3750L); (mk_real_int64 2550L); (mk_real_int64 2500L); (mk_real_int64 2500L); (mk_real_int64 1250L); (mk_real_int64 1700L); (mk_real_int64 5000L); (mk_real_int64 3150L); (mk_real_int64 3250L); (mk_real_int64 6250L); (mk_real_int64 1840L); ]); +("y5_lo", [10; 11; 19; 20; 21; 29; 35; 45; 48; 50; 51; 56; 59; 62; 67; 68; ], [(mk_real_int64 3750L); (mk_real_int64 1250L); (mk_real_int64 1167L); (mk_real_int64 5000L); (mk_real_int64 1968L); (mk_real_int64 2026L); (mk_real_int64 2970L); (mk_real_int64 2798L); (mk_real_int64 2144L); (mk_real_int64 1250L); (mk_real_int64 2144L); (mk_real_int64 3750L); (mk_real_int64 5000L); (mk_real_int64 4175L); (mk_real_int64 3750L); (mk_real_int64 2160L); ]); +("y5_hi", [15; 22; 26; 28; 31; 34; 38; 40; 44; 47; 53; 54; 55; 57; ], [(mk_real_int64 4340L); (mk_real_int64 6330L); (mk_real_int64 3750L); (mk_real_int64 3750L); (mk_real_int64 4224L); (mk_real_int64 203L); (mk_real_int64 2500L); (mk_real_int64 2500L); (mk_real_int64 1250L); (mk_real_int64 5000L); (mk_real_int64 3697L); (mk_real_int64 439L); (mk_real_int64 145L); (mk_real_int64 6430L); ]); +("y6_lo", [10; 11; 12; 13; 19; 20; 21; 24; 27; 29; 30; 31; 33; 35; 38; 39; 40; 42; 44; 45; 46; 48; 49; 50; 51; 54; 55; 56; 59; 62; 67; 68; ], [(mk_real_int64 3750L); (mk_real_int64 18951250L); (mk_real_int64 11710000L); (mk_real_int64 10440000L); (mk_real_int64 1271167L); (mk_real_int64 5000L); (mk_real_int64 2050000L); (mk_real_int64 2160000L); (mk_real_int64 10690000L); (mk_real_int64 2026L); (mk_real_int64 15160000L); (mk_real_int64 8220000L); (mk_real_int64 35270000L); (mk_real_int64 2970L); (mk_real_int64 3870000L); (mk_real_int64 12350000L); (mk_real_int64 8480000L); (mk_real_int64 15090000L); (mk_real_int64 6610000L); (mk_real_int64 15940000L); (mk_real_int64 19900000L); (mk_real_int64 10472144L); (mk_real_int64 1140000L); (mk_real_int64 1250L); (mk_real_int64 1130000L); (mk_real_int64 7060000L); (mk_real_int64 37610000L); (mk_real_int64 3750L); (mk_real_int64 5000L); (mk_real_int64 4175L); (mk_real_int64 10473750L); (mk_real_int64 2160L); ]); +("y6_hi", [15; 21; 22; 26; 28; 31; 34; 38; 40; 44; 45; 47; 51; 53; 54; 55; 57; ], [(mk_real_int64 4340L); (mk_real_int64 8032L); (mk_real_int64 6330L); (mk_real_int64 3750L); (mk_real_int64 3750L); (mk_real_int64 4224L); (mk_real_int64 203L); (mk_real_int64 2500L); (mk_real_int64 2500L); (mk_real_int64 1250L); (mk_real_int64 7202L); (mk_real_int64 5000L); (mk_real_int64 7856L); (mk_real_int64 3697L); (mk_real_int64 439L); (mk_real_int64 145L); (mk_real_int64 6430L); ]); +("ye_hi", [20; 23; 33; 58; 67; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("ye_lo", [5; 21; 24; 26; 27; 45; 46; 56; ], [(mk_real_int64 7240000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 29470000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 6750000L); ]); +("yn_lo", [0; 2; 3; 5; 7; 8; 10; 11; 12; 14; ], [(mk_real_int64 1211L); (mk_real_int64 1211L); (mk_real_int64 1211L); (mk_real_int64 3293L); (mk_real_int64 12803L); (mk_real_int64 6663L); (mk_real_int64 14819L); (mk_real_int64 11211L); (mk_real_int64 4819L); (mk_real_int64 4819L); ]); +("yn_hi", [1; 4; 6; 9; 13; ], [(mk_real_int64 7182L); (mk_real_int64 8149L); (mk_real_int64 7497L); (mk_real_int64 33337L); (mk_real_int64 7182L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/91057093091_out.hl b/formal_lp/old/ineqs/tests2/91057093091_out.hl new file mode 100644 index 0000000..2ebb2f3 --- /dev/null +++ b/formal_lp/old/ineqs/tests2/91057093091_out.hl @@ -0,0 +1,87 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "91057093091 20 4 0 1 2 3 4 0 3 4 5 3 4 3 2 3 4 2 6 3 6 2 1 3 6 1 7 3 7 1 8 3 8 1 0 3 8 0 9 3 9 0 5 3 9 5 10 3 10 5 11 3 11 5 4 3 11 4 6 4 11 6 7 12 3 10 11 12 4 12 7 8 13 3 13 8 9 3 13 9 10 3 10 12 13 ";; +let precision = 3;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [2; 3; 5; 6; 7; 9; ], [(mk_real_int64 133L); (mk_real_int64 232L); (mk_real_int64 13L); (mk_real_int64 89L); (mk_real_int64 488L); (mk_real_int64 200L); ]); +("azim_sum_neg", [0; 10; 11; 13; ], [(mk_real_int64 116L); (mk_real_int64 70L); (mk_real_int64 89L); (mk_real_int64 206L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 919L); (mk_real_int64 803L); (mk_real_int64 1002L); (mk_real_int64 1144L); (mk_real_int64 1144L); (mk_real_int64 1144L); (mk_real_int64 1020L); (mk_real_int64 1109L); (mk_real_int64 981L); (mk_real_int64 1012L); (mk_real_int64 1082L); (mk_real_int64 1082L); (mk_real_int64 981L); (mk_real_int64 981L); ]); +("sol_sum3_neg", [5; 10; 11; ], [(mk_real_int64 200L); (mk_real_int64 34L); (mk_real_int64 89L); ]); +("sol_sum3", [8; 13; 14; 15; ], [(mk_real_int64 70L); (mk_real_int64 78L); (mk_real_int64 206L); (mk_real_int64 68L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; ], [(mk_real_int64 803L); (mk_real_int64 803L); (mk_real_int64 803L); (mk_real_int64 981L); (mk_real_int64 981L); (mk_real_int64 1002L); (mk_real_int64 1012L); (mk_real_int64 1082L); (mk_real_int64 1082L); (mk_real_int64 1082L); (mk_real_int64 1109L); (mk_real_int64 1020L); (mk_real_int64 981L); (mk_real_int64 981L); (mk_real_int64 981L); (mk_real_int64 981L); ]); +("tau_sum4_neg", [0; 1; 2; 3; ], [(mk_real_int64 803L); (mk_real_int64 1144L); (mk_real_int64 981L); (mk_real_int64 981L); ]); +("ln_def_neg", [0; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 14L); (mk_real_int64 104L); (mk_real_int64 261L); (mk_real_int64 261L); (mk_real_int64 261L); (mk_real_int64 125L); (mk_real_int64 223L); (mk_real_int64 82L); (mk_real_int64 116L); (mk_real_int64 193L); (mk_real_int64 193L); (mk_real_int64 82L); (mk_real_int64 82L); ]); +("ln_def", [1; ], [(mk_real_int64 114L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 5777L); (mk_real_int64 5048L); (mk_real_int64 6293L); (mk_real_int64 7185L); (mk_real_int64 7185L); (mk_real_int64 7185L); (mk_real_int64 6409L); (mk_real_int64 6970L); (mk_real_int64 6166L); (mk_real_int64 6357L); (mk_real_int64 6798L); (mk_real_int64 6798L); (mk_real_int64 6166L); (mk_real_int64 6166L); ]); +("edge_sym", [0; 1; 5; 6; 13; 16; 27; 36; 53; 54; 60; ], [(mk_real_int64 118L); (mk_real_int64 118L); (mk_real_int64 5L); (mk_real_int64 5L); (mk_real_int64 462L); (mk_real_int64 60L); (mk_real_int64 46L); (mk_real_int64 64L); (mk_real_int64 33L); (mk_real_int64 92L); (mk_real_int64 92L); ]); +("edge_sym_neg", [10; 12; 18; 19; 21; 25; 28; 31; 33; 34; 37; 40; 50; 57; ], [(mk_real_int64 5L); (mk_real_int64 60L); (mk_real_int64 103L); (mk_real_int64 60L); (mk_real_int64 43L); (mk_real_int64 46L); (mk_real_int64 335L); (mk_real_int64 130L); (mk_real_int64 68L); (mk_real_int64 206L); (mk_real_int64 84L); (mk_real_int64 50L); (mk_real_int64 35L); (mk_real_int64 34L); ]); +("y1_def_neg", [1; 6; 8; 10; 11; 12; 13; 14; 16; 17; 19; 22; 23; 25; 27; 30; 33; 34; 35; 36; 37; 39; 40; 41; 42; 48; 49; 56; 57; 60; 63; ], [(mk_real_int64 93L); (mk_real_int64 4L); (mk_real_int64 90L); (mk_real_int64 86L); (mk_real_int64 207L); (mk_real_int64 84L); (mk_real_int64 57L); (mk_real_int64 121L); (mk_real_int64 20L); (mk_real_int64 24L); (mk_real_int64 108L); (mk_real_int64 84L); (mk_real_int64 6L); (mk_real_int64 197L); (mk_real_int64 258L); (mk_real_int64 148L); (mk_real_int64 64L); (mk_real_int64 185L); (mk_real_int64 10L); (mk_real_int64 37L); (mk_real_int64 17L); (mk_real_int64 69L); (mk_real_int64 8L); (mk_real_int64 297L); (mk_real_int64 29L); (mk_real_int64 7L); (mk_real_int64 39L); (mk_real_int64 58L); (mk_real_int64 12L); (mk_real_int64 77L); (mk_real_int64 76L); ]); +("y1_def", [24; 29; 38; 55; ], [(mk_real_int64 34L); (mk_real_int64 35L); (mk_real_int64 13L); (mk_real_int64 64L); ]); +("y2_def", [1; 6; 8; 11; 13; 14; 17; 23; 27; 33; 36; 37; 38; 40; 41; 42; 48; 49; ], [(mk_real_int64 118L); (mk_real_int64 5L); (mk_real_int64 54L); (mk_real_int64 129L); (mk_real_int64 35L); (mk_real_int64 73L); (mk_real_int64 15L); (mk_real_int64 4L); (mk_real_int64 8L); (mk_real_int64 37L); (mk_real_int64 22L); (mk_real_int64 10L); (mk_real_int64 13L); (mk_real_int64 5L); (mk_real_int64 28L); (mk_real_int64 17L); (mk_real_int64 4L); (mk_real_int64 4L); ]); +("y2_def_neg", [10; 12; 16; 19; 22; 24; 25; 29; 30; 34; 35; 39; 55; 56; 57; 60; 63; ], [(mk_real_int64 86L); (mk_real_int64 84L); (mk_real_int64 20L); (mk_real_int64 108L); (mk_real_int64 65L); (mk_real_int64 10L); (mk_real_int64 41L); (mk_real_int64 11L); (mk_real_int64 88L); (mk_real_int64 198L); (mk_real_int64 68L); (mk_real_int64 69L); (mk_real_int64 19L); (mk_real_int64 57L); (mk_real_int64 12L); (mk_real_int64 77L); (mk_real_int64 166L); ]); +("y3_def", [1; 6; 8; 11; 13; 14; 17; 23; 27; 33; 36; 37; 38; 40; 41; 42; 48; 49; ], [(mk_real_int64 118L); (mk_real_int64 5L); (mk_real_int64 54L); (mk_real_int64 129L); (mk_real_int64 35L); (mk_real_int64 73L); (mk_real_int64 15L); (mk_real_int64 4L); (mk_real_int64 8L); (mk_real_int64 37L); (mk_real_int64 22L); (mk_real_int64 10L); (mk_real_int64 13L); (mk_real_int64 5L); (mk_real_int64 28L); (mk_real_int64 17L); (mk_real_int64 4L); (mk_real_int64 4L); ]); +("y3_def_neg", [10; 12; 16; 19; 22; 24; 25; 29; 30; 34; 35; 39; 55; 56; 57; 60; 63; ], [(mk_real_int64 86L); (mk_real_int64 84L); (mk_real_int64 20L); (mk_real_int64 108L); (mk_real_int64 65L); (mk_real_int64 10L); (mk_real_int64 41L); (mk_real_int64 11L); (mk_real_int64 88L); (mk_real_int64 198L); (mk_real_int64 68L); (mk_real_int64 69L); (mk_real_int64 19L); (mk_real_int64 57L); (mk_real_int64 12L); (mk_real_int64 77L); (mk_real_int64 166L); ]); +("y4_def_neg", [0; 2; 3; 4; 5; 6; 8; 9; 11; 14; 15; 17; 19; 22; 25; 26; 28; 29; 30; 31; 32; 33; 34; 36; 37; 40; ], [(mk_real_int64 103L); (mk_real_int64 60L); (mk_real_int64 242L); (mk_real_int64 58L); (mk_real_int64 65L); (mk_real_int64 138L); (mk_real_int64 14L); (mk_real_int64 28L); (mk_real_int64 75L); (mk_real_int64 63L); (mk_real_int64 7L); (mk_real_int64 283L); (mk_real_int64 335L); (mk_real_int64 119L); (mk_real_int64 68L); (mk_real_int64 120L); (mk_real_int64 42L); (mk_real_int64 19L); (mk_real_int64 7L); (mk_real_int64 48L); (mk_real_int64 9L); (mk_real_int64 479L); (mk_real_int64 33L); (mk_real_int64 8L); (mk_real_int64 39L); (mk_real_int64 40L); ]); +("y4_def", [16; 21; 27; 39; 41; 44; 47; ], [(mk_real_int64 52L); (mk_real_int64 54L); (mk_real_int64 31L); (mk_real_int64 99L); (mk_real_int64 25L); (mk_real_int64 34L); (mk_real_int64 35L); ]); +("y5_def", [1; 6; 8; 11; 13; 14; 17; 23; 27; 33; 36; 37; 40; 41; 42; 46; 48; 49; 51; 57; 60; ], [(mk_real_int64 118L); (mk_real_int64 5L); (mk_real_int64 54L); (mk_real_int64 129L); (mk_real_int64 35L); (mk_real_int64 73L); (mk_real_int64 15L); (mk_real_int64 4L); (mk_real_int64 46L); (mk_real_int64 71L); (mk_real_int64 22L); (mk_real_int64 10L); (mk_real_int64 5L); (mk_real_int64 33L); (mk_real_int64 17L); (mk_real_int64 60L); (mk_real_int64 4L); (mk_real_int64 8L); (mk_real_int64 92L); (mk_real_int64 25L); (mk_real_int64 34L); ]); +("y5_def_neg", [10; 12; 16; 19; 22; 24; 25; 29; 30; 34; 35; 38; 39; 55; 56; 63; ], [(mk_real_int64 60L); (mk_real_int64 58L); (mk_real_int64 14L); (mk_real_int64 75L); (mk_real_int64 43L); (mk_real_int64 10L); (mk_real_int64 101L); (mk_real_int64 11L); (mk_real_int64 54L); (mk_real_int64 138L); (mk_real_int64 52L); (mk_real_int64 7L); (mk_real_int64 48L); (mk_real_int64 19L); (mk_real_int64 39L); (mk_real_int64 92L); ]); +("y6_def", [1; 6; 8; 9; 11; 12; 13; 14; 15; 17; 20; 23; 27; 29; 32; 33; 35; 36; 37; 40; 41; 42; 48; 49; 53; 56; 57; 59; 60; ], [(mk_real_int64 118L); (mk_real_int64 5L); (mk_real_int64 54L); (mk_real_int64 162L); (mk_real_int64 129L); (mk_real_int64 148L); (mk_real_int64 392L); (mk_real_int64 73L); (mk_real_int64 34L); (mk_real_int64 15L); (mk_real_int64 167L); (mk_real_int64 337L); (mk_real_int64 46L); (mk_real_int64 9L); (mk_real_int64 180L); (mk_real_int64 71L); (mk_real_int64 64L); (mk_real_int64 22L); (mk_real_int64 10L); (mk_real_int64 5L); (mk_real_int64 33L); (mk_real_int64 17L); (mk_real_int64 76L); (mk_real_int64 8L); (mk_real_int64 33L); (mk_real_int64 212L); (mk_real_int64 25L); (mk_real_int64 171L); (mk_real_int64 92L); ]); +("y6_def_neg", [10; 16; 19; 24; 25; 30; 34; 38; 39; 55; 63; ], [(mk_real_int64 60L); (mk_real_int64 14L); (mk_real_int64 75L); (mk_real_int64 10L); (mk_real_int64 101L); (mk_real_int64 54L); (mk_real_int64 138L); (mk_real_int64 7L); (mk_real_int64 3L); (mk_real_int64 19L); (mk_real_int64 92L); ]); +("RHA", [0; 1; 3; 8; 9; 13; 14; 16; 18; 21; 22; 28; 31; 39; 40; 42; 44; 45; 48; 49; 53; 56; 57; 59; 60; 61; ], [(mk_real_int64 340L); (mk_real_int64 198L); (mk_real_int64 116L); (mk_real_int64 190L); (mk_real_int64 116L); (mk_real_int64 122L); (mk_real_int64 15L); (mk_real_int64 198L); (mk_real_int64 20L); (mk_real_int64 20L); (mk_real_int64 11L); (mk_real_int64 70L); (mk_real_int64 62L); (mk_real_int64 34L); (mk_real_int64 21L); (mk_real_int64 76L); (mk_real_int64 128L); (mk_real_int64 39L); (mk_real_int64 89L); (mk_real_int64 83L); (mk_real_int64 30L); (mk_real_int64 29L); (mk_real_int64 101L); (mk_real_int64 101L); (mk_real_int64 101L); (mk_real_int64 101L); ]); +("RHB", [5; ], [(mk_real_int64 224L); ]); +("tau4", [3; ], [(mk_real_int64 223L); ]); +("ineq105", [1; 6; ], [(mk_real_int64 294L); (mk_real_int64 13L); ]); +("ineq106", [0; 3; 5; 6; 9; 14; 15; 17; 19; 22; 25; 28; 29; 32; 33; 34; 36; 37; 40; ], [(mk_real_int64 150L); (mk_real_int64 340L); (mk_real_int64 95L); (mk_real_int64 202L); (mk_real_int64 39L); (mk_real_int64 19L); (mk_real_int64 10L); (mk_real_int64 142L); (mk_real_int64 132L); (mk_real_int64 62L); (mk_real_int64 62L); (mk_real_int64 62L); (mk_real_int64 27L); (mk_real_int64 13L); (mk_real_int64 89L); (mk_real_int64 48L); (mk_real_int64 11L); (mk_real_int64 45L); (mk_real_int64 1L); ]); +("ineq107", [16; 21; 26; 27; 39; 47; ], [(mk_real_int64 67L); (mk_real_int64 70L); (mk_real_int64 19L); (mk_real_int64 89L); (mk_real_int64 128L); (mk_real_int64 138L); ]); +("ineq108", [3; 9; 17; 19; 25; 29; 33; ], [(mk_real_int64 13L); (mk_real_int64 3L); (mk_real_int64 32L); (mk_real_int64 232L); (mk_real_int64 70L); (mk_real_int64 1L); (mk_real_int64 399L); ]); +("ineq109", [25; 41; 44; 47; ], [(mk_real_int64 70L); (mk_real_int64 78L); (mk_real_int64 206L); (mk_real_int64 68L); ]); +("ineq110", [17; 30; 33; ], [(mk_real_int64 200L); (mk_real_int64 34L); (mk_real_int64 89L); ]); +("ineq111", [2; 4; 8; 11; 14; 17; 19; 22; 26; 27; 31; 33; 37; 40; 44; 47; ], [(mk_real_int64 478L); (mk_real_int64 467L); (mk_real_int64 109L); (mk_real_int64 600L); (mk_real_int64 400L); (mk_real_int64 1002L); (mk_real_int64 693L); (mk_real_int64 614L); (mk_real_int64 1082L); (mk_real_int64 304L); (mk_real_int64 385L); (mk_real_int64 1020L); (mk_real_int64 69L); (mk_real_int64 317L); (mk_real_int64 258L); (mk_real_int64 747L); ]); +("ineq114", [0; 5; 6; 8; 9; 10; 13; 14; 18; 22; 23; 29; 30; 37; 40; 41; 43; 44; 45; 46; ], [(mk_real_int64 325L); (mk_real_int64 337L); (mk_real_int64 166L); (mk_real_int64 529L); (mk_real_int64 137L); (mk_real_int64 244L); (mk_real_int64 244L); (mk_real_int64 337L); (mk_real_int64 319L); (mk_real_int64 369L); (mk_real_int64 98L); (mk_real_int64 778L); (mk_real_int64 724L); (mk_real_int64 912L); (mk_real_int64 491L); (mk_real_int64 174L); (mk_real_int64 377L); (mk_real_int64 346L); (mk_real_int64 126L); (mk_real_int64 108L); ]); +("ineq119", [5; 15; ], [(mk_real_int64 838L); (mk_real_int64 454L); ]); +("ineq120", [0; 1; 4; 8; 9; 14; ], [(mk_real_int64 755L); (mk_real_int64 48L); (mk_real_int64 306L); (mk_real_int64 813L); (mk_real_int64 168L); (mk_real_int64 304L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 3025L); (mk_real_int64 2600L); (mk_real_int64 2725L); (mk_real_int64 3625L); (mk_real_int64 3625L); (mk_real_int64 3625L); (mk_real_int64 3425L); (mk_real_int64 3250L); (mk_real_int64 2950L); (mk_real_int64 3525L); (mk_real_int64 3350L); (mk_real_int64 3350L); (mk_real_int64 2950L); (mk_real_int64 2950L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [0; 8; 16; 37; 44; 53; 54; 56; ], [(mk_real_int64 290L); (mk_real_int64 450L); (mk_real_int64 154L); (mk_real_int64 28L); (mk_real_int64 254L); (mk_real_int64 432L); (mk_real_int64 338L); (mk_real_int64 366L); ]); +("azim_lo", [1; 4; 5; 13; 14; 17; 18; 21; 22; 26; 30; 31; 38; 45; 49; 57; 59; 60; 61; 62; ], [(mk_real_int64 616L); (mk_real_int64 52L); (mk_real_int64 190L); (mk_real_int64 38L); (mk_real_int64 84L); (mk_real_int64 238L); (mk_real_int64 256L); (mk_real_int64 256L); (mk_real_int64 38L); (mk_real_int64 306L); (mk_real_int64 1006L); (mk_real_int64 652L); (mk_real_int64 776L); (mk_real_int64 656L); (mk_real_int64 88L); (mk_real_int64 76L); (mk_real_int64 998L); (mk_real_int64 1404L); (mk_real_int64 1124L); (mk_real_int64 392L); ]); +("rhazim_lo", [0; 1; 8; 11; 16; 18; 21; 22; 39; 40; 48; 53; 56; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("rhazim_hi", [5; ], [(mk_real_int64 1000L); ]); +("rho_hi", [2; 3; 4; 5; 6; 9; 10; 11; ], [(mk_real_int64 3568L); (mk_real_int64 3896L); (mk_real_int64 3896L); (mk_real_int64 3896L); (mk_real_int64 680L); (mk_real_int64 2408L); (mk_real_int64 1288L); (mk_real_int64 1288L); ]); +("rho_lo", [0; 1; 7; 8; 12; 13; ], [(mk_real_int64 2004L); (mk_real_int64 1948L); (mk_real_int64 1044L); (mk_real_int64 1396L); (mk_real_int64 1396L); (mk_real_int64 1396L); ]); +("tau_hi", [3; 4; 17; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("tau_lo", [9; ], [(mk_real_int64 1000L); ]); +("y1_lo", [6; 10; 11; 12; 14; 17; 24; 25; 27; 33; 34; 35; 36; 38; 39; 49; 60; ], [(mk_real_int64 95L); (mk_real_int64 40L); (mk_real_int64 55L); (mk_real_int64 60L); (mk_real_int64 200L); (mk_real_int64 105L); (mk_real_int64 500L); (mk_real_int64 80L); (mk_real_int64 460L); (mk_real_int64 220L); (mk_real_int64 260L); (mk_real_int64 220L); (mk_real_int64 200L); (mk_real_int64 80L); (mk_real_int64 300L); (mk_real_int64 420L); (mk_real_int64 546L); ]); +("y1_hi", [1; 16; 22; 30; 37; 40; 41; 42; 48; 56; 57; 63; ], [(mk_real_int64 390L); (mk_real_int64 380L); (mk_real_int64 600L); (mk_real_int64 280L); (mk_real_int64 565L); (mk_real_int64 200L); (mk_real_int64 55L); (mk_real_int64 200L); (mk_real_int64 400L); (mk_real_int64 340L); (mk_real_int64 222L); (mk_real_int64 272L); ]); +("y2_lo", [10; 11; 12; 13; 22; 23; 24; 25; 27; 35; 38; 39; 40; 41; 49; 55; 60; ], [(mk_real_int64 40L); (mk_real_int64 508L); (mk_real_int64 60L); (mk_real_int64 420L); (mk_real_int64 84L); (mk_real_int64 360L); (mk_real_int64 184L); (mk_real_int64 24L); (mk_real_int64 244L); (mk_real_int64 248L); (mk_real_int64 80L); (mk_real_int64 300L); (mk_real_int64 268L); (mk_real_int64 148L); (mk_real_int64 40L); (mk_real_int64 456L); (mk_real_int64 546L); ]); +("y2_hi", [1; 6; 8; 14; 16; 17; 29; 30; 33; 34; 36; 37; 42; 48; 56; 57; 63; ], [(mk_real_int64 188L); (mk_real_int64 226L); (mk_real_int64 600L); (mk_real_int64 528L); (mk_real_int64 380L); (mk_real_int64 288L); (mk_real_int64 360L); (mk_real_int64 48L); (mk_real_int64 478L); (mk_real_int64 352L); (mk_real_int64 568L); (mk_real_int64 192L); (mk_real_int64 472L); (mk_real_int64 4L); (mk_real_int64 304L); (mk_real_int64 222L); (mk_real_int64 296L); ]); +("y3_lo", [10; 11; 12; 13; 22; 23; 24; 25; 27; 35; 38; 39; 40; 41; 49; 55; 60; ], [(mk_real_int64 40L); (mk_real_int64 508L); (mk_real_int64 60L); (mk_real_int64 420L); (mk_real_int64 84L); (mk_real_int64 360L); (mk_real_int64 184L); (mk_real_int64 24L); (mk_real_int64 244L); (mk_real_int64 248L); (mk_real_int64 80L); (mk_real_int64 300L); (mk_real_int64 268L); (mk_real_int64 148L); (mk_real_int64 40L); (mk_real_int64 456L); (mk_real_int64 546L); ]); +("y3_hi", [1; 6; 8; 14; 16; 17; 29; 30; 33; 34; 36; 37; 42; 48; 56; 57; 63; ], [(mk_real_int64 188L); (mk_real_int64 226L); (mk_real_int64 600L); (mk_real_int64 528L); (mk_real_int64 380L); (mk_real_int64 288L); (mk_real_int64 360L); (mk_real_int64 48L); (mk_real_int64 478L); (mk_real_int64 352L); (mk_real_int64 568L); (mk_real_int64 192L); (mk_real_int64 472L); (mk_real_int64 4L); (mk_real_int64 304L); (mk_real_int64 222L); (mk_real_int64 296L); ]); +("y4_lo", [4; 5; 6; 9; 14; 16; 17; 19; 22; 26; 27; 28; 29; 31; 33; 37; 39; 40; ], [(mk_real_int64 375L); (mk_real_int64 75L); (mk_real_int64 370L); (mk_real_int64 770L); (mk_real_int64 15L); (mk_real_int64 209L); (mk_real_int64 640L); (mk_real_int64 965L); (mk_real_int64 220L); (mk_real_int64 563L); (mk_real_int64 203L); (mk_real_int64 470L); (mk_real_int64 180L); (mk_real_int64 125L); (mk_real_int64 224L); (mk_real_int64 450L); (mk_real_int64 56L); (mk_real_int64 310L); ]); +("y4_hi", [0; 2; 3; 8; 15; 21; 25; 30; 32; 34; 36; 41; 44; 47; ], [(mk_real_int64 250L); (mk_real_int64 250L); (mk_real_int64 195L); (mk_real_int64 375L); (mk_real_int64 150L); (mk_real_int64 110L); (mk_real_int64 260L); (mk_real_int64 336L); (mk_real_int64 95L); (mk_real_int64 120L); (mk_real_int64 465L); (mk_real_int64 272L); (mk_real_int64 494L); (mk_real_int64 331L); ]); +("y5_lo", [11; 12; 13; 22; 23; 24; 25; 27; 30; 33; 34; 39; 40; 41; 46; 49; 51; 55; 56; 63; ], [(mk_real_int64 508L); (mk_real_int64 375L); (mk_real_int64 420L); (mk_real_int64 84L); (mk_real_int64 360L); (mk_real_int64 184L); (mk_real_int64 114L); (mk_real_int64 129L); (mk_real_int64 182L); (mk_real_int64 272L); (mk_real_int64 138L); (mk_real_int64 125L); (mk_real_int64 268L); (mk_real_int64 312L); (mk_real_int64 60000L); (mk_real_int64 245L); (mk_real_int64 92000L); (mk_real_int64 456L); (mk_real_int64 261L); (mk_real_int64 319L); ]); +("y5_hi", [1; 6; 8; 10; 14; 16; 17; 29; 35; 36; 37; 38; 42; 48; 57; 60; ], [(mk_real_int64 188L); (mk_real_int64 226L); (mk_real_int64 600L); (mk_real_int64 250L); (mk_real_int64 528L); (mk_real_int64 375L); (mk_real_int64 288L); (mk_real_int64 360L); (mk_real_int64 472L); (mk_real_int64 568L); (mk_real_int64 192L); (mk_real_int64 336L); (mk_real_int64 472L); (mk_real_int64 4L); (mk_real_int64 272L); (mk_real_int64 494L); ]); +("y6_lo", [9; 11; 12; 13; 15; 20; 22; 23; 24; 25; 27; 29; 30; 32; 33; 34; 35; 39; 40; 41; 48; 49; 53; 55; 56; 59; 60; 63; ], [(mk_real_int64 162000L); (mk_real_int64 508L); (mk_real_int64 206375L); (mk_real_int64 357420L); (mk_real_int64 34000L); (mk_real_int64 167000L); (mk_real_int64 43084L); (mk_real_int64 333360L); (mk_real_int64 184L); (mk_real_int64 114L); (mk_real_int64 129L); (mk_real_int64 19640L); (mk_real_int64 182L); (mk_real_int64 180000L); (mk_real_int64 272L); (mk_real_int64 138L); (mk_real_int64 116000L); (mk_real_int64 45125L); (mk_real_int64 268L); (mk_real_int64 312L); (mk_real_int64 72000L); (mk_real_int64 245L); (mk_real_int64 33000L); (mk_real_int64 456L); (mk_real_int64 251261L); (mk_real_int64 171000L); (mk_real_int64 58000L); (mk_real_int64 319L); ]); +("y6_hi", [1; 6; 8; 10; 14; 16; 17; 35; 36; 37; 38; 42; 48; 57; 60; ], [(mk_real_int64 188L); (mk_real_int64 226L); (mk_real_int64 600L); (mk_real_int64 250L); (mk_real_int64 528L); (mk_real_int64 375L); (mk_real_int64 288L); (mk_real_int64 472L); (mk_real_int64 568L); (mk_real_int64 192L); (mk_real_int64 336L); (mk_real_int64 472L); (mk_real_int64 4L); (mk_real_int64 272L); (mk_real_int64 494L); ]); +("ye_hi", [11; 12; 13; 20; 23; 25; 29; 32; 33; 56; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("ye_lo", [8; 9; 10; 14; 16; 35; 36; 59; ], [(mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); (mk_real_int64 1000L); ]); +("yn_hi", [3; 4; 5; 6; 7; 9; 10; ], [(mk_real_int64 164L); (mk_real_int64 164L); (mk_real_int64 1164L); (mk_real_int64 500L); (mk_real_int64 52L); (mk_real_int64 1184L); (mk_real_int64 332L); ]); +("yn_lo", [0; 1; 2; 8; 11; 12; 13; ], [(mk_real_int64 64L); (mk_real_int64 222L); (mk_real_int64 904L); (mk_real_int64 232L); (mk_real_int64 668L); (mk_real_int64 232L); (mk_real_int64 232L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/945145744_out.hl b/formal_lp/old/ineqs/tests2/945145744_out.hl new file mode 100644 index 0000000..bf7591a --- /dev/null +++ b/formal_lp/old/ineqs/tests2/945145744_out.hl @@ -0,0 +1,87 @@ +needs "nobranching_lp.hl";; + +module Test_case = struct +let hypermap_string = "945145744 18 4 0 1 2 3 3 0 3 4 3 4 3 5 4 5 3 2 6 3 6 2 1 3 6 1 7 3 7 1 8 3 8 1 0 3 8 0 9 4 9 0 4 10 4 10 4 5 11 3 11 5 6 3 11 6 7 3 11 7 12 3 12 7 8 3 10 11 12 3 12 8 9 3 9 10 12 ";; +let precision = 4;; +(***************) +(* Constraints *) +(***************) +let constraints = [ +("azim_sum", [2; 3; 6; 7; 8; 12; ], [(mk_real_int64 78L); (mk_real_int64 2445L); (mk_real_int64 696L); (mk_real_int64 251L); (mk_real_int64 5955L); (mk_real_int64 277L); ]); +("azim_sum_neg", [0; 1; 4; 9; 10; 11; ], [(mk_real_int64 197L); (mk_real_int64 3515L); (mk_real_int64 494L); (mk_real_int64 394L); (mk_real_int64 2847L); (mk_real_int64 110L); ]); +("rhazim_sum", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 9125L); (mk_real_int64 8928L); (mk_real_int64 8928L); (mk_real_int64 8928L); (mk_real_int64 9422L); (mk_real_int64 8928L); (mk_real_int64 9116L); (mk_real_int64 9607L); (mk_real_int64 8928L); (mk_real_int64 8928L); (mk_real_int64 8928L); (mk_real_int64 9038L); (mk_real_int64 8928L); ]); +("sol_sum3", [2; 10; 12; 13; ], [(mk_real_int64 1667L); (mk_real_int64 121L); (mk_real_int64 1798L); (mk_real_int64 1708L); ]); +("sol_sum3_neg", [5; 7; 8; 9; 11; ], [(mk_real_int64 5225L); (mk_real_int64 626L); (mk_real_int64 1629L); (mk_real_int64 2037L); (mk_real_int64 1321L); ]); +("tau_sum3_neg", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; ], [(mk_real_int64 8928L); (mk_real_int64 8706L); (mk_real_int64 8928L); (mk_real_int64 8004L); (mk_real_int64 8534L); (mk_real_int64 3781L); (mk_real_int64 8534L); (mk_real_int64 8928L); (mk_real_int64 8184L); (mk_real_int64 7821L); (mk_real_int64 8654L); (mk_real_int64 7606L); (mk_real_int64 8928L); (mk_real_int64 8928L); ]); +("tau_sum4_neg", [0; 1; 2; 3; ], [(mk_real_int64 8928L); (mk_real_int64 8928L); (mk_real_int64 8928L); (mk_real_int64 8928L); ]); +("ln_def", [1; 2; 3; 5; 8; 9; 10; 11; 12; ], [(mk_real_int64 156L); (mk_real_int64 156L); (mk_real_int64 156L); (mk_real_int64 156L); (mk_real_int64 156L); (mk_real_int64 156L); (mk_real_int64 156L); (mk_real_int64 35L); (mk_real_int64 156L); ]); +("ln_def_neg", [0; 4; 6; 7; ], [(mk_real_int64 61L); (mk_real_int64 388L); (mk_real_int64 51L); (mk_real_int64 592L); ]); +("rho_def", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 57336L); (mk_real_int64 56095L); (mk_real_int64 56095L); (mk_real_int64 56095L); (mk_real_int64 59198L); (mk_real_int64 56095L); (mk_real_int64 57278L); (mk_real_int64 60362L); (mk_real_int64 56095L); (mk_real_int64 56095L); (mk_real_int64 56095L); (mk_real_int64 56785L); (mk_real_int64 56095L); ]); +("edge_sym", [0; 3; 16; 18; 19; 35; 39; ], [(mk_real_int64 659L); (mk_real_int64 659L); (mk_real_int64 1709L); (mk_real_int64 630L); (mk_real_int64 236L); (mk_real_int64 218L); (mk_real_int64 361L); ]); +("edge_sym_neg", [5; 6; 21; 22; 25; 27; 42; 44; 45; 48; 51; ], [(mk_real_int64 498L); (mk_real_int64 179L); (mk_real_int64 630L); (mk_real_int64 1126L); (mk_real_int64 1096L); (mk_real_int64 179L); (mk_real_int64 313L); (mk_real_int64 1452L); (mk_real_int64 291L); (mk_real_int64 971L); (mk_real_int64 1054L); ]); +("y1_def_neg", [0; 6; 9; 16; 19; 21; 22; 30; 42; 43; 46; 47; 48; 50; 54; 56; 57; ], [(mk_real_int64 516L); (mk_real_int64 889L); (mk_real_int64 250L); (mk_real_int64 252L); (mk_real_int64 1068L); (mk_real_int64 255L); (mk_real_int64 1155L); (mk_real_int64 140L); (mk_real_int64 11L); (mk_real_int64 664L); (mk_real_int64 148L); (mk_real_int64 311L); (mk_real_int64 18L); (mk_real_int64 795L); (mk_real_int64 353L); (mk_real_int64 545L); (mk_real_int64 258L); ]); +("y1_def", [15; 23; 25; 28; 38; 40; 44; 45; 51; 55; ], [(mk_real_int64 553L); (mk_real_int64 236L); (mk_real_int64 1985L); (mk_real_int64 709L); (mk_real_int64 550L); (mk_real_int64 604L); (mk_real_int64 493L); (mk_real_int64 326L); (mk_real_int64 336L); (mk_real_int64 570L); ]); +("y2_def", [0; 19; 21; 25; 30; 38; 40; 42; 43; 44; 47; 50; 51; ], [(mk_real_int64 659L); (mk_real_int64 43L); (mk_real_int64 172L); (mk_real_int64 1985L); (mk_real_int64 179L); (mk_real_int64 143L); (mk_real_int64 604L); (mk_real_int64 17L); (mk_real_int64 403L); (mk_real_int64 493L); (mk_real_int64 482L); (mk_real_int64 441L); (mk_real_int64 603L); ]); +("y2_def_neg", [6; 9; 15; 16; 22; 23; 28; 45; 46; 48; 54; 55; 56; 57; ], [(mk_real_int64 741L); (mk_real_int64 36L); (mk_real_int64 652L); (mk_real_int64 252L); (mk_real_int64 1155L); (mk_real_int64 72L); (mk_real_int64 215L); (mk_real_int64 99L); (mk_real_int64 148L); (mk_real_int64 18L); (mk_real_int64 1038L); (mk_real_int64 173L); (mk_real_int64 545L); (mk_real_int64 258L); ]); +("y3_def", [0; 19; 21; 25; 30; 38; 40; 42; 43; 44; 47; 50; 51; ], [(mk_real_int64 659L); (mk_real_int64 43L); (mk_real_int64 172L); (mk_real_int64 1985L); (mk_real_int64 179L); (mk_real_int64 143L); (mk_real_int64 604L); (mk_real_int64 17L); (mk_real_int64 403L); (mk_real_int64 493L); (mk_real_int64 482L); (mk_real_int64 441L); (mk_real_int64 603L); ]); +("y3_def_neg", [6; 9; 15; 16; 22; 23; 28; 45; 46; 48; 54; 55; 56; 57; ], [(mk_real_int64 741L); (mk_real_int64 36L); (mk_real_int64 652L); (mk_real_int64 252L); (mk_real_int64 1155L); (mk_real_int64 72L); (mk_real_int64 215L); (mk_real_int64 99L); (mk_real_int64 148L); (mk_real_int64 18L); (mk_real_int64 1038L); (mk_real_int64 173L); (mk_real_int64 545L); (mk_real_int64 258L); ]); +("y4_def_neg", [2; 5; 11; 13; 14; 17; 24; 26; 27; 28; 30; 31; 34; 35; 40; ], [(mk_real_int64 659L); (mk_real_int64 233L); (mk_real_int64 1709L); (mk_real_int64 324L); (mk_real_int64 802L); (mk_real_int64 1024L); (mk_real_int64 330L); (mk_real_int64 31L); (mk_real_int64 758L); (mk_real_int64 595L); (mk_real_int64 103L); (mk_real_int64 907L); (mk_real_int64 896L); (mk_real_int64 449L); (mk_real_int64 379L); ]); +("y4_def", [7; 8; 15; 20; 22; 29; 32; 38; 39; 41; ], [(mk_real_int64 1171L); (mk_real_int64 539L); (mk_real_int64 365L); (mk_real_int64 1096L); (mk_real_int64 361L); (mk_real_int64 505L); (mk_real_int64 39L); (mk_real_int64 971L); (mk_real_int64 881L); (mk_real_int64 552L); ]); +("y5_def", [0; 16; 19; 21; 30; 42; 43; 47; 48; 50; 57; ], [(mk_real_int64 659L); (mk_real_int64 539L); (mk_real_int64 236L); (mk_real_int64 172L); (mk_real_int64 179L); (mk_real_int64 17L); (mk_real_int64 403L); (mk_real_int64 482L); (mk_real_int64 39L); (mk_real_int64 449L); (mk_real_int64 552L); ]); +("y5_def_neg", [6; 15; 22; 23; 25; 28; 38; 40; 44; 45; 46; 51; 55; 56; ], [(mk_real_int64 498L); (mk_real_int64 539L); (mk_real_int64 802L); (mk_real_int64 72L); (mk_real_int64 1024L); (mk_real_int64 215L); (mk_real_int64 218L); (mk_real_int64 330L); (mk_real_int64 595L); (mk_real_int64 99L); (mk_real_int64 103L); (mk_real_int64 158L); (mk_real_int64 173L); (mk_real_int64 379L); ]); +("y6_def", [0; 7; 16; 19; 21; 27; 30; 41; 42; 43; 46; 47; 48; 50; 57; ], [(mk_real_int64 659L); (mk_real_int64 731L); (mk_real_int64 539L); (mk_real_int64 236L); (mk_real_int64 172L); (mk_real_int64 37L); (mk_real_int64 179L); (mk_real_int64 77L); (mk_real_int64 17L); (mk_real_int64 403L); (mk_real_int64 931L); (mk_real_int64 1190L); (mk_real_int64 39L); (mk_real_int64 449L); (mk_real_int64 552L); ]); +("y6_def_neg", [6; 15; 22; 23; 25; 28; 40; 44; 45; 51; 55; 56; ], [(mk_real_int64 498L); (mk_real_int64 539L); (mk_real_int64 802L); (mk_real_int64 72L); (mk_real_int64 1024L); (mk_real_int64 215L); (mk_real_int64 330L); (mk_real_int64 595L); (mk_real_int64 99L); (mk_real_int64 158L); (mk_real_int64 173L); (mk_real_int64 379L); ]); +("RHA", [3; 5; 6; 7; 8; 11; 13; 14; 17; 18; 19; 20; 22; 23; 24; 25; 26; 27; 28; 31; 32; 33; 34; 39; 40; 41; 42; 44; 45; 46; 47; 48; 49; 50; 51; 56; ], [(mk_real_int64 197L); (mk_real_int64 197L); (mk_real_int64 340L); (mk_real_int64 716L); (mk_real_int64 420L); (mk_real_int64 197L); (mk_real_int64 188L); (mk_real_int64 188L); (mk_real_int64 1113L); (mk_real_int64 924L); (mk_real_int64 1603L); (mk_real_int64 1073L); (mk_real_int64 394L); (mk_real_int64 5147L); (mk_real_int64 5147L); (mk_real_int64 5147L); (mk_real_int64 394L); (mk_real_int64 394L); (mk_real_int64 394L); (mk_real_int64 494L); (mk_real_int64 110L); (mk_real_int64 110L); (mk_real_int64 494L); (mk_real_int64 188L); (mk_real_int64 744L); (mk_real_int64 932L); (mk_real_int64 1423L); (mk_real_int64 1786L); (mk_real_int64 1107L); (mk_real_int64 273L); (mk_real_int64 952L); (mk_real_int64 273L); (mk_real_int64 1431L); (mk_real_int64 39L); (mk_real_int64 1044L); (mk_real_int64 110L); ]); +("tau4", [3; ], [(mk_real_int64 1064L); ]); +("ineq105", [0; 9; ], [(mk_real_int64 1639L); (mk_real_int64 444L); ]); +("ineq106", [2; 5; 13; 27; 34; 35; ], [(mk_real_int64 154L); (mk_real_int64 222L); (mk_real_int64 394L); (mk_real_int64 1107L); (mk_real_int64 1283L); (mk_real_int64 277L); ]); +("ineq107", [7; 15; 20; 22; 29; 38; 39; ], [(mk_real_int64 1848L); (mk_real_int64 473L); (mk_real_int64 1418L); (mk_real_int64 626L); (mk_real_int64 653L); (mk_real_int64 1050L); (mk_real_int64 1140L); ]); +("ineq108", [11; 13; 26; 31; ], [(mk_real_int64 1855L); (mk_real_int64 78L); (mk_real_int64 46L); (mk_real_int64 1325L); ]); +("ineq109", [8; 32; 38; 41; ], [(mk_real_int64 1667L); (mk_real_int64 121L); (mk_real_int64 1798L); (mk_real_int64 1708L); ]); +("ineq110", [17; 22; 24; 28; 35; ], [(mk_real_int64 5225L); (mk_real_int64 626L); (mk_real_int64 1629L); (mk_real_int64 2037L); (mk_real_int64 1321L); ]); +("ineq111", [2; 5; 7; 11; 14; 24; 28; 30; 34; 38; 40; ], [(mk_real_int64 4428L); (mk_real_int64 647L); (mk_real_int64 2063L); (mk_real_int64 3513L); (mk_real_int64 6418L); (mk_real_int64 83L); (mk_real_int64 1562L); (mk_real_int64 822L); (mk_real_int64 142L); (mk_real_int64 3371L); (mk_real_int64 3029L); ]); +("ineq113", [2; 20; ], [(mk_real_int64 594L); (mk_real_int64 3998L); ]); +("ineq114", [0; 3; 4; 6; 8; 9; 10; 12; 17; 19; 21; 23; 24; 27; 30; 34; 36; 37; 40; 41; ], [(mk_real_int64 3906L); (mk_real_int64 355L); (mk_real_int64 355L); (mk_real_int64 4076L); (mk_real_int64 2788L); (mk_real_int64 2889L); (mk_real_int64 1601L); (mk_real_int64 2116L); (mk_real_int64 3781L); (mk_real_int64 4536L); (mk_real_int64 8514L); (mk_real_int64 414L); (mk_real_int64 8100L); (mk_real_int64 6259L); (mk_real_int64 1073L); (mk_real_int64 7465L); (mk_real_int64 3315L); (mk_real_int64 2242L); (mk_real_int64 2728L); (mk_real_int64 3171L); ]); +("ineq119", [2; 6; 8; ], [(mk_real_int64 7760L); (mk_real_int64 7760L); (mk_real_int64 6286L); ]); +("ineq120", [0; 1; 7; 9; 15; ], [(mk_real_int64 1065L); (mk_real_int64 103L); (mk_real_int64 1168L); (mk_real_int64 2642L); (mk_real_int64 7864L); ]); +];; + +(***************) +(* Variables *) +(***************) +let target_variables = [ +("ln_hi", [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 42656L); (mk_real_int64 49370L); (mk_real_int64 49370L); (mk_real_int64 49370L); (mk_real_int64 46708L); (mk_real_int64 49370L); (mk_real_int64 44388L); (mk_real_int64 45052L); (mk_real_int64 49370L); (mk_real_int64 49370L); (mk_real_int64 49370L); (mk_real_int64 49110L); (mk_real_int64 49370L); ]); +];; + +(*************************) + +let variable_bounds = [ +("azim_hi", [0; 1; 4; 6; 7; 13; 14; 16; 18; 19; 20; 27; 36; 37; 39; 40; 41; 42; 43; 46; 47; 50; 52; 57; ], [(mk_real_int64 5245L); (mk_real_int64 19L); (mk_real_int64 1560L); (mk_real_int64 1540L); (mk_real_int64 2300L); (mk_real_int64 5264L); (mk_real_int64 5760L); (mk_real_int64 2880L); (mk_real_int64 2260L); (mk_real_int64 10000L); (mk_real_int64 6160L); (mk_real_int64 5360L); (mk_real_int64 4072L); (mk_real_int64 7640L); (mk_real_int64 11640L); (mk_real_int64 6000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 1340L); (mk_real_int64 6980L); (mk_real_int64 10000L); (mk_real_int64 900L); (mk_real_int64 1900L); (mk_real_int64 460L); ]); +("azim_lo", [2; 8; 12; 17; 23; 25; 28; 29; 30; 53; 54; 55; 56; ], [(mk_real_int64 2800L); (mk_real_int64 7700L); (mk_real_int64 2800L); (mk_real_int64 4860L); (mk_real_int64 10000L); (mk_real_int64 940L); (mk_real_int64 4820L); (mk_real_int64 5580L); (mk_real_int64 2134L); (mk_real_int64 5080L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 2720L); ]); +("rhazim_lo", [46; 47; 48; 49; 51; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("rhazim_hi", [8; 17; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("rho_hi", [1; 2; 3; 4; 5; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 14096L); (mk_real_int64 14096L); (mk_real_int64 14096L); (mk_real_int64 23104L); (mk_real_int64 14096L); (mk_real_int64 7024L); (mk_real_int64 14096L); (mk_real_int64 14096L); (mk_real_int64 14096L); (mk_real_int64 25616L); (mk_real_int64 14096L); ]); +("rho_lo", [0; 6; ], [(mk_real_int64 18000L); (mk_real_int64 3488L); ]); +("tau_lo", [2; 4; 5; 12; 14; ], [(mk_real_int64 73500000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 10000L); (mk_real_int64 67590000L); ]); +("tau_hi", [2; 15; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("y1_lo", [0; 6; 15; 19; 22; 43; 44; 47; 48; 50; 51; 54; 56; ], [(mk_real_int64 2850L); (mk_real_int64 4400L); (mk_real_int64 3400L); (mk_real_int64 2650L); (mk_real_int64 2400L); (mk_real_int64 2000L); (mk_real_int64 1000L); (mk_real_int64 3750L); (mk_real_int64 2710L); (mk_real_int64 3600L); (mk_real_int64 2200L); (mk_real_int64 2780L); (mk_real_int64 2200L); ]); +("y1_hi", [9; 16; 21; 23; 25; 30; 38; 40; 42; 45; 46; 57; ], [(mk_real_int64 3400L); (mk_real_int64 2830L); (mk_real_int64 2700L); (mk_real_int64 5000L); (mk_real_int64 5000L); (mk_real_int64 1400L); (mk_real_int64 8800L); (mk_real_int64 800L); (mk_real_int64 1900L); (mk_real_int64 5000L); (mk_real_int64 400L); (mk_real_int64 920L); ]); +("y2_lo", [0; 15; 19; 21; 22; 28; 30; 38; 42; 43; 44; 45; 48; 51; 55; 56; ], [(mk_real_int64 1220L); (mk_real_int64 2360L); (mk_real_int64 3055L); (mk_real_int64 2392L); (mk_real_int64 2400L); (mk_real_int64 5360L); (mk_real_int64 5120L); (mk_real_int64 2720L); (mk_real_int64 2606L); (mk_real_int64 1627L); (mk_real_int64 1000L); (mk_real_int64 2560L); (mk_real_int64 2710L); (mk_real_int64 2197L); (mk_real_int64 2800L); (mk_real_int64 2200L); ]); +("y2_hi", [6; 9; 16; 23; 25; 40; 46; 47; 50; 54; 57; ], [(mk_real_int64 6L); (mk_real_int64 3258L); (mk_real_int64 2830L); (mk_real_int64 1040L); (mk_real_int64 5000L); (mk_real_int64 800L); (mk_real_int64 400L); (mk_real_int64 1675L); (mk_real_int64 3237L); (mk_real_int64 1220L); (mk_real_int64 920L); ]); +("y3_lo", [0; 15; 19; 21; 22; 28; 30; 38; 42; 43; 44; 45; 48; 51; 55; 56; ], [(mk_real_int64 1220L); (mk_real_int64 2360L); (mk_real_int64 3055L); (mk_real_int64 2392L); (mk_real_int64 2400L); (mk_real_int64 5360L); (mk_real_int64 5120L); (mk_real_int64 2720L); (mk_real_int64 2606L); (mk_real_int64 1627L); (mk_real_int64 1000L); (mk_real_int64 2560L); (mk_real_int64 2710L); (mk_real_int64 2197L); (mk_real_int64 2800L); (mk_real_int64 2200L); ]); +("y3_hi", [6; 9; 16; 23; 25; 40; 46; 47; 50; 54; 57; ], [(mk_real_int64 6L); (mk_real_int64 3258L); (mk_real_int64 2830L); (mk_real_int64 1040L); (mk_real_int64 5000L); (mk_real_int64 800L); (mk_real_int64 400L); (mk_real_int64 1675L); (mk_real_int64 3237L); (mk_real_int64 1220L); (mk_real_int64 920L); ]); +("y4_lo", [7; 8; 11; 14; 17; 26; 27; 29; 31; 34; ], [(mk_real_int64 3710L); (mk_real_int64 2256L); (mk_real_int64 8000L); (mk_real_int64 2500L); (mk_real_int64 1000L); (mk_real_int64 5100L); (mk_real_int64 2950L); (mk_real_int64 2310L); (mk_real_int64 6250L); (mk_real_int64 6050L); ]); +("y4_hi", [2; 5; 13; 15; 20; 22; 24; 28; 30; 32; 35; 38; 39; 40; 41; ], [(mk_real_int64 100L); (mk_real_int64 550L); (mk_real_int64 6800L); (mk_real_int64 6290L); (mk_real_int64 1140L); (mk_real_int64 2020L); (mk_real_int64 3410L); (mk_real_int64 4980L); (mk_real_int64 2500L); (mk_real_int64 1072L); (mk_real_int64 3390L); (mk_real_int64 3886L); (mk_real_int64 2200L); (mk_real_int64 3750L); (mk_real_int64 256L); ]); +("y5_lo", [0; 9; 16; 19; 21; 22; 25; 28; 30; 42; 43; 45; 51; 55; ], [(mk_real_int64 1220L); (mk_real_int64 892L); (mk_real_int64 2256L); (mk_real_int64 905L); (mk_real_int64 2392L); (mk_real_int64 2500L); (mk_real_int64 1000L); (mk_real_int64 5360L); (mk_real_int64 5120L); (mk_real_int64 2606L); (mk_real_int64 1627L); (mk_real_int64 2560L); (mk_real_int64 1157L); (mk_real_int64 2800L); ]); +("y5_hi", [6; 15; 23; 38; 40; 44; 46; 47; 48; 50; 54; 56; 57; ], [(mk_real_int64 5406L); (mk_real_int64 2290L); (mk_real_int64 1040L); (mk_real_int64 1520L); (mk_real_int64 3410L); (mk_real_int64 4980L); (mk_real_int64 2500L); (mk_real_int64 1675L); (mk_real_int64 1072L); (mk_real_int64 1337L); (mk_real_int64 1386L); (mk_real_int64 3750L); (mk_real_int64 256L); ]); +("y6_lo", [0; 7; 9; 16; 19; 21; 22; 25; 27; 28; 30; 38; 41; 42; 43; 45; 46; 47; 51; 55; ], [(mk_real_int64 1220L); (mk_real_int64 7310000L); (mk_real_int64 892L); (mk_real_int64 2256L); (mk_real_int64 905L); (mk_real_int64 2392L); (mk_real_int64 2500L); (mk_real_int64 1000L); (mk_real_int64 370000L); (mk_real_int64 5360L); (mk_real_int64 5120L); (mk_real_int64 2180000L); (mk_real_int64 770000L); (mk_real_int64 2606L); (mk_real_int64 1627L); (mk_real_int64 2560L); (mk_real_int64 10340000L); (mk_real_int64 7080000L); (mk_real_int64 1157L); (mk_real_int64 2800L); ]); +("y6_hi", [6; 15; 23; 38; 40; 44; 46; 47; 48; 50; 54; 56; 57; ], [(mk_real_int64 5406L); (mk_real_int64 2290L); (mk_real_int64 1040L); (mk_real_int64 1520L); (mk_real_int64 3410L); (mk_real_int64 4980L); (mk_real_int64 2500L); (mk_real_int64 1675L); (mk_real_int64 1072L); (mk_real_int64 1337L); (mk_real_int64 1386L); (mk_real_int64 3750L); (mk_real_int64 256L); ]); +("ye_hi", [16; 27; ], [(mk_real_int64 10000L); (mk_real_int64 10000L); ]); +("ye_lo", [6; 18; 23; 28; 35; ], [(mk_real_int64 3190000L); (mk_real_int64 3940000L); (mk_real_int64 17260000L); (mk_real_int64 2150000L); (mk_real_int64 2180000L); ]); +("yn_hi", [1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ], [(mk_real_int64 10120L); (mk_real_int64 10120L); (mk_real_int64 10120L); (mk_real_int64 1628L); (mk_real_int64 120L); (mk_real_int64 10781L); (mk_real_int64 4752L); (mk_real_int64 20120L); (mk_real_int64 10120L); (mk_real_int64 20120L); (mk_real_int64 6950L); (mk_real_int64 10120L); ]); +("yn_lo", [0; ], [(mk_real_int64 6909L); ]); +];; +let result = prove_hypermap_lp hypermap_string precision constraints target_variables variable_bounds;; +end;; + +concl (Test_case.result) diff --git a/formal_lp/old/ineqs/tests2/all_tests.hl b/formal_lp/old/ineqs/tests2/all_tests.hl new file mode 100644 index 0000000..da52f80 --- /dev/null +++ b/formal_lp/old/ineqs/tests2/all_tests.hl @@ -0,0 +1,93 @@ +load_path := "/mnt/Repository/formal_lp/ineqs/tests2" + :: "/mnt/Repository/formal_lp/hypermap" :: !load_path;; + +needs "nobranching_lp.hl";; + +#load "unix.cma";; + +let test file = + let start = Unix.gettimeofday() in + let _ = loadt file in + let finish = Unix.gettimeofday() in + finish -. start;; + +(* 4.350 *) +test "118343205068_out.hl";; + +(* 3.758 *) +test "118760185161_out.hl";; + +(* 3.757 *) +test "119040238600_out.hl";; + +(* 3.638 *) +test "122526068934_out.hl";; + +(* 5.148 *) +test "123040027899_out.hl";; + +(* 3.210 *) +test "125719999821_out.hl";; + +(* 3.337 *) +test "147671934133_out.hl";; + +(* 4.723 *) +test "156401568298_out.hl";; + +(* 4.071 *) +test "156615503428_out.hl";; + +(* 4.329 *) +test "158856256118_out.hl";; + +(* 4.082 *) +test "165950391005_out.hl";; + +(* 4.165 *) +test "168156828154_out.hl";; + +(* 3.298 *) +test "17272290668_out.hl";; + +(* 3.161 *) +test "195482381558_out.hl";; + +(* 3.203 *) +test "196021155893_out.hl";; + +(* 3.309 *) +test "206084941231_out.hl";; + +(* 3.664 *) +test "211626865969_out.hl";; + +(* 3.867 *) +test "219955817888_out.hl";; + +(* 4.465 *) +test "245859035526_out.hl";; + +(* 3.318 *) +test "25168582633_out.hl";; + +(* 3.252 *) +test "30500231120_out.hl";; + +(* 3.470 *) +test "4436579732_out.hl";; + +(* 4.311 *) +test "63626063287_out.hl";; + +(* 3.578 *) +test "69964410750_out.hl";; + +(* 4.020 *) +test "74394196986_out.hl";; + +(* 3.731 *) +test "91057093091_out.hl";; + +(* 3.139 *) +test "945145744_out.hl";; diff --git a/formal_lp/old/list/list_conversions.hl b/formal_lp/old/list/list_conversions.hl new file mode 100644 index 0000000..362ef60 --- /dev/null +++ b/formal_lp/old/list/list_conversions.hl @@ -0,0 +1,718 @@ +needs "../formal_lp/arith/nat.hl";; + +open Arith_nat;; +open Arith_misc;; + +let t_const = `T` and + f_const = `F`;; + + +let MY_PROVE_HYP hyp th = EQ_MP (DEDUCT_ANTISYM_RULE hyp th) hyp;; +let MY_RULE = UNDISCH_ALL o PURE_REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL;; +let MY_RULE_NUM = UNDISCH_ALL o NUMERALS_TO_NUM o PURE_REWRITE_RULE[GSYM IMP_IMP] o SPEC_ALL;; + + + + +(******************************) + +(* HD conversions *) + +let HD_A_CONS = prove(`HD (CONS (h:A) t) = h`, REWRITE_TAC[HD]);; + +(* Takes a term `[a;...]` and returns the theorem |- HD [a;...] = a *) +let eval_hd list_tm = + let ltm, t_tm = dest_comb list_tm in + let h_tm = rand ltm in + let list_ty = type_of t_tm and + ty = type_of h_tm in + let h_var = mk_var("h", ty) and + t_var = mk_var("t", list_ty) in + (INST[h_tm, h_var; t_tm, t_var] o INST_TYPE[ty, aty]) HD_A_CONS;; + +(* Takes a term `HD [a;...]` and returns the theorem |- HD [a;...] = a *) +let hd_conv hd_tm = + if (fst o dest_const o rator) hd_tm <> "HD" then failwith "hd_conv" + else eval_hd (rand hd_tm);; + + +(* +let tm = `HD [1;2;3;4]`;; +hd_conv tm;; +(* 0.072 *) +test 1000 (REWRITE_CONV[HD]) tm;; +(* 0.016 *) +test 1000 hd_conv tm;; +let tm = `[1;2;3;4]`;; +eval_hd tm;; +test 1000 eval_hd tm;; +*) + + +(*********************************) +(* EL conversion *) + +let EL_0' = (MY_RULE_NUM o prove)(`EL 0 (CONS (h:A) t) = h`, REWRITE_TAC[EL; HD]);; +let EL_n' = (MY_RULE_NUM o prove)(`0 < n /\ PRE n = m ==> EL n (CONS (h:A) t) = EL m t`, + STRIP_TAC THEN SUBGOAL_THEN `n = SUC m` ASSUME_TAC THENL + [ REPEAT (POP_ASSUM MP_TAC) THEN ARITH_TAC; ALL_TAC ] THEN ASM_REWRITE_TAC[EL; TL]);; + + +let zero_const = `_0` and + pre_const = `PRE`;; + +let m_var_num = `m:num` and + n_var_num = `n:num`;; + + +(* Takes a raw numeral term and a list term and returns the theorem |- EL n [...] = x *) +let eval_el n_tm list_tm = + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let inst_t = INST_TYPE[ty, aty] in + let el_0, el_n = inst_t EL_0', inst_t EL_n' in + let h_var, t_var = mk_var("h", ty), mk_var("t", list_ty) in + + let rec el_conv_raw = fun n_tm list_tm -> + let h_tm, t_tm = dest_cons list_tm in + let inst0 = INST[h_tm, h_var; t_tm, t_var] in + if n_tm = zero_const then + inst0 el_0 + else + let n_gt0 = (EQT_ELIM o raw_gt0_hash_conv) n_tm in + let pre_n = raw_pre_hash_conv (mk_comb (pre_const, n_tm)) in + let m_tm = (rand o concl) pre_n in + let th0 = (MY_PROVE_HYP pre_n o MY_PROVE_HYP n_gt0 o + INST[n_tm, n_var_num; m_tm, m_var_num] o inst0) el_n in + let th1 = el_conv_raw m_tm t_tm in + TRANS th0 th1 in + el_conv_raw n_tm list_tm;; + + + +(* Takes a term `EL n [...]` and returns the theorem |- EL n [...] = x *) +(* Note: n must be a raw numeral term Dx (Dy ... _0) *) +let el_conv el_tm = + let ltm, list_tm = dest_comb el_tm in + let el, n_tm = dest_comb ltm in + if (fst o dest_const) el <> "EL" then failwith "el_conv" + else eval_el n_tm list_tm;; + +(* +let n0_tm = `_0` and + n_tm = `D3 _0` and + list_tm = `[1; 2; 3; 4; 5]`;; + +eval_el n0_tm list_tm;; +(* 0.24 *) +test 10000 (eval_el n0_tm) list_tm;; + +eval_el n_tm list_tm;; +(* 1.22 *) +test 10000 (eval_el n_tm) list_tm;; + +let tm = mk_icomb (mk_comb (`EL`, n_tm), list_tm);; +el_conv tm;; +*) + + + +(*******************************) + +(* FST, SND conversions *) + +let FST' = ISPECL[`x:A`; `y:B`] FST;; +let SND' = ISPECL[`x:A`; `y:B`] SND;; + + +let fst_conv tm = + let x_tm, y_tm = dest_pair (rand tm) in + let x_ty, y_ty = type_of x_tm, type_of y_tm in + let x_var, y_var = mk_var("x", x_ty), mk_var("y", y_ty) in + (INST[x_tm, x_var; y_tm, y_var] o INST_TYPE[x_ty, aty; y_ty, bty]) FST';; + +let snd_conv tm = + let x_tm, y_tm = dest_pair (rand tm) in + let x_ty, y_ty = type_of x_tm, type_of y_tm in + let x_var, y_var = mk_var("x", x_ty), mk_var("y", y_ty) in + (INST[x_tm, x_var; y_tm, y_var] o INST_TYPE[x_ty, aty; y_ty, bty]) SND';; + + +(* +let tm = `FST (1,2)`;; +fst_conv tm;; + +(* 0.688 *) +test 10000 (REWRITE_CONV[]) tm;; +(* 0.100 *) +test 10000 fst_conv tm;; +*) + + +(******************************) + +(* LENGTH conversions *) + +let LENGTH_0' = (MY_RULE_NUM o prove) (`LENGTH ([]:(A)list) = 0`, REWRITE_TAC[LENGTH]) and + LENGTH_CONS' = prove(`LENGTH (CONS (h:A) t) = SUC (LENGTH t)`, REWRITE_TAC[LENGTH]);; + +let suc_const = `SUC`;; + +(* Takes a term `[...]` and returns the theorem |- LENGTH [...] = n *) +let eval_length list_tm = + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let inst_t = INST_TYPE[ty, aty] in + let length_empty, length_cons = inst_t LENGTH_0', inst_t LENGTH_CONS' in + let h_var, t_var = mk_var("h", ty), mk_var("t", list_ty) in + + let rec length_conv_raw = fun list_tm -> + if (is_comb list_tm) then + let ltm, t_tm = dest_comb list_tm in + let h_tm = rand ltm in + let th0 = INST[h_tm, h_var; t_tm, t_var] length_cons in + let th1' = length_conv_raw t_tm in + let th1 = AP_TERM suc_const th1' in + let th2 = raw_suc_conv_hash (rand(concl th1)) in + TRANS (TRANS th0 th1) th2 + else + length_empty in + length_conv_raw list_tm;; + + +(* Takes a term `LENGTH [...]` and returns the theorem |- LENGTH [...] = n *) +let length_conv length_tm = + if (fst o dest_const o rator) length_tm <> "LENGTH" then failwith "length_conv" + else eval_length (rand length_tm);; + + +(* +let tm = `LENGTH [&1;&4;&4;&6;&7 * &8]`;; +length_conv tm;; +test 1000 (REWRITE_CONV[LENGTH; ARITH_SUC]) tm;; (* 0.792 *) +test 1000 length_conv tm;; (* 0.076 *) +*) + + +(***************) +(* eval_zip *) + +let ZIP_0' = prove(`ZIP ([]:(A)list) ([]:(B)list) = []`, REWRITE_TAC[ZIP]) and + ZIP_CONS' = prove(`ZIP (CONS (h1:A) t1) (CONS (h2:B) t2) = CONS (h1, h2) (ZIP t1 t2)`, + REWRITE_TAC[ZIP]);; + +let eval_zip list1_tm list2_tm = + let list1_ty = type_of list1_tm and + list2_ty = type_of list2_tm in + let ty1 = (hd o snd o dest_type) list1_ty and + ty2 = (hd o snd o dest_type) list2_ty in + let inst_t = INST_TYPE[ty1, aty; ty2, bty] in + let zip0, zip_cons = inst_t ZIP_0', inst_t ZIP_CONS' in + let h1_var, t1_var = mk_var("h1", ty1), mk_var("t1", list1_ty) and + h2_var, t2_var = mk_var("h2", ty2), mk_var("t2", list2_ty) in + + let rec zip_conv_rec = fun list1_tm list2_tm -> + if (is_comb list1_tm) then + let ltm1, t1_tm = dest_comb list1_tm and + ltm2, t2_tm = dest_comb list2_tm in + let h1_tm, h2_tm = rand ltm1, rand ltm2 in + let th0 = INST[h1_tm, h1_var; t1_tm, t1_var; h2_tm, h2_var; t2_tm, t2_var] zip_cons in + let cons_tm = (rator o rand o concl) th0 in + let th1' = zip_conv_rec t1_tm t2_tm in + let th1 = AP_TERM cons_tm th1' in + TRANS th0 th1 + else + zip0 in + zip_conv_rec list1_tm list2_tm;; + + +(******************) +(* ALL conversion *) +(******************) + +let ALL_0' = prove(`ALL P ([]:(A)list) <=> T`, REWRITE_TAC[ALL]) and + ALL_CONS_T' = (MY_RULE o prove)(`(P h <=> T) /\ (ALL P t <=> T) ==> (ALL P (CONS (h:A) t) <=> T)`, + REWRITE_TAC[ALL]) and + ALL_CONS_F2' = (MY_RULE o prove)(`(ALL P t <=> F) ==> (ALL P (CONS (h:A) t) <=> F)`, + SIMP_TAC[ALL]) and + ALL_CONS_F1' = (MY_RULE o prove)(`(P h <=> F) ==> (ALL P (CONS (h:A) t) <=> F)`, + SIMP_TAC[ALL]);; + + +(* Note: p_conv should return theorems of the form |- P a b <=> T *) +let all_conv_univ p_conv tm = + let ltm, list_tm = dest_comb tm in + let p_tm = rand ltm in + + let list_ty = type_of list_tm and + p_ty = type_of p_tm in + let ty = (hd o snd o dest_type) list_ty in + let inst_t = INST_TYPE[ty, aty] in + + let all_0, all_t, all_f1, all_f2 = inst_t ALL_0', inst_t ALL_CONS_T', + inst_t ALL_CONS_F1', inst_t ALL_CONS_F2' in + let h_var, t_var = mk_var("h", ty), mk_var("t", list_ty) and + p_var = mk_var("P", p_ty) in + + let rec all_conv_rec = fun list_tm -> + if is_comb list_tm then + let ltm, t_tm = dest_comb list_tm in + let h_tm = rand ltm in + let p_th = p_conv (mk_comb (p_tm, h_tm)) in + let inst = INST[h_tm, h_var; t_tm, t_var; p_tm, p_var] in + if (rand o concl) p_th = t_const then + let all_th = all_conv_rec t_tm in + if (rand o concl) all_th = t_const then + (MY_PROVE_HYP all_th o MY_PROVE_HYP p_th o inst) all_t + else + (MY_PROVE_HYP all_th o inst) all_f2 + else + (MY_PROVE_HYP p_th o inst) all_f1 + else + INST[p_tm, p_var] all_0 in + all_conv_rec list_tm;; + + +(* +let tm = `ALL ((<) 0) [1;3;4;2;4]`;; +all_conv_univ NUM_LT_CONV tm;; +let test_conv = REWRITE_CONV[ALL] THENC ONCE_DEPTH_CONV NUM_LT_CONV;; +test_conv tm;; +(* 0.504 *) +test 1000 (all_conv_univ NUM_LT_CONV) tm;; +(* 1.056 *) +test 1000 test_conv test_tm;; +*) + + + +(*******************) +(* ALL2 conversion *) +(*******************) + +let ALL2_0' = prove(`ALL2 P ([]:(A)list) ([]:(B)list) <=> T`, REWRITE_TAC[ALL2]) and + ALL2_CONS_T' = (MY_RULE o prove)(`(P h1 h2 <=> T) /\ (ALL2 P t1 t2 <=> T) ==> + (ALL2 P (CONS (h1:A) t1) (CONS (h2:B) t2) <=> T)`, + REWRITE_TAC[ALL2]) and + ALL2_CONS_F2' = (MY_RULE o prove)(`(ALL2 P t1 t2 <=> F) ==> + (ALL2 P (CONS (h1:A) t1) (CONS (h2:B) t2) <=> F)`, + SIMP_TAC[ALL2]) and + ALL2_CONS_F1' = (MY_RULE o prove)(`(P h1 h2 <=> F) ==> + (ALL2 P (CONS (h1:A) t1) (CONS (h2:B) t2) <=> F)`, + SIMP_TAC[ALL2]);; + + +(* Note: p_conv should return theorems of the form |- P a b <=> T *) +let all2_conv_univ p_conv tm = + let ltm, list2_tm = dest_comb tm in + let ltm2, list1_tm = dest_comb ltm in + let p_tm = rand ltm2 in + + let list1_ty = type_of list1_tm and + list2_ty = type_of list2_tm and + p_ty = type_of p_tm in + let ty1 = (hd o snd o dest_type) list1_ty and + ty2 = (hd o snd o dest_type) list2_ty in + let inst_t = INST_TYPE[ty1, aty; ty2, bty] in + + let all2_0, all2_t, all2_f1, all2_f2 = inst_t ALL2_0', inst_t ALL2_CONS_T', + inst_t ALL2_CONS_F1', inst_t ALL2_CONS_F2' in + let h1_var, t1_var = mk_var("h1", ty1), mk_var("t1", list1_ty) and + h2_var, t2_var = mk_var("h2", ty2), mk_var("t2", list2_ty) and + p_var = mk_var("P", p_ty) in + + let rec all2_conv_rec = fun list1_tm list2_tm -> + if is_comb list1_tm then + let ltm1, t1_tm = dest_comb list1_tm and + ltm2, t2_tm = dest_comb list2_tm in + let h1_tm, h2_tm = rand ltm1, rand ltm2 in + let p_th = p_conv (mk_binop p_tm h1_tm h2_tm) in + let inst = INST[h1_tm, h1_var; t1_tm, t1_var; h2_tm, h2_var; t2_tm, t2_var; p_tm, p_var] in + if (rand o concl) p_th = t_const then + let all2_th = all2_conv_rec t1_tm t2_tm in + if (rand o concl) all2_th = t_const then + (MY_PROVE_HYP all2_th o MY_PROVE_HYP p_th o inst) all2_t + else + (MY_PROVE_HYP all2_th o inst) all2_f2 + else + (MY_PROVE_HYP p_th o inst) all2_f1 + else + if is_comb list2_tm then failwith ("all2_conv_univ: l1 = []; l2 = "^string_of_term list2_tm) else + INST[p_tm, p_var] all2_0 in + all2_conv_rec list1_tm list2_tm;; + + +(* +let tm = `ALL2 (<) [1;3;4;2;4] [3;343;454;454;5]`;; +all2_conv_univ NUM_LT_CONV tm;; +let test_conv = REWRITE_CONV[ALL2] THENC ONCE_DEPTH_CONV NUM_LT_CONV;; +test_conv tm;; +(* 0.744 *) +test 1000 (all2_conv_univ NUM_LT_CONV) tm;; +(* 2.280 *) +test 1000 test_conv test_tm;; +*) + + + +(******************************) + +(* MEM conversions *) + +let MEM_A_EMPTY = prove(`MEM (x:A) [] <=> F`, REWRITE_TAC[MEM]) and + MEM_A_HD = MY_RULE (prove(`(x = h <=> T) ==> (MEM (x:A) (CONS h t) <=> T)`,SIMP_TAC[MEM])) and + MEM_A_TL = MY_RULE (prove(`(x = h <=> F) ==> (MEM (x:A) (CONS h t) <=> MEM x t)`, SIMP_TAC[MEM]));; + + +let rec eval_mem_univ eq_conv x_tm list_tm = + let ty = type_of x_tm in + let inst_t = INST_TYPE[ty, aty] in + let mem_empty, mem_hd, mem_tl = inst_t MEM_A_EMPTY, inst_t MEM_A_HD, inst_t MEM_A_TL in + let x_var, h_var = mk_var("x", ty), mk_var("h", ty) and + t_var = mk_var("t", mk_type("list", [ty])) in + + let rec mem_conv_raw list_tm = + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let eq_th = eq_conv (mk_eq(x_tm, h_tm)) in + if (rand(concl eq_th) = t_const) then + let th0' = INST[x_tm, x_var; h_tm, h_var; t_tm, t_var] mem_hd in + MY_PROVE_HYP eq_th th0' + else + let th0' = INST[x_tm, x_var; h_tm, h_var; t_tm, t_var] mem_tl in + let th0 = MY_PROVE_HYP eq_th th0' in + let th1 = mem_conv_raw t_tm in + TRANS th0 th1 + else + INST[x_tm, x_var] mem_empty in + + mem_conv_raw list_tm;; + + +let mem_conv_univ eq_conv mem_tm = + let ltm, list_tm = dest_comb mem_tm in + let c_tm, x_tm = dest_comb ltm in + if (fst o dest_const) c_tm <> "MEM" then failwith "mem_conv_univ" else + eval_mem_univ eq_conv x_tm list_tm;; + + +(* +let tm = `MEM 11 [1;2;3;4;5;6;4;5;6;7;3;4;4;6;8;9;10]`;; +mem_conv_univ (PURE_REWRITE_CONV[ARITH_EQ]) tm;; + +test 100 (mem_conv_univ (REWRITE_CONV[ARITH_EQ])) tm;; (* 0.176 *) +test 100 (REWRITE_CONV[MEM; ARITH_EQ]) tm;; (* 0.352 *) +*) + + +(**********************************) + +(* FILTER conversions *) + +let FILTER_A_EMPTY = prove(`FILTER (P:A->bool) [] = []`, REWRITE_TAC[FILTER]) and + FILTER_A_HD = (MY_RULE o prove)(`(P h <=> T) ==> FILTER (P:A->bool) (CONS h t) = CONS h (FILTER P t)`, + SIMP_TAC[FILTER]) and + FILTER_A_TL = (MY_RULE o prove)(`(P h <=> F) ==> FILTER (P:A->bool) (CONS h t) = FILTER P t`, + SIMP_TAC[FILTER]);; + + + +let filter_conv_univ p_conv tm = + let ltm, list_tm = dest_comb tm in + let p_tm = rand ltm in + let p_ty = type_of p_tm in + let ty = (hd o snd o dest_type) p_ty in + let inst_t = INST_TYPE[ty, aty] in + let filter_empty, filter_hd, filter_tl = + inst_t FILTER_A_EMPTY, inst_t FILTER_A_HD, inst_t FILTER_A_TL in + let p_var = mk_var("P", p_ty) in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", mk_type("list",[ty])) in + + let rec filter_conv_raw = fun list_tm -> + if (is_comb list_tm) then + let ltm, t_tm = dest_comb list_tm in + let h_tm = rand ltm in + let p_th = p_conv (mk_comb(p_tm, h_tm)) in + if (rand(concl p_th) = t_const) then + let th0' = INST[p_tm, p_var; h_tm, h_var; t_tm, t_var] filter_hd in + let th0 = MY_PROVE_HYP p_th th0' in + let ltm = rator(rand(concl th0)) in + let th1 = filter_conv_raw t_tm in + TRANS th0 (AP_TERM ltm th1) + else + let th0' = INST[p_tm, p_var; h_tm, h_var; t_tm, t_var] filter_tl in + let th0 = MY_PROVE_HYP p_th th0' in + let th1 = filter_conv_raw t_tm in + TRANS th0 th1 + else + INST[p_tm, p_var] filter_empty in + + filter_conv_raw list_tm;; + + + + +(* +let tm = `FILTER (\n. n = 2 \/ n = 3) [1;2;3;4;2;3;1]`;; + +REWRITE_CONV[FILTER; ARITH_EQ] tm;; +filter_conv_univ (REWRITE_CONV[ARITH_EQ]) tm;; + +test 100 (REWRITE_CONV[FILTER; ARITH_EQ]) tm;; (* 7.596 *) +test 100 (filter_conv_univ (REWRITE_CONV[ARITH_EQ])) tm;; (* 0.236 *) +*) + +(***************************) + +(* MAP conversions *) + + +let MAP_AB_EMPTY = prove(`MAP (f:A->B) [] = []`, REWRITE_TAC[MAP]) and + MAP_AB_CONS = prove(`MAP (f:A->B) (CONS h t) = CONS (f h) (MAP f t)`, REWRITE_TAC[MAP]);; + + +let map_conv_univ f_conv tm = + let ltm, list_tm = dest_comb tm in + let ftm = rand ltm in + let ftm_ty = type_of ftm in + let f_var = mk_var("f", ftm_ty) in + let [a_type; b_type] = snd(dest_type ftm_ty) in + let h_var = mk_var("h", a_type) in + let t_var = mk_var("t", mk_type("list", [a_type])) in + let inst_t = INST[ftm, f_var] o INST_TYPE[a_type, aty; b_type, bty] in + let map_empty, map_cons = + inst_t MAP_AB_EMPTY, inst_t MAP_AB_CONS in + + let rec map_conv_raw list_tm = + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let th0 = INST[h_tm, h_var; t_tm, t_var] map_cons in + let ltm, rtm = dest_comb (rand(concl th0)) in + let cons_tm, f_h_tm = dest_comb ltm in + let f_h_th = f_conv f_h_tm in + let map_t_th = map_conv_raw t_tm in + TRANS th0 (MK_COMB (AP_TERM cons_tm f_h_th, map_t_th)) + else + map_empty in + + map_conv_raw list_tm;; + + +(* +let tm = `MAP (\x. x + 1) [1;2;3;4;5;6;7;8;9;10;11]`;; + +REWRITE_CONV[MAP] tm;; +map_conv_univ BETA_CONV tm;; +map_conv_univ (BETA_CONV THENC NUM_ADD_CONV) tm;; + +test 100 (REWRITE_CONV[MAP]) tm;; (* 0.464 *) +test 100 (map_conv_univ BETA_CONV) tm;; (* 0.04 *) + +test 100 (map_conv_univ (BETA_CONV THENC NUM_ADD_CONV)) tm;; (* 0.096 *) +*) + + +(*****************************************) + +(* ALL rules *) + + +let ALL_A_HD = UNDISCH_ALL(prove(`ALL (P:A->bool) (CONS h t) ==> P h`, SIMP_TAC[ALL])) and + ALL_A_TL = UNDISCH_ALL(prove(`ALL (P:A->bool) (CONS h t) ==> ALL P t`, SIMP_TAC[ALL]));; + + +(* Given a theorem `ALL P list` returns the list of theorems (P x1),...,(P xn) *) +let get_all th = + let ltm, list_tm = dest_comb (concl th) in + let p_tm = rand ltm in + let list_ty = type_of list_tm in + let p_ty = type_of p_tm in + let ty = (hd o snd o dest_type) list_ty in + let p_var = mk_var("P", p_ty) in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", list_ty) in + + let inst_t = INST[p_tm, p_var] o INST_TYPE[ty, aty] in + let all_hd, all_tl = inst_t ALL_A_HD, inst_t ALL_A_TL in + + let rec get_all_raw all_th list_tm = + if (is_comb list_tm) then + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let inst_t = INST[h_tm, h_var; t_tm, t_var] in + let th_tl = MY_PROVE_HYP all_th (inst_t all_tl) in + let th_hd = MY_PROVE_HYP all_th (inst_t all_hd) in + th_hd :: get_all_raw th_tl t_tm + else + [] in + + get_all_raw th list_tm;; + + + +(* Given a theorem `ALL P list`, returns (P x_i1),..., (P x_in) + where i1,...,in are given indices. + The list of indices should be sorted *) +let select_all th indices = + let ltm, list_tm = dest_comb (concl th) in + let p_tm = rand ltm in + let list_ty = type_of list_tm in + let p_ty = type_of p_tm in + let ty = (hd o snd o dest_type) list_ty in + let p_var = mk_var("P", p_ty) in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", list_ty) in + + let inst_t = INST[p_tm, p_var] o INST_TYPE[ty, aty] in + let all_hd, all_tl = inst_t ALL_A_HD, inst_t ALL_A_TL in + + let rec get_all_raw all_th list_tm indices n = + match indices with + [] -> [] + | i::is -> + let h_tm', t_tm = dest_comb list_tm in + let h_tm = rand h_tm' in + let inst_t = INST[h_tm, h_var; t_tm, t_var] in + let th_tl = MY_PROVE_HYP all_th (inst_t all_tl) in + + if (i - n = 0) then + let th_hd = MY_PROVE_HYP all_th (inst_t all_hd) in + th_hd :: get_all_raw th_tl t_tm is (n + 1) + else + get_all_raw th_tl t_tm (i::is) (n + 1) in + + get_all_raw th list_tm indices 0;; + + +(* +let tm = `ALL (\x. x > 3) [4; 5; 8; 10; 5; 4]`;; +let th = (EQT_ELIM o REWRITE_CONV[ALL; ARITH]) tm;; +get_all th;; +select_all th [2;3;4];; + +(* 0.192 *) +test 100 (CONJUNCTS o REWRITE_RULE[ALL]) th;; +(* 0.016 *) +test 100 (get_all) th;; +(* 0.012 *) +test 100 (select_all th) [2;3;4];; +*) + + +(*****************************************) + +(* set_of_list conversions *) + +let SET_OF_LIST_A_EMPTY = prove(`set_of_list ([]:(A)list) = {}`, REWRITE_TAC[set_of_list]) and + SET_OF_LIST_A_H = prove(`set_of_list [h:A] = {h}`, REWRITE_TAC[set_of_list]) and + SET_OF_LIST_A_CONS = prove(`set_of_list (CONS (h:A) t) = h INSERT set_of_list t`, REWRITE_TAC[set_of_list]);; + + + +let set_of_list_conv tm = + let list_tm = rand tm in + let list_ty = type_of list_tm in + let ty = (hd o snd o dest_type) list_ty in + let h_var = mk_var("h", ty) in + let t_var = mk_var("t", list_ty) in + let inst_t = INST_TYPE[ty, aty] in + let set_of_list_h, set_of_list_cons = inst_t SET_OF_LIST_A_H, inst_t SET_OF_LIST_A_CONS in + + let rec set_of_list_conv_raw = fun h_tm t_tm -> + if (is_comb t_tm) then + let h_tm', t_tm' = dest_comb t_tm in + let th0 = INST[h_tm, h_var; t_tm, t_var] set_of_list_cons in + let ltm, rtm = dest_comb(rand(concl th0)) in + TRANS th0 (AP_TERM ltm (set_of_list_conv_raw (rand h_tm') t_tm')) + else + INST[h_tm, h_var] set_of_list_h in + + if (is_comb list_tm) then + let h_tm, t_tm = dest_comb list_tm in + set_of_list_conv_raw (rand h_tm) t_tm + else + inst_t SET_OF_LIST_A_EMPTY;; + + + +(* +let tm = `set_of_list [&1; &5; &6; &3; &5; &8; &9]`;; +set_of_list_conv tm;; +(* 0.872 *) +test 1000 (REWRITE_CONV[set_of_list]) tm;; +(* 0.076 *) +test 1000 set_of_list_conv tm;; +*) + + + + +(*************************************) + +(* list_sum conversions *) + +let list_sum = new_definition `list_sum list f = ITLIST (\t1 t2. f t1 + t2) list (&0)`;; + +let LIST_SUM_A_EMPTY = prove(`list_sum [] (f:A->real) = &0`, REWRITE_TAC[list_sum; ITLIST]) and + LIST_SUM_A_H = prove(`list_sum [h:A] f = f h`, REWRITE_TAC[list_sum; ITLIST; REAL_ADD_RID]) and + LIST_SUM_A_CONS = prove(`list_sum (CONS (h:A) t) f = f h + list_sum t f`, REWRITE_TAC[list_sum; ITLIST]);; + + +let list_sum_conv f_conv tm = + let ltm, f_tm = dest_comb tm in + let list_tm = rand ltm in + let list_ty = type_of list_tm in + let f_ty = type_of f_tm in + let ty = (hd o snd o dest_type) list_ty in + let f_var = mk_var("f", f_ty) and + h_var = mk_var("h", ty) and + t_var = mk_var("t", list_ty) in + let inst_t = INST[f_tm, f_var] o INST_TYPE[ty, aty] in + let list_sum_h = inst_t LIST_SUM_A_H and + list_sum_cons = inst_t LIST_SUM_A_CONS in + + let rec list_sum_conv_raw = fun h_tm t_tm -> + if (is_comb t_tm) then + let h_tm', t_tm' = dest_comb t_tm in + let th0 = INST[h_tm, h_var; t_tm, t_var] list_sum_cons in + let ltm, rtm = dest_comb(rand(concl th0)) in + let plus_op, fh_tm = dest_comb ltm in + let f_th = f_conv fh_tm in + let th1 = list_sum_conv_raw (rand h_tm') t_tm' in + let th2 = MK_COMB(AP_TERM plus_op f_th, th1) in + TRANS th0 th2 + else + let th0 = INST[h_tm, h_var] list_sum_h in + let f_th = f_conv (rand(concl th0)) in + TRANS th0 f_th in + + if (is_comb list_tm) then + let h_tm, t_tm = dest_comb list_tm in + list_sum_conv_raw (rand h_tm) t_tm + else + inst_t LIST_SUM_A_EMPTY;; + + + + +(* +let tm = `list_sum [&1; &3; &4; pi; #0.1] cos`;; + +list_sum_conv ALL_CONV tm;; + +(* 2.812 *) +test 1000 (REWRITE_CONV[list_sum; ITLIST; REAL_ADD_RID]) tm;; +(* 0.076 *) +test 1000 (list_sum_conv ALL_CONV) tm;; + + +let tm = `list_sum [&1; &3; &4; pi; #0.1] (\x. cos x)`;; +(* 0.104 *) +test 1000 (list_sum_conv BETA_CONV) tm;; +*) + + + diff --git a/formal_lp/old/list/list_float.hl b/formal_lp/old/list/list_float.hl new file mode 100644 index 0000000..38d8b7e --- /dev/null +++ b/formal_lp/old/list/list_float.hl @@ -0,0 +1,195 @@ +needs "../formal_lp/formal_interval/more_float.hl";; +needs "../formal_lp/list/list_conversions.hl";; + +let MY_RULE_FLOAT = UNDISCH_ALL o NUMERALS_TO_NUM o + PURE_REWRITE_RULE[FLOAT_OF_NUM; min_exp_def; GSYM IMP_IMP] o SPEC_ALL;; + + +(*************************************) +(* list_sum2 evaluation *) + +let list_sum2 = new_definition `list_sum2 f l1 l2 = ITLIST2 (\a b c. f a b + c) l1 l2 (&0)`;; + +let LIST_SUM2_0_LE' = (MY_RULE_FLOAT o prove)(`list_sum2 (f:A->B->real) [] [] <= &0`, + REWRITE_TAC[list_sum2; ITLIST2; REAL_LE_REFL]);; +let LIST_SUM2_1_LE' = (MY_RULE o prove)(`f h1 h2 <= x ==> list_sum2 (f:A->B->real) [h1] [h2] <= x`, + REWRITE_TAC[list_sum2; ITLIST2; REAL_ADD_RID]);; +let LIST_SUM2_LE' = (MY_RULE o prove)(`f h1 h2 <= x /\ list_sum2 f t1 t2 <= y /\ x + y <= z ==> + list_sum2 (f:A->B->real) (CONS h1 t1) (CONS h2 t2) <= z`, + REWRITE_TAC[list_sum2; ITLIST2] THEN STRIP_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `x + y:real` THEN + ASM_SIMP_TAC[REAL_LE_ADD2]);; + + +let list_sum2_le_conv pp f_le_conv tm = + let ltm, list2_tm = dest_comb tm in + let ltm2, list1_tm = dest_comb ltm in + let f_tm = rand ltm2 in + let list1_ty = type_of list1_tm and + list2_ty = type_of list2_tm and + f_ty = type_of f_tm in + let ty1 = (hd o snd o dest_type) list1_ty and + ty2 = (hd o snd o dest_type) list2_ty in + let f_var = mk_var ("f", f_ty) and + h1_var, t1_var = mk_var ("h1", ty1), mk_var ("t1", list1_ty) and + h2_var, t2_var = mk_var ("h2", ty2), mk_var ("t2", list2_ty) in + let inst_t = INST[f_tm, f_var] o INST_TYPE[ty1, aty; ty2, bty] in + let list2_0, list2_1, list2_le = inst_t LIST_SUM2_0_LE', inst_t LIST_SUM2_1_LE', inst_t LIST_SUM2_LE' in + + let rec rec_conv = fun list1_tm list2_tm -> + if (is_comb list1_tm) then + let h1_tm, t1_tm = dest_cons list1_tm and + h2_tm, t2_tm = dest_cons list2_tm in + let f_le_th = f_le_conv pp h1_tm h2_tm in + let x_tm = (rand o concl) f_le_th in + let inst0 = INST[h1_tm, h1_var; h2_tm, h2_var; x_tm, x_var_real] in + if is_comb t1_tm then + let sum2_t_th = rec_conv t1_tm t2_tm in + let y_tm = (rand o concl) sum2_t_th in + let xy_th = float_add_hi pp x_tm y_tm in + let z_tm = (rand o concl) xy_th in + (MY_PROVE_HYP xy_th o MY_PROVE_HYP sum2_t_th o MY_PROVE_HYP f_le_th o + INST[y_tm, y_var_real; z_tm, z_var_real; t1_tm, t1_var; t2_tm, t2_var] o + inst0) list2_le + else + if is_comb t2_tm then failwith ("sum2_le_conv: t1 = []; t2 = "^string_of_term t2_tm) else + (MY_PROVE_HYP f_le_th o inst0) list2_1 + else + if is_comb list2_tm then failwith ("sum2_le_conv: list1 = []; list2 = "^string_of_term list2_tm) else + list2_0 in + + rec_conv list1_tm list2_tm;; + + +(* +let pp = 5;; +let pi_approx = (fst o dest_pair o rand o concl) pi_approx_array.(pp) and + pi2_approx = (fst o dest_pair o rand o concl) pi2_approx_array.(pp);; + +let l1 = mk_list (replicate pi_approx 5, real_ty) and + l2 = mk_list (replicate pi2_approx 5, real_ty);; + +let tm = mk_binop `list_sum2 ( * )` l1 l2;; +(*let test_conv pp tm = + let tm1, tm2 = dest_binop mul_op_real tm in float_mul_hi pp tm1 tm2;; *) +list_sum2_le_conv pp float_mul_hi tm;; +(* 10: 4.504 *) +test 1000 (list_sum2_le_conv pp float_mul_hi) tm;; +*) + + +(**************************) +(* \a b c. a * iabs b + c *) + +let error_mul_f2 = new_definition `error_mul_f2 a int = a * iabs int`;; +let ERROR_MUL_F2' = (SYM o MY_RULE) error_mul_f2;; + + +(* |- x = a, |- P x y -> P a y *) +let rewrite_lhs eq_th th = + let ltm, rhs = dest_comb (concl th) in + let th0 = AP_THM (AP_TERM (rator ltm) eq_th) rhs in + EQ_MP th0 th;; + +let a_var_real = `a:real`;; +let le_op_real = `(<=):real->real->bool`;; + +let error_mul_f2_le_conv pp tm1 tm2 = + let eq_th = INST[tm1, a_var_real; tm2, int_var] ERROR_MUL_F2' in + let iabs_th = float_iabs tm2 in + let iabs_tm = (rand o concl) iabs_th in + let mul_th = float_mul_hi pp tm1 iabs_tm in + let th0 = AP_TERM (mk_comb (mul_op_real, tm1)) iabs_th in + let th1 = AP_THM (AP_TERM le_op_real th0) (rand (concl mul_th)) in + let le_th = EQ_MP (SYM th1) mul_th in + rewrite_lhs eq_th le_th;; + +let ERROR_MUL_F2_LEMMA' = (MY_RULE o prove)(`iabs int = x /\ a * x <= y ==> error_mul_f2 a int <= y`, + REWRITE_TAC[error_mul_f2] THEN STRIP_TAC THEN ASM_REWRITE_TAC[]);; + +let error_mul_f2_le_conv2 pp tm1 tm2 = + let iabs_th = float_iabs tm2 in + let x_tm = (rand o concl) iabs_th in + let mul_th = float_mul_hi pp tm1 x_tm in + let y_tm = (rand o concl) mul_th in + (MY_PROVE_HYP iabs_th o MY_PROVE_HYP mul_th o + INST[tm2, int_var; tm1, a_var_real; x_tm, x_var_real; y_tm, y_var_real]) ERROR_MUL_F2_LEMMA';; + + +(* +let pp = 5;; +let tm1 = pi_approx and tm2 = (rand o concl) pi2_approx_array.(pp);; +error_mul_f2_le_conv pp tm1 tm2;; +error_mul_f2_le_conv2 pp tm1 tm2;; +(* 10: 0.772 *) +test 1000 (error_mul_f2_le_conv pp tm1) tm2;; +(* 10: 0.768 *) +test 1000 (error_mul_f2_le_conv2 pp tm1) tm2;; + +let n = 6;; +let l1 = mk_list (replicate pi_approx n, real_ty) and + l2 = mk_list (replicate (mk_pair (pi2_approx, pi2_approx)) n, `:real#real`);; + +let tm = mk_comb (mk_comb (`list_sum2 error_mul_f2`, l1), l2);; + +list_sum2_le_conv pp error_mul_f2_le_conv2 tm;; +(* 10: 5.920 *) +test 1000 (list_sum2_le_conv pp error_mul_f2_le_conv2) tm;; +*) + + +(**************************) +(* \a b c. a * iabs b + c *) + +let error_mul_f1 = new_definition `error_mul_f1 w x list = x * list_sum2 error_mul_f2 w list`;; + +let ERROR_MUL_F1_LEMMA' = (MY_RULE o prove)(`x * list_sum2 error_mul_f2 w list <= z ==> + error_mul_f1 w x list <= z`, REWRITE_TAC[error_mul_f1]);; + +let list_sum2_error2_const = `list_sum2 error_mul_f2` and + w_var_list = `w:(real)list` and + list_var = `list:(real#real)list`;; + +let error_mul_f1_le_conv w_tm pp x_tm list_tm = + (* TODO: if x = 0 then do not need to compute the sum *) + let sum2_tm = mk_binop list_sum2_error2_const w_tm list_tm in + let sum2_le_th = list_sum2_le_conv pp error_mul_f2_le_conv2 sum2_tm in + let ineq_th = mul_ineq_pos_const_hi pp x_tm sum2_le_th in + let z_tm = (rand o concl) ineq_th in + (MY_PROVE_HYP ineq_th o + INST[x_tm, x_var_real; z_tm, z_var_real; w_tm, w_var_list; list_tm, list_var]) ERROR_MUL_F1_LEMMA';; + +(* +let pp = 5;; +let w_tm = mk_list (replicate pi5 6, real_ty) and + x_tm = pi5;; +let list_tm = mk_list (replicate (mk_pair (two_float, two_float)) 6, `:real#real`);; + +error_mul_f1_le_conv w_tm pp x_tm list_tm;; + +(* 10: 3.672 *) +test 1000 (error_mul_f1_le_conv w_tm pp x_tm) list_tm;; +*) + +(***********************) + +(* +let n = 6;; +let pp = 5;; + +let xx = mk_vector_list (replicate two_float n) and + zz = mk_vector_list (replicate pi5 n);; + +let eval_poly = eval_second_bounded_poly pp delta_x_poly;; +let th = eval_poly xx zz;; +let domain6_th = mk_m_center_domain n pp (rand xx) (rand zz);; +let w_tm = (rand o rand o concl) domain6_th;; +let dd_tm = (rand o concl) th;; + +let op = mk_icomb (`list_sum2`, mk_comb (`error_mul_f1`, w_tm));; +let tm = mk_binop op w_tm dd_tm;; + +list_sum2_le_conv pp (error_mul_f1_le_conv w_tm) tm;; +(* 10: 4.236 *) +test 100 (list_sum2_le_conv pp (error_mul_f1_le_conv w_tm)) tm;; +*) diff --git a/glpk/glpk_link.ml b/glpk/glpk_link.ml new file mode 100644 index 0000000..994fa3e --- /dev/null +++ b/glpk/glpk_link.ml @@ -0,0 +1,248 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Linear Programming Link *) +(* Author: Thomas C. Hales *) +(* Date: 2010-05-19 *) +(* ========================================================================== *) + +(* +This file contains material that does not depend on the details of the LP. + list processing functions, + IO operations, + glpk function calls. +*) + +module Glpk_link = struct + +(* + +needs new mktop on platforms that do not support dynamic loading of Str. + +ocamlmktop unix.cma nums.cma str.cma -o ocampl +./ocampl + +glpk needs to be installed, and glpsol needs to be found in the path. + +needs lib.ml from HOL Light and flyspeck_lib.hl from Flyspeck. +*) + + +open Str;; +open List;; +let sprintf = Printf.sprintf;; + +let (nextc,resetc) = + let counter = ref 0 in + ((fun () -> + counter:= !counter + 1; + !counter),(fun () -> (counter :=0)));; + + +(* list operations *) +let maxlist0 xs = fold_right max xs 0;; (* NB: value is always at least 0 *) + +let get_values key xs = + map snd (find_all (function k,_ -> (k=key)) xs);; + +(* +let rec sort cmp lis = (* from HOL Light lib.ml *) + match lis with + [] -> [] + | piv::rest -> + let r,l = partition (cmp piv) rest in + (sort cmp l) @ (piv::(sort cmp r));; +*) + +let sort = Lib.sort;; + +let (--) = Lib.(--);; + +(* +let rec (--) = fun m n -> if m > n then [] else m::((m + 1) -- n);; (* from HOL Light lib.ml *) +*) + +let up i = 0 -- (i-1);; + +let rec rotateL i xs = + if i=0 then xs + else match xs with + | x::xss -> rotateL ((i-1) mod length xs) (xss @ [x]) + | [] -> [];; + +let rotateR i = rotateL (-i);; + +let rotation xs = + let maxsz = maxlist0 (map length xs) in + flatten (map (fun i -> map (rotateL i) xs) (up maxsz));; + + +(* + zip from Harrison's lib.ml. + List.combine causes a stack overflow : + let tt = up 30000 in combine tt tt;; + Stack overflow during evaluation (looping recursion?). + +let rec zip l1 l2 = + match (l1,l2) with + ([],[]) -> [] + | (h1::t1,h2::t2) -> (h1,h2)::(zip t1 t2) + | _ -> failwith "zip";; +*) + +let zip = Lib.zip;; + +let enumerate xs = zip (up (length xs)) xs;; + +let whereis i xs = + let (p,_) = find (function _,j -> j=i) (enumerate xs) in + p;; + +let wheremod xs x = + let ys = rotation xs in + (whereis x ys) mod (length xs);; + +(* example *) +wheremod [[0;1;2];[3;4;5];[7;8;9]] [8;9;7];; (* 2 *) + + +let unsplit = Flyspeck_lib.unsplit;; + +let nub = Flyspeck_lib.nub;; + +let join_lines = Flyspeck_lib.join_lines;; + +(* +let rec nub = function + | [] -> [] + | x::xs -> x::filter ((!=) x) (nub xs);; + +let unsplit d f = function + | (x::xs) -> fold_left (fun s t -> s^d^(f t)) (f x) xs + | [] -> "";; + +let join_lines = unsplit "\n" (fun x-> x);; +*) + + +(* read and write *) + +(* +let load_and_close_channel do_close ic = + let rec lf ichan a = + try + lf ic (Pervasives.input_line ic::a) + with End_of_file -> a in + let rs = lf ic [] in + if do_close then Pervasives.close_in ic else (); + rev rs;; + +let load_file filename = + let ic = Pervasives.open_in filename in load_and_close_channel true ic;; + +*) + +let load_and_close_channel = Flyspeck_lib.load_and_close_channel;; + +let load_file = Flyspeck_lib.load_file;; + +let save_stringarray filename xs = + let oc = open_out filename in + for i=0 to length xs -1 + do + Pervasives.output_string oc (nth xs i ^ "\n"); + done; + close_out oc;; + +let strip_archive filename = (* strip // comments, blank lines, quotation marks etc. *) + let (ic,oc) = Unix.open_process(sprintf "cat %s | grep -v '=' | grep -v 'list' | grep -v '^//' | grep -v '^$' | grep '^[^a-z/-]' | sed 's/\"[,;]*//g' | sed 's/_//g' " filename) in + let s = load_and_close_channel false ic in + let _ = Unix.close_process (ic,oc) in + s;; + +(* example of java style string from hypermap generator. *) +let pentstring = "13_150834109178 18 3 0 1 2 3 3 2 7 3 3 0 2 4 5 4 0 3 4 6 1 0 4 3 7 2 8 3 8 2 1 4 8 1 6 9 3 9 6 10 3 10 6 4 3 10 4 5 4 5 3 7 11 3 10 5 11 3 11 7 12 3 12 7 8 3 12 8 9 3 9 10 11 3 11 12 9 ";; + +(* conversion to list. e.g. convert_to_list pentstring *) + +let convert_to_list = + let split_sp= Str.split (regexp " +") in + let strip_ = global_replace (regexp "_") "" in + let rec movelist n (x,a) = + if n=0 then (x,a) else match x with y::ys -> movelist (n-1) (ys, y::a) in + let getone (x,a) = match x with + | [] -> ([],a) + | y::ys -> let (u,v) = movelist y (ys,[]) in (u,v::a) in + let rec getall (x,a) = + if (x=[]) then (x,a) else getall (getone (x,a)) in + fun s -> + let h::ss = (split_sp (strip_ s)) in + let _::ns = map int_of_string ss in + let (_,a) = getall (ns,[]) in + (h,rev (map rev a));; + + +(* Linear programming *) + +let display_ampl ampl_datafile ampl_of_bb bb = (* for debugging *) + let outs = open_out ampl_datafile in + let _ = ampl_of_bb outs bb in + let _ = close_out outs in + Sys.command(sprintf "cat %s" ampl_datafile);; + +(* model should name the optimal value "optival" *) + +let solve_counter=ref 0;; + +let solve com model glpk_outfile varname ampl_of_bb bb = + let (ic,oc) = Unix.open_process(com) in + let _ = ampl_of_bb oc bb in + let _ = close_out oc in + let _ = (solve_counter := !solve_counter + 1) in + let inp = load_and_close_channel false ic in + let _ = Unix.close_process (ic,oc) in + (* test for no feasible solution. There are two different messages. *) +(* let _ = Sys.command("cat "^ glpk_outfile) in (* debug *) *) + let com2 = sprintf "grep \"PROBLEM HAS NO.*FEASIBLE SOLUTION\" %s" glpk_outfile in + let (ic,oc) =Unix.open_process(com2) in + let inp2 = load_and_close_channel false ic in + let _ = Unix.close_process(ic,oc) in + (inp2,inp);; + +let solve_branch_f model glpk_outfile varname ampl_of_bb bb = + let com = sprintf "glpsol -m %s -d /dev/stdin | tee %s | grep '^%s' | sed 's/.val//' | sed 's/%s = //' " model glpk_outfile varname varname in + solve com model glpk_outfile varname ampl_of_bb bb;; + +let solve_dual_f model glpk_outfile varname ampl_of_bb bb = + let com = sprintf "glpsol -m %s -d /dev/stdin --simplex --exact --dual -w /tmp/dual.out --output /tmp/output.out | tee %s | grep '^%s' | sed 's/.val//' | sed 's/%s = //' " model glpk_outfile varname varname in + solve com model glpk_outfile varname ampl_of_bb bb;; + +let display_lp model ampl_datafile glpk_outfile ampl_of_bb bb = + let oc = open_out ampl_datafile in + let _ = ampl_of_bb oc bb in + let _ = close_out oc in + let com = sprintf "glpsol -m %s -d %s | tee %s" model ampl_datafile glpk_outfile in + let _ = Sys.command(com) in + ();; + +let cpx_branch model cpxfile ampl_of_bb bb = (* debug *) + let com = sprintf "glpsol -m %s --wcpxlp %s -d /dev/stdin | grep '^opti' | sed 's/optival = //' " model cpxfile in + let (ic,oc) = Unix.open_process(com) in + let _ = ampl_of_bb oc bb in + let _ = close_out oc in + let _ = load_and_close_channel false ic in + let _ = Unix.close_process (ic,oc) in + sprintf "cplex file created of lp: %s" cpxfile;; + +(* for debugging: reading optimal variables values from the glpk_outfile *) + +let get_dumpvar glpk_outfile s = (* read variables from glpk_outfile *) + let com = sprintf "grep '%s' %s | sed 's/^.*= //' " s glpk_outfile in + let (ic,oc) = Unix.open_process(com) in + let _ = close_out oc in + let inp = load_and_close_channel false ic in + let _ = Unix.close_process(ic,oc) in + inp;; +(* get_dumpvar "yn.0.*=";; *) + +end;; diff --git a/glpk/minorlp/OXLZLEZ.ml b/glpk/minorlp/OXLZLEZ.ml new file mode 100644 index 0000000..2134828 --- /dev/null +++ b/glpk/minorlp/OXLZLEZ.ml @@ -0,0 +1,347 @@ +(* ========================================================================== *) +(* FLYSPECK - GLPK *) +(* *) +(* Linear Programming, AMPL format (non-formal) *) +(* Chapter: Packing *) +(* Lemma: OXLZLEZ *) +(* Author: Thomas C. Hales *) +(* Date: 2009-09-22, rechecked 2010-06-03, 2012-06-08 *) +(* ========================================================================== *) + +(* + +This file generates the informal linear programming part of the cluster inequality (OXLZLEZ). +These linear programs reduce the 3 and 4 blade cases to a single case: + 4 blades with 3 quarters and 1 4-cell of weight 0.5. +This final case is handled separately. + + + +needs new mktop on platforms that do not support dynamic loading of Str. + +ocamlmktop unix.cma str.cma -o ocampl +./ocampl + +*) + + +flyspeck_needs "../glpk/glpk_link.ml";; + +module Oxlzlez_informal = struct + +open Str;; +open List;; +open Glpk_link;; + +let sprintf = Printf.sprintf;; + +let glpk_dir = flyspeck_dir ^ "/../glpk";; + +(* external files *) +let model = glpk_dir^ "/minorlp/OXLZLEZ.mod";; +let tmpfile = "/tmp/OXLZLEZ_informal.dat";; +let dumpfile = "/tmp/OXLZLEZ_informal.out";; + +type lptype = Lp_unset + | Lp_infeasible + | Lp_value of (((string * int list) * string * float) list)*float;; + + +let string_of_lptype t = match t with + | Lp_infeasible -> "infeasible" + | Lp_unset -> "unset" + | Lp_value (_,u) -> Printf.sprintf "%3.3f" u;; + + +(* fields of bladerunner are documented in OXLZLEZ.mod. + See CBLADE,SBLADE,NONSBLADE,QU,QX,QY,QXD,NONQXD,NEGQU,POSQU, + HALFWT,FULLWT,SHORTY4,LONGY4 +*) + +type bladerunner = + { + mutable lpvalue : lptype; + mutable history : string; + cblade : int; (* number of blades *) + sblade : int list; + nonsblade : int list; + qu: int list; + qx : int list; + qy : int list; + qxd : int list; + nonqxd : int list; + negqu : int list; + posqu : int list; + halfwt : int list; + fullwt : int list; + shorty4: int list; + longy4:int list; + };; + +let next br i = (i+1) mod br.cblade;; + +let backup = ref [];; + +(* the initial configuration always has a quarter at 0 *) +let mk_br n = + let br = + {cblade = n; + sblade = [0;1]; (* quarter at 0. "raw" blades: face 0 goes with raw blades 0 & 1. *) + nonsblade = []; + qu = [0]; + qx = []; + qy = []; + qxd = []; + nonqxd = []; + negqu = []; + posqu = []; + halfwt = []; + fullwt = []; + shorty4=[]; + longy4=[]; + lpvalue = Lp_unset; + history=""; + } in + let _ = (backup := br ::!backup) in + br;; + +let modify_br h br fields = + let _ = (br.history <- h) in + let add s vs = nub((get_values s fields) @ vs) in + let br' = { +cblade = br.cblade; +sblade = add "sblade" br.sblade; +nonsblade = add "nonsblade" br.nonsblade; +qu = add "qu" br.qu; +qx = add "qx" br.qx; +qy = add "qy" br.qy; +qxd = add "qxd" br.qxd; +nonqxd = add "nonqxd" br.nonqxd; +negqu = add "negqu" br.negqu; +posqu = add "posqu" br.posqu; +halfwt = add "halfwt" br. halfwt; +fullwt = add "fullwt" br.fullwt; +shorty4 = add "shorty4" br.shorty4; (* y4 <= 2.1 *) +longy4 = add "longy4" br.longy4; (* y4 >= 2.1 *) +lpvalue = Lp_unset; +history = ""; +} in + let _ = (backup:= br':: !backup) in + br' +;; + +(* +Example: move 1 into halfwt +let brx = modify_br "" (mk_br 4) ["halfwt",1];; +*) + +let ampl_of_br outs br = + let list_of = unsplit " " string_of_int in + let p = sprintf in + let mk s f = p"set %s := %s;" s (list_of f) in + let j = join_lines [ + p"param CBLADE := %d;" br.cblade ; + mk "SBLADERAW" br.sblade; + mk "NONSBLADERAW" br.nonsblade; + mk "QU" br.qu; + mk "QX" br.qx; + mk "QY" br.qy; + mk "QXD" br.qxd; + mk "NONQXD" br.nonqxd; + mk "NEGQU" br.negqu; + mk "POSQU" br.posqu; + mk "HALFWT" br. halfwt; + mk "FULLWT" br.fullwt; + mk "LONGY4" br.longy4; + mk "SHORTY4" br.shorty4] in + Printf.fprintf outs "%s" j;; + +let test() = + let br = mk_br 4 in + let br = modify_br "test" br ["qu",1;"qu",2;"negqu",3] in + display_ampl tmpfile ampl_of_br br;; + +(* manipulations of lpvalue field that don't involve glpsol *) + +let notdone r = (r < 0.0);; + +let select_notdone f brs = (* selects unset and those satisfying f *) + let fil ro = match ro.lpvalue with + Lp_unset -> true + | Lp_infeasible -> false + | Lp_value (_,r) -> f r in + filter fil brs;; + +let is_unset br = match br.lpvalue with + Lp_unset -> true + | _ -> false;; + +let calc_min brs = fold_right + (fun br x -> match br.lpvalue with + |Lp_value (_,y) -> min x y + |_ -> x + ) brs 10.0;; + +let find_min brs = + let t = calc_min brs in + (* let r = Lp_value (t) in *) + find (fun br -> + match br.lpvalue with + | Lp_value (_,y) -> (y=t) + | _ -> false) brs;; + + +(* +branching. +We fail on the branching if the branch has been made already, + or if the necessary prior branches have not been followed. +*) + +let branch h br ss i = + map (fun s -> modify_br h br [s,i]) ss;; + +let branch_sblade i br = + let _ = not(mem i br.sblade or mem i br.nonsblade) or failwith "sblade" in + branch "sblade" br ["sblade"; "nonsblade"] i;; + +let branch_qxd i br = + let _ = mem i br.qx or failwith "qxd1" in + let _ = not(mem i br.qxd or mem i br.nonqxd) or failwith "qxd2" in + branch "qxd" br ["qxd";"nonqxd"] i;; + +let branch_negqu i br = + let _ = mem i br.qu or failwith "negqu1" in + let _ = not(mem i br.negqu or mem i br.posqu) or failwith "negqu2" in + branch "negqu" br ["negqu";"posqu"] i;; + +let branch_wt i br = + let _ = mem i br.qx or failwith "wt-qx" in + let _ = (mem i br.sblade && mem (next br i) br.sblade) or failwith "wt-blade" in + let _ = not(mem i br.halfwt or mem i br.fullwt) or failwith "wt-set" in + branch "wt" br ["halfwt";"fullwt"] i;; + +let branch_y4 i br = + let _ = mem i br.qy or failwith "y4-qy" in + let _ = (mem i br.sblade && mem (next br i) br.sblade) or failwith "y4-blade" in + branch "y4" br ["shorty4";"longy4"] i;; + +let branch_qu i br = + let j = next br i in + let _ = not(mem i br.qu or mem i br.qx or mem i br.qy) or failwith "qu-set" in + let _ = not(mem i br.nonsblade or mem j br.nonsblade) or failwith "qu-blade" in + modify_br "qus" br ["sblade",i;"sblade",j;"qu",i] :: branch "qu" br ["qx";"qy"] i;; + +(* (* example *) +let br = mk_br 3;; +let br1 = List.nth (branch_qu 1 br) 1;; +let br2 = List.nth (branch_sblade 2 br1) 0;; +branch_wt 1 br2;; +*) + +(* Link in glpsol linear programming package *) + +let strip_id s = + let ss = Str.split (Str.regexp "[],[]") s in + (hd ss,map int_of_string (tl ss));; + + +let load_dual() = + let outputf = Flyspeck_lib.load_file "/tmp/output.out" in + let output_split = map (Str.split (Str.regexp " +")) outputf in + let output_active = filter + (fun xs -> + if (List.length xs <3) then false else + let n = List.nth xs 0 in + let t = List.nth xs 2 in + let v = hd (List.rev xs) in + (can int_of_string n && t.[0]='N') && not(v="eps")) output_split in + let output_format = map + (fun xs -> + (strip_id (List.nth xs 1),List.nth xs 2, + float_of_string (hd (List.rev xs)))) + output_active in + output_format;; + +let set_lpvalue nt (dualdata,(f,r)) = (* side effects *) + let _ = + if (List.length f > 0) then nt.lpvalue <- Lp_infeasible + else if (List.length r = 1) + then + nt.lpvalue <- Lp_value (dualdata, float_of_string(hd r)) + else + nt.lpvalue <- Lp_unset in + nt;; + +let solve_and_set_lp br = + let _ = match br.lpvalue with + | Lp_unset -> (* generate dual data as soon as lp is solved *) + let fr = (Glpk_link.solve_dual_f model dumpfile "ggsum" ampl_of_br br) in + let dualdata = load_dual() in + (set_lpvalue br (dualdata,fr)) + | _ -> br in + let _ = report (string_of_lptype br.lpvalue) in + br;; + + +(* control flow *) + +let ex0 brancher i brs = (flatten (map (brancher i) brs));; + +let ex brancher i brs = + let brs' = ex0 brancher i brs in +(* let _ = map set_lpvalue brs' in *) + select_notdone notdone (map solve_and_set_lp brs');; + +let top brancher i (br::rest) = (ex brancher i [br]) @ rest;; + +let bury (x::xs) = xs @ [x];; + +(* case of 3 blades: *) +let blade3() = + let br = mk_br 3 in + let br1 = ex branch_qu 2 (branch_qu 1 br) in + let br2 = ex branch_negqu 0 br1 in + let br3 = ex branch_qxd 2 br2 in + let br4 = ex branch_qxd 1 br3 in + br4;; + +(* case of 4 blades *) +let blade4() = + let cr = mk_br 4 in + let cr1 = ex branch_qu 3 (ex0 branch_qu 2 (branch_qu 1 cr)) in + let cr2 = bury (top branch_wt 3 cr1) in + let cr2' = top branch_y4 3 cr2 in + let cr3 = bury (top branch_wt 2 cr2') in + let cr4 = top branch_sblade 3 cr3 in + let cr5' = top branch_sblade 3 cr4 in + let cr5 = top branch_y4 2 cr5' in + let cr6 = top branch_sblade 3 cr5 in + let cr7 = bury(top branch_wt 1 cr6) in + let cr8 = top branch_sblade 2 cr7 in + let cr9 = top branch_sblade 2 cr8 in + let cr10' = top branch_sblade 2 cr9 in + let cr10 = top branch_y4 1 cr10' in + let cr11 = top branch_sblade 2 cr10 in + cr11;; + +(* three cases remain, all related by symmetry. 4 blades, 3 quarters, 1 4-cell with weight 0.5 *) + +let test_structure br = + let _ = (sort (<) br.sblade = [0;1;2;3]) or failwith "sblade" in + let _ = ((length br.qx = 1) && (br.qx = br.halfwt)) or failwith "weight" in + let _ = (length br.qu = 3) or failwith "qu" in + true;; + + +let execute() = + let b3 = blade3() in + let b3_info = if (List.length b3 = 0) then "blade 3 passes" else failwith "blade 3 fails in OXLZLEZ" in + let b4 = blade4() in + let t0 = nub (map test_structure (b4)) in + let b4_info = if (t0=[true]) then "blade 4 passes (ignoring cases with 4 blades, 3 quarters, 1 4-cell with wt 0.5)" + else failwith "blade 4 fails in OXLZLEZ" in + let s = join_lines [b3_info;b4_info] in + let _ = report s in + s;; + +end;; diff --git a/glpk/minorlp/tame_table.ml b/glpk/minorlp/tame_table.ml new file mode 100644 index 0000000..7d3b67a --- /dev/null +++ b/glpk/minorlp/tame_table.ml @@ -0,0 +1,189 @@ +(* ========================================================================== *) +(* FLYSPECK - GLPK *) +(* *) +(* Linear Programming, AMPL format (non-formal) *) +(* Chapter:Tame Hypermap *) +(* Lemma: KCBLRQC (Tame Table B) *) +(* Author: Thomas C. Hales *) +(* Date: 2010-06-14 *) +(* ========================================================================== *) + +(* + +The model considers nodes of type (p,q,0) and computes +the constants b(p,q). + +It also computes the constant a(5,0,1). + +*) + +flyspeck_needs "strictbuild.hl";; +flyspeck_needs "../glpk/glpk_link.ml";; +flyspeck_needs "../graph_generator/graph_control.hl";; + +module Tame_table = struct + + let squander_target = Graph_control.flyspeck_properties.Graph_control.squander_target;; + let table_weight_d = Graph_control.flyspeck_properties.Graph_control.table_weight_d;; + let table_weight_a = Graph_control.flyspeck_properties.Graph_control.table_weight_a;; + let table_weight_b = Graph_control.flyspeck_properties.Graph_control.table_weight_b;; + let node_card_max_at_exceptional_vertex = Graph_control.flyspeck_properties.Graph_control.node_card_max_at_exceptional_vertex;; + let fl x = float_of_int x /. 10000.0;; + +type lptype = Lp_unset + | Lp_infeasible + | Lp_value of float;; + +let string_of_lptype t = match t with + | Lp_infeasible -> "infeasible" + | Lp_unset -> "unset" + | Lp_value u -> Printf.sprintf "%3.3f" u;; + +let rec cart b c = match b with + [] -> [] + |b::bs -> (map (fun t -> (b,t)) c) @ cart bs c;; + + +open Str;; +open List;; +open Glpk_link;; + +let sprintf = Printf.sprintf;; + +let glpk_dir = flyspeck_dir ^ "/../glpk";; + +(* external files *) +let model = glpk_dir^ "/minorlp/tame_table.mod";; +let tmpfile = "/tmp/tame_table.dat";; +let dumpfile = "/tmp/tmp.out";; + +type node_type = + { + mutable lpvalue : lptype; + p : int; + q : int; + r : int; + };; + +(* the initial configuration always has a quarter at 0 *) +let mk_node p q r = + { + p = p; + q = q; + r = r; + lpvalue = Lp_unset + };; + +let string_of_node t = + Printf.sprintf "%d %d %d %s" t.p t.q t.r (string_of_lptype t.lpvalue);; + +let ampl_of_nt outs nt = + let pr = sprintf in + let j = join_lines [ + pr"param p := %d;" nt.p; + pr"param q := %d;" nt.q; + pr"param r := %d;\n" nt.r; + ] in + Printf.fprintf outs "%s" j;; + +let test() = + let nt = mk_node 3 3 0 in + display_ampl tmpfile ampl_of_nt nt;; + +(* running of branch in glpsol *) + +let set_lpvalue nt (f,r) = (* side effects *) + let _ = + if (List.length f > 0) then nt.lpvalue <- Lp_infeasible + else if (List.length r = 1) then nt.lpvalue <- Lp_value (float_of_string(hd r)) + else nt.lpvalue <- Lp_unset in + nt;; + +let init_lpvalue nt = + let _ = match nt.lpvalue with + | Lp_unset -> (set_lpvalue nt (solve_branch_f model dumpfile "tausum" ampl_of_nt nt)) + | _ -> nt in + let _ = report (string_of_node nt) in + nt;; + +(* display_ampl tmpfile ampl_of_nt (mk_node 5 0 0);; *) + +let fpqr ((p,q),r) = init_lpvalue (mk_node p q r);; + +let fpq (p,q) = fpqr((p,q),0);; + +(* solve_branch_f model dumpfile "tausum" ampl_of_nt (mk_node 3 4 0);; *) + +(* Each exception region contributes at least tame_table_d_5 *) + +let filter1 = + let target_ub = 1.542 in + let _ = target_ub > fl squander_target or failwith "bad target value" in + let tame_table_d_5 = 0.4818 in + let _ = tame_table_d_5 < fl (List.nth table_weight_d 5) or failwith "bad d5 value" in + filter (fun t -> match t.lpvalue with + Lp_infeasible -> false + | Lp_unset -> true + | Lp_value s -> (s +. float_of_int t.r *. tame_table_d_5 < target_ub));; + +let graph_control_unfound_b (t:node_type ) = match (t.lpvalue) with + | Lp_value u -> + (try ( + let eps = 1.0e-10 in (* allow roundoff error *) + let (_,_,v) = List.find (fun (a,b,_) -> (a=t.p && b = t.q)) table_weight_b in + u +. eps <= fl v + ) + with Not_found -> true) + | _ -> true + ;; + +let filter2 = filter graph_control_unfound_b;; + +(* The case (p,q,r) = (0,2,0) is rejected by the convexity hypothesis. *) +(* The case (p,q,r) = (5,0,0) is done with calculation 4652969746 *) + +let known_exceptions (t:node_type) = + not((t.p = 0 && t.q = 2 && t.r = 0) or (t.p = 5 && t.q = 0 && t.r = 0));; + +let filter3 = filter known_exceptions;; + +let tame_table_lp_data() = (map fpq (cart (0--10) (0--10)));; + +let tame_table_b_info() = + let n = filter3 (filter2 (filter1 (tame_table_lp_data()))) in + if (List.length n = 0) then "All b table values have been accounted for in informal lp tests (ignoring 0,2,0 and 5,0,0)" + else "Unaccounted for b values: \n" ^ join_lines (map string_of_node n);; + +(* If r >= 4, then the dihedral sum is greater than 2 Pi *) + +let pqrvalues = + let a = (cart (cart (0--6) (0--6)) (1--3)) in + filter (fun ((p,q),r) -> (p+q+r=6)) a;; + + +let badvalues_a (t:node_type) = match (t.lpvalue) with + | Lp_value u -> + (try ( + let eps = 1.0e-10 in (* allow roundoff error *) + let (_,v) = List.find (fun (a,_) -> (a=t.p && (6-a) = t.q + t.r)) table_weight_a in + u +. eps <= fl v + ) + with Not_found -> true) + | _ -> true + ;; + +let filter_a = filter badvalues_a;; + +let tame_table_a_info() = + let n = filter_a (filter1 (map fpqr pqrvalues )) in + if (List.length n = 0) then "All a table values have been accounted for in informal lp tests" + else "Unaccounted for a values: \n" ^ join_lines (map string_of_node n);; + +let execute() = + let s = join_lines [tame_table_b_info();tame_table_a_info()] in + let _ = report s in + s;; + + + +end;; diff --git a/glpk/sphere.ml b/glpk/sphere.ml new file mode 100644 index 0000000..173ef77 --- /dev/null +++ b/glpk/sphere.ml @@ -0,0 +1,76 @@ +(* code automatically generated from Parse_ineq.ocaml_code *) + +module Sphere_math = struct + +let sqrt = Pervasives.sqrt + +let pi = 4.0 *. atan(1.0);; +let sqrt2 = sqrt (2.) ;; + + +let sqrt8 = sqrt (8.) ;; + + +let delta_x (x1) (x2) (x3) (x4) (x5) (x6) = ((x1 *. (x4 *. ((-. x1) +. (x2 +. ((x3 -. x4) +. (x5 +. x6)))))) +. ((x2 *. (x5 *. ((x1 -. x2) +. (x3 +. ((x4 -. x5) +. x6))))) +. (((((x3 *. (x6 *. (x1 +. ((x2 -. x3) +. (x4 +. (x5 -. x6)))))) -. (x2 *. (x3 *. x4))) -. (x1 *. (x3 *. x5))) -. (x1 *. (x2 *. x6))) -. (x4 *. (x5 *. x6)))));; + + +let delta_y (y1) (y2) (y3) (y4) (y5) (y6) = delta_x ((y1 *. y1)) ((y2 *. y2)) ((y3 *. y3)) ((y4 *. y4)) ((y5 *. y5)) ((y6 *. y6)) ;; + + +let delta_x4 (x1) (x2) (x3) (x4) (x5) (x6) = ((((-. x2) *. x3) -. (x1 *. x4)) +. ((x2 *. x5) +. (((x3 *. x6) -. (x5 *. x6)) +. (x1 *. ((-. x1) +. (x2 +. ((x3 -. x4) +. (x5 +. x6))))))));; + + +let delta_x6 (x1) (x2) (x3) (x4) (x5) (x6) = ((((-. x1) *. x2) -. (x3 *. x6)) +. ((x1 *. x4) +. (((x2 *. x5) -. (x4 *. x5)) +. (x3 *. ((-. x3) +. (x1 +. ((x2 -. x6) +. (x4 +. x5))))))));; + + +let ups_x (x1) (x2) (x6) = (((((-. x1) *. x1) -. (x2 *. x2)) -. (x6 *. x6)) +. ((2. *. (x1 *. x6)) +. ((2. *. (x1 *. x2)) +. (2. *. (x2 *. x6)))));; + + +let eta_x (x1) (x2) (x3) = sqrt (((x1 *. (x2 *. x3)) /. ups_x (x1) (x2) (x3) )) ;; + + +let eta_y (y1) (y2) (y3) = eta_x ((y1 *. y1)) ((y2 *. y2)) ((y3 *. y3)) ;; + + +let dih_x (x1) (x2) (x3) (x4) (x5) (x6) = (( pi /. 2.) +. atan2 ((-. delta_x4 (x1) (x2) (x3) (x4) (x5) (x6) )) ( sqrt ((4. *. (x1 *. delta_x (x1) (x2) (x3) (x4) (x5) (x6) ))) ) );; + + +let dih_y (y1) (y2) (y3) (y4) (y5) (y6) = dih_x ((y1 *. y1)) ((y2 *. y2)) ((y3 *. y3)) ((y4 *. y4)) ((y5 *. y5)) ((y6 *. y6)) ;; + + +let dih2_y (y1) (y2) (y3) (y4) (y5) (y6) = dih_y (y2) (y1) (y3) (y5) (y4) (y6) ;; + + +let dih3_y (y1) (y2) (y3) (y4) (y5) (y6) = dih_y (y3) (y1) (y2) (y6) (y4) (y5) ;; + + +let sol_x (x1) (x2) (x3) (x4) (x5) (x6) = ( dih_x (x1) (x2) (x3) (x4) (x5) (x6) +. ( dih_x (x2) (x3) (x1) (x5) (x6) (x4) +. ( dih_x (x3) (x1) (x2) (x6) (x4) (x5) -. pi )));; + + +let sol_y (y1) (y2) (y3) (y4) (y5) (y6) = ( dih_y (y1) (y2) (y3) (y4) (y5) (y6) +. ( dih_y (y2) (y3) (y1) (y5) (y6) (y4) +. ( dih_y (y3) (y1) (y2) (y6) (y4) (y5) -. pi )));; + + +let interp (x1) (y1) (x2) (y2) (x) = (y1 +. ((x -. x1) *. ((y2 -. y1) /. (x2 -. x1))));; + + +let ly (y) = interp (2.) (1.) (2.52) (0.) (y) ;; + + +let const1 = ( sol_y (2.) (2.) (2.) (2.) (2.) (2.) /. pi );; + + +let rho (y) = (1. +. ( const1 -. ( const1 *. ly (y) )));; + + +let rhazim (y1) (y2) (y3) (y4) (y5) (y6) = ( rho (y1) *. dih_y (y1) (y2) (y3) (y4) (y5) (y6) );; + + +let lnazim (y1) (y2) (y3) (y4) (y5) (y6) = ( ly (y1) *. dih_y (y1) (y2) (y3) (y4) (y5) (y6) );; + + +let taum (y1) (y2) (y3) (y4) (y5) (y6) = (( sol_y (y1) (y2) (y3) (y4) (y5) (y6) *. (1. +. const1 )) -. ( const1 *. ( lnazim (y1) (y2) (y3) (y4) (y5) (y6) +. ( lnazim (y2) (y3) (y1) (y5) (y6) (y4) +. lnazim (y3) (y1) (y2) (y6) (y4) (y5) ))));; + + +let arclength (a) (b) (c) = (( pi /. 2.) +. atan2 ((((c *. c) -. (a *. a)) -. (b *. b))) ( sqrt ( ups_x ((a *. a)) ((b *. b)) ((c *. c)) ) ) );; + +end;; diff --git a/glpk/tame_archive/build_lp.hl b/glpk/tame_archive/build_lp.hl new file mode 100644 index 0000000..c6dfc9e --- /dev/null +++ b/glpk/tame_archive/build_lp.hl @@ -0,0 +1,120 @@ +(* ========================================================================== *) +(* FLYSPECK - CODE FORMALIZATION *) +(* *) +(* Program: Linear Programs *) +(* Author: Thomas C. Hales *) +(* Date: 2010-08-01 *) +(* ========================================================================== *) + + +(* +Local build file for linear programs. +*) + +flyspeck_needs "nonlinear/ineq.hl";; +flyspeck_needs "nonlinear/parse_ineq.hl";; +flyspeck_needs "../glpk/glpk_link.ml";; +flyspeck_needs "../glpk/tame_archive/lpproc.ml";; +flyspeck_needs "../glpk/sphere.ml";; +flyspeck_needs "../glpk/tame_archive/hard_lp.ml";; +flyspeck_needs "../glpk/tame_archive/scaffolding.hl";; + +module Build_lp = struct + +let test_nonlinear_lp() = let lpineq = Ineq.getfield Lp in + Parse_ineq.execute_cfsqp_list lpineq;; + +let rebuild_body_mod() = + let _ = Parse_ineq.output_filestring "/tmp/body.mod" (Parse_ineq.lpstring()) in + let _ = Sys.command("diff /tmp/body.mod "^flyspeck_dir^"/../glpk/tame_archive/body.mod") in + "--end of diff-- To install, move /tmp/body.mod to glpk/tame_archive/body.mod";; + +(* +test_nonlinear_lp();; +rebuild_body_mod();; +*) + + +let execute() = + let _ = Sys.command("date") in + let startdate = process_to_string "date" in + let lpdata = Lpproc.execute() in + let (tame_bb,feasible_bb,hard_bb,easy_bb, + remaining_easy_bb) = lpdata in + let output = + if (remaining_easy_bb=[]) then (([],[],[],[],[]),Hard_lp.execute(),"finished output") + else (lpdata,[[]],"easy cases remain- aborted") in + let _ = Sys.command("date") in + let enddate = process_to_string "date" in + (startdate,!Glpk_link.solve_counter,output,enddate);; + +end;; + + +(* LOG OF RUNS: + + +run_all();; +!Glpk_link.solve_counter;; + +Run of Hard_lp.execute();; +started at Thu Aug 5 16:58:26 ICT 2010 +finished Aug 5 23:20. +STACK 1 15413 (so about 30K linear programs) +val it : Lpproc.branchnbound list list = + [[]; []; []; []; []; []; []; []; []; []; []; []] + +retested Sep 22 on Thackmac, identical results, svn 1978. + +retested Oct 22, 2010 on Malt, 2026, some weakened ineqs. + + +All retested svn 2402 on Malt +May 10, 2011, eliminated ineq 7676202716 from body.mod. +Still passes. So this inequality can be eliminated entirely! +STACK 1 16604 +val it : Lpproc.branchnbound list list = + [[]; []; []; []; []; []; []; []; []; []; []; []] + + +May 18, svn 2411 on malt, +experiment 0.696 -> 0.616, and moved 3 more cases to hardid. + +let run_output = run_all();; + +STACK 1 18925 +val hard_out : Lpproc.branchnbound list list = + [[]; []; []; []; []; []; []; []; []; []; []; []; []; []; []] +I also ran the new hex cases (at least those with a pent), and they all pass easily. + + +svn 2412 on malt, May 22, 2011, +tameTableD[6,0]->0.712, tameTableD[4,1]->0.616. +This only affects the hexagon cases. Graph generator for hexagons was rerun. + +Lpproc.archiveraw := (Filename.concat archive_dir "string_hex_may2011.txt");; +!Lpproc.archiveraw;; +let lpdata = Lpproc.execute();; +let (tame_bb,feasible_bb,hard_bb,easy_bb,remaining_easy_bb) = lpdata;; +(no hexagons in the hardid list) + +April 14, 2012. Preparing new run. Seems to be running fine on Thackmac. + + +Quad Inequalities "6944699408 a" and "7043724150 a" have been removed. +Everything still goes through. +val build_lp_out : + string * int * + ((Lpproc.branchnbound list * Lpproc.branchnbound list * + Lpproc.branchnbound list * Lpproc.branchnbound list * + Lpproc.branchnbound list) * + Lpproc.branchnbound list list * string) * + string = + ("Mon Jul 29 14:50:39 EDT 2013\n", 62748, + (([], [], [], [], []), + [[]; []; []; []; []; []; []; []; []; []; []; []; []; []; []], + "finished output"), + "Mon Jul 29 20:31:03 EDT 2013\n") + +*) + diff --git a/glpk/tame_archive/hard_lp.ml b/glpk/tame_archive/hard_lp.ml new file mode 100644 index 0000000..d5aae93 --- /dev/null +++ b/glpk/tame_archive/hard_lp.ml @@ -0,0 +1,378 @@ +(* ========================================================================== *) +(* FLYSPECK - CODE FORMALIZATION *) +(* *) +(* Program: Linear Programs *) +(* Author: Thomas C. Hales *) +(* Date: 2010-08-01 *) +(* ========================================================================== *) + + +(* +The purpose of this file is to treat the 12 hard tame hypermaps that +are not treated in lpproc.ml. +*) + +module Hard_lp = struct + +(* code for the hard cases... *) + +let hardidref = ref Lpproc.hardid;; + +open Str;; +open List;; +open Glpk_link;; +open Lpproc;; + +let sqrt = Pervasives.sqrt;; +let dih_y = Sphere_math.dih_y;; + +(* +The purpose of this first section is to build up tables of what the +LP solution gives as the dihedral angles +versus the floating point calculation of dihedral angles. + +The idea is that branching should occur where the discrepancy is the biggest. +*) + +(* build up hashtables of all the variables assignments from the glpk_outfile *) + +let new_tables () = (Hashtbl.create 13,Hashtbl.create 70,Hashtbl.create 70);; + +let tables bb = match bb.diagnostic with + Hash_tables (a,b,c) -> (a,b,c);; + +let ynhash bb= (fun (a,_,_) -> a) (tables bb);; +let yehash bb = (fun (_,a,_) -> a) (tables bb);; +let azimhash bb = (fun (_,_,a) -> a) (tables bb);; + +let yn bb i = Hashtbl.find (ynhash bb) i;; +let ye bb (i,j) = Hashtbl.find (yehash bb) (i,j);; +let azim bb (i,j) = Hashtbl.find (azimhash bb) (i,j);; + +(* +There is state involved here. This code is rather fragile. +The glpk_outfile gets overwritten the next time solve is called. +So we want to generate the hash tables right after solve is called. +*) + +(* this renews the glpk_outfile *) +let resolve bb = solve_branch_verbose (fun t->t) bb;; + +let init_hash_verified_glpk_outfile glpk_outfile bb = + let _ = (bb.diagnostic <- Hash_tables (new_tables())) in + let _ = Hashtbl.clear (ynhash bb) in + let _ = Hashtbl.clear (yehash bb) in + let _ = Hashtbl.clear (azimhash bb) in + let com = sprintf "cat %s | grep -v ':' | grep '=' | tr '[\[\]=,]' ' ' | sed 's/.val//' | sed 's/\( [0-9]*\)$/\1.0/g'" glpk_outfile in + let is = int_of_string in + let fs = float_of_string in + let (ic,oc) = Unix.open_process(com) in + let _ = close_out oc in + let inp = load_and_close_channel false ic in + let _ = Unix.close_process(ic,oc) in + let split_sp= Str.split (regexp " +") in + let inpa = map split_sp inp in + let ynproc [a;b;c] = Hashtbl.add (ynhash bb) (is b) (fs c) in + let yeproc [a;b;c;d] = Hashtbl.add (yehash bb) ( (is b), (is c)) (fs d) in + let azimproc [a;b;c;d] = Hashtbl.add (azimhash bb) ( (is b), (is c)) (fs d) in + let proc1 xs = + begin + let a = hd xs in + if (a = "yn") then ynproc xs + else if (a = "ye") then yeproc xs + else if (a = "azim") then azimproc xs + end in + let _ = try (map proc1 inpa) with Failure _ -> failwith "init_has_v" in ();; + +let init_hash bb = + match bb.diagnostic with + | File (glpk_outfile,dig) -> if not(dig = Digest.file glpk_outfile) + then (bb.diagnostic <- No_data; failwith "init_hash:stale") + else init_hash_verified_glpk_outfile glpk_outfile bb + | _ -> ();; + +(* look at edge lengths and azimuth angles of a triangle *) +let int_of_face xs bb = wheremod (faces bb) xs;; + +(* get_azim_table dih_y [2;4;3] bb;; *) + +let get_azim_dart_diff f xs bb = + let [y1;y2;y3] = map (yn bb) xs in + let [y6;y4;y5] = map (fun i -> (ye bb (i,int_of_face xs bb))) xs in + let a1 = azim bb (hd xs, int_of_face xs bb) in + let b1 = f y1 y2 y3 y4 y5 y6 in + abs_float (a1 -. b1);; +(* get_azim_dart_diff dih_y [2;4;3] bb;; *) + +(* first entry is the triangle with the biggest azim error. *) +let sorted_azim_diff p bb = + let ys = p bb in + let u = map (fun t-> (get_azim_dart_diff dih_y t bb ,t)) ys in + let v = List.sort (fun a b -> - compare (fst a) (fst b)) u in + v;; +(* sorted_azim_diff darts_of_std_tri bb;; *) + +(* if we always do branching on the worst triangle, we quickly run out of + possibilities because we can get stuck on a single triangle. We need a + heuristic that moves emphasis away from triangles where extensive branching + has already been done. Here is my heuristic to do so. Many different + strategies are possible. This works sufficiently well in practice. *) + +let heuristic_weight d bb = + if not(mem d (rotation (bb.std3_small @ bb.std3_big))) then 1.0 else + if not(subset d (bb.node_200_218 @ bb.node_218_252)) then 0.7 else + if not(subset d (bb.node_200_218 @ bb.node_218_236 @ bb.node_236_252)) then 0.49 else + if not(subset (rotation [d]) (bb.d_edge_200_225 @ bb.d_edge_225_252 @ map (rotateL 1) bb.apex_flat)) then 0.3 + else 0.0;; + +(* first entry is the triangle with the biggest azim weighted error. *) + +let sorted_azim_weighted_diff p bb = + let ys = p bb in + let u = map (fun t-> ((heuristic_weight t bb *. get_azim_dart_diff dih_y t bb) ,t)) ys in + let v = List.sort (fun a b -> - compare (fst a) (fst b)) u in + v;; + + +(* ------------------------ *) +(* HINTS *) + +(* add_hints is called right after the LP is solved and the lpvalue set. + The glpk_outfile has been initialized. *) + +let darts_of_std_tri bb = + rotation(filter (fun t -> length t = 3) bb.std_faces_not_super);; + +let darts_of_std_tri_and_flats bb = + rotation(filter (fun t -> length t = 3) (bb.std_faces_not_super @ bb.apex_flat));; + +let highish bb = subtract bb.node_218_252 (bb.node_218_236 @ bb.node_236_252);; + +let face_of_dart fc bb = + let xss = map triples (faces bb) in + nth (find (fun t -> mem fc t) xss) 0;; + +let add_hints_force bb = + try( + let _ = init_hash bb in + let dart = snd(hd(sorted_azim_weighted_diff darts_of_std_tri bb)) in + let f = face_of_dart dart bb in + if not(mem f (bb.std3_big @ bb.std3_small)) then bb.hints <- [Triangle_split f] else + let f1 = subtract f (bb.node_200_218 @ bb.node_218_252) in + if not(f1 = []) then bb.hints <- [High_low (hd f1)] else + let f2 = intersect (highish bb) f in + if not(f2 = []) then bb.hints <- [High_low (hd f2)] else + let d1 = subtract (rotation [dart]) (bb.d_edge_200_225 @ bb.d_edge_225_252) in + if not (d1 = []) then bb.hints <- [Edge_split (hd d1)] else () + ) with | Failure s -> failwith (s^"in add_hints") + | Not_found -> failwith "Not_found add_hints_force";; + + +let add_hints_force_include_flat bb = + try( + let _ = init_hash bb in + let dart = snd(hd(sorted_azim_weighted_diff darts_of_std_tri_and_flats bb)) in + let f = face_of_dart dart bb in + if (mem f (rotation bb.std_faces_not_super)) then add_hints_force bb else + let f1 = subtract f (bb.node_200_218 @ bb.node_218_252) in + if not(f1 = []) then bb.hints <- [High_low (hd f1)] else + let f2 = intersect (highish bb) f in + if not(f2 = []) then bb.hints <- [High_low (hd f2)] else + add_hints_force bb + ) with | Failure s -> failwith ( s^" in add_hints_force_include_flat") + | Not_found -> failwith ( " Not_found in add_hints_force_include_flat");; + + +let add_hints_include_flat bb = + if not(is_feas bb) then () else + if not(bb.hints = []) then () else + add_hints_force_include_flat bb;; + +(* ------------------------ *) + +let is_none bb = match bb.lpvalue with (* for debugging *) + | Lp_value _ -> false + | _ -> true;; + + +let calc_max bbs = fold_right + (fun bb x -> match bb.lpvalue with + |Lp_value y -> max x y + |_ -> x) + bbs 0.0 ;; + +let find_max bbs = + let r = Lp_value (calc_max bbs) in + find (fun bb -> r = bb.lpvalue) bbs;; + +let findid s = find (fun t -> s = t.hypermap_id);; + +let findid_list s = filter (fun t -> s = t.hypermap_id);; + + +(* +We are proving the bound L(V) <= 12. When there are 13 nodes, +this is automatic when the nodes excess heights (|v|-2) add up to at least 0.52. +Fail if the bb already satisfies L(V) <= 12. +*) + +let node_list bb = 0 -- (card_node bb - 1);; + +let set_node_numerics bb = + if not(card_node bb = 13) then bb else + let n_high = length bb.node_236_252 in + let n_mid = length bb.node_218_236 in + let n_highish = length (highish bb) in + if (n_high =0 ) & (n_mid +n_highish < 2) then bb else + let _ = (n_mid * 18 + n_highish * 18 + n_high *36 <= 52) or failwith "set_node_numerics" in + let node_new_low = subtract (node_list bb) (unions [bb.node_200_218 ;bb.node_218_236; bb.node_236_252;bb.node_218_252]) in + let vfields_low = map (fun t -> ("200_218",t)) node_new_low in + let vfields_mid = map(fun t->("218_236",t)) (highish bb) in + let vfields = vfields_low @ vfields_mid in + if vfields = [] then bb else modify_bb bb false [] vfields;; + +(* +let t1 = modify_bb (pent_bb) false [] ["236_252",5];; +set_node_numerics t1;; +let t1 = modify_bb (pent_bb) false [] [("236_252",5);("218_236",3)];; +can set_node_numerics t1;; +let t1 = modify_bb (pent_bb) false [] [("218_236",5);("218_236",3)];; +set_node_numerics t1;; +let t1 = modify_bb (pent_bb) false [] [("218_236",5);("218_252",3)];; +set_node_numerics t1;; +*) + +let opposite_edge [i;j;k] bb = + let f = find (fun t -> (nth t 0 = j) & (nth t 1 = i)) (rotation (faces bb)) in + [j;i;nth f 2];; + +(* +if a face is small the three edges lie in the range [2,2.25]. +if an edge is in the range (2.25,2.52], then the face is big. +A directed edge is in the same category as the oppositely directed edge. +*) + +let set_face_numerics bb = + let opp xs = nub (xs @ map (C opposite_edge bb) xs) in + let edge_of_small = opp (rotation bb.std3_small) in + let short_edge = opp bb.d_edge_200_225 in + let long_edge = opp bb.d_edge_225_252 in + let _ = (intersect edge_of_small long_edge = []) or failwith "set_face_numerics" in + let shortadds = subtract (edge_of_small @ short_edge) bb.d_edge_200_225 in + let shortfields = (map (fun t-> ("e_200_225",t)) shortadds) in + let longadds = subtract long_edge bb.d_edge_225_252 in + let longfields = (map (fun t-> ("e_225_252",t)) longadds) in + let r = filter (fun t -> mem t (std_faces bb) & (length t = 3) ) + (nub (map (C face_of_dart bb) long_edge)) in + let _ = (intersect (rotation bb.std3_small) r =[]) or failwith "set_face_numerics" in + let bigfields = map (fun t -> ("bt",t)) (subtract r bb.std3_big) in + let fields = shortfields @ longfields @ bigfields in + if fields=[] then bb else modify_bb bb false fields [];; + + +(* +let t1 = modify_bb pent_bb false [("st",[9;6;10]);("e_225_252",[7;8;12])] [];; +set_face_numerics t1;; +let t1 = modify_bb pent_bb false ["st",[8;2;1]] [];; +set_face_numerics t1;; +let t1 = modify_bb pent_bb false ["e_225_252",[7;12;11]] [];; +set_face_numerics t1;; +*) + +(* +Hints are given as a list. However, I never ended up using more +than a single hint at a time. It could be restructured as +Some _ | None. +*) + +(* ------------------------ *) +(* switch and selection functions *) + +let clear_hint bb = + if (bb.hints = []) then () else (bb.hints <- tl bb.hints);; + +let switch_std3 d bb = + let c = face_of_dart d bb in + [modify_bb bb false ["bt",c] [];modify_bb bb false ["st",c] []];; + +let switch_edge d bb = + [modify_bb bb false ["e_225_252",d] [];modify_bb bb false ["e_200_225",d] []];; + +let switch_node bb i = + if (mem i (highish bb)) then + [modify_bb bb false [] ["218_236",i];modify_bb bb false [] ["236_252",i]] else + let settable = subtract (node_list bb ) (bb.node_200_218 @ bb.node_218_236 @ bb.node_236_252) in + if not(mem i settable) then failwith "switch_node" else + [modify_bb bb false [] ["218_252",i];modify_bb bb false [] ["200_218",i]];; + +let follow_hint bb = + let _ =assert(not(bb.hints = [])) in + let hint = hd (bb.hints) in +(* let _ = clear_hint bb in *) + let sbb = match hint with + | Triangle_split d -> switch_std3 d bb + | High_low i -> switch_node bb i + | Edge_split d -> switch_edge d bb in + let _ = map clear_hint sbb in sbb;; + +let filter_feas_hint_include_flat bbs = filter_feas_f add_hints_include_flat bbs;; + +let switch_hint bb = + if (length bb.std_faces_not_super > 0) & + (length (hd bb.std_faces_not_super) > 3) then switch_face bb + else if not(bb.hints = []) then follow_hint bb else [bb];; + +(* For debugging purposes, when we interrupt a calculation *) + +let onepass_backup = ref [];; + +let sortbb bbs = + let eval bb = (match bb.lpvalue with Lp_value r -> r | _ -> 0.0) in + let v = List.sort (fun a b -> - compare (eval a) (eval b)) bbs in + v;; + + + +(* One iteration of the main loop *) + +let onepass_hint_include_flat = function + [] -> [] + | bb::bbss as bbs -> + let _ = onepass_backup := bbs in + let brs = switch_hint bb in + let brs1 = map set_face_numerics brs in + let brs2 = map set_node_numerics brs1 in + let _ = echo bbs in + sortbb ((filter_feas_hint_include_flat brs2) @ bbss);; + + +(* The main loop *) + +let rec allpass_hint_include_flat count bbs = + if count <= 0 then bbs else allpass_hint_include_flat (count - 1) + (onepass_hint_include_flat bbs);; + +let hard_string_rep() = + List.find_all (fun s -> mem (fst (Glpk_link.convert_to_list s)) !hardidref) + (Glpk_link.strip_archive (!Lpproc.archiveraw));; + +let resolve_with_hints_include_flat t = + let u = resolve t in + let _ = add_hints_force_include_flat u in + u;; + +let hard_bb() = + let r = map mk_bb (hard_string_rep()) in + map resolve_with_hints_include_flat r;; + +let hard i = List.nth (hard_bb()) i;; + +(* if successful, all lists will be empty. This takes several hours + to run on my laptop. *) + +let execute() = + let _ = Lpproc.make_model() in + let _ = resetc() in + map (fun t-> allpass_hint_include_flat 20000 [t]) (hard_bb());; + +end;; diff --git a/glpk/tame_archive/lpproc.ml b/glpk/tame_archive/lpproc.ml new file mode 100644 index 0000000..fbf5f4f --- /dev/null +++ b/glpk/tame_archive/lpproc.ml @@ -0,0 +1,477 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Lemma: Easy Linear Programs *) +(* Chapter: Tame Hypermap *) +(* Author: Thomas C. Hales *) +(* Date: 2009-06-25 *) +(* ========================================================================== *) + +(* + +This file treats all but a few "hard" cases (hard_bb). + +needs new mktop on platforms that do not support dynamic loading of Str. + +ocamlmktop unix.cma nums.cma str.cma -o ocampl +./ocampl + +glpk needs to be installed, and glpsol needs to be found in the path. + +Execution instructions. + +1- Download tame_archive_svn1830.txt from + http://weyl.math.pitt.edu/hanoi2009/Kepler/Kepler. + and save it as /tmp/tame_graph.txt + + (* Update: 2011-5-9, This has been added to the project as tame_archive/string_archive.txt *) + +2- make body.mod (using Parse_ineq.lpstring) if it doesn't exist already + and place it in the directory glpk/tame_archive/ + + (* Update: 2012-4-8, This is part of the svn repository now. It doesn't need to be regenerated. *) + +3- Load this module and execute the following command. + +let (tame_bb,feasible_bb,hard_bb,easy_bb,remaining_easy_bb) = Lpproc.execute();; + +*) + +#load "str.cma";; + +let flyspeck_dir = + (try Sys.getenv "FLYSPECK_DIR" with Not_found -> Sys.getcwd());; + +let project_root_dir = (Filename.concat (flyspeck_dir) Filename.parent_dir_name);; + +let glpk_dir = Filename.concat project_root_dir "glpk";; + +let archive_dir = Filename.concat project_root_dir "graph_generator/output";; + +let tame_dir = Filename.concat glpk_dir "tame_archive";; + +needs (Filename.concat glpk_dir "glpk_link.ml");; + +module Lpproc = struct + +open Glpk_link;; +open List;; + + +(* external files. + + The archiveraw file can be downloaded from + http://weyl.math.pitt.edu/hanoi2009/Kepler/Kepler (Archive of Tame Graphs). + + body.mod is automatically generated by Parse_ineq.lpstring *) + +(* let archiveraw = ref "/tmp/tame_graph.txt";; (* read only *) *) + +let archiveraw = ref (Filename.concat archive_dir "string_archive.txt");; + +let modelbody = ref (Filename.concat tame_dir "body.mod");; + +let model = Filename.concat tame_dir "graph_all.mod";; + +(* +let ampl_datafile = Filename.temp_file "ampl_datafile_" ".dat";; (* only used for debugging purposes *) +*) + +let glpk_outfile = Filename.temp_file "glpk_outfile_" ".out";; + +let make_model() = + (Sys.chdir(tame_dir); +Sys.command("cp head.mod "^model^"; cat "^(!modelbody)^" >> "^ + model^"; cat tail.mod >> "^model));; + +(* conversion to list. e.g. convert_to_ordered_list pentstring *) + +(* + The order in which the faces occur is the order of branch n bound. + The order affects the effectiveness of the branch and bound. + My heuristic is to branch on hexagons, then quads, then pents, then tris. + Within faces of a given size, look for nodes that appear frequently. +*) +let order_list (h,xs) = + let fl = flatten xs in + let count k = length (filter ((=) k) fl) in + let mc rs = maxlist0 (map count rs) in + let sortfn a b = compare (mc b) (mc a) in + let r k = filter (fun x -> length x = k) xs in + let f k = sort sortfn (r k) in + (h,f 6 @ f 4 @ f 5 @ f 3);; + +let convert_to_ordered_list s = order_list (convert_to_list s);; + +type hint = Triangle_split of int list + | High_low of int + | Edge_split of int list;; + +type init = No_data + | File of string*Digest.t + | Hash_tables of (((int,float) Hashtbl.t) * (((int*int),float) Hashtbl.t) * (((int*int),float) Hashtbl.t));; + +(* change 4/2012 to make compatible with latest version of GLPK ( >= 4.47). + New versions abort when problem is infeasible, rather than printing value 0. +*) + +type lptype = Lp_unset + | Lp_infeasible + | Lp_value of float;; + +(* type for holding the parameters for a linear program. + Many of the parameters are not needed for the easy cases that are treated + in this module. They will only be needed for the hard cases (hardid). *) + +(* + Fields for the hard cases: hints, diagnostic, node and edge lists +*) + +type branchnbound = + { + hypermap_id : string; + mutable lpvalue : lptype; + mutable hints : hint list; (* hints about branching *) + mutable diagnostic : init; + string_rep : string; + (* std_faces is the disjoint union of std_faces_not_super, std56_flat_free, std4_diag3 *) + std_faces_not_super: int list list; + std56_flat_free : int list list; + std4_diag3 : int list list; + std3_big : int list list; + std3_small : int list list; + (* special dart appears first in next ones *) + apex_sup_flat : int list list; + apex_flat : int list list; + apex_A : int list list; + apex5 : int list list; + apex4 : int list list; + (* edge lists *) + d_edge_225_252 : int list list; + d_edge_200_225 : int list list; + (* node lists *) + node_218_252 : int list; + node_236_252 : int list; + node_218_236 : int list; + node_200_218 : int list; + };; + + + +let mk_bb s = + let (h,face1) = convert_to_ordered_list s in + {hypermap_id= h; + lpvalue = Lp_unset; + diagnostic = No_data; + hints = []; + string_rep=s; + std_faces_not_super = face1; + std3_big=[]; + std3_small=[]; + std4_diag3=[]; + std56_flat_free=[]; + + apex_flat=[]; + apex_sup_flat=[]; + apex_A=[]; + apex4=[]; + apex5=[]; + + d_edge_225_252=[]; + d_edge_200_225=[]; + + node_218_252=[]; + node_236_252=[]; + node_218_236=[]; + node_200_218=[]; + };; + +let pent_bb = mk_bb pentstring;; + +(* conversion to branchnbound. e.g. mk_bb pentstring *) + +let modify_bb bb drop1std fields vfields = + let add key xs t = nub ((get_values key xs) @ t) in + let jump_queue key xs vs = + let ys = get_values key xs in + let e = rotation ys in + nub(ys @ (filter (fun t -> not(mem t e)) vs)) in + let std = bb.std_faces_not_super in + let jump_queue_std = jump_queue "jq" fields std in +{ +hypermap_id = bb.hypermap_id; +lpvalue = Lp_unset; +diagnostic = No_data; +hints = bb.hints; +string_rep = bb.string_rep; + +std_faces_not_super = if drop1std then tl std else jump_queue_std; +std3_big = add "bt" fields bb.std3_big; +std3_small = add "st" fields bb.std3_small; +std56_flat_free = add "flat_free" fields bb.std56_flat_free; +std4_diag3 = add "diag3" fields bb.std4_diag3; + +apex_flat = add "ff" fields bb.apex_flat; +apex_sup_flat = add "sf" fields bb.apex_sup_flat; +apex_A = add "af" fields bb.apex_A; +apex4 = add "apex4" fields bb.apex4; +apex5 = add "apex5" fields bb.apex5; + +d_edge_225_252 = add "e_225_252" fields bb.d_edge_225_252; +d_edge_200_225 = add "e_200_225" fields bb.d_edge_200_225; + +node_218_252 = add "218_252" vfields bb.node_218_252; +node_236_252 = add "236_252" vfields bb.node_236_252; +node_218_236 = add "218_236" vfields bb.node_218_236; +node_200_218 = add "200_218" vfields bb.node_200_218; +};; + +(* +Example: move [8;1;6;9] from std to std56_flat_free. + +modify_bb pent_bb true ["flat_free",[8;1;6;9];"ff",[9;10;11]] ["200_218",8;"218_252",3;"200_218",7];; +pent_bb;; +modify_bb pent_bb false ["jq",[0;3;5;4];"jq",[10;6;4]] [];; +*) + +(* functions on branch n bound *) + +let std_faces bb = bb.std_faces_not_super @ bb.std56_flat_free @ bb.std4_diag3;; +(* @ bb.std3_big @ bb.std3_small;; *) + +let std_tri_prebranch bb = filter + (let r = rotation (bb.std3_big @ bb.std3_small) in + fun t -> not(mem t r) && (length t = 3)) bb.std_faces_not_super;; + +(* should sort faces, so that numbering doesn't change so much when branching *) + +let faces bb = (std_faces bb) @ bb.apex_sup_flat @ bb.apex_flat @ + bb.apex_A @ bb.apex5 @ bb.apex4;; + +let triples w = + let r j = nth w (j mod length w) in + let triple i = + [r i; r (i+1); r(i+2)] in + map triple (up (length w));; + +let card_node bb = + 1+ maxlist0 (flatten (faces bb));; + +let card_face bb = length(faces bb);; + +let std_face_of_size bb r= + let f = std_faces bb in + let z = enumerate f in + fst(split (filter (function _,y -> length y=r) z));; + +let wheretriplemod xs = + let nth = List.nth in + let t3 = (fun t -> [nth t 0;nth t 1;nth t 2]) in + let ys = map t3 (rotation xs) in + fun x -> + try ( + whereis (t3 x) ys) mod (length xs) + with Not_found -> failwith "wheretriplemod";; + +(* generate ampl data string of branch n bound *) + +let ampl_of_bb outs bb = + let fs = faces bb in + let where3 = wheremod fs in + let number = map where3 in + let list_of = unsplit " " string_of_int in + let mk_faces xs = list_of (number xs) in + let e_dart_raw = + map triples fs in + let e_dart = + let edata_row (i,x) = (sprintf "(*,*,*,%d) " i)^(unsplit ", " list_of x) in + unsplit "\n" edata_row (enumerate e_dart_raw) in + let mk_dart xs = sprintf "%d %d" (hd xs) (wheretriplemod fs xs) in + let mk_darts xs = (unsplit ", " mk_dart xs) in + let p = sprintf in + let j = join_lines [ + p"param card_node := %d;" (card_node bb) ; + p"param hypermap_id := %s;" bb.hypermap_id ; + p"param card_face := %d;\n" (card_face bb); + p"set std3 := %s;" (list_of (std_face_of_size bb 3)) ; + p"set std4 := %s;" (list_of (std_face_of_size bb 4) ); + p"set std5 := %s;" (list_of (std_face_of_size bb 5)) ; + p"set std6 := %s;\n" (list_of (std_face_of_size bb 6)); + p"set e_dart := \n%s;\n" (e_dart); + p"set std56_flat_free := %s;" (mk_faces bb.std56_flat_free); + p"set std4_diag3 := %s;" (mk_faces bb.std4_diag3); + p"set apex_sup_flat := %s;" (mk_darts bb.apex_sup_flat); + p"set apex_flat := %s;" (mk_darts bb.apex_flat); + p"set apex_A := %s;" (mk_darts bb.apex_A); + p"set apex5 := %s;" (mk_darts bb.apex5); + p"set apex4 := %s;" (mk_darts bb.apex4); + p"set d_edge_225_252 := %s;" (mk_darts bb.d_edge_225_252); + p"set d_edge_200_225 := %s;" (mk_darts bb.d_edge_200_225); + p"set std3_big := %s;" (mk_faces bb.std3_big); + p"set std3_small := %s;" (mk_faces bb.std3_small); + p"set node_218_252 := %s;" (list_of bb.node_218_252); + p"set node_236_252 := %s;" (list_of bb.node_236_252); + p"set node_218_236 := %s;" (list_of bb.node_218_236); + p"set node_200_218 := %s;" (list_of bb.node_200_218)] in + Printf.fprintf outs "%s" j;; + +(* running of branch in glpsol *) + +let solve_branch_verbose addhints bb = + let set_some bb r = (* side effects *) + if (length r = 1) then bb.lpvalue <- Lp_value (float_of_string(hd r)) else () in + let (f,inp) = solve_branch_f model glpk_outfile "lnsum" ampl_of_bb bb in + let _ = if (List.length f =0) then (set_some bb inp) else bb.lpvalue <- Lp_infeasible in + let _ = bb.diagnostic <- File (glpk_outfile,Digest.file glpk_outfile) in + let _ = addhints bb in (* hints for control flow *) + let r = match bb.lpvalue with + | Lp_unset -> "not set" + | Lp_infeasible -> "infeasible" + | Lp_value r -> sprintf "%3.3f" r in + let _ = Sys.command(sprintf "echo %s: %s\n" bb.hypermap_id r) in + bb;; + +let solve_f f bb = match bb.lpvalue with + | Lp_unset -> solve_branch_verbose f bb + | Lp_value _ -> bb + | Lp_infeasible -> bb;; + +let solve bb = solve_f (fun t -> t) bb;; + +(* filtering output *) + +let is_feas bb = + let feasible r = (r > 11.9999) in (* relax a bit from 12.0 *) + match bb.lpvalue with + | Lp_unset -> failwith "unexpected unset LP" + | Lp_infeasible -> false + | Lp_value r -> feasible r;; + +let filter_feas_f f bbs = + filter is_feas (map (solve_f f) bbs);; + +let filter_feas bbs = filter_feas_f (fun t->t) bbs;; + +(* +branching on face data: +switch_face does all the branching on the leading std face +*) + +let split_flatq xs i = (* {y1,y3} is the new diagonal *) + match rotateL i xs with + | y1::y2::y3::ys -> ([y2;y3;y1],rotateR 1 (y1 :: y3 :: ys)) + | _ -> failwith "split_flatq match";; + +let asplit_pent xs i = match rotateL i xs with +(* y2,y4 darts of flat; y3 is the point of the A, {y1,y3}, {y3,y5} diags *) + | y1::y2::y3::y4::[y5] -> ([y2;y3;y1],[y3;y5;y1],[y4;y5;y3]) + | _ -> failwith "asplit_pent match error";; + +let switch3 bb = match std_tri_prebranch bb with + | [] -> failwith ("switch3 empty " ^ bb.hypermap_id) + | fc::_ -> [modify_bb bb false ["bt",fc] [];modify_bb bb false ["st",fc] []];; + +let switch4 bb = match bb.std_faces_not_super with + | [] -> failwith ("switch4 empty" ^ bb.hypermap_id) + | fc::_ -> + let mo s (a,b) = modify_bb bb true [s,a;s,b] [] in + let f s i = mo s (split_flatq fc i) in + let g s = modify_bb bb true [s,fc] [] in + [f "ff" 0;f "ff" 1; f "sf" 0; f "sf" 1;g "diag3"];; + +let switch5 bb = match bb.std_faces_not_super with + | [] -> failwith ("switch5 empty" ^ bb.hypermap_id) + | fc::_ -> + let mo (a,b) = modify_bb bb true ["ff",a;"apex4",b] [] in + let f i = mo (split_flatq fc i) in + let bbs = map f (up 5) in + let mo (a,b,c) = modify_bb bb true ["ff",a;"af",b;"ff",c] [] in + let f i = mo (asplit_pent fc i) in + let ccs = map f (up 5) in + (modify_bb bb true ["flat_free",fc] []) :: bbs @ ccs ;; + +let switch6 bb = match bb.std_faces_not_super with + | [] -> failwith ("switch6 empty" ^ bb.hypermap_id) + | fc::_ -> + let mo (a,b) = modify_bb bb true ["ff",a;"apex5",b] [] in + let f i = mo (split_flatq fc i) in + (modify_bb bb true ["flat_free",fc] []) :: (map f (up 6));; + +let switch_face bb = match bb.std_faces_not_super with + | [] -> [bb] + | fc::_ -> + let j = length fc in + let fn = (nth [switch3;switch4;switch5;switch6] (j-3)) in + fn bb;; + +let echo bbs = Sys.command (sprintf "echo STACK %d %d" (length bbs) (nextc()));; + +let onepass bbs = + let branches = flatten (map switch_face bbs) in + let _ = echo bbs in + filter_feas branches;; + +let rec allpass count bbs = + let t = maxlist0 (map (fun b -> length (std_tri_prebranch b)) bbs) in + if t = 0 or count <= 0 then bbs else allpass (count - 1) (onepass bbs);; + +let hardid = +[ +(* {3,3,3,3,3,3} *) "161847242261"; +(* {3,3,3,3,3,3} *) "223336279535"; +(* {3,3,3,3,3,3} *) "86506100695"; +(* one quad {3,3,4} *) "179189825656"; +(* two quad {3,4,4} *) "154005963125"; +(* {4,4,4} *) "65974205892"; +(* added 2010-06-24 *) +"50803004532";"39599353438";"242652038506"; +"88089363170";"75641658977";"34970074286"; +(* added 2011-05-18 *) +"164470574315"; "100126458338"; "215863975889" +];; + + +(* +tame_bb is the entire archive. +feasible_bb are those that pass the first elementary linear program. +hard_bb are those known to be difficult, and easy_bb is the complement. +remaining_easy_bb should be empty; the easy ones should be entirely treated. +*) + +(* execute() takes about 2.5 hours to run. + +Tested on 2010-06-24, svn 1847. +with graph archive file tame_archive_svn1830.txt (June 17, 2010) +It does not work on older versions of the archive because of differences +in the hash code identifiers of graphs. + +Retested 2010-07-28, + +with graph archive file tame_archive_svn1830.txt (June 17, 2010) +Digest.file "/tmp/tame_graph.txt";; +val it : Digest.t = "X\221\153\0263Z\241\178\188\211S'\244\148f@" + +project svn 1909 +body.mod Last Changed Rev: 1849 +lpproc.ml Last Changed Rev: 1850 + +Retested 2011-05-09, after deleting inequality 7676202716 from body.mod. +Runs with 24K cases. All still good. + +Retested 2011-05-15 on hex cases, using 0.6 instead of 0.7578=tameTableD[6,0]. +All still good. (But a change in the tameTable would create more tame graphs, +and this didn't terminate in reasonable time.) + +*) + +let execute() = + let _ = make_model() in + let _ = resetc() in + let tame = strip_archive (!archiveraw) in + let tame_bb = map mk_bb tame in + let feasible_bb = filter_feas (map solve tame_bb) in + let (hard_bb,easy_bb) = partition (fun t -> (mem t.hypermap_id hardid)) feasible_bb in + let remaining_easy_bb = allpass 20 easy_bb in + (tame_bb,feasible_bb,hard_bb,easy_bb,remaining_easy_bb);; + +end;; diff --git a/glpk/tame_archive/scaffolding.hl b/glpk/tame_archive/scaffolding.hl new file mode 100644 index 0000000..87323b3 --- /dev/null +++ b/glpk/tame_archive/scaffolding.hl @@ -0,0 +1,138 @@ +(* ========================================================================== *) +(* FLYSPECK - CODE FORMALIZATION *) +(* *) +(* Program: Linear Programs *) +(* Author: Thomas C. Hales *) +(* Date: 2010-08-01 *) +(* ========================================================================== *) + + +(* + This file contains code that has been used in the interaction to + find inequalities and branching that work. Once the working system + has been designed, this file is no longer required. +*) + + +module Tame_scaffolding = struct + + + let libsort = sort;; (* from Hol light lib.ml, before we open List *) + + open Glpk_link;; + open Lpproc;; + open Hard_lp;; + open List;; + +(* Old results from hard_lp.hl *) + +(* preliminary version *) + +let add_hints bb = + if not(is_feas bb) then () else + if not(bb.hints = []) then () else + add_hints_force bb;; + +let filter_feas_hint bbs = filter_feas_f add_hints bbs;; + +let onepass_hint = function + [] -> [] + | bb::bbss as bbs -> + let _ = onepass_backup := bbs in + let brs = switch_hint bb in + let brs1 = map set_face_numerics brs in + let brs2 = map set_node_numerics brs1 in + let _ = echo bbs in + sortbb ((filter_feas_hint brs2) @ bbss);; + +(* Generate graphics files of a branchnbound, save gif as a /tmp file. *) + +let mk_gif bb = (Sys.chdir + "/Users/thomashales/Desktop/googlecode/flyspeck/graph_generator/classes"; + Sys.command + ("java render/Gendot \""^bb.string_rep ^ + "\" | neato -s -n -Tgif -o "^ + (Filename.temp_file ("render"^bb.hypermap_id^"_") (".gif"))));; + + + +let get_azim_table xs bb = + let [y1;y2;y3] = map (yn bb) xs in + let [y6;y4;y5] = map (fun i -> ye bb ( i, int_of_face xs bb)) xs in + let [a1;a2;a3] = map (fun i -> azim bb (i, int_of_face xs bb)) xs in + let b1 = dih_y y1 y2 y3 y4 y5 y6 in + let b2 = dih_y y2 y3 y1 y5 y6 y4 in + let b3 = dih_y y3 y1 y2 y6 y4 y5 in + (y1,y2,y3,y4,y5,y6,("dih_lp",a1,"dih_y",b1,a1-. b1),("dih2_lp",a2,"dih2_y",b2,a2-. b2),("dih3_lp",a3,"dih3_y",b3,a3 -. b3),"soldiff",a1+. a2 +. a3 -.( b1 +. b2 +. b3));; + +let testval f xs bb = + let (y1,y2,y3,y4,y5,y6,_,_,_,_,_) = get_azim_table xs bb in + f y1 y2 y3 y4 y5 y6;; + +let testvalsym d = testval (fun y1 y2 y3 y4 y5 y6 -> d y1 y3 y2 y4 y6 y5);; + +(* for the purpose of debugging *) + +let check_basic_format bb = + (subset bb.std3_small (rotation bb.std_faces_not_super)) & + (subset bb.std3_big (rotation bb.std_faces_not_super)) & + (intersect (rotation bb.std3_small) (rotation bb.std3_big) = []) & + (subset bb.node_218_236 bb.node_218_252) & + (subset bb.node_236_252 bb.node_218_252);; + +(* for debugging, we don't want overly long lists. Pick out random elts. *) + +let random_elt xs = + let i = Random.int (length xs) in + let r = nth xs i in + r, (subtract xs [r]);; + +let rec random_elts n xs = + if n=0 then ([],xs) else + let (a,b) = random_elts (n-1) xs in + let (r,s) = random_elt b in (r::a,s);; + +let get_highest n bbs = + let eval bb = (match bb.lpvalue with Lp_value r -> r | _ -> 0.0 ) in + (chop_list n (libsort (fun b1 b2 -> eval b1 > eval b2) bbs));; + +let prune_results n bbs = + if length bbs <= 2*n then bbs else + let (b1,b2) = get_highest n bbs in + b1 @ fst (random_elts n b2);; + +let rec allpass_prune_hint prune count bbs = + if count <= 0 then bbs else allpass_prune_hint prune (count - 1) (prune_results prune (onepass_hint bbs));; + +(* Code to help eliminate final cases. *) + + let tmpfile = Filename.temp_file "display_ampl_" ".dat";; + +let display_ampl = + fun bb -> Glpk_link.display_ampl tmpfile Lpproc.ampl_of_bb bb;; + +let display_lp bb = Glpk_link.display_lp + Lpproc.model tmpfile Lpproc.glpk_outfile Lpproc.ampl_of_bb bb ;; + +let remake_model = + let bodyfile = Filename.temp_file "body_" ".mod" in + let m = Lpproc.model in + fun () -> + let _ = Lpproc.modelbody := bodyfile in + let _ = Parse_ineq.output_filestring bodyfile (Parse_ineq.lpstring()) in + let _ = Sys.chdir(tame_dir) in + Sys.command("cp head.mod "^m^"; cat "^bodyfile^" >> "^ + m^"; cat tail.mod >> "^m);; + +(* remake_model();; *) + +let clone bb = modify_bb bb false [] [];; + +let unset_edge bb = + let f = rotation (faces bb) in + let g x = map (fun t -> [nth t 0; nth t 1]) x in + libsort (<) (nub(subtract (g f) (g bb.d_edge_200_225 @ g bb.d_edge_225_252)));; + + + +end;; diff --git a/graph_generator/graph_control.hl b/graph_generator/graph_control.hl new file mode 100644 index 0000000..b92514b --- /dev/null +++ b/graph_generator/graph_control.hl @@ -0,0 +1,256 @@ +(* ========================================================================== *) +(* FLYSPECK - CODE FORMALIZATION *) +(* *) +(* Software: Graph Generator *) +(* Author: Thomas C. Hales *) +(* Date: 2010-09-28 *) +(* ========================================================================== *) + +(* Code to control the graph generator *) + +module Graph_control = struct + +let graph_dir = flyspeck_dir ^ "/../graph_generator";; +let graph_src = graph_dir ^ "/src";; +let graph_classes = graph_dir ^ "/classes";; + +let graph_out = Filename.temp_file "graph_out" ".txt";; (* "/tmp/graph_out.txt";; *) +let render_out = Filename.temp_file "render_out" ".txt";; (* "/tmp/render_out.txt";; *) + +let tmp_graph_properties = Filename.temp_file "graph" ".properties";; +let tmp_graph_properties = "/tmp/graph.properties";; (* Still hard-wired into java code *) + +(* duplicated code *) +let unsplit d f = function + | (x::xs) -> List.fold_left (fun s t -> s^d^(f t)) (f x) xs + | [] -> "";; + +let join_comma = unsplit "," (fun x-> x);; + +let join_lines = unsplit "\n" (fun x-> x);; + +let join_space = unsplit " " (fun x-> x);; + +let output_filestring tmpfile a = + let outs = open_out tmpfile in + let _ = try (Printf.fprintf outs "%s" a) + with _ as t -> (close_out outs; raise t) in + close_out outs ;; + +(* duplicated code *) + + + +type graph_generator_properties = + { + properties_id : string; + ignore_archive : bool; + exclude_degree2 : bool; + exclude_pent_qrtet : bool; + exclude_2_in_quad : bool; + exclude_1_in_tri : bool; + vertex_count_min : int; + vertex_count_max : int; + node_card_max : int; + node_card_max_at_exceptional_vertex : int; + squander_target : int; + score_target : int; + table_weight_d : int list; + table_weight_a : (int*int) list; + table_weight_b : (int*int*int) list; + };; + +let string_of_properties (x:graph_generator_properties) = + let p = Printf.sprintf in + let b t = if t then "true" else "false" in + let weightd = zip (0-- (List.length x.table_weight_d -1)) (x.table_weight_d) in + join_lines + ([ + p"#This properties files is machine generated"; + p"#Graph Generator %s" (flyspeck_version()); + p"#Properties file: %s" (x.properties_id); + p"ignoreArchive=%s" (b x.ignore_archive); + p"excludeDegree2=%s" (b x.exclude_degree2); + p"excludePentQRTet=%s" (b x.exclude_pent_qrtet); + p"exclude2inQuad=%s" (b x.exclude_2_in_quad); + p"exclude1inTri=%s" (b x.exclude_1_in_tri); + p"vertexCountMin=%d" x.vertex_count_min; + p"vertexCountMax=%d" x.vertex_count_max; + p"nodeCardMax=%d" x.node_card_max; + p"nodeCardMaxAtExceptionalVertex=%d" x.node_card_max_at_exceptional_vertex; + p"squanderTarget=%d" x.squander_target; + p"scoreTarget=%d" x.score_target; + (join_lines (map (fun (m,n) -> p"tableWeightD%d=%d" m n) weightd)); + (join_lines (map (fun (m,n) -> p"tableWeightA%d=%d" m n) x.table_weight_a)); + (join_lines (map (fun (a,b,v) -> p"tableWeightB%d%d=%d" a b v) x.table_weight_b)) + ]);; + +let flyspeck_properties = + { + properties_id = "flyspeck properties"; + ignore_archive=true; + exclude_degree2=true; + exclude_pent_qrtet=true; (* because degrees must be at least 2 *) + exclude_2_in_quad=false; + exclude_1_in_tri=false; + vertex_count_min=13; + vertex_count_max=15; + node_card_max=7; + node_card_max_at_exceptional_vertex=6; + squander_target=15410; + score_target= -1; + table_weight_d = [0;0;0;0;2060;4819;7120;15410;15410]; + table_weight_a = [(5,6300)]; + (* exclude b02 because degrees are at least 3. b50 is a special calculation *) + table_weight_b = [(0,3,6180);(0,4,9700);(1,2,6560);(1,3,6180); + (2,1,7970);(2,2,4120);(2,3,12851); + (3,1,3110);(3,2,8170);(4,0,3470);(4,1,3660); + (5,0,400);(5,1,11360);(6,0,6860);(7,0,14500);]; + };; + +let bauer_nipkow_deprecated_properties = + { + properties_id = "flyspeck properties from the Bauer Nipkow Isabelle classification Fall 2010."^ + " table_weight_d is out of date in the 7578 entry." ^ + " This should produce (9,1105,15991,1657) graphs in the pass with n=3,4,5,6, respectively"; + ignore_archive=true; + exclude_degree2=true; + exclude_pent_qrtet=true; (* because degrees must be at least 2 *) + exclude_2_in_quad=false; + exclude_1_in_tri=false; + vertex_count_min=13; + vertex_count_max=15; + node_card_max=7; + node_card_max_at_exceptional_vertex=6; + squander_target=15410; + score_target= -1; + table_weight_d = [0;0;0;0;2060;4819;7578;15410;15410]; + table_weight_a = [(5,6300)]; + (* exclude b02 because degrees are at least 3. b50 is a special calculation *) + table_weight_b = [(0,3,6180);(0,4,9700);(1,2,6560);(1,3,6180); + (2,1,7970);(2,2,4120);(2,3,12851); + (3,1,3110);(3,2,8170);(4,0,3470);(4,1,3660); + (5,0,400);(5,1,11360);(6,0,6860);(7,0,14500);]; + };; + +let kepler98_deprecated_properties = + { + properties_id = "values from the original 1998 proof of the Kepler conjecture, but relaxed to eliminate score"; + ignore_archive=true; + exclude_degree2=true; + exclude_pent_qrtet=true; + exclude_2_in_quad=true; + exclude_1_in_tri=true; + vertex_count_min=10; + vertex_count_max=100; + node_card_max=6; + node_card_max_at_exceptional_vertex=5; + squander_target=14800; + score_target= -1; + table_weight_d = [0;0;0;0;2378;4896;7414;9932;10916]; + table_weight_a = [(3,1400);(4,1500)]; + table_weight_b = [(0,3,7135);(0,4,10649);(1,2,6950);(1,3,7135); + (2,1,8500);(2,2,4756);(2,3,12981); + (3,1,3642);(3,2,8334);(4,0,4139);(4,1,3781); + (5,0,550);(5,1,11220);(6,0,6339)]; + };; + + + +let fejes_toth_contact_conjecture_properties = + { + properties_id = "Fejes Toth's Contact Conjecture"; + ignore_archive=true; + exclude_degree2=false; + exclude_pent_qrtet=true; + exclude_2_in_quad=true; + exclude_1_in_tri=true; + vertex_count_min=12; + vertex_count_max=12; + node_card_max=4; + node_card_max_at_exceptional_vertex=4; + squander_target=1541; + score_target= -1; + (* table_weight_d = [0;0;0;0;206;480;756;1031;1306]; change sep 23, 2012 *) + table_weight_d = [0;0;0;0;206;476;746;1016;1286]; + table_weight_a = [(0,0);(1,0);(2,0);(3,0)]; + table_weight_b = [(0,3,618);(1,3,618);(2,2,412)]; + };; + +let mclaughlin_dodecaheral_conjecture_properties= +{ + properties_id="McLaughlin's Dodecahedral Theorem"; + ignore_archive=true; + exclude_degree2=false; + exclude_pent_qrtet=true; + exclude_2_in_quad=true; + exclude_1_in_tri=true; + vertex_count_min=13; + vertex_count_max=100; + node_card_max=6; + node_card_max_at_exceptional_vertex=5; + squander_target=178; + score_target= -1; + table_weight_d = [0;0;0;0;31;76;121;166;200]; + table_weight_a = [(3,0);(4,16)]; + table_weight_b = [(0,3,93);(0,4,125);(1,2,91);(1,3,93); + (2,1,133);(2,2,62);(3,1,43);(3,2,118);(4,0,53);(4,1,31);(5,0,4)]; +};; + +(* deprecated +let set_properties file_name = + Sys.command(Printf.sprintf "cd %s; cp %s /tmp/graph.properties" graph_dir file_name);; +*) + +let set_prop_file (x:graph_generator_properties) = + output_filestring tmp_graph_properties (string_of_properties x);; + +let compile () = + Sys.command(Printf.sprintf "cd %s; javac -d ../classes graph/Generator.java " graph_src);; + +let execute () = + Sys.command(Printf.sprintf "cd %s; java -Xms300m -Xmx1g graph/Generator | tee %s" graph_classes graph_out);; + +let run(x:graph_generator_properties)= + let _ = set_prop_file (x) in + let _ = compile() in + let _ = execute() in + "execution complete. Results tee'd to " ^ graph_out;; + +(* rendering *) + +let compile_render () = + Sys.command(Printf.sprintf "cd %s; javac -d ../classes render/Gendot.java " graph_src);; + +let compile_gentikz () = + Sys.command(Printf.sprintf "cd %s; javac -d ../classes render/Gentikz.java " graph_src);; + +let execute_render s = + let _ = Sys.command(Printf.sprintf "cd %s; java render/Gendot \"%s\" |tee %s" graph_classes s render_out) in + "execution complete. Results tee'd to " ^ render_out;; + +let execute_g prm s = + let _ = Sys.command(Printf.sprintf "cd %s; java render/%s \"%s\" |tee %s" graph_classes prm s render_out) in + "execution complete. Results tee'd to " ^ render_out;; + +let execute_gendot = execute_g "Gendot";; + +let execute_gentikz = execute_g "Gentikz";; + +let example_graph = "0 24 3 0 1 2 3 0 2 3 3 3 2 4 3 4 2 1 3 4 1 5 3 5 1 0 3 5 0 6 3 6 0 7 3 7 0 3 3 7 3 8 3 8 3 9 3 9 3 4 3 9 4 10 3 10 4 5 3 10 5 11 3 11 5 6 3 11 6 12 3 12 6 7 3 12 7 8 3 12 8 13 3 13 8 9 3 11 12 13 3 10 11 13 3 13 9 10 ";; + +let example_render() = + let _ = compile_render() in + execute_render example_graph;; + +let example_gentikz() = + let _ = compile_gentikz() in + execute_gentikz example_graph;; + +let execute() = + let _ = example_render() in + let _ = example_gentikz() in + run(flyspeck_properties);; + + +end;; diff --git a/jHOLLight/Examples/group_sylow-compiled.hl b/jHOLLight/Examples/group_sylow-compiled.hl new file mode 100644 index 0000000..6cc406e --- /dev/null +++ b/jHOLLight/Examples/group_sylow-compiled.hl @@ -0,0 +1,2789 @@ +needs "Library/prime.ml";; +needs "Examples/seq-compiled.hl";; +open Ssrfun;; +open Ssrbool;; +open Ssrnat;; +open Seq;; +let group = new_definition `group (G,op,i,e) <=> (!x y. x IN G /\ y IN G ==> op x y IN G) /\ + (!x. x IN G ==> i x IN G) /\ e IN G /\ + (!x. x IN G ==> op x e = x /\ op e x = x) /\ + (!x. x IN G ==> op x (i x) = e /\ op (i x) x = e) /\ + (!x y z. x IN G /\ y IN G /\ z IN G ==> op x (op y z) = op (op x y) z)`;; +let subgroup = new_definition `subgroup op i H G <=> H SUBSET G /\ ~(H = {}) /\ + (!x y. x IN H /\ y IN H ==> op x (i y) IN H)`;; +let morphism = new_definition `morphism (f:A->B) op1 op2 G1 G2 <=> + (!x. x IN G1 ==> f x IN G2) /\ + (!x y. x IN G1 /\ y IN G1 ==> f (op1 x y) = op2 (f x) (f y))`;; +let normal = new_definition `normal op i H G <=> subgroup op i H G /\ + (!x y. x IN G /\ y IN H ==> op (i x) (op y x) IN H)`;; +let coset = new_definition `coset op x H = {op x y | y | y IN H}`;; +let cosets = new_definition `cosets op G H = {coset op x H | x | x IN G}`;; +let set_op = new_definition `set_op (op:A->A->A) = (\A B. {op x y | x IN A /\ y IN B})`;; +let set_op1 = new_definition `set_op1 (i:A->A) = (\A. {i x | x IN A})`;; +let conjg = new_definition `conjg (op, i) g x = op (i g) (op x g)`;; +let normalizer = new_definition `normalizer op i G H = {g | g IN G /\ set_op1 (conjg (op, i) g) H = H}`;; + +(* Lemma inE *) +let inE = Sections.section_proof [] +`(!p x. x IN {y | p y} <=> p x) /\ + (!P x. x IN GSPEC (\v. P (SETSPEC v)) <=> P (\p t. p /\ x = t))` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma in_trans *) +let in_trans = Sections.section_proof ["t";"A";"B"] +`A SUBSET B ==> t IN A ==> t IN B` +[ + ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (exact_tac) THEN (done_tac)); +];; + +(* Lemma coset_op *) +let coset_op = Sections.section_proof ["op";"x";"H"] +`coset op x H = set_op op {x} H` +[ + ((((((use_arg_then2 ("coset", [coset]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_op", [set_op]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"])) THEN ((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (split_tac)); + (BETA_TAC THEN (case THEN ((move ["z"]) THEN (case THEN ((move ["zH"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))))); + ((((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("z", [])) (term_tac exists_tac))) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["z"])) THEN (case THEN (move ["t"])) THEN (case THEN ((case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["tH"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma set_op1_sing *) +let set_op1_sing = Sections.section_proof ["f";"x"] +`set_op1 f {x} = {f x}` +[ + ((((((use_arg_then2 ("set_op1", [set_op1]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))))) THEN (move ["a"])) THEN (split_tac)); + ((BETA_TAC THEN (case THEN (move ["b"])) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac)); + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma set_op1_lmul *) +let set_op1_lmul = Sections.section_proof ["g";"op"] +`set_op1 (op g) = set_op op {g}` +[ + ((((((use_arg_then2 ("set_op1", [set_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_op", [set_op]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["S"]) THEN (move ["a"])) THEN (split_tac)); + (BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN ((move ["xS"]) THEN (move ["a_eq"])))); + ((((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac))) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN (move ["y"])) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["xg"]) THEN (move ["yS"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("yS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xg", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma coset_op1 *) +let coset_op1 = Sections.section_proof ["op";"x";"H"] +`coset (op:A->A->A) x H = set_op1 (op x) H` +[ + (((((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("coset_op", [coset_op]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma normal_conj *) +let normal_conj = Sections.section_proof ["op";"i";"G";"H";"x";"y"] +`normal op i H G /\ x IN G /\ y IN H ==> conjg (op, i) x y IN H` +[ + (((((use_arg_then2 ("normal", [normal]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma normal_subgroup *) +let normal_subgroup = Sections.section_proof ["op";"i";"H";"G"] +`normal op i H G ==> subgroup op i H G` +[ + (((((use_arg_then2 ("normal", [normal]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma in_subgroup *) +let in_subgroup = Sections.section_proof ["op";"i";"H";"G";"x"] +`subgroup op i H G ==> x IN H ==> x IN G` +[ + (((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma subgroup_subset *) +let subgroup_subset = Sections.section_proof ["op";"i";"H";"G"] +`subgroup op i H G ==> H SUBSET G` +[ + (((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma subgroup_subset_trans *) +let subgroup_subset_trans = Sections.section_proof ["op";"i";"H";"K";"G"] +`subgroup op i H G ==> H SUBSET K ==> subgroup op i H K` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma normal_subset_trans *) +let normal_subset_trans = Sections.section_proof ["op";"i";"H";"K";"G"] +`normal op i H G ==> H SUBSET K ==> K SUBSET G ==> normal op i H K` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("normal", [normal]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [(`K SUBSET G`)]))))) THEN ALL_TAC THEN (case THEN (move ["subHG"])) THEN (move ["nH"]) THEN (move ["sHK"]) THEN (move ["sKG"])); + (((((fun arg_tac -> (use_arg_then2 ("subgroup_subset_trans", [subgroup_subset_trans])) (fun fst_arg -> (use_arg_then2 ("subHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["k"]) THEN (move ["h"]) THEN (case THEN ((move ["kK"]) THEN (move ["hH"])))); + (((((use_arg_then2 ("nH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sKG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma cosets_full_preimage_sub *) +let cosets_full_preimage_sub = Sections.section_proof ["op";"G";"H";"K"] +`K SUBSET G ==> K SUBSET {g | g IN G /\ coset op g H IN (cosets op K H)}` +[ + (((((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))))) THEN (BETA_TAC THEN (move ["sKG"])) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["k"]) THEN (move ["kK"]))); + (((use_arg_then2 ("k", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("sKG", []))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))) THEN ((use_arg_then2 ("k", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma op_in_coset *) +let op_in_coset = Sections.section_proof ["op";"k";"x";"K"] +`k IN K ==> op x k IN coset op x K` +[ + ((BETA_TAC THEN (move ["kK"])) THEN ((((use_arg_then2 ("coset", [coset]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("k", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma eqxx *) +let eqxx = Sections.section_proof ["x"] +`x = x <=> T` +[ + ((ALL_TAC) THEN (done_tac)); +];; +let divides = GEN_ALL divides;; + +(* Lemma set_op_sing *) +let set_op_sing = Sections.section_proof ["a";"b";"op"] +`set_op op {a} {b} = {op a b}` +[ + ((((((use_arg_then2 ("set_op", [set_op]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))))) THEN (move ["x"])) THEN (split_tac)); + ((BETA_TAC THEN (case THEN (move ["z"])) THEN (case THEN (move ["y"])) THEN (case THEN ((case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac)); + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("b", [])) (term_tac exists_tac))) THEN (done_tac)); +];; + +(* Lemma in_set_op1 *) +let in_set_op1 = Sections.section_proof ["f";"S";"x"] +`x IN set_op1 f S <=> ?s. s IN S /\ x = f s` +[ + (((((use_arg_then2 ("set_op1", [set_op1]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma in_set_op *) +let in_set_op = Sections.section_proof ["f";"S1";"S2";"x"] +`x IN set_op f S1 S2 <=> ?s1 s2. s1 IN S1 /\ s2 IN S2 /\ x = f s1 s2` +[ + (((((use_arg_then2 ("set_op", [set_op]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("CONJ_ASSOC", [CONJ_ASSOC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma conjg_set_alt *) +let conjg_set_alt = Sections.section_proof ["op";"i";"g";"S"] +`set_op1 (conjg (op, i) g) S = set_op1 (op (i g)) (set_op op S {g})` +[ + ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])) THEN (split_tac)); + (BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["sS"])) THEN (move ["x_eq"])); + (((fun arg_tac -> arg_tac (Arg_term (`op s g`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("g", [])) (term_tac exists_tac))) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["s1"])) THEN (case THEN (move ["s2"])) THEN (case THEN (move ["s1S"])) THEN (case THEN (move ["s2_eq"])) THEN (move ["s_eq"]) THEN (move ["x_eq"])); + (((use_arg_then2 ("s1", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s2_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma set_op1_eq_image *) +let set_op1_eq_image = Sections.section_proof ["f";"S"] +`set_op1 f S = IMAGE f S` +[ + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL CONJ_ACI)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma set_op_eq_union *) +let set_op_eq_union = Sections.section_proof ["f";"S1";"S2"] +`set_op f S1 S2 = UNIONS {IMAGE (f x) S2 | x | x IN S1}` +[ + ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNIONS", [IN_UNIONS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"])) THEN (split_tac)); + (BETA_TAC THEN (case THEN (move ["s1"])) THEN (case THEN (move ["s2"])) THEN (case THEN (move ["s1S"])) THEN (case THEN (move ["s2S"])) THEN (move ["x_eq"])); + (((THENL) (((fun arg_tac -> arg_tac (Arg_term (`IMAGE (f s1) S2`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (split_tac)) [((use_arg_then2 ("s1", [])) (term_tac exists_tac)); ((use_arg_then2 ("s2", [])) (term_tac exists_tac))]) THEN (done_tac)); + ((BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["s1"])) THEN (case THEN (move ["s1S"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["s2"])) THEN (case THEN (move ["x_eq"])) THEN (move ["s2S"]))); + ((((use_arg_then2 ("s1", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("s2", [])) (term_tac exists_tac))) THEN (done_tac)); +];; + +(* Lemma set_op_eq_image *) +let set_op_eq_image = Sections.section_proof ["f";"S";"y"] +`set_op f S {y} = IMAGE (\x. f x y) S` +[ + ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"])) THEN (split_tac)); + (BETA_TAC THEN (case THEN (move ["s1"])) THEN (case THEN (move ["s2"])) THEN (case THEN (move ["s1S"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("s1", [])) (term_tac exists_tac)) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["sS"])); + ((((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("y", [])) (term_tac exists_tac))) THEN (done_tac)); +];; + +(* Section Groups *) +Sections.begin_section "Groups";; +(Sections.add_section_var (mk_var ("G", (`:A->bool`))));; +(Sections.add_section_var (mk_var ("e", (`:A`))));; +(Sections.add_section_var (mk_var ("op", (`:A -> A -> A`))));; +(Sections.add_section_var (mk_var ("i", (`:A -> A`))));; +(Sections.add_section_hyp "grG" (`group (G,op,i,e)`));; + +(* Lemma e_in_group *) +let e_in_group = Sections.section_proof [] +`e IN G` +[ + ((((use_arg_then2 ("grG", [])) (disch_tac [])) THEN (clear_assumption "grG") THEN BETA_TAC) THEN ((((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma in_group *) +let in_group = Sections.section_proof ["x";"y"] +`x IN G ==> y IN G ==> op x y IN G` +[ + ((((use_arg_then2 ("grG", [])) (disch_tac [])) THEN (clear_assumption "grG") THEN BETA_TAC) THEN ((((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma i_in_group *) +let i_in_group = Sections.section_proof ["x"] +`x IN G ==> i x IN G` +[ + ((((use_arg_then2 ("grG", [])) (disch_tac [])) THEN (clear_assumption "grG") THEN BETA_TAC) THEN ((((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma mul1g *) +let mul1g = Sections.section_proof ["x"] +`x IN G ==> op e x = x` +[ + ((((use_arg_then2 ("grG", [])) (disch_tac [])) THEN (clear_assumption "grG") THEN BETA_TAC) THEN ((((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma mulg1 *) +let mulg1 = Sections.section_proof ["x"] +`x IN G ==> op x e = x` +[ + ((((use_arg_then2 ("grG", [])) (disch_tac [])) THEN (clear_assumption "grG") THEN BETA_TAC) THEN ((((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma mulIg *) +let mulIg = Sections.section_proof ["x"] +`x IN G ==> op (i x) x = e` +[ + ((((use_arg_then2 ("grG", [])) (disch_tac [])) THEN (clear_assumption "grG") THEN BETA_TAC) THEN ((((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma mulgI *) +let mulgI = Sections.section_proof ["x"] +`x IN G ==> op x (i x) = e` +[ + ((((use_arg_then2 ("grG", [])) (disch_tac [])) THEN (clear_assumption "grG") THEN BETA_TAC) THEN ((((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma mulgA *) +let mulgA = Sections.section_proof ["x";"y";"z"] +`x IN G ==> y IN G ==> z IN G ==> op x (op y z) = op (op x y) z` +[ + ((((use_arg_then2 ("grG", [])) (disch_tac [])) THEN (clear_assumption "grG") THEN BETA_TAC) THEN ((((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma mulgK *) +let mulgK = Sections.section_proof ["x";"y"] +`x IN G ==> y IN G ==> op (op x y) (i y) = x` +[ + ((BETA_TAC THEN (move ["xG"]) THEN (move ["yG"])) THEN ((((use_arg_then2 ("mulgA", [mulgA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulgI", [mulgI]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulg1", [mulg1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mulKg *) +let mulKg = Sections.section_proof ["x";"y"] +`x IN G ==> y IN G ==> op (op x (i y)) y = x` +[ + ((BETA_TAC THEN (move ["xG"]) THEN (move ["yG"])) THEN ((((use_arg_then2 ("mulgA", [mulgA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulIg", [mulIg]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulg1", [mulg1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma i_uniq *) +let i_uniq = Sections.section_proof ["x";"y"] +`x IN G ==> y IN G ==> op x y = e ==> y = i x` +[ + (BETA_TAC THEN (move ["xG"]) THEN (move ["yG"]) THEN (move ["eq"])); + ((fun arg_tac -> arg_tac (Arg_term (`op (op (i x) x) y = op (i x) e`))) (term_tac (have_gen_tac []ALL_TAC))); + (((((use_arg_then2 ("mulgA", [mulgA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("yG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("xG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (done_tac)); + (((((use_arg_then2 ("mulIg", [mulIg]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulg1", [mulg1]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma invgK *) +let invgK = Sections.section_proof ["x"] +`x IN G ==> i (i x) = x` +[ + ((BETA_TAC THEN (move ["xG"])) THEN (((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[IMP_IMP] i_uniq))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + (((((use_arg_then2 ("mulIg", [mulIg]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma invg1 *) +let invg1 = Sections.section_proof [] +`i e = e` +[ + (((((fun arg_tac -> (use_arg_then2 ("mulg1", [mulg1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i e`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("e_in_group", [e_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulIg", [mulIg]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("e_in_group", [e_in_group]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mulI *) +let mulI = Sections.section_proof ["x";"y"] +`x IN G ==> y IN G ==> i (op x y) = op (i y) (i x)` +[ + ((BETA_TAC THEN (move ["xG"]) THEN (move ["yG"])) THEN (((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_uniq", [i_uniq])) (disch_tac [])) THEN (clear_assumption "i_uniq") THEN (DISCH_THEN apply_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mulgA", [mulgA]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulgK", [mulgK]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulgI", [mulgI]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mulg_leftI *) +let mulg_leftI = Sections.section_proof ["x";"y";"z"] +`x IN G ==> y IN G ==> z IN G ==> op x y = op x z ==> y = z` +[ + (BETA_TAC THEN (move ["xG"]) THEN (move ["yG"]) THEN (move ["zG"]) THEN (move ["eq"])); + (((((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("z", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mulgA", [mulgA]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma mulg_rightI *) +let mulg_rightI = Sections.section_proof ["x";"y";"z"] +`x IN G ==> y IN G ==> z IN G ==> op y x = op z x ==> y = z` +[ + (BETA_TAC THEN (move ["xG"]) THEN (move ["yG"]) THEN (move ["zG"]) THEN (move ["eq"])); + (((((fun arg_tac -> (use_arg_then2 ("mulg1", [mulg1])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulg1", [mulg1]))(gsym_then (thm_tac (new_rewrite [] [(`z`)]))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mulgA", [mulgA]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma mulg_left *) +let mulg_left = Sections.section_proof ["x";"y";"z"] +`x IN G ==> y IN G ==> z IN G ==> (op x y = z <=> x = op z (i y))` +[ + ((BETA_TAC THEN (move ["xG"]) THEN (move ["yG"]) THEN (move ["zG"])) THEN ((THENL) (split_tac) [(move ["opxy"]); (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))])); + (((((fun arg_tac -> (use_arg_then2 ("mulg1", [mulg1])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulgA", [mulgA]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("mulgA", [mulgA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mulIg", [mulIg]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mulg1", [mulg1]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma mulg_right *) +let mulg_right = Sections.section_proof ["x";"y";"z"] +`x IN G ==> y IN G ==> z IN G ==> (op x y = z <=> y = op (i x) z)` +[ + ((BETA_TAC THEN (move ["xG"]) THEN (move ["yG"]) THEN (move ["zG"])) THEN ((THENL) (split_tac) [(move ["opxy"]); (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))])); + (((((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulgA", [mulgA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("mulgA", [mulgA]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mulgI", [mulgI]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma invg_e *) +let invg_e = Sections.section_proof [] +`i e = e` +[ + ((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_uniq", [i_uniq])) (disch_tac [])) THEN (clear_assumption "i_uniq") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_in_group", [e_in_group]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma subgroup_alt *) +let subgroup_alt = Sections.section_proof ["H"] +`subgroup op i H G <=> + H SUBSET G /\ ~(H = {}) /\ (!x y. x IN H ==> y IN H ==> op x y IN H) /\ + (!x. x IN H ==> i x IN H)` +[ + (((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ((split_tac) THEN ALL_TAC THEN (case THEN (move ["subHG"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)))); + (((((use_arg_then2 ("subHG", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (BETA_TAC THEN (move ["h"]))); + ((fun arg_tac -> arg_tac (Arg_term (`x IN H ==> i x IN H`))) (term_tac (have_gen_tac ["x"](move ["ixH"])))); + (BETA_TAC THEN (move ["xH"])); + ((fun arg_tac -> (use_arg_then2 ("subHG", [])) (fun fst_arg -> (use_arg_then2 ("xH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["xG"]))); + (((((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("ixH", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (move ["x"]) THEN (move ["y"]) THEN (move ["xH"]) THEN (move ["yH"])); + (((fun arg_tac -> (use_arg_then2 ("subHG", [])) (fun fst_arg -> (use_arg_then2 ("xH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["xG"]))) THEN ((fun arg_tac -> (use_arg_then2 ("subHG", [])) (fun fst_arg -> (use_arg_then2 ("yH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["yG"])))); + (((((fun arg_tac -> (use_arg_then2 ("invgK", [invgK])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ixH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma subgroup_group *) +let subgroup_group = Sections.section_proof ["H"] +`subgroup op i H G ==> group (H, op, i, e)` +[ + (((use_arg_then2 ("grG", [])) (disch_tac [])) THEN BETA_TAC); + (((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 2 0 (((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["opG"])) THEN (case THEN (move ["iG"])) THEN (case THEN (move ["eG"])) THEN (case THEN (move ["idG"])) THEN (case THEN ((move ["invG"]) THEN (move ["aG"]))) THEN (case THEN (move ["sHG"])) THEN (case THEN ((move ["nH"]) THEN (move ["op_iH"])))); + ((fun arg_tac -> arg_tac (Arg_term (`e IN H`))) (term_tac (have_gen_tac [](move ["eH"])))); + ((((use_arg_then2 ("nH", [])) (disch_tac [])) THEN (clear_assumption "nH") THEN BETA_TAC) THEN ((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["x"]) THEN (move ["xH"]))))); + (((((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("op_iH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`y IN H ==> i y IN H`))) (term_tac (have_gen_tac ["y"](move ["iH"])))); + (BETA_TAC THEN (move ["yH"])); + (((((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("op_iH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (repeat_tactic 0 6 (((split_tac) THEN ((TRY done_tac))))); + ((BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ((move ["xH"]) THEN (move ["yH"])))) THEN ((((use_arg_then2 ("invgK", [invgK]))(gsym_then (thm_tac (new_rewrite [] [(`y`)]))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("op_iH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["x"]) THEN (move ["xH"])) THEN (((use_arg_then2 ("idG", [])) (disch_tac [])) THEN (clear_assumption "idG") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((BETA_TAC THEN (move ["x"]) THEN (move ["xH"])) THEN (((use_arg_then2 ("invG", [])) (disch_tac [])) THEN (clear_assumption "invG") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (move ["z"]) THEN (case THEN (move ["xH"])) THEN (case THEN ((move ["yH"]) THEN (move ["zH"])))); + ((((use_arg_then2 ("aG", [])) (disch_tac [])) THEN (clear_assumption "aG") THEN (DISCH_THEN apply_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma subgroup_e *) +let subgroup_e = Sections.section_proof [] +`subgroup op i {e} G` +[ + (((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("e_in_group", [e_in_group]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + (((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN (done_tac)); + (BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("mulgI", [mulgI]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("e_in_group", [e_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma set_opK *) +let set_opK = Sections.section_proof [] +`set_op op G G = G` +[ + ((((((use_arg_then2 ("set_op", [set_op]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])) THEN ((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (split_tac)); + (BETA_TAC THEN (case THEN (move ["x'"])) THEN (case THEN (move ["y"])) THEN (case THEN ((case THEN ((move ["xG"]) THEN (move ["yG"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (BETA_TAC THEN (move ["xG"])); + ((((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac))) THEN ((((use_arg_then2 ("xG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_in_group", [e_in_group]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma normal_conj2 *) +let normal_conj2 = Sections.section_proof ["H";"x";"y"] +`normal op i H G ==> x IN G ==> y IN H ==> + op x (op y (i x)) IN H` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("normal_conj", [normal_conj])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] [])))) THEN (move ["conj"]) THEN (move ["xG"]) THEN (move ["yH"]))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("conj", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("yH", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("invgK", [invgK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma set_opA *) +let set_opA = Sections.section_proof ["A";"B";"C"] +`A SUBSET G ==> B SUBSET G ==> C SUBSET G ==> + set_op op A (set_op op B C) = set_op op (set_op op A B) C` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (move ["AG"]) THEN (move ["BG"]) THEN (move ["CG"])); + ((((repeat_tactic 1 9 (((use_arg_then2 ("set_op", [set_op]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (simp_tac)) THEN (split_tac)); + (BETA_TAC THEN (case THEN (move ["a"])) THEN (case THEN (move ["u"])) THEN (case THEN (case THEN (move ["aA"]))) THEN (case THEN (move ["b"])) THEN (case THEN (move ["c"])) THEN (case THEN ((case THEN ((move ["bB"]) THEN (move ["cC"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["x_eq"])); + (((fun arg_tac -> arg_tac (Arg_term (`op a b`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("c", [])) (term_tac exists_tac))); + ((((use_arg_then2 ("mulgA", [mulgA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("AG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("BG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("CG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("x_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("cC", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("a", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("b", [])) (term_tac exists_tac))) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["u"])) THEN (case THEN (move ["c"])) THEN (case THEN ALL_TAC) THEN (case THEN ALL_TAC) THEN (case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN ((case THEN ((move ["aA"]) THEN (move ["bB"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["cC"]) THEN (move ["x_eq"])); + (((use_arg_then2 ("a", [])) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`op b c`))) (term_tac exists_tac))); + ((((use_arg_then2 ("mulgA", [mulgA]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("AG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("BG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("CG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("x_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("aA", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("b", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("c", [])) (term_tac exists_tac))) THEN (done_tac)); +];; + +(* Lemma coset_subset *) +let coset_subset = Sections.section_proof ["x";"S"] +`x IN G ==> S SUBSET G ==> coset op x S SUBSET G` +[ + ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["xG"]) THEN (move ["SG"])); + ((((((use_arg_then2 ("coset", [coset]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"])) THEN (((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["z"])) THEN (case THEN ((move ["zS"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + (((((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma coset_e *) +let coset_e = Sections.section_proof ["S"] +`S SUBSET G ==> coset op e S = S` +[ + ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["sSG"])); + (((((use_arg_then2 ("coset", [coset]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] []))))) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (simp_tac)) THEN (move ["x"])) THEN (split_tac)); + ((BETA_TAC THEN (case THEN (move ["y"])) THEN (case THEN ((move ["yH"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN ((((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["xH"])) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma coset_eq_e *) +let coset_eq_e = Sections.section_proof ["g"] +`g IN G ==> coset op g G = G` +[ + ((((((use_arg_then2 ("coset", [coset]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["gG"]) THEN (move ["g'"])) THEN ((THENL) (split_tac) [ALL_TAC; (move ["g'G"])])); + ((BETA_TAC THEN (case THEN (move ["h"])) THEN (case THEN (move ["hG"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`op (i g) g'`))) (term_tac exists_tac)); + (((((use_arg_then2 ("mulgA", [mulgA]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mulgI", [mulgI]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma left_mul_coset *) +let left_mul_coset = Sections.section_proof ["g";"h";"S"] +`g IN G ==> h IN G ==> S SUBSET G ==> + set_op1 (op g) (coset op h S) = coset op (op g h) S` +[ + (BETA_TAC THEN (move ["gG"]) THEN (move ["hG"]) THEN (move ["sSG"])); + ((((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("coset_op", [coset_op]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("set_opA", [set_opA]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((use_arg_then2 ("congr2", [congr2])) (thm_tac apply_tac)) THEN (((((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_op", [set_op]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"])) THEN (split_tac)); + ((BETA_TAC THEN (case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN ALL_TAC) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["x_eq"])) THEN (((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("h", [])) (term_tac exists_tac))) THEN (done_tac)); +];; + +(* Lemma set_lmul_subset *) +let set_lmul_subset = Sections.section_proof ["g";"S"] +`g IN G ==> S SUBSET G ==> set_op1 (op g) S SUBSET G` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN (move ["gG"]) THEN (move ["sSG"]) THEN (move ["x"]) THEN (case THEN (move ["s"])) THEN (case THEN (move ["sS"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma set_rmul_subset *) +let set_rmul_subset = Sections.section_proof ["g";"S"] +`g IN G ==> S SUBSET G ==> set_op op S {g} SUBSET G` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (move ["gG"]) THEN (move ["sSG"]) THEN (move ["x"]) THEN (case THEN (move ["s1"])) THEN (case THEN (move ["s2"])) THEN (case THEN (move ["s1S"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma set_lmul_has_size *) +let set_lmul_has_size = Sections.section_proof ["g";"S";"n"] +`g IN G ==> S SUBSET G ==> S HAS_SIZE n ==> set_op1 (op g) S HAS_SIZE n` +[ + (BETA_TAC THEN (move ["gG"]) THEN (move ["sSG"]) THEN (move ["sizeS"])); + ((((use_arg_then2 ("set_op1_eq_image", [set_op1_eq_image]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("HAS_SIZE_IMAGE_INJ", [HAS_SIZE_IMAGE_INJ])) (thm_tac apply_tac)) THEN (((((use_arg_then2 ("sizeS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN (move ["xS"])) THEN (case THEN (move ["yS"])))); + ((((use_arg_then2 ("mulg_leftI", [mulg_leftI])) (disch_tac [])) THEN (clear_assumption "mulg_leftI") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("in_trans", [in_trans])) (fun fst_arg -> (use_arg_then2 ("sSG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma set_rmul_has_size *) +let set_rmul_has_size = Sections.section_proof ["g";"S";"n"] +`g IN G ==> S SUBSET G ==> S HAS_SIZE n ==> set_op op S {g} HAS_SIZE n` +[ + (BETA_TAC THEN (move ["gG"]) THEN (move ["sSG"]) THEN (move ["sizeS"])); + ((((use_arg_then2 ("set_op_eq_image", [set_op_eq_image]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("HAS_SIZE_IMAGE_INJ", [HAS_SIZE_IMAGE_INJ])) (thm_tac apply_tac)) THEN (((((use_arg_then2 ("sizeS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN (move ["xS"])) THEN (case THEN (move ["yS"])) THEN (simp_tac))); + ((((use_arg_then2 ("mulg_rightI", [mulg_rightI])) (disch_tac [])) THEN (clear_assumption "mulg_rightI") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("in_trans", [in_trans])) (fun fst_arg -> (use_arg_then2 ("sSG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma set_lmul_card *) +let set_lmul_card = Sections.section_proof ["g";"S"] +`g IN G ==> S SUBSET G ==> FINITE S ==> CARD (set_op1 (op g) S) = CARD S` +[ + ((((use_arg_then2 ("FINITE_HAS_SIZE", [FINITE_HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (move ["gG"]) THEN (move ["sSG"]) THEN (move ["sizeS"])); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("set_lmul_has_size", [set_lmul_has_size])) (fun fst_arg -> (use_arg_then2 ("gG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sSG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sizeS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma set_rmul_card *) +let set_rmul_card = Sections.section_proof ["g";"S"] +`g IN G ==> S SUBSET G ==> FINITE S ==> CARD (set_op op S {g}) = CARD S` +[ + ((((use_arg_then2 ("FINITE_HAS_SIZE", [FINITE_HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (move ["gG"]) THEN (move ["sSG"]) THEN (move ["sizeS"])); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("set_rmul_has_size", [set_rmul_has_size])) (fun fst_arg -> (use_arg_then2 ("gG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sSG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sizeS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma set_lrmul_card *) +let set_lrmul_card = Sections.section_proof ["g1";"g2";"S"] +`g1 IN G ==> g2 IN G ==> S SUBSET G ==> FINITE S ==> + CARD (set_op1 (op g1) S) = CARD (set_op op S {g2})` +[ + ((BETA_TAC THEN (move ["g1G"]) THEN (move ["g2G"]) THEN (move ["sSG"]) THEN (move ["finS"])) THEN ((((use_arg_then2 ("set_lmul_card", [set_lmul_card]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("set_rmul_card", [set_rmul_card]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma set_llmul_card *) +let set_llmul_card = Sections.section_proof ["g1";"g2";"S"] +`g1 IN G ==> g2 IN G ==> S SUBSET G ==> FINITE S ==> + CARD (set_op1 (op g1) S) = CARD (set_op1 (op g2) S)` +[ + ((BETA_TAC THEN (move ["g1G"]) THEN (move ["g2G"]) THEN (move ["sSG"]) THEN (move ["finS"])) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_lmul_card", [set_lmul_card]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma set_lmul1 *) +let set_lmul1 = Sections.section_proof ["S"] +`S SUBSET G ==> set_op1 (op e) S = S` +[ + ((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN (move ["sSG"]) THEN (move ["x"])) THEN ((THENL) (split_tac) [((case THEN (move ["s"])) THEN (case THEN ((move ["sS"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); (move ["xS"])])); + (((((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma set_rmul1 *) +let set_rmul1 = Sections.section_proof ["S"] +`S SUBSET G ==> set_op op S {e} = S` +[ + ((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (move ["sSG"]) THEN (move ["x"])) THEN ((THENL) (split_tac) [((case THEN (move ["s1"])) THEN (case THEN (move ["s2"])) THEN (case THEN (move ["s1S"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); (move ["xS"])])); + (((((use_arg_then2 ("mulg1", [mulg1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("e", [])) (term_tac exists_tac))) THEN ((((use_arg_then2 ("mulg1", [mulg1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma conjg_in *) +let conjg_in = Sections.section_proof ["x";"g"] +`g IN G ==> x IN G ==> conjg (op, i) g x IN G` +[ + ((BETA_TAC THEN (move ["gG"]) THEN (move ["xG"])) THEN ((((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma mul_conjg *) +let mul_conjg = Sections.section_proof ["x";"g1";"g2"] +`x IN G ==> g1 IN G ==> g2 IN G ==> + conjg (op, i) (op g1 g2) x = conjg (op, i) g2 (conjg (op, i) g1 x)` +[ + ((BETA_TAC THEN (move ["xG"]) THEN (move ["g1G"]) THEN (move ["g2G"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mulI", [mulI]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mulgA", [mulgA]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma conjg_mul *) +let conjg_mul = Sections.section_proof ["x";"y";"g"] +`x IN G ==> y IN G ==> g IN G ==> + conjg (op, i) g (op x y) = op (conjg (op, i) g x) (conjg (op, i) g y)` +[ + ((BETA_TAC THEN (move ["xG"]) THEN (move ["yG"]) THEN (move ["gG"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mulgA", [mulgA]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mulgK", [mulgK]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma inv_conjg *) +let inv_conjg = Sections.section_proof ["x";"g"] +`g IN G ==> x IN G ==> i (conjg (op, i) g x) = conjg (op, i) g (i x)` +[ + ((BETA_TAC THEN (move ["gG"]) THEN (move ["xG"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mulI", [mulI]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("invgK", [invgK]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mulgA", [mulgA]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma conj1g *) +let conj1g = Sections.section_proof ["x"] +`x IN G ==> conjg (op, i) e x = x` +[ + ((BETA_TAC THEN (move ["xG"])) THEN ((((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("invg1", [invg1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulg1", [mulg1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma conjg1 *) +let conjg1 = Sections.section_proof ["g"] +`g IN G ==> conjg (op, i) g e = e` +[ + ((BETA_TAC THEN (move ["gG"])) THEN ((((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulIg", [mulIg]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma conjg_inj *) +let conjg_inj = Sections.section_proof ["x";"y";"g"] +`x IN G ==> y IN G ==> g IN G ==> + (conjg (op, i) g x = conjg (op, i) g y <=> x = y)` +[ + ((THENL_LAST) ((BETA_TAC THEN (move ["xG"]) THEN (move ["yG"]) THEN (move ["gG"])) THEN (split_tac)) ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("congr1", [congr1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`conjg (op, i) (i g)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("mul_conjg", [mul_conjg]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mulgI", [mulgI]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("conj1g", [conj1g]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma conjg_set_subset *) +let conjg_set_subset = Sections.section_proof ["g";"S"] +`g IN G ==> S SUBSET G ==> set_op1 (conjg (op, i) g) S SUBSET G` +[ + (BETA_TAC THEN (move ["gG"]) THEN (move ["sSG"])); + ((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN (move ["y"])) THEN (case THEN (move ["yS"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("conjg_in", [conjg_in]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_trans", [in_trans])) (fun fst_arg -> (use_arg_then2 ("sSG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma conj1g_set *) +let conj1g_set = Sections.section_proof ["S"] +`S SUBSET G ==> set_op1 (conjg (op, i) e) S = S` +[ + ((BETA_TAC THEN (move ["sSG"])) THEN ((((use_arg_then2 ("conjg_set_alt", [conjg_set_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_rmul1", [set_rmul1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("invg1", [invg1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_lmul1", [set_lmul1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mul_conjg_set *) +let mul_conjg_set = Sections.section_proof ["S";"g1";"g2"] +`g1 IN G ==> g2 IN G ==> S SUBSET G ==> + set_op1 (conjg (op, i) (op g1 g2)) S = set_op1 (conjg (op, i) g2) (set_op1 (conjg (op, i) g1) S)` +[ + ((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] [])))))) THEN (move ["g1G"]) THEN (move ["g2G"]) THEN (move ["sSG"]) THEN (move ["x"])) THEN (split_tac)); + (BETA_TAC THEN (case THEN (move ["s"])) THEN (case THEN (move ["sS"])) THEN (move ["x_eq"])); + (((fun arg_tac -> arg_tac (Arg_term (`conjg (op, i) g1 s`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("mul_conjg", [mul_conjg]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("g1G", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("g2G", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["s"])) THEN (case THEN (move ["sS"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["x_eq"])); + (((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("mul_conjg", [mul_conjg]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("g1G", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("g2G", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma conjg_set_has_size *) +let conjg_set_has_size = Sections.section_proof ["S";"g";"n"] +`g IN G ==> S SUBSET G ==> S HAS_SIZE n ==> + set_op1 (conjg (op, i) g) S HAS_SIZE n` +[ + (BETA_TAC THEN (move ["gG"]) THEN (move ["sSG"]) THEN (move ["sizeS"])); + (((((use_arg_then2 ("conjg_set_alt", [conjg_set_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_lmul_has_size", [set_lmul_has_size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("set_rmul_subset", [set_rmul_subset]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("set_rmul_has_size", [set_rmul_has_size]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma conjg_set_card *) +let conjg_set_card = Sections.section_proof ["S";"g"] +`g IN G ==> S SUBSET G ==> FINITE S ==> + CARD (set_op1 (conjg (op, i) g) S) = CARD S` +[ + ((((use_arg_then2 ("FINITE_HAS_SIZE", [FINITE_HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (move ["gG"]) THEN (move ["sSG"]) THEN (move ["sizeS"])); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("conjg_set_has_size", [conjg_set_has_size])) (fun fst_arg -> (use_arg_then2 ("gG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sSG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sizeS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma conjg_set_card2 *) +let conjg_set_card2 = Sections.section_proof ["S";"g1";"g2"] +`g1 IN G ==> g2 IN G ==> S SUBSET G ==> FINITE S ==> + CARD (set_op1 (conjg (op, i) g1) S) = CARD (set_op1 (conjg (op, i) g2) S)` +[ + ((BETA_TAC THEN (move ["g1G"]) THEN (move ["g2G"]) THEN (move ["sSG"]) THEN (move ["finS"])) THEN (repeat_tactic 1 9 (((use_arg_then2 ("conjg_set_card", [conjg_set_card]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma conjg_set_equiv *) +let conjg_set_equiv = Sections.section_proof ["S";"U";"g"] +`g IN G ==> S SUBSET G ==> U SUBSET G ==> + ((set_op1 (conjg (op, i) g) S) = U <=> set_op op S {g} = set_op1 (op g) U)` +[ + ((BETA_TAC THEN (move ["gG"]) THEN (move ["sSG"]) THEN (move ["sUG"])) THEN (split_tac)); + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then2 ("conjg_set_alt", [conjg_set_alt]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_opA", [set_opA]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("set_rmul_subset", [set_rmul_subset]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("set_op_sing", [set_op_sing]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulgI", [mulgI]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_lmul1", [set_lmul1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("set_rmul_subset", [set_rmul_subset]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("congr1", [congr1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`set_op1 (op (i g))`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then2 ("conjg_set_alt", [conjg_set_alt]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_opA", [set_opA]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("set_op_sing", [set_op_sing]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulIg", [mulIg]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_lmul1", [set_lmul1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma set_mulI *) +let set_mulI = Sections.section_proof ["S";"U"] +`S SUBSET G ==> U SUBSET G ==> + set_op1 i (set_op op S U) = set_op op (set_op1 i U) (set_op1 i S)` +[ + ((((repeat_tactic 1 9 (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] []))))) THEN (move ["sSG"]) THEN (move ["sUG"]) THEN (move ["x"])) THEN (split_tac)); + (BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["s"])) THEN (case THEN (move ["u"])) THEN (case THEN (move ["sS"])) THEN (case THEN (move ["uU"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> arg_tac (Arg_term (`i u`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`i s`))) (term_tac exists_tac))) THEN ((((use_arg_then2 ("mulI", [mulI]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("sUG", [])) (fun fst_arg -> (use_arg_then2 ("uU", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + (((THENL) (split_tac) [((use_arg_then2 ("u", [])) (term_tac exists_tac)); ((use_arg_then2 ("s", [])) (term_tac exists_tac))]) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["y"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["u"])) THEN (case THEN (move ["uU"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (case THEN ALL_TAC) THEN (case THEN (move ["s"])) THEN (case THEN (move ["sS"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["x_eq"])); + (((fun arg_tac -> arg_tac (Arg_term (`op s u`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulI", [mulI]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("sUG", [])) (fun fst_arg -> (use_arg_then2 ("uU", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("u", [])) (term_tac exists_tac))) THEN (done_tac)); +];; + +(* Lemma set_invgK *) +let set_invgK = Sections.section_proof ["S"] +`S SUBSET G ==> set_op1 i (set_op1 i S) = S` +[ + ((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] [])))))) THEN (move ["sSG"]) THEN (move ["x"])) THEN (split_tac)); + (BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["s"])) THEN (case THEN (move ["sS"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("invgK", [invgK]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["xS"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`i x`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("invgK", [invgK]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sSG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma group_invK *) +let group_invK = Sections.section_proof [] +`set_op1 i G = G` +[ + ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])) THEN ((THENL) (split_tac) [((case THEN (move ["s"])) THEN (case THEN ((move ["sG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); (move ["xG"])])); + ((((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`i x`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("invgK", [invgK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma group_lmulK *) +let group_lmulK = Sections.section_proof ["g"] +`g IN G ==> set_op1 (op g) G = G` +[ + ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN (move ["gG"]) THEN (move ["x"])) THEN ((THENL) (split_tac) [((case THEN (move ["s"])) THEN (case THEN ((move ["sG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); (move ["xG"])])); + ((((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`op (i g) x`))) (term_tac exists_tac)); + (((((use_arg_then2 ("mulgA", [mulgA]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mulgI", [mulgI]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mul1g", [mul1g]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma group_rmulK *) +let group_rmulK = Sections.section_proof ["g"] +`g IN G ==> set_op op G {g} = G` +[ + ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (move ["gG"]) THEN (move ["x"])) THEN ((THENL) (split_tac) [((case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN (move ["aG"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); (move ["xG"])])); + ((((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`op x (i g)`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("g", [])) (term_tac exists_tac))); + (((((use_arg_then2 ("mulgA", [mulgA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mulIg", [mulIg]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_group", [in_group]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulg1", [mulg1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma group_conjgK *) +let group_conjgK = Sections.section_proof ["g"] +`g IN G ==> set_op1 (conjg (op, i) g) G = G` +[ + ((BETA_TAC THEN (move ["gG"])) THEN ((((use_arg_then2 ("conjg_set_alt", [conjg_set_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("group_rmulK", [group_rmulK]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("group_lmulK", [group_lmulK]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("i_in_group", [i_in_group]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Groups *) +let e_in_group = Sections.finalize_theorem e_in_group;; +let in_group = Sections.finalize_theorem in_group;; +let i_in_group = Sections.finalize_theorem i_in_group;; +let mul1g = Sections.finalize_theorem mul1g;; +let mulg1 = Sections.finalize_theorem mulg1;; +let mulIg = Sections.finalize_theorem mulIg;; +let mulgI = Sections.finalize_theorem mulgI;; +let mulgA = Sections.finalize_theorem mulgA;; +let mulgK = Sections.finalize_theorem mulgK;; +let mulKg = Sections.finalize_theorem mulKg;; +let i_uniq = Sections.finalize_theorem i_uniq;; +let invgK = Sections.finalize_theorem invgK;; +let invg1 = Sections.finalize_theorem invg1;; +let mulI = Sections.finalize_theorem mulI;; +let mulg_leftI = Sections.finalize_theorem mulg_leftI;; +let mulg_rightI = Sections.finalize_theorem mulg_rightI;; +let mulg_left = Sections.finalize_theorem mulg_left;; +let mulg_right = Sections.finalize_theorem mulg_right;; +let invg_e = Sections.finalize_theorem invg_e;; +let subgroup_alt = Sections.finalize_theorem subgroup_alt;; +let subgroup_group = Sections.finalize_theorem subgroup_group;; +let subgroup_e = Sections.finalize_theorem subgroup_e;; +let set_opK = Sections.finalize_theorem set_opK;; +let normal_conj2 = Sections.finalize_theorem normal_conj2;; +let set_opA = Sections.finalize_theorem set_opA;; +let coset_subset = Sections.finalize_theorem coset_subset;; +let coset_e = Sections.finalize_theorem coset_e;; +let coset_eq_e = Sections.finalize_theorem coset_eq_e;; +let left_mul_coset = Sections.finalize_theorem left_mul_coset;; +let set_lmul_subset = Sections.finalize_theorem set_lmul_subset;; +let set_rmul_subset = Sections.finalize_theorem set_rmul_subset;; +let set_lmul_has_size = Sections.finalize_theorem set_lmul_has_size;; +let set_rmul_has_size = Sections.finalize_theorem set_rmul_has_size;; +let set_lmul_card = Sections.finalize_theorem set_lmul_card;; +let set_rmul_card = Sections.finalize_theorem set_rmul_card;; +let set_lrmul_card = Sections.finalize_theorem set_lrmul_card;; +let set_llmul_card = Sections.finalize_theorem set_llmul_card;; +let set_lmul1 = Sections.finalize_theorem set_lmul1;; +let set_rmul1 = Sections.finalize_theorem set_rmul1;; +let conjg_in = Sections.finalize_theorem conjg_in;; +let mul_conjg = Sections.finalize_theorem mul_conjg;; +let conjg_mul = Sections.finalize_theorem conjg_mul;; +let inv_conjg = Sections.finalize_theorem inv_conjg;; +let conj1g = Sections.finalize_theorem conj1g;; +let conjg1 = Sections.finalize_theorem conjg1;; +let conjg_inj = Sections.finalize_theorem conjg_inj;; +let conjg_set_subset = Sections.finalize_theorem conjg_set_subset;; +let conj1g_set = Sections.finalize_theorem conj1g_set;; +let mul_conjg_set = Sections.finalize_theorem mul_conjg_set;; +let conjg_set_has_size = Sections.finalize_theorem conjg_set_has_size;; +let conjg_set_card = Sections.finalize_theorem conjg_set_card;; +let conjg_set_card2 = Sections.finalize_theorem conjg_set_card2;; +let conjg_set_equiv = Sections.finalize_theorem conjg_set_equiv;; +let set_mulI = Sections.finalize_theorem set_mulI;; +let set_invgK = Sections.finalize_theorem set_invgK;; +let group_invK = Sections.finalize_theorem group_invK;; +let group_lmulK = Sections.finalize_theorem group_lmulK;; +let group_rmulK = Sections.finalize_theorem group_rmulK;; +let group_conjgK = Sections.finalize_theorem group_conjgK;; +Sections.end_section "Groups";; + +(* Lemma subgroup_alt2 *) +let subgroup_alt2 = Sections.section_proof ["G";"op";"i";"e";"H"] +`group (G, op, i, e) ==> + (subgroup op i H G <=> (H SUBSET G /\ group (H, op, i, e)))` +[ + ((BETA_TAC THEN (move ["grG"])) THEN ((THENL) (split_tac) [(move ["subHG"]); (case THEN ((move ["sHG"]) THEN (move ["grH"])))])); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (split_tac)); + (((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ((move ["xH"]) THEN (move ["yH"])))); + (((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xH", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Normal *) +Sections.begin_section "Normal";; +(Sections.add_section_var (mk_var ("G", (`:A->bool`))));; +(Sections.add_section_var (mk_var ("op", (`:A->A->A`))));; +(Sections.add_section_var (mk_var ("i", (`:A->A`))));; +(Sections.add_section_var (mk_var ("e", (`:A`))));; +(Sections.add_section_var (mk_var ("H", (`:A->bool`))));; +(Sections.add_section_hyp "grG" (`group (G,op,i,e)`));; + +(* Lemma group_subgroup *) +let group_subgroup = Sections.section_proof [] +`subgroup op i G G` +[ + (((((fun arg_tac -> (use_arg_then2 ("subgroup_alt2", [subgroup_alt2])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET_REFL", [SUBSET_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma group_normal *) +let group_normal = Sections.section_proof [] +`normal op i G G` +[ + (((((use_arg_then2 ("normal", [normal]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("group_subgroup", [group_subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ((move ["xG"]) THEN (move ["yG"])))); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma subgroup_conjg *) +let subgroup_conjg = Sections.section_proof ["g"] +`subgroup op i H G ==> g IN G ==> + subgroup op i (set_op1 (conjg (op, i) g) H) G` +[ + (BETA_TAC THEN (move ["subH"]) THEN (move ["gG"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"]))); + ((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"]))); + (((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("conjg_set_subset", [conjg_set_subset])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + (((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("conjg1", [conjg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["h1"])) THEN (case THEN (move ["h1H"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (case THEN (move ["h2"])) THEN (case THEN (move ["h2H"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`op h1 (i h2)`))) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + (((((fun arg_tac -> (use_arg_then2 ("inv_conjg", [inv_conjg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_trans", [in_trans])) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("conjg_mul", [conjg_mul])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_trans", [in_trans])) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma subgroup_trans *) +let subgroup_trans = Sections.section_proof ["H";"K"] +`subgroup op i H K ==> subgroup op i K G ==> subgroup op i H G` +[ + (BETA_TAC THEN (move ["subHK"])); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("subgroup_alt2", [subgroup_alt2])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["sKG"]) THEN (move ["grK"])))); + ((((use_arg_then2 ("subHK", [])) (disch_tac [])) THEN (clear_assumption "subHK") THEN BETA_TAC) THEN ((((fun arg_tac -> (use_arg_then2 ("subgroup_alt2", [subgroup_alt2])) (fun fst_arg -> (use_arg_then2 ("grK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["sHK"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("SUBSET_TRANS", [SUBSET_TRANS])) (fun fst_arg -> (use_arg_then2 ("sHK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +];; + +(* Lemma cosets_full_preimage0 *) +let cosets_full_preimage0 = Sections.section_proof ["K"] +`subgroup op i K G ==> H SUBSET K ==> ~(H = {}) ==> + K = {g | g IN G /\ coset op g H IN (cosets op K H)}` +[ + (((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (move ["subKG"]) THEN (move ["sHK"]) THEN (case THEN (move ["h"])) THEN (move ["hH"])); + ((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sKG"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grK"]))); + (((((use_arg_then2 ("SUBSET_ANTISYM_EQ", [SUBSET_ANTISYM_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("cosets_full_preimage_sub", [cosets_full_preimage_sub]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (move ["k"])); + (((((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["g"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["gG"])) THEN (case THEN (move ["x"])) THEN (case THEN (move ["xK"]))); + (((repeat_tactic 1 9 (((use_arg_then2 ("coset", [coset]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUBSET_ANTISYM_EQ", [SUBSET_ANTISYM_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN ((move ["h1"]) THEN (move ["_"]))) THEN (move ["_"])); + ((THENL_FIRST) ((((fun arg_tac -> (use_arg_then2 ("h1", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`op g h`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)) (((use_arg_then2 ("h", [])) (term_tac exists_tac)) THEN (done_tac))); + (BETA_TAC THEN (case THEN (move ["y"])) THEN (case THEN (move ["yH"]))); + ((((fun arg_tac -> (use_arg_then2 ("mulg_left", [mulg_left])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_subgroup", [in_subgroup])) (fun fst_arg -> (use_arg_then2 ("subKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("xK", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("sHK", [])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("sHK", [])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("xK", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sHK", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma preimages_eq0 *) +let preimages_eq0 = Sections.section_proof ["K1";"K2"] +`subgroup op i K1 G ==> subgroup op i K2 G ==> + H SUBSET K1 ==> H SUBSET K2 ==> ~(H = {}) ==> + (cosets op K1 H = cosets op K2 H <=> K1 = K2)` +[ + ((BETA_TAC THEN (move ["subK1G"]) THEN (move ["subK2G"]) THEN (move ["sHK1"]) THEN (move ["sHK2"]) THEN (move ["nH0"])) THEN ((THENL) (split_tac) [(move ["c_eq"]); ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))])); + (((((fun arg_tac -> (use_arg_then2 ("cosets_full_preimage0", [cosets_full_preimage0])) (fun fst_arg -> (use_arg_then2 ("K1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("cosets_full_preimage0", [cosets_full_preimage0])) (fun fst_arg -> (use_arg_then2 ("K2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma normal_alt *) +let normal_alt = Sections.section_proof [] +`normal op i H G <=> subgroup op i H G /\ (!g. g IN G ==> set_op1 (conjg (op, i) g) H = H)` +[ + ((((use_arg_then2 ("normal", [normal]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andb_id2l", [andb_id2l])) (disch_tac [])) THEN (clear_assumption "andb_id2l") THEN (DISCH_THEN apply_tac) THEN (move ["subH"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"]))); + ((fun arg_tac -> (use_arg_then2 ("in_subgroup", [in_subgroup])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"]))); + ((THENL) (split_tac) [((move ["h1"]) THEN (move ["g"]) THEN (move ["gG"])); ((move ["h1"]) THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ((move ["xG"]) THEN (move ["yH"]))))]); + ((THENL_FIRST) ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] []))))) THEN (move ["h"])) THEN ((THENL) (split_tac) [((case THEN (move ["s"])) THEN (case THEN ((move ["sH"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); (move ["hH"])])) ((((use_arg_then2 ("h1", [])) (disch_tac [])) THEN (clear_assumption "h1") THEN (DISCH_THEN apply_tac)) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`conjg (op, i) (i g) h`))) (term_tac exists_tac)); + ((((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("h1", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("conjg", [conjg]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("mul_conjg", [mul_conjg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("conj1g", [conj1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((fun arg_tac -> (use_arg_then2 ("h1", [])) (fun fst_arg -> (use_arg_then2 ("xG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("conjg", [conjg]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (done_tac)); +];; +(Sections.add_section_hyp "normH" (`normal op i H G`));; + +(* Lemma cosets_full_preimage *) +let cosets_full_preimage = Sections.section_proof ["K"] +`subgroup op i K G ==> H SUBSET K ==> + K = {g | g IN G /\ coset op g H IN (cosets op K H)}` +[ + ((BETA_TAC THEN (move ["subKG"]) THEN (move ["sHK"])) THEN (((use_arg_then2 ("cosets_full_preimage0", [cosets_full_preimage0])) (disch_tac [])) THEN (clear_assumption "cosets_full_preimage0") THEN (DISCH_THEN apply_tac))); + ((((use_arg_then2 ("sHK", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subKG", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("normH", [])) (disch_tac [])) THEN (clear_assumption "normH") THEN BETA_TAC) THEN ((((use_arg_then2 ("normal", [normal]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma preimages_eq *) +let preimages_eq = Sections.section_proof ["K1";"K2"] +`subgroup op i K1 G ==> subgroup op i K2 G ==> + H SUBSET K1 ==> H SUBSET K2 ==> (cosets op K1 H = cosets op K2 H <=> K1 = K2)` +[ + ((BETA_TAC THEN (move ["sub1"]) THEN (move ["sub2"]) THEN (move ["s1"]) THEN (move ["s2"])) THEN (((use_arg_then2 ("preimages_eq0", [preimages_eq0])) (disch_tac [])) THEN (clear_assumption "preimages_eq0") THEN (DISCH_THEN apply_tac))); + ((((use_arg_then2 ("normH", [])) (disch_tac [])) THEN (clear_assumption "normH") THEN BETA_TAC) THEN ((((use_arg_then2 ("normal", [normal]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sub1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sub2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s2", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma normal_conjg *) +let normal_conjg = Sections.section_proof ["g"] +`g IN G ==> set_op1 (conjg (op, i) g) H = H` +[ + ((fun arg_tac -> (use_arg_then2 ("in_subgroup", [in_subgroup])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"]))); + ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN (move ["gG"]) THEN (move ["x"])) THEN ((THENL) (split_tac) [((case THEN (move ["s"])) THEN (case THEN ((move ["sH"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); (move ["xH"])])); + ((((fun arg_tac -> (use_arg_then2 ("normal_conj", [normal_conj])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`conjg (op, i) (i g) x`))) (term_tac exists_tac)); + ((((fun arg_tac -> (use_arg_then2 ("normal_conj", [normal_conj])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mul_conjg", [mul_conjg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("conj1g", [conj1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma left_right_coset *) +let left_right_coset = Sections.section_proof ["x"] +`x IN G ==> coset op x H = set_op op H {x}` +[ + (BETA_TAC THEN (move ["xG"])); + (((((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("conjg_set_equiv", [conjg_set_equiv])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("normal_conjg", [normal_conjg]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma coset_mul_normal *) +let coset_mul_normal = Sections.section_proof ["x";"y"] +`x IN G ==> y IN G ==> + set_op op (coset op x H) (coset op y H) = coset op (op x y) H` +[ + (BETA_TAC THEN (move ["xG"]) THEN (move ["yG"])); + ((fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["subH"]))); + ((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("set_opA", [set_opA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("set_lmul_subset", [set_lmul_subset])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("set_opA", [set_opA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [(`set_op op _1 {y}`)]))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("left_right_coset", [left_right_coset]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("set_opA", [set_opA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("set_op_sing", [set_op_sing]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("set_opA", [set_opA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("set_opK", [set_opK])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma coset_inv_normal *) +let coset_inv_normal = Sections.section_proof ["x"] +`x IN G ==> set_op1 i (coset op x H) = coset op (i x) H` +[ + (BETA_TAC THEN (move ["xG"])); + ((fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["subH"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"]))); + ((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"]))); + ((((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("set_mulI", [set_mulI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("group_invK", [group_invK])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_op1_sing", [set_op1_sing]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("left_right_coset", [left_right_coset]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma quotient_group *) +let quotient_group = Sections.section_proof [] +`group (cosets op G H, set_op op, set_op1 i, H)` +[ + (((fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["subH"])); + (((fun arg_tac -> (use_arg_then2 ("in_subgroup", [in_subgroup])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["sHG"])); + (((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["SHG"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["grH"])); + (((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] [])))); + ((repeat_tactic 0 6 ((split_tac))) THEN ((((use_arg_then2 ("cosets", [cosets]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["u"])) THEN (case THEN ((move ["uG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (case THEN (move ["v"])) THEN (case THEN ((move ["vG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((fun arg_tac -> arg_tac (Arg_term (`op u v`))) (term_tac exists_tac)) THEN ((repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("coset_mul_normal", [coset_mul_normal]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (move ["x"]) THEN (case THEN (move ["u"])) THEN (case THEN ((move ["uG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((fun arg_tac -> arg_tac (Arg_term (`i u`))) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)))); + ((((use_arg_then2 ("coset_inv_normal", [coset_inv_normal]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("coset_e", [coset_e])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (move ["c"]) THEN (case THEN (move ["x"])) THEN (case THEN ((move ["xG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((fun arg_tac -> (use_arg_then2 ("coset_e", [coset_e])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2; 4] [(`H`)]))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("coset_mul_normal", [coset_mul_normal]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("mulg1", [mulg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (move ["c"]) THEN (case THEN (move ["x"])) THEN (case THEN ((move ["xG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("coset_inv_normal", [coset_inv_normal]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("coset_mul_normal", [coset_mul_normal]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("coset_e", [coset_e])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (move ["A"]) THEN (move ["B"]) THEN (move ["C"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["a"])) THEN (case THEN ((move ["aG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (case THEN ALL_TAC) THEN (case THEN (move ["b"])) THEN (case THEN ((move ["bG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (case THEN (move ["c"])) THEN (case THEN ((move ["cG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((fun arg_tac -> (use_arg_then2 ("set_opA", [set_opA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("coset_subset", [coset_subset])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma subgroup_of_quotient *) +let subgroup_of_quotient = Sections.section_proof ["K1"] +`subgroup (set_op op) (set_op1 i) K1 (cosets op G H) <=> + ?K. subgroup op i K G /\ normal op i H K /\ cosets op K H = K1` +[ + ((THENL_ROT (-1)) (split_tac)); + (BETA_TAC THEN (case THEN (move ["K"])) THEN (case THEN ((move ["subKG"]) THEN (case THEN ((move ["nHK"]) THEN (move ["eqK"])))))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grK"]))); + ((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqK", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ((THENL) (split_tac) [((move ["c"]) THEN (case THEN (move ["g"])) THEN (case THEN (move ["gK"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); ALL_TAC])); + (((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("in_subgroup", [in_subgroup])) (fun fst_arg -> (use_arg_then2 ("subKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((THENL_FIRST) (split_tac) ((((fun arg_tac -> arg_tac (Arg_term (`coset op e H`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("e", [])) (term_tac exists_tac))) THEN (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (BETA_TAC THEN (move ["c1"]) THEN (move ["c2"]) THEN (case THEN ((case THEN (move ["g1"])) THEN (case THEN ((move ["g1K"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) THEN (case THEN (move ["g2"])) THEN (case THEN ((move ["g2K"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((fun arg_tac -> arg_tac (Arg_term (`op g1 (i g2)`))) (term_tac exists_tac)); + ((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("coset_inv_normal", [coset_inv_normal]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("coset_mul_normal", [coset_mul_normal]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_subgroup", [in_subgroup])) (fun fst_arg -> (use_arg_then2 ("subKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (BETA_TAC THEN (move ["subK1"])); + ((use_arg_then2 ("quotient_group", [quotient_group])) (fun arg -> thm_tac MP_TAC arg THEN (move ["grG1"]))); + ((fun arg_tac -> arg_tac (Arg_term (`{g | g IN G /\ coset op g H IN K1}`))) (term_tac (set_tac "K"))); + ((use_arg_then2 ("K", [])) (term_tac exists_tac)); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subK1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grK1"]))); + ((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grK1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["eK1"]))); + ((fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["subH"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"]))); + ((fun arg_tac -> arg_tac (Arg_term (`H SUBSET K`))) (term_tac (have_gen_tac [](move ["sHK"])))); + (((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("K_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["h"]) THEN (move ["hH"])); + (((use_arg_then2 ("h", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("coset_eq_e", [coset_eq_e])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("eK1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("in_subgroup", [in_subgroup])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`K SUBSET G`))) (term_tac (have_gen_tac [](move ["sKG"])))); + ((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("K_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["g"]) THEN (case THEN (move ["g'"])) THEN (case THEN (move ["in_h"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`subgroup op i K G`))) (term_tac (have_gen_tac [](move ["subKG"]))))); + ((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subK1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("subKG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("normal_subset_trans", [normal_subset_trans])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("K_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((THENL_FIRST) ((BETA_TAC THEN (move ["inK1"]) THEN (move ["c"])) THEN ((THENL) (split_tac) [ALL_TAC; (move ["cK1"])])) ((BETA_TAC THEN (case THEN (move ["g'"])) THEN (case THEN (case THEN (move ["g"]))) THEN (case THEN ((case THEN ((move ["gG"]) THEN (move ["cK1"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["c_eq"])) THEN (done_tac))); + (((fun arg_tac -> (use_arg_then2 ("inK1", [])) (fun fst_arg -> (use_arg_then2 ("cK1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["g"])) THEN (case THEN ((move ["gG"]) THEN (move ["eq"])))); + (((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sKG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("K_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (split_tac)); + ((((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("e", [])) (term_tac exists_tac))) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("coset_e", [coset_e])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ((case THEN (move ["h"])) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["hG"]) THEN (move ["chK1"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (case THEN (move ["k"])) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["kG"]) THEN (move ["ckK1"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`op h (i k)`))) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)))); + ((((use_arg_then2 ("coset_mul_normal", [coset_mul_normal]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("coset_inv_normal", [coset_inv_normal]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grK1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("chK1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grK1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Normal *) +let group_subgroup = Sections.finalize_theorem group_subgroup;; +let group_normal = Sections.finalize_theorem group_normal;; +let subgroup_conjg = Sections.finalize_theorem subgroup_conjg;; +let subgroup_trans = Sections.finalize_theorem subgroup_trans;; +let cosets_full_preimage0 = Sections.finalize_theorem cosets_full_preimage0;; +let preimages_eq0 = Sections.finalize_theorem preimages_eq0;; +let normal_alt = Sections.finalize_theorem normal_alt;; +let cosets_full_preimage = Sections.finalize_theorem cosets_full_preimage;; +let preimages_eq = Sections.finalize_theorem preimages_eq;; +let normal_conjg = Sections.finalize_theorem normal_conjg;; +let left_right_coset = Sections.finalize_theorem left_right_coset;; +let coset_mul_normal = Sections.finalize_theorem coset_mul_normal;; +let coset_inv_normal = Sections.finalize_theorem coset_inv_normal;; +let quotient_group = Sections.finalize_theorem quotient_group;; +let subgroup_of_quotient = Sections.finalize_theorem subgroup_of_quotient;; +Sections.end_section "Normal";; + +(* Section Normalizer *) +Sections.begin_section "Normalizer";; +(Sections.add_section_var (mk_var ("G", (`:A->bool`))));; +(Sections.add_section_var (mk_var ("op", (`:A->A->A`))));; +(Sections.add_section_var (mk_var ("i", (`:A->A`))));; +(Sections.add_section_var (mk_var ("e", (`:A`))));; +(Sections.add_section_var (mk_var ("H", (`:A->bool`))));; + +(* Lemma image_eq *) +let image_eq = Sections.section_proof [] +`!f g H. (!x. x IN H ==> f x = g x) ==> IMAGE (f:A->A) H = IMAGE g H` +[ + ((BETA_TAC THEN (move ["f"]) THEN (move ["g"]) THEN (move ["H"]) THEN (move ["eq"])) THEN (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))))) THEN (move ["xx"])) THEN ((split_tac) THEN (case THEN (move ["yy"])) THEN (case THEN ((move ["eq2"]) THEN (move ["in_s"]))))); + (((use_arg_then2 ("yy", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("eq2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((use_arg_then2 ("yy", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("eq2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma normalizer_subset *) +let normalizer_subset = Sections.section_proof [] +`normalizer op i G H SUBSET G` +[ + ((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("normalizer", [normalizer]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"]) THEN (case THEN (move ["g"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["gG"])) THEN (move ["_"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(Sections.add_section_hyp "grG" (`group (G,op,i,e)`));; + +(* Lemma set_op_subset *) +let set_op_subset = Sections.section_proof ["A";"B"] +`A SUBSET G ==> B SUBSET G ==> set_op op A B SUBSET G` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_op", [set_op]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["sAG"]) THEN (move ["sBG"]) THEN (move ["g"]) THEN (case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN ((case THEN ((move ["aA"]) THEN (move ["bB"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("sBG", [])) (fun fst_arg -> (use_arg_then2 ("b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sAG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma in_normalizer0 *) +let in_normalizer0 = Sections.section_proof ["g";"H"] +`g IN normalizer op i G H <=> g IN G /\ H = set_op1 (conjg (op, i) g) H` +[ + (((((use_arg_then2 ("normalizer", [normalizer]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andb_id2l", [andb_id2l])) (disch_tac [])) THEN (clear_assumption "andb_id2l") THEN (DISCH_THEN apply_tac) THEN (move ["gG"])) THEN ((THENL) (split_tac) [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))]) THEN (done_tac)); +];; + +(* Lemma normalizerK *) +let normalizerK = Sections.section_proof [] +`normalizer op i G G = G` +[ + ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_normalizer0", [in_normalizer0]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])) THEN ((THENL) (split_tac) [((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); (move ["xG"])])); + (((((fun arg_tac -> (use_arg_then2 ("normal_conjg", [normal_conjg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("group_normal", [group_normal])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma normalizer_norm *) +let normalizer_norm = Sections.section_proof [] +`normal op i H G ==> normalizer op i G H = G` +[ + ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_normalizer0", [in_normalizer0]))(thm_tac (new_rewrite [] []))))) THEN (move ["normH"]) THEN (move ["x"])) THEN ((THENL) (split_tac) [((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); (move ["xG"])])); + ((((fun arg_tac -> (use_arg_then2 ("normal_conjg", [normal_conjg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma normalizer_subgroup *) +let normalizer_subgroup = Sections.section_proof [] +`H SUBSET G ==> subgroup op i (normalizer op i G H) G` +[ + ((((((fun arg_tac -> (use_arg_then2 ("subgroup_alt", [subgroup_alt])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_normalizer0", [in_normalizer0]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("normalizer_subset", [normalizer_subset]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["sHG"])) THEN (repeat_tactic 1 9 ((split_tac)))); + (((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("conj1g_set", [conj1g_set])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["xG"])) THEN (move ["eq_x"]) THEN (case THEN (move ["yG"])) THEN (move ["eq_y"])); + (((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mul_conjg_set", [mul_conjg_set])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eq_x", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_y", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (BETA_TAC THEN (move ["x"]) THEN (case THEN (move ["xG"])) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("congr1", [congr1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`set_op1 (conjg (op, i) (i x))`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> (use_arg_then2 ("mul_conjg_set", [mul_conjg_set])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("conj1g_set", [conj1g_set])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(Sections.add_section_hyp "subH" (`subgroup op i H G`));; + +(* Lemma subset_normalizer *) +let subset_normalizer = Sections.section_proof [] +`H SUBSET (normalizer op i G H)` +[ + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"]))); + (((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_normalizer0", [in_normalizer0]))(thm_tac (new_rewrite [] []))))) THEN (move ["h"]) THEN (move ["hH"])); + (((((fun arg_tac -> (use_arg_then2 ("group_conjgK", [group_conjgK])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("in_subgroup", [in_subgroup])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma normal_in_normalizer *) +let normal_in_normalizer = Sections.section_proof [] +`normal op i H (normalizer op i G H)` +[ + ((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("normalizer_subgroup", [normalizer_subgroup])) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grN"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"]))); + (((((fun arg_tac -> (use_arg_then2 ("normal_alt", [normal_alt])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("subgroup_alt2", [subgroup_alt2])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subset_normalizer", [subset_normalizer]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("grH", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["g"])); + (((((use_arg_then2 ("in_normalizer0", [in_normalizer0]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma in_normalizer *) +let in_normalizer = Sections.section_proof ["g"] +`g IN normalizer op i G H <=> g IN G /\ coset op g H = set_op op H {g}` +[ + ((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"]))); + ((((use_arg_then2 ("in_normalizer0", [in_normalizer0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andb_id2l", [andb_id2l])) (disch_tac [])) THEN (clear_assumption "andb_id2l") THEN (DISCH_THEN apply_tac) THEN (move ["gG"]))); + (((((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (use_arg_then2 ("H", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("conjg_set_equiv", [conjg_set_equiv])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] []))))) THEN ((split_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Normalizer *) +let image_eq = Sections.finalize_theorem image_eq;; +let normalizer_subset = Sections.finalize_theorem normalizer_subset;; +let set_op_subset = Sections.finalize_theorem set_op_subset;; +let in_normalizer0 = Sections.finalize_theorem in_normalizer0;; +let normalizerK = Sections.finalize_theorem normalizerK;; +let normalizer_norm = Sections.finalize_theorem normalizer_norm;; +let normalizer_subgroup = Sections.finalize_theorem normalizer_subgroup;; +let subset_normalizer = Sections.finalize_theorem subset_normalizer;; +let normal_in_normalizer = Sections.finalize_theorem normal_in_normalizer;; +let in_normalizer = Sections.finalize_theorem in_normalizer;; +Sections.end_section "Normalizer";; + +(* Section Lagrange *) +Sections.begin_section "Lagrange";; +(Sections.add_section_var (mk_var ("G", (`:A->bool`))));; +(Sections.add_section_var (mk_var ("e", (`:A`))));; +(Sections.add_section_var (mk_var ("op", (`:A -> A -> A`))));; +(Sections.add_section_var (mk_var ("i", (`:A -> A`))));; +(Sections.add_section_var (mk_var ("n", (`:num`))));; +(Sections.add_section_hyp "grG" (`group (G,op,i,e)`));; +(Sections.add_section_var (mk_var ("H", (`:A->bool`))));; +(Sections.add_section_hyp "subH" (`subgroup op i H G`));; + +(* Lemma coset_eq *) +let coset_eq = Sections.section_proof ["h";"x"] +`x IN G ==> h IN H ==> coset op (op x h) H = coset op x H` +[ + (BETA_TAC THEN (move ["xG"]) THEN (move ["hH"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"]))); + ((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_op_sing", [set_op_sing]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("set_opA", [set_opA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("xG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_trans", [in_trans])) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((fun arg_tac -> (use_arg_then2 ("group_lmulK", [group_lmulK])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma coset_inter *) +let coset_inter = Sections.section_proof ["x";"y"] +`x IN G ==> y IN G ==> ~(coset op x H = coset op y H) ==> + coset op x H INTER coset op y H = {}` +[ + (BETA_TAC THEN (move ["xG"]) THEN (move ["yG"]) THEN (move ["nc"])); + (((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["SHG"])); + ((((use_arg_then2 ("SHG", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["sHG"]))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["grH"])); + ((((use_arg_then2 ("negbK", [negbK]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nc", [])) (disch_tac [])) THEN (clear_assumption "nc") THEN BETA_TAC) THEN ((((use_arg_then2 ("CONTRAPOS_THM", [CONTRAPOS_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))))); + (BETA_TAC THEN (case THEN (move ["u"]))); + (((repeat_tactic 2 0 (((use_arg_then2 ("coset", [coset]))(thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (BETA_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["h1"])) THEN (case THEN ((move ["h1H"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (case THEN (move ["h2"])) THEN (case THEN (move ["h2H"])) THEN (move ["eq"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`op (op x h1) (i h1) = op (op y h2) (i h1)`))) (term_tac (have_gen_tac []ALL_TAC))) ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("mulgA", [mulgA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("xG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("yG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulg1", [mulg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`op h2 _`))) (term_tac (set_tac "h"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`h IN H`))) (term_tac (have_gen_tac [](move ["hH"])))) (((((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((((use_arg_then2 ("coset_eq", [coset_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma x_in_coset *) +let x_in_coset = Sections.section_proof ["x"] +`x IN G ==> x IN coset op x H` +[ + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["grH"])); + ((BETA_TAC THEN (move ["xG"])) THEN ((((use_arg_then2 ("coset", [coset]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mulg1", [mulg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma cosets_unions *) +let cosets_unions = Sections.section_proof [] +`G = UNIONS (cosets op G H)` +[ + (((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["SHG"])); + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNIONS", [IN_UNIONS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (move ["x"]) THEN (simp_tac)) THEN (split_tac)); + (BETA_TAC THEN (move ["xG"])); + (((fun arg_tac -> arg_tac (Arg_term (`coset op x H`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("x_in_coset", [x_in_coset]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)))); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["c"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["y"])) THEN (case THEN ((move ["yG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("coset", [coset]))(thm_tac (new_rewrite [] [])))) THEN (((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["u"])) THEN (case THEN ((move ["uH"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + ((((use_arg_then2 ("SHG", [])) (disch_tac [])) THEN (clear_assumption "SHG") THEN BETA_TAC) THEN ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["sHG"]))); + (((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma coset_equiv *) +let coset_equiv = Sections.section_proof ["g1";"g2"] +`g1 IN G ==> g2 IN G ==> + (coset op g1 H = coset op g2 H <=> op (i g2) g1 IN H)` +[ + (BETA_TAC THEN (move ["g1G"]) THEN (move ["g2G"])); + ((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"]))); + (((repeat_tactic 1 9 (((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac)); + ((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("congr1", [congr1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`set_op op {i g2}`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("set_opA", [set_opA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_op_sing", [set_op_sing]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(gsym_then (thm_tac (new_rewrite [] []))))))); + ((((((fun arg_tac -> (use_arg_then2 ("set_lmul1", [set_lmul1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mulg1", [mulg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))))) THEN (move ["h1"]) THEN (move ["x"])) THEN (split_tac)); + (BETA_TAC THEN (case THEN (move ["g"])) THEN (case THEN (move ["h"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (case THEN (move ["hH"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("g2", [])) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`op (op (i g2) g1) h`))) (term_tac exists_tac))); + ((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("mulgA", [mulgA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("g2G", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_trans", [in_trans])) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["g"])) THEN (case THEN (move ["h"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (case THEN (move ["hH"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("g1", [])) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`op (i (op (i g2) g1)) h`))) (term_tac exists_tac))); + ((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("mulI", [mulI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("invgK", [invgK])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("mulgA", [mulgA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("g1G", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("in_trans", [in_trans])) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma coset_not_empty *) +let coset_not_empty = Sections.section_proof ["g"] +`g IN G ==> ~(coset op g H = {})` +[ + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"]))); + ((BETA_TAC THEN (move ["gG"])) THEN ((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("coset", [coset]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("g", [])) (term_tac exists_tac))); + (((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mulg1", [mulg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(Sections.add_section_hyp "finG" (`FINITE G`));; + +(* Lemma subgroup_size *) +let subgroup_size = Sections.section_proof [] +`H HAS_SIZE (CARD H)` +[ + (((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((use_arg_then2 ("FINITE_HAS_SIZE", [FINITE_HAS_SIZE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["SHG"])); + (((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (disch_tac [])) THEN (clear_assumption "FINITE_SUBSET") THEN (DISCH_THEN apply_tac)); + (((use_arg_then2 ("G", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("SHG", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma coset_card *) +let coset_card = Sections.section_proof ["x"] +`x IN G ==> CARD (coset op x H) = CARD H` +[ + ((BETA_TAC THEN (move ["xG"])) THEN ((((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("set_lmul_card", [set_lmul_card])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"]))); + (((((use_arg_then2 ("xG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN ((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("G", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma finite_index *) +let finite_index = Sections.section_proof [] +`FINITE (cosets op G H)` +[ + ((fun arg_tac -> arg_tac (Arg_term (`cosets op G H = IMAGE (\x. coset op x H) G`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IMAGE", [IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac)); + ((((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma LaGrange *) +let LaGrange = Sections.section_proof [] +`CARD G = CARD (cosets op G H) * CARD H` +[ + ((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"]))); + ((THENL_ROT (-1)) ((((use_arg_then2 ("cosets_unions", [cosets_unions]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("CARD_UNIONS", [CARD_UNIONS]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("NSUM_CONST", [NSUM_CONST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("finite_index", [finite_index]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((use_arg_then2 ("NSUM_EQ", [NSUM_EQ])) (thm_tac apply_tac)); + ((BETA_TAC THEN (move ["c"])) THEN (((((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN ((move ["xG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + ((((use_arg_then2 ("coset_card", [coset_card]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((use_arg_then2 ("finite_index", [finite_index]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)); + ((BETA_TAC THEN (move ["c"])) THEN (((((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN ((move ["xG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + ((((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (disch_tac [])) THEN (clear_assumption "FINITE_SUBSET") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then2 ("G", [])) (term_tac exists_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("coset_subset", [coset_subset])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((BETA_TAC THEN (move ["c1"]) THEN (move ["c2"])) THEN (((((use_arg_then2 ("cosets", [cosets]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["x"])) THEN (case THEN ((move ["xG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (case THEN ALL_TAC) THEN (case THEN (move ["y"])) THEN (case THEN ((move ["yG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["nc"]))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("coset_inter", [coset_inter])) (fun fst_arg -> (use_arg_then2 ("xG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("yG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("nc", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +];; + +(* Finalization of the section Lagrange *) +let coset_eq = Sections.finalize_theorem coset_eq;; +let coset_inter = Sections.finalize_theorem coset_inter;; +let x_in_coset = Sections.finalize_theorem x_in_coset;; +let cosets_unions = Sections.finalize_theorem cosets_unions;; +let coset_equiv = Sections.finalize_theorem coset_equiv;; +let coset_not_empty = Sections.finalize_theorem coset_not_empty;; +let subgroup_size = Sections.finalize_theorem subgroup_size;; +let coset_card = Sections.finalize_theorem coset_card;; +let finite_index = Sections.finalize_theorem finite_index;; +let LaGrange = Sections.finalize_theorem LaGrange;; +Sections.end_section "Lagrange";; + +(* Section Z_group *) +Sections.begin_section "Z_group";; +let add_mod = new_definition `add_mod p m n = (m + n) MOD p`;; +let inv_add_mod = new_definition `inv_add_mod p x = if x = 0 then 0 else p - x`;; + +(* Lemma grZ *) +let grZ = Sections.section_proof ["n"] +`0 < n ==> group({i:num | i < n}, (add_mod n), inv_add_mod n, 0)` +[ + ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("lt0n_neq0", [lt0n_neq0])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["n0"])); + ((((use_arg_then2 ("group", [group]))(thm_tac (new_rewrite [] [])))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("add_mod", [add_mod]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("inv_add_mod", [inv_add_mod]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (repeat_tactic 0 6 ((split_tac)))); + ((((fun arg_tac -> (use_arg_then2 ("DIVISION", [DIVISION])) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); + ((case THEN (simp_tac)) THEN (((use_arg_then2 ("n0", [])) (disch_tac [])) THEN (clear_assumption "n0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("n0", [])) (disch_tac [])) THEN (clear_assumption "n0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((BETA_TAC THEN (move ["x"]) THEN (move ["xn"])) THEN ((((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addn0", [addn0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MOD_LT", [MOD_LT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) (((THENL) case [ALL_TAC; ((move ["m"]) THEN (move ["lt_m_n"]))]) THEN (simp_tac)) (((((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MOD_0", [MOD_0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("eqS0", [eqS0]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("subnKC", [subnKC]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("subnK", [subnK]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("muln1", [muln1])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1; 3] []))))) THEN (((use_arg_then2 ("MOD_MULT", [MOD_MULT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (move ["z"]) THEN (case THEN ((move ["xn"]) THEN (case THEN ((move ["yn"]) THEN (move ["zn"])))))); + (((((fun arg_tac -> (use_arg_then2 ("MOD_LT", [MOD_LT])) (fun fst_arg -> (use_arg_then2 ("xn", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("MOD_LT", [MOD_LT])) (fun fst_arg -> (use_arg_then2 ("zn", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("MOD_ADD_MOD", [MOD_ADD_MOD]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("addnA", [addnA]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma testZ *) +let testZ = Sections.section_proof ["n";"x";"y"] +`0 < n ==> x < n ==> y < n ==> add_mod n (add_mod n x y) (inv_add_mod n y) = x` +[ + (BETA_TAC THEN (move ["n0"]) THEN (move ["xn"]) THEN (move ["yn"])); + (((((fun arg_tac -> (use_arg_then2 ("mulgK", [mulgK])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("grZ", [grZ])) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Finalization of the section Z_group *) +let grZ = Sections.finalize_theorem grZ;; +let testZ = Sections.finalize_theorem testZ;; +Sections.end_section "Z_group";; + +(* Lemma SING_HAS_SIZE_1 *) +let SING_HAS_SIZE_1 = Sections.section_proof ["x"] +`{x} HAS_SIZE 1` +[ + ((((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_SIZE_CLAUSES)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`{}`))) (term_tac exists_tac))) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_SIZE_CLAUSES)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma HAS_SIZE_1_SING *) +let HAS_SIZE_1_SING = Sections.section_proof ["X"] +`X HAS_SIZE 1 <=> ?x. X = {x}` +[ + ((THENL_LAST) (split_tac) ((BETA_TAC THEN (case THEN ((move ["x"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (((use_arg_then2 ("SING_HAS_SIZE_1", [SING_HAS_SIZE_1]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_SIZE_CLAUSES)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HAS_SIZE_0", [HAS_SIZE_0]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN (move ["t"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (case THEN ((move ["_"]) THEN (move ["eq"])))); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma BIJ_SYM *) +let BIJ_SYM = Sections.section_proof ["f";"V";"U"] +`BIJ f V U ==> ?g. BIJ g U V` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((case THEN ((move ["f_on"]) THEN (move ["f_inj"]))) THEN (case THEN ((move ["_"]) THEN (move ["f_surj"])))))); + (((fun arg_tac -> (use_arg_then2 ("BIJECTIVE_ON_LEFT_RIGHT_INVERSE", [BIJECTIVE_ON_LEFT_RIGHT_INVERSE])) (fun fst_arg -> (use_arg_then2 ("f_on", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((((use_arg_then2 ("f_inj", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("f_surj", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["g"])) THEN (case THEN (move ["g_on"])) THEN (case THEN ((move ["fg"]) THEN (move ["gf"])))); + (((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("g_on", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (split_tac)); + (BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN (move ["xU"])) THEN (case THEN (move ["yU"])) THEN (move ["g_eq"])); + (((((fun arg_tac -> (use_arg_then2 ("fg", [])) (fun fst_arg -> (use_arg_then2 ("yU", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("fg", [])) (fun fst_arg -> (use_arg_then2 ("xU", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("g_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (move ["x"]) THEN (move ["xV"])); + (((fun arg_tac -> arg_tac (Arg_term (`f x`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("f_on", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("gf", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma bij_inverse *) +let bij_inverse = Sections.section_proof ["f";"s";"t"] +`BIJ (f:A->B) s t ==> + (?g. (!y. y IN t ==> g y IN s) /\ (!x. x IN s ==> g (f x) = x) /\ (!y. y IN t ==> f (g y) = y))` +[ + (((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["f_on"])) THEN (move ["f_inj"]) THEN (case THEN (move ["_"])) THEN (move ["f_surj"])); + ((((fun arg_tac -> (use_arg_then2 ("BIJECTIVE_ON_LEFT_RIGHT_INVERSE", [BIJECTIVE_ON_LEFT_RIGHT_INVERSE])) (fun fst_arg -> (use_arg_then2 ("f_on", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("f_inj", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("f_surj", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["g"])) THEN (case THEN (move ["g_on"])) THEN (case THEN (move ["g1"])) THEN (move ["g2"]))); + (((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma BIJ_CARD_EQ *) +let BIJ_CARD_EQ = Sections.section_proof ["V";"U";"f"] +`FINITE V ==> BIJ f V U ==> CARD U = CARD V` +[ + (BETA_TAC THEN (move ["finV"]) THEN (move ["bij_f"])); + (((fun arg_tac -> (use_arg_then2 ("bij_inverse", [bij_inverse])) (fun fst_arg -> (use_arg_then2 ("bij_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["g"])) THEN (case THEN (move ["g_on"])) THEN (case THEN (move ["gf"])) THEN (move ["fg"])); + (((use_arg_then2 ("BIJECTIONS_CARD_EQ", [BIJECTIONS_CARD_EQ])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("f", [])) (term_tac exists_tac))) THEN ((((use_arg_then2 ("finV", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((split_tac) THEN (move ["x"]) THEN (move ["x_in"]))); + (((((use_arg_then2 ("g_on", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fg", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("bij_f", [])) (disch_tac [])) THEN (clear_assumption "bij_f") THEN BETA_TAC) THEN (((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["f_on"])) THEN (move ["_"]) THEN (move ["_"]))); + (((((use_arg_then2 ("gf", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_on", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma card_sing *) +let card_sing = Sections.section_proof ["a"] +`CARD {a} = 1` +[ + (((use_arg_then2 ("HAS_SIZE_CARD", [HAS_SIZE_CARD])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("HAS_SIZE_1_SING", [HAS_SIZE_1_SING]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("a", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma set_one_point *) +let set_one_point = Sections.section_proof ["s";"x"] +`FINITE s ==> CARD s = 1 ==> x IN s ==> s = {x}` +[ + (BETA_TAC THEN (move ["finS"]) THEN (move ["cs"]) THEN (move ["xs"])); + ((((fun arg_tac -> (use_arg_then2 ("HAS_SIZE_1_SING", [HAS_SIZE_1_SING])) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("finS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["y"])) THEN (move ["cond"]) THEN (move ["a"]))); + ((((fun arg_tac -> (use_arg_then2 ("cond", [])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["xy"])) THEN (((fun arg_tac -> (use_arg_then2 ("cond", [])) (fun fst_arg -> (use_arg_then2 ("a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sing_eq *) +let sing_eq = Sections.section_proof ["x";"y"] +`{x} = {y} <=> x = y` +[ + (((THENL) (split_tac) [ALL_TAC; ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))]) THEN (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN ((((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Section Action *) +Sections.begin_section "Action";; +let acts = new_definition `acts (G, op, e) S a <=> + (!g x. g IN G ==> x IN S ==> a g x IN S) /\ + (!g h x. g IN G ==> h IN G ==> x IN S ==> a g (a h x) = a (op g h) x) /\ + (!x. x IN S ==> a e x = x)`;; +let stab = new_definition `Stab G a x = {g | g IN G /\ a g x = x}`;; +let orbit = new_definition `Orbit G a x = {a g x | g | g IN G}`;; +let fix = new_definition `Fix G S a = {x | x IN S /\ (!g. g IN G ==> a g x = x)}`;; +(Sections.add_section_var (mk_var ("G", (`:A -> bool`))));; +(Sections.add_section_var (mk_var ("op", (`:A -> A -> A`))));; +(Sections.add_section_var (mk_var ("i", (`:A -> A`))));; +(Sections.add_section_var (mk_var ("e", (`:A`))));; +(Sections.add_section_var (mk_var ("S", (`:B -> bool`))));; +(Sections.add_section_var (mk_var ("a", (`:A -> B -> B`))));; + +(* Lemma in_stab *) +let in_stab = Sections.section_proof ["g";"x"] +`g IN Stab G a x ==> a g x = x` +[ + ((((((use_arg_then2 ("stab", [stab]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["h"])) THEN (case THEN ((move ["hyp"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac)); +];; + +(* Lemma fix_subset *) +let fix_subset = Sections.section_proof [] +`Fix G S a SUBSET S` +[ + ((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fix", [fix]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (simp_tac)) THEN (done_tac)); +];; +(Sections.add_section_hyp "acts_a" (`acts (G, op, e) S a`));; + +(* Lemma acts1 *) +let acts1 = Sections.section_proof ["x"] +`x IN S ==> a e x = x` +[ + ((((use_arg_then2 ("acts_a", [])) (disch_tac [])) THEN (clear_assumption "acts_a") THEN BETA_TAC) THEN ((((use_arg_then2 ("acts", [acts]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma acts_in *) +let acts_in = Sections.section_proof ["g";"x"] +`g IN G ==> x IN S ==> a g x IN S` +[ + ((((use_arg_then2 ("acts_a", [])) (disch_tac [])) THEN (clear_assumption "acts_a") THEN BETA_TAC) THEN ((((use_arg_then2 ("acts", [acts]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma acts_op *) +let acts_op = Sections.section_proof ["g";"h";"x"] +`g IN G ==> h IN G ==> x IN S ==> a g (a h x) = a (op g h) x` +[ + ((((use_arg_then2 ("acts_a", [])) (disch_tac [])) THEN (clear_assumption "acts_a") THEN BETA_TAC) THEN ((((use_arg_then2 ("acts", [acts]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma acts_sub *) +let acts_sub = Sections.section_proof ["H"] +`H SUBSET G ==> acts (H, op, e) S a` +[ + ((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("acts", [acts]))(thm_tac (new_rewrite [] []))))) THEN (move ["sHG"])) THEN (repeat_tactic 1 9 ((split_tac)))); + (BETA_TAC THEN (move ["g"]) THEN (move ["x"]) THEN (case THEN ((move ["gH"]) THEN (move ["xS"])))); + (((((use_arg_then2 ("acts_in", [acts_in]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (move ["g"]) THEN (move ["h"]) THEN (move ["x"]) THEN (case THEN ((case THEN ((move ["gH"]) THEN (move ["hH"]))) THEN (move ["xS"])))); + (((((use_arg_then2 ("acts_op", [acts_op]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("xS", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sHG", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["x"]) THEN (move ["xS"])) THEN (((use_arg_then2 ("acts1", [acts1]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma orbit_subset *) +let orbit_subset = Sections.section_proof ["x"] +`x IN S ==> Orbit G a x SUBSET S` +[ + ((BETA_TAC THEN (move ["xS"])) THEN (((((use_arg_then2 ("orbit", [orbit]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["y"]) THEN (case THEN ((move ["g"]) THEN (case THEN ((move ["gG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))))) THEN (((use_arg_then2 ("acts_in", [acts_in]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; +(Sections.add_section_hyp "grG" (`group (G, op, i, e)`));; + +(* Lemma x_in_orbit *) +let x_in_orbit = Sections.section_proof ["x"] +`x IN S ==> x IN Orbit G a x` +[ + ((BETA_TAC THEN (move ["xS"])) THEN ((((use_arg_then2 ("orbit", [orbit]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("acts1", [acts1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma stab_subgroup *) +let stab_subgroup = Sections.section_proof ["x"] +`x IN S ==> subgroup op i (Stab G a x) G` +[ + ((BETA_TAC THEN (move ["xS"])) THEN ((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("stab", [stab]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 2 ((split_tac)))); + ((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("acts1", [acts1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (move ["g"]) THEN (move ["h"]) THEN (case THEN ((case THEN ((move ["gG"]) THEN (move ["agx"]))) THEN (case THEN ((move ["hG"]) THEN (move ["ahx"])))))); + ((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("acts_op", [acts_op]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`a (i h) x = x`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((done_tac) THEN (done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("acts1", [acts1])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("acts_op", [acts_op]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma stab_group *) +let stab_group = Sections.section_proof ["x"] +`x IN S ==> group (Stab G a x, op, i, e)` +[ + ((BETA_TAC THEN (move ["xS"])) THEN ((((use_arg_then2 ("subgroup_group", [subgroup_group]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("stab_subgroup", [stab_subgroup]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma orbits_disj *) +let orbits_disj = Sections.section_proof ["x";"y"] +`x IN S ==> y IN S ==> + ~(Orbit G a x = Orbit G a y) ==> (Orbit G a x INTER Orbit G a y = {})` +[ + ((BETA_TAC THEN (move ["xS"]) THEN (move ["yS"])) THEN (((use_arg_then2 ("contraR", [contraR])) (disch_tac [])) THEN (clear_assumption "contraR") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("orbit", [orbit]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + ((BETA_TAC THEN (case THEN (move ["z"])) THEN (case THEN ((case THEN ((move ["g"]) THEN (case THEN ((move ["gG"]) THEN (move ["zgx"]))))) THEN (case THEN ((move ["h"]) THEN (case THEN ((move ["hG"]) THEN (move ["zhx"])))))))) THEN (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["t"])) THEN ((split_tac) THEN ALL_TAC THEN (case THEN (move ["u"])) THEN (case THEN ((move ["uG"]) THEN (move ["tu"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`op u (op (i g) h)`))) (term_tac exists_tac)); + ((repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("acts_op", [acts_op]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("tu", []))(thm_tac (new_rewrite [] [])))) THEN (congr_tac (`a u _`))); + (((((fun arg_tac -> (use_arg_then2 ("acts1", [acts1])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("acts_op", [acts_op]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("zhx", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("zgx", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`op u (op (i h) g)`))) (term_tac exists_tac)); + ((repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("acts_op", [acts_op]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("tu", []))(thm_tac (new_rewrite [] [])))) THEN (congr_tac (`a u _`))); + (((((fun arg_tac -> (use_arg_then2 ("acts1", [acts1])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("acts_op", [acts_op]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("zhx", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("zgx", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma fix_orbit_imp *) +let fix_orbit_imp = Sections.section_proof ["x"] +`x IN Fix G S a ==> Orbit G a x = {x}` +[ + (((((use_arg_then2 ("fix", [fix]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbit", [orbit]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["xS"]) THEN (move ["fix"]))) THEN (move ["y"])); + ((THENL_LAST) (split_tac) ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("acts1", [acts1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((BETA_TAC THEN (case THEN ((move ["g"]) THEN (case THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("fix", [fix])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))))) THEN (done_tac)); +];; + +(* Lemma fix_orbit *) +let fix_orbit = Sections.section_proof ["x"] +`x IN S ==> (x IN Fix G S a <=> Orbit G a x = {x})` +[ + ((THENL_FIRST) ((BETA_TAC THEN (move ["xS"])) THEN (split_tac)) (((use_arg_then2 ("fix_orbit_imp", [fix_orbit_imp])) (disch_tac [])) THEN (clear_assumption "fix_orbit_imp") THEN (exact_tac))); + ((((use_arg_then2 ("fix", [fix]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbit", [orbit]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))); + ((BETA_TAC THEN (move ["eq"])) THEN (((((use_arg_then2 ("xS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["g"]) THEN (move ["gG"]))); + ((((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma x_in_orbit *) +let x_in_orbit = Sections.section_proof ["x"] +`x IN S ==> x IN Orbit G a x` +[ + ((BETA_TAC THEN (move ["xS"])) THEN ((((use_arg_then2 ("orbit", [orbit]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("acts1", [acts1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sing_orbit *) +let sing_orbit = Sections.section_proof ["x"] +`x IN S ==> (x IN Fix G S a <=> Orbit G a x HAS_SIZE 1)` +[ + ((THENL_FIRST) ((BETA_TAC THEN (move ["xS"])) THEN ((((use_arg_then2 ("fix_orbit", [fix_orbit]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("HAS_SIZE_1_SING", [HAS_SIZE_1_SING]))(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); ALL_TAC])) (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac))); + ((BETA_TAC THEN (case THEN ((move ["y"]) THEN (move ["eq"])))) THEN (((fun arg_tac -> (use_arg_then2 ("x_in_orbit", [x_in_orbit])) (fun fst_arg -> (use_arg_then2 ("xS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC)); + ((((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma orbit_image *) +let orbit_image = Sections.section_proof ["x"] +`Orbit G a x = IMAGE (\g. a g x) G` +[ + (((((use_arg_then2 ("orbit", [orbit]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("andbC", [andbC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma finite_orbit *) +let finite_orbit = Sections.section_proof ["x"] +`FINITE S ==> x IN S ==> FINITE (Orbit G a x)` +[ + ((BETA_TAC THEN (move ["finS"]) THEN (move ["xS"])) THEN ((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("S", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("orbit_subset", [orbit_subset]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma bij_orbit_cosets *) +let bij_orbit_cosets = Sections.section_proof ["x"] +`x IN S ==> ?f. BIJ f (cosets op G (Stab G a x)) (Orbit G a x)` +[ + (BETA_TAC THEN (move ["xS"])); + (((fun arg_tac -> (use_arg_then2 ("stab_subgroup", [stab_subgroup])) (fun fst_arg -> (use_arg_then2 ("xS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then2 ("stab_group", [stab_group])) (fun fst_arg -> (use_arg_then2 ("xS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["grS"]) THEN (move ["subS"])); + ((fun arg_tac -> arg_tac (Arg_term (`\c:A->bool. a (CHOICE c) x`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`!g. g IN G ==> f (coset op g (Stab G a x)) = a g x`))) (term_tac (have_gen_tac [](move ["f_eq"])))); + ((BETA_TAC THEN (move ["g"]) THEN (move ["gG"])) THEN ((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + ((((fun arg_tac -> (use_arg_then2 ("CHOICE_DEF", [CHOICE_DEF])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`coset op g (Stab G a x)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("coset_not_empty", [coset_not_empty])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)))); + (((((use_arg_then2 ("coset", [coset]))(thm_tac (new_rewrite [2] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["h"])) THEN (case THEN ((move ["h_stab"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("acts_op", [acts_op]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("xS", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_subgroup", [in_subgroup])) (fun fst_arg -> (use_arg_then2 ("subS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("in_stab", [in_stab])) (fun fst_arg -> (use_arg_then2 ("h_stab", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((use_arg_then2 ("f", [])) (term_tac exists_tac)); + ((THENL_ROT (-1)) ((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (split_tac))); + (((((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (split_tac)); + ((BETA_TAC THEN (move ["c"]) THEN (case THEN (move ["g"])) THEN (case THEN ((move ["gG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("orbit_image", [orbit_image]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + (((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN (done_tac)); + ((BETA_TAC THEN (move ["y"])) THEN (((((use_arg_then2 ("orbit_image", [orbit_image]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["g"])) THEN (simp_tac) THEN (case THEN ((move ["y_eq"]) THEN (move ["gG"]))))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`coset op g (Stab G a x)`))) (term_tac exists_tac)) THEN (split_tac)) (((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN (done_tac))); + ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (split_tac)); + ((BETA_TAC THEN (move ["c"]) THEN (case THEN (move ["g"])) THEN (case THEN ((move ["gG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("orbit_image", [orbit_image]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + (((use_arg_then2 ("g", [])) (term_tac exists_tac)) THEN (done_tac)); + (BETA_TAC THEN (move ["c1"]) THEN (move ["c2"]) THEN (case THEN ((case THEN ((move ["g"]) THEN (case THEN ((move ["gG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["h"]) THEN (case THEN ((move ["hG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["a_eq"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("coset_equiv", [coset_equiv])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("stab", [stab]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> (use_arg_then2 ("acts1", [acts1])) (fun fst_arg -> (use_arg_then2 ("xS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("acts_op", [acts_op]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma card_orbit *) +let card_orbit = Sections.section_proof ["x"] +`FINITE S ==> x IN S ==> + CARD (Orbit G a x) = CARD (cosets op G (Stab G a x))` +[ + (BETA_TAC THEN (move ["finS"]) THEN (move ["xS"])); + (((fun arg_tac -> (use_arg_then2 ("bij_orbit_cosets", [bij_orbit_cosets])) (fun fst_arg -> (use_arg_then2 ("xS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["f"])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("BIJ_SYM", [BIJ_SYM])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["g"])) THEN (move ["bij"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("finite_orbit", [finite_orbit])) (fun fst_arg -> (use_arg_then2 ("finS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("xS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["finO"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("BIJ_CARD_EQ", [BIJ_CARD_EQ])) (fun fst_arg -> (use_arg_then2 ("finO", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bij", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma set_union_orbits *) +let set_union_orbits = Sections.section_proof [] +`S = UNIONS (IMAGE (Orbit G a) S)` +[ + ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNIONS", [IN_UNIONS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])) THEN (split_tac)); + ((BETA_TAC THEN (move ["xS"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`Orbit G a x`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("x_in_orbit", [x_in_orbit]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["y"])) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["yS"])))); + ((((((use_arg_then2 ("orbit_image", [orbit_image]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["h"])) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["hG"]))) THEN (simp_tac)) THEN (((use_arg_then2 ("acts_in", [acts_in])) (disch_tac [])) THEN (clear_assumption "acts_in") THEN (exact_tac))); +];; + +(* Lemma card_set *) +let card_set = Sections.section_proof [] +`FINITE S ==> CARD S = nsum (IMAGE (Orbit G a) S) CARD` +[ + ((BETA_TAC THEN (move ["finS"])) THEN ((((use_arg_then2 ("set_union_orbits", [set_union_orbits]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("CARD_UNIONS", [CARD_UNIONS]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((BETA_TAC THEN (move ["t"])) THEN ((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["xS"])))) THEN ((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac))); + (((use_arg_then2 ("S", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("orbit_subset", [orbit_subset]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((BETA_TAC THEN (move ["t"]) THEN (move ["u"])) THEN ((repeat_tactic 2 0 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["x"])) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["xS"]))) THEN (case THEN ALL_TAC) THEN (case THEN (move ["y"])) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["yS"]))) THEN (move ["disj"]))); + (((use_arg_then2 ("orbits_disj", [orbits_disj])) (disch_tac [])) THEN (clear_assumption "orbits_disj") THEN (exact_tac)); +];; + +(* Lemma card_set_fix *) +let card_set_fix = Sections.section_proof [] +`FINITE S ==> CARD S = CARD (Fix G S a) + + nsum {Orbit G a x | x | x IN S /\ CARD (Orbit G a x) > 1} CARD` +[ + (BETA_TAC THEN (move ["finS"])); + (((fun arg_tac -> (use_arg_then2 ("card_set", [card_set])) (fun fst_arg -> (use_arg_then2 ("finS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> arg_tac (Arg_term (`{Orbit G a x | x | x IN S /\ CARD (Orbit G a x) > 1}`))) (term_tac (set_tac "A"))); + ((fun arg_tac -> arg_tac (Arg_term (`{Orbit G a x | x | x IN S /\ CARD (Orbit G a x) = 1}`))) (term_tac (set_tac "B"))); + ((fun arg_tac -> arg_tac (Arg_term (`IMAGE (Orbit G a) S = A UNION B`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((THENL_ROT (-1)) ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("A_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("B_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["orb"])) THEN (split_tac))); + (case THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN ((move ["xS"]) THEN (move ["eq"])))); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN ((move ["eq"]) THEN (move ["xS"])))); + ((fun arg_tac -> arg_tac (Arg_term (`CARD (Orbit G a x)`))) (term_tac (set_tac "n"))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("finite_orbit", [finite_orbit])) (fun fst_arg -> (use_arg_then2 ("finS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("xS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finO"]))); + ((THENL) (((use_arg_then2 ("n_def", [])) (disch_tac [])) THEN (clear_assumption "n_def") THEN ((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN case) [ALL_TAC; ((THENL) case [(move ["card1"]); ((move ["n"]) THEN (move ["card_ge2"]))])]); + (((((use_arg_then2 ("CARD_EQ_0", [CARD_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["x_eq"])); + ((((fun arg_tac -> (use_arg_then2 ("x_in_orbit", [x_in_orbit])) (fun fst_arg -> (use_arg_then2 ("xS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((DISJ2_TAC) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("card1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((DISJ1_TAC) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("card_ge2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("gtE", [gtE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn0Sn", [ltn0Sn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`FINITE B`))) (term_tac (have_gen_tac [](move ["finB"])))); + (((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`IMAGE (Orbit G a) S`))) (term_tac exists_tac))); + (((((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("B_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["orb"]) THEN (case THEN (move ["x"])) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["xS"]) THEN (move ["_"]))) THEN (move ["eq"])); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); + ((((use_arg_then2 ("NSUM_UNION", [NSUM_UNION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DISJOINT", [DISJOINT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("finB", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + (split_tac); + (((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`IMAGE (Orbit G a) S`))) (term_tac exists_tac))); + (((((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("A_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["orb"]) THEN (case THEN (move ["x"])) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["xS"]) THEN (move ["_"]))) THEN (move ["eq"])); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); + (((((use_arg_then2 ("A_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("B_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["orb"])); + ((((fun arg_tac -> arg_tac (Arg_theorem (TAUT `!P. ~P <=> (P ==> F)`)))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["x"])) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["xS"]) THEN (move ["gt1"]))) THEN (move ["eq"]) THEN (case THEN (move ["y"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["yS"])) THEN (move ["eq1"])); + (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (move ["orb_eq"])) THEN (((use_arg_then2 ("gt1", [])) (disch_tac [])) THEN (clear_assumption "gt1") THEN ((use_arg_then2 ("eq1", [])) (disch_tac [])) THEN (clear_assumption "eq1") THEN BETA_TAC)); + ((((use_arg_then2 ("orb_eq", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqn_addr", [eqn_addr]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`nsum B CARD = CARD B`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("CARD_EQ_NSUM", [CARD_EQ_NSUM]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("NSUM_EQ", [NSUM_EQ])) (thm_tac apply_tac)) THEN (move ["orb"]))); + ((((((use_arg_then2 ("B_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["xS"])) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`B = IMAGE (Orbit G a) (Fix G S a)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((((use_arg_then2 ("B_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (move ["orb"])) THEN (split_tac)); + (BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN ((case THEN ((move ["xS"]) THEN (move ["card1"]))) THEN (move ["orb_eq"])))); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("orb_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("fix_orbit", [fix_orbit]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("set_one_point", [set_one_point])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`Orbit G a x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("finite_orbit", [finite_orbit]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("x_in_orbit", [x_in_orbit]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN (move ["orb_eq"])) THEN (move ["fix"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x IN S`))) (term_tac (have_gen_tac [](move ["xS"])))) ((((use_arg_then2 ("fix_subset", [fix_subset])) (disch_tac [])) THEN (clear_assumption "fix_subset") THEN BETA_TAC) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (exact_tac) THEN (done_tac))); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("orb_eq", [])) (disch_tac [])) THEN (clear_assumption "orb_eq") THEN ((use_arg_then2 ("fix", [fix])) (disch_tac [])) THEN (clear_assumption "fix") THEN BETA_TAC) THEN (((((use_arg_then2 ("fix_orbit", [fix_orbit]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_sing", [card_sing]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((THENL_ROT (-1)) (((use_arg_then2 ("CARD_IMAGE_INJ", [CARD_IMAGE_INJ])) (thm_tac apply_tac)) THEN (split_tac))); + (((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("S", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("fix_subset", [fix_subset]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("fix_orbit_imp", [fix_orbit_imp])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (case THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("fix_orbit_imp", [fix_orbit_imp])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("sing_eq", [sing_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; +(Sections.add_section_var (mk_var ("p", (`:num`))); Sections.add_section_var (mk_var ("r", (`:num`))));; +(Sections.add_section_hyp "prime_p" (`prime p`));; +(Sections.add_section_hyp "finG" (`FINITE G`));; +(Sections.add_section_hyp "cardG" (`CARD G = p EXP r`));; +(Sections.add_section_hyp "finS" (`FINITE S`));; + +(* Lemma card_orbit_p_group *) +let card_orbit_p_group = Sections.section_proof ["x"] +`x IN S ==> CARD (Orbit G a x) > 1 ==> p divides CARD (Orbit G a x)` +[ + ((BETA_TAC THEN (move ["xS"])) THEN (((((use_arg_then2 ("card_orbit", [card_orbit]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["card_gt1"]))); + ((fun arg_tac -> arg_tac (Arg_term (`CARD (cosets op G (Stab G a x)) divides p EXP r`))) (term_tac (have_gen_tac []ALL_TAC))); + (((((use_arg_then2 ("cardG", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL divides)))(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`CARD (Stab G a x)`))) (term_tac exists_tac))); + (((((fun arg_tac -> (use_arg_then2 ("LaGrange", [LaGrange])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("stab_subgroup", [stab_subgroup]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL DIVIDES_PRIMEPOW)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ALL_TAC THEN (case THEN (move ["q"])) THEN (case THEN ((move ["_"]) THEN (move ["card_eq"])))); + (((use_arg_then2 ("card_gt1", [])) (disch_tac [])) THEN (clear_assumption "card_gt1") THEN ((use_arg_then2 ("card_eq", [])) (disch_tac [])) THEN (clear_assumption "card_eq") THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("q", [])) (disch_tac [])) THEN (clear_assumption "q") THEN case) THEN (((((use_arg_then2 ("EXP", [EXP]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("gtE", [gtE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltnn", [ltnn]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["n"]) THEN (move ["_"]))); + ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL divides)))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`p EXP n`))) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma DIVIDES_NSUM *) +let DIVIDES_NSUM = Sections.section_proof ["f";"s";"q"] +`(!x. x IN s ==> q divides f x) ==> q divides nsum s f` +[ + (BETA_TAC THEN (move ["H"])); + ((((use_arg_then2 ("divides", [divides]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`nsum s (\x. f x DIV q)`))) (term_tac exists_tac))); + (((((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NSUM_RMUL", [NSUM_RMUL]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("NSUM_EQ", [NSUM_EQ])) (thm_tac apply_tac)) THEN (move ["x"]) THEN (move ["xs"]) THEN (simp_tac))); + (((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIVIDES_DIV_MULT", [DIVIDES_DIV_MULT]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("H", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sum_orbit_p_group *) +let sum_orbit_p_group = Sections.section_proof [] +`p divides nsum {Orbit G a x | x | x IN S /\ CARD (Orbit G a x) > 1} CARD` +[ + ((((use_arg_then2 ("DIVIDES_NSUM", [DIVIDES_NSUM])) (thm_tac apply_tac)) THEN (move ["orb"])) THEN (((((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["xS"])) THEN (move ["card_gt1"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((use_arg_then2 ("card_orbit_p_group", [card_orbit_p_group])) (disch_tac [])) THEN (clear_assumption "card_orbit_p_group") THEN (exact_tac)); +];; + +(* Lemma p_div_fix *) +let p_div_fix = Sections.section_proof [] +`p divides CARD S ==> p divides CARD (Fix G S a)` +[ + (((((use_arg_then2 ("card_set_fix", [card_set_fix]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["p_div_sum"])); + ((use_arg_then2 ("sum_orbit_p_group", [sum_orbit_p_group])) (fun arg -> thm_tac MP_TAC arg THEN (move ["p_div2"]))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DIVIDES_ADD_REVL", [DIVIDES_ADD_REVL])) (fun fst_arg -> (use_arg_then2 ("p_div2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p_div_sum", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +];; + +(* Lemma fix_mod_p *) +let fix_mod_p = Sections.section_proof [] +`CARD (Fix G S a) MOD p = CARD S MOD p` +[ + ((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MOD_EQ", [MOD_EQ])) (disch_tac [])) THEN (clear_assumption "MOD_EQ") THEN (DISCH_THEN apply_tac))); + ((((use_arg_then2 ("sum_orbit_p_group", [sum_orbit_p_group])) (disch_tac [])) THEN (clear_assumption "sum_orbit_p_group") THEN BETA_TAC) THEN ((((use_arg_then2 ("divides", [divides]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["q"])) THEN (move ["eq"]))); + (((use_arg_then2 ("q", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("card_set_fix", [card_set_fix]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Action *) +let in_stab = Sections.finalize_theorem in_stab;; +let fix_subset = Sections.finalize_theorem fix_subset;; +let acts1 = Sections.finalize_theorem acts1;; +let acts_in = Sections.finalize_theorem acts_in;; +let acts_op = Sections.finalize_theorem acts_op;; +let acts_sub = Sections.finalize_theorem acts_sub;; +let orbit_subset = Sections.finalize_theorem orbit_subset;; +let x_in_orbit = Sections.finalize_theorem x_in_orbit;; +let stab_subgroup = Sections.finalize_theorem stab_subgroup;; +let stab_group = Sections.finalize_theorem stab_group;; +let orbits_disj = Sections.finalize_theorem orbits_disj;; +let fix_orbit_imp = Sections.finalize_theorem fix_orbit_imp;; +let fix_orbit = Sections.finalize_theorem fix_orbit;; +let x_in_orbit = Sections.finalize_theorem x_in_orbit;; +let sing_orbit = Sections.finalize_theorem sing_orbit;; +let orbit_image = Sections.finalize_theorem orbit_image;; +let finite_orbit = Sections.finalize_theorem finite_orbit;; +let bij_orbit_cosets = Sections.finalize_theorem bij_orbit_cosets;; +let card_orbit = Sections.finalize_theorem card_orbit;; +let set_union_orbits = Sections.finalize_theorem set_union_orbits;; +let card_set = Sections.finalize_theorem card_set;; +let card_set_fix = Sections.finalize_theorem card_set_fix;; +let card_orbit_p_group = Sections.finalize_theorem card_orbit_p_group;; +let DIVIDES_NSUM = Sections.finalize_theorem DIVIDES_NSUM;; +let sum_orbit_p_group = Sections.finalize_theorem sum_orbit_p_group;; +let p_div_fix = Sections.finalize_theorem p_div_fix;; +let fix_mod_p = Sections.finalize_theorem fix_mod_p;; +Sections.end_section "Action";; + +(* Lemma has_size_tuples *) +let has_size_tuples = Sections.section_proof ["s";"n"] +`FINITE (s:T -> bool) ==> + {t | sizel t = n /\ (!x. x <- t ==> x IN s)} HAS_SIZE CARD s EXP n` +[ + (BETA_TAC THEN (move ["finS"])); + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; (move ["n"])]) THEN (((use_arg_then2 ("EXP", [EXP]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("HAS_SIZE_1_SING", [HAS_SIZE_1_SING]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`[]:(T)list`))) (term_tac exists_tac))); + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_eq0", [size_eq0]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])); + (((split_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (move ["y"])) THEN (((use_arg_then2 ("MEM", [MEM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`GSPEC _`))) (term_tac (set_tac "r"))); + ((fun arg_tac -> arg_tac (Arg_term (`GSPEC _`))) (term_tac (set_tac "l"))); + (BETA_TAC THEN (move ["IHn"])); + ((fun arg_tac -> arg_tac (Arg_term (`l = IMAGE (\p. FST p :: SND p) (s CROSS r)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("l_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CROSS", [CROSS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["u"])); + ((THENL) (((use_arg_then2 ("u", [])) (disch_tac [])) THEN (clear_assumption "u") THEN case) [ALL_TAC; ((move ["a"]) THEN (move ["u"]))]); + (((((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [(`0 = _`)])))) THEN (((use_arg_then2 ("eqS0", [eqS0]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("NOT_EXISTS_THM", [NOT_EXISTS_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])); + (((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_CONS_NIL", [NOT_CONS_NIL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqSS", [eqSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqseq_cons", [eqseq_cons]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((BETA_TAC THEN (case THEN ((move ["size_u"]) THEN (move ["x_mem"])))) THEN (((fun arg_tac -> arg_tac (Arg_term (`a, u`))) (term_tac exists_tac)) THEN (simp_tac)) THEN ((((use_arg_then2 ("a", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("u", [])) (term_tac exists_tac))) THEN (simp_tac))); + (((((fun arg_tac -> (use_arg_then2 ("x_mem", [])) (fun fst_arg -> (use_arg_then2 ("a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_u", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["mem_x"])); + ((((fun arg_tac -> (use_arg_then2 ("x_mem", [])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["p"])) THEN (case THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (case THEN (move ["a"])) THEN (case THEN (move ["u"])) THEN (case THEN ((case THEN ((move ["as"]) THEN (move ["ur"]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (simp_tac)); + ((((use_arg_then2 ("ur", [])) (disch_tac [])) THEN (clear_assumption "ur") THEN BETA_TAC) THEN (((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["mem_x"]))))); + ((((((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])) THEN ((THENL) case [((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); ALL_TAC]) THEN (((use_arg_then2 ("mem_x", [])) (disch_tac [])) THEN (clear_assumption "mem_x") THEN (exact_tac)) THEN (done_tac)); + ((((use_arg_then2 ("IHn", [])) (disch_tac [])) THEN (clear_assumption "IHn") THEN BETA_TAC) THEN ((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["finR"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))))))); + ((THENL_ROT (-1)) (((use_arg_then2 ("HAS_SIZE_IMAGE_INJ", [HAS_SIZE_IMAGE_INJ])) (thm_tac apply_tac)) THEN (split_tac))); + (((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_CROSS", [FINITE_CROSS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("CARD_CROSS", [CARD_CROSS]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["p1"]) THEN (move ["p2"]) THEN (simp_tac) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"]))) THEN (((use_arg_then2 ("eqseq_cons", [eqseq_cons]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("p1", [])) (disch_tac [])) THEN (clear_assumption "p1") THEN case THEN (move ["x1"]) THEN (move ["y1"])) THEN (((use_arg_then2 ("p2", [])) (disch_tac [])) THEN (clear_assumption "p2") THEN case THEN (move ["x2"]) THEN (move ["y2"]) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma card_tuples *) +let card_tuples = Sections.section_proof ["s";"n"] +`FINITE s ==> CARD {t | sizel t = n /\ (!x. x <- t ==> x IN s)} = CARD s EXP n` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("has_size_tuples", [has_size_tuples])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma finite_tuples *) +let finite_tuples = Sections.section_proof ["s";"n"] +`FINITE s ==> FINITE {t | sizel t = n /\ (!x. x <- t ==> x IN s)}` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("has_size_tuples", [has_size_tuples])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Section MoreSeq *) +Sections.begin_section "MoreSeq";; + +(* Lemma rot_nseq *) +let rot_nseq = Sections.section_proof ["n";"x";"k"] +`rot k (nseq n x) = nseq n x` +[ + ((fun arg_tac -> (use_arg_then2 ("eq_from_nth", [eq_from_nth])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac)); + (((((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_nseq", [size_nseq]))(thm_tac (new_rewrite [] []))))) THEN (move ["j"]) THEN (move ["jn"])); + ((((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_cat", [nth_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_nseq", [size_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_nseq", [nth_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("if_same", [if_same]))(thm_tac (new_rewrite [] []))))); + ((THENL) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ltnP", [ltnP])) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n - k`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(move ["ineq"]); ALL_TAC]); + (((((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("nth_drop", [nth_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_nseq", [nth_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("if_same", [if_same]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("k", [])) (disch_tac [])) THEN (clear_assumption "k") THEN case) [ALL_TAC; (move ["k"])]) (((((use_arg_then2 ("take", [take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((THENL_FIRST) (((use_arg_then2 ("nth_take", [nth_take]))(thm_tac (new_rewrite [] [])))) ((((use_arg_then2 ("jn", [])) (disch_tac [])) THEN (clear_assumption "jn") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("nth_nseq", [nth_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("if_same", [if_same]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma in_nseq_imp *) +let in_nseq_imp = Sections.section_proof ["n";"x";"y"] +`y <- nseq n x ==> y = x` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("in_nil", [in_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("in_cons", [in_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("nseq", [nseq]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))) THEN case THEN (done_tac)); +];; + +(* Lemma in_nseq *) +let in_nseq = Sections.section_proof ["n";"x";"y"] +`~(n = 0) ==> (y <- nseq n x <=> y = x)` +[ + ((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [((simp_tac THEN TRY done_tac)); ((move ["n"]) THEN (move ["IHn"]) THEN (move ["_"]))]); + ((((use_arg_then2 ("IHn", [])) (disch_tac [])) THEN (clear_assumption "IHn") THEN ((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN case THEN ((simp_tac THEN TRY done_tac))) THEN ((((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_cons", [in_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("in_nil", [in_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ncons", [ncons]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("nseq", [nseq]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("eqS0", [eqS0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma rot_same *) +let rot_same = Sections.section_proof ["t"] +`(!k. k < sizel t ==> rot k t = t) <=> (!k. rot k t = t)` +[ + ((split_tac) THEN (simp_tac) THEN (move ["rot_eq"]) THEN (move ["k"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ltnP", [ltnP])) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sizel t`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) THEN (TRY ((exact_tac)))); + (((use_arg_then2 ("rot_oversize", [rot_oversize])) (thm_tac apply_tac)) THEN (done_tac)); +];; + +(* Lemma rot_const *) +let rot_const = Sections.section_proof ["t"] +`(!k. k < sizel t ==> rot k t = t) ==> t = nseq (sizel t) (HD t)` +[ + (((use_arg_then2 ("rot_same", [rot_same]))(thm_tac (new_rewrite [] [])))); + ((THENL_FIRST) (((THENL) (((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]))]) THEN (((use_arg_then2 ("HD", [HD]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) (((((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`h :: t`))) (term_tac (set_tac "l"))) THEN (BETA_TAC THEN (move ["rot_eq"]))); + (((fun arg_tac -> (use_arg_then2 ("eq_from_nth", [eq_from_nth])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((((((use_arg_then2 ("size_nseq", [size_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["j"]) THEN (move ["j_size"])) THEN ((((use_arg_then2 ("nth_nseq", [nth_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("if_same", [if_same]))(thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> (use_arg_then2 ("rot_eq", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sizel l - j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_cat", [nth_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subKn", [subKn]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ltnn", [ltnn]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("subnn", [subnn]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("nth0", [nth0])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`?n. sizel l - j = SUC n`))) (term_tac (have_gen_tac []ALL_TAC))); + (((fun arg_tac -> arg_tac (Arg_term (`sizel l - j - 1`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("j_size", [])) (disch_tac [])) THEN (clear_assumption "j_size") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((BETA_TAC THEN (case THEN ((move ["n"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN ((((use_arg_then2 ("l_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("take", [take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("head", [head]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma cat_nseq_nseq *) +let cat_nseq_nseq = Sections.section_proof ["n";"m";"x"] +`cat (nseq n x) (nseq m x) = nseq (n + m) x` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("add0n", [add0n]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("cat0s", [cat0s]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ncons", [ncons]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("nseq", [nseq]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))))); + (((((use_arg_then2 ("addSn", [addSn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nseq", [nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ncons", [ncons]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("nseq", [nseq]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("IHn", []))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Finalization of the section MoreSeq *) +let rot_nseq = Sections.finalize_theorem rot_nseq;; +let in_nseq_imp = Sections.finalize_theorem in_nseq_imp;; +let in_nseq = Sections.finalize_theorem in_nseq;; +let rot_same = Sections.finalize_theorem rot_same;; +let rot_const = Sections.finalize_theorem rot_const;; +let cat_nseq_nseq = Sections.finalize_theorem cat_nseq_nseq;; +Sections.end_section "MoreSeq";; + +(* Section ProdExp *) +Sections.begin_section "ProdExp";; +let expg = GEN_ALL (define `expg (op, e) g 0 = e /\ + expg (op, e) g (SUC n) = op g (expg (op, e) g n)`);; + +(* Lemma expg_prod *) +let expg_prod = Sections.section_proof ["op";"e";"g";"n"] +`expg (op, e) g n = foldr op e (nseq n g)` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((((use_arg_then2 ("expg", [expg]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nseq", [nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ncons", [ncons]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("ncons", [ncons]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nseq", [nseq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma expg0 *) +let expg0 = Sections.section_proof ["op";"e";"g"] +`expg (op, e) g 0 = e` +[ + ((((use_arg_then2 ("expg", [expg]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma expgS *) +let expgS = Sections.section_proof ["op";"e";"g";"n"] +`expg (op, e) g (SUC n) = op g (expg (op, e) g n)` +[ + ((((use_arg_then2 ("expg", [expg]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; +(Sections.add_section_var (mk_var ("G", (`:A->bool`))));; +(Sections.add_section_var (mk_var ("op", (`:A->A->A`))));; +(Sections.add_section_var (mk_var ("i", (`:A->A`))));; +(Sections.add_section_var (mk_var ("e", (`:A`))));; +(Sections.add_section_hyp "grG" (`group (G, op, i, e)`));; + +(* Lemma exp1g *) +let exp1g = Sections.section_proof ["n"] +`expg (op, e) e n = e` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((((use_arg_then2 ("expg", [expg]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma expg1 *) +let expg1 = Sections.section_proof ["g"] +`g IN G ==> expg (op, e) g 1 = g` +[ + ((BETA_TAC THEN (move ["gG"])) THEN ((((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 2 0 (((use_arg_then2 ("expg", [expg]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("mulg1", [mulg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma prod_in *) +let prod_in = Sections.section_proof ["t"] +`(!g. g <- t ==> g IN G) ==> foldr op e t IN G` +[ + ((THENL_FIRST) (((THENL) (((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN elim) [ALL_TAC; ((move ["a"]) THEN (move ["t"]) THEN (move ["IHt"]))]) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((BETA_TAC THEN (move ["memG"])) THEN (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((((((use_arg_then2 ("memG", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHt", []))(thm_tac (new_rewrite [] []))))) THEN (move ["g"]) THEN (move ["mem_g"])) THEN (((use_arg_then2 ("memG", [])) (disch_tac [])) THEN (clear_assumption "memG") THEN (DISCH_THEN apply_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma expg_in *) +let expg_in = Sections.section_proof ["n";"g"] +`g IN G ==> expg (op, e) g n IN G` +[ + ((BETA_TAC THEN (move ["gG"])) THEN (((((use_arg_then2 ("expg_prod", [expg_prod]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("prod_in", [prod_in]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("in_nseq_imp", [in_nseq_imp])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma prod_cat *) +let prod_cat = Sections.section_proof ["t1";"t2"] +`(!g. g <- t1 \/ g <- t2 ==> g IN G) ==> + foldr op e (t1 ++ t2) = op (foldr op e t1) (foldr op e t2)` +[ + (((THENL) (((use_arg_then2 ("t2", [])) (disch_tac [])) THEN (clear_assumption "t2") THEN ((use_arg_then2 ("t1", [])) (disch_tac [])) THEN (clear_assumption "t1") THEN elim) [((move ["t2"]) THEN (move ["inG"])); ((move ["a"]) THEN (move ["t"]) THEN (move ["IHt"]) THEN (move ["t2"]) THEN (move ["inG"]))]) THEN ((((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + ((((((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("prod_in", [prod_in]))(thm_tac (new_rewrite [] []))))) THEN (move ["g"]) THEN (move ["mem_g"])) THEN (((use_arg_then2 ("inG", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((fun arg_tac -> (use_arg_then2 ("mulgA", [mulgA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("prod_in", [prod_in]))(thm_tac (new_rewrite [] [])))))) THEN (TRY ((BETA_TAC THEN (move ["g"]) THEN (move ["mem_g"])))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("inG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((((((use_arg_then2 ("IHt", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["g"])) THEN (case THEN (move ["h"])) THEN ((((use_arg_then2 ("inG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma expg_add *) +let expg_add = Sections.section_proof ["g";"n";"m"] +`g IN G ==> + expg (op, e) g (n + m) = op (expg (op, e) g n) (expg (op, e) g m)` +[ + ((BETA_TAC THEN (move ["inG"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("expg_prod", [expg_prod]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("prod_cat", [prod_cat]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("cat_nseq_nseq", [cat_nseq_nseq]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)))); + ((BETA_TAC THEN (move ["x"])) THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("in_nseq_imp", [in_nseq_imp])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma expg_expg *) +let expg_expg = Sections.section_proof ["g";"n";"m"] +`g IN G ==> + expg (op, e) (expg (op, e) g n) m = expg (op, e) g (n * m)` +[ + ((BETA_TAC THEN (move ["gG"])) THEN ((THENL) (((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; ((move ["m"]) THEN (move ["IHm"]))])); + (((((use_arg_then2 ("muln0", [muln0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("expg", [expg]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("expg", [expg]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHm", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulnS", [mulnS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expg_add", [expg_add]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma expg_inv *) +let expg_inv = Sections.section_proof ["n";"g"] +`g IN G ==> i (expg (op, e) g n) = expg (op, e) (i g) n` +[ + ((THENL_FIRST) ((BETA_TAC THEN (move ["gG"])) THEN ((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))])) (((repeat_tactic 1 9 (((use_arg_then2 ("expg", [expg]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("invg_e", [invg_e])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("addn1", [addn1]))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("expg_add", [expg_add]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulI", [mulI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("expg_in", [expg_in]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expg1", [expg1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("expg", [expg]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section ProdExp *) +let expg_prod = Sections.finalize_theorem expg_prod;; +let expg0 = Sections.finalize_theorem expg0;; +let expgS = Sections.finalize_theorem expgS;; +let exp1g = Sections.finalize_theorem exp1g;; +let expg1 = Sections.finalize_theorem expg1;; +let prod_in = Sections.finalize_theorem prod_in;; +let expg_in = Sections.finalize_theorem expg_in;; +let prod_cat = Sections.finalize_theorem prod_cat;; +let expg_add = Sections.finalize_theorem expg_add;; +let expg_expg = Sections.finalize_theorem expg_expg;; +let expg_inv = Sections.finalize_theorem expg_inv;; +Sections.end_section "ProdExp";; + +(* Lemma minP_exists *) +let minP_exists = Sections.section_proof ["P";"k"] +`P k ==> ?n. P n /\ (!m. P m ==> n <= m)` +[ + ((((use_arg_then2 ("k", [])) (disch_tac [])) THEN (clear_assumption "k") THEN BETA_TAC) THEN (((use_arg_then2 ("num_WF", [num_WF])) (disch_tac [])) THEN (clear_assumption "num_WF") THEN (DISCH_THEN apply_tac) THEN (move ["k"]) THEN (move ["IH"]) THEN (move ["Pk"]))); + (((fun arg_tac -> (use_arg_then2 ("orbN", [orbN])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`?m. m < k /\ P m`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case); + ((BETA_TAC THEN (case THEN (move ["m"])) THEN (case THEN ((move ["mk"]) THEN (move ["Pm"])))) THEN (((fun arg_tac -> (use_arg_then2 ("IH", [])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)) THEN (done_tac)); + (((((use_arg_then2 ("NOT_EXISTS_THM", [NOT_EXISTS_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (move ["h"])); + (((use_arg_then2 ("k", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("Pk", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["m"]) THEN (move ["Pm"]))); + ((((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("Pm", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_LT", [NOT_LT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Cyclic *) +Sections.begin_section "Cyclic";; +let orderg = new_definition `orderg (op, e) g = + @n. ~(n = 0) /\ expg (op, e) g n = e /\ (!m. ~(m = 0) /\ expg (op, e) g m = e ==> n <= m)`;; +(Sections.add_section_var (mk_var ("G", (`:A->bool`))));; +(Sections.add_section_var (mk_var ("op", (`:A->A->A`))));; +(Sections.add_section_var (mk_var ("i", (`:A->A`))));; +(Sections.add_section_var (mk_var ("e", (`:A`))));; +(Sections.add_section_var (mk_var ("g", (`:A`))));; +(Sections.add_section_hyp "grG" (`group (G, op, i, e)`));; + +(* Lemma order_e *) +let order_e = Sections.section_proof [] +`orderg (op, e) e = 1` +[ + ((THENL_ROT (-1)) ((((use_arg_then2 ("orderg", [orderg]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SELECT_UNIQUE", [SELECT_UNIQUE])) (thm_tac apply_tac)) THEN (simp_tac) THEN (move ["n"])) THEN (split_tac))); + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((((fun arg_tac -> (use_arg_then2 ("expg1", [expg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqS0", [eqS0]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["m"])) THEN (arith_tac) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["n0"])) THEN (case THEN (move ["_"])) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))); + (((((fun arg_tac -> (use_arg_then2 ("expg1", [expg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqS0", [eqS0]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then2 ("n0", [])) (disch_tac [])) THEN (clear_assumption "n0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma INFINITE_SUBSET *) +let INFINITE_SUBSET = Sections.section_proof ["s";"t"] +`INFINITE s ==> s SUBSET t ==> INFINITE t` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("INFINITE", [INFINITE]))(thm_tac (new_rewrite [] []))))) THEN (move ["hs"]) THEN (move ["hst"])) THEN (((use_arg_then2 ("hs", [])) (disch_tac [])) THEN (clear_assumption "hs") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (move ["fin_t"]))); + (((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN (done_tac)); +];; +(Sections.add_section_hyp "finG" (`FINITE G`));; +(Sections.add_section_hyp "gG" (`g IN G`));; + +(* Lemma order_exists0 *) +let order_exists0 = Sections.section_proof [] +`?n. ~(n = 0) /\ expg (op, e) g n = e` +[ + ((((use_arg_then2 ("finG", [])) (disch_tac [])) THEN (clear_assumption "finG") THEN ((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("NOT_EXISTS_THM", [NOT_EXISTS_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INFINITE", [INFINITE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] []))))) THEN (move ["Hexp"]))); + ((use_arg_then2 ("INFINITE_SUBSET", [INFINITE_SUBSET])) (thm_tac apply_tac)); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`IMAGE (expg (op, e) g) UNIV`))) (term_tac exists_tac)) THEN (split_tac))); + ((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (move ["h"]) THEN (case THEN (move ["n"])) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["_"])))) THEN (((fun arg_tac -> (use_arg_then2 ("expg_in", [expg_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((use_arg_then2 ("INFINITE_IMAGE_INJ", [INFINITE_IMAGE_INJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("num_INFINITE", [num_INFINITE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (move ["n"]) THEN (move ["m"])); + ((fun arg_tac -> arg_tac (Arg_term (`n <= m`))) (term_tac (wlog_tac ALL_TAC[`n`; `m`]))); + (BETA_TAC THEN (move ["h"])); + (((THENL_LAST) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("leq_total", [leq_total])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))) THEN (BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("h", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (simp_tac)) THEN (done_tac)); + (BETA_TAC THEN (move ["n_le_m"])); + ((THENL_FIRST) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ltngtP", [ltngtP])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) (((((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_le_m", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((THENL) case [((move ["n_lt_m"]) THEN (move ["exp_eq"])); ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))]); + (((fun arg_tac -> (use_arg_then2 ("Hexp", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m - n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((use_arg_then2 ("subn_eq0", [subn_eq0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_lt_m", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((use_arg_then2 ("contraR", [contraR])) (disch_tac [])) THEN (clear_assumption "contraR") THEN (DISCH_THEN apply_tac) THEN (move ["_"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mulg_rightI", [mulg_rightI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`expg (op, e) g n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("expg_in", [expg_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("expg_in", [expg_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("expg_add", [expg_add])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("subnK", [subnK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma order_exists *) +let order_exists = Sections.section_proof [] +`~(orderg (op, e) g = 0) /\ + expg (op, e) g (orderg (op, e) g) = e /\ + (!m. ~(m = 0) /\ expg (op, e) g m = e ==> orderg (op, e) g <= m)` +[ + ((fun arg_tac -> arg_tac (Arg_term (`\n. ~(n = 0) /\ expg (op, e) g n = e /\ (!m. ~(m = 0) /\ expg (op, e) g m = e ==> n <= m)`))) (term_tac (set_tac "P"))); + (((fun arg_tac -> (use_arg_then2 ("SELECT_AX", [SELECT_AX])) (fun fst_arg -> (use_arg_then2 ("P", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((((use_arg_then2 ("P_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("orderg", [orderg]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("CONJ_ASSOC", [CONJ_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("minP_exists", [minP_exists])) (disch_tac [])) THEN (clear_assumption "minP_exists") THEN (DISCH_THEN apply_tac))); + (((use_arg_then2 ("order_exists0", [order_exists0])) (disch_tac [])) THEN (clear_assumption "order_exists0") THEN (exact_tac)); +];; + +(* Lemma order1 *) +let order1 = Sections.section_proof [] +`orderg (op, e) g = 1 <=> g = e` +[ + ((THENL_LAST) (split_tac) ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("order_e", [order_e]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((BETA_TAC THEN (move ["o1"])) THEN (((use_arg_then2 ("order_exists", [order_exists])) (disch_tac [])) THEN (clear_assumption "order_exists") THEN BETA_TAC)); + ((((((use_arg_then2 ("o1", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("expg1", [expg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fin_inv_expg *) +let fin_inv_expg = Sections.section_proof [] +`?k. i g = expg (op, e) g k` +[ + ((((use_arg_then2 ("order_exists0", [order_exists0])) (disch_tac [])) THEN (clear_assumption "order_exists0") THEN BETA_TAC) THEN ((((use_arg_then2 ("lt0n", [lt0n]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["n"])) THEN (case THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("prednK", [prednK])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["n_eq"]) THEN (move ["exp1"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`n - 1`))) (term_tac exists_tac)); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mulg_leftI", [mulg_leftI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("expg_in", [expg_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("gG", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("expgS", [expgS]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("exp1", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma expg_inj *) +let expg_inj = Sections.section_proof ["n";"m"] +`n < orderg (op, e) g ==> m < orderg (op, e) g ==> + (expg (op, e) g n = expg (op, e) g m <=> n = m)` +[ + ((THENL) ((fun arg_tac -> arg_tac (Arg_term (`n <= m`))) (term_tac (wlog_tac ALL_TAC[`n`; `m`]))) [((move ["h"]) THEN (move ["n_lt"]) THEN (move ["m_lt"])); ((move ["n_le_m"]) THEN (move ["n_lt"]) THEN (move ["m_lt"]))]); + ((THENL_FIRST) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n <= m`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("h", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (exact_tac) THEN (done_tac))); + ((((((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`expg (op, e) g n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_LE", [NOT_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn_neqAle", [ltn_neqAle]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("h", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (exact_tac) THEN (done_tac)); + ((THENL_LAST) (split_tac) ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("subnK", [subnK])) (fun fst_arg -> (use_arg_then2 ("n_le_m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("expg_add", [expg_add])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mulg_left", [mulg_left])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("expg_in", [expg_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["eq"])); + ((((use_arg_then2 ("n_le_m", [])) (disch_tac [])) THEN (clear_assumption "n_le_m") THEN BETA_TAC) THEN (((use_arg_then2 ("leq_eqVlt", [leq_eqVlt]))(thm_tac (new_rewrite [] [])))) THEN (case THEN ((TRY done_tac)) THEN (move ["n_lt_m"]))); + ((((use_arg_then2 ("order_exists", [order_exists])) (disch_tac [])) THEN (clear_assumption "order_exists") THEN BETA_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m - n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) (ANTS_TAC) ((((use_arg_then2 ("n_lt_m", [])) (disch_tac [])) THEN (clear_assumption "n_lt_m") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("m_lt", [])) (disch_tac [])) THEN (clear_assumption "m_lt") THEN ((use_arg_then2 ("n_lt_m", [])) (disch_tac [])) THEN (clear_assumption "n_lt_m") THEN BETA_TAC) THEN (arith_tac)); +];; + +(* Lemma expg_eq_mod *) +let expg_eq_mod = Sections.section_proof ["n"] +`expg (op, e) g n = expg (op, e) g (n MOD orderg (op, e) g) /\ + n MOD orderg (op, e) g < orderg (op, e) g` +[ + ((use_arg_then2 ("order_exists", [order_exists])) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["on0"]) THEN (case THEN ((move ["oe"]) THEN (move ["_"]))))))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DIVMOD_EXIST", [DIVMOD_EXIST])) (fun fst_arg -> (use_arg_then2 ("on0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["q"])) THEN (case THEN (move ["r"])) THEN (case THEN ((move ["n_eq"]) THEN (move ["r_lt"])))); + (((fun arg_tac -> (use_arg_then2 ("DIVMOD_UNIQ", [DIVMOD_UNIQ])) (fun fst_arg -> (use_arg_then2 ("n_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("r_lt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("expg_add", [expg_add])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("expg_expg", [expg_expg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("oe", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("exp1g", [exp1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("expg_in", [expg_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma expg_eq *) +let expg_eq = Sections.section_proof ["n"] +`?r. r < orderg (op, e) g /\ expg (op, e) g n = expg (op, e) g r` +[ + ((fun arg_tac -> arg_tac (Arg_term (`n MOD orderg (op, e) g`))) (term_tac exists_tac)); + (((((use_arg_then2 ("expg_eq_mod", [expg_eq_mod]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expg_eq_mod", [expg_eq_mod]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma cyclic_eq *) +let cyclic_eq = Sections.section_proof [] +`IMAGE (expg (op, e) g) UNIV = IMAGE (expg (op, e) g) (0..(orderg (op, e) g - 1))` +[ + ((THENL_ROT (-1)) ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["y"])) THEN ((THENL) (split_tac) [(case THEN ((move ["n"]) THEN (move ["y_eq"]))); ((case THEN (move ["n"])) THEN (move ["h"]))]))); + (((use_arg_then2 ("n", [])) (term_tac exists_tac)) THEN (done_tac)); + (((fun arg_tac -> (use_arg_then2 ("expg_eq", [expg_eq])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["r"])) THEN (case THEN ((move ["r_lt"]) THEN (move ["r_eq"])))); + (((use_arg_then2 ("r", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("r_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("r_lt", [])) (disch_tac [])) THEN (clear_assumption "r_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma cyclic_eq2 *) +let cyclic_eq2 = Sections.section_proof [] +`IMAGE (expg (op, e) g) UNIV = IMAGE (expg (op, e) g) (1..orderg (op, e) g)` +[ + ((use_arg_then2 ("order_exists", [order_exists])) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["on0"]) THEN (case THEN ((move ["oe"]) THEN (move ["_"]))))))); + ((((((use_arg_then2 ("cyclic_eq", [cyclic_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"])) THEN ((split_tac) THEN ALL_TAC THEN (case THEN (move ["n"])) THEN (case THEN ((move ["y_eq"]) THEN (move ["n_in"]))))); + (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n = 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["n_eq"])); + (((fun arg_tac -> arg_tac (Arg_term (`orderg (op, e) g`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expg0", [expg0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("oe", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("on0", [])) (disch_tac [])) THEN (clear_assumption "on0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((use_arg_then2 ("n", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n_in", [])) (disch_tac [])) THEN (clear_assumption "n_in") THEN ((use_arg_then2 ("n_eq", [])) (disch_tac [])) THEN (clear_assumption "n_eq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n = orderg (op, e) g`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["n_eq"])); + (((fun arg_tac -> arg_tac (Arg_term (`0`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expg0", [expg0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("oe", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq0n", [leq0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("n", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n_in", [])) (disch_tac [])) THEN (clear_assumption "n_in") THEN ((use_arg_then2 ("n_eq", [])) (disch_tac [])) THEN (clear_assumption "n_eq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma cyclic_finite *) +let cyclic_finite = Sections.section_proof [] +`FINITE (IMAGE (expg (op, e) g) UNIV)` +[ + (((((use_arg_then2 ("cyclic_eq2", [cyclic_eq2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma cyclic_card *) +let cyclic_card = Sections.section_proof [] +`CARD (IMAGE (expg (op, e) g) UNIV) = orderg (op, e) g` +[ + ((use_arg_then2 ("order_exists", [order_exists])) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["on0"]) THEN (case THEN ((move ["oe"]) THEN (move ["_"]))))))); + ((((use_arg_then2 ("cyclic_eq", [cyclic_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("CARD_IMAGE_INJ", [CARD_IMAGE_INJ]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("CARD_NUMSEG", [CARD_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))))); + (BETA_TAC THEN (move ["n"]) THEN (move ["m"]) THEN (case THEN (move ["n_in"])) THEN (case THEN (move ["m_in"]))); + (((((use_arg_then2 ("expg_inj", [expg_inj]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("on0", [])) (disch_tac [])) THEN (clear_assumption "on0") THEN ((use_arg_then2 ("m_in", [])) (disch_tac [])) THEN (clear_assumption "m_in") THEN ((use_arg_then2 ("n_in", [])) (disch_tac [])) THEN (clear_assumption "n_in") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("on0", [])) (disch_tac [])) THEN (clear_assumption "on0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma lt_order *) +let lt_order = Sections.section_proof ["n"] +`expg (op, e) g n = e ==> n < orderg (op, e) g ==> n = 0` +[ + (BETA_TAC THEN (move ["n_eq"]) THEN (move ["n_lt"])); + ((use_arg_then2 ("order_exists", [order_exists])) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["on0"]) THEN (case THEN ((move ["oe"]) THEN (move ["o_min"]))))))); + ((((fun arg_tac -> (use_arg_then2 ("o_min", [])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("implyNb", [implyNb]))(thm_tac (new_rewrite [] []))))) THEN (case THEN ((TRY done_tac)))); + ((((use_arg_then2 ("n_lt", [])) (disch_tac [])) THEN (clear_assumption "n_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma order_div *) +let order_div = Sections.section_proof ["n"] +`expg (op, e) g n = e <=> orderg (op, e) g divides n` +[ + ((use_arg_then2 ("order_exists", [order_exists])) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["on0"]) THEN (case THEN ALL_TAC) THEN (move ["oe"]) THEN (move ["_"]))))); + ((THENL) (split_tac) [(move ["n_eq"]); ALL_TAC]); + ((((fun arg_tac -> (use_arg_then2 ("DIVIDES_MOD", [DIVIDES_MOD])) (fun fst_arg -> (use_arg_then2 ("on0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lt_order", [lt_order])) (disch_tac [])) THEN (clear_assumption "lt_order") THEN (DISCH_THEN apply_tac))); + (((((use_arg_then2 ("expg_eq_mod", [expg_eq_mod]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expg_eq_mod", [expg_eq_mod]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("divides", [divides]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["q"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> (use_arg_then2 ("expg_expg", [expg_expg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("oe", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("exp1g", [exp1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma order_prime *) +let order_prime = Sections.section_proof ["p"] +`prime p ==> expg (op, e) g p = e ==> g = e \/ orderg (op, e) g = p` +[ + (((((use_arg_then2 ("prime", [prime]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("order_div", [order_div]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (move ["pH"])); + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("pH", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then2 ("order1", [order1]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section Cyclic *) +let order_e = Sections.finalize_theorem order_e;; +let INFINITE_SUBSET = Sections.finalize_theorem INFINITE_SUBSET;; +let order_exists0 = Sections.finalize_theorem order_exists0;; +let order_exists = Sections.finalize_theorem order_exists;; +let order1 = Sections.finalize_theorem order1;; +let fin_inv_expg = Sections.finalize_theorem fin_inv_expg;; +let expg_inj = Sections.finalize_theorem expg_inj;; +let expg_eq_mod = Sections.finalize_theorem expg_eq_mod;; +let expg_eq = Sections.finalize_theorem expg_eq;; +let cyclic_eq = Sections.finalize_theorem cyclic_eq;; +let cyclic_eq2 = Sections.finalize_theorem cyclic_eq2;; +let cyclic_finite = Sections.finalize_theorem cyclic_finite;; +let cyclic_card = Sections.finalize_theorem cyclic_card;; +let lt_order = Sections.finalize_theorem lt_order;; +let order_div = Sections.finalize_theorem order_div;; +let order_prime = Sections.finalize_theorem order_prime;; +Sections.end_section "Cyclic";; + +(* Section MoreCyclic *) +Sections.begin_section "MoreCyclic";; +(Sections.add_section_var (mk_var ("G", (`:A->bool`))));; +(Sections.add_section_var (mk_var ("op", (`:A->A->A`))));; +(Sections.add_section_var (mk_var ("i", (`:A->A`))));; +(Sections.add_section_var (mk_var ("e", (`:A`))));; +(Sections.add_section_var (mk_var ("g", (`:A`))));; +(Sections.add_section_hyp "grG" (`group (G, op, i, e)`));; +(Sections.add_section_hyp "finG" (`FINITE G`));; +(Sections.add_section_hyp "gG" (`g IN G`));; + +(* Lemma cyclic_subgroup *) +let cyclic_subgroup = Sections.section_proof [] +`subgroup op i (IMAGE (expg (op, e) g) UNIV) G` +[ + (((((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac)); + ((BETA_TAC THEN (move ["x"]) THEN (case THEN (move ["n"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("expg_in", [expg_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((use_arg_then2 ("IMAGE_EQ_EMPTY", [IMAGE_EQ_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("UNIV_NOT_EMPTY", [UNIV_NOT_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["n"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (case THEN ((move ["m"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fin_inv_expg", [fin_inv_expg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`expg (op, e) g m`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((fun arg_tac -> (use_arg_then2 ("expg_in", [expg_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))) THEN ALL_TAC THEN (case THEN (move ["k"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`n + m * k`))) (term_tac exists_tac)); + (((((fun arg_tac -> (use_arg_then2 ("expg_expg", [expg_expg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("expg_add", [expg_add])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma cyclic_group *) +let cyclic_group = Sections.section_proof [] +`group (IMAGE (expg (op, e) g) UNIV, op, i, e)` +[ + ((((fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("cyclic_subgroup", [cyclic_subgroup])) (disch_tac [])) THEN (clear_assumption "cyclic_subgroup") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma order_div_group *) +let order_div_group = Sections.section_proof [] +`orderg (op, e) g divides CARD G` +[ + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("LaGrange", [LaGrange])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cyclic_subgroup", [cyclic_subgroup])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("cyclic_card", [cyclic_card])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`CARD _`))) (term_tac (set_tac "c"))); + ((((use_arg_then2 ("divides", [divides]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("c", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section MoreCyclic *) +let cyclic_subgroup = Sections.finalize_theorem cyclic_subgroup;; +let cyclic_group = Sections.finalize_theorem cyclic_group;; +let order_div_group = Sections.finalize_theorem order_div_group;; +Sections.end_section "MoreCyclic";; + +(* Section Cauchy *) +Sections.begin_section "Cauchy";; +(Sections.add_section_var (mk_var ("p", (`:num`))));; +(Sections.add_section_var (mk_var ("G", (`:A->bool`))));; +(Sections.add_section_var (mk_var ("op", (`:A->A->A`))));; +(Sections.add_section_var (mk_var ("i", (`:A->A`))));; +(Sections.add_section_var (mk_var ("e", (`:A`))));; + +(* Lemma add_mod_alt *) +let add_mod_alt = Sections.section_proof ["n";"m"] +`n < p ==> m < p ==> + add_mod p n m = if n + m < p then n + m else (n + m) - p` +[ + ((BETA_TAC THEN (move ["np"]) THEN (move ["mp"])) THEN (((use_arg_then2 ("add_mod", [add_mod]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (((THENL) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ltnP", [ltnP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n + m`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [ALL_TAC; (move ["le"])]) THEN (simp_tac)) (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("MOD_LT", [MOD_LT])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (done_tac))); + ((((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("le", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((fun arg_tac -> (use_arg_then2 ("subnK", [subnK])) (fun fst_arg -> (use_arg_then2 ("le", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mul1n", [mul1n])) (fun fst_arg -> (use_arg_then2 ("p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("MOD_MULT_ADD", [MOD_MULT_ADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MOD_LT", [MOD_LT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("np", [])) (disch_tac [])) THEN (clear_assumption "np") THEN ((use_arg_then2 ("mp", [])) (disch_tac [])) THEN (clear_assumption "mp") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; +(Sections.add_section_hyp "prime_p" (`prime p`));; + +(* Lemma PRIME_DIVIDES *) +let PRIME_DIVIDES = Sections.section_proof ["n"] +`p divides n ==> n = 0 \/ 2 <= n` +[ + ((((use_arg_then2 ("divides", [divides]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["m"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((THENL) (((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN case) [ALL_TAC; (move ["m"])]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("muln0", [muln0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (DISJ2_TAC)); + ((((fun arg_tac -> (use_arg_then2 ("PRIME_GE_2", [PRIME_GE_2])) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; +(Sections.add_section_hyp "grG" (`group (G, op, i, e)`));; +(Sections.add_section_hyp "finG" (`FINITE G`));; + +(* Lemma has_size_group_tuples *) +let has_size_group_tuples = Sections.section_proof [] +`{t | sizel t = p /\ (!g. g <- t ==> g IN G) /\ foldr op e t = e} HAS_SIZE CARD G EXP (p - 1)` +[ + ((fun arg_tac -> arg_tac (Arg_term (`GSPEC _`))) (term_tac (set_tac "l"))); + ((fun arg_tac -> arg_tac (Arg_term (`l = IMAGE (\y. i (foldr op e y) :: y) {t | sizel t = p - 1 /\ (!g. g <- t ==> g IN G)}`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("l_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))))) THEN (move ["t"])); + ((THENL) (((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]))]); + (((((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [(`0 = p`)])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [(`[] = _`)])))) THEN (((use_arg_then2 ("NOT_CONS_NIL", [NOT_CONS_NIL]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (DISJ1_TAC)); + (((((fun arg_tac -> arg_tac (Arg_theorem (TAUT `!P. ~P <=> (P ==> F)`)))(thm_tac (new_rewrite [] [])))) THEN (move ["p_eq"])) THEN (((use_arg_then2 ("prime_p", [])) (disch_tac [])) THEN (clear_assumption "prime_p") THEN BETA_TAC)); + (((((use_arg_then2 ("p_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PRIME_0", [PRIME_0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (split_tac)); + ((BETA_TAC THEN (case THEN (move ["size_t"])) THEN (case THEN (move ["inG"]))) THEN ((((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (move ["prod_eq"]))); + ((THENL_ROT (-1)) (((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("eqseq_cons", [eqseq_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_t", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addn1", [addn1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addnK", [addnK]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac))); + ((BETA_TAC THEN (move ["g"]) THEN (move ["mem_g"])) THEN ((((use_arg_then2 ("inG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("prod_eq", [])) (disch_tac [])) THEN (clear_assumption "prod_eq") THEN BETA_TAC) THEN ((((fun arg_tac -> (use_arg_then2 ("mulg_left", [mulg_left])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("prod_in", [prod_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (TRY ((BETA_TAC THEN (move ["g"]) THEN (move ["mem_g"])))) THEN ((((use_arg_then2 ("inG", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((BETA_TAC THEN (case THEN (move ["t2"]))) THEN ((((use_arg_then2 ("eqseq_cons", [eqseq_cons]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["inG"]))))); + ((((use_arg_then2 ("prednK", [prednK]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lt0n", [lt0n]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("PRIME_IMP_NZ", [PRIME_IMP_NZ]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((((fun arg_tac -> (use_arg_then2 ("mulIg", [mulIg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("prod_in", [prod_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (move ["g"])) THEN ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); ((TRY done_tac))])); + (((((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("prod_in", [prod_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_LAST) (((use_arg_then2 ("HAS_SIZE_IMAGE_INJ", [HAS_SIZE_IMAGE_INJ])) (thm_tac apply_tac)) THEN (split_tac)) ((((use_arg_then2 ("has_size_tuples", [has_size_tuples]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((BETA_TAC THEN (move ["x"]) THEN (move ["y"])) THEN ((((use_arg_then2 ("eqseq_cons", [eqseq_cons]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma actsZ *) +let actsZ = Sections.section_proof [] +`acts ({k | k < p}, add_mod p, 0) + {t | sizel t = p /\ (!g. g <- t ==> g IN G) /\ foldr op e t = e} rot` +[ + ((THENL_LAST) ((((use_arg_then2 ("acts", [acts]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 2 ((split_tac)))) ((((use_arg_then2 ("rot0", [rot0]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((BETA_TAC THEN (move ["k"]) THEN (move ["t"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["k_p"])) THEN (case THEN (move ["size_t"])) THEN (case THEN (move ["inG"])))); + (((((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_rot", [mem_rot]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("inG", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (((THENL) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("cat_take_drop", [cat_take_drop])) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("prod_cat", [prod_cat])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) [(move ["g"]); (move ["g"]); ALL_TAC]) THEN (TRY (case)) THEN (TRY (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("mem_drop", [mem_drop])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC))) THEN (TRY (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("mem_take", [mem_take])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC))) THEN (TRY ((done_tac)))); + (((THENL) ((((fun arg_tac -> (use_arg_then2 ("mulg_left", [mulg_left])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("prod_in", [prod_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) [(move ["g"]); (move ["g"]); (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))]) THEN (TRY (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("mem_drop", [mem_drop])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC))) THEN (TRY (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("mem_take", [mem_take])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC))) THEN (TRY ((done_tac)))); + ((((((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("mulgI", [mulgI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("prod_in", [prod_in])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["g"])) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("mem_drop", [mem_drop])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (done_tac)); + ((BETA_TAC THEN (move ["k1"]) THEN (move ["k2"]) THEN (move ["t"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (case THEN ((move ["k1_p"]) THEN (move ["k2_p"])))) THEN (case THEN ((move ["size_t"]) THEN (move ["_"]))))); + ((((use_arg_then2 ("rot_add_mod", [rot_add_mod]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] [(`k1 <= _`)]))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] [(`k2 <= _`)]))))) THEN ((TRY done_tac))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("leqP", [leqP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`k1 + k2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sizel t`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac)); + ((((use_arg_then2 ("leq_eqVlt", [leq_eqVlt]))(thm_tac (new_rewrite [] [])))) THEN ((THENL) case [(move ["eq"]); (move ["ineq"])])); + (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot_size", [rot_size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add_mod_alt", [add_mod_alt]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("subnn", [subnn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot0", [rot0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("add_mod_alt", [add_mod_alt]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_t", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (move ["ineq"])); + ((((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add_mod_alt", [add_mod_alt]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("size_t", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("ltnW", [ltnW])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma fix_order *) +let fix_order = Sections.section_proof [] +`Fix {k | k < p} {t | sizel t = p /\ (!g. g <- t ==> g IN G) /\ foldr op e t = e} rot = + {nseq p g | g | g IN G /\ expg (op, e) g p = e}` +[ + ((THENL_ROT (-1)) ((((((use_arg_then2 ("fix", [fix]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["t"])) THEN (split_tac))); + (BETA_TAC THEN (case THEN (move ["g"])) THEN (case THEN ((case THEN ((move ["gG"]) THEN (move ["eq"]))) THEN (move ["t_eq"])))); + (((((use_arg_then2 ("t_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("size_nseq", [size_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("t_eq", []))(thm_tac (new_rewrite [2] [])))) THEN (((use_arg_then2 ("expg_prod", [expg_prod]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN ((split_tac) THEN (move ["h"]))); + (((((use_arg_then2 ("t_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_nseq", [in_nseq]))(thm_tac (new_rewrite [] []))))) THEN (TRY (((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac))))); + (((((use_arg_then2 ("implybF", [implybF]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["p0"])) THEN (((use_arg_then2 ("prime_p", [])) (disch_tac [])) THEN (clear_assumption "prime_p") THEN BETA_TAC)); + (((((use_arg_then2 ("p0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PRIME_0", [PRIME_0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("t_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot_nseq", [rot_nseq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (case THEN (case THEN (move ["size_t"]))) THEN (case THEN ((move ["inG"]) THEN (move ["prod_e"]) THEN (move ["rot_eq"])))); + ((fun arg_tac -> arg_tac (Arg_term (`HD t`))) (term_tac exists_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`t = nseq p (HD t)`))) (term_tac (have_gen_tac [](move ["eq"]))))); + ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [3] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expg_prod", [expg_prod]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("prod_e", []))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inG", []))(thm_tac (new_rewrite [] []))))); + ((THENL_LAST) ((THENL) (((use_arg_then2 ("size_t", [])) (disch_tac [])) THEN (clear_assumption "size_t") THEN ((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["tt"]))]) (((((use_arg_then2 ("HD", [HD]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("in_cons", [in_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac))); + (((((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (move ["eq"])) THEN (((use_arg_then2 ("prime_p", [])) (disch_tac [])) THEN (clear_assumption "prime_p") THEN BETA_TAC)); + (((((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("PRIME_0", [PRIME_0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("size_t", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rot_const", [rot_const]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma cauchy0 *) +let cauchy0 = Sections.section_proof [] +`p divides CARD G ==> ?g. g IN G /\ ~(g = e) /\ expg (op, e) g p = e` +[ + (BETA_TAC THEN (move ["p_div_G"])); + ((fun arg_tac -> arg_tac (Arg_term (`{t | sizel t = p /\ (!g. g <- t ==> g IN G) /\ foldr op e t = e}`))) (term_tac (set_tac "S"))); + ((fun arg_tac -> arg_tac (Arg_term (`p divides CARD S /\ FINITE S`))) (term_tac (have_gen_tac []ALL_TAC))); + ((((use_arg_then2 ("has_size_group_tuples", [has_size_group_tuples])) (disch_tac [])) THEN (clear_assumption "has_size_group_tuples") THEN BETA_TAC) THEN (((((use_arg_then2 ("S_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + ((((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIVIDES_REXP", [DIVIDES_REXP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("p_div_G", []))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("PRIME_GE_2", [PRIME_GE_2])) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (BETA_TAC THEN (case THEN ((move ["p_divS"]) THEN (move ["finS"])))); + ((((fun arg_tac -> (use_arg_then2 ("PRIME_IMP_NZ", [PRIME_IMP_NZ])) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lt0n", [lt0n]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("grZ", [grZ])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["grZ"]))); + ((fun arg_tac -> arg_tac (Arg_term (`CARD {k | k < p} = p EXP 1`))) (term_tac (have_gen_tac [](move ["cardZ"])))); + (((((use_arg_then2 ("CARD_NUMSEG_LT", [CARD_NUMSEG_LT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXP_1", [EXP_1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("p_div_fix", [p_div_fix])) (fun fst_arg -> (use_arg_then2 ("actsZ", [actsZ])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("grZ", [grZ])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("FINITE_NUMSEG_LT", [FINITE_NUMSEG_LT])) (fun fst_arg -> (use_arg_then2 ("p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cardZ", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("S_def", []))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> (fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("finS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p_divS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))); + ((fun arg_tac -> arg_tac (Arg_term (`FINITE (Fix {k | k < p} S rot)`))) (term_tac (have_gen_tac [](move ["fix_finite"])))); + (((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("S", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("finS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fix_subset", [fix_subset]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("fix_finite", [])) (disch_tac [])) THEN (clear_assumption "fix_finite") THEN BETA_TAC) THEN (((((use_arg_then2 ("S_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fix_order", [fix_order]))(thm_tac (new_rewrite [] []))))) THEN (move ["fix_finite"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("PRIME_DIVIDES", [PRIME_DIVIDES])) (thm_tac (match_mp_then snd_th MP_TAC)))))); + case; + ((((fun arg_tac -> (use_arg_then2 ("CARD_EQ_0", [CARD_EQ_0])) (fun fst_arg -> (use_arg_then2 ("fix_finite", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac) THEN (move ["_"]))); + ((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`nseq p e`))) (term_tac exists_tac))); + (((((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("exp1g", [exp1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`GSPEC _`))) (term_tac (set_tac "fix"))) THEN (move ["fix2"])); + ((fun arg_tac -> arg_tac (Arg_term (`?n. fix HAS_SIZE (SUC (SUC n))`))) (term_tac (have_gen_tac []ALL_TAC))); + (((fun arg_tac -> arg_tac (Arg_term (`CARD fix - 2`))) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("addn1", [addn1]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("addnA", [addnA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("add1n", [add1n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("TWO", [TWO]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("subnK", [subnK]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("FINITE_HAS_SIZE", [FINITE_HAS_SIZE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((BETA_TAC THEN (case THEN (move ["n"]))) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL HAS_SIZE_CLAUSES)))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["a1"])) THEN (case THEN (move ["t1"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["a2"])) THEN (case THEN (move ["t2"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN ((move ["na12"]) THEN (move ["_"]))) THEN (move ["fix_eq"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`a1 IN fix /\ a2 IN fix`))) (term_tac (have_gen_tac []ALL_TAC))) (((((use_arg_then2 ("fix_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("fix_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (case THEN (move ["g1"]))) THEN (case THEN ((case THEN ((move ["g1G"]) THEN (move ["g1e"]))) THEN (move ["a1_eq"]))) THEN (case THEN (move ["g2"])) THEN (case THEN ((case THEN ((move ["g2G"]) THEN (move ["g2e"]))) THEN (move ["a2_eq"])))); + ((THENL_LAST) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`g1 = e`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) ((BETA_TAC THEN (move ["g1_not_e"])) THEN ((use_arg_then2 ("g1", [])) (term_tac exists_tac)) THEN (done_tac))); + (BETA_TAC THEN (move ["g1_eq_e"])); + (((use_arg_then2 ("g2", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("g2G", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("g2e", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("g1_eq_e", []))(gsym_then (thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("na12", [])) (disch_tac [])) THEN (clear_assumption "na12") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("a1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("a2_eq", []))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma cauchy *) +let cauchy = Sections.section_proof [] +`p divides CARD G ==> ?H. subgroup op i H G /\ CARD H = p` +[ + ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("cauchy0", [cauchy0])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["g"])) THEN (case THEN (move ["gG"])) THEN (case THEN (move ["gne"])) THEN (move ["exp_e"])); + ((fun arg_tac -> arg_tac (Arg_term (`IMAGE (expg (op, e) g) UNIV`))) (term_tac exists_tac)); + ((((fun arg_tac -> (use_arg_then2 ("cyclic_subgroup", [cyclic_subgroup])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("cyclic_card", [cyclic_card])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("order_prime", [order_prime])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("gG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("exp_e", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("gne", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section Cauchy *) +let add_mod_alt = Sections.finalize_theorem add_mod_alt;; +let PRIME_DIVIDES = Sections.finalize_theorem PRIME_DIVIDES;; +let has_size_group_tuples = Sections.finalize_theorem has_size_group_tuples;; +let actsZ = Sections.finalize_theorem actsZ;; +let fix_order = Sections.finalize_theorem fix_order;; +let cauchy0 = Sections.finalize_theorem cauchy0;; +let cauchy = Sections.finalize_theorem cauchy;; +Sections.end_section "Cauchy";; + +(* Section GroupActions *) +Sections.begin_section "GroupActions";; +(Sections.add_section_var (mk_var ("G", (`:A->bool`))));; +(Sections.add_section_var (mk_var ("op", (`:A->A->A`))));; +(Sections.add_section_var (mk_var ("i", (`:A->A`))));; +(Sections.add_section_var (mk_var ("e", (`:A`))));; +(Sections.add_section_var (mk_var ("H", (`:A->bool`))));; +(Sections.add_section_hyp "grG" (`group (G, op, i, e)`));; + +(* Lemma finite_subgroups *) +let finite_subgroups = Sections.section_proof [] +`FINITE G ==> FINITE {K | subgroup op i K G}` +[ + ((BETA_TAC THEN (move ["finG"])) THEN ((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`{t | t SUBSET G}`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("FINITE_POWERSET", [FINITE_POWERSET]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("subgroup", [subgroup]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma finite_n_subgroups *) +let finite_n_subgroups = Sections.section_proof ["n"] +`FINITE G ==> FINITE {K | subgroup op i K G /\ K HAS_SIZE n}` +[ + ((BETA_TAC THEN (move ["finG"])) THEN ((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`{K | subgroup op i K G}`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("finite_subgroups", [finite_subgroups]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma subgroups_size_eq_card *) +let subgroups_size_eq_card = Sections.section_proof ["n"] +`FINITE G ==> + {K | subgroup op i K G /\ K HAS_SIZE n} = {K | subgroup op i K G /\ CARD K = n}` +[ + ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] []))))) THEN (move ["finG"]) THEN (move ["K"])) THEN (((use_arg_then2 ("andb_id2l", [andb_id2l])) (disch_tac [])) THEN (clear_assumption "andb_id2l") THEN (DISCH_THEN apply_tac) THEN (move ["subK"]))); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (use_arg_then2 ("K", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("G", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma group_acts_on_cosets *) +let group_acts_on_cosets = Sections.section_proof ["K"] +`K SUBSET G ==> acts (G, op, e) (cosets op G K) (\g. set_op1 (op g))` +[ + ((BETA_TAC THEN (move ["sKG"])) THEN (((use_arg_then2 ("acts", [acts]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 ((split_tac)))); + ((BETA_TAC THEN (move ["g"]) THEN (move ["c"])) THEN (((((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["gG"])) THEN (case THEN (move ["h"])) THEN (case THEN (move ["hG"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> arg_tac (Arg_term (`op g h`))) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("left_mul_coset", [left_mul_coset])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["g1"]) THEN (move ["g2"]) THEN (move ["c"]) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["g1G"]) THEN (move ["g2G"]))) THEN (case THEN (move ["g"])) THEN (case THEN (move ["gG"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("left_mul_coset", [left_mul_coset])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("in_group", [in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulgA", [mulgA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["c"]) THEN (case THEN (move ["g"])) THEN (case THEN ((move ["gG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((fun arg_tac -> (use_arg_then2 ("left_mul_coset", [left_mul_coset])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("e_in_group", [e_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mul1g", [mul1g])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma group_acts_on_subgroups *) +let group_acts_on_subgroups = Sections.section_proof ["n"] +`acts (G, op, e) + {K | subgroup op i K G /\ K HAS_SIZE n} (\g. set_op1 (conjg (op, i) (i g)))` +[ + (((((use_arg_then2 ("acts", [acts]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (repeat_tactic 1 9 ((split_tac)))); + (BETA_TAC THEN (move ["g"]) THEN (move ["K"]) THEN (case THEN (move ["gG"])) THEN (case THEN (move ["subK"])) THEN (move ["sizeK"])); + ((((fun arg_tac -> (use_arg_then2 ("subgroup_conjg", [subgroup_conjg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> (use_arg_then2 ("conjg_set_has_size", [conjg_set_has_size])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (move ["g1"]) THEN (move ["g2"]) THEN (move ["K"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["g1G"])) THEN (move ["g2G"]) THEN (case THEN (move ["subK"])) THEN (move ["sizeK"])); + (((((fun arg_tac -> (use_arg_then2 ("mul_conjg_set", [mul_conjg_set])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mulI", [mulI])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (move ["K"]) THEN (case THEN (move ["subK"])) THEN (move ["sizeK"])); + (((((fun arg_tac -> (use_arg_then2 ("invg1", [invg1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("conj1g_set", [conj1g_set])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma conj_subgroup_stab *) +let conj_subgroup_stab = Sections.section_proof ["K"] +`K SUBSET G ==> + (Stab G (\g. set_op1 (conjg (op, i) (i g))) K = normalizer op i G K)` +[ + (BETA_TAC THEN (move ["sKG"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("normalizer_subgroup", [normalizer_subgroup])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["subN"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grN"]))); + ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("stab", [stab]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"])) THEN ((THENL) (split_tac) [(case THEN ((move ["xG"]) THEN (move ["K_eq"]))); (move ["xN"])])); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("invgK", [invgK])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("in_normalizer0", [in_normalizer0])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("xN", [])) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("xN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("in_normalizer0", [in_normalizer0])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(Sections.add_section_hyp "subH" (`subgroup op i H G`));; + +(* Lemma subgroup_acts_on_cosets *) +let subgroup_acts_on_cosets = Sections.section_proof ["K"] +`K SUBSET G ==> acts (H, op, e) (cosets op G K) (\h. set_op1 (op h))` +[ + ((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"]))); + (BETA_TAC THEN (move ["sKG"])); + (((fun arg_tac -> (use_arg_then2 ("acts_sub", [acts_sub])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("group_acts_on_cosets", [group_acts_on_cosets])) (fun fst_arg -> (use_arg_then2 ("sKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +];; + +(* Lemma subgroup_acts_on_subgroups *) +let subgroup_acts_on_subgroups = Sections.section_proof ["n"] +`acts (H, op, e) + {K | subgroup op i K G /\ K HAS_SIZE n} (\g. set_op1 (conjg (op, i) (i g)))` +[ + ((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"]))); + (((fun arg_tac -> (use_arg_then2 ("acts_sub", [acts_sub])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("group_acts_on_subgroups", [group_acts_on_subgroups])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +];; +(Sections.add_section_hyp "finG" (`FINITE G`));; + +(* Lemma subgroup_left_mul_fix *) +let subgroup_left_mul_fix = Sections.section_proof [] +`Fix H (cosets op G H) (\h. set_op1 (op h)) = + cosets op (normalizer op i G H) H` +[ + ((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finH"]))); + ((((use_arg_then2 ("sHG", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["sHG'"]))); + ((THENL_ROT (-1)) ((((((use_arg_then2 ("fix", [fix]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["c"])) THEN (split_tac))); + ((BETA_TAC THEN (case THEN (move ["x"]))) THEN (((((fun arg_tac -> (use_arg_then2 ("in_normalizer", [in_normalizer])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["xG"])) THEN (move ["eq"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`coset op x H`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)) (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac))); + ((BETA_TAC THEN (move ["h"]) THEN (move ["hH"])) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_op1_lmul", [set_op1_lmul]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("set_opA", [set_opA])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("xG", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sHG'", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("coset_op", [coset_op]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("coset_eq_e", [coset_eq_e])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["c1"])) THEN (case THEN ALL_TAC) THEN (case THEN ALL_TAC) THEN (case THEN (move ["x"])) THEN (case THEN ((move ["xG"]) THEN (move ["c1_eq"]))) THEN (move ["h_eq"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("c1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("in_normalizer", [in_normalizer])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("xG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((THENL_ROT (-1)) ((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET_CARD_EQ", [SUBSET_CARD_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("set_lmul_card", [set_lmul_card])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("set_rmul_card", [set_rmul_card])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_op1_eq_image", [set_op1_eq_image]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN (move ["a"]) THEN (case THEN (move ["h"])) THEN (case THEN (move ["s2"])) THEN (case THEN (move ["hH"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("h_eq", [])) (fun fst_arg -> (use_arg_then2 ("hH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("SUBSET_ANTISYM_EQ", [SUBSET_ANTISYM_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("c1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`op h x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN (ANTS_TAC)); + ((((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("x_in_coset", [x_in_coset])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["h2"])) THEN (case THEN (move ["h2H"])) THEN (move ["op_eq"]) THEN (move ["_"])); + (((use_arg_then2 ("h2", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Finalization of the section GroupActions *) +let finite_subgroups = Sections.finalize_theorem finite_subgroups;; +let finite_n_subgroups = Sections.finalize_theorem finite_n_subgroups;; +let subgroups_size_eq_card = Sections.finalize_theorem subgroups_size_eq_card;; +let group_acts_on_cosets = Sections.finalize_theorem group_acts_on_cosets;; +let group_acts_on_subgroups = Sections.finalize_theorem group_acts_on_subgroups;; +let conj_subgroup_stab = Sections.finalize_theorem conj_subgroup_stab;; +let subgroup_acts_on_cosets = Sections.finalize_theorem subgroup_acts_on_cosets;; +let subgroup_acts_on_subgroups = Sections.finalize_theorem subgroup_acts_on_subgroups;; +let subgroup_left_mul_fix = Sections.finalize_theorem subgroup_left_mul_fix;; +Sections.end_section "GroupActions";; + +(* Lemma max_expn_divides *) +let max_expn_divides = Sections.section_proof ["c";"p";"n";"m"] +`prime p ==> c = (p EXP n) * m ==> coprime (p, m) ==> + p EXP n divides c /\ ~(p EXP (SUC n) divides c)` +[ + ((BETA_TAC THEN (move ["prime_p"]) THEN (move ["c_eq"]) THEN (move ["c_pm"])) THEN (split_tac)); + (((((use_arg_then2 ("c_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("divides", [divides]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("m", [])) (term_tac exists_tac)) THEN (done_tac)); + (((((use_arg_then2 ("c_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXP", [EXP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIVIDES_LMUL2_EQ", [DIVIDES_LMUL2_EQ]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("expn_eq0", [expn_eq0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("PRIME_IMP_NZ", [PRIME_IMP_NZ]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("PRIME_COPRIME_EQ", [PRIME_COPRIME_EQ]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Section Sylow *) +Sections.begin_section "Sylow";; +(Sections.add_section_var (mk_var ("G", (`:A->bool`))));; +(Sections.add_section_var (mk_var ("op", (`:A->A->A`))));; +(Sections.add_section_var (mk_var ("i", (`:A->A`))));; +(Sections.add_section_var (mk_var ("e", (`:A`))));; +(Sections.add_section_var (mk_var ("p", (`:num`))));; +(Sections.add_section_hyp "grG" (`group (G,op,i,e)`));; +(Sections.add_section_hyp "finG" (`FINITE G`));; +(Sections.add_section_hyp "prime_p" (`prime p`));; + +(* Lemma sylow1 *) +let sylow1 = Sections.section_proof [] +`!n. p EXP n divides CARD G ==> ?H. subgroup op i H G /\ CARD H = p EXP n` +[ + ((THENL_FIRST) ((THENL) elim [(move ["_"]); ((move ["n"]) THEN (move ["IH"]) THEN (move ["pSn"]))]) (((fun arg_tac -> arg_tac (Arg_term (`{e}`))) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("subgroup_e", [subgroup_e])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_sing", [card_sing]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXP", [EXP]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("pSn", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("EXP", [EXP]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("DIVIDES_LMUL2", [DIVIDES_LMUL2])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IH", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["H"])) THEN (case THEN ((move ["subH"]) THEN (move ["cH"]))))); + ((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("normalizer_subgroup", [normalizer_subgroup])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["subN"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grN"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("normal_in_normalizer", [normal_in_normalizer])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["normH"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("quotient_group", [quotient_group])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grNH"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("normalizer_subset", [normalizer_subset])) (fun fst_arg -> (use_arg_then2 ("op", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("H", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("G", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finN"]))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("finite_index", [finite_index])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finNH"]))); + ((fun arg_tac -> arg_tac (Arg_term (`normalizer op i G H`))) (term_tac (set_tac "N"))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`p divides CARD (cosets op N H)`))) (term_tac (have_gen_tac [](move ["p_div"]))))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("cauchy", [cauchy])) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("grNH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finNH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p_div", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["K1"])) THEN (case THEN ((move ["subK1"]) THEN (move ["cK1"])))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_of_quotient", [subgroup_of_quotient])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("normH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("K1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("subK1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["K"])) THEN (case THEN (move ["subK"])) THEN (case THEN (move ["normK"])) THEN (move ["K_eq_K1"]))); + (((use_arg_then2 ("K", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_trans", [subgroup_trans])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("LaGrange", [LaGrange])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (use_arg_then2 ("normK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("cH", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("K_eq_K1", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("cK1", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (disch_tac [])) THEN (clear_assumption "FINITE_SUBSET") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then2 ("N", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("finN", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("N_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("subgroup_left_mul_fix", [subgroup_left_mul_fix])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((use_arg_then2 ("p_div_fix", [p_div_fix])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("op", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("i", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("n", [])) (term_tac exists_tac)))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finH"]))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("finite_index", [finite_index])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finGH"]))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("subgroup_acts_on_cosets", [subgroup_acts_on_cosets])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("prime_p", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqxx", [eqxx]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("finH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("finGH", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("DIVIDES_CMUL2", [DIVIDES_CMUL2])) (disch_tac [])) THEN (clear_assumption "DIVIDES_CMUL2") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`p EXP n`))) (term_tac exists_tac))); + (((((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXP", [EXP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("expn_eq0", [expn_eq0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("PRIME_IMP_NZ", [PRIME_IMP_NZ])) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("cH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("LaGrange", [LaGrange])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma sylow2 *) +let sylow2 = Sections.section_proof ["n";"H";"K"] +`~(p EXP (SUC n) divides CARD G) /\ + subgroup op i H G /\ subgroup op i K G /\ CARD H = p EXP n /\ CARD K = p EXP n ==> + ?g. g IN G /\ H = set_op1 (conjg (op, i) g) K` +[ + (BETA_TAC THEN (case THEN (move ["p_n_div"])) THEN (case THEN (move ["subH"])) THEN (case THEN (move ["subK"])) THEN (case THEN (move ["cH"])) THEN (move ["cK"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grK"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"]))); + ((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"]))); + ((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sKG"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finK"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finH"]))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("finite_index", [finite_index])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finGH"]))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_acts_on_cosets", [subgroup_acts_on_cosets])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["actsK"]))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fix_mod_p", [fix_mod_p])) (fun fst_arg -> (use_arg_then2 ("actsK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("grK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finGH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((fun arg_tac -> arg_tac (Arg_term (`Fix K _1 _2`))) (term_tac (set_tac "S")))); + (BETA_TAC THEN (move ["fix_mod"])); + ((fun arg_tac -> arg_tac (Arg_term (`?c. c IN S`))) (term_tac (have_gen_tac []ALL_TAC))); + ((THENL_LAST) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`S HAS_SIZE 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) (((((use_arg_then2 ("HAS_SIZE_0", [HAS_SIZE_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["finS"]) THEN (move ["cS0"])))); + ((((use_arg_then2 ("fix_mod", [])) (disch_tac [])) THEN (clear_assumption "fix_mod") THEN BETA_TAC) THEN ((((use_arg_then2 ("cS0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MOD_0", [MOD_0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("PRIME_IMP_NZ", [PRIME_IMP_NZ]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIVIDES_MOD", [DIVIDES_MOD]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("PRIME_IMP_NZ", [PRIME_IMP_NZ]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac) THEN (move ["_"])) THEN (((use_arg_then2 ("p_n_div", [])) (disch_tac [])) THEN (clear_assumption "p_n_div") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (move ["p_div"]))); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("LaGrange", [LaGrange])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("cH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXP", [EXP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIVIDES_MUL_R", [DIVIDES_MUL_R]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (case THEN (move ["c"]))) THEN (((((use_arg_then2 ("S_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fix", [fix]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cosets", [cosets]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["x"])) THEN (case THEN ((move ["xG"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["x_eq"]))); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("xG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((THENL_ROT (-1)) ((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("conjg_set_equiv", [conjg_set_equiv])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SUBSET_CARD_EQ", [SUBSET_CARD_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))))); + (((((fun arg_tac -> (use_arg_then2 ("set_lmul_card", [set_lmul_card])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("set_rmul_card", [set_rmul_card])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("set_op1_eq_image", [set_op1_eq_image]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op", [in_set_op]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (move ["a"]) THEN (case THEN (move ["k"])) THEN (case THEN (move ["s2"])) THEN (case THEN (move ["kK"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("x_eq", [])) (fun fst_arg -> (use_arg_then2 ("kK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("SUBSET_ANTISYM_EQ", [SUBSET_ANTISYM_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`op k x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN (ANTS_TAC)); + ((((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("x_in_coset", [x_in_coset])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((use_arg_then2 ("coset_op1", [coset_op1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_set_op1", [in_set_op1]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["h"])) THEN (case THEN (move ["hH"])) THEN (move ["op_eq"]) THEN (move ["_"])); + (((use_arg_then2 ("h", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma sylow3_1 *) +let sylow3_1 = Sections.section_proof ["n";"H"] +`~(p EXP (SUC n) divides CARD G) /\ subgroup op i H G /\ CARD H = p EXP n ==> + CARD {K | subgroup op i K G /\ CARD K = p EXP n} = CARD (cosets op G (normalizer op i G H))` +[ + (BETA_TAC THEN (case THEN (move ["p_n_div"])) THEN (case THEN (move ["subH"])) THEN (move ["cH"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"]))); + ((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"]))); + ((fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (fun arg_tac ->(use_arg_then2 ("finG", []))(fun tmp_arg1 -> (use_arg_then2 ("sHG", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2)))))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finH"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("group_acts_on_subgroups", [group_acts_on_subgroups])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`p EXP n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["actsG"]))); + ((((fun arg_tac -> (use_arg_then2 ("conj_subgroup_stab", [conj_subgroup_stab])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("card_orbit", [card_orbit])) (fun fst_arg -> (use_arg_then2 ("actsG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((fun arg_tac -> (use_arg_then2 ("finite_n_subgroups", [finite_n_subgroups])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_ROT (-1)) (((use_arg_then2 ("congr1", [congr1])) (thm_tac apply_tac)) THEN (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbit", [orbit]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["K"])) THEN ((THENL) (split_tac) [((case THEN (move ["subK"])) THEN (move ["cK"])); ((case THEN (move ["g"])) THEN (case THEN (move ["gG"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))]))); + (((((fun arg_tac -> (use_arg_then2 ("subgroup_conjg", [subgroup_conjg])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("conjg_set_card", [conjg_set_card])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sylow2", [sylow2])) (fun fst_arg -> (use_arg_then2 ("p_n_div", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["g"])) THEN (case THEN (move ["gG"])) THEN (move ["K_eq"])); + (((fun arg_tac -> arg_tac (Arg_term (`i g`))) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("invgK", [invgK])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sylow3_2 *) +let sylow3_2 = Sections.section_proof ["n";"m"] +`CARD G = (p EXP n) * m /\ coprime (p, m) ==> + CARD {K | subgroup op i K G /\ CARD K = p EXP n} divides m` +[ + (BETA_TAC THEN (case THEN ((move ["cG"]) THEN (move ["c_pm"])))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("max_expn_divides", [max_expn_divides])) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("c_pm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["p_div"]) THEN (move ["p_n_div"]))))); + (((fun arg_tac -> (use_arg_then2 ("sylow1", [sylow1])) (fun fst_arg -> (use_arg_then2 ("p_div", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["H"])) THEN (case THEN (move ["subH"])) THEN (move ["cH"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sylow3_1", [sylow3_1])) (fun fst_arg -> (use_arg_then2 ("p_n_div", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("normalizer_subgroup", [normalizer_subgroup])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sHG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["subN"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grN"]))); + ((fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("normal_in_normalizer", [normal_in_normalizer])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["subHN"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finN"]))); + ((fun arg_tac -> arg_tac (Arg_term (`normalizer op i G H`))) (term_tac (set_tac "N"))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("LaGrange", [LaGrange])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("LaGrange", [LaGrange])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subHN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("cG", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulnA", [mulnA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqn_mul2r", [eqn_mul2r]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expn_eq0", [expn_eq0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PRIME_IMP_NZ", [PRIME_IMP_NZ]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((THENL) case [(simp_tac); (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))])); + ((((use_arg_then2 ("divides", [divides]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`CARD (cosets op N H)`))) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Finalization of the section Sylow *) +let sylow1 = Sections.finalize_theorem sylow1;; +let sylow2 = Sections.finalize_theorem sylow2;; +let sylow3_1 = Sections.finalize_theorem sylow3_1;; +let sylow3_2 = Sections.finalize_theorem sylow3_2;; +Sections.end_section "Sylow";; + +(* Section Sylow3_final *) +Sections.begin_section "Sylow3_final";; +(Sections.add_section_var (mk_var ("G", (`:A->bool`))));; +(Sections.add_section_var (mk_var ("op", (`:A->A->A`))));; +(Sections.add_section_var (mk_var ("i", (`:A->A`))));; +(Sections.add_section_var (mk_var ("e", (`:A`))));; +(Sections.add_section_var (mk_var ("p", (`:num`))));; +(Sections.add_section_hyp "grG" (`group (G,op,i,e)`));; +(Sections.add_section_hyp "finG" (`FINITE G`));; +(Sections.add_section_hyp "prime_p" (`prime p`));; + +(* Lemma sylow3_3 *) +let sylow3_3 = Sections.section_proof ["n";"m"] +`CARD G = (p EXP n) * m /\ coprime (p, m) ==> + CARD {K | subgroup op i K G /\ CARD K = p EXP n} MOD p = 1` +[ + (BETA_TAC THEN (case THEN ((move ["cG"]) THEN (move ["c_pm"])))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("max_expn_divides", [max_expn_divides])) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("c_pm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["p_div"]) THEN (move ["p_n_div"]))))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sylow1", [sylow1])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p_div", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["H"])) THEN (case THEN (move ["subH"])) THEN (move ["cH"])); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_acts_on_subgroups", [subgroup_acts_on_subgroups])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`p EXP n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["actsH"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grH"]))); + ((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sHG"]))); + ((fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (fun arg_tac ->(use_arg_then2 ("finG", []))(fun tmp_arg1 -> (use_arg_then2 ("sHG", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2)))))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finH"]))); + ((((fun arg_tac -> (use_arg_then2 ("subgroups_size_eq_card", [subgroups_size_eq_card])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fix_mod_p", [fix_mod_p])) (fun fst_arg -> (use_arg_then2 ("actsH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("finite_n_subgroups", [finite_n_subgroups])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`Fix H _1 _2`))) (term_tac (set_tac "fix_set"))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`fix_set = {H}`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + (((((use_arg_then2 ("card_sing", [card_sing]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MOD_LT", [MOD_LT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((fun arg_tac -> (use_arg_then2 ("PRIME_GE_2", [PRIME_GE_2])) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_ROT (-1)) ((((((use_arg_then2 ("fix_set_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fix", [fix]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))))) THEN (move ["K"])) THEN ((THENL) (split_tac) [ALL_TAC; (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))]))); + (((((use_arg_then2 ("subH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("finH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cH", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["h"]) THEN (move ["hH"])); + (((((fun arg_tac -> (use_arg_then2 ("group_conjgK", [group_conjgK])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["subK"])) THEN (case THEN (move ["finK"])) THEN (move ["cK"]) THEN (move ["k_eq"])); + ((fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sKG"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("normalizer_subgroup", [normalizer_subgroup])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sKG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["subN"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subgroup_group", [subgroup_group])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["grN"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("normal_in_normalizer", [normal_in_normalizer])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["normKN"]))); + ((fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (fun arg_tac ->(use_arg_then2 ("finG", []))(fun tmp_arg1 -> (fun arg_tac -> (use_arg_then2 ("subgroup_subset", [subgroup_subset])) (fun fst_arg -> (use_arg_then2 ("subN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2)))))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finN"]))); + ((fun arg_tac -> arg_tac (Arg_term (`normalizer op i G K`))) (term_tac (set_tac "N"))); + ((fun arg_tac -> arg_tac (Arg_term (`subgroup op i H N`))) (term_tac (have_gen_tac [](move ["subHN"])))); + (((((fun arg_tac -> (use_arg_then2 ("subgroup_alt2", [subgroup_alt2])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("grH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("N_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("in_normalizer0", [in_normalizer0])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (move ["h"]) THEN (move ["hH"])); + (((((fun arg_tac -> (use_arg_then2 ("in_subgroup", [in_subgroup])) (fun fst_arg -> (use_arg_then2 ("subH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("k_eq", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i h`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("i_in_group", [i_in_group])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("invgK", [invgK])) (fun fst_arg -> (use_arg_then2 ("grH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`~(p EXP (SUC n) divides CARD N)`))) (term_tac (have_gen_tac [](move ["p_n_divN"])))); + ((((use_arg_then2 ("p_n_div", [])) (disch_tac [])) THEN (clear_assumption "p_n_div") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (move ["div"])) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("LaGrange", [LaGrange])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("DIVIDES_LMUL", [DIVIDES_LMUL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sylow2", [sylow2])) (fun fst_arg -> (use_arg_then2 ("grN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("finN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("prime_p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p_n_divN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subHN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("normal_subgroup", [normal_subgroup])) (fun fst_arg -> (use_arg_then2 ("normKN", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("cK", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((BETA_TAC THEN (case THEN (move ["g"]))) THEN (((((use_arg_then2 ("N_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("in_normalizer0", [in_normalizer0])) (fun fst_arg -> (use_arg_then2 ("grG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["_"])) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Sylow3_final *) +let sylow3_3 = Sections.finalize_theorem sylow3_3;; +Sections.end_section "Sylow3_final";; diff --git a/jHOLLight/Examples/seq-compiled.hl b/jHOLLight/Examples/seq-compiled.hl new file mode 100644 index 0000000..a8e0288 --- /dev/null +++ b/jHOLLight/Examples/seq-compiled.hl @@ -0,0 +1,3821 @@ +needs "Examples/ssrnat-compiled.hl";; + +(* Module Seq*) +module Seq = struct + +open Ssrfun;; +open Ssrbool;; +open Ssrnat;; +prioritize_num();; + +(* Section Sequences *) +Sections.begin_section "Sequences";; +(Sections.add_section_var (mk_var ("n0", (`:num`))));; +(Sections.add_section_var (mk_var ("x0", (`:A`))));; +(Sections.add_section_type (mk_var ("x", (`:A`))); Sections.add_section_type (mk_var ("y", (`:A`))); Sections.add_section_type (mk_var ("z", (`:A`))));; +(Sections.add_section_type (mk_var ("m", (`:num`))); Sections.add_section_type (mk_var ("n", (`:num`))));; +(Sections.add_section_type (mk_var ("s", (`:(A)list`))));; +let size = new_definition `sizel = LENGTH`;; + +(* Lemma size0nil *) +let size0nil = Sections.section_proof ["s"] +`sizel s = 0 ==> s = []` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]))]) THEN (BETA_TAC THEN ((TRY done_tac))) THEN ((((use_arg_then2 ("size", [size]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("LENGTH", [LENGTH]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (arith_tac) THEN (done_tac)); +];; +let nilp = new_definition `!(s:(A)list). nilp s <=> (sizel s = 0)`;; + +(* Lemma nilP *) +let nilP = Sections.section_proof ["s"] +`s = [] <=> nilp s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]))]) THEN ((((use_arg_then2 ("nilp", [nilp]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LENGTH", [LENGTH]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("NOT_CONS_NIL", [NOT_CONS_NIL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_SUC", [NOT_SUC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +let head = define `!(x0:A) h t. headl x0 [] = x0 /\ headl x0 (CONS h t) = h`;; +let behead = define `!(h:A) t. behead [] = [] /\ behead (CONS h t) = t`;; + +(* Lemma size_behead *) +let size_behead = Sections.section_proof ["s"] +`sizel (behead s) = (sizel s) - 1` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]))]) THEN ((((use_arg_then2 ("behead", [behead]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size", [size]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("LENGTH", [LENGTH]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("SUC_SUB1", [SUC_SUB1]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("sub0n", [sub0n]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; +let ncons = new_definition `!n (x:A). ncons n x = iter n (CONS x)`;; +let nseq = new_definition `!n (x:A). nseq n x = ncons n x []`;; + +(* Lemma size_nil *) +let size_nil = Sections.section_proof [] +`sizel ([]:(A)list) = 0` +[ + (((((use_arg_then2 ("size", [size]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("LENGTH", [LENGTH]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma size_cons *) +let size_cons = Sections.section_proof ["h";"t"] +`sizel (CONS (h:A) t) = SUC (sizel t)` +[ + (((((use_arg_then2 ("size", [size]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("LENGTH", [LENGTH]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma size_ncons *) +let size_ncons = Sections.section_proof ["n";"x";"s"] +`sizel (ncons n x s) = n + sizel s` +[ + ((((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ncons", [ncons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((repeat_tactic 0 10 (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["n"]) THEN (move ["IH"]))); + (((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addSn", [addSn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma size_nseq *) +let size_nseq = Sections.section_proof ["n";"x"] +`sizel (nseq n (x:A)) = n` +[ + (((((use_arg_then2 ("nseq", [nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_ncons", [size_ncons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addn0", [addn0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +parse_as_infix ("::", (12, "right"));; +override_interface ("::", `CONS`);; +make_overloadable "++" `:A -> A -> A`;; +let cat = define `!(x:A) t s2. cat [] s2 = s2 /\ cat (CONS x t) s2 = x :: cat t s2`;; +overload_interface ("++", `cat`);; + +(* Lemma cat0s *) +let cat0s = Sections.section_proof ["s"] +`[] ++ (s:(A)list) = s` +[ + ((((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma cat1s *) +let cat1s = Sections.section_proof ["x";"s"] +`[x:A] ++ s = x :: s` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma cat_cons *) +let cat_cons = Sections.section_proof ["x";"s1";"s2"] +`(x :: s1) ++ s2 = x :: s1 ++ s2` +[ + ((((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma cat_nseq *) +let cat_nseq = Sections.section_proof ["n";"x";"s"] +`nseq n (x:A) ++ s = ncons n x s` +[ + ((((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) THEN (((((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))) THEN (move ["n"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma cats0 *) +let cats0 = Sections.section_proof ["s"] +`s ++ [] = (s:(A)list)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]))]) THEN (((((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma catA *) +let catA = Sections.section_proof ["s1";"s2";"s3"] +`s1 ++ s2 ++ s3 = (s1 ++ s2) ++ s3:(A)list` +[ + (((THENL) (((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s1"]))]) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma size_cat *) +let size_cat = Sections.section_proof ["s1";"s2"] +`sizel (s1 ++ s2) = sizel s1 + sizel (s2:(A)list)` +[ + (((THENL) (((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s1"]))]) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("add0n", [add0n]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("addSn", [addSn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +let rcons = define `!x t (z:A). rcons [] z = [z] /\ rcons (x :: t) z = x :: rcons t z`;; + +(* Lemma rcons_cons *) +let rcons_cons = Sections.section_proof ["x";"s";"z"] +`rcons (x :: s) z = x:A :: rcons s z` +[ + ((((use_arg_then2 ("rcons", [rcons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma cats1 *) +let cats1 = Sections.section_proof ["s";"z"] +`s ++ [z:A] = rcons s z` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]))]) THEN (((((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("rcons", [rcons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +let last = define `!(x:A) h t. last x [] = x /\ last x (h :: t) = last h t`;; +let belast = define `!(x:A) h t. belast x [] = [] /\ belast x (h :: t) = x :: (belast h t)`;; + +(* Lemma lastI *) +let lastI = Sections.section_proof ["x";"s"] +`(x:A :: s) = rcons (belast x s) (last x s)` +[ + (((THENL) (((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN (BETA_TAC THEN (move ["x"])) THEN ((((use_arg_then2 ("belast", [belast]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("last", [last]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("rcons", [rcons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma last_cons *) +let last_cons = Sections.section_proof ["x";"y";"s"] +`last x (y:A :: s) = last y s` +[ + ((((use_arg_then2 ("last", [last]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma size_rcons *) +let size_rcons = Sections.section_proof ["s";"x"] +`sizel (rcons s (x:A)) = SUC (sizel s)` +[ + (((((use_arg_then2 ("cats1", [cats1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_cat", [size_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnS", [addnS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addn0", [addn0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma size_belast *) +let size_belast = Sections.section_proof ["x";"s"] +`sizel (belast (x:A) s) = sizel s` +[ + (((THENL) (((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN (BETA_TAC THEN (move ["x"])) THEN ((((use_arg_then2 ("belast", [belast]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma last_cat *) +let last_cat = Sections.section_proof ["x";"s1";"s2"] +`last (x:A) (s1 ++ s2) = last (last x s1) s2` +[ + (((THENL) (((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s1"]) THEN (move ["IHs"]))]) THEN (BETA_TAC THEN (move ["x"])) THEN ((((use_arg_then2 ("last", [last]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("last", [last]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma last_rcons *) +let last_rcons = Sections.section_proof ["x";"s";"z"] +`last x (rcons s z) = z:A` +[ + (((((use_arg_then2 ("cats1", [cats1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("last_cat", [last_cat]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("last", [last]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma belast_cat *) +let belast_cat = Sections.section_proof ["x";"s1";"s2"] +`belast x (s1 ++ s2) = belast x s1 ++ belast (last (x:A) s1) s2` +[ + (((THENL) (((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s1"]) THEN (move ["IHs"]))]) THEN (BETA_TAC THEN (move ["x"])) THEN ((((use_arg_then2 ("belast", [belast]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("last", [last]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("belast", [belast]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma belast_rcons *) +let belast_rcons = Sections.section_proof ["x";"s";"z"] +`belast x (rcons s z) = x:A :: s` +[ + (((((use_arg_then2 ("lastI", [lastI]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cats1", [cats1]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("belast_cat", [belast_cat]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("belast", [belast]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma cat_rcons *) +let cat_rcons = Sections.section_proof ["x";"s1";"s2"] +`rcons s1 x ++ s2 = s1 ++ (x:A :: s2)` +[ + (((((use_arg_then2 ("cats1", [cats1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("catA", [catA]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma rcons_cat *) +let rcons_cat = Sections.section_proof ["x";"s1";"s2"] +`rcons (s1 ++ s2) x = s1 ++ rcons s2 (x:A)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("cats1", [cats1]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("catA", [catA]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma last_ind *) +let last_ind = Sections.section_proof ["P"] +`P [] ==> (!s (x : A). P s ==> P (rcons s x)) ==> (!s. P s)` +[ + (BETA_TAC THEN (move ["Hnil"]) THEN (move ["Hlast"]) THEN (move ["s"])); + (((fun arg_tac -> (use_arg_then2 ("cat0s", [cat0s])) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("Hnil", [])) (disch_tac [])) THEN (clear_assumption "Hnil") THEN ((fun arg_tac -> arg_tac (Arg_term (`[]`))) (disch_tac [])) THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s2"]) THEN (move ["IHs"]))]) ((((use_arg_then2 ("cats0", [cats0]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((((use_arg_then2 ("cat_rcons", [cat_rcons]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["s1"]) THEN (move ["Ps1"])) THEN (((use_arg_then2 ("IHs", [])) (disch_tac [])) THEN (clear_assumption "IHs") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("Hlast", [])) (disch_tac [])) THEN (clear_assumption "Hlast") THEN (exact_tac)) THEN (done_tac)); +];; +let nth = define `!(x0:A) h t n. nth x0 [] n = x0 /\ nth x0 (h :: t) 0 = h /\ nth x0 (h :: t) (SUC n) = nth x0 t n`;; +let set_nth = define `!(x0:A) h t n y. + set_nth x0 [] n y = ncons n x0 [y] /\ + set_nth x0 (h :: t) 0 y = y :: t /\ + set_nth x0 (h :: t) (SUC n) y = h :: set_nth x0 t n y`;; + +(* Lemma nth0 *) +let nth0 = Sections.section_proof ["s"] +`nth x0 s 0 = headl x0 s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("head", [head]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma nth_default *) +let nth_default = Sections.section_proof ["s";"n"] +`sizel s <= n ==> nth x0 s n = x0` +[ + ((((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) case [ALL_TAC; (move ["n"])])) THEN ((((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IHs", [])) (disch_tac [])) THEN (clear_assumption "IHs") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma nth_nil *) +let nth_nil = Sections.section_proof ["n"] +`nth x0 [] n = x0` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma last_nth *) +let last_nth = Sections.section_proof ["x";"s"] +`last x s = nth x0 (x :: s) (sizel s)` +[ + ((THENL_FIRST) (((THENL) (((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN (BETA_TAC THEN (move ["x"])) THEN ((((use_arg_then2 ("last", [last]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))) (done_tac)); + (((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma nth_last *) +let nth_last = Sections.section_proof ["s"] +`nth x0 s (sizel s - 1) = last x0 s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["t"]) THEN (move ["h"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("last", [last]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("succnK", [succnK]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("last_nth", [last_nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma nth_behead *) +let nth_behead = Sections.section_proof ["s";"n"] +`nth x0 (behead s) n = nth x0 s (SUC n)` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["_"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("behead", [behead]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma nth_cat *) +let nth_cat = Sections.section_proof ["s1";"s2";"n"] +`nth x0 (s1 ++ s2) n = if n < sizel s1 then nth x0 s1 n else nth x0 s2 (n - sizel s1)` +[ + ((THENL) (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s1"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("sub0n", [sub0n]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("subn0", [subn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))) [(arith_tac); (arith_tac); BETA_TAC]); + (((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subSS", [subSS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_rcons *) +let nth_rcons = Sections.section_proof ["s";"x";"n"] +`nth x0 (rcons s x) n = + if n < sizel s then nth x0 s n else if n = sizel s then x else x0` +[ + ((THENL_FIRST) (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("rcons", [rcons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltn0Sn", [ltn0Sn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqSS", [eqSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_ncons *) +let nth_ncons = Sections.section_proof ["m";"x";"s";"n"] +`nth x0 (ncons m x s) n = if n < m then x else nth x0 s (n - m)` +[ + ((((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; ((move ["m"]) THEN (move ["IHm"]))]) THEN ((THENL) case [ALL_TAC; (move ["n"])])) THEN ((((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("subn0", [subn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ncons", [ncons]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (TRY ((arith_tac)))); + (((((use_arg_then2 ("IHm", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subSS", [subSS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_nseq *) +let nth_nseq = Sections.section_proof ["m";"x";"n"] +`nth x0 (nseq m x) n = (if n < m then x else x0)` +[ + ((((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; ((move ["m"]) THEN (move ["IHm"]))]) THEN ((THENL) case [ALL_TAC; (move ["n"])])) THEN ((((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (TRY ((arith_tac)))); + (((((use_arg_then2 ("ncons", [ncons]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nseq", [nseq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IHm", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eq_from_nth *) +let eq_from_nth = Sections.section_proof ["s1";"s2"] +`sizel s1 = sizel s2 ==> (!i. i < sizel s1 ==> nth x0 s1 i = nth x0 s2 i) ==> + s1 = s2` +[ + ((((THENL) (((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["x1"]) THEN (move ["s1"]) THEN (move ["IHs1"]))]) THEN ((THENL) case [ALL_TAC; ((move ["x2"]) THEN (move ["s2"]))])) THEN ((((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("NOT_SUC", [NOT_SUC]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("eqSS", [eqSS]))(thm_tac (new_rewrite [] [])))) THEN (move ["eq_sz"]) THEN (move ["eq_s12"])); + ((((fun arg_tac -> (use_arg_then2 ("eq_s12", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("ltn0Sn", [ltn0Sn]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 2 0 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["_"])) THEN (((((fun arg_tac -> (use_arg_then2 ("IHs1", [])) (fun fst_arg -> (use_arg_then2 ("s2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eq_sz", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["i"]))); + ((((fun arg_tac -> (use_arg_then2 ("eq_s12", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SUC i`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 2 0 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma size_set_nth *) +let size_set_nth = Sections.section_proof ["s";"n";"y"] +`sizel (set_nth x0 s n y) = maxn (SUC n) (sizel s)` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN (((use_arg_then2 ("set_nth", [set_nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); + (((((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("maxn", [maxn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then2 ("size_ncons", [size_ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ONE", [ONE]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("addn1", [addn1]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("maxn", [maxn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("add_sub_maxn", [add_sub_maxn]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (arith_tac) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add1n", [add1n]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addn_maxr", [addn_maxr]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("add1n", [add1n]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma set_nth_nil *) +let set_nth_nil = Sections.section_proof ["n";"y"] +`set_nth x0 [] n y = ncons n x0 [y]` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN (((use_arg_then2 ("set_nth", [set_nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma ltS0 *) +let ltS0 = Sections.section_proof ["n"] +`SUC n < 0 <=> F` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma eqS0 *) +let eqS0 = Sections.section_proof ["n"] +`SUC n = 0 <=> F` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma eq0S *) +let eq0S = Sections.section_proof ["n"] +`0 = SUC n <=> F` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma gtS0 *) +let gtS0 = Sections.section_proof ["n"] +`0 < SUC n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma ltSS *) +let ltSS = Sections.section_proof ["m";"n"] +`SUC m < SUC n <=> m < n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma nth_set_nth *) +let nth_set_nth = Sections.section_proof ["s";"n";"y";"i"] +`nth x0 (set_nth x0 s n y) i = if i = n then y else nth x0 s i` +[ + ((THENL_ROT (-1)) (((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN ((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["m"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("set_nth", [set_nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("nth_nil", [nth_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("nth_ncons", [nth_ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("sub0n", [sub0n]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ltS0", [ltS0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("eqS0", [eqS0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("eq0S", [eq0S]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("gtS0", [gtS0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("subn0", [subn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))))); + (((((use_arg_then2 ("eqSS", [eqSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHs", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subSS", [subSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqSS", [eqSS]))(thm_tac (new_rewrite [] []))))); + ((THENL_LAST) ((THENL) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ltngtP", [ltngtP])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(move ["lt_mn"]); ((THENL) case [(move ["lt_nm"]); (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))])]) (((((use_arg_then2 ("subnn", [subnn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))) THEN (done_tac))); + (((((use_arg_then2 ("lt_mn", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `m < n ==> (m = n <=> F)`)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_LAST) ((((use_arg_then2 ("nth_default", [nth_default]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("if_same", [if_same]))(thm_tac (new_rewrite [] [])))))) ((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `n < m ==> (m = n <=> F)`)))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("subn_gt0", [subn_gt0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma set_set_nth *) +let set_set_nth = Sections.section_proof ["s";"n1";"y1";"n2";"y2"] +`set_nth x0 (set_nth x0 s n1 y1) n2 y2 = + if n1 = n2 then set_nth x0 s n2 y2 else set_nth x0 (set_nth x0 s n2 y2) n1 y1` +[ + ((THENL) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n1 = n2:num`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); (move ["ne_n12"])]); + ((THENL_FIRST) ((((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[IMP_IMP] eq_from_nth))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (split_tac)) (((repeat_tactic 1 9 (((use_arg_then2 ("size_set_nth", [size_set_nth]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("maxnA", [maxnA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("maxnn", [maxnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((BETA_TAC THEN (move ["i"]) THEN (move ["_"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("nth_set_nth", [nth_set_nth]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac)); + ((THENL_FIRST) ((((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[IMP_IMP] eq_from_nth))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (split_tac)) (((((use_arg_then2 ("ne_n12", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("size_set_nth", [size_set_nth]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("maxnCA", [maxnCA]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((BETA_TAC THEN (move ["i"]) THEN (move ["_"])) THEN (((simp_tac THEN TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_set_nth", [nth_set_nth]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ((((use_arg_then2 ("ne_n12", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (((THENL) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i = n2:num`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (move ["ne_i2"])]) THEN (simp_tac)); + (((((use_arg_then2 ("nth_set_nth", [nth_set_nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ne_n12", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("nth_set_nth", [nth_set_nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac)); + (((((use_arg_then2 ("ne_i2", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth_set_nth", [nth_set_nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("ne_i2", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Section SeqFind *) +Sections.begin_section "SeqFind";; +(Sections.add_section_var (mk_var ("a", (`:A -> bool`))));; +let find = define `!a (x:A) s'. find a [] = 0 /\ + find a (x :: s') = if a x then 0 else SUC(find a s')`;; +let filter = define `!a (x:A) s'. filter a [] = [] /\ + filter a (x :: s') = if a x then x :: filter a s' else filter a s'`;; +let count = define `!a (x:A) s'. count a [] = 0 /\ + count a (x :: s') = (if a x then 1 else 0) + count a s'`;; +let has = define `!a (x:A) s'. has a [] = F /\ + has a (x :: s') = (a x \/ has a s')`;; +let all = define `!a (x:A) s'. all a [] = T /\ + all a (x :: s') = (a x /\ all a s')`;; + +(* Lemma find_nil *) +let find_nil = Sections.section_proof [] +`find a [] = 0` +[ + ((((use_arg_then2 ("find", [find]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma find_cons *) +let find_cons = Sections.section_proof ["x";"t"] +`find a (x::t) = if a x then 0 else SUC (find a t)` +[ + ((((use_arg_then2 ("find", [find]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma filter_nil *) +let filter_nil = Sections.section_proof [] +`filter a [] = []` +[ + ((((use_arg_then2 ("filter", [filter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma filter_cons *) +let filter_cons = Sections.section_proof ["x";"t"] +`filter a (x::t) = if a x then x :: filter a t else filter a t` +[ + ((((use_arg_then2 ("filter", [filter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma count_nil *) +let count_nil = Sections.section_proof [] +`count a [] = 0` +[ + ((((use_arg_then2 ("count", [count]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma count_cons *) +let count_cons = Sections.section_proof ["x";"t"] +`count a (x::t) = (if a x then 1 else 0) + count a t` +[ + ((((use_arg_then2 ("count", [count]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma has_nil *) +let has_nil = Sections.section_proof [] +`has a [] = F` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("has", [has]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma has_cons *) +let has_cons = Sections.section_proof ["x";"t"] +`has a (x::t) <=> a x \/ has a t` +[ + ((((use_arg_then2 ("has", [has]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma all_nil *) +let all_nil = Sections.section_proof [] +`all a [] = T` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("all", [all]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma all_cons *) +let all_cons = Sections.section_proof ["x";"t"] +`all a (x::t) <=> a x /\ all a t` +[ + ((((use_arg_then2 ("all", [all]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma count_filter *) +let count_filter = Sections.section_proof ["s"] +`count a s = sizel (filter a s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]))]) THEN (((((use_arg_then2 ("count", [count]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("filter", [filter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((THENL) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(a:A->bool) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); (move ["nax"])]) THEN ((((use_arg_then2 ("add1n", [add1n]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (((((use_arg_then2 ("nax", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("add0n", [add0n]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma has_count *) +let has_count = Sections.section_proof ["s"] +`has a s = (0 < count a s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]))]) THEN (((((use_arg_then2 ("has", [has]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("count", [count]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltnn", [ltnn]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_term (`a x`))) (disch_tac [])) THEN case THEN (simp_tac)) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma count_size *) +let count_size = Sections.section_proof ["s"] +`count a s <= sizel s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]))]) THEN ((((use_arg_then2 ("count", [count]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + ((((fun arg_tac -> arg_tac (Arg_term (`a x`))) (disch_tac [])) THEN case THEN (simp_tac)) THEN ((((fun arg_tac ->(use_arg_then2 ("add1n", [add1n]))(fun tmp_arg1 -> (use_arg_then2 ("add0n", [add0n]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("leqW", [leqW])) (disch_tac [])) THEN (clear_assumption "leqW") THEN (exact_tac))); +];; + +(* Lemma all_count *) +let all_count = Sections.section_proof ["s"] +`all a s = (count a s = sizel s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]))]) THEN ((((use_arg_then2 ("all", [all]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("count", [count]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((THENL_FIRST) ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(a:A->bool) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["_"]) THEN (move ["_"])) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqn_leq", [eqn_leq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbC", [andbC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("count_size", [count_size]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma filter_all *) +let filter_all = Sections.section_proof ["s"] +`all a (filter a s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("filter", [filter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("all", [all]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(a:A->bool) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac)) THEN (((use_arg_then2 ("all", [all]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma all_filterP *) +let all_filterP = Sections.section_proof ["s"] +`(filter a s = s) <=> (all a s)` +[ + ((THENL_FIRST) ((THENL) (EQ_TAC) [(((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))); ALL_TAC]) ((((use_arg_then2 ("filter_all", [filter_all]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN (((((use_arg_then2 ("filter", [filter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("all", [all]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))) THEN ALL_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["Hs"]))) THEN (simp_tac))); + ((((fun arg_tac -> (use_arg_then2 ("IHs", [])) (fun fst_arg -> (use_arg_then2 ("Hs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma filter_id *) +let filter_id = Sections.section_proof ["s"] +`filter a (filter a s) = filter a s` +[ + (((((use_arg_then2 ("all_filterP", [all_filterP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("filter_all", [filter_all]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma has_find *) +let has_find = Sections.section_proof ["s"] +`has a s <=> (find a s < sizel s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("has", [has]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("find", [find]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((simp_tac THEN TRY done_tac)))); + ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(a:A->bool) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["_"])) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("gtS0", [gtS0]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma find_size *) +let find_size = Sections.section_proof ["s"] +`find a s <= sizel s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("find", [find]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(a:A->bool) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["_"])) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("leq0n", [leq0n]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma find_cat *) +let find_cat = Sections.section_proof ["s1";"s2"] +`find a (s1 ++ s2) = if has a s1 then find a s1 else sizel s1 + find a s2` +[ + (((THENL) (((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s1"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("has", [has]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("find", [find]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("add0n", [add0n]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(a:A->bool) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["_"])); + (((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fun_if", [fun_if]))(thm_tac (new_rewrite [] [(`SUC _1`)])))) THEN (((use_arg_then2 ("addSn", [addSn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma has_nil *) +let has_nil = Sections.section_proof [] +`has a [] = F` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("has", [has]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma has_seq1 *) +let has_seq1 = Sections.section_proof ["x"] +`has a [x] = a x` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("has", [has]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma has_seqb *) +let has_seqb = Sections.section_proof ["b";"x"] +`has a (nseq (if b then 1 else 0) x) <=> (b /\ a x)` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN ((((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ONE", [ONE]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("has_nil", [has_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("has_seq1", [has_seq1]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma all_nil *) +let all_nil = Sections.section_proof [] +`all a [] = T` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("all", [all]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma all_seq1 *) +let all_seq1 = Sections.section_proof ["x"] +`all a [x] = a x` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("all", [all]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma nth_find *) +let nth_find = Sections.section_proof ["s"] +`has a s ==> a (nth x0 s (find a s))` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("has", [has]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("find", [find]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(a:A->bool) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac)) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma before_find *) +let before_find = Sections.section_proof ["s";"i"] +`i < find a s ==> (a (nth x0 s i) <=> F)` +[ + (((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("find", [find]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((THENL_FIRST) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(a:A->bool) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ax"])) ((((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((THENL) elim [ALL_TAC; ((move ["i"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ax", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ltSS", [ltSS]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHs", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (done_tac)); +];; + +(* Lemma filter_cat *) +let filter_cat = Sections.section_proof ["s1";"s2"] +`filter a (s1 ++ s2) = filter a s1 ++ filter a s2` +[ + (((THENL) (((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s1"]) THEN (move ["Ihs"]))]) THEN ((((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("filter", [filter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(a:A->bool) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["_"])) THEN (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma filter_rcons *) +let filter_rcons = Sections.section_proof ["s";"x"] +`filter a (rcons s x) = if a x then rcons (filter a s) x else filter a s` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("cats1", [cats1]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("filter_cat", [filter_cat]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("filter", [filter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(a:A->bool) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["_"])) THEN (((use_arg_then2 ("cats0", [cats0]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma count_cat *) +let count_cat = Sections.section_proof ["s1";"s2"] +`count a (s1 ++ s2) = count a s1 + count a s2` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("count_filter", [count_filter]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("filter_cat", [filter_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_cat", [size_cat]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma has_cat *) +let has_cat = Sections.section_proof ["s1";"s2"] +`has a (s1 ++ s2) = (has a s1 \/ has a s2)` +[ + (((THENL) (((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s1"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("has", [has]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbA", [orbA]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma has_rcons *) +let has_rcons = Sections.section_proof ["s";"x"] +`has a (rcons s x) = (a x \/ has a s)` +[ + (((((use_arg_then2 ("cats1", [cats1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("has_cat", [has_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_seq1", [has_seq1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbC", [orbC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma all_cat *) +let all_cat = Sections.section_proof ["s1";"s2"] +`all a (s1 ++ s2) = (all a s1 /\ all a s2)` +[ + (((THENL) (((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s1"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("all", [all]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbA", [andbA]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma all_rcons *) +let all_rcons = Sections.section_proof ["s";"x"] +`all a (rcons s x) = (a x /\ all a s)` +[ + (((((use_arg_then2 ("cats1", [cats1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("all_cat", [all_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("all_seq1", [all_seq1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbC", [andbC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section SeqFind *) +let find_nil = Sections.finalize_theorem find_nil;; +let find_cons = Sections.finalize_theorem find_cons;; +let filter_nil = Sections.finalize_theorem filter_nil;; +let filter_cons = Sections.finalize_theorem filter_cons;; +let count_nil = Sections.finalize_theorem count_nil;; +let count_cons = Sections.finalize_theorem count_cons;; +let has_nil = Sections.finalize_theorem has_nil;; +let has_cons = Sections.finalize_theorem has_cons;; +let all_nil = Sections.finalize_theorem all_nil;; +let all_cons = Sections.finalize_theorem all_cons;; +let count_filter = Sections.finalize_theorem count_filter;; +let has_count = Sections.finalize_theorem has_count;; +let count_size = Sections.finalize_theorem count_size;; +let all_count = Sections.finalize_theorem all_count;; +let filter_all = Sections.finalize_theorem filter_all;; +let all_filterP = Sections.finalize_theorem all_filterP;; +let filter_id = Sections.finalize_theorem filter_id;; +let has_find = Sections.finalize_theorem has_find;; +let find_size = Sections.finalize_theorem find_size;; +let find_cat = Sections.finalize_theorem find_cat;; +let has_nil = Sections.finalize_theorem has_nil;; +let has_seq1 = Sections.finalize_theorem has_seq1;; +let has_seqb = Sections.finalize_theorem has_seqb;; +let all_nil = Sections.finalize_theorem all_nil;; +let all_seq1 = Sections.finalize_theorem all_seq1;; +let nth_find = Sections.finalize_theorem nth_find;; +let before_find = Sections.finalize_theorem before_find;; +let filter_cat = Sections.finalize_theorem filter_cat;; +let filter_rcons = Sections.finalize_theorem filter_rcons;; +let count_cat = Sections.finalize_theorem count_cat;; +let has_cat = Sections.finalize_theorem has_cat;; +let has_rcons = Sections.finalize_theorem has_rcons;; +let all_cat = Sections.finalize_theorem all_cat;; +let all_rcons = Sections.finalize_theorem all_rcons;; +Sections.end_section "SeqFind";; +let pred1 = new_definition `pred1 (a:A) = (\x. x = a)`;; +let predD1 = new_definition `predD1 a x = predD a (pred1 x)`;; + +(* Lemma eq_find *) +let eq_find = Sections.section_proof ["a1";"a2"] +`(!x:A. a1 x = a2 x) ==> (!s. find a1 s = find a2 s)` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("EQ_EXT", [EQ_EXT])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eq_filter *) +let eq_filter = Sections.section_proof ["a1";"a2"] +`(!x:A. a1 x = a2 x) ==> (!s. filter a1 s = filter a2 s)` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("EQ_EXT", [EQ_EXT])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eq_count *) +let eq_count = Sections.section_proof ["a1";"a2"] +`(!x:A. a1 x = a2 x) ==> (!s. count a1 s = count a2 s)` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("EQ_EXT", [EQ_EXT])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eq_has *) +let eq_has = Sections.section_proof ["a1";"a2"] +`(!x. a1 x = a2 x) ==> (!s. has a1 s = has a2 s)` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("EQ_EXT", [EQ_EXT])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eq_all *) +let eq_all = Sections.section_proof ["a1";"a2"] +`(!x. a1 x = a2 x) ==> (!s. all a1 s = all a2 s)` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("EQ_EXT", [EQ_EXT])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma filter_pred0 *) +let filter_pred0 = Sections.section_proof ["s"] +`filter pred0 s = []` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("filter", [filter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("pred0", [pred0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (((((use_arg_then2 ("IHs", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("pred0", [pred0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma filter_predT *) +let filter_predT = Sections.section_proof ["s"] +`filter predT s = s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("filter", [filter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("predT", [predT]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (((((use_arg_then2 ("IHs", []))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then2 ("predT", [predT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma filter_predI *) +let filter_predI = Sections.section_proof ["a1";"a2";"s"] +`filter (predI a1 a2) s = filter a1 (filter a2 s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("filter", [filter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("predI", [predI]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + ((THENL_LAST) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(a2:A->bool) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["_"])) (((((use_arg_then2 ("IHs", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("predI", [predI]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(a1:A->bool) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["a1x"])) THEN (((use_arg_then2 ("filter", [filter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))); + (((((use_arg_then2 ("a1x", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("IHs", []))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("predI", [predI]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); + (((((use_arg_then2 ("a1x", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("IHs", []))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("predI", [predI]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma count_pred0 *) +let count_pred0 = Sections.section_proof ["s"] +`count pred0 s = 0` +[ + (((((use_arg_then2 ("count_filter", [count_filter]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("filter_pred0", [filter_pred0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma count_predT *) +let count_predT = Sections.section_proof ["s"] +`count predT s = sizel s` +[ + (((((use_arg_then2 ("count_filter", [count_filter]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("filter_predT", [filter_predT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma count_predUI *) +let count_predUI = Sections.section_proof ["a1";"a2";"s"] +`count (predU a1 a2) s + count (predI a1 a2) s = count a1 s + count a2 (s:(A)list)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("count", [count]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("predI", [predI]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("predU", [predU]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(a1:A->bool) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["a1x"])) THEN (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(a2:A->bool) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["a2x"])) THEN ((((use_arg_then2 ("predI", [predI]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("predU", [predU]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("IHs", [])) (disch_tac [])) THEN (clear_assumption "IHs") THEN BETA_TAC) THEN (arith_tac)); +];; + +(* Lemma count_predC *) +let count_predC = Sections.section_proof ["a";"s"] +`count a s + count (predC a) s = sizel (s:(A)list)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("count", [count]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("add0n", [add0n]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + ((((use_arg_then2 ("addnCA", [addnCA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnA", [addnA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("predC", [predC]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(a:A->bool) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ax"])) THEN (arith_tac)); +];; + +(* Lemma has_pred0 *) +let has_pred0 = Sections.section_proof ["s"] +`has pred0 s = F` +[ + (((((use_arg_then2 ("has_count", [has_count]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("count_pred0", [count_pred0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma has_predT *) +let has_predT = Sections.section_proof ["s"] +`has predT s = (0 < sizel s)` +[ + (((((use_arg_then2 ("has_count", [has_count]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("count_predT", [count_predT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma has_predC *) +let has_predC = Sections.section_proof ["a";"s"] +`has (predC a) s = ~ all a s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("has", [has]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("all", [all]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))))); + (((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("predC", [predC]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma has_predU *) +let has_predU = Sections.section_proof ["a1";"a2";"s"] +`has (predU a1 a2) s <=> (has a1 s \/ has a2 s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("has", [has]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + ((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("predU", [predU]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("orbA", [orbA]))(gsym_then (thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("orbCA", [orbCA]))(thm_tac (new_rewrite [] [(`has a1 s \/ _ \/ _1`)])))) THEN (done_tac)); +];; + +(* Lemma all_pred0 *) +let all_pred0 = Sections.section_proof ["s"] +`all pred0 s = (sizel s = 0)` +[ + (((((use_arg_then2 ("all_count", [all_count]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("count_pred0", [count_pred0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [(`0 = _`)]))))) THEN (done_tac)); +];; + +(* Lemma all_predT *) +let all_predT = Sections.section_proof ["s"] +`all predT s` +[ + (((((use_arg_then2 ("all_count", [all_count]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("count_predT", [count_predT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma all_predC *) +let all_predC = Sections.section_proof ["a";"s"] +`all (predC a) s = ~ has a s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("all", [all]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("has", [has]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))))); + (((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("predC", [predC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma can_inj *) +let can_inj = Sections.section_proof ["f";"g"] +`(!x. g (f x) = x) ==> (!x y. f x = f y ==> x = y)` +[ + (BETA_TAC THEN (move ["h"]) THEN (move ["x"]) THEN (move ["y"]) THEN (move ["f_eq"])); + (((((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma all_predI *) +let all_predI = Sections.section_proof ["a1";"a2";"s"] +`all (predI a1 a2) s <=> all a1 s /\ all a2 s` +[ + ((((fun arg_tac -> (use_arg_then2 ("can_inj", [can_inj])) (fun fst_arg -> (use_arg_then2 ("negbK", [negbK])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("has_predC", [has_predC]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("has_predU", [has_predU]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("predU", [predU]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("predI", [predI]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("predC", [predC]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +let drop = define `!n x s. dropl (SUC n) (x :: s) = dropl n s /\ + dropl n [] = [] /\ dropl 0 s = s`;; + +(* Lemma eq_ext *) +let eq_ext = Sections.section_proof ["f";"g"] +`(!x. f x = g x) <=> f = g` +[ + ((THENL_FIRST) ((split_tac) THEN (move ["h"])) ((MATCH_MP_TAC EQ_EXT) THEN (done_tac))); + ((((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma drop_nil *) +let drop_nil = Sections.section_proof ["n"] +`dropl n [] = []` +[ + ((((use_arg_then2 ("drop", [drop]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma drop0 *) +let drop0 = Sections.section_proof [] +`dropl 0 = I` +[ + (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("drop", [drop]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma drop_cons *) +let drop_cons = Sections.section_proof ["n";"x";"s"] +`dropl (SUC n) (x :: s) = dropl n s` +[ + ((((use_arg_then2 ("drop", [drop]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma drop_behead *) +let drop_behead = Sections.section_proof [] +`dropl n0 = iter n0 behead` +[ + ((THENL_FIRST) (((THENL) (((use_arg_then2 ("n0", [])) (disch_tac [])) THEN (clear_assumption "n0") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("drop", [drop]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))) ((((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac))); + (((THENL) elim [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("iterSr", [iterSr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHn", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then2 ("behead", [behead]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("drop", [drop]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma drop0 *) +let drop0 = Sections.section_proof ["s"] +`dropl 0 s = s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["_"]))]) THEN (((use_arg_then2 ("drop", [drop]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma drop1 *) +let drop1 = Sections.section_proof ["s"] +`dropl 1 s = behead s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("ONE", [ONE]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("drop", [drop]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("behead", [behead]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("drop0", [drop0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma drop_oversize *) +let drop_oversize = Sections.section_proof ["n";"s"] +`sizel s <= n ==> dropl n s = []` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN ((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("drop", [drop]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] []))))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHn", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (done_tac)); +];; + +(* Lemma drop_size *) +let drop_size = Sections.section_proof ["s"] +`dropl (sizel s) s = []` +[ + (((((use_arg_then2 ("drop_oversize", [drop_oversize]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma size_drop *) +let size_drop = Sections.section_proof ["s"] +`sizel (dropl n0 s) = sizel s - n0` +[ + (((THENL) (((use_arg_then2 ("n0", [])) (disch_tac [])) THEN (clear_assumption "n0") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("drop", [drop]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("subn0", [subn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("sub0n", [sub0n]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subSS", [subSS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma drop_cat *) +let drop_cat = Sections.section_proof ["s1";"s2"] +`dropl n0 (s1 ++ s2) = + if n0 < sizel s1 then dropl n0 s1 ++ s2 else dropl (n0 - sizel s1) s2` +[ + (((THENL) (((use_arg_then2 ("n0", [])) (disch_tac [])) THEN (clear_assumption "n0") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s1"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("sub0n", [sub0n]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("drop", [drop]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("if_same", [if_same]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN ((((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("subn0", [subn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("gtS0", [gtS0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subSS", [subSS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma drop_size_cat *) +let drop_size_cat = Sections.section_proof ["n";"s1";"s2"] +`sizel s1 = n ==> dropl n (s1 ++ s2) = s2` +[ + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((THENL) (((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("drop0", [drop0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("drop_cons", [drop_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nconsK *) +let nconsK = Sections.section_proof ["n";"x";"s"] +`dropl n (ncons n x s) = s` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((((use_arg_then2 ("drop", [drop]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("drop", [drop]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))) THEN (done_tac)); +];; +let take = define `!x s n. take (SUC n) (x :: s) = x :: take n s /\ + take 0 s = [] /\ take n [] = []`;; + +(* Lemma take0 *) +let take0 = Sections.section_proof ["s"] +`take 0 s = []` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["_"]))]) THEN (((use_arg_then2 ("take", [take]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma take_oversize *) +let take_oversize = Sections.section_proof ["n";"s"] +`sizel s <= n ==> take n s = s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN ((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("take", [take]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] []))))) THEN (move ["Hsn"])) THEN (((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma take_size *) +let take_size = Sections.section_proof ["s"] +`take (sizel s) s = s` +[ + (((((use_arg_then2 ("take_oversize", [take_oversize]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma take_cons *) +let take_cons = Sections.section_proof ["x";"s"] +`take (SUC n0) (x :: s) = x :: (take n0 s)` +[ + ((((use_arg_then2 ("take", [take]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma drop_rcons *) +let drop_rcons = Sections.section_proof ["s"] +`n0 <= sizel s ==> + !x. dropl n0 (rcons s x) = rcons (dropl n0 s) x` +[ + (((THENL) (((use_arg_then2 ("n0", [])) (disch_tac [])) THEN (clear_assumption "n0") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("drop", [drop]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("rcons", [rcons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("drop_cons", [drop_cons]))(thm_tac (new_rewrite [] []))))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHs", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma congr1 *) +let congr1 = Sections.section_proof ["f";"x";"y"] +`x = y ==> f x = f y` +[ + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma cat_take_drop *) +let cat_take_drop = Sections.section_proof ["s"] +`take n0 s ++ dropl n0 s = s` +[ + (((THENL) (((use_arg_then2 ("n0", [])) (disch_tac [])) THEN (clear_assumption "n0") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("take", [take]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("drop", [drop]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + ((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma size_takel *) +let size_takel = Sections.section_proof ["s"] +`n0 <= sizel s ==> sizel (take n0 s) = n0` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("subnKC", [subnKC])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((fun arg_tac -> (use_arg_then2 ("cat_take_drop", [cat_take_drop])) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then2 ("size_cat", [size_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] []))))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("addIn", [addIn])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma size_take *) +let size_take = Sections.section_proof ["s"] +`sizel (take n0 s) = if n0 < sizel s then n0 else sizel s` +[ + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("leqP", [leqP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sizel (s:(A)list)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN ((THENL) case [(move ["le_sn"]); (move ["lt_ns"])])); + (((((use_arg_then2 ("take_oversize", [take_oversize]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("le_sn", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); + (((((use_arg_then2 ("lt_ns", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("size_takel", [size_takel]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma take_cat *) +let take_cat = Sections.section_proof ["s1";"s2"] +`take n0 (s1 ++ s2) = + if n0 < sizel s1 then take n0 s1 else s1 ++ take (n0 - sizel s1) s2` +[ + (((THENL) (((use_arg_then2 ("n0", [])) (disch_tac [])) THEN (clear_assumption "n0") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s1"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("take", [take]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("subn0", [subn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("take", [take]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("gtS0", [gtS0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (((((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subSS", [subSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fun_if", [fun_if]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma take_size_cat *) +let take_size_cat = Sections.section_proof ["n";"s1";"s2"] +`sizel s1 = n ==> take n (s1 ++ s2) = s1` +[ + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((THENL) (((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s1"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("take", [take]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("take", [take]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + ((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma takel_cat *) +let takel_cat = Sections.section_proof ["s1"] +`n0 <= sizel (s1:(A)list) ==> (!s2. take n0 (s1 ++ s2) = take n0 s1)` +[ + (BETA_TAC THEN (move ["Hn0"]) THEN (move ["s2"])); + ((((use_arg_then2 ("take_cat", [take_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn_neqAle", [ltn_neqAle]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Hn0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n0 = sizel (s1:(A)list)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["eq"])); + (((((use_arg_then2 ("subnn", [subnn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("take0", [take0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cats0", [cats0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("take_size", [take_size]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_drop *) +let nth_drop = Sections.section_proof ["s";"i"] +`nth x0 (dropl n0 s) i = nth x0 s (n0 + i)` +[ + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ltnP", [ltnP])) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sizel (s:(A)list)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN ((THENL) case [(move ["lt_n0_s"]); (move ["le_s_n0"])])); + ((((use_arg_then2 ("cat_take_drop", [cat_take_drop]))(gsym_then (thm_tac (new_rewrite [2] [(`s`)]))))) THEN (((use_arg_then2 ("nth_cat", [nth_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_take", [size_take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lt_n0_s", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("addKn", [addKn]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_addr", [leq_addr]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("nth_default", [nth_default]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("le_s_n0", [])) (disch_tac [])) THEN (clear_assumption "le_s_n0") THEN BETA_TAC) THEN (((((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("leqE", [leqE]))(thm_tac (new_rewrite [] [])))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("sub0n", [sub0n]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("leq_trans", [leq_trans])) (fun fst_arg -> (use_arg_then2 ("le_s_n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("leq_addr", [leq_addr]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma nth_take *) +let nth_take = Sections.section_proof ["i"] +`i < n0 ==> !s. nth x0 (take n0 s) i = nth x0 s i` +[ + ((BETA_TAC THEN (move ["lt_i_n0"]) THEN (move ["s"])) THEN (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n0 < sizel (s:(A)list)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["lt_n0_s"]))); + (((((use_arg_then2 ("cat_take_drop", [cat_take_drop]))(gsym_then (thm_tac (new_rewrite [2] [(`s`)]))))) THEN (((use_arg_then2 ("nth_cat", [nth_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_take", [size_take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lt_n0_s", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("lt_i_n0", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("cats0", [cats0]))(gsym_then (thm_tac (new_rewrite [1] [(`s`)]))))) THEN (((use_arg_then2 ("take_cat", [take_cat]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("lt_n0_s", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("take", [take]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("cats0", [cats0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma drop_nth *) +let drop_nth = Sections.section_proof ["n";"s"] +`n < sizel s ==> dropl n s = nth x0 s n :: dropl (SUC n) s` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("drop", [drop]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("drop", [drop]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHs", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (done_tac)); +];; + +(* Lemma take_nth *) +let take_nth = Sections.section_proof ["n";"s"] +`n < sizel s ==> take (SUC n) s = rcons (take n s) (nth x0 s n)` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("take", [take]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("rcons", [rcons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("take", [take]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHs", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +let rot = new_definition `rot n s = dropl n s ++ take n s`;; + +(* Lemma rot0 *) +let rot0 = Sections.section_proof ["s"] +`rot 0 s = s` +[ + (((((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("drop0", [drop0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("take0", [take0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cats0", [cats0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma size_rot *) +let size_rot = Sections.section_proof ["s"] +`sizel (rot n0 s) = sizel s` +[ + (((((use_arg_then2 ("cat_take_drop", [cat_take_drop]))(gsym_then (thm_tac (new_rewrite [2] [(`s`)]))))) THEN (((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size_cat", [size_cat]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rot_oversize *) +let rot_oversize = Sections.section_proof ["n";"s"] +`sizel s <= n ==> rot n s = s` +[ + ((BETA_TAC THEN (move ["le_s_n"])) THEN ((((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("take_oversize", [take_oversize]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("drop_oversize", [drop_oversize]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma rot_size *) +let rot_size = Sections.section_proof ["s"] +`rot (sizel s) s = s` +[ + ((((use_arg_then2 ("rot_oversize", [rot_oversize])) (disch_tac [])) THEN (clear_assumption "rot_oversize") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma has_rot *) +let has_rot = Sections.section_proof ["s";"a"] +`has a (rot n0 s) = has a s` +[ + (((((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_cat", [has_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbC", [orbC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_cat", [has_cat]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("cat_take_drop", [cat_take_drop]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rot_size_cat *) +let rot_size_cat = Sections.section_proof ["s1";"s2"] +`rot (sizel s1) (s1 ++ s2) = s2 ++ s1` +[ + (((((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("take_size_cat", [take_size_cat]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("drop_size_cat", [drop_size_cat]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; +let rotr = new_definition `rotr n s = rot (sizel s - n) s`;; + +(* Lemma rotK *) +let rotK = Sections.section_proof ["s"] +`rotr n0 (rot n0 s) = s` +[ + ((((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [(`rot n0 _`)]))))); + (((((use_arg_then2 ("rot_size_cat", [rot_size_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat_take_drop", [cat_take_drop]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rot_inj *) +let rot_inj = Sections.section_proof ["s1";"s2"] +`rot n0 (s1:(A)list) = rot n0 s2 ==> s1 = s2` +[ + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("can_inj", [can_inj])) (fun fst_arg -> (use_arg_then2 ("rotK", [rotK])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (done_tac)); +];; + +(* Lemma rot1_cons *) +let rot1_cons = Sections.section_proof ["x";"s"] +`rot 1 (x :: s) = rcons s x` +[ + (((((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("drop_cons", [drop_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("take", [take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("take0", [take0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("drop0", [drop0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cats1", [cats1]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section Sequences *) +let size0nil = Sections.finalize_theorem size0nil;; +let nilP = Sections.finalize_theorem nilP;; +let size_behead = Sections.finalize_theorem size_behead;; +let size_nil = Sections.finalize_theorem size_nil;; +let size_cons = Sections.finalize_theorem size_cons;; +let size_ncons = Sections.finalize_theorem size_ncons;; +let size_nseq = Sections.finalize_theorem size_nseq;; +let cat0s = Sections.finalize_theorem cat0s;; +let cat1s = Sections.finalize_theorem cat1s;; +let cat_cons = Sections.finalize_theorem cat_cons;; +let cat_nseq = Sections.finalize_theorem cat_nseq;; +let cats0 = Sections.finalize_theorem cats0;; +let catA = Sections.finalize_theorem catA;; +let size_cat = Sections.finalize_theorem size_cat;; +let rcons_cons = Sections.finalize_theorem rcons_cons;; +let cats1 = Sections.finalize_theorem cats1;; +let lastI = Sections.finalize_theorem lastI;; +let last_cons = Sections.finalize_theorem last_cons;; +let size_rcons = Sections.finalize_theorem size_rcons;; +let size_belast = Sections.finalize_theorem size_belast;; +let last_cat = Sections.finalize_theorem last_cat;; +let last_rcons = Sections.finalize_theorem last_rcons;; +let belast_cat = Sections.finalize_theorem belast_cat;; +let belast_rcons = Sections.finalize_theorem belast_rcons;; +let cat_rcons = Sections.finalize_theorem cat_rcons;; +let rcons_cat = Sections.finalize_theorem rcons_cat;; +let last_ind = Sections.finalize_theorem last_ind;; +let nth0 = Sections.finalize_theorem nth0;; +let nth_default = Sections.finalize_theorem nth_default;; +let nth_nil = Sections.finalize_theorem nth_nil;; +let last_nth = Sections.finalize_theorem last_nth;; +let nth_last = Sections.finalize_theorem nth_last;; +let nth_behead = Sections.finalize_theorem nth_behead;; +let nth_cat = Sections.finalize_theorem nth_cat;; +let nth_rcons = Sections.finalize_theorem nth_rcons;; +let nth_ncons = Sections.finalize_theorem nth_ncons;; +let nth_nseq = Sections.finalize_theorem nth_nseq;; +let eq_from_nth = Sections.finalize_theorem eq_from_nth;; +let size_set_nth = Sections.finalize_theorem size_set_nth;; +let set_nth_nil = Sections.finalize_theorem set_nth_nil;; +let ltS0 = Sections.finalize_theorem ltS0;; +let eqS0 = Sections.finalize_theorem eqS0;; +let eq0S = Sections.finalize_theorem eq0S;; +let gtS0 = Sections.finalize_theorem gtS0;; +let ltSS = Sections.finalize_theorem ltSS;; +let nth_set_nth = Sections.finalize_theorem nth_set_nth;; +let set_set_nth = Sections.finalize_theorem set_set_nth;; +let find_nil = Sections.finalize_theorem find_nil;; +let find_cons = Sections.finalize_theorem find_cons;; +let filter_nil = Sections.finalize_theorem filter_nil;; +let filter_cons = Sections.finalize_theorem filter_cons;; +let count_nil = Sections.finalize_theorem count_nil;; +let count_cons = Sections.finalize_theorem count_cons;; +let has_nil = Sections.finalize_theorem has_nil;; +let has_cons = Sections.finalize_theorem has_cons;; +let all_nil = Sections.finalize_theorem all_nil;; +let all_cons = Sections.finalize_theorem all_cons;; +let count_filter = Sections.finalize_theorem count_filter;; +let has_count = Sections.finalize_theorem has_count;; +let count_size = Sections.finalize_theorem count_size;; +let all_count = Sections.finalize_theorem all_count;; +let filter_all = Sections.finalize_theorem filter_all;; +let all_filterP = Sections.finalize_theorem all_filterP;; +let filter_id = Sections.finalize_theorem filter_id;; +let has_find = Sections.finalize_theorem has_find;; +let find_size = Sections.finalize_theorem find_size;; +let find_cat = Sections.finalize_theorem find_cat;; +let has_nil = Sections.finalize_theorem has_nil;; +let has_seq1 = Sections.finalize_theorem has_seq1;; +let has_seqb = Sections.finalize_theorem has_seqb;; +let all_nil = Sections.finalize_theorem all_nil;; +let all_seq1 = Sections.finalize_theorem all_seq1;; +let nth_find = Sections.finalize_theorem nth_find;; +let before_find = Sections.finalize_theorem before_find;; +let filter_cat = Sections.finalize_theorem filter_cat;; +let filter_rcons = Sections.finalize_theorem filter_rcons;; +let count_cat = Sections.finalize_theorem count_cat;; +let has_cat = Sections.finalize_theorem has_cat;; +let has_rcons = Sections.finalize_theorem has_rcons;; +let all_cat = Sections.finalize_theorem all_cat;; +let all_rcons = Sections.finalize_theorem all_rcons;; +let eq_find = Sections.finalize_theorem eq_find;; +let eq_filter = Sections.finalize_theorem eq_filter;; +let eq_count = Sections.finalize_theorem eq_count;; +let eq_has = Sections.finalize_theorem eq_has;; +let eq_all = Sections.finalize_theorem eq_all;; +let filter_pred0 = Sections.finalize_theorem filter_pred0;; +let filter_predT = Sections.finalize_theorem filter_predT;; +let filter_predI = Sections.finalize_theorem filter_predI;; +let count_pred0 = Sections.finalize_theorem count_pred0;; +let count_predT = Sections.finalize_theorem count_predT;; +let count_predUI = Sections.finalize_theorem count_predUI;; +let count_predC = Sections.finalize_theorem count_predC;; +let has_pred0 = Sections.finalize_theorem has_pred0;; +let has_predT = Sections.finalize_theorem has_predT;; +let has_predC = Sections.finalize_theorem has_predC;; +let has_predU = Sections.finalize_theorem has_predU;; +let all_pred0 = Sections.finalize_theorem all_pred0;; +let all_predT = Sections.finalize_theorem all_predT;; +let all_predC = Sections.finalize_theorem all_predC;; +let can_inj = Sections.finalize_theorem can_inj;; +let all_predI = Sections.finalize_theorem all_predI;; +let eq_ext = Sections.finalize_theorem eq_ext;; +let drop_nil = Sections.finalize_theorem drop_nil;; +let drop0 = Sections.finalize_theorem drop0;; +let drop_cons = Sections.finalize_theorem drop_cons;; +let drop_behead = Sections.finalize_theorem drop_behead;; +let drop0 = Sections.finalize_theorem drop0;; +let drop1 = Sections.finalize_theorem drop1;; +let drop_oversize = Sections.finalize_theorem drop_oversize;; +let drop_size = Sections.finalize_theorem drop_size;; +let size_drop = Sections.finalize_theorem size_drop;; +let drop_cat = Sections.finalize_theorem drop_cat;; +let drop_size_cat = Sections.finalize_theorem drop_size_cat;; +let nconsK = Sections.finalize_theorem nconsK;; +let take0 = Sections.finalize_theorem take0;; +let take_oversize = Sections.finalize_theorem take_oversize;; +let take_size = Sections.finalize_theorem take_size;; +let take_cons = Sections.finalize_theorem take_cons;; +let drop_rcons = Sections.finalize_theorem drop_rcons;; +let congr1 = Sections.finalize_theorem congr1;; +let cat_take_drop = Sections.finalize_theorem cat_take_drop;; +let size_takel = Sections.finalize_theorem size_takel;; +let size_take = Sections.finalize_theorem size_take;; +let take_cat = Sections.finalize_theorem take_cat;; +let take_size_cat = Sections.finalize_theorem take_size_cat;; +let takel_cat = Sections.finalize_theorem takel_cat;; +let nth_drop = Sections.finalize_theorem nth_drop;; +let nth_take = Sections.finalize_theorem nth_take;; +let drop_nth = Sections.finalize_theorem drop_nth;; +let take_nth = Sections.finalize_theorem take_nth;; +let rot0 = Sections.finalize_theorem rot0;; +let size_rot = Sections.finalize_theorem size_rot;; +let rot_oversize = Sections.finalize_theorem rot_oversize;; +let rot_size = Sections.finalize_theorem rot_size;; +let has_rot = Sections.finalize_theorem has_rot;; +let rot_size_cat = Sections.finalize_theorem rot_size_cat;; +let rotK = Sections.finalize_theorem rotK;; +let rot_inj = Sections.finalize_theorem rot_inj;; +let rot1_cons = Sections.finalize_theorem rot1_cons;; +Sections.end_section "Sequences";; +let catrev = define `catrev (x :: s1) s2 = catrev s1 (x :: s2) /\ catrev [] s2 = s2`;; +let rev = new_definition `rev s = catrev s []`;; + +(* Section Rev *) +Sections.begin_section "Rev";; +(Sections.add_section_type (mk_var ("s", (`:(A)list`))); Sections.add_section_type (mk_var ("t", (`:(A)list`))));; + +(* Lemma catrev_catl *) +let catrev_catl = Sections.section_proof ["s";"t";"u"] +`catrev (s ++ t) u = catrev t (catrev s u)` +[ + ((((use_arg_then2 ("u", [])) (disch_tac [])) THEN (clear_assumption "u") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) THEN ((((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("catrev", [catrev]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma catrev_catr *) +let catrev_catr = Sections.section_proof ["s";"t";"u"] +`catrev s (t ++ u) = catrev s t ++ u` +[ + (((THENL) (((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN (BETA_TAC THEN (move ["t"])) THEN ((((use_arg_then2 ("catrev", [catrev]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (((((use_arg_then2 ("IHs", []))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma catrevE *) +let catrevE = Sections.section_proof ["s";"t"] +`catrev s t = rev s ++ t` +[ + (((((use_arg_then2 ("rev", [rev]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("catrev_catr", [catrev_catr]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma rev_cons *) +let rev_cons = Sections.section_proof ["x";"s"] +`rev (x :: s) = rcons (rev s) x` +[ + (((((use_arg_then2 ("cats1", [cats1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("catrevE", [catrevE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rev", [rev]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("catrev", [catrev]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma size_rev *) +let size_rev = Sections.section_proof ["s"] +`sizel (rev s) = sizel s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("rev", [rev]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("catrev", [catrev]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (((((use_arg_then2 ("catrevE", [catrevE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cats1", [cats1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rcons", [size_rcons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rev_cat *) +let rev_cat = Sections.section_proof ["s";"t"] +`rev (s ++ t) = rev t ++ rev s` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("rev", [rev]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("catrev_catr", [catrev_catr]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("cat0s", [cat0s]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("catrev_catl", [catrev_catl]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma rev_rcons *) +let rev_rcons = Sections.section_proof ["s";"x"] +`rev (rcons s x) = x :: rev s` +[ + (((((use_arg_then2 ("cats1", [cats1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rev_cat", [rev_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rev", [rev]))(thm_tac (new_rewrite [] []))))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("catrev", [catrev]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))) THEN (done_tac)); +];; + +(* Lemma revK *) +let revK = Sections.section_proof ["s"] +`rev (rev s) = s` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) ((repeat_tactic 1 9 (((use_arg_then2 ("rev", [rev]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("catrev", [catrev]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (simp_tac))); + (((((use_arg_then2 ("rev_cons", [rev_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rev_rcons", [rev_rcons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_rev *) +let nth_rev = Sections.section_proof ["x0";"n";"s"] +`n < sizel s ==> nth x0 (rev s) n = nth x0 s (sizel s - SUC n)` +[ + ((((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN BETA_TAC) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[IMP_IMP] last_ind))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + (((((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["s"]) THEN (move ["x"]) THEN (move ["IHs"]) THEN (move ["n"])); + ((((use_arg_then2 ("rev_rcons", [rev_rcons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rcons", [size_rcons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltnS", [ltnS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subSS", [subSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cats1", [cats1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_cat", [nth_cat]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) (((((use_arg_then2 ("subn0", [subn0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("subnn", [subnn]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth0", [nth0]))(thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("head", [head]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac))); + (BETA_TAC THEN (move ["lt_n_s"])); + ((((fun arg_tac -> (use_arg_then2 ("subnK", [subnK])) (fun fst_arg -> (use_arg_then2 ("lt_n_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then2 ("addSnnS", [addSnnS]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_addr", [leq_addr]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("IHs", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Finalization of the section Rev *) +let catrev_catl = Sections.finalize_theorem catrev_catl;; +let catrev_catr = Sections.finalize_theorem catrev_catr;; +let catrevE = Sections.finalize_theorem catrevE;; +let rev_cons = Sections.finalize_theorem rev_cons;; +let size_rev = Sections.finalize_theorem size_rev;; +let rev_cat = Sections.finalize_theorem rev_cat;; +let rev_rcons = Sections.finalize_theorem rev_rcons;; +let revK = Sections.finalize_theorem revK;; +let nth_rev = Sections.finalize_theorem nth_rev;; +Sections.end_section "Rev";; + +(* Section EqSeq *) +Sections.begin_section "EqSeq";; +(Sections.add_section_var (mk_var ("n0", (`:num`))));; +(Sections.add_section_var (mk_var ("x0", (`:A`))));; +(Sections.add_section_type (mk_var ("s", (`:(A)list`))));; +(Sections.add_section_type (mk_var ("x", (`:A`))); Sections.add_section_type (mk_var ("y", (`:A`))); Sections.add_section_type (mk_var ("z", (`:A`))));; + +(* Lemma eqseq_cons *) +let eqseq_cons = Sections.section_proof ["x1";"x2";"s1";"s2"] +`((x1 :: s1) = x2 :: s2) <=> (x1 = x2 /\ s1 = s2)` +[ + ((((fun arg_tac -> arg_tac (Arg_theorem (injectivity "list")))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma eqseq_cat *) +let eqseq_cat = Sections.section_proof ["s1";"s2";"s3";"s4"] +`sizel s1 = sizel s2 ==> (s1 ++ s3 = s2 ++ s4 <=> (s1 = s2 /\ s3 = s4))` +[ + ((THENL) (((THENL) (((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["x1"]) THEN (move ["s1"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["x2"]) THEN (move ["s2"]) THEN (move ["_"]))]) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))) [(arith_tac); (arith_tac); BETA_TAC]); + (((((use_arg_then2 ("eqSS", [eqSS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqseq_cons", [eqseq_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andbA", [andbA]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHs", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eqseq_rcons *) +let eqseq_rcons = Sections.section_proof ["s1";"s2";"x1";"x2"] +`(rcons s1 x1 = rcons s2 x2) <=> (s1 = s2 /\ x1 = x2)` +[ + ((THENL_ROT (-1)) (((THENL) (((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["y1"]) THEN (move ["s1"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["y2"]) THEN (move ["s2"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("rcons", [rcons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("eqseq_cons", [eqseq_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)))); + (((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbA", [andbA]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((THENL) (((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s2"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("rcons", [rcons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("NOT_CONS_NIL", [NOT_CONS_NIL]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac)); + (((THENL) (((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["xx"]) THEN (move ["ss"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("rcons", [rcons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("NOT_CONS_NIL", [NOT_CONS_NIL]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma has_filter *) +let has_filter = Sections.section_proof ["a";"s"] +`has a s <=> ~(filter a s = [])` +[ + ((((use_arg_then2 ("has_count", [has_count]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("count_filter", [count_filter]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`filter a s`))) (term_tac (set_tac "l"))); + (((THENL) (((use_arg_then2 ("l_def", [])) (disch_tac [])) THEN (clear_assumption "l_def") THEN ((use_arg_then2 ("l", [])) (disch_tac [])) THEN (clear_assumption "l") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["l"]) THEN (move ["_"]))]) THEN (BETA_TAC THEN (move ["_"])) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltnn", [ltnn]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("NOT_CONS_NIL", [NOT_CONS_NIL]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("gtS0", [gtS0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma size_eq0 *) +let size_eq0 = Sections.section_proof ["s"] +`(sizel s = 0) <=> (s = [])` +[ + (((THENL) (split_tac) [ALL_TAC; (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("size0nil", [size0nil])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (done_tac)); +];; +parse_as_infix("<-", (11, "right"));; +override_interface("<-", `MEM`);; + +(* Lemma in_cons *) +let in_cons = Sections.section_proof ["y";"s";"x"] +`(x <- y :: s) <=> (x = y \/ x <- s)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("MEM", [MEM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma in_nil *) +let in_nil = Sections.section_proof ["x"] +`(x <- []) = F` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("MEM", [MEM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma mem_seq1 *) +let mem_seq1 = Sections.section_proof ["x";"y"] +`(x <- [y]) <=> (x = y)` +[ + (((((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_nil", [in_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbF", [orbF]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_seq2 *) +let mem_seq2 = Sections.section_proof ["x";"y1";"y2"] +`(x <- [y1; y2]) <=> (x = y1 \/ x = y2)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_nil", [in_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbF", [orbF]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_seq3 *) +let mem_seq3 = Sections.section_proof ["x";"y1";"y2";"y3"] +`(x <- [y1; y2; y3]) <=> (x = y1 \/ x = y2 \/ x = y3)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_nil", [in_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbF", [orbF]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_seq4 *) +let mem_seq4 = Sections.section_proof ["x";"y1";"y2";"y3";"y4"] +`(x <- [y1; y2; y3; y4]) <=> (x = y1 \/ x = y2 \/ x = y3 \/ x = y4)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_nil", [in_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbF", [orbF]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_cat *) +let mem_cat = Sections.section_proof ["x";"s1";"s2"] +`(x <- s1 ++ s2) <=> (x <- s1 \/ x <- s2)` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s1"]) THEN (move ["IHs"]))]) (((((use_arg_then2 ("cat0s", [cat0s]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_nil", [in_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orFb", [orFb]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("cat_cons", [cat_cons]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbA", [orbA]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma mem_rcons *) +let mem_rcons = Sections.section_proof ["s";"y"] +`!x. x <- rcons s y <=> x <- y :: s` +[ + ((BETA_TAC THEN (move ["x"])) THEN ((((use_arg_then2 ("cats1", [cats1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_seq1", [mem_seq1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbC", [orbC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_head *) +let mem_head = Sections.section_proof ["x";"s"] +`x <- x :: s` +[ + (((((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma mem_last *) +let mem_last = Sections.section_proof ["x";"s"] +`last x s <- x :: s` +[ + (((((use_arg_then2 ("lastI", [lastI]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_rcons", [mem_rcons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_head", [mem_head]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_behead *) +let mem_behead = Sections.section_proof ["s"] +`!x. x <- behead s ==> x <- s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["_"]) THEN (move ["x"]))]) THEN ((((use_arg_then2 ("behead", [behead]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("in_nil", [in_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("in_cons", [in_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma mem_belast *) +let mem_belast = Sections.section_proof ["s";"y"] +`!x. x <- belast y s ==> x <- y :: s` +[ + ((BETA_TAC THEN (move ["x"]) THEN (move ["ys'x"])) THEN ((((use_arg_then2 ("lastI", [lastI]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_rcons", [mem_rcons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_behead", [mem_behead]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("behead", [behead]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma mem_nth *) +let mem_nth = Sections.section_proof ["s";"n"] +`n < sizel s ==> nth x0 s n <- s` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltS0", [ltS0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("mem_head", [mem_head]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))) THEN (move ["sz_s"])); + ((((use_arg_then2 ("mem_behead", [mem_behead]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("behead", [behead]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma mem_take *) +let mem_take = Sections.section_proof ["s";"x"] +`x <- take n0 s ==> x <- s` +[ + ((BETA_TAC THEN (move ["s0x"])) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("cat_take_drop", [cat_take_drop])) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_drop *) +let mem_drop = Sections.section_proof ["s";"x"] +`x <- dropl n0 s ==> x <- s` +[ + ((BETA_TAC THEN (move ["s0'x"])) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("cat_take_drop", [cat_take_drop])) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_rev *) +let mem_rev = Sections.section_proof ["s"] +`!x. x <- rev s <=> x <- s` +[ + ((THENL_FIRST) ((BETA_TAC THEN (move ["y"])) THEN ((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))])) (((((use_arg_then2 ("rev", [rev]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("catrev", [catrev]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac))); + (((((use_arg_then2 ("rev_cons", [rev_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_rcons", [mem_rcons]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Filters *) +Sections.begin_section "Filters";; +(Sections.add_section_var (mk_var ("a", (`:A -> bool`))));; + +(* Lemma hasP *) +let hasP = Sections.section_proof ["s"] +`(?x. x <- s /\ a x) <=> has a s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("has", [has]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_nil", [in_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))))); + ((THENL_FIRST) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(a:A->bool) y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ay"])) (((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("mem_head", [mem_head]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((THENL_ROT (-1)) ((((use_arg_then2 ("IHs", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((split_tac) THEN ALL_TAC THEN (case THEN ((move ["x"]) THEN (case THEN ((move ["ysx"]) THEN (move ["ax"])))))))); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("mem_behead", [mem_behead]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("behead", [behead]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("ysx", [])) (disch_tac [])) THEN (clear_assumption "ysx") THEN BETA_TAC) THEN (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x = y:A`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN ((simp_tac THEN TRY done_tac)) THEN (move ["xy"])); + ((((use_arg_then2 ("ax", [])) (disch_tac [])) THEN (clear_assumption "ax") THEN BETA_TAC) THEN ((((use_arg_then2 ("xy", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ay", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma hasPn *) +let hasPn = Sections.section_proof ["s"] +`(!x. x <- s ==> ~(a x)) <=> ~has a s` +[ + ((THENL_ROT (1)) ((split_tac) THEN (move ["not_a_s"]))); + ((BETA_TAC THEN (move ["x"]) THEN (move ["s_x"])) THEN (((use_arg_then2 ("not_a_s", [])) (disch_tac [])) THEN (clear_assumption "not_a_s") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (move ["a_x"]))); + ((((use_arg_then2 ("hasP", [hasP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); + ((((((use_arg_then2 ("hasP", [hasP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("implybF", [implybF]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (case THEN ((move ["x"]) THEN (case THEN (move ["s_x"]))))) THEN (((use_arg_then2 ("implybF", [implybF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("not_a_s", [])) (disch_tac [])) THEN (clear_assumption "not_a_s") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma allP *) +let allP = Sections.section_proof ["s"] +`(!x. x <- s ==> a x) <=> (all a s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("in_nil", [in_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("all", [all]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((THENL_ROT (-1)) (((((use_arg_then2 ("andbC", [andbC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHs", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (split_tac))); + (BETA_TAC THEN (case THEN ((move ["h"]) THEN (move ["ax"]))) THEN (move ["y"]) THEN ((THENL) case [((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); (move ["ys"])])); + (((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN (exact_tac)); + (BETA_TAC THEN (move ["h"])); + ((THENL_FIRST) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(a:A->bool) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac)) (BETA_TAC THEN (move ["ax"]))); + ((((((use_arg_then2 ("ax", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (move ["y"]) THEN (move ["ys"])) THEN (((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN (exact_tac)) THEN (done_tac)); + (((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN (exact_tac)); +];; + +(* Lemma allPn *) +let allPn = Sections.section_proof ["s"] +`(?x. x <- s /\ ~a x) <=> ~all a s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("all", [all]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("in_nil", [in_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("in_cons", [in_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + (((((use_arg_then2 ("andbC", [andbC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHs", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (split_tac)); + (BETA_TAC THEN (case THEN ((move ["y"]) THEN (case THEN ((move ["ay"]) THEN ((THENL) case [(move ["eq"]); (move ["mem"])])))))); + ((((use_arg_then2 ("ay", [])) (disch_tac [])) THEN (clear_assumption "ay") THEN BETA_TAC) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); + ((DISJ2_TAC) THEN ((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (done_tac)); + ((THENL_FIRST) ((THENL) case [(move ["nax"]); (case THEN ((move ["y"]) THEN (case THEN ((move ["ys"]) THEN (move ["nay"])))))]) ((((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (simp_tac)) THEN (done_tac))); + (((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma mem_filter *) +let mem_filter = Sections.section_proof ["x";"s"] +`(x <- filter a s) <=> (a x /\ x <- s)` +[ + ((((use_arg_then2 ("andbC", [andbC]))(thm_tac (new_rewrite [] [])))) THEN ((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("filter", [filter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("MEM", [MEM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("fun_if", [fun_if]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(a:A->bool) y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ay"])) THEN (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x = y:A`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN ((simp_tac THEN TRY done_tac))) THEN (done_tac)); +];; + +(* Finalization of the section Filters *) +let hasP = Sections.finalize_theorem hasP;; +let hasPn = Sections.finalize_theorem hasPn;; +let allP = Sections.finalize_theorem allP;; +let allPn = Sections.finalize_theorem allPn;; +let mem_filter = Sections.finalize_theorem mem_filter;; +Sections.end_section "Filters";; + +(* Lemma eq_in_filter *) +let eq_in_filter = Sections.section_proof ["a1";"a2";"s"] +`(!x. x <- s ==> a1 x = a2 x) ==> filter a1 s = filter a2 s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN (((((use_arg_then2 ("filter", [filter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))) THEN (move ["eq_a"]))); + (((((use_arg_then2 ("eq_a", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mem_head", [mem_head]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["y"]) THEN (move ["s_y"])); + ((((use_arg_then2 ("eq_a", [])) (disch_tac [])) THEN (clear_assumption "eq_a") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("mem_behead", [mem_behead]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("behead", [behead]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma eq_has_r *) +let eq_has_r = Sections.section_proof ["s1";"s2"] +`(!x. x <- s1 <=> x <- s2) ==> (!a. has a s1 <=> has a s2)` +[ + (BETA_TAC THEN (move ["Es12"]) THEN (move ["a"])); + ((split_tac) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("hasP", [hasP]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN ((move ["x"]) THEN (case THEN ((move ["Hx"]) THEN (move ["Hax"]))))))); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("Es12", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("Es12", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma eq_all_r *) +let eq_all_r = Sections.section_proof ["s1";"s2"] +`(!x. x <- s1 <=> x <- s2) ==> (!a. all a s1 = all a s2)` +[ + ((BETA_TAC THEN (move ["Es12"]) THEN (move ["a"])) THEN (repeat_tactic 1 9 (((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((split_tac) THEN (move ["Hs"]) THEN (move ["x"]) THEN (move ["Hx"]))); + ((((use_arg_then2 ("Hs", [])) (disch_tac [])) THEN (clear_assumption "Hs") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("Es12", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("Hs", [])) (disch_tac [])) THEN (clear_assumption "Hs") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("Es12", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma has_sym *) +let has_sym = Sections.section_proof ["s1";"s2"] +`has (\x. x <- s1) s2 = has (\x. x <- s2) s1` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("hasP", [hasP]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (simp_tac) THEN (((use_arg_then2 ("andbC", [andbC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma has_pred1 *) +let has_pred1 = Sections.section_proof ["x";"s"] +`has (pred1 x) s <=> x <- s` +[ + (((((use_arg_then2 ("hasP", [hasP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("pred1", [pred1]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((THENL) (split_tac) [((case THEN ((move ["y"]) THEN (case THEN ((move ["ys"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))))))) THEN ((TRY done_tac))); (move ["xs"])])); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); +];; +let constant = define `constant [] = T /\ constant (CONS x s') = all (pred1 x) s'`;; + +(* Lemma all_pred1P *) +let all_pred1P = Sections.section_proof ["x";"s"] +`(s = nseq (sizel s) x) <=> (all (pred1 x) s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("all", [all]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eqseq_cons", [eqseq_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + ((THENL_ROT (-1)) ((THENL) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x = y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))); (move ["ne_xy"])])); + (((((use_arg_then2 ("pred1", [pred1]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((((use_arg_then2 ("ne_xy", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("andFb", [andFb]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); + (((((use_arg_then2 ("pred1", [pred1]))(thm_tac (new_rewrite [1] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("IHs", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nseq", [nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ncons", [ncons]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma all_pred1_constant *) +let all_pred1_constant = Sections.section_proof ["x";"s"] +`all (pred1 x) s ==> constant s` +[ + ((((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) THEN ((((use_arg_then2 ("constant", [constant]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("all", [all]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("pred1", [pred1]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma all_pred1_nseq *) +let all_pred1_nseq = Sections.section_proof ["x";"y";"n"] +`all (pred1 x) (nseq n y) <=> (n = 0 \/ x = y)` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("pred1", [pred1]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("all", [all]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((simp_tac THEN TRY done_tac)))); + (((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [(`y = x`)])))) THEN (((use_arg_then2 ("eqS0", [eqS0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orFb", [orFb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andb_idr", [andb_idr])) (disch_tac [])) THEN (clear_assumption "andb_idr") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("all", [all]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma constant_nseq *) +let constant_nseq = Sections.section_proof ["n";"x"] +`constant (nseq n x)` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN case) [ALL_TAC; (move ["n"])]) THEN ((((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("constant", [constant]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("ncons", [ncons]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nseq", [nseq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("all_pred1_nseq", [all_pred1_nseq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma constantP *) +let constantP = Sections.section_proof ["s"] +`(?x. s = nseq (sizel s) x) <=> (constant s)` +[ + ((THENL_FIRST) ((THENL) (split_tac) [(case THEN ((move ["x"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); ALL_TAC]) ((((use_arg_then2 ("constant_nseq", [constant_nseq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((THENL_FIRST) (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN case) [ALL_TAC; ((move ["x"]) THEN (move ["s"]))]) THEN ((((use_arg_then2 ("constant", [constant]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))) ((EXISTS_TAC `x0:A`) THEN ((((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac))); + (((((use_arg_then2 ("all_pred1P", [all_pred1P]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["def_s"])) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac))); + ((((use_arg_then2 ("def_s", []))(thm_tac (new_rewrite [1] [])))) THEN ((((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; +let uniq = define `uniq [] = T /\ (uniq (x :: s') <=> ~(MEM x s') /\ uniq s')`;; + +(* Lemma nil_uniq *) +let nil_uniq = Sections.section_proof [] +`uniq ([]:(A)list)` +[ + ((((use_arg_then2 ("uniq", [uniq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma cons_uniq *) +let cons_uniq = Sections.section_proof ["x";"s"] +`uniq (x :: s) <=> ~(x <- s) /\ uniq s` +[ + ((((use_arg_then2 ("uniq", [uniq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma cat_uniq *) +let cat_uniq = Sections.section_proof ["s1";"s2"] +`uniq (s1 ++ s2) <=> uniq s1 /\ ~ has (\x. x <- s1) s2 /\ uniq s2` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s1"]) THEN (move ["IHs"]))]) (((((use_arg_then2 ("in_nil", [in_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pred0", [pred0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("has_pred0", [has_pred0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat0s", [cat0s]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nil_uniq", [nil_uniq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("has_sym", [has_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat_cons", [cat_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cons_uniq", [cons_uniq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_cons", [has_cons]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("has_sym", [has_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cons_uniq", [cons_uniq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbA", [andbA]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((((use_arg_then2 ("andbAC", [andbAC]))(thm_tac (new_rewrite [] [(`_ /\ uniq s1`)])))) THEN (done_tac)); +];; + +(* Lemma uniq_catC *) +let uniq_catC = Sections.section_proof ["s1";"s2"] +`uniq (s1 ++ s2) = uniq (s2 ++ s1)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("cat_uniq", [cat_uniq]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("has_sym", [has_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbCA", [andbCA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbA", [andbA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbC", [andbC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma uniq_catCA *) +let uniq_catCA = Sections.section_proof ["s1";"s2";"s3"] +`uniq (s1 ++ s2 ++ s3) = uniq (s2 ++ s1 ++ s3)` +[ + (repeat_tactic 1 9 (((use_arg_then2 ("catA", [catA]))(thm_tac (new_rewrite [] []))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("uniq_catC", [uniq_catC]))(gsym_then (thm_tac (new_rewrite [] [(`uniq (cat _ s3)`)])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cat_uniq", [cat_uniq]))(thm_tac (new_rewrite [] [(`uniq (cat s3 _)`)]))))) THEN (((use_arg_then2 ("uniq_catC", [uniq_catC]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("has_cat", [has_cat]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("orbC", [orbC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rcons_uniq *) +let rcons_uniq = Sections.section_proof ["s";"x"] +`uniq (rcons s x) <=> (~(x <- s) /\ uniq s)` +[ + (((((use_arg_then2 ("cats1", [cats1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("uniq_catC", [uniq_catC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat_cons", [cat_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cons_uniq", [cons_uniq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat0s", [cat0s]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma filter_uniq *) +let filter_uniq = Sections.section_proof ["s";"a"] +`uniq s ==> uniq (filter a s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("filter", [filter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("uniq", [uniq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((THENL_ROT (-1)) (((THENL) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`a x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); (move ["nax"])]) THEN (BETA_TAC THEN (case THEN ((move ["Hx"]) THEN (move ["Hs"])))))); + (((((use_arg_then2 ("nax", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (((use_arg_then2 ("IHs", [])) (disch_tac [])) THEN (clear_assumption "IHs") THEN (exact_tac)) THEN (done_tac)); + ((((use_arg_then2 ("uniq", [uniq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("negbTE", [negbTE])) (fun fst_arg -> (use_arg_then2 ("Hx", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbF", [andbF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rot_uniq *) +let rot_uniq = Sections.section_proof ["s"] +`uniq (rot n0 s) = uniq s` +[ + (((((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("uniq_catC", [uniq_catC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat_take_drop", [cat_take_drop]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rev_uniq *) +let rev_uniq = Sections.section_proof ["s"] +`uniq (rev s) = uniq s` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) (((((use_arg_then2 ("rev", [rev]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("catrev", [catrev]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))) THEN (done_tac))); + (((((use_arg_then2 ("rev_cons", [rev_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cats1", [cats1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("cat_uniq", [cat_uniq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cons_uniq", [cons_uniq]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("has_cons", [has_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_nil", [in_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nil_uniq", [nil_uniq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_nil", [has_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("andbC", [andbC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_rev", [mem_rev]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma count_uniq_mem *) +let count_uniq_mem = Sections.section_proof ["s";"x"] +`uniq s ==> count (pred1 x) s = if (x <- s) then 1 else 0` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("count", [count]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("in_nil", [in_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + ((((((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cons_uniq", [cons_uniq]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["Hy"]))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHs", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("pred1", [pred1]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [(`y = x`)]))))); + (((THENL) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x = y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); ALL_TAC]) THEN ((((use_arg_then2 ("Hy", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("addn0", [addn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; +let undup = define `undup [] = [] /\ + undup (x :: s') = if x <- s' then undup s' else x :: undup s'`;; + +(* Lemma size_undup *) +let size_undup = Sections.section_proof ["s"] +`sizel (undup s) <= sizel s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("undup", [undup]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x <- s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_undup *) +let mem_undup = Sections.section_proof ["s"] +`!x. x <- undup s <=> x <- s` +[ + ((BETA_TAC THEN (move ["x"])) THEN ((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("undup", [undup]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y <- s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["Hy"])) THEN ((((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("MEM", [MEM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x = y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma undup_uniq *) +let undup_uniq = Sections.section_proof ["s"] +`uniq (undup s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("undup", [undup]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("uniq", [uniq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x <- s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) THEN (((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("cons_uniq", [cons_uniq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_undup", [mem_undup]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma undup_id *) +let undup_id = Sections.section_proof ["s"] +`uniq s ==> undup s = s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN (((((use_arg_then2 ("undup", [undup]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("uniq", [uniq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((simp_tac THEN TRY done_tac))) THEN ALL_TAC THEN (case THEN ((move ["Hx"]) THEN (move ["Hs"]))))); + ((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma ltn_size_undup *) +let ltn_size_undup = Sections.section_proof ["s"] +`(sizel (undup s) < sizel s) <=> ~ uniq s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("undup", [undup]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("uniq", [uniq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x <- s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) THEN (((simp_tac THEN TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ltnS", [ltnS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_undup", [size_undup]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +let index = new_definition `indexl x = find (pred1 x)`;; + +(* Lemma index_size *) +let index_size = Sections.section_proof ["x";"s"] +`indexl x s <= sizel s` +[ + (((((use_arg_then2 ("index", [index]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_size", [find_size]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma index_mem *) +let index_mem = Sections.section_proof ["x";"s"] +`(indexl x s < sizel s) <=> (x <- s)` +[ + (((((use_arg_then2 ("has_pred1", [has_pred1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index", [index]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_find", [has_find]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_index *) +let nth_index = Sections.section_proof ["x";"s"] +`x <- s ==> nth x0 s (indexl x s) = x` +[ + ((((use_arg_then2 ("has_pred1", [has_pred1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("nth_find", [nth_find])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then2 ("index", [index]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pred1", [pred1]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma index_cat *) +let index_cat = Sections.section_proof ["x";"s1";"s2"] +`indexl x (s1 ++ s2) = if x <- s1 then indexl x s1 else sizel s1 + indexl x s2` +[ + (((((use_arg_then2 ("index", [index]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_cat", [find_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_pred1", [has_pred1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma index_uniq *) +let index_uniq = Sections.section_proof ["i";"s"] +`i < sizel s ==> uniq s ==> indexl (nth x0 s i) s = i` +[ + (((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))) THEN ((THENL) elim [ALL_TAC; ((move ["i"]) THEN (move ["_"]))])); + (((((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("index", [index]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("find", [find]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("pred1", [pred1]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac)); + (((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltnS", [ltnS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("cons_uniq", [cons_uniq]))(thm_tac (new_rewrite [] []))))) THEN (move ["lt_i_s"]) THEN (case THEN (move ["not_s_x"]))); + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("IHs", [])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("lt_i_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("index", [index]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("find", [find]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("pred1", [pred1]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x = nth x0 s i`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["x_eq"])); + (((fun arg_tac -> (use_arg_then2 ("mem_nth", [mem_nth])) (fun fst_arg -> (use_arg_then2 ("lt_i_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((((use_arg_then2 ("x_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("negbTE", [negbTE])) (fun fst_arg -> (use_arg_then2 ("not_s_x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma index_head *) +let index_head = Sections.section_proof ["x";"s"] +`indexl x (x :: s) = 0` +[ + (((((use_arg_then2 ("index", [index]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("find", [find]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("pred1", [pred1]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma index_last *) +let index_last = Sections.section_proof ["x";"s"] +`uniq (x :: s) ==> indexl (last x s) (x :: s) = sizel s` +[ + ((((use_arg_then2 ("lastI", [lastI]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rcons_uniq", [rcons_uniq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cats1", [cats1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index_cat", [index_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_belast", [size_belast]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`last x s <- belast x s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac)); + (((((use_arg_then2 ("index", [index]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("find", [find]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("pred1", [pred1]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("addn0", [addn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma nth_uniq *) +let nth_uniq = Sections.section_proof ["s";"i";"j"] +`i < sizel s ==> j < sizel s ==> uniq s ==> (nth x0 s i = nth x0 s j) = (i = j)` +[ + ((BETA_TAC THEN (move ["lt_i_s"]) THEN (move ["lt_j_s"]) THEN (move ["Us"])) THEN ((THENL) (split_tac) [(move ["eq_sij"]); ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))])); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("index_uniq", [index_uniq])) (fun fst_arg -> (use_arg_then2 ("lt_i_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("Us", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_sij", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("index_uniq", [index_uniq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_rot *) +let mem_rot = Sections.section_proof ["s"] +`!x. x <- rot n0 s <=> x <- s` +[ + ((BETA_TAC THEN (move ["x"])) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("cat_take_drop", [cat_take_drop])) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] [(`s`)]))))) THEN (((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("orbC", [orbC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eqseq_rot *) +let eqseq_rot = Sections.section_proof ["s1";"s2"] +`(rot n0 s1 = rot n0 s2) <=> (s1 = s2)` +[ + (((THENL) (split_tac) [ALL_TAC; ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))]) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("rot_inj", [rot_inj])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (done_tac)); +];; + +(* Lemma rot_to *) +let rot_to = Sections.section_proof ["s";"x"] +`x <- s ==> ?i s'. rot i s = x :: s'` +[ + ((BETA_TAC THEN (move ["s_x"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`indexl (x:A) s`))) (term_tac (set_tac "i")))); + (((use_arg_then2 ("i", [])) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`dropl (SUC i) s ++ take i s`))) (term_tac exists_tac))); + (((((use_arg_then2 ("cat_cons", [cat_cons]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`take _1 _2`))) (term_tac (set_tac "r")))); + (((use_arg_then2 ("r_def", [])) (disch_tac [])) THEN (clear_assumption "r_def") THEN ((use_arg_then2 ("i_def", [])) (disch_tac [])) THEN (clear_assumption "i_def") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"])); + (((THENL) (((use_arg_then2 ("s_x", [])) (disch_tac [])) THEN (clear_assumption "s_x") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("in_nil", [in_nil]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x = y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac))); + ((((use_arg_then2 ("index_head", [index_head]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("drop0", [drop0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("drop_cons", [drop_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("drop0", [drop0]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((((use_arg_then2 ("index", [index]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("find", [find]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("pred1", [pred1]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("pred1", [pred1]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("index", [index]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("drop_cons", [drop_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (move ["_"])) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHs", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section EqSeq *) +let eqseq_cons = Sections.finalize_theorem eqseq_cons;; +let eqseq_cat = Sections.finalize_theorem eqseq_cat;; +let eqseq_rcons = Sections.finalize_theorem eqseq_rcons;; +let has_filter = Sections.finalize_theorem has_filter;; +let size_eq0 = Sections.finalize_theorem size_eq0;; +let in_cons = Sections.finalize_theorem in_cons;; +let in_nil = Sections.finalize_theorem in_nil;; +let mem_seq1 = Sections.finalize_theorem mem_seq1;; +let mem_seq2 = Sections.finalize_theorem mem_seq2;; +let mem_seq3 = Sections.finalize_theorem mem_seq3;; +let mem_seq4 = Sections.finalize_theorem mem_seq4;; +let mem_cat = Sections.finalize_theorem mem_cat;; +let mem_rcons = Sections.finalize_theorem mem_rcons;; +let mem_head = Sections.finalize_theorem mem_head;; +let mem_last = Sections.finalize_theorem mem_last;; +let mem_behead = Sections.finalize_theorem mem_behead;; +let mem_belast = Sections.finalize_theorem mem_belast;; +let mem_nth = Sections.finalize_theorem mem_nth;; +let mem_take = Sections.finalize_theorem mem_take;; +let mem_drop = Sections.finalize_theorem mem_drop;; +let mem_rev = Sections.finalize_theorem mem_rev;; +let hasP = Sections.finalize_theorem hasP;; +let hasPn = Sections.finalize_theorem hasPn;; +let allP = Sections.finalize_theorem allP;; +let allPn = Sections.finalize_theorem allPn;; +let mem_filter = Sections.finalize_theorem mem_filter;; +let eq_in_filter = Sections.finalize_theorem eq_in_filter;; +let eq_has_r = Sections.finalize_theorem eq_has_r;; +let eq_all_r = Sections.finalize_theorem eq_all_r;; +let has_sym = Sections.finalize_theorem has_sym;; +let has_pred1 = Sections.finalize_theorem has_pred1;; +let all_pred1P = Sections.finalize_theorem all_pred1P;; +let all_pred1_constant = Sections.finalize_theorem all_pred1_constant;; +let all_pred1_nseq = Sections.finalize_theorem all_pred1_nseq;; +let constant_nseq = Sections.finalize_theorem constant_nseq;; +let constantP = Sections.finalize_theorem constantP;; +let nil_uniq = Sections.finalize_theorem nil_uniq;; +let cons_uniq = Sections.finalize_theorem cons_uniq;; +let cat_uniq = Sections.finalize_theorem cat_uniq;; +let uniq_catC = Sections.finalize_theorem uniq_catC;; +let uniq_catCA = Sections.finalize_theorem uniq_catCA;; +let rcons_uniq = Sections.finalize_theorem rcons_uniq;; +let filter_uniq = Sections.finalize_theorem filter_uniq;; +let rot_uniq = Sections.finalize_theorem rot_uniq;; +let rev_uniq = Sections.finalize_theorem rev_uniq;; +let count_uniq_mem = Sections.finalize_theorem count_uniq_mem;; +let size_undup = Sections.finalize_theorem size_undup;; +let mem_undup = Sections.finalize_theorem mem_undup;; +let undup_uniq = Sections.finalize_theorem undup_uniq;; +let undup_id = Sections.finalize_theorem undup_id;; +let ltn_size_undup = Sections.finalize_theorem ltn_size_undup;; +let index_size = Sections.finalize_theorem index_size;; +let index_mem = Sections.finalize_theorem index_mem;; +let nth_index = Sections.finalize_theorem nth_index;; +let index_cat = Sections.finalize_theorem index_cat;; +let index_uniq = Sections.finalize_theorem index_uniq;; +let index_head = Sections.finalize_theorem index_head;; +let index_last = Sections.finalize_theorem index_last;; +let nth_uniq = Sections.finalize_theorem nth_uniq;; +let mem_rot = Sections.finalize_theorem mem_rot;; +let eqseq_rot = Sections.finalize_theorem eqseq_rot;; +let rot_to = Sections.finalize_theorem rot_to;; +Sections.end_section "EqSeq";; + +(* Section NseqthTheory *) +Sections.begin_section "NseqthTheory";; +(Sections.add_section_type (mk_var ("s", (`:(A)list`))));; + +(* Lemma nthP *) +let nthP = Sections.section_proof ["s";"x";"x0"] +`(?i. i < sizel s /\ nth x0 s i = x) <=> (x <- s)` +[ + ((THENL_FIRST) ((THENL) (split_tac) [(case THEN ((move ["n"]) THEN (case THEN ((move ["Hn"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))))))); (move ["Hx"])]) ((((use_arg_then2 ("mem_nth", [mem_nth])) (disch_tac [])) THEN (clear_assumption "mem_nth") THEN (DISCH_THEN apply_tac)) THEN (done_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`indexl x s`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Hx", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_index", [nth_index])) (disch_tac [])) THEN (clear_assumption "nth_index") THEN (DISCH_THEN apply_tac)) THEN (done_tac)); +];; + +(* Lemma has_nthP *) +let has_nthP = Sections.section_proof ["a";"s";"x0"] +`(?i. i < sizel s /\ a (nth x0 s i)) <=> (has a s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("has", [has]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("andFb", [andFb]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`a x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ax"])); + (((fun arg_tac -> arg_tac (Arg_term (`0`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltn0Sn", [ltn0Sn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); + ((THENL_ROT (-1)) ((((use_arg_then2 ("IHs", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [(case THEN ALL_TAC); (case THEN (move ["i"]))]))); + ((BETA_TAC THEN (case THEN ((move ["i_s"]) THEN (move ["anth"])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`SUC i`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltSS", [ltSS]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); + ((THENL_FIRST) (((THENL) elim [ALL_TAC; ((move ["i"]) THEN (move ["_"]))]) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) ((((use_arg_then2 ("ax", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac))); + ((((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["i_s"]) THEN (move ["anth"])))) THEN ((use_arg_then2 ("i", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma all_nthP *) +let all_nthP = Sections.section_proof ["a";"s";"x0"] +`(!i. i < sizel s ==> a (nth x0 s i)) <=> (all a s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("all", [all]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ltn0", [ltn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac)))); + ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`a x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ax"]))); + ((((use_arg_then2 ("NOT_FORALL_THM", [NOT_FORALL_THM]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`0`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn0Sn", [ltn0Sn]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); + ((((use_arg_then2 ("IHs", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((split_tac) THEN (move ["IH"]) THEN (move ["i"]) THEN (move ["i_s"]))); + ((((fun arg_tac -> (use_arg_then2 ("IH", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SUC i`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (exact_tac) THEN (done_tac)); + (((THENL) (((use_arg_then2 ("i_s", [])) (disch_tac [])) THEN (clear_assumption "i_s") THEN ((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN elim) [ALL_TAC; ((move ["i"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IH", [])) (disch_tac [])) THEN (clear_assumption "IH") THEN (DISCH_THEN apply_tac)) THEN (done_tac)); +];; + +(* Finalization of the section NseqthTheory *) +let nthP = Sections.finalize_theorem nthP;; +let has_nthP = Sections.finalize_theorem has_nthP;; +let all_nthP = Sections.finalize_theorem all_nthP;; +Sections.end_section "NseqthTheory";; + +(* Lemma set_nth_default *) +let set_nth_default = Sections.section_proof ["s";"y0";"x0";"n"] +`n < sizel s ==> nth (x0:A) s n = nth y0 s n` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s'"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHs", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (done_tac)); +];; + +(* Lemma headI *) +let headI = Sections.section_proof ["s";"x"] +`rcons s x = headl x s :: behead (rcons s (x:A))` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["s"]) THEN (move ["x"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("rcons", [rcons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("head", [head]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("behead", [behead]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; +let incr_nth = define `incr_nth (n :: v') (SUC i) = n :: incr_nth v' i /\ + incr_nth (n :: v') 0 = SUC n :: v' /\ + incr_nth [] i = ncons i 0 [1]`;; + +(* Lemma nth_incr_nth *) +let nth_incr_nth = Sections.section_proof ["v";"i";"j"] +`nth 0 (incr_nth v i) j = (if (i = j) then 1 else 0) + nth 0 v j` +[ + (((THENL) (((use_arg_then2 ("j", [])) (disch_tac [])) THEN (clear_assumption "j") THEN ((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN ((use_arg_then2 ("v", [])) (disch_tac [])) THEN (clear_assumption "v") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["v"]) THEN (move ["IHv"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["i"]) THEN (move ["_"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["j"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("incr_nth", [incr_nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("addn0", [addn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eqS0", [eqS0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("add0n", [add0n]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("add1n", [add1n]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (arith_tac); + (((THENL) (((use_arg_then2 ("j", [])) (disch_tac [])) THEN (clear_assumption "j") THEN ((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN elim) [ALL_TAC; ((move ["i"]) THEN (move ["IHv"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["j"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac)))); + (arith_tac); + (arith_tac); + (((((use_arg_then2 ("IHv", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqSS", [eqSS]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [(`0 = SUC j`)])))) THEN (((use_arg_then2 ("eqS0", [eqS0]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("IHv", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqSS", [eqSS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma size_incr_nth *) +let size_incr_nth = Sections.section_proof ["v";"i"] +`sizel (incr_nth v i) = if i < sizel v then sizel v else SUC i` +[ + (((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN ((use_arg_then2 ("v", [])) (disch_tac [])) THEN (clear_assumption "v") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["v"]) THEN (move ["IHv"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["i"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("incr_nth", [incr_nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_ncons", [size_ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("add0n", [add0n]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ltS0", [ltS0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (((((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addn1", [addn1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("ltn0Sn", [ltn0Sn]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("IHv", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("fun_if", [fun_if])) (thm_tac apply_tac)) THEN (done_tac)); +];; + +(* Section PermSeq *) +Sections.begin_section "PermSeq";; +(Sections.add_section_type (mk_var ("s", (`:(A)list`))); Sections.add_section_type (mk_var ("s1", (`:(A)list`))));; +let same_count1 = new_definition `same_count1 s1 s2 x <=> (count (pred1 x) s1 = count (pred1 x) s2)`;; +let perm_eq = new_definition `perm_eq s1 s2 = all (same_count1 s1 s2) (s1 ++ s2)`;; + +(* Lemma perm_eqP *) +let perm_eqP = Sections.section_proof ["s1";"s2"] +`perm_eq s1 s2 <=> (!a. count a s1 = count a s2)` +[ + ((THENL_LAST) (((((use_arg_then2 ("perm_eq", [perm_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("same_count1", [same_count1]))(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [((move ["eq_cnt1"]) THEN (move ["a"])); ((move ["eq_cnt"]) THEN (move ["x"]) THEN (move ["_"]))])) (exact_tac)); + ((((fun arg_tac -> (use_arg_then2 ("ltnSn", [ltnSn])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`count a (s1 ++ s2)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("a", [])) (disch_tac [1; 3; 4])) THEN (clear_assumption "a") THEN ((fun arg_tac -> arg_tac (Arg_term (`SUC _`))) (disch_tac [])) THEN elim) THEN (((repeat_tactic 0 10 (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["n"]) THEN (move ["IHn"]) THEN (move ["a"]) THEN (move ["le_an"]))); + (((fun arg_tac -> (use_arg_then2 ("posnP", [posnP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`count a (s1 ++ s2)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case); + ((((((use_arg_then2 ("count_cat", [count_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addn_eq0", [addn_eq0]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((((use_arg_then2 ("has_count", [has_count]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hasP", [hasP]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN ((move ["s12x"]) THEN (move ["a_x"])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`predD1 a x`))) (term_tac (set_tac "a'")))); + ((fun arg_tac -> arg_tac (Arg_term (`!s. count a s = count (pred1 x) s + count a' s`))) (term_tac (have_gen_tac [](move ["cnt_a'"])))); + (BETA_TAC THEN (move ["s"])); + ((((use_arg_then2 ("count_filter", [count_filter]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("count_predC", [count_predC])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`pred1 x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 2 0 (((use_arg_then2 ("count_filter", [count_filter]))(thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("filter_predI", [filter_predI]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("count_filter", [count_filter]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("predC", [predC]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`predI (\x'. ~pred1 x x') a = predD1 a x`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("predI", [predI]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("predD1", [predD1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("predD", [predD]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); + ((((use_arg_then2 ("a'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqn_addr", [eqn_addr]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN ((use_arg_then2 ("eq_count", [eq_count])) (disch_tac [])) THEN (clear_assumption "eq_count") THEN (DISCH_THEN apply_tac) THEN (move ["y"])) THEN ((((use_arg_then2 ("predI", [predI]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pred1", [pred1]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((THENL) (split_tac) [(case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))]) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("cnt_a'", []))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("eq_cnt1", [])) (fun fst_arg -> (use_arg_then2 ("s12x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("IHn", [])) (fun fst_arg -> (use_arg_then2 ("a'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltnS", [ltnS]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("le_an", [])) (disch_tac [])) THEN (clear_assumption "le_an") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leq_trans", [leq_trans])) (disch_tac [])) THEN (clear_assumption "leq_trans") THEN (DISCH_THEN apply_tac))); + (((((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ltnS", [ltnS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cnt_a'", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add1n", [add1n]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leq_add2r", [leq_add2r]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("has_count", [has_count]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("has_pred1", [has_pred1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_eq_refl *) +let perm_eq_refl = Sections.section_proof ["s"] +`perm_eq s s` +[ + ((((use_arg_then2 ("perm_eqP", [perm_eqP]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma perm_eq_sym *) +let perm_eq_sym = Sections.section_proof [] +`!s1 s2. perm_eq s1 s2 = perm_eq s2 s1` +[ + ((BETA_TAC THEN (move ["s1"]) THEN (move ["s2"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("perm_eqP", [perm_eqP]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [(`!a. _ a`)]))))) THEN (done_tac)); +];; + +(* Lemma perm_eq_trans *) +let perm_eq_trans = Sections.section_proof [] +`!s2 s1 s3. perm_eq s1 s2 ==> perm_eq s2 s3 ==> perm_eq s1 s3` +[ + ((BETA_TAC THEN (move ["s2"]) THEN (move ["s1"]) THEN (move ["s3"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("perm_eqP", [perm_eqP]))(thm_tac (new_rewrite [] []))))) THEN (move ["eq12"]) THEN (move ["eq23"]) THEN (move ["a"]))); + (((((use_arg_then2 ("eq12", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq23", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_eqlP *) +let perm_eqlP = Sections.section_proof ["s1";"s2"] +`perm_eq s1 s2 <=> (!s. perm_eq s1 s = perm_eq s2 s)` +[ + ((THENL_LAST) ((THENL) (split_tac) [((move ["eq12"]) THEN (move ["s3"])); (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))]) ((((use_arg_then2 ("perm_eq_refl", [perm_eq_refl]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((THENL_LAST) (split_tac) (((use_arg_then2 ("perm_eq_trans", [perm_eq_trans])) (disch_tac [])) THEN (clear_assumption "perm_eq_trans") THEN (exact_tac))); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("perm_eq_sym", [perm_eq_sym])) (fun fst_arg -> (use_arg_then2 ("s3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [(`perm_eq _ s3`)])))))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("perm_eq_trans", [perm_eq_trans])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (DISCH_THEN apply_tac) THEN (done_tac)); +];; + +(* Lemma perm_eqrP *) +let perm_eqrP = Sections.section_proof ["s1";"s2"] +`perm_eq s1 s2 <=> (!s. perm_eq s s1 = perm_eq s s2)` +[ + ((THENL_LAST) ((THENL) (split_tac) [ALL_TAC; (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))]) ((((use_arg_then2 ("perm_eq_refl", [perm_eq_refl]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("perm_eqlP", [perm_eqlP]))(thm_tac (new_rewrite [] [])))) THEN (move ["eq12"]) THEN (move ["s3"])); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("perm_eq_sym", [perm_eq_sym])) (fun fst_arg -> (use_arg_then2 ("s3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [(`perm_eq s3 _`)]))))) THEN (((use_arg_then2 ("eq12", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_catC *) +let perm_catC = Sections.section_proof ["s1";"s2"] +`!s. perm_eq (s1 ++ s2) s = perm_eq (s2 ++ s1) s` +[ + ((((((use_arg_then2 ("perm_eqlP", [perm_eqlP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("perm_eqP", [perm_eqP]))(thm_tac (new_rewrite [] []))))) THEN (move ["a"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("count_cat", [count_cat]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_cat2l *) +let perm_cat2l = Sections.section_proof ["s1";"s2";"s3"] +`perm_eq (s1 ++ s2) (s1 ++ s3) = perm_eq s2 s3` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("perm_eqP", [perm_eqP]))(thm_tac (new_rewrite [] []))))) THEN ((split_tac) THEN (move ["eq23"]) THEN (move ["a"]))); + ((((fun arg_tac -> (use_arg_then2 ("eq23", [])) (fun fst_arg -> (use_arg_then2 ("a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("count_cat", [count_cat]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eqn_addl", [eqn_addl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("eq23", [])) (fun fst_arg -> (use_arg_then2 ("a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("count_cat", [count_cat]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eqn_addl", [eqn_addl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_cons *) +let perm_cons = Sections.section_proof ["x";"s1";"s2"] +`perm_eq (x :: s1) (x :: s2) = perm_eq s1 s2` +[ + ((((fun arg_tac -> (use_arg_then2 ("perm_cat2l", [perm_cat2l])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`[x]`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("cat_cons", [cat_cons]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cat0s", [cat0s]))(thm_tac (new_rewrite [] [])))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_cat2r *) +let perm_cat2r = Sections.section_proof ["s1";"s2";"s3"] +`perm_eq (s2 ++ s1) (s3 ++ s1) = perm_eq s2 s3` +[ + ((repeat_tactic 2 0 (((((use_arg_then2 ("perm_eq_sym", [perm_eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_catC", [perm_catC]))(thm_tac (new_rewrite [] []))))))) THEN (((use_arg_then2 ("perm_cat2l", [perm_cat2l]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma perm_catAC *) +let perm_catAC = Sections.section_proof ["s1";"s2";"s3"] +`!s. perm_eq ((s1 ++ s2) ++ s3) s = perm_eq ((s1 ++ s3) ++ s2) s` +[ + (((((use_arg_then2 ("perm_eqlP", [perm_eqlP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("catA", [catA]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("perm_cat2l", [perm_cat2l]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_catC", [perm_catC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_eq_refl", [perm_eq_refl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_catCA *) +let perm_catCA = Sections.section_proof ["s1";"s2";"s3"] +`!s. perm_eq (s1 ++ s2 ++ s3) s = perm_eq (s2 ++ s1 ++ s3) s` +[ + (((((use_arg_then2 ("perm_eqlP", [perm_eqlP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("catA", [catA]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("perm_cat2r", [perm_cat2r]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_catC", [perm_catC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_eq_refl", [perm_eq_refl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_rcons *) +let perm_rcons = Sections.section_proof ["x";"s"] +`!s2. perm_eq (rcons s x) s2 = perm_eq (x :: s) s2` +[ + ((BETA_TAC THEN (move ["s2"])) THEN ((((use_arg_then2 ("cats1", [cats1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("perm_catC", [perm_catC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat1s", [cat1s]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_rot *) +let perm_rot = Sections.section_proof ["n";"s"] +`!s2. perm_eq (rot n s) s2 = perm_eq s s2` +[ + ((BETA_TAC THEN (move ["s2"])) THEN ((((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_catC", [perm_catC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat_take_drop", [cat_take_drop]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_rotr *) +let perm_rotr = Sections.section_proof ["n";"s"] +`!s2. perm_eq (rotr n s) s2 = perm_eq s s2` +[ + (((((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_rot", [perm_rot]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_filterC *) +let perm_filterC = Sections.section_proof ["a";"s"] +`!s2. perm_eq (filter a s ++ filter (predC a) s) s2 = perm_eq s s2` +[ + ((((use_arg_then2 ("perm_eqlP", [perm_eqlP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("filter", [filter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("perm_eq_refl", [perm_eq_refl]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("predC", [predC]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("predC", [predC]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`a x`))) (disch_tac [])) THEN case THEN (simp_tac)) ((((use_arg_then2 ("cat1s", [cat1s]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("perm_catCA", [perm_catCA]))(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("perm_cons", [perm_cons]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_eq_mem *) +let perm_eq_mem = Sections.section_proof ["s1";"s2"] +`perm_eq s1 s2 ==> (!x. x <- s1 <=> x <- s2)` +[ + (((((use_arg_then2 ("perm_eqP", [perm_eqP]))(thm_tac (new_rewrite [] [])))) THEN (move ["eq12"]) THEN (move ["x"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("has_pred1", [has_pred1]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("has_count", [has_count]))(thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("eq12", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma perm_eq_size *) +let perm_eq_size = Sections.section_proof ["s1";"s2"] +`perm_eq s1 s2 ==> sizel s1 = sizel s2` +[ + ((((use_arg_then2 ("perm_eqP", [perm_eqP]))(thm_tac (new_rewrite [] [])))) THEN (move ["eq12"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("count_predT", [count_predT]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("eq12", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma uniq_leq_size *) +let uniq_leq_size = Sections.section_proof ["s1";"s2"] +`uniq s1 ==> (!x. x <- s1 ==> x <- s2) ==> sizel s1 <= sizel s2` +[ + ((THENL) ((THENL) (((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s1"]) THEN (move ["IHs"]))]) [(((((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq0n", [leq0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); ((((use_arg_then2 ("cons_uniq", [cons_uniq]))(thm_tac (new_rewrite [] [])))) THEN (move ["_"]) THEN (case THEN ((move ["Hx"]) THEN (move ["Hs1"]) THEN (move ["Hs12"]))))]); + ((((fun arg_tac -> (use_arg_then2 ("Hs12", [])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("mem_head", [mem_head]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["Hxs2"]))); + (((fun arg_tac -> (use_arg_then2 ("rot_to", [rot_to])) (fun fst_arg -> (use_arg_then2 ("Hxs2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["i"])) THEN (case THEN ((move ["s2'"]) THEN (move ["Ds2'"])))); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("size_rot", [size_rot])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [(`sizel s2`)]))))) THEN (((use_arg_then2 ("Ds2'", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Hs1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (move ["Hy"])); + ((((fun arg_tac -> (use_arg_then2 ("Hs12", [])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Hy", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((fun arg_tac -> (use_arg_then2 ("mem_rot", [mem_rot])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Ds2'", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] [])))))); + ((case THEN ((TRY done_tac)) THEN (move ["yx"])) THEN (((use_arg_then2 ("Hy", [])) (disch_tac [])) THEN (clear_assumption "Hy") THEN ((use_arg_then2 ("Hx", [])) (disch_tac [])) THEN (clear_assumption "Hx") THEN BETA_TAC)); + (((((use_arg_then2 ("yx", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma leq_size_uniq *) +let leq_size_uniq = Sections.section_proof ["s1";"s2"] +`uniq s1 ==> (!x. x <- s1 ==> x <- s2) ==> sizel s2 <= sizel s1 ==> uniq s2` +[ + ((THENL) (((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [((move ["s2"]) THEN (move ["Hs1"]) THEN (move ["Hs12"])); ((move ["x"]) THEN (move ["s1"]) THEN (move ["IHs"]) THEN (move ["s2"]) THEN (move ["Hs1"]) THEN (move ["Hs12"]))]); + (((THENL) (((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["_"]))]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("nil_uniq", [nil_uniq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("Hs12", [])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("mem_head", [mem_head]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["Hxs2"]))); + (((fun arg_tac -> (use_arg_then2 ("rot_to", [rot_to])) (fun fst_arg -> (use_arg_then2 ("Hxs2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["i"])) THEN (case THEN ((move ["s2'"]) THEN (move ["Ds2'"])))); + (((((fun arg_tac -> (use_arg_then2 ("size_rot", [size_rot])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("rot_uniq", [rot_uniq])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Ds2'", []))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x <- s2'`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["Hs2'"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cons_uniq", [cons_uniq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Hs2'", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((fun arg_tac -> (use_arg_then2 ("size_cons", [size_cons])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> (use_arg_then2 ("uniq_leq_size", [uniq_leq_size])) (fun fst_arg -> (use_arg_then2 ("Hs1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac) THEN ((move ["y"]) THEN (move ["Hy"]))); + ((((fun arg_tac -> (use_arg_then2 ("Hs12", [])) (fun fst_arg -> (use_arg_then2 ("Hy", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((fun arg_tac -> (use_arg_then2 ("mem_rot", [mem_rot])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Ds2'", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (case THEN ((TRY done_tac)) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("Hs1", [])) (disch_tac [])) THEN (clear_assumption "Hs1") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("cons_uniq", [cons_uniq]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["Hx"]) THEN (move ["Hs1"])))) THEN ((((use_arg_then2 ("Hs2'", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + (((fun arg_tac -> (use_arg_then2 ("IHs", [])) (fun fst_arg -> (use_arg_then2 ("Hs1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac) THEN ((move ["y"]) THEN (move ["Hy"]))); + (((fun arg_tac -> (use_arg_then2 ("Hs12", [])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Hy", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((fun arg_tac -> (use_arg_then2 ("mem_rot", [mem_rot])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Ds2'", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (case THEN ((TRY done_tac)) THEN (move ["yx"]))); + ((((use_arg_then2 ("Hx", [])) (disch_tac [])) THEN (clear_assumption "Hx") THEN ((use_arg_then2 ("Hy", [])) (disch_tac [])) THEN (clear_assumption "Hy") THEN BETA_TAC) THEN ((((use_arg_then2 ("yx", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma uniq_size_uniq *) +let uniq_size_uniq = Sections.section_proof ["s1";"s2"] +`uniq s1 ==> (!x. x <- s1 <=> x <- s2) ==> (uniq s2 = (sizel s2 = sizel s1))` +[ + (BETA_TAC THEN (move ["Us1"]) THEN (move ["Es12"])); + ((((use_arg_then2 ("eqn_leq", [eqn_leq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbC", [andbC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("uniq_leq_size", [uniq_leq_size]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("Us1", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("Es12", []))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))); + ((THENL_FIRST) ((THENL) (split_tac) [(move ["Hs2"]); ALL_TAC]) (((((use_arg_then2 ("uniq_leq_size", [uniq_leq_size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Es12", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac))); + ((((use_arg_then2 ("leq_size_uniq", [leq_size_uniq])) (disch_tac [])) THEN (clear_assumption "leq_size_uniq") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("Us1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Es12", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_size_perm *) +let leq_size_perm = Sections.section_proof ["s1";"s2"] +`uniq s1 ==> (!x. x <- s1 ==> x <- s2) ==> sizel s2 <= sizel s1 ==> + (!x. x <- s1 <=> x <- s2) /\ sizel s1 = sizel s2` +[ + ((BETA_TAC THEN (move ["Us1"]) THEN (move ["Hs1"]) THEN (move ["Hs12"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`uniq s2`))) (term_tac (have_gen_tac [](move ["Us2"]))))); + ((((fun arg_tac -> (use_arg_then2 ("leq_size_uniq", [leq_size_uniq])) (fun fst_arg -> (use_arg_then2 ("Us1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`!x. x <- s1 <=> x <- s2`))) (term_tac (have_gen_tac []ALL_TAC)))); + ((BETA_TAC THEN (move ["h"])) THEN ((split_tac) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("uniq_size_uniq", [uniq_size_uniq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (move ["x"])); + ((THENL) ((THENL) (split_tac) [ALL_TAC; (move ["Hxs2"])]) [((((use_arg_then2 ("Hs1", [])) (disch_tac [])) THEN (clear_assumption "Hs1") THEN (DISCH_THEN apply_tac)) THEN (done_tac)); (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x <- s1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN ((TRY done_tac)) THEN (move ["Hxs1"]))]); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`sizel (x :: s1) <= sizel s2`))) (term_tac (have_gen_tac []ALL_TAC)))); + (((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Hs12", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((((use_arg_then2 ("uniq_leq_size", [uniq_leq_size])) (disch_tac [])) THEN (clear_assumption "uniq_leq_size") THEN (DISCH_THEN apply_tac)) THEN ((THENL) (split_tac) [ALL_TAC; (move ["y"])])) ((((use_arg_then2 ("cons_uniq", [cons_uniq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] [])))) THEN ((THENL) case [((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); (move ["Hy"])]) THEN (((use_arg_then2 ("Hs1", [])) (disch_tac [])) THEN (clear_assumption "Hs1") THEN (exact_tac))); +];; + +(* Lemma perm_uniq *) +let perm_uniq = Sections.section_proof ["s1";"s2"] +`(!x. x <- s1 <=> x <- s2) ==> + sizel s1 = sizel s2 ==> uniq s1 = uniq s2` +[ + ((BETA_TAC THEN (move ["Es12"]) THEN (move ["Hs12"])) THEN ((split_tac) THEN (move ["Us"]))); + (((((fun arg_tac -> (use_arg_then2 ("uniq_size_uniq", [uniq_size_uniq])) (fun fst_arg -> (use_arg_then2 ("Us", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("Hs12", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((fun arg_tac -> (use_arg_then2 ("uniq_size_uniq", [uniq_size_uniq])) (fun fst_arg -> (use_arg_then2 ("Us", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("Hs12", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma perm_eq_uniq *) +let perm_eq_uniq = Sections.section_proof ["s1";"s2"] +`perm_eq s1 s2 ==> uniq s1 = uniq s2` +[ + (((THENL) ((BETA_TAC THEN (move ["eq_s12"])) THEN (((use_arg_then2 ("perm_uniq", [perm_uniq])) (disch_tac [])) THEN (clear_assumption "perm_uniq") THEN (DISCH_THEN apply_tac)) THEN (split_tac)) [(((use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (disch_tac [])) THEN (clear_assumption "perm_eq_mem") THEN (exact_tac)); (((use_arg_then2 ("perm_eq_size", [perm_eq_size])) (disch_tac [])) THEN (clear_assumption "perm_eq_size") THEN (exact_tac))]) THEN (done_tac)); +];; + +(* Lemma uniq_perm_eq *) +let uniq_perm_eq = Sections.section_proof ["s1";"s2"] +`uniq s1 ==> uniq s2 ==> + (!x. x <- s1 <=> x <- s2) ==> perm_eq s1 s2` +[ + ((BETA_TAC THEN (move ["Us1"]) THEN (move ["Us2"]) THEN (move ["eq12"])) THEN (((((use_arg_then2 ("perm_eq", [perm_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("same_count1", [same_count1]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["_"]))); + (((repeat_tactic 1 9 (((use_arg_then2 ("count_uniq_mem", [count_uniq_mem]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("eq12", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma count_mem_uniq *) +let count_mem_uniq = Sections.section_proof ["s"] +`(!x. count (pred1 x) s = if (x <- s) then 1 else 0) ==> uniq s` +[ + ((BETA_TAC THEN (move ["count1_s"])) THEN ((fun arg_tac -> (use_arg_then2 ("undup_uniq", [undup_uniq])) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["Uus"])))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`perm_eq s (undup s)`))) (term_tac (have_gen_tac []ALL_TAC)))) (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("perm_eq_uniq", [perm_eq_uniq])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("perm_eq", [perm_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("same_count1", [same_count1]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["_"])); + (((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("count_uniq_mem", [count_uniq_mem])) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("Uus", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_undup", [mem_undup]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section PermSeq *) +let perm_eqP = Sections.finalize_theorem perm_eqP;; +let perm_eq_refl = Sections.finalize_theorem perm_eq_refl;; +let perm_eq_sym = Sections.finalize_theorem perm_eq_sym;; +let perm_eq_trans = Sections.finalize_theorem perm_eq_trans;; +let perm_eqlP = Sections.finalize_theorem perm_eqlP;; +let perm_eqrP = Sections.finalize_theorem perm_eqrP;; +let perm_catC = Sections.finalize_theorem perm_catC;; +let perm_cat2l = Sections.finalize_theorem perm_cat2l;; +let perm_cons = Sections.finalize_theorem perm_cons;; +let perm_cat2r = Sections.finalize_theorem perm_cat2r;; +let perm_catAC = Sections.finalize_theorem perm_catAC;; +let perm_catCA = Sections.finalize_theorem perm_catCA;; +let perm_rcons = Sections.finalize_theorem perm_rcons;; +let perm_rot = Sections.finalize_theorem perm_rot;; +let perm_rotr = Sections.finalize_theorem perm_rotr;; +let perm_filterC = Sections.finalize_theorem perm_filterC;; +let perm_eq_mem = Sections.finalize_theorem perm_eq_mem;; +let perm_eq_size = Sections.finalize_theorem perm_eq_size;; +let uniq_leq_size = Sections.finalize_theorem uniq_leq_size;; +let leq_size_uniq = Sections.finalize_theorem leq_size_uniq;; +let uniq_size_uniq = Sections.finalize_theorem uniq_size_uniq;; +let leq_size_perm = Sections.finalize_theorem leq_size_perm;; +let perm_uniq = Sections.finalize_theorem perm_uniq;; +let perm_eq_uniq = Sections.finalize_theorem perm_eq_uniq;; +let uniq_perm_eq = Sections.finalize_theorem uniq_perm_eq;; +let count_mem_uniq = Sections.finalize_theorem count_mem_uniq;; +Sections.end_section "PermSeq";; + +(* Section RotrLemmas *) +Sections.begin_section "RotrLemmas";; +(Sections.add_section_var (mk_var ("n0", (`:num`))));; +(Sections.add_section_type (mk_var ("s", (`:(A)list`))));; + +(* Lemma size_rotr *) +let size_rotr = Sections.section_proof ["s"] +`sizel (rotr n0 s) = sizel s` +[ + (((((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_rotr *) +let mem_rotr = Sections.section_proof ["s"] +`!x. x <- rotr n0 s <=> x <- s` +[ + ((BETA_TAC THEN (move ["x"])) THEN ((((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_rot", [mem_rot]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rotr_size_cat *) +let rotr_size_cat = Sections.section_proof ["s1";"s2"] +`rotr (sizel s2) (s1 ++ s2) = s2 ++ s1` +[ + (((((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_cat", [size_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnK", [addnK]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot_size_cat", [rot_size_cat]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rotr1_rcons *) +let rotr1_rcons = Sections.section_proof ["x";"s"] +`rotr 1 (rcons s x) = x :: s` +[ + (((((use_arg_then2 ("rot1_cons", [rot1_cons]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rotK", [rotK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma has_rotr *) +let has_rotr = Sections.section_proof ["a";"s"] +`has a (rotr n0 s) = has a s` +[ + (((((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_rot", [has_rot]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rotr_uniq *) +let rotr_uniq = Sections.section_proof ["s"] +`uniq (rotr n0 s) = uniq s` +[ + (((((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot_uniq", [rot_uniq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rotrK *) +let rotrK = Sections.section_proof [] +`!s. rot n0 (rotr n0 s) = s` +[ + (BETA_TAC THEN (move ["s"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ltnP", [ltnP])) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sizel s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ((THENL) case [(move ["lt_n0s"]); (move ["ge_n0s"])]))); + (((((fun arg_tac -> (use_arg_then2 ("subKn", [subKn])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ltnW", [ltnW])) (fun fst_arg -> (use_arg_then2 ("lt_n0s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("size_rotr", [size_rotr]))(gsym_then (thm_tac (new_rewrite [1] [(`sizel s`)]))))) THEN (((use_arg_then2 ("rotr", [rotr]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] [(`rotr n0 _`)])))) THEN (((use_arg_then2 ("rotK", [rotK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("rot_oversize", [rot_oversize])) (fun fst_arg -> (use_arg_then2 ("ge_n0s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subn_eq0", [subn_eq0])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sizel s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("ge_n0s", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("rot0", [rot0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rotr_inj *) +let rotr_inj = Sections.section_proof ["s1";"s2"] +`rotr n0 (s1:(A)list) = rotr n0 s2 ==> s1 = s2` +[ + (BETA_TAC THEN (move ["h"])); + (((((use_arg_then2 ("rotrK", [rotrK]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rotrK", [rotrK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rev_rot *) +let rev_rot = Sections.section_proof ["s"] +`rev (rot n0 s) = rotr n0 (rev s)` +[ + ((((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rev", [size_rev]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("cat_take_drop", [cat_take_drop])) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [3] [(`s`)]))))) THEN (((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("rev_cat", [rev_cat]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("size_drop", [size_drop]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_rev", [size_rev]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rot_size_cat", [rot_size_cat]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rev_rotr *) +let rev_rotr = Sections.section_proof ["s"] +`rev (rotr n0 s) = rot n0 (rev s)` +[ + (((((use_arg_then2 ("rotrK", [rotrK]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rotrK", [rotrK]))(gsym_then (thm_tac (new_rewrite [] [(`rot n0 (rev s)`)])))))) THEN (AP_TERM_TAC) THEN (((use_arg_then2 ("rotK", [rotK]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rev", [size_rev]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rotr", [size_rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [(`rot _ s`)])))) THEN (((use_arg_then2 ("rev_cat", [rev_cat]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`sizel s - n0`))) (term_tac (set_tac "m"))); + ((THENL_ROT (-1)) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("size_takel", [size_takel])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] [])))))); + (((((use_arg_then2 ("size_rev", [size_rev]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rot_size_cat", [rot_size_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rev_cat", [rev_cat]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("cat_take_drop", [cat_take_drop]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("m_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leq_subr", [leq_subr]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section RotrLemmas *) +let size_rotr = Sections.finalize_theorem size_rotr;; +let mem_rotr = Sections.finalize_theorem mem_rotr;; +let rotr_size_cat = Sections.finalize_theorem rotr_size_cat;; +let rotr1_rcons = Sections.finalize_theorem rotr1_rcons;; +let has_rotr = Sections.finalize_theorem has_rotr;; +let rotr_uniq = Sections.finalize_theorem rotr_uniq;; +let rotrK = Sections.finalize_theorem rotrK;; +let rotr_inj = Sections.finalize_theorem rotr_inj;; +let rev_rot = Sections.finalize_theorem rev_rot;; +let rev_rotr = Sections.finalize_theorem rev_rotr;; +Sections.end_section "RotrLemmas";; + +(* Section RotCompLemmas *) +Sections.begin_section "RotCompLemmas";; +(Sections.add_section_type (mk_var ("s", (`:(A)list`))));; + +(* Lemma rot_addn *) +let rot_addn = Sections.section_proof ["m";"n";"s"] +`m + n <= sizel s ==> rot (m + n) s = rot m (rot n s)` +[ + ((BETA_TAC THEN (move ["sz_s"])) THEN ((((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("cat_take_drop", [cat_take_drop])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [(`take _ s`)]))))))); + ((((use_arg_then2 ("catA", [catA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot_size_cat", [rot_size_cat]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("catA", [catA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot_size_cat", [rot_size_cat]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("catA", [catA]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cat_take_drop", [cat_take_drop]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size_takel", [size_takel]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("leq_addl", [leq_addl]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("addnK", [addnK]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma rotS *) +let rotS = Sections.section_proof ["n";"s"] +`n < sizel s ==> rot (SUC n) s = rot 1 (rot n s)` +[ + ((((((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add1n", [add1n]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("rot_addn", [rot_addn])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Lemma rot_add_mod *) +let rot_add_mod = Sections.section_proof ["m";"n";"s"] +`n <= sizel s ==> m <= sizel s ==> + rot m (rot n s) = rot (if m + n <= sizel s then m + n else (m + n) - sizel s) s` +[ + ((THENL) ((BETA_TAC THEN (move ["Hn"]) THEN (move ["Hm"])) THEN (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m + n <= sizel s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac))) [((DISCH_THEN (fun snd_th -> (use_arg_then2 ("rot_addn", [rot_addn])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); BETA_TAC]); + (((((use_arg_then2 ("ltnNge", [ltnNge]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("ltnW", [ltnW])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["Hmn"])) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("rotK", [rotK])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] [(`s`)]))))) THEN (((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot_addn", [rot_addn]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addn_subA", [addn_subA]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("subnK", [subnK]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("addnK", [addnK]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma rot_rot *) +let rot_rot = Sections.section_proof ["m";"n";"s"] +`rot m (rot n s) = rot n (rot m s)` +[ + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ltnP", [ltnP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sizel s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["Hm"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("rot_oversize", [rot_oversize]))(thm_tac (new_rewrite [] [(`rot m _`)]))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ltnP", [ltnP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sizel s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["Hn"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("rot_oversize", [rot_oversize]))(thm_tac (new_rewrite [] [(`rot n _`)]))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then2 ("rot_add_mod", [rot_add_mod]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 1 (((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma rot_rotr *) +let rot_rotr = Sections.section_proof ["m";"n";"s"] +`rot m (rotr n s) = rotr n (rot m s)` +[ + (((((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] [(`rotr n (rot m s)`)])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot_rot", [rot_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rotr", [rotr]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma rotr_rotr *) +let rotr_rotr = Sections.section_proof ["m";"n";"s"] +`rotr m (rotr n s) = rotr n (rotr m s)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rot_rot", [rot_rot]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section RotCompLemmas *) +let rot_addn = Sections.finalize_theorem rot_addn;; +let rotS = Sections.finalize_theorem rotS;; +let rot_add_mod = Sections.finalize_theorem rot_add_mod;; +let rot_rot = Sections.finalize_theorem rot_rot;; +let rot_rotr = Sections.finalize_theorem rot_rotr;; +let rotr_rotr = Sections.finalize_theorem rotr_rotr;; +Sections.end_section "RotCompLemmas";; + +(* Section Mask *) +Sections.begin_section "Mask";; +(Sections.add_section_var (mk_var ("n0", (`:num`))));; +(Sections.add_section_type (mk_var ("m", (`:(bool)list`))));; +(Sections.add_section_type (mk_var ("s", (`:(A)list`))); Sections.add_section_type (mk_var ("s1", (`:(A)list`))));; +let mask = define `mask [] s' = [] /\ mask m' [] = [] /\ + mask (b :: m') (x :: s') = if b then x :: mask m' s' else mask m' s'`;; + +(* Lemma mask_false *) +let mask_false = Sections.section_proof ["s";"n"] +`mask (nseq n F) s = []` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("ncons", [ncons]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("nseq", [nseq]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))) THEN (done_tac)); +];; + +(* Lemma mask_true *) +let mask_true = Sections.section_proof ["s";"n"] +`sizel s <= n ==> mask (nseq n T) s = s` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((((((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ncons", [ncons]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nseq", [nseq]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHs", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mask0 *) +let mask0 = Sections.section_proof ["m"] +`mask m [] = []` +[ + (((THENL) (((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; ((move ["m"]) THEN (move ["_"]))]) THEN (((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma mask1 *) +let mask1 = Sections.section_proof ["b";"x"] +`mask [b] [x] = nseq (if b then 1 else 0) x` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN ((((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ONE", [ONE]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma mask_cons *) +let mask_cons = Sections.section_proof ["b";"m";"x";"s"] +`mask (b :: m) (x :: s) = nseq (if b then 1 else 0) x ++ mask m s` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN ((((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ONE", [ONE]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("cat1s", [cat1s]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("cat0s", [cat0s]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma size_mask *) +let size_mask = Sections.section_proof ["m";"s"] +`sizel m = sizel s ==> sizel (mask m s) = count I m` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN ((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; ((move ["b"]) THEN (move ["m"]) THEN (move ["IHm"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("count", [count]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("eqS0", [eqS0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eqSS", [eqSS]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + ((((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHm", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("add1n", [add1n]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mask_cat *) +let mask_cat = Sections.section_proof ["m1";"s1";"m2";"s2"] +`sizel m1 = sizel s1 ==> + mask (m1 ++ m2) (s1 ++ s2) = mask m1 s1 ++ mask m2 s2` +[ + (BETA_TAC THEN (move ["Hm1"])); + (((THENL) (((use_arg_then2 ("Hm1", [])) (disch_tac [])) THEN (clear_assumption "Hm1") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN ((use_arg_then2 ("m1", [])) (disch_tac [])) THEN (clear_assumption "m1") THEN elim) [ALL_TAC; ((move ["b1"]) THEN (move ["m1"]) THEN (move ["IHm"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["x1"]) THEN (move ["s1"]) THEN (move ["_"]))]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("mask0", [mask0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("cat0s", [cat0s]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [(`0 = _`)]))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("eqS0", [eqS0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((((((use_arg_then2 ("eqSS", [eqSS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cat_cons", [cat_cons]))(thm_tac (new_rewrite [] [])))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHm", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN ((((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("b1", [])) (disch_tac [])) THEN (clear_assumption "b1") THEN case THEN (simp_tac)) THEN (((use_arg_then2 ("cat_cons", [cat_cons]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma has_mask_cons *) +let has_mask_cons = Sections.section_proof ["a";"b";"m";"x";"s"] +`has a (mask (b :: m) (x :: s)) <=> b /\ a x \/ has a (mask m s)` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN ((((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("has", [has]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma mask_rot *) +let mask_rot = Sections.section_proof ["m";"s"] +`sizel m = sizel s ==> + mask (rot n0 m) (rot n0 s) = rot (count I (take n0 m)) (mask m s)` +[ + (BETA_TAC THEN (move ["Hs"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`sizel (take n0 m) = sizel (take n0 s)`))) (term_tac (have_gen_tac [](move ["Hsn0"])))) (((repeat_tactic 1 9 (((use_arg_then2 ("size_take", [size_take]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Hs", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("size_mask", [size_mask])) (fun fst_arg -> (use_arg_then2 ("Hsn0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 2 0 (((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mask_cat", [mask_cat]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("Hs", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("cat_take_drop", [cat_take_drop])) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [4] [(`m`)]))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("cat_take_drop", [cat_take_drop])) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [4] [(`s`)]))))) THEN (((use_arg_then2 ("mask_cat", [mask_cat]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("rot_size_cat", [rot_size_cat]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section Mask *) +let mask_false = Sections.finalize_theorem mask_false;; +let mask_true = Sections.finalize_theorem mask_true;; +let mask0 = Sections.finalize_theorem mask0;; +let mask1 = Sections.finalize_theorem mask1;; +let mask_cons = Sections.finalize_theorem mask_cons;; +let size_mask = Sections.finalize_theorem size_mask;; +let mask_cat = Sections.finalize_theorem mask_cat;; +let has_mask_cons = Sections.finalize_theorem has_mask_cons;; +let mask_rot = Sections.finalize_theorem mask_rot;; +Sections.end_section "Mask";; + +(* Section EqMask *) +Sections.begin_section "EqMask";; +(Sections.add_section_var (mk_var ("n0", (`:num`))));; +(Sections.add_section_type (mk_var ("s", (`:(A)list`))));; +(Sections.add_section_type (mk_var ("m", (`:(bool)list`))));; + +(* Lemma mem_mask_cons *) +let mem_mask_cons = Sections.section_proof ["x";"b";"m";"y";"s"] +`(x <- mask (b :: m) (y :: s)) <=> b /\ (x = y) \/ (x <- mask m s)` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN ((((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("in_cons", [in_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma mem_mask *) +let mem_mask = Sections.section_proof ["x";"m";"s"] +`x <- mask m s ==> x <- s` +[ + (((THENL) (((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["p"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["m"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("in_nil", [in_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_cons", [in_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))))); + ((((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN case THEN (simp_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_term (`x = y`))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["_"])) THEN (((use_arg_then2 ("IHs", [])) (disch_tac [])) THEN (clear_assumption "IHs") THEN (DISCH_THEN apply_tac)) THEN (done_tac)); +];; + +(* Lemma mask_uniq *) +let mask_uniq = Sections.section_proof ["s"] +`uniq s ==> !m. uniq (mask m s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN (((repeat_tactic 0 10 (((use_arg_then2 ("mask0", [mask0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("nil_uniq", [nil_uniq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("cons_uniq", [cons_uniq]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["Hx"]) THEN (move ["Hs"])))) THEN ((THENL) elim [ALL_TAC; ((move ["b"]) THEN (move ["m"]) THEN (move ["_"]))])); + (((((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("nil_uniq", [nil_uniq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN ((((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("uniq", [uniq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("IHs", [])) (fun fst_arg -> (use_arg_then2 ("Hs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)))); + ((((use_arg_then2 ("Hx", [])) (disch_tac [])) THEN (clear_assumption "Hx") THEN BETA_TAC) THEN (((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("mem_mask", [mem_mask])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Lemma mem_mask_rot *) +let mem_mask_rot = Sections.section_proof ["m";"s"] +`sizel m = sizel s ==> + (!x. x <- mask (rot n0 m) (rot n0 s) <=> x <- mask m s)` +[ + ((BETA_TAC THEN (move ["Hm"]) THEN (move ["x"])) THEN ((((use_arg_then2 ("mask_rot", [mask_rot]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mem_rot", [mem_rot]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section EqMask *) +let mem_mask_cons = Sections.finalize_theorem mem_mask_cons;; +let mem_mask = Sections.finalize_theorem mem_mask;; +let mask_uniq = Sections.finalize_theorem mask_uniq;; +let mem_mask_rot = Sections.finalize_theorem mem_mask_rot;; +Sections.end_section "EqMask";; + +(* Section Subseq *) +Sections.begin_section "Subseq";; +(Sections.add_section_type (mk_var ("s", (`:(A)list`))); Sections.add_section_type (mk_var ("s1", (`:(A)list`))));; +let subseq = define `subseq (x :: s1) (y :: s2) = subseq (if x = y then s1 else x :: s1) s2 /\ + subseq [] s2 = T /\ subseq (x :: s1) [] = F`;; + +(* Lemma sub0seq *) +let sub0seq = Sections.section_proof ["s"] +`subseq [] s` +[ + ((((use_arg_then2 ("subseq", [subseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma subseq0 *) +let subseq0 = Sections.section_proof ["s"] +`subseq s [] = (s = [])` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("subseq", [subseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("NOT_CONS_NIL", [NOT_CONS_NIL]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))) THEN (done_tac)); +];; + +(* Lemma subseqP *) +let subseqP = Sections.section_proof ["s1";"s2"] +`subseq s1 s2 <=> (?m. sizel m = sizel s2 /\ s1 = mask m s2)` +[ + (((THENL) (((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN ((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s2"]) THEN (move ["IHs2"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["x"]) THEN (move ["s1"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("subseq", [subseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`[]:(bool)list`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac)); + (((((use_arg_then2 ("NOT_EXISTS_THM", [NOT_EXISTS_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mask0", [mask0]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("NOT_CONS_NIL", [NOT_CONS_NIL]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`nseq (SUC (sizel s2)) F`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("size_nseq", [size_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mask_false", [mask_false]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("IHs2", []))(thm_tac (new_rewrite [] [])))) THEN ((split_tac) THEN ALL_TAC THEN (case THEN (move ["n"])) THEN (case THEN ((move ["sz_m"]) THEN (move ["def_s1"])))) THEN (((use_arg_then2 ("IHs2", [])) (disch_tac [])) THEN (clear_assumption "IHs2") THEN BETA_TAC THEN (move ["_"]))); + (((fun arg_tac -> arg_tac (Arg_term (`(x = y) :: n`))) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("sz_m", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((((use_arg_then2 ("def_s1", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x = y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac)) THEN (done_tac)); + ((THENL_ROT (-1)) ((THENL) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x = y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac)) [(BETA_TAC THEN (move ["_"])); (BETA_TAC THEN (move ["ne_xy"]))])); + (((THENL) (((use_arg_then2 ("sz_m", [])) (disch_tac [])) THEN (clear_assumption "sz_m") THEN ((use_arg_then2 ("def_s1", [])) (disch_tac [])) THEN (clear_assumption "def_s1") THEN ((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN case) [ALL_TAC; ((case THEN ALL_TAC) THEN (move ["m"]))]) THEN (((((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("NOT_CONS_NIL", [NOT_CONS_NIL]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("eqSS", [eqSS]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (move ["eq"]) THEN (move ["seq"]))); + ((((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN ((((use_arg_then2 ("eqseq_cons", [eqseq_cons]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (done_tac)); + (((use_arg_then2 ("m", [])) (term_tac exists_tac)) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`indexl T n`))) (term_tac (set_tac "i"))); + ((fun arg_tac -> arg_tac (Arg_term (`take i n = nseq (sizel (take i n)) F`))) (term_tac (have_gen_tac [](move ["def_m_i"])))); + (((((use_arg_then2 ("all_pred1P", [all_pred1P]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("all_nthP", [all_nthP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`pred1 F`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`take i n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`T`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["j"])); + (((((use_arg_then2 ("size_take", [size_take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("minn", [minn]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leq_minl", [leq_minl]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltnNge", [ltnNge]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (case THEN (move ["lt_j_i"]) THEN (move ["_"]))); + ((((fun arg_tac -> (use_arg_then2 ("nth_take", [nth_take])) (fun fst_arg -> (use_arg_then2 ("lt_j_i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lt_j_i", [])) (disch_tac [])) THEN (clear_assumption "lt_j_i") THEN BETA_TAC) THEN (((((use_arg_then2 ("i_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index", [index]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("before_find", [before_find])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`T`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)))); + (((repeat_tactic 1 9 (((use_arg_then2 ("pred1", [pred1]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`i < sizel n`))) (term_tac (have_gen_tac [](move ["lt_i_m"])))); + ((((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] [])))) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (TAUT `!P. (P ==> F) <=> ~P`)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["le_m_i"]))); + ((((use_arg_then2 ("def_s1", [])) (disch_tac [])) THEN (clear_assumption "def_s1") THEN ((use_arg_then2 ("def_m_i", [])) (disch_tac [])) THEN (clear_assumption "def_m_i") THEN BETA_TAC) THEN (((((use_arg_then2 ("take_oversize", [take_oversize]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mask_false", [mask_false]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("NOT_CONS_NIL", [NOT_CONS_NIL]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); + ((((use_arg_then2 ("def_m_i", [])) (disch_tac [])) THEN (clear_assumption "def_m_i") THEN BETA_TAC) THEN (((((use_arg_then2 ("size_take", [size_take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lt_i_m", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["def_m_i"]))); + (((fun arg_tac -> arg_tac (Arg_term (`take i n ++ dropl (SUC i) n`))) (term_tac exists_tac)) THEN (split_tac)); + ((((use_arg_then2 ("size_cat", [size_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_take", [size_take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lt_i_m", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("lt_i_m", [])) (disch_tac [])) THEN (clear_assumption "lt_i_m") THEN BETA_TAC) THEN (((((use_arg_then2 ("sz_m", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("subnKC", [subnKC])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN ((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addSn", [addSn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqSS", [eqSS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("congr1", [congr1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`behead`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("def_s1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("behead", [behead]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("cat_take_drop", [cat_take_drop])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [(`s2`)]))))) THEN (((fun arg_tac -> (use_arg_then2 ("cat_take_drop", [cat_take_drop])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] [(`n`)]))))) THEN (((use_arg_then2 ("def_m_i", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat_cons", [cat_cons]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`sizel (take i s2) = i`))) (term_tac (have_gen_tac [](move ["sz_i_s2"])))); + ((((use_arg_then2 ("size_takel", [size_takel])) (disch_tac [])) THEN (clear_assumption "size_takel") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("lt_i_m", [])) (disch_tac [])) THEN (clear_assumption "lt_i_m") THEN BETA_TAC) THEN ((((use_arg_then2 ("sz_m", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("lastI", [lastI]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat_rcons", [cat_rcons]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mask_cat", [mask_cat]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_nseq", [size_nseq]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_belast", [size_belast]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mask_false", [mask_false]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cat0s", [cat0s]))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("drop_nth", [drop_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`T`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("i_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("nth_index", [nth_index]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("index_mem", [index_mem]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_def", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("behead", [behead]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma subseq_trans *) +let subseq_trans = Sections.section_proof ["s1";"s2";"s3"] +`subseq s1 s2 ==> subseq s2 s3 ==> subseq s1 s3` +[ + (((((use_arg_then2 ("subseqP", [subseqP]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["m2"])) THEN (case THEN ((move ["_"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN ((((use_arg_then2 ("subseqP", [subseqP]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["m1"])) THEN (case THEN ((move ["_"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("m1", [])) (disch_tac [])) THEN (clear_assumption "m1") THEN ((use_arg_then2 ("m2", [])) (disch_tac [])) THEN (clear_assumption "m2") THEN ((use_arg_then2 ("s3", [])) (disch_tac [])) THEN (clear_assumption "s3") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) (((repeat_tactic 1 9 (((use_arg_then2 ("mask0", [mask0]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("subseq0", [subseq0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (BETA_TAC THEN (move ["m2"]) THEN (move ["m1"])); + (((THENL) (((use_arg_then2 ("m1", [])) (disch_tac [])) THEN (clear_assumption "m1") THEN case) [ALL_TAC; ((case THEN ALL_TAC) THEN (move ["m1"]))]) THEN ((((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("mask0", [mask0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("subseq", [subseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((THENL) (((use_arg_then2 ("m2", [])) (disch_tac [])) THEN (clear_assumption "m2") THEN case) [ALL_TAC; ((case THEN ALL_TAC) THEN (move ["m2"]))]) THEN ((((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("subseq", [subseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("IHs", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("IHs", [])) (fun fst_arg -> (use_arg_then2 ("m2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("m1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("subseqP", [subseqP]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["m"])) THEN (case THEN ((move ["sz_m"]) THEN (move ["def_s"]))))); + (((fun arg_tac -> arg_tac (Arg_term (`F :: m`))) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("sz_m", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("def_s", []))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac)); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("IHs", [])) (fun fst_arg -> (use_arg_then2 ("m2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("m1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("subseqP", [subseqP]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["m"])) THEN (case THEN ((move ["sz_m"]) THEN (move ["def_s"]))))); + (((fun arg_tac -> arg_tac (Arg_term (`F :: m`))) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("sz_m", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("def_s", []))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma subseq_refl *) +let subseq_refl = Sections.section_proof ["s"] +`subseq s s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("subseq", [subseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma subseq_cat *) +let subseq_cat = Sections.section_proof ["s1";"s2";"s3";"s4"] +`subseq s1 s3 ==> subseq s2 s4 ==> subseq (s1 ++ s2) (s3 ++ s4)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("subseqP", [subseqP]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["m1"])) THEN (case THEN ((move ["sz_m1"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (case THEN (move ["m2"])) THEN (case THEN ((move ["sz_m2"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((fun arg_tac -> arg_tac (Arg_term (`m1 ++ m2`))) (term_tac exists_tac)) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("size_cat", [size_cat]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mask_cat", [mask_cat]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sz_m1", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sz_m2", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma mem_subseq *) +let mem_subseq = Sections.section_proof ["s1";"s2"] +`subseq s1 s2 ==> (!x. x <- s1 ==> x <- s2)` +[ + (((((use_arg_then2 ("subseqP", [subseqP]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["m"])) THEN (case THEN ((move ["_"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["x"])) THEN (((use_arg_then2 ("mem_mask", [mem_mask])) (disch_tac [])) THEN (clear_assumption "mem_mask") THEN (DISCH_THEN apply_tac)) THEN (done_tac)); +];; + +(* Lemma subseq_seq1 *) +let subseq_seq1 = Sections.section_proof ["x";"s"] +`subseq [x] s <=> x <- s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("subseq", [subseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("MEM", [MEM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))))); + ((((fun arg_tac -> (use_arg_then2 ("orbN", [orbN])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x = y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac)) THEN ((((use_arg_then2 ("subseq", [subseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma size_subseq *) +let size_subseq = Sections.section_proof ["s1";"s2"] +`subseq s1 s2 ==> sizel s1 <= sizel s2` +[ + ((((use_arg_then2 ("subseqP", [subseqP]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["m"])) THEN (case THEN ((move ["sz_m"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("size_mask", [size_mask]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sz_m", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("count_size", [count_size]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma size_subseq_leqif *) +let size_subseq_leqif = Sections.section_proof ["s1";"s2"] +`subseq s1 s2 ==> leqif (sizel s1) (sizel s2) (s1 = s2)` +[ + ((THENL_FIRST) ((BETA_TAC THEN (move ["sub12"])) THEN (((use_arg_then2 ("leqif", [leqif]))(thm_tac (new_rewrite [] [])))) THEN (split_tac)) (((use_arg_then2 ("size_subseq", [size_subseq])) (disch_tac [])) THEN (clear_assumption "size_subseq") THEN (exact_tac))); + (((THENL) (split_tac) [ALL_TAC; ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))]) THEN (((use_arg_then2 ("sub12", [])) (disch_tac [])) THEN (clear_assumption "sub12") THEN BETA_TAC) THEN ((((use_arg_then2 ("subseqP", [subseqP]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["m"])) THEN (case THEN ((move ["sz_m"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + ((((use_arg_then2 ("size_mask", [size_mask]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sz_m", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("all_count", [all_count]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`all I m = all (pred1 T) m`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("eq_all", [eq_all])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`I:bool->bool`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`pred1 T`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((((use_arg_then2 ("pred1", [pred1]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); + (((((use_arg_then2 ("all_pred1P", [all_pred1P]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("sz_m", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mask_true", [mask_true]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma subseq_cons *) +let subseq_cons = Sections.section_proof ["s";"x"] +`subseq s (x :: s)` +[ + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("subseq_cat", [subseq_cat])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`[]`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`[x]`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((((use_arg_then2 ("subseq_refl", [subseq_refl]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat0s", [cat0s]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat1s", [cat1s]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("subseq", [subseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma subseq_rcons *) +let subseq_rcons = Sections.section_proof ["s";"x"] +`subseq s (rcons s x)` +[ + (((((use_arg_then2 ("cats0", [cats0]))(gsym_then (thm_tac (new_rewrite [1] [(`s`)]))))) THEN (((use_arg_then2 ("cats1", [cats1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("subseq_cat", [subseq_cat]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("subseq", [subseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("subseq_refl", [subseq_refl]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))) THEN (done_tac)); +];; + +(* Lemma subseq_uniq *) +let subseq_uniq = Sections.section_proof ["s1";"s2"] +`subseq s1 s2 ==> uniq s2 ==> uniq s1` +[ + (((((use_arg_then2 ("subseqP", [subseqP]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["m"])) THEN (case THEN ((move ["_"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["Us2"])) THEN (((use_arg_then2 ("mask_uniq", [mask_uniq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section Subseq *) +let sub0seq = Sections.finalize_theorem sub0seq;; +let subseq0 = Sections.finalize_theorem subseq0;; +let subseqP = Sections.finalize_theorem subseqP;; +let subseq_trans = Sections.finalize_theorem subseq_trans;; +let subseq_refl = Sections.finalize_theorem subseq_refl;; +let subseq_cat = Sections.finalize_theorem subseq_cat;; +let mem_subseq = Sections.finalize_theorem mem_subseq;; +let subseq_seq1 = Sections.finalize_theorem subseq_seq1;; +let size_subseq = Sections.finalize_theorem size_subseq;; +let size_subseq_leqif = Sections.finalize_theorem size_subseq_leqif;; +let subseq_cons = Sections.finalize_theorem subseq_cons;; +let subseq_rcons = Sections.finalize_theorem subseq_rcons;; +let subseq_uniq = Sections.finalize_theorem subseq_uniq;; +Sections.end_section "Subseq";; + +(* Section Map *) +Sections.begin_section "Map";; +(Sections.add_section_var (mk_var ("n0", (`:num`))));; +(Sections.add_section_var (mk_var ("x1", (`:A`))));; +(Sections.add_section_var (mk_var ("x2", (`:B`))));; +(Sections.add_section_var (mk_var ("f", (`:A -> B`))));; +let map = define `map f (x :: s) = f x :: map f s /\ map f [] = []`;; + +(* Lemma map_MAP *) +let map_MAP = Sections.section_proof [] +`map = MAP` +[ + ((((use_arg_then2 ("EQ_EXT", [EQ_EXT])) (thm_tac apply_tac)) THEN (move ["f"])) THEN (((use_arg_then2 ("EQ_EXT", [EQ_EXT])) (thm_tac apply_tac)) THEN (move ["s"]))); + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("MAP", [MAP]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma map_cons *) +let map_cons = Sections.section_proof ["x";"s"] +`map f (x :: s) = f x :: map f s` +[ + ((((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma map_nseq *) +let map_nseq = Sections.section_proof ["x"] +`map f (nseq n0 x) = nseq n0 (f x)` +[ + (((THENL) (((use_arg_then2 ("n0", [])) (disch_tac [])) THEN (clear_assumption "n0") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ncons", [ncons]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("nseq", [nseq]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))))); + ((((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma map_cat *) +let map_cat = Sections.section_proof ["s1";"s2"] +`map f (s1 ++ s2) = map f s1 ++ map f s2` +[ + (((THENL) (((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s1"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))) THEN (done_tac)); +];; + +(* Lemma size_map *) +let size_map = Sections.section_proof ["s"] +`sizel (map f s) = sizel s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + ((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma behead_map *) +let behead_map = Sections.section_proof ["s"] +`behead (map f s) = map f (behead s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("behead", [behead]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma nth_map *) +let nth_map = Sections.section_proof ["n";"s"] +`n < sizel s ==> nth x2 (map f s) n = f (nth x1 s n)` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltS0", [ltS0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHs", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Lemma map_rcons *) +let map_rcons = Sections.section_proof ["s";"x"] +`map f (rcons s x) = rcons (map f s) (f x)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("cats1", [cats1]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("map_cat", [map_cat]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma last_map *) +let last_map = Sections.section_proof ["s";"x"] +`last (f x) (map f s) = f (last x s)` +[ + (((THENL) (((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("last", [last]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma belast_map *) +let belast_map = Sections.section_proof ["s";"x"] +`belast (f x) (map f s) = map f (belast x s)` +[ + (((THENL) (((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["IHs"]) THEN (move ["x"]))]) THEN ((((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("belast", [belast]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))) THEN (done_tac)); +];; +let preim = new_definition `preim (f:A->B) (a:B->bool) = (\x. a (f x))`;; + +(* Lemma filter_map *) +let filter_map = Sections.section_proof ["a";"s"] +`filter a (map f s) = map f (filter (preim f a) s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("filter", [filter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("filter", [filter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("preim", [preim]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`a (f x)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["_"])) THEN (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma find_map *) +let find_map = Sections.section_proof ["a";"s"] +`find a (map f s) = find (preim f a) s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("find", [find]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("preim", [preim]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma has_map *) +let has_map = Sections.section_proof ["a";"s"] +`has a (map f s) = has (preim f a) s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("has", [has]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("preim", [preim]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma all_map *) +let all_map = Sections.section_proof ["a";"s"] +`all a (map f s) = all (preim f a) s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("all", [all]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("preim", [preim]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma count_map *) +let count_map = Sections.section_proof ["a";"s"] +`count a (map f s) = count (preim f a) s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("count", [count]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("preim", [preim]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma map_take *) +let map_take = Sections.section_proof ["s"] +`map f (take n0 s) = take n0 (map f s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN ((use_arg_then2 ("n0", [])) (disch_tac [])) THEN (clear_assumption "n0") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("take", [take]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("take", [take]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma map_drop *) +let map_drop = Sections.section_proof ["s"] +`map f (dropl n0 s) = dropl n0 (map f s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN ((use_arg_then2 ("n0", [])) (disch_tac [])) THEN (clear_assumption "n0") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("drop", [drop]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("drop", [drop]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma map_rot *) +let map_rot = Sections.section_proof ["s"] +`map f (rot n0 s) = rot n0 (map f s)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("map_cat", [map_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("map_take", [map_take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("map_drop", [map_drop]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma map_rotr *) +let map_rotr = Sections.section_proof ["s"] +`map f (rotr n0 s) = rotr n0 (map f s)` +[ + (((fun arg_tac -> (use_arg_then2 ("rot_inj", [rot_inj])) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("rotrK", [rotrK]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("map_rot", [map_rot]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("rotrK", [rotrK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma map_rev *) +let map_rev = Sections.section_proof ["s"] +`map f (rev s) = rev (map f s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("rev_cons", [rev_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("map_rcons", [map_rcons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("rev", [rev]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("catrev", [catrev]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma map_mask *) +let map_mask = Sections.section_proof ["m";"s"] +`map f (mask m s) = mask m (map f s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN ((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; ((case THEN ALL_TAC) THEN (move ["m"]) THEN (move ["IHm"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["x"]) THEN (move ["p"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("map_cons", [map_cons]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("IHm", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma inj_map *) +let inj_map = Sections.section_proof [] +`(!x y. f x = f y ==> x = y) ==> (!s1 s2. map f s1 = map f s2 ==> s1 = s2)` +[ + ((BETA_TAC THEN (move ["injf"])) THEN ((THENL) elim [ALL_TAC; ((move ["y1"]) THEN (move ["s1"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["y2"]) THEN (move ["s2"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [(`[] = CONS _1 _2`)]))))) THEN ((((use_arg_then2 ("NOT_CONS_NIL", [NOT_CONS_NIL]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("eqseq_cons", [eqseq_cons]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("injf", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHs", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac)); +];; + +(* Finalization of the section Map *) +let map_MAP = Sections.finalize_theorem map_MAP;; +let map_cons = Sections.finalize_theorem map_cons;; +let map_nseq = Sections.finalize_theorem map_nseq;; +let map_cat = Sections.finalize_theorem map_cat;; +let size_map = Sections.finalize_theorem size_map;; +let behead_map = Sections.finalize_theorem behead_map;; +let nth_map = Sections.finalize_theorem nth_map;; +let map_rcons = Sections.finalize_theorem map_rcons;; +let last_map = Sections.finalize_theorem last_map;; +let belast_map = Sections.finalize_theorem belast_map;; +let filter_map = Sections.finalize_theorem filter_map;; +let find_map = Sections.finalize_theorem find_map;; +let has_map = Sections.finalize_theorem has_map;; +let all_map = Sections.finalize_theorem all_map;; +let count_map = Sections.finalize_theorem count_map;; +let map_take = Sections.finalize_theorem map_take;; +let map_drop = Sections.finalize_theorem map_drop;; +let map_rot = Sections.finalize_theorem map_rot;; +let map_rotr = Sections.finalize_theorem map_rotr;; +let map_rev = Sections.finalize_theorem map_rev;; +let map_mask = Sections.finalize_theorem map_mask;; +let inj_map = Sections.finalize_theorem inj_map;; +Sections.end_section "Map";; + +(* Lemma filter_mask *) +let filter_mask = Sections.section_proof ["a";"s"] +`filter (a:A->bool) s = mask (map a s) s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("filter", [filter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`a x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac)) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN ((((use_arg_then2 ("mask", [mask]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Section FilterSubseq *) +Sections.begin_section "FilterSubseq";; +(Sections.add_section_type (mk_var ("s", (`:(A)list`))); Sections.add_section_type (mk_var ("s1", (`:(A)list`))));; +(Sections.add_section_type (mk_var ("a", (`:A -> bool`))));; + +(* Lemma filter_subseq *) +let filter_subseq = Sections.section_proof ["a";"s"] +`subseq (filter a s) s` +[ + ((((use_arg_then2 ("subseqP", [subseqP]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`map a s`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("size_map", [size_map]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("filter_mask", [filter_mask]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma subseq_filter *) +let subseq_filter = Sections.section_proof ["s1";"s2";"a"] +`subseq s1 (filter a s2) <=> all a s1 /\ subseq s1 s2` +[ + (((THENL) (((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN ((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s2"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["y"]) THEN (move ["s1"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("filter", [filter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("subseq", [subseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("all", [all]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac)))); + ((((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`a x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["ax"])) THEN (((use_arg_then2 ("subseq", [subseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y = x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["yx"])) THEN ((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("all_cons", [all_cons]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma subseq_uniqP *) +let subseq_uniqP = Sections.section_proof ["s1";"s2"] +`uniq s2 ==> (subseq s1 s2 <=> s1 = filter (\x. x <- s1) s2)` +[ + ((THENL_LAST) ((BETA_TAC THEN (move ["uniq_s2"])) THEN ((THENL) (split_tac) [(move ["ss12"]); (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))])) ((((use_arg_then2 ("filter_subseq", [filter_subseq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`subseq s1 (filter (\x. x <- s1) s2)`))) (term_tac (have_gen_tac []ALL_TAC))); + (((((use_arg_then2 ("subseq_filter", [subseq_filter]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("size_subseq_leqif", [size_subseq_leqif])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("leqif_imp_eq", [leqif_imp_eq])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_eq_size", [perm_eq_size])) (disch_tac [])) THEN (clear_assumption "perm_eq_size") THEN (DISCH_THEN apply_tac))); + ((((use_arg_then2 ("uniq_perm_eq", [uniq_perm_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("filter_uniq", [filter_uniq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("subseq_uniq", [subseq_uniq])) (fun fst_arg -> (use_arg_then2 ("ss12", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"])) THEN ((((use_arg_then2 ("andb_idr", [andb_idr]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((fun arg_tac -> (use_arg_then2 ("mem_subseq", [mem_subseq])) (fun fst_arg -> (use_arg_then2 ("ss12", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (done_tac)); +];; + +(* Finalization of the section FilterSubseq *) +let filter_subseq = Sections.finalize_theorem filter_subseq;; +let subseq_filter = Sections.finalize_theorem subseq_filter;; +let subseq_uniqP = Sections.finalize_theorem subseq_uniqP;; +Sections.end_section "FilterSubseq";; + +(* Section EqMap *) +Sections.begin_section "EqMap";; +(Sections.add_section_var (mk_var ("n0", (`:num`))));; +(Sections.add_section_var (mk_var ("x1", (`:A`))));; +(Sections.add_section_var (mk_var ("x2", (`:B`))));; +(Sections.add_section_var (mk_var ("f", (`:A -> B`))));; +(Sections.add_section_type (mk_var ("s", (`:(A)list`))));; + +(* Lemma map_f *) +let map_f = Sections.section_proof ["s";"x"] +`x <- s ==> f x <- map f s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("in_nil", [in_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("in_cons", [in_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((THENL) case [((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); (move ["Hx"])]) THEN (DISJ2_TAC) THEN (((use_arg_then2 ("IHs", [])) (disch_tac [])) THEN (clear_assumption "IHs") THEN (DISCH_THEN apply_tac)) THEN (done_tac)); +];; + +(* Lemma mapP *) +let mapP = Sections.section_proof ["s";"y"] +`(y <- map f s) <=> (?x. x <- s /\ y = f x)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("in_nil", [in_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("andFb", [andFb]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + (((((use_arg_then2 ("NOT_EXISTS_THM", [NOT_EXISTS_THM]))(thm_tac (new_rewrite [] [])))) THEN (move ["x"])) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y = f x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["Hxy"]))); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); + ((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN ((THENL) (split_tac) [(case THEN ((move ["x'"]) THEN (case THEN ((move ["Hx'"]) THEN (move ["eq"]))))); (case THEN ((move ["x'"]) THEN (case THEN ((move ["Hx'"]) THEN (move ["Dy"])))))])); + (((use_arg_then2 ("x'", [])) (term_tac exists_tac)) THEN (done_tac)); + ((THENL) (((use_arg_then2 ("Hx'", [])) (disch_tac [])) THEN (clear_assumption "Hx'") THEN case THEN (move ["Hx'"])) [BETA_TAC; (((use_arg_then2 ("x'", [])) (term_tac exists_tac)) THEN ((TRY done_tac)))]); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("Hxy", [])) (disch_tac [])) THEN (clear_assumption "Hxy") THEN BETA_TAC) THEN ((((use_arg_then2 ("Dy", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Hx'", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma map_uniq *) +let map_uniq = Sections.section_proof ["s"] +`uniq (map f s) ==> uniq s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN (((((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("uniq", [uniq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))) THEN ALL_TAC THEN (case THEN (move ["not_sfx"])))); + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHs", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("not_sfx", [])) (disch_tac [])) THEN (clear_assumption "not_sfx") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (move ["sx"])) THEN (((use_arg_then2 ("mapP", [mapP]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma map_inj_in_uniq *) +let map_inj_in_uniq = Sections.section_proof ["s"] +`(!x y. x <- s ==> y <- s ==> (f x = f y ==> x = y)) ==> + uniq (map f s) = uniq s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN (((((use_arg_then2 ("in_nil", [in_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("uniq", [uniq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))) THEN (move ["injf"]))); + (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))); + (BETA_TAC THEN (move ["a"]) THEN (move ["b"]) THEN (case THEN ((case THEN ((move ["Ha"]) THEN (move ["Hb"]))) THEN (move ["fab"])))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("injf", [])) (fun fst_arg -> (use_arg_then2 ("a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Ha", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Hb", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fab", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((congr_tac (`_ /\ _`)) THEN ((TRY done_tac))); + (((((use_arg_then2 ("mapP", [mapP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_EXISTS_THM", [NOT_EXISTS_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC THEN (simp_tac)) THEN (done_tac)); + (BETA_TAC THEN (move ["Hx"]) THEN (move ["y"])); + (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y <- s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["Hy"])); + ((((fun arg_tac -> arg_tac (Arg_theorem (TAUT `~A <=> (A ==> F)`)))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (move ["fxy"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("injf", [])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Hy", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fxy", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x = y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN ((TRY done_tac)) THEN (move ["xy"])); + ((((use_arg_then2 ("Hx", [])) (disch_tac [])) THEN (clear_assumption "Hx") THEN ((use_arg_then2 ("Hy", [])) (disch_tac [])) THEN (clear_assumption "Hy") THEN BETA_TAC) THEN (((use_arg_then2 ("xy", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma map_subseq *) +let map_subseq = Sections.section_proof ["s1";"s2"] +`subseq s1 s2 ==> subseq (map f s1) (map f s2)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("subseqP", [subseqP]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["m"])) THEN (case THEN ((move ["sz_m"]) THEN (move ["eq"])))); + (((use_arg_then2 ("m", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_map", [size_map]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("map_mask", [map_mask]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section EqMap *) +let map_f = Sections.finalize_theorem map_f;; +let mapP = Sections.finalize_theorem mapP;; +let map_uniq = Sections.finalize_theorem map_uniq;; +let map_inj_in_uniq = Sections.finalize_theorem map_inj_in_uniq;; +let map_subseq = Sections.finalize_theorem map_subseq;; +Sections.end_section "EqMap";; + +(* Section EqMap2 *) +Sections.begin_section "EqMap2";; +(Sections.add_section_var (mk_var ("n0", (`:num`))));; +(Sections.add_section_var (mk_var ("x1", (`:A`))));; +(Sections.add_section_var (mk_var ("x2", (`:B`))));; +(Sections.add_section_var (mk_var ("f", (`:A -> B`))));; +(Sections.add_section_type (mk_var ("s", (`:(A)list`))));; +(Sections.add_section_hyp "Hf" (`!x y. f x = f y ==> x = y`));; + +(* Lemma inj_eq *) +let inj_eq = Sections.section_proof ["x";"y"] +`(f x = f y <=> x = y)` +[ + (((THENL) (split_tac) [(DISCH_THEN (fun snd_th -> (use_arg_then2 ("Hf", [])) (thm_tac (match_mp_then snd_th MP_TAC)))); (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))]) THEN (done_tac)); +];; + +(* Lemma mem_map *) +let mem_map = Sections.section_proof ["s";"x"] +`(f x <- map f s) = (x <- s)` +[ + ((((use_arg_then2 ("mapP", [mapP]))(thm_tac (new_rewrite [] [])))) THEN ((THENL) (split_tac) [((case THEN ((move ["y"]) THEN (case THEN ((move ["Hy"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("Hf", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) THEN ((TRY done_tac))); (move ["Hx"])]) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma index_map *) +let index_map = Sections.section_proof ["s";"x"] +`indexl (f x) (map f s) = indexl x s` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("index", [index]))(thm_tac (new_rewrite [] []))))) THEN ((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("find", [find]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("pred1", [pred1]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac))); + (((((use_arg_then2 ("inj_eq", [inj_eq]))(gsym_then (thm_tac (new_rewrite [] [(`y = x`)]))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("pred1", [pred1]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma map_inj_uniq *) +let map_inj_uniq = Sections.section_proof ["s"] +`uniq (map f s) = uniq s` +[ + ((((use_arg_then2 ("map_inj_in_uniq", [map_inj_in_uniq])) (disch_tac [])) THEN (clear_assumption "map_inj_in_uniq") THEN (DISCH_THEN apply_tac) THEN (move ["x"]) THEN (move ["y"]) THEN (move ["_"]) THEN (move ["_"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("Hf", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Finalization of the section EqMap2 *) +let inj_eq = Sections.finalize_theorem inj_eq;; +let mem_map = Sections.finalize_theorem mem_map;; +let index_map = Sections.finalize_theorem index_map;; +let map_inj_uniq = Sections.finalize_theorem map_inj_uniq;; +Sections.end_section "EqMap2";; + +(* Section MapComp *) +Sections.begin_section "MapComp";; + +(* Lemma map_id *) +let map_id = Sections.section_proof ["s"] +`map I (s:(A)list) = s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("I_THM", [I_THM]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma eq_map *) +let eq_map = Sections.section_proof ["f1";"f2"] +`(!x. (f1:A->B) x = f2 x) ==> map f1 = map f2` +[ + (((((use_arg_then2 ("eq_ext", [eq_ext]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma map_comp *) +let map_comp = Sections.section_proof ["f1";"f2";"s"] +`map (f1 o f2) s = map (f1:B->C) (map (f2:A->B) s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN (repeat_tactic 1 9 (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + (((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mapK *) +let mapK = Sections.section_proof ["f1";"f2"] +`(!x. (f2:B->A) ((f1:A->B) x) = x) ==> (!s. map f2 (map f1 s) = s)` +[ + ((BETA_TAC THEN (move ["eq_f12"])) THEN ((THENL) elim [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN (repeat_tactic 1 9 (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Finalization of the section MapComp *) +let map_id = Sections.finalize_theorem map_id;; +let eq_map = Sections.finalize_theorem eq_map;; +let map_comp = Sections.finalize_theorem map_comp;; +let mapK = Sections.finalize_theorem mapK;; +Sections.end_section "MapComp";; + +(* Lemma eq_in_map *) +let eq_in_map = Sections.section_proof ["f1";"f2";"s"] +`(!x. x <- s ==> (f1:A->B) x = f2 x) ==> map f1 s = map f2 s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]) THEN (move ["eqf12"]))]) THEN ((((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("eqf12", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["y"]) THEN (move ["sy"])); + (((((use_arg_then2 ("eqf12", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma map_id_in *) +let map_id_in = Sections.section_proof ["f";"s"] +`(!x. x <- s ==> f x = (x:A)) ==> map f s = s` +[ + ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("eq_in_map", [eq_in_map])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("map_id", [map_id]))(gsym_then (thm_tac (new_rewrite [2] [(`s`)]))))); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("eq_map", [eq_map])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(\x. x)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`I`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +let iota = define `iota m (SUC n) = m :: iota (SUC m) n /\ iota m 0 = []`;; + +(* Lemma size_iota *) +let size_iota = Sections.section_proof ["m";"n"] +`sizel (iota m n) = n` +[ + (((THENL) (((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN ((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]) THEN (move ["m"]))]) THEN ((((use_arg_then2 ("iota", [iota]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + ((((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma iota_add *) +let iota_add = Sections.section_proof ["m";"n1";"n2"] +`iota m (n1 + n2) = iota m n1 ++ iota (m + n1) n2` +[ + (((THENL) (((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN ((use_arg_then2 ("n1", [])) (disch_tac [])) THEN (clear_assumption "n1") THEN elim) [ALL_TAC; ((move ["n1"]) THEN (move ["IHn1"]))]) THEN ((((use_arg_then2 ("addn0", [addn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("add0n", [add0n]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iota", [iota]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("cat0s", [cat0s]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("addSnnS", [addSnnS]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("addSn", [addSn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iota", [iota]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("IHn1", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("addSn", [addSn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("cat_cons", [cat_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma iota_addl *) +let iota_addl = Sections.section_proof ["m1";"m2";"n"] +`iota (m1 + m2) n = map ((+) m1) (iota m2 n)` +[ + (((THENL) (((use_arg_then2 ("m2", [])) (disch_tac [])) THEN (clear_assumption "m2") THEN ((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]) THEN (move ["m2"]))]) THEN ((((use_arg_then2 ("iota", [iota]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("addnS", [addnS]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_iota *) +let nth_iota = Sections.section_proof ["m";"n";"i"] +`i < n ==> nth 0 (iota m n) i = m + i` +[ + (((((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("subnKC", [subnKC])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then2 ("addSnnS", [addSnnS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iota_add", [iota_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_cat", [nth_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_iota", [size_iota]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("subnn", [subnn]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("iota", [iota]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma mem_iota *) +let mem_iota = Sections.section_proof ["m";"n";"i"] +`(i <- iota m n) <=> (m <= i) /\ (i < m + n)` +[ + ((((THENL) (((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN ((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN (move ["m"])) THEN ((((use_arg_then2 ("iota", [iota]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("in_nil", [in_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + (((((use_arg_then2 ("addn0", [addn0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbN", [andbN]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("addSnnS", [addSnnS]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leq_eqVlt", [leq_eqVlt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [(`i = m`)]))))); + (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m = i`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac)); + (((((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addSn", [addSn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_addr", [leq_addr]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma iota_uniq *) +let iota_uniq = Sections.section_proof ["m";"n"] +`uniq (iota m n)` +[ + (((THENL) (((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN ((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]) THEN (move ["m"]))]) THEN ((((use_arg_then2 ("iota", [iota]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("uniq", [uniq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("mem_iota", [mem_iota]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andFb", [andFb]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section MakeSeq *) +Sections.begin_section "MakeSeq";; +(Sections.add_section_var (mk_var ("x0", (`:A`))));; +let mkseq = new_definition `mkseq f n = map f (iota 0 n)`;; + +(* Lemma size_mkseq *) +let size_mkseq = Sections.section_proof ["f";"n"] +`sizel (mkseq f n) = n` +[ + (((((use_arg_then2 ("mkseq", [mkseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_map", [size_map]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_iota", [size_iota]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eq_mkseq *) +let eq_mkseq = Sections.section_proof ["f";"g"] +`(!x. f x = g x) ==> mkseq f = mkseq g` +[ + ((((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mkseq", [mkseq]))(thm_tac (new_rewrite [] [])))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("eq_map", [eq_map])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_mkseq *) +let nth_mkseq = Sections.section_proof ["f";"n";"i"] +`i < n ==> nth x0 (mkseq f n) i = f i` +[ + ((BETA_TAC THEN (move ["Hi"])) THEN (((use_arg_then2 ("mkseq", [mkseq]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("nth_map", [nth_map]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`0`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("size_iota", [size_iota]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Hi", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["_"]))); + (((((use_arg_then2 ("nth_iota", [nth_iota]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma mkseq_nth *) +let mkseq_nth = Sections.section_proof ["s"] +`mkseq (nth x0 s) (sizel s) = s` +[ + ((((fun arg_tac -> (use_arg_then2 ("eq_from_nth", [eq_from_nth])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["i"]) THEN (move ["Hi"])) THEN (((use_arg_then2 ("nth_mkseq", [nth_mkseq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section MakeSeq *) +let size_mkseq = Sections.finalize_theorem size_mkseq;; +let eq_mkseq = Sections.finalize_theorem eq_mkseq;; +let nth_mkseq = Sections.finalize_theorem nth_mkseq;; +let mkseq_nth = Sections.finalize_theorem mkseq_nth;; +Sections.end_section "MakeSeq";; + +(* Lemma mkseq_uniq *) +let mkseq_uniq = Sections.section_proof ["f";"n"] +`(!x y. f x = f y ==> x = y) ==> uniq (mkseq f n)` +[ + ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("map_inj_uniq", [map_inj_uniq])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["Hs"])); + (((((use_arg_then2 ("mkseq", [mkseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Hs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iota_uniq", [iota_uniq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section FoldRight *) +Sections.begin_section "FoldRight";; +(Sections.add_section_var (mk_var ("f", (`:A -> B -> B`))));; +(Sections.add_section_var (mk_var ("z0", (`:B`))));; +let foldr = define `foldr f z0 (x :: s) = f x (foldr f z0 s) /\ foldr f z0 [] = z0`;; + +(* Finalization of the section FoldRight *) +Sections.end_section "FoldRight";; + +(* Section FoldRightComp *) +Sections.begin_section "FoldRightComp";; +(Sections.add_section_var (mk_var ("h", (`:A->B`))));; +(Sections.add_section_var (mk_var ("f", (`:B->R->R`))));; +(Sections.add_section_var (mk_var ("z0", (`:R`))));; + +(* Lemma foldr_cat *) +let foldr_cat = Sections.section_proof ["s1";"s2"] +`foldr f z0 (s1 ++ s2) = foldr f (foldr f z0 s2) s1` +[ + (((THENL) (((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s1"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma foldr_map *) +let foldr_map = Sections.section_proof ["s"] +`foldr f z0 (map h s) = foldr (\x z. f (h x) z) z0 s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Finalization of the section FoldRightComp *) +let foldr_cat = Sections.finalize_theorem foldr_cat;; +let foldr_map = Sections.finalize_theorem foldr_map;; +Sections.end_section "FoldRightComp";; +let sumn = new_definition `sumn = foldr (+) 0`;; + +(* Lemma sumn0 *) +let sumn0 = Sections.section_proof [] +`sumn [] = 0` +[ + (((((use_arg_then2 ("sumn", [sumn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma sumn_nseq *) +let sumn_nseq = Sections.section_proof ["x";"n"] +`sumn (nseq n x) = x * n` +[ + ((((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [])))) THEN ((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) THEN ((((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("sumn", [sumn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("mul0n", [mul0n]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("sumn", [sumn]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ncons", [ncons]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nseq", [nseq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulSn", [mulSn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sumn_cat *) +let sumn_cat = Sections.section_proof ["s1";"s2"] +`sumn (s1 ++ s2) = sumn s1 + sumn s2` +[ + (((THENL) (((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s1"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("sumn0", [sumn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("add0n", [add0n]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("sumn", [sumn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("sumn", [sumn]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("IHs", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("addnA", [addnA]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma natnseq0P *) +let natnseq0P = Sections.section_proof ["s"] +`sumn s = 0 <=> s = nseq (sizel s) 0` +[ + ((THENL_LAST) ((THENL) (split_tac) [ALL_TAC; (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))]) (((((use_arg_then2 ("sumn_nseq", [sumn_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mul0n", [mul0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) (((((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac))); + ((((((use_arg_then2 ("sumn", [sumn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("sumn", [sumn]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("addn_eq0", [addn_eq0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("nseq", [nseq]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ncons", [ncons]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("nseq", [nseq]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))) THEN ALL_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHs", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))))) THEN (done_tac)); +];; + +(* Section FoldLeft *) +Sections.begin_section "FoldLeft";; +(Sections.add_section_var (mk_var ("f", (`:R->A->R`))));; +let foldl = define `foldl f z (x :: s) = foldl f (f z x) s /\ foldl f z [] = z`;; + +(* Lemma foldl_rev *) +let foldl_rev = Sections.section_proof ["z";"s"] +`foldl f z (rev s) = foldr (\x z0. f z0 x) z s` +[ + ((((use_arg_then2 ("z", [])) (disch_tac [])) THEN (clear_assumption "z") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN ((fun arg_tac -> arg_tac (Arg_theorem (REWRITE_RULE[IMP_IMP] last_ind))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (((THENL) (split_tac) [ALL_TAC; ((move ["s"]) THEN (move ["x"]) THEN (move ["IHs"]))]) THEN (move ["z"]))); + (((((use_arg_then2 ("rev", [rev]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("catrev", [catrev]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldl", [foldl]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); + ((((use_arg_then2 ("rev_rcons", [rev_rcons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cats1", [cats1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("foldr_cat", [foldr_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHs", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("foldl", [foldl]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma foldl_cat *) +let foldl_cat = Sections.section_proof ["z";"s1";"s2"] +`foldl f z (s1 ++ s2) = foldl f (foldl f z s1) s2` +[ + (((((fun arg_tac -> (use_arg_then2 ("revK", [revK])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`s1 ++ s2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("foldl_rev", [foldl_rev]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rev_cat", [rev_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("foldr_cat", [foldr_cat]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("foldl_rev", [foldl_rev]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("revK", [revK]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section FoldLeft *) +let foldl_rev = Sections.finalize_theorem foldl_rev;; +let foldl_cat = Sections.finalize_theorem foldl_cat;; +Sections.end_section "FoldLeft";; + +(* Section Scan *) +Sections.begin_section "Scan";; +(Sections.add_section_var (mk_var ("x1", (`:A`))));; +(Sections.add_section_var (mk_var ("x2", (`:B`))));; +(Sections.add_section_var (mk_var ("f", (`:A -> A -> B`))));; +(Sections.add_section_var (mk_var ("g", (`:A -> B -> A`))));; +let pairmap = define `pairmap f x (y :: s) = f x y :: pairmap f y s /\ pairmap f x [] = []`;; + +(* Lemma size_pairmap *) +let size_pairmap = Sections.section_proof ["x";"s"] +`sizel (pairmap f x s) = sizel s` +[ + ((((THENL) (((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN (move ["x"])) THEN ((((use_arg_then2 ("pairmap", [pairmap]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((repeat_tactic 1 9 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma pairmap_cat *) +let pairmap_cat = Sections.section_proof ["x";"s1";"s2"] +`pairmap f x (s1 ++ s2) = pairmap f x s1 ++ pairmap f (last x s1) s2` +[ + ((((THENL) (((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s1"]) THEN (move ["IHs1"]))]) THEN (move ["x"])) THEN ((((use_arg_then2 ("pairmap", [pairmap]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("last", [last]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("pairmap", [pairmap]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + ((((use_arg_then2 ("IHs1", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma nth_pairmap *) +let nth_pairmap = Sections.section_proof ["s";"n"] +`n < sizel s ==> + !x. nth x2 (pairmap f x s) n = f (nth x1 (x :: s) n) (nth x1 s n)` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltS0", [ltS0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("pairmap", [pairmap]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHs", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["Hn"]) THEN (move ["x"])) THEN (done_tac)); +];; +let scanl = define `scanl g x (y :: s) = g x y :: scanl g (g x y) s /\ scanl g x [] = []`;; + +(* Lemma size_scanl *) +let size_scanl = Sections.section_proof ["x";"s"] +`sizel (scanl g x s) = sizel s` +[ + ((((THENL) (((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN (move ["x"])) THEN ((((use_arg_then2 ("scanl", [scanl]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + ((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma scanl_cat *) +let scanl_cat = Sections.section_proof ["x";"s1";"s2"] +`scanl g x (s1 ++ s2) = scanl g x s1 ++ scanl g (foldl g x s1) s2` +[ + ((((THENL) (((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s1"]) THEN (move ["IHs1"]))]) THEN (move ["x"])) THEN ((((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("scanl", [scanl]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldl", [foldl]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma nth_scanl *) +let nth_scanl = Sections.section_proof ["s";"n"] +`n < sizel s ==> + !x. nth x1 (scanl g x s) n = foldl g x (take (SUC n) s)` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["n"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltS0", [ltS0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("scanl", [scanl]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("take", [take]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("foldl", [foldl]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((TRY done_tac)))); + ((((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHs", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["Hn"])) THEN (done_tac)); +];; + +(* Lemma scanlK *) +let scanlK = Sections.section_proof [] +`(!x y. f x (g x y) = y) ==> (!x s. pairmap f x (scanl g x s) = s)` +[ + (BETA_TAC THEN (move ["Hfg"]) THEN (move ["x"]) THEN (move ["s"])); + ((((THENL) (((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN (move ["x"])) THEN ((((use_arg_then2 ("scanl", [scanl]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("pairmap", [pairmap]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma pairmapK *) +let pairmapK = Sections.section_proof [] +`(!x y. g x (f x y) = y) ==> (!x s. scanl g x (pairmap f x s) = s)` +[ + (BETA_TAC THEN (move ["Hgf"]) THEN (move ["x"]) THEN (move ["s"])); + ((((THENL) (((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["y"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN (move ["x"])) THEN ((((use_arg_then2 ("pairmap", [pairmap]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("scanl", [scanl]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Finalization of the section Scan *) +let size_pairmap = Sections.finalize_theorem size_pairmap;; +let pairmap_cat = Sections.finalize_theorem pairmap_cat;; +let nth_pairmap = Sections.finalize_theorem nth_pairmap;; +let size_scanl = Sections.finalize_theorem size_scanl;; +let scanl_cat = Sections.finalize_theorem scanl_cat;; +let nth_scanl = Sections.finalize_theorem nth_scanl;; +let scanlK = Sections.finalize_theorem scanlK;; +let pairmapK = Sections.finalize_theorem pairmapK;; +Sections.end_section "Scan";; + +(* Section Zip *) +Sections.begin_section "Zip";; +let zip = define `zip (x :: s) (y :: t) = (x, y) :: zip s t /\ + zip [] t = [] /\ zip s [] = []`;; +let unzip1 = new_definition `unzip1 = map FST`;; +let unzip2 = new_definition `unzip2 = map SND`;; + +(* Lemma zip_unzip *) +let zip_unzip = Sections.section_proof ["s"] +`zip (unzip1 s) (unzip2 s) = s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("unzip1", [unzip1]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("unzip2", [unzip2]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("zip", [zip]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("PAIR", [PAIR]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + (((((use_arg_then2 ("unzip1", [unzip1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("unzip2", [unzip2]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma unzip1_zip *) +let unzip1_zip = Sections.section_proof ["s";"t"] +`sizel s <= sizel t ==> unzip1 (zip s t) = s` +[ + (((THENL) (((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["y"]) THEN (move ["t"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("zip", [zip]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("unzip1", [unzip1]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((((((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("unzip1", [unzip1]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHs", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma unzip2_zip *) +let unzip2_zip = Sections.section_proof ["s";"t"] +`sizel t <= sizel s ==> unzip2 (zip s t) = t` +[ + (((THENL) (((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["y"]) THEN (move ["t"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("zip", [zip]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("unzip2", [unzip2]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((((((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("unzip2", [unzip2]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHs", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma size1_zip *) +let size1_zip = Sections.section_proof ["s";"t"] +`sizel s <= sizel t ==> sizel (zip s t) = sizel s` +[ + (((THENL) (((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["y"]) THEN (move ["t"]) THEN (move ["_"]))]) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("zip", [zip]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((((((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHs", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma size2_zip *) +let size2_zip = Sections.section_proof ["s";"t"] +`sizel t <= sizel s ==> sizel (zip s t) = sizel t` +[ + (((THENL) (((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["y"]) THEN (move ["t"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("zip", [zip]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + ((((((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHs", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma size_zip *) +let size_zip = Sections.section_proof ["s";"t"] +`sizel (zip s t) = minn (sizel s) (sizel t)` +[ + (((THENL) (((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["t2"]) THEN (move ["t"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("zip", [zip]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("minn", [minn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("gtS0", [gtS0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltS0", [ltS0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("minn", [minn]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("add1n", [add1n]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addn_minr", [addn_minr]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("add1n", [add1n]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma zip_cat *) +let zip_cat = Sections.section_proof ["s1";"s2";"t1";"t2"] +`sizel s1 = sizel t1 ==> zip (s1 ++ s2) (t1 ++ t2) = zip s1 t1 ++ zip s2 t2` +[ + (((THENL) (((use_arg_then2 ("t1", [])) (disch_tac [])) THEN (clear_assumption "t1") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["y"]) THEN (move ["t"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("zip", [zip]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [(`0 = _`)]))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("eqS0", [eqS0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("eqSS", [eqSS]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHs", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_zip *) +let nth_zip = Sections.section_proof ["x";"y";"s";"t";"i"] +`sizel s = sizel t ==> nth (x, y) (zip s t) i = (nth x s i, nth y t i)` +[ + (((THENL) (((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN ((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN elim) [ALL_TAC; ((move ["i"]) THEN (move ["IHi"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["y1"]) THEN (move ["s1"]) THEN (move ["_"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["y2"]) THEN (move ["t"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("zip", [zip]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [(`0 = _`)]))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("eqS0", [eqS0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("eqSS", [eqSS]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IHi", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_zip_cond *) +let nth_zip_cond = Sections.section_proof ["p";"s";"t";"i"] +`nth p (zip s t) i + = (if i < sizel (zip s t) then (nth (FST p) s i, nth (SND p) t i) else p)` +[ + ((((use_arg_then2 ("size_zip", [size_zip]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_minl", [leq_minl]))(thm_tac (new_rewrite [] []))))); + (((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN ((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["y"]) THEN (move ["t"]) THEN (move ["_"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["i"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("leqnn", [leqnn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("zip", [zip]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("nth", [nth]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("leq0n", [leq0n]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma zip_rcons *) +let zip_rcons = Sections.section_proof ["s1";"s2";"z1";"z2"] +`sizel s1 = sizel s2 ==> + zip (rcons s1 z1) (rcons s2 z2) = rcons (zip s1 s2) (z1, z2)` +[ + ((BETA_TAC THEN (move ["eq_sz"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("cats1", [cats1]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("zip_cat", [zip_cat]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("zip", [zip]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma rev_zip *) +let rev_zip = Sections.section_proof ["s1";"s2"] +`sizel s1 = sizel s2 ==> rev (zip s1 s2) = zip (rev s1) (rev s2)` +[ + ((((THENL) (((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s1"]) THEN (move ["IHs"]))]) THEN ((THENL) case [ALL_TAC; ((move ["y"]) THEN (move ["s2"]))])) THEN (TRY ((((((use_arg_then2 ("rev", [rev]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("catrev", [catrev]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("zip", [zip]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("catrev", [catrev]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eqSS", [eqSS]))(thm_tac (new_rewrite [] []))))) THEN (move ["eq_sz"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("rev_cons", [rev_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("zip_rcons", [zip_rcons]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_rev", [size_rev]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN ((((use_arg_then2 ("zip", [zip]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("rev_cons", [rev_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN ((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (done_tac)); +];; + +(* Finalization of the section Zip *) +let zip_unzip = Sections.finalize_theorem zip_unzip;; +let unzip1_zip = Sections.finalize_theorem unzip1_zip;; +let unzip2_zip = Sections.finalize_theorem unzip2_zip;; +let size1_zip = Sections.finalize_theorem size1_zip;; +let size2_zip = Sections.finalize_theorem size2_zip;; +let size_zip = Sections.finalize_theorem size_zip;; +let zip_cat = Sections.finalize_theorem zip_cat;; +let nth_zip = Sections.finalize_theorem nth_zip;; +let nth_zip_cond = Sections.finalize_theorem nth_zip_cond;; +let zip_rcons = Sections.finalize_theorem zip_rcons;; +let rev_zip = Sections.finalize_theorem rev_zip;; +Sections.end_section "Zip";; + +(* Section Flatten *) +Sections.begin_section "Flatten";; +(Sections.add_section_type (mk_var ("s", (`:(A)list`))));; +(Sections.add_section_type (mk_var ("ss", (`:((A)list)list`))));; +let flatten = new_definition `flatten = foldr cat []`;; +let shape = new_definition `shape = map sizel`;; +let reshape = define `reshape (n :: sh) s = take n s :: reshape sh (dropl n s) /\ + reshape [] s = []`;; + +(* Lemma flatten0 *) +let flatten0 = Sections.section_proof [] +`flatten [] = []` +[ + (((((use_arg_then2 ("flatten", [flatten]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma flatten_cons *) +let flatten_cons = Sections.section_proof ["s";"ss"] +`flatten (s :: ss) = s ++ flatten ss` +[ + (((((use_arg_then2 ("flatten", [flatten]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma size_flatten *) +let size_flatten = Sections.section_proof ["ss"] +`sizel (flatten ss) = sumn (shape ss)` +[ + (((THENL) (((use_arg_then2 ("ss", [])) (disch_tac [])) THEN (clear_assumption "ss") THEN elim) [ALL_TAC; ((move ["s"]) THEN (move ["ss"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("flatten", [flatten]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("shape", [shape]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("sumn0", [sumn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("flatten", [flatten]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_cat", [size_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("shape", [shape]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then2 ("sumn", [sumn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma flatten_cat *) +let flatten_cat = Sections.section_proof ["ss1";"ss2"] +`flatten (ss1 ++ ss2) = flatten ss1 ++ flatten ss2` +[ + (((THENL) (((use_arg_then2 ("ss1", [])) (disch_tac [])) THEN (clear_assumption "ss1") THEN elim) [ALL_TAC; ((move ["s"]) THEN (move ["ss1"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("flatten0", [flatten0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("flatten_cons", [flatten_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + (((((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("catA", [catA]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma flattenK *) +let flattenK = Sections.section_proof ["ss"] +`reshape (shape ss) (flatten ss) = ss` +[ + (((THENL) (((use_arg_then2 ("ss", [])) (disch_tac [])) THEN (clear_assumption "ss") THEN elim) [ALL_TAC; ((move ["s"]) THEN (move ["ss"]) THEN (move ["IHss"]))]) THEN ((((use_arg_then2 ("flatten", [flatten]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("shape", [shape]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("reshape", [reshape]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("take_size_cat", [take_size_cat]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("drop_size_cat", [drop_size_cat]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("flatten", [flatten]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("shape", [shape]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IHss", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma reshapeKr *) +let reshapeKr = Sections.section_proof ["sh";"s"] +`sizel s <= sumn sh ==> flatten (reshape sh s) = s` +[ + ((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN ((use_arg_then2 ("sh", [])) (disch_tac [])) THEN (clear_assumption "sh") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["sh"]) THEN (move ["IHsh"]) THEN (move ["s"]) THEN (move ["sz_s"]))]); + (((THENL) elim [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("reshape", [reshape]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("flatten0", [flatten0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sumn0", [sumn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); + ((((use_arg_then2 ("reshape", [reshape]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("flatten", [flatten]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("flatten", [flatten]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + (((((use_arg_then2 ("IHsh", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("cat_take_drop", [cat_take_drop]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_sub_add", [leq_sub_add]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("sz_s", [])) (disch_tac [])) THEN (clear_assumption "sz_s") THEN BETA_TAC)); + (((((use_arg_then2 ("sumn", [sumn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma reshapeKl *) +let reshapeKl = Sections.section_proof ["sh";"s"] +`sumn sh <= sizel s ==> shape (reshape sh s) = sh` +[ + ((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN ((use_arg_then2 ("sh", [])) (disch_tac [])) THEN (clear_assumption "sh") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["sh"]) THEN (move ["IHsh"]) THEN (move ["s"]) THEN (move ["sz_s"]))]); + (((THENL) elim [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["_"]))]) THEN ((((use_arg_then2 ("reshape", [reshape]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("shape", [shape]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); + ((((use_arg_then2 ("sz_s", [])) (disch_tac [])) THEN (clear_assumption "sz_s") THEN BETA_TAC) THEN (((((use_arg_then2 ("sumn", [sumn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("sumn", [sumn]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))) THEN (move ["sz_s"]))); + (((((use_arg_then2 ("reshape", [reshape]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("shape", [shape]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("map", [map]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("shape", [shape]))(gsym_then (fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))) THEN (((use_arg_then2 ("size_takel", [size_takel]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("sz_s", [])) (disch_tac [])) THEN (clear_assumption "sz_s") THEN ((use_arg_then2 ("leq_trans", [leq_trans])) (disch_tac [])) THEN (clear_assumption "leq_trans") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("leq_addr", [leq_addr]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((use_arg_then2 ("IHsh", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("leq_add2l", [leq_add2l])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add_sub_maxn", [add_sub_maxn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_maxr", [leq_maxr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sz_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbT", [orbT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Flatten *) +let flatten0 = Sections.finalize_theorem flatten0;; +let flatten_cons = Sections.finalize_theorem flatten_cons;; +let size_flatten = Sections.finalize_theorem size_flatten;; +let flatten_cat = Sections.finalize_theorem flatten_cat;; +let flattenK = Sections.finalize_theorem flattenK;; +let reshapeKr = Sections.finalize_theorem reshapeKr;; +let reshapeKl = Sections.finalize_theorem reshapeKl;; +Sections.end_section "Flatten";; + +(* Section AllPairs *) +Sections.begin_section "AllPairs";; +(Sections.add_section_var (mk_var ("f", (`:S->T->R`))));; +(Sections.add_section_type (mk_var ("s", (`:(S)list`))));; +(Sections.add_section_type (mk_var ("t", (`:(T)list`))));; +let allpairs = new_definition `allpairs f s t = foldr (\x. cat (map (f x) t)) [] s`;; + +(* Lemma size_allpairs *) +let size_allpairs = Sections.section_proof ["s";"t"] +`sizel (allpairs f s t) = sizel s * sizel t` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("allpairs", [allpairs]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("mul0n", [mul0n]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("size_cat", [size_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("allpairs", [allpairs]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_map", [size_map]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulSn", [mulSn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma allpairs_cat *) +let allpairs_cat = Sections.section_proof ["s1";"s2";"t"] +`allpairs f (s1 ++ s2) t = allpairs f s1 t ++ allpairs f s2 t` +[ + (((THENL) (((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s1"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("allpairs", [allpairs]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("cat", [cat]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((repeat_tactic 1 9 (((use_arg_then2 ("allpairs", [allpairs]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("catA", [catA]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section AllPairs *) +let size_allpairs = Sections.finalize_theorem size_allpairs;; +let allpairs_cat = Sections.finalize_theorem allpairs_cat;; +Sections.end_section "AllPairs";; + +(* Section EqAllPairs *) +Sections.begin_section "EqAllPairs";; +(Sections.add_section_var (mk_var ("f", (`:S->T->R`))));; +(Sections.add_section_type (mk_var ("s", (`:(S)list`))));; +(Sections.add_section_type (mk_var ("t", (`:(T)list`))));; + +(* Lemma allpairsP *) +let allpairsP = Sections.section_proof ["s";"t";"z"] +`(z <- allpairs f s t) <=> (?p. FST p <- s /\ SND p <- t /\ z = f (FST p) (SND p))` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["x"]) THEN (move ["s"]) THEN (move ["IHs"]))]) THEN ((((use_arg_then2 ("allpairs", [allpairs]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("foldr", [foldr]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("in_nil", [in_nil]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("allpairs", [allpairs]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mapP", [mapP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((THENL_FIRST) ((THENL) case [((case THEN (move ["y"])) THEN (case THEN ((move ["Hy"]) THEN (move ["eq"])))); ((case THEN (move ["p"])) THEN (case THEN ((move ["p1"]) THEN (case THEN ((move ["p2"]) THEN (move ["eq"]))))))]) ((((fun arg_tac -> arg_tac (Arg_term (`(x, y)`))) (term_tac exists_tac)) THEN (simp_tac)) THEN (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((use_arg_then2 ("p", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("in_cons", [in_cons]))(thm_tac (new_rewrite [] [])))) THEN (BETA_TAC THEN (case THEN (move ["p"])) THEN (case THEN (case THEN (move ["p_s"]))) THEN (case THEN ((move ["p_t"]) THEN (move ["eq"]))))); + ((DISJ1_TAC) THEN ((fun arg_tac -> arg_tac (Arg_term (`SND p`))) (term_tac exists_tac)) THEN (done_tac)); + ((DISJ2_TAC) THEN ((use_arg_then2 ("p", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma mem_allpairs *) +let mem_allpairs = Sections.section_proof ["s1";"t1";"s2";"t2"] +`(!x. x <- s1 <=> x <- s2) ==> (!y. y <- t1 <=> y <- t2) + ==> (!p. p <- allpairs f s1 t1 <=> p <- allpairs f s2 t2)` +[ + (BETA_TAC THEN (move ["eq_s"]) THEN (move ["eq_t"]) THEN (move ["z"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("allpairsP", [allpairsP]))(thm_tac (new_rewrite [] []))))) THEN ((split_tac) THEN ALL_TAC THEN (case THEN (move ["p"]))) THEN (((((use_arg_then2 ("eq_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_t", []))(thm_tac (new_rewrite [] []))))) THEN (move ["fpz"]))); + (((use_arg_then2 ("p", [])) (term_tac exists_tac)) THEN (done_tac)); + (((use_arg_then2 ("p", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma allpairs_catr *) +let allpairs_catr = Sections.section_proof ["s";"t1";"t2"] +`!p. p <- allpairs f s (t1 ++ t2) <=> p <- allpairs f s t1 ++ allpairs f s t2` +[ + ((BETA_TAC THEN (move ["z"])) THEN (((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("allpairsP", [allpairsP]))(thm_tac (new_rewrite [] [])))) THEN ((THENL) (split_tac) [(case THEN ((move ["p"]) THEN (case THEN (move ["sP1"])))); ALL_TAC])); + (((THENL) ((((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((case THEN (move ["H"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) [(DISJ1_TAC); (DISJ2_TAC)]) THEN (((use_arg_then2 ("allpairsP", [allpairsP]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("p", [])) (term_tac exists_tac)) THEN (done_tac)); + (case THEN ((((use_arg_then2 ("allpairsP", [allpairsP]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["p"])) THEN (case THEN (move ["sp1"])) THEN (case THEN ((move ["sp2"]) THEN (move ["eq"])))) THEN ((use_arg_then2 ("p", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sp2", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section EqAllPairs *) +let allpairsP = Sections.finalize_theorem allpairsP;; +let mem_allpairs = Sections.finalize_theorem mem_allpairs;; +let allpairs_catr = Sections.finalize_theorem allpairs_catr;; +Sections.end_section "EqAllPairs";; + +(* Close the module *) +end;; diff --git a/jHOLLight/Examples/ssrbool-compiled.hl b/jHOLLight/Examples/ssrbool-compiled.hl new file mode 100644 index 0000000..af2ab90 --- /dev/null +++ b/jHOLLight/Examples/ssrbool-compiled.hl @@ -0,0 +1,766 @@ +needs "Examples/ssrfun-compiled.hl";; + +(* Module Ssrbool*) +module Ssrbool = struct + + +(* Section ApplyIff *) +Sections.begin_section "ApplyIff";; +(Sections.add_section_var (mk_var ("P", (`:bool`))); Sections.add_section_var (mk_var ("Q", (`:bool`))));; +(Sections.add_section_hyp "eqPQ" (`P <=> Q`));; + +(* Lemma iffLR *) +let iffLR = Sections.section_proof [] +`P ==> Q` +[ + (done_tac); +];; + +(* Lemma iffRL *) +let iffRL = Sections.section_proof [] +`Q ==> P` +[ + (done_tac); +];; + +(* Lemma iffLRn *) +let iffLRn = Sections.section_proof [] +`~P ==> ~Q` +[ + (done_tac); +];; + +(* Lemma iffRLn *) +let iffRLn = Sections.section_proof [] +`~Q ==> ~P` +[ + (done_tac); +];; + +(* Finalization of the section ApplyIff *) +let iffLR = Sections.finalize_theorem iffLR;; +let iffRL = Sections.finalize_theorem iffRL;; +let iffLRn = Sections.finalize_theorem iffLRn;; +let iffRLn = Sections.finalize_theorem iffRLn;; +Sections.end_section "ApplyIff";; + +(* Lemma is_true_true *) +let is_true_true = Sections.section_proof [] +`T` +[ + (done_tac); +];; + +(* Lemma not_false_is_true *) +let not_false_is_true = Sections.section_proof [] +`~F` +[ + (done_tac); +];; +let isT = is_true_true;; +let notF = not_false_is_true;; + +(* Lemma negbT *) +let negbT = Sections.section_proof ["b"] +`(b = F) ==> ~b` +[ + (done_tac); +];; + +(* Lemma negbTE *) +let negbTE = Sections.section_proof ["b"] +`~b ==> b = F` +[ + (done_tac); +];; + +(* Lemma negbF *) +let negbF = Sections.section_proof ["b"] +`b ==> ~b = F` +[ + (done_tac); +];; + +(* Lemma negbFE *) +let negbFE = Sections.section_proof ["b"] +`~b = F ==> b` +[ + (done_tac); +];; + +(* Lemma negbK *) +let negbK = Sections.section_proof ["b"] +`~ ~b = b` +[ + (done_tac); +];; + +(* Lemma negbNE *) +let negbNE = Sections.section_proof ["b"] +`~ ~ b ==> b` +[ + (done_tac); +];; + +(* Lemma negb_inj *) +let negb_inj = Sections.section_proof ["b1";"b2"] +`~b1 = ~b2 ==> b1 = b2` +[ + ((((use_arg_then2 ("b1", [])) (disch_tac [])) THEN (clear_assumption "b1") THEN case) THEN (((use_arg_then2 ("b2", [])) (disch_tac [])) THEN (clear_assumption "b2") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma negbLR *) +let negbLR = Sections.section_proof ["b";"c"] +`b = ~c ==> ~b = c` +[ + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma negbRL *) +let negbRL = Sections.section_proof ["b";"c"] +`~b = c ==> b = ~c` +[ + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma contra *) +let contra = Sections.section_proof ["c";"b"] +`(c ==> b) ==> ~b ==> ~c` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac))); +];; +let contraNN = contra;; + +(* Lemma contraL *) +let contraL = Sections.section_proof ["c";"b"] +`(c ==> ~b) ==> b ==> ~c` +[ + (BETA_TAC THEN (move ["h"])); + ((((fun arg_tac -> (use_arg_then2 ("contra", [contra])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma contraR *) +let contraR = Sections.section_proof ["c";"b"] +`(~c ==> b) ==> ~b ==> c` +[ + (BETA_TAC THEN (move ["h"])); + ((((fun arg_tac -> (use_arg_then2 ("contra", [contra])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma contraLR *) +let contraLR = Sections.section_proof ["c";"b"] +`(~c ==> ~b) ==> b ==> c` +[ + (BETA_TAC THEN (move ["h"])); + ((((fun arg_tac -> (use_arg_then2 ("contra", [contra])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma contraT *) +let contraT = Sections.section_proof ["b"] +`(~b ==> F) ==> b` +[ + (done_tac); +];; + +(* Lemma wlog_neg *) +let wlog_neg = Sections.section_proof ["b"] +`(~b ==> b) ==> b` +[ + (((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)); +];; + +(* Lemma contraFT *) +let contraFT = Sections.section_proof ["c";"b"] +`(~c ==> b) ==> b = F ==> c` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac))); +];; + +(* Lemma contraFN *) +let contraFN = Sections.section_proof ["c";"b"] +`(c ==> b) ==> b = F ==> ~c` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac))); +];; + +(* Lemma contraTF *) +let contraTF = Sections.section_proof ["c";"b"] +`(c ==> ~b) ==> b ==> c = F` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac))); +];; + +(* Lemma contraNF *) +let contraNF = Sections.section_proof ["c";"b"] +`(c ==> b) ==> ~b ==> c = F` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac))); +];; + +(* Lemma contraFF *) +let contraFF = Sections.section_proof ["c";"b"] +`(c ==> b) ==> b = F ==> c = F` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac))); +];; +let isSome = define `isSome NONE = F /\ (!x. isSome (SOME x) = T)`;; + +(* Section BoolIf *) +Sections.begin_section "BoolIf";; +(Sections.add_section_var (mk_var ("vT", (`:A`))); Sections.add_section_var (mk_var ("vF", (`:A`))));; +(Sections.add_section_var (mk_var ("f", (`:A -> B`))));; +(Sections.add_section_var (mk_var ("b", (`:bool`))));; + +(* Lemma if_same *) +let if_same = Sections.section_proof [] +`(if b then vT else vT) = vT` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma if_neg *) +let if_neg = Sections.section_proof [] +`(if ~b then vT else vF) = if b then vF else vT` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma fun_if *) +let fun_if = Sections.section_proof [] +`f (if b then vT else vF) = if b then f vT else f vF` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma if_arg *) +let if_arg = Sections.section_proof ["fT";"fF";"x"] +`(if b then (fT:A->B) else fF) x = if b then fT x else fF x` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Finalization of the section BoolIf *) +let if_same = Sections.finalize_theorem if_same;; +let if_neg = Sections.finalize_theorem if_neg;; +let fun_if = Sections.finalize_theorem fun_if;; +let if_arg = Sections.finalize_theorem if_arg;; +Sections.end_section "BoolIf";; + +(* Lemma andTb *) +let andTb = Sections.section_proof ["b"] +`(T /\ b) = b` +[ + (done_tac); +];; + +(* Lemma andFb *) +let andFb = Sections.section_proof ["b"] +`(F /\ b) = F` +[ + (done_tac); +];; + +(* Lemma andbT *) +let andbT = Sections.section_proof ["b"] +`(b /\ T) = b` +[ + (done_tac); +];; + +(* Lemma andbF *) +let andbF = Sections.section_proof ["b"] +`(b /\ F) = F` +[ + (done_tac); +];; + +(* Lemma andbb *) +let andbb = Sections.section_proof ["b"] +`(b /\ b) = b` +[ + (done_tac); +];; + +(* Lemma andbC *) +let andbC = Sections.section_proof ["b";"c"] +`(b /\ c) = (c /\ b)` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andbA *) +let andbA = Sections.section_proof ["b";"c";"p"] +`b /\ (c /\ p) <=> (b /\ c) /\ p` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andbCA *) +let andbCA = Sections.section_proof ["b";"c";"p"] +`b /\ (c /\ p) <=> c /\ (b /\ p)` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andbAC *) +let andbAC = Sections.section_proof ["b";"c";"p"] +`(b /\ c) /\ p <=> (b /\ p) /\ c` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orTb *) +let orTb = Sections.section_proof ["b"] +`T \/ b <=> T` +[ + (done_tac); +];; + +(* Lemma orFb *) +let orFb = Sections.section_proof ["b"] +`F \/ b <=> b` +[ + (done_tac); +];; + +(* Lemma orbT *) +let orbT = Sections.section_proof ["b"] +`b \/ T <=> T` +[ + (done_tac); +];; + +(* Lemma orbF *) +let orbF = Sections.section_proof ["b"] +`b \/ F <=> b` +[ + (done_tac); +];; + +(* Lemma orbb *) +let orbb = Sections.section_proof ["b"] +`b \/ b <=> b` +[ + (done_tac); +];; + +(* Lemma orbC *) +let orbC = Sections.section_proof ["b";"c"] +`b \/ c <=> c \/ b` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orbA *) +let orbA = Sections.section_proof ["b";"c";"p"] +`b \/ (c \/ p) <=> (b \/ c) \/ p` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orbCA *) +let orbCA = Sections.section_proof ["b";"c";"p"] +`b \/ (c \/ p) <=> c \/ (b \/ p)` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orbAC *) +let orbAC = Sections.section_proof ["b";"c";"p"] +`(b \/ c) \/ p <=> (b \/ p) \/ c` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andbN *) +let andbN = Sections.section_proof ["b"] +`b /\ ~b <=> F` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andNb *) +let andNb = Sections.section_proof ["b"] +`~b /\ b <=> F` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orbN *) +let orbN = Sections.section_proof ["b"] +`b \/ ~b` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orNb *) +let orNb = Sections.section_proof ["b"] +`~b \/ b` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andb_orl *) +let andb_orl = Sections.section_proof ["b";"c";"p"] +`(b \/ c) /\ p <=> (b /\ p) \/ (c /\ p)` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andb_orr *) +let andb_orr = Sections.section_proof ["b";"c";"p"] +`b /\ (c \/ p) <=> (b /\ c) \/ (b /\ p)` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orb_andl *) +let orb_andl = Sections.section_proof ["b";"c";"p"] +`(b /\ c) \/ p <=> (b \/ p) /\ (c \/ p)` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orb_andr *) +let orb_andr = Sections.section_proof ["b";"c";"p"] +`b \/ (c /\ p) <=> (b \/ c) /\ (b \/ p)` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andb_idl *) +let andb_idl = Sections.section_proof ["a";"b"] +`(b ==> a) ==> (a /\ b <=> b)` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case) THEN (((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andb_idr *) +let andb_idr = Sections.section_proof ["a";"b"] +`(a ==> b) ==> (a /\ b <=> a)` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case) THEN (((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andb_id2l *) +let andb_id2l = Sections.section_proof ["a";"b";"c"] +`(a ==> (b <=> c)) ==> (a /\ b <=> a /\ c)` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andb_id2r *) +let andb_id2r = Sections.section_proof ["a";"b";"c"] +`(b ==> (a <=> c)) ==> (a /\ b <=> c /\ b)` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case) THEN (((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orb_idl *) +let orb_idl = Sections.section_proof ["a";"b"] +`(a ==> b) ==> (a \/ b <=> b)` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orbb_idr *) +let orbb_idr = Sections.section_proof ["a";"b"] +`(b ==> a) ==> (a \/ b <=> a)` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orb_id2l *) +let orb_id2l = Sections.section_proof ["a";"b";"c"] +`(~ a ==> (b <=> c)) ==> (a \/ b <=> a \/ c)` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orb_id2r *) +let orb_id2r = Sections.section_proof ["a";"b";"c"] +`(~ b ==> (a <=> c)) ==> (a \/ b <=> c \/ b)` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case) THEN (((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma negb_and *) +let negb_and = Sections.section_proof ["a";"b"] +`~ (a /\ b) <=> ~ a \/ ~ b` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma negb_or *) +let negb_or = Sections.section_proof ["a";"b"] +`~ (a \/ b) <=> ~ a /\ ~ b` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andbK *) +let andbK = Sections.section_proof ["a";"b"] +`((a /\ b) \/ a) = a` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma andKb *) +let andKb = Sections.section_proof ["a";"b"] +`a \/ b /\ a <=> a` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orbK *) +let orbK = Sections.section_proof ["a";"b"] +`(a \/ b) /\ a <=> a` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma orKb *) +let orKb = Sections.section_proof ["a";"b"] +`a /\ (b \/ a) <=> a` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma implybT *) +let implybT = Sections.section_proof ["b"] +`b ==> T` +[ + (done_tac); +];; + +(* Lemma implybF *) +let implybF = Sections.section_proof ["b"] +`(b ==> F) <=> ~ b` +[ + (done_tac); +];; + +(* Lemma implyFb *) +let implyFb = Sections.section_proof ["b"] +`F ==> b` +[ + (done_tac); +];; + +(* Lemma implyTb *) +let implyTb = Sections.section_proof ["b"] +`(T ==> b) <=> b` +[ + (done_tac); +];; + +(* Lemma implybb *) +let implybb = Sections.section_proof ["b"] +`b ==> b` +[ + (done_tac); +];; + +(* Lemma negb_imply *) +let negb_imply = Sections.section_proof ["a";"b"] +`~ (a ==> b) <=> a /\ ~ b` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma implybE *) +let implybE = Sections.section_proof ["a";"b"] +`(a ==> b) <=> ~ a \/ b` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma implyNb *) +let implyNb = Sections.section_proof ["a";"b"] +`(~ a ==> b) <=> a \/ b` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma implybN *) +let implybN = Sections.section_proof ["a";"b"] +`(a ==> ~ b) <=> (b ==> ~ a)` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma implybNN *) +let implybNN = Sections.section_proof ["a";"b"] +`(~ a ==> ~ b) <=> b ==> a` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma implyb_idl *) +let implyb_idl = Sections.section_proof ["a";"b"] +`(~ a ==> b) ==> ((a ==> b) <=> b)` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma implyb_idr *) +let implyb_idr = Sections.section_proof ["a";"b"] +`(b ==> ~ a) ==> ((a ==> b) <=> ~ a)` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma implyb_id2l *) +let implyb_id2l = Sections.section_proof ["a";"b";"c"] +`(a ==> (b <=> c)) ==> ((a ==> b) <=> (a ==> c))` +[ + ((((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac)) THEN (done_tac)); +];; +let XOR_DEF = new_definition `XOR p q = if p then ~q else q`;; +overload_interface("+", `XOR`);; + +(* Lemma addFb *) +let addFb = Sections.section_proof ["b"] +`F + b <=> b` +[ + ((((use_arg_then2 ("XOR_DEF", [XOR_DEF]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma addbF *) +let addbF = Sections.section_proof ["b"] +`b + F <=> b` +[ + ((((use_arg_then2 ("XOR_DEF", [XOR_DEF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma addbb *) +let addbb = Sections.section_proof ["b"] +`b + b <=> F` +[ + ((((use_arg_then2 ("XOR_DEF", [XOR_DEF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma addbC *) +let addbC = Sections.section_proof ["b";"c"] +`b + c <=> c + b` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("XOR_DEF", [XOR_DEF]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma addbA *) +let addbA = Sections.section_proof ["a";"b";"c"] +`a + (b + c) <=> (a + b) + c` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("XOR_DEF", [XOR_DEF]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case) THEN (((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac))); +];; + +(* Lemma addbCA *) +let addbCA = Sections.section_proof ["a";"b";"c"] +`(a + b) + c <=> (a + c) + b` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("XOR_DEF", [XOR_DEF]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case) THEN (((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac))); +];; + +(* Lemma addbAC *) +let addbAC = Sections.section_proof ["a";"b";"c"] +`a + (b + c) <=> b + (a + c)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("XOR_DEF", [XOR_DEF]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case) THEN (((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac))); +];; + +(* Lemma andb_addl *) +let andb_addl = Sections.section_proof ["a";"b";"c"] +`(a + b) /\ c <=> (a /\ c) + (b /\ c)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("XOR_DEF", [XOR_DEF]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case) THEN (((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac))); +];; + +(* Lemma andb_addr *) +let andb_addr = Sections.section_proof ["a";"b";"c"] +`a /\ (b + c) <=> (a /\ b) + (a /\ c)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("XOR_DEF", [XOR_DEF]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case) THEN (((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case THEN (simp_tac))); +];; + +(* Lemma addKb *) +let addKb = Sections.section_proof ["x";"y"] +`x + (x + y) <=> y` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("XOR_DEF", [XOR_DEF]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN case) THEN (((use_arg_then2 ("y", [])) (disch_tac [])) THEN (clear_assumption "y") THEN case THEN (simp_tac))); +];; + +(* Lemma addbK *) +let addbK = Sections.section_proof ["x";"y"] +`(y + x) + x <=> y` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("XOR_DEF", [XOR_DEF]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN case) THEN (((use_arg_then2 ("y", [])) (disch_tac [])) THEN (clear_assumption "y") THEN case THEN (simp_tac))); +];; + +(* Lemma addIb *) +let addIb = Sections.section_proof ["x";"y1";"y2"] +`(y1 + x <=> y2 + x) ==> (y1 = y2)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("XOR_DEF", [XOR_DEF]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y1", [])) (disch_tac [])) THEN (clear_assumption "y1") THEN case) THEN (((use_arg_then2 ("y2", [])) (disch_tac [])) THEN (clear_assumption "y2") THEN case) THEN (((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN case THEN (simp_tac))); +];; + +(* Lemma addbI *) +let addbI = Sections.section_proof ["x";"y1";"y2"] +`(x + y1 <=> x + y2) ==> (y1 = y2)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("XOR_DEF", [XOR_DEF]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN case) THEN (((use_arg_then2 ("y1", [])) (disch_tac [])) THEN (clear_assumption "y1") THEN case) THEN (((use_arg_then2 ("y2", [])) (disch_tac [])) THEN (clear_assumption "y2") THEN case THEN (simp_tac))); +];; + +(* Lemma addTb *) +let addTb = Sections.section_proof ["b"] +`T + b <=> ~b` +[ + (((((use_arg_then2 ("XOR_DEF", [XOR_DEF]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (done_tac)); +];; + +(* Lemma addbT *) +let addbT = Sections.section_proof ["b"] +`b + T <=> ~ b` +[ + ((((use_arg_then2 ("XOR_DEF", [XOR_DEF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma addbN *) +let addbN = Sections.section_proof ["a";"b"] +`a + ~ b <=> ~ (a + b)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("XOR_DEF", [XOR_DEF]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case) THEN (((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac))); +];; + +(* Lemma addNb *) +let addNb = Sections.section_proof ["a";"b"] +`~ a + b <=> ~ (a + b)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("XOR_DEF", [XOR_DEF]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a", [])) (disch_tac [])) THEN (clear_assumption "a") THEN case) THEN (((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac))); +];; +let subpred = new_definition `subpred p1 p2 <=> (!x. p1 x ==> p2 x)`;; +let subrel = new_definition `subrel r1 r2 <=> (!x y. r1 x y ==> r2 x y)`;; +let pred0 = new_definition `pred0 = (\x. F)`;; +let predT = new_definition `predT = (\x. T)`;; +let predI = new_definition `predI p1 p2 = (\x. p1 x /\ p2 x)`;; +let predU = new_definition `predU p1 p2 = (\x. p1 x \/ p2 x)`;; +let predC = new_definition `predC p = (\x. ~p x)`;; +let predD = new_definition `predD p1 p2 = (\x. ~p2 x /\ p1 x)`;; +let preim = new_definition `preim f (d:A->bool) = (\x. d (f x))`;; +let relU = new_definition `relU r1 r2 = (\x y. r1 x y \/ r2 x y)`;; + +(* Lemma subrelUl *) +let subrelUl = Sections.section_proof ["r1";"r2"] +`subrel r1 (relU r1 r2)` +[ + (((((use_arg_then2 ("relU", [relU]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subrel", [subrel]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma subrelUr *) +let subrelUr = Sections.section_proof ["r1";"r2"] +`subrel r2 (relU r1 r2)` +[ + (((((use_arg_then2 ("relU", [relU]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subrel", [subrel]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Close the module *) +end;; diff --git a/jHOLLight/Examples/ssrfun-compiled.hl b/jHOLLight/Examples/ssrfun-compiled.hl new file mode 100644 index 0000000..0d6d88d --- /dev/null +++ b/jHOLLight/Examples/ssrfun-compiled.hl @@ -0,0 +1,371 @@ + +(* Module Ssrfun*) +module Ssrfun = struct + +let oapp = define `!f x y. oapp f x (SOME y) = f y /\ oapp f x NONE = x`;; +let odflt = new_definition `odflt = oapp I`;; +let obind = new_definition `obind f = oapp f NONE`;; +let omap = new_definition `omap f = obind (\x. SOME (f x))`;; +let pcomp = new_definition `pcomp f g x = obind f (g x)`;; + +(* Lemma odflt_alt *) +let odflt_alt = Sections.section_proof ["x"] +`(!y. odflt x (SOME y) = y) /\ odflt x NONE = x` +[ + (((((use_arg_then2 ("odflt", [odflt]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("oapp", [oapp]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma obind_alt *) +let obind_alt = Sections.section_proof ["f"] +`obind f NONE = NONE /\ (!x. obind f (SOME x) = f x)` +[ + (((((use_arg_then2 ("obind", [obind]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("oapp", [oapp]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma omap_alt *) +let omap_alt = Sections.section_proof ["f"] +`omap f NONE = NONE /\ (!x. omap f (SOME x) = SOME (f x))` +[ + (((((use_arg_then2 ("omap", [omap]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("obind", [obind]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("oapp", [oapp]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma eq_sym *) +let eq_sym = Sections.section_proof ["x";"y"] +`x = y ==> y = x` +[ + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eq_trans *) +let eq_trans = Sections.section_proof ["x";"y";"z"] +`x = y ==> y = z ==> x = z` +[ + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma f_equal *) +let f_equal = Sections.section_proof ["f";"x";"y"] +`x = y ==> f x = f y` +[ + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma f_equal2 *) +let f_equal2 = Sections.section_proof ["f";"x1";"y1";"x2";"y2"] +`x1 = y1 ==> x2 = y2 ==> f x1 x2 = f y1 y2` +[ + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +let erefl = eq_sym;; +let esym = eq_sym;; +let etrans = eq_trans;; +let congr1 = f_equal;; +let congr2 = f_equal2;; + +(* Lemma eq_ext *) +let eq_ext = Sections.section_proof ["f";"g"] +`(!x. f x = g x) <=> f = g` +[ + (((THENL) (split_tac) [(DISCH_THEN (fun snd_th -> (use_arg_then2 ("EQ_EXT", [EQ_EXT])) (thm_tac (match_mp_then snd_th MP_TAC)))); (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))]) THEN (done_tac)); +];; + +(* Section Injections *) +Sections.begin_section "Injections";; +(Sections.add_section_var (mk_var ("f", (`:A -> R`))));; +let injective = new_definition `injective f <=> (!x1 x2. f x1 = f x2 ==> x1 = x2)`;; +let cancel = new_definition `cancel f g <=> !x. g (f x) = x`;; +let pcancel = new_definition `pcancel f g <=> !x. g (f x) = SOME x`;; +let ocancel = new_definition `ocancel g h <=> !x. oapp h x (g x) = x`;; + +(* Lemma can_pcan *) +let can_pcan = Sections.section_proof ["g"] +`cancel f g ==> pcancel f (\y. SOME (g y))` +[ + (((((use_arg_then2 ("cancel", [cancel]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pcancel", [pcancel]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma pcan_inj *) +let pcan_inj = Sections.section_proof ["g"] +`pcancel f g ==> injective f` +[ + (((((use_arg_then2 ("pcancel", [pcancel]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("injective", [injective]))(thm_tac (new_rewrite [] []))))) THEN (move ["can"]) THEN (move ["x1"]) THEN (move ["x2"]) THEN (move ["f_eq"])); + ((((fun arg_tac -> (use_arg_then2 ("can", [])) (fun fst_arg -> (use_arg_then2 ("x2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then2 ("can", [])) (fun fst_arg -> (use_arg_then2 ("x1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (injectivity "option")))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma can_inj *) +let can_inj = Sections.section_proof ["g"] +`cancel f g ==> injective f` +[ + (((((use_arg_then2 ("cancel", [cancel]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("injective", [injective]))(thm_tac (new_rewrite [] []))))) THEN (move ["can"]) THEN (move ["x1"]) THEN (move ["x2"]) THEN (move ["f_eq"])); + (((((fun arg_tac -> (use_arg_then2 ("can", [])) (fun fst_arg -> (use_arg_then2 ("x1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("can", [])) (fun fst_arg -> (use_arg_then2 ("x2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma canLR *) +let canLR = Sections.section_proof ["g";"x";"y"] +`cancel f g ==> x = f y ==> g x = y` +[ + (((((use_arg_then2 ("cancel", [cancel]))(thm_tac (new_rewrite [] [])))) THEN (move ["can"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma canRL *) +let canRL = Sections.section_proof ["g";"x";"y"] +`cancel f g ==> f x = y ==> x = g y` +[ + (((((use_arg_then2 ("cancel", [cancel]))(thm_tac (new_rewrite [] [])))) THEN (move ["can"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section Injections *) +let can_pcan = Sections.finalize_theorem can_pcan;; +let pcan_inj = Sections.finalize_theorem pcan_inj;; +let can_inj = Sections.finalize_theorem can_inj;; +let canLR = Sections.finalize_theorem canLR;; +let canRL = Sections.finalize_theorem canRL;; +Sections.end_section "Injections";; + +(* Lemma some_inj *) +let some_inj = Sections.section_proof [] +`injective SOME` +[ + (((((use_arg_then2 ("injective", [injective]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (injectivity "option")))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section InjectionsTheory *) +Sections.begin_section "InjectionsTheory";; +(Sections.add_section_var (mk_var ("f", (`:B -> A`))); Sections.add_section_var (mk_var ("g", (`:B -> A`))));; +(Sections.add_section_var (mk_var ("h", (`:C -> B`))));; + +(* Lemma inj_id *) +let inj_id = Sections.section_proof [] +`injective I` +[ + (((((use_arg_then2 ("injective", [injective]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma inj_can_sym *) +let inj_can_sym = Sections.section_proof ["f'"] +`cancel f f' ==> injective f' ==> cancel f' f` +[ + (((repeat_tactic 2 0 (((use_arg_then2 ("cancel", [cancel]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("injective", [injective]))(thm_tac (new_rewrite [] []))))) THEN (move ["can1"]) THEN (move ["inj"]) THEN (move ["x"])); + ((((use_arg_then2 ("inj", [])) (disch_tac [])) THEN (clear_assumption "inj") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("can1", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma inj_comp *) +let inj_comp = Sections.section_proof [] +`injective f ==> injective h ==> injective (f o h)` +[ + (((repeat_tactic 3 0 (((use_arg_then2 ("injective", [injective]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 2 0 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN (move ["inj_f"]) THEN (move ["inj_h"]) THEN (move ["x1"]) THEN (move ["x2"])); + ((BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("inj_f", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("inj_h", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Lemma can_comp *) +let can_comp = Sections.section_proof ["f'";"h'"] +`cancel f f' ==> cancel h h' ==> cancel (f o h) (h' o f')` +[ + ((((repeat_tactic 3 0 (((use_arg_then2 ("cancel", [cancel]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 2 0 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN (move ["f_can"]) THEN (move ["h_can"]) THEN (move ["x"])) THEN (done_tac)); +];; + +(* Lemma pcan_pcomp *) +let pcan_pcomp = Sections.section_proof ["f'";"h'"] +`pcancel f f' ==> pcancel h h' ==> pcancel (f o h) (pcomp h' f')` +[ + ((((repeat_tactic 3 0 (((use_arg_then2 ("pcancel", [pcancel]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("pcomp", [pcomp]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("obind", [obind]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("oapp", [oapp]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eq_inj *) +let eq_inj = Sections.section_proof [] +`injective f ==> (!x. f x = g x) ==> injective g` +[ + (((((use_arg_then2 ("eq_ext", [eq_ext]))(thm_tac (new_rewrite [] [])))) THEN (move ["inj"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma eq_can *) +let eq_can = Sections.section_proof ["f'";"g'"] +`cancel f f' ==> (!x. f x = g x) ==> (!x. f' x = g' x) ==> cancel g g'` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("eq_ext", [eq_ext]))(thm_tac (new_rewrite [] []))))) THEN (move ["can"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma inj_can_eq *) +let inj_can_eq = Sections.section_proof ["f'"] +`cancel f f' ==> injective f' ==> cancel g f' ==> f = g` +[ + ((((repeat_tactic 2 0 (((use_arg_then2 ("cancel", [cancel]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("injective", [injective]))(thm_tac (new_rewrite [] []))))) THEN (move ["f_can"]) THEN (move ["inj"]) THEN (move ["g_can"])) THEN ((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["x"]))); + ((((use_arg_then2 ("inj", [])) (disch_tac [])) THEN (clear_assumption "inj") THEN (DISCH_THEN apply_tac)) THEN (done_tac)); +];; + +(* Finalization of the section InjectionsTheory *) +let inj_id = Sections.finalize_theorem inj_id;; +let inj_can_sym = Sections.finalize_theorem inj_can_sym;; +let inj_comp = Sections.finalize_theorem inj_comp;; +let can_comp = Sections.finalize_theorem can_comp;; +let pcan_pcomp = Sections.finalize_theorem pcan_pcomp;; +let eq_inj = Sections.finalize_theorem eq_inj;; +let eq_can = Sections.finalize_theorem eq_can;; +let inj_can_eq = Sections.finalize_theorem inj_can_eq;; +Sections.end_section "InjectionsTheory";; + +(* Section Bijections *) +Sections.begin_section "Bijections";; +(Sections.add_section_var (mk_var ("f", (`:B -> A`))));; +let bijective = new_definition `bijective f <=> ?g. cancel f g /\ cancel g f`;; +(Sections.add_section_hyp "bijf" (`bijective f`));; + +(* Lemma bij_inj *) +let bij_inj = Sections.section_proof [] +`injective f` +[ + ((((use_arg_then2 ("bijf", [])) (disch_tac [])) THEN (clear_assumption "bijf") THEN BETA_TAC) THEN ((((use_arg_then2 ("bijective", [bijective]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["g"])) THEN (case THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("can_inj", [can_inj])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac)); +];; + +(* Lemma bij_can_sym *) +let bij_can_sym = Sections.section_proof ["f'"] +`cancel f' f <=> cancel f f'` +[ + ((THENL_FIRST) (split_tac) (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("inj_can_sym", [inj_can_sym])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("bij_inj", [bij_inj])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN (done_tac))); + ((((use_arg_then2 ("bijf", [])) (disch_tac [])) THEN (clear_assumption "bijf") THEN BETA_TAC) THEN ((((use_arg_then2 ("bijective", [bijective]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["g"])) THEN (case THEN ALL_TAC)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("cancel", [cancel]))(thm_tac (new_rewrite [] []))))) THEN (move ["gf"]) THEN (move ["fg"]) THEN (move ["f'f"]) THEN (move ["x"]))); + (((((fun arg_tac -> (use_arg_then2 ("fg", [])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f'f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma bij_can_eq *) +let bij_can_eq = Sections.section_proof ["f'";"f''"] +`cancel f f' ==> cancel f f'' ==> f' = f''` +[ + (((((fun arg_tac -> (use_arg_then2 ("bij_can_sym", [bij_can_sym])) (fun fst_arg -> (use_arg_then2 ("f''", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("bij_can_sym", [bij_can_sym]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["can1"]) THEN (move ["can2"])); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("inj_can_eq", [inj_can_eq])) (fun fst_arg -> (use_arg_then2 ("can1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("bij_inj", [bij_inj])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("can2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (done_tac)); +];; + +(* Finalization of the section Bijections *) +let bij_inj = Sections.finalize_theorem bij_inj;; +let bij_can_sym = Sections.finalize_theorem bij_can_sym;; +let bij_can_eq = Sections.finalize_theorem bij_can_eq;; +Sections.end_section "Bijections";; + +(* Section BijectionsTheory *) +Sections.begin_section "BijectionsTheory";; +(Sections.add_section_var (mk_var ("f", (`:BB -> AA`))));; +(Sections.add_section_var (mk_var ("h", (`:CC -> BB`))));; + +(* Lemma eq_bij *) +let eq_bij = Sections.section_proof [] +`bijective f ==> !g. (!x. f x = g x) ==> bijective g` +[ + (((((use_arg_then2 ("eq_ext", [eq_ext]))(thm_tac (new_rewrite [] [])))) THEN (move ["bij"]) THEN (move ["g"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma bij_comp *) +let bij_comp = Sections.section_proof [] +`bijective f ==> bijective h ==> bijective (f o h)` +[ + ((repeat_tactic 3 0 (((use_arg_then2 ("bijective", [bijective]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["g"])) THEN (case THEN ((move ["can_fg"]) THEN (move ["can_gf"]))) THEN (case THEN ((move ["r"]) THEN (case THEN ((move ["can_hr"]) THEN (move ["can_rh"])))))); + (((fun arg_tac -> arg_tac (Arg_term (`r o g`))) (term_tac exists_tac)) THEN (split_tac)); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("can_comp", [can_comp])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("r", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("can_fg", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC) THEN (DISCH_THEN apply_tac) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("can_comp", [can_comp])) (fun fst_arg -> (use_arg_then2 ("r", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("g", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("can_rh", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC) THEN (DISCH_THEN apply_tac) THEN (done_tac)); +];; + +(* Lemma bij_can_bij *) +let bij_can_bij = Sections.section_proof [] +`bijective f ==> !f'. cancel f f' ==> bijective f'` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("bij_can_sym", [bij_can_sym])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["can_sym"]) THEN (move ["f'"]) THEN (move ["can_ff'"])) THEN (((use_arg_then2 ("bijective", [bijective]))(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("f", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("can_sym", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section BijectionsTheory *) +let eq_bij = Sections.finalize_theorem eq_bij;; +let bij_comp = Sections.finalize_theorem bij_comp;; +let bij_can_bij = Sections.finalize_theorem bij_can_bij;; +Sections.end_section "BijectionsTheory";; + +(* Section Involutions *) +Sections.begin_section "Involutions";; +(Sections.add_section_var (mk_var ("f", (`:A -> A`))));; +let involutive = new_definition `involutive f <=> cancel f f`;; +(Sections.add_section_hyp "Hf" (`involutive f`));; + +(* Lemma inv_inj *) +let inv_inj = Sections.section_proof [] +`injective f` +[ + ((((use_arg_then2 ("Hf", [])) (disch_tac [])) THEN (clear_assumption "Hf") THEN BETA_TAC) THEN ((((use_arg_then2 ("involutive", [involutive]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("can_inj", [can_inj])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Lemma inv_bij *) +let inv_bij = Sections.section_proof [] +`bijective f` +[ + ((((use_arg_then2 ("bijective", [bijective]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("f", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("Hf", [])) (disch_tac [])) THEN (clear_assumption "Hf") THEN BETA_TAC) THEN (((use_arg_then2 ("involutive", [involutive]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section Involutions *) +let inv_inj = Sections.finalize_theorem inv_inj;; +let inv_bij = Sections.finalize_theorem inv_bij;; +Sections.end_section "Involutions";; + +(* Section OperationProperties *) +Sections.begin_section "OperationProperties";; + +(* Section SopTisR *) +Sections.begin_section "SopTisR";; +let left_inverse = new_definition `left_inverse e inv op = !x. op (inv x) x = e`;; +let right_inverse = new_definition `right_inverse e inv op = !x. op x (inv x) = e`;; +let left_injective = new_definition `left_injective op = !x. injective (\y. op y x)`;; +let right_injective = new_definition `right_injective op = !y. injective (op y)`;; + +(* Finalization of the section SopTisR *) +Sections.end_section "SopTisR";; + +(* Section SopTisS *) +Sections.begin_section "SopTisS";; +let right_id = new_definition `right_id e op = !x. op x e = x`;; +let left_zero = new_definition `left_zero z op = !x. op z x = z`;; +let right_commutative = new_definition + `right_commutative op = !x y z. op (op x y) z = op (op x z) y`;; +let left_distributive = new_definition + `left_distributive op add = !x y z. op (add x y) z = add (op x z) (op y z)`;; +let right_loop = new_definition + `right_loop inv op = !y. cancel (\x. op x y) (\x. op x (inv y))`;; +let rev_right_loop = new_definition + `rev_right_loop inv op = !y. cancel (\x. op x (inv y)) (\x. op x y)`;; + +(* Finalization of the section SopTisS *) +Sections.end_section "SopTisS";; + +(* Section SopTisT *) +Sections.begin_section "SopTisT";; +let left_id = new_definition `left_id e op = !x. op e x = x`;; +let right_zero = new_definition `right_zero z op = !x. op x z = z`;; +let left_commutative = new_definition + `left_commutative op = !x y z. op x (op y z) = op y (op x z)`;; +let right_distributive = new_definition + `right_distributive op add = !x y z. op x (add y z) = add (op x y) (op x z)`;; +let left_loop = new_definition + `left_loop inv op = !x. cancel (op x) (op (inv x))`;; +let rev_left_loop = new_definition + `rev_left_loop inv op = !x. cancel (op (inv x)) (op x)`;; + +(* Finalization of the section SopTisT *) +Sections.end_section "SopTisT";; + +(* Section SopSisT *) +Sections.begin_section "SopSisT";; +let self_inverse = new_definition `self_inverse e op = !x. op x x = e`;; +let commutative = new_definition `commutative op = !x y. op x y = op y x`;; + +(* Finalization of the section SopSisT *) +Sections.end_section "SopSisT";; + +(* Section SopSisS *) +Sections.begin_section "SopSisS";; +let idempotent = new_definition `idempotent op = !x. op x x = x`;; +let associative = new_definition `associative op = !x y z. op x (op y z) = op (op x y) z`;; + +(* Finalization of the section SopSisS *) +Sections.end_section "SopSisS";; + +(* Finalization of the section OperationProperties *) +Sections.end_section "OperationProperties";; + +(* Close the module *) +end;; diff --git a/jHOLLight/Examples/ssrnat-compiled.hl b/jHOLLight/Examples/ssrnat-compiled.hl new file mode 100644 index 0000000..c08d50b --- /dev/null +++ b/jHOLLight/Examples/ssrnat-compiled.hl @@ -0,0 +1,2221 @@ +needs "Examples/ssrbool-compiled.hl";; + +(* Module Ssrnat*) +module Ssrnat = struct + +open Ssrbool;; +overload_interface("+", `XOR`);; +prioritize_num();; + +(* Lemma succnK *) +let succnK = Sections.section_proof ["n"] +`SUC n - 1 = n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma succn_inj *) +let succn_inj = Sections.section_proof ["n";"m"] +`SUC n = SUC m ==> n = m` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma eqSS *) +let eqSS = Sections.section_proof ["m";"n"] +`(SUC m = SUC n) = (m = n)` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma add0n *) +let add0n = Sections.section_proof ["n"] +`0 + n = n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma addSn *) +let addSn = Sections.section_proof ["m";"n"] +`SUC m + n = SUC (m + n)` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma add1n *) +let add1n = Sections.section_proof ["n"] +`1 + n = SUC n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma addn0 *) +let addn0 = Sections.section_proof ["n"] +`n + 0 = n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma addnS *) +let addnS = Sections.section_proof ["m";"n"] +`m + SUC n = SUC (m + n)` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma addSnnS *) +let addSnnS = Sections.section_proof ["m";"n"] +`SUC m + n = m + SUC n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma addnCA *) +let addnCA = Sections.section_proof ["m";"n";"p"] +`m + (n + p) = n + (m + p)` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma addnC *) +let addnC = Sections.section_proof ["m";"n"] +`m + n = n + m` +[ + (((((fun arg_tac -> (use_arg_then2 ("addn0", [addn0])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("addnCA", [addnCA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addn0", [addn0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma addn1 *) +let addn1 = Sections.section_proof ["n"] +`n + 1 = SUC n` +[ + (((((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add1n", [add1n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma addnA *) +let addnA = Sections.section_proof ["n";"m";"p"] +`n + (m + p) = (n + m) + p` +[ + (((((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] [(`m + p`)])))) THEN (((use_arg_then2 ("addnCA", [addnCA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma addnAC *) +let addnAC = Sections.section_proof ["m";"n";"p"] +`(n + m) + p = (n + p) + m` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("addnA", [addnA]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] [(`p + m`)]))))) THEN (done_tac)); +];; + +(* Lemma addn_eq0 *) +let addn_eq0 = Sections.section_proof ["m";"n"] +`(m + n = 0) <=> (m = 0) /\ (n = 0)` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma eqn_addl *) +let eqn_addl = Sections.section_proof ["p";"m";"n"] +`(p + m = p + n) <=> (m = n)` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma eqn_addr *) +let eqn_addr = Sections.section_proof ["p";"m";"n"] +`(m + p = n + p) = (m = n)` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma addnI *) +let addnI = Sections.section_proof ["m";"n1";"n2"] +`m + n1 = m + n2 ==> n1 = n2` +[ + ((BETA_TAC THEN (move ["Heq"])) THEN (((fun arg_tac -> (use_arg_then2 ("eqn_addl", [eqn_addl])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma addIn *) +let addIn = Sections.section_proof ["m";"n1";"n2"] +`n1 + m = n2 + m ==> n1 = n2` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("addnC", [addnC]))(gsym_then (thm_tac (new_rewrite [] [(`_1 + m`)])))))) THEN (move ["Heq"])); + ((((fun arg_tac -> (use_arg_then2 ("addnI", [addnI])) (fun fst_arg -> (use_arg_then2 ("Heq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (done_tac)); +];; + +(* Lemma sub0n *) +let sub0n = Sections.section_proof ["n"] +`0 - n = 0` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma subn0 *) +let subn0 = Sections.section_proof ["n"] +`n - 0 = n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma subnn *) +let subnn = Sections.section_proof [] +`!n. n - n = 0` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma subSS *) +let subSS = Sections.section_proof [] +`!n m. SUC m - SUC n = m - n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma subn_add2l *) +let subn_add2l = Sections.section_proof [] +`!p m n. (p + m) - (p + n) = m - n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma subn_add2r *) +let subn_add2r = Sections.section_proof [] +`!p m n. (m + p) - (n + p) = m - n` +[ + (BETA_TAC THEN (move ["p"]) THEN (move ["m"]) THEN (move ["n"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("addnC", [addnC]))(gsym_then (thm_tac (new_rewrite [] [(`_1 + p`)])))))) THEN (((use_arg_then2 ("subn_add2l", [subn_add2l]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma addKn *) +let addKn = Sections.section_proof ["n"] +`!x. (n + x) - n = x` +[ + ((BETA_TAC THEN (move ["m"])) THEN ((((use_arg_then2 ("addn0", [addn0]))(gsym_then (thm_tac (new_rewrite [2] [(`n`)]))))) THEN (((use_arg_then2 ("subn_add2l", [subn_add2l]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subn0", [subn0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma addnK *) +let addnK = Sections.section_proof [] +`!n x. (x + n) - n = x` +[ + ((BETA_TAC THEN (move ["n"]) THEN (move ["m"])) THEN ((((fun arg_tac -> (use_arg_then2 ("addnC", [addnC])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addKn", [addKn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma subSnn *) +let subSnn = Sections.section_proof ["n"] +`SUC n - n = 1` +[ + (((((use_arg_then2 ("add1n", [add1n]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addnK", [addnK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma subn_sub *) +let subn_sub = Sections.section_proof ["m";"n";"p"] +`(n - m) - p = n - (m + p)` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma subnAC *) +let subnAC = Sections.section_proof [] +`!m n p. (m - n) - p = (m - p) - n` +[ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["p"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("subn_sub", [subn_sub]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma predn_sub *) +let predn_sub = Sections.section_proof [] +`!m n. (m - n) - 1 = m - SUC n` +[ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n"])) THEN ((((use_arg_then2 ("subn_sub", [subn_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addn1", [addn1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma predn_subS *) +let predn_subS = Sections.section_proof [] +`!m n. (SUC m - n) - 1 = m - n` +[ + (((((use_arg_then2 ("predn_sub", [predn_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subSS", [subSS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltnS *) +let ltnS = Sections.section_proof [] +`!m n. (m < SUC n) = (m <= n)` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma leq0n *) +let leq0n = Sections.section_proof [] +`!n. 0 <= n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma ltn0Sn *) +let ltn0Sn = Sections.section_proof [] +`!n. 0 < SUC n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma ltn0 *) +let ltn0 = Sections.section_proof [] +`!n. n < 0 <=> F` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma leqnn *) +let leqnn = Sections.section_proof [] +`!n. n <= n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma ltnSn *) +let ltnSn = Sections.section_proof [] +`!n. n < SUC n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma eq_leq *) +let eq_leq = Sections.section_proof [] +`!m n. m = n ==> m <= n` +[ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma leqnSn *) +let leqnSn = Sections.section_proof [] +`!n. n <= SUC n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma leq_pred *) +let leq_pred = Sections.section_proof [] +`!n. n - 1 <= n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma leqSpred *) +let leqSpred = Sections.section_proof [] +`!n. n <= SUC (n - 1)` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma ltn_predK *) +let ltn_predK = Sections.section_proof [] +`!m n. m < n ==> SUC (n - 1) = n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma prednK *) +let prednK = Sections.section_proof [] +`!n. 0 < n ==> SUC (n - 1) = n` +[ + ((BETA_TAC THEN (move ["n"]) THEN (move ["H"])) THEN (((fun arg_tac -> (use_arg_then2 ("ltn_predK", [ltn_predK])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac))); +];; + +(* Lemma leqNgt *) +let leqNgt = Sections.section_proof [] +`!m n. (m <= n) <=> ~(n < m)` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma ltnNge *) +let ltnNge = Sections.section_proof [] +`!m n. (m < n) = ~(n <= m)` +[ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n"])) THEN (((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma ltnn *) +let ltnn = Sections.section_proof [] +`!n. n < n <=> F` +[ + ((BETA_TAC THEN (move ["n"])) THEN ((((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leqn0 *) +let leqn0 = Sections.section_proof [] +`!n. (n <= 0) = (n = 0)` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma lt0n *) +let lt0n = Sections.section_proof [] +`!n. (0 < n) = ~(n = 0)` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma lt0n_neq0 *) +let lt0n_neq0 = Sections.section_proof [] +`!n. 0 < n ==> ~(n = 0)` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma eqn0Ngt *) +let eqn0Ngt = Sections.section_proof [] +`!n. (n = 0) = ~(0 < n)` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma neq0_lt0n *) +let neq0_lt0n = Sections.section_proof [] +`!n. (n = 0) = F ==> 0 < n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma eqn_leq *) +let eqn_leq = Sections.section_proof [] +`!m n. (m = n) = (m <= n /\ n <= m)` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma anti_leq *) +let anti_leq = Sections.section_proof [] +`!m n. m <= n /\ n <= m ==> m = n` +[ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n"])) THEN (((use_arg_then2 ("eqn_leq", [eqn_leq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma neq_ltn *) +let neq_ltn = Sections.section_proof [] +`!m n. ~(m = n) <=> (m < n) \/ (n < m)` +[ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"])); + (((((use_arg_then2 ("eqn_leq", [eqn_leq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbC", [orbC]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ltnNge", [ltnNge]))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); +];; + +(* Lemma leq_eqVlt *) +let leq_eqVlt = Sections.section_proof ["m";"n"] +`(m <= n) <=> (m = n) \/ (m < n)` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma eq_sym *) +let eq_sym = Sections.section_proof [] +`!x y:A. x = y <=> y = x` +[ + ((((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ])) (disch_tac [])) THEN (clear_assumption "EQ_SYM_EQ") THEN BETA_TAC) THEN (done_tac)); +];; + +(* Lemma ltn_neqAle *) +let ltn_neqAle = Sections.section_proof [] +`!m n. (m < n) <=> ~(m = n) /\ (m <= n)` +[ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"])); + (((((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_eqVlt", [leq_eqVlt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqNgt", [leqNgt]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [(`n = m`)]))))) THEN (done_tac)); +];; + +(* Lemma leq_trans *) +let leq_trans = Sections.section_proof [] +`!n m p. m <= n ==> n <= p ==> m <= p` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma ltE *) +let ltE = Sections.section_proof [] +`!n m. n < m <=> SUC n <= m` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma leqSS *) +let leqSS = Sections.section_proof [] +`!n m. SUC n <= SUC m <=> n <= m` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma leq_ltn_trans *) +let leq_ltn_trans = Sections.section_proof [] +`!n m p. m <= n ==> n < p ==> m < p` +[ + (BETA_TAC THEN (move ["n"]) THEN (move ["m"]) THEN (move ["p"]) THEN (move ["Hmn"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leq_trans", [leq_trans])) (disch_tac [])) THEN (clear_assumption "leq_trans") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)) THEN (done_tac)); +];; + +(* Lemma ltn_leq_trans *) +let ltn_leq_trans = Sections.section_proof ["n";"m";"p"] +`m < n ==> n <= p ==> m < p` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma ltnW *) +let ltnW = Sections.section_proof [] +`!m n. m < n ==> m <= n` +[ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n"])) THEN (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_trans", [leq_trans])) (disch_tac [])) THEN (clear_assumption "leq_trans") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("leqnSn", [leqnSn]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma leqW *) +let leqW = Sections.section_proof [] +`!m n. m <= n ==> m <= SUC n` +[ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["le_mn"])) THEN (((use_arg_then2 ("ltnW", [ltnW])) (disch_tac [])) THEN (clear_assumption "ltnW") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltn_trans *) +let ltn_trans = Sections.section_proof [] +`!n m p. m < n ==> n < p ==> m < p` +[ + (BETA_TAC THEN (move ["n"]) THEN (move ["m"]) THEN (move ["p"]) THEN (move ["lt_mn"])); + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("ltnW", [ltnW])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("leq_trans", [leq_trans])) (disch_tac [])) THEN (clear_assumption "leq_trans") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma geqE *) +let geqE = Sections.section_proof [] +`!m n. m >= n <=> n <= m` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma gtE *) +let gtE = Sections.section_proof ["m";"n"] +`m > n <=> n < m` +[ + (arith_tac); +];; + +(* Lemma leq_total *) +let leq_total = Sections.section_proof ["m";"n"] +`(m <= n) \/ (n <= m)` +[ + ((((((use_arg_then2 ("implyNb", [implyNb]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ltnNge", [ltnNge]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["lt_nm"])) THEN (((use_arg_then2 ("ltnW", [ltnW])) (disch_tac [])) THEN (clear_assumption "ltnW") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma leqP *) +let leqP = Sections.section_proof ["m";"n"] +`m <= n \/ n < m` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma ltnP *) +let ltnP = Sections.section_proof ["m";"n"] +`m < n \/ n <= m` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma posnP *) +let posnP = Sections.section_proof ["n"] +`n = 0 \/ 0 < n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma ltngtP *) +let ltngtP = Sections.section_proof ["m";"n"] +`m < n \/ n < m \/ m = n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma leq_add2l *) +let leq_add2l = Sections.section_proof [] +`!p m n. (p + m <= p + n) = (m <= n)` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma ltn_add2l *) +let ltn_add2l = Sections.section_proof [] +`!p m n. (p + m < p + n) = (m < n)` +[ + (BETA_TAC THEN (move ["p"]) THEN (move ["m"]) THEN (move ["n"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addnS", [addnS]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leq_add2l", [leq_add2l]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_add2r *) +let leq_add2r = Sections.section_proof ["p";"m";"n"] +`(m + p <= n + p) = (m <= n)` +[ + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("addnC", [addnC])) (fun fst_arg -> (use_arg_then2 ("p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("leq_add2l", [leq_add2l]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltn_add2r *) +let ltn_add2r = Sections.section_proof [] +`!p m n. (m + p < n + p) = (m < n)` +[ + (BETA_TAC THEN (move ["p"]) THEN (move ["m"]) THEN (move ["n"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addSn", [addSn]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leq_add2r", [leq_add2r]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_add *) +let leq_add = Sections.section_proof [] +`!m1 m2 n1 n2. m1 <= n1 ==> m2 <= n2 ==> m1 + m2 <= n1 + n2` +[ + (BETA_TAC THEN (move ["m1"]) THEN (move ["m2"]) THEN (move ["n1"]) THEN (move ["n2"]) THEN (move ["le_mn1"]) THEN (move ["le_mn2"])); + (((((fun arg_tac -> (use_arg_then2 ("leq_trans", [leq_trans])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m1 + n2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_add2l", [leq_add2l]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_add2r", [leq_add2r]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_addr *) +let leq_addr = Sections.section_proof [] +`!m n. n <= n + m` +[ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"])); + (((((use_arg_then2 ("addn0", [addn0]))(gsym_then (thm_tac (new_rewrite [1] [(`n`)]))))) THEN (((use_arg_then2 ("leq_add2l", [leq_add2l]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq0n", [leq0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_addl *) +let leq_addl = Sections.section_proof [] +`!m n. n <= m + n` +[ + (((((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_addr", [leq_addr]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltn_addr *) +let ltn_addr = Sections.section_proof ["m";"n";"p"] +`m < n ==> m < n + p` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] []))))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("leq_trans", [leq_trans])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leq_addr", [leq_addr]))(thm_tac (new_rewrite [] []))))); +];; + +(* Lemma ltn_addl *) +let ltn_addl = Sections.section_proof [] +`!m n p. m < n ==> m < p + n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma addn_gt0 *) +let addn_gt0 = Sections.section_proof [] +`!m n. (0 < m + n) <=> (0 < m) \/ (0 < n)` +[ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("lt0n", [lt0n]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addn_eq0", [addn_eq0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma subn_gt0 *) +let subn_gt0 = Sections.section_proof ["m";"n"] +`(0 < n - m) = (m < n)` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma subn_eq0 *) +let subn_eq0 = Sections.section_proof [] +`!m n. (m - n = 0) = (m <= n)` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma leqE *) +let leqE = Sections.section_proof [] +`!m n. m <= n <=> m - n = 0` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma leq_sub_add *) +let leq_sub_add = Sections.section_proof [] +`!m n p. (m - n <= p) = (m <= n + p)` +[ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["p"])); + (((((use_arg_then2 ("subn_eq0", [subn_eq0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("subn_sub", [subn_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqE", [leqE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma leq_subr *) +let leq_subr = Sections.section_proof [] +`!m n. n - m <= n` +[ + (((((use_arg_then2 ("leq_sub_add", [leq_sub_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_addl", [leq_addl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma subnKC *) +let subnKC = Sections.section_proof [] +`!m n. m <= n ==> m + (n - m) = n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma subnK *) +let subnK = Sections.section_proof [] +`!m n. m <= n ==> (n - m) + m = n` +[ + ((((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subnKC", [subnKC])) (disch_tac [])) THEN (clear_assumption "subnKC") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma addn_subA *) +let addn_subA = Sections.section_proof [] +`!m n p. p <= n ==> m + (n - p) = (m + n) - p` +[ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["p"]) THEN (move ["le_pn"])); + (((((fun arg_tac -> (use_arg_then2 ("subnK", [subnK])) (fun fst_arg -> (use_arg_then2 ("le_pn", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then2 ("addnA", [addnA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnK", [addnK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma subn_subA *) +let subn_subA = Sections.section_proof [] +`!m n p. p <= n ==> m - (n - p) = (m + p) - n` +[ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["p"]) THEN (move ["le_pn"])); + (((((fun arg_tac -> (use_arg_then2 ("subnK", [subnK])) (fun fst_arg -> (use_arg_then2 ("le_pn", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then2 ("subn_add2r", [subn_add2r]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma subKn *) +let subKn = Sections.section_proof [] +`!m n. m <= n ==> n - (n - m) = m` +[ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"])); + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("subn_subA", [subn_subA])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addKn", [addKn]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma leq_subS *) +let leq_subS = Sections.section_proof [] +`!m n. m <= n ==> SUC n - m = SUC (n - m)` +[ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"])); + ((((use_arg_then2 ("add1n", [add1n]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("addn_subA", [addn_subA])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("add1n", [add1n]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma ltn_subS *) +let ltn_subS = Sections.section_proof [] +`!m n. m < n ==> n - m = SUC (n - SUC m)` +[ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["lt_mn"])) THEN ((((use_arg_then2 ("leq_subS", [leq_subS]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("subSS", [subSS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma leq_sub2r *) +let leq_sub2r = Sections.section_proof [] +`!p m n. m <= n ==> m - p <= n - p` +[ + (BETA_TAC THEN (move ["p"]) THEN (move ["m"]) THEN (move ["n"]) THEN (move ["le_mn"])); + (((((use_arg_then2 ("leq_sub_add", [leq_sub_add]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("leq_trans", [leq_trans])) (fun fst_arg -> (use_arg_then2 ("le_mn", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_sub_add", [leq_sub_add]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_sub2l *) +let leq_sub2l = Sections.section_proof [] +`!p m n. m <= n ==> p - n <= p - m` +[ + ((BETA_TAC THEN (move ["p"]) THEN (move ["m"]) THEN (move ["n"])) THEN ((((fun arg_tac -> (use_arg_then2 ("leq_add2r", [leq_add2r])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`p - m`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leq_sub_add", [leq_sub_add]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("leq_trans", [leq_trans])) (disch_tac [])) THEN (clear_assumption "leq_trans") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("leq_sub_add", [leq_sub_add]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_sub2 *) +let leq_sub2 = Sections.section_proof [] +`!m1 m2 n1 n2. m1 <= m2 ==> n2 <= n1 ==> m1 - n1 <= m2 - n2` +[ + (BETA_TAC THEN (move ["m1"]) THEN (move ["m2"]) THEN (move ["n1"]) THEN (move ["n2"])); + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("leq_sub2r", [leq_sub2r])) (fun fst_arg -> (use_arg_then2 ("n1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["le_m12"])) THEN ((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("leq_sub2l", [leq_sub2l])) (fun fst_arg -> (use_arg_then2 ("m2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then2 ("leq_trans", [leq_trans])) (disch_tac [])) THEN (clear_assumption "leq_trans") THEN (exact_tac))); +];; + +(* Lemma ltn_sub2r *) +let ltn_sub2r = Sections.section_proof [] +`!p m n. p < n ==> m < n ==> m - p < n - p` +[ + (BETA_TAC THEN (move ["p"]) THEN (move ["m"]) THEN (move ["n"])); + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("ltn_subS", [ltn_subS])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))))); + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("leq_sub2r", [leq_sub2r])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SUC p`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then2 ("subSS", [subSS]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma ltn_sub2l *) +let ltn_sub2l = Sections.section_proof [] +`!p m n. m < p ==> m < n ==> p - n < p - m` +[ + (BETA_TAC THEN (move ["p"]) THEN (move ["m"]) THEN (move ["n"])); + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("ltn_subS", [ltn_subS])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))))); + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("leq_sub2l", [leq_sub2l])) (fun fst_arg -> (use_arg_then2 ("p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (done_tac)); +];; + +(* Lemma ltn_add_sub *) +let ltn_add_sub = Sections.section_proof [] +`!m n p. (m + n < p) = (n < p - m)` +[ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["p"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leq_sub_add", [leq_sub_add]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +let maxn = new_definition `maxn m n = if m < n then n else m`;; +let minn = new_definition `minn m n = if m < n then m else n`;; + +(* Lemma max0n *) +let max0n = Sections.section_proof [] +`!n. maxn 0 n = n` +[ + ((((use_arg_then2 ("maxn", [maxn]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma maxn0 *) +let maxn0 = Sections.section_proof [] +`!n. maxn n 0 = n` +[ + ((((use_arg_then2 ("maxn", [maxn]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma maxnC *) +let maxnC = Sections.section_proof [] +`!m n. maxn m n = maxn n m` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("maxn", [maxn]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma maxnl *) +let maxnl = Sections.section_proof [] +`!m n. n <= m ==> maxn m n = m` +[ + ((((use_arg_then2 ("maxn", [maxn]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma maxnr *) +let maxnr = Sections.section_proof [] +`!m n. m <= n ==> maxn m n = n` +[ + ((((use_arg_then2 ("maxn", [maxn]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma add_sub_maxn *) +let add_sub_maxn = Sections.section_proof [] +`!m n. m + (n - m) = maxn m n` +[ + ((((use_arg_then2 ("maxn", [maxn]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma maxnAC *) +let maxnAC = Sections.section_proof [] +`!m n p. maxn (maxn m n) p = maxn (maxn m p) n` +[ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["p"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("add_sub_maxn", [add_sub_maxn]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("addnA", [addnA]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("subn_sub", [subn_sub]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("add_sub_maxn", [add_sub_maxn]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("maxnC", [maxnC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma maxnA *) +let maxnA = Sections.section_proof [] +`!m n p. maxn m (maxn n p) = maxn (maxn m n) p` +[ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["p"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("maxnC", [maxnC]))(thm_tac (new_rewrite [] [(`maxn m _1`)]))))) THEN (((use_arg_then2 ("maxnAC", [maxnAC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma maxnCA *) +let maxnCA = Sections.section_proof [] +`!m n p. maxn m (maxn n p) = maxn n (maxn m p)` +[ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["p"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("maxnA", [maxnA]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("maxnC", [maxnC]))(thm_tac (new_rewrite [] [(`maxn m _1`)]))))) THEN (done_tac)); +];; + +(* Lemma eqn_maxr *) +let eqn_maxr = Sections.section_proof [] +`!m n. (maxn m n = n) = (m <= n)` +[ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"])); + (((((use_arg_then2 ("maxnC", [maxnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addn0", [addn0]))(gsym_then (thm_tac (new_rewrite [2] [(`n`)]))))) THEN (((use_arg_then2 ("add_sub_maxn", [add_sub_maxn]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eqn_addl", [eqn_addl]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqE", [leqE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eqn_maxl *) +let eqn_maxl = Sections.section_proof [] +`!m n. (maxn m n = m) = (n <= m)` +[ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"])); + (((((use_arg_then2 ("addn0", [addn0]))(gsym_then (thm_tac (new_rewrite [2] [(`m`)]))))) THEN (((use_arg_then2 ("add_sub_maxn", [add_sub_maxn]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eqn_addl", [eqn_addl]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqE", [leqE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma maxnn *) +let maxnn = Sections.section_proof [] +`!n. maxn n n = n` +[ + (BETA_TAC THEN (move ["n"])); + (((((use_arg_then2 ("maxnl", [maxnl]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_maxr *) +let leq_maxr = Sections.section_proof ["m";"n1";"n2"] +`(m <= maxn n1 n2) <=> (m <= n1) \/ (m <= n2)` +[ + ((fun arg_tac -> arg_tac (Arg_term (`n2 <= n1`))) (term_tac (wlog_tac (move ["le_n21"])[`n1`; `n2`]))); + (((THENL_LAST) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("leq_total", [leq_total])) (fun fst_arg -> (use_arg_then2 ("n2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["le_n12"])) ((((use_arg_then2 ("maxnC", [maxnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbC", [orbC]))(thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("le_n21", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (BETA_TAC THEN (move ["le_n21"])); + (((((use_arg_then2 ("maxn", [maxn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("le_n21", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m <= n1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (simp_tac))); + ((((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac)) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("leq_trans", [leq_trans])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("n1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN (done_tac)); +];; + +(* Lemma leq_maxl *) +let leq_maxl = Sections.section_proof ["m";"n1";"n2"] +`(maxn n1 n2 <= m) <=> (n1 <= m) /\ (n2 <= m)` +[ + (((((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_maxr", [leq_maxr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("leqNgt", [leqNgt]))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); +];; + +(* Lemma addn_maxl *) +let addn_maxl = Sections.section_proof [] +`!m1 m2 n. (maxn m1 m2) + n = maxn (m1 + n) (m2 + n)` +[ + ((BETA_TAC THEN (move ["m1"]) THEN (move ["m2"]) THEN (move ["n"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("add_sub_maxn", [add_sub_maxn]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("subn_add2r", [subn_add2r]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnAC", [addnAC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma addn_maxr *) +let addn_maxr = Sections.section_proof [] +`!m n1 n2. m + maxn n1 n2 = maxn (m + n1) (m + n2)` +[ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n1"]) THEN (move ["n2"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] [(`m + _1`)]))))) THEN (((use_arg_then2 ("addn_maxl", [addn_maxl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma min0n *) +let min0n = Sections.section_proof ["n"] +`minn 0 n = 0` +[ + ((((use_arg_then2 ("minn", [minn]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma minn0 *) +let minn0 = Sections.section_proof ["n"] +`minn n 0 = 0` +[ + ((((use_arg_then2 ("minn", [minn]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma minnC *) +let minnC = Sections.section_proof ["m";"n"] +`minn m n = minn n m` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("minn", [minn]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma minnr *) +let minnr = Sections.section_proof ["m";"n"] +`n <= m ==> minn m n = n` +[ + ((((use_arg_then2 ("minn", [minn]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma minnl *) +let minnl = Sections.section_proof ["m";"n"] +`m <= n ==> minn m n = m` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("minnr", [minnr])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then2 ("minnC", [minnC]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma addn_min_max *) +let addn_min_max = Sections.section_proof ["m";"n"] +`minn m n + maxn m n = m + n` +[ + (((((use_arg_then2 ("minn", [minn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("maxn", [maxn]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma minn_to_maxn *) +let minn_to_maxn = Sections.section_proof ["m";"n"] +`minn m n = (m + n) - maxn m n` +[ + (((((use_arg_then2 ("addn_min_max", [addn_min_max]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addnK", [addnK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sub_sub_minn *) +let sub_sub_minn = Sections.section_proof ["m";"n"] +`m - (m - n) = minn m n` +[ + (((((use_arg_then2 ("minnC", [minnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("minn_to_maxn", [minn_to_maxn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add_sub_maxn", [add_sub_maxn]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("subn_add2l", [subn_add2l]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma minnCA *) +let minnCA = Sections.section_proof [] +`!m1 m2 m3. minn m1 (minn m2 m3) = minn m2 (minn m1 m3)` +[ + ((BETA_TAC THEN (move ["m1"]) THEN (move ["m2"]) THEN (move ["m3"])) THEN (repeat_tactic 1 9 (((use_arg_then2 ("minn_to_maxn", [minn_to_maxn]))(thm_tac (new_rewrite [] [(`minn _1 (minn _2 _3)`)])))))); + ((((fun arg_tac -> (use_arg_then2 ("subn_add2r", [subn_add2r])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`maxn m2 m3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("subn_add2r", [subn_add2r])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`maxn m1 m3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [(`(m2 + _1) - _2`)]))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("addnA", [addnA]))(gsym_then (thm_tac (new_rewrite [] []))))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("addn_maxl", [addn_maxl]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("addn_min_max", [addn_min_max]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("addn_maxr", [addn_maxr]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addnCA", [addnCA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("maxnAC", [maxnAC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] [(`m2 + m1`)]))))) THEN (done_tac)); +];; + +(* Lemma minnA *) +let minnA = Sections.section_proof [] +`!m1 m2 m3. minn m1 (minn m2 m3) = minn (minn m1 m2) m3` +[ + (BETA_TAC THEN (move ["m1"]) THEN (move ["m2"]) THEN (move ["m3"])); + (((((use_arg_then2 ("minnC", [minnC]))(thm_tac (new_rewrite [] [(`minn m2 _1`)])))) THEN (((use_arg_then2 ("minnCA", [minnCA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("minnC", [minnC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma minnAC *) +let minnAC = Sections.section_proof ["m1";"m2";"m3"] +`minn (minn m1 m2) m3 = minn (minn m1 m3) m2` +[ + (((((use_arg_then2 ("minnC", [minnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("minnCA", [minnCA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("minnA", [minnA]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eqn_minr *) +let eqn_minr = Sections.section_proof ["m";"n"] +`(minn m n = n) = (n <= m)` +[ + (((fun arg_tac -> (use_arg_then2 ("eqn_addr", [eqn_addr])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("addn_min_max", [addn_min_max]))(gsym_then (thm_tac (new_rewrite [] [(`n + m`)]))))) THEN (((use_arg_then2 ("minnC", [minnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqn_addl", [eqn_addl]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [(`m = _1`)])))) THEN (((use_arg_then2 ("maxnC", [maxnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqn_maxl", [eqn_maxl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eqn_minl *) +let eqn_minl = Sections.section_proof ["m";"n"] +`(minn m n = m) = (m <= n)` +[ + (((((fun arg_tac -> (use_arg_then2 ("eqn_addr", [eqn_addr])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [(`_1 = m + n`)])))) THEN (((use_arg_then2 ("addn_min_max", [addn_min_max]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eqn_addl", [eqn_addl]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqn_maxr", [eqn_maxr]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma minnn *) +let minnn = Sections.section_proof ["n"] +`minn n n = n` +[ + (((((use_arg_then2 ("minnr", [minnr]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_minr *) +let leq_minr = Sections.section_proof ["m";"n1";"n2"] +`(m <= minn n1 n2) <=> (m <= n1) /\ (m <= n2)` +[ + ((((use_arg_then2 ("minn", [minn]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma leq_minl *) +let leq_minl = Sections.section_proof ["m";"n1";"n2"] +`(minn n1 n2 <= m) <=> (n1 <= m) \/ (n2 <= m)` +[ + (((((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_minr", [leq_minr]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("leqNgt", [leqNgt]))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); +];; + +(* Lemma addn_minl *) +let addn_minl = Sections.section_proof [] +`!m1 m2 n. (minn m1 m2) + n = minn (m1 + n) (m2 + n)` +[ + ((BETA_TAC THEN (move ["m1"]) THEN (move ["m2"]) THEN (move ["n"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("minn_to_maxn", [minn_to_maxn]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addn_maxl", [addn_maxl]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addnA", [addnA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subn_add2r", [subn_add2r]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnAC", [addnAC]))(thm_tac (new_rewrite [] [])))))); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("addnC", [addnC])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [(`_1 + n`)])))))) THEN (((use_arg_then2 ("addn_subA", [addn_subA]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("addn_min_max", [addn_min_max]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leq_addl", [leq_addl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma addn_minr *) +let addn_minr = Sections.section_proof [] +`!m n1 n2. m + minn n1 n2 = minn (m + n1) (m + n2)` +[ + (BETA_TAC THEN (move ["m"]) THEN (move ["n1"]) THEN (move ["n2"])); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("addnC", [addnC])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [(`m + _1`)]))))) THEN (((use_arg_then2 ("addn_minl", [addn_minl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma maxnK *) +let maxnK = Sections.section_proof ["m";"n"] +`minn (maxn m n) m = m` +[ + (((((use_arg_then2 ("minnr", [minnr]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("leq_maxr", [leq_maxr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma maxKn *) +let maxKn = Sections.section_proof ["m";"n"] +`minn n (maxn m n) = n` +[ + (((((use_arg_then2 ("minnC", [minnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("maxnC", [maxnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("maxnK", [maxnK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma minnK *) +let minnK = Sections.section_proof ["m";"n"] +`maxn (minn m n) m = m` +[ + (((((use_arg_then2 ("maxnr", [maxnr]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("leq_minl", [leq_minl]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma minKn *) +let minKn = Sections.section_proof ["m";"n"] +`maxn n (minn m n) = n` +[ + (((((use_arg_then2 ("minnC", [minnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("maxnC", [maxnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("minnK", [minnK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma maxn_minl *) +let maxn_minl = Sections.section_proof ["m1";"m2";"n"] +`maxn (minn m1 m2) n = minn (maxn m1 n) (maxn m2 n)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("maxn", [maxn]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("minn", [minn]))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac)); +];; + +(* Lemma maxn_minr *) +let maxn_minr = Sections.section_proof ["m";"n1";"n2"] +`maxn m (minn n1 n2) = minn (maxn m n1) (maxn m n2)` +[ + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("maxnC", [maxnC])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [(`maxn m _1`)]))))) THEN (((use_arg_then2 ("maxn_minl", [maxn_minl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma minn_maxl *) +let minn_maxl = Sections.section_proof [] +`!m1 m2 n. minn (maxn m1 m2) n = maxn (minn m1 n) (minn m2 n)` +[ + ((BETA_TAC THEN (move ["m1"]) THEN (move ["m2"]) THEN (move ["n"])) THEN ((((use_arg_then2 ("maxn_minr", [maxn_minr]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("maxn_minl", [maxn_minl]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("minnA", [minnA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("maxnn", [maxnn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("maxnC", [maxnC]))(thm_tac (new_rewrite [] [(`maxn _1 n`)])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("maxnK", [maxnK]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma minn_maxr *) +let minn_maxr = Sections.section_proof [] +`!m n1 n2. minn m (maxn n1 n2) = maxn (minn m n1) (minn m n2)` +[ + (BETA_TAC THEN (move ["m"]) THEN (move ["n1"]) THEN (move ["n2"])); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("minnC", [minnC])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [(`minn m _1`)]))))) THEN (((use_arg_then2 ("minn_maxl", [minn_maxl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Iteration *) +Sections.begin_section "Iteration";; +(Sections.add_section_var (mk_var ("m", (`:num`))); Sections.add_section_var (mk_var ("n", (`:num`))));; +(Sections.add_section_var (mk_var ("x", (`:A`))); Sections.add_section_var (mk_var ("y", (`:A`))));; +let iter = define `iter (SUC n) f (x:A) = f (iter n f x) /\ iter 0 f x = x`;; +let iteri = define `iteri (SUC n) f (x:A) = f n (iteri n f x) /\ iteri 0 f x = x`;; + +(* Lemma iterSr *) +let iterSr = Sections.section_proof ["n";"f";"x"] +`iter (SUC n) f (x : A) = iter n f (f x)` +[ + ((((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (move ["n"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma iterS *) +let iterS = Sections.section_proof ["n";"f";"x"] +`iter (SUC n) f (x:A) = f (iter n f x)` +[ + ((((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma iter_add *) +let iter_add = Sections.section_proof ["n";"m";"f";"x"] +`iter (n + m) f (x:A) = iter n f (iter m f x)` +[ + ((((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("iter", [iter]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((use_arg_then2 ("add0n", [add0n]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("addSn", [addSn]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (move ["n"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("iterS", [iterS]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma iteriS *) +let iteriS = Sections.section_proof ["n";"f";"x"] +`iteri (SUC n) f x = f n (iteri n f (x:A))` +[ + ((((use_arg_then2 ("iteri", [iteri]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Finalization of the section Iteration *) +let iterSr = Sections.finalize_theorem iterSr;; +let iterS = Sections.finalize_theorem iterS;; +let iter_add = Sections.finalize_theorem iter_add;; +let iteriS = Sections.finalize_theorem iteriS;; +Sections.end_section "Iteration";; + +(* Lemma mul0n *) +let mul0n = Sections.section_proof ["n"] +`0 * n = 0` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma muln0 *) +let muln0 = Sections.section_proof ["n"] +`n * 0 = 0` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma mul1n *) +let mul1n = Sections.section_proof ["n"] +`1 * n = n` +[ + ((arith_tac) THEN (done_tac)); +];; + +(* Lemma mulSn *) +let mulSn = Sections.section_proof ["m";"n"] +`SUC m * n = n + m * n` +[ + (arith_tac); +];; + +(* Lemma mulSnr *) +let mulSnr = Sections.section_proof ["m";"n"] +`SUC m * n = m * n + n` +[ + (arith_tac); +];; + +(* Lemma mulnS *) +let mulnS = Sections.section_proof ["m";"n"] +`m * SUC n = m + m * n` +[ + ((((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN elim) THEN (((repeat_tactic 0 10 (((use_arg_then2 ("mul0n", [mul0n]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("addn0", [addn0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["m"]))); + ((((repeat_tactic 1 9 (((use_arg_then2 ("mulSn", [mulSn]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("addSn", [addSn]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addnCA", [addnCA]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mulnSr *) +let mulnSr = Sections.section_proof ["m";"n"] +`m * SUC n = m * n + m` +[ + (((((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulnS", [mulnS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma muln1 *) +let muln1 = Sections.section_proof ["n"] +`n * 1 = n` +[ + (((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `1 = SUC 0`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulnSr", [mulnSr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("muln0", [muln0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mulnC *) +let mulnC = Sections.section_proof [] +`!m n. m * n = n * m` +[ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"])); + (((THENL) (((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; (move ["m"])]) THEN (((repeat_tactic 0 10 (((use_arg_then2 ("muln0", [muln0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mulnS", [mulnS]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mul0n", [mul0n]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mulSn", [mulSn]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma muln_addl *) +let muln_addl = Sections.section_proof ["m1";"m2";"n"] +`(m1 + m2) * n = m1 * n + m2 * n` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("m1", [])) (disch_tac [])) THEN (clear_assumption "m1") THEN elim) [ALL_TAC; ((move ["m1"]) THEN (move ["IHm"]))]) (((((use_arg_then2 ("mul0n", [mul0n]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + (((((use_arg_then2 ("mulSn", [mulSn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnA", [addnA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IHm", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mulSn", [mulSn]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addSn", [addSn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma muln_addr *) +let muln_addr = Sections.section_proof ["m";"n1";"n2"] +`m * (n1 + n2) = m * n1 + m * n2` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [(`m * _1`)]))))) THEN (((use_arg_then2 ("muln_addl", [muln_addl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma muln_subl *) +let muln_subl = Sections.section_proof [] +`!m n p. (m - n) * p = m * p - n * p` +[ + ((THENL_FIRST) (BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN ((THENL) case [ALL_TAC; (move ["n'"])])) (((repeat_tactic 1 9 (((use_arg_then2 ("muln0", [muln0]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("subn0", [subn0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; ((move ["m"]) THEN (move ["IHm"]))]) THEN ((THENL) case [ALL_TAC; (move ["n"])])) THEN ((repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("mul0n", [mul0n]))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("sub0n", [sub0n]))(fun tmp_arg1 -> (use_arg_then2 ("subn0", [subn0]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mulSn", [mulSn]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("subn_add2l", [subn_add2l]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("IHm", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("subSS", [subSS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma muln_subr *) +let muln_subr = Sections.section_proof [] +`!m n p. m * (n - p) = m * n - m * p` +[ + ((BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["p"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [(`m * _1`)]))))) THEN (((use_arg_then2 ("muln_subl", [muln_subl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mulnA *) +let mulnA = Sections.section_proof [] +`!m n p. m * (n * p) = (m * n) * p` +[ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"]) THEN (move ["p"])); + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; (move ["m"])]) ((repeat_tactic 1 9 (((use_arg_then2 ("mul0n", [mul0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((repeat_tactic 1 9 (((use_arg_then2 ("mulSn", [mulSn]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("muln_addl", [muln_addl]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mulnCA *) +let mulnCA = Sections.section_proof ["m";"n1";"n2"] +`m * (n1 * n2) = n1 * (m * n2)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("mulnA", [mulnA]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("mulnC", [mulnC])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [(`m * _1`)]))))) THEN (done_tac)); +];; + +(* Lemma mulnAC *) +let mulnAC = Sections.section_proof ["m";"n";"p"] +`(n * m) * p = (n * p) * m` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("mulnA", [mulnA]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [(`p * _1`)]))))) THEN (done_tac)); +];; + +(* Lemma muln_eq0 *) +let muln_eq0 = Sections.section_proof ["m";"n"] +`(m * n = 0) <=> (m = 0) \/ (n = 0)` +[ + ((((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN case) [ALL_TAC; (move ["m"])]) THEN ((THENL) case [ALL_TAC; (move ["n"])])) THEN ((repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("muln0", [muln0]))(fun tmp_arg1 -> (use_arg_then2 ("mul0n", [mul0n]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (arith_tac)); +];; + +(* Lemma eqn_mul1 *) +let eqn_mul1 = Sections.section_proof ["m";"n"] +`(m * n = 1) <=> (m = 1) /\ (n = 1)` +[ + ((((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN case) [ALL_TAC; ((THENL) case [ALL_TAC; (move ["m"])])]) THEN ((THENL) case [ALL_TAC; ((THENL) case [ALL_TAC; (move ["n"])])])) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma muln_gt0 *) +let muln_gt0 = Sections.section_proof ["m";"n"] +`(0 < m * n) <=> (0 < m) /\ (0 < n)` +[ + ((((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN case) [ALL_TAC; (move ["m"])]) THEN ((THENL) case [ALL_TAC; (move ["n"])])) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma leq_pmull *) +let leq_pmull = Sections.section_proof ["m";"n"] +`0 < n ==> m <= n * m` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("prednK", [prednK])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then2 ("mulSn", [mulSn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_addr", [leq_addr]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_pmulr *) +let leq_pmulr = Sections.section_proof ["m";"n"] +`0 < n ==> m <= m * n` +[ + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("leq_pmull", [leq_pmull])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma leq_mul2l *) +let leq_mul2l = Sections.section_proof ["m";"n1";"n2"] +`(m * n1 <= m * n2) <=> (m = 0) \/ (n1 <= n2)` +[ + (((((use_arg_then2 ("leqE", [leqE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("muln_subr", [muln_subr]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("muln_eq0", [muln_eq0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqE", [leqE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma leq_mul2r *) +let leq_mul2r = Sections.section_proof ["m";"n1";"n2"] +`(n1 * m <= n2 * m) <=> (m = 0) \/ (n1 <= n2)` +[ + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("mulnC", [mulnC])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [(`_1 * m`)])))))) THEN (((use_arg_then2 ("leq_mul2l", [leq_mul2l]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_mul *) +let leq_mul = Sections.section_proof ["m1";"m2";"n1";"n2"] +`m1 <= n1 ==> m2 <= n2 ==> m1 * m2 <= n1 * n2` +[ + (BETA_TAC THEN (move ["le_mn1"]) THEN (move ["le_mn2"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("leq_trans", [leq_trans])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m1 * n2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m1 * m2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n1 * n2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((THENL_FIRST) (ANTS_TAC) (((((use_arg_then2 ("leq_mul2l", [leq_mul2l]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("le_mn2", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (DISCH_THEN apply_tac); + (((((use_arg_then2 ("leq_mul2r", [leq_mul2r]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("le_mn1", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eqn_mul2l *) +let eqn_mul2l = Sections.section_proof ["m";"n1";"n2"] +`(m * n1 = m * n2) <=> (m = 0) \/ (n1 = n2)` +[ + (((((use_arg_then2 ("eqn_leq", [eqn_leq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("leq_mul2l", [leq_mul2l]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("orb_andr", [orb_andr]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eqn_leq", [eqn_leq]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma eqn_mul2r *) +let eqn_mul2r = Sections.section_proof ["m";"n1";"n2"] +`(n1 * m = n2 * m) <=> (m = 0) \/ (n1 = n2)` +[ + (((((use_arg_then2 ("eqn_leq", [eqn_leq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("leq_mul2r", [leq_mul2r]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("orb_andr", [orb_andr]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eqn_leq", [eqn_leq]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma leq_pmul2l *) +let leq_pmul2l = Sections.section_proof ["m";"n1";"n2"] +`0 < m ==> ((m * n1 <= m * n2) <=> (n1 <= n2))` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("prednK", [prednK])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("leq_mul2l", [leq_mul2l]))(thm_tac (new_rewrite [] [])))) THEN ((((use_arg_then2 ("NOT_SUC", [NOT_SUC]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("orFb", [orFb]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma leq_pmul2r *) +let leq_pmul2r = Sections.section_proof ["m";"n1";"n2"] +`0 < m ==> ((n1 * m <= n2 * m) <=> (n1 <= n2))` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("prednK", [prednK])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("leq_mul2r", [leq_mul2r]))(thm_tac (new_rewrite [] [])))) THEN ((((use_arg_then2 ("NOT_SUC", [NOT_SUC]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("orFb", [orFb]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma eqn_pmul2l *) +let eqn_pmul2l = Sections.section_proof ["m";"n1";"n2"] +`0 < m ==> ((m * n1 = m * n2) <=> (n1 = n2))` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("prednK", [prednK])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("eqn_mul2l", [eqn_mul2l]))(thm_tac (new_rewrite [] [])))) THEN ((((use_arg_then2 ("NOT_SUC", [NOT_SUC]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("orFb", [orFb]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma eqn_pmul2r *) +let eqn_pmul2r = Sections.section_proof ["m";"n1";"n2"] +`0 < m ==> ((n1 * m = n2 * m) <=> (n1 = n2))` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("prednK", [prednK])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("eqn_mul2r", [eqn_mul2r]))(thm_tac (new_rewrite [] [])))) THEN ((((use_arg_then2 ("NOT_SUC", [NOT_SUC]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("orFb", [orFb]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma ltn_mul2l *) +let ltn_mul2l = Sections.section_proof ["m";"n1";"n2"] +`(m * n1 < m * n2) <=> (0 < m) /\ (n1 < n2)` +[ + (((((use_arg_then2 ("lt0n", [lt0n]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leq_mul2l", [leq_mul2l]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltn_mul2r *) +let ltn_mul2r = Sections.section_proof ["m";"n1";"n2"] +`(n1 * m < n2 * m) <=> (0 < m) /\ (n1 < n2)` +[ + (((((use_arg_then2 ("lt0n", [lt0n]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leq_mul2r", [leq_mul2r]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltn_pmul2l *) +let ltn_pmul2l = Sections.section_proof ["m";"n1";"n2"] +`0 < m ==> ((m * n1 < m * n2) <=> (n1 < n2))` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("prednK", [prednK])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then2 ("ltn_mul2l", [ltn_mul2l]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LT_0", [LT_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltn_pmul2r *) +let ltn_pmul2r = Sections.section_proof ["m";"n1";"n2"] +`0 < m ==> (n1 * m < n2 * m <=> n1 < n2)` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("prednK", [prednK])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then2 ("ltn_mul2r", [ltn_mul2r]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LT_0", [LT_0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltn_Pmull *) +let ltn_Pmull = Sections.section_proof ["m";"n"] +`1 < n ==> 0 < m ==> m < n * m` +[ + ((BETA_TAC THEN (move ["lt1n"]) THEN (move ["m_gt0"])) THEN ((((use_arg_then2 ("mul1n", [mul1n]))(gsym_then (thm_tac (new_rewrite [1] [(`m`)]))))) THEN (((use_arg_then2 ("ltn_pmul2r", [ltn_pmul2r]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltn_Pmulr *) +let ltn_Pmulr = Sections.section_proof ["m";"n"] +`1 < n ==> 0 < m ==> m < m * n` +[ + ((BETA_TAC THEN (move ["lt1n"]) THEN (move ["m_gt0"])) THEN ((((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn_Pmull", [ltn_Pmull]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltn_mul *) +let ltn_mul = Sections.section_proof ["m1";"m2";"n1";"n2"] +`m1 < n1 ==> m2 < n2 ==> m1 * m2 < n1 * n2` +[ + (BETA_TAC THEN (move ["lt_mn1"]) THEN (move ["lt_mn2"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("leq_ltn_trans", [leq_ltn_trans])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m1 * n2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m1 * m2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n1 * n2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (ANTS_TAC); + (((((use_arg_then2 ("leq_mul2l", [leq_mul2l]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbC", [orbC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (DISCH_THEN apply_tac); + ((((use_arg_then2 ("ltn_pmul2r", [ltn_pmul2r]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("lt_mn2", [])) (disch_tac [])) THEN (clear_assumption "lt_mn2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma maxn_mulr *) +let maxn_mulr = Sections.section_proof ["m";"n1";"n2"] +`m * maxn n1 n2 = maxn (m * n1) (m * n2)` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN case) [ALL_TAC; (move ["n"])]) (((repeat_tactic 1 9 (((use_arg_then2 ("mul0n", [mul0n]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("maxnn", [maxnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("maxn", [maxn]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fun_if", [fun_if]))(thm_tac (new_rewrite [] [(`SUC n * _1`)])))) THEN (((use_arg_then2 ("ltn_pmul2l", [ltn_pmul2l]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("LT_0", [LT_0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma maxn_mull *) +let maxn_mull = Sections.section_proof ["m1";"m2";"n"] +`maxn m1 m2 * n = maxn (m1 * n) (m2 * n)` +[ + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("mulnC", [mulnC])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [(`_1 * n`)])))))) THEN (((use_arg_then2 ("maxn_mulr", [maxn_mulr]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma minn_mulr *) +let minn_mulr = Sections.section_proof ["m";"n1";"n2"] +`m * minn n1 n2 = minn (m * n1) (m * n2)` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN case) [ALL_TAC; (move ["n"])]) (((repeat_tactic 1 9 (((use_arg_then2 ("mul0n", [mul0n]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("minn", [minn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("if_same", [if_same]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("minn", [minn]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fun_if", [fun_if]))(thm_tac (new_rewrite [] [(`SUC n * _1`)])))) THEN (((use_arg_then2 ("ltn_pmul2l", [ltn_pmul2l]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("LT_0", [LT_0]))(thm_tac (new_rewrite [] []))))); +];; + +(* Lemma minn_mull *) +let minn_mull = Sections.section_proof ["m1";"m2";"n"] +`minn m1 m2 * n = minn (m1 * n) (m2 * n)` +[ + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("mulnC", [mulnC])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [(`_1 * n`)])))))) THEN (((use_arg_then2 ("minn_mulr", [minn_mulr]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +parse_as_infix("^", (24, "left"));; +override_interface("^", `EXP`);; + +(* Lemma expn0 *) +let expn0 = Sections.section_proof ["m"] +`m ^ 0 = 1` +[ + ((((use_arg_then2 ("EXP", [EXP]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma expn1 *) +let expn1 = Sections.section_proof ["m"] +`m ^ 1 = m` +[ + ((((use_arg_then2 ("EXP_1", [EXP_1]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma expnS *) +let expnS = Sections.section_proof ["m";"n"] +`m ^ SUC n = m * m ^ n` +[ + ((((use_arg_then2 ("EXP", [EXP]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma expnSr *) +let expnSr = Sections.section_proof ["m";"n"] +`m ^ SUC n = m ^ n * m` +[ + (((((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expnS", [expnS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma exp0n *) +let exp0n = Sections.section_proof ["n"] +`0 < n ==> 0 ^ n = 0` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN case) [ALL_TAC; (move ["n"])]) ((((use_arg_then2 ("LT_REFL", [LT_REFL]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((((use_arg_then2 ("EXP", [EXP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mul0n", [mul0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma exp1n *) +let exp1n = Sections.section_proof ["n"] +`1 ^ n = 1` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [(((use_arg_then2 ("expn0", [expn0]))(thm_tac (new_rewrite [] [])))); ((((use_arg_then2 ("expnS", [expnS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mul1n", [mul1n]))(thm_tac (new_rewrite [] [])))))]) THEN (done_tac)); +];; + +(* Lemma expn_add *) +let expn_add = Sections.section_proof ["m";"n1";"n2"] +`m ^ (n1 + n2) = m ^ n1 * m ^ n2` +[ + (((THENL) (((use_arg_then2 ("n1", [])) (disch_tac [])) THEN (clear_assumption "n1") THEN elim) [ALL_TAC; ((move ["n1"]) THEN (move ["IHn"]))]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("expn0", [expn0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mul1n", [mul1n]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("addSn", [addSn]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("expnS", [expnS]))(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulnA", [mulnA]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma expn_mull *) +let expn_mull = Sections.section_proof ["m1";"m2";"n"] +`(m1 * m2) ^ n = m1 ^ n * m2 ^ n` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) (((repeat_tactic 1 9 (((use_arg_then2 ("expn0", [expn0]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("muln1", [muln1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("expnS", [expnS]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mulnA", [mulnA]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("mulnCA", [mulnCA]))(thm_tac (new_rewrite [] [(`m2 * _1`)]))))) THEN (done_tac)); +];; + +(* Lemma expn_mulr *) +let expn_mulr = Sections.section_proof ["m";"n1";"n2"] +`m ^ (n1 * n2) = (m ^ n1) ^ n2` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("n1", [])) (disch_tac [])) THEN (clear_assumption "n1") THEN elim) [ALL_TAC; ((move ["n1"]) THEN (move ["IHn"]))]) (((repeat_tactic 1 9 (((use_arg_then2 ("expn0", [expn0]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mul0n", [mul0n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expn0", [expn0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("exp1n", [exp1n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("mulSn", [mulSn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expn_add", [expn_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expnS", [expnS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expn_mull", [expn_mull]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma expn_gt0 *) +let expn_gt0 = Sections.section_proof ["m";"n"] +`(0 < m ^ n) <=> (0 < m) \/ (n = 0)` +[ + ((THENL_FIRST) (((THENL) (((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN case) [ALL_TAC; (move ["m"])]) THEN ((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))])) ((((use_arg_then2 ("expn0", [expn0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("expnS", [expnS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mul0n", [mul0n]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("expn0", [expn0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then2 ("expnS", [expnS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulSn", [mulSn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addn_gt0", [addn_gt0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma expn_eq0 *) +let expn_eq0 = Sections.section_proof ["m";"e"] +`(m ^ e = 0) <=> (m = 0) /\ (0 < e)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("eqn0Ngt", [eqn0Ngt]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("expn_gt0", [expn_gt0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lt0n", [lt0n]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma ltn_expl *) +let ltn_expl = Sections.section_proof ["m";"n"] +`1 < m ==> n < m ^ n` +[ + ((THENL_FIRST) ((BETA_TAC THEN (move ["m_gt1"])) THEN ((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; (move ["n"])])) ((((use_arg_then2 ("expn0", [expn0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("ltnW", [ltnW])) (fun fst_arg -> (use_arg_then2 ("m_gt1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("leq_pmul2l", [leq_pmul2l])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC)); + (((repeat_tactic 1 9 (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("expnS", [expnS]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("leq_trans", [leq_trans])) (disch_tac [])) THEN (clear_assumption "leq_trans") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("ltn_Pmull", [ltn_Pmull])) (fun fst_arg -> (use_arg_then2 ("m_gt1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma leq_exp2l *) +let leq_exp2l = Sections.section_proof ["m";"n1";"n2"] +`1 < m ==> (m ^ n1 <= m ^ n2 <=> n1 <= n2)` +[ + ((THENL_ROT (-1)) ((BETA_TAC THEN (move ["m_gt1"])) THEN ((THENL) (((use_arg_then2 ("n2", [])) (disch_tac [])) THEN (clear_assumption "n2") THEN ((use_arg_then2 ("n1", [])) (disch_tac [])) THEN (clear_assumption "n1") THEN elim) [ALL_TAC; ((move ["n1"]) THEN (move ["IHn"]))]) THEN (BETA_TAC THEN ((THENL) case [ALL_TAC; (move ["q"])])) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("expnS", [expnS]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leq_pmul2l", [leq_pmul2l]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("expn0", [expn0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("expn_gt0", [expn_gt0]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("m_gt1", [])) (disch_tac [])) THEN (clear_assumption "m_gt1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expn0", [expn0]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("m_gt1", [])) (disch_tac [])) THEN (clear_assumption "m_gt1") THEN BETA_TAC) THEN ((((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (move ["m_gt1"]))); + ((((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("leq_trans", [leq_trans])) (fun fst_arg -> (use_arg_then2 ("m_gt1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("expnS", [expnS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_pmulr", [leq_pmulr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("expn_gt0", [expn_gt0]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("m_gt1", [])) (disch_tac [])) THEN (clear_assumption "m_gt1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma ltn_exp2l *) +let ltn_exp2l = Sections.section_proof ["m";"n1";"n2"] +`1 < m ==> (m ^ n1 < m ^ n2 <=> n1 < n2)` +[ + ((BETA_TAC THEN (move ["m_gt1"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leq_exp2l", [leq_exp2l]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eqn_exp2l *) +let eqn_exp2l = Sections.section_proof ["m";"n1";"n2"] +`1 < m ==> (m ^ n1 = m ^ n2 <=> n1 = n2)` +[ + ((BETA_TAC THEN (move ["m_gt1"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("eqn_leq", [eqn_leq]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("leq_exp2l", [leq_exp2l]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma expnI *) +let expnI = Sections.section_proof ["m"] +`1 < m ==> !e1 e2. m ^ e1 = m ^ e2 ==> e1 = e2` +[ + ((BETA_TAC THEN (move ["m_gt1"]) THEN (move ["e1"]) THEN (move ["e2"])) THEN (((use_arg_then2 ("eqn_exp2l", [eqn_exp2l]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma leq_pexp2l *) +let leq_pexp2l = Sections.section_proof ["m";"n1";"n2"] +`0 < m ==> n1 <= n2 ==> m ^ n1 <= m ^ n2` +[ + (((THENL) (((THENL) (((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN case) [ALL_TAC; ((THENL) case [ALL_TAC; (move ["m"])])]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))) [((((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("exp1n", [exp1n]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))); ((((use_arg_then2 ("leq_exp2l", [leq_exp2l]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))]) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma ltn_pexp2l *) +let ltn_pexp2l = Sections.section_proof ["m";"n1";"n2"] +`0 < m ==> m ^ n1 < m ^ n2 ==> n1 < n2` +[ + (((THENL) (((THENL) (((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN case) [ALL_TAC; ((THENL) case [ALL_TAC; (move ["m"])])]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))) [((((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("exp1n", [exp1n]))(thm_tac (new_rewrite [] [])))))); (((use_arg_then2 ("ltn_exp2l", [ltn_exp2l]))(thm_tac (new_rewrite [] []))))]) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma ltn_exp2r *) +let ltn_exp2r = Sections.section_proof ["m";"n";"e"] +`0 < e ==> (m ^ e < n ^ e <=> m < n)` +[ + ((BETA_TAC THEN (move ["e_gt0"])) THEN ((THENL) (split_tac) [ALL_TAC; (move ["ltmn"])])); + ((repeat_tactic 1 9 (((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (move ["lemn"]))); + (((THENL) (((use_arg_then2 ("e", [])) (disch_tac [])) THEN (clear_assumption "e") THEN elim) [ALL_TAC; ((move ["e'"]) THEN (move ["IHe"]))]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("expn0", [expn0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("expnS", [expnS]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leq_mul", [leq_mul]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) (((use_arg_then2 ("e_gt0", [])) (disch_tac [])) THEN (clear_assumption "e_gt0") THEN ((use_arg_then2 ("e", [])) (disch_tac [])) THEN (clear_assumption "e") THEN elim) ((((use_arg_then2 ("ltnn", [ltnn]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((THENL_FIRST) (BETA_TAC THEN ((THENL) case [ALL_TAC; ((move ["e"]) THEN (move ["IHe"]))])) (((((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("expn1", [expn1]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("expnS", [expnS]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ltn_mul", [ltn_mul]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("expnS", [expnS]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("IHe", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (arith_tac)); +];; + +(* Lemma leq_exp2r *) +let leq_exp2r = Sections.section_proof ["m";"n";"e"] +`0 < e ==> (m ^ e <= n ^ e <=> m <= n)` +[ + ((BETA_TAC THEN (move ["e_gt0"])) THEN ((((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn_exp2r", [ltn_exp2r]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("leqNgt", [leqNgt]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma eqn_exp2r *) +let eqn_exp2r = Sections.section_proof ["m";"n";"e"] +`0 < e ==> (m ^ e = n ^ e <=> m = n)` +[ + ((BETA_TAC THEN (move ["e_gt0"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("eqn_leq", [eqn_leq]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("leq_exp2r", [leq_exp2r]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma expIn *) +let expIn = Sections.section_proof ["e"] +`0 < e ==> !m n. m ^ e = n ^ e ==> m = n` +[ + ((BETA_TAC THEN (move ["e_gt0"]) THEN (move ["m"]) THEN (move ["n"])) THEN (((use_arg_then2 ("eqn_exp2r", [eqn_exp2r]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma fact0 *) +let fact0 = Sections.section_proof [] +`FACT 0 = 1` +[ + ((((use_arg_then2 ("FACT", [FACT]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma factS *) +let factS = Sections.section_proof ["n"] +`FACT (SUC n) = (SUC n) * FACT n` +[ + ((((use_arg_then2 ("FACT", [FACT]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma fact_gt0 *) +let fact_gt0 = Sections.section_proof ["n"] +`0 < FACT n` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; (move ["n"])]) THEN ((((use_arg_then2 ("FACT", [FACT]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("muln_gt0", [muln_gt0]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))) THEN (arith_tac) THEN (done_tac)); +];; +let odd = new_basic_definition `odd = ODD`;; + +(* Lemma odd0 *) +let odd0 = Sections.section_proof [] +`odd 0 = F` +[ + ((((use_arg_then2 ("odd", [odd]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 2 0 (((use_arg_then2 ("ODD", [ODD]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma oddS *) +let oddS = Sections.section_proof ["n"] +`odd (SUC n) = ~odd n` +[ + (((((use_arg_then2 ("odd", [odd]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("ODD", [ODD]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma odd1 *) +let odd1 = Sections.section_proof [] +`odd 1 = T` +[ + (((((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("oddS", [oddS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("odd0", [odd0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma odd_add *) +let odd_add = Sections.section_proof ["m";"n"] +`odd (m + n) = odd m + odd n` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; ((move ["m"]) THEN (move ["IHn"]))]) (((((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("odd0", [odd0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addFb", [addFb]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("addSn", [addSn]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("oddS", [oddS]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addTb", [addTb]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addbA", [addbA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addTb", [addTb]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma odd_sub *) +let odd_sub = Sections.section_proof ["m";"n"] +`n <= m ==> odd (m - n) = odd m + odd n` +[ + ((BETA_TAC THEN (move ["le_nm"])) THEN (((fun arg_tac -> (use_arg_then2 ("addIb", [addIb])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`odd n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("odd_add", [odd_add]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("subnK", [subnK]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("addbK", [addbK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma odd_opp *) +let odd_opp = Sections.section_proof ["i";"m"] +`odd m = F ==> i < m ==> odd (m - i) = odd i` +[ + (BETA_TAC THEN (move ["oddm"]) THEN (move ["lt_im"])); + (((((fun arg_tac -> (use_arg_then2 ("odd_sub", [odd_sub])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ltnW", [ltnW])) (fun fst_arg -> (use_arg_then2 ("lt_im", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("oddm", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addFb", [addFb]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma odd_mul *) +let odd_mul = Sections.section_proof ["m";"n"] +`odd (m * n) <=> odd m /\ odd n` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; ((move ["m"]) THEN (move ["IHm"]))]) (((((use_arg_then2 ("mul0n", [mul0n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("odd0", [odd0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andFb", [andFb]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("mulSn", [mulSn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("odd_add", [odd_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("oddS", [oddS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addTb", [addTb]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andb_addl", [andb_addl]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHm", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma odd_exp *) +let odd_exp = Sections.section_proof ["m";"n"] +`odd (m ^ n) <=> (n = 0) \/ odd m` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) (((((use_arg_then2 ("expn0", [expn0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("odd1", [odd1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("expnS", [expnS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("odd_mul", [odd_mul]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbC", [orbC]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `SUC n = 0 <=> F`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orFb", [orFb]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`odd m`))) (term_tac (set_tac "b"))); + (((use_arg_then2 ("IHn", [])) (disch_tac [])) THEN (clear_assumption "IHn") THEN ((use_arg_then2 ("b_def", [])) (disch_tac [])) THEN (clear_assumption "b_def") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"])); + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case THEN (simp_tac)) THEN (done_tac)); +];; +let double = define `double 0 = 0 /\ (!n. double (SUC n) = SUC (SUC (double n)))`;; + +(* Lemma double0 *) +let double0 = Sections.section_proof [] +`double 0 = 0` +[ + ((((use_arg_then2 ("double", [double]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma doubleS *) +let doubleS = Sections.section_proof ["n"] +`double (SUC n) = SUC (SUC (double n))` +[ + ((((use_arg_then2 ("double", [double]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (done_tac)); +];; + +(* Lemma addnn *) +let addnn = Sections.section_proof ["n"] +`n + n = double n` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) (((((use_arg_then2 ("addn0", [addn0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("double0", [double0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("addnS", [addnS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addSn", [addSn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("doubleS", [doubleS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mul2n *) +let mul2n = Sections.section_proof ["m"] +`2 * m = double m` +[ + (((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `2 = SUC 1`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulSn", [mulSn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mul1n", [mul1n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnn", [addnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma muln2 *) +let muln2 = Sections.section_proof ["m"] +`m * 2 = double m` +[ + (((((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mul2n", [mul2n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma double_add *) +let double_add = Sections.section_proof ["m";"n"] +`double (m + n) = double m + double n` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("addnn", [addnn]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("addnA", [addnA]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((fun arg_tac -> (use_arg_then2 ("addnCA", [addnCA])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [(`n + _1`)]))))) THEN (done_tac)); +];; + +(* Lemma double_sub *) +let double_sub = Sections.section_proof ["m";"n"] +`double (m - n) = double m - double n` +[ + ((((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("m", [])) (disch_tac [])) THEN (clear_assumption "m") THEN elim) [ALL_TAC; ((move ["m"]) THEN (move ["IHm"]))]) THEN ((THENL) case [ALL_TAC; (move ["n"])])) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("sub0n", [sub0n]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("subn0", [subn0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("double0", [double0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("subn0", [subn0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sub0n", [sub0n]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((repeat_tactic 1 9 (((use_arg_then2 ("doubleS", [doubleS]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("subSS", [subSS]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IHm", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_double *) +let leq_double = Sections.section_proof ["m";"n"] +`(double m <= double n <=> m <= n)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("leqE", [leqE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("double_sub", [double_sub]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((THENL) (((fun arg_tac -> arg_tac (Arg_term (`m - n`))) (disch_tac [])) THEN case) [ALL_TAC; (move ["n"])]) THEN (((use_arg_then2 ("double", [double]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma ltn_double *) +let ltn_double = Sections.section_proof ["m";"n"] +`(double m < double n) = (m < n)` +[ + (((repeat_tactic 2 0 (((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leq_double", [leq_double]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ltn_Sdouble *) +let ltn_Sdouble = Sections.section_proof ["m";"n"] +`(SUC (double m) < double n) = (m < n)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("muln2", [muln2]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma leq_Sdouble *) +let leq_Sdouble = Sections.section_proof ["m";"n"] +`(double m <= SUC (double n)) = (m <= n)` +[ + (((((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn_Sdouble", [ltn_Sdouble]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqNgt", [leqNgt]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma odd_double *) +let odd_double = Sections.section_proof ["n"] +`odd (double n) = F` +[ + (((((use_arg_then2 ("addnn", [addnn]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("odd_add", [odd_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addbb", [addbb]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma double_gt0 *) +let double_gt0 = Sections.section_proof ["n"] +`(0 < double n) = (0 < n)` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN case) [ALL_TAC; (move ["n"])]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("double0", [double0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("doubleS", [doubleS]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac)); +];; + +(* Lemma double_eq0 *) +let double_eq0 = Sections.section_proof ["n"] +`(double n = 0) = (n = 0)` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN case) [ALL_TAC; (move ["n"])]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("double0", [double0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("doubleS", [doubleS]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac)); +];; + +(* Lemma double_mull *) +let double_mull = Sections.section_proof ["m";"n"] +`double (m * n) = double m * n` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("mul2n", [mul2n]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("mulnA", [mulnA]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma double_mulr *) +let double_mulr = Sections.section_proof ["m";"n"] +`double (m * n) = m * double n` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("muln2", [muln2]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("mulnA", [mulnA]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +let half_def = define `HALF 0 = (0, 0) /\ + !n. HALF (SUC n) = (SND (HALF n), SUC (FST (HALF n)))`;; +let half = new_basic_definition `half = FST o HALF`;; +let uphalf = new_basic_definition `uphalf = SND o HALF`;; + +(* Lemma half0 *) +let half0 = Sections.section_proof [] +`half 0 = 0` +[ + (((((use_arg_then2 ("half", [half]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("o_DEF", [o_DEF]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("half_def", [half_def]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma uphalf0 *) +let uphalf0 = Sections.section_proof [] +`uphalf 0 = 0` +[ + (((((use_arg_then2 ("uphalf", [uphalf]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("o_DEF", [o_DEF]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("half_def", [half_def]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma halfS *) +let halfS = Sections.section_proof ["n"] +`half (SUC n) = uphalf n` +[ + (((((use_arg_then2 ("half", [half]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("uphalf", [uphalf]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("o_DEF", [o_DEF]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("half_def", [half_def]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma uphalfS *) +let uphalfS = Sections.section_proof ["n"] +`uphalf (SUC n) = SUC (half n)` +[ + (((((use_arg_then2 ("half", [half]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("uphalf", [uphalf]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (((use_arg_then2 ("o_DEF", [o_DEF]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac) THEN (((use_arg_then2 ("half_def", [half_def]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); +];; + +(* Lemma doubleK *) +let doubleK = Sections.section_proof ["x"] +`half (double x) = x` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN elim) [ALL_TAC; (move ["n"])]) (((((use_arg_then2 ("double0", [double0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("half0", [half0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((((use_arg_then2 ("doubleS", [doubleS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("halfS", [halfS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("uphalfS", [uphalfS]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +let half_double = doubleK;; + +(* Lemma double_inj *) +let double_inj = Sections.section_proof [] +`!m n. double m = double n ==> m = n` +[ + (BETA_TAC THEN (move ["m"]) THEN (move ["n"])); + ((((((use_arg_then2 ("doubleK", [doubleK]))(gsym_then (thm_tac (new_rewrite [2] [(`m`)]))))) THEN (((use_arg_then2 ("doubleK", [doubleK]))(gsym_then (thm_tac (new_rewrite [2] [(`n`)])))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma uphalf_double *) +let uphalf_double = Sections.section_proof ["n"] +`uphalf (double n) = n` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; (move ["n"])]) (((((use_arg_then2 ("double0", [double0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("uphalf0", [uphalf0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((((use_arg_then2 ("doubleS", [doubleS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("uphalfS", [uphalfS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("halfS", [halfS]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma uphalf_half *) +let uphalf_half = Sections.section_proof ["n"] +`uphalf n = (if odd n then 1 else 0) + half n` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) (((((use_arg_then2 ("uphalf0", [uphalf0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("half0", [half0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("odd0", [odd0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addn0", [addn0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("halfS", [halfS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHn", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnA", [addnA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("oddS", [oddS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("uphalfS", [uphalfS]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> arg_tac (Arg_term (`odd n`))) (disch_tac [])) THEN case THEN (simp_tac)) THEN ((((fun arg_tac ->(use_arg_then2 ("add0n", [add0n]))(fun tmp_arg1 -> (use_arg_then2 ("addn0", [addn0]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add1n", [add1n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma odd_double_half *) +let odd_double_half = Sections.section_proof ["n"] +`(if odd n then 1 else 0) + double (half n) = n` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IHn"]))]) (((((use_arg_then2 ("odd0", [odd0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("half0", [half0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("double0", [double0]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("addn0", [addn0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("IHn", []))(gsym_then (thm_tac (new_rewrite [3] []))))) THEN (((use_arg_then2 ("halfS", [halfS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("uphalf_half", [uphalf_half]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("double_add", [double_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("oddS", [oddS]))(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("IHn", [])) (disch_tac [])) THEN (clear_assumption "IHn") THEN BETA_TAC THEN (move ["_"])); + ((((fun arg_tac -> arg_tac (Arg_term (`odd n`))) (disch_tac [])) THEN case THEN (simp_tac)) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("double0", [double0]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add1n", [add1n]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("doubleS", [doubleS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("addSn", [addSn]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("double0", [double0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma half_bit_double *) +let half_bit_double = Sections.section_proof ["n";"b"] +`half ((if b then 1 else 0) + double n) = n` +[ + ((((use_arg_then2 ("b", [])) (disch_tac [])) THEN (clear_assumption "b") THEN case) THEN ((simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("add1n", [add1n]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("halfS", [halfS]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac ->(use_arg_then2 ("half_double", [half_double]))(fun tmp_arg1 -> (use_arg_then2 ("uphalf_double", [uphalf_double]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma half_add *) +let half_add = Sections.section_proof ["m";"n"] +`half (m + n) = (if odd m /\ odd n then 1 else 0) + (half m + half n)` +[ + ((((use_arg_then2 ("odd_double_half", [odd_double_half]))(gsym_then (thm_tac (new_rewrite [1] [(`n`)]))))) THEN (((use_arg_then2 ("addnCA", [addnCA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("odd_double_half", [odd_double_half]))(gsym_then (thm_tac (new_rewrite [1] [(`m`)]))))) THEN (((use_arg_then2 ("addnA", [addnA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("double_add", [double_add]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 2 0 ((((fun arg_tac -> arg_tac (Arg_term (`odd _`))) (disch_tac [])) THEN case))) THEN ((simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("half_double", [half_double]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("add1n", [add1n]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("halfS", [halfS]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uphalfS", [uphalfS]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uphalf_double", [uphalf_double]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("half_double", [half_double]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma half_leq *) +let half_leq = Sections.section_proof ["m";"n"] +`m <= n ==> half m <= half n` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("subnK", [subnK])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then2 ("half_add", [half_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnA", [addnA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_addl", [leq_addl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma half_gt0 *) +let half_gt0 = Sections.section_proof ["n"] +`(0 < half n) = (1 < n)` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN case) [ALL_TAC; (case THEN ALL_TAC)]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("halfS", [halfS]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uphalfS", [uphalfS]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uphalf0", [uphalf0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("half0", [half0]))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma mulnn *) +let mulnn = Sections.section_proof ["m"] +`m * m = m ^ 2` +[ + (((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `2 = SUC (SUC 0)`)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("expnS", [expnS]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("expn0", [expn0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("muln1", [muln1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sqrn_add *) +let sqrn_add = Sections.section_proof ["m";"n"] +`(m + n) ^ 2 = (m ^ 2 + n ^ 2) + 2 * (m * n)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("mulnn", [mulnn]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("mul2n", [mul2n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("muln_addr", [muln_addr]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("muln_addl", [muln_addl]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("mulnC", [mulnC])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("addnA", [addnA]))(gsym_then (thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("EQ_ADD_LCANCEL", [EQ_ADD_LCANCEL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnA", [addnA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnn", [addnn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sqrn_sub *) +let sqrn_sub = Sections.section_proof ["m";"n"] +`n <= m ==> (m - n) ^ 2 = (m ^ 2 + n ^ 2) - 2 * (m * n)` +[ + ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("subnK", [subnK])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["def_m"])); + ((((use_arg_then2 ("def_m", []))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then2 ("sqrn_add", [sqrn_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnA", [addnA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addnAC", [addnAC]))(thm_tac (new_rewrite [] []))))); + (((repeat_tactic 2 0 (((use_arg_then2 ("addnA", [addnA]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("addnn", [addnn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mul2n", [mul2n]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("muln_addr", [muln_addr]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mulnn", [mulnn]))(gsym_then (thm_tac (new_rewrite [] [(`n EXP 2`)]))))) THEN (((use_arg_then2 ("muln_addl", [muln_addl]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("def_m", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnK", [addnK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sqrn_add_sub *) +let sqrn_add_sub = Sections.section_proof ["m";"n"] +`n <= m ==> (m + n) ^ 2 - 4 * (m * n) = (m - n) ^ 2` +[ + ((BETA_TAC THEN (move ["le_nm"])) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `4 = 2 * 2`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulnA", [mulnA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mul2n", [mul2n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnn", [addnn]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("subn_sub", [subn_sub]))(gsym_then (thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("sqrn_add", [sqrn_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnK", [addnK]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sqrn_sub", [sqrn_sub]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma subn_sqr *) +let subn_sqr = Sections.section_proof ["m";"n"] +`m ^ 2 - n ^ 2 = (m - n) * (m + n)` +[ + (((((use_arg_then2 ("muln_subl", [muln_subl]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("muln_addr", [muln_addr]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mulnC", [mulnC])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subn_add2l", [subn_add2l]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mulnn", [mulnn]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma ltn_sqr *) +let ltn_sqr = Sections.section_proof ["m";"n"] +`(m ^ 2 < n ^ 2) = (m < n)` +[ + (((((use_arg_then2 ("ltn_exp2r", [ltn_exp2r]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma leq_sqr *) +let leq_sqr = Sections.section_proof ["m";"n"] +`(m ^ 2 <= n ^ 2) = (m <= n)` +[ + (((((use_arg_then2 ("leq_exp2r", [leq_exp2r]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma sqrn_gt0 *) +let sqrn_gt0 = Sections.section_proof ["n"] +`(0 < n ^ 2) = (0 < n)` +[ + ((THENL_FIRST) ((((fun arg_tac -> (use_arg_then2 ("ltn_sqr", [ltn_sqr])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("exp0n", [exp0n]))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma eqn_sqr *) +let eqn_sqr = Sections.section_proof ["m";"n"] +`(m ^ 2 = n ^ 2) = (m = n)` +[ + (((((use_arg_then2 ("eqn_exp2r", [eqn_exp2r]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma sqrn_inj *) +let sqrn_inj = Sections.section_proof ["m";"n"] +`m ^ 2 = n ^ 2 ==> m = n` +[ + (BETA_TAC THEN (move ["eq"])); + (((fun arg_tac -> (use_arg_then2 ("expIn", [expIn])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `0 < 2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["inj"])); + ((((fun arg_tac -> (use_arg_then2 ("inj", [])) (fun fst_arg -> (use_arg_then2 ("eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; +let leqif = new_definition `!m n c. leqif m n c <=> (m <= n /\ ((m = n) <=> c))`;; + +(* Lemma leqifP *) +let leqifP = Sections.section_proof ["m";"n";"c"] +`leqif m n c <=> if c then m = n else m < n` +[ + ((THENL_FIRST) (((((use_arg_then2 ("ltn_neqAle", [ltn_neqAle]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqif", [leqif]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)) ((((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (done_tac))); + ((((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN case THEN (simp_tac)) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma leqif_imp_le *) +let leqif_imp_le = Sections.section_proof ["m";"n";"c"] +`leqif m n c ==> m <= n` +[ + (((((use_arg_then2 ("leqif", [leqif]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma leqif_imp_eq *) +let leqif_imp_eq = Sections.section_proof ["m";"n";"c"] +`leqif m n c ==> (m = n <=> c)` +[ + (((((use_arg_then2 ("leqif", [leqif]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma leqif_refl *) +let leqif_refl = Sections.section_proof ["m";"c"] +`(leqif m m c) <=> c` +[ + (((((use_arg_then2 ("leqif", [leqif]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leqif_trans *) +let leqif_trans = Sections.section_proof ["m1";"m2";"m3";"c1";"c2"] +`leqif m1 m2 c1 ==> leqif m2 m3 c2 ==> leqif m1 m3 (c1 /\ c2)` +[ + (repeat_tactic 1 9 (((use_arg_then2 ("leqifP", [leqifP]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((((use_arg_then2 ("c1", [])) (disch_tac [])) THEN (clear_assumption "c1") THEN case) THEN (((use_arg_then2 ("c2", [])) (disch_tac [])) THEN (clear_assumption "c2") THEN case THEN (simp_tac) THEN (move ["lt12"]))) ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leq_trans", [leq_trans])) (disch_tac [])) THEN (clear_assumption "leq_trans") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltnW", [ltnW])) (disch_tac [])) THEN (clear_assumption "ltnW") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma monotone_leqif *) +let monotone_leqif = Sections.section_proof ["f"] +`(!m n. f m <= f n <=> m <= n) ==> + !m n c. (leqif (f m) (f n) c) <=> (leqif m n c)` +[ + (BETA_TAC THEN (move ["f_mono"]) THEN (move ["m"]) THEN (move ["n"]) THEN (move ["c"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("leqifP", [leqifP]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqn_leq", [eqn_leq]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("f_mono", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma leqif_geq *) +let leqif_geq = Sections.section_proof ["m";"n"] +`m <= n ==> leqif m n (n <= m)` +[ + ((BETA_TAC THEN (move ["lemn"])) THEN (((use_arg_then2 ("leqif", [leqif]))(thm_tac (new_rewrite [] [])))) THEN ((split_tac) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("eqn_leq", [eqn_leq]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("lemn", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma leqif_eq *) +let leqif_eq = Sections.section_proof ["m";"n"] +`m <= n ==> leqif m n (m = n)` +[ + ((((use_arg_then2 ("leqif", [leqif]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma geq_leqif *) +let geq_leqif = Sections.section_proof ["a";"b";"C"] +`leqif a b C ==> ((b <= a) <=> C)` +[ + ((((use_arg_then2 ("leqif", [leqif]))(thm_tac (new_rewrite [] [])))) THEN (case THEN (move ["le_ab"])) THEN (((use_arg_then2 ("eqn_leq", [eqn_leq]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("le_ab", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma ltn_leqif *) +let ltn_leqif = Sections.section_proof ["a";"b";"C"] +`leqif a b C ==> (a < b <=> ~ C)` +[ + (BETA_TAC THEN (move ["le_ab"])); + (((((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("geq_leqif", [geq_leqif])) (fun fst_arg -> (use_arg_then2 ("le_ab", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leqif_add *) +let leqif_add = Sections.section_proof ["m1";"n1";"c1";"m2";"n2";"c2"] +`leqif m1 n1 c1 ==> leqif m2 n2 c2 ==> leqif (m1 + m2) (n1 + n2) (c1 /\ c2)` +[ + ((((fun arg_tac -> (use_arg_then2 ("monotone_leqif", [monotone_leqif])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("leq_add2r", [leq_add2r])) (fun fst_arg -> (use_arg_then2 ("m2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["le1"])); + (((fun arg_tac -> (use_arg_then2 ("monotone_leqif", [monotone_leqif])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("leq_add2l", [leq_add2l])) (fun fst_arg -> (use_arg_then2 ("n1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("leqif_trans", [leqif_trans])) (disch_tac [])) THEN (clear_assumption "leqif_trans") THEN (exact_tac)); +];; + +(* Lemma leqif_mul *) +let leqif_mul = Sections.section_proof ["m1";"n1";"c1";"m2";"n2";"c2"] +`leqif m1 n1 c1 ==> leqif m2 n2 c2 ==> + leqif (m1 * m2) (n1 * n2) (n1 * n2 = 0 \/ (c1 /\ c2))` +[ + (BETA_TAC THEN (move ["le1"]) THEN (move ["le2"])); + ((THENL) (((fun arg_tac -> (use_arg_then2 ("posnP", [posnP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n1 * n2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(move ["n12_0"]); ALL_TAC]); + ((((use_arg_then2 ("n12_0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("le2", [])) (disch_tac [])) THEN (clear_assumption "le2") THEN ((use_arg_then2 ("le1", [])) (disch_tac [])) THEN (clear_assumption "le1") THEN ((use_arg_then2 ("n12_0", [])) (disch_tac [])) THEN (clear_assumption "n12_0") THEN BETA_TAC) THEN (((use_arg_then2 ("muln_eq0", [muln_eq0]))(thm_tac (new_rewrite [] []))))); + ((case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((THENL) (((use_arg_then2 ("m2", [])) (disch_tac [])) THEN (clear_assumption "m2") THEN ((use_arg_then2 ("m1", [])) (disch_tac [])) THEN (clear_assumption "m1") THEN case) [ALL_TAC; (move ["m"])]) THEN ((THENL) case [ALL_TAC; (move ["m'"])]) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("leqif", [leqif]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("muln0", [muln0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mul0n", [mul0n]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (arith_tac)); + ((((use_arg_then2 ("muln_gt0", [muln_gt0]))(thm_tac (new_rewrite [] [])))) THEN (BETA_TAC THEN (case THEN ((move ["n1_gt0"]) THEN (move ["n2_gt0"]))))); + (((fun arg_tac -> (use_arg_then2 ("posnP", [posnP])) (fun fst_arg -> (use_arg_then2 ("m2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN ((THENL) case [(move ["m2_0"]); (move ["m2_gt0"])])); + ((((use_arg_then2 ("leqifP", [leqifP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("le2", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("leqif", [leqif]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["_"]) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))))))); + (((((use_arg_then2 ("andbC", [andbC]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqn_leq", [eqn_leq]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("m2_0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("muln0", [muln0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("muln_gt0", [muln_gt0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n1_gt0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n2_gt0", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("n1_gt0", [])) (disch_tac [])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("leq_pmul2l", [leq_pmul2l])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("monotone_leqif", [monotone_leqif])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["Mn1"]))); + (((use_arg_then2 ("le2", [])) (disch_tac [])) THEN (clear_assumption "le2") THEN ((use_arg_then2 ("Mn1", [])) (disch_tac [])) THEN (clear_assumption "Mn1") THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("m2_gt0", [])) (disch_tac [])) THEN (clear_assumption "m2_gt0") THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("leq_pmul2r", [leq_pmul2r])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("monotone_leqif", [monotone_leqif])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["Mm2"]))); + (((use_arg_then2 ("le1", [])) (disch_tac [])) THEN (clear_assumption "le1") THEN ((use_arg_then2 ("Mm2", [])) (disch_tac [])) THEN (clear_assumption "Mm2") THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))); + (BETA_TAC THEN (move ["leq1"]) THEN (move ["leq2"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("leqif_trans", [leqif_trans])) (fun fst_arg -> (use_arg_then2 ("leq1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("leq2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("leqifP", [leqifP]))(thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> arg_tac (Arg_term (`c1 /\ c2`))) (disch_tac [])) THEN case THEN (simp_tac)); + (((((use_arg_then2 ("eqn_leq", [eqn_leq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("muln_gt0", [muln_gt0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n1_gt0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n2_gt0", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nat_Cauchy *) +let nat_Cauchy = Sections.section_proof ["m";"n"] +`leqif (2 * (m * n)) (m ^ 2 + n ^ 2) (m = n)` +[ + ((fun arg_tac -> arg_tac (Arg_term (`n <= m`))) (term_tac (wlog_tac (move ["le_nm"])[`m`; `n`]))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("leqP", [leqP])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN ((TRY done_tac))) THEN (((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] [(`m * _1`)]))))) THEN (move ["mn"]))); + ((((use_arg_then2 ("le_nm", [])) (disch_tac [])) THEN (clear_assumption "le_nm") THEN (DISCH_THEN apply_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("ltnW", [ltnW])) (fun fst_arg -> (use_arg_then2 ("mn", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (done_tac)); + (BETA_TAC THEN (move ["le_nm"])); + (((use_arg_then2 ("leqifP", [leqifP]))(thm_tac (new_rewrite [] [])))); + ((THENL_FIRST) ((THENL) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m = n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (move ["ne_mn"])]) (((((use_arg_then2 ("mulnn", [mulnn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnn", [addnn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mul2n", [mul2n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("ne_mn", []))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (simp_tac)) THEN ((((use_arg_then2 ("subn_gt0", [subn_gt0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("sqrn_sub", [sqrn_sub]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sqrn_gt0", [sqrn_gt0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subn_gt0", [subn_gt0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn_neqAle", [ltn_neqAle]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nat_AGM2 *) +let nat_AGM2 = Sections.section_proof ["m";"n"] +`leqif (4 * (m * n)) ((m + n) ^ 2) (m = n)` +[ + ((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `4 = 2 * 2`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulnA", [mulnA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mul2n", [mul2n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnn", [addnn]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("sqrn_add", [sqrn_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqifP", [leqifP]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("ltn_add2r", [ltn_add2r]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqn_addr", [eqn_addr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn_neqAle", [ltn_neqAle]))(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> (use_arg_then2 ("leqif_imp_eq", [leqif_imp_eq])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nat_Cauchy", [nat_Cauchy])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("leqif_imp_le", [leqif_imp_le])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nat_Cauchy", [nat_Cauchy])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("if_same", [if_same]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +let distn = new_definition `!m n. distn m n = (m - n) + (n - m)`;; + +(* Lemma distnC *) +let distnC = Sections.section_proof ["m";"n"] +`distn m n = distn n m` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("distn", [distn]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma distn_add2l *) +let distn_add2l = Sections.section_proof ["d";"m";"n"] +`distn (d + m) (d + n) = distn m n` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("distn", [distn]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("subn_add2l", [subn_add2l]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma distn_add2r *) +let distn_add2r = Sections.section_proof ["d";"m";"n"] +`distn (m + d) (n + d) = distn m n` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("distn", [distn]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("subn_add2r", [subn_add2r]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma distnEr *) +let distnEr = Sections.section_proof ["m";"n"] +`m <= n ==> distn m n = n - m` +[ + (BETA_TAC THEN (move ["le_m_n"])); + (((((use_arg_then2 ("distn", [distn]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("EQ_IMP", [EQ_IMP])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("leqE", [leqE])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("le_m_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma distnEl *) +let distnEl = Sections.section_proof ["m";"n"] +`n <= m ==> distn m n = m - n` +[ + ((BETA_TAC THEN (move ["le_n_m"])) THEN ((((use_arg_then2 ("distnC", [distnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("distnEr", [distnEr]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dist0n *) +let dist0n = Sections.section_proof ["n"] +`distn 0 n = n` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN case) [ALL_TAC; (move ["m"])]) THEN ((((use_arg_then2 ("distn", [distn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sub0n", [sub0n]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("subn0", [subn0]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma distn0 *) +let distn0 = Sections.section_proof ["n"] +`distn n 0 = n` +[ + (((((use_arg_then2 ("distnC", [distnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist0n", [dist0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma distnn *) +let distnn = Sections.section_proof ["m"] +`distn m m = 0` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("distn", [distn]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("subnn", [subnn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addn0", [addn0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma distn_eq0 *) +let distn_eq0 = Sections.section_proof ["m";"n"] +`(distn m n = 0) <=> (m = n)` +[ + (((((use_arg_then2 ("distn", [distn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addn_eq0", [addn_eq0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("subn_eq0", [subn_eq0]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eqn_leq", [eqn_leq]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma distnS *) +let distnS = Sections.section_proof ["m"] +`distn m (SUC m) = 1` +[ + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("distn_add2r", [distn_add2r])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add1n", [add1n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist0n", [dist0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma distSn *) +let distSn = Sections.section_proof ["m"] +`distn (SUC m) m = 1` +[ + (((((use_arg_then2 ("distnC", [distnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("distnS", [distnS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma distn_eq1 *) +let distn_eq1 = Sections.section_proof ["m";"n"] +`(distn m n = 1) <=> (if m < n then SUC m = n else m = SUC n)` +[ + ((THENL) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ltnP", [ltnP])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(move ["lt_mn"]); (move ["le_mn"])]); + (((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [(`_ = 1`)])))) THEN (((fun arg_tac -> (use_arg_then2 ("eqn_addr", [eqn_addr])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("distnEr", [distnEr]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("subnK", [subnK]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("add1n", [add1n]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((fun arg_tac -> (use_arg_then2 ("eqn_addr", [eqn_addr])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("distnEl", [distnEl]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("subnK", [subnK]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("add1n", [add1n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltnNge", [ltnNge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("le_mn", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma leqif_add_distn *) +let leqif_add_distn = Sections.section_proof ["m";"n";"p"] +`leqif (distn m p) (distn m n + distn n p) ((m <= n /\ n <= p) \/ (p <= n /\ n <= m))` +[ + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`!m p. m <= p ==> leqif (distn m p) (distn m n + distn n p) (m <= n /\ n <= p \/ p <= n /\ n <= m)`))) (term_tac (have_gen_tac [](move ["IH"]))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("leq_total", [leq_total])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN ((TRY done_tac))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("IH", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC)); + (((((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbC", [orbC]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("distnC", [distnC])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [(`distn n _`)])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("distnC", [distnC]))(thm_tac (new_rewrite [] [(`distn p _`)])))))) THEN (done_tac)); + (BETA_TAC THEN (move ["m"]) THEN (move ["p"]) THEN (move ["le_mp"])); + ((((use_arg_then2 ("distnEr", [distnEr]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((THENL) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m <= n /\ n <= p`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [((case THEN ((move ["le_mn"]) THEN (move ["le_np"]))) THEN ((simp_tac THEN TRY done_tac))); ALL_TAC]); + (((repeat_tactic 1 9 (((use_arg_then2 ("distnEr", [distnEr]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqifP", [leqifP]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((fun arg_tac -> (use_arg_then2 ("eqn_addr", [eqn_addr])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("addnA", [addnA]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("subnK", [subnK]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ltnNge", [ltnNge]))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN ALL_TAC THEN ((THENL) case [(move ["lt_nm"]); (move ["lt_pn"])])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ltn_leq_trans", [ltn_leq_trans])) (fun fst_arg -> (use_arg_then2 ("lt_nm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("le_mp", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["lt_np"])); + (((((use_arg_then2 ("leqifP", [leqifP]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lt_nm", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lt_np", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("ltn_addl", [ltn_addl]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("distnEr", [distnEr]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ltn_sub2l", [ltn_sub2l]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("leq_ltn_trans", [leq_ltn_trans])) (fun fst_arg -> (use_arg_then2 ("le_mp", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("lt_pn", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["lt_mn"])); + (((((use_arg_then2 ("leqifP", [leqifP]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lt_mn", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lt_pn", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("ltn_addr", [ltn_addr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("distnEr", [distnEr]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltn_sub2r", [ltn_sub2r]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma leq_add_distn *) +let leq_add_distn = Sections.section_proof ["m";"n";"p"] +`distn m p <= distn m n + distn n p` +[ + ((((fun arg_tac -> (use_arg_then2 ("leqif_imp_le", [leqif_imp_le])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("leqif_add_distn", [leqif_add_distn])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (done_tac)); +];; + +(* Lemma sqrn_distn *) +let sqrn_distn = Sections.section_proof ["m";"n"] +`(distn m n) ^ 2 + 2 * (m * n) = m ^ 2 + n ^ 2` +[ + ((fun arg_tac -> arg_tac (Arg_term (`n <= m`))) (term_tac (wlog_tac (move ["le_nm"])[`m`; `n`]))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("leq_total", [leq_total])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("le_nm", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("addnC", [addnC])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n EXP 2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mulnC", [mulnC])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("distnC", [distnC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["le_nm"])) THEN ((((use_arg_then2 ("distnEl", [distnEl]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sqrn_sub", [sqrn_sub]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("subnK", [subnK]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("leqif_imp_le", [leqif_imp_le])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nat_Cauchy", [nat_Cauchy])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Close the module *) +end;; diff --git a/jHOLLight/JHOL.app/Contents/Resources/Java/newprinter.ml b/jHOLLight/JHOL.app/Contents/Resources/Java/newprinter.ml new file mode 100644 index 0000000..e680231 --- /dev/null +++ b/jHOLLight/JHOL.app/Contents/Resources/Java/newprinter.ml @@ -0,0 +1,768 @@ +include Format;; + +set_max_boxes 100;; + + +(* ------------------------------------------------------------------------- *) +(* Protection for HTML output *) +(* ------------------------------------------------------------------------- *) + let output_functions = get_all_formatter_output_functions();; +let make n s= + let rec make_aux n s str = + match n with + | 0 -> str + | _ -> make_aux (n - 1) s (str ^ s) + in + make_aux n s "";; + +let new_output_functions (x,y,z,w) = set_all_formatter_output_functions x y (fun () ->x "
" 0 4) (fun n -> x (make n " ") 0 (6 * n));; + let restore_output_functions (x,y,z,w) = set_all_formatter_output_functions x y z w;; + +let pp_print_string' = pp_print_string;; +let print_string' = print_string;; +let rec pp_print_string fmt str = +match (String.length str) with +| 0 -> () +|_-> +if (Str.string_match (Str.regexp "!") str 0) +then begin +pp_print_as fmt 1 "∀"; +pp_print_string fmt (String.sub str 1 ((String.length str) - 1)) +end +else +if (Str.string_match (Str.regexp "\?") str 0) +then begin +pp_print_as fmt 1 "∃"; +pp_print_string fmt (String.sub str 1 ((String.length str) - 1)) +end +else +if (Str.string_match (Str.regexp "--") str 0) +then begin +pp_print_as fmt 1 "−"; +pp_print_string fmt (String.sub str 2 ((String.length str) - 2)) +end +else +if (Str.string_match (Str.regexp "|-") str 0) +then begin +pp_print_as fmt 1 "⊢"; +pp_print_string fmt (String.sub str 2 ((String.length str) - 2)) +end +else +if (Str.string_match (Str.regexp "~") str 0) +then begin +pp_print_as fmt 1 "¬"; +pp_print_string fmt (String.sub str 1 ((String.length str) - 1)) +end +else +if (Str.string_match (Str.regexp "<=>") str 0) +then begin +pp_print_as fmt 1 "⇔"; +pp_print_string fmt (String.sub str 3 ((String.length str) - 3)) +end +else +if (Str.string_match (Str.regexp "==>") str 0) +then begin +pp_print_as fmt 1 "⇒"; +pp_print_string fmt (String.sub str 3 ((String.length str) - 3)) +end +else +if (Str.string_match (Str.regexp ">=") str 0) +then begin +pp_print_as fmt 1 "≥"; +pp_print_string fmt (String.sub str 2 ((String.length str) - 2)) +end +else +if (Str.string_match (Str.regexp "<=") str 0) +then begin +pp_print_as fmt 1 "≤"; +pp_print_string fmt (String.sub str 2 ((String.length str) - 2)) +end +else +if (Str.string_match (Str.regexp "\\\\/") str 0) +then begin +pp_print_as fmt 1 "∨"; +pp_print_string fmt (String.sub str 2 ((String.length str) - 2)) +end +else +if (Str.string_match (Str.regexp "/\\\\") str 0) +then begin +pp_print_as fmt 1 "∧"; +pp_print_string fmt (String.sub str 2 ((String.length str) - 2)) +end +else +if (Str.string_match (Str.regexp "\\\\") str 0) +then begin +pp_print_as fmt 1 "λ"; +pp_print_string fmt (String.sub str 1 ((String.length str) - 1)) +end +else +if (Str.string_match (Str.regexp ">") str 0) +then begin +pp_print_as fmt 1 ">"; +pp_print_string fmt (String.sub str 1 ((String.length str) - 1)) +end +else +if (Str.string_match (Str.regexp "<") str 0) +then begin +pp_print_as fmt 1 "<"; +pp_print_string fmt (String.sub str 1 ((String.length str) - 1)) +end +else +if (Str.string_match (Str.regexp " ") str 0) +then begin +pp_print_as fmt 1 " "; +pp_print_string fmt (String.sub str 1 ((String.length str) - 1)) +end +else +begin +pp_print_as fmt 1 (String.sub str 0 1); +pp_print_string fmt (String.sub str 1 ((String.length str) - 1)) +end;; +let print_string = pp_print_string std_formatter;; + +(* ------------------------------------------------------------------------- *) +(* Determine binary operators that print without surrounding spaces. *) +(* ------------------------------------------------------------------------- *) + +let unspaced_binops = ref [","; ".."; "$"];; + +(* ------------------------------------------------------------------------- *) +(* Binary operators to print at start of line when breaking. *) +(* ------------------------------------------------------------------------- *) + +let prebroken_binops = ref ["==>"];; + +(* ------------------------------------------------------------------------- *) +(* Force explicit indications of bound variables in set abstractions. *) +(* ------------------------------------------------------------------------- *) + +(* let print_unambiguous_comprehensions = ref false;; *) + + (* ------------------------------------------------------------------------- *) + (* Print the universal set UNIV:A->bool as "(:A)". *) + (* ------------------------------------------------------------------------- *) + + let typify_universal_set = ref true;; + + (* ------------------------------------------------------------------------- *) + (* Flag controlling whether hypotheses print. *) + (* ------------------------------------------------------------------------- *) + + let print_all_thm = ref true;; + + (* ------------------------------------------------------------------------- *) + (* Flag determining whether interface/overloading is reversed on printing. *) + (* ------------------------------------------------------------------------- *) + let reverse_interface_mapping = ref true;; + + (* ------------------------------------------------------------------------- *) + (* Uses the_interface to lookup the names of operators *) + (* ------------------------------------------------------------------------- *) + let reverse_interface (s0,ty0) = + if not(!reverse_interface_mapping) then s0 else + try fst(find (fun (s,(s',ty)) -> s' = s0 & can (type_match ty ty0) []) + (!the_interface)) + with Failure _ -> s0;; + + (* ------------------------------------------------------------------------- *) + (* Get the name of a constant or variable. *) + (* ------------------------------------------------------------------------- *) + + let name_of tm = + match tm with + Var(x,ty) | Const(x,ty) -> x + | _ -> "";; + + (* ------------------------------------------------------------------------- *) + (* Printer for types. *) + (* ------------------------------------------------------------------------- *) + + let pp_print_type,pp_print_qtype = + let soc sep flag ss = + if ss = [] then "" else + let s = end_itlist (fun s1 s2 -> s1^sep^s2) ss in + if flag then "("^s^")" else s in + let rec sot pr ty = + try dest_vartype ty with Failure _ -> + match dest_type ty with + con,[] -> con + | "fun",[ty1;ty2] -> soc "->" (pr > 0) [sot 1 ty1; sot 0 ty2] + | "sum",[ty1;ty2] -> soc "+" (pr > 2) [sot 3 ty1; sot 2 ty2] + | "prod",[ty1;ty2] -> soc "#" (pr > 4) [sot 5 ty1; sot 4 ty2] + | "cart",[ty1;ty2] -> soc "^" (pr > 6) [sot 6 ty1; sot 7 ty2] + | con,args -> (soc "," true (map (sot 0) args))^con in + (fun fmt ty -> pp_print_string fmt (sot 0 ty)), + (fun fmt ty -> pp_print_string fmt ("`:" ^ sot 0 ty ^ "`"));; + +(* ------------------------------------------------------------------------- *) +(* This returns L and R if OP = c in (tm:= L OP R) *) +(* ------------------------------------------------------------------------- *) +let dest_binary' c tm = +try let il,r = dest_comb tm in +let i,l = dest_comb il in +if i = c or +(is_const i & is_const c & + reverse_interface(dest_const i) = reverse_interface(dest_const c)) +then l,r else fail() +with Failure _ -> failwith "dest_binary";; + +(* ------------------------------------------------------------------------- *) +(* string -> bool Lookup to see if operator of string is right assoc *) +(* ------------------------------------------------------------------------- *) +let is_right_assoc s = +match snd(get_infix_status s) with +|"right" -> true + | _ -> false;; + +(* ------------------------------------------------------------------------- *) +(* num -> bool *) +(* ------------------------------------------------------------------------- *) +let rec power_of_10 n = +if abs_num n bool converts bool term to ocaml bool *) +(* ------------------------------------------------------------------------- *) +let bool_of_term t = +match t with +Const("T",_) -> true +| Const("F",_) -> false + | _ -> failwith "bool_of_term";; + +(* ------------------------------------------------------------------------- *) +(* term -> int converts ASCII term into int equiv *) +(* ------------------------------------------------------------------------- *) +let code_of_term t = +let f,tms = strip_comb t in +if not(is_const f & fst(dest_const f) = "ASCII") +or not(length tms = 8) then failwith "code_of_term" +else +itlist (fun b f -> if b then 1 + 2 * f else 2 * f) +(map bool_of_term (rev tms)) 0;; + +(* ------------------------------------------------------------------------- *) +(* *) +(* ------------------------------------------------------------------------- *) +let rec dest_clause tm = +let pbod = snd(strip_exists(body(body tm))) in +let s,args = strip_comb pbod in +if name_of s = "_UNGUARDED_PATTERN" & length args = 2 then +[rand(rator(hd args));rand(rator(hd(tl args)))] +else if name_of s = "_GUARDED_PATTERN" & length args = 3 then +[rand(rator(hd args)); hd(tl args); rand(rator(hd(tl(tl args))))] +else failwith "dest_clause" ;; + +(* ------------------------------------------------------------------------- *) +(* *) +(* ------------------------------------------------------------------------- *) +let rec dest_clauses tm = +let s,args = strip_comb tm in +if name_of s = "_SEQPATTERN" & length args = 2 then +dest_clause (hd args)::dest_clauses(hd(tl args)) +else [dest_clause tm];; + + +(* ------------------------------------------------------------------------- *) +(* Allow the installation of user printers. Must fail quickly if N/A. *) +(* ------------------------------------------------------------------------- *) +let install_user_printer,delete_user_printer,try_user_printer = +let user_printers = ref ([]:(string*(term->unit))list) in +(fun pr -> user_printers := pr::(!user_printers)), +(fun s -> user_printers := snd(remove (fun (s',_) -> s = s') + (!user_printers))), +(fun tm -> tryfind (fun (_,pr) -> pr tm) (!user_printers));; + + + + + +(* ------------------------------------------------------------------------- *) +(* Type to determine how/(what tag) to print *) +(* ------------------------------------------------------------------------- *) +type term_type = Numeral | List | Char_list | Generalized_abstraction | +Empty | Universal | G_spec | Let | Decimal | Match | Function | + Insert | Cond | Other;; + +(* ------------------------------------------------------------------------- *) +(* term -> term_type *) +(* ------------------------------------------------------------------------- *) +let rec get_term_type tm = +if is_numeral tm then Numeral +else if is_list tm then +begin +try if fst(dest_type(hd(snd(dest_type(type_of tm))))) <> "char" +then fail() +else Char_list with Failure _ -> List +end +else if is_gabs tm then Generalized_abstraction +else +begin +let hop,args = strip_comb tm in +let s0 = name_of hop +and ty0 = type_of hop in +let s = reverse_interface (s0,ty0) in +if s = "EMPTY" & is_const tm & args = [] then Empty +else if s = "UNIV" & !typify_universal_set & is_const tm & args = [] +then Universal +else if s = "INSERT" & +is_const (snd(splitlist (dest_binary "INSERT") tm)) & +fst( + dest_const ( + snd( + splitlist ( + dest_binary "INSERT") tm))) = "EMPTY" then Insert +else if (s = "GSPEC") & +fst(dest_const ( + (rator o + fst o dest_comb o + fst o dest_comb o + snd o strip_exists + o body o rand)tm )) = "SETSPEC" then G_spec +else if is_let tm then Let +else if s = "DECIMAL" & +(power_of_10 ((dest_numeral o hd o tl)args)) then Decimal +else if s = "_MATCH" & +length args = 2 then Match +else if s = "_FUNCTION" & +length args = 1 then Function +else if s = "COND" & length args = 3 then Cond +else Other +end;; + + +(* ------------------------------------------------------------------------- *) +(* Printer for terms. *) +(* ------------------------------------------------------------------------- *) +let pp_print_term = +fun fmt -> +let rec print_subterm prec tm = +try try_user_printer tm with Failure _ -> +let hop,args = strip_comb tm in +let s0 = name_of hop +and ty0 = type_of hop in +let s = reverse_interface (s0,ty0) in +match get_term_type tm with +| Numeral -> + begin + open_tag "span class=\"Numeral\""; + pp_print_string fmt (string_of_num(dest_numeral tm)); + close_tag(); + end; + |Char_list -> +begin +open_tag "span class=\"Char_list\""; +pp_print_string fmt ( + "\"" ^ String.escaped (implode (map ( + String.make 1 o + Char.chr o + code_of_term ) + (dest_list tm) )) ^ "\""); +close_tag(); +end; +|List -> + begin + open_tag "span class=\"List\""; + pp_print_string fmt "["; + print_term_sequence "; " 0 (dest_list tm); + pp_print_string fmt "]"; + close_tag(); + end; + |Generalized_abstraction -> +begin +open_tag "span class=\"Generalized_abstraction\""; +print_binder prec tm; +close_tag(); +end +|Empty -> + begin + open_tag "span class=\"Empty\""; + pp_print_string fmt "{}"; + close_tag(); + end + |Universal -> +begin +let ty = fst(dest_fun_ty(type_of tm)) in +begin +open_tag "span class=\"Universal\""; +pp_print_string fmt "(:"; +pp_print_type fmt ty; +pp_print_string fmt ")"; +close_tag(); +end +end; +|Insert -> + begin + open_tag "span class=\"Insert\""; + pp_print_string fmt "{"; + print_term_sequence ", " 14 ( + fst( + splitlist (dest_binary "INSERT") tm)); + pp_print_string fmt "}"; + close_tag(); + end; + |G_spec -> +begin + +let evs,bod = strip_exists(body(rand tm)) in +let bod1,fabs = dest_comb bod in +let bod2,babs = dest_comb bod1 in +(* let c = rator bod2 in*) + +(* (let fvs = frees fabs and bvs = frees babs in + if not(!print_unambiguous_comprehensions) & + set_eq evs + (if (length fvs <= 1 or bvs = []) then fvs + else intersect fvs bvs) + then () + else (print_term_sequence "," 14 evs; + pp_print_string fmt " | ")); + *) +open_tag "span class=\"G_spec\""; +pp_print_string fmt "{"; +print_subterm 0 fabs; +pp_print_string fmt " | "; +print_subterm 0 babs; +pp_print_string fmt "}"; +close_tag(); +end; +|Let -> + begin + open_tag "span class=\"Let\""; + let eqs,bod = dest_let tm in + (if prec = 0 then pp_open_hvbox fmt 0 + else (pp_open_hvbox fmt 1; pp_print_string fmt "("); + pp_print_string fmt "let "; + print_subterm 0 (mk_eq(hd eqs)); + do_list (fun (v,t) -> pp_print_break fmt 1 0; + pp_print_string fmt "and "; + print_subterm 0 (mk_eq(v,t))) + (tl eqs); + pp_print_string fmt " in"; + pp_print_break fmt 1 0; + print_subterm 0 bod; + if prec = 0 then () else pp_print_string fmt ")"; + pp_close_box fmt ()); + close_tag(); + end; + |Decimal -> +begin +open_tag "span class=\"Decimal\""; +let n_num = dest_numeral (hd args) +and n_den = dest_numeral (hd(tl args)) in +let s_num = string_of_num(quo_num n_num n_den) in +let s_den = implode( + tl(explode(string_of_num + (n_den +/ (mod_num n_num n_den))))) in +pp_print_string fmt( + "#"^s_num^(if n_den = Int 1 then "" else ".")^s_den); +close_tag(); +end; +|Match -> + begin + + open_tag "span class=\"Match\""; + let cls = dest_clauses(hd(tl args)) in + (if prec = 0 then () else pp_print_string fmt "("; + pp_open_hvbox fmt 0; + pp_print_string fmt "match "; + print_subterm 0 (hd args); + pp_print_string fmt " with"; + pp_print_break fmt 1 2; + print_clauses cls; + pp_close_box fmt (); + if prec = 0 then () else pp_print_string fmt ")"); + close_tag(); + end + |Function -> +begin +open_tag "span class=\"Function\""; +let cls = dest_clauses(hd args) in +(if prec = 0 then () else pp_print_string fmt "("; + pp_open_hvbox fmt 0; + pp_print_string fmt "function"; + pp_print_break fmt 1 2; + print_clauses cls; + pp_close_box fmt (); + if prec = 0 then () else pp_print_string fmt ")"); +close_tag(); +end +|Cond -> + begin + open_tag "span class=\"Cond\""; + + (if prec = 0 then () else pp_print_string fmt "("; + pp_open_hvbox fmt (-1); + pp_print_string fmt "if "; + print_subterm 0 (hd args); + pp_print_break fmt 0 0; + pp_print_string fmt " then "; + print_subterm 0 (hd(tl args)); + pp_print_break fmt 0 0; + pp_print_string fmt " else "; + print_subterm 0 (hd(tl(tl args))); + pp_close_box fmt (); + if prec = 0 then () else pp_print_string fmt ")"); + close_tag(); + end + |_ -> +begin +if is_prefix s & length args = 1 then +(if prec = 1000 then pp_print_string fmt "(" else (); + pp_print_string fmt s; + (if isalnum s or + s = "--" & + length args = 1 & + (try let l,r = dest_comb(hd args) in + let s0 = name_of l in + s0 = "--" or + mem (fst(dest_const l)) ["real_of_num"; "int_of_num"] + with Failure _ -> false) or + s = "~" & length args = 1 & is_neg(hd args) + then pp_print_string fmt " " else ()); + print_subterm 999 (hd args); + if prec = 1000 then pp_print_string fmt ")" else ()) +else if parses_as_binder s & length args = 1 & is_gabs (hd args) then +print_binder prec tm +else if can get_infix_status s & length args = 2 then +let bargs = +if is_right_assoc s then +let tms,tmt = splitlist (dest_binary' hop) tm in tms@[tmt] +else +let tmt,tms = rev_splitlist (dest_binary' hop) tm in tmt::tms in +let newprec = fst(get_infix_status s) in +(if newprec <= prec then + (pp_open_hvbox fmt 1; pp_print_string fmt "(") + else pp_open_hvbox fmt 0; + print_subterm newprec (hd bargs); + do_list (fun x -> if mem s (!unspaced_binops) then () + else if mem s (!prebroken_binops) + then pp_print_break fmt 1 0 + else pp_print_string fmt " "; + pp_print_string fmt s; + if mem s (!unspaced_binops) + then pp_print_break fmt 0 0 + else if mem s (!prebroken_binops) + then pp_print_string fmt " " + else pp_print_break fmt 1 0; + print_subterm newprec x) (tl bargs); + if newprec <= prec then pp_print_string fmt ")" else (); + pp_close_box fmt ()) + else if (is_const hop or is_var hop) & args = [] then + let s' = if parses_as_binder s or can get_infix_status s or is_prefix s + then "("^s^")" else s in + pp_print_string fmt s' + else + let l,r = dest_comb tm in + (pp_open_hvbox fmt 0; + if prec = 1000 then pp_print_string fmt "(" else (); + print_subterm 999 l; + (if try mem (fst(dest_const l)) ["real_of_num"; "int_of_num"] + with Failure _ -> false + then () else pp_print_space fmt ()); + print_subterm 1000 r; + if prec = 1000 then pp_print_string fmt ")" else (); + pp_close_box fmt ()) + + end + + + + (* Code is safe down here *) + + + + + and print_term_sequence sep prec tms = + if tms = [] then () else + (print_subterm prec (hd tms); + let ttms = tl tms in + if ttms = [] then () + else (pp_print_string fmt sep; print_term_sequence sep prec ttms)) + + + and print_clauses cls = + match cls with + [c] -> print_clause c + | c::cs -> (print_clause c; + pp_print_break fmt 1 0; + pp_print_string fmt "| "; + print_clauses cs) + + and print_binder prec tm = + let absf = is_gabs tm in + let s = if absf then "\\" else name_of(rator tm) in + let rec collectvs tm = + if absf then + if is_abs tm then + let v,t = dest_abs tm in + let vs,bod = collectvs t in (false,v)::vs,bod + else if is_gabs tm then + let v,t = dest_gabs tm in + let vs,bod = collectvs t in (true,v)::vs,bod + else [],tm + else if is_comb tm & name_of(rator tm) = s then + if is_abs(rand tm) then + let v,t = dest_abs(rand tm) in + let vs,bod = collectvs t in (false,v)::vs,bod + else if is_gabs(rand tm) then + let v,t = dest_gabs(rand tm) in + let vs,bod = collectvs t in (true,v)::vs,bod + else [],tm + else [],tm in + let vs,bod = collectvs tm in + begin + open_tag "span class=\"binder\""; + (if prec = 0 then pp_open_hvbox fmt 4 + else (pp_open_hvbox fmt 5; pp_print_string fmt "(")); + pp_print_string fmt s; + (if isalnum s then pp_print_string fmt " " else ()); + do_list (fun (b,x) -> + (if b then pp_print_string fmt "(" else ()); + print_subterm 0 x; + (if b then pp_print_string fmt ")" else ()); + pp_print_string fmt " ") (butlast vs); + (if fst(last vs) then pp_print_string fmt "(" else ()); + print_subterm 0 (snd(last vs)); + (if fst(last vs) then pp_print_string fmt ")" else ()); + pp_print_string fmt "."; + (if length vs = 1 then pp_print_string fmt " " + else pp_print_space fmt ()); + print_subterm 0 bod; + (if prec = 0 then () else pp_print_string fmt ")"); + pp_close_box fmt (); + close_tag(); + end; + + and print_clause cl = + match cl with + [p;g;r] -> (print_subterm 1 p; + pp_print_string fmt " when "; + print_subterm 1 g; + pp_print_string fmt " -> "; + print_subterm 1 r) + | [p;r] -> (print_subterm 1 p; + pp_print_string fmt " -> "; + print_subterm 1 r) + in print_subterm 0;; + +(* ------------------------------------------------------------------------- *) +(* Print term with quotes. *) +(* ------------------------------------------------------------------------- *) + +let pp_print_qterm fmt tm = +new_output_functions output_functions; +open_tag "HTML"; +open_tag "HEAD"; +open_tag "TITLE"; +close_tag (); +open_tag "style type=\"text/css\""; +pp_print_as fmt 0 ".real {color:teal; background-color:white; font-weight:bold; text-align:center;} .num {color:fuchsia; background-color:white; font-weight:bold; text-align:center;} .int {color:olive; background-color:white; font-weight:bold; text-align:center;}"; +close_tag(); +close_tag(); +open_tag "BODY"; +open_tag "TT"; +pp_print_term fmt tm; +close_tag(); +close_tag(); +close_tag(); +restore_output_functions output_functions;; + + +(* ------------------------------------------------------------------------- *) +(* Printer for theorems. *) +(* ------------------------------------------------------------------------- *) + +let pp_print_thm fmt th = +let asl,tm = dest_thm th in +(if not (asl = []) then + (if !print_all_thm then + (pp_print_term fmt (hd asl); + do_list (fun x -> pp_print_string fmt ","; + pp_print_space fmt (); + pp_print_term fmt x) + (tl asl)) + else pp_print_string fmt "..."; + pp_print_space fmt ()) + else (); + pp_open_hbox fmt(); + + pp_print_string fmt "|- "; + pp_print_term fmt tm; + pp_close_box fmt ());; + +let pp_print_thm' = pp_print_thm;; +let pp_print_thm fmt tm = +new_output_functions output_functions; +open_tag "HTML"; +open_tag "HEAD"; +open_tag "TITLE"; +close_tag(); +open_tag "style type=\"text/css\""; +pp_print_as fmt 0 ".real {color:teal; background-color:white; font-weight:bold; text-align:center;} .num {color:fuchsia; background-color:white; font-weight:bold; text-align:center;} .int {color:olive; background-color:white; font-weight:bold; text-align:center;}"; +close_tag(); +close_tag(); +open_tag "BODY"; +open_tag "TT"; +pp_print_thm fmt tm; +close_tag(); +close_tag(); +close_tag(); +restore_output_functions output_functions;; + + +(* ------------------------------------------------------------------------- *) +(* Print on standard output. *) +(* ------------------------------------------------------------------------- *) + +let print_type = pp_print_type std_formatter;; +let print_qtype = pp_print_qtype std_formatter;; +let print_term = pp_print_term std_formatter;; +let print_qterm = pp_print_qterm std_formatter;; +let print_thm = pp_print_thm std_formatter;; + +(* ------------------------------------------------------------------------- *) +(* Install all the printers. *) +(* ------------------------------------------------------------------------- *) + +#install_printer print_qtype;; +#install_printer print_qterm;; +#install_printer print_thm;; + +(* ------------------------------------------------------------------------- *) +(* Conversions to string. *) +(* ------------------------------------------------------------------------- *) + +let print_to_string printer = +let sbuff = ref "" in +let output s m n = sbuff := (!sbuff)^(String.sub s m n) and flush() = () in +let fmt = make_formatter output flush in +ignore(pp_set_max_boxes fmt 100); +fun i -> ignore(printer fmt i); +ignore(pp_print_flush fmt ()); +let s = !sbuff in sbuff := ""; s;; + +let string_of_type = print_to_string pp_print_type;; +let string_of_term = print_to_string pp_print_term;; +let string_of_thm = print_to_string pp_print_thm;; + +(* ------------------------------------------------------------------------- *) +(* Print types *) +(* ------------------------------------------------------------------------- *) + +let print_typed_var tm = +let s,ty = dest_var tm in +begin +open_tag("span class=\""^(string_of_type ty)^"\""); +print_string(s); +close_tag(); +end in +install_user_printer("print_typed_var", print_typed_var);; +set_mark_tags true;; + +let pp_print_string = pp_print_string';; +let print_string = print_string';; + + + diff --git a/jHOLLight/caml/raw_printer.hl b/jHOLLight/caml/raw_printer.hl new file mode 100644 index 0000000..bdf12e6 --- /dev/null +++ b/jHOLLight/caml/raw_printer.hl @@ -0,0 +1,70 @@ +let clear_goalstack() = + current_goalstack := [];; + + +let top_goalstate() = + if !current_goalstack = [] then + (null_meta, [], fun _ [th] -> th) + else + hd (!current_goalstack);; + + +let raw_print_string str = + print_string ("$begin$" ^ str ^ "$end$");; + + +let raw_string_of_int i = string_of_num i;; + + +let raw_string_of_bool b = if b then "true" else "false";; + + +let raw_string_of_string str = "\"" ^ str ^ "\"";; + + +let rec raw_string_of_type = + function + (Tyapp(name, args)) -> "Tyapp(\"" ^ name ^ "\"[" ^ String.concat "," (map raw_string_of_type args) ^ "])" + | (Tyvar v) -> "Tyvar(\"" ^ v ^ "\")";; + + + +let rec raw_string_of_term = + function + Var(name,ty) -> "Var(\"" ^ name ^ "\"," ^ raw_string_of_type ty ^ ")" + | Const(name,ty) -> "Const(\"" ^ name ^ "\"," ^ raw_string_of_type ty ^ ")" + | Comb(f,a) -> "Comb(" ^ raw_string_of_term f ^ "," ^ raw_string_of_term a ^ ")" + | Abs(v,b) -> "Abs(" ^ raw_string_of_term v ^ "," ^ raw_string_of_term b ^ ")";; + + + + +let raw_string_of_list el_type el_f list = + let str = String.concat ";" (map el_f list) in + "List(" ^ el_type ^ ",[" ^ str ^ "])";; + + + +let raw_string_of_thm th = + let c = raw_string_of_term (concl th) in + let h = raw_string_of_list "Term" raw_string_of_term (hyp th) in + "Theorem(" ^ h ^ "," ^ c ^ ")";; + + + +let raw_string_of_pair f_fst f_snd p = + "Pair(" ^ f_fst (fst p) ^ "," ^ f_snd (snd p) ^ ")";; + + + +let raw_string_of_goal (g:goal) = + let assumptions = raw_string_of_list "Pair(String,Theorem)" (raw_string_of_pair raw_string_of_string raw_string_of_thm) (fst g) in + let c = raw_string_of_term (snd g) in + "Goal(" ^ assumptions ^ "," ^ c ^ ")";; + + + +let raw_string_of_goalstate (g:goalstate) = + let s (_,b,_) = b in + let goals = raw_string_of_list "Goal" raw_string_of_goal (s g) in + "Goalstate("^goals^")";; diff --git a/jHOLLight/caml/sections.hl b/jHOLLight/caml/sections.hl new file mode 100644 index 0000000..6aa677c --- /dev/null +++ b/jHOLLight/caml/sections.hl @@ -0,0 +1,327 @@ +module Sections = struct + +(* Basic commands for working with the goal stack *) +(* b() from tactics.ml *) +let revert_proof_step() = + let l = !current_goalstack in + if length l = 1 then failwith "Can't back up any more" else + current_goalstack := tl l; + !current_goalstack;; + + +(* A flag for fast proof loading (using mk_thm) *) +let fast_load_flag = ref false;; + +(* Section variables, hypotheses (with labels), implicit types, and auxiliary lemmas *) +type section_info = +{ + vars : term list; + hyps : (string * term) list; + types : (string * hol_type) list; + lemmas : (string * thm) list; +};; + + +let empty_section : section_info = {vars = []; hyps = []; types = []; lemmas = []};; + +let section_stack = ref ([] : (string * section_info ref) list);; + + +(* Begins a new section *) +let begin_section name = + let sections = !section_stack in + if can (C assoc sections) name then + failwith ("Section " ^ name ^ " is already active") + else + let sections = (name, ref empty_section) :: sections in + section_stack := sections;; + + +(* Ends the active section *) +let end_section name = + let sections = !section_stack in + if sections = [] then + failwith "end_section: No open sections" + else + let last_name, _ = hd sections in + if Pervasives.compare last_name name <> 0 then + failwith ("The last open section is " ^ last_name) + else + section_stack := tl sections;; + + +(* Ends all sections *) +let end_all_sections () = + section_stack := [];; + + +(* Returns all section variables in the current section *) +let current_section_vars () = + if !section_stack = [] then [] + else + !((snd o hd) !section_stack).vars;; + + +(* Returns all hypotheses in the current section *) +let current_section_hyps () = + if !section_stack = [] then [] + else + !((snd o hd) !section_stack).hyps;; + + +(* Returns all section variables from all sections *) +let section_vars () : term list = + let vars = map (fun (_, s) -> !s.vars) !section_stack in + List.concat vars;; + + +(* Returns all implicit types from all sections *) +let section_types () : (string * hol_type) list = + let types = map (fun (_, s) -> !s.types) !section_stack in + List.concat types;; + + +(* Returns all hypotheses from all sections *) +let section_hyps () : (string * term) list = + let hyps = map (fun (_, s) -> !s.hyps) !section_stack in + List.concat hyps;; + + +(* Returns all lemmas from all sections *) +let section_lemmas () : (string * thm) list = + let lemmas = map (fun (_, s) -> !s.lemmas) !section_stack in + List.concat lemmas;; + + +(* Returns names of all section lemmas and hypotheses *) +let section_labels () : string list = + let hyp_names = map fst (section_hyps()) and + lemma_names = map fst (section_lemmas()) in + hyp_names @ lemma_names;; + + +(* Instantiates types of section variables in the term *) +let inst_section_vars tm = + let s_vars = map dest_var (section_vars()) in + let find_var (name, ty) = + try (assoc name s_vars, ty) + with Failure _ -> (bool_ty, bool_ty) in + let inst_var (name, ty) tm = + let ty_dst, ty_src = find_var (name, ty) in + try (inst (type_match ty_src ty_dst []) tm) + with Failure _ -> + failwith ("Section variable " ^ name ^ + " has type " ^ string_of_type ty_dst) in + let f_vars = map dest_var (frees tm) in + itlist inst_var f_vars tm;; + + +(* Instantiates implicit types in the given term *) +(* (free variables and top generalized variables are considered in the term) *) +let inst_section_types tm = + let s_types = section_types() in + let find_type tm = + let name, ty = dest_var tm in + try (assoc name s_types, ty) with Failure _ -> (bool_ty, bool_ty) in + let f_vars = frees tm in + let g_vars, _ = strip_forall tm in + let ty_dst, ty_src = unzip (map find_type (g_vars @ f_vars)) in + let ty_inst = itlist2 type_match ty_src ty_dst [] in + inst ty_inst tm;; + + +(* Checks if the term contains any free variables + which are not section variables *) +let check_section_term tm = + let f_vars = frees tm in + if !section_stack = [] then + if f_vars <> [] then + let str = String.concat ", " (map string_of_term f_vars) in + failwith ("Free variables: " ^ str) + else () + else + let s_vars = section_vars() in + let vars = subtract f_vars s_vars in + if vars <> [] then + let str = String.concat ", " (map string_of_term vars) in + failwith ("Free variables: " ^ str) + else ();; + + +(* Adds the given variable to the active section *) +let add_section_var var = + let sections = !section_stack in + if sections = [] then + failwith "add_section_var: No open sections" + else + let s_var = section_vars() in + let var_name, _ = dest_var var in + if can (C assoc (map dest_var s_var)) var_name then + failwith ("A variable with the name "^var_name^" is already defined") + else + let section = (snd o hd) sections in + section := {!section with vars = var :: !section.vars};; + + +(* Adds the given implicit type to the active section *) +let add_section_type tm = + let sections = !section_stack in + if sections = [] then + failwith "add_section_type: No open sections" + else + let s_types = section_types() in + let var_name, ty = dest_var tm in + if can (C assoc s_types) var_name then + failwith ("An implicit type for the variable "^var_name^" is already defined") + else + let section = (snd o hd) sections in + section := {!section with types = (var_name, ty) :: !section.types};; + +(* Adds the given lemma to the active section *) +let add_section_lemma name th = + let sections = !section_stack in + if sections = [] then + failwith "add_section_lemma: No open sections" + else + let labels = section_labels() in + if mem name labels then + failwith ("A lemma (or hypothesis) with the name " ^ name ^ " is already defined") + else + let section = (snd o hd) sections in + section := {!section with lemmas = (name, th) :: !section.lemmas};; + + +(* Adds the given hypothesis (term) to the active section *) +let add_section_hyp label hyp = + let sections = !section_stack in + if sections = [] then + failwith "add_section_hyp: No open sections" + else + let labels = section_labels() in + if mem label labels then + failwith ("A hypothesis (or lemma) with the label " ^ label ^ " is already defined") + else + let hyp0 = inst_section_vars hyp in + let hyp1 = inst_section_types hyp0 in + if type_of hyp1 <> bool_ty then + failwith "A boolean term is expected" + else + let section = (snd o hd) sections in + check_section_term hyp1; + section := {!section with hyps = (label, hyp1) :: !section.hyps};; + + +(* Removes the given variable from the active section *) +let remove_section_var var_name = + let sections = !section_stack in + if sections = [] then + failwith "remove_section_var: No open sections" + else + let section = (snd o hd) sections in + let new_vars = filter (fun var -> (fst o dest_var) var <> var_name) !section.vars in + section := {!section with vars = new_vars};; + + +(* Removes the given implicit type from the active section *) +let remove_section_type type_name = + let sections = !section_stack in + if sections = [] then + failwith "remove_section_type: No open sections" + else + let section = (snd o hd) sections in + let new_types = filter (fun name, _ -> name <> type_name) !section.types in + section := {!section with types = new_types};; + + +(* Removes the given lemma from the active section *) +let remove_section_lemma lemma_name = + let sections = !section_stack in + if sections = [] then + failwith "remove_section_lemma: No open sections" + else + let section = (snd o hd) sections in + let new_lemmas = filter (fun name, _ -> name <> lemma_name) !section.lemmas in + section := {!section with lemmas = new_lemmas};; + + +(* Removes the given assumption from the active section *) +let remove_section_hyp label = + let sections = !section_stack in + if sections = [] then + failwith "remove_section_hyp: No open sections" + else + let section = (snd o hd) sections in + let new_hyps = filter (fun name, _ -> name <> label) !section.hyps in + section := {!section with hyps = new_hyps};; + + +(* Prepares a goal term *) +let prepare_goal_term tm = + if !section_stack = [] then (check_section_term tm; tm) + else + let tm0 = inst_section_vars tm in + let tm1 = inst_section_types tm0 in + let s_hyps = map snd (section_hyps()) in + let r = itlist (curry mk_imp) s_hyps tm1 in + check_section_term r; r;; + + +(* Prepares a goal term and an initial tactic *) +let prepare_section_proof names tm = + let f_vars = map dest_var (frees tm) in + let find_type var_name = + try assoc var_name f_vars with Failure _ -> failwith ("Unused variable: " ^ var_name) in + let g_vars = map (fun name -> mk_var (name, find_type name)) names in + let g_tm = list_mk_forall (g_vars, tm) in + let tm0 = prepare_goal_term g_tm in + let hyp_names = map fst (section_hyps()) in + let lemmas = section_lemmas() in + let gen_tac = REPLICATE_TAC (length g_vars) GEN_TAC in + let disch_tac = itlist (fun name tac -> DISCH_THEN (LABEL_TAC name) THEN tac) hyp_names ALL_TAC in + let assume_tac = itlist (fun (name,lemma) tac -> LABEL_TAC name lemma THEN tac) lemmas ALL_TAC in + tm0, assume_tac THEN disch_tac THEN gen_tac;; + + +(* Starts a proof of the goal using section hypotheses *) +let start_section_proof names tm = + let tm0, tac0 = prepare_section_proof names tm in + let _ = set_goal([], tm0) in + refine (by (VALID tac0));; + + +(* Returns the final theorem *) +let end_section_proof () = + let th = top_thm() in + let hyps = section_hyps() in + itlist (fun _ th -> UNDISCH th) hyps th;; + + +(* Proves a lemma using section hypotheses and variables *) +let section_proof names tm tac_list = + let tm0, tac0 = prepare_section_proof names tm in + let gstate = mk_goalstate ([], tm0) in + let tac_list1 = + if !fast_load_flag then + [fun g -> ACCEPT_TAC(mk_thm([], snd g)) g] + else + tac_list in + let _, sgs, just = rev_itlist by (tac0 :: tac_list1) gstate in + let th0 = + if sgs = [] then just null_inst [] + else failwith "section_proof: unsolved goals" in + let hyps = section_hyps() in + itlist (fun _ th -> UNDISCH th) hyps th0;; + + +(* Discharges all assumptions and generalizes all section variables *) +let finalize_theorem th = + let hyps = map snd (current_section_hyps()) in + let th_hyps = hyp th in + let hyps0 = intersect hyps th_hyps in + let s_vars = current_section_vars() in + let th1 = rev_itlist (fun hyp th -> DISCH hyp th) hyps0 th in + let f_vars = frees (concl th1) in + let vars = intersect f_vars s_vars in + itlist (fun var th -> GEN var th) vars th1;; + +end;; diff --git a/jHOLLight/caml/ssreflect.hl b/jHOLLight/caml/ssreflect.hl new file mode 100644 index 0000000..0cf045f --- /dev/null +++ b/jHOLLight/caml/ssreflect.hl @@ -0,0 +1,1059 @@ +(* A special definition for introducing equalities with the construction move eq: a => b *) +let ssreflect_eq_def = new_definition `!v P. ssreflect_eq (v:A) (P:bool) = P`;; + + +(* Generalizes given variables in a term *) +let gen_variables binders tm = + if type_of tm <> bool_ty then + if length binders = 0 then tm + else + failwith "gen_variables: bool term is required" + else + let f_vars = map dest_var (frees tm) in + let find_type name = assoc name f_vars in + let gen_variable var_name tm = + let var = + try mk_var (var_name, find_type var_name) + with Failure _ -> + failwith ("gen_variables: variable "^var_name + ^" is not free in the term "^(string_of_term tm)) in + mk_forall (var, tm) in + itlist gen_variable binders tm;; + + +(* Combined type of theorems and terms *) +type arg_type = Arg_theorem of thm | Arg_term of term | Arg_type of hol_type;; + +let get_arg_thm arg = + match arg with + | Arg_theorem th -> th + | _ -> failwith "A theorem expected";; + +let get_arg_term arg = + match arg with + | Arg_term tm -> tm + | _ -> failwith "A term expected";; + +let get_arg_type arg = + match arg with + | Arg_type ty -> ty + | _ -> failwith "A type expected";; + + +(* Converts a theorem tactic into a tactic which accepts thm_term arguments *) +let thm_tac (ttac : thm_tactic) = ttac o get_arg_thm;; +let term_tac (ttac : term -> tactic) = ttac o get_arg_term;; +let type_tac (ttac : hol_type -> tactic) arg = ttac o get_arg_type;; + + +let conv_thm_tac (ttac : thm_tactic->tactic) (arg_tac : arg_type->tactic) = + ttac (fun th -> arg_tac (Arg_theorem th));; + + + +(* Based on the code from tactics.ml *) +(* Applies the second tactic to either the first subgoal or + the last subgoal *) +let (THENL_FIRST),(THENL_LAST) = + let propagate_empty i [] = [] + and propagate_thm th i [] = INSTANTIATE_ALL i th in + let compose_justs n just1 just2 i ths = + let ths1,ths2 = chop_list n ths in + (just1 i ths1)::(just2 i ths2) in + let rec seqapply l1 l2 = match (l1,l2) with + ([],[]) -> null_meta,[],propagate_empty + | ((tac:tactic)::tacs),((goal:goal)::goals) -> + let ((mvs1,insts1),gls1,just1) = tac goal in + let goals' = map (inst_goal insts1) goals in + let ((mvs2,insts2),gls2,just2) = seqapply tacs goals' in + ((union mvs1 mvs2,compose_insts insts1 insts2), + gls1@gls2,compose_justs (length gls1) just1 just2) + | _,_ -> failwith "seqapply: Length mismatch" in + let justsequence just1 just2 insts2 i ths = + just1 (compose_insts insts2 i) (just2 i ths) in + let tacsequence ((mvs1,insts1),gls1,just1) tacl = + let ((mvs2,insts2),gls2,just2) = seqapply tacl gls1 in + let jst = justsequence just1 just2 insts2 in + let just = if gls2 = [] then propagate_thm (jst null_inst []) else jst in + ((union mvs1 mvs2,compose_insts insts1 insts2),gls2,just) in + let (thenl_first: tactic -> tactic -> tactic) = + fun tac1 tac2 g -> + let _,gls,_ as gstate = tac1 g in + if gls = [] then failwith "No subgoals" + else + let tac_list = tac2 :: (replicate ALL_TAC (length gls - 1)) in + tacsequence gstate tac_list + and (thenl_last: tactic -> tactic -> tactic) = + fun tac1 tac2 g -> + let _,gls,_ as gstate = tac1 g in + if gls = [] then failwith "No subgoals" + else + let tac_list = (replicate ALL_TAC (length gls - 1)) @ [tac2] in + tacsequence gstate tac_list in + thenl_first, thenl_last;; + + +(* Rotates the goalstack *) +let (THENL_ROT: int -> tactic -> tactic) = + fun n tac g -> + let gstate = tac g in + rotate n gstate;; + + +(* Repeats the given tactic exactly n times and then repeats the same tactic at most m times *) +let repeat_tactic n m tac = + let rec replicate_at_most m tac = + if m <= 0 then ALL_TAC else (tac THEN replicate_at_most (m - 1) tac) ORELSE ALL_TAC in + REPLICATE_TAC n tac THEN replicate_at_most m tac;; + + + +(* Returns all free variables in the goal *) +let get_context_vars (g : goal) = + let list, g_tm = g in + let tms = g_tm :: map (concl o snd) list in + let f_vars = setify (flat (map frees tms)) in + map (fun v -> ((fst o dest_var) v, v)) f_vars;; + + +(* Clears the given assumption *) +let clear_assumption name = + TRY (REMOVE_THEN name (fun th -> ALL_TAC));; + + +(* DISCH_THEN (LABEL_TAC name) for assumptions and X_GEN_TAC name for variables *) +let move labels = + (* Automatically introduces an assumption for a top-level ssreflect_eq *) + let move_eq (g:goal) = + let g_tm = snd g in + let tac = + try + let eq_tm = (rator o fst o dest_imp) g_tm in + if (fst o dest_const o rator) eq_tm = "ssreflect_eq" then + let label = (fst o dest_var o rand) eq_tm in + DISCH_THEN (LABEL_TAC label o PURE_ONCE_REWRITE_RULE[ssreflect_eq_def]) + else + ALL_TAC + with Failure _ -> ALL_TAC in + tac g in + + let move1 name (g:goal) = + let g_tm = snd g in + let tac = + if is_forall g_tm then + let tm0, g_tm1 = dest_forall g_tm in + let tm = mk_var (name, type_of tm0) in + if name = "_" then + GEN_TAC + else + X_GEN_TAC tm + else + if is_imp g_tm then + if name = "_" then + DISCH_THEN (fun th -> ALL_TAC) + else + DISCH_THEN (LABEL_TAC name) + else + failwith "move: not (!) or (==>)" in + tac g in + fun g -> + let tac = itlist + (fun name tac -> move_eq THEN move1 name THEN tac) labels ALL_TAC in + tac g;; + + +(* Localization tactical *) +let in_tac a_list in_goal tac (g:goal) = + let goal_tm = snd g in + let tmp_goal_name = "$_goal_$" in + let tmp_goal_var = mk_var (tmp_goal_name, bool_ty) in + let tmp_goal = mk_eq (tmp_goal_var, goal_tm) in + let tmp_goal_sym = mk_eq (goal_tm, tmp_goal_var) in + let disch_tac = + rev_itlist (fun name tac -> REMOVE_THEN name MP_TAC THEN tac) a_list ALL_TAC in + let intro_tac = move a_list in + let hide_goal, unfold_goal = + if in_goal then + ALL_TAC, ALL_TAC + else + ABBREV_TAC tmp_goal, + EXPAND_TAC tmp_goal_name THEN + UNDISCH_TAC tmp_goal_sym THEN DISCH_THEN (fun th -> ALL_TAC) + in + (hide_goal THEN disch_tac THEN tac THEN TRY intro_tac THEN unfold_goal) g;; + + + +(* Finds a subterm in the given term which matches against the given + pattern; local_consts is a list of variable which must be fixed in + the pattern. + This function returns the path to the first matched subterm *) +let match_subterm local_consts pat tm = + let rec find tm path = + try + let inst = term_match local_consts pat tm in + if instantiate inst pat = tm then path else failwith "Bad instantiation" + with x -> + try + match tm with + | Abs(_, b_tm) -> find b_tm (path^"b") + | Comb(l_tm, r_tm) -> + try find l_tm (path^"l") + with Failure _ -> find r_tm (path^"r") + | _ -> failwith "match_subterm: no match" + with x -> + failwith ("match_subterm: no match: "^string_of_term pat) in + find tm "";; + + + +(* Returns paths to all subterms satisfying p *) +let find_all_paths p tm = + let rec find_path p tm path = + let paths = + match tm with + | Abs(_, b_tm) -> + find_path p b_tm (path ^ "b") + | Comb(l_tm, r_tm) -> + (find_path p l_tm (path ^ "l")) @ (find_path p r_tm (path ^ "r")) + | _ -> [] in + if p tm then path :: paths else paths in + find_path p tm "";; + + +(* Instantiates types of the given context variables in the given term.*) +let inst_context_vars vars tm_vars tm = + let find_type var = + let name, ty = dest_var var in + try + (ty, type_of (assoc name vars)) + with Failure _ -> + failwith (name^" is free in the term `"^(string_of_term tm)^"` and in the context") in + let ty_src, ty_dst = unzip (map find_type tm_vars) in + let ty_inst = itlist2 type_match ty_src ty_dst [] in + inst ty_inst tm;; + + +(* Instantiates types of all free variables in the term using the context *) +let inst_all_free_vars tm (g : goal) = + let context_vars = get_context_vars g in + let f_vars = frees tm in + inst_context_vars context_vars f_vars tm;; + + +(* Finds a subterm corresponding to the given pattern. + Before matching, the term types are instantiated in the given context. *) +let match_subterm_in_context pat tm (g : goal) = + let context_vars = get_context_vars g in + let f0_vars = filter (fun tm -> ((fst o dest_var) tm).[0] <> '_') (frees pat) in + let pattern = inst_context_vars context_vars f0_vars pat in + let f1_vars = filter (fun tm -> ((fst o dest_var) tm).[0] <> '_') (frees pattern) in + match_subterm f1_vars pattern tm;; + + +(*************************) +(* Rewriting *) +(*************************) + +(* Breaks conjunctions and does other misc stuff *) +let rec break_conjuncts th : thm list = + (* Convert P ==> (!x. Q x) to !x. P ==> Q x and P ==> Q ==> R to P /\ Q ==> R *) + let th0 = PURE_REWRITE_RULE[GSYM RIGHT_FORALL_IMP_THM; IMP_IMP] th in + let th1 = SPEC_ALL th0 in + (* Break top level conjunctions *) + let th_list = CONJUNCTS th1 in + if length th_list > 1 then + List.concat (map break_conjuncts th_list) + else + let th_tm = concl th1 in + (* Deal with assumptions *) + if is_imp th_tm then + let a_tm = lhand th_tm in + let th_list = break_conjuncts (UNDISCH th1) in + map (DISCH a_tm) th_list + else + if is_eq th_tm then [th1] + else + if is_neg th_tm then + [PURE_ONCE_REWRITE_RULE[TAUT `~P <=> (P <=> F)`] th1] + else + [EQT_INTRO th1];; + + +(* Finds an instantination for the given term inside another term *) +let rec find_term_inst local_consts tm src_tm path = + try (term_match local_consts tm src_tm, true, path) + with Failure _ -> + match src_tm with + | Comb(l_tm, r_tm) -> + let r_inst, flag, s = find_term_inst local_consts tm l_tm (path ^ "l") in + if flag then (r_inst, flag, s) + else + find_term_inst local_consts tm r_tm (path ^ "r") + | Abs(_, b_tm) -> + find_term_inst local_consts tm b_tm (path ^ "b") + | _ -> (([],[],[]), false, path);; + + + +(* Rewrites the subterm at the given path using the given equation theorem *) +let path_rewrite path th tm = + let rec build path tm = + let n = String.length path in + if n = 0 then + th + else + let ch = path.[0] in + let path' = String.sub path 1 (n - 1) in + if ch = 'l' then + let lhs, rhs = dest_comb tm in + let th0 = build path' lhs in + AP_THM th0 rhs + else if ch = 'r' then + let lhs, rhs = dest_comb tm in + let th0 = build path' rhs in + AP_TERM lhs th0 + else if ch = 'b' then + let var, body = dest_abs tm in + let th0 = build path' body in + try ABS var th0 + with Failure _ -> failwith ("ABS failed: (" ^ string_of_term var ^ ", " ^ string_of_thm th0) + else + failwith ("Bad path symbol: "^path) in + let res = build path tm in + let lhs = (lhand o concl) res in + if not (aconv lhs tm) then failwith ("path_rewrite: incorrect result [required: "^ + (string_of_term tm)^"; obtained: "^ + (string_of_term lhs)) + else + res;; + + +let new_rewrite occ pat th g = + let goal_tm = snd g in + (* Free variables in the given theorem will not be matched *) + let local_consts = frees (concl th) in + (* Apply the pattern *) + let goal_subterm_path = + if pat = [] then "" else match_subterm_in_context (hd pat) goal_tm g in + let goal_subterm = follow_path goal_subterm_path goal_tm in + + (* Local rewrite function *) + let rewrite th = + let concl_th = concl th in + let cond_flag = is_imp concl_th in + let match_fun = lhs o (if cond_flag then rand else I) in + + (* Match the theorem *) + let lhs_tm = match_fun concl_th in + let ii, flag, path = find_term_inst local_consts lhs_tm goal_subterm goal_subterm_path in + if not flag then + failwith (string_of_term lhs_tm ^ " does not match any subterm in the goal") + else + let matched_th = INSTANTIATE ii th in + let matched_tm = (match_fun o concl) matched_th in + + (* Find all matched subterms *) + let paths = find_all_paths (fun x -> aconv x matched_tm) goal_tm in + let paths = if occ = [] then paths else + map (fun i -> List.nth paths (i - 1)) occ in + + (* Find all free variables in the matched theorem which do not correspond to free variables in + the matched subterm *) + let tm_frees = frees matched_tm in + let mth_frees = frees (concl matched_th) in + let vars = subtract mth_frees (union local_consts tm_frees) in + if vars = [] then + (* Construct the tactic for rewriting *) + let r_tac = fun th -> MAP_EVERY (fun path -> CONV_TAC (path_rewrite path th)) paths in + if cond_flag then + MP_TAC matched_th THEN ANTS_TAC THENL [ALL_TAC; DISCH_THEN r_tac] + else + r_tac matched_th + else + let rec gen_vars vars th = + match vars with + | v :: vs -> gen_vars vs (GEN v th) + | [] -> th in + let th2 = gen_vars vars matched_th in + MP_TAC th2 THEN PURE_REWRITE_TAC[LEFT_IMP_FORALL_THM] in + + (* Try to rewrite with all given theorems *) + let th_list = break_conjuncts th in + let rec my_first th_list = + if length th_list = 1 then + rewrite (hd th_list) g + else + try rewrite (hd th_list) g + with Failure _ -> my_first (tl th_list) in + my_first th_list;; + + +(* +let th = ARITH_RULE `!n. n * 0 <= 1`;; +let tm = `m * 0 <= 1 <=> T`;; +g tm;; +e(new_rewrite [] [] th);; + +let th = CONJ REAL_MUL_RINV REAL_MUL_LINV;; +let tm = `inv (x - y) * (x - y) + &1 = &1 + inv (x - y) * (x - y) + x * inv x`;; +let tm0 = `!x. inv (x - y) * (x - y) = &1`;; + + +g tm0;; +e(new_rewrite [] [] (th));; +e(new_rewrite [] [] (GSYM th));; +e(new_rewrite [] [`_ + &1`] th);; + +g(`x < 2`);; +e(new_rewrite [] [] (ARITH_RULE `!x. x > 2 ==> (!n. n = 2 ==> ~(x < n))`));; + +*) + + +(* Rewrite tactic for usual and conditional theorems *) +let rewrite occ pat th g = + let rec match_theorem ffun th tm str = + try (PART_MATCH ffun th tm, true, str) + with Failure _ -> + match tm with + | Comb(l_tm, r_tm) -> + let r_th, flag, s = match_theorem ffun th l_tm (str ^ "l") in + if flag then (r_th, flag, s) + else + match_theorem ffun th r_tm (str ^ "r") + | Abs(_, b_tm) -> + match_theorem ffun th b_tm (str ^ "b") + | _ -> (th, false, str) in + (* Initialize auxiliary variables *) + let goal_tm = snd g in + let th0 = PURE_REWRITE_RULE[IMP_IMP] th in + let concl_th = concl (SPEC_ALL th0) in + let cond_flag = is_imp concl_th in + let eq_tm = if cond_flag then rand concl_th else concl_th in + let match_fun = (if is_eq eq_tm then lhand else I) o (if cond_flag then rand else I) in + + (* Apply the pattern *) + let goal_subterm_path = + if pat = [] then "" else match_subterm_in_context (hd pat) goal_tm g in + let goal_subterm = follow_path goal_subterm_path goal_tm in + + (* Match the theorem *) + let matched_th, flag, path = match_theorem match_fun th0 goal_subterm goal_subterm_path in + if not flag then + failwith "lhs does not match any term in the goal" + else + let matched_tm = (match_fun o concl) matched_th in + (* Find all matched subterms *) + let paths = find_all_paths (fun x -> x = matched_tm) goal_tm in + let paths = if occ = [] then paths else + map (fun i -> List.nth paths (i - 1)) occ in + (* Find all free variables in the matched theorem which do not correspond to free variables in + the matched subterm *) + let tm_frees = frees matched_tm in + let th_frees = frees (concl th0) in + let mth_frees = frees (concl matched_th) in + let vars = subtract mth_frees (union th_frees tm_frees) in + if vars = [] then + let r_tac = fun th -> MAP_EVERY (fun path -> GEN_REWRITE_TAC (PATH_CONV path) [th]) paths in + if cond_flag then + (MP_TAC matched_th THEN ANTS_TAC THENL [ALL_TAC; DISCH_THEN r_tac]) g + else + (r_tac matched_th) g + else + let rec gen_vars vars th = + match vars with + | v :: vs -> gen_vars vs (GEN v th) + | [] -> th in + let th2 = gen_vars vars matched_th in + (MP_TAC th2 THEN REWRITE_TAC[LEFT_IMP_FORALL_THM]) g;; + + + + +(* Analogue of the "done" tactic in SSReflect *) +let done_tac = ASM_REWRITE_TAC[] THEN FAIL_TAC "done: not all subgoals are proved";; + +(* Simplification: /= *) +let simp_tac = SIMP_TAC[];; + + +(* Linear arithmetic simplification *) +let arith_tac = FIRST [ARITH_TAC; REAL_ARITH_TAC; INT_ARITH_TAC];; + + +(* split *) +let split_tac = FIRST [CONJ_TAC; EQ_TAC];; + + + +(* Creates an abbreviation for the given term with the given name *) +let set_tac name tm (g : goal) = + let goal_tm = snd g in + let tm0 = + try + follow_path (match_subterm_in_context tm goal_tm g) goal_tm + with Failure _ -> tm in + let tm1 = inst_all_free_vars tm0 g in + let abbrev_tm = mk_eq (mk_var (name, type_of tm1), tm1) in + (ABBREV_TAC abbrev_tm THEN POP_ASSUM (LABEL_TAC (name ^ "_def"))) g;; + +(* Generates a fresh name for the given term *) +(* taking into account names of the provided variables *) +let generate_fresh_name names tm = + let rec find_name prefix n = + let name = prefix ^ (if n = 0 then "" else string_of_int n) in + if can (find (fun str -> str = name)) names then + find_name prefix (n + 1) + else + name in + let prefix = if is_var tm then (fst o dest_var) tm else "x" in + find_name prefix 0;; + + +(* Returns a variable which name does not conflict with names of given vars *) +let get_fresh_var var vars = + let names = map (fst o dest_var) vars in + mk_var (generate_fresh_name names var, type_of var);; + + +(* Matches all wild cards in the term and *) +(* instantinates all type variables in the given context *) +let prepare_term tm (g : goal) = + let goal_tm = snd g in + let tm0 = + try follow_path (match_subterm_in_context tm goal_tm g) goal_tm + with Failure _ -> tm in + inst_all_free_vars tm0 g;; + +(* Discharges a term by generalizing all occurences of this term first *) +let disch_tm_tac occs tm (g : goal) = + let tm0 = prepare_term tm g in + let name = generate_fresh_name ((fst o unzip) (get_context_vars g)) tm in + let new_tm = mk_var (name, type_of tm0) in + let new_tm1 = + if occs = [] && is_var tm then + mk_var ((fst o dest_var) tm, type_of tm0) + else new_tm in + let abbrev_tm = mk_eq (new_tm, tm0) in + (ABBREV_TAC abbrev_tm THEN + EXPAND_TAC name THEN + POP_ASSUM (fun th -> TRY (new_rewrite occs [] th)) THEN + SPEC_TAC (new_tm, new_tm1)) g;; + + +(* Discharges a theorem or a term *) +let disch_tac occs arg = + match arg with + | Arg_theorem th -> MP_TAC th + | Arg_term tm -> disch_tm_tac occs tm + | _ -> failwith "disch_tac: a type cannot be discharged";; + + + +(* process_thm *) +let process_thm = + let conj_imp = TAUT `(A /\ B ==> C) ==> (A ==> B ==> C)` in + let dummy_tm = `F` in + fun local_consts -> + let rec process th = + let ctm = concl th in + (* forall *) + if is_forall ctm then + let (var_tm, _) = dest_forall ctm in + let var = get_fresh_var var_tm (thm_frees th @ local_consts) in + let th1 = SPEC var th in + let list, th0 = process th1 in + ("spec", var) :: list, th0 + (* P ==> Q *) + else if is_imp ctm then + let ant_tm, _ = dest_imp ctm in + (* P /\ R ==> Q *) + if is_conj ant_tm then + let th1 = MATCH_MP conj_imp th in + let list, th0 = process th1 in + ("conj", dummy_tm) :: list, th0 + (* P ==> Q *) + else + let th1 = UNDISCH th in + let list, th0 = process th1 in + ("undisch", ant_tm) :: list, th0 + else + [], th in + process;; + + + +(* reconstruct_thm *) +let reconstruct_thm = + let imp_conj = TAUT `(A ==> B ==> C) ==> (A /\ B ==> C)` in + let triv_ths = TAUT `((T ==> A) <=> A) /\ ((T /\ A) = A) /\ ((A /\ T) = A)` in + let rec reconstruct list th = + match list with + | [] -> th + | cmd :: t -> + let th1 = + match cmd with + | ("spec", (_ as tm)) -> GEN tm th + | ("conj", _) -> MATCH_MP imp_conj th + | ("undisch", (_ as tm)) -> DISCH tm th + | _ -> failwith ("Unknown command: " ^ fst cmd) in + reconstruct t th1 in + + fun (cmd_list, th) -> + let th1 = reconstruct (rev cmd_list) th in + PURE_REWRITE_RULE[triv_ths] th1;; + + +(* spec_var_th *) +let spec_var_th th n tm = + let cmd, th0 = process_thm (frees tm) th in + let ty = type_of tm in + let rec spec n list head = + match list with + | ("spec", (_ as var_tm)) :: t -> + (try + let ty_ii = type_match (type_of var_tm) ty [] in + if n <= 1 then + let th1 = reconstruct_thm (list, th0) in + let th2 = ISPEC tm th1 in + let tail, th0 = process_thm [] th2 in + let head1 = map (fun s, tm -> s, inst ty_ii tm) head in + head1 @ tail, th0 + else + spec (n - 1) t (head @ [hd list]) + with Failure _ -> + spec n t (head @ [hd list])) + | h :: t -> spec n t (head @ [h]) + | [] -> failwith ("spec_var_th") in + reconstruct_thm (spec n cmd []);; + + +(* match_mp_th *) +let match_mp_th ith n th = + let lconsts = thm_frees ith in + let cmd, th0 = process_thm (thm_frees th) ith in + let tm = concl th in + let rec rec_match n list head = + match list with + | ("undisch", (_ as tm0)) :: t -> + (try + let ii = term_match lconsts tm0 tm in + if n <= 1 then + let th1 = INSTANTIATE_ALL ii th0 in + let th2 = PROVE_HYP th th1 in + let list0 = head @ (("undisch", `T`) :: t) in + let f_vars = frees tm0 in + let list1 = filter + (fun s, tm -> not (s = "spec" && mem tm f_vars)) list0 in + let list = map (fun s, tm -> s, instantiate ii tm) list1 in + list, th2 + else + rec_match (n - 1) t (head @ [hd list]) + with Failure _ -> + rec_match n t (head @ [hd list])) + | h :: t -> rec_match n t (head @ [h]) + | [] -> failwith "match_mp_th: no match" in + let r = rec_match n cmd [] in + reconstruct_thm r;; + +(* Introduces a subgoal *) +let have_gen_tac binders then_tac tm (g : goal) = +(* let tm0 = inst_all_free_vars tm g in *) + let tm1 = gen_variables binders tm in + let tm2 = prepare_term tm1 g in + (THENL_FIRST (SUBGOAL_THEN tm2 (fun th -> MP_TAC th THEN then_tac)) + (move binders)) g;; + + +let have_tac then_tac tm (g : goal) = +(* let tm0 = inst_all_free_vars tm g in *) + let tm0 = prepare_term tm g in + (SUBGOAL_THEN tm0 (fun th -> MP_TAC th THEN then_tac)) g;; + + + +(* 'wlog' tactic *) +let wlog_tac then_tac vars tm (g : goal) = +(* let tm0 = inst_all_free_vars tm g in *) + let tm0 = prepare_term tm g in + let vars0 = map (fun tm -> inst_all_free_vars tm g) vars in + let g_tm = snd g in + let imp = list_mk_forall (vars0, mk_imp (tm0, g_tm)) in + (THENL_ROT 1 (SUBGOAL_THEN imp (fun th -> MP_TAC th THEN then_tac) THENL + [REPLICATE_TAC (length vars) GEN_TAC; ALL_TAC])) g;; + + +(* Provides a witness for an existential goal *) +let exists_tac tm (g : goal) = + let tm0 = inst_all_free_vars tm g in + let target_ty = (type_of o fst o dest_exists o snd) g in + let inst_ty = type_match (type_of tm0) target_ty [] in + let tm1 = inst inst_ty tm0 in + (EXISTS_TAC tm1) g;; + +(* Instantiates the first type variable in the given theorem *) +let inst_first_type th ty = + let ty_vars = type_vars_in_term (concl th) in + if ty_vars = [] then + failwith "inst_first_type: no type variables in the theorem" + else + INST_TYPE [(ty, hd ty_vars)] th;; + + +(* The first argument must be a theorem, the second argument is arbitrary *) +let combine_args arg1 arg2 = + let th1 = get_arg_thm arg1 in + let th0 = + match arg2 with + | Arg_theorem th2 -> + (try MATCH_MP th1 th2 with Failure _ -> match_mp_th th1 1 th2) + | Arg_term tm2 -> + (try ISPEC tm2 th1 with Failure _ -> spec_var_th th1 1 tm2) + | Arg_type ty2 -> inst_first_type th1 ty2 in + Arg_theorem th0;; + + +(* A temporary variable *) +let use_arg_then_result = ref TRUTH;; + +(* Tests if the given id defines a theorem *) +let test_id_thm id = + let lexbuf = + Lexing.from_string ("use_arg_then_result := " ^ id ^ ";;") in + let ast = (!Toploop.parse_toplevel_phrase) lexbuf in + try + let _ = Toploop.execute_phrase false Format.std_formatter ast in + true + with _ -> false;; + + +(* For a given id (string) finds an assumption or an existing theorem with the same name + and then applies the given tactic *) +let use_arg_then id (arg_tac:arg_type->tactic) (g:goal) = + let list = fst g in + let arg = + try + let assumption = assoc id list in + Arg_theorem assumption + with Failure _ -> + try + let vars = get_context_vars g in + let var = assoc id vars in + Arg_term var + with Failure _ -> + let lexbuf = + Lexing.from_string ("use_arg_then_result := " ^ id ^ ";;") in + let ast = (!Toploop.parse_toplevel_phrase) lexbuf in + let _ = + try + Toploop.execute_phrase false Format.std_formatter ast + with _ -> failwith ("Bad identifier: " ^ id) in + Arg_theorem !use_arg_then_result in + arg_tac arg g;; + + +(* The same effect as use_arg_then but the theorem is given explicitly*) +let use_arg_then2 (id, opt_thm) (arg_tac:arg_type->tactic) (g:goal) = + let list = fst g in + let arg = + try + let assumption = assoc id list in + Arg_theorem assumption + with Failure _ -> + try + let vars = get_context_vars g in + let var = assoc id vars in + Arg_term var + with Failure _ -> + if opt_thm <> [] then + Arg_theorem (hd opt_thm) + else + failwith ("Assumption is not found: " ^ id) in + arg_tac arg g;; + + +let combine_args_then (tac:arg_type->tactic) arg1 arg2 (g:goal) = + let th1 = get_arg_thm arg1 in + let th0 = + match arg2 with + | Arg_theorem th2 -> + (try MATCH_MP th1 th2 with Failure _ -> match_mp_th th1 1 th2) + | Arg_term tm2 -> + let tm0 = prepare_term tm2 g in + (try ISPEC tm0 th1 with Failure _ -> spec_var_th th1 1 tm0) + | Arg_type ty2 -> inst_first_type th1 ty2 in + tac (Arg_theorem th0) g;; + + + + +(* Specializes a variable and applies the next tactic *) +let ispec_then tm (tac : thm_tactic) th (g : goal) = + let tm0 = prepare_term tm g in + let th0 = try ISPEC tm0 th with Failure _ -> spec_var_th th 1 tm0 in + tac th0 g;; + + +let ISPEC_THEN tm (tac : thm_tactic) th (g : goal) = + let tm0 = inst_all_free_vars tm g in + tac (ISPEC tm0 th) g;; + + + +let USE_THM_THEN th (tac : thm_tactic) = + tac th;; + + +let MATCH_MP_THEN th2 (tac : thm_tactic) th1 = + tac (MATCH_MP th1 th2);; + +let match_mp_then th2 (tac : thm_tactic) th1 = + let th0 = try MATCH_MP th1 th2 with Failure _ -> match_mp_th th1 1 th2 in + tac th0;; + + +let GSYM_THEN (tac : thm -> tactic) th = + tac (GSYM th);; + + +let gsym_then (tac:arg_type->tactic) arg = + tac (Arg_theorem (GSYM (get_arg_thm arg)));; + + +(* The 'apply' tactic *) +let apply_tac th g = + let rec try_match th = + try MATCH_MP_TAC th g with Failure _ -> + let th0 = PURE_ONCE_REWRITE_RULE[IMP_IMP] th in + if th = th0 then failwith "apply_tac: no match" + else + try_match th0 in + + try MATCH_ACCEPT_TAC th g with Failure _ -> + try_match th;; + +(*let apply_tac th = + FIRST [MATCH_ACCEPT_TAC th; MATCH_MP_TAC th];; *) + + +(* The 'exact' tactic *) +(* TODO: do [done | by move => top; apply top], here apply top + works as ACCEPT_TAC with matching (rewriting) in some cases *) +let exact_tac = FIRST [done_tac; DISCH_THEN (fun th -> apply_tac th) THEN done_tac];; + + + +(* Specializes the theorem using the given set of variables *) +let spec0 names vars = + let find name = + try (assoc name vars, true) + with Failure _ -> (parse_term name, false) in + let find_type var = + let name, ty = dest_var var in + let t, flag = find name in + if flag then + (ty, type_of t) + else + (`:bool`, `:bool`) in + let inst_term tm = + let ty_src, ty_dst = unzip (map find_type (frees tm)) in + let ty_inst = itlist2 type_match ty_src ty_dst [] in + inst ty_inst tm in + let list = map find names in + let tm_list = map (fun tm, flag -> if flag then tm else inst_term tm) list in + ISPECL tm_list;; + + +let spec names = spec0 names (get_context_vars (top_realgoal()));; + + +let spec_mp names th g = MP_TAC (spec0 names (get_context_vars g) th) g;; + + +(* Case theorems *) +let bool_cases = ONCE_REWRITE_RULE[CONJ_ACI] bool_INDUCT;; +let list_cases = prove(`!P. P [] /\ (!(h:A) t. P (CONS h t)) ==> (!l. P l)`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC `l:(A)list` list_CASES) THEN DISCH_THEN DISJ_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (CHOOSE_THEN MP_TAC) THEN DISCH_THEN (CHOOSE_THEN MP_TAC) THEN + DISCH_THEN (fun th -> ASM_REWRITE_TAC[th]));; +let pair_cases = pair_INDUCT;; +let num_cases = prove(`!P. P 0 /\ (!n. P (SUC n)) ==> (!m. P m)`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC `m:num` num_CASES) THEN DISCH_THEN DISJ_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (CHOOSE_THEN (fun th -> ASM_REWRITE_TAC[th])));; +let option_cases = option_INDUCT;; + + +let cases_table = Hashtbl.create 10;; +Hashtbl.add cases_table "bool" bool_cases;; +Hashtbl.add cases_table "list" list_cases;; +Hashtbl.add cases_table "prod" pair_cases;; +Hashtbl.add cases_table "num" num_cases;; +Hashtbl.add cases_table "option" option_cases;; + + +(* Induction theorems *) +let bool_elim = bool_cases;; +let list_elim = list_INDUCT;; +let pair_elim = pair_INDUCT;; +let num_elim = num_INDUCTION;; +let option_elim = option_INDUCT;; + +let elim_table = Hashtbl.create 10;; +Hashtbl.add elim_table "bool" bool_elim;; +Hashtbl.add elim_table "list" list_elim;; +Hashtbl.add elim_table "prod" pair_elim;; +Hashtbl.add elim_table "num" num_elim;; +Hashtbl.add elim_table "option" option_elim;; + + + +(* case: works only for (A /\ B) -> C; (A \/ B) -> C; (?x. P) -> Q; !(n:num). P; !(l:list(A)). P *) +let case (g:goal) = + let goal_tm = snd g in + if not (is_imp goal_tm) then + (* !a. P *) + if is_forall goal_tm then + let var, _ = dest_forall goal_tm in + let ty_name = (fst o dest_type o type_of) var in + let case_th = Hashtbl.find cases_table ty_name in + (MATCH_MP_TAC case_th THEN REPEAT CONJ_TAC) g + else + failwith "case: not imp or forall" + else + let tm = lhand goal_tm in + (* A /\ B *) + if is_conj tm then + (DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN POP_ASSUM MP_TAC) g + (* A \/ B *) + else if is_disj tm then + (DISCH_THEN DISJ_CASES_TAC THEN POP_ASSUM MP_TAC) g + (* ?x. P *) + else if is_exists tm then + (ONCE_REWRITE_TAC[GSYM LEFT_FORALL_IMP_THM]) g + else + failwith "case: not implemented";; + + + +(* elim: works only for num and list *) +let elim (g:goal) = + let goal_tm = snd g in + (* !a. P *) + if is_forall goal_tm then + let var, _ = dest_forall goal_tm in + let ty_name = (fst o dest_type o type_of) var in + let induct_th = Hashtbl.find elim_table ty_name in + (MATCH_MP_TAC induct_th THEN REPEAT CONJ_TAC) g + else + failwith "elim: not forall";; + + + +(* Instantiates the first type variable in the given theorem *) +let INST_FIRST_TYPE_THEN ty (then_tac:thm_tactic) th = + let ty_vars = type_vars_in_term (concl th) in + if ty_vars = [] then + failwith "inst_first_type: no type variables in the theorem" + else + then_tac (INST_TYPE [(ty, hd ty_vars)] th);; + + +(* Replaces all occurrences of distinct '_' with unique variables *) +let transform_pattern pat_tm = + let names = ref (map (fst o dest_var) (frees pat_tm)) in + let rec transform tm = + match tm with + | Abs(x_tm, b_tm) -> + let _ = names := (fst o dest_var) x_tm :: !names in + mk_abs (x_tm, transform b_tm) + | Comb(l_tm, r_tm) -> + mk_comb (transform l_tm, transform r_tm) + | Var ("_", ty) -> + let name = generate_fresh_name !names tm in + let _ = names := name :: !names in + mk_var (name, ty) + | _ -> tm in + transform pat_tm;; + + +let wild_frees tm = + filter (fun tm -> ((fst o dest_var) tm).[0] = '_') (frees tm);; + +let nwild_frees tm = + filter (fun tm -> ((fst o dest_var) tm).[0] <> '_') (frees tm);; + + +(* congr_tac *) +let congr_tac pat_tm goal = + let goal_tm = snd goal in + let context_vars = get_context_vars goal in + let pat = transform_pattern pat_tm in + let f0_vars = nwild_frees pat in + let pattern = inst_context_vars context_vars f0_vars pat in + let const_pat = nwild_frees pattern in + let wild_pat = wild_frees pattern in + + let lhs, rhs = dest_eq goal_tm in + let lm, rm = + term_match const_pat pattern lhs, term_match const_pat pattern rhs in + let eq_tms = map + (fun tm -> mk_eq (instantiate lm tm, instantiate rm tm)) wild_pat in + let eq_tm = itlist (curry mk_imp) eq_tms goal_tm in + let eq_thm = EQT_ELIM (SIMP_CONV[] eq_tm) in + (apply_tac eq_thm THEN REPEAT CONJ_TAC) goal;; + + +(* Eliminates the first antecedent of a goal *) +let elim_fst_ants_tac = + let gen_elim_thm tm = + let vars, tm1 = strip_forall tm in + let ants_tm, concl_tm = dest_imp tm1 in + let th1 = ASSUME (itlist (curry mk_forall) vars concl_tm) in + let th2 = DISCH ants_tm (SPECL vars th1) in + DISCH_ALL (itlist GEN vars th2) in + fun (g:goal) -> + let goal_tm = snd g in + let elim_th = gen_elim_thm goal_tm in + MATCH_MP_TAC elim_th g;; + + +(* If a goal has the form ssreflect_eq ==> P then the equality is introduced as + an assumption. + If a goal has the form !x. ssreflect_eq ==> P then the equality is eliminated *) +let process_fst_eq_tac (g:goal) = + let vars, g_tm = strip_forall (snd g) in + let tac = + try + let eq_tm = (rator o fst o dest_imp) g_tm in + let label = (fst o dest_var o rand) eq_tm in + if (fst o dest_const o rator) eq_tm = "ssreflect_eq" then + if length vars = 0 then + DISCH_THEN (LABEL_TAC label o PURE_ONCE_REWRITE_RULE[ssreflect_eq_def]) + else + elim_fst_ants_tac + else + ALL_TAC + with Failure _ -> ALL_TAC in + tac g;; + + +(* Discharges a term by generalizing all occurences of this term first *) +let disch_tm_eq_tac eq_name occs tm (g : goal) = + let tm0 = prepare_term tm g in + let name = generate_fresh_name ((fst o unzip) (get_context_vars g)) tm in + let eq_var = mk_var (eq_name, aty) in + let new_tm = mk_var (name, type_of tm0) in + let abbrev_tm = mk_eq (new_tm, tm0) in + (ABBREV_TAC abbrev_tm THEN + EXPAND_TAC name THEN + FIRST_ASSUM (fun th -> TRY (new_rewrite occs [] th)) THEN + POP_ASSUM (MP_TAC o PURE_ONCE_REWRITE_RULE[GSYM (SPEC eq_var ssreflect_eq_def)]) THEN + SPEC_TAC (new_tm, new_tm)) g;; + + +(* Discharges a term and generates an equality *) +let disch_eq_tac eq_name occs arg = + disch_tm_eq_tac eq_name occs (get_arg_term arg);; diff --git a/kepler_tex/tikz/tikz.ml b/kepler_tex/tikz/tikz.ml new file mode 100644 index 0000000..39f84f5 --- /dev/null +++ b/kepler_tex/tikz/tikz.ml @@ -0,0 +1,1359 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK PREPARATION *) +(* *) +(* Chapter: Graphics *) +(* Author: Thomas C. Hales *) +(* Date: 2011-11-26 *) +(* ========================================================================== *) + +(* +Some procedures to facilitate the generation of tikz graphics. +Tikz.execute produces output in /tmp/x.txt +Read in by fig.tex to produce graphics. + +This is mostly independent of the flyspeck .hl files, but it might make +light use of HOL's lib.ml functions, such as sort. + +Lessons learned: + +Tikz is almost totally unusable for 3D graphics. +Generate 3D coordinates with OCAML, then project to 2D at the very end. +Use --plot[smooth] coordinates { ... } rather than try to use tikz elliptical +arc routines. + + At the beginning, I used Mathematica to generate tikz files, but + eventually almost everything was done with Ocaml rather than Math'ca. + +*) + +module Tikz = struct + +let map = List.map;; + +let filter= List.filter;; + +let hd = List.hd;; + +(* from HOL LIGHT lib.ml . *) + +(* let (o) = fun f g x -> f(g x);; *) + +let rec (--) = fun m n -> if m > n then [] else m::((m + 1) -- n);; + +let rec funpow n f x = + if n < 1 then x else funpow (n-1) f (f x);; + +let rec forall p l = + match l with + [] -> true + | h::t -> p(h) & forall p t;; + +let rec mem x lis = + match lis with + [] -> false + | (h::t) -> Pervasives.compare x h = 0 or mem x t;; + +let subtract l1 l2 = filter (fun x -> not (mem x l2)) l1;; + +let intersect l1 l2 = filter (fun x -> mem x l2) l1;; + +let subset l1 l2 = forall (fun t -> mem t l2) l1;; + +let rec partition p l = + match l with + [] -> [],l + | h::t -> let yes,no = partition p t in + if p(h) then (if yes == t then l,[] else h::yes,no) + else (if no == t then [],l else yes,h::no);; + +let rec sort cmp lis = + match lis with + [] -> [] + | piv::rest -> + let r,l = partition (cmp piv) rest in + (sort cmp l) @ (piv::(sort cmp r));; + +let rec zip l1 l2 = + match (l1,l2) with + ([],[]) -> [] + | (h1::t1,h2::t2) -> (h1,h2)::(zip t1 t2) + | _ -> failwith "zip";; + +let rec end_itlist f l = + match l with + [] -> failwith "end_itlist" + | [x] -> x + | (h::t) -> f h (end_itlist f t);; + +let rec assoc a l = + match l with + (x,y)::t -> if Pervasives.compare x a = 0 then y else assoc a t + | [] -> failwith "find";; + + +(* I/O *) + +let output_filestring tmpfile a = + let outs = open_out tmpfile in + let _ = try (Printf.fprintf outs "%s" a) + with _ as t -> (close_out outs; raise t) in + close_out outs ;; + +let unsplit d f = function + | (x::xs) -> List.fold_left (fun s t -> s^d^(f t)) (f x) xs + | [] -> "";; + +let join_comma = unsplit "," (fun x-> x);; + +let join_lines = unsplit "\n" (fun x-> x);; + +let join_space = unsplit " " (fun x-> x);; + + + +(* math *) + +let cos = Pervasives.cos;; +let sin = Pervasives.sin;; +let cot x = cos x /. sin x;; +let sqrt = Pervasives.sqrt;; +let pi = 4.0 *. atan(1.0);; +let nth = List.nth;; + +(* arg between 0 and 2pi *) + +let arg x y = if (y<0.0) then atan2 y x +. 2.0 *. pi else atan2 y x;; + +let degree x = 180.0 *. x /. pi;; + +let radian x = pi *. x /. 180.0;; + +let eta x y z = + let s = (x +. y +. z)/. 2.0 in + x *. y *. z /. ( 4. *. sqrt(s *. (s -. x) *. ( s -. y) *. (s -. z)));; + +let orig3 = (0.0,0.0,0.0);; + +let orig2 = (0.0,0.0);; + +(* vector sum, difference, scalar product, dot product *) + +let map3 f (x,y,z) = (f x,f y,f z);; + +let map2 f (x,y) = (f x , f y);; + +let (+..) (x1,x2) (y1,y2) = (x1+. y1,x2+. y2);; + +let (-..) (x1,x2) (y1,y2) = (x1-. y1,x2-. y2);; + +let uminus3 (x1,x2,x3) = (-. x1,-.x2,-.x3);; + +let uminus2 (x1,x2) = (-. x1,-.x2);; + +let ( %.. ) s (x1,x2) = (s *. x1, s *. x2);; + +let ( *.. ) (x1,x2) (y1,y2) = (x1 *. y1 +. x2 *. y2);; + +let (+...) (x1,x2,x3) (y1,y2,y3) = (x1 +. y1, x2 +. y2, x3+. y3);; + +let (-...) (x1,x2,x3) (y1,y2,y3) = (x1 -. y1, x2 -. y2, x3-. y3);; + +let ( %... ) s (x1,x2,x3) = (s *. x1, s *. x2, s*. x3);; + +let ( *... ) (x1,x2,x3) (y1,y2,y3) = (x1 *. y1 +. x2 *. y2 +. x3 *. y3);; + +let cross (x1,x2,x3) (y1,y2,y3) = + (x2 *. y3 -. x3 *. y2, x3 *. y1 -. x1 *. y3, x1 *. y2 -. x2 *. y1);; + +let det3 x y z = x *... (cross y z);; + +let det2 (x1,y1) (x2,y2) = (x1 *. y2 -. y1 *. x2);; + +let conj (x,y) = (x,-. y);; + +let cmul (x1,y1) (x2,y2) = (x1 *. x2 -. y1 *. y2, x1 *. y2 +. x2 *. y1);; + +let cinv v = (1.0/. (v *.. v)) %.. (conj v);; + +let cdiv u v = cmul u (cinv v);; + + + +let delta1 = (1.0,0.0,0.0);; + +let delta2 = (0.0,1.0,0.0);; + +let delta3 = (0.0,0.0,1.0);; + +let proj e1 e2 x = (x *... e1) , (x *... e2);; + +let perp p x = x -... (((x *... p) /. (p *... p)) %... p) ;; (* ortho to p *) + +let transpose ((a11,a12,a13),(a21,a22,a23),(a31,a32,a33)) = + ((a11,a21,a31),(a12,a22,a32),(a13,a23,a33));; + +let transpose2 ((x1,y1),(x2,y2)) = ((x1,x2),(y1,y2));; + +let mul3 (e1,e2,e3) x = + (e1 *... x, e2 *... x, e3 *... x);; + +let tuple3 [v1;v2;v3] = (v1,v2,v3);; + +let list3 (v1,v2,v3) = [v1;v2;v3];; + +let tuple2 [v1;v2] = (v1,v2);; + +let list2 (v1,v2) = [v1;v2];; + +let norm2 x = sqrt(x *.. x);; + +let norm3 x = sqrt(x *... x);; + +let normalize3 x = (1.0 /. sqrt(x *... x)) %... x;; + +let normalize2 x = (1.0 /. sqrt(x *.. x)) %.. x;; + +let dist3 x y = + let z = x -... y in sqrt (z *... z);; + +let dist2 x y = + let z = x -.. y in sqrt (z *.. z);; + +let rec outer x y = + match x with + | [] -> [] + | a::r -> (map (fun i -> (a,i)) y) @ (outer r y);; + +let solve33 (m1,m2,m3) c = (* solve m.x ==c for x by Cramer *) + let d = det3 m1 m2 m3 in + let (t1,t2,t3) = transpose (m1,m2,m3) in + map3 (fun t -> t/. d) (det3 c t2 t3, det3 t1 c t3, det3 t1 t2 c);; + +let solve22 (m1,m2) c = + let d = det2 m1 m2 in + let (t1,t2) = transpose2 (m1,m2) in + map2 (fun t -> t/. d) (det2 c t2, det2 t1 c);; + +let extreme_point m' = + solve33 m' (map3 (fun m -> 0.5 *. (m *... m)) m');; + +let lex3 (i,j,k) (i',j',k') = (i -1.0 +. Random.float 2.0) [0;0;0]) in + frame_of (v3()) (v3());; + + +(* TIKZ OUTPUT *) + +let ppair (x,y) = Printf.sprintf "(%f,%f)" x y;; + +let pcoord s (x,y) = + Printf.sprintf "\\coordinate (%s) at (%f,%f) " s x y;; + +let plet s y = + Printf.sprintf "\\pgfmathsetmacro\\%s{%s}" s y;; + + + +(* specific cases *) + +(* CLOSE PACKING CHAPTER FIGURES *) + +(* SEYIMIE *) + +let fcc_fun_domain = + let v1 = (1.0,0.0,0.0) in + let v2 = (0.5,sqrt(3.0)/.2.0,0.0) in + let v3 = (0.5,1.0 /. sqrt(12.0),sqrt(2.0/.3.0)) in + let v12 = v1 +... v2 in + let v23 = v2 +... v3 in + let v13 = v1 +... v3 in + let v123 = v1 +... v2 +... v3 in + let f = frame_of (1.0,0.1,0.1) (0.3,0.5,1.0) in (* 0.3 0.5 1.0 *) + let p v = proj delta1 delta2 (mul3 f v) in + let [w1;w2;w3;w12;w23;w13;w123] = map p [v1;v2;v3;v12;v23;v13;v123] in + let coord (s,u) = Printf.sprintf "\\coordinate (%s) at (%f,%f);" s (fst u) (snd u) in + join_lines (map coord [("w1",w1);("w2",w2);("w3",w3);("w12",w12);("w23",w23);("w13",w13);("w123",w123)]);; + +(* figAZGXQWC *) + +let tet_oct_ratio = + let v0 = (0.0,0.0,0.0) in + let v1 = (1.0,0.0,0.0) in + let v2 = (0.5,sqrt(3.0)/.2.0,0.0) in + let v3 = (0.5,1.0 /. sqrt(12.0),sqrt(2.0/.3.0)) in + let v12 = 0.5 %... (v1 +... v2) in + let v02 = 0.5 %...( v0 +... v2) in + let v01 = 0.5 %... v1 in + let v03 = 0.5 %... v3 in + let v13 = 0.5 %... (v1 +... v3) in + let v23 = 0.5 %... (v2 +... v3) in + let f = frame_of (1.0,0.1,0.1) (0.3,0.5,1.0) in (* 0.3 0.5 1.0 *) + let p v = proj delta1 delta2 (mul3 f v) in + let [w0;w1;w2;w3;w12;w02;w01;w03;w13;w23] = map p [v0;v1;v2;v3;v12;v02;v01;v03;v13;v23] in + let coord (s,u) = Printf.sprintf "\\coordinate (%s) at (%f,%f);" s (fst u) (snd u) in + join_lines (map coord [("w0",w0);("w1",w1);("w2",w2);("w3",w3);("w12",w12);("w02",w02);("w01",w01);("w03",w03);("w13",w13);("w23",w23)]);; + +(* SGIWBEN *) + +let fcc_hcp_pattern = + let f = frame_of +(* (0.3,0.4,0.1) (-0.1,0.1,0.4) in *) + (0.4,0.3,0.1) (-0.2,0.1,0.4) in + let g = mul3 f in + let u = g delta3 in + let v0 = (0.0,0.0,0.0) in + let v1 = g(1.0,0.0,0.0) in + let v2 = g(0.5,sqrt(3.0)/.2.0,0.0) in + let v3 = g(0.5,1.0 /. sqrt(12.0),sqrt(2.0/.3.0)) in + let v4 = v2 -... v1 in + let v5 = v0 -... v1 in + let v6 = v0 -... v2 in + let v7 = v0 -... v4 in + let v8 = v3 +... v5 in + let v9 = v3 +... v6 in + let v10 = v0 -... v3 in + let v11 = v0 -... v8 in + let v12 = v0 -... v9 in + let n v = v -... (2.0 *. (u *... v) ) %... u in + let v13 = v0 -... n v3 in + let v14 = v0 -... n v8 in + let v15 = v0 -... n v9 in + let p v = proj delta1 delta2 (v) in + let [w0;w1;w2;w3;w4;w5;w6;w7;w8;w9;w10;w11;w12;w13;w14;w15] = map p + [v0;v1;v2;v3;v4;v5;v6;v7;v8;v9;v10;v11;v12;v13;v14;v15] in + let coord (s,u) = Printf.sprintf "\\coordinate (%s) at (%f,%f);" s (fst u) (snd u) in + join_lines (map coord [("w0",w0);("w1",w1);("w2",w2);("w3",w3); + ("w4",w4);("w5",w5);("w6",w6);("w7",w7);("w8",w8);("w9",w9);("w10",w10);("w11",w11);("w12",w12);("w13",w13);("w14",w14);("w15",w15)]);; + + +let fcc_packing = + let f = frame_of +(* (0.4,0.3,0.1) (-0.2,0.1,0.4) in *) + (0.5,0.4,0.) (-. 0.0,0.1,0.4) in + let g = mul3 f in + let u = g delta3 in + let v0 = (0.0,0.0,0.0) in + let v1 = g(1.0,0.0,0.0) in + let v2 = g(0.5,sqrt(3.0)/.2.0,0.0) in + let e1 = g delta1 in + let e2 = g delta2 in + let e3 = u in + let v3 = g(0.5,1.0 /. sqrt(12.0),sqrt(2.0/.3.0)) in + let e12 = e1 +... e2 in + let e13 = e1 +... e3 in + let e23 = e2 +... e3 in + let e123 = e1 +... e2 +... e3 in + let p v = proj delta1 delta2 (v) in + let [w0;w1;w2;w3;e1;e2;e3;e12;e13;e23;e123] = map p [v0;v1;v2;v3;e1;e2;u;e12;e13;e23;e123] in + let coord (s,u) = Printf.sprintf "\\coordinate (%s) at (%f,%f);" s (fst u) (snd u) in + join_lines (map coord [("w0",w0);("w1",w1);("w2",w2);("w3",w3);("e1",e1);("e2",e2);("e3",e3);("e12",e12);("e13",e13);("e23",e23);("e123",e123)]);; + +let pascal_packing = + let f = frame_of +(* (0.5,0.4,0.0) (-0.0,0.1,0.4) in *) + (0.5,0.4,0.) (-0.2,0.1,0.4) in + let g = mul3 f in + let v0 = (0.0,0.0,0.0) in + let v1 = g(1.0,0.0,0.0) in + let v2 = g(0.5,sqrt(3.0)/.2.0,0.0) in + let v3 = g(0.5,1.0 /. sqrt(12.0),sqrt(2.0/.3.0)) in + let p v = proj delta1 delta2 (v) in + let [w0;w1;w2;w3] = map p [v0;v1;v2;v3] in + let coord (s,u) = Printf.sprintf "\\coordinate (%s) at (%f,%f);" s (fst u) (snd u) in + join_lines (map coord [("w0",w0);("w1",w1);("w2",w2);("w3",w3)]);; + + + + +(* TCFVGTS % fig:face-centered-cubic *) + +let circle_point r u v = + u +... r %... normalize3 (v -... u);; + +let circle_interpolate r s u v1 v2 = + let v = (s %... v2) +... ((1.0 -. s) %... v1) in + circle_point r u v;; + +let pcircle r n v u1 u2 label = + let p1 = map (fun s -> circle_interpolate r (float_of_int s /. float_of_int n) v u1 u2) (0--n) in + let q1 = map (proj delta1 delta2) p1 in + let w1 = join_space (map (fun (x,y)-> Printf.sprintf "(%f,%f) " x y) q1) in + Printf.sprintf "\\def\\%s{%s}" label w1 ;; + +let cubic_layers = + let f = frame_of (1.0,0.1,0.4) (-0.5,1.0,0.0) in + let g = mul3 f in + let r = sqrt(8.0) in + let v0 = (0.0,0.0,0.0) in + let v1 = g(r %... delta1) in + let v2 = g(r %... delta2) in + let v3 = g(r %... delta3) in + let v12 = (v1 +... v2) in + let v13 = ( v1 +... v3) in + let v23 = (v2+... v3) in + let v123 = (v1 +... v2 +... v3) in + let vfront = (0.5 %... (v12)) in + let vtop = (0.5 %... (v2 +... v123)) in + let vright = (0.5 %... (v1 +... v123)) in + let p v = proj delta1 delta2 v in + let [w0;w1;w2;w3;w12;w13;w23;w123;wfront;wtop;wright] = map p + [v0;v1;v2;v3;v12;v13;v23;v123;vfront;vtop;vright] in + let coord (s,u) = Printf.sprintf "\\coordinate (%s) at (%f,%f);" s (fst u) (snd u) in + let cc = (map coord + [("w0",w0);("w1",w1);("w2",w2);("w3",w3);("w12",w12);("w13",w13); + ("w23",w23);("w123",w123);("wfront",wfront);("wtop",wtop); + ("wright",wright)]) in + let b s = "tcf"^s in + let paths = [(v0,v1,v2,b "a");(v1,v12,v0,b "b");(v12,v2,v1,b "c"); + (v2,v0,v12,b "d"); + (vfront,v12,v2,b"e");(vfront,v2,v0,b"f");(vfront,v0,v1,b"g"); + (vfront,v1,v12,b"h"); + (v1,v13,v12,b"i");(v13,v123,v1,b"j");(v123,v12,v13,b"k"); + (v12,v1,v123,b"l"); + (vright,v123,v12,b"m");(vright,v12,v1,b"n");(vright,v1,v13,b"o"); + (vright,v13,v123,b"p"); + (v2,v12,v23,b"q");(v12,v123,v2,b"r");(v123,v12,v23,b"s"); + (v23,v123,v2,b"t"); + (vtop,v12,v123,b"u");(vtop,v123,v23,b"v");(vtop,v23,v2,b"w"); + (vtop,v2,v12,b"x");] in + let pc = map (fun (u,v1,v2,s)-> pcircle 1.0 5 u v1 v2 s) paths in + join_lines (cc @ pc);; + + +(* NTNKMGO *) + +let square_layers = + let f = frame_of (1.0,0.1,0.4) (-0.5,1.0,0.0) in + let g = mul3 f in + let v0 = (0.0,0.0,0.0) in + let v1 = g( delta1) in + let v2 = g( delta2) in + let v3 = g( delta3) in + let p v = proj delta1 delta2 v in + let [w0;w1;w2;w3] = map p [v0;v1;v2;v3] in + let coord (s,u) = Printf.sprintf "\\coordinate (%s) at (%f,%f);" s (fst u) (snd u) in + let cc = map coord [("w0",w0);("w1",w1);("w2",w2);("w3",w3)] in + join_lines (cc);; + + + +(* PQJIJGE *) + +let rhombic_dodec = + let f = frame_of (1.0,0.1,0.4) (-0.5,1.0,0.0) in + let g = mul3 f in + let r = 2.0 in + let v0 = (0.0,0.0,0.0) in + let v1 = g(r %... delta1) in + let v2 = g(r %... delta2) in + let v3 = g(r %... delta3) in + let v12 = (v1 +... v2) in + let v13 = ( v1 +... v3) in + let v23 = (v2+... v3) in + let v123 = (v1 +... v2 +... v3) in + let center = 0.5 %... v123 in + let vfront = (0.5 %... (v12 -... v3)) in + let vtop = (0.5 %... (v2 +... v123)) +... 0.5 %... v2 in + let vright = (0.5 %... (v1 +... v123)) +... 0.5 %... v1 in + let vback = vfront +... 2.0 %... v3 in + let vleft = vright -... 2.0 %... v1 in + let vbottom = vtop -... 2.0 %... v2 in + let p v = proj delta1 delta2 v in + let [w0;w1;w2;w3;w12;w13;w23;w123;wfront;wtop;wright;wback;wleft;wbottom;wcenter] = map p + [v0;v1;v2;v3;v12;v13;v23;v123;vfront;vtop;vright;vback;vleft;vbottom;center] in + let coord (s,u) = Printf.sprintf "\\coordinate (%s) at (%f,%f);" s (fst u) (snd u) in + let cc = (map coord + [("w0",w0);("w1",w1);("w2",w2);("w3",w3);("w12",w12);("w13",w13); + ("w23",w23);("w123",w123);("wfront",wfront);("wtop",wtop); + ("wright",wright); + ("wback",wback);("wleft",wleft);("wbottom",wbottom); + ("wcenter",wcenter)]) in + join_lines cc;; + + + + + +(* PACKING CHAPTER FIGURES *) + +(* figDEQCVQL *) + +let rec mindist2 r w = function + | [] -> r + | l::ls -> if (dist2 l w < r) then mindist2 (dist2 l w) w ls else mindist2 r w ls;; + +let randompacking radius seed xdim ydim = (* seed=5 works well *) + let _ = Random.init seed in +(* let radius = 0.15 in *) + let v () = (Random.float xdim,Random.float ydim) in + let add len ls = + let w = v() in + if (mindist2 100.0 w ls < 2.0 *. radius) or List.length ls > len then ls else w::ls in + let unsat = funpow 40 (add 15) [] in + let sat = funpow 100000 (add 20000) unsat in + (unsat,sat);; + +let print_satunsat seed = + let radius = 0.15 in + let (unsat,sat) = randompacking radius seed 2.0 2.0 in + let line d (x,y) = Printf.sprintf "\\draw[gray,fill=black!%d] (%f,%f) circle (0.15);" d x y in + let punsat = map (line 30) unsat in + let psat = map (line 10) sat in + join_lines (["\\begin{scope}[shift={(0,0)}]"] @ punsat @ + ["\\end{scope}\\begin{scope}[shift={(3.0,0)}]"] @ psat @ punsat @ ["\\end{scope}"]);; + +(* \figXOHAZWO Voronoi cells of a random saturated packing. Start with Delaunay triangles. *) + + + +let center2 s (i,j,k) = circumcenter (s i , s j , s k);; +(* + let si = s i -.. s k in + let sj = s j -.. s k in + s k +.. (0.5 %.. (solve22 (si,sj) (si *.. si, sj *.. sj)));; +*) + +let sat_triples sat = + let radius = 0.15 in + let r = List.length sat in + let s = nth sat in + let rr = 0--(r-1) in + let allt = outer rr (outer rr rr) in + let triple = (map (fun (i,(j,k))->(i,j,k)) (filter(fun (i,(j,k))->(i i< j) (outer rr rr) in + let shortpair = filter (fun (i,j) -> dist2 (s i) (s j) < 4.0 *. radius +. 1.0e-5) allpair in + let ftriple = filter (fun (i,j,k) -> mem (i,j) shortpair && mem(i,k) shortpair && mem(j,k) shortpair) triple in + let fit (i,j,k) = + let c = center2 s (i,j,k) in + let rad = dist2 c (s k) in + let rest = subtract sat [s i;s j;s k] in + let vals = filter (fun v -> dist2 v c < rad) rest in + List.length vals = 0 in + filter fit ftriple;; + +let print_satst seed= + let radius = 0.15 in + let (_,sat) = randompacking radius seed 5.0 2.0 in + let satst = sat_triples sat in + let s = nth sat in + let prs = filter (fun ((i,j,k),(i',j',k')) -> + List.length (intersect [i;j;k] [i';j';k'])=2 && lex3 (i,j,k) (i',j',k')) + (outer satst satst) in + let pp = map (fun (t, t') -> + let (x,y) = center2 s t in + let (x',y') = center2 s t' in + Printf.sprintf "\\draw (%f,%f) -- (%f,%f) ;" x y x' y') prs in + let smalldot (x,y) = Printf.sprintf "%c\\draw[gray!10,fill=gray!30] (%f,%f) circle (0.15);\n\\smalldot{%f,%f};" '%' x y x y in + let psmalldot = map (smalldot) sat in + join_lines (psmalldot @ pp);; + +(* autoBUGZBTW *) + +let print_rogers seed= + let radius = 0.15 in + let (_,sat) = randompacking radius seed 3.0 1.4 in (* 3,1.4 *) + let satst = sat_triples sat in + let s = nth sat in + let coord_triple t = center2 (nth sat) t in + let prs = filter (fun ((i,j,k),(i',j',k')) -> + List.length (intersect [i;j;k] [i';j';k'])=2 && lex3 (i,j,k) (i',j',k')) + (outer satst satst) in + let pp = map (fun (t, t') -> + let (x,y) = coord_triple t in + let (x',y') = coord_triple t' in + Printf.sprintf "\\draw[very thick] (%f,%f) -- (%f,%f) ;" x y x' y') prs in + let smalldot (x,y) = Printf.sprintf "%c\\draw[gray!10,fill=gray!30] (%f,%f) circle (0.15);\n\\smalldot{%f,%f};" '%' x y x y in + let psmalldot = map (smalldot) sat in + let draw ((ux,uy),(vx,vy)) = Printf.sprintf "\\draw (%f,%f)--(%f,%f);" ux uy vx vy in + let drawc (ax,ay) (bx,by) (cx,cy) (dx,dy)= + Printf.sprintf "\\draw[fill=gray] (%f,%f)--(%f,%f)--(%f,%f)--(%f,%f)--cycle;" ax ay bx by cx cy dx dy in + let draw_radial (i,j,k) = + let c = coord_triple (i,j,k) in + let (u1,u2,u3)=(s i,s j,s k) in + let vv = map draw [(c,u1);(c,u2);(c,u3);] in + join_lines vv in + let radial = map draw_radial satst in + let draw_dedge (t,t') = + let c = coord_triple t in + let c'= coord_triple t' in + let (i,j) = tuple2 (intersect (list3 t) (list3 t')) in + let u1 = s i in + let u2 = s j in + let w = u2 -.. u1 in + let d = c -.. u1 in + let d' = c' -.. u1 in + if (det2 d w *. det2 w d' > 0.0) then draw (u1, u2) else drawc u1 c u2 c' in + let dedge = map draw_dedge prs in + join_lines (psmalldot @ radial @ dedge @ pp);; + +(* EVIAIQP +*) +let print_voronoi seed= + let radius = 0.15 in + let (_,sat) = randompacking radius seed 3.0 1.4 in (* 3,1.4 *) + let satst = sat_triples sat in + let coord_triple t = center2 (nth sat) t in + let prs = filter (fun ((i,j,k),(i',j',k')) -> + List.length (intersect [i;j;k] [i';j';k'])=2 && lex3 (i,j,k) (i',j',k')) + (outer satst satst) in + let pp = map (fun (t, t') -> + let (x,y) = coord_triple t in + let (x',y') = coord_triple t' in + Printf.sprintf "\\draw[very thick] (%f,%f) -- (%f,%f) ;" x y x' y') prs in + let dot (x,y) = Printf.sprintf "\\smalldot{%f,%f};" x y in + let psmalldot = map (dot) sat in + join_lines (psmalldot @ pp);; + +(* ANNTKZP *) + +let print_delaunay seed= + let radius = 0.15 in + let (_,sat) = randompacking radius seed 3.0 1.4 in (* 3,1.4 *) + let satst = sat_triples sat in + let delaunay_edge = List.flatten (map (fun (i,j,k) -> [(i,j);(j,k);(k,i)]) satst) in + + let s = nth sat in + let smalldot (x,y) = Printf.sprintf "\\smalldot{%f,%f};" x y in + let psmalldot = map (smalldot) sat in + let draw ((ux,uy),(vx,vy)) = Printf.sprintf "\\draw (%f,%f)--(%f,%f);" ux uy vx vy in + let pdraw = map (fun (i,j) -> draw (s i,s j)) delaunay_edge in + join_lines ( psmalldot @ (* radial @ dedge @ pp @ *) pdraw);; + + + +(* figYAJOTSL *) + +let mk_tetrahedron seed = + let rot v = mul3 (random_SO3 seed) ( sqrt(3.0 /. 2.0) %... v) in + let v1 = rot (0.0,0.0,1.0) in + let v2 = rot (sqrt(8.0)/. 3.0,0.0,-. 1.0/. 3.0) in + let v3 = rot (-. sqrt(8.0)/. 6.0, sqrt(2.0/. 3.0), -. 1.0/. 3.0) in + let v4 = rot (-. sqrt(8.0)/. 6.0,-. sqrt(2.0 /. 3.0),-. 1.0/. 3.0) in + (v1,v2,v3,v4);; + +let print_tetra = + let (v1,v2,v3,v4) = (mk_tetrahedron 50) in + let [w1;w2;w3;w4]= map (proj delta1 delta2) [v1;v2;v3;v4] in + let draw ((ux,uy),(vx,vy)) = Printf.sprintf "\\draw (%f,%f)--(%f,%f);" ux uy vx vy in + let drawv ((ux,uy),(vx,vy)) = Printf.sprintf "\\draw[very thick] (%f,%f)--(%f,%f);" ux uy vx vy in + let face (s, (ux,uy),(vx,vy),(wx,wy)) = + Printf.sprintf "\\draw[fill=black!%s] (%f,%f)--(%f,%f)--(%f,%f)--cycle;" s ux uy vx vy wx wy in + let vertex (x,y) = Printf.sprintf "\\smalldot{%f,%f};" x y in + let vertices = map vertex [w1;w2;w3;w4] in + let vv = map draw [(w1,w2);(w1,w3);(w1,w4);(w2,w3);(w3,w4);(w2,w4)] in + let shade = join_lines (map face [("45",w1,w2,w4); ("30",w1,w2,w3);("10",w2,w3,w4)]) in + let edges= join_lines vv in + let triangulate (u,v,w) = + let c = proj delta1 delta2 (0.3333 %... (u +... v +... w)) in + let [muv;mvw;muw] = map (fun (u,v)-> proj delta1 delta2 (0.5 %... (u +... v))) + [(u,v);(v,w);(u,w)] in + let [pu;pv;pw] = map (proj delta1 delta2) [u;v;w] in + let vv = map draw [(c,pu);(c,pv);(c,pw)] in + let ww = map drawv [(c,muv);(c,mvw);(c,muw)] in + join_lines (vv @ ww) in + join_lines (edges :: shade :: (map triangulate [(v1,v2,v4);(v1,v2,v3);(v2,v3,v4)]) @ vertices);; + +(* autoBWEYURN *) + +let print_marchal seed= + let radius = 0.15 in + let radius_sqrt2 = 0.212 in + let (_,sat) = randompacking radius seed 3.0 1.4 in (* 3,1.4 *) + let satst = sat_triples sat in + let rr = 0-- (List.length sat - 1) in + let allpair = (outer rr rr) in + let s = nth sat in + let shortpair =filter(fun (i,j)-> (i + List.length (intersect [i;j;k] [i';j';k'])=2 && lex3 (i,j,k) (i',j',k')) + (outer satst satst) in + let pp = map (fun (t, t') -> + let (x,y) = coord_triple t in + let (x',y') = coord_triple t' in + Printf.sprintf "\\draw[very thick] (%f,%f) -- (%f,%f) ;" x y x' y') prs in + let line (x,y) = Printf.sprintf "\\draw[black,fill=black!20] (%f,%f) circle (%f);" + x y radius_sqrt2 in + let dot_line (x,y) = Printf.sprintf "\\smalldot{%f,%f};" x y in + let psmalldot = map (line) sat in + let dot = map (dot_line) sat in + let draw ((ux,uy),(vx,vy)) = Printf.sprintf "\\draw (%f,%f)--(%f,%f);" ux uy vx vy in + let draw_radial (i,j,k) = + let c = coord_triple (i,j,k) in + let (u1,u2,u3)=(s i,s j,s k) in + let vv = map draw [(c,u1);(c,u2);(c,u3);] in + join_lines vv in + let radial = map draw_radial satst in + let draw_dedge (t,t') = + let c = coord_triple t in + let c'= coord_triple t' in + let (i,j) = tuple2 (intersect (list3 t) (list3 t')) in + let u1 = s i in + let u2 = s j in + let w = u2 -.. u1 in + let d = c -.. u1 in + let d' = c' -.. u1 in + if (det2 d w *. det2 w d' > 0.0) then draw (u1, u2) else "%" in + let dedge = map draw_dedge prs in + let fill_tri (s,(ux,uy),(vx,vy),(wx,wy)) = + Printf.sprintf "\\draw[black,fill=black!%s] (%f,%f)--(%f,%f)--(%f,%f)--cycle;" + s ux uy vx vy wx wy in + let rotate u v x = + v +.. cmul (normalize2 (u -.. v)) x in + let drawc (ax,ay) (bx,by) (cx,cy) (dx,dy) = + Printf.sprintf "\\draw[fill=black!35] (%f,%f)--(%f,%f)--(%f,%f)--(%f,%f)--cycle;\n\\draw (%f,%f)--(%f,%f);" + ax ay bx by cx cy dx dy ax ay cx cy in + let draw_cell2 (i,j) = + let u1 = s i in + let u2 = s j in + let r = dist2 u1 u2 in + let h2 = radius_sqrt2 *. radius_sqrt2 -. r *. r /. 4.0 in + let _ = (h2 >= 0.0) or failwith (Printf.sprintf "expected pos %d %d %f" i j h2) in + let h = sqrt(h2) in + let c = rotate u1 u2 (r /. 2.0,h) in + let c' = rotate u1 u2 (r /. 2.0, -. h) in + drawc u1 c u2 c' in + let cell2 = map draw_cell2 shortpair in + let draw_cell3 (i,j,k) = + let (u,v,w) = (s i,s j,s k) in fill_tri ("60",u,v,w) in + let cell3filter (i,j,k) = + etaV (s i) (s j) (s k) < radius *. sqrt(2.0) in + let cell3 = map draw_cell3 (filter cell3filter satst) in + join_lines (psmalldot @ pp @ radial @ dedge @ cell2 @ cell3 @ dot);; + +(* FIFJALK *) + +let print_ferguson_hales seed= + let radius = 0.15 in + let radius_h = 1.255 *. radius in + let radius_h2 = 2.51 *. radius in + let radius_s = sqrt(8.0) *. radius in + let (_,sat) = randompacking radius seed 3.0 1.4 in (* 3,1.4 *) + let s = nth sat in + let satst = sat_triples sat in + let qrtet = filter (fun (i,j,k) -> dist2 (s i) (s j) < radius_h2 && + dist2 (s j) (s k) < radius_h2 && + dist2 (s i) (s k) < radius_h2) satst in + let quarter = filter (fun (i,j,k) -> + let [a;b;c] = + sort (<) [dist2 (s i) (s j);dist2 (s j) (s k);dist2 (s i) (s k)] in + (a < radius_h2 && b < radius_h2 && c < radius_s)) satst in + let satst = sat_triples sat in + let rr = 0-- (List.length sat - 1) in + let allpair = (outer rr rr) in + let coord_triple t = center2 (nth sat) t in + let prs = filter (fun ((i,j,k),(i',j',k')) -> + List.length (intersect [i;j;k] [i';j';k'])=2 && lex3 (i,j,k) (i',j',k')) + (outer satst satst) in + let pp = map (fun (t, t') -> + let (x,y) = coord_triple t in + let (x',y') = coord_triple t' in + Printf.sprintf "\\draw[very thick] (%f,%f) -- (%f,%f) ;" x y x' y') prs in + let shortpair =filter(fun (i,j)-> (i= 0.0) or failwith (Printf.sprintf "expected pos %d %d %f" i j h2) in + let h = sqrt(h2) in + let c = rotate u1 u2 (r /. 2.0,h) in + let c' = rotate u1 u2 (r /. 2.0, -. h) in + drawc u1 c u2 c' in + let cell2 = map draw_cell2 shortpair in + let draw_cell3 (i,j,k) = + let (u,v,w) = (s i,s j,s k) in fill_tri ("60",u,v,w) in + let cell3 = map draw_cell3 (qrtet @ quarter) in + join_lines (pp @ pcircle @ cell2 @ cell3 @ dot);; + + + +(* +SENQMWT +*) + +let print_thue seed= + let radius = 0.15 in + let radius_2_div_sqrt3 = radius *. 2.0 /. sqrt(3.0) in + let (_,sat) = randompacking radius seed 3.0 1.4 in (* 3,1.4 *) + let rr = 0-- (List.length sat - 1) in + let allpair = (outer rr rr) in + let s = nth sat in + let shortpair =filter(fun (i,j)-> (i= 0.0) or failwith (Printf.sprintf "expected pos %d %d %f" i j h2) in + let h = sqrt(h2) in + let c = rotate u1 u2 (r /. 2.0,h) in + let c' = rotate u1 u2 (r /. 2.0, -. h) in + drawc u1 c u2 c' in + let cell2 = map draw_cell2 shortpair in + join_lines (psmalldot (* @ dedge *) @ cell2 @ dot);; + + + +(* figKVIVUOT *) + +let kv_inter r2 u v = + let nu = norm3 u in + let nvu = norm3 (v-...u) in + let t = sqrt ( (r2 -. nu *. nu) /. (nvu *. nvu)) in + u +... t %... (v-... u);; + +(* +let kv_interp s u v1 v2 = + let r2 = 2.0 in + let v = (s %... v2) +... ((1.0 -. s) %... v1) in + let nu = norm3 u in + let nvu = norm3 (v-...u) in + let t = sqrt ( (r2 -. nu *. nu) /. (nvu *. nvu)) in + u +... t %... (v-... u) + ;; +*) + +let kv_interp r2 s u v1 v2 = + let v = (s %... v2) +... ((1.0 -. s) %... v1) in + kv_inter r2 u v;; + + +let kv_proj rho (x,y,z) = x %.. (1.0,0.0) +.. y %.. (0.0,1.0) +.. z %.. rho;; + +let rx u1 u2 label = + let r2 = 2.0 in + let rho = (0.33,0.66) in + let null3 = (0.0,0.0,0.0) in + let p1 = map (fun s -> kv_interp r2 (float_of_int s /. 5.0) null3 u1 u2) (0--5) in + let q1 = map (kv_proj rho) p1 in + let w1 = join_space (map (fun (x,y)-> Printf.sprintf "(%f,%f) " x y) q1) in + Printf.sprintf "\\def\\kv%s{%s}" label w1 ;; + +let col1 = + let a = 1.5 in + let b = 2.0 in + let c = b +. 0.2 in + let bb = sqrt(b*.b -. a*.a) in + let cc = sqrt(c*.c -. b*.b) in + let r2 = 2.0 in + let r = sqrt(r2) in + let omega1 = a %... delta2 in + let omega2 = omega1 +... bb %... delta1 in + let omega3 = omega2 +... cc %... delta3 in + let v1 = r %... normalize3 omega1 in + let v2 = r %... normalize3 omega2 in + let v3 = r %... normalize3 omega3 in + let w12 = rx v1 v2 "oneab" in + let w13 = rx v1 v3 "oneac" in + let w32 = rx v3 v2 "onecb" in + join_lines [w12;w13;w32];; + +let col2 = + let a = 1.0 in + let b = 2.0 in + let c = b +. 0.2 in + let bb = sqrt(b*.b -. a*.a) in + let cc = sqrt(c*.c -. b*.b) in + let r2 = 2.0 in + let r = sqrt(r2) in + let omega1 = a %... delta2 in + let omega2 = omega1 +... bb %... delta1 in + let omega3 = omega2 +... cc %... delta3 in + let v13 = kv_inter r2 omega1 omega3 in + let v12 = kv_inter r2 omega1 omega2 in + let v3 = r %... normalize3 omega3 in + let v2 = r %... normalize3 omega2 in + let wab = rx v13 v3 "Bab" in + let wbc = rx v3 v2 "Bbc" in + let wcd = rx v2 v12 "Bcd" in + let wda = rx v12 v13 "Bda" in + join_lines [wab;wbc;wcd;wda];; + + +let col3 = + let a = 1.0 in + let b = 1.35 in + let c = 2.0 in + let bb = sqrt(b*.b -. a*.a) in + let cc = sqrt(c*.c -. b*.b) in + let r2 = 2.0 in + let r = sqrt(r2) in + let omega1 = a %... delta2 in + let omega2 = omega1 +... bb %... delta1 in + let omega3 = omega2 +... cc %... delta3 in + let v13 = kv_inter r2 omega1 omega3 in + let v23 = kv_inter r2 omega2 omega3 in + let v3 = r %... normalize3 omega3 in + let wab = rx v13 v3 "Cab" in + let wbc = rx v3 v23 "Cbc" in + let wca = rx v23 v13 "Cca" in + join_lines [wab;wbc;wca];; + + + +(* +figDEJKNQK + +v0 = {0, 0, 1}; +null = {0, 0, 0}; +v1 = {0, 0.85, Sqrt[1 - 0.85^2]}; +v2 = FarFrom[{1, 0, 0}, Vertex[{v0, 1}, {v1, 1}, {null, 1}]] +v3 = FarFrom[{0, 0, -1}, Vertex[{null, 1}, {v1, 1}, {v2, 1.26}]] +v4 = FarFrom[v1, Vertex[{null, 1}, {v2, 1}, {v3, 1.26}]] +v5 = FarFrom[v2, Vertex[{null, 1}, {v4, 1}, {v3, 1.26}]] +w4 = FarFrom[v1, Vertex[{null, 1}, {v2, 1}, {v3, 1}]] +w5 = FarFrom[v2, Vertex[{null, 1}, {v4, 1}, {v3, 1}]] +w6 = FarFrom[v4, Vertex[{null, 1}, {v3, 1}, {v5, 1}]] +*) + + +let vws = + let v1=( 0.0, 0.85, 0.526783) in + let v2=( -0.820069, 0.278363, 0.5) in + let v3=( 0.32578, 0.00230249, 0.945443) in + let v4=( -0.586928, -0.690949, 0.422025) in + let v5=( 0.329363, -0.938133, 0.106892) in + let w4=( -0.409791, -0.617314, 0.671562) in + let w5=(0.40333, -0.826891, 0.391887) in + let w6=(0.965333, -0.171655, 0.196637) in + (v1,v2,v3,v4,v5,w4,w5,w6);; + +let rxdej(u1,u2,label) = + let r2 = 1.0 in + let rho = (0.0,0.0) in + let null3 = (0.0,0.0,0.0) in + let p1 = map (fun s -> kv_interp r2 (float_of_int s /. 5.0) null3 u1 u2) (0--5) in + let q1 = map (kv_proj rho) p1 in + let w1 = join_space (map (fun (x,y)-> Printf.sprintf "(%f,%f) " x y) q1) in + Printf.sprintf "\\def\\dejk%s{%s}" label w1 ;; + +let mkdejA = + let (v1,v2,v3,v4,v5,w4,w5,w6) = vws in + let vv = join_lines (map rxdej + [(v1,v2,"a");(v2,v4,"b");(v4,v5,"c");(v5,w6,"d");(w6,v3,"e");(v3,v1,"f"); + (v2,v3,"g");(v4,v3,"h");(v5,v3,"i");(v4,w5,"j");(w5,v3,"k");(v2,w4,"l"); + (w4,v3,"m")]) in + vv;; + +let mkdejB = + let rho = (0.0,0.0) in + let (v1,v2,v3,v4,v5,w4,w5,w6) = vws in + let a ((x,y),s) = Printf.sprintf "\\coordinate (%s) at (%f,%f);" s x y in + let ww = join_lines (map (fun (v,s) -> a ((kv_proj rho v),s)) + [(v1,"v1");(v2,"v2");(v3,"v3");(v4,"v4");(v5,"v5");(w4,"w4");(w5,"w5");(w6,"w6")]) in + ww;; + + +(* QTICQYN + +Mathematica: +v0 = {0, 0, 1}; +null = {0, 0, 0}; +v1 = {0, 0.85, Sqrt[1 - 0.85^2]}; +v2 = FarFrom[{1, 0, 0}, Vertex[{v0, 1}, {v1, 1}, {null, 1}]]; +v3 = FarFrom[{0, 0, -1}, Vertex[{null, 1}, {v1, 1}, {v2, 1.5}]]; +v4 = FarFrom[v1, Vertex[{null, 1}, {v2, 1}, {v3, 1.5}]]; +v5 = FarFrom[v2, Vertex[{null, 1}, {v4, 1}, {v3, 1}]]; +*) + +let qtvv = + let v1=(0.0, 0.85, 0.526783) in + let v2=(-0.820069, 0.278363, 0.5) in + let v3=(0.651104, 0.124197, 0.748758) in + let v4=(-0.572254, -0.688878, 0.444941) in + let v5=(0.421862, -0.796553, 0.433055) in + (v1,v2,v3,v4,v5);; + + +let rxqt(u1,u2,label) = + let r2 = 1.0 in + let rho = (0.0,0.0) in + let null3 = (0.0,0.0,0.0) in + let p1 = map (fun s -> kv_interp r2 (float_of_int s /. 5.0) null3 u1 u2) (0--5) in + let q1 = map (kv_proj rho) p1 in + let w1 = join_space (map (fun (x,y)-> Printf.sprintf "(%f,%f) " x y) q1) in + Printf.sprintf "\\def\\qt%s{%s}" label w1 ;; + +let mkqtA = + let (v1,v2,v3,v4,v5) = qtvv in + let vv = join_lines (map rxqt + [(v1,v2,"a");(v2,v4,"b");(v4,v5,"c");(v5,v3,"d");(v3,v1,"e");(v2,v3,"f"); + (v4,v3,"g")]) in + vv;; + +let mkqtB = + let rho = (0.0,0.0) in + let (v1,v2,v3,v4,v5) = qtvv in + let a ((x,y),s) = Printf.sprintf "\\coordinate (%s) at (%f,%f);" s x y in + let ww = join_lines (map (fun (v,s) -> a ((kv_proj rho v),s)) + [(v1,"v1");(v2,"v2");(v3,"v3");(v4,"v4");(v5,"v5")]) in + ww;; + +(* +HEABLRG +*) + +let vvhe = + let (a,b,c) = (0.45,0.6,0.4) in + map normalize3 [(a,b,c);(-. a,b,c);(-.a,-.b,c);(a,-.b,c)];; + +let dualhe = + let [v1;v2;v3;v4] = vvhe in + let nc (u,v) = normalize3 (cross u v) in + map nc [(v1,v2);(v2,v3);(v3,v4);(v4,v1)];; + +let mkhe = + let rho = (0.0,0.0) in + let [v1;v2;v3;v4] = vvhe in + let [w1;w2;w3;w4] = dualhe in + let vv = join_lines (map rxqt + [(v1,v2,"a");(v2,v3,"b");(v3,v4,"c");(v4,v1,"d");(w1,w2,"e");(w2,w3,"f"); + (w3,w4,"g");(w4,w1,"h")]) in + let a ((x,y),s) = Printf.sprintf "\\coordinate (%s) at (%f,%f);" s x y in + let ww = join_lines (map (fun (v,s) -> a ((kv_proj rho v),s)) + [(v1,"v1");(v2,"v2");(v3,"v3");(v4,"v4");(w1,"w1");(w2,"w2");(w3,"w3"); + (w4,"w4")]) in + join_lines [ww;vv];; + + + +(* figYAHDBVO *) + +let vv i = (72.0*.i +. (-.40.0) +. Random.float 80.0,Random.float 1.5 +. 1.0);; + +(* map (vv o float_of_int) [0;1;2;3;4];; *) + +let vout =[ (-1.40573615605411817, 2.43152527011496122); + (62.2310998421659392, 1.50101500229540341); + (166.419445012932584, 1.80579527399678152); + (206.27916875919712, 1.73501080990908485); + (293.766402309343221, 1.59228179599956721)];; + +let midangles = + let mm = map fst vout in + let suc i = ((i+1) mod 5) in + let mm1 i = nth mm (suc i) +. if (nth mm i < nth mm (suc i)) then 0.0 else 360. in + let mm' i = 0.5 *. (nth mm i +. mm1 i ) in + let f = map mm' (0--4) in + let mm' i = 1.0/. cos( (pi /. 180.0) *.(0.5 *. (mm1 i -. nth mm i))) in + let g = map mm' (0--4) in + zip f g;; + +let poly2_extreme = + let m = map (fun (theta,r)-> (r *. cos (radian theta), r*. sin (radian theta))) vout in + let v i = nth m i in + let suc i = v ((i+1) mod 5) in + let inter i = solve22 (v i, suc i) (v i *.. v i, suc i *.. suc i) in + map inter (0--4);; + +(* figZXEVDCA *) + + +let fix_SO3 = (* random_SO3 () ;; *) + ((-0.623709278332764572, -0.768294961660169751, -0.143908262477248777), + (-0.592350038826666592, 0.34445174255424732, 0.728336754910384077), + (-0.510008007411323683, 0.539514456654259789, -0.669937298138706616));; + + +(* vertices of an icosahedron, vector lengths sqrt3. *) + +let icos_vertex = + let sqrt3 = sqrt(3.0) in + let v = sqrt3 %... (1.0,0.0,0.0) in +(* let d0 = 2.10292 in *) (* 20 Solid[2,2,2,d0,d0,d0] = 4 Pi *) + let theta = 1.10715 in (* arc[2,2,d0] = theta *) + let ct = cos theta in + let st = sin theta in + let p5 = pi/. 5.0 in + let vv = map (mul3 fix_SO3) + ( v :: map + (fun i-> (sqrt3 %... (ct, st *. cos (i *. p5), st *. sin (i *. p5)))) + [2.0;4.0;6.0;8.0;10.0]) in + (vv @ (map ( uminus3 ) vv));; + +let iv = nth icos_vertex;; + +let icos_edge = + let v i = nth icos_vertex i in + let dall = filter (fun (i,j) -> (i dist3 (v i) (v j) < 2.2) dall;; (* note 2.2 cutoff *) + +let icos_face = + let micos (i,j) = mem ( i, j ) icos_edge in + let balance (i,(j,k)) = (i,j,k) in + map balance (filter (fun (i,(j,k)) -> micos (i,j) && micos (i,k) && micos (j,k)) + (outer (0--11) (outer (0--11) (0--11))));; + +let dodec_vertex = + map (fun (i,j,k) -> extreme_point (iv i,iv j,iv k)) icos_face;; (* voronoi cell vertices *) + +let next_icos_face (a,b,u3)= (* input flag: [a] subset u2 subset u3 *) + let v3 = list3 u3 in + let _ = mem a v3 or failwith "next_dodec_face a" in + let _ = mem b v3 or failwith "next_dodec_face b" in + let ifc = map (tuple3) (filter (subset [a;b]) (map list3 icos_face)) in + let ifc' = subtract ifc [u3] in + let _ = List.length ifc' = 1 or failwith "next_dodec_face c" in + let w3 = nth ifc' 0 in + let cx = subtract (list3 w3) [a;b] in + let _ = List.length cx = 1 or failwith "next_dodec_face d" in + let c = hd cx in + let w2x = filter (fun (i,j)->(i funpow i next_icos_face startp) [0;1;2;3;4] in + map (fun (_,_,u) -> u) t;; + +let icos_cycles = map icos_vertex_cycle (0--11);; + +let ht xxs = + let (_,_,z) = end_itlist ( +... ) xxs in + z;; + +let sort_dodec_face = + let t = icos_cycles in + let lookup = zip icos_face dodec_vertex in + let htc cycle = ht (map (fun i -> assoc i lookup) cycle) in + let hts = map htc t in + let z = zip hts t in + let z' = filter (fun (h,_) -> (h>0.0)) z in + let t' = map snd (sort (fun (a,_) (b,_) -> a assoc i lookup) cycle in + (1.0 /. float_of_int (List.length cycle)) %... (end_itlist (+...) coords);; + +let pname (i,j,k) = Printf.sprintf "V%d-%d-%d" i j k;; + +let print_cycles = + let lookup = zip icos_face (map (proj delta1 delta2) dodec_vertex) in + map (fun (r,(x,y)) -> Printf.sprintf "\\coordinate (%s) at (%f,%f);" (pname r) x y) lookup;; + +let print_dodec_face = + let opt = "fill=white" in + let pdraw = Printf.sprintf "\\draw[%s] " opt in + let cycle m = join_space (map (fun s -> Printf.sprintf "(%s)--" ( pname s)) m) in + let s m = pdraw ^ (cycle m) ^ "cycle;" in + map s sort_dodec_face;; + +(* let print_dodec = join_lines (print_cycles @ print_dodec_face);; *) + + + +(* printing spherical caps. + Parameters: + R = radius of sphere at the origin + v =(_,_,_) norm 1 vector pointing to center of cap. + theta = arclength on unit sphere of cap. + +*) + + + +let frame_cap v = + let v = normalize3 v in + let (x,y,z) = v in + let w = normalize3 (-. y,x,0.0) in + frame_of v w;; + +let ellipse_param v rad theta = + let (v,w,u) = frame_cap v in + let q = (rad *. cos theta) %... v in + let qbar = proj delta1 delta2 q in + let p = ((rad *. cos theta) %... v) +... ((rad *. sin theta) %... u) in + let pbar = proj delta1 delta2 p in + let h = dist2 qbar pbar in + let k = rad *. sin theta in + (qbar,h,k);; + +let calc_psi theta v = + let (x,y,_) = normalize3 v in + let cospsi = cos theta /. sqrt( x *. x +. y *. y) in + if (abs_float cospsi <= 1.0) then acos cospsi else 0.0;; + +let calc_alpha rad psi qbar = + let nqbar = normalize2 qbar in + let rtrue = cmul (rad *. cos psi, rad *. sin psi) nqbar in + let a = normalize2 (rtrue -.. qbar) in + acos (a *.. nqbar);; + +let adjust_alpha h k alpha = (* compensate for TIKZ BUG in arc specs *) + let ca = cos alpha in + let sa = sin alpha in + let t = 1.0 /. sqrt(ca *. ca /. (h *. h) +. sa *. sa /. (k *. k)) in + acos (t *. ca /. h);; + +let print_ellipse rad qbar h k psi = + let nqbar = normalize2 qbar in + let r = (rad *. cos psi, rad *. sin psi) in + let (qbx,qby) = qbar in + let (px,py) = cmul r nqbar in + let (px',py') = cmul (conj r) nqbar in + let alpha = adjust_alpha h k (calc_alpha rad psi qbar) in + let endangle = 2.0 *. pi -. alpha in + let rotateAngle = degree (arg qbx qby) in + let cstart = degree (arg px' py') in + let delta = 2.0 *. psi in + let s = "\\draw[ball color=gray!10,shading=ball] (0,0) circle (1);\n\\end{scope}" in + if (psi<0.01) then + Printf.sprintf + "\\begin{scope} \\clip (%f,%f) circle[x radius=%f,y radius=%f,rotate=%f];\n%s" + qbx qby h k rotateAngle s + else + Printf.sprintf + "\\begin{scope}\\clip (%f,%f) arc[x radius=%f,y radius = %f,start angle=%f,end angle=%f,rotate=%f] arc[radius=1.0,start angle=%f,delta angle=%f];\\pgfpathclose;\n%s" + px py h k (degree alpha) (degree endangle) rotateAngle + cstart (degree delta) + s;; + +let print_dodec_ellipse = + let vs = map center_face sort_dodec_face in + let theta = pi /. 6.0 in + let rad = 1.0 in + let one_ellipse v = + let (q,h,k) = ellipse_param v rad theta in + let psi = calc_psi theta v in + print_ellipse rad q h k psi in + map one_ellipse vs;; + + + + + +(* output *) + +let outfilestring = "/tmp/x.txt";; + +let execute() = + let outs = open_out outfilestring in + let write_out s = try (Printf.fprintf outs "%s" s) + with _ as t -> (close_out outs; raise t) in + let _ = write_out "% AUTO GENERATED BY tikz.ml. Do not edit.\n" in + let wrap s s' = Printf.sprintf "\\def\\%s{%s}\n\n\n" s s' in + let add name s = write_out (wrap name s) in + let _ = add "autoZXEVDCA" + (join_lines (print_cycles @ print_dodec_face @ print_dodec_ellipse)) in + let voronoi_seed = 12345678 in (* 50, 300 good, *) + let _ = add "autoDEQCVQL" (print_satunsat 5) in +(* ok to here. In ML mode next line causes stack overflow. *) + let _ = add "autoXOHAZWO" (print_satst voronoi_seed) in + let _ = add "autoBUGZBTW" (print_rogers voronoi_seed) in + let _ = add "autoORQISJR" (print_rogers 45) in + let _ = add "autoSENQMWT" (print_thue 45) in + let _ = add "autoEVIAIQP" (print_voronoi 45) in + let _ = add "autoANNTKZP" (print_delaunay 45) in + let _ = add "autoFIFJALK" (print_ferguson_hales 45) in + let _ = add "autoBWEYURN" (print_marchal 45) in + let _ = add "autoYAJOTSL" (print_tetra) in + let _ = add "autoKVIVUOT" (join_lines[col1;col2;col3]) in + let _ = add "autoDEJKNQK" (mkdejA) in + let _ = add "autocDEJKNQK" (mkdejB) in + let _ = add "autoQTICQYN" (join_lines [mkqtA;mkqtB]) in + let _ = add "autoHEABLRG" (mkhe) in + let _ = add "autoSEYIMIE" (fcc_fun_domain) in + let _ = add "autoAZGXQWC" (tet_oct_ratio) in + let _ = add "autoTCFVGTS" (cubic_layers) in + let _ = add "autoPQJIJGE" (rhombic_dodec) in + let _ = add "autoSGIWBEN" (fcc_hcp_pattern) in + let _ = add "autoDHQRILO" (fcc_packing) in + let _ = add "autoBDCABIA" (pascal_packing) in + let _ = add "autoNTNKMGO" (square_layers) in + let _ = close_out outs in + "to save results move /tmp/x.txt to kepler_tex/x.txt" + ;; + +(* +let gen2_out = + let wrap s s' = Printf.sprintf "\\def\\%s{%s}\n\n\n" s s' in + let outstring = ref "" in + let add name s = outstring:= !outstring ^ wrap name s in + let _ = add "autoYAJOTSL" (print_tetra) in + let _ = add "autoKVIVUOT" (join_lines[col1;col2;col3]) in + let _ = add "autoDEJKNQK" (mkdejA) in + let _ = add "autocDEJKNQK" (mkdejB) in + let _ = add "autoQTICQYN" (join_lines [mkqtA;mkqtB]) in + let _ = add "autoHEABLRG" (mkhe) in + let _ = add "autoSEYIMIE" (fcc_fun_domain) in + let _ = add "autoAZGXQWC" (tet_oct_ratio) in + let _ = add "autoTCFVGTS" (cubic_layers) in + let _ = add "autoPQJIJGE" (rhombic_dodec) in + let _ = add "autoSGIWBEN" (fcc_hcp_pattern) in + let _ = add "autoDHQRILO" (fcc_packing) in + let _ = add "autoBDCABIA" (pascal_packing) in + let _ = add "autoNTNKMGO" (square_layers) in + output_filestring "/tmp/y.txt" (!outstring);; + +let genz_out = + let wrap s s' = Printf.sprintf "\\def\\%s{%s}\n\n\n" s s' in + let outstring = ref "" in + let add name s = outstring:= !outstring ^ wrap name s in + let _ = add "autoNTNKMGO" (square_layers) in + output_filestring "/tmp/z.txt" (!outstring);; +*) + +end;; diff --git a/legacy/general/database_more.ml b/legacy/general/database_more.ml new file mode 100644 index 0000000..c11c629 --- /dev/null +++ b/legacy/general/database_more.ml @@ -0,0 +1,2107 @@ +(* + +This file extends search capabilities to a few additional files. +For example, before this file is loaded the following search finds nothing, but +after the file is loaded it finds the thm SQRT_MUL + +# search [`sqrt(x*y)`];; + + + +By modifying the procedure below, search can be extended to the files of your choice. + + + + * The bulk of this file with created by the emacs macro listed below. + + * The emacs macro was read in by placing the cursor at the end of the macro and typing control-x control-e + + * HOL Light was loaded. Then the extra files were loaded. + Multivariate/vectors.ml + Examples/analysis.ml + Examples/transc.ml + definitions_kepler.ml (from google code) + + * The part of the screen showing the output from the extra files is highlighted, then the macro index-region is executed. + + * The buffer *scratch* is saved out to database_more.ml (this file) and the + head and tail were slightly edited. + +*) + +(* + +(defun index-region() + "Build an array of user-added theorms in scratch region" + (interactive) + (kill-ring-save (mark) (point)) + (set-buffer (get-buffer-create "*scratch*")) + (beginning-of-buffer) + (yank) + (let ((beg (point))) + (end-of-buffer) + (kill-region beg (point))) + (beginning-of-buffer) + (let ((pt (point))) + (end-of-buffer) + (universal-argument) + (shell-command-on-region pt (point) + "egrep \"[^-] : thm =\"" "*scratch*" t "*scratch*")) + (beginning-of-buffer) + (while (re-search-forward " ) :.*$" nil t) + (replace-match "" nil nil)) + (beginning-of-buffer) + (while (re-search-forward " :.*$" nil t) + (replace-match "" nil nil)) + (beginning-of-buffer) + (while (re-search-forward "^val ( " nil t) + (replace-match "" nil nil)) + (beginning-of-buffer) + (while (re-search-forward "^val " nil t) + (replace-match "" nil nil)) + (beginning-of-buffer) + (replace-regexp "^.*$" "(\"\\&\",\\&);") + (delete-backward-char 1) + (insert "];;") + (beginning-of-buffer) + (insert "(* AUTOMATICALLY GENERATED FILE BY EMACS MACRO index-region:") + (insert " DO NOT EDIT *);;\n\nthm_region_array := [") + (beginning-of-buffer) + ) + + +*) + +let thm_region_array = ref[];; + +(* AUTOMATICALLY GENERATED FILE BY EMACS MACRO index-region: DO NOT EDIT *) + +thm_region_array := [("EXISTS_DIFF",EXISTS_DIFF); +("GE_REFL",GE_REFL); +("FORALL_SUC",FORALL_SUC); +("SEQ_MONO_LEMMA",SEQ_MONO_LEMMA); +("REAL_HALF",REAL_HALF); +("UPPER_BOUND_FINITE_SET",UPPER_BOUND_FINITE_SET); +("UPPER_BOUND_FINITE_SET_REAL",UPPER_BOUND_FINITE_SET_REAL); +("LOWER_BOUND_FINITE_SET",LOWER_BOUND_FINITE_SET); +("LOWER_BOUND_FINITE_SET_REAL",LOWER_BOUND_FINITE_SET_REAL); +("REAL_CONVEX_BOUND_LT",REAL_CONVEX_BOUND_LT); +("REAL_CONVEX_BOUND_LE",REAL_CONVEX_BOUND_LE); +("INFINITE_ENUMERATE",INFINITE_ENUMERATE); +("APPROACHABLE_LT_LE",APPROACHABLE_LT_LE); +("REAL_LE_BETWEEN",REAL_LE_BETWEEN); +("REAL_LT_BETWEEN",REAL_LT_BETWEEN); +("TRIANGLE_LEMMA",TRIANGLE_LEMMA); +("LAMBDA_SKOLEM",LAMBDA_SKOLEM); +("LAMBDA_PAIR",LAMBDA_PAIR); +("sup",sup); +("SUP",SUP); +("SUP_FINITE_LEMMA",SUP_FINITE_LEMMA); +("SUP_FINITE",SUP_FINITE); +("REAL_LE_SUP_FINITE",REAL_LE_SUP_FINITE); +("REAL_SUP_LE_FINITE",REAL_SUP_LE_FINITE); +("REAL_LT_SUP_FINITE",REAL_LT_SUP_FINITE); +("REAL_SUP_LT_FINITE",REAL_SUP_LT_FINITE); +("REAL_SUP_UNIQUE",REAL_SUP_UNIQUE); +("REAL_SUP_LE",REAL_SUP_LE); +("REAL_SUP_LE_SUBSET",REAL_SUP_LE_SUBSET); +("REAL_SUP_BOUNDS",REAL_SUP_BOUNDS); +("REAL_ABS_SUP_LE",REAL_ABS_SUP_LE); +("REAL_SUP_ASCLOSE",REAL_SUP_ASCLOSE); +("inf",inf); +("INF",INF); +("INF_FINITE_LEMMA",INF_FINITE_LEMMA); +("INF_FINITE",INF_FINITE); +("REAL_LE_INF",REAL_LE_INF); +("REAL_LE_INF_FINITE",REAL_LE_INF_FINITE); +("REAL_INF_LE_FINITE",REAL_INF_LE_FINITE); +("REAL_LT_INF_FINITE",REAL_LT_INF_FINITE); +("REAL_INF_LT_FINITE",REAL_INF_LT_FINITE); +("REAL_INF_UNIQUE",REAL_INF_UNIQUE); +("REAL_LE_INF",REAL_LE_INF); +("REAL_LE_INF_SUBSET",REAL_LE_INF_SUBSET); +("REAL_ABS_INF_LE",REAL_ABS_INF_LE); +("REAL_INF_BOUNDS",REAL_INF_BOUNDS); +("REAL_ABS_INF_LE",REAL_ABS_INF_LE); +("REAL_INF_ASCLOSE",REAL_INF_ASCLOSE); +("hull",hull); +("HULL_P",HULL_P); +("P_HULL",P_HULL); +("HULL_EQ",HULL_EQ); +("HULL_HULL",HULL_HULL); +("HULL_SUBSET",HULL_SUBSET); +("HULL_MONO",HULL_MONO); +("HULL_ANTIMONO",HULL_ANTIMONO); +("HULL_MINIMAL",HULL_MINIMAL); +("SUBSET_HULL",SUBSET_HULL); +("HULL_UNIQUE",HULL_UNIQUE); +("HULL_UNION_SUBSET",HULL_UNION_SUBSET); +("HULL_UNION",HULL_UNION); +("HULL_REDUNDANT_EQ",HULL_REDUNDANT_EQ); +("HULL_REDUNDANT",HULL_REDUNDANT); +("HULL_INDUCT",HULL_INDUCT); +("HULL_INC",HULL_INC); +("REAL_ARCH_SIMPLE",REAL_ARCH_SIMPLE); +("REAL_ARCH_LT",REAL_ARCH_LT); +("REAL_ARCH",REAL_ARCH); +("REAL_ARCH_INV",REAL_ARCH_INV); +("REAL_POW_LBOUND",REAL_POW_LBOUND); +("REAL_ARCH_POW",REAL_ARCH_POW); +("REAL_ARCH_POW2",REAL_ARCH_POW2); +("REAL_ARCH_POW_INV",REAL_ARCH_POW_INV); +("FORALL_POS_MONO",FORALL_POS_MONO); +("FORALL_POS_MONO_1",FORALL_POS_MONO_1); +("REAL_ARCH_RDIV_EQ_0",REAL_ARCH_RDIV_EQ_0); +("REAL_MAX_SUP",REAL_MAX_SUP); +("REAL_MIN_INF",REAL_MIN_INF); +("sqrt",sqrt); +("SQRT_UNIQUE",SQRT_UNIQUE); +("POW_2_SQRT",POW_2_SQRT); +("SQRT_0",SQRT_0); +("SQRT_1",SQRT_1); +("POW_2_SQRT_ABS",POW_2_SQRT_ABS); +("SUM_GP_BASIC",SUM_GP_BASIC); +("SUM_GP_MULTIPLIED",SUM_GP_MULTIPLIED); +("SUM_GP",SUM_GP); +("SUM_GP_OFFSET",SUM_GP_OFFSET); +("FORALL_1",FORALL_1); +("FORALL_2",FORALL_2); +("FORALL_3",FORALL_3); +("SUM_1",SUM_1); +("SUM_2",SUM_2); +("SUM_3",SUM_3); +("vector_add",vector_add); +("vector_sub",vector_sub); +("vector_neg",vector_neg); +("vector_mul",vector_mul); +("vec",vec); +("dot",dot); +("DOT_1",DOT_1); +("DOT_2",DOT_2); +("DOT_3",DOT_3); +("VEC_COMPONENT",VEC_COMPONENT); +("VECTOR_ADD_COMPONENT",VECTOR_ADD_COMPONENT); +("VECTOR_SUB_COMPONENT",VECTOR_SUB_COMPONENT); +("VECTOR_NEG_COMPONENT",VECTOR_NEG_COMPONENT); +("VECTOR_MUL_COMPONENT",VECTOR_MUL_COMPONENT); +("COND_COMPONENT",COND_COMPONENT); +("VECTOR_ADD_SYM",VECTOR_ADD_SYM); +("VECTOR_ADD_LID",VECTOR_ADD_LID); +("VECTOR_ADD_RID",VECTOR_ADD_RID); +("VECTOR_SUB_REFL",VECTOR_SUB_REFL); +("VECTOR_ADD_LINV",VECTOR_ADD_LINV); +("VECTOR_ADD_RINV",VECTOR_ADD_RINV); +("VECTOR_SUB_RADD",VECTOR_SUB_RADD); +("VECTOR_NEG_SUB",VECTOR_NEG_SUB); +("VECTOR_SUB_EQ",VECTOR_SUB_EQ); +("VECTOR_MUL_ASSOC",VECTOR_MUL_ASSOC); +("VECTOR_MUL_LID",VECTOR_MUL_LID); +("VECTOR_MUL_LZERO",VECTOR_MUL_LZERO); +("VECTOR_SUB_ADD",VECTOR_SUB_ADD); +("VECTOR_SUB_ADD2",VECTOR_SUB_ADD2); +("VECTOR_ADD_LDISTRIB",VECTOR_ADD_LDISTRIB); +("VECTOR_SUB_LDISTRIB",VECTOR_SUB_LDISTRIB); +("VECTOR_ADD_RDISTRIB",VECTOR_ADD_RDISTRIB); +("VECTOR_SUB_RDISTRIB",VECTOR_SUB_RDISTRIB); +("VECTOR_ADD_SUB",VECTOR_ADD_SUB); +("VECTOR_EQ_ADDR",VECTOR_EQ_ADDR); +("VECTOR_SUB",VECTOR_SUB); +("VECTOR_SUB_RZERO",VECTOR_SUB_RZERO); +("VECTOR_MUL_RZERO",VECTOR_MUL_RZERO); +("VECTOR_NEG_MINUS1",VECTOR_NEG_MINUS1); +("VECTOR_ADD_ASSOC",VECTOR_ADD_ASSOC); +("VECTOR_SUB_LZERO",VECTOR_SUB_LZERO); +("VECTOR_NEG_NEG",VECTOR_NEG_NEG); +("VECTOR_MUL_LNEG",VECTOR_MUL_LNEG); +("VECTOR_MUL_RNEG",VECTOR_MUL_RNEG); +("VECTOR_NEG_0",VECTOR_NEG_0); +("VECTOR_ADD_AC",VECTOR_ADD_AC); +("VEC_EQ",VEC_EQ); +("DOT_SYM",DOT_SYM); +("DOT_LADD",DOT_LADD); +("DOT_RADD",DOT_RADD); +("DOT_LSUB",DOT_LSUB); +("DOT_RSUB",DOT_RSUB); +("DOT_LMUL",DOT_LMUL); +("DOT_RMUL",DOT_RMUL); +("DOT_LNEG",DOT_LNEG); +("DOT_RNEG",DOT_RNEG); +("DOT_LZERO",DOT_LZERO); +("DOT_RZERO",DOT_RZERO); +("DOT_POS_LE",DOT_POS_LE); +("DOT_EQ_0",DOT_EQ_0); +("DOT_POS_LT",DOT_POS_LT); +("vector_norm",vector_norm); +("FORALL_DIMINDEX_1",FORALL_DIMINDEX_1); +("VECTOR_ONE",VECTOR_ONE); +("FORALL_REAL_ONE",FORALL_REAL_ONE); +("NORM_REAL",NORM_REAL); +("dist",dist); +("DIST_REAL",DIST_REAL); +("CONNECTED_REAL_LEMMA",CONNECTED_REAL_LEMMA); +("SQUARE_BOUND_LEMMA",SQUARE_BOUND_LEMMA); +("SQUARE_CONTINUOUS",SQUARE_CONTINUOUS); +("SQRT_WORKS",SQRT_WORKS); +("SQRT_POS_LE",SQRT_POS_LE); +("SQRT_POW_2",SQRT_POW_2); +("SQRT_MUL",SQRT_MUL); +("SQRT_INV",SQRT_INV); +("SQRT_DIV",SQRT_DIV); +("SQRT_POW2",SQRT_POW2); +("SQRT_MONO_LT",SQRT_MONO_LT); +("SQRT_MONO_LE",SQRT_MONO_LE); +("SQRT_MONO_LT_EQ",SQRT_MONO_LT_EQ); +("SQRT_MONO_LE_EQ",SQRT_MONO_LE_EQ); +("SQRT_INJ",SQRT_INJ); +("SQRT_LT_0",SQRT_LT_0); +("SQRT_EQ_0",SQRT_EQ_0); +("SQRT_POS_LT",SQRT_POS_LT); +("REAL_LE_LSQRT",REAL_LE_LSQRT); +("REAL_LE_RSQRT",REAL_LE_RSQRT); +("REAL_LT_RSQRT",REAL_LT_RSQRT); +("SQRT_EVEN_POW2",SQRT_EVEN_POW2); +("REAL_DIV_SQRT",REAL_DIV_SQRT); +("NORM_0",NORM_0); +("NORM_POS_LE",NORM_POS_LE); +("NORM_NEG",NORM_NEG); +("NORM_SUB",NORM_SUB); +("NORM_MUL",NORM_MUL); +("NORM_EQ_0_DOT",NORM_EQ_0_DOT); +("NORM_EQ_0",NORM_EQ_0); +("NORM_POS_LT",NORM_POS_LT); +("NORM_POW_2",NORM_POW_2); +("NORM_EQ_0_IMP",NORM_EQ_0_IMP); +("NORM_LE_0",NORM_LE_0); +("VECTOR_MUL_EQ_0",VECTOR_MUL_EQ_0); +("VECTOR_MUL_LCANCEL",VECTOR_MUL_LCANCEL); +("VECTOR_MUL_RCANCEL",VECTOR_MUL_RCANCEL); +("VECTOR_MUL_LCANCEL_IMP",VECTOR_MUL_LCANCEL_IMP); +("VECTOR_MUL_RCANCEL_IMP",VECTOR_MUL_RCANCEL_IMP); +("NORM_CAUCHY_SCHWARZ",NORM_CAUCHY_SCHWARZ); +("NORM_CAUCHY_SCHWARZ_ABS",NORM_CAUCHY_SCHWARZ_ABS); +("NORM_TRIANGLE",NORM_TRIANGLE); +("NORM_TRIANGLE_SUB",NORM_TRIANGLE_SUB); +("NORM_TRIANGLE_LE",NORM_TRIANGLE_LE); +("NORM_TRIANGLE_LT",NORM_TRIANGLE_LT); +("COMPONENT_LE_NORM",COMPONENT_LE_NORM); +("NORM_BOUND_COMPONENT_LE",NORM_BOUND_COMPONENT_LE); +("NORM_BOUND_COMPONENT_LT",NORM_BOUND_COMPONENT_LT); +("NORM_LE_L1",NORM_LE_L1); +("REAL_ABS_NORM",REAL_ABS_NORM); +("REAL_ABS_SUB_NORM",REAL_ABS_SUB_NORM); +("NORM_LE",NORM_LE); +("NORM_LT",NORM_LT); +("NORM_EQ",NORM_EQ); +("NORM_EQ_1",NORM_EQ_1); +("DOT_SQUARE_NORM",DOT_SQUARE_NORM); +("NORM_EQ_SQUARE",NORM_EQ_SQUARE); +("NORM_LE_SQUARE",NORM_LE_SQUARE); +("NORM_GE_SQUARE",NORM_GE_SQUARE); +("NORM_LT_SQUARE",NORM_LT_SQUARE); +("NORM_GT_SQUARE",NORM_GT_SQUARE); +("DOT_NORM",DOT_NORM); +("DOT_NORM_NEG",DOT_NORM_NEG); +("VECTOR_EQ",VECTOR_EQ); +("DIST_REFL",DIST_REFL); +("DIST_SYM",DIST_SYM); +("DIST_POS_LE",DIST_POS_LE); +("DIST_TRIANGLE",DIST_TRIANGLE); +("DIST_TRIANGLE_ALT",DIST_TRIANGLE_ALT); +("DIST_EQ_0",DIST_EQ_0); +("DIST_POS_LT",DIST_POS_LT); +("DIST_NZ",DIST_NZ); +("DIST_TRIANGLE_LE",DIST_TRIANGLE_LE); +("DIST_TRIANGLE_LT",DIST_TRIANGLE_LT); +("DIST_TRIANGLE_HALF_L",DIST_TRIANGLE_HALF_L); +("DIST_TRIANGLE_HALF_R",DIST_TRIANGLE_HALF_R); +("DIST_TRIANGLE_ADD",DIST_TRIANGLE_ADD); +("DIST_MUL",DIST_MUL); +("DIST_TRIANGLE_ADD_HALF",DIST_TRIANGLE_ADD_HALF); +("DIST_LE_0",DIST_LE_0); +("NEUTRAL_VECTOR_ADD",NEUTRAL_VECTOR_ADD); +("MONOIDAL_VECTOR_ADD",MONOIDAL_VECTOR_ADD); +("vsum",vsum); +("VSUM_CLAUSES",VSUM_CLAUSES); +("VSUM",VSUM); +("VSUM_EQ_0",VSUM_EQ_0); +("VSUM_0",VSUM_0); +("VSUM_LMUL",VSUM_LMUL); +("VSUM_RMUL",VSUM_RMUL); +("VSUM_ADD",VSUM_ADD); +("VSUM_SUB",VSUM_SUB); +("VSUM_CONST",VSUM_CONST); +("VSUM_COMPONENT",VSUM_COMPONENT); +("VSUM_IMAGE",VSUM_IMAGE); +("VSUM_UNION",VSUM_UNION); +("VSUM_DIFF",VSUM_DIFF); +("VSUM_DELETE",VSUM_DELETE); +("VSUM_INCL_EXCL",VSUM_INCL_EXCL); +("VSUM_NEG",VSUM_NEG); +("VSUM_EQ",VSUM_EQ); +("VSUM_SUPERSET",VSUM_SUPERSET); +("VSUM_UNION_RZERO",VSUM_UNION_RZERO); +("VSUM_UNION_LZERO",VSUM_UNION_LZERO); +("VSUM_RESTRICT",VSUM_RESTRICT); +("VSUM_RESTRICT_SET",VSUM_RESTRICT_SET); +("VSUM_CASES",VSUM_CASES); +("VSUM_SING",VSUM_SING); +("VSUM_NORM",VSUM_NORM); +("VSUM_NORM_LE",VSUM_NORM_LE); +("VSUM_NORM_BOUND",VSUM_NORM_BOUND); +("VSUM_CLAUSES_NUMSEG",VSUM_CLAUSES_NUMSEG); +("VSUM_CLAUSES_RIGHT",VSUM_CLAUSES_RIGHT); +("VSUM_CMUL_NUMSEG",VSUM_CMUL_NUMSEG); +("VSUM_EQ_NUMSEG",VSUM_EQ_NUMSEG); +("VSUM_IMAGE_GEN",VSUM_IMAGE_GEN); +("VSUM_GROUP",VSUM_GROUP); +("VSUM_VMUL",VSUM_VMUL); +("VSUM_DELTA",VSUM_DELTA); +("VSUM_ADD_NUMSEG",VSUM_ADD_NUMSEG); +("VSUM_ADD_SPLIT",VSUM_ADD_SPLIT); +("VSUM_VSUM_PRODUCT",VSUM_VSUM_PRODUCT); +("VSUM_IMAGE_NONZERO",VSUM_IMAGE_NONZERO); +("VSUM_UNION_NONZERO",VSUM_UNION_NONZERO); +("VSUM_UNIONS_NONZERO",VSUM_UNIONS_NONZERO); +("VSUM_CLAUSES_LEFT",VSUM_CLAUSES_LEFT); +("VSUM_DIFFS",VSUM_DIFFS); +("VSUM_DELETE_CASES",VSUM_DELETE_CASES); +("VSUM_EQ_GENERAL",VSUM_EQ_GENERAL); +("VSUM_EQ_GENERAL_INVERSES",VSUM_EQ_GENERAL_INVERSES); +("VSUM_NORM_ALLSUBSETS_BOUND",VSUM_NORM_ALLSUBSETS_BOUND); +("DOT_LSUM",DOT_LSUM); +("DOT_RSUM",DOT_RSUM); +("VSUM_OFFSET",VSUM_OFFSET); +("VSUM_OFFSET_0",VSUM_OFFSET_0); +("VSUM_TRIV_NUMSEG",VSUM_TRIV_NUMSEG); +("VSUM_CONST_NUMSEG",VSUM_CONST_NUMSEG); +("VSUM_SUC",VSUM_SUC); +("basis",basis); +("NORM_BASIS",NORM_BASIS); +("NORM_BASIS_1",NORM_BASIS_1); +("VECTOR_CHOOSE_SIZE",VECTOR_CHOOSE_SIZE); +("VECTOR_CHOOSE_DIST",VECTOR_CHOOSE_DIST); +("BASIS_INJ",BASIS_INJ); +("BASIS_COMPONENT",BASIS_COMPONENT); +("BASIS_EXPANSION",BASIS_EXPANSION); +("BASIS_EXPANSION_UNIQUE",BASIS_EXPANSION_UNIQUE); +("DOT_BASIS",DOT_BASIS); +("BASIS_EQ_0",BASIS_EQ_0); +("BASIS_NONZERO",BASIS_NONZERO); +("VECTOR_EQ_LDOT",VECTOR_EQ_LDOT); +("VECTOR_EQ_RDOT",VECTOR_EQ_RDOT); +("orthogonal",orthogonal); +("ORTHOGONAL_BASIS",ORTHOGONAL_BASIS); +("ORTHOGONAL_BASIS_BASIS",ORTHOGONAL_BASIS_BASIS); +("ORTHOGONAL_CLAUSES",ORTHOGONAL_CLAUSES); +("ORTHOGONAL_SYM",ORTHOGONAL_SYM); +("vector",vector); +("VECTOR_1",VECTOR_1); +("VECTOR_2",VECTOR_2); +("VECTOR_3",VECTOR_3); +("FORALL_VECTOR_1",FORALL_VECTOR_1); +("FORALL_VECTOR_2",FORALL_VECTOR_2); +("FORALL_VECTOR_3",FORALL_VECTOR_3); +("linear",linear); +("LINEAR_COMPOSE_CMUL",LINEAR_COMPOSE_CMUL); +("LINEAR_COMPOSE_NEG",LINEAR_COMPOSE_NEG); +("LINEAR_COMPOSE_ADD",LINEAR_COMPOSE_ADD); +("LINEAR_COMPOSE_SUB",LINEAR_COMPOSE_SUB); +("LINEAR_COMPOSE",LINEAR_COMPOSE); +("LINEAR_ID",LINEAR_ID); +("LINEAR_ZERO",LINEAR_ZERO); +("LINEAR_COMPOSE_VSUM",LINEAR_COMPOSE_VSUM); +("LINEAR_VMUL_COMPONENT",LINEAR_VMUL_COMPONENT); +("LINEAR_0",LINEAR_0); +("LINEAR_CMUL",LINEAR_CMUL); +("LINEAR_NEG",LINEAR_NEG); +("LINEAR_ADD",LINEAR_ADD); +("LINEAR_SUB",LINEAR_SUB); +("LINEAR_VSUM",LINEAR_VSUM); +("LINEAR_VSUM_MUL",LINEAR_VSUM_MUL); +("LINEAR_INJECTIVE_0",LINEAR_INJECTIVE_0); +("LINEAR_BOUNDED",LINEAR_BOUNDED); +("LINEAR_BOUNDED_POS",LINEAR_BOUNDED_POS); +("bilinear",bilinear); +("BILINEAR_LADD",BILINEAR_LADD); +("BILINEAR_RADD",BILINEAR_RADD); +("BILINEAR_LMUL",BILINEAR_LMUL); +("BILINEAR_RMUL",BILINEAR_RMUL); +("BILINEAR_LNEG",BILINEAR_LNEG); +("BILINEAR_RNEG",BILINEAR_RNEG); +("BILINEAR_LZERO",BILINEAR_LZERO); +("BILINEAR_RZERO",BILINEAR_RZERO); +("BILINEAR_LSUB",BILINEAR_LSUB); +("BILINEAR_RSUB",BILINEAR_RSUB); +("BILINEAR_VSUM",BILINEAR_VSUM); +("BILINEAR_BOUNDED",BILINEAR_BOUNDED); +("BILINEAR_BOUNDED_POS",BILINEAR_BOUNDED_POS); +("adjoint",adjoint); +("ADJOINT_WORKS",ADJOINT_WORKS); +("ADJOINT_LINEAR",ADJOINT_LINEAR); +("ADJOINT_CLAUSES",ADJOINT_CLAUSES); +("ADJOINT_ADJOINT",ADJOINT_ADJOINT); +("ADJOINT_UNIQUE",ADJOINT_UNIQUE); +("matrix_neg",matrix_neg); +("matrix_add",matrix_add); +("matrix_sub",matrix_sub); +("matrix_mul",matrix_mul); +("matrix_vector_mul",matrix_vector_mul); +("vector_matrix_mul",vector_matrix_mul); +("mat",mat); +("transp",transp); +("row",row); +("column",column); +("rows",rows); +("columns",columns); +("MATRIX_ADD_SYM",MATRIX_ADD_SYM); +("MATRIX_ADD_ASSOC",MATRIX_ADD_ASSOC); +("MATRIX_ADD_LID",MATRIX_ADD_LID); +("MATRIX_ADD_RID",MATRIX_ADD_RID); +("MATRIX_ADD_LNEG",MATRIX_ADD_LNEG); +("MATRIX_ADD_RNEG",MATRIX_ADD_RNEG); +("MATRIX_SUB",MATRIX_SUB); +("MATRIX_SUB_REFL",MATRIX_SUB_REFL); +("MATRIX_ADD_LDISTRIB",MATRIX_ADD_LDISTRIB); +("MATRIX_MUL_LID",MATRIX_MUL_LID); +("MATRIX_MUL_RID",MATRIX_MUL_RID); +("MATRIX_MUL_ASSOC",MATRIX_MUL_ASSOC); +("MATRIX_VECTOR_MUL_ASSOC",MATRIX_VECTOR_MUL_ASSOC); +("MATRIX_VECTOR_MUL_LID",MATRIX_VECTOR_MUL_LID); +("MATRIX_TRANSP_MUL",MATRIX_TRANSP_MUL); +("MATRIX_EQ",MATRIX_EQ); +("MATRIX_VECTOR_MUL_COMPONENT",MATRIX_VECTOR_MUL_COMPONENT); +("DOT_LMUL_MATRIX",DOT_LMUL_MATRIX); +("TRANSP_MAT",TRANSP_MAT); +("TRANSP_TRANSP",TRANSP_TRANSP); +("ROW_TRANSP",ROW_TRANSP); +("COLUMN_TRANSP",COLUMN_TRANSP); +("ROWS_TRANSP",ROWS_TRANSP); +("COLUMNS_TRANSP",COLUMNS_TRANSP); +("MATRIX_MUL_DOT",MATRIX_MUL_DOT); +("MATRIX_MUL_VSUM",MATRIX_MUL_VSUM); +("VECTOR_COMPONENTWISE",VECTOR_COMPONENTWISE); +("LINEAR_COMPONENTWISE",LINEAR_COMPONENTWISE); +("invertible",invertible); +("matrix_inv",matrix_inv); +("matrix",matrix); +("MATRIX_VECTOR_MUL_LINEAR",MATRIX_VECTOR_MUL_LINEAR); +("MATRIX_WORKS",MATRIX_WORKS); +("MATRIX_VECTOR_MUL",MATRIX_VECTOR_MUL); +("MATRIX_OF_MATRIX_VECTOR_MUL",MATRIX_OF_MATRIX_VECTOR_MUL); +("MATRIX_COMPOSE",MATRIX_COMPOSE); +("MATRIX_VECTOR_COLUMN",MATRIX_VECTOR_COLUMN); +("ADJOINT_MATRIX",ADJOINT_MATRIX); +("MATRIX_ADJOINT",MATRIX_ADJOINT); +("onorm",onorm); +("NORM_BOUND_GENERALIZE",NORM_BOUND_GENERALIZE); +("ONORM",ONORM); +("ONORM_POS_LE",ONORM_POS_LE); +("ONORM_EQ_0",ONORM_EQ_0); +("ONORM_CONST",ONORM_CONST); +("ONORM_POS_LT",ONORM_POS_LT); +("ONORM_COMPOSE",ONORM_COMPOSE); +("ONORM_NEG_LEMMA",ONORM_NEG_LEMMA); +("ONORM_NEG",ONORM_NEG); +("ONORM_TRIANGLE",ONORM_TRIANGLE); +("ONORM_TRIANGLE_LE",ONORM_TRIANGLE_LE); +("ONORM_TRIANGLE_LT",ONORM_TRIANGLE_LT); +("lift",lift); +("drop",drop); +("LIFT_COMPONENT",LIFT_COMPONENT); +("LIFT_DROP",LIFT_DROP); +("FORALL_LIFT",FORALL_LIFT); +("EXISTS_LIFT",EXISTS_LIFT); +("FORALL_DROP",FORALL_DROP); +("EXISTS_DROP",EXISTS_DROP); +("LIFT_EQ",LIFT_EQ); +("DROP_EQ",DROP_EQ); +("LIFT_IN_IMAGE_LIFT",LIFT_IN_IMAGE_LIFT); +("LIFT_NUM",LIFT_NUM); +("LIFT_ADD",LIFT_ADD); +("LIFT_SUB",LIFT_SUB); +("LIFT_CMUL",LIFT_CMUL); +("LIFT_NEG",LIFT_NEG); +("LIFT_EQ_CMUL",LIFT_EQ_CMUL); +("LIFT_SUM",LIFT_SUM); +("DROP_LAMBDA",DROP_LAMBDA); +("DROP_VEC",DROP_VEC); +("DROP_ADD",DROP_ADD); +("DROP_SUB",DROP_SUB); +("DROP_CMUL",DROP_CMUL); +("DROP_NEG",DROP_NEG); +("DROP_VSUM",DROP_VSUM); +("NORM_LIFT",NORM_LIFT); +("DIST_LIFT",DIST_LIFT); +("ABS_DROP",ABS_DROP); +("LINEAR_VMUL_DROP",LINEAR_VMUL_DROP); +("LINEAR_FROM_REALS",LINEAR_FROM_REALS); +("LINEAR_TO_REALS",LINEAR_TO_REALS); +("DROP_EQ_0",DROP_EQ_0); +("VSUM_REAL",VSUM_REAL); +("DROP_WLOG_LE",DROP_WLOG_LE); +("LINEAR_FSTCART",LINEAR_FSTCART); +("LINEAR_SNDCART",LINEAR_SNDCART); +("FSTCART_VEC",FSTCART_VEC); +("FSTCART_ADD",FSTCART_ADD); +("FSTCART_CMUL",FSTCART_CMUL); +("FSTCART_NEG",FSTCART_NEG); +("FSTCART_SUB",FSTCART_SUB); +("FSTCART_VSUM",FSTCART_VSUM); +("SNDCART_VEC",SNDCART_VEC); +("SNDCART_ADD",SNDCART_ADD); +("SNDCART_CMUL",SNDCART_CMUL); +("SNDCART_NEG",SNDCART_NEG); +("SNDCART_SUB",SNDCART_SUB); +("SNDCART_VSUM",SNDCART_VSUM); +("PASTECART_VEC",PASTECART_VEC); +("PASTECART_ADD",PASTECART_ADD); +("PASTECART_CMUL",PASTECART_CMUL); +("PASTECART_NEG",PASTECART_NEG); +("PASTECART_SUB",PASTECART_SUB); +("PASTECART_VSUM",PASTECART_VSUM); +("NORM_FSTCART",NORM_FSTCART); +("DIST_FSTCART",DIST_FSTCART); +("NORM_SNDCART",NORM_SNDCART); +("DIST_SNDCART",DIST_SNDCART); +("DOT_PASTECART",DOT_PASTECART); +("NORM_PASTECART",NORM_PASTECART); +("subspace",subspace); +("span",span); +("dependent",dependent); +("independent",independent); +("SUBSPACE_UNIV",SUBSPACE_UNIV); +("SUBSPACE_0",SUBSPACE_0); +("SUBSPACE_ADD",SUBSPACE_ADD); +("SUBSPACE_MUL",SUBSPACE_MUL); +("SUBSPACE_NEG",SUBSPACE_NEG); +("SUBSPACE_SUB",SUBSPACE_SUB); +("SUBSPACE_VSUM",SUBSPACE_VSUM); +("SUBSPACE_LINEAR_IMAGE",SUBSPACE_LINEAR_IMAGE); +("SUBSPACE_LINEAR_PREIMAGE",SUBSPACE_LINEAR_PREIMAGE); +("SUBSPACE_TRIVIAL",SUBSPACE_TRIVIAL); +("SUBSPACE_INTER",SUBSPACE_INTER); +("SPAN_SPAN",SPAN_SPAN); +("SPAN_MONO",SPAN_MONO); +("SUBSPACE_SPAN",SUBSPACE_SPAN); +("SPAN_CLAUSES",SPAN_CLAUSES); +("SPAN_INDUCT",SPAN_INDUCT); +("SPAN_EMPTY",SPAN_EMPTY); +("INDEPENDENT_EMPTY",INDEPENDENT_EMPTY); +("INDEPENDENT_MONO",INDEPENDENT_MONO); +("SPAN_SUBSPACE",SPAN_SUBSPACE); +("SPAN_INDUCT_ALT",SPAN_INDUCT_ALT); +("SPAN_SUPERSET",SPAN_SUPERSET); +("SPAN_INC",SPAN_INC); +("SPAN_0",SPAN_0); +("SPAN_ADD",SPAN_ADD); +("SPAN_MUL",SPAN_MUL); +("SPAN_NEG",SPAN_NEG); +("SPAN_SUB",SPAN_SUB); +("SPAN_VSUM",SPAN_VSUM); +("SPAN_ADD_EQ",SPAN_ADD_EQ); +("SPAN_LINEAR_IMAGE",SPAN_LINEAR_IMAGE); +("SPAN_BREAKDOWN",SPAN_BREAKDOWN); +("SPAN_BREAKDOWN_EQ",SPAN_BREAKDOWN_EQ); +("IN_SPAN_INSERT",IN_SPAN_INSERT); +("IN_SPAN_DELETE",IN_SPAN_DELETE); +("SPAN_TRANS",SPAN_TRANS); +("SPAN_EXPLICIT",SPAN_EXPLICIT); +("DEPENDENT_EXPLICIT",DEPENDENT_EXPLICIT); +("SPAN_FINITE",SPAN_FINITE); +("SPAN_STDBASIS",SPAN_STDBASIS); +("HAS_SIZE_STDBASIS",HAS_SIZE_STDBASIS); +("FINITE_STDBASIS",FINITE_STDBASIS); +("CARD_STDBASIS",CARD_STDBASIS); +("INDEPENDENT_STDBASIS_LEMMA",INDEPENDENT_STDBASIS_LEMMA); +("INDEPENDENT_STDBASIS",INDEPENDENT_STDBASIS); +("INDEPENDENT_INSERT",INDEPENDENT_INSERT); +("SPANNING_SUBSET_INDEPENDENT",SPANNING_SUBSET_INDEPENDENT); +("EXCHANGE_LEMMA",EXCHANGE_LEMMA); +("INDEPENDENT_SPAN_BOUND",INDEPENDENT_SPAN_BOUND); +("INDEPENDENT_BOUND",INDEPENDENT_BOUND); +("DEPENDENT_BIGGERSET",DEPENDENT_BIGGERSET); +("MAXIMAL_INDEPENDENT_SUBSET_EXTEND",MAXIMAL_INDEPENDENT_SUBSET_EXTEND); +("MAXIMAL_INDEPENDENT_SUBSET",MAXIMAL_INDEPENDENT_SUBSET); +("dim",dim); +("BASIS_EXISTS",BASIS_EXISTS); +("INDEPENDENT_CARD_LE_DIM",INDEPENDENT_CARD_LE_DIM); +("SPAN_CARD_GE_DIM",SPAN_CARD_GE_DIM); +("BASIS_CARD_EQ_DIM",BASIS_CARD_EQ_DIM); +("DIM_UNIQUE",DIM_UNIQUE); +("DIM_UNIV",DIM_UNIV); +("DIM_SUBSET",DIM_SUBSET); +("DIM_SUBSET_UNIV",DIM_SUBSET_UNIV); +("CARD_GE_DIM_INDEPENDENT",CARD_GE_DIM_INDEPENDENT); +("CARD_LE_DIM_SPANNING",CARD_LE_DIM_SPANNING); +("CARD_EQ_DIM",CARD_EQ_DIM); +("INDEPENDENT_BOUND_GENERAL",INDEPENDENT_BOUND_GENERAL); +("DEPENDENT_BIGGERSET_GENERAL",DEPENDENT_BIGGERSET_GENERAL); +("DIM_SPAN",DIM_SPAN); +("SUBSET_LE_DIM",SUBSET_LE_DIM); +("SPAN_EQ_DIM",SPAN_EQ_DIM); +("SPANS_IMAGE",SPANS_IMAGE); +("DIM_IMAGE_LE",DIM_IMAGE_LE); +("SPANNING_SURJECTIVE_IMAGE",SPANNING_SURJECTIVE_IMAGE); +("INDEPENDENT_INJECTIVE_IMAGE",INDEPENDENT_INJECTIVE_IMAGE); +("VECTOR_SUB_PROJECT_ORTHOGONAL",VECTOR_SUB_PROJECT_ORTHOGONAL); +("BASIS_ORTHOGONAL",BASIS_ORTHOGONAL); +("ORTHOGONAL_BASIS_EXISTS",ORTHOGONAL_BASIS_EXISTS); +("SPAN_EQ",SPAN_EQ); +("SPAN_NOT_UNIV_ORTHOGONAL",SPAN_NOT_UNIV_ORTHOGONAL); +("SPAN_NOT_UNIV_SUBSET_HYPERPLANE",SPAN_NOT_UNIV_SUBSET_HYPERPLANE); +("LOWDIM_SUBSET_HYPERPLANE",LOWDIM_SUBSET_HYPERPLANE); +("LINEAR_INDEP_IMAGE_LEMMA",LINEAR_INDEP_IMAGE_LEMMA); +("LINEAR_INDEPENDENT_EXTEND_LEMMA",LINEAR_INDEPENDENT_EXTEND_LEMMA); +("LINEAR_INDEPENDENT_EXTEND",LINEAR_INDEPENDENT_EXTEND); +("SUBSPACE_ISOMORPHISM",SUBSPACE_ISOMORPHISM); +("SUBSPACE_KERNEL",SUBSPACE_KERNEL); +("LINEAR_EQ_0_SPAN",LINEAR_EQ_0_SPAN); +("LINEAR_EQ_0",LINEAR_EQ_0); +("LINEAR_EQ",LINEAR_EQ); +("LINEAR_EQ_STDBASIS",LINEAR_EQ_STDBASIS); +("BILINEAR_EQ",BILINEAR_EQ); +("BILINEAR_EQ_STDBASIS",BILINEAR_EQ_STDBASIS); +("LEFT_INVERTIBLE_TRANSP",LEFT_INVERTIBLE_TRANSP); +("RIGHT_INVERTIBLE_TRANSP",RIGHT_INVERTIBLE_TRANSP); +("LINEAR_INJECTIVE_LEFT_INVERSE",LINEAR_INJECTIVE_LEFT_INVERSE); +("LINEAR_SURJECTIVE_RIGHT_INVERSE",LINEAR_SURJECTIVE_RIGHT_INVERSE); +("MATRIX_LEFT_INVERTIBLE_INJECTIVE",MATRIX_LEFT_INVERTIBLE_INJECTIVE); +("MATRIX_LEFT_INVERTIBLE_KER",MATRIX_LEFT_INVERTIBLE_KER); +("MATRIX_RIGHT_INVERTIBLE_SURJECTIVE",MATRIX_RIGHT_INVERTIBLE_SURJECTIVE); +("MATRIX_LEFT_INVERTIBLE_INDEPENDENT_COLUMNS",MATRIX_LEFT_INVERTIBLE_INDEPENDENT_COLUMNS); +("MATRIX_RIGHT_INVERTIBLE_INDEPENDENT_ROWS",MATRIX_RIGHT_INVERTIBLE_INDEPENDENT_ROWS); +("MATRIX_RIGHT_INVERTIBLE_SPAN_COLUMNS",MATRIX_RIGHT_INVERTIBLE_SPAN_COLUMNS); +("MATRIX_LEFT_INVERTIBLE_SPAN_ROWS",MATRIX_LEFT_INVERTIBLE_SPAN_ROWS); +("LINEAR_INJECTIVE_IMP_SURJECTIVE",LINEAR_INJECTIVE_IMP_SURJECTIVE); +("LINEAR_SURJECTIVE_IMP_INJECTIVE",LINEAR_SURJECTIVE_IMP_INJECTIVE); +("LEFT_RIGHT_INVERSE_EQ",LEFT_RIGHT_INVERSE_EQ); +("ISOMORPHISM_EXPAND",ISOMORPHISM_EXPAND); +("LINEAR_INJECTIVE_ISOMORPHISM",LINEAR_INJECTIVE_ISOMORPHISM); +("LINEAR_SURJECTIVE_ISOMORPHISM",LINEAR_SURJECTIVE_ISOMORPHISM); +("LINEAR_INVERSE_LEFT",LINEAR_INVERSE_LEFT); +("LEFT_INVERSE_LINEAR",LEFT_INVERSE_LINEAR); +("RIGHT_INVERSE_LINEAR",RIGHT_INVERSE_LINEAR); +("MATRIX_LEFT_RIGHT_INVERSE",MATRIX_LEFT_RIGHT_INVERSE); +("rowvector",rowvector); +("columnvector",columnvector); +("TRANSP_COLUMNVECTOR",TRANSP_COLUMNVECTOR); +("TRANSP_ROWVECTOR",TRANSP_ROWVECTOR); +("DOT_ROWVECTOR_COLUMNVECTOR",DOT_ROWVECTOR_COLUMNVECTOR); +("DOT_MATRIX_PRODUCT",DOT_MATRIX_PRODUCT); +("DOT_MATRIX_VECTOR_MUL",DOT_MATRIX_VECTOR_MUL); +("infnorm",infnorm); +("NUMSEG_DIMINDEX_NONEMPTY",NUMSEG_DIMINDEX_NONEMPTY); +("INFNORM_SET_IMAGE",INFNORM_SET_IMAGE); +("INFNORM_SET_LEMMA",INFNORM_SET_LEMMA); +("INFNORM_POS_LE",INFNORM_POS_LE); +("INFNORM_TRIANGLE",INFNORM_TRIANGLE); +("INFNORM_EQ_0",INFNORM_EQ_0); +("INFNORM_0",INFNORM_0); +("INFNORM_NEG",INFNORM_NEG); +("INFNORM_SUB",INFNORM_SUB); +("REAL_ABS_SUB_INFNORM",REAL_ABS_SUB_INFNORM); +("REAL_ABS_INFNORM",REAL_ABS_INFNORM); +("COMPONENT_LE_INFNORM",COMPONENT_LE_INFNORM); +("INFNORM_MUL_LEMMA",INFNORM_MUL_LEMMA); +("INFNORM_MUL",INFNORM_MUL); +("INFNORM_POS_LT",INFNORM_POS_LT); +("INFNORM_LE_NORM",INFNORM_LE_NORM); +("NORM_LE_INFNORM",NORM_LE_INFNORM); +("NORM_CAUCHY_SCHWARZ_EQ",NORM_CAUCHY_SCHWARZ_EQ); +("NORM_CAUCHY_SCHWARZ_ABS_EQ",NORM_CAUCHY_SCHWARZ_ABS_EQ); +("NORM_TRIANGLE_EQ",NORM_TRIANGLE_EQ); +("collinear",collinear); +("COLLINEAR_EMPTY",COLLINEAR_EMPTY); +("COLLINEAR_SING",COLLINEAR_SING); +("COLLINEAR_2",COLLINEAR_2); +("COLLINEAR_LEMMA",COLLINEAR_LEMMA); +("NORM_CAUCHY_SCHWARZ_EQUAL",NORM_CAUCHY_SCHWARZ_EQUAL); +("F_IMP",F_IMP); +("LEFT_AND_OVER_OR",LEFT_AND_OVER_OR); +("RIGHT_AND_OVER_OR",RIGHT_AND_OVER_OR); +("LESS_EQUAL_ANTISYM",LESS_EQUAL_ANTISYM); +("NOT_LESS_0",NOT_LESS_0); +("LESS_LEMMA1",LESS_LEMMA1); +("LESS_SUC_REFL",LESS_SUC_REFL); +("LESS_EQ_SUC_REFL",LESS_EQ_SUC_REFL); +("LESS_EQUAL_ADD",LESS_EQUAL_ADD); +("LESS_EQ_IMP_LESS_SUC",LESS_EQ_IMP_LESS_SUC); +("LESS_MONO_ADD",LESS_MONO_ADD); +("LESS_SUC",LESS_SUC); +("LESS_ADD_1",LESS_ADD_1); +("SUC_SUB1",SUC_SUB1); +("LESS_ADD_SUC",LESS_ADD_SUC); +("OR_LESS",OR_LESS); +("NOT_SUC_LESS_EQ",NOT_SUC_LESS_EQ); +("LESS_LESS_CASES",LESS_LESS_CASES); +("SUB_SUB",SUB_SUB); +("LESS_CASES_IMP",LESS_CASES_IMP); +("SUB_LESS_EQ",SUB_LESS_EQ); +("SUB_EQ_EQ_0",SUB_EQ_EQ_0); +("SUB_LEFT_LESS_EQ",SUB_LEFT_LESS_EQ); +("SUB_LEFT_GREATER_EQ",SUB_LEFT_GREATER_EQ); +("LESS_0_CASES",LESS_0_CASES); +("LESS_OR",LESS_OR); +("SUB_OLD",SUB_OLD); +("real_le",real_le); +("REAL_10",REAL_10); +("REAL_LDISTRIB",REAL_LDISTRIB); +("REAL_LT_IADD",REAL_LT_IADD); +("REAL_MUL_RID",REAL_MUL_RID); +("REAL_MUL_RINV",REAL_MUL_RINV); +("REAL_RDISTRIB",REAL_RDISTRIB); +("REAL_EQ_LADD",REAL_EQ_LADD); +("REAL_EQ_RADD",REAL_EQ_RADD); +("REAL_ADD_LID_UNIQ",REAL_ADD_LID_UNIQ); +("REAL_ADD_RID_UNIQ",REAL_ADD_RID_UNIQ); +("REAL_LNEG_UNIQ",REAL_LNEG_UNIQ); +("REAL_RNEG_UNIQ",REAL_RNEG_UNIQ); +("REAL_NEG_ADD",REAL_NEG_ADD); +("REAL_MUL_LZERO",REAL_MUL_LZERO); +("REAL_MUL_RZERO",REAL_MUL_RZERO); +("REAL_NEG_LMUL",REAL_NEG_LMUL); +("REAL_NEG_RMUL",REAL_NEG_RMUL); +("REAL_NEGNEG",REAL_NEGNEG); +("REAL_NEG_MUL2",REAL_NEG_MUL2); +("REAL_LT_LADD",REAL_LT_LADD); +("REAL_LT_RADD",REAL_LT_RADD); +("REAL_NOT_LT",REAL_NOT_LT); +("REAL_LT_ANTISYM",REAL_LT_ANTISYM); +("REAL_LT_GT",REAL_LT_GT); +("REAL_NOT_LE",REAL_NOT_LE); +("REAL_LE_TOTAL",REAL_LE_TOTAL); +("REAL_LE_REFL",REAL_LE_REFL); +("REAL_LE_LT",REAL_LE_LT); +("REAL_LT_LE",REAL_LT_LE); +("REAL_LT_IMP_LE",REAL_LT_IMP_LE); +("REAL_LTE_TRANS",REAL_LTE_TRANS); +("REAL_LE_TRANS",REAL_LE_TRANS); +("REAL_NEG_LT0",REAL_NEG_LT0); +("REAL_NEG_GT0",REAL_NEG_GT0); +("REAL_NEG_LE0",REAL_NEG_LE0); +("REAL_NEG_GE0",REAL_NEG_GE0); +("REAL_LT_NEGTOTAL",REAL_LT_NEGTOTAL); +("REAL_LE_NEGTOTAL",REAL_LE_NEGTOTAL); +("REAL_LE_MUL",REAL_LE_MUL); +("REAL_LE_SQUARE",REAL_LE_SQUARE); +("REAL_LT_01",REAL_LT_01); +("REAL_LE_LADD",REAL_LE_LADD); +("REAL_LE_RADD",REAL_LE_RADD); +("REAL_LT_ADD2",REAL_LT_ADD2); +("REAL_LT_ADD",REAL_LT_ADD); +("REAL_LT_ADDNEG",REAL_LT_ADDNEG); +("REAL_LT_ADDNEG2",REAL_LT_ADDNEG2); +("REAL_LT_ADD1",REAL_LT_ADD1); +("REAL_SUB_ADD",REAL_SUB_ADD); +("REAL_SUB_ADD2",REAL_SUB_ADD2); +("REAL_SUB_REFL",REAL_SUB_REFL); +("REAL_SUB_0",REAL_SUB_0); +("REAL_LE_DOUBLE",REAL_LE_DOUBLE); +("REAL_LE_NEGL",REAL_LE_NEGL); +("REAL_LE_NEGR",REAL_LE_NEGR); +("REAL_NEG_EQ0",REAL_NEG_EQ0); +("REAL_NEG_0",REAL_NEG_0); +("REAL_NEG_SUB",REAL_NEG_SUB); +("REAL_SUB_LT",REAL_SUB_LT); +("REAL_SUB_LE",REAL_SUB_LE); +("REAL_EQ_LMUL",REAL_EQ_LMUL); +("REAL_EQ_RMUL",REAL_EQ_RMUL); +("REAL_SUB_LDISTRIB",REAL_SUB_LDISTRIB); +("REAL_SUB_RDISTRIB",REAL_SUB_RDISTRIB); +("REAL_NEG_EQ",REAL_NEG_EQ); +("REAL_NEG_MINUS1",REAL_NEG_MINUS1); +("REAL_INV_NZ",REAL_INV_NZ); +("REAL_INVINV",REAL_INVINV); +("REAL_LT_IMP_NE",REAL_LT_IMP_NE); +("REAL_INV_POS",REAL_INV_POS); +("REAL_LT_LMUL_0",REAL_LT_LMUL_0); +("REAL_LT_RMUL_0",REAL_LT_RMUL_0); +("REAL_LT_LMUL_EQ",REAL_LT_LMUL_EQ); +("REAL_LT_RMUL_EQ",REAL_LT_RMUL_EQ); +("REAL_LT_RMUL_IMP",REAL_LT_RMUL_IMP); +("REAL_LT_LMUL_IMP",REAL_LT_LMUL_IMP); +("REAL_LINV_UNIQ",REAL_LINV_UNIQ); +("REAL_RINV_UNIQ",REAL_RINV_UNIQ); +("REAL_NEG_INV",REAL_NEG_INV); +("REAL_INV_1OVER",REAL_INV_1OVER); +("REAL",REAL); +("REAL_POS",REAL_POS); +("REAL_LE",REAL_LE); +("REAL_LT",REAL_LT); +("REAL_INJ",REAL_INJ); +("REAL_ADD",REAL_ADD); +("REAL_MUL",REAL_MUL); +("REAL_INV1",REAL_INV1); +("REAL_DIV_LZERO",REAL_DIV_LZERO); +("REAL_LT_NZ",REAL_LT_NZ); +("REAL_NZ_IMP_LT",REAL_NZ_IMP_LT); +("REAL_LT_RDIV_0",REAL_LT_RDIV_0); +("REAL_LT_RDIV",REAL_LT_RDIV); +("REAL_LT_FRACTION_0",REAL_LT_FRACTION_0); +("REAL_LT_MULTIPLE",REAL_LT_MULTIPLE); +("REAL_LT_FRACTION",REAL_LT_FRACTION); +("REAL_LT_HALF1",REAL_LT_HALF1); +("REAL_LT_HALF2",REAL_LT_HALF2); +("REAL_DOUBLE",REAL_DOUBLE); +("REAL_HALF_DOUBLE",REAL_HALF_DOUBLE); +("REAL_SUB_SUB",REAL_SUB_SUB); +("REAL_LT_ADD_SUB",REAL_LT_ADD_SUB); +("REAL_LT_SUB_RADD",REAL_LT_SUB_RADD); +("REAL_LT_SUB_LADD",REAL_LT_SUB_LADD); +("REAL_LE_SUB_LADD",REAL_LE_SUB_LADD); +("REAL_LE_SUB_RADD",REAL_LE_SUB_RADD); +("REAL_LT_NEG",REAL_LT_NEG); +("REAL_LE_NEG",REAL_LE_NEG); +("REAL_SUB_LZERO",REAL_SUB_LZERO); +("REAL_SUB_RZERO",REAL_SUB_RZERO); +("REAL_LTE_ADD2",REAL_LTE_ADD2); +("REAL_LTE_ADD",REAL_LTE_ADD); +("REAL_LT_MUL2_ALT",REAL_LT_MUL2_ALT); +("REAL_SUB_LNEG",REAL_SUB_LNEG); +("REAL_SUB_RNEG",REAL_SUB_RNEG); +("REAL_SUB_NEG2",REAL_SUB_NEG2); +("REAL_SUB_TRIANGLE",REAL_SUB_TRIANGLE); +("REAL_INV_MUL_WEAK",REAL_INV_MUL_WEAK); +("REAL_LE_LMUL_LOCAL",REAL_LE_LMUL_LOCAL); +("REAL_LE_RMUL_EQ",REAL_LE_RMUL_EQ); +("REAL_SUB_INV2",REAL_SUB_INV2); +("REAL_SUB_SUB2",REAL_SUB_SUB2); +("REAL_MEAN",REAL_MEAN); +("REAL_EQ_LMUL2",REAL_EQ_LMUL2); +("REAL_LE_MUL2V",REAL_LE_MUL2V); +("REAL_LE_LDIV",REAL_LE_LDIV); +("REAL_LE_RDIV",REAL_LE_RDIV); +("REAL_LT_1",REAL_LT_1); +("REAL_LE_LMUL_IMP",REAL_LE_LMUL_IMP); +("REAL_LE_RMUL_IMP",REAL_LE_RMUL_IMP); +("REAL_INV_LT1",REAL_INV_LT1); +("REAL_POS_NZ",REAL_POS_NZ); +("REAL_EQ_RMUL_IMP",REAL_EQ_RMUL_IMP); +("REAL_EQ_LMUL_IMP",REAL_EQ_LMUL_IMP); +("REAL_FACT_NZ",REAL_FACT_NZ); +("REAL_POSSQ",REAL_POSSQ); +("REAL_SUMSQ",REAL_SUMSQ); +("REAL_EQ_NEG",REAL_EQ_NEG); +("REAL_DIV_MUL2",REAL_DIV_MUL2); +("REAL_MIDDLE1",REAL_MIDDLE1); +("REAL_MIDDLE2",REAL_MIDDLE2); +("ABS_ZERO",ABS_ZERO); +("ABS_0",ABS_0); +("ABS_1",ABS_1); +("ABS_NEG",ABS_NEG); +("ABS_TRIANGLE",ABS_TRIANGLE); +("ABS_POS",ABS_POS); +("ABS_MUL",ABS_MUL); +("ABS_LT_MUL2",ABS_LT_MUL2); +("ABS_SUB",ABS_SUB); +("ABS_NZ",ABS_NZ); +("ABS_INV",ABS_INV); +("ABS_ABS",ABS_ABS); +("ABS_LE",ABS_LE); +("ABS_REFL",ABS_REFL); +("ABS_N",ABS_N); +("ABS_BETWEEN",ABS_BETWEEN); +("ABS_BOUND",ABS_BOUND); +("ABS_STILLNZ",ABS_STILLNZ); +("ABS_CASES",ABS_CASES); +("ABS_BETWEEN1",ABS_BETWEEN1); +("ABS_SIGN",ABS_SIGN); +("ABS_SIGN2",ABS_SIGN2); +("ABS_DIV",ABS_DIV); +("ABS_CIRCLE",ABS_CIRCLE); +("REAL_SUB_ABS",REAL_SUB_ABS); +("ABS_SUB_ABS",ABS_SUB_ABS); +("ABS_BETWEEN2",ABS_BETWEEN2); +("ABS_BOUNDS",ABS_BOUNDS); +("pow",pow); +("POW_0",POW_0); +("POW_NZ",POW_NZ); +("POW_INV",POW_INV); +("POW_ABS",POW_ABS); +("POW_PLUS1",POW_PLUS1); +("POW_ADD",POW_ADD); +("POW_1",POW_1); +("POW_2",POW_2); +("POW_POS",POW_POS); +("POW_LE",POW_LE); +("POW_M1",POW_M1); +("POW_MUL",POW_MUL); +("REAL_LE_SQUARE_POW",REAL_LE_SQUARE_POW); +("ABS_POW2",ABS_POW2); +("REAL_LE1_POW2",REAL_LE1_POW2); +("REAL_LT1_POW2",REAL_LT1_POW2); +("POW_POS_LT",POW_POS_LT); +("POW_2_LE1",POW_2_LE1); +("POW_2_LT",POW_2_LT); +("POW_MINUS1",POW_MINUS1); +("REAL_SUP_EXISTS",REAL_SUP_EXISTS); +("sup_def",sup_def); +("sup",sup); +("REAL_SUP",REAL_SUP); +("REAL_SUP_UBOUND",REAL_SUP_UBOUND); +("SETOK_LE_LT",SETOK_LE_LT); +("REAL_SUP_LE",REAL_SUP_LE); +("REAL_SUP_UBOUND_LE",REAL_SUP_UBOUND_LE); +("REAL_ARCH_SIMPLE",REAL_ARCH_SIMPLE); +("REAL_ARCH",REAL_ARCH); +("REAL_ARCH_LEAST",REAL_ARCH_LEAST); +("REAL_POW_LBOUND",REAL_POW_LBOUND); +("REAL_ARCH_POW",REAL_ARCH_POW); +("REAL_ARCH_POW2",REAL_ARCH_POW2); +("sum_EXISTS",sum_EXISTS); +("sum_DEF",sum_DEF); +("sum",sum); +("PSUM_SUM",PSUM_SUM); +("PSUM_SUM_NUMSEG",PSUM_SUM_NUMSEG); +("SUM_TWO",SUM_TWO); +("SUM_DIFF",SUM_DIFF); +("ABS_SUM",ABS_SUM); +("SUM_LE",SUM_LE); +("SUM_EQ",SUM_EQ); +("SUM_POS",SUM_POS); +("SUM_POS_GEN",SUM_POS_GEN); +("SUM_ABS",SUM_ABS); +("SUM_ABS_LE",SUM_ABS_LE); +("SUM_ZERO",SUM_ZERO); +("SUM_ADD",SUM_ADD); +("SUM_CMUL",SUM_CMUL); +("SUM_NEG",SUM_NEG); +("SUM_SUB",SUM_SUB); +("SUM_SUBST",SUM_SUBST); +("SUM_NSUB",SUM_NSUB); +("SUM_BOUND",SUM_BOUND); +("SUM_GROUP",SUM_GROUP); +("SUM_1",SUM_1); +("SUM_2",SUM_2); +("SUM_OFFSET",SUM_OFFSET); +("SUM_REINDEX",SUM_REINDEX); +("SUM_0",SUM_0); +("SUM_CANCEL",SUM_CANCEL); +("SUM_HORNER",SUM_HORNER); +("SUM_CONST",SUM_CONST); +("SUM_SPLIT",SUM_SPLIT); +("SUM_SWAP",SUM_SWAP); +("SUM_EQ_0",SUM_EQ_0); +("SUM_MORETERMS_EQ",SUM_MORETERMS_EQ); +("SUM_DIFFERENCES_EQ",SUM_DIFFERENCES_EQ); +("re_Union",re_Union); +("re_union",re_union); +("re_intersect",re_intersect); +("re_null",re_null); +("re_universe",re_universe); +("re_subset",re_subset); +("re_compl",re_compl); +("SUBSETA_REFL",SUBSETA_REFL); +("COMPL_MEM",COMPL_MEM); +("SUBSETA_ANTISYM",SUBSETA_ANTISYM); +("SUBSETA_TRANS",SUBSETA_TRANS); +("istopology",istopology); +("topology_tybij",topology_tybij); +("TOPOLOGY",TOPOLOGY); +("TOPOLOGY_UNION",TOPOLOGY_UNION); +("neigh",neigh); +("OPEN_OWN_NEIGH",OPEN_OWN_NEIGH); +("OPEN_UNOPEN",OPEN_UNOPEN); +("OPEN_SUBOPEN",OPEN_SUBOPEN); +("OPEN_NEIGH",OPEN_NEIGH); +("closed",closed); +("limpt",limpt); +("CLOSED_LIMPT",CLOSED_LIMPT); +("ismet",ismet); +("metric_tybij",metric_tybij); +("METRIC_ISMET",METRIC_ISMET); +("METRIC_ZERO",METRIC_ZERO); +("METRIC_SAME",METRIC_SAME); +("METRIC_POS",METRIC_POS); +("METRIC_SYM",METRIC_SYM); +("METRIC_TRIANGLE",METRIC_TRIANGLE); +("METRIC_NZ",METRIC_NZ); +("mtop",mtop); +("mtop_istopology",mtop_istopology); +("MTOP_OPEN",MTOP_OPEN); +("ball",ball); +("BALL_OPEN",BALL_OPEN); +("BALL_NEIGH",BALL_NEIGH); +("MTOP_LIMPT",MTOP_LIMPT); +("ISMET_R1",ISMET_R1); +("mr1",mr1); +("MR1_DEF",MR1_DEF); +("MR1_ADD",MR1_ADD); +("MR1_SUB",MR1_SUB); +("MR1_ADD_LE",MR1_ADD_LE); +("MR1_SUB_LE",MR1_SUB_LE); +("MR1_ADD_LT",MR1_ADD_LT); +("MR1_SUB_LT",MR1_SUB_LT); +("MR1_BETWEEN1",MR1_BETWEEN1); +("MR1_LIMPT",MR1_LIMPT); +("dorder",dorder); +("tends",tends); +("bounded",bounded); +("tendsto",tendsto); +("DORDER_LEMMA",DORDER_LEMMA); +("DORDER_NGE",DORDER_NGE); +("DORDER_TENDSTO",DORDER_TENDSTO); +("MTOP_TENDS",MTOP_TENDS); +("MTOP_TENDS_UNIQ",MTOP_TENDS_UNIQ); +("SEQ_TENDS",SEQ_TENDS); +("LIM_TENDS",LIM_TENDS); +("LIM_TENDS2",LIM_TENDS2); +("MR1_BOUNDED",MR1_BOUNDED); +("NET_NULL",NET_NULL); +("NET_CONV_BOUNDED",NET_CONV_BOUNDED); +("NET_CONV_NZ",NET_CONV_NZ); +("NET_CONV_IBOUNDED",NET_CONV_IBOUNDED); +("NET_NULL_ADD",NET_NULL_ADD); +("NET_NULL_MUL",NET_NULL_MUL); +("NET_NULL_CMUL",NET_NULL_CMUL); +("NET_ADD",NET_ADD); +("NET_NEG",NET_NEG); +("NET_SUB",NET_SUB); +("NET_MUL",NET_MUL); +("NET_INV",NET_INV); +("NET_DIV",NET_DIV); +("NET_ABS",NET_ABS); +("NET_SUM",NET_SUM); +("NET_LE",NET_LE); +("tends_num_real",tends_num_real); +("SEQ",SEQ); +("SEQ_CONST",SEQ_CONST); +("SEQ_ADD",SEQ_ADD); +("SEQ_MUL",SEQ_MUL); +("SEQ_NEG",SEQ_NEG); +("SEQ_INV",SEQ_INV); +("SEQ_SUB",SEQ_SUB); +("SEQ_DIV",SEQ_DIV); +("SEQ_UNIQ",SEQ_UNIQ); +("SEQ_NULL",SEQ_NULL); +("SEQ_SUM",SEQ_SUM); +("SEQ_TRANSFORM",SEQ_TRANSFORM); +("convergent",convergent); +("cauchy",cauchy); +("lim",lim); +("SEQ_LIM",SEQ_LIM); +("subseq",subseq); +("SUBSEQ_SUC",SUBSEQ_SUC); +("mono",mono); +("MONO_SUC",MONO_SUC); +("MAX_LEMMA",MAX_LEMMA); +("SEQ_BOUNDED",SEQ_BOUNDED); +("SEQ_BOUNDED_2",SEQ_BOUNDED_2); +("SEQ_CBOUNDED",SEQ_CBOUNDED); +("SEQ_ICONV",SEQ_ICONV); +("SEQ_NEG_CONV",SEQ_NEG_CONV); +("SEQ_NEG_BOUNDED",SEQ_NEG_BOUNDED); +("SEQ_BCONV",SEQ_BCONV); +("SEQ_MONOSUB",SEQ_MONOSUB); +("SEQ_SBOUNDED",SEQ_SBOUNDED); +("SEQ_SUBLE",SEQ_SUBLE); +("SEQ_DIRECT",SEQ_DIRECT); +("SEQ_CAUCHY",SEQ_CAUCHY); +("SEQ_LE",SEQ_LE); +("SEQ_LE_0",SEQ_LE_0); +("SEQ_SUC",SEQ_SUC); +("SEQ_ABS",SEQ_ABS); +("SEQ_ABS_IMP",SEQ_ABS_IMP); +("SEQ_INV0",SEQ_INV0); +("SEQ_POWER_ABS",SEQ_POWER_ABS); +("SEQ_POWER",SEQ_POWER); +("SEQ_HARMONIC",SEQ_HARMONIC); +("SEQ_SUBSEQ",SEQ_SUBSEQ); +("SEQ_POW",SEQ_POW); +("NEST_LEMMA",NEST_LEMMA); +("NEST_LEMMA_UNIQ",NEST_LEMMA_UNIQ); +("BOLZANO_LEMMA",BOLZANO_LEMMA); +("BOLZANO_LEMMA_ALT",BOLZANO_LEMMA_ALT); +("sums",sums); +("summable",summable); +("suminf",suminf); +("SUM_SUMMABLE",SUM_SUMMABLE); +("SUMMABLE_SUM",SUMMABLE_SUM); +("SUM_UNIQ",SUM_UNIQ); +("SER_UNIQ",SER_UNIQ); +("SER_0",SER_0); +("SER_POS_LE",SER_POS_LE); +("SER_POS_LT",SER_POS_LT); +("SER_GROUP",SER_GROUP); +("SER_PAIR",SER_PAIR); +("SER_OFFSET",SER_OFFSET); +("SER_OFFSET_REV",SER_OFFSET_REV); +("SER_POS_LT_PAIR",SER_POS_LT_PAIR); +("SER_ADD",SER_ADD); +("SER_CMUL",SER_CMUL); +("SER_NEG",SER_NEG); +("SER_SUB",SER_SUB); +("SER_CDIV",SER_CDIV); +("SER_CAUCHY",SER_CAUCHY); +("SER_ZERO",SER_ZERO); +("SER_COMPAR",SER_COMPAR); +("SER_COMPARA",SER_COMPARA); +("SER_LE",SER_LE); +("SER_LE2",SER_LE2); +("SER_ACONV",SER_ACONV); +("SER_ABS",SER_ABS); +("GP_FINITE",GP_FINITE); +("GP",GP); +("ABS_NEG_LEMMA",ABS_NEG_LEMMA); +("SER_RATIO",SER_RATIO); +("SEQ_TRUNCATION",SEQ_TRUNCATION); +("tends_real_real",tends_real_real); +("LIM",LIM); +("LIM_CONST",LIM_CONST); +("LIM_ADD",LIM_ADD); +("LIM_MUL",LIM_MUL); +("LIM_NEG",LIM_NEG); +("LIM_INV",LIM_INV); +("LIM_SUB",LIM_SUB); +("LIM_DIV",LIM_DIV); +("LIM_NULL",LIM_NULL); +("LIM_SUM",LIM_SUM); +("LIM_X",LIM_X); +("LIM_UNIQ",LIM_UNIQ); +("LIM_EQUAL",LIM_EQUAL); +("LIM_TRANSFORM",LIM_TRANSFORM); +("diffl",diffl); +("contl",contl); +("differentiable",differentiable); +("DIFF_UNIQ",DIFF_UNIQ); +("DIFF_CONT",DIFF_CONT); +("CONTL_LIM",CONTL_LIM); +("CONT_X",CONT_X); +("CONT_CONST",CONT_CONST); +("CONT_ADD",CONT_ADD); +("CONT_MUL",CONT_MUL); +("CONT_NEG",CONT_NEG); +("CONT_INV",CONT_INV); +("CONT_SUB",CONT_SUB); +("CONT_DIV",CONT_DIV); +("CONT_ABS",CONT_ABS); +("CONT_COMPOSE",CONT_COMPOSE); +("IVT",IVT); +("IVT2",IVT2); +("DIFF_CONST",DIFF_CONST); +("DIFF_ADD",DIFF_ADD); +("DIFF_MUL",DIFF_MUL); +("DIFF_CMUL",DIFF_CMUL); +("DIFF_NEG",DIFF_NEG); +("DIFF_SUB",DIFF_SUB); +("DIFF_CARAT",DIFF_CARAT); +("DIFF_CHAIN",DIFF_CHAIN); +("DIFF_X",DIFF_X); +("DIFF_POW",DIFF_POW); +("DIFF_XM1",DIFF_XM1); +("DIFF_INV",DIFF_INV); +("DIFF_DIV",DIFF_DIV); +("DIFF_SUM",DIFF_SUM); +("CONT_BOUNDED",CONT_BOUNDED); +("CONT_BOUNDED_ABS",CONT_BOUNDED_ABS); +("CONT_HASSUP",CONT_HASSUP); +("CONT_ATTAINS",CONT_ATTAINS); +("CONT_ATTAINS2",CONT_ATTAINS2); +("CONT_ATTAINS_ALL",CONT_ATTAINS_ALL); +("DIFF_LINC",DIFF_LINC); +("DIFF_LDEC",DIFF_LDEC); +("DIFF_LMAX",DIFF_LMAX); +("DIFF_LMIN",DIFF_LMIN); +("DIFF_LCONST",DIFF_LCONST); +("INTERVAL_LEMMA_LT",INTERVAL_LEMMA_LT); +("INTERVAL_LEMMA",INTERVAL_LEMMA); +("ROLLE",ROLLE); +("MVT_LEMMA",MVT_LEMMA); +("MVT",MVT); +("MVT_ALT",MVT_ALT); +("DIFF_ISCONST_END",DIFF_ISCONST_END); +("DIFF_ISCONST",DIFF_ISCONST); +("DIFF_ISCONST_END_SIMPLE",DIFF_ISCONST_END_SIMPLE); +("DIFF_ISCONST_ALL",DIFF_ISCONST_ALL); +("INTERVAL_ABS",INTERVAL_ABS); +("CONT_INJ_LEMMA",CONT_INJ_LEMMA); +("CONT_INJ_LEMMA2",CONT_INJ_LEMMA2); +("CONT_INJ_RANGE",CONT_INJ_RANGE); +("CONT_INVERSE",CONT_INVERSE); +("DIFF_INVERSE",DIFF_INVERSE); +("DIFF_INVERSE_LT",DIFF_INVERSE_LT); +("IVT_DERIVATIVE_0",IVT_DERIVATIVE_0); +("IVT_DERIVATIVE_POS",IVT_DERIVATIVE_POS); +("IVT_DERIVATIVE_NEG",IVT_DERIVATIVE_NEG); +("SEQ_CONT_UNIFORM",SEQ_CONT_UNIFORM); +("SER_COMPARA_UNIFORM",SER_COMPARA_UNIFORM); +("SER_COMPARA_UNIFORM_WEAK",SER_COMPARA_UNIFORM_WEAK); +("CONTL",CONTL); +("CONTL_SEQ",CONTL_SEQ); +("SUP_INTERVAL",SUP_INTERVAL); +("CONT_UNIFORM",CONT_UNIFORM); +("CONT_UNIFORM_STRONG",CONT_UNIFORM_STRONG); +("POWDIFF_LEMMA",POWDIFF_LEMMA); +("POWDIFF",POWDIFF); +("POWREV",POWREV); +("POWSER_INSIDEA",POWSER_INSIDEA); +("POWSER_INSIDE",POWSER_INSIDE); +("diffs",diffs); +("DIFFS_NEG",DIFFS_NEG); +("DIFFS_LEMMA",DIFFS_LEMMA); +("DIFFS_LEMMA2",DIFFS_LEMMA2); +("DIFFS_EQUIV",DIFFS_EQUIV); +("TERMDIFF_LEMMA1",TERMDIFF_LEMMA1); +("TERMDIFF_LEMMA2",TERMDIFF_LEMMA2); +("TERMDIFF_LEMMA3",TERMDIFF_LEMMA3); +("TERMDIFF_LEMMA4",TERMDIFF_LEMMA4); +("TERMDIFF_LEMMA5",TERMDIFF_LEMMA5); +("TERMDIFF",TERMDIFF); +("SEQ_NPOW",SEQ_NPOW); +("TERMDIFF_CONVERGES",TERMDIFF_CONVERGES); +("TERMDIFF_STRONG",TERMDIFF_STRONG); +("POWSER_0",POWSER_0); +("POWSER_LIMIT_0",POWSER_LIMIT_0); +("POWSER_LIMIT_0_STRONG",POWSER_LIMIT_0_STRONG); +("POWSER_EQUAL_0",POWSER_EQUAL_0); +("POWSER_EQUAL",POWSER_EQUAL); +("MULT_DIV_2",MULT_DIV_2); +("EVEN_DIV2",EVEN_DIV2); +("POW_ZERO",POW_ZERO); +("POW_ZERO_EQ",POW_ZERO_EQ); +("POW_LT",POW_LT); +("POW_EQ",POW_EQ); +("exp",exp); +("sin",sin); +("cos",cos); +("REAL_EXP_CONVERGES",REAL_EXP_CONVERGES); +("SIN_CONVERGES",SIN_CONVERGES); +("COS_CONVERGES",COS_CONVERGES); +("REAL_EXP_FDIFF",REAL_EXP_FDIFF); +("SIN_FDIFF",SIN_FDIFF); +("COS_FDIFF",COS_FDIFF); +("SIN_NEGLEMMA",SIN_NEGLEMMA); +("DIFF_EXP",DIFF_EXP); +("DIFF_SIN",DIFF_SIN); +("DIFF_COS",DIFF_COS); +("DIFF_COMPOSITE",DIFF_COMPOSITE); +("REAL_EXP_0",REAL_EXP_0); +("REAL_EXP_LE_X",REAL_EXP_LE_X); +("REAL_EXP_LT_1",REAL_EXP_LT_1); +("REAL_EXP_ADD_MUL",REAL_EXP_ADD_MUL); +("REAL_EXP_NEG_MUL",REAL_EXP_NEG_MUL); +("REAL_EXP_NEG_MUL2",REAL_EXP_NEG_MUL2); +("REAL_EXP_NEG",REAL_EXP_NEG); +("REAL_EXP_ADD",REAL_EXP_ADD); +("REAL_EXP_POS_LE",REAL_EXP_POS_LE); +("REAL_EXP_NZ",REAL_EXP_NZ); +("REAL_EXP_POS_LT",REAL_EXP_POS_LT); +("REAL_EXP_N",REAL_EXP_N); +("REAL_EXP_SUB",REAL_EXP_SUB); +("REAL_EXP_MONO_IMP",REAL_EXP_MONO_IMP); +("REAL_EXP_MONO_LT",REAL_EXP_MONO_LT); +("REAL_EXP_MONO_LE",REAL_EXP_MONO_LE); +("REAL_EXP_INJ",REAL_EXP_INJ); +("REAL_EXP_TOTAL_LEMMA",REAL_EXP_TOTAL_LEMMA); +("REAL_EXP_TOTAL",REAL_EXP_TOTAL); +("REAL_EXP_BOUND_LEMMA",REAL_EXP_BOUND_LEMMA); +("ln",ln); +("LN_EXP",LN_EXP); +("REAL_EXP_LN",REAL_EXP_LN); +("EXP_LN",EXP_LN); +("LN_MUL",LN_MUL); +("LN_INJ",LN_INJ); +("LN_1",LN_1); +("LN_INV",LN_INV); +("LN_DIV",LN_DIV); +("LN_MONO_LT",LN_MONO_LT); +("LN_MONO_LE",LN_MONO_LE); +("LN_POW",LN_POW); +("LN_LE",LN_LE); +("LN_LT_X",LN_LT_X); +("LN_POS",LN_POS); +("LN_POS_LT",LN_POS_LT); +("DIFF_LN",DIFF_LN); +("root",root); +("sqrt_def",sqrt_def); +("sqrt",sqrt); +("ROOT_LT_LEMMA",ROOT_LT_LEMMA); +("ROOT_LN",ROOT_LN); +("ROOT_0",ROOT_0); +("ROOT_1",ROOT_1); +("ROOT_POW_POS",ROOT_POW_POS); +("POW_ROOT_POS",POW_ROOT_POS); +("ROOT_POS_POSITIVE",ROOT_POS_POSITIVE); +("ROOT_POS_UNIQ",ROOT_POS_UNIQ); +("ROOT_MUL",ROOT_MUL); +("ROOT_INV",ROOT_INV); +("ROOT_DIV",ROOT_DIV); +("ROOT_MONO_LT",ROOT_MONO_LT); +("ROOT_MONO_LE",ROOT_MONO_LE); +("ROOT_MONO_LT_EQ",ROOT_MONO_LT_EQ); +("ROOT_MONO_LE_EQ",ROOT_MONO_LE_EQ); +("ROOT_INJ",ROOT_INJ); +("SQRT_0",SQRT_0); +("SQRT_1",SQRT_1); +("SQRT_POS_LT",SQRT_POS_LT); +("SQRT_POS_LE",SQRT_POS_LE); +("SQRT_POW2",SQRT_POW2); +("SQRT_POW_2",SQRT_POW_2); +("POW_2_SQRT",POW_2_SQRT); +("SQRT_POS_UNIQ",SQRT_POS_UNIQ); +("SQRT_MUL",SQRT_MUL); +("SQRT_INV",SQRT_INV); +("SQRT_DIV",SQRT_DIV); +("SQRT_MONO_LT",SQRT_MONO_LT); +("SQRT_MONO_LE",SQRT_MONO_LE); +("SQRT_MONO_LT_EQ",SQRT_MONO_LT_EQ); +("SQRT_MONO_LE_EQ",SQRT_MONO_LE_EQ); +("SQRT_INJ",SQRT_INJ); +("SQRT_EVEN_POW2",SQRT_EVEN_POW2); +("REAL_DIV_SQRT",REAL_DIV_SQRT); +("POW_2_SQRT_ABS",POW_2_SQRT_ABS); +("SQRT_EQ_0",SQRT_EQ_0); +("REAL_LE_LSQRT",REAL_LE_LSQRT); +("REAL_LE_POW_2",REAL_LE_POW_2); +("REAL_LE_RSQRT",REAL_LE_RSQRT); +("DIFF_SQRT",DIFF_SQRT); +("SIN_0",SIN_0); +("COS_0",COS_0); +("SIN_CIRCLE",SIN_CIRCLE); +("SIN_BOUND",SIN_BOUND); +("SIN_BOUNDS",SIN_BOUNDS); +("COS_BOUND",COS_BOUND); +("COS_BOUNDS",COS_BOUNDS); +("SIN_COS_ADD",SIN_COS_ADD); +("SIN_COS_NEG",SIN_COS_NEG); +("SIN_ADD",SIN_ADD); +("COS_ADD",COS_ADD); +("SIN_NEG",SIN_NEG); +("COS_NEG",COS_NEG); +("SIN_DOUBLE",SIN_DOUBLE); +("COS_DOUBLE",COS_DOUBLE); +("COS_ABS",COS_ABS); +("SIN_PAIRED",SIN_PAIRED); +("SIN_POS",SIN_POS); +("COS_PAIRED",COS_PAIRED); +("COS_2",COS_2); +("COS_ISZERO",COS_ISZERO); +("pi",pi); +("PI2",PI2); +("COS_PI2",COS_PI2); +("PI2_BOUNDS",PI2_BOUNDS); +("PI_POS",PI_POS); +("SIN_PI2",SIN_PI2); +("COS_PI",COS_PI); +("SIN_PI",SIN_PI); +("SIN_COS",SIN_COS); +("COS_SIN",COS_SIN); +("SIN_PERIODIC_PI",SIN_PERIODIC_PI); +("COS_PERIODIC_PI",COS_PERIODIC_PI); +("SIN_PERIODIC",SIN_PERIODIC); +("COS_PERIODIC",COS_PERIODIC); +("COS_NPI",COS_NPI); +("SIN_NPI",SIN_NPI); +("SIN_POS_PI2",SIN_POS_PI2); +("COS_POS_PI2",COS_POS_PI2); +("COS_POS_PI",COS_POS_PI); +("SIN_POS_PI",SIN_POS_PI); +("SIN_POS_PI_LE",SIN_POS_PI_LE); +("COS_TOTAL",COS_TOTAL); +("SIN_TOTAL",SIN_TOTAL); +("COS_ZERO_LEMMA",COS_ZERO_LEMMA); +("SIN_ZERO_LEMMA",SIN_ZERO_LEMMA); +("COS_ZERO",COS_ZERO); +("SIN_ZERO",SIN_ZERO); +("SIN_ZERO_PI",SIN_ZERO_PI); +("COS_ONE_2PI",COS_ONE_2PI); +("tan",tan); +("TAN_0",TAN_0); +("TAN_PI",TAN_PI); +("TAN_NPI",TAN_NPI); +("TAN_NEG",TAN_NEG); +("TAN_PERIODIC",TAN_PERIODIC); +("TAN_PERIODIC_PI",TAN_PERIODIC_PI); +("TAN_PERIODIC_NPI",TAN_PERIODIC_NPI); +("TAN_ADD",TAN_ADD); +("TAN_DOUBLE",TAN_DOUBLE); +("TAN_POS_PI2",TAN_POS_PI2); +("DIFF_TAN",DIFF_TAN); +("TAN_TOTAL_LEMMA",TAN_TOTAL_LEMMA); +("TAN_TOTAL_POS",TAN_TOTAL_POS); +("TAN_TOTAL",TAN_TOTAL); +("PI2_PI4",PI2_PI4); +("TAN_PI4",TAN_PI4); +("TAN_COT",TAN_COT); +("TAN_BOUND_PI2",TAN_BOUND_PI2); +("TAN_ABS_GE_X",TAN_ABS_GE_X); +("asn",asn); +("acs",acs); +("atn",atn); +("ASN",ASN); +("ASN_SIN",ASN_SIN); +("ASN_BOUNDS",ASN_BOUNDS); +("ASN_BOUNDS_LT",ASN_BOUNDS_LT); +("SIN_ASN",SIN_ASN); +("ACS",ACS); +("ACS_COS",ACS_COS); +("ACS_BOUNDS",ACS_BOUNDS); +("ACS_BOUNDS_LT",ACS_BOUNDS_LT); +("COS_ACS",COS_ACS); +("ATN",ATN); +("ATN_TAN",ATN_TAN); +("ATN_BOUNDS",ATN_BOUNDS); +("TAN_ATN",TAN_ATN); +("ATN_0",ATN_0); +("ATN_1",ATN_1); +("ATN_NEG",ATN_NEG); +("COS_ATN_NZ",COS_ATN_NZ); +("TAN_SEC",TAN_SEC); +("DIFF_ATN",DIFF_ATN); +("ATN_MONO_LT",ATN_MONO_LT); +("ATN_MONO_LT_EQ",ATN_MONO_LT_EQ); +("ATN_MONO_LE_EQ",ATN_MONO_LE_EQ); +("ATN_INJ",ATN_INJ); +("ATN_POS_LT",ATN_POS_LT); +("ATN_POS_LE",ATN_POS_LE); +("ATN_LT_PI4_POS",ATN_LT_PI4_POS); +("ATN_LT_PI4_NEG",ATN_LT_PI4_NEG); +("ATN_LT_PI4",ATN_LT_PI4); +("ATN_LE_PI4",ATN_LE_PI4); +("COS_SIN_SQRT",COS_SIN_SQRT); +("COS_ASN_NZ",COS_ASN_NZ); +("DIFF_ASN_COS",DIFF_ASN_COS); +("DIFF_ASN",DIFF_ASN); +("SIN_COS_SQRT",SIN_COS_SQRT); +("SIN_ACS_NZ",SIN_ACS_NZ); +("DIFF_ACS_SIN",DIFF_ACS_SIN); +("DIFF_ACS",DIFF_ACS); +("CIRCLE_SINCOS",CIRCLE_SINCOS); +("ACS_MONO_LT",ACS_MONO_LT); +("LESS_SUC_EQ",LESS_SUC_EQ); +("LESS_1",LESS_1); +("division",division); +("dsize",dsize); +("tdiv",tdiv); +("gauge",gauge); +("fine",fine); +("rsum",rsum); +("defint",defint); +("DIVISION_0",DIVISION_0); +("DIVISION_1",DIVISION_1); +("DIVISION_SINGLE",DIVISION_SINGLE); +("DIVISION_LHS",DIVISION_LHS); +("DIVISION_THM",DIVISION_THM); +("DIVISION_RHS",DIVISION_RHS); +("DIVISION_LT_GEN",DIVISION_LT_GEN); +("DIVISION_LT",DIVISION_LT); +("DIVISION_LE",DIVISION_LE); +("DIVISION_GT",DIVISION_GT); +("DIVISION_EQ",DIVISION_EQ); +("DIVISION_LBOUND",DIVISION_LBOUND); +("DIVISION_LBOUND_LT",DIVISION_LBOUND_LT); +("DIVISION_UBOUND",DIVISION_UBOUND); +("DIVISION_UBOUND_LT",DIVISION_UBOUND_LT); +("DIVISION_APPEND_LEMMA1",DIVISION_APPEND_LEMMA1); +("DIVISION_APPEND_LEMMA2",DIVISION_APPEND_LEMMA2); +("DIVISION_APPEND_EXPLICIT",DIVISION_APPEND_EXPLICIT); +("DIVISION_APPEND_STRONG",DIVISION_APPEND_STRONG); +("DIVISION_APPEND",DIVISION_APPEND); +("DIVISION_EXISTS",DIVISION_EXISTS); +("GAUGE_MIN",GAUGE_MIN); +("FINE_MIN",FINE_MIN); +("DINT_UNIQ",DINT_UNIQ); +("INTEGRAL_NULL",INTEGRAL_NULL); +("STRADDLE_LEMMA",STRADDLE_LEMMA); +("FTC1",FTC1); +("integrable",integrable); +("integral",integral); +("INTEGRABLE_DEFINT",INTEGRABLE_DEFINT); +("DIVISION_BOUNDS",DIVISION_BOUNDS); +("TDIV_BOUNDS",TDIV_BOUNDS); +("TDIV_LE",TDIV_LE); +("DEFINT_WRONG",DEFINT_WRONG); +("DEFINT_INTEGRAL",DEFINT_INTEGRAL); +("DEFINT_CONST",DEFINT_CONST); +("DEFINT_0",DEFINT_0); +("DEFINT_NEG",DEFINT_NEG); +("DEFINT_CMUL",DEFINT_CMUL); +("DEFINT_ADD",DEFINT_ADD); +("DEFINT_SUB",DEFINT_SUB); +("INTEGRAL_LE",INTEGRAL_LE); +("DEFINT_LE",DEFINT_LE); +("DEFINT_TRIANGLE",DEFINT_TRIANGLE); +("DEFINT_EQ",DEFINT_EQ); +("INTEGRAL_EQ",INTEGRAL_EQ); +("INTEGRATION_BY_PARTS",INTEGRATION_BY_PARTS); +("DIVISION_LE_SUC",DIVISION_LE_SUC); +("DIVISION_MONO_LE",DIVISION_MONO_LE); +("DIVISION_MONO_LE_SUC",DIVISION_MONO_LE_SUC); +("DIVISION_INTERMEDIATE",DIVISION_INTERMEDIATE); +("DIVISION_DSIZE_LE",DIVISION_DSIZE_LE); +("DIVISION_DSIZE_GE",DIVISION_DSIZE_GE); +("DIVISION_DSIZE_EQ",DIVISION_DSIZE_EQ); +("DIVISION_DSIZE_EQ_ALT",DIVISION_DSIZE_EQ_ALT); +("DEFINT_COMBINE",DEFINT_COMBINE); +("DEFINT_DELTA_LEFT",DEFINT_DELTA_LEFT); +("DEFINT_DELTA_RIGHT",DEFINT_DELTA_RIGHT); +("DEFINT_DELTA",DEFINT_DELTA); +("DEFINT_POINT_SPIKE",DEFINT_POINT_SPIKE); +("DEFINT_FINITE_SPIKE",DEFINT_FINITE_SPIKE); +("GAUGE_MIN_FINITE",GAUGE_MIN_FINITE); +("INTEGRABLE_CAUCHY",INTEGRABLE_CAUCHY); +("SUM_DIFFS",SUM_DIFFS); +("RSUM_BOUND",RSUM_BOUND); +("RSUM_DIFF_BOUND",RSUM_DIFF_BOUND); +("INTEGRABLE_LIMIT",INTEGRABLE_LIMIT); +("INTEGRABLE_CONST",INTEGRABLE_CONST); +("INTEGRABLE_COMBINE",INTEGRABLE_COMBINE); +("INTEGRABLE_POINT_SPIKE",INTEGRABLE_POINT_SPIKE); +("INTEGRABLE_CONTINUOUS",INTEGRABLE_CONTINUOUS); +("INTEGRABLE_SPLIT_SIDES",INTEGRABLE_SPLIT_SIDES); +("INTEGRABLE_SUBINTERVAL_LEFT",INTEGRABLE_SUBINTERVAL_LEFT); +("INTEGRABLE_SUBINTERVAL_RIGHT",INTEGRABLE_SUBINTERVAL_RIGHT); +("INTEGRABLE_SUBINTERVAL",INTEGRABLE_SUBINTERVAL); +("INTEGRAL_CONST",INTEGRAL_CONST); +("INTEGRAL_CMUL",INTEGRAL_CMUL); +("INTEGRAL_ADD",INTEGRAL_ADD); +("INTEGRAL_SUB",INTEGRAL_SUB); +("INTEGRAL_BY_PARTS",INTEGRAL_BY_PARTS); +("MCLAURIN",MCLAURIN); +("MCLAURIN_NEG",MCLAURIN_NEG); +("MCLAURIN_BI_LE",MCLAURIN_BI_LE); +("MCLAURIN_ALL_LT",MCLAURIN_ALL_LT); +("MCLAURIN_ZERO",MCLAURIN_ZERO); +("MCLAURIN_ALL_LE",MCLAURIN_ALL_LE); +("MCLAURIN_EXP_LEMMA",MCLAURIN_EXP_LEMMA); +("MCLAURIN_EXP_LT",MCLAURIN_EXP_LT); +("MCLAURIN_EXP_LE",MCLAURIN_EXP_LE); +("MCLAURIN_LN_POS",MCLAURIN_LN_POS); +("MCLAURIN_LN_NEG",MCLAURIN_LN_NEG); +("MCLAURIN_SIN",MCLAURIN_SIN); +("MCLAURIN_COS",MCLAURIN_COS); +("REAL_ATN_POWSER_SUMMABLE",REAL_ATN_POWSER_SUMMABLE); +("REAL_ATN_POWSER_DIFFS_SUMMABLE",REAL_ATN_POWSER_DIFFS_SUMMABLE); +("REAL_ATN_POWSER_DIFFS_SUM",REAL_ATN_POWSER_DIFFS_SUM); +("REAL_ATN_POWSER_DIFFS_DIFFS_SUMMABLE",REAL_ATN_POWSER_DIFFS_DIFFS_SUMMABLE); +("REAL_ATN_POWSER_DIFFL",REAL_ATN_POWSER_DIFFL); +("REAL_ATN_POWSER",REAL_ATN_POWSER); +("MCLAURIN_ATN",MCLAURIN_ATN); +("max_real",max_real); +("min_real",min_real); +("min_num",min_num); +("deriv",deriv); +("deriv2",deriv2); +("atn2",atn2); +("sqrt8",sqrt8); +("sqrt2",sqrt2); +("t0",t0); +("two_t0",two_t0); +("square_2t0",square_2t0); +("square_4t0",square_4t0); +("pt",pt); +("square",square); +("zeta",zeta); +("doct",doct); +("dtet",dtet); +("pi_rt18",pi_rt18); +("rogers",rogers); +("compression_cut",compression_cut); +("squander_target",squander_target); +("xiV",xiV); +("xi_gamma",xi_gamma); +("xi'_gamma",xi'_gamma); +("xi_kappa",xi_kappa); +("xi_kappa_gamma",xi_kappa_gamma); +("pi_max",pi_max); +("t4",t4); +("t5",t5); +("t6",t6); +("t7",t7); +("t8",t8); +("t9",t9); +("t10",t10); +("s5",s5); +("s6",s6); +("s7",s7); +("s8",s8); +("s9",s9); +("s10",s10); +("eps0",eps0); +("Z31",Z31); +("Z32",Z32); +("Z33",Z33); +("Z41",Z41); +("Z42",Z42); +("D31",D31); +("D32",D32); +("D33",D33); +("D41",D41); +("D42",D42); +("D51",D51); +("pp_a1",pp_a1); +("pp_a2",pp_a2); +("pp_d0",pp_d0); +("pp_m",pp_m); +("pp_b",pp_b); +("pp_a",pp_a); +("pp_bc",pp_bc); +("pp_c",pp_c); +("pp_d",pp_d); +("pp_solt0",pp_solt0); +("delta_x",delta_x); +("delta_x4",delta_x4); +("delta_x6",delta_x6); +("ups_x",ups_x); +("eta_x",eta_x); +("eta_y",eta_y); +("rho_x",rho_x); +("rad2_y",rad2_y); +("chi_x",chi_x); +("dih_x",dih_x); +("dih_y",dih_y); +("dih2_y",dih2_y); +("dih3_y",dih3_y); +("dih2_x",dih2_x); +("dih3_x",dih3_x); +("sol_x",sol_x); +("sol_y",sol_y); +("vol_x",vol_x); +("beta",beta); +("arclength",arclength); +("volR",volR); +("solR",solR); +("dihR",dihR); +("vorR",vorR); +("denR",denR); +("tauR",tauR); +("quoin",quoin); +("qy",qy); +("quo_x",quo_x); +("qn",qn); +("phi",phi); +("phi0",phi0); +("eta0",eta0); +("crown",crown); +("anc",anc); +("K0",K0); +("AH",AH); +("BHY",BHY); +("KY",KY); +("KX",KX); +("vor_analytic_x",vor_analytic_x); +("vor_analytic_x_flipped",vor_analytic_x_flipped); +("octavor_analytic_x",octavor_analytic_x); +("tau_analytic_x",tau_analytic_x); +("kappa",kappa); +("kappa_dih_y",kappa_dih_y); +("level_at",level_at); +("vorstar",vorstar); +("vort_y",vort_y); +("vor_0_y",vor_0_y); +("tau_0_y",tau_0_y); +("vor_0_x",vor_0_x); +("tau_0_x",tau_0_x); +("vort_x",vort_x); +("tauVt_x",tauVt_x); +("vorA_x",vorA_x); +("tauA_x",tauA_x); +("vorC0_x",vorC0_x); +("tauC0_x",tauC0_x); +("vorC_x",vorC_x); +("tauC_x",tauC_x); +("v0x",v0x); +("v1x",v1x); +("gamma_x",gamma_x); +("tau_gamma_x",tau_gamma_x); +("rad2_x",rad2_x); +("sigma_qrtet_x",sigma_qrtet_x); +("sigma1_qrtet_x",sigma1_qrtet_x); +("tau_sigma_x",tau_sigma_x); +("sigma32_qrtet_x",sigma32_qrtet_x); +("mu_flat_x",mu_flat_x); +("taumu_flat_x",taumu_flat_x); +("mu_upright_x",mu_upright_x); +("mu_flipped_x",mu_flipped_x); +("vor_0_x_flipped",vor_0_x_flipped); +("octavor0_x",octavor0_x); +("nu_x",nu_x); +("nu_gamma_x",nu_gamma_x); +("taunu_x",taunu_x); +("octa_x",octa_x); +("sigmahat_x",sigmahat_x); +("sigmahat_x'",sigmahat_x'); +("sigmahatpi_x",sigmahatpi_x); +("tauhat_x",tauhat_x); +("tauhatpi_x",tauhatpi_x); +("pi_prime_tau",pi_prime_tau); +("pi_prime_sigma",pi_prime_sigma); +("findpoint",findpoint); +("enclosed",enclosed); +("cross_diag",cross_diag); +("cross_diag_x",cross_diag_x); +("affine",affine); +("convex",convex); +("aff",aff); +("conv",conv); +("conv0",conv0); +("cone",cone); +("cone0",cone0); +("voronoi",voronoi); +("line",line); +("collinear",collinear); +("plane",plane); +("closed_half_plane",closed_half_plane); +("open_half_plane",open_half_plane); +("coplanar",coplanar); +("closed_half_space",closed_half_space); +("open_half_space",open_half_space); +("arcV",arcV); +("cross",cross); +("dihV",dihV); +("ylist",ylist); +("xlist",xlist); +("euler_p",euler_p); +("radius",radius); +("polar_angle",polar_angle); +("polar_c",polar_c); +("less_polar",less_polar); +("min_polar",min_polar); +("polar_cycle",polar_cycle); +("iter_spec",iter_spec); +("iter",iter); +("orthonormal",orthonormal); +("cyclic_set",cyclic_set); +("azim_cycle_hyp_def",azim_cycle_hyp_def); +("azim_cycle_spec",azim_cycle_spec); +("azim_cycle_def",azim_cycle_def); +("ineq",ineq) + + +(* ==================== *) +(* ==== QUANG TRUONG ======= *) +(* ====== if you load geomdetail, you should load the following things +, so that you can find thm in geomdetail.ml + + +("VC_DISJOINT", VC_DISJOINT ); +("trg_sub_bo", trg_sub_bo); +("trg_sub_se", trg_sub_se); + +("not_in_set3", not_in_set3); + +("trg_d3_sym", trg_d3_sym); + +("affine_hull_e", affine_hull_e); + +("wlog", wlog ); + +("wlog_real", wlog_real); + +("dkdx", dkdx); + +("tarski_arith", tarski_arith); + +("simp_def", simp_def); + +("AFFINE_HULL_SINGLE", AFFINE_HULL_SINGLE); + +("usefull", usefull ); + +("near", near); + +("near2t0", near2t0); + +("e_plane", e_plane); + +("bis", bis); + +("min_dist", min_dist); + +("exists_min_dist", exists_min_dist); + + + + + + + + + + + +("centered_pac", centered_pac); + +("Q_SYS", Q_SYS); + + + + + + + + + +("a_le_sub", a_le_sub); + +("strict_qua_in_oct", strict_qua_in_oct); + +("set_3elements", set_3elements); + + + + +("without_lost", without_lost ); + +("condi_of_wlofg", condi_of_wlofg); + +("SET_OF_4", SET_OF_4); + +("def_simplex", def_simplex); + +("strict_qua2_interior_pos", strict_qua2_interior_pos); + +("simplex_interior_pos", simplex_interior_pos); + + + + + + +("WHEN_IN_QSYS", WHEN_IN_Q_SYS); + + + + + + + + +("strict_qua2_imply_strict_qua", strict_qua2_imply_strict_qua); + + +("CASES_OF_Q_SYS", CASES_OF_Q_SYS); + +("RELATE_Q_SYS", RELATE_Q_SYS); + +("tarski_FFSXOWD", tarski_FFSXOWD); + + + + + +("barrier'", barrier'); + +("lemma7_7_CXRHOVG", lemma7_7_CXRHOVG); + +("tarski_UMMNOJN", tarski_UMMNOJN); + +("CARD_SING", CARD_SING); + +("FINITE6", FINITE6); + +("CARD_SET2", CARD_SET2); + +("CARD_EQUATION ", CARD_EQUATION); + +(" CARD5", CARD5 ); + +(" CARD_DISJOINT", CARD_DISJOINT); + +("QUA_TET_IMPLY_QUA_TRI", QUA_TET_IMPLY_QUA_TRI); + +("PAIR_D3", PAIR_D3); + +("PAIR_DIST", PAIR_DIST); + +("TRIANGLE_IN_STRICT_QUA", TRIANGLE_IN_STRICT_QUA); + +("TRIANGLE_IN_BARRIER", TRIANGLE_IN_BARRIER); + +("DIA_OF_QUARTER", DIA_OF_QUARTER); + +("SUB_PACKING", SUB_PACKING); + +("D3_REFL", D3_REFL); + +("db_t0_sq8", db_t0_sq8); + +("db_t0", db_t0); + +("TRIANGLE_IN_BARRIER'", TRIANGLE_IN_BARRIER'); + + + +("IN_AFF_GE_CON", IN_AFF_GE_CON ); + +("OCT23", OCT23); + + +(* --------------- +("OTHER_LEMMA", OTHER_LEMMA ); + +("quasi_reg_tet_case", quasi_reg_tet_case ); + +("in_VC", in_VC); + +("MEETING_CONDITION", MEETING_CONDITION); + +("quasi_tri_case", quasi_tri_case); + +("OCTOR23", OCTOR23); + +("OCTO23", OCTO23); + +("OCT24", OCT24); + +("hard_case", hard_case ); + +("v_near2t0_v", v_near2t0_v); + +("lemma_of_lemma82", lemma_of_lemma82); + +("le1_82", le1_82); + +("rhand_subset_lhand", rhand_subset_lhand); + +("import_le", import_le); + +("v1_in_convex3", v1_in_convex3); + +("v1v2v3_in_convex3", v1v2v3_in_convex3); + +("minconvex3", minconvex3); + +("convex3_in_inters", convex3_in_inters) +----------------- *) + + + +("DIAGONAL_QUA", DIAGONAL_QUA); + +("DIAGONAL_STRICT_QUA", DIAGONAL_STRICT_QUA); + +("DIAGONAL_BARRIER", DIAGONAL_BARRIER); + +("simp_def", simp_def); + +("def_obstructed", def_obstructed ); + +("CARD_CLAUSES_IMP", CARD_CLAUSES_IMP); + +("CARD2", CARD2); + +("CARD3", CARD3); + +(" CARD4", CARD4); + +("PAIR_EQ_EXPAND", PAIR_EQ_EXPAND); + +("IN_SET3", IN_SET3); + +("IN_SET4", IN_SET4); + +("SHORT_EDGES", SHORT_EDGES); + +("CONV_EM", CONV_EM); + +("CONV_SING", CONV_SING); + +("IN_ACT_SING", IN_ACT_SING); + +("IN_SET2", IN_SET2); + +("VSUM_DIS2", VSUM_DIS2); + +("SUM_DIS2", SUM_DIS2); + +("CONV_SET2", CONV_SET2); + +("CEWWWDQ", CEWWWDQ); + +("QHSEWMI", QHSEWMI ); + +("TCQPONA", TCQPONA ); + +("CONV3_A_EQ", CONV3_A_EQ); + +("VSUM_DIS3", VSUM_DIS3); + +("SUM_DIS3", SUM_DIS3); + +("EQ_EXPAND", EQ_EXPAND); + +("CONV_SET3", CONV_SET3); +("SET3_SUBSET", SET3_SUBSET); + + + + +("convex3", convex3); +("INTERS_SUBSET", INTERS_SUBSET); + +("SUM_TWO_RATIO ", SUM_TWO_RATIO); + +("OTHER_CONVEX_CONDI ", OTHER_CONVEX_CONDI ); + +("CONV_BAR_EQ", CONV_BAR_EQ); + +("CONV3_EQ", CONV3_EQ); + +("DOT_SUB_ADD", DOT_SUB_ADD); + +("DIST_LT_HALF_PLANE", DIST_LT_HALF_PLANE); + +("OR_IMP_EX", OR_IMP_EX); + +("HALF_PLANE_CONV", HALF_PLANE_CONV); + +("HALF_PLANE_CONV_EP", HALF_PLANE_CONV_EP ); +("VORONOI_CONV ", VORONOI_CONV ); + +("CONVEX_IM_CONV2_SU", CONVEX_IM_CONV2_SU ); + +("CONVEX_AS_CONV2", CONVEX_AS_CONV2 ); + +("CONV0_SING", CONV0_SING); + +("CONV0_SET2", CONV0_SET2); + +("CONV02_SU_CONV2", CONV02_SU_CONV2); + +("CONVEX_IM_CONV02_SU ", CONVEX_IM_CONV02_SU ); + +("BAR_TRI", BAR_TRI); + +("X_IN_VOR_X", X_IN_VOR_X); + +("IN_VO2_EQ", IN_VO2_EQ); + +("IN_VO_EQ", IN_VO_EQ); + +("IN_BAR_DISTINCT", IN_BAR_DISTINCT); + +("FOUR_POINTS", FOUR_POINTS); + +("IN_Q_SYS_IMP4", IN_Q_SYS_IMP4 ); + +("D3_SYM", D3_SYM); + +("SET2_SU_EX", SET2_SU_EX); + +("QUARTER_EQ_EX_DIA", QUARTER_EQ_EX_DIA ); + +("IN_Q_IMP", IN_Q_IMP); + +("EXISTS_DIA", EXISTS_DIA); + +("COND_Q_SYS", COND_Q_SYS); + +("SET4_SUB_EX", SET4_SUB_EX); + +("IMP_QUA_RE_TE", IMP_QUA_RE_TE); + +("SET3_U_SET1", SET3_U_SET1); + +("IN_BA_IM_PA_SU ", IN_BA_IM_PA_SU ); + +("QUA_TRI_EDGE", QUA_TRI_EDGE); + +("BAR_WI_LONG_ED", BAR_WI_LONG_ED) + + +========== *) + +];; + +theorems := !theorems @ !thm_region_array;; diff --git a/legacy/general/deprecated_sphere.hl b/legacy/general/deprecated_sphere.hl new file mode 100644 index 0000000..70be822 --- /dev/null +++ b/legacy/general/deprecated_sphere.hl @@ -0,0 +1,1546 @@ +(* + May 2012, definitions no longer needed in + primary verifications of flyspeck. +*) + +(* +deprecated May 2012: + +arclength_x_345 +taum_hexall_x +dih_hexall_x + dih1_hexall_x + upper_dih_hexall_x + delta_hexall_x +delta4_hexall_x +eulerA_hexall_x +factor345_hexall_x +law_cosines_234_x +law_cosines_126_x +delta_template_B_x +dih_template_B_x +taum_template_B_x +delta_top_x +tau_lowform_x +tau_m_diff_quotient +tau_m_diff_quotient2 + +*) + + +(* +7/29/2009: + * normball deprecated. Replace normball x r with ball(x,r) + * rect deprecated. Use interval instead. + * wedge is now defined by Harrison using azim. He has proved a lemma giving the equivalence with the previous definition. + * azim in defined by Harrison. + * directed_angle is now defined through complex Arg. + * definition of polar cycle has been changed (again). + * a lemma is needed relating atn2 to Arg. + * cone -> cone0 + * deprecated: volume_props. +*) + + +(* deleted obsolete definitions 2/7/2010 svn 1471: + obsolete definitions: + obsolete: rad2_y, d3, mk_vec3, real3_of_triple, triple_of_real3, + obsolete: conv, radius -> norm(vector[x;y]), + obsolete: polar_angle -> Arg(vector[x;y]), + obsolete: polar_c, less_polar, min_polar, + obsolete: iter_SPEC, iter -> ITER, + obsolete: azim_cycle_hyp_def, azim_cycle_spec, azim_cycle_def, + obsolete: rogers, rogers0, azim_hyp_def, azim_spec, azim_def, + + 2011-08-01. + obsolete: polar_cycle +*) + +(* terms moved to Harrison's flyspeck.ml +NULLSET_RULES, +solid_triangle, ellipsoid, conic_cap, frustum, frustt, +primitive, MEASURABLE_RULES, solid, coplanar, cross, wedge, azim, +*) + + +(* (now voronoi_open) let voronoi = new_definition `voronoi v S = { x | !w. ((S w) /\ ~(w=v)) ==> (dist( x, v) < dist( x, w)) }`;; *) + + +(* DEPRECATED, 2011-08-01, not used + +let directed_angle = new_definition `directed_angle (x,y) (x',y') = + Arg (complex(x',y') / complex(x,y))`;; + +let cyclic_order = new_definition `cyclic_order v u w = + ((directed_angle v u < directed_angle v w) \/ + ((directed_angle v u = directed_angle v w) /\ (radius u <= radius w)))`;; + +let polar_cycle = new_definition `polar_cycle V v = + if (V SUBSET {v}) then v else (@ u. ~(u=v) /\ V u /\ + (!w. ~(w = v) /\ V w ==> cyclic_order v u w))`;; +*) + + +(* +let sol_euler_y = `sol_euler_y y1 y2 y3 y4 y5 y6 = + (let a = y1*y2*y3 + y1*(y2*y2 + y3*y3 - y4*y4)/ &2 + + y2*(y1*y1 + y3*y3 - y5*y5)/ &2 + y3*(y1*y1 + y2*y2 - y6*y6)/ &2 in + &2 * atn2( &2 * a, sqrt (delta_y y1 y2 y3 y4 y5 y6)))`;; + +let sol_euler_y = `sol_euler_y = y_of_x sol_euler_x`;; +*) + + +(* +let acs_sqrt_x1 = new_definition `acs_sqrt_x1 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + acs (sqrt(x1))`;; + +let acs_sqrt_x2 = new_definition `acs_sqrt_x2 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + acs (sqrt(x2))`;; +*) + + +(* deprecated + +let solRy = new_definition `solRy y1 y2 y6 c = solR (y1/ &2) (eta_y y1 y2 y6) c`;; + +let dihRy = new_definition `dihRy y1 y2 y6 c = dihR (y1/ &2) (eta_y y1 y2 y6) c`;; +*) + +(* deprecated *) + +let arclength_x_345 = new_definition `arclength_x_345 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = arclength (sqrt x3) (sqrt x4) (sqrt x5)`;; + + +(* +let tauq_x = new_definition + `tauq_x x1 x2 x3 x4 x5 x6 x7 x8 x9 = + tauq (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) (sqrt x7) (sqrt x8) (sqrt x9)`;; +*) + + +let taum_hexall_x = new_definition + `taum_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 (x6:real) = + taum_x x1 x3 x4 x5 x14 (edge_flat2_x x2 x1 x3 (&0) x23 x12) + + flat_term_x x2`;; + + +(* deprecated *) + +let dih_hexall_x = new_definition `dih_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 (x6:real) = + dih_x x1 x2 x4 ((&2 * h0) pow 2) x14 x12 - + dih_x x1 x3 x4 x5 x14 (edge_flat2_x x2 x1 x3 (&0) x23 x12)`;; + +let dih1_hexall_x = new_definition `dih1_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 (x6:real) = + dih_x x1 x3 x4 x5 x14 (edge_flat2_x x2 x1 x3 (&0) x23 x12)`;; + +let upper_dih_hexall_x = new_definition `upper_dih_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 (x6:real) = + dih_x x1 x2 x4 ((&2 * h0) pow 2) x14 x12 - + upper_dih_x x1 x3 x4 x5 x14 (edge_flat2_x x2 x1 x3 (&0) x23 x12)`;; + +let delta_hexall_x = new_definition `delta_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 (x6:real) = + delta_x x1 x3 x4 x5 x14 (edge_flat2_x x2 x1 x3 (&0) x23 x12)`;; + +let delta4_hexall_x = new_definition `delta4_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 (x6:real) = + delta_x4 x1 x3 x4 x5 x14 (edge_flat2_x x2 x1 x3 (&0) x23 x12)`;; + +(* +let euler_ap = new_definition `euler_ap y1 y2 y3 y4 y5 y6 = + y1*y2*y3 + y1*(y2*y2 + y3*y3 - y4*y4)/ &2 + y2*(y1*y1 + y3*y3 - y5*y5)/ &2 + + y3*(y1*y1 + y2*y2 - y6*y6)/ &2`;; +*) + +let eulerA_hexall_x = new_definition `eulerA_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 (x6:real) = + eulerA_x x1 x3 x4 x5 x14 (edge_flat2_x x2 x1 x3 (&0) x23 x12)`;; + + +let factor345_hexall_x = new_definition `factor345_hexall_x c (x1:real) (x2:real) x3 x4 x5 (x6:real) = + x5 -x3 -x4 + &2 * c * sqrt(x3) * sqrt(x4)`;; + +let law_cosines_234_x = new_definition + `law_cosines_234_x c (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + x4 -x2 -x3 + &2 * c * sqrt(x2) * sqrt(x3)`;; + +let law_cosines_126_x = new_definition + `law_cosines_126_x c (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + x6 -x1 -x2 + &2 * c * sqrt(x1) * sqrt(x2)`;; + +(* -- not used +let taum_sub156_x = new_definition + `taum_sub156_x x1s x5s x6s (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + taum_x x1s x2 x3 x4 x5s x6s`;; +*) + + +(* DEPRECATED. +let tau_nullform_x = new_definition + `tau_nullform_x x1 x2 x3 x4 x5 x6 = + rho (sqrt x1) * pi - (pi + sol0) + + sqp(delta_x x1 x2 x3 x4 x5 x6) * tau_residual_x x1 x2 x3 x4 x5 x6`;; +*) + + +(* deprecated *) + +let delta_template_B_x = new_definition + `delta_template_B_x x15 x45 x34 x12 x1 x2 x3 x4 x5 (x6:real) = + (let x23 = x12 in + let x13 = edge_flat2_x x2 x1 x3 (&0) x23 x12 in + let x14 = edge_flat2_x x5 x1 x4 (&0) x45 x15 in + (delta_x x1 x3 x4 x34 x14 x13))`;; + + +let dih_template_B_x = new_definition + `dih_template_B_x x15 x45 x34 x12 x25 x1 x2 x3 x4 x5 (x6:real) = + (let x23 = x12 in + let x13 = edge_flat2_x x2 x1 x3 (&0) x23 x12 in + let x14 = edge_flat2_x x5 x1 x4 (&0) x45 x15 in + (dih_x x1 x2 x5 x25 x15 x12 - dih_x x1 x3 x4 x34 x14 x13))`;; + +let taum_template_B_x = new_definition + `taum_template_B_x x15 x45 x34 x12 x1 x2 x3 x4 x5 (x6:real) = + (let x23 = x12 in + let x13 = edge_flat2_x x2 x1 x3 (&0) x23 x12 in + let x14 = edge_flat2_x x5 x1 x4 (&0) x45 x15 in + (taum_x x1 x3 x4 x34 x14 x13 +flat_term_x x2 + flat_term_x x5))`;; + + + +(* No longer needed.... deprecated. *) +let delta_top_x = new_definition + `delta_top_x (a:real) (x1:real) (x2:real) (x3:real) (x4:real) + (x5:real) (x6:real) (x7:real) (x8:real) (x9:real) = + delta_y (sqrt x4) (sqrt x9) (sqrt x6) a (sqrt x5) (sqrt x8)`;; + + +(* tau_lowform_x intended for use when dih1 > pi/2, dih2, dih3 < pi/2, + tau_residual <0, + Then tau_lowform_x is a lower bound on tau (that is graceful when delta->0). +*) + +let tau_lowform_x = new_definition + `tau_lowform_x x1 x2 x3 x4 x5 x6 = + (let d = delta_x x1 x2 x3 x4 x5 x6 in + (rho (sqrt x1) * pi - (pi + sol0) + + sqp d * rhazim_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 + + sqn d * rhazim2_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 + + sqn d * rhazim3_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6))`;; + + +let tau_m_diff_quotient = new_definition + `tau_m_diff_quotient (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) = + (let eps = #0.000001 in + (taum (y1 + eps) y2 y3 y4 y5 y6 - taum y1 y2 y3 y4 y5 y6)/eps)`;; + +let tau_m_diff_quotient2 = new_definition + `tau_m_diff_quotient2 (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) = + (let eps = #0.000001 in + (taum (y1 + eps) y2 y3 y4 y5 y6 - taum y1 y2 y3 y4 y5 y6 + + taum (y1 - eps) y2 y3 y4 y5 y6)/(eps pow 2))`;; + +(* deleted 2013-08-18 *) + +let delta_y_LC = new_definition +`delta_y_LC (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) = + delta_y y1 y2 y3 y4 y5 y6`;; + +let mardih_x = new_definition `mardih_x x1 x2 x3 x4 x5 x6 = + marchal_quartic (sqrt x1 / #2.0) * dih_x x1 x2 x3 x4 x5 x6`;; + +let mardih2_x = new_definition `mardih2_x x1 x2 x3 x4 x5 x6 = + marchal_quartic (sqrt x2 / #2.0) * dih2_x x1 x2 x3 x4 x5 x6`;; + +let mardih3_x = new_definition `mardih3_x x1 x2 x3 x4 x5 x6 = + marchal_quartic (sqrt x3 / #2.0) * dih3_x x1 x2 x3 x4 x5 x6`;; + +let mardih4_x = new_definition `mardih4_x x1 x2 x3 x4 x5 x6 = + marchal_quartic (sqrt x4 / #2.0) * dih4_x x1 x2 x3 x4 x5 x6`;; + +let mardih5_x = new_definition `mardih5_x x1 x2 x3 x4 x5 x6 = + marchal_quartic (sqrt x5 / #2.0) * dih5_x x1 x2 x3 x4 x5 x6`;; + +let mardih6_x = new_definition `mardih6_x x1 x2 x3 x4 x5 x6 = + marchal_quartic (sqrt x6 / #2.0) * dih6_x x1 x2 x3 x4 x5 x6`;; + +(* c++ associations: + ("mardih_x","marchalDih"); ("mardih2_x","marchalDih2"); + ("mardih3_x","marchalDih3"); + ("mardih4_x","marchalDih4"); ("mardih5_x","marchalDih5"); + ("mardih6_x","marchalDih6"); +*) + +(* +(* +num1 is based on the following Mathematica calculation. It is the +numerator of the a-partial derivative of taumarE. +num2 is the numerator of second a-partial +formal proof: derived_form_sum_dih444 +*) + +taumarE = e1 Dihedral[2, 2, 2, a, b, c] + e2 Dihedral[2, 2, 2, b, c, a] + + e3 Dihedral[2, 2, 2, c, a, b]; + +afac = a (16 - a^2); +sd = Sqrt[Delta[2, 2, 2, a, b, c]]; +abcsub = {a -> 2.1, b -> 2.2, c -> 2.3, e1 -> 5.5, e2 -> 5.6, + e3 -> 5.7, ssd -> sd, aafac -> afac}; +abcsq = {a -> Sqrt[a2], b -> Sqrt[b2], c -> Sqrt[c2]}; + + +taumarE1 = 4 a afac e1/(aafac ssd); +taumarE2 = 4 (-8 b^2 + a^2 (-8 + b^2) + 8 c^2) e2/(aafac ssd) ; +taumarE3 = 4 (-8 c^2 + a^2 (-8 + c^2) + 8 b^2) e3/(aafac ssd); +(D[taumarE, a] - taumarE1 - taumarE2 - taumarE3 //. abcsub) // Chop (*0*) + +num1e = aafac ssd (taumarE1 + taumarE2 + taumarE3) // Together // Simplify; +num1sqI = -4*(a2^2*e1 + 8*( + b2 - c2)*(e2 - e3) - a2*(16*e1 + (-8 + b2)*e2 + (-8 + c2)*e3)); (* num1 + in sphere.hl *) +(num1e /. abcsq) - num1sqI (*0*) + +(* second derivatives *) +taumarE1D2calc = D[Dihedral[2, 2, 2, a, b, c], {a, + 2}] // Together // Simplify; +taumarE1D2 = -(16*(-a^4 + (b^2 - c^2)^2)) afac^2 /(aafac^2 ssd^3); +(taumarE1D2calc - taumarE1D2 //. abcsub) // Chop + + + +taumarE2D2calc = D[Dihedral[2, 2, 2, b, c, a], {a, 2}] // Together // + Simplify; +taumarE2D2 = -(8*(6*a^8*(-8 + b^2) + 256*( + b^2 - c^2)^3 + a^6*(b^4*(-8 + c^2) - 16*b^2*(3 + c^2) + 16*( + 16 + 9*c^2)) - 16*a^2*(b^6 + b^4*( + 80 - 13*c^2) - 3*c^4*(16 + c^2) + b^2* + c^2*(-32 + + 15*c^2)) + 2*a^4*(b^6 + b^4*(56 - + 10*c^2) - 24*c^2*(16 + 3*c^2) + b^2*( + 384 + 16*c^2 + 9*c^4))))/(aafac^2 ssd^3); +(taumarE2D2calc - taumarE2D2 //. abcsub) // Chop + +taumarE3D2calc = D[Dihedral[2, 2, 2, c, a, b], {a, + 2}] // Together // Simplify; +taumarE3D2 = -(8*(-256*(b^2 - c^2)^3 + 6*a^8*(-8 + c^2) + 16*a^2* + (3*b^6 + b^4*(48 - 15*c^2) - c^4*(80 + c^2) + b^2* + c^2*(32 + 13*c^2)) + + a^6*(b^2*(144 - 16*c^2 + c^4) - 8*(-32 + 6*c^2 + c^4)) + 2* +a^4*(9*b^4*(-8 + c^2) + c^2*(384 + 56*c^2 + c^4) - 2*b^2*(192 - 8* + c^2 + 5*c^4))))/(aafac^2 ssd^3); +(taumarE3D2calc - taumarE3D2 //. abcsub) // Chop + +taumarD2num = (e1 taumarE1D2 + e2 taumarE2D2 + e3 + taumarE3D2) (aafac^2 ssd^3) // Simplify +taumarD2numDef = (taumarD2num /. abcsq) // HolForm; (* num2 in sphere.hl *) + +(((D[taumarE, {a, 2}]) aafac^2 ssd^3 - taumarD2num) //. abcsub) // Chop + +(* analysis near a2 -> 16 *) +{"near a2->16", DeltaX[4, + 4, 4, 16, b2, c2] // Factor, (num1sqI /. a2 -> 16) // Factor, + ((taumarD2num /. abcsq) /. a2 -> 16) // Factor} + + +*) +let num2 = new_definition `num2 e1 e2 e3 a2 b2 c2 = + (&8 * ((&2 * ((a2 pow 5) * e1)) + (((-- &256) * (((b2 + ((-- &1) * c2)) pow 3) + * (e2 + ((-- &1) * e3)))) + (((-- &1) * ((a2 pow 3) * ((&2 * (((-- &256) + + ((b2 pow 2) + (((-- &2) * (b2 * c2)) + (c2 pow 2)))) * e1)) + (((((b2 pow 2) + * ((-- &8) + c2)) + (((-- &16) * (b2 * (&3 + c2))) + (&16 * (&16 + (&9 * + c2))))) * e2) + (((b2 * (&144 + (((-- &16) * c2) + (c2 pow 2)))) + ((-- &8) * + ((-- &32) + ((&6 * c2) + (c2 pow 2))))) * e3))))) + (((a2 pow 4) * (((-- &64) + * e1) + ((-- &6) * ((((-- &8) + b2) * e2) + (((-- &8) + c2) * e3))))) + (((-- + &2) * ((a2 pow 2) * ((b2 + ((-- &1) * c2)) * (((b2 pow 2) * e2) + ((&8 * (c2 + * ((&4 * e1) + ((&9 * e2) + ((-- &7) * e3))))) + ((&384 * (e2 + ((-- &1) * + e3))) + (((-- &1) * ((c2 pow 2) * e3)) + (b2 * (((-- &32) * e1) + (((&56 + + ((-- &9) * c2)) * e2) + (&9 * (((-- &8) + c2) * e3)))))))))))) + (&16 * (a2 * + ((b2 + ((-- &1) * c2)) * (((b2 pow 2) * (e2 + ((-- &3) * e3))) + (((-- &4) * + (b2 * ((&8 * e1) + ((((-- &20) + (&3 * c2)) * e2) + ((-- &3) * (((-- &4) + + c2) * e3)))))) + (c2 * ((&32 * e1) + ((&3 * ((&16 + c2) * e2)) + ((-- &1) * + ((&80 + c2) * e3))))))))))))))))`;; + +let rat1 = new_definition `rat1 e1 e2 e3 a2 b2 c2 = + num1 e1 e2 e3 a2 b2 c2 / + (sqrt(delta_x (&4) (&4) (&4) a2 b2 c2) * sqrt(a2) * (&16 - a2))`;; + +let rat2 = new_definition `rat2 e1 e2 e3 a2 b2 c2 = + num2 e1 e2 e3 a2 b2 c2 / + (((sqrt(delta_x (&4) (&4) (&4) a2 b2 c2)) pow 3) * a2 * ((&16 - a2) pow 2))`;; + +(* num1^2 - #0.01 * num2 *) + +let num_combo1 = new_definition `num_combo1 e1 e2 e3 a2 b2 c2 = +((&2 / &25) * (((-- &2) * ((a2 pow 5) * e1)) + ((&256 * (((b2 + ((-- &1) * +c2)) pow 3) * (e2 + ((-- &1) * e3)))) + (((a2 pow 3) * ((&2 * (((-- &256) + +((b2 pow 2) + (((-- &2) * (b2 * c2)) + (c2 pow 2)))) * e1)) + (((((b2 pow 2) +* ((-- &8) + c2)) + (((-- &16) * (b2 * (&3 + c2))) + (&16 * (&16 + (&9 * +c2))))) * e2) + (((b2 * (&144 + (((-- &16) * c2) + (c2 pow 2)))) + ((-- &8) * +((-- &32) + ((&6 * c2) + (c2 pow 2))))) * e3)))) + ((&2 * ((a2 pow 4) * ((&32 +* e1) + (&3 * ((((-- &8) + b2) * e2) + (((-- &8) + c2) * e3)))))) + ((&200 * +((((a2 pow 2) * e1) + ((&8 * ((b2 + ((-- &1) * c2)) * (e2 + ((-- &1) * e3)))) ++ ((-- &1) * (a2 * ((&16 * e1) + ((((-- &8) + b2) * e2) + (((-- &8) + c2) * +e3))))))) pow 2)) + ((&2 * ((a2 pow 2) * ((b2 + ((-- &1) * c2)) * (((b2 pow 2) +* e2) + ((&8 * (c2 * ((&4 * e1) + ((&9 * e2) + ((-- &7) * e3))))) + ((&384 * +(e2 + ((-- &1) * e3))) + (((-- &1) * ((c2 pow 2) * e3)) + (b2 * (((-- &32) * +e1) + (((&56 + ((-- &9) * c2)) * e2) + (&9 * (((-- &8) + c2) * +e3)))))))))))) + ((-- &16) * (a2 * ((b2 + ((-- &1) * c2)) * (((b2 pow 2) * +(e2 + ((-- &3) * e3))) + (((-- &4) * (b2 * ((&8 * e1) + ((((-- &20) + (&3 * +c2)) * e2) + ((-- &3) * (((-- &4) + c2) * e3)))))) + (c2 * ((&32 * e1) + ((&3 +* ((&16 + c2) * e2)) + ((-- &1) * ((&80 + c2) * e3)))))))))))))))))`;; + +(* x_A is a special case of x_C: *) + +(* +let truncate_gamma23_x_A = new_definition `truncate_gamma23_x_A iw1 m1 m2 m6 = + scalar6 + (compose6 (truncate_gamma3f_x (#0.14) m1 m2 m6) + dummy6 dummy6 dummy6 proj_x1 proj_x2 proj_x6) + iw1 + + (dih_x - (mk_126 (truncate_dih_x (#0.14)) + constant6 (#0.08))) * + uni((truncate_gamma2_x m1), proj_x1)`;; +*) + +let truncate_gamma23_x_C = new_definition `truncate_gamma23_x_C d iw1 m1 m2 m6 = + scalar6 + (compose6 (truncate_gamma3f_x (#0.14) m1 m2 m6) + dummy6 dummy6 dummy6 proj_x1 proj_x2 proj_x6) + iw1 + + (dih_x - (mk_126 (truncate_dih_x (#0.14)) + constant6 (d))) * + uni((truncate_gamma2_x m1), proj_x1)`;; + + +let truncate_gamma23_x_B = new_definition + `truncate_gamma23_x_B m1 = + (dih_x - constant6 (&2 * #0.08)) * + uni((truncate_gamma2_x m1),proj_x1)`;; + +(* function truncate_gamma2_x deprecated. It is incorrect. See gamma2_x_div_azim_v2 *) +let truncate_gamma2_x = + new_definition `truncate_gamma2_x m x = (&8 - x)* sqrt x / (&24) - + ( (&2 * mm1/ pi) * (&1 - sqrt x / sqrt8) - + (&8 * mm2 / pi) * m * lfun (sqrt x / &2))`;; + +let truncate_gamma3f_x = new_definition `truncate_gamma3f_x d m4 m5 m6 = + truncate_vol3r_456 d - + truncate_vol3f d m4 m5 m6`;; + +let truncate_gamma23_x = new_definition `truncate_gamma23_x iw1 iw2 m1 m2 m3 m5 m6 = + scalar6 + (compose6 (truncate_gamma3f_x (#0.14) m1 m2 m6) + dummy6 dummy6 dummy6 proj_x1 proj_x2 proj_x6) + iw1 + + scalar6 + (compose6 (truncate_gamma3f_x (#0.14) m1 m3 m5) + dummy6 dummy6 dummy6 proj_x1 proj_x3 proj_x5) + iw2 + + (dih_x - + (mk_126 (truncate_dih_x (#0.14)) + + mk_135 (truncate_dih_x (#0.14)))) * + uni((truncate_gamma2_x m1),proj_x1)`;; + +(* version for large azimuth angles *) +let truncate_gamma23a_x = new_definition ` + truncate_gamma23a_x iw1 iw2 m1 m2 m3 m5 m6 x1 x2 x3 az4 x5 x6 = + truncate_gamma3f_x (&0) m1 m2 m6 (&0) (&0) (&0) x1 x2 x6 * iw1 + + truncate_gamma3f_x (&0) m1 m3 m5 (&0) (&0) (&0) x1 x3 x5 * iw2 + + (az4 - + (dih_x x1 x2 (&2) (&2) (&2) x6 + + dih_x x1 (&2) x3 (&2) x5 (&2))) * + truncate_gamma2_x m1 x1`;; + +let truncate_gamma2_x = + new_definition `truncate_gamma2_x m x = (&8 - x)* sqrt x / (&24) - + ( (&2 * mm1/ pi) * (&1 - sqrt x / sqrt8) - + (&8 * mm2 / pi) * m * lfun (sqrt x / &2))`;; + +let truncate_gamma3f_x = new_definition `truncate_gamma3f_x d m4 m5 m6 = + truncate_vol3r_456 d - + truncate_vol3f d m4 m5 m6`;; + +let truncate_gamma23_x = new_definition `truncate_gamma23_x iw1 iw2 m1 m2 m3 m5 m6 = + scalar6 + (compose6 (truncate_gamma3f_x (#0.14) m1 m2 m6) + dummy6 dummy6 dummy6 proj_x1 proj_x2 proj_x6) + iw1 + + scalar6 + (compose6 (truncate_gamma3f_x (#0.14) m1 m3 m5) + dummy6 dummy6 dummy6 proj_x1 proj_x3 proj_x5) + iw2 + + (dih_x - + (mk_126 (truncate_dih_x (#0.14)) + + mk_135 (truncate_dih_x (#0.14)))) * + uni((truncate_gamma2_x m1),proj_x1)`;; + +(* version for large azimuth angles *) +let truncate_gamma23a_x = new_definition ` + truncate_gamma23a_x iw1 iw2 m1 m2 m3 m5 m6 x1 x2 x3 az4 x5 x6 = + truncate_gamma3f_x (&0) m1 m2 m6 (&0) (&0) (&0) x1 x2 x6 * iw1 + + truncate_gamma3f_x (&0) m1 m3 m5 (&0) (&0) (&0) x1 x3 x5 * iw2 + + (az4 - + (dih_x x1 x2 (&2) (&2) (&2) x6 + + dih_x x1 (&2) x3 (&2) x5 (&2))) * + truncate_gamma2_x m1 x1`;; + +let truncate_sqrt = new_definition ` + truncate_sqrt c x = if (x <= c) then sqrt(c) else sqrt(x)`;; + +let truncate_dih_x = new_definition(`truncate_dih_x c x1 x2 x3 x4 x5 x6 = + let d_x4 = delta_x4 x1 x2 x3 x4 x5 x6 in + let d = delta_x x1 x2 x3 x4 x5 x6 in + pi/ (&2) + atn2( (sqrt ((&4) * x1) * truncate_sqrt c d),-- d_x4)`);; + +let truncate_sol_x = new_definition + `truncate_sol_x c = truncate_dih_x c + + (rotate2 (truncate_dih_x c)) + + (rotate3 (truncate_dih_x c)) - constant6 (pi)`;; + + + + + +let truncate_vol_x =new_definition + `truncate_vol_x c = scalar6 (uni((truncate_sqrt c),delta_x)) (&1 / &12)`;; + +let truncate_vol3r_456 = new_definition `truncate_vol3r_456 c = + mk_456 (truncate_vol_x c)`;; + +(* new 6/18 *) + +let truncate_vol3f = new_definition `truncate_vol3f c m4 m5 m6 = + scalar6 ( mk_456 (rotate5 (truncate_sol_x c)) + + mk_456 (rotate6 (truncate_sol_x c)) + + mk_456 (rotate4 (truncate_sol_x c)) + ) (&2 * mm1/ pi) + - + scalar6 ( + (scalar6 (uni(lfun,(scalar6 proj_y4 #0.5))) m4) * + mk_456 (rotate4 (truncate_dih_x c)) + + (scalar6 (uni(lfun,(scalar6 proj_y5 #0.5))) m5) * + mk_456 (rotate5 (truncate_dih_x c)) + + (scalar6 (uni(lfun,(scalar6 proj_y6 #0.5))) m6) * + mk_456 (rotate6 (truncate_dih_x c)) + ) (&8 * mm2 / pi)`;; + +let truncate_sqrt = new_definition ` + truncate_sqrt c x = if (x <= c) then sqrt(c) else sqrt(x)`;; + +let truncate_dih_x = new_definition(`truncate_dih_x c x1 x2 x3 x4 x5 x6 = + let d_x4 = delta_x4 x1 x2 x3 x4 x5 x6 in + let d = delta_x x1 x2 x3 x4 x5 x6 in + pi/ (&2) + atn2( (sqrt ((&4) * x1) * truncate_sqrt c d),-- d_x4)`);; + +let truncate_sol_x = new_definition + `truncate_sol_x c = truncate_dih_x c + + (rotate2 (truncate_dih_x c)) + + (rotate3 (truncate_dih_x c)) - constant6 (pi)`;; + +let truncate_vol_x =new_definition + `truncate_vol_x c = scalar6 (uni((truncate_sqrt c),delta_x)) (&1 / &12)`;; + +let truncate_vol3r_456 = new_definition `truncate_vol3r_456 c = + mk_456 (truncate_vol_x c)`;; + + +(* new 6/18 *) + +let truncate_vol3f = new_definition `truncate_vol3f c m4 m5 m6 = + scalar6 ( mk_456 (rotate5 (truncate_sol_x c)) + + mk_456 (rotate6 (truncate_sol_x c)) + + mk_456 (rotate4 (truncate_sol_x c)) + ) (&2 * mm1/ pi) + - + scalar6 ( + (scalar6 (uni(lfun,(scalar6 proj_y4 #0.5))) m4) * + mk_456 (rotate4 (truncate_dih_x c)) + + (scalar6 (uni(lfun,(scalar6 proj_y5 #0.5))) m5) * + mk_456 (rotate5 (truncate_dih_x c)) + + (scalar6 (uni(lfun,(scalar6 proj_y6 #0.5))) m6) * + mk_456 (rotate6 (truncate_dih_x c)) + ) (&8 * mm2 / pi)`;; + +(* in delta_pent_x: nonstandard ordering of variables, x6 swapped with x3 *) + +let delta_pent_x = new_definition + `delta_pent_x (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + delta_x x1 x2 x6 (&4) (&4) (#3.24 pow 2)`;; + + + + + +(* + +Upper approximation to Sqrt on [0,1]: + +sqp = 3/8 + (3*x)/4 - x^2/8 + (1 - x)^3 (0.7 x - 0.25); + +Sqp[x_]:= If[x<1,3/8 + (3*x)/4 - x^2/8 + (1 - x)^3 (0.7 x - 0.25),Sqrt[x]]; + +DeltaX4[x1_, x2_, x3_, x4_, x5_, x6_] := -(x2*x3) - x1*x4 + + x2*x5 + x3*x6 - x5*x6 + x1*(-x1 + x2 + x3 - x4 + x5 + x6); + +Matan[x_] := ArcTan[Sqrt[x]]/Sqrt[x]; + +UpperDihX[x1_, x2_, x3_, x4_, x5_, x6_] := Module[{d, d4}, + d = DeltaX[x1, x2, x3, x4, x5, x6]; + d4 = DeltaX4[x1, x2, x3, x4, x5, x6]; + 2 Sqrt[x1] Sqp[d]/d4 * Matan[4 x1 d/d4^2]]; + +UpperDihY[y1_, y2_, y3_, y4_, y5_, y6_] := + UpperDihX @@ ({y1, y2, y3, y4, y5, y6}^2); + +Lower approx to sqrt on [0,1]: + +sqn = 3/8 + (3*x)/4 - x^2/8 + (1 - x)^3 (1.3 x (1 - x) - 3/8) - 0.3 x^2(1 - x)^3; + +Thm: if y1,y2,y3 >= 2, then Dihedral[sqrt2,y1,y2,y3,sqrt2,sqrt2] >= pi/2, + (and delta_x4 <= 0). Proof: Imagine the cube of side sqrt2. qed. + The case of equality delta_x4=0 occurs when y3=2, and y1 or y2=2. +Thm: if y1,y2,y3 in [2,sqrt8], then Dihedral[y1,y2,sqrt2,sqrt2,sqrt2,y6] <= pi/2 + (and delta_x4 >= 0). Proof. The triangle y1,y2,y3 is acute, so the circumcenter lands inside. +*) + +let sqp = new_definition `sqp x = + if (x < &1) then + &3 / &8 + (&1 - x) pow 3 * (-- #0.25 + #0.7 * x) + + &3 * x / &4 - x * x/ &8 else sqrt x`;; + +let sqn = new_definition `sqn x = + if (x < &1) + then #0.375 + (&3*x)/ &4 - (x pow 2)/ &8 - #0.3*((&1 - x) pow 3)*(x pow 2) + + ((&1 - x) pow 3)*(-- #0.375 + #1.3*(&1 - x)*x) + else sqrt x`;; + +(* upper bound on dih (when delta_x4 > 0), useful when delta is near 0 and angle is near 0. + Also pi + upper_dih_x is a lower bound on dih when (delta_x4 < 0), useful when delta is + near 0 and angle is near pi. *) + +let upper_dih_x = new_definition `upper_dih_x x1 x2 x3 x4 x5 x6 = + (let d = delta_x x1 x2 x3 x4 x5 x6 in + let d4 = delta_x4 x1 x2 x3 x4 x5 x6 in ( + &2 * sqrt x1 * sqp d * + matan (&4 * x1 * d / (d4 pow 2) ) / d4))`;; + +let upper_dih_y = new_definition `upper_dih_y = y_of_x upper_dih_x`;; + +let gamma3f_135_n = new_definition `gamma3f_135_n y1 y2 y3 y4 y5 y6 = + sqn(delta_y y1 y2 y3 y4 y5 y6) * (&1 / &12 - + ( (&2 * mm1 / pi) * + (y_of_x sol_euler_x_div_sqrtdelta y1 y2 y3 y4 y5 y6 + + y_of_x sol_euler156_x_div_sqrtdelta y1 y2 y3 y4 y5 y6 + + y_of_x sol_euler345_x_div_sqrtdelta y1 y2 y3 y4 y5 y6) - + (&8 * mm2 / pi) * + (y_of_x lmdih_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 + + y_of_x lmdih3_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 + + y_of_x lmdih5_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6) + ))`;; + +let gamma3f_126_n = new_definition `gamma3f_126_n y1 y2 y3 y4 y5 y6 = + sqn(delta_y y1 y2 y3 y4 y5 y6) * (&1 / &12 - + ( (&2 * mm1 / pi) * + (y_of_x sol_euler_x_div_sqrtdelta y1 y2 y3 y4 y5 y6 + + y_of_x sol_euler246_x_div_sqrtdelta y1 y2 y3 y4 y5 y6 + + y_of_x sol_euler156_x_div_sqrtdelta y1 y2 y3 y4 y5 y6) - + (&8 * mm2 / pi) * + (y_of_x lmdih_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 + + y_of_x lmdih2_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 + + y_of_x lmdih6_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6) + ))`;; + +let gamma23f_n = new_definition `gamma23f_n y1 y2 y3 y4 y5 y6 w1 w2 r f = + gamma3f_126_n y1 y2 sqrt2 sqrt2 sqrt2 y6 / &w1 + + gamma3f_135_n y1 sqrt2 y3 sqrt2 y5 sqrt2 / &w2 + + (dih_y y1 y2 y3 y4 y5 y6 - + upper_dih_y y1 y2 r r r y6 - + upper_dih_y y1 y3 r r r y5) * + (vol2r y1 r - vol2f y1 r f) / (&2 * pi)`;; + +let gamma23f_126_03_n = new_definition + `gamma23f_126_03_n y1 y2 y3 y4 y5 y6 w1 r f = + gamma3f_126_n y1 y2 sqrt2 sqrt2 sqrt2 y6 / &w1 + + (dih_y y1 y2 y3 y4 y5 y6 - upper_dih_y y1 y2 r r r y6 - #0.03) * + (vol2r y1 r - vol2f y1 r f) / (&2 * pi)`;; + + +let euler_3flat_x = new_definition + `euler_3flat_x x1 x2 x3 x23 x13 x12 = +let x5 = edge_flat2_x x13 x1 x3 (&0) (&4) (&4) in +let x6 = edge_flat2_x x12 x1 x2 (&0) (&4) (&4) in +let x4 = edge_flat2_x x23 x2 x3 (&0) (&4) (&4) in + (eulerA_x x1 x2 x3 x4 x5 x6)`;; + +let euler_2flat_x = new_definition + `euler_2flat_x x1 x2 x3 x4 x13 x12 = +let x5 = edge_flat2_x x13 x1 x3 (&0) (&4) (&4) in +let x6 = edge_flat2_x x12 x1 x2 (&0) (&4) (&4) in + (eulerA_x x1 x2 x3 x4 x5 x6)`;; + +let euler_1flat_x = new_definition + `euler_1flat_x x1 x2 x3 x4 x5 x12 = +let x6 = edge_flat2_x x12 x1 x2 (&0) (&4) (&4) in + (eulerA_x x1 x2 x3 x4 x5 x6)`;; + +let taum_3flat_x = new_definition + `taum_3flat_x x1 x2 x3 x23 x13 x12 = +let x5 = edge_flat2_x x13 x1 x3 (&0) (&4) (&4) in +let x6 = edge_flat2_x x12 x1 x2 (&0) (&4) (&4) in +let x4 = edge_flat2_x x23 x2 x3 (&0) (&4) (&4) in + (taum_x x1 x2 x3 x4 x5 x6 + flat_term_x x12 + flat_term_x x23 + flat_term_x x13)`;; + +let taum_2flat_x = new_definition + `taum_2flat_x x1 x2 x3 x4 x13 x12 = +let x5 = edge_flat2_x x13 x1 x3 (&0) (&4) (&4) in +let x6 = edge_flat2_x x12 x1 x2 (&0) (&4) (&4) in + (taum_x x1 x2 x3 x4 x5 x6 + flat_term_x x12 + flat_term_x x13)`;; + +let taum_1flat_x = new_definition + `taum_1flat_x x1 x2 x3 x4 x5 x12 = +let x6 = edge_flat2_x x12 x1 x2 (&0) (&4) (&4) in + (taum_x x1 x2 x3 x4 x5 x6 + flat_term_x x12)`;; + +(* DEPRECATED 2013-05-25. +let sphere= new_definition`sphere x=(?(v:real^3)(r:real). (r> &0)/\ (x={w:real^3 | norm (w-v)= r}))`;; +*) + +(* deprecated 2013-2-13. +let beta = new_definition(`beta psi theta = + let arg = ((cos psi)*(cos psi) - (cos theta)*(cos theta))/ + ((&1) - (cos theta)*(cos theta)) in + (acs (sqrt arg))`);; +*) + +(* deprecated 2013-2-13. +let radius = new_definition `radius (x,y) = sqrt((x pow 2) + (y pow 2))`;; +*) + + + + +(* DEPRECATED added May 11, 2013. x4 st. delta_x = 50, removed May 24, 2013. +let edge_flat50 = new_definition`edge_flat50 y1 y2 y3 y5 y6 = + sqrt(quadratic_root_plus (abc_of_quadratic ( + \x4. &50 - delta_x (y1*y1) (y2*y2) (y3*y3) x4 (y5*y5) (y6*y6))))`;; + +let edge_flat250_x = new_definition `edge_flat250_x x1 x2 x3 x4 x5 x6 = + (edge_flat (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x5) (sqrt x6)) pow 2`;; (* x4 dummy *) + +let edge_flat50_x = new_definition`edge_flat50_x x1 x2 x3 (x4:real) x5 x6 = + edge_flat (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x5) (sqrt x6)`;; +*) + +(* deprecated, Dec 1, 2012 , replaced with beta_bumpA_y *) + +(* +let beta_bump_y = new_definition `beta_bump_y y1 y2 y3 y4 y5 y6 = + (if critical_edge_y y1 then &1 else &0) * + (if critical_edge_y y2 then &0 else &1) * + (if critical_edge_y y3 then &0 else &1) * + (if critical_edge_y y4 then &1 else &0) * + (if critical_edge_y y5 then &0 else &1) * + (if critical_edge_y y6 then &0 else &1) * + (bump (y1/ &2) - bump (y4 / &2))`;; +*) + + + +(* + let delta_x6 = new_definition + `delta_x6 x1 x2 x3 x4 x5 x6 = -- x1 *x2 + x1 *x4 + x2* x5 - x4* x5 + x3* (x1 + x2 - x3 + x4 + x5 - x6) - + x3 * x6`;; +*) + + + +let gamma3f_135_s_n = new_definition `gamma3f_135_s_n y1 y2 y3 y4 y5 y6 = + sqn(delta_y y1 y2 y3 y4 y5 y6) * (&1 / &12 - + (&2 * mm1 / pi) * + (y_of_x sol_euler_x_div_sqrtdelta y1 y2 y3 y4 y5 y6 + + y_of_x sol_euler156_x_div_sqrtdelta y1 y2 y3 y4 y5 y6 + + y_of_x sol_euler345_x_div_sqrtdelta y1 y2 y3 y4 y5 y6) )`;; + +let gamma3f_126_s_n = new_definition `gamma3f_126_s_n y1 y2 y3 y4 y5 y6 = + sqn(delta_y y1 y2 y3 y4 y5 y6) * (&1 / &12 - + (&2 * mm1 / pi) * + (y_of_x sol_euler_x_div_sqrtdelta y1 y2 y3 y4 y5 y6 + + y_of_x sol_euler246_x_div_sqrtdelta y1 y2 y3 y4 y5 y6 + + y_of_x sol_euler156_x_div_sqrtdelta y1 y2 y3 y4 y5 y6) )`;; + +let lmdih_x_n = new_definition `lmdih_x_n x1 x2 x3 x4 x5 x6 = + sqn (delta_x x1 x2 x3 x4 x5 x6) * lmdih_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let lmdih2_x_n = new_definition `lmdih2_x_n x1 x2 x3 x4 x5 x6 = + sqn (delta_x x1 x2 x3 x4 x5 x6) * lmdih2_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let lmdih3_x_n = new_definition `lmdih3_x_n x1 x2 x3 x4 x5 x6 = + sqn (delta_x x1 x2 x3 x4 x5 x6) * lmdih3_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let lmdih5_x_n = new_definition `lmdih5_x_n x1 x2 x3 x4 x5 x6 = + sqn (delta_x x1 x2 x3 x4 x5 x6) * lmdih5_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let lmdih6_x_n = new_definition `lmdih6_x_n x1 x2 x3 x4 x5 x6 = + sqn (delta_x x1 x2 x3 x4 x5 x6) * lmdih6_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let gamma3f_vLR_n = new_definition `gamma3f_vLR_n y1 y2 y3 y4 y5 y6 f = + (dih_y y1 y2 y3 y4 y5 y6 - + upper_dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - + upper_dih_y y1 y3 sqrt2 sqrt2 sqrt2 y5) * + (vol2r y1 sqrt2 - vol2f y1 sqrt2 f) / (&2 * pi)`;; + +let gamma3f_vL_n = new_definition `gamma3f_vL_n y1 y2 y3 y4 y5 y6 f = + (dih_y y1 y2 y3 y4 y5 y6 - upper_dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - #0.03) * + (vol2r y1 sqrt2 - vol2f y1 sqrt2 f) / (&2 * pi)`;; + +let gamma3f_vLR_n0 = new_definition `gamma3f_vLR_n0 y1 y2 y3 y4 y5 y6 = + gamma3f_vLR_n y1 y2 y3 y4 y5 y6 (\x. &0)`;; + +let gamma3f_vLR_nlfun = new_definition `gamma3f_vLR_nlfun y1 y2 y3 y4 y5 y6 = + gamma3f_vLR_n y1 y2 y3 y4 y5 y6 lfun`;; + +let gamma3f_vL_n0 = new_definition `gamma3f_vL_n0 y1 y2 y3 y4 y5 y6 = + gamma3f_vL_n y1 y2 y3 y4 y5 y6 (\x. &0)`;; + +let gamma3f_vL_nlfun = new_definition `gamma3f_vL_nlfun y1 y2 y3 y4 y5 y6 = + gamma3f_vL_n y1 y2 y3 y4 y5 y6 lfun`;; + +let ldih_x_n = new_definition `ldih_x_n x1 x2 x3 x4 x5 x6 = + sqn(delta_x x1 x2 x3 x4 x5 x6) * ldih_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let ldih2_x_n = new_definition `ldih2_x_n x1 x2 x3 x4 x5 x6 = + sqn(delta_x x1 x2 x3 x4 x5 x6) * ldih2_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let ldih3_x_n = new_definition `ldih3_x_n x1 x2 x3 x4 x5 x6 = + sqn(delta_x x1 x2 x3 x4 x5 x6) * ldih3_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let ldih5_x_n = new_definition `ldih5_x_n x1 x2 x3 x4 x5 x6 = + sqn(delta_x x1 x2 x3 x4 x5 x6) * ldih5_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let ldih6_x_n = new_definition `ldih6_x_n x1 x2 x3 x4 x5 x6 = + sqn(delta_x x1 x2 x3 x4 x5 x6) * ldih6_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let gamma3f_vLR_x_nlfun = new_definition `gamma3f_vLR_x_nlfun x1 x2 x3 x4 x5 x6= + gamma3f_vLR_nlfun (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let gamma3f_vL_x_nlfun = new_definition `gamma3f_vL_x_nlfun x1 x2 x3 x4 x5 x6= + gamma3f_vL_nlfun (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let gamma3f_vLR_x_n0 = new_definition `gamma3f_vLR_x_n0 x1 x2 x3 x4 x5 x6= + gamma3f_vLR_n0 (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let gamma3f_vL_x_n0 = new_definition `gamma3f_vL_x_n0 x1 x2 x3 x4 x5 x6= + gamma3f_vL_n0 (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let gamma3f_135_x_s_n = new_definition + `gamma3f_135_x_s_n x1 (x2:real) x3 (x4:real) x5 (x6:real) = + gamma3f_135_s_n (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let gamma3f_126_x_s_n = new_definition + `gamma3f_126_x_s_n x1 (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + gamma3f_126_s_n (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let rr22 = REWRITE_RULE[GSYM sqrt2_sqrt2];; + +let ldih_x_126_n = rr22 (new_definition `ldih_x_126_n x1 x2 (x3:real) (x4:real) (x5:real) x6 = + ldih_x_n x1 x2 (&2) (&2) (&2) x6`);; + +(* +let ldih2_x_126_n = rr22 (new_definition +`ldih2_x_126_n_ x1 x2 (x3:real) (x4:real) (x5:real) x6 = + ldih2_x_n x1 x2 (&2) (&2) (&2) x6`);; +*) + +let ldih2_x_126_n = rr22 (new_definition +`ldih2_x_126_n x1 x2 (x3:real) (x4:real) (x5:real) x6 = + ldih2_x_n x1 x2 (&2) (&2) (&2) x6`);; + +let ldih6_x_126_n = rr22 (new_definition + `ldih6_x_126_n x1 x2 (x3:real) (x4:real) (x5:real) x6 = + ldih6_x_n x1 x2 (&2) (&2) (&2) x6`);; + +let ldih_x_135_n = rr22 (new_definition + `ldih_x_135_n x1 (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + ldih_x_n x1 (&2) x3 (&2) x5 (&2)`);; + +let ldih3_x_135_n = rr22 (new_definition +`ldih3_x_135_n x1 (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + ldih3_x_n x1 (&2) x3 (&2) x5 (&2)`);; + +let ldih5_x_135_n = rr22 (new_definition + `ldih5_x_135_n x1 (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + ldih5_x_n x1 (&2) x3 (&2) x5 (&2)`);; + +(* +let vol3f_sqrt2_lfun = new_definition + `vol3f_sqrt2_lfun y1 y2 (y3:real) (y4:real) (y5:real) y6 = + vol3f y1 y2 y6 sqrt2 lfun`;; +*) + +(* remaining splits *) + +let gamma3f_126 = new_definition + `gamma3f_126 (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) f = + gamma3f y1 y2 y6 sqrt2 f`;; + +let gamma3f_135 = new_definition + `gamma3f_135 (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) f = + gamma3f y1 y3 y5 sqrt2 f`;; + +let gamma3f_vLR = new_definition + `gamma3f_vLR (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) f = + (dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - dih_y y1 y3 sqrt2 sqrt2 sqrt2 y5) * + (vol2r y1 sqrt2 - vol2f y1 sqrt2 f)/(&2 * pi)`;; + +let gamma3f_vL = new_definition + `gamma3f_vL (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) f = + (dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - #0.03) * (vol2r y1 sqrt2 - vol2f y1 sqrt2 f)/(&2 * pi)`;; + +let gamma3f_v = new_definition + `gamma3f_v (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) f = + (dih_y y1 y2 y3 y4 y5 y6 - &2 * #0.03) * (vol2r y1 sqrt2 - vol2f y1 sqrt2 f)/(&2 * pi)`;; + + +let gamma23f_126_03 = new_definition `gamma23f_126_03 y1 y2 y3 y4 y5 y6 w1 r f = + (gamma3f y1 y2 y6 r f / &w1 + + (dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 r r r y6 - #0.03) * (vol2r y1 r - vol2f y1 r f)/(&2 * pi)) `;; + +let gamma23f_red_03 = new_definition `gamma23f_red_03 y1 y2 y3 y4 y5 y6 r f = + (dih_y y1 y2 y3 y4 y5 y6 - &2 * #0.03) * (vol2r y1 r - vol2f y1 r f)/(&2 * pi)`;; + +let gamma3f_vLR0 = new_definition `gamma3f_vLR0 y1 y2 y3 y4 y5 y6 = + (dih_y y1 y2 y3 y4 y5 y6 - + dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - + dih_y y1 y3 sqrt2 sqrt2 sqrt2 y5) * + (vol2r y1 sqrt2 - (&2 * mm1 / pi) * &2 * pi * (&1 - y1 / (sqrt2 * &2))) / + (&2 * pi)`;; + +let gamma3f_vLR_lfun = new_definition `gamma3f_vLR_lfun y1 y2 y3 y4 y5 y6 = +(dih_y y1 y2 y3 y4 y5 y6 - + dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - + dih_y y1 y3 sqrt2 sqrt2 sqrt2 y5) * + (vol2r y1 sqrt2 - + ((&2 * mm1 / pi) * &2 * pi * (&1 - y1 / (sqrt2 * &2)) - + (&8 * mm2 / pi) * &2 * pi * lfun (y1 / &2))) / + (&2 * pi) `;; + + +let gamma3f_vL0 = new_definition `gamma3f_vL0 y1 y2 y3 y4 y5 y6 = +(dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - #0.03) * + (vol2r y1 sqrt2 - (&2 * mm1 / pi) * &2 * pi * (&1 - y1 / (sqrt2 * &2))) / + (&2 * pi) `;; + + +let gamma3f_vL_lfun = new_definition `gamma3f_vL_lfun y1 y2 y3 y4 y5 y6 = + (dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - #0.03) * + (vol2r y1 sqrt2 - + ((&2 * mm1 / pi) * &2 * pi * (&1 - y1 / (sqrt2 * &2)) - + (&8 * mm2 / pi) * &2 * pi * lfun (y1 / &2))) / + (&2 * pi)`;; + +let gamma3f_v0 = new_definition `gamma3f_v0 y1 y2 y3 y4 y5 y6 = + (dih_y y1 y2 y3 y4 y5 y6 - &2 * #0.03) * + (vol2r y1 sqrt2 - (&2 * mm1 / pi) * &2 * pi * (&1 - y1 / (sqrt2 * &2))) / + (&2 * pi)`;; + + +let gamma3f_v_lfun = new_definition `gamma3f_v_lfun y1 y2 y3 y4 y5 y6 = + (dih_y y1 y2 y3 y4 y5 y6 - &2 * #0.03) * + (vol2r y1 sqrt2 - + ((&2 * mm1 / pi) * &2 * pi * (&1 - y1 / (sqrt2 * &2)) - + (&8 * mm2 / pi) * &2 * pi * lfun (y1 / &2))) / + (&2 * pi)`;; + +let dih_x_126_s2 = new_definition `dih_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + dih_y (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let dih2_x_126_s2 = new_definition `dih2_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + dih2_y (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let dih3_x_126_s2 = new_definition `dih3_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + dih3_y (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let dih4_x_126_s2 = new_definition `dih4_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + dih4_y (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let dih5_x_126_s2 = new_definition `dih5_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + dih5_y (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let dih6_x_126_s2 = new_definition `dih6_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + dih6_y (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let ldih_x_126_s2 = new_definition `ldih_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + lfun (sqrt x1 / #2.0) * dih_x_126_s2 x1 x2 x3 x4 x5 x6`;; + +let ldih2_x_126_s2 = new_definition `ldih2_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + lfun (sqrt x2 / #2.0) * dih2_x_126_s2 x1 x2 x3 x4 x5 x6`;; + +let ldih6_x_126_s2 = new_definition `ldih6_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + lfun (sqrt x6 / #2.0) * dih6_x_126_s2 x1 x2 x3 x4 x5 x6`;; + +let dih_x_135_s2 = new_definition `dih_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + dih_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let dih2_x_135_s2 = new_definition `dih2_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + dih2_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let dih3_x_135_s2 = new_definition `dih3_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + dih3_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let dih4_x_135_s2 = new_definition `dih4_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + dih4_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let dih5_x_135_s2 = new_definition `dih5_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + dih5_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let dih6_x_135_s2 = new_definition `dih6_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + dih6_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let ldih_x_135_s2' = new_definition `ldih_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + lfun (sqrt x1/ #2.0) * dih_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let ldih3_x_135_s2 = new_definition `ldih3_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + lfun (sqrt x3/ #2.0) * dih3_x_135_s2 x1 x2 x3 x4 x5 x6 `;; + +let ldih5_x_135_s2 = new_definition `ldih5_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + lfun (sqrt x5/ #2.0) * dih5_x_135_s2 x1 x2 x3 x4 x5 x6 `;; + + +let delta_x_126_s2 = new_definition + `delta_x_126_s2 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + delta_y (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let delta_x_135_s2 = new_definition + `delta_x_135_s2 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + delta_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let gamma3f_x_vLR_lfun = new_definition +`gamma3f_x_vLR_lfun (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + gamma3f_vLR_lfun (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) + (sqrt x6)`;; + +let gamma3f_x_vLR0 = new_definition +`gamma3f_x_vLR0 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + gamma3f_vLR0 (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) + (sqrt x6)`;; + +let gamma3f_x_vL_lfun = new_definition +`gamma3f_x_vL_lfun (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + gamma3f_vL_lfun (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) + (sqrt x6)`;; + +let gamma3f_x_vL0 = new_definition +`gamma3f_x_vL0 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + gamma3f_vL0 (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) + (sqrt x6)`;; + +let gamma3f_x_v_lfun = new_definition +`gamma3f_x_v_lfun (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + gamma3f_v_lfun (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) + (sqrt x6)`;; + +let gamma3f_x_v0 = new_definition +`gamma3f_x_v0 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + gamma3f_v0 (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) + (sqrt x6)`;; + +let vol3_x_135_s2 = new_definition +`vol3_x_135_s2 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + vol3r (sqrt x1) (sqrt x3) (sqrt x5) sqrt2`;; + +let x1cube = new_definition `x1cube = proj_x1 * proj_x1 * proj_x1`;; + +let x1cube = new_definition `x1cube = proj_x1 * proj_x1 * proj_x1`;; + + + +let gamma23f_126_03 = new_definition `gamma23f_126_03 y1 y2 y3 y4 y5 y6 w1 r f = + (gamma3f y1 y2 y6 r f / &w1 + + (dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 r r r y6 - #0.03) * (vol2r y1 r - vol2f y1 r f)/(&2 * pi)) `;; + +let gamma23f_red_03 = new_definition `gamma23f_red_03 y1 y2 y3 y4 y5 y6 r f = + (dih_y y1 y2 y3 y4 y5 y6 - &2 * #0.03) * (vol2r y1 r - vol2f y1 r f)/(&2 * pi)`;; + +let gamma3f_vLR0 = new_definition `gamma3f_vLR0 y1 y2 y3 y4 y5 y6 = + (dih_y y1 y2 y3 y4 y5 y6 - + dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - + dih_y y1 y3 sqrt2 sqrt2 sqrt2 y5) * + (vol2r y1 sqrt2 - (&2 * mm1 / pi) * &2 * pi * (&1 - y1 / (sqrt2 * &2))) / + (&2 * pi)`;; + +let gamma3f_vLR_lfun = new_definition `gamma3f_vLR_lfun y1 y2 y3 y4 y5 y6 = +(dih_y y1 y2 y3 y4 y5 y6 - + dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - + dih_y y1 y3 sqrt2 sqrt2 sqrt2 y5) * + (vol2r y1 sqrt2 - + ((&2 * mm1 / pi) * &2 * pi * (&1 - y1 / (sqrt2 * &2)) - + (&8 * mm2 / pi) * &2 * pi * lfun (y1 / &2))) / + (&2 * pi) `;; + + +let gamma3f_vL0 = new_definition `gamma3f_vL0 y1 y2 y3 y4 y5 y6 = +(dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - #0.03) * + (vol2r y1 sqrt2 - (&2 * mm1 / pi) * &2 * pi * (&1 - y1 / (sqrt2 * &2))) / + (&2 * pi) `;; + + +let gamma3f_vL_lfun = new_definition `gamma3f_vL_lfun y1 y2 y3 y4 y5 y6 = + (dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - #0.03) * + (vol2r y1 sqrt2 - + ((&2 * mm1 / pi) * &2 * pi * (&1 - y1 / (sqrt2 * &2)) - + (&8 * mm2 / pi) * &2 * pi * lfun (y1 / &2))) / + (&2 * pi)`;; + +let gamma3f_v0 = new_definition `gamma3f_v0 y1 y2 y3 y4 y5 y6 = + (dih_y y1 y2 y3 y4 y5 y6 - &2 * #0.03) * + (vol2r y1 sqrt2 - (&2 * mm1 / pi) * &2 * pi * (&1 - y1 / (sqrt2 * &2))) / + (&2 * pi)`;; + + +let gamma3f_v_lfun = new_definition `gamma3f_v_lfun y1 y2 y3 y4 y5 y6 = + (dih_y y1 y2 y3 y4 y5 y6 - &2 * #0.03) * + (vol2r y1 sqrt2 - + ((&2 * mm1 / pi) * &2 * pi * (&1 - y1 / (sqrt2 * &2)) - + (&8 * mm2 / pi) * &2 * pi * lfun (y1 / &2))) / + (&2 * pi)`;; + +let dih_x_126_s2 = new_definition `dih_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + dih_y (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let dih2_x_126_s2 = new_definition `dih2_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + dih2_y (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let dih3_x_126_s2 = new_definition `dih3_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + dih3_y (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let dih4_x_126_s2 = new_definition `dih4_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + dih4_y (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let dih5_x_126_s2 = new_definition `dih5_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + dih5_y (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let dih6_x_126_s2 = new_definition `dih6_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + dih6_y (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let ldih_x_126_s2 = new_definition `ldih_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + lfun (sqrt x1 / #2.0) * dih_x_126_s2 x1 x2 x3 x4 x5 x6`;; + +let ldih2_x_126_s2 = new_definition `ldih2_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + lfun (sqrt x2 / #2.0) * dih2_x_126_s2 x1 x2 x3 x4 x5 x6`;; + +let ldih6_x_126_s2 = new_definition `ldih6_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + lfun (sqrt x6 / #2.0) * dih6_x_126_s2 x1 x2 x3 x4 x5 x6`;; + +let dih_x_135_s2 = new_definition `dih_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + dih_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let dih2_x_135_s2 = new_definition `dih2_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + dih2_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let dih3_x_135_s2 = new_definition `dih3_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + dih3_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let dih4_x_135_s2 = new_definition `dih4_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + dih4_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let dih5_x_135_s2 = new_definition `dih5_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + dih5_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let dih6_x_135_s2 = new_definition `dih6_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + dih6_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let ldih_x_135_s2' = new_definition `ldih_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + lfun (sqrt x1/ #2.0) * dih_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let ldih3_x_135_s2 = new_definition `ldih3_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + lfun (sqrt x3/ #2.0) * dih3_x_135_s2 x1 x2 x3 x4 x5 x6 `;; + +let ldih5_x_135_s2 = new_definition `ldih5_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + lfun (sqrt x5/ #2.0) * dih5_x_135_s2 x1 x2 x3 x4 x5 x6 `;; + + +let delta_x_126_s2 = new_definition + `delta_x_126_s2 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + delta_y (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let delta_x_135_s2 = new_definition + `delta_x_135_s2 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + delta_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let gamma3f_x_vLR_lfun = new_definition +`gamma3f_x_vLR_lfun (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + gamma3f_vLR_lfun (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) + (sqrt x6)`;; + +let gamma3f_x_vLR0 = new_definition +`gamma3f_x_vLR0 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + gamma3f_vLR0 (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) + (sqrt x6)`;; + +let gamma3f_x_vL_lfun = new_definition +`gamma3f_x_vL_lfun (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + gamma3f_vL_lfun (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) + (sqrt x6)`;; + +let gamma3f_x_vL0 = new_definition +`gamma3f_x_vL0 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + gamma3f_vL0 (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) + (sqrt x6)`;; + +let gamma3f_x_v_lfun = new_definition +`gamma3f_x_v_lfun (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + gamma3f_v_lfun (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) + (sqrt x6)`;; + +let gamma3f_x_v0 = new_definition +`gamma3f_x_v0 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + gamma3f_v0 (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) + (sqrt x6)`;; + +let vol3_x_135_s2 = new_definition +`vol3_x_135_s2 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + vol3r (sqrt x1) (sqrt x3) (sqrt x5) sqrt2`;; + + +(* +let arclength6_x = new_definition `arclength6_x x1 x2 x3 x4 x5 x6 = arclength (sqrt x1) (sqrt x2) (sqrt x3)`;; +*) + +let x1cube = new_definition `x1cube = proj_x1 * proj_x1 * proj_x1`;; + + + +let gamma3f_135_s_n = new_definition `gamma3f_135_s_n y1 y2 y3 y4 y5 y6 = + sqn(delta_y y1 y2 y3 y4 y5 y6) * (&1 / &12 - + (&2 * mm1 / pi) * + (y_of_x sol_euler_x_div_sqrtdelta y1 y2 y3 y4 y5 y6 + + y_of_x sol_euler156_x_div_sqrtdelta y1 y2 y3 y4 y5 y6 + + y_of_x sol_euler345_x_div_sqrtdelta y1 y2 y3 y4 y5 y6) )`;; + +let gamma3f_126_s_n = new_definition `gamma3f_126_s_n y1 y2 y3 y4 y5 y6 = + sqn(delta_y y1 y2 y3 y4 y5 y6) * (&1 / &12 - + (&2 * mm1 / pi) * + (y_of_x sol_euler_x_div_sqrtdelta y1 y2 y3 y4 y5 y6 + + y_of_x sol_euler246_x_div_sqrtdelta y1 y2 y3 y4 y5 y6 + + y_of_x sol_euler156_x_div_sqrtdelta y1 y2 y3 y4 y5 y6) )`;; + +let lmdih_x_n = new_definition `lmdih_x_n x1 x2 x3 x4 x5 x6 = + sqn (delta_x x1 x2 x3 x4 x5 x6) * lmdih_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let lmdih2_x_n = new_definition `lmdih2_x_n x1 x2 x3 x4 x5 x6 = + sqn (delta_x x1 x2 x3 x4 x5 x6) * lmdih2_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let lmdih3_x_n = new_definition `lmdih3_x_n x1 x2 x3 x4 x5 x6 = + sqn (delta_x x1 x2 x3 x4 x5 x6) * lmdih3_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let lmdih5_x_n = new_definition `lmdih5_x_n x1 x2 x3 x4 x5 x6 = + sqn (delta_x x1 x2 x3 x4 x5 x6) * lmdih5_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let lmdih6_x_n = new_definition `lmdih6_x_n x1 x2 x3 x4 x5 x6 = + sqn (delta_x x1 x2 x3 x4 x5 x6) * lmdih6_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let gamma3f_vLR_n = new_definition `gamma3f_vLR_n y1 y2 y3 y4 y5 y6 f = + (dih_y y1 y2 y3 y4 y5 y6 - + upper_dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - + upper_dih_y y1 y3 sqrt2 sqrt2 sqrt2 y5) * + (vol2r y1 sqrt2 - vol2f y1 sqrt2 f) / (&2 * pi)`;; + +let gamma3f_vL_n = new_definition `gamma3f_vL_n y1 y2 y3 y4 y5 y6 f = + (dih_y y1 y2 y3 y4 y5 y6 - upper_dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - #0.03) * + (vol2r y1 sqrt2 - vol2f y1 sqrt2 f) / (&2 * pi)`;; + +let gamma3f_vLR_n0 = new_definition `gamma3f_vLR_n0 y1 y2 y3 y4 y5 y6 = + gamma3f_vLR_n y1 y2 y3 y4 y5 y6 (\x. &0)`;; + +let gamma3f_vLR_nlfun = new_definition `gamma3f_vLR_nlfun y1 y2 y3 y4 y5 y6 = + gamma3f_vLR_n y1 y2 y3 y4 y5 y6 lfun`;; + +let gamma3f_vL_n0 = new_definition `gamma3f_vL_n0 y1 y2 y3 y4 y5 y6 = + gamma3f_vL_n y1 y2 y3 y4 y5 y6 (\x. &0)`;; + +let gamma3f_vL_nlfun = new_definition `gamma3f_vL_nlfun y1 y2 y3 y4 y5 y6 = + gamma3f_vL_n y1 y2 y3 y4 y5 y6 lfun`;; + +let ldih_x_n = new_definition `ldih_x_n x1 x2 x3 x4 x5 x6 = + sqn(delta_x x1 x2 x3 x4 x5 x6) * ldih_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let ldih2_x_n = new_definition `ldih2_x_n x1 x2 x3 x4 x5 x6 = + sqn(delta_x x1 x2 x3 x4 x5 x6) * ldih2_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let ldih3_x_n = new_definition `ldih3_x_n x1 x2 x3 x4 x5 x6 = + sqn(delta_x x1 x2 x3 x4 x5 x6) * ldih3_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let ldih5_x_n = new_definition `ldih5_x_n x1 x2 x3 x4 x5 x6 = + sqn(delta_x x1 x2 x3 x4 x5 x6) * ldih5_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let ldih6_x_n = new_definition `ldih6_x_n x1 x2 x3 x4 x5 x6 = + sqn(delta_x x1 x2 x3 x4 x5 x6) * ldih6_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let gamma3f_vLR_x_nlfun = new_definition `gamma3f_vLR_x_nlfun x1 x2 x3 x4 x5 x6= + gamma3f_vLR_nlfun (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let gamma3f_vL_x_nlfun = new_definition `gamma3f_vL_x_nlfun x1 x2 x3 x4 x5 x6= + gamma3f_vL_nlfun (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let gamma3f_vLR_x_n0 = new_definition `gamma3f_vLR_x_n0 x1 x2 x3 x4 x5 x6= + gamma3f_vLR_n0 (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let gamma3f_vL_x_n0 = new_definition `gamma3f_vL_x_n0 x1 x2 x3 x4 x5 x6= + gamma3f_vL_n0 (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let gamma3f_135_x_s_n = new_definition + `gamma3f_135_x_s_n x1 (x2:real) x3 (x4:real) x5 (x6:real) = + gamma3f_135_s_n (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let gamma3f_126_x_s_n = new_definition + `gamma3f_126_x_s_n x1 (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + gamma3f_126_s_n (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let rr22 = REWRITE_RULE[GSYM sqrt2_sqrt2];; + +let ldih_x_126_n = rr22 (new_definition `ldih_x_126_n x1 x2 (x3:real) (x4:real) (x5:real) x6 = + ldih_x_n x1 x2 (&2) (&2) (&2) x6`);; + +(* +let ldih2_x_126_n = rr22 (new_definition +`ldih2_x_126_n_ x1 x2 (x3:real) (x4:real) (x5:real) x6 = + ldih2_x_n x1 x2 (&2) (&2) (&2) x6`);; +*) + +let ldih2_x_126_n = rr22 (new_definition +`ldih2_x_126_n x1 x2 (x3:real) (x4:real) (x5:real) x6 = + ldih2_x_n x1 x2 (&2) (&2) (&2) x6`);; + +let ldih6_x_126_n = rr22 (new_definition + `ldih6_x_126_n x1 x2 (x3:real) (x4:real) (x5:real) x6 = + ldih6_x_n x1 x2 (&2) (&2) (&2) x6`);; + +let ldih_x_135_n = rr22 (new_definition + `ldih_x_135_n x1 (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + ldih_x_n x1 (&2) x3 (&2) x5 (&2)`);; + +let ldih3_x_135_n = rr22 (new_definition +`ldih3_x_135_n x1 (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + ldih3_x_n x1 (&2) x3 (&2) x5 (&2)`);; + +let ldih5_x_135_n = rr22 (new_definition + `ldih5_x_135_n x1 (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + ldih5_x_n x1 (&2) x3 (&2) x5 (&2)`);; + +(* +let vol3f_sqrt2_lfun = new_definition + `vol3f_sqrt2_lfun y1 y2 (y3:real) (y4:real) (y5:real) y6 = + vol3f y1 y2 y6 sqrt2 lfun`;; +*) + +(* remaining splits *) + +let gamma3f_126 = new_definition + `gamma3f_126 (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) f = + gamma3f y1 y2 y6 sqrt2 f`;; + +let gamma3f_135 = new_definition + `gamma3f_135 (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) f = + gamma3f y1 y3 y5 sqrt2 f`;; + +let gamma3f_vLR = new_definition + `gamma3f_vLR (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) f = + (dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - dih_y y1 y3 sqrt2 sqrt2 sqrt2 y5) * + (vol2r y1 sqrt2 - vol2f y1 sqrt2 f)/(&2 * pi)`;; + +let gamma3f_vL = new_definition + `gamma3f_vL (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) f = + (dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - #0.03) * (vol2r y1 sqrt2 - vol2f y1 sqrt2 f)/(&2 * pi)`;; + +let gamma3f_v = new_definition + `gamma3f_v (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) f = + (dih_y y1 y2 y3 y4 y5 y6 - &2 * #0.03) * (vol2r y1 sqrt2 - vol2f y1 sqrt2 f)/(&2 * pi)`;; + +let gamma23f = new_definition `gamma23f y1 y2 y3 y4 y5 y6 w1 w2 r f = + (gamma3f y1 y2 y6 r f / &w1 + gamma3f y1 y3 y5 r f / &w2 + + (dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 r r r y6 - dih_y y1 y3 r r r y5) * (vol2r y1 r - vol2f y1 r f)/(&2 * pi)) `;; + +let gamma23f_126_03 = new_definition `gamma23f_126_03 y1 y2 y3 y4 y5 y6 w1 r f = + (gamma3f y1 y2 y6 r f / &w1 + + (dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 r r r y6 - #0.03) * (vol2r y1 r - vol2f y1 r f)/(&2 * pi)) `;; + +let gamma23f_red_03 = new_definition `gamma23f_red_03 y1 y2 y3 y4 y5 y6 r f = + (dih_y y1 y2 y3 y4 y5 y6 - &2 * #0.03) * (vol2r y1 r - vol2f y1 r f)/(&2 * pi)`;; + +let gamma3f_vLR0 = new_definition `gamma3f_vLR0 y1 y2 y3 y4 y5 y6 = + (dih_y y1 y2 y3 y4 y5 y6 - + dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - + dih_y y1 y3 sqrt2 sqrt2 sqrt2 y5) * + (vol2r y1 sqrt2 - (&2 * mm1 / pi) * &2 * pi * (&1 - y1 / (sqrt2 * &2))) / + (&2 * pi)`;; + +let gamma3f_vLR_lfun = new_definition `gamma3f_vLR_lfun y1 y2 y3 y4 y5 y6 = +(dih_y y1 y2 y3 y4 y5 y6 - + dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - + dih_y y1 y3 sqrt2 sqrt2 sqrt2 y5) * + (vol2r y1 sqrt2 - + ((&2 * mm1 / pi) * &2 * pi * (&1 - y1 / (sqrt2 * &2)) - + (&8 * mm2 / pi) * &2 * pi * lfun (y1 / &2))) / + (&2 * pi) `;; + + +let gamma3f_vL0 = new_definition `gamma3f_vL0 y1 y2 y3 y4 y5 y6 = +(dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - #0.03) * + (vol2r y1 sqrt2 - (&2 * mm1 / pi) * &2 * pi * (&1 - y1 / (sqrt2 * &2))) / + (&2 * pi) `;; + + +let gamma3f_vL_lfun = new_definition `gamma3f_vL_lfun y1 y2 y3 y4 y5 y6 = + (dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - #0.03) * + (vol2r y1 sqrt2 - + ((&2 * mm1 / pi) * &2 * pi * (&1 - y1 / (sqrt2 * &2)) - + (&8 * mm2 / pi) * &2 * pi * lfun (y1 / &2))) / + (&2 * pi)`;; + +let gamma3f_v0 = new_definition `gamma3f_v0 y1 y2 y3 y4 y5 y6 = + (dih_y y1 y2 y3 y4 y5 y6 - &2 * #0.03) * + (vol2r y1 sqrt2 - (&2 * mm1 / pi) * &2 * pi * (&1 - y1 / (sqrt2 * &2))) / + (&2 * pi)`;; + + +let gamma3f_v_lfun = new_definition `gamma3f_v_lfun y1 y2 y3 y4 y5 y6 = + (dih_y y1 y2 y3 y4 y5 y6 - &2 * #0.03) * + (vol2r y1 sqrt2 - + ((&2 * mm1 / pi) * &2 * pi * (&1 - y1 / (sqrt2 * &2)) - + (&8 * mm2 / pi) * &2 * pi * lfun (y1 / &2))) / + (&2 * pi)`;; + +let dih_x_126_s2 = new_definition `dih_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + dih_y (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let dih2_x_126_s2 = new_definition `dih2_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + dih2_y (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let dih3_x_126_s2 = new_definition `dih3_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + dih3_y (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let dih4_x_126_s2 = new_definition `dih4_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + dih4_y (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let dih5_x_126_s2 = new_definition `dih5_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + dih5_y (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let dih6_x_126_s2 = new_definition `dih6_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + dih6_y (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let ldih_x_126_s2 = new_definition `ldih_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + lfun (sqrt x1 / #2.0) * dih_x_126_s2 x1 x2 x3 x4 x5 x6`;; + +let ldih2_x_126_s2 = new_definition `ldih2_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + lfun (sqrt x2 / #2.0) * dih2_x_126_s2 x1 x2 x3 x4 x5 x6`;; + +let ldih6_x_126_s2 = new_definition `ldih6_x_126_s2 x1 x2 (x3:real) (x4:real) (x5:real) x6 = + lfun (sqrt x6 / #2.0) * dih6_x_126_s2 x1 x2 x3 x4 x5 x6`;; + +let dih_x_135_s2 = new_definition `dih_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + dih_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let dih2_x_135_s2 = new_definition `dih2_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + dih2_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let dih3_x_135_s2 = new_definition `dih3_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + dih3_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let dih4_x_135_s2 = new_definition `dih4_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + dih4_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let dih5_x_135_s2 = new_definition `dih5_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + dih5_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let dih6_x_135_s2 = new_definition `dih6_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + dih6_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let ldih_x_135_s2' = new_definition `ldih_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + lfun (sqrt x1/ #2.0) * dih_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let ldih3_x_135_s2 = new_definition `ldih3_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + lfun (sqrt x3/ #2.0) * dih3_x_135_s2 x1 x2 x3 x4 x5 x6 `;; + +let ldih5_x_135_s2 = new_definition `ldih5_x_135_s2 x1 (x2:real) x3 (x4:real) x5 (x6:real) = + lfun (sqrt x5/ #2.0) * dih5_x_135_s2 x1 x2 x3 x4 x5 x6 `;; + + +let delta_x_126_s2 = new_definition + `delta_x_126_s2 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + delta_y (sqrt x1) (sqrt x2) sqrt2 sqrt2 sqrt2 (sqrt x6)`;; + +let delta_x_135_s2 = new_definition + `delta_x_135_s2 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + delta_y (sqrt x1) sqrt2 (sqrt x3) sqrt2 (sqrt x5) sqrt2`;; + +let gamma3f_x_vLR_lfun = new_definition +`gamma3f_x_vLR_lfun (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + gamma3f_vLR_lfun (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) + (sqrt x6)`;; + +let gamma3f_x_vLR0 = new_definition +`gamma3f_x_vLR0 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + gamma3f_vLR0 (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) + (sqrt x6)`;; + +let gamma3f_x_vL_lfun = new_definition +`gamma3f_x_vL_lfun (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + gamma3f_vL_lfun (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) + (sqrt x6)`;; + +let gamma3f_x_vL0 = new_definition +`gamma3f_x_vL0 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + gamma3f_vL0 (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) + (sqrt x6)`;; + +let gamma3f_x_v_lfun = new_definition +`gamma3f_x_v_lfun (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + gamma3f_v_lfun (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) + (sqrt x6)`;; + +let gamma3f_x_v0 = new_definition +`gamma3f_x_v0 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + gamma3f_v0 (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) + (sqrt x6)`;; + +let vol3_x_135_s2 = new_definition +`vol3_x_135_s2 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + vol3r (sqrt x1) (sqrt x3) (sqrt x5) sqrt2`;; + +(* +let dih_y_div_sqrtdelta_posbranch = new_definition + `dih_y_div_sqrtdelta_posbranch = y_of_x dih_x_div_sqrtdelta_posbranch`;; +*) + + +(* +let rhof_x = define `rhof_x x = rho (sqrt x)`;; +*) + + +(* +let ineq_lemma = prove_by_refinement( + `!a x b. &0 <= a /\ &0 <= b /\ a pow 2 <= x /\ x <= b pow 2 ==> a <= sqrt x /\ sqrt x <= b`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + STRIP_TAC; + SUBGOAL_THEN `&0 <= x` MP_TAC; + ASM_MESON_TAC [REAL_LE_TRANS;Collect_geom.REAL_LE_SQUARE_POW]; + ASM_MESON_TAC[Collect_geom.POW2_COND;SQRT_WORKS]; + ]);; + (* }}} *) +*) + +(* +let arclength6_x = new_definition `arclength6_x x1 x2 x3 x4 x5 x6 = arclength (sqrt x1) (sqrt x2) (sqrt x3)`;; +*) + +(* + +let sqrt_x8 = define `sqrt_x8 (x7:real) (x2:real) (x3:real) (x4:real) (x8:real) (x9:real) = sqrt x8`;; + +let sqrt_x9 = define `sqrt_x9 (x7:real) (x2:real) (x3:real) (x4:real) (x8:real) (x9:real) = sqrt x9`;; + +*) + + + + + diff --git a/legacy/glpk/glpk/glpk_def.hl b/legacy/glpk/glpk/glpk_def.hl new file mode 100644 index 0000000..397183e --- /dev/null +++ b/legacy/glpk/glpk/glpk_def.hl @@ -0,0 +1,39 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Lemma: Main Linear Programs *) +(* Chapter: *) +(* Author: Thomas C. Hales *) +(* Date: 2010-06-14 *) +(* ========================================================================== *) + + +(* +This file contains definitions related to the main linear programming model. +*) + +(* +changes +delta0 -> sol0 + +*) + +let sol0 = new_definition `sol0 = &3 * acs (&1 / &3) - pi`;; +let rhom = new_definition `rhom y = &1 + sol0 / pi - lfun (y/ &2) * sol0/pi`;; +let rho218 = new_definition `rho218 = rhom (#2.18)`;; +let tgt_exact = new_definition `tgt_exact = &4 * pi - &20 * sol0`;; + +(* The model has a hypermap (D,e,n,f) with + set of nodes V, edges E, faces F, + + std_faces_not_super : set of faces. + super8 : set of faces. + superduperq : set of faces. + .... + + declare a type for decorated hypermaps. + + + Each standard fan gives a decorated hypermap. + + *) diff --git a/legacy/glpk/glpk/mkineq.ml b/legacy/glpk/glpk/mkineq.ml new file mode 100644 index 0000000..c691938 --- /dev/null +++ b/legacy/glpk/glpk/mkineq.ml @@ -0,0 +1,230 @@ +(* create new inequalities for lp, cfsqp, formal spec *) + +open Str;; +open List;; +open Num;; +let sprintf = Printf.sprintf;; + +(* from lpproc.ml *) + +let unsplit d f = function + | (x::xs) -> fold_left (fun s t -> s^d^(f t)) (f x) xs + | [] -> "";; + +let join_lines = unsplit "\n" (fun x-> x);; + +let rec zip l1 l2 = + match (l1,l2) with + ([],[]) -> [] + | (h1::t1,h2::t2) -> (h1,h2)::(zip t1 t2) + | _ -> failwith "zip";; + + +(* end from lpproc.ml *) + +type sgn = GT | GE;; + +type constrain = NONE | SMALLTRI | BIGTRI ;; + +type node = LOW | MEDIUM | HIGH | EXTRA ;; + +type edge = SMALL | BIG;; + +type decimal = Dec of string | Sqrt2 | Sqrt8;; + +let has_point s = try + let _ = String.index s '.' in true + with failure -> false;; + +let add_point s = if has_point s then s else s^".0";; + +let dec_of_string s = + if s="s2" then Sqrt2 + else if s="s8" then Sqrt8 + else Dec s;; + +let d = dec_of_string;; + +let ds:string -> decimal list = fun s -> + let ss = split_sp s in + map dec_of_string ss;; + +let float_of_dec:decimal -> float = function + | Sqrt2 -> sqrt(2.0) + | Sqrt8 -> sqrt(8.0) + | Dec x -> float_of_string x;; + +let holtext_of_dec:decimal -> string = function + | Sqrt2 -> "s2" + | Sqrt8 -> "s8" + | Dec x -> let y = add_point x in + if (y.[0]= '-') then " -- #"^(String.sub y 1 (String.length y - 1)) + else "#"^y;; + + +holtext_of_dec (Dec "2.0");; + +let holtext_of_declist:decimal list -> string = fun xs -> + "["^(unsplit ";" holtext_of_dec xs)^"]";; + +let holtext_of_sgn:sgn -> string = function + | GT -> "( > )" + | GE -> "( >= )";; + +let holtext_of_constrain:constrain -> string = function + | NONE -> "Cnone" + | BIGTRI -> "Cstd3_big" + | SMALLTRI -> "Cstd3_small";; + +let split_sp= Str.split (regexp " +");; + + + +(* +represents on rectangle xmin[6], xmax[6]: + +azim[i]*azim i y + rhzim[i]*rhzim i y + tau0 * taumar y + sol0 * sol y +sgn +c0 + c dot (y-p). + +*) + +type ineq = { + mutable id : string; + mutable constrain: constrain; + mutable sgn : sgn; + mutable xmin : decimal list; + mutable xmax : decimal list; + mutable c0 : decimal; + mutable c : decimal list; + mutable p : decimal list; + mutable azim : decimal list; + mutable rhzim : decimal list; + mutable tau0 : decimal; + mutable sol0 : decimal; +};; + +let hh = { + id = "21444"; + constrain = NONE; + sgn = GT; + xmin = ds "2 2 2 2 2 2"; + xmax = ds "2.52 2.52 2.52 2.52 2.52 2.52"; + c0 = d "2.34"; + c = ds "2.0 2.1 2.2 2.3 2.4 2.5"; + p = ds "3.0 3.1 3.2 3.3 3.4 3.5"; + azim = ds "1 1 1"; + rhzim = ds "-1.0 -2.0 -3.0"; + tau0 = d "1.0"; + sol0 = d "-4.0"; +};; + + +let holtext_of_ineq:ineq->string = fun h -> + let p = sprintf in + join_lines [ + p"let hol_ineq%s = `hol_ineq (\"%s\", " h.id h.id; + p" %s," (holtext_of_constrain h.constrain); + p" %s," (holtext_of_sgn h.sgn); + p" %s," (holtext_of_declist h.xmin); + p" %s," (holtext_of_declist h.xmax); + p" %s," (holtext_of_dec h.c0); + p" %s," (holtext_of_declist h.c); + p" %s," (holtext_of_declist h.p); + p" %s," (holtext_of_declist h.azim); + p" %s," (holtext_of_declist h.rhzim); + p" %s," (holtext_of_dec h.tau0); + p" %s)` " (holtext_of_dec h.sol0); + ];; +holtext_of_ineq hh;; +(* ampl text generation of triangle ineqs + ocaml numbering 012345 + ampl numbering 123456 *) + + +let aug i = i+1;; +let nz s = (float_of_dec s <> 0.0);; +let hasnz s = exists nz s;; +let unempty = filter (fun t -> t <> "");; + +let ampl_of_dec:decimal -> string = function + | Sqrt2 -> "+1.4142135623730951" + | Sqrt8 -> "+2.8284271247461903" + | Dec x -> + if (x.[0]= '-') then x else "+"^x;; + +let comp:decimal->decimal->int = + fun a b -> + if (a=b) then 0 else compare (float_of_dec a) (float_of_dec b);; + +let less_equal bs cs = + []= filter (fun t -> comp (fst t) (snd t) >0 ) (zip bs cs);; + +let domain_covers (lo,high) h = + less_equal h.xmin lo && less_equal high h.xmax;; + +let domain_covers_itriangle = + domain_covers (ds "2 2 2 2 2 2",ds "2.52 2.52 2.52 2.52 2.52 2.52");; + +let domain_covers_apiece = + domain_covers (ds "2 2 2 2 2.52 2.52",ds "2.52 2.52 2.52 2.52 s8 s8");; + +let domain_covers_flat = + domain_covers (ds "2 2 2 2.52 2 2",ds "2.52 2.52 2.52 s8 2.52 2.52");; + +let domain_covers_apex_sup_flat = + domain_covers (ds "2 2 2 s8 2 2",ds "2.52 2.52 2.52 3.0 2.52 2.52");; + +let domain_covers_std3_big h = + domain_covers_itriangle h && (h.constrain = BIGTRI);; + +let domain_covers_std3_small h = + domain_covers_itriangle h && (h.constrain = SMALLTRI);; + +let node_range = function + | LOW -> ds "2 2.18" + | MEDIUM -> ds "2.18 2.36" + | HIGH -> ds "2.18 2.52" + | EXTRA -> ds "2.36 2.52";; + +let domain_covers_f f node h i = + let ymin = nth h.xmin i in + let ymax = nth h.xmax i in + let [mm;mx] = f node in + less_equal [ymin] [mm] && less_equal [mx] [ymax];; + +let domain_covers_node = domain_covers_f node_range;; + +let edge_range = function + | SMALL -> ds "2 2.25" + | BIG -> ds "2.25 2.52";; + +let domain_covers_edge = domain_covers_f edge_range;; + +let string_of_domain h = "";; + +let ampltext_of_ineq:ineq->string = fun h -> + let p = sprintf in + let a = ampl_of_dec in + let mkone f s = if nz f then p" %s * %s " (a f) s else "" in + let mk_madd j = p" %s * (y%d[i2,j] - (%s))" + (a (nth h.c j)) (j+1) (a (nth h.p j)) in + join_lines (unempty[ + "# "; + p"ineq%s 'ID[%s]' {(i1,i2,i3,j) in e_dart : " h.id h.id; + string_of_domain h; + "}:"; + mkone h.tau0 "tau[j]"; + mkone h.sol0 "sol[j]"; + mkone (nth h.azim 0) "azim[i1,j]"; + mkone (nth h.azim 1) "azim[i2,j]"; + mkone (nth h.azim 2) "azim[i3,j]"; + mkone (nth h.rhzim 0) "rhzim[i1,j]"; + mkone (nth h.rhzim 1) "rhzim[i2,j]"; + mkone (nth h.rhzim 2) "rhzim[i3,j]"; + " >= "; + p" %s" (a h.c0); + mk_madd 0;mk_madd 1;mk_madd 2;mk_madd 3;mk_madd 4;mk_madd 5 + ]);; +1;; +ampltext_of_ineq hh;; diff --git a/legacy/glpk/glpk/tame_archive_hard_notes.hl b/legacy/glpk/glpk/tame_archive_hard_notes.hl new file mode 100644 index 0000000..d27bdd0 --- /dev/null +++ b/legacy/glpk/glpk/tame_archive_hard_notes.hl @@ -0,0 +1,889 @@ +(* ========================================================================== *) +(* FLYSPECK - CODE FORMALIZATION *) +(* *) +(* Lemma: Linear Programs *) +(* Program: Tame Hypermap *) +(* Author: Thomas C. Hales *) +(* Date: 2010-08-01 *) +(* ========================================================================== *) + + + + +(* Case notes for the various hard cases + + This code probably isn't directly executable, because it consists + of notes from interactive sessions, run over a period of about a + year (but mostly at the beginning of August, 2010). + + It is a historical trace of how I got all the linear programs to work + to eliminate the 12 hard tame hypermaps. + + It is part of the scafffolding. It has served its purpose and is no longer + needed, except as a historical record. +*) + +(* +When running these scripts, I opened all modules in sight! + +Glpk_link, Lpproc, Hard_lp, Temp_ineq, Tame_scaffolding, List,... + +*) + +raise (failwith "File is not executable");; + + +open Temp_ineq;; + +(* + +(* There are parallel versions of several functions here XX and + XX_include_flat. I think we can use the XX_include_flat version + everywhere and delete the others. +*) + + let add_hints_force bb = + try( + let _ = init_hash bb in + let dart = snd(hd(sorted_azim_weighted_diff darts_of_std_tri bb)) in + let f = face_of_dart dart bb in + if not(mem f (bb.std3_big @ bb.std3_small)) then bb.hints <- [Triangle_split f] else + let f1 = subtract f (bb.node_200_218 @ bb.node_218_252) in + if not(f1 = []) then bb.hints <- [High_low (hd f1)] else + let f2 = intersect (highish bb) f in + if not(f2 = []) then bb.hints <- [High_low (hd f2)] else + let d1 = subtract (rotation [dart]) (bb.d_edge_200_225 @ bb.d_edge_225_252) in + if not (d1 = []) then bb.hints <- [Edge_split (hd d1)] else () + ) with Failure _ -> failwith "add_hints";; + + let add_hints bb = + if not(is_feas bb) then () else + if not(bb.hints = []) then () else + add_hints_force bb;; + + let filter_feas_hint bbs = filter_feas_f add_hints bbs;; + + let onepass_hint = function + [] -> [] + | bb::bbss as bbs -> + let _ = onepass_backup := bbs in + let brs = switch_hint bb in + let brs1 = map set_face_numerics brs in + let brs2 = map set_node_numerics brs1 in + let _ = echo bbs in + sortbb ((filter_feas_hint brs2) @ bbss);; + + let rec allpass_hint count bbs = + if count <= 0 then bbs else allpass_hint (count - 1) (onepass_hint bbs);; +*) + +let resolve_with_hints t = + let u = resolve t in + let _ = add_hints_force u in + u;; + + +(* ========================================================================== *) +(* Case: Hard 11 *) +(* ========================================================================== *) + + + +(* early note on case 11 *) + + +let bb = findid "34970074286" hard_bb;; + +let bb1 = allpass 2 [bb];; +let bb2 = allpass 4 bb1;; +let bb3 = allpass 15 bb2;; +length bb3;; (* 992 *) +map (fun t -> t.lpvalue) bb3;; + +let bbmax = find_max bb3;; +bbmax;; + +init_dumpfile bbmax;; +init_hash();; +yn 0;; + +dumpfile;; +get_dumpvar "yn.1.*=";; +get_azim_table dih_y [5;4;3] bbmax;; + +get_azim_diff dih_y [4;3;5] bbmax;; +get_tri bbmax;; +biggest_azim_diff dih_y bbmax;; + + + +(* ========================================================================== *) +(* Case: Hard 9 *) +(* ========================================================================== *) + + +Glpk_link.resetc();; +let b1 = allpass_hint 500 [hard 9];; +let bx = nth b1 0;; (* 12.011042 , it has become worse?? *) (* 12.0074 *) +#print_length 600;; +resolve_with_hints bx;; (* 0 *) +let b1' = tl b1;; +let b2 = allpass_hint 500 b1';; + + +(* ========================================================================== *) +(* Case: Hard 8 *) +(* ========================================================================== *) + + + +(* hard 8 , early notes work in progress. *) +Glpk_link.resetc();; +let b1 = allpass_hint 500 [hard 8];; +let bx = hd b1;; + +(* Aug 3 notes on hard 8. *) +length (filter (fun t-> (t.hints = [])) b1);; +bx;; +sorted_azim_diff darts_of_std_tri bx;; +sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat)) bx;; +display_ampl bx;; +get_azim_table[6;11;4] bx;; (* lll_xww *) +let jj = generate_ineq_datum_p + "Dihedral" "{2,2,2.14,2,2.25,2.25}" "{2,2,2,2,2.25,2.25}" "{2.18,2.18,2.18,2.52,2.52,2.52}";; +jj;; +let fjj = ocaml_eval jj;; +testval fjj [6;11;4] bx;; (* 0.035 not great, but use it *) + +(* Aug 3 am . TO HERE, the ineq above has been added to the system, + but haven't called remake, the one below is in the makes. It + hasn't been added, still at the experimentation stages. *) + +get_azim_table [3;6;4] bx;; (* lll_wxx *) +let kk = generate_ineq_datum "Dihedral2" "{2,2,2,2.25,2,2}" "{2.18,2.18,2.18,2.52,2.52,2.52}";; +let fkk = ocaml_eval kk;; +testvalsym fkk [3;6;4] bx;; (* 0.012, not great, but use *) +let bx1 = clone bx;; +remake_model();; +bx.lpvalue;; (* 12.05 *) +resolve_with_hints bx1;; (* This digression has helped. 12.018 *) +length b1;; +get_azim_table [3;4;0] bx;; +let jj1 = generate_ineq_datum_p + "mDihedral" "{2.18,2.1,2.1,2.52,2,2}" "{2,2,2,2.52,2,2}" "{2.52,2.52,2.52,sqrt8,2.52,2.52}";; +let fjj1 = ocaml_eval jj1;; +testvalsym fjj1 [3;4;0] bx;; (* 0.045, not great, but use *) +let bx1 = clone bx;; +remake_model();; +resolve_with_hints bx1;; (* This digression didn't help, still 12.018 *) +get_azim_table [3;4;0] bx1;; (* but it made the angles more accurate. *) +sorted_azim_diff darts_of_std_tri bx1;; (* [6;3;2], a mini *) +get_azim_table [6;3;2] bx1;; +let jj2 = generate_ineq_datum_p + "Dihedral" "{2,2.18,2.18,2,2.25,2.25}" "{2,2,2,2,2,2}" "{2.18,2.18,2.18,2.25,2.25,2.25}";; +let fjj2 = ocaml_eval jj2;; +testval fjj2 [6;3;2] bx1;; (* 0.005 huge improvement, use *) +get_azim_table [6;3;2] bx1;; +let jj3 = generate_ineq_datum_p + "mDihedral2" "{2,2.18,2.18,2,2.25,2.25}" "{2,2,2,2,2,2}" "{2.18,2.18,2.18,2.25,2.25,2.25}";; +jj3;; +let fjj3 = ocaml_eval jj3;; +testval fjj3 [6;3;2] bx1;; (* 0.003 huge improvement, use *) +let bx2 = clone bx;; +remake_model();; +resolve_with_hints bx2;; (* still 12.018 *) +get_azim_table [6;3;2] bx2;; (* This didn't fix the angles, there must be a bug *) +(* why didn't 9828015955 ineq get used?? *) +display_lp bx2;; +modelbody;; +Glpk_link.cpx_branch model "/tmp/cpx.out" ampl_of_bb bx2;; +(* bug found dart_std3_mini incorrectly defined in head.mod, fixed. Aug 3, 2010 *) +let bx2 = clone bx;; +remake_model();; +resolve_with_hints bx2;; (* still 0.0, bug fixed!, unneeded mini inequalities removed. *) + + + +(* hard 8 , restart work in progress. *) +Glpk_link.resetc();; +let b1 = allpass_hint 5000 [hard 8];; (* runs out of hints at 3177, stack stize 1025 *) + +(* Aug 4 *) +length b1;; +let bx = hd b1;; +bx;; +sorted_azim_diff darts_of_std_tri bx;; +sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat)) bx;; +unset_edge bx;; +get_azim_table[3;6;4] bx;; +let jj = generate_ineq_datum_p + "Dihedral2" "{2.18,2,2,2.52,2,2.25}" "{2,2,2,2.25,2,2}" "{2.18,2.18,2.18,2.52,2.52,2.52}";; +jj;; +let fjj = ocaml_eval jj;; +testval fjj [3;6;4] bx;; (* 0.041 use it *) +let jj1 = generate_ineq_datum_p + "mDihedral3" "{2.18,2,2,2.52,2,2.25}" "{2,2,2,2.25,2,2}" "{2.18,2.18,2.18,2.52,2.52,2.52}";; +jj1;; +let fjj1 = ocaml_eval jj1;; +testval fjj1 [3;6;4] bx;; (* 0.018 use it *) +testvalsym fjj1 [11;4;6] bx;; +get_azim_table[11;4;6] bx;; +get_azim_table[3;2;6] bx;; +let bx1 = clone bx;; +let bx1 = resolve_with_hints bx1 (* drops to 0 *);; + +(* OK, lets go again *) +map (fun t -> t.lpvalue <- None) b1;; +let b1' = filter_feas_hint b1;; +let b1'' = sortbb b1';; +let bx = hd b1'';; +sort (<) bx.d_edge_200_225;; +resolve_with_hints bx;; +sorted_azim_diff darts_of_std_tri bx;; +sorted_azim_weighted_diff darts_of_std_tri bx;; +sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat)) bx;; +unset_edge bx;; +get_azim_table[2;7;6] bx;; +get_azim_table[2;6;3] bx;; +get_azim_table[4;6;11] bx;; +get_azim_table[4;3;6] bx;; +let kk1 = generate_ineq_datum + "mDihedral" "{2.18,2,2,2,2.25,2}" "{2.36,2.18,2.18,2.25,2.52,2.25}";; +let fkk1 = ocaml_eval kk1;; +testval fkk1 [2;7;6] bx;; +testvalsym fkk1[2;6;3] bx;; +testvalsym fkk1[4;6;11] bx;; +testval fkk1[4;3;6] bx;; +let kk2 = generate_ineq_datum_p + "mDihedral" "{2.18,2,2,2.25,2.52,2}" "{2.18,2,2,2,2.25,2}" "{2.36,2.18,2.18,2.25,2.52,2.25}";; +let fkk2 = ocaml_eval kk2;; +testval fkk2 [2;7;6] bx;; +testvalsym fkk2[2;6;3] bx;; +testvalsym fkk2[4;6;11] bx;; +testval fkk2[4;3;6] bx;; +kk2;; +let kk3 = generate_ineq_datum_p + "mDihedral" "{2.18,2,2,2.25,2.52,2}" "{2.18,2,2,2,2,2}" "{2.36,2.18,2.18,2.25,2.52,2.52}";; +let fkk3 = ocaml_eval kk3;; +testval fkk3 [2;7;6] bx;; +testvalsym fkk3[2;6;3] bx;; +testvalsym fkk3[4;6;11] bx;; +testval fkk3[4;3;6] bx;; +let kk4 = generate_ineq_datum_p + "Dihedral2" "{2.18,2,2,2.25,2,2.52}" "{2.18,2,2,2,2,2}" "{2.36,2.18,2.18,2.25,2.52,2.52}";; +let fkk4 = ocaml_eval kk4;; +testval fkk4 [2;7;6] bx;; +testval fkk4[2;6;3] bx;; +testval fkk4[4;6;11] bx;; +testvalsym fkk4[4;3;6] bx;; +kk3;; +kk4;; +remake_model();; +let bcx = clone bx;; +resolve bcx;; + +(* OK, lets go again *) +map (fun t -> t.lpvalue <- None) b1'';; +let b2 = sortbb(filter_feas_hint b1'');; +length b2;; +let bx = hd b2;; +bx;; +sort (<) bx.d_edge_225_252;; +unset_edge bx;; +resolve_with_hints bx;; +sorted_azim_diff darts_of_std_tri bx;; +sorted_azim_weighted_diff darts_of_std_tri bx;; +(* [6;2;3], [3;6;4], [6;7;12], [6;2;7], [4;6;11], [7;12;6], *) +sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat)) bx;; +get_azim_table[3;6;4] bx;; + +(* continue *) +let b3 = allpass_hint 500 b2;; +let b4 = allpass_hint 1500 b3;; + +length b3;; +let bx = hd b3;; +sort (<) bx.d_edge_225_252;; +unset_edge bx;; +sorted_azim_diff darts_of_std_tri bx;; +sorted_azim_weighted_diff darts_of_std_tri bx;; +get_azim_table[6;7;12] bx;; + + + +(* ========================================================================== *) +(* Case: Hard 7 *) +(* ========================================================================== *) + + + +(* starts out at 12.4 *) + +let b1 = allpass_hint 10 [hard 7];; + +(* hard 6 done, hard 4 done, hard 2 done *) + + +(* ========================================================================== *) +(* Case: Hard 5 *) +(* ========================================================================== *) + + +(* starts at 12.291 *) +resetc();; +let b1 = allpass_hint 505 [hard 5];; +length b1;; +let b2 = allpass_hint 5000 b1;; +let bxi = hd !onepass_backup;; + + + + +(* ========================================================================== *) +(* Case: Hard 3 *) +(* ========================================================================== *) + +resetc();; +let c1 = allpass_hint 1500 [hard 3];; +let cx = hd c1;; (* 12.041 , about 600 cases *) +resolve_with_hints_include_flat cx;; +let c2 = allpass_hint_include_flat 500 c1;; +length c2;; +let cx = hd c2;; (* 12.036, 598 cases *) +length cx.node_200_218;; +#print_length 1000;; +sorted_azim_diff darts_of_std_tri cx;; (* 0.04 *) +sorted_azim_weighted_diff darts_of_std_tri cx;; (* 0.012 *) +sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat)) cx;; (* 0.119 *) +sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_sup_flat)) cx;; (* 0.332 *) +[0;1;2];; +get_azim_table[1;2;0] cx;; +cx;; + +let kk1 = generate_ineq_datum + "mDihedral3" "{2,2,2,sqrt8,2,2}" "{2.52,2.52,2.52,3.0,2.52,2.52}";; +let fkk1 = ocaml_eval kk1;; +testval fkk1 [1;2;0] cx;; (* improves to 0.024, use. *) +kk1;; + +let kk2 = generate_ineq_datum_p + "Dihedral2" "{2.1,2.1,2.3,sqrt8,2.1,2.1}" "{2,2,2,sqrt8,2,2}" "{2.52,2.52,2.52,3.0,2.52,2.52}";; +let fkk2 = ocaml_eval kk2;; +testval fkk2 [1;2;0] cx;; (* improves to 0.074, use. *) +kk2;; +remake_model();; +resolve_with_hints_include_flat cx;; + +(* restart *) +let c3 = allpass_hint_include_flat 500 c2;; +length c3;; (* 98 , worst is 12.015 *) +let c4 = allpass_hint_include_flat 500 c3;; + + +(* rerun *) + +b65974205892();; + + +(* ========================================================================== *) +(* Case: Hard 2 *) +(* ========================================================================== *) + + + +let c1 = allpass_hint 100 [hard 2];; +let c2 = allpass_hint 1000 c1;; + + + +(* ========================================================================== *) +(* Case: Hard 0 *) +(* ========================================================================== *) + + +(* NEW CASE *) +resetc();; +(* with prune size 10, the list died out before an empty hint was found *) + +let b1 = allpass_prune_hint 80 1000 [hard 0];; +let bx = hd b1;; + +sorted_azim_diff darts_of_std_tri bx;; (* [2;0;1]; 0.14, [0;1;2]; [4;2;1]; [2;3;0] *) +get_azim_table[0;1;2] bx;; +nub (sort (<) (map (fun t-> t.node_218_252) (filter (fun t-> 2 = length t.node_218_252) b1)));; + +bx;; +let kk1 = generate_ineq_datum_p + "Dihedral" "{2,2.18,2.18,2,2.25,2.25}" "{2,2.18,2.18,2,2,2}" "{2.18,2.52,2.52,2.52,2.52,2.52}";; +let fkk1 = ocaml_eval kk1;; +testval fkk1 [0;1;2] bx;; (* improves to 0.0727, use. *) +let kk2 = generate_ineq_datum_p + "mDihedral2" "{2,2.18,2.18,2,2.25,2.25}" "{2,2.18,2.18,2,2,2}" "{2.18,2.52,2.52,2.52,2.52,2.52}";; +let fkk2 = ocaml_eval kk2;; +testvalsym fkk2 [0;1;2] bx;; (* improves to 0.0402, use. *) +remake_model();; +let bcx = clone bx;; +resolve_with_hints bcx;; + +(* restart *) +let b2 = map resolve_with_hints b1;; +let b3 = allpass_prune_hint 80 100 b2;; +let bx = hd b3;; (* 12.02 *) +sorted_azim_diff darts_of_std_tri bx;; (* [3;8;0]; [1;5;4] *) +sorted_azim_weighted_diff darts_of_std_tri bx;; (* [3;8;0]; [1;5;4] *) +get_azim_table[3;8;0] bx;; +bx;; +let b4 = allpass_prune_hint 80 300 b3;; +let bx = hd b4;; (* 12.007 *) +sorted_azim_diff darts_of_std_tri bx;; (* [4;2;1]; [0;1;2]; [0;3;8]; [4;1;5]; [4;3;2]; *) +sorted_azim_weighted_diff darts_of_std_tri bx;; (* [3;8;0]; [1;5;4] *) +let b5 = allpass_prune_hint 80 300 b4;; (* this goes to zero as well *) + +(* restart *) +resetc();; +let b1 = allpass_hint 10000 [hard 0];; + + + +(* ========================================================================== *) +(* Case: Hard 1 *) +(* ========================================================================== *) + + +(* NEW CASE *) + +resetc();; +let b1 = allpass_hint_include_flat 30000 [hard 1];; +(* runs to 13334 before giving one without hints *) +length b1;; (* 1430 *) +let bx = hd b1;; (* 12.004, almost there! *) +map (fun t-> length t.node_236_252) b1;; +sorted_azim_diff darts_of_std_tri bx;; (* [5;3;2]; [6;5;2] [5;4;3] *) +sorted_azim_weighted_diff darts_of_std_tri bx;; (* 0 *) +sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat)) bx;; (* [1;2;3], [1;3;0] *) +bx;; +length bx.node_200_218;; +get_azim_table[2;3;1] bx;; +let kk1 = generate_ineq_datum_p + "Dihedral3" "{2.36,2.1,2.1,2.6,2.1,2.1}" "{2.18,2,2,2.52,2,2}" "{2.52,2.52,2.52,sqrt8,2.52,2.52}";; +let fkk1 = ocaml_eval kk1;; +testval fkk1 [2;3;1] bx;; +let kk3 = generate_ineq_datum_p + "Dihedral3" "{2.36,2.1,2.1,2.55,2.1,2.0}" "{2.18,2,2,2.52,2,2}" "{2.52,2.52,2.52,sqrt8,2.52,2.52}";; +let fkk3 = ocaml_eval kk3;; +testval fkk3 [2;3;1] bx;; +kk3;; +let kk3 = generate_ineq_datum_p + "Dihedral3" "{2.36,2.1,2.1,2.55,2.1,2.0}" "{2,2,2,2.52,2,2}" "{2.52,2.52,2.52,sqrt8,2.52,2.52}";; +let fkk3 = ocaml_eval kk3;; +testval fkk3 [2;3;1] bx;; +kk3;; +let kk2 = generate_ineq_datum_p + "Dihedral3" "{2.36,2.1,2.1,2.6,2.1,2.1}" "{2.18,2,2,2.52,2,2}" "{2.52,2.18,2.18,sqrt8,2.52,2.52}";; +let fkk2 = ocaml_eval kk2;; +testval fkk2 [2;3;1] bx;; +get_azim_table[2;5;3] bx;; +let jj1 = generate_ineq_datum_p + "mDihedral3" "{2.36,2.1,2.1,2.45,2.,2.45}" "{2.18,2,2,2,2,2}" "{2.52,2.18,2.18,2.52,2.52,2.52}";; +let fjj1 = ocaml_eval jj1;; +testval fjj1 [2;5;3] bx;; +jj1;; + +get_azim_table[2;5;3] bx;; +let jj2 = generate_ineq_datum_p + "Dihedral2" "{2.36,2.1,2.1,2.45,2.,2.45}" "{2.18,2,2,2,2,2}" "{2.52,2.18,2.18,2.52,2.52,2.52}";; +let fjj2 = ocaml_eval jj2;; +testval fjj2 [2;5;3] bx;; +jj2;; + +get_azim_table[2;6;5] bx;; +testvalsym fjj1 [2;6;5] bx;; +testvalsym fjj2 [2;6;5] bx;; + +kk3;; +Ineq.getexact "6725783616";; +Ineq.getexact "9185711902";; +Ineq.getexact "6284721194";; +remake_model();; +let bcx = clone bx;; +resolve_with_hints bcx;; + +(* restart *) +let b1' = map resolve_with_hints_include_flat b1;; + +let b2 = sortbb(filter_feas_hint b1);; +length b2;; (* 564, this is more reasonable! *) +let bx = hd b2;; +sorted_azim_diff darts_of_std_tri bx;; (* [5;11;10] [5;4;3] [1;6;2] *) +sorted_azim_weighted_diff darts_of_std_tri bx;; +sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat)) bx;; +get_azim_table [2;3;1] bx;; +let b3 = allpass_hint_include_flat 1000 b2;; +length b3;; (* down to 158 *) +let b4 = allpass_hint_include_flat 1000 b3;; +b4 = [];; + + +(* ========================================================================== *) +(* Case: Hard 5 *) +(* ========================================================================== *) + + +resetc();; +let b1 = allpass_hint_include_flat 30000 [hard 5];; +let bx = hd b1;; +sorted_azim_diff darts_of_std_tri bx;; (* [5;9;0]; [1;0;9]; *) +sorted_azim_weighted_diff darts_of_std_tri bx;; (* 0 *) +sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat)) bx;; (* [1;3;0] [5;0;3] *) +get_azim_table [0;1;3]bx ;; +get_azim_table [0;3;5] bx;; +length b1;; (* 1575 *) +map (fun t-> (length t.node_218_236,length t.node_236_252)) b1;; +map (fun t -> t.node_218_236) b1;; +bx;; (* 12.014 *) +let jj1 = generate_ineq_datum_p + "Dihedral2" "{2.25,2,2.18,2.65,2.,2.2}" "{2.18,2,2,2.52,2,2}" "{2.52,2.52,2.52,sqrt8,2.52,2.52}";; +let fjj1 = ocaml_eval jj1;; +testval fjj1 [0;1;3] bx;; +testvalsym fjj1 [0;3;5] bx;; (* use *) +let jj2 = generate_ineq_datum_p + "Dihedral2" "{2.25,2,2.18,2.65,2.,2.2}" "{2.18,2,2,2.52,2,2}" "{2.36,2.52,2.52,sqrt8,2.52,2.52}";; +let fjj2 = ocaml_eval jj2;; (* don't use *) +testval fjj2 [0;1;3] bx;; +remake_model();; +let bcx = clone bx;; + + +(* restart case 5 *) +resetc();; +let b1 = allpass_hint_include_flat 30000 [hard 5];; + +(* This is the last of the +linear programming cases. This is when it finished running: +Thu Aug 5 13:31:11 ICT 2010 *) + + +1;; + +(* ========================================================================== *) +(* Case: OLD NOTES, 2009- July 31, 2010 *) +(* ========================================================================== *) + +(* OLD *) + +(* pick it up here tomorrow *) +let jj = generate_ineq_datum_p + "mDihedral" "{2.09,2.1,2.1,2.52,2,2}" + "{2,2,2,2.52,2,2}" "{2.18,2.52,2.52,sqrt8,2.52,2.52}";; +let fn = Temp_ineq.ocaml_eval jj;; +testvalsym fn [3;4;0] bx;; + +testvalsym (Temp_ineq.ocaml_eval(hd(Ineq.getexact "8384511215"))) [0;3;5] bx;; +testvalsym (Temp_ineq.ocaml_eval(hd(Ineq.getexact "7291663656"))) [0;3;5] bx;; +testvalsym (fun y1 y2 y3 y4 y5 y6 -> [y1;y2;y3;y4;y5;y6]) [0;3;5] bx;; +let jj = generate_ineq_datum_p + "Dihedral2" "{2.18,2.18,2,2.65,2,2.3}" + "{2,2,2,2.52,2,2}" "{2.18,2.52,2.52,sqrt8,2.52,2.52}";; + + +get_azim_table [0;1;3] bx;; +let ii = generate_ineq_datum_p "Dihedral2" "{2,2,2.3,2.65,2,2.2}" + "{2,2,2,2.52,2,2}" "{2.52,2.52,2.52,sqrt8,2.52,2.52}";; +let fn = Temp_ineq.ocaml_eval ii;; +testvalsym fn [0;3;5] bx;; (* 0.139931, lousy here, need a new ineq. *) +testval fn [4;5;3] bx;; (* 0.0629 , install it. *) +testval fn [0;1;3] bx;; (* 0.0464 , install it. *) +testvalsym (fun y1 y2 y3 y4 y5 y6 -> [y1;y2;y3;y4;y5;y6]) [0;3;5] bx;; +let jj = generate_ineq_datum_p "Dihedral2" "{2.18,2.0,2.2,2.6,2.0,2.25}" + "{2,2,2,2.52,2,2}" "{2.52,2.52,2.52,sqrt8,2.52,2.52}";; +let jj = generate_ineq_datum + "Dihedral" "{2,2,2,2,2,2}" "{2.18,2.18,2.18,2.25,2.25,2.25}";; +let jj = generate_ineq_datum_p + "Dihedral" "{2,2.1,2.1,2,2.25,2.25}" "{2,2,2,2,2,2}" "{2.18,2.18,2.18,2.25,2.25,2.25}";; +let fnjj = Temp_ineq.ocaml_eval jj;; +let idq = hd(Ineq.getexact "9229542852");; +let fn9 = Temp_ineq.ocaml_eval idq;; +testval fnjj [5;9;0] bx;; +get_azim_table [5;9;0] bx;; +remake_model();; +resolve (hard 9);; + + + +(* OLD experiments *) + +#print_length 600;;; +let bx = hd b2;; +bx;; (* 12.001 *) +sorted_azim_diff darts_of_std_tri bx;; +get_azim_table [2;0;1] bx;; +get_azim_table [2;3;0] bx;; +get_azim_table [2;1;4] bx;; +let ii = hd(Ineq.getexact "7409690040");; +ocaml_fun_of_ineq ii.ineq;; +let fxx = (fun y1 y2 y3 y4 y5 y6 -> ( dih2_y y1 y2 y3 y4 y5 y6 +. 0.0042) -. (0.952682 +. (((-. 0.268837) *. ((-. 2.36) +. y1)) +. ((0.130607 *. ((-. 2.) +. y2)) +. (((-. 0.168729) *. ((-. 2.) +. y3)) +. (((-. 0.0831764) *. ((-. 2.52) +. y4)) +. ((0.580152 *. ((-. 2.) +. y5)) +. (0.0656612 *. ((-. 2.25) +. y6)))))))));; +testval fxx [2;0;1] bx;; +remake_model();; +resolve amx2;; (* 2.063 *) +add_hints_force amx2;; + + +(* <= Jul 31 2010 *) + +let tests = ref [];; + +(* std4_diag3 disappears: *) +length hard_bb;; (* 12 *) + + +let testsuper _ = + let allhardpassA_bb = allpass 3 hard_bb in + let allhardpassS_bb = (filter (fun t -> length t.std4_diag3 >0) allhardpassA_bb) in + let allhardpassF_bb = filter (fun t -> ( length t.std4_diag3 = 0) && (length t.apex_sup_flat > 0)) allhardpassA_bb in + allhardpassS_bb = [] && allhardpassF_bb = [];; + +tests := testsuper :: !tests;; + +(* July 29 , 2010 "161847242261" starts out 12.06... *) +let b1 = onepass_hint [hard 0];; +let b2 = allpass_prune_hint 15 [hard 0];; +let b3 = allpass_prune_hint 15 b2;; +let b4 = allpass_prune_hint 15 b3;; +let b5 = allpass_prune_hint 15 b4;; +map (fun bb -> bb.hints) b5;; +let c1 = find_max b5;; (* runs out of hints at this stage, length of b5 is only 8 *) + +(* 223336279535, starts out at 12.130 *) +let a1 = onepass_hint [hard 1];; +let a2 = allpass_prune_hint 5 15 [hard 1];; +let a3 = allpass_prune_hint 5 15 a2;; +find_max (!onepass_backup);; + +(* see where this goes.... July 29, 2010, stack started at 145 *) +let a_test_july29 = allpass_prune_hint 40 80 hard_bb;; +let a0 = a_test_july29;; +map (fun bb -> bb.hints) a0;; (* no hints left *) +let amx = find_max (a0);; +map (fun bb -> bb.hypermap_id) a0;; +get_azim_table [4;5;3] amx;; +get_azim_table [0;3;5] amx;; + (fun bb -> (bb.node_200_218,bb.node_218_236,bb.node_236_252)) amx;; +fst(chop_list 15 (sorted_azim_diff darts_of_std_tri amx));; + + +darts_of_std_tri;; +find_max (!onepass_backup);; + +#print_length 600;; +amx;; +let amx2 = {hypermap_id = "154005963125"; lpvalue = None; hints = []; + diagnostic = No_data; + string_rep = + "154005963125 20 4 0 1 2 3 4 0 3 4 5 3 4 3 2 3 4 2 6 3 6 2 7 3 7 2 1 3 7 1 8 3 8 1 9 3 9 1 0 3 9 0 5 3 9 5 10 3 10 5 11 3 11 5 4 3 11 4 6 3 11 6 12 3 12 6 7 3 12 7 8 3 12 8 10 3 8 9 10 3 10 11 12 "; + std_faces_not_super = + [[4; 3; 2]; [4; 2; 6]; [6; 2; 7]; [7; 2; 1]; [7; 1; 8]; [8; 1; 9]; + [9; 1; 0]; [9; 0; 5]; [9; 5; 10]; [10; 5; 11]; [11; 5; 4]; [11; 4; 6]; + [11; 6; 12]; [12; 6; 7]; [12; 7; 8]; [12; 8; 10]; [8; 9; 10]; + [10; 11; 12]]; + std56_flat_free = []; std4_diag3 = []; + std3_big = [[7; 1; 8]; [9; 1; 0]; [9; 0; 5]; [8; 1; 9]; [9; 5; 10]]; + std3_small = + [[11; 4; 6]; [6; 2; 7]; [10; 11; 12]; [11; 6; 12]; [12; 6; 7]; + [12; 7; 8]; [7; 2; 1]; [4; 2; 6]; [11; 5; 4]; [12; 8; 10]; [10; 5; 11]; + [8; 9; 10]; [4; 3; 2]]; + apex_sup_flat = []; + apex_flat = [[4; 5; 3]; [0; 3; 5]; [2; 3; 1]; [0; 1; 3]]; apex_A = []; + apex5 = []; apex4 = []; + d_edge_225_252 = [[5; 9; 0]; [9; 1; 0]; [9; 5; 10]; [1; 9; 8]]; + d_edge_200_225 = + [[11; 4; 6]; [4; 6; 11]; [6; 11; 4]; [6; 2; 7]; [2; 7; 6]; [7; 6; 2]; + [10; 11; 12]; [11; 12; 10]; [12; 10; 11]; [11; 6; 12]; [6; 12; 11]; + [12; 11; 6]; [12; 6; 7]; [6; 7; 12]; [7; 12; 6]; [12; 7; 8]; [7; 8; 12]; + [8; 12; 7]; [7; 2; 1]; [2; 1; 7]; [1; 7; 2]; [4; 2; 6]; [2; 6; 4]; + [6; 4; 2]; [11; 5; 4]; [5; 4; 11]; [4; 11; 5]; [7; 1; 8]; [8; 7; 1]; + [1; 8; 7]; [12; 8; 10]; [8; 10; 12]; [10; 12; 8]; [0; 5; 9]; [9; 0; 5]; + [10; 5; 11]; [5; 11; 10]; [11; 10; 5]; [8; 9; 10]; [9; 10; 8]; + [10; 8; 9]; [0; 9; 1]; [1; 0; 9]; [10; 9; 5]; [8; 1; 9]; [9; 8; 1]; + [5; 10; 9]; [4; 3; 2]; [3; 2; 4]; [2; 4; 3]]; + node_218_252 = [3]; node_236_252 = [3]; node_218_236 = []; + node_200_218 = [6; 11; 12; 7; 2; 0; 4; 10; 5; 9; 1; 8]};; + +(* amx2;; 2.1878 *) +resolve amx2;; +add_hints_force amx2;; +sorted_azim_diff darts_of_std_tri amx2;; +sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat)) amx2;; +(* [(0.17937279505957382, [3; 4; 5]); (0.129169044058939808, [5; 3; 4]); + (0.115889948342437377, [5; 0; 3]); (0.101279767307688728, [1; 3; 0]); + (0.101279767307671298, [1; 2; 3]); (0.081429255816779289, [0; 3; 5]);];; *) +(* added new ineq 4750199435 *) +resolve amx2;; (* 2.1718 *) +add_hints_force amx2;; +sorted_azim_diff darts_of_std_tri amx2;; +sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat)) amx2;; +amx2;; +get_azim_table [4;5;3] amx2;; +get_azim_table [0;3;5] amx2;; +get_azim_table [0;1;3] amx2;; +get_azim_table [2;3;1] amx2;; +let f00 = (fun y1 y2 y3 y4 y5 y6 -> (( Sphere_math.dih2_y y1 y2 y3 y4 y5 y6 -. 1.083) +. (((0.6365 *. (y1 -. 2.)) -. (0.198 *. (y2 -. 2.))) +. ((0.352 *. (y3 -. 2.)) +. (((0.416 *. (y4 -. 2.52)) -. (0.66 *. (y5 -. 2.))) +. (0.071 *. (y6 -. 2.)))))) -. 0.);; + +let dih2_y = Sphere_math.dih2_y;; + +ocaml_fun_of_ineq i8384511215.ineq;; +let fxx = (fun y1 y2 y3 y4 y5 y6 -> ( dih2_y y1 y2 y3 y4 y5 y6 +. 0.0015) -. (0.913186 +. (((-. 0.390288) *. ((-. 2.) +. y1)) +. ((0.115895 *. ((-. 2.) +. y2)) +. ((0.164805 *. ((-. 2.52) +. y3)) +. (((-. 0.271329) *. ((-. 2.82843) +. y4)) +. ((0.584817 *. ((-. 2.) +. y5)) +. ((-. 0.170218) *. ((-. 2.) +. y6)))))))));; + +testval f00 [4;5;3] amx2;; + +remake_model();; +resolve amx2;; (* 2.063 *) +add_hints_force amx2;; +sorted_azim_diff darts_of_std_tri amx2;; +sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat)) amx2;; +get_azim_table[8;1;9] amx2;; +get_azim_table[0;5;9] amx2;; +get_azim_table[0;9;1] amx2;; +ocaml_fun_of_ineq i7819193535.ineq;; +let fxx = (fun y1 y2 y3 y4 y5 y6 -> ( dih2_y y1 y2 y3 y4 y5 y6 +. 0.0011) -. (1.16613 +. (((-. 0.296776) *. ((-. 2.) +. y1)) +. ((0.208935 *. ((-. 2.) +. y2)) +. (((-. 0.243302) *. ((-. 2.) +. y3)) +. (((-. 0.360575) *. ((-. 2.25) +. y4)) +. ((0.636205 *. ((-. 2.) +. y5)) +. ((-. 0.295156) *. ((-. 2.) +. y6)))))))));; +testval fxx [8;1;9] amx2;; + +remake_model();; +resolve amx2;; (* 2.056 *) +add_hints_force amx2;; +sorted_azim_diff darts_of_std_tri amx2;; +sorted_azim_weighted_diff (fun bb -> rotation (bb.apex_flat)) amx2;; +get_azim_table[0;3;5] amx2;; +get_azim_table[0;5;9] amx2;; +get_azim_table[0;9;1] amx2;; +ocaml_fun_of_ineq i2621779878.ineq;; +let fxx = (fun y1 y2 y3 y4 y5 y6 -> ( dih2_y y1 y2 y3 y4 y5 y6 +. 0.0011) -. (1.16613 +. (((-. 0.296776) *. ((-. 2.) +. y1)) +. ((0.208935 *. ((-. 2.) +. y2)) +. (((-. 0.243302) *. ((-. 2.) +. y3)) +. (((-. 0.360575) *. ((-. 2.25) +. y4)) +. ((0.636205 *. ((-. 2.) +. y5)) +. ((-. 0.295156) *. ((-. 2.) +. y6)))))))));; +testval fxx [8;1;9] amx2;; + +(* material from 2009 *) +(* case 86506100695 *) +let h86 _ = + let h86 = [findid "86506100695" hard_bb] in + let h86a = allpass 10 h86 in + let h86b = allpass 10 h86a in + allvpass h86b = [];; +tests := h86 :: !tests;; + + +(* the 2 pressed icosahedra remain *) + +let hard2_bb = filter (fun t -> mem t.hypermap_id ["161847242261";"223336279535"]) hard_bb;; + + +length hard2_bb;; +let h16 = allvpass (findall "161847242261" hard_bb);; +let h16max = find_max h16;; (* 12.0627 *) +let b16 = h16;; +let b16a = all_highvpass b16;; +length b16a;; +let b16Amax = find_max b16a;; (* 12.0627 *) +let b16b = (one_epass b16a);; +let b16c = one_epass (one_epass b16b);; +let b16d = one_epass b16c;; +length b16d;; +let b16e = find_max b16d;; (* 12.051 *) +0;; (* -- *) +let c16a= allpass 10 b16d;; +let c16Amax = find_max c16a;; (* 12.048 *) (* was 12.059 *) +length c16a;; (* 997 *) +let c16b = allpass 15 c16a;; +let c16Bmax = find_max c16b;; (* 12.026 *) (* was 12.037 *) +length c16b;; (* 657 *) (* was 636 *) + + +(* + +(* this one is a dodecahedron modified with node 2 pressed + into an edge *) + let h = findid (nth hardid 3);; (* 12223336279535 *) + let h1 = allpass [h];; + length h1;; (* length 1885 *) + let k1 = find_max h1;; (* 12.0416 *) + let h2 = onevpassi h1 2;; (* length h2 : 2637 *) +(* unfinished... *) + +(* this one is triangles only, types {6,0}, {4,0}, {6,0}. *) + let r = findid (nth hardid 5);; (* 12161847242261 *) + length r1;; (* length *) + let r1 = allvpass [r];; + let r2 = allpass r1;; +(* unfinished *) + +*) + + + + +(* +let allhardpassB_bb = allpass 8 hard2_bb;; +*) + +(* +let hard2_bb = [nth hard_bb 0;nth hard_bb 1];; +(* to here *) + +length (allhardpassB_bb);; (* 288 *) +let h16 = find_max allhardpassB_bb;; +(* unfinished *) +*) + +(* +let h0 = nth hard_bb 0;; +let h1 = + let s i l= flatten((map (fun t -> switch_node t i)) l) in + let branches = s 4( s 3( s 2( s 1 (s 0 [h0])) ) ) in + filter_feas branches;; +length h1;; +find_max h1;; +let all16_bb = allpass 6 h1;; +(* unfinished *) +*) + + +(* ========================================================================== *) +(* Case: OLD NOTES, Aug 4, 2010 *) +(* ========================================================================== *) + +(* Don't need the rest of the file, if execute works. *) + +(* this eliminates case 11 *) +let b34970074286() = allpass_hint 500 [hard 11];; + +(* this eliminates case 10, about 5000 linear programs *) + +let b75641658977() = allpass_hint 2500 [hard 10];; + +(* + let b1 = allpass_hint 500 [hard 10] in + let b2 = allpass_hint 500 b1 in + let b3 = allpass_hint 500 b2 in + let b4 = allpass_hint 500 b3 in + let b5 = allpass_hint 500 b4 in + b5;; +*) + + +let b88089363170() = allpass_hint 1000 [hard 9];; + +let b86506100695() = allpass_hint 2000 [hard 8];; + +let b242652038506() = allpass_hint_include_flat 10 [hard 7];; + +let b179189825656() = allpass_hint 50 [hard 6];; + +let b154005963125() = allpass_hint 3000 [hard 5];; + +let b39599353438() = allpass_hint 10 [hard 4];; + +let b65974205892() = allpass_hint 30 [hard 3];; + +let b50803004532() = allpass_hint 500 [hard 2];; + +let b223336279535() = allpass_hint_include_flat 20000 [hard 1];; + +let b161847242261() = allpass_hint 5000 [hard 0];; (* runs to 3583 *) + diff --git a/legacy/inequalities/definitions_kepler.ml b/legacy/inequalities/definitions_kepler.ml new file mode 100644 index 0000000..2670f6c --- /dev/null +++ b/legacy/inequalities/definitions_kepler.ml @@ -0,0 +1,1268 @@ +(* This file now uses Harrison's R^n from hol-light version 2.20. + It should also be compatible with the Feb 2008 release of HOL-Light. + It is not compatible with pre-2.20 versions of HOL-LIGHT. +*) + +(* system dependent : + + load_path := + ["/Users/thomashales/Desktop/flyspeck_google/source/inequalities/"] + @ (!load_path) +*) + +(* +needs "Multivariate/vectors.ml";; (* Eventually should load entire *) +needs "Examples/analysis.ml";; (* multivariate-complex theory. *) +needs "Examples/transc.ml";; (* Then it won't need these three. *) + + +*) + + + +let kepler_def = (* local_definition "kepler";; *) new_definition;; + +prioritize_real();; + +let max_real = new_definition(`max_real x y = + if (y < x) then x else y`);; + +let min_real = new_definition(`min_real x y = + if (x < y) then x else y`);; + +let min_num = new_definition + `min_num (X:num->bool) = @m. (m IN X) /\ (!n. (n IN X) ==> (m <= n))`;; + + +let deriv = new_definition(`deriv f x = @d. (f diffl d)(x)`);; +let deriv2 = new_definition(`deriv2 f = (deriv (deriv f))`);; + +(* ------------------------------------------------------------------ *) +(* Extend atn to allow zero denominators. *) +(* ------------------------------------------------------------------ *) + +(* new argument order 2/14/2008 to make it compatible with the + ANSI C arctan2 function. Also reworked for better numerical + stability in the regions that matter for us. The way things + are defined, it gives atn2(0,0) = pi. This is a bit strange, + but we never need its value at the origin anyway. + + 4/19/2008: changed final case to pi along the negative real axis. +*) + +let atn2 = new_definition(`atn2(x,y) = + if ( abs y < x ) then atn(y / x) else + (if (&0 < y) then ((pi / &2) - atn(x / y)) else + (if (y < &0) then (-- (pi/ &2) - atn (x / y)) else ( pi )))`);; + +(* ------------------------------------------------------------------ *) + +let sqrt8 = kepler_def (`sqrt8 = sqrt (&8) `);; +let sqrt2 = kepler_def (`sqrt2 = sqrt (&2) `);; + +(* ------------------------------------------------------------------ *) + +let t0 = kepler_def (`t0 = (#1.255)`);; +let two_t0 = kepler_def(`two_t0 = (#2.51)`);; +let square_2t0 = kepler_def(`square_2t0 = two_t0*two_t0`);; +let square_4t0 = kepler_def(`square_4t0 = (&4)*square_2t0`);; +let pt = kepler_def(`pt = (&4)*(atn (sqrt2/(&5))) - (pi/(&3))`);; +let square = kepler_def(`square x = x*x`);; + +(* ------------------------------------------------------------------ *) +(* Standard constants. *) +(* ------------------------------------------------------------------ *) + +let zeta = kepler_def(`zeta= (&1)/((&2) * atn (sqrt2/(&5)))`);; +let doct = kepler_def(`doct= (pi - (&2)/zeta)/sqrt8`);; +let dtet = kepler_def(`dtet = sqrt2/zeta`);; +let pi_rt18 = kepler_def(`pi_rt18= pi/(sqrt (&18))`);; + +(* ------------------------------------------------------------------ *) +(* Technical constants. *) +(* ------------------------------------------------------------------ *) + +let rogers_density=kepler_def(`rogers_density= sqrt2/zeta`);; +let compression_cut=kepler_def(`compression_cut=(#1.41)`);; +let squander_target=kepler_def(`squander_target = + ((&4)*pi*zeta - (&8))*pt`);; +let xiV=kepler_def(`xiV=(#0.003521)`);; +let xi_gamma=kepler_def(`xi_gamma=(#0.01561)`);; +let xi'_gamma=kepler_def(`xi'_gamma=(#0.00935)`);; +let xi_kappa=kepler_def(`xi_kappa= -- (#0.029)`);; +let xi_kappa_gamma=kepler_def(`xi_kappa_gamma= + xi_kappa+xi_gamma`);; +let pi_max =kepler_def(`xi_max = (#0.006688)`);; +let t4 = kepler_def(`t4= (#0.1317)`);; +let t5 = kepler_def(`t5= (#0.27113)`);; +let t6 = kepler_def(`t6= (#0.41056)`);; +let t7 = kepler_def(`t7= (#0.54999)`);; +let t8 = kepler_def(`t8= (#0.6045)`);; +let t9 = kepler_def(`t9= (#0.6978)`);; +let t10= kepler_def(`t10=(#0.7891)`);; +let s5 = kepler_def(`s5= --(#0.05704)`);; +let s6 = kepler_def(`s6= --(#0.11408)`);; +let s7 = kepler_def(`s7= --(#0.17112)`);; +let s8 = kepler_def(`s8= --(#0.22816)`);; +let s9 = kepler_def(`s9= --(#0.1972)`);; + +(* Note this is what s10 is in DCG p128, but for the blueprint + it should be made -eps0 so that the 8pt bound holds by margin eps0 *) +let s10= kepler_def(`s10= #0.0`);; +let eps0 = kepler_def(`eps0 = #0.000000000001`);; (* eps0 = 10^-12 *) + + +let Z31 = kepler_def(`Z31 = (#0.00005)`);; +let Z32 = kepler_def(`Z32 = -- (#0.05714)`);; +let Z33 = kepler_def(`Z33 = s6 - (#3.0)*Z31`);; +let Z41 = kepler_def(`Z41 = s5 - Z31`);; +let Z42 = kepler_def(`Z42 = s6 - (#2.0)*Z31`);; + +let D31 = kepler_def(`D31 = t4 - (#0.06585)`);; (* = 0.06585 *) +let D32 = kepler_def(`D32 = (#0.13943)`);; +let D33 = kepler_def(`D33 = t6 - (#0.06585)*(#3.0)`);; +let D41 = kepler_def(`D41 = t5 - (#0.06585)`);; +let D42 = kepler_def(`D42 = t6 - (#2.0)*(#0.06585)`);; +let D51 = kepler_def(`D51 = t6 - (#0.06585)`);; + +(* ------------------------------------------------------------------ *) +(* Ferguson's thesis constants from DCG-2006-Sec 17.4 *) +(* ------------------------------------------------------------------ *) + +let pp_a1 = kepler_def(`pp_a1 = #0.38606588081240521`);; +let pp_a2 = kepler_def(`pp_a2 = #0.4198577862`);; +let pp_d0 = kepler_def(`pp_d0 = #1.4674`);; +let pp_m = kepler_def(`pp_m = #0.3621`);; +let pp_b = kepler_def(`pp_b = #0.49246`);; +let pp_a = kepler_def(`pp_a = #0.0739626`);; +let pp_bc = kepler_def(`pp_bc = #0.253095`);; +let pp_c = kepler_def(`pp_c = #0.1533667634670977`);; +let pp_d = kepler_def(`pp_d = #0.2265`);; +(* solt0 = Solid[2,2,2,2,2,Sqrt[8]] *) +let pp_solt0 = kepler_def(`pp_solt0 = &2 * atn2 (&1, sqrt8)`);; + +(* ------------------------------------------------------------------ *) +(* This polynomial is essentially the Cayley-Menger determinant. *) +(* ------------------------------------------------------------------ *) +let delta_x = kepler_def (`delta_x x1 x2 x3 x4 x5 x6 = + x1*x4*(--x1 + x2 + x3 -x4 + x5 + x6) + + x2*x5*(x1 - x2 + x3 + x4 -x5 + x6) + + x3*x6*(x1 + x2 - x3 + x4 + x5 - x6) + -x2*x3*x4 - x1*x3*x5 - x1*x2*x6 -x4*x5*x6`);; + +(* ------------------------------------------------------------------ *) +(* The partial derivative of delta_x with respect to x4. *) +(* ------------------------------------------------------------------ *) + +let delta_x4 = kepler_def(`delta_x4 x1 x2 x3 x4 x5 x6 + = -- x2* x3 - x1* x4 + x2* x5 + + x3* x6 - x5* x6 + x1* (-- x1 + x2 + x3 - x4 + x5 + x6)`);; + +let delta_x6 = kepler_def(`delta_x6 x1 x2 x3 x4 x5 x6 + = -- x1 * x2 - x3*x6 + x1 * x4 + + x2* x5 - x4* x5 + x3*(-- x3 + x1 + x2 - x6 + x4 + x5)`);; + +(* ------------------------------------------------------------------ *) +(* Circumradius . *) +(* ------------------------------------------------------------------ *) + +(* same as ups_x +let u_x = kepler_def( + `u_x x1 x2 x3 = (--(x1*x1+x2*x2+x3*x3)) + + (&2) * (x1*x2+x2*x3+x3*x1)`);; +*) + +let ups_x = kepler_def(`ups_x x1 x2 x6 = + --x1*x1 - x2*x2 - x6*x6 + + &2 *x1*x6 + &2 *x1*x2 + &2 *x2*x6`);; + + +let eta_x = kepler_def(`eta_x x1 x2 x3 = + (sqrt ((x1*x2*x3)/(ups_x x1 x2 x3))) + `);; + +let eta_y = kepler_def(`eta_y y1 y2 y3 = + let x1 = y1*y1 in + let x2 = y2*y2 in + let x3 = y3*y3 in + eta_x x1 x2 x3`);; + +let rho_x = kepler_def(`rho_x x1 x2 x3 x4 x5 x6 = + --x1*x1*x4*x4 - x2*x2*x5*x5 - x3*x3*x6*x6 + + (&2)*x1*x2*x4*x5 + (&2)*x1*x3*x4*x6 + (&2)*x2*x3*x5*x6`);; + +let rad2_y = kepler_def(`rad2_y y1 y2 y3 y4 y5 y6 = + let (x1,x2,x3,x4,x5,x6)= (y1*y1,y2*y2,y3*y3,y4*y4,y5*y5,y6*y6) in + (rho_x x1 x2 x3 x4 x5 x6)/((delta_x x1 x2 x3 x4 x5 x6)*(&4))`);; + + +let chi_x = kepler_def(`chi_x x1 x2 x3 x4 x5 x6 + = -- (x1*x4*x4) + x1*x4*x5 + x2*x4*x5 - x2*x5*x5 + + x1*x4*x6 + x3*x4*x6 + + x2*x5*x6 + x3*x5*x6 - (&2) * x4*x5*x6 - x3*x6*x6`);; + + + +(* ------------------------------------------------------------------ *) +(* The formula for the dihedral angle of a simplex. *) +(* The variables xi are the squares of the lengths of the edges. *) +(* The angle is computed along the first edge (x1). *) +(* ------------------------------------------------------------------ *) + +let dih_x = kepler_def(`dih_x x1 x2 x3 x4 x5 x6 = + let d_x4 = delta_x4 x1 x2 x3 x4 x5 x6 in + let d = delta_x x1 x2 x3 x4 x5 x6 in + pi/ (&2) + atn2( (sqrt ((&4) * x1 * d)),-- d_x4)`);; + + +let dih_y = kepler_def(`dih_y y1 y2 y3 y4 y5 y6 = + let (x1,x2,x3,x4,x5,x6)= (y1*y1,y2*y2,y3*y3,y4*y4,y5*y5,y6*y6) in + dih_x x1 x2 x3 x4 x5 x6`);; + +let dih2_y = kepler_def(`dih2_y y1 y2 y3 y4 y5 y6 = + dih_y y2 y1 y3 y5 y4 y6`);; + +let dih3_y = kepler_def(`dih3_y y1 y2 y3 y4 y5 y6 = + dih_y y3 y1 y2 y6 y4 y5`);; + +let dih2_x = kepler_def(`dih2_x x1 x2 x3 x4 x5 x6 = + dih_x x2 x1 x3 x5 x4 x6`);; + +let dih3_x = kepler_def(`dih3_x x1 x2 x3 x4 x5 x6 = + dih_x x3 x1 x2 x6 x4 x5`);; + + +(* ------------------------------------------------------------------ *) +(* Harriot-Euler formula for the area of a spherical triangle *) +(* in terms of the angles: area = alpha+beta+gamma - pi *) +(* ------------------------------------------------------------------ *) + +let sol_x = kepler_def(`sol_x x1 x2 x3 x4 x5 x6 = + (dih_x x1 x2 x3 x4 x5 x6) + + (dih_x x2 x3 x1 x5 x6 x4) + (dih_x x3 x1 x2 x6 x4 x5) - pi`);; + +let sol_y = kepler_def(`sol_y y1 y2 y3 y4 y5 y6 = + (dih_y y1 y2 y3 y4 y5 y6) + + (dih_y y2 y3 y1 y5 y6 y4) + (dih_y y3 y1 y2 y6 y4 y5) - pi`);; + + +(* ------------------------------------------------------------------ *) +(* The Cayley-Menger formula for the volume of a simplex *) +(* The variables xi are the squares of the lengths of the edges. *) +(* ------------------------------------------------------------------ *) + +let vol_x = kepler_def(`vol_x x1 x2 x3 x4 x5 x6 = + (sqrt (delta_x x1 x2 x3 x4 x5 x6))/ (&12)`);; + +(* ------------------------------------------------------------------ *) +(* Some lower dimensional funcions and Rogers simplices. *) +(* ------------------------------------------------------------------ *) + +let beta = kepler_def(`beta psi theta = + let arg = ((cos psi)*(cos psi) - (cos theta)*(cos theta))/ + ((&1) - (cos theta)*(cos theta)) in + (acs (sqrt arg))`);; + +let arclength = kepler_def(`arclength a b c = + pi/(&2) + (atn2( (sqrt (ups_x (a*a) (b*b) (c*c))),(c*c - a*a -b*b)))`);; + + +let volR = kepler_def(`volR a b c = + (sqrt (a*a*(b*b-a*a)*(c*c-b*b)))/(&6)`);; + +let solR = kepler_def(`solR a b c = + (&2)*atn2( sqrt(((c+b)*(b+a))), sqrt ((c-b)*(b-a)))`);; + +let dihR = kepler_def(`dihR a b c = + atn2( sqrt(b*b-a*a),sqrt (c*c-b*b))`);; + +let vorR = kepler_def(`vorR a b c = + (&4)*(--doct*(volR a b c) + (solR a b c)/(&3))`);; + +let denR = kepler_def(`denR a b c = + (solR a b c)/((&3)*(volR a b c))`);; + +let tauR = kepler_def(`tauR a b c = + --(volR a b c) + (solR a b c)*zeta*pt`);; + +let quoin = kepler_def(`quoin a b c = + let u = sqrt ((c*c-b*b)/(b*b-a*a)) in + if ((a>=b) \/ (b>=c)) then (&0) else + (--(a*a + a*c-(&2)*c*c)*(c-a)*atn(u)/(&6) + + a*(b*b-a*a)*u/(&6) + - ((&2)/(&3))*c*c*c*(atn2((b+c),(u*(b-a)))))`);; + +let qy = kepler_def(`qy y1 y2 y3 t = + quoin (y1/(&2)) (eta_y y1 y2 y3) t`);; + +let quo_x = kepler_def(`quo_x x y z = qy (sqrt x) (sqrt y) (sqrt z) t0`);; + +let qn = kepler_def(`qn y1 y2 z t = + --(&4)*doct*((qy y1 y2 z t) +(qy y2 y1 z t))`);; + +let phi = kepler_def(`phi h t = + (&2)*((&2) - doct*h*t*(h+t))/(&3)`);; + +let phi0 = kepler_def(`phi0 = + phi t0 t0`);; + +let eta0 = kepler_def(`eta0 h = + eta_y ((&2)*h) (two_t0) (&2)`);; + +let crown = kepler_def(`crown h = + let e = eta0 h in + (&2)*pi*((&1)- h/e)*(phi h e - phi0)`);; + +let anc = kepler_def(`anc y1 y2 y6 = + let h1 = y1/(&2) in + let h2 = y2/(&2) in + let b = eta_y y1 y2 y6 in + let c = eta0 h1 in + if (b>c) then (&0) else + --(dihR h1 b c)*(crown h1)/((&2)*pi) + -(solR h1 b c)*phi0 + (vorR h1 b c) + -(dihR h2 b c)*((&1)-h2/t0)*((phi h2 t0)-phi0) + -(solR h2 b c)*(phi0) + (vorR h2 b c)`);; + +let K0 = kepler_def(`K0 y1 y2 y6 = + (vorR (y1/(&2)) (eta_y y1 y2 y6) (sqrt2)) + + (vorR (y2/(&2)) (eta_y y1 y2 y6) (sqrt2)) - + (dihR (y1/(&2)) (eta_y y1 y2 y6) (sqrt2))* + (&1 - (y1/(sqrt8)))*(phi (y1/(&2)) sqrt2)`);; + +let AH = kepler_def(`AH h t = (&1 - (h/t))*((phi h t) - (phi t t))`);; + +let BHY = kepler_def(`BHY y = (AH (y/(&2)) t0) + phi0`);; + +(* + +(* This definition still needs to be finished *) +let overlap_f = kepler_def( + `overlap_f y1 y2 = + let ell = (#3.2) in + let lam = (#1.945) in + let dih1 = dih_y y1 t0 y2 lam ell lam in + let dih2 = dih_y y2 t0 y1 lam ell lam in + let s = sol_y y2 t0 y1 lam ell lam in + let phi1 = phi (y1/(&2)) t0 in + let phi2 = phi (y2/(&2)) t0 in + (&2)*(zeta*pt - phi0)*s + + (&2)*dih1*((&1) - (y1/two_t0))*(phi0-phi1) + + (&2)*dih2*((&1) - (y2/two_t0))*(phi0-phi2) + + xxxxx-- need to insert tau terms ---xxxxx`);; +*) + + +(* ------------------------------------------------------------------ *) +(* Analytic and truncated Voronoi function *) +(* ------------------------------------------------------------------ *) + +let KY = kepler_def(`KY y1 y2 y3 y4 y5 y6 = + (K0 y1 y2 y6) + (K0 y1 y3 y5) + + (dih_y y1 y2 y3 y4 y5 y6)* + (&1 - (y1/(sqrt8)))*(phi (y1/(&2)) sqrt2)`);; + +let KX = kepler_def(`KX x1 x2 x3 x4 x5 x6 = + KY (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`);; + +let vor_analytic_x = kepler_def(`vor_analytic_x x1 x2 x3 x4 x5 x6 = + let del = sqrt (delta_x x1 x2 x3 x4 x5 x6) in + let u126 = ups_x x1 x2 x6 in + let u135 = ups_x x1 x3 x5 in + let u234 = ups_x x2 x3 x4 in + let vol = ((&1)/((&48)*del))* + ((x1*(x2+x6-x1)+x2*(x1+x6-x2))*(chi_x x4 x5 x3 x1 x2 x6)/u126 + +(x2*(x3+x4-x2)+x3*(--x3+x4+x2))*(chi_x x6 x5 x1 x3 x2 x4)/u234 + +(x1*(--x1+x3+x5)+x3*(x1-x3+x5))*(chi_x x4 x6 x2 x1 x3 x5)/u135) + in + (&4)*(--doct*vol + (sol_x x1 x2 x3 x4 x5 x6)/(&3))`);; + +let vor_analytic_x_flipped = kepler_def(`vor_analytic_x_flipped x1 x2 x3 x4 x5 x6 = + vor_analytic_x x1 x5 x6 x4 x2 x3`);; + +let octavor_analytic_x = kepler_def(`octavor_analytic_x + x1 x2 x3 x4 x5 x6 = + (#0.5)*((vor_analytic_x x1 x2 x3 x4 x5 x6) + (vor_analytic_x_flipped x1 x2 x3 x4 x5 x6))`);; + +let tau_analytic_x = kepler_def(`tau_analytic_x x1 x2 x3 x4 x5 x6 = + (sol_x x1 x2 x3 x4 x5 x6)*zeta*pt - + (vor_analytic_x x1 x2 x3 x4 x5 x6)`);; + +(* bug found 3/21/2008: had parenthesis misplaced. -tch *) + +let kappa = kepler_def(`kappa y1 y2 y3 y4 y5 y6 = + (crown (y1/(&2)))*(dih_y y1 y2 y3 y4 y5 y6)/((&2)*pi) + + (anc y1 y2 y6) + (anc y1 y3 y5)`);; + +let kappa_dih_y = kepler_def(`kappa_dih_y y1 y2 y3 y5 y6 d = + (crown (y1/(&2)))*d/((&2)*pi) + + (anc y1 y2 y6) + (anc y1 y3 y5)`);; + + +let level_at = kepler_def(`level_at h t = if (h min_num +Exists uniquely on all nonempty subsets of N. +Can be uniquely extended to all subsets by defining min_num {} = 0 + +> deriv +This is the derivative of a function of a real variable. Its domain is more difficult to describe. + +> aff +Exists uniquely on all finite subsets of R3. +It will only be used on finite sets. +Can be uniquely extended to all subsets by defining aff S = S, when S is infinite + + +> min_polar +Exists uniquely on all nonempty finite sets of ordered pairs of real numbers +Can be uniquely extended to all sets of ordered pairs by setting min_polar X = ( &0, &0 ), when X is empty or infinite. +This definition actually holds for some infinite sets, but I never use it, except on finite sets, so you are free +to redefine it to be (&0,&0) on infinite sets. + +> iter +iter is uniquely defined with no domain conditions, no preconditions + +> azim +Exists uniquely when the stated non collinearity preconditions are met: ~(collinear {v, w, w1}) /\ ~(collinear {v, w, w2}) +(The preconditions azim_hyp, orthonormality, and e3 normalization are not domain constraints, because they do not restrict v w w1 w2.) +Can be uniquely extended to all cases, by setting azim w1 w2 w3 w4 = &0, when the non-collinearity preconditions are not met. + + +> azim_cycle +azim_cycle W v w p exists uniquely under the preconditions (W p) /\ (cyclic_set W v w). +It is only used when the preconditions are met. +Can be uniquely extended to all cases, by setting azim_cycle W v w p = p, when these two preconditions are not met. + + + +*) + + +(* from convex.ml: *) + +let affine = new_definition + `affine s <=> !x y u v. x IN s /\ y IN s /\ (u + v = &1) + ==> (u % x + v % y) IN s`;; +let convex = new_definition + `convex s <=> + !x y u v. x IN s /\ y IN s /\ &0 <= u /\ &0 <= v /\ (u + v = &1) + ==> (u % x + v % y) IN s`;; + +(* aff is deprecated *) +let aff = new_definition `aff = ( hull ) affine`;; + +let lin_combo = new_definition `lin_combo V f = vsum V (\v. f v % (v:real^N))`;; + +(* Fix "sum" because Harrison's interface is too special in analysis.ml *) + +reduce_interface("sum",`sum:(num->bool)->(num->real)->real`);; +reduce_interface("sum",`psum:(num#num)->(num->real)->real`);; +let remove_overload sym = + let overload_skeletons = filter ((<>)sym o fst) (!the_overload_skeletons) in + the_overload_skeletons := overload_skeletons;; +remove_overload "sum";; +make_overloadable "sum" `:A->(B->real)->real`;; +overload_interface("sum",`sum:(A->bool)->(A->real)->real`);; +overload_interface("sum",`psum:(num#num)->(num->real)->real`);; + +let affsign = new_definition `affsign sgn s t (v:real^A) = (?f. + (v = lin_combo (s UNION t) f) /\ (!w. t w ==> sgn (f w)) /\ (sum (s UNION t) f = &1))`;; + + +let sgn_gt = new_definition `sgn_gt = (\t. (&0 < t))`;; +let sgn_ge = new_definition `sgn_ge = (\t. (&0 <= t))`;; +let sgn_lt = new_definition `sgn_lt = (\t. (t < &0))`;; +let sgn_le = new_definition `sgn_le = (\t. (t <= &0))`;; + +(* conv is deprecated. Use `convex hull S` instead *) + +let conv = new_definition `conv S:real^A->bool = affsign sgn_ge {} S`;; +let conv0 = new_definition `conv0 S:real^A->bool = affsign sgn_gt {} S`;; +let cone = new_definition `cone v S:real^A->bool = affsign sgn_ge {v} S`;; +let cone0 = new_definition `cone0 v S:real^A->bool = affsign sgn_gt {v} S`;; + +(* deprecated: + +let semiconvex = new_definition + `semiconvex sgn s t <=> + !x y z u v w. x IN (affine hull s) /\ y IN t /\ z IN t /\ sgn v /\ sgn w /\ (u + v + w = &1) + ==> (u % x + v % y + w % z) IN t`;; + +*) + +let aff_gt_def = new_definition `aff_gt = affsign sgn_gt`;; +let aff_ge_def = new_definition `aff_ge = affsign sgn_ge`;; +let aff_lt_def = new_definition `aff_lt = affsign sgn_lt`;; +let aff_le_def = new_definition `aff_le = affsign sgn_le`;; + + +(* conv is deprecated. Use `convex hull S` instead *) + +(* Vuong Quyen has pointed out that the definition of aff_insert + is incorrect. + + New definitions are based on Multivariate/convex.ml. + + -TCH 8/17/08. +*) + + +(* SWSAMQE *) + +let voronoi = new_definition `voronoi v S = { x | !w. ((S w) /\ ~(w=v)) ==> (dist( x, v) < dist( x, w)) }`;; + +let voronoi_le = new_definition `voronoi_le v S = { x | !w. ((S w) /\ ~(w=v)) ==> (dist( x, v) <= dist( x, w)) }`;; + + + +(* LFQMLPU *) + +let line = new_definition `line x = (?v w. ~(v =w) /\ (x = affine hull {v,w}))`;; + +(* Done in Harrison's Multilinear/vectors.ml (Feb 2008 release only) : let collinear = new_definition `collinear S = (?x. line x /\ S SUBSET x)`;; *) +(* repeat of definition for 2.20 version *) +(* PPZSAYG *) +let collinear = new_definition + `collinear s <=> ?u. !x y. x IN s /\ y IN s ==> ?c. x - y = c % u`;; + +(* BUGLQNN *) +(* MHHXNTW *) +(* QTQNLKK *) + +let plane = new_definition `plane x = (?u v w. ~(collinear {u,v,w}) /\ (x = affine hull {u,v,w}))`;; +let closed_half_plane = new_definition `closed_half_plane x = (?u v w. ~(collinear {u,v,w}) /\ (x = aff_ge {u,v} {w}))`;; +let open_half_plane = new_definition `open_half_plane x = (?u v w. ~(collinear {u,v,w}) /\ (x = aff_gt {u,v} {w}))`;; +let coplanar = new_definition `coplanar S = (?x. plane x /\ S SUBSET x)`;; +let closed_half_space = new_definition `closed_half_space x = (?u v w w'. ~(coplanar {u,v,w,w'}) /\ (x = aff_ge {u,v,w} {w'}))`;; +let open_half_space = new_definition `open_half_space x = (?u v w w'. ~(coplanar {u,v,w,w'}) /\ (x = aff_gt {u,v,w} {w'}))`;; + +(* WMJHKBL *) +let bis = new_definition `bis u v = {x | dist(x,u) = dist(x,v)}`;; + +(* TIWZVEW *) +let bis_le = new_definition `bis_le u v = {x | dist(x,u) <= dist(x,v) }`;; +let bis_lt = new_definition `bis_lt u v = {x | dist(x,u) < dist(x,v) }`;; + +(* XCJABYH *) +let circumcenter = new_definition `circumcenter S = @v. ( (affine hull S) v /\ (?c. !w. (S w) ==> (c = dist(v,w))))`;; + +(* XPLPHNG *) +(* circumradius *) +let radV = new_definition `radV S = @c. !w. (S w) ==> (c = dist(circumcenter S,w))`;; + + +(* EOBLRCS *) +let orientation = new_definition `orientation S v sgn = affsign sgn (S DIFF {v}) {v} (circumcenter S)`;; + +(* ANGLE *) + +let arcV = new_definition `arcV u v w = acs (( (v - u) dot (w - u))/((norm (v-u)) * (norm (w-u))))`;; + +let cross = new_definition `cross u v = let (x,y,z) = triple_of_real3 u in + let (x',y',z') = triple_of_real3 v in + (real3_of_triple (y*z' - y'*z, z*x' - z'*x, x*y' - x'*y))`;; + +let dihV = new_definition `dihV w0 w1 w2 w3 = + let va = w2 - w0 in + let vb = w3 - w0 in + let vc = w1 - w0 in + let vap = ( vc dot vc) % va - ( va dot vc) % vc in + let vbp = ( vc dot vc) % vb - ( vb dot vc) % vc in + arcV (vec 0) vap vbp`;; + +(* conventional ordering on variables *) + +let ylist = new_definition `ylist w0 w1 w2 w3 = + ((dist (w0, w1)),(dist( w0, w2)),(dist( w0, w3)),(dist( w2, w3)),(dist( w1, w3)),(dist( w1, w2)))`;; + +let xlist = new_definition `xlist w0 w1 w2 w3 = + let (y1,y2,y3,y4,y5,y6) = ylist w0 w1 w2 w3 in + (y1 pow 2, y2 pow 2, y3 pow 2, y4 pow 2, y5 pow 2, y6 pow 2)`;; + +let euler_p = new_definition `euler_p v0 v1 v2 v3 = + (let (y1,y2,y3,y4,y5,y6) = ylist v0 v1 v2 v3 in + let w1 = v1 - v0 in + let w2 = v2 - v0 in + let w3 = v3 - v0 in + y1*y2*y3 + y1*( w2 dot w3) + y2*( w3 dot w1) + y3*( w1 dot w2))`;; + +(* polar coordinates *) + +let radius = new_definition `radius x y = sqrt((x pow 2) + (y pow 2))`;; +let polar_angle = new_definition `polar_angle x y = + let theta = atn2(x,y) in + if (theta < &0) then (theta + (&2 * pi)) else theta`;; +let polar_c = new_definition `polar_c x y = (radius x y,polar_angle x y)`;; + +let less_polar = new_definition `less_polar (x,y) (x',y') = + let (r,theta) = polar_c x y in + let (r',theta') = polar_c x' y' in + (theta < theta') \/ ((theta =theta') /\ (r < r'))`;; + +let min_polar = new_definition `min_polar V = ( @ u. V u /\ (!w. V w /\ ~(u = w) ==> (less_polar u w)))`;; + +let polar_cycle = new_definition `polar_cycle V v = + let W = {u | V u /\ less_polar v u} in + if (W = EMPTY) then min_polar V else min_polar W`;; + +(* iterates of a function must be done already, but I don't know where *) + +let iter_spec = prove(`?iter. !f u:A. (iter 0 f u = u) /\ (!n. (iter (SUC n) f u = f(iter n f u)))`, + (SUBGOAL_THEN `?g. !f (u:A). (g f u 0 = u) /\ (!n. (g f u (SUC n) = f (g f u n)))` CHOOSE_TAC) THENL + ([REWRITE_TAC[GSYM SKOLEM_THM;num_RECURSION_STD];REWRITE_TAC[]]) THEN + (EXISTS_TAC `\ (i:num) (f:A->A) (u:A). (g f u i):A`) THEN + (BETA_TAC) THEN + (ASM_REWRITE_TAC[]));; + +let iter = new_specification ["iter"] iter_spec;; + +(* +let polar_power_spec = prove(`?fn. !V v. (fn V v 0 = v ) /\ (!n. (fn V v (SUC n) = polar_cycle V (fn V v n)))`, + (REWRITE_TAC[GSYM SKOLEM_THM;num_RECURSION_STD]));; + +let polar_power = new_specification ["polar_power"] polar_power_spec;; +*) + +let orthonormal = new_definition `orthonormal e1 e2 e3 = + (( e1 dot e1 = &1) /\ (e2 dot e2 = &1) /\ ( e3 dot e3 = &1) /\ + ( e1 dot e2 = &0) /\ ( e1 dot e3 = &0) /\ ( e2 dot e3 = &0) /\ + (&0 < (cross e1 e2) dot e3))`;; + +(* spherical coordinates *) +let azim_hyp_def = new_definition `azim_hyp = (!v w w1 w2. ?theta. !e1 e2 e3. ?psi h1 h2 r1 r2. + ~(collinear {v, w, w1}) /\ ~(collinear {v, w, w2}) /\ + (orthonormal e1 e2 e3) /\ ((dist( w, v)) % e3 = (w - v)) ==> + ((&0 <= theta) /\ (theta < &2 * pi) /\ (&0 < r1) /\ (&0 < r2) /\ + (w1 - v = (r1 * cos(psi)) % e1 + (r1 * sin(psi)) % e2 + h1 % (w-v)) /\ + (w2 - v = (r2 * cos(psi + theta)) % e1 + (r2 * sin(psi + theta)) % e2 + h2 % (w-v))))`;; + +let azim_spec = prove(`?theta. !v w w1 w2 e1 e2 e3. ?psi h1 h2 r1 r2. + (azim_hyp) ==> + ~(collinear {v, w, w1}) /\ ~(collinear {v, w, w2}) /\ + (orthonormal e1 e2 e3) /\ ((dist( w, v)) % e3 = (w - v)) ==> + ((&0 <= theta v w w1 w2) /\ (theta v w w1 w2 < &2 * pi) /\ (&0 < r1) /\ (&0 < r2) /\ + (w1 - v = (r1 * cos(psi)) % e1 + (r1 * sin(psi)) % e2 + h1 % (w-v)) /\ + (w2 - v = (r2 * cos(psi + theta v w w1 w2)) % e1 + (r2 * sin(psi + theta v w w1 w2)) % e2 + h2 % (w-v)))`, + (REWRITE_TAC[GSYM SKOLEM_THM;GSYM RIGHT_IMP_EXISTS_THM;GSYM RIGHT_IMP_FORALL_THM]) THEN + (REWRITE_TAC[azim_hyp_def]) THEN + (REPEAT STRIP_TAC) THEN + (ASM_REWRITE_TAC[RIGHT_IMP_EXISTS_THM]));; + +let azim_def = new_specification ["azim"] azim_spec;; + + +let cyclic_set = new_definition `cyclic_set W v w = + (~(v=w) /\ (FINITE W) /\ (!p q h. W p /\ W q /\ (p = q + h % (v - w)) ==> (p=q)) /\ + (W INTER (affine hull {v,w}) = EMPTY))`;; + + + + +let azim_cycle_hyp_def = new_definition `azim_cycle_hyp = + (?sigma. !W proj v w e1 e2 e3 p. + (W p) /\ + (cyclic_set W v w) /\ ((dist( v ,w)) % e3 = (w-v)) /\ + (orthonormal e1 e2 e3) /\ + (!u x y. (proj u = (x,y)) <=> (?h. (u = v + x % e1 + y % e2 + h % e3))) ==> + (proj (sigma W v w p) = polar_cycle (IMAGE proj W) (proj p)))`;; + +let azim_cycle_spec = prove(`?sigma. !W proj v w e1 e2 e3 p. + (azim_cycle_hyp) ==> ( (W p) /\ + (cyclic_set W v w) /\ ((dist( v ,w)) % e3 = (w-v)) /\ + (orthonormal e1 e2 e3) /\ + (!u x y. (proj u = (x,y)) <=> (?h. (u = v + x % e1 + y % e2 + h % e3)))) ==> (proj (sigma W v w p) = polar_cycle (IMAGE proj W) (proj p))`, + (REWRITE_TAC[GSYM RIGHT_IMP_EXISTS_THM;GSYM RIGHT_IMP_FORALL_THM]) THEN + (REWRITE_TAC[azim_cycle_hyp_def]) + );; + +let azim_cycle_def = new_specification ["azim_cycle"] azim_cycle_spec;; + + +(* ------------------------------------------------------------------ *) +(* Definitions from the Collection in Elementary Geometry *) +(* ------------------------------------------------------------------ *) + +(* EDSFZOT *) + +let cayleyR = new_definition `cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 = + -- (x14*x14*x23*x23) + &2 *x14*x15*x23*x23 - x15*x15*x23*x23 + &2 *x13*x14*x23*x24 - &2 *x13*x15*x23*x24 - &2 *x14*x15*x23*x24 + + &2 *x15*x15*x23*x24 - x13*x13*x24*x24 + &2 *x13*x15*x24*x24 - x15*x15*x24*x24 - &2 *x13*x14*x23*x25 + + &2 *x14*x14*x23*x25 + &2 *x13*x15*x23*x25 - &2 *x14*x15*x23*x25 + &2 *x13*x13*x24*x25 - &2 *x13*x14*x24*x25 - &2 *x13*x15*x24*x25 + + &2 *x14*x15*x24*x25 - x13*x13*x25*x25 + &2 *x13*x14*x25*x25 - x14*x14*x25*x25 + &2 *x12*x14*x23*x34 - &2 *x12*x15*x23*x34 - + &2 *x14*x15*x23*x34 + &2 *x15*x15*x23*x34 + &2 *x12*x13*x24*x34 - &2 *x12*x15*x24*x34 - &2 *x13*x15*x24*x34 + &2 *x15*x15*x24*x34 + + &4 *x15*x23*x24*x34 - &2 *x12*x13*x25*x34 - &2 *x12*x14*x25*x34 + &4 *x13*x14*x25*x34 + &4 *x12*x15*x25*x34 - &2 *x13*x15*x25*x34 - &2 *x14*x15*x25*x34 - + &2 *x14*x23*x25*x34 - &2 *x15*x23*x25*x34 - &2 *x13*x24*x25*x34 - &2 *x15*x24*x25*x34 + &2 *x13*x25*x25*x34 + &2 *x14*x25*x25*x34 - + x12*x12*x34*x34 + &2 *x12*x15*x34*x34 - x15*x15*x34*x34 + &2 *x12*x25*x34*x34 + &2 *x15*x25*x34*x34 - + x25*x25*x34*x34 - &2 *x12*x14*x23*x35 + &2 *x14*x14*x23*x35 + &2 *x12*x15*x23*x35 - &2 *x14*x15*x23*x35 - &2 *x12*x13*x24*x35 + + &4 *x12*x14*x24*x35 - &2 *x13*x14*x24*x35 - &2 *x12*x15*x24*x35 + &4 *x13*x15*x24*x35 - &2 *x14*x15*x24*x35 - &2 *x14*x23*x24*x35 - &2 *x15*x23*x24*x35 + + &2 *x13*x24*x24*x35 + &2 *x15*x24*x24*x35 + &2 *x12*x13*x25*x35 - &2 *x12*x14*x25*x35 - &2 *x13*x14*x25*x35 + &2 *x14*x14*x25*x35 + + &4 *x14*x23*x25*x35 - &2 *x13*x24*x25*x35 - &2 *x14*x24*x25*x35 + &2 *x12*x12*x34*x35 - &2 *x12*x14*x34*x35 - &2 *x12*x15*x34*x35 + + &2 *x14*x15*x34*x35 - &2 *x12*x24*x34*x35 - &2 *x15*x24*x34*x35 - &2 *x12*x25*x34*x35 - &2 *x14*x25*x34*x35 + &2 *x24*x25*x34*x35 - + x12*x12*x35*x35 + &2 *x12*x14*x35*x35 - x14*x14*x35*x35 + &2 *x12*x24*x35*x35 + &2 *x14*x24*x35*x35 - + x24*x24*x35*x35 + &4 *x12*x13*x23*x45 - &2 *x12*x14*x23*x45 - &2 *x13*x14*x23*x45 - &2 *x12*x15*x23*x45 - &2 *x13*x15*x23*x45 + + &4 *x14*x15*x23*x45 + &2 *x14*x23*x23*x45 + &2 *x15*x23*x23*x45 - &2 *x12*x13*x24*x45 + &2 *x13*x13*x24*x45 + &2 *x12*x15*x24*x45 - + &2 *x13*x15*x24*x45 - &2 *x13*x23*x24*x45 - &2 *x15*x23*x24*x45 - &2 *x12*x13*x25*x45 + &2 *x13*x13*x25*x45 + &2 *x12*x14*x25*x45 - + &2 *x13*x14*x25*x45 - &2 *x13*x23*x25*x45 - &2 *x14*x23*x25*x45 + &4 *x13*x24*x25*x45 + &2 *x12*x12*x34*x45 - &2 *x12*x13*x34*x45 - + &2 *x12*x15*x34*x45 + &2 *x13*x15*x34*x45 - &2 *x12*x23*x34*x45 - &2 *x15*x23*x34*x45 - &2 *x12*x25*x34*x45 - &2 *x13*x25*x34*x45 + &2 *x23*x25*x34*x45 + + &2 *x12*x12*x35*x45 - &2 *x12*x13*x35*x45 - &2 *x12*x14*x35*x45 + &2 *x13*x14*x35*x45 - &2 *x12*x23*x35*x45 - &2 *x14*x23*x35*x45 - + &2 *x12*x24*x35*x45 - &2 *x13*x24*x35*x45 + &2 *x23*x24*x35*x45 + &4 *x12*x34*x35*x45 - x12*x12*x45*x45 + &2 *x12*x13*x45*x45 - + x13*x13*x45*x45 + &2 *x12*x23*x45*x45 + &2 *x13*x23*x45*x45 - x23*x23*x45*x45`;; + + +(* PUSACOU *) + +let packing = new_definition `packing S = (!u v. S u /\ S v /\ ~(u = v) ==> (&2 <= dist( u, v)))`;; + +(* SIDEXYO *) + +let wedge = new_definition (`wedge v1 v2 w1 w2 = + let z = v2 - v1 in + let u1 = w1 - v1 in + let u2 = w2 - v1 in + let n = cross z u1 in + let d = n dot u2 in + if (aff_ge {v1,v2} {w1} w2) then {} else + if (aff_lt {v1,v2} {w1} w2) then aff_gt {v1,v2,w1} {n} else + if (d > &0) then aff_gt {v1,v2} {w1,w2} else + (:real^3) DIFF aff_ge {v1,v2} {w1,w2}`);; + +(* ------------------------------------------------------------------ *) +(* Measure and Volume, following Nguyen Tat Thang *) +(* ------------------------------------------------------------------ *) + +let sphere= new_definition`sphere x=(?(v:real^3)(r:real). (r> &0)/\ (x={w:real^3 | norm (w-v)= r}))`;; + +let c_cone = new_definition `c_cone (v,w:real^3, r:real)={x:real^3 | ((x-v) dot w = norm (x-v)* norm w* r)}`;; + +let circular_cone =new_definition `circular_cone (V:real^3-> bool)= +(? (v,w:real^3)(r:real). V= c_cone (v,w,r))`;; + +let NULLSET_RULES,NULLSET_INDUCT,NULLSET_CASES = + new_inductive_definition + `(!P. ((plane P)\/ (sphere P) \/ (circular_cone P)) ==> NULLSET P) /\ + !(s:real^3->bool) t. (NULLSET s /\ NULLSET t) ==> NULLSET (s UNION t)`;; + +let null_equiv = new_definition `null_equiv (s,t :real^3->bool)=(? (B:real^3-> bool). NULLSET B /\ +((s DIFF t) UNION (t DIFF s)) SUBSET B)`;; + + +let normball = new_definition `normball x r = { y:real^A | dist(y,x) < r}`;; + +let radial = new_definition `radial r x C <=> (C SUBSET normball x r) /\ (!u. (x+u) IN C ==> (!t.(t> &0) /\ (t* norm u < r)==>(x+ t % u) IN C))`;; + +let eventually_radial = new_definition `eventually_radial x C <=> (?r. (r> &0) /\ radial r x (C INTER normball x r))`;; + +let solid_triangle = new_definition `solid_triangle v0 S r = normball v0 r INTER cone v0 S`;; + +let rconesgn = new_definition `rconesgn sgn v w h = {x:real^A | sgn ((x-v) dot (w-v)) (dist(x,v)*dist(w,v)*h)}`;; + +(* drop primes *) + +let rcone_ge = new_definition `rcone_ge = rconesgn ( >= )`;; +let rcone_gt = new_definition `rcone_gt = rconesgn ( > )`;; +let rcone_lt = new_definition `rcone_lt = rconesgn ( < )`;; +let rcone_eq = new_definition `rcone_eq = rconesgn ( = )`;; + +let scale = new_definition `scale (t:real^3) (u:real^3) = vector[t$1 * u$1; t$2 * u$2; t$3 * u$3]`;; + +let ellipsoid = new_definition `ellipsoid t r = IMAGE (scale t) (normball(vec 0)r)`;; + +let conic_cap = new_definition `conic_cap v0 v1 r a = normball v0 r INTER rcone_gt v0 v1 a`;; + +let frustum = new_definition `frustum v0 v1 h1 h2 a = { y | rcone_gt v0 v1 a y /\ + let d = (y - v0) dot (v1 - v0) in + let n = norm(v1 - v0) in + (h1*n < d /\ d < h2*n)}`;; + +let frustt = new_definition `frustt v0 v1 h a = frustum v0 v1 (&0) h a`;; + +let rect = new_definition `rect (a:real^3) (b:real^3) = {(v:real^3) | !i. ( a$i < v$i /\ v$i < b$i )}`;; + +(* +let is_tetrahedron = new_definition `is_tetrahedron S = ?v0 v1 v2 v3. (S = conv0 {v0,v1,v2,v3})`;; +*) + +let primitive = new_definition `primitive (C:real^3->bool) = + ((?v0 v1 v2 v3 r. (C = solid_triangle v0 {v1,v2,v3} r)) \/ + (?v0 v1 v2 v3. (C = conv0 {v0,v1,v2,v3})) \/ + (?v0 v1 v2 v3 h a. (C = frustt v0 v1 h a INTER wedge v0 v1 v2 v3)) \/ + (?v0 v1 v2 v3 r c. (C = conic_cap v0 v1 r c INTER wedge v0 v1 v2 v3)) \/ + (?a b. (C = rect a b)) \/ + (?t r. (C = ellipsoid t r)) \/ + (?v0 v1 v2 v3 r. (C = normball v0 r INTER wedge v0 v1 v2 v3)))`;; + +let MEASURABLE_RULES,MEASURABLE_INDUCT,MEASURABLE_CASES = + new_inductive_definition + `(!C. primitive C ==> measurable C) /\ + ( !Z. NULLSET Z ==> measurable Z) /\ + (!X t. measurable X ==> (measurable (IMAGE (scale t) X))) /\ + (!X v. measurable X ==> (measurable (IMAGE ((+) v) X))) /\ + ( !(s:real^3->bool) t. (measurable s /\ measurable t) ==> measurable (s UNION t)) /\ + ( !(s:real^3->bool) t. (measurable s /\ measurable t) ==> measurable (s INTER t)) /\ + ( !(s:real^3->bool) t. (measurable s /\ measurable t) ==> measurable (s DIFF t)) + `;; + + +let SDIFF = new_definition `SDIFF X Y = (X DIFF Y) UNION (Y DIFF X)`;; + + +let vol_solid_triangle = new_definition `vol_solid_triangle v0 v1 v2 v3 r = + let a123 = dihV v0 v1 v2 v3 in + let a231 = dihV v0 v2 v3 v1 in + let a312 = dihV v0 v3 v1 v2 in + (a123 + a231 + a312 - pi)*(r pow 3)/(&3)`;; + +let vol_frustt_wedge = new_definition `vol_frustt_wedge v0 v1 v2 v3 h a = + (azim v0 v1 v2 v3)*(h pow 3)*(&1/(a*a) - &1)/(&6)`;; + +(* volume of intersection of conic cap and wedge *) +let vol_conic_cap_wedge = new_definition `vol_conic_cap_wedge v0 v1 v2 v3 r c = + (azim v0 v1 v2 v3)*(&1 - c)*(r pow 3)/(&3)`;; + + +let vol_conv = new_definition `vol_conv v1 v2 v3 v4 = + let x12 = dist(v1,v2) pow 2 in + let x13 = dist(v1,v3) pow 2 in + let x14 = dist(v1,v4) pow 2 in + let x23 = dist(v2,v3) pow 2 in + let x24 = dist(v2,v4) pow 2 in + let x34 = dist(v3,v4) pow 2 in + sqrt(delta_x x12 x13 x14 x34 x24 x34)/(&12)`;; + +let vol_rect = new_definition `vol_rect a b = + if (a$1 < b$1) /\ (a$2 < b$2) /\ (a$3 < b$3) then (b$3-a$3)*(b$2-a$2)*(b$1-a$1) else &0`;; + +let vol_ball_wedge = new_definition `vol_ball_wedge v0 v1 v2 v3 r = + (azim v0 v1 v2 v3)*(&2)*(r pow 3)/(&3)`;; + + +let volume_props = new_definition `volume_props (vol:(real^3->bool)->real) = + ( (!C. vol C >= &0) /\ + (!Z. NULLSET Z ==> (vol Z = &0)) /\ + (!X Y. measurable X /\ measurable Y /\ NULLSET (SDIFF X Y) ==> (vol X = vol Y)) /\ + (!X t. (measurable X) /\ (measurable (IMAGE (scale t) X)) ==> (vol (IMAGE (scale t) X) = abs(t$1 * t$2 * t$3)*vol(X))) /\ + (!X v. measurable X ==> (vol (IMAGE ((+) v) X) = vol X)) /\ + (!v0 v1 v2 v3 r. (r > &0) /\ (~(collinear {v0,v1,v2})) /\ ~(collinear {v0,v1,v3}) ==> vol (solid_triangle v0 {v1,v2,v3} r) = vol_solid_triangle v0 v1 v2 v3 r) /\ + (!v0 v1 v2 v3. vol(conv0 {v0,v1,v2,v3}) = vol_conv v0 v1 v2 v3) /\ + (!v0 v1 v2 v3 h a. ~(collinear {v0,v1,v2}) /\ ~(collinear {v0,v1,v3}) /\ (h >= &0) /\ (a > &0) /\ (a <= &1) ==> vol(frustt v0 v1 h a INTER wedge v0 v1 v2 v3) = vol_frustt_wedge v0 v1 v2 v3 h a) /\ + (!v0 v1 v2 v3 r c. ~(collinear {v0,v1,v2}) /\ ~(collinear {v0,v1,v3}) /\ (r >= &0) /\ (c >= -- (&1)) /\ (c <= &1) ==> (vol(conic_cap v0 v1 r c INTER wedge v0 v1 v2 v3) = vol_conic_cap_wedge v0 v1 v2 v3 r c)) /\ + (!(a:real^3) (b:real^3). vol(rect a b) = vol_rect a b) /\ + (!v0 v1 v2 v3 r. ~(collinear {v0,v1,v2}) /\ ~(collinear {v0,v1,v3}) /\ (r >= &0) ==> (vol(normball v0 r INTER wedge v0 v1 v2 v3) = vol_ball_wedge v0 v1 v2 v3 r)))`;; + +let vol_def = new_definition `vol = ( @ ) volume_props`;; + +let solid = new_definition `solid x C = (@s. ?c. (c > &0) /\ (!r. (r > &0) /\ (r < c) ==> + (s = &3 * vol(C INTER normball x r)/(r pow 3)))) `;; + +let sovo = new_definition `sovo x C (v,s) = v* vol(C) + s* solid x C`;; + +let phivo = new_definition `phivo h t (v,s) = v*t*h*(t+h)/(&6) + s`;; + +let avo = new_definition `avo h t l= (&1 - h/t)*(phivo h t l - phivo t t l)`;; + +let ortho0 = new_definition `ortho0 x v1 v2 v3 = conv0 {x,x+v1,x+v1+v2,x+v1+v2+v3}`;; + +let make_point = new_definition `make_point v1 v2 v3 w r1 r2 r3 = @v. (aff_ge {v1,v2,v3} {w} (v:real^3)) /\ (r1 = dist(v1,v)) /\ (r2 = dist(v2,v)) /\ (r3 = dist(v3,v))`;; + +let rogers = new_definition `rogers v0 v1 v2 v3 c = + let w = (&1/ (&2)) % (v0 + v1) in + let p = circumcenter {v0,v1,v2} in + let q = make_point v0 v1 v2 v3 c c c in + conv {v0,w,p,q}`;; + +let rogers0 = new_definition `rogers0 v0 v1 v2 v3 c = + let w = (&1/ (&2)) % (v0 + v1) in + let p = circumcenter {v0,v1,v2} in + let q = make_point v0 v1 v2 v3 c c c in + conv0 {v0,w,p,q}`;; + +let abc_param = new_definition `abc_param v0 v1 v2 c = + let a = (&1/(&2)) * dist(v0,v1) in + let b = radV {v0,v1,v2} in + (a,b,c)`;; + +(* ------------------------------------------------------------------ *) +(* Format of inequalities in the archive. *) +(* ------------------------------------------------------------------ *) + +let ineq = kepler_def `ineq (bounds:(real#real#real) list) (A:bool) = + ((!(a,x,b). ((MEM (a,x,b) bounds) ==> ((a <= x) /\ (x <= b)))) /\ A)`;; + +let all_forall bod = + let mk_forall = mk_binder "!" in + itlist (curry mk_forall) (frees bod) bod;; diff --git a/legacy/inequalities/definitions_keplerC.ml b/legacy/inequalities/definitions_keplerC.ml new file mode 100644 index 0000000..2dd796b --- /dev/null +++ b/legacy/inequalities/definitions_keplerC.ml @@ -0,0 +1,673 @@ +(* Start from the beginning of the text of Unabridged Proof + of the Kepler Conjecture. Version Nov 26, 2003 *) + + (* #use "load_def_kepler.ml";; *) + +(*let mk_vec3 = kepler_def `mk_vec3 y1 y2 y3 = + (\i. if (i=0) then y1 else if (i=1) then y2 else if (i=2) then y3 + else (&.0))`;; +*) + +(* +let mk_lattice = kepler_def `mk_lattice v1 v2 v3 = + { z | ?m1 m2 m3. (z = (dest_int m1) *# v1 + (dest_int m2) *# v2 + + (dest_int m3) *# v3 ) }`;; + +let fcc_packing = kepler_def `fcc_packing = + let v1 = mk_vec3 (&.2) (&.0) (&.0) in + let v2 = mk_vec3 (&.1) (sqrt (&.3)) (&.0) in + let v3 = mk_vec3 (&.1) ((sqrt (&.3))/(&.3)) ((&.2)*sqrt(&.6)/(&.3)) in + mk_lattice v1 v2 v3`;; + + +let hcp_packing = kepler_def `hcp_packing = + let v1 = mk_vec3 (&.2) (&.0) (&.0) in + let v2 = mk_vec3 (&.1) (sqrt (&.3)) (&.0) in + let v3 = mk_vec3 (&.1) ((sqrt (&.3))/(&.3)) ((&.2)*sqrt(&.6)/(&.3)) in + let v4 = mk_vec3 (&.0) (&.0) ((&.4)*sqrt(&.6)/(&.3)) in + let L = mk_lattice v1 v2 v4 in + L UNION (set_translate v3 L)`;; +*) + +(* B(x,r). Changed from closed in text. *) + +(* ------------------------------------------------------------------ *) +(* The following definitions also appear in Jordan/misc_defs_and_lemmas.ml *) +(* ------------------------------------------------------------------ *) + +(* mk_local_interface "kepler";; *) + +(* we are switching from real3 (based on num->real) *) +(* to real^3. *) +(* The file definitions_keplerC.ml still depends on euclid. + These definitions should be left in until the transition + is complete. -tch 7/9/2008 *) + +overload_interface + ("+", `euclid_plus:(num->real)->(num->real)->(num->real)`);; + +make_overloadable "*#" `:A -> B -> B`;; + +let euclid_scale = kepler_def + `euclid_scale t f = \ (i:num). (t* (f i))`;; + +overload_interface ("*#",`euclid_scale`);; (* `kepler'euclid_scale`);; *) + +parse_as_infix("*#",(20,"right"));; + +let euclid_neg = kepler_def `euclid_neg (f:num->real) = \ (i:num). (-- (f i))`;; + +(* This is highly ambiguous: -- f x can be read as + (-- f) x or as -- (f x). *) +overload_interface ("--",`euclid_neg`);; (* `kepler'euclid_neg`);; *) + +overload_interface + ("-", `euclid_minus:(num->real)->(num->real)->(num->real)`);; + +let euclid_plus = kepler_def + `euclid_plus (f:num->real) g = \ (i:num). (f i) + (g i)`;; + +let euclid_minus = kepler_def + `euclid_minus (f:num->real) g = \(i:num). (f i) - (g i)`;; + +let euclid = kepler_def `euclid n v <=> !m. (n <= m) ==> (v (m:num) = &0)`;; + + +let euclid0 = kepler_def `euclid0 = \(i:num). &0`;; + +let coord = kepler_def `coord i (f:num->real) = f i`;; + +let dot = kepler_def `dot f g = + let (n = (min_num (\m. (euclid m f) /\ (euclid m g)))) in + sum (0,n) (\i. (f i)*(g i))`;; + +let norm = kepler_def `norm f = sqrt(dot f f)`;; + + +let d_euclid = kepler_def `d_euclid f g = norm (f - g)`;; + + + +let real3_exists = prove( `?f. (!n. (n> 2) ==> (f n = &0))`, + EXISTS_TAC `(\j:num. &0)` THEN + BETA_TAC THEN (REWRITE_TAC[]) + );; + +let real3 = new_type_definition "real3" ("mk_real3","dest_real3") real3_exists;; + +overload_interface + ("+", `real3_plus:real3->real3 ->real3`);; + +let real3_scale = new_definition + `real3_scale t v = mk_real3 (t *# dest_real3 v)`;; + +overload_interface ("*#",`real3_scale`);; + +let real3_neg = new_definition `real3_neg v = mk_real3 (-- dest_real3 v)`;; + +(* This is highly ambiguous: -- f x can be read as + (-- f) x or as -- (f x). *) +overload_interface ("--",`real3_neg`);; + +overload_interface + ("-", `real3_minus:real3->real3->real3`);; + +let real3_plus =new_definition + `real3_plus v w = mk_real3 (euclid_plus (dest_real3 v) (dest_real3 w))`;; + +let real3_minus = new_definition + `real3_minus v w = mk_real3 (euclid_minus (dest_real3 v) (dest_real3 w))`;; + + +(* No need for this one. v$i does the same thing. *) + +let coord3 = new_definition `coord3 i v = coord i (dest_real3 v)`;; + +let open_ball = new_definition + `open_ball(X,d) (x:A) r = { y | (X x) /\ (X y) /\ (d x y <. r) }`;; + +let ball3 = kepler_def `ball3 x r = + open_ball (euclid 3,d_euclid) x r`;; + +(* B(x,r,Lambda) *) +let ball3_lambda = kepler_def + `ball3_lambda x r Lambda = + ( ball3 x r) INTER (UNIONS(IMAGE (\v. ball3 v (&.1)) Lambda))`;; + +(* delta(x,r,Lambda) - THIS DEFINITION IS NOT WORKING (VU KHAC KY)*) + + + +(*let delta_finite = kepler_def + `delta_finite x r Lambda = + (vol 3 (ball3_lambda x r Lambda))/(vol 3 (ball3 x r))`;; +*) + + + + +(* Lambda(x,r) *) +let truncated_packing = kepler_def + `truncated_packing x r Lambda = + Lambda INTER (ball3_lambda x r Lambda)`;; + +(* Omega(v,Lambda) *) +let closed_voronoi_cell = kepler_def + `closed_voronoi_cell v Lambda = + {x | euclid 3 x /\ + (!w. (Lambda w) ==> (d_euclid x v <= d_euclid x w)) }`;; + +let open_voronoi_cell = kepler_def + `open_voronoi_cell v Lambda = + {x | euclid 3 x /\ + (!w. (Lambda w) /\ ~(w = v) ==> (d_euclid x v <. d_euclid x w)) }`;; +let fcc_voronoi_volume = + `!v. (fcc_packing v) ==> + (vol 3 (open_voronoi_cell v fcc_packing) = (sqrt(&.32)))`;; + +let hcp_voronoi_volume = + `!v. (hcp_packing v) ==> + (vol 3 (open_voronoi_cell v hcp_packing) = sqrt(&.32))`;; + +let negligible = kepler_def + `negligible Lambda A = ?C. (!r x. (euclid 3 x) /\ (&.1 <=. r) ==> + ITSET (\v acc. A(v) +. acc) (truncated_packing x r Lambda) (&.0) + <=. (C * r * r))`;; + + +(* fcc_compatible : THIS DEFINITION IS NOT WORKING (VUKHACKY) *) + +(* +let fcc_compatible = kepler_def + ` fcc_compatible Lambda (A:Lambda->real) = ( !v. (Lambda v) ==> + (sqrt(&.32) <=. (( vol 3 (open_voronoi_cell v Lambda)) + (A v))))`;; +*) + +let compatible_density = + `!Lambda. + (saturated_packing Lambda) /\ + (Lambda SUBSET (euclid 3)) /\ + (?A. (fcc_compatible Lambda A) /\ (negligible Lambda A)) ==> + (?C. (! x r. (euclid 3 x) /\ (&.1 <=. r) ==> + (delta_finite x r Lambda <=. pi/(sqrt (&.18)) + C/r)))`;; + +let kepler_conjecture = + `!Lambda. ?C. !x r. + (Lambda SUBSET (euclid 3)) /\ + (saturated_packing Lambda) /\ + (euclid 3 x) /\ (&.1 <=. r) ==> + ( (delta_finite x r Lambda <=. pi/(sqrt (&. 18)) + C/r))`;; + +(* skipped some top-down material that doesn't make sense at this point *) + +(* + + +let tetrahedron_vol = kepler_def + `tetrahedron_vol = + let v0 = mk_vec3 (&.0) (&.0) (&.0) in + let v1 = mk_vec3 (&.2) (&.0) (&.0) in + let v2 = mk_vec3 (&.1) (sqrt (&.3)) (&.0) in + let v3 = mk_vec3 (&.1) ((sqrt (&.3))/(&.3)) ((&.2)*sqrt(&.6)/(&.3)) in + vol 3 (convex_hull {v0,v1,v2,v3})`;; + + +let tetrahedron_ball_vol = kepler_def + `tetrahedron_ball_vol = + let v0 = mk_vec3 (&.0) (&.0) (&.0) in + let v1 = mk_vec3 (&.2) (&.0) (&.0) in + let v2 = mk_vec3 (&.1) (sqrt (&.3)) (&.0) in + let v3 = mk_vec3 (&.1) ((sqrt (&.3))/(&.3)) ((&.2)*sqrt(&.6)/(&.3)) in + vol 3 (convex_hull {v0,v1,v2,v3} INTER + (UNIONS (IMAGE (\v. ball3 v (&.1)) {v0,v1,v2,v3})))`;; + +let dtet_lemma = + `dtet = (tetrahedron_ball_vol/tetrahedron_vol)`;; + +let octahedron_vol = kepler_def + `octahedron_vol = + let v0 = mk_vec3 (&.0) (&.0) (-- (sqrt(&.2))) in + let v1 = mk_vec3 (&.1) (&.1) (&.0) in + let v2 = mk_vec3 (&.1) (--(&.1)) (&.0) in + let v3 = mk_vec3 (-- (&.1)) (&.1) (&.0) in + let v4 = mk_vec3 (-- (&.1)) (-- (&.1)) (&.0) in + let v5 = mk_vec3 (&.0) (&.0) ( (sqrt(&.2))) in + let S = {v0,v1,v2,v3,v4,v5} in + vol 3 (convex_hull S)`;; + +let octahedron_ball_vol = kepler_def + `octahedron_ball_vol = + let v0 = mk_vec3 (&.0) (&.0) (-- (sqrt(&.2))) in + let v1 = mk_vec3 (&.1) (&.1) (&.0) in + let v2 = mk_vec3 (&.1) (--(&.1)) (&.0) in + let v3 = mk_vec3 (-- (&.1)) (&.1) (&.0) in + let v4 = mk_vec3 (-- (&.1)) (-- (&.1)) (&.0) in + let v5 = mk_vec3 (&.0) (&.0) ( (sqrt(&.2))) in + let S = {v0,v1,v2,v3,v4,v5} in + vol 3 (convex_hull S INTER + (UNIONS (IMAGE (\v. ball3 v (&.1)) S)))`;; + +let doct_lemma = + `doct = (octahedron_ball_vol/octahedron_vol)`;; + +let dtet_doct = + `pi/(sqrt(&.18)) = dtet/(&.3) + (&.2)*doct/(&.3)`;; + +let pt_dtet = + `pt = (sqrt(&.2))*dtet - pi/(&.3)`;; + +let pt_doct = + `pt = (-- (&.2))*(sqrt(&.2)*doct - pi/(&.3))`;; +*) + + + + + + + + +(* Construction of the Q-system *) + +(* VU KHAC KY *) +let packing = kepler_def +`packing Lambda = (!v w. (((Lambda v)/\(Lambda w)/\(norm(v-w) < &2))==>(v=w)))`;; + +let two_t0 = kepler_def `two_t0 = #2.51 `;; +(*THE NAME OF QUASI_REGULAR_TRIANGLE HAS BEEN CHANGED INTO QUASI_REGULAR_TRIG (VU KHAC KY)*) +let quasi_regular_trig = kepler_def + `quasi_regular_trig Lambda S = ((S HAS_SIZE 3) /\ + (S SUBSET Lambda) /\ + (!v w. (((S v ) /\ (S w)) ==> (d_euclid w v <= two_t0))))`;; +(*THE NAME OF SIMPLEX HAS BEEN CHANGED INTO SIMPLX ( VU KHAC KY)*) +let simplx = kepler_def `simplx Lambda S = ((S SUBSET Lambda) /\(S HAS_SIZE 4))`;; + +let quasi_regular_tet = kepler_def + `quasi_regular_tet Lambda S = ((simplx Lambda S) /\ + (!v w. ((S v) /\ (S w)) ==> (d_euclid w v <= two_t0)))`;; + +let two_to_2t0 = kepler_def `two_to_2t0 x = + (((&2)<= x) /\ (x <= two_t0))`;; + +let twot0_to_sqrt8 = kepler_def `twot0_to_sqrt8 x = + ((two_t0 <= x) /\ (x <= sqrt8))`;; + +let two_to_sqrt8 = kepler_def `two_to_sqrt8 x = + (((&2)<= x) /\ (x <= sqrt8))`;; + +let strict_twot0_to_sqrt8 = kepler_def `strict_twot0_to_sqrt8 x = + ((two_t0 < x) /\ (x < sqrt8))`;; + +let pre_quarter = kepler_def +`pre_quarter Lambda S = ((simplx Lambda S) /\ (!v w. (((Lambda v)/\(Lambda w))==>(two_to_sqrt8 (d_euclid v w )))))`;; + +let quarter = kepler_def + `quarter Lambda S = ((pre_quarter Lambda S) /\ + (?v w. (S v) /\ (S w) /\ (twot0_to_sqrt8 (d_euclid v w))/\ + (!x y. (((S x) /\ (S y) /\ (two_t0 <= (d_euclid x y) )) ==>({x,y}={v,w}) ))))`;; + +let strict_quarter = kepler_def + `strict_quarter Lambda S = ( (quarter Lambda S) /\ + (?v w. (S v) /\ (S w) /\ (strict_twot0_to_sqrt8 (d_euclid w v))))`;; + +let diagonal = kepler_def + `diagonal S d = ((d SUBSET S) /\ + (?d1 d2. (d = {d1,d2}) /\ + (!u v. (S u) /\ (S v) ==>(d_euclid u v <=. d_euclid d1 d2))))`;; + + + +(* VU KHAC KY *) +let six_point = new_definition + `six_point x1 x2 x3 x4 x5 x6 = + (!x y. (((x IN {x1, x2 ,x3, x4, x5, x6})/\(y IN {x1, x2 ,x3, x4, x5, x6}))==>(norm(x-y) >(&0))))`;; + +let pre_quarter_oct = new_definition + `pre_quarter_oct Lambda v w x1 x2 x3 x4 = + let S1= {v,w,x1,x2} in + let S2= {v,w,x2,x3} in + let S3= {v,w,x3,x4} in + let S4= {v,w,x4,x1} in + (strict_quarter Lambda S1)/\ + (strict_quarter Lambda S2)/\ + (strict_quarter Lambda S3)/\ + (strict_quarter Lambda S4)/\ + (diagonal S1 {v,w})/\ + (diagonal S2 {v,w})/\ + (diagonal S3 {v,w})/\ + (diagonal S4 {v,w})/\ + ((convex hull (S1) INTER convex hull (S2))= {})/\ + ((convex hull (S1) INTER convex hull (S3))= {})/\ + ((convex hull (S1) INTER convex hull (S4))= {})/\ + ((convex hull (S2) INTER convex hull (S3))= {})/\ + ((convex hull (S2) INTER convex hull (S4))= {})/\ + ((convex hull (S3) INTER convex hull (S4))= {})`;; + +let quartered_oct = kepler_def +`quartered_oct Lambda v w x1 x2 x3 x4 = +((six_point v w x1 x2 x3 x4 )/\(pre_quarter_oct Lambda v w x1 x2 x3 x4))`;; + +let adjacent_pair = kepler_def + `adjacent_pair Lambda v v1 v3 v2 v4 = + let Q = {v, v1, v3, v2} in + let Q1 = {v, v1,v3,v4} in + (strict_quarter Lambda Q)/\ + (strict_quarter Lambda Q1)/\ + (diagonal Q {v1,v3})/\ + (diagonal Q1 {v1,v3})/\ + (conv0 Q INTER conv Q1 = EMPTY )`;; + +let conflict_diagonal = new_definition +`conflict_diagonal Lambda v v1 v3 v2 v4 = ((adjacent_pair Lambda v v1 v3 v2 v4)/\(adjacent_pair Lambda v v2 v4 v1 v3))`;; + +let inter_position = kepler_def +` inter_position Lambda v v1 v3 v2 v4 = + ((conflict_diagonal Lambda v v1 v3 v2 v4) /\ +(conv {v1,v3} INTER conv0 {v,v2,v4}= EMPTY))`;; + +let isolated_pair = new_definition +`isolated_pair Lambda Q = +((quarter Lambda Q)/\ +(~(?v v1 v2 v3 v4. (Q v1)/\(Q v2)/\(Q v3)/\(Q v4)==>(adjacent_pair Lambda v v1 v3 v2 v4))))`;; + + +let anchor = new_definition +`anchor Lambda v v1 v2 = ( (Lambda v)/\ + (twot0_to_sqrt8 (d_euclid v1 v2))/\ + (~(v = v1))/\ + (~(v = v2))/\ + ( d_euclid v v1 <= two_t0)/\ + ( d_euclid v v2 <= two_t0))`;; + +(* Definition of Q- System ..to be continue.. *) +(* +let Q-system = new_definition +`Q-system (Lambda:packing) Q = + (!S. (Q S)==> + (quasi_regular_tet Lambda S)\/ + (strict_quarter Lambda S) + +`;; +*) + + + + + + + + + + + + + + +let is_qrtet_y = kepler_def + `is_qrtet_y y1 y2 y3 y4 y5 y6 = + ((two_to_2t0 y1) /\ + (two_to_2t0 y2) /\ + (two_to_2t0 y3) /\ + (two_to_2t0 y4) /\ + (two_to_2t0 y5) /\ + (two_to_2t0 y6))`;; + +let s_to_8 = kepler_def `s_to_8 x = + ( (#6.3001 <= x) /\ (x <= (&.8)) )`;; + +let four_to_s = kepler_def `four_to_s x = + (((&.4)<= x) /\ (x <= #6.3001))`;; + +let is_qrtet_x = kepler_def(`is_qrtet_x x1 x2 x3 x4 x5 x6 = + ((four_to_s x1) /\ + (four_to_s x2) /\ + (four_to_s x3) /\ + (four_to_s x4) /\ + (four_to_s x5) /\ + (four_to_s x6))`);; + +let is_upright_quarter_y = kepler_def +(`is_upright_quarter_y y1 y2 y3 y4 y5 y6 = + ((twot0_to_sqrt8 y1) /\ + (two_to_2t0 y2) /\ + (two_to_2t0 y3) /\ + (two_to_2t0 y4) /\ + (two_to_2t0 y5) /\ + (two_to_2t0 y6))`);; + +let is_upright_quarter_v = kepler_def +(`is_upright_quarter_v v0 v1 v2 v3 = + is_upright_quarter_y + (d_euclid v0 v1) (d_euclid v0 v2) (d_euclid v0 v3) + (d_euclid v2 v3) (d_euclid v1 v3) (d_euclid v2 v3)`);; + +let dih_v = kepler_def(`dih_v v0 v1 v2 v3 = + dih_y (d_euclid v0 v1) (d_euclid v0 v2) (d_euclid v0 v3) + (d_euclid v2 v3) (d_euclid v1 v3) (d_euclid v1 v2)`);; + +(* an equivalent definition of dih, except it works better in the +degenerate case of delta = 0 in distinguishing between angle 0 and pi *) + +let dih_alt_x = kepler_def(`dih_alt_x x1 x2 x3 x4 x5 x6 = + acs ((delta_x4 x1 x2 x3 x4 x5 x6)/ + sqrt((ups_x x1 x2 x6)*(ups_x x1 x3 x5)))`);; + +let dih_alt_y = kepler_def(`dih_alt_y y1 y2 y3 y4 y5 y6 = + let (x1,x2,x3,x4,x5,x6)=(y1*y1,y2*y2,y3*y3,y4*y4,y5*y5,y6*y6) in + dih_alt_x x1 x2 x3 x4 x5 x6`);; + +let dih_alt_v = kepler_def(`dih_alt_v v0 v1 v2 v3 = + dih_alt_y (d_euclid v0 v1) (d_euclid v0 v2) (d_euclid v0 v3) + (d_euclid v2 v3) (d_euclid v1 v3) (d_euclid v1 v2)`);; + +(* oriented dihedral takes a value from 0 to < 2pi *) +let or_dih_v = kepler_def(`or_dih_v v0 v1 v2 v3 = + let w1 = v1 - v0 in + let w2 = v2 - v0 in + let w3 = v3 - v0 in + let triple = triple_product w1 w2 w3 in + if (triple > (&0)) then (dih_v v0 v1 v2 v3) + else if (triple < (&0)) then ((&2)*pi - (dih_v v0 v1 v2 v3)) + else (dih_alt_v v0 v1 v2 v3)`);; + +(* traverse the boundary v1 v2 v3 v4, with the region to the left + as you circle around *) + +let solid_area_quad_v = kepler_def(`solid_area_quad_v v0 v1 v2 v3 v4 = + (or_dih_v v0 v1 v2 v4) + + (or_dih_v v0 v2 v3 v1) + + (or_dih_v v0 v3 v4 v2) + + (or_dih_v v0 v4 v1 v3) - (&2)*pi`);; + +let is_quad_cluster_v = kepler_def(`is_quad_cluster_v v0 v1 v2 v3 v4 = + let y1 = d_euclid v0 v1 in + let y2 = d_euclid v0 v2 in + let y3 = d_euclid v0 v3 in + let y4 = d_euclid v0 v4 in + let e12 = d_euclid v1 v2 in + let e23 = d_euclid v2 v3 in + let e34 = d_euclid v3 v4 in + let e41 = d_euclid v4 v1 in + let d13 = d_euclid v1 v3 in + let d24 = d_euclid v2 v4 in + (two_to_2t0 y1) /\ + (two_to_2t0 y2) /\ + (two_to_2t0 y3) /\ + (two_to_2t0 y4) /\ + (two_to_2t0 e12) /\ + (two_to_2t0 e23) /\ + (two_to_2t0 e34) /\ + (two_to_2t0 e41) /\ + (two_t0 <= d13) /\ + (two_t0 <= d24) `);; + +let upright_oct_v = kepler_def(`upright_oct_v v0 w v1 v2 v3 v4 = + ((is_upright_quarter_v v0 w v1 v2) /\ + (is_upright_quarter_v v0 w v2 v3) /\ + (is_upright_quarter_v v0 w v3 v4) /\ + (is_upright_quarter_v v0 w v4 v1))`);; + +let is_pairflat13 = kepler_def(`is_pairflat13 v0 v1 v2 v3 v4 = + ((is_quad_cluster_v v0 v1 v2 v3 v4) /\ + ((d_euclid v1 v3) <= sqrt8))`);; + +let is_pairflat24 = kepler_def(`is_pairflat24 v0 v1 v2 v3 v4 = + (is_quad_cluster_v v0 v1 v2 v3 v4) /\ + ((d_euclid v2 v4) <= sqrt8)`);; + +(* we make w lie in the open cone at v0 spanned by (v[i]-v0) *) +let is_enclosed = kepler_def + `is_enclosed w v0 v1 v2 v3 = + (?a0 a1 a2 a3. ((w = a0 *# v0 + a1 *# v1 + a2 *# v2 + a3 *# v3) + /\ + ((&1) = a0 + a1 + a2 + a3) /\ + (a1 > (&0)) /\ + (a2 > (&0)) /\ + (a3 > (&0))))`;; + +(* there are some geometry theorems that should be proved here to make + sure that everything is as expected. The edge constraints on + a quad cluster constrain the polygon under v1 v2 v3 v4 on the + unit sphere to be a simple polygon (fact). + The edge constraints that the diagonals are at least sqrt8 + together with the constraint that the quad region has area + at most 2Pi, constrains the region to be convex (fact). Thus, we + can get by without proving the Jordan curve theorem for now. + An enclosed point will be one the lies over one of the two + simplices formed by drawing either diagonal. *) + + (* a quad cluster with no flat quarters, and diagonals at least + sqrt8 *) +let is_sqrt_quadable = kepler_def(`is_sqrt2_quadable v0 v1 v2 v3 v4 = + (is_quad_cluster_v v0 v1 v2 v3 v4) /\ + (~(is_pairflat13 v0 v1 v2 v3 v4)) /\ + (~(is_pairflat24 v0 v1 v2 v3 v4))`);; + + + (* define this the same way. The only difference will be in + the scoring approximation. These are the ones that have an + upright diagonal of ht <= sqrt8, and for which the formulation + bounds of vor0 and -1.04 pt apply *) +let is_mixed_quadable = kepler_def(`is_mixed_quadable v0 v1 v2 v3 v4 = + (is_quad_cluster_v v0 v1 v2 v3 v4) /\ + (~(is_pairflat13 v0 v1 v2 v3 v4))/\ + (~(is_pairflat24 v0 v1 v2 v3 v4))`);; + + (* define an approximation to sigma. It will be + actual score if two flat quarters + highest score (w) if four upright quarters in an oct + vor(.,sqrt2) if sqrt_quadable + max(-1.04pt,vor0) if mixed_quadable. *) + +let eta_v = kepler_def(` + eta_v v (i:num) j k = + let v1 = (v i) in + let v2 = (v j) in + let v3 = (v k) in + let y1 = d_euclid v2 v3 in + let y2 = d_euclid v3 v1 in + let y3 = d_euclid v1 v2 in + eta_y y1 y2 y3`);; + +let edge_of_v = kepler_def(`edge_of_v v0 v1 v2 v3 = + (d_euclid v0 v1,d_euclid v0 v2,d_euclid v0 v3, + d_euclid v2 v3,d_euclid v1 v3,d_euclid v1 v2)`);; + +let mu_flat_v = kepler_def(`mu_flat_v v0 v1 v2 v3 = + let (x1,x2,x3,x4,x5,x6) = edge_of_v v0 v1 v2 v3 in + mu_flat_x x1 x2 x3 x4 x5 x6`);; + +let mu_upright_v = kepler_def(`mu_upright_v v0 v1 v2 v3 = + let (x1,x2,x3,x4,x5,x6) = edge_of_v v0 v1 v2 v3 in + mu_upright_x x1 x2 x3 x4 x5 x6`);; + +let sigma_upright_c21_x = kepler_def(`sigma_upright_c21_x + x1 x2 x3 x4 x5 x6= + mu_upright_x x1 x2 x3 x4 x5 x6`);; + +let sigma_upright_c40_x = kepler_def(`sigma_upright_c40_x + x1 x2 x3 x4 x5 x6= + ((&1)/(&2))* + ((mu_upright_x x1 x2 x3 x4 x5 x6) + + (mu_upright_x x1 x5 x6 x4 x2 x3))`);; + +let qy_v = kepler_def(`qy_v v0 v1 v2 = + let y1 = d_euclid v0 v1 in + let y2 = d_euclid v0 v2 in + let y3 = d_euclid v1 v2 in + qy y1 y2 y3`);; + +let full_phit = kepler_def(`full_phit h t = + ((&1)- (h/t))*((phi h t)-(phi t t))`);; + +let vort_quad_v = kepler_def(`vort_quad_v v0 v1 v2 v3 v4 t= + let sol = solid_area_quad_v v0 v1 v2 v3 v4 in + let phit= phi t t in + let qy12 = (qy_v v0 v1 v2 t) + (qy_v v0 v2 v1 t) in + let qy23 = (qy_v v0 v2 v3 t) + (qy_v v0 v3 v2 t) in + let qy34 = (qy_v v0 v3 v4 t) + (qy_v v0 v4 v3 t) in + let qy41 = (qy_v v0 v4 v1 t) + (qy_v v0 v1 v4 t) in + let d1 = or_dih_v v0 v1 v2 v4 in + let d2 = or_dih_v v0 v2 v3 v1 in + let d3 = or_dih_v v0 v3 v4 v2 in + let d4 = or_dih_v v0 v4 v1 v3 in + sol*phit - (&4)*doct*(qy12+qy23+qy34+qy41) + + (d1*(full_phit ((d_euclid v0 v1)/(&2)) t)) + + (d2*(full_phit ((d_euclid v0 v2)/(&2)) t)) + + (d3*(full_phit ((d_euclid v0 v3)/(&2)) t)) + + (d4*(full_phit ((d_euclid v0 v4)/(&2)) t))`);; + + + +(* score of an octahedron with an upright diagonal w *) +let sigma_upoct_approx_w = kepler_def(`sigma_upoct_approx_w v0 w v1 v2 v3 v4= + let t1 = + (let (x1,x2,x3,x4,x5,x6) = edge_of_v v0 w v1 v2 in + sigma_upright_c40_x x1 x2 x3 x4 x5 x6) in + let t2 = + (let (x1',x2',x3',x4',x5',x6') = edge_of_v v0 w v2 v3 in + sigma_upright_c40_x x1' x2' x3' x4' x5' x6') in + let t3 = + (let (x1'',x2'',x3'',x4'',x5'',x6'') = edge_of_v v0 w v3 v4 in + sigma_upright_c40_x x1'' x2'' x3'' x4'' x5'' x6'') in + let t4 = + (let (x1''',x2''',x3''',x4''',x5''',x6''') = edge_of_v v0 w v4 v1 in + sigma_upright_c40_x x1''' x2''' x3''' x4''' x5''' x6''') in + t1+t2+t3+t4`);; + +(* this is an upper bound on the score of a quad cluster *) +let sigma_quad_approx1 = kepler_def(`sigma_quad_approx1 v0 v1 v2 v3 v4= + let nonoctpart = ( + if ((is_pairflat13 v0 v1 v2 v3 v4)/\ + (is_pairflat24 v0 v1 v2 v3 v4)) then + (max_real ((mu_flat_v v0 v2 v1 v3)+(mu_flat_v v0 v4 v1 v3)) + ((mu_flat_v v0 v1 v2 v4)+(mu_flat_v v0 v3 v2 v4))) + else if (is_pairflat13 v0 v1 v2 v3 v4) + then ((mu_flat_v v0 v2 v1 v3)+(mu_flat_v v0 v4 v1 v3)) + else if (is_pairflat24 v0 v1 v2 v3 v4) + then (((mu_flat_v v0 v1 v2 v4)+(mu_flat_v v0 v3 v2 v4))) + else + (max_real + (min_real (--(&104)*pt/(&100)) + (vort_quad_v v0 v1 v2 v3 v4 t0)) + (vort_quad_v v0 v1 v2 v3 v4 sqrt2))) in + let octpart = (if (?w. (upright_oct_v v0 w v1 v2 v3 v4)) then + (sup (\x. ?w. ((upright_oct_v v0 w v1 v2 v3 v4) /\ + (x = sigma_upoct_approx_w v0 w v1 v2 v3 v4)))) + else nonoctpart) in + (max_real octpart nonoctpart)`);; + +let sigma_quad_approx1_lambda = kepler_def(`sigma_quad_approx1_lambda + v0 v1 v2 v3 v4 lambda = + (sigma_quad_approx1 v0 v1 v2 v3 v4) - + (solid_area_quad_v v0 v1 v2 v3 v4)*lambda*zeta*pt`);; + + + +(* VU KHAC KY *) + + + + + + diff --git a/legacy/inequalities/dodec_ineq_names.ml b/legacy/inequalities/dodec_ineq_names.ml new file mode 100644 index 0000000..757ff3c --- /dev/null +++ b/legacy/inequalities/dodec_ineq_names.ml @@ -0,0 +1,117 @@ + +module type Dodec_ineq_names = +sig + + val dodec_ineqs : (string * term) list + +end + +module Dodec_ineq_names : Dodec_ineq_names = +struct + +let dodec_ineqs = [ + + "D_232427898",D_232427898; + "D_501745932",D_501745932; + "D_454413312",D_454413312; + "D_484548925",D_484548925; + "D_140432082",D_140432082; + "D_211431164",D_211431164; + "D_120383233",D_120383233; + "D_950195574",D_950195574; + "D_411439162",D_411439162; + "D_930476095",D_930476095; + "D_504216105",D_504216105; + "D_303447655",D_303447655; + "D_999530305",D_999530305; + "D_774222998",D_774222998; + "D_583790155",D_583790155; + "D_954638763",D_954638763; + "D_836501282",D_836501282; + "D_815857122",D_815857122; + "D_143442051",D_143442051; + "D_616037833",D_616037833; + "D_943639543",D_943639543; + "D_348573741",D_348573741; + "D_887895540",D_887895540; + "D_292050936",D_292050936; + "D_747114280",D_747114280; + "D_407035272",D_407035272; + "D_746762527",D_746762527; + "D_908135697",D_908135697; + "D_852700722",D_852700722; + "D_187794654",D_187794654; + "D_241250402",D_241250402; + "D_614375500",D_614375500; + "D_392850749",D_392850749; + "D_324682944",D_324682944; + "D_102919537",D_102919537; + "D_756454529",D_756454529; + "D_563250599",D_563250599; + "D_439521695",D_439521695; + "D_805633512",D_805633512; + "D_892141600",D_892141600; + "D_224306197",D_224306197; + "D_120210454",D_120210454; + "D_479875130",D_479875130; + "D_629548058",D_629548058; + "D_469668150",D_469668150; + "D_218128189",D_218128189; + "D_169113912",D_169113912; + "D_143105921",D_143105921; + "D_421739939",D_421739939; + "D_595203705",D_595203705; + "D_943490566",D_943490566; + "D_797136399",D_797136399; + "D_603733089",D_603733089; + "D_459264712",D_459264712; + "D_557495949",D_557495949; + "D_171329882",D_171329882; + "D_720788076",D_720788076; + "D_554235027",D_554235027; + "D_569393441",D_569393441; + "D_992963254",D_992963254; + "D_157321192",D_157321192; + "D_954705068",D_954705068; + "D_607292193",D_607292193; + "D_852636576",D_852636576; + "D_981457443",D_981457443; + "D_400655725",D_400655725; + "D_552790530",D_552790530; + "D_339650543",D_339650543; + "D_195763418",D_195763418; + "D_346647038",D_346647038; + "D_542422328",D_542422328; + "D_958501031",D_958501031; + "D_977882706",D_977882706; + "D_817699709",D_817699709; + "D_221335081",D_221335081; + "D_380511524",D_380511524; + "D_534704091",D_534704091; + "D_510654661",D_510654661; + "D_296038926",D_296038926; + "D_725284239",D_725284239; + "D_508592316",D_508592316; + "D_780228595",D_780228595; + "D_129176394",D_129176394; + "D_794503453",D_794503453; + "D_820371697",D_820371697; + "D_993947481",D_993947481; + "D_888634003",D_888634003; + "D_985594975",D_985594975; + "D_278856582",D_278856582; + "D_309781213",D_309781213; + "D_546070702",D_546070702; + "D_273299220",D_273299220; + "D_420356876",D_420356876; + "D_168730298",D_168730298; + "D_563211815",D_563211815; + "D_923665644",D_923665644; + "D_131907821",D_131907821; + "D_632783039",D_632783039; + "D_997560269",D_997560269; + "D_849090707",D_849090707; + "D_741613981",D_741613981; + + ] +end diff --git a/legacy/inequalities/dodec_inequalities.ml b/legacy/inequalities/dodec_inequalities.ml new file mode 100644 index 0000000..e18f1ca --- /dev/null +++ b/legacy/inequalities/dodec_inequalities.ml @@ -0,0 +1,284 @@ + +(* -------------------------------------------------------------------------- *) +(* Util *) +(* -------------------------------------------------------------------------- *) + +let mk_times x y = mk_binop `( *. )` x y +let mk_plus x y = mk_binop `( +. )` x y +let mk_gt x y = mk_binop `( >. )` x y +let _0 = `&0` +let _1 = `&1` +let m_1 = `-- &1` +let list_disj l = end_itlist (curry mk_disj) l + +(* -------------------------------------------------------------------------- *) +(* Definitions *) +(* -------------------------------------------------------------------------- *) + +(* + * t = 1.25841 + * 2t = 2.51682 + * (2t)^2 = 6.3343829124 + *) +let dodecTrunc = kepler_def `dodecTrunc = #1.25841` +let twoDodecTrunc = kepler_def `twoDodecTrunc = #2.51682` +let twoDodecTruncSq = kepler_def `twoDodecTruncSq = #6.3343829124` +let dodecSlope = kepler_def `dodecSlope = #0.42755` + +let volume_x = kepler_def(`volume_x x1 x2 x3 x4 x5 x6 = + let del = sqrt (delta_x x1 x2 x3 x4 x5 x6) in + let u126 = ups_x x1 x2 x6 in + let u135 = ups_x x1 x3 x5 in + let u234 = ups_x x2 x3 x4 in + let vol = ((&1)/((&48)*del))* + ((x1*(x2+x6-x1)+x2*(x1+x6-x2))*(chi_x x4 x5 x3 x1 x2 x6)/u126 + +(x2*(x3+x4-x2)+x3*(--x3+x4+x2))*(chi_x x6 x5 x1 x3 x2 x4)/u234 + +(x1*(--x1+x3+x5)+x3*(x1-x3+x5))*(chi_x x4 x6 x2 x1 x3 x5)/u135) in + vol`) + +let truncated_volume_x = kepler_def(`truncated_volume_x x1 x2 x3 x4 x5 x6 = + let vor = vort_x x1 x2 x3 x4 x5 x6 dodecTrunc in + let sol = sol_x x1 x2 x3 x4 x5 x6 in + (vor - (&4 / &3) * sol) / (--(&4) * doct)`) + +let omega_x = kepler_def( `omega_x x1 x2 x3 x4 x5 x6 = + if eta_x x1 x2 x6 < sqrt2 /\ + eta_x x1 x3 x5 < sqrt2 /\ + eta_x x2 x3 x4 < sqrt2 /\ + eta_x x4 x5 x6 < sqrt2 + then + volume_x x1 x2 x3 x4 x5 x6 + else + truncated_volume_x x1 x2 x3 x4 x5 x6`) + +let squander_x = kepler_def( `squander_x x1 x2 x3 x4 x5 x6 = + omega_x x1 x2 x3 x4 x5 x6 - dodecSlope * sol_x x1 x2 x3 x4 x5 x6`) + +(* -------------------------------------------------------------------------- *) +(* Tetrahedra *) +(* -------------------------------------------------------------------------- *) + +let basicTet = + let bnds = `ineq + [(&4, x1, twoDodecTruncSq); + (&4, x2, twoDodecTruncSq); + (&4, x3, twoDodecTruncSq); + (&4, x4, twoDodecTruncSq); + (&4, x5, twoDodecTruncSq); + (&4, x6, twoDodecTruncSq)]` in + let mk_p (vol,sol,dih,y1,y2,y3,y4,y5,y6,const) = + let vt = mk_times vol `omega_x x1 x2 x3 x4 x5 x6` in + let st = mk_times sol `sol_x x1 x2 x3 x4 x5 x6` in + let dt = mk_times dih `dih_x x1 x2 x3 x4 x5 x6` in + let y1t = mk_times y1 `sqrt x1` in + let y2t = mk_times y2 `sqrt x2` in + let y3t = mk_times y3 `sqrt x3` in + let y4t = mk_times y4 `sqrt x4` in + let y5t = mk_times y5 `sqrt x5` in + let y6t = mk_times y6 `sqrt x6` in + let lhs = end_itlist mk_plus [vt;st;dt;y1t;y2t;y3t;y4t;y5t;y6t;const] in + mk_gt lhs _0 in + fun args -> all_forall (mk_comb(bnds,mk_p args)) + +(* +structure R = Random +val rand = R.rand(1029,4139871) +fun n () = R.randRange(100000000,999999999) rand +n() + + *) + +let D_232427898 = basicTet(_1,_0,_0,_0,_0,_0,_0,_0,_0,`-- #0.20280`) +let D_501745932 = basicTet(_0,_1,_0,_0,_0,_0,_0,_0,_0,`-- #0.31568`) +let D_454413312 = basicTet(_0,m_1,_0,_0,_0,_0,_0,_0,_0,`#1.05124`) +let D_484548925 = basicTet(_0,_0,_1,_0,_0,_0,_0,_0,_0,`-- #0.85613`) +let D_140432082 = basicTet(_0,_0,m_1,_0,_0,_0,_0,_0,_0,`#1.88674`) +let D_211431164 = basicTet(_1,`-- #0.42755`,_0,_0,_0,_0,_0,_0,_0,_0) +let D_120383233 = basicTet(_1,`-- #0.68`,`#1.88718`,_0,_0,_0,_0,_0,_0,`-- #1.54550`) +let D_950195574 = basicTet(_1,`-- #0.68`,`#0.90746`,_0,_0,_0,_0,_0,_0,`-- #0.70671`) +let D_411439162 = basicTet(_1,`-- #0.68`,`#0.46654`,_0,_0,_0,_0,_0,_0,`-- #0.32922`) +let D_930476095 = basicTet(_1,`-- #0.55889`,_0,_0,_0,_0,_0,_0,_0,`#0.07365`) +let D_504216105 = basicTet(_1,`-- #0.63214`,_0,_0,_0,_0,_0,_0,_0,`#0.13033`) +let D_303447655 = basicTet(_1,`-- #0.73256`,_0,_0,_0,_0,_0,_0,_0,`#0.23590`) +let D_999530305 = basicTet(_1,`-- #0.89346`,_0,_0,_0,_0,_0,_0,_0,`#0.40504`) +let D_774222998 = basicTet(_1,`-- #0.3`,`-- #0.5734`,_0,_0,_0,_0,_0,_0,`#0.97823`) +let D_583790155 = basicTet(_1,`-- #0.3`,`-- #0.03668`,_0,_0,_0,_0,_0,_0,`-- #0.02475`) +let D_954638763 = basicTet(_1,`-- #0.3`,`#0.04165`,_0,_0,_0,_0,_0,_0,`-- #0.12118`) +let D_836501282 = basicTet(_1,`-- #0.3`,`#0.1234`,_0,_0,_0,_0,_0,_0,`-- #0.20926`) +let D_815857122 = basicTet(_1,`-- #0.42755`,`-- #0.11509`,_0,_0,_0,_0,_0,_0,`#0.17186`) +let D_143442051 = basicTet(_1,`-- #0.42755`,`-- #0.04078`,_0,_0,_0,_0,_0,_0,`#0.05072`) +let D_616037833 = basicTet(_1,`-- #0.42755`,`#0.11031`,_0,_0,_0,_0,_0,_0,`-- #0.13562`) +let D_943639543 = basicTet(_1,`-- #0.42755`,`#0.13091`,_0,_0,_0,_0,_0,_0,`-- #0.15735`) +let D_348573741 = basicTet(_1,`-- #0.55792`,`-- #0.21394`,_0,_0,_0,_0,_0,_0,`#0.41800`) +let D_887895540 = basicTet(_1,`-- #0.55792`,`-- #0.0068`,_0,_0,_0,_0,_0,_0,`#0.08191`) +let D_292050936 = basicTet(_1,`-- #0.55792`,`#0.0184`,_0,_0,_0,_0,_0,_0,`#0.05123`) +let D_747114280 = basicTet(_1,`-- #0.55792`,`#0.24335`,_0,_0,_0,_0,_0,_0,`-- #0.19398`) +let D_407035272 = basicTet(_1,`-- #0.68`,`-- #0.30651`,_0,_0,_0,_0,_0,_0,`#0.64850`) +let D_746762527 = basicTet(_1,`-- #0.68`,`-- #0.06965`,_0,_0,_0,_0,_0,_0,`#0.27799`) +let D_908135697 = basicTet(_1,`-- #0.68`,`#0.0172`,_0,_0,_0,_0,_0,_0,`#0.15661`) +let D_852700722 = basicTet(_1,`-- #0.68`,`#0.41812`,_0,_0,_0,_0,_0,_0,`-- #0.28776`) +let D_187794654 = basicTet(_1,`-- #0.64934`,_0,_0,_0,_0,_0,_0,_0,`#0.14841`) +let D_241250402 = basicTet(_1,`-- #0.6196`,_0,_0,_0,_0,_0,_0,_0,`#0.11763`) +let D_614375500 = basicTet(_1,`-- #0.58402`,_0,_0,_0,_0,_0,_0,_0,`#0.09029`) +let D_392850749 = basicTet(_1,`-- #0.25181`,_0,_0,_0,_0,_0,_0,_0,`-- #0.09649`) +let D_324682944 = basicTet(_1,`-- #0.00909`,_0,_0,_0,_0,_0,_0,_0,`-- #0.19954`) +let D_102919537 = basicTet(_1,`#0.93877`,_0,_0,_0,_0,_0,_0,_0,`-- #0.53788`) +let D_756454529 = basicTet(_1,`#0.93877`,`-- #0.20211`,_0,_0,_0,_0,_0,_0,`-- #0.28126`) +let D_563250599 = basicTet(_1,`#0.93877`,`#0.63517`,_0,_0,_0,_0,_0,_0,`-- #1.21407`) +let D_439521695 = basicTet(_1,`#1.93877`,_0,_0,_0,_0,_0,_0,_0,`-- #0.85479`) +let D_805633512 = basicTet(_1,`#1.93877`,`-- #0.20211`,_0,_0,_0,_0,_0,_0,`-- #0.62187`) +let D_892141600 = basicTet(_1,`#1.93877`,`#0.63517`,_0,_0,_0,_0,_0,_0,`-- #1.57647`) +let D_224306197 = basicTet(_1,`-- #0.42775`,_0,_0,_0,_0,_0,_0,_0,`#0.00012`) +let D_120210454 = basicTet(_1,`-- #0.55792`,_0,_0,_0,_0,_0,_0,_0,`#0.07304`) +let D_479875130 = basicTet(_1,_0,`-- #0.07853`,_0,_0,_0,_0,_0,_0,`-- #0.09374`) +let D_629548058 = basicTet(_1,_0,`-- #0.00339`,_0,_0,_0,_0,_0,_0,`-- #0.19868`) +let D_469668150 = basicTet(_1,_0,`#0.18199`,_0,_0,_0,_0,_0,_0,`-- #0.39666`) +let D_218128189 = basicTet(_1,`-- #0.42755`,`-- #0.2`,_0,_0,_0,_0,_0,_0,`#0.33207`) +let D_169113912 = basicTet(_1,`-- #0.3`,`-- #0.36373`,_0,_0,_0,_0,_0,_0,`#0.58263`) +let D_143105921 = basicTet(_1,`-- #0.3`,`#0.20583`,_0,_0,_0,_0,_0,_0,`-- #0.27984`) +let D_421739939 = basicTet(_1,`-- #0.3`,`#0.40035`,_0,_0,_0,_0,_0,_0,`-- #0.44637`) +let D_595203705 = basicTet(_1,`-- #0.3`,`#0.83259`,_0,_0,_0,_0,_0,_0,`-- #0.81644`) +let D_943490566 = basicTet(_1,`-- #0.42755`,`-- #0.51838`,_0,_0,_0,_0,_0,_0,`#0.93276`) +let D_797136399 = basicTet(_1,`-- #0.42755`,`#0.29344`,_0,_0,_0,_0,_0,_0,`-- #0.29650`) +let D_603733089 = basicTet(_1,`-- #0.42755`,`#0.57056`,_0,_0,_0,_0,_0,_0,`-- #0.53375`) +let D_459264712 = basicTet(_1,`-- #0.42755`,`#1.18656`,_0,_0,_0,_0,_0,_0,`-- #1.06114`) +let D_557495949 = basicTet(_1,`-- #0.55792`,`-- #0.67644`,_0,_0,_0,_0,_0,_0,`#1.29062`) +let D_171329882 = basicTet(_1,`-- #0.55792`,`#0.38278`,_0,_0,_0,_0,_0,_0,`-- #0.31335`) +let D_720788076 = basicTet(_1,`-- #0.55792`,`#0.74454`,_0,_0,_0,_0,_0,_0,`-- #0.62307`) +let D_554235027 = basicTet(_1,`-- #0.55792`,`#1.54837`,_0,_0,_0,_0,_0,_0,`-- #1.31127`) +let D_569393441 = basicTet(_1,`-- #0.68`,`-- #0.82445`,_0,_0,_0,_0,_0,_0,`#1.62571`) + +let D_992963254 = basicTet + (_0,_1,_0,`#0.245`,`#0.245`,`#0.245`, + `-- #0.063`,`-- #0.063`,`-- #0.063`,`-- #1.64327`) + +let D_157321192 = basicTet + (_0,_1,_0,`#0.3798`,`#0.3798`,`#0.3798`, + `-- #0.198`,`-- #0.198`,`-- #0.198`,`-- #1.64207`) + +(* Error: changed from 0.480715*) +let D_954705068 = basicTet + (_0,m_1,_0,`-- #0.151`,`-- #0.151`,`-- #0.151`, + `#0.323`,`#0.323`,`#0.323`,`-- #0.48070`) + +let D_607292193 = basicTet + (_1,`-- #0.42755`,_0,`-- #0.0392`,`-- #0.0392`,`-- #0.0392`, + `-- #0.0101`,`-- #0.0101`,`-- #0.0101`,`#0.29580`) + +let D_852636576 = basicTet + (_1,_0,_0,`#0.107`,`#0.107`,`#0.107`, + `-- #0.116`,`-- #0.116`,`-- #0.116`,`-- #0.18169`) + +let D_981457443 = basicTet + (_1,_0,_0,`#0.0623`,`#0.0623`,`#0.0623`, + `-- #0.0722`,`-- #0.0722`,`-- #0.0722`,`-- #0.17629`) + +let D_400655725 = basicTet + (_0,_0,_1,`-- #0.237`,`#0.372`,`#0.372`, + `-- #0.708`,`#0.372`,`#0.372`,`-- #2.31694`) + +let D_552790530 = basicTet + (_0,_0,_1,`-- #0.237`,`#0.363`,`#0.363`, + `-- #0.688`,`#0.363`,`#0.363`,`-- #2.28494`) + +(* Error: changed from 0.9505*) +let D_339650543 = basicTet + (_0,_0,m_1,`#0.505`,`-- #0.152`,`-- #0.152`, + `#0.766`,`-- #0.152`,`-- #0.152`,`-- #0.09503`) + +(* -------------------------------------------------------------------------- *) +(* Quadrilaterals *) +(* -------------------------------------------------------------------------- *) + +let basicQuad = + let bnds = `ineq + [(&4, x1, twoDodecTruncSq); + (&4, x2, twoDodecTruncSq); + (&4, x3, twoDodecTruncSq); + (twoDodecTruncSq, x4, #26.0)); + (&4, x5, twoDodecTruncSq); + (&4, x6, twoDodecTruncSq); + (&4, x7, twoDodecTruncSq); + (&4, x8, twoDodecTruncSq); + (&4, x9, twoDodecTruncSq)]` in + let mk_times x y = mk_binop `( *. )` x y in + let mk_plus x y = mk_binop `( +. )` x y in + let mk_gt x y = mk_binop `( >. )` x y in + let constr1 = `delta_x x1 x2 x3 x4 x5 x6 < &0` in + let constr2 = `delta_x x7 x2 x3 x4 x8 x9 < &0` in + let constr3 = `cross_diag_x x1 x2 x3 x4 x5 x6 x7 x8 x9 < twoDodecTrunc` in + let mk_p (vol,sol,dih,const) = + let vt = mk_times vol `omega_x x1 x2 x3 x4 x5 x6 + omega_x x7 x2 x3 x4 x8 x9` in + let st = mk_times sol `sol_x x1 x2 x3 x4 x5 x6 + sol_x x7 x2 x3 x4 x8 x9` in + let dt = mk_times dih `dih_x x1 x2 x3 x4 x5 x6` in + let rhs = end_itlist mk_plus [vt;st;dt;const] in + mk_gt rhs _0 in + fun args -> + all_forall (mk_comb(bnds,list_disj [mk_p args;constr1;constr2;constr3])) + +let D_195763418 = basicQuad (_1,_0,_0,`-- #0.45513`) +let D_346647038 = basicQuad (_0,_1,_0,`-- #0.73192`) +let D_542422328 = basicQuad (_0,m_1,_0,`#2.85860`) +let D_958501031 = basicQuad (_0,_0,_1,`-- #1.15242`) +let D_977882706 = basicQuad (_0,_0,m_1,`#3.25887`) +let D_817699709 = basicQuad (_1,`-- #0.42755`,_0,`-- #0.031350`) + +(* false *) +(* let D_221335081 = basicQuad (_1,`-- #0.42775`,`-- #0.15098`,`-- #0.3670`) *) + +(* false *) +(* let D_380511524 = basicQuad (_1,`-- #0.42775`,`-- #0.09098`,`-- #0.1737`) *) + +let D_534704091 = basicQuad (_1,`-- #0.42775`,`-- #0.00000`,`#0.0310`) + +(* too true *) +(* let D_510654661 = basicQuad (_1,`-- #0.42775`,`#0.18519`,`#0.3183`) *) + + +let D_296038926 = basicQuad (_1,`-- #0.42775`,`#0.20622`,`#0.3438`) + +(* false *) +(* let D_725284239 = basicQuad (_1,`-- #0.55792`,`-- #0.30124`,`-- #1.0173`) *) + +(* false *) +(* let D_508592316 = basicQuad (_1,`-- #0.55792`,`-- #0.02921`,`-- #0.2101`) *) + +(* false *) +(* let D_780228595 = basicQuad (_1,`-- #0.55792`,`-- #0.00000`,`-- #0.1393`) *) + +(* false *) +(* let D_129176394 = basicQuad (_1,`-- #0.55792`,`#0.05947`,`-- #0.0470`) *) + +let D_794503453 = basicQuad (_1,`-- #0.55792`,`#0.39938`,`#0.4305`) +let D_820371697 = basicQuad (_1,`-- #0.55792`,`#2.50210`,`#2.8976`) + +(* false *) +(* let D_993947481 = basicQuad (_1,`-- #0.68000`,`-- #0.44194`,`-- #1.6264`) *) + +(* false *) +(* let D_888634003 = basicQuad (_1,`-- #0.68000`,`-- #0.10957`,`-- #0.6753`) *) + +(* false *) +(* let D_985594975 = basicQuad (_1,`-- #0.68000`,`-- #0.00000`,`-- #0.4029`) *) + +let D_278856582 = basicQuad (_1,`-- #0.68000`,`#0.86096`,`#0.8262`) +let D_309781213 = basicQuad (_1,`-- #0.68000`,`#2.44439`,`#2.7002`) + +(* false *) +(* let D_546070702 = basicQuad (_1,`-- #0.30000`,`-- #0.12596`,`-- #0.1279`) *) + +let D_273299220 = basicQuad (_1,`-- #0.30000`,`-- #0.02576`,`#0.1320`) +let D_420356876 = basicQuad (_1,`-- #0.30000`,`#0.00000`,`#0.1945`) +let D_168730298 = basicQuad (_1,`-- #0.30000`,`#0.03700`,`#0.2480`) + +let D_563211815 = basicQuad (_1,`-- #0.30000`,`#0.22476`,`#0.5111`) +let D_923665644 = basicQuad (_1,`-- #0.30000`,`#2.31852`,`#2.9625`) + +(* false *) +(* let D_131907821 = basicQuad (_1,_0,`-- #0.23227`,`-- #0.1042`) *) + +let D_632783039 = basicQuad (_1,_0,`#0.07448`,`#0.5591`) +let D_997560269 = basicQuad (_1,_0,`#0.22019`,`#0.7627`) +let D_849090707 = basicQuad (_1,_0,`#0.80927`,`#1.5048`) +let D_741613981 = basicQuad (_1,_0,`#5.84380`,`#7.3468`) + diff --git a/legacy/inequalities/generate-ineq-syntax.ml b/legacy/inequalities/generate-ineq-syntax.ml new file mode 100644 index 0000000..1b9bfeb --- /dev/null +++ b/legacy/inequalities/generate-ineq-syntax.ml @@ -0,0 +1,40 @@ + +(* + * Load HOL Light and the kepler definition and inequality files. + * Then use [ocaml_to_sml] to generate an SML file of the + * inequality syntax. + *) + +#use "hol.ml";; +needs "Examples/analysis.ml";; +needs "Examples/transc.ml";; +needs "Jordan/lib_ext.ml";; +needs "Jordan/parse_ext_override_interface.ml";; +unambiguous_interface();; + +let kepler_home = Sys.getenv "KEPLER_HOME";; +(* +let kepler_home = "/Users/seanmcl/save/versioned/projects/kepler/src";; +*) +loads (kepler_home ^ "/inequalities/holl/definitions_kepler.ml");; +loads (kepler_home ^ "/inequalities/holl/kep_inequalities.ml");; +loads (kepler_home ^ "/inequalities/holl/kep_ineq_bis.ml");; +loads (kepler_home ^ "/inequalities/holl/kepler_ineq_names.ml");; +loads (kepler_home ^ "/inequalities/holl/dodec_inequalities.ml");; +loads (kepler_home ^ "/inequalities/holl/dodec_ineq_names.ml");; +loads (kepler_home ^ "/inequalities/holl/ocaml_to_sml.ml");; + +let kepler_ineqs = Ocaml_sml.translate_list ~ignore:Kepler_ineq_names.ignore ~terms:Kepler_ineq_names.kepler_ineqs;; +let dodec_ineqs = Ocaml_sml.translate_list ~ignore:[] ~terms:Dodec_ineq_names.dodec_ineqs;; + +let _ = + Ocaml_sml.ineqs_to_sml + ~file:(kepler_home ^ "/inequalities/kepler-inequality-syntax-base.sml") + ~ineqs:kepler_ineqs + ~univ:"Kepler";; + +let _ = + Ocaml_sml.ineqs_to_sml + ~file:(kepler_home ^ "/inequalities/dodec-inequality-syntax-base.sml") + ~ineqs:dodec_ineqs + ~univ:"Dodec";; diff --git a/legacy/inequalities/inequality_spec.ml b/legacy/inequalities/inequality_spec.ml new file mode 100644 index 0000000..a31409a --- /dev/null +++ b/legacy/inequalities/inequality_spec.ml @@ -0,0 +1,653 @@ +(* inequalities used in the text part of the kepler conjecture *) + +(* They are not ALL listed here. + +The following are in kep_inequalities2.ml +996268658 P2 +824762926 P2 +675785884 P2 +657406669 P2 +551665569 P2 +325738864 P2 +314974315 P2 +277330628 P2 +193592217 P2 + +The following need to be moved here, but they are composites +of several inequalites. + +984628285 C +971555266 C +940884472 C +934150983 C +874876755 C +855294746 C +852270725 C +83777706 C +830854305 C +815492935 C +764978100 C +73974037 C +729988292 C +692155251 C +636208429 C +628964355 C +618205535 C +531888597 C +485049042 C +311189443 C +209361863 C +193836552 C +187932932 C +163548682 C +148776243 C +129662166 C +128523606 C +*) + +parse_as_infix("+.",(16,"right")); +parse_as_infix("-.",(18,"left")); +parse_as_infix("*.",(20,"right")); +parse_as_infix("**.",(24,"left")); +parse_as_infix("<.",(12,"right")); +parse_as_infix("<=.",(12,"right")); +parse_as_infix(">.",(12,"right")); +parse_as_infix(">=.",(12,"right")); +override_interface("+.",`real_add:real->real->real`); +override_interface("-.",`real_sub:real->real->real`); +override_interface("*.",`real_mul:real->real->real`); +override_interface("**.",`real_pow:real->num->real`); +(* boolean *) +override_interface("<.",`real_lt:real->real->bool`); +override_interface("<=.",`real_le:real->real->bool`); +override_interface(">.",`real_gt:real->real->bool`); +override_interface(">=.",`real_ge:real->real->bool`); +(* unary *) +override_interface("--.",`real_neg:real->real`); +override_interface("&.",`real_of_num:num->real`); +override_interface("||.",`real_abs:real->real`);; + + +let I_115383627= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, (square (#2.168))); + ((#4.0), x3, (square (#2.168))); + ((#4.0), x4, square_2t0); + (square_2t0, x5, square_2t0); + (square_2t0, x6, square_4t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#1.51) \/ + (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)) `;; + + +let I_115756648= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0) + ] + ( (overlap_f (sqrt x1) (sqrt x2)) >. (#0.887))`;; + +let I_122081309= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, (square (#2.168))); + ((#4.0), x3, (square (#2.168))); + ((#8.0), x4, (#8.0)); + (square_2t0, x5, square_2t0); + (square_2t0, x6, square_4t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#1.77) \/ + (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0))`;; + + +let I_135427691= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, (square (#2.168))); + ((#4.0), x3, (square (#2.168))); + (square_2t0, x4, (#8.0)); + (square_2t0, x5, square_2t0); + (square_2t0, x6, square_4t0) + ] + ( + ( + ( (tau_0_x x1 x2 x3 x4 x5 x6) -. ( (#0.2529) *. (dih_x x1 x2 x3 x4 x5 x6))) >. (--. (#0.12))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#1.2)) \/ + (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0))`;; + + + +let J_175514843= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( ( (mu_upright_x x1 x2 x3 x4 x5 x6) +. + ( (--. (#0.1378)) *. ( (#1.0) +. ( (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) / ( (#2.0) *. pi)))) +. + ( (#2.0) *. (#0.0263))) <. + (vor_0_x x1 x2 x3 x4 x5 x6))`;; + + +let J_208809199= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#0.8638))`;; + + +let I_2298281931= +all_forall `ineq + [ + ((#4.0),x1,square_2t0); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#4.0),x4,(#8.0)); + ((#4.0),x5,square_2t0); + ((#4.0),x6,(#8.0)) + ] + (((x1 pow 5)*x4 - (&2)*(x1 pow 4)*x2*x4 + (x1 pow 3)*(x2 pow 2)*x4 - (&2)*(x1 pow 4)*x3*x4 + + (&4)*(x1 pow 3)*x2*x3*x4 - (&2)*(x1 pow 2)*(x2 pow 2)*x3*x4 + (x1 pow 3)*(x3 pow 2)*x4 - + (&2)*(x1 pow 2)*x2*(x3 pow 2)*x4 + x1*(x2 pow 2)*(x3 pow 2)*x4 - (x1 pow 4)*x2*x5 + + (&2)*(x1 pow 3)*(x2 pow 2)*x5 - (x1 pow 2)*(x2 pow 3)*x5 + (x1 pow 4)*x3*x5 - + (x1 pow 3)*x2*x3*x5 - (x1 pow 2)*(x2 pow 2)*x3*x5 + x1*(x2 pow 3)*x3*x5 - + (x1 pow 3)*(x3 pow 2)*x5 + (&2)*(x1 pow 2)*x2*(x3 pow 2)*x5 - + x1*(x2 pow 2)*(x3 pow 2)*x5 - (&2)*(x1 pow 4)*x4*x5 + (&4)*(x1 pow 3)*x2*x4*x5 - + (&2)*(x1 pow 2)*(x2 pow 2)*x4*x5 + (&2)*(x1 pow 3)*x2*(x5 pow 2) - + (&4)*(x1 pow 2)*(x2 pow 2)*(x5 pow 2) + (&2)*x1*(x2 pow 3)*(x5 pow 2) - + (x1 pow 3)*x3*(x5 pow 2) + (&3)*(x1 pow 2)*x2*x3*(x5 pow 2) - + (&3)*x1*(x2 pow 2)*x3*(x5 pow 2) + (x2 pow 3)*x3*(x5 pow 2) + (x1 pow 3)*x4*(x5 pow 2) - + (&2)*(x1 pow 2)*x2*x4*(x5 pow 2) + x1*(x2 pow 2)*x4*(x5 pow 2) - + (x1 pow 2)*x2*(x5 pow 3) + (&2)*x1*(x2 pow 2)*(x5 pow 3) - (x2 pow 3)*(x5 pow 3) + + (x1 pow 4)*x2*x6 - (x1 pow 3)*(x2 pow 2)*x6 - (x1 pow 4)*x3*x6 - (x1 pow 3)*x2*x3*x6 + + (&2)*(x1 pow 2)*(x2 pow 2)*x3*x6 + (&2)*(x1 pow 3)*(x3 pow 2)*x6 - + (x1 pow 2)*x2*(x3 pow 2)*x6 - x1*(x2 pow 2)*(x3 pow 2)*x6 - (x1 pow 2)*(x3 pow 3)*x6 + + x1*x2*(x3 pow 3)*x6 - (&2)*(x1 pow 4)*x4*x6 + (&4)*(x1 pow 3)*x3*x4*x6 - + (&2)*(x1 pow 2)*(x3 pow 2)*x4*x6 - (x1 pow 3)*x2*x5*x6 + (&3)*(x1 pow 2)*(x2 pow 2)*x5*x6 - + (x1 pow 3)*x3*x5*x6 - (&4)*(x1 pow 2)*x2*x3*x5*x6 + x1*(x2 pow 2)*x3*x5*x6 + + (&3)*(x1 pow 2)*(x3 pow 2)*x5*x6 + x1*x2*(x3 pow 2)*x5*x6 - + (&2)*(x2 pow 2)*(x3 pow 2)*x5*x6 + (&4)*(x1 pow 3)*x4*x5*x6 - (&4)*x1*x2*x3*x4*x5*x6 - + (x1 pow 2)*x2*(x5 pow 2)*x6 - (&3)*x1*(x2 pow 2)*(x5 pow 2)*x6 + + (&2)*(x1 pow 2)*x3*(x5 pow 2)*x6 + x1*x2*x3*(x5 pow 2)*x6 + (x2 pow 2)*x3*(x5 pow 2)*x6 - + (&2)*(x1 pow 2)*x4*(x5 pow 2)*x6 + x1*x2*(x5 pow 3)*x6 + (x2 pow 2)*(x5 pow 3)*x6 - + (x1 pow 3)*x2*(x6 pow 2) + (&2)*(x1 pow 3)*x3*(x6 pow 2) + + (&3)*(x1 pow 2)*x2*x3*(x6 pow 2) - (&4)*(x1 pow 2)*(x3 pow 2)*(x6 pow 2) - + (&3)*x1*x2*(x3 pow 2)*(x6 pow 2) + (&2)*x1*(x3 pow 3)*(x6 pow 2) + + x2*(x3 pow 3)*(x6 pow 2) + (x1 pow 3)*x4*(x6 pow 2) - (&2)*(x1 pow 2)*x3*x4*(x6 pow 2) + + x1*(x3 pow 2)*x4*(x6 pow 2) + (&2)*(x1 pow 2)*x2*x5*(x6 pow 2) - + (x1 pow 2)*x3*x5*(x6 pow 2) + x1*x2*x3*x5*(x6 pow 2) - (&3)*x1*(x3 pow 2)*x5*(x6 pow 2) + + x2*(x3 pow 2)*x5*(x6 pow 2) - (&2)*(x1 pow 2)*x4*x5*(x6 pow 2) - + x1*x2*(x5 pow 2)*(x6 pow 2) - x1*x3*(x5 pow 2)*(x6 pow 2) - + (&2)*x2*x3*(x5 pow 2)*(x6 pow 2) + x1*x4*(x5 pow 2)*(x6 pow 2) - + (x1 pow 2)*x3*(x6 pow 3) + (&2)*x1*(x3 pow 2)*(x6 pow 3) - (x3 pow 3)*(x6 pow 3) + + x1*x3*x5*(x6 pow 3) + (x3 pow 2)*x5*(x6 pow 3)) < (#0.0))`;; + + +let J_241241504_1= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((square (#2.177303)), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) <. ( #0.028794285 ))`;; + + +let I_312132053= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, (square (#2.168))); + ((#4.0), x3, (square (#2.168))); + ((#4.0), x4, square_2t0); + (square_2t0, x5, (square (#3.488))); + (square_2t0, x6, square_2t0) + ] + ( + ( (tau_0_x x1 x2 x3 x4 x5 x6) -. ( (#0.2529) *. (dih_x x1 x2 x3 x4 x5 x6))) >. (--. (#0.1453)))`;; + +let J_346093004= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (gamma_x x1 x2 x3 x4 x5 x6) <=. (#0.0)) \/ + ( (eta_x x1 x2 x6) >. (#2.0)) \/ + ( (eta_x x2 x3 x4) >. (#2.0)) \/ + ( (eta_x x1 x3 x5) >. (#2.0)) \/ + ( (eta_x x4 x5 x6) >. (#2.0)))`;; + +let J_40003553= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (vor_analytic_x x1 x2 x3 x4 x5 x6) <=. (#0.0))`;; + +let I_467530297= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, (square (#2.168))); + ((#4.0), x3, (square (#2.168))); + ((#4.0), x4, square_2t0); + (square_2t0, x5, square_2t0); + (square_2t0, x6, square_4t0) + ] + ( + ( + ( (tau_0_x x1 x2 x3 x4 x5 x6) -. ( (#0.2529) *. (dih_x x1 x2 x3 x4 x5 x6))) >. (--. (#0.1376))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#1.2)) \/ + (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0))`;; + + +let J_522528841= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( ( ( (#2.0) *. (gamma_x x1 x2 x3 x4 x5 x6)) +. + (vor_0_x x1 x2 x3 x4 x5 x6) +. + (( --. ) (vor_0_x_flipped x1 x2 x3 x4 x5 x6))) <=. (#0.0))`;; + + +let J_53415898= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma1_qrtet_x x1 x2 x3 x4 x5 x6) <=. (#0.0))`;; + +let I_535502975= + all_forall `ineq + [((square (#2.3)), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + (square_2t0, x5, (square (#3.02))); + (square_2t0, x6, (square (#3.02))) + ] + ( + ( + ( (tau_0_x x1 x2 x3 x4 x5 x6) -. ( (#0.2529) *. (dih_x x1 x2 x3 x4 x5 x6))) >. + (--. (#0.1371))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#1.14)) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.51)))`;; + +let J_554253147= + all_forall `ineq + [ + (square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4,square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( ( (mu_upright_x x1 x2 x3 x4 x5 x6) +. (mu_flipped_x x1 x2 x3 x4 x5 x6) +. + ( (crown ( (sqrt x1) / (#2.0))) *. ( (#1.0) +. ( (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) / pi))) +. + ( (#2.0) *. (anc (sqrt x1) (sqrt x2) (sqrt x6)))) <. + ( (vor_0_x x1 x2 x3 x4 x5 x6) +. (vor_0_x_flipped x1 x2 x3 x4 x5 x6)))`;; + +let I_560470084= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((square (#2.3)), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (tauhat_x x1 x2 x3 x4 x5 x6) -. ( (#0.2529) *. (dih2_x x1 x2 x3 x4 x5 x6))) >. + (--. (#0.2137)))`;; + +let I_572068135= + all_forall `ineq + [((square (#2.3)), x1, (#6.3001)); + ((#4.0), x2, (#6.3001)); + ((#4.0), x3, (#6.3001)); + ((#4.0), x4, (#6.3001)); + ((#4.0), x5, (#6.3001)); + ((#4.0), x6, (#6.3001)) + ] + ( + ( + ( (tau_sigma_x x1 x2 x3 x4 x5 x6) -. ( (#0.2529) *. (dih_x x1 x2 x3 x4 x5 x6))) >. + (--. (#0.3442))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#1.51)))`;; + +let I_576221766= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, (square (#2.168))); + ((#4.0), x3, (square (#2.168))); + ((#8.0), x4, (#8.0)); + ((#4.0), x5, square_2t0); + (square_2t0, x6, square_4t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#1.93) \/ + (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0))`;; + +let J_586468779= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) <=. pt)`;; + +let J_587618947= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + (square_2t0, x4, (#8.0)); + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( + ( (vor_analytic_x x1 x2 x3 x4 x5 x6) <. (#0.0)) \/ + ( (eta_x x1 x2 x6) >. (sqrt (#2.0))) \/ + ( (eta_x x2 x3 x4) >. (sqrt (#2.0))) \/ + ( (eta_x x1 x3 x5) >. (sqrt (#2.0))) \/ + ( (eta_x x4 x5 x6) >. (sqrt (#2.0))))`;; + +let J_5901405= + all_forall `ineq + [((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + (square_2t0, x1, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + (( (vor_analytic_x x1 x2 x3 x4 x5 x6) <=. (#0.0)) \/ + (chi_x x5 x6 x1 x2 x3 x4 >. (#0.0) ))`;; + +let I_60314528= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, (square (#2.168))); + ((#4.0), x3, (square (#2.168))); + ((#4.0), x4, (#4.0)); + (square_2t0, x5, square_2t0); + (square_2t0, x6, square_4t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#1.16) \/ + (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0))`;; + + + +let I_603910880= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, (square (#2.168))); + ((#4.0), x3, (square (#2.168))); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + (square_2t0, x6, square_4t0) + ] + ( + ( + ( (tau_0_x x1 x2 x3 x4 x5 x6) -. ( (#0.2529) *. (dih_x x1 x2 x3 x4 x5 x6))) >. (--. (#0.266))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#1.2)) \/ + (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0))`;; + + +let J_629256313= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + (square_2t0, x5, (#8.0)); + ((#4.0), x6, square_2t0) + ] + ( + ( (vor_analytic_x x1 x2 x3 x4 x5 x6) <. (#0.0)) \/ + ( (eta_x x1 x2 x6) >. (sqrt (#2.0))) \/ + ( (eta_x x2 x3 x4) >. (sqrt (#2.0))) \/ + ( (eta_x x1 x3 x5) >. (sqrt (#2.0))) \/ + ( (eta_x x4 x5 x6) >. (sqrt (#2.0))))`;; + + +let I_644534985= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, (square (#2.168))); + ((#4.0), x3, (square (#2.168))); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + (square_2t0, x6, square_4t0) + ] + ( + ( + ( (tau_0_x x1 x2 x3 x4 x5 x6) -. ( (#0.2529) *. (dih_x x1 x2 x3 x4 x5 x6))) >. (--. (#0.2391))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#1.2)) \/ + (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0))`;; + +let I_690646028= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, (square (#2.168))); + ((#4.0), x3, (square (#2.168))); + ((#4.0), x4, square_2t0); + (square_2t0, x5, square_4t0); + ((#4.0), x6, square_2t0) + ] + ( ( (dih_x x1 x2 x3 x4 x5 x6) +. ( (#0.5) *. ( (#2.402) -. (sqrt x4)))) <. ( pi / (#2.0)) \/ + (delta_x x1 x2 x3 x4 x5 x6 < (#0.0)))`;; + +let I_69064028=I_690646028;; (* because of a typo *) + + +let J_703457064= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (anc (sqrt x1) (sqrt x2) (sqrt x6)) <. (#0.0263))`;; + +let I_723700608= + all_forall `ineq + [((square (#2.3)), x1, (#6.3001)); + ((#4.0), x2, (#6.3001)); + ((#4.0), x3, (#6.3001)); + ((#4.0), x4, (#6.3001)); + ((#4.0), x5, (#6.3001)); + ((#8.0), x6, (square (#3.02))) + ] + ( + ( + ( (tau_0_x x1 x2 x3 x4 x5 x6) -. ( (#0.2529) *. (dih_x x1 x2 x3 x4 x5 x6))) >. + (--. (#0.1787))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#1.26)) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.63)))`;; + + + + +let I_735258244= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((square (#3.2)), x4, (square (#3.2))); + + (square_2t0, x5, square_2t0); + ((#4.0), x6, (#4.0)) + ] + ( + (beta (acs ( (sqrt x1) / (#2.51))) (arclength (sqrt x1) (sqrt x3) (sqrt x5))) <. + (dih3_x x1 x2 x3 x4 x5 x6))`;; + +let J_738318844= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + (square_2t0, x4, (#8.0)); + (square_2t0, x5, (#8.0)); + ((#4.0), x6, square_2t0) + ] + ( + ( (vor_analytic_x x1 x2 x3 x4 x5 x6) <. (#0.0)) \/ + ( (eta_x x1 x2 x6) >. (sqrt (#2.0))) \/ + ( (eta_x x2 x3 x4) >. (sqrt (#2.0))) \/ + ( (eta_x x1 x3 x5) >. (sqrt (#2.0))) \/ + ( (eta_x x4 x5 x6) >. (sqrt (#2.0))))`;; + + +let I_751442360= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, (square (#2.168))); + ((#4.0), x3, (square (#2.168))); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih2_x x1 x2 x3 x4 x5 x6) >. (#0.74))`;; + +let I_757995764= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, (square (#2.23))); + ((#4.0), x3, (square (#2.23))); + ((square (#2.77)), x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, (#4.0)) + ] + ( + (beta (acs ( (sqrt x1) / (#2.77))) (arclength (sqrt x1) (sqrt x3) (sqrt x5))) <. + (dih3_x x1 x2 x3 x4 x5 x6))`;; + + +let I_821707685= + all_forall `ineq + [((#4.0), x1, (#6.3001)); + ((#4.0), x2, (square (#2.168))); + ((#4.0), x3, (square (#2.168))); + ((#4.0), x4, (#6.3001)); + ((#4.0), x5, (#6.3001)); + (square_2t0, x6, square_4t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#1.63) \/ + (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0))`;; + +let J_82950290= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, (square (#2.177303))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( (#0.31023815) +. ( (--. (#0.207045)) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + +let J_855677395= + all_forall `ineq + [((square (#2.69)), x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( ( (mu_upright_x x1 x2 x3 x4 x5 x6) +. (mu_flipped_x x1 x2 x3 x4 x5 x6)) <. + ( (vor_0_x x1 x2 x3 x4 x5 x6) +. (vor_0_x_flipped x1 x2 x3 x4 x5 x6) +. + ( (#0.02) *. ( ( pi / (#2.0)) +. (( --. ) (dih_x x1 x2 x3 x4 x5 x6))))))`;; + +let J_892806084= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( ( (vor_analytic_x x1 x2 x3 x4 x5 x6) +. + (vor_analytic_x_flipped x1 x2 x3 x4 x5 x6) +. + (vor_0_x x1 x2 x3 x4 x5 x6) +. + (( --. ) (vor_0_x_flipped x1 x2 x3 x4 x5 x6))) <=. (#0.0))`;; + +let J_906566422= + all_forall `ineq + [((square (#1.255)), x, (#2.0)) + ] + ( (crown (sqrt x)) <. (--. (#0.1378)))`;; + +let J_917032944= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( + ( (vor_analytic_x x1 x2 x3 x4 x5 x6) <. (#0.0)) \/ + ( (eta_x x1 x2 x6) >. (sqrt (#2.0))) \/ + ( (eta_x x2 x3 x4) >. (sqrt (#2.0))) \/ + ( (eta_x x1 x3 x5) >. (sqrt (#2.0))) \/ + ( (eta_x x4 x5 x6) >. (sqrt (#2.0))))`;; + +let J_984463800= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#1.874445))`;; + diff --git a/legacy/inequalities/kep_deprecated.ml b/legacy/inequalities/kep_deprecated.ml new file mode 100644 index 0000000..3409145 --- /dev/null +++ b/legacy/inequalities/kep_deprecated.ml @@ -0,0 +1,772 @@ +(* + +These are inequalities that have been withdrawn for various reasons +from kep_inequalities.ml. The main reason is that some of them are false. +If a new version of the inequalities are introduced, they should carry +a new 9-digit identification number. The numbers of the following +inequalities should be retired. + +We keep these inequalities around for reference, because some were +part of the 1998 proof. Others are here just to keep a record of what happened to them. +It may still be necessary to refer to them +sometimes. + +*) + +(* interval verification in partK.cc *) +(* LOC: 2002 k.c page 48 +17.17 Group_17 *) + +(* XXX false: + +Bound: 0.0336078908192 +Point: [6.30009999999, 3.99999999999, 3.99999999999, 4.20260782962, 7.67289999999, 7.67289999999] + +The interval arithmetic code in partK.cc was incorrectly +copied from a different inequality. Thus, this appears to +be a genuine counterexample. Reported in dcg_errata. +TCH 1/31/2008. + +*) + +let I_900212351= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((square (#2.7)), x5, (square (#2.77))); + ((square (#2.7)), x6, (square (#2.77))) + ] + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. ( (#1.798) +. ( (--. (#0.1)) *. + ( (sqrt x1) +. (sqrt x2) +. (sqrt x3))) +. ( (--. (#0.19)) + *. (sqrt x4)) +. ( (--. (#0.17)) *. ( (sqrt x5) +. (sqrt + x6)))))`;; + + + +(* XXX Appears this is false. + Check point (4,10.4329) +*) +(* This inequality agrees with what is written in SPVI-2002-Group25,p.52. + This does not agree with what appears in partK.cc, which has + right-hand-side = 0.05925 - 0.14 (y5 - sqrt8). + If we take the interval code to be the authority, we need to change + the sign of 0.14 to -0.14. + + This inequality only gets used in the proof of SPVI-2002-Prop~17.2,page52. + *) +(* interval verification in partK.cc *) + +(* +XXX false + +Bound: 0.112123545317 + +Point: [3.99999999999, 10.4328999999] + +*) + +let I_775220784= + all_forall `ineq + [((#4.0), x3, square_2t0); + ((#8.0), x5, (square (#3.23))) + ] + ( (tau_0_x (#4.0) (#4.0) x3 (#4.0) x5 (#4.0)) >. + ( (#0.05925) +. ( (#0.14) *. ( (sqrt x5) +. ( (--. (#2.0)) *. (sqrt (#2.0)))))))`;; + + + +(* interval verification in partK.cc + +LOC: 2002 k.c page 60 +Group_18.16 + +*) +(* +XXX false. This seems false. The constant term in partK.cc is wrong. +dcg_errata note added. 1/31/2008. + +Bound: 0.0109646865132 + +Point: [4, 3.99999999999, 3.99999999999, 3.99999999999, 10.2399999999, 6.30009999999] +*) +let I_292827481= + all_forall `ineq + [((#4.0), x1, (#4.0) ); + ((#4.0), x2, square_2t0); + ((#4.0), x3, (#4.0) ); + ((#4.0), x4, (#4.0) ); + ((#8.0) , x5, square (#3.2)); + (square_2t0 , x6, square_2t0) + ] + (vor_0_x x1 x2 x3 x4 x5 x6 <. --(#0.084) - ((sqrt x5 - sqrt8)*(#0.1)) ) + `;; + + + + +(* +The proof that vor_0_analytic < -1.04 pt from DCG Lemma 10.14 has been +redone. I am deprecating the inequalities for that proof, even though +they are all still correct. *) + + +(* +LOC: 2002 Form, Appendix 1, page 19 + 2002_Calc_4.1.1 + DCG Lemma 10.14, mixed quad -1.04 bound +*) +let J_69785808= + all_forall `ineq + [((#4.0), x1, square_2t0); + (square_2t0, x2, (square (#2.7))); + (square_2t0, x3, (square (#2.7))); + + ((#4.0), x4, (square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vor_analytic_x x1 x2 x3 x4 x5 x6) <. + ( (--. (#1.04)) *. pt)) \/ + ( (eta_x x2 x3 x4) >. (sqrt (#2.0))))`;; + + +(* +LOC: 2002 Form, Appendix 1, page 19 + 2002_Calc_4.1.1 + DCG Lemma 10.14, mixed quad -1.04 bound +*) +let J_104677697= + all_forall `ineq + [((#4.0), x1, square_2t0); + (square_2t0, x2, (square (#2.7))); + (square_2t0, x3, (square (#2.7))); + + ((#4.0), x4, (square (#3.2))); + ((#4.0), x5, square_2t0); + (square_2t0, x6, (square (#2.7))) + ] + ( + ( (vor_analytic_x x1 x2 x3 x4 x5 x6) <. ( (--. (#1.04)) *. pt)) \/ + ( (eta_x x2 x3 x4) >. (sqrt (#2.0))) \/ + ( (eta_x x1 x2 x6) >. (sqrt (#2.0))))`;; + + + + + + + +(* +LOC: 2002 Form, Appendix 1, page 19 + 2002_Calc_4.1.2 + DCG Lemma 10.14, the -1.04 bound. + +WWW KX is wildly unstable as x2 and x3 approach 8. Are you sure +about these? +*) +let J_586706757= + all_forall `ineq + [((#4.0), x1, square_2t0); + (square_2t0, x2, (#8.0)); + (square_2t0, x3, (#8.0)); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (KX x1 x2 x3 x4 x5 x6) <. ( (--. (#1.04)) *. pt)) \/ + ( (eta_x x2 x3 x4) <. (sqrt (#2.0))))`;; + + + +(* +LOC: 2002 Form, Appendix 1, page 19 + 2002_Calc_4.1.2 + DCG Lemma 10.14, mixed quad -1.04 bound +*) +let J_87690094= + all_forall `ineq + [((#4.0), x1, square_2t0); + (square_2t0, x2, (#8.0)); + (square_2t0, x3, (#8.0)); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + (square_2t0, x6, (square (#2.7))) + ] + ( + ( (KX x1 x2 x3 x4 x5 x6) <. ( (--. (#1.04)) *. pt)) \/ + ( (eta_x x2 x3 x4) <. (sqrt (#2.0))) \/ + ( (eta_x x1 x2 x6) >. (sqrt (#2.0))))`;; + + + +(* +LOC: 2002 Form, Appendix 1, page 19 + 2002_Formulation_4.1.3 + DCG Lemma 10.14, mixed quad -1.04 bound +*) +let J_185703487= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + (square_2t0, x3, (square (#2.7))); + + (square_2t0, x4, (square (#2.7))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vor_analytic_x x1 x2 x3 x4 x5 x6) <. ( (--. (#0.52)) *. pt)) \/ + ( (eta_x x2 x3 x4) >. (sqrt (#2.0))))`;; + + +(* +LOC: 2002 Form, Appendix 1, page 19 + 2002_Formulation_4.1.4 + DCG Lemma 10.14, mixed quad -1.04 bound +*) +let J_441195992= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + (square_2t0, x3, (#8.0)); + + (square_2t0, x4, (#8.0)); + ((#4.0), x5, (square (#2.2))); + ((#4.0), x6, square_2t0) + ] + ( + ( (KX x1 x2 x3 x4 x5 x6) <. ( (--. (#0.52)) *. pt)) \/ + ( (eta_x x2 x3 x4) <. (sqrt (#2.0))))`;; + + +(* +LOC: 2002 Form, Appendix 1, page 19 + 2002_Formulation_4.1.5 + DCG Lemma 10.14, mixed quad -1.04 bound +*) +let J_848147403= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + (square_2t0, x3, (#8.0)); + + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (KX x1 x2 x3 x4 x5 x6) <. ( (--. (#0.31)) *. pt)) \/ + ( (eta_x x2 x3 x4) <. (sqrt (#2.0))))`;; + + +(* +LOC: 2002 Form, Appendix 1, page 20 + 2002_Formulation_4.1.6 + DCG Lemma 10.14, mixed quad -1.04 bound +*) +let J_969320489= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((square (#2.2)), x6, square_2t0) + ] + ( (mu_flat_x x1 x2 x3 x4 x5 x6) <. ( (--. (#0.21)) *. pt))`;; + + +(* +LOC: 2002 Form, Appendix 1, page 20 + 2002_Formulation_4.1.6 + DCG Lemma 10.14, mixed quad -1.04 bound +*) +let J_975496332= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((square (#2.2)), x6, square_2t0) + ] + ( (nu_x x1 x2 x3 x4 x5 x6) <. ( (--. (#0.21)) *. pt))`;; + + +(* +LOC: 2002 Form, Appendix 1, page 20 + 2002_Formulation_4.1.7 + DCG Lemma 10.14, mixed quad -1.04 bound +*) +let J_766771911= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((square (#2.2)), x5, square_2t0); + ((square (#2.2)), x6, square_2t0) + ] + ( (mu_upright_x x1 x2 x3 x4 x5 x6) <. ( (--. (#0.42)) *. pt))`;; + + + +(* + + +A number of inequalities were provisionally added in Dec 2007 to deal with the +deformation (biconnectedness problem) on page 131 of DCG. This argument was rewritten +in October 2008 for the paper "A Revision of the Proof of the Kepler Conjecture." +These provisional inequalities are now deprecated. + +They will be labeled "BICONNECTED-131". These were deprecated on Nov 2, 2008. + +*) + +(* EXPUNGE 3-CROWDED. +LOC: DCG errata : +http://flyspeck.googlecode.com/svn/trunk/dcg_errata/dcg_errata.tex +(svn 338) +Added March7,2008. + +CCC false +Bound: 0.064541497335 + +Point: [6.30010733228, 6.30007582978, 5.35475339765, 4.00000309308, 6.30007582977, 5.35475339763] + +3/10/2008, changed. octavor_analytic_x to octavor0_x + +CCC octavor_0_x is not defined. I feel like we're programming +in assembly language... + +BICONNECTED-131 + + *) + + let I_9467217686= + all_forall `ineq + [(square_2t0,x1,(#8.0)); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#4.0),x4,square_2t0); + ((#4.0),x5,square_2t0); + ((#4.0),x6,square_2t0) + ] + ((gamma_x x1 x2 x3 x4 x5 x6 < octavor0_x x1 x2 x3 x4 x5 x6 + + (#0.5)*(dih_x x1 x2 x3 x4 x5 x6) - (#0.54125)) \/ + (eta_x x1 x2 x6 > sqrt2) \/ (eta_x x1 x3 x5 > sqrt2))`;; + + + +(* EXPUNGE UPRIGHT DIAG OVER FLAT QUARTER +LOC: DCG errata : +http://flyspeck.googlecode.com/svn/trunk/dcg_errata/dcg_errata.tex +(svn 338) +Added March7,2008. +BICONNECTED-131 +It is a consequence of I_2333917810, I_8220246614. + *) +(* use monotonicity on upper end of y4. Used for y4 out to 3.2. *) + +let I_1427782443= +all_forall `ineq + [((#2.51),y1,(#2.0)* sqrt2); + ((#2.0),y2,(#2.51)); + ((#2.0),y3,(#2.51)); + ((#2.91),y4,(#2.91)); + ((#2.0),y5,(#2.51)); + ((#2.0),y6,(#2.51)) + ] + ((kappa y1 y2 y3 y4 y5 y6 < -- (#0.0201)))`;; + +(* (l42) +LOC: DCG errata : +BICONNECTED-131 +http://flyspeck.googlecode.com/svn/trunk/dcg_errata/dcg_errata.tex +(svn 338) +Added March7,2008. + *) + +(* use monotonicity on upper end of y4 *) +let I_8220246614= +all_forall `ineq + [((#2.51),y1,(#2.57)); + ((#2.0),y2,(#2.51)); + ((#2.0),y3,(#2.51)); + ((#2.91),y4,(#2.91)); + ((#2.0),y5,(#2.51)); + ((#2.0),y6,(#2.51)) + ] + ((kappa y1 y2 y3 y4 y5 y6 < -- (#0.022)))`;; + +(* (L42) +LOC: DCG errata : +BICONNECTED-131 +http://flyspeck.googlecode.com/svn/trunk/dcg_errata/dcg_errata.tex +(svn 338) +Added March7,2008. + *) + +(* use monotonicity on upper end of y4 *) + +(* +XXX false + + +Bound: 2.88750850026E~4 + +Point: [2.57000013158, 2.00000021362, 2.50999916311, 2.91, 2.5099991631, 2.00000023519] + +*) +let I_2333917810= +all_forall `ineq + [((#2.57),y1,(#2.0)*sqrt2); + ((#2.0),y2,(#2.51)); + ((#2.0),y3,(#2.51)); + ((#2.91),y4,(#2.91)); + ((#2.0),y5,(#2.51)); + ((#2.0),y6,(#2.51)) + ] + ((kappa y1 y2 y3 y4 y5 y6 < -- (#0.03)))`;; + + +(* L41e257 +LOC: DCG errata : +BICONNECTED-131 +http://flyspeck.googlecode.com/svn/trunk/dcg_errata/dcg_errata.tex +(svn 338) +Added March7,2008. + *) + +(* use monotonicity on upper end of y4 *) +let I_6863978831= +all_forall `ineq + [((#2.51),y1,(#2.57)); + ((#2.0),y2,(#2.51)); + ((#2.0),y3,(#2.51)); + ((#2.0),y4,(#2.51)); + ((#2.51),y5,(#2.51)); + ((#2.0),y6,(#2.51)) + ] + ((kappa y1 y2 y3 y4 y5 y6 < (-- (#2.0)*xi_gamma) + (#0.029)))`;; + + +(* L41e257 +LOC: DCG errata : +BICONNECTED-131 +http://flyspeck.googlecode.com/svn/trunk/dcg_errata/dcg_errata.tex +(svn 338) +Added March7,2008. + +CCC Fixed (#2.51) --> (square (#2.51)) +Bound: 0.223878304374 + +Point: [6.30010754072, 6.30009424726, 4.00000591053, 4, 4.00000591051, 6.3001] + + *) + +let I_6410186704= +all_forall `ineq + [(square_2t0,x1,square (#2.57)); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#4.0),x4,(#4.0)); + ((#4.0),x5,square_2t0); + (square_2t0,x6,square_2t0) + ] + ((dih_x x1 x2 x3 x4 x5 x6 > + dih_x (square_2t0) (square_2t0) x3 x4 x5 (square_2t0) - (#0.0084)))`;; + + +(* +BICONNECTED-131 + +CCC fixed (#2.51) -> square_2t0 +Bound: 0.194552580073 + +Point: [6.30011135252, 6.30009239209, 4.00000677596, 3.2, 4.00000677583, 6.3001] + +XXX false + +Bound: 0.0044085164046 + +Point: [6.30010017942, 4.00000040706, 6.30009980299, 3.2, 4.00000045964, 6.3001] + +*) + +let I_3008133607= +all_forall `ineq + [(square_2t0,x1,square (#2.57)); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#3.2),x4,(#3.2)); + ((#4.0),x5,square_2t0); + (square_2t0,x6,square_2t0) + ] + ((dih_x x1 x2 x3 x4 x5 x6 > + dih_x (square_2t0) (square_2t0) x3 x4 x5 (square_2t0) - (#0.0084)))`;; + +(* BICONNECTED-131 *) + +let I_5617427593= +all_forall `ineq + [(square_2t0,x1,square_2t0); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#4.0),x5,square_2t0); + ((#4.0),x6,square_2t0) + ] + ((dih_x x1 square_2t0 x3 (#4.0) x5 square_2t0 + + dih_x x1 x2 square_2t0 (square (#3.2)) square_2t0 x6 > (#3.0)) \/ + (delta_x x1 x2 x3 x4 x5 x6 < (#0.0)))`;; + + +(* type C. +LOC: DCG errata : +BICONNECTED-131 +http://flyspeck.googlecode.com/svn/trunk/dcg_errata/dcg_errata.tex +(svn 338) +Added March7,2008. + *) + +let I_2377396571= +all_forall `ineq + [((#4.0),x1,square_2t0); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + (square (#3.2),x4,square (#3.2)); + (square (#2.91),x5,square (#3.2)); + (square (#2.91),x6,square (#3.2)) + ] + (dih_x x1 x2 x3 x4 x5 x6 > (#1.2))`;; + +(* BICONNECTED-131 *) + +let I_3656545285= +all_forall `ineq + [((#4.0),x1,square_2t0); + (square_2t0,x2,square (#2.57)); + (square_2t0,x3,square (#2.57)); + ((#4.0),x4,(#4.0)); + ((#4.0),x5,square_2t0); + ((#4.0),x6,square_2t0) + ] + (dih_x x1 x2 x3 x4 x5 x6 < (#1.2))`;; + + +(* deleted from kep_ineq_bis.ml on 11/27/08 because it is false. + The proof of the lemma that used it has been completely rewritten. + This was originally for the 2008 "Revision of the Kepler Conjecture" + by Hales et al. Sec. Biconnected Graphs. *) +(* Revision, lemma:double-edge *) +(* XX FALSE *) +(* biconnected section *) +let I_8167927350= +all_forall `ineq + [ + ((square (#2.39)),x1,square_2t0); + (#4.0 ,x2,square(#2.15)); + (#4.0,x3,square(#2.15)); + (#4.0,x5,square(#2.15)); + (#4.0,x6,square(#2.15)); + ] + (dih_x x1 x2 (square_2t0) (#4.0) (#4.0) x6 + + dih_x x1 square_2t0 square_2t0 (#4.0) (#4.0) (square (#2.7)) + + dih_x x1 square_2t0 x3 (#4.0) x5 (square (#2.7)) > pi)`;; + +(* deleted from kep_ineq_bis.ml on 11/27/08 because is was used in connection + with the false inequality 8167927350 . + The proof of the lemma that used it has been completely rewritten. + This was originally for the 2008 "Revision of the Kepler Conjecture" + by Hales et al. Sec. Biconnected Graphs. *) +(* Revision, lemma:double-edge *) +(* verified by S. McLaughlin Nov 3, 2008 *) +(* biconnected section *) +let I_6040218010= +all_forall `ineq + [((square (#2.36)),x1,square_2t0); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square (#2.16)); + (square (#2.7),x4, square (#2.7)); + ((#4.0),x5,(square (#2.17))); + ((#4.0),x6,(#4.0)); + ] + (dih_x x1 x2 x3 x4 x5 x6 > pi / (#2.0) )`;; + + + +(* +LOC: Blueprint, Lemma:1.04. +This was never verified with interval arithmetic. +*) + + +let I_7710172071_GEN= + `(\ a1 a2 a3 a4. (ineq +[ +((#8.0), x, (square (#4.0)))] + (vor_0_x a4 a1 a2 (#4.0) x (#4.0) + + vor_0_x a2 a3 a4 (#4.0) x (#4.0) < -- (#1.04) * pt) \/ + delta_x a4 a1 a2 (#4.0) x (#4.0) < (#0.0) \/ + delta_x a2 a3 a4 (#4.0) x (#4.0) < (#0.0) \/ + (cross_diag_x a1 a2 a4 x (#4.0) (#4.0) a3 (#4.0) (#4.0) < sqrt8)))`;; + +(* wlog a2 <= a4 *) + +let I_7710172071_1= + all_forall (list_mk_comb( I_302085207_GEN, + [`(square (#2.3))`;`#4.0`;`#4.0`;`#4.0`]));; + +(* +CCC false. fixed square + +Bound: 0.47653139353 + +Point: [8.00000008497] + + *) + +let I_7710172071_2= + all_forall (list_mk_comb( I_302085207_GEN, + [`(square (#2.3))`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* +CCC false. fixed square + +Bound: 0.472007641148 + +Point: [8.18163440844] +*) +let I_7710172071_3= + all_forall (list_mk_comb( I_302085207_GEN, + [`(square (#2.3))`;`#4.0`;`square_2t0`;`#4.0`]));; + + +(* +CCC false. fixed square + +Bound: 1.20170306839 + +Point: [8.00000019731] +*) + +let I_7710172071_4= + all_forall (list_mk_comb( I_302085207_GEN, + [`(square (#2.3))`;`#4.0`;`square_2t0`;`square_2t0`]));; + +let I_7710172071_5= + all_forall (list_mk_comb( I_302085207_GEN, + [`(square (#2.3))`;`square_2t0`;`#4.0`;`square_2t0`]));; + +let I_7710172071_6= + all_forall (list_mk_comb( I_302085207_GEN, + [`(square (#2.3))`;`square_2t0`;`square_2t0`;`square_2t0`]));; + + +let I_7710172071_7= + all_forall (list_mk_comb( I_302085207_GEN, + [`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* CCC false. fixed square *) +let I_7710172071_8= + all_forall (list_mk_comb( I_302085207_GEN, + [`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* CCC false. fixed square *) +let I_7710172071_9= + all_forall (list_mk_comb( I_302085207_GEN, + [`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* CCC false. fixed square *) +let I_7710172071_10= + all_forall (list_mk_comb( I_302085207_GEN, + [`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +let I_7710172071_11= + all_forall (list_mk_comb( I_302085207_GEN, + [`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +let I_7710172071_12= + all_forall (list_mk_comb( I_302085207_GEN, + [`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + + +(* cases when the diagonal hits sqrt8 *) + + let I_7710172071_13= + all_forall `ineq + [(square (#2.3),x1,square_2t0); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#8.0),x4,(#8.0)); + ((#4.0),x5,square_2t0); + ((#4.0),x6,square_2t0) + ] + ((vor_0_x x1 x2 x3 x4 x5 x6 < -- (#1.04) *pt - (#0.009)))`;; + + + + let I_7710172071_14= + all_forall `ineq + [ + ((#4.0),x1,square_2t0); + (square (#2.3),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#8.0),x4,(#8.0)); + ((#4.0),x5,square_2t0); + ((#4.0),x6,square_2t0) + ] + ((vor_0_x x1 x2 x3 x4 x5 x6 < -- (#0.52) *pt))`;; + + + +(* Revision errata SPV p 182, Lemma 16.7--16.9 *) +(* complement to SPV page 183, Lemma 16.9 *) +(* deprecated 12/9/2008 *) +let I_7220423821= +all_forall `ineq + [((#4.0),x1,(square (#2.1))); + ((#4.0),x2,(square (#2.1))); + ((#4.0),x3,square_2t0); + ((#4.0),x4,square_2t0); + ((#4.0),x5,(#4.0)); + ((#8.0),x6,(#8.82)) + ] + ((vort_x x1 x2 x3 x4 x5 x6 sqrt2 + pp_m* solid_x x1 x2 x3 x4 x5 x6 - pp_b/(#2.0) < (#0.0)) \/ (vort_x x1 x2 x3 x4 x5 x6 sqrt2 > -- (pt * (#1.04))))`;; + +(* Revision errata SPV p 182, Lemma 16.7--16.9 *) +(* dim reduction on x3 *) +(* deprecated 12/9/2008 *) +let I_7188502846= +all_forall `ineq + [((#4.0),x1,(square (#2.1))); + ((#4.0),x2,(square (#2.1))); + ((#4.0),x3,(#4.0)); + ((#4.0),x4,square_2t0); + ((#4.0),x5,square_2t0); + ((#8.0),x6,(#8.82)) + ] + ((vort_x x1 x2 x3 x4 x5 x6 sqrt2 + pp_m* solid_x x1 x2 x3 x4 x5 x6 - pp_b/(#2.0) < (#0.0)) \/ (vort_x x1 x2 x3 x4 x5 x6 sqrt2 > -- (pt * (#1.04))))`;; + +(* variant of 5127197465 in a small corner f the tight spot *) +(* deprecated 12/9/08 *) +let I_1017723951= +(* 8.82 = (2.1 Sqrt[2])^2, for triangle acuteness condition *) +all_forall `ineq + [((#4.0),x1,(square (#2.1))); + ((#4.0),x2,(square (#2.1))); + ((#4.0),x3,square_2t0); + ((#4.0),x4,square_2t0); + ((#4.0),x5,square_2t0); + ((#8.0),x6,(#8.82)) + ] + (vort_x x1 x2 x3 x4 x5 x6 sqrt2 + (#0.05)*(x1 + x2 - x6) <= (#0.0))`;; + diff --git a/legacy/inequalities/kep_ineq_bis.ml b/legacy/inequalities/kep_ineq_bis.ml new file mode 100644 index 0000000..ac37ee9 --- /dev/null +++ b/legacy/inequalities/kep_ineq_bis.ml @@ -0,0 +1,484 @@ +(* Added inequalities 2008 *) + + + + + + + + +(* LOC: New proof of -1.04 bound [lemma:1.04] BLUEPRINT. +*) + +(* if any top edge is 2.43 or more, then < -1.04 pt *) + + +let I_8227268739_GEN= + `(\ a1 a2 a3 a4. (ineq +[ +((#8.0), x, (square (#4.0)))] + (vor_0_x a4 a1 a2 (#4.0) x (square (#2.43)) + + vor_0_x a2 a3 a4 (#4.0) x (#4.0) < -- (#1.04) * pt) \/ + delta_x a4 a1 a2 (#4.0) x (square (#2.43)) < (#0.0) \/ + delta_x a2 a3 a4 (#4.0) x (#4.0) < (#0.0) \/ + (cross_diag_x a1 a2 a4 x (square (#2.43)) (#4.0) a3 (#4.0) (#4.0) < sqrt8)))`;; + +let rec binexpand i j = + if (j <= 0) then [] + else [ (i mod 2)] @ (binexpand (i / 2) (j-1));; + +let mk_8227268739 i= + all_forall (list_mk_comb( I_8227268739_GEN, + map (fun j->if (j=0) then `#4.0` else `square (#2.3)`) (binexpand i 4)));; + +let [I_8227268739_0;I_8227268739_1;I_8227268739_2;I_8227268739_3; + I_8227268739_4;I_8227268739_5;I_8227268739_6;I_8227268739_7; + I_8227268739_8;I_8227268739_9;I_8227268739_10;I_8227268739_11; + I_8227268739_12;I_8227268739_13;I_8227268739_14;I_8227268739_15]= + map mk_8227268739 (0 -- 15);; + +(* if a diagonal hits sqrt8 : *) + +let I_8227268739_16= +all_forall `ineq + [((#4.0),x1,(square (#2.3))); + ((#4.0),x2,(square (#2.3))); + ((#4.0),x3,(square (#2.3))); + ((#8.0),x4,(#8.0)); + ((square (#2.43)),x5,(square (#2.43))); + ((#4.0),x6,(#4.0)) + ] + (vor_0_x x1 x2 x3 x4 x5 x6 < -- (#1.04) * pt - (#0.009))`;; + + +let I_8227268739_17= +all_forall `ineq + [((#4.0),x1,(square (#2.3))); + ((#4.0),x2,(square (#2.3))); + ((#4.0),x3,(square (#2.3))); + ((#8.0),x4,(#8.0)); + ((square (#2.43)),x5,(square (#2.43))); + ((#4.0),x6,(#4.0)) + ] + (vor_0_x x1 x2 x3 x4 x5 x6 < -- (#1.04) * pt - (#0.009))`;; + +(* 6337649845 deleted, March 21, 2008 *) + + + +(* Next one is a consequence of others and deformation. Don't prove separately. *) + +let I_8227268739_99= +all_forall `ineq + [( (#4.0),x0, square_2t0); + ( (#4.0),x1, square_2t0); + ( (#4.0),x2, square_2t0); + ( (#8.0),x3, (#8.0)); + ( (square (#2.43)),x4, square_2t0); + ( (#4.0),x4, square_2t0); + ( (#4.0),x5, square_2t0); + ( (#4.0),x6, square_2t0); + ( (#4.0),x7, square_2t0) + ] + ( -- (vor_0_x x0 x1 x2 x3 x4 x5) + - vor_0_x x1 x2 x6 x7 x8 x3 - (#1.04)* pt > (#0.0))`;; + + + +let I_1852976279= +all_forall `ineq + [( two_t0,y0, (#8.0)); + ( (#2.0),y1, two_t0); + ( (#2.0),y2, two_t0); + ( sqrt8,y3, sqrt8); + ( (#2.0),y4, two_t0); + ( (#2.0),y5, two_t0) + ] + ( -- (kappa y0 y1 y2 y3 y4 y5) - (#0.019) > (#0.0))`;; + + + +let I_8587053087= +all_forall `ineq + [( two_t0,x0, sqrt8); + ( (#2.0),x1, two_t0); + ( (#2.0),x2, two_t0); + ( (#2.0),x3, two_t0); + ( (#2.0),x4, two_t0) + ] + ( -- (kappa_dih_y y0 y1 y2 y3 y4 (#2.9)) - (#0.019) > (#0.0))`;; + + + +let I_9401027298= +all_forall `ineq + [( square_2t0,x0, (#8.0)); + ( (#4.0),x1, square_2t0); + ( (#4.0),x2, square_2t0); + ( (#4.0),x3, (square (#2.43))); + ( (#4.0),x4, (square (#3.17))); + ( (#4.0),x5, (square (#3.17))) + ] + ( -- (dih_x x0 x1 x2 x3 x4 x5) + (#2.0672) > (#0.0))`;; + + + +let I_8713619400= +all_forall `ineq + [( square_2t0,x0, (#8.0)); + ( (#4.0),x1, square_2t0); + ( (#4.0),x2, square_2t0); + ( (#4.0),x3, (#4.0)); + ( (square (#3.17)),x4, (square (#3.8))); + ( (#4.0),x5, (square (#3.17))) + ] + ( -- (dih_x x0 x1 x2 x3 x4 x5) + (#1.0743) > (#0.0))`;; + + + +let I_5815318817= +all_forall `ineq + [( square_2t0,x0, (#8.0)); + ( (#4.0),x1, square_2t0); + ( (#4.0),x2, square_2t0); + ( (#4.0),x3, (#4.0)); + ( (square (#3.17)),x4, (square (#3.8))); + ( (square (#3.17)),x5, (square (#3.8))) + ] + ( -- (dih_x x0 x1 x2 x3 x4 x5) + (#2.0672) > (#0.0))`;; + + + +let I_5817445944= +all_forall `ineq + [( square_2t0,x0, (#8.0)); + ( (#4.0),x1, square_2t0); + ( (#4.0),x2, square_2t0); + ( (#4.0),x3, square_2t0); + ( square_2t0,x4, (square (#3.17))); + ( square_2t0,x5, (square (#3.17))) + ] + ( -- (vor_0_x x0 x1 x2 x3 x4 x5) - (#0.05) > (#0.0))`;; + + + +let I_5781533845= +all_forall `ineq + [( square_2t0,x0, (#8.0)); + ( (#4.0),x1, square_2t0); + ( (#4.0),x2, square_2t0); + ( (#4.0),x3, square_2t0); + ( (#4.0),x4, square_2t0); + ( square_2t0,x5, (square (#3.17))) + ] + ( -- (vor_0_x x0 x1 x2 x3 x4 x5) + (#0.005) > (#0.0))`;; + + + +let I_3006850743= +all_forall `ineq + [( square_2t0,x0, (#8.0)); + ( (#4.0),x1, square_2t0); + ( (#4.0),x2, square_2t0); + ( (#4.0),x3, square_2t0); + ( (#4.0),x4, (#4.0)); + ( square_2t0,x5, square_2t0) + ] + ( -- (vor_0_x x0 x1 x2 x3 x4 x5) > (#0.0))`;; + + + +let I_3915426488= +all_forall `ineq + [( square_2t0,x0, (#8.0)); + ( (#4.0),x1, square_2t0); + ( (#4.0),x2, square_2t0); + ( (#4.0),x3, square_2t0); + ( (#4.0),x4, square_2t0); + ( square_2t0,x5, square_2t0); + ( (#4.0),x6, square_2t0); + ( (#4.0),x7, square_2t0); + ( (#4.0),x8, square_2t0) + ] + (( -- (vor_0_x x0 x1 x2 x3 x4 x5 ) + - vor_0_x x0 x1 x8 x6 x7 x5 - (#0.039) > (#0.0)) \/ + ( -- dih_x x0 x1 x2 x3 x4 x5 + -dih_x x0 x1 x8 x6 x7 x5+ (#2.9) > (#0.0)))`;; + + + +let I_7031224851= +all_forall `ineq + [( square_2t0,x0, (#8.0)); + ( (#4.0),x1, square_2t0); + ( (#4.0),x2, square_2t0); + ( (#4.0),x3, square_2t0); + ( (#4.0),x4, square_2t0); + ( square_2t0,x5, square_2t0); + ( (#4.0),x6, square_2t0); + ( (#4.0),x7, square_2t0); + ( (#4.0),x8, square_2t0) + ] + (( -- (vor_0_x x0 x1 x2 x3 x4 x5 ) + -vor_0_x x0 x1 x8 x6 x7 x5 - (#0.035) > (#0.0)) \/ + ( sqrt8 - crossdiag_x x0 x1 x2 x3 x4 x5 x6 x7 x8 > (#0.0)))`;; + + +(* gamma branch. *) + +let I_2172978729_1= +all_forall `ineq + [( square_2t0,x0, (#8.0)); + ( (#4.0),x1, square_2t0); + ( (#4.0),x2, square_2t0); + ( (#4.0),x3, square_2t0); + ( (#4.0),x4, square_2t0); + ( (#4.0),x5, square_2t0) + ] + (( -- (nu_x x0 x1 x2 x3 x4 x5) - (#0.0036) > (#0.0)) \/ + (pi - (#2.9) / (#2.0) - dih_x x0 x1 x2 x3 x4 x5 > (#0.0) ))`;; + + +(* vor branch. *) + +let I_2172978729_2= +all_forall `ineq + [( square_2t0,x0, (#8.0)); + ( (#4.0),x1, square_2t0); + ( (#4.0),x2, square_2t0); + ( (#4.0),x3, square_2t0); + ( (#4.0),x4, square_2t0); + ( (#4.0),x5, square_2t0) + ] + (( -- (nu_x x0 x1 x2 x3 x4 x5) - (#0.0036) > (#0.0)) \/ + (pi - (#2.9) / (#2.0) - dih_x x0 x1 x2 x3 x4 x5 > (#0.0) ) \/ + (sqrt2 - eta_x x0 x1 x5 > (#0.0) ))`;; + + + +let I_1480860075= +all_forall `ineq + [( square_2t0,x0, (#8.0)); + ( square_2t0,x1, square_2t0); + ( (#4.0),x2, square_2t0); + ( (#4.0),x3, (#4.0)); + ( (#4.0),x4, square_2t0); + ( square_2t0,x5, (square (#3.17))) + ] + ( -- (vor_0_x x0 x1 x2 x3 x4 x5) - (#0.02) > (#0.0))`;; + + + +let I_6479729349= +all_forall `ineq + [( square_2t0,x0, (#8.0)); + ( (#4.0),x1, (#4.0)); + ( (#4.0),x2, square_2t0); + ( (#4.0),x3, (#4.0)); + ( (#4.0),x4, square_2t0); + ( square_2t0,x5, (square (#3.17))) + ] + ( -- (dih_x x0 x1 x2 x3 x4 x5) + pi / (#2.0) > (#0.0))`;; + + + +let I_1741049647= +all_forall `ineq + [( square_2t0,x0, (#8.0)); + ( (#4.0),x1, square_2t0); + ( (#4.0),x2, square_2t0); + ( square_2t0,x3, (square (#3.17))); + ( (#4.0),x4, square_2t0); + ( (#4.0),x5, square_2t0) + ] + (( sqrt8 - crossdiag_x x1 x0 (#4.0) x3 (#4.0) x5 x2 (#4.0) x4 > (#0.0)) \/ + ( -- (vor_0_x x0 x1 (#4.0) (#4.0) x3 x5) + -vor_0_x x0 x2 (#4.0) (#4.0) x3 x4 + -kappa (sqrt x0) (sqrt x1) (sqrt x2) sqrt8 (sqrt x4) (sqrt x5) - (#1.04)*pt > (#0.0) ))`;; + + +(* +Inequalities added October 30, 2008 for use in "A Revision of the Kepler Conjecture" biconnected argument. +*) + +(* LOC: DCG 2006, V, page 201. Calc 17.4.4.... *) +(* See note in DCG errata. We need to check that each half is nonpositive for the proof + of Lemma DCG 16.7, page 182. + + +CCC fixed x1 x2 bounds +Bound: 0.152942962259 + +Point: [6.30009985876, 6.30009985876, 4.00000006053, 4.00000007573, 4.00000007573, 12.6001995643] + +*) +(* modified x1-interval 12/4/2008 by tch *) +(* verified by STM 12/4/2008 *) +let I_5127197465= +all_forall `ineq + [(square (#2.1),x1,(square (#2.3))); + ((#4.0),x2,(square (#2.3))); + ((#4.0),x3,square_2t0); + ((#4.0),x4,square_2t0); + ((#4.0),x5,square_2t0); + ((#8.0),x6,(#10.58)) + ] + ((vort_x x1 x2 x3 x4 x5 x6 sqrt2 < (#0.0)) \/ + (x1 + x2 < x6))`;; + + +(* Revision errata SPV p 182, Lemma 16.7--16.9 *) +(* added 12/9/2008 as an alternative to 1017723951 *) +(* dim reduction on x5 *) +let I_1551562505= +all_forall `ineq + [((#4.0),x1,(square (#2.1))); + ((#4.0),x2,(square (#2.1))); + ((#4.0),x3,square_2t0); + ((#4.0),x4,square_2t0); + ((#4.0),x5,(#4.0)); + ((#8.0),x6,(#8.82)) + ] + ((vort_x x1 x2 x3 x4 x5 x6 sqrt2 + pp_m* solid_x x1 x2 x3 x4 x5 x6 - pp_b/(#2.0) + (#0.015)*(x1 + x2 - x6) < (#0.0)))`;; + + +(* Revision errata SPV p 182, Lemma 16.7--16.9 *) +(* added 12/9/2008 as an alternative to 1017723951 *) +(* dim reduction on x6 *) +(* verified by STM 12/9/2008 *) +let I_4723770703= +all_forall `ineq + [((#4.0),x1,(square (#2.1))); + ((#4.0),x2,(square (#2.1))); + ((#4.0),x3,(square (#2.1))); + ((#4.0),x4,(square (#2.02))); + ((#4.0),x5,(square (#2.02))); + ((#8.0),x6,(#8.00)) + ] + ((vort_x x1 x2 x3 x4 x5 x6 sqrt2 + pp_m* solid_x x1 x2 x3 x4 x5 x6 - pp_b/(#2.0) + (#0.015)*(x1 + x2 - x6) < (#0.0)))`;; + +(* Revision errata SPV p 182, Lemma 16.7--16.9 *) +(* dim reduction on x3 *) +(* verified by STM 12/9/2008 *) +let I_3013446042= +all_forall `ineq + [((#4.0),x1,(square (#2.1))); + ((#4.0),x2,(square (#2.1))); + ((#4.0),x3,(#4.0)); + ((#4.0),x4,square_2t0); + ((#4.0),x5,square_2t0); + ((#8.0),x6,(#8.82)) + ] + ((vort_x x1 x2 x3 x4 x5 x6 sqrt2 + pp_m* solid_x x1 x2 x3 x4 x5 x6 - pp_b/(#2.0) + (#0.015)*(x1 + x2 - x6) < (#0.0)))`;; + + + +(* add inequality that vor_0 of quad cluster is < -1.04 pt if any vertex ht > 2.3. By dimension reduction (DCG Lemma 13.1, Lemma 12.10) +it reduces to the following cases. +This also gives vort_x ... sqrt2 < -1.04 pt. *) + +(* Revision errata *) +(* lemma:three-edge *) +(* verified by S. McLaughlin Nov 3, 2008 *) +(* biconnected section *) +let I_2799256461= +all_forall `ineq + [((#4.0),x1,square_2t0); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#4.0),x4,(#4.0)); + (square (#2.91),x5,square (#3.2)); + (square (#2.91),x6,square (#3.2)) + ] + (dih_x x1 x2 x3 x4 x5 x6 > (#0.7))`;; + +(* Revision errata *) +(* lemma:three-edge *) +(* verified by S. McLaughlin Nov 3, 2008 *) +(* biconnected section *) +let I_5470795818= +all_forall `ineq + [((#4.0),x1,square_2t0); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#4.0),x4,(#4.0)); + ((#4.0),x5,square_2t0); + ((#4.0),x6,square_2t0) + ] + (dih_x x1 x2 x3 x4 x5 x6 < (#1.4))`;; + + +(* Revision, lemma:double-cross *) +(* changed 11/25/2008 *) +(* verified by S. McLaughlin Dec 3, 2008 *) +(* biconnected section *) +let I_7431506800= +all_forall `ineq + [((#4.0),x1,(square (#2.23))); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#4.0),x4,(#4.0)); + (square(#3.2),x5,square(#3.2)); + (square_2t0,x6,square_2t0) + ] + (dih_x x1 x2 x3 x4 x5 x6 > (#0.5))`;; + +(* Revision, lemma:double-cross *) +(* changed 11/25/2008 *) +(* verified by S. McLaughlin Dec 3, 2008 *) +(* biconnected section *) +let I_5568465464 = +all_forall `ineq + [((#4.0),x1,(square (#2.23))); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + (square_2t0,x4,square_2t0); + (square(#3.2),x5,square(#3.2)); + ((#4.0),x6,square_2t0) + ] + (dih_x x1 x2 x3 x4 x5 x6 > (#0.5))`;; + +(* Revision, lemma:double-cross *) +(* verified by S. McLaughlin Nov 3, 2008 *) +(* biconnected section *) +let I_4741571261 = +all_forall `ineq + [((#4.0),x1,(square (#2.23))); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#4.0),x4,(#4.0)); + (square(#3.2),x5,square(#3.2)); + (square(#3.2),x6,square(#3.2)) + ] + (dih_x x1 x2 x3 x4 x5 x6 > (#0.8))`;; + +(* Revision, lemma:double-cross *) +(* revised 11/25/2008 *) +(* verified by S. McLaughlin Dec 3, 2008 *) +(* biconnected section *) + +let I_6915275259 = +all_forall `ineq + [((#4.0),x1,(square (#2.23))); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#4.0),x4,(#4.0)); + ((#4.0),x5,square_2t0); + ((#4.0),x6,square_2t0) + ] + (dih_x x1 x2 x3 x4 x5 x6 < (#1.3))`;; + +(* Revision, errata [DCG-p182,Lemma 16.7,SPV] *) +(* added 12/4/2008 *) +(* verified by STM 12/4/2008 *) + + let I_8990938295= + all_forall `ineq + [(square (#2.3),x1,square_2t0); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#8.0),x4,(#8.0)); + ((#4.0),x5,(#4.0)); + ((#4.0),x6,(#4.0)) + ] + ((vor_0_x x1 x2 x3 x4 x5 x6 < -- (#1.04) *pt - (#0.009)))`;; diff --git a/legacy/inequalities/kep_inequalities.ml b/legacy/inequalities/kep_inequalities.ml new file mode 100644 index 0000000..179e9f7 --- /dev/null +++ b/legacy/inequalities/kep_inequalities.ml @@ -0,0 +1,13573 @@ + + + +(* + Inequalities for the proof of the Kepler Conjecture + Jan 15, 2003 + HOL-light format. + Converted from kep_inequalities.ml CVS:1.4, + using "modify()" in "kep_inequalities_convert.ml" + + + Eventually this file will become the final authority about + the various inequalities. For now, there are still typos, + so that 2002-version of Kepler Conjecture and the + interval arithmetic C++ files have higher authority. + The C++ code inequalities have been put into the form F < = 0. + Ferguson's verifications can be obtained from + http://www.math.pitt.edu/~thales/kepler98/samf/ferguson98.tar.gz/hales/source/ +*) + +(* + Acknowledgement: I would like to thank Carole Bunting for + typing many of these inequalities in a machine readable form. +*) + + +(* + +Errata: + +Please report any errors that are found. This includes typos (such +as a typo in the 9-digit identifier for the inequality), missing inequalities, +false inequalities, incompatibilities +between the stated inequality and the interval arithmetic verification, +and incompatibilities between the stated inequality and how the inequality +is used in the proof of the Kepler Conjecture. + + + +Nov 8, 2007: Fixed the x1 bound on calc 815492935 and +729988292 (SPIV-2002 Sec. A2-A3). It should be (square_2t0,x1,(#8.0)) + +Dec 16, 2007: Fixed the direction of inequalities in 690626704_* + +*) + +(* Files for 1998 interval verification: +partK.cc = http://www.math.pitt.edu/~thales/kepler98/interval/partK.cc + 533270809 appears in partK.cc but not below. + 353116995 appears in partK.cc but not below. +part3.cc = http://www.math.pitt.edu/~thales/kepler98/interval/PART3/part3.c +part3a.cc +part3more.c + +*) + + + +(* Search for LOC: to find the location of inequalities + in preprint. + + The order of the inequalities is from last paper to first: + Kepler Conjecture: k.c. + IV. + III. + II. (a couple that are needed) + I. (one? inequality) + Form. + V +*) + +(* CONSTANT LIST: + +BIT0* +BIT1* +COND* +CONS* +D31 +D32 +D33 +D41 +D42 +D51 +DECIMAL* +KX +LET* +LET_END* +NUMERAL* +Z32 +Z33 +Z41 +Z42 +_0* +acs* +anc +arclength +beta +chi_x +cos* +cross_diag_x +crown +delta_x +deriv +deriv2 +dih2_x +dih3_x +dihR +dih_x +doct +eta_x +gamma_x +ineq +kappa +mu_flat_x +mu_flipped_x +mu_upright_x +nu_gamma_x +nu_x +octa_x +octavor0_x +octavor_analytic_x +overlap_f +pi* +pi_prime_sigma +pi_prime_tau +pt +quo_x +rad2_x +s5 +sigma1_qrtet_x +sigma32_qrtet_x +sigma_qrtet_x +sigmahat_x +sol_x +sqrt* +sqrt2 +sqrt8 +square +square_2t0 +square_4t0 +t0 +t5 +tauA_x +tauC0_x +tauVt_x +tau_0_x +tau_analytic_x +tau_sigma_x +tauhat_x +tauhatpi_x +taumu_flat_x +taunu_x +two_t0 +ups_x +v0x +v1x +vorA_x +vorC0_x +vorC_x +vor_0_x +vor_0_x_flipped +vor_analytic_x +vor_analytic_x_flipped +vort_x +xi'_gamma +xiV + + + +*) + +(* + GENERAL NOTES: +*) + +(* + 1. FERGUSON +*) + +(* + Many of the original interval arithmetic verifications + were completed by Sam Ferguson. The original 1998 proof + (available at the arXiv) + contains details about which inequalities were verified by him. +*) + +(* + 2. EQUALITY +*) + +(* +In general, to the greatest extent possible, we express each +inequality as a strict inequality on a compact domain. There are, +however, a few inequalities that are not strict, such as the bound +of $1\,\pt$ on the score of a quasi_regular tetrahedron or the +bound of $0.0$ on the score of a quad cluster. (These particular +sharp bounds appear in the proof of the local optimality of the +face_centered cubic and hexagonal close packings.) +*) + +(* + The most significant are the bounds +$\sigma\le\pt$ on quasi_regular tetrahedra and $\sigma\le0$ on +quad_clusters. The fact that these are attained for the regular cases +with edge lengths(#2.0) and diagonal $2\sqrt{2.0}$ on the quad_cluster +and for +no other cases gives the bound $\pi/\sqrt{18.0}$ on density and the local +optimality of the fcc and hcp packings. +*) + +(* +Another place where we have allowed equality to be obtained is +with $\tau_0\ge0$ for quasi_regular simplices. +*) + +(* +There are also a few less significant cases where an inequality is +sharp. For example, + $$\tau_0(2t_0,2,2,x,2,2)\ge0,\quad\vor_0(2t_0,2,2,x,2,2)\le0$$ +for special simplices satisfying $x\in[2\sqrt{2.0},3.2]$. Also, equality +occurs in Lemma~\ref{lemma:pass_makes_quarter} and +Lemma~\ref{lemma:neg_orient_quad}. +*) + +(* +Equality is attained in \calc{} iff $S$ is a regular_tetrahedron +of edge_length $2.0$. Equality is attained in \calc{346093004}, +\calc{40003553}, and \calc{522528841} \calc{892806084} iff the +simplex has five edges of length $2.0$ and one edge of length +$\sqrt8$. +*) + +(* +Search for SKIP to find sections skipped. +Search for LOC: to find preprint locations. +*) + +(* avoid Jordan/parse_ext_override_interface.ml *) + +(* real number operations *) +parse_as_infix("+.",(16,"right")); +parse_as_infix("-.",(18,"left")); +parse_as_infix("*.",(20,"right")); +parse_as_infix("**.",(24,"left")); +parse_as_infix("<.",(12,"right")); +parse_as_infix("<=.",(12,"right")); +parse_as_infix(">.",(12,"right")); +parse_as_infix(">=.",(12,"right")); +override_interface("+.",`real_add:real->real->real`); +override_interface("-.",`real_sub:real->real->real`); +override_interface("*.",`real_mul:real->real->real`); +override_interface("**.",`real_pow:real->num->real`); +(* boolean *) +override_interface("<.",`real_lt:real->real->bool`); +override_interface("<=.",`real_le:real->real->bool`); +override_interface(">.",`real_gt:real->real->bool`); +override_interface(">=.",`real_ge:real->real->bool`); +(* unary *) +override_interface("--.",`real_neg:real->real`); +override_interface("&.",`real_of_num:num->real`); +override_interface("||.",`real_abs:real->real`);; + + +(* XXX Note: please don't write comments in HOL Light terms. + * this does not work. *) + +(* +LOC: 2002 k.c page 42. +17.1 Group_1 +*) + +(* interval verification in partK.cc *) +(* moved 572068135 to inequality_spec.ml *) + + + + + +(* interval verification in partK.cc *) +(* moved 723700608 to inequality_spec.ml *) + + + + + +(* interval verification in partK.cc *) +(* moved 560470084 to inequality_spec.ml *) + + + + +(* interval verification in partK.cc *) +(* moved 535502975 to inequality_spec.ml *) + + + + +(* + +LOC: 2002 k.c page 42 +17.2 Group_2 +*) + + + +(* let I_821_707685= *) +(* all_forall `ineq *) +(* [((#4.0), x1, (#6.3001)); *) +(* ((#4.0), x2, (square (#2.168))); *) +(* ((#4.0), x3, (square (#2.168))); *) +(* ((#4.0), x4, (#6.3001)); *) +(* ((#4.0), x5, (#6.3001)); *) +(* (square_2t0, x6, square_4t0) *) +(* ] *) +(* ( (dih_x x1 x2 x3 x4 x5 x6) <. (#1.63))`;; *) + +(* Added delta_x > 0, Jan 2008 *) +(* interval verification by Ferguson *) +(* moved 821707685 to inequality_spec.ml *) + + +(* interval verification by Ferguson *) +(* moved 115383627 to inequality_spec.ml *) + + +(* interval verification by Ferguson *) +(* moved 576221766 to inequality_spec.ml *) + + + +(* interval verification by Ferguson *) +(* moved 122081309 to inequality_spec.ml *) + + + +(* interval verification by Ferguson *) +(* moved 644534985 to inequality_spec.ml *) + + + +(* interval verification by Ferguson *) +(* moved 467530297 to inequality_spec.ml *) + + + +(* interval verification by Ferguson *) +(* moved 603910880 to inequality_spec.ml *) + + +(* interval verification by Ferguson *) +(* moved 135427691 to inequality_spec.ml *) + + +(* interval verification by Ferguson *) +(* moved 60314528 to inequality_spec.ml *) + + +(* interval verification by Ferguson *) +(* moved 312132053 to inequality_spec.ml *) + + + + + +(* + +LOC: 2002 k.c page 42 +17.3 Group_3 +*) + +(* moved 751442360 to inequality_spec.ml *) + + + + + +let I_893059266= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, (square (#2.168))); + ((#4.0), x3, (square (#2.168))); + ((#4.0), x4, square_2t0); + (square_2t0, x5, (square (#3.488))); + ((#4.0), x6, square_2t0) + ] + ( + ( + ( ((tau_0_x x1 x2 x3 x4 x5 x6) ) -. ( (#0.2529) *. (dih_x x1 x2 x3 x4 x5 x6))) >. + (--. (#0.2391))) \/ + ( (delta_x x5 (#4.0) (#4.0) (#8.0) square_2t0 x6) <. (#0.0)))`;; + + + +(* +Added delta constraint, 3/9/08 +*) + +(* mistyped as 69064028 *) +(* moved 69064028 to inequality_spec.ml *) + + + + +(* + +LOC: 2002 k.c page 42 +17.4 Group_4 +*) + + +(* interval verification in partK.cc *) +let I_161665083= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((square (#3.2)), x4, (square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.78)) \/ + ( ( (sqrt x2) +. (sqrt x3)) >. (#4.6)))`;; + + + + +(* + +LOC: 2002 k.c page 42-43 +17.5 Group_5 +*) + + + +(* interval verification in partK.cc *) +let I_867513567_1= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (dih2_x x1 x2 x3 x4 x5 x6)) +. ( (#0.35) *. (sqrt x2)) +. ( (--. (#0.15)) *. + (sqrt x1)) +. ( (--. (#0.15)) *. (sqrt x3)) +. ( (#0.7022) *. (sqrt x5)) +. ( (--. (#0.17)) *. + (sqrt x4))) >. (--. (#0.0123)))`;; + + + + + +let I_867513567_2= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (dih2_x x1 x2 x3 x4 x5 x6) +. ( (--. (#0.13)) *. (sqrt x2)) +. ( (#0.631) *. + (sqrt x1)) +. ( (#0.31) *. (sqrt x3)) +. ( (--. (#0.58)) *. (sqrt x5)) +. ( (#0.413) *. + (sqrt x4)) +. ( (#0.025) *. (sqrt x6))) >. (#2.63363))`;; + + + +let I_867513567_3= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) +. ( (#0.714) *. (sqrt x1)) +. ( (--. (#0.221)) *. + (sqrt x2)) +. ( (--. (#0.221)) *. (sqrt x3)) +. ( (#0.92) *. (sqrt x4)) +. ( (--. (#0.221)) *. + (sqrt x5)) +. ( (--. (#0.221)) *. (sqrt x6))) >. (#0.3482))`;; + + + + +let I_867513567_4= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (dih_x x1 x2 x3 x4 x5 x6) +. ( (--. (#0.315)) *. (sqrt x1)) +. ( (#0.3972) *. + (sqrt x2)) +. ( (#0.3972) *. (sqrt x3)) +. ( (--. (#0.715)) *. (sqrt x4)) +. ( (#0.3972) *. + (sqrt x5)) +. ( (#0.3972) *. (sqrt x6))) >. (#2.37095))`;; + + +(* interval verification by Ferguson *) +let I_867513567_5= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (sol_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.187)) *. (sqrt x1)) +. ( (--. (#0.187)) *. + (sqrt x2)) +. ( (--. (#0.187)) *. (sqrt x3)) +. ( (#0.1185) *. (sqrt x4)) +. ( (#0.479) *. + (sqrt x5)) +. ( (#0.479) *. (sqrt x6))) >. (#0.437235))`;; + + +(* interval verification by Ferguson *) +let I_867513567_6= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (sol_x x1 x2 x3 x4 x5 x6) +. ( (#0.488) *. (sqrt x1)) +. ( (#0.488) *. + (sqrt x2)) +. ( (#0.488) *. (sqrt x3)) +. ( (--. (#0.334)) *. (sqrt x5)) +. ( (--. (#0.334)) *. + (sqrt x6))) >. (#2.244))`;; + + + +let I_867513567_7= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (sigmahat_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.145)) *. (sqrt x1)) +. ( (--. (#0.081)) *. + (sqrt x2)) +. ( (--. (#0.081)) *. (sqrt x3)) +. ( (--. (#0.133)) *. (sqrt x5)) +. ( (--. (#0.133)) *. + (sqrt x6))) >. (--. (#1.17401)))`;; + +let I_867513567_8= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (sigmahat_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.12)) *. (sqrt x1)) +. ( (--. (#0.081)) *. + (sqrt x2)) +. ( (--. (#0.081)) *. (sqrt x3)) +. ( (--. (#0.113)) *. (sqrt x5)) +. ( (--. (#0.113)) *. + (sqrt x6)) +. ( (#0.029) *. (sqrt x4))) >. (--. (#0.94903)))`;; + + + +let I_867513567_9= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (sigmahat_x x1 x2 x3 x4 x5 x6) +. ( (#0.153) *. (sqrt x4)) +. ( (#0.153) *. + (sqrt x5)) +. ( (#0.153) *. (sqrt x6))) <. (#1.05382))`;; + +let I_867513567_10= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (sigmahat_x x1 x2 x3 x4 x5 x6) +. ( (#0.419351) *. (sol_x x1 x2 x3 x4 x5 x6)) +. ( (#0.19) *. + (sqrt x1)) +. ( (#0.19) *. (sqrt x2)) +. ( (#0.19) *. (sqrt x3))) <. (#1.449))`;; + + +let I_867513567_11= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (sigmahat_x x1 x2 x3 x4 x5 x6) +. ( (#0.419351) *. (sol_x x1 x2 x3 x4 x5 x6))) <. + ( (--. (#0.01465)) +. ( (#0.0436) *. (sqrt x5)) +. ( (#0.436) *. (sqrt x6)) +. ( (#0.079431) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + +let I_867513567_12= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigmahat_x x1 x2 x3 x4 x5 x6) <. (#0.0114))`;; + + +let I_867513567_13= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (tauhat_x x1 x2 x3 x4 x5 x6) >. ( (#1.019) *. pt))`;; + + +(* + +LOC: 2002 k.c page 43 +17.6 Group_6 +*) + + +(* let I_498839271_1= *) +(* all_forall `ineq *) +(* [(square_2t0, x1, (#8.0)); *) +(* ((#4.0), x2, square_2t0); *) +(* ((#4.0), x3, square_2t0); *) +(* ((#4.0), x4, square_2t0); *) +(* ((#4.0), x5, square_2t0); *) +(* ((#4.0), x6, square_2t0) *) +(* ] *) +(* ( (sqrt x1) >. (#2.51))`;; *) + + + + +(* let I_498839271_2= *) +(* all_forall `ineq *) +(* [(square_2t0, x1, (#8.0)); *) +(* ((#4.0), x2, square_2t0); *) +(* ((#4.0), x3, square_2t0); *) +(* ((#4.0), x4, square_2t0); *) +(* ((#4.0), x5, square_2t0); *) +(* ((#4.0), x6, square_2t0) *) +(* ] *) +(* ( (sqrt x1) <=. ( (#2.0) *. (sqrt (#2.0))))`;; *) + + + +(* interval verification in partK.cc *) + +(* CCC Shouldn't this say > rather than >= ? + I'm changing it... + Yes, that's right. +*) +let I_498839271_3= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (dih_x x1 x2 x3 x4 x5 x6) +. ( (--. (#0.636)) *. (sqrt x1)) +. ( (#0.462) *. (sqrt x2)) +. ( (#0.462) *. (sqrt x3)) +. + ( (--. (#0.82)) *. (sqrt x4)) +. ( (#0.462) *. (sqrt x5)) +. ( (#0.462) *. (sqrt x6))) >. (#1.82419))`;; + + +(* interval verification in partK.cc *) +let I_498839271_4= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) +. ( (#0.55) *. (sqrt x1)) +. ( (--. (#0.214)) *. (sqrt x2)) +. ( (--. (#0.214)) *. (sqrt x3)) +. + ( (#1.24) *. (sqrt x4)) +. ( (--. (#0.214)) *. (sqrt x5)) +. ( (--. (#0.214)) *. (sqrt x6))) >. (#0.75281))`;; + +(* interval verification in partK.cc *) +let I_498839271_5= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (dih2_x x1 x2 x3 x4 x5 x6) +. ( (#0.4) *. (sqrt x1)) +. ( (--. (#0.15)) *. (sqrt x2)) +. ( (#0.09) *. (sqrt x3)) +. + ( (#0.631) *. (sqrt x4)) +. ( (--. (#0.57)) *. (sqrt x5)) +. ( (#0.23) *. (sqrt x6))) >. (#2.5481))`;; + + +(* interval verification in partK.cc *) +let I_498839271_6= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (dih2_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.454)) *. (sqrt x1)) +. ( (#0.34) *. (sqrt x2)) +. ( (#1.54) *. (sqrt x3)) +. + ( (--. (#0.346)) *. (sqrt x4)) +. ( (#0.805) *. (sqrt x5))) >. (--. (#0.3429)))`;; + + +(* interval verification in partK.cc *) +let I_498839271_7= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (dih3_x x1 x2 x3 x4 x5 x6) +. ( (#0.4) *. (sqrt x1)) +. ( (--. (#0.15)) *. (sqrt x3)) +. ( (#0.09) *. (sqrt x2)) +. + ( (#0.631) *. (sqrt x4)) +. ( (--. (#0.57)) *. (sqrt x6)) +. ( (#0.23) *. (sqrt x5))) >. (#2.5481))`;; + + + + +(* Seems to be wrong : check at + (8, 4.77946715116, 4.0, 6.30009999999, 6.30009999999, 4) + STM changed from 0.364 + 1/20/2008. This seems to fix the problem. The + left hand side evaluates to -0.342688 > -0.3429. +*) +(* interval verification in partK.cc *) +let I_498839271_8= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (dih3_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.454)) *. (sqrt x1)) +. ( (#0.34) *. (sqrt x3)) +. ( (#0.154) *. (sqrt x2)) +. + ( (--. (#0.346)) *. (sqrt x4)) +. ( (#0.805) *. (sqrt x6))) >. (--. (#0.3429)))`;; + + +(* interval verification in partK.cc *) +let I_498839271_9= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (sol_x x1 x2 x3 x4 x5 x6) +. ( (#0.065) *. (sqrt x2)) +. ( (#0.065) *. (sqrt x3)) +. ( (#0.061) *. (sqrt x4)) +. + ( (--. (#0.115)) *. (sqrt x5)) +. ( (--. (#0.115)) *. (sqrt x6))) >. (#0.2618))`;; + + +(* interval verification in partK.cc *) +let I_498839271_10= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (sol_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.293)) *. (sqrt x1)) +. ( (--. (#0.03)) *. (sqrt x2)) +. ( (--. (#0.03)) *. (sqrt x3)) +. + ( (#0.12) *. (sqrt x4)) +. ( (#0.325) *. (sqrt x5)) +. ( (#0.325) *. (sqrt x6))) >. (#0.2514))`;; + + +(* interval verification in partK.cc *) +let I_498839271_11= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (nu_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.0538)) *. (sqrt x2)) +. ( (--. (#0.0538)) *. (sqrt x3)) +. + ( (--. (#0.083)) *. (sqrt x4)) +. ( (--. (#0.0538)) *. (sqrt x5)) +. ( (--. (#0.0538)) *. (sqrt x6))) >. (--. (#0.5995)))`;; + +(* interval verification in partK.cc *) +let I_498839271_12= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (nu_x x1 x2 x3 x4 x5 x6) >=. (#0.0))`;; + + +(* interval verification in partK.cc *) +let I_498839271_13= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (taunu_x x1 x2 x3 x4 x5 x6) +. ( (--. (#0.5945)) *. pt)) >. (#0.0))`;; + + + + +(* + +LOC: 2002 k.c page 45 +17.7 Group_7 +*) + + +(* interval verification in partK.cc *) +let I_319046543_1= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sqrt x1) <. (#2.696))`;; + + + + +let I_319046543_2= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (dih_x x1 x2 x3 x4 x5 x6) +. ( (--. (#0.49)) *. (sqrt x1)) +. ( (#0.44) *. (sqrt x2)) +. ( (#0.44) *. (sqrt x3)) +. + ( (--. (#0.82)) *. (sqrt x4)) +. ( (#0.44) *. (sqrt x5)) +. ( (#0.44) *. (sqrt x6))) >. (#2.0421))`;; + + + +let I_319046543_3= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) +. ( (#0.495) *. (sqrt x1)) +. ( (--. (#0.214)) *. (sqrt x2)) +. ( (--. (#0.214)) *. (sqrt x3)) +. + ( (#1.05) *. (sqrt x4)) +. ( (--. (#0.214)) *. (sqrt x5)) +. ( (--. (#0.214)) *. (sqrt x6))) >. (#0.2282))`;; + + + +let I_319046543_4= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (dih2_x x1 x2 x3 x4 x5 x6) +. ( (#0.38) *. (sqrt x1)) +. ( (--. (#0.15)) *. (sqrt x2)) +. ( (#0.09) *. (sqrt x3)) +. + ( (#0.54) *. (sqrt x4)) +. ( (--. (#0.57)) *. (sqrt x5)) +. ( (#0.24) *. (sqrt x6))) >. (#2.3398))`;; + + + +let I_319046543_5= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (dih2_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.375)) *. (sqrt x1)) +. ( (#0.33) *. (sqrt x2)) +. ( (#0.11) *. (sqrt x3)) +. + ( (--. (#0.36)) *. (sqrt x4)) +. ( (#0.72) *. (sqrt x5)) +. ( (#0.034) *. (sqrt x6))) >. (--. (#0.36135)))`;; + + +let I_319046543_6= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (sol_x x1 x2 x3 x4 x5 x6) +. ( (#0.42) *. (sqrt x1)) +. ( (#0.165) *. (sqrt x2)) +. ( (#0.165) *. (sqrt x3)) +. + ( (--. (#0.06)) *. (sqrt x4)) +. ( (--. (#0.135)) *. (sqrt x5)) +. ( (--. (#0.135)) *. (sqrt x6))) >. (#1.479))`;; + + +let I_319046543_7= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (sol_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.265)) *. (sqrt x1)) +. ( (--. (#0.06)) *. (sqrt x2)) +. ( (--. (#0.06)) *. (sqrt x3)) +. + ( (#0.124) *. (sqrt x4)) +. ( (#0.296) *. (sqrt x5)) +. ( (#0.296) *. (sqrt x6))) >. (#0.0997))`;; + + + +let I_319046543_8= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (nu_x x1 x2 x3 x4 x5 x6)) +. ( (#0.112) *. (sqrt x1)) +. ( (--. (#0.142)) *. (sqrt x2)) +. ( (--. (#0.142)) *. (sqrt x3)) +. + ( (--. (#0.16)) *. (sqrt x4)) +. ( (--. (#0.074)) *. (sqrt x5)) +. ( (--. (#0.074)) *. (sqrt x6))) >. (--. (#0.9029)))`;; + + + +let I_319046543_9= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (nu_x x1 x2 x3 x4 x5 x6) +. ( (#0.07611) *. (dih_x x1 x2 x3 x4 x5 x6))) <. (#0.11))`;; + + + +(* +Counterexample to +Bound: 0.855729929143 +Point: [6.30009999999, 5.76256763219, 6.30009999999, 6.30009999999, 6.30009999999, 5.92418597238] + +There is a sign error in the statement of the inequality +in SPVI2002:page44. It should be -nu_gamma_x. +A note has been added to the dcg_errata (even though it is not an error there). + +The interval arithmetic file partK.c (1998) states it correctly. +*) +let I_319046543_10= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + (( + ((--. (nu_gamma_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.015)) *. (sqrt x1)) +. ( (--. (#0.16)) *. ( (sqrt x2) +. (sqrt x3) +. (sqrt x4))) +. + ( (--. (#0.0738)) *. ( (sqrt x5) +. (sqrt x6))) ) >. (--. (#1.29285))) + \/ (sqrt2 <. (eta_x x1 x2 x6) ))`;; + + + + +let I_319046543_11= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (taunu_x x1 x2 x3 x4 x5 x6) +. ( (--. (#0.07106)) *. (dih_x x1 x2 x3 x4 x5 x6))) >. (--. (#0.06429)))`;; + + + + +let I_319046543_12= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (taunu_x x1 x2 x3 x4 x5 x6) >. (#0.0414))`;; + + + +(* + LOC: 2002 k.c page 44 + Remark (#17.1) + + From text: + +In connection with the Inequality (I_319046543_3), we +occasionally use the stronger constant $0.2345$ instead of +$0.2282$. To justify this constant, we have checked using +interval arithmetic that the bound $0.2345$ holds if $y_1\le2.68$ +or $y_4\le2.475$. Further interval calculations show that the +anchored simplices can be erased if they share an upright diagonal +with such a quarter. + +*) + + +let I_319046543_13= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( + ( (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) +. ( (#0.495) *. (sqrt x1)) +. ( (--. (#0.214)) *. (sqrt x2)) +. ( (--. (#0.214)) *. (sqrt x3)) +. + ( (#1.05) *. (sqrt x4)) +. ( (--. (#0.214)) *. (sqrt x5)) +. ( (--. (#0.214)) *. (sqrt x6))) >. (#0.2345)) \/ + ( (sqrt x1) >. (#2.68)))`;; + + + + +let I_319046543_14= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( + ( (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) +. ( (#0.495) *. (sqrt x1)) +. ( (--. (#0.214)) *. (sqrt x2)) +. ( (--. (#0.214)) *. (sqrt x3)) +. + ( (#1.05) *. (sqrt x4)) +. ( (--. (#0.214)) *. (sqrt x5)) +. ( (--. (#0.214)) *. (sqrt x6))) >. (#0.2345)) \/ + ( (sqrt x4) >. (#2.475)))`;; + + + + + +(* + +LOC: 2002 k.c page 44--45 +17.8 Group_8 +*) + +(* + The following comment about Group_8 is copied from + KC_2002_17.8_page44_group8. +*) + +(* + We give lower and upper bounds on dihedral angles. The domains that we + list are not disjoint. In general we consider an edge as belonging to + the most restrictive domain that the information of the following charts + permit us to conclude that it lies in. +*) + + + +(* interval verification by Ferguson *) +let I_853728973_1= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.153))`;; + + + + +(* interval verification by Ferguson *) +let I_853728973_2= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#2.28))`;; + + + + + +(* interval verification by Ferguson *) +(* Uses monotonicity reduction in x4 variable *) +let I_853728973_3= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.32))`;; + + + + +(* interval verification by Ferguson *) +(* By definition dih <= pi, so there is no need for intervals here *) + +(* +let I_853728973_4= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, square_4t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. ( (#2.0) *. pi))`;; +*) + + + +(* interval verification by Ferguson *) +let I_853728973_5= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + (square_2t0, x6, (#8.0)) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#0.633))`;; + + + + +(* interval verification by Ferguson *) +let I_853728973_6= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + (square_2t0, x6, (square (#3.02))) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#1.624))`;; + + + + + +(* interval verification by Ferguson *) +let I_853728973_7= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + (square_2t0, x6, (#8.0)) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.033))`;; + + + + +(* interval verification by Ferguson *) +let I_853728973_8= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + (square_2t0, x6, (#8.0)) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#1.929))`;; + + + + + +(* interval verification by Ferguson *) +let I_853728973_9= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, square_4t0); + ((#4.0), x5, square_2t0); + (square_2t0, x6, (#8.0)) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.033))`;; + + + + +(* interval verification by Ferguson *) +let I_853728973_10= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, square_4t0); + ((#4.0), x5, square_2t0); + (square_2t0, x6, (#8.0)) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. ( (#2.0) *. pi))`;; + + + + +(* interval verification by Ferguson *) +let I_853728973_11= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, square_4t0); + ((#4.0), x5, square_2t0); + (square_2t0, x6, (#8.0)) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.259))`;; + + + + +(* interval verification by Ferguson *) +let I_853728973_12= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, square_4t0); + ((#4.0), x5, square_2t0); + (square_2t0, x6, (#8.0)) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. ( (#2.0) *. pi))`;; + + + + + +(* interval verification by Ferguson *) +let I_853728973_13= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#0.817))`;; + + + + +(* interval verification by Ferguson *) +let I_853728973_14= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + (square_2t0, x5, (square (#3.02))); + (square_2t0, x6, (square (#3.02))) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#1.507))`;; + + + + +(* interval verification by Ferguson *) +let I_853728973_15= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.07))`;; + + + + +(* interval verification by Ferguson *) +let I_853728973_16= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#1.761))`;; + + + + +(* interval verification by Ferguson *) +let I_853728973_17= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, square_4t0); + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.07))`;; + + + + +(* interval verification by Ferguson *) +let I_853728973_18= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, square_4t0); + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. ( (#2.0) *. pi))`;; + + + + +(* interval verification by Ferguson *) +let I_853728973_19= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, square_4t0); + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.23))`;; + + + + +(* interval verification by Ferguson *) +let I_853728973_20= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, square_4t0); + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. ( (#2.0) *. pi))`;; + + + + +(* interval verification by Ferguson *) +let I_853728973_21= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#0.956))`;; + + + +(* interval verification by Ferguson *) +let I_853728973_22= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#2.184))`;; + + + + +(* interval verification by Ferguson *) +let I_853728973_23= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.23))`;; + + + + + + +(* interval verification by Ferguson *) +(* Uses monotonicity in the x4 variable *) + +let I_853728973_25= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.23))`;; + + + + +(* interval verification by Ferguson *) +(* Uses monotonicity in the x4 variable *) + +let I_853728973_27= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.416))`;; + +(* interval verification by Ferguson *) +let I_853728973_29= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + (square_2t0, x3, (#8.0)); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#0.633))`;; + + + + +(* interval verification by Ferguson *) +let I_853728973_30= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + (square_2t0, x3, (#8.0)); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#1.624))`;; + + + + +(* interval verification by Ferguson *) +let I_853728973_31= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + (square_2t0, x3, (#8.0)); + (square_2t0, x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.033))`;; + + + + +(* interval verification by Ferguson *) +let I_853728973_32= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + (square_2t0, x3, (#8.0)); + (square_2t0, x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. ( (#2.0) *. pi))`;; + +(* interval verification by Ferguson *) +let I_853728973_34= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + (square_2t0, x3, (#8.0)); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + (square_2t0, x6, (#8.0)) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#1.381))`;; + + + +(* interval verification by Ferguson *) +let I_853728973_35= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + (square_2t0, x3, (#8.0)); + (square_2t0, x4, square_2t0); + ((#4.0), x5, square_2t0); + (square_2t0, x6, (#8.0)) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#0.777))`;; + + + + +(* interval verification by Ferguson *) +let I_853728973_36= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + (square_2t0, x3, (#8.0)); + (square_2t0, x4, square_2t0); + ((#4.0), x5, square_2t0); + (square_2t0, x6, (#8.0)) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. ( (#2.0) *. pi))`;; + + +(* + +LOC: 2002 k.c page 45--46 +17.9 Group_9 +*) + + + +(* interval verification by Ferguson *) +(* +Uses monotonoicity in the x4 variable. +*) +let I_529738375_1= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (dih_x x1 x2 x3 x4 x5 x6) +. ( (--. (#0.372)) *. (sqrt x1)) +. ( (#0.465) *. (sqrt x2)) +. ( (#0.465) *. (sqrt x3)) +. + ( (#0.465) *. (sqrt x5)) +. ( (#0.465) *. (sqrt x6))) >. (#4.885))`;; + + + + +(* interval verification by Ferguson *) +let I_529738375_2= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + (square_2t0, x6, (#8.0)) + ] + ( + ( ( (#0.291) *. (sqrt x1)) +. ( (--. (#0.393)) *. (sqrt x2)) +. ( (--. (#0.586)) *. (sqrt x3)) +. ( (#0.79) *. (sqrt x4)) +. + ( (--. (#0.321)) *. (sqrt x5)) +. ( (--. (#0.397)) *. (sqrt x6)) +. (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) ) <. (--. (#2.47277)))`;; + + +(* interval verification by Ferguson *) +let I_529738375_3= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, square_4t0); + ((#4.0), x5, square_2t0); + (square_2t0, x6, (#8.0)) + ] + ( + ( ( (#0.291) *. (sqrt x1)) +. ( (--. (#0.393)) *. (sqrt x2)) +. ( (--. (#0.586)) *. (sqrt x3)) +. + ( (--. (#0.321)) *. (sqrt x5)) +. ( (--. (#0.397)) *. (sqrt x6)) +. (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) ) <. (--. (#4.45567)))`;; + + + +(* interval verification by Ferguson *) +let I_529738375_4= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, square_4t0); + ((#4.0), x5, square_2t0); + (square_2t0, x6, (#8.0)) + ] + ( + ( ( (#0.291) *. (sqrt x1)) +. ( (--. (#0.393)) *. (sqrt x2)) +. ( (--. (#0.586)) *. (sqrt x3)) +. + ( (--. (#0.321)) *. (sqrt x5)) +. ( (--. (#0.397)) *. (sqrt x6)) +. (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) ) <. (--. (#4.71107)))`;; + + + +(* interval verification by Ferguson *) +let I_529738375_5= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, square_4t0); + ((#4.0), x5, square_2t0); + (square_2t0, x6, (#8.0)) + ] + ( + ( (--. (#0.214) *. (sqrt x1)) +. ( ( (#0.4)) *. (sqrt x2)) +. ( ( (#0.58)) *. (sqrt x3)) +. + ( ( (#0.155)) *. (sqrt x5)) +. ( ( (#0.395)) *. (sqrt x6)) +. (dih_x x1 x2 x3 x4 x5 x6) ) >. (#4.52345))`;; + + + +(* interval verification in partK.cc *) +let I_529738375_6= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( (tauA_x x1 x2 x3 x4 x5 x6) >. D32)`;; + + +(* interval verification in partK.cc *) +let I_529738375_7= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( (vorA_x x1 x2 x3 x4 x5 x6) <. Z32)`;; + + + + +(* interval verification by Ferguson *) +let I_529738375_8= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( + ( (( --. ) (sol_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.492)) *. (sqrt x1)) +. ( (--. (#0.492)) *. (sqrt x2)) +. ( (--. (#0.492)) *. (sqrt x3)) +. + ( (#0.43) *. (sqrt x4)) +. ( (#0.038) *. (sqrt x5)) +. ( (#0.038) *. (sqrt x6)) ) <. (--. (#2.71884)))`;; + + + +(* interval verification in partK.cc *) +let I_529738375_9= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( + ( (( --. ) (vorA_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.058)) *. (sqrt x1)) +. ( (--. (#0.105)) *. (sqrt x2)) +. ( (--. (#0.105)) *. (sqrt x3)) +. + ( (--. (#0.115)) *. (sqrt x4)) +. ( (#0.062) *. (sqrt x5)) +. ( (--. (#0.062)) *. (sqrt x6)) ) >. (--. (#1.02014)))`;; + + + +(* interval verification in partK.cc *) +let I_529738375_10= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( + ( (vor_0_x x1 x2 x3 x4 x5 x6) +. ( (#0.419351) *. (sol_x x1 x2 x3 x4 x5 x6)) ) <. (#0.3085))`;; + + + +(* interval verification by Ferguson *) +let I_529738375_11= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( + ( ( (#0.115) *. (sqrt x1)) +. ( (--. (#0.452)) *. (sqrt x2)) +. ( (--. (#0.452)) *. (sqrt x3)) +. + ( (#0.613) *. (sqrt x4)) +. ( (--. (#0.15)) *. (sqrt x5)) +. ( (--. (#0.15)) *. (sqrt x6)) +. (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) ) <. (--. (#2.177)))`;; + + + +(* interval verification by Ferguson *) +let I_529738375_12= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( + ( ( (#0.115) *. (sqrt x1)) +. ( (--. (#0.452)) *. (sqrt x2)) +. ( (--. (#0.452)) *. (sqrt x3)) +. + ( (#0.618) *. (sqrt x4)) +. ( (--. (#0.15)) *. (sqrt x5)) +. ( (--. (#0.15)) *. (sqrt x6)) +. (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) ) <. (--. (#2.17382)))`;; + + + +(* interval verification in partK.cc *) +let I_529738375_13= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. (--. (#0.121)))`;; + + + + +(* interval verification in partK.cc *) +let I_529738375_14= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( ((tau_0_x x1 x2 x3 x4 x5 x6)) >. (#0.21301))`;; + + +(* interval verification by Ferguson *) +let I_529738375_15= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, square_4t0); + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( + ( ( (#0.115) *. (sqrt x1)) +. ( (--. (#0.452)) *. (sqrt x2)) +. ( (--. (#0.452)) *. (sqrt x3)) +. + ( (--. (#0.15)) *. (sqrt x5)) +. ( (--. (#0.15)) *. (sqrt x6)) +. (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) ) <. (--. (#3.725)))`;; + + + + +(* interval verification by Ferguson *) +let I_529738375_16= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, square_4t0); + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( + ( ( (#0.115) *. (sqrt x1)) +. ( (--. (#0.452)) *. (sqrt x2)) +. ( (--. (#0.452)) *. (sqrt x3)) +. + ( (--. (#0.15)) *. (sqrt x5)) +. ( (--. (#0.15)) *. (sqrt x6)) +. (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) ) <. (--. (#3.927)))`;; + + + +(* + +LOC: 2002 k.c page 46 +17.10 Group_10 +*) + + +let I_456320257_1= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (vorC_x x1 x2 x3 x4 x5 x6) <. (#0.0))`;; + + + + +let I_456320257_2= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( ( (#0.47) *. (sqrt x1)) +. ( (--. (#0.522)) *. (sqrt x2)) +. ( (--. (#0.522)) *. (sqrt x3)) +. ( (#0.812) *. (sqrt x4)) +. + ( (--. (#0.522)) *. (sqrt x5)) +. ( (--. (#0.522)) *. (sqrt x6)) +. (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) ) <. (--. (#2.82988)))`;; + + + +(* Uses monotonicity in the x4 variable *) + +let I_456320257_3= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( ( (#0.47) *. (sqrt x1)) +. ( (--. (#0.522)) *. (sqrt x2)) +. ( (--. (#0.522)) *. (sqrt x3)) +. + ( (--. (#0.522)) *. (sqrt x5)) +. ( (--. (#0.522)) *. (sqrt x6)) +. (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) ) <. (--. (#4.8681)))`;; + + + +(* Uses monotonicity in x4 *) + +let I_456320257_4= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( ( (#0.47) *. (sqrt x1)) +. ( (--. (#0.522)) *. (sqrt x2)) +. ( (--. (#0.522)) *. (sqrt x3)) +. + ( (--. (#0.522)) *. (sqrt x5)) +. ( (--. (#0.522)) *. (sqrt x6)) +. (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) ) <. (--. (#5.1623)))`;; + + + + +(* + +LOC: 2002 k.c page 47 +17.11 Group_11 +*) + + + +let I_664959245_1= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + (square_2t0, x3, (#8.0)); + (square_2t0, x4, square_4t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( ( (--. (#0.4)) *. (sqrt x3)) +. ( (#0.15) *. (sqrt x1)) +. ( (--. (#0.09)) *. (sqrt x2)) +. + ( (--. (#0.631)) *. (sqrt x6)) +. ( (--. (#0.23)) *. (sqrt x5)) +. (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) ) <. (--. (#3.9788)))`;; + + + +let I_664959245_2= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + (square_2t0, x3, (#8.0)); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + (square_2t0, x6, (#8.0)) + ] + ( + ( ( (#0.289) *. (sqrt x1)) +. ( (--. (#0.148)) *. (sqrt x2)) +. ( (--. (#1.36)) *. (sqrt x3)) +. + ( (#0.688) *. (sqrt x4)) +. ( (--. (#0.148)) *. (sqrt x5)) +. ( (--. (#1.36)) *. (sqrt x6)) +. (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) ) <. (--. (#6.3282)))`;; + + + + +let I_664959245_3= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + (square_2t0, x3, (#8.0)); + (square_2t0, x4, (square (( +. ) (#2.51) (sqrt (#8.0))))); + ((#4.0), x5, square_2t0); + (square_2t0, x6, (#8.0)) + ] + ( + ( ( (#0.289) *. (sqrt x1)) +. ( (--. (#0.148)) *. (sqrt x2)) +. ( (--. (#0.723)) *. (sqrt x3)) +. + ( (--. (#0.148)) *. (sqrt x5)) +. ( (--. (#0.723)) *. (sqrt x6)) +. (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) ) <. (--. (#4.85746)))`;; + + + + +(* + +LOC: 2002 k.c page 47 +17.12 Group_12 +*) + + +(* interval verification in partK.cc *) +let I_704795925_1= + all_forall `ineq + [((square (#2.696)), x1, (#8.0)); + ((square (#2.45)), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((square (#2.45)), x6, square_2t0) + ] + ( (nu_x x1 x2 x3 x4 x5 x6) <. (--. (#0.055)))`;; + + + +let I_704795925_2= + all_forall `ineq + [((square (#2.696)), x1, (#8.0)); + ((square (#2.45)), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((square (#2.45)), x6, square_2t0) + ] + ( (taunu_x x1 x2 x3 x4 x5 x6) >. (#0.092))`;; + + + + + +(* interval verification in partK.cc *) +let I_332919646_1= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((square (#2.45)), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigmahat_x x1 x2 x3 x4 x5 x6) <. (--. (#0.039)))`;; + +let I_332919646_2= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((square (#2.45)), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (tauhat_x x1 x2 x3 x4 x5 x6) >. (#0.094))`;; + +(* interval verification in partK.cc *) +let I_335795137_1= + all_forall `ineq + [((square (#2.696)), x1, (#8.0)); + ((square (#2.45)), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((square (#2.45)), x6, square_2t0) + ] + ( (vor_analytic_x x1 x2 x3 x4 x5 x6) <. (--. (#0.197)))`;; + + + +let I_335795137_2= + all_forall `ineq + [((square (#2.696)), x1, (#8.0)); + ((square (#2.45)), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((square (#2.45)), x6, square_2t0) + ] + ( (taunu_x x1 x2 x3 x4 x5 x6) >. (#0.239))`;; + + + + + +(* interval verification by Ferguson *) +(* interval verification by Ferguson *) +let I_605071818_1= + all_forall `ineq + [((square (#2.45)), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. (--. (#0.089)))`;; + + + +let I_605071818_2= + all_forall `ineq + [((square (#2.45)), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + (square_2t0, x5, (#8.0)); + (square_2t0, x6, (#8.0)) + ] + ( (tau_0_x x1 x2 x3 x4 x5 x6) >. (#0.154))`;; + + + +(* interval verification by Ferguson *) +let I_642806938_1= + all_forall `ineq + [((square (#2.45)), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + (square_2t0, x5, (#8.0)); + ((#4.0), x6, square_2t0) + ] + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. (--. (#0.089)))`;; + + + +let I_642806938_2= + all_forall `ineq + [((square (#2.45)), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + (square_2t0, x5, (#8.0)); + ((#4.0), x6, square_2t0) + ] + ( (tau_0_x x1 x2 x3 x4 x5 x6) >. (#0.154))`;; + + +(* + +LOC: 2002 k.c page 47 +17.13 Group_13 +*) + + +(* interval verification in partK.cc *) +let I_104506452= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (octavor_analytic_x x1 x2 x3 x4 x5 x6) <. ( (octavor0_x x1 x2 x3 x4 x5 x6) +. (--. (#0.017)))) \/ + ( (eta_x x1 x2 x6) <. (sqrt (#2.0))))`;; + + + + +(* interval verification in partK.cc *) +let I_601083647= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#9.0), x4, (#9.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.678)) \/ + ( ( (sqrt x2) +. (sqrt x3) +. (sqrt x5) +. (sqrt x6)) >. (#8.77)))`;; + + +(* + +LOC: 2002 k.c page 47 +17.14 Group_14 +*) + + + +(* interval verification in partK.cc *) +let I_543730647= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (square (#2.6))); + + ((#4.0), x5, (square (#2.138))); + ((#4.0), x6, square_2t0) + ] + ( (gamma_x x1 x2 x3 x4 x5 x6) <. ( (#0.3138) +. ( (--. (#0.157)) *. (sqrt x5))))`;; + + + + +(* interval verification in partK.cc *) +let I_163030624= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((square (#2.121)), x2, (square (#2.145))); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + ((square (#2.22)), x5, (square (#2.238))); + ((#4.0), x6, square_2t0) + ] + ( (gamma_x x1 x2 x3 x4 x5 x6) <. (--. (#0.06)))`;; + + + + +(* +Earlier version was false at (4.0,4.0,4.0,4.0,5.5225,5.5225). +Bug fixed 1/19/2008 : lower bound on x4 was a typo. It should be square_2t0. +*) +(* interval verification in partK.cc *) +let I_181462710= + all_forall `ineq + [((#4.0), x1, (square (#2.2))); + ((#4.0), x2, (square (#2.2))); + ((#4.0), x3, (square (#2.2))); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, (square (#2.35))); + ((#4.0), x6, (square (#2.35))) + ] + ( (gamma_x x1 x2 x3 x4 x5 x6) <. + ( (#0.000001) +. (#1.4) +. ( (--. (#0.1)) *. (sqrt x1)) + +. ( (--. (#0.15)) *. ( (sqrt x2) +. (sqrt x3) +. + (sqrt x5) +. (sqrt x6)))))`;; + + + + +(* + +LOC: 2002 k.c page 48 +17.15 Group_15 +*) + +(* interval verification in partK.cc *) +let I_463544803= + all_forall `ineq + [((#4.0), x1, (square (#2.14))); + ((#4.0), x2, (square (#2.14))); + ((#4.0), x3, (square (#2.14))); + ((square (#2.7)), x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (vor_analytic_x x1 x2 x3 x4 x5 x6) <. (vor_0_x x1 x2 x3 x4 x5 x6))`;; + + + + +(* interval verification in partK.cc *) +let I_399326202= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (square (#2.72))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. (--. (#0.064))) \/ + ( (eta_x x4 x5 x6) <. (sqrt (#2.0))))`;; + + + +(* interval verification in partK.cc *) +let I_569240360= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((square (#2.7)), x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. + ( (#1.0612) +. ( (--. (#0.08)) *. ( (sqrt x1) +. (sqrt x2) +. (sqrt x3))) +. ( (--. (#0.142)) *. ( (sqrt x5) +. (sqrt x6)))))`;; + + + + +(* False at +SphereIn[5]:= VorVc @@ Sqrt [{4,4,4,6.7081,6.1009,4.41}] +SphereOut[5]= -0.0625133. +1/19/2008. Added the missing eta456 constraint to eliminate counterexample. +*) +(* interval verification in partK.cc *) +let I_252231882= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((square (#2.59)), x4, (square (#2.64))); + ((square (#2.47)), x5, square_2t0); + ((square (#2.1)), x6, (square (#3.51))) + ] + (( (vor_0_x x1 x2 x3 x4 x5 x6) <. (--. (#0.0713))) \/ + ( (eta_x x4 x5 x6) <. (sqrt (#2.0))))`;; + + + +let I_472436131= + all_forall `ineq + [((#4.0), x1, (square (#2.13))); + ((#4.0), x2, (square (#2.13))); + ((#4.0), x3, (square (#2.13))); + ((square (#2.7)), x4, (square (#2.74))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. (--. (#0.06))) \/ + ( (eta_x x4 x5 x6) <. (sqrt (#2.0))))`;; + + + + +(* interval verification in partK.cc *) +let I_913534858= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (square (#2.747))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. (--. (#0.058))) \/ + ( (eta_x x4 x5 x6) <. (sqrt (#2.0))))`;; + + + + +(* interval verification in partK.cc *) +let I_850226792= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (square (#2.77))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. (--. (#0.0498))) \/ + ( (eta_x x4 x5 x6) <. (sqrt (#2.0))))`;; + + + +(* + +LOC: 2002 k.c page 48 +17.16 Group_16 +*) + + + +(* +Was false at (4,4,4,8,6.3001,6.3001) +Fixed by inserting the missing circumradius condition on 1/19/2008. +Also, the lower bound on x4 was changed to 7.29 from square_2t0 +to bring it into agreement with the interval calculation in partK.cc +*) +(* interval verification in partK.cc *) + +(* changed (square_2t0, x4, (#8.0)); *) + +let I_594246986= + all_forall `ineq + [((#4.0), x1, (square (#2.14))); + ((#4.0), x2, (square (#2.14))); + ((#4.0), x3, (square (#2.14))); + ((square (#7.29), x4, (#8.0))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + (( ( (( --. ) (gamma_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.145)) *. (sqrt x1)) +. ( (--. (#0.08)) *. ( (sqrt x2) +. (sqrt x3))) +. + ( (--. (#0.133)) *. ( (sqrt x5) +. (sqrt x6)))) >. (--. (#1.146))) \/ ( (eta_x x4 x5 x6) >. (sqrt (#2.0))))`;; + + + +(* interval verification in partK.cc *) + +(* This is false at + point: [4, 4, 4, 6.3001, 5.29, 5.29] + value: about 0.0001. + + The interval arithmetic code for 381970727 in partK.c has a lower + bound on x4 of 7.29. This seems to be a bug in the 1998 interval arithmetic + code. A note has been added to the dcg_errata. + This affects the 1998 linear programs. + + I am changing the lower bound on x4 to 7.29, even though we would like + it to be at its original 6.3001. TCH 1/29/2008. +*) + +(* Please don't put comments inside HOL terms. They don't compile. Oh no! *) +(* let I_381970727= *) +(* all_forall `ineq *) +(* [((#4.0), x1, (square (#2.14))); *) +(* ((#4.0), x2, (square (#2.14))); *) +(* ((#4.0), x3, (square (#2.14))); *) +(* (\* (square_2t0, x4, (#8.0)); *\) *) +(* ((#7.29), x4, (#8.0)); *) + +(* ((#4.0), x5, (square (#2.3))); *) +(* ((#4.0), x6, (square (#2.3))) *) +(* ] *) +(* ( ( (( --. ) (gamma_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.145)) *. (sqrt x1)) +. ( (--. (#0.081)) *. ( (sqrt x2) +. (sqrt x3))) +. *) +(* ( (--. (#0.16)) *. ( (sqrt x5) +. (sqrt x6)))) >. (--. (#1.255)))`;; *) + +let I_381970727= + all_forall `ineq + [((#4.0), x1, (square (#2.14))); + ((#4.0), x2, (square (#2.14))); + ((#4.0), x3, (square (#2.14))); + ((#7.29), x4, (#8.0)); + ((#4.0), x5, (square (#2.3))); + ((#4.0), x6, (square (#2.3))) + ] + ( ( (( --. ) (gamma_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.145)) *. (sqrt x1)) +. ( (--. (#0.081)) *. ( (sqrt x2) +. (sqrt x3))) +. + ( (--. (#0.16)) *. ( (sqrt x5) +. (sqrt x6)))) >. (--. (#1.255)))`;; + +(* interval verification in partK.cc *) + +(* This was false at + point: [4, 4, 4, 8, 4, 4] + value: about 0.02. + However, this doesn't satisfy the second constraint: + In the paper and in partK.cc, there is a constraint that y5+y6 >= 4.3. + This was overlooked when this inequality was originally typed. + This fixes the problem. +*) +let I_951798877= + all_forall `ineq + [((#4.0), x1, (square (#2.14))); + ((#4.0), x2, (square (#2.14))); + ((#4.0), x3, (square (#2.14))); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, (square (#2.3))); + ((#4.0), x6, (square (#2.3))) + ] + ((((( --. ) (gamma_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.03)) *. (sqrt x1)) +. ( (--. (#0.03)) *. ( (sqrt x2) +. (sqrt x3))) +. + ( (--. (#0.094)) *. ( (sqrt x5) +. (sqrt x6)))) >. (--. (#0.5361))) + \/ ((sqrt x5) +. (sqrt x6) <. #4.3))`;; + +(* interval verification in partK.cc *) +let I_923397705= + all_forall `ineq + [((#4.0), x1, (square (#2.14))); + ((#4.0), x2, (square (#2.14))); + ((#4.0), x3, (square (#2.14))); + (square_2t0, x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( ( (( --. ) (gamma_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.03)) *. (sqrt x1)) +. ( (--. (#0.03)) *. ( (sqrt x2) +. (sqrt x3))) +. + ( (--. (#0.16)) *. ( (sqrt x5) +. (sqrt x6)))) >. ( (--. (#0.82)) +. (--. (#0.000001)))) \/ + ( ( (sqrt x5) +. (sqrt x6)) >. (#4.3)))`;; + + + + +(* interval verification in partK.cc *) +(* +This was false. Gamma seems unstable as +x5 gets very large. + +value: about .4 +point: {4, 4, 4, 7.99999999999, 15.3886219273, 6.30009999999}] + +Typo fixed on the upper bound of x5. +The correct upper bound square_2t0. + +*) +let I_312481617= + all_forall `ineq + [((#4.0), x1, (square (#2.14))); + ((#4.0), x2, (square (#2.14))); + ((#4.0), x3, (square (#2.14))); + (square_2t0, x4, (#8.0)); + ((square (#2.35)), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (gamma_x x1 x2 x3 x4 x5 x6) <. (--. (#0.053)))`;; + + + +(* interval verification in partK.cc *) +let I_292760488= + all_forall `ineq + [((#4.0), x1, (square (#2.14))); + ((#4.0), x2, (square (#2.14))); + ((#4.0), x3, (square (#2.14))); + (square_2t0, x4, (#8.0)); + + ((square (#2.25)), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (gamma_x x1 x2 x3 x4 x5 x6) <. (--. (#0.041)))`;; + + + + +(* interval verification in partK.cc *) +let I_155008179= + all_forall `ineq + [((#4.0), x1, (square (#2.14))); + ((#4.0), x2, (square (#2.14))); + ((#4.0), x3, (square (#2.14))); + (square_2t0, x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( ( (gamma_x x1 x2 x3 x4 x5 x6) +. ( (#0.419351) *. (sol_x x1 x2 x3 x4 x5 x6))) <. + ( ( (#0.079431) *. (dih_x x1 x2 x3 x4 x5 x6)) +. ( (#0.0436) *. ( (sqrt x5) +. (sqrt x6))) +. (--. (#0.0294)))) \/ + ( (eta_x x4 x5 x6) >. (sqrt (#2.0))))`;; + + + +(* interval verification in partK.cc *) +let I_819450002= + all_forall `ineq + [((#4.0), x1, (square (#2.13))); + ((#4.0), x2, (square (#2.13))); + ((#4.0), x3, (square (#2.13))); + (square_2t0, x4, (square (#2.67))); + + ((#4.0), x5, (square (#2.1))); + ((square (#2.27)), x6, (square (#2.43))) + ] + ( (gamma_x x1 x2 x3 x4 x5 x6) <. ( (#1.1457) +. ( (--. (#0.1)) *. ( (sqrt x1) +. (sqrt x2) +. (sqrt x3))) +. + ( (--. (#0.17)) *. (sqrt x5)) +. ( (--. (#0.11)) *. (sqrt x6))))`;; + + + + +(* interval verification in partK.cc *) +let I_495568072= + all_forall `ineq + [((#4.0), x1, (square (#2.14))); + ((#4.0), x2, (square (#2.14))); + ((#4.0), x3, (square (#2.14))); + (square_2t0, x4, (square (#2.7))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( ( ( (#1.69) *. (sqrt x4)) +. (sqrt x5) +. (sqrt x6)) >. (#9.0659)) \/ + ( (eta_x x4 x5 x6) <. (sqrt (#2.0))))`;; + + + +(* interval verification in partK.cc *) +let I_838887715= + all_forall `ineq + [((#4.0), x1, (square (#2.14))); + ((#4.0), x2, (square (#2.14))); + ((#4.0), x3, (square (#2.14))); + (square_2t0, x4, (square (#2.77))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( ( ( (#1.69) *. (sqrt x4)) +. (sqrt x5) +. (sqrt x6)) >. (#9.044)) \/ + ( (eta_x x4 x5 x6) <. (sqrt (#2.0))))`;; + + + + +(* interval verification in partK.cc *) +let I_794413343= + all_forall `ineq + [((#4.0), x1, (square (#2.14))); + ((#4.0), x2, (square (#2.14))); + ((#4.0), x3, (square (#2.14))); + (square_2t0, x4, (square (#2.72))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( ( (sqrt x5) +. (sqrt x6)) >. (#4.4)) \/ + ( (eta_x x4 x5 x6) <. (sqrt (#2.0))))`;; + + + +(* + +LOC: 2002 k.c page 48 +17.17 Group_17 +*) + + + +(* interval verification in partK.cc *) +let I_378020227= + all_forall `ineq + [((#4.0), x1, (square (#2.14))); + ((#4.0), x2, (square (#2.14))); + ((#4.0), x3, (square (#2.14))); + ((#4.0), x4, square_2t0); + (square_2t0, x5, (square (#2.77))); + (square_2t0, x6, (square (#2.77))) + ] + ( ( (( --. ) (vor_analytic_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.058)) *. (sqrt x1)) +. ( (--. (#0.08)) *. (sqrt x2)) +. ( (--. (#0.08)) *. (sqrt x3)) +. + ( (--. (#0.16)) *. (sqrt x4)) +. ( (--. (#0.21)) *. ( (sqrt x5) +. (sqrt x6))) ) >. (--. (#1.7531)))`;; + + + +(* +Changed x5 from 4..(2t)^2 +*) +(* interval verification in partK.cc *) +let I_256893386= + all_forall `ineq + [((#4.0), x1, (square (#2.14))); + ((#4.0), x2, (square (#2.14))); + ((#4.0), x3, (square (#2.14))); + ((#4.0), x4, square_2t0); + (square_2t0, x5, #8.0); + ((square (#2.77)), x6, (#8.0)) + ] + ( + ( ( (( --. ) (vor_0_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.058)) *. (sqrt x1)) +. ( (--. (#0.1)) *. (sqrt x2)) +. ( (--. (#0.1)) *. (sqrt x3)) +. + ( (--. (#0.165)) *. (sqrt x4)) +. ( (--. (#0.115)) *. (sqrt x6)) +. ( (--. (#0.12)) *. (sqrt x5)) ) >. (--. (#1.38875))) \/ + ( (eta_x x4 x5 x6) <. (sqrt (#2.0))))`;; + + + + +(* interval verification in partK.cc *) +let I_749955642= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + (square_2t0, x5, (square (#2.77))); + (square_2t0, x6, (square (#2.77))) + ] + ( + ( ( (sqrt x4) +. (sqrt x5) +. (sqrt x6)) >. (#7.206)) \/ + ( (eta_x x4 x5 x6) <. (sqrt (#2.0))))`;; + + + +(* interval verification in partK.cc *) +let I_653849975= + all_forall `ineq + [((#4.0), x1, (square (#2.14))); + ((#4.0), x2, (square (#2.14))); + ((#4.0), x3, (square (#2.14))); + ((#4.0), x4, square_2t0); + + (square_2t0, x5, (square (#2.77))); + (square_2t0, x6, (square (#2.77))) + ] + ( + ( ( (( --. ) (vor_0_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.058)) *. (sqrt x1)) +. ( (--. (#0.05)) *. (sqrt x2)) +. ( (--. (#0.05)) *. (sqrt x3)) +. + ( (--. (#0.16)) *. (sqrt x4)) +. ( (--. (#0.13)) *. (sqrt x6)) +. ( (--. (#0.13)) *. (sqrt x5)) ) >. (--. (#1.24547))) \/ + ( (eta_x x4 x5 x6) <. (sqrt (#2.0))))`;; + + + + + +(* interval verification in partK.cc *) +let I_480930831= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + ((square (#2.77)), x5, (#8.0)); + ((#4.0), x6, square_2t0) + ] + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. (--. (#0.077)))`;; + + + +(* interval verification in partK.cc *) +let I_271703736= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (square (#2.77))); + (square_2t0, x5, (square (#2.77))); + ((#4.0), x6, square_2t0) + ] + ( ( (vor_analytic_x x1 x2 x3 x4 x5 x6) +. ( (#0.419351) *. (sol_x x1 x2 x3 x4 x5 x6))) <. (#0.289))`;; + + +(* I_900212351 has been deprecated. *) + +(* + +LOC: 2002 k.c page 49 +17.18 Group_18 +*) + + + + +(* interval verification in partK.cc *) +let I_455329491= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (square (#2.6961))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (vor_analytic_x x1 x2 x3 x4 x5 x6) <. ( (--. (#0.078)) / (#2.0)))`;; + + + + +(* interval verification in partK.cc *) +let I_857241493= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + (square_2t0, x5, (square (#2.6961))); + (square_2t0, x6, (square (#2.6961))) + ] + ( + ( (vort_x x1 x2 x3 x4 x5 x6 (sqrt (#2.0))) <. (--. (#0.078))) \/ + ( (eta_x x4 x5 x6) <. (sqrt (#2.0))))`;; + + + + +(* + +LOC: 2002 k.c page 49 +17.19 Group_19 +*) + + +(* + +2002 text: + +The interval calculations here show that the set of separated +vertices (\ref{definition:admissible:excess}) can be generalized +to include opposite vertices of a quadrilateral unless the edge +between those vertices forms a flat quarter. Consider a vertex +of type $(3,1,1)$ with $a(3)=1.4\,\pt$. By the arguments in the +text, we may assume that the dihedral angles of the exceptional +regions at those vertices are at least $1.32$ (see +\cite[3.11.4]{part4}). Also, the three quasi-regular tetrahedra at +the vertex squander at least $1.5\,\pt$ by a linear programming +bound, if the angle of the quad cluster is at least $1.55$. Thus, +we assume that the dihedral angles at opposite vertices of the +quad cluster are at most $1.55$. A linear program also gives +$\tau+0.316\dih>0.3864$ for a quasi-regular tetrahedron. + +If we give bounds of the form +$\tau_x +0.316\dih> b$, for the part of the quad cluster around a +vertex, where $\tau_x$ is the appropriate squander function, then +we obtain + $$\sum\tau_x > -0.316(2\pi-1.32) + b + 3 (0.3864)$$ +for a lower bound on what is squandered. If the two opposite +vertices give at least $2(1.4)\,\pt + 0.1317$, then the inclusion +of two opposite vertices in the separated set of vertices is +justified. (Recall that $t_4=0.1317$.) The following +inequalities give the desired result. + +*) + + + +(* interval verification in partK.cc *) +let I_912536613= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( ( (taumu_flat_x x1 x2 x3 x4 x5 x6) +. ( (#0.316) *. (dih_x x1 x2 x3 x4 x5 x6))) >. (#0.5765)) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.55)))`;; + + + +(* interval verification in partK.cc *) +(* +CCC fails: added delta > 0 +*) +let I_640248153= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, square_4t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( ( (tau_0_x x1 x2 x3 x4 x5 x6) +. ( (#0.316) *. (dih_x x1 x2 x3 x4 x5 x6))) >. (#0.5765)) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.55)) \/ + ((delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)))`;; + + + + +(* interval verification in partK.cc *) +let I_594902677= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( ( (taunu_x x1 x2 x3 x4 x5 x6) +. ( (#0.316) *. (dih2_x x1 x2 x3 x4 x5 x6))) >. (#0.2778))`;; + + +(* Note I moved the huge non-interval-arithmetic inequalitites + to kep_inequalities2.ml *) + +(* + +LOC: 2002 k.c page 50 +17.23 Group_23 +*) + + +(* interval verification in partK.cc *) +let I_365179082_1= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (vorC_x x1 x2 x3 x4 x5 x6) <. (#0.0))`;; + + + + +let I_365179082_2= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (vorC_x x1 x2 x3 x4 x5 x6) <. (--. (#0.05)))`;; + + + + +let I_365179082_3= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vorC_x x1 x2 x3 x4 x5 x6) <. (--. (#0.119))) \/ + ( (eta_x x1 x2 x6) <. (sqrt (#2.0))))`;; + + +(* + +LOC: 2002 k.c page 50-51 +17.24 Group_24 +*) + +(* + +From 2002 text: + + \begin{eqnarray} + \sigma_R(D) < + \begin{cases} + 0,& y_1\in[2t_0,2\sqrt2],\\ + -0.043, & y_1\in[2t_0,2.696],\\ + \end{cases} + %\label{sec:4.5.6} + \label{eqn:group24} + \end{eqnarray} + for quad regions $R$ constructed from an anchored +simplex $S$ and adjacent special simplex $S'$. Assume that +$y_4(S)=y_4(S')\in[2\sqrt2,3.2]$, and that the other edges have +lengths in $[2,2t_0]$. The bound $0$ is found in \cite[Lemma +3.13]{formulation}. The bound $-0.043$ is obtained from +deformations, reducing the inequality to the following interval +calculations. + +(* interval verification by Ferguson *) +\refno{368244553\dag} + +(* interval verification by Ferguson *) +\refno{820900672\dag} + +(* interval verification by Ferguson *) +\refno{961078136\dag} + + +Under certain conditions, Inequality \ref {eqn:group24} can be +improved. +... +(The last of these was verified by S. Ferguson.) \refno{424186517} + +These combine to give +$$ +\vor_0(S)+\vor_0(S') < \begin{cases} -0.091,&\text{ or }\\ + -0.106,& + \end{cases} +$$ +for the combination of special simplex and anchored simplex under +the stated conditions. + +*) + + +let I_368244553= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + (square_2t0, x6, square_2t0) + ] + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. ( (--. (#0.043)) / (#2.0)))`;; + +let I_820900672= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( ( (vor_0_x x1 x2 x3 x4 x5 x6) +. (vor_0_x (#4.0) x2 x3 x4 (#4.0) (#4.0))) <. (--. (#0.043))) \/ + ( (cross_diag_x x1 x2 x3 x4 x5 x6 (#4.0) (#4.0) (#4.0)) <. two_t0))`;; + +let I_961078136= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( ( (vor_0_x x1 x2 x3 x4 x5 x6) +. (vor_0_x square_2t0 x2 x3 x4 (#4.0) (#4.0))) <. (--. (#0.043))) \/ + ( (cross_diag_x x1 x2 x3 x4 x5 x6 square_2t0 (#4.0) (#4.0)) <. two_t0))`;; + +(* Fixed bad bounds on first variable on 1/19/2008 *) +(* interval verification in part4.cc:424186517+1 *) +let I_424186517_1= + all_forall `ineq + [((#4.0), x1, (square (#2.12))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. (--. (#0.033))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.8)))`;; + +(* interval verification in part4.cc:424186517+2 *) +let I_424186517_2= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. (--. (#0.058))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.5)))`;; + +(* interval code in part4.cc:424186517+3 not used *) +(* interval verification by Ferguson *) +let I_424186517_3= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. (--. (#0.073))) \/ + ( (eta_x x1 x2 x6) <. (sqrt (#2.0))))`;; + + + +(* + +LOC: 2002 k.c page 51 +17.25 Group_25 (pentagons) +*) + +(* + +From 2002 text: + +There are a few inequalities that arise for pentagonal regions. + +\begin{proposition} If the pentagonal region has no flat quarters +and no upright quarters, the subregion $F$ is a pentagon. It +satisfies + $$ + \begin{array}{lll} + \vor_0 &< -0.128,\\ + \tau_0 &> 0.36925. + \end{array} + %\label{eqn:4.7.2} + $$ +\end{proposition} + + +\begin{proof} The proof is by deformations and interval calculations. If +a deformation produces a new flat quarter, then the result follows +from \cite[$\A_{13}$]{part4} and Inequality \ref {app:hexquad}. So +we may assume that all diagonals remain at least $2\sqrt2$. If all +diagonals remain at least 3.2, the result follows from the +tcc-bound on the pentagon \cite[Section 5.5]{part4}. Thus, we +assume that some diagonal is at most $3.2$. We deform the cluster +into the form + $$(a_1,2,a_2,2,a_3,2,a_4,2,a_5,2),\quad |v_i|=a_i\in\{2,2t_0\}.$$ +Assume that $|v_1-v_3|\le3.2$. If $\max(a_1,a_3)=2t_0$, the +result follows from \cite[$\A_{13}$]{part4} and +Section~\ref{app:hexquad}, Equations \ref{eqn:hexquadsig} and +\ref{eqn:hexquadtau}. + +Assume $a_1=a_3=2$. There is a diagonal of the quadrilateral of +length at most $3.23$ because + $$\Delta(3.23^2,4,4,3.23^2,4,3.2^2)<0.$$ + The result now follows from the following interval arithmetic + calculations. + +(These inequalities are closely related to +\cite[$\A_{21}$]{part4}.) + +*) + +(* interval verification by Ferguson *) +let I_587781327= + all_forall `ineq + [((#8.0), x4, (square (#3.2))); + ((#8.0), x4', (square (#3.23))) + ] + ( ( (vor_0_x (#4.0) (#4.0) (#4.0) x4 (#4.0) (#4.0)) +. + (vor_0_x (#4.0) (#4.0) (#4.0) x4' (#4.0) (#4.0)) +. + (vor_0_x (#4.0) (#4.0) (#4.0) x4 x4' (#4.0))) <. (--. (#0.128)))`;; + + + +(* interval verification by Ferguson *) +let I_807067544= + all_forall `ineq + [((#8.0), x4, (square (#3.2))); + ((#8.0), x4', (square (#3.23))) + ] + ( ( (tau_0_x (#4.0) (#4.0) (#4.0) x4 (#4.0) (#4.0)) +. + (tau_0_x (#4.0) (#4.0) (#4.0) x4' (#4.0) (#4.0)) +. + (tau_0_x (#4.0) (#4.0) (#4.0) x4 x4' (#4.0))) >. (#0.36925))`;; + + + + +(* interval verification (commented out) in partK.cc *) +(* interval verification by Ferguson *) +let I_986970370= + all_forall `ineq + [((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.06))) + ] + ( (tau_0_x (#4.0) (#4.0) x3 x4 (#4.0) (#4.0)) <. + (tau_0_x square_2t0 (#4.0) x3 x4 (#4.0) (#4.0)))`;; + + + + +(* interval verification (commented out) in partK.cc *) +(* interval verification by Ferguson *) +let I_677910379= + all_forall `ineq + [((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.06))) + ] + ( (vor_0_x (#4.0) (#4.0) x3 x4 (#4.0) (#4.0)) >. + (vor_0_x square_2t0 (#4.0) x3 x4 (#4.0) (#4.0)))`;; + + + + + +(* interval verification in partK.cc *) +let I_276168273= + all_forall `ineq + [((#4.0), x3, square_2t0); + ((square (#3.06)), x5, (square (#3.23))); + ((square (#3.06)), x6, (square (#3.23))) + ] + ( (vor_0_x (#4.0) (#4.0) x3 (#4.0) x5 x6) <. (--. (#0.128)))`;; + + + +(* interval verification in partK.cc *) +let I_411203982= + all_forall `ineq + [((square (#3.06)), x5, (square (#3.23))); + ((square (#3.06)), x6, (square (#3.23))) + ] + ( (tau_0_x (#4.0) (#4.0) (#4.0) (#4.0) x5 x6) >. (#0.36925))`;; + + + + +(* interval verification in partK.cc *) +let I_860823724= + all_forall `ineq + [((square (#3.06)), x5, (square (#3.23))); + ((square (#3.06)), x6, (square (#3.23))) + ] + ( (tau_0_x (#4.0) (#4.0) square_2t0 (#4.0) x5 x6) >. (#0.31))`;; + + + + +let I_353116955= + all_forall `ineq + [((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x5, (square (#3.23))); + + ((square (#3.06)), x6, (square (#3.23))) + ] + ( (vor_0_x (#4.0) x2 x3 (#4.0) x5 x6) <. + ( (--. (#0.137)) +. ( (--. (#0.14)) *. ( (sqrt x5) +. + ( (--. (#2.0)) *. (sqrt (#2.0)))))))`;; + + + +(* interval verification in partK.cc *) +let I_943315982= + all_forall `ineq + [((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x5, (square (#3.23))); + + ((square (#3.105)), x6, (square (#3.23))) + ] + ( (tau_0_x (#4.0) x2 x3 (#4.0) x5 x6) >. + ( (#0.31) +. ( (#0.14) *. ( (sqrt x5) +. + ( (--. (#2.0)) *. (sqrt (#2.0)))))))`;; + + + + +(* interval verification in partK.cc *) +let I_941799628= + all_forall `ineq + [((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x5, (square (#3.23))); + + ((square (#3.06)), x6, (square (#3.105))) + ] + ( (tau_0_x (#4.0) x2 x3 (#4.0) x5 x6) >. + ( (#0.31) +. ( (#0.14) *. ( (sqrt x5) +. ( (--. (#2.0)) *. (sqrt (#2.0))))) +. + ( (#0.19) *. ( (--. (#3.105)) +. (sqrt x6)))))`;; + + + +(* interval verification in partK.cc *) +let I_674284283= + all_forall `ineq + [((#4.0), x3, square_2t0); + ((#8.0), x5, (square (#3.23))) + ] + ( (vor_0_x (#4.0) (#4.0) x3 (#4.0) x5 (#4.0)) <. + ( (#0.009) +. ( (#0.14) *. ( (sqrt x5) +. ( (--. (#2.0)) *. (sqrt (#2.0)))))))`;; + + + +(* I_775220784 has been deprecated *) + +(* interval verification in partK.cc *) +let I_286076305= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#8.0), x4, (square (#3.23))) + ] + ( (tau_0_x x1 x2 square_2t0 x4 (#4.0) (#4.0)) >. (#0.05925))`;; + + + +(* interval verification in partK.cc *) +let I_589319960= + all_forall `ineq + [((square (#3.06)), x4, (square (#3.105))) + ] + ( (tau_0_x square_2t0 (#4.0) (#4.0) x4 (#4.0) (#4.0)) >. + ( (--. (#0.19)) *. ( (sqrt x4) +. (--. (#3.105)))))`;; + + +(* + +LOC: 2002 k.c page 52 +17.26 Group_26 +*) + +(* + +From 2002 text: + +Let $Q$ be a quadrilateral region with parameters + $$(a_1,2t_0,a_2,2,a_3,2,a_4,2t_0),\quad a_i\in\{2,2t_0\}.$$ +Assume that $|v_2-v_4|\in[2\sqrt2,3.2]$, + $|v_1-v_3|\in[3.2,3.46]$. Note that +$$\Delta(4,4,8,2t_0^2,2t_0^2,3.46^2)<0.$$ + +Sat Feb 21 12:47:03 EST 2004: Are we making an implicit convexity +assumption by phrasing the inequality this way? + + +*) + +(* interval verification by Ferguson *) +let I_302085207_GEN= + `\ a1 a2 a3 a4. (ineq + [ + ((#8.0),x4,(square (#3.2))) + ] + ((vor_0_x a1 a2 a4 x4 (square_2t0) (square_2t0) + + (vor_0_x a3 a2 a4 x4 (#4.0) (#4.0)) <. (--. (#0.168))) \/ + ((cross_diag_x a1 a2 a4 x4 (square_2t0) (square_2t0) a3 (#4.0) (#4.0)) <. (#3.2)) \/ + ((cross_diag_x a1 a2 a4 x4 (square_2t0) (square_2t0) a3 (#4.0) (#4.0)) >. (#3.46))))`;; + +(* interval verification by Ferguson *) +let I_302085207_1= + all_forall (list_mk_comb( I_302085207_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_302085207_2= + all_forall (list_mk_comb( I_302085207_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_302085207_3= + all_forall (list_mk_comb( I_302085207_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_302085207_4= + all_forall (list_mk_comb( I_302085207_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_302085207_5= + all_forall (list_mk_comb( I_302085207_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* WWW + This seems unfeasible due to cross_diag constraints +*) +(* interval verification by Ferguson *) +let I_302085207_6= + all_forall (list_mk_comb( I_302085207_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_302085207_7= + all_forall (list_mk_comb( I_302085207_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_302085207_8= + all_forall (list_mk_comb( I_302085207_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_302085207_9= + all_forall (list_mk_comb( I_302085207_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_302085207_10= + all_forall (list_mk_comb( I_302085207_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_302085207_11= + all_forall (list_mk_comb( I_302085207_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_302085207_12= + all_forall (list_mk_comb( I_302085207_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_302085207_13= + all_forall (list_mk_comb( I_302085207_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_302085207_14= + all_forall (list_mk_comb( I_302085207_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_302085207_15= + all_forall (list_mk_comb( I_302085207_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_302085207_16= + all_forall (list_mk_comb( I_302085207_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_411491283_GEN= + `\ a1 a2 a3 a4. (ineq + [ + ((#8.0),x4,(square (#3.2))) + ] + ((tau_0_x a1 a2 a4 x4 (square_2t0) (square_2t0) + + (tau_0_x a3 a2 a4 x4 (#4.0) (#4.0)) >. ( (#0.352))) \/ + ((cross_diag_x a1 a2 a4 x4 (square_2t0) (square_2t0) a3 (#4.0) (#4.0)) <. (#3.2)) \/ + ((cross_diag_x a1 a2 a4 x4 (square_2t0) (square_2t0) a3 (#4.0) (#4.0)) >. (#3.46))))`;; + +(* interval verification by Ferguson *) +let I_411491283_1= + all_forall (list_mk_comb( I_411491283_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_411491283_2= + all_forall (list_mk_comb( I_411491283_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_411491283_3= + all_forall (list_mk_comb( I_411491283_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_411491283_4= + all_forall (list_mk_comb( I_411491283_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_411491283_5= + all_forall (list_mk_comb( I_411491283_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* +WWW Seems infeasible due to cross_diag_x constraints +*) +(* interval verification by Ferguson *) +let I_411491283_6= + all_forall (list_mk_comb( I_411491283_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_411491283_7= + all_forall (list_mk_comb( I_411491283_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_411491283_8= + all_forall (list_mk_comb( I_411491283_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_411491283_9= + all_forall (list_mk_comb( I_411491283_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_411491283_10= + all_forall (list_mk_comb( I_411491283_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_411491283_11= + all_forall (list_mk_comb( I_411491283_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_411491283_12= + all_forall (list_mk_comb( I_411491283_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_411491283_13= + all_forall (list_mk_comb( I_411491283_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_411491283_14= + all_forall (list_mk_comb( I_411491283_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_411491283_15= + all_forall (list_mk_comb( I_411491283_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_411491283_16= + all_forall (list_mk_comb( I_411491283_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + + + + +(* + +LOC: 2002 k.c page 52 +17.27 Group_27 +*) + +(* 2002 text: + +Consider a pentagonal region. If the pentagonal region has one +flat quarter and no upright quarters, there is a quadrilateral +region $F$. It satisfies + $$ + \begin{array}{lll} + \vor_0 &< -0.075,\\ + \tau_0 &> 0.176. + \end{array} + $$ + \oldlabel{4.6.4} +Break the cluster into two simplices $S=S(y_1,\ldots,y_6)$, +$S'=S(y'_1,y_2,y_3,y_4,y'_5,y'_6)$, by drawing a diagonal of +length $y_4$. Assume that the edge $y'_5\in[2t_0,2\sqrt2]$. Let +$y_4'$ be the length of the diagonal that crosses $y_4$. + $$ + \begin{array}{lll} + \vor_0 &< 2.1327-0.1 y_1 -0.15 y_2 -0.08 y_3 -0.15 y_5\\ + &\qquad -0.15 y_6 - 0.1 y'_1 - 0.17 y'_5 -0.16 y'_6,\\ + &\quad\text{if }\dih(S)<1.9,\ \dih(S')<2.0,\ y_1\in[2,2.2],\ + y_4\ge2\sqrt2,\\ + \vor_0 & < 2.02644 - 0.1 y_1 -0.14 (y_2+y_3)-0.15 (y_5+y_6) + -0.1 y'_1 - 0.12 (y_5'+y_6'), \\ + &\quad\text{if }y_1\in[2,2.08],\quad y_4\le3.\\ + \vor_0 &+0.419351 \sol < 0.4542 + 0.0238 (y_5+y_6+y_6'),\\ + &\quad\text{if }\ y_4,y_4'\ge2\sqrt2.\\ + %\tag A.4.7.1 + \end{array} + $$ + \oldlabel{A.4.7.1} +The inequalities above are verified in smaller pieces: + + +*) + + +(* interval verification in partK.cc *) +(* CCC added delta >= 0 *) +let I_131574415= + all_forall `ineq + [((#4.0), x1, (square (#2.2))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, square_4t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. + ( (#1.01) +. ( (--. (#0.1)) *. (sqrt x1)) +. ( (--. (#0.05)) *. (sqrt x2)) +. ( (--. (#0.05)) *. (sqrt x3)) +. + ( (--. (#0.15)) *. (sqrt x5)) +. ( (--. (#0.15)) *. (sqrt x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.9)) \/ + ((delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)))`;; + + + +(* interval verification in partK.cc *) +let I_929773933= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, square_4t0); + + (square_2t0, x5, (#8.0)); + ((#4.0), x6, square_2t0) + ] + ( + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. + ( (#1.1227) +. ( (--. (#0.1)) *. (sqrt x1)) +. ( (--. (#0.1)) *. (sqrt x2)) +. ( (--. (#0.03)) *. (sqrt x3)) +. + ( (--. (#0.17)) *. (sqrt x5)) +. ( (--. (#0.16)) *. (sqrt x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.0)) \/ + ( ( (sqrt x2) +. (sqrt x3)) >. (#4.67)))`;; + + + +(* interval verification in partK.cc *) +let I_223261160= + all_forall `ineq + [((#4.0), x1, (square (#2.08))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (#9.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. + ( (#1.0159) +. ( (--. (#0.1)) *. (sqrt x1)) +. ( (--. (#0.08)) *. ( (sqrt x2) +. (sqrt x3))) +. + ( (#0.04) *. (sqrt x4)) +. ( (--. (#0.15)) *. ( (sqrt x5) +. (sqrt x6)))))`;; + + + +(* interval verification in partK.cc *) +let I_135018647= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (#9.0)); + + (square_2t0, x5, (#8.0)); + ((#4.0), x6, square_2t0) + ] + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. + ( (#1.01054) +. ( (--. (#0.1)) *. (sqrt x1)) +. ( (--. (#0.06)) *. ( (sqrt x2) +. (sqrt x3))) +. + ( (--. (#0.04)) *. (sqrt x4)) +. ( (--. (#0.12)) *. ( (sqrt x5) +. (sqrt x6)))))`;; + + + + +(* interval verification in partK.cc *) +(* CCC i think you need delta constraints, added. *) +let I_559676877= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, square_4t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0); + ((#4.0), x1', square_2t0); + (square_2t0, x5', (#8.0)); + + ((#4.0), x6', square_2t0) + ] + ( + ( ( (vor_0_x x1 x2 x3 x4 x5 x6) +. (vor_0_x x1' x2 x3 x4 x5' x6') +. + ( (#0.419351) *. ( (sol_x x1 x2 x3 x4 x5 x6) +. (sol_x x1' x2 x3 x4 x5' x6')))) <. + ( (#0.4542) +. ( (#0.0238) *. ( (sqrt x5) +. (sqrt x6) +. (sqrt x6'))))) \/ + ( (cross_diag_x x1 x2 x3 x4 x5 x6 x1' x5' x6') <. ( (#2.0) *. (sqrt (#2.0)))) \/ + ((delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)) \/ + ((delta_x x1' x2 x3 x4 x5' x6') <. (#0.0)))`;; + +(* + +LOC: 2002 k.c page 53 +17.29 Group_29 +*) + +(* + +2002 text: + + $$ + \vor_0 < -0.136\quad\text{and }\tau_0 > 0.224, + %\tag A.4.12.4 + $$ + \oldlabel{A.4.12.4} +for a combination of anchored simplex $S$ and special simplex +$S'$, with $y_1(S)\in[2.696,2\sqrt2]$, +$y_2(S),y_6(S)\in[2.45,2t_0]$, $y_4(S)\in[2\sqrt2,3.2]$, and with +cross-diagonal at least $2t_0$. This inequality can be verified by +proving the following inequalities in lower dimension. In the +first four $y_1\in[2.696,2\sqrt2]$, $y_2,y_6\in[2.45,2t_0]$, +$y_4\in[2\sqrt2,3.2]$, and $y_4'\ge2t_0$ (the cross-diagonal). + + +*) + + +(* interval verification by Ferguson *) +let I_967376139= + all_forall `ineq + [((square (#2.696)), x1, (#8.0)); + ((square (#2.45)), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((square (#2.45)), x6, square_2t0) + ] + ( + ( ( (vor_0_x x1 x2 x3 x4 x5 x6) +. (vor_0_x (#4.0) x2 x3 x4 (#4.0) (#4.0))) <. (--. (#0.136))) \/ + ( (cross_diag_x x1 x2 x3 x4 x5 x6 (#4.0) (#4.0) (#4.0) ) <. two_t0))`;; + + + + +(* interval verification by Ferguson *) +let I_666869244= + all_forall `ineq + [((square (#2.696)), x1, (#8.0)); + ((square (#2.45)), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((square (#2.45)), x6, square_2t0) + ] + ( + ( ( (vor_0_x x1 x2 x3 x4 x5 x6) +. (vor_0_x square_2t0 x2 x3 x4 (#4.0) (#4.0))) <. (--. (#0.136))) \/ + ( (cross_diag_x x1 x2 x3 x4 x5 x6 square_2t0 (#4.0) (#4.0) ) <. two_t0))`;; + + + + +(* interval verification by Ferguson *) +let I_268066802= + all_forall `ineq + [((square (#2.696)), x1, (#8.0)); + ((square (#2.45)), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((square (#2.45)), x6, square_2t0) + ] + ( + ( ( (tau_0_x x1 x2 x3 x4 x5 x6) +. + (tau_0_x (#4.0) x2 x3 x4 (#4.0) (#4.0))) >. (#0.224)) \/ + ( (cross_diag_x x1 x2 x3 x4 x5 x6 (#4.0) (#4.0) (#4.0) ) <. two_t0))`;; + + + + +(* interval verification by Ferguson *) +let I_508108214= + all_forall `ineq + [((square (#2.696)), x1, (#8.0)); + ((square (#2.45)), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((square (#2.45)), x6, square_2t0) + ] + ( + ( ( (tau_0_x x1 x2 x3 x4 x5 x6) +. + (tau_0_x square_2t0 x2 x3 x4 (#4.0) (#4.0))) >. (#0.224)) \/ + ( (cross_diag_x x1 x2 x3 x4 x5 x6 square_2t0 (#4.0) (#4.0) ) <. two_t0))`;; + + + + +(* interval verification by Ferguson *) +let I_322505397= + all_forall `ineq + [((square (#2.696)), x1, (#8.0)); + ((square (#2.45)), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + (square_2t0, x5, square_2t0); + ((square (#2.45)), x6, square_2t0) + ] + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. (--. (#0.125)))`;; + + + +(* interval verification by Ferguson *) +let I_736616321= + all_forall `ineq + [((square (#2.696)), x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + (square_2t0, x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. (#0.011))`;; + + + + +(* interval verification by Ferguson *) +let I_689417023= + all_forall `ineq + [((square (#2.696)), x1, (#8.0)); + ((square (#2.45)), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + (square_2t0, x5, square_2t0); + ((square (#2.45)), x6, square_2t0) + ] + ( (tau_0_x x1 x2 x3 x4 x5 x6) >. (#0.17))`;; + + + +(* interval verification by Ferguson *) +let I_748466752= + all_forall `ineq + [((square (#2.696)), x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + (square_2t0, x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (tau_0_x x1 x2 x3 x4 x5 x6) >. (#0.054))`;; + + +(* + +LOC: 2002 k.c page 53 +17.30 Group_30 +*) + +(* + +2002 text: + +$$\vor_0 < -0.24\text{ and }\tau_0 > 0.346, + %\tag {A.4.12.5} + $$ + \oldlabel{A.4.12.5} +for an anchored simplex $S$ and simplex $S'$ with edge parameters +$(3,2)$ in a hexagonal cluster, with $y_2(S)=y_2(S')$, +$y_3(S)=y_3(S')$, $y_4(S)=y_4(S')$, $y_1(S)\in[2.696,2\sqrt2]$, +$y_4(S)\in[2\sqrt2,3.2]$, $y_2(S),y_6(S)\in[2.45,2t_0]$, and +$$\max(y_5(S'),y_6(S'))\in[2t_0,2\sqrt2],\quad +\min(y_5(S'),y_6(S'))\in[2,2t_0].$$ This breaks into separate +interval calculations for $S$ and $S'$. + +This inequality results from the following four inequalities: + +(* interval verification by Ferguson *) +$\vor_0(S) < -0.126$ and $\tau_0(S) > 0.16$ \refno{369386367\dag} + +$\vor_0(S') < -0.114$ and $\tau_0(S') >0.186$ (There are two cases +for each, depending on which of $y_5,y_6$ is longer.) +(* interval verification by Ferguson *) +\refno{724943459\dag} + +Sun Feb 22 07:47:31 EST 2004: I assume S' is a special below. + +*) + + +let I_369386367_1= + all_forall `ineq + [((square (#2.696)), x1, (#8.0)); + ((square (#2.45)), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + ((#4.0), x5, square_2t0); + ((square (#2.45)), x6, square_2t0) + ] + (vor_0_x x1 x2 x3 x4 x5 x6 <. (--. (#0.126))) + `;; + +let I_369386367_2= + all_forall `ineq + [((square (#2.696)), x1, (#8.0)); + ((square (#2.45)), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + ((#4.0), x5, square_2t0); + ((square (#2.45)), x6, square_2t0) + ] + (tau_0_x x1 x2 x3 x4 x5 x6 >. (#0.16)) + `;; + +let I_724943459_1= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((square (#2.45)), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + ((#4.0), x5, square_2t0); + ((square_2t0), x6, (#8.0)) + ] + (vor_0_x x1 x2 x3 x4 x5 x6 <. (--. (#0.114))) + `;; + +let I_724943459_2= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((square (#2.45)), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + ((square_2t0), x5, (#8.0)); + ((#4.0), x6, square_2t0) + ] + (vor_0_x x1 x2 x3 x4 x5 x6 <. (--. (#0.114))) + `;; + +let I_724943459_3= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((square (#2.45)), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + ((#4.0), x5, square_2t0); + ((square_2t0), x6, (#8.0)) + ] + (tau_0_x x1 x2 x3 x4 x5 x6 >. (#0.186)) + `;; + +let I_724943459_4= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((square (#2.45)), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + ((square_2t0), x5, (#8.0)); + ((#4.0), x6, square_2t0) + ] + (tau_0_x x1 x2 x3 x4 x5 x6 >. (#0.186)) + `;; + + +(* +LOC: 2002 k.c page 53 +17.31 Group_31 +*) + +(* interval verification by Ferguson *) +(* CCC delta constraints added *) +let I_836331201_1= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((square(#2.45)), x3, square_2t0); + ((#8.0), x4, square_4t0); + (square_2t0, x5, (#8.0)); + ((#4.0), x6, square_2t0); + ((#4.0), x7, square_2t0); + ((#4.0), x8, square_2t0); + ((#4.0), x9, square_2t0)] + (((vor_0_x x1 x2 x3 x4 x5 x6) + + (vor_0_x x7 x2 x3 x4 x8 x9) <. (-- (#0.149))) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 x7 x8 x9 <. (sqrt8)) \/ + ((delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)) \/ + ((delta_x x7 x2 x3 x4 x8 x9) <. (#0.0)))`;; + +(* CCC delta constraints added *) +let I_836331201_2= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((square(#2.45)), x3, square_2t0); + ((#8.0), x4, square_4t0); + (square_2t0, x5, (#8.0)); + ((#4.0), x6, square_2t0); + ((#4.0), x7, square_2t0); + ((#4.0), x8, square_2t0); + ((#4.0), x9, square_2t0)] + (((tau_0_x x1 x2 x3 x4 x5 x6) + + (tau_0_x x7 x2 x3 x4 x8 x9) >. (#0.281)) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 x7 x8 x9 <. (sqrt8)) \/ + ((delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)) \/ + ((delta_x x7 x2 x3 x4 x8 x9) <. (#0.0)))`;; + + +(* + +LOC: 2002 k.c page 54 +17.32 Group_32 +*) + +(* 2002 text: + + $$\vor_0 < -0.254\quad\text{and }\tau_0 > 0.42625, + %\tag {A.4.12.9} + $$ + %\oldlabel{A.4.12.9} +for a combination of anchored simplex $S$ and quadrilateral +cluster $Q$. It is assumed that $y_1(S)\in[2.696,2\sqrt2]$, +$y_2(S),y_6(S)\in[2.45,2t_0]$. The adjacent quadrilateral +subcluster is assumed to have both diagonals $\ge2\sqrt2$, and +parameters +$$(a_1,b_1,a_2,b_2,a_3,b_3,a_4,b_4),$$ +with $b_4\in[2\sqrt2,3.2]$. The verification of this inequality +reduces to separate inequalities for the anchored simplex and +quadrilateral subcluster. For the anchored simplex we use the +bounds $\vor_0(S')<-0.126$, $\tau_0(S')>0.16$ that have already +been established above. We then show that the quad cluster +satisfies + +(* interval verification by Ferguson *) +$\vor_0 < -0.128$ and $\tau_0 > 0.26625$. \refno{327474205\dag} + +(* interval verification in partK.cc *) +For this, use deformations to reduce either to the case where the +diagonal is $2\sqrt2$, or to the case where $b_1=b_2=b_3=2$, +$a_2,a_3\in\{2,2t_0\}$. When the diagonal is $2\sqrt2$, the flat +quarter can be scored by \cite[$\A_{13}$]{part4}: + $(\vor_0<0.009,\tau_0>0.05925)$. +(There are two cases depending on which direction the diagonal of +length $2\sqrt2$ runs.) + + + +*) + +(* CCC delta constraints added *) +(* XXX fixed syntax *) + +let I_327474205_1= + all_forall ` +let x2 = (#4.0) in +let x7 = (#4.0) in +let x8 = (#4.0) in +let x9 = (#4.0) in + ineq + [ + ((square(#2.45)), x1, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, square_4t0); + ((#8.0), x5, (square (#3.2))); + ((#4.0), x6, square_2t0)] + (((vor_0_x x1 x2 x3 x4 x5 x6) + + (vor_0_x x7 x2 x3 x4 x8 x9) <. (-- (#0.128))) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 x7 x8 x9 <. (sqrt8)) \/ + ((delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)) \/ + ((delta_x x7 x2 x3 x4 x8 x9) <. (#0.0)))`;; + +(* XXX fixed syntax *) +(* CCC delta constraints added *) +let I_327474205_2= + all_forall ` +let x2 = (square_2t0) in +let x7 = (#4.0) in +let x8 = (#4.0) in +let x9 = (#4.0) in + ineq + [ + ((square(#2.45)), x1, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, square_4t0); + ((#8.0), x5, (square (#3.2))); + ((#4.0), x6, square_2t0)] + (((vor_0_x x1 x2 x3 x4 x5 x6) + + (vor_0_x x7 x2 x3 x4 x8 x9) <. (-- (#0.128))) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 x7 x8 x9 <. (sqrt8)) \/ + ((delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)) \/ + ((delta_x x7 x2 x3 x4 x8 x9) <. (#0.0)))`;; + +(* XXX fixed syntax *) +let I_327474205_3= + all_forall ` +let x2 = (square_2t0) in +let x7 = (square_2t0) in +let x8 = (#4.0) in +let x9 = (#4.0) in + ineq + [ + ((square(#2.45)), x1, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, square_4t0); + ((#8.0), x5, (square (#3.2))); + ((#4.0), x6, square_2t0)] + (((vor_0_x x1 x2 x3 x4 x5 x6) + + (vor_0_x x7 x2 x3 x4 x8 x9) <. (-- (#0.128))) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 x7 x8 x9 + <. (sqrt8)))`;; + +(* XXX fixed syntax *) +let I_327474205_4= + all_forall ` +let x2 = (#4.0) in +let x7 = (square_2t0) in +let x8 = (#4.0) in +let x9 = (#4.0) in + ineq + [ + ((square(#2.45)), x1, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, square_4t0); + ((#8.0), x5, (square (#3.2))); + ((#4.0), x6, square_2t0)] + (((vor_0_x x1 x2 x3 x4 x5 x6) + + (vor_0_x x7 x2 x3 x4 x8 x9) <. (-- (#0.128))) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 x7 x8 x9 + <. (sqrt8)))`;; + +let I_327474205_5= + all_forall `ineq + [ + ((square(#2.45)), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x5, (square (#3.2))); + ((#4.0), x6, square_2t0)] + ((vor_0_x x1 x2 x3 (#8.0) x5 x6) <. (-- (#0.128)) - (#0.009))`;; + +let I_327474205_6= + all_forall `ineq + [ + ((square(#2.45)), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#8.0), x5, (square (#3.2)))] + ((vor_0_x x1 x2 x3 x4 x5 (#8.0)) <. (-- (#0.128)) - (#0.009))`;; + + +(* +CCC delta constraints added here as well. +*) + + +let I_327474205_7= + all_forall ` +let x2 = (#4.0) in +let x7 = (#4.0) in +let x8 = (#4.0) in +let x9 = (#4.0) in + ineq + [ + ((square(#2.45)), x1, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, square_4t0); + ((#8.0), x5, (square (#3.2))); + ((#4.0), x6, square_2t0)] + ((((tau_0_x x1 x2 x3 x4 x5 x6) + + (tau_0_x x7 x2 x3 x4 x8 x9) >. (#0.26625)) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 x7 x8 x9 <. (sqrt8))) \/ + ((delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)) \/ + ((delta_x x7 x2 x3 x4 x8 x9) <. (#0.0)))`;; + +let I_327474205_8= + all_forall ` +let x2 = (square_2t0) in +let x7 = (#4.0) in +let x8 = (#4.0) in +let x9 = (#4.0) in + ineq + [ + ((square(#2.45)), x1, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, square_4t0); + ((#8.0), x5, (square (#3.2))); + ((#4.0), x6, square_2t0)] + ((((tau_0_x x1 x2 x3 x4 x5 x6) + + (tau_0_x x7 x2 x3 x4 x8 x9) >. (#0.26625)) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 x7 x8 x9 <. (sqrt8))) \/ + ((delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)) \/ + ((delta_x x7 x2 x3 x4 x8 x9) <. (#0.0)))`;; + +let I_327474205_9= + all_forall ` +let x2 = (square_2t0) in +let x7 = (square_2t0) in +let x8 = (#4.0) in +let x9 = (#4.0) in + ineq + [ + ((square(#2.45)), x1, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, square_4t0); + ((#8.0), x5, (square (#3.2))); + ((#4.0), x6, square_2t0)] + (((tau_0_x x1 x2 x3 x4 x5 x6) + + (tau_0_x x7 x2 x3 x4 x8 x9) >. (#0.26625)) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 x7 x8 x9 + <. (sqrt8)))`;; + +let I_327474205_10= + all_forall ` +let x2 = (#4.0) in +let x7 = (square_2t0) in +let x8 = (#4.0) in +let x9 = (#4.0) in + ineq + [ + ((square(#2.45)), x1, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, square_4t0); + ((#8.0), x5, (square (#3.2))); + ((#4.0), x6, square_2t0)] + (((tau_0_x x1 x2 x3 x4 x5 x6) + + (tau_0_x x7 x2 x3 x4 x8 x9) >. (#0.26625)) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 x7 x8 x9 + <. (sqrt8)))`;; + +let I_327474205_11= + all_forall `ineq + [ + ((square(#2.45)), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x5, (square (#3.2))); + ((#4.0), x6, square_2t0)] + ((tau_0_x x1 x2 x3 (#8.0) x5 x6) >. (#0.26625) - (#0.05925))`;; + +let I_327474205_12= + all_forall `ineq + [ + ((square(#2.45)), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#8.0), x5, (square (#3.2)))] + ((tau_0_x x1 x2 x3 x4 x5 (#8.0)) >. (#0.26625) - (#0.05925))`;; + + +(* +LOC: 2002 k.c page 55-- +18. Appendix Hexagonal Inequalities +*) + +(* +LOC: 2002 k.c page 55--56 +SKIP 18.1. This has been moved to the main part of the +text. It is more mathematical argument than interval arithmetic. +*) + +(* +LOC: 2002 k.c page 56--59 +SKIP first part of 18.2. +This is a mathematical proof. It has been moved into the main +body of text. +*) + +(* +LOC: 2002 k.c page 56--59 +Last part of 18.2. +*) + + +(* interval verification by Ferguson *) +let I_725257062= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((square (#3.2)), x4, (square (#3.2))); + + ((#8.0), x5, (square (#3.2))); + ((#4.0), x6, square_2t0) + ] + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. ( (--. (#0.212)) +. (--. (#0.0461)) +. (#0.137)))`;; + + + +(* interval verification by Ferguson *) +let I_977272202= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((square (#3.2)), x4, (square (#3.2))); + + ((#8.0), x5, (square (#3.2))); + ((#4.0), x6, square_2t0) + ] + ( (tau_0_x x1 x2 x3 x4 x5 x6) >. ( (#0.54525) +. (--. (#0.0)) +. (--. (#0.31))))`;; + + + +(* +LOC: 2002 k.c page 59 +Group_18.3 +*) + +(* + +let CKC_377409251= (* 18.3 : app:p1b *) +let CKC_586214007= (* 18.4 : app:p1c *) +let CKC_89384104= (* 18.5 : app:p1d *) +let CKC_859726639= (* kc group 18.6 : app:p1e *) +let CKC_673399623= (* kc group 18.7 : app:p2a *) +let CKC_297256991= (* kc group 18.8 : app:p2b *) +let CKC_861511432= (* kc group 18.9 : app:p2c *) +let CKC_746445726= (* kc group 18.10 : app:p2d *) +let CKC_897046482= (* kc group 18.11 : app:p2e *) +let CKC_928952883= (* kc group 18.12 : app:p2f *) +let CKC_673800906= (* kc group 18.13 : app:p2g *) +let CKC_315678695= (* kc group 18.14 : app:p3 *) +let CKC_468742136= (* kc group 18.15 : app:p8 *) +let CKC_938091791= (* kc group 18.16 : app:p11 *) + +*) + +(* interval verification by Ferguson *) + + +(* This old code is incorrect. +let I_583626763_GEN= + `(\ a2 a3 a4. + (ineq +[ +((square(#3.2)), x, (#16.0)); +((square(#3.2)), x', square_4t0) +] + (((vor_0_x (#4.0) a2 a3 (#4.0) x (#4.0))+. + (vor_0_x (#4.0) a3 a4 (#4.0) x' x) +. + (vor_0_x (#4.0) a4 (#4.0) (#4.0) (#8.0) x') + (#0.0461) + <. (--(#0.212))) + \/ + (delta_x (#4.0) a2 a3 (#4.0) x (#4.0) <. (#0.0)) \/ + (delta_x (#4.0) a3 a4 (#4.0) x' x <. (#0.0)) \/ + (delta_x (#4.0) a4 (#4.0) (#4.0) (#8.0) x'<. (#0.0)))))`;; +*) + +(* The diagonals of the pentagon + run between (v1,v3) and (v3,v5). The long edge + of the pentagon is (v1,v5). See SPVI,2002,page 60,group 18.3. *) + +let I_583626763_GEN= + `(\ a2 a3 a4. + (ineq +[ +((square(#3.2)), x, (#16.0)); +((square(#3.2)), x', square_4t0) +] + (((vor_0_x (#4.0) a2 a3 (#4.0) x (#4.0))+. + (vor_0_x a3 (#4.0) (#4.0) (#8.0) x x') +. + (vor_0_x (#4.0) a4 a3 (#4.0) x' (#4.0)) + (#0.0461) + <. (--(#0.212))) + \/ + (delta_x (#4.0) a2 a3 (#4.0) x (#4.0) <. (#0.0)) \/ + (delta_x a3 (#4.0) (#4.0) (#8.0) x x' <. (#0.0)) \/ + (delta_x (#4.0) a4 a3 (#4.0) x' (#4.0) <. (#0.0)))))`;; + +(* interval verification by Ferguson *) + +(* False for old code + +Bound: 0.189116321203 +Point: [10.2399999999, 14.9282032302] + +*) +let I_583626763_1= + all_forall + (list_mk_comb(I_583626763_GEN,[`#4.0`;`#4.0`;`#4.0`]));; + + +(* interval verification by Ferguson *) + +(* False for old code +Bound: 0.265976192226 + +Point: [10.2399999999, 18.1174102784] +*) +let I_583626763_2= + all_forall + (list_mk_comb(I_583626763_GEN,[`#4.0`;`#4.0`;`square_2t0`]));; + + +(* interval verification by Ferguson *) +(* False for old code +Bound: 0.626837612707 + +Point: [11.8474915071, 14.9282032302] +*) +let I_583626763_3= + all_forall + (list_mk_comb(I_583626763_GEN,[`#4.0`;`square_2t0`;`#4.0`]));; + + +(* interval verification by Ferguson *) +(* False for old code + +Bound: 0.607887643248 + +Point: [11.0313746566, 18.1174102783] +*) +let I_583626763_4= + all_forall + (list_mk_comb(I_583626763_GEN,[`#4.0`;`square_2t0`;`square_2t0`]));; + + +(* interval verification by Ferguson *) +(* WWW Infeasible old code *) +let I_583626763_5= + all_forall + (list_mk_comb(I_583626763_GEN,[`square_2t0`;`#4.0`;`#4.0`]));; + + +(* interval verification by Ferguson *) +(* WWW Infeasible old code *) +let I_583626763_6= + all_forall + (list_mk_comb(I_583626763_GEN,[`square_2t0`;`#4.0`;`square_2t0`]));; + + +(* interval verification by Ferguson *) +(* False for old code *) +let I_583626763_7= + all_forall + (list_mk_comb(I_583626763_GEN,[`square_2t0`;`square_2t0`;`#4.0`]));; + + +(* interval verification by Ferguson *) +(* False for old code *) +let I_583626763_8= + all_forall + (list_mk_comb(I_583626763_GEN,[`square_2t0`;`square_2t0`;`square_2t0`]));; + + +(* All false or infeasible for old code. This had the same + diagonals error as 583626763. See comments there. *) +(* interval verification by Ferguson *) + +(* +let I_390951718_GEN= + `(\ a2 a3 a4. + (ineq +[ +((square(#3.2)), x, (#16.0)); +((square(#3.2)), x', square_4t0) +] + (((tau_0_x (#4.0) a2 a3 (#4.0) x (#4.0))+. + (tau_0_x (#4.0) a3 a4 (#4.0) x' x) +. + (tau_0_x (#4.0) a4 (#4.0) (#4.0) (#8.0) x') + >. (#0.54525)) + \/ + (delta_x (#4.0) a2 a3 (#4.0) x (#4.0) <. (#0.0)) \/ + (delta_x (#4.0) a3 a4 (#4.0) x' x <. (#0.0)) \/ + (delta_x (#4.0) a4 (#4.0) (#4.0) (#8.0) x'<. (#0.0)))))`;; + +*) + + + +(* The diagonals of the pentagon + run between (v1,v3) and (v3,v5). The long edge + of the pentagon is (v1,v5). See SPVI,2002,page 60,group 18.3. *) + +let I_390951718_GEN = + `(\ a2 a3 a4. + (ineq +[ +((square(#3.2)), x, (#16.0)); +((square(#3.2)), x', square_4t0) +] + (((tau_0_x (#4.0) a2 a3 (#4.0) x (#4.0))+. + (tau_0_x a3 (#4.0) (#4.0) (#8.0) x x') +. + (tau_0_x (#4.0) a4 a3 (#4.0) x' (#4.0)) + >. (#0.54525)) + \/ + (delta_x (#4.0) a2 a3 (#4.0) x (#4.0) <. (#0.0)) \/ + (delta_x a3 (#4.0) (#4.0) (#8.0) x x' <. (#0.0)) \/ + (delta_x (#4.0) a4 a3 (#4.0) x' (#4.0) <. (#0.0)))))`;; + +(* interval verification by Ferguson *) +let I_390951718_1= + all_forall + (list_mk_comb(I_390951718_GEN,[`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_390951718_2= + all_forall + (list_mk_comb(I_390951718_GEN,[`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_390951718_3= + all_forall + (list_mk_comb(I_390951718_GEN,[`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_390951718_4= + all_forall + (list_mk_comb(I_390951718_GEN,[`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_390951718_5= + all_forall + (list_mk_comb(I_390951718_GEN,[`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_390951718_6= + all_forall + (list_mk_comb(I_390951718_GEN,[`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_390951718_7= + all_forall + (list_mk_comb(I_390951718_GEN,[`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_390951718_8= + all_forall + (list_mk_comb(I_390951718_GEN,[`square_2t0`;`square_2t0`;`square_2t0`]));; + +let CKC_377409251= (* 18.3 *) + list_mk_conj + [I_390951718_8; I_390951718_7; I_390951718_6; I_390951718_5; + I_390951718_4; I_390951718_3; I_390951718_2; I_390951718_1; + I_583626763_8; I_583626763_7; I_583626763_6; I_583626763_5; + I_583626763_4; I_583626763_3; I_583626763_2; I_583626763_1; ];; + +(* +LOC: 2002 k.c page 59 +Group_18.4 +*) + +(* interval verification by Ferguson *) + +(* added disjunct on 3/11/2008 to express that |v2-v4|\ge sqrt8. + This is not in the statement of 2002. Note added to DCG errata. + This does not affect the proof, because this conditions holds in + practice. I haven't traced the error in the original code. + It is quite possible that Ferguson inserts this condition and + it never got updated in the text. *) + +let I_621852152_GEN= + `(\ a1 a2 a3 a4 a5. + (ineq +[ +((#8.0),b5,(square (#3.2))); +((square(#3.2)), x, (square_4t0)); +((square(#3.2)), x', (square_4t0)) +] + (((vor_0_x a3 a2 a1 (#4.0) x (#4.0)) +. + (vor_0_x a3 a1 a5 b5 x' x) +. + (vor_0_x a3 a5 a4 (#4.0) (#4.0) x') + + (#0.0461) <. (--(#0.212))) + \/ + (dih_x a3 a2 a1 (#4.0) x (#4.0) +. + dih_x a3 a1 a5 b5 xp x +. + dih_x a3 a5 a4 (#4.0) (#4.0) xp <. dih_x a3 a2 a4 (#8.0) (#4.0) (#4.0)) \/ + (delta_x a3 a2 a1 (#4.0) x (#4.0) <. (#0.0)) \/ + (delta_x a3 a1 a5 b5 x' x <. (#0.0)) \/ + (delta_x a3 a5 a4 (#4.0) (#4.0) x' <. (#0.0)))))`;; + +(* interval verification by Ferguson *) +let I_621852152_1= + all_forall + (list_mk_comb(I_621852152_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_621852152_2= + all_forall + (list_mk_comb(I_621852152_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + + +(* interval verification by Ferguson *) +let I_621852152_3= + all_forall + (list_mk_comb(I_621852152_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_621852152_4= + all_forall + (list_mk_comb(I_621852152_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_621852152_5= + all_forall + (list_mk_comb(I_621852152_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) + +(* CCC false , disjunct added +Bound: 0.0571539662754 + +Point: [8.00048294466, 13.920039161, 15.2775848381] + +*) +let I_621852152_6= + all_forall + (list_mk_comb(I_621852152_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_621852152_7= + all_forall + (list_mk_comb(I_621852152_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_621852152_8= + all_forall + (list_mk_comb(I_621852152_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* WWW infeasible *) +(* interval verification by Ferguson *) +let I_621852152_9= + all_forall + (list_mk_comb(I_621852152_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* WWW infeasible *) +(* interval verification by Ferguson *) +let I_621852152_10= + all_forall + (list_mk_comb(I_621852152_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* WWW infeasible *) +(* interval verification by Ferguson *) +let I_621852152_11= + all_forall + (list_mk_comb(I_621852152_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* WWW infeasible *) +(* interval verification by Ferguson *) +let I_621852152_12= + all_forall + (list_mk_comb(I_621852152_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_621852152_13= + all_forall + (list_mk_comb(I_621852152_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_621852152_14= + all_forall + (list_mk_comb(I_621852152_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_621852152_15= + all_forall + (list_mk_comb(I_621852152_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_621852152_16= + all_forall + (list_mk_comb(I_621852152_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_621852152_17= + all_forall + (list_mk_comb(I_621852152_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +(* +CCC false, disjunct added +Bound: 0.0270250652729 + +Point: [8.00060070939, 13.9200391262, 13.920039283] +*) +let I_621852152_18= + all_forall + (list_mk_comb(I_621852152_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_621852152_19= + all_forall + (list_mk_comb(I_621852152_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_621852152_20= + all_forall + (list_mk_comb(I_621852152_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +(* +CCC false, disjunct added +Bound: 0.0571539734352 + +Point: [8.00048294461, 15.2775848381, 13.920039161] + +*) +let I_621852152_21= + all_forall + (list_mk_comb(I_621852152_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +(* +CCC false, disjunct added +Bound: 0.0813970415878 + +Point: [8.00208732876, 15.2775848587, 15.2775793515] + +*) +let I_621852152_22= + all_forall + (list_mk_comb(I_621852152_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_621852152_23= + all_forall + (list_mk_comb(I_621852152_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_621852152_24= + all_forall + (list_mk_comb(I_621852152_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_621852152_25= + all_forall + (list_mk_comb(I_621852152_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_621852152_26= + all_forall + (list_mk_comb(I_621852152_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* WWW infeasible *) +(* interval verification by Ferguson *) +let I_621852152_27= + all_forall + (list_mk_comb(I_621852152_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_621852152_28= + all_forall + (list_mk_comb(I_621852152_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_621852152_29= + all_forall + (list_mk_comb(I_621852152_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_621852152_30= + all_forall + (list_mk_comb(I_621852152_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_621852152_31= + all_forall + (list_mk_comb(I_621852152_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_621852152_32= + all_forall + (list_mk_comb(I_621852152_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + + + +(* interval verification by Ferguson, source/section_a46_1c.c *) +(* There are counterexamples to various cases, listed below as stated + in 2002. The version below inserts an extra dihedral constraint + that is satisfied in practice. *) + +let I_207203174_GEN= + `(\ a1 a2 a3 a4 a5. + (ineq +[ +((#8.0),b5,(square (#3.2))); +((square(#3.2)), x, (square_4t0)); +((square(#3.2)), x', (square_4t0)) +] + (((tau_0_x a3 a2 a1 (#4.0) x (#4.0)) +. + (tau_0_x a3 a1 a5 b5 x' x) +. + (tau_0_x a3 a5 a4 (#4.0) (#4.0) x') + >. (#0.54525)) \/ + (dih_x a3 a2 a1 (#4.0) x (#4.0) +. + dih_x a3 a1 a5 b5 xp x +. + dih_x a3 a5 a4 (#4.0) (#4.0) xp <. dih_x a3 a2 a4 (#8.0) (#4.0) (#4.0)) \/ + (delta_x a3 a2 a1 (#4.0) x (#4.0) <. (#0.0)) \/ + (delta_x a3 a2 a1 (#4.0) x (#4.0) <. (#0.0)) \/ + (delta_x a3 a1 a5 b5 x' x <. (#0.0)) \/ + (delta_x a3 a5 a4 (#4.0) (#4.0) x' <. (#0.0)))))`;; + +(* interval verification by Ferguson *) +let I_207203174_1= + all_forall + (list_mk_comb(I_207203174_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_207203174_2= + all_forall + (list_mk_comb(I_207203174_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +(* WWW infeasible *) +let I_207203174_3= + all_forall + (list_mk_comb(I_207203174_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_207203174_4= + all_forall + (list_mk_comb(I_207203174_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_207203174_5= + all_forall + (list_mk_comb(I_207203174_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +(* CCC false , extra constraint added + False at {ay1,ay2,ay3,ay4,ay5}={2,2,2.51,2,2.51}; + by5=Sqrt[8]; {y,yp}={3.2,3.9086}; + Note that Solve[Delta[2, 2.51, 2.51, y, 2, 2] == 0, y] gives a zero + near y = 3.90866. + tauVc drops rapidly as x' increases in the range [3.9,3.9086]. + It is still true by a considerable margin at yp=3.9. + + The verification code is there in source/section_a46_1c.c, but I haven't + located the bug. + + Reported in dcg_errata.tex 1/31/2008, TCH. +*) +let I_207203174_6= + all_forall + (list_mk_comb(I_207203174_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_207203174_7= + all_forall + (list_mk_comb(I_207203174_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_207203174_8= + all_forall + (list_mk_comb(I_207203174_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + + +(* interval verification by Ferguson *) +(* WWW infeasible *) +let I_207203174_9= + all_forall + (list_mk_comb(I_207203174_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +(* WWW infeasible *) +let I_207203174_10= + all_forall + (list_mk_comb(I_207203174_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +(* WWW infeasible *) +let I_207203174_11= + all_forall + (list_mk_comb(I_207203174_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +(* WWW infeasible *) +let I_207203174_12= + all_forall + (list_mk_comb(I_207203174_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_207203174_13= + all_forall + (list_mk_comb(I_207203174_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_207203174_14= + all_forall + (list_mk_comb(I_207203174_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_207203174_15= + all_forall + (list_mk_comb(I_207203174_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_207203174_16= + all_forall + (list_mk_comb(I_207203174_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_207203174_17= + all_forall + (list_mk_comb(I_207203174_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_207203174_18= + all_forall + (list_mk_comb(I_207203174_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +(* WWW infeasible *) +let I_207203174_19= + all_forall + (list_mk_comb(I_207203174_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_207203174_20= + all_forall + (list_mk_comb(I_207203174_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +(* CCC false. extra constraint added. Comments before I_207203174_6 *) +let I_207203174_21= + all_forall + (list_mk_comb(I_207203174_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +(* CCC false. extra constraint added. Comments before I_207203174_6 *) +let I_207203174_22= + all_forall + (list_mk_comb(I_207203174_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_207203174_23= + all_forall + (list_mk_comb(I_207203174_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_207203174_24= + all_forall + (list_mk_comb(I_207203174_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_207203174_25= + all_forall + (list_mk_comb(I_207203174_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_207203174_26= + all_forall + (list_mk_comb(I_207203174_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +(* WWW infeasible *) +let I_207203174_27= + all_forall + (list_mk_comb(I_207203174_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_207203174_28= + all_forall + (list_mk_comb(I_207203174_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_207203174_29= + all_forall + (list_mk_comb(I_207203174_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_207203174_30= + all_forall + (list_mk_comb(I_207203174_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_207203174_31= + all_forall + (list_mk_comb(I_207203174_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_207203174_32= + all_forall + (list_mk_comb(I_207203174_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + + +let CKC_586214007= (* 18.4 *) + list_mk_conj[ + I_207203174_32;I_207203174_31;I_207203174_30;I_207203174_29; + I_207203174_28;I_207203174_27;I_207203174_26;I_207203174_25; + I_207203174_24;I_207203174_23;I_207203174_22;I_207203174_21; + I_207203174_20;I_207203174_19;I_207203174_18;I_207203174_17; + I_207203174_16;I_207203174_15;I_207203174_14;I_207203174_13; + I_207203174_12;I_207203174_11;I_207203174_10;I_207203174_9; + I_207203174_8;I_207203174_7;I_207203174_6;I_207203174_5; + I_207203174_4;I_207203174_3;I_207203174_2;I_207203174_1; + I_621852152_32;I_621852152_31;I_621852152_30;I_621852152_29; + I_621852152_28;I_621852152_27;I_621852152_26;I_621852152_25; + I_621852152_24;I_621852152_23;I_621852152_22;I_621852152_21; + I_621852152_20;I_621852152_19;I_621852152_18;I_621852152_17; + I_621852152_16;I_621852152_15;I_621852152_14;I_621852152_13; + I_621852152_12;I_621852152_11;I_621852152_10;I_621852152_9; + I_621852152_8;I_621852152_7;I_621852152_6;I_621852152_5; + I_621852152_4;I_621852152_3;I_621852152_2;I_621852152_1; ];; + + +(* +LOC: 2002 k.c page 59 +Group_18.5 +*) + + +(* interval verification by Ferguson *) +let I_368258024_GEN= + `(\ a1 a2 a3 a4 a5 a6. + (ineq +[ +((#8.0) , xd3, (square(#3.2))); +((square(#3.2)), xd4 , square_4t0); +((#8.0) , xd5,(square(#3.2))) +] + (((vor_0_x a1 a2 a3 (#4.0) xd3 (#4.0)) +. + (vor_0_x a1 a3 a4 (#4.0) xd4 xd3) +. + (vor_0_x a1 a4 a5 (#4.0) xd5 xd4) +. + (vor_0_x a1 a5 a6 (#4.0) (#4.0) xd5) + <. (--(#0.212))) + \/ + (cross_diag_x a3 a1 a4 xd4 (#4.0) xd3 a5 (#4.0) xd5 + <. (sqrt(#8.0))) \/ + (delta_x a1 a2 a3 (#4.0) xd3 (#4.0) <. (#0.0)) \/ + (delta_x a1 a3 a4 (#4.0) xd4 xd3 <. (#0.0)) \/ + (delta_x a1 a4 a5 (#4.0) xd5 xd4 <. (#0.0)) \/ + (delta_x a1 a5 a6 (#4.0) (#4.0) xd5 <. (#0.0)))))`;; + +(* interval verification by Ferguson *) +(* CCC false + +Bound: 0.894112044825 + +Point: [8.27682664562, 15.0624674033, 8.27682846171] + +Fixed. The sign on the cross-diag inequalty was reversed. + +From Mathematica: +{y3, y4, y5} = Sqrt[{8.27682664562, 15.0624674033, 8.27682846171}]; +Enclosed[2, 2, y3, 2, y4, 2, 2, 2, y5] +This yields 0.00216981, but the cross_diag_x constraint should keep +it above sqrt8. + +*) +let I_368258024_1= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +(* CCC See comments on _1 *) +let I_368258024_2= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_3= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_4= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_5= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_6= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_7= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_8= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + + +(* interval verification by Ferguson *) +let I_368258024_9= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_10= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_11= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_12= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_13= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_14= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_15= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_16= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_17= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_18= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_19= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_20= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_21= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_22= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_23= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_24= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_25= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_26= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_27= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_28= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_29= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_30= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_31= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_32= + all_forall + (list_mk_comb(I_368258024_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_33= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_34= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_35= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_36= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_37= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_38= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_39= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_40= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + + +(* interval verification by Ferguson *) +let I_368258024_41= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_42= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_43= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_44= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_45= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_46= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_47= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_48= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_49= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_50= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_51= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_52= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_53= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_54= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_55= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_56= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_57= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_58= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_59= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_60= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_61= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_62= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_368258024_63= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_368258024_64= + all_forall + (list_mk_comb(I_368258024_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + + +(* interval verification by Ferguson *) +(* CCC all fail/infeasible. Fixed cross-diag sign. Apply comments from 368258024. *) +let I_564618342_GEN= + `(\ a1 a2 a3 a4 a5 a6. + (ineq +[ +((#8.0) , xd3, (square(#3.2))); +((square(#3.2)), xd4 , square_4t0); +((#8.0) , xd5,(square(#3.2))) +] + (((tau_0_x a1 a2 a3 (#4.0) xd3 (#4.0)) +. + (tau_0_x a1 a3 a4 (#4.0) xd4 xd3) +. + (tau_0_x a1 a4 a5 (#4.0) xd5 xd4) +. + (tau_0_x a1 a5 a6 (#4.0) (#4.0) xd5) + >. (#0.54525)) + \/ + (cross_diag_x a3 a1 a4 xd4 (#4.0) xd3 a5 (#4.0) xd5 + <. (sqrt(#8.0))) \/ + (delta_x a1 a2 a3 (#4.0) xd3 (#4.0) <. (#0.0)) \/ + (delta_x a1 a3 a4 (#4.0) xd4 xd3 <. (#0.0)) \/ + (delta_x a1 a4 a5 (#4.0) xd5 xd4 <. (#0.0)) \/ + (delta_x a1 a5 a6 (#4.0) (#4.0) xd5 <. (#0.0)))))`;; + +(* interval verification by Ferguson *) +let I_564618342_1= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_2= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_3= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_4= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_5= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_6= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_7= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_8= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + + +(* interval verification by Ferguson *) +let I_564618342_9= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_10= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_11= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_12= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_13= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_14= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_15= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_16= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_17= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_18= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_19= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_20= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_21= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_22= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_23= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_24= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_25= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_26= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_27= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_28= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_29= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_30= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_31= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_32= + all_forall + (list_mk_comb(I_564618342_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_33= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_34= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_35= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_36= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_37= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_38= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_39= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_40= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + + +(* interval verification by Ferguson *) +let I_564618342_41= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_42= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_43= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_44= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_45= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_46= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_47= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_48= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_49= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_50= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_51= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_52= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_53= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_54= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_55= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_56= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_57= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_58= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_59= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_60= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_61= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_62= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_564618342_63= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_564618342_64= + all_forall + (list_mk_comb(I_564618342_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +let CKC_89384104= (* 18.5 *) + list_mk_conj[ + I_564618342_64;I_564618342_63;I_564618342_62;I_564618342_61; + I_564618342_60;I_564618342_59;I_564618342_58;I_564618342_57; + I_564618342_56;I_564618342_55;I_564618342_54;I_564618342_53; + I_564618342_52;I_564618342_51;I_564618342_50;I_564618342_49; + I_564618342_48;I_564618342_47;I_564618342_46;I_564618342_45; + I_564618342_44;I_564618342_43;I_564618342_42;I_564618342_41; + I_564618342_40;I_564618342_39;I_564618342_38;I_564618342_37; + I_564618342_36;I_564618342_35;I_564618342_34;I_564618342_33; + I_564618342_32;I_564618342_31;I_564618342_30;I_564618342_29;I_564618342_28;I_564618342_27; + I_564618342_26;I_564618342_25;I_564618342_24;I_564618342_23;I_564618342_22;I_564618342_21; + I_564618342_20;I_564618342_19;I_564618342_18;I_564618342_17;I_564618342_16;I_564618342_15; + I_564618342_14;I_564618342_13;I_564618342_12;I_564618342_11;I_564618342_10;I_564618342_9; + I_564618342_8;I_564618342_7;I_564618342_6;I_564618342_5;I_564618342_4;I_564618342_3;I_564618342_2;I_564618342_1; + I_368258024_64;I_368258024_63;I_368258024_62;I_368258024_61;I_368258024_60;I_368258024_59; + I_368258024_58;I_368258024_57;I_368258024_56;I_368258024_55;I_368258024_54;I_368258024_53; + I_368258024_52;I_368258024_51;I_368258024_50;I_368258024_49;I_368258024_48;I_368258024_47;I_368258024_46; + I_368258024_45;I_368258024_44;I_368258024_43;I_368258024_42;I_368258024_41;I_368258024_40;I_368258024_39; + I_368258024_38;I_368258024_37;I_368258024_36;I_368258024_35;I_368258024_34;I_368258024_33;I_368258024_32; + I_368258024_31;I_368258024_30;I_368258024_29;I_368258024_28;I_368258024_27;I_368258024_26;I_368258024_25; + I_368258024_24;I_368258024_23;I_368258024_22;I_368258024_21;I_368258024_20;I_368258024_19;I_368258024_18; + I_368258024_17;I_368258024_16;I_368258024_15;I_368258024_14;I_368258024_13;I_368258024_12;I_368258024_11; + I_368258024_10;I_368258024_9;I_368258024_8;I_368258024_7;I_368258024_6;I_368258024_5;I_368258024_4; + I_368258024_3;I_368258024_2;I_368258024_1; ];; + + +(* +LOC: 2002 k.c page 59 +Group_18.6 +*) + + +(* interval verification by Ferguson *) +(* CCC many fail/infeasible, cross diag constraint fixed. *) +let I_498774382_GEN= + `(\ a1 a2 a3 a4 a5 a6. + (ineq +[ +((#8.0) , x, (square(#3.2))); +((#8.0) , x'', (square(#3.2))); +((square(#3.2)), x' , (square(#3.78))) +] + (((vor_0_x a1 a2 a6 x (#4.0) (#4.0) ) + + (vor_0_x a2 a6 a5 (#4.0) x' x) + + (vor_0_x a2 a3 a5 x'' x' (#4.0) ) + + (vor_0_x a3 a4 a5 (#4.0) x'' (#4.0) ) + <. (--(#0.212))) + \/ + (cross_diag_x a3 a2 a5 x' x'' (#4.0) a6 (#4.0) x + <. ((#3.2))) \/ + (delta_x a1 a2 a6 x (#4.0) (#4.0) <. (#0.0)) \/ + (delta_x a2 a6 a5 (#4.0) x' x <. (#0.0)) \/ + (delta_x a2 a3 a5 x'' x' (#4.0) <. (#0.0)) \/ + (delta_x a3 a4 a5 (#4.0) x'' (#4.0) <. (#0.0)))))`;; + +(* interval verification by Ferguson *) +let I_498774382_1= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_2= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_3= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_4= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_5= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_6= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_7= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_8= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + + +(* interval verification by Ferguson *) +let I_498774382_9= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_10= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_11= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_12= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_13= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_14= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_15= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_16= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_17= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_18= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_19= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_20= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_21= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_22= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_23= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_24= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_25= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_26= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_27= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_28= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_29= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_30= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_31= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_32= + all_forall + (list_mk_comb(I_498774382_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_33= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_34= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_35= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_36= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_37= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_38= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_39= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_40= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + + +(* interval verification by Ferguson *) +let I_498774382_41= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_42= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_43= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_44= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_45= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_46= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_47= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_48= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_49= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_50= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_51= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_52= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_53= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_54= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_55= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_56= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_57= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_58= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_59= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_60= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_61= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_62= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_498774382_63= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_498774382_64= + all_forall + (list_mk_comb(I_498774382_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + + +(* interval verification by Ferguson *) +(* CCC many fail/infeasible, cross diag fixed. *) +let I_544865225_GEN= + `(\ a1 a2 a3 a4 a5 a6. + (ineq +[ +((#8.0) , x, (square(#3.2))); +((#8.0) , x'', (square(#3.2))); +((square(#3.2)), x' , (square(#3.78))) +] + (((tau_0_x a1 a2 a6 x (#4.0) (#4.0) ) + + (tau_0_x a2 a6 a5 (#4.0) x' x) + + (tau_0_x a2 a3 a5 x'' x' (#4.0) ) + + (tau_0_x a3 a4 a5 (#4.0) x'' (#4.0) ) + >. (#0.54525)) + \/ + (cross_diag_x a3 a2 a5 x' x'' (#4.0) a6 (#4.0) x + <. ((#3.2))) \/ + (delta_x a1 a2 a6 x (#4.0) (#4.0) <. (#0.0)) \/ + (delta_x a2 a6 a5 (#4.0) x' x <. (#0.0)) \/ + (delta_x a2 a3 a5 x'' x' (#4.0) <. (#0.0)) \/ + (delta_x a3 a4 a5 (#4.0) x'' (#4.0) <. (#0.0)))))`;; + +(* interval verification by Ferguson *) +let I_544865225_1= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_2= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_3= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_4= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_5= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_6= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_7= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_8= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + + +(* interval verification by Ferguson *) +let I_544865225_9= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_10= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_11= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_12= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_13= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_14= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_15= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_16= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_17= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_18= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_19= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_20= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_21= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_22= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_23= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_24= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_25= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_26= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_27= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_28= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_29= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_30= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_31= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_32= + all_forall + (list_mk_comb(I_544865225_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_33= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_34= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_35= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_36= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_37= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_38= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_39= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_40= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + + +(* interval verification by Ferguson *) +let I_544865225_41= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_42= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_43= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_44= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_45= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_46= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_47= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_48= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_49= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_50= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_51= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_52= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_53= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_54= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_55= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_56= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_57= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_58= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_59= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_60= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_61= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_62= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_544865225_63= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_544865225_64= + all_forall + (list_mk_comb(I_544865225_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +let CKC_859726639= list_mk_conj + [I_544865225_64;I_544865225_63;I_544865225_62;I_544865225_61;I_544865225_60;I_544865225_59; + I_544865225_58;I_544865225_57;I_544865225_56;I_544865225_55;I_544865225_54;I_544865225_53; + I_544865225_52;I_544865225_51;I_544865225_50;I_544865225_49;I_544865225_48;I_544865225_47; + I_544865225_46;I_544865225_45;I_544865225_44;I_544865225_43;I_544865225_42;I_544865225_41; + I_544865225_40;I_544865225_39;I_544865225_38;I_544865225_37;I_544865225_36;I_544865225_35; + I_544865225_34;I_544865225_33;I_544865225_32;I_544865225_31;I_544865225_30;I_544865225_29; + I_544865225_28;I_544865225_27;I_544865225_26;I_544865225_25;I_544865225_24;I_544865225_23; + I_544865225_22;I_544865225_21;I_544865225_20;I_544865225_19;I_544865225_18;I_544865225_17; + I_544865225_16;I_544865225_15;I_544865225_14;I_544865225_13;I_544865225_12;I_544865225_11; + I_544865225_10;I_544865225_9;I_544865225_8;I_544865225_7;I_544865225_6;I_544865225_5;I_544865225_4; + I_544865225_3;I_544865225_2;I_544865225_1; I_498774382_64;I_498774382_63;I_498774382_62;I_498774382_61; + I_498774382_60;I_498774382_59;I_498774382_58;I_498774382_57;I_498774382_56;I_498774382_55;I_498774382_54; + I_498774382_53;I_498774382_52;I_498774382_51;I_498774382_50;I_498774382_49;I_498774382_48;I_498774382_47; + I_498774382_46;I_498774382_45;I_498774382_44;I_498774382_43;I_498774382_42;I_498774382_41;I_498774382_40; + I_498774382_39;I_498774382_38;I_498774382_37;I_498774382_36;I_498774382_35;I_498774382_34;I_498774382_33; + I_498774382_32;I_498774382_31;I_498774382_30;I_498774382_29;I_498774382_28;I_498774382_27;I_498774382_26; + I_498774382_25;I_498774382_24;I_498774382_23;I_498774382_22;I_498774382_21;I_498774382_20;I_498774382_19; + I_498774382_18;I_498774382_17;I_498774382_16;I_498774382_15;I_498774382_14;I_498774382_13;I_498774382_12; + I_498774382_11;I_498774382_10;I_498774382_9;I_498774382_8;I_498774382_7;I_498774382_6;I_498774382_5; + I_498774382_4;I_498774382_3;I_498774382_2;I_498774382_1; ];; (* kc group 18.6 *) + + +(* +LOC: 2002 k.c page 59 +Group_18.7 +*) + + +(* interval verification by Ferguson *) +let I_234734606= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0) , x4, (#8.0)); + ((#8.0), x5, (square(#3.2))); + ((square_2t0), x6, (#8.0)) + ] + ( + ( (vor_0_x x1 x2 x3 x4 x5 x6 ) <. (--(#0.221))-(&.2)*(#0.009)))` ;; + + +(* interval verification by Ferguson *) +(* +CCC false + +Bound: 0.322153452432 + +Point: [4, 4.16407792566, 4, 7.99999999999, 10.2399999999, 8] + +Sign of the inequality was reversed. Fixed 1/31/2008 + +*) +let I_791682321= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0) , x4, (#8.0)); + ((#8.0), x5, (square(#3.2))); + ((square_2t0), x6, (#8.0)) + ] + ( + ( (tau_0_x x1 x2 x3 x4 x5 x6 ) >. (#0.486)-(&.2)*(#0.05925)))`;; + +let CKC_673399623= list_mk_conj [I_791682321;I_234734606; ];; (* kc group 18.7 *) + +(* +LOC: 2002 k.c page 59 + Group_18.8 +*) + +(* interval verification by Ferguson *) +(* cross-diag constraint fixed 1/31/2008 *) +let I_995351614_GEN= + `(\ a2 a3 a4 . + (ineq +[ +((#4.0) , a1, square_2t0); +((#8.0) , x, (square(#3.2))); +((#8.0) , b1, (square(#3.2))) +] + ((((vor_0_x a1 a2 a4 x square_2t0 b1) + + (vor_0_x a3 a2 a4 x (#4.0) (#4.0) ) + <. (--(#0.221))-(#0.009))) + \/ + (cross_diag_x a1 a2 a4 x square_2t0 b1 a3 (#4.0) (#4.0) + <. ((#3.2))) \/ + (delta_x a1 a2 a4 x square_2t0 b1 <. (#0.0)) \/ + (delta_x a3 a2 a4 x (#4.0) (#4.0) <. (#0.0)))))`;; + +(* interval verification by Ferguson *) +let I_995351614_1= + all_forall + (list_mk_comb(I_995351614_GEN,[`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_995351614_2= + all_forall + (list_mk_comb(I_995351614_GEN,[`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_995351614_3= + all_forall + (list_mk_comb(I_995351614_GEN,[`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_995351614_4= + all_forall + (list_mk_comb(I_995351614_GEN,[`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_995351614_5= + all_forall + (list_mk_comb(I_995351614_GEN,[`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_995351614_6= + all_forall + (list_mk_comb(I_995351614_GEN,[`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_995351614_7= + all_forall + (list_mk_comb(I_995351614_GEN,[`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_995351614_8= + all_forall + (list_mk_comb(I_995351614_GEN,[`square_2t0`;`square_2t0`;`square_2t0`]));; + + +(* interval verification by Ferguson *) +(* cross-diag constraint fixed 1/31/2008 *) + +let I_321843503_GEN= + `(\ a2 a3 a4 . + (ineq +[ +((#4.0) , a1, square_2t0); +((#8.0) , x, (square(#3.2))); +((#8.0) , b1, (square(#3.2))) +] + ((((tau_0_x a1 a2 a4 x square_2t0 b1) + + (tau_0_x a3 a2 a4 x (#4.0) (#4.0) ) + >. (#0.486)-(#0.0595))) + \/ + (cross_diag_x a1 a2 a4 x square_2t0 b1 a3 (#4.0) (#4.0) + <. ((#3.2))) \/ + (delta_x a1 a2 a4 x square_2t0 b1 <. (#0.0)) \/ + (delta_x a3 a2 a4 x (#4.0) (#4.0) <. (#0.0)))))`;; + +(* interval verification by Ferguson *) +let I_321843503_1= + all_forall + (list_mk_comb(I_321843503_GEN,[`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_321843503_2= + all_forall + (list_mk_comb(I_321843503_GEN,[`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_321843503_3= + all_forall + (list_mk_comb(I_321843503_GEN,[`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_321843503_4= + all_forall + (list_mk_comb(I_321843503_GEN,[`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_321843503_5= + all_forall + (list_mk_comb(I_321843503_GEN,[`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_321843503_6= + all_forall + (list_mk_comb(I_321843503_GEN,[`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_321843503_7= + all_forall + (list_mk_comb(I_321843503_GEN,[`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_321843503_8= + all_forall + (list_mk_comb(I_321843503_GEN,[`square_2t0`;`square_2t0`;`square_2t0`]));; + +let CKC_297256991= list_mk_conj [I_321843503_8;I_321843503_7;I_321843503_6;I_321843503_5; + I_321843503_4;I_321843503_3;I_321843503_2;I_321843503_1; I_995351614_8; + I_995351614_7;I_995351614_6;I_995351614_5;I_995351614_4;I_995351614_3; + I_995351614_2;I_995351614_1; ];; (* kc group 18.8 *) + +(* +LOC: 2002 k.c page 59--60 +Group_18.9 +*) + +(* interval verification by Ferguson, source/section_a46_2c.c *) +(* +CCC false +Bound: 0.196433568955 + +Point: [6.30009999999, 3.99999999999, 3.99999999999, 3.99999999999, 7.99999999999, 10.2399999999 +Typo: sqrt2 changed to sqrt8 below. +The typo appears in SPVI2002,SPVI1998. Note added to dcg_errata 1/31/2008. + +] + +*) +let I_354217730= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0) , x4, (#4.0)); + ((#8.0), x5, (square(#3.2))); + ((square(#3.2)), x6, (square(#3.47))) + ] + ( + ( (vor_0_x x1 x2 x3 x4 x5 x6 ) <. (--(#0.19))-((sqrt x5)-(sqrt8))*(#0.14)))`;; + + +(* interval verification in partK.cc, possibly also in Ferguson *) +let I_595674181= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0) , x4, (#4.0)); + ((#8.0), x5, (square(#3.2))); + ((square(#3.2)), x6, (square(#3.23))) + ] + ( + ( (tau_0_x x1 x2 x3 x4 x5 x6 ) >. (#0.281)))`;; + + +(* interval verification by Ferguson *) +let I_547486831= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0) , x4, (#4.0)); + (square_2t0, x5, square_2t0); + ((square(#3.2)), x6, (square(#3.2))) + ] + ( + ( (vor_0_x x1 x2 x3 x4 x5 x6 ) <. (--(#0.11))))`;; + +(* interval verification by Ferguson *) +let I_683897354= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0) , x4, (#4.0)); + (square_2t0, x5, square_2t0); + ((square(#3.2)), x6, (square(#3.2))) + ] + ( + ( (tau_0_x x1 x2 x3 x4 x5 x6 ) >. ((#0.205))))`;; + +(* interval verification by Ferguson *) +(* +CCC false +Bound: 0.0890816152428 + +Point: [3.99999999999, 3.99999999999, 3.99999999999, 3.99999999999, 10.2399999999, 3.99999999999] + +The inequality is OK in SPVI2002, but a sign error was introduced when it was +copied to this file. The typo has been corrected. +*) +let I_938003786= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0) , x4, (#4.0)); + ((#8.0) , x5, (square(#3.2))); + ((#4.0) , x6, (#4.0) ) + ] + ( + ( (vor_0_x x1 x2 x3 x4 x5 x6 ) <. ((#0.009) +. ((sqrt x5)-(sqrt8))*(#0.14))))`;; + +let CKC_861511432= list_mk_conj[I_938003786;I_683897354;I_547486831; + I_595674181;I_354217730; ];; (* kc group 18.9 *) + +(* +LOC: 2002 k.c page 60 + Group_18.10 +*) + + +(* interval verification by Ferguson *) +(* CCC many false/infeasible. Cross diag constraint fixed 1/31/2008 *) +let I_109046923_GEN= + `(\ a1 a2 a3 a4 . + (ineq +[ +((square ( # 3.2)) , x, (square_4t0)) +] + (((vor_0_x a1 a2 a4 x square_2t0 (#4.0) )+ + (vor_0_x a3 a2 a4 x (#4.0) (#8.0) ) + <. (--(#0.221))-(#0.0461)) + \/ + (cross_diag_x a1 a2 a4 x square_2t0 (#4.0) a3 (#4.0) (#8.0) + <. ((#3.2))) \/ + (delta_x a1 a2 a4 x square_2t0 (#4.0) <. (#0.0)) \/ + (delta_x a3 a2 a4 x (#4.0) (#8.0) <. (#0.0)))))`;; + +(* interval verification by Ferguson *) +let I_109046923_1= + all_forall + (list_mk_comb(I_109046923_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_109046923_2= + all_forall + (list_mk_comb(I_109046923_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_109046923_3= + all_forall + (list_mk_comb(I_109046923_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_109046923_4= + all_forall + (list_mk_comb(I_109046923_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_109046923_5= + all_forall + (list_mk_comb(I_109046923_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +(* CCC false + +Bound: 0.122198000542 +Point: [16.9619640963] +My calculation of the cross-diag is < 3.2 which means that this +isn't a counterexample. +*) +let I_109046923_6= + all_forall + (list_mk_comb(I_109046923_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_109046923_7= + all_forall + (list_mk_comb(I_109046923_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_109046923_8= + all_forall + (list_mk_comb(I_109046923_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_109046923_9= + all_forall + (list_mk_comb(I_109046923_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_109046923_10= + all_forall + (list_mk_comb(I_109046923_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_109046923_11= + all_forall + (list_mk_comb(I_109046923_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_109046923_12= + all_forall + (list_mk_comb(I_109046923_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_109046923_13= + all_forall + (list_mk_comb(I_109046923_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_109046923_14= + all_forall + (list_mk_comb(I_109046923_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_109046923_15= + all_forall + (list_mk_comb(I_109046923_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_109046923_16= + all_forall + (list_mk_comb(I_109046923_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + + + +(* interval verification by Ferguson *) +(* CCC many false/infeasible, cross diag fixed 1/31/2008 *) +let I_642590101_GEN= + `(\ a1 a2 a3 a4 . + (ineq +[ +((square ( # 3.2)) , x, (square_4t0)) +] + (((tau_0_x a1 a2 a4 x square_2t0 (#4.0) )+ + (tau_0_x a3 a2 a4 x (#4.0) (#8.0) ) + >. (#0.486)) + \/ + (cross_diag_x a1 a2 a4 x square_2t0 (#4.0) a3 (#4.0) (#8.0) + <. ((#3.2))) \/ + (delta_x a1 a2 a4 x square_2t0 (#4.0) <. (#0.0)) \/ + (delta_x a3 a2 a4 x (#4.0) (#8.0) <. (#0.0)))))`;; + +(* interval verification by Ferguson *) +let I_642590101_1= + all_forall + (list_mk_comb(I_642590101_GEN,[`#4.0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_642590101_2= + all_forall + (list_mk_comb(I_642590101_GEN,[`#4.0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_642590101_3= + all_forall + (list_mk_comb(I_642590101_GEN,[`#4.0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_642590101_4= + all_forall + (list_mk_comb(I_642590101_GEN,[`#4.0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_642590101_5= + all_forall + (list_mk_comb(I_642590101_GEN,[`#4.0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +(* CCC false +Bound: 0.218305970844 + +Point: [16.9397074241] +My calculation of the cross-diag is < 3.2, so this is not a counterexample. +*) +let I_642590101_6= + all_forall + (list_mk_comb(I_642590101_GEN,[`#4.0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_642590101_7= + all_forall + (list_mk_comb(I_642590101_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_642590101_8= + all_forall + (list_mk_comb(I_642590101_GEN,[`#4.0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_642590101_9= + all_forall + (list_mk_comb(I_642590101_GEN,[`square_2t0`;`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_642590101_10= + all_forall + (list_mk_comb(I_642590101_GEN,[`square_2t0`;`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_642590101_11= + all_forall + (list_mk_comb(I_642590101_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_642590101_12= + all_forall + (list_mk_comb(I_642590101_GEN,[`square_2t0`;`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_642590101_13= + all_forall + (list_mk_comb(I_642590101_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_642590101_14= + all_forall + (list_mk_comb(I_642590101_GEN,[`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_642590101_15= + all_forall + (list_mk_comb(I_642590101_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_642590101_16= + all_forall + (list_mk_comb(I_642590101_GEN,[`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`]));; + +let CKC_746445726= list_mk_conj[ + I_642590101_16;I_642590101_15;I_642590101_14;I_642590101_13;I_642590101_12; + I_642590101_11;I_642590101_10;I_642590101_9;I_642590101_8;I_642590101_7; + I_642590101_6;I_642590101_5;I_642590101_4;I_642590101_3;I_642590101_2; + I_642590101_1; I_109046923_16;I_109046923_15;I_109046923_14;I_109046923_13; + I_109046923_12;I_109046923_11;I_109046923_10;I_109046923_9;I_109046923_8; + I_109046923_7;I_109046923_6;I_109046923_5;I_109046923_4;I_109046923_3; + I_109046923_2;I_109046923_1; ];; (* kc group 18.10 *) + +(* +LOC: 2002 k.c page 60 +Group_18.11 +*) + +(* CCC Error: for much of this group a3 is not in scope here! Fixed 1/31/2008. *) +(* interval verification by Ferguson *) +let I_160800042_GEN= + `(\ a2 a4 . + (ineq +[ +((#8.0) , x, (square(#3.2))); +((#8.0) , x', (square(#3.2))) +] + (((vor_0_x a2 (#4.0) a1 x (#4.0) (#4.0))+ + (vor_0_x a1 (#4.0) a5 x' square_2t0 x)+ + (vor_0_x a5 (#4.0) a4 (#4.0) (#4.0) x') + <. (--(#0.221))) + \/ + (delta_x a2 (#4.0) a1 x (#4.0) (#4.0) <. (#0.0)) \/ + (delta_x a1 (#4.0) a5 x' square_2t0 x <. (#0.0)) \/ + (delta_x a5 (#4.0) a4 (#4.0) (#4.0) x' <. (#0.0)))))`;; + +(* interval verification by Ferguson *) +let I_160800042_1= + all_forall + (list_mk_comb(I_160800042_GEN,[`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_160800042_2= + all_forall + (list_mk_comb(I_160800042_GEN,[`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_160800042_3= + all_forall + (list_mk_comb(I_160800042_GEN,[`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_160800042_4= + all_forall + (list_mk_comb(I_160800042_GEN,[`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_690272881_GEN= + `(\ a2 a4 . + (ineq +[ +((#8.0) , x, (square(#3.2))); +((#8.0) , x', (square(#3.2))) +] + (((tau_0_x a2 (#4.0) a1 x (#4.0) (#4.0))+ + (tau_0_x a1 (#4.0) a5 x' square_2t0 x)+ + (tau_0_x a5 (#4.0) a4 (#4.0) (#4.0) x') + >. (#0.486)) + \/ + (delta_x a2 (#4.0) a1 x (#4.0) (#4.0) <. (#0.0)) \/ + (delta_x a1 (#4.0) a5 x' square_2t0 x <. (#0.0)) \/ + (delta_x a5 (#4.0) a4 (#4.0) (#4.0) x' <. (#0.0)))))`;; + +(* interval verification by Ferguson *) +let I_690272881_1= + all_forall + (list_mk_comb(I_690272881_GEN,[`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_690272881_2= + all_forall + (list_mk_comb(I_690272881_GEN,[`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_690272881_3= + all_forall + (list_mk_comb(I_690272881_GEN,[`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_690272881_4= + all_forall + (list_mk_comb(I_690272881_GEN,[`square_2t0`;`square_2t0`]));; + +let CKC_897046482= list_mk_conj[ + I_690272881_4;I_690272881_3;I_690272881_2;I_690272881_1 + ; I_160800042_4;I_160800042_3;I_160800042_2;I_160800042_1; ];; (* kc group 18.11 *) + + +(* +LOC: 2002 k.c page 60 +Group_18.12 +*) + + + +(* interval verification by Ferguson *) +(* Note that this inequality only applies to a convex pentagon *) + +(* CCC many false/infeasible. I don't see any problem with it. Do you have a counterexample? + In SPVI2002 there is a typo, but it appears to be correct in this file. *) +let I_713930036_GEN= + `(\ a1 a5 . + (ineq +[ +((square(#3.2)),x,square_4t0); +((square(#3.2)),x',square_4t0) + ] + (((vor_0_x (#4.0) (#4.0) a1 x (#4.0) (#4.0))+ + (vor_0_x a1 (#4.0) a5 x' square_2t0 x)+ + (vor_0_x a5 (#4.0) (#4.0) (#4.0) (#4.0) x') + <. (--(#0.221))) + \/ + ((dih_x (#4.0) a5 (#4.0) (#4.0) (#4.0) x') + + (dih_x (#4.0) a5 a1 square_2t0 x x') + + (dih_x (#4.0) (#4.0) a1 (#4.0) x (#4.0) ) < acs(--(&.53)/(&.75))) \/ + (delta_x (#4.0) (#4.0) a1 x (#4.0) (#4.0) <. (#0.0)) \/ + (delta_x a1 (#4.0) a5 x' square_2t0 x <. (#0.0)) \/ + (delta_x a5 (#4.0) (#4.0) (#4.0) (#4.0) x' <. (#0.0)))))`;; + +(* interval verification by Ferguson *) +(* +CCC false. See note on _4 +Bound: 0.0216447124442 + +Point: [11.9999999941, 11.9999998104] + +*) +let I_713930036_1= + all_forall + (list_mk_comb(I_713930036_GEN,[`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +(* +CCC false. See note on _4 +Bound: 0.114998022539 + +Point: [11.9999998616, 13.9200391298] + +*) +let I_713930036_2= + all_forall + (list_mk_comb(I_713930036_GEN,[`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +(* +CCC false. See note on _4 +Bound: 0.114998022544 + +Point: [13.9200391298, 11.9999998616] + +*) +let I_713930036_3= + all_forall + (list_mk_comb(I_713930036_GEN,[`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +(* CCC false +Bound: 0.112874764386 + +Point: [13.9200392672, 13.9200389776] + +Tom, I know you think this is not because of instability, +but my calculations give +[0.112294486983,1.91893398547,1.95123394064E~06,393.739050459,0.000453238439945] +for the values of the respective functions. + +Sean, +The arccos(-53/75) is approximately 2.35557. +The left-hand side for that inequality is about 1.13184. +(Two of the dihedrals are nearly zero because delta is about 0. +The middle piece has dih 1.13184...) + +Here is my theory. I suspect you are still not switching between different +formulas for dih on different parts of the domain, as you should be. +This is causing your dihedral function to return an angle near pi, +when it should be returning an angle near 0. + +Note that your constant 1.91893398547 + (2.3557 - 1.13184) is +approximately 3.13562, which is suspiciously close to pi. + +Tom, It was worse than that. I didn't implement acos +correctly. :( + +*) +let I_713930036_4= + all_forall + (list_mk_comb(I_713930036_GEN,[`square_2t0`;`square_2t0`]));; + + + +(* interval verification by Ferguson *) +let I_724922588_GEN= + `(\ a1 a5 . + (ineq +[ +((square(#3.2)),x,square_4t0); +((square(#3.2)),x',square_4t0) + ] + (((tau_0_x (#4.0) (#4.0) a1 x (#4.0) (#4.0))+ + (tau_0_x a1 (#4.0) a5 x' square_2t0 x)+ + (tau_0_x a5 (#4.0) (#4.0) (#4.0) (#4.0) x') + >. (#0.221)) + \/ + ((dih_x (#4.0) a5 (#4.0) (#4.0) (#4.0) x') + + (dih_x (#4.0) a5 a1 square_2t0 x x') + + (dih_x (#4.0) (#4.0) a1 (#4.0) x (#4.0) ) < acs(--(&.53)/(&.75))) \/ + (delta_x (#4.0) (#4.0) a1 x (#4.0) (#4.0) <. (#0.0)) \/ + (delta_x a1 (#4.0) a5 x' square_2t0 x <. (#0.0)) \/ + (delta_x a5 (#4.0) (#4.0) (#4.0) (#4.0) x' <. (#0.0)))))`;; + +(* interval verification by Ferguson *) +let I_724922588_1= + all_forall + (list_mk_comb(I_724922588_GEN,[`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_724922588_2= + all_forall + (list_mk_comb(I_724922588_GEN,[`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_724922588_3= + all_forall + (list_mk_comb(I_724922588_GEN,[`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_724922588_4= + all_forall + (list_mk_comb(I_724922588_GEN,[`square_2t0`;`square_2t0`]));; + +let CKC_928952883= list_mk_conj[I_724922588_4;I_724922588_3;I_724922588_2;I_724922588_1; + I_713930036_4;I_713930036_3;I_713930036_2;I_713930036_1; ];; (* kc group 18.12 *) + +(* +LOC: 2002 k.c page 61 +Group_18.13 +*) + +(* interval verification by Ferguson *) +(* cross_diag constraint fixed 1/31/2008, + Fixed bug in third branch of vor_0_x and delta_x 2/1/2008. + It is correctly stated in SPVI2002. + *) + +let I_821730621_GEN= + `(\ a2 a4 a5 . + (ineq +[ +((#8.0) , x, (square(#3.2))); +(square(#3.2),x',square_4t0) +] + (((vor_0_x (#4.0) a2 (#4.0) (#4.0) x (#4.0))+ + (vor_0_x (#4.0) (#4.0) a4 (#4.0) x' x)+ + (vor_0_x (#4.0) a4 a5 (#4.0) (square_2t0) x') + <. (--(#0.221))) + \/ + (cross_diag_x (#4.0) (#4.0) a4 x' (#4.0) x a5 (#4.0) square_2t0 + <. ((#3.2))) \/ + (delta_x (#4.0) a2 (#4.0) (#4.0) x (#4.0) <. (#0.0)) \/ + (delta_x (#4.0) (#4.0) a4 (#4.0) x' x <. (#0.0)) \/ + (delta_x (#4.0) a4 a5 (#4.0) (square_2t0) x' <. (#0.0)))))`;; + + +(* interval verification by Ferguson *) +(* CCC (not) false +Bound: 0.189254861226 + +Point: [10.0605373011, 11.9999998741] +{y,yp} = {y, yp} = {10.0605373011, 11.9999998741} // Sqrt; +CrossDiag[y1_, y2_, y3_, y4_, y5_, y6_, y7_, y8_, y9_] := + Enclosed[y1, y5, y6, + y4, y2, y3, y7, y8, y9]; +CrossDiag[2, 2, 2, yp, 2, y, 2, 2, 2.51]; (* yields 3.28.. *) +tt = {VorVc[2, 2, 2, 2, y, 2], VorVc[2, 2, 2, 2, yp, y], VorVc[2, 2, 2, 2, 2.51, yp]}; +Plus @@ tt + +{Delta[2, 2, 2, 2, y, 2], Delta[2, 2, 2, 2, yp, y], Delta[2, 2, 2, 2, 2.51, yp]}; +(* Yields {78.04, 143.98, 6.043*10^-6} *) + +*) + +let I_821730621_1= + all_forall + (list_mk_comb(I_821730621_GEN,[`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_821730621_2= + all_forall + (list_mk_comb(I_821730621_GEN,[`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +(* CCC false +Bound: 0.0948377771411 + +Point: [8.57185841044, 13.3519358538] +*) +let I_821730621_3= + all_forall + (list_mk_comb(I_821730621_GEN,[`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_821730621_4= + all_forall + (list_mk_comb(I_821730621_GEN,[`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +(* +CCC +Bound: 0.177722784329 + +Point: [9.69989999996, 11.9999999999] + +*) +let I_821730621_5= + all_forall + (list_mk_comb(I_821730621_GEN,[`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_821730621_6= + all_forall + (list_mk_comb(I_821730621_GEN,[`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_821730621_7= + all_forall + (list_mk_comb(I_821730621_GEN,[`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_821730621_8= + all_forall + (list_mk_comb(I_821730621_GEN,[`square_2t0`;`square_2t0`;`square_2t0`]));; + + + +(* interval verification by Ferguson *) +(* cross diag constraint fixed 1/31/2008 *) +(* b5 edge length in tau_0_x and delta_x fixed 2/1/2008 *) + +let I_890642961_GEN= + `(\ a2 a4 a5 . + (ineq +[ +((#8.0) , x, (square(#3.2))); +(square(#3.2),x',square_4t0) +] + (((tau_0_x (#4.0) a2 (#4.0) (#4.0) x (#4.0))+ + (tau_0_x (#4.0) (#4.0) a4 (#4.0) x' x)+ + (tau_0_x (#4.0) a4 a5 (#4.0) (square_2t0) x') + >. (#0.486)) + \/ + (cross_diag_x (#4.0) (#4.0) a4 x' (#4.0) x a5 (#4.0) square_2t0 + <. ((#3.2))) \/ + (delta_x (#4.0) a2 (#4.0) (#4.0) x (#4.0) <. (#0.0)) \/ + (delta_x (#4.0) (#4.0) a4 (#4.0) x' x <. (#0.0)) \/ + (delta_x (#4.0) a4 a5 (#4.0) (square_2t0) x' <. (#0.0)))))`;; + + +(* interval verification by Ferguson *) +(* +CCC +Bound: 0.282549826421 + +Point: [9.27255301111, 11.9999999996]; +{y,yp} = {9.27255301111, 11.9999999996}//Sqrt; +tt = {tauVc[2,2,2,2,y,2],tauVc[2,2,2,2,yp,y],tauVc[2,2,2,2,2.51,yp]} +Plus @@ tt +{Delta[2,2,2,2,y,2],Delta[2,2,2,2,yp,y],Delta[2,2,2,2,2.51,yp]} +CrossDiagE[2,2,2,yp,2,y,2,2,2.51] +*) +let I_890642961_1= + all_forall + (list_mk_comb(I_890642961_GEN,[`#4.0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_890642961_2= + all_forall + (list_mk_comb(I_890642961_GEN,[`#4.0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +let I_890642961_3= + all_forall + (list_mk_comb(I_890642961_GEN,[`#4.0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +(* CCC See comments above +Bound: 0.0169200764 + +Point: [9.26173984803, 11.7132329274] +*) +let I_890642961_4= + all_forall + (list_mk_comb(I_890642961_GEN,[`#4.0`;`square_2t0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +(* CCC See comments above +Bound: 0.245027755733 + +Point: [9.42893490619, 11.9999999297] +*) +let I_890642961_5= + all_forall + (list_mk_comb(I_890642961_GEN,[`square_2t0`;`#4.0`;`#4.0`]));; + +(* interval verification by Ferguson *) +let I_890642961_6= + all_forall + (list_mk_comb(I_890642961_GEN,[`square_2t0`;`#4.0`;`square_2t0`]));; + +(* interval verification by Ferguson *) +(* CCC See comments above +Bound: 0.00265356467075 + +Point: [8.13556916171, 12.1086273347] +*) +let I_890642961_7= + all_forall + (list_mk_comb(I_890642961_GEN,[`square_2t0`;`square_2t0`;`#4.0`]));; + +(* interval verification by Ferguson *) +(* CCC See comments above +Bound: 0.0405287948262 + +Point: [9.69989999999, 11.7132329804] +*) +let I_890642961_8= + all_forall + (list_mk_comb(I_890642961_GEN,[`square_2t0`;`square_2t0`;`square_2t0`]));; + +let CKC_673800906= list_mk_conj[I_890642961_8;I_890642961_7;I_890642961_6;I_890642961_5; + I_890642961_4;I_890642961_3;I_890642961_2;I_890642961_1; + I_821730621_8;I_821730621_7;I_821730621_6;I_821730621_5; + I_821730621_4;I_821730621_3;I_821730621_2;I_821730621_1; ];; (* kc group 18.13 *) + +(* +LOC: 2002 k.c page 60 +Group_18.14 +*) + +(* interval verification by Ferguson *) +let I_341667126= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0) , x4, (#8.0)); + (square_2t0 , x5, (#8.0) ); + (square_2t0 , x6, (#8.0) ) + ] + (vor_0_x x1 x2 x3 x4 x5 x6 <. --(#0.168) - (#0.009)) + `;; + +(* interval verification by Ferguson *) +let I_535906363= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0) , x4, (#8.0)); + (square_2t0 , x5, (#8.0) ); + (square_2t0 , x6, (#8.0) ) + ] + (tau_0_x x1 x2 x3 x4 x5 x6 > (#0.352) - (#0.05925)) + `;; + +let CKC_315678695= list_mk_conj[I_535906363;I_341667126; ];; (* kc group 18.14 *) + +(* +LOC: 2002 k.c page 61 +Group_18.15 +*) + +(* +CCC fail concerned about this one... Thanks for the concern, man. + +Bound: 0.0215663812919 + +Point: [3.99999999999, 3.99999999999, 3.99999999999, 3.99999999999, 7.99999999999, 8] + +A typo in the constant fixed 1/31/2008. +*) +let I_516537931= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#8.0) , x5, square (#3.2)); + ((#8.0) , x6, square (#3.2)) + ] + (vor_0_x x1 x2 x3 x4 x5 x6 <. --(#0.146) ) + `;; + + +let I_130008809_1= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#8.0) , x5, square (#3.2)); + ((#8.0) , x6, square (#3.2)) + ] + (tau_0_x x1 x2 x3 x4 x5 x6 + + (tau_0_x x1 (#4.0) x3 (#4.0) x5 (#4.0)) >. (#0.31) ) + `;; + + +let I_130008809_2= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#8.0) , x5, square (#3.2)); + ((#8.0) , x6, square (#3.2)) + ] + (tau_0_x x1 x2 x3 x4 x5 x6 + + (tau_0_x x1 square_2t0 x3 (#4.0) x5 (#4.0)) >. (#0.31) ) + `;; + +let CKC_468742136= list_mk_conj[I_130008809_2;I_130008809_1;I_516537931; ];; (* kc group 18.15 *) + +(* +LOC: 2002 k.c page 60 +Group_18.16 +*) + +let I_531861442= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + (square_2t0 , x5, (#8.0) ); + ((#8.0) , x6, square (#3.2)) + ] + (vor_0_x x1 x2 x3 x4 x5 x6 <. --(#0.084) ) + `;; + + +(* I_292827481 deprecated *) + + +(* interval verification in partK.cc *) +let I_710875528= + all_forall `ineq + [((#4.0), x1, (#4.0) ); + ((#4.0), x2, square_2t0); + ((#4.0), x3, (#4.0) ); + ((#4.0), x4, (#4.0) ); + ((#8.0) , x5, square (#3.2)); + ((#4.0), x6, (#4.0) ) + ] + (vor_0_x x1 x2 x3 x4 x5 x6 < (#0.009) + ((sqrt x5 - sqrt8)*(#0.1)) ) + `;; + + +let I_286122364= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + (square_2t0 , x5, (#8.0) ); + ((#8.0) , x6, square (#3.2)) + ] + (tau_0_x x1 x2 x3 x4 x5 x6 >. (#0.176) ) + `;; + +let CKC_938091791= list_mk_conj[I_286122364;I_710875528;(* I_292827481;*)I_531861442; ];; (* kc group 18.16 *) + +(* end of 2002:kc *) + + +(* +LOC: 2002 IV +group hash codes spIV : +*) + + +(* + +Here are the composite inequalities +for the various groups: + + +CIVA1_193836552 + +CIVA2_815492935 + +CIVA3_729988292 + +CIVA4_531888597 + +CIVA5_628964355 +CIVA6_934150983 + +CIVA7_187932932 + +CIVA8_83777706 + +CIVA9_618205535 + +CIVA10_73974037 + + +CIVA11_764978100 +CIVA12_855294746 + + +CIVA13_148776243 +CIVA14_984628285 + +CIVA15_311189443 + +CIVA16_163548682 +CIVA17_852270725 +CIVA18_819209129 + +CIVA19_128523606 +CIVA20_874876755 + + +CIVA21_692155251 +CIVA22_485049042 + +CIVA23_209361863 +CIVA24_835344007 + + +*) + +(* +LOC: 2002 IV page 46. +Section A1 +*) + +(* +It says we may assume y6=2, and equality is entered below in the bounds +*) +(* interval verification by Ferguson *) +(* moved 757995764 to inequality_spec.ml *) + + + + + + + + + + + + + + + + +(* interval verification by Ferguson *) +(* moved 735258244 to inequality_spec.ml *) + + + + + +(* interval verification by Ferguson *) +let I_343330051= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, (square (#3.2))); + + (square_2t0, x5, square_2t0); + (square_2t0, x6, square_2t0) + ] + ( + (beta (arclength (sqrt x1) t0 (#1.6)) (arclength (sqrt x1) (sqrt x2) (sqrt x6))) <. + (dih2_x x1 x2 x3 x4 x5 x6))`;; + + + + + + + + + + +(* interval verification by Ferguson *) +let I_49446087= + all_forall `ineq + [((square (#2.2)), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, (square (#3.2))); + + ((square (#3.2)), x5, (square (#3.2))); + ((#4.0), x6, (#4.0)) + ] + ( + (beta (arclength (sqrt x1) t0 (#1.6)) (arclength (sqrt x1) (sqrt x2) (sqrt x6))) <. + (dih2_x x1 x2 x3 x4 x5 x6))`;; + + + +(* interval verification by Ferguson *) +let I_799187442 = + all_forall `ineq + [ + ((#4.0), x1, (square (#2.2))); + ((#4.0), x2, (square_2t0)); + (square_2t0, x3, square_2t0); + ((square (#3.2)), x4, (square (#3.2))); + ((square (#3.2)), x5, (square (#3.2))); + ((#4.0), x6, (#4.0)) + ] + (let y1 = (sqrt x1) in + let y2 = (sqrt x2) in + let psi = (arclength y1 t0 (#1.6)) in + let eta126 = (eta_x x1 x2 x6) in + ((dihR (y2/(&2)) eta126 (y1/(&.2 * cos(psi)))) + <. + (dih2_x x1 x2 x3 x4 x5 x6) + ))`;; + + +let I_275706375= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((square (#2.77)), x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vort_x x1 x2 x3 x4 x5 x6 (#1.385)) <. (#0.00005)) \/ + ( (eta_x x4 x5 x6) <. (sqrt (#2.0))))`;; + + + + +let I_324536936= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((square (#2.77)), x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vort_x x1 x2 x3 x4 x5 x6 (#1.385)) <. (#0.00005)) \/ + ( (eta_x x2 x3 x4) <. (sqrt (#2.0))))`;; + + + +let I_983547118= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((square (#2.77)), x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (tauVt_x x1 x2 x3 x4 x5 x6 (#1.385)) >. (#0.0682)) \/ + ( (eta_x x4 x5 x6) <. (sqrt (#2.0))))`;; + + +let I_206278009= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((square (#2.77)), x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (tauVt_x x1 x2 x3 x4 x5 x6 (#1.385)) >. (#0.0682)) \/ + ( (eta_x x2 x3 x4) <. (sqrt (#2.0))))`;; + + +(* Group A1 *) +let CIVA1_193836552 = list_mk_conj [ + I_757995764;I_735258244;I_343330051;I_49446087;I_799187442 ; + I_275706375;I_324536936;I_983547118;I_206278009;];; + +(* + +LOC: 2002 IV, page 46 +Section A2 +*) + + +let I_413688580= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (nu_x x1 x2 x3 x4 x5 x6) <. ( (--. (#4.3223)) +. ( (#4.10113) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + + +let I_805296510= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (nu_x x1 x2 x3 x4 x5 x6) <. ( (--. (#0.9871)) +. ( (#0.80449) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + + +let I_136610219= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (nu_x x1 x2 x3 x4 x5 x6) <. ( (--. (#0.8756)) +. ( (#0.70186) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + + +let I_379204810= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (nu_x x1 x2 x3 x4 x5 x6) <. ( (--. (#0.3404)) +. ( (#0.24573) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + + + +let I_878731435= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (nu_x x1 x2 x3 x4 x5 x6) <. ( (--. (#0.0024)) +. ( (#0.00154) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + + +let I_891740103= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (nu_x x1 x2 x3 x4 x5 x6) <. ( (#0.1196) +. ( (--. (#0.07611)) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + +let CIVA2_815492935 = list_mk_conj [ + I_413688580;I_805296510;I_136610219; + I_379204810;I_878731435;I_891740103;];; + +(* + +LOC: 2002 IV, page 46 +Section A3 +*) + + + +let I_334002329= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (( --. ) (taunu_x x1 x2 x3 x4 x5 x6)) <. ( (--. (#4.42873)) +. ( (#4.16523) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + + + +let I_883139937= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (( --. ) (taunu_x x1 x2 x3 x4 x5 x6)) <. ( (--. (#1.01104)) +. ( (#0.78701) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + + +let I_507989176= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (( --. ) (taunu_x x1 x2 x3 x4 x5 x6)) <. ( (--. (#0.99937)) +. ( (#0.77627) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + + + +let I_244435805= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (( --. ) (taunu_x x1 x2 x3 x4 x5 x6)) <. ( (--. (#0.34877)) +. ( (#0.21916) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + + +let I_930176500= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (( --. ) (taunu_x x1 x2 x3 x4 x5 x6)) <. ( (--. (#0.11434)) +. ( (#0.05107) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + + +let I_815681339= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (( --. ) (taunu_x x1 x2 x3 x4 x5 x6)) <. ( (#0.07749) +. ( (--. (#0.07106)) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + +let CIVA3_729988292 = list_mk_conj + [ I_334002329;I_883139937;I_507989176;I_244435805;I_930176500; + I_815681339;];; + +(* + +LOC: 2002 IV, page 47 +Section A4 +*) + + +(* +In this section and in section A5 we assumed dih_x ( <=. ) (#2.46) +*) +let I_649592321= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vorC0_x x1 x2 x3 x4 x5 x6) <. ( (--. (#3.421)) +. ( (#2.28501) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + +let I_600996944= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vorC0_x x1 x2 x3 x4 x5 x6) <. ( (--. (#2.616)) +. ( (#1.67382) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + +let I_70667639= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vorC0_x x1 x2 x3 x4 x5 x6) <. ( (--. (#1.4486)) +. ( (#0.8285) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + +let I_99182343= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vorC0_x x1 x2 x3 x4 x5 x6) <. ( (--. (#0.79)) +. ( (#0.390925) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + +let I_578762805= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vorC0_x x1 x2 x3 x4 x5 x6) <. ( (--. (#0.3088)) +. ( (#0.12012) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + +let I_557125557= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vorC0_x x1 x2 x3 x4 x5 x6) <. ( (--. (#0.1558)) +. ( (#0.0501) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + +let CIVA4_531888597= list_mk_conj + [ I_649592321;I_600996944;I_70667639;I_99182343;I_578762805; + I_557125557;];; +(* + +LOC: 2002 IV, page 47 +Section A5 +*) + + +(* +?comment at the beginning of the section + +not indicated in file +*) + +let I_719735900= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (tauC0_x x1 x2 x3 x4 x5 x6)) <. ( (--. (#3.3407)) +. ( (#2.1747) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + +let I_359616783= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (tauC0_x x1 x2 x3 x4 x5 x6)) <. ( (--. (#2.945)) +. ( (#1.87427) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + +let I_440833181= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (tauC0_x x1 x2 x3 x4 x5 x6)) <. ( (--. (#1.5035)) +. ( (#0.83046) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + +let I_578578364= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (tauC0_x x1 x2 x3 x4 x5 x6)) <. ( (--. (#1.0009)) +. ( (#0.48263) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + + +let I_327398152= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (tauC0_x x1 x2 x3 x4 x5 x6)) <. ( (--. (#0.7787)) +. ( (#0.34833) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + +let I_314861952= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (tauC0_x x1 x2 x3 x4 x5 x6)) <. ( (--. (#0.4475)) +. ( (#0.1694) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + +let I_234753056= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (tauC0_x x1 x2 x3 x4 x5 x6)) <. ( (--. (#0.2568)) +. ( (#0.0822) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + +let CIVA5_628964355= list_mk_conj + [ I_719735900;I_359616783;I_440833181;I_578578364;I_327398152; + I_314861952;I_234753056;];; +(* + +LOC: 2002 IV, page 47 +Section A6 +*) + +(* +In this section and in section A7 we assumed dih_x ( <=. ) (#2.46) +*) + + +let I_555481748= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. ( (--. (#3.58)) +. ( (#2.28501) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + +let I_615152889= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. ( (--. (#2.715)) +. ( (#1.67382) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + +let I_647971645= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. ( (--. (#1.517)) +. ( (#0.8285) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + +let I_516606403= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. ( (--. (#0.858)) +. ( (#0.390925) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + +let I_690552204= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. ( (--. (#0.358)) +. ( (#0.12012) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + +let I_852763473= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. ( (--. (#0.186)) +. ( (#0.0501) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + +let CIVA6_934150983 = list_mk_conj + [ I_555481748;I_615152889;I_647971645;I_516606403;I_690552204; + I_852763473;];; + +(* + +LOC: 2002 IV, page 47 +Section A7 +*) + + +let I_679673664= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (tau_0_x x1 x2 x3 x4 x5 x6)) <. ( (--. (#3.48)) +. ( (#2.1747) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + +let I_926514235= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (tau_0_x x1 x2 x3 x4 x5 x6)) <. ( (--. (#3.06)) +. ( (#1.87427) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + +let I_459744700= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (tau_0_x x1 x2 x3 x4 x5 x6)) <. ( (--. (#1.58)) +. ( (#0.83046) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + +let I_79400832= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (tau_0_x x1 x2 x3 x4 x5 x6)) <. ( (--. (#1.06)) +. ( (#0.48263) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + +let I_277388353= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (tau_0_x x1 x2 x3 x4 x5 x6)) <. ( (--. (#0.83)) +. ( (#0.34833) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + +let I_839852751= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (tau_0_x x1 x2 x3 x4 x5 x6)) <. ( (--. (#0.50)) +. ( (#0.1694) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + + +let I_787458652= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (tau_0_x x1 x2 x3 x4 x5 x6)) <. ( (--. (#0.29)) +. ( (#0.0822) *. (dih_x x1 x2 x3 x4 x5 x6)))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.46)))`;; + + +let CIVA7_187932932= list_mk_conj + [ I_679673664;I_926514235;I_459744700;I_79400832;I_277388353; + I_839852751;I_787458652;];; + +(* + +LOC: 2002 IV, page 47 +Section A8 +*) + +(* +Need upper bound for y4 in all equations in this section +Change so that each y4 is equality. +*) + + +let I_499014780= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.23))`;; + + + +let I_901845849= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.4167))`;; + + + +let I_410091263= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((square (#3.2)), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.65))`;; + + + +let I_125103581= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, (#4.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#0.956))`;; + + + +let I_504968542= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, (#4.0)); + + ((#4.0), x5, (#8.0)); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#0.28))`;; + + + +let I_770716154= + all_forall `ineq + [((square (#2.7)), x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((square (#3.2)), x4, (square (#3.2))); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.714))`;; + + + +let I_666090270= + all_forall `ineq + [(square_2t0, x1, (square (#2.7))); + ((#4.0), x2, (square (#2.25))); + ((#4.0), x3, square_2t0); + + ((square (#3.2)), x4, (square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.714))`;; + + + +let I_971555266= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. (#2.184))`;; + +let CIVA8_83777706= list_mk_conj + [ I_499014780;I_901845849;I_410091263;I_125103581;I_504968542; + I_770716154;I_666090270;I_971555266;];; +(* + +LOC: 2002 IV, page 47--48 +Section A9 +*) + + +(* interval verification by Ferguson *) +(* Uses monotonoicity in x4 variable *) +let I_956875054= + all_forall `ineq + [((square (#2.696)), x1, (#8.0)); + ((square (#2.45)), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((square (#2.77)), x4, (square (#2.77))); + ((#4.0), x5, square_2t0); + ((square (#2.45)), x6, square_2t0) + ] + ( (kappa (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)) <. (--. (#0.003521)))`;; + + + +(* interval verification by Ferguson *) +let I_664200787= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((square (#2.77)), x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (kappa (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)) <. (--. (#0.017))) \/ + ( (eta_x x2 x3 x4) <. (sqrt (#2.0))))`;; + + + +(* interval verification by Ferguson *) +let I_390273147= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((square (#2.77)), x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (kappa (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)) <. (--. (#0.017))) \/ + ( (eta_x x4 x5 x6) <. (sqrt (#2.0))))`;; + + + +(* +Equality has been assumed with x4 term +*) +(* interval verification by Ferguson *) +let I_654422246= + all_forall `ineq + [((square (#2.57)), x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((square (#3.2)), x4, (square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (kappa (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)) <. (--. (#0.02274))) \/ + ( (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)))`;; + + + +(* +Equality has been assumed with x4 term +*) +(* interval verification by Ferguson *) +let I_366536370= + all_forall `ineq + [(square_2t0, x1, (square (#2.57))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((square (#3.2)), x4, (square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (kappa (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)) <. (--. (#0.029))) \/ + ( (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)))`;; + + + +(* +Equality has been assumed with x4 term +*) +(* interval verification by Ferguson *) +let I_62532125= + all_forall `ineq + [(square_2t0, x1, (square (#2.57))); + ((#4.0), x2, (square (#2.25))); + ((#4.0), x3, (square (#2.25))); + + ((square (#3.2)), x4, (square (#3.2))); + ((#4.0), x5, (square (#2.25))); + ((#4.0), x6, (square (#2.25))) + ] + ( + ( (kappa (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)) <. (--. (#0.03883))) \/ + ( (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)))`;; + + + + +(* interval verification by Ferguson *) +let I_370631902= + all_forall `ineq + [(square_2t0, x1, (square (#2.57))); + ((#4.0), x2, (square (#2.25))); + ((#4.0), x3, (square (#2.25))); + + ((square (#3.2)), x4, (square (#3.2))); + ((#4.0), x5, (square (#2.25))); + ((#4.0), x6, square_2t0) + ] + ( + ( (kappa (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)) <. (--. (#0.0325))) \/ + ( (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)))`;; + + +let CIVA9_618205535= list_mk_conj + [ I_956875054;I_664200787;I_390273147;I_654422246;I_366536370; + I_62532125;I_370631902;];; + +(* + +LOC: 2002 IV, page 48 +Section A10 +*) + + +let I_214637273= + all_forall `ineq + [((square (#2.696)), x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (gamma_x x1 x2 x3 x4 x5 x6) <. (octavor0_x x1 x2 x3 x4 x5 x6))`;; + + + + +let I_751772680= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (gamma_x x1 x2 x3 x4 x5 x6) <. ( (octavor0_x x1 x2 x3 x4 x5 x6) +. (#0.01561)))`;; + + + + +let I_366146051= + all_forall `ineq + [((square (#2.57)), x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (gamma_x x1 x2 x3 x4 x5 x6) <. ( (octavor0_x x1 x2 x3 x4 x5 x6) +. (#0.00935)))`;; + + + + +let I_675766140= + all_forall `ineq + [(square_2t0, x1, (square (#2.57))); + ((square (#2.25)), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (gamma_x x1 x2 x3 x4 x5 x6) <. ( (octavor0_x x1 x2 x3 x4 x5 x6) +. (#0.00928)))`;; + + + +let I_520734758= + all_forall `ineq + [(square_2t0, x1, (square (#2.57))); + ((square (#2.25)), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((square (#2.25)), x6, square_2t0) + ] + ( (gamma_x x1 x2 x3 x4 x5 x6) <. (octavor0_x x1 x2 x3 x4 x5 x6))`;; + +let CIVA10_73974037= list_mk_conj + [ I_214637273;I_751772680;I_366146051;I_675766140;I_520734758;];; +(* + +LOC: 2002 IV, page 48 +Section A11 +*) + + +let I_378432183= + all_forall `ineq + [((square (#2.696)), x1, (#8.0)); + ((#4.0), x2, (square (#2.45))); + ((#4.0), x3, (square (#2.45))); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (octavor_analytic_x x1 x2 x3 x4 x5 x6) <. (octavor0_x x1 x2 x3 x4 x5 x6))`;; + + + + +let I_572206659= + all_forall `ineq + [((square (#2.696)), x1, (#8.0)); + ((square (#2.45)), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((square (#2.45)), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (octavor_analytic_x x1 x2 x3 x4 x5 x6) <. (octavor0_x x1 x2 x3 x4 x5 x6))`;; + + + + +let I_310679005= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (vor_analytic_x x1 x2 x3 x4 x5 x6) <. ( (vor_0_x x1 x2 x3 x4 x5 x6) +. (#0.003521)))`;; + + + + +let I_284970880= + all_forall `ineq + [((square (#2.696)), x1, (#8.0)); + ((square (#2.45)), x2, square_2t0); + ((#4.0), x3, square_2t0); + + (square_2t0, x4, (square (#2.77))); + ((#4.0), x5, square_2t0); + ((square (#2.45)), x6, square_2t0) + ] + ( (vor_analytic_x x1 x2 x3 x4 x5 x6) <. ( (vor_0_x x1 x2 x3 x4 x5 x6) +. (--. (#0.003521))))`;; + + + + +let I_972111620= + all_forall `ineq + [(square_2t0, x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (vor_analytic_x x1 x2 x3 x4 x5 x6) <. ( (vor_0_x x1 x2 x3 x4 x5 x6) +. (--. (#0.009))))`;; + + + + +let I_875762896= + all_forall `ineq + [(square_2t0, x1, (square (#2.57))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (octavor_analytic_x x1 x2 x3 x4 x5 x6) <. (octavor0_x x1 x2 x3 x4 x5 x6)) \/ + ( (eta_x x1 x2 x6) <. (sqrt (#2.0))))`;; + + + + +let I_385332676= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, (square (#2.2))); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (octavor_analytic_x x1 x2 x3 x4 x5 x6) <. ( (octavor0_x x1 x2 x3 x4 x5 x6) +. (--. (#0.004131)))) \/ + ( (eta_x x1 x2 x6) >. (sqrt (#2.0))) \/ + ( (eta_x x1 x3 x5) <. (sqrt (#2.0))))`;; + +let CIVA11_764978100= list_mk_conj + [ I_378432183;I_572206659;I_310679005;I_284970880;I_972111620; + I_875762896;I_385332676;];; + +(* + +LOC: 2002 IV, page 48 +Section A12 +*) + + +(* interval verification by Ferguson *) +let I_970291025= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + (square_2t0, x2, (#8.0)); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (tau_analytic_x x1 x2 x3 x4 x5 x6) >. + ( (#0.13) +. ( (#0.2) *. ( (dih_x x1 x2 x3 x4 x5 x6) +. ( pi / (--. (#2.0))))))) \/ + ( (eta_x x1 x2 x6) >. (sqrt (#2.0))))`;; + + + + +(* interval verification by Ferguson *) +let I_524345535= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + (square_2t0, x2, (#8.0)); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (tauVt_x x1 x2 x3 x4 x5 x6 (sqrt (#2.0))) >. + ( (#0.13) +. ( (#0.2) *. ( (dih_x x1 x2 x3 x4 x5 x6) +. ( pi / (--. (#2.0))))))) \/ + ( (eta_x x1 x2 x6) <. (sqrt (#2.0))))`;; + + + + +let I_812894433= + all_forall `ineq + [((square (#2.75)), x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (nu_x x1 x2 x3 x4 x5 x6) <. ( (--. (#0.3429)) +. ( (#0.24573) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + + + +(* +Equality used in dih_x equation +*) +let I_404793781= + all_forall `ineq + [(square_2t0, x1, (square (#2.75))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (vorC0_x x1 x2 x3 x4 x5 x6) <. (--. (#0.0571))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#2.2)))`;; + +let CIVA12_855294746= list_mk_conj + [ I_970291025;I_524345535;I_812894433;I_404793781;];; + +(* + +LOC: 2002 IV, page 48--49 +Section A13 +*) + + +let I_705592875= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (taunu_x x1 x2 x3 x4 x5 x6) >. (#0.033))`;; + + + + +let I_747727191= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (tau_0_x x1 x2 x3 x4 x5 x6) >. ( (#0.06585) +. (--. (#0.0066))))`;; + + + + +let I_474496219= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (#8.0)); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. (#0.009))`;; + + + +let I_649551700= + all_forall `ineq + [((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))) + ] + ( (vor_0_x (#4.0) x2 x3 x4 (#4.0) (#4.0)) <. (#0.0461))`;; + + + +(* +Weak inequality used ( <=. ) in next one below +*) +let I_74657942= + all_forall `ineq + [((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))) + ] + ( (vor_0_x square_2t0 (#4.0) x3 x4 (#4.0) (#4.0)) <=. (#0.0))`;; + + + +let I_897129160= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#8.0), x4, (square (#3.2))) + ] + ( (vor_0_x x1 x2 square_2t0 x4 (#4.0) (#4.0)) <. (#0.0))`;; + + + +let I_760840103= + all_forall `ineq + [((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))) + ] + ( (tau_0_x (#4.0) x2 x3 x4 (#4.0) (#4.0)) >. (#0.014))`;; + + + +(* +Inequality used ( >=. ) in next one +*) +let I_675901554= + all_forall `ineq + [((#8.0), x4, (square (#3.2))) + ] + ( (tau_0_x square_2t0 (#4.0) (#4.0) x4 (#4.0) (#4.0)) >=. (#0.0))`;; + + + +let I_712696695= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#8.0), x4, (square (#3.2))) + ] + ( (tau_0_x x1 x2 square_2t0 x4 (#4.0) (#4.0)) >. (#0.06585))`;; + + + + +(* interval verification in partK.cc *) +let I_269048407= + all_forall `ineq + [((square (#2.696)), x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (nu_x x1 x2 x3 x4 x5 x6) <. + ( (vor_0_x x1 x2 x3 x4 x5 x6) +. ( (#0.01) *. ( ( pi / (#2.0)) +. (( --. ) (dih_x x1 x2 x3 x4 x5 x6))))))`;; + + + +(* interval verification in partK.cc *) +let I_553285469= + all_forall `ineq + [((square (#2.6)), x1, (square (#2.696))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((square (#2.1)), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (nu_x x1 x2 x3 x4 x5 x6) <. (vor_0_x x1 x2 x3 x4 x5 x6))`;; + + + +(* interval verification in partK.cc *) +let I_293389410= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (mu_flat_x x1 x2 x3 x4 x5 x6) <. ( (vor_0_x x1 x2 x3 x4 x5 x6) +. (#0.0268)))`;; + + + + +(* interval verification in partK.cc *) +let I_695069283= + all_forall `ineq + [((#4.0), x1, (square (#2.17))); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (mu_flat_x x1 x2 x3 x4 x5 x6) <. ( (vor_0_x x1 x2 x3 x4 x5 x6) +. (#0.02)))`;; + + + + +(* interval verification in partK.cc *) +let I_814398901= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#8.0), x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.32))`;; + + + + +(* interval verification in partK.cc *) +(* +CCC false in multiple branches of tauhat. +Domain has been corrected. Should be flat quarters. + +CCC still false in vor0 branch. +Not a counterexample, because the dihedral angle > 1.32. + +Bound: 0.0206833063205 + +Point: [4.10991923445, 4.05029743735, 4.15049810846, 7.32673562767, 4.73630950763, 4.85438443725]; + +yy = {4.10991923445, 4.05029743735, 4.15049810846, 7.32673562767, 4.73630950763, 4.85438443725}//Sqrt + +tauVc @@ yy + +Dihedral @@ yy (* yields 1.651, so OK *) + +*) + +let I_352079526= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (tauhat_x x1 x2 x3 x4 x5 x6) >. ( (#3.07) *. pt)) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.32)))`;; + + + +(* interval verification in partK.cc *) +let I_179025673 = + all_forall `ineq + [ + ((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, #8.0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ((tau_0_x x1 x2 x3 x4 x5 x6) >. ((#3.07)*pt + xiV + (&2 * xi'_gamma))) \/ + ((dih_x x1 x2 x3 x4 x5 x6 >. (#1.32))) \/ + ((eta_x x4 x5 x6 <. sqrt2)) + )`;; + + +let CIVA13_148776243= list_mk_conj + [ I_705592875;I_747727191;I_474496219;I_649551700;I_74657942; + I_897129160;I_760840103;I_675901554;I_712696695;I_269048407; + I_553285469;I_293389410;I_695069283;I_814398901;I_352079526; + I_179025673];; + +(* + +LOC: 2002 IV, page 49 +Section A14 +*) + +(* interval verification by Ferguson *) +(* let I_424011442= *) +(* all_forall `ineq *) +(* [((#4.0), x1, square_2t0); *) +(* ((#4.0), x2, square_2t0); *) +(* ((#4.0), x3, square_2t0); *) + +(* ((#4.0), x4, square_4t0); *) +(* ((#4.0), x5, (square (#3.2))); *) +(* (x5, x6, (square (#3.2))) *) +(* ] *) +(* ( *) +(* ( (v0x x1 x2 x3 x4 x5 x6) <. (#0.0)) \/ *) +(* ( (sqrt x4) >. ( (sqrt x2) +. (sqrt x3))) \/ *) +(* ( (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)))`;; *) + +(* CCC made nonconstant bound a constraint *) +let I_424011442= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_4t0); + ((#4.0), x5, (square (#3.2))); + ((#4.0), x6, (square (#3.2))) + ] + ( + ( (v0x x1 x2 x3 x4 x5 x6) <. (#0.0)) \/ + ( (sqrt x4) >. ( (sqrt x2) +. (sqrt x3))) \/ + ( (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)) \/ + ( x6 <. x5 ) + + )`;; + +(* (\* interval verification by Ferguson *\) *) +(* let I_140881233= *) +(* all_forall `ineq *) +(* [((#4.0), x1, square_2t0); *) +(* ((#4.0), x2, square_2t0); *) +(* ((#4.0), x3, square_2t0); *) + +(* ((#4.0), x4, square_4t0); *) +(* ((#4.0), x5, (square (#3.2))); *) +(* (x5, x6, (square (#3.2))) *) +(* ] *) +(* ( *) +(* ( (v1x x1 x2 x3 x4 x5 x6) <. (#0.0)) \/ *) +(* ( (sqrt x4) >. ( (sqrt x2) +. (sqrt x3))) \/ *) +(* ( (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)))`;; *) + + + +(* interval verification by Ferguson *) +(* CCC made nonconstant bound a constraint *) +let I_140881233= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_4t0); + ((#4.0), x5, (square (#3.2))); + ((#4.0), x6, (square (#3.2))) + ] + ( + ( (v1x x1 x2 x3 x4 x5 x6) <. (#0.0)) \/ + ( (sqrt x4) >. ( (sqrt x2) +. (sqrt x3))) \/ + ( (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)) \/ + ( x6 <. x5 ) + )`;; + + + + +(* interval verification by Ferguson *) +let I_601456709_1= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#8.0), x4, (square (#3.2))); + ((#4.0), x5, (square (#2.189))); + ((#4.0), x6, square_2t0) + ] + ( + ( ( (v0x x1 x2 x3 x4 x5 x6) +. ( (#0.82) *. (sqrt (#421.0)))) <. (#0.0)) \/ + ( (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)))`;; + + + + +(* interval verification by Ferguson *) +let I_601456709_2= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#8.0), x4, (square (#3.2))); + ((#4.0), x5, (square (#2.189))); + ((#4.0), x6, square_2t0) + ] + ( + ( ( (v1x x1 x2 x3 x4 x5 x6) +. ( (#0.82) *. (sqrt (#421.0)))) <. (#0.0)) \/ + ( (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)))`;; + + + +(* interval verification by Ferguson *) +let I_292977281_1= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((square (#3.2)), x4, square_4t0); + ((#4.0), x5, (square (#2.189))); + ((#4.0), x6, (square (#3.2))) + ] + ( + ( ( (v0x x1 x2 x3 x4 x5 x6) +. ( (#0.82) *. (sqrt (#421.0)))) <. (#0.0)) \/ + ( (sqrt x4) >. ( (sqrt x2) +. (sqrt x3))) \/ + ( (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)))`;; + + + +(* interval verification by Ferguson *) +let I_292977281_2= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((square (#3.2)), x4, square_4t0); + ((#4.0), x5, (square (#2.189))); + ((#4.0), x6, (square (#3.2))) + ] + ( + ( ( (v1x x1 x2 x3 x4 x5 x6) +. ( (#0.82) *. (sqrt (#421.0)))) <. (#0.0)) \/ + ( (sqrt x4) >. ( (sqrt x2) +. (sqrt x3))) \/ + ( (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)))`;; + + + +(* +Two sets of bounds for x5 I used the more restrictive set +*) +(* interval verification by Ferguson *) +let I_927286061_1= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#8.0), x4, (square (#3.2))); + ((square (#2.189)), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( ( (v0x x1 x2 x3 x4 x5 x6) +. ( (#0.5) *. (sqrt (#421.0)))) <. (#0.0)) \/ + ( (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)))`;; + + + + +(* +Two sets of bounds for x5 I used the more restrictive set +*) +(* interval verification by Ferguson *) +let I_927286061_2= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#8.0), x4, (square (#3.2))); + ((square (#2.189)), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( ( (v1x x1 x2 x3 x4 x5 x6) +. ( (#0.5) *. (sqrt (#421.0)))) <. (#0.0)) \/ + ( (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)))`;; + + + + +(* +Two sets of bounds for x5 I used the more restrictive set + +*) +(* interval verification by Ferguson *) +let I_340409511_1= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((square (#3.2)), x4, square_4t0); + + ((square (#2.189)), x5, (square (#3.2))); + ((#4.0), x6, (square (#3.2))) + ] + ( + ( ( (v0x x1 x2 x3 x4 x5 x6) +. ( (#0.5) *. (sqrt (#421.0)))) <. (#0.0)) \/ + ( (sqrt x4) >. ( (sqrt x2) +. (sqrt x3))) \/ + ( (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)))`;; + + + + +(* +Two sets of bounds for x5 I used the more restrictive set +*) +(* interval verification by Ferguson *) +let I_340409511_2= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((square (#3.2)), x4, square_4t0); + + ((square (#2.189)), x5, (square (#3.2))); + ((#4.0), x6, (square (#3.2))) + ] + ( + ( ( (v1x x1 x2 x3 x4 x5 x6) +. ( (#0.5) *. (sqrt (#421.0)))) <. (#0.0)) \/ + ( (sqrt x4) >. ( (sqrt x2) +. (sqrt x3))) \/ + ( (delta_x x1 x2 x3 x4 x5 x6) <. (#0.0)))`;; + + + +(* interval verification by Ferguson *) +let I_727498658= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#8.0), x4, square_4t0); + ((#4.0), x5, (square (#3.2))); + ((#4.0), x6, (square (#3.2))) + ] + ( + ( (delta_x x1 x2 x3 x4 x5 x6) <. (#421.0)) \/ + ( (sqrt x4) >. ( (sqrt x2) +. (sqrt x3))) \/ + ( (eta_x x1 x3 x5) >. t0))`;; + + +(* interval verification by Ferguson *) +let I_484314425 = all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x5, square_2t0) + ] + (--(&.4)*doct*(ups_x x1 x3 x5)* + ((deriv (\x. (quo_x x1 x3 x)) x5) +. + (deriv (\x. (quo_x x3 x1 x)) x5)) + <. (#0.82))`;; + +(* interval verification by Ferguson *) +let I_440223030 = all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x3, square_2t0); + ((square (#2.189)), x5, square_2t0) + ] + (--(&.4)*doct*(ups_x x1 x3 x5)* + ((deriv (\x. (quo_x x1 x3 x)) x5) +. + (deriv (\x. (quo_x x3 x1 x)) x5)) + <. (#0.50))`;; + +(* +Handwritten note says to change ( >=. ) to ( >. ) + overlap_f is the function of 1998:IV.4.11, or 2002,IV,Sec.4.14 +*) +(* interval verification by Ferguson *) +(* moved 115756648 to inequality_spec.ml *) + + + +let CIVA14_984628285 = list_mk_conj + [ I_424011442;I_140881233;I_601456709_1;I_601456709_2; + I_292977281_1;I_292977281_2;I_927286061_1;I_927286061_2; + I_340409511_1;I_340409511_2;I_727498658;I_484314425; + I_440223030;I_115756648;];; + +(* + +LOC: 2002 IV, page 49 +Section A15 +Remember to include this in the summary list-mk-conj +*) + +(* interval verification by Ferguson *) +let I_329882546_1= all_forall `ineq + [((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#8.0), x4, square_4t0); +((#4.0), x5, (#4.0)); +((#4.0), x6, (#4.0)) + ] + ((sqrt x4 >. (sqrt x2 + (sqrt x3))) \/ + (sqrt x4 >. (sqrt x5 + (sqrt x6))) \/ + (delta_x x1 x2 x3 x4 x5 x6 <. (&.0)) \/ + ~(deriv (\x. vor_0_x x x2 x3 x4 x5 x6) x1 = (&.0)) \/ + (deriv2 (\x. vor_0_x x x2 x3 x4 x5 x6) x1 >. (&.0)))`;; + +(* interval verification by Ferguson *) +let I_329882546_2= + all_forall `ineq + [((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#8.0), x4, square_4t0); +((#4.0), x5, (#4.0)); +((#4.0), x6, (#4.0)) + ] + ((sqrt x4 >. (sqrt x2 + (sqrt x3))) \/ + (sqrt x4 >. (sqrt x5 + (sqrt x6))) \/ + (delta_x x1 x2 x3 x4 x5 x6 <. (&.0)) \/ + ~(deriv (\x. (-- (tau_0_x x x2 x3 x4 x5 x6))) x1 = (&.0)) \/ + (deriv2 (\x. (-- (tau_0_x x x2 x3 x4 x5 x6))) x1 >. (&.0)))`;; + +(* interval verification by Ferguson *) +let I_427688691_1= + all_forall `ineq + [((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#8.0), x4, square_4t0); +((#4.0), x5, (#4.0)); +(square_2t0, x6, square_2t0) + ] + ((sqrt x4 >. (sqrt x2 + (sqrt x3))) \/ + (sqrt x4 >. (sqrt x5 + (sqrt x6))) \/ + (delta_x x1 x2 x3 x4 x5 x6 <. (&.0)) \/ + ~(deriv (\x. vor_0_x x x2 x3 x4 x5 x6) x1 = (&.0)) \/ + (deriv2 (\x. vor_0_x x x2 x3 x4 x5 x6) x1 >. (&.0)))`;; + +(* interval verification by Ferguson *) +let I_427688691_2= + all_forall `ineq + [((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#8.0), x4, square_4t0); +((#4.0), x5, (#4.0)); +(square_2t0, x6, square_2t0) + ] + ((sqrt x4 >. (sqrt x2 + (sqrt x3))) \/ + (sqrt x4 >. (sqrt x5 + (sqrt x6))) \/ + (delta_x x1 x2 x3 x4 x5 x6 <. (&.0)) \/ + ~(deriv (\x. (-- (tau_0_x x x2 x3 x4 x5 x6))) x1 = (&.0)) \/ + (deriv2 (\x. (-- (tau_0_x x x2 x3 x4 x5 x6))) x1 >. (&.0)))`;; + +(* interval verification by Ferguson *) +let I_562103670_1= + all_forall `ineq + [((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#8.0), x4, square_4t0); +((#4.0), x5, (#4.0)); +((#8.0), x6, (#8.0)) + ] + ((sqrt x4 >. (sqrt x2 + (sqrt x3))) \/ + (sqrt x4 >. (sqrt x5 + (sqrt x6))) \/ + (delta_x x1 x2 x3 x4 x5 x6 <. (&.0)) \/ + ~(deriv (\x. vor_0_x x x2 x3 x4 x5 x6) x1 = (&.0)) \/ + (deriv2 (\x. vor_0_x x x2 x3 x4 x5 x6) x1 >. (&.0)))`;; + +(* interval verification by Ferguson *) +let I_562103670_2= + all_forall `ineq + [((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#8.0), x4, square_4t0); +((#4.0), x5, (#4.0)); +((#8.0), x6, (#8.0)) + ] + ((sqrt x4 >. (sqrt x2 + (sqrt x3))) \/ + (sqrt x4 >. (sqrt x5 + (sqrt x6))) \/ + (delta_x x1 x2 x3 x4 x5 x6 <. (&.0)) \/ + ~(deriv (\x. (-- (tau_0_x x x2 x3 x4 x5 x6))) x1 = (&.0)) \/ + (deriv2 (\x. (-- (tau_0_x x x2 x3 x4 x5 x6))) x1 >. (&.0)))`;; + +(* interval verification by Ferguson *) +let I_564506426_1= + all_forall `ineq + [((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#8.0), x4, square_4t0); +(square_2t0, x5, square_2t0); +(square_2t0, x6, square_2t0) + ] + ((sqrt x4 >. (sqrt x2 + (sqrt x3))) \/ + (sqrt x4 >. (sqrt x5 + (sqrt x6))) \/ + (delta_x x1 x2 x3 x4 x5 x6 <. (&.0)) \/ + ~(deriv (\x. vor_0_x x x2 x3 x4 x5 x6) x1 = (&.0)) \/ + (deriv2 (\x. vor_0_x x x2 x3 x4 x5 x6) x1 >. (&.0)))`;; + +(* interval verification by Ferguson *) +let I_564506426_2= + all_forall `ineq + [((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#8.0), x4, square_4t0); +(square_2t0, x5, square_2t0); +(square_2t0, x6, square_2t0) + ] + ((sqrt x4 >. (sqrt x2 + (sqrt x3))) \/ + (sqrt x4 >. (sqrt x5 + (sqrt x6))) \/ + (delta_x x1 x2 x3 x4 x5 x6 <. (&.0)) \/ + ~(deriv (\x. (-- (tau_0_x x x2 x3 x4 x5 x6))) x1 = (&.0)) \/ + (deriv2 (\x. (-- (tau_0_x x x2 x3 x4 x5 x6))) x1 >. (&.0)))`;; + +(* interval verification by Ferguson *) +let I_288224597_1= + all_forall `ineq + [((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#8.0), x4, square_4t0); +(square_2t0, x5, square_2t0); +((#8.0), x6, (#8.0)) + ] + ((sqrt x4 >. (sqrt x2 + (sqrt x3))) \/ + (sqrt x4 >. (sqrt x5 + (sqrt x6))) \/ + (delta_x x1 x2 x3 x4 x5 x6 <. (&.0)) \/ + ~(deriv (\x. vor_0_x x x2 x3 x4 x5 x6) x1 = (&.0)) \/ + (deriv2 (\x. vor_0_x x x2 x3 x4 x5 x6) x1 >. (&.0)))`;; + +(* interval verification by Ferguson *) +let I_288224597_2= + all_forall `ineq + [((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#8.0), x4, square_4t0); +(square_2t0, x5, square_2t0); +((#8.0), x6, (#8.0)) + ] + ((sqrt x4 >. (sqrt x2 + (sqrt x3))) \/ + (sqrt x4 >. (sqrt x5 + (sqrt x6))) \/ + (delta_x x1 x2 x3 x4 x5 x6 <. (&.0)) \/ + ~(deriv (\x. (-- (tau_0_x x x2 x3 x4 x5 x6))) x1 = (&.0)) \/ + (deriv2 (\x. (-- (tau_0_x x x2 x3 x4 x5 x6))) x1 >. (&.0)))`;; + +(* interval verification by Ferguson *) +let I_979916330_1= + all_forall `ineq + [((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#8.0), x4, square_4t0); +((#8.0), x5, (#8.0)); +((#8.0), x6, (#8.0)) + ] + ((sqrt x4 >. (sqrt x2 + (sqrt x3))) \/ + (sqrt x4 >. (sqrt x5 + (sqrt x6))) \/ + (delta_x x1 x2 x3 x4 x5 x6 <. (&.0)) \/ + ~(deriv (\x. vor_0_x x x2 x3 x4 x5 x6) x1 = (&.0)) \/ + (deriv2 (\x. vor_0_x x x2 x3 x4 x5 x6) x1 >. (&.0)))`;; + +(* interval verification by Ferguson *) +let I_749968927_2= + all_forall `ineq + [((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#8.0), x4, square_4t0); +((#8.0), x5, (#8.0)); +((#8.0), x6, (#8.0)) + ] + ((sqrt x4 >. (sqrt x2 + (sqrt x3))) \/ + (sqrt x4 >. (sqrt x5 + (sqrt x6))) \/ + (delta_x x1 x2 x3 x4 x5 x6 <. (&.0)) \/ + ~(deriv (\x. (-- (tau_0_x x x2 x3 x4 x5 x6))) x1 = (&.0)) \/ + (deriv2 (\x. (-- (tau_0_x x x2 x3 x4 x5 x6))) x1 >. (&.0)))`;; + +let CIVA15_311189443= list_mk_conj + [ I_329882546_1;I_329882546_2;I_427688691_1;I_427688691_2; + I_562103670_1;I_562103670_2;I_564506426_1;I_564506426_2; + I_288224597_1;I_288224597_2;I_979916330_1;I_749968927_2;];; + +(* + +LOC: 2002 IV, page 49--50 +Section A16 + +Comments from 2002 text: + +Some of these follow from known results. +See II.4.5.1, F.3.13.1, F.3.13.3, F.3.13.4. + +The case vor <=0 of the inequality sigma<=0 for flat quarters +follows by Rogers's monotonicity lemma I.8.6.2 and F.3.13.1, +because the circumradius of the flat quarter is ASSUME_TAC least +sqrt(2) when the analytic Voronoi function is used. We also +use that vor(R(1,eta(2,2,2),sqrt(2)) = 0. +*) + + +let I_695180203_1= + all_forall `ineq + [ +((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +(square_2t0, x4, (#8.0)); +((#4.0), x5, square_2t0); +((#4.0), x6, square_2t0) + ] + (taumu_flat_x x1 x2 x3 x4 x5 x6 >. #0.06585)`;; + +let I_695180203_2= + all_forall `ineq + [ +((square (#2.2)), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((square(#2.6)), x4, (#8.0)); +((#4.0), x5, square_2t0); +((#4.0), x6, square_2t0) + ] + ((#0.0063) + (tau_0_x x1 x2 x3 x4 x5 x6) >. #0.06585)`;; + +let I_695180203_3= + all_forall `ineq + [ +((#4.0), x1, (square (#2.2))); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((square(#2.7)), x4, (#8.0)); +((#4.0), x5, square_2t0); +((#4.0), x6, square_2t0) + ] + ((#0.0114) + (tau_0_x x1 x2 x3 x4 x5 x6) >. #0.06585)`;; + +(* In this fourth case, we get half from each upright quarter. *) +let I_695180203_4= + all_forall `ineq + [ +(square_2t0, x1, (#8.0)); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#4.0), x4, square_2t0); +((#4.0), x5, square_2t0); +((#4.0), x6, square_2t0) + ] + ((taunu_x x1 x2 x3 x4 x5 x6) >. (#0.06585)/(#2.0))`;; + +let I_695180203_5= + all_forall `ineq + [ +((#4.0), x1, square_2t0); +((square(#2.23)), x2, square_2t0); +((#4.0), x3, square_2t0); +((square(#2.77)), x4, (#8.0)); +((#4.0), x5, square_2t0); +((#4.0), x6, square_2t0) + ] + (((tau_0_x x1 x2 x3 x4 x5 x6) >. #0.06585) \/ + (eta_x x4 x5 x6 <. (sqrt (#2.0))))`;; + +(* direction of inequality corrected in 690626704_* on Dec 16, 2007, tch *) + +let I_690626704_1= + all_forall `ineq + [ +((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +(square_2t0, x4, (#8.0)); +((#4.0), x5, square_2t0); +((#4.0), x6, square_2t0) + ] + (mu_flat_x x1 x2 x3 x4 x5 x6 <. #0.0)`;; + +let I_690626704_2= + all_forall `ineq + [ +((square (#2.2)), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((square(#2.6)), x4, (#8.0)); +((#4.0), x5, square_2t0); +((#4.0), x6, square_2t0) + ] + ((--(#0.0063)) + (vor_0_x x1 x2 x3 x4 x5 x6) <. #0.0)`;; + +let I_690626704_3= + all_forall `ineq + [ +((#4.0), x1, (square (#2.2))); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((square(#2.7)), x4, (#8.0)); +((#4.0), x5, square_2t0); +((#4.0), x6, square_2t0) + ] + ((--(#0.0114)) + (vor_0_x x1 x2 x3 x4 x5 x6) <. #0.0)`;; + +(* In this fourth case, we get half from each upright quarter. *) +let I_690626704_4= + all_forall `ineq + [ +(square_2t0, x1, (#8.0)); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#4.0), x4, square_2t0); +((#4.0), x5, square_2t0); +((#4.0), x6, square_2t0) + ] + ((nu_x x1 x2 x3 x4 x5 x6) <. (#0.0))`;; + +let I_690626704_5= + all_forall `ineq + [ +((#4.0), x1, square_2t0); +((square(#2.23)), x2, square_2t0); +((#4.0), x3, square_2t0); +((square(#2.77)), x4, (#8.0)); +((#4.0), x5, square_2t0); +((#4.0), x6, square_2t0) + ] + (((vor_0_x x1 x2 x3 x4 x5 x6) <. #0.0) \/ + (eta_x x4 x5 x6 <. (sqrt (#2.0))))`;; + + +let I_807023313= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + (square_2t0, x4, (square (#2.77))); + (square_2t0, x5, (square (#2.77))); + ((#4.0), x6, square_2t0) + ] + ( + ( (vor_analytic_x x1 x2 x3 x4 x5 x6) <. (--. (#0.05714))) \/ + ( (eta_x x4 x5 x6) >. (sqrt (#2.0))))`;; + + +let I_590577214= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + (square_2t0, x4, (square (#2.77))); + (square_2t0, x5, (square (#2.77))); + ((#4.0), x6, square_2t0) + ] + ( + ( (tau_analytic_x x1 x2 x3 x4 x5 x6) >. (#0.13943)) \/ + ( (eta_x x4 x5 x6) >. (sqrt (#2.0))))`;; + +(* STM 1/13/08. Added parentheses. This was not parsing correctly *) +(* +CCC false. Sign of the inequality corrected on the eta constraint 1/31/2008. + +Bound: 0.0133663042564 + +Point: [3.99999999999, 3.99999999999, 3.99999999999, 3.99999999999, 6.30009999999, 6.30009999999] + +*) +let I_949210508_1= + all_forall `ineq +[((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#4.0), x4, square_2t0); +(square_2t0, x5, (#8.0)); +(square_2t0, x6, (#8.0)) + ] + ((vor_0_x x1 x2 x3 x4 x5 x6 <. Z32) \/ + (eta_x x4 x5 x6 <. (sqrt (#2.0)) ))`;; + +let I_949210508_2= + all_forall `ineq +[((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#4.0), x4, square_2t0); +((square(#2.77), x5, (#8.0))); +(square_2t0, x6, (#8.0)) + ] + (vor_0_x x1 x2 x3 x4 x5 x6 <. Z32)`;; + +(* STM 1/13/08. Added parentheses. This was not parsing correctly *) +(* +CCC false. Sign of the inequality corrected on the eta constraint 1/31/2008. + +Bound: 0.0130374551969 + +Point: [3.99999999999, 3.99999999999, 3.99999999999, 3.99999999999, 6.30009999999, 6.30009999999] + +*) +let I_671961774_1= + all_forall `ineq +[((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#4.0), x4, square_2t0); +(square_2t0, x5, (#8.0)); +(square_2t0, x6, (#8.0)) + ] + ((tau_0_x x1 x2 x3 x4 x5 x6 >. (#0.13943)) \/ + (eta_x x4 x5 x6 <. (sqrt (#2.0)) ))`;; + +let I_671961774_2= + all_forall `ineq +[((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#4.0), x4, square_2t0); +((square(#2.77), x5, (#8.0))); +(square_2t0, x6, (#8.0)) + ] + (tau_0_x x1 x2 x3 x4 x5 x6 >. (#0.13943))`;; + +let CIVA16_163548682 = list_mk_conj + [ I_695180203_1;I_695180203_2;I_695180203_3;I_695180203_4; + I_695180203_5;I_690626704_1;I_690626704_2;I_690626704_3; + I_690626704_4;I_690626704_5;I_807023313;I_590577214; + I_949210508_1;I_949210508_2;I_671961774_1;I_671961774_2;];; + +(* + +LOC: 2002 IV, page 50 +Section A17 +*) + +(* + +Six Cases: + (k0,k1,k2) + (3,0,0)X + (2,1,0)X + (2,0,1)X + (1,2,0)X + (1,0,2) + (1,1,1) + (0,3,0) + (0,2,1) + (0,1,2) + (0,0,3) + +*) + +(* interval verification by Ferguson *) +let I_645264496_102= + all_forall `ineq +[((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#4.0), x4, square_2t0); +((#8.0), x5, (square (#3.2))); +((#8.0), x6, (square (#3.2))) + ] + ((tau_0_x x1 x2 x3 x4 x5 x6)- (pi_prime_tau 1 0 2) >. D32)`;; + +(* interval verification by Ferguson *) +let I_645264496_111= + all_forall `ineq +[((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#4.0), x4, square_2t0); +(square_2t0, x5, (#8.0)); +((#8.0), x6, (square (#3.2))) + ] + ((tau_0_x x1 x2 x3 x4 x5 x6)- (pi_prime_tau 1 1 1) >. D32)`;; + +(* interval verification by Ferguson *) +let I_645264496_030= + all_forall `ineq +[((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +(square_2t0, x4, (#8.0)); +(square_2t0, x5, (#8.0)); +(square_2t0, x6, (#8.0)) + ] + ((tau_0_x x1 x2 x3 x4 x5 x6)- (pi_prime_tau 0 3 0) >. D33)`;; + +(* interval verification by Ferguson *) +let I_645264496_021= + all_forall `ineq +[((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +(square_2t0, x4, (#8.0)); +(square_2t0, x5, (#8.0)); +((#8.0), x6, (square (#3.2))) + ] + ((tau_0_x x1 x2 x3 x4 x5 x6)- (pi_prime_tau 0 2 1) >. D33)`;; + +(* interval verification by Ferguson *) +let I_645264496_012= + all_forall `ineq +[((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +(square_2t0, x4, (#8.0)); +((#8.0), x5, (square (#3.2))); +((#8.0), x6, (square (#3.2))) + ] + ((tau_0_x x1 x2 x3 x4 x5 x6)- (pi_prime_tau 0 1 2) >. D33)`;; + +(* interval verification by Ferguson *) +let I_645264496_003= + all_forall `ineq +[((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#8.0), x4, (square (#3.2))); +((#8.0), x5, (square (#3.2))); +((#8.0), x6, (square (#3.2))) + ] + ((tau_0_x x1 x2 x3 x4 x5 x6)- (pi_prime_tau 0 0 3) >. D33)`;; + + + + +(* interval verification by Ferguson *) +let I_910154674= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((square (#2.6)), x4, (#8.0)); + ((#8.0), x5, (square (#3.2))); + ((#4.0), x6, square_2t0) + ] + ( ( (tau_0_x x1 x2 x3 x4 x5 x6) +. (--. (#0.034052))) >. (#0.13943))`;; + + + +(* interval verification by Ferguson *) +let I_877743345= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + (square_2t0, x4, square_2t0); + ((square (#3.2)), x5, (square (#3.2))); + ((#4.0), x6, (#4.0)) + ] + ( ( (tau_0_x x1 x2 x3 x4 x5 x6) +. (--. (#0.034052)) +. (--. (#0.0066))) >. (#0.13943))`;; + + +let CIVA17_852270725 = list_mk_conj + [ I_645264496_102;I_645264496_111;I_645264496_030;I_645264496_021; + I_645264496_012;I_645264496_003;I_910154674;I_877743345;];; + +(* + +LOC: 2002 IV, page 50 +Section A18 + +*) + + +(* interval verification by Ferguson *) +let I_612259047_102= + all_forall `ineq +[((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#4.0), x4, square_2t0); +((#8.0), x5, (square (#3.2))); +((#8.0), x6, (square (#3.2))) + ] + ((vor_0_x x1 x2 x3 x4 x5 x6)+ (pi_prime_sigma 1 0 2) <. Z32)`;; + +(* interval verification by Ferguson *) +let I_612259047_111= + all_forall `ineq +[((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#4.0), x4, square_2t0); +(square_2t0, x5, (#8.0)); +((#8.0), x6, (square (#3.2))) + ] + ((vor_0_x x1 x2 x3 x4 x5 x6)+ (pi_prime_sigma 1 1 1) <. Z32)`;; + +(* interval verification by Ferguson *) +let I_612259047_030= + all_forall `ineq +[((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +(square_2t0, x4, (#8.0)); +(square_2t0, x5, (#8.0)); +(square_2t0, x6, (#8.0)) + ] + ((vor_0_x x1 x2 x3 x4 x5 x6)+ (pi_prime_sigma 0 3 0) <. Z33)`;; + +(* interval verification by Ferguson *) +let I_612259047_021= + all_forall `ineq +[((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +(square_2t0, x4, (#8.0)); +(square_2t0, x5, (#8.0)); +((#8.0), x6, (square (#3.2))) + ] + ((vor_0_x x1 x2 x3 x4 x5 x6)+ (pi_prime_sigma 0 2 1) <. Z33)`;; + +(* interval verification by Ferguson *) +let I_612259047_012= + all_forall `ineq +[((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +(square_2t0, x4, (#8.0)); +((#8.0), x5, (square (#3.2))); +((#8.0), x6, (square (#3.2))) + ] + ((vor_0_x x1 x2 x3 x4 x5 x6)+ (pi_prime_sigma 0 1 2) <. Z33)`;; + +(* interval verification by Ferguson *) +let I_612259047_003= + all_forall `ineq +[((#4.0), x1, square_2t0); +((#4.0), x2, square_2t0); +((#4.0), x3, square_2t0); +((#8.0), x4, (square (#3.2))); +((#8.0), x5, (square (#3.2))); +((#8.0), x6, (square (#3.2))) + ] + ((vor_0_x x1 x2 x3 x4 x5 x6)+ (pi_prime_sigma 0 0 3) <. Z33)`;; + + +let CIVA18_819209129 = list_mk_conj + [ I_612259047_102;I_612259047_111;I_612259047_030;I_612259047_021; + I_612259047_012;I_612259047_003;];; + +(* + +LOC: 2002 IV, page 50 +Section A19 + +Note: I might need to add some convexity results to make what +is stated below consistent with what is asserted in 2002-IV. + +Without loss of generality in Section 19, we can divide the +quad along the shorter diagonal. +*) + +(* interval verification by Ferguson *) +let I_357477295_1= + all_forall `ineq +[((#4.0), x1, square_2t0); +((#4.0), x3, square_2t0); +((#8.0), x4, (square (#3.2))); +(square_2t0, x5, (#8.0)) + ] + (((tau_0_x x1 (#4.0) x3 x4 x5 (#4.0))+ + (tau_0_x (#4.0) (#4.0) x3 x4 (#4.0) (#4.0)) >. (#0.235)) \/ + (cross_diag_x x1 (#4.0) x3 x4 x5 (#4.0) (#4.0) (#4.0) (#4.0) + <. (sqrt x4)))`;; + +(* interval verification by Ferguson *) +let I_357477295_2= + all_forall `ineq +[((#4.0), x1, square_2t0); +((#4.0), x3, square_2t0); +((#8.0), x4, (square (#3.2))); +((#8.0), x5, (square (#3.2))) + ] + (((tau_0_x x1 (#4.0) x3 x4 x5 (#4.0))+ + (tau_0_x (#4.0) (#4.0) x3 x4 (#4.0) (#4.0)) >. (#0.3109)) \/ + (cross_diag_x x1 (#4.0) x3 x4 x5 (#4.0) (#4.0) (#4.0) (#4.0) + <. (sqrt x4)))`;; + +(* interval verification by Ferguson *) +let I_357477295_3= + all_forall `ineq +[((#4.0), x1, square_2t0); +((#4.0), x3, square_2t0); +((#8.0), x4, (square (#3.2))); +(square_2t0, x5, (#8.0)) + ] + (((vor_0_x x1 (#4.0) x3 x4 x5 (#4.0))+ + (vor_0_x (#4.0) (#4.0) x3 x4 (#4.0) (#4.0)) <. (--(#0.075))) \/ + (cross_diag_x x1 (#4.0) x3 x4 x5 (#4.0) (#4.0) (#4.0) (#4.0) + <. (sqrt x4)))`;; + +(* interval verification by Ferguson *) +let I_357477295_4= + all_forall `ineq +[((#4.0), x1, square_2t0); +((#4.0), x3, square_2t0); +((#8.0), x4, (square (#3.2))); +((#8.0), x5, (square (#3.2))) + ] + (((vor_0_x x1 (#4.0) x3 x4 x5 (#4.0))+ + (vor_0_x (#4.0) (#4.0) x3 x4 (#4.0) (#4.0)) <. (--(#0.137))) \/ + (cross_diag_x x1 (#4.0) x3 x4 x5 (#4.0) (#4.0) (#4.0) (#4.0) + <. (sqrt x4)))`;; + +let CIVA19_128523606 = list_mk_conj + [ I_357477295_1;I_357477295_2;I_357477295_3;I_357477295_4;];; + +(* + +LOC: 2002 IV, page 50--51 +Section A20 + +Let $Q$ be a quadrilateral subcluster +whose edges are described by the vector + $$(2,2,a_2,2,2,b_3,a_4,b_4).$$ +Assume $b_4\ge b_3$, $b_4\in\{2t_0,2\sqrt2\}$, +$b_3\in\{2,2t_0,2\sqrt2\}$, $a_2,a_4\in\{2,2t_0\}$. Assume that the +diagonal between corners $1$ and $3$ has length in $[2\sqrt2,3.2]$, and +that the other diagonal has length $\ge3.2$. Let $k_0$, $k_1$, $k_2$ be +the number of $b_i$ equal to $2$, $2t_0$, $2\sqrt2$, respectively. If +$b_4=2t_0$ and $b_3=2$, no such subcluster exists (the reader can check +that $\Delta(4,4,x_3,4,2t_0^2,x_6)<0$ under these conditions), and we +exclude this case. + +b4 b3 k0 k1 k2 +++ ++ 0 0 2 +++ + 0 1 1 +++ 0 1 0 1 + + + 0 2 0 + + 0 1 1 0 X + +Need Z42 and Z41 + D42 and D41 +*) + +(* b4 b3 a2 a4 *) +(* interval verification by Ferguson *) +let I_193776341_GEN= + `(\ b4 b3 a2 a4 k0 k1 k2. ( +let x1 = (a4) in +let x2 = (#4.0) in +let x3 = (#4.0) in +let x5 = (b3) in +let x6 = (b4) in + (ineq +[ +((#8.0), (x4:real), (square (#3.2)))] + (((vor_0_x x1 x2 x3 x4 x5 x6) + + (vor_0_x (a2) x2 x3 x4 (#4.0) (#4.0)) <. + ((if (k1+k2 = 2) then Z42 else Z41) - + ((#0.009)*(&.k2) + (&. (k0+ 2 *k2))*((#0.008)/(#3.0)))) + ) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 a2 (#4.0) (#4.0) + <. ((#3.2)))))))`;; + +(* interval verification by Ferguson *) +let I_193776341_1= + all_forall (list_mk_comb(I_193776341_GEN, + [`#8.0`;`#8.0`;`#4.0`;`#4.0`;`0`;`0`;`2`]));; + +(* interval verification by Ferguson *) +let I_193776341_2= + all_forall (list_mk_comb(I_193776341_GEN, + [`#8.0`;`#8.0`;`#4.0`;`square_2t0`;`0`;`0`;`2`]));; + +(* interval verification by Ferguson *) +let I_193776341_3= + all_forall (list_mk_comb(I_193776341_GEN, + [`#8.0`;`#8.0`;`square_2t0`;`square_2t0`;`0`;`0`;`2`]));; + +(* interval verification by Ferguson *) +let I_193776341_4= + all_forall (list_mk_comb(I_193776341_GEN, + [`#8.0`;`#8.0`;`square_2t0`;`#4.0`;`0`;`0`;`2`]));; + +(* interval verification by Ferguson *) +let I_193776341_5= + all_forall (list_mk_comb(I_193776341_GEN, + [`#8.0`;`square_2t0`;`#4.0`;`#4.0`;`0`;`1`;`1`]));; + +(* interval verification by Ferguson *) +let I_193776341_6= + all_forall (list_mk_comb(I_193776341_GEN, + [`#8.0`;`square_2t0`;`#4.0`;`square_2t0`;`0`;`1`;`1`]));; + +(* interval verification by Ferguson *) +let I_193776341_7= + all_forall (list_mk_comb(I_193776341_GEN, + [`#8.0`;`square_2t0`;`square_2t0`;`square_2t0`;`0`;`1`;`1`]));; + +(* interval verification by Ferguson *) +let I_193776341_8= + all_forall (list_mk_comb(I_193776341_GEN, + [`#8.0`;`square_2t0`;`square_2t0`;`#4.0`;`0`;`1`;`1`]));; + +(* interval verification by Ferguson *) +let I_193776341_9= + all_forall (list_mk_comb(I_193776341_GEN, + [`#8.0`;`#4.0`;`#4.0`;`#4.0`;`1`;`0`;`1`]));; + +(* interval verification by Ferguson *) +let I_193776341_10= + all_forall (list_mk_comb(I_193776341_GEN, + [`#8.0`;`#4.0`;`#4.0`;`square_2t0`;`1`;`0`;`1`]));; + +(* interval verification by Ferguson *) +let I_193776341_11= + all_forall (list_mk_comb(I_193776341_GEN, + [`#8.0`;`#4.0`;`square_2t0`;`square_2t0`;`1`;`0`;`1`]));; + +(* interval verification by Ferguson *) +let I_193776341_12= + all_forall (list_mk_comb(I_193776341_GEN, + [`#8.0`;`#4.0`;`square_2t0`;`#4.0`;`1`;`0`;`1`]));; + +(* interval verification by Ferguson *) +let I_193776341_13= all_forall (list_mk_comb(I_193776341_GEN, + [`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`0`;`2`;`0`]));; + +(* interval verification by Ferguson *) +let I_193776341_14= + all_forall (list_mk_comb(I_193776341_GEN, + [`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`0`;`2`;`0`]));; + +(* interval verification by Ferguson *) +let I_193776341_15= + all_forall (list_mk_comb(I_193776341_GEN, + [`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`0`;`2`;`0`]));; + +(* interval verification by Ferguson *) +let I_193776341_16= + all_forall (list_mk_comb(I_193776341_GEN, + [`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`0`;`2`;`0`]));; + +(* interval verification by Ferguson *) +let I_898647773_GEN= + `(\ b4 b3 a2 a4 k0 k1 k2. ( +let x1 = (a4) in +let x2 = (#4.0) in +let x3 = (#4.0) in +let x5 = (b3) in +let x6 = (b4) in + (ineq +[ +((#8.0), (x4:real), (square (#3.2)))] + (((tau_0_x x1 x2 x3 x4 x5 x6) + + (tau_0_x (a2) x2 x3 x4 (#4.0) (#4.0)) >. + ((if (k1+k2 = 2) then D42 else D41) + (#0.04683) + + ((#0.0066)*(&.k2) + ((&. (k0+ 2 *k2))-(#3.0))*((#0.008)/(#3.0)))) + ) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 a2 (#4.0) (#4.0) + <. ((#3.2)))))))`;; + + +(* interval verification by Ferguson *) +let I_898647773_1= + all_forall (list_mk_comb(I_898647773_GEN, + [`#8.0`;`#8.0`;`#4.0`;`#4.0`;`0`;`0`;`2`]));; + +(* interval verification by Ferguson *) +let I_898647773_2= + all_forall (list_mk_comb(I_898647773_GEN, + [`#8.0`;`#8.0`;`#4.0`;`square_2t0`;`0`;`0`;`2`]));; + +(* interval verification by Ferguson *) +let I_898647773_3= + all_forall (list_mk_comb(I_898647773_GEN, + [`#8.0`;`#8.0`;`square_2t0`;`square_2t0`;`0`;`0`;`2`]));; + +(* interval verification by Ferguson *) +let I_898647773_4= + all_forall (list_mk_comb(I_898647773_GEN, + [`#8.0`;`#8.0`;`square_2t0`;`#4.0`;`0`;`0`;`2`]));; + +(* interval verification by Ferguson *) +let I_898647773_5= + all_forall (list_mk_comb(I_898647773_GEN, + [`#8.0`;`square_2t0`;`#4.0`;`#4.0`;`0`;`1`;`1`]));; + +(* interval verification by Ferguson *) +let I_898647773_6= all_forall (list_mk_comb(I_898647773_GEN, + [`#8.0`;`square_2t0`;`#4.0`;`square_2t0`;`0`;`1`;`1`]));; + +(* interval verification by Ferguson *) +let I_898647773_7= + all_forall (list_mk_comb(I_898647773_GEN, + [`#8.0`;`square_2t0`;`square_2t0`;`square_2t0`;`0`;`1`;`1`]));; + +(* interval verification by Ferguson *) +let I_898647773_8= + all_forall (list_mk_comb(I_898647773_GEN, + [`#8.0`;`square_2t0`;`square_2t0`;`#4.0`;`0`;`1`;`1`]));; + +(* interval verification by Ferguson *) +let I_898647773_9= + all_forall (list_mk_comb(I_898647773_GEN, + [`#8.0`;`#4.0`;`#4.0`;`#4.0`;`1`;`0`;`1`]));; + +(* interval verification by Ferguson *) +let I_898647773_10= + all_forall (list_mk_comb(I_898647773_GEN, + [`#8.0`;`#4.0`;`#4.0`;`square_2t0`;`1`;`0`;`1`]));; + +(* interval verification by Ferguson *) +let I_898647773_11= + all_forall (list_mk_comb(I_898647773_GEN, + [`#8.0`;`#4.0`;`square_2t0`;`square_2t0`;`1`;`0`;`1`]));; + +(* interval verification by Ferguson *) +let I_898647773_12= + all_forall (list_mk_comb(I_898647773_GEN, + [`#8.0`;`#4.0`;`square_2t0`;`#4.0`;`1`;`0`;`1`]));; + +(* interval verification by Ferguson *) +let I_898647773_13= + all_forall (list_mk_comb(I_898647773_GEN, + [`square_2t0`;`square_2t0`;`#4.0`;`#4.0`;`0`;`2`;`0`]));; + +(* interval verification by Ferguson *) +let I_898647773_14= + all_forall (list_mk_comb(I_898647773_GEN, + [`square_2t0`;`square_2t0`;`#4.0`;`square_2t0`;`0`;`2`;`0`]));; + +(* interval verification by Ferguson *) +let I_898647773_15= + all_forall (list_mk_comb(I_898647773_GEN, + [`square_2t0`;`square_2t0`;`square_2t0`;`square_2t0`;`0`;`2`;`0`]));; + +(* interval verification by Ferguson *) +let I_898647773_16= + all_forall (list_mk_comb(I_898647773_GEN, + [`square_2t0`;`square_2t0`;`square_2t0`;`#4.0`;`0`;`2`;`0`]));; + +(* STM 1/13/08. Added parentheses. This was not parsing correctly *) +(* interval verification by Ferguson *) +let I_844634710_1= + all_forall ` +let a2 = (#4.0) in +let a4 = (#4.0) in +let b4 = (#8.0) in +let b3 = (#8.0) in +let x1 = (a4) in +let x2 = (#4.0) in +let x3 = (#4.0) in +let x5 = (b3) in +let x6 = (b4) in + (ineq +[ +((#8.0), (x4:real), (square (#3.2)))] + ((((vor_0_x x1 x2 x3 x4 x5 x6) + + (vor_0_x (a2) x2 x3 x4 (#4.0) (#4.0)) <. + Z42 - (#0.0461) - (#0.009) - (&.2)*(#0.008))) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 a2 (#4.0) (#4.0) + <. ((#3.2)))))`;; + +(* STM 1/13/08. Added parentheses. This was not parsing correctly *) +(* interval verification by Ferguson *) +let I_844634710_2= + all_forall ` +let a2 = (square_2t0) in +let a4 = (#4.0) in +let b4 = (#8.0) in +let b3 = (#8.0) in +let x1 = (a4) in +let x2 = (#4.0) in +let x3 = (#4.0) in +let x5 = (b3) in +let x6 = (b4) in + (ineq +[ +((#8.0), (x4:real), (square (#3.2)))] + ((((vor_0_x x1 x2 x3 x4 x5 x6) + + (vor_0_x (a2) x2 x3 x4 (#4.0) (#4.0)) <. + Z42 - (#0.0461) - (#0.009) - (&.2)*(#0.008))) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 a2 (#4.0) (#4.0) + <. ((#3.2)))))`;; + +(* STM 1/13/08. Added parentheses. This was not parsing correctly *) +(* interval verification by Ferguson *) +let I_844634710_3= + all_forall ` +let a2 = (#4.0) in +let a4 = (#4.0) in +let b4 = (#8.0) in +let b3 = (square_2t0) in +let x1 = (a4) in +let x2 = (#4.0) in +let x3 = (#4.0) in +let x5 = (b3) in +let x6 = (b4) in + (ineq +[ +((#8.0), (x4:real), (square (#3.2)))] + ((((vor_0_x x1 x2 x3 x4 x5 x6) + + (vor_0_x (a2) x2 x3 x4 (#4.0) (#4.0)) <. + Z42 - (#0.0461) - (#0.009) - (&.2)*(#0.008))) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 a2 (#4.0) (#4.0) + <. ((#3.2)))))`;; + +(* STM 1/13/08. Added parentheses. This was not parsing correctly *) +(* interval verification by Ferguson *) +let I_844634710_4= + all_forall ` +let a2 = (square_2t0) in +let a4 = (#4.0) in +let b4 = (#8.0) in +let b3 = (square_2t0) in +let x1 = (a4) in +let x2 = (#4.0) in +let x3 = (#4.0) in +let x5 = (b3) in +let x6 = (b4) in + (ineq +[((#8.0), (x4:real), (square (#3.2)))] + ((((vor_0_x x1 x2 x3 x4 x5 x6) + + (vor_0_x (a2) x2 x3 x4 (#4.0) (#4.0)) <. + (Z42 - (#0.0461) - (#0.009) - (&.2)*(#0.008)))) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 a2 (#4.0) (#4.0) + <. ((#3.2)))))`;; + + +(* interval verification by Ferguson *) +let I_328845176_1= + all_forall ` +let a2 = (#4.0) in +let a4 = (#4.0) in +let b4 = (#8.0) in +let b3 = (#8.0) in +let x1 = (a4) in +let x2 = (#4.0) in +let x3 = (#4.0) in +let x5 = (b3) in +let x6 = (b4) in + (ineq +[ +((#8.0), (x4:real), (square (#3.2)))] + ((((tau_0_x x1 x2 x3 x4 x5 x6) + + (tau_0_x (a2) x2 x3 x4 (#4.0) (#4.0)) >. + D51 + (#0.04683)+(#0.008)+(&.2)*(#0.066))) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 a2 (#4.0) (#4.0) + <. ((#3.2)))))`;; + +(* interval verification by Ferguson *) +let I_328845176_2= + all_forall ` +let a2 = (square_2t0) in +let a4 = (#4.0) in +let b4 = (#8.0) in +let b3 = (#8.0) in +let x1 = (a4) in +let x2 = (#4.0) in +let x3 = (#4.0) in +let x5 = (b3) in +let x6 = (b4) in + (ineq +[ +((#8.0), (x4:real), (square (#3.2)))] + ((((tau_0_x x1 x2 x3 x4 x5 x6) + + (tau_0_x (a2) x2 x3 x4 (#4.0) (#4.0)) >. + D51 + (#0.04683)+(#0.008)+(&.2)*(#0.066))) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 a2 (#4.0) (#4.0) + <. ((#3.2)))))`;; + +(* STM 1/13/08. Added parentheses. This was not parsing correctly *) +(* interval verification by Ferguson *) +let I_328845176_3= + all_forall ` +let a2 = (#4.0) in +let a4 = (#4.0) in +let b4 = (#8.0) in +let b3 = (square_2t0) in +let x1 = (a4) in +let x2 = (#4.0) in +let x3 = (#4.0) in +let x5 = (b3) in +let x6 = (b4) in + (ineq +[ +((#8.0), (x4:real), (square (#3.2)))] + ((((tau_0_x x1 x2 x3 x4 x5 x6) + + (tau_0_x (a2) x2 x3 x4 (#4.0) (#4.0)) >. + D51 + (#0.04683)+(#0.008)+(&.2)*(#0.066))) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 a2 (#4.0) (#4.0) + <. ((#3.2)))))`;; + +(* STM 1/13/08. Added parentheses. This was not parsing correctly *) +(* interval verification by Ferguson *) +let I_328845176_4= + all_forall ` +let a2 = (square_2t0) in +let a4 = (#4.0) in +let b4 = (#8.0) in +let b3 = (square_2t0) in +let x1 = (a4) in +let x2 = (#4.0) in +let x3 = (#4.0) in +let x5 = (b3) in +let x6 = (b4) in + (ineq +[((#8.0), (x4:real), (square (#3.2)))] + ((((tau_0_x x1 x2 x3 x4 x5 x6) + + (tau_0_x (a2) x2 x3 x4 (#4.0) (#4.0)) >. + D51 + (#0.04683)+(#0.008)+(&.2)*(#0.066))) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 a2 (#4.0) (#4.0) + <. ((#3.2)))))`;; + + +(* interval verification by Ferguson *) +let I_233273785_1= + all_forall ` +let a2 = (#4.0) in +let a4 = (#4.0) in +let b4 = (#8.0) in +let b3 = (#4.0) in +let x1 = (a4) in +let x2 = (#4.0) in +let x3 = (#4.0) in +let x5 = (b3) in +let x6 = (b4) in + (ineq +[ +((#8.0), (x4:real), (square (#3.2)))] + (((vor_0_x x1 x2 x3 x4 x5 x6) + + (vor_0_x (a2) x2 x3 x4 (#4.0) (#4.0)) <. + s5 - (#0.0461) - (#0.008)) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 a2 (#4.0) (#4.0) + <. ((#3.2)))))`;; + +(* interval verification by Ferguson *) +let I_233273785_2= + all_forall ` +let a2 = (square_2t0) in +let a4 = (#4.0) in +let b4 = (#8.0) in +let b3 = (#4.0) in +let x1 = (a4) in +let x2 = (#4.0) in +let x3 = (#4.0) in +let x5 = (b3) in +let x6 = (b4) in + (ineq +[ +((#8.0), (x4:real), (square (#3.2)))] + (((vor_0_x x1 x2 x3 x4 x5 x6) + + (vor_0_x (a2) x2 x3 x4 (#4.0) (#4.0)) <. + s5 - (#0.0461) - (#0.008)) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 a2 (#4.0) (#4.0) + <. ((#3.2)))))`;; + +(* interval verification by Ferguson *) +let I_96695550_1= + all_forall ` +let a2 = (#4.0) in +let a4 = (#4.0) in +let b4 = (#8.0) in +let b3 = (#4.0) in +let x1 = (a4) in +let x2 = (#4.0) in +let x3 = (#4.0) in +let x5 = (b3) in +let x6 = (b4) in + (ineq +[ +((#8.0), (x4:real), (square (#3.2)))] + (((tau_0_x x1 x2 x3 x4 x5 x6) + + (tau_0_x (a2) x2 x3 x4 (#4.0) (#4.0)) >. + t5 + (#0.008)) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 a2 (#4.0) (#4.0) + <. ((#3.2)))))`;; + +(* interval verification by Ferguson *) +let I_96695550_2= + all_forall ` +let a2 = (square_2t0) in +let a4 = (#4.0) in +let b4 = (#8.0) in +let b3 = (#4.0) in +let x1 = (a4) in +let x2 = (#4.0) in +let x3 = (#4.0) in +let x5 = (b3) in +let x6 = (b4) in + (ineq +[ +((#8.0), (x4:real), (square (#3.2)))] + (((tau_0_x x1 x2 x3 x4 x5 x6) + + (tau_0_x (a2) x2 x3 x4 (#4.0) (#4.0)) >. + t5 + (#0.008)) + \/ + (cross_diag_x x1 x2 x3 x4 x5 x6 a2 (#4.0) (#4.0) + <. ((#3.2)))))`;; + +let CIVA20_874876755 = list_mk_conj + [ I_193776341_1;I_193776341_2;I_193776341_3;I_193776341_4; + I_193776341_5;I_193776341_6;I_193776341_7;I_193776341_8; + I_193776341_9;I_193776341_10;I_193776341_11;I_193776341_12; + I_193776341_13;I_193776341_14;I_193776341_15;I_193776341_16; + I_898647773_1;I_898647773_2;I_898647773_3;I_898647773_4; + I_898647773_5;I_898647773_6;I_898647773_7;I_898647773_8; + I_898647773_9;I_898647773_10;I_898647773_11;I_898647773_12; + I_898647773_13;I_898647773_14;I_898647773_15;I_898647773_16; + I_844634710_1;I_844634710_2;I_844634710_3;I_844634710_4; + I_328845176_1;I_328845176_2;I_328845176_3;I_328845176_4; + I_233273785_1;I_233273785_2;I_96695550_1;I_96695550_2;];; +(* + +LOC: 2002 IV, page 51 +Section A21 +*) + + + +(* interval verification by Ferguson *) +let I_275286804= + all_forall `ineq + [((#8.0), x4, (square (#3.2))); + ((#8.0), x4', (square (#3.2))) + ] + ( ( + (vor_0_x (#4.0) (#4.0) (#4.0) x4 (#4.0) (#4.0)) +. + (vor_0_x (#4.0) (#4.0) (#4.0) x4' (#4.0) (#4.0)) +. + (vor_0_x (#4.0) (#4.0) (#4.0) x4 x4' (#4.0))) <. + ( (--. (#0.05704)) +. (--. (#0.008))))`;; + + + +(* interval verification by Ferguson *) +let I_627654828= + all_forall `ineq + [((#8.0), x4, (square (#3.2))); + ((#8.0), x4', (square (#3.2))) + ] + ( ( (tau_0_x (#4.0) (#4.0) (#4.0) x4 (#4.0) (#4.0)) +. + (tau_0_x (#4.0) (#4.0) (#4.0) x4' (#4.0) (#4.0)) +. + (tau_0_x (#4.0) (#4.0) (#4.0) x4 x4' (#4.0))) >. + ( (#0.27113) +. (#0.008)))`;; + + + +(* interval verification by Ferguson *) +let I_995177961= + all_forall `ineq + [((#8.0), x4, (square (#3.2))); + ((#8.0), x5, (square (#3.2))); + ((#8.0), x6, (square (#3.2))) + ] + ( (vor_0_x (#4.0) (#4.0) (#4.0) x4 x5 x6) <. + ( ( (--. (#2.0)) *. (#0.008)) +. (--. (#0.11408)) +. + ( (--. (#3.0)) *. (#0.0461))))`;; + + + +(* interval verification by Ferguson *) +let I_735892048= + all_forall `ineq + [((#8.0), x4, (square (#3.2))); + ((#8.0), x5, (square (#3.2))); + ((#8.0), x6, (square (#3.2))) + ] + ( (tau_0_x (#4.0) (#4.0) (#4.0) x4 x5 x6) >. + ( (#0.41056) +. (#0.06688)))`;; + +let CIVA21_692155251 = list_mk_conj + [ I_275286804;I_627654828;I_995177961;I_735892048;];; +(* + +LOC: 2002 IV, page 51 +Section A22 + +Note from text: +In $\A_{22}$ and $\A_{23}$, $y_1\in [2t_0,2\sqrt2]$, +$y_4\in[2\sqrt2,3.2]$, and $\dih<2.46$. $\vor_0(Q)$ denotes the +truncated Voronoi function on the union of an anchored simplex and an +adjacent special simplex. Let $S'$ be the special simplex. By +deformations, $y_1(S')\in\{2,2t_0\}$. If $y_1(S')=2t_0$, the +verifications follow from $\A_6$ and $\vor_0(S')\le0$. We may assume +that $y_1(S')=2$. Also by deformations, $y_5(S')=y_6(S')=2$. + +*) + + +(* ineq changed from weak to strick on dih *) +(* interval verification by Ferguson *) +let I_53502142= + all_forall `ineq + [(square_2t0,x1,(#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + (((vor_0_x x1 x2 x3 x4 x5 x6) + (vor_0_x (#4.0) x2 x3 x4 (#4.0) (#4.0)) + <. (--(#3.58) + (#2.28501)*(dih_x x1 x2 x3 x4 x5 x6))) \/ + (dih_x x1 x2 x3 x4 x5 x6 >. (#2.46)))`;; + +(* ineq changed from weak to strick on dih *) +(* interval verification by Ferguson *) +let I_134398524= + all_forall `ineq + [(square_2t0,x1,(#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + (((vor_0_x x1 x2 x3 x4 x5 x6) + (vor_0_x (#4.0) x2 x3 x4 (#4.0) (#4.0)) + <. (--(#2.715) + (#1.67382)*(dih_x x1 x2 x3 x4 x5 x6))) \/ + (dih_x x1 x2 x3 x4 x5 x6 >. (#2.46)))`;; + +(* ineq changed from weak to strick on dih *) +(* interval verification by Ferguson *) +let I_371491817= + all_forall `ineq + [(square_2t0,x1,(#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + (((vor_0_x x1 x2 x3 x4 x5 x6) + (vor_0_x (#4.0) x2 x3 x4 (#4.0) (#4.0)) + <. (--(#1.517) + (#0.8285)*(dih_x x1 x2 x3 x4 x5 x6))) \/ + (dih_x x1 x2 x3 x4 x5 x6 >. (#2.46)))`;; + +(* ineq changed from weak to strick on dih *) +(* interval verification by Ferguson *) +let I_832922998= + all_forall `ineq + [(square_2t0,x1,(#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + (((vor_0_x x1 x2 x3 x4 x5 x6) + (vor_0_x (#4.0) x2 x3 x4 (#4.0) (#4.0)) + <. (--(#0.858) + (#0.390925)*(dih_x x1 x2 x3 x4 x5 x6))) \/ + (dih_x x1 x2 x3 x4 x5 x6 >. (#2.46)))`;; + +(* ineq changed from weak to strick on dih *) +(* interval verification by Ferguson *) +let I_724796759= + all_forall `ineq + [(square_2t0,x1,(#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + (((vor_0_x x1 x2 x3 x4 x5 x6) + (vor_0_x (#4.0) x2 x3 x4 (#4.0) (#4.0)) + <. (--(#0.358) + (#0.009)+ (#0.12012)*(dih_x x1 x2 x3 x4 x5 x6))) \/ + (dih_x x1 x2 x3 x4 x5 x6 >. (#2.46)))`;; + +(* ineq changed from weak to strick on dih *) +(* interval verification by Ferguson *) +let I_431940343= + all_forall `ineq + [(square_2t0,x1,(#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, (square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + (((vor_0_x x1 x2 x3 x4 x5 x6) + (vor_0_x (#4.0) x2 x3 x4 (#4.0) (#4.0)) + <. (--(#0.186) + (#0.009)+ (#0.0501)*(dih_x x1 x2 x3 x4 x5 x6))) \/ + (dih_x x1 x2 x3 x4 x5 x6 >. (#2.46)))`;; + + + + +(* interval verification by Ferguson *) +let I_980721294= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + (square_2t0, x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. ( ( (--. (#3.58)) / (#2.0)) +. ( (#2.28501) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + + +(* interval verification by Ferguson *) +let I_989564937= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + (square_2t0, x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. ( ( (--. (#2.715)) / (#2.0)) +. ( (#1.67382) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + + +(* interval verification by Ferguson *) +let I_263355808= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + (square_2t0, x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. ( ( (--. (#1.517)) / (#2.0)) +. ( (#0.8285) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + + +(* interval verification by Ferguson *) +let I_445132132= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + (square_2t0, x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. ( ( (--. (#0.858)) / (#2.0)) +. ( (#0.390925) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + + + +(* interval verification by Ferguson *) +let I_806767374= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + (square_2t0, x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. + ( ( ( (--. (#0.358)) +. (#0.009)) / (#2.0)) +. ( (#0.12012) *. (dih_x x1 x2 x3 x4 x5 x6)) +. + ( (#0.2) *. ( (dih_x x1 x2 x3 x4 x5 x6) +. (--. (#1.23))))))`;; + + + + +(* interval verification by Ferguson *) +let I_511038592= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + (square_2t0, x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (vor_0_x x1 x2 x3 x4 x5 x6) <. + ( ( ( (--. (#0.186)) +. (#0.009)) / (#2.0)) +. ( (#0.0501) *. (dih_x x1 x2 x3 x4 x5 x6)) +. + ( (#0.2) *. ( (dih_x x1 x2 x3 x4 x5 x6) +. (--. (#1.23))))))`;; + +let CIVA22_485049042 = list_mk_conj + [ I_53502142;I_134398524;I_371491817;I_832922998; + I_724796759;I_431940343;I_980721294;I_989564937; + I_263355808;I_445132132;I_806767374;I_511038592;];; + +(* + +LOC: 2002 IV, page 51--52 +Section A23 + +Note from text (appearing after the first seven) : + +Let $S'$ be the special simplex. By deformations, we have +$y_5(S')=y_6(S')=2$, and $y_1(S')\in\{2,2t_0\}$. If $y_1(S')=2t_0$, and +$y_4(S')\le3$, the inequalities listed above follow from Section~$\A_7$ +and the inequality #8 \refno{66753311} + +Similarly, the result follows if $y_2$ or $y_3\ge2.2$ from the +inequality #9 \refno{762922223} + + +Because of these reductions, we may assume in the first batch of +inequalities of $\A_{23}$ that when $y_1(S')\ne2$, we have that +$y_1(S')=2t_0$, $y_5(S')=y_6(S')=2$, $y_4\in[3,3.2]$, +$y_2(S'),y_3(S')\le2.2$. In all but {\tt (371464244)} and {\tt +(657011065)}, if $y_1(S')=2t_0$, we prove the inequality with +$\tau_0(S')$ replaced with its lower bound $0$. + +Again if the cross-diagonal is $2t_0$, we break $Q$ in the other +direction. Let $S''$ be an upright quarter with $y_5=2t_0$. Set $\tau_0 += \tau_0(S'')$. We have ... + +*) + + + + + +(* interval verification by Ferguson *) +let I_4591018_1= + all_forall `ineq + [(square_2t0,x1,(#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4,(square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ((--(tau_0_x x1 x2 x3 x4 x5 x6) ) - + (tau_0_x (#4.0) x2 x3 x4 (#4.0) (#4.0)) + + (#0.06585) <. + (--(#3.48) + (#2.1747)*(dih_x x1 x2 x3 x4 x5 x6))) \/ + (dih_x x1 x2 x3 x4 x5 x6 >. (#2.46)))`;; + +(* interval verification by Ferguson *) +let I_193728878_1= + all_forall `ineq + [(square_2t0,x1,(#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4,(square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ((--(tau_0_x x1 x2 x3 x4 x5 x6) ) - + (tau_0_x (#4.0) x2 x3 x4 (#4.0) (#4.0)) + + (#0.06585) <. + (--(#3.06) + (#1.87427)*(dih_x x1 x2 x3 x4 x5 x6))) \/ + (dih_x x1 x2 x3 x4 x5 x6 >. (#2.46)))`;; + +(* interval verification by Ferguson *) +let I_2724096_1= + all_forall `ineq + [(square_2t0,x1,(#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4,(square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ((--(tau_0_x x1 x2 x3 x4 x5 x6) ) - + (tau_0_x (#4.0) x2 x3 x4 (#4.0) (#4.0)) + + (#0.06585) <. + (--(#1.58) + (#0.83046)*(dih_x x1 x2 x3 x4 x5 x6))) \/ + (dih_x x1 x2 x3 x4 x5 x6 >. (#2.46)))`;; + +(* interval verification by Ferguson *) +let I_213514168_1= + all_forall `ineq + [(square_2t0,x1,(#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4,(square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ((--(tau_0_x x1 x2 x3 x4 x5 x6) ) - + (tau_0_x (#4.0) x2 x3 x4 (#4.0) (#4.0)) + + (#0.06585) <. + (--(#1.06) + (#0.48263)*(dih_x x1 x2 x3 x4 x5 x6))) \/ + (dih_x x1 x2 x3 x4 x5 x6 >. (#2.46)))`;; + +(* interval verification by Ferguson *) +let I_750768322_1= + all_forall `ineq + [(square_2t0,x1,(#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4,(square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ((--(tau_0_x x1 x2 x3 x4 x5 x6) ) - + (tau_0_x (#4.0) x2 x3 x4 (#4.0) (#4.0)) + + (#0.06585) <. + (--(#0.83) + (#0.34833)*(dih_x x1 x2 x3 x4 x5 x6))) \/ + (dih_x x1 x2 x3 x4 x5 x6 >. (#2.46)))`;; + +(* interval verification by Ferguson *) +let I_371464244_1= + all_forall `ineq + [(square_2t0,x1,(#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4,(square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ((--(tau_0_x x1 x2 x3 x4 x5 x6) ) - + (tau_0_x (#4.0) x2 x3 x4 (#4.0) (#4.0)) + + (#0.06585) <. + (--(#0.5) + (#0.1694)*(dih_x x1 x2 x3 x4 x5 x6))) \/ + (dih_x x1 x2 x3 x4 x5 x6 >. (#2.46)))`;; + +(* interval verification by Ferguson *) +let I_657011065_1= + all_forall `ineq + [(square_2t0,x1,(#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4,(square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ((--(tau_0_x x1 x2 x3 x4 x5 x6) ) - + (tau_0_x (#4.0) x2 x3 x4 (#4.0) (#4.0)) + + (#0.06585) <. + (--(#0.29) + (#0.0014)+ (#0.0822)*(dih_x x1 x2 x3 x4 x5 x6))) \/ + (dih_x x1 x2 x3 x4 x5 x6 >. (#2.46)))`;; + + +(* interval verification by Ferguson *) +let I_4591018_2= + all_forall `ineq + [(square_2t0,x1,(#8.0)); + ((#4.0), x2, (square (#2.2))); + ((#4.0), x3, (square (#2.2))); + ((square (#3.0)), x4,(square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ((--(tau_0_x x1 x2 x3 x4 x5 x6) ) - + (tau_0_x (square_2t0) x2 x3 x4 (#4.0) (#4.0)) + + (#0.06585) <. + (--(#3.48) + (#2.1747)*(dih_x x1 x2 x3 x4 x5 x6))) \/ + (dih_x x1 x2 x3 x4 x5 x6 >. (#2.46)))`;; + +(* interval verification by Ferguson *) +let I_193728878_2= + all_forall `ineq + [(square_2t0,x1,(#8.0)); + ((#4.0), x2, (square (#2.2))); + ((#4.0), x3, (square (#2.2))); + ((square (#3.0)), x4,(square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ((--(tau_0_x x1 x2 x3 x4 x5 x6) ) - + (tau_0_x (square_2t0) x2 x3 x4 (#4.0) (#4.0)) + + (#0.06585) <. + (--(#3.06) + (#1.87427)*(dih_x x1 x2 x3 x4 x5 x6))) \/ + (dih_x x1 x2 x3 x4 x5 x6 >. (#2.46)))`;; + +(* interval verification by Ferguson *) +let I_2724096_2= + all_forall `ineq + [(square_2t0,x1,(#8.0)); + ((#4.0), x2, (square (#2.2))); + ((#4.0), x3, (square (#2.2))); + ((square (#3.0)), x4,(square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ((--(tau_0_x x1 x2 x3 x4 x5 x6) ) - + (tau_0_x (square_2t0) x2 x3 x4 (#4.0) (#4.0)) + + (#0.06585) <. + (--(#1.58) + (#0.83046)*(dih_x x1 x2 x3 x4 x5 x6))) \/ + (dih_x x1 x2 x3 x4 x5 x6 >. (#2.46)))`;; + +(* interval verification by Ferguson *) +let I_213514168_2= + all_forall `ineq + [(square_2t0,x1,(#8.0)); + ((#4.0), x2, (square (#2.2))); + ((#4.0), x3, (square (#2.2))); + ((square (#3.0)), x4,(square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ((--(tau_0_x x1 x2 x3 x4 x5 x6) ) - + (tau_0_x (square_2t0) x2 x3 x4 (#4.0) (#4.0)) + + (#0.06585) <. + (--(#1.06) + (#0.48263)*(dih_x x1 x2 x3 x4 x5 x6))) \/ + (dih_x x1 x2 x3 x4 x5 x6 >. (#2.46)))`;; + +(* interval verification by Ferguson *) +let I_750768322_2= + all_forall `ineq + [(square_2t0,x1,(#8.0)); + ((#4.0), x2, (square (#2.2))); + ((#4.0), x3, (square (#2.2))); + ((square (#3.0)), x4,(square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ((--(tau_0_x x1 x2 x3 x4 x5 x6) ) - + (tau_0_x (square_2t0) x2 x3 x4 (#4.0) (#4.0)) + + (#0.06585) <. + (--(#0.83) + (#0.34833)*(dih_x x1 x2 x3 x4 x5 x6))) \/ + (dih_x x1 x2 x3 x4 x5 x6 >. (#2.46)))`;; + +(* interval verification by Ferguson *) +(* +WWW infeasible +*) +let I_371464244_2= + all_forall `ineq + [(square_2t0,x1,(#8.0)); + ((#4.0), x2, (square (#2.2))); + ((#4.0), x3, (square (#2.2))); + ((square (#3.0)), x4,(square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ((--(tau_0_x x1 x2 x3 x4 x5 x6) ) - + (tau_0_x (square_2t0) x2 x3 x4 (#4.0) (#4.0)) + + (#0.06585) <. + (--(#0.5) + (#0.1694)*(dih_x x1 x2 x3 x4 x5 x6))) \/ + (dih_x x1 x2 x3 x4 x5 x6 >. (#2.46)))`;; + +(* interval verification by Ferguson *) +let I_657011065_2 = + all_forall `ineq + [(square_2t0,x1,(#8.0)); + ((#4.0), x2, (square (#2.2))); + ((#4.0), x3, (square (#2.2))); + ((square (#3.0)), x4,(square (#3.2))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ((--(tau_0_x x1 x2 x3 x4 x5 x6) ) - + (tau_0_x (square_2t0) x2 x3 x4 (#4.0) (#4.0)) + + (#0.06585) <. + (--(#0.29) + (#0.0014)+ (#0.0822)*(dih_x x1 x2 x3 x4 x5 x6))) \/ + (dih_x x1 x2 x3 x4 x5 x6 >. (#2.46)))`;; + + +(* calcs 8 --9 *) +(* interval verification by Ferguson *) +(* id number corrected from 55753311 *) + +let I_66753311= + all_forall `ineq + [ ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4,(square (#3.0))) + ] + ( + (tau_0_x (square_2t0) x2 x3 x4 (#4.0) (#4.0) ) >. (#0.06585) + )`;; + +(* interval verification by Ferguson *) +(* +CCC fixed domain 3/10/2008. +Bound: 0.0658173454705 + +Point: [4.09979901231, 4.0015878624, 9.8006368154] + +*) +let I_762922223= + all_forall `ineq + [ ((square (#2.2)), x2,square_2t0); + ((#4.0), x3, square_2t0); + ((square (#3.0)), x4,(square (#3.2))) + ] + ( + (tau_0_x (square_2t0) x2 x3 x4 (#4.0) (#4.0) ) >. (#0.06585) + )`;; + + +(* calcs 10 -- 16 *) +(* interval verification by Ferguson *) +let I_953023504= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + (square_2t0, x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( ( (( --. ) (tau_0_x x1 x2 x3 x4 x5 x6)) +. + ( (#0.06585) / (#2.0))) <. + ( ( (--. (#3.48)) / (#2.0)) +. + ( (#2.1747) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + +(* interval verification by Ferguson *) +let I_887276655= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + (square_2t0, x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( ( (( --. ) (tau_0_x x1 x2 x3 x4 x5 x6)) +. + ( (#0.06585) / (#2.0))) <. + ( ( (--. (#3.06)) / (#2.0)) +. + ( (#1.87427) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + +(* interval verification by Ferguson *) +let I_246315515= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + (square_2t0, x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( ( (( --. ) (tau_0_x x1 x2 x3 x4 x5 x6)) +. + ( (#0.06585) / (#2.0))) <. + ( ( (--. (#1.58)) / (#2.0)) +. + ( (#0.83046) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + +(* interval verification by Ferguson *) +let I_784421604= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + (square_2t0, x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( ( (( --. ) (tau_0_x x1 x2 x3 x4 x5 x6)) +. + ( (#0.06585) / (#2.0))) <. + ( ( (--. (#1.06)) / (#2.0)) +. + ( (#0.48263) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + + +(* interval verification by Ferguson *) +let I_258632246= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + (square_2t0, x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( ( (( --. ) (tau_0_x x1 x2 x3 x4 x5 x6)) +. + ( (#0.06585) / (#2.0))) <. + ( ( (--. (#0.83)) / (#2.0)) +. + ( (#0.34833) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + + +(* interval verification by Ferguson *) +let I_404164527= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + (square_2t0, x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( ( (( --. ) (tau_0_x x1 x2 x3 x4 x5 x6)) +. + ( (#0.06585) / (#2.0))) <. + ( ( (--. (#0.50)) / (#2.0)) +. + ( (#0.1694) *. (dih_x x1 x2 x3 x4 x5 x6)) +. + ( (#0.03) *. ( (dih_x x1 x2 x3 x4 x5 x6) +. + (--. (#1.23))))))`;; + + + +(* interval verification by Ferguson *) +let I_163088471= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + (square_2t0, x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( ( (( --. ) (tau_0_x x1 x2 x3 x4 x5 x6)) +. + ( (#0.06585) / (#2.0))) <. + ( ( (--. (#0.29)) / (#2.0)) +. + ( (#0.0014) / (#2.0)) +. + ( (#0.0822) *. (dih_x x1 x2 x3 x4 x5 x6)) +. + ( (#0.2) *. ( (dih_x x1 x2 x3 x4 x5 x6) +. + (--. (#1.23))))))`;; + +let CIVA23_209361863= list_mk_conj + [ I_4591018_1;I_193728878_1;I_2724096_1;I_213514168_1; + I_750768322_1;I_371464244_1;I_657011065_1;I_4591018_2; + I_193728878_2;I_2724096_2;I_213514168_2;I_750768322_2; + I_371464244_2;I_657011065_2 ;I_66753311;I_762922223; + I_953023504;I_887276655;I_246315515;I_784421604; + I_258632246;I_404164527;I_163088471;];; +(* + +LOC: 2002 IV, page 52 +Section A24 +*) + + +(* interval verification in partK.cc *) +(* interval verification by Ferguson *) +let I_968721007= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, (#4.0)); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, (#4.0)); + ((#4.0), x5, square_2t0); + (square_2t0, x6, (square (#2.75))) + ] + ( ( (tau_0_x x1 x2 x3 x4 x5 x6) +. + ( (#0.0822) *. (dih_x x1 x2 x3 x4 x5 x6))) >. (#0.159))`;; + + + +(* interval verification in partK.cc *) +(* interval verification by Ferguson *) +(* needs delta *) +let I_783968228= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + (square_2t0, x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, (#4.0)); + ((#4.0), x5, square_2t0); + (square_2t0, x6, square_4t0) + ] + (( dih_x x1 x2 x3 x4 x5 x6 <. (#1.23)) \/ + (delta_x x1 x2 x3 x4 x5 x6 <. (#0.0)))`;; + + + +(* interval verification in partK.cc *) +(* interval verification by Ferguson *) +(* needs delta *) +let I_745174731= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, (#4.0)); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, (#4.0)); + ((#4.0), x5, square_2t0); + ((square (#2.75)), x6, square_4t0) + ] + (( (dih_x x1 x2 x3 x4 x5 x6) <. (#1.23)) \/ + (delta_x x1 x2 x3 x4 x5 x6 <. (#0.0)))`;; + +let CIVA24_835344007= list_mk_conj + [ I_968721007;I_783968228;I_745174731;];; + +(* + + +LOC: 2002 III, page 14. +Sec. 10. Group 1. +*) + + + +(* moved 586468779 to inequality_spec.ml *) + + + + +(* moved 984463800 to inequality_spec.ml *) + + + + +(* moved 208809199 to inequality_spec.ml *) + + + + +let J_995444025= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( ( (--. (#0.37642101)) *. (sol_x x1 x2 x3 x4 x5 x6)) +. (#0.287389)))`;; + + + +let J_49987949= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( ( (#0.446634) *. (sol_x x1 x2 x3 x4 x5 x6)) +. (--. (#0.190249))))`;; + + + +let J_825495074= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( ( (--. (#0.419351)) *. (sol_x x1 x2 x3 x4 x5 x6)) +. (#0.2856354) +. (#0.001)))`;; + + + +(* +SKIP equation 7. (sigma(quad) <= 0) +This is proved as a theorem and is not really an +interval arithmetic result. +*) + +(* + +LOC: 2002 III, page 14. +Group_2 +*) + + +let J_544014470= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sol_x x1 x2 x3 x4 x5 x6) >. + ( (#0.551285) +. ( (#0.199235) *. ( (sqrt x4) +. (sqrt x5) +. (sqrt x6) +. (--. (#6.0)))) +. + ( (--. (#0.377076)) *. ( (sqrt x1) +. (sqrt x2) +. (sqrt x3) +. (--. (#6.0))))))`;; + + + +let J_382430711= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sol_x x1 x2 x3 x4 x5 x6) <. + ( (#0.551286) +. ( (#0.320937) *. ( (sqrt x4) +. (sqrt x5) +. (sqrt x6) +. (--. (#6.0)))) +. + ( (--. (#0.152679)) *. ( (sqrt x1) +. (sqrt x2) +. (sqrt x3) +. (--. (#6.0))))))`;; + + + +let J_568731327= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) >. + ( (#1.23095) +. ( (--. (#0.359894)) *. ( (sqrt x2) +. (sqrt x3) +. (sqrt x5) +. (sqrt x6) +. (--. (#8.0)))) +. + ( (#0.003) *. ( (sqrt x1) +. (--. (#2.0)))) +. ( (#0.685) *. ( (sqrt x4) +. (--. (#2.0))))))`;; + + + + +let J_507227930= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <. + ( (#1.23096) +. ( (--. (#0.153598)) *. ( (sqrt x2) +. (sqrt x3) +. (sqrt x5) +. (sqrt x6) +. (--. (#8.0)))) +. + ( (#0.498) *. ( (sqrt x1) +. (--. (#2.0)))) +. ( (#0.76446) *. ( (sqrt x4) +. (--. (#2.0))))))`;; + + + +let J_789045970= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( (#0.0553737) +. + ( (--. (#0.10857)) *. ( (sqrt x1) +. (sqrt x2) +. (sqrt x3) +. (sqrt x4) +. (sqrt x5) +. (sqrt x6) +. (--. (#12.0))))))`;; + + + +let J_710947756= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) +. ( (#0.419351) *. (sol_x x1 x2 x3 x4 x5 x6))) <. + ( (#0.28665) +. ( (--. (#0.2)) *. ( (sqrt x1) +. (sqrt x2) +. (sqrt x3) +. (--. (#6.0))))))`;; + + + +let J_649712615= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma1_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( (#0.000001) +. ( (--. (#0.129119)) *. ( (sqrt x4) +. (sqrt x5) +. (sqrt x6) +. (--. (#6.0)))) +. + ( (--. (#0.0845696)) *. ( (sqrt x1) +. (sqrt x2) +. (sqrt x3) +. (--. (#6.0))))))`;; + + +(* + +LOC: 2002 III, page 14--15 +Sec. 10, Group_3: +*) + +(* interval verification in part3.cc, but labeled there as C619245724 *) +let J_539256862= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( ( (#0.37898) *. (dih_x x1 x2 x3 x4 x5 x6)) +. (--. (#0.4111))))`;; + + +(* interval verification in part3.cc, but labeled there as C678284947 *) +let J_864218323= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( ( (--. (#0.142)) *. (dih_x x1 x2 x3 x4 x5 x6)) +. (#0.23021)))`;; + + +(* interval verification in part3.cc, but labeled there as C970731712 *) +let J_776305271= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( ( (--. (#0.3302)) *. (dih_x x1 x2 x3 x4 x5 x6)) +. (#0.5353)))`;; + + +(* interval verification in part3.cc, but labeled there as C921602098 *) +let J_927432550= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma1_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( ( (#0.3897) *. (dih_x x1 x2 x3 x4 x5 x6)) +. (--. (#0.4666))))`;; + + +(* interval verification in part3.cc, but labeled there as C338482233 *) +let J_221945658= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma1_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( ( (#0.2993) *. (dih_x x1 x2 x3 x4 x5 x6)) +. (--. (#0.3683))))`;; + + +(* interval verification in part3.cc, but labeled there as C47923787 *) +(* moved 53415898 to inequality_spec.ml *) + + + +(* interval verification in part3.cc, but labeled there as C156673846 *) +let J_106537269= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma1_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( ( (--. (#0.1689)) *. (dih_x x1 x2 x3 x4 x5 x6)) +. (#0.208)))`;; + + +(* interval verification in part3.cc, but labeled there as C363044842 *) +let J_254627291= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma1_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( ( (--. (#0.2529)) *. (dih_x x1 x2 x3 x4 x5 x6)) +. (#0.3442)))`;; + + +(* interval verification in part3.cc, but labeled there as C68229886 *) +let J_170403135= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma32_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( ( (#0.4233) *. (dih_x x1 x2 x3 x4 x5 x6)) +. (--. (#0.5974))))`;; + + +(* interval verification in part3.cc, but labeled there as C996335124 *) +let J_802409438= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma32_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( ( (#0.1083) *. (dih_x x1 x2 x3 x4 x5 x6)) +. (--. (#0.255))))`;; + + +(* interval verification in part3.cc, but labeled there as C722658871 *) +let J_195296574= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma32_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( ( (--. (#0.0953)) *. (dih_x x1 x2 x3 x4 x5 x6)) +. (--. (#0.0045))))`;; + + +(* interval verification in part3.cc, but labeled there as C226224557 *) +let J_16189133= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma32_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( ( (--. (#0.1966)) *. (dih_x x1 x2 x3 x4 x5 x6)) +. (#0.1369)))`;; + + +(* interval verification in part3.cc, but labeled there as C914585134 *) +let J_584511898= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( ( (--. (#0.419351)) *. (sol_x x1 x2 x3 x4 x5 x6)) +. + ( (#0.796456) *. (dih_x x1 x2 x3 x4 x5 x6)) +. (--. (#0.5786316))))`;; + + +(* interval verification in part3.cc, but labeled there as C296182719 *) +let J_98170671= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( ( (--. (#0.419351)) *. (sol_x x1 x2 x3 x4 x5 x6)) +. + ( (#0.0610397) *. (dih_x x1 x2 x3 x4 x5 x6)) +. (#0.211419)))`;; + + +(* interval verification in part3.cc, but labeled there as C538860011 *) +let J_868828815= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( ( (--. (#0.419351)) *. (sol_x x1 x2 x3 x4 x5 x6)) +. + ( (--. (#0.0162028)) *. (dih_x x1 x2 x3 x4 x5 x6)) +. (#0.308526)))`;; + + +(* interval verification in part3.cc, but labeled there as C886673381 *) +let J_809197575= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( ( (--. (#0.419351)) *. (sol_x x1 x2 x3 x4 x5 x6)) +. + ( (--. (#0.0499559)) *. (dih_x x1 x2 x3 x4 x5 x6)) +. (#0.35641)))`;; + + +(* interval verification in part3.cc, but labeled there as C681494013 *) +let J_73203677= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( ( (--. (#0.419351)) *. (sol_x x1 x2 x3 x4 x5 x6)) +. + ( (--. (#0.64713719)) *. (dih_x x1 x2 x3 x4 x5 x6)) +. (#1.3225)))`;; + + +let C_830854305 = list_mk_conj[ + J_539256862;J_864218323;J_776305271;J_927432550;J_221945658; + J_53415898;J_106537269;J_254627291;J_170403135;J_802409438; + J_195296574;J_16189133;J_584511898;J_98170671;J_868828815; + J_809197575;J_73203677;];; + + +(* +SKIP statement about Quad clusters at end of Group_3 +This is Prop 4.1 and Prop 4.2 -- a long list of quad ineqs. +These inequalities are in the file kep_inequalities2.ml +*) + +let J_395086940= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( ( ( (--. (#0.398)) *. ( (sqrt x2) +. (sqrt x3) +. (sqrt x5) +. (sqrt x6))) +. + ( (#0.3257) *. (sqrt x1)) +. (( --. ) (dih_x x1 x2 x3 x4 x5 x6))) <. (--. (#4.14938)))`;; + + + +(* +LOC: 2002 III, page 15. +Sec. 10, Group_4 +SKIP equation 5. +equation 5 is Prop 4.3 and Lemma 5.3. +Proposition 4.3 appears in kep_inequalities2.ml. +Lemma 5.3 is derived from other inequalities (Group_5), so it needn't +be listed separately here. + +*) + +(* +LOC: 2002 III, page 15. +Sec. 10, Group_4 +SKIP equation 6. +These are identical to the inequalities of 2002-III-Appendix 1: + A.2.1--11, A.3.1--11, A.4.1--4, A.6.1--9, A.6.1'--8', A.8.1--3. + These are all listed below. +*) + +(* + +LOC: 2002 III, page 15. +Sec. 10, Group_5 +*) + + +let J_550901847= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((square (#2.1773)), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (tau_sigma_x x1 x2 x3 x4 x5 x6) >. ( (#0.55) *. pt))`;; + + + +let J_559163627= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((square (#2.1773)), x4, square_2t0); + ((square (#2.1773)), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (tau_sigma_x x1 x2 x3 x4 x5 x6) >. ( (#2.0) *. (#0.55) *. pt))`;; + + + +let J_571492944= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, (square (#2.1773))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (tau_sigma_x x1 x2 x3 x4 x5 x6) >. ( (--. (#0.29349)) +. ( (#0.2384) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + + +let J_471806843= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, (square (#2.1773))); + ((square (#2.1773)), x5, square_2t0); + ((#4.0), x6, (square (#2.1773))) + ] + ( (tau_sigma_x x1 x2 x3 x4 x5 x6) >. ( (--. (#0.26303)) +. ( (#0.2384) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + + +let J_610154063= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, (square (#2.1773))); + ((#4.0), x5, (square (#2.1773))); + ((square (#2.1773)), x6, square_2t0) + ] + ( (tau_sigma_x x1 x2 x3 x4 x5 x6) >. + ( (--. (#0.5565)) +. ( (#0.2384) *. ( (dih_x x1 x2 x3 x4 x5 x6) +. (dih2_x x1 x2 x3 x4 x5 x6)))))`;; + + + +let J_466112442= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, (square (#2.1773))); + ((#4.0), x5, (square (#2.1773))); + ((#4.0), x6, (square (#2.1773))) + ] + ( (tau_sigma_x x1 x2 x3 x4 x5 x6) >. + ( ( (--. (#2.0)) *. (#0.29349)) +. ( (#0.2384) *. ( (dih_x x1 x2 x3 x4 x5 x6) +. (dih2_x x1 x2 x3 x4 x5 x6)))))`;; + + + +let J_904445624= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, (square (#2.1773))); + ((#4.0), x5, (square (#2.1773))); + ((#4.0), x6, (square (#2.1773))) + ] + ( (tau_sigma_x x1 x2 x3 x4 x5 x6) >. + ( ( (--. (#3.0)) *. (#0.29349)) +. + ( (#0.2384) *. ( (dih_x x1 x2 x3 x4 x5 x6) +. (dih2_x x1 x2 x3 x4 x5 x6) +. + (dih3_x x1 x2 x3 x4 x5 x6)))))`;; + + +let C_636208429 = + list_mk_conj[ + J_550901847;J_559163627;J_571492944;J_471806843;J_610154063; + J_466112442;J_904445624;];; + + +let J_241241504= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((square (#2.177303)), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) <. ( ( (#1.0) +. (--. (#0.48))) *. pt))`;; + +(* Added March 10, 2005. Requested by Lagarias for DCG *) +(* Note to Google flyspeck group, March 10, 2005 *) +(* moved 241241504_1 to inequality_spec.ml *) + + +let J_144820927= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((square (#2.177303)), x4, square_2t0); + ((square (#2.177303)), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) <. ( ( (#1.0) +. ( (--. (#2.0)) *. (#0.48))) *. pt))`;; + + + + +(* moved 82950290 to inequality_spec.ml *) + + + + +let J_938408928= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, (square (#2.177303))); + ((square (#2.177303)), x5, square_2t0); + ((#4.0), x6, (square (#2.177303))) + ] + ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( (#0.28365) +. ( (--. (#0.207045)) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + +let J_739415811= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, (square (#2.177303))); + ((#4.0), x5, (square (#2.177303))); + ((square (#2.177303)), x6, square_2t0) + ] + ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( (#0.53852) +. ( (--. (#0.207045)) *. ( (dih_x x1 x2 x3 x4 x5 x6) +. (dih2_x x1 x2 x3 x4 x5 x6)))))`;; + + + +let J_898558502= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, (square (#2.177303))); + ((#4.0), x5, (square (#2.177303))); + ((#4.0), x6, (square (#2.177303))) + ] + ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( (( --. ) (pt)) +. ( (#2.0) *. (#0.31023815)) +. + ( (--. (#0.207045)) *. ( (dih_x x1 x2 x3 x4 x5 x6) +. (dih2_x x1 x2 x3 x4 x5 x6)))))`;; + + + +let J_413792383= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, (square (#2.177303))); + ((#4.0), x5, (square (#2.177303))); + ((#4.0), x6, (square (#2.177303))) + ] + ( (sigma_qrtet_x x1 x2 x3 x4 x5 x6) <. + ( ( (--. (#2.0)) *. pt) +. ( (#3.0) *. (#0.31023815)) +. + ( (--. (#0.207045)) *. ( (dih_x x1 x2 x3 x4 x5 x6) +. (dih2_x x1 x2 x3 x4 x5 x6) +. + (dih3_x x1 x2 x3 x4 x5 x6)))))`;; + + +let C_129662166 = list_mk_conj [ + J_241241504;J_144820927;J_82950290;J_938408928;J_739415811; + J_898558502;J_413792383;];; + + + + +(* + +LOC: 2002 III, page 17. +Section A.2 (Flat Quarters) +*) + + + +let J_845282627= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (dih2_x x1 x2 x3 x4 x5 x6)) +. ( (#0.35) *. (sqrt x2)) +. ( (--. (#0.15)) *. (sqrt x1)) +. + ( (--. (#0.15)) *. (sqrt x3)) +. ( (#0.7022) *. (sqrt x5)) +. ( (--. (#0.17)) *. (sqrt x4))) >. (--. (#0.0123)))`;; + + + +let J_370569407= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (dih3_x x1 x2 x3 x4 x5 x6)) +. ( (#0.35) *. (sqrt x3)) +. ( (--. (#0.15)) *. (sqrt x1)) +. + ( (--. (#0.15)) *. (sqrt x2)) +. ( (#0.7022) *. (sqrt x6)) +. ( (--. (#0.17)) *. (sqrt x4))) >. (--. (#0.0123)))`;; + + + +let J_339706797= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (dih2_x x1 x2 x3 x4 x5 x6) +. ( (--. (#0.13)) *. (sqrt x2)) +. ( (#0.631) *. (sqrt x1)) +. + ( (#0.31) *. (sqrt x3)) +. ( (--. (#0.58)) *. (sqrt x5)) +. ( (#0.413) *. (sqrt x4)) +. ( (#0.025) *. (sqrt x6))) >. + (#2.63363))`;; + + + +let J_430633660= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (dih3_x x1 x2 x3 x4 x5 x6) +. ( (--. (#0.13)) *. (sqrt x3)) +. ( (#0.631) *. (sqrt x1)) +. + ( (#0.31) *. (sqrt x2)) +. ( (--. (#0.58)) *. (sqrt x6)) +. ( (#0.413) *. (sqrt x4)) +. ( (#0.025) *. (sqrt x5))) >. + (#2.63363))`;; + + + +let J_623340094= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) +. ( (#0.714) *. (sqrt x1)) +. ( (--. (#0.221)) *. (sqrt x2)) +. + ( (--. (#0.221)) *. (sqrt x3)) +. ( (#0.92) *. (sqrt x4)) +. ( (--. (#0.221)) *. (sqrt x5)) +. ( (--. (#0.221)) *. (sqrt x6))) >. + (#0.3482))`;; + + + +let J_27261595= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (dih_x x1 x2 x3 x4 x5 x6) +. ( (--. (#0.315)) *. (sqrt x1)) +. ( (#0.3972) *. (sqrt x2)) +. + ( (#0.3972) *. (sqrt x3)) +. ( (--. (#0.715)) *. (sqrt x4)) +. ( (#0.3972) *. (sqrt x5)) +. ( (#0.3972) *. (sqrt x6))) >. + (#2.37095))`;; + + + +let J_211740764= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (sol_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.187)) *. (sqrt x1)) +. ( (--. (#0.187)) *. (sqrt x2)) +. + ( (--. (#0.187)) *. (sqrt x3)) +. ( (#0.1185) *. (sqrt x4)) +. ( (#0.479) *. (sqrt x5)) +. ( (#0.479) *. (sqrt x6))) >. + (#0.437235))`;; + + + + +let J_954401688= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (sol_x x1 x2 x3 x4 x5 x6) +. ( (#0.488) *. (sqrt x1)) +. ( (#0.488) *. (sqrt x2)) +. + ( (#0.488) *. (sqrt x3)) +. ( (--. (#0.334)) *. (sqrt x5)) +. ( (--. (#0.334)) *. (sqrt x6))) >. + (#2.244))`;; + + + +let J_563700199= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (mu_flat_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.159)) *. (sqrt x1)) +. ( (--. (#0.081)) *. (sqrt x2)) +. + ( (--. (#0.081)) *. (sqrt x3)) +. ( (--. (#0.133)) *. (sqrt x5)) +. ( (--. (#0.133)) *. (sqrt x6))) >. + (--. (#1.17401)))`;; + + + +let J_847997083= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + (mu_flat_x x1 x2 x3 x4 x5 x6) <. + ( ( (--. (#0.419351)) *. (sol_x x1 x2 x3 x4 x5 x6)) +. (#0.1448) +. + ( (#0.0436) *. ( (sqrt x5) +. (sqrt x6) +. (--. (#4.0)))) +. ( (#0.079431) *. (dih_x x1 x2 x3 x4 x5 x6))))`;; + + + +let J_465440863= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + (mu_flat_x x1 x2 x3 x4 x5 x6) <. + ( (#0.000001) +. ( (--. (#0.197)) *. ( (sqrt x4) +. (sqrt x5) +. (sqrt x6) +. ( (--. (#2.0)) *. (sqrt (#2.0))) +. (--. (#4.0))))))`;; + + +(* + +LOC: 2002 III, page 17-18 +Appendix 1 (Some final cases) +Section A3 (upright quarters) +*) + + +let J_875717907= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (dih_x x1 x2 x3 x4 x5 x6) +. ( (--. (#0.636)) *. (sqrt x1)) +. ( (#0.462) *. (sqrt x2)) +. + ( (#0.462) *. (sqrt x3)) +. ( (--. (#0.82)) *. (sqrt x4)) +. ( (#0.462) *. (sqrt x5)) +. ( (#0.462) *. (sqrt x6))) >. + (#1.82419))`;; + + + +let J_614510242= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) +. ( (#0.55) *. (sqrt x1)) +. ( (--. (#0.214)) *. (sqrt x2)) +. + ( (--. (#0.214)) *. (sqrt x3)) +. ( (#1.24) *. (sqrt x4)) +. ( (--. (#0.214)) *. (sqrt x5)) +. ( (--. (#0.214)) *. (sqrt x6))) >. + (#0.75281))`;; + + + +let J_17441891= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (dih2_x x1 x2 x3 x4 x5 x6) +. ( (#0.4) *. (sqrt x1)) +. ( (--. (#0.15)) *. (sqrt x2)) +. + ( (#0.09) *. (sqrt x3)) +. ( (#0.631) *. (sqrt x4)) +. ( (--. (#0.57)) *. (sqrt x5)) +. ( (#0.23) *. (sqrt x6))) >. + (#2.5481))`;; + + + +let J_58663442= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (dih2_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.454)) *. (sqrt x1)) +. ( (#0.34) *. (sqrt x2)) +. + ( (#0.154) *. (sqrt x3)) +. ( (--. (#0.346)) *. (sqrt x4)) +. ( (#0.805) *. (sqrt x5))) >. + (--. (#0.3429)))`;; + + + + +let J_776139048= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (dih3_x x1 x2 x3 x4 x5 x6) +. ( (#0.4) *. (sqrt x1)) +. ( (--. (#0.15)) *. (sqrt x3)) +. + ( (#0.09) *. (sqrt x2)) +. ( (#0.631) *. (sqrt x4)) +. ( (--. (#0.57)) *. (sqrt x6)) +. ( (#0.23) *. (sqrt x5))) >. + (#2.5481))`;; + + + + +let J_695202082= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (dih3_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.454)) *. (sqrt x1)) +. ( (#0.34) *. (sqrt x3)) +. + ( (#0.154) *. (sqrt x2)) +. ( (--. (#0.346)) *. (sqrt x4)) +. ( (#0.805) *. (sqrt x6))) >. + (--. (#0.3429)))`;; + + + +let J_974811809= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (sol_x x1 x2 x3 x4 x5 x6) +. ( (#0.065) *. (sqrt x2)) +. ( (#0.065) *. (sqrt x3)) +. + ( (#0.061) *. (sqrt x4)) +. ( (--. (#0.115)) *. (sqrt x5)) +. ( (--. (#0.115)) *. (sqrt x6))) >. + (#0.2618))`;; + + + +let J_416984093= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (sol_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.239)) *. (sqrt x1)) +. ( (--. (#0.03)) *. (sqrt x2)) +. + ( (--. (#0.03)) *. (sqrt x3)) +. ( (#0.12) *. (sqrt x4)) +. ( (#0.325) *. (sqrt x5)) +. ( (#0.325) *. (sqrt x6))) >. + (#0.2514))`;; + + + +let J_709137309= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (( --. ) (octa_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.054)) *. (sqrt x2)) +. ( (--. (#0.054)) *. (sqrt x3)) +. + ( (--. (#0.083)) *. (sqrt x4)) +. ( (--. (#0.054)) *. (sqrt x5)) +. ( (--. (#0.054)) *. (sqrt x6))) >. + (--. (#0.59834)))`;; + + + +let J_889412880= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + (octa_x x1 x2 x3 x4 x5 x6) <. + ( ( (--. (#0.419351)) *. (sol_x x1 x2 x3 x4 x5 x6)) +. ( (#0.079431) *. (dih2_x x1 x2 x3 x4 x5 x6)) +. + (#0.06904) +. ( (--. (#0.0846)) *. ( (sqrt x1) +. (--. (#2.8))))))`;; + + + +let J_330814127= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, (square (#2.13))); + ((#4.0), x3, (square (#2.13))); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + (octa_x x1 x2 x3 x4 x5 x6) <. + ( ( (#0.07) *. ( (sqrt x1) +. (--. (#2.51)))) +. ( (--. (#0.133)) *. ( (sqrt x2) +. (sqrt x3) +. (sqrt x5) +. (sqrt x6) +. (--. (#8.0)))) +. + ( (#0.135) *. ( (sqrt x4) +. (--. (#2.0))))))`;; + + +(* + +LOC: 2002 III, page 18. +Appendix 1. (Some final cases) +Section A4 (Truncated quad clusters) +*) + + + +let J_739434119= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#8.0), x4, square_4t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (dih_x x1 x2 x3 x4 x5 x6) +. ( (--. (#0.372)) *. (sqrt x1)) +. ( (#0.465) *. (sqrt x2)) +. + ( (#0.465) *. (sqrt x3)) +. ( (#0.465) *. (sqrt x5)) +. ( (#0.465) *. (sqrt x6))) >. + (#4.885))`;; + + + +let J_353908222= + all_forall `ineq + [((#4.0), x1, (square (#2.26))); + ((#4.0), x2, (square (#2.26))); + ((#4.0), x3, (square (#2.26))); + + ((#8.0), x4, square_4t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( ( (( --. ) (vor_0_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.06)) *. (sqrt x2)) +. ( (--. (#0.06)) *. (sqrt x3)) +. + ( (--. (#0.185)) *. (sqrt x5)) +. ( (--. (#0.185)) *. (sqrt x6))) >. (--. (#0.9978))) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >=. (#2.12)))`;; + + + +let J_399226168= + all_forall `ineq + [((#4.0), x1, (square (#2.26))); + ((#4.0), x2, (square (#2.26))); + ((#4.0), x3, (square (#2.26))); + + ((#8.0), x4, square_4t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( ( (( --. ) (vor_0_x x1 x2 x3 x4 x5 x6)) +. ( (#0.419351) *. (sol_x x1 x2 x3 x4 x5 x6))) <. (#0.3072)) \/ + ( (dih_x x1 x2 x3 x4 x5 x6) >=. (#2.12)))`;; + + + +let J_815275408= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( ( (quo_x x1 x2 x6) +. ( (#0.00758) *. (sqrt x1)) +. ( (#0.0115) *. (sqrt x2)) +. ( (#0.0115) *. (sqrt x6))) >. + (#0.06333))`;; + + + +(* +Handwritten in as new inequality +*) +let J_349475742= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (quo_x x1 x2 x6) >=. (#0.0))`;; + + + + +(* + +LOC: 2002 III, page 19. +Appendix 1. (Some final cases) +Section A6 (Quasi-regular tetrahedra) +*) + + +let J_61701725= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( + ( (sol_x x1 x2 x3 x4 x5 x6) +. ( (#0.377076) *. (sqrt x1)) +. ( (#0.377076) *. (sqrt x2)) +. + ( (#0.377076) *. (sqrt x3)) +. ( (--. (#0.221)) *. (sqrt x4)) +. ( (--. (#0.221)) *. (sqrt x5)) +. ( (--. (#0.221)) *. (sqrt x6))) >. + (#1.487741)) \/ + ( ( (sqrt x4) +. (sqrt x5) +. (sqrt x6)) >. (#6.25)))`;; + + + +let J_679487679= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( + ( ( (#0.221) *. (sqrt x4)) +. ( (#0.221) *. (sqrt x5)) +. ( (#0.221) *. (sqrt x6)) +. (( --. ) (sol_x x1 x2 x3 x4 x5 x6))) >. + (#0.76822)) \/ + ( ( (sqrt x4) +. (sqrt x5) +. (sqrt x6)) >. (#6.25)))`;; + + + +let J_178057365= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( + ( (dih_x x1 x2 x3 x4 x5 x6) +. ( (#0.34) *. (sqrt x2)) +. ( (#0.34) *. (sqrt x3)) +. + ( (--. (#0.689)) *. (sqrt x4)) +. ( (#0.27) *. (sqrt x5)) +. ( (#0.27) *. (sqrt x6))) >. + (#2.29295)) \/ + ( ( (sqrt x4) +. (sqrt x5) +. (sqrt x6)) >. (#6.25)))`;; + + + +let J_285829736= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( + ( (( --. ) (dih_x x1 x2 x3 x4 x5 x6)) +. ( (#0.498) *. (sqrt x1)) +. ( (#0.731) *. (sqrt x4)) +. + ( (--. (#0.212)) *. (sqrt x5)) +. ( (--. (#0.212)) *. (sqrt x6))) >. + (#0.37884)) \/ + ( ( (sqrt x4) +. (sqrt x5) +. (sqrt x6)) >. (#6.25)))`;; + + + + +let J_364138508= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( + ( (( --. ) (sigma_qrtet_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.109)) *. (sqrt x1)) +. ( (--. (#0.109)) *. (sqrt x2)) +. + ( (--. (#0.109)) *. (sqrt x3)) +. ( (--. (#0.14135)) *. (sqrt x4)) +. ( (--. (#0.14135)) *. (sqrt x5)) +. ( (--. (#0.14135)) *. (sqrt x6))) >. + (--. (#1.5574737))) \/ + ( ( (sqrt x4) +. (sqrt x5) +. (sqrt x6)) >. (#6.25)))`;; + + + + +let J_217981292= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( + ( (( --. ) (sigma_qrtet_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.419351)) *. (sol_x x1 x2 x3 x4 x5 x6)) +. + ( (--. (#0.2)) *. (sqrt x1)) +. ( (--. (#0.2)) *. (sqrt x2)) +. ( (--. (#0.2)) *. (sqrt x3)) +. + ( (--. (#0.048)) *. (sqrt x4)) +. ( (--. (#0.048)) *. (sqrt x5)) +. ( (--. (#0.048)) *. (sqrt x6))) >. + (--. (#1.77465))) \/ + ( ( (sqrt x4) +. (sqrt x5) +. (sqrt x6)) >. (#6.25)))`;; + + + +let J_599117591= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( + ( (tau_sigma_x x1 x2 x3 x4 x5 x6) +. ( (--. (#0.0845696)) *. (sqrt x1)) +. ( (--. (#0.0845696)) *. (sqrt x2)) +. + ( (--. (#0.0845696)) *. (sqrt x3)) +. ( (--. (#0.163)) *. (sqrt x4)) +. ( (--. (#0.163)) *. (sqrt x5)) +. ( (--. (#0.163)) *. (sqrt x6))) >. + (--. (#1.48542))) \/ + ( ( (sqrt x4) +. (sqrt x5) +. (sqrt x6)) >. (#6.25)))`;; + + + +let J_163177561= + all_forall `ineq + [((#4.0), x1, (square (#2.13))); + ((#4.0), x2, (square (#2.13))); + ((#4.0), x3, (square (#2.13))); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( + ( (dih_x x1 x2 x3 x4 x5 x6) +. ( (#0.27) *. (sqrt x2)) +. ( (#0.27) *. (sqrt x3)) +. + ( (--. (#0.689)) *. (sqrt x4)) +. ( (#0.27) *. (sqrt x5)) +. ( (#0.27) *. (sqrt x6))) >. + (#2.01295)) \/ + ( ( (sqrt x4) +. (sqrt x5) +. (sqrt x6)) >. (#6.25)))`;; + + + +(* CCC +Bound: 0.0207472140662 + +Point: [4.3332764986, 4.0214270778, 4.12912710387, 5.03818306425, 5.36790850639, 4.93072243755] + +yy = {4.3332764986, 4.0214270778, 4.12912710387, 5.03818306425, 5.36790850639, 4.93072243755}//Sqrt + +cstr1 = ( yy[[4]]+yy[[5]]+yy[[6]] > 6.25 ) + +cstr2 = ( -(Gamma @@ yy) - 0.14135 (Plus @@ yy) > -1.7515737 ) + +(* both constraints are satisfied. This is not a counterexample. It is not + even close to being a counterexample. Why does a question even come up? *) +*) +let J_225583331= + all_forall `ineq + [((#4.0), x1, (square (#2.13))); + ((#4.0), x2, (square (#2.13))); + ((#4.0), x3, (square (#2.13))); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( + ( (( --. ) (sigma_qrtet_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.14135)) *. (sqrt x1)) +. ( (--. (#0.14135)) *. (sqrt x2)) +. + ( (--. (#0.14135)) *. (sqrt x3)) +. ( (--. (#0.14135)) *. (sqrt x4)) +. ( (--. (#0.14135)) *. (sqrt x5)) +. ( (--. (#0.14135)) *. (sqrt x6))) >. + (--. (#1.7515737))) \/ + ( ( (sqrt x4) +. (sqrt x5) +. (sqrt x6)) >. (#6.25)))`;; + + + + +let J_891900056= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( + ( (sol_x x1 x2 x3 x4 x5 x6) +. ( (#0.378) *. (sqrt x1)) +. ( (#0.378) *. (sqrt x2)) +. + ( (#0.378) *. (sqrt x3)) +. ( (--. (#0.1781)) *. (sqrt x4)) +. ( (--. (#0.1781)) *. (sqrt x5)) +. ( (--. (#0.1781)) *. (sqrt x6))) >. + (#1.761445)) \/ + ( ( (sqrt x4) +. (sqrt x5) +. (sqrt x6)) <. (#6.25)))`;; + + + + +let J_874759621= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( + ( (( --. ) (sol_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.171)) *. (sqrt x1)) +. ( (--. (#0.171)) *. (sqrt x2)) +. + ( (--. (#0.171)) *. (sqrt x3)) +. ( (#0.3405) *. (sqrt x4)) +. ( (#0.3405) *. (sqrt x5)) +. ( (#0.3405) *. (sqrt x6))) >. + (#0.489145)) \/ + ( ( (sqrt x4) +. (sqrt x5) +. (sqrt x6)) <. (#6.25)))`;; + + + +let J_756881665= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( + ( (( --. ) (sigma_qrtet_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.1208)) *. (sqrt x1)) +. ( (--. (#0.1208)) *. (sqrt x2)) +. + ( (--. (#0.1208)) *. (sqrt x3)) +. ( (--. (#0.0781)) *. (sqrt x4)) +. ( (--. (#0.0781)) *. (sqrt x5)) +. ( (--. (#0.0781)) *. (sqrt x6))) >. + (--. (#1.2436))) \/ + ( ( (sqrt x4) +. (sqrt x5) +. (sqrt x6)) <. (#6.25)))`;; + + + +let J_619846561= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( + ( (( --. ) (sigma_qrtet_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.419351)) *. (sol_x x1 x2 x3 x4 x5 x6)) +. + ( (--. (#0.2)) *. (sqrt x1)) +. ( (--. (#0.2)) *. (sqrt x2)) +. ( (--. (#0.2)) *. (sqrt x3)) +. + ( (#0.0106) *. (sqrt x4)) +. ( (#0.0106) *. (sqrt x5)) +. ( (#0.0106) *. (sqrt x6))) >. + (--. (#1.40816))) \/ + ( ( (sqrt x4) +. (sqrt x5) +. (sqrt x6)) <. (#6.25)))`;; + + + + +let J_675872124= + all_forall `ineq + [((#4.0), x1, (square (#2.13))); + ((#4.0), x2, (square (#2.13))); + ((#4.0), x3, (square (#2.13))); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( + ( (sol_x x1 x2 x3 x4 x5 x6) +. ( (#0.356) *. (sqrt x1)) +. ( (#0.356) *. (sqrt x2)) +. ( (#0.356) *. (sqrt x3)) +. + ( (--. (#0.1781)) *. (sqrt x4)) +. ( (--. (#0.1781)) *. (sqrt x5)) +. ( (--. (#0.1781)) *. (sqrt x6))) >. + (#1.629445)) \/ + ( ( (sqrt x4) +. (sqrt x5) +. (sqrt x6)) <. (#6.25)))`;; + + + +(* CCC Added 6.13 constraint on 2/1/2008. +Bound: 0.0071026022964 + +Point: [4.53689999999, 4.53689999999, 4.53689999999, 4.34027778215, 4.34027782266, 4.34027772851] + +yy = {y1,y2,y3,y4,y5,y6}={4.53689999999, 4.53689999999, 4.53689999999, 4.34027778215, 4.34027782266, 4.34027772851}//Sqrt; + +cnstr1 = (y4 + y5+y6 < 6.25) (* lands right at 6.25 *) + +constr2 = ( -(Solid @@ yy) - 0.254 (y1+y2+y3) + 0.3405 (y4+y5+y6) > -0.008855) +*) + +(* interval verification in part3.cc (numbered as 465988688) + Notes on interval verification. + It uses constant -0.61298 + 0.3405 6.25 -0.254 6 = -0.008855. + F is the main inequality. + G is the y4+y5+y6 < 6.25 constraint. + H is the inequality 6.13 < y1 + y2 +y3. H is not stated in SPVI2002. + It seems to have been a constraint of the original inequality and then left + out of the writeup. This explains the difference. + There is one more inequality J that is a consequence of F, hence redundant. + Note added to dcg_errata, adding the precondition. + *) + +let J_498007387= + all_forall `ineq + [((#4.0), x1, (square (#2.13))); + ((#4.0), x2, (square (#2.13))); + ((#4.0), x3, (square (#2.13))); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( + ( (( --. ) (sol_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.254)) *. (sqrt x1)) +. ( (--. (#0.254)) *. (sqrt x2)) +. ( (--. (#0.254)) *. (sqrt x3)) +. + ( (#0.3405) *. (sqrt x4)) +. ( (#0.3405) *. (sqrt x5)) +. ( (#0.3405) *. (sqrt x6))) >. + (--. (#0.008855))) \/ + ( ( (sqrt x4) +. (sqrt x5) +. (sqrt x6)) <. (#6.25)) \/ + ( ( (sqrt x1) +. (sqrt x2) +. (sqrt x3)) >. (#6.13)))`;; + + + + +let J_413387792= + all_forall `ineq + [((#4.0), x1, (square (#2.13))); + ((#4.0), x2, (square (#2.13))); + ((#4.0), x3, (square (#2.13))); + + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( + ( (( --. ) (sigma_qrtet_x x1 x2 x3 x4 x5 x6)) +. ( (--. (#0.167)) *. (sqrt x1)) +. ( (--. (#0.167)) *. (sqrt x2)) +. ( (--. (#0.167)) *. (sqrt x3)) +. + ( (--. (#0.0781)) *. (sqrt x4)) +. ( (--. (#0.0781)) *. (sqrt x5)) +. ( (--. (#0.0781)) *. (sqrt x6))) >. + (--. (#1.51017))) \/ + ( ( (sqrt x4) +. (sqrt x5) +. (sqrt x6)) <. (#6.25)))`;; + + +(* + +LOC: 2002 III, page 20. +Appendix 1. (Some final Cases) +Section A8 (Final cases) +*) + + +let J_135953363= + all_forall `ineq + [((#4.0), x1, (square (#2.13))); + ((#4.0), x2, (square (#2.13))); + ((#4.0), x3, (square (#2.13))); + + ((square (#2.93)), x4, square_4t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (dih_x x1 x2 x3 x4 x5 x6) >. (#1.694)) \/ + ( ( (sqrt x2) +. (sqrt x3) +. (sqrt x5) +. (sqrt x6)) >. (#8.709)))`;; + + + + +let J_324141781= + all_forall `ineq + [((#4.0), x1, (square (#2.13))); + ((#4.0), x2, (square (#2.13))); + ((#4.0), x3, (square (#2.13))); + + ((#8.0), x4, (square (#2.93))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( ( (dih2_x x1 x2 x3 x4 x5 x6) +. ( (#0.59) *. (sqrt x1)) +. ( (#0.1) *. (sqrt x2)) +. ( (#0.1) *. (sqrt x3)) +. + ( (#0.55) *. (sqrt x4)) +. ( (--. (#0.6)) *. (sqrt x5)) +. ( (--. (#0.12)) *. (sqrt x6))) >. (#2.6506))`;; + + + +let J_778150947= + all_forall `ineq + [((#4.0), x1, (square (#2.13))); + ((#4.0), x2, (square (#2.13))); + ((#4.0), x3, (square (#2.13))); + + ((#8.0), x4, (square (#2.93))); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( ( (dih2_x x1 x2 x3 x4 x5 x6) +. ( (#0.35) *. (sqrt x1)) +. ( (--. (#0.24)) *. (sqrt x2)) +. ( (#0.05) *. (sqrt x3)) +. + ( (#0.35) *. (sqrt x4)) +. ( (--. (#0.72)) *. (sqrt x5)) +. ( (--. (#0.18)) *. (sqrt x6))) <. (#0.47))`;; + + + +(* +LOC: DCG II, page 147 (published DCG pages). +Cases (8) (9) (10) (11) +Used in Formulation + +CCC Fixed circumradius constraints 2/1/2008 + +Bound: 0.00257586721418 + +Point: [8, 3.99999999999, 6.30009999999, 3.99999999999, 8, 4] + +yy = {8, 3.99999999999, 6.30009999999, 3.99999999999, 8, 4}//Sqrt + +vorAnalytic @@ yy + +*) + +(* moved 629256313 to inequality_spec.ml *) + + +(* eta_x constraint fixed 2/1/2008 *) + +(* moved 917032944 to inequality_spec.ml *) + + +(* eta_x constraint fixed 2/1/2008 *) + +(* moved 738318844 to inequality_spec.ml *) + + +(* eta_x constraint fixed 2/1/2008 *) + +(* moved 587618947 to inequality_spec.ml *) + + + +(* + + LOC: DCG Sphere Packing II, page 147, Calc 4.5.1. + + Note case of equality is equality five (#4.0) and x4=(#8.0). + In the following inequality, we need that this is the unique case + of equality. +*) + +(* moved 346093004 to inequality_spec.ml *) + + + + +(* I, SPI-1997 Lemma 9.17 *) + +let J_534566617 = + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + (((vor_analytic_x x1 x2 x3 x4 x5 x6) < --((#1.8))*pt) \/ + (rad2_x x1 x2 x3 x4 x5 x6 <. (#1.9881)))`;; + + + +(* + +LOC: 2002 Form, Appendix 1, page 19 +Formulation +*) + +(* +LOC: 2002 Form, Appendix 1, page 19 + 2002_Calc_3.13.1 + +*) + +(* moved 5901405 to inequality_spec.ml *) + + + +(* +LOC: 2002 Form, Appendix 1, page 19 + 2002_Calc_3.13.2: + We need that equality implies that x1=8 and the other edges are 4.0. +*) +(* moved 40003553 to inequality_spec.ml *) + + + +(* +LOC: 2002 Form, Appendix 1, page 19 + 2002_Calc_3.13.3 +*) +(* moved 522528841 to inequality_spec.ml *) + + + +(* +LOC: 2002 Form, Appendix 1, page 19 + 2002_Calc_3.13.4 +*) +(* moved 892806084 to inequality_spec.ml *) + + + +(* +LOC: 2002 Form, Appendix 1, page 20 + 2002_Formulation_4.7.1: + +Corrected 2/1/2008, mu_flat_x -> mu_upright_x + +CCC many cases +Bound: 0.394287252586 + +Point: [7.99999999999, 3.99999999999, 6.30009999999, 6.30009999999, 3.99999999999, 4.00000002705] + +yy = {y1,y2,y3,y4,y5,y6}={7.99999999999, 3.99999999999, 6.30009999999, 6.30009999999, 3.99999999999, 4.00000002705}//Sqrt; + +CCC 3/10/2008. I had the domain swapped on x1 x4. I think it is OK now. + this still fails in almost every case + +for example: + + +Functions : vor_analytic_x[x1, x2, x3, x4, x5, x6] + vor_analytic_x_flipped[x1, x2, x3, x4, x5, x6] + (crown[(sqrt x1 / 2.0)] * 1.0) + (crown[(sqrt x1 / 2.0)] * ((~ * dih_x[x1, x2, x3, x4, x5, x6]) / pi)) + 2.0 anc[sqrt x1, sqrt x2, sqrt x6] + ~ vor_0_x[x1, x2, x3, x4, x5, x6] + ~ vor_0_x_flipped[x1, x2, x3, x4, x5, x6] + ~sqrt2 + eta_x[x2, x3, x4] + ~sqrt2 + eta_x[x1, x5, x4] + +Ready : false + +Finished : false + +Notes : + +Bound: 0.278416202455 + +Point: [7.50977085644, 4.00000080978, 5.91871675372, 4.00003052831, 5.91874664244, 4.00001152248] + +eta_x are near sqrt 2 + +*) +(* moved 554253147 to inequality_spec.ml *) + + + +(* +LOC: 2002 Form, Appendix 1, page 20 + 2002_Formulation_4.7.2: + +CCC Fixed bounds. +crown[Sqrt[2.575]] --> 0 +*) + +(* moved 906566422 to inequality_spec.ml *) + + + +(* +LOC: 2002 Form, Appendix 1, page 20 + 2002_Formulation_4.7.3: +*) +(* moved 703457064 to inequality_spec.ml *) + + + + +(* +LOC: 2002 Form, Appendix 1, page 20 + 2002_Formulation_4.7.4 +*) +(* moved 175514843 to inequality_spec.ml *) + + + +(* +LOC: 2002 Form, Appendix 1, page 20 + 2002_Formulation_4.7.5 +*) +(* moved 855677395 to inequality_spec.ml *) + + + + +(* ****************************************************** *) +(* FERGUSON'S THESIS INEQUALITIES *) + + +(* LOC: DCG 2006, V, page 197. Calc 17.4.1.1. *) + +(* verification uses dimension reduction *) +let I_7728905995= + all_forall `ineq + [((#4.0),x1,square_2t0); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#4.0),x4,square_2t0); + ((#4.0),x5,square_2t0); + ((#4.0),x6,square_2t0) + ] + ( (gamma_x x1 x2 x3 x4 x5 x6 < pp_a1 * dih_x x1 x2 x3 x4 x5 x6 - pp_a2) \/ + (gamma_x x1 x2 x3 x4 x5 x6 < -- (#0.52) * pt))`;; + + +(* LOC: DCG 2006, V, page 197. Calc 17.4.1.2. *) + +(* verification uses dimension reduction *) +let I_8421744162= + all_forall `ineq + [((#4.0),x1,square_2t0); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#4.0),x4,square_2t0); + ((#4.0),x5,square_2t0); + ((#4.0),x6,square_2t0) + ] + ( (gamma_x x1 x2 x3 x4 x5 x6 < pp_a1 * dih_x x1 x2 x3 x4 x5 x6 + (#3.48 * pt) - (#2.0 * pi * pp_a1) + (#4.0 * pp_a2)) \/ + (gamma_x x1 x2 x3 x4 x5 x6 < -- (#0.52) * pt) \/ + (dih_x x1 x2 x3 x4 x5 x6 < pp_d0))`;; + +(* LOC: DCG 2006, V, page 197. Calc 17.4.1.3. *) + +(* verification uses dimension reduction *) +let I_2045090718= + all_forall `ineq + [((#4.0),x1,square_2t0); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#4.0),x4,square_2t0); + ((#4.0),x5,square_2t0); + ((#4.0),x6,square_2t0) + ] + ( (gamma_x x1 x2 x3 x4 x5 x6 + pp_m * sol_x x1 x2 x3 x4 x5 x6 + + pp_a * (dih_x x1 x2 x3 x4 x5 x6 - #2.0 * pi / #5.0) < pp_bc) \/ + (gamma_x x1 x2 x3 x4 x5 x6 < -- (#0.52) * pt) \/ + (dih_x x1 x2 x3 x4 x5 x6 > pp_d0))`;; + + +(* LOC: DCG 2006, V, page 198. Calc 17.4.2.1. *) + +(* verification uses dimension reduction. See note on Calc 17.4.2.2 + +CCC typo fixed pp_bc -> pp_b +Bound: 0.119559830004 + +Point: [4.00000445799, 4.00000445799, 4.00000286459, 4.00004119188, 4.00004119188, 7.99987944373] + + + *) + +let I_9046001781= +all_forall `ineq + [((#4.0),x1,square_2t0); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#4.0),x4,square_2t0); + ((#4.0),x5,square_2t0); + (square_2t0,x6,(#8.0)) + ] + ( (gamma_x x1 x2 x3 x4 x5 x6 + pp_m * sol_x x1 x2 x3 x4 x5 x6 < pp_b / (#2.0)) \/ + (eta_x x1 x2 x6 > sqrt2) \/ + (eta_x x4 x5 x6 > sqrt2) \/ + (gamma_x x1 x2 x3 x4 x5 x6 < -- (#1.04)* pt))`;; + +(* LOC: DCG 2006, V, page 198. Calc 17.4.2.2. *) +(* I am not including this inequality because I don't see that it is needed. + Ferguson gives a special boundary case of the inequality 9046001781 here, because + he sees the dimension reduction as not applying in a boundary case. It seems + to me that dimension reduction in the previous ineq is entirely justified. *) + + + + +(* LOC: DCG 2006, V, page 198. Calc 17.4.2.3. *) +(* LOC: DCG 2006, V, page 199. Calc 17.4.2.4. *) +(* LOC: DCG 2006, V, page 199. Calc 17.4.2.5. *) +(* LOC: DCG 2006, V, page 199. Calc 17.4.2.6. *) + +(* Ferguson separates the following two interval calculations into four cases, +depending on things like derivative information, +dimension reduction, a separate calculation in a small +neighborhood of the tight corner at (2,2,2,2,2,Sqrt[8]), etc. +I am combining them here. Ferguson's discussion may be needed in their formal +verification. + +CCC pp_b typo fixed. + +Bound: 0.118099592077 + +Point: [4.00593290879, 4.00593290879, 4.000991016, 4.02090803522, 4.02090803742, 7.99999120025] + + +*) + +let I_4075001492= +all_forall `ineq + [((#4.0),x1,square_2t0); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#4.0),x4,square_2t0); + ((#4.0),x5,square_2t0); + (square_2t0,x6,(#8.0)) + ] + ( (vor_analytic_x x1 x2 x3 x4 x5 x6 + pp_m * sol_x x1 x2 x3 x4 x5 x6 < pp_b / (#2.0)) \/ + (eta_x x1 x2 x6 < sqrt2) \/ + (vor_analytic_x x1 x2 x3 x4 x5 x6 < -- (#1.04)* pt))`;; + + +(* + +CCC pp_b typo fixed. + +Bound: 0.119559508184 + +Point: [4.00000394962, 4.00000394962, 4.00000197481, 4.0001220805, 4.0001220805, 7.99999999627] + +*) +let I_8777240900= +all_forall `ineq + [((#4.0),x1,square_2t0); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#4.0),x4,square_2t0); + ((#4.0),x5,square_2t0); + (square_2t0,x6,(#8.0)) + ] + ( (vor_analytic_x x1 x2 x3 x4 x5 x6 + pp_m * sol_x x1 x2 x3 x4 x5 x6 < pp_b / (#2.0)) \/ + (eta_x x4 x5 x6 < sqrt2) \/ + (vor_analytic_x x1 x2 x3 x4 x5 x6 < -- (#1.04)* pt))`;; + + + + + +(* LOC: DCG 2006, V, page 199. Calc 17.4.3.1. *) +(* upright quarters in an octahedron *) + +let I_4780480978= +all_forall `ineq + [(square_2t0,x1,(#8.0)); + (square (#2.2),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#4.0),x4,square_2t0); + ((#4.0),x5,square_2t0); + ((#4.0),x6,square_2t0) + ] + ( (octavor_analytic_x x1 x2 x3 x4 x5 x6 < -- (#0.52) * pt) \/ + (eta_x x1 x2 x6 < sqrt2))`;; + + +let I_1520829511= +all_forall `ineq + [(square_2t0,x1,(#8.0)); + (square (#2.2),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#4.0),x4,square_2t0); + ((#4.0),x5,square_2t0); + ((#4.0),x6,square_2t0) + ] + ( (octavor_analytic_x x1 x2 x3 x4 x5 x6 < -- (#0.52) * pt) \/ + (eta_x x1 x3 x5 < sqrt2))`;; + +let I_6529801070= +all_forall `ineq + [(square_2t0,x1,(#8.0)); + (square (#2.2),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#4.0),x4,square_2t0); + ((#4.0),x5,square_2t0); + ((#4.0),x6,square_2t0) + ] + (gamma_x x1 x2 x3 x4 x5 x6 < -- (#0.52) * pt)`;; + + +(* LOC: DCG 2006, V, page 199. Calc 17.4.3.2. *) + +let I_2301260168= +all_forall `ineq + [(square_2t0,x1,square (#2.716)); + ((#4.0),x2,square (#2.2)); + ((#4.0),x3,square (#2.2)); + ((#4.0),x4,square (#2.2)); + ((#4.0),x5,square (#2.2)); + ((#4.0),x6,square (#2.2)) + ] + ((gamma_x x1 x2 x3 x4 x5 x6 + pp_c * dih_x x1 x2 x3 x4 x5 x6 < pp_d) \/ + (gamma_x x1 x2 x3 x4 x5 x6 < -- (#1.04) * pt))`;; + +(* LOC: DCG 2006, V, page 200. Calc 17.4.3.3. *) + +let I_9580162379= +all_forall `ineq + [(square (#2.716),x1,(#8.0)); + ((#4.0),x2,square (#2.2)); + ((#4.0),x3,square (#2.2)); + ((#4.0),x4,square_2t0); + ((#4.0),x5,square (#2.2)); + ((#4.0),x6,square (#2.2)) + ] + ((gamma_x x1 x2 x3 x4 x5 x6 + pp_m * sol_x x1 x2 x3 x4 x5 x6 + + (#0.14) * dih_x x1 x2 x3 x4 x5 x6 < pp_b / (#4.0) + (#0.14)* pi/ (#2.0)) \/ + (gamma_x x1 x2 x3 x4 x5 x6 < -- (#1.04) * pt) \/ + (eta_x x1 x2 x6 > sqrt2) \/ + (eta_x x1 x3 x5 > sqrt2))`;; + + +(* LOC: DCG 2006, V, page 200. Calc 17.4.3.4. *) +(* +CCC Fixed typo. Sign on eta_x was reversed. + + +Bound: 0.0249615271277 + +Point: [7.89609717439, 4.000001105, 4.000001105, 6.30008811007, 4.00000159981, 4.00000159981] + +*) +let I_2785497175= +all_forall `ineq + [(square (#2.716),x1,square (#2.81)); + ((#4.0),x2,square (#2.2)); + ((#4.0),x3,square (#2.2)); + ((#4.0),x4,square_2t0); + ((#4.0),x5,square (#2.2)); + ((#4.0),x6,square (#2.2)) + ] + ((octavor_analytic_x x1 x2 x3 x4 x5 x6 + pp_m * sol_x x1 x2 x3 x4 x5 x6 + + (#0.14) * dih_x x1 x2 x3 x4 x5 x6 < pp_b / (#4.0) + (#0.14)* pi/ (#2.0)) \/ + (octavor_analytic_x x1 x2 x3 x4 x5 x6 < -- (#1.04) * pt) \/ + (eta_x x1 x2 x6 < sqrt2))`;; + +(* LOC: DCG 2006, V, page 200. Calc 17.4.3.5. *) + +let I_5112922270= +all_forall `ineq + [(square (#2.81),x1,(#8.0)); + ((#4.0),x2,square (#2.2)); + ((#4.0),x3,square (#2.2)); + ((#4.0),x4,square_2t0); + ((#4.0),x5,square (#2.2)); + ((#4.0),x6,square (#2.2)) + ] + ((gamma_x x1 x2 x3 x4 x5 x6 + pp_m * sol_x x1 x2 x3 x4 x5 x6 + + (#0.054) * dih_x x1 x2 x3 x4 x5 x6 + (#0.00455) * (x1- (#8.0)) < + pp_b / (#4.0) + (#0.054)* pi/ (#2.0)) \/ + (gamma_x x1 x2 x3 x4 x5 x6 < -- (#1.04) * pt) \/ + (eta_x x1 x2 x6 > sqrt2) \/ + (eta_x x1 x3 x5 > sqrt2))`;; + + +(* LOC: DCG 2006, V, page 200. Calc 17.4.3.6. *) + +let I_8586415208= +all_forall `ineq + [(square (#2.81),x1,(#8.0)); + ((#4.0),x2,square (#2.2)); + ((#4.0),x3,square (#2.2)); + ((#4.0),x4,square_2t0); + ((#4.0),x5,square (#2.2)); + ((#4.0),x6,square (#2.2)) + ] + ((octavor_analytic_x x1 x2 x3 x4 x5 x6 + pp_m * sol_x x1 x2 x3 x4 x5 x6 + + (#0.054) * dih_x x1 x2 x3 x4 x5 x6 - (#0.00455) * (x1- (#8.0)) < + pp_b / (#4.0) + (#0.054)* pi/ (#2.0)) \/ + (octavor_analytic_x x1 x2 x3 x4 x5 x6 < -- (#1.04) * pt) \/ + (eta_x x1 x2 x6 > sqrt2))`;; + + +(* LOC: DCG 2006, V, page 201. Calc 17.4.4.1. *) +(* pure Voronoi quad clusters, sigma is sqrt-2 truncated Voronoi *) +(* acute case *) + +let I_1017762470= +all_forall `ineq + [((#4.0),x1,square_2t0); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#4.0),x4,square_2t0); + ((#4.0),x5,square_2t0); + (square (#2.84),x6,(#16.0)) + ] + ((vort_x x1 x2 x3 x4 x5 x6 sqrt2 + pp_m * sol_x x1 x2 x3 x4 x5 x6 + < pp_b / (#2.0)) \/ + (sol_x x1 x2 x3 x4 x5 x6 < pp_solt0) \/ + (x1 + x2 < x6) \/ + (vort_x x1 x2 x3 x4 x5 x6 sqrt2 < -- (#1.04) * pt))`;; + + +(* LOC: DCG 2006, V, page 201. Calc 17.4.4.... *) +(* See note in DCG errata. We need to check that each half is nonpositive for the proof + of Lemma DCG 16.7, page 182. +*) + + + + + + +(* LOC: DCG 2006, V, page 201. Calc 17.4.4.2. *) +(* LOC: DCG 2006, V, page 201. Calc 17.4.4.3. *) +(* pure Voronoi quad clusters, sigma is sqrt-2 truncated Voronoi *) +(* acute case *) +(* This is separated into 2 cases in Ferguson. *) + +let I_2314721799= +all_forall `ineq + [((#4.0),x1,square_2t0); + ((#4.0),x2,square_2t0); + ((#4.0),x3,square_2t0); + ((#4.0),x4,square_2t0); + ((#4.0),x5,square_2t0); + ((#8.0),x6,square (#2.84)) + ] + ((vort_x x1 x2 x3 x4 x5 x6 sqrt2 + pp_m * sol_x x1 x2 x3 x4 x5 x6 + < pp_b / (#2.0)) \/ + (sol_x x1 x2 x3 x4 x5 x6 < pp_solt0) \/ + (x1 + x2 < x6) \/ + (vort_x x1 x2 x3 x4 x5 x6 sqrt2 < -- (#1.04) * pt))`;; + + +(* LOC: DCG 2006, V, page 201. Calc 17.4.4.4. *) +(* pure Voronoi quad clusters, sigma is sqrt-2 truncated Voronoi *) +(* obtuse case *) + + +let I_6318537815= +all_forall `ineq + [((square ((#4.0)/(#2.51))),x,square_2t0); + ((#8.0),ds,((#2.0)* square_2t0)) + ] + ((vort_x (#4.0) (#4.0) (#4.0) x x ds sqrt2 + pp_m * sol_x (#4.0) (#4.0) (#4.0) x x ds + < pp_b / (#2.0)) \/ + (vort_x (#4.0) (#4.0) (#4.0) x x ds sqrt2 < -- (#0.52) * pt) \/ + (sol_x (#4.0) (#4.0) (#4.0) x x ds < pp_solt0) \/ + ((#2.0) * x < ds))`;; + +(* LOC: DCG 2006, V, page 201. Calc 17.4.4.5. *) +(* pure Voronoi quad clusters, sigma is sqrt-2 truncated Voronoi *) +(* obtuse case *) + + +let I_6737436637= +all_forall `ineq + [((square ((#4.0)/(#2.51))),x1,square_2t0); + ((square ((#4.0)/(#2.51))),x2,square_2t0) + ] + ((vort_x (#4.0) (#4.0) (#4.0) x1 x1 (#8.0) sqrt2 + vort_x (#4.0) (#4.0) (#4.0) x2 x2 (#8.0) sqrt2 + + pp_m * (sol_x (#4.0) (#4.0) (#4.0) x1 x1 (#8.0) + sol_x (#4.0) (#4.0) (#4.0) x2 x2 (#8.0)) + < pp_b) \/ + (vort_x (#4.0) (#4.0) (#4.0) x1 x1 (#8.0) sqrt2 + vort_x (#4.0) (#4.0) (#4.0) x2 x2 (#8.0) sqrt2 < -- (#1.04) * pt) \/ + (sol_x (#4.0) (#4.0) (#4.0) x1 x1 (#8.0) + sol_x (#4.0) (#4.0) (#4.0) x2 x2 (#8.0) < (#2.0) * pp_solt0))`;; + + +(* LOC: DCG 2006, V, page 201. Calc 17.4.5.1. DCG, V, page 174, Theorem 16.1. *) +(* This 91-term polynomial is used to justify dimension reduction for vol_analytic_x. *) +(* Ferguson states two cases, but the second case covers the first as well. *) + +(* This has been formally verified by R. Zumkeller in COQ on March 6 2008. +He writes: + +My tactic reports -451149333733932001/156250000000000 (approximately +-2887.36) as the sharp maximum of the left-hand side. Mathematica +seems to agree. As you can see below conversion to the Bernstein basis +was sufficient, no subdivisions are needed. + +Time Eval vm_compute in min_bb_Q_Ff steps (prec (-10)) +(ply_mgm.mdlN_of_rngN (-ferguson)). + = (451149333733932001 # 156250000000000, + 451149333733932001 # 156250000000000, true, + (0%nat, 0%nat, 0%nat)) + : Q * Q * bool * (nat * nat * nat) +Finished transaction in 2. secs (1.963554u,0.021168s) + + (* upper bound on x4 changed 3/7/08, new domain *) +*) + +(* moved 2298281931 to inequality_spec.ml *) + + + +(* End of Sphere Packings V, DCG, Ferguson's thesis *) + + + + + + + + + + +(* +end of document +*) + diff --git a/legacy/inequalities/kep_inequalities2.ml b/legacy/inequalities/kep_inequalities2.ml new file mode 100644 index 0000000..a62d77a --- /dev/null +++ b/legacy/inequalities/kep_inequalities2.ml @@ -0,0 +1,1152 @@ +(* This file is a continuation of kep_inequalities.ml. + It contains the inequalities related to quad clusters. + It also contains some particularly long, tricky, or high-dimensional verifications *) + + + +(* ----------------------------------------------------------------------- *) +(* +latex-format comment + +\section{Notes on Interval Verifications} + %{Appendix 2. Interval Verifications} + \label{sec:verification-notes} + +We make a few remarks in this appendix on the verification of the +inequalities of Proposition~\ref{calc:quad-bounds} and \ref{calc:d(R)}. +The basic method in proving an inequality $f(x)<0$ for $x\in C$, is to +use computer-based interval arithmetic to obtain rigorous upper bounds +on the second derivatives: $|f_{ij}(x)|\le a_{ij}$, for $x\in C$. These +bounds lead immediately to upper bounds on $f(x)$ through a Taylor +approximation with explicit bounds on the error. We divide the domain +$C$ as necessary until the Taylor approximation on each piece is less +that the desired bound. + +Some of the inequalities involve as many as $12$ variables, such as the +octahedral cases of Lemma~\ref{calc:d(R)}. These are not directly +accessible by computer. We describe some reductions we have used, based +on linear programming. We start by applying the dimension reduction +techniques described in~\cite[Sec.~8.7]{part1}. We have used these +whenever possible. + +We will describe Lemma~\ref{calc:d(R)} because in various respects these +inequalities have been the most difficult to prove, although the +verifications of Lemmas~\ref{calc:quad-bounds} and \ref{lemma:1.153} are +quite similar. If there is a diagonal of length $\le2\sqrt{2}$, we have +two flat quarters $S_1$ and $S_2$. The score breaks up into + $\sigma=\sigma(S_1)+\sigma(S_2)$. The simplices $S_1$ and +$S_2$ share a three-dimensional face. The inequality we wish to prove +has the form + $$\sigma \le a(\dih(S_1)+\dih_2(S_1)+\dih_2(S_2))+b.$$ +We break the shared face into smaller domains on which we have + $$ + \begin{array}{lll} + \sigma(S_1)&\le a (\dih(S_1)+\dih_2(S_1)) + b_1,\\ + \sigma(S_2)&\le a \dih_2(S_1) + b_2,\\ + \end{array} + $$ +for some $b_1,b_2$ satisfying $b_1+b_2\le b$. These inequalities are +six-dimensional verifications. + +If the quad cluster is an octahedron with upright diagonal, there are +four upright quarters $S_1,\ldots,S_4$. We consider inequalities of the +form + \begin{equation} + \sigma(S_i)\le \sum _{j\ne 4} a_j^i y_j(S_i) + + a_7 (\dih_1(S_i)-\pi/2) + \sum_{j=2}^3 a \epsilon^i_j \dih_j(S_i) + + b^i. + \label{eqn:Xi} + \end{equation} +If $\sum_{i=1}^4 a_j^i \le0$, $j\ne 4$, and $\sum_i b^i\le b$, then for +appropriate $\epsilon^i_j\in\{0,1\}$, these inequalities imply the full +inequality for octahedral quad clusters. + +By linear programming techniques, we were able to divide the domain of +all octahedra into about $1200$ pieces and find inequalities of this +form on each piece, giving an explicit list of inequalities that imply +Lemma~\ref{calc:d(R)}. The inequalities involve six variables and were +verified by interval arithmetic. + +To find the optimal coefficients $a_j^i$ by linear programming we pose +the linear problem + $$ + \begin{array}{lll} + &\max t \\ + &\hbox{such that}\\ + &\quad X_i,\quad i=1,2,3,4, \ \{S_1,S_2,S_3,S_4\}\in C\\ + &\quad\sum_i a_j^i \le 0,\\ + &\quad\sum_i b^i \le b, + \end{array} + $$ +where $\{S_1,S_2,S_3,S_4\}$ runs over all octahedra in a given domain +$C$. The nonlinear inequalities~\ref{eqn:Xi} are to be regarded as +linear conditions on the coefficients $a_j^i$, $b^i$, etc. The nonlinear +functions $\sigma(S_i),\dih(S_i)$, $y_j(S_i)$ are to be regarded as the +coefficients of the variables $a_j^i,\ldots$ in a system of linear +inequalities. There are infinitely many constraints, because the set +$C$ of octahedra is infinite. In practice we approximate $C$ by a large +finite set. If the maximum of $t$ is positive, then we have a +collection of inequalities in small dimensions that imply the inequality +for octahedral quad clusters. Otherwise, we subdivide $C$ into smaller +domains and try again. Eventually, we succeed in partitioning the +problem into six-dimensional pieces, which were verified by interval +methods. + +\smallskip +If the quad cluster is a mixed case, then Lemma~\ref{lemma:1.04} gives + $$\sigma\le \vor_0, -1.04\,\pt,$$ so also + $$\sigma \le \frac{3}{4}\vor_0 + \frac{1}{4} (-1.04\,\pt).$$ +In the pure Voronoi case with no quarters and no enclosed vertices, we +have the approximation + $$\sigma \le \vor(\cdot,\sqrt2) \le \vor_0.$$ +If we prove $\vor_0\le a (\dih_1+\dih_2) + b$, the mixed case is +established. This is how the first of the Inequalities~\ref{calc:d(R)} +was established. Dimension reduction reduces this to a seven-dimensional +verification. We draw the shorter of the two diagonals between corners +of the quad cluster. As we begin to subdivide this seven-dimensional +domain, we are able to separate the quad cluster into two simplices +along the diagonal, each scored by $\vor_0$. This reduces the dimension +further, to make it accessible. The two last two cases of +Inequality~\ref{calc:d(R)}, are similar, but we establish the +inequalities + $$ + \begin{array}{lll} + \frac{3}{4}\vor_0 + \frac{1}{4} (-1.04\,\pt) &\le a (\dih_1+\dih_2) + b,\\ + \vor(\cdot,\sqrt2)&\le a (\dih_1+\dih_2) + b. + \end{array} + $$ +This completes our sketch of how the verifications were made. + + +*) + + +(* now we can list inequalities *) + +(* SPIII-1998 Lemma 4.1 *) + + +let J_310151857 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1 v0 v1 v2 v3 v4) < --(&57906)/(&10000) + + ((&456766)/(&100000))*(dih_or_v v0 v1 v2 v4)))`);; +let J_655029773 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1 v0 v1 v2 v3 v4) < --(&20749)/(&10000) + + ((&15094)/(&10000))*(dih_or_v v0 v1 v2 v4)))`);; +let J_73283761 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1 v0 v1 v2 v3 v4) < --(&8341)/(&10000) + + ((&5301)/(&10000))*(dih_or_v v0 v1 v2 v4)))`);; +let J_15141595 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1 v0 v1 v2 v3 v4) < --(&6284)/(&10000) + + ((&3878)/(&10000))*(dih_or_v v0 v1 v2 v4)))`);; +let J_574391221 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1 v0 v1 v2 v3 v4) < (&4124)/(&10000) + - ((&1897)/(&10000))*(dih_or_v v0 v1 v2 v4)))`);; +let J_396281725 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1 v0 v1 v2 v3 v4) < (&15707)/(&10000) + - ((&5905)/(&10000))*(dih_or_v v0 v1 v2 v4)))`);; +let J_166451608 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1 v0 v1 v2 v3 v4) < (&41717)/(&100000) + - ((&3)/(&10))*(solid_area_quad_v v0 v1 v2 v3 v4)))`);; +let J_539320075 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1_lambda v0 v1 v2 v3 v4 (&1)) < --(&581446)/(&100000) + + ((&449461)/(&100000))*(dih_or_v v0 v1 v2 v4)))`);; +let J_122375455 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1_lambda v0 v1 v2 v3 v4 (&1)) < --(&2955)/(&1000) + + ((&21406)/(&10000))*(dih_or_v v0 v1 v2 v4)))`);; +let J_408478278 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1_lambda v0 v1 v2 v3 v4 (&1)) < --(&6438)/(&10000) + + ((&316)/(&1000))*(dih_or_v v0 v1 v2 v4)))`);; +let J_996268658 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1_lambda v0 v1 v2 v3 v4 (&1)) < --(&1317)/(&10000)))`);; +let J_393682353 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1_lambda v0 v1 v2 v3 v4 (&1)) < (&3825)/(&10000) + - ((&2365)/(&10000))*(dih_or_v v0 v1 v2 v4)))`);; +let J_775642319 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1_lambda v0 v1 v2 v3 v4 (&1)) < (&1071)/(&1000) + - ((&4747)/(&10000))*(dih_or_v v0 v1 v2 v4)))`);; +let J_616145964 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1_lambda v0 v1 v2 v3 v4 ((&32)/(&10))) < + --(&577942)/(&100000) + + ((&425863)/(&100000))*(dih_or_v v0 v1 v2 v4)))`);; +let J_153920401 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1_lambda v0 v1 v2 v3 v4 ((&32)/(&10)) < + --(&4893)/(&1000) + + ((&35294)/(&10000))*(dih_or_v v0 v1 v2 v4))))`);; +let J_337637212 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1_lambda v0 v1 v2 v3 v4 ((&32)/(&10)) < + --(&4126)/(&10000))))`);; +let J_768057794 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1_lambda v0 v1 v2 v3 v4 ((&32)/(&10)) < + (&33)/(&100) + - ((&316)/(&1000))*(dih_or_v v0 v1 v2 v4))))`);; +let J_465497818 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1 v0 v1 v2 v3 v4 < + -- ((&419351)/(&1000000))*(solid_area_quad_v v0 v1 v2 v3 v4) + - (&5350181)/(&1000000) + + ((&4611391)/(&1000000))*(dih_or_v v0 v1 v2 v4))))`);; +let J_18502666 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1 v0 v1 v2 v3 v4 < + -- ((&419351)/(&1000000))*(solid_area_quad_v v0 v1 v2 v3 v4) + - (&166174)/(&100000) + + ((&1582508)/(&1000000))*(dih_or_v v0 v1 v2 v4))))`);; +let J_676439533 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1 v0 v1 v2 v3 v4 < + -- ((&419351)/(&1000000))*(solid_area_quad_v v0 v1 v2 v3 v4) + + (&895)/(&10000) + + ((&342747)/(&1000000))*(dih_or_v v0 v1 v2 v4))))`);; +let J_974296985 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1 v0 v1 v2 v3 v4 < + -- ((&419351)/(&1000000))*(solid_area_quad_v v0 v1 v2 v3 v4) + + (&336909)/(&100000) + - ((&974137)/(&1000000))*(dih_or_v v0 v1 v2 v4))))`);; + +let C_940884472 = list_mk_conj[ + J_310151857; + J_655029773; + J_73283761; + J_15141595; + J_574391221; + J_396281725; + J_166451608; + J_539320075; + J_122375455; + J_408478278; + J_996268658; + J_393682353; + J_775642319; + J_616145964; + J_153920401; + J_337637212; + J_768057794; + J_465497818; + J_18502666 ; + J_676439533; + J_974296985;];; + + +(* SPIII-1998 Lemma 4.2 *) + +let J_322621318 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1 v0 v1 v2 v3 v4 < + -- (&9494)/(&1000) + + ((&30508)/(&100000))* + ((dih_or_v v0 v1 v2 v4)+ + (dih_or_v v0 v2 v3 v1)))))`);; +let J_444643063 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1 v0 v1 v2 v3 v4 < + -- (&10472)/(&100000) + + ((&27605)/(&100000))* + ((dih_or_v v0 v1 v2 v4)+ + (dih_or_v v0 v2 v3 v1)))))`);; +let J_552698390 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((sigma_quad_approx1 v0 v1 v2 v3 v4 < + (&35926)/(&10000) + - ((&844)/(&1000))* + ((dih_or_v v0 v1 v2 v4)+ + (dih_or_v v0 v2 v3 v1)))))`);; + +(* SPIII-1998 Lemma 4.3 *) + +let J_657406669 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((#1.153) < dih_or_v v0 v1 v2 v4))`);; +let J_277330628 = (`!v0 v1 v2 v3 v4. ((is_quad_cluster_v v0 v1 v2 v3 v4) ==> + ((dih_or_v v0 v1 v2 v4) < (#3.247)))`);; + + + + +(* + +LOC: 2002 k.c page 49 +Five simplices in cyclic order A,B,C,D,E around edge x1. +17.20 Group_20 + +Note from text: If the circumradius of a quasi-regular tetrahedron +is >= 1.41, then tau > 1.8 pt and many of the inequalities hold +(without further interval arithmetic calculation). + +*) + +(* interval verification by Ferguson *) +let I_551665569= + all_forall + ` +let x6B = x5A in +let x2B = x3A in +let x6C = x5B in +let x2C = x3B in +let x6D = x5C in +let x2D = x3C in +let x6E = x5D in +let x2E = x3D in +let x6A = x5E in +let x2A = x3E in + (ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2A, square_2t0); + ((#4.0), x3A, square_2t0); + ((#4.0), x4A, square_2t0); + ((#4.0), x5A, square_2t0); + ((#4.0), x6A, square_2t0); + ((#4.0), x2B, square_2t0); + ((#4.0), x3B, square_2t0); + ((#4.0), x4B, square_2t0); + ((#4.0), x5B, square_2t0); + ((#4.0), x6B, square_2t0); + ((#4.0), x2C, square_2t0); + ((#4.0), x3C, square_2t0); + ((#8.0), x4C, square_4t0); // NB + ((#4.0), x5C, square_2t0); + ((#4.0), x6C, square_2t0); + ((#4.0), x2D, square_2t0); + ((#4.0), x3D, square_2t0); + ((#4.0), x4D, square_2t0); + ((#4.0), x5D, square_2t0); + ((#4.0), x6D, square_2t0); + ((#4.0), x2E, square_2t0); + ((#4.0), x3E, square_2t0); + ((#8.0), x4E, square_4t0); // NB + ((#4.0), x5E, square_2t0); + ((#4.0), x6E, square_2t0)] + (((tau_sigma_x x1 x2A x3A x4A x5A x6A) +. + (tau_sigma_x x1 x2B x3B x4B x5B x6B) +. + (tau_sigma_x x1 x2D x3D x4D x5D x6D) >. (#1.4) *. pt) \/ + ((dih_x x1 x2A x3A x4A x5A x6A) +. + (dih_x x1 x2B x3B x4B x5B x6B) +. + (dih_x x1 x2C x3C x4C x5C x6C) +. + (dih_x x1 x2D x3D x4D x5D x6D) +. + (dih_x x1 x2E x3E x4E x5E x6E) >. (#2.0) *. pi + )))`;; + +(* interval verification by Ferguson *) +let I_824762926= + all_forall + ` +let x6B = x5A in +let x2B = x3A in +let x6C = x5B in +let x2C = x3B in +let x6D = x5C in +let x2D = x3C in +let x6E = x5D in +let x2E = x3D in +let x6A = x5E in +let x2A = x3E in + (ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2A, square_2t0); + ((#4.0), x3A, square_2t0); + ((#4.0), x4A, square_2t0); + ((#4.0), x5A, square_2t0); + ((#4.0), x6A, square_2t0); + ((#4.0), x2B, square_2t0); + ((#4.0), x3B, square_2t0); + ((#4.0), x4B, square_2t0); + ((#4.0), x5B, square_2t0); + ((#4.0), x6B, square_2t0); + ((#4.0), x2C, square_2t0); + ((#4.0), x3C, square_2t0); + ((#4.0), x4C, square_2t0); + ((#4.0), x5C, square_2t0); + ((#4.0), x6C, square_2t0); + ((#4.0), x2D, square_2t0); + ((#4.0), x3D, square_2t0); + ((#8.0), x4D, square_4t0); // NB + ((#4.0), x5D, square_2t0); + ((#4.0), x6D, square_2t0); + ((#4.0), x2E, square_2t0); + ((#4.0), x3E, square_2t0); + ((#8.0), x4E, square_4t0); // NB + ((#4.0), x5E, square_2t0); + ((#4.0), x6E, square_2t0)] + (((tau_sigma_x x1 x2A x3A x4A x5A x6A) +. + (tau_sigma_x x1 x2B x3B x4B x5B x6B) +. + (tau_sigma_x x1 x2C x3C x4C x5C x6C) >. (#1.4) *. pt) \/ + ((dih_x x1 x2A x3A x4A x5A x6A) +. + (dih_x x1 x2B x3B x4B x5B x6B) +. + (dih_x x1 x2C x3C x4C x5C x6C) +. + (dih_x x1 x2D x3D x4D x5D x6D) +. + (dih_x x1 x2E x3E x4E x5E x6E) >. (#2.0) *. pi + )))`;; + +(* interval verification by Ferguson *) +let I_675785884= + all_forall + ` +let x6B = x5A in +let x2B = x3A in +let x6C = x5B in +let x2C = x3B in +let x6D = x5C in +let x2D = x3C in +let x6E = x5D in +let x2E = x3D in +let x6A = x5E in +let x2A = x3E in + (ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2A, square_2t0); + ((#4.0), x3A, square_2t0); + ((#4.0), x4A, square_2t0); + ((#4.0), x5A, square_2t0); + ((#4.0), x6A, square_2t0); + ((#4.0), x2B, square_2t0); + ((#4.0), x3B, square_2t0); + ((#4.0), x4B, square_2t0); + ((#4.0), x5B, square_2t0); + ((#4.0), x6B, square_2t0); + ((#4.0), x2C, square_2t0); + ((#4.0), x3C, square_2t0); + (square_2t0, x4C, (#8.0)); // NB + ((#4.0), x5C, square_2t0); + ((#4.0), x6C, square_2t0); + ((#4.0), x2D, square_2t0); + ((#4.0), x3D, square_2t0); + ((#4.0), x4D, square_2t0); + ((#4.0), x5D, square_2t0); + ((#4.0), x6D, square_2t0); + ((#4.0), x2E, square_2t0); + ((#4.0), x3E, square_2t0); + (square_2t0, x4E, square_4t0); // NB + ((#4.0), x5E, square_2t0); + ((#4.0), x6E, square_2t0)] + (((tau_sigma_x x1 x2A x3A x4A x5A x6A) +. + (tau_sigma_x x1 x2B x3B x4B x5B x6B) +. + (tauhatpi_x x1 x2C x3C x4C x5C x6C) +. + (tau_sigma_x x1 x2D x3D x4D x5D x6D) + >. ((#1.4) *. pt +. D31)) \/ + ((dih_x x1 x2A x3A x4A x5A x6A) +. + (dih_x x1 x2B x3B x4B x5B x6B) +. + (dih_x x1 x2C x3C x4C x5C x6C) +. + (dih_x x1 x2D x3D x4D x5D x6D) +. + (dih_x x1 x2E x3E x4E x5E x6E) >. (#2.0) *. pi ) \/ + (dih_x x1 x2E x3E x4E x5E x6E <. #1.32 ) + ))`;; + +(* interval verification by Ferguson *) +let I_193592217= + all_forall + ` +let x6B = x5A in +let x2B = x3A in +let x6C = x5B in +let x2C = x3B in +let x6D = x5C in +let x2D = x3C in +let x6E = x5D in +let x2E = x3D in +let x6A = x5E in +let x2A = x3E in + (ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2A, square_2t0); + ((#4.0), x3A, square_2t0); + ((#4.0), x4A, square_2t0); + ((#4.0), x5A, square_2t0); + ((#4.0), x6A, square_2t0); + ((#4.0), x2B, square_2t0); + ((#4.0), x3B, square_2t0); + ((#4.0), x4B, square_2t0); + ((#4.0), x5B, square_2t0); + ((#4.0), x6B, square_2t0); + ((#4.0), x2C, square_2t0); + ((#4.0), x3C, square_2t0); + ((#4.0), x4C, square_2t0); + ((#4.0), x5C, square_2t0); + ((#4.0), x6C, square_2t0); + ((#4.0), x2D, square_2t0); + ((#4.0), x3D, square_2t0); + (square_2t0, x4D, (#8.0)); // NB + ((#4.0), x5D, square_2t0); + ((#4.0), x6D, square_2t0); + ((#4.0), x2E, square_2t0); + ((#4.0), x3E, square_2t0); + (square_2t0, x4E, square_4t0); // NB + ((#4.0), x5E, square_2t0); + ((#4.0), x6E, square_2t0)] + (((tau_sigma_x x1 x2A x3A x4A x5A x6A) +. + (tau_sigma_x x1 x2B x3B x4B x5B x6B) +. + (tau_sigma_x x1 x2C x3C x4C x5C x6C) +. + (tauhatpi_x x1 x2D x3D x4D x5D x6D) + >. ((#1.4) *. pt +. D31)) \/ + ((dih_x x1 x2A x3A x4A x5A x6A) +. + (dih_x x1 x2B x3B x4B x5B x6B) +. + (dih_x x1 x2C x3C x4C x5C x6C) +. + (dih_x x1 x2D x3D x4D x5D x6D) +. + (dih_x x1 x2E x3E x4E x5E x6E) >. (#2.0) *. pi ) \/ + (dih_x x1 x2E x3E x4E x5E x6E <. #1.32 ) + ))`;; + + + + +(* + +LOC: 2002 k.c page 50 +17.21 Group_21 + +Note from text: As in Section 17.20, the quasi-regular tetrahedra +are generally compression scored. The constraint sum dih = 2pi +is assumed. +[Note 2/17/2004: We relax this constraint to sum dih <= 2 pi.] + +*) + +(* interval verification by Ferguson *) +let I_325738864= + all_forall + ` +let x6B = x5A in +let x2B = x3A in +let x6C = x5B in +let x2C = x3B in +let x6D = x5C in +let x2D = x3C in +let x6E = x5D in +let x2E = x3D in +let x6A = x5E in +let x2A = x3E in + (ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2A, square_2t0); + ((#4.0), x3A, square_2t0); + ((#4.0), x4A, square_2t0); + ((#4.0), x5A, square_2t0); + ((#4.0), x6A, square_2t0); + ((#4.0), x2B, square_2t0); + ((#4.0), x3B, square_2t0); + ((#4.0), x4B, square_2t0); + ((#4.0), x5B, square_2t0); + ((#4.0), x6B, square_2t0); + ((#4.0), x2C, square_2t0); + ((#4.0), x3C, square_2t0); + ((#4.0), x4C, square_2t0); + ((#4.0), x5C, square_2t0); + ((#4.0), x6C, square_2t0); + ((#4.0), x2D, square_2t0); + ((#4.0), x3D, square_2t0); + ((#4.0), x4D, square_2t0); + ((#4.0), x5D, square_2t0); + ((#4.0), x6D, square_2t0); + ((#4.0), x2E, square_2t0); + ((#4.0), x3E, square_2t0); + ((#8.0), x4E, square_4t0); // NB + ((#4.0), x5E, square_2t0); + ((#4.0), x6E, square_2t0)] + (((tau_sigma_x x1 x2A x3A x4A x5A x6A) +. + (tau_sigma_x x1 x2B x3B x4B x5B x6B) +. + (tau_sigma_x x1 x2C x3C x4C x5C x6C) +. + (tau_sigma_x x1 x2D x3D x4D x5D x6D) + >. ((#1.5) *. pt )) \/ + ((dih_x x1 x2A x3A x4A x5A x6A) +. + (dih_x x1 x2B x3B x4B x5B x6B) +. + (dih_x x1 x2C x3C x4C x5C x6C) +. + (dih_x x1 x2D x3D x4D x5D x6D) +. + (dih_x x1 x2E x3E x4E x5E x6E) >. (#2.0) *. pi ) + ))`;; + +(* interval verification by Ferguson *) +let I_314974315= + all_forall + ` +let x6B = x5A in +let x2B = x3A in +let x6C = x5B in +let x2C = x3B in +let x6D = x5C in +let x2D = x3C in +let x6E = x5D in +let x2E = x3D in +let x6A = x5E in +let x2A = x3E in + (ineq + [((#4.0), x1 , square_2t0); + ((#4.0), x2A, square_2t0); + ((#4.0), x3A, square_2t0); + ((#4.0), x4A, square_2t0); + ((#4.0), x5A, square_2t0); + ((#4.0), x6A, square_2t0); + ((#4.0), x2B, square_2t0); + ((#4.0), x3B, square_2t0); + ((#4.0), x4B, square_2t0); + ((#4.0), x5B, square_2t0); + ((#4.0), x6B, square_2t0); + ((#4.0), x2C, square_2t0); + ((#4.0), x3C, square_2t0); + ((#4.0), x4C, square_2t0); + ((#4.0), x5C, square_2t0); + ((#4.0), x6C, square_2t0); + ((#4.0), x2D, square_2t0); + ((#4.0), x3D, square_2t0); + ((#4.0), x4D, square_2t0); + ((#4.0), x5D, square_2t0); + ((#4.0), x6D, square_2t0); + ((#4.0), x2E, square_2t0); + ((#4.0), x3E, square_2t0); + (square_2t0, x4E, (#8.0)); // NB + ((#4.0), x5E, square_2t0); + ((#4.0), x6E, square_2t0)] + (((tau_sigma_x x1 x2A x3A x4A x5A x6A) +. + (tau_sigma_x x1 x2B x3B x4B x5B x6B) +. + (tau_sigma_x x1 x2C x3C x4C x5C x6C) +. + (tau_sigma_x x1 x2D x3D x4D x5D x6D) +. + (tauhatpi_x x1 x2E x3E x4E x5E x6E) + >. ((#1.5) *. pt +. D31 )) \/ + ((dih_x x1 x2A x3A x4A x5A x6A) +. + (dih_x x1 x2B x3B x4B x5B x6B) +. + (dih_x x1 x2C x3C x4C x5C x6C) +. + (dih_x x1 x2D x3D x4D x5D x6D) +. + (dih_x x1 x2E x3E x4E x5E x6E) >. (#2.0) *. pi ) + ))`;; + +(* + +LOC: 2002 k.c page 50 +17.22 Group_22 +[The constraint sum dih <= 2pi was not explicitly stated in the text.] +*) + +(* interval verification by Ferguson, I think. In SPVI-1998, it carries +a dagger, which means that Ferguson has done the verification, but the +dagger has been commented out in the tex file. -TCH 1/19/2008 *) +let I_867359387= + all_forall + ` +let x6B = x5A in +let x2B = x3A in +let x6C = x5B in +let x2C = x3B in +let x6D = x5C in +let x2D = x3C in +let x6E = x5D in +let x2E = x3D in +let x6A = x5E in +let x2A = x3E in + (ineq + [((#4.0), x1 , square_2t0); + ((#4.0), x2A, square_2t0); + ((#4.0), x3A, square_2t0); + ((#4.0), x4A, square_2t0); + ((#4.0), x5A, square_2t0); + ((#4.0), x6A, square_2t0); + ((#4.0), x2B, square_2t0); + ((#4.0), x3B, square_2t0); + ((#4.0), x4B, square_2t0); + ((#4.0), x5B, square_2t0); + ((#4.0), x6B, square_2t0); + ((#4.0), x2C, square_2t0); + ((#4.0), x3C, square_2t0); + ((#4.0), x4C, square_2t0); + ((#4.0), x5C, square_2t0); + ((#4.0), x6C, square_2t0); + ((#4.0), x2D, square_2t0); + ((#4.0), x3D, square_2t0); + ((#4.0), x4D, square_2t0); + ((#4.0), x5D, square_2t0); + ((#4.0), x6D, square_2t0); + ((#4.0), x2E, square_2t0); + ((#4.0), x3E, square_2t0); + (square_2t0, x4E, (#8.0)); // NB + ((#4.0), x5E, square_2t0); + ((#4.0), x6E, square_2t0)] + (((sigma_qrtet_x x1 x2A x3A x4A x5A x6A) +. + (sigma_qrtet_x x1 x2B x3B x4B x5B x6B) +. + (sigma_qrtet_x x1 x2C x3C x4C x5C x6C) +. + (sigma_qrtet_x x1 x2D x3D x4D x5D x6D) +. + (sigmahat_x x1 x2E x3E x4E x5E x6E) + <. #0.114) \/ + ((dih_x x1 x2A x3A x4A x5A x6A) +. + (dih_x x1 x2B x3B x4B x5B x6B) +. + (dih_x x1 x2C x3C x4C x5C x6C) +. + (dih_x x1 x2D x3D x4D x5D x6D) +. + (dih_x x1 x2E x3E x4E x5E x6E) >. (#2.0) *. pi ) + ))`;; + + +(* +LOC: 2002 III, page 15. +Sec. 10, Group_4 +SKIP equation 2. +It asserts that the angle sum around a vertex is 2pi. +This is not an interval calculation. +*) + +(* +LOC: 2002 III, page 15. +Sec. 10, Group_4 +equation 3. Dihedral sum changed to an inequality. +*) + +let J_694278521= + all_forall + ` +let x6B = x5A in +let x2B = x3A in +let x6C = x5B in +let x2C = x3B in +let x6D = x5C in +let x2D = x3C in +let x6E = x5D in +let x2E = x3D in +let x6A = x5E in +let x2A = x3E in + (ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2A, square_2t0); + ((#4.0), x3A, square_2t0); + ((#4.0), x4A, square_2t0); + ((#4.0), x5A, square_2t0); + ((#4.0), x6A, square_2t0); + ((#4.0), x2B, square_2t0); + ((#4.0), x3B, square_2t0); + ((#4.0), x4B, square_2t0); + ((#4.0), x5B, square_2t0); + ((#4.0), x6B, square_2t0); + ((#4.0), x2C, square_2t0); + ((#4.0), x3C, square_2t0); + ((#4.0), x4C, square_2t0); + ((#4.0), x5C, square_2t0); + ((#4.0), x6C, square_2t0); + ((#4.0), x2D, square_2t0); + ((#4.0), x3D, square_2t0); + ((#4.0), x4D, square_2t0); + ((#4.0), x5D, square_2t0); + ((#4.0), x6D, square_2t0); + ((#4.0), x2E, square_2t0); + ((#4.0), x3E, square_2t0); + ((#4.0), x4E, square_2t0); + ((#4.0), x5E, square_2t0); + ((#4.0), x6E, square_2t0)] + (( + ((sigma_qrtet_x x1 x2A x3A x4A x5A x6A) +. + #0.419351*. (sol_x x1 x2A x3A x4A x5A x6A)) +. + ((sigma_qrtet_x x1 x2B x3B x4B x5B x6B) +. + #0.419351*. (sol_x x1 x2B x3B x4B x5B x6B)) +. + ((sigma_qrtet_x x1 x2C x3C x4C x5C x6C) +. + #0.419351*. (sol_x x1 x2C x3C x4C x5C x6C)) +. + ((sigma_qrtet_x x1 x2D x3D x4D x5D x6D) +. + #0.419351*. (sol_x x1 x2D x3D x4D x5D x6D)) +. + ((sigma_qrtet_x x1 x2E x3E x4E x5E x6E) +. + #0.419351*. (sol_x x1 x2E x3E x4E x5E x6E)) + <. (#5.0 *. (#0.2856354))) \/ + + ((dih_x x1 x2A x3A x4A x5A x6A) +. + (dih_x x1 x2B x3B x4B x5B x6B) +. + (dih_x x1 x2C x3C x4C x5C x6C) +. + (dih_x x1 x2D x3D x4D x5D x6D) +. + (dih_x x1 x2E x3E x4E x5E x6E) >. (#2.0) *. pi + )))`;; + + +(* + +LOC: 2002 III, page 15. +Sec. 10, Group_4 +*) + +(* +equation 1. Dihedral sum changed to inequality. +*) + +let J_895315463= + all_forall + ` +let x6B = x5A in +let x2B = x3A in +let x6C = x5B in +let x2C = x3B in +let x6D = x5C in +let x2D = x3C in +let x6A = x5D in +let x2A = x3D in + (ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2A, square_2t0); + ((#4.0), x3A, square_2t0); + ((#4.0), x4A, square_2t0); + ((#4.0), x5A, square_2t0); + ((#4.0), x6A, square_2t0); + ((#4.0), x2B, square_2t0); + ((#4.0), x3B, square_2t0); + ((#4.0), x4B, square_2t0); + ((#4.0), x5B, square_2t0); + ((#4.0), x6B, square_2t0); + ((#4.0), x2C, square_2t0); + ((#4.0), x3C, square_2t0); + ((#4.0), x4C, square_2t0); + ((#4.0), x5C, square_2t0); + ((#4.0), x6C, square_2t0); + ((#4.0), x2D, square_2t0); + ((#4.0), x3D, square_2t0); + ((#4.0), x4D, square_2t0); + ((#4.0), x5D, square_2t0); + ((#4.0), x6D, square_2t0)] + (((sigma_qrtet_x x1 x2A x3A x4A x5A x6A) +. + (sigma_qrtet_x x1 x2B x3B x4B x5B x6B) +. + (sigma_qrtet_x x1 x2C x3C x4C x5C x6C) +. + (sigma_qrtet_x x1 x2D x3D x4D x5D x6D) <. (#0.33) *. pt) \/ + ((dih_x x1 x2A x3A x4A x5A x6A) +. + (dih_x x1 x2B x3B x4B x5B x6B) +. + (dih_x x1 x2C x3C x4C x5C x6C) +. + (dih_x x1 x2D x3D x4D x5D x6D) <. (#2.0) *. pi + )))`;; + +(* + +LOC: 2002 k.c page 52--53 +17.28 Group_28 +*) + +(* interval verification by Ferguson *) +let I_615073260= + all_forall + ` +let x6B = x5A in +let x2B = x3A in +let x6C = x5B in +let x2C = x3B in +let x6D = x5C in +let x2D = x3C in +let x6E = x5D in +let x2E = x3D in +let x6A = x5E in +let x2A = x3E in + (ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2A, square_2t0); + ((#4.0), x3A, square_2t0); + ((#4.0), x4A, square_2t0); + ((#4.0), x5A, square_2t0); + ((#4.0), x6A, square_2t0); + ((#4.0), x2B, square_2t0); + ((#4.0), x3B, square_2t0); + ((#4.0), x4B, square_2t0); + ((#4.0), x5B, square_2t0); + ((#4.0), x6B, square_2t0); + ((#4.0), x2C, square_2t0); + ((#4.0), x3C, square_2t0); + ((#4.0), x4C, square_2t0); + ((#4.0), x5C, square_2t0); + ((#4.0), x6C, square_2t0); + ((#4.0), x2D, square_2t0); + ((#4.0), x3D, square_2t0); + ((#4.0), x4D, square_2t0); + ((#4.0), x5D, square_2t0); + ((#4.0), x6D, square_2t0); + ((#4.0), x2E, square_2t0); + ((#4.0), x3E, square_2t0); + ((square_2t0), x4E, (square_4t0)); // (* NB *) + ((#4.0), x5E, square_2t0); + ((#4.0), x6E, square_2t0)] + ((sqrt x2A) + (sqrt x2B) + (sqrt x2C) + (sqrt x2D) + (sqrt x2E) + + (sqrt x6A) + (sqrt x6B) + (sqrt x6C) + (sqrt x6D) + (sqrt x6E) >. (#20.42)))`;; + +(* interval verification by Ferguson *) +let I_844430737= + all_forall + ` +let x6B = x5A in +let x2B = x3A in +let x6C = x5B in +let x2C = x3B in +let x6D = x5C in +let x2D = x3C in +let x6E = x5D in +let x2E = x3D in +let x6A = x5E in +let x2A = x3E in + (ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2A, square_2t0); + ((#4.0), x3A, square_2t0); + ((#4.0), x4A, square_2t0); + ((#4.0), x5A, square_2t0); + ((#4.0), x6A, square_2t0); + ((#4.0), x2B, square_2t0); + ((#4.0), x3B, square_2t0); + ((#4.0), x4B, square_2t0); + ((#4.0), x5B, square_2t0); + ((#4.0), x6B, square_2t0); + ((#4.0), x2C, square_2t0); + ((#4.0), x3C, square_2t0); + ((#4.0), x4C, square_2t0); + ((#4.0), x5C, square_2t0); + ((#4.0), x6C, square_2t0); + ((#4.0), x2D, square_2t0); + ((#4.0), x3D, square_2t0); + ((#4.0), x4D, square_2t0); + ((#4.0), x5D, square_2t0); + ((#4.0), x6D, square_2t0); + ((#4.0), x2E, square_2t0); + ((#4.0), x3E, square_2t0); + ((#8.0), x4E, (square_4t0)); // (* NB *) + ((#4.0), x5E, square_2t0); + ((#4.0), x6E, square_2t0)] + ((sqrt x2A) + (sqrt x2B) + (sqrt x2C) + (sqrt x2D) + (sqrt x2E) + + (sqrt x6A) + (sqrt x6B) + (sqrt x6C) + (sqrt x6D) + (sqrt x6E) >. (#20.76)))`;; + + +(* Duplicate inequality. This is the same as 413688580 *) +(* +let J_549774315_1= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (nu_x x1 x2 x3 x4 x5 x6) +. ( (--. (#4.10113)) *. (dih_x x1 x2 x3 x4 x5 x6))) <. (--. (#4.3223)))`;; +*) + + +(* Duplicate inequality. This is the same as 805296510 *) +(* +let J_549774315_2= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (nu_x x1 x2 x3 x4 x5 x6) +. ( (--. (#0.80449)) *. (dih_x x1 x2 x3 x4 x5 x6))) <. (--. (#0.9871)))`;; +*) + +(* Duplicate inequality. This is the same as 136610219 *) +(* +let J_549774315_3= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (nu_x x1 x2 x3 x4 x5 x6) +. ( (--. (#0.70186)) *. (dih_x x1 x2 x3 x4 x5 x6))) <. (--. (#0.8756)))`;; +*) + +(* Duplicate inequality. This is the same as 379204810 *) +(* +let J_549774315_4= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (nu_x x1 x2 x3 x4 x5 x6) +. ( (--. (#0.24573)) *. (dih_x x1 x2 x3 x4 x5 x6))) <. (--. (#0.3404)))`;; +*) + +(* Duplicate inequality. This is the same as 878731435 *) +(* +let J_549774315_5= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (nu_x x1 x2 x3 x4 x5 x6) +. ( (--. (#0.00154)) *. (dih_x x1 x2 x3 x4 x5 x6))) <. (--. (#0.0024)))`;; +*) + +(* Duplicate inequality. This is the same as 891740103 *) +(* +let J_549774315_6= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (nu_x x1 x2 x3 x4 x5 x6) +. ( (#0.07611) *. (dih_x x1 x2 x3 x4 x5 x6))) <. (#0.1196))`;; +*) + +(* Duplicate inequality. This is the same as 334002329 *) +(* +let J_574435320_1= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (taunu_x x1 x2 x3 x4 x5 x6) +. ( (#4.16523) *. (dih_x x1 x2 x3 x4 x5 x6))) >. (#4.42873))`;; +*) + +(* Duplicate inequality. This is the same as 883139937 *) +(* +let J_574435320_2= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (taunu_x x1 x2 x3 x4 x5 x6) +. ( (#0.78701) *. (dih_x x1 x2 x3 x4 x5 x6))) >. (#1.01104))`;; +*) + +(* Duplicate inequality. This is the same as 507989176 *) +(* +let J_574435320_3= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (taunu_x x1 x2 x3 x4 x5 x6) +. ( (#0.77627) *. (dih_x x1 x2 x3 x4 x5 x6))) >. (#0.99937))`;; +*) + +(* Duplicate inequality. This is the same as 244435805 *) +(* +let J_574435320_4= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (taunu_x x1 x2 x3 x4 x5 x6) +. ( (#0.21916) *. (dih_x x1 x2 x3 x4 x5 x6))) >. (#0.34877))`;; +*) + +(* Duplicate inequality. This is the same as 930176500 *) +(* +let J_574435320_5= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (taunu_x x1 x2 x3 x4 x5 x6) +. ( (#0.05107) *. (dih_x x1 x2 x3 x4 x5 x6))) >. (#0.11434))`;; +*) + +(* Duplicate inequality. This is the same as 815681339 *) +(* +let J_574435320_6= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( + ( (taunu_x x1 x2 x3 x4 x5 x6) +. ( (--. (#0.07106)) *. (dih_x x1 x2 x3 x4 x5 x6))) >. (--. (#0.07749)))`;; +*) + +(* +This was false for strict inequality. +gives equality at [8,4,4,8,4,4]. +It is trivially true when weak inequality is used, because dih(simplex)<=pi +without any constraints on the simplex. So we don't need interval arithmetic +for its verification. Commented out. +*) +(* +let I_853728973_24= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, (#8.0)); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <=. pi)`;; +*) + + + +(* +dih < pi is false +gives equality at [8,4,4,8,4,4]. +See comments for I_853728973_24. +*) + +(* +let I_853728973_26= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + (square_2t0, x4, square_4t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <=. pi)`;; +*) + + +(* +dih < pi is false +gives equality at [8,4,4,8,4,4]. +Interval verification not needed. +See comments for I_853728973_24. +*) + +(* +let I_853728973_28= + all_forall `ineq + [(square_2t0, x1, (#8.0)); + ((#4.0), x2, square_2t0); + ((#4.0), x3, square_2t0); + ((#8.0), x4, square_4t0); + ((#4.0), x5, square_2t0); + ((#4.0), x6, square_2t0) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) <=. pi)`;; +*) + + +(* +dih > 0 is false +gives equality at [4,4,8,4,4,8] +Interval verification not needed, +since dih is always >= 0. +See comments for I_853728973_24. +*) + +(* +let I_853728973_33= + all_forall `ineq + [((#4.0), x1, square_2t0); + ((#4.0), x2, square_2t0); + (square_2t0, x3, (#8.0)); + ((#4.0), x4, square_2t0); + ((#4.0), x5, square_2t0); + (square_2t0, x6, (#8.0)) + ] + ( (dih_x x1 x2 x3 x4 x5 x6) =>. (#0.0))`;; +*) diff --git a/legacy/inequalities/kepler_ineq_names.ml b/legacy/inequalities/kepler_ineq_names.ml new file mode 100644 index 0000000..446da07 --- /dev/null +++ b/legacy/inequalities/kepler_ineq_names.ml @@ -0,0 +1,1130 @@ + +(* Do an emacs `occur` for ^let [IJ] *) + +module type Kepler_ineq_names = +sig + + val ignore : string list + val kepler_ineqs : (string * term) list + +end + +module Kepler_ineq_names : Kepler_ineq_names = +struct + + let ignore = [ + (* >= *) + "I_498839271_12"; + "I_74657942"; + "I_675901554"; + "J_586468779"; + "J_53415898"; + "J_346093004"; + "J_5901405"; + "J_40003553"; + "J_522528841" ; + "J_892806084"; + "J_353908222"; + "J_399226168"; + "J_349475742"; + (* deriv *) + "I_484314425"; + "I_440223030"; + "I_329882546_1"; + "I_329882546_2"; + "I_427688691_1"; + "I_427688691_2"; + "I_562103670_1"; + "I_562103670_2"; + "I_564506426_1"; + "I_564506426_2"; + "I_288224597_1"; + "I_288224597_2"; + "I_979916330_1"; + "I_749968927_2"; + (* beta + composition *) + "I_757995764"; + "I_735258244"; + "I_343330051"; + "I_49446087"; + "I_799187442"; + (* overlap_f not finished (by tom) *) + "I_115756648"; + "I_275706375"; + "I_324536936"; + (* tauVt not implemented (by me) *) + "I_983547118"; + "I_206278009"; + "I_524345535"; + + ] + + let kepler_ineqs = [ + + "I_572068135",I_572068135; + "I_723700608",I_723700608; + "I_560470084",I_560470084; + "I_535502975",I_535502975; + "I_821707685",I_821707685; + "I_115383627",I_115383627; + "I_576221766",I_576221766; + "I_122081309",I_122081309; + "I_644534985",I_644534985; + "I_467530297",I_467530297; + "I_603910880",I_603910880; + "I_135427691",I_135427691; + "I_60314528",I_60314528; + "I_312132053",I_312132053; + "I_751442360",I_751442360; + "I_893059266",I_893059266; + "I_690646028",I_690646028; + "I_161665083",I_161665083; + "I_867513567_1",I_867513567_1; + "I_867513567_2",I_867513567_2; + "I_867513567_3",I_867513567_3; + "I_867513567_4",I_867513567_4; + "I_867513567_5",I_867513567_5; + "I_867513567_6",I_867513567_6; + "I_867513567_7",I_867513567_7; + "I_867513567_8",I_867513567_8; + "I_867513567_9",I_867513567_9; + "I_867513567_10",I_867513567_10; + "I_867513567_11",I_867513567_11; + "I_867513567_12",I_867513567_12; + "I_867513567_13",I_867513567_13; + "I_498839271_3",I_498839271_3; + "I_498839271_4",I_498839271_4; + "I_498839271_5",I_498839271_5; + "I_498839271_6",I_498839271_6; + "I_498839271_7",I_498839271_7; + "I_498839271_8",I_498839271_8; + "I_498839271_9",I_498839271_9; + "I_498839271_10",I_498839271_10; + "I_498839271_11",I_498839271_11; + "I_498839271_12",I_498839271_12; + "I_498839271_13",I_498839271_13; + "I_319046543_1",I_319046543_1; + "I_319046543_2",I_319046543_2; + "I_319046543_3",I_319046543_3; + "I_319046543_4",I_319046543_4; + "I_319046543_5",I_319046543_5; + "I_319046543_6",I_319046543_6; + "I_319046543_7",I_319046543_7; + "I_319046543_8",I_319046543_8; + "I_319046543_9",I_319046543_9; + "I_319046543_10",I_319046543_10; + "I_319046543_11",I_319046543_11; + "I_319046543_12",I_319046543_12; + "I_319046543_13",I_319046543_13; + "I_319046543_14",I_319046543_14; + "I_853728973_1",I_853728973_1; + "I_853728973_2",I_853728973_2; + "I_853728973_3",I_853728973_3; + "I_853728973_5",I_853728973_5; + "I_853728973_6",I_853728973_6; + "I_853728973_7",I_853728973_7; + "I_853728973_8",I_853728973_8; + "I_853728973_9",I_853728973_9; + "I_853728973_10",I_853728973_10; + "I_853728973_11",I_853728973_11; + "I_853728973_12",I_853728973_12; + "I_853728973_13",I_853728973_13; + "I_853728973_14",I_853728973_14; + "I_853728973_15",I_853728973_15; + "I_853728973_16",I_853728973_16; + "I_853728973_17",I_853728973_17; + "I_853728973_18",I_853728973_18; + "I_853728973_19",I_853728973_19; + "I_853728973_20",I_853728973_20; + "I_853728973_21",I_853728973_21; + "I_853728973_22",I_853728973_22; + "I_853728973_23",I_853728973_23; + "I_853728973_25",I_853728973_25; + "I_853728973_27",I_853728973_27; + "I_853728973_29",I_853728973_29; + "I_853728973_30",I_853728973_30; + "I_853728973_31",I_853728973_31; + "I_853728973_32",I_853728973_32; + "I_853728973_34",I_853728973_34; + "I_853728973_35",I_853728973_35; + "I_853728973_36",I_853728973_36; + "I_529738375_1",I_529738375_1; + "I_529738375_2",I_529738375_2; + "I_529738375_3",I_529738375_3; + "I_529738375_4",I_529738375_4; + "I_529738375_5",I_529738375_5; + "I_529738375_6",I_529738375_6; + "I_529738375_7",I_529738375_7; + "I_529738375_8",I_529738375_8; + "I_529738375_9",I_529738375_9; + "I_529738375_10",I_529738375_10; + "I_529738375_11",I_529738375_11; + "I_529738375_12",I_529738375_12; + "I_529738375_13",I_529738375_13; + "I_529738375_14",I_529738375_14; + "I_529738375_15",I_529738375_15; + "I_529738375_16",I_529738375_16; + "I_456320257_1",I_456320257_1; + "I_456320257_2",I_456320257_2; + "I_456320257_3",I_456320257_3; + "I_456320257_4",I_456320257_4; + "I_664959245_1",I_664959245_1; + "I_664959245_2",I_664959245_2; + "I_664959245_3",I_664959245_3; + "I_704795925_1",I_704795925_1; + "I_704795925_2",I_704795925_2; + "I_332919646_1",I_332919646_1; + "I_332919646_2",I_332919646_2; + "I_335795137_1",I_335795137_1; + "I_335795137_2",I_335795137_2; + "I_605071818_1",I_605071818_1; + "I_605071818_2",I_605071818_2; + "I_642806938_1",I_642806938_1; + "I_642806938_2",I_642806938_2; + "I_104506452",I_104506452; + "I_601083647",I_601083647; + "I_543730647",I_543730647; + "I_163030624",I_163030624; + "I_181462710",I_181462710; + "I_463544803",I_463544803; + "I_399326202",I_399326202; + "I_569240360",I_569240360; + "I_252231882",I_252231882; + "I_472436131",I_472436131; + "I_913534858",I_913534858; + "I_850226792",I_850226792; + "I_594246986",I_594246986; + "I_381970727",I_381970727; + "I_951798877",I_951798877; + "I_923397705",I_923397705; + "I_312481617",I_312481617; + "I_292760488",I_292760488; + "I_155008179",I_155008179; + "I_819450002",I_819450002; + "I_495568072",I_495568072; + "I_838887715",I_838887715; + "I_794413343",I_794413343; + "I_378020227",I_378020227; + "I_256893386",I_256893386; + "I_749955642",I_749955642; + "I_653849975",I_653849975; + "I_480930831",I_480930831; + "I_271703736",I_271703736; + "I_455329491",I_455329491; + "I_857241493",I_857241493; + "I_912536613",I_912536613; + "I_640248153",I_640248153; + "I_594902677",I_594902677; + "I_365179082_1",I_365179082_1; + "I_365179082_2",I_365179082_2; + "I_365179082_3",I_365179082_3; + "I_368244553",I_368244553; + "I_820900672",I_820900672; + "I_961078136",I_961078136; + "I_424186517_1",I_424186517_1; + "I_424186517_2",I_424186517_2; + "I_424186517_3",I_424186517_3; + "I_587781327",I_587781327; + "I_807067544",I_807067544; + "I_986970370",I_986970370; + "I_677910379",I_677910379; + "I_276168273",I_276168273; + "I_411203982",I_411203982; + "I_860823724",I_860823724; + "I_353116955",I_353116955; + "I_943315982",I_943315982; + "I_941799628",I_941799628; + "I_674284283",I_674284283; + "I_286076305",I_286076305; + "I_589319960",I_589319960; + "I_302085207_1",I_302085207_1; + "I_302085207_2",I_302085207_2; + "I_302085207_3",I_302085207_3; + "I_302085207_4",I_302085207_4; + "I_302085207_5",I_302085207_5; + "I_302085207_6",I_302085207_6; + "I_302085207_7",I_302085207_7; + "I_302085207_8",I_302085207_8; + "I_302085207_9",I_302085207_9; + "I_302085207_10",I_302085207_10; + "I_302085207_11",I_302085207_11; + "I_302085207_12",I_302085207_12; + "I_302085207_13",I_302085207_13; + "I_302085207_14",I_302085207_14; + "I_302085207_15",I_302085207_15; + "I_302085207_16",I_302085207_16; + "I_411491283_1",I_411491283_1; + "I_411491283_2",I_411491283_2; + "I_411491283_3",I_411491283_3; + "I_411491283_4",I_411491283_4; + "I_411491283_5",I_411491283_5; + "I_411491283_6",I_411491283_6; + "I_411491283_7",I_411491283_7; + "I_411491283_8",I_411491283_8; + "I_411491283_9",I_411491283_9; + "I_411491283_10",I_411491283_10; + "I_411491283_11",I_411491283_11; + "I_411491283_12",I_411491283_12; + "I_411491283_13",I_411491283_13; + "I_411491283_14",I_411491283_14; + "I_411491283_15",I_411491283_15; + "I_411491283_16",I_411491283_16; + "I_131574415",I_131574415; + "I_929773933",I_929773933; + "I_223261160",I_223261160; + "I_135018647",I_135018647; + "I_559676877",I_559676877; + "I_967376139",I_967376139; + "I_666869244",I_666869244; + "I_268066802",I_268066802; + "I_508108214",I_508108214; + "I_322505397",I_322505397; + "I_736616321",I_736616321; + "I_689417023",I_689417023; + "I_748466752",I_748466752; + "I_369386367_1",I_369386367_1; + "I_369386367_2",I_369386367_2; + "I_724943459_1",I_724943459_1; + "I_724943459_2",I_724943459_2; + "I_724943459_3",I_724943459_3; + "I_724943459_4",I_724943459_4; + "I_836331201_1",I_836331201_1; + "I_836331201_2",I_836331201_2; + "I_327474205_1",I_327474205_1; + "I_327474205_2",I_327474205_2; + "I_327474205_3",I_327474205_3; + "I_327474205_4",I_327474205_4; + "I_327474205_5",I_327474205_5; + "I_327474205_6",I_327474205_6; + "I_327474205_7",I_327474205_7; + "I_327474205_8",I_327474205_8; + "I_327474205_9",I_327474205_9; + "I_327474205_10",I_327474205_10; + "I_327474205_11",I_327474205_11; + "I_327474205_12",I_327474205_12; + "I_725257062",I_725257062; + "I_977272202",I_977272202; + "I_583626763_1",I_583626763_1; + "I_583626763_2",I_583626763_2; + "I_583626763_3",I_583626763_3; + "I_583626763_4",I_583626763_4; + "I_583626763_5",I_583626763_5; + "I_583626763_6",I_583626763_6; + "I_583626763_7",I_583626763_7; + "I_583626763_8",I_583626763_8; + "I_390951718_1",I_390951718_1; + "I_390951718_2",I_390951718_2; + "I_390951718_3",I_390951718_3; + "I_390951718_4",I_390951718_4; + "I_390951718_5",I_390951718_5; + "I_390951718_6",I_390951718_6; + "I_390951718_7",I_390951718_7; + "I_390951718_8",I_390951718_8; + "I_621852152_1",I_621852152_1; + "I_621852152_2",I_621852152_2; + "I_621852152_3",I_621852152_3; + "I_621852152_4",I_621852152_4; + "I_621852152_5",I_621852152_5; + "I_621852152_6",I_621852152_6; + "I_621852152_7",I_621852152_7; + "I_621852152_8",I_621852152_8; + "I_621852152_9",I_621852152_9; + "I_621852152_10",I_621852152_10; + "I_621852152_11",I_621852152_11; + "I_621852152_12",I_621852152_12; + "I_621852152_13",I_621852152_13; + "I_621852152_14",I_621852152_14; + "I_621852152_15",I_621852152_15; + "I_621852152_16",I_621852152_16; + "I_621852152_17",I_621852152_17; + "I_621852152_18",I_621852152_18; + "I_621852152_19",I_621852152_19; + "I_621852152_20",I_621852152_20; + "I_621852152_21",I_621852152_21; + "I_621852152_22",I_621852152_22; + "I_621852152_23",I_621852152_23; + "I_621852152_24",I_621852152_24; + "I_621852152_25",I_621852152_25; + "I_621852152_26",I_621852152_26; + "I_621852152_27",I_621852152_27; + "I_621852152_28",I_621852152_28; + "I_621852152_29",I_621852152_29; + "I_621852152_30",I_621852152_30; + "I_621852152_31",I_621852152_31; + "I_621852152_32",I_621852152_32; + "I_207203174_1",I_207203174_1; + "I_207203174_2",I_207203174_2; + "I_207203174_3",I_207203174_3; + "I_207203174_4",I_207203174_4; + "I_207203174_5",I_207203174_5; + "I_207203174_6",I_207203174_6; + "I_207203174_7",I_207203174_7; + "I_207203174_8",I_207203174_8; + "I_207203174_9",I_207203174_9; + "I_207203174_10",I_207203174_10; + "I_207203174_11",I_207203174_11; + "I_207203174_12",I_207203174_12; + "I_207203174_13",I_207203174_13; + "I_207203174_14",I_207203174_14; + "I_207203174_15",I_207203174_15; + "I_207203174_16",I_207203174_16; + "I_207203174_17",I_207203174_17; + "I_207203174_18",I_207203174_18; + "I_207203174_19",I_207203174_19; + "I_207203174_20",I_207203174_20; + "I_207203174_21",I_207203174_21; + "I_207203174_22",I_207203174_22; + "I_207203174_23",I_207203174_23; + "I_207203174_24",I_207203174_24; + "I_207203174_25",I_207203174_25; + "I_207203174_26",I_207203174_26; + "I_207203174_27",I_207203174_27; + "I_207203174_28",I_207203174_28; + "I_207203174_29",I_207203174_29; + "I_207203174_30",I_207203174_30; + "I_207203174_31",I_207203174_31; + "I_207203174_32",I_207203174_32; + "I_368258024_1",I_368258024_1; + "I_368258024_2",I_368258024_2; + "I_368258024_3",I_368258024_3; + "I_368258024_4",I_368258024_4; + "I_368258024_5",I_368258024_5; + "I_368258024_6",I_368258024_6; + "I_368258024_7",I_368258024_7; + "I_368258024_8",I_368258024_8; + "I_368258024_9",I_368258024_9; + "I_368258024_10",I_368258024_10; + "I_368258024_11",I_368258024_11; + "I_368258024_12",I_368258024_12; + "I_368258024_13",I_368258024_13; + "I_368258024_14",I_368258024_14; + "I_368258024_15",I_368258024_15; + "I_368258024_16",I_368258024_16; + "I_368258024_17",I_368258024_17; + "I_368258024_18",I_368258024_18; + "I_368258024_19",I_368258024_19; + "I_368258024_20",I_368258024_20; + "I_368258024_21",I_368258024_21; + "I_368258024_22",I_368258024_22; + "I_368258024_23",I_368258024_23; + "I_368258024_24",I_368258024_24; + "I_368258024_25",I_368258024_25; + "I_368258024_26",I_368258024_26; + "I_368258024_27",I_368258024_27; + "I_368258024_28",I_368258024_28; + "I_368258024_29",I_368258024_29; + "I_368258024_30",I_368258024_30; + "I_368258024_31",I_368258024_31; + "I_368258024_32",I_368258024_32; + "I_368258024_33",I_368258024_33; + "I_368258024_34",I_368258024_34; + "I_368258024_35",I_368258024_35; + "I_368258024_36",I_368258024_36; + "I_368258024_37",I_368258024_37; + "I_368258024_38",I_368258024_38; + "I_368258024_39",I_368258024_39; + "I_368258024_40",I_368258024_40; + "I_368258024_41",I_368258024_41; + "I_368258024_42",I_368258024_42; + "I_368258024_43",I_368258024_43; + "I_368258024_44",I_368258024_44; + "I_368258024_45",I_368258024_45; + "I_368258024_46",I_368258024_46; + "I_368258024_47",I_368258024_47; + "I_368258024_48",I_368258024_48; + "I_368258024_49",I_368258024_49; + "I_368258024_50",I_368258024_50; + "I_368258024_51",I_368258024_51; + "I_368258024_52",I_368258024_52; + "I_368258024_53",I_368258024_53; + "I_368258024_54",I_368258024_54; + "I_368258024_55",I_368258024_55; + "I_368258024_56",I_368258024_56; + "I_368258024_57",I_368258024_57; + "I_368258024_58",I_368258024_58; + "I_368258024_59",I_368258024_59; + "I_368258024_60",I_368258024_60; + "I_368258024_61",I_368258024_61; + "I_368258024_62",I_368258024_62; + "I_368258024_63",I_368258024_63; + "I_368258024_64",I_368258024_64; + "I_564618342_1",I_564618342_1; + "I_564618342_2",I_564618342_2; + "I_564618342_3",I_564618342_3; + "I_564618342_4",I_564618342_4; + "I_564618342_5",I_564618342_5; + "I_564618342_6",I_564618342_6; + "I_564618342_7",I_564618342_7; + "I_564618342_8",I_564618342_8; + "I_564618342_9",I_564618342_9; + "I_564618342_10",I_564618342_10; + "I_564618342_11",I_564618342_11; + "I_564618342_12",I_564618342_12; + "I_564618342_13",I_564618342_13; + "I_564618342_14",I_564618342_14; + "I_564618342_15",I_564618342_15; + "I_564618342_16",I_564618342_16; + "I_564618342_17",I_564618342_17; + "I_564618342_18",I_564618342_18; + "I_564618342_19",I_564618342_19; + "I_564618342_20",I_564618342_20; + "I_564618342_21",I_564618342_21; + "I_564618342_22",I_564618342_22; + "I_564618342_23",I_564618342_23; + "I_564618342_24",I_564618342_24; + "I_564618342_25",I_564618342_25; + "I_564618342_26",I_564618342_26; + "I_564618342_27",I_564618342_27; + "I_564618342_28",I_564618342_28; + "I_564618342_29",I_564618342_29; + "I_564618342_30",I_564618342_30; + "I_564618342_31",I_564618342_31; + "I_564618342_32",I_564618342_32; + "I_564618342_33",I_564618342_33; + "I_564618342_34",I_564618342_34; + "I_564618342_35",I_564618342_35; + "I_564618342_36",I_564618342_36; + "I_564618342_37",I_564618342_37; + "I_564618342_38",I_564618342_38; + "I_564618342_39",I_564618342_39; + "I_564618342_40",I_564618342_40; + "I_564618342_41",I_564618342_41; + "I_564618342_42",I_564618342_42; + "I_564618342_43",I_564618342_43; + "I_564618342_44",I_564618342_44; + "I_564618342_45",I_564618342_45; + "I_564618342_46",I_564618342_46; + "I_564618342_47",I_564618342_47; + "I_564618342_48",I_564618342_48; + "I_564618342_49",I_564618342_49; + "I_564618342_50",I_564618342_50; + "I_564618342_51",I_564618342_51; + "I_564618342_52",I_564618342_52; + "I_564618342_53",I_564618342_53; + "I_564618342_54",I_564618342_54; + "I_564618342_55",I_564618342_55; + "I_564618342_56",I_564618342_56; + "I_564618342_57",I_564618342_57; + "I_564618342_58",I_564618342_58; + "I_564618342_59",I_564618342_59; + "I_564618342_60",I_564618342_60; + "I_564618342_61",I_564618342_61; + "I_564618342_62",I_564618342_62; + "I_564618342_63",I_564618342_63; + "I_564618342_64",I_564618342_64; + "I_498774382_1",I_498774382_1; + "I_498774382_2",I_498774382_2; + "I_498774382_3",I_498774382_3; + "I_498774382_4",I_498774382_4; + "I_498774382_5",I_498774382_5; + "I_498774382_6",I_498774382_6; + "I_498774382_7",I_498774382_7; + "I_498774382_8",I_498774382_8; + "I_498774382_9",I_498774382_9; + "I_498774382_10",I_498774382_10; + "I_498774382_11",I_498774382_11; + "I_498774382_12",I_498774382_12; + "I_498774382_13",I_498774382_13; + "I_498774382_14",I_498774382_14; + "I_498774382_15",I_498774382_15; + "I_498774382_16",I_498774382_16; + "I_498774382_17",I_498774382_17; + "I_498774382_18",I_498774382_18; + "I_498774382_19",I_498774382_19; + "I_498774382_20",I_498774382_20; + "I_498774382_21",I_498774382_21; + "I_498774382_22",I_498774382_22; + "I_498774382_23",I_498774382_23; + "I_498774382_24",I_498774382_24; + "I_498774382_25",I_498774382_25; + "I_498774382_26",I_498774382_26; + "I_498774382_27",I_498774382_27; + "I_498774382_28",I_498774382_28; + "I_498774382_29",I_498774382_29; + "I_498774382_30",I_498774382_30; + "I_498774382_31",I_498774382_31; + "I_498774382_32",I_498774382_32; + "I_498774382_33",I_498774382_33; + "I_498774382_34",I_498774382_34; + "I_498774382_35",I_498774382_35; + "I_498774382_36",I_498774382_36; + "I_498774382_37",I_498774382_37; + "I_498774382_38",I_498774382_38; + "I_498774382_39",I_498774382_39; + "I_498774382_40",I_498774382_40; + "I_498774382_41",I_498774382_41; + "I_498774382_42",I_498774382_42; + "I_498774382_43",I_498774382_43; + "I_498774382_44",I_498774382_44; + "I_498774382_45",I_498774382_45; + "I_498774382_46",I_498774382_46; + "I_498774382_47",I_498774382_47; + "I_498774382_48",I_498774382_48; + "I_498774382_49",I_498774382_49; + "I_498774382_50",I_498774382_50; + "I_498774382_51",I_498774382_51; + "I_498774382_52",I_498774382_52; + "I_498774382_53",I_498774382_53; + "I_498774382_54",I_498774382_54; + "I_498774382_55",I_498774382_55; + "I_498774382_56",I_498774382_56; + "I_498774382_57",I_498774382_57; + "I_498774382_58",I_498774382_58; + "I_498774382_59",I_498774382_59; + "I_498774382_60",I_498774382_60; + "I_498774382_61",I_498774382_61; + "I_498774382_62",I_498774382_62; + "I_498774382_63",I_498774382_63; + "I_498774382_64",I_498774382_64; + "I_544865225_1",I_544865225_1; + "I_544865225_2",I_544865225_2; + "I_544865225_3",I_544865225_3; + "I_544865225_4",I_544865225_4; + "I_544865225_5",I_544865225_5; + "I_544865225_6",I_544865225_6; + "I_544865225_7",I_544865225_7; + "I_544865225_8",I_544865225_8; + "I_544865225_9",I_544865225_9; + "I_544865225_10",I_544865225_10; + "I_544865225_11",I_544865225_11; + "I_544865225_12",I_544865225_12; + "I_544865225_13",I_544865225_13; + "I_544865225_14",I_544865225_14; + "I_544865225_15",I_544865225_15; + "I_544865225_16",I_544865225_16; + "I_544865225_17",I_544865225_17; + "I_544865225_18",I_544865225_18; + "I_544865225_19",I_544865225_19; + "I_544865225_20",I_544865225_20; + "I_544865225_21",I_544865225_21; + "I_544865225_22",I_544865225_22; + "I_544865225_23",I_544865225_23; + "I_544865225_24",I_544865225_24; + "I_544865225_25",I_544865225_25; + "I_544865225_26",I_544865225_26; + "I_544865225_27",I_544865225_27; + "I_544865225_28",I_544865225_28; + "I_544865225_29",I_544865225_29; + "I_544865225_30",I_544865225_30; + "I_544865225_31",I_544865225_31; + "I_544865225_32",I_544865225_32; + "I_544865225_33",I_544865225_33; + "I_544865225_34",I_544865225_34; + "I_544865225_35",I_544865225_35; + "I_544865225_36",I_544865225_36; + "I_544865225_37",I_544865225_37; + "I_544865225_38",I_544865225_38; + "I_544865225_39",I_544865225_39; + "I_544865225_40",I_544865225_40; + "I_544865225_41",I_544865225_41; + "I_544865225_42",I_544865225_42; + "I_544865225_43",I_544865225_43; + "I_544865225_44",I_544865225_44; + "I_544865225_45",I_544865225_45; + "I_544865225_46",I_544865225_46; + "I_544865225_47",I_544865225_47; + "I_544865225_48",I_544865225_48; + "I_544865225_49",I_544865225_49; + "I_544865225_50",I_544865225_50; + "I_544865225_51",I_544865225_51; + "I_544865225_52",I_544865225_52; + "I_544865225_53",I_544865225_53; + "I_544865225_54",I_544865225_54; + "I_544865225_55",I_544865225_55; + "I_544865225_56",I_544865225_56; + "I_544865225_57",I_544865225_57; + "I_544865225_58",I_544865225_58; + "I_544865225_59",I_544865225_59; + "I_544865225_60",I_544865225_60; + "I_544865225_61",I_544865225_61; + "I_544865225_62",I_544865225_62; + "I_544865225_63",I_544865225_63; + "I_544865225_64",I_544865225_64; + "I_234734606",I_234734606; + "I_791682321",I_791682321; + "I_995351614_1",I_995351614_1; + "I_995351614_2",I_995351614_2; + "I_995351614_3",I_995351614_3; + "I_995351614_4",I_995351614_4; + "I_995351614_5",I_995351614_5; + "I_995351614_6",I_995351614_6; + "I_995351614_7",I_995351614_7; + "I_995351614_8",I_995351614_8; + "I_321843503_1",I_321843503_1; + "I_321843503_2",I_321843503_2; + "I_321843503_3",I_321843503_3; + "I_321843503_4",I_321843503_4; + "I_321843503_5",I_321843503_5; + "I_321843503_6",I_321843503_6; + "I_321843503_7",I_321843503_7; + "I_321843503_8",I_321843503_8; + "I_354217730",I_354217730; + "I_595674181",I_595674181; + "I_547486831",I_547486831; + "I_683897354",I_683897354; + "I_938003786",I_938003786; + "I_109046923_1",I_109046923_1; + "I_109046923_2",I_109046923_2; + "I_109046923_3",I_109046923_3; + "I_109046923_4",I_109046923_4; + "I_109046923_5",I_109046923_5; + "I_109046923_6",I_109046923_6; + "I_109046923_7",I_109046923_7; + "I_109046923_8",I_109046923_8; + "I_109046923_9",I_109046923_9; + "I_109046923_10",I_109046923_10; + "I_109046923_11",I_109046923_11; + "I_109046923_12",I_109046923_12; + "I_109046923_13",I_109046923_13; + "I_109046923_14",I_109046923_14; + "I_109046923_15",I_109046923_15; + "I_109046923_16",I_109046923_16; + "I_642590101_1",I_642590101_1; + "I_642590101_2",I_642590101_2; + "I_642590101_3",I_642590101_3; + "I_642590101_4",I_642590101_4; + "I_642590101_5",I_642590101_5; + "I_642590101_6",I_642590101_6; + "I_642590101_7",I_642590101_7; + "I_642590101_8",I_642590101_8; + "I_642590101_9",I_642590101_9; + "I_642590101_10",I_642590101_10; + "I_642590101_11",I_642590101_11; + "I_642590101_12",I_642590101_12; + "I_642590101_13",I_642590101_13; + "I_642590101_14",I_642590101_14; + "I_642590101_15",I_642590101_15; + "I_642590101_16",I_642590101_16; + "I_160800042_1",I_160800042_1; + "I_160800042_2",I_160800042_2; + "I_160800042_3",I_160800042_3; + "I_160800042_4",I_160800042_4; + "I_690272881_1",I_690272881_1; + "I_690272881_2",I_690272881_2; + "I_690272881_3",I_690272881_3; + "I_690272881_4",I_690272881_4; + "I_713930036_1",I_713930036_1; + "I_713930036_2",I_713930036_2; + "I_713930036_3",I_713930036_3; + "I_713930036_4",I_713930036_4; + "I_724922588_1",I_724922588_1; + "I_724922588_2",I_724922588_2; + "I_724922588_3",I_724922588_3; + "I_724922588_4",I_724922588_4; + "I_821730621_1",I_821730621_1; + "I_821730621_2",I_821730621_2; + "I_821730621_3",I_821730621_3; + "I_821730621_4",I_821730621_4; + "I_821730621_5",I_821730621_5; + "I_821730621_6",I_821730621_6; + "I_821730621_7",I_821730621_7; + "I_821730621_8",I_821730621_8; + "I_890642961_1",I_890642961_1; + "I_890642961_2",I_890642961_2; + "I_890642961_3",I_890642961_3; + "I_890642961_4",I_890642961_4; + "I_890642961_5",I_890642961_5; + "I_890642961_6",I_890642961_6; + "I_890642961_7",I_890642961_7; + "I_890642961_8",I_890642961_8; + "I_341667126",I_341667126; + "I_535906363",I_535906363; + "I_516537931",I_516537931; + "I_130008809_1",I_130008809_1; + "I_130008809_2",I_130008809_2; + "I_531861442",I_531861442; + "I_710875528",I_710875528; + "I_286122364",I_286122364; + "I_757995764",I_757995764; + "I_735258244",I_735258244; + "I_343330051",I_343330051; + "I_49446087",I_49446087; + "I_799187442",I_799187442; + "I_275706375",I_275706375; + "I_324536936",I_324536936; + "I_983547118",I_983547118; + "I_206278009",I_206278009; + "I_413688580",I_413688580; + "I_805296510",I_805296510; + "I_136610219",I_136610219; + "I_379204810",I_379204810; + "I_878731435",I_878731435; + "I_891740103",I_891740103; + "I_334002329",I_334002329; + "I_883139937",I_883139937; + "I_507989176",I_507989176; + "I_244435805",I_244435805; + "I_930176500",I_930176500; + "I_815681339",I_815681339; + "I_649592321",I_649592321; + "I_600996944",I_600996944; + "I_70667639",I_70667639; + "I_99182343",I_99182343; + "I_578762805",I_578762805; + "I_557125557",I_557125557; + "I_719735900",I_719735900; + "I_359616783",I_359616783; + "I_440833181",I_440833181; + "I_578578364",I_578578364; + "I_327398152",I_327398152; + "I_314861952",I_314861952; + "I_234753056",I_234753056; + "I_555481748",I_555481748; + "I_615152889",I_615152889; + "I_647971645",I_647971645; + "I_516606403",I_516606403; + "I_690552204",I_690552204; + "I_852763473",I_852763473; + "I_679673664",I_679673664; + "I_926514235",I_926514235; + "I_459744700",I_459744700; + "I_79400832",I_79400832; + "I_277388353",I_277388353; + "I_839852751",I_839852751; + "I_787458652",I_787458652; + "I_499014780",I_499014780; + "I_901845849",I_901845849; + "I_410091263",I_410091263; + "I_125103581",I_125103581; + "I_504968542",I_504968542; + "I_770716154",I_770716154; + "I_666090270",I_666090270; + "I_971555266",I_971555266; + "I_956875054",I_956875054; + "I_664200787",I_664200787; + "I_390273147",I_390273147; + "I_654422246",I_654422246; + "I_366536370",I_366536370; + "I_62532125",I_62532125; + "I_370631902",I_370631902; + "I_214637273",I_214637273; + "I_751772680",I_751772680; + "I_366146051",I_366146051; + "I_675766140",I_675766140; + "I_520734758",I_520734758; + "I_378432183",I_378432183; + "I_572206659",I_572206659; + "I_310679005",I_310679005; + "I_284970880",I_284970880; + "I_972111620",I_972111620; + "I_875762896",I_875762896; + "I_385332676",I_385332676; + "I_970291025",I_970291025; + "I_524345535",I_524345535; + "I_812894433",I_812894433; + "I_404793781",I_404793781; + "I_705592875",I_705592875; + "I_747727191",I_747727191; + "I_474496219",I_474496219; + "I_649551700",I_649551700; + "I_74657942",I_74657942; + "I_897129160",I_897129160; + "I_760840103",I_760840103; + "I_675901554",I_675901554; + "I_712696695",I_712696695; + "I_269048407",I_269048407; + "I_553285469",I_553285469; + "I_293389410",I_293389410; + "I_695069283",I_695069283; + "I_814398901",I_814398901; + "I_352079526",I_352079526; + "I_179025673",I_179025673; + "I_424011442",I_424011442; + "I_140881233",I_140881233; + "I_601456709_1",I_601456709_1; + "I_601456709_2",I_601456709_2; + "I_292977281_1",I_292977281_1; + "I_292977281_2",I_292977281_2; + "I_927286061_1",I_927286061_1; + "I_927286061_2",I_927286061_2; + "I_340409511_1",I_340409511_1; + "I_340409511_2",I_340409511_2; + "I_727498658",I_727498658; + "I_484314425",I_484314425; + "I_440223030",I_440223030; + "I_115756648",I_115756648; + "I_329882546_1",I_329882546_1; + "I_329882546_2",I_329882546_2; + "I_427688691_1",I_427688691_1; + "I_427688691_2",I_427688691_2; + "I_562103670_1",I_562103670_1; + "I_562103670_2",I_562103670_2; + "I_564506426_1",I_564506426_1; + "I_564506426_2",I_564506426_2; + "I_288224597_1",I_288224597_1; + "I_288224597_2",I_288224597_2; + "I_979916330_1",I_979916330_1; + "I_749968927_2",I_749968927_2; + "I_695180203_1",I_695180203_1; + "I_695180203_2",I_695180203_2; + "I_695180203_3",I_695180203_3; + "I_695180203_4",I_695180203_4; + "I_695180203_5",I_695180203_5; + "I_690626704_1",I_690626704_1; + "I_690626704_2",I_690626704_2; + "I_690626704_3",I_690626704_3; + "I_690626704_4",I_690626704_4; + "I_690626704_5",I_690626704_5; + "I_807023313",I_807023313; + "I_590577214",I_590577214; + "I_949210508_1",I_949210508_1; + "I_949210508_2",I_949210508_2; + "I_671961774_1",I_671961774_1; + "I_671961774_2",I_671961774_2; + "I_645264496_102",I_645264496_102; + "I_645264496_111",I_645264496_111; + "I_645264496_030",I_645264496_030; + "I_645264496_021",I_645264496_021; + "I_645264496_012",I_645264496_012; + "I_645264496_003",I_645264496_003; + "I_910154674",I_910154674; + "I_877743345",I_877743345; + "I_612259047_102",I_612259047_102; + "I_612259047_111",I_612259047_111; + "I_612259047_030",I_612259047_030; + "I_612259047_021",I_612259047_021; + "I_612259047_012",I_612259047_012; + "I_612259047_003",I_612259047_003; + "I_357477295_1",I_357477295_1; + "I_357477295_2",I_357477295_2; + "I_357477295_3",I_357477295_3; + "I_357477295_4",I_357477295_4; + "I_193776341_1",I_193776341_1; + "I_193776341_2",I_193776341_2; + "I_193776341_3",I_193776341_3; + "I_193776341_4",I_193776341_4; + "I_193776341_5",I_193776341_5; + "I_193776341_6",I_193776341_6; + "I_193776341_7",I_193776341_7; + "I_193776341_8",I_193776341_8; + "I_193776341_9",I_193776341_9; + "I_193776341_10",I_193776341_10; + "I_193776341_11",I_193776341_11; + "I_193776341_12",I_193776341_12; + "I_193776341_14",I_193776341_14; + "I_193776341_15",I_193776341_15; + "I_193776341_16",I_193776341_16; + "I_898647773_1",I_898647773_1; + "I_898647773_2",I_898647773_2; + "I_898647773_3",I_898647773_3; + "I_898647773_4",I_898647773_4; + "I_898647773_5",I_898647773_5; + "I_898647773_7",I_898647773_7; + "I_898647773_8",I_898647773_8; + "I_898647773_9",I_898647773_9; + "I_898647773_10",I_898647773_10; + "I_898647773_11",I_898647773_11; + "I_898647773_12",I_898647773_12; + "I_898647773_13",I_898647773_13; + "I_898647773_14",I_898647773_14; + "I_898647773_15",I_898647773_15; + "I_898647773_16",I_898647773_16; + "I_844634710_1",I_844634710_1; + "I_844634710_2",I_844634710_2; + "I_844634710_3",I_844634710_3; + "I_844634710_4",I_844634710_4; + "I_328845176_1",I_328845176_1; + "I_328845176_2",I_328845176_2; + "I_328845176_3",I_328845176_3; + "I_328845176_4",I_328845176_4; + "I_233273785_1",I_233273785_1; + "I_233273785_2",I_233273785_2; + "I_96695550_1",I_96695550_1; + "I_96695550_2",I_96695550_2; + "I_275286804",I_275286804; + "I_627654828",I_627654828; + "I_995177961",I_995177961; + "I_735892048",I_735892048; + "I_53502142",I_53502142; + "I_134398524",I_134398524; + "I_371491817",I_371491817; + "I_832922998",I_832922998; + "I_724796759",I_724796759; + "I_431940343",I_431940343; + "I_980721294",I_980721294; + "I_989564937",I_989564937; + "I_263355808",I_263355808; + "I_445132132",I_445132132; + "I_806767374",I_806767374; + "I_511038592",I_511038592; + "I_4591018_1",I_4591018_1; + "I_193728878_1",I_193728878_1; + "I_2724096_1",I_2724096_1; + "I_213514168_1",I_213514168_1; + "I_750768322_1",I_750768322_1; + "I_371464244_1",I_371464244_1; + "I_657011065_1",I_657011065_1; + "I_4591018_2",I_4591018_2; + "I_193728878_2",I_193728878_2; + "I_2724096_2",I_2724096_2; + "I_213514168_2",I_213514168_2; + "I_750768322_2",I_750768322_2; + "I_371464244_2",I_371464244_2; + "I_657011065_2",I_657011065_2; + "I_66753311",I_66753311; + "I_762922223",I_762922223; + "I_953023504",I_953023504; + "I_887276655",I_887276655; + "I_246315515",I_246315515; + "I_784421604",I_784421604; + "I_258632246",I_258632246; + "I_404164527",I_404164527; + "I_163088471",I_163088471; + "I_968721007",I_968721007; + "I_783968228",I_783968228; + "I_745174731",I_745174731; + "J_586468779",J_586468779; + "J_984463800",J_984463800; + "J_208809199",J_208809199; + "J_995444025",J_995444025; + "J_49987949",J_49987949; + "J_825495074",J_825495074; + "J_544014470",J_544014470; + "J_382430711",J_382430711; + "J_568731327",J_568731327; + "J_507227930",J_507227930; + "J_789045970",J_789045970; + "J_710947756",J_710947756; + "J_649712615",J_649712615; + "J_539256862",J_539256862; + "J_864218323",J_864218323; + "J_776305271",J_776305271; + "J_927432550",J_927432550; + "J_221945658",J_221945658; + "J_53415898",J_53415898; + "J_106537269",J_106537269; + "J_254627291",J_254627291; + "J_170403135",J_170403135; + "J_802409438",J_802409438; + "J_195296574",J_195296574; + "J_16189133",J_16189133; + "J_584511898",J_584511898; + "J_98170671",J_98170671; + "J_868828815",J_868828815; + "J_809197575",J_809197575; + "J_73203677",J_73203677; + "J_395086940",J_395086940; + "J_550901847",J_550901847; + "J_559163627",J_559163627; + "J_571492944",J_571492944; + "J_471806843",J_471806843; + "J_610154063",J_610154063; + "J_466112442",J_466112442; + "J_904445624",J_904445624; + "J_241241504",J_241241504; + "J_241241504_1",J_241241504_1; + "J_144820927",J_144820927; + "J_82950290",J_82950290; + "J_938408928",J_938408928; + "J_739415811",J_739415811; + "J_898558502",J_898558502; + "J_413792383",J_413792383; + "J_845282627",J_845282627; + "J_370569407",J_370569407; + "J_339706797",J_339706797; + "J_430633660",J_430633660; + "J_623340094",J_623340094; + "J_27261595",J_27261595; + "J_211740764",J_211740764; + "J_954401688",J_954401688; + "J_563700199",J_563700199; + "J_847997083",J_847997083; + "J_465440863",J_465440863; + "J_875717907",J_875717907; + "J_614510242",J_614510242; + "J_17441891",J_17441891; + "J_58663442",J_58663442; + "J_776139048",J_776139048; + "J_695202082",J_695202082; + "J_974811809",J_974811809; + "J_416984093",J_416984093; + "J_709137309",J_709137309; + "J_889412880",J_889412880; + "J_330814127",J_330814127; + "J_739434119",J_739434119; + "J_353908222",J_353908222; + "J_399226168",J_399226168; + "J_815275408",J_815275408; + "J_349475742",J_349475742; + "J_61701725",J_61701725; + "J_679487679",J_679487679; + "J_178057365",J_178057365; + "J_285829736",J_285829736; + "J_364138508",J_364138508; + "J_217981292",J_217981292; + "J_599117591",J_599117591; + "J_163177561",J_163177561; + "J_225583331",J_225583331; + "J_891900056",J_891900056; + "J_874759621",J_874759621; + "J_756881665",J_756881665; + "J_619846561",J_619846561; + "J_675872124",J_675872124; + "J_498007387",J_498007387; + "J_413387792",J_413387792; + "J_135953363",J_135953363; + "J_324141781",J_324141781; + "J_778150947",J_778150947; + "J_629256313",J_629256313; + "J_917032944",J_917032944; + "J_738318844",J_738318844; + "J_587618947",J_587618947; + "J_346093004",J_346093004; + "J_534566617",J_534566617; + "J_5901405",J_5901405; + "J_40003553",J_40003553; + "J_522528841",J_522528841; + "J_892806084",J_892806084; + "J_554253147",J_554253147; + "J_906566422",J_906566422; + "J_703457064",J_703457064; + "J_175514843",J_175514843; + "J_855677395",J_855677395; + "I_7728905995",I_7728905995; + "I_8421744162",I_8421744162; + "I_2045090718",I_2045090718; + "I_9046001781",I_9046001781; + "I_4075001492",I_4075001492; + "I_8777240900",I_8777240900; + "I_4780480978",I_4780480978; + "I_1520829511",I_1520829511; + "I_6529801070",I_6529801070; + "I_2301260168",I_2301260168; + "I_9580162379",I_9580162379; + "I_2785497175",I_2785497175; + "I_5112922270",I_5112922270; + "I_8586415208",I_8586415208; + "I_1017762470",I_1017762470; + "I_2314721799",I_2314721799; + "I_6318537815",I_6318537815; + "I_6737436637",I_6737436637; + "I_2298281931",I_2298281931; + "I_5127197465",I_5127197465; + "I_7710172071_1",I_7710172071_1; + "I_7710172071_2",I_7710172071_2; + "I_7710172071_3",I_7710172071_3; + "I_7710172071_4",I_7710172071_4; + "I_7710172071_5",I_7710172071_5; + "I_7710172071_6",I_7710172071_6; + "I_7710172071_7",I_7710172071_7; + "I_7710172071_8",I_7710172071_8; + "I_7710172071_9",I_7710172071_9; + "I_7710172071_10",I_7710172071_10; + "I_7710172071_11",I_7710172071_11; + "I_7710172071_12",I_7710172071_12; + "I_1427782443",I_1427782443; + "I_8220246614",I_8220246614; + "I_2333917810",I_2333917810; + "I_6863978831",I_6863978831; + "I_6410186704",I_6410186704; + "I_3008133607",I_3008133607; + "I_5617427593",I_5617427593; + "I_2377396571",I_2377396571; + "I_3656545285",I_3656545285; + "I_8227268739_16",I_8227268739_16; + "I_8227268739_17",I_8227268739_17; + + ] + +end + diff --git a/legacy/inequalities/ocaml_to_sml.ml b/legacy/inequalities/ocaml_to_sml.ml new file mode 100644 index 0000000..e3be540 --- /dev/null +++ b/legacy/inequalities/ocaml_to_sml.ml @@ -0,0 +1,1102 @@ + +(* -------------------------------------------------------------------------- *) +(* Signature *) +(* -------------------------------------------------------------------------- *) + +module type Ocaml_sml = +sig + + type const_name = | Dodec_slope + | Dd_31 + | Dd_32 + | Dd_33 + | Dd_41 + | Dd_42 + | Dd_51 + | Doct + | Dodec_trunc + | Pi + | Ppa1 + | Ppa2 + | Ppd0 + | Ppm + | Ppb + | Ppa + | Ppbc + | Ppc + | Ppd + | Ppsolt0 + | Pt + | Ss_5 + | Sqrt2 + | Sqrt8 + | Square_2t0 + | Sqrt_2t0 + | Square_4t0 + | Tt_0 + | Tt_5 + | Two_dodec_trunc + | Two_dodec_trunc_sq + | Two_t0 + | Xi_gamma + | Xi'_gamma + | Xiv + | Zz_32 + | Zz_33 + | Zz_41 + | Zz_42 + + type func_name = | Anc + | Arclength + | Beta + | Chi_x + | Cross_diag_x + | Crown + | Delta_x + | Dih_x + | Dih2_x + | Dih3_x + | Dihr + | Eta_x + | Gamma_x + | Kappa + | Kx + | Mu_flat_x + | Mu_flipped_x + | Mu_upright_x + | Nu_gamma_x + | Nu_x + | Octa_x + | Octavor0_x + | Octavor_analytic_x + | Omega_x + | Overlap_f + | Quo_x + | Rad2_x + | Sigma1_qrtet_x + | Sigma32_qrtet_x + | Sigma_qrtet_x + | Sigmahat_x + | Sol_x + | Squander_x + | Taua_x + | Tauc0_x + | Tauvt_x + | Tau_0_x + | Tau_analytic_x + | Tau_sigma_x + | Tauhat_x + | Tauhatpi_x + | Taumu_flat_x + | Taunu_x + | Truncated_volume_x + | U_x + | V0x + | V1x + | Volume_x + | Vora_x + | Vorc0_x + | Vorc_x + | Vor_0_x + | Vor_0_x_flipped + | Vor_analytic_x + | Vor_analytic_x_flipped + | Vort_x + + type const = | Decimal of int * int + | Int of int + | Named of const_name + | Sqr of const + | Sqrt of const + | Cos of const + | Acos of const + | Copp of const + | Cplus of const * const + | Cmul of const * const + | Cdiv of const * const + + type expr = | Const of const + | Funcall of func_name * expr list + | Var of string + | Varsqrt of string + | Opp of expr + | Mul of expr * expr + | Div of expr * expr + | Pow of expr * int + | One + + type monom = const * expr + + type lcomb = monom list + + type bounds = {lo : const; + hi : const} + + type ineq = {name : string; + vars : (string * bounds) list; + rels : lcomb list} + + (* + put the hales inequalities in a normal form + + !x_1 ... x_n. ineq [lower_1,x_1,upper_1; + ...; + lower_n,x_n,upper_n] + c_1_1 f_1 + ... + c_1_m f_m < &0 \/ + ... \/ + c_k_1 f_k + ... + c_k_m f_m < &0 + *) + val normalize : Term.term -> Term.term + + + (* Translate HOL Light term to OCaml datatype *) + val translate : string * Term.term -> ineq + + val translate_list : ignore : string list -> + terms : (string * Term.term) list -> ineq list + + (* Print Ocaml datatype as an SML datatype *) + val ineq_to_sml : ineq -> unit + + val ineqs_to_sml : file:string -> ineqs:ineq list -> unit + +end + +(* -------------------------------------------------------------------------- *) +(* Structure *) +(* -------------------------------------------------------------------------- *) + +module Ocaml_sml (* : Ocaml_sml *) = +struct + + type const_name = | Dodec_slope + | Dd_31 + | Dd_32 + | Dd_33 + | Dd_41 + | Dd_42 + | Dd_51 + | Doct + | Dodec_trunc + | Pi + | Ppa1 + | Ppa2 + | Ppd0 + | Ppm + | Ppb + | Ppa + | Ppbc + | Ppc + | Ppd + | Ppsolt0 + | Pt + | Ss_5 + | Sqrt2 + | Sqrt8 + | Square_2t0 + | Sqrt_2t0 + | Square_4t0 + | Tt_0 + | Tt_5 + | Two_dodec_trunc + | Two_dodec_trunc_sq + | Two_t0 + | Xi_gamma + | Xi'_gamma + | Xiv + | Zz_32 + | Zz_33 + | Zz_41 + | Zz_42 + + type func_name = | Anc + | Arclength + | Beta + | Chi_x + | Cross_diag_x + | Crown + | Delta_x + | Dih_x + | Dih2_x + | Dih3_x + | Dihr + | Eta_x + | Gamma_x + | Kappa + | Kx + | Mu_flat_x + | Mu_flipped_x + | Mu_upright_x + | Nu_gamma_x + | Nu_x + | Octa_x + | Octavor0_x + | Octavor_analytic_x + | Omega_x + | Overlap_f + | Quo_x + | Rad2_x + | Sigma1_qrtet_x + | Sigma32_qrtet_x + | Sigma_qrtet_x + | Sigmahat_x + | Sol_x + | Squander_x + | Taua_x + | Tauc0_x + | Tauvt_x + | Tau_0_x + | Tau_analytic_x + | Tau_sigma_x + | Tauhat_x + | Tauhatpi_x + | Taumu_flat_x + | Taunu_x + | Truncated_volume_x + | U_x + | V0x + | V1x + | Volume_x + | Vora_x + | Vorc0_x + | Vorc_x + | Vor_0_x + | Vor_0_x_flipped + | Vor_analytic_x + | Vor_analytic_x_flipped + | Vort_x + + type const = | Decimal of int * int + | Int of int + | Named of const_name + | Sqr of const + | Sqrt of const + | Cos of const + | Acos of const + | Copp of const + | Cplus of const * const + | Cmul of const * const + | Cdiv of const * const + + type expr = | Const of const + | Funcall of func_name * expr list + | Var of string + | Varsqrt of string + | Opp of expr + | Mul of expr * expr + | Div of expr * expr + | Pow of expr * int + | One + + type monom = const * expr + + type lcomb = monom list + + type bounds = {lo : const; + hi : const} + + type ineq = {name : string; + vars : (string * bounds) list; + rels : lcomb list} + + (* -------------------------------------------------------------------------- *) + (* Util *) + (* -------------------------------------------------------------------------- *) + + (* remove "kepler'" from the front of a name *) + let unkepler s = + try + let kep = String.sub s 0 7 in + if kep = "kepler'" then String.sub s 7 (String.length s - 7) + else s + with Invalid_argument _ -> s + + let const_of_string const = match const with + | "D31" -> Dd_31 + | "D32" -> Dd_32 + | "D33" -> Dd_33 + | "D41" -> Dd_41 + | "D42" -> Dd_42 + | "D51" -> Dd_51 + | "dodecSlope" -> Dodec_slope + | "dodecTrunc" -> Dodec_trunc + | "Z32" -> Zz_32 + | "Z33" -> Zz_33 + | "Z41" -> Zz_41 + | "Z42" -> Zz_42 + | "doct" -> Doct + | "pi" -> Pi + | "pp_a1" -> Ppa1 + | "pp_a2" -> Ppa2 + | "pp_d0" -> Ppd0 + | "pp_m" -> Ppm + | "pp_b" -> Ppb + | "pp_a" -> Ppa + | "pp_bc" -> Ppbc + | "pp_c" -> Ppc + | "pp_d" -> Ppd + | "pp_solt0" -> Ppsolt0 + | "pt" -> Pt + | "s5" -> Ss_5 + | "sqrt2" -> Sqrt2 + | "sqrt8" -> Sqrt8 + | "sqrt_2t0" -> Sqrt_2t0 + | "square_2t0" -> Square_2t0 + | "square_4t0" -> Square_4t0 + | "t0" -> Tt_0 + | "t5" -> Tt_5 + | "two_t0" -> Two_t0 + | "twoDodecTrunc" -> Two_dodec_trunc + | "twoDodecTruncSq" -> Two_dodec_trunc_sq + | "xi_gamma" -> Xi_gamma + | "xi'_gamma" -> Xi'_gamma + | "xiV" -> Xiv + | _ -> failwith ("not a constant: " ^ const) + + let const_of_string = const_of_string o unkepler + + let const_to_string const = match const with + | Dd_31 -> "D31" + | Dd_32 -> "D32" + | Dd_33 -> "D33" + | Dd_41 -> "D41" + | Dd_42 -> "D42" + | Dd_51 -> "D51" + | Dodec_slope -> "DodecSlope" + | Dodec_trunc -> "DodecTrunc" + | Zz_32 -> "Z32" + | Zz_33 -> "Z33" + | Zz_41 -> "Z41" + | Zz_42 -> "Z42" + | Doct -> "Doct" + | Pi -> "Pi" + | Ppa1 -> "Ppa1" + | Ppa2 -> "Ppa2" + | Ppd0 -> "Ppd0" + | Ppm -> "Ppm" + | Ppb -> "Ppb" + | Ppa -> "Ppa" + | Ppbc -> "Ppbc" + | Ppc -> "Ppc" + | Ppd -> "Ppd" + | Ppsolt0 -> "Ppsolt0" + | Pt -> "Pt" + | Ss_5 -> "S5" + | Sqrt2 -> "Sqrt2" + | Sqrt8 -> "Sqrt8" + | Sqrt_2t0 -> "Sqrt2t0" + | Square_2t0 -> "Square2t0" + | Square_4t0 -> "Square4t0" + | Tt_0 -> "T0" + | Tt_5 -> "T5" + | Two_dodec_trunc -> "TwoDodecTrunc" + | Two_dodec_trunc_sq -> "TwoDodecTruncSq" + | Two_t0 -> "TwoT0" + | Xi_gamma -> "XiGamma" + | Xi'_gamma -> "Xi'Gamma" + | XiV -> "XiV" + + let func_of_string func = match func with + | "anc" -> Anc + | "arclength" -> Arclength + | "beta" -> Beta + | "chi_x" -> Chi_x + | "cross_diag_x" -> Cross_diag_x + | "crown" -> Crown + | "delta_x" -> Delta_x + | "dih2_x" -> Dih2_x + | "dih3_x" -> Dih3_x + | "dihR" -> Dihr + | "dih_x" -> Dih_x + | "eta_x" -> Eta_x + | "gamma_x" -> Gamma_x + | "kappa" -> Kappa + | "KX" -> Kx + | "mu_flat_x" -> Mu_flat_x + | "mu_flipped_x" -> Mu_flipped_x + | "mu_upright_x" -> Mu_upright_x + | "nu_gamma_x" -> Nu_gamma_x + | "nu_x" -> Nu_x + | "octa_x" -> Octa_x + | "octavor0_x" -> Octavor0_x + | "octavor_analytic_x" -> Octavor_analytic_x + | "omega_x" -> Omega_x + | "overlap_f" -> Overlap_f + | "quo_x" -> Quo_x + | "rad2_x" -> Rad2_x + | "sigma1_qrtet_x" -> Sigma1_qrtet_x + | "sigma32_qrtet_x" -> Sigma32_qrtet_x + | "sigma_qrtet_x" -> Sigma_qrtet_x + | "sigmahat_x" -> Sigmahat_x + | "sol_x" -> Sol_x + | "squander_x" -> Squander_x + | "tauA_x" -> Taua_x + | "tauC0_x" -> Tauc0_x + | "tauVt_x" -> Tauvt_x + | "tau_0_x" -> Tau_0_x + | "tau_analytic_x" -> Tau_analytic_x + | "tau_sigma_x" -> Tau_sigma_x + | "tauhat_x" -> Tauhat_x + | "tauhatpi_x" -> Tauhatpi_x + | "taumu_flat_x" -> Taumu_flat_x + | "taunu_x" -> Taunu_x + | "truncated_volume_x" -> Truncated_volume_x + | "u_x" -> U_x + | "v0x" -> V0x + | "v1x" -> V1x + | "volume_x" -> Volume_x + | "vorA_x" -> Vora_x + | "vorC0_x" -> Vorc0_x + | "vorC_x" -> Vorc_x + | "vor_0_x" -> Vor_0_x + | "vor_0_x_flipped" -> Vor_0_x_flipped + | "vor_analytic_x" -> Vor_analytic_x + | "vor_analytic_x_flipped" -> Vor_analytic_x_flipped + | "vort_x" -> Vort_x + | _ -> failwith ("no such const: " ^ func) + + let func_of_string = func_of_string o unkepler + + let func_to_string func = match func with + | Anc -> "Anc" + | Arclength -> "Arclength" + | Beta -> "Beta" + | Chi_x -> "ChiX" + | Cross_diag_x -> "CrossDiagX" + | Crown -> "Crown" + | Delta_x -> "DeltaX" + | Dih2_x -> "Dih2X" + | Dih3_x -> "Dih3X" + | Dihr -> "Dihr" + | Dih_x -> "DihX" + | Eta_x -> "EtaX" + | Gamma_x -> "GammaX" + | Kappa -> "Kappa" + | Kx -> "Kx" + | Mu_flat_x -> "MuFlatX" + | Mu_flipped_x -> "MuFlippedX" + | Mu_upright_x -> "MuUprightX" + | Nu_gamma_x -> "NuGammaX" + | Nu_x -> "NuX" + | Octa_x -> "OctaX" + | Octavor0_x -> "Octavor0X" + | Octavor_analytic_x -> "OctavorAnalyticX" + | Omega_x -> "OmegaX" + | Overlap_f -> "OverlapF" + | Quo_x -> "QuoX" + | Rad2_x -> "Rad2X" + | Sigma1_qrtet_x -> "Sigma1QrtetX" + | Sigma32_qrtet_x -> "Sigma32QrtetX" + | Sigma_qrtet_x -> "SigmaQrtetX" + | Sigmahat_x -> "SigmahatX" + | Sol_x -> "SolX" + | Squander_x -> "SquanderX" + | Taua_x -> "TauaX" + | Tauc0_x -> "Tauc0X" + | Tauvt_x -> "TauvtX" + | Tau_0_x -> "Tau0X" + | Tau_analytic_x -> "TauAnalyticX" + | Tau_sigma_x -> "TauSigmaX" + | Tauhat_x -> "TauhatX" + | Tauhatpi_x -> "TauhatpiX" + | Taumu_flat_x -> "TaumuFlatX" + | Taunu_x -> "TaunuX" + | Truncated_volume_x -> "TruncatedVolumeX" + | U_x -> "UX" + | V0x -> "V0x" + | V1x -> "V1x" + | Volume_x -> "VolumeX" + | Vora_x -> "VoraX" + | Vorc0_x -> "Vorc0X" + | Vorc_x -> "VorcX" + | Vor_0_x -> "Vor0X" + | Vor_0_x_flipped -> "Vor0XFlipped" + | Vor_analytic_x -> "VorAnalyticX" + | Vor_analytic_x_flipped -> "VorAnalyticXFlipped" + | Vort_x -> "VortX" + + let var_to_string v = fst (dest_var v) + let dest_add t = try Some (dest_binop `(+.)` t) with _ -> None + let dest_sub t = try Some (dest_binop `(-.)` t) with _ -> None + let dest_mul t = try Some (dest_binop `( *. )` t) with _ -> None + let dest_div t = try Some (dest_binop `( / )` t) with _ -> None + + (* -------------------------------------------------------------------------- *) + (* Translation *) + (* -------------------------------------------------------------------------- *) + + (* `#1.35` *) + let translate_decimal t : const option = + try + let dec,numden = strip_comb t in + let num,den = match numden with [num;den] -> num,den | _ -> failwith "" in + if dec = `DECIMAL` then + match dest_numeral num,dest_numeral den with + Num.Int num', Num.Int den' -> Some (Decimal (num',den')) + | _ -> failwith "" + else None + with _ -> None + + (* `&5` *) + let translate_rint t : const option = + try + let amp,n = dest_comb t in + if amp = `&.` then + match dest_numeral n with + Num.Int n' -> Some (Int n') + | _ -> None + else None + with _ -> None + + (* `5` *) + let translate_int t : int option = + try + match dest_numeral t with + Num.Int n' -> Some n' + | _ -> None + with _ -> None + + (* `square_2t0` *) + let translate_named t : const option = + try + let c,_ = dest_const t in + Some (Named (const_of_string c)) + with _ -> None + + let rec translate_const t : const option = + match translate_decimal t with + Some _ as c -> c + | None -> + match translate_rint t with + Some _ as c -> c + | None -> + match translate_named t with + Some _ as c -> c + | None -> + match translate_cos t with + Some _ as c -> c + | None -> + match translate_acos t with + Some _ as c -> c + | None -> + match translate_sqr t with + Some _ as c -> c + | None -> + match translate_sqrt t with + Some _ as c -> c + | None -> + match translate_copp t with + Some _ as c -> c + | None -> + match translate_cplus t with + Some _ as c -> c + | None -> + match translate_cmul t with + Some _ as c -> c + | None -> + match translate_cdiv t with + Some _ as c -> c + | None -> None + + and translate_unop p con t : const option = + try + let p',c = dest_comb t in + if p = p' then + match translate_const c with + Some c -> Some (con c) + | None -> None + else + None + with _ -> None + + and translate_binop p con t : const option = + try + let l,r = dest_binop p t in + match translate_const l,translate_const r with + Some l', Some r' -> Some (con(l',r')) + | _ -> None + with _ -> None + + and translate_cos t = translate_unop `cos` (fun x -> Cos x) t + and translate_acos t = translate_unop `acs` (fun x -> Acos x) t + and translate_sqr t = translate_unop `square` (fun x -> Sqr x) t + and translate_sqrt t = translate_unop `sqrt` (fun x -> Sqrt x) t + and translate_copp t = translate_unop `(--.)` (fun x -> Copp x) t + and translate_cplus t = translate_binop `(+.)` (fun x,y -> Cplus (x,y)) t + and translate_cmul t = translate_binop `( *. )` (fun x,y -> Cmul (x,y)) t + and translate_cdiv t = translate_binop `( / )` (fun x,y -> Cdiv (x,y)) t + + let translate_var t = + if is_var t then Some (Var (fst (dest_var t))) else None + + let translate_varsqrt t = + try + let sqrt,x = dest_comb t in + if sqrt = `sqrt` && is_var x then + Some (Varsqrt (fst (dest_var x))) + else None + with _ -> None + + let rec translate_expr t : expr option = + match translate_const t with + Some c -> Some (Const c) + | None -> + match translate_funcall t with + Some _ as c -> c + | None -> + match translate_varsqrt t with + Some _ as c -> c + | None -> + match translate_var t with + Some _ as c -> c + | None -> + match translate_opp t with + Some _ as c -> c + | None -> + match translate_mul t with + Some _ as c -> c + | None -> + match translate_div t with + Some _ as c -> c + | None -> + match translate_pow t with + Some _ as c -> c + | None -> failwith "translate_expr" + + and translate_funcall t = + try + let f,xs = strip_comb t in + let func_str,_ = dest_const f in + let func = func_of_string func_str in + let xs' = map (fun x -> match translate_expr x with Some e -> e | None -> failwith "") xs in + Some (Funcall(func,xs')) + with _ -> None + + and translate_unop p con t : expr option = + try + let p',c = dest_comb t in + if p = p' then + match translate_expr c with + Some c -> Some (con c) + | None -> None + else + None + with _ -> None + + and translate_binop p con t : expr option = + try + let l,r = dest_binop p t in + match translate_expr l,translate_expr r with + Some l', Some r' -> Some (con(l',r')) + | _ -> None + with _ -> None + + and translate_opp t = translate_unop `(--.)` (fun x -> Opp x) t + and translate_mul t = translate_binop `( *. )` (fun x,y -> Mul (x,y)) t + and translate_div t = translate_binop `( / )` (fun x,y -> Div (x,y)) t + and translate_pow t = + try + let f,[x;n] = strip_comb t in + if not(f = `((pow):real->num->real)`) then None else + let Some x' = translate_expr x in + let Some n' = translate_int n in + Some (Pow(x',n')) + with _ -> None + + let translate_monom t : monom option = + match translate_const t with + Some x -> Some (x,One) + | None -> + match dest_mul t with + Some (c,e) -> + (match translate_const c, translate_expr e with + Some c', Some e' -> Some (c',e') + | _ -> match translate_expr t with + Some e -> Some (Int 1,e) + | None -> None) + | None -> + match translate_expr t with + Some e -> Some (Int 1,e) + | None -> None;; + + let rec translate_lcomb t = + match dest_add t with + Some (l,r) -> + (match translate_lcomb l ,translate_lcomb r with + Some l', Some r' -> Some (l' @ r') + | _ -> None) + | None -> + match translate_monom t with + Some m -> Some [m] + | None -> None + + let translate_rel t = + try + let lcomb,zero = dest_binop `(<.)` t in + let _ = if zero <> `(&0)` then failwith "not zero" else () in + translate_lcomb lcomb + with _ -> failwith "translate_rel" + + let translate_ineq t = + try + let _,body = strip_forall t in + let ineq_tm,bounds_rel = strip_comb body in + let bounds,rel = match bounds_rel with [bounds;rel] -> bounds,rel | _ -> failwith "" in + let ineqs = disjuncts rel in + let map_fn q = match translate_rel q with Some l -> l | None -> failwith "" in + let ineqs = map map_fn ineqs in + let dest_trip xyz = + let x,yz = dest_pair xyz in + let x = match translate_const x with Some x -> x | None -> failwith "" in + let y,z = dest_pair yz in + let y,_ = dest_var y in + let z = match translate_const z with Some x -> x | None -> failwith "" in + y,{lo = x; hi = z} in + let bounds' = map dest_trip (dest_list bounds) in + (bounds',ineqs) + with _ -> failwith "translate_ineq" + + (* -------------------------------------------------------------------------- *) + (* Normalize *) + (* -------------------------------------------------------------------------- *) + + let normalize = + let thms = [ + REAL_ARITH `x *. (y + z) = x * y + x * z`; + REAL_ARITH `(x +. y) * z = z * x + z * y`; + REAL_ARITH `&0 *. x = &0`; + REAL_ARITH `x * -- y = -- x * y`; + REAL_ARITH `(x -. y) = x + (-- y)`; + REAL_ARITH `(x +. y) + z = x + y + z`; + REAL_ARITH `--. (x * y) = (--. x) * y`; + REAL_ARITH `-- #0.0 = &0`; + REAL_ARITH `-- &0 = &0`; + REAL_ARITH `x + &0 = x`; + REAL_ARITH `&0 + x = x`; + REAL_ARITH `--. (x + y) = (--. x) + (-- y)`; + REAL_ARITH `--. (-- x) = x`; + REAL_ARITH `!f:real->real->real->real->real->real->real. (-- (f x1 x2 x3 x4 x5 x6)) = (-- (&1) *. (f x1 x2 x3 x4 x5 x6))`; + MESON [] `(a \/ (b \/ c)) = (a \/ b \/ c)`; + pi_prime_tau; + pi_prime_sigma; + LET_DEF; + LET_END_DEF; + ] in + let once_thms = [ + REAL_ARITH `!x y z:real. (x < y) = x - y < &0`; + REAL_ARITH `!x y z:real. (x > y) = y - x < &0`; + ] in + fun x -> + snd (dest_eq (concl ( + (DEPTH_CONV BETA_CONV THENC + ONCE_REWRITE_CONV once_thms THENC + REWRITE_CONV thms THENC + NUM_REDUCE_CONV) x))) + + let translate (name,q) = + let _ = print_endline ("translating ineq: " ^ name) in + let bounds,rels = translate_ineq (normalize q) in + {name = name; + vars = bounds; + rels = rels} + + let translate_list ~ignore ~terms = + map translate (List.filter (fun x,_ -> not (mem x ignore)) terms) + + (* -------------------------------------------------------------------------- *) + (* Pretty Printing *) + (* -------------------------------------------------------------------------- *) + + open Format + + let pp_int n = + begin + open_hbox (); + print_string (string_of_int n); + close_box (); + end + + let pp_pair f (l,r) = + begin + open_hbox(); + print_string "(";f l;print_string ",";f r;print_string ")"; + close_box(); + end + + let separate = + let rec separate x l str = match l with + | [] -> List.rev str + | [h] -> List.rev (h::str) + | h::h'::t -> separate x (h'::t) (x::h::str) in + fun x l -> separate x l [] + + let rec iter_butlast f l = match l with + | [] | [_] -> () + | h::t -> (f h;iter_butlast f t) + + let rec last l = match l with + | [] -> failwith "" + | [h] -> h + | _::t -> last t + + let pp_list_horiz f l = if l = [] then print_string "[]" else + begin + open_hbox(); + print_string "["; + iter_butlast (fun x -> (f x; print_string ", ")) l; + f (last l); + print_string "]"; + close_box(); + end + + let pp_list_vert f l = if l = [] then print_string "[]" else + begin + open_vbox 1; + print_string "["; + iter_butlast (fun x -> (f x; print_string ",";print_cut())) l; + f (last l); + print_string "]"; + close_box(); + end + + let pp_unop p s c = + begin + open_hbox(); + print_string s; + print_string "("; + p c; + print_string ")"; + close_box(); + end + + let pp_binop p1 p2 s c1 c2 = + begin + open_hbox(); + print_string s; + print_string "("; + p1 c1; + print_string ","; + p2 c2; + print_string ")"; + close_box(); + end + + let pp_decimal (x,y) = + begin + open_hbox(); + print_string "Decimal"; + pp_pair pp_int (x,y); + close_box(); + end + + let pp_named n = print_string (const_to_string n) + + let rec pp_const c = match c with + | Decimal (x,y) -> pp_decimal(x,y) + | Int n -> (print_string "Int "; pp_int n) + | Named n -> (print_string "Named ";pp_named n) + | Cos c -> pp_cos c + | Acos c -> pp_acos c + | Sqr c -> pp_sqr c + | Sqrt c -> pp_sqrt c + | Copp c -> pp_copp c + | Cplus (x,y) -> pp_cplus x y + | Cmul (x,y) -> pp_cmul x y + | Cdiv (x,y) -> pp_cdiv x y + + and pp_cos c = pp_unop pp_const "Cos" c + and pp_acos c = pp_unop pp_const "Acos" c + and pp_sqr c = pp_unop pp_const "Sqr" c + and pp_sqrt c = pp_unop pp_const "Sqrt" c + and pp_copp c = pp_unop pp_const "Copp" c + and pp_cplus c1 c2 = pp_binop pp_const pp_const "Cplus" c1 c2 + and pp_cmul c1 c2 = pp_binop pp_const pp_const "Cmul" c1 c2 + and pp_cdiv c1 c2 = pp_binop pp_const pp_const "Cdiv" c1 c2 + + let rec pp_expr e = match e with + | Const c -> (print_string "Const (";pp_const c;print_string ")") + | Funcall (f,xs) -> pp_funcall f xs + | Var v -> pp_var v + | Varsqrt v -> pp_varsqrt v + | Opp e -> pp_opp e + | Mul(x,y) -> pp_mul x y + | Div(x,y) -> pp_div x y + | Pow(x,n) -> pp_pow x n + | One -> print_string "One" + + and pp_funcall f xs = + begin + open_hbox(); + print_string "Funcall("; + print_string (func_to_string f); + print_string ", "; + pp_list_horiz pp_expr xs; + print_string ")"; + close_box(); + end + + and pp_var v = print_string ("Var \"" ^ v ^ "\"") + and pp_varsqrt v = print_string ("Varsqrt \"" ^ v ^ "\"") + and pp_opp e = pp_unop pp_expr "Opp" e + and pp_mul e1 e2 = pp_binop pp_expr pp_expr "Mul" e1 e2 + and pp_div e1 e2 = pp_binop pp_expr pp_expr "Div" e1 e2 + and pp_pow e1 e2 = pp_binop pp_expr pp_int "Pow" e1 e2 + + let pp_monom (c,e) = + begin + open_hbox(); + print_string "("; + pp_const c; + print_string ","; + pp_expr e; + print_string ")"; + close_box(); + end + + let pp_lcomb l = pp_list_horiz pp_monom l + + let pp_bounds (v, {lo=lo;hi=hi}) = + begin + open_vbox 1; + print_string ("(\"" ^ v ^ "\","); + print_cut(); + open_hbox(); + print_string "{lo = "; + pp_const lo; + close_box(); + print_string ","; + print_cut(); + open_hbox(); + print_string " hi = "; + pp_const hi; + print_string "})"; + close_box(); + close_box(); + end + + let ineq_to_sml q = + begin + open_vbox 1; + print_string "{"; + print_string "name = \""; + print_string q.name; + print_string "\","; + print_cut(); + print_cut(); + print_string "vars = "; + pp_list_vert pp_bounds q.vars; + print_string ","; + print_cut(); + print_cut(); + print_string "rels = "; + pp_list_vert pp_lcomb q.rels; + print_string "}"; + close_box(); + end + + let ineqs_to_sml qs = + let doit q = + begin + ineq_to_sml q; + print_string ","; + print_cut(); + print_cut(); + end in + begin + open_vbox 4; + print_cut(); + iter_butlast doit qs; + ineq_to_sml (last qs); + close_box(); + end + + let header univ = +" +(*============================================================================*) +(* THIS FILE IS AUTOGENERATED. DO NOT EDIT!!! *) +(*============================================================================*) + +structure " ^ univ ^ "InequalitySyntaxBase:> INEQUALITY_SYNTAX_BASE = +struct + +open FunctionUtil +open InequalityUtil + +val unexpandedIneqs = [ +" + + let footer = +" +] + +end" + + let ineqs_to_sml ~file ~ineqs ~univ = + let chan = open_out file in + try + set_formatter_out_channel chan; + print_string (header univ); + ineqs_to_sml ineqs; + print_string footer; + set_formatter_out_channel stdout; + close_out chan; + with exn -> + set_formatter_out_channel stdout; + close_out chan; + raise exn + +end + +(* + +needs "Examples/analysis.ml";; +needs "Examples/transc.ml";; +needs "Jordan/lib_ext.ml";; +needs "Jordan/parse_ext_override_interface.ml";; +unambiguous_interface();; + +#use "../../kepler/sml/inequalities/holl/definitions_kepler.ml";; +#use "../../kepler/sml/inequalities/holl/kep_inequalities.ml";; +#use "../../kepler/sml/inequalities/holl/ineq_names.ml";; +#use "../../kepler/sml/inequalities/holl/ocaml_to_sml.ml";; +let ocaml_ineqs = Ocaml_sml.translate_list ~ignore:Ineq_names.ignore ~terms:Ineq_names.ineqs;; + +Ocaml_sml.ineqs_to_sml + ~file:"/Users/seanmcl/save/versioned/projects/kepler/sml/inequalities/inequality-syntax.sml" + ~ineqs:ocaml_ineqs;; + +let file = "/Users/seanmcl/save/versioned/projects/kepler/sml/inequalities/inequality-syntax.sml" + +let q = List.nth ocaml_ineqs 0;; +(print_endline ""; Ocaml_sml.ineq_to_sml q; print_endline "";) + + let t = Ocaml_sml.normalize x;; + Ocaml_sml.translate_ineq t + + + #trace Ocaml_sml.;; + #trace Ocaml_sml.normalize;; + #trace Ocaml_sml.translate_const;; + #trace Ocaml_sml.translate_cdiv;; + #trace Ocaml_sml.translate_expr;; + #trace Ocaml_sml.translate_funcall;; + #trace Ocaml_sml.translate_div;; + #trace Ocaml_sml.translate_monom;; + #trace Ocaml_sml.translate_lcomb;; + #trace Ocaml_sml.translate_rel;; + #trace Ocaml_sml.translate_ineq;; + #trace Ocaml_sml.translate_pow;; + #trace Ocaml_sml.translate;; + + #untrace_all;; + + let x = I_327474205_1 + Ocaml_sml.translate_ineq (Ocaml_sml.normalize x) + Ocaml_sml.normalize I_327474205_1 + + translate_ineq I_867513567_13 + let t = `tau_sigma_x x1 x2 x3 x4 x5 x6 -. #0.2529 *. dih_x x1 x2 x3 x4 x5 x6 >. + --. #0.3442` + + + *) diff --git a/legacy/inequalities/sigmahat.hl b/legacy/inequalities/sigmahat.hl new file mode 100644 index 0000000..0cbf21e --- /dev/null +++ b/legacy/inequalities/sigmahat.hl @@ -0,0 +1,61 @@ + + +let max_real_symm = prove_by_refinement( + `!a b. max_real a b = max_real b a`, + [ + REP_GEN_TAC; + REWRITE_TAC[max_real]; + COND_CASES_TAC; + USE 0 (MATCH_MP (REAL_ARITH `a < b ==> ~(b < a)`)); + ASM_REWRITE_TAC[]; + COND_CASES_TAC; + ASM_REWRITE_TAC[]; + UND 0; + UND 1; + REAL_ARITH_TAC; + ]);; + + +let SIGMAHAT_EQ = prove( + `!x1 x2 x3 x4 x5 x6. sigmahat_x x1 x2 x3 x4 x5 x6 = sigmahat_x' x1 x2 x3 x4 x5 x6`, + REPEAT STRIP_TAC THEN + REWRITE_TAC [sigmahat_x';sigmahat_x] THEN + LET_TAC THEN + LET_TAC THEN + LET_TAC THEN + LET_TAC THEN + LET_TAC THEN + LET_TAC THEN + LET_TAC THEN + LET_TAC THEN + LET_TAC THEN + COND_CASES_TAC THEN + REWRITE_TAC[] + LET_TAC THEN + COND_CASES_TAC THEN REWRITE_TAC[] THEN + COND_CASES_TAC THEN REWRITE_TAC[] THEN + LET_TAC THEN + COND_CASES_TAC THEN REWRITE_TAC[] THEN + LET_TAC THEN + COND_CASES_TAC THEN REWRITE_TAC[] THEN + LET_TAC THEN + COND_CASES_TAC THEN REWRITE_TAC[] THEN + LET_TAC THEN + REWRITE_ALL_TAC[] + ONCE_REWRITE_TAC[MAX_REAL_SYMM] + + +let TEST = prove(`!x:bool. x = x`, + STRIP_TAC THEN + REWRITE_TAC []);; + + + +(program-get-line) let x = 5 + + +e (REPEAT STRIP_TAC) +e (REWRITE_TAC[sigmahat_sean_x;sigmahat_x;LET_DEF;LET_END_DEF]) +e (REPEAT COND_CASES_TAC THEN REWRITE_TAC[]) +e (MESON_TAC[]) + diff --git a/legacy/inequalities/sphere.ml b/legacy/inequalities/sphere.ml new file mode 100644 index 0000000..36960c6 --- /dev/null +++ b/legacy/inequalities/sphere.ml @@ -0,0 +1,526 @@ +(* +2009 definitions. + + +*) + +let atn2 = new_definition(`atn2(x,y) = + if ( abs y < x ) then atn(y / x) else + (if (&0 < y) then ((pi / &2) - atn(x / y)) else + (if (y < &0) then (-- (pi/ &2) - atn (x / y)) else ( pi )))`);; + +(* ------------------------------------------------------------------ *) + +let sqrt8 = new_definition (`sqrt8 = sqrt (&8) `);; +let sqrt2 = new_definition (`sqrt2 = sqrt (&2) `);; + +let pi_rt18 = new_definition(`pi_rt18= pi/(sqrt (&18))`);; + + +(* ------------------------------------------------------------------ *) +(* This polynomial is essentially the Cayley-Menger determinant. *) +(* ------------------------------------------------------------------ *) +let delta_x = kepler_def (`delta_x x1 x2 x3 x4 x5 x6 = + x1*x4*(--x1 + x2 + x3 -x4 + x5 + x6) + + x2*x5*(x1 - x2 + x3 + x4 -x5 + x6) + + x3*x6*(x1 + x2 - x3 + x4 + x5 - x6) + -x2*x3*x4 - x1*x3*x5 - x1*x2*x6 -x4*x5*x6`);; + +(* ------------------------------------------------------------------ *) +(* The partial derivative of delta_x with respect to x4. *) +(* ------------------------------------------------------------------ *) + +let delta_x4 = kepler_def(`delta_x4 x1 x2 x3 x4 x5 x6 + = -- x2* x3 - x1* x4 + x2* x5 + + x3* x6 - x5* x6 + x1* (-- x1 + x2 + x3 - x4 + x5 + x6)`);; + +let delta_x6 = kepler_def(`delta_x6 x1 x2 x3 x4 x5 x6 + = -- x1 * x2 - x3*x6 + x1 * x4 + + x2* x5 - x4* x5 + x3*(-- x3 + x1 + x2 - x6 + x4 + x5)`);; + +(* ------------------------------------------------------------------ *) +(* Circumradius . *) +(* ------------------------------------------------------------------ *) + +(* same as ups_x +let u_x = kepler_def( + `u_x x1 x2 x3 = (--(x1*x1+x2*x2+x3*x3)) + + (&2) * (x1*x2+x2*x3+x3*x1)`);; +*) + +let ups_x = kepler_def(`ups_x x1 x2 x6 = + --x1*x1 - x2*x2 - x6*x6 + + &2 *x1*x6 + &2 *x1*x2 + &2 *x2*x6`);; + + +let eta_x = kepler_def(`eta_x x1 x2 x3 = + (sqrt ((x1*x2*x3)/(ups_x x1 x2 x3))) + `);; + +let eta_y = kepler_def(`eta_y y1 y2 y3 = + let x1 = y1*y1 in + let x2 = y2*y2 in + let x3 = y3*y3 in + eta_x x1 x2 x3`);; + +let rho_x = kepler_def(`rho_x x1 x2 x3 x4 x5 x6 = + --x1*x1*x4*x4 - x2*x2*x5*x5 - x3*x3*x6*x6 + + (&2)*x1*x2*x4*x5 + (&2)*x1*x3*x4*x6 + (&2)*x2*x3*x5*x6`);; + +let rad2_y = kepler_def(`rad2_y y1 y2 y3 y4 y5 y6 = + let (x1,x2,x3,x4,x5,x6)= (y1*y1,y2*y2,y3*y3,y4*y4,y5*y5,y6*y6) in + (rho_x x1 x2 x3 x4 x5 x6)/((delta_x x1 x2 x3 x4 x5 x6)*(&4))`);; + + +let chi_x = kepler_def(`chi_x x1 x2 x3 x4 x5 x6 + = -- (x1*x4*x4) + x1*x4*x5 + x2*x4*x5 - x2*x5*x5 + + x1*x4*x6 + x3*x4*x6 + + x2*x5*x6 + x3*x5*x6 - (&2) * x4*x5*x6 - x3*x6*x6`);; + + + +(* ------------------------------------------------------------------ *) +(* The formula for the dihedral angle of a simplex. *) +(* The variables xi are the squares of the lengths of the edges. *) +(* The angle is computed along the first edge (x1). *) +(* ------------------------------------------------------------------ *) + +let dih_x = kepler_def(`dih_x x1 x2 x3 x4 x5 x6 = + let d_x4 = delta_x4 x1 x2 x3 x4 x5 x6 in + let d = delta_x x1 x2 x3 x4 x5 x6 in + pi/ (&2) + atn2( (sqrt ((&4) * x1 * d)),-- d_x4)`);; + + +let dih_y = kepler_def(`dih_y y1 y2 y3 y4 y5 y6 = + let (x1,x2,x3,x4,x5,x6)= (y1*y1,y2*y2,y3*y3,y4*y4,y5*y5,y6*y6) in + dih_x x1 x2 x3 x4 x5 x6`);; + +let dih2_y = kepler_def(`dih2_y y1 y2 y3 y4 y5 y6 = + dih_y y2 y1 y3 y5 y4 y6`);; + +let dih3_y = kepler_def(`dih3_y y1 y2 y3 y4 y5 y6 = + dih_y y3 y1 y2 y6 y4 y5`);; + +let dih2_x = kepler_def(`dih2_x x1 x2 x3 x4 x5 x6 = + dih_x x2 x1 x3 x5 x4 x6`);; + +let dih3_x = kepler_def(`dih3_x x1 x2 x3 x4 x5 x6 = + dih_x x3 x1 x2 x6 x4 x5`);; + + +(* ------------------------------------------------------------------ *) +(* Harriot-Euler formula for the area of a spherical triangle *) +(* in terms of the angles: area = alpha+beta+gamma - pi *) +(* ------------------------------------------------------------------ *) + +let sol_x = kepler_def(`sol_x x1 x2 x3 x4 x5 x6 = + (dih_x x1 x2 x3 x4 x5 x6) + + (dih_x x2 x3 x1 x5 x6 x4) + (dih_x x3 x1 x2 x6 x4 x5) - pi`);; + +let sol_y = kepler_def(`sol_y y1 y2 y3 y4 y5 y6 = + (dih_y y1 y2 y3 y4 y5 y6) + + (dih_y y2 y3 y1 y5 y6 y4) + (dih_y y3 y1 y2 y6 y4 y5) - pi`);; + + +(* ------------------------------------------------------------------ *) +(* The Cayley-Menger formula for the volume of a simplex *) +(* The variables xi are the squares of the lengths of the edges. *) +(* ------------------------------------------------------------------ *) + +let vol_x = kepler_def(`vol_x x1 x2 x3 x4 x5 x6 = + (sqrt (delta_x x1 x2 x3 x4 x5 x6))/ (&12)`);; + +(* ------------------------------------------------------------------ *) +(* Some lower dimensional funcions and Rogers simplices. *) +(* ------------------------------------------------------------------ *) + +let arclength = kepler_def(`arclength a b c = + pi/(&2) + (atn2( (sqrt (ups_x (a*a) (b*b) (c*c))),(c*c - a*a -b*b)))`);; + + +let volR = kepler_def(`volR a b c = + (sqrt (a*a*(b*b-a*a)*(c*c-b*b)))/(&6)`);; + +let solR = kepler_def(`solR a b c = + (&2)*atn2( sqrt(((c+b)*(b+a))), sqrt ((c-b)*(b-a)))`);; + +let dihR = kepler_def(`dihR a b c = + atn2( sqrt(b*b-a*a),sqrt (c*c-b*b))`);; + +let vorR = kepler_def(`vorR a b c = + (&4)*(--doct*(volR a b c) + (solR a b c)/(&3))`);; + +let rad2_x = kepler_def(`rad2_x x1 x2 x3 x4 x5 x6 = + (rho_x x1 x2 x3 x4 x5 x6)/((delta_x x1 x2 x3 x4 x5 x6)*(&4))`);; + +(* deprecated: + +let d3 = new_definition `d3 (v:real^3) w = dist(v,w)`;; + +let mk_vec3 = new_definition `mk_vec3 a b c = vector[a; b; c]`;; + +let real3_of_triple = new_definition `real3_of_triple (a,b,c) = (mk_vec3 a b c):real^3`;; + +let triple_of_real3 = new_definition `triple_of_real3 (v:real^3) = + (v$1, v$2, v$3)`;; + + + +*) + +(* aff is deprecated *) +let aff = new_definition `aff = ( hull ) affine`;; + +let lin_combo = new_definition `lin_combo V f = vsum V (\v. f v % (v:real^N))`;; + +let affsign = new_definition `affsign sgn s t (v:real^A) = (?f. + (v = lin_combo (s UNION t) f) /\ (!w. t w ==> sgn (f w)) /\ (sum (s UNION t) f = &1))`;; + + +let sgn_gt = new_definition `sgn_gt = (\t. (&0 < t))`;; +let sgn_ge = new_definition `sgn_ge = (\t. (&0 <= t))`;; +let sgn_lt = new_definition `sgn_lt = (\t. (t < &0))`;; +let sgn_le = new_definition `sgn_le = (\t. (t <= &0))`;; + +(* conv is deprecated. Use `convex hull S` instead *) + +let conv = new_definition `conv S:real^A->bool = affsign sgn_ge {} S`;; +let conv0 = new_definition `conv0 S:real^A->bool = affsign sgn_gt {} S`;; +let cone = new_definition `cone v S:real^A->bool = affsign sgn_ge {v} S`;; +let cone0 = new_definition `cone0 v S:real^A->bool = affsign sgn_gt {v} S`;; + + +let aff_gt_def = new_definition `aff_gt = affsign sgn_gt`;; +let aff_ge_def = new_definition `aff_ge = affsign sgn_ge`;; +let aff_lt_def = new_definition `aff_lt = affsign sgn_lt`;; +let aff_le_def = new_definition `aff_le = affsign sgn_le`;; + +let voronoi = new_definition `voronoi v S = { x | !w. ((S w) /\ ~(w=v)) ==> (dist( x, v) < dist( x, w)) }`;; + +let voronoi_le = new_definition `voronoi_le v S = { x | !w. ((S w) /\ ~(w=v)) ==> (dist( x, v) <= dist( x, w)) }`;; + +let line = new_definition `line x = (?v w. ~(v =w) /\ (x = affine hull {v,w}))`;; + +let plane = new_definition `plane x = (?u v w. ~(collinear {u,v,w}) /\ (x = affine hull {u,v,w}))`;; +let closed_half_plane = new_definition `closed_half_plane x = (?u v w. ~(collinear {u,v,w}) /\ (x = aff_ge {u,v} {w}))`;; +let open_half_plane = new_definition `open_half_plane x = (?u v w. ~(collinear {u,v,w}) /\ (x = aff_gt {u,v} {w}))`;; +let coplanar = new_definition `coplanar S = (?x. plane x /\ S SUBSET x)`;; +let closed_half_space = new_definition `closed_half_space x = (?u v w w'. ~(coplanar {u,v,w,w'}) /\ (x = aff_ge {u,v,w} {w'}))`;; +let open_half_space = new_definition `open_half_space x = (?u v w w'. ~(coplanar {u,v,w,w'}) /\ (x = aff_gt {u,v,w} {w'}))`;; + +(* WMJHKBL *) +let bis = new_definition `bis u v = {x | dist(x,u) = dist(x,v)}`;; + +(* TIWZVEW *) +let bis_le = new_definition `bis_le u v = {x | dist(x,u) <= dist(x,v) }`;; +let bis_lt = new_definition `bis_lt u v = {x | dist(x,u) < dist(x,v) }`;; + +(* XCJABYH *) +let circumcenter = new_definition `circumcenter S = @v. ( (affine hull S) v /\ (?c. !w. (S w) ==> (c = dist(v,w))))`;; + +(* XPLPHNG *) +(* circumradius *) +let radV = new_definition `radV S = @c. !w. (S w) ==> (c = dist(circumcenter S,w))`;; + + + +(* EOBLRCS *) +let orientation = new_definition `orientation S v sgn = affsign sgn (S DIFF {v}) {v} (circumcenter S)`;; + +(* ANGLE *) + +let arcV = new_definition `arcV u v w = acs (( (v - u) dot (w - u))/((norm (v-u)) * (norm (w-u))))`;; + +let dihV = new_definition `dihV w0 w1 w2 w3 = + let va = w2 - w0 in + let vb = w3 - w0 in + let vc = w1 - w0 in + let vap = ( vc dot vc) % va - ( va dot vc) % vc in + let vbp = ( vc dot vc) % vb - ( vb dot vc) % vc in + arcV (vec 0) vap vbp`;; + +(* polar coordinates *) + +let radius = new_definition `radius x y = sqrt((x pow 2) + (y pow 2))`;; +let polar_angle = new_definition `polar_angle x y = + let theta = atn2(x,y) in + if (theta < &0) then (theta + (&2 * pi)) else theta`;; +let polar_c = new_definition `polar_c x y = (radius x y,polar_angle x y)`;; + +let less_polar = new_definition `less_polar (x,y) (x',y') = + let (r,theta) = polar_c x y in + let (r',theta') = polar_c x' y' in + (theta < theta') \/ ((theta =theta') /\ (r < r'))`;; + +let min_polar = new_definition `min_polar V = ( @ u. V u /\ (!w. V w /\ ~(u = w) ==> (less_polar u w)))`;; + +let polar_cycle = new_definition `polar_cycle V v = + let W = {u | V u /\ less_polar v u} in + if (W = EMPTY) then min_polar V else min_polar W`;; + +let iter_spec = prove(`?iter. !f u:A. (iter 0 f u = u) /\ (!n. (iter (SUC n) f u = f(iter n f u)))`, + (SUBGOAL_THEN `?g. !f (u:A). (g f u 0 = u) /\ (!n. (g f u (SUC n) = f (g f u n)))` CHOOSE_TAC) THENL + ([REWRITE_TAC[GSYM SKOLEM_THM;num_RECURSION_STD];REWRITE_TAC[]]) THEN + (EXISTS_TAC `\ (i:num) (f:A->A) (u:A). (g f u i):A`) THEN + (BETA_TAC) THEN + (ASM_REWRITE_TAC[]));; + +let iter = new_specification ["iter"] iter_spec;; + +let orthonormal = new_definition `orthonormal e1 e2 e3 = + (( e1 dot e1 = &1) /\ (e2 dot e2 = &1) /\ ( e3 dot e3 = &1) /\ + ( e1 dot e2 = &0) /\ ( e1 dot e3 = &0) /\ ( e2 dot e3 = &0) /\ + (&0 < (cross e1 e2) dot e3))`;; + +(* spherical coordinates *) +let azim_hyp_def = new_definition `azim_hyp = (!v w w1 w2. ?theta. !e1 e2 e3. ?psi h1 h2 r1 r2. + ~(collinear {v, w, w1}) /\ ~(collinear {v, w, w2}) /\ + (orthonormal e1 e2 e3) /\ ((dist( w, v)) % e3 = (w - v)) ==> + ((&0 <= theta) /\ (theta < &2 * pi) /\ (&0 < r1) /\ (&0 < r2) /\ + (w1 - v = (r1 * cos(psi)) % e1 + (r1 * sin(psi)) % e2 + h1 % (w-v)) /\ + (w2 - v = (r2 * cos(psi + theta)) % e1 + (r2 * sin(psi + theta)) % e2 + h2 % (w-v))))`;; + +let azim_spec = prove(`?theta. !v w w1 w2 e1 e2 e3. ?psi h1 h2 r1 r2. + (azim_hyp) ==> + ~(collinear {v, w, w1}) /\ ~(collinear {v, w, w2}) /\ + (orthonormal e1 e2 e3) /\ ((dist( w, v)) % e3 = (w - v)) ==> + ((&0 <= theta v w w1 w2) /\ (theta v w w1 w2 < &2 * pi) /\ (&0 < r1) /\ (&0 < r2) /\ + (w1 - v = (r1 * cos(psi)) % e1 + (r1 * sin(psi)) % e2 + h1 % (w-v)) /\ + (w2 - v = (r2 * cos(psi + theta v w w1 w2)) % e1 + (r2 * sin(psi + theta v w w1 w2)) % e2 + h2 % (w-v)))`, + (REWRITE_TAC[GSYM SKOLEM_THM;GSYM RIGHT_IMP_EXISTS_THM;GSYM RIGHT_IMP_FORALL_THM]) THEN + (REWRITE_TAC[azim_hyp_def]) THEN + (REPEAT STRIP_TAC) THEN + (ASM_REWRITE_TAC[RIGHT_IMP_EXISTS_THM]));; + +let azim_def = new_specification ["azim"] azim_spec;; + + +let cyclic_set = new_definition `cyclic_set W v w = + (~(v=w) /\ (FINITE W) /\ (!p q h. W p /\ W q /\ (p = q + h % (v - w)) ==> (p=q)) /\ + (W INTER (affine hull {v,w}) = EMPTY))`;; + + + + +let azim_cycle_hyp_def = new_definition `azim_cycle_hyp = + (?sigma. !W proj v w e1 e2 e3 p. + (W p) /\ + (cyclic_set W v w) /\ ((dist( v ,w)) % e3 = (w-v)) /\ + (orthonormal e1 e2 e3) /\ + (!u x y. (proj u = (x,y)) <=> (?h. (u = v + x % e1 + y % e2 + h % e3))) ==> + (proj (sigma W v w p) = polar_cycle (IMAGE proj W) (proj p)))`;; + +let azim_cycle_spec = prove(`?sigma. !W proj v w e1 e2 e3 p. + (azim_cycle_hyp) ==> ( (W p) /\ + (cyclic_set W v w) /\ ((dist( v ,w)) % e3 = (w-v)) /\ + (orthonormal e1 e2 e3) /\ + (!u x y. (proj u = (x,y)) <=> (?h. (u = v + x % e1 + y % e2 + h % e3)))) ==> (proj (sigma W v w p) = polar_cycle (IMAGE proj W) (proj p))`, + (REWRITE_TAC[GSYM RIGHT_IMP_EXISTS_THM;GSYM RIGHT_IMP_FORALL_THM]) THEN + (REWRITE_TAC[azim_cycle_hyp_def]) + );; + +let azim_cycle_def = new_specification ["azim_cycle"] azim_cycle_spec;; + + +(* ------------------------------------------------------------------ *) +(* Definitions from the Collection in Elementary Geometry *) +(* ------------------------------------------------------------------ *) + +(* EDSFZOT *) + +let cayleyR = new_definition `cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 = + -- (x14*x14*x23*x23) + &2 *x14*x15*x23*x23 - x15*x15*x23*x23 + &2 *x13*x14*x23*x24 - &2 *x13*x15*x23*x24 - &2 *x14*x15*x23*x24 + + &2 *x15*x15*x23*x24 - x13*x13*x24*x24 + &2 *x13*x15*x24*x24 - x15*x15*x24*x24 - &2 *x13*x14*x23*x25 + + &2 *x14*x14*x23*x25 + &2 *x13*x15*x23*x25 - &2 *x14*x15*x23*x25 + &2 *x13*x13*x24*x25 - &2 *x13*x14*x24*x25 - &2 *x13*x15*x24*x25 + + &2 *x14*x15*x24*x25 - x13*x13*x25*x25 + &2 *x13*x14*x25*x25 - x14*x14*x25*x25 + &2 *x12*x14*x23*x34 - &2 *x12*x15*x23*x34 - + &2 *x14*x15*x23*x34 + &2 *x15*x15*x23*x34 + &2 *x12*x13*x24*x34 - &2 *x12*x15*x24*x34 - &2 *x13*x15*x24*x34 + &2 *x15*x15*x24*x34 + + &4 *x15*x23*x24*x34 - &2 *x12*x13*x25*x34 - &2 *x12*x14*x25*x34 + &4 *x13*x14*x25*x34 + &4 *x12*x15*x25*x34 - &2 *x13*x15*x25*x34 - &2 *x14*x15*x25*x34 - + &2 *x14*x23*x25*x34 - &2 *x15*x23*x25*x34 - &2 *x13*x24*x25*x34 - &2 *x15*x24*x25*x34 + &2 *x13*x25*x25*x34 + &2 *x14*x25*x25*x34 - + x12*x12*x34*x34 + &2 *x12*x15*x34*x34 - x15*x15*x34*x34 + &2 *x12*x25*x34*x34 + &2 *x15*x25*x34*x34 - + x25*x25*x34*x34 - &2 *x12*x14*x23*x35 + &2 *x14*x14*x23*x35 + &2 *x12*x15*x23*x35 - &2 *x14*x15*x23*x35 - &2 *x12*x13*x24*x35 + + &4 *x12*x14*x24*x35 - &2 *x13*x14*x24*x35 - &2 *x12*x15*x24*x35 + &4 *x13*x15*x24*x35 - &2 *x14*x15*x24*x35 - &2 *x14*x23*x24*x35 - &2 *x15*x23*x24*x35 + + &2 *x13*x24*x24*x35 + &2 *x15*x24*x24*x35 + &2 *x12*x13*x25*x35 - &2 *x12*x14*x25*x35 - &2 *x13*x14*x25*x35 + &2 *x14*x14*x25*x35 + + &4 *x14*x23*x25*x35 - &2 *x13*x24*x25*x35 - &2 *x14*x24*x25*x35 + &2 *x12*x12*x34*x35 - &2 *x12*x14*x34*x35 - &2 *x12*x15*x34*x35 + + &2 *x14*x15*x34*x35 - &2 *x12*x24*x34*x35 - &2 *x15*x24*x34*x35 - &2 *x12*x25*x34*x35 - &2 *x14*x25*x34*x35 + &2 *x24*x25*x34*x35 - + x12*x12*x35*x35 + &2 *x12*x14*x35*x35 - x14*x14*x35*x35 + &2 *x12*x24*x35*x35 + &2 *x14*x24*x35*x35 - + x24*x24*x35*x35 + &4 *x12*x13*x23*x45 - &2 *x12*x14*x23*x45 - &2 *x13*x14*x23*x45 - &2 *x12*x15*x23*x45 - &2 *x13*x15*x23*x45 + + &4 *x14*x15*x23*x45 + &2 *x14*x23*x23*x45 + &2 *x15*x23*x23*x45 - &2 *x12*x13*x24*x45 + &2 *x13*x13*x24*x45 + &2 *x12*x15*x24*x45 - + &2 *x13*x15*x24*x45 - &2 *x13*x23*x24*x45 - &2 *x15*x23*x24*x45 - &2 *x12*x13*x25*x45 + &2 *x13*x13*x25*x45 + &2 *x12*x14*x25*x45 - + &2 *x13*x14*x25*x45 - &2 *x13*x23*x25*x45 - &2 *x14*x23*x25*x45 + &4 *x13*x24*x25*x45 + &2 *x12*x12*x34*x45 - &2 *x12*x13*x34*x45 - + &2 *x12*x15*x34*x45 + &2 *x13*x15*x34*x45 - &2 *x12*x23*x34*x45 - &2 *x15*x23*x34*x45 - &2 *x12*x25*x34*x45 - &2 *x13*x25*x34*x45 + &2 *x23*x25*x34*x45 + + &2 *x12*x12*x35*x45 - &2 *x12*x13*x35*x45 - &2 *x12*x14*x35*x45 + &2 *x13*x14*x35*x45 - &2 *x12*x23*x35*x45 - &2 *x14*x23*x35*x45 - + &2 *x12*x24*x35*x45 - &2 *x13*x24*x35*x45 + &2 *x23*x24*x35*x45 + &4 *x12*x34*x35*x45 - x12*x12*x45*x45 + &2 *x12*x13*x45*x45 - + x13*x13*x45*x45 + &2 *x12*x23*x45*x45 + &2 *x13*x23*x45*x45 - x23*x23*x45*x45`;; + + +(* PUSACOU *) + +let packing = new_definition `packing S = (!u v. S u /\ S v /\ ~(u = v) ==> (&2 <= dist( u, v)))`;; + +(* SIDEXYO *) + +let wedge = new_definition (`wedge v1 v2 w1 w2 = + let z = v2 - v1 in + let u1 = w1 - v1 in + let u2 = w2 - v1 in + let n = cross z u1 in + let d = n dot u2 in + if (aff_ge {v1,v2} {w1} w2) then {} else + if (aff_lt {v1,v2} {w1} w2) then aff_gt {v1,v2,w1} {n} else + if (d > &0) then aff_gt {v1,v2} {w1,w2} else + (:real^3) DIFF aff_ge {v1,v2} {w1,w2}`);; + +(* ------------------------------------------------------------------ *) +(* Measure and Volume, following Nguyen Tat Thang *) +(* ------------------------------------------------------------------ *) + +let sphere= new_definition`sphere x=(?(v:real^3)(r:real). (r> &0)/\ (x={w:real^3 | norm (w-v)= r}))`;; + +let c_cone = new_definition `c_cone (v,w:real^3, r:real)={x:real^3 | ((x-v) dot w = norm (x-v)* norm w* r)}`;; + +let circular_cone =new_definition `circular_cone (V:real^3-> bool)= +(? (v,w:real^3)(r:real). V= c_cone (v,w,r))`;; + +let NULLSET_RULES,NULLSET_INDUCT,NULLSET_CASES = + new_inductive_definition + `(!P. ((plane P)\/ (sphere P) \/ (circular_cone P)) ==> NULLSET P) /\ + !(s:real^3->bool) t. (NULLSET s /\ NULLSET t) ==> NULLSET (s UNION t)`;; + +let null_equiv = new_definition `null_equiv (s,t :real^3->bool)=(? (B:real^3-> bool). NULLSET B /\ +((s DIFF t) UNION (t DIFF s)) SUBSET B)`;; + + +let normball = new_definition `normball x r = { y:real^A | dist(y,x) < r}`;; + +let radial = new_definition `radial r x C <=> (C SUBSET normball x r) /\ (!u. (x+u) IN C ==> (!t.(t> &0) /\ (t* norm u < r)==>(x+ t % u) IN C))`;; + +let eventually_radial = new_definition `eventually_radial x C <=> (?r. (r> &0) /\ radial r x (C INTER normball x r))`;; + +let solid_triangle = new_definition `solid_triangle v0 S r = normball v0 r INTER cone v0 S`;; + +let rconesgn = new_definition `rconesgn sgn v w h = {x:real^A | sgn ((x-v) dot (w-v)) (dist(x,v)*dist(w,v)*h)}`;; + +(* drop primes *) + +let rcone_ge = new_definition `rcone_ge = rconesgn ( >= )`;; +let rcone_gt = new_definition `rcone_gt = rconesgn ( > )`;; +let rcone_lt = new_definition `rcone_lt = rconesgn ( < )`;; +let rcone_eq = new_definition `rcone_eq = rconesgn ( = )`;; + +let scale = new_definition `scale (t:real^3) (u:real^3) = vector[t$1 * u$1; t$2 * u$2; t$3 * u$3]`;; + +let ellipsoid = new_definition `ellipsoid t r = IMAGE (scale t) (normball(vec 0)r)`;; + +let conic_cap = new_definition `conic_cap v0 v1 r a = normball v0 r INTER rcone_gt v0 v1 a`;; + +let frustum = new_definition `frustum v0 v1 h1 h2 a = { y | rcone_gt v0 v1 a y /\ + let d = (y - v0) dot (v1 - v0) in + let n = norm(v1 - v0) in + (h1*n < d /\ d < h2*n)}`;; + +let frustt = new_definition `frustt v0 v1 h a = frustum v0 v1 (&0) h a`;; + +let rect = new_definition `rect (a:real^3) (b:real^3) = {(v:real^3) | !i. ( a$i < v$i /\ v$i < b$i )}`;; + +(* +let is_tetrahedron = new_definition `is_tetrahedron S = ?v0 v1 v2 v3. (S = conv0 {v0,v1,v2,v3})`;; +*) + +let primitive = new_definition `primitive (C:real^3->bool) = + ((?v0 v1 v2 v3 r. (C = solid_triangle v0 {v1,v2,v3} r)) \/ + (?v0 v1 v2 v3. (C = conv0 {v0,v1,v2,v3})) \/ + (?v0 v1 v2 v3 h a. (C = frustt v0 v1 h a INTER wedge v0 v1 v2 v3)) \/ + (?v0 v1 v2 v3 r c. (C = conic_cap v0 v1 r c INTER wedge v0 v1 v2 v3)) \/ + (?a b. (C = rect a b)) \/ + (?t r. (C = ellipsoid t r)) \/ + (?v0 v1 v2 v3 r. (C = normball v0 r INTER wedge v0 v1 v2 v3)))`;; + +let MEASURABLE_RULES,MEASURABLE_INDUCT,MEASURABLE_CASES = + new_inductive_definition + `(!C. primitive C ==> measurable C) /\ + ( !Z. NULLSET Z ==> measurable Z) /\ + (!X t. measurable X ==> (measurable (IMAGE (scale t) X))) /\ + (!X v. measurable X ==> (measurable (IMAGE ((+) v) X))) /\ + ( !(s:real^3->bool) t. (measurable s /\ measurable t) ==> measurable (s UNION t)) /\ + ( !(s:real^3->bool) t. (measurable s /\ measurable t) ==> measurable (s INTER t)) /\ + ( !(s:real^3->bool) t. (measurable s /\ measurable t) ==> measurable (s DIFF t)) + `;; + + +let SDIFF = new_definition `SDIFF X Y = (X DIFF Y) UNION (Y DIFF X)`;; + + +let vol_solid_triangle = new_definition `vol_solid_triangle v0 v1 v2 v3 r = + let a123 = dihV v0 v1 v2 v3 in + let a231 = dihV v0 v2 v3 v1 in + let a312 = dihV v0 v3 v1 v2 in + (a123 + a231 + a312 - pi)*(r pow 3)/(&3)`;; + +let vol_frustt_wedge = new_definition `vol_frustt_wedge v0 v1 v2 v3 h a = + (azim v0 v1 v2 v3)*(h pow 3)*(&1/(a*a) - &1)/(&6)`;; + +(* volume of intersection of conic cap and wedge *) +let vol_conic_cap_wedge = new_definition `vol_conic_cap_wedge v0 v1 v2 v3 r c = + (azim v0 v1 v2 v3)*(&1 - c)*(r pow 3)/(&3)`;; + + +let vol_conv = new_definition `vol_conv v1 v2 v3 v4 = + let x12 = dist(v1,v2) pow 2 in + let x13 = dist(v1,v3) pow 2 in + let x14 = dist(v1,v4) pow 2 in + let x23 = dist(v2,v3) pow 2 in + let x24 = dist(v2,v4) pow 2 in + let x34 = dist(v3,v4) pow 2 in + sqrt(delta_x x12 x13 x14 x34 x24 x34)/(&12)`;; + +let vol_rect = new_definition `vol_rect a b = + if (a$1 < b$1) /\ (a$2 < b$2) /\ (a$3 < b$3) then (b$3-a$3)*(b$2-a$2)*(b$1-a$1) else &0`;; + +let vol_ball_wedge = new_definition `vol_ball_wedge v0 v1 v2 v3 r = + (azim v0 v1 v2 v3)*(&2)*(r pow 3)/(&3)`;; + + +let volume_props = new_definition `volume_props (vol:(real^3->bool)->real) = + ( (!C. vol C >= &0) /\ + (!Z. NULLSET Z ==> (vol Z = &0)) /\ + (!X Y. measurable X /\ measurable Y /\ NULLSET (SDIFF X Y) ==> (vol X = vol Y)) /\ + (!X t. (measurable X) /\ (measurable (IMAGE (scale t) X)) ==> (vol (IMAGE (scale t) X) = abs(t$1 * t$2 * t$3)*vol(X))) /\ + (!X v. measurable X ==> (vol (IMAGE ((+) v) X) = vol X)) /\ + (!v0 v1 v2 v3 r. (r > &0) /\ (~(collinear {v0,v1,v2})) /\ ~(collinear {v0,v1,v3}) ==> vol (solid_triangle v0 {v1,v2,v3} r) = vol_solid_triangle v0 v1 v2 v3 r) /\ + (!v0 v1 v2 v3. vol(conv0 {v0,v1,v2,v3}) = vol_conv v0 v1 v2 v3) /\ + (!v0 v1 v2 v3 h a. ~(collinear {v0,v1,v2}) /\ ~(collinear {v0,v1,v3}) /\ (h >= &0) /\ (a > &0) /\ (a <= &1) ==> vol(frustt v0 v1 h a INTER wedge v0 v1 v2 v3) = vol_frustt_wedge v0 v1 v2 v3 h a) /\ + (!v0 v1 v2 v3 r c. ~(collinear {v0,v1,v2}) /\ ~(collinear {v0,v1,v3}) /\ (r >= &0) /\ (c >= -- (&1)) /\ (c <= &1) ==> (vol(conic_cap v0 v1 r c INTER wedge v0 v1 v2 v3) = vol_conic_cap_wedge v0 v1 v2 v3 r c)) /\ + (!(a:real^3) (b:real^3). vol(rect a b) = vol_rect a b) /\ + (!v0 v1 v2 v3 r. ~(collinear {v0,v1,v2}) /\ ~(collinear {v0,v1,v3}) /\ (r >= &0) ==> (vol(normball v0 r INTER wedge v0 v1 v2 v3) = vol_ball_wedge v0 v1 v2 v3 r)))`;; + +let vol_def = new_definition `vol = ( @ ) volume_props`;; + +let solid = new_definition `solid x C = (@s. ?c. (c > &0) /\ (!r. (r > &0) /\ (r < c) ==> + (s = &3 * vol(C INTER normball x r)/(r pow 3)))) `;; + +let sovo = new_definition `sovo x C (v,s) = v* vol(C) + s* solid x C`;; + +let phivo = new_definition `phivo h t (v,s) = v*t*h*(t+h)/(&6) + s`;; + +let avo = new_definition `avo h t l= (&1 - h/t)*(phivo h t l - phivo t t l)`;; + +let ortho0 = new_definition `ortho0 x v1 v2 v3 = conv0 {x,x+v1,x+v1+v2,x+v1+v2+v3}`;; + +let make_point = new_definition `make_point v1 v2 v3 w r1 r2 r3 = @v. (aff_ge {v1,v2,v3} {w} (v:real^3)) /\ (r1 = dist(v1,v)) /\ (r2 = dist(v2,v)) /\ (r3 = dist(v3,v))`;; + +let rogers = new_definition `rogers v0 v1 v2 v3 c = + let w = (&1/ (&2)) % (v0 + v1) in + let p = circumcenter {v0,v1,v2} in + let q = make_point v0 v1 v2 v3 c c c in + conv {v0,w,p,q}`;; + +let rogers0 = new_definition `rogers0 v0 v1 v2 v3 c = + let w = (&1/ (&2)) % (v0 + v1) in + let p = circumcenter {v0,v1,v2} in + let q = make_point v0 v1 v2 v3 c c c in + conv0 {v0,w,p,q}`;; + +let abc_param = new_definition `abc_param v0 v1 v2 c = + let a = (&1/(&2)) * dist(v0,v1) in + let b = radV {v0,v1,v2} in + (a,b,c)`;; diff --git a/legacy/linear_program/LinProg.ml b/legacy/linear_program/LinProg.ml new file mode 100644 index 0000000..f536438 --- /dev/null +++ b/legacy/linear_program/LinProg.ml @@ -0,0 +1,42 @@ +(*Define the notion of solution*) +let is_solution = define `is_solution xs (cs,b) <=> + LENGTH xs = LENGTH cs /\ + ITLIST2 (\c x s. c * x + s) cs xs (&0) = b`;; + +(*Useful tactic supporting double list induction -- written by John Harrison*) +let LIST2_INDUCT_TAC = + let list2_INDUCT = prove + (`!P:(A)list->(B)list->bool. + P [] [] /\ + (!h1 t1 h2 t2. P t1 t2 ==> P (CONS h1 t1) (CONS h2 t2)) + ==> !l1 l2. LENGTH l1 = LENGTH l2 ==> P l1 l2`, + GEN_TAC THEN STRIP_TAC THEN + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN + ASM_SIMP_TAC[LENGTH; NOT_SUC; SUC_INJ]) in + MATCH_MP_TAC list2_INDUCT THEN + CONJ_TAC THENL [ALL_TAC; REPLICATE_TAC 4 GEN_TAC THEN DISCH_TAC];; + +(*Prove the most basic theorem of multiplying both sides with the same non-zero integer (homogeneity)*) +let homogeneity_thm = prove(`!a b xs cs. ( ~(a = &0) ) ==> ( is_solution xs (cs,b) <=> is_solution xs ( MAP (\c. a*c) cs, a*b ) )`, +REPEAT GEN_TAC THEN +REWRITE_TAC[is_solution; LENGTH_MAP] THEN +REWRITE_TAC[TAUT` (a/\b<=>a/\c) = (a ==> (b<=>c))`] THEN +REPEAT DISCH_TAC THEN +UNDISCH_TAC `~(a = &0)` THEN +SPEC_TAC (`b:real`, `b:real`) THEN +SPEC_TAC (`a:real`, `a:real`) THEN +UNDISCH_TAC `LENGTH (xs:real list) = LENGTH (cs:real list)` THEN +SPEC_TAC (`cs: real list`,`cs: real list`) THEN +SPEC_TAC (`xs: real list`,`xs: real list`) THEN +LIST2_INDUCT_TAC THENL [ + REPEAT GEN_TAC THEN + REWRITE_TAC[MAP; ITLIST2] THEN + REWRITE_TAC[REAL_FIELD `~(a = &0) ==> (&0 = b <=> &0 = a * b)`]; + + REWRITE_TAC[MAP; ITLIST2] THEN + REWRITE_TAC[ARITH_RULE `(a:real)+b=c <=> b=c-a`] THEN + REWRITE_TAC[ARITH_RULE `((a:real)* b) * c = a * (b * c)`] THEN + REWRITE_TAC[ARITH_RULE `(a:real) * b - a * c = a * (b - c)`] THEN + ASM_SIMP_TAC[] +] );; + diff --git a/legacy/load_def_kepler.ml b/legacy/load_def_kepler.ml new file mode 100644 index 0000000..5fcb3ac --- /dev/null +++ b/legacy/load_def_kepler.ml @@ -0,0 +1,42 @@ + +(* + * Load HOL Light and the kepler definition and inequality files. + * Then use [ocaml_to_sml] to generate an SML file of the + * inequality syntax. + *) + +#use "hol.ml";; +needs "Multivariate/vectors.ml";; +needs "Examples/analysis.ml";; +needs "Examples/transc.ml";; +needs "definitions_kepler.ml";; +needs "Jordan/lib_ext.ml";; +needs "Jordan/parse_ext_override_interface.ml";; +unambiguous_interface();; + +let kepler_home = Sys.getenv "KEPLER_HOME";; +(* +let kepler_home = "/Users/seanmcl/save/versioned/projects/kepler/src";; +*) +loads (kepler_home ^ "/inequalities/holl/definitions_kepler.ml");; +loads (kepler_home ^ "/inequalities/holl/kep_inequalities.ml");; +loads (kepler_home ^ "/inequalities/holl/kep_ineq_bis.ml");; +loads (kepler_home ^ "/inequalities/holl/kepler_ineq_names.ml");; +loads (kepler_home ^ "/inequalities/holl/dodec_inequalities.ml");; +loads (kepler_home ^ "/inequalities/holl/dodec_ineq_names.ml");; +loads (kepler_home ^ "/inequalities/holl/ocaml_to_sml.ml");; + +let kepler_ineqs = Ocaml_sml.translate_list ~ignore:Kepler_ineq_names.ignore ~terms:Kepler_ineq_names.kepler_ineqs;; +let dodec_ineqs = Ocaml_sml.translate_list ~ignore:[] ~terms:Dodec_ineq_names.dodec_ineqs;; + +let _ = + Ocaml_sml.ineqs_to_sml + ~file:(kepler_home ^ "/inequalities/kepler-inequality-syntax-base.sml") + ~ineqs:kepler_ineqs + ~univ:"Kepler";; + +let _ = + Ocaml_sml.ineqs_to_sml + ~file:(kepler_home ^ "/inequalities/dodec-inequality-syntax-base.sml") + ~ineqs:dodec_ineqs + ~univ:"Dodec";; diff --git a/legacy/oldfan/Conforming2.hl b/legacy/oldfan/Conforming2.hl new file mode 100644 index 0000000..b55c915 --- /dev/null +++ b/legacy/oldfan/Conforming2.hl @@ -0,0 +1,17815 @@ + +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================= *) + +(* +tame_lemmas-compiled.hl needs Conforming2.hl which is an almost exact copy of Conforming.hl. The content of Conforming2.hl should replace Conforming.hl. I think there will be no problems with such a replacement but I never tested it. The only difference between Conforming2.hl and Conforming.hl is that I removed the assumption `~(conforming_fan (x,V,E))` from some lemmas where it is not used. + + +Alexey +*) + + + +module Conforming2 = struct + + + + + + + + + +open Sphere;; +open Fan_defs;; +open Hypermap;; +open Vol1;; +open Fan;; +open Topology;; +open Fan_misc;; +open Planarity;; + + + + + + + +let conforming_bijection_fan = new_definition `conforming_bijection_fan (x,V,E) <=> + !s. s IN topological_component_yfan (x,V,E) ==> (?!f. f IN face_set (hypermap1_of_fanx (x,V,E)) /\ + s = dartset_leads_into_fan x V E f)`;; + + +let conforming_half_space_fan = new_definition `conforming_half_space_fan (x,V,E) <=> + !f. f IN face_set (hypermap1_of_fanx (x,V,E)) ==> + dartset_leads_into_fan x V E f = + INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN f}`;; + + +let conforming_solid_angle_fan = new_definition `conforming_solid_angle_fan (x,V,E) <=> + !f. f IN face_set (hypermap1_of_fanx (x,V,E)) ==> + (let U = dartset_leads_into_fan x V E f in + (!r. measurable (ball (x,r) INTER U)) /\ + eventually_radial x U /\ + sol x U = &2 * pi + sum (f) (\y. (azim_fan x V E (pr2 y) (pr3 y)) - pi))`;; + + +let conforming_diagonal_fan = new_definition `conforming_diagonal_fan (x,V,E) <=> + (!f y z. f IN face_set (hypermap1_of_fanx (x,V,E)) /\ y IN f /\ z IN f /\ ~(y = z) ==> + ~collinear {x, pr2 y, pr2 z} /\ + ((y = f1_fan x V E z) \/ (z = f1_fan x V E y) \/ + aff_gt {x} {pr2 y, pr2 z} SUBSET (dartset_leads_into_fan x V E f)))`;; + + + + + +let conforming_fan = new_definition `conforming_fan (x,V,E) <=> + (!v. v IN V==>CARD (set_of_edge v V E) >1)/\ + fan80(x,V,E) /\ + conforming_bijection_fan (x,V,E) /\ + conforming_half_space_fan (x,V,E) /\ + conforming_solid_angle_fan (x,V,E) /\ + conforming_diagonal_fan (x,V,E)`;; + + + + +let N_FAN = new_definition `N_FAN (x,V,E) = nsum (face_set (hypermap1_of_fanx (x,V,E))) (\f. CARD f -3)`;; + + + +let minimally_nonconforming_fan=new_definition`minimally_nonconforming_fan(x,V,E)<=> +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ~(conforming_fan (x,V,E)) +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))`;; + + + + +let GINGUAP=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E) +/\ conforming_fan (x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> convex(dartset_leads_into_fan x V E ds)`, + +REWRITE_TAC[conforming_fan;conforming_half_space_fan] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th`ds:real^3#real^3#real^3#real^3->bool`) +THEN MATCH_MP_TAC CONVEX_INTERS +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[CONVEX_AFF_GT]);; + + + + + +let fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v w. +FAN(x,V,E) /\ {v,w} IN E +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +==> aff_gt {x, v,w} {sigma_fan x V E v w} = + aff_gt {x, v, w} {inverse1_sigma_fan x V E w v}`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`w:real^3`] THEN MRESA_TAC th [`w:real^3`;`inverse1_sigma_fan x V E w v:real^3`] ) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`] +THEN REMOVE_THEN "EM" MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN DISCH_TAC THEN MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`] THEN DISCH_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` sigma_fan x V E v w:real^3`;`(v:real^3)`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`sigma_fan x V E v w:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN DISCH_TAC THEN MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN DISCH_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`;`sigma_fan x V E v w:real^3`; `w:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`(w:real^3)`;`inverse1_sigma_fan x V E w v:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`;`v:real^3`;`inverse1_sigma_fan x V E w v:real^3`; ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`w:real^3`;`sigma_fan x V E v w:real^3`;] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w v:real^3`]);; + + + + + + + + + + + +let IMAGE_F1_IN_FACE_IMP_IN_FACE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y y1. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ ds IN face_set (hypermap1_of_fanx (x,V,E)) +/\ y IN ds +/\ y1 IN d_fan(x,V,E) +/\ f1_fan x V E y1= y +==> y1 IN ds`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM;orbit_map] +THEN RESA_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x':real^3#real^3#real^3#real^3`) +THEN STRIP_TAC +THEN SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E)) y1 IN + face_set (hypermap1_of_fanx (x,V,E))`ASSUME_TAC +THENL[ +REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;face] +THEN EXISTS_TAC`y1:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[]; +MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) y1):real^3#real^3#real^3#real^3->bool`] +THEN SUBGOAL_THEN`?N:num. CARD (face (hypermap1_of_fanx (x,V,E)) y1)= SUC N /\ N>0`ASSUME_TAC +THENL[ +EXISTS_TAC`CARD (face (hypermap1_of_fanx (x:real^3,V,E)) y1)-1` +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`CARD (face (hypermap1_of_fanx (x,V,E)) y1):num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y1:real^3#real^3#real^3#real^3`) +THEN STRIP_TAC +THEN MRESA_TAC lemma_face_cycle[`hypermap1_of_fanx (x:real^3,V,E)`;`y1:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[POWER;o_DEF;GSYM lemma_add_exponent_function] +THEN STRIP_TAC +THEN EXISTS_TAC`N+n:num` +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`N+n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x':real^3#real^3#real^3#real^3`) +THEN MP_TAC(ARITH_RULE`n>=0/\ N>0==> N+n>=0`) +THEN ASM_REWRITE_TAC[]]]);; + + + + + + +let IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE=prove(`!m x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y y1. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ ds IN face_set (hypermap1_of_fanx (x,V,E)) +/\ y IN ds +/\ y1 IN d_fan(x,V,E) +/\ (f1_fan x V E POWER m) y1= y +==> y1 IN ds`, + +INDUCT_TAC +THENL[ +ASM_REWRITE_TAC[POWER;I_DEF] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN ASM_REWRITE_TAC[POWER;o_DEF] +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESA_TAC th[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`;` (f1_fan x V E y1):real^3#real^3#real^3#real^3`;]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN STRIP_TAC +THEN MRESAL_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`1:num`][POWER_1] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y1:real^3#real^3#real^3#real^3`) +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`(f1_fan x V E y1):real^3#real^3#real^3#real^3`;`y1:real^3#real^3#real^3#real^3`;]]);; + + + + + + + +let REP_OF_INVERSE1_SIGMA_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ ds IN face_set (hypermap1_of_fanx (x,V,E)) +/\ y IN ds +==> f1_fan x V E (x,sigma_fan x V E (pr2 y) (pr3 y),(pr2 y),sigma_fan x V E (sigma_fan x V E (pr2 y) (pr3 y)) (pr2 y))=y `, + +REPEAT STRIP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`ds SUBSET d1_fan (x,V,E) /\ y IN ds ==> y IN d1_fan (x,V,E)`) +THEN ASM_REWRITE_TAC[f1_fan;d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr2;pr3] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`w:real^3`));; + + + + +let REP_OF_INVERSE1_SIGMA_FAN_IN_D_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ ds IN face_set (hypermap1_of_fanx (x,V,E)) +/\ y IN ds +==> (x,sigma_fan x V E (pr2 y) (pr3 y),(pr2 y),sigma_fan x V E (sigma_fan x V E (pr2 y) (pr3 y)) (pr2 y)) IN + d_fan (x:real^3,V:real^3->bool,E)`, + +REPEAT STRIP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`ds SUBSET d1_fan (x,V,E) /\ y IN ds ==> y IN d1_fan (x,V,E)`) +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr2;pr3] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`(sigma_fan x V E v w):real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`(sigma_fan x V E (sigma_fan x V E v w) v):real^3` +THEN ASM_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v:real^3`;`w:real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E v w):real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC);; + + + + + +let DARTSET_LEADS_INTO_SUBSET_WDART_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y. +FAN(x,V,E) +/\ ds IN face_set (hypermap1_of_fanx (x,V,E)) +/\ y IN ds +/\ conforming_fan (x,V,E) +==> (dartset_leads_into_fan x V E ds) SUBSET (w_dart_fan x V E y)`, +REWRITE_TAC[conforming_fan;conforming_half_space_fan] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th`ds:real^3#real^3#real^3#real^3->bool`) +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y IN ds /\ ds SUBSET d1_fan (x,V,E)==> y IN d1_fan (x,V,E)`) THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN FIND_ASSUM MP_TAC`(!v:real^3. v IN V==>CARD (set_of_edge v V E) >1)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC `v:real^3` th) THEN FIND_ASSUM MP_TAC `(v:real^3) IN V` THEN DISCH_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN STRIP_TAC) +THEN ASM_REWRITE_TAC[w_dart_fan;] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM1")) +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v:real^3`;`w:real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E v w):real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC WEDGE_LUNE_GT[`x:real^3`;`v:real^3`;`w:real^3`;`(sigma_fan x V E v w):real^3`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E v w):real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN DISCH_TAC THEN MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] THEN DISCH_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_2_2[`x:real^3`;`w:real^3`;`v:real^3`;`(sigma_fan x V E v w):real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) +THEN SUBGOAL_THEN`x,sigma_fan x V E v w,v,sigma_fan x V E (sigma_fan x V E v w) v IN + d1_fan (x:real^3,V:real^3->bool,E)` ASSUME_TAC +THENL[ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`(sigma_fan x V E v w):real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`(sigma_fan x V E (sigma_fan x V E v w) v):real^3` +THEN ASM_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]; +MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E (x,sigma_fan x V E v w, v, sigma_fan x V E (sigma_fan x V E v w) v)):real^3#real^3#real^3#real^3)` ;`((x,sigma_fan x V E v w,v,sigma_fan x V E (sigma_fan x V E v w) v):real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[pr2;pr3;f1_fan] +THEN REWRITE_TAC[] +THEN STRIP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[pr2;pr3;f1_fan] +THEN REWRITE_TAC[INTERS;INTER;IN_ELIM_THM; SUBSET] +THEN REPEAT STRIP_TAC +THENL[POP_ASSUM(fun th-> MRESA1_TAC th `aff_gt {x, w, v} {sigma_fan x V E v w:real^3}` THEN POP_ASSUM MATCH_MP_TAC) +THEN EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[pr2;pr3;f1_fan] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B,C}={A,C,B}`] +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`]; +POP_ASSUM(fun th-> MRESA1_TAC th `aff_gt {x, v, sigma_fan x V E v w} {w}` THEN POP_ASSUM MATCH_MP_TAC) +THEN EXISTS_TAC`(x,sigma_fan x V E v w,v,sigma_fan x V E (sigma_fan x V E v w:real^3) v):real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[pr2;pr3;f1_fan] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`w:real^3`) +THEN MRESAL_TAC REP_OF_INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`][pr2;pr3] +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`;`(x,sigma_fan x V E v w,v,sigma_fan x V E (sigma_fan x V E v w:real^3) v):real^3#real^3#real^3#real^3`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B,C}={A,C,B}`] +THEN REWRITE_TAC[]]]);; + + + + + + + + +let power_map_points_edge_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 w:real^3 n:num. +FAN(x,V,E) +/\ {v,w} IN E +==> {v,power_map_points sigma_fan x V E v w n} IN E`, +REPEAT STRIP_TAC +THEN MRESA_TAC i_IN_ORBITS_FAN[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`n:num`] +THEN MRESA_TAC ORBITS_SUBSET_EDGE_FAN[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;` (w:real^3)`] +THEN MP_TAC (SET_RULE`power_map_points sigma_fan x V E v w n IN + set_of_orbits_points_fan x V E v w /\ +set_of_orbits_points_fan x V E v w SUBSET set_of_edge v V E +==> power_map_points sigma_fan x V E v w n IN set_of_edge v V E`) +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC properties_of_set_of_edge_fan[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;` ((power_map_points sigma_fan x V E v w n):real^3)`]);; + + + + +let SRPRNPL=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +/\ conforming_fan (x,V,E) +==> simple_hypermap(hypermap1_of_fanx (x,V,E))`, + +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN REWRITE_TAC[conforming_fan] THEN ASSUME_TAC th) +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN ASM_REWRITE_TAC[simple_hypermap;node;EXTENSION;INTER;IN_ELIM_THM;orbit_map] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THEN STRIP_TAC +THENL[POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC "EM") +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`x' IN face (hypermap1_of_fanx (x:real^3,V,E)) x'`ASSUME_TAC +THENL[ +REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[POWER;I_DEF;ARITH_RULE`0>=0`]; + SUBGOAL_THEN `face (hypermap1_of_fanx (x,V,E)) x' IN + face_set (hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;orbit_map;face] +THEN EXISTS_TAC`x':real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[]; +MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN REMOVE_THEN"EM"MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x':real^3#real^3#real^3#real^3`) +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN"EM"MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[d1_fan;] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC power_n_fan[`n:num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN MRESAL_TAC DARTSET_LEADS_INTO_SUBSET_WDART_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) x'):real^3#real^3#real^3#real^3->bool`;`x'':real^3#real^3#real^3#real^3`][pr2;pr3;] +THEN MRESAL_TAC DARTSET_LEADS_INTO_SUBSET_WDART_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) x'):real^3#real^3#real^3#real^3->bool`;`x':real^3#real^3#real^3#real^3`][pr2;pr3] +THEN MRESA_TAC power_map_points_edge_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`; `w:real^3`; `n:num`] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) x'):real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC exists_point_in_component_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)` ;`(dartset_leads_into_fan x V E + (face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w))):real^3->bool`] + +THEN MP_TAC(SET_RULE`dartset_leads_into_fan x V E + (face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)) SUBSET + w_dart_fan x V E + (x, + v, + power_map_points sigma_fan x V E v w n, + power_map_points sigma_fan x V E v w (SUC n))/\ + dartset_leads_into_fan x V E + (face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)) SUBSET + w_dart_fan x V E (x,v,w,sigma_fan x V E v w) +/\ z IN + dartset_leads_into_fan x V E + (face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)) +==> ~(w_dart_fan x V E (x,v,w,sigma_fan x V E v w) INTER w_dart_fan x V E + (x, + v, + power_map_points sigma_fan x V E v w n, + power_map_points sigma_fan x V E v w (SUC n)) + ={})`) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[power_map_points] +THEN STRIP_TAC +THEN MRESA_TAC disjoint_fan2[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`; `w:real^3`;`(power_map_points sigma_fan x V E v w n):real^3`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;IN_SING])]]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN_SING] +THEN RESA_TAC +THEN STRIP_TAC +THENL[ +EXISTS_TAC `0` +THEN REWRITE_TAC[ARITH_RULE`0>=0`; POWER;I_DEF]; + +REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC `0` +THEN REWRITE_TAC[ARITH_RULE`0>=0`; POWER;I_DEF]]]);; + + +let N_FAN_GE_0=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> 0<= N_FAN(x,V,E) `, + +REPEAT STRIP_TAC +THEN MRESA_TAC NSUM_EQ_0[`(\f:real^3#real^3#real^3#real^3->bool. 0)`;`face_set (hypermap1_of_fanx (x:real^3,V,E))`] +THEN MRESA_TAC NSUM_LE[`(\f:real^3#real^3#real^3#real^3->bool. 0)`;`(\f:real^3#real^3#real^3#real^3->bool. CARD f - 3)`;`face_set (hypermap1_of_fanx (x:real^3,V,E))`] +THEN REWRITE_TAC[N_FAN] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[FINITE_HYPERMAP_ORBITS] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`x':real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC);; + +let NSUM_EQ_0_IFF = prove + (`!s f. FINITE s ==> (nsum s f = 0 <=> !x. x IN s ==> f x = 0)`, + REPEAT STRIP_TAC THEN EQ_TAC THEN ASM_SIMP_TAC[NSUM_EQ_0] THEN + ASM_MESON_TAC[ARITH_RULE `n = 0 <=> n <= 0`; NSUM_POS_BOUND]);; + + + +let N_FAN_EQ_0_IMP_CARD_FACE_EQ_3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ N_FAN(x,V,E)=0 +/\ ds IN face_set (hypermap1_of_fanx (x,V,E)) +==> CARD ds=3`, + +REWRITE_TAC[N_FAN] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC NSUM_EQ_0_IFF[`face_set (hypermap1_of_fanx (x:real^3,V,E))`;`(\f:real^3#real^3#real^3#real^3->bool. CARD f -3)`][FINITE_HYPERMAP_ORBITS] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`ds:real^3#real^3#real^3#real^3->bool`) +THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC);; + + + + +let version_JUTSTKG=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +==> ?f. f IN face_set (hypermap1_of_fanx (x,V,E)) /\ dartset_leads_into_fan x V E f = U`, + +REPEAT STRIP_TAC +THEN MRESA_TAC JUTSTKG[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN ABBREV_TAC`y=(x,v,u:real^3,sigma_fan x V E v u)` +THEN ABBREV_TAC`ds=face (hypermap1_of_fanx (x:real^3,V,E)) y` +THEN EXISTS_TAC`ds:real^3#real^3#real^3#real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`y IN dart (hypermap1_of_fanx (x:real^3,V,E))`ASSUME_TAC +THENL[ +REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESAL_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`][d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`(sigma_fan x (V:real^3->bool) E v u):real^3` +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN `ds IN face_set (hypermap1_of_fanx (x:real^3,V,E))`ASSUME_TAC +THENL[ + POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;face_set; IN_ELIM_THM;set_of_orbits;face]) +THEN STRIP_TAC +THEN EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`y IN ds:real^3#real^3#real^3#real^3->bool`ASSUME_TAC +THENL[ +EXPAND_TAC"ds" +THEN REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF]; +MRESA_TAC DARTSET_LEADS_INTO_FAN [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN EXPAND_TAC"y" +THEN REWRITE_TAC[pr2;pr3]]]]);; + + +let measurable_dartset_leads_into30_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds e. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ CARD ds=3 +==> measurable((dartset_leads_into_fan x V E ds) INTER ball (x,e))`, +REPEAT STRIP_TAC +THEN MRESA_TAC KVQWYDL_lemma10[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) +THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B=B INTER A`] +THEN MESON_TAC[MEASURABLE_BALL_AFF_GT]);; + + + + + + + +let DWFBRQY=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ N_FAN(x,V,E)=0 +==> conforming_fan (x,V,E)`, + + +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[conforming_fan] +THEN MRESA_TAC N_FAN_EQ_0_IMP_CARD_FACE_EQ_3[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN STRIP_TAC +THENL[ +REWRITE_TAC[conforming_bijection_fan;EXISTS_UNIQUE] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC version_JUTSTKG[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`s:real^3->bool`] +THEN EXISTS_TAC`f:real^3#real^3#real^3#real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC exists_point_dart_leads_into_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`y:real^3#real^3#real^3#real^3->bool`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MA") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `f:real^3#real^3#real^3#real^3->bool`) +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`y:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y' IN y /\ y SUBSET d_fan(x,V,E)==> y' IN d_fan(x,V,E)`) +THEN RESA_TAC +THEN MRESA_TAC KVQWYDL_lemma30[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y':real^3#real^3#real^3#real^3`) +THEN REMOVE_THEN "MA" MP_TAC +THEN ASM_TAC +THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`;`y':real^3#real^3#real^3#real^3`][face] +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x'':real^3#real^3#real^3#real^3`;`y':real^3#real^3#real^3#real^3`][face]; + +STRIP_TAC +THENL[ +REWRITE_TAC[conforming_half_space_fan] +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `f:real^3#real^3#real^3#real^3->bool`) +THEN MRESA_TAC KVQWYDL_lemma10[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th);]) +THEN MRESA_TAC CARD_FACE_SET_EQ_3_FULLY_SURROUNDED_FAN1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN ASM_REWRITE_TAC[SET_RULE`INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y)} | y IN {f1, f2, f3}} += aff_gt {x, pr2 f1, pr3 f1} {pr3 (f1_fan x V E f1)} INTER aff_gt {x, pr2 f2, pr3 f2} {pr3 (f1_fan x V E f2)} INTER aff_gt {x, pr2 f3, pr3 f3} {pr3 (f1_fan x V E f3)}`;SET_RULE`{pr2 y | y IN {f1, f2, f3}}={pr2 f1, pr2 f2, pr2 f3}`] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`pr2 f2:real^3`;`pr2 f3:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(pr2 f1):real^3`;`(pr2 f2):real^3`;`(pr2 f3):real^3`] +THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_1_3[`x:real^3`;`(pr3 f3):real^3`;`(pr3 f1):real^3`;`(pr3 f2):real^3`]; + +STRIP_TAC +THENL[ +REWRITE_TAC[conforming_solid_angle_fan] +THEN REPEAT STRIP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B= B INTER A`] +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `f:real^3#real^3#real^3#real^3->bool`) +THEN MRESA_TAC measurable_dartset_leads_into30_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`;] +THEN MRESA_TAC dartset_leads_into_fan_eventually_radial_norm[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[eventually_radial_norm;eventually_radial;radial_norm; radial;ball_eq_normball] +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC solid_of_dartset_leads_into_fan_triangle_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`;]; + +REWRITE_TAC[conforming_diagonal_fan] +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `f:real^3#real^3#real^3#real^3->bool`) +THEN MRESA_TAC CARD_FACE_SET_EQ_3_FULLY_SURROUNDED_FAN1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr2 f2):real^3`;`(pr2 f1):real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr2 f3):real^3`;`(pr2 f2):real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr2 f1):real^3`;`(pr2 f3):real^3`] +THEN REPEAT DISCH_TAC +THEN MP_TAC(SET_RULE`y IN {f1, f2, f3:real^3#real^3#real^3#real^3} /\ z IN {f1, f2, f3}/\ ~(y = z) +==> (y=f1 /\ z= f2) \/ (y=f1 /\ z= f3) \/ (y=f2 /\ z= f1) \/ (y=f2 /\ z= f3)\/ (y=f3 /\ z= f1) \/ (y=f3 /\ z= f2)` ) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[]]]]);; + + + + +let NEGLIGIBLE_AFF_3=prove(`!x:real^3 v:real^3 u:real^3. + negligible (aff {x,v,u})`, + +MESON_TAC[NEGLIGIBLE_AFFINE_HULL_3;aff]);; + + + + +let NEGLIGIBLE_AFF_GE_2_1=prove(`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u} +==> negligible (aff_ge {x,v} {u})`, + +REPEAT GEN_TAC THEN GEOM_ORIGIN_TAC `x:real^3` THEN +REPEAT STRIP_TAC +THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET +THEN EXISTS_TAC`{w:real^3| (w) dot (e2_fan (vec 0) v u)= &0}` +THEN MRESAL_TAC exp_aff_ge_by_dot[`(vec 0):real^3`;`v:real^3`;`u:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN REWRITE_TAC[SET_RULE`{w | w dot e2_fan (vec 0) v u = &0 /\ &0 <= w dot e1_fan (vec 0) v u} SUBSET + {w | w dot e2_fan (vec 0) v u = &0}`] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN MATCH_MP_TAC NEGLIGIBLE_HYPERPLANE +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESAL_TAC properties_coordinate[`((vec 0):real^3)`;` (v:real^3)`;` (u:real^3)`][orthonormal;DOT_LZERO] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + + +let NEGLIGIBLE_AFF_GE_1_2=prove(`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u} +==> negligible (aff_ge {x} {v,u})`, + +REPEAT STRIP_TAC +THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET +THEN EXISTS_TAC `aff_ge {x,v} {u:real^3}` +THEN MRESA_TAC aff_ge_inter_aff_ge[`x:real^3`;`v:real^3`;`u:real^3`] +THEN ASM_SIMP_TAC[SET_RULE`A INTER B SUBSET A`;NEGLIGIBLE_AFF_GE_2_1]);; + +let NEGLIGIBLE_AFF_GT_1_2=prove(`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u} +==> negligible (aff_gt {x} {v,u})`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET +THEN EXISTS_TAC `aff_ge {x} {v,u:real^3}` +THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]th3) THEN RESA_TAC +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`u:real^3`] +THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_GE_1_2]);; + + + + + + + + + + +let MEASURE_AFF_3=prove(`!x:real^3 v:real^3 u:real^3. + measure (aff {x,v,u})= &0`, + +REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0 +THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_3]);; + + + +let MEASURE_AFF_GT_2_1=prove(`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u}==> measure (aff_gt {x} {v,u})= &0`, + +REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0 +THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_GT_1_2]);; + + +let NEGLIGIBLE_AFF_3_INTER_BALL=prove(`!x:real^3 v:real^3 u:real^3 r:real. +negligible (aff {x,v,u} INTER normball x r)`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET +THEN EXISTS_TAC `aff {x,v,u:real^3}` +THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_3; SET_RULE`A INTER B SUBSET A`]);; + + + + +let NEGLIGIBLE_AFF_GT_1_2_INTER_BALL=prove(`!x:real^3 v:real^3 u:real^3 r:real. +~collinear {x,v,u} +==> negligible (aff_gt {x} {v,u} INTER normball x r)`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET +THEN EXISTS_TAC `aff_gt {x} {v,u:real^3}` +THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_GT_1_2; SET_RULE`A INTER B SUBSET A`]);; + + +let MEASURE_AFF_3_INTER_BALL=prove(`!x:real^3 v:real^3 u:real^3 r:real. + measure (aff {x,v,u} INTER normball x r)= &0`, + +REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0 +THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_3_INTER_BALL]);; + + + +let MEASURE_AFF_GT_2_1_INTER_BALL=prove(`!x:real^3 v:real^3 u:real^3 r:real. +~collinear {x,v,u}==> measure (aff_gt {x} {v,u} INTER normball x r)= &0`, + +REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0 +THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_GT_1_2_INTER_BALL]);; + + +let HAS_MEASURE_AFF_3_INTER_BALL=prove(`!x:real^3 v:real^3 u:real^3 r:real. +(aff {x,v,u} INTER normball x r) has_measure &0`, + +REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_3_INTER_BALL;HAS_MEASURE_0]);; + + +let HAS_MEASURE_AFF_GT_1_2_INTER_BALL=prove(`!x:real^3 v:real^3 u:real^3 r:real. +~collinear {x,v,u}==> (aff_gt {x} {v,u} INTER normball x r) has_measure &0`, + +REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_GT_1_2_INTER_BALL;HAS_MEASURE_0]);; + + +let MEASURABLE_AFF_GT_2_1_INTER_BALL=prove(`!x:real^3 v:real^3 u:real^3 r:real. +~collinear {x,v,u}==> measurable (aff_gt {x} {v,u} INTER normball x r)`, +REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[measurable;] +THEN EXISTS_TAC`&0` +THEN MRESA_TAC HAS_MEASURE_AFF_GT_1_2_INTER_BALL[`x:real^3`;`v:real^3`;`u:real^3`;`r:real`]);; + + +let XFAN_EQ_UNIONS_AFF_GE_1_2=prove(`!x V E. +xfan(x,V,E) =UNIONS {y | ?e. e IN E /\ y = aff_ge {x} e}`, +REWRITE_TAC[xfan;UNIONS;IN_ELIM_THM] +THEN SET_TAC[]);; + + + + +let NEGLIGIBLE_XFAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool). +FAN (x,V,E) ==> negligible (xfan (x,V,E))`, +REPEAT STRIP_TAC THEN REWRITE_TAC[XFAN_EQ_UNIONS_AFF_GE_1_2] THEN MATCH_MP_TAC NEGLIGIBLE_UNIONS +THEN MRESAL_TAC set_edges_is_finite_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`][IN_ELIM_THM] +THEN MRESAL_TAC FINITE_IMAGE[`(\e:real^3->bool. aff_ge {x:real^3} e)`;`E:(real^3->bool)->bool`][IMAGE;] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "EM") +THEN STRIP_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] +THEN ASM_MESON_TAC[NEGLIGIBLE_AFF_GE_1_2]);; + + +let NEGLIGIBLE_XFAN_INTER_BALL=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool) r:real. +FAN (x,V,E) ==> negligible (xfan (x,V,E) INTER normball x r)`, +REPEAT STRIP_TAC THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET +THEN EXISTS_TAC`xfan ((x:real^3),(V:real^3->bool),(E:(real^3->bool)->bool))` +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[NEGLIGIBLE_XFAN;SET_RULE`xfan (x,V,E) INTER normball x r SUBSET xfan (x,V,E)`]);; + + + +let MEASURE_XFAN=prove(`!x:real^3 V E. +FAN (x,V,E) ==> measure (xfan (x,V,E))= &0`, + +REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0 +THEN ASM_SIMP_TAC[NEGLIGIBLE_XFAN]);; + + +let HAS_MEASURE_XFAN=prove(`!x:real^3 V E. +FAN (x,V,E) ==> (xfan (x,V,E)) has_measure &0`, + +REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[NEGLIGIBLE_XFAN;HAS_MEASURE_0]);; + + + +let MEASURE_XFAN_INTER_BALL=prove(`!x:real^3 V E r. +FAN (x,V,E) ==> measure (xfan (x,V,E) INTER normball x r)= &0`, + +REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0 +THEN ASM_SIMP_TAC[NEGLIGIBLE_XFAN_INTER_BALL]);; + + +let HAS_MEASURE_XFAN_INTER_BALL=prove(`!x:real^3 V E r. +FAN (x,V,E) ==> (xfan (x,V,E) INTER normball x r) has_measure &0`, + +REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[NEGLIGIBLE_XFAN_INTER_BALL;HAS_MEASURE_0]);; + + + +let MEASURABLE_BALL_INTER_UNIV=prove(`!x r. measurable ((:real^3) INTER normball x r)`, +REWRITE_TAC[SET_RULE`(:real^3) INTER (A:real^3->bool)=A`;GSYM ball_eq_normball;MEASURABLE_BALL]);; + + + + + + + + +let MEASURE_YFAN_INTER_BALL=prove(`!x:real^3 V E r. +FAN(x,V,E)/\ &0<= r +==> measure ( (yfan (x,V,E)) INTER normball x r)= &4/ &3 *pi *r pow 3`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[yfan;SET_RULE`((:real^3) DIFF xfan (x,V,E)) INTER normball x r= normball x r DIFF (xfan (x,V,E) INTER normball x r)`] +THEN MRESAL_TAC HAS_MEASURE_XFAN_INTER_BALL[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` r:real`][HAS_MEASURE_MEASURABLE_MEASURE;GSYM ball_eq_normball] +THEN MRESAL_TAC MEASURE_DIFF_SUBSET[`normball (x:real^3) (r:real)`;`(xfan ((x:real^3),V:real^3->bool,E) INTER normball x r)`][GSYM ball_eq_normball;MEASURABLE_BALL;SET_RULE`xfan (x,V,E) INTER ball (x,r) SUBSET ball (x,r)`;] +THEN ASM_SIMP_TAC[VOLUME_BALL] +THEN REAL_ARITH_TAC);; + + + + +let MESURABLE_YFAN_INTER_BALL=prove(`!x:real^3 V E r. +FAN(x,V,E)/\ &0<= r +==> measurable ( (yfan (x,V,E)) INTER normball x r)`, + + +REPEAT STRIP_TAC +THEN REWRITE_TAC[yfan;SET_RULE`((:real^3) DIFF xfan (x,V,E)) INTER normball x r= normball x r DIFF (xfan (x,V,E) INTER normball x r)`] +THEN MRESAL_TAC HAS_MEASURE_XFAN_INTER_BALL[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` r:real`][HAS_MEASURE_MEASURABLE_MEASURE;GSYM ball_eq_normball] +THEN MRESAL_TAC MEASURABLE_DIFF[`normball (x:real^3) (r:real)`;`(xfan ((x:real^3),V:real^3->bool,E) INTER normball x r)`][GSYM ball_eq_normball;MEASURABLE_BALL;SET_RULE`xfan (x,V,E) INTER ball (x,r) SUBSET ball (x,r)`;]);; + + + + + + +let RADIAL_DIFF=prove(`!r v0 A B:real^N->bool. radial_norm r v0 A /\ radial_norm r v0 B /\ A SUBSET B ==> radial_norm r v0 (B DIFF A)`, + +REWRITE_TAC[radial_norm] +THEN REPEAT STRIP_TAC +THENL[ +ASM_TAC THEN SET_TAC[]; + +MP_TAC(SET_RULE`v0 + u:real^N IN B DIFF A==> v0 + u IN B /\ ~(v0 + u IN A)`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC `!u:real^N. v0 + u IN B ==> (!t. t > &0 /\ t * norm u < r ==> v0 + t % u IN B)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC `u:real^N` th)) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `t:real`) +THEN FIND_ASSUM MP_TAC `!u:real^N. v0 + u IN A ==> (!t. t > &0 /\ t * norm u < r ==> v0 + t % u IN A)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC `t% u:real^N` th)) +THEN DISJ_CASES_TAC(SET_RULE`v0 + t % u IN A \/ ~(v0 + t % u:real^N IN A)`) +THENL[POP_ASSUM (fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `inv t:real`) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`t> &0==> ~(t= &0) /\ &0<= t`) THEN RESA_TAC +THEN MRESA1_TAC REAL_ABS_REFL`t:real` +THEN MRESA1_TAC REAL_MUL_LINV`t:real` +THEN MRESAL1_TAC REAL_LT_INV `t:real`[REAL_ARITH`&0
A> &0`;NORM_MUL; REAL_ARITH`A*B*C=(A*B)*C`;REAL_ARITH`&1 *A=A`;VECTOR_ARITH`A % B%C=(A*B)%C`;VECTOR_ARITH`&1 %A=A`] +THEN MP_TAC(SET_RULE`B SUBSET normball v0 r /\ v0 + u:real^N IN B==> v0 + u IN normball v0 r`) +THEN ASM_REWRITE_TAC[normball;IN_ELIM_THM;dist;VECTOR_ARITH`(A+B)-A=B:real^N`] +THEN SET_TAC[]; + +ASM_TAC THEN SET_TAC[]]]);; + + + + +let RADIAL_UNION=prove(`!r v0 A B:real^N->bool. radial_norm r v0 A /\ radial_norm r v0 B ==> radial_norm r v0 (A UNION B)`, + +REWRITE_TAC[radial_norm;IN_UNION] +THEN REPEAT STRIP_TAC +THEN ASM_TAC THEN SET_TAC[]);; + + +let RADIAL_EMPTY=prove(`!r v0:real^N. radial_norm r v0 {}`, +REWRITE_TAC[radial_norm;] +THEN SET_TAC[]);; + + +let RADIAL_UNIONS=prove(`!r v0 f:(real^N->bool)->bool. + FINITE f /\ (!s. s IN f ==> radial_norm r v0 s) + ==> (radial_norm r v0 (UNIONS f))`, + GEN_TAC THEN GEN_TAC THEN REWRITE_TAC[IMP_CONJ] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + SIMP_TAC[UNIONS_0; UNIONS_INSERT; RADIAL_EMPTY] THEN + REWRITE_TAC[IN_INSERT] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC RADIAL_UNION THEN ASM_SIMP_TAC[]);; + + + +let RADIAL_UNIV=prove(`!r x. r> &0 ==> radial_norm r x ((:real^N) INTER normball x r)`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[radial_norm] +THEN REPEAT STRIP_TAC +THENL +[ SET_TAC[]; +UNDISCH_TAC `(x:real^N) + u IN (:real^N) INTER normball x r` THEN +ASM_SIMP_TAC[aff_normball;SET_RULE`(:real^N) INTER (A:real^N->bool)=A`]]);; + + + + +let RADIAL_AFF_GE_1_2 = prove(`!x u v r. + (DISJOINT {(x:real^B)} {u,v} /\ (r > &0) ) ==> + radial_norm r x (aff_ge {x} {u,v} INTER normball x r)`, + +REWRITE_TAC[radial_norm] +THEN REPEAT STRIP_TAC +THENL[SET_TAC[]; + +UNDISCH_TAC `(x:real^B) + u' IN aff_ge {x} {u, v} INTER normball x r` +THEN ASM_SIMP_TAC[AFF_GE_1_2] +THEN REWRITE_TAC[IN_ELIM_THM;IN_INTER] +THEN REPEAT STRIP_TAC +THENL[EXISTS_TAC `&1 + (t:real) * t1 - t` +THEN EXISTS_TAC `(t:real) * t2` +THEN EXISTS_TAC `(t:real) * t3` +THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 + t * t1 - t) + t * t2 + t * t3 = &1 + t * (t1 + t2 +t3)-t `; REAL_ARITH`&1 + t * &1 - t = &1`;VECTOR_ARITH`(&1 + t * t1 - t) % x + (t * t2) % u + (t * t3) % v=x + t % (t1 % x + t2 % u + t3 % v) - t %x`;] +THEN MP_TAC(REAL_ARITH`t> &0 ==> &0<= t`) THEN RESA_TAC +THEN SUBGOAL_THEN `&0 <= t * t2 /\ &0 <= t * t3` (fun t -> REWRITE_TAC[t]) +THENL[ ASM_MESON_TAC[REAL_LE_MUL]; +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN VECTOR_ARITH_TAC]; + +MATCH_MP_TAC aff_normball +THEN ASM_REWRITE_TAC[]]]);; + +let RADIAL_AFF_GT_3_1 = prove_by_refinement(`!x u v w r. + (DISJOINT {(x:real^B),u,v} {w} /\ (r > &0) ) ==> + radial_norm r x (aff_gt {x,u,v} {w} INTER normball x r)`, +[ +REWRITE_TAC[radial_norm]; +REPEAT STRIP_TAC; +SET_TAC[]; +UNDISCH_TAC `(x:real^B) + u' IN aff_gt {x,u,v} {w} INTER normball x r`; +ASM_SIMP_TAC[AFF_GT_3_1]; +REWRITE_TAC[IN_ELIM_THM;IN_INTER]; +REPEAT STRIP_TAC; +EXISTS_TAC `&1 + (t:real) * t1 - t`; +EXISTS_TAC `(t:real) * t2`; +EXISTS_TAC `(t:real) * t3`; +EXISTS_TAC `(t:real) * t4`; +SUBGOAL_THEN `&0 < t * t4` (fun t -> REWRITE_TAC[t]); +ASM_MESON_TAC[REAL_MUL_POS_LT;REAL_ARITH `r > &0 <=> &0 < r`]; +CONJ_TAC; +SUBGOAL_THEN `(&1 + t * t1 - t) + t * t2 + t * t3 + t * t4 = &1 - t + t * (t1 + t2 + t3 + t4)` (fun t-> ASM_REWRITE_TAC[t]); +REAL_ARITH_TAC; +REAL_ARITH_TAC; +ONCE_REWRITE_TAC[ VECTOR_ARITH `( &1 + t * t1 - t) % (x:real^B) + (t * t2) % u + (t * t3) % v + (t * t4) % w = x - t % x + t % (t1 % x + t2 % u + t3 % v + t4 % w)`]; +UNDISCH_TAC `(x:real^B) + u' = t1 % x + t2 % u + t3 % v + t4 % w`; +DISCH_THEN(fun thm -> ONCE_REWRITE_TAC[GSYM thm]); +VECTOR_ARITH_TAC; +MATCH_MP_TAC aff_normball; +ASM_REWRITE_TAC[]; +]);; + + +let RADIAL_INTERS=prove(`!r v0 f:(real^N->bool)->bool. + FINITE f /\ (!s. s IN f ==> radial_norm r v0 (s INTER normball v0 r))/\ r> &0 + ==> (radial_norm r v0 (INTERS f INTER normball v0 r))`, + + GEN_TAC THEN GEN_TAC THEN REWRITE_TAC[IMP_CONJ] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + SIMP_TAC[ INTERS_0; INTERS_INSERT;RADIAL_UNIV;FORALL_IN_CLAUSES] THEN + REWRITE_TAC[IN_INSERT;SET_RULE`(x INTER INTERS f) INTER normball v0 r=(x INTER normball v0 r) INTER (INTERS f INTER normball v0 r)`] THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC inter_radial THEN ASM_SIMP_TAC[]);; + + + + + +let XFAN_INTER_BALL_UNIONS=prove(`!x:real^N V E. +xfan(x,V,E) INTER normball x r= UNIONS {y | ?e. e IN E /\ y = (aff_ge {x} e) INTER normball x r}`, +REPEAT GEN_TAC +THEN REWRITE_TAC[XFAN_EQ_UNIONS_AFF_GE_1_2] +THEN ONCE_REWRITE_TAC[ EXTENSION] +THEN REWRITE_TAC[UNIONS; INTER;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC `{x' | x' IN aff_ge {x} e /\ x' IN normball (x:real^N) (r:real)}` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC THEN RESA_TAC +THEN EXISTS_TAC`e:real^N->bool` +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC +THEN EXISTS_TAC `aff_ge {x:real^N} e ` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC `e:real^N->bool` +THEN ASM_REWRITE_TAC[]]);; + + +let RADIAL_XFAN_INTER_BALL=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) r. +FAN (x,V,E) /\ r> &0 ==> radial_norm r x (xfan (x,V,E) INTER normball x r)`, +REPEAT STRIP_TAC THEN REWRITE_TAC[XFAN_INTER_BALL_UNIONS] + THEN MATCH_MP_TAC RADIAL_UNIONS +THEN MRESAL_TAC set_edges_is_finite_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`][IN_ELIM_THM] +THEN MRESAL_TAC FINITE_IMAGE[`(\e:real^3->bool. aff_ge {x:real^3} e INTER normball x r)`;`E:(real^3->bool)->bool`][IMAGE;] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "EM") +THEN STRIP_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] +THEN ASM_MESON_TAC[RADIAL_AFF_GE_1_2]);; + + + + + +let RADIAL_NORM_YFAN_INTER_BALL=prove(`!x:real^3 V E r. +FAN(x,V,E) /\ r> &0 +==> radial_norm r x ( (yfan (x,V,E)) INTER normball x r)`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[yfan;SET_RULE`((:real^3) DIFF xfan (x,V,E)) INTER normball x r= ((:real^3) INTER normball x r) DIFF (xfan (x,V,E) INTER normball x r)`] +THEN MRESA_TAC RADIAL_UNIV[`r:real`;`x:real^3`] +THEN MRESA_TAC RADIAL_XFAN_INTER_BALL[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` r:real`] +THEN MRESAL_TAC RADIAL_DIFF[`r:real`;`x:real^3`;`(xfan ((x:real^3),V:real^3->bool,E) INTER normball x r)`;`(:real^3) INTER normball (x:real^3) (r:real)`;][SET_RULE`xfan (x,V,E) INTER normball x r SUBSET (:real^3) INTER normball x r`;]);; + + + + + + + +let SOLID_ANGLE_YFAN=prove(`!x:real^3 V E. +FAN (x,V,E) ==> sol x (yfan (x,V,E))= &4 * pi`, +REPEAT STRIP_TAC +THEN MRESAL_TAC RADIAL_NORM_YFAN_INTER_BALL[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` &1:real`][REAL_ARITH`&1> &0`] +THEN MRESAL_TAC MESURABLE_YFAN_INTER_BALL +[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` &1:real`][REAL_ARITH`&0<= &1`] +THEN MRESAL_TAC MEASURE_YFAN_INTER_BALL +[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` &1:real`][REAL_ARITH`&0<= &1`] +THEN MRESAL_TAC sol[`x:real^3`;`yfan(x:real^3,V:real^3->bool,E)`;`&1`][REAL_ARITH`&1> &0`] +THEN REAL_ARITH_TAC);; + + + +let SUM_SOL_IN_TOPOLOGICAL_COMPONENET_EQ_IN_FACE_SET=prove(`!x:real^3 V E. +FAN(x,V,E) /\ conforming_fan (x,V,E) +==> sum (topological_component_yfan (x,V,E)) (\f. sol x f) = sum (face_set (hypermap1_of_fanx (x,V,E))) (\f. sol x (dartset_leads_into_fan x V E f))`, +REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC SUM_IMAGE[`(\f. (dartset_leads_into_fan x V E f))`;`(\f. sol x f)`;`(face_set (hypermap1_of_fanx (x:real^3,V,E)))`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`(!x' y. + x' IN face_set (hypermap1_of_fanx (x,V,E)) /\ + y IN face_set (hypermap1_of_fanx (x,V,E)) /\ + dartset_leads_into_fan x V E x' = dartset_leads_into_fan x V E y + ==> x' = y)`ASSUME_TAC +THENL[ +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "A") +THEN REPEAT STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`x':real^3#real^3#real^3#real^3->bool`] +THEN REMOVE_THEN "A" (fun th-> MRESA1_TAC th`dartset_leads_into_fan (x:real^3) V E x'` ) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3->bool` THEN MRESA1_TAC th`x':real^3#real^3#real^3#real^3->bool`); +POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[FUN_EQ_THM;o_DEF;] +THEN SUBGOAL_THEN`(IMAGE (\f. dartset_leads_into_fan x V E f) + (face_set (hypermap1_of_fanx (x,V,E))))=topological_component_yfan (x,V,E)` ASSUME_TAC +THENL[ + ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL[STRIP_TAC +THEN ASM_SIMP_TAC[dartset_leads_into_is_topological_component_yfan]; + +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "A") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "A" (fun th-> MRESA1_TAC th`x':real^3->bool` ) +THEN EXISTS_TAC`f:real^3#real^3#real^3#real^3->bool` +THEN ASM_REWRITE_TAC[]]; +ASM_REWRITE_TAC[]]]);; + + + + +let SOL_EMPTY=prove(`!x:real^3. + sol x {} = &0`, +GEN_TAC +THEN MRESAL_TAC sol[`x:real^3`;`{}:real^3->bool`;`&1`][REAL_ARITH`&1> &0`;SET_RULE`{} INTER normball x (&1)={}`;MEASURABLE_EMPTY;RADIAL_EMPTY;MEASURE_EMPTY] +THEN REAL_ARITH_TAC);; + + + +let SOL_DISJOINT_UNION =prove(`!x:real^3 s t r. r > &0 /\ measurable (s INTER normball x r) /\ measurable (t INTER normball x r) /\ DISJOINT s t /\ radial_norm r x (s INTER normball x r) /\ radial_norm r x (t INTER normball x r) + ==> sol x (s UNION t) = sol x s + sol x t`, + +REPEAT STRIP_TAC +THEN MRESAL_TAC MEASURABLE_UNION[`(s INTER normball x r):real^3->bool`;`(t INTER normball x r):real^3->bool`][SET_RULE`(s INTER normball x r) UNION (t INTER normball x r):real^3->bool=((s UNION t) INTER normball x r):real^3->bool`] +THEN MP_TAC(SET_RULE`DISJOINT (s:real^3->bool) t +==>DISJOINT (s INTER normball x r) (t INTER normball x r)`) +THEN RESA_TAC +THEN MRESAL_TAC MEASURE_DISJOINT_UNION[`(s INTER normball x r):real^3->bool`;`(t INTER normball x r):real^3->bool`][SET_RULE`(s INTER normball x r) UNION (t INTER normball x r):real^3->bool=((s UNION t) INTER normball x r):real^3->bool`] +THEN MRESAL_TAC RADIAL_UNION[`r:real`;`x:real^3`;`(s INTER normball x r):real^3->bool`;`(t INTER normball x r):real^3->bool`][SET_RULE`(s INTER normball x r) UNION (t INTER normball x r):real^3->bool=((s UNION t) INTER normball x r):real^3->bool`] +THEN MRESA_TAC sol[`x:real^3`;`s:real^3->bool`;`r:real`] +THEN MRESA_TAC sol[`x:real^3`;`t:real^3->bool`;`r:real`] +THEN MRESA_TAC sol[`x:real^3`;`s UNION t:real^3->bool`;`r:real`] +THEN REAL_ARITH_TAC);; + + +let UNIONS_INTER=prove(`!f t:A->bool. UNIONS f INTER t= UNIONS {s INTER t| s IN f}`, + +ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[UNIONS;INTER;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`{x | x IN u /\ x IN t}:A->bool` +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`u :A->bool` +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC +THEN EXISTS_TAC`s :A->bool` +THEN ASM_REWRITE_TAC[]]);; + + + + + + +let UNIONS_INTER1=prove(`!f t:A->bool. UNIONS f INTER t= UNIONS {y | ?s. s IN f /\ y = s INTER t}`, + +ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[UNIONS;INTER;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`{x | x IN u /\ x IN t}:A->bool` +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`u :A->bool` +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC +THEN EXISTS_TAC`s :A->bool` +THEN ASM_REWRITE_TAC[]]);; + + + +let MEASURABLE_UNIONS = prove + (`!f:(real^N->bool)->bool. + FINITE f /\ (!s. s IN f ==> measurable s) + ==> measurable (UNIONS f)`, + REWRITE_TAC[IMP_CONJ] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + SIMP_TAC[UNIONS_0; UNIONS_INSERT; MEASURABLE_EMPTY] THEN + REWRITE_TAC[IN_INSERT] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC MEASURABLE_UNION THEN ASM_SIMP_TAC[]);; + + + +let SOL_UNIONS=prove(`!r x f:(real^3->bool)->bool. + FINITE f /\ r> &0 /\ + (!s. s IN f ==> measurable (s INTER normball x r) /\ radial_norm r x (s INTER normball x r)) /\ + (!s t. s IN f /\ t IN f /\ ~(s = t) ==> DISJOINT s t) + ==> sol x (UNIONS f) = sum f (\s. sol x s)`, +GEN_TAC THEN GEN_TAC THEN REWRITE_TAC[IMP_CONJ] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + SIMP_TAC[UNIONS_0; UNIONS_INSERT; SOL_EMPTY;SUM_CLAUSES] +THEN REWRITE_TAC[IN_INSERT] THEN REPEAT STRIP_TAC +THEN ASM_TAC THEN DISCH_THEN(LABEL_TAC"EM") +THEN ASM_REWRITE_TAC[SET_RULE`(!s. P s \/ Q s==> C s)<=> (!s. P s ==> C s) /\ (!s. Q s ==> C s)`;SET_RULE`(!s. P s /\ Q s) <=> (!s. P s) /\ (!s. Q s)`; +SET_RULE`(!s. E s ==> P s \/ Q s==> C s)<=> (!s. E s==> P s ==> C s) /\ (!s. E s ==> Q s ==> C s)`] +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MATCH_MP_TAC SOL_DISJOINT_UNION +THEN EXISTS_TAC`r:real` +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM (fun th-> MP_TAC (SPEC `x':real^3->bool` th))`!s:real^3->bool. s = x' + ==> measurable (s INTER normball x r) /\ + radial_norm r x (s INTER normball x r)` +THEN REWRITE_TAC[] +THEN DISCH_TAC +THEN ASM_SIMP_TAC[UNIONS_INTER1] +THEN MRESAL_TAC FINITE_IMAGE[`(\s:real^3->bool. s INTER normball x r)`;`f:(real^3->bool)->bool`][IMAGE;] +THEN FIND_ASSUM MP_TAC`!s:real^3->bool. s IN f + ==> measurable (s INTER normball x r) /\ + radial_norm r x (s INTER normball x r)` + +THEN REWRITE_TAC[SET_RULE`(!s. P s==> Q s /\ Q1 s)<=>(!s. P s==> Q s )/\ (!s. P s==> Q1 s)`] +THEN STRIP_TAC + +THEN MRESAL_TAC RADIAL_UNIONS[`r:real`;`x:real^3`;`{y | ?s. s IN f /\ y = s INTER normball x r}:(real^3->bool)->bool`;][IN_ELIM_THM;SET_RULE`(!s. (?s'. s' IN f /\ s = P s') ==> Q s) <=> (!s. s IN f ==> Q (P s))` +] +THEN MRESAL_TAC MEASURABLE_UNIONS[`{y | ?s. s IN f /\ y = s INTER normball x r}:(real^3->bool)->bool`;][IN_ELIM_THM;SET_RULE`(!s. (?s'. s' IN f /\ s = P s') ==> Q s) <=> (!s. s IN f ==> Q (P s))`;DISJOINT] +THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B= B INTER A`] +THEN REWRITE_TAC[UNIONS_INTER1] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th `x':real^3->bool`[SET_RULE` (!t. t IN f ==> ~(x' = t) ==> DISJOINT x' t) +<=> (!t. t IN f /\ ~(x' = t) ==> DISJOINT x' t)`]) +THEN FIND_ASSUM MP_TAC`~((x':real^3->bool) IN f)` +THEN REWRITE_TAC[SET_RULE`~(x' IN f)<=> (!t. t IN f ==> ~(x' = t))`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` (!t. t IN f /\ ~(x' = t:real^3->bool) ==> DISJOINT x' t) /\ +(!t. t IN f ==> ~(x' = t:real^3->bool))==> (!t. t IN f ==> DISJOINT x' t)`) +THEN ASM_REWRITE_TAC[DISJOINT] +THEN SET_TAC[]);; + +let BOUNDED_INTER_BALL=prove(`!x:real^3 V E. +FAN(x,V,E) /\ conforming_fan (x,V,E) +==>(!f. f IN topological_component_yfan (x,V,E) + ==> bounded (f INTER normball x r)) `, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC BOUNDED_SUBSET +THEN EXISTS_TAC`(normball x r):real^3->bool` +THEN SIMP_TAC[GSYM ball_eq_normball;BOUNDED_BALL] +THEN SET_TAC[]);; + + +let OPEN_AFF_GT_3_1=prove(`!x v u w:real^3. + (~coplanar {x,v,u,w}) ==> open (aff_gt {x,v,u} {w})`, + + GEOM_ORIGIN_TAC `x:real^3` THEN + REPEAT STRIP_TAC THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN DISCH_TAC THEN +MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] THEN DISCH_TAC THEN ASSUME_TAC th) +THEN MRESAL_TAC coplanar_cross_dot[`vec 0:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN MP_TAC (REAL_ARITH`~((v cross u) dot w = &0)==> &0< (v cross u) dot w \/ &0< --((v cross u) dot w)`) +THEN RESA_TAC +THENL[POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN DISCH_TAC THEN ASSUME_TAC th) THEN ASSUME_TAC th) +THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`][VECTOR_ARITH`A- vec 0=A`;] +THEN REWRITE_TAC[REAL_ARITH`&0 A> &0`; OPEN_HALFSPACE_GT]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM DOT_LNEG] +THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] +THEN ASM_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`(vec 0):real^3`;`u:real^3`;`v:real^3`;`w:real^3`][VECTOR_ARITH`A- vec 0=A`;] +THEN REWRITE_TAC[ REAL_ARITH`&0 A> &0`;OPEN_HALFSPACE_GT;] ]);; + + + + +let EQ_SET_THM=prove(`!f' f.{(f:A->B) y| y IN f'}= {t|(?y. y IN f' /\ t = f y)}`, +ONCE_REWRITE_TAC[EXTENSION] THEN REWRITE_TAC[IN_ELIM_THM]);; + + +let fully_surrounded_imp_aff_gt_3_1_of_dart_eq_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set (hypermap1_of_fanx (x,V,E)) +/\ y IN ds +==> aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y)} = + aff_gt {x, pr2 y, pr3 y} {sigma_fan x V E (pr2 y) (pr3 y)}`, + +REPEAT STRIP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y IN ds /\ ds SUBSET d1_fan(x,V,E)==> y IN d1_fan (x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr2;pr3;f1_fan] +THEN ASM_SIMP_TAC[fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan]);; + + + + + +let OPEN_TOPOLOGICAL_COMPONENT_YFAN=prove(`!x:real^3 V E f. +FAN(x,V,E) /\ conforming_fan (x,V,E)/\ f IN topological_component_yfan (x,V,E) + ==> open f`, +REWRITE_TAC[conforming_fan;conforming_bijection_fan;conforming_half_space_fan] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "EM" (fun th-> MRESAL1_TAC th`f:real^3->bool`[EXISTS_UNIQUE]) +THEN REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th`f':real^3#real^3#real^3#real^3->bool`) +THEN MATCH_MP_TAC OPEN_INTERS +THEN ASM_REWRITE_TAC[IN_ELIM_THM;] +THEN MRESA_TAC FINITE_FACE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f':real^3#real^3#real^3#real^3->bool`] +THEN MRESAL_TAC FINITE_IMAGE[`(\y:real^3#real^3#real^3#real^3. aff_gt {x:real^3, pr2 y, pr3 y} {pr3 (f1_fan x V E y)})`;`f':real^3#real^3#real^3#real^3->bool`][IMAGE;EQ_SET_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_dart_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f':real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`] +THEN MATCH_MP_TAC OPEN_AFF_GT_3_1 +THEN MRESA_TAC properties_of_elements_in_face_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f':real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`(pr2 y):real^3`;`(pr3 y):real^3`] ) +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`(pr2 y):real^3`;`(pr3 y):real^3`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`(pr2 y):real^3`;`(pr3 y):real^3`] +THEN DISCH_TAC +THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`(pr2 y):real^3`;`(sigma_fan x V E (pr2 y) (pr3 y)):real^3`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E (pr2 y) (pr3 y)):real^3`;`(pr2 y):real^3`;`(pr3 y):real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN ASM_REWRITE_TAC[]);; + + +let OPEN_TOPOLOGICAL_COMPONENT_YFAN_INTER_BALL=prove(`!x:real^3 V E f. +FAN(x,V,E) /\ conforming_fan (x,V,E)/\ f IN topological_component_yfan (x,V,E) + ==> open (f INTER normball x r)`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC OPEN_INTER +THEN ASM_SIMP_TAC[GSYM ball_eq_normball;OPEN_BALL;] +THEN ASM_MESON_TAC[OPEN_TOPOLOGICAL_COMPONENT_YFAN]);; + + +let MEASURABLE_TOPOLOGICAL_COMPONENT_YFAN_INTER_BALL=prove(`!x:real^3 V E r f. +FAN(x,V,E) /\ conforming_fan (x,V,E) /\ f IN topological_component_yfan (x,V,E) + ==> measurable (f INTER normball x r) `, + +REPEAT STRIP_TAC +THEN MATCH_MP_TAC MEASURABLE_OPEN +THEN ASM_MESON_TAC[OPEN_TOPOLOGICAL_COMPONENT_YFAN_INTER_BALL;BOUNDED_INTER_BALL]);; + + + +let RADIAL_TOPOLOGICAL_COMPONENT_YFAN=prove(`!x:real^3 V E r f. +FAN(x,V,E) /\ r> &0 /\ conforming_fan (x,V,E) /\ f IN topological_component_yfan (x,V,E) + ==> radial_norm r x (f INTER normball x r) `, + +REWRITE_TAC[conforming_fan;conforming_bijection_fan;conforming_half_space_fan] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "EM" (fun th-> MRESAL1_TAC th`f:real^3->bool`[EXISTS_UNIQUE]) +THEN REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th`f':real^3#real^3#real^3#real^3->bool`) +THEN MATCH_MP_TAC RADIAL_INTERS +THEN ASM_REWRITE_TAC[IN_ELIM_THM;] +THEN MRESA_TAC FINITE_FACE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f':real^3#real^3#real^3#real^3->bool`] +THEN MRESAL_TAC FINITE_IMAGE[`(\y:real^3#real^3#real^3#real^3. aff_gt {x:real^3, pr2 y, pr3 y} {pr3 (f1_fan x V E y)})`;`f':real^3#real^3#real^3#real^3->bool`][IMAGE;EQ_SET_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_dart_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f':real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`] +THEN MATCH_MP_TAC RADIAL_AFF_GT_3_1 +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC properties_of_elements_in_face_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f':real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`(pr2 y):real^3`;`(pr3 y):real^3`] ) +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`(pr2 y):real^3`;`(pr3 y):real^3`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`(pr2 y):real^3`;`(pr3 y):real^3`] +THEN DISCH_TAC +THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`(pr2 y):real^3`;`(sigma_fan x V E (pr2 y) (pr3 y)):real^3`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E (pr2 y) (pr3 y)):real^3`;`(pr2 y):real^3`;`(pr3 y):real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN ASM_REWRITE_TAC[] +THEN ASM_MESON_TAC[notcoplanar_disjoints]);; + + +let FINITE_TOPOLOGICAL_COMPONENT_YFAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +==> FINITE (topological_component_yfan (x,V,E))`, +REPEAT STRIP_TAC +THEN MRESA1_TAC FINITE_HYPERMAP_ORBITS`hypermap1_of_fanx (x:real^3,V,E)` +THEN MRESAL_TAC FINITE_IMAGE[`(\f:real^3#real^3#real^3#real^3->bool. dartset_leads_into_fan x V E f)`;`face_set (hypermap1_of_fanx (x:real^3,V,E))`][IMAGE;] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`{y | ?f. f IN face_set (hypermap1_of_fanx (x,V,E)) /\ + y = dartset_leads_into_fan x V E f} =topological_component_yfan (x:real^3,V,E)` (fun th-> REWRITE_TAC[th]) +THEN ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC THEN EQ_TAC +THENL[ +REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[dartset_leads_into_is_topological_component_yfan]; + +REPEAT STRIP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A=B<=> B=A`] +THEN ASM_SIMP_TAC[version_JUTSTKG]]);; + + +let SUM_SOL_TOPOLOGICAL_COMPONENT_YFAN_EQ_SOL_UNIONS=prove(`!x:real^3 V E. +FAN(x,V,E) /\ conforming_fan (x,V,E) +==> sol x (UNIONS (topological_component_yfan (x,V,E)))=sum (topological_component_yfan (x,V,E)) (\f. sol x f)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[conforming_fan]; THEN ASSUME_TAC th THEN STRIP_TAC) +THEN MATCH_MP_TAC SOL_UNIONS +THEN MRESAL_TAC FINITE_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;][SET_RULE`(!s. P s==> Q s /\ R s)<=>(!s. P s==> Q s) /\(!s. P s==> R s)`] +THEN EXISTS_TAC`&1` +THEN MRESAL_TAC RADIAL_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`&1:real`][REAL_ARITH`&1> &0`] +THEN MRESA_TAC MEASURABLE_TOPOLOGICAL_COMPONENT_YFAN_INTER_BALL[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`&1:real`] +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DISJOINT;CONNECTED_COMPONENT_NONOVERLAP]);; + +let UNIONS_TOPOLOGICAL_COMPONENT_EQ_YFAN=prove(`!x:real^3 V E. + UNIONS (topological_component_yfan (x,V,E))= yfan(x,V,E)`, + ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[UNIONS;topological_component_yfan;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MATCH_MP_TAC(SET_RULE`!x B A. x IN B /\ B SUBSET A==> x IN A`) +THEN EXISTS_TAC`connected_component (yfan (x:real^3,V:real^3->bool,E)) (y:real^3)` +THEN ASM_REWRITE_TAC[CONNECTED_COMPONENT_SUBSET]; +STRIP_TAC +THEN EXISTS_TAC`connected_component (yfan (x,V:real^3->bool,E)) x'` +THEN STRIP_TAC +THENL[EXISTS_TAC`x':real^3` +THEN ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[IN;CONNECTED_COMPONENT_REFL_EQ]]]);; + + +let SUM_SOL_IN_FACE_SET_EQ_4PI=prove(`!x:real^3 V E. +FAN(x,V,E) /\ conforming_fan (x,V,E) +==> sum (face_set (hypermap1_of_fanx (x,V,E))) (\f. sol x (dartset_leads_into_fan x V E f))= &4 * pi`, + +REPEAT STRIP_TAC +THEN MRESA_TAC SUM_SOL_IN_TOPOLOGICAL_COMPONENET_EQ_IN_FACE_SET[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC SUM_SOL_TOPOLOGICAL_COMPONENT_YFAN_EQ_SOL_UNIONS[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;UNIONS_TOPOLOGICAL_COMPONENT_EQ_YFAN]) +THEN ASM_SIMP_TAC[SOLID_ANGLE_YFAN]);; + + + + +let DART_EQ_UNIONS_FACE_SET_NODE_SET_EDGE_SET=prove(`!(H:(A)hypermap). dart H = UNIONS (face_set H)/\ dart H = UNIONS (node_set H)/\ dart H = UNIONS (edge_set H)`, + GEN_TAC THEN REWRITE_TAC[face_set;node_set;edge_set] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC lemma_partition +THEN REWRITE_TAC[hypermap_lemma]);; + + + +let FINITE_NODE_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +ds IN node_set(hypermap1_of_fanx (x,V,E)) +==> FINITE ds `, +REWRITE_TAC[node_set;set_of_orbits;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[GSYM node;NODE_FINITE]);; + + +let lemma_properties_of_node_set_fan=prove(`!x V E f y y1. FAN (x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1)/\ + f IN (node_set (hypermap1_of_fanx (x,V,E)) ) +/\ y IN f /\ y1 IN f +==> pr2 y = pr2 y1 `, + +REWRITE_TAC[node_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN ASM_REWRITE_TAC[orbit_map;IN_ELIM_THM;] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`;] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x':real^3#real^3#real^3#real^3`) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n':num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`;] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x':real^3#real^3#real^3#real^3`) +THEN FIND_ASSUM MP_TAC `x' IN d1_fan (x:real^3,V,E)` +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN MRESA_TAC power_n_fan[`n:num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC power_n_fan[`n':num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[pr2]);; + + + + +let lemma_node_identity_fan=prove(`!x V E f y. f IN (node_set (hypermap1_of_fanx (x,V,E)) ) + /\ y IN f +==> f= node (hypermap1_of_fanx (x,V,E)) y`, +REWRITE_TAC[node_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[node] +THEN MESON_TAC[lemma_orbit_identity; hypermap_lemma]);; + + +let node_subset_dart_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ ds IN node_set(hypermap1_of_fanx (x,V,E)) +==> ds SUBSET d_fan (x,V,E)`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA_TAC lemma_node_representation[`hypermap1_of_fanx(x:real^3,V,E)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC lemma_node_subset[`hypermap1_of_fanx(x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`]);; + + + + + + +let rep_node_set_fan=prove(`!x V E f y. FAN (x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ f IN (node_set (hypermap1_of_fanx (x,V,E)) ) + /\ y IN f +==> f = {z| ?i. i >= 0 /\ z=(x, pr2 y,power_map_points (sigma_fan) x V E (pr2 y) (pr3 y) i, power_map_points (sigma_fan) x V E (pr2 y) (pr3 y) (SUC i))}`, + + REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[lemma_node_identity_fan;] +THEN REWRITE_TAC[node;orbit_map;EXTENSION;IN_ELIM_THM] +THEN MRESA_TAC node_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MP_TAC(SET_RULE`y IN (f:real^3#real^3#real^3#real^3->bool) /\ f SUBSET d_fan(x,V,E)==> y IN d_fan(x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr2;pr3] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`;] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3`) +THEN MRESA_TAC power_n_fan[`n:num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN RESA_TAC +THEN EXISTS_TAC`n:num` +THEN ASM_SIMP_TAC[]; + +REPEAT STRIP_TAC +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`i:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`;] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3`) +THEN MRESA_TAC power_n_fan[`i:num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN RESA_TAC]);; + + +let properties_of_elements_in_node_fully_surroundedfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ ds IN node_set(hypermap1_of_fanx (x,V,E)) +/\ y IN ds +==> {pr2 y, pr3 y} IN E`, + +REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA_TAC node_subset_dart_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y IN ds /\ ds SUBSET d_fan (x,V,E)==> y IN d_fan (x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr2;pr3]);; + + +let lemma_card_node_eq_set_of_orbits=prove(`!x V E f y. FAN (x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ f IN (node_set (hypermap1_of_fanx (x,V,E)) ) + /\ y IN f +==> CARD {z| ?i. i >= 0 /\ z=(x, pr2 y,power_map_points (sigma_fan) x V E (pr2 y) (pr3 y) i, power_map_points (sigma_fan) x V E (pr2 y) (pr3 y) (SUC i))}= CARD( set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) ((pr2 y):real^3) ((pr3 y):real^3) +)`, + + REPEAT STRIP_TAC +THEN MATCH_MP_TAC BIJECTIONS_CARD_EQ +THEN EXISTS_TAC`pr3:real^3#real^3#real^3#real^3->real^3` +THEN EXISTS_TAC`(\z:real^3. x,pr2 y, z, sigma_fan x V E (pr2 y) z)` +THEN MRESA_TAC properties_of_elements_in_node_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(pr2 y):real^3`;` ((pr3 y):real^3)`]FINITE_ORBITS_SIGMA_FAN) +THEN RESA_TAC +THEN REWRITE_TAC[set_of_orbits_points_fan;IN_ELIM_THM; pr3] +THEN REWRITE_TAC[GSYM pr3] +THEN STRIP_TAC +THENL[ +STRIP_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[ARITH_RULE`0<= i <=> i>=0`;pr3;power_map_points] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; + +STRIP_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[ARITH_RULE`i>=0 <=> 0<=i`;power_map_points] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]]);; + + +let lemma_card_node_eq_set_of_edge=prove(`!x V E f y. FAN (x,V,E) /\ f IN (node_set (hypermap1_of_fanx (x,V,E)) ) +/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) /\ y IN f +==> CARD (set_of_edge (pr2 y) V E)=CARD f `, + +REPEAT STRIP_TAC +THEN MRESA_TAC rep_node_set_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC lemma_card_node_eq_set_of_orbits[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC properties_of_elements_in_node_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC CARD_SET_OF_ORBITS_POINTS_FAN[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(pr2 y):real^3`;` ((pr3 y):real^3)`]);; + + + +let mono_cyclic_power_sigma_fan=prove(`!x V E v u i j. FAN(x,V,E)/\ {v,u} IN E /\ + i IN 0..CARD (set_of_edge (v) V E) - 1 /\ + j IN 0..CARD (set_of_edge (v) V E) - 1 /\ + power_map_points sigma_fan x V E (v) (u) i = + power_map_points sigma_fan x V E (v) (u) j + ==> i = j`, + +REWRITE_TAC[IN_NUMSEG_0] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`i=j \/ i< j\/ j< i:num`) +THENL[ +ASM_REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL[ +MP_TAC(SPECL[`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;`j:num`;`i:num`]cyclic_power_sigma_fan) +THEN RESA_TAC +THEN ASM_TAC +THEN ARITH_TAC; + +MP_TAC(SPECL[`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;`i:num`;`j:num`]cyclic_power_sigma_fan) +THEN RESA_TAC +THEN ASM_TAC +THEN ARITH_TAC]]);; + + +let SUM_AZIM_FAN_OF_NODE_EQ_SUM_AZIM_I_FAN=prove(`!x V E f y. FAN (x,V,E) /\ f IN node_set (hypermap1_of_fanx (x,V,E)) /\ y IN f /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) + ==> sum (0..CARD (set_of_edge (pr2 y) V E) - 1) (\i. azim_i_fan x V E (pr2 y) (pr3 y) i) = + sum f (\y1. azim_fan x V E (pr2 y1) (pr3 y1))`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "EM") +THEN MRESA_TAC rep_node_set_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN SUBGOAL_THEN`(!x' y1. + x' IN set_of_orbits_points_fan x V E (pr2 y) (pr3 y) /\ + y1 IN set_of_orbits_points_fan x V E (pr2 y) (pr3 y) /\ + x,pr2 y,x',sigma_fan x V E (pr2 y) x' = + x,pr2 y,y1,sigma_fan x V E (pr2 y) y1 + ==> x' = y1)`ASSUME_TAC +THENL[MESON_TAC[EQ_PAIR_4]; + + MRESAL_TAC SUM_IMAGE[`(\z:real^3. x,pr2 y, z, sigma_fan x V E (pr2 y) z)`;`(\y. azim_fan x V E (pr2 y) (pr3 y))`;`set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) ((pr2 y):real^3) ((pr3 y):real^3)`][IMAGE] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[set_of_orbits_points_fan] +THEN REWRITE_TAC[IN_ELIM_THM;SET_RULE`{y' | ?x'. (?i. 0 <= i /\ + x' = power_map_points sigma_fan x V E (pr2 y) (pr3 y) i) /\ + y' = x,pr2 y,x',sigma_fan x V E (pr2 y) x'} = {y' | ?i. 0 <= i /\ + y' = x,pr2 y,power_map_points sigma_fan x V E (pr2 y) (pr3 y) i,sigma_fan x V E (pr2 y) (power_map_points sigma_fan x V E (pr2 y) (pr3 y) i)}`;power_map_points;ARITH_RULE`i>= 0<=> 0<= i`] +THEN RESA_TAC +THEN REWRITE_TAC[o_DEF;pr2;pr3] +THEN ASM_REWRITE_TAC[GSYM pr2; GSYM pr3;azim_fan;azim_i_fan] +THEN MRESA_TAC properties_of_elements_in_node_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` ((pr3 y):real^3)`;` ((pr2 y):real^3)`] +THEN REMOVE_ASSUM_TAC +THEN USE_THEN "EM"(fun th-> MP_TAC(ISPEC `(pr2 y):real^3` th) THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN RESA_TAC) + +THEN MRESA_TAC SIMP_ORBITS_POINTS_FAN[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` ((pr2 y):real^3)`;` ((pr3 y):real^3)`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC(SPECL[`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` ((pr2 y):real^3)`;` ((pr3 y):real^3)`]mono_cyclic_power_sigma_fan +) +THEN RESA_TAC +THEN MRESAL_TAC SUM_IMAGE[`(\i:num. power_map_points sigma_fan x V E (pr2 y) (pr3 y) i)`;`(\x'. azim x (pr2 y) x' (sigma_fan x V E (pr2 y) x'))`;`0..CARD (set_of_edge (pr2 y) (V:real^3->bool) E) - 1`][IMAGE;o_DEF;power_map_points] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;IN_NUMSEG_0]) +THEN MP_TAC(ARITH_RULE`CARD (set_of_edge (pr2 y) V E) > 1==> (!i. i <= CARD (set_of_edge (pr2 y) V E) - 1<=> i < CARD (set_of_edge (pr2 y) V E)) `) +THEN RESA_TAC +THEN SUBGOAL_THEN`{y1 | ?i. i < CARD (set_of_edge (pr2 y) V E) /\ + y1 = power_map_points sigma_fan x V E (pr2 y) (pr3 y) i} + = + {power_map_points sigma_fan x V E (pr2 y) (pr3 y) i | i | i < + CARD + (set_of_edge + (pr2 y) + V + E)} +`(fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM]]);; + +let exists_point_in_node=prove(`!x V E f. f IN node_set (hypermap1_of_fanx (x,V,E)) +==> ?y. y IN f`, +REWRITE_TAC[node_set;set_of_orbits;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`x':real^3#real^3#real^3#real^3` +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[POWER;ARITH_RULE`0>=0`;I_DEF]);; + + +let SUM_AZIM_FAN_OF_NODE_EQ_2PI_I_FAN=prove(`!x V E f. FAN (x,V,E) /\ f IN node_set (hypermap1_of_fanx (x,V,E)) /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) + ==> + sum f (\y. azim_fan x V E (pr2 y) (pr3 y))= &2 * pi`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC exists_point_in_node[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`;] +THEN MRESA_TAC SUM_AZIM_FAN_OF_NODE_EQ_SUM_AZIM_I_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) +THEN SUBGOAL_THEN`(\i. azim_i_fan x V E (pr2 y) (pr3 y) i)= azim_i_fan x V E (pr2 y) (pr3 y) `(fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[FUN_EQ_THM] +THEN MATCH_MP_TAC SUM_AZIMS_EQ_2PI_FAN +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC properties_of_elements_in_node_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` ((pr3 y):real^3)`;` ((pr2 y):real^3)`] +THEN REMOVE_ASSUM_TAC +THEN USE_THEN "EM"(fun th-> MP_TAC(ISPEC `(pr2 y):real^3` th) THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN RESA_TAC) +THEN ASM_REWRITE_TAC[ARITH_RULE`1 A>1`] +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge (pr2 y) V E = {(pr3 y):real^3})\/ ~(set_of_edge (pr2 y) V E = {pr3 y})`) +THENL[ +MRESA_TAC CARD_SING[`(pr3 y):real^3`; `(set_of_edge (pr2 y) V E):real^3->bool`] +THEN FIND_ASSUM MP_TAC `CARD ((set_of_edge (pr2 y) V E):real^3->bool) >1` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun TH-> REWRITE_TAC[TH]) +THEN ARITH_TAC; +ASM_REWRITE_TAC[]]);; + + + + +let SUM_CARD_FACE_NODE_DART_FAN=prove(`!x V E. + FAN (x,V,E) /\ conforming_fan (x,V,E) + ==> &2 * &(CARD (face_set (hypermap1_of_fanx (x,V,E)))) + + &2 * &(CARD (node_set (hypermap1_of_fanx (x,V,E)))) - + &(CARD (dart (hypermap1_of_fanx (x,V,E)))) = &4 `, + +REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[conforming_fan;conforming_solid_angle_fan] THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN REWRITE_TAC[SET_RULE`(!s. P s ==> Q s /\ Q1 s/\ Q2 s) <=> (!s. P s ==> Q s ) /\ (!s. P s ==> Q1 s) /\ (!s. P s ==> Q2 s)`] + THEN ASSUME_TAC th THEN STRIP_TAC) +THEN MRESA_TAC SUM_SOL_IN_FACE_SET_EQ_4PI[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC SUM_EQ[`(\f. sol x (dartset_leads_into_fan (x:real^3) V E f))`;`(\f. (&2 * pi + sum f (\y. azim_fan x V E (pr2 y) (pr3 (y:real^3#real^3#real^3#real^3)) - pi)))`;`face_set (hypermap1_of_fanx (x:real^3,V,E))`] +THEN MRESA1_TAC FINITE_HYPERMAP_ORBITS`hypermap1_of_fanx (x:real^3,V,E)` +THEN MRESA_TAC SUM_ADD[`(\f:real^3#real^3#real^3#real^3->bool. &2 * pi)`;`(\f. sum f (\y. azim_fan x V E (pr2 y) (pr3 (y:real^3#real^3#real^3#real^3)) - pi))`;`face_set (hypermap1_of_fanx (x:real^3,V,E))`] +THEN MRESA_TAC SUM_CONST[`&2 * pi`;`face_set (hypermap1_of_fanx (x:real^3,V,E))`] +THEN MRESA_TAC FINITE_FACE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN SUBGOAL_THEN`(!t1 t2 y. + t1 IN face_set (hypermap1_of_fanx (x,V,E)) /\ + t2 IN face_set (hypermap1_of_fanx (x,V,E)) /\ + ~(t1 = t2) /\ + y IN t1 /\ + y IN t2 + ==> azim_fan x V E (pr2 y) (pr3 y) - pi = &0)` ASSUME_TAC +THENL[ + REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_THEN (LABEL_TAC "EM") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face] +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x'':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face]; + + +MRESA_TAC SUM_UNIONS_NONZERO[` (\y. azim_fan x (V:real^3->bool) E (pr2 y) (pr3 (y:real^3#real^3#real^3#real^3)) - pi)`;`face_set (hypermap1_of_fanx (x:real^3,V:real^3->bool,E))`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC SUM_SUB[`(\y. azim_fan x V E (pr2 y) (pr3 (y:real^3#real^3#real^3#real^3)))`;`(\f:real^3#real^3#real^3#real^3. pi)`;`(UNIONS (node_set (hypermap1_of_fanx (x:real^3,V,E))))`] +THEN POP_ASSUM MP_TAC +THEN MRESA1_TAC DART_EQ_UNIONS_FACE_SET_NODE_SET_EDGE_SET`(hypermap1_of_fanx (x:real^3,V:real^3->bool,E))` +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC SUM_CONST[`pi`;`(UNIONS (node_set (hypermap1_of_fanx (x:real^3,V,E))))`] +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SYM th;hypermap_lemma] THEN STRIP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN REWRITE_TAC[th] THEN MP_TAC th THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN ASSUME_TAC th THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "MA")) +THEN RESA_TAC +THEN SUBGOAL_THEN`(!t1 t2 y. + t1 IN node_set (hypermap1_of_fanx (x,V,E)) /\ + t2 IN node_set (hypermap1_of_fanx (x,V,E)) /\ + ~(t1 = t2) /\ + y IN t1 /\ + y IN t2 + ==> azim_fan x V E (pr2 y) (pr3 y) = &0)` ASSUME_TAC +THENL[ + REWRITE_TAC[node_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_THEN (LABEL_TAC "EM") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN MRESAL_TAC lemma_node_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][node] +THEN MRESAL_TAC lemma_node_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x'':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][node]; + +MRESAL_TAC SUM_UNIONS_NONZERO[` (\y. azim_fan x (V:real^3->bool) E (pr2 y) (pr3 (y:real^3#real^3#real^3#real^3)))`;`node_set (hypermap1_of_fanx (x:real^3,V:real^3->bool,E))`][FINITE_NODE_FAN] +THEN MRESA_TAC SUM_AZIM_FAN_OF_NODE_EQ_2PI_I_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;] +THEN MRESA_TAC SUM_EQ[`(\t:real^3#real^3#real^3#real^3->bool. sum t (\y. azim_fan x V E (pr2 y) (pr3 y)))`;`(\t:real^3#real^3#real^3#real^3->bool. &2 * pi)`;`(node_set (hypermap1_of_fanx (x:real^3,V,E)))`] +THEN MRESA_TAC SUM_CONST[`&2 * pi`;`node_set (hypermap1_of_fanx (x:real^3,V,E))`] +THEN REMOVE_THEN "MA"(fun th-> REWRITE_TAC[SYM th]) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[REAL_ARITH`A= A * &1`] +THEN MP_TAC(REAL_ARITH`&0< pi==> ~(pi= &0)`) +THEN ASM_REWRITE_TAC[PI_WORKS] +THEN STRIP_TAC +THEN MRESA1_TAC REAL_MUL_RINV`pi:real` +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;REAL_ARITH`(A+B-C)*D*E=(A*D+B*D-C*D)*E/\ (A*B)*C=B*A*C`;]) +THEN REAL_ARITH_TAC]]);; + + + + + + + + +let nonconformin_fan_imp_n_fan_ge0=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ~(conforming_fan (x,V,E)) +==> N_FAN(x,V,E)> 0`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] +THEN ASM_SIMP_TAC[ARITH_RULE`~(A>0)<=> A=0`;DWFBRQY]);; + + +let nonconformin_fan_imp_exist_face_gt_3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ~(conforming_fan (x,V,E)) +==> ?ds. ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3`, + +REPEAT STRIP_TAC +THEN MRESA_TAC nonconformin_fan_imp_n_fan_ge0[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[N_FAN] +THEN DISJ_CASES_TAC(SET_RULE`(!f. f IN face_set (hypermap1_of_fanx (x,V,E))==> CARD f -3=0)\/ ~(!f. f IN face_set (hypermap1_of_fanx (x:real^3,V,E))==> CARD f -3=0)`) +THENL[ +ASM_SIMP_TAC[NSUM_EQ_0] THEN ARITH_TAC; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;ARITH_RULE`~(A=0)<=> A>0`] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN EXISTS_TAC`f:real^3#real^3#real^3#real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN ARITH_TAC]);; + + +let exists_face_in_face_set=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. + ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> ?f1. f1 IN ds `, + +REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`x':real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[orbit_map;IN_ELIM_THM;] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[POWER;I_DEF;ARITH_RULE`0>=0`]);; + + +let exists_node_in_face_set=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. + ds IN node_set(hypermap1_of_fanx (x,V,E)) +==> ?f1. f1 IN ds `, + +REWRITE_TAC[node_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`x':real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[orbit_map;IN_ELIM_THM;] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[POWER;I_DEF;ARITH_RULE`0>=0`]);; + + + +let identity_face_in_face_set=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds f1. + ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ f1 IN ds +==> ds= face (hypermap1_of_fanx (x,V,E)) f1 `, +REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[GSYM face;] +THEN MESON_TAC[lemma_face_identity]);; + + +let identity_node_in_face_set=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds f1. + ds IN node_set(hypermap1_of_fanx (x,V,E)) +/\ f1 IN ds +==> ds= node (hypermap1_of_fanx (x,V,E)) f1 `, +REWRITE_TAC[node_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[GSYM node;] +THEN MESON_TAC[lemma_node_identity]);; + + + + +let condition_f1_eq_fan=prove(`!x V E v u w. +FAN(x,V,E) +/\ {u,w} IN E /\ {v,u} IN E +/\ sigma_fan x V E u w = v +==> f1_fan x V E (x,v,u,sigma_fan x V E v u)=(x,u,w,v)`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[f1_fan;EQ_PAIR_4] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[INVERSE1_SIGMA_FAN]);; + + +let nonconformin_fan_imp_exist_3point_in_face=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +==> ?f1 f2 f3. {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ {pr2 f2, pr2 f3} IN E +/\ ~({pr2 f3, pr2 f1 } IN E) +/\ {pr2 f1, pr2 f2 } IN E +/\ sigma_fan x V E (pr2 f2) (pr2 f3)=pr2 f1 +/\ pr2 f3= pr3 f2 +/\ pr2 f2= pr3 f1`, + +REPEAT STRIP_TAC +THEN MRESA_TAC exists_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN ABBREV_TAC`f2=f1_fan x V E (f1:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f3=f1_fan x V E (f2:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f4=f1_fan x V E (f3:real^3#real^3#real^3#real^3)` +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"VUT") +THEN MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f2:real^3#real^3#real^3#real^3)` ;`(f1:real^3#real^3#real^3#real^3)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f3:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f4:real^3#real^3#real^3#real^3)` ;`(f3:real^3#real^3#real^3#real^3)`;`ds:real^3#real^3#real^3#real^3->bool`] + +THEN MP_TAC(SET_RULE`f1 IN ds /\ f2 IN ds /\ f3 IN ds /\ ds SUBSET d1_fan (x,V,E)==> {f1,f2,f3} SUBSET (ds:real^3#real^3#real^3#real^3->bool)/\ f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)`) +THEN RESA_TAC +THEN MRESA_TAC f_fan_no_fix_point[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f1:real^3#real^3#real^3#real^3)` THEN MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)` THEN MRESA1_TAC th`(f3:real^3#real^3#real^3#real^3)`) +THEN DISJ_CASES_TAC(SET_RULE`f3=f1 \/ ~(f3=f1:real^3#real^3#real^3#real^3)`) +THENL(*1*)[ +MP_TAC(SET_RULE`f1=f3:real^3#real^3#real^3#real^3==> pr2 f1= pr2 f3`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f3:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f2:real^3#real^3#real^3#real^3)` ;`(f1:real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` pr2 (f3:real^3#real^3#real^3#real^3)`; +` pr2 (f2:real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge (pr2 (f2:real^3#real^3#real^3#real^3)) V E = {pr2 f3} \/ ~(set_of_edge (pr2 (f2:real^3#real^3#real^3#real^3)) V E = {pr2 f3})`) +THENL[ + MRESA_TAC CARD_SING[`(pr2 f3):real^3`; `(set_of_edge (pr2 (f2:real^3#real^3#real^3#real^3)) V E):real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) +THEN FIND_ASSUM (fun th -> MP_TAC(ISPEC `(pr2 (f2:real^3#real^3#real^3#real^3))` th))`(!v:real^3. v IN V==>CARD (set_of_edge v V E) >1)` +THEN FIND_ASSUM (fun th-> REWRITE_TAC[th])`(pr2 (f2:real^3#real^3#real^3#real^3)) IN V` +THEN ARITH_TAC; + +MRESA_TAC SIGMA_FAN [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` pr2 (f2:real^3#real^3#real^3#real^3)`; +` pr2 (f3:real^3#real^3#real^3#real^3)`] +THEN ASM_TAC THEN SET_TAC[]];(*1*) + + + + +DISJ_CASES_TAC(SET_RULE`f4=f1 \/ ~(f4=f1:real^3#real^3#real^3#real^3)`) +THENL(*2*)[ +SUBGOAL_THEN(`((f1_fan (x:real^3) V E) POWER 3) f1=f1`) ASSUME_TAC +THENL(*3*)[ +ASM_SIMP_TAC[ARITH_RULE`3= SUC(2)/\ 2= SUC(1) /\ 1= SUC(0)`;POWER;I_DEF;o_DEF];(*3*) + + SUBGOAL_THEN`face (hypermap1_of_fanx (x:real^3,V:real^3->bool,E)) f1=orbit_map (f1_fan x V E) f1`ASSUME_TAC +THENL(*4*)[ +ASM_REWRITE_TAC[face;orbit_map;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THEN STRIP_TAC +THEN MRESAL_TAC into_domain_power_efn_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`n:num`;`( \ t. res (t x V E ) (d1_fan (x:real^3,V,E))) `][POWER_1;I_DEF] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `f1:real^3#real^3#real^3#real^3`) +THEN EXISTS_TAC`n:num` +THEN ASM_REWRITE_TAC[];(*4*) + +MRESAL_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f1:real^3#real^3#real^3#real^3`][] +THEN MRESAL_TAC card_orbit_le[`f1_fan (x:real^3) V E`;`3`;`f1:real^3#real^3#real^3#real^3`][ARITH_RULE`~(3=0)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th -> REWRITE_TAC[SYM th]) +THEN ASM_TAC THEN ARITH_TAC]]; +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EMYEU") +THEN EXISTS_TAC`f1:real^3#real^3#real^3#real^3` +THEN EXISTS_TAC`f2:real^3#real^3#real^3#real^3` +THEN EXISTS_TAC`f3:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f2:real^3#real^3#real^3#real^3)` ;`(f1:real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f3:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)] +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)] THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)] THEN MP_TAC th) THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[th] THEN MP_TAC th) +THEN REPEAT STRIP_TAC THEN ASSUME_TAC (SYM th)) +THEN MRESA_TAC PROPERTIES_TRIANGLE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(pr2 f1):real^3`;`(pr3 f1):real^3`;` (pr2 f3):real^3`] +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC condition_f1_eq_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` (pr2 f3):real^3`;`(pr2 f1):real^3`;`(pr3 f1):real^3`;] +THEN REMOVE_THEN "EMYEU" MP_TAC +THEN REMOVE_THEN"VUT"(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN REPEAT (ASM_REWRITE_TAC[pr2;pr3] THEN STRIP_TAC THEN ASM_REWRITE_TAC[]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC MONO_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v'':real^3`;`v:real^3`;`w'':real^3`;]]]);; + + + + + + +let condition_aff_gt_subset_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w. +FAN(x,V,E) /\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ~({w,v} IN E) +==> aff_gt {x} {v,w} SUBSET yfan (x,V,E)`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[yfan;SET_RULE`A SUBSET (:real^3) DIFF B<=> A INTER B= {}`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] +THEN REWRITE_TAC[xfan;IN;SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GT_CUT_XFAN_IMP_EDGE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v:real^3`; `u:real^3`; `w:real^3`][IN]);; + + + + + + + +let segment_subset_aff_gt_union=prove(`!x:real^3 y z v u w. +~coplanar{x,v,u,w} +/\ y IN aff_gt {x} {v, u, w} +/\ z IN aff_gt {x} {w, v} +==> segment[y,z] SUBSET aff_gt {x} {w, v} UNION aff_gt {x} {v, u, w}`, + REWRITE_TAC[segment;UNION;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`u'<= &1==> u'= &1 \/ u'< &1`) +THEN RESA_TAC +THENL[ +REWRITE_TAC[REAL_ARITH`&1- &1= &0`] +THEN REDUCE_VECTOR_TAC +THEN RESA_TAC; + +STRIP_TAC +THEN MATCH_MP_TAC(SET_RULE`B==> A\/ B`) +THEN ASM_TAC +THEN DISCH_TAC +THEN MRESA_TAC notcoplanar_disjoints[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC AFF_GT_1_2[`x:real^3`;`w:real^3`;`v:real^3`;] +THEN MRESA_TAC AFF_GT_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - u') % (t1 % x + t2 % v + t3 % u + t4 % w) + + u' % (t1' % x + t2' % w + t3' % v) +=((&1 - u') *t1 + u' *t1') % x + ((&1 - u')*t2+ u' * t3') % v + ((&1 - u')*t3) % u + ((&1 - u')*t4+ u' * t2') % w`] +THEN EXISTS_TAC`(&1 - u') * t1 + u' * t1':real` +THEN EXISTS_TAC`(&1 - u') * t2 + u' * t3':real` +THEN EXISTS_TAC`(&1 - u') * t3:real` +THEN EXISTS_TAC`(&1 - u') * t4 + u' * t2':real` +THEN ASM_REWRITE_TAC[REAL_ARITH` ((&1 - u') * t1 + u' * t1') + + ((&1 - u') * t2 + u' * t3') + + (&1 - u') * t3 + + (&1 - u') * t4 + + u' * t2' += (&1 - u') * (t1 + t2+ t3 + t4)+ u'*(t1' +t2'+t3') +`;REAL_ARITH`(&1 - u') * &1 + u' * &1 = &1`] +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC (REAL_ARITH`&0< A/\ &0<=B ==> &0< A+B`) +THEN STRIP_TAC +THENL[MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1- u'<=> u'< &1`]; + +MATCH_MP_TAC REAL_LE_MUL +THEN ASM_TAC +THEN REAL_ARITH_TAC]; +STRIP_TAC +THENL[ +MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1- u'<=> u'< &1`]; + +MATCH_MP_TAC (REAL_ARITH`&0< A/\ &0<=B ==> &0< A+B`) +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1- u'<=> u'< &1`]; +MATCH_MP_TAC REAL_LE_MUL +THEN ASM_TAC +THEN REAL_ARITH_TAC]]]]);; + + +let SEGMENT_CONNECTED=prove(`!a b. connected(segment [a,b])`, + +REPEAT GEN_TAC THEN +MATCH_MP_TAC CONVEX_CONNECTED THEN +REWRITE_TAC[SEGMENT_CONVEX_HULL;CONVEX_CONVEX_HULL]);; + + +let AFF_GT_SUBSET_DART_LEADS_INTO_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w. +FAN(x,V,E) /\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +==> aff_gt {x} {w,v} SUBSET dart_leads_into x V E u w`, +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_disjoints[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v:real^3`;`u:real^3`;`w:real^3`;] +THEN MRESA_TAC dart_leads_into_fan_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`u:real^3`; `w:real^3`] +THEN MRESA_TAC in_topological_component_yfan_is_connected[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(dart_leads_into x V E u w):real^3->bool`] +THEN MRESAL_TAC notcoplanar_4point_aff_gt_1_3_not_empty[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][SET_RULE`~(A={})<=> ?y. y IN A`] +THEN MP_TAC(SET_RULE`y IN aff_gt {x} {v, u, w}/\ aff_gt {x} {v, u, w} SUBSET dart_leads_into x V E u w +==> y IN dart_leads_into x V E u w`) +THEN RESA_TAC +THEN MRESA_TAC topological_component_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(dart_leads_into x V E u w):real^3->bool`] +THEN MP_TAC(SET_RULE`dart_leads_into x V E u w SUBSET yfan (x,V,E) +/\ aff_gt {x} {v, u, w} SUBSET dart_leads_into x V E u w +==> aff_gt {x} {v, u, w} SUBSET yfan (x,V,E)`) +THEN RESA_TAC +THEN MRESA_TAC expand_element_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(dart_leads_into x V E u w):real^3->bool`;`y:real^3`] +THEN MRESA_TAC exists_in_aff_gt_disjoint[`x:real^3`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC condition_aff_gt_subset_yfan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v:real^3`;`u:real^3`;`w:real^3`;] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC segment_subset_aff_gt_union[`x:real^3`;`y:real^3`;`y':real^3`;` v:real^3`;`u:real^3`;`w:real^3`;] +THEN MP_TAC(SET_RULE` +segment [y,y'] SUBSET aff_gt {x} {w, v} UNION aff_gt {x} {v, u, w} +/\ aff_gt {x} {w, v} SUBSET yfan (x,V:real^3->bool,E) +/\ aff_gt {x} {v, u, w} SUBSET yfan (x,V,E) +==> segment [y,y':real^3] SUBSET yfan(x,V,E) +`) +THEN RESA_TAC +THEN MRESA_TAC CONVEX_AFF_GT[`{x:real^3}`;`{ w,v:real^3}`] +THEN MRESA_TAC CONVEX_CONNECTED[`aff_gt {x} {w,v}:real^3->bool`] +THEN MRESA_TAC SEGMENT_CONNECTED[`y:real^3`;`y':real^3`] +THEN MRESA_TAC ENDS_IN_SEGMENT[`y:real^3`;`y':real^3`] +THEN MRESA1_TAC CONNECTED_IFF_CONNECTED_COMPONENT`segment[y,y':real^3]` +THEN POP_ASSUM (fun th-> MRESA_TAC th [`y:real^3`;`y':real^3`]) +THEN MRESA_TAC CONNECTED_COMPONENT_OF_SUBSET[`segment [y,y':real^3]`;`yfan(x:real^3,V:real^3->bool,E)`;`y:real^3`;`y':real^3`] +THEN MRESAL_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3,V:real^3->bool,E)`;`y:real^3`;`y':real^3`][IN] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC CONNECTED_COMPONENT_MAXIMAL[`yfan(x:real^3,V:real^3->bool,E)`;`aff_gt {x} {w,v}:real^3->bool`;`y':real^3`]);; + + + + +let STEP2_REDUCE_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds f1 f2 f3 v u w. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +==> aff_gt {x} {v,w} SUBSET dartset_leads_into_fan x V E ds`, + +REPEAT STRIP_TAC +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds /\ ds SUBSET d1_fan(x,V,E)==> f1 IN d1_fan(x,V,E)/\ f2 IN d1_fan(x,V,E) /\ f3 IN d1_fan(x,V,E) /\ f1 IN ds /\ f2 IN ds/\ f3 IN ds`) +THEN RESA_TAC +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f3:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC AFF_GT_SUBSET_DART_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`] +THEN MRESA_TAC UNIQUE_DARTSET_LEADS_INTO1_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`dart_leads_into (x:real^3) V E (pr2 f2) (pr3 f2)`;`f2:real^3#real^3#real^3#real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]);; + + +let STEP3_REDUCE_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ E UNION {{v,w}}= E1 +==> FAN (x,V,E1)`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP2_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`]) +THEN MRESAL_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1:real`][REAL_ARITH`&0<= &1 /\ &1<= &1`;VECTOR_ARITH`(&1 - &1) % u + &1 % w=w`] +THEN MRESA_TAC DWWUTKW[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`; +`ds:real^3#real^3#real^3#real^3->bool`;]);; + + + + + + +let SET_OF_EDGE_UNION_GRAPH=prove(`!v V E1 E2. set_of_edge v V (E1 UNION E2)= (set_of_edge v V E1) UNION (set_of_edge v V E2)`, +ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[set_of_edge;UNION;IN_ELIM_THM;SET_RULE`(A\/B)/\C<=>(A/\C)\/ (B/\C)`;] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THEN SET_TAC[]);; + + + + + +let add_edge_imp_card_set_edge_ge1_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ E1=E UNION {{v,w}} +==> +(!v. v IN V==>CARD (set_of_edge v V E1) > 1)`, +REWRITE_TAC[FAN;fan1] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC remark_finite_fan1[`v':real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[SET_OF_EDGE_UNION_GRAPH;] +THEN STRIP_TAC +THEN MRESAL_TAC CARD_SUBSET[`(set_of_edge v' (V:real^3->bool) E):real^3->bool`;`(set_of_edge v' (V:real^3->bool) E UNION set_of_edge v' V {{v, w}}):real^3->bool`][SET_RULE`A SUBSET A UNION B`] +THEN POP_ASSUM MP_TAC +THEN FIRST_ASSUM (MP_TAC o SPEC `v':real^3`) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN ARITH_TAC);; + + + + +let pr23=new_definition`pr23=(\(x,y,z,t). (y,z))` +;; + + +let PR23_OF_D1_FAN=prove(`!x:real^3 V:real^3->bool E:(real^3->bool)->bool. +IMAGE pr23 (d1_fan(x,V,E))={ (v,w) | {v,w} IN E}`, +REWRITE_TAC[IMAGE;d1_fan;IN_ELIM_THM;EXTENSION;] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[pr23;] +THEN RESA_TAC +THEN EXISTS_TAC `v:real^3` +THEN EXISTS_TAC `w:real^3` +THEN ASM_REWRITE_TAC[]; + +REPEAT STRIP_TAC +THEN EXISTS_TAC`x,v,w,sigma_fan x V E v w:real^3` +THEN ASM_REWRITE_TAC[pr23] +THEN EXISTS_TAC `x:real^3` +THEN EXISTS_TAC `v:real^3` +THEN EXISTS_TAC `w:real^3` +THEN EXISTS_TAC `sigma_fan x V E v w:real^3` +THEN ASM_REWRITE_TAC[]]);; + + + + +let PR23_OF_D20_FAN=prove(`!x:real^3 V:real^3->bool E:(real^3->bool)->bool. +IMAGE pr23 (d20_fan(x,V,E))={ (v,v) | v IN V/\ set_of_edge v V E={}}`, + +REWRITE_TAC[IMAGE;d20_fan;IN_ELIM_THM;EXTENSION;] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[pr23;] +THEN RESA_TAC +THEN EXISTS_TAC `v:real^3` +THEN ASM_REWRITE_TAC[IN]; + +REPEAT STRIP_TAC +THEN EXISTS_TAC`(x:real^3),v,v,(v:real^3)` +THEN ASM_REWRITE_TAC[pr23] +THEN EXISTS_TAC `x:real^3` +THEN EXISTS_TAC `v:real^3` +THEN ASM_REWRITE_TAC[IN] +THEN ASM_TAC +THEN SIMP_TAC[IN]]);; + + + +let add_edge_graph=prove(`!v w E. {v',w' | {v', w'} IN E UNION {{v, w}}}= {v',w' | {v', w'} IN E} UNION {(v',w')| {v',w'}={v,w}}`, + +ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[UNION;IN_ELIM_THM;IN_SING;SET_RULE`(A\/B)/\C<=>(A/\C)\/ (B/\C)`;] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THEN SET_TAC[]);; + +let expand_set_edge_fan=prove(`!v w.{(v',w')| {v',w'}={v,w}}={(v,w), (w,v)}`, + +REWRITE_TAC[SET_RULE`{v',w'}={v,w}<=> (v=v' /\ w= w') \/ v= w' /\ w=v'`] +THEN SET_TAC[]);; + + + + + + + +let DART_FANADD_EQ_DART_FAN_ADD_2DART=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ~(v=w) +/\ E UNION {{v,w}}=E1 +==> +IMAGE pr23 (dart (hypermap1_of_fanx (x,V,E1))) + += (IMAGE pr23 (dart (hypermap1_of_fanx (x,V,E)))) UNION {(v,w),(w,v)}`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] + +THEN ASM_REWRITE_TAC[d_fan;IMAGE_UNION;PR23_OF_D20_FAN;PR23_OF_D1_FAN] +THEN REMOVE_THEN"YEU"(fun th-> REWRITE_TAC[SYM th;add_edge_graph;expand_set_edge_fan;SET_OF_EDGE_UNION_GRAPH]));; + + + +let pr23_inj_in_dfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> (!y y1. + y IN d_fan(x,V,E) +/\ y1 IN d_fan(x,V,E) +/\ pr23 y= pr23 y1 +==> y=y1)`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN REWRITE_TAC[PAIR_EQ;IN_ELIM_THM;d1_fan] +THEN STRIP_TAC +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr23;PAIR_EQ] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[]);; + + + + + +let condition_set_of_edge_eq_empty=prove(`!v:A V E1 E2. +~(v IN UNIONS E2) +==> set_of_edge v V E2= {}`, +REWRITE_TAC[set_of_edge;SET_RULE`A={}<=> !s. ~(s IN A)`;IN_ELIM_THM;DE_MORGAN_THM;] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC(SET_RULE`A==> A\/B`) +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN STRIP_TAC +THEN REWRITE_TAC[UNIONS;IN_ELIM_THM] +THEN EXISTS_TAC`{v:A,s}` +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]);; + + + + +let SET_OF_EDGE_INVARIANT=prove(`!v V E1 E2. +~(v IN UNIONS E2) +==> set_of_edge v V (E1 UNION E2)= (set_of_edge v V E1)`, + +SIMP_TAC[SET_OF_EDGE_UNION_GRAPH;condition_set_of_edge_eq_empty;SET_RULE`A UNION {}=A`]);; + + +let expand_unions=prove(`!v w:A. UNIONS {{v,w}}= {v,w}`, +SIMP_TAC[UNIONS;IN_SING;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN SIMP_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[SET_TAC[]; + +STRIP_TAC +THEN EXISTS_TAC`{v,w:A}` +THEN ASM_REWRITE_TAC[]]);; + + +let SIGMA_FAN_OF_FANADD1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 v w. +FAN(x,V,E)/\ FAN(x,V,E1) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) + /\ ~({v,w} IN E) +/\ E UNION {{v,w}}=E1 +==> (!v1 w1. {v1,w1} IN E /\ ~(v1 IN {v,w})==> sigma_fan x V E1 v1 w1 = sigma_fan x V E v1 w1) +`, + +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +`(v1:real^3)`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v1:real^3`) +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v1 V E1 = {w1:real^3})\/ ~(set_of_edge v1 V E1 = {w1})`) +THENL[ +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; + + +POP_ASSUM MP_TAC +THEN MRESAL_TAC SET_OF_EDGE_INVARIANT[`v1:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` ({{v,w}}:(real^3->bool)->bool)`;][expand_unions] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC UNIQUE_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v1:real^3`;`w1:real^3`;`sigma_fan x V E v1 w1:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESA_TAC SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v1:real^3`;`w1:real^3`] +]);; + + + + + + + +let add_edge_graph=prove(`!v w E E1. +E UNION {{v,w}}=E1 +==> {w,v} IN E1/\ {v,w}IN E1`, + +REPEAT STRIP_TAC +THENL +[ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SET_TAC[]; +POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SET_TAC[]]);; + +let not_in_set_of_edge=prove(` +!v w V E. ~({w,v} IN E) +==> ~(w IN set_of_edge v V E)`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN SIMP_TAC[set_of_edge;IN_ELIM_THM;SET_RULE`{A,B}={B,A}`]);; + + + +let set_of_only_edge=prove(`!v w V. w IN V ==> set_of_edge v V {{v, w}}={w}`, + +REWRITE_TAC[set_of_edge;IN_SING;SET_RULE`{v',w'}={v,w}<=> (v=v' /\ w= w') \/ v= w' /\ w=v'`;EXTENSION;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[]);; + + +let set_of_only_edge1=prove(`!v w V. v IN V ==> set_of_edge w V {{v, w}}={v}`, + +REWRITE_TAC[set_of_edge;IN_SING;SET_RULE`{v',w'}={v,w}<=> (v=v' /\ w= w') \/ v= w' /\ w=v'`;EXTENSION;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[]);; + + + + + + +let SIGMA_FAN_OF_FANADD_AT_POINT1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 v u w. +FAN(x,V,E)/\ FAN(x,V,E1) +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ fan80(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ E UNION {{v,w}}=E1 +==> sigma_fan x V E1 v w = sigma_fan x V E v u`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E1 = {w:real^3})\/ ~(set_of_edge v V E1 = {w})`) +THENL[ +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; + +STRIP_TAC +THEN MRESA_TAC add_edge_graph[`v:real^3`;`w:real^3`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC UNIQUE_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`sigma_fan x V E v u:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN REMOVE_THEN "EM"(fun th -> REWRITE_TAC[SYM th;SET_OF_EDGE_UNION_GRAPH]) +THEN REMOVE_THEN "YEU"(fun th -> MRESA1_TAC th`v:real^3` THEN POP_ASSUM MP_TAC THEN ASSUME_TAC th) +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E = {u:real^3})\/ ~(set_of_edge v V E = {u})`) +THENL[ +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; +STRIP_TAC +THEN MRESA_TAC SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"QUY") +THEN ASM_SIMP_TAC[SET_RULE`x IN A==> x IN A UNION B`] +THEN MRESA_TAC not_in_set_of_edge[`v:real^3`;`w:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC (SET_RULE`!x y A. x IN A /\ ~(y IN A)==> ~(x=y)`) +THEN EXISTS_TAC`set_of_edge (v:real^3) V E` +THEN ASM_REWRITE_TAC[]; + +MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ASM_SIMP_TAC[UNION;IN_ELIM_THM;set_of_only_edge;IN_SING;SET_RULE`((A \/ B)/\ (~ B)) <=>A /\ ~ B`] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC angle_is_small_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w:real^3`] +THEN ABBREV_TAC`u1=sigma_fan x V E v u` +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u1:real^3)`; +`(v:real^3)`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`u1:real^3`] +THEN MATCH_MP_TAC(REAL_ARITH`!A B C D. A=B+C /\ A<= B+D ==> C<= D`) +THEN EXISTS_TAC`azim x v u (u1:real^3)` +THEN EXISTS_TAC`azim x v u (w:real^3)` +THEN ASM_REWRITE_TAC[] +THEN FIRST_X_ASSUM (fun th-> REWRITE_TAC[SYM th] THEN MP_TAC(SYM th) THEN DISCH_THEN(LABEL_TAC"NHO")) +THEN DISJ_CASES_TAC(SET_RULE`(w1=u:real^3)\/ ~(w1=u)`) +THENL[ +ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESAL_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][DE_MORGAN_THM;] +THEN MRESAL_TAC AZIM_COMPL[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][REAL_ARITH`A+B-A=B`;] +THEN MATCH_MP_TAC (REAL_ARITH`A A<=B`) +THEN SIMP_TAC[azim]; +REMOVE_THEN"QUY" (fun th-> MRESA1_TAC th`w1:real^3`) +THEN MP_TAC(REAL_ARITH`azim x v u w + azim x v w u1 = azim x v u u1 /\ azim x v u u1 <= azim x v u w1 +/\ &0<= azim x v w u1==> azim x v u w <= azim x v u w1`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[azim] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +`(v:real^3)`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])]]]]);; + + + + +let SIGMA_FAN_OF_FANADD_AT_POINT2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 v u w. +FAN(x,V,E)/\ FAN(x,V,E1) +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ fan80(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ E UNION {{v,w}}=E1 +==> sigma_fan x V E1 v u = w`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC add_edge_graph[`v:real^3`;`w:real^3`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E1 = {u:real^3})\/ ~(set_of_edge v V E1 = {u})`) +THENL[ + +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; +STRIP_TAC +THEN MRESA_TAC UNIQUE_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN REMOVE_THEN "EM"(fun th -> REWRITE_TAC[SYM th;SET_OF_EDGE_UNION_GRAPH]) +THEN ASM_SIMP_TAC[SET_RULE`x IN A==> x IN A UNION B`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`; +`(w:real^3)`] +THEN ASM_SIMP_TAC[UNION;IN_ELIM_THM;set_of_only_edge;IN_SING;SET_RULE`((A \/ B)/\ (~ B)) <=>A /\ ~ B`] +THEN REPEAT STRIP_TAC +THENL[ +REMOVE_THEN "YEU"(fun th -> MRESA1_TAC th`v:real^3` THEN POP_ASSUM MP_TAC THEN ASSUME_TAC th) +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E = {u:real^3})\/ ~(set_of_edge v V E = {u})`) +THENL[ +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; +STRIP_TAC +THEN MRESA_TAC SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w1:real^3`) +THEN MRESA_TAC angle_is_small_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]; +ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC]]);; + + + + +let XFAN_INTER_SET=prove(`!x:real^N V E s:real^N->bool. +xfan(x,V,E) INTER s = UNIONS {y | ?e. e IN E /\ y = (aff_ge {x} e) INTER s}`, +REPEAT GEN_TAC +THEN REWRITE_TAC[XFAN_EQ_UNIONS_AFF_GE_1_2] +THEN ONCE_REWRITE_TAC[ EXTENSION] +THEN REWRITE_TAC[UNIONS; INTER;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC `{x' | x' IN aff_ge {x:real^N} e /\ x' IN s}` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC THEN RESA_TAC +THEN EXISTS_TAC`e:real^N->bool` +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC +THEN EXISTS_TAC `aff_ge {x:real^N} e ` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC `e:real^N->bool` +THEN ASM_REWRITE_TAC[]]);; + + + + +let condition_azim_imp_edge_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w w1. +FAN(x,V,E) +/\ {v,u} IN E /\ {u,w} IN E /\ {w,w1} IN E +/\ sigma_fan x V E u w = v +/\ sigma_fan x V E w w1 = u +/\ fan80(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ azim x w v u = azim x w w1 u +==> {v,w} IN E`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`w:real^3`;`w1:real^3`] THEN MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`w:real^3`;`u:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN ASM_REWRITE_TAC[DE_MORGAN_THM;] +THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`w:real^3`;`u:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN ASM_REWRITE_TAC[DE_MORGAN_THM;] +THEN RESA_TAC +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`w:real^3`;`u:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`w:real^3`;`u:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ARITH`A-B=A-C<=> B=C`] +THEN STRIP_TAC +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`w:real^3`;`u:real^3`;`v:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MATCH_MP_TAC AFF_GT_CUT_XFAN_IMP_EDGE_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`u:real^3` +THEN ASM_SIMP_TAC[SET_RULE`A INTER B= B INTER A`] +THEN MRESAL_TAC XFAN_INTER_SET[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`aff_gt {x:real^3} {v, w}`][IN;xfan] +THEN ASM_REWRITE_TAC[UNIONS;IN_ELIM_THM;SET_RULE`~(A={})<=> ?y. y IN A`] +THEN SUBGOAL_THEN`?y. y IN aff_gt {x:real^3} {v,w} INTER aff_ge {x} {w,w1}`ASSUME_TAC +THENL[ +MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{x:real^3,w:real^3}`;`{w1:real^3}`] +THEN MP_TAC(SET_RULE`v IN aff_gt {x, w} {w1} /\ aff_gt {x, w} {w1} SUBSET aff_ge {x, w} {w1} +==> v IN aff_ge {x, w} {w1:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC decomposition_planar_by_angle_fan[`x:real^3`;`w:real^3`;`w1:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THENL[ +POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{B,C}={C,B}`] +THEN STRIP_TAC +THEN MRESAL_TAC point_in_aff_ge[`x:real^3`;`w:real^3`;`w1:real^3`][INTER;IN_ELIM_THM] +THEN EXISTS_TAC`w1:real^3` +THEN ASM_REWRITE_TAC[]; + +MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +`(w:real^3)`] +THEN MRESA_TAC aff_gt12_subset_aff_ge[`x:real^3`;`w:real^3`;`w1:real^3`;`v:real^3`] +THEN ASM_SIMP_TAC[SET_RULE`A SUBSET B==> A INTER B= A`] +THEN MATCH_MP_TAC exists_in_aff_gt +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`; +`(w:real^3)`]]; + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN EXISTS_TAC `y:real^3` +THEN EXISTS_TAC `aff_gt {x} {v, w} INTER aff_ge {x} {w, w1:real^3}` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`{w,w1:real^3}` +THEN ASM_SIMP_TAC[SET_RULE`A INTER B= B INTER A`;] +THEN ASM_TAC +THEN SIMP_TAC[IN]]);; + +let condition_azim_le_pi=prove( +`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w. +FAN(x,V,E) +/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ fan80(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +==> &0< azim x w v u/\ azim x w v u < pi`, + + +REPEAT GEN_TAC +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`w:real^3`;`w1:real^3`] THEN MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`w:real^3`;`u:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN ASM_REWRITE_TAC[DE_MORGAN_THM;] +THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN ASM_REWRITE_TAC[DE_MORGAN_THM;] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`~(azim x w v u = &0) /\ &0<= azim x w v u==> &0< azim x w v u `) +THEN ASM_SIMP_TAC[azim] +THEN RESA_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`pi<= azim x w v u \/ azim x w v u < pi`) +THENL[ +MRESA_TAC AZIM_COMPL[`x:real^3`;`w:real^3`;`u:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`~(azim x w v u = pi)/\ pi<= azim x w v u /\ azim x w v u < &2 * pi /\ azim x w v u = &2 * pi - azim x w u v +==> &0 < azim x w u v /\ azim x w u v< pi`) +THEN ASM_SIMP_TAC[azim] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `w:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN REWRITE_TAC[DOT_LNEG] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[]]);; + + + + +let azim_trangle_le_azim_face_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w w1. +FAN(x,V,E) +/\ {v,u} IN E /\ {u,w} IN E /\ {w,w1} IN E /\ ~({v,w} IN E) +/\ sigma_fan x V E u w = v +/\ sigma_fan x V E w w1 = u +/\ fan80(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +==> azim x w v u < azim x w w1 u`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[REAL_ARITH`A ~(B<=A) `] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`w:real^3`;`w1:real^3`] THEN MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN DISCH_TAC THEN +MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] THEN DISCH_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +`(w:real^3)`] +THEN MRESA_TAC condition_azim_imp_edge_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`v:real^3`;`w1:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x w v u = azim x w v w1 + azim x w w1 u +/\ azim x w w1 u <= azim x w v u /\ &0< azim x w w1 u /\ ~(azim x w v u = azim x w w1 u) ==> &0 < azim x w v w1 /\ azim x w v w1 < azim x w v u`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC (SYM th)) +THEN RESA_TAC +THEN MRESA_TAC condition_azim_le_pi[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC WEDGE_LUNE_GT[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN SUBGOAL_THEN`w1 IN wedge x w v (u:real^3)` ASSUME_TAC +THENL[ +REWRITE_TAC[wedge;IN_ELIM_THM] +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_2_2[`x:real^3`;`v:real^3`;`w:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`] +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN DISCH_TAC THEN ASSUME_TAC th) THEN ASSUME_TAC th) +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`u:real^3`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC invariant_crossr_dot_esilon_3piont[`x:real^3`;`u:real^3`;`w:real^3`;`v:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC`h=t/ &2:real` +THEN MP_TAC(REAL_ARITH`&0< t/\ t< &1/\ h= t/ &2 ==> &0 <= h/\ &0< h/\ &0<= &1 -h /\ h< t`) +THEN RESA_TAC +THEN DISCH_THEN(fun th-> MRESA1_TAC th `h:real`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN REWRITE_TAC[INTER;IN_ELIM_THM] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN SUBGOAL_THEN`&0 < ((w - x) cross (v - x)) dot ((&1 - h) % w + h % w1 - x:real^3)/\ &0 < ((u - x) cross (w - x)) dot ((&1 - h) % w + h % w1 - x:real^3)` ASSUME_TAC +THENL[ + +REWRITE_TAC[VECTOR_ARITH`(&1 - h) % w + h % w1-x=(&1 - h) % (w-x) + h % (w1-x)`] +THEN REWRITE_TAC[DOT_RADD;DOT_RMUL;DOT_CROSS_SELF] +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`(&1 - h) % w + h % w1 IN aff_gt {x} {v,u,w:real^3}`ASSUME_TAC +THENL[ +MRESA_TAC inter_aff_gt_3_1_is_aff_gt_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;IN_ELIM_THM;INTER;VECTOR_ARITH`(A+B)-C=A+B-C:real^3`]); +SUBGOAL_THEN`(&1 - h:real) % w + h % (w1:real^3) IN aff_ge {x} {w,w1:real^3}`ASSUME_TAC +THENL[ + MRESAL_TAC AFF_GE_1_2[`x:real^3`;`w:real^3`;` w1:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1-h:real` +THEN EXISTS_TAC`h:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0 + &1 - h + h = &1`] +THEN REDUCE_VECTOR_TAC; +MRESA_TAC AFF_GE_SUBSET_XFAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`w1:real^3`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v:real^3`;`u:real^3`;`w:real^3`;] +THEN MRESA_TAC dart_leads_into_fan_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`u:real^3`; `w:real^3`] +THEN MRESA_TAC topological_component_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(dart_leads_into x V E u w):real^3->bool`] +THEN MP_TAC(SET_RULE`dart_leads_into x V E u w SUBSET yfan (x,V,E) +/\ aff_gt {x} {v, u, w} SUBSET dart_leads_into x V E u w +==> aff_gt {x} {v, u, w} SUBSET yfan (x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan] +THEN SET_TAC[]]]]]);; + + + +let SIGMA_FAN_OF_FANADD_AT_POINT3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 v u w. +FAN(x,V,E)/\ FAN(x,V,E1) +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ fan80(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ E UNION {{v,w}}=E1 +==> sigma_fan x V E1 w v = u`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC add_edge_graph[`v:real^3`;`w:real^3`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MP_TAC(SET_RULE`{u,w:real^3} IN E /\ E UNION {{v,w}}=E1==> {u,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (u:real^3)`; +`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`; +`(w:real^3)`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`) +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge w V E1 = {v:real^3})\/ ~(set_of_edge w V E1 = {v})`) +THENL[ +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; + +STRIP_TAC +THEN MRESA_TAC UNIQUE_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN REMOVE_THEN "EM"(fun th -> REWRITE_TAC[SYM th;SET_OF_EDGE_UNION_GRAPH]) +THEN ASM_SIMP_TAC[UNION;IN_ELIM_THM;set_of_only_edge1;IN_SING;SET_RULE`((A \/ B)/\ (~ B)) <=>A /\ ~ B`] +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`w2=inverse1_sigma_fan x V E w u:real^3` +THEN REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th`w:real^3` THEN POP_ASSUM MP_TAC THEN ASSUME_TAC(th)) +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge w V E = {w2:real^3})\/ ~(set_of_edge w V E = {w2})`) +THENL[ +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; + +STRIP_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w2:real^3)`; +`(w:real^3)`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`w2:real^3`] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w1:real^3`) +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(w1 = w2:real^3)\/ (w1 = w2)`) +THENL[ +RESA_TAC +THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` w2:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w w2 u==> azim x w v u <= azim x w w2 u`) +THEN RESA_TAC +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`w2:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN DISCH_THEN(LABEL_TAC "ME1") +THEN MP_TAC(REAL_ARITH`azim x w w2 (u:real^3) = azim x w w2 v + azim x w v u +/\ azim x w w2 u <= azim x w w2 w1 +/\ &0 <= azim x w v u +==> azim x w w2 v <= azim x w w2 w1 `) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[azim] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`w:real^3`;`w2:real^3`;`v:real^3`;`w1:real^3`] +THEN MATCH_MP_TAC(REAL_ARITH`!B A C. A+C<=A+B==>C<=B`) +THEN EXISTS_TAC`azim x w w2 (v:real^3)` +THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th;]) +THEN REMOVE_THEN "ME1"(fun th -> ASM_REWRITE_TAC[SYM th;]); +STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` w2:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w w2 u==> azim x w v u <= azim x w w2 u`) +THEN RESA_TAC +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`w2:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MATCH_MP_TAC(REAL_ARITH`!B A C. A+C<=A+B==>C<=B`) +THEN EXISTS_TAC`azim x w w2 (v:real^3)` +THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th;] +THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w w2 u /\ +azim x w w2 u = azim x w w2 v + azim x w v u +==> ~(azim x w w2 v = &0)`) +THEN ASM_REWRITE_TAC[SYM th] +THEN STRIP_TAC) +THEN MRESAL_TAC AZIM_COMPL[`x:real^3`;`w:real^3`;`w2:real^3`;`v:real^3`][REAL_ARITH`A+ B-A=B`] +THEN MATCH_MP_TAC(REAL_ARITH`!a b. a< b==> a<= b`) +THEN SIMP_TAC[azim]]]]);; + + +let elements_in_ds2_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ f10=(x,w,v,u) +/\ E UNION {{v,w}}= E1 +==> f10 IN ds2`, +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN REWRITE_TAC[face;orbit_map; IN_ELIM_THM] +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[POWER;ARITH_RULE`0>=0`;I_DEF;EQ_PAIR_4] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ]);; + + + + + + + + +let SIGMA_FAN_OF_FANADD_AT_POINT4=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w w1. + +FAN(x,V,E)/\ FAN(x,V,E1) +/\ fan80(x,V,E) +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) /\ ~(u=w1) +/\ {v,w1} IN E +/\ sigma_fan x V E u w = v + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ E UNION {{v,w}}=E1 +==> sigma_fan x V E1 v w1 = sigma_fan x V E v w1`, + + + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC add_edge_graph[`v:real^3`;`w:real^3`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E1 = {w1:real^3})\/ ~(set_of_edge v V E1 = {w1})`) +THENL(*1*)[ + +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC;(*1*) + + +STRIP_TAC +THEN MP_TAC(SET_RULE`{v,w1:real^3} IN E /\ E UNION {{v,w}}=E1==> {v,w1} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w1:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC UNIQUE_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`w1:real^3`;`sigma_fan x V E v w1:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN REMOVE_THEN "YEU"(fun th -> MRESA1_TAC th`v:real^3` THEN POP_ASSUM MP_TAC THEN ASSUME_TAC th) +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E = {w1:real^3})\/ ~(set_of_edge v V E = {w1})`) +THENL(*2*)[ + +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC;(*2*) + +STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`; +`(w:real^3)`] +THEN REMOVE_THEN "EM"(fun th -> REWRITE_TAC[SYM th;SET_OF_EDGE_UNION_GRAPH]) +THEN ASM_SIMP_TAC[SET_RULE`x IN A==> x IN A UNION B`] +THEN ASM_SIMP_TAC[UNION;IN_ELIM_THM;set_of_only_edge;IN_SING;SET_RULE`((A \/ B)/\ (~ B)) <=>A /\ ~ B`] +THEN MRESA_TAC SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MA") +THEN REPEAT STRIP_TAC +THENL(*3*)[ +REMOVE_THEN "MA"(fun th-> MRESA1_TAC th`w1':real^3`);(*3*) + +ASM_REWRITE_TAC[] +THEN REMOVE_THEN "MA"(fun th-> MRESA1_TAC th`u:real^3`) +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN DISJ_CASES_TAC(SET_RULE`~(sigma_fan x V E v u = w1)\/ (sigma_fan x V E v u = w1)`) +THENL(*4*)[ +ASM_REWRITE_TAC[] +THEN MRESA_TAC +MONO_AZIM_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w1:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E v u):real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`w1:real^3`;`u:real^3`;`(sigma_fan x V E v u):real^3`] +THEN MRESA_TAC angle_is_small_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w:real^3`] +THEN MP_TAC(REAL_ARITH`azim x v w1 (sigma_fan x V E v u) = + azim x v w1 u + azim x v u (sigma_fan x V E v u) +/\ azim x v u w <= azim x v u (sigma_fan x V E v u) +==> azim x v w1 u+ azim x v u w<= azim x v w1 (sigma_fan x V E v u) +`) +THEN POP_ASSUM(fun th -> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th -> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH` azim x v w1 (sigma_fan x V E v u)< &2 * pi +/\ azim x v w1 u+ azim x v u w<= azim x v w1 (sigma_fan x V E v u) +==> +azim x v w1 u+ azim x v u w< &2 * pi +`) +THEN ASM_SIMP_TAC[azim] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`E UNION {{v,w}}=E1==> {v,w} IN E1`) THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E1:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC sum3_azim_fan[`x:real^3`;`v:real^3`;`w1:real^3`;`u:real^3`;`w:real^3`] +THEN MATCH_MP_TAC(REAL_ARITH`!A B C.A<=B /\ &0<= C ==>A<= B+C`) +THEN ASM_SIMP_TAC[azim];(*4*) + +MRESA_TAC angle_is_small_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w:real^3`] +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`v:real^3`;` u:real^3`;`w1:real^3`] +THEN MP_TAC(REAL_ARITH` + azim x v w1 u + azim x v u (sigma_fan x V E v u) = &2 * pi +/\ azim x v u w <= azim x v u (sigma_fan x V E v u) +==> azim x v w1 u+ azim x v u w<= &2 * pi +`) +THEN POP_ASSUM(fun th -> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(SET_RULE`azim x v u w1 = &0\/ ~(azim x v u w1 = &0)`) +THENL(*5*)[ + +MRESA_TAC UNIQUE_AZIM_0_POINT_FAN[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w1:real^3`];(*5*) + +ASM_REWRITE_TAC[REAL_ARITH`A-B+B=A`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`E UNION {{v,w}}=E1==> {v,w} IN E1`) THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E1:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`] +THEN MP_TAC(REAL_ARITH`azim x v w1 u + azim x v u w <= &2 * pi +==> azim x v w1 u + azim x v u w < &2 * pi\/ azim x v w1 u + azim x v u w = &2 * pi`) +THEN RESA_TAC THENL(*6*)[ + +MRESA_TAC sum3_azim_fan[`x:real^3`;`v:real^3`;`w1:real^3`;`u:real^3`;`w:real^3`] +THEN MATCH_MP_TAC(REAL_ARITH`!A B C.A<=B /\ &0<= C ==>A<= B+C`) +THEN ASM_SIMP_TAC[azim];(*6*) + +POP_ASSUM MP_TAC +THEN MRESAL_TAC AZIM_COMPL[`x:real^3`;`v:real^3`;` u:real^3`;`w1:real^3`][REAL_ARITH`A-C+D=A<=> C=D`] +THEN STRIP_TAC +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`;`w:real^3`] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v:real^3`;`w:real^3`;`w1:real^3`] +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`v:real^3`;`w:real^3`;`w1:real^3`] +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w1:real^3`;`w:real^3`] decomposition_planar_by_angle_fan) +THEN RESA_TAC +THENL(*7*)[ +MRESA_TAC aff_gt3_subset_aff_gt[`x:real^3`;`v:real^3`;`w:real^3`;`w1:real^3`] +THEN MRESA_TAC exists_in_aff_gt_disjoint[`x:real^3`;`v:real^3`;`w1:real^3`] +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`w1:real^3`;] +THEN SUBGOAL_THEN`aff_gt {x} {v, w1:real^3} SUBSET xfan(x,V:real^3->bool,E)` ASSUME_TAC +THENL(*8*)[ + +REWRITE_TAC[xfan;SUBSET;IN_ELIM_THM] +THEN GEN_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`{v,w1}:real^3->bool` +THEN MP_TAC(SET_RULE`x' IN aff_gt {x}{v,w1}/\ aff_gt {x} { v,w1} SUBSET aff_ge {x} {v, w1} +==> x' IN aff_ge {x:real^3} {v, w1}`) +THEN RESA_TAC +THEN ASM_TAC +THEN SIMP_TAC[IN];(*8*) + +MP_TAC(SET_RULE`aff_gt {x} {v, w1} SUBSET aff_gt {x} {v, w}/\y IN aff_gt {x} {v, w1} +/\ aff_gt {x} {v, w1} SUBSET xfan (x,V,E) +==> ~(aff_gt {x:real^3} {v, w} INTER xfan (x,V:real^3->bool,E) ={})`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[xfan;IN ] +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GT_CUT_XFAN_IMP_EDGE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v:real^3`; `u:real^3`; `w:real^3`][IN] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_TAC +THEN SIMP_TAC[IN] ];(*7*) + + + + + +MRESA_TAC aff_gt12_subset_aff_ge[`x:real^3`;`v:real^3`;`w1:real^3`;`w:real^3`] +THEN SUBGOAL_THEN`aff_gt {x} {w, v:real^3} SUBSET xfan(x,V:real^3->bool,E)` ASSUME_TAC +THENL(*8*)[ +REWRITE_TAC[xfan;SUBSET;IN_ELIM_THM] +THEN GEN_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`{v,w1}:real^3->bool` +THEN MP_TAC(SET_RULE`x' IN aff_gt {x}{w,v}/\ aff_gt {x} {w, v} SUBSET aff_ge {x} {v, w1} +==> x' IN aff_ge {x:real^3} {v, w1}`) +THEN RESA_TAC +THEN ASM_TAC +THEN SIMP_TAC[IN]; + + +MRESA_TAC condition_aff_gt_subset_yfan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v:real^3`;`u:real^3`;`w:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REWRITE_TAC[yfan] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC exists_in_aff_gt_disjoint[`x:real^3`;`w:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]]]]]]]]);; + + + + + + + + + + + + +let SIGMA_FAN_OF_FANADD_AT_POINT5=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w w1. + +FAN(x,V,E)/\ FAN(x,V,E1) +/\ fan80(x,V,E) +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) /\ ~(w1=inverse1_sigma_fan x V E w u ) +/\ {w,w1} IN E +/\ sigma_fan x V E u w = v + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ E UNION {{v,w}}=E1 +==> sigma_fan x V E1 w w1 = sigma_fan x V E w w1`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC add_edge_graph[`v:real^3`;`w:real^3`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`{w:real^3, w1} IN E /\ E UNION {{v,w}}=E1 ==>{w, w1} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w1:real^3)`; +`(w:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +`(w:real^3)`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`) +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge w V E1 = {w1:real^3})\/ ~(set_of_edge w V E1 = {w1})`) +THENL(*1*)[ + +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC;(*1*) + +STRIP_TAC +THEN REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th`w:real^3` THEN POP_ASSUM MP_TAC THEN ASSUME_TAC(th)) +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge w V E = {w1:real^3})\/ ~(set_of_edge w V E = {w1})`) +THENL(*2*)[ +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC;(*2*) + +STRIP_TAC +THEN MRESA_TAC SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "MA") +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` ((sigma_fan x V E w w1):real^3)`;`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{w:real^3, sigma_fan x V E w w1} IN E /\ E UNION {{v,w}}=E1 ==>{w, sigma_fan x V E w w1} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` ((sigma_fan x V E w w1):real^3)`;`(w:real^3)`] +THEN MRESA_TAC UNIQUE_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`;`w1:real^3`;`sigma_fan x V E w w1:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN REMOVE_THEN "EM"(fun th -> REWRITE_TAC[SYM th;SET_OF_EDGE_UNION_GRAPH]) +THEN ASM_SIMP_TAC[SET_RULE`x IN A==> x IN A UNION B`] +THEN ASM_SIMP_TAC[UNION;IN_ELIM_THM;set_of_only_edge;IN_SING;SET_RULE`((A \/ B)/\ (~ B)) <=>A /\ ~ B`] +THEN REPEAT STRIP_TAC +THENL(*3*)[ +REMOVE_THEN "MA"(fun th-> MRESA1_TAC th`w1':real^3`);(*3*) + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;`(v:real^3)`] +THEN ASM_SIMP_TAC[set_of_only_edge;IN_SING] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`u:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` ((inverse1_sigma_fan x V E w u):real^3)`;`(w:real^3)`] +THEN REMOVE_THEN "MA"(fun th-> MRESA1_TAC th`inverse1_sigma_fan x V E w (u:real^3)`) +THEN MRESA_TAC MONO_AZIM_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`w1:real^3`;`(inverse1_sigma_fan x V E w u):real^3`] +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(u=w1:real^3)\/ u=w1`) +THENL(*4*)[ +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`w:real^3`;`w1:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w (inverse1_sigma_fan x V E w u) u +==> +azim x w v u <= azim x w (inverse1_sigma_fan x V E w u) (u:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`;`(w:real^3)`] +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u) u = + azim x w (inverse1_sigma_fan x V E w u) v + azim x w v u +/\ &0<= azim x w v u +==> azim x w (inverse1_sigma_fan x V E w u) v<=azim x w (inverse1_sigma_fan x V E w u) u +`) +THEN ASM_SIMP_TAC[azim] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u) v <= + azim x w (inverse1_sigma_fan x V E w u) u +/\ azim x w w1 u = + azim x w w1 (inverse1_sigma_fan x V E w u) + + azim x w (inverse1_sigma_fan x V E w u) u +/\ azim x w w1 u< &2 *pi +==> azim x w w1 (inverse1_sigma_fan x V E w u) + + azim x w (inverse1_sigma_fan x V E w u) v < &2 *pi + +`) +THEN SIMP_TAC[azim] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC sum3_azim_fan[`x:real^3`;`w:real^3`;`w1:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`v:real^3`] +THEN MATCH_MP_TAC (REAL_ARITH`!A B C. A<= B/\ &0<= C==> A<= B +C`) +THEN ASM_SIMP_TAC[azim];(*4*) + +POP_ASSUM(fun th -> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w (inverse1_sigma_fan x V E w u) u +==> +azim x w v u <= azim x w (inverse1_sigma_fan x V E w u) (u:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`;`(w:real^3)`] +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u) u = + azim x w (inverse1_sigma_fan x V E w u) v + azim x w v u +/\ &0<= azim x w v u +==> azim x w (inverse1_sigma_fan x V E w u) v<=azim x w (inverse1_sigma_fan x V E w u) u +`) +THEN ASM_SIMP_TAC[azim] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u) v <= + azim x w (inverse1_sigma_fan x V E w u) u +==> azim x w u (inverse1_sigma_fan x V E w u) + + azim x w (inverse1_sigma_fan x V E w u) v <= +azim x w u (inverse1_sigma_fan x V E w u) + + azim x w (inverse1_sigma_fan x V E w u) u +`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`azim x w (inverse1_sigma_fan x V E w u) u = &0\/ ~(azim x w (inverse1_sigma_fan x V E w u) (u:real^3) = &0)`) +THENL(*5*)[ +MRESA_TAC UNIQUE_AZIM_0_POINT_FAN[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`;`u:real^3`]; + +MRESAL_TAC AZIM_COMPL[`x:real^3`;`w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`;`u:real^3`][REAL_ARITH`A-B+B=A`] +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[SYM th;REAL_ARITH`A<=B<=> A A<= B +C`) +THEN ASM_SIMP_TAC[azim]; +POP_ASSUM MP_TAC +THEN MRESAL_TAC AZIM_COMPL[`x:real^3`;`w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`;`u:real^3`][REAL_ARITH`A-B+C=A<=> B=C`] +THEN STRIP_TAC +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`u:real^3`;`v:real^3`] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM1")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN ASM_REWRITE_TAC[]]]]]]]);; + + + + +let SIGMA_FAN_OF_FANADD_AT_POINT6=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w w1. +FAN(x,V,E)/\ FAN(x,V,E1) +/\ fan80(x,V,E) +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) /\ w1=inverse1_sigma_fan x V E w u +/\ {w,w1} IN E +/\ sigma_fan x V E u w = v + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ E UNION {{v,w}}=E1 +==> sigma_fan x V E1 w w1 = v`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC add_edge_graph[`v:real^3`;`w:real^3`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`{w:real^3, w1} IN E /\ E UNION {{v,w}}=E1 ==>{w, w1} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w1:real^3)`; +`(w:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +`(w:real^3)`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`) +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge w V E1 = {w1:real^3})\/ ~(set_of_edge w V E1 = {w1})`) +THENL[ +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; + +STRIP_TAC +THEN REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th`w:real^3` THEN POP_ASSUM MP_TAC THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"YEU")) +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge w V E = {w1:real^3})\/ ~(set_of_edge w V E = {w1})`) +THENL[ +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; +DISCH_THEN(LABEL_TAC"LINHYEU") +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` v:real^3`;`(w:real^3)`] +THEN MRESA_TAC UNIQUE_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`;`w1:real^3`;`v:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`) +THEN STRIP_TAC +THENL[ +STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "EM"(fun th -> REWRITE_TAC[SYM th;SET_OF_EDGE_UNION_GRAPH]) +THEN REWRITE_TAC[UNION;IN_ELIM_THM;IN_SING] +THEN REPEAT STRIP_TAC +THENL[(*4*) +REMOVE_THEN "LINHYEU" MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge w V E = {w1':real^3})\/ ~(set_of_edge w V E = {w1'})`) +THENL[ + +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; +STRIP_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`w1:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w1':real^3`) +THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w (inverse1_sigma_fan x V E w u) u +==> +azim x w v u <= azim x w (inverse1_sigma_fan x V E w u) (u:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u) u = + azim x w (inverse1_sigma_fan x V E w u) v + azim x w v u +/\ &0<= azim x w v u +==> azim x w (inverse1_sigma_fan x V E w u) v<=azim x w (inverse1_sigma_fan x V E w u) u +`) +THEN ASM_SIMP_TAC[azim] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` u:real^3`;`(v:real^3)`] +THEN MRESAL_TAC set_of_only_edge1[`v:real^3`;`w:real^3`;`V:real^3->bool`][IN_SING] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN REAL_ARITH_TAC]]]]);; + + + + +let f1_fan_of_f10_eq_f20=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ f10=(x,w,v,u) +/\ f20=(x,v,u,w) +/\ E UNION {{v,w}}= E1 +==> f20=f1_fan x V E1 f10`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN REWRITE_TAC[f1_fan;EQ_PAIR_4] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`{v,u:real^3} IN E /\ E UNION {{v,w}}= E1 +==> {v,u} IN E1`) THEN RESA_TAC THEN RESA_TAC);; + + + + + + +let f1_fan_of_f20_eq_f30=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ f20=(x,v,u,w) +/\ f30=(x,u,w,v) +/\ E UNION {{v,w}}= E1 +==> f30=f1_fan x V E1 f20`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN REWRITE_TAC[f1_fan;EQ_PAIR_4] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`) +THEN RESA_TAC +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`{u:real^3,w} IN E /\ E UNION {{v,w}}= E1 +==> {u,w} IN E1`) THEN RESA_TAC THEN RESA_TAC);; + + +let f1_fan_of_f30_eq_f10=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ f10=(x,w,v,u) +/\ f30=(x,u,w,v) +/\ E UNION {{v,w}}= E1 +==> f10=f1_fan x V E1 f30`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN REWRITE_TAC[f1_fan;EQ_PAIR_4] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `u:real^3`;`w:real^3` ] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MP_TAC(SET_RULE` E UNION {{v,w:real^3}}= E1 +==> {v,w} IN E1`) +THEN RESA_TAC THEN RESA_TAC);; + + + + + + +let f10_in_d1_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ f10=(x,w,v,u) +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> f10 IN d1_fan (x,V,E1)`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC f1_fan_of_f10_eq_f20[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)` ] +THEN MRESA_TAC f1_fan_of_f20_eq_f30[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC f1_fan_of_f30_eq_f10[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f30:real^3#real^3#real^3#real^3)`; ] +THEN MRESAL_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `u:real^3`;`w:real^3` ][d1_fan; IN_ELIM_THM] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 w v:real^3` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REMOVE_THEN "EM"(fun th-> REWRITE_TAC[SYM th]) +THEN SET_TAC[]);; + + + +let pair_disjoint_f10_f20_f30=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ f10=(x,w,v,u) +/\ f20=(x,v,u,w) +/\ f30=(x,u,w,v) +/\ E UNION {{v,w}}= E1 +==> ~(f10= f20)/\ ~(f20= f30)/\ ~(f30=f10)`, + +REPEAT GEN_TAC THEN STRIP_TAC +THEN ASM_REWRITE_TAC[EQ_PAIR_4;SET_RULE`~(A/\B)<=> ~ A\/ ~ B`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`;` (u:real^3)`]);; + + +let n_fan_permutes_prime=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool) p. +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) +==> (p n_fan) permutes (d_fan (x,V,E))`, + +REPEAT STRIP_TAC +THEN MRESA_TAC finite_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC PERMUTES_FINITE_SURJECTIVE[`d_fan (x:real^3,V,E)`;`res (n_fan x V E) (d1_fan (x:real^3,V,E))`] +THEN STRIP_TAC +THENL[ +REWRITE_TAC[res;d_fan;UNION;IN_ELIM_THM;DE_MORGAN_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[]; +MRESA_TAC into_domain_n_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(y IN d1_fan (x,V,E) )\/ (y IN d1_fan (x:real^3,V,E))`) +THENL[ +EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[res]; +MRESA_TAC permuters_of_enf_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN REWRITE_TAC[res] +THEN EXISTS_TAC`b:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC subset_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN ASM_TAC THEN SET_TAC[]]]);; + + +let f1_fan_permutes_prime=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool) p. +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) +==> (p f1_fan) permutes (d_fan (x,V,E))`, + +REPEAT STRIP_TAC +THEN MRESA_TAC finite_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC PERMUTES_FINITE_SURJECTIVE[`d_fan (x:real^3,V,E)`;`res (f1_fan x V E) (d1_fan (x:real^3,V,E))`] +THEN STRIP_TAC +THENL[ +REWRITE_TAC[res;d_fan;UNION;IN_ELIM_THM;DE_MORGAN_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[]; +MRESA_TAC into_domain_f1_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(y IN d1_fan (x,V,E) )\/ (y IN d1_fan (x:real^3,V,E))`) +THENL[ +EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[res]; +MRESA_TAC permuters_of_enf_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN REWRITE_TAC[res] +THEN EXISTS_TAC`b:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC subset_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN ASM_TAC THEN SET_TAC[]]]);; + + + + + + +let card_ds2_fanadd_eq3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> CARD ds2=3`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC f1_fan_of_f10_eq_f20[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)` ] +THEN MRESA_TAC f1_fan_of_f20_eq_f30[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC f1_fan_of_f30_eq_f10[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f30:real^3#real^3#real^3#real^3)`; ] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM YEU") +THEN MRESAL_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `u:real^3`;`w:real^3` ][face;orbit_map] +THEN MRESA_TAC f10_in_d1_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`3:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`f10:real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`2:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`f10:real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`1:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`f10:real^3#real^3#real^3#real^3` ) +THEN MRESAL_TAC card_orbit_le[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`3:num`;`(f10:real^3#real^3#real^3#real^3)`][ARITH_RULE`~(3=0)`;ARITH_RULE`3=SUC 2`;POWER_2;POWER;o_DEF] +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "EM YEU"(fun th -> REWRITE_TAC[SYM th;ARITH_RULE`SUC 2=3`;]) +THEN MRESAL_TAC in_orbit_lemma[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`0:num`;`(f10:real^3#real^3#real^3#real^3)`;`(f10:real^3#real^3#real^3#real^3)`] +[POWER;I_DEF] +THEN MRESAL_TAC in_orbit_lemma[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`1:num`;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`] +[POWER_1] +THEN MRESAL_TAC in_orbit_lemma[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`2:num`;`(f10:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`] +[POWER_2;o_DEF] +THEN MP_TAC(SET_RULE`f10 IN orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10 +/\ f1_fan x V E1 f10 IN + orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10 +/\ f1_fan x V E1 (f1_fan x V E1 f10) IN + orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10 +==> +{f10, f1_fan x V E1 f10,f1_fan x V E1 (f1_fan x V E1 f10)} SUBSET + orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10`) +THEN RESA_TAC +THEN MRESA_TAC pair_disjoint_f10_f20_f30[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ] +THEN SUBGOAL_THEN(`CARD {f10,f20,f30:real^3#real^3#real^3#real^3}=3`)ASSUME_TAC +THENL[ +SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] + +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; +POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC f1_fan_permutes_prime[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC finite_d_fan[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`] +THEN MRESA_TAC lemma_orbit_finite[`d1_fan(x:real^3,V,E1)`;`(res (f1_fan x V E1) (d1_fan (x:real^3,V,E1)))`;`(f10:real^3#real^3#real^3#real^3)`] +THEN MRESAL_TAC CARD_SUBSET_LE[`{f10, f1_fan x V E1 f10, f1_fan (x:real^3) V E1 (f1_fan x V E1 f10)}`;`orbit_map (res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))) f10`;][orbit_map] +]);; + + + + + +let reperentation_of_ds2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> ds2={f10,f20,f30}`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC f1_fan_of_f10_eq_f20[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)` ] +THEN MRESA_TAC f1_fan_of_f20_eq_f30[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC f1_fan_of_f30_eq_f10[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f30:real^3#real^3#real^3#real^3)`; ] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM YEU") +THEN MRESAL_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `u:real^3`;`w:real^3` ][face;orbit_map] +THEN MRESA_TAC f10_in_d1_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`3:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`f10:real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`2:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`f10:real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`1:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`f10:real^3#real^3#real^3#real^3` ) +THEN MRESAL_TAC card_orbit_le[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`3:num`;`(f10:real^3#real^3#real^3#real^3)`][ARITH_RULE`~(3=0)`;ARITH_RULE`3=SUC 2`;POWER_2;POWER;o_DEF] +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "EM YEU"(fun th -> REWRITE_TAC[SYM th;ARITH_RULE`SUC 2=3`;]) +THEN MRESAL_TAC in_orbit_lemma[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`0:num`;`(f10:real^3#real^3#real^3#real^3)`;`(f10:real^3#real^3#real^3#real^3)`] +[POWER;I_DEF] +THEN MRESAL_TAC in_orbit_lemma[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`1:num`;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`] +[POWER_1] +THEN MRESAL_TAC in_orbit_lemma[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`2:num`;`(f10:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`] +[POWER_2;o_DEF] +THEN MP_TAC(SET_RULE`f10 IN orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10 +/\ f1_fan x V E1 f10 IN + orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10 +/\ f1_fan x V E1 (f1_fan x V E1 f10) IN + orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10 +==> +{f10, f1_fan x V E1 f10,f1_fan x V E1 (f1_fan x V E1 f10)} SUBSET + orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10`) +THEN RESA_TAC +THEN MRESA_TAC pair_disjoint_f10_f20_f30[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ] +THEN SUBGOAL_THEN(`CARD {f10,f20,f30:real^3#real^3#real^3#real^3}=3`)ASSUME_TAC +THENL[ +SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] + +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; +POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC f1_fan_permutes_prime[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC finite_d_fan[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`] +THEN MRESA_TAC lemma_orbit_finite[`d1_fan(x:real^3,V,E1)`;`(res (f1_fan x V E1) (d1_fan (x:real^3,V,E1)))`;`(f10:real^3#real^3#real^3#real^3)`] +THEN MRESAL_TAC CARD_SUBSET_LE[`{f10, f1_fan x V E1 f10, f1_fan (x:real^3) V E1 (f1_fan x V E1 f10)}`;`orbit_map (res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))) f10`;][orbit_map]]);; + + +let edge_not_in_ds2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ f10=(x,w,v,u) +/\ f20=(x,v,u,w) +/\ f30=(x,u,w,v) +/\ E UNION {{v,w}}=E1 +==> ~((x,v,w,sigma_fan x V E1 v w) IN ds2)`, + +REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESAL_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ][SET_RULE`~(a IN {b,c,d})<=> ~(a=b)/\ ~(a=c)/\ ~(a=d) `;EQ_PAIR_4;SET_RULE`~(A/\B)<=> ~ A\/ ~ B`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`;` (u:real^3)`] +THEN ASM_TAC +THEN DISJ_CASES_TAC(SET_RULE`v=w \/ ~(v=w:real^3)`) +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC SIGMA_FAN [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`; +` w:real^3`] +THEN FIND_ASSUM (MP_TAC)`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)` +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> MP_TAC (ISPEC `u:real^3` th) ) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC);; + + + +let disjoint_ds1_and_ds2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> ~(ds1=ds2)`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA_TAC edge_not_in_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ] +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;face;orbit_map;IN_ELIM_THM]) +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF]);; + + + + +let card_eq_image_in_d_fan=prove(`!x V E ds. +FAN(x,V,E) /\ +(!v. v IN V==>CARD (set_of_edge v V E) >1)/\ +ds SUBSET d_fan(x,V,E) +==> +CARD(IMAGE pr23 ds)= CARD ds`, + +REPEAT STRIP_TAC +THEN MATCH_MP_TAC CARD_IMAGE_INJ +THEN MRESA_TAC finite_d_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC FINITE_SUBSET[`ds:real^3#real^3#real^3#real^3->bool`; `d_fan(x:real^3,V,E):real^3#real^3#real^3#real^3->bool`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`x' IN ds /\ y IN ds /\ ds SUBSET d_fan(x,V,E)==> x' IN d_fan(x:real^3,V,E)/\ y IN d_fan(x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN REWRITE_TAC[d_fan;UNION;d1_fan;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[pr23;PAIR_EQ] +THEN RESA_TAC);; + + + + + + +let trans=new_definition`trans (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) E1=(\(x,y:real^3,z,sigma_fan x V E y z). (x,y,z,sigma_fan x V E1 y z))` +;; + +let tran=new_definition`tran x V E1=(\(x,y:real^3,z,w). (x,y,z,sigma_fan x V E1 y z))` +;; + + +let tranf=new_definition`tranf x V E E1 ds=(@f. ?y. f = face (hypermap1_of_fanx (x,V,E1)) (tran x V E1 y)/\ y IN ds)` +;; + + + +let exists_tranf_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds +==> ?f. ?y. f = face (hypermap1_of_fanx (x,V,E1)) (tran x V E1 y)/\ y IN ds0`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MP_TAC(SET_RULE` ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds +==> ds0 IN face_set (hypermap1_of_fanx (x,V,E)) `) +THEN ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM;] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN REMOVE_THEN "YEU" MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`face (hypermap1_of_fanx (x:real^3,V,E1)) (tran x V E1 (x':real^3#real^3#real^3#real^3))` +THEN EXISTS_TAC`x':real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[tran;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF]);; + + + + + + +let TRANF=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds +==> +?y. tranf x V E E1 ds0 = face (hypermap1_of_fanx (x,V,E1)) (tran x V E1 y)/\ y IN ds0`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN ONCE_REWRITE_TAC[tranf] + THEN MRESA_TAC exists_tranf_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0:real^3#real^3#real^3#real^3->bool` ] +THEN SELECT_ELIM_TAC +THEN EXISTS_TAC`f:real^3#real^3#real^3#real^3->bool` +THEN EXISTS_TAC`y:real^3#real^3#real^3#real^3` THEN ASM_REWRITE_TAC[]);; + + + + + + +let exists_edge_not_edge_in_face=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y n:num. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ y IN d_fan(x,V,E) +==> +?y1. y1 IN d_fan(x,V,E)/\ ~(pr2 y1 IN {v,w})/\ +face (hypermap1_of_fanx (x,V,E)) y1= face (hypermap1_of_fanx (x,V,E)) y +`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(pr2 y IN {v,w})\/ pr2 y IN {v,w}`) +THENL[ +EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`A IN {B,C}<=> A=B\/ A=C`] +THEN STRIP_TAC +THENL[ EXISTS_TAC`f1_fan x V E (y:real^3#real^3#real^3#real^3)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain1_f1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN SUBGOAL_THEN`f1_fan x V E y IN face (hypermap1_of_fanx (x:real^3,V,E)) y` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[face;IN_ELIM_THM;orbit_map;] +THEN EXISTS_TAC`1:num` +THEN REWRITE_TAC[ARITH_RULE`1>=0`;] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`1:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` ) +THEN REWRITE_TAC[POWER_1]; + +MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`y:real^3#real^3#real^3#real^3`;`(f1_fan x V E y):real^3#real^3#real^3#real^3`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[d1_fan; IN_ELIM_THM;] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[f1_fan;pr2] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w':real^3)`; +`(v':real^3)`] +THEN REMOVE_THEN"YEU EM" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]]; + +EXISTS_TAC`f1_fan x V E (y:real^3#real^3#real^3#real^3)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain1_f1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN SUBGOAL_THEN`f1_fan x V E y IN face (hypermap1_of_fanx (x:real^3,V,E)) y` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[face;IN_ELIM_THM;orbit_map;] +THEN EXISTS_TAC`1:num` +THEN REWRITE_TAC[ARITH_RULE`1>=0`;] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`1:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` ) +THEN REWRITE_TAC[POWER_1]; + +MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`y:real^3#real^3#real^3#real^3`;`(f1_fan x V E y):real^3#real^3#real^3#real^3`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[d1_fan; IN_ELIM_THM;] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[f1_fan;pr2] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"YEU EM" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w':real^3)`; +`(v':real^3)`]]]]);; + + + + +let TRAN_COMMUTATIVE_F1_FAN1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ~(pr3 y IN {v,w}) +/\ y IN d_fan(x,V,E) +==> +tran x V E1 ((f1_fan x V E ) y)=(f1_fan x V E1 ) (tran x V E1 y)`, + + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EMYEU") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[f1_fan;tran;PAIR_EQ] +THEN REMOVE_THEN"EMYEU" MP_TAC +THEN ASM_REWRITE_TAC[pr3] +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`w':real^3`;`(inverse1_sigma_fan (x:real^3) V E w' v')`]) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w':real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REPEAT RESA_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(RAND_CONV o ONCE_DEPTH_CONV)[SYM th]) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w':real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`inverse1_sigma_fan x V E w' (v':real^3)`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MP_TAC(SET_RULE`{inverse1_sigma_fan x V E w' v', w'} IN E +/\ E1= E UNION {{v,w}}==> {inverse1_sigma_fan x V E w' v', w'} IN E1`) +THEN REPEAT RESA_TAC);; + + + + +let TRAN_COMMUTATIVE_F1_FAN2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ~(pr2 y= u) +/\ pr3 y = w +/\ y IN d_fan(x,V,E) +==> +tran x V E1 ((f1_fan x V E ) y)=(f1_fan x V E1 ) (tran x V E1 y)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN DISCH_THEN(LABEL_TAC"EMYEU") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[f1_fan;tran;PAIR_EQ] +THEN REMOVE_THEN"EMYEU" MP_TAC +THEN ASM_REWRITE_TAC[pr3] +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN REMOVE_THEN"YEU EM" MP_TAC +THEN ASM_REWRITE_TAC[pr2] +THEN RESA_TAC +THEN SUBGOAL_THEN(`~(inverse1_sigma_fan (x:real^3) V E w v'=inverse1_sigma_fan x V E w u)`) ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN STRIP_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`u:real^3` +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REMOVE_THEN "LINH"(fun th-> ASM_REWRITE_TAC[SYM th] THEN ASSUME_TAC th +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"LINH")) +THEN RESA_TAC +THEN MRESA1_TAC th`v':real^3` +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "LINH"(fun th-> ASM_REWRITE_TAC[SYM th] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN RESA_TAC)); + +MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`) +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "LINH"(fun th-> ASM_REWRITE_TAC[SYM th] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[] +THEN ASSUME_TAC th) +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT5[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w v'):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`inverse1_sigma_fan x V E w (v':real^3)`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MP_TAC(SET_RULE`{inverse1_sigma_fan x V E w v', w} IN E +/\ E1= E UNION {{v,w}}==> {inverse1_sigma_fan x V E w v', w} IN E1`) +THEN REPEAT RESA_TAC]);; + + + + + +let TRAN_COMMUTATIVE_F1_FAN3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ~(pr2 y= sigma_fan x V E v u) +/\ pr3 y = v +/\ y IN d_fan(x,V,E) +==> +tran x V E1 ((f1_fan x V E ) y)=(f1_fan x V E1 ) (tran x V E1 y)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN DISCH_THEN(LABEL_TAC"EMYEU") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[f1_fan;tran;PAIR_EQ] +THEN REMOVE_THEN"EMYEU" MP_TAC +THEN ASM_REWRITE_TAC[pr3] +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN REMOVE_THEN"YEU EM" MP_TAC +THEN ASM_REWRITE_TAC[pr2] +THEN RESA_TAC +THEN SUBGOAL_THEN(`~(u=inverse1_sigma_fan (x:real^3) V E v v')`) ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3` +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REMOVE_THEN "LINH"(fun th-> ASM_REWRITE_TAC[SYM th] THEN ASSUME_TAC th +THEN RESA_TAC)); +MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3` +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REMOVE_THEN "LINH"(fun th-> ASM_REWRITE_TAC[SYM th] THEN ASSUME_TAC th +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[SYM th] THEN ASSUME_TAC th +THEN RESA_TAC )) +THEN STRIP_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT4[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E v v'):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`inverse1_sigma_fan x V E v (v':real^3)`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MP_TAC(SET_RULE`{inverse1_sigma_fan x V E v v', v} IN E +/\ E1= E UNION {{v,w}}==> {inverse1_sigma_fan x V E v v', v} IN E1`) +THEN REPEAT RESA_TAC]);; + + + + + + +let TRAN_COMMUTATIVE_F1_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ~(y IN ds) +/\ y IN d_fan(x,V,E) +==> +tran x V E1 ((f1_fan x V E ) y)=(f1_fan x V E1 ) (tran x V E1 y)`, + + +REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE` +((pr2 y= sigma_fan x V E v u)/\ pr3 y = v)\/ +((pr2 y= u)/\ pr3 y = w)\/ +(~(pr2 y= sigma_fan x V E v u)/\ pr3 y = v)\/ +(~(pr2 y= u)/\ pr3 y = w)\/ + ~(pr3 y IN {v,w})`) +THENL[ +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN DISCH_THEN(LABEL_TAC"EMYEU") +THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN REMOVE_THEN "LINH" ( fun th->MP_TAC th +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN MP_TAC th THEN RESA_TAC) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[f1_fan;tran;PAIR_EQ] +THEN REMOVE_THEN"EMYEU" MP_TAC +THEN ASM_REWRITE_TAC[pr2] +THEN RESA_TAC +THEN REMOVE_THEN"YEU EM" MP_TAC +THEN ASM_REWRITE_TAC[pr3] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EMYEU") +THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN STRIP_TAC +THEN STRIP_TAC +THEN REMOVE_THEN"YEU EM" MP_TAC +THEN REMOVE_THEN"EMYEU" MP_TAC +THEN RESA_TAC THEN STRIP_TAC +THEN SUBGOAL_THEN`f1= f1_fan x V E (y:real^3#real^3#real^3#real^3)`ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[f1_fan] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`u:real^3` ) +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds /\ ds SUBSET d1_fan (x,V,E)==> {f1,f2,f3} SUBSET (ds:real^3#real^3#real^3#real^3->bool)/\ f1 IN d1_fan (x,V,E) `) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`pr2 f1 =v:real^3` +THEN FIND_ASSUM(MP_TAC)`pr3 f1= u :real^3` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;pr2;pr3]) +THEN RESA_TAC +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN DISCH_THEN(fun th-> ASSUME_TAC(SYM th)) +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds /\ ds SUBSET d1_fan (x,V,E)==> {f1,f2,f3} SUBSET (ds:real^3#real^3#real^3#real^3->bool)/\ f1 IN ds `) +THEN RESA_TAC +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f1:real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`]]; + + + + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL[ + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN DISCH_THEN(LABEL_TAC"EMYEU") +THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN REMOVE_THEN "LINH" ( fun th->MP_TAC th +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN MP_TAC th THEN RESA_TAC) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[f1_fan;tran;PAIR_EQ] +THEN REMOVE_THEN"EMYEU" MP_TAC +THEN ASM_REWRITE_TAC[pr2] +THEN RESA_TAC +THEN REMOVE_THEN"YEU EM" MP_TAC +THEN ASM_REWRITE_TAC[pr3] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EMYEU") +THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN STRIP_TAC +THEN STRIP_TAC +THEN REMOVE_THEN"YEU EM" MP_TAC +THEN REMOVE_THEN"EMYEU" MP_TAC +THEN RESA_TAC THEN STRIP_TAC +THEN SUBGOAL_THEN`f2= (y:real^3#real^3#real^3#real^3)`ASSUME_TAC +THENL[ +MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds /\ ds SUBSET d1_fan (x,V,E)==> {f1,f2,f3} SUBSET (ds:real^3#real^3#real^3#real^3->bool)/\ f2 IN d1_fan (x,V,E) `) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`pr2 f2 =u:real^3` +THEN FIND_ASSUM(MP_TAC)`pr3 f2= w :real^3` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;pr2;pr3]) +THEN RESA_TAC +THEN RESA_TAC; +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN DISCH_TAC +THEN MP_TAC(SET_RULE`{f1,f2,f3:real^3#real^3#real^3#real^3} SUBSET ds ==> f2 IN ds `) +THEN RESA_TAC]; +MRESA_TAC TRAN_COMMUTATIVE_F1_FAN3 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`]; + +MRESA_TAC TRAN_COMMUTATIVE_F1_FAN2 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`]; + +MRESA_TAC TRAN_COMMUTATIVE_F1_FAN1 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`]]]);; + + + +let f1_fan_power_in_face=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y n. +FAN(x,V,E)/\ +(!v. v IN V ==> CARD (set_of_edge v V E) > 1) /\ + ds IN face_set (hypermap1_of_fanx (x,V,E))/\ +y IN d1_fan (x,V,E) +/\ ~(y IN ds) +==> ~((f1_fan x V E POWER n) y IN ds)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN MATCH_MP_TAC MONO_NOT +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC +THENL[ +ASM_REWRITE_TAC[POWER;I_DEF]; + + +REWRITE_TAC[COM_POWER;o_DEF] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3`) +THEN MP_TAC(SET_RULE`(f1_fan x V E POWER n) y IN d1_fan (x,V,E)/\ +d_fan (x,V,E)=d1_fan (x,V,E) UNION d20_fan (x,V,E) +==> (f1_fan x V E POWER n) y IN d_fan (x,V,E)`) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[d_fan] +THEN RESA_TAC +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`(f1_fan x V E ((f1_fan x V E POWER n) y)):real^3#real^3#real^3#real^3`;`((f1_fan x V E POWER n) y):real^3#real^3#real^3#real^3`]]);; + + +let f1_fan_power_in_face_imp_in_face=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y n. +FAN(x,V,E)/\ +(!v. v IN V ==> CARD (set_of_edge v V E) > 1) /\ + ds IN face_set (hypermap1_of_fanx (x,V,E))/\ +y IN d1_fan (x,V,E) +/\ ((f1_fan x V E POWER n) y IN ds) +==> +(y IN ds)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC +THENL[ +ASM_REWRITE_TAC[POWER;I_DEF]; + + +REWRITE_TAC[COM_POWER;o_DEF] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3`) +THEN MP_TAC(SET_RULE`(f1_fan x V E POWER n) y IN d1_fan (x,V,E)/\ +d_fan (x,V,E)=d1_fan (x,V,E) UNION d20_fan (x,V,E) +==> (f1_fan x V E POWER n) y IN d_fan (x,V,E)`) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[d_fan] +THEN RESA_TAC +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`(f1_fan x V E ((f1_fan x V E POWER n) y)):real^3#real^3#real^3#real^3`;`((f1_fan x V E POWER n) y):real^3#real^3#real^3#real^3`]]);; + + + +let TRAN_COMMUTATIVE_F1_FAN0=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 + /\ ((~(pr2 y= sigma_fan x V E v u)/\ pr3 y = v)\/ +(~(pr2 y= u)/\ pr3 y = w) \/ ~(pr3 y IN {v,w})) +/\ y IN d_fan(x,V,E) +==> +tran x V E1 ((f1_fan x V E ) y)=(f1_fan x V E1 ) (tran x V E1 y)`, + + +REPEAT STRIP_TAC +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN1 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN2 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN3 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`]);; + + + +let TRAN_COMMUTATIVE_F1_FAN_POWER=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y n. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ~(y IN ds) +/\ y IN d_fan(x,V,E) +==> +tran x V E1 ((f1_fan x V E POWER n) y)=(f1_fan x V E1 POWER n) (tran x V E1 y)`, + +REPEAT STRIP_TAC +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC +THENL[ + +REWRITE_TAC[POWER;I_DEF]; +REWRITE_TAC[COM_POWER;o_DEF] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(((f1_fan x V E POWER n) y):real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3`) +THEN ASM_SIMP_TAC[f1_fan_power_in_face]]);; + + + + + + +let TRAN_COMMUTATIVE_F1_FAN_POWER1=prove( +`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y n. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ y IN d_fan(x,V,E) +/\ (!m. m < n ==> ~(pr3 ((f1_fan x V E POWER m) y) IN {v,w})) +==> +tran x V E1 ((f1_fan x V E POWER n) y)=(f1_fan x V E1 POWER n) (tran x V E1 y)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC +THENL[ + +REWRITE_TAC[POWER;I_DEF]; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINK") +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN DISCH_TAC +THEN SUBGOAL_THEN`(!m. m < n ==> ~(pr3 ((f1_fan x V E POWER m) y) IN {v, w:real^3}))` ASSUME_TAC +THENL[ REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (ARITH_RULE`!m n. m m< SUC n`)[`m:num`;`n:num`]; +REMOVE_THEN "LINH" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN REWRITE_TAC[COM_POWER;o_DEF] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`n:num`[ARITH_RULE`n< SUC n`]) +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN1 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(((f1_fan x V E POWER n) y):real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN STRIP_TAC +THEN REMOVE_THEN "LINK" MP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3`) +THEN ASM_SIMP_TAC[f1_fan_power_in_face]]]);; + + + + + + + + + + +let TRAN_COMMUTATIVE_F1_FAN_POWER2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y n. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ y IN d_fan(x,V,E) +/\ (!m. m < n ==> ((~(pr2 ((f1_fan x V E POWER m) y)= sigma_fan x V E v u)/\ pr3 ((f1_fan x V E POWER m) y) = v)\/ +(~(pr2 ((f1_fan x V E POWER m) y)= u)/\ pr3 ((f1_fan x V E POWER m) y) = w)) +) +==> +tran x V E1 ((f1_fan x V E POWER n) y)=(f1_fan x V E1 POWER n) (tran x V E1 y)`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC + +THENL[ + +REWRITE_TAC[POWER;I_DEF]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINK") +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN DISCH_TAC +THEN SUBGOAL_THEN`(!m. m < n ==> ((~(pr2 ((f1_fan x V E POWER m) y)= sigma_fan x V E v u)/\ pr3 ((f1_fan x V E POWER m) y) = v)\/ +(~(pr2 ((f1_fan x V E POWER m) y)= u)/\ pr3 ((f1_fan x V E POWER m) y) = w:real^3)) +)` ASSUME_TAC +THENL[ +REPEAT STRIP_TAC +THEN MRESA_TAC (ARITH_RULE`!m n. m m< SUC n`)[`m:num`;`n:num`]; +REMOVE_THEN "LINH" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN REWRITE_TAC[COM_POWER;o_DEF] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`n:num`[ARITH_RULE`n< SUC n`]) +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN0 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(((f1_fan x V E POWER n) y):real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN STRIP_TAC +THEN REMOVE_THEN "LINK" MP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3`) +THEN ASM_SIMP_TAC[f1_fan_power_in_face]]]);; + + + +let TRAN_COMMUTATIVE_F1_FAN_POWER3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y n. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ y IN d_fan(x,V,E) +/\ (!m. m < n ==> (~(pr2 ((f1_fan x V E POWER m) y) = sigma_fan x V E v u) /\ + pr3 ((f1_fan x V E POWER m) y) = v) \/ + (~(pr2 ((f1_fan x V E POWER m) y) = u) /\ + pr3 ((f1_fan x V E POWER m) y) = w) \/ + ~(pr3 ((f1_fan x V E POWER m) y) IN {v, w})) +==> +tran x V E1 ((f1_fan x V E POWER n) y)=(f1_fan x V E1 POWER n) (tran x V E1 y)`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC + +THENL[ + +REWRITE_TAC[POWER;I_DEF]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINK") +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN DISCH_TAC +THEN SUBGOAL_THEN`(!m. m < n ==> (~(pr2 ((f1_fan x V E POWER m) y) = sigma_fan x V E v u) /\ + pr3 ((f1_fan x V E POWER m) y) = v) \/ + (~(pr2 ((f1_fan x V E POWER m) y) = u) /\ + pr3 ((f1_fan x V E POWER m) y) = w) \/ + ~(pr3 ((f1_fan x V E POWER m) y) IN {v, w}) +)` ASSUME_TAC +THENL[ +REPEAT STRIP_TAC +THEN MRESA_TAC (ARITH_RULE`!m n. m m< SUC n`)[`m:num`;`n:num`]; +REMOVE_THEN "LINH" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN REWRITE_TAC[COM_POWER;o_DEF] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`n:num`[ARITH_RULE`n< SUC n`]) +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN0 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(((f1_fan x V E POWER n) y):real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN STRIP_TAC +THEN REMOVE_THEN "LINK" MP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3`) +THEN ASM_SIMP_TAC[f1_fan_power_in_face]]]);; + + + +let unique_tranf_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0 f y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ f= face (hypermap1_of_fanx (x,V,E1)) (tran x V E1 y)/\ y IN ds0 +/\ ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds +==> tranf x V E E1 ds0 = f`, + +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC TRANF[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0:real^3#real^3#real^3#real^3->bool` ] +THEN FIND_ASSUM(MP_TAC) `ds0 IN face_set (hypermap1_of_fanx (x:real^3,V,E))` +THEN REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN SUBGOAL_THEN`orbit_map (res (f1_fan x V E) (d1_fan (x,V,E))) x'=face (hypermap1_of_fanx (x:real^3,V,E)) x'`(fun th-> REWRITE_TAC[th]) +THENL[ + ASM_REWRITE_TAC[face]; + +STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC lemma_face_subset[`hypermap1_of_fanx (x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`] +THEN MP_TAC(SET_RULE`face (hypermap1_of_fanx (x,V,E)) x' SUBSET d1_fan (x,V,E) +/\ y IN face (hypermap1_of_fanx (x,V,E)) x' ==> y IN d1_fan(x,V,E)`) +THEN RESA_TAC +THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN DISCH_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[face;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM;orbit_map] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` ) +THEN RESA_TAC +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN_POWER +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`;`n:num`] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x:real^3,V,E1)) ((f1_fan x V E1 POWER n) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3)))):real^3#real^3#real^3#real^3->bool`;`(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E1)) ((f1_fan x V E1 POWER n) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))) IN + face_set (hypermap1_of_fanx (x:real^3,V,E1))`ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;face] +THEN EXISTS_TAC`(f1_fan (x:real^3) V E1 POWER n) (tran x V E1 (y:real^3#real^3#real^3#real^3))` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`n:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`) +THEN POP_ASSUM MATCH_MP_TAC + +THEN FIND_ASSUM(MP_TAC)`y IN d1_fan (x:real^3,V,E)` +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[tran] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v':real^3` +THEN EXISTS_TAC`w':real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v' (w':real^3)` +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM] THEN ASM_REWRITE_TAC[])` E UNION {{v:real^3,w}}= E1`; + +MRESA_TAC f1_fan_power_in_face_imp_in_face[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`; +`(face (hypermap1_of_fanx (x,V,E1)) ((f1_fan x V E1 POWER n) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3)))):real^3#real^3#real^3#real^3->bool`;`tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3)` ;`n:num`] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN STRIP_TAC +THENL[ + +FIND_ASSUM(MP_TAC)`y IN d1_fan (x:real^3,V,E)` +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[tran] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v':real^3` +THEN EXISTS_TAC`w':real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v' (w':real^3)` +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM] THEN ASM_REWRITE_TAC[])` E UNION {{v:real^3,w}}= E1`; + +EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF]]]]);; + + + + + + +let tran_in_dart_newfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 y . +FAN(x,V,E)/\ FAN(x,V,E1) +/\ E SUBSET E1 +/\ y IN d1_fan(x,V,E) +==> tran x V E1 y IN d1_fan(x,V,E1)`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN REWRITE_TAC[tran] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v (w:real^3)` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN SET_TAC[]);; + + + + +let INJ_TRAN_D1_FAN=prove(` !x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 y y1. +FAN(x,V,E)/\ FAN(x,V,E1) +/\ E SUBSET E1 +/\ y IN d1_fan(x,V,E) +/\ y1 IN d1_fan(x,V,E) +/\ +tran x V E1 y = tran x V E1 y1 +==> y =y1`, +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[tran;PAIR_EQ] +THEN RESA_TAC);; + + + + + + +let INJ_TRANF_FACE_DELETE_DS= prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0 ds0'. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds +/\ ds0' IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds +/\ tranf x V E E1 ds0=tranf x V E E1 ds0' +==> + ds0 = ds0'`, + + + +REPEAT STRIP_TAC +THEN MRESA_TAC TRANF[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0:real^3#real^3#real^3#real^3->bool` ] +THEN SUBGOAL_THEN`(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3)) IN face (hypermap1_of_fanx (x,V,E1)) (tran x V E1 y)`ASSUME_TAC +THENL[ + +REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF]; + +POP_ASSUM MP_TAC +THEN MRESA_TAC TRANF[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0':real^3#real^3#real^3#real^3->bool` ] +THEN REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM(MP_TAC)`ds0' IN face_set (hypermap1_of_fanx (x:real^3,V,E)) DELETE ds` +THEN REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN RESA_TAC +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0':real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y' IN ds0'/\ ds0' SUBSET d1_fan (x:real^3,V,E)==> y' IN d1_fan (x,V,E)`) +THEN RESA_TAC +THEN FIND_ASSUM(MP_TAC)`ds0 IN face_set (hypermap1_of_fanx (x:real^3,V,E)) DELETE ds` +THEN REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN RESA_TAC +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y IN ds0/\ ds0 SUBSET d1_fan (x:real^3,V,E)==> y IN d1_fan (x,V,E)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`E UNION {{v:real^3,w}}= E1==> E SUBSET E1`) +THEN RESA_TAC +THEN MRESA_TAC tran_in_dart_newfan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(E1:(real^3->bool)->bool)`; +`y':real^3#real^3#real^3#real^3`] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`tran (x:real^3) V E1 (y':real^3#real^3#real^3#real^3)`) +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0':real^3#real^3#real^3#real^3->bool`;`y':real^3#real^3#real^3#real^3`] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y':real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN_POWER +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y':real^3#real^3#real^3#real^3)`;`n:num`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y':real^3#real^3#real^3#real^3)`) +THEN MRESA_TAC INJ_TRAN_D1_FAN +[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(E1:(real^3->bool)->bool)`; +`y:real^3#real^3#real^3#real^3`;`(f1_fan x V E POWER n) (y':real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0':real^3#real^3#real^3#real^3->bool`;`y':real^3#real^3#real^3#real^3`] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`] + +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x:real^3,V,E)) ((f1_fan x V E POWER n) (y':real^3#real^3#real^3#real^3))):real^3#real^3#real^3#real^3->bool`;` (y':real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MATCH_MP_TAC +THEN SUBGOAL_THEN`face (hypermap1_of_fanx (x:real^3,V,E)) ((f1_fan x V E POWER n) y') IN + face_set (hypermap1_of_fanx (x,V,E))`ASSUME_TAC +THENL[ + +REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`(f1_fan x V E POWER n) (y':real^3#real^3#real^3#real^3)` +THEN ASM_REWRITE_TAC[face]; + +MRESA_TAC f1_fan_power_in_face_imp_in_face[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`(face (hypermap1_of_fanx (x,V,E)) ((f1_fan x V E POWER n) (y':real^3#real^3#real^3#real^3))):real^3#real^3#real^3#real^3->bool`;`(y':real^3#real^3#real^3#real^3)` ;`n:num`] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF]]]);; + + + + + + +let ds1_in_face_set_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1=face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2=face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> ds1 IN face_set (hypermap1_of_fanx (x,V,E1))`, + + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN ASM_REWRITE_TAC[face_set;face;set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`(x,v:real^3,w,sigma_fan x V E1 v w)` +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v w:real^3` +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM;IN_SING] THEN ASM_REWRITE_TAC[])` E UNION {{v:real^3,w}}= E1`);; + + + +let ds2_in_face_set_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ ds2=face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> ds2 IN face_set (hypermap1_of_fanx (x,V,E1))`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN ASM_REWRITE_TAC[face_set;face;set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`(x,w:real^3,v,sigma_fan x V E1 w v)` +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 w v:real^3` +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM;IN_SING] THEN ASM_REWRITE_TAC[])` E UNION {{v:real^3,w}}= E1` +THEN SET_TAC[]);; + + + + + +let condition_f1_fan_power_in_face_set=prove(`!n:num x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) y y1 ds. +FAN(x,V,E) +/\ y = (f1_fan x V E POWER n) y1 +/\ ds IN face_set (hypermap1_of_fanx (x,V,E)) +/\ d_fan (x,V,E) =d1_fan (x,V,E) +/\ y1 IN ds +==> y IN ds`, +INDUCT_TAC +THENL[MESON_TAC[POWER;I_DEF]; +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESAL_TAC th[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f1_fan x V E POWER n) y1:real^3#real^3#real^3#real^3`;`y1:real^3#real^3#real^3#real^3`;`ds:real^3#real^3#real^3#real^3->bool`;][COM_POWER;o_DEF]) +THEN MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f1_fan x V E ((f1_fan x V E POWER n) y1):real^3#real^3#real^3#real^3)` ;`((f1_fan x V E POWER n) y1:real^3#real^3#real^3#real^3)`;`ds:real^3#real^3#real^3#real^3->bool`]]);; + + + + + + + + + + + +let SUR_TRANF_FACE_DELETE_DS =prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 f. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ f IN (face_set (hypermap1_of_fanx (x,V,E1)) DELETE ds1 ) DELETE ds2 +==> ?ds0. ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds +/\ tranf x V E E1 ds0=f`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM;face_set;set_of_orbits;] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC) `x' IN d1_fan (x:real^3,V,E1)` +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[d1_fan;] +THEN REWRITE_TAC[IN_ELIM_THM;] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"NHO") +THEN SUBGOAL_THEN`{v', w':real^3} IN E`ASSUME_TAC +THENL(*1*)[ +FIND_ASSUM(MP_TAC) `{v', w':real^3} IN E1` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM;IN_SING;SET_RULE`{v', w'} = {v, w}<=> (v'=v/\ w'=w)\/ (v'=w/\ w'=v)`]) `E UNION {{v:real^3, w}} = E1` +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM (fun th -> ASM_TAC THEN ASM_REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM (fun th -> ASM_TAC THEN ASM_REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM (fun th -> ASM_TAC THEN ASM_REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM (fun th -> ASM_TAC THEN ASM_REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM (fun th -> ASM_TAC THEN ASM_REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM (fun th -> ASM_TAC THEN ASM_REWRITE_TAC[th;face] THEN REPEAT STRIP_TAC) +THEN FIND_ASSUM(fun th -> ASM_TAC THEN ASM_REWRITE_TAC[th;face] THEN REPEAT STRIP_TAC)`face_map (hypermap1_of_fanx (x:real^3,V,E1)) = + res (f1_fan x V E1) (d1_fan (x,V,E1))` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[];(*1*) + + + +ABBREV_TAC`y=(x,(v':real^3),w',sigma_fan x V E v' w')` +THEN SUBGOAL_THEN`y IN d1_fan(x:real^3,V,E)`ASSUME_TAC +THENL(*2*)[ +ASM_REWRITE_TAC[face;d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v':real^3` +THEN EXISTS_TAC`w':real^3` +THEN EXISTS_TAC`sigma_fan x V E v' (w':real^3)` +THEN EXPAND_TAC"y" +THEN ASM_REWRITE_TAC[];(*2*) + + +EXISTS_TAC`face (hypermap1_of_fanx (x:real^3,V,E)) (y:real^3#real^3#real^3#real^3)` +THEN SUBGOAL_THEN `((?x'. x' IN d1_fan (x,V,E) /\ + face (hypermap1_of_fanx (x,V,E)) y = + orbit_map (res (f1_fan x V E) (d1_fan (x,V,E))) x') /\ + ~(face (hypermap1_of_fanx (x,V,E)) y = ds)) ` ASSUME_TAC + +THENL(*3*)[ + +STRIP_TAC +THENL(*4*)[ + +EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[face];(*4*) + +STRIP_TAC +THEN MP_TAC(SET_RULE`{f1, f2, (f3:real^3#real^3#real^3#real^3)} SUBSET ds ==> f2 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"ME") +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`(CARD (ds:real^3#real^3#real^3#real^3->bool)):num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`) +THEN MRESA_TAC lemma_face_cycle[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`y:real^3#real^3#real^3#real^3`] + +THEN MP_TAC(ARITH_RULE`(CARD (ds:real^3#real^3#real^3#real^3->bool)):num>3 +==> ~((CARD (ds:real^3#real^3#real^3#real^3->bool)):num =0)`) +THEN RESA_TAC +THEN MRESA_TAC orbit_cyclic[`(res (f1_fan x V E) (d1_fan (x:real^3,V,E)))`;`(CARD (ds:real^3#real^3#real^3#real^3->bool)):num`;`y:real^3#real^3#real^3#real^3`] +THEN REMOVE_THEN "ME"(fun th-> REWRITE_TAC[SYM th;face;]) +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`k=0 \/ k=1\/ k>=2`) +THENL(*5*)[ + +ASM_REWRITE_TAC[POWER;I_DEF] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`pr2 f2 = u:real^3` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] +THEN EXPAND_TAC"y" +THEN REWRITE_TAC[pr2] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`pr3 f2 = w` +THEN REWRITE_TAC[th] +THEN EXPAND_TAC"y" +THEN REWRITE_TAC[pr3] +THEN STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) + THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`) +THEN RESA_TAC +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MP_TAC(SET_RULE`ds2 = {(f10:real^3#real^3#real^3#real^3), f20, f30}==> f30 IN ds2`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`;` (f30:real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;face] THEN REPEAT STRIP_TAC) +THEN ASM_MESON_TAC[];(*5*) + + + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL(*6*)[ + +ASM_REWRITE_TAC[POWER_1] +THEN MRESAL_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`1:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`][POWER_1] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`) +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`ds SUBSET d1_fan (x,V,E) /\ {f1, f2, f3} SUBSET ds +==> f1 IN d1_fan(x,V,E)`) +THEN RESA_TAC +THEN MRESA_TAC MONO_F1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[` (f1:real^3#real^3#real^3#real^3)`;` (y:real^3#real^3#real^3#real^3)`]) +THEN FIND_ASSUM(MP_TAC)`pr2 f1 = v:real^3` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] +THEN EXPAND_TAC"y" +THEN REWRITE_TAC[pr2] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`pr3 f1 = u` +THEN REWRITE_TAC[th] +THEN EXPAND_TAC"y" +THEN REWRITE_TAC[pr3] +THEN STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MP_TAC(SET_RULE`ds2 = {(f10:real^3#real^3#real^3#real^3), f20, f30}==> f20 IN ds2`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`;` (f20:real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;face] THEN REPEAT STRIP_TAC) +THEN ASM_MESON_TAC[];(*6*) + + +SUBGOAL_THEN`?m. k=SUC (SUC m)/\ m>=0`ASSUME_TAC +THENL(*7*)[ +EXISTS_TAC`k-2:num` +THEN REWRITE_TAC[ARITH_RULE`SUC n= n+1`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC;(*7*) + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC (SUC m):num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`][POWER_1] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`) +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REWRITE_TAC[COM_POWER;o_DEF] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CHUYEN") +THEN DISCH_TAC +THEN REMOVE_THEN "CHUYEN" MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC n= n+1`] +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`(m + 1) + 1 < CARD (ds:real^3# real^3#real^3#real^3->bool)==> m< CARD ds -2`) +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN ASM_TAC +THEN SPEC_TAC (`m:num`,`m:num`) +THEN INDUCT_TAC + +THENL(*8*)[ + +ASM_REWRITE_TAC[POWER;I_DEF] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`ds SUBSET d1_fan (x,V,E) /\ {f1, f2, f3} SUBSET ds +==> f1 IN d1_fan(x,V,E)`) +THEN RESA_TAC +THEN MRESA_TAC into_domain1_f1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th` y:real^3#real^3#real^3#real^3`) + +THEN MRESA_TAC MONO_F1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[` (f1:real^3#real^3#real^3#real^3)`;` (f1_fan x V E y:real^3#real^3#real^3#real^3)`]) +THEN FIND_ASSUM(MP_TAC)`pr2 f1 = v:real^3` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] +THEN EXPAND_TAC"y" +THEN REWRITE_TAC[pr2;f1_fan] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`pr3 f1 = u` +THEN REWRITE_TAC[th] +THEN EXPAND_TAC"y" +THEN REWRITE_TAC[pr3;f1_fan] +THEN STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;] THEN REPEAT STRIP_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w':real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN SUBGOAL_THEN`((x,v:real^3,w,sigma_fan x V E1 v w)=f1_fan x V E1 x')`ASSUME_TAC +THENL(*9*)[ +ASM_REWRITE_TAC[f1_fan;PAIR_EQ] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`w:real^3`) +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[SYM th;UNION;IN_ELIM_THM;] THEN ASM_REWRITE_TAC[IN_SING])` E UNION {{v:real^3,w}}= E1` +THEN RESA_TAC;(*9*) +SUBGOAL_THEN`(x,v,w,sigma_fan x V E1 v w) IN face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)`ASSUME_TAC +THENL(*10*)[ + +REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF];(*10*) + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN FIND_ASSUM(MP_TAC)`x' IN d1_fan (x:real^3,V,E1)` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`x' = (x'',v',v,(w1:real^3)):real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`f1_fan x V E1 x':real^3#real^3#real^3#real^3`;`x':real^3#real^3#real^3#real^3`] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`x':real^3#real^3#real^3#real^3`] +THEN FIND_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC THEN ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC THEN MP_TAC th THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;face] THEN REPEAT STRIP_TAC) +)`x' = (x'',v',v,(w1:real^3)):real^3#real^3#real^3#real^3` +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;] THEN REPEAT STRIP_TAC) +THEN ASM_MESON_TAC[]](*10*)](*9*);(*8*) + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"NHO") +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN MP_TAC(ARITH_RULE`SUC m < CARD (ds:real^3# real^3#real^3#real^3->bool) - 2==> m < CARD ds - 2`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`m>=0`] +THEN STRIP_TAC +THEN ABBREV_TAC`y1=(f1_fan (x:real^3) V E POWER SUC(m)) y` +THEN STRIP_TAC +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`ds SUBSET d1_fan (x,V,E) /\ {f1, f2, f3} SUBSET ds +==> f1 IN d1_fan(x,V,E)`) +THEN RESA_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC m:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`) +THEN MRESA_TAC into_domain1_f1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th` y1:real^3#real^3#real^3#real^3`) +THEN MRESA_TAC MONO_F1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[` (f1:real^3#real^3#real^3#real^3)`;` (f1_fan x V E y1:real^3#real^3#real^3#real^3)`]) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN ASSUME_TAC th THEN STRIP_TAC) +THEN ASM_REWRITE_TAC[f1_fan] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`pr2 f1 = v:real^3` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] +THEN REWRITE_TAC[pr2;] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`pr3 f1 = u` +THEN REWRITE_TAC[pr3;th] +THEN STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "NHO" MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"AN") THEN DISCH_THEN(LABEL_TAC"NHO") THEN STRIP_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v'':real^3`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN SUBGOAL_THEN`((x,v:real^3,w,sigma_fan x V E1 v w)=f1_fan x V E1 (x,sigma_fan x V E1 v w,v,sigma_fan x V E1 v'' v))`ASSUME_TAC +THENL(*9*)[ + +ASM_REWRITE_TAC[f1_fan;PAIR_EQ] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`w:real^3`) +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[SYM th;UNION;IN_ELIM_THM;] THEN ASM_REWRITE_TAC[IN_SING])` E UNION {{v:real^3,w}}= E1` +THEN RESA_TAC;(*9*) + +SUBGOAL_THEN`(x,v,w,sigma_fan x V E1 v w) IN face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)`ASSUME_TAC +THENL(*10*)[ + +REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF];(*10*) + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN SUBGOAL_THEN`x,v'',v,sigma_fan x V E1 v'' v IN d1_fan (x:real^3,V,E1)`ASSUME_TAC +THENL(*11*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v'':real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v'' v:real^3` +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM;] THEN ASM_REWRITE_TAC[IN_SING])` E UNION {{v:real^3,w}}= E1`;(*11*) + +MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`f1_fan x V E1 (x,v'',v,sigma_fan x V E1 v'' v):real^3#real^3#real^3#real^3`;`(x,v'',v,sigma_fan x V E1 v'' v):real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`(x,v'',v,sigma_fan x V E1 v'' v)=tran x V E1 (y1:real^3#real^3#real^3#real^3)`ASSUME_TAC +THENL(*12*)[ +ASM_REWRITE_TAC[tran];(*12*) + +ASM_REWRITE_TAC[] +THEN REMOVE_THEN "NHO" MP_TAC +THEN FIND_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC +THEN ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC THEN MP_TAC th THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"NHO") +THEN ASSUME_TAC (SYM th) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"AN") +)`y1 = (x''',v'',v,(w1':real^3)):real^3#real^3#real^3#real^3` +THEN MRESAL_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`1:num`;][POWER_1] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` THEN MRESA1_TAC th`y1:real^3#real^3#real^3#real^3`) +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN_POWER3 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`;`SUC m:num`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC finite_d1_fan[`x:real^3`;` V:real^3->bool`;` (E:(real^3->bool)->bool)`] +THEN MRESA_TAC AAUHTVE[`x:real^3`;` V:real^3->bool`;` (E:(real^3->bool)->bool)`;`( \ t. res (t x V E ) (d1_fan (x:real^3,V,E)) )`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN MP_TAC (SET_RULE`{f1, f2:real^3#real^3#real^3#real^3, f3} SUBSET ds==> f2 IN ds`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`(f1_fan x V E (f1_fan x V E y1)):real^3#real^3#real^3#real^3`;`f1_fan x V E y1:real^3#real^3#real^3#real^3`;] +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`(f1_fan x V E y1):real^3#real^3#real^3#real^3`;` y1:real^3#real^3#real^3#real^3`;] +THEN MRESA_TAC lemma_face_representation[`hypermap1_of_fanx(x:real^3,V,E)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`SUC m`; `x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y1:real^3#real^3#real^3#real^3`;` y:real^3#real^3#real^3#real^3`;] +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x'''':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face] +THEN MRESA_TAC lemma_segment_orbit[`d1_fan (x:real^3,V,E)`;`res (f1_fan x V E) (d1_fan ((x:real^3),V,E))`;`(y:real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[face] THEN STRIP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;lemma_def_inj_orbit]) +THEN REMOVE_ASSUM_TAC +THEN MP_TAC(ARITH_RULE `SUC (m:num) < CARD (ds:real^3#real^3#real^3#real^3->bool) - 2 ==> CARD ds -1 < CARD ds /\ SUC (m:num) <= CARD (ds:real^3#real^3#real^3#real^3->bool) - 1 /\ SUC( SUC(SUC (m:num))) <= CARD (ds:real^3#real^3#real^3#real^3->bool) - 1`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `CARD (ds:real^3#real^3#real^3#real^3->bool) -1 :num`) +THEN SUBGOAL_THEN`!m'. m' < SUC m==> ~((f1_fan (x:real^3) V E POWER m') y=y1) /\ ~((f1_fan (x:real^3) V E POWER m') y=f2)` ASSUME_TAC +THENL(*13*)[ +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN REPEAT STRIP_TAC +THENL(*14*)[ + +POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`m':num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC m:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` ) +THEN REMOVE_THEN "LINH"(fun th-> MRESA_TAC th [`SUC (m:num)`;`m':num`;]);(*14*) + + +POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`m':num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC (SUC(SUC m:num))`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` ) +THEN MP_TAC (ARITH_RULE`m'< SUC m ==> m'< SUC(SUC(SUC m)) `) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESA_TAC th [`SUC (SUC (SUC (m:num)))`;`m':num`;]) +THEN REMOVE_THEN "AN" MP_TAC +THEN DISCH_TAC THEN REMOVE_ASSUM_TAC +THEN EXPAND_TAC"y1" +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[COM_POWER;o_DEF;SET_RULE`~(A=B)<=> ~(B=A)`]](*14*);(*13*) + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN SUBGOAL_THEN`!m'. m' < SUC m + ==> (~(pr2 ((f1_fan x V E POWER m') y) = v'') /\ + pr3 ((f1_fan x V E POWER m') y) = v) \/ + (~(pr2 ((f1_fan x V E POWER m') y) = u) /\ + pr3 ((f1_fan x V E POWER m') y) = w) \/ +~(pr3 ((f1_fan x V E POWER m') y) IN {v, w})` ASSUME_TAC +THENL(*14*)[ + +REPEAT STRIP_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th`m':num`) +THEN MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`SUC m`; `x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y1:real^3#real^3#real^3#real^3`;` y:real^3#real^3#real^3#real^3`;] +THEN MRESA_TAC condition_f1_fan_power_in_face_set[`m':num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3` ;` y:real^3#real^3#real^3#real^3`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`f1_fan x V E (f1_fan x V E y1) IN ds /\ (f1_fan x V E POWER m') y IN ds/\ ds SUBSET d1_fan (x,V,E)==> (f1_fan x V E POWER m') y IN d1_fan (x:real^3,V,E) /\ f1_fan x V E (f1_fan x V E y1) IN d1_fan (x:real^3,V,E)`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`y1:real^3#real^3#real^3#real^3`][PAIR_EQ] +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "AN"(fun th-> REWRITE_TAC[SYM th;pr2;pr3]) +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`][PAIR_EQ;pr2;pr3] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*14*) + +ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN ASM_REWRITE_TAC[POWER] THEN STRIP_TAC +THEN MRESAL_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`SUC m`; `x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;` ((f1_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) POWER SUC m) (tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y:real^3#real^3#real^3#real^3)))`;`tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y:real^3#real^3#real^3#real^3)`;][POWER] +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM (fun th-> REWRITE_TAC[SYM th;tran])`x,(v':real^3),w',sigma_fan x V E v' w' = y` +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "NHO" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`x':real^3#real^3#real^3#real^3`] +THEN ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC THEN ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC THEN MP_TAC th THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;face] THEN REPEAT STRIP_TAC) +) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;] THEN REPEAT STRIP_TAC) +THEN ASM_MESON_TAC[]](*14*)](*13*)](*12*)](*11*)](*10*)](*9*)] + +(*8*)](*7*)](*6*)](*5*)](*4*);(*3*) + +ASM_REWRITE_TAC[] +THEN MRESAL_TAC unique_tranf_fan +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +; `(face (hypermap1_of_fanx (x:real^3,V:real^3->bool,E)) (y:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3->bool` +;`(f:real^3#real^3#real^3#real^3->bool)` +;`(y:real^3#real^3#real^3#real^3)`;][face] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;tran;face]) +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THENL(*4*)[ +REWRITE_TAC[orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[POWER;I_DEF;ARITH_RULE`0>=0`];(*4*) + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM;face_set;set_of_orbits] +THEN EXISTS_TAC`x''':real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] + +]]]]);; + + +let DOMAIN_TRANF_FACE_DELETE_DS=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds + ==> tranf x V E E1 ds0 IN + face_set (hypermap1_of_fanx (x,V,E1)) DELETE ds1 DELETE ds2`, + + +REWRITE_TAC[DELETE;IN_ELIM_THM;] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN DISCH_THEN(LABEL_TAC"LINK") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESAL_TAC TRANF[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0:real^3#real^3#real^3#real^3->bool` ][DELETE;IN_ELIM_THM] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`y IN ds0/\ ds0 SUBSET d1_fan (x:real^3,V,E)==> y IN d1_fan (x,V,E)`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC (SYM th) THEN DISCH_THEN(LABEL_TAC"NHO")) +THEN ASSUME_TAC th) +THEN MP_TAC(SET_RULE`{v', w'} IN E /\ E UNION {{v, w}} = E1==> {v', w':real^3} IN E1 /\ {v, w:real^3} IN E1`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THENL(*1*)[ + +REWRITE_TAC[face_set;face;IN_ELIM_THM;set_of_orbits] +THEN EXISTS_TAC`(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))` +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "NHO"(fun th-> REWRITE_TAC[SYM th;tran;d1_fan;IN_ELIM_THM]) +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v':real^3` +THEN EXISTS_TAC`w':real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v' (w':real^3)` +THEN ASM_REWRITE_TAC[];(*1*) + +REMOVE_THEN "LINH" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`(x,v,w,sigma_fan x V E1 v w) IN face (hypermap1_of_fanx (x,V,E1)) (tran x V E1 (y:real^3#real^3#real^3#real^3))` ASSUME_TAC +THENL(*2*)[ +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`ds1 = face (hypermap1_of_fanx (x,V,E1)) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`face (hypermap1_of_fanx (x,V,E1)) ((x:real^3),v,w,sigma_fan x V E1 v w) = ds1` +THEN REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF];(*2*) + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`tran x V E1 (y:real^3#real^3#real^3#real^3) IN d1_fan (x:real^3,V,E1)` ASSUME_TAC +THENL(*3*)[ + +REMOVE_THEN "NHO" (fun th-> REWRITE_TAC[SYM th;tran;d1_fan;IN_ELIM_THM]) +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v':real^3` +THEN EXISTS_TAC`w':real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v' w':real^3` +THEN ASM_REWRITE_TAC[];(*3*) + +MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`n:num`;`( \ t. res (t (x:real^3) V E1 ) (d1_fan (x:real^3, V:real^3->bool, (E1:(real^3->bool)->bool))))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`) +THEN DISJ_CASES_TAC(ARITH_RULE`n=0\/ n=1\/ n:num>1`) +THENL(*4*)[ + +REMOVE_THEN"NHO"(fun th-> ASM_REWRITE_TAC[SYM th;tran;POWER;I_DEF;EQ_PAIR_4]) +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN FIND_ASSUM MP_TAC`{v':real^3, w'} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*4*) + +POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`x,v,w,sigma_fan x V E1 v w= f1_fan x V E1 (x,sigma_fan x V E1 v w,v, sigma_fan x V E1 (sigma_fan x V E1 v w) v )` ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[f1_fan;EQ_PAIR_4] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`);(*5*) + +SUBGOAL_THEN`x,sigma_fan x V E1 v w,v,sigma_fan x V E1 (sigma_fan x V E1 v w) v IN + d1_fan (x,V,E1)` ASSUME_TAC +THENL(*6*)[ +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 (sigma_fan x V E1 v w ) v :real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` sigma_fan x V E1 v (w:real^3)`; +`v:real^3`];(*6*) + + +SUBGOAL_THEN `f1= f1_fan x V E (x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v)` ASSUME_TAC +THENL(*7*)[ + +REWRITE_TAC[f1_fan;EQ_PAIR_4] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`) +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f1:real^3#real^3#real^3#real^3`;`(x,v,u,sigma_fan x V E v u):real^3#real^3#real^3#real^3`;][pr2;pr3] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u :real^3` +THEN ASM_REWRITE_TAC[];(*7*) + +SUBGOAL_THEN`x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v IN + d1_fan (x,V,E)` ASSUME_TAC +THENL(*8*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E (sigma_fan x V E v u ) v :real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` sigma_fan x V E v (u:real^3)`;`v:real^3`];(*8*) + + +MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f1:real^3#real^3#real^3#real^3`;`(x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v):real^3#real^3#real^3#real^3`;] +THEN STRIP_TAC +THENL(*9*)[ + +ASM_REWRITE_TAC[POWER_1] +THEN STRIP_TAC +THEN MRESA_TAC MONO_F1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(x:real^3,sigma_fan x V E1 v w,v,sigma_fan x V E1 (sigma_fan x V E1 v w) v)`;`(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`]) +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "NHO"(fun th-> ASM_REWRITE_TAC[SYM th;tran;EQ_PAIR_4] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"NHO" )) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_THEN"NHO" MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;` (y:real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`;` (y:real^3#real^3#real^3#real^3)`];(*9*) + +SUBGOAL_THEN`?m. n=SUC (SUC m)/\ m>=0`ASSUME_TAC +THENL(*10*)[ +EXISTS_TAC`n-2:num` +THEN REWRITE_TAC[ARITH_RULE`SUC n= n+1`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC;(*10*) + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[COM_POWER] +THEN REWRITE_TAC[o_DEF] +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`SUC m:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`) +THEN MRESA_TAC MONO_F1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(x:real^3,sigma_fan x V E1 v w,v,sigma_fan x V E1 (sigma_fan x V E1 v w) v)`;`(f1_fan x V E1 POWER SUC m) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`]) +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC`y1=(x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v)` +THEN DISJ_CASES_TAC(SET_RULE`~((y:real^3#real^3#real^3#real^3) IN ds)\/ y IN ds`) +THENL(*11*)[ + +SUBGOAL_THEN`!m'. m' < SUC m==> ~((f1_fan (x:real^3) V E POWER m') y=y1) /\ ~((f1_fan (x:real^3) V E POWER m') y=f2)` ASSUME_TAC + +THENL(*12*)[ +REPEAT STRIP_TAC +THENL(*13*)[ + +MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`m':num`; `x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y1:real^3#real^3#real^3#real^3`;` y:real^3#real^3#real^3#real^3`;];(*13*) + +MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`m':num`; `x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f2:real^3#real^3#real^3#real^3`;` y:real^3#real^3#real^3#real^3`;](*13*)];(*12*) + + + + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN SUBGOAL_THEN`!m'. m' < SUC m + ==> (~(pr2 ((f1_fan x V E POWER m') y) = sigma_fan x V E v u) /\ + pr3 ((f1_fan x V E POWER m') y) = v) \/ + (~(pr2 ((f1_fan x V E POWER m') y) = u) /\ + pr3 ((f1_fan x V E POWER m') y) = w) \/ +~(pr3 ((f1_fan x V E POWER m') y) IN {v, w})` ASSUME_TAC +THENL(*13*)[ +REPEAT STRIP_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th`m':num`) +THEN MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`SUC m`; `x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y1:real^3#real^3#real^3#real^3`;` y:real^3#real^3#real^3#real^3`;] +THEN MP_TAC(SET_RULE`f1_fan x V E (f1_fan x V E y1) IN ds /\ (f1_fan x V E POWER m') y IN ds0/\ ds SUBSET d1_fan (x,V,E) /\ ds0 SUBSET d1_fan (x,V,E)==> (f1_fan x V E POWER m') y IN d1_fan (x:real^3,V,E) /\ f1_fan x V E (f1_fan x V E y1) IN d1_fan (x:real^3,V,E)`) +THEN FIND_ASSUM (fun th->REWRITE_TAC[SYM th])`f1 = f1_fan x V E (y1:real^3#real^3#real^3#real^3)` +THEN MRESA_TAC condition_f1_fan_power_in_face_set[`m':num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3` ;` y:real^3#real^3#real^3#real^3`;`ds0:real^3#real^3#real^3#real^3->bool`] +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`y1:real^3#real^3#real^3#real^3`][PAIR_EQ] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[pr2;pr3] +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`][PAIR_EQ;pr2;pr3] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*13*) + +MRESA_TAC TRAN_COMMUTATIVE_F1_FAN_POWER3 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`;`SUC m:num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`(x,sigma_fan x V E1 v w,v,sigma_fan x V E1 (sigma_fan x V E1 v w) v)=tran x V E1 (y1:real^3#real^3#real^3#real^3)`ASSUME_TAC +THENL(*14*)[ + +EXPAND_TAC"y1" +THEN REWRITE_TAC[tran] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ];(*14*) + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC condition_f1_fan_power_in_face_set[`SUC m:num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER (SUC m)) y):real^3#real^3#real^3#real^3` ;` y:real^3#real^3#real^3#real^3`;`ds0:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE` (f1_fan x V E POWER (SUC m)) y IN ds0 /\ ds0 SUBSET d1_fan (x,V,E)/\ E UNION {{v, w}} = E1 ==> (f1_fan x V E POWER (SUC m)) y IN d1_fan (x:real^3,V,E) /\ E SUBSET E1`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC INJ_TRAN_D1_FAN +[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(E1:(real^3->bool)->bool)`; +`y1:real^3#real^3#real^3#real^3`;`(f1_fan x V E POWER (SUC m)) (y:real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`SUC m`; `x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y1:real^3#real^3#real^3#real^3`;` y:real^3#real^3#real^3#real^3`;]](*14*)](*13*)](*12*);(*11*) + + +MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;` (y:real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`;` (y:real^3#real^3#real^3#real^3)`]](*11*)](*10*)](*9*)](*8*)](*7*)](*6*)](*5*)](*4*)](*3*)](*2*);(*1*) + +REMOVE_THEN "LINH" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3) IN ds2` ASSUME_TAC +THENL(*2*)[ + +ASM_REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0 >=0 `;POWER;I_DEF];(*2*) +POP_ASSUM MP_TAC +THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3) IN {f10, (f20:real^3#real^3#real^3#real^3), f30}==> tran x V E1 y =f10 \/ tran x V E1 y =f20 \/ tran x V E1 y = f30`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*3*)[ +POP_ASSUM MP_TAC +THEN REMOVE_THEN"NHO"(fun th-> REWRITE_TAC[SYM th;tran]) +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;EQ_PAIR_4])`x,w,v,u = f10:real^3#real^3#real^3#real^3` +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN FIND_ASSUM MP_TAC`{w, v:real^3} IN E` +THEN FIND_ASSUM MP_TAC`~({w, v:real^3} IN E)` +THEN SET_TAC[];(*3*) + +POP_ASSUM MP_TAC +THEN REMOVE_THEN"NHO"(fun th-> REWRITE_TAC[SYM th;tran]THEN ASSUME_TAC (SYM(th))) +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;EQ_PAIR_4])`x,v,u,w = f20:real^3#real^3#real^3#real^3` +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN SUBGOAL_THEN `f1=y:real^3#real^3#real^3#real^3`ASSUME_TAC +THENL(*4*)[ +ASM_REWRITE_TAC[] +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f1:real^3#real^3#real^3#real^3`;`(x,v,u,sigma_fan x V E v u):real^3#real^3#real^3#real^3`;][pr2;pr3] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u :real^3` +THEN ASM_REWRITE_TAC[];(*4*) + + +MP_TAC(SET_RULE`f1=y /\ f1 IN ds ==> (y:real^3#real^3#real^3#real^3) IN ds`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;` (y:real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`;` (y:real^3#real^3#real^3#real^3)`]](*4*);(*3*) + +POP_ASSUM MP_TAC +THEN REMOVE_THEN"NHO"(fun th-> REWRITE_TAC[SYM th;tran]THEN ASSUME_TAC (SYM(th))) +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;EQ_PAIR_4])`x,u,w,v = f30:real^3#real^3#real^3#real^3` +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN SUBGOAL_THEN `f2=y:real^3#real^3#real^3#real^3`ASSUME_TAC +THENL(*4*)[ +ASM_REWRITE_TAC[] +THEN MRESA_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f2:real^3#real^3#real^3#real^3`;`(x,u,w,w1):real^3#real^3#real^3#real^3`;] +THEN POP_ASSUM MATCH_MP_TAC +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3])`x,u,w,v = f30:real^3#real^3#real^3#real^3` +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v :real^3` +THEN ASM_REWRITE_TAC[];(*4*) + +MP_TAC(SET_RULE`f2=y /\ f2 IN ds ==> (y:real^3#real^3#real^3#real^3) IN ds`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;` (y:real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`;` (y:real^3#real^3#real^3#real^3)`]]]]]);; + + + +let EQ_CARD_FACE_FAN_AND_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> CARD ((face_set (hypermap1_of_fanx (x,V,E1)) DELETE ds1 ) DELETE ds2 )= CARD (face_set (hypermap1_of_fanx (x,V,E)) DELETE ds) `, + +REPEAT STRIP_TAC +THEN MATCH_MP_TAC CARD_IMAGE_INJ_EQ +THEN EXISTS_TAC`tranf (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (E1:(real^3->bool)->bool):(real^3#real^3#real^3#real^3->bool)->real^3#real^3#real^3#real^3->bool` +THEN MRESAL1_TAC FINITE_HYPERMAP_ORBITS`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`[FINITE_DELETE;EXISTS_UNIQUE] +THEN STRIP_TAC +THENL[ +REPEAT STRIP_TAC +THEN MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(x':real^3#real^3#real^3#real^3->bool)`;]; + +REPEAT STRIP_TAC +THEN MRESA_TAC SUR_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3->bool)`;] +THEN EXISTS_TAC`ds0:real^3#real^3#real^3#real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC INJ_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y':real^3#real^3#real^3#real^3->bool)`;`(ds0:real^3#real^3#real^3#real^3->bool)`]]);; + + + + + +let CARD_DART_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ~(v=w) +/\ E UNION {{v,w}}=E1 +==> +CARD (dart (hypermap1_of_fanx (x,V,E1))) += CARD (dart (hypermap1_of_fanx (x,V,E))) +2`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESAL_TAC card_eq_image_in_d_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`; +`d1_fan (x,V,E1):real^3#real^3#real^3#real^3->bool`][SET_RULE`d1_fan (x,V,E1) SUBSET d1_fan (x,V,E1)`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC card_eq_image_in_d_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`; +`d1_fan (x,V,E):real^3#real^3#real^3#real^3->bool`][SET_RULE`d1_fan (x,V,E) SUBSET d1_fan (x,V,E)`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC DART_FANADD_EQ_DART_FAN_ADD_2DART[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC finite_d1_fan[`x:real^3`;` V:real^3->bool`;` (E:(real^3->bool)->bool)`] +THEN MRESA_TAC FINITE_IMAGE[`pr23:real^3#real^3#real^3#real^3->real^3#real^3`;`(d1_fan ((x:real^3),V,E))`] +THEN MRESA_TAC CARD_UNION[`IMAGE pr23 (d1_fan ((x:real^3),V,E))`;`{(v,w), (w,(v:real^3))}`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY;PAIR_EQ;SET_RULE`v = w /\ w = v <=> v=w`;ARITH_RULE`SUC(SUC 0)=2`] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[EXTENSION;INTER;IN_ELIM_THM;NOT_IN_EMPTY;PR23_OF_D1_FAN;SET_RULE`x' IN {(v,w), (w,v)} +<=> x'=(v,w) \/ x'=(w,v)`] +THEN GEN_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PAIR_EQ] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]);; + + +let ZSZIUQE_LEMMA=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> N_FAN (x,V,E1)< N_FAN(x,V,E)`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REWRITE_TAC[N_FAN] +THEN MRESA1_TAC FINITE_HYPERMAP_ORBITS`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)` +THEN MRESA1_TAC FINITE_HYPERMAP_ORBITS`hypermap1_of_fanx (x:real^3,V:real^3->bool,E1)` +THEN MRESA_TAC NSUM_CONST[`3:num`;`(face_set (hypermap1_of_fanx ((x:real^3),V,E1)))`] +THEN MRESA_TAC NSUM_CONST[`3:num`;`(face_set (hypermap1_of_fanx ((x:real^3),V,E)))`] +THEN SUBGOAL_THEN`!y. y IN (face_set (hypermap1_of_fanx ((x:real^3),V,E1)))==> (\x. CARD x - 3 + 3) y=(\x. CARD x ) y` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`y:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +SUBGOAL_THEN`!y. y IN (face_set (hypermap1_of_fanx ((x:real^3),V,E)))==> (\x. CARD x - 3 + 3) y=(\x. CARD x ) y` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`y:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MP_TAC(SET_RULE` E UNION {{v,w:real^3}}= E1 +==> {v,w} IN E1`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC NSUM_EQ[`(\(f:real^3#real^3#real^3#real^3->bool). CARD f - 3+3)`;`(\(f:real^3#real^3#real^3#real^3->bool). CARD f)`;`(face_set (hypermap1_of_fanx ((x:real^3),V,E1)))`] +THEN MRESA_TAC NSUM_EQ[`(\(f:real^3#real^3#real^3#real^3->bool). CARD f - 3+3)`;`(\(f:real^3#real^3#real^3#real^3->bool). CARD f)`;`(face_set (hypermap1_of_fanx ((x:real^3),V,E)))`] +THEN MRESA_TAC finite_d1_fan[`x:real^3`;` V:real^3->bool`;` (E1:(real^3->bool)->bool)`] +THEN MRESA_TAC finite_d1_fan[`x:real^3`;` V:real^3->bool`;` (E:(real^3->bool)->bool)`] +THEN MRESA_TAC AAUHTVE[`x:real^3`;` V:real^3->bool`;` (E:(real^3->bool)->bool)`;`( \ t. res (t x V E ) (d1_fan (x:real^3,V,E)) )`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC AAUHTVE[`x:real^3`;` V:real^3->bool`;` (E1:(real^3->bool)->bool)`;`( \ t. res (t x V E1 ) (d1_fan (x:real^3,V,E1)) )`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC card_partition_formula[`dart (hypermap1_of_fanx (x:real^3,V,E1))`;`face_map (hypermap1_of_fanx (x:real^3,V,E1))`] +THEN MRESA_TAC NSUM_ADD[`(\(f:real^3#real^3#real^3#real^3->bool). CARD f - 3)`;`(\(f:real^3#real^3#real^3#real^3->bool). 3)`;`(face_set (hypermap1_of_fanx ((x:real^3),V,E1)))`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[face_set] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC card_partition_formula[`dart (hypermap1_of_fanx (x:real^3,V,E))`;`face_map (hypermap1_of_fanx (x:real^3,V,E))`] +THEN MRESA_TAC NSUM_ADD[`(\(f:real^3#real^3#real^3#real^3->bool). CARD f - 3)`;`(\(f:real^3#real^3#real^3#real^3->bool). 3)`;`(face_set (hypermap1_of_fanx ((x:real^3),V,E)))`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[face_set] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC CARD_DART_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC EQ_CARD_FACE_FAN_AND_FANADD +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC CARD_MINUS_ONE[`(face_set (hypermap1_of_fanx ((x:real^3),V,E)))`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC CARD_MINUS_ONE[`(face_set (hypermap1_of_fanx ((x:real^3),V,E1)))`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN SUBGOAL_THEN `ds2 IN (face_set (hypermap1_of_fanx ((x:real^3),V,E1))) DELETE (ds1:real^3#real^3#real^3#real^3->bool)`ASSUME_TAC +THENL[ +REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC disjoint_ds1_and_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]; +MRESAL_TAC CARD_MINUS_ONE[`(face_set (hypermap1_of_fanx ((x:real^3),V,E1))) DELETE (ds1:real^3#real^3#real^3#real^3->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`][FINITE_DELETE] +THEN ARITH_TAC]]]);; + + +let ZSZIUQE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> ~(ds1= ds2)/\ CARD ds2=3 /\ ds2={f10,f20,f30} /\ N_FAN (x,V,E1)< N_FAN(x,V,E)`, +REPEAT STRIP_TAC +THENL[ +POP_ASSUM MP_TAC +THEN MRESA_TAC disjoint_ds1_and_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]; +MRESA_TAC card_ds2_fanadd_eq3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]; +MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]; +MRESA_TAC ZSZIUQE_LEMMA[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]]);; + + +let FAN80_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> fan80(x,V,E1)`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN REPEAT GEN_TAC +THEN FIND_ASSUM (fun th-> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM th] THEN REWRITE_TAC[IN_ELIM_THM;UNION;IN_SING])`E UNION {{v, w:real^3}} = E1` +THEN STRIP_TAC +THENL(*1*)[ +FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v':real^3`;`u':real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"NHOLINH")) +THEN DISJ_CASES_TAC(SET_RULE` +~(v' IN {v, w:real^3})\/ (v'=v/\ u'=u)\/ (v'=v/\ ~(u'=u))\/ (v'=w/\ u'= inverse1_sigma_fan x V E w u)\/ (v'=w/\ ~(u'=inverse1_sigma_fan x V E w u))`) +THENL(*2*)[ + MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v':real^3`;`u':real^3`] );(*2*) + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL(*3*)(*4GOAL*)[ + +ASM_REWRITE_TAC[] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MATCH_MP_TAC properties_of_fully_surrounded1_fan +THEN REMOVE_THEN "NHOLINH"(fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`];(*3*) + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT4[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ;`u':real^3`];(*3*) + + +ASM_REWRITE_TAC[] +THEN REMOVE_THEN "NHOLINH"(fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"NHOLINH")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT6[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ;`u':real^3`] +THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w (inverse1_sigma_fan x V E w u) u +==> +azim x w v u <= azim x w (inverse1_sigma_fan x V E w u) (u:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (inverse1_sigma_fan x V E w u:real^3)`; +`(w:real^3)`] +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u) u = + azim x w (inverse1_sigma_fan x V E w u) v + azim x w v u +/\ &0<= azim x w v u +==> azim x w (inverse1_sigma_fan x V E w u) v<=azim x w (inverse1_sigma_fan x V E w u) u +`) +THEN ASM_SIMP_TAC[azim] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN MP_TAC (SYM th) THEN DISCH_THEN(LABEL_TAC"YEUEMLINH")) +THEN REMOVE_THEN "NHOLINH"(fun th-> MRESA_TAC th[`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`] ) +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH` +azim x w (inverse1_sigma_fan x V E w u) v <= + azim x w (inverse1_sigma_fan x V E w u) u +/\ azim x w (inverse1_sigma_fan x V E w u) u < pi +==> azim x w (inverse1_sigma_fan x V E w u) (v:real^3) < pi`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u) u = + azim x w (inverse1_sigma_fan x V E w u) v + azim x w v u +/\ azim x w v u < azim x w (inverse1_sigma_fan x V E w u) u +==> &0 < azim x w (inverse1_sigma_fan x V E w u) v +`) +THEN ASM_REWRITE_TAC[];(*3*) +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT5[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ;`u':real^3`]](*3*)](*2*);(*1*) + + + +MP_TAC(SET_RULE`{v', u':real^3} = {v, w}==> (v'=v /\ u'=w) \/ (v'=w /\ u'=v)`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL[ +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ;] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"NHOLINH")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESAL_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][DE_MORGAN_THM;] +THEN MRESA_TAC angle_is_small_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w:real^3`] +THEN ABBREV_TAC`u1=sigma_fan x V E v u` +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u1:real^3)`; +`(v:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`u1:real^3`] +THEN REMOVE_THEN "NHOLINH"(fun th-> MRESA_TAC th[`v:real^3`;`u:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"NHOLINH")) +THEN MP_TAC(REAL_ARITH` azim x v u w + azim x v w u1< pi/\ &0 <= azim x v u w /\ &0 <= azim x v w u1 +==> azim x v w (u1:real^3) azim x v w u1 = &0\/ &0{v, w} IN E1 /\ {v, u1} IN E1`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC UNIQUE_AZIM_0_POINT_FAN[`(x:real^3)`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`(v:real^3)`;`(w:real^3)`;`u1:real^3`] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC) +THEN FIND_ASSUM MP_TAC`{v,w:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]; +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ;] +THEN MRESA_TAC condition_azim_le_pi[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`]]]);; + + + + + + +let FANADD_CONFORMING=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> +conforming_fan (x,V,E1)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(E1:(real^3->bool)->bool)`) +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC ZSZIUQE_LEMMA[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]);; + + + + +let dartset_leads_in_fanadd_topological_component_yfan =prove( `!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds +==> dartset_leads_into_fan x V E1 (tranf x V E E1 ds0) IN topological_component_yfan (x,V,E1)`, +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(ds0:real^3#real^3#real^3#real^3->bool)`;] +THEN MP_TAC(SET_RULE`tranf (x:real^3) V (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool) IN face_set (hypermap1_of_fanx (x,V,E1)) DELETE ds1 DELETE ds2 +==> tranf (x:real^3) V E E1 (ds0:real^3#real^3#real^3#real^3->bool) IN face_set (hypermap1_of_fanx ((x:real^3),V,E1))`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`tranf (x:real^3) V (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool)`]);; + + + + + +let INVARANT_SIGMA_FAN_ADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ~(y IN ds) +/\ y IN d_fan(x,V,E) +==> +sigma_fan x V E1 (pr2(y)) (pr3(y))= sigma_fan x V E (pr2(y)) (pr3(y))`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC THEN MP_TAC th THEN ASM_REWRITE_TAC[] THEN STRIP_TAC) +THEN ASM_REWRITE_TAC[pr2;pr3] +THEN DISJ_CASES_TAC(SET_RULE` +~(v' IN {v, w:real^3})\/ (v'=v/\ w'=u)\/ (v'=v/\ ~(w'=u))\/ (v'=w/\ w'= inverse1_sigma_fan x V E w u)\/ (v'=w/\ ~(w'=inverse1_sigma_fan x V E w u))`) +THENL[ + MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v':real^3`;`w':real^3`] );(*1*) + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL[ +SUBGOAL_THEN`y= f1:real^3#real^3#real^3#real^3`ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[pr3;pr2] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); +MP_TAC(SET_RULE`y=(f1:real^3#real^3#real^3#real^3) /\ f1 IN ds ==> y IN ds`) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT4[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ;`w':real^3`]; + + +SUBGOAL_THEN`y=f3:real^3#real^3#real^3#real^3`ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]; +MP_TAC(SET_RULE`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3 +==> f1_fan x V E f2= f1_fan x V E (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN REWRITE_TAC[pr2;pr3]) + THEN STRIP_TAC +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;])`f1_fan x V E (f2:real^3#real^3#real^3#real^3) = (f3:real^3#real^3#real^3#real^3)` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;f1_fan]) +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[]]; + +MP_TAC(SET_RULE`y=(f3:real^3#real^3#real^3#real^3) /\ f3 IN ds ==> y IN ds`) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT5[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ;`w':real^3`]]]);; + + + + +let lemma_yfanadd_aff_ge=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> yfan(x,V,E) SUBSET yfan(x,V,E1) UNION aff_ge {x} {v, w}`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[yfan;XFAN_EQ_UNIONS_AFF_GE_1_2;] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIFF;UNION;UNIONS;IN_ELIM_THM;GSYM FORALL_NOT_THM;IN_SING;DE_MORGAN_THM;SUBSET]) +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[SET_RULE`x' IN (:real^3)`] +THEN DISJ_CASES_TAC(SET_RULE`~(x' IN aff_ge {x} {v, w:real^3})\/ (x' IN aff_ge {x} {v, w:real^3})`) +THENL[ +ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC `u':real^3->bool`th)) +THEN DISJ_CASES_TAC(SET_RULE`~(x' IN (u':real^3->bool))\/ (x' IN (u':real^3->bool))`) +THENL[ +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(e = {v, w})\/ (e = {v, w:real^3})`) +THENL[ + +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CONTRAPOS_THM] +THEN STRIP_TAC THEN +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN ASM_REWRITE_TAC[]]]; + +ASM_REWRITE_TAC[]]);; + + + +let lemma_yfanadd_aff_gt= prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> yfan(x,V,E) SUBSET yfan(x,V,E1) UNION aff_gt {x} {v, w}`, + + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`; +` (w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC lemma_yfanadd_aff_ge[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN SUBGOAL_THEN`aff_ge {x} {w} SUBSET xfan(x:real^3,V:real^3->bool,E)` ASSUME_TAC +THENL[ +REWRITE_TAC[xfan;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC exists_edge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` w:real^3`] +THEN EXISTS_TAC `{w,v'}:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v':real^3)`; +` (w:real^3)`] +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(w:real^3)`;` (v':real^3)`] +THEN ASM_TAC THEN SET_TAC[IN]; +SUBGOAL_THEN`aff_ge {x} {v} SUBSET xfan(x:real^3,V:real^3->bool,E)` ASSUME_TAC +THENL[ +REWRITE_TAC[xfan;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC exists_edge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`] +THEN EXISTS_TAC `{v,v'}:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v':real^3)`; +` (v:real^3)`] +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;` (v':real^3)`] +THEN ASM_TAC THEN SET_TAC[IN]; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan;SUBSET;UNION;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `x':real^3` th)) +THEN REWRITE_TAC[th] +THEN ASSUME_TAC th) +THEN STRIP_TAC +THENL[ + +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[]; + +REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `x':real^3` th)) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + + +STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `x':real^3` th)) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]]]);; + + + + + +let lemma_yfanadd_aff_gt1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> yfan(x,V,E1) SUBSET yfan(x,V,E)`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[yfan;XFAN_EQ_UNIONS_AFF_GE_1_2] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;IN_ELIM_THM;IN_SING;UNION]) +THEN SET_TAC[]);; + + + + +let YFANADD_AFF_GT=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> yfan(x,V,E) = yfan(x,V,E1) UNION aff_gt {x} {v, w}`, + +REPEAT STRIP_TAC +THEN MRESA_TAC lemma_yfanadd_aff_gt[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC lemma_yfanadd_aff_gt1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC condition_aff_gt_subset_yfan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v:real^3`;`u:real^3`;`w:real^3`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + + + + +let dartset_leads_into_fanadd1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> dartset_leads_into_fan x V E1 ds1 SUBSET dartset_leads_into_fan x V E ds`, + + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN ABBREV_TAC`y=(x,sigma_fan x V E v u,v:real^3,sigma_fan x V E (sigma_fan x V E v u) v )` +THEN SUBGOAL_THEN `f1=f1_fan x V E (y:real^3#real^3#real^3#real^3)` ASSUME_TAC +THENL(*1*)[ +POP_ASSUM(fun th-> REWRITE_TAC[SYM th;f1_fan;EQ_PAIR_4]) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`) +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f1:real^3#real^3#real^3#real^3`;`(x,v,u,sigma_fan x V E v u):real^3#real^3#real^3#real^3`;][pr2;pr3] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u :real^3` +THEN ASM_REWRITE_TAC[];(*1*) + +SUBGOAL_THEN`x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v IN + d1_fan (x:real^3,V,E)` ASSUME_TAC +THENL(*2*)[ +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E (sigma_fan x V E v u ) v :real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` sigma_fan x V E v (u:real^3)`;`v:real^3`];(*2*) +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f1:real^3#real^3#real^3#real^3`;`(x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v):real^3#real^3#real^3#real^3`;] +THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN SUBGOAL_THEN `(x,v,w,sigma_fan x V E1 v w)=f1_fan x V E1 (y:real^3#real^3#real^3#real^3)` ASSUME_TAC +THENL(*3*)[ +EXPAND_TAC"y" +THEN REWRITE_TAC[f1_fan;EQ_PAIR_4] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC(SET_RULE`E UNION {{v, w:real^3}} = E1==>{v, w}IN E1`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`);(*3*) + +SUBGOAL_THEN`x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v IN + d1_fan (x:real^3,V,E1)` ASSUME_TAC +THENL(*4*)[ +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E (sigma_fan x V E v u ) v :real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` sigma_fan x V E v (u:real^3)`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MP_TAC(SET_RULE`E UNION {{v, w:real^3}} = E1 /\ {v, sigma_fan x V E v u} IN E ==> {v, sigma_fan x V E v u} IN E1`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`sigma_fan x V E v u:real^3`;`v:real^3`][SET_RULE`~(A IN {B,C}) <=> ~(A=B)/\ ~(C=A)`]) +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(sigma_fan x V E v u = w:real^3) \/ ~(sigma_fan x V E v u = w)`) +THENL(*5*)[ +POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN FIND_ASSUM MP_TAC`{v, w:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*5*) + +ASM_REWRITE_TAC[] +THEN RESA_TAC](*5*);(*4*) + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN SUBGOAL_THEN`x,v,w,sigma_fan x V E1 v w IN ds1:real^3#real^3#real^3#real^3->bool`ASSUME_TAC +THENL(*5*)[ +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;face;orbit_map;IN_ELIM_THM])`face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) = ds1:real^3#real^3#real^3#real^3->bool` +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF];(*5*) + + MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`;`(x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v):real^3#real^3#real^3#real^3`;] +THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`; +`ds1:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN FIND_ASSUM MP_TAC `(y:real^3#real^3#real^3#real^3) IN d1_fan (x,V,E)` +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr2;pr3] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC DART_LEADS_INTO [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN MP_TAC(SET_RULE`{v', w'} IN E /\ E UNION {{v, w}} = E1 ==> {v':real^3, w'} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC DART_LEADS_INTO [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN MP_TAC(REAL_ARITH`&0 &0< (min (min (h:real) (h':real)) (pi/ &2))/ &2 /\ (min (min (h:real) (h':real)) (pi/ &2))/ &2 < (pi/ &2) /\ (min (min (h:real) (h':real)) (pi/ &2))/ &2< h /\ (min (min (h:real) (h':real)) (pi/ &2))/ &2< h'`) +THEN ASM_REWRITE_TAC[PI_WORKS;] +THEN STRIP_TAC +THEN MRESA_TAC not_empty_rw_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(min (min (h:real) (h':real)) (pi/ &2))/ &2`[SET_RULE`~(A={})<=> ?y. y IN A`]) +THEN SUBGOAL_THEN`y' IN + rw_dart_fan x V E1 (x,v',w',sigma_fan x V E1 v' w') + (cos (min (min h h') (pi / &2) / &2))` +ASSUME_TAC +THENL(*6*)[ +POP_ASSUM MP_TAC +THEN + MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w':real^3)`; +`(v':real^3)`] +THEN FIND_ASSUM MP_TAC`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E1) > 1)` +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `v':real^3`th) +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN STRIP_TAC THEN ASSUME_TAC th)) +THEN FIND_ASSUM MP_TAC`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)` +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `v':real^3`th) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN STRIP_TAC THEN ASSUME_TAC th)) +THEN ASM_REWRITE_TAC[rw_dart_fan;w_dart_fan] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`v':real^3`;`w':real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[SET_RULE`~(v' IN {v, w}) <=> ~(v =v') /\ ~(v' = w)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (sigma_fan x V E v u:real^3)`;`(v:real^3)`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN REMOVE_THEN "EM" (fun th-> MP_TAC th THEN ASSUME_TAC(th)) +THEN EXPAND_TAC"y" +THEN REWRITE_TAC[EQ_PAIR_4] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`~(v:real^3 = sigma_fan x V E v u)` +THEN DISJ_CASES_TAC(SET_RULE`(sigma_fan x V E v u = w:real^3) \/ ~(sigma_fan x V E v u = w)`) +THENL(*7*)[ +POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN FIND_ASSUM MP_TAC`{v, w:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`~({w, v:real^3} IN E)`;(*7*) +POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[]](*7*);(*6*) + +REMOVE_THEN"LINH"(fun th-> MRESA_TAC th[`(min (min (h:real) (h':real)) (pi/ &2))/ &2`;`y':real^3`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_THEN"LINH1"(fun th-> MRESA_TAC th[`(min (min (h:real) (h':real)) (pi/ &2))/ &2`;`y':real^3`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC CONNECTED_COMPONENT_MONO[`yfan (x:real^3,(V:real^3->bool),E1)`;`(yfan (x:real^3,(V:real^3->bool),E1) UNION aff_gt {x} {v:real^3, w})`;`y':real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN SET_TAC[]]]]]]]);; + + + + + +let dartset_leads_into_fanadd2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> dartset_leads_into_fan x V E1 ds2 SUBSET dartset_leads_into_fan x V E ds`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `f2:real^3#real^3#real^3#real^3`) +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MP_TAC(SET_RULE`ds2 = {(f10:real^3#real^3#real^3#real^3), f20, f30}==> f30 IN ds2`) +THEN RESA_TAC +THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`; +`ds2:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `f30:real^3#real^3#real^3#real^3`) +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3])`x,u,w,v = f30:real^3#real^3#real^3#real^3` +THEN MRESA_TAC DART_LEADS_INTO [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN MP_TAC(SET_RULE`{u, w} IN E /\ E UNION {{v, w}} = E1 ==> {u:real^3, w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC DART_LEADS_INTO [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN MP_TAC(REAL_ARITH`&0 &0< (min (min (h:real) (h':real)) (pi/ &2))/ &2 /\ (min (min (h:real) (h':real)) (pi/ &2))/ &2 < (pi/ &2) /\ (min (min (h:real) (h':real)) (pi/ &2))/ &2< h /\ (min (min (h:real) (h':real)) (pi/ &2))/ &2< h'`) +THEN ASM_REWRITE_TAC[PI_WORKS;] +THEN STRIP_TAC +THEN MRESA_TAC not_empty_rw_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(min (min (h:real) (h':real)) (pi/ &2))/ &2`[SET_RULE`~(A={})<=> ?y. y IN A`]) +THEN SUBGOAL_THEN`y IN + rw_dart_fan x V E1 (x,u,w,sigma_fan x V E1 u w) + (cos (min (min h h') (pi / &2) / &2))` +ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC +THEN + MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] + +THEN FIND_ASSUM MP_TAC`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E1) > 1)` +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `u:real^3`th) +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN STRIP_TAC THEN ASSUME_TAC th)) +THEN FIND_ASSUM MP_TAC`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)` +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `u:real^3`th) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN STRIP_TAC THEN ASSUME_TAC th)) +THEN ASM_REWRITE_TAC[rw_dart_fan;w_dart_fan] +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;rw_dart_fan;w_dart_fan])`x,u,w,v = f30:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN + MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN ASM_REWRITE_TAC[SET_RULE`~(v' IN {v, w}) <=> ~(v =v') /\ ~(v' = w)`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[]; +REMOVE_THEN"LINH"(fun th-> MRESA_TAC th[`(min (min (h:real) (h':real)) (pi/ &2))/ &2`;`y:real^3`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_THEN"LINH1"(fun th-> MRESA_TAC th[`(min (min (h:real) (h':real)) (pi/ &2))/ &2`;`y:real^3`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC CONNECTED_COMPONENT_MONO[`yfan (x:real^3,(V:real^3->bool),E1)`;`(yfan (x:real^3,(V:real^3->bool),E1) UNION aff_gt {x} {v:real^3, w})`;`y:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN SET_TAC[]]);; + + + + + +let INTERS_HALF_SPACE_DS_FANADD1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U1. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN ds} =U1 +==> U1 INTER aff_gt {x, v, w} {u} SUBSET dartset_leads_into_fan x V E1 ds2`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[conforming_fan;conforming_half_space_fan] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`ds2:real^3#real^3#real^3#real^3->bool`) +THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN REWRITE_TAC[INTERS;IN_ELIM_THM;SUBSET] +THEN REMOVE_THEN "EM"(fun th-> REWRITE_TAC[SYM th;INTERS;IN_ELIM_THM;INTER]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] THEN ASSUME_TAC th THEN STRIP_TAC) +THEN MP_TAC(SET_RULE`y IN {f10, f20, f30:real^3#real^3#real^3#real^3}==> y =f10\/ y =f20\/ y =f30`) +THEN RESA_TAC + +THENL[ + +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3;f1_fan])`x,w,v,u = f10:real^3#real^3#real^3#real^3` +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]; + +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3;f1_fan])`x,v,u,w = f20:real^3#real^3#real^3#real^3` +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 /\ {v, u} IN E==> {v, u} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th `aff_gt {x:real^3, v, u} {w}`) +THEN POP_ASSUM MATCH_MP_TAC +THEN SUBGOAL_THEN `x,v,u,sigma_fan x V E v u IN d1_fan (x,V,E)` ASSUME_TAC +THENL[ +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN ASM_REWRITE_TAC[]; +MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f1:real^3#real^3#real^3#real^3`;`(x,v,u,sigma_fan x V E v u):real^3#real^3#real^3#real^3`;][pr2;pr3] +THEN EXISTS_TAC`(x,v,u:real^3, sigma_fan x (V:real^3->bool) E v u)` +THEN ASM_REWRITE_TAC[f1_fan] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`u:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`)]; + +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3;f1_fan])`x,u,w,v = f30:real^3#real^3#real^3#real^3` +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 /\ {u,w} IN E==> {u,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`) +THEN RESA_TAC +THEN RESA_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th `aff_gt {x:real^3, u,w} {v}`) +THEN POP_ASSUM MATCH_MP_TAC +THEN EXISTS_TAC`f2:real^3#real^3#real^3#real^3` +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]; + +MP_TAC(SET_RULE`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3 +==> f1_fan x V E f2= f1_fan x V E (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN REWRITE_TAC[pr2;pr3]) + THEN STRIP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[th;f1_fan]) +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`]]]);; + + + + + + +let inverse1_sigma_fan_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> inverse1_sigma_fan x V E1 w v = inverse1_sigma_fan x V E w u`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MATCH_MP_TAC MONO_SIGMA_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E1:(real^3->bool)->bool` +THEN EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{inverse1_sigma_fan x V E w u, w:real^3} IN E /\ E UNION {{v,w}}= E1 +==> {inverse1_sigma_fan x V E w u, w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT6[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ;`inverse1_sigma_fan x V E w u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC);; + + + +let aff_gt_eq_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> aff_gt {x, w, inverse1_sigma_fan x V E1 w v} {v} = aff_gt {x, w, inverse1_sigma_fan x V E w u} {u}`, + + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{w:real^3,inverse1_sigma_fan x V E w u } IN E /\ E UNION {{v,w}}= E1 +==> {w:real^3,inverse1_sigma_fan x V E w u} IN E1`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN RESA_TAC +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`;`v:real^3`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;`(v:real^3)`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`;`v:real^3`;`inverse1_sigma_fan x V E w u:real^3`; ] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`;`v :real^3`;] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x,V:real^3->bool,E)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`(u:real^3)`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC + +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`;`u:real^3`;`inverse1_sigma_fan x V E w u:real^3`; ] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`;`u :real^3`;]);; + + + +let f2_EQ_F30_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ f30=(x,u,w,v) +/\ E UNION {{v,w}}= E1 +==> f30= f2`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E)`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;pr2;pr3] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]));; + + + + + +let CONDITION_DART_IN_NODE=prove(`!x V E f y y1. FAN (x,V,E) +/\(!v. v IN V ==> CARD (set_of_edge v V E) > 1) +/\ f IN (node_set (hypermap1_of_fanx (x,V,E)) ) +/\ y IN f +/\ y1 IN d1_fan(x,V,E) +/\ pr2 y1= pr2 y +==> y1 IN f`, + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC node_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`;] +THEN MP_TAC(SET_RULE`y IN f /\ f SUBSET d1_fan (x,V,E)==> y IN d1_fan (x,V,E)`) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESAL_TAC rep_node_set_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`][pr2;pr3] +THEN RESA_TAC +THEN MRESA_TAC ORBITS_EQ_SET_EDGE_FAN[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w':real^3)`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[set_of_orbits_points_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[power_map_points ] +THEN ARITH_TAC);; + + + + + + + + + +let INTERS_HALF_SPACE_DS_FANADD2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN ds} =U1 +==> U1 INTER aff_gt {x, v, w} {sigma_fan x V E v u} SUBSET dartset_leads_into_fan x V E1 ds1`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[conforming_fan;conforming_half_space_fan] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`ds1:real^3#real^3#real^3#real^3->bool`) +THEN REWRITE_TAC[INTERS;IN_ELIM_THM;SUBSET] +THEN REMOVE_THEN "EM"(fun th-> REWRITE_TAC[SYM th;INTERS;IN_ELIM_THM;INTER]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN STRIP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] THEN ASSUME_TAC th THEN STRIP_TAC) +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y IN ds1/\ ds1 SUBSET d1_fan (x,V,E1)==> y IN d1_fan (x,V:real^3->bool,E1)`) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM;pr2;pr3;f1_fan] +THEN RESA_TAC +THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(ARITH_RULE`3 <= ( CARD (ds1:real^3#real^3#real^3#real^3->bool)):num +==> ~((CARD (ds1:real^3#real^3#real^3#real^3->bool)):num =0)`) +THEN RESA_TAC +THEN MRESA_TAC lemma_face_cycle[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E1)`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`] +THEN MRESA_TAC orbit_cyclic[`(res (f1_fan x V E1) (d1_fan (x:real^3,V,E1)))`;`(CARD (ds1:real^3#real^3#real^3#real^3->bool)):num`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`] +THEN USE_THEN "LINH1" MP_TAC +THEN FIND_ASSUM (fun th-> REWRITE_TAC[SYM th;face;] THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC)`face (hypermap1_of_fanx (x,V:real^3->bool,E1)) (x,v,w,sigma_fan x V E1 v w) = ds1` +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`(x,v,w,sigma_fan x V E1 v w) IN d1_fan(x:real^3,V,E1)`ASSUME_TAC +THENL(*1*)[ +ASM_REWRITE_TAC[face;d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v (w:real^3)` +THEN ASM_REWRITE_TAC[];(*1*) + + +MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`) +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN DISJ_CASES_TAC(SET_RULE`(v' IN {v,w:real^3}) \/ ~(v' IN {v,w})`) +THENL(*2*)[ + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`A IN {B,C}<=> A=B\/ A=C`] +THEN STRIP_TAC +THENL(*3*)[ + +MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESAL_TAC SRPRNPL[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;][simple_hypermap] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `(x,v,w,sigma_fan x V E1 v w:real^3)`) +THEN MP_TAC(SET_RULE`y IN ds1/\ ds1 SUBSET d1_fan (x,V,E1)==> y IN d1_fan (x,V:real^3->bool,E1)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`node (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) IN + node_set (hypermap1_of_fanx (x,V:real^3->bool,E1))` ASSUME_TAC +THENL(*4*)[ +ASM_REWRITE_TAC[node_set;IN_ELIM_THM;set_of_orbits] +THEN EXISTS_TAC`(x,v,w,sigma_fan x V E1 v w:real^3)` +THEN ASM_REWRITE_TAC[node];(*4*) + + +SUBGOAL_THEN`x,v,w,sigma_fan x V E1 v w IN + node (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w:real^3)`ASSUME_TAC +THENL(*5*)[ +ASM_REWRITE_TAC[node;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC;(*5*) + + + MRESAL_TAC CONDITION_DART_IN_NODE[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`node (hypermap1_of_fanx (x,V:real^3->bool,E1)) (x,v,w,sigma_fan x V E1 v w)`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][pr2] +THEN MP_TAC(SET_RULE`y IN + node (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)/\ +node (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) INTER + ds1 = + {(x,v,w,sigma_fan x V E1 v w)} +/\ y IN ds1==> y IN {(x,v,w,sigma_fan x V E1 v w)} +`) +THEN ASM_REWRITE_TAC[IN_SING;EQ_PAIR_4] +THEN STRIP_TAC +THEN REMOVE_THEN "YEU" MP_TAC +THEN ASM_REWRITE_TAC[POWER;I_DEF;EQ_PAIR_4] +THEN RESA_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ]](*5*)](*4*);(*3*) + + + +MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`) +THEN STRIP_TAC +THEN SUBGOAL_THEN`x,w,inverse1_sigma_fan x V E1 w v,v IN d1_fan (x,V,E1)`ASSUME_TAC +THENL(*4*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`inverse1_sigma_fan x V E1 w v:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*4*) + +MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESAL_TAC SRPRNPL[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;][simple_hypermap] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `x,w,inverse1_sigma_fan x V E1 w v,v:real^3`) +THEN SUBGOAL_THEN`(x,w,inverse1_sigma_fan x V E1 w v,v:real^3) =f1_fan x V E1 (x,v,w,sigma_fan x V E1 v w)` ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[f1_fan];(*5*) + +SUBGOAL_THEN`x:real^3,v,w,sigma_fan x V E1 v w IN ds1`ASSUME_TAC +THENL(*6*)[ + +FIND_ASSUM (fun th-> REWRITE_TAC[SYM th;face;IN_ELIM_THM;orbit_map])`face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w:real^3) = ds1` +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC;(*6*) + +MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`((x,w,inverse1_sigma_fan x V E1 w v,v):real^3#real^3#real^3#real^3)` ;`((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E1)`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`;`(x,w,inverse1_sigma_fan x V E1 w v,v):real^3#real^3#real^3#real^3`;] +THEN MP_TAC(SET_RULE`y IN ds1/\ ds1 SUBSET d1_fan (x,V,E1)==> y IN d1_fan (x,V:real^3->bool,E1)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`node (hypermap1_of_fanx (x,V,E1)) (x,w,inverse1_sigma_fan x V E1 w v,v) IN + node_set (hypermap1_of_fanx (x,V:real^3->bool,E1))` ASSUME_TAC +THENL(*7*)[ + + +ASM_REWRITE_TAC[node_set;IN_ELIM_THM;set_of_orbits] +THEN EXISTS_TAC`(x,w,inverse1_sigma_fan x V E1 w v,v:real^3)` +THEN ASM_REWRITE_TAC[node];(*7*) + +SUBGOAL_THEN`(x,w,inverse1_sigma_fan x V E1 w v,v)IN + node (hypermap1_of_fanx (x,V,E1)) (x,w,inverse1_sigma_fan x V E1 w v,v:real^3)`ASSUME_TAC +THENL(*8*)[ + +ASM_REWRITE_TAC[node;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC;(*8*) + + MRESAL_TAC CONDITION_DART_IN_NODE[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`node (hypermap1_of_fanx (x,V:real^3->bool,E1)) (x,w,inverse1_sigma_fan x V E1 w v,v)`;`(x,w,inverse1_sigma_fan x V E1 w v,v):real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][pr2] +THEN MP_TAC(SET_RULE`y IN + node (hypermap1_of_fanx (x,V,E1)) (x,w,inverse1_sigma_fan x V E1 w v,v)/\ +node (hypermap1_of_fanx (x,V,E1)) (x,w,inverse1_sigma_fan x V E1 w v,v) INTER + ds1 = + {(x,w,inverse1_sigma_fan x V E1 w v,v)} +/\ y IN ds1==> y IN {(x,w,inverse1_sigma_fan x V E1 w v,v:real^3)} +`) +THEN ASM_REWRITE_TAC[IN_SING;EQ_PAIR_4] +THEN STRIP_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`;`inverse1_sigma_fan x V E1 w v:real^3`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESA_TAC aff_gt_eq_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th `aff_gt {x:real^3, w, inverse1_sigma_fan x V E w u} {u}`) +THEN POP_ASSUM MATCH_MP_TAC +THEN EXISTS_TAC`(x, w, inverse1_sigma_fan x V E w u,u:real^3)` +THEN REWRITE_TAC[pr2;pr3;f1_fan] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN SUBGOAL_THEN`x,w,inverse1_sigma_fan x V E w u,u= f1_fan x V E ((x,u,w,sigma_fan x V E u w):real^3#real^3#real^3#real^3)` +ASSUME_TAC +THENL(*9*)[REWRITE_TAC[f1_fan;EQ_PAIR_4];(*9*) + + +POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN MATCH_MP_TAC condition_f1_fan_in_face_set +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN EXISTS_TAC`(x,u,w,sigma_fan x V E u w:real^3)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC f2_EQ_F30_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +](*9*)](*8*)](*7*)](*6*)](*5*)](*4*)](*3*);(*2*) + + +MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN FIND_ASSUM MP_TAC`{v', w':real^3} IN E1` +THEN FIND_ASSUM( fun th-> GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[SYM th;UNION;IN_ELIM_THM])`E UNION {{v, w:real^3}}=E1` +THEN STRIP_TAC +THENL(*3*)[ + + +MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`v':real^3`;`w':real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th `aff_gt {x, v', w'} {sigma_fan x V E1 v' w':real^3}`) +THEN POP_ASSUM MATCH_MP_TAC +THEN EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[pr2;pr3;f1_fan] +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;`w':real^3`] +THEN DISJ_CASES_TAC(SET_RULE`~(x,v',w',sigma_fan x V E v' w' IN ds)\/ x,v',w',sigma_fan x V E v' w' IN (ds:real^3#real^3#real^3#real^3->bool)`) +THENL(*4*)[ + +SUBGOAL_THEN`~(ds = face (hypermap1_of_fanx (x,V,E)) (x,v',w',sigma_fan x V E v' w':real^3))`ASSUME_TAC +THENL(*5*)[ + +POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN RESA_TAC +THEN REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC;(*5*) + +ABBREV_TAC`ds0=face (hypermap1_of_fanx (x,V,E)) (x,v',w',sigma_fan x V E v' (w':real^3))` +THEN SUBGOAL_THEN`ds0 IN face_set (hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL(*6*)[ + +REWRITE_TAC[face_set; set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`(x,v',w':real^3,sigma_fan x V E v' w')` +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC "ds0" +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v':real^3` +THEN EXISTS_TAC`w':real^3` +THEN EXISTS_TAC`sigma_fan x V E v' w':real^3` +THEN ASM_REWRITE_TAC[];(*6*) + +MRESAL_TAC DOMAIN_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(ds0:real^3#real^3#real^3#real^3->bool)`;][DELETE;IN_ELIM_THM] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC unique_tranf_fan +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +; `(face (hypermap1_of_fanx (x:real^3,V:real^3->bool,E)) (y:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3->bool` +;`(ds1:real^3#real^3#real^3#real^3->bool)` +;`((x,v',w':real^3,sigma_fan x V E v' w'):real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM;tran] +THEN REMOVE_THEN "YEU" MP_TAC +THEN RESA_TAC +THEN REMOVE_THEN "LINH1" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESAL_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`(f1_fan x V E1 POWER k) (x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`][] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN EXPAND_TAC "ds0" +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;face;IN_ELIM_THM;orbit_map]) +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC](*6*)](*5*);(*4*) + +ASM_REWRITE_TAC[]](*4*);(*3*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN_SING] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]]]);; + + + + + + +let lemmaINTERS_HALF_SPACE_DS_FANADD1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U1. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v}=U1 +==> U1 INTER aff_gt {x, v, w} {u} SUBSET dartset_leads_into_fan x V E1 ds2`, + + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[conforming_fan;conforming_half_space_fan] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`ds2:real^3#real^3#real^3#real^3->bool`) +THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN REWRITE_TAC[INTERS;IN_ELIM_THM;SUBSET] +THEN REMOVE_THEN "EM"(fun th-> REWRITE_TAC[SYM th;INTERS;IN_ELIM_THM;INTER]) +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] THEN ASSUME_TAC th THEN STRIP_TAC) +THEN MP_TAC(SET_RULE`y IN {f10, f20, f30:real^3#real^3#real^3#real^3}==> y =f10\/ y =f20\/ y =f30`) +THEN RESA_TAC +THENL[ + +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3;f1_fan])`x,w,v,u = f10:real^3#real^3#real^3#real^3` +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]; + +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3;f1_fan])`x,v,u,w = f20:real^3#real^3#real^3#real^3` +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 /\ {v, u} IN E==> {v, u} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`u:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`) +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); + + + +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3;f1_fan])`x,u,w,v = f30:real^3#real^3#real^3#real^3` +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 /\ {u,w} IN E==> {u,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`) +THEN RESA_TAC +THEN RESA_TAC]);; + + + + + + + + +let lemmaINTERS_HALF_SPACE_DS_FANADD2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U1. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v}=U1 +==> U1 INTER aff_gt {x, v, w} {sigma_fan x V E v u} SUBSET dartset_leads_into_fan x V E1 ds1`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] + +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "EM"(fun th-> REWRITE_TAC[SYM th;INTERS;IN_ELIM_THM;INTER;SUBSET]) +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 ==> {v,w:real^3} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`sigma_fan x V E v (u:real^3)`; +`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {sigma_fan x V E v u,v} IN E ==> { sigma_fan x V E v u,v} IN E1`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`w:real^3`]) + +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`sigma_fan x V E v u:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_1_3[`x:real^3`;`sigma_fan x V E v u:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`sigma_fan x V E v u:real^3`;` v:real^3`;` w:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` x' IN aff_gt {x, sigma_fan x V E v u,v} {w} /\ +x' IN aff_gt {x, w, sigma_fan x V E v u} {v} +/\ x' IN aff_gt {x, v, w} {sigma_fan x V E v u} + +/\ aff_gt {x, sigma_fan x V E v u, v} {w} INTER + aff_gt {x, v, w} {sigma_fan x V E v u} INTER + aff_gt {x, w, sigma_fan x V E v u} {v} SUBSET + dart_leads_into x V E1 v w +==> (x':real^3) IN dart_leads_into x V E1 v w`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN SUBGOAL_THEN`(x,v,w:real^3,sigma_fan x V E v u:real^3) IN ds1` ASSUME_TAC +THENL[ +FIND_ASSUM (fun th-> REWRITE_TAC[SYM th;face;IN_ELIM_THM;orbit_map])`face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w:real^3) = ds1` +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC; +MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`; +`ds1:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th `(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`[pr2;pr3])]);; + + + +let aff_gt_3_1_INTER_aff_SUBSET_aff_gt_2_1=prove(`!a x y z w:real^3. +azim a x y z < pi +/\ &0< azim a x y z +/\ azim a x y w < pi +/\ &0< azim a x y w +/\ DISJOINT {a, x} {w} +/\ ~collinear {a, x, w} +/\ ~coplanar {a, x, y, z} +==> aff_gt {a,x,y}{z} INTER aff{a,x,w} SUBSET aff_gt {a,x} {w}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`] +THEN RESA_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`a:real^3`;`x:real^3`;`z:real^3`;`y:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`a:real^3`; `x:real^3`;`z:real^3`;`y:real^3`] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`a:real^3`;`x:real^3`;`y:real^3`;`z:real^3`] +THEN REWRITE_TAC[AFFINE_HULL_3;aff;INTER;SUBSET;IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_2_1[`a:real^3`;`x:real^3`;`w:real^3`][IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`u:real` +THEN EXISTS_TAC`v:real` +THEN EXISTS_TAC`w':real` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[th]) +THEN REWRITE_TAC[VECTOR_ARITH`(u % a + v % x + w' % w) - a= v % (x-a) + w' % (w-a) +((u+v +w')- &1)% a`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th;VECTOR_ARITH`v % (x - a) + w' % (w - a) + (&1 - &1) % a=v % (x - a) + w' % (w - a)`;]) +THEN REWRITE_TAC[DOT_RADD;DOT_RMUL;DOT_CROSS_SELF;REAL_ARITH`v * &0 +A=A`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`a:real^3`; `x:real^3`;`w:real^3`;`y:real^3`] +THEN STRIP_TAC +THEN MRESA_TAC REAL_LT_LCANCEL_IMP[`((x - a) cross (y - a)) dot (w - a:real^3)`;`&0`;`w':real`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC);; + + + + + +let aff_gt_3_1_INTER_aff_SUBSET_aff_gt_2_14=prove(`!a x y z:real^3. +~coplanar {a, x, y, z} +==> aff_gt {a,x,y}{z} INTER aff{a,x,z} SUBSET aff_gt {a,x} {z}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`] +THEN RESA_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`a:real^3`;`x:real^3`;`z:real^3`;`y:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`a:real^3`; `x:real^3`;`z:real^3`;`y:real^3`] +THEN REWRITE_TAC[AFFINE_HULL_3;aff;INTER;SUBSET;IN_ELIM_THM] +THEN MRESA_TAC notcoplanar_disjoint[`a:real^3`;`x:real^3`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC notcoplanar_disjoints[`a:real^3`;`x:real^3`;`y:real^3`;`z:real^3`] +THEN MP_TAC(SET_RULE`~(a=z) /\ ~(x=z:real^3)==>DISJOINT {a, x} {z}`) +THEN RESA_TAC +THEN MRESAL_TAC AFF_GT_2_1[`a:real^3`;`x:real^3`;`z:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_3_1[`a:real^3`;`x:real^3`;`y:real^3`;`z:real^3`][IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`u:real` +THEN EXISTS_TAC`v:real` +THEN EXISTS_TAC`w:real` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th] THEN MP_TAC th) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % a + t2 % x + t3 % y + t4 % z = u % a + v % x + w % z +<=> ((u+v+w)-(t1+t2+t3+t4))%a+(w-t4)%(z-a)= t3%(y-a)+(t2-v)%(x-a)`;VECTOR_ARITH`(&1 - &1) % a +A=A`] +THEN DISJ_CASES_TAC(REAL_ARITH`~(w-t4= &0)\/ w=t4:real`) +THENL[ +STRIP_TAC +THEN MP_TAC(SET_RULE`(w - t4) % (z - a:real^3) = t3 % (y - a) + (t2 - v) % (x - a) +==> (inv (w-t4))%((w - t4) % (z - a)) =(inv (w-t4))%( t3 % (y - a) + (t2 - v) % (x - a))`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN MRESA1_TAC REAL_MUL_LINV `w-t4:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`~(coplanar{a, x, y, z:real^3})` +THEN REWRITE_TAC[COPLANAR_DET_EQ_0] +THEN ASM_REWRITE_TAC[DET_3;VECTOR_3;VECTOR_ADD_COMPONENT;VECTOR_MUL_COMPONENT] +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[]]);; + + + + +let lemmaINTERS_HALF_SPACE_DS_FANADD3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U1. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ U1= aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v} + +==> U1 INTER aff {x,v,w} SUBSET aff_gt {x} {v, w} `, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {v,u} IN E ==> { v,u} IN E1`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 ==> {v,w:real^3} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`sigma_fan x V E v (u:real^3)`; +`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`sigma_fan x V E v u:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN STRIP_TAC +THEN MRESA_TAC aff_gt_3_1_INTER_aff_SUBSET_aff_gt_2_1[`x:real^3`;`v:real^3`;`u:real^3`;`sigma_fan x V E v u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC aff_gt_3_1_INTER_aff_SUBSET_aff_gt_2_14[`x:real^3`;`w:real^3`;`u:real^3`;`v:real^3`;] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(v:real^3)`;`(w:real^3)`] +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B,C}={A,C,B}`] +THEN SET_TAC[]);; + + + + + + +let aff_3_rep_cross_dot=prove(`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u} + +==> aff {x,v,u} ={y:real^3| (((v-x) cross (u-x)) dot (y-x)) = &0}`, + REWRITE_TAC[AFFINE_HULL_3;aff;IN_ELIM_THM;EXTENSION] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(u' % x + v' % v + w % u) - x= ((u'+v'+w)- &1)%x + v'%(v-x)+ w%(u-x)` +;VECTOR_ARITH`(&1- &1)%X+A=A`;DOT_RADD;DOT_RMUL;DOT_CROSS_SELF] +THEN REAL_ARITH_TAC; +DISCH_THEN(LABEL_TAC"ME") +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]properties_coordinate) THEN RESA_TAC +THEN MRESA_TAC ORTHONORMAL_IMP_SPANNING[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3)( v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[SPAN_3;EXTENSION] + THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(x':real^3)-(x:real^3)`th) THEN ASSUME_TAC(th)) +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(u:real^3)-(x:real^3)`th)THEN ASSUME_TAC(th)) +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(v:real^3)-(x:real^3)`th)) +THEN REWRITE_TAC[SET_RULE`(x:real^3) IN (:real^3)`;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`e1=e1_fan x v u:real^3` +THEN ABBREV_TAC`e2=e2_fan x v u:real^3` +THEN ABBREV_TAC`e3=e3_fan x v u:real^3` +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`x' = u' % x + v' % v + w % u <=> x'-x = ((u'+v'+w)- &1)%x+ v'%(v-x)+ w%(u-x)`] +THEN MRESA_TAC ORTHONORMAL_CROSS[`e1:real^3`;`e2:real^3`;`e3:real^3`;] +THEN REMOVE_THEN "ME" MP_TAC +THEN ASM_REWRITE_TAC[CROSS_LMUL;CROSS_RMUL;CROSS_LADD;CROSS_RADD;CROSS_REFL;] +THEN REDUCE_VECTOR_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;DOT_LNEG] +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC`orthonormal e1 e2 (e3:real^3)` +THEN REWRITE_TAC[orthonormal] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN FIND_ASSUM MP_TAC`(v - x) dot (e2:real^3) = &0:real` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`v - x = u' % e1 + v' % e2 + w % e3:real^3` +THEN REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;DOT_LNEG] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`(u - x) dot (e2:real^3) = &0:real` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`u - x = u'' % e1 + v'' % e2 + w' % e3:real^3` +THEN REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;DOT_LNEG] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN RESA_TAC +THEN REDUCE_ARITH_TAC +THEN FIND_ASSUM MP_TAC`(v - x) dot (e1:real^3) = &0:real` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`v - x = u' % e1 + v' % e2 + w % e3:real^3` +THEN REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;DOT_LNEG] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ARITH`u' * w' * --v''' + w * u'' * v''' = (w * u''-u' * w') * v''':real `] +THEN REDUCE_ARITH_TAC +THEN FIND_ASSUM MP_TAC`&0 < (u - x) dot (e1:real^3)` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`u - x = u'' % e1 + v'' % e2 + w' % e3:real^3` +THEN REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;DOT_LNEG] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN RESA_TAC +THEN REDUCE_ARITH_TAC +THEN FIND_ASSUM MP_TAC`dist (v,x) % e3 = v - x :real^3` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`v - x = u' % e1 + v' % e2 + w % e3:real^3` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN STRIP_TAC +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`dist (v,x:real^3) % e3 = w % (e3:real^3) ==> dist (v,x) % e3 dot e3 = w % e3 dot e3`) +THEN POP_ASSUM( fun th-> GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[DOT_LMUL] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;dist]) +THEN MRESA_TAC collinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;] +THEN MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_not_zero_fan) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 < u''==> ~(u''= &0)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[REAL_ENTIRE] +THEN RESA_TAC +THEN MP_TAC(ISPEC`(norm(v-x:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`u'':real`REAL_MUL_LINV) +THEN RESA_TAC +THEN REDUCE_VECTOR_TAC +THEN EXISTS_TAC`&1- (w''-u''' * inv(u'':real) * w') * inv(norm(v-x:real^3))- u''' * inv(u'':real)` +THEN EXISTS_TAC`(w''-u''' * inv(u'':real) * w') * inv(norm(v-x:real^3))` +THEN EXISTS_TAC`u''' * inv(u'':real)` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - (w'' - u''' * inv u'' * w') * inv (norm (v - x)) - u''' * inv u'' + + (w'' - u''' * inv u'' * w') * inv (norm (v - x)) + + u''' * inv u'' = + &1`;VECTOR_ARITH`(&1- &1) %A+B+C=B+C`;VECTOR_ARITH`A%(B+C)=A %B+ A%C`;VECTOR_ARITH`A %B %C=(A*B)%C` +;REAL_ARITH`(A*B)*C=A*(B*C)`] +THEN VECTOR_ARITH_TAC]);; + + + + + + + +let SPACE3_EQ_UNION_3SET=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> aff {x,v,w} UNION aff_gt {x, v, w} {sigma_fan x V E v u} UNION aff_gt {x, v, w} {u}= (:real^3) `, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 ==> { v,w} IN E1`) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MP_TAC th +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC THEN ASSUME_TAC th) +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`w:real^3`;`v:real^3`]) +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{a,b,c,d}={a,d,b,c}`] +THEN STRIP_TAC +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `w:real^3`;`u:real^3`;`v:real^3`] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`w:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`sigma_fan x V E v (u:real^3)`; +`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {sigma_fan x V E v u, v} IN E ==> {sigma_fan x V E v u, v} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`sigma_fan x V E v u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{a,b,c,d}={a,c,b,d}`] +THEN STRIP_TAC +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`sigma_fan x V E v u`;`w:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `v:real^3`;`sigma_fan x V E v u:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`w:real^3`;`sigma_fan x V E v u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{a,b,c,d}={a,b,d,c}`] +THEN RESA_TAC +THEN MRESA_TAC aff_3_rep_cross_dot[`x:real^3`;`v:real^3`;`w:real^3`] +THEN REWRITE_TAC[UNION;IN_ELIM_THM;EXTENSION;DOT_LNEG] +THEN GEN_TAC +THEN EQ_TAC +THENL[SET_TAC[]; +REAL_ARITH_TAC]);; + + + +let lemmaU1_subset_U=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U U1. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ U1= aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v} +/\ U= dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w} +==> U1 SUBSET U `, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] + +THEN MRESA_TAC lemmaINTERS_HALF_SPACE_DS_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U1:real^3->bool`] +THEN MRESA_TAC lemmaINTERS_HALF_SPACE_DS_FANADD2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U1:real^3->bool`] +THEN MRESA_TAC lemmaINTERS_HALF_SPACE_DS_FANADD3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U1:real^3->bool`] +THEN MRESA_TAC SPACE3_EQ_UNION_3SET +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN ASM_TAC +THEN SET_TAC[]);; + + + + + + + + + + +let open_subsetU=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ U=aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v} +==> open U`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MATCH_MP_TAC OPEN_INTER +THEN STRIP_TAC +THENL[ + MATCH_MP_TAC OPEN_AFF_GT_3_1 +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)` ;`v:real^3`;`u:real^3`;`w:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN ASM_REWRITE_TAC[]; + +MATCH_MP_TAC OPEN_INTER +THEN STRIP_TAC +THENL[ + MATCH_MP_TAC OPEN_AFF_GT_3_1 +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`sigma_fan x V E v (u:real^3)`; +`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)` ;`sigma_fan x V E v u:real^3`;`v:real^3`;`u:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASM_REWRITE_TAC[]; + + +MATCH_MP_TAC OPEN_INTER +THEN STRIP_TAC +THENL[ MATCH_MP_TAC OPEN_AFF_GT_3_1 +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 ==> { v,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`w:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`sigma_fan x V E v (u:real^3)`; +`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {sigma_fan x V E v u, v} IN E ==> {sigma_fan x V E v u, v} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)` ;`sigma_fan x V E v u:real^3`;`v:real^3`;`w:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC OPEN_AFF_GT_3_1 +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 ==> { v,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`w:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`sigma_fan x V E v (u:real^3)`; +`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {sigma_fan x V E v u, v} IN E ==> {sigma_fan x V E v u, v} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)` ;`sigma_fan x V E v u:real^3`;`v:real^3`;`w:real^3`]]]]);; + + + +let eq_aff_gt_3_fanadd_edge=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> aff_gt {x, v, u} {sigma_fan x V E v u}= aff_gt {x, v, u} {w}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`sigma_fan x V E v (u:real^3)`; +`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)` ;`sigma_fan x V E v u:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`sigma_fan x V E v u`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `v:real^3`;`sigma_fan x V E v u:real^3`;`u:real^3`] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`u:real^3`;`sigma_fan x V E v u:real^3`;] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {v,u} IN E ==> { v,u} IN E1`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v:real^3`;`u:real^3`]) +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {v,u} IN E ==> { v,w} IN E1`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)` ;`sigma_fan x V E1 v u:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`sigma_fan x V E1 v u`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `v:real^3`;`sigma_fan x V E1 v u:real^3`;`u:real^3`] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[]);; + + + + + +let aff_gt_add_subset_U1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U1. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ U1= aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v} +==> aff_gt {x} {v,w} SUBSET U1 `, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> { v,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(v:real^3)`;`(w:real^3)`] +THEN MRESA_TAC eq_aff_gt_3_fanadd_edge[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESAL_TAC AFF_GT_MONO_LEFT[`{x,w:real^3}`;`{x,u,w:real^3}`;`{v:real^3}`][SET_RULE`{x, w} SUBSET {x, u, w:real^3}`] +THEN MRESAL_TAC AFF_GT_MONO_LEFT[`{x,v:real^3}`;`{x,v,u:real^3}`;`{w:real^3}`][SET_RULE`{x, v} SUBSET {x, v, u:real^3}`] +THEN MRESAL_TAC AFF_GT_MONO_LEFT[`{x,v:real^3}`;`{x,v,sigma_fan x V E v u:real^3}`;`{w:real^3}`][SET_RULE`{x, v} SUBSET {x, v, sigma_fan x V E v u:real^3}`] +THEN MRESAL_TAC AFF_GT_MONO_LEFT[`{x,w:real^3}`;`{x,sigma_fan x V E v u,w:real^3}`;`{v:real^3}`][SET_RULE`{x, w} SUBSET {x, sigma_fan x V E v u, w:real^3}`] +THEN ASM_TAC +THEN SET_TAC[]);; + + + +let lemma_rep_U_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U U1. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ U= dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w} +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ U1= aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v} +==> U= U1 UNION dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC aff_gt_add_subset_U1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U1:real^3->bool`] +THEN MRESA_TAC lemmaU1_subset_U[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U:real^3->bool`;`U1:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + +let dartset_leads_into_ds_open_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}=U +==> open U `, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC lemma_rep_U_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U:real^3->bool`;`aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v:real^3}`] +THEN MATCH_MP_TAC OPEN_UNION +THEN MRESA_TAC open_subsetU[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v:real^3}`] +THEN MATCH_MP_TAC OPEN_UNION +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`dartset_leads_into_fan x V E1 ds1`] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`dartset_leads_into_fan x V E1 ds2`]);; + + +let U_INTER_U2_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ U= dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w} +==> +U INTER + UNIONS + (topological_component_yfan (x,V,E1) DELETE + dartset_leads_into_fan x V E1 ds1 DELETE + dartset_leads_into_fan x V E1 ds2) = {}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN REWRITE_TAC[UNIONS;INTER;IN_ELIM_THM;UNION;DELETE] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +REPEAT STRIP_TAC +THENL[ + MRESA_TAC version_JUTSTKG[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u':real^3->bool`] +THEN FIND_ASSUM MP_TAC`u' IN topological_component_yfan (x:real^3,V,E1)` +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y:real^3`;`x':real^3`] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y':real^3`;`x':real^3`]; + + MRESA_TAC version_JUTSTKG[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u':real^3->bool`] +THEN FIND_ASSUM MP_TAC`u' IN topological_component_yfan (x:real^3,V,E1)` +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y:real^3`;`x':real^3`] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y':real^3`;`x':real^3`]; + MRESA_TAC version_JUTSTKG[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u':real^3->bool`] +THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;` f:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC AFF_GE_SUBSET_XFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE` aff_ge {x} {v, w} SUBSET xfan (x,V,E1) /\ aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w} +==> aff_gt {x:real^3} {v, w} SUBSET xfan (x,V:real^3->bool,E1)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE` x' IN aff_gt {x} {v, w}/\ u' SUBSET yfan (x,V,E1) /\ x' IN u'==> ~(aff_gt {x} {v, w} INTER yfan(x,V:real^3->bool,E1)={})`) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan] +THEN SET_TAC[]]; +SET_TAC[]]);; + + +let dartset_leads_into_fan_SUBSET_U=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}=U +==> dartset_leads_into_fan x V E ds SUBSET U +`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN REWRITE_TAC[GSYM UNIONS_TOPOLOGICAL_COMPONENT_EQ_YFAN] +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[UNIONS_TOPOLOGICAL_COMPONENT_EQ_YFAN] +THEN DISCH_THEN(LABEL_TAC"MA") +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN SUBGOAL_THEN`yfan (x,V,E) = + UNIONS ((topological_component_yfan (x,V,E1) DELETE (dartset_leads_into_fan x V E1 ds1))DELETE (dartset_leads_into_fan x V E1 ds2)) UNION (dartset_leads_into_fan x V E1 ds2) UNION (dartset_leads_into_fan x V E1 ds1) UNION aff_gt {x} {v, w}` +ASSUME_TAC +THENL(*1*)[ +ASM_REWRITE_TAC[UNIONS;DELETE;UNION;IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*1*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`A UNION B UNION C UNION D=A UNION (C UNION B UNION D)`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC(SYM th) THEN DISCH_THEN(LABEL_TAC"LINH")) +THEN REMOVE_THEN"MA"(fun th-> MP_TAC(SYM th) THEN DISCH_THEN(LABEL_TAC"MA")) +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC exists_in_aff_gt_disjoint[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC STEP2_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN REWRITE_TAC[SUBSET] +THEN GEN_TAC +THEN MRESA_TAC dartset_leads_into_fanadd2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MP_TAC(SET_RULE`y' IN aff_gt {x} {v, w:real^3} /\ aff_gt {x} {v, w} SUBSET connected_component (yfan (x,V:real^3->bool,E)) y==> y' IN connected_component (yfan (x,V,E)) y`) +THEN RESA_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan (x,V:real^3->bool,E)`;`y:real^3`;`y':real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_SUBSET[`yfan (x,V:real^3->bool,E)`;`y':real^3`] +THEN MP_TAC(SET_RULE`connected_component (yfan (x,V,E)) y' SUBSET yfan (x,V,E)/\ x' IN connected_component (yfan (x,V,E)) y' +==> x' IN yfan (x,V:real^3->bool,E)`) +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "MA"(fun th-> REWRITE_TAC[SYM th] +THEN REMOVE_THEN "LINH"(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM])) +THEN STRIP_TAC +THEN SUBGOAL_THEN`?e1 e2. + open e1 /\ + open e2 /\ + (connected_component (yfan (x,V,E)) y') SUBSET e1 UNION e2 /\ + e1 INTER e2 INTER (connected_component (yfan (x,V:real^3->bool,E)) y') = {} /\ + ~(e1 INTER (connected_component (yfan (x,V,E)) y') = {}) /\ + ~(e2 INTER (connected_component (yfan (x,V,E)) y') = {})` ASSUME_TAC +THENL(*2*)[ + + MRESA_TAC dartset_leads_into_ds_open_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U:real^3->bool`] + +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN EXISTS_TAC`U:real^3->bool` +THEN EXISTS_TAC`UNIONS + (topological_component_yfan (x,V:real^3->bool,E1) DELETE + dartset_leads_into_fan x V E1 ds1 DELETE + dartset_leads_into_fan x V E1 ds2)` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*3*)[ +MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`; +`dartset_leads_into_fan x V E1 ds1:real^3->bool`] +THEN MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`; +`dartset_leads_into_fan x V E1 ds2:real^3->bool`] +THEN MATCH_MP_TAC OPEN_UNIONS +THEN REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`; +`s:real^3->bool`]; + +STRIP_TAC +THENL(*4*)[ + + MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC UNIONS_TOPOLOGICAL_COMPONENT_EQ_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM( fun th-> REMOVE_THEN "EM" (fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[th]) +THEN SET_TAC[]; + +STRIP_TAC +THENL(*5*)[ + +MRESA_TAC U_INTER_U2_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*5*) + +MP_TAC(SET_RULE`y' IN aff_gt {x} {v, w} /\ dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w:real^3}=U +==> y' IN U +`) +THEN RESA_TAC +THEN SUBGOAL_THEN`y' IN connected_component (yfan (x,V:real^3->bool,E)) y'`ASSUME_TAC +THENL(*6*)[ + +REWRITE_TAC[IN] +THEN MATCH_MP_TAC CONNECTED_COMPONENT_REFL +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC condition_aff_gt_subset_yfan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v:real^3`;`u:real^3`;`w:real^3`;] +THEN ASM_TAC +THEN SET_TAC[];(*6*) + +MP_TAC(SET_RULE`y' IN U /\ y' IN connected_component (yfan (x,V:real^3->bool,E)) y'==> ~(U INTER connected_component (yfan (x,V,E)) y' = {})`) +THEN RESA_TAC +THEN ASM_TAC +THEN SET_TAC[]]]]];(*2*) +MRESA_TAC CONNECTED_CONNECTED_COMPONENT[`yfan(x,V:real^3->bool,E)`;`y':real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[connected]]]);; + + + + + + + + + + + +let rep_dartset_leads_into_fan_ds=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}=U +==> dartset_leads_into_fan x V E ds =U +`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC dartset_leads_into_fan_SUBSET_U[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U:real^3->bool`] +THEN MRESA_TAC dartset_leads_into_fanadd2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC dartset_leads_into_fanadd1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC STEP2_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN ASM_TAC +THEN SET_TAC[]);; + + + + + +let u_in_topological_component_yfanadd1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN (x,V,E1) /\ + (!v. v IN V ==> CARD (set_of_edge v V E1) > 1) /\ + fan80 (x,V,E1) /\ + N_FAN (x,V,E1) < N_FAN (x,V,E) + ==> conforming_fan (x,V,E1)) +/\ dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}=U +==> U IN topological_component_yfan (x,V,E)`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U:real^3->bool`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`]);; + + + + + + + + + + + + +let dartset_leads_into_fan_eq_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) + +==> dartset_leads_into_fan x V E1 (tranf x V E E1 ds0) = dartset_leads_into_fan x V E ds0`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MP_TAC(SET_RULE`ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds ==> ds0 IN face_set (hypermap1_of_fanx (x:real^3,V,E))`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC TRANF[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0:real^3#real^3#real^3#real^3->bool` ] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MAT") +THEN STRIP_TAC +THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds0:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN MP_TAC(SET_RULE`ds0 SUBSET d1_fan (x,V,E) /\ y IN ds0==> y IN d1_fan ((x:real^3),V,E)`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM (fun th-> MP_TAC (SYM th)) +THEN DISCH_THEN(LABEL_TAC"NHO") THEN ASSUME_TAC th) +THEN SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E1)) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3)) IN face_set (hypermap1_of_fanx (x:real^3,V,E1))` ASSUME_TAC +THENL(*1*)[ +REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;face] +THEN EXISTS_TAC`(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))` +THEN REMOVE_THEN "NHO"(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[tran;d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v':real^3` +THEN EXISTS_TAC`w':real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v' w':real^3` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`{v', w'} IN E/\ E UNION {{v, w:real^3}} = E1==> {v', w'} IN E1`) +THEN ASM_REWRITE_TAC[];(*1*) + +SUBGOAL_THEN`tran x V E1 y IN face (hypermap1_of_fanx (x,V,E1)) (tran x V E1 (y:real^3#real^3#real^3#real^3))` +ASSUME_TAC +THENL(*2*)[ +REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC;(*2*) + +MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`; +`face (hypermap1_of_fanx (x,V,E1)) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"NHOEM") +THEN REMOVE_THEN "NHO"(fun th-> REWRITE_TAC[SYM th;tran;pr2;pr3] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"LINH")) +THEN MP_TAC(SET_RULE`{v', w'} IN E/\ E UNION {{v, w:real^3}} = E1==> {v', w'} IN E1`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC DART_LEADS_INTO [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"NHO") +THEN MRESA_TAC DART_LEADS_INTO [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"NHO1") +THEN MATCH_MP_TAC unique_dart_leads_into +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0 &0< min (h:real) (h':real)`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN EXISTS_TAC`min (h:real) (h':real)` +THEN ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(SET_RULE`((y:real^3#real^3#real^3#real^3) IN ds)\/ ~(y IN ds)`) +THENL(*3*)[ +MRESA_TAC lemma_face_representation[`hypermap1_of_fanx(x:real^3,V,E)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x'':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESA_TAC lemma_face_representation[`hypermap1_of_fanx(x:real^3,V,E)`;`ds0:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x''':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th; DELETE;IN_ELIM_THM] );(*3*) + + REPEAT GEN_TAC THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`s < min h h'==> s < h' /\ s < h `) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w':real^3)`; +`(v':real^3)`] +THEN FIND_ASSUM MP_TAC`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E1) > 1)` +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `v':real^3`th) +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN STRIP_TAC THEN ASSUME_TAC th)) +THEN FIND_ASSUM MP_TAC`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)` +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `v':real^3`th) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN STRIP_TAC THEN ASSUME_TAC th)) +THEN ASM_REWRITE_TAC[rw_dart_fan;w_dart_fan] +THEN MRESA_TAC INVARANT_SIGMA_FAN_ADD +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN"NHOEM" MP_TAC +THEN REMOVE_THEN "LINH"(fun th-> REWRITE_TAC[SYM th;pr2;pr3;tran] THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"LINH")) +THEN DISCH_THEN(LABEL_TAC"NHOEM") +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REMOVE_THEN "NHO"(fun th-> MRESAL_TAC th[`s:real`;`y':real^3`][rw_dart_fan;w_dart_fan]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN MP_TAC(SYM th) THEN DISCH_THEN(LABEL_TAC"BELINH")) +THEN MRESA_TAC STEP2_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"NHOLINH") +THEN ASSUME_TAC(SET_RULE`yfan (x:real^3,(V:real^3->bool),E1) SUBSET yfan (x,V,E1) UNION aff_gt {x} {v, w}`) +THEN MRESA_TAC CONNECTED_COMPONENT_MONO[`yfan (x:real^3,(V:real^3->bool),E1)`;`(yfan (x:real^3,(V:real^3->bool),E1) UNION aff_gt {x} {v:real^3, w})`;`y':real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEULINH") +THEN REWRITE_TAC[EXTENSION] +THEN GEN_TAC +THEN EQ_TAC +THENL(*4*)[ +POP_ASSUM MP_TAC +THEN SET_TAC[];(*4*) + + + GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[IN;connected_component ] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE(`(t INTER aff_gt {x} {v:real^3, w}={}) \/ ~(t INTER aff_gt {x} {v, w}={})`)) +THENL(*5*)[ +MP_TAC(SET_RULE`t SUBSET yfan (x,V,E1) UNION aff_gt {x} {v, w}/\ t INTER aff_gt {x} {v, w} = {} +==> t SUBSET yfan (x,V:real^3->bool,E1)`) +THEN ASM_REWRITE_TAC[IN;connected_component ] +THEN STRIP_TAC +THEN EXISTS_TAC`t:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN SET_TAC[IN];(*5*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?z. z IN A`;INTER;IN_ELIM_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN`z IN connected_component (yfan (x,V:real^3->bool,E1) UNION aff_gt {x} {v, w}) y'` +ASSUME_TAC +THENL(*6*)[ +ASM_REWRITE_TAC[IN;connected_component ] +THEN EXISTS_TAC`t:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN SET_TAC[IN];(*6*) +MP_TAC(SET_RULE`aff_gt {x} {v, w} SUBSET dartset_leads_into_fan x V E ds /\ z IN aff_gt {x} {v, w} +==> z IN dartset_leads_into_fan x (V:real^3->bool) E ds`) +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`z IN connected_component (yfan (x,V,E1) UNION aff_gt {x} {v, w}) y'' +/\ z IN connected_component (yfan (x,V,E1) UNION aff_gt {x} {v, w}) y' +==> ~(connected_component (yfan (x,V,E1) UNION aff_gt {x} {v, w}) y' INTER connected_component (yfan (x,V:real^3->bool,E1) UNION aff_gt {x} {v, w}) y''={})`) +THEN ASM_REWRITE_TAC[CONNECTED_COMPONENT_OVERLAP] +THEN STRIP_TAC +THEN REMOVE_THEN"YEULINH" MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN"NHOLINH" (fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_THEN"EM" (fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_THEN"BELINH" (fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "NHO1"(fun th-> MRESAL_TAC th[`s:real`;`y':real^3`][rw_dart_fan;w_dart_fan]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN MP_TAC(th) THEN DISCH_THEN(LABEL_TAC"BELINH")) +THEN REMOVE_THEN "NHOEM"(fun th-> REWRITE_TAC[SYM th] THEN MP_TAC(SYM th) THEN DISCH_THEN(LABEL_TAC"BELINH12")) +THEN REMOVE_THEN "MAT" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "LINH"(fun th-> ASM_REWRITE_TAC[SYM th;tran]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN MP_TAC(SYM th) THEN DISCH_THEN(LABEL_TAC"BELINH123")) +THEN MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION + dartset_leads_into_fan x (V:real^3->bool) E1 ds2 UNION + aff_gt {x} {v, w}:real^3->bool`] +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC AFF_GE_SUBSET_XFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE` aff_ge {x} {v, w} SUBSET xfan (x,V,E1) /\ aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w} +==> aff_gt {x:real^3} {v, w} SUBSET xfan (x,V:real^3->bool,E1)`) +THEN RESA_TAC +THEN MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(ds0:real^3#real^3#real^3#real^3->bool)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;` tranf x (V:real^3->bool)( E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`aff_gt {x} {v, w} SUBSET xfan (x,V,E1) +/\ dartset_leads_into_fan x V E1 (tranf x V E E1 ds0) SUBSET (:real^3) DIFF xfan (x,V,E1) /\ dartset_leads_into_fan x V E1 (tranf x V E E1 ds0) SUBSET + dartset_leads_into_fan x V E1 ds1 UNION + dartset_leads_into_fan x V E1 ds2 UNION + aff_gt {x} {v, w} +==> dartset_leads_into_fan x V E1 (tranf x (V:real^3->bool)( E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool)) SUBSET + dartset_leads_into_fan x V E1 ds1 UNION + dartset_leads_into_fan x V E1 ds2`) +THEN RESA_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN STRIP_TAC +THEN SUBGOAL_THEN`y''' IN dartset_leads_into_fan x V (E1:(real^3->bool)->bool) (tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool))` +ASSUME_TAC +THENL(*7*)[ +ASM_REWRITE_TAC[IN] +THEN MATCH_MP_TAC CONNECTED_COMPONENT_REFL +THEN ASM_REWRITE_TAC[];(*7*) +MP_TAC(SET_RULE`y''' IN dartset_leads_into_fan x V (E1:(real^3->bool)->bool) (tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool)) +/\ dartset_leads_into_fan x V E1 (tranf x V E E1 ds0) SUBSET + dartset_leads_into_fan x V E1 ds1 UNION + dartset_leads_into_fan x V E1 ds2 +==> y''' IN dartset_leads_into_fan x V E1 ds1\/ y''' IN dartset_leads_into_fan x V E1 ds2`) +THEN RESA_TAC +THENL(*8*)[ + + +POP_ASSUM MP_TAC +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`(ds1:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y'''':real^3`;`y''':real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool)`] +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`dartset_leads_into_fan x V (E1:(real^3->bool)->bool) (tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool))`) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(ds1:real^3#real^3#real^3#real^3->bool)` +THEN MRESA1_TAC th`(tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool))`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[];(*8*) + +POP_ASSUM MP_TAC +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`(ds2:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y'''':real^3`;`y''':real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool)`] +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`dartset_leads_into_fan x V (E1:(real^3->bool)->bool) (tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool))`) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(ds2:real^3#real^3#real^3#real^3->bool)` +THEN MRESA1_TAC th`(tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool))`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[]]]]]]]]]);; + + + + + +let conforming_bijection_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> + +!s. s IN topological_component_yfan (x,V,E) ==> (?!f. f IN face_set (hypermap1_of_fanx (x,V,E)) /\ + s = dartset_leads_into_fan x V E f)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REWRITE_TAC[EXISTS_UNIQUE] +THEN MRESA_TAC version_JUTSTKG[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`s:real^3->bool`] +THEN EXISTS_TAC`f:real^3#real^3#real^3#real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE] +THEN REPEAT STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN DISJ_CASES_TAC(SET_RULE`~(ds=y)\/ (y=ds:real^3#real^3#real^3#real^3->bool)`) +THENL[ +MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3->bool)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (y:real^3#real^3#real^3#real^3->bool)`] +THEN MRESA_TAC dartset_leads_into_fan_eq_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(y:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(ds=f)\/ (f=ds:real^3#real^3#real^3#real^3->bool)`) +THENL[ + +MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(f:real^3#real^3#real^3#real^3->bool)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool)`] +THEN MRESA_TAC dartset_leads_into_fan_eq_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(f:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th`dartset_leads_into_fan x V E1 (tranf x V (E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool))`) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(tranf x V (E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool))` THEN MRESA1_TAC th`(tranf x V (E:(real^3->bool)->bool) E1 (y:real^3#real^3#real^3#real^3->bool))`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESAL_TAC INJ_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3->bool)`;`(f:real^3#real^3#real^3#real^3->bool)`][DELETE;IN_ELIM_THM]; + +REMOVE_THEN "LINH1" MP_TAC +THEN MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC AFF_GE_SUBSET_XFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE` aff_ge {x} {v, w} SUBSET xfan (x,V,E1) /\ aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w} +==> aff_gt {x:real^3} {v, w} SUBSET xfan (x,V:real^3->bool,E1)`) +THEN RESA_TAC +THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;` tranf x (V:real^3->bool)( E:(real^3->bool)->bool) E1 (y:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC exists_in_aff_gt_disjoint[`x:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]; + + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN DISJ_CASES_TAC(SET_RULE`~(ds=f)\/ (f=ds:real^3#real^3#real^3#real^3->bool)`) +THENL[ +MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(f:real^3#real^3#real^3#real^3->bool)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool)`] +THEN MRESA_TAC dartset_leads_into_fan_eq_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(f:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}:real^3->bool`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC AFF_GE_SUBSET_XFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE` aff_ge {x} {v, w} SUBSET xfan (x,V,E1) /\ aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w} +==> aff_gt {x:real^3} {v, w} SUBSET xfan (x,V:real^3->bool,E1)`) +THEN RESA_TAC +THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;` tranf x (V:real^3->bool)( E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC exists_in_aff_gt_disjoint[`x:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; +ASM_REWRITE_TAC[]]]);; + + + + +let RADIAL_AFF_GT_1_2 = prove(`!x u v r. + (DISJOINT {(x:real^B)} {u,v} /\ (r > &0) ) ==> + radial_norm r x (aff_gt {x} {u,v} INTER normball x r)`, +REWRITE_TAC[radial_norm] +THEN REPEAT STRIP_TAC +THENL[SET_TAC[]; +UNDISCH_TAC `(x:real^B) + u' IN aff_gt {x} {u, v} INTER normball x r` +THEN ASM_SIMP_TAC[AFF_GT_1_2] +THEN REWRITE_TAC[IN_ELIM_THM;IN_INTER] +THEN REPEAT STRIP_TAC +THENL[ +EXISTS_TAC `&1 + (t:real) * t1 - t` +THEN EXISTS_TAC `(t:real) * t2` +THEN EXISTS_TAC `(t:real) * t3` +THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 + t * t1 - t) + t * t2 + t * t3 = &1 + t * (t1 + t2 +t3)-t `; REAL_ARITH`&1 + t * &1 - t = &1`;VECTOR_ARITH`(&1 + t * t1 - t) % x + (t * t2) % u + (t * t3) % v=x + t % (t1 % x + t2 % u + t3 % v) - t %x`;] +THEN MP_TAC(REAL_ARITH`t> &0 ==> &0< t`) THEN RESA_TAC +THEN SUBGOAL_THEN `&0 < t * t2 /\ &0 < t * t3` (fun t -> REWRITE_TAC[t]) +THENL[ ASM_MESON_TAC[REAL_LT_MUL];REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN VECTOR_ARITH_TAC]; + + +MATCH_MP_TAC aff_normball +THEN ASM_REWRITE_TAC[]]]);; + + +let NORMBALL_SUBSET=prove(`!x r r'. r<= r' ==> normball x r SUBSET normball x r'`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;normball] +THEN GEN_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC);; + + +let RADIAL_NORM_CO=prove(`!r r' (x:real^3) C. r' <= r /\ &0< r' ==> (radial_norm r x (C INTER (normball x r))) ==> (radial_norm r' x (C INTER (normball x r')))`, +REWRITE_TAC[radial_norm] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC NORMBALL_SUBSET[`x:real^3`;`r':real`;`r:real`] +THENL[ +ASM_TAC +THEN SET_TAC[]; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`x + u IN C INTER normball x r' +/\ normball x r' SUBSET normball x r +==> (x:real^3) + u IN C INTER normball x r`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t * norm u < r' /\ r'<=r /\ t> &0 /\ &0< r' ==> &0< r /\ &0<=t /\ &0 t * r * inv r' > &0 /\ &0 <= t * r * inv r'/\ (t * r * inv r') * norm u < r* (inv r' * r')`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A * &1=A`] +THEN STRIP_TAC +THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th`u:real^3`) +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`t:real`[INTER;IN_ELIM_THM] THEN MRESAL1_TAC th`t * r * inv (r'):real`[INTER;IN_ELIM_THM]) +THEN POP_ASSUM MP_TAC +THEN MRESA1_TAC REAL_ABS_REFL `t:real` +THEN MRESA1_TAC REAL_ABS_REFL `t * r * inv r':real` +THEN ASM_REWRITE_TAC[normball;IN_ELIM_THM;dist;VECTOR_ARITH`(A+B)-A=B:real^3`;NORM_MUL]]);; + + +let tranf_eq_image_of_tran=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ds0 IN face_set(hypermap1_of_fanx (x,V,E)) DELETE ds +==> tranf x V E E1 ds0= IMAGE (tran x V E1) ds0`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MP_TAC(SET_RULE`ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds ==> ds0 IN face_set (hypermap1_of_fanx (x:real^3,V,E))`) +THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"LINH") +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC TRANF[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0:real^3#real^3#real^3#real^3->bool` ] +THEN MP_TAC(SET_RULE`y IN ds0 /\ ds0 SUBSET d1_fan (x,V,E)==> y IN d1_fan (x,V:real^3->bool,E)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`tran x (V:real^3->bool) E1 (y:real^3#real^3#real^3#real^3) IN d1_fan (x,V:real^3->bool,E1)` +ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN REWRITE_TAC[tran] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v':real^3` +THEN EXISTS_TAC`w':real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v' w':real^3` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN SET_TAC[]; +SUBGOAL_THEN`~(y IN ds:real^3#real^3#real^3#real^3->bool)` ASSUME_TAC +THENL[ +FIND_ASSUM MP_TAC`ds IN face_set(hypermap1_of_fanx (x,V:real^3->bool,E))` +THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face] +THEN REWRITE_TAC[orbit_map;IN_ELIM_THM] +THEN USE_THEN"EM"MP_TAC +THEN REWRITE_TAC[DELETE;face_set;IN_ELIM_THM;set_of_orbits] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x'':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN FIND_ASSUM MP_TAC`ds0 IN face_set (hypermap1_of_fanx (x,V:real^3->bool,E)) DELETE ds` +THEN REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN SET_TAC[]; + +ASM_REWRITE_TAC[IMAGE;face;orbit_map;EXTENSION;IN_ELIM_THM] +THEN USE_THEN"LINH"MP_TAC +THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face] +THEN REWRITE_TAC[orbit_map;IN_ELIM_THM] +THEN EQ_TAC +THEN REPEAT STRIP_TAC +THENL[ + + +EXISTS_TAC`(res (f1_fan x V E) (d1_fan (x,V,E)) POWER n) (y:real^3#real^3#real^3#real^3)` +THEN STRIP_TAC +THENL[ +EXISTS_TAC`n:num` +THEN ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`tran (x:real^3) (V:real^3->bool) E1 (y:real^3#real^3#real^3#real^3)` ) +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN_POWER +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`;`n:num`]]; + + +EXISTS_TAC`n:num` +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`tran (x:real^3) (V:real^3->bool) E1 (y:real^3#real^3#real^3#real^3)` ) +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN_POWER +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`;`n:num`] +]]]) +;; + + +let azim_fanadd_eq=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0 y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ds0 IN face_set(hypermap1_of_fanx (x,V,E)) DELETE ds +/\ y IN ds0 +==> azim_fan x V E1 (pr2 (tran x V E1 y)) (pr3 (tran x V E1 y)) += azim_fan x V E (pr2 y) (pr3 y)`, + + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MP_TAC(SET_RULE`ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds ==> ds0 IN face_set (hypermap1_of_fanx (x:real^3,V,E))`) +THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"LINH") +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC TRANF[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0:real^3#real^3#real^3#real^3->bool` ] +THEN MP_TAC(SET_RULE`y IN ds0 /\ ds0 SUBSET d1_fan (x,V,E)==> y IN d1_fan (x,V:real^3->bool,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[tran;pr2;pr3;azim_fan] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w':real^3)`; +`(v':real^3)`] +THEN REMOVE_ASSUM_TAC +THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `v':real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E1) > 1` +THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `v':real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E) > 1` +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN RESA_TAC +THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(v' IN {v, w})\/ (v' = v /\ ~(u=w')) \/ (v' = v /\ (u=w')) \/ (v' = w /\ ~(w'=inverse1_sigma_fan x (V:real^3->bool) E w u )) \/ (v' = w /\ (w'=inverse1_sigma_fan x V E w u ))`) +THENL[ + +MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v':real^3`;`w':real^3`]); +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL[ + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT4[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`w':real^3`]; + +SUBGOAL_THEN`f1=y:real^3#real^3#real^3#real^3` +ASSUME_TAC +THENL[ + MP_TAC(SET_RULE`y IN ds0 /\ ds0 SUBSET d1_fan (x,V,E)==> y IN d1_fan (x,V:real^3->bool,E)`) +THEN RESA_TAC +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f1:real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`;][pr2;pr3]; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN REMOVE_THEN "LINH" MP_TAC +THEN REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN RESA_TAC +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x'':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN FIND_ASSUM MP_TAC`ds IN face_set (hypermap1_of_fanx (x:real^3,V,E))` +THEN REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x'':real^3#real^3#real^3#real^3`;`f1:real^3#real^3#real^3#real^3`][face] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC`ds0 IN face_set (hypermap1_of_fanx (x,V:real^3->bool,E)) DELETE ds` +THEN REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN SET_TAC[]]; + + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT5[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`w':real^3`]; + + +SUBGOAL_THEN`f3=y:real^3#real^3#real^3#real^3` +ASSUME_TAC +THENL[ + MP_TAC(SET_RULE`y IN ds0 /\ ds0 SUBSET d1_fan (x,V,E)==> y IN d1_fan (x,V:real^3->bool,E)`) +THEN RESA_TAC +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f3:real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`;][pr2;pr3] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]; + +MP_TAC(SET_RULE`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3 +==> f1_fan x V E f2= f1_fan x V E (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN REWRITE_TAC[]) +THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[th;f1_fan]) +THEN FIND_ASSUM (fun th-> REWRITE_TAC[SYM th])`(x,u,w,(v:real^3)) = f30:real^3#real^3#real^3#real^3` +THEN REWRITE_TAC[]]; + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN REMOVE_THEN "LINH" MP_TAC +THEN REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN RESA_TAC +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x'':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN FIND_ASSUM MP_TAC`ds IN face_set (hypermap1_of_fanx (x:real^3,V,E))` +THEN REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x'':real^3#real^3#real^3#real^3`;`f3:real^3#real^3#real^3#real^3`][face] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC`ds0 IN face_set (hypermap1_of_fanx (x,V:real^3->bool,E)) DELETE ds` +THEN REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN SET_TAC[]]]]);; + + + + +let eventally_measurable_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 f. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ f IN face_set (hypermap1_of_fanx (x,V,E)) + ==> let U = dartset_leads_into_fan x V E f in + ((!r. measurable (ball (x,r) INTER U)) /\ + eventually_radial x U) `, + + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[conforming_fan;conforming_solid_angle_fan;] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN STRIP_TAC +THENL(*1*)[ +DISJ_CASES_TAC(SET_RULE`~(ds=f)\/ (f=ds:real^3#real^3#real^3#real^3->bool)`) +THENL(*2*)[ +MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(f:real^3#real^3#real^3#real^3->bool)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_fan_eq_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(f:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN"LINH"(fun th-> MRESA1_TAC th` tranf x (V:real^3->bool)( E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool)`);(*2*) + +MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}:real^3->bool`] +THEN REWRITE_TAC[SET_RULE`A INTER (B UNION C UNION D)=(A INTER B) UNION (A INTER C) UNION (A INTER D)`] +THEN MATCH_MP_TAC MEASURABLE_UNION +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN REMOVE_THEN"LINH"(fun th-> MRESA1_TAC th` (ds1:real^3#real^3#real^3#real^3->bool)` THEN MRESA1_TAC th` (ds2:real^3#real^3#real^3#real^3->bool)`) +THEN MATCH_MP_TAC MEASURABLE_UNION +THEN ASM_REWRITE_TAC[MEASURABLE_BALL_AFF_GT]];(*1*) + + +DISJ_CASES_TAC(SET_RULE`~(ds=f)\/ (f=ds:real^3#real^3#real^3#real^3->bool)`) +THENL(*2*)[ +MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(f:real^3#real^3#real^3#real^3->bool)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_fan_eq_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(f:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN"LINH"(fun th-> MRESA1_TAC th` tranf x (V:real^3->bool)( E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool)`);(*2*) + +MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}:real^3->bool`] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN REMOVE_THEN"LINH"(fun th-> MRESA1_TAC th` (ds1:real^3#real^3#real^3#real^3->bool)` THEN MRESA1_TAC th` (ds2:real^3#real^3#real^3#real^3->bool)`) +THEN ASM_TAC +THEN REWRITE_TAC[SET_RULE`A INTER (B UNION C UNION D)=(A INTER B) UNION (A INTER C) UNION (A INTER D)`;eventually_radial;radial;ball_eq_normball;] +THEN REPEAT STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN STRIP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH2") +THEN EXISTS_TAC`min r (r':real)` +THEN MP_TAC(REAL_ARITH`r> &0 /\ r' > &0==> min r (r':real)> &0 /\ &0< min r (r':real)/\ min r r' <= r /\ min r r' <= r'`) +THEN RESA_TAC +THEN MRESA_TAC NORMBALL_SUBSET[`x:real^3`;`min r r':real`;`r:real`] +THEN MRESA_TAC NORMBALL_SUBSET[`x:real^3`;`min r r':real`;`r':real`] +THEN REWRITE_TAC[SET_RULE`A INTER B SUBSET B`;SET_RULE`(B UNION C UNION D) INTER A=(B INTER A) UNION (C INTER A) UNION (D INTER A)`] +THEN REWRITE_TAC[UNION;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`t * norm u' < min r r'==> t * norm u' < r' /\ t * norm (u':real^3) < r`) +THEN RESA_TAC +THENL[ + +MRESAL_TAC RADIAL_NORM_CO[`r:real`;`min r r':real`;`x:real^3`;`dartset_leads_into_fan x V E1 (ds1:real^3#real^3#real^3#real^3->bool)`][radial_norm] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u':real^3`) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`t:real`);(**) + +MRESAL_TAC RADIAL_NORM_CO[`r':real`;`min r r':real`;`x:real^3`;`dartset_leads_into_fan x V E1 (ds2:real^3#real^3#real^3#real^3->bool)`][radial_norm;SET_RULE`A INTER B SUBSET B`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u':real^3`) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`t:real`); + + +MP_TAC(SET_RULE`E UNION {{v,w}}=E1==> {v,w:real^3} IN E1`) THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E1:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`] +THEN MRESAL_TAC RADIAL_AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`;`min r r':real`;][radial_norm] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u':real^3`) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`t:real`)]]]);; + + + +let SOL_AFF_GT_2_1=prove(`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u}==> sol x (aff_gt {x} {v,u})= &0`, +REPEAT STRIP_TAC +THEN MRESA_TAC MEASURABLE_AFF_GT_2_1_INTER_BALL[`x:real^3`;`v:real^3`;`u:real^3`;`&1:real`] +THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]th3) THEN RESA_TAC +THEN MRESAL_TAC RADIAL_AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`;`&1:real`;][REAL_ARITH`&1> &0`] +THEN MRESAL_TAC sol[`x:real^3`;`aff_gt {x} {v,u}:real^3->bool`;`&1`][REAL_ARITH`&1> &0`;SET_RULE`{} INTER normball x (&1)={}`; MEASURABLE_AFF_GT_2_1_INTER_BALL] +THEN MRESA_TAC MEASURE_AFF_GT_2_1_INTER_BALL[`x:real^3`;`v:real^3`;`u:real^3`;`&1:real`] +THEN REAL_ARITH_TAC);; + + + +let inverse1_sigma_fan_FANADD1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> inverse1_sigma_fan x V E1 v (sigma_fan x V E v u) = w`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MATCH_MP_TAC MONO_SIGMA_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E1:(real^3->bool)->bool` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (sigma_fan x V E v u:real^3)`; +`v:real^3`] +THEN MP_TAC(SET_RULE`{v, sigma_fan x V E v u:real^3} IN E /\ E UNION {{v,w}}= E1 +==> {v, sigma_fan x V E v u} IN E1/\ {v,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `sigma_fan x V E v u:real^3`) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `sigma_fan x V E v u:real^3`) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (E1:(real^3->bool)->bool)` +;`v:real^3`;`u:real^3`; `w:real^3`]);; + + + +let inverse1_sigma_fan_FANADD2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> inverse1_sigma_fan x V E1 v w=u`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MATCH_MP_TAC MONO_SIGMA_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E1:(real^3->bool)->bool` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`{v, u:real^3} IN E /\ E UNION {{v,w}}= E1 +==> {v, u} IN E1/\ {v,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (E1:(real^3->bool)->bool)` +;`v:real^3`;`u:real^3`; `w:real^3`]);; + + + +let inverse1_sigma_fan_FANADD3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> inverse1_sigma_fan x V E1 u v=w`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MATCH_MP_TAC MONO_SIGMA_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E1:(real^3->bool)->bool` +THEN EXISTS_TAC`u:real^3` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`{v, u:real^3} IN E /\ { u:real^3,w} IN E /\ E UNION {{v,w}}= E1 +==> {u,w} IN E1/\ {v,w} IN E1/\ {v,u} IN E1 `) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`) +THEN RESA_TAC +THEN RESA_TAC);; + + + + + +let DS1_DS2_EQ_DS_FANADD1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ed1 ed2. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1=face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2=face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ed1=(x,v,w,sigma_fan x V E1 v w) +/\ ed2=(x,w,v,sigma_fan x V E1 w v) +==> (ds1 UNION ds2) DELETE ed1 DELETE ed2 SUBSET IMAGE (tran x V E1) ds`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] + +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN REWRITE_TAC[face;IN_ELIM_THM] +THEN SUBGOAL_THEN`x,v,w,sigma_fan x V E1 v w IN ds1:real^3#real^3#real^3#real^3->bool`ASSUME_TAC +THENL(*1*)[ + +ASM_REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF];(*1*) + +MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(ARITH_RULE`3<= CARD (ds1:real^3#real^3#real^3#real^3->bool) ==> ~(CARD ds1=0)`) +THEN RESA_TAC +THEN MRESA_TAC lemma_face_cycle[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E1)`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`] +THEN MRESA_TAC orbit_cyclic[`(res (f1_fan x V E1) (d1_fan (x:real^3,V,E1)))`;`(CARD (ds1:real^3#real^3#real^3#real^3->bool)):num`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`] +THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(ARITH_RULE`3<= CARD (ds2:real^3#real^3#real^3#real^3->bool) ==> ~(CARD ds2=0)`) +THEN RESA_TAC +THEN MRESA_TAC lemma_face_cycle[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E1)`;`(x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3`] +THEN MRESA_TAC orbit_cyclic[`(res (f1_fan x V E1) (d1_fan (x:real^3,V,E1)))`;`(CARD (ds2:real^3#real^3#real^3#real^3->bool)):num`;`(x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3`] +THEN MP_TAC(SET_RULE`x,v,w,sigma_fan x V E1 v w IN ds1 /\ ds1 SUBSET d1_fan (x:real^3,V,E1)==> x,v,w,sigma_fan x V E1 v w IN d1_fan (x,V,E1)`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`ds IN face_set(hypermap1_of_fanx (x,V:real^3->bool,E))` +THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] +THEN RESA_TAC +THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x':real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) +THEN RESA_TAC +THEN REWRITE_TAC[orbit_map;IMAGE;IN_ELIM_THM;UNION;DELETE;SUBSET] +THEN GEN_TAC +THEN REPEAT STRIP_TAC +THENL(*1*)[ + +EXISTS_TAC`(res (f1_fan x V E) (d1_fan (x,V,E)) POWER k) + f2:real^3#real^3#real^3#real^3` +THEN STRIP_TAC +THENL(*2*)[ + +EXISTS_TAC`k:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`k:num>=0`];(*2*) + +MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`f2:real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3` ) +THEN DISJ_CASES_TAC(ARITH_RULE`k=0 \/ k>0`) +THENL(*3*)[ + +POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th;POWER;I_DEF]) +THEN SET_TAC[];(*3*) + + SUBGOAL_THEN`?m. k= SUC m`ASSUME_TAC +THENL(*4*)[ +EXISTS_TAC`k-1:num` +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC;(*4*) + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN REWRITE_TAC[POWER;o_DEF;] +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL(*5*)[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*5*) + +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[f1_fan] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN SUBGOAL_THEN`(x,w,inverse1_sigma_fan x V E w u,v) = + tran x (V:real^3->bool) E1 + (x,w,inverse1_sigma_fan x V E w u,u:real^3)` +ASSUME_TAC +THENL(*6*)[ +REWRITE_TAC[tran] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC;(*6*) + +POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN ONCE_REWRITE_TAC[SET_RULE`x=y <=> y=x`] +THEN ABBREV_TAC`y=(x,w,inverse1_sigma_fan x V E w u,u:real^3)` +THEN SUBGOAL_THEN`y IN d1_fan (x,V:real^3->bool,E)` ASSUME_TAC +THENL(*7*)[ + +POP_ASSUM(fun th-> REWRITE_TAC[SYM th; d1_fan;IN_ELIM_THM]) +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`inverse1_sigma_fan x V E w u:real^3` +THEN EXISTS_TAC`u:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC;(*7*) + + +MRESAL_TAC TRAN_COMMUTATIVE_F1_FAN_POWER3 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`;`m:num`][f1_fan;] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[GSYM f1_fan] +THEN ABBREV_TAC`y1=(x,sigma_fan x V E v u,v:real^3,sigma_fan x V E (sigma_fan x V E v u) v)` +THEN SUBGOAL_THEN`!m'. m' < m ==> (!k. k <= m'==> ~((f1_fan (x:real^3) V E POWER k) y=y1) /\ ~((f1_fan (x:real^3) V E POWER k) y=f2))` ASSUME_TAC +THENL(*8*)[ + + +INDUCT_TAC +THENL(*9*)[ + +STRIP_TAC +THEN GEN_TAC +THEN REWRITE_TAC[ARITH_RULE`k<=0 <=> k=0`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[POWER;I_DEF] +THEN EXPAND_TAC"y" +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[EQ_PAIR_4] +THEN REPEAT STRIP_TAC +THENL(*10*)[ + +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> ASSUME_TAC (SYM th)) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*10*) + +FIND_ASSUM MP_TAC`pr2 f2=u:real^3` +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`u:real^3`]](*10*);(*9*) + + + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN STRIP_TAC +THEN GEN_TAC +THEN MP_TAC(ARITH_RULE`SUC m' < m ==> m' < m:num`) +THEN RESA_TAC +THEN REWRITE_TAC[ARITH_RULE`k <= SUC m'<=> k <= m' \/ k = SUC m'`] +THEN STRIP_TAC +THENL(*10*)[ + +REMOVE_THEN "A" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`k':num`);(*10*) + +REMOVE_THEN "A" MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`k<= m' <=> k < SUC m'`] +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN SUBGOAL_THEN `y1 IN d1_fan(x,V:real^3->bool,E)`ASSUME_TAC +THENL(*11*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E (sigma_fan x V E v u) v:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (sigma_fan x V E v u:real^3)`; +`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*11*) + + +SUBGOAL_THEN`!k. k < SUC m' + ==> (~(pr2 ((f1_fan x V E POWER k) y) = sigma_fan x V E v u) /\ + pr3 ((f1_fan x V E POWER k) y) = v) \/ + (~(pr2 ((f1_fan x V E POWER k) y) = u) /\ + pr3 ((f1_fan x V E POWER k) y) = w) \/ +~(pr3 ((f1_fan x V E POWER k) y) IN {v, w})` ASSUME_TAC +THENL(*12*)[ + + +REPEAT STRIP_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th`k'':num`) +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k'':num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`((y:real^3#real^3#real^3#real^3))`) +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER k'') y):real^3#real^3#real^3#real^3`;`y1:real^3#real^3#real^3#real^3`][PAIR_EQ] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[pr2;pr3] +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER k'') y):real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`][PAIR_EQ;pr2;pr3] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*12*) + +MRESA_TAC TRAN_COMMUTATIVE_F1_FAN_POWER3 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`;`SUC m':num`] +THEN SUBGOAL_THEN`~(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) ((f1_fan x V E POWER SUC m') y) = tran x V E1 (y1:real^3#real^3#real^3#real^3)) /\ + ~(tran x V E1((f1_fan x V E POWER SUC m') y) = tran x V E1 (f2:real^3#real^3#real^3#real^3))`ASSUME_TAC +THENL(*13*)[ + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`tran x (V:real^3->bool) (E1:(real^3->bool)->bool) (y:real^3#real^3#real^3#real^3)= f1_fan x V E1(f1_fan x V E1 (tran x (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3))) ` +ASSUME_TAC +THENL(*14*)[ + +EXPAND_TAC"y" +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[tran;f1_fan] +THEN MRESA_TAC inverse1_sigma_fan_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT6[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ;`inverse1_sigma_fan x V E w u:real^3`];(*14*) + + + +ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THENL(*15*)[ +POP_ASSUM MP_TAC +THEN REWRITE_TAC[POWER;o_DEF] +THEN STRIP_TAC +THEN MRESAL_TAC card_orbit_le[`f1_fan (x:real^3) V (E1:(real^3->bool)->bool)`;`SUC(SUC(SUC m'))`;`(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3))`][ARITH_RULE`~(SUC (SUC (SUC m')) = 0)`;POWER;o_DEF] +THEN MP_TAC(ARITH_RULE`SUC m':num < m /\ SUC m=k /\ k< CARD (ds1:real^3#real^3#real^3#real^3->bool) +==> SUC(SUC (SUC m'))< CARD ds1`) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`k= SUC m:num` +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`(x,v,w,sigma_fan x V E1 v w)= (f1_fan x V E1 (tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3))) ` +ASSUME_TAC +THENL(*16*)[ +EXPAND_TAC"y1" +THEN REWRITE_TAC[tran;f1_fan] +THEN MRESA_TAC inverse1_sigma_fan_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ];(*16*) + +SUBGOAL_THEN`tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3) IN d1_fan (x:real^3,V,E1)` +ASSUME_TAC +THENL(*17*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM;tran] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 (sigma_fan x V E v u) v:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (sigma_fan x V E v u:real^3)`; +`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN EXPAND_TAC"y1" +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`{v:real^3, sigma_fan x V E v u} IN E /\ E UNION {{v, w}} = E1 ==> {v, sigma_fan x V E v u} IN E1`) +THEN ASM_REWRITE_TAC[];(*17*) + + +MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`;`tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3):real^3#real^3#real^3#real^3`;] + +THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E1)`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`;`(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[face] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC(SYM th)) +THEN STRIP_TAC THEN STRIP_TAC THEN STRIP_TAC +THEN ASM_REWRITE_TAC[orbit_map] +THEN STRIP_TAC +THEN SUBGOAL_THEN`{(f1_fan x V E1 POWER n) (tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3)) | n >= 0}=ds1` +ASSUME_TAC +THENL(*18*)[ + +ASM_REWRITE_TAC[] +THEN REWRITE_TAC[face;orbit_map] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL(*19*)[ + +REPEAT STRIP_TAC +THEN EXISTS_TAC`(n:num)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3`);(*19*) +REPEAT STRIP_TAC +THEN EXISTS_TAC`(n:num)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3`)](*19*);(*18*) + + + +POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[face;orbit_map] +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC](*18*)](*17*)](*16*);(*15*) + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN SUBGOAL_THEN`tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y:real^3#real^3#real^3#real^3) IN d1_fan (x:real^3,V,E1)` +ASSUME_TAC +THENL(*16*)[ +EXPAND_TAC "y" +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM;tran] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`inverse1_sigma_fan x V E w u:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 w (inverse1_sigma_fan x V E w u):real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{inverse1_sigma_fan x V E w u, w:real^3} IN E /\ E UNION {{v,w}}= E1 +==> {inverse1_sigma_fan x V E w u, w} IN E1`) +THEN RESA_TAC;(*16*) + +MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] + +THEN MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`SUC m'`; `x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`;`(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (f2:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3`;` (tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3`;] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL(*17*)[ + +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*17*) +REWRITE_TAC[tran] +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"y" +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`) +THEN RESA_TAC +THEN RESA_TAC +THEN REWRITE_TAC[SET_RULE`f30 IN {f10, f20, f30}`] +THEN REWRITE_TAC[SET_RULE`y IN {f10, f20, f30:real^3#real^3#real^3#real^3}<=> y =f10\/ y =f20\/ y =f30`] +THEN RESA_TAC +THENL(*18*)[ + +POP_ASSUM MP_TAC +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;EQ_PAIR_4])`x,w,v,u = f10:real^3#real^3#real^3#real^3` +THEN STRIP_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th -> MP_TAC(ISPEC `u:real^3` th)) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*18*) + +POP_ASSUM MP_TAC +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;EQ_PAIR_4])`x,v,u,w = f20:real^3#real^3#real^3#real^3` +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`];(*18*) + +POP_ASSUM MP_TAC +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;EQ_PAIR_4])`x,u,w,v = f30:real^3#real^3#real^3#real^3` +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[]](*18*)](*17*)](*16*)](*15*)](*14*);(*13*) + + +POP_ASSUM MP_TAC +THEN SET_TAC[]](*13*)](*12*)](*11*)](*10*)](*9*);(*8*) + + +SUBGOAL_THEN`!k. k < m==> ~((f1_fan (x:real^3) V E POWER k) y=y1) /\ ~((f1_fan (x:real^3) V E POWER k) y=f2)` ASSUME_TAC +THENL(*9*)[ + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN GEN_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`m=0 \/ m>0`) +THENL(*10*)[ +ASM_REWRITE_TAC[] +THEN ARITH_TAC;(*10*) +MP_TAC(ARITH_RULE`m>0==> m-1< m`) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`k' k'<= m-1`) +THEN RESA_TAC +THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th`m-1:num`) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`k':num`)](*10*);(*9*) + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th`m':num`) +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`m':num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`((y:real^3#real^3#real^3#real^3))`) +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`y1:real^3#real^3#real^3#real^3`][PAIR_EQ] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[pr2;pr3] + +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`][PAIR_EQ;pr2;pr3] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN `y1 IN d1_fan(x,V:real^3->bool,E)`ASSUME_TAC +THENL(*10*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E (sigma_fan x V E v u) v:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (sigma_fan x V E v u:real^3)`; +`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*10*) + +ASM_REWRITE_TAC[] +THEN SET_TAC[]](*10*)](*9*)](*8*)]]]]]];(*1*) + + + +ASM_REWRITE_TAC[] +THEN MRESA_TAC card_ds2_fanadd_eq3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[face;] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL(*2*)[ + +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*2*) + +SUBGOAL_THEN`x,w,v,sigma_fan x V E1 w v IN d1_fan (x,V:real^3->bool,E1):real^3#real^3#real^3#real^3->bool`ASSUME_TAC +THENL(*3*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 w v:real^3` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_TAC +THEN SET_TAC[];(*3*) + +MP_TAC(ARITH_RULE`k<3==> k=0 \/ k= SUC 0\/ k = SUC(SUC 0)`) +THEN RESA_TAC +THENL(*4*)[ +POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th;POWER;I_DEF]) +THEN SET_TAC[];(*4*) + + +ASM_REWRITE_TAC[POWER;I_DEF;o_DEF] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`[POWER;I_DEF;o_DEF;f1_fan]) +THEN MRESA_TAC inverse1_sigma_fan_FANADD2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN EXISTS_TAC`(x,v,u,sigma_fan x V E v u:real^3)` +THEN ASM_REWRITE_TAC[tran] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (E1:(real^3->bool)->bool)` +;`v:real^3`;`u:real^3`; `w:real^3`] +THEN SUBGOAL_THEN`f1=(x,v,u,sigma_fan x V E v u:real^3)`ASSUME_TAC +THENL(*5*)[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[PAIR_EQ] +THEN ASM_REWRITE_TAC[pr2;pr3] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN ASM_REWRITE_TAC[];(*5*) + +FIND_ASSUM(MP_TAC)`f1 IN ds:real^3#real^3#real^3#real^3->bool` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[orbit_map;IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`n:num` +THEN ASM_REWRITE_TAC[f1_fan]](*5*);(*4*) + + + MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`[POWER;I_DEF;o_DEF;f1_fan]) +THEN MRESA_TAC inverse1_sigma_fan_FANADD2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC inverse1_sigma_fan_FANADD3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN EXISTS_TAC`(x:real^3,u:real^3,w:real^3,v:real^3)` +THEN REWRITE_TAC[tran] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`) +THEN RESA_TAC +THEN RESA_TAC +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF] +THEN MRESA_TAC f2_EQ_F30_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +]]]]]);; + + + + + +let DS1_DS2_EQ_DS_FANADD2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ed1 ed2. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1=face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2=face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ed1=(x,v,w,sigma_fan x V E1 v w) +/\ ed2=(x,w,v,sigma_fan x V E1 w v) +==> IMAGE (tran x V E1) ds SUBSET (ds1 UNION ds2) DELETE ed1 DELETE ed2 `, + + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] + +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN REWRITE_TAC[face;IN_ELIM_THM] +THEN SUBGOAL_THEN`x,v,w,sigma_fan x V E1 v w IN ds1:real^3#real^3#real^3#real^3->bool`ASSUME_TAC +THENL(*1*)[ +ASM_REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF];(*1*) + +SUBGOAL_THEN`x,w,v,sigma_fan x V E1 w v IN d1_fan (x,V:real^3->bool,E1):real^3#real^3#real^3#real^3->bool`ASSUME_TAC +THENL(*2*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 w v:real^3` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_TAC +THEN SET_TAC[];(*2*) + +MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(ARITH_RULE`3<= CARD (ds:real^3#real^3#real^3#real^3->bool) ==> ~(CARD ds=0)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`x,v,w,sigma_fan x V E1 v w IN ds1 /\ ds1 SUBSET d1_fan (x:real^3,V,E1)==> x,v,w,sigma_fan x V E1 v w IN d1_fan (x,V,E1)`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`ds IN face_set(hypermap1_of_fanx (x,V:real^3->bool,E))` +THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] +THEN RESA_TAC +THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x':real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) +THEN RESA_TAC +THEN MRESAL_TAC lemma_face_cycle[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`f2:real^3#real^3#real^3#real^3`][face] +THEN MRESA_TAC orbit_cyclic[`(res (f1_fan x V E) (d1_fan (x:real^3,V,E)))`;`(CARD (ds:real^3#real^3#real^3#real^3->bool)):num`;`f2:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[orbit_map;IMAGE;IN_ELIM_THM;UNION;DELETE;SUBSET] +THEN GEN_TAC +THEN REPEAT STRIP_TAC +THENL(*32GOAL*)[ + +DISJ_CASES_TAC(ARITH_RULE`k=0\/ k>0`) +THENL(*4*)[ +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;POWER;I_DEF] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN SUBGOAL_THEN(`(?n. n >= 0 /\ + tran x V E1 (f2:real^3#real^3#real^3#real^3) = + (res (f1_fan x V E1) (d1_fan (x,V,E1)) POWER n) + (x,w,v,sigma_fan x V E1 w v:real^3))`) +ASSUME_TAC +THENL(*5*)[ + +EXISTS_TAC`SUC(SUC 0:num)` +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(SUC 0)>=0`] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`SUC(SUC 0):num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`[POWER;I_DEF;o_DEF;f1_fan]) +THEN MRESA_TAC inverse1_sigma_fan_FANADD2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC inverse1_sigma_fan_FANADD3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL(*6*)[ + +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*6*) + +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[tran] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`) +THEN RESA_TAC +THEN RESA_TAC](*6*);(*5*) + +ASM_REWRITE_TAC[]](*5*);(*4*) + + +MP_TAC(ARITH_RULE`k< CARD ds /\ 3<= CARD (ds:real^3#real^3#real^3#real^3->bool) ==> SUC k = CARD ds \/ SUC k < CARD ds`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[orbit_map] +THEN RESA_TAC +THENL(*5*)[ + + + MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`CARD (ds:real^3#real^3#real^3#real^3->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)`) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)`) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REWRITE_TAC[orbit_map] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;COM_POWER;o_DEF]) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC (SYM th)) +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)`) +THEN MRESA_TAC MONO_F1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[` (f1:real^3#real^3#real^3#real^3)`;` (x''':real^3#real^3#real^3#real^3)`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`(?n. n >= 0 /\ + tran x V E1 (f1:real^3#real^3#real^3#real^3) = + (res (f1_fan x V E1) (d1_fan (x,V,E1)) POWER n) + (x,w,v:real^3,sigma_fan x V E1 w v))` +ASSUME_TAC +THENL(*6*)[ +EXISTS_TAC`SUC(0:num)` +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(0)>=0`] +THEN ASM_REWRITE_TAC[POWER;I_DEF;o_DEF] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`SUC 0:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`[POWER;I_DEF;o_DEF;f1_fan]) +THEN MRESA_TAC inverse1_sigma_fan_FANADD2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN ASM_REWRITE_TAC[tran] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (E1:(real^3->bool)->bool)` +;`v:real^3`;`u:real^3`; `w:real^3`] +THEN SUBGOAL_THEN`f1=(x,v,u,sigma_fan x V E v u:real^3)`ASSUME_TAC +THENL(*7*)[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[PAIR_EQ] +THEN ASM_REWRITE_TAC[pr2;pr3] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN ASM_REWRITE_TAC[];(*7*) + +FIND_ASSUM(MP_TAC)`f1 IN ds:real^3#real^3#real^3#real^3->bool` +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[th])](*7*);(*6*) + + +ASM_REWRITE_TAC[]](*6*);(*5*) + + +MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`f2:real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3` ) +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`?m. k= SUC m`ASSUME_TAC +THENL(*6*)[ + +EXISTS_TAC`k-1:num` +THEN FIND_ASSUM MP_TAC`k:num>0` +THEN ARITH_TAC;(*6*) + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN RESA_TAC +THEN ASM_REWRITE_TAC[POWER;o_DEF;] +THEN SUBGOAL_THEN`(?n. n >= 0 /\ + tran x V E1 ((f1_fan x V E POWER m) f3) = + (res (f1_fan x V E1) (d1_fan (x,V,E1)) POWER n) + (x,v,w,sigma_fan x V E1 v w:real^3))`ASSUME_TAC +THENL(*7*)[ + +EXISTS_TAC`SUC m:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC m>=0`;POWER;o_DEF;f1_fan] +THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN SUBGOAL_THEN`(x,w,inverse1_sigma_fan x V E w u,v) = + tran x (V:real^3->bool) E1 + (x,w,inverse1_sigma_fan x V E w u,u:real^3)` +ASSUME_TAC +THENL(*8*)[ + +REWRITE_TAC[tran] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC;(*8*) +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN SUBGOAL_THEN`(x,w,inverse1_sigma_fan x V E w u,u:real^3)= f1_fan x V E f2` +ASSUME_TAC +THENL(*9*)[ + + SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL(*10*)[ + +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*10*) +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[f1_fan] +THEN ASM_REWRITE_TAC[]](*10*);(*9*) + + +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`f1_fan (x:real^3) V E f2 = f3` +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[] +THEN ABBREV_TAC`y=(x,w,inverse1_sigma_fan x V E w u,u:real^3)` +THEN SUBGOAL_THEN`y IN d1_fan (x,V:real^3->bool,E)` ASSUME_TAC +THENL(*10*)[ + +POP_ASSUM(fun th-> REWRITE_TAC[SYM th; d1_fan;IN_ELIM_THM]) +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`inverse1_sigma_fan x V E w u:real^3` +THEN EXISTS_TAC`u:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC;(*10*) + +MRESAL_TAC TRAN_COMMUTATIVE_F1_FAN_POWER3 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`;`m:num`][f1_fan;] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[GSYM f1_fan] +THEN ABBREV_TAC`y1=(x,sigma_fan x V E v u,v:real^3,sigma_fan x V E (sigma_fan x V E v u) v)` +THEN SUBGOAL_THEN`!m'. m' < m ==> ~((f1_fan (x:real^3) V E POWER m') y=y1) /\ ~((f1_fan (x:real^3) V E POWER m') y=f2)` ASSUME_TAC + +THENL(*11*)[ + +STRIP_TAC +THEN SUBGOAL_THEN`y= f1_fan x V E(f1_fan x V E(f1_fan (x:real^3) V E y1))` ASSUME_TAC +THENL(*12*)[ + +EXPAND_TAC "y" +THEN EXPAND_TAC "y1" +THEN REWRITE_TAC[f1_fan] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`);(*12*) + +SUBGOAL_THEN`(f1_fan (x:real^3) V E POWER SUC (SUC 0)) y1 = f2`ASSUME_TAC +THENL(*13*)[ + +EXPAND_TAC "y1" +THEN REWRITE_TAC[f1_fan;POWER;I_DEF;o_DEF] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`) +THEN MRESA_TAC f2_EQ_F30_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;];(*13*) + +ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THENL(*14*)[ + +MRESAL_TAC card_orbit_le[`f1_fan (x:real^3) V (E:(real^3->bool)->bool)`;`SUC(SUC(SUC m'))`;` (y1:real^3#real^3#real^3#real^3)`][ARITH_RULE`~(SUC (SUC (SUC m')) = 0)`;POWER;o_DEF] +THEN MP_TAC(ARITH_RULE`m':num < m /\ SUC m=k /\ SUC k< CARD (ds:real^3#real^3#real^3#real^3->bool) +==> SUC(SUC (SUC m'))< CARD ds`) +THEN ASM_REWRITE_TAC[orbit_map] +THEN FIND_ASSUM (fun th -> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)`k= SUC m:num` +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN `y1 IN d1_fan(x,V:real^3->bool,E)`ASSUME_TAC +THENL(*15*)[ +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E (sigma_fan x V E v u) v:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (sigma_fan x V E v u:real^3)`; +`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*15*) + +MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`SUC (SUC 0)`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f2:real^3#real^3#real^3#real^3`;`(y1:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`f2:real^3#real^3#real^3#real^3`;` (y1:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[orbit_map] +THEN RESA_TAC +THEN SUBGOAL_THEN`{(f1_fan x V E POWER n) ((y1:real^3#real^3#real^3#real^3)) | n >= 0}={(res (f1_fan x V E) (d1_fan (x,V,E)) POWER n) y1 | n >= 0}` +ASSUME_TAC +THENL(*16*)[ + REWRITE_TAC[EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL(*17*)[ +REPEAT STRIP_TAC +THEN EXISTS_TAC`(n:num)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y1:real^3#real^3#real^3#real^3)`);(*17*) + +REPEAT STRIP_TAC +THEN EXISTS_TAC`(n:num)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y1:real^3#real^3#real^3#real^3)`)](*17*);(*16*) + +ASM_REWRITE_TAC[] +THEN ARITH_TAC](*16*)](*15*);(*14*) + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[POWER;o_DEF;I_DEF] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC card_orbit_le[`f1_fan (x:real^3) V (E:(real^3->bool)->bool)`;`(SUC m')`;` (f2:real^3#real^3#real^3#real^3)`][ARITH_RULE`~( (SUC m')= 0)`;POWER;o_DEF] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[orbit_map] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`m':num < m /\ SUC m=k /\ SUC k< CARD (ds:real^3#real^3#real^3#real^3->bool) +==> (SUC m')< CARD ds`) +THEN ASM_REWRITE_TAC[orbit_map] +THEN FIND_ASSUM (fun th -> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)`k= SUC m:num` +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`{(f1_fan x V E POWER n) ((f2:real^3#real^3#real^3#real^3)) | n >= 0}={(res (f1_fan x V E) (d1_fan (x,V,E)) POWER n) f2 | n >= 0}` +ASSUME_TAC +THENL(*15*)[ + + REWRITE_TAC[EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL(*16*)[ +REPEAT STRIP_TAC +THEN EXISTS_TAC`(n:num)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)`);(*16*) + +REPEAT STRIP_TAC +THEN EXISTS_TAC`(n:num)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)`)](*16*);(*15*) + +ASM_REWRITE_TAC[] +THEN ARITH_TAC](*15*)](*14*)](*13*)](*12*);(*11*) + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th`m':num`) +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`m':num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`((y:real^3#real^3#real^3#real^3))`) +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`y1:real^3#real^3#real^3#real^3`][PAIR_EQ] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[pr2;pr3] +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`][PAIR_EQ;pr2;pr3] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN `y1 IN d1_fan(x,V:real^3->bool,E)`ASSUME_TAC +THENL(*12*)[ +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E (sigma_fan x V E v u) v:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (sigma_fan x V E v u:real^3)`; +`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*12*) + +ASM_REWRITE_TAC[] +THEN SET_TAC[]](*12*)](*11*)](*10*)](*9*)](*8*);(*7*) + +ASM_REWRITE_TAC[]](*7*)](*6*)](*5*)](*4*);(*3*) + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)`) +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`f2:real^3#real^3#real^3#real^3`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[tran] +THEN RESA_TAC +THEN REWRITE_TAC[EQ_PAIR_4] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*3*) + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)`) +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`f2:real^3#real^3#real^3#real^3`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[tran] +THEN RESA_TAC +THEN REWRITE_TAC[EQ_PAIR_4] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[]]]]);; + + + + +let DS1_DS2_EQ_DS_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ed1 ed2. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1=face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2=face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ed1=(x,v,w,sigma_fan x V E1 v w) +/\ ed2=(x,w,v,sigma_fan x V E1 w v) +==> IMAGE (tran x V E1) ds = (ds1 UNION ds2) DELETE ed1 DELETE ed2 `, +REPEAT STRIP_TAC +THEN MRESA_TAC DS1_DS2_EQ_DS_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(ed1:real^3#real^3#real^3#real^3)`;`(ed2:real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC DS1_DS2_EQ_DS_FANADD2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(ed1:real^3#real^3#real^3#real^3)`;`(ed2:real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + +let azim_fanadd_eq_ds=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ y IN ds +/\ ~(y=f1) +/\ ~(y=f3) +==> azim_fan x V E1 (pr2 (tran x V E1 y)) (pr3 (tran x V E1 y)) += azim_fan x V E (pr2 y) (pr3 y)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E) /\ y IN ds==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds /\ y IN d1_fan (x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> ASSUME_TAC(th) THEN MP_TAC th +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[tran;pr2;pr3;azim_fan] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w':real^3)`; +`(v':real^3)`] +THEN REMOVE_ASSUM_TAC +THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `v':real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E1) > 1` +THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `v':real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E) > 1` +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN RESA_TAC +THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(v' IN {v, w})\/ (v' = v /\ ~(u=w')) \/ (v' = v /\ (u=w')) \/ (v' = w /\ ~(w'=inverse1_sigma_fan x (V:real^3->bool) E w u )) \/ (v' = w /\ (w'=inverse1_sigma_fan x V E w u ))`) + +THENL[ + +MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v':real^3`;`w':real^3`]); + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL[ + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT4[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`w':real^3`]; + +SUBGOAL_THEN`(x',v',w',w1)=f1:real^3#real^3#real^3#real^3` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[pr2;pr3] +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN ASM_REWRITE_TAC[]; + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] ) +THEN SET_TAC[]]; + + + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT5[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`w':real^3`]; + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN SUBGOAL_THEN`x, + w, + inverse1_sigma_fan x V E w u, + sigma_fan x V E w (inverse1_sigma_fan x V E w u)=f1_fan x V E f2:real^3#real^3#real^3#real^3` ASSUME_TAC +THENL[ +SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL[ + +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]; +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[f1_fan] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC]; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] ) +THEN SET_TAC[]]]]);; + + + + + + + + +let TXFBALB=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> conforming_solid_angle_fan(x,V,E)`, + + + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[conforming_fan;conforming_solid_angle_fan;] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN STRIP_TAC +THEN MRESA_TAC eventally_measurable_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(f:real^3#real^3#real^3#real^3->bool)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[conforming_fan;conforming_solid_angle_fan;] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THENL(*1*)[ +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`r:real`);(*1*) + + +DISJ_CASES_TAC(SET_RULE`~(ds=f)\/ (f=ds:real^3#real^3#real^3#real^3->bool)`) +THENL(*2*)[ + +MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(f:real^3#real^3#real^3#real^3->bool)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_fan_eq_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(f:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN"LINH"(fun th-> MRESA1_TAC th` tranf x (V:real^3->bool)( E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool)`) +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN MRESAL_TAC tranf_eq_image_of_tran[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`f:real^3#real^3#real^3#real^3->bool` ][DELETE;IN_ELIM_THM] +THEN SUBGOAL_THEN` (!x' y. x' IN f /\ y IN (f:real^3#real^3#real^3#real^3->bool) /\ tran x V E1 x' = tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) y ==> x' = y)` +ASSUME_TAC +THENL(*3*)[ + +REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`x' IN f /\ y IN (f:real^3#real^3#real^3#real^3->bool) +/\ f SUBSET d1_fan (x,V,E)/\ E UNION {{v, w:real^3}} = E1 ==> E SUBSET E1/\ x' IN d1_fan (x,V,E) /\ y IN d1_fan (x,V,E) `) +THEN RESA_TAC +THEN MRESA_TAC INJ_TRAN_D1_FAN +[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(E1:(real^3->bool)->bool)`; +`x':real^3#real^3#real^3#real^3`;`(y:real^3#real^3#real^3#real^3)`];(*3*) + + +MRESA_TAC SUM_IMAGE[`(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool)):real^3#real^3#real^3#real^3 -> real^3#real^3#real^3#real^3`;`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN REWRITE_TAC[o_DEF; ] +THEN SUBGOAL_THEN `(!y. y IN f + ==> azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 (tran x V E1 y)) (pr3 (tran x V E1 y)) - + pi = + azim_fan x V E (pr2 y) (pr3 y) - pi)` +ASSUME_TAC +THENL(*4*)[ + +REPEAT STRIP_TAC +THEN MRESAL_TAC azim_fanadd_eq[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`f:real^3#real^3#real^3#real^3->bool`;`(y:real^3#real^3#real^3#real^3)` ][DELETE;IN_ELIM_THM];(*4*) + +MRESA_TAC SUM_EQ[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 (tran x V E1 y)) (pr3 (tran x V E1 y)) - pi)`;`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`f:real^3#real^3#real^3#real^3->bool`]](*4*)](*3*);(*2*) + + + + + + + + + +MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}:real^3->bool`] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN REMOVE_THEN"LINH"(fun th-> MRESAL1_TAC th` (ds1:real^3#real^3#real^3#real^3->bool)`[eventually_radial;radial;ball_eq_normball] THEN MRESAL1_TAC th` (ds2:real^3#real^3#real^3#real^3->bool)`[eventually_radial;radial;ball_eq_normball]) +THEN MP_TAC(REAL_ARITH`r> &0 /\ r' > &0==> min r (r':real)> &0 /\ &0< min r (r':real)/\ min r r' <= r /\ min r r' <= r'`) +THEN RESA_TAC +THEN MRESAL_TAC RADIAL_NORM_CO[`r:real`;`min r r':real`;`x:real^3`;`dartset_leads_into_fan x V E1 (ds1:real^3#real^3#real^3#real^3->bool)`][radial_norm] +THEN MRESAL_TAC RADIAL_NORM_CO[`r':real`;`min r r':real`;`x:real^3`;`dartset_leads_into_fan x V E1 (ds2:real^3#real^3#real^3#real^3->bool)`][radial_norm] +THEN FIND_ASSUM(fun th-> MP_TAC(ISPEC `min r r':real` th) THEN REWRITE_TAC[SET_RULE`A INTER B=B INTER A`] THEN STRIP_TAC)`!r. measurable (normball x r INTER dartset_leads_into_fan (x:real^3) V E1 ds1)` +THEN FIND_ASSUM(fun th-> MP_TAC(ISPEC `min r r':real` th) THEN REWRITE_TAC[SET_RULE`A INTER B=B INTER A`] THEN STRIP_TAC)`!r. measurable (normball x r INTER dartset_leads_into_fan (x:real^3) V E1 ds2)` +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN FIND_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[conforming_bijection_fan;EXISTS_UNIQUE] THEN STRIP_TAC )`conforming_bijection_fan (x:real^3,V,E1)` +THEN POP_ASSUM(fun th-> MRESA1_TAC th`dartset_leads_into_fan x V E1 (ds1:real^3#real^3#real^3#real^3->bool)`) + +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(ds1:real^3#real^3#real^3#real^3->bool)` +THEN MRESA1_TAC th`(ds2:real^3#real^3#real^3#real^3->bool)`) +THEN SUBGOAL_THEN`dartset_leads_into_fan x V E1 f' INTER + dartset_leads_into_fan x V E1 (ds2:real^3#real^3#real^3#real^3->bool) = + {}` +ASSUME_TAC +THENL(*4*)[ + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN REWRITE_TAC[SET_RULE`A INTER B ={} <=> ~(?z. z IN A /\ z IN B)`] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`f':real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(SYM th) THEN STRIP_TAC) +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(SYM th) THEN STRIP_TAC) +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y':real^3`;`z:real^3`] +THEN REMOVE_THEN "LINH1" MP_TAC +THEN RESA_TAC +THEN MRESA_TAC disjoint_ds1_and_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;];(*4*) + + +MRESAL_TAC SOL_DISJOINT_UNION[`x:real^3`;`dartset_leads_into_fan (x:real^3) V E1 ds1`; `dartset_leads_into_fan (x:real^3) V E1 ds2`;`min (r:real) r'`][radial_norm;DISJOINT] +THEN MRESAL_TAC MEASURABLE_UNION[`(dartset_leads_into_fan (x:real^3) V E1 ds1 INTER normball x (min r r'))`;`(dartset_leads_into_fan (x:real^3) V E1 ds2 INTER normball x (min r r'))`][SET_RULE`(A INTER C) UNION (B INTER C)=(A UNION B) INTER C`] +THEN MP_TAC(SET_RULE`E UNION {{v,w}}=E1==> {v,w:real^3} IN E1`) THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC MEASURABLE_AFF_GT_2_1_INTER_BALL[`x:real^3`;`v:real^3`;`w:real^3`;`(min r r'):real`] +THEN MRESAL_TAC RADIAL_UNION[`min r r':real`;`x:real^3`;`dartset_leads_into_fan (x:real^3) V E1 ds1 INTER normball x (min r r')`; `dartset_leads_into_fan (x:real^3) V E1 ds2 INTER normball x (min r r')`][radial_norm;SET_RULE`(A INTER C) UNION (B INTER C)=(A UNION B) INTER C`] +THEN MRESAL_TAC RADIAL_AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`;`(min r r'):real`;][REAL_ARITH`&1> &0`] +THEN MRESA_TAC AFF_GE_SUBSET_XFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE` aff_ge {x} {v, w} SUBSET xfan (x,V,E1) /\ aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w} +==> aff_gt {x:real^3} {v, w} SUBSET xfan (x,V:real^3->bool,E1)`) +THEN RESA_TAC +THEN MRESAL_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;` (f':real^3#real^3#real^3#real^3->bool)`][yfan] +THEN MRESAL_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;` (ds2:real^3#real^3#real^3#real^3->bool)`][yfan] +THEN MP_TAC(SET_RULE`aff_gt {x} {v, w} SUBSET xfan (x,V,E1)/\ +dartset_leads_into_fan x V E1 f' SUBSET (:real^3) DIFF xfan (x,V,E1)/\ +dartset_leads_into_fan x V E1 ds2 SUBSET (:real^3) DIFF xfan (x,V,E1) +==> (dartset_leads_into_fan x V E1 f' UNION + dartset_leads_into_fan x V E1 ds2) INTER + aff_gt {x} {v, w:real^3} = + {}`) +THEN RESA_TAC +THEN MRESAL_TAC SOL_DISJOINT_UNION[`x:real^3`;`dartset_leads_into_fan (x:real^3) V E1 ds1 UNION dartset_leads_into_fan (x:real^3) V E1 ds2`;`aff_gt {x} {v, w:real^3}`; `min (r:real) r'`;][radial_norm;DISJOINT; SET_RULE`(A UNION B) UNION C= A UNION B UNION C`] +THEN MRESA_TAC SOL_AFF_GT_2_1 [`x:real^3`;`v:real^3`;`w:real^3`] +THEN REWRITE_TAC[REAL_ARITH`((&2 * pi + sum f' (\y. azim_fan x V E1 (pr2 y) (pr3 y) - pi)) + + &2 * pi + + sum ds2 (\y. azim_fan x V E1 (pr2 y) (pr3 y) - pi)) + + &0= &4 * pi + (sum f' (\y. azim_fan x V E1 (pr2 y) (pr3 y) - pi) + + sum ds2 (\y. azim_fan x V E1 (pr2 y) (pr3 y) - pi)) `] +THEN MRESA_TAC FINITE_FACE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC FINITE_FACE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC disjoint_ds1_and_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN SUBGOAL_THEN`(f':real^3#real^3#real^3#real^3->bool) INTER ds2 ={}` +ASSUME_TAC +THENL(*5*)[ +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN REWRITE_TAC[SET_RULE`A INTER B ={} <=> ~(?z. z IN A /\ z IN B)`] +THEN STRIP_TAC +THEN FIND_ASSUM(fun th -> MP_TAC th THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] THEN STRIP_TAC)`f' IN face_set (hypermap1_of_fanx (x:real^3,V,E1))` +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E1)`;`x':real^3#real^3#real^3#real^3`;`z:real^3#real^3#real^3#real^3`][face] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN FIND_ASSUM(fun th -> MP_TAC th THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] THEN STRIP_TAC)`ds2 IN face_set (hypermap1_of_fanx (x:real^3,V,E1))` +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E1)`;`x'':real^3#real^3#real^3#real^3`;`z:real^3#real^3#real^3#real^3`][face] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]);(*5*) + + + + + +MRESAL_TAC SUM_UNION[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`(f':real^3#real^3#real^3#real^3->bool)`;`(ds2:real^3#real^3#real^3#real^3->bool)`;][DISJOINT] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`f' SUBSET d1_fan (x,V,E1)/\ ds2 SUBSET d1_fan (x,V,E1) +==> f' UNION ds2 SUBSET d1_fan(x:real^3,V,E1) +`) +THEN RESA_TAC +THEN MRESA_TAC finite_d1_fan[`x:real^3`;` V:real^3->bool`;` (E1:(real^3->bool)->bool)`] +THEN MRESA_TAC FINITE_SUBSET[`((f' UNION ds2 ):real^3#real^3#real^3#real^3->bool)`;`d1_fan(x:real^3,V,E1)`] +THEN SUBGOAL_THEN`x,v,w,sigma_fan x V E1 v w IN ds1` ASSUME_TAC +THENL(*6*)[ +FIND_ASSUM (fun th-> REWRITE_TAC[SYM th;face;orbit_map;IN_ELIM_THM])`face (hypermap1_of_fanx (x,V,E1)) (x,v,w:real^3,sigma_fan x V E1 v w) = ds1` +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[POWER;I_DEF;ARITH_RULE`0>=0`];(*6*) + +MP_TAC(SET_RULE`x,v,w,sigma_fan x V E1 v w IN ds1 ==> x,v,w,sigma_fan x V E1 v w IN ds1 UNION ds2`) +THEN RESA_TAC +THEN MRESAL_TAC SUM_DELETE[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`((f' UNION ds2 ):real^3#real^3#real^3#real^3->bool)`;`( (x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`;][REAL_ARITH`A=B-C<=> B=A+C`] +THEN MRESA_TAC FINITE_DELETE[`(f' UNION ds2 ):real^3#real^3#real^3#real^3->bool`;`(x,v,w,sigma_fan x V E1 v w:real^3)`] +THEN SUBGOAL_THEN`(x,w,v,sigma_fan x V E1 w v) IN + (f' UNION ds2) DELETE (x,v,w,sigma_fan x V E1 v w:real^3)`ASSUME_TAC +THENL(*7*)[ +ASM_REWRITE_TAC[DELETE;IN_ELIM_THM;EQ_PAIR_4] +THEN MATCH_MP_TAC(SET_RULE`A IN C ==> A IN B UNION C`) +THEN FIND_ASSUM (fun th-> REWRITE_TAC[SYM th;face;orbit_map;IN_ELIM_THM])`face (hypermap1_of_fanx (x,V,E1)) (x,w,v:real^3,sigma_fan x V E1 w v) = ds2` +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[POWER;I_DEF;ARITH_RULE`0>=0`];(*7*) + + + + + +MRESAL_TAC SUM_DELETE[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`((f' UNION ds2 ):real^3#real^3#real^3#real^3->bool) DELETE (x,v,w:real^3,sigma_fan x V E1 v w)`;`( (x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`;][REAL_ARITH`A=B-C<=> B=A+C`] +THEN MRESA_TAC DS1_DS2_EQ_DS_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`;`((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN` (!x' y. x' IN ds /\ y IN (ds:real^3#real^3#real^3#real^3->bool) /\ tran x V E1 x' = tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) y ==> x' = y)` +ASSUME_TAC +THENL(*8*)[ + +REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`x' IN ds /\ y IN (ds:real^3#real^3#real^3#real^3->bool) +/\ ds SUBSET d1_fan (x,V,E)/\ E UNION {{v, w:real^3}} = E1 ==> E SUBSET E1/\ x' IN d1_fan (x,V,E) /\ y IN d1_fan (x,V,E) `) +THEN RESA_TAC +THEN MRESA_TAC INJ_TRAN_D1_FAN +[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(E1:(real^3->bool)->bool)`; +`x':real^3#real^3#real^3#real^3`;`(y:real^3#real^3#real^3#real^3)`];(*8*) + + +MRESA_TAC SUM_IMAGE[`(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool)):real^3#real^3#real^3#real^3 -> real^3#real^3#real^3#real^3`;`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN REWRITE_TAC[o_DEF; ] +THEN MRESA_TAC finite_d1_fan[`x:real^3`;` V:real^3->bool`;` (E:(real^3->bool)->bool)`] +THEN MRESA_TAC FINITE_SUBSET[`(ds:real^3#real^3#real^3#real^3->bool)`;`d1_fan(x:real^3,V,E)`] +THEN MRESAL_TAC SUM_DELETE[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`(ds:real^3#real^3#real^3#real^3->bool)`;`(f1:real^3#real^3#real^3#real^3)`;][REAL_ARITH`A=B-C<=> B=A+C`] +THEN MRESA_TAC FINITE_DELETE[`(ds ):real^3#real^3#real^3#real^3->bool`;`f1:real^3#real^3#real^3#real^3`] +THEN SUBGOAL_THEN`f3 IN ds DELETE f1:real^3#real^3#real^3#real^3` ASSUME_TAC +THENL(*9*)[ +ASM_REWRITE_TAC[IN_ELIM_THM;DELETE;] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC) +THEN FIND_ASSUM MP_TAC`pr2 f3=w:real^3` +THEN FIND_ASSUM (fun th-> REWRITE_TAC[th])`pr2 f3=v:real^3` +THEN ASM_REWRITE_TAC[];(*9*) + + MRESAL_TAC SUM_DELETE[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`(ds:real^3#real^3#real^3#real^3->bool) DELETE f1`;`(f3:real^3#real^3#real^3#real^3)`;][REAL_ARITH`A=B-C<=> B=A+C`] +THEN MRESAL_TAC SUM_DELETE[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 (tran (x:real^3) V E1 y)) (pr3 (tran x V E1 y)) - pi)`;`(ds:real^3#real^3#real^3#real^3->bool)`;`(f1:real^3#real^3#real^3#real^3)`;][REAL_ARITH`A=B-C<=> B=A+C`] +THEN MRESAL_TAC SUM_DELETE[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 (tran (x:real^3) V E1 y)) (pr3 (tran x V E1 y)) - pi)`;`(ds:real^3#real^3#real^3#real^3->bool) DELETE f1`;`(f3:real^3#real^3#real^3#real^3)`;][REAL_ARITH`A=B-C<=> B=A+C`] +THEN SUBGOAL_THEN `(!y. y IN ds DELETE f1 DELETE f3 + ==> azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 (tran x V E1 y)) (pr3 (tran x V E1 y)) - + pi = + azim_fan x V E (pr2 y) (pr3 y) - pi)` +ASSUME_TAC +THENL(*10*)[ + +REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC azim_fanadd_eq_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(y:real^3#real^3#real^3#real^3)` ][DELETE;IN_ELIM_THM];(*10*) + +MRESA_TAC SUM_EQ[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 (tran x V E1 y)) (pr3 (tran x V E1 y)) - pi)`;`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`(ds:real^3#real^3#real^3#real^3->bool) DELETE f1 DELETE f3`] +THEN REWRITE_TAC[REAL_ARITH`&4 * pi + + (((sum (ds DELETE f1 DELETE f3) (\y. azim_fan x V E (pr2 y) (pr3 y) - pi) + + azim_fan x V E1 (pr2 (tran x V E1 f3)) (pr3 (tran x V E1 f3)) - pi) + + azim_fan x V E1 (pr2 (tran x V E1 f1)) (pr3 (tran x V E1 f1)) - pi) + + azim_fan x V E1 (pr2 (x,w,v,sigma_fan x V E1 w v)) + (pr3 (x,w,v,sigma_fan x V E1 w v)) - + pi) + + azim_fan x V E1 (pr2 (x,v,w,sigma_fan x V E1 v w)) + (pr3 (x,v,w,sigma_fan x V E1 v w)) - + pi = + &2 * pi + + (sum (ds DELETE f1 DELETE f3) (\y. azim_fan x V E (pr2 y) (pr3 y) - pi) + + azim_fan x V E w (pr3 f3) - pi) + + azim_fan x V E v u - pi +<=> azim_fan x V E1 (pr2 (tran x V E1 f3)) (pr3 (tran x V E1 f3)) + + azim_fan x V E1 (pr2 (tran x V E1 f1)) (pr3 (tran x V E1 f1))+ + azim_fan x V E1 (pr2 (x,w,v,sigma_fan x V E1 w v)) + (pr3 (x,w,v,sigma_fan x V E1 w v)) + + azim_fan x V E1 (pr2 (x,v,w,sigma_fan x V E1 v w)) + (pr3 (x,v,w,sigma_fan x V E1 v w)) = + azim_fan x V E w (pr3 f3) + + azim_fan x V E v u`;pr2;pr3] +THEN SUBGOAL_THEN`(x,v,u,sigma_fan x V E v u)=f1:real^3#real^3#real^3#real^3` ASSUME_TAC +THENL(*11*)[ +ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[pr2;pr3] +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN ASM_REWRITE_TAC[];(*11*) + +POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`x, + w, + inverse1_sigma_fan x V E w u, + sigma_fan x V E w (inverse1_sigma_fan x V E w u)=f1_fan x V E f2:real^3#real^3#real^3#real^3` ASSUME_TAC +THENL(*12*)[ +SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL(*13*)[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*13*) +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[f1_fan] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC](*13*);(*12*) + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;tran;azim_fan]) +THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `v:real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E1) > 1` +THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `v:real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E) > 1` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`(v:real^3) IN V` +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`; +`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `w:real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E1) > 1` +THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `w:real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E) > 1` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`(w:real^3) IN V` +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC angle_is_small_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w:real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`u:real^3`;`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E v u):real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`(sigma_fan x V E v u):real^3`] +THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w (inverse1_sigma_fan x V E w u) u +==> +azim x w v u <= azim x w (inverse1_sigma_fan x V E w u) (u:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`;`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV)[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV)[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (inverse1_sigma_fan x V E w u:real^3)`;`(w:real^3)`] +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`v:real^3`;`u:real^3`] +THEN REAL_ARITH_TAC +]]]]]]]]]]]);; + + +let TRAN_IN_TRANF=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 f y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w /\ pr3 f1 = u +/\ pr3 f2 = w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 + +/\ f IN face_set(hypermap1_of_fanx (x,V,E)) DELETE ds +/\ y IN f +==> tran x V E1 y IN tranf x V E E1 f`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC unique_tranf_fan +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +; `f:real^3#real^3#real^3#real^3->bool` +;`(face (hypermap1_of_fanx (x,V,E1)) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3->bool)` +;`(y:real^3#real^3#real^3#real^3)`;] +THEN REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[POWER;I_DEF;ARITH_RULE`0>=0`]);; + + + + +let TXFBALB_VERSION=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ~(conforming_fan (x,V,E)) +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> conforming_solid_angle_fan(x,V,E)`, +REPEAT STRIP_TAC +THEN MRESA_TAC nonconformin_fan_imp_exist_face_gt_3[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC nonconformin_fan_imp_exist_3point_in_face[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN ABBREV_TAC`v= pr2 (f1:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`u= pr2 (f2:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`w= pr2 (f3:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`E1= E UNION {{v:real^3, w:real^3}}` +THEN ABBREV_TAC`ds1= face (hypermap1_of_fanx (x,V,E1)) ((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x,V,E1)) ((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f10= ((x,w,v,u):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f20= ((x,v,u,w):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f30= ((x,u,w,v):real^3#real^3#real^3#real^3)` +THEN MRESA_TAC TXFBALB[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]);; + + + +let conforming_bijection_fanadd_verrion=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ~(conforming_fan (x,V,E)) +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> +!s. s IN topological_component_yfan (x,V,E) ==> (?!f. f IN face_set (hypermap1_of_fanx (x,V,E)) /\ + s = dartset_leads_into_fan x V E f)`, + +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MRESA_TAC nonconformin_fan_imp_exist_face_gt_3[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC nonconformin_fan_imp_exist_3point_in_face[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN ABBREV_TAC`v= pr2 (f1:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`u= pr2 (f2:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`w= pr2 (f3:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`E1= E UNION {{v:real^3, w:real^3}}` +THEN ABBREV_TAC`ds1= face (hypermap1_of_fanx (x,V,E1)) ((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x,V,E1)) ((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f10= ((x,w,v,u):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f20= ((x,v,u,w):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f30= ((x,u,w,v):real^3#real^3#real^3#real^3)` +THEN MRESA_TAC conforming_bijection_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]);; + +let OBHTHCD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ~(conforming_fan (x,V,E)) +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> +!s. s IN topological_component_yfan (x,V,E) ==> (?!f. f IN face_set (hypermap1_of_fanx (x,V,E)) /\ + s = dartset_leads_into_fan x V E f)`, + +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MRESA_TAC nonconformin_fan_imp_exist_face_gt_3[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC nonconformin_fan_imp_exist_3point_in_face[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN ABBREV_TAC`v= pr2 (f1:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`u= pr2 (f2:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`w= pr2 (f3:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`E1= E UNION {{v:real^3, w:real^3}}` +THEN ABBREV_TAC`ds1= face (hypermap1_of_fanx (x,V,E1)) ((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x,V,E1)) ((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f10= ((x,w,v,u):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f20= ((x,v,u,w):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f30= ((x,u,w,v):real^3#real^3#real^3#real^3)` +THEN MRESA_TAC conforming_bijection_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]);; + + + +let inverse1_sigma_fan_FANADD4=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> inverse1_sigma_fan x V E1 (inverse1_sigma_fan x V E w u) w = inverse1_sigma_fan x V E (inverse1_sigma_fan x V E w u) w`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MATCH_MP_TAC MONO_SIGMA_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E1:(real^3->bool)->bool` +THEN EXISTS_TAC`inverse1_sigma_fan x V E w u:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{inverse1_sigma_fan x V E w u,w:real^3} IN E /\ E UNION {{v,w}}= E1 +==> {inverse1_sigma_fan x V E w u,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`inverse1_sigma_fan x V E w u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`inverse1_sigma_fan x V E w u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`{inverse1_sigma_fan x V E w u, inverse1_sigma_fan x V E + (inverse1_sigma_fan x V E w u) + w:real^3} IN E /\ E UNION {{v,w}}= E1 +==> {inverse1_sigma_fan x V E w u, inverse1_sigma_fan x V E + (inverse1_sigma_fan x V E w u) + w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`inverse1_sigma_fan x V E w u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`inverse1_sigma_fan x V E w u:real^3`;`inverse1_sigma_fan x V E (inverse1_sigma_fan x V E w u) w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(SET_RULE`~(inverse1_sigma_fan x V E w u IN {v, w}) \/ inverse1_sigma_fan x V E w u =v \/ inverse1_sigma_fan x V E w u =w`) +THENL[ +RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`inverse1_sigma_fan x V E w u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`); + + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL[ +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (inverse1_sigma_fan x V E w u:real^3)`; +`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC]]);; + + +let conforming_diagonal_fanadd1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 z. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ z IN ds +/\ ~(f3=z) +==> ~collinear {x, pr2 f3, pr2 z} /\ + (f3 = f1_fan x V E z \/ + z = f1_fan x V E f3 \/ + aff_gt {x} {pr2 f3, pr2 z} SUBSET + dartset_leads_into_fan x V E ds)`, + +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E) /\ z IN ds ==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds/\ z IN d1_fan(x,V,E)`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[conforming_fan;conforming_diagonal_fan;] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(z=f1:real^3#real^3#real^3#real^3)\/ z=f2 \/ (~(z=f1)/\ ~(z=f2))`) +THENL(*1*)[ +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THENL(*2*)[ +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`E UNION {{v,w:real^3}}=E1==> {v,w:real^3} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[];(*2*) + +ASM_REWRITE_TAC[] +THEN MRESA_TAC STEP2_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]](*2*);(*1*) + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL(*2*)[ + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THENL(*3*)[ + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[];(*3*) + +ASM_REWRITE_TAC[]](*3*);(*2*) + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 ==> E SUBSET E1/\ {v,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC INJ_TRAN_D1_FAN +[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(E1:(real^3->bool)->bool)`; +`f3:real^3#real^3#real^3#real^3`;`(z:real^3#real^3#real^3#real^3)`] +THEN SUBGOAL_THEN`tran (x:real^3) V E1 (z:real^3#real^3#real^3#real^3) IN IMAGE (tran (x:real^3) (V:real^3->bool) E1) (ds:real^3#real^3#real^3#real^3->bool)` ASSUME_TAC +THENL(*3*)[ + +REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`z:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[];(*3*) + +POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`tran (x:real^3) V E1 (f3:real^3#real^3#real^3#real^3)=(x,w,inverse1_sigma_fan x V E1 w v,v)` ASSUME_TAC +THENL(*4*)[ + +SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL(*5*)[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*5*) +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`f1_fan x V E f2 = f3:real^3#real^3#real^3#real^3` +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th;f1_fan;tran] ) +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC](*5*);(*4*) + +SUBGOAL_THEN`(x,w,inverse1_sigma_fan x V E1 w v,v:real^3) =f1_fan x V E1 (x,v,w,sigma_fan x V E1 v w)` ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[f1_fan];(*5*) + +SUBGOAL_THEN`x:real^3,v,w,sigma_fan x V E1 v w IN ds1`ASSUME_TAC +THENL(*6*)[ +FIND_ASSUM (fun th-> REWRITE_TAC[SYM th;face;IN_ELIM_THM;orbit_map])`face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w:real^3) = ds1` +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC;(*6*) + +MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`((x,w,inverse1_sigma_fan x V E1 w v,v):real^3#real^3#real^3#real^3)` ;`((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC DS1_DS2_EQ_DS_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`;`((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN REWRITE_TAC[DELETE;IN_ELIM_THM;UNION] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN STRIP_TAC +THENL(*7*)[ + +FIND_ASSUM MP_TAC`z IN d1_fan (x:real^3,V,E)` +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESAL_TAC th[`ds1:real^3#real^3#real^3#real^3->bool`;`tran (x:real^3) V E1 (f3:real^3#real^3#real^3#real^3)`;`tran (x:real^3) V E1 (z:real^3#real^3#real^3#real^3)`][pr2;pr3;tran]) +THENL(*8*)(*3GOAL*)[ + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[f1_fan;EQ_PAIR_4] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*8*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[f1_fan;EQ_PAIR_4] +THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC inverse1_sigma_fan_FANADD4[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN RESA_TAC +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL(*9*)[ + +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*9*) +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`f1_fan x V E f2 = f3:real^3#real^3#real^3#real^3` +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th;f1_fan;tran] ) +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`inverse1_sigma_fan x V E w u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`)](*9*);(*8*) + +MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION + dartset_leads_into_fan x (V:real^3->bool) E1 ds2 UNION + aff_gt {x} {v, w}:real^3->bool`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]](*8*);(*7*) + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`A IN {B,C,D}<=> A=B \/ A=C \/ A=D`] +THEN STRIP_TAC +THENL(*8*)(*3 GOAL*)[ + +ASM_REWRITE_TAC[];(*8*) + +POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`z IN d1_fan (x:real^3,V,E)` +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[tran] +THEN EXPAND_TAC"f20" +THEN REWRITE_TAC[EQ_PAIR_4] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REWRITE_TAC[pr2] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`f1=(x,v,u,sigma_fan x V E v u:real^3)` ASSUME_TAC +THENL(*9*)[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[pr2;pr3;] +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN ASM_REWRITE_TAC[];(*9*) + +POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[]](*9*);(*8*) +POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`z IN d1_fan (x:real^3,V,E)` +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[tran] +THEN EXPAND_TAC"f30" +THEN REWRITE_TAC[EQ_PAIR_4] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REWRITE_TAC[pr2] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC f2_EQ_F30_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]]]]]]]]]);; + + + + + + +let INDUCTION_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ y IN ds +==> ?f1 f2 f3. {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ {pr2 f2, pr2 f3} IN E +/\ ~({pr2 f3, pr2 f1 } IN E) +/\ {pr2 f1, pr2 f2 } IN E +/\ sigma_fan x V E (pr2 f2) (pr2 f3)=pr2 f1 +/\ pr2 f3= pr3 f2 +/\ pr2 f2= pr3 f1 +/\ y=f3`, + +REPEAT STRIP_TAC +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN ABBREV_TAC`f2'=(f1_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) POWER (CARD (ds:real^3#real^3#real^3#real^3->bool) -1)) (y:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f1'=(f1_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) POWER (CARD (ds:real^3#real^3#real^3#real^3->bool) -2)) (y:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f4=f1_fan x V E (y:real^3#real^3#real^3#real^3)` +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"VUT") +THEN FIND_ASSUM MP_TAC`ds IN face_set(hypermap1_of_fanx (x,V:real^3->bool,E))` +THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] +THEN RESA_TAC +THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) +THEN RESA_TAC +THEN MRESA_TAC lemma_face_cycle[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`y:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) +THEN MP_TAC(SET_RULE`y IN ds /\ ds SUBSET d1_fan(x,V,E)==> y IN d1_fan(x:real^3,V,E)`) +THEN RESA_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`CARD( ds:real^3#real^3#real^3#real^3->bool):num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`CARD( ds:real^3#real^3#real^3#real^3->bool)>3 ==> CARD ds= SUC(CARD(ds)-1)`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC THEN POP_ASSUM(fun th1-> MP_TAC th1 THEN +ONCE_REWRITE_TAC[th] +THEN ASM_REWRITE_TAC[COM_POWER;o_DEF] +THEN STRIP_TAC THEN MP_TAC th1)) +THEN MP_TAC(ARITH_RULE`CARD( ds:real^3#real^3#real^3#real^3->bool)>3 ==> CARD ds= SUC( SUC(CARD(ds)-2))`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[COM_POWER;o_DEF] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`CARD( ds:real^3#real^3#real^3#real^3->bool)-1:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`CARD( ds:real^3#real^3#real^3#real^3->bool)-2:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC(0):num`;] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(f1':real^3#real^3#real^3#real^3)`[POWER;I_DEF;o_DEF]) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN MRESA_TAC MONO_F1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[` (f1_fan x V E f1':real^3#real^3#real^3#real^3)`;` (f2':real^3#real^3#real^3#real^3)`]) +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`(y:real^3#real^3#real^3#real^3)` ;`(f2':real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`(f2':real^3#real^3#real^3#real^3)` ;`(f1':real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f4:real^3#real^3#real^3#real^3)` ;`(y:real^3#real^3#real^3#real^3)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`f1' IN ds /\ f2' IN ds /\ y IN ds /\ ds SUBSET d1_fan (x,V,E)==> {f1',f2',y} SUBSET (ds:real^3#real^3#real^3#real^3->bool)`) +THEN RESA_TAC +THEN MRESA_TAC f_fan_no_fix_point[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f1':real^3#real^3#real^3#real^3)` THEN MRESA1_TAC th`(f2':real^3#real^3#real^3#real^3)` THEN MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`) +THEN DISJ_CASES_TAC(SET_RULE`y=f1' \/ ~(y=f1':real^3#real^3#real^3#real^3)`) +THENL(*1*)[ +MP_TAC(SET_RULE`f1'=y:real^3#real^3#real^3#real^3==> pr2 f1'= pr2 y`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(y:real^3#real^3#real^3#real^3)` ;`(f2':real^3#real^3#real^3#real^3)`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f2':real^3#real^3#real^3#real^3)` ;`(f1':real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` pr2 (y:real^3#real^3#real^3#real^3)`; +` pr2 (f2':real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge (pr2 (f2':real^3#real^3#real^3#real^3)) V E = {pr2 y} \/ ~(set_of_edge (pr2 (f2':real^3#real^3#real^3#real^3)) V E = {pr2 y})`) +THENL(*2*)[ + MRESA_TAC CARD_SING[`(pr2 y):real^3`; `(set_of_edge (pr2 (f2':real^3#real^3#real^3#real^3)) V E):real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) +THEN FIND_ASSUM (fun th -> MP_TAC(ISPEC `(pr2 (f2':real^3#real^3#real^3#real^3))` th))`(!v:real^3. v IN V==>CARD (set_of_edge v V E) >1)` +THEN FIND_ASSUM (fun th-> REWRITE_TAC[th])`(pr2 (f2':real^3#real^3#real^3#real^3)) IN V` +THEN ARITH_TAC;(*2*) + +MRESA_TAC SIGMA_FAN [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` pr2 (f2':real^3#real^3#real^3#real^3)`; +` pr2 (y:real^3#real^3#real^3#real^3)`] +THEN ASM_TAC THEN SET_TAC[]];(*1*) + + + +DISJ_CASES_TAC(SET_RULE`f4=f1' \/ ~(f4=f1':real^3#real^3#real^3#real^3)`) +THENL(*2*)[ +SUBGOAL_THEN(`((f1_fan (x:real^3) V E) POWER 3) f1'=f1'`) ASSUME_TAC + +THENL(*3*)[ +ASM_SIMP_TAC[ARITH_RULE`3= SUC(2)/\ 2= SUC(1) /\ 1= SUC(0)`;POWER;I_DEF;o_DEF];(*3*) + + SUBGOAL_THEN`face (hypermap1_of_fanx (x:real^3,V:real^3->bool,E)) f1'=orbit_map (f1_fan x V E) f1'`ASSUME_TAC +THENL(*4*)[ +ASM_REWRITE_TAC[face;orbit_map;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THEN STRIP_TAC +THEN MRESAL_TAC into_domain_power_efn_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`n:num`;`( \ t. res (t x V E ) (d1_fan (x:real^3,V,E))) `][POWER_1;I_DEF] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `f1':real^3#real^3#real^3#real^3`) +THEN EXISTS_TAC`n:num` +THEN ASM_REWRITE_TAC[];(*4*) + +MRESAL_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f1':real^3#real^3#real^3#real^3`][] +THEN MRESAL_TAC card_orbit_le[`f1_fan (x:real^3) V E`;`3`;`f1':real^3#real^3#real^3#real^3`][ARITH_RULE`~(3=0)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th -> REWRITE_TAC[SYM th]) +THEN FIND_ASSUM MP_TAC`CARD( ds:real^3#real^3#real^3#real^3->bool)>3` +THEN ARITH_TAC](*4*)](*3*);(*2*) + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EMYEU") +THEN EXISTS_TAC`f1':real^3#real^3#real^3#real^3` +THEN EXISTS_TAC`f2':real^3#real^3#real^3#real^3` +THEN EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f2':real^3#real^3#real^3#real^3)` ;`(f1':real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(y:real^3#real^3#real^3#real^3)` ;`(f2':real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)] +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)] THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)] THEN MP_TAC th) THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[th] THEN MP_TAC th) +THEN REPEAT STRIP_TAC THEN ASSUME_TAC (SYM th)) +THEN MRESA_TAC PROPERTIES_TRIANGLE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(pr2 f1'):real^3`;`(pr3 f1'):real^3`;` (pr2 y):real^3`] +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC condition_f1_eq_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` (pr2 y):real^3`;`(pr2 f1'):real^3`;`(pr3 f1'):real^3`;] +THEN REMOVE_THEN "EMYEU" MP_TAC +THEN REMOVE_THEN"VUT"(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN REPEAT (ASM_REWRITE_TAC[pr2;pr3] THEN STRIP_TAC THEN ASM_REWRITE_TAC[]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC MONO_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v'':real^3`;`v'''':real^3`;`w'':real^3`]]]);; + +let conforming_diagonal_fan_ds_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y z. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ y IN ds +/\ z IN ds +/\ ~(y=z) +==> ~collinear {x, pr2 y, pr2 z} /\ + (y = f1_fan x V E z \/ + z = f1_fan x V E y \/ + aff_gt {x} {pr2 y, pr2 z} SUBSET + dartset_leads_into_fan x V E ds)`, + +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MRESA_TAC INDUCTION_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`y:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC`v'= pr2 (f1':real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`u'= pr2 (f2':real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`w'= pr2 (f3':real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`E1'= E UNION {{v':real^3, w':real^3}}` +THEN ABBREV_TAC`ds1'= face (hypermap1_of_fanx (x,V,E1')) ((x,v',w',sigma_fan x V E1' v' w'):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`ds2'= face (hypermap1_of_fanx (x,V,E1')) ((x,w',v',sigma_fan x V E1' w' v'):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f10'= ((x,w',v',u'):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f20'= ((x,v',u',w'):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f30'= ((x,u',w',v'):real^3#real^3#real^3#real^3)` +THEN STRIP_TAC +THEN MRESA_TAC conforming_diagonal_fanadd1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1':(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1':real^3#real^3#real^3#real^3)` ;`(f2':real^3#real^3#real^3#real^3)`;`(f3':real^3#real^3#real^3#real^3)`;`v':real^3`;`u':real^3`; `w':real^3`;`ds1':real^3#real^3#real^3#real^3->bool`;`ds2':real^3#real^3#real^3#real^3->bool` ;`(f10':real^3#real^3#real^3#real^3)`;`(f20':real^3#real^3#real^3#real^3)`;`(f30':real^3#real^3#real^3#real^3)`;`(z:real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[]);; + +let GGZWYRM=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> conforming_diagonal_fan(x,V,E)`, +REWRITE_TAC[conforming_diagonal_fan] +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`(f):real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(ARITH_RULE`3<= CARD (f:real^3#real^3#real^3#real^3->bool)==> CARD f=3 \/ CARD f>3`) +THEN RESA_TAC +THENL[ +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM1") +THEN DISCH_THEN(LABEL_TAC"EM2") +THEN STRIP_TAC +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC CARD_FACE_SET_EQ_3_FULLY_SURROUNDED_FAN1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr2 f2):real^3`;`(pr2 f1):real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr2 f3):real^3`;`(pr2 f2):real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr2 f1):real^3`;`(pr2 f3):real^3`] +THEN REPEAT DISCH_TAC +THEN REMOVE_THEN"EM1" MP_TAC +THEN REMOVE_THEN"EM2" MP_TAC +THEN RESA_TAC +THEN RESA_TAC +THEN MP_TAC(SET_RULE`y IN {f1, f2, f3:real^3#real^3#real^3#real^3} /\ z IN {f1, f2, f3}/\ ~(y = z) +==> (y=f1 /\ z= f2) \/ (y=f1 /\ z= f3) \/ (y=f2 /\ z= f1) \/ (y=f2 /\ z= f3)\/ (y=f3 /\ z= f1) \/ (y=f3 /\ z= f2)` ) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[]; +MRESA_TAC nonconformin_fan_imp_exist_3point_in_face[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`f:real^3#real^3#real^3#real^3->bool`] +THEN ABBREV_TAC`v= pr2 (f1:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`u= pr2 (f2:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`w= pr2 (f3:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`E1= E UNION {{v:real^3, w:real^3}}` +THEN ABBREV_TAC`ds1= face (hypermap1_of_fanx (x,V,E1)) ((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x,V,E1)) ((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f10= ((x,w,v,u):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f20= ((x,v,u,w):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f30= ((x,u,w,v):real^3#real^3#real^3#real^3)` +THEN MRESA_TAC conforming_diagonal_fan_ds_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`f:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(y:real^3#real^3#real^3#real^3)`;`(z:real^3#real^3#real^3#real^3)`] +]);; + +let INTERS_HALF_SPACE_DS_FANADD3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U1. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ U1=INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN ds} +==> U1 INTER aff {x, v, w} SUBSET aff_gt {x} {v, w}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {v,u} IN E ==> { v,u} IN E1`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 ==> {v,w:real^3} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`sigma_fan x V E v (u:real^3)`; +`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`sigma_fan x V E v u:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN STRIP_TAC +THEN MRESA_TAC aff_gt_3_1_INTER_aff_SUBSET_aff_gt_2_1[`x:real^3`;`v:real^3`;`u:real^3`;`sigma_fan x V E v u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC aff_gt_3_1_INTER_aff_SUBSET_aff_gt_2_14[`x:real^3`;`w:real^3`;`u:real^3`;`v:real^3`;] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(v:real^3)`;`(w:real^3)`] +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B,C}={A,C,B}`] +THEN REWRITE_TAC[INTERS;INTER;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THENL[ +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN SUBGOAL_THEN`(?y. y IN ds /\ + aff_gt {x, v, u} {sigma_fan x V E v u} = + aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y):real^3})` +ASSUME_TAC +THENL[ +EXISTS_TAC`f1:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`); +STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`aff_gt {x, v, u} {sigma_fan x V E v u:real^3}`) +THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th`x':real^3`)]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN STRIP_TAC +THEN SUBGOAL_THEN `(?y. y IN ds /\ + aff_gt {x, u, w} {v} = + aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y):real^3})` +ASSUME_TAC +THENL[ +EXISTS_TAC`f2:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]; +FIND_ASSUM (fun th-> REWRITE_TAC[SYM th])`f1_fan (x:real^3) V E f2 = f3` +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[f1_fan] +THEN ASM_REWRITE_TAC[pr3]]; +STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`aff_gt {x, u, w} {v:real^3}`) +THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th`x':real^3`)]]);; + + +let lemma_HYUAZSE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U U1. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN ds} = U1 +/\ U= dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w} +==> U1 SUBSET U`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] + +THEN MRESA_TAC INTERS_HALF_SPACE_DS_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U1:real^3->bool`] +THEN MRESA_TAC INTERS_HALF_SPACE_DS_FANADD2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U1:real^3->bool`] +THEN MRESA_TAC INTERS_HALF_SPACE_DS_FANADD3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U1:real^3->bool`] +THEN MRESA_TAC SPACE3_EQ_UNION_3SET +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + + +let DART_FANADD_SUBSET_HALFSPACE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> dartset_leads_into_fan x V E1 ds1 SUBSET aff_gt {x, pr2 f3, pr3 f3} {pr3 (f1_fan x V E f3) }`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]; + +FIND_ASSUM (fun th-> REWRITE_TAC[SYM th])`f1_fan (x:real^3) V E f2 = f3` +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[f1_fan] +THEN ASM_REWRITE_TAC[pr3] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[conforming_fan;conforming_half_space_fan] +THEN REPEAT STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`ds1:real^3#real^3#real^3#real^3->bool`) +THEN MP_TAC(SET_RULE`dartset_leads_into_fan x V E1 ds1 = + INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E1 y)} | y IN ds1} +==> (!y. y IN ds1 ==> dartset_leads_into_fan x V E1 ds1 SUBSET aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E1 y):real^3})`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[SYM th]) +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN SUBGOAL_THEN`(x,v,w,sigma_fan x V E1 v w:real^3) IN ds1`ASSUME_TAC +THENL[ + +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;face;orbit_map;IN_ELIM_THM])`face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) = ds1:real^3#real^3#real^3#real^3->bool` +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF]; +MRESAL_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`((x,w,inverse1_sigma_fan x V E1 w v,v):real^3#real^3#real^3#real^3)` ;`((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`;`ds1:real^3#real^3#real^3#real^3->bool`][f1_fan] +THEN REMOVE_THEN "LINH"(fun th-> MRESAL1_TAC th `(x,w,inverse1_sigma_fan x V E1 w v,v:real^3)`[f1_fan;pr3;pr2] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`;`inverse1_sigma_fan x V E1 w v:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESAL1_TAC th `(x,v,w,sigma_fan x V E1 v w:real^3)`[f1_fan;pr3;pr2]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`w:real^3`;`inverse1_sigma_fan x V E1 w v:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`inverse1_sigma_fan x V E1 w v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN RESA_TAC +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E1 w v:real^3`;`v:real^3`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;`(v:real^3)`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`;`v:real^3`;`inverse1_sigma_fan x V E1 w v:real^3`; ] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E1 w v:real^3`;`v :real^3`;] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CHANGE") +THEN STRIP_TAC +THEN REMOVE_THEN "CHANGE" MP_TAC +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN RESA_TAC +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`;`u:real^3`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`(u:real^3)`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`;`u:real^3`;`inverse1_sigma_fan x V E w u:real^3`; ] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`;`u :real^3`;]]]);; + + + +let DART_FANADD_SUBSET_HALFSPACE1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> dartset_leads_into_fan x V E1 ds2 SUBSET aff_gt {x, pr2 f3, pr3 f3} {pr3 (f1_fan x V E f3) }`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]; + +FIND_ASSUM (fun th-> REWRITE_TAC[SYM th])`f1_fan (x:real^3) V E f2 = f3` +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[f1_fan] +THEN ASM_REWRITE_TAC[pr3] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC card_ds2_fanadd_eq3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC KVQWYDL_lemma10[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN REWRITE_TAC[SET_RULE`{pr2 y | y IN {f10, f20, f30}}={pr2 f10, pr2 f20, pr2 f30}`] +THEN EXPAND_TAC"f10" +THEN EXPAND_TAC"f20" +THEN EXPAND_TAC"f30" +THEN REWRITE_TAC[pr2] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u:real^3`] THEN MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,C,A}`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC(SET_RULE`{u,w} IN E/\ E UNION {{v, w:real^3}} = E1==>{v, w} IN E1 /\ {u,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`w:real^3`;`v:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`; +`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC WEDGE_LUNE_GT[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_2_2[`x:real^3`;`v:real^3`;`w:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[SET_RULE`A INTER B INTER C= A INTER C INTER B`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) +THEN SUBGOAL_THEN`wedge x w v u SUBSET wedge x w (inverse1_sigma_fan x V E w u:real^3) u` ASSUME_TAC +THENL[ +REWRITE_TAC[wedge;IN_ELIM_THM;SUBSET] +THEN STRIP_TAC THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`azim x w v x' < azim x w v (u:real^3)==> azim x w v x' <= azim x w v u`) +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`w:real^3`;`v:real^3`;`x':real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x w v x' < azim x w v (u:real^3)/\ azim x w v u = azim x w v x' + azim x w x' (u:real^3) /\ &0 < azim x w v x' ==> &0< azim x w x' u /\ azim x w x' u < azim x w v u`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w (inverse1_sigma_fan x V E w u) u +/\ azim x w x' u < azim x w v u +==> +azim x w x' u < azim x w (inverse1_sigma_fan x V E w u) u +/\ +azim x w x' u <= azim x w (inverse1_sigma_fan x V E w u) (u:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`(inverse1_sigma_fan x V E w u):real^3`; +`(w:real^3)`] +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`x':real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u:real^3) u = + azim x w (inverse1_sigma_fan x V E w u) x' + azim x w x' u +/\ azim x w x' u < azim x w (inverse1_sigma_fan x V E w u) u +/\ &0< azim x w x' u +==> +&0 < azim x w (inverse1_sigma_fan x V E w u) x' /\ + azim x w (inverse1_sigma_fan x V E w u) x' < + azim x w (inverse1_sigma_fan x V E w u) x' + azim x w x' u +`) +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`(inverse1_sigma_fan x V E w u):real^3`; +`(w:real^3)`] +THEN REMOVE_THEN "YEU EM"(fun th-> MRESA_TAC th [`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`]) +THEN MRESA_TAC WEDGE_LUNE_GT[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`] +THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_2_2[`x:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`w:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,C,A}`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SET_TAC[]]]);; + +let DART_FANADD_SUBSET_HALFSPACE2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> aff_gt {x} {v,w} SUBSET aff_gt {x, pr2 f3, pr3 f3} {pr3 (f1_fan x V E f3) }`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]; + +FIND_ASSUM (fun th-> REWRITE_TAC[SYM th])`f1_fan (x:real^3) V E f2 = f3` +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[f1_fan] +THEN ASM_REWRITE_TAC[pr3] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> { v,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(v:real^3)`;`(w:real^3)`] +THEN MATCH_MP_TAC(SET_RULE`A SUBSET B ==> C INTER A SUBSET B`) +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`w:real^3`;`v:real^3`][IN_ELIM_THM] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`(inverse1_sigma_fan x V E w u):real^3`; +`(w:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`;`u:real^3`;`inverse1_sigma_fan x V E w u:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`] +THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`;`u:real^3`][IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(t1 % x + t2 % w + t3 % v) - x= ((t1+t2+t3)- &1) % x+ t2 % (w-x) +t3 % (v-x)`; VECTOR_ARITH`(&1 - &1) % x + t2 % (w - x) + t3 % (v - x)= t2 % (w - x) + t3 % (v - x)`;DOT_RMUL;DOT_RADD;DOT_CROSS_SELF;REAL_ARITH`A * &0 +B=B`] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`;`v:real^3`;`inverse1_sigma_fan x V E w u:real^3`;] +THEN POP_ASSUM MATCH_MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`{w, inverse1_sigma_fan x V E w u} IN E /\ {u,w} IN E/\ E UNION {{v, w:real^3}} = E1==>{w, inverse1_sigma_fan x V E w u} IN E1 /\ {u,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`])]);; + + + +let DART_FANADD_SUBSET_HALFSPACE3= prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> dartset_leads_into_fan x V E ds SUBSET aff_gt {x, pr2 f3, pr3 f3} {pr3 (f1_fan x V E f3) }`, + + + + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION + dartset_leads_into_fan x (V:real^3->bool) E1 ds2 UNION + aff_gt {x} {v, w}:real^3->bool`] +THEN MRESA_TAC DART_FANADD_SUBSET_HALFSPACE[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC DART_FANADD_SUBSET_HALFSPACE1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC DART_FANADD_SUBSET_HALFSPACE2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + +let DART_FANADD_SUBSET_HALFSPACE4=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> dartset_leads_into_fan x V E ds SUBSET INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN ds}`, + + +REPEAT GEN_TAC +THEN STRIP_TAC +THEN REWRITE_TAC[SET_RULE`dartset_leads_into_fan x V E ds SUBSET INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN ds} <=> (!y. y IN ds ==> dartset_leads_into_fan x V E ds SUBSET aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) })`] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC INDUCTION_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`y:real^3#real^3#real^3#real^3`] +THEN ABBREV_TAC`v'= pr2 (f1':real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`u'= pr2 (f2':real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`w'= pr2 (f3':real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`E1'= E UNION {{v':real^3, w':real^3}}` +THEN ABBREV_TAC`ds1'= face (hypermap1_of_fanx (x,V,E1')) ((x,v',w',sigma_fan x V E1' v' w'):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`ds2'= face (hypermap1_of_fanx (x,V,E1')) ((x,w',v',sigma_fan x V E1' w' v'):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f10'= ((x,w',v',u'):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f20'= ((x,v',u',w'):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f30'= ((x,u',w',v'):real^3#real^3#real^3#real^3)` +THEN MRESA_TAC DART_FANADD_SUBSET_HALFSPACE3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1':(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1':real^3#real^3#real^3#real^3)` ;`(f2':real^3#real^3#real^3#real^3)`;`(f3':real^3#real^3#real^3#real^3)`;`v':real^3`;`u':real^3`; `w':real^3`;`ds1':real^3#real^3#real^3#real^3->bool`;`ds2':real^3#real^3#real^3#real^3->bool` ;`(f10':real^3#real^3#real^3#real^3)`;`(f20':real^3#real^3#real^3#real^3)`;`(f30':real^3#real^3#real^3#real^3)`]);; + +let DART_FANADD_EQ_HALFSPACE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> dartset_leads_into_fan x V E ds = INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN ds}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION + dartset_leads_into_fan x (V:real^3->bool) E1 ds2 UNION + aff_gt {x} {v, w}:real^3->bool`] +THEN MRESA_TAC DART_FANADD_SUBSET_HALFSPACE4[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC lemma_HYUAZSE +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w:real^3}`;`INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN (ds:real^3#real^3#real^3#real^3->bool)}`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + +let HYUAZSE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> conforming_half_space_fan(x,V,E)`, +REWRITE_TAC[conforming_half_space_fan] +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`(f):real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(ARITH_RULE`3<= CARD (f:real^3#real^3#real^3#real^3->bool)==> CARD f=3 \/ CARD f>3`) +THEN RESA_TAC +THENL[ +MRESA_TAC KVQWYDL_lemma10[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th);]) +THEN MRESA_TAC CARD_FACE_SET_EQ_3_FULLY_SURROUNDED_FAN1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN ASM_REWRITE_TAC[SET_RULE`INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y)} | y IN {f1, f2, f3}} += aff_gt {x, pr2 f1, pr3 f1} {pr3 (f1_fan x V E f1)} INTER aff_gt {x, pr2 f2, pr3 f2} {pr3 (f1_fan x V E f2)} INTER aff_gt {x, pr2 f3, pr3 f3} {pr3 (f1_fan x V E f3)}`;SET_RULE`{pr2 y | y IN {f1, f2, f3}}={pr2 f1, pr2 f2, pr2 f3}`] + +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`pr2 f2:real^3`;`pr2 f3:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(pr2 f1):real^3`;`(pr2 f2):real^3`;`(pr2 f3):real^3`] +THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_1_3[`x:real^3`;`(pr3 f3):real^3`;`(pr3 f1):real^3`;`(pr3 f2):real^3`]; + + + +MRESA_TAC nonconformin_fan_imp_exist_3point_in_face[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`f:real^3#real^3#real^3#real^3->bool`] +THEN ABBREV_TAC`v= pr2 (f1:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`u= pr2 (f2:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`w= pr2 (f3:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`E1= E UNION {{v:real^3, w:real^3}}` +THEN ABBREV_TAC`ds1= face (hypermap1_of_fanx (x,V,E1)) ((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x,V,E1)) ((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f10= ((x,w,v,u):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f20= ((x,v,u,w):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f30= ((x,u,w,v):real^3#real^3#real^3#real^3)` +THEN MRESA_TAC DART_FANADD_EQ_HALFSPACE[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`f:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`]]);; + + + + + +let PIIJBJK=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +==> conforming_fan(x,V,E)`, + +REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(conforming_fan (x,V,E))\/ (conforming_fan (x:real^3,V,E))`) +THENL[ +ABBREV_TAC`S= {(N_FAN(x':real^3,V',E1))| x'= x /\ V'= V /\ FAN(x,V,E1)/\ (!v. v IN V'==>CARD (set_of_edge v V' E1) > 1) +/\ fan80(x',V',E1) /\ ~(conforming_fan (x',V',E1))}` +THEN ABBREV_TAC`n= (minimal) (S:num->bool)` +THEN SUBGOAL_THEN`?y. y IN (S:num->bool)`ASSUME_TAC +THENL[ +EXPAND_TAC"S" +THEN REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`(N_FAN(x:real^3,V,E))` +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN] +THEN DISCH_TAC +THEN MRESA1_TAC MINIMAL`S:num->bool` +THEN SUBGOAL_THEN`n IN (S:num->bool)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[IN]; + +POP_ASSUM MP_TAC +THEN EXPAND_TAC"S" +THEN REWRITE_TAC[IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINHYEU") +THEN STRIP_TAC +THEN SUBGOAL_THEN`(!E2. FAN(x:real^3,V,E2) /\ + (!v. v IN V==>CARD (set_of_edge v V E2) > 1) /\ + fan80(x,V,E2)/\ + N_FAN(x,V,E2)< N_FAN(x,V,E1) ==> conforming_fan (x,V,E2)) +`ASSUME_TAC +THENL[ +REPEAT STRIP_TAC +THEN REMOVE_THEN "LINHYEU"(fun th-> MRESA1_TAC th`N_FAN (x:real^3,V,E2)` ) +THEN MP_TAC(SET_RULE`~ (S (N_FAN (x:real^3,V,E2))) ==> ~(N_FAN (x,V,E2) IN S) `) +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"S" +THEN REWRITE_TAC[IN_ELIM_THM;GSYM FORALL_NOT_THM;DE_MORGAN_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th -> MRESA_TAC th[`x:real^3`;`V:real^3->bool`;`E2:(real^3->bool)->bool`]); +MRESA_TAC nonconformin_fan_imp_n_fan_ge0[`x':real^3`;`(V':real^3->bool)`;`(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC HYUAZSE[`x':real^3`;`(V':real^3->bool)`;`(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC TXFBALB_VERSION +[`x':real^3`;`(V':real^3->bool)`;`(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC GGZWYRM +[`x':real^3`;`(V':real^3->bool)`;`(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC conforming_bijection_fanadd_verrion +[`x':real^3`;`(V':real^3->bool)`;`(E1:(real^3->bool)->bool)`] +THEN FIND_ASSUM MP_TAC`~conforming_fan (x':real^3,V',E1)` +THEN REWRITE_TAC[conforming_fan] +THEN ASM_REWRITE_TAC[conforming_bijection_fan]]]]; +ASM_REWRITE_TAC[]]);; + + +let expand_xfan_eq_aff_gt_aff_ge=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +==> UNIONS {y | ?e. e IN E /\ y = aff_ge {x} e}= (UNIONS {aff_gt {x} e | e IN E}) UNION (UNIONS {aff_ge {x} {v}| v IN V})`, +REWRITE_TAC[UNIONS;UNION;] +THEN ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[IN_ELIM_THM;] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th] THEN STRIP_TAC) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;` (w:real^3)`] +THEN REWRITE_TAC[UNION] +THEN RESA_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THENL[ + + +SUBGOAL_THEN`(?u1. (?e. e IN E /\ u1 = aff_gt {x:real^3} e) /\ x' IN u1)`ASSUME_TAC +THENL[ +EXISTS_TAC`aff_gt {x} {v, w:real^3}` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`{v,w:real^3}` +THEN ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[]]; + +SUBGOAL_THEN`(?u1. (?v. v IN V /\ u1 = aff_ge {x} {v:real^3}) /\ x' IN u1)` ASSUME_TAC +THENL[ +EXISTS_TAC`aff_ge {x} {v:real^3}` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[]]; + +SUBGOAL_THEN`(?u1. (?v. v IN V /\ u1 = aff_ge {x} {v:real^3}) /\ x' IN u1)` ASSUME_TAC +THENL[ +EXISTS_TAC`aff_ge {x} {w:real^3}` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`; +`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC; +ASM_REWRITE_TAC[]]]; + + +REPEAT STRIP_TAC +THENL[ +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th] THEN STRIP_TAC) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE`x' IN aff_gt {x} {v, w} /\ aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w} +==> x' IN aff_ge {x:real^3} {v, w}`) +THEN RESA_TAC +THEN EXISTS_TAC`aff_ge {x:real^3} {v, w}` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`{v,w:real^3}` +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN FIND_ASSUM(fun th-> MP_TAC(ISPEC `v:real^3` th))`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`(v:real^3) IN V` +THEN STRIP_TAC +THEN MRESA_TAC exists_inf_element_fix_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u1:real^3`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;` (u':real^3)`] +THEN MP_TAC(SET_RULE`aff_ge {x} {v, u'} = + aff_gt {x} {v, u'} UNION aff_ge {x} {v} UNION aff_ge {x} {u'} +/\ x' IN aff_ge {x} {v} +==> x' IN aff_ge {x} {v, u':real^3} `) +THEN RESA_TAC +THEN EXISTS_TAC`aff_ge {x} {v, u':real^3}` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`{v,u':real^3}` +THEN ASM_REWRITE_TAC[]]]);; + + + +let properties12_fan7=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +==> (UNIONS {aff_gt {x} e | e IN E}) INTER (UNIONS {aff_ge {x} {v}| v IN V})={}`, + +REWRITE_TAC[SET_RULE`A={} <=> ~(?y. y IN A)`;IN_ELIM_THM;UNIONS;INTER] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th] THEN STRIP_TAC) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(v':real^3)`] +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v':real^3)`;` (w:real^3)`] +THEN POP_ASSUM (fun th-> MP_TAC(SYM th) THEN STRIP_TAC) +THEN RESA_TAC +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM(fun th-> MP_TAC(ISPEC `v:real^3` th))`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`(v:real^3) IN V` +THEN STRIP_TAC +THEN MRESA_TAC exists_inf_element_fix_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u1:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u'':real^3)`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC AFF_GE_1_1[`x:real^3`;`v:real^3`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN `v IN aff_gt {x} {v',w:real^3}` ASSUME_TAC +THENL(*1*)[ +MRESA_TAC AFF_GT_1_2[`x:real^3`;`v':real^3`;`w:real^3`] +THEN FIND_ASSUM MP_TAC`y IN aff_gt {x} {v', w:real^3}` +THEN POP_ASSUM (fun th-> REWRITE_TAC[th;IN_ELIM_THM]) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 <= t2==> t2= &0 \/ &0 < t2`) +THEN RESA_TAC +THENL(*2*)[ +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th; REAL_ARITH`A+ &0=A`] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`&1 % x + &0 % v = t1' % x + t2' % v' + t3 % w <=> t2' %(v'-x) + t3 %(w-x)= (&1-(t1'+t2'+t3))%x`;VECTOR_ARITH`t2' % (v' - x) + t3 % (w - x) = (&1 - &1) % x<=> t3 % w= (t3 +t2') % x + (-- t2') % v' `] +THEN FIND_ASSUM MP_TAC`~(w IN aff {x, v':real^3})` +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN MP_TAC(REAL_ARITH`&0< t3==> ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t3:real` +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`t3 % w = (t3 + t2') % x + --t2' % v' ==> (inv (t3)) %(t3%w) = inv (t3)%((t3 + t2') % x + --t2' % v':real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C `;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`?u1 v1. u1 + v1 = &1 /\ w = u1 % x + v1 % v':real^3` ASSUME_TAC +THENL(*3*)[ +EXISTS_TAC`inv t3 * (t3 + t2'):real` +THEN EXISTS_TAC`(inv t3 * --t2'):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t3 * (t3 + t2') + inv t3 * --t2'= inv t3 * t3 `];(*3*) + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[]](*2*); + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN STRIP_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v = t1' % x + t2' % v' + t3 % w +<=> t2 % v = (t1'- t1) % x + t2' % v' + t3 % w`] +THEN MP_TAC(REAL_ARITH`&0< t2 ==> ~(t2= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`t2 % v = (t1' - t1) % x + t2' % v' + t3 % w ==> (inv (t2)) %(t2 % v) = inv (t2)%((t1' - t1) % x + t2' % v' + t3 % w:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C `;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`] +THEN STRIP_TAC +THEN MP_TAC(ISPEC`(t2:real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv (t2:real)`;`(t2':real)`]REAL_LT_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv (t2:real)`;`(t3:real)`]REAL_LT_MUL) +THEN RESA_TAC +THEN EXISTS_TAC`(inv t2 * (t1' - t1)):real` +THEN EXISTS_TAC`(inv t2 * t2'):real` +THEN EXISTS_TAC`(inv t2 * t3):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t2 * (t1' - t1) + inv t2 * t2' + inv t2 * t3 += inv t2 * (t2+(t1'+t2'+t3)- (t1+t2))`;REAL_ARITH`A+ &1 - &1=A`]];(*1*) + +MP_TAC(SET_RULE`v IN aff_gt {x} {v', w} /\ aff_ge {x} {v', w} = + aff_gt {x} {v', w} UNION aff_ge {x} {v'} UNION aff_ge {x} {w} +==> v IN aff_ge {x} {v', w:real^3}`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v:real^3`; `u'':real^3`; `v':real^3`;`w:real^3`]properties_of_fan7) +THEN RESA_TAC +THENL[ + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`v = t1' % x + t2' % v + t3 % w +<=> t3 % w = (--t1') % x +(&1 - t2') % v`] +THEN MP_TAC(REAL_ARITH`&0< t3==> ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t3:real` +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`t3 % w = (--t1') % x + (&1 -t2') % v ==> (inv (t3)) %(t3%w) = inv (t3)%((--t1') % x + (&1 -t2') % v:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C `;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`~(w IN aff {x, v:real^3})` +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`(inv t3 * --t1'):real` +THEN EXISTS_TAC`(inv t3 * (&1 - t2')):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t3 * --t1' + inv t3 * (&1 - t2')= inv t3 *( t3+ &1 -(t1'+t2' +t3))`;REAL_ARITH`A+ &1- &1=A`]; +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v':real^3`;`w:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`w = t1' % x + t2' % v + t3 % w +<=> (t2') % v = (--t1') % x +(&1 - t3) % w`] +THEN MP_TAC(REAL_ARITH`&0< t2' ==> ~(t2'= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2':real` +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`t2' % v' = (--t1') % x + (&1 -t3) % w ==> (inv (t2')) %(t2' %v') = inv (t2')%((--t1') % x + (&1 -t3) % w:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C `;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v':real^3)`; +`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`~(v' IN aff {w,x:real^3})` +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`(inv t2' * (&1 - t3)):real` +THEN EXISTS_TAC`(inv t2' * --t1'):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t2' * (&1 - t3) + inv t2' * --t1' = inv t2' *( t2'+ &1 -(t1'+t2' +t3))`;REAL_ARITH`A+ &1- &1=A`;VECTOR_ARITH`A+B=B+A:real^3`]]]);; + + +let yfan_union_aff_gt_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +==> yfan(x,V,E) UNION (UNIONS {aff_gt {x} e | e IN E}) = (:real^3) DIFF (UNIONS {aff_ge {x} {v}| v IN V})`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[yfan;XFAN_EQ_UNIONS_AFF_GE_1_2;] +THEN MRESA_TAC expand_xfan_eq_aff_gt_aff_ge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC properties12_fan7[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + +let exists_point_in_dartset_leads_into_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> ?y. y IN dartset_leads_into_fan x V E ds`, +REPEAT STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN EXISTS_TAC`y:real^3` +THEN MRESA_TAC CONNECTED_COMPONENT_REFL[`yfan(x:real^3,V:real^3->bool,E)`;`y:real^3`] +THEN ASM_REWRITE_TAC[IN]);; + + + + +let NEGLIGIBLE_AFF_3_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) z:real^3. +FAN (x,V,E) ==> negligible (UNIONS {aff {x, z, v} | v IN V} )`, + +REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[FAN;fan1] THEN STRIP_TAC THEN ASSUME_TAC th) +THEN MATCH_MP_TAC NEGLIGIBLE_UNIONS +THEN MRESAL_TAC FINITE_IMAGE[`(\e:real^3. aff {x:real^3,z:real^3,e})`;`V:(real^3->bool)`][IMAGE] +THEN SUBGOAL_THEN`{aff {x, z, v} | v IN V} = {y | ?x'. x' IN V /\ y = aff {x, z, x':real^3}} `(fun th-> ASM_REWRITE_TAC[th]) +THENL[ +REWRITE_TAC[EXTENSION;IN_ELIM_THM]; +REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[NEGLIGIBLE_AFF_3]]);; + + + + +let MEASURE_AFF_3_FAN=prove(`!x:real^3 V:real^3->bool E:(real^3->bool)->bool z:real^3. +FAN (x,V,E) ==> measure (UNIONS {aff {x, z, v} | v IN V})= &0`, +REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0 +THEN POP_ASSUM MP_TAC +THEN MESON_TAC[NEGLIGIBLE_AFF_3_FAN]);; + + +let NEGLIGIBLE_AFF_3_UNION_INTER_BALL=prove(`!x:real^3 V:real^3->bool E:(real^3->bool)->bool z:real^3 y:real^3 r:real. +FAN (x,V,E) ==> +negligible ((UNIONS {aff {x, z, v} | v IN V} ) INTER normball y r)`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET +THEN EXISTS_TAC `(UNIONS {aff {x, z, v:real^3} | v IN V} )` +THEN ASM_SIMP_TAC[ SET_RULE`A INTER B SUBSET A`] +THEN ASM_MESON_TAC[NEGLIGIBLE_AFF_3_FAN;]);; + + +let MEASURE_AFF_3_UNION_FAN=prove(`!x:real^3 V:real^3->bool E:(real^3->bool)->bool z:real^3 y:real^3 r:real. +FAN (x,V,E) ==> measure (UNIONS {aff {x, z, v} | v IN V} INTER normball y r)= &0`, +REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0 +THEN POP_ASSUM MP_TAC +THEN MESON_TAC[NEGLIGIBLE_AFF_3_UNION_INTER_BALL]);; + + +let HAS_MEASURE_AFF_3_UNION_INTER_BALL=prove(`!x:real^3 V:real^3->bool E:(real^3->bool)->bool z:real^3 y:real^3 r:real. +FAN (x,V,E) ==> (UNIONS {aff {x, z, v} | v IN V} INTER normball y r) has_measure &0`, +REPEAT STRIP_TAC +THEN ASM_MESON_TAC[NEGLIGIBLE_AFF_3_UNION_INTER_BALL;HAS_MEASURE_0]);; + + + +let MEASURABLE_AFF_3_UNION_INTER_BALL=prove(`!x:real^3 V:real^3->bool E:(real^3->bool)->bool z:real^3 y:real^3 r:real. +FAN (x,V,E) ==> measurable (UNIONS {aff {x, z, v} | v IN V} INTER normball y r)`, +REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[measurable;] +THEN EXISTS_TAC`&0` +THEN MRESA_TAC HAS_MEASURE_AFF_3_UNION_INTER_BALL[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`z:real^3 `;`y:real^3`;`r:real`] +);; + + +let measure_ball_diff_set_negligible=prove(`!x:real^3 V E z y r. +FAN(x,V,E)/\ &0<= r +==> measure ( (normball y r) DIFF (UNIONS {aff {x,z,v}| v IN V}))= &4/ &3 *pi *r pow 3`, +REPEAT STRIP_TAC +THEN MRESA_TAC MEASURE_AFF_3_UNION_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`z:real^3 `;`y:real^3`;`r:real`] +THEN MRESA_TAC MEASURABLE_AFF_3_UNION_INTER_BALL[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`z:real^3 `;`y:real^3`;`r:real`] + +THEN MRESA_TAC VOLUME_BALL[`y:real^3`;`r:real`] +THEN MRESAL_TAC MEASURE_DIFF_SUBSET[`normball (y:real^3) (r:real)`;`(UNIONS {aff {x,z,v:real^3}| v IN V}) INTER (normball y r)`][GSYM ball_eq_normball;MEASURABLE_BALL;SET_RULE`(UNIONS {aff {x,z,v:real^3}| v IN V}) INTER ball (y,r) SUBSET ball (y,r)`;SET_RULE`A DIFF(B INTER A)= A DIFF B`] +THEN ASM_SIMP_TAC[VOLUME_BALL;] +THEN REAL_ARITH_TAC);; + + + +let exists_measure_ball_diff_set_negligible=prove(`!x:real^3 V E y z r. +FAN(x,V,E)/\ &0< r +==> ?a. a IN (normball y r) DIFF (UNIONS {aff {x,z,v}| v IN V})`, +REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(normball y r) DIFF (UNIONS {aff {x,z,v:real^3}| v IN V}) ={} \/ ?a. a IN (normball y r) DIFF (UNIONS {aff {x,z,v}| v IN V})`) +THENL[ +MP_TAC(REAL_ARITH`&0 &0<= r`) +THEN RESA_TAC +THEN +MRESAL_TAC measure_ball_diff_set_negligible[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`z:real^3 `;`y:real^3`;`r:real`][MEASURE_EMPTY; ] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`A=B <=> B=A`;REAL_ENTIRE;REAL_ARITH`~(&4/ &3 = &0)`;] +THEN MP_TAC(REAL_ARITH`&0< pi ==> ~(pi= &0)`) +THEN ASM_REWRITE_TAC[PI_WORKS;] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0< r ==> ~(r= &0)`) +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC REAL_POW_EQ_0[`r:real`;`3`]; +ASM_REWRITE_TAC[]]);; + + + +let connected_in_dartset_leads_into_fan_union_aff_gt=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds ds1 Z. +FAN(x,V,E) +/\ conforming_fan (x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ ds1 IN face_set(hypermap1_of_fanx (x,V,E)) +/\ Z=(:real^3) DIFF (UNIONS {aff_ge {x} {v}| v IN V}) +==> ?y z. y IN dartset_leads_into_fan x V E ds +/\ z IN dartset_leads_into_fan x V E ds1 +/\ segment[y,z] SUBSET Z `, +REPEAT STRIP_TAC +THEN MRESA_TAC exists_point_in_dartset_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC exists_point_in_dartset_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`dartset_leads_into_fan x V E ds`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[open_def] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3`) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC exists_measure_ball_diff_set_negligible[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`y:real^3 `;`y':real^3`;`e:real`][normball;DIFF;IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`a:real^3`) +THEN EXISTS_TAC`a:real^3` +THEN EXISTS_TAC`y':real^3` +THEN ASM_REWRITE_TAC[segment;SUBSET;IN_ELIM_THM;SET_RULE`(x:real^3) IN (:real^3)`] +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "LINH" MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[UNIONS;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`aff{x,y',v:real^3}` +THEN STRIP_TAC +THENL(*1*)[ +EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*1*) +POP_ASSUM MP_TAC +THEN FIND_ASSUM(fun th-> MP_TAC(ISPEC `v:real^3` th))`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`(v:real^3) IN V` +THEN STRIP_TAC +THEN MRESA_TAC exists_inf_element_fix_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u1:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u'':real^3)`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC AFF_GE_1_1[`x:real^3`;`v:real^3`] +THEN ASM_REWRITE_TAC[aff;AFFINE_HULL_3;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`u <= &1 ==> u= &1 \/ &0< (&1 -u)`) +THEN RESA_TAC +THENL(*2*)[ + +REWRITE_TAC[VECTOR_ARITH`(&1 - &1) % a + &1 % y'=y'`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`y' IN xfan(x:real^3,V:real^3->bool,E)` ASSUME_TAC +THENL(*3*)[ +REWRITE_TAC[XFAN_EQ_UNIONS_AFF_GE_1_2;UNIONS;IN_ELIM_THM] +THEN EXISTS_TAC`aff_ge {x} {v,u'':real^3}` +THEN STRIP_TAC +THENL(*4*)[ + +EXISTS_TAC`{v,u'':real^3}` +THEN ASM_REWRITE_TAC[];(*4*) +MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u'':real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`&0:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &0`;REAL_ARITH`A+B+ &0=A+B`;VECTOR_ARITH`A+B+ &0 % C=A+B`]](*4*);(*3*) + +POP_ASSUM MP_TAC +THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` ds1:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`dartset_leads_into_fan x V E ds1 SUBSET yfan (x,V,E) /\ y' IN dartset_leads_into_fan x V E ds1 ==> y' IN yfan (x:real^3,V:real^3->bool,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan;IN_ELIM_THM;DIFF] +THEN SET_TAC[]](*3*);(*2*) + +MP_TAC(REAL_ARITH`&0< &1- u ==> ~((&1- u)= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`&1- u:real` +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - u) % a + u % y' = t1 % x + t2 % v <=> +(&1 - u) % a = t1 % x + (--u) % y' + t2 % v`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`(&1 - u) % a = t1 % x + --u % y' + t2 % v ==> (inv (&1 - u)) %((&1 - u) % a ) = inv (&1 - u)%(t1 % x + --u % y' + t2 % v:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C `;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`] +THEN STRIP_TAC +THEN EXISTS_TAC`inv (&1 - u) * t1:real` +THEN EXISTS_TAC`inv (&1 - u) * --u:real` +THEN EXISTS_TAC`inv (&1 - u) * t2:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1 - u) * t1 + inv (&1 - u) * --u + inv (&1 - u) * t2= +inv (&1 - u) * ((t1+t2)- u)`]]]);; + + + +let AFF_GT_1_1_SUBSET_DARTSET_LEADS_INTO_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y. +FAN(x,V,E) + +/\ conforming_fan (x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ~(E={}) +/\ ds IN face_set (hypermap1_of_fanx (x,V,E)) +/\ y IN dartset_leads_into_fan x V E ds +==> aff_gt {x} {y} SUBSET dartset_leads_into_fan x V E ds`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(dartset_leads_into_fan x V E ds):real^3->bool`;` y:real^3`] +THEN MRESAL_TAC AFF_GT_1_1[`x:real^3`;`y:real^3`][SET_RULE`DISJOINT {x} {y} <=> ~(x=y)`] +THEN REMOVE_THEN"YEU" MP_TAC +THEN FIND_ASSUM MP_TAC`conforming_fan (x:real^3,V,E)` +THEN REWRITE_TAC[conforming_fan;conforming_half_space_fan] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `ds:real^3#real^3#real^3#real^3->bool`) +THEN REWRITE_TAC[INTERS;IN_ELIM_THM;SUBSET] +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`(?y. y IN ds /\ + aff_gt {x:real^3, pr2 y', pr3 y'} {pr3 (f1_fan x V E y')} = + aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y)})` ASSUME_TAC +THENL[ +EXISTS_TAC`y':real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[]; +REMOVE_THEN"LINH"(fun th-> MRESA1_TAC th`u:real^3->bool`) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y' IN ds /\ ds SUBSET d1_fan (x:real^3,V,E)==> y' IN d1_fan(x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN REWRITE_TAC[pr2;pr3;f1_fan] +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`v:real^3`;`w:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` sigma_fan x V E v w:real^3`;`(v:real^3)`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E v w):real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`;`sigma_fan x V E v w:real^3`;`w:real^3`] +THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`w:real^3`;`sigma_fan x V E v w:real^3`;][IN_ELIM_THM;VECTOR_ARITH`(t1 % x + t2 % y) - x=((t1+t2)- &1)%x+ t2 % (y-x)`;VECTOR_ARITH`((&1 - &1) % x + t2 % (y - x))= t2 % (y - x)`;DOT_RMUL] +THEN STRIP_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]]);; + + +let aff_gt_subset_dartset_leads_into_fan_union_aff_gt=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds ds1 Z y z . +FAN(x,V,E) +/\ conforming_fan (x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ ds1 IN face_set(hypermap1_of_fanx (x,V,E)) +/\ Z=(:real^3) DIFF (UNIONS {aff_ge {x} {v}| v IN V}) +/\ y IN dartset_leads_into_fan x V E ds +/\ z IN dartset_leads_into_fan x V E ds1 +/\ ~(x=y) /\ ~(x=z) +/\ segment[y,z] SUBSET Z +==> aff_gt {x} {y,z} SUBSET Z`, +REWRITE_TAC[segment;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN FIND_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[FAN;fan2] THEN STRIP_TAC)`FAN(x:real^3,V,E)` +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`y:real^3`;`z:real^3`][SET_RULE`DISJOINT{x} {y,z}<=> ~(x=y) /\ ~(x=z)`;IN_ELIM_THM;DIFF;SET_RULE`(x:real^3) IN (:real^3)`;UNIONS] +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`~(x IN V) /\ v IN V==> ~(x=v:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC AFF_GE_1_1[`x:real^3`;`v:real^3`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % y + t3 % z = t1' % x + t2' % v +<=> t2 % y + t3 % z = (t1' - t1) % x + t2' % v`] +THEN MP_TAC(REAL_ARITH`&0< t2 /\ &0 < t3 ==> &0 < t2+ t3 /\ &0 <= t2+ t3 /\ ~(t2 +t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2+t3:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`t2 % y + t3 % z = (t1' - t1) % x + t2' % v ==> (inv (t2+ t3)) %(t2 % y + t3 % z) = inv (t2 +t3)%((t1' - t1) % x + t2' % v:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C `;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`] +THEN STRIP_TAC +THEN ABBREV_TAC`v123= (inv (t2 + t3) * (t1' - t1)) % x + (inv (t2 + t3) * t2') % v:real^3` +THEN SUBGOAL_THEN`v123 IN aff_ge {x} {v:real^3}` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`(inv (t2 + t3) * (t1' - t1)):real` +THEN EXISTS_TAC`(inv (t2 + t3) * t2'):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (t2 + t3) * (t1' - t1) + inv (t2 + t3) * t2' += inv (t2 + t3) * ((t2+ t3)+ (t1'+ t2') - (t1+ t2+t3))`; REAL_ARITH`A + &1 - &1= A`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN MRESA1_TAC REAL_LE_INV`t2+ t3`; + +SUBGOAL_THEN`(?u. (&0 <= u /\ u <= &1) /\ v123 = (&1 - u) % y + u % z:real^3)` ASSUME_TAC +THENL[ +EXISTS_TAC`(inv (t2 + t3) * t3)` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - inv (t2 + t3) * t3= &1 - inv (t2 +t3) *(t2+ t3)+ inv(t2 +t3) * t2`; REAL_ARITH`&1 - &1 +A=A`; REAL_ARITH`A<= &1 <=> &0<= &1- A`] +THEN MRESA1_TAC REAL_LT_INV`t2+t3` +THEN MP_TAC(REAL_ARITH`&0 < inv (t2 + t3) /\ &0< t2 /\ &0< t3 ==> &0 <= inv (t2 + t3) /\ &0<= t2 /\ &0<= t3`) +THEN RESA_TAC +THEN STRIP_TAC +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[]; +REMOVE_THEN "LINH"(fun th-> MRESAL1_TAC th`v123:real^3`[DIFF;IN_ELIM_THM;UNIONS]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN EXISTS_TAC`aff_ge {x} {v:real^3}` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]]]);; + +let aff_gt_1_2_subset_aff_1_3111=prove(`!x y z v u w:real^3. +~coplanar {x,v,u,w} +/\ y IN aff_gt {x} {v,u} +/\ z IN aff_gt {x} {v,w} +==> aff_gt {x} {y,z} SUBSET aff_gt {x} {v,u,w}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`w:real^3`;`z:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`y:real^3`;`v:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`z:real^3`;`v:real^3`] +THEN REMOVE_THEN "LINH" MP_TAC +THEN REMOVE_THEN "LINH1" MP_TAC +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT {x} {v,u,w} <=> ~(x=v) /\ ~(x=u) /\ ~(x=w)`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`y:real^3`;`z:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT {x} {v,u} <=> ~(x=v) /\ ~(x=u)`;SUBSET] +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[VECTOR_ARITH` t1'' % x + + t2'' % (t1' % x + t2' % v + t3' % u) + + t3'' % (t1 % x + t2 % v + t3 % w) += (t1''+ t2''* t1'+ t3'' *t1) % x + + (t2'' * t2'+ t3'' *t2) % v + (t2''* t3') % u + + (t3''* t3) % w`] +THEN EXISTS_TAC`t1'' + t2'' * t1' + t3'' * t1:real` +THEN EXISTS_TAC`t2'' * t2' + t3'' * t2:real` +THEN EXISTS_TAC`t2'' * t3':real` +THEN EXISTS_TAC`t3'' * t3:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`(t1'' + t2'' * t1' + t3'' * t1) + + (t2'' * t2' + t3'' * t2) + + t2'' * t3' + + t3'' * t3 = t1'' + + t2'' * (t1' + t2'+ t3') + + t3'' * (t1 + t2 + t3 )`;REAL_ARITH`A * &1=A`] +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC (REAL_ARITH`&0< A/\ &0< B==> &0< A+B`) +THEN STRIP_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]; + +STRIP_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]]);; + + +let AFF_GT_1_3_SUBSET_AFF_GT_1_3=prove(`!x v u w:real^3 t:real. +~coplanar {x,v,u,w}/\ &0< t/\ t< &1 +==> aff_gt {x} {v,u,(&1-t) %u+ t %w} SUBSET aff_gt {x} {v,u,w}`, +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0< t==> ~(t= &0)`) +THEN RESA_TAC +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `t:real`) +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`(&1-t) %u+ t %w:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`(&1-t) %u+ t %w:real^3`] +THEN MRESAL_TAC AFF_GT_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT {x} {v,u,w} <=> ~(x=v) /\ ~(x=u) /\ ~(x=w)`] +THEN MRESAL_TAC AFF_GT_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`(&1-t) %u+ t %w:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT {x} {v,u,w} <=> ~(x=v) /\ ~(x=u) /\ ~(x=w)`;SUBSET] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t3 + t4 *( &1- t):real` +THEN EXISTS_TAC`t4 *t:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % u + t4 % ((&1 - t) % u + t % w) = + t1 % x + t2 % v + (t3 + t4 * (&1 - t)) % u + (t4 * t) % w:real^3`;REAL_ARITH`t1 + t2 + (t3 + t4 * (&1 - t)) + t4 * t=t1 +t2+t3+t4` +] +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC (REAL_ARITH`&0< A /\ &0< B==> &0< A+B`) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1- A<=> A< &1`]; +MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1- A<=> A< &1`]]);; + + + + + + + + +let lemma_connect_hypermap=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) f1 f2. +FAN(x,V,E) +/\ conforming_fan (x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ f1 IN d_fan(x,V,E) /\ f2 IN d_fan(x,V,E) +==> ?D. D IN set_of_components(hypermap1_of_fanx (x,V,E)) +/\ f1 IN D /\ f2 IN D`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN ABBREV_TAC`ds= face (hypermap1_of_fanx (x,V,E)) (f1:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`ds1= face (hypermap1_of_fanx (x,V,E)) (f2:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`Z=(:real^3) DIFF (UNIONS {aff_ge {x} {v:real^3}| v IN V})` +THEN SUBGOAL_THEN`ds IN face_set(hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL(*1*)[ + +ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`f1:real^3#real^3#real^3#real^3` +THEN EXPAND_TAC"ds" +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[];(*1*) + +SUBGOAL_THEN`ds1 IN face_set(hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL(*2*)[ + +ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`f2:real^3#real^3#real^3#real^3` +THEN EXPAND_TAC"ds1" +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[];(*2*) + +SUBGOAL_THEN`f2 IN ds1:real^3#real^3#real^3#real^3->bool` ASSUME_TAC +THENL(*3*)[ +EXPAND_TAC"ds1" +THEN REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC;(*3*) + +SUBGOAL_THEN`f1 IN ds:real^3#real^3#real^3#real^3->bool` ASSUME_TAC +THENL(*4*)[ +EXPAND_TAC"ds" +THEN REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC;(*4*) + +ABBREV_TAC`D= comb_component (hypermap1_of_fanx (x,V,E)) (f1:real^3#real^3#real^3#real^3)` +THEN MRESA_TAC lemma_component_subset[`hypermap1_of_fanx (x:real^3,V,E)`;`f1:real^3#real^3#real^3#real^3`] +THEN SUBGOAL_THEN`D IN set_of_components(hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL(*5*)[ + +ASM_REWRITE_TAC[set_of_components;set_part_components;IN_ELIM_THM] +THEN EXISTS_TAC`f1:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[];(*5*) + + +SUBGOAL_THEN`(f1:real^3#real^3#real^3#real^3) IN D`ASSUME_TAC +THENL(*6*)[ +EXPAND_TAC"D" +THEN REWRITE_TAC[comb_component;IN_ELIM_THM;is_in_component] +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`(\m. (f1_fan (x:real^3) V E POWER m) f1)` +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[POWER;I_DEF;is_path];(*6*) + +MRESAL_TAC connected_in_dartset_leads_into_fan_union_aff_gt[`x:real^3`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`ds1:real^3#real^3#real^3#real^3->bool`;`Z:real^3->bool`][segment;IN_ELIM_THM] +THEN +ABBREV_TAC`TA={t| &0 <= t /\ t <= &1 /\ (?f. f IN D /\ (&1 - t) % (y:real^3) + t % z IN dartset_leads_into_fan x V E (face (hypermap1_of_fanx (x:real^3,V,E)) f))}` +THEN ABBREV_TAC`t1= sup (TA:real->bool)` +THEN SUBGOAL_THEN`&0 IN TA:real->bool `ASSUME_TAC +THENL(*7*)[ + EXPAND_TAC"TA" +THEN REWRITE_TAC[IN_ELIM_THM;REAL_ARITH`&0<= &0 /\ &0<= &1`;VECTOR_ARITH`(&1 - &0) % y + &0 % z=y`] +THEN EXISTS_TAC`f1:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[];(*7*) + + +MP_TAC(SET_RULE`&0 IN TA ==> ~(TA ={})`) +THEN RESA_TAC +THEN EXISTS_TAC`D:real^3#real^3#real^3#real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(SET_RULE`(y=z:real^3) \/ ~(z=y)`) +THENL(*8*)[ + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`z IN dartset_leads_into_fan (x:real^3) V E ds1` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`z IN dartset_leads_into_fan (x:real^3) V E ds` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN FIND_ASSUM MP_TAC`conforming_fan (x:real^3,V,E)` +THEN REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `dartset_leads_into_fan x V E (ds:real^3#real^3#real^3#real^3->bool)`) +THEN POP_ASSUM(fun th-> MRESA1_TAC th ` (ds1:real^3#real^3#real^3#real^3->bool)` THEN MRESA1_TAC th ` (ds:real^3#real^3#real^3#real^3->bool)`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC lemma_face_subset_component[`hypermap1_of_fanx (x:real^3,V,E)`;`f1:real^3#real^3#real^3#real^3`] +THEN ASM_TAC +THEN SET_TAC[];(*8*) + +SUBGOAL_THEN`(?b. !a. a IN TA ==> a <= b)` ASSUME_TAC +THENL(*9*)[ + +EXISTS_TAC`&1` +THEN EXPAND_TAC"TA" +THEN REWRITE_TAC[IN_ELIM_THM;REAL_ARITH`&0<= &0 /\ &0<= &1`;VECTOR_ARITH`(&1 - &0) % y + &0 % z=y`] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[];(*9*) + +SUBGOAL_THEN`(!a. a IN TA ==> a <= &1)` ASSUME_TAC +THENL(*10*)[ + +EXPAND_TAC"TA" +THEN REWRITE_TAC[IN_ELIM_THM;REAL_ARITH`&0<= &0 /\ &0<= &1`;VECTOR_ARITH`(&1 - &0) % y + &0 % z=y`] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[];(*10*) + +MRESA1_TAC SUP`TA:real->bool` +THEN POP_ASSUM(fun th-> MRESA1_TAC th `&1` THEN POP_ASSUM MP_TAC THEN ASSUME_TAC th THEN STRIP_TAC) +THEN DISJ_CASES_TAC(SET_RULE` (t1:real) IN TA\/ ~(t1 IN TA)`) +THENL(*11*)[ + +POP_ASSUM MP_TAC +THEN EXPAND_TAC "TA" +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x,V,E)) (f:real^3#real^3#real^3#real^3)` +THEN MP_TAC(SET_RULE`D SUBSET d1_fan (x:real^3,V,E) /\ f IN D==> f IN d1_fan (x,V,E)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`ds2 IN face_set(hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL(*12*)[ +ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`f:real^3#real^3#real^3#real^3` +THEN EXPAND_TAC"ds2" +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[];(*12*) + +MP_TAC(REAL_ARITH`(t1:real) <= &1 ==> t1= &1 \/ t1< &1`) +THEN RESA_TAC +THENL(*13*)[ + +ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - &1) % y + &1 % z=z`] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`z IN dartset_leads_into_fan (x:real^3) V E ds1` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y'':real^3`;`z:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN FIND_ASSUM MP_TAC`conforming_fan (x:real^3,V,E)` +THEN REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `dartset_leads_into_fan x V E (ds2:real^3#real^3#real^3#real^3->bool)`) +THEN POP_ASSUM(fun th-> MRESA1_TAC th ` (ds1:real^3#real^3#real^3#real^3->bool)` THEN MRESA1_TAC th ` (ds2:real^3#real^3#real^3#real^3->bool)`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC lemma_component_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`f1:real^3#real^3#real^3#real^3`;`f:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC lemma_face_subset_component[`hypermap1_of_fanx (x:real^3,V,E)`;`f:real^3#real^3#real^3#real^3`] +THEN ASM_TAC +THEN SET_TAC[];(*13*) + +STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`dartset_leads_into_fan x V E ds2`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[open_def] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(&1 - t1) % y + t1 % z:real^3`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[dist] +THEN ABBREV_TAC`t2=min (inv(norm(z-y:real^3)) *e) (&1- t1)/ &2 + t1 ` +THEN MRESAL_TAC imp_norm_gl_zero_fan[`z:real^3`;`y:real^3`][REAL_ARITH`A>B <=> B t1< min (inv (norm (z - y)) * e) (&1 - t1) / &2 + t1/\ min (inv (norm (z - y)) * e) (&1 - t1) / &2 + t1 <= &1 /\ &0 <= min (inv (norm (z - y)) * e) (&1 - t1) / &2 + t1/\ &0 <= min (inv (norm (z - y)) * e) (&1 - t1) / &2 +/\ min (inv (norm (z - y)) * e) (&1 - t1) / &2 < e * inv (norm (z - y)) `) +THEN RESA_TAC +THEN MP_TAC(ISPEC`min (inv (norm (z - y:real^3)) * e) (&1 - t1) / &2:real`REAL_ABS_REFL) +THEN RESA_TAC +THEN SUBGOAL_THEN`norm (((&1 - t2) % y + t2 % z:real^3) - ((&1 - t1) % y + t1 % z)) < e` +ASSUME_TAC +THENL(*14*)[ +EXPAND_TAC"t2" +THEN REWRITE_TAC[VECTOR_ARITH`(((&1 - (min (inv (norm (z - y)) * e) (&1 - t1) / &2 + t1)) % y + + (min (inv (norm (z - y)) * e) (&1 - t1) / &2 + t1) % z) - + ((&1 - t1) % y + t1 % z)) += (min (inv (norm (z - y)) * e) (&1 - t1) / &2) % (z-y)`;NORM_MUL] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC imp_norm_not_zero_fan[`z:real^3`;`y:real^3`] +THEN MRESA1_TAC NORM_POS_LE`z-y:real^3` +THEN MP_TAC(REAL_ARITH`&0 <= norm (z - y) /\ ~(norm (z - y) = &0) ==> &0 < norm (z - y:real^3)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`norm(z-y:real^3)` +THEN MRESAL_TAC REAL_LT_RMUL[`min (inv (norm (z - y:real^3)) * e) (&1 - t1) / &2`;`e * inv (norm (z - y:real^3))`;`norm (z - y:real^3)`][REAL_ARITH`(A * B) *C= A *(B*C)`;REAL_ARITH`A * &1=A`];(*14*) + +STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`((&1 - t2) % y + t2 % z:real^3)`) +THEN SUBGOAL_THEN`(t2:real) IN TA` ASSUME_TAC +THENL(*15*)[ + +EXPAND_TAC "TA" +THEN REWRITE_TAC[IN_ELIM_THM] +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`f:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[];(*15*) + +FIND_ASSUM (fun th-> MP_TAC(ISPEC `t2:real` th))`!x:real. x IN TA ==> x <= t1` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;REAL_ARITH`A<=B <=> ~(B< A)`]) +THEN ASM_REWRITE_TAC[]](*15*)](*14*)](*13*)](*12*);(*11*) + + +POP_ASSUM (fun th-> MP_TAC th THEN ASSUME_TAC th) +THEN EXPAND_TAC "TA" +THEN REWRITE_TAC[IN_ELIM_THM;DE_MORGAN_THM] +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC`&0` th))`!x. x IN TA ==> x <= t1:real` +THEN FIND_ASSUM (fun th-> REWRITE_TAC[th])`&0 IN TA` +THEN RESA_TAC +THEN REWRITE_TAC[NOT_EXISTS_THM;DE_MORGAN_THM] +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN DISJ_CASES_TAC(SET_RULE`~(!e. +&0< e ==> +?e1 f3. &0 < e1 /\ e1< e /\ f3 IN D +/\ ((&1 -(t1-e1)) % y + (t1-e1) % z:real^3) IN +dartset_leads_into_fan x V E (face (hypermap1_of_fanx (x:real^3,V,E)) f3))\/ (!e. +&0< e ==> +?e1 f3. &0 < e1 /\ e1< e /\ f3 IN D +/\ ((&1 -(t1-e1)) % y + (t1-e1) % z) IN +dartset_leads_into_fan x V E (face (hypermap1_of_fanx (x:real^3,V,E)) f3)) `) +THENL(*12*)[ + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_EXISTS_THM;NOT_IMP;NOT_FORALL_THM] +THEN REWRITE_TAC[DE_MORGAN_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN SUBGOAL_THEN`(!a. a IN TA ==> a <= t1- e/ &2)`ASSUME_TAC +THENL(*13*)[ + +GEN_TAC THEN +STRIP_TAC +THEN POP_ASSUM( fun th-> MP_TAC th THEN ASSUME_TAC th) +THEN EXPAND_TAC "TA" +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0< e ==> &0< e/ &2 /\ e/ &2 < e`) +THEN RESA_TAC +THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `a:real` th))`!x. x IN TA ==> x <= t1:real` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`a:real IN TA` +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`a<= t1==> a=t1 \/ a< t1`) +THEN RESA_TAC +THENL(*14*)[ + +FIND_ASSUM MP_TAC`a:real IN TA` +THEN POP_ASSUM (fun th-> REWRITE_TAC[th;] ) +THEN EXPAND_TAC"TA" +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN"LINH"(fun th-> MRESA1_TAC th`f':real^3#real^3#real^3#real^3`);(*14*) + + +MP_TAC(REAL_ARITH`a &0< t1 -a`) +THEN RESA_TAC +THEN REMOVE_THEN "LINH1"(fun th-> MRESAL_TAC th[`t1-a:real`;`f:real^3#real^3#real^3#real^3`][REAL_ARITH`(t1 - (t1 - a))=a`]) +THEN MP_TAC(REAL_ARITH`~(t1 - a < e) /\ &0< e==> a<= t1 - e/ &2`) +THEN RESA_TAC](*14*);(*13*) + +FIND_ASSUM (fun th-> MP_TAC(ISPEC `t1- e / &2` th))`!b. (!x. x IN TA ==> x <= b) ==> t1 <= b:real` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC](*13*);(*12*) + + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN SUBGOAL_THEN`(&1 - t1) % y + t1 % z IN {(&1 - u) % y + u % z:real^3 | &0 <= u /\ u <= &1}` ASSUME_TAC +THENL(*13*)[ + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[];(*13*) + + +MP_TAC(SET_RULE`(&1 - t1) % y + t1 % z IN {(&1 - u) % y + u % z:real^3 | &0 <= u /\ u <= &1} /\ {(&1 - u) % y + u % z | &0 <= u /\ u <= &1} SUBSET Z ==> (&1 - t1) % y + t1 % z IN Z`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC yfan_union_aff_gt_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th; UNION;IN_ELIM_THM;GSYM UNIONS_TOPOLOGICAL_COMPONENT_EQ_YFAN;UNIONS]) +THEN STRIP_TAC +THENL(*14*)[ + +POP_ASSUM MP_TAC +THEN MRESA_TAC version_JUTSTKG[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3->bool`] +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`dartset_leads_into_fan x V E f`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[open_def] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(&1 - t1) % y + t1 % z:real^3`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[dist] +THEN DISCH_THEN(LABEL_TAC"LINH2") +THEN MRESAL_TAC imp_norm_gl_zero_fan[`z:real^3`;`y:real^3`][REAL_ARITH`A>B <=> B MRESA1_TAC th ` inv(norm(z-y:real^3)) * e:real`) +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`norm (((&1 - (t1- e1)) % y + (t1- e1) % z:real^3) - ((&1 - t1) % y + t1 % z)) < e` +ASSUME_TAC +THENL(*15*)[ + +REWRITE_TAC[VECTOR_ARITH`(((&1 - (t1 - e1)) % y + (t1 - e1) % z) - ((&1 - t1) % y + t1 % z)) += --(e1 %(z-y))`;NORM_NEG;NORM_MUL] +THEN MRESA_TAC imp_norm_not_zero_fan[`z:real^3`;`y:real^3`] +THEN MRESA1_TAC NORM_POS_LE`z-y:real^3` +THEN MP_TAC(REAL_ARITH`&0 <= norm (z - y) /\ ~(norm (z - y) = &0) /\ &0< e1 ==> &0 < norm (z - y:real^3)/\ &0<= e1`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`norm(z-y:real^3)` +THEN MP_TAC(ISPEC`e1:real`REAL_ABS_REFL) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LT_RMUL[`e1:real`;`inv (norm (z - y:real^3)) * (e:real)`;`(norm (z - y:real^3))`][REAL_ARITH`(A * B) *C= B*(A*C)`;REAL_ARITH`A * &1=A`];(*15*) + + +REMOVE_THEN"LINH2"(fun th-> MRESA1_TAC th`((&1 - (t1 - e1)) % y + (t1 - e1) % z):real^3`) +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC`y12=((&1 - (t1 - e1)) % y + (t1 - e1) % z):real^3` +THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x,V,E)) (f3:real^3#real^3#real^3#real^3)` +THEN MP_TAC(SET_RULE`D SUBSET d1_fan (x:real^3,V,E) /\ f3 IN D==> f3 IN d1_fan (x,V,E)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`ds2 IN face_set(hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL(*16*)[ + +ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`f3:real^3#real^3#real^3#real^3` +THEN EXPAND_TAC"ds2" +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[];(*16*) + +STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`y12:real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`dartset_leads_into_fan x V E f IN topological_component_yfan (x:real^3,V,E)` +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`y12:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th`f3:real^3#real^3#real^3#real^3`) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[SYM th])](*16*)](*15*);(*14*) + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th] THEN STRIP_TAC) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MP_TAC(REAL_ARITH`(t1:real) <= &1 ==> t1= &1 \/ t1< &1`) +THEN RESA_TAC +THENL(*15*)[ + +REWRITE_TAC[VECTOR_ARITH`(&1 - &1) % y + &1 % z=z`] +THEN STRIP_TAC +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;` (w:real^3)`] +THEN MP_TAC(SET_RULE`z IN aff_gt {x} {v, w} /\ aff_ge {x} {v, w} = + aff_gt {x} {v, w} UNION aff_ge {x} {v} UNION aff_ge {x} {w} +==> z IN aff_ge {x} {v, w:real^3} `) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN SUBGOAL_THEN`z IN xfan(x:real^3,V:real^3->bool,E)`ASSUME_TAC +THENL(*16*)[ +REWRITE_TAC[xfan;IN_ELIM_THM] +THEN EXISTS_TAC`{v,w:real^3}` +THEN ASM_REWRITE_TAC[IN] +THEN ASM_MESON_TAC[IN];(*16*) + +MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` ds1:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`z IN dartset_leads_into_fan x V E ds1 /\ dartset_leads_into_fan x V E ds1 SUBSET yfan(x:real^3,V,E) ==> z IN yfan(x:real^3,V,E)`) +THEN ASM_REWRITE_TAC[yfan;IN_ELIM_THM;DIFF]](*16*);(*15*) + +STRIP_TAC +THEN ABBREV_TAC`v1=(&1 - t1) % y + t1 % z:real^3` +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`w:real^3`;`v1:real^3`] +THEN MP_TAC(SET_RULE`{v,w:real^3} IN E==> ~(E={})`) +THEN RESA_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(dartset_leads_into_fan x V E ds):real^3->bool`;` y:real^3`] +THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(dartset_leads_into_fan x V E ds1):real^3->bool`;` z:real^3`] +THEN SUBGOAL_THEN`~(collinear{x,y,z:real^3})` ASSUME_TAC +THENL(*16*)[ + +MRESAL_TAC collinear1_fan[`(x:real^3)` ;` (z:real^3)`;`(y:real^3)`;][aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`v'= &0\/ &0< -- v' \/ &0 < v'`) +THENL(*17*)[ + +ASM_REWRITE_TAC[REAL_ARITH`A + &0=A`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`&1 % x + &0 % z= x`];(*17*) + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL(*18*)[ + +REWRITE_TAC[VECTOR_ARITH`y = u' % x + v' % z <=> u' % x =y +(--v') % z `] +THEN DISJ_CASES_TAC(SET_RULE`u'= &0 \/ ~(u'= &0)`) +THENL(*19*)[ + +ASM_REWRITE_TAC[REAL_ARITH`&0+A=A`;] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`&0 % x = y + -- &1 % z <=> y=z`];(*19*) +STRIP_TAC +THEN MRESA1_TAC REAL_MUL_LINV`u':real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`u' % x = y + --v' % z ==> (inv (u')) %(u' % x ) = inv (u')%(y + --v' % z:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C `;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`x IN {(&1 - u) % y + u % z:real^3 | &0 <= u /\ u <= &1}` ASSUME_TAC +THENL(*20*)[ +MP_TAC(REAL_ARITH`~(u'= &0) ==> &0< u'\/ &0 < -- u'`) +THEN RESA_TAC +THENL(*21*)[ + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`(inv u' * --v')` +THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 - inv u' * --v')=( &1 - inv u' * u')+ inv u' *(u'+v') `;REAL_ARITH`&1 - &1 + inv u' * &1 = inv u'`;REAL_ARITH`A<= &1<=> &0<= &1 -A `] +THEN MP_TAC(REAL_ARITH`&0< -- v' /\ &0 < u' ==> &0<= -- v' /\ &0 <= u'`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LE_INV`u':real` +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[];(*21*) + +MP_TAC(REAL_ARITH`&0< --v' /\ &0 < -- u' ==> &0 < --(u'+v')`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC](*21*);(*20*) + +MP_TAC(SET_RULE`x IN {(&1 - u) % y + u % z | &0 <= u /\ u <= &1} +/\ {(&1 - u) % y + u % z:real^3 | &0 <= u /\ u <= &1} SUBSET Z +==> x IN Z`) +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN EXPAND_TAC"Z" +THEN REWRITE_TAC[DIFF;IN_ELIM_THM;SET_RULE`x IN (:real^3)`;UNIONS;IN_ELIM_THM] +THEN EXISTS_TAC`aff_ge {x} {v:real^3}` +THEN MRESA_TAC point_in_aff_ge_1_1[`(x:real^3)`;`(v:real^3) `] +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]](*20*)](*19*);(*18*) + + + +REPEAT STRIP_TAC +THEN SUBGOAL_THEN`y IN aff_gt {x} {z:real^3}` ASSUME_TAC +THENL(*19*)[ + +MRESAL_TAC AFF_GT_1_1[`x:real^3`;`z:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT {x} {y}<=> ~(x=y)`] +THEN EXISTS_TAC`u':real` +THEN EXISTS_TAC`v':real` +THEN ASM_REWRITE_TAC[];(*19*) + +MRESA_TAC AFF_GT_1_1_SUBSET_DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`z:real^3`] +THEN MP_TAC(SET_RULE`y IN aff_gt {x} {z:real^3}/\ aff_gt {x} {z} SUBSET dartset_leads_into_fan x V E ds1 +==> y IN dartset_leads_into_fan x V E ds1`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y'':real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN FIND_ASSUM MP_TAC`y IN dartset_leads_into_fan (x:real^3) V E ds` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`&1 IN TA:real->bool` ASSUME_TAC +THENL(*20*)[ + +EXPAND_TAC "TA" +THEN REWRITE_TAC[IN_ELIM_THM; REAL_ARITH`&0<= &1 /\ &1<= &1`;VECTOR_ARITH`(&1 - &1) % y + &1 % z=z`] +THEN EXISTS_TAC`f1:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[];(*20*) + + +FIND_ASSUM (fun th-> MP_TAC(ISPEC `&1` th))`!x. x IN TA ==> x <= t1:real` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC](*20*)](*19*)](*18*)](*17*);(*16*) + + +POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`v1 IN {(&1 - u) % y + u % z:real^3 | &0 <= u /\ u <= &1}` ASSUME_TAC +THENL(*17*)[ + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[];(*17*) + +SUBGOAL_THEN`~(x= v1:real^3)` ASSUME_TAC +THENL(*18*)[ + STRIP_TAC +THEN MP_TAC(SET_RULE`v1 IN {(&1 - u) % y + u % z | &0 <= u /\ u <= &1} +/\ {(&1 - u) % y + u % z:real^3 | &0 <= u /\ u <= &1} SUBSET Z +==> v1 IN Z`) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN EXPAND_TAC"Z" +THEN REWRITE_TAC[DIFF;IN_ELIM_THM;SET_RULE`x IN (:real^3)`;UNIONS;IN_ELIM_THM] +THEN EXISTS_TAC`aff_ge {x} {v:real^3}` +THEN MRESA_TAC point_in_aff_ge_1_1[`(x:real^3)`;`(v:real^3) `] +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*18*) + + MP_TAC(SET_RULE`&0 IN TA /\ ~(t1 IN TA)==> ~(t1= &0)`) +THEN RESA_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`~collinear{x,y,v1:real^3}` ASSUME_TAC +THENL(*19*)[ + +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN MRESAL_TAC collinear1_fan[`(x:real^3)` ;` (y:real^3)`;`(z:real^3)`;][aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN MRESAL_TAC collinear1_fan[`(x:real^3)` ;` (y:real^3)`;`(v1:real^3)`;][aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN REWRITE_TAC[CONTRAPOS_THM] +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - t1) % y + t1 % z = u' % x + v' % y +<=> t1 % z= u' % x + (v'- &1 +t1) %y`] +THEN MRESA1_TAC REAL_MUL_LINV`t1:real` +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`t1 % z = u' % x + (v' - &1 + t1) % y ==> (inv (t1)) %(t1 % z ) = inv (t1)%(u' % x + (v' - &1 + t1) % y:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C `;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`] +THEN RESA_TAC +THEN EXISTS_TAC`inv t1 * u':real` +THEN EXISTS_TAC`(inv t1 * (v' - &1 + t1)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t1 * u' +(inv t1 * (v' - &1 + t1))= inv t1 * ((u'+ v')- &1 +t1)`;REAL_ARITH`&1- &1+A=A`];(*19*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`v1 IN aff_gt {x} {y,z:real^3}` ASSUME_TAC +THENL(*20*)[ + +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`y:real^3`;`z:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1- t1` +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A= &0 % X +A`;REAL_ARITH`&0< &1- t1 <=> t1< &1`;] +THEN MP_TAC(REAL_ARITH`&0<= t1 /\ ~(t1= &0)==> &0< t1`) +THEN RESA_TAC +THEN REAL_ARITH_TAC;(*20*) + +MRESAL_TAC aff_gt3_subset_aff_gt[`x:real^3`;`y:real^3`;`z:real^3`;`v1:real^3`][SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`coplanar{x,v1,v,y}\/ ~coplanar{x,v1,v,y:real^3}`) +THENL(*21*)[ + +MRESAL_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v1:real^3`;`v:real^3`;`y:real^3`][DE_MORGAN_THM;] +THENL(*22*)[ + + +MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v1:real^3`;`v:real^3`;`y:real^3`] +THEN MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{x,v1:real^3}`;`{v:real^3}`] +THEN MP_TAC(SET_RULE`y IN aff_gt {x, v1} {v}/\ aff_gt {x, v1} {v} SUBSET aff_ge {x, v1} {v} +==> y IN aff_ge {x, v1} {v:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC decomposition_planar_by_angle_fan[`x:real^3`;`v1:real^3`;`v:real^3`;`y:real^3`] +THENL(*23*)[ + +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESAL_TAC aff_gt_subset_dartset_leads_into_fan_union_aff_gt[`x:real^3`;`(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`ds1:real^3#real^3#real^3#real^3->bool`;`Z:real^3->bool`;`y:real^3`;`z:real^3`][segment] +THEN MP_TAC(SET_RULE`v IN aff_gt {x} {y,v1:real^3}/\ aff_gt {x} {y, v1} SUBSET aff_gt {x} {y, z} +/\ aff_gt {x} {y, z} SUBSET Z==> v IN Z`) +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"Z" +THEN REWRITE_TAC[DIFF;IN_ELIM_THM;UNIONS;NOT_EXISTS_THM;DE_MORGAN_THM] +THEN MRESAL_TAC point_in_aff_ge_1_1[`(x:real^3)`;`(v:real^3) `][IN_SING] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `aff_ge {x} {v:real^3}`) +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`);(*23*) + + +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{x:real^3}`;`{v:real^3,w}`] +THEN MP_TAC(SET_RULE`aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w:real^3} +/\ v1 IN aff_gt {x} {v, w} ==> v1 IN aff_ge {x} {v, w}`) +THEN RESA_TAC +THEN MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`w:real^3`; `v:real^3`;`v1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`aff_ge {x} {v, v1} SUBSET aff_ge {x} {v, w} /\ y IN aff_ge {x} {v, v1} ==> y IN aff_ge {x} {v, w:real^3}`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y IN dartset_leads_into_fan x V E ds +/\ dartset_leads_into_fan x V E ds SUBSET yfan(x,V,E)==> y IN yfan(x:real^3,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan;DIFF;IN_ELIM_THM;xfan;NOT_EXISTS_THM;DE_MORGAN_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`{v,w:real^3}`) +THEN ASM_TAC +THEN REWRITE_TAC[IN] +THEN REPEAT RESA_TAC](*23*);(*22*) + + + + +MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`w:real^3`;`v:real^3`;`v1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3 `;`v1:real^3`] +THEN MRESAL_TAC sum4_azim_fan[`x:real^3`;`v1:real^3`;`v:real^3`;`w:real^3`;`y:real^3`][REAL_ARITH`pi<=pi`;REAL_ARITH`pi = pi + azim x v1 w y <=> azim x v1 w y= &0`] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v1:real^3`;`w:real^3`;`y:real^3`] +THEN MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{x,v1:real^3}`;`{w:real^3}`] +THEN MP_TAC(SET_RULE`y IN aff_gt {x, v1} {w}/\ aff_gt {x, v1} {w} SUBSET aff_ge {x, v1} {w} +==> y IN aff_ge {x, v1} {w:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC decomposition_planar_by_angle_fan[`x:real^3`;`v1:real^3`;`w:real^3`;`y:real^3`] +THENL(*23*)[ + +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESAL_TAC aff_gt_subset_dartset_leads_into_fan_union_aff_gt[`x:real^3`;`(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`ds1:real^3#real^3#real^3#real^3->bool`;`Z:real^3->bool`;`y:real^3`;`z:real^3`][segment] +THEN MP_TAC(SET_RULE`w IN aff_gt {x} {y,v1:real^3}/\ aff_gt {x} {y, v1} SUBSET aff_gt {x} {y, z} +/\ aff_gt {x} {y, z} SUBSET Z==> w IN Z`) +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"Z" +THEN REWRITE_TAC[DIFF;IN_ELIM_THM;UNIONS;NOT_EXISTS_THM;DE_MORGAN_THM] +THEN MRESAL_TAC point_in_aff_ge_1_1[`(x:real^3)`;`(w:real^3) `][IN_SING] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `aff_ge {x} {w:real^3}`) +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`; +` (w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*23*) + + + +MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{x:real^3}`;`{v:real^3,w}`] +THEN MP_TAC(SET_RULE`aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w:real^3} +/\ v1 IN aff_gt {x} {v, w} ==> v1 IN aff_ge {x} {v, w}`) +THEN RESA_TAC +THEN MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`v:real^3`; `w:real^3`;`v1:real^3`] +THEN MP_TAC(SET_RULE`aff_ge {x} {v1,w} SUBSET aff_ge {x} {v, w} /\ y IN aff_ge {x} {v1,w} ==> y IN aff_ge {x} {v, w:real^3}`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y IN dartset_leads_into_fan x V E ds +/\ dartset_leads_into_fan x V E ds SUBSET yfan(x,V,E)==> y IN yfan(x:real^3,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan;DIFF;IN_ELIM_THM;xfan;NOT_EXISTS_THM;DE_MORGAN_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`{v,w:real^3}`) +THEN ASM_TAC +THEN REWRITE_TAC[IN] +THEN REPEAT RESA_TAC](*23*)](*22*);(*21*) + + +MRESAL_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v1:real^3`;`v:real^3`;`y:real^3`][DE_MORGAN_THM;] +THEN MP_TAC(REAL_ARITH`&0<= azim x v1 v y /\ azim x v1 v y < &2 * pi /\ ~(azim x v1 v y = &0)/\ ~(azim x v1 v y= pi)==> (&0< azim x v1 v y/\ azim x v1 v y < pi)\/ (pi< azim x v1 v y/\ azim x v1 v y < &2 * pi)`) +THEN ASM_REWRITE_TAC[azim] +THEN STRIP_TAC +THENL(*22*)[ + +MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`; `y:real^3`;`v:real^3`] +THEN ABBREV_TAC`u123=inverse1_sigma_fan x V E v w:real^3` +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`) +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u123:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u123:real^3)`; +` (v:real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`; `w:real^3`;`u123:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN MRESA_TAC aff_gt_1_2_cross_dotr_4point_neg[`x:real^3`;`v1:real^3`;`y:real^3`;`v:real^3`;`w:real^3`;] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REWRITE_TAC[GSYM DOT_LNEG;GSYM CROSS_SKEW] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN MRESA_TAC exists_open_not_collinear[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (w:real^3)`;`(v:real^3)`;`(u123:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN SUBGOAL_THEN`(!h. &0 < h /\ h < t1' / &2 ==> ~collinear {x, (&1 - h) % v + h % u123, w:real^3})`ASSUME_TAC +THENL(*23*)[ + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CHANGE") +THEN GEN_TAC THEN STRIP_TAC +THEN REMOVE_THEN "CHANGE"(fun th-> MRESA1_TAC th`h:real`) +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*23*) + +MP_TAC(REAL_ARITH`&0< t1' /\ t1'<= &1==> &0< t1'/ &2 /\ t1'/ &2 < &1`) +THEN RESA_TAC +THEN MRESAL_TAC condition_4point_aff_gt_1_2inter_aff_gt_1_2[`x:real^3`;`v1:real^3`;`y:real^3`;`w:real^3`;` v:real^3`;`u123:real^3`;`t1'/ &2:real`][REAL_ARITH`&1/ &2 < &1 /\ &0 < &1/ &2`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN SUBGOAL_THEN`(x,v,w,sigma_fan x V E v w) IN d1_fan(x:real^3,V,E)` +ASSUME_TAC +THENL(*24*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`sigma_fan x V E v w:real^3` +THEN ASM_REWRITE_TAC[];(*24*) + +SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w) IN + face_set (hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL(*25*)[ + +REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;] +THEN EXISTS_TAC`(x,v,w,sigma_fan x V E v w:real^3)` +THEN ASM_REWRITE_TAC[face];(*25*) + +SUBGOAL_THEN`(x,w,v,sigma_fan x V E w v) IN d1_fan(x:real^3,V,E)` +ASSUME_TAC +THENL(*26*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E w v:real^3` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*26*) + + +SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v) IN + face_set (hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL(*27*)[ + +REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;] +THEN EXISTS_TAC`(x,w,v,sigma_fan x V E w v:real^3)` +THEN ASM_REWRITE_TAC[face];(*27*) + +SUBGOAL_THEN`(x,v,u123,w:real^3) IN face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v)`ASSUME_TAC +THENL(*28*)[ + +REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`SUC 0:num` +THEN ASM_REWRITE_TAC[POWER; ARITH_RULE`SUC 0 >= 0`;I_DEF;o_DEF] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC 0:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(x,w,v,sigma_fan x V E w v):real^3#real^3#real^3#real^3`[POWER;I_DEF;o_DEF;]) +THEN REWRITE_TAC[f1_fan] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`];(*28*) + +MP_TAC(REAL_ARITH`&0< t /\ t< &1==> &0< t/ &2 /\ t/ &2< t/\ t/ &2< &1/\ t/ &2<= &1 /\ &0<= t/ &2/\ ~(t/ &2 = &0)`) +THEN RESA_TAC +THEN REMOVE_THEN "YEU" (fun th-> MRESAL1_TAC th`t/ &2:real`[SET_RULE`~(A={}) <=> ?a. a IN A`;INTER;IN_ELIM_THM]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`;`u123:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESAL_TAC aff_gt_1_3_eq_unions_aff_gt_1_2[`x:real^3`;`w:real^3`;`v:real^3`;`u123:real^3`][UNIONS;IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` w:real^3`;` v:real^3`;` u123:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{x' | ?u. (?a. (&0 < a /\ a < &1) /\ + u = aff_gt {x} {(&1 - a) % v + a % u123, w}) /\ + x' IN u} SUBSET + dart_leads_into x V E v u123 +/\ a IN aff_gt {x} {(&1 - t / &2) % v + t / &2 % u123, w:real^3} +/\ &0 < t / &2 /\ t / &2 < &1 +==> a IN dart_leads_into x V E v u123`) +THEN RESA_TAC +THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`(face (hypermap1_of_fanx (x,V:real^3->bool,E)) (x,w,v,sigma_fan x V E w v)) :real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th `(x:real^3,v:real^3,u123:real^3,w:real^3)`[pr2;pr3]) +THEN MRESAL_TAC scale_in_edges_fan[`(x:real^3)`;`(y:real^3)`;`(v1:real^3)`;`(a:real^3)`][SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`;VECTOR_ARITH`a' % (a - x) = (&1 - t') % y + t' % v1 - x <=> (&1- a')% x + a' % a= (&1 - t') % y + t' % v1`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`y:real^3`;`v1:real^3`;`a:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;` (a:real^3)`;`(y:real^3)`;] +THEN SUBGOAL_THEN`(&1 - t') % y + t' % v1 IN aff_gt {x} {a:real^3}`ASSUME_TAC +THENL(*29*)[ + +MRESAL_TAC AFF_GT_1_1[`x:real^3`;`a:real^3`][SET_RULE`DISJOINT{x} {y} <=> ~(x= y)`;IN_ELIM_THM] +THEN EXISTS_TAC`&1-a':real` +THEN EXISTS_TAC` a':real` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*29*) + + +MRESA_TAC AFF_GT_1_1_SUBSET_DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v)):real^3#real^3#real^3#real^3->bool`;`a:real^3`] +THEN SUBGOAL_THEN`(&1 - t') % y + t' % v1 IN aff_gt {x} {(&1 - t / &2) % v + t / &2 % u123, w:real^3}` +ASSUME_TAC +THENL(*30*)[ + +MRESA_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`;`u123:real^3`;`t/ &2:real`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC th3[`x:real^3`;`(&1 - t / &2) % v + t / &2 % u123:real^3`;`w:real^3`] +THEN MRESA_TAC scale_aff_gt_fan[`x:real^3`;`(&1 - t / &2) % v + t / &2 % u123:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`a:real^3`;`a':real`][VECTOR_ARITH`a' % (a - x) + x=(&1 - a') % x + a' % a`]) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC;(*30*) + +MRESA_TAC continuous_coplanar_fan[`x:real^3 `;`w:real^3`;`v:real^3`;`u123:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `t/ &2:real`) +THEN MRESA_TAC aff_gt_1_2_subset_aff_1_3111[`x:real^3`;`(&1 - t') % y + t' % v1:real^3`;`v1:real^3`;`w:real^3`;`(&1 - t / &2) % v + t / &2 % u123:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC AFF_GT_1_3_SUBSET_AFF_GT_1_3[`x:real^3 `;`w:real^3`;`v:real^3`;`u123:real^3`;`t/ &2 :real`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`aff_gt {x} {w, (&1 - t / &2) % v + t / &2 % u123, v} SUBSET + {x' | ?u. (?a. (&0 < a /\ a < &1) /\ + u = aff_gt {x} {(&1 - a) % v + a % u123, w}) /\ + x' IN u} +/\ {x' | ?u. (?a. (&0 < a /\ a < &1) /\ + u = aff_gt {x} {(&1 - a) % v + a % u123, w}) /\ + x' IN u} SUBSET + dart_leads_into x V E v u123 +==> +aff_gt {x} {w, (&1 - t / &2) % v + t / &2 % u123, v:real^3} SUBSET +dart_leads_into x V E v u123 +`) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`aff_gt {x} {v1, (&1 - t') % y + t' % v1} SUBSET + aff_gt {x} {w, v, (&1 - t / &2) % v + t / &2 % u123} + +/\ aff_gt {x} {w, v, (&1 - t / &2) % v + t / &2 % u123} SUBSET + dart_leads_into x V E v u123 + +==> +aff_gt {x} {v1, (&1 - t') % y + t' % v1} SUBSET +dart_leads_into x V E v u123 +`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`&0 IN TA /\ ~(t1 IN TA)==> ~(t1= &0)`) +THEN MP_TAC(REAL_ARITH`t'< &1/\ &0<= t1 /\ ~(t1= &0)==> &0< &1- t' /\ ~(&1- t' = &0) /\ &0< t1`) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LT_MUL[`t1:real`;`&1- t':real`][REAL_ARITH`t1*(&1- t')= t1- t' * t1`] +THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th `t1 - t' * t1:real`) +THEN SUBGOAL_THEN`(&1 - (t1 - e1)) % y + (t1 - e1) % z IN aff_gt {x} {v1, (&1 - t') % y + t' % v1:real^3}` +ASSUME_TAC +THENL(*31*)[ + +MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v)):real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`(&1 - t') % y + t' % v1 IN aff_gt {x} {a:real^3} +/\ aff_gt {x} {a} SUBSET dart_leads_into x V E v u123 +/\ dart_leads_into x V E v u123 SUBSET yfan (x,V,E) +==> (&1 - t') % y + t' % v1 IN yfan(x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan;IN_ELIM_THM;DIFF] +THEN STRIP_TAC +THEN MRESA_TAC x_in_xfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MP_TAC(SET_RULE`~((&1 - t') % y + t' % v1 IN xfan (x,V:real^3->bool,E)) /\ x IN xfan (x,V,E) +==> ~(x= (&1 - t') % y + t' % v1:real^3)`) +THEN RESA_TAC +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v1:real^3`;`(&1 - t') % y + t' % v1:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`; +VECTOR_ARITH`t1' % x + t2 % v1 + t3 % ((&1 - t') % y + t' % v1) += t1' % x + (t3 *(&1 - t')) % y + (t2+ t3*t') % v1`] +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + + (t3 * (&1 - t')) % y + + (t2 + t3 * t') % ((&1 - t1) % y + t1 % z) += t1' % x + + (t3 * (&1 - t') + (t2 + t3 * t') * (&1 - t1)) % y + + ((t2 + t3 * t') * t1) % z`] +THEN MRESA1_TAC REAL_MUL_LINV`&1- t':real` +THEN MRESA1_TAC REAL_MUL_LINV`t1:real` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC `inv t1 * (t1- e1)- ((&1 - (t1 - e1)) - inv t1 * (t1- e1) *(&1- t1)) * inv(&1- t')* t' :real` +THEN EXISTS_TAC`((&1 - (t1 - e1)) - inv t1 * (t1- e1) *(&1- t1)) * inv(&1- t'):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t1 * (t1 - e1) - a1 * t' + a1 * t'= (t1- e1)* inv t1`; REAL_ARITH`(A*B)*C=A*(B*C)`;REAL_ARITH`&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)+ + (t1 - e1) * inv t1 * (&1 - t1)= &1 - (t1 - e1)`; REAL_ARITH`A * &1=A` +;VECTOR_ARITH` &0 % x + A +B= A+B`; +REAL_ARITH`&0 + + inv t1 * (t1 - e1) - + (&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)) * inv (&1 - t') * t' + + (&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)) * inv (&1 - t') += inv t1 * (t1 - e1) + + (&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)) * inv (&1 - t') *(&1- t')`; +REAL_ARITH`inv t1 * (t1 - e1) + &1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1) += (t1 - e1)*(inv t1 * t1 ) + &1 - (t1 - e1)` +; REAL_ARITH`A+ &1-A= &1`] +THEN ASM_REWRITE_TAC[REAL_ARITH`&1-(t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)= +&1- (&1+ inv t1 - inv t1* t1) *(t1 - e1) `; REAL_ARITH`A +B-A=B` +;REAL_ARITH`inv t1 * (t1 - e1) = inv t1 * t1 - inv t1 * e1` +;REAL_ARITH`A-(A-B)=B`; +REAL_ARITH`&1 - inv t1 * e1 - (inv t1 * e1) * inv (&1 - t') * t' += &1 - inv t1 * e1 - (inv t1 * e1) * inv (&1 - t') + (inv t1 * e1) * inv (&1 - t') * (&1-t')`; +REAL_ARITH`&1 - inv t1 * e1 - (inv t1 * e1) * inv (&1 - t') + (inv t1 * e1) * &1= +&1- (inv t1 * e1) * inv (&1 - t')` ] +THEN STRIP_TAC +THENL(*32*)[ + +REWRITE_TAC[ REAL_ARITH`&0< &1 - (inv t1 * e1) * inv (&1 - t') +<=> ((inv t1) * inv (&1 -t')) * e1 < &1`;GSYM REAL_INV_MUL; REAL_ARITH`A*( &1- B)=A- B*A`] +THEN MP_TAC(REAL_ARITH` &0< t1 - t' * t1==> ~(t1 - t' * t1= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`t1- t' * t1:real` +THEN MRESA1_TAC REAL_MUL_LINV`t1- t' * t1:real` +THEN MRESA_TAC REAL_LT_LMUL[`inv (t1- t' * t1):real`;`e1:real`;`t1- t' * t1:real`];(*32*) + +REWRITE_TAC[ REAL_ARITH`&0< (inv t1 * e1) * inv (&1 - t') +<=> &0< ((inv t1) * inv (&1 -t')) * e1 `;GSYM REAL_INV_MUL; REAL_ARITH`A*( &1- B)=A- B*A`] +THEN MRESA1_TAC REAL_LT_INV`t1- t' * t1:real` +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]](*32*);(*31*) + +MP_TAC(SET_RULE`(&1 - (t1 - e1)) % y + (t1 - e1) % z IN + aff_gt {x} {v1, (&1 - t') % y + t' % v1} +/\ aff_gt {x} {v1, (&1 - t') % y + t' % v1:real^3} SUBSET + dart_leads_into x V E v u123 +==> (&1 - (t1 - e1)) % y + (t1 - e1) % z IN + dart_leads_into x V E v u123`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`D SUBSET d1_fan (x:real^3,V,E) /\ f3 IN D==> f3 IN d1_fan (x,V,E)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E)) f3 IN + face_set (hypermap1_of_fanx (x:real^3,V,E))` +ASSUME_TAC +THENL(*32*)[ + +ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`f3:real^3#real^3#real^3#real^3` +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[];(*32*) + +ABBREV_TAC`y123=(&1 - (t1 - e1)) % y + (t1 - e1) % z:real^3` +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`y123:real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v):real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y'':real^3`;`y123:real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool`] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`conforming_fan (x:real^3,V,E)` +THEN REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `dartset_leads_into_fan x V E ((face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool)`) +THEN POP_ASSUM(fun th-> MRESA1_TAC th ` ((face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool)` THEN MRESA1_TAC th ` ((face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v)):real^3#real^3#real^3#real^3->bool)`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC lemma_component_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`f1:real^3#real^3#real^3#real^3`;`f3:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC lemma_face_subset_component[`hypermap1_of_fanx (x:real^3,V,E)`;`f3:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN` (x,w,v,sigma_fan x V E w v)IN face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v)` ASSUME_TAC +THENL(*33*)[ +REWRITE_TAC[face;IN_ELIM_THM; orbit_map] +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>= 0`;POWER;I_DEF];(*33*) + +STRIP_TAC +THEN MP_TAC(SET_RULE`x,w,v,sigma_fan x V E w v IN + face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v:real^3) +/\ face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v) SUBSET D +==> x,w,v,sigma_fan x V E w v IN D`) +THEN RESA_TAC +THEN ABBREV_TAC`u12=inverse1_sigma_fan x V E w v:real^3` +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`w:real^3`;`u12:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u12:real^3)`; +` (w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`; `v:real^3`;`u12:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN SUBGOAL_THEN`(!h. &0 < h /\ h < &1 / &2 ==> ~collinear {x, v, (&1 - h) % w + h % u12:real^3})` +ASSUME_TAC +THENL(*34*)[ +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`u12:real^3`;`h:real`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*34*) + +MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`z:real^3`;`y:real^3`;`v1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`z:real^3`;`y:real^3 `;`v1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REWRITE_TAC[SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y) /\ ~(x=z)`;] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x v1 v y < pi ==> azim x v1 v y <= pi`) +THEN RESA_TAC +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`v1:real^3`;`z:real^3`;`v:real^3`;`y:real^3`] +THEN MP_TAC(REAL_ARITH`pi = azim x v1 z v + azim x v1 v y /\ +&0< azim x v1 v y /\ azim x v1 v y< pi ==> &0< azim x v1 z v /\ azim x v1 z v < pi`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`; `v:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN MRESAL_TAC condition_4point_aff_gt_1_2inter_aff_gt_1_2[`x:real^3`;`v1:real^3`;`z:real^3`;`v:real^3`;` w:real^3`;`u12:real^3`;`&1/ &2:real`][REAL_ARITH`&1/ &2 < &1 /\ &0 < &1/ &2`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`t''/ &2:real`[SET_RULE`~(A={}) <=> ?a. a IN A`;INTER;IN_ELIM_THM]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0 < t''/\ t'' < &1 ==> &0 < t'' / &2 /\ t'' / &2 < t''/\ t'' / &2< &1`) +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`u12:real^3`] +THEN MRESAL_TAC aff_gt_1_3_eq_unions_aff_gt_1_2[`x:real^3`;`v:real^3`;`w:real^3`;`u12:real^3`][UNIONS;IN_ELIM_THM] +THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` w:real^3`;` u12:real^3`] +THEN MP_TAC(SET_RULE`{x' | ?u. (?a. (&0 < a /\ a < &1) /\ + u = aff_gt {x} {v, (&1 - a) % w + a % u12}) /\ + x' IN u} SUBSET + dart_leads_into x V E w u12 +/\ a'' IN aff_gt {x} {v, (&1 - t'' / &2) % w + t'' / &2 % u12:real^3} +/\ &0< t''/ &2 /\ t''/ &2< &1 +==> a'' IN dart_leads_into x V E w u12`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`x,w,u12,v IN + face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w:real^3)`ASSUME_TAC +THENL(*35*)[ + +REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`SUC 0:num` +THEN ASM_REWRITE_TAC[POWER; ARITH_RULE`SUC 0 >= 0`;I_DEF;o_DEF] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC 0:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(x,v,w,sigma_fan x V E v w):real^3#real^3#real^3#real^3`[POWER;I_DEF;o_DEF;]) +THEN REWRITE_TAC[f1_fan] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`];(*35*) + +MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`(face (hypermap1_of_fanx (x,V:real^3->bool,E)) (x,v,w,sigma_fan x V E v w)) :real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th `(x:real^3,w:real^3,u12:real^3,v:real^3)`[pr2;pr3]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESAL_TAC scale_in_edges_fan[`(x:real^3)`;`(v1:real^3)`;`(z:real^3)`;`(a'':real^3)`][SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`;VECTOR_ARITH`a' % (a - x) = (&1 - t') % y + t' % v1 - x <=> (&1- a')% x + a' % a= (&1 - t') % y + t' % v1`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v1:real^3`;`z:real^3`;`a'':real^3`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (a'':real^3)`;`(v1:real^3)`;] +THEN SUBGOAL_THEN`(&1 - t''') % v1 + t''' % z IN aff_gt {x} {a'':real^3}`ASSUME_TAC +THENL(*36*)[ + +MRESAL_TAC AFF_GT_1_1[`x:real^3`;`a'':real^3`][SET_RULE`DISJOINT{x} {y} <=> ~(x= y)`;IN_ELIM_THM] +THEN EXISTS_TAC`&1-a''':real` +THEN EXISTS_TAC` a''':real` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*36*) + +MRESA_TAC AFF_GT_1_1_SUBSET_DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)):real^3#real^3#real^3#real^3->bool`;`a'':real^3`] +THEN MP_TAC(SET_RULE`(&1 - t''') % v1 + t''' % z IN aff_gt {x} {a''} +/\ aff_gt {x} {a''} SUBSET + dartset_leads_into_fan x V E + (face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w:real^3)) +==> (&1 - t''') % v1 + t''' % z IN + dartset_leads_into_fan x V E + (face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w))`) +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - t''') % ((&1 - t1) % y + t1 % z) + t''' % z +=(&1 - (t1+ (&1 - t1)*t''')) % y + (t1+ (&1 - t1)*t''') % z`] +THEN SUBGOAL_THEN`(x,v,w,sigma_fan x V E v w:real^3) IN D`ASSUME_TAC +THENL(*37*)[ + +MRESA_TAC lemma_component_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`f1:real^3#real^3#real^3#real^3`;`(x,w,v,sigma_fan x V E w v:real^3):real^3#real^3#real^3#real^3`] +THEN MRESA_TAC lemma_powers_in_component[`hypermap1_of_fanx (x:real^3,V,E)`;`(x,w,v,sigma_fan x V E w v :real^3)`;`SUC 0:num`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC 0:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(x,w,v,sigma_fan x V E w v:real^3):real^3#real^3#real^3#real^3`) +THEN REWRITE_TAC[e_fan;POWER;I_DEF;o_DEF];(*37*) + + +STRIP_TAC +THEN SUBGOAL_THEN `t1 + (&1 - t1) * t''' IN TA:real->bool`ASSUME_TAC +THENL(*38*)[ + +EXPAND_TAC"TA" +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THENL(*39*)[ + +MATCH_MP_TAC(REAL_ARITH`&0<= A /\ &0<=B ==> &0<=A+B`) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &1- A<=> A<= &1`] +THEN MATCH_MP_TAC(REAL_ARITH`&0 &0<=A `) +THEN ASM_REWRITE_TAC[];(*39*) +STRIP_TAC +THENL(*40*)[ + +REWRITE_TAC[REAL_ARITH`t1 + (&1 - t1) * t''' <= &1<=> &0 <= (&1 - t1)* (&1- t''')`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &1- A<=> A<= &1`] +THEN MATCH_MP_TAC(REAL_ARITH`A< &1 ==> A<= &1 `) +THEN ASM_REWRITE_TAC[];(*40*) + +EXISTS_TAC`(x,v,w,sigma_fan x V E v w:real^3)` +THEN ASM_REWRITE_TAC[]](*40*)](*39*);(*38*) + +FIND_ASSUM (fun th-> MP_TAC(ISPEC `t1 + (&1 - t1) * t''':real` th))`!x. x IN TA ==> x <= t1` +THEN MP_TAC(SET_RULE`t1 + (&1 - t1) * t''' IN TA /\ ~(t1 IN TA)==> ~(t1=t1 + (&1 - t1) * t''')`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`t1 + (&1 - t1) * t''' <= t1 /\ ~(t1= t1 + (&1 - t1) * t''') /\ t1<= &1 /\ &0< t''' +==> (&1 - t1) * t'''< &0:real /\ &0<= (&1 -t1)/\ &0<= t'''`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`(&1- t1):real`;`t''':real`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC](*38*)](*37*)](*36*)](*35*)](*34*)](*33*)](*32*)](*31*)](*30*)](*29*)](*28*)](*27*)](*26*)](*25*)](*24*)](*23*);(*22*) + + +POP_ASSUM MP_TAC +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`w:real^3`;`v:real^3`;`v1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3 `;`v1:real^3`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`pi < azim x v1 v y==> pi <= azim x v1 v y`) +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v1:real^3`;`v:real^3`;`w:real^3`;`y:real^3`] +THEN MP_TAC(REAL_ARITH`pi < azim x v1 v y +/\ azim x v1 v y = pi + azim x v1 w y /\ azim x v1 v y< &2 * pi +==> &0< azim x v1 w y /\ azim x v1 w y< pi`) +THEN ASM_REWRITE_TAC[azim] +THEN STRIP_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`; `y:real^3`;`w:real^3`] +THEN ABBREV_TAC`u123=inverse1_sigma_fan x V E w v:real^3` +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`w:real^3`;`u123:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u123:real^3)`; +` (w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`; `v:real^3`;`u123:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN MRESA_TAC aff_gt_1_2_cross_dotr_4point_neg[`x:real^3`;`v1:real^3`;`y:real^3`;`w:real^3`;`v:real^3`;] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REWRITE_TAC[GSYM DOT_LNEG;GSYM CROSS_SKEW] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN MRESA_TAC exists_open_not_collinear[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(w:real^3)`;`(u123:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN SUBGOAL_THEN`(!h. &0 < h /\ h < t1' / &2 ==> ~collinear {x, (&1 - h) % w + h % u123, v:real^3})`ASSUME_TAC +THENL(*23*)[ + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CHANGE") +THEN GEN_TAC THEN STRIP_TAC +THEN REMOVE_THEN "CHANGE"(fun th-> MRESA1_TAC th`h:real`) +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*23*) + +MP_TAC(REAL_ARITH`&0< t1' /\ t1'<= &1==> &0< t1'/ &2 /\ t1'/ &2 < &1`) +THEN RESA_TAC +THEN MRESAL_TAC condition_4point_aff_gt_1_2inter_aff_gt_1_2[`x:real^3`;`v1:real^3`;`y:real^3`;`v:real^3`;` w:real^3`;`u123:real^3`;`t1'/ &2:real`][REAL_ARITH`&1/ &2 < &1 /\ &0 < &1/ &2`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN SUBGOAL_THEN`(x,w,v,sigma_fan x V E w v) IN d1_fan(x:real^3,V,E)` +ASSUME_TAC +THENL(*24*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E w v:real^3` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*24*) + +SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v) IN + face_set (hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL(*25*)[ + +REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;] +THEN EXISTS_TAC`(x,w,v,sigma_fan x V E w v:real^3)` +THEN ASM_REWRITE_TAC[face];(*25*) + +SUBGOAL_THEN`(x,v,w,sigma_fan x V E v w) IN d1_fan(x:real^3,V,E)` +ASSUME_TAC +THENL(*26*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`sigma_fan x V E v w:real^3` +THEN ASM_REWRITE_TAC[];(*26*) + + +SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w) IN + face_set (hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL(*27*)[ + +REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;] +THEN EXISTS_TAC`(x,v,w,sigma_fan x V E v w:real^3)` +THEN ASM_REWRITE_TAC[face];(*27*) + +SUBGOAL_THEN`(x,w,u123,v:real^3) IN face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)`ASSUME_TAC +THENL(*28*)[ + +REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`SUC 0:num` +THEN ASM_REWRITE_TAC[POWER; ARITH_RULE`SUC 0 >= 0`;I_DEF;o_DEF] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC 0:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(x,v,w,sigma_fan x V E v w):real^3#real^3#real^3#real^3`[POWER;I_DEF;o_DEF;]) +THEN REWRITE_TAC[f1_fan] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`];(*28*) + +MP_TAC(REAL_ARITH`&0< t /\ t< &1==> &0< t/ &2 /\ t/ &2< t/\ t/ &2< &1/\ t/ &2<= &1 /\ &0<= t/ &2/\ ~(t/ &2 = &0)`) +THEN RESA_TAC +THEN REMOVE_THEN "YEU" (fun th-> MRESAL1_TAC th`t/ &2:real`[SET_RULE`~(A={}) <=> ?a. a IN A`;INTER;IN_ELIM_THM]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`u123:real^3`] +THEN MRESAL_TAC aff_gt_1_3_eq_unions_aff_gt_1_2[`x:real^3`;`v:real^3`;`w:real^3`;`u123:real^3`][UNIONS;IN_ELIM_THM] +THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` w:real^3`;` u123:real^3`] +THEN MP_TAC(SET_RULE`{x' | ?u. (?a. (&0 < a /\ a < &1) /\ + u = aff_gt {x} {(&1 - a) % w + a % u123, v}) /\ + x' IN u} SUBSET + dart_leads_into x V E w u123 +/\ a IN aff_gt {x} {(&1 - t / &2) % w + t / &2 % u123, v:real^3} +/\ &0 < t / &2 /\ t / &2 < &1 +==> a IN dart_leads_into x V E w u123`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`(face (hypermap1_of_fanx (x,V:real^3->bool,E)) (x,v,w,sigma_fan x V E v w)) :real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th `(x:real^3,w:real^3,u123:real^3,v:real^3)`[pr2;pr3]) +THEN MRESAL_TAC scale_in_edges_fan[`(x:real^3)`;`(y:real^3)`;`(v1:real^3)`;`(a:real^3)`][SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`;VECTOR_ARITH`a' % (a - x) = (&1 - t') % y + t' % v1 - x <=> (&1- a')% x + a' % a= (&1 - t') % y + t' % v1`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`y:real^3`;`v1:real^3`;`a:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;` (a:real^3)`;`(y:real^3)`;] +THEN SUBGOAL_THEN`(&1 - t') % y + t' % v1 IN aff_gt {x} {a:real^3}`ASSUME_TAC +THENL(*29*)[ + +MRESAL_TAC AFF_GT_1_1[`x:real^3`;`a:real^3`][SET_RULE`DISJOINT{x} {y} <=> ~(x= y)`;IN_ELIM_THM] +THEN EXISTS_TAC`&1-a':real` +THEN EXISTS_TAC` a':real` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*29*) + + +MRESA_TAC AFF_GT_1_1_SUBSET_DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)):real^3#real^3#real^3#real^3->bool`;`a:real^3`] +THEN SUBGOAL_THEN`(&1 - t') % y + t' % v1 IN aff_gt {x} {(&1 - t / &2) % w + t / &2 % u123, v:real^3}` +ASSUME_TAC +THENL(*30*)[ + +MRESA_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`u123:real^3`;`t/ &2:real`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC th3[`x:real^3`;`(&1 - t / &2) % w + t / &2 % u123:real^3`;`v:real^3`] +THEN MRESA_TAC scale_aff_gt_fan[`x:real^3`;`(&1 - t / &2) % w + t / &2 % u123:real^3`;`v:real^3`] +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`a:real^3`;`a':real`][VECTOR_ARITH`a' % (a - x) + x=(&1 - a') % x + a' % a`]) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC;(*30*) + +MRESA_TAC continuous_coplanar_fan[`x:real^3 `;`v:real^3`;`w:real^3`;`u123:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `t/ &2:real`) +THEN MRESA_TAC aff_gt_1_2_subset_aff_1_3111[`x:real^3`;`(&1 - t') % y + t' % v1:real^3`;`v1:real^3`;`v:real^3`;`(&1 - t / &2) % w + t / &2 % u123:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC AFF_GT_1_3_SUBSET_AFF_GT_1_3[`x:real^3 `;`v:real^3`;`w:real^3`;`u123:real^3`;`t/ &2 :real`] +THEN MP_TAC(SET_RULE`aff_gt {x} {v, w, (&1 - t / &2) % w + t / &2 % u123} SUBSET + {x' | ?u. (?a. (&0 < a /\ a < &1) /\ + u = aff_gt {x} {v, (&1 - a) % w + a % u123}) /\ + x' IN u} +/\ +{x' | ?u. (?a. (&0 < a /\ a < &1) /\ + u = aff_gt {x} {v, (&1 - a) % w + a % u123}) /\ + x' IN u} SUBSET + dart_leads_into x V E w u123 +==> +aff_gt {x} {v, w, (&1 - t / &2) % w + t / &2 % u123} SUBSET +dart_leads_into x V E w u123 `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`aff_gt {x} {v1, (&1 - t') % y + t' % v1} SUBSET + aff_gt {x} {v, w, (&1 - t / &2) % w + t / &2 % u123} +/\ +aff_gt {x} {v, w, (&1 - t / &2) % w + t / &2 % u123} SUBSET +dart_leads_into x V E w u123 + +==> aff_gt {x} {v1, (&1 - t') % y + t' % v1} SUBSET +dart_leads_into x V E w u123`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`&0 IN TA /\ ~(t1 IN TA)==> ~(t1= &0)`) +THEN MP_TAC(REAL_ARITH`t'< &1/\ &0<= t1 /\ ~(t1= &0)==> &0< &1- t' /\ ~(&1- t' = &0) /\ &0< t1`) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LT_MUL[`t1:real`;`&1- t':real`][REAL_ARITH`t1*(&1- t')= t1- t' * t1`] +THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th `t1 - t' * t1:real`) +THEN SUBGOAL_THEN`(&1 - (t1 - e1)) % y + (t1 - e1) % z IN aff_gt {x} {v1, (&1 - t') % y + t' % v1:real^3}` +ASSUME_TAC +THENL(*31*)[ + +MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)):real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`(&1 - t') % y + t' % v1 IN aff_gt {x} {a:real^3} +/\ aff_gt {x} {a} SUBSET dart_leads_into x V E w u123 +/\ dart_leads_into x V E w u123 SUBSET yfan (x,V,E) +==> (&1 - t') % y + t' % v1 IN yfan(x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan;IN_ELIM_THM;DIFF] +THEN STRIP_TAC +THEN MRESA_TAC x_in_xfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MP_TAC(SET_RULE`~((&1 - t') % y + t' % v1 IN xfan (x,V:real^3->bool,E)) /\ x IN xfan (x,V,E) +==> ~(x= (&1 - t') % y + t' % v1:real^3)`) +THEN RESA_TAC +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v1:real^3`;`(&1 - t') % y + t' % v1:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`; +VECTOR_ARITH`t1' % x + t2 % v1 + t3 % ((&1 - t') % y + t' % v1) += t1' % x + (t3 *(&1 - t')) % y + (t2+ t3*t') % v1`] +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + + (t3 * (&1 - t')) % y + + (t2 + t3 * t') % ((&1 - t1) % y + t1 % z) += t1' % x + + (t3 * (&1 - t') + (t2 + t3 * t') * (&1 - t1)) % y + + ((t2 + t3 * t') * t1) % z`] +THEN MRESA1_TAC REAL_MUL_LINV`&1- t':real` +THEN MRESA1_TAC REAL_MUL_LINV`t1:real` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC `inv t1 * (t1- e1)- ((&1 - (t1 - e1)) - inv t1 * (t1- e1) *(&1- t1)) * inv(&1- t')* t' :real` +THEN EXISTS_TAC`((&1 - (t1 - e1)) - inv t1 * (t1- e1) *(&1- t1)) * inv(&1- t'):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t1 * (t1 - e1) - a1 * t' + a1 * t'= (t1- e1)* inv t1`; REAL_ARITH`(A*B)*C=A*(B*C)`;REAL_ARITH`&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)+ + (t1 - e1) * inv t1 * (&1 - t1)= &1 - (t1 - e1)`; REAL_ARITH`A * &1=A` +;VECTOR_ARITH` &0 % x + A +B= A+B`; +REAL_ARITH`&0 + + inv t1 * (t1 - e1) - + (&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)) * inv (&1 - t') * t' + + (&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)) * inv (&1 - t') += inv t1 * (t1 - e1) + + (&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)) * inv (&1 - t') *(&1- t')`; +REAL_ARITH`inv t1 * (t1 - e1) + &1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1) += (t1 - e1)*(inv t1 * t1 ) + &1 - (t1 - e1)` +; REAL_ARITH`A+ &1-A= &1`] +THEN ASM_REWRITE_TAC[REAL_ARITH`&1-(t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)= +&1- (&1+ inv t1 - inv t1* t1) *(t1 - e1) `; REAL_ARITH`A +B-A=B` +;REAL_ARITH`inv t1 * (t1 - e1) = inv t1 * t1 - inv t1 * e1` +;REAL_ARITH`A-(A-B)=B`; +REAL_ARITH`&1 - inv t1 * e1 - (inv t1 * e1) * inv (&1 - t') * t' += &1 - inv t1 * e1 - (inv t1 * e1) * inv (&1 - t') + (inv t1 * e1) * inv (&1 - t') * (&1-t')`; +REAL_ARITH`&1 - inv t1 * e1 - (inv t1 * e1) * inv (&1 - t') + (inv t1 * e1) * &1= +&1- (inv t1 * e1) * inv (&1 - t')` ] +THEN STRIP_TAC +THENL(*32*)[ + +REWRITE_TAC[ REAL_ARITH`&0< &1 - (inv t1 * e1) * inv (&1 - t') +<=> ((inv t1) * inv (&1 -t')) * e1 < &1`;GSYM REAL_INV_MUL; REAL_ARITH`A*( &1- B)=A- B*A`] +THEN MP_TAC(REAL_ARITH` &0< t1 - t' * t1==> ~(t1 - t' * t1= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`t1- t' * t1:real` +THEN MRESA1_TAC REAL_MUL_LINV`t1- t' * t1:real` +THEN MRESA_TAC REAL_LT_LMUL[`inv (t1- t' * t1):real`;`e1:real`;`t1- t' * t1:real`];(*32*) + + +REWRITE_TAC[ REAL_ARITH`&0< (inv t1 * e1) * inv (&1 - t') +<=> &0< ((inv t1) * inv (&1 -t')) * e1 `;GSYM REAL_INV_MUL; REAL_ARITH`A*( &1- B)=A- B*A`] +THEN MRESA1_TAC REAL_LT_INV`t1- t' * t1:real` +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]](*32*);(*31*) + + +MP_TAC(SET_RULE`(&1 - (t1 - e1)) % y + (t1 - e1) % z IN + aff_gt {x} {v1, (&1 - t') % y + t' % v1} +/\ aff_gt {x} {v1, (&1 - t') % y + t' % v1:real^3} SUBSET + dart_leads_into x V E w u123 +==> (&1 - (t1 - e1)) % y + (t1 - e1) % z IN + dart_leads_into x V E w u123`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`D SUBSET d1_fan (x:real^3,V,E) /\ f3 IN D==> f3 IN d1_fan (x,V,E)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E)) f3 IN + face_set (hypermap1_of_fanx (x:real^3,V,E))` +ASSUME_TAC +THENL(*32*)[ + +ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`f3:real^3#real^3#real^3#real^3` +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[];(*32*) + +ABBREV_TAC`y123=(&1 - (t1 - e1)) % y + (t1 - e1) % z:real^3` +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`y123:real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w):real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y'':real^3`;`y123:real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool`] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`conforming_fan (x:real^3,V,E)` +THEN REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `dartset_leads_into_fan x V E ((face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool)`) +THEN POP_ASSUM(fun th-> MRESA1_TAC th ` ((face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool)` THEN MRESA1_TAC th ` ((face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)):real^3#real^3#real^3#real^3->bool)`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC lemma_component_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`f1:real^3#real^3#real^3#real^3`;`f3:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC lemma_face_subset_component[`hypermap1_of_fanx (x:real^3,V,E)`;`f3:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN` (x,v,w,sigma_fan x V E v w)IN face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)` ASSUME_TAC +THENL(*33*)[ +REWRITE_TAC[face;IN_ELIM_THM; orbit_map] +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>= 0`;POWER;I_DEF];(*33*) + +STRIP_TAC +THEN MP_TAC(SET_RULE`x,v,w,sigma_fan x V E v w IN + face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w:real^3) +/\ face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w) SUBSET D +==> x,v,w,sigma_fan x V E v w IN D`) +THEN RESA_TAC +THEN ABBREV_TAC`u12=inverse1_sigma_fan x V E v w:real^3` +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`) +THEN REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u12:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u12:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`; `w:real^3`;`u12:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN SUBGOAL_THEN`(!h. &0 < h /\ h < &1 / &2 ==> ~collinear {x, w, (&1 - h) % v + h % u12:real^3})` +ASSUME_TAC +THENL(*34*)[ + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`;`u12:real^3`;`h:real`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*34*) + +MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`z:real^3`;`y:real^3`;`v1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`z:real^3`;`y:real^3 `;`v1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REWRITE_TAC[SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y) /\ ~(x=z)`;] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x v1 w y < pi ==> azim x v1 w y <= pi`) +THEN RESA_TAC +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`v1:real^3`;`z:real^3`;`w:real^3`;`y:real^3`] +THEN MP_TAC(REAL_ARITH`pi = azim x v1 z w + azim x v1 w y /\ +&0< azim x v1 w y /\ azim x v1 w y< pi ==> &0< azim x v1 z w /\ azim x v1 z w < pi`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`; `w:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN MRESAL_TAC condition_4point_aff_gt_1_2inter_aff_gt_1_2[`x:real^3`;`v1:real^3`;`z:real^3`;`w:real^3`;` v:real^3`;`u12:real^3`;`&1/ &2:real`][REAL_ARITH`&1/ &2 < &1 /\ &0 < &1/ &2`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`t''/ &2:real`[SET_RULE`~(A={}) <=> ?a. a IN A`;INTER;IN_ELIM_THM]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0 < t''/\ t'' < &1 ==> &0 < t'' / &2 /\ t'' / &2 < t''/\ t'' / &2< &1`) +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`;`u12:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESAL_TAC aff_gt_1_3_eq_unions_aff_gt_1_2[`x:real^3`;`w:real^3`;`v:real^3`;`u12:real^3`][UNIONS;IN_ELIM_THM] +THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` w:real^3`;` v:real^3`;` u12:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{x' | ?u. (?a. (&0 < a /\ a < &1) /\ + u = aff_gt {x} {(&1 - a) % v + a % u12,w}) /\ + x' IN u} SUBSET + dart_leads_into x V E v u12 +/\ a'' IN aff_gt {x} {(&1 - t'' / &2) % v + t'' / &2 % u12:real^3,w} +/\ &0< t''/ &2 /\ t''/ &2< &1 +==> a'' IN dart_leads_into x V E v u12`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`x,v,u12,w IN + face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v:real^3)`ASSUME_TAC +THENL(*35*)[ +REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`SUC 0:num` +THEN ASM_REWRITE_TAC[POWER; ARITH_RULE`SUC 0 >= 0`;I_DEF;o_DEF] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC 0:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(x,w,v,sigma_fan x V E w v):real^3#real^3#real^3#real^3`[POWER;I_DEF;o_DEF;]) +THEN REWRITE_TAC[f1_fan] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`];(*35*) + +MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`(face (hypermap1_of_fanx (x,V:real^3->bool,E)) (x,w,v,sigma_fan x V E w v)) :real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th `(x:real^3,v:real^3,u12:real^3,w:real^3)`[pr2;pr3]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESAL_TAC scale_in_edges_fan[`(x:real^3)`;`(v1:real^3)`;`(z:real^3)`;`(a'':real^3)`][SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`;VECTOR_ARITH`a' % (a - x) = (&1 - t') % y + t' % v1 - x <=> (&1- a')% x + a' % a= (&1 - t') % y + t' % v1`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v1:real^3`;`z:real^3`;`a'':real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;` (a'':real^3)`;`(v1:real^3)`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN SUBGOAL_THEN`(&1 - t''') % v1 + t''' % z IN aff_gt {x} {a'':real^3}`ASSUME_TAC +THENL(*36*)[ + +MRESAL_TAC AFF_GT_1_1[`x:real^3`;`a'':real^3`][SET_RULE`DISJOINT{x} {y} <=> ~(x= y)`;IN_ELIM_THM] +THEN EXISTS_TAC`&1-a''':real` +THEN EXISTS_TAC` a''':real` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*36*) + +MRESA_TAC AFF_GT_1_1_SUBSET_DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v)):real^3#real^3#real^3#real^3->bool`;`a'':real^3`] +THEN MP_TAC(SET_RULE`(&1 - t''') % v1 + t''' % z IN aff_gt {x} {a''} +/\ aff_gt {x} {a''} SUBSET + dartset_leads_into_fan x V E + (face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v:real^3)) +==> (&1 - t''') % v1 + t''' % z IN + dartset_leads_into_fan x V E + (face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v))`) +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - t''') % ((&1 - t1) % y + t1 % z) + t''' % z +=(&1 - (t1+ (&1 - t1)*t''')) % y + (t1+ (&1 - t1)*t''') % z`] +THEN SUBGOAL_THEN`(x,w,v,sigma_fan x V E w v:real^3) IN D`ASSUME_TAC +THENL(*37*)[ + +MRESA_TAC lemma_component_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`f1:real^3#real^3#real^3#real^3`;`(x,v,w,sigma_fan x V E v w:real^3):real^3#real^3#real^3#real^3`] +THEN MRESA_TAC lemma_powers_in_component[`hypermap1_of_fanx (x:real^3,V,E)`;`(x,v,w,sigma_fan x V E v w :real^3)`;`SUC 0:num`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC 0:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(x,v,w,sigma_fan x V E v w:real^3):real^3#real^3#real^3#real^3`) +THEN REWRITE_TAC[e_fan;POWER;I_DEF;o_DEF];(*37*) + + +STRIP_TAC +THEN SUBGOAL_THEN `t1 + (&1 - t1) * t''' IN TA:real->bool`ASSUME_TAC +THENL(*38*)[ +EXPAND_TAC"TA" +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THENL(*39*)[ + +MATCH_MP_TAC(REAL_ARITH`&0<= A /\ &0<=B ==> &0<=A+B`) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &1- A<=> A<= &1`] +THEN MATCH_MP_TAC(REAL_ARITH`&0 &0<=A `) +THEN ASM_REWRITE_TAC[];(*39*) +STRIP_TAC +THENL(*40*)[ + +REWRITE_TAC[REAL_ARITH`t1 + (&1 - t1) * t''' <= &1<=> &0 <= (&1 - t1)* (&1- t''')`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &1- A<=> A<= &1`] +THEN MATCH_MP_TAC(REAL_ARITH`A< &1 ==> A<= &1 `) +THEN ASM_REWRITE_TAC[];(*40*) + +EXISTS_TAC`(x,w,v,sigma_fan x V E w v:real^3)` +THEN ASM_REWRITE_TAC[]](*40*)](*39*);(*38*) + +FIND_ASSUM (fun th-> MP_TAC(ISPEC `t1 + (&1 - t1) * t''':real` th))`!x. x IN TA ==> x <= t1` +THEN MP_TAC(SET_RULE`t1 + (&1 - t1) * t''' IN TA /\ ~(t1 IN TA)==> ~(t1=t1 + (&1 - t1) * t''')`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`t1 + (&1 - t1) * t''' <= t1 /\ ~(t1= t1 + (&1 - t1) * t''') /\ t1<= &1 /\ &0< t''' +==> (&1 - t1) * t'''< &0:real /\ &0<= (&1 -t1)/\ &0<= t'''`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`(&1- t1):real`;`t''':real`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]);; + + + + + +let WGVWSKE=prove(`!x V E. + FAN (x,V,E) /\ + conforming_fan (x,V,E) +==> connected_hypermap(hypermap1_of_fanx (x,V,E))`, +REWRITE_TAC[connected_hypermap;number_of_components] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN REWRITE_TAC[conforming_fan] THEN STRIP_TAC THEN ASSUME_TAC th) +THEN FIND_ASSUM MP_TAC`FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan1;SET_RULE`~(V SUBSET {}) <=> ?v. v IN V`] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN FIND_ASSUM(fun th-> MP_TAC(ISPEC `v:real^3` th))`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`(v:real^3) IN V` +THEN STRIP_TAC +THEN MRESA_TAC exists_inf_element_fix_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u1:real^3`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN ABBREV_TAC`f1=(x,v,u,sigma_fan x V E v u:real^3)` +THEN SUBGOAL_THEN`f1 IN d1_fan(x:real^3,V,E)`ASSUME_TAC +THENL[ +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN ASM_REWRITE_TAC[]; + +MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN ABBREV_TAC`D= comb_component (hypermap1_of_fanx (x,V,E)) (f1:real^3#real^3#real^3#real^3)` +THEN SUBGOAL_THEN`D IN set_of_components(hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[set_of_components;set_part_components;IN_ELIM_THM] +THEN EXISTS_TAC`f1:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`set_of_components (hypermap1_of_fanx (x:real^3,V,E))={D}` +ASSUME_TAC +THENL[ +REWRITE_TAC[EXTENSION;IN_ELIM_THM;] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +ASM_REWRITE_TAC[IN_SING;set_of_components;set_part_components;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESAL_TAC lemma_connect_hypermap[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`f1:real^3#real^3#real^3#real^3`;`x'':real^3#real^3#real^3#real^3`][set_of_components;set_part_components;IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC lemma_component_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x''':real^3#real^3#real^3#real^3`;`f1:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC lemma_component_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x''':real^3#real^3#real^3#real^3`;`x'':real^3#real^3#real^3#real^3`]; + +REWRITE_TAC[IN_SING] +THEN RESA_TAC]; + +ASM_REWRITE_TAC[CARD_SINGLETON]]]]);; + + +let CARD_EDGE_SET_FAN=prove(`!x V E e. + FAN (x,V,E) +/\ e IN edge_set (hypermap1_of_fanx (x,V,E)) +/\ conforming_fan (x,V,E) + ==> CARD e= 2`, +REWRITE_TAC[edge_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN REWRITE_TAC[conforming_fan] THEN STRIP_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN REMOVE_THEN"LINH" MP_TAC +THEN RESA_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC(SUC 0):num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(x':real^3#real^3#real^3#real^3)`) +THEN MRESA_TAC plain_hypermap_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(x':real^3#real^3#real^3#real^3)`) +THEN MRESAL_TAC orbit_cyclic[`(res (e_fan x V E) (d1_fan (x:real^3,V,E)))`;`SUC (SUC 0):num`;`x':real^3#real^3#real^3#real^3`][POWER;I_DEF;o_DEF;ARITH_RULE`~(SUC (SUC 0) = 0)`] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`(SUC 0):num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(x':real^3#real^3#real^3#real^3)`) +THEN ASM_REWRITE_TAC[ARITH_RULE`k:num < SUC(SUC 0) <=> k = 0 \/ k= SUC 0`; +SET_RULE`{(res (e_fan x V E) (d1_fan (x,V,E)) POWER k) x' | k = 0 \/ k= SUC 0} += {(res (e_fan x V E) (d1_fan (x,V,E)) POWER 0) x' , (res (e_fan x V E) (d1_fan (x,V,E)) POWER SUC(0)) x' }`;POWER;I_DEF;o_DEF] +THEN MRESA_TAC e_fan_no_fix_point[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(x':real^3#real^3#real^3#real^3)`) +THEN POP_ASSUM MP_TAC +THEN MESON_TAC[CARD_2_FAN]);; + + + +let REP_CARD_EDGE_SET_FAN=prove(`!x V E. + FAN (x,V,E) +/\ conforming_fan (x,V,E) + ==> &(CARD (edge_set (hypermap1_of_fanx (x,V,E)))) * &2= &(CARD (dart (hypermap1_of_fanx (x,V,E))))`, +REPEAT STRIP_TAC +THEN MRESA1_TAC DART_EQ_UNIONS_FACE_SET_NODE_SET_EDGE_SET`(hypermap1_of_fanx (x:real^3,V:real^3->bool,E))` +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN RESA_TAC +THEN SUBGOAL_THEN`(!t. t IN edge_set (hypermap1_of_fanx (x:real^3,V,E)) ==> FINITE t)`ASSUME_TAC +THENL[ +REWRITE_TAC[edge_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC EDGE_FINITE[`(hypermap1_of_fanx (x:real^3,V,E))`;`x':real^3#real^3#real^3#real^3`][edge]; +SUBGOAL_THEN`(!t u. + t IN edge_set (hypermap1_of_fanx (x,V,E)) /\ + u IN edge_set (hypermap1_of_fanx (x:real^3,V,E)) /\ + ~(t = u) + ==> t INTER u = {})`ASSUME_TAC +THENL[ +REWRITE_TAC[edge_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`(?a:real^3#real^3#real^3#real^3. a IN t INTER u) \/ (t INTER u = {}) `) +THENL[ +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESAL_TAC lemma_edge_identity[`(hypermap1_of_fanx (x:real^3,V,E))`;`x':real^3#real^3#real^3#real^3`;`a:real^3#real^3#real^3#real^3`][edge] +THEN MRESAL_TAC lemma_edge_identity[`(hypermap1_of_fanx (x:real^3,V,E))`;`x'':real^3#real^3#real^3#real^3`;`a:real^3#real^3#real^3#real^3`][edge] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[]]; + + MRESA_TAC CARD_EDGE_SET_FAN[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESAL_TAC HAS_SIZE_UNIONS[`(edge_set (hypermap1_of_fanx (x:real^3,V,E)))`;`(\x:real^3#real^3#real^3#real^3->bool. x)`;`CARD (edge_set (hypermap1_of_fanx (x:real^3,V,E)))`;`2:num`][HAS_SIZE;FINITE_HYPERMAP_ORBITS;SET_RULE`DISJOINT x y <=> x INTER y={}` +;SET_RULE`(!x'. x' IN edge_set (hypermap1_of_fanx (x,V,E)) + ==> FINITE x' /\ CARD x' = 2) +<=> (!x'. x' IN edge_set (hypermap1_of_fanx (x,V,E)) + ==> FINITE x' ) /\ (!x'. x' IN edge_set (hypermap1_of_fanx (x,V,E)) + ==> CARD x' = 2)`; SET_RULE`UNIONS {x' | x' IN edge_set (hypermap1_of_fanx (x,V,E))} +=UNIONS (edge_set (hypermap1_of_fanx (x,V,E)))`;REAL_OF_NUM_MUL]]]);; + + +let GGRLKHP=prove(`!x V E. + FAN (x,V,E) /\ conforming_fan (x,V,E) + ==> planar_hypermap (hypermap1_of_fanx (x,V,E))`, +REPEAT STRIP_TAC +THEN MRESA_TAC SUM_CARD_FACE_NODE_DART_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC REP_CARD_EDGE_SET_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`] +THEN REWRITE_TAC[REAL_ARITH`A+B-C=D<=> A+B+C=D + &2 *C`] +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SYM th]) +THEN MRESAL_TAC WGVWSKE[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`][connected_hypermap] +THEN ASM_REWRITE_TAC[planar_hypermap;number_of_nodes;number_of_edges;number_of_faces;REAL_ARITH`&2 * &(CARD (face_set (hypermap1_of_fanx (x,V,E)))) + + &2 * &(CARD (node_set (hypermap1_of_fanx (x,V,E)))) + + &(CARD (edge_set (hypermap1_of_fanx (x,V,E)))) * &2 = + &4 + &2 * &(CARD (dart (hypermap1_of_fanx (x,V,E)))) +<=> + &(CARD (node_set (hypermap1_of_fanx (x,V,E)))) + + &(CARD (edge_set (hypermap1_of_fanx (x,V,E)))) ++ &(CARD (face_set (hypermap1_of_fanx (x,V,E)))) += + &(CARD (dart (hypermap1_of_fanx (x,V,E)))) + &2 +`;REAL_OF_NUM_ADD;ARITH_RULE`2*1=2`;REAL_OF_NUM_EQ]);; + + + +end;; + + diff --git a/legacy/oldfan/DHVFGBC.hl b/legacy/oldfan/DHVFGBC.hl new file mode 100755 index 0000000..5881a9c --- /dev/null +++ b/legacy/oldfan/DHVFGBC.hl @@ -0,0 +1,6061 @@ + +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + + +module Leads_intos = struct + + + +open Sphere;; +open Fan_defs;; +open Hypermap_of_fan;; +open Tactic_fan;; +open Lemma_fan;; +open Fan;; +open Hypermap_of_fan;; +open Node_fan;; +open Azim_node;; +open Sum_azim_node;; +open Disjoint_fan;; +open Lead_fan;; +open Fan_misc;; +open Leads_into_fan;; +open Fully_surrounded;; +open Sin_azim_cross_dot;; + + + +(* ========================================================================== *) +(* FAN AND CONVEX *) +(* ========================================================================== *) + + +let origin_point_not1_in_convex_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ {v,u} IN E +==> +~(x IN convex hull{v,u})`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] remark1_fan) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`~(u IN aff {x,v:real^3})` +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[CONVEX_HULL_2; IN_ELIM_THM;] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(v':real= &0) \/ ~(v':real= &0)`) +THENL[ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN ASM_MESON_TAC[]; + +POP_ASSUM MP_TAC +THEN REPEAT REMOVE_ASSUM_TAC +THEN REWRITE_TAC[VECTOR_ARITH`A=B+C<=>C= A-B:real^3`;REAL_ARITH`a+b= &1<=> a= &1 -b:real`] +THEN REPEAT DISCH_TAC +THEN MP_TAC(SET_RULE`v'% u =x- u' % v ==> (inv (v')) % v' % u = (inv (v')) % (x-u' % v:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;VECTOR_ARITH`(A%(B-(&1-U)%C)=(A%B)+(A*U-A)%C:real^3)`]) +THEN MP_TAC(ISPEC`(v':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`inv(v':real)` +THEN EXISTS_TAC`&1-inv(v':real)` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC]);; + + + + + + +let origin_point_not_in_convex_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3). +FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) +==> +~(x IN convex hull{v,u,w})`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[CONVEX_HULL_3; IN_ELIM_THM; coplanar] +THEN STRIP_TAC +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN SUBGOAL_THEN`(x:real^3)IN affine hull {v,u,w:real^3}` ASSUME_TAC +THENL(*3*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`u':real` +THEN EXISTS_TAC`v':real` +THEN EXISTS_TAC`w':real` +THEN ASM_MESON_TAC[]; + +SUBGOAL_THEN`(v:real^3)IN affine hull {v,u,w:real^3}` ASSUME_TAC +THENL(*4*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; + +SUBGOAL_THEN`(u:real^3)IN affine hull {v,u,w:real^3}` ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; +SUBGOAL_THEN`(w:real^3)IN affine hull {v,u,w:real^3}` ASSUME_TAC +THENL(*6*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; +ASM_TAC +THEN SET_TAC[]]]]]);; + +let separate_point_convex_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3). +FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) +==> +?(h:real). &0< h /\ (!(y:real^3). y IN convex hull{v,u,w} ==> h < norm(y-x))`, + +REPEAT STRIP_TAC +THEN SUBGOAL_THEN `FINITE {(v:real^3),(u:real^3),(w:real^3)}` ASSUME_TAC +THENL(*1*)[ +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] remark1_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] remark1_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (w:real^3)`] remark1_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(v:real^3) IN (V:real^3->bool) /\ (u:real^3) IN (V:real^3->bool) /\ (w:real^3) IN (V:real^3->bool)==> {v,u,w} SUBSET V`) +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MATCH_MP_TAC(ISPECL[`{(v:real^3),(u:real^3),(w:real^3)}`;`V:real^3->bool`]FINITE_SUBSET) +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[FAN;fan1] +THEN SET_TAC[]; + +MP_TAC(ISPEC`{(v:real^3),(u:real^3),(w:real^3)}`FINITE_IMP_COMPACT_CONVEX_HULL) +THEN POP_ASSUM (fun th-> REWRITE_TAC[th;COMPACT_EQ_BOUNDED_CLOSED]) +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3) `;`(w:real^3)`]origin_point_not_in_convex_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`convex hull {(v:real^3),(u:real^3),(w:real^3)}`;`x:real^3`]SEPARATE_POINT_CLOSED) +THEN RESA_TAC +THEN EXISTS_TAC`d:real/ &2` +THEN STRIP_TAC +THENL[ +ASM_TAC THEN REAL_ARITH_TAC; + +ONCE_REWRITE_TAC[NORM_SUB] +THEN GEN_TAC +THEN POP_ASSUM (fun th ->MP_TAC(ISPEC`y:real^3`th)) +THEN REWRITE_TAC[dist;] +THEN DISCH_THEN(LABEL_TAC"A") +THEN DISCH_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN POP_ASSUM (fun th ->REWRITE_TAC[th]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]);; + + + +let bounded_convex_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ {v,u} IN E +==> ?(h:real). &0< h /\ (!(y:real^3). y IN convex hull{v,u} ==> norm(y-x) REWRITE_TAC[th;]) +THEN DISCH_TAC +THEN ASSUME_TAC(ISPEC`x:real^3` norm_origin_fan ) +THEN ASSUME_TAC(SET_RULE`convex hull {(v:real^3), u} SUBSET (:real^3)`) +THEN MP_TAC(ISPECL[`(\(y:real^3). lift(norm(y-x:real^3)))`;`(:real^3)`;`convex hull {(v:real^3),(u:real^3)}`]CONTINUOUS_ON_SUBSET) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(\(y:real^3). lift(norm(y-x:real^3)))`;`convex hull {(v:real^3),(u:real^3)}`]COMPACT_CONTINUOUS_IMAGE) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[COMPACT_EQ_BOUNDED_CLOSED;bounded;IMAGE;IN_ELIM_THM] +THEN ONCE_REWRITE_TAC[TAUT`A/\B<=>B/\A`;] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN SUBGOAL_THEN `(?x':real^3. x' IN convex hull {v, u} /\ + lift (norm (v - x:real^3)) = lift (norm (x' - x)))`ASSUME_TAC +THENL[ +EXISTS_TAC`v:real^3` +THEN SIMP_TAC[CONVEX_HULL_2; IN_ELIM_THM;] +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC; + +SUBGOAL_THEN `&0< (a:real)` ASSUME_TAC +THENL[ +REMOVE_THEN "A" (fun th-> MP_TAC(ISPEC`lift (norm (v - (x:real^3)))`th)) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NORM_LIFT;REAL_ABS_NORM ] +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] remark1_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_not_zero_fan) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`v-x:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(&0 =norm(v-x:real^3)) /\ &0 <= norm(v-x:real^3)==> &0 MP_TAC(ISPEC`lift (norm (y - x:real^3))`th)) +THEN ASM_REWRITE_TAC[NORM_LIFT;REAL_ABS_NORM ] +THEN ASM_TAC +THEN REAL_ARITH_TAC]; + +ASM_TAC +THEN REAL_ARITH_TAC]]]]);; + + + +(* ========================================================================== *) +(* ESILON OF FAN *) +(* ========================================================================== *) + + +let exists_open_not_collinear=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +==> +?t1:real. &0 < t1 /\ t1 <= &1 +/\ (!t:real. &0<= t /\ t<= t1==> ~(collinear{x,v,(&1-t)%u+ t % w}))`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ONCE_REWRITE_TAC[COLLINEAR_3;] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `; +`(E:(real^3->bool)->bool)`;` w:real^3`;` u:real^3`] +THEN FIND_ASSUM MP_TAC`~collinear {(x:real^3),(u:real^3),(w:real^3)}` +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B,C}={B,C,A}`;] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[collinear_fan] +THEN ASM_REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN DISCH_THEN(LABEL_TAC"MA") +THEN FIND_ASSUM MP_TAC`~((u:real^3) IN aff {(x:real^3), (v:real^3)})` +THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN DISCH_THEN(LABEL_TAC"A") +THEN SUBGOAL_THEN`!(t:real). ~((&1 - t) % u + t % w = x:real^3)`ASSUME_TAC +THENL(*1*)[ +GEN_TAC +THEN REMOVE_THEN "MA" MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN DISCH_TAC +THEN EXISTS_TAC`&1-(t:real)` +THEN EXISTS_TAC`(t:real)` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - t + t = &1`];(*1*) + + +SUBGOAL_THEN`!(t:real). (collinear {vec 0, v - x, ((&1 - t) % u + t % w) - x} <=> + vector_angle (v - x:real^3) (((&1 - t) % u + t % w) - x) = &0 \/ + vector_angle (v - x) (((&1 - t) % u + t % w) - x) = pi)`ASSUME_TAC +THENL(*2*)[ + +GEN_TAC +THEN MP_TAC(ISPECL[`(v:real^3)-(x:real^3)`;`((&1 - t) % (u:real^3) + (t:real) % (w:real^3)) - (x:real^3)`] +COLLINEAR_VECTOR_ANGLE) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-B=vec 0<=> A=B`];(*2*) + +ASM_REWRITE_TAC[] +THEN MRESA_TAC open_vector_angle_fan[ `x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`c:real`;`&0`] +THEN MRESA_TAC open_vector_angle_fan[ `x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`c:real`;`pi`] +THEN REWRITE_TAC[DE_MORGAN_THM;] +THEN MP_TAC(ISPECL[`{(t:real^1) | ~( +vector_angle ((v:real^3) - x) (((&1 - drop(t)) % (u:real^3) + drop(t) % (w:real^3)) - x) = &0)}` +;`{(t:real^1) | ~(vector_angle (v - x) (((&1 - drop (t)) % u + drop (t) % w) - (x:real^3)) = pi)}`]OPEN_INTER) +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM] +THEN DISCH_TAC +THEN SUBGOAL_THEN` +((vec 0):real^1) IN {(t:real^1) | ~( +vector_angle ((v:real^3) - x) (((&1 - drop(t)) % (u:real^3) + drop(t) % (w:real^3)) - x) = &0 )/\ +~(vector_angle (v - x) (((&1 - drop (t)) % u + drop (t) % w) - (x:real^3)) = pi)}` ASSUME_TAC +THENL(*3*)[ + +SIMP_TAC[IN_ELIM_THM;drop;VEC_COMPONENT;GSYM(DE_MORGAN_THM)] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(ISPECL[`((v:real^3)-(x:real^3))`;`((u:real^3)-(x:real^3))`]COLLINEAR_VECTOR_ANGLE) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-B=vec 0<=> A=B:real^3`] +THEN ONCE_REWRITE_TAC[GSYM(COLLINEAR_3);] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[];(*3*) + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"G") +THEN DISCH_TAC +THEN REMOVE_THEN "G" MP_TAC +THEN REWRITE_TAC[open_def] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`(vec 0):real^1`th)) +THEN ASM_REWRITE_TAC[IN_ELIM_THM;dist; VECTOR_ARITH`A-vec 0=A`] +THEN STRIP_TAC +THEN EXISTS_TAC`min ((e:real)/ &2) (&1)` +THEN STRIP_TAC +THENL(*4*)[ +POP_ASSUM (fun th->REWRITE_TAC[]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*4*) + +STRIP_TAC +THENL(*5*)[ +REAL_ARITH_TAC; +GEN_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`lift(t:real)`th)) +THEN REWRITE_TAC[LIFT_DROP;NORM_LIFT] +THEN DISCH_THEN(LABEL_TAC"G") +THEN STRIP_TAC +THEN REMOVE_THEN "G" MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]]]]);; + + + + + +let exist_close_fan=prove(`(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (v1:real^3) (w1:real^3). + +FAN(x,V,E) /\ {v,w} INTER {v1,w1}={} /\ {v1,w1} IN E /\ {v,w} IN E +==> +?h:real. +(&0 < h) +/\ +(!y1:real^3 y2:real^3. y1 IN (aff_ge {x} {v, w} INTER ballnorm_fan x) /\ y2 IN (aff_ge {x} {v1, w1} INTER ballnorm_fan x) +==> h <= dist(y1,y2) ))`, + +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (v1:real^3)`] +THEN MATCH_MP_TAC( ISPECL [`aff_ge {(x:real^3)} {(v:real^3), (w:real^3)} INTER ballnorm_fan x`; + `aff_ge {(x:real^3)} {(v1:real^3), (w1:real^3)} INTER ballnorm_fan x`] SEPARATE_CLOSED_COMPACT) +THEN MP_TAC(ISPECL[`(x:real^3) `;` (v:real^3)`;` (w:real^3)`]closed_aff_ge_ballnorm_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3) `;` (v1:real^3)`;` (w1:real^3)`]compact_aff_ge_ballnorm_fan) THEN RESA_TAC +THEN FIND_ASSUM(MP_TAC)`FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPECL[`{(v:real^3),(w:real^3)}`;`{(v1:real^3),(w1:real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION; IN_ELIM_THM;] +THEN ASM_REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL; SET_RULE`(A INTER C) INTER (B INTER C)= (A INTER B) INTER C`;] +THEN ASSUME_TAC(AFFINE_SING) +THEN MP_TAC(ISPEC`{ (x:real^3) }` AFFINE_HULL_EQ ) +THEN RESA_TAC +THEN RESA_TAC +THEN REWRITE_TAC[ballnorm_fan;INTER; IN_SING; EXTENSION;EMPTY;IN_ELIM_THM;] +THEN GEN_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DIST_REFL ] +THEN REAL_ARITH_TAC);; + + + + + +let inequality1_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) d:real. +FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) /\ &0 < d +==> +?(h:real). &0 (!(s:real). &0 <= s /\ s <= &1 +==> s * inv(norm((&1-s)%v+s%((&1-t)%u+ t%w)-x))* norm(u-((&1-t)%u+ t%w))< d ))`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`u-((&1-t)%u+ t%w)=t%(u-w):real^3`;NORM_MUL] +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;` (w:real^3)`]separate_point_convex_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN EXISTS_TAC`min ((h:real)*(d:real) *inv(norm(u-w:real^3))) (&1)` +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] remark1_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`u:real^3`;`w:real^3`]imp_norm_gl_zero_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(h:real)*(d:real)`;`inv(norm(u-w:real^3))`] REAL_LT_MUL) +THEN RESA_TAC +THEN STRIP_TAC +THENL[ +MP_TAC(ISPECL[`h:real`;`d:real`] REAL_LT_MUL) +THEN RESA_TAC +THEN ASM_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ + +REAL_ARITH_TAC; +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 <(h:real)==> ~(h= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(h:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`(t:real)< min ((h:real) * (d:real) * inv (norm (u - w:real^3))) (&1)/\ min (h * d * inv (norm (u - w))) (&1)<= &1 ==>t<= &1/\ (t:real)< (h * d * inv (norm (u - w:real^3)))`) +THEN ASM_REWRITE_TAC[REAL_ARITH`min (h * d * inv (norm (u - w))) (&1)<= &1`] +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3) `;`(w:real^3) `;`(t:real) `;`s:real`]expansion_convex_fan) +THEN RESA_TAC +THEN REMOVE_THEN "A"(fun th -> MP_TAC(ISPEC`(&1-s)%v+s%((&1-t)%u+ t%w):real^3`th)) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`h:real`;`norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)`]REAL_LT_INV2) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 &0 <= norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)`REAL_LE_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`t:real`REAL_ABS_REFL) +THEN RESP_TAC +THEN MP_TAC(ISPECL[`inv(norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3))`; +`inv(h:real)`;`t:real`;`(h * d * inv (norm (u - w:real^3)))`; +]REAL_LT_MUL2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`u:real^3`;`w:real^3`]imp_norm_not_zero_fan) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(norm(u-w:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`u-w:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(&0 =norm(u-w:real^3)) /\ &0 <= norm(u-w:real^3)==> &0 GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REDUCE_ARITH_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A*B*C=(A*B)*C:real`;VECTOR_ARITH`(&1 - s) % v + s % ((&1 - t) % u + t % w) - x=((&1 - s) % v + s % ((&1 - t) % u + t % w))- x :real^3`]; +MP_TAC(REAL_ARITH`~(s= &1) /\ s<= &1==> (s:real)< &1`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`s:real`;`&1`;`(inv (norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3))*(t:real)) * norm(u-w:real^3)`; +`d:real`]REAL_LT_MUL2) +THEN REDUCE_ARITH_TAC +THEN RESA_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A*d*B*C=A*(d*B)*C:real`;VECTOR_ARITH`(&1 - s) % v + s % ((&1 - t) % u + t % w) - x=((&1 - s) % v + s % ((&1 - t) % u + t % w))- x :real^3`]]]]);; + + + + + +let inequaility2_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) d:real. +FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) /\ &0 < d +==> +?(h:real). &0 (!(s:real). &0 <= s /\ s <= &1 +==> (norm(inv(norm((&1-s)%v+s%u-x))%((&1-s)%v+s%u-x) - inv(norm((&1-s)%v+s%((&1-t)%u+ t%w)-x))% ((&1-s)%v+s%u-x)))< d ))`, + +REWRITE_TAC[VECTOR_ARITH`A%B-C%B=(A-C)%B`;NORM_MUL] +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`u-((&1-t)%u+ t%w)=t%(u-w):real^3`;NORM_MUL] +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;` (w:real^3)`]separate_point_convex_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3) `;`(w:real^3)`]origin_point_not_in_convex_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"B") +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`]bounded_convex_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"C") +THEN EXISTS_TAC`min (h*h*(inv (h'))* inv(norm(u-w:real^3))*d:real) (&1)` +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] remark1_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`u:real^3`;`w:real^3`]imp_norm_not_zero_fan) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`u-w:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(&0 =norm(u-w:real^3)) /\ &0 <= norm(u-w:real^3)==> &0 ~(h= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(h:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 <(h':real)==> ~(h'= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(h':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`norm (u-w:real^3)`REAL_LE_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`norm (u-w:real^3)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(h:real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 &0 <= inv(h)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(h':real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 &0 <= inv(h')`) +THEN RESA_TAC +THEN STRIP_TAC +THENL(*1*)[ +MP_TAC(ISPECL[`(h:real)`;`inv (h':real) `]REAL_LT_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(h:real)`;`(h:real)*inv (h':real) `]REAL_LT_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(h:real)*(h:real)*inv (h':real)`;`inv(norm(u-w:real^3))`]REAL_LT_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(h:real)*(h:real)*inv (h':real) *inv(norm(u-w:real^3))`;`d:real`]REAL_LT_MUL) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*1*) + + +STRIP_TAC +THENL(*2*)[ + +REAL_ARITH_TAC;(*2*) + +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3)`;` s:real`]expansion1_convex_fan) +THEN RESA_TAC +THEN REMOVE_THEN "C"(fun th->MP_TAC(ISPEC`(&1 - s) % v + s % u:real^3`th)) +THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`] +origin_point_not1_in_convex_fan) +THEN RESA_TAC +THEN SUBGOAL_THEN`~(x=(&1-s)%v+s%u:real^3)` ASSUME_TAC +THENL(*3*)[ +POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN RESA_TAC;(*3*) + +MP_TAC(ISPECL[`(&1-s)%v+s%u:real^3`;`x:real^3`]imp_norm_not_zero_fan) +THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`(&1-s)%v+s%u-x:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(norm((&1-s)%v+s%u-x:real^3)= &0) /\ &0 <= norm((&1-s)%v+s%u-x:real^3)==> &0 t<= &1/\ (t:real)< (h * h * inv h' * inv (norm (u - w:real^3)) * d) `) +THEN ASM_REWRITE_TAC[REAL_ARITH`min (h * h * inv h' * inv (norm (u - w:real^3)) * d) (&1)<= &1`] +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`norm ((&1 - s) % v + s % u - x:real^3) `; +`(h':real)`;`t:real`;`(h * h * inv h' * inv (norm (u - w:real^3)) * d)`;]REAL_LT_MUL2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3) `;`(w:real^3) `;`(&0:real) `;`s:real`]expansion_convex_fan) +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &0/\ &0<= &1`] +THEN DISCH_TAC +THEN USE_THEN "A" (fun th-> MP_TAC(ISPEC`((&1 - s) % v + s % u:real^3)`th)) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th; VECTOR_ARITH`(A+B)-C=A+B-C:real^3`]) +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`h:real`;`norm ((&1 - s) % v + s % u-x:real^3)`]REAL_LT_INV2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`norm((&1-s)%v+s%u-x:real^3)`;`t:real`]REAL_LE_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv(norm ((&1 - s) % v + s % u - x:real^3))`;`inv(h:real)`;`norm ((&1 - s) % v + s % u - x:real^3)*(t:real)`;`(h':real)*(h * h * inv h' * inv (norm (u - w:real^3)) * d)`;]REAL_LT_MUL2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3) `;`(w:real^3) `;`(t:real) `;`s:real`]expansion_convex_fan) +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN USE_THEN "A" (fun th-> MP_TAC(ISPEC`(&1 - s) % v + s % ((&1 - t) % u + t % w):real^3`th)) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th; VECTOR_ARITH`(A+B)-C=A+B-C:real^3`]) +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`h:real`;`norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`]REAL_LT_INV2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv(norm((&1-s)%v+s%u-x:real^3))`;`norm((&1-s)%v+s%u-x:real^3)*(t:real)`]REAL_LE_MUL) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`NORM_POS_LE) +THEN MP_TAC(ISPEC`norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`REAL_LE_INV) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv(norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3))`;`inv(h:real)`;`inv(norm ((&1 - s) % v + s % u - x:real^3)) * norm ((&1 - s) % v + s % u - x:real^3)*(t:real)`;`inv(h:real)*(h':real)*(h * h * inv h' * inv (norm (u - w:real^3)) * d)`;]REAL_LT_MUL2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`norm (u - w:real^3)`; +`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3)) * + inv (norm ((&1 - s) % v + s % u - x)) * + norm ((&1 - s) % v + s % u - x) * + t`;`inv h * inv h * h' * h * h * inv h' * inv (norm (u - w:real^3)) * d`;]REAL_LT_LMUL) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(B*C)*E*A*D`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(A*B)*E*(C*D)`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(A*B)*E*(C*D)`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D=(A*B)*C*D`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(A*B)*(C*D)*E`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`(A*B*C)*D*E=A*B*(C*D)*E`] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B*C)*D=A*B*(C*D)`] +THEN REDUCE_ARITH_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`((A*B)*C*D)*E=(A*C)*(B*D)*E`] +THEN REDUCE_ARITH_TAC +THEN REWRITE_TAC[REAL_ARITH`((A*B)*C)*D*E=(A*B)*(C*D)*E`] +THEN ASSUME_TAC(ISPECL[`u:real^3`;`w:real^3`]NORM_SUB) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN MP_TAC(ISPECL[`t:real`;`w-u:real^3`]NORM_MUL) +THEN MP_TAC(ISPEC`t:real`REAL_ABS_REFL) +THEN RESP_TAC +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN ASM_REWRITE_TAC[REAL_ARITH`(A*B)*C*D=C*A*(B*D)`] +THEN REDUCE_ARITH_TAC +THEN DISCH_THEN(LABEL_TAC"BA") +THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3) `;`(w:real^3) `;`(t:real) `;`s:real`]expansion_convex_fan) +THEN RESA_TAC +THEN SUBGOAL_THEN`~(x=(&1 - s) % v + s % ((&1 - t) % u + t % w):real^3)` ASSUME_TAC +THENL(*4*)[ +POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"MA") +THEN STRIP_TAC +THEN REMOVE_THEN"MA" MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN ASM_REWRITE_TAC[];(*4*) + +MP_TAC(ISPECL[`(&1 - s) % v + s % ((&1 - t) % u + t % w):real^3`;`x:real^3`]imp_norm_not_zero_fan) +THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] +THEN RESA_TAC +THEN MP_TAC(ISPECL[`norm((&1 - s) % v + s % u-x:real^3)`;`norm((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`]REAL_SUB_INV) +THEN RESP_TAC +THEN ASM_REWRITE_TAC[REAL_ABS_ABS;REAL_ABS_DIV;REAL_ABS_MUL;REAL_ABS_NORM;real_div;REAL_INV_MUL; +REAL_ARITH`(A*B*C)*D=A*C*(B*D)`] +THEN REDUCE_ARITH_TAC +THEN MP_TAC(ISPECL[`((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`;`((&1 - s) % v + s % u-x:real^3)`]REAL_ABS_SUB_NORM) +THEN REWRITE_TAC[VECTOR_ARITH` +((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)-((&1 - s) % v + s % u - x)=s%(t)%(w-u) :real^3`] +THEN ONCE_REWRITE_TAC[NORM_MUL] +THEN MP_TAC(ISPEC`s:real`REAL_ABS_REFL) +THEN RESP_TAC +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`abs + (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3) - + norm ((&1 - s) % v + s % u - x))`;`s * norm (t % (w - u):real^3)`;`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3))`]REAL_LE_RMUL) +THEN RESA_TAC +THEN REMOVE_THEN "BA" MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(s= &1)\/ ~((s:real) = &1)`) +THENL(*5*)[ +ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*5*) + +MP_TAC(REAL_ARITH`~(s= &1) /\ s<= &1==> (s:real)< &1`) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`(t % (w - u):real^3)`NORM_POS_LE) +THEN MP_TAC(ISPECL[`norm (t % (w - u):real^3)`;`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3))`]REAL_LE_MUL) +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`s:real`;`&1`;`norm (t % (w - u)) * + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3))`; +`d:real`]REAL_LT_MUL2) +THEN REDUCE_ARITH_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]]]]);; + + + + + +let exists_point_small_edges_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) d:real. +FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) /\ &0 < d +==> +?(h:real). &0 (!(s:real). &0 <= s /\ s <= &1 +==> norm(inv(norm((&1-s)%v+s%u-x))%((&1-s)%v+s%u-x) - inv(norm((&1-s)%v+s%((&1-t)%u+ t%w)-x))% ((&1-s)%v+s%((&1-t)%u+ t%w)-x))< d ))`, + +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0< (d:real)==> &0< d/ &2`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3) `;`(w:real^3)`]origin_point_not_in_convex_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3) `;`(w:real^3)`;` (d:real)/ &2`]inequaility2_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool) `;`(v:real^3)`;` (u:real^3)`;` (w:real^3)`;` (d:real)/ &2`]inequality1_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"B") +THEN EXISTS_TAC`min (h:real) (h':real)` +THEN STRIP_TAC +THENL[ASM_TAC +THEN REAL_ARITH_TAC; + +STRIP_TAC +THENL[ +ASM_TAC +THEN REAL_ARITH_TAC; + +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`t< min (h:real) (h':real)==> t< (h:real) /\ t< (h':real)`) +THEN RESA_TAC +THEN REMOVE_THEN"B" (fun th-> MP_TAC(ISPEC`t:real`th)) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`s:real`th)) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"B") +THEN REMOVE_THEN"A" (fun th-> MP_TAC(ISPEC`t:real`th)) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`s:real`th)) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN ASSUME_TAC(ISPEC`((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`NORM_POS_LE) +THEN MP_TAC(ISPEC`norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`REAL_LE_INV) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`s * + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3)):real`;`(u - ((&1 - t) % u + t % w)):real^3`]NORM_MUL) +THEN REWRITE_TAC[REAL_ABS_MUL] +THEN MP_TAC(ISPEC`s:real`REAL_ABS_REFL) +THEN RESP_TAC +THEN MP_TAC(ISPEC`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3)):real`REAL_ABS_REFL) +THEN RESP_TAC +THEN REWRITE_TAC[REAL_ARITH`(A*B)*C=A*B*C`] +THEN DISCH_TAC +THEN REMOVE_THEN"B"MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN REWRITE_TAC[VECTOR_ARITH`(s * inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x))) % + (u - ((&1 - t) % u + t % w))= inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % u - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3`] + +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`norm(inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % u - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3)`;`(d:real)/ &2`; +`norm + (inv (norm ((&1 - s) % v + s % u - x)) % ((&1 - s) % v + s % u - x) - + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % u - x):real^3)`;`(d:real)/ &2`; +]REAL_LT_ADD2) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`d / &2 + d/ &2 = d`] +THEN MP_TAC(ISPECL[`(inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % u - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3)`; +`(inv (norm ((&1 - s) % v + s % u - x)) % ((&1 - s) % v + s % u - x) - + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % u - x):real^3)`]NORM_TRIANGLE) +THEN REWRITE_TAC[VECTOR_ARITH`(inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % u - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3)+ +(inv (norm ((&1 - s) % v + s % u - x)) % ((&1 - s) % v + s % u - x) - + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % u - x):real^3)=(inv (norm ((&1 - s) % v + s % u - x)) % ((&1 - s) % v + s % u - x) - + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) `] +THEN REAL_ARITH_TAC]]);; + + + + + +let same_projective_sphere_ge_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) (t:real) (y1:real^3). +FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~collinear {x, v, (&1 - t) % u + t % w} +/\ ~(y1=x) +/\ (y1 IN aff_ge {x} {v, (&1-t)%u+(t:real)% (w:real^3)} INTER ballnorm_fan x) + +==> ?s:real. &0 <= s/\ s<= &1 +/\ y1=inv(norm((&1 - s) % v + s % ((&1 - t) % u + t % w)-x))%((&1 - s) % v + s % ((&1 - t) % u + t % w)-x)+x`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN MP_TAC(ISPECL[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;]th3) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;]AFF_GE_1_2) +THEN RESA_TAC +THEN REMOVE_THEN"A" MP_TAC +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;dist;ballnorm_fan] +THEN STRIP_TAC +THEN SUBGOAL_THEN`~(&1 - t1:real= &0)/\ &0 <= &1-t1` ASSUME_TAC +THENL[ +STRIP_TAC +THENL[ + +FIND_ASSUM MP_TAC`t1+t2+t3= &1:real` +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN REWRITE_TAC[REAL_ARITH`(A+B)-A=B`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`(&0 <= t2) /\ (&0 <= t3) /\(t2+t3= &0)==> t2= &0 /\ t3= &0`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`y1 = t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w) +:real^3` +THEN FIND_ASSUM MP_TAC`t1+t2+t3= &1:real` +THEN POP_ASSUM (fun th-> REWRITE_TAC[(th)]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[(th)]) +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[(th)]) +THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[]; +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPECL[`t2:real`;`t3:real`]REAL_LT_ADD) +THEN REAL_ARITH_TAC]; + +MP_TAC(REAL_ARITH`~(&1 - t1= &0)/\ &0 <= &1-t1==> &0< (&1 -t1:real)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(&1 -t1:real)`REAL_LE_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(&1-t1:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv ((&1 - t1:real))`;`(t2:real)`]REAL_LE_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv ((&1 - t1:real))`;`(t3:real)`]REAL_LE_MUL) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC `t1+t2+t3= &1:real` +THEN REWRITE_TAC[REAL_ARITH`A+B+C=D<=>B+C=D-A`] +THEN DISCH_TAC +THEN MP_TAC(SET_RULE`t2+t3 = &1-t1 ==> (inv (&1-t1))*(t2+t3) = (inv (&1-t1))* (&1-t1:real)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)=D<=>D- A*C=A*B`] +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`inv ((&1 - t1:real))*(t3:real)` +THEN STRIP_TAC +THENL[ +ASM_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ +ASM_TAC +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[VECTOR_ARITH`(inv (&1 - t1) * t2) % v + + (inv (&1 - t1) * t3) % ((&1 - t) % u + t % w)-x= inv (&1 - t1) %( t2 % v + t3 % ((&1 - t) % u + t % w))-x:real^3`] +THEN FIND_ASSUM MP_TAC `norm(x-y1:real^3)= &1` +THEN FIND_ASSUM MP_TAC `y1 = t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w):real^3` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[NORM_SUB] +THEN REWRITE_TAC[VECTOR_ARITH`(B%A+C+D)-A=C+D-(&1-B)%A`] +THEN DISCH_TAC +THEN MP_TAC(SET_RULE`norm (t2 % v + t3 % ((&1 - t) % u + t % w) - (&1 - t1) % x:real^3) = &1 ==> (inv (&1-t1))*(norm (t2 % v + t3 % ((&1 - t) % u + t % w) - (&1 - t1) % x) ) = (inv (&1-t1))* (&1):real`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN MP_TAC(ISPECL[`inv(&1-t1:real)`;`t2 % v + t3 % ((&1 - t) % u + t % w) - (&1 - t1) % x:real^3`]NORM_MUL) +THEN MP_TAC(ISPEC`inv(&1-t1:real)`REAL_ABS_REFL) +THEN RESP_TAC +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B+C-E%D)=A%(B+C)-(A*E)%D`] +THEN REDUCE_VECTOR_TAC +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[(th)]) +THEN ASM_REWRITE_TAC[REAL_INV_INV;VECTOR_ARITH`(&1-A)%(B%C-D)+D= A%D+(B*(&1-A))%C:real^3`] +THEN REDUCE_VECTOR_TAC]]]);; + + + + + +let same_projective_sphere_gt_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) (t:real) (y1:real^3). +FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~collinear {x, v, (&1 - t) % u + t % w} +/\ (y1 IN aff_gt {x} {v, (&1-t)%u+(t:real)% (w:real^3)} INTER ballnorm_fan x) + +==> ?s:real. &0 <= s/\ s<= &1 +/\ y1=inv(norm((&1 - s) % v + s % ((&1 - t) % u + t % w)-x))%((&1 - s) % v + s % ((&1 - t) % u + t % w)-x)+x`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN MP_TAC(ISPECL[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;]th3) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;]AFF_GT_1_2) +THEN RESA_TAC +THEN REMOVE_THEN"A" MP_TAC +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;dist;ballnorm_fan] +THEN STRIP_TAC +THEN SUBGOAL_THEN`~(&1 - t1= &0)/\ &0 < &1-t1` ASSUME_TAC +THENL[ +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPECL[`t2:real`;`t3:real`]REAL_LT_ADD) +THEN REAL_ARITH_TAC; + +MP_TAC(ISPEC`(&1 -t1:real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(&1-t1:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv ((&1 - t1:real))`;`(t2:real)`]REAL_LT_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv ((&1 - t1:real))`;`(t3:real)`]REAL_LT_MUL) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC `t1+t2+t3= &1:real` +THEN REWRITE_TAC[REAL_ARITH`A+B+C=D<=>B+C=D-A`] +THEN DISCH_TAC +THEN MP_TAC(SET_RULE`t2+t3 = &1-t1 ==> (inv (&1-t1))*(t2+t3) = (inv (&1-t1))* (&1-t1:real)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)=D<=>D- A*C=A*B`] +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`inv ((&1 - t1:real))*(t3:real)` +THEN STRIP_TAC +THENL[ +ASM_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ +ASM_TAC +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[VECTOR_ARITH`(inv (&1 - t1) * t2) % v + + (inv (&1 - t1) * t3) % ((&1 - t) % u + t % w)-x= inv (&1 - t1) %( t2 % v + t3 % ((&1 - t) % u + t % w))-x:real^3`] +THEN FIND_ASSUM MP_TAC `norm(x-y1:real^3)= &1` +THEN FIND_ASSUM MP_TAC `y1 = t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w):real^3` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[NORM_SUB] +THEN REWRITE_TAC[VECTOR_ARITH`(B%A+C+D)-A=C+D-(&1-B)%A`] +THEN DISCH_TAC +THEN MP_TAC(SET_RULE`norm (t2 % v + t3 % ((&1 - t) % u + t % w) - (&1 - t1) % x:real^3) = &1 ==> (inv (&1-t1))*(norm (t2 % v + t3 % ((&1 - t) % u + t % w) - (&1 - t1) % x) ) = (inv (&1-t1))* (&1):real`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN MP_TAC(REAL_ARITH`&0 &0<= inv(&1-t1:real)`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv(&1-t1:real)`;`t2 % v + t3 % ((&1 - t) % u + t % w) - (&1 - t1) % x:real^3`]NORM_MUL) +THEN MP_TAC(ISPEC`inv(&1-t1:real)`REAL_ABS_REFL) +THEN RESP_TAC +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B+C-E%D)=A%(B+C)-(A*E)%D`] +THEN REDUCE_VECTOR_TAC +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[(th)]) +THEN ASM_REWRITE_TAC[REAL_INV_INV;VECTOR_ARITH`(&1-A)%(B%C-D)+D= A%D+(B*(&1-A))%C:real^3`] +THEN REDUCE_VECTOR_TAC]]]);; + + + +let separate1_sphere_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) (v1:real^3) (u1:real^3). + +FAN(x,V,E) /\ {v,u} INTER {v1,u1}={} /\ {v,u} IN E/\ {u,w} IN E /\ {v1,u1} IN E +/\ ~(coplanar{x,v,u,w}) +==> +?h:real. +(&0 < h) /\ (h<= &1) +/\ +(!t:real. &0 aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge {x} {v1, u1} INTER ballnorm_fan x={})`, + +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC exist_close_fan[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`; +`(v1:real^3)`;` (u1:real^3)`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THA") +THEN MRESA_TAC exists_open_not_collinear[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A" ) +THEN MRESA_TAC exists_point_small_edges_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(v:real^3)`;`(u:real^3) `;`(w:real^3)`;`h:real`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"B" ) +THEN EXISTS_TAC`min ((h':real)/ &2) (t1:real)` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*1*)[ +ASM_TAC +THEN REAL_ARITH_TAC;(*1*) + +STRIP_TAC +THENL(*2*)[ + +ASM_TAC +THEN REAL_ARITH_TAC;(*2*) + +REPEAT STRIP_TAC +THEN REWRITE_TAC[EXTENSION] +THEN GEN_TAC +THEN EQ_TAC +THENL(*3*)[ + +STRIP_TAC +THEN REWRITE_TAC[EMPTY;IN_ELIM_THM] +THEN SUBGOAL_THEN `!y1:real^3. + y1 IN aff_gt {x} {v, (&1-t)%u+(t:real)% (w:real^3)} INTER ballnorm_fan x +==> ?y2:real^3. y2 IN aff_ge {x:real^3} {(v:real^3), (u:real^3)} INTER ballnorm_fan x /\ + dist (y1,y2)<(h:real)` ASSUME_TAC +THENL(*4*)[ +MP_TAC(REAL_ARITH`&0 <(t:real)/\ &0< h' /\ t < min ((h':real)/ &2) (t1:real)==> &0 <= t /\ t<=t1 /\ t< h'`) +THEN RESA_TAC +THEN REMOVE_THEN"A" (fun th-> MP_TAC(ISPEC`t:real`th)) +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MRESA_TAC same_projective_sphere_gt_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(v:real^3)`;`(u:real^3) `;`(w:real^3)`;` (t:real) `;`(y1:real^3)`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] +THEN MRESA_TAC AFF_GE_1_2[`(x:real^3)` ;` (v:real^3)`;`(u:real^3) `;] +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;dist] +THEN MRESA_TAC expansion1_convex_fan[`(v:real^3)`;` (u:real^3)`;` s:real`] +THEN MRESA_TAC origin_point_not1_in_convex_fan[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`] +THEN SUBGOAL_THEN`~(x=(&1-s)%v+s%u:real^3)` ASSUME_TAC +THENL(*5*)[ +POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN RESA_TAC;(*5*) + +MP_TAC(ISPECL[`x:real^3`;`(&1 - s) % v + s % u:real^3`]imp_norm_not_zero_fan) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[NORM_SUB] +THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`(&1 - s) % v + s % u-x:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(&0 =norm((&1 - s) % v + s % u-x:real^3)) /\ &0 <= norm((&1 - s) % v + s % u-x:real^3)==> &0 MP_TAC(ISPEC`t:real`th)) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`s:real`th)) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[NORM_SUB]](*6*)](*5*);(*4*) +POP_ASSUM (fun th->MP_TAC(ISPEC`x':real^3`th)) +THEN MP_TAC(SET_RULE` x' IN aff_gt {x} {v, (&1 - t) % u + t % w} INTER aff_ge {x} {v1, u1} INTER + ballnorm_fan x ==> x' IN aff_ge {x} {v1, u1:real^3} INTER ballnorm_fan x +/\ x' IN aff_gt {x} {v, (&1 - t) % u + t % w:real^3} INTER ballnorm_fan x`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN SIMP_TAC[] +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THA" (fun th-> MP_TAC(ISPECL[`y2:real^3`;`x':real^3`]th)) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN SIMP_TAC[dist;NORM_SUB] +THEN REAL_ARITH_TAC](*4*);(*3*) + +SET_TAC[]]]]);; + + + + +let fan_run_in_small1_is_fan=prove( +`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 v1:real^3 u1:real^3. +FAN(x,V,E) /\ {v,u} INTER {v1,u1}={} /\ {v,u} IN E/\ {u,w} IN E /\ {v1,u1} IN E +/\ ~(coplanar{x,v,u,w}) +==> +?t1:real. &0 < t1 /\ t1 <= &1 +/\ (!t:real. &0< t /\ t< t1 ==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v1,u1}={})`, + +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u1:real^3)`; +` (v1:real^3)`] +THEN MRESA_TAC exists_open_not_collinear[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"BA") +THEN MRESA_TAC separate1_sphere_fan[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3)`;` (w:real^3)`;` (v1:real^3)`;`(u1:real^3)`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH` &0 < t1/\ &0 < h ==> &0 < min (h:real) (t1:real)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH` t1 <= &1 /\ h <= &1==> min (h:real) (t1:real)<= &1`) +THEN RESA_TAC +THEN EXISTS_TAC`min (h:real) (t1:real)` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH` &0 < t /\ t< min (h:real) (t1:real)==> t< h /\ t<= t1 /\ &0 <= t`) +THEN RESA_TAC +THEN REMOVE_THEN "A"(fun th-> MRESA1_TAC th `(t:real)`) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN REMOVE_THEN "BA"(fun th-> MRESA1_TAC th `(t:real)`) +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] +THEN MRESA_TAC origin_is_not_aff_gt_fan[`x:real^3`;`v:real^3`;`(&1-t)%u+t%w:real^3`] +THEN REWRITE_TAC[EXTENSION;INTER;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL[ REPEAT STRIP_TAC +THEN SUBGOAL_THEN`~(x=x':real^3)`ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; +MRESA_TAC imp_norm_not_zero_fan[`x':real^3`;`x:real^3`] +THEN ASSUME_TAC(ISPEC`x'-x:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(norm(x'-x:real^3)= &0) /\ &0 <= norm(x'-x:real^3)==> &0 MRESA_TAC th [`x':real^3`;`inv(norm(x'-x:real^3))`]) +THEN MRESA_TAC scale_aff_gt_fan[`x:real^3`;`v:real^3`;`(&1-t)%u+t%w:real^3`] +THEN POP_ASSUM(fun th -> MRESA_TAC th [`x':real^3`;`inv(norm(x'-x:real^3))`]) +THEN SUBGOAL_THEN`inv (norm (x' - x)) % (x' - x) + x IN ballnorm_fan x:real^3->bool` ASSUME_TAC +THENL[ +MRESA1_TAC REAL_ABS_REFL `inv(norm(x'-x:real^3))` +THEN ASM_REWRITE_TAC[ballnorm_fan;IN_ELIM_THM;dist;VECTOR_ARITH`B-(A+B)= --A:real^3`;NORM_NEG;NORM_MUL]; + +ASM_TAC +THEN SET_TAC[]]]; + +SET_TAC[]]);; + + +let fan_run_in_small21_is_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {v,w1} IN E +/\ ~coplanar {x,v,u,w} +==> +?t1:real. &0 aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v,w1}={})`, + +REPEAT STRIP_TAC +THEN MRESA_TAC exists_open_not_collinear[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN DISJ_CASES_TAC(SET_RULE`(?h:real. &0 &0<=t`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`(t:real)<= min (t1:real) (h:real/ &2) ==> t <= t1`) +THEN RESA_TAC +THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `t:real`) +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (v:real^3)`] +THEN REWRITE_TAC[INTER;EXTENSION;IN_ELIM_THM;] +THEN GEN_TAC +THEN EQ_TAC +THENL(*4*)[ +DISCH_TAC +THEN SUBGOAL_THEN `(&1-t)%u+t%w IN aff_ge {x,v} {w1}:real^3->bool` ASSUME_TAC +THENL(*5*)[ +POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-t)%u +t%w:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2 % v + t3 % ((&1 - t) % u + t % w) = + t1'' % x + t2' % v + t3' % w1<=> t3 % ((&1 - t) % u + t % w) = + (t1''-t1') % x + (t2'-t2) % v + t3' % w1:real^3`] +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`(t3:real)` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3 % ((&1 - t) % u + t % w) = (t1''-t1') % x + (t2'-t2) % v + t3' % w1:real^3 +==> (inv (t3))%(t3 % ((&1 - t) % u + t % w)) = (inv (t3))%((t1''-t1') % x + (t2'-t2) % v + t3' % w1)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;VECTOR_ARITH`A%(B%X+C%Y+D%Z)=(A*B)%X+(A*C)%Y+(A*D)%Z`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`t1'' + t2' + t3' = &1:real` +THEN FIND_ASSUM MP_TAC`t1' + t2 + t3 = &1:real` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM(th)]) +THEN REWRITE_TAC[REAL_ARITH`t1'' + t2' + t3' = t1' + t2 + t3<=> (t1''-t1') + (t2'-t2) + t3' = t3:real`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +(t1''-t1') + (t2'-t2) + t3' = t3 +==> (inv (t3))*((t1''-t1') + (t2'-t2) + t3') = (inv (t3))*t3`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C+D)=A*B+A*C+A*D`] +THEN STRIP_TAC +THEN EXISTS_TAC`inv t3 * (t1'' - t1'):real` +THEN EXISTS_TAC`inv t3 * (t2' - t2):real` +THEN EXISTS_TAC`inv t3 * t3':real` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_INV +THEN ASM_TAC +THEN REAL_ARITH_TAC;(*5*) +MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`;`(&1 - t) % u + t % w:real^3`;] +THEN MRESA_TAC injective_azim_coplanar[`x:real^3`;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th->MRESA_TAC th [`h:real`;`t:real`]) +THEN ASM_TAC +THEN REAL_ARITH_TAC](*5*)(*4*); +SET_TAC[]]]];(*1*) +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NOT_EXISTS_THM] +THEN DISCH_THEN(LABEL_TAC"B") +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 &0<=t`) +THEN RESA_TAC +THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `t:real`) +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (v:real^3)`] +THEN REWRITE_TAC[INTER;EXTENSION;IN_ELIM_THM;] +THEN GEN_TAC +THEN EQ_TAC +THENL(*2*)[ +DISCH_TAC +THEN SUBGOAL_THEN `(&1-t)%u+t%w IN aff_ge {x,v} {w1}:real^3->bool` ASSUME_TAC +THENL(*3*)[ +POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-t)%u +t%w:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2 % v + t3 % ((&1 - t) % u + t % w) = + t1'' % x + t2' % v + t3' % w1<=> t3 % ((&1 - t) % u + t % w) = + (t1''-t1') % x + (t2'-t2) % v + t3' % w1:real^3`] +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`(t3:real)` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3 % ((&1 - t) % u + t % w) = (t1''-t1') % x + (t2'-t2) % v + t3' % w1:real^3 +==> (inv (t3))%(t3 % ((&1 - t) % u + t % w)) = (inv (t3))%((t1''-t1') % x + (t2'-t2) % v + t3' % w1)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;VECTOR_ARITH`A%(B%X+C%Y+D%Z)=(A*B)%X+(A*C)%Y+(A*D)%Z`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`t1'' + t2' + t3' = &1:real` +THEN FIND_ASSUM MP_TAC`t1' + t2 + t3 = &1:real` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM(th)]) +THEN REWRITE_TAC[REAL_ARITH`t1'' + t2' + t3' = t1' + t2 + t3<=> (t1''-t1') + (t2'-t2) + t3' = t3:real`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +(t1''-t1') + (t2'-t2) + t3' = t3 +==> (inv (t3))*((t1''-t1') + (t2'-t2) + t3') = (inv (t3))*t3`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C+D)=A*B+A*C+A*D`] +THEN STRIP_TAC +THEN EXISTS_TAC`inv t3 * (t1'' - t1'):real` +THEN EXISTS_TAC`inv t3 * (t2' - t2):real` +THEN EXISTS_TAC`inv t3 * t3':real` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_INV +THEN ASM_TAC +THEN REAL_ARITH_TAC;(*3*) +MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`;`(&1 - t) % u + t % w:real^3`;] +THEN REMOVE_THEN "B"(fun th -> MRESAL1_TAC th `t:real`[DE_MORGAN_THM]) +THEN ASM_TAC +THEN REAL_ARITH_TAC]; +SET_TAC[]]]);; + + + +let fan_run_in_small2_is_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 w1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {v,w1} IN E +/\ ~coplanar {x,v,u,w} +==> +?t1:real. &0 aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v,w1}={})`, +REPEAT STRIP_TAC +THEN MRESA_TAC fan_run_in_small21_is_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`tt<=t1`) +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `t:real`));; + + + +let extension_in_aff_2_2_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +==> +(!t:real. &0< t /\ t< &1 +==> (!t1:real t2:real t3:real. &0t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w) IN aff_gt {x,u} {w,v}))`, +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN SUBGOAL_THEN `DISJOINT {x,u:real^3} {w,v:real^3}` ASSUME_TAC +THENL[ +REWRITE_TAC[DISJOINT_SYM;SET_RULE`{v:real^3,w:real^3}= {v} UNION {w}`;DISJOINT_UNION] +THEN REWRITE_TAC[SET_RULE`{v} UNION {w}={v:real^3,w:real^3}`] +THEN ONCE_REWRITE_TAC[DISJOINT_SYM] +THEN ASM_REWRITE_TAC[]; +MRESAL_TAC AFF_GT_2_2[`x:real^3`;`u:real^3`;`w:real^3`;`v:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t3*(&1-t):real` +THEN EXISTS_TAC`t3*(t):real` +THEN EXISTS_TAC`t2:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`t1 + t3 * (&1 - t) + t3 * t +t2 = t1+t2+t3:real`;VECTOR_ARITH`t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w) = + t1 % x + (t3 * (&1 - t)) % u + (t3 * t) % w+ t2 % v:real^3`] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_TAC +THEN REAL_ARITH_TAC]);; + + + +let inequality3_aim_in_convex_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ +(&0< azim x u w v ) /\ (azim x u w v +(!t:real. &0< t /\ t< &1 +==> (!t1:real t2:real t3:real. &0 &0< azim x u w (t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w)) +/\ azim x u w (t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w))< azim x u w v))`, + +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC`{v,u} IN (E:(real^3->bool)->bool)` +THEN ONCE_REWRITE_TAC[SET_RULE`{v,u}={u,v}`] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC WEDGE_LUNE_GT[`x:real^3`;` u:real^3`;`w:real^3`;`v:real^3`] +THEN POP_ASSUM (fun th-> MP_TAC(SYM(th))) +THEN DISCH_TAC +THEN MRESA_TAC extension_in_aff_2_2_fan[`x:real^3`;` v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `t:real`) +THEN POP_ASSUM(fun th-> MRESAL_TAC th [`t1:real`;`t2:real`;`t3:real`][wedge;IN_ELIM_THM]));; + + + +let fan_run_in_small3_is_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 w1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {u,w1} IN E +/\ ~coplanar {x,v,u,w} /\ sigma_fan x V E u w=v +/\ (&0< azim x u w v ) /\ (azim x u w v +?t1:real. &0 aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {u,w1}={})`, +REPEAT STRIP_TAC +THEN MRESA_TAC exists_open_not_collinear[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 &0<=t /\ ~(t= &0)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`tt<=t1 /\ t< &1`) +THEN RESA_TAC +THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `t:real`) +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (u:real^3)`] +THEN REWRITE_TAC[EXTENSION;INTER;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL(*1*)[ +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-t)%u +t%w:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN `x' IN (aff_ge {x,u} {w1}:real^3->bool)`ASSUME_TAC +THENL(*2*)[ +POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`u:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`u:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`t1'':real` +THEN EXISTS_TAC`t2':real` +THEN EXISTS_TAC`t3':real` +THEN ASM_REWRITE_TAC[];(*2*) + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC inequality3_aim_in_convex_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;` w:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `t:real`) +THEN POP_ASSUM(fun th-> MRESA_TAC th [`t1':real`;`t2:real`;`t3:real`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"BE") +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN SUBGOAL_THEN`~collinear {x, u, x':real^3}`ASSUME_TAC +THENL(*3*)[ +MRESA_TAC continuous_coplanar_fan [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `t:real`) +THEN ASM_REWRITE_TAC[collinear_fan;] +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[coplanar;aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN SUBGOAL_THEN`(x:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL(*4*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC;(*4*) + +SUBGOAL_THEN`(v:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC;(*5*) + +SUBGOAL_THEN`(u:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL(*6*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC;(*6*) + +SUBGOAL_THEN`((&1 - t) % u + t % w:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL(*7*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(t3:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + t2 % v + t3 % ((&1 - t) % u + t % w) = u' % x + v' % u +<=>t3 % ((&1 - t) % u + t % w) = (u'-t1') % x -t2 % v+v' % u:real^3`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3 % ((&1 - t) % u + t % w) = (u'-t1') % x -t2 % v+v' % u +==> (inv (t3))%(t3 % ((&1 - t) % u + t % w) ) = (inv (t3))%((u'-t1') % x -t2 % v+v' % u):real^3`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B-C+D)=A%B-A%C+A%D`;VECTOR_ARITH`A%B%C=(A*B)%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`(inv t3 * (u' - t1')):real` +THEN EXISTS_TAC`-- (inv t3 * t2):real` +THEN EXISTS_TAC`(inv t3 * v'):real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A+(--b)%C+d=A-b%C+d`;REAL_ARITH`inv t3 * (u' - t1') + --(inv t3 * t2) + inv t3 * v'=inv t3 * (t3+(u'+v') - (t1'+ t2+t3))`;REAL_ARITH`A+ &1- &1=A`];(*7*) + +ASM_TAC +THEN SET_TAC[]](*7*)](*6*)](*5*)](*4*);(*3*) + +MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`u:real^3`;`x':real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`u:real^3`;`x':real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`;`x':real^3`;] +THEN REMOVE_THEN"BE" MP_TAC +THEN REMOVE_THEN"YEU" MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN FIND_ASSUM MP_TAC`(sigma_fan x V E u w = (v:real^3))` +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge u V E = {w:real^3}) \/ ~(set_of_edge u V E = {w})`) +THENL(*4*)[ +FIND_ASSUM MP_TAC`w1 IN set_of_edge (u:real^3) V E` +THEN POP_ASSUM (fun th-> REWRITE_TAC[(th);IN_SING]) +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC (ISPECL[`x:real^3`;`u:real^3`;`w:real^3`]AZIM_REFL) +THEN REAL_ARITH_TAC;(*4*) + +DISJ_CASES_TAC(SET_RULE`(w1:real^3)=w \/ ~((w1:real^3)=w)`) +THENL(*5*)[ +ASM_REWRITE_TAC[] +THEN MP_TAC (ISPECL[`x:real^3`;`u:real^3`;`w:real^3`]AZIM_REFL) +THEN REAL_ARITH_TAC;(*5*) + +MRESA_TAC SIGMA_FAN[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(u:real^3)`;`(w:real^3)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w1:real^3`) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]]]; + +SET_TAC[]]);; + + +let fan_run_in_small_is_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 v1:real^3 w1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {v1,w1} IN E +/\ (&0< azim x u w v ) /\ (azim x u w v +?t1:real. &0 aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v1,w1}={})`, +(let lem=prove(`!x v v1. aff_ge {x} {v1, v}=aff_ge {x} {v, v1}`, +REPEAT STRIP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{v,u}={u,v}`] +THEN SIMP_TAC[]) in + +REPEAT STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN DISJ_CASES_TAC(SET_RULE`(v1=v)\/ ~(v1=v:real^3)`) +THENL[ +MRESA_TAC fan_run_in_small2_is_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v1:real^3`;`u:real^3`;` w:real^3`;`w1:real^3`]; + +DISJ_CASES_TAC(SET_RULE`(v1=u)\/ ~(v1=u:real^3)`) +THENL[ +MRESA_TAC fan_run_in_small3_is_fan[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` v1:real^3`;` w:real^3`;`w1:real^3`]; + DISJ_CASES_TAC(SET_RULE`(w1=v)\/ ~(w1=v:real^3)`) +THENL[ +FIND_ASSUM MP_TAC`{v1,w1} IN (E:(real^3->bool)->bool)` +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{v,u}={u,v}`] +THEN STRIP_TAC +THEN MRESA_TAC fan_run_in_small2_is_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w1:real^3`;`u:real^3`;` w:real^3`;`v1:real^3`] +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[lem]; +DISJ_CASES_TAC(SET_RULE`(w1=u)\/ ~(w1=u:real^3)`) +THENL[ +FIND_ASSUM MP_TAC`{v1,w1} IN (E:(real^3->bool)->bool)` +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{v,u}={u,v}`] +THEN STRIP_TAC +THEN MRESA_TAC fan_run_in_small3_is_fan[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` w1:real^3`;` w:real^3`;`v1:real^3`] +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[lem]; +SUBGOAL_THEN`{v,u} INTER {v1,w1:real^3}={}` ASSUME_TAC +THENL[ +ASM_TAC +THEN SET_TAC[]; +MRESA_TAC fan_run_in_small1_is_fan[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;` w:real^3`;`v1:real^3`;`w1:real^3`]]]]]]));; + + + + + + +let fan_run1_in_small_is_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) (E':(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ E' SUBSET E +/\ (&0< azim x u w v ) /\ (azim x u w v +?h:real. &0 aff_gt{x} {v,(&1-s)%u+ s % w} INTER {v | ?e. e IN E' /\ v IN aff_ge {x} e}={})`, + +REPEAT STRIP_TAC +THEN MRESA_TAC set_edges_is_finite_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC FINITE_SUBSET [`(E':(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`] +THEN ABBREV_TAC`n=CARD (E':(real^3->bool)->bool)` +THEN REPEAT(POP_ASSUM MP_TAC) +THEN SPEC_TAC (`(E':(real^3->bool)->bool)`,`(E':(real^3->bool)->bool)`) +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC +THENL(*1*)[ +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`E':(real^3->bool)->bool`]CARD_EQ_0) +THEN RESA_TAC +THEN EXISTS_TAC`&1 / &2` +THEN REWRITE_TAC[REAL_ARITH`&0< &1/ &2`;REAL_ARITH`&1 / &2 <= &1`] +THEN ASM_SET_TAC[];(*1*) + +REPEAT GEN_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC "A") +THEN REPEAT STRIP_TAC +THEN MP_TAC(ISPEC`(E':(real^3->bool)->bool)` CHOOSE_SUBSET) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`n:num `th)) +THEN REWRITE_TAC[ARITH_RULE `n:num <= SUC n`; HAS_SIZE] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` t SUBSET E' /\ E' SUBSET E ==> (t:(real^3->bool)->bool) SUBSET E`) +THEN RESA_TAC +THEN REMOVE_THEN "A" (fun th-> MP_TAC(ISPEC`(t:(real^3->bool)->bool)`th)) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN SUBGOAL_THEN `~((E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)= {})` ASSUME_TAC +THENL(*2*)[ +STRIP_TAC +THEN MP_TAC(SET_RULE`(E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)={} /\ t SUBSET E' ==> t= E'`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`CARD (t:(real^3->bool)->bool)=n` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC;(*2*) +SUBGOAL_THEN`?e. e IN (E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)` ASSUME_TAC +THENL(*3*)[ +ASM_SET_TAC[];(*3*) + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`e IN (E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)/\ +(E':(real^3->bool)->bool) SUBSET (E:(real^3->bool)->bool) /\ t SUBSET E' ==> e IN E'/\ e IN E/\ ~(e IN t) /\ {e} UNION t SUBSET E'`) +THEN RESA_TAC +THEN MP_TAC(ISPECL [`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;`(E':(real^3->bool)->bool)`] FINITE_SUBSET) +THEN RESA_TAC +THEN ASSUME_TAC(SET_RULE`e IN {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`) +THEN MP_TAC(ISPECL[`e:real^3->bool`;`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `e IN {e:(real^3->bool)} UNION (t:(real^3->bool)->bool) +==> ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e PSUBSET {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))DELETE e`;`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`]CARD_PSUBSET) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`FINITE ( {e:(real^3->bool)} UNION (t:(real^3->bool)->bool))` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN DISCH_TAC +THEN MP_TAC(ARITH_RULE`CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) < CARD ( {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) +/\ CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) = CARD ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))-1 +<=>CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) +1= CARD ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th;]) +THEN REWRITE_TAC[ARITH_RULE`A=A`; ] +THEN MP_TAC(SET_RULE`~(e IN t)==>({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e=t`) +THEN RESA_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`(CARD (E':(real^3->bool)->bool)=SUC n)` +THEN REWRITE_TAC[ARITH_RULE`SUC n=(n:num) +1`] +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;`E':(real^3->bool)->bool`]CARD_SUBSET_EQ) +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MA") +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`]expand_edge_graph_fan) +THEN RESA_TAC +THEN MRESA_TAC fan_run_in_small_is_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w:real^3`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"BE") +THEN EXISTS_TAC` min (h:real) (t1:real)` +THEN STRIP_TAC +THENL(*4*)[ +ASM_TAC +THEN REAL_ARITH_TAC;(*4*) + +STRIP_TAC +THENL(*5*)[ +ASM_TAC +THEN REAL_ARITH_TAC;(*5*) +REPEAT STRIP_TAC +THEN REMOVE_THEN "MA" MP_TAC +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) +THEN REWRITE_TAC[UNION;IN_ELIM_THM;EXTENSION; INTER;] +THEN GEN_TAC +THEN EQ_TAC +THENL(*6*)[ +ASM_REWRITE_TAC[IN_SING] +THEN MP_TAC(REAL_ARITH`s< min h t1==> s MRESA1_TAC th `s:real`) +THEN ASM_SET_TAC[]; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th `s:real`) +THEN ASM_SET_TAC[]]; +SET_TAC[]]]]]]]);; + + + +let fan_run_in_small_is_not_meet_xfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ (&0< azim x u w v ) /\ (azim x u w v +?h:real. &0 aff_gt{x} {v,(&1-s)%u+ s % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={})`, + +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`u:real^3`;` (w:real^3)`]fan_run1_in_small_is_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`A SUBSET A`] +THEN RESA_TAC +THEN EXISTS_TAC`h:real` +THEN ASM_REWRITE_TAC[] +THEN ASM_SET_TAC[]);; + +let fan_run_in_small_is_subset_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ (&0< azim x u w v ) /\ (azim x u w v + ?h:real. &0 aff_gt{x} {v,(&1-s)%u+ s % w} SUBSET yfan(x,V,E))`, +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`u:real^3`;` (w:real^3)`]fan_run1_in_small_is_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`A SUBSET A`;yfan;xfan] +THEN RESA_TAC +THEN EXISTS_TAC`h:real` +THEN ASM_REWRITE_TAC[] +THEN ASM_SET_TAC[]);; + + +let not_collinear_is_properties_fully_surrounded1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 t:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ (&0< azim x u w v ) /\ (azim x u w v ~ collinear {x,v,(&1-t)%u+ t % w}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0<=t /\ t<= &1 ==> t= &0 \/ t= &1 \/ (&0bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] ; + +REWRITE_TAC[REAL_ARITH`&1- &1= &0`] THEN REDUCE_VECTOR_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR[`x:real^3`;`v:real^3`;`w:real^3`;`u:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`] +THEN ASM_REWRITE_TAC[]; + +MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC collinear1_fan [`x:real^3`;`v:real^3`;`(&1-t)% u+t% w:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC properties_fully_surrounded[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;` w:real^3`] +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff; AFFINE_HULL_2; IN_ELIM_THM; coplanar] +THEN STRIP_TAC +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN SUBGOAL_THEN`(x:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; + +SUBGOAL_THEN`(v:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; + +SUBGOAL_THEN`(u:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; + +SUBGOAL_THEN`(w:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(t= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(t:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - t) % u + t % w = u' % x + v' % v +<=>t % w = u' % x + v' % v-(&1 - t) % u :real^3`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t % w = u' % x + v' % v-(&1 - t) % u +==> (inv (t))%(t % w ) = (inv (t))%(u' % x + v' % v-(&1 - t) % u ):real^3`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B+C-(&1-E)%D)=A%B+A%C+(A*E-A)%D`;VECTOR_ARITH`A%B%C=(A*B)%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`(inv t * u'):real` +THEN EXISTS_TAC`(inv t * v'):real` +THEN EXISTS_TAC`(&1-inv t):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`A*B+A*C+D-E=A*(B+C)+D-E`] +THEN ASM_TAC +THEN REAL_ARITH_TAC; + +ASM_TAC +THEN SET_TAC[]]]]]]);; + + + + +let not_collinear_is_properties_fully_surrounded=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 t:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ (&0< azim x u w v ) /\ (azim x u w v ~ collinear {x,v,(&1-t)%u+ t % w}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0 &0<= t /\ t <= &1`) +THEN RESA_TAC +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`t:real`] +);; + + + + +let exists_inf_element_fix_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u1:real^3 . +FAN(x,V,E)/\ v IN V /\ CARD (set_of_edge v V E) >1 +==> +(?(u:real^3). (u IN (set_of_edge v V E)) /\ +(!(w:real^3). (w IN (set_of_edge v V E)) ==> azim x v u1 u <= azim x v u1 w))`, +(let lemma = prove + (`!X:real->bool. + FINITE X /\ ~(X = {}) + ==> ?a. a IN X /\ !x. x IN X ==> a <= x`, + MESON_TAC[INF_FINITE]) in +MP_TAC(lemma) +THEN DISCH_THEN(LABEL_TAC "a") +THEN REPEAT GEN_TAC THEN REWRITE_TAC[FAN;fan1] +THEN STRIP_TAC +THEN MRESA_TAC remark_finite_fan1[`(v:real^3)` ;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN DISJ_CASES_TAC(SET_RULE`((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))={})\/ + ~((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) ={})`) +THENL[ +FIND_ASSUM MP_TAC `CARD ((set_of_edge v V E):real^3->bool) > 1` +THEN POP_ASSUM (fun th->REWRITE_TAC[th;CARD_CLAUSES]) +THEN ARITH_TAC; +SUBGOAL_THEN`~(IMAGE (azim x v u1) ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) )={})` ASSUME_TAC +THENL[ +REWRITE_TAC[IMAGE_EQ_EMPTY] THEN ASM_MESON_TAC[]; + +SUBGOAL_THEN` FINITE (IMAGE (azim x v u1) (set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))` ASSUME_TAC +THENL[ASM_MESON_TAC[FINITE_IMAGE]; + +REMOVE_THEN "a" (fun th ->MRESAL1_TAC th `(IMAGE (azim x v u1) ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) ))`[IMAGE;IN_ELIM_THM]) +THEN EXISTS_TAC`x':real^3` + THEN ASM_REWRITE_TAC[] +THEN ASM_MESON_TAC[]]]]));; + + + +let exists_element_in_half_sapace_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u1:real^3 w1:real^3. +FAN(x,V,E)/\ v IN V /\ ~coplanar{x,v,u1,w1} +/\ CARD (set_of_edge v V E) >1 +/\ fan80(x,V,E) +==> ?u:real^3. {v,u} IN E /\ &0< azim x v u1 (u:real^3)/\ azim x v u1 (u:real^3) bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u1:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "YEU") +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC SUR_SIGMA_FAN[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(v:real^3) `;`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] +THEN DISJ_CASES_TAC(REAL_ARITH`(pi<= azim (x:real^3) (v:real^3) (u1:real^3) u )\/ azim x v u1 (u:real^3) MRESA_TAC th [`v:real^3`;`w:real^3`]) +THEN MP_TAC(REAL_ARITH`pi <= azim (x:real^3) (v:real^3) (u1:real^3) (u:real^3) /\ azim x v w u < pi==> azim x v w u <= azim x v u1 u`) +THEN RESA_TAC +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`v:real^3`;`u1:real^3`;`w:real^3`;`u:real^3`] +THEN MP_TAC(REAL_ARITH`&0 < azim x v w u /\ azim (x:real^3) (v:real^3) (u1:real^3) (u:real^3) = azim x v u1 w + azim x v w u +==> azim x v u1 w < azim x v u1 u`) +THEN POP_ASSUM (fun th-> GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN RESA_TAC +THEN REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th `w:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +ASSUME_TAC(ISPECL[`(x:real^3)`;`(v:real^3)`;`(u1:real^3)`;`u:real^3`]azim) +THEN MP_TAC(REAL_ARITH`(&0<= azim (x:real^3) (v:real^3) (u1:real^3) u) ==>(azim (x:real^3) (v:real^3) (u1:real^3) u = &0 ) \/ &0< azim x v u1 (u:real^3) `) +THEN POP_ASSUM (fun th-> GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN REWRITE_TAC[]) +THEN STRIP_TAC +THENL[ +EXISTS_TAC`sigma_fan x V E v (u:real^3)` +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E = {u:real^3})\/ ~(set_of_edge v V E = {u})`) +THENL[ + +MRESA_TAC CARD_SING[`u:real^3`; `(set_of_edge v V E):real^3->bool`] +THEN FIND_ASSUM MP_TAC `CARD ((set_of_edge v V E):real^3->bool) >1` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun TH-> REWRITE_TAC[TH]) +THEN ARITH_TAC; + +MRESA_TAC SIGMA_FAN[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(v:real^3) `;`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`sigma_fan x V E v (u:real^3)`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th `sigma_fan x V E v (u:real^3)`) +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u1:real^3`;`u:real^3`;`sigma_fan x V E v (u:real^3)`] +THEN REDUCE_ARITH_TAC +THEN REMOVE_THEN "BE" (fun th-> MRESA_TAC th [`v:real^3`;`(u:real^3)`])]; + +EXISTS_TAC`(u:real^3)` +THEN ASM_REWRITE_TAC[]]]);; + + + +let independent_run_edges_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ fan80(x,V,E) +/\ sigma_fan x V E u w = v +/\ &0 independent {v - x, u - x, ((&1 - a) % u + a % w) - x}`, + + +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MP_TAC(REAL_ARITH`&0< a==> ~(a= &0)`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) +THEN POP_ASSUM MP_TAC +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, v, u, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3,v:real^3,u:real^3,(&1 - a) % u + a % w:real^3}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN REMOVE_ASSUM_TAC +THEN DISCH_TAC +THEN MRESA_TAC NOT_COPLANAR_0_4_IMP_INDEPENDENT[`v - x:real^3`; `u - x:real^3`; `((&1 - a) % u + a % w) - x:real^3`]);; + + +let span_run_edges_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ fan80(x,V,E) +/\ sigma_fan x V E u w = v +/\ &0 ?t1:real t2:real t3:real. +u1-x =t1 % (v-x)+t2 % ((&1 - a) % u + a % w - x)+t3 %(u-x)`, +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MP_TAC(REAL_ARITH`&0< a==> ~(a= &0)`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) +THEN POP_ASSUM MP_TAC +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, v, u, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3,v:real^3,u:real^3,(&1 - a) % u + a % w:real^3}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN REMOVE_ASSUM_TAC +THEN DISCH_TAC +THEN MRESA_TAC NOT_COPLANAR_0_4_IMP_INDEPENDENT[`v - x:real^3`; `u - x:real^3`; `((&1 - a) % u + a % w) - x:real^3`] +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR[`v - x:real^3`; `u - x:real^3`; `((&1 - a) % u + a % w) - x:real^3`;`(vec 0):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={D,A,B,C}`] +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MP_TAC(th) THEN ASSUME_TAC(th)) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,D}={D,A,B}`] +THEN DISCH_TAC +THEN MRESA_TAC th3[`v - x:real^3`; `u - x:real^3`; `((&1 - a) % u + a % w) - x:real^3`] +THEN MRESA_TAC th3[ `((&1 - a) % u + a % w) - x:real^3`;`v - x:real^3`; `u - x:real^3`;] +THEN MP_TAC(ISPECL [`(:real^3)`; `{v - x, u - x, ((&1 - a) % u + a % w) - x:real^3}`] CARD_EQ_DIM) THEN + ASM_SIMP_TAC[ORTHONORMAL_IMP_INDEPENDENT; SUBSET_UNIV] THEN + REWRITE_TAC[DIM_UNIV; DIMINDEX_3; HAS_SIZE; FINITE_INSERT; FINITE_EMPTY] THEN + SIMP_TAC[CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; IN_INSERT;] +THEN ASM_REWRITE_TAC[NOT_IN_EMPTY; ARITH;SUBSET] +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th `u1-x:real^3`[IN_UNIV;SPAN_3;IN_ELIM_THM]) +THEN EXISTS_TAC`u':real` +THEN EXISTS_TAC`w':real` +THEN EXISTS_TAC`v':real` +THEN VECTOR_ARITH_TAC);; + + +let cross_dot_fully_surrounded1_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0 &0< ((v1 - x) cross (u1 - x)) dot + ((&1 - a) % u + a % w-x)`, + +REPEAT STRIP_TAC +THEN MRESAL_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`; `(&1 - a) % u + a % w:real^3`;`u1:real^3`][VECTOR_ARITH`((&1 - a) % u + a % w) - x=(&1 - a) % u + a % w - x`] +THEN POP_ASSUM MATCH_MP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_THEN(LABEL_TAC"yeu em") +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "yeu em" (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`(&1-a)%u+ a%w:real^3`;`v1:real^3`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] +THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3) `;] +THEN FIND_ASSUM MP_TAC `(v1:real^3) IN aff_gt {x} {v,(&1-a)%u+ a%(w:real^3)}` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) +THEN STRIP_TAC +THEN SUBGOAL_THEN`~collinear {x, v1, (&1 - a) % u + a % w:real^3}` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[collinear1_fan;] +THEN FIND_ASSUM MP_TAC`~((&1 - a) % u + a % w IN aff {x, v:real^3})` +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % ((&1 - a) % u + a % w) = + u' % x + v' % ((&1 - a) % u + a % w)<=> +(&1-(t1+t2+t3)) % x + (v'-t3) % ((&1 - a) % u + a % w-x) = + (&1-(u'+v') ) % x + t2 % (v-x)`;REAL_ARITH`a-a= &0`] +THEN REDUCE_VECTOR_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`v' - t3= &0 \/ ~(v' - (t3:real)= &0)`) +THENL[ +ASM_REWRITE_TAC[VECTOR_ARITH`&0 %A=B<=> B= vec 0`;VECTOR_MUL_EQ_0] +THEN MP_TAC(REAL_ARITH`&0< t2==> ~(t2 = &0)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-B= vec 0<=> A=B`]; + +MRESA1_TAC REAL_MUL_LINV `(v'-t3:real)` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(v' - t3) % ((&1 - a) % u + a % w - x) = t2 % (v - x:real^3) ==> (inv (v'-t3)) % (v' - t3) % ((&1 - a) % u + a % w - x) = (inv (v'-t3)) % ( t2 % (v - x))`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C:real^3)`]) +THEN REWRITE_TAC[VECTOR_ARITH`&1 % ((&1 - a) % u + a % w - x) = (inv (v' - t3) * t2) % (v - x)<=> +(&1 - a) % u + a % w = (&1-(inv (v' - t3) * t2))%x +(inv (v' - t3) * t2) % v:real^3`] +THEN STRIP_TAC +THEN EXISTS_TAC`&1-(inv (v' - t3) * (t2:real))` +THEN EXISTS_TAC`(inv (v' - t3) * (t2:real))` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN DISCH_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v1:real^3`;`v:real^3`;`u1:real^3`;`((&1 - a) % u + a % w):real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"B") +THEN DISCH_TAC +THEN SUBGOAL_THEN`azim x v1 v ((&1 - a) % u + a % w)= pi` ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;`v1:real^3`;` (v:real^3)`] +THEN MRESA_TAC AFF_LT_2_1[`x:real^3`;`v1:real^3`;`v:real^3`] +THEN MRESAL_TAC AZIM_EQ_PI_ALT[`x:real^3`;`v1:real^3`;`v:real^3`;`((&1 - a) % u + a % w):real^3`][IN_ELIM_THM] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[VECTOR_ARITH`A=B+C+D <=> D=A-B-C:real^3`] +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV `(t3:real)` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`t3 % ((&1 - a) % u + a % w) = v1 - t1 % x - t2 % v ==> (inv (t3)) % t3 % ((&1 - a) % u + a % w) = (inv (t3)) % ( v1 - t1 % x - t2 % v:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C:real^3)`]) +THEN REWRITE_TAC[VECTOR_ARITH`&1 % ((&1 - a) % u + a % w) = inv t3 % (v1 - t1 % x - t2 % v) +<=> (&1 - a) % u + a % w = (-- inv t3 * t1) % x + (inv t3) % v1 +(-- (inv t3* t2)) % v`] +THEN STRIP_TAC +THEN EXISTS_TAC`(-- inv t3 * t1):real` +THEN EXISTS_TAC`(inv t3):real` +THEN EXISTS_TAC`(-- (inv t3 * t2)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`--inv t3 * t1 + inv t3 + --(inv t3 * t2)= inv t3 *(t3+ &1-(t1+t2+t3))`;REAL_ARITH`(t3 + &1 - &1)=t3`;REAL_ARITH`--A< &0 <=> &0< A`] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_INV +THEN ASM_REWRITE_TAC[]; +REMOVE_THEN "B" MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REMOVE_ASSUM_TAC +THEN MP_TAC(REAL_ARITH`azim x v1 v u1 < pi==> azim x v1 v u1 <= pi`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC`azim x v1 v (u1:real^3) < pi` +THEN FIND_ASSUM MP_TAC`&0< azim x v1 v (u1:real^3) ` +THEN REAL_ARITH_TAC]]);; + + + + + + + +let exists_cross_dot_fully_surrounded1_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0 ?t. &0< t/\ t < &1 +/\( !h:real. &0< h/\ h &0< ((v1 - x) cross (u1 - x)) dot (((&1 - h) % ((&1 - a) % u + a % w) + h % u) - x))`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`(((&1 - t) % ((&1 - a) % u + a % w) + t % u) - x)= + ((&1 - a) % u + a % w - x) + t % (--a) % ( w-u)`;] +THEN ABBREV_TAC`va=(&1 - a) % u + a % w-x:real^3` +THEN REWRITE_TAC[DOT_RADD;DOT_RMUL; REAL_ARITH`&0 (B*D)*Cbool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;`u1:real^3`] +THEN DISJ_CASES_TAC(REAL_ARITH`(((v1 - x) cross (u1 - x:real^3)) dot (w - u)<= &0 )\/ (&0<((v1 - x) cross (u1 - x)) dot (w - u))`) +THENL[ +EXISTS_TAC`&1/ &2` +THEN REWRITE_TAC[REAL_ARITH`&0 < &1 / &2 /\ &1 / &2 < &1`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 < a ==> &0<= (a:real)`) THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 < h ==> &0<= (h:real)`) THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_LMUL[`a:real`;`((v1 - x) cross (u1 - x)) dot ((w - u):real^3)`;`&0`][REAL_ARITH`(A:real)* &0= &0`] +THEN MRESAL_TAC REAL_LE_RMUL[`a*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)`;`&0`;`h:real`][REAL_ARITH`&0 * (A:real)= &0`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +MRESA_TAC REAL_LT_MUL[`a:real`;`((v1 - x) cross (u1 - x)) dot ((w - u):real^3)`] +THEN MP_TAC(REAL_ARITH`&0<(a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)==> ~( (a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_RINV`(a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)` +THEN MRESA1_TAC REAL_LT_INV`(a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)` +THEN MRESA_TAC REAL_LT_MUL[`inv((a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3))`;`((v1 - x) cross (u1 - x)) dot (va:real^3)`] +THEN EXISTS_TAC `min ((inv(a *(((v1 - x) cross (u1 - x)) dot (w - u)))*(((v1 - x) cross (u1 - x)) dot va)) / &2 ) (&1/ &2)` +THEN STRIP_TAC +THENL[POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ + REAL_ARITH_TAC; +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH` h< min ((inv (a * (((v1 - x) cross (u1 - x)) dot (w - u))) * (((v1 - x) cross (u1 - x)) dot va)) / &2) (&1 / &2) +==> +h< ((inv (a * (((v1 - x) cross (u1 - x)) dot (w - u))) * (((v1 - x) cross (u1 - x)) dot va)) / &2)`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_LMUL[`(a * (((v1 - x) cross (u1 - x)) dot (w - u:real^3)))`;`h:real`;`((inv (a * (((v1 - x) cross (u1 - x)) dot (w - u))) * (((v1 - x) cross (u1 - x:real^3)) dot va)) / &2)`] +THEN ASM_TAC +THEN ABBREV_TAC`vb=a * (((v1 - x) cross (u1 - x)) dot (w - u))` +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`vb * (inv vb * (((v1 - x) cross (u1 - x)) dot va)) / &2= +(vb * inv vb) * (((v1 - x) cross (u1 - x)) dot va)/ &2`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]]);; + + +let cross_dot_fully_surrounded2_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0 &0 < (((&1 - a) % u + a % w - x) cross (v - x)) dot (u1 - x)`, + +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_THEN(LABEL_TAC"yeu em") +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "yeu em" (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`(&1-a)%u+ a%w:real^3`;`v1:real^3`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] +THEN MRESA1_TAC SIN_POS_PI`azim x v1 v (u1:real^3)` +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AZIM_TRANSLATION[`-- x:real^3`;`x:real^3`;`v1:real^3`;` v:real^3`;`u1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`x-x= vec 0`;VECTOR_ARITH`(-- X)+A= A-X:real^3`] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN MRESA_TAC JBDNJJB[`(v1-x):real^3`;`v-x:real^3`;`u1-x:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM COLLINEAR_3;] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN MRESAL_TAC REAL_LT_LMUL_EQ [` &0:real `;`(((v1 - x) cross (v - x)) dot ((u1 - x):real^3)):real`;`t:real`][REAL_ARITH`a * &0 = &0`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3) `;] +THEN FIND_ASSUM MP_TAC `v1 IN aff_gt {x} {v,(&1-a)%u+ a%(w:real^3)}` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[th;VECTOR_ARITH`A- vec 0= A`;VECTOR_ARITH`(t1 % x + t2 % v + t3 % ((&1 - a) % u + a % w)) - x=(t1- &1) % x + t2 % v + t3 % ((&1 - a) % u + a % w)`]) +THEN FIND_ASSUM MP_TAC `t1 + t2 + t3 = &1:real` +THEN REWRITE_TAC[REAL_ARITH`t1 + t2 + t3 = &1<=> t1- &1= (-- t2)- t3 `] +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(--t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w)= t2 % (v-x) + t3 % ((&1 - a) % u + a % w-x)`] +THEN REWRITE_TAC[CROSS_LADD; CROSS_RADD; CROSS_LMUL; CROSS_RMUL;CROSS_REFL;CROSS_RNEG;CROSS_LNEG] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[GSYM CROSS_LMUL;GSYM CROSS_LADD;DOT_LMUL] +THEN MRESAL_TAC REAL_LT_LMUL_EQ [` &0:real `;`((((&1 - a) % u + a % w - x) cross (v - x)) dot (u1 - x)):real`;`t3:real`][REAL_ARITH`a * &0 = &0`]);; + + + +let exists_cross_dot_fully_surrounded2_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0 +?t:real. &0< t/\ t < &1 +/\ (!h:real. &0 &0 < +((((&1 - h) % ((&1 - a) % u + a % w) + h % u) - x) cross (v - x)) dot (u1 - x))`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`(((&1 - t) % ((&1 - a) % u + a % w) + t % u) - x)= + ((&1 - a) % u + a % w - x) + t % (--a) % ( w-u)`;] +THEN ABBREV_TAC`va=(&1 - a) % u + a % w-x:real^3` +THEN REWRITE_TAC[CROSS_LADD;CROSS_LMUL;DOT_LADD;DOT_LMUL; REAL_ARITH`&0 (B*D)*Cbool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;`u1:real^3`] +THEN DISJ_CASES_TAC(REAL_ARITH`(((w - u) cross (v - x:real^3)) dot (u1- x)<= &0 )\/ (&0<((w - u) cross (v - x:real^3)) dot (u1- x))`) +THENL[ +EXISTS_TAC`&1/ &2` +THEN REWRITE_TAC[REAL_ARITH`&0 < &1 / &2 /\ &1 / &2 < &1`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 < a ==> &0<= (a:real)`) THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 < h ==> &0<= (h:real)`) THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_LMUL[`a:real`;`((w - u) cross (v - x:real^3)) dot (u1- x:real^3)`;`&0`][REAL_ARITH`(A:real)* &0= &0`] +THEN MRESAL_TAC REAL_LE_RMUL[`a*(((w - u) cross (v - x:real^3)) dot (u1- x))`;`&0`;`h:real`][REAL_ARITH`&0 * (A:real)= &0`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +MRESA_TAC REAL_LT_MUL[`a:real`;`((w - u) cross (v - x:real^3)) dot (u1- x:real^3)`] +THEN MP_TAC(REAL_ARITH`&0<(a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x))==> ~( (a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x))= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_RINV`(a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x))` +THEN MRESA1_TAC REAL_LT_INV`(a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x))` +THEN MRESA_TAC REAL_LT_MUL[`inv((a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x)))`;`((va cross (v - x)) dot (u1 - x))`] +THEN EXISTS_TAC `min ((inv(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))*((va cross (v - x)) dot (u1 - x))) / &2 ) (&1/ &2)` +THEN STRIP_TAC +THENL[POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ + REAL_ARITH_TAC; +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH` h< min ((inv(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))*((va cross (v - x)) dot (u1 - x))) / &2 ) (&1/ &2) +==> +h< ((inv(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))*((va cross (v - x)) dot (u1 - x))) / &2 )`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_LMUL[`(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))`;`h:real`;`((inv(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))*((va cross (v - x)) dot (u1 - x))) / &2 )`] +THEN ASM_TAC +THEN ABBREV_TAC`vb=a * (((w - u) cross (v - x:real^3)) dot (u1- x))` +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`vb * (inv vb * ((va cross (v - x)) dot (u1 - x))) / &2= +(vb * inv vb) * ((va cross (v - x)) dot (u1 - x))/ &2`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]]);; + + +let lie_in_half_space_and_azim=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0 &0 < ((v-x) cross (u - x)) dot (v1-x)`, + +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_THEN(LABEL_TAC"yeu em") +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "yeu em" (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] +THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3) `;] +THEN FIND_ASSUM MP_TAC `v1 IN aff_gt {x} {v,(&1-a)%u+ a%(w:real^3)}` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A- vec 0= A`;VECTOR_ARITH`(t1 % x + t2 % v + t3 % ((&1 - a) % u + a % w)) - x=(t1- &1) % x + t2 % v + t3 % ((&1 - a) % u + a % w)`] +THEN FIND_ASSUM MP_TAC `t1 + t2 + t3 = &1:real` +THEN REWRITE_TAC[REAL_ARITH`t1 + t2 + t3 = &1<=> t1- &1= (-- t2)- t3 `] +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(--t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w)= t2 % (v-x) + t3 % ((&1 - a) % (u-x) + a % (w-x))`] +THEN REWRITE_TAC[ DOT_RADD;DOT_RMUL;DOT_CROSS_SELF] +THEN REDUCE_ARITH_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[CROSS_TRIPLE]);; + + + + + + + +let exists_cut_small_edges_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0 +?t:real. &0< t/\ t < &1 +/\ ~(aff_gt {x} {v,(&1-t)%((&1-a)%u+ a%w)+t%u} INTER aff_gt {x} {v1,u1}={})`, + +REPEAT STRIP_TAC +THEN MRESA_TAC lie_in_half_space_and_azim[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;` u1:real^3`] +THEN MRESA_TAC exists_cross_dot_fully_surrounded1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;` u1:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"MA") +THEN MRESA_TAC exists_cross_dot_fully_surrounded2_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;` u1:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"BE NHO") +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_THEN(LABEL_TAC"yeu em") +THEN ABBREV_TAC`ta=min (t:real) (t':real)/ &2` +THEN EXISTS_TAC `(ta:real)` +THEN SUBGOAL_THEN `&0< ta:real /\ ta < &1 /\ ta< t /\ ta< t'` ASSUME_TAC +THENL(*1*)[ +POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN FIND_ASSUM MP_TAC`&0 &0< (&1-ta):real`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL [`(&1-ta):real`;`a:real`] +THEN MRESA_TAC REAL_LT_LMUL [`(&1-ta):real`;`a:real`;`&1`] +THEN MP_TAC(REAL_ARITH` &0< ta /\ (&1-ta)*a< (&1-ta)* &1 :real==> (&1-ta)*a< &1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "yeu em" (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESAL_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`((&1-ta)*a):real`][VECTOR_ARITH`(&1 - ((&1 - ta) * a)) % u + ((&1 - ta) * a ) % w= +(&1 - ta) % ((&1 - a) % u + a % w) + ta % u:real^3`] +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`(&1-a)%u+ a%w:real^3`;`v1:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`;`u1:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"CON") +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - ta) % ((&1 - a) % u + a % w) + ta % u:real^3`;] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v1:real^3)`;`u1:real^3`;] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] +THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v1:real^3)`;`(u1:real^3) `;] +THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(&1 - ta) % ((&1 - a) % u + a % w) + ta % u:real^3 `;] +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;EXTENSION;EMPTY;IN;NOT_FORALL_THM] +THEN ABBREV_TAC`a1=(v-x):real^3` +THEN ABBREV_TAC`a2=(((&1-ta)%((&1-a)%u+ a%w)+ta%u)-x):real^3` +THEN ABBREV_TAC`a3=(v1-x) :real^3` +THEN ABBREV_TAC`a4=u1-x:real^3` +THEN ABBREV_TAC`va=a1 cross a2:real^3` +THEN ABBREV_TAC`vb=a3 cross a4:real^3` +THEN EXISTS_TAC`(vb:real^3) cross (va:real^3)+(x:real^3)` +THEN STRIP_TAC +THENL(*2*)[ +EXISTS_TAC`&1-(vb:real^3) dot (a2:real^3)+ vb dot (a1:real^3)` +THEN EXISTS_TAC`(vb:real^3) dot (a2:real^3)` +THEN EXISTS_TAC`--((vb:real^3) dot (a1:real^3))` +THEN REMOVE_THEN "MA"(fun th-> MRESA1_TAC th `ta:real`) +THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 - vb dot a2 + vb dot a1) + vb dot a2 + --(vb dot a1) = &1`] +THEN SUBGOAL_THEN `&0< --((vb:real^3) dot (a1:real^3))` ASSUME_TAC +THENL(*3*)[EXPAND_TAC"vb" +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[DOT_LNEG] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN REMOVE_THEN "CON"MP_TAC +THEN REAL_ARITH_TAC;(*3*) + +ASM_REWRITE_TAC[] +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_MUL_LNEG] +THEN EXPAND_TAC"a1" +THEN EXPAND_TAC"a2" +THEN VECTOR_ARITH_TAC];(*2*) + +ONCE_REWRITE_TAC[CROSS_SKEW] +THEN EXPAND_TAC"vb" +THEN REWRITE_TAC[CROSS_LAGRANGE;] +THEN EXISTS_TAC`&1+(va:real^3) dot (a4:real^3)- va dot (a3:real^3)` +THEN EXISTS_TAC`--(va:real^3) dot (a4:real^3)` +THEN EXISTS_TAC`((va:real^3) dot (a3:real^3))` +THEN REMOVE_THEN "BE NHO"(fun th-> MRESA1_TAC th `ta:real`) +THEN ASM_REWRITE_TAC[DOT_LNEG;VECTOR_MUL_LNEG;REAL_ARITH`(&1 + va dot a4 - va dot a3) + --(va dot a4) + va dot a3 = &1`;] + +THEN STRIP_TAC +THENL(*3*)[ +EXPAND_TAC"va" +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[DOT_LNEG] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*3*) + +STRIP_TAC +THENL(*4*)[ +EXPAND_TAC"va" +THEN EXPAND_TAC"a2" +THEN REWRITE_TAC[VECTOR_ARITH`((&1 - ta) % ((&1 - a) % u + a % w) + ta % u) - x +=(&1 - ta) % ((&1 - a) % u + a % w-x) + ta % (u - x)`] +THEN ABBREV_TAC`vu=(&1 - a) % u + a % w - x:real^3` +THEN REWRITE_TAC[CROSS_RADD;CROSS_RMUL;DOT_LADD;DOT_LMUL;] +THEN MRESAL_TAC coplanar_is_cross_fan[`x:real^3`;`v:real^3`;`(&1 - a) % u + a % w:real^3`;`v1:real^3`] +[VECTOR_ARITH`((&1 - a) % u + a % w) - x=(&1 - a) % u + a % w - x`] +THEN REDUCE_ARITH_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[];(*4*) +EXPAND_TAC"a3" +THEN EXPAND_TAC"a4" +THEN REWRITE_TAC[VECTOR_ARITH`-- A+B= B-A:real^3`;VECTOR_ARITH`(&1+A-B)%X+B%U-A%V=X-A%(V-X)+B%(U-X)`] +THEN VECTOR_ARITH_TAC]]]]);; + + + + + +let not_cut_inside_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) + +/\ (!h:real. &0 aff_gt{x} {v,(&1-h)%u+ h % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={}) +==> aff_gt{x} {v,(&1-a)%u+ a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MP_TAC (th) THEN ASSUME_TAC(th)) +THEN REWRITE_TAC[fan80] +THEN DISCH_THEN(LABEL_TAC"BE") +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN REWRITE_TAC[INTER;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL(*1*)[ +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN DISCH_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[(th)]) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN DISCH_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN REMOVE_THEN "BE" (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"BE") ) +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w':real^3)`; +` (v':real^3)`] +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v':real^3`;`w':real^3`][IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "VUT1") +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-a)%u +a%w:real^3`][IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "VUT") +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "VUT1") +THEN DISCH_TAC THEN DISCH_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(t3'= &0) \/ ~(t3':real= &0)`) +THENL(*2*)[ +ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(t2'= &0) \/ ~(t2':real= &0)`) +THENL(*3*)[ +ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(t3:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM (fun th-> REWRITE_TAC[SYM(th)])`t1 + t2 + t3 = &1:real` +THEN REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % (((t1 + t2 + t3) - a) % u + a % w) = + (t1 + t2 + t3) % x<=>(t3) % (((t1 + t2 + t3) - a) % u + a % w- x)=(-- t2) % (v-x) `] +THEN ASM_REWRITE_TAC[IN;EMPTY] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +(t3) % ((&1 - a) % u + a % w- x)=(-- t2) % (v-x) +==> (inv (t3))%((t3) % ((&1 - a) % u + a % w- x) ) = (inv (t3))%((-- t2) % (v-x)):real^3`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[VECTOR_ARITH`E+A-B=C%(D-B)<=>E+A=(&1-C)%B+C%D`;] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC `~((&1 - a) % u + a % w IN aff {x, v:real^3})` +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`&1-(inv t3 * (--t2)):real` +THEN EXISTS_TAC`(inv t3 * (--t2)):real` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*3*) + +FIND_ASSUM MP_TAC`t1 + t2 + t3 = &1:real` +THEN REWRITE_TAC[REAL_ARITH`t1 + t2 + t3 = &1<=> t1= &1 -t2 -t3`; REAL_ARITH`A+B= &1<=> A= &1-B`] +THEN DISCH_THEN(LABEL_TAC"MAI") +THEN DISCH_THEN (LABEL_TAC"YEU EM") +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w) = + (&1 - t2') % x + t2' % v'<=> t2' % v'=(t2' - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w):real^3 `] +THEN MP_TAC(ISPEC`(t2':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2' % v'=(t2' - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w):real^3 +==> (inv (t2'))%(t2' % v' ) = (inv (t2'))%((t2' - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w):real^3) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C+D)=(A%B+A%C+A%D)`;REAL_ARITH`a*(b-c-d)=a*b-a*c-a*d`] +THEN REDUCE_VECTOR_TAC +THEN DISCH_TAC +THEN SUBGOAL_THEN `~coplanar{x:real^3,v':real^3,v:real^3,u:real^3}` ASSUME_TAC +THENL(*4*)[ + +POP_ASSUM MP_TAC +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, v', v, u}= {(--x) +x, (--x) +v', (--x) +v, (--x) +u}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3,v':real^3,v:real^3,u:real^3}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`]) +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th;VECTOR_ARITH`((&1 - inv t2' * t2 - inv t2' * t3) % x + + (inv t2' * t2) % v + + (inv t2' * t3) % ((&1 - a) % u + a % w)) - + x=(inv t2' * t2) % (v-x) + + (inv t2' * t3) % ((&1 - a) % u + a % w-x)`]) +THEN MP_TAC(REAL_ARITH`&0< t2 /\ &0< t3 /\ t1+t2+t3= &1==> &0 < &1- t1 /\ ~(&1- t1 = &0)/\ t2+t3= &1- t1`) +THEN REMOVE_THEN"MAI" MP_TAC +THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`&1- (t1:real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`&1- (t1:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2 + t3 = &1 - t1:real +==> (inv ( &1 - t1))*(t2 + t3) = (inv ( &1 - t1))*( &1 - t1:real) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> A*B = &1 -A*C`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH` ~(t2' = &0) /\ &0 <= t2'==> &0 ~(a = &0) `) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`t2':real`;`inv (&1- t1):real`] +THEN MRESA_TAC REAL_LT_MUL[`inv (&1- t1):real`;`t3:real`;] +THEN MP_TAC(REAL_ARITH`&0< (inv (&1- t1)) * t3 ==> ~( (inv(&1- t1)) * t3= &0)`) +THEN MP_TAC(REAL_ARITH`&0< (t2') * inv (&1- t1) ==> ~((t2')* inv(&1- t1)= &0)`) +THEN RESA_TAC +THEN ASSUME_TAC(REAL_ARITH`~(&1 = &0)`) +THEN MRESA_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`(t2')* inv(&1- t1)`;`u - x:real^3`; `v - x:real^3`; `(inv t2' * t2) % (v - x) +(inv t2' * t3) % ((&1 - a) % u + a % w - x):real^3`] +THEN POP_ASSUM (fun th -> ONCE_REWRITE_TAC[SYM(th);]) +THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B+E%(C+D))=A%B+(A*E)%(C+D)`; +VECTOR_ARITH`A%B%C=(A*B)%C`; REAL_ARITH`(t2' * inv (&1 - t1)) * inv t2' * t2= (inv (t2')* t2' ) * inv (&1-t1) * t2`] +THEN REDUCE_ARITH_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN DISCH_TAC +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, (&1 - a) % u + a % w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] ) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN DISCH_TAC +THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` ((&1 - a) % u + a % w)-x:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(inv(&1- t1)) * t3:real`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH` +(&1 - inv (&1 - t1) * t3) % (v - x) + + (inv (&1 - t1) * t3) % (((&1 - a) % u + a % w) - x)= +(&1 - inv (&1 - t1) * t3) % (v - x) + + (inv (&1 - t1) * t3) % ((&1 - a) % u + a % w - x)`];(*4*) + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"DICH") +THEN DISCH_TAC +THEN ABBREV_TAC `va=((&1 - a) % u + a % w):real^3` +THEN MP_TAC(REAL_ARITH` ~(t2' = &0) /\ &0 <= t2'==> &0 ~(a = &0) `) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`t2':real` +THEN MRESA_TAC REAL_LT_MUL[`inv (t2'):real`;`t2:real`;] +THEN MRESA_TAC REAL_LT_MUL[`inv (t2'):real`;`t3:real`;] +THEN SUBGOAL_THEN `(v':real^3) IN aff_gt {x} {v,va:real^3}` ASSUME_TAC +THENL(*5*)[ + +ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`(&1 - inv t2' * t2 - inv t2' * t3:real)` +THEN EXISTS_TAC`inv t2' * t2:real` +THEN EXISTS_TAC`(inv t2' * t3:real)` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*5*) + +REMOVE_THEN "DICH" MP_TAC +THEN REMOVE_THEN "VUT" MP_TAC +THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `v':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN MRESA_TAC exists_element_in_half_sapace_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;` v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; +` (v':real^3)`] +THEN MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v':real^3`;`u':real^3`] +THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC +THEN REWRITE_TAC[EMPTY;IN] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0 &0< &1-t:real /\ &1-t< &1`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] +THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] +THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v':real^3`;`u':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`{v',u'} IN (E:(real^3->bool)->bool)` +THEN SET_TAC[]](*5*)](*4*)](*3*);(*2*) + + + +DISJ_CASES_TAC(REAL_ARITH`(t2'= &0) \/ ~(t2':real= &0)`) +THENL(*3*)[ + +FIND_ASSUM MP_TAC`t1 + t2 + t3 = &1:real` +THEN REWRITE_TAC[REAL_ARITH`t1 + t2 + t3 = &1<=> t1= &1 -t2 -t3`; REAL_ARITH`A+B= &1<=> A= &1-B`] +THEN DISCH_THEN(LABEL_TAC"MAI") +THEN DISCH_THEN (LABEL_TAC"YEU EM") +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w) = + (&1 - &0 - t3') % x + &0% v'+t3' % w'<=> t3' % w'=(t3' - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w):real^3 `] +THEN MP_TAC(ISPEC`(t3':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3' % w'=(t3' - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w):real^3 +==> (inv (t3'))%(t3' % w' ) = (inv (t3'))%((t3' - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w):real^3) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C+D)=(A%B+A%C+A%D)`;REAL_ARITH`a*(b-c-d)=a*b-a*c-a*d`] +THEN REDUCE_VECTOR_TAC +THEN DISCH_TAC +THEN SUBGOAL_THEN `~coplanar{x:real^3,w':real^3,v:real^3,u:real^3}` ASSUME_TAC +THENL(*4*)[ + + POP_ASSUM MP_TAC +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, w', v, u}= {(--x) +x, (--x) +w', (--x) +v, (--x) +u}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3,w':real^3,v:real^3,u:real^3}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`]) +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th;VECTOR_ARITH`((&1 - inv t2' * t2 - inv t2' * t3) % x + + (inv t2' * t2) % v + + (inv t2' * t3) % ((&1 - a) % u + a % w)) - + x=(inv t2' * t2) % (v-x) + + (inv t2' * t3) % ((&1 - a) % u + a % w-x)`]) +THEN MP_TAC(REAL_ARITH`&0< t2 /\ &0< t3 /\ t1+t2+t3= &1==> &0 < &1- t1 /\ ~(&1- t1 = &0)/\ t2+t3= &1- t1`) +THEN REMOVE_THEN"MAI" MP_TAC +THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`&1- (t1:real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`&1- (t1:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2 + t3 = &1 - t1:real +==> (inv ( &1 - t1))*(t2 + t3) = (inv ( &1 - t1))*( &1 - t1:real) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> A*B = &1 -A*C`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH` ~(t3' = &0) /\ &0 <= t3'==> &0 ~(a = &0) `) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`t3':real`;`inv (&1- t1):real`] +THEN MRESA_TAC REAL_LT_MUL[`inv (&1- t1):real`;`t3:real`;] +THEN MP_TAC(REAL_ARITH`&0< (inv (&1- t1)) * t3 ==> ~( (inv(&1- t1)) * t3= &0)`) +THEN MP_TAC(REAL_ARITH`&0< (t3') * inv (&1- t1) ==> ~((t3')* inv(&1- t1)= &0)`) +THEN RESA_TAC +THEN ASSUME_TAC(REAL_ARITH`~(&1 = &0)`) +THEN MRESA_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`(t3')* inv(&1- t1)`;`u - x:real^3`; `v - x:real^3`; `(inv t3' * t2) % (v - x) +(inv t3' * t3) % ((&1 - a) % u + a % w - x):real^3`] +THEN POP_ASSUM (fun th -> ONCE_REWRITE_TAC[SYM(th);]) +THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B+E%(C+D))=A%B+(A*E)%(C+D)`; +VECTOR_ARITH`A%B%C=(A*B)%C`; REAL_ARITH`(t2' * inv (&1 - t1)) * inv t2' * t2= (inv (t2')* t2' ) * inv (&1-t1) * t2`] +THEN REDUCE_ARITH_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN DISCH_TAC +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, (&1 - a) % u + a % w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] ) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN DISCH_TAC +THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` ((&1 - a) % u + a % w)-x:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(inv(&1- t1)) * t3:real`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH` +(&1 - inv (&1 - t1) * t3) % (v - x) + + (inv (&1 - t1) * t3) % (((&1 - a) % u + a % w) - x)= +(&1 - inv (&1 - t1) * t3) % (v - x) + + (inv (&1 - t1) * t3) % ((&1 - a) % u + a % w - x)`];(*4*) + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"DICH") +THEN DISCH_TAC +THEN ABBREV_TAC `va=((&1 - a) % u + a % w):real^3` +THEN MP_TAC(REAL_ARITH` ~(t3' = &0) /\ &0 <= t3'==> &0 ~(a = &0) `) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`t3':real` +THEN MRESA_TAC REAL_LT_MUL[`inv (t3'):real`;`t2:real`;] +THEN MRESA_TAC REAL_LT_MUL[`inv (t3'):real`;`t3:real`;] +THEN SUBGOAL_THEN `(w':real^3) IN aff_gt {x} {v,va:real^3}` ASSUME_TAC +THENL[(*5*) + +ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`(&1 - inv t3' * t2 - inv t3' * t3:real)` +THEN EXISTS_TAC`inv t3' * t2:real` +THEN EXISTS_TAC`(inv t3' * t3:real)` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*5*) + +REMOVE_THEN "DICH" MP_TAC +THEN REMOVE_THEN "VUT" MP_TAC +THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC +THEN FIND_ASSUM MP_TAC`{v',w':real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN DISCH_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v':real^3)`; +` (w':real^3)`] +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `w':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN MRESA_TAC exists_element_in_half_sapace_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w':real^3`;` v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; +` (w':real^3)`] +THEN MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`w':real^3`;`u':real^3`] +THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC +THEN REWRITE_TAC[EMPTY;IN] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0 &0< &1-t:real /\ &1-t< &1`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] +THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] +THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`w':real^3`;`u':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`{w',u'} IN (E:(real^3->bool)->bool)` +THEN SET_TAC[]](*5*)](*4*);(*3*) + + +ASM_REWRITE_TAC[] +THEN DISCH_TAC THEN DISCH_THEN(LABEL_TAC"BO") +THEN ABBREV_TAC `va=((&1 - a) % u + a % w):real^3` +THEN MP_TAC(REAL_ARITH` ~(t3' = &0) /\ &0 <= t3'==> &0 &0 ~(a = &0) `) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`t2':real` +THEN MRESA1_TAC REAL_MUL_LINV`t2':real` +THEN MRESA_TAC REAL_LT_MUL[`inv (t2'):real`;`t2:real`;] +THEN MRESA_TAC REAL_LT_MUL[`inv (t2'):real`;`t3:real`;] +THEN MRESA1_TAC REAL_LT_INV`t3':real` +THEN MRESA1_TAC REAL_MUL_LINV`t3':real` +THEN MRESA_TAC REAL_LT_MUL[`inv (t3'):real`;`t2:real`;] +THEN MRESA_TAC REAL_LT_MUL[`inv (t3'):real`;`t3:real`;] +THEN SUBGOAL_THEN`(x':real^3) IN aff_gt {x} {v',w'}` ASSUME_TAC +THENL(*4*)[ + +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v':real^3`;`w':real^3`][IN_ELIM_THM] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`t1':real` +THEN EXISTS_TAC`t2':real` +THEN EXISTS_TAC`t3':real` +THEN ASM_REWRITE_TAC[];(*4*) + +SUBGOAL_THEN`(x':real^3) IN aff_ge {x} {v',w'}` ASSUME_TAC +THENL(*5*)[ + +ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`t1':real` +THEN EXISTS_TAC`t2':real` +THEN EXISTS_TAC`t3':real` +THEN ASM_REWRITE_TAC[];(*5*) + +SUBGOAL_THEN `(x':real^3) IN aff_gt {x} {v,va:real^3}` ASSUME_TAC +THENL(*6*)[ + +ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t3:real` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*6*) + +SUBGOAL_THEN `(x':real^3) IN aff_ge {x} {v,va:real^3}` ASSUME_TAC +THENL(*7*)[ + +MRESA_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`va:real^3`] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t3:real` +THEN MP_TAC(REAL_ARITH`&0< t2==> &0 <= t2`) THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0< t3==> &0 <= t3`) THEN RESA_TAC +THEN ASM_REWRITE_TAC[];(*7*) + +FIND_ASSUM MP_TAC`{v',w':real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN DISCH_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v':real^3)`; +` (w':real^3)`] +THEN SUBGOAL_THEN `~collinear {x, x', w':real^3}` ASSUME_TAC +THENL(*8*)[ + +ASM_REWRITE_TAC[collinear1_fan;] +THEN FIND_ASSUM MP_TAC `~((v':real^3) IN aff{x,w'})` +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % v' + t3' % w' = u' % x + v'' % w' +<=> t2' % v' = (u'-t1') % x + (v''-t3') % w'`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2' % v' = (u'-t1') % x + (v''-t3') % w':real^3 +==> (inv ( t2'))%(t2' % v') = (inv (t2'))%((u'-t1') % x + (v''-t3') % w') +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC `(inv t2' * (u' - t1':real))` +THEN EXISTS_TAC `(inv t2' * (v'' - t3':real))` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t2' * (u' - t1') + inv t2' * (v'' - t3')=inv t2'* (t2'+ (u'+v'') - (t1'+t2'+t3'))`;REAL_ARITH`t2'+ &1 - &1=t2'`];(*8*) + + + + +SUBGOAL_THEN `~collinear {x, x', v':real^3}` ASSUME_TAC +THENL(*9*)[ +ASM_REWRITE_TAC[collinear1_fan;] +THEN FIND_ASSUM MP_TAC `~((w':real^3) IN aff{x,v'})` +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % v' + t3' % w' = u' % x + v'' % v' +<=> t3' % w' = (u'-t1') % x + (v''-t2') % v'`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3' % w' = (u'-t1') % x + (v''-t2') % v':real^3 +==> (inv ( t3'))%(t3' % w') = (inv (t3'))%((u'-t1') % x + (v''-t2') % v') +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC `(inv t3' * (u' - t1':real))` +THEN EXISTS_TAC `(inv t3' * (v'' - t2':real))` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t3' * (u' - t1') + inv t3' * (v'' - t2')=inv t3'* (t3'+ (u'+v'') - (t1'+t2'+t3'))`;REAL_ARITH`t3'+ &1 - &1=t3'`];(*9*) + + + + +SUBGOAL_THEN`~collinear {x, x', va:real^3}` ASSUME_TAC +THENL(*10*)[ +REMOVE_THEN "BO" MP_TAC +THEN DISCH_TAC THEN REMOVE_ASSUM_TAC +THEN ASM_REWRITE_TAC[collinear1_fan;] +THEN FIND_ASSUM MP_TAC`~(va IN aff {x, v:real^3})` +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % (va) = + u' % x + v' % (va)<=> +(&1-(t1+t2+t3)) % x + (v'-t3) % (va-x) = + (&1-(u'+v') ) % x + t2 % (v-x)`;REAL_ARITH`a-a= &0`] +THEN REDUCE_VECTOR_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(v'' - t3 = &0) \/ ~(v'' - (t3:real)= &0)`) +THENL(*11*)[ + +ASM_REWRITE_TAC[VECTOR_ARITH`&0 %A=B<=> B= vec 0`;VECTOR_MUL_EQ_0] +THEN MP_TAC(REAL_ARITH`&0< t2==> ~(t2 = &0)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-B= vec 0<=> A=B`];(*11*) + +MRESA1_TAC REAL_MUL_LINV `(v''-t3:real)` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(v'' - t3) % (va- x) = t2 % (v - x:real^3) ==> (inv (v'' -t3)) % ((v'' - t3) % (va - x)) = (inv (v'' -t3)) % ( t2 % (v - x))`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C:real^3)`]) +THEN REWRITE_TAC[VECTOR_ARITH`&1 % (va - x) = (inv (v' - t3) * t2) % (v - x)<=> +va = (&1-(inv (v' - t3) * t2))%x +(inv (v' - t3) * t2) % v:real^3`] +THEN STRIP_TAC +THEN EXISTS_TAC`&1-(inv (v'' - t3) * (t2:real))` +THEN EXISTS_TAC`(inv (v'' - t3) * (t2:real))` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC](*11*);(*10*) + + +SUBGOAL_THEN `~collinear {x, x', v:real^3}` ASSUME_TAC +THENL(*11*)[ +REMOVE_THEN "BO" MP_TAC +THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC +THEN ASM_REWRITE_TAC[collinear1_fan] +THEN FIND_ASSUM MP_TAC `~(va IN aff {x, v:real^3})` +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % v' + t3' % w' = u' % x + v'' % v' +<=> t3' % w' = (u'-t1') % x + (v''-t2') % v'`] +THEN MP_TAC(REAL_ARITH`&0< t3 ==> ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t3:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3 % va = (u'-t1) % x + (v''-t2) % v:real^3 +==> (inv ( t3))%(t3 % va) = (inv (t3))%((u'-t1) % x + (v''-t2) % v) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC `(inv t3 * (u' - t1:real))` +THEN EXISTS_TAC `(inv t3 * (v'' - t2:real))` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t3' * (u' - t1') + inv t3' * (v'' - t2')=inv t3'* (t3'+ (u'+v'') - (t1'+t2'+t3'))`;REAL_ARITH`t3'+ &1 - &1=t3'`];(*11*) + +ABBREV_TAC`an=t1' % x + t2' % v' + t3' % w':real^3` +THEN REMOVE_THEN "VUT1" MP_TAC +THEN REMOVE_THEN "VUT1" MP_TAC +THEN REMOVE_THEN "BO" MP_TAC +THEN REMOVE_THEN "VUT" MP_TAC +THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN DISJ_CASES_TAC(SET_RULE`(&0 < azim x (x':real^3) v w' /\ + azim x (x') v w' < pi)\/ ~(&0 < azim x (x') v w' /\ + azim x (x') v w' < pi)`) + +THENL(*12*)[ + +MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`x':real^3`;`w':real^3`] +THEN REWRITE_TAC[EMPTY;IN] +THEN MP_TAC(REAL_ARITH`&0 &0< &1-t:real /\ &1-t< &1`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] +THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] +THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) +THEN MRESA_TAC aff_gt1_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`{v',w'} IN (E:(real^3->bool)->bool)` +THEN SET_TAC[];(*12*) + +ASSUME_TAC(ISPECL[`x:real^3`;`v':real^3`;`w':real^3`;`x':real^3`]azim) +THEN ASSUME_TAC(PI_WORKS) +THEN MP_TAC(REAL_ARITH`~(&0 < azim x x' v w' /\ azim x x' v w' < pi)/\ +&0 <= azim x x' v w' /\ &0< pi==> pi< azim x x' v w' \/(azim x x' v w'= &0 \/ azim x x' v w'=pi) `) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*13*)(*3SUBGOAL*)[ + +POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3 `;`x':real^3`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN DISCH_TAC +THEN MP_TAC(REAL_ARITH`azim x x' v' w' < azim x x' v w'==>azim x x' v' w' <= azim x x' v w'`) +THEN RESA_TAC +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3 `;`x':real^3`] +THEN DISCH_TAC THEN DISCH_TAC +THEN MP_TAC(REAL_ARITH`pi < azim x x' v w' /\ azim x x' v w' = azim x x' v v' + pi +/\ azim x x' v w' < &2 * pi==> &0 bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`x':real^3`;`v':real^3`] +THEN REWRITE_TAC[EMPTY;IN] +THEN MP_TAC(REAL_ARITH`&0 &0< &1-t:real /\ &1-t< &1`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] +THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] +THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) +THEN SUBGOAL_THEN ` aff_ge {x} {w', v':real^3}=aff_ge {x} {v', w'}` ASSUME_TAC +THENL(*14*)[ +REWRITE_TAC[SET_RULE`{A,B}={B,A}`];(*14*) + +MRESA_TAC aff_gt1_subset_aff_ge[`x:real^3`;`w':real^3`;`v':real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`{v',w'} IN (E:(real^3->bool)->bool)` +THEN SET_TAC[]](*14*);(*13*) + +MRESA_TAC AZIM_EQ_0[`x:real^3`;`x':real^3`;`v:real^3`;`w':real^3`] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`x':real^3`;`v:real^3`;`w':real^3`] +THEN MRESA_TAC AZIM_EQ_0[`x:real^3`;`x':real^3`;`w':real^3`;`v:real^3`] +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`w':real^3`;`v:real^3`] +THEN DISJ_CASES_TAC(SET_RULE`w' IN aff_gt {x} {v,va:real^3}\/ ~(w' IN aff_gt {x} {v,va:real^3})`) +THENL(*14*)[ +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-a)%u +a%w:real^3`][IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"DICH CHUYEN") +THEN DISCH_TAC +THEN REMOVE_THEN "DICH CHUYEN"(fun th->MP_TAC(th) THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN REMOVE_ASSUM_TAC + THEN ASSUME_TAC(th)) +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`w' = t1'' % x + t2'' % v + t3'' % va<=> + ((t1''+t2''+t3'')- &1) % x + t2'' % (v-x) + t3'' % (va-x)= w' -x:real^3`;REAL_ARITH`&1- &1 = &0`] +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(REAL_ARITH`&0< t2'' /\ &0< t3'' /\ t1''+t2''+t3''= &1==> &0 < &1- t1'' /\ ~(&1- t1'' = &0)/\ t2''+t3''= &1- t1''`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2'' + t3'' = &1 - t1'':real +==> (inv ( &1 - t1''))*(t2'' + t3'') = (inv ( &1 - t1''))*( &1 - t1'':real) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1- A*C = A*B`] +THEN STRIP_TAC +THEN MRESA_TAC REAL_LT_MUL[`inv(&1- t1'':real)`;`t3'':real`] +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)*(t3'':real)= &0)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)= &0)`) +THEN RESA_TAC +THEN ASSUME_TAC(REAL_ARITH`~(&1= &0)`) +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, (&1 - a) % u + a % w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] ) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN DISCH_TAC +THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` ((&1 - a) % u + a % w)-x:real^3`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(inv(&1- t1'')) * t3'':real`[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`inv(&1- t1'')`;`u - x:real^3`; `v - x:real^3`; `w'-x:real^3`] +[VECTOR_ARITH`&1 %A=A`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v,w'}= {(--x) +x, (--x) +u, (--x) +v, (--x) + w'}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w'}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN DISCH_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `w':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN MRESA_TAC exists_element_in_half_sapace_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w':real^3`;` v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; +` (w':real^3)`] +THEN MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`w':real^3`;`u':real^3`] +THEN REWRITE_TAC[EMPTY;IN] +THEN MP_TAC(REAL_ARITH`&0 &0< &1-t:real /\ &1-t< &1`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] +THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] +THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`w':real^3`;`u':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`{w',u'} IN (E:(real^3->bool)->bool)` +THEN SET_TAC[];(*14*) + +DISJ_CASES_TAC(SET_RULE`v' IN aff_gt {x} {v,va:real^3}\/ ~(v' IN aff_gt {x} {v,va:real^3})`) +THENL(*15*)[ + +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-a)%u +a%w:real^3`][IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"DICH CHUYEN") +THEN DISCH_TAC +THEN REMOVE_THEN "DICH CHUYEN"(fun th->MP_TAC(th) THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN REMOVE_ASSUM_TAC + THEN ASSUME_TAC(th)) +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`v' = t1'' % x + t2'' % v + t3'' % va<=> + ((t1''+t2''+t3'')- &1) % x + t2'' % (v-x) + t3'' % (va-x)= v' -x:real^3`;REAL_ARITH`&1- &1 = &0`] +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(REAL_ARITH`&0< t2'' /\ &0< t3'' /\ t1''+t2''+t3''= &1==> &0 < &1- t1'' /\ ~(&1- t1'' = &0)/\ t2''+t3''= &1- t1''`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2'' + t3'' = &1 - t1'':real +==> (inv ( &1 - t1''))*(t2'' + t3'') = (inv ( &1 - t1''))*( &1 - t1'':real) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1- A*C = A*B`] +THEN STRIP_TAC +THEN MRESA_TAC REAL_LT_MUL[`inv(&1- t1'':real)`;`t3'':real`] +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)*(t3'':real)= &0)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)= &0)`) +THEN RESA_TAC +THEN ASSUME_TAC(REAL_ARITH`~(&1= &0)`) +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, (&1 - a) % u + a % w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] ) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN DISCH_TAC +THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` ((&1 - a) % u + a % w)-x:real^3`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(inv(&1- t1'')) * t3'':real`[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`inv(&1- t1'')`;`u - x:real^3`; `v - x:real^3`; `v'-x:real^3`] +[VECTOR_ARITH`&1 %A=A`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v,v'}= {(--x) +x, (--x) +u, (--x) +v, (--x) + v'}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, v'}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN DISCH_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `v':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN MRESA_TAC exists_element_in_half_sapace_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;` v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; +` (v':real^3)`] +THEN MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v':real^3`;`u':real^3`] +THEN REWRITE_TAC[EMPTY;IN] +THEN MP_TAC(REAL_ARITH`&0 &0< &1-t:real /\ &1-t< &1`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] +THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] +THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v':real^3`;`u':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`{v',u'} IN (E:(real^3->bool)->bool)` +THEN SET_TAC[];(*15*) + +SUBGOAL_THEN`~(w' IN aff_gt {x} { x',v:real^3})` ASSUME_TAC +THENL(*16*)[ +REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC aff_gt3_subset_aff_gt[`x:real^3`;`v:real^3`;`va:real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*16*) + +MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`v:real^3`;`w':real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*17*)[ +MRESA_TAC aff_gt1_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3`;`x':real^3`] +THEN MP_TAC(SET_RULE`v IN aff_gt {x} {x', w':real^3} /\ aff_gt {x} {x', w'} SUBSET aff_ge {x} {v', w'} +==>v IN aff_ge {x} {v', w':real^3}`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v:real^3`; `u:real^3`; `v':real^3`;`w':real^3`]properties_of_fan7) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*18*)[ +MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`; `w':real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)]) +THEN MP_TAC(PI_WORKS) +THEN REAL_ARITH_TAC;(*18*) + +MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`; `w':real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)]) +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_PI_SYM [`x:real^3`;`x':real^3`; `v':real^3`;`v:real^3`] +THEN ASSUME_TAC(REAL_ARITH`pi <= pi`) +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`va:real^3`;`v':real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A=A+B <=> B= &0`] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`va:real^3`;`v':real^3`] +THEN MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`v':real^3`;`va:real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*19*)[ +MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] +THEN ASM_TAC THEN SET_TAC[];(*19*) + +MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`w':real^3`; `v':real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC THEN STRIP_TAC +THEN MP_TAC(SET_RULE`va IN aff_ge {x} {v', x':real^3} /\ aff_ge {x} {v', x'} SUBSET aff_ge {x} {v', w'} +==>va IN aff_ge {x} {v', w':real^3}`) +THEN RESA_TAC +THEN SUBGOAL_THEN `va IN aff_ge {x} {u,w:real^3}` ASSUME_TAC +THENL(*20*)[ + +MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1 -a:real` +THEN EXISTS_TAC`a:real` +THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 <= &1 - a /\ &0 <= a`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC;(*20*) + + +MP_TAC(SET_RULE`va IN aff_ge {x} {v', w':real^3} /\ va IN aff_ge {x} {u, w} +==>va IN aff_ge {x} {u, w} INTER aff_ge {x} {v', w':real^3} `) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPECL[`{(u:real^3),(w:real^3)}`;`{(v':real^3),(w':real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] +THEN DISCH_TAC THEN ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(SET_RULE`{u, w} INTER {v', w'}={u,w:real^3}\/ ~({u, w} INTER {v', w'}={u,w:real^3})`) +THENL(*21*)[ + +DISCH_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN MP_TAC(SET_RULE`{u, w} INTER {v', w'}={u,w:real^3}/\ ~(w=u) /\ ~(v'=w') ==> {v', w'}={u,w} `) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC `v IN aff_ge {x} {v', w':real^3}` +THEN POP_ASSUM(fun th->REWRITE_TAC[th]) +THEN MRESAL_TAC aff_ge_inter_aff_ge[`x:real^3`;`u:real^3`;`w:real^3`][INTER;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*21*) + + +MP_TAC(SET_RULE`~({u, w} INTER {v', w'} = {u, w:real^3}) ==> {u, w} INTER {v', w'} PSUBSET {u, w} `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{u, w} INTER {v', w'} PSUBSET {u, w:real^3} ==> {u, w} INTER {v', w'} SUBSET {u}\/ {u, w} INTER {v', w'} SUBSET {w} `) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*22*)[ + +MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v', w':real^3}`; `{u:real^3}`][DISJOINT;SET_RULE`{x} INTER {u} = {}<=> ~(x=u:real^3)`] +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{u:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] +THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v', w'}) SUBSET aff_ge {x} {u}/\ aff_ge {x} {u} SUBSET aff {x, u}/\ va IN aff_ge {x} ({u, w} INTER {v', w'})==> va IN aff {x,u}`) +THEN RESA_TAC +THEN REWRITE_TAC[IN;EMPTY] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % u +<=> a % w = u' % x + (v''+a- &1) % u`] +THEN MRESA1_TAC REAL_MUL_LINV`a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`a % w = u' % x + (v'' + a - &1) % u:real^3 ==> (inv (a))%(a % w ) = (inv (a))%( u' % x + (v'' + a - &1) % u)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`(inv a * u'):real` +THEN EXISTS_TAC`(inv a * (v'' + a - &1)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv a * u' + inv a * (v'' + a - &1) =inv a * ( a+ (u' + v'') - &1)`;REAL_ARITH`A+ &1- &1=A`];(*22*) + +STRIP_TAC +THEN FIND_ASSUM MP_TAC`{u,w:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`w:real^3`] +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v', w':real^3}`; `{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {w} = {}<=> ~(x=w:real^3)`] +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{w:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] +THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v', w'}) SUBSET aff_ge {x} {w}/\ aff_ge {x} {w} SUBSET aff {x, w}/\ va IN aff_ge {x} ({u, w} INTER {v', w'})==> va IN aff {x,w}`) +THEN RESA_TAC +THEN REWRITE_TAC[IN;EMPTY] +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `~(u IN aff {x, w:real^3})` +THEN REWRITE_TAC[] +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % w +<=> (&1-a )% u = u' % x + (v''-a) % w`] +THEN MP_TAC(REAL_ARITH`a< &1==> ~(&1-a= &0)` )THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`&1-a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(&1-a )% u = u' % x + (v''-a) % w:real^3 ==> (inv (&1-a))%((&1-a )% u ) = (inv (&1-a))%( u' % x + (v''-a) % w)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`(inv (&1-a) * u'):real` +THEN EXISTS_TAC`(inv (&1-a) * (v'' - a)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1 - a) * u' + inv (&1 - a) * (v'' - a)=inv (&1 - a) * ((u' + v'') - a)`]](*22*)](*21*)](*20*)](*19*)](*18*);(*17*) + + + + +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN DISCH_TAC +THEN MRESA_TAC aff_ge_subset_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;`(x':real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MP_TAC(SET_RULE`aff_ge {x} {v, x':real^3} SUBSET aff_gt {x, v} {x'} UNION aff_ge {x} {v} /\ w' IN aff_ge {x} {v, x'} ==> w' IN aff_gt {x, v} {x'} UNION aff_ge {x} {v}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(x':real^3)`;`(v:real^3)`] +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;UNION] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `w':real^3`; `v':real^3`; `v:real^3`;`u:real^3`]properties1_of_fan7) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(SYM(th))) +THEN DISCH_TAC +THEN MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v':real^3)`;`(w':real^3)`] +THEN SUBGOAL_THEN`v IN aff_ge {x} {v', w':real^3}`ASSUME_TAC +THENL(*18*)[ +POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[];(*18*) +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"NHAT") +THEN DISCH_TAC +THEN REMOVE_THEN "NHAT" MP_TAC +THEN DISCH_TAC +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`; `w':real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)]) +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_PI_SYM [`x:real^3`;`x':real^3`; `v':real^3`;`v:real^3`] +THEN ASSUME_TAC(REAL_ARITH`pi <= pi`) +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`va:real^3`;`v':real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A=A+B <=> B= &0`] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`va:real^3`;`v':real^3`] +THEN MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`v':real^3`;`va:real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*19*)[ + +MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] +THEN ASM_TAC THEN SET_TAC[];(*19*) + +MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`w':real^3`; `v':real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC THEN STRIP_TAC +THEN MP_TAC(SET_RULE`va IN aff_ge {x} {v', x':real^3} /\ aff_ge {x} {v', x'} SUBSET aff_ge {x} {v', w'} +==>va IN aff_ge {x} {v', w':real^3}`) +THEN RESA_TAC +THEN SUBGOAL_THEN `va IN aff_ge {x} {u,w:real^3}` ASSUME_TAC +THENL(*20*)[ + +MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1 -a:real` +THEN EXISTS_TAC`a:real` +THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 <= &1 - a /\ &0 <= a`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC;(*20*) + +MP_TAC(SET_RULE`va IN aff_ge {x} {v', w':real^3} /\ va IN aff_ge {x} {u, w} +==>va IN aff_ge {x} {u, w} INTER aff_ge {x} {v', w':real^3} `) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPECL[`{(u:real^3),(w:real^3)}`;`{(v':real^3),(w':real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] +THEN DISCH_TAC THEN ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(SET_RULE`{u, w} INTER {v', w'}={u,w:real^3}\/ ~({u, w} INTER {v', w'}={u,w:real^3})`) +THENL(*21*)[ + +DISCH_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN MP_TAC(SET_RULE`{u, w} INTER {v', w'}={u,w:real^3}/\ ~(w=u) /\ ~(v'=w') ==> {v', w'}={u,w} `) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC `v IN aff_ge {x} {v', w':real^3}` +THEN POP_ASSUM(fun th->REWRITE_TAC[th]) +THEN MRESAL_TAC aff_ge_inter_aff_ge[`x:real^3`;`u:real^3`;`w:real^3`][INTER;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*21*) + +MP_TAC(SET_RULE`~({u, w} INTER {v', w'} = {u, w:real^3}) ==> {u, w} INTER {v', w'} PSUBSET {u, w} `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{u, w} INTER {v', w'} PSUBSET {u, w:real^3} ==> {u, w} INTER {v', w'} SUBSET {u}\/ {u, w} INTER {v', w'} SUBSET {w} `) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*22*)[ + +MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v', w':real^3}`; `{u:real^3}`][DISJOINT;SET_RULE`{x} INTER {u} = {}<=> ~(x=u:real^3)`] +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{u:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] +THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v', w'}) SUBSET aff_ge {x} {u}/\ aff_ge {x} {u} SUBSET aff {x, u}/\ va IN aff_ge {x} ({u, w} INTER {v', w'})==> va IN aff {x,u}`) +THEN RESA_TAC +THEN REWRITE_TAC[IN;EMPTY] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % u +<=> a % w = u' % x + (v''+a- &1) % u`] +THEN MRESA1_TAC REAL_MUL_LINV`a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`a % w = u' % x + (v'' + a - &1) % u:real^3 ==> (inv (a))%(a % w ) = (inv (a))%( u' % x + (v'' + a - &1) % u)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`(inv a * u'):real` +THEN EXISTS_TAC`(inv a * (v'' + a - &1)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv a * u' + inv a * (v'' + a - &1) =inv a * ( a+ (u' + v'') - &1)`;REAL_ARITH`A+ &1- &1=A`];(*22*) + + +STRIP_TAC +THEN FIND_ASSUM MP_TAC`{u,w:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`w:real^3`] +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v', w':real^3}`; `{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {w} = {}<=> ~(x=w:real^3)`] +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{w:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] +THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v', w'}) SUBSET aff_ge {x} {w}/\ aff_ge {x} {w} SUBSET aff {x, w}/\ va IN aff_ge {x} ({u, w} INTER {v', w'})==> va IN aff {x,w}`) +THEN RESA_TAC +THEN REWRITE_TAC[IN;EMPTY] +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `~(u IN aff {x, w:real^3})` +THEN REWRITE_TAC[] +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % w +<=> (&1-a )% u = u' % x + (v''-a) % w`] +THEN MP_TAC(REAL_ARITH`a< &1==> ~(&1-a= &0)` )THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`&1-a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(&1-a )% u = u' % x + (v''-a) % w:real^3 ==> (inv (&1-a))%((&1-a )% u ) = (inv (&1-a))%( u' % x + (v''-a) % w)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`(inv (&1-a) * u'):real` +THEN EXISTS_TAC`(inv (&1-a) * (v'' - a)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1 - a) * u' + inv (&1 - a) * (v'' - a)=inv (&1 - a) * ((u' + v'') - a)`]](*22*)](*21*)](*20*)](*19*)](*18*)](*17*)](*16*)](*15*)](*14*);(*13*) + + + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CUOI") +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3 `;`x':real^3`] +THEN ASSUME_TAC(REAL_ARITH`pi<= pi`) +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A=B+A<=>B= &0`] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`] +THEN MRESA_TAC AZIM_EQ_0[`x:real^3`;`x':real^3`;`v':real^3`;`v:real^3`] +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`v':real^3`;`v:real^3`] +THEN DISJ_CASES_TAC(SET_RULE`w' IN aff_gt {x} {v,va:real^3}\/ ~(w' IN aff_gt {x} {v,va:real^3})`) +THENL(*14*)[ + +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-a)%u +a%w:real^3`][IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"DICH CHUYEN") +THEN DISCH_TAC +THEN REMOVE_THEN "DICH CHUYEN"(fun th->MP_TAC(th) THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN REMOVE_ASSUM_TAC + THEN ASSUME_TAC(th)) +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`w' = t1'' % x + t2'' % v + t3'' % va<=> + ((t1''+t2''+t3'')- &1) % x + t2'' % (v-x) + t3'' % (va-x)= w' -x:real^3`;REAL_ARITH`&1- &1 = &0`] +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(REAL_ARITH`&0< t2'' /\ &0< t3'' /\ t1''+t2''+t3''= &1==> &0 < &1- t1'' /\ ~(&1- t1'' = &0)/\ t2''+t3''= &1- t1''`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2'' + t3'' = &1 - t1'':real +==> (inv ( &1 - t1''))*(t2'' + t3'') = (inv ( &1 - t1''))*( &1 - t1'':real) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1- A*C = A*B`] +THEN STRIP_TAC +THEN MRESA_TAC REAL_LT_MUL[`inv(&1- t1'':real)`;`t3'':real`] +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)*(t3'':real)= &0)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)= &0)`) +THEN RESA_TAC +THEN ASSUME_TAC(REAL_ARITH`~(&1= &0)`) +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, (&1 - a) % u + a % w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] ) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN DISCH_TAC +THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` ((&1 - a) % u + a % w)-x:real^3`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(inv(&1- t1'')) * t3'':real`[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`inv(&1- t1'')`;`u - x:real^3`; `v - x:real^3`; `w'-x:real^3`] +[VECTOR_ARITH`&1 %A=A`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v,w'}= {(--x) +x, (--x) +u, (--x) +v, (--x) + w'}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w'}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN DISCH_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `w':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN MRESA_TAC exists_element_in_half_sapace_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w':real^3`;` v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; +` (w':real^3)`] +THEN MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`w':real^3`;`u':real^3`] +THEN REWRITE_TAC[EMPTY;IN] +THEN MP_TAC(REAL_ARITH`&0 &0< &1-t:real /\ &1-t< &1`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] +THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] +THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`w':real^3`;`u':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`{w',u'} IN (E:(real^3->bool)->bool)` +THEN SET_TAC[];(*14*) + +DISJ_CASES_TAC(SET_RULE`v' IN aff_gt {x} {v,va:real^3}\/ ~(v' IN aff_gt {x} {v,va:real^3})`) +THENL(*15*)[ + +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-a)%u +a%w:real^3`][IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"DICH CHUYEN") +THEN DISCH_TAC +THEN REMOVE_THEN "DICH CHUYEN"(fun th->MP_TAC(th) THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN REMOVE_ASSUM_TAC + THEN ASSUME_TAC(th)) +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`v' = t1'' % x + t2'' % v + t3'' % va<=> + ((t1''+t2''+t3'')- &1) % x + t2'' % (v-x) + t3'' % (va-x)= v' -x:real^3`;REAL_ARITH`&1- &1 = &0`] +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(REAL_ARITH`&0< t2'' /\ &0< t3'' /\ t1''+t2''+t3''= &1==> &0 < &1- t1'' /\ ~(&1- t1'' = &0)/\ t2''+t3''= &1- t1''`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2'' + t3'' = &1 - t1'':real +==> (inv ( &1 - t1''))*(t2'' + t3'') = (inv ( &1 - t1''))*( &1 - t1'':real) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1- A*C = A*B`] +THEN STRIP_TAC +THEN MRESA_TAC REAL_LT_MUL[`inv(&1- t1'':real)`;`t3'':real`] +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)*(t3'':real)= &0)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)= &0)`) +THEN RESA_TAC +THEN ASSUME_TAC(REAL_ARITH`~(&1= &0)`) +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, (&1 - a) % u + a % w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] ) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN DISCH_TAC +THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` ((&1 - a) % u + a % w)-x:real^3`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(inv(&1- t1'')) * t3'':real`[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`inv(&1- t1'')`;`u - x:real^3`; `v - x:real^3`; `v'-x:real^3`] +[VECTOR_ARITH`&1 %A=A`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v,v'}= {(--x) +x, (--x) +u, (--x) +v, (--x) + v'}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, v'}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN DISCH_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `v':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN MRESA_TAC exists_element_in_half_sapace_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;` v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; +` (v':real^3)`] +THEN MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v':real^3`;`u':real^3`] +THEN REWRITE_TAC[EMPTY;IN] +THEN MP_TAC(REAL_ARITH`&0 &0< &1-t:real /\ &1-t< &1`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] +THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] +THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v':real^3`;`u':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`{v',u'} IN (E:(real^3->bool)->bool)` +THEN SET_TAC[];(*15*) + +SUBGOAL_THEN`~(v' IN aff_gt {x} { x',v:real^3})` ASSUME_TAC +THENL(*16*)[ +REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC aff_gt3_subset_aff_gt[`x:real^3`;`v:real^3`;`va:real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*16*) + +MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*17*)[ + +MRESA_TAC aff_gt12_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3`;`x':real^3`] +THEN MP_TAC(SET_RULE`v IN aff_gt {x} {x', v':real^3} /\ aff_gt {x} {x', v'} SUBSET aff_ge {x} {v', w'} +==>v IN aff_ge {x} {v', w':real^3}`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v:real^3`; `u:real^3`; `v':real^3`;`w':real^3`]properties_of_fan7) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*18*)[ + MRESA_TAC aff_gt2_subset_aff_ge [`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] +THEN ASSUME_TAC(REAL_ARITH`pi <= pi`) +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`va:real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A=A+B <=> B= &0`] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`va:real^3`;`w':real^3`] +THEN MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`w':real^3`;`va:real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*19*)[ + +MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] +THEN ASM_TAC THEN SET_TAC[];(*19*) + +MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] +THEN ASM_TAC THEN SET_TAC[]](*19*);(*18*) + + +REMOVE_THEN "CUOI" MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[AZIM_REFL] +THEN MP_TAC(PI_WORKS) +THEN REAL_ARITH_TAC](*18*);(*17*) + +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN DISCH_TAC +THEN MRESA_TAC aff_ge_subset_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;`(x':real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MP_TAC(SET_RULE`aff_ge {x} {v, x':real^3} SUBSET aff_gt {x, v} {x'} UNION aff_ge {x} {v} /\ v' IN aff_ge {x} {v, x'} ==> v' IN aff_gt {x, v} {x'} UNION aff_ge {x} {v}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(x':real^3)`;`(v:real^3)`] +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;UNION] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v':real^3`; `w':real^3`; `v:real^3`;`u:real^3`]properties1_of_fan7) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(SYM(th))) +THEN DISCH_TAC +THEN MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v':real^3)`;`(w':real^3)`] +THEN MRESA_TAC aff_gt2_subset_aff_ge [`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] +THEN ASSUME_TAC(REAL_ARITH`pi <= pi`) +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`va:real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A=A+B <=> B= &0`] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`va:real^3`;`w':real^3`] +THEN MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`w':real^3`;`va:real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*18*)[ +MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] +THEN ASM_TAC THEN SET_TAC[];(*18*) + + +MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`v':real^3`; `w':real^3`;`x':real^3`] +THEN MP_TAC(SET_RULE`va IN aff_ge {x} { x',w':real^3} /\ aff_ge {x} { x',w'} SUBSET aff_ge {x} {v', w'} +==>va IN aff_ge {x} {v', w':real^3}`) +THEN RESA_TAC +THEN SUBGOAL_THEN `va IN aff_ge {x} {u,w:real^3}` ASSUME_TAC +THENL(*19*)[ + +MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1 -a:real` +THEN EXISTS_TAC`a:real` +THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 <= &1 - a /\ &0 <= a`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC;(*19*) + +MP_TAC(SET_RULE`va IN aff_ge {x} {v', w':real^3} /\ va IN aff_ge {x} {u, w} +==>va IN aff_ge {x} {u, w} INTER aff_ge {x} {v', w':real^3} `) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPECL[`{(u:real^3),(w:real^3)}`;`{(v':real^3),(w':real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] +THEN DISCH_TAC THEN ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(SET_RULE`{u, w} INTER {v', w'}={u,w:real^3}\/ ~({u, w} INTER {v', w'}={u,w:real^3})`) +THENL(*20*)[ +DISCH_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN MP_TAC(SET_RULE`{u, w} INTER {v', w'}={u,w:real^3}/\ ~(w=u) /\ ~(v'=w') ==> {v', w'}={u,w} `) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC `v' IN aff_ge {x} {v', w':real^3}` +THEN POP_ASSUM(fun th->REWRITE_TAC[th]) +THEN MRESAL_TAC aff_ge_inter_aff_ge[`x:real^3`;`u:real^3`;`w:real^3`][INTER;IN_ELIM_THM] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC `~collinear {x, v, u:real^3}` +THEN FIND_ASSUM MP_TAC `v=v':real^3` +THEN DISCH_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[th]) +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*20*) + +MP_TAC(SET_RULE`~({u, w} INTER {v', w'} = {u, w:real^3}) ==> {u, w} INTER {v', w'} PSUBSET {u, w} `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{u, w} INTER {v', w'} PSUBSET {u, w:real^3} ==> {u, w} INTER {v', w'} SUBSET {u}\/ {u, w} INTER {v', w'} SUBSET {w} `) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*21*)[ + +MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v', w':real^3}`; `{u:real^3}`][DISJOINT;SET_RULE`{x} INTER {u} = {}<=> ~(x=u:real^3)`] +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{u:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] +THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v', w'}) SUBSET aff_ge {x} {u}/\ aff_ge {x} {u} SUBSET aff {x, u}/\ va IN aff_ge {x} ({u, w} INTER {v', w'})==> va IN aff {x,u}`) +THEN RESA_TAC +THEN REWRITE_TAC[IN;EMPTY] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % u +<=> a % w = u' % x + (v''+a- &1) % u`] +THEN MRESA1_TAC REAL_MUL_LINV`a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`a % w = u' % x + (v'' + a - &1) % u:real^3 ==> (inv (a))%(a % w ) = (inv (a))%( u' % x + (v'' + a - &1) % u)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`(inv a * u'):real` +THEN EXISTS_TAC`(inv a * (v'' + a - &1)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv a * u' + inv a * (v'' + a - &1) =inv a * ( a+ (u' + v'') - &1)`;REAL_ARITH`A+ &1- &1=A`];(*21*) + + +STRIP_TAC +THEN FIND_ASSUM MP_TAC`{u,w:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`w:real^3`] +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v', w':real^3}`; `{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {w} = {}<=> ~(x=w:real^3)`] +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{w:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] +THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v', w'}) SUBSET aff_ge {x} {w}/\ aff_ge {x} {w} SUBSET aff {x, w}/\ va IN aff_ge {x} ({u, w} INTER {v', w'})==> va IN aff {x,w}`) +THEN RESA_TAC +THEN REWRITE_TAC[IN;EMPTY] +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `~(u IN aff {x, w:real^3})` +THEN REWRITE_TAC[] +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % w +<=> (&1-a )% u = u' % x + (v''-a) % w`] +THEN MP_TAC(REAL_ARITH`a< &1==> ~(&1-a= &0)` )THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`&1-a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(&1-a )% u = u' % x + (v''-a) % w:real^3 ==> (inv (&1-a))%((&1-a )% u ) = (inv (&1-a))%( u' % x + (v''-a) % w)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`(inv (&1-a) * u'):real` +THEN EXISTS_TAC`(inv (&1-a) * (v'' - a)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1 - a) * u' + inv (&1 - a) * (v'' - a)=inv (&1 - a) * ((u' + v'') - a)`]](*21*)](*20*)](*19*)](*18*)](*17*)](*16*)](*15*)](*14*)](*13*)](*12*)](*11*)](*10*)](*9*)] +(*8*)](*7*)](*6*)](*5*)](*4*)](*3*)](*2*);(*1*) + +SET_TAC[]]);; + + + + +let exist_close1_fan=prove(`(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) (v1:real^3) (w1:real^3) a:real. + +FAN(x,V,E) /\ {v,u} INTER {v1,w1}={} /\ {v1,w1} IN E /\ {v,u} IN E /\ {u,w} IN E +/\ (&0< azim x u w v ) /\ (azim x u w v +?h:real. +(&0 < h) +/\ +(!y1:real^3 y2:real^3. y1 IN (aff_ge {x} {v, (&1 - a) % u + a % w} INTER ballnorm_fan x) /\ y2 IN (aff_ge {x} {v1, w1} INTER ballnorm_fan x) +==> h <= dist(y1,y2) ))`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (v1:real^3)`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`;`a:real`] + +THEN MATCH_MP_TAC( ISPECL [`aff_ge {(x:real^3)} {(v:real^3), ((&1 - a) % u + a % w:real^3)} INTER ballnorm_fan x`; + `aff_ge {(x:real^3)} {(v1:real^3), (w1:real^3)} INTER ballnorm_fan x`] SEPARATE_CLOSED_COMPACT) +THEN MP_TAC(ISPECL[`(x:real^3) `;` (v:real^3)`;` ((&1 - a) % u + a % w:real^3)`]closed_aff_ge_ballnorm_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3) `;` (v1:real^3)`;` (w1:real^3)`]compact_aff_ge_ballnorm_fan) THEN RESA_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN FIND_ASSUM MP_TAC `{v1,w1:real^3} IN E` +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;` (v:real^3)`;`((&1 - a) % u + a % w:real^3)`] +THEN FIND_ASSUM(MP_TAC)`FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPECL[`{(v:real^3)}`;`{(v1:real^3),(w1:real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION; IN_ELIM_THM;] +THEN MP_TAC(SET_RULE`(v:real^3) IN V==>(?v'. v' IN V /\ {v} = {v'})`) +THEN REDA_TAC +THEN MP_TAC(SET_RULE`{(v:real^3),u} INTER {v1,w1}={} ==> {v} INTER {v1,w1}={}`) +THEN REDA_TAC +THEN REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_1;] +THEN STRIP_TAC THEN SUBGOAL_THEN`(aff_ge {x} {v} INTER aff_ge {x} {v1, w1:real^3}) INTER ballnorm_fan x={}` +ASSUME_TAC +THENL(*1*)[ +ASM_REWRITE_TAC[INTER;ballnorm_fan;EXTENSION;IN_ELIM_THM;SET_RULE`(?u. u = &1 /\ x' = u % x)<=> x'= &1 % x`;] +THEN REDUCE_VECTOR_TAC +THEN GEN_TAC THEN EQ_TAC +THENL(*2*)[ +STRIP_TAC THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DIST_REFL] +THEN REAL_ARITH_TAC; +SET_TAC[]]; + +ABBREV_TAC`va=(&1 - a) % u + a % w:real^3` + THEN SUBGOAL_THEN `va IN aff_ge {x} {u,w:real^3}` ASSUME_TAC +THENL(*2*)[ + MRESAL_TAC AFF_GE_1_2[`x:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1 -a:real` +THEN EXISTS_TAC`a:real` +THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 <= &1 - a /\ &0 <= a`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC;(*2*) + +SUBGOAL_THEN`(aff_ge {x} {va} INTER aff_ge {x} {v1, w1:real^3}) SUBSET {x}` +ASSUME_TAC +THENL(*3*)[ + MRESA_TAC th3[` (x:real^3)`;`(v:real^3)`;`(va:real^3)`] +THEN MRESA_TAC aff_ge1_1_subset_aff_ge[`x:real^3`;`u:real^3`;`w:real^3`;`va:real^3`] +THEN FIND_ASSUM(MP_TAC)`FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPECL[`{(u:real^3),(w:real^3)}`;`{(v1:real^3),(w1:real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION; IN_ELIM_THM;] +THEN MP_TAC(SET_RULE`{v,u} INTER {v1,w1}={}==> {u,w} INTER {v1,w1} SUBSET {w:real^3}`) +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v1, w1:real^3}`; `{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {u} = {}<=> ~(x=u:real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) +THEN REMOVE_ASSUM_TAC +THEN DISCH_TAC +THEN MP_TAC(SET_RULE`aff_ge {x} {va} SUBSET aff_ge {x} {u, w}/\ +aff_ge {x} {u, w} INTER aff_ge {x} {v1, w1} SUBSET aff_ge {x} {w} +==> aff_ge {x} {va:real^3} INTER aff_ge {x} {v1, w1} SUBSET aff_ge {x} {va} INTER aff_ge {x} {w}`) +THEN RESA_TAC +THEN MATCH_MP_TAC(SET_RULE` aff_ge {x} {va:real^3} INTER aff_ge {x} {v1, w1} SUBSET aff_ge {x} {va} INTER aff_ge {x} {w} /\ aff_ge {x} {va} INTER aff_ge {x} {w} SUBSET {x:real^3} ==>aff_ge {x} {va:real^3} INTER aff_ge {x} {v1, w1} SUBSET {x}`) +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`va:real^3`;][IN_ELIM_THM;SUBSET;INTER] +THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`w:real^3`;][IN_ELIM_THM;SUBSET;IN_SING] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % ((&1 - a) % u + a % w) = t1' % x + t2' % w +<=> (t2 *(&1 - a)) % u = (t1'-t1) % x + (t2'- t2*a) % w:real^3`] +THEN MP_TAC(REAL_ARITH`&0<= t2==> t2= &0 \/ &0 < t2:real`) +THEN RES_TAC +THENL(*4*)[ +FIND_ASSUM MP_TAC`t1+ t2:real= &1` +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN REDUCE_ARITH_TAC +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC;(*4*) + +MP_TAC(REAL_ARITH`a< &1==> &0< &1-a:real`) THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`t2:real`;`&1- a:real`] +THEN MP_TAC(REAL_ARITH` &0< t2*(&1-a)==> ~(t2*(&1-a):real= &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2*(&1-a):real` +THEN MRESA1_TAC REAL_LT_INV`t2*(&1-a):real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(t2 * (&1 - a)) % u = (t1' - t1) % x + (t2' - t2 * a) % w:real^3 ==> (inv (t2 * (&1 - a)))%((t2 * (&1 - a)) % u ) = (inv (t2 * (&1 - a)))%((t1' - t1) % x + (t2' - t2 * a) % w)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`u IN aff {x,w:real^3}`ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`(inv (t2 * (&1 - a)) * (t1' - t1)):real` +THEN EXISTS_TAC`(inv (t2 * (&1 - a)) * (t2' - t2 * a)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (t2 * (&1 - a)) * (t1' - t1) + inv (t2 * (&1 - a)) * (t2' - t2 * a) += inv (t2 * (&1 - a)) * ((t1' +t2')- (t1+t2)+ t2*(&1 - a)):real`; REAL_ARITH`&1- &1 + A= A`];(*5*) + +FIND_ASSUM MP_TAC `~collinear {x, u, w:real^3}` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC th3[`x:real^3`;`w:real^3`;`u:real^3`]]];(*3*) + + +SUBGOAL_THEN`(aff_ge {x} {va} INTER aff_ge {x} {v1, w1:real^3}) INTER ballnorm_fan x={}` +ASSUME_TAC +THENL(*4*)[ +ASM_REWRITE_TAC[INTER;ballnorm_fan;EXTENSION;IN_ELIM_THM;] +THEN REDUCE_VECTOR_TAC +THEN GEN_TAC THEN EQ_TAC +THENL(*5*)[ +STRIP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`x' IN aff_ge {x} {va} /\ x' IN aff_ge {x} {v1, w1} +/\ aff_ge {x} {va} INTER aff_ge {x} {v1, w1} SUBSET {x} +==> x' IN {x:real^3}`) +THEN REWRITE_TAC[IN_SING] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[DIST_REFL;] +THEN REAL_ARITH_TAC;(*5*) +SET_TAC[]]; +ASM_TAC THEN SET_TAC[]]]]]);; + + + + +let lemma_proof0_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (w:real^3) (v1:real^3) (w1:real^3) a:real. + +FAN(x,V,E) /\ {v1,w1} IN E /\ {u,w} IN E /\ ~(u IN {v1,w1}) +/\ &0 (aff_ge {x} {(&1 - a) % u + a % w} INTER aff_ge {x} {v1, w1:real^3}) SUBSET {x}`, +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (v1:real^3)`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN FIND_ASSUM MP_TAC `{v1,w1:real^3} IN E` +THEN ABBREV_TAC`va=(&1 - a) % u + a % w:real^3` +THEN MRESA_TAC properties1_inside_fan[`(x:real^3)`;` (u:real^3)`;`(w:real^3)`;] +THEN MRESA_TAC properties_inside_collinear_fan[`(x:real^3)`;` (u:real^3)`;`(w:real^3)`;`a:real`] +THEN MRESA_TAC th3[` (x:real^3)`;`(va:real^3)`;`(u:real^3)`] +THEN MRESA_TAC aff_ge1_1_subset_aff_ge[`x:real^3`;`u:real^3`;`w:real^3`;`va:real^3`] +THEN FIND_ASSUM(MP_TAC)`FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPECL[`{(u:real^3),(w:real^3)}`;`{(v1:real^3),(w1:real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION; IN_ELIM_THM;] +THEN MP_TAC(SET_RULE`~(u IN {v1,w1})==> {u,w} INTER {v1,w1} SUBSET {w:real^3}`) +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v1, w1:real^3}`; `{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {u} = {}<=> ~(x=u:real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) +THEN REMOVE_ASSUM_TAC +THEN DISCH_TAC +THEN MP_TAC(SET_RULE`aff_ge {x} {va} SUBSET aff_ge {x} {u, w}/\ +aff_ge {x} {u, w} INTER aff_ge {x} {v1, w1} SUBSET aff_ge {x} {w} +==> aff_ge {x} {va:real^3} INTER aff_ge {x} {v1, w1} SUBSET aff_ge {x} {va} INTER aff_ge {x} {w}`) +THEN RESA_TAC +THEN MATCH_MP_TAC(SET_RULE` aff_ge {x} {va:real^3} INTER aff_ge {x} {v1, w1} SUBSET aff_ge {x} {va} INTER aff_ge {x} {w} /\ aff_ge {x} {va} INTER aff_ge {x} {w} SUBSET {x:real^3} ==>aff_ge {x} {va:real^3} INTER aff_ge {x} {v1, w1} SUBSET {x}`) +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`va:real^3`;][IN_ELIM_THM;SUBSET;INTER] +THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`w:real^3`;][IN_ELIM_THM;SUBSET;IN_SING] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % ((&1 - a) % u + a % w) = t1' % x + t2' % w +<=> (t2 *(&1 - a)) % u = (t1'-t1) % x + (t2'- t2*a) % w:real^3`] +THEN MP_TAC(REAL_ARITH`&0<= t2==> t2= &0 \/ &0 < t2:real`) +THEN RES_TAC +THENL(*4*)[ +FIND_ASSUM MP_TAC`t1+ t2:real= &1` +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN REDUCE_ARITH_TAC +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC; +MP_TAC(REAL_ARITH`a< &1==> &0< &1-a:real`) THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`t2:real`;`&1- a:real`] +THEN MP_TAC(REAL_ARITH` &0< t2*(&1-a)==> ~(t2*(&1-a):real= &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2*(&1-a):real` +THEN MRESA1_TAC REAL_LT_INV`t2*(&1-a):real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(t2 * (&1 - a)) % u = (t1' - t1) % x + (t2' - t2 * a) % w:real^3 ==> (inv (t2 * (&1 - a)))%((t2 * (&1 - a)) % u ) = (inv (t2 * (&1 - a)))%((t1' - t1) % x + (t2' - t2 * a) % w)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`u IN aff {x,w:real^3}`ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`(inv (t2 * (&1 - a)) * (t1' - t1)):real` +THEN EXISTS_TAC`(inv (t2 * (&1 - a)) * (t2' - t2 * a)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (t2 * (&1 - a)) * (t1' - t1) + inv (t2 * (&1 - a)) * (t2' - t2 * a) += inv (t2 * (&1 - a)) * ((t1' +t2')- (t1+t2)+ t2*(&1 - a)):real`; REAL_ARITH`&1- &1 + A= A`]; +FIND_ASSUM MP_TAC `~collinear {x, u, w:real^3}` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC th3[`x:real^3`;`w:real^3`;`u:real^3`]]]);; + + +let lemma_proof1_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (w:real^3) (v1:real^3) (w1:real^3) a:real. + +FAN(x,V,E) /\ {v1,w1} IN E /\ {u,w} IN E /\ ~(w IN {v1,w1}) +/\ &0 (aff_ge {x} {(&1 - a) % u + a % w} INTER aff_ge {x} {v1, w1:real^3}) SUBSET {x}`, + +REPEAT STRIP_TAC +THEN MRESAL_TAC lemma_proof0_fan[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(w:real^3)`;` (u:real^3)`;`(v1:real^3)`;`(w1:real^3)`;`&1 -a:real`][VECTOR_ARITH`(&1 - (&1 - a)) % w + (&1 - a) % u=(&1 - a) % u + a % w`;] +THEN POP_ASSUM MATCH_MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC);; + +let lemma_proof_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (w:real^3) (v1:real^3) (w1:real^3) a:real. + +FAN(x,V,E) /\ {v1,w1} IN E /\ {u,w} IN E /\ ~({u,w} = {v1,w1}) +/\ &0 (aff_ge {x} {(&1 - a) % u + a % w} INTER aff_ge {x} {v1, w1:real^3}) SUBSET {x}`, + +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (v1:real^3)`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN MP_TAC(SET_RULE` ~(u=w) /\ ~(v1=w1:real^3)==> ({u,w} = {v1,w1}<=> {u,w} SUBSET {v1,w1})`) +THEN ASM_REWRITE_TAC[SET_RULE`~({u,w} SUBSET {v1,w1})<=> ~(w IN {v1,w1})\/ ~( u IN {v1,w1})`] +THEN ASM_TAC THEN SET_TAC[lemma_proof0_fan;lemma_proof1_fan]);; + + + + +let remark012_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (w:real^3) a:real. +FAN(x,V,E) /\ {u,w} IN E +/\ &0 ~((&1 - a) % u + a % w IN V)`, +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN ABBREV_TAC`v1=(&1 - a) % u + a % w:real^3` +THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan2] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`~(x IN V) /\ v1 IN V==> ~(x=(v1:real^3))`) +THEN RESA_TAC +THEN MRESA_TAC properties_inside_collinear_fan[`(x:real^3)`;`(u:real^3)`;`(w:real^3)`;`a:real`] +THEN MRESA_TAC th3[`(x:real^3)`;`((&1-a)%u+ a%w:real^3)`;`(w:real^3)`] +THEN MRESA_TAC th3[`(x:real^3)`;`((&1-a)%u+ a%w:real^3)`;`(u:real^3)`] +THEN MP_TAC(SET_RULE`DISJOINT {x, v1} {u}==> ~(v1=u:real^3)`) THEN RESA_TAC +THEN MP_TAC(SET_RULE`DISJOINT {x, v1} {w}==> ~(v1=w:real^3)`) THEN RESA_TAC +THEN MP_TAC(SET_RULE` ~(v1=w:real^3) /\ ~(v1=u:real^3) ==> {u,w} INTER {v1}={}`) THEN RESA_TAC +THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPECL[`{(u:real^3),w}`;`({v1:real^3})`]th)) + THEN ASM_REWRITE_TAC[UNION; IN_ELIM_THM;] +THEN MP_TAC(SET_RULE`(v1:real^3) IN V==>(?v'. v' IN V /\ {v1} = {v'})`) +THEN REDA_TAC +THEN MRESA_TAC properties1_inside_fan[`(x:real^3)`;` (u:real^3)`;`(w:real^3)`;] +THEN MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`u:real^3`; `w:real^3`;`v1:real^3`] +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`((&1 - a) % u + a % w:real^3)`;` (w:real^3)`] +THEN MP_TAC(SET_RULE`aff_ge {x} {v1, w} SUBSET aff_ge {x} {u, w}/\ aff_ge {x} {v1, w} = + aff_gt {x} {v1, w} UNION aff_ge {x} {v1} UNION aff_ge {x} {w} +==> aff_ge {x} {u, w} INTER aff_ge {x} {v1}=aff_ge {x} {v1:real^3}`) +THEN RESA_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`v1 IN aff_ge {x} {v1:real^3}` ASSUME_TAC +THENL[MRESAL_TAC AFF_GE_1_1[`x:real^3`;`v1:real^3`;][IN_ELIM_THM] +THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&1` THEN REDUCE_VECTOR_TAC THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_1;SUBSET;IN_SING;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`&1 %A=A`]]);; + + +let remark01_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (w:real^3) (v1:real^3) (w1:real^3) a:real. +FAN(x,V,E) /\ {v1,w1} IN E /\ {u,w} IN E /\ ~({u,w} = {v1,w1}) +/\ &0 ~((&1 - a) % u + a % w IN {v1, w1:real^3})`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w1:real^3`;`v1:real^3`] +THEN FIND_ASSUM MP_TAC `{v1,w1:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v1:real^3`;`w1:real^3`] +THEN MRESA_TAC remark012_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`w:real^3`;`a:real`] +THEN ASM_TAC THEN SET_TAC[]);; + + +let remark0_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) e:real^3->bool. +FAN(x,V,E)/\ e IN E +==> {x} INTER e={}`, +REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"A") THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`]expand_edge_graph_fan) +THEN RESA_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC THEN SET_TAC[]);; + + + +let case2_proof_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {v,w1} IN E +/\ &0 < azim x u w v /\ azim x u w v < pi +/\ &0 (!e. e IN (E DELETE {u,w}) ==> aff_ge {x} e INTER aff_ge {x} {ua,w} = aff_ge {x} (e INTER {ua,w}))`, +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC `~collinear {x,w,ua:real^3}` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN DISCH_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN FIND_ASSUM MP_TAC `e IN E DELETE {u,w:real^3}` +THEN REWRITE_TAC[DELETE;IN_ELIM_THM;SET_RULE`~(e={u,w:real^3})<=> ~({u,w:real^3}=e)`] +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`]expand_edge_graph_fan) +THEN RESA_TAC +THEN MRESA_TAC lemma_proof_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`(w:real^3)`;`(v':real^3)`;`(w':real^3)`;`a:real`] +THEN MRESA_TAC remark01_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`(w:real^3)`;`(v':real^3)`;`(w':real^3)`;`a:real`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM(th)]) +THEN RESA_TAC THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(ua IN e)==> e INTER {ua,w:real^3} SUBSET {w}`) +THEN RESA_TAC +THEN MRESA_TAC properties1_inside_fan[`(x:real^3)`;` (u:real^3)`;`(w:real^3)`;] +THEN MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`u:real^3`; `w:real^3`;`ua:real^3`] +THEN MRESA_TAC th3[` (x:real^3)`;`(ua:real^3)`;`(w:real^3)`] +THEN MRESA_TAC remark0_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`e:real^3->bool`] +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`e INTER { ua,w:real^3}`;`e:real^3->bool`][DISJOINT;SET_RULE` e INTER {ua,w} SUBSET e`;] +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`e INTER { ua,w:real^3}`;`{ua,w:real^3}`][DISJOINT;SET_RULE` e INTER {ua,w} SUBSET {ua,w:real^3}`;] +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{}:real^3->bool`;`{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {w}={} <=> ~(x=w)`;SET_RULE` {} SUBSET {w:real^3}`;] +THEN MATCH_MP_TAC(SET_RULE`C SUBSET A /\ C SUBSET B /\ A INTER B SUBSET C==>A INTER B= C`) +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPECL[`{(u:real^3),w}`;`(e:real^3->bool)`]th)) + THEN ASM_REWRITE_TAC[UNION; IN_ELIM_THM;] +THEN DISJ_CASES_TAC(SET_RULE`{u,w:real^3} INTER e= {u,w} \/ ~({u,w} INTER e= {u,w})`) +THENL[MP_TAC(SET_RULE`{u,w} INTER e= {u,w:real^3}==> {u,w} SUBSET e`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`]expand_edge_graph_fan) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` ~(u=w:real^3) ==> ({u,w} = {v',w'}<=> {u,w} SUBSET {v',w'})`) +THEN RESA_TAC +THEN ASM_TAC THEN SET_TAC[]; + +MP_TAC(SET_RULE` e INTER {ua,w:real^3} SUBSET {w}==> e INTER { ua,w:real^3} = {w} \/ e INTER { ua,w:real^3}= {}`) +THEN RESA_TAC + +THENL[ +MP_TAC(SET_RULE`e INTER {ua, w} = {w:real^3}==> w IN e`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~({u, w} INTER e = {u, w:real^3}) ==> {u, w} INTER e PSUBSET {u, w} `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{u, w} INTER e PSUBSET {u, w:real^3} /\ w IN e /\ ~(u=w) ==> {u, w} INTER e SUBSET {w} `) +THEN RESA_TAC +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER (e:real^3->bool)`;`{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {w}={} <=> ~(x=w)`;SET_RULE` {} SUBSET {w:real^3}`;] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC + THEN SET_TAC[]; + +MP_TAC(SET_RULE`e INTER {ua, w:real^3} = {}==> ~(w IN e)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~({u, w} INTER e = {u, w:real^3}) ==> {u, w} INTER e PSUBSET {u, w} `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{u, w} INTER e PSUBSET {u, w:real^3} /\ ~(w IN e) ==> {u, w} INTER e SUBSET {u} `) +THEN RESA_TAC +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER (e:real^3->bool)`;`{u:real^3}`][DISJOINT;SET_RULE`{x} INTER {u}={} <=> ~(x=u)`;SET_RULE` {} SUBSET {w:real^3}`;] +THEN STRIP_TAC +THEN SUBGOAL_THEN `aff_ge {x} e INTER aff_ge {x} {ua, w} SUBSET aff_ge {x} {u} INTER aff_ge {x} {ua, w:real^3}`ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]; +MRESA_TAC properties_inside_collinear1_fan[`x:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]]]);; + + + + + + + +let inequality1_not0_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) d:real a:real. +FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) /\ &0 < d +/\ &0 +?(h:real). a (!(s:real). &0 <= s /\ s <= &1 +==> s * inv(norm((&1-s)%v+s%((&1-t)%u+ t%w)-x))* norm( ((&1-a)%u + a %w)-((&1-t)%u+ t%w))< d ))`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`((&1-a)%u + a %w)-((&1-t)%u+ t%w)=(t-a)%(u-w):real^3`;NORM_MUL] +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;` (w:real^3)`]separate_point_convex_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN EXISTS_TAC`min (a+(h:real)*(d:real) *inv(norm(u-w:real^3))) (&1)` +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] remark1_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`u:real^3`;`w:real^3`]imp_norm_gl_zero_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(h:real)*(d:real)`;`inv(norm(u-w:real^3))`] REAL_LT_MUL) +THEN RESA_TAC +THEN STRIP_TAC +THENL[ +MP_TAC(ISPECL[`h:real`;`d:real`] REAL_LT_MUL) +THEN RESA_TAC +THEN ASM_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ +REAL_ARITH_TAC; +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 <(h:real)==> ~(h= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(h:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`(t:real)< min (a+(h:real) * (d:real) * inv (norm (u - w:real^3))) (&1)/\ min (a+h * d * inv (norm (u - w))) (&1)<= &1 /\ &0 &0 <= t /\ t <= &1 /\ &0 <= t-a /\ t - a<= &1/\ (t:real)-a < (h * d * inv (norm (u - w:real^3)))`) +THEN ASM_REWRITE_TAC[REAL_ARITH`min (a+h * d * inv (norm (u - w))) (&1)<= &1`] +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3) `;`(w:real^3) `;`(t:real) `;`s:real`]expansion_convex_fan) +THEN RESA_TAC +THEN REMOVE_THEN "A"(fun th -> MP_TAC(ISPEC`(&1-s)%v+s%((&1-t)%u+ t%w):real^3`th)) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`h:real`;`norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)`]REAL_LT_INV2) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 &0 <= norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)`REAL_LE_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`t-a:real`REAL_ABS_REFL) +THEN RESP_TAC +THEN MP_TAC(ISPECL[`inv(norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3))`; +`inv(h:real)`;`t:real-a`;`(h * d * inv (norm (u - w:real^3)))`;]REAL_LT_MUL2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`u:real^3`;`w:real^3`]imp_norm_not_zero_fan) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(norm(u-w:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`u-w:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(&0 =norm(u-w:real^3)) /\ &0 <= norm(u-w:real^3)==> &0 GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REDUCE_ARITH_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A*B*C=(A*B)*C:real`;VECTOR_ARITH`(&1 - s) % v + s % ((&1 - t) % u + t % w) - x=((&1 - s) % v + s % ((&1 - t) % u + t % w))- x :real^3`]; +MP_TAC(REAL_ARITH`~(s= &1) /\ s<= &1==> (s:real)< &1`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`s:real`;`&1`;`(inv (norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3))*(t-a:real)) * norm(u-w:real^3)`; +`d:real`]REAL_LT_MUL2) +THEN REDUCE_ARITH_TAC +THEN RESA_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A*d*B*C=A*(d*B)*C:real`;VECTOR_ARITH`(&1 - s) % v + s % ((&1 - t) % u + t % w) - x=((&1 - s) % v + s % ((&1 - t) % u + t % w))- x :real^3`]]]]);; + + + +let bounded_convex1_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) w:real^3. +FAN(x,V,E) /\ {v,u} IN E /\ {u,w} IN E +==> ?(h:real). &0< h /\ (!(y:real^3). y IN convex hull{v,u,w} ==> norm(y-x) REWRITE_TAC[th;]) +THEN DISCH_TAC +THEN ASSUME_TAC(ISPEC`x:real^3` norm_origin_fan ) +THEN ASSUME_TAC(SET_RULE`convex hull {(v:real^3), u,w} SUBSET (:real^3)`) +THEN MP_TAC(ISPECL[`(\(y:real^3). lift(norm(y-x:real^3)))`;`(:real^3)`;`convex hull {(v:real^3),(u:real^3),w}`]CONTINUOUS_ON_SUBSET) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(\(y:real^3). lift(norm(y-x:real^3)))`;`convex hull {(v:real^3),(u:real^3),w}`]COMPACT_CONTINUOUS_IMAGE) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[COMPACT_EQ_BOUNDED_CLOSED;bounded;IMAGE;IN_ELIM_THM] +THEN ONCE_REWRITE_TAC[TAUT`A/\B<=>B/\A`;] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN SUBGOAL_THEN `(?x':real^3. x' IN convex hull {v, u,w} /\ + lift (norm (v - x:real^3)) = lift (norm (x' - x)))`ASSUME_TAC +THENL[ +EXISTS_TAC`v:real^3` +THEN SIMP_TAC[CONVEX_HULL_3; IN_ELIM_THM;] +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC; +SUBGOAL_THEN `&0< (a:real)` ASSUME_TAC +THENL[ +REMOVE_THEN "A" (fun th-> MP_TAC(ISPEC`lift (norm (v - (x:real^3)))`th)) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NORM_LIFT;REAL_ABS_NORM ] +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] remark1_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_not_zero_fan) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`v-x:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(&0 =norm(v-x:real^3)) /\ &0 <= norm(v-x:real^3)==> &0 MP_TAC(ISPEC`lift (norm (y - x:real^3))`th)) +THEN ASM_REWRITE_TAC[NORM_LIFT;REAL_ABS_NORM ] +THEN ASM_TAC +THEN REAL_ARITH_TAC]; + +ASM_TAC +THEN REAL_ARITH_TAC]]]]);; + + +let inequaility2_not0_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) d:real a:real. +FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) /\ &0 < d +/\ &0 +?(h:real). a (!(s:real). &0 <= s /\ s <= &1 +==> (norm(inv(norm((&1-s)%v+s%((&1-a)%u+ a%w)-x))%((&1-s)%v+s%((&1-a)%u+ a%w)-x) - inv(norm((&1-s)%v+s%((&1-t)%u+ t%w)-x))% ((&1-s)%v+s%((&1-a)%u+ a%w)-x)))< d ))`, + +REWRITE_TAC[VECTOR_ARITH`A%B-C%B=(A-C)%B`;NORM_MUL] +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`u-((&1-t)%u+ t%w)=t%(u-w):real^3`;NORM_MUL] +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;` (w:real^3)`]separate_point_convex_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3) `;`(w:real^3)`]origin_point_not_in_convex_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"B") +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`w:real^3`]bounded_convex1_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"C") +THEN EXISTS_TAC`min (a+h*h*(inv (h'))* inv(norm(u-w:real^3))*d:real) (&1)` +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] remark1_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`u:real^3`;`w:real^3`]imp_norm_not_zero_fan) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`u-w:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(&0 =norm(u-w:real^3)) /\ &0 <= norm(u-w:real^3)==> &0 ~(h= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(h:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 <(h':real)==> ~(h'= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(h':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`norm (u-w:real^3)`REAL_LE_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`norm (u-w:real^3)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(h:real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 &0 <= inv(h)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(h':real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 &0 <= inv(h')`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 &0 <= a/\ a <= &1`) +THEN RESA_TAC +THEN STRIP_TAC +THENL(*1*)[ +MP_TAC(ISPECL[`(h:real)`;`inv (h':real) `]REAL_LT_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(h:real)`;`(h:real)*inv (h':real) `]REAL_LT_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(h:real)*(h:real)*inv (h':real)`;`inv(norm(u-w:real^3))`]REAL_LT_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(h:real)*(h:real)*inv (h':real) *inv(norm(u-w:real^3))`;`d:real`]REAL_LT_MUL) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`a:real < &1 ` +THEN REAL_ARITH_TAC;(*1*) + +STRIP_TAC +THENL(*2*)[ +REAL_ARITH_TAC;(*2*) +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3)`;`w:real^3`;`a:real`;` s:real`]expansion_convex_fan) +THEN RESA_TAC +THEN REMOVE_THEN "C"(fun th->MP_TAC(ISPEC`(&1 - s) % v + s % ((&1 - a) % u + a % w):real^3`th)) +THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] +THEN RESA_TAC +THEN SUBGOAL_THEN`~(x=(&1 - s) % v + s % ((&1 - a) % u + a % w):real^3)` ASSUME_TAC +THENL(*3*)[ +ASM_TAC THEN SET_TAC[];(*3*) +MP_TAC(ISPECL[`(&1 - s) % v + s % ((&1 - a) % u + a % w):real^3`;`x:real^3`]imp_norm_not_zero_fan) +THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`(&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)= &0) /\ &0 <= norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)==> &0 &0<= t-a /\ &0<= t /\ t<= &1/\ (t:real)-a< (h * h * inv h' * inv (norm (u - w:real^3)) * d) `) +THEN ASM_REWRITE_TAC[REAL_ARITH`min (a+h * h * inv h' * inv (norm (u - w:real^3)) * d) (&1)<= &1`] +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x:real^3) `; +`(h':real)`;`t-a:real`;`(h * h * inv h' * inv (norm (u - w:real^3)) * d)`;]REAL_LT_MUL2) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &0/\ &0<= &1`] +THEN USE_THEN "A" (fun th-> MP_TAC(ISPEC`((&1 - s) % v + s % ((&1 - a) % u + a % w):real^3)`th)) +THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`h:real`;`norm ((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)`]REAL_LT_INV2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)`;`t-a:real`]REAL_LE_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv(norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x:real^3))`;`inv(h:real)`;`norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x:real^3)*(t:real-a)`;`(h':real)*(h * h * inv h' * inv (norm (u - w:real^3)) * d)`;]REAL_LT_MUL2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3) `;`(w:real^3) `;`(t:real) `;`s:real`]expansion_convex_fan) +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN USE_THEN "A" (fun th-> MP_TAC(ISPEC`(&1 - s) % v + s % ((&1 - t) % u + t % w):real^3`th)) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th; VECTOR_ARITH`(A+B)-C=A+B-C:real^3`]) +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`h:real`;`norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`]REAL_LT_INV2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv(norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3))`;`norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)*(t-a:real)`]REAL_LE_MUL) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`NORM_POS_LE) +THEN MP_TAC(ISPEC`norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`REAL_LE_INV) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv(norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3))`;`inv(h:real)`;`inv(norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x:real^3)) * norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x:real^3)*(t-a:real)`;`inv(h:real)*(h':real)*(h * h * inv h' * inv (norm (u - w:real^3)) * d)`;]REAL_LT_MUL2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`norm (u - w:real^3)`; +`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3)) * + inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)) * + norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x) * + (t-a)`;`inv h * inv h * h' * h * h * inv h' * inv (norm (u - w:real^3)) * d`;]REAL_LT_LMUL) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(B*C)*E*A*D`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(A*B)*E*(C*D)`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(A*B)*E*(C*D)`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D=(A*B)*C*D`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(A*B)*(C*D)*E`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`(A*B*C)*D*E=A*B*(C*D)*E`] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B*C)*D=A*B*(C*D)`] +THEN REDUCE_ARITH_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`((A*B)*C*D)*E=(A*C)*(B*D)*E`] +THEN REDUCE_ARITH_TAC +THEN REWRITE_TAC[REAL_ARITH`((A*B)*C)*D*E=(A*B)*(C*D)*E`] +THEN ASSUME_TAC(ISPECL[`u:real^3`;`w:real^3`]NORM_SUB) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN MP_TAC(ISPECL[`t-a:real`;`w-u:real^3`]NORM_MUL) +THEN MP_TAC(ISPEC`t-a:real`REAL_ABS_REFL) +THEN RESP_TAC +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN ASM_REWRITE_TAC[REAL_ARITH`(A*B)*C*D=C*A*(B*D)`] +THEN REDUCE_ARITH_TAC +THEN DISCH_THEN(LABEL_TAC"BA") +THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3) `;`(w:real^3) `;`(t:real) `;`s:real`]expansion_convex_fan) +THEN RESA_TAC +THEN SUBGOAL_THEN`~(x=(&1 - s) % v + s % ((&1 - t) % u + t % w):real^3)` ASSUME_TAC +THENL(*4*)[ +POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"MA") +THEN STRIP_TAC +THEN REMOVE_THEN"MA" MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN ASM_REWRITE_TAC[];(*4*) +MP_TAC(ISPECL[`(&1 - s) % v + s % ((&1 - t) % u + t % w):real^3`;`x:real^3`]imp_norm_not_zero_fan) +THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] +THEN RESA_TAC +THEN MP_TAC(ISPECL[`norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)`;`norm((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`]REAL_SUB_INV) +THEN RESP_TAC +THEN ASM_REWRITE_TAC[REAL_ABS_ABS;REAL_ABS_DIV;REAL_ABS_MUL;REAL_ABS_NORM;real_div;REAL_INV_MUL; +REAL_ARITH`(A*B*C)*D=A*C*(B*D)`] +THEN REDUCE_ARITH_TAC +THEN MP_TAC(ISPECL[`((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`;`((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)`]REAL_ABS_SUB_NORM) +THEN REWRITE_TAC[VECTOR_ARITH` +((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)-((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)=s%(t-a)%(w-u) :real^3`] +THEN ONCE_REWRITE_TAC[NORM_MUL] +THEN MP_TAC(ISPEC`s:real`REAL_ABS_REFL) +THEN RESP_TAC +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`abs + (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3) - + norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x))`;`s * norm ((t-a) % (w - u):real^3)`;`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3))`]REAL_LE_RMUL) +THEN RESA_TAC +THEN REMOVE_THEN "BA" MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(s= &1)\/ ~((s:real) = &1)`) +THENL(*5*)[ +ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*5*) + +MP_TAC(REAL_ARITH`~(s= &1) /\ s<= &1==> (s:real)< &1`) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`((t-a) % (w - u):real^3)`NORM_POS_LE) +THEN MP_TAC(ISPECL[`norm ((t-a) % (w - u):real^3)`;`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3))`]REAL_LE_MUL) +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`s:real`;`&1`;`norm ((t-a) % (w - u)) * + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3))`; +`d:real`]REAL_LT_MUL2) +THEN REDUCE_ARITH_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]]]]);; + + +let exists_point_small_edges_not0_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) d:real a:real. +FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) /\ &0 < d +/\ &0 +?(h:real). a (!(s:real). &0 <= s /\ s <= &1 +==> norm(inv(norm((&1-s)%v+s%((&1-a)%u+ a%w)-x))%((&1-s)%v+s%((&1-a)%u+ a%w)-x) - inv(norm((&1-s)%v+s%((&1-t)%u+ t%w)-x))% ((&1-s)%v+s%((&1-t)%u+ t%w)-x))< d ))`, + +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0< (d:real)==> &0< d/ &2`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3) `;`(w:real^3)`]origin_point_not_in_convex_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3) `;`(w:real^3)`;` (d:real)/ &2`;`a:real`]inequaility2_not0_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool) `;`(v:real^3)`;` (u:real^3)`;` (w:real^3)`;` (d:real)/ &2`;`a:real`]inequality1_not0_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"B") +THEN EXISTS_TAC`min (h:real) (h':real)` +THEN STRIP_TAC +THENL[ASM_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ +ASM_TAC +THEN REAL_ARITH_TAC; +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`t< min (h:real) (h':real)==> t< (h:real) /\ t< (h':real)`) +THEN RESA_TAC +THEN REMOVE_THEN"B" (fun th-> MP_TAC(ISPEC`t:real`th)) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`s:real`th)) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"B") +THEN REMOVE_THEN"A" (fun th-> MP_TAC(ISPEC`t:real`th)) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`s:real`th)) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN ASSUME_TAC(ISPEC`((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`NORM_POS_LE) +THEN MP_TAC(ISPEC`norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`REAL_LE_INV) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`s * + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3)):real`;`(((&1 - a) % u + a % w) - ((&1 - t) % u + t % w)):real^3`]NORM_MUL) +THEN REWRITE_TAC[REAL_ABS_MUL] +THEN MP_TAC(ISPEC`s:real`REAL_ABS_REFL) +THEN RESP_TAC +THEN MP_TAC(ISPEC`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3)):real`REAL_ABS_REFL) +THEN RESP_TAC +THEN REWRITE_TAC[REAL_ARITH`(A*B)*C=A*B*C`] +THEN DISCH_TAC +THEN REMOVE_THEN"B"MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN REWRITE_TAC[VECTOR_ARITH`(s * inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x))) % + (((&1 - a) % u + a % w) - ((&1 - t) % u + t % w))= inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3`] + +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`norm(inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3)`;`(d:real)/ &2`; +`norm + (inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x) - + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x):real^3)`;`(d:real)/ &2`; +]REAL_LT_ADD2) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`d / &2 + d/ &2 = d`] +THEN MP_TAC(ISPECL[`(inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3)`; +`(inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x) - + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x):real^3)`]NORM_TRIANGLE) +THEN REWRITE_TAC[VECTOR_ARITH`(inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3)+ +(inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x) - + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x):real^3)=(inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x) - + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) `] +THEN REAL_ARITH_TAC]]);; + + +let separate1_sphere_not0_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) (v1:real^3) (u1:real^3) a:real. + +FAN(x,V,E) /\ {v,u} INTER {v1,u1}={} /\ {v,u} IN E/\ {u,w} IN E /\ {v1,u1} IN E +/\ ~(coplanar{x,v,u,w}) +/\ (&0< azim x u w v ) /\ (azim x u w v +?h:real. +(a < h) /\ (h<= &1) +/\ +(!t:real. a aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge {x} {v1, u1} INTER ballnorm_fan x={})`, +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC exist_close1_fan[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`w:real^3`;`(v1:real^3)`;` (u1:real^3)`;`a:real`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THA") +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`;] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A" ) +THEN MRESA_TAC exists_point_small_edges_not0_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(v:real^3)`;`(u:real^3) `;`(w:real^3)`;`h:real`;`a:real`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"B" ) +THEN EXISTS_TAC`min (a+((h'-a:real)/ &2)) (&1:real)` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*1*)[ +MP_TAC(REAL_ARITH`a< h':real==> &0< (h'-a)/ &2`) +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC`a:real< &1` +THEN REAL_ARITH_TAC;(*1*) +STRIP_TAC +THENL(*2*)[ +ASM_TAC +THEN REAL_ARITH_TAC;(*2*) +REPEAT STRIP_TAC +THEN REWRITE_TAC[EXTENSION] +THEN GEN_TAC +THEN EQ_TAC +THENL(*3*)[ +STRIP_TAC +THEN REWRITE_TAC[EMPTY;IN_ELIM_THM] +THEN SUBGOAL_THEN `!y1:real^3. + y1 IN aff_gt {x} {v, (&1-t)%u+(t:real)% (w:real^3)} INTER ballnorm_fan x +==> ?y2:real^3. y2 IN aff_ge {x:real^3} {(v:real^3), ((&1 - a) % u + a % w:real^3)} INTER ballnorm_fan x /\ + dist (y1,y2)<(h:real)` ASSUME_TAC +THENL(*4*)[ +MP_TAC(REAL_ARITH`&0 &0 MP_TAC(ISPEC`a:real`th)) +THEN REMOVE_THEN"A" (fun th-> MP_TAC(ISPEC`t:real`th)) +THEN RESA_TAC +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MRESA_TAC same_projective_sphere_gt_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(v:real^3)`;`(u:real^3) `;`(w:real^3)`;` (t:real) `;`(y1:real^3)`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] +THEN MRESA_TAC AFF_GE_1_2[`(x:real^3)` ;` (v:real^3)`;`((&1 - a) % u + a % w:real^3) `;] +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;dist] +THEN MRESA_TAC expansion_convex_fan[`(v:real^3)`;` (u:real^3)`;`w:real^3`;`a:real`;` s:real`;] +THEN MRESA_TAC origin_point_not_in_convex_fan[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`w:real^3`] +THEN SUBGOAL_THEN`~(x=(&1-s)%v+s%((&1 - a) % u + a % w):real^3)` ASSUME_TAC +THENL(*5*)[ +POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN RESA_TAC;(*5*) +MP_TAC(ISPECL[`x:real^3`;`(&1 - s) % v + s % ((&1 - a) % u + a % w):real^3`]imp_norm_not_zero_fan) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[NORM_SUB] +THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`(&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(&0 =norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)) /\ &0 <= norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)==> &0 MP_TAC(ISPEC`t:real`th)) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`s:real`th)) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[NORM_SUB]](*6*)](*5*);(*4*) +POP_ASSUM (fun th->MP_TAC(ISPEC`x':real^3`th)) +THEN MP_TAC(SET_RULE` x' IN aff_gt {x} {v, (&1 - t) % u + t % w} INTER aff_ge {x} {v1, u1} INTER + ballnorm_fan x ==> x' IN aff_ge {x} {v1, u1:real^3} INTER ballnorm_fan x +/\ x' IN aff_gt {x} {v, (&1 - t) % u + t % w:real^3} INTER ballnorm_fan x`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN SIMP_TAC[] +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THA" (fun th-> MP_TAC(ISPECL[`y2:real^3`;`x':real^3`]th)) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN SIMP_TAC[dist;NORM_SUB] +THEN REAL_ARITH_TAC](*4*);(*3*) + +SET_TAC[]]]]);; + + + +let fan_run_in_small11_not0_is_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 v1:real^3 u1:real^3 a:real. +FAN(x,V,E) /\ {v,u} INTER {v1,u1}={} /\ {v,u} IN E/\ {u,w} IN E /\ {v1,u1} IN E +/\ ~(coplanar{x,v,u,w}) +/\ (&0< azim x u w v ) /\ (azim x u w v +?t1:real. a < t1 /\ t1 <= &1 +/\ (!t:real. a< t /\ t< t1 ==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v1,u1}={})`, + +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u1:real^3)`; +` (v1:real^3)`] +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`;] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"BA") +THEN MRESA_TAC separate1_sphere_not0_fan[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3)`;` (w:real^3)`;` (v1:real^3)`;`(u1:real^3)`;`a:real`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH` a < &1 /\ a < h ==> a < min (h:real) (&1:real)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH` h <= &1==> min (h:real) (&1:real)<= &1`) +THEN RESA_TAC +THEN EXISTS_TAC`min (h:real) (&1:real)` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH` &0< a /\ a < t /\ t< min (h:real) (&1:real)==> t< h /\ t<= &1 /\ &0 <= t/\ &0 MRESA1_TAC th `(t:real)`) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN REMOVE_THEN "BA"(fun th-> MRESA1_TAC th `(t:real)`) +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] +THEN MRESA_TAC origin_is_not_aff_gt_fan[`x:real^3`;`v:real^3`;`(&1-t)%u+t%w:real^3`] +THEN REWRITE_TAC[EXTENSION;INTER;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +REPEAT STRIP_TAC +THEN SUBGOAL_THEN`~(x=x':real^3)`ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; +MRESA_TAC imp_norm_not_zero_fan[`x':real^3`;`x:real^3`] +THEN ASSUME_TAC(ISPEC`x'-x:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(norm(x'-x:real^3)= &0) /\ &0 <= norm(x'-x:real^3)==> &0 MRESA_TAC th [`x':real^3`;`inv(norm(x'-x:real^3))`]) +THEN MRESA_TAC scale_aff_gt_fan[`x:real^3`;`v:real^3`;`(&1-t)%u+t%w:real^3`] +THEN POP_ASSUM(fun th -> MRESA_TAC th [`x':real^3`;`inv(norm(x'-x:real^3))`]) +THEN SUBGOAL_THEN`inv (norm (x' - x)) % (x' - x) + x IN ballnorm_fan x:real^3->bool` ASSUME_TAC +THENL[ +MRESA1_TAC REAL_ABS_REFL `inv(norm(x'-x:real^3))` +THEN ASM_REWRITE_TAC[ballnorm_fan;IN_ELIM_THM;dist;VECTOR_ARITH`B-(A+B)= --A:real^3`;NORM_NEG;NORM_MUL]; +ASM_TAC +THEN SET_TAC[]]]; + +SET_TAC[]]);; + + +let fan_run_in_small1_not0_is_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 v1:real^3 u1:real^3 a:real. +FAN(x,V,E) /\ {v,u} INTER {v1,u1}={} /\ {v,u} IN E/\ {u,w} IN E /\ {v1,u1} IN E +/\ ~(coplanar{x,v,u,w}) +/\ (&0< azim x u w v ) /\ (azim x u w v aff_gt {x} {v, (&1 - s) % u + s % w} INTER + {v | ?e. e IN E /\ v IN aff_ge {x} e} = + {}) +==> +(?t1:real. a < t1 /\ t1 <= &1 +/\ (!t:real. &0< t /\ t< t1 ==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v1,u1}={}))`, +REPEAT STRIP_TAC +THEN MRESA_TAC fan_run_in_small11_not0_is_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;` w:real^3`;`v1:real^3`;`u1:real^3`;`a:real`] +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN MP_TAC(REAL_ARITH`&0((&0 (&0bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 w1:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {v,w1} IN E +/\ ~coplanar {x,v,u,w} +/\ (&0< azim x u w v ) /\ (azim x u w v aff_gt {x} {v, (&1 - s) % u + s % w} INTER + {v | ?e. e IN E /\ v IN aff_ge {x} e} = + {}) +==> ?t1. a < t1 /\ t1<= &1 +/\ (!t:real. &0< t /\ t< t1==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v,w1}={})`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MAI MAI") +THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`;] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN DISJ_CASES_TAC(SET_RULE`(?h:real. a &0<=t`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`(t:real)< (h:real) /\ h <= &1 ==> t < &1`) +THEN RESA_TAC +THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `t:real`) +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (v:real^3)`] +THEN REWRITE_TAC[INTER;EXTENSION;IN_ELIM_THM;] +THEN GEN_TAC +THEN EQ_TAC +THENL(*4*)[ + +DISCH_TAC +THEN SUBGOAL_THEN `(&1-t)%u+t%w IN aff_ge {x,v} {w1}:real^3->bool` ASSUME_TAC +THENL(*5*)[ +POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-t)%u +t%w:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2 % v + t3 % ((&1 - t) % u + t % w) = + t1'' % x + t2' % v + t3' % w1<=> t3 % ((&1 - t) % u + t % w) = + (t1''-t1') % x + (t2'-t2) % v + t3' % w1:real^3`] +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`(t3:real)` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3 % ((&1 - t) % u + t % w) = (t1'-t1) % x + (t2'-t2) % v + t3' % w1:real^3 +==> (inv (t3))%(t3 % ((&1 - t) % u + t % w)) = (inv (t3))%((t1'-t1) % x + (t2'-t2) % v + t3' % w1)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;VECTOR_ARITH`A%(B%X+C%Y+D%Z)=(A*B)%X+(A*C)%Y+(A*D)%Z`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`t1' + t2' + t3' = &1:real` +THEN FIND_ASSUM MP_TAC`t1 + t2 + t3 = &1:real` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM(th)]) +THEN REWRITE_TAC[REAL_ARITH`t1'' + t2' + t3' = t1' + t2 + t3<=> (t1''-t1') + (t2'-t2) + t3' = t3:real`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +(t1'-t1) + (t2'-t2) + t3' = t3 +==> (inv (t3))*((t1'-t1) + (t2'-t2) + t3') = (inv (t3))*t3`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C+D)=A*B+A*C+A*D`] +THEN STRIP_TAC +THEN EXISTS_TAC`inv t3 * (t1' - t1):real` +THEN EXISTS_TAC`inv t3 * (t2' - t2):real` +THEN EXISTS_TAC`inv t3 * t3':real` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_INV +THEN ASM_TAC +THEN REAL_ARITH_TAC;(*5*) + +MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`;`(&1 - t) % u + t % w:real^3`;] +THEN MRESA_TAC injective_azim_coplanar[`x:real^3`;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th->MRESA_TAC th [`h:real`;`t:real`]) +THEN ASM_TAC +THEN REAL_ARITH_TAC](*5*)(*4*); +SET_TAC[]]]];(*1*) +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NOT_EXISTS_THM] +THEN DISCH_THEN(LABEL_TAC"B") +THEN EXISTS_TAC`&1:real` +THEN ASM_REWRITE_TAC[REAL_ARITH `&1<= &1`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 &0<=t`) +THEN RESA_TAC +THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `t:real`) +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (v:real^3)`] +THEN REWRITE_TAC[INTER;EXTENSION;IN_ELIM_THM;] +THEN GEN_TAC +THEN EQ_TAC +THENL(*2*)[ +DISCH_TAC +THEN SUBGOAL_THEN `(&1-t)%u+t%w IN aff_ge {x,v} {w1}:real^3->bool` ASSUME_TAC +THENL(*3*)[ +POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-t)%u +t%w:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2 % v + t3 % ((&1 - t) % u + t % w) = + t1'' % x + t2' % v + t3' % w1<=> t3 % ((&1 - t) % u + t % w) = + (t1''-t1') % x + (t2'-t2) % v + t3' % w1:real^3`] +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`(t3:real)` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3 % ((&1 - t) % u + t % w) = (t1'-t1) % x + (t2'-t2) % v + t3' % w1:real^3 +==> (inv (t3))%(t3 % ((&1 - t) % u + t % w)) = (inv (t3))%((t1'-t1) % x + (t2'-t2) % v + t3' % w1)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;VECTOR_ARITH`A%(B%X+C%Y+D%Z)=(A*B)%X+(A*C)%Y+(A*D)%Z`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`t1' + t2' + t3' = &1:real` +THEN FIND_ASSUM MP_TAC`t1 + t2 + t3 = &1:real` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM(th)]) +THEN REWRITE_TAC[REAL_ARITH`t1'' + t2' + t3' = t1' + t2 + t3<=> (t1''-t1') + (t2'-t2) + t3' = t3:real`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +(t1'-t1) + (t2'-t2) + t3' = t3 +==> (inv (t3))*((t1'-t1) + (t2'-t2) + t3') = (inv (t3))*t3`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C+D)=A*B+A*C+A*D`] +THEN STRIP_TAC +THEN EXISTS_TAC`inv t3 * (t1' - t1):real` +THEN EXISTS_TAC`inv t3 * (t2' - t2):real` +THEN EXISTS_TAC`inv t3 * t3':real` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_INV +THEN ASM_TAC +THEN REAL_ARITH_TAC;(*3*) +MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`;`(&1 - t) % u + t % w:real^3`;] +THEN REMOVE_THEN "B"(fun th -> MRESAL1_TAC th `t:real`[DE_MORGAN_THM; REAL_ARITH`~(A B MRESA1_TAC th `t:real`) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `{v,w1:real^3} IN E` +THEN SET_TAC[]; +REMOVE_THEN"MAI MAI" MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `{v,w1:real^3} IN E` +THEN SET_TAC[]; +ASM_TAC +THEN REAL_ARITH_TAC](*4*)]; +SET_TAC[]]]);; + + + + + + + + + +let fan_run_in_small3_not0_is_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 w1:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {u,w1} IN E +/\ ~coplanar {x,v,u,w} /\ sigma_fan x V E u w=v +/\ (&0< azim x u w v ) /\ (azim x u w v aff_gt {x} {v, (&1 - s) % u + s % w} INTER + {v | ?e. e IN E /\ v IN aff_ge {x} e} = + {}) +==> ?t1. a < t1 /\ t1 <= &1 +/\ (!t:real. &0< t /\ t< t1==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {u,w1}={})`, +REPEAT STRIP_TAC +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`;] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN EXISTS_TAC`&1:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1<= &1`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 &0<=t /\ ~(t= &0)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< &1 ==>t<= &1`) +THEN RESA_TAC +THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `t:real`) +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (u:real^3)`] +THEN REWRITE_TAC[EXTENSION;INTER;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL(*1*)[ +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-t)%u +t%w:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN `x' IN (aff_ge {x,u} {w1}:real^3->bool)`ASSUME_TAC +THENL(*2*)[ +POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`u:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`u:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`t1':real` +THEN EXISTS_TAC`t2':real` +THEN EXISTS_TAC`t3':real` +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC inequality3_aim_in_convex_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;` w:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `t:real`) +THEN POP_ASSUM(fun th-> MRESA_TAC th [`t1:real`;`t2:real`;`t3:real`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"BE") +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN SUBGOAL_THEN`~collinear {x, u, x':real^3}`ASSUME_TAC +THENL(*3*)[ +MRESA_TAC continuous_coplanar_fan [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `t:real`) +THEN ASM_REWRITE_TAC[collinear_fan;] +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[coplanar;aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN SUBGOAL_THEN`(x:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL(*4*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; + +SUBGOAL_THEN`(v:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; +SUBGOAL_THEN`(u:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL(*6*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; +SUBGOAL_THEN`((&1 - t) % u + t % w:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL(*7*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(t3:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + t2 % v + t3 % ((&1 - t) % u + t % w) = u' % x + v' % u +<=>t3 % ((&1 - t) % u + t % w) = (u'-t1') % x -t2 % v+v' % u:real^3`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3 % ((&1 - t) % u + t % w) = (u'-t1) % x -t2 % v+v' % u +==> (inv (t3))%(t3 % ((&1 - t) % u + t % w) ) = (inv (t3))%((u'-t1) % x -t2 % v+v' % u):real^3`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B-C+D)=A%B-A%C+A%D`;VECTOR_ARITH`A%B%C=(A*B)%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`(inv t3 * (u' - t1)):real` +THEN EXISTS_TAC`-- (inv t3 * t2):real` +THEN EXISTS_TAC`(inv t3 * v'):real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A+(--b)%C+d=A-b%C+d`;REAL_ARITH`inv t3 * (u' - t1') + --(inv t3 * t2) + inv t3 * v'=inv t3 * (t3+(u'+v') - (t1'+ t2+t3))`;REAL_ARITH`A+ &1- &1=A`];(*7*) + +ASM_TAC +THEN SET_TAC[]](*7*)](*6*)](*5*)](*4*);(*3*) + +MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`u:real^3`;`x':real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`u:real^3`;`x':real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`;`x':real^3`;] +THEN REMOVE_THEN"BE" MP_TAC +THEN REMOVE_THEN"YEU" MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN FIND_ASSUM MP_TAC`(sigma_fan x V E u w = (v:real^3))` +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge u V E = {w:real^3}) \/ ~(set_of_edge u V E = {w})`) +THENL(*4*)[ +FIND_ASSUM MP_TAC`w1 IN set_of_edge (u:real^3) V E` +THEN POP_ASSUM (fun th-> REWRITE_TAC[(th);IN_SING]) +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC (ISPECL[`x:real^3`;`u:real^3`;`w:real^3`]AZIM_REFL) +THEN REAL_ARITH_TAC;(*4*) + +DISJ_CASES_TAC(SET_RULE`(w1:real^3)=w \/ ~((w1:real^3)=w)`) +THENL(*5*)[ +ASM_REWRITE_TAC[] +THEN MP_TAC (ISPECL[`x:real^3`;`u:real^3`;`w:real^3`]AZIM_REFL) +THEN REAL_ARITH_TAC; +MRESA_TAC SIGMA_FAN[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(u:real^3)`;`(w:real^3)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w1:real^3`) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]]]; + +SET_TAC[]]);; + + + + + +let fan_run_in_small_not0_is_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 v1:real^3 w1:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {v1,w1} IN E +/\ (&0< azim x u w v ) /\ (azim x u w v aff_gt {x} {v, (&1 - s) % u + s % w} INTER + {v | ?e. e IN E /\ v IN aff_ge {x} e} = + {}) + +==> +?t1:real. a aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v1,w1}={})`, + + +(let lem=prove(`!x v v1. aff_ge {x} {v1, v}=aff_ge {x} {v, v1}`, +REPEAT STRIP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{v,u}={u,v}`] +THEN SIMP_TAC[]) in + +REPEAT STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN DISJ_CASES_TAC(SET_RULE`(v1=v)\/ ~(v1=v:real^3)`) +THENL[ +MRESA_TAC fan_run_in_small2_not0_is_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v1:real^3`;`u:real^3`;` w:real^3`;`w1:real^3`;`a:real`]; + +DISJ_CASES_TAC(SET_RULE`(v1=u)\/ ~(v1=u:real^3)`) +THENL[ +MRESA_TAC fan_run_in_small3_not0_is_fan[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` v1:real^3`;` w:real^3`;`w1:real^3`;`a:real`]; + DISJ_CASES_TAC(SET_RULE`(w1=v)\/ ~(w1=v:real^3)`) +THENL[ +FIND_ASSUM MP_TAC`{v1,w1} IN (E:(real^3->bool)->bool)` +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{v,u}={u,v}`] +THEN STRIP_TAC +THEN MRESA_TAC fan_run_in_small2_not0_is_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w1:real^3`;`u:real^3`;` w:real^3`;`v1:real^3`;`a:real`] +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[lem]; +DISJ_CASES_TAC(SET_RULE`(w1=u)\/ ~(w1=u:real^3)`) +THENL[ +FIND_ASSUM MP_TAC`{v1,w1} IN (E:(real^3->bool)->bool)` +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{v,u}={u,v}`] +THEN STRIP_TAC +THEN MRESA_TAC fan_run_in_small3_not0_is_fan[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` w1:real^3`;` w:real^3`;`v1:real^3`;`a:real`] +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[lem]; +SUBGOAL_THEN`{v,u} INTER {v1,w1:real^3}={}` ASSUME_TAC +THENL[ +ASM_TAC +THEN SET_TAC[]; +MRESA_TAC fan_run_in_small1_not0_is_fan[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;` w:real^3`;`v1:real^3`;`w1:real^3`;`a:real`]]]]]]));; + + +let fan_run1_in_small_not0_is_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) (E':(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ E' SUBSET E +/\ (&0< azim x u w v ) /\ (azim x u w v aff_gt {x} {v, (&1 - s) % u + s % w} INTER + {v | ?e. e IN E /\ v IN aff_ge {x} e} = + {}) +==> +?h:real. a aff_gt{x} {v,(&1-s)%u+ s % w} INTER {v | ?e. e IN E' /\ v IN aff_ge {x} e}={})`, + +REPEAT STRIP_TAC +THEN MRESA_TAC set_edges_is_finite_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC FINITE_SUBSET [`(E':(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`] +THEN ABBREV_TAC`n=CARD (E':(real^3->bool)->bool)` +THEN REPEAT(POP_ASSUM MP_TAC) +THEN SPEC_TAC (`(E':(real^3->bool)->bool)`,`(E':(real^3->bool)->bool)`) +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC +THENL(*1*)[ +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`E':(real^3->bool)->bool`]CARD_EQ_0) +THEN RESA_TAC +THEN EXISTS_TAC`a+ (&1-a:real) / &2` +THEN MP_TAC(REAL_ARITH`&0 a< a+ (&1-a:real) / &2/\ a+ (&1-a:real) / &2 <= &1`) +THEN RESA_TAC +THEN ASM_SET_TAC[];(*1*) + +REPEAT GEN_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC "A") +THEN REPEAT STRIP_TAC +THEN MP_TAC(ISPEC`(E':(real^3->bool)->bool)` CHOOSE_SUBSET) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`n:num `th)) +THEN REWRITE_TAC[ARITH_RULE `n:num <= SUC n`; HAS_SIZE] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` t SUBSET E' /\ E' SUBSET E ==> (t:(real^3->bool)->bool) SUBSET E`) +THEN RESA_TAC +THEN REMOVE_THEN "A" (fun th-> MP_TAC(ISPEC`(t:(real^3->bool)->bool)`th)) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN SUBGOAL_THEN `~((E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)= {})` ASSUME_TAC +THENL(*2*)[ +STRIP_TAC +THEN MP_TAC(SET_RULE`(E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)={} /\ t SUBSET E' ==> t= E'`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`CARD (t:(real^3->bool)->bool)=n` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC;(*2*) +SUBGOAL_THEN`?e. e IN (E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)` ASSUME_TAC +THENL(*3*)[ +ASM_SET_TAC[];(*3*) + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`e IN (E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)/\ +(E':(real^3->bool)->bool) SUBSET (E:(real^3->bool)->bool) /\ t SUBSET E' ==> e IN E'/\ e IN E/\ ~(e IN t) /\ {e} UNION t SUBSET E'`) +THEN RESA_TAC +THEN MP_TAC(ISPECL [`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;`(E':(real^3->bool)->bool)`] FINITE_SUBSET) +THEN RESA_TAC +THEN ASSUME_TAC(SET_RULE`e IN {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`) +THEN MP_TAC(ISPECL[`e:real^3->bool`;`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `e IN {e:(real^3->bool)} UNION (t:(real^3->bool)->bool) +==> ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e PSUBSET {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))DELETE e`;`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`]CARD_PSUBSET) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`FINITE ( {e:(real^3->bool)} UNION (t:(real^3->bool)->bool))` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN DISCH_TAC +THEN MP_TAC(ARITH_RULE`CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) < CARD ( {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) +/\ CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) = CARD ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))-1 +<=>CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) +1= CARD ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th;]) +THEN REWRITE_TAC[ARITH_RULE`A=A`; ] +THEN MP_TAC(SET_RULE`~(e IN t)==>({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e=t`) +THEN RESA_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`(CARD (E':(real^3->bool)->bool)=SUC n)` +THEN REWRITE_TAC[ARITH_RULE`SUC n=(n:num) +1`] +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;`E':(real^3->bool)->bool`]CARD_SUBSET_EQ) +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MA") +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`]expand_edge_graph_fan) +THEN RESA_TAC +THEN MRESA_TAC fan_run_in_small_not0_is_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w:real^3`;`v':real^3`;`w':real^3`;`a:real`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"BE") +THEN EXISTS_TAC` min (h:real) (t1:real)` +THEN STRIP_TAC +THENL(*4*)[ +ASM_TAC +THEN REAL_ARITH_TAC;(*4*) + +STRIP_TAC +THENL(*5*)[ +ASM_TAC +THEN REAL_ARITH_TAC;(*5*) +REPEAT STRIP_TAC +THEN REMOVE_THEN "MA" MP_TAC +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) +THEN REWRITE_TAC[UNION;IN_ELIM_THM;EXTENSION; INTER;] +THEN GEN_TAC +THEN EQ_TAC +THENL(*6*)[ +ASM_REWRITE_TAC[IN_SING] +THEN MP_TAC(REAL_ARITH`s< min h t1==> s MRESA1_TAC th `s:real`) +THEN ASM_SET_TAC[]; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th `s:real`) +THEN ASM_SET_TAC[]]; +SET_TAC[]]]]]]]);; + + + + + + + +let cut_in_edges_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ~(aff_gt{x} {v,(&1-a)%u+ a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={}) +==> a= &1 `, +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN ABBREV_TAC`s1={h:real| &0< h/\ h<= &1 /\ +~(aff_gt{x} {v,(&1-h)%u+ h % w:real^3} INTER {v | ?e. e IN E /\ v IN aff_ge {x:real^3} e}={})}` +THEN SUBGOAL_THEN`(a:real) IN (s1:real->bool)` ASSUME_TAC +THENL(*1*)[ +POP_ASSUM(fun th->ASM_REWRITE_TAC[SYM(th);IN_ELIM_THM]); + +MP_TAC(SET_RULE`(a:real) IN (s1:real->bool)==> ~(s1={})`) +THEN RESA_TAC +THEN SUBGOAL_THEN`(?b. !x:real. x IN s1 ==> b <= x)`ASSUME_TAC +THENL(*2*)[ +EXISTS_TAC`&0` +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th->ASM_REWRITE_TAC[SYM(th);IN_ELIM_THM]) +THEN REAL_ARITH_TAC; +MRESA1_TAC INF`s1:real->bool` +THEN ABBREV_TAC`b= inf (s1:real->bool)` +THEN SUBGOAL_THEN`b<= &1` ASSUME_TAC +THENL(*3*)[POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) +THEN ASM_TAC +THEN REAL_ARITH_TAC;(*3*) + +SUBGOAL_THEN`~(?s. &0 < s /\ s < b + /\ ~( aff_gt {x} {v, (&1 - s) % u + s % w} INTER + {v | ?e. e IN E /\ v IN aff_ge {x:real^3} e} = + {}))` ASSUME_TAC +THENL(*4*)[STRIP_TAC +THEN SUBGOAL_THEN`s IN (s1:real->bool)` ASSUME_TAC +THENL(*5*)[ EXPAND_TAC"s1" +THEN REWRITE_TAC[IN_ELIM_THM] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN REAL_ARITH_TAC;(*5*) +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th->MP_TAC(ISPEC`s:real` th)) +THEN DISCH_THEN (LABEL_TAC"DICH") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"DICH" MP_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC];(*4*) +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM NOT_IMP; GSYM NOT_FORALL_THM;IMP_IMP] +THEN STRIP_TAC +THEN MRESA_TAC fan_run_in_small_is_not_meet_xfan [`x:real^3`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;`u:real^3`;`w:real^3`] +THEN SUBGOAL_THEN`~(?x:real. x IN s1 /\ ~(h <= x))`ASSUME_TAC +THENL(*5*)[ +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN EXPAND_TAC"s1" +THEN REWRITE_TAC[IN_ELIM_THM; REAL_ARITH`~(A<=B)<=> B MRESA1_TAC th `x':real`);(*5*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM NOT_IMP; GSYM NOT_FORALL_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN`&0MP_TAC(ISPEC`h:real` th)) +THEN DISCH_THEN (LABEL_TAC"DICH") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"DICH" MP_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*6*) +MRESA_TAC not_cut_inside_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3` ;`b:real`] +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(b:real)< &1\/ &1 <= b`) +THENL(*7*)[ +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESAL_TAC fan_run1_in_small_not0_is_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`b:real`][SET_RULE`A SUBSET A`] +THEN SUBGOAL_THEN`~(?x:real. x IN s1 /\ ~(h' <= x))`ASSUME_TAC +THENL(*8*)[ +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN EXPAND_TAC"s1" +THEN REWRITE_TAC[IN_ELIM_THM; REAL_ARITH`~(A<=B)<=> B MRESA1_TAC th `x':real`);(*8*) +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM NOT_IMP; GSYM NOT_FORALL_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN `h':real <= b`ASSUME_TAC +THENL(*9*)[POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th->MP_TAC(ISPEC`h':real` th)) +THEN REWRITE_TAC[];(*9*) +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC](*9*)](*8*);(*7*) + +STRIP_TAC +THEN MP_TAC(REAL_ARITH`&1<=b /\ b<= &1==> b= &1`) THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th->MP_TAC(ISPEC`a:real` th)) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]]]]]]]);; + + + + + +let DHVFGBC=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ~(aff_gt{x} {v,(&1-a)%u+ a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={}) +==> a= &1 /\ independent {v - x, u - x, ((&1 - a) % u + a % w) - x}`, +MESON_TAC[independent_run_edges_fan;cut_in_edges_fan]);; + + +let not_cut_in_edges_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +==> (aff_gt{x} {v,(&1-a)%u+ a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={})`, + +REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(?a. &0< a /\ a< &1 /\ ~(aff_gt{x} {v,(&1-a)%u+ a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={})) \/ (!a. &0< a /\ a< &1 ==> (aff_gt{x} {v,(&1-a)%u+ a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x:real^3} e}={})) `) +THENL[ +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM BE") +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN ABBREV_TAC`s1={h:real| &0< h/\ h< &1 /\ +~(aff_gt{x} {v,(&1-h)%u+ h % w:real^3} INTER {v | ?e. e IN E /\ v IN aff_ge {x:real^3} e}={})}` +THEN SUBGOAL_THEN`(a':real) IN (s1:real->bool)` ASSUME_TAC +THENL(*1*)[ +POP_ASSUM(fun th->ASM_REWRITE_TAC[SYM(th);IN_ELIM_THM]); +MP_TAC(SET_RULE`(a':real) IN (s1:real->bool)==> ~(s1={})`) +THEN RESA_TAC +THEN SUBGOAL_THEN`(?b. !x:real. x IN s1 ==> b <= x)`ASSUME_TAC +THENL(*2*)[EXISTS_TAC`&0` +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th->ASM_REWRITE_TAC[SYM(th);IN_ELIM_THM]) +THEN REAL_ARITH_TAC;(*2*) +MRESA1_TAC INF`s1:real->bool` +THEN ABBREV_TAC`b= inf (s1:real->bool)` +THEN SUBGOAL_THEN`b< &1` ASSUME_TAC +THENL(*3*)[ +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `a':real`) +THEN ASM_TAC +THEN REAL_ARITH_TAC;(*3*) + SUBGOAL_THEN`~(?s. &0 < s /\ s < b + /\ ~( aff_gt {x} {v, (&1 - s) % u + s % w} INTER + {v | ?e. e IN E /\ v IN aff_ge {x:real^3} e} = + {}))` ASSUME_TAC +THENL(*4*)[ +STRIP_TAC +THEN SUBGOAL_THEN`s IN (s1:real->bool)` ASSUME_TAC +THENL(*5*)[EXPAND_TAC"s1" +THEN REWRITE_TAC[IN_ELIM_THM] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN REAL_ARITH_TAC;(*5*) +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th->MP_TAC(ISPEC`s:real` th)) +THEN DISCH_THEN (LABEL_TAC"DICH") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"DICH" MP_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC];(*4*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM NOT_IMP; GSYM NOT_FORALL_THM;IMP_IMP] +THEN STRIP_TAC +THEN MRESA_TAC fan_run_in_small_is_not_meet_xfan [`x:real^3`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;`u:real^3`;`w:real^3`] +THEN SUBGOAL_THEN`~(?x:real. x IN s1 /\ ~(h <= x))`ASSUME_TAC +THENL(*5*)[POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN EXPAND_TAC"s1" +THEN REWRITE_TAC[IN_ELIM_THM; REAL_ARITH`~(A<=B)<=> B MRESA1_TAC th `x':real`);(*5*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM NOT_IMP; GSYM NOT_FORALL_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN`&0MP_TAC(ISPEC`h:real` th)) +THEN DISCH_THEN (LABEL_TAC"DICH") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"DICH" MP_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*6*) +MRESA_TAC not_cut_inside_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3` ;`b:real`] +THEN MRESAL_TAC fan_run1_in_small_not0_is_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`b:real`][SET_RULE`A SUBSET A`] +THEN SUBGOAL_THEN`~(?x:real. x IN s1 /\ ~(h' <= x))`ASSUME_TAC +THENL(*7*)[ +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN EXPAND_TAC"s1" +THEN REWRITE_TAC[IN_ELIM_THM; REAL_ARITH`~(A<=B)<=> B MRESA1_TAC th `x':real`);(*7*) +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM NOT_IMP; GSYM NOT_FORALL_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN `h':real <= b`ASSUME_TAC +THENL(*8*)[POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th->MP_TAC(ISPEC`h':real` th)) +THEN REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]]]]]]]]; + +POP_ASSUM (fun th-> MRESA1_TAC th`a:real`)]);; + + + + + + + + + + + + + + + + + + + + + + + +end;; + + diff --git a/legacy/oldfan/DWWUTKW.hl b/legacy/oldfan/DWWUTKW.hl new file mode 100755 index 0000000..1498233 --- /dev/null +++ b/legacy/oldfan/DWWUTKW.hl @@ -0,0 +1,286 @@ + +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + + +module Dwwutkw = struct + + + +open Sphere;; +open Fan_defs;; +open Hypermap_of_fan;; +open Tactic_fan;; +open Lemma_fan;; +open Fan;; +open Hypermap_of_fan;; +open Node_fan;; +open Azim_node;; +open Sum_azim_node;; +open Disjoint_fan;; +open Lead_fan;; +open Fan_misc;; +open Leads_into_fan;; +open Fully_surrounded;; +open Sin_azim_cross_dot;; +open Leads_intos;; +open Hypermap;; +open Dartset_leads_into;; + + + + + + +let condition_not_edge_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 ds. +FAN(x,V,E) /\ v IN V /\ u IN V /\ ~collinear {x,v,u} +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ e1 IN E /\ e2 = {v, u} +/\ aff_gt {x} {v,u} SUBSET dartset_leads_into_fan x V E ds +==> ~(e1=e2)`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN STRIP_TAC +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;` (u:real^3)`] +THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`dartset_leads_into_fan x V E ds SUBSET yfan (x,V,E)/\ aff_gt {x} {v, u} SUBSET dartset_leads_into_fan x V E ds==> aff_gt {x} {v, u} SUBSET yfan (x:real^3,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan; SET_RULE`A SUBSET (:real^3) DIFF B <=> A INTER B={}`;] +THEN DISCH_TAC +THEN SUBGOAL_THEN`aff_ge {x} e1 SUBSET xfan(x:real^3,V:real^3->bool,E)` ASSUME_TAC +THENL[REWRITE_TAC[xfan;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC `e1:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC(`(e1:real^3->bool) IN E`) +THEN REWRITE_TAC[IN] +THEN ASM_REWRITE_TAC[]; +ASSUME_TAC(SET_RULE`aff_gt {x} {v, u} INTER + (aff_gt {x} {v, u} UNION aff_ge {x} {v} UNION aff_ge {x} {u}) +=aff_gt {x} {v, u} `) +THEN MP_TAC(SET_RULE`aff_gt {x:real^3} {v, u} INTER xfan (x,V:real^3->bool,E) = {}/\aff_ge {x} e1 SUBSET xfan (x,V,E) +==> aff_gt {x} {v, u} INTER aff_ge {x} e1={}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`] +THEN MATCH_MP_TAC exists_in_aff_gt +THEN ASM_REWRITE_TAC[]]);; + + + +let condition_not_intersection_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 ds e1:real^3->bool e2:real^3->bool. +FAN(x,V,E) /\ v IN V /\ u IN V /\ ~collinear {x,v,u} +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ aff_gt {x} {v,u} SUBSET dartset_leads_into_fan x V E ds +/\ e1 IN E /\ e2 = {v, u} +==>aff_ge {x} e1 INTER aff_ge {x} e2 = aff_ge {x} (e1 INTER e2)`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;` (u:real^3)`] +THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`dartset_leads_into_fan x V E ds SUBSET yfan (x,V,E)/\ aff_gt {x} {v, u} SUBSET dartset_leads_into_fan x V E ds==> aff_gt {x} {v, u} SUBSET yfan (x:real^3,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan; SET_RULE`A SUBSET (:real^3) DIFF B <=> A INTER B={}`;] +THEN DISCH_TAC +THEN SUBGOAL_THEN`aff_ge {x} e1 SUBSET xfan(x:real^3,V:real^3->bool,E)` ASSUME_TAC +THENL[ +REWRITE_TAC[xfan;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC `e1:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN SET_TAC[IN]; +MP_TAC(SET_RULE`aff_gt {x:real^3} {v, u} INTER xfan (x,V:real^3->bool,E) = {}/\aff_ge {x} e1 SUBSET xfan (x,V,E) +==> aff_gt {x} {v, u} INTER aff_ge {x} e1={}`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE` +aff_gt {x:real^3} {v, u} INTER aff_ge {x} e1={}==> +aff_ge {x} e1 INTER (aff_gt {x} {v, u} UNION aff_ge {x} {v} UNION aff_ge {x} {u}) += (aff_ge {x} e1 INTER aff_ge {x} {v}) UNION (aff_ge {x} e1 INTER aff_ge {x} {u})`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`e1 IN E==> e1 IN E UNION {{v:real^3} | v IN V}`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`v:real^3 IN V==> {v} IN E UNION {{v} | v IN V}`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`u:real^3 IN V==> {u} IN E UNION {{v} | v IN V}`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC(`FAN(x:real^3,V,E)`) +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th [`e1:real^3->bool`;`{v:real^3}`]THEN ASSUME_TAC th) +THEN POP_ASSUM(fun th-> MRESA_TAC th [`e1:real^3->bool`;`{u:real^3}`]) +THEN MRESA_TAC condition_not_edge_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN FIND_ASSUM MP_TAC (`graph (E:(real^3->bool)->bool)`) +THEN REWRITE_TAC[GRAPH] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL1_TAC th `e1:real^3->bool`[HAS_SIZE]) +THEN MRESA_TAC th3[`v:real^3`;`u:real^3`;`x:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MRESA_TAC properties_edges_eq_fan[`e1:real^3->bool`; `v:real^3`;`u:real^3`] +THENL[MP_TAC(SET_RULE`~(v IN e1)==> e1 INTER {v:real^3}={} /\ e1 INTER {v, u}=e1 INTER {u}`) +THEN RESA_TAC +THEN ASSUME_TAC(SET_RULE`{} SUBSET e1 INTER {u}:real^3->bool`) +THEN MP_TAC(SET_RULE`DISJOINT {v, u} {x:real^3}==> DISJOINT {x} (e1 INTER {u})`) +THEN RESA_TAC +THEN MRESA_TAC AFF_GE_MONO_RIGHT[`{x:real^3}`;`{}:real^3->bool`;`e1 INTER {u}:real^3->bool`] +THEN POP_ASSUM MP_TAC THEN SET_TAC[]; +MP_TAC(SET_RULE`~(u IN e1)==> e1 INTER {u:real^3}={} /\ e1 INTER {v, u}=e1 INTER {v}`) +THEN RESA_TAC +THEN ASSUME_TAC(SET_RULE`{} SUBSET e1 INTER {v}:real^3->bool`) +THEN MP_TAC(SET_RULE`DISJOINT {v, u} {x:real^3}==> DISJOINT {x} (e1 INTER {v})`) +THEN RESA_TAC +THEN MRESA_TAC AFF_GE_MONO_RIGHT[`{x:real^3}`;`{}:real^3->bool`;`e1 INTER {v}:real^3->bool`] +THEN POP_ASSUM MP_TAC THEN SET_TAC[]]]);; + + + + + +let condition_not_intersection_point_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 ds:real^3#real^3#real^3#real^3->bool e1:real^3->bool w:real^3. +FAN(x,V,E) /\ v IN V /\ u IN V /\ ~collinear {x,v,u} +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ aff_gt {x} {v,u} SUBSET dartset_leads_into_fan x V E ds +/\ w IN V /\ e1 = {v, u} +==>aff_ge {x} e1 INTER aff_ge {x} {w} = aff_ge {x} (e1 INTER {w})`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;` (u:real^3)`] +THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`dartset_leads_into_fan x V E ds SUBSET yfan (x,V,E)/\ aff_gt {x} {v, u} SUBSET dartset_leads_into_fan x V E ds==> aff_gt {x} {v, u} SUBSET yfan (x:real^3,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan; SET_RULE`A SUBSET (:real^3) DIFF B <=> A INTER B={}`;] +THEN DISCH_TAC +THEN SUBGOAL_THEN`aff_ge {x} {w} SUBSET xfan(x:real^3,V:real^3->bool,E)` ASSUME_TAC +THENL[ +REWRITE_TAC[xfan;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC exists_edge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` w:real^3`] +THEN EXISTS_TAC `{w,v'}:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v':real^3)`; +` (w:real^3)`] +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(w:real^3)`;` (v':real^3)`] +THEN ASM_TAC THEN SET_TAC[IN]; +MP_TAC(SET_RULE`aff_gt {x:real^3} {v, u} INTER xfan (x,V:real^3->bool,E) = {}/\aff_ge {x} {w} SUBSET xfan (x,V,E) +==> aff_gt {x} {v, u} INTER aff_ge {x} {w}={}`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE` +aff_gt {x:real^3} {v, u} INTER aff_ge {x} {w}={}==> +(aff_gt {x} {v, u} UNION aff_ge {x} {v} UNION aff_ge {x} {u}) INTER aff_ge {x} {w} += (aff_ge {x} {w} INTER aff_ge {x} {v}) UNION (aff_ge {x} {w} INTER aff_ge {x} {u})`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`w IN V==> {w} IN E UNION {{v:real^3} | v IN V}`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`v:real^3 IN V==> {v} IN E UNION {{v} | v IN V}`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`u:real^3 IN V==> {u} IN E UNION {{v} | v IN V}`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC(`FAN(x:real^3,V,E)`) +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th [`{w}:real^3->bool`;`{v:real^3}`]THEN ASSUME_TAC th) +THEN POP_ASSUM(fun th-> MRESA_TAC th [`{w}:real^3->bool`;`{u:real^3}`]) +THEN MRESA_TAC th3[`v:real^3`;`u:real^3`;`x:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(v=u:real^3)==> ({v, u} INTER {w}= {w} INTER {v} /\ {w} INTER {u}={}) \/ ({v, u} INTER {w}= {w} INTER {u} /\ {w} INTER {v}={})`) +THEN RESA_TAC +THENL[ ASSUME_TAC(SET_RULE`{} SUBSET {w} INTER {v}:real^3->bool`) +THEN MP_TAC(SET_RULE`DISJOINT {v, u} {x:real^3}==> DISJOINT {x} ({w} INTER {v})`) +THEN RESA_TAC +THEN MRESA_TAC AFF_GE_MONO_RIGHT[`{x:real^3}`;`{}:real^3->bool`;`{w} INTER {v}:real^3->bool`] +THEN POP_ASSUM MP_TAC THEN SET_TAC[]; +ASSUME_TAC(SET_RULE`{} SUBSET {w} INTER {u}:real^3->bool`) +THEN MP_TAC(SET_RULE`DISJOINT {v, u} {x:real^3}==> DISJOINT {x} ({w} INTER {u})`) +THEN RESA_TAC +THEN MRESA_TAC AFF_GE_MONO_RIGHT[`{x:real^3}`;`{}:real^3->bool`;`{w} INTER {u}:real^3->bool`] +THEN POP_ASSUM MP_TAC THEN SET_TAC[]]]);; + + + +let DWWUTKW=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 ds. +FAN(x,V,E) /\ v IN V /\ u IN V /\ ~collinear {x,v,u} +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ aff_gt {x} {v,u} SUBSET dartset_leads_into_fan x V E ds +/\ E1=E UNION {{v,u}} +==> FAN (x,V,E1)`, +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC`FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan1;fan2;fan6;fan7] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC th3[`v:real^3`;`u:real^3`;`x:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MRESA_TAC add_edge_graph_fan[`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC garph_add_edge_is_garph[`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC add_edge_into_collinear_fan[`x:real^3`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN REWRITE_TAC[UNION;IN_ELIM_THM;IN_SING] +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THENL[ REMOVE_THEN"YEU" (fun th-> MRESA_TAC th[`e1:real^3->bool`;`e2:real^3->bool`]) +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]; + +MRESA_TAC condition_not_intersection_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `ds:real^3#real^3#real^3#real^3->bool`;`e1:real^3->bool`;`e2:real^3->bool`]; + +REMOVE_THEN"YEU" (fun th-> MRESA_TAC th[`e1:real^3->bool`;`e2:real^3->bool`]) +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]; + +MRESA_TAC condition_not_intersection_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `ds:real^3#real^3#real^3#real^3->bool`;`e2:real^3->bool`;`e1:real^3->bool`] +THEN ASM_REWRITE_TAC[SET_RULE`A INTER B= B INTER A`]; + +ASM_REWRITE_TAC[SET_RULE`A INTER A=A`]; + +MRESA_TAC condition_not_intersection_point_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `ds:real^3#real^3#real^3#real^3->bool`;`e1:real^3->bool`;`v':real^3`]; + +REMOVE_THEN"YEU" (fun th-> MRESA_TAC th[`e2:real^3->bool`;`e1:real^3->bool`]) +THEN ASM_REWRITE_TAC[SET_RULE`A INTER B=B INTER A`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]; + +MRESA_TAC condition_not_intersection_point_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `ds:real^3#real^3#real^3#real^3->bool`;`e2:real^3->bool`;`v':real^3`] +THEN ASM_REWRITE_TAC[SET_RULE`A INTER B=B INTER A`]; + +REMOVE_THEN"YEU" (fun th-> MRESA_TAC th[`e1:real^3->bool`;`e2:real^3->bool`]) +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]]);; + + + + +end;; + + diff --git a/legacy/oldfan/IBZWFFH.hl b/legacy/oldfan/IBZWFFH.hl new file mode 100755 index 0000000..f718921 --- /dev/null +++ b/legacy/oldfan/IBZWFFH.hl @@ -0,0 +1,93 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + + +module Disjoint_fan = struct + + + +open Sphere;; +open Fan_defs;; +open Hypermap_of_fan;; +open Tactic_fan;; +open Lemma_fan;; +open Fan;; +open Hypermap_of_fan;; +open Node_fan;; +open Azim_node;; +open Sum_azim_node;; + + + + +(* ========================================================================== *) +(* DISJOINT IN FAN *) +(* ========================================================================== *) + +let disjiont_union_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (w1:real^3). +FAN(x,V,E)/\ ({v,w}IN E) /\ ({v,w1}IN E) +==> + w_dart_fan x V E (x,v,w,(sigma_fan x V E v w)) INTER + (aff{x,v} UNION aff_gt {x,v} {w1})={}`, + +REPEAT STRIP_TAC THEN REWRITE_TAC[UNION_OVER_INTER] + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;` (w1:real^3)`] disjoint_set_fan) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;] disjoint_fan1) THEN ASM_REWRITE_TAC[] + THEN ASM_SET_TAC[]);; + + + +let aff_ge_subset_aff_gt_union_aff=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3). +FAN(x,V,E)/\ {v,w} IN E +==> +aff_ge {x} {v , w} SUBSET (aff_gt {x , v} {w}) UNION (aff {x, v})`, + +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`;` (v:real^3)`] remark1_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GE_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GT_2_1) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`]affine_hull_2_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[SUBSET; UNION;IN_ELIM_THM] + THEN GEN_TAC THEN +REWRITE_TAC[REAL_ARITH `(&0 <= (t3:real)) <=> (&0 < t3) \/ ( t3 = &0)`; TAUT `(a \/ b) /\ (c \/ d) /\ e /\ f <=> ((a \/ b)/\ c /\ e /\ f) \/ ((a \/ b) /\ d /\ e /\ f)`; EXISTS_OR_THM] THEN +MATCH_MP_TAC MONO_OR THEN +SUBGOAL_THEN `((?t1:real t2:real t3:real. + (&0 < t2 \/ t2 = &0) /\ + &0< t3 /\ + t1 + t2 + t3 = &1 /\ + (x':real^3) = t1 % x + t2 % v + t3 % w) + ==> (?t1 t2 t3. + &0< t3 /\ t1 + t2 + t3 = &1 /\ x' = t1 % x + t2 % v + t3 % w))` ASSUME_TAC +THENL +[MESON_TAC[]; + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC MONO_EXISTS THEN GEN_TAC THEN MATCH_MP_TAC MONO_EXISTS THEN GEN_TAC THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN GEN_TAC THEN + REWRITE_TAC[REAL_ARITH `(&0< (t2:real) \/ (t2 = &0)) <=> ( &0<= t2)`] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC [REAL_ARITH `(a:real)+ &0 = a`; VECTOR_ARITH `&0 % (w:real^3) = vec 0`; + VECTOR_ARITH ` ((x':real^3) = (t1:real) % (x:real^3) + (t2:real) % (v:real^3) + vec 0)<=> ( x' = t1 % x + t2 % v )` ] + THEN MESON_TAC[]]);; + + +let IBZWFFH=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (w1:real^3). +FAN(x,V,E)/\ ({v,w}IN E) /\ ({v,w1}IN E) +==> + w_dart_fan x V E (x,v,w,(sigma_fan x V E v w)) INTER +aff_ge {x} {v , w1}={}`, +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w1:real^3)`] aff_ge_subset_aff_gt_union_aff) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;`w:real^3`;` (w1:real^3)`] disjiont_union_fan) + THEN ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]);; + + + +end;; diff --git a/legacy/oldfan/JBDNJJB.hl b/legacy/oldfan/JBDNJJB.hl new file mode 100755 index 0000000..3948918 --- /dev/null +++ b/legacy/oldfan/JBDNJJB.hl @@ -0,0 +1,102 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + + +module Sin_azim_cross_dot= struct + + + +open Sphere;; +open Tactic_fan;; +open Lemma_fan;; + + + +let JBDNJJB=prove(`!u:real^3 v:real^3 w:real^3. +~collinear {vec 0, u, v} /\ ~collinear {vec 0, u, w} +==> +?t:real. &0< t /\ sin(azim (vec 0) u v w)=t *(u cross v) dot w`, + +REPEAT STRIP_TAC +THEN MRESA_TAC th3[`((vec 0):real^3)`;` (u:real^3)`;` (v:real^3)`] +THEN MRESA_TAC properties_coordinate[`((vec 0):real^3)`;` (u:real^3)`;` (v:real^3)`] +THEN MRESA_TAC azim[`((vec 0):real^3)`;` (u:real^3)`;` (v:real^3)`;`(w:real^3)`] +THEN POP_ASSUM (fun th->MRESA_TAC th [`e1_fan ((vec 0):real^3) (u:real^3) (v:real^3)`;`e2_fan ((vec 0):real^3) (u:real^3) (v:real^3)`;`e3_fan ((vec 0):real^3) (u:real^3) (v:real^3)`]) +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"YEU EM") +THEN DISCH_TAC THEN DISCH_TAC +THEN MRESA_TAC sincos1_of_u_fan[`((vec 0):real^3)`;` (u:real^3)`;` (v:real^3)`;`r1:real`; `psi:real`; `h1:real`] +THEN REMOVE_THEN "YEU EM" MP_TAC +THEN ASM_REWRITE_TAC[COS_ADD;SIN_ADD;] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`w = + (r2 * cos (azim (vec 0) u v w)) % e1_fan (vec 0) u v + + (r2 * sin (azim (vec 0) u v w)) % e2_fan (vec 0) u v + + h2 % u ==> +(u cross v) dot w = +(u cross v) dot ((r2 * cos (azim (vec 0) u v w)) % e1_fan (vec 0) u v + + (r2 * sin (azim (vec 0) u v w)) % e2_fan (vec 0) u v + + h2 % u)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[DOT_LADD; DOT_RADD; DOT_LMUL; DOT_RMUL;DOT_CROSS_SELF; e2_fan;e1_fan;e3_fan; +VECTOR_ARITH`A- vec 0= A`;CROSS_LADD; CROSS_RADD; CROSS_LMUL; CROSS_RMUL;CROSS_REFL;CROSS_RNEG;CROSS_LNEG;] +THEN REDUCE_ARITH_TAC +THEN REWRITE_TAC[NORM_MUL;REAL_INV_MUL; REAL_ABS_INV;REAL_INV_INV;REAL_ABS_NORM;DOT_SQUARE_NORM +;REAL_ARITH`(r2 * sin (azim (vec 0) u v w)) * + (norm u * inv (norm (u cross v))) * + inv (norm u) * + norm (u cross v) pow 2 =(r2* norm(u cross v)) * sin (azim (vec 0) u v w) * + ( inv (norm u) * norm u)* +( inv (norm (u cross v))* norm (u cross (v:real^3)))` +] +THEN MP_TAC(ISPECL[`u:real^3`;`(vec 0) :real^3`]imp_norm_not_zero_fan) +THEN REDUCE_VECTOR_TAC +THEN RESA_TAC +THEN MP_TAC(ISPEC`(norm(u:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`u:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(&0 =norm(u:real^3)) /\ &0 <= norm(u:real^3)==> &0 &0 ~((r2:real)*norm(u cross v:real^3)= &0)`) +THEN REDUCE_VECTOR_TAC +THEN RESA_TAC +THEN MP_TAC(ISPEC`(r2 * norm(u cross v:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(r2 * norm(u cross v:real^3))`REAL_LT_INV) +THEN RESA_TAC +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(u cross v) dot w = (r2 * norm (u cross v)) * sin (azim (vec 0) u v w) ==> +inv (r2 * norm (u cross v))*(r2 * norm (u cross v)) * sin (azim (vec 0) u v w)= inv (r2 * norm (u cross v)) *((u cross v) dot w)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (r2 * norm (u cross v)) * (r2 * norm (u cross v)) * + sin (azim (vec 0) u v w)=(inv (r2 * norm (u cross v)) * (r2 * norm (u cross v)))* + sin (azim (vec 0) u v w)`] +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`inv (r2 * norm (u cross v)):real` +THEN ASM_REWRITE_TAC[]]);; + + +end;; diff --git a/legacy/oldfan/JGIYDLE.hl b/legacy/oldfan/JGIYDLE.hl new file mode 100755 index 0000000..c20e7a0 --- /dev/null +++ b/legacy/oldfan/JGIYDLE.hl @@ -0,0 +1,1638 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + + +module Lead_fan = struct + + + +open Sphere;; +open Fan_defs;; +open Hypermap_of_fan;; +open Tactic_fan;; +open Lemma_fan;; +open Fan;; +open Hypermap_of_fan;; +open Node_fan;; +open Azim_node;; +open Sum_azim_node;; +open Disjoint_fan;; + +(* ========================================================================== *) +(* DISJOINT IN FAN *) +(* ========================================================================== *) + + + + +let exist_fan=prove(`(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (v1:real^3) (w1:real^3). + +FAN(x,V,E) /\ ~(v IN {v1,w1}) /\ {v1,w1} IN E /\ {v,w} IN E +==> +?h:real. +(&0 < h) +/\ +(!y1:real^3 y2:real^3. (y1 IN aff_ge {x} {v} INTER ballnorm_fan x) /\ y2 IN (aff_ge {x} {v1, w1} INTER ballnorm_fan x) +==> h <= dist(y1,y2) ))`, +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] remark1_fan) +THEN RES_TAC +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (v1:real^3)`] remark1_fan) +THEN RES_TAC +THEN MATCH_MP_TAC( ISPECL [`aff_ge {(x:real^3)} {(v:real^3)} INTER ballnorm_fan x`; + `aff_ge {(x:real^3)} {(v1:real^3), (w1:real^3)} INTER ballnorm_fan x`] SEPARATE_CLOSED_COMPACT) + THEN MP_TAC(ISPECL[`(x:real^3) `;` (v:real^3)`;` (w:real^3)`]closed_point_fan) +THEN RESA_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;` (v1:real^3)`;` (w1:real^3)`]compact_aff_ge_ballnorm_fan) THEN RESA_TAC + THEN FIND_ASSUM(MP_TAC)`FAN(x:real^3,V,E)` + THEN REWRITE_TAC[FAN;fan7] THEN STRIP_TAC + THEN POP_ASSUM(fun th-> MP_TAC(ISPECL[`{(v:real^3)}`;`{(v1:real^3),(w1:real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION; IN_ELIM_THM;] + THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[EXTENSION;] + THEN ASM_REWRITE_TAC[IN_SING; SET_RULE`(!x. x = v <=> x = v') <=> v =v'`;SET_RULE`(?v'. v' IN V /\ v = v')<=> v IN V`] + THEN SUBGOAL_THEN `{v:real^3} INTER {v1,w1} ={}` ASSUME_TAC +THENL[ +REWRITE_TAC[INTER;IN_SING; EXTENSION; EMPTY; IN_ELIM_THM] THEN ASM_SET_TAC[]; + +ASM_REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL; SET_RULE`(A INTER C) INTER (B INTER C)= (A INTER B) INTER C`;] +THEN ASSUME_TAC(AFFINE_SING) THEN MP_TAC(ISPEC`{ (x:real^3) }` AFFINE_HULL_EQ ) + THEN RESA_TAC THEN RESA_TAC THEN REWRITE_TAC[ballnorm_fan;INTER; IN_SING; EXTENSION;EMPTY;IN_ELIM_THM; +] THEN GEN_TAC THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[DIST_REFL ] THEN REAL_ARITH_TAC]);; + + + + +let ballsets_fan=new_definition`ballsets_fan (s:real^3->bool) (h:real)= {y:real^3| ?x:real^3. dist(x,y) < h /\ x IN s} `;; + + +let exists_ballsets_fan =prove( +`(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (v1:real^3) (w1:real^3). +FAN(x,V,E) /\ ~(v IN {v1,w1}) /\ {v1,w1} IN E /\ {v,w} IN E +==> +?h:real. +(&0 < h) +/\ (ballsets_fan (aff_ge {x} {v} INTER ballnorm_fan x) h INTER (aff_ge {x} {v1, w1} INTER ballnorm_fan x) = {}) +)`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;` (v1:real^3)`;` (w1:real^3)`] exist_fan) THEN RES_TAC + THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[ballsets_fan; INTER; IN_ELIM_THM] + THEN DISCH_TAC THEN EXISTS_TAC`h:real` + THEN ASM_REWRITE_TAC[EXTENSION;IN_ELIM_THM;] THEN GEN_TAC THEN EQ_TAC +THENL[ + POP_ASSUM MP_TAC + THEN DISCH_THEN(LABEL_TAC"a") + THEN STRIP_TAC THEN REMOVE_THEN "a"(fun th-> MP_TAC(ISPECL[`x'':real^3`;`x':real^3`]th)) +THEN ASM_REWRITE_TAC[EMPTY;IN_ELIM_THM] THEN REPEAT (POP_ASSUM MP_TAC) + THEN REAL_ARITH_TAC; +REWRITE_TAC[EMPTY;IN_ELIM_THM]]);; + + + + +(*-------------------------------------------------------------------------------------------*) +(* cone_ge_fan_inter_aff_ge_is_empty *) +(*-------------------------------------------------------------------------------------------*) + + + +let cone_ge_fan=new_definition`cone_ge_fan (x:real^3) (s:real^3->bool)= {y:real^3| ?a:real z:real^3. (&0 <= a)/\(z IN s) /\ (y =a % (z - x) + x)}`;; + + + + + +let cone_ge_fan_inter_aff_ge_is_empty=prove( +`(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (v1:real^3) (w1:real^3). +FAN(x,V,E) /\ ~(v IN {v1,w1}) /\ {v1,w1} IN E /\ {v,w} IN E +==> + +?h:real. +(h > &0) +/\ (cone_ge_fan x ((ballsets_fan (aff_ge {x} {v} INTER ballnorm_fan x) h)INTER ballnorm_fan x ) INTER aff_ge {x} {v1, w1} = {x}) +)`, + +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] remark1_fan) + THEN RES_TAC +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +`(v1:real^3)`] remark1_fan) + THEN RES_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`; +`(w:real^3)`;` (v1:real^3)`;` (w1:real^3)`] exists_ballsets_fan) +THEN ASM_REWRITE_TAC[] + THEN MATCH_MP_TAC MONO_EXISTS +THEN GEN_TAC THEN STRIP_TAC THEN STRIP_TAC +THENL(*1*)[ + +ASM_REWRITE_TAC[REAL_ARITH`a> &0 <=> &0< a`];(*1*) + REWRITE_TAC [cone_ge_fan; EXTENSION; IN_SING; INTER; IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC +THENL(*2*)[ + ASM_CASES_TAC `(x':real^3)=(x:real^3)` +THENL(*3*)[ASM_REWRITE_TAC[];(*3*) + MP_TAC (ISPECL [`x':real^3`; `x:real^3`] imp_norm_not_zero_fan) + THEN RES_TAC THEN STRIP_TAC THEN + POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "a") + THEN REPEAT STRIP_TAC + THEN ASM_REWRITE_TAC[] + THEN ABBREV_TAC `(x1:real^3)= inv (norm ((x':real^3)-(x:real^3))) % (x'-x) + x` + THEN SUBGOAL_THEN `(x1:real^3) IN ballnorm_fan (x:real^3)` ASSUME_TAC +THENL(*4*)[ REWRITE_TAC[ballnorm_fan; IN_ELIM_THM] + THEN EXPAND_TAC "x1" + THEN REWRITE_TAC[dist] + THEN REWRITE_TAC[VECTOR_ARITH `(x:real^3)-((a:real^3)+(x:real^3))= --(a)`; VECTOR_ARITH `-- ((a:real)% (v:real^3))=(-- a) % v`; NORM_MUL;REAL_ABS_NEG; REAL_ABS_INV; REAL_ABS_NORM] + THEN USE_THEN "a" MP_TAC + THEN MP_TAC(ISPEC `norm ((x':real^3)-(x:real^3))` REAL_MUL_LINV) + THEN ASM_MESON_TAC[];(*4*) + SUBGOAL_THEN `(x1:real^3) IN aff_ge {(x:real^3)} {(v1:real^3),(w1:real^3)}` ASSUME_TAC +THENL(*5*)[REMOVE_THEN "a" MP_TAC THEN +MP_TAC(ISPECL[`x:real^3`;`v1:real^3`;`w1:real^3`]AFF_GE_1_2) THEN RESA_TAC + THEN REWRITE_TAC[IN_ELIM_THM] + THEN STRIP_TAC THEN + EXISTS_TAC `&1 - inv (norm((x':real^3)-(x:real^3))) + inv (norm (x' - x)) * (t1:real) ` + THEN EXISTS_TAC `inv (norm((x':real^3)-(x:real^3))) * (t2:real) ` + THEN EXISTS_TAC `inv (norm((x':real^3)-(x:real^3))) * (t3:real) ` + THEN EXPAND_TAC "x1" + THEN REWRITE_TAC[VECTOR_ARITH`((a:real)-(b:real)+(c:real))%(v:real^3)=(a:real) % v -(b:real)% v+(c:real) %(v:real^3)`; +VECTOR_ARITH `&1 % (x:real^3)=x`; VECTOR_ARITH `((a:real)*(b:real)) % (v:real^3)= (a % (b % v))`; +VECTOR_ARITH `(x - inv (norm (x' - x)) % x + inv (norm (x' - x)) % t1 % x) + + inv (norm (x' - x)) % t2 % v1 + + inv (norm (x' - x)) % t3 % w1 =(inv (norm ((x':real^3)- x))) % ( t1 % x + t2 % v1+ t3% w1 -x)+ (x:real^3)` + +] + THEN STRIP_TAC +THENL(*6*)[SUBGOAL_THEN `&0 <= inv (norm ((x':real^3)-(x:real^3))) ` ASSUME_TAC +THENL(*7*)[ MATCH_MP_TAC REAL_LE_INV + THEN MESON_TAC[NORM_POS_LE];(*7*) + ASM_MESON_TAC[REAL_LE_MUL]](*7*);(*6*) + +STRIP_TAC +THENL(*7*)[ SUBGOAL_THEN `&0 <= inv (norm ((x':real^3)-(x:real^3))) ` ASSUME_TAC +THENL(*8*)[ MATCH_MP_TAC REAL_LE_INV + THEN MESON_TAC[NORM_POS_LE];(*8*) + ASM_MESON_TAC[REAL_LE_MUL; REAL_ARITH `(a:real)>= &0 <=> &0 <= a`]](*8*);(*7*) + +REWRITE_TAC[REAL_ARITH `(&1 - inv (norm (x' - x)) + inv (norm (x' - x)) * t1) + + inv (norm (x' - x)) * t2 + + inv (norm (x' - x)) * t3= &1 - inv (norm (x' - x)) + inv (norm (x' - x)) * (t1 + t2 + t3)`] + THEN STRIP_TAC +THENL(*8*)[ +ASM_REWRITE_TAC[] THEN REWRITE_TAC[REAL_ARITH `(a:real) * &1 = a`; REAL_ARITH `&1 - (a:real) +(a:real) = &1`];(*8*) + +SUBGOAL_THEN `(x':real^3) -(x:real^3)= (t1:real) % (x:real^3) + (t2:real) % (v1:real^3) + (t3:real) % (w1:real^3) -(x:real^3)` ASSUME_TAC +THENL(*9*)[ ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC;(*9*) + SUBGOAL_THEN `inv (norm ((x':real^3) -(x:real^3)) ) % ((x':real^3) -(x:real^3)) = inv (norm ((x':real^3) -(x:real^3)) ) % ((t1:real) % (x:real^3) + (t2:real) % (v1:real^3) + (t3:real) % (w1:real^3) -(x:real^3))` ASSUME_TAC +THENL(*10*)[ASM_MESON_TAC[ VECTOR_MUL_LCANCEL ];(*10*) +ASM_MESON_TAC[]](*10*)](*9*)](*8*)](*7*)](*6*); (*5*) + +SUBGOAL_THEN `(x1:real^3) IN ballsets_fan (aff_ge {(x:real^3)} {(v:real^3)} INTER ballnorm_fan x) (h:real)` ASSUME_TAC +THENL(*6*)[ + SUBGOAL_THEN `norm ((z:real^3)-(x:real^3))= &1` ASSUME_TAC +THENL(*7*)[FIND_ASSUM(MP_TAC)`z IN ballnorm_fan (x:real^3)` + THEN REWRITE_TAC[ballnorm_fan; IN_ELIM_THM; dist; NORM_SUB];(*7*) + POP_ASSUM MP_TAC + THEN DISCH_THEN (LABEL_TAC "k") + THEN SUBGOAL_THEN `(x':real^3)- (x:real^3)= (a:real) % ((z:real^3)-x )` ASSUME_TAC +THENL(*8*)[ FIND_ASSUM(MP_TAC)`x'=a %(z-x) +x:real^3` THEN VECTOR_ARITH_TAC;(*8*) + +SUBGOAL_THEN `norm((x':real^3)- (x:real^3))= norm((a:real) % ((z:real^3)-x ))` ASSUME_TAC +THENL(*9*)[ASM_SET_TAC[];(*9*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NORM_MUL] +THEN POP_ASSUM MP_TAC + THEN USE_THEN "k" (fun th -> REWRITE_TAC[th]) + THEN REDUCE_ARITH_TAC + THEN SUBGOAL_THEN `abs (a:real)=a`ASSUME_TAC + THENL(*10*)[FIND_ASSUM(MP_TAC)`&0 <= a:real` THEN REAL_ARITH_TAC;(*10*) +POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN DISCH_THEN(LABEL_TAC"l") + THEN DISCH_THEN (LABEL_TAC "n") + THEN REMOVE_THEN "l" MP_TAC THEN USE_THEN "n" (fun th-> REWRITE_TAC[SYM th]) + THEN DISCH_THEN (LABEL_TAC "l") + THEN SUBGOAL_THEN `(inv (norm (x'- x))) % ((x':real^3)- (x:real^3)) = (inv (norm (x' - x))) % (norm (x' - x) % ((z:real^3)- x ))` ASSUME_TAC +THENL(*11*)[POP_ASSUM MP_TAC THEN MESON_TAC[];(*11*) + POP_ASSUM MP_TAC + THEN REWRITE_TAC[VECTOR_ARITH `(a:real)%(b:real)%(v:real^3)=(a*b)%v`] + THEN MP_TAC(ISPEC`norm((x':real^3)-(x:real^3))`REAL_MUL_LINV) + THEN FIND_ASSUM(fun th ->REWRITE_TAC[th]) `~(norm((x':real^3)-(x:real^3))= &0)` + THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN REDUCE_VECTOR_TAC + THEN REWRITE_TAC[VECTOR_ARITH `((a:real^3)=(z:real^3)-(x:real^3))<=>(a+x=z)`] + THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`inv (norm (x' - x)) % (x' - x) + x = x1:real^3` + THEN DISCH_TAC THEN ASM_REWRITE_TAC[INTER]](*11*)](*10*)](*9*)](*8*)](*7*);(*6*) +ASM_SET_TAC[]](*6*)](*5*)](*4*)](*3*);(*2*) + +STRIP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THENL(*2*)[ EXISTS_TAC `&0` THEN EXISTS_TAC`inv (norm ((v:real^3)-(x:real^3))) % (v-x) + x` THEN REDUCE_VECTOR_TAC + THEN STRIP_TAC +THENL(*3*)[ REAL_ARITH_TAC;(*3*) + STRIP_TAC +THENL(*4*)[ REWRITE_TAC[ballsets_fan; IN_ELIM_THM] + THEN EXISTS_TAC `inv(norm((v:real^3)-(x:real^3))) % (v-x)+x` + THEN REWRITE_TAC[dist; VECTOR_ARITH `(a)-a= vec 0`; NORM_0] + THEN STRIP_TAC +THENL(*5*)[ ASM_SET_TAC[];(*5*) + +STRIP_TAC +THENL(*6*)[ +MP_TAC(ISPECL[`x:real^3`;`v:real^3`]AFF_GE_1_1) THEN RESA_TAC + THEN REWRITE_TAC[IN_ELIM_THM] + THEN EXISTS_TAC `&1 - inv (norm ((v:real^3)-(x:real^3)))` + THEN EXISTS_TAC `inv (norm ((v:real^3)-(x:real^3)))` + THEN STRIP_TAC +THENL(*7*)[ + MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_ge_zero_fan) THEN RES_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*7*) +STRIP_TAC +THENL(*8*)[ REAL_ARITH_TAC;(*8*) +VECTOR_ARITH_TAC](*8*)](*7*);(*6*) + + REWRITE_TAC[ballnorm_fan; IN_ELIM_THM; dist; VECTOR_ARITH `(x:real^3)-((a:real^3)+(x:real^3))= --a`; NORM_NEG; NORM_MUL ] + THEN SUBGOAL_THEN `inv(norm((v:real^3)-(x:real^3))) > &0 ` ASSUME_TAC +THENL(*7*)[MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_gl_zero_fan) THEN RESA_TAC;(*7*) + +SUBGOAL_THEN `abs(inv(norm((v:real^3)-(x:real^3))))=inv(norm((v:real^3)-(x:real^3)))` ASSUME_TAC +THENL(*8*)[ASM_REWRITE_TAC[REAL_ABS_REFL] THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*8*) + +POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN SUBGOAL_THEN `~ (norm ((v:real^3)-(x:real^3))= &0)` ASSUME_TAC +THENL(*9*)[MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_not_zero_fan) THEN RESA_TAC;(*9*) + POP_ASSUM MP_TAC THEN MESON_TAC[REAL_MUL_RINV;REAL_MUL_SYM]](*9*)](*8*)](*7*)](*6*)](*5*);(*4*) +REWRITE_TAC[ballnorm_fan; IN_ELIM_THM; dist; VECTOR_ARITH `(x:real^3)-((a:real^3)+(x:real^3))= --a`; NORM_NEG; NORM_MUL ] + THEN SUBGOAL_THEN `inv(norm((v:real^3)-(x:real^3))) > &0 ` ASSUME_TAC +THENL(*5*)[ MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_gl_zero_fan) THEN RESA_TAC;(*5*) + SUBGOAL_THEN `abs(inv(norm((v:real^3)-(x:real^3))))=inv(norm((v:real^3)-(x:real^3)))` ASSUME_TAC +THENL(*6*)[ASM_REWRITE_TAC[REAL_ABS_REFL] THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*6*) +POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN SUBGOAL_THEN `~ (norm ((v:real^3)-(x:real^3))= &0)` ASSUME_TAC +THENL(*7*)[ MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_not_zero_fan) THEN RESA_TAC;(*7*) + POP_ASSUM MP_TAC THEN MESON_TAC[REAL_MUL_RINV;REAL_MUL_SYM]](*7*)](*6*)](*5*)](*4*)](*3*);(*2*) + +MP_TAC(ISPECL[`x:real^3`;`v1:real^3`;`w1:real^3`]AFF_GE_1_2) THEN RESA_TAC THEN REWRITE_TAC[IN_ELIM_THM] +THEN +EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0` + THEN STRIP_TAC THENL [REAL_ARITH_TAC; STRIP_TAC THENL [REAL_ARITH_TAC; STRIP_TAC THENL [REAL_ARITH_TAC; VECTOR_ARITH_TAC]]]]]]);; + + +let subset_by_inequality_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (v1:real^3) (w1:real^3) (h:real) (h1:real). +FAN(x,V,E) /\ ~(v IN {v1,w1}) /\ {v1,w1} IN E /\ {v,w} IN E /\ h < h1 +==> + cone_ge_fan x ((ballsets_fan (aff_ge {x} {v} INTER ballnorm_fan x) h)INTER ballnorm_fan x ) INTER aff_ge {x} {v1, w1} SUBSET cone_ge_fan x ((ballsets_fan (aff_ge {x} {v} INTER ballnorm_fan x) h1)INTER ballnorm_fan x ) INTER aff_ge {x} {v1, w1} +`, +REPEAT STRIP_TAC +THEN SUBGOAL_THEN` cone_ge_fan x ((ballsets_fan (aff_ge {x} {v} INTER ballnorm_fan x) h)INTER ballnorm_fan x) SUBSET cone_ge_fan x ((ballsets_fan (aff_ge {x} {v} INTER ballnorm_fan x) h1)INTER ballnorm_fan x ) ` ASSUME_TAC +THENL[ +REWRITE_TAC[cone_ge_fan; SUBSET;IN_ELIM_THM] +THEN GEN_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`a:real` +THEN EXISTS_TAC`z:real^3` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM (fun th-> REWRITE_TAC[]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ballsets_fan;INTER; IN_ELIM_THM] +THEN RESA_TAC +THEN EXISTS_TAC`x'':real^3` +THEN ASM_REWRITE_TAC[] +THEN REPEAT (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; +ASM_SET_TAC[]]);; + + + +let cone_ge_fan_inter_aff_ge_is_empty_fan=prove( `(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (v1:real^3) (w1:real^3). +FAN(x,V,E) /\ ~(v IN {v1,w1}) /\ {v1,w1} IN E /\ {v,w} IN E +==> + +?h:real. +(&1> h) +/\ (h > &0) +/\ (cone_ge_fan x ((ballsets_fan (aff_ge {x} {v} INTER ballnorm_fan x) h)INTER ballnorm_fan x ) INTER aff_ge {x} {v1, w1} SUBSET {x}) +)`, + +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `; +`(w:real^3) `;`(v1:real^3)`;` (w1:real^3)`]cone_ge_fan_inter_aff_ge_is_empty) +THEN RESA_TAC +THEN DISJ_CASES_TAC(REAL_ARITH `(h >= &1) \/ (&1 > h)` ) +THENL[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `; +`(w:real^3) `;`(v1:real^3)`;` (w1:real^3)`; `&1/ &2`; `(h:real)`]subset_by_inequality_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`h>= &1==> &1 / &2 bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) h:real. +FAN(x,V,E) /\ {v,w} IN E /\(&0< h) /\ (h< &1) +==> +?h1:real. +&1 > h1 /\ +h1> &0 /\ +(rcone_fan x v h1) SUBSET cone_ge_fan x ((ballsets_fan (aff_ge {x} {v} INTER ballnorm_fan x) h)INTER ballnorm_fan x )`, + +REWRITE_TAC[rcone_fan;cone_ge_fan; SUBSET;IN_ELIM_THM;dist] + THEN REPEAT STRIP_TAC + THEN EXISTS_TAC`(&2 -(h:real) pow 2)/ &2` +THEN STRIP_TAC +THENL[ +REWRITE_TAC[REAL_ARITH`&1 > (&2 -(h:real) pow 2)/ &2 <=> h pow 2> &0`] +THEN MP_TAC (ISPECL[`h:real`;`2`]REAL_POW_LT) +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +STRIP_TAC +THENL[ +REWRITE_TAC[REAL_ARITH`(&2 -h pow 2)/ &2> &0<=> &2 > h pow 2`] +THEN MATCH_MP_TAC(REAL_ARITH` h pow 2<= &1 ==> &2 > h pow 2`) +THEN MATCH_MP_TAC (ISPECL[`2`;`h:real`;]REAL_POW_1_LE) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + + REPEAT STRIP_TAC + THEN EXISTS_TAC `norm ((x':real^3)-(x:real^3))` + THEN EXISTS_TAC `inv(norm ((x':real^3)-(x:real^3)))%(x'-x)+x` + THEN REWRITE_TAC[NORM_POS_LE] + THEN POP_ASSUM MP_TAC + THEN DISJ_CASES_TAC(SET_RULE`((x':real^3)-(x:real^3)= vec 0) \/ ~((x':real^3)-(x:real^3)= vec 0)`) +THENL(*1*)[ + +ASM_REWRITE_TAC[NORM_0;DOT_LZERO;] THEN REDUCE_ARITH_TAC THEN REAL_ARITH_TAC;(*1*) + +REWRITE_TAC[VECTOR_ARITH`(A+B)-B=A:real^3`;VECTOR_MUL_ASSOC] + THEN MP_TAC(ISPEC`x':real^3- x`NORM_EQ_0) + THEN RESA_TAC + THEN MP_TAC(ISPEC`norm(x':real^3- x)`REAL_MUL_LINV) + THEN ASM_REWRITE_TAC[REAL_MUL_SYM] + THEN RESA_TAC + THEN REDUCE_VECTOR_TAC + THEN REWRITE_TAC[VECTOR_ARITH`A-B+B=A:real^3`] + THEN SUBGOAL_THEN` inv (norm (x' - x)) % (x' - x) + x IN ballnorm_fan (x:real^3)` ASSUME_TAC +THENL(*2*)[ + REWRITE_TAC[ballnorm_fan; IN_ELIM_THM; dist; VECTOR_ARITH `(x:real^3)-((a:real^3)+(x:real^3))= --a`; NORM_NEG; NORM_MUL ] + THEN MP_TAC(ISPECL[`x':real^3`;`x:real^3`]imp_norm_ge_zero_fan) + THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[VECTOR_ARITH`(a:real^3)=b <=> a - b = vec 0`] + THEN RESA_TAC + THEN MP_TAC(ISPEC`inv(norm((x':real^3)-(x:real^3)))`REAL_ABS_REFL) + THEN GEN_REWRITE_TAC( LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[REAL_ARITH`&0<= (a:real) <=> a >= &0`] + THEN RESA_TAC;(*2*) + +STRIP_TAC + THEN SUBGOAL_THEN` inv (norm (x' - x)) % (x' - x) + x IN ballsets_fan (aff_ge {x} {v} INTER ballnorm_fan (x:real^3)) (h:real)` ASSUME_TAC +THENL(*3*)[ + +REWRITE_TAC[ballsets_fan;IN_ELIM_THM;dist] + THEN EXISTS_TAC`inv (norm (v - x)) % (v - x) + (x:real^3)` + THEN STRIP_TAC +THENL(*4*)[ + +REWRITE_TAC[VECTOR_ARITH`((v:real^3)+b)-(u+b)= (v-u)`;] + THEN SUBGOAL_THEN`norm(inv(norm(v-x))%(v:real^3-x)-inv(norm(x'-x))%(x'-x)) pow 2< h pow 2` ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[NORM_POW_2;DOT_LSUB;DOT_RSUB] +THEN REWRITE_TAC[DOT_RMUL;DOT_LMUL;DOT_SQUARE_NORM; REAL_ARITH`a-b-(c-d)=a+d-b-c`; +REAL_ARITH`a*a*b pow 2=(a*b) pow 2`;DOT_SYM;REAL_ARITH`a+b-e*d*c-d*e*c=a+b- &2 * d*e *c`] +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(w:real^3)`; +`(v:real^3)`;] remark1_fan) +THEN RES_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;`(v:real^3)`;] imp_norm_not_zero_fan) +THEN REWRITE_TAC[NORM_SUB] + THEN RES_TAC + THEN MP_TAC(ISPEC`norm(v:real^3- x)`REAL_MUL_LINV) +THEN RES_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 pow 2= &1`; +REAL_ARITH`&1+ &1 - &2 * a< h pow 2 <=> a > (&2- h pow 2)/ &2`] +THEN MP_TAC (ISPEC `(v:real^3)-(x:real^3)` NORM_POS_LE) + THEN DISCH_TAC +THEN SUBGOAL_THEN `norm((v:real^3)-(x:real^3))> &0` ASSUME_TAC +THENL(*6*)[ + +REPEAT( POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC;(*6*) + + MP_TAC (ISPEC `(x':real^3)-(x:real^3)` NORM_POS_LE) + THEN DISCH_TAC +THEN SUBGOAL_THEN ` norm((x:real^3)-(x':real^3))> &0 ` ASSUME_TAC +THENL(*7*)[ + +ONCE_REWRITE_TAC[NORM_ARITH`norm (x:real^3- x')> &0 <=> norm(x'-x)> &0`] +THEN REPEAT( POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC;(*7*) + +MP_TAC(ISPECL[`(&2 - (h:real) pow 2) / &2`; +`inv (norm (x:real^3 - x')) * inv (norm (v - x)) * ((v - x) dot (x' - x))`; +`norm (x:real^3 - x')`]REAL_LT_LMUL_EQ) +THEN REWRITE_TAC[REAL_ARITH`a b>a`] +THEN POP_ASSUM(fun th->REWRITE_TAC[th]) +THEN POP_ASSUM(fun th->REWRITE_TAC[]) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`(A<=>B)<=>(B<=>A)`] +THEN DISCH_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[th]) +THEN MP_TAC(ISPECL[`norm (x:real^3 - x') * (&2 - (h:real) pow 2) / &2`; +`norm (x:real^3 - x')*inv (norm (x:real^3 - x')) * inv (norm (v - x)) * ((v - x) dot (x' - x))`; +`norm (v:real^3 - x)`]REAL_LT_LMUL_EQ) +THEN REWRITE_TAC[REAL_ARITH`a b>a`] +THEN POP_ASSUM(fun th->REWRITE_TAC[th]) +THEN POP_ASSUM(fun th->REWRITE_TAC[]) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`(A<=>B)<=>(B<=>A)`] +THEN DISCH_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*B*C*D*E>a*b*c<=>(C*B)*(D*A)*E>b*c*a`] +THEN ONCE_REWRITE_TAC[NORM_ARITH`norm (x:real^3- x')= norm(x'-x)`] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN GEN_REWRITE_TAC(RAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[NORM_SUB] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[DOT_SYM] +THEN ASM_REWRITE_TAC[]](*7*)](*6*)(*5*); + +ASM_REWRITE_TAC[NORM_LT_SQUARE;DOT_SQUARE_NORM]](*5*);(*4*) + + +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(w:real^3)`; +`(v:real^3)`;] remark1_fan) +THEN RES_TAC +THEN +SUBGOAL_THEN`inv(norm(v-x:real^3)) % (v-x) +x IN aff_ge {x} {v}` ASSUME_TAC +THENL(*5*)[ +MP_TAC(ISPECL[`x:real^3`;`v:real^3`]AFF_GE_1_1) THEN RESA_TAC + THEN REWRITE_TAC[IN_ELIM_THM] + THEN EXISTS_TAC `&1 - inv (norm ((v:real^3)-(x:real^3)))` + THEN EXISTS_TAC `inv (norm ((v:real^3)-(x:real^3)))` + THEN STRIP_TAC +THENL(*6*)[ + + + MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_ge_zero_fan) THEN RES_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*6*) +STRIP_TAC +THENL(*7*)[ + REAL_ARITH_TAC; +VECTOR_ARITH_TAC]](*6*);(*5*) + +SUBGOAL_THEN` inv (norm (v- x)) % (v - x) + x IN ballnorm_fan (x:real^3)` ASSUME_TAC +THENL(*6*)[ + REWRITE_TAC[ballnorm_fan; IN_ELIM_THM; dist; VECTOR_ARITH `(x:real^3)-((a:real^3)+(x:real^3))= --a`; NORM_NEG; NORM_MUL ] + THEN MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_ge_zero_fan) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`v-x=vec 0<=> v=x`] + + THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[VECTOR_ARITH`(a:real^3)=b <=> a - b = vec 0`] + THEN RESA_TAC + THEN MP_TAC(ISPEC`inv(norm((v:real^3)-(x:real^3)))`REAL_ABS_REFL) + THEN GEN_REWRITE_TAC( LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[REAL_ARITH`&0<= (a:real) <=> a >= &0`] + THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;`(v:real^3)`;] imp_norm_not_zero_fan) +THEN REWRITE_TAC[NORM_SUB] + THEN RES_TAC + THEN MP_TAC(ISPEC`norm(v:real^3- x)`REAL_MUL_LINV) +THEN RES_TAC +THEN ASM_REWRITE_TAC[];(*6*) +ASM_SET_TAC[]](*6*)](*5*)](*4*);(*3*) +ASM_SET_TAC[]]]]]]);; + + + + + + + + + + + + + + +let inter_is_empty=prove(` +!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (v1:real^3) (w1:real^3). +FAN(x,V,E) /\ ~(v IN {v1,w1}) /\ {v1,w1} IN E /\ {v,w} IN E +==> +?h1:real. +&1 > h1 /\ +h1> &0 /\ +rcone_fan x v h1 INTER aff_ge {x} {v1, w1} = {} +`, +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`; `(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3) ` +;`(w:real^3)`;` (v1:real^3) `;`(w1:real^3)`]cone_ge_fan_inter_aff_ge_is_empty_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`(v:real^3)`; +`(w:real^3)`;` h:real`]rcone_subset_cone) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`&0 h> &0`; REAL_ARITH`h< &1 <=> &1 >h`] +THEN RES_TAC +THEN SUBGOAL_THEN`(rcone_fan x v h1 INTER aff_ge {x} {v1, w1}) SUBSET + {x:real^3}` ASSUME_TAC +THENL[ +ASM_SET_TAC[]; +MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (h1:real)`]origin_not_in_rcone_fan) +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`h1:real` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SUBSET; IN_SING;EXTENSION;EMPTY] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ + POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"a") +THEN DISCH_TAC +THEN DISCH_TAC +THEN REMOVE_THEN "a" (fun th->MP_TAC(ISPEC`x':real^3`th)) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"a") +THEN DISCH_TAC +THEN REMOVE_THEN "a" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN SUBGOAL_THEN`x:real^3 IN rcone_fan x v h1` ASSUME_TAC +THENL[ASM_SET_TAC[]; +ASM_SET_TAC[]]; +ASM_SET_TAC[]]]);; + +let avoids_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (v1:real^3) (w1:real^3)(w2:real^3). +FAN(x,V,E) /\ ~(v IN {v1,w1}) /\ {v1,w1} IN E /\ {v,w} IN E +==> +?h:real. +&1 >h /\ +h> &0 +/\ rw_dart_fan x V E ((x:real^3),(v:real^3),(w:real^3),(w2:real^3)) h INTER aff_ge {x} {v1, w1} = {} +`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[rw_dart_fan] +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;` (v1:real^3)` ;`(w1:real^3)`]inter_is_empty) +THEN RESA_TAC +THEN EXISTS_TAC`h1:real` +THEN ASM_SET_TAC[] + +);; + + +let avoids1_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (w1:real^3). +FAN(x,V,E) /\ {v,w} IN E /\ {v,w1} IN E +==> +?h:real. +&1 > h /\ +h > &0 /\ + rw_dart_fan x V E ((x:real^3),(v:real^3),(w:real^3),sigma_fan x V E v w) h INTER aff_ge {x} {v, w1} = {}`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[rw_dart_fan] +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`; +` (w:real^3)`;`(w1:real^3)`]IBZWFFH) +THEN RESA_TAC +THEN EXISTS_TAC`&1/ &2` +THEN REWRITE_TAC[REAL_ARITH`&1/ &2 > &0`;REAL_ARITH`&1 > &1/ &2`] +THEN ASM_SET_TAC[]);; + + +let finish_avoids_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (v1:real^3) (w1:real^3). +FAN(x,V,E) /\ {v,w} IN E /\ {v1,w1} IN E +==> +?h:real. +&1 >h /\ +h> &0/\ +rw_dart_fan x V E ((x:real^3),(v:real^3),(w:real^3),sigma_fan x V E v w) h INTER aff_ge {x} {v1, w1} = {}`, + +REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(v:real^3 IN {v1,w1})\/ (v=v1\/ v=w1)`) +THENL[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(w:real^3) `;`(v1:real^3)`;`w1:real^3`;` (sigma_fan x V E v w:real^3)`]avoids_fan) +THEN RESA_TAC +THEN ASM_SET_TAC[]; + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL[ +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN DISCH_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN POP_ASSUM( fun th-> REWRITE_TAC[SYM(th)]) +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(w:real^3) `;`w1:real^3`]avoids1_fan) +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN DISCH_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN POP_ASSUM( fun th-> REWRITE_TAC[SYM(th)]) +THEN ONCE_REWRITE_TAC[SET_RULE`{X,Y}={Y,X}`] +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(w:real^3) `;`v1:real^3`]avoids1_fan) +THEN RESA_TAC]]);; + +let continuous_set_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (h:real) (h1:real). +FAN(x,V,E) /\ {v,w} IN E /\ h1 <= h +==> +rw_dart_fan x V E ((x:real^3),(v:real^3),(w:real^3),sigma_fan x V E v w) h SUBSET rw_dart_fan x V E ((x:real^3),(v:real^3),(w:real^3),sigma_fan x V E v w) h1`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[rw_dart_fan] +THEN SUBGOAL_THEN `rcone_fan x v h SUBSET rcone_fan x v h1` ASSUME_TAC +THENL[ +REWRITE_TAC[rcone_fan;SUBSET; IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASSUME_TAC(ISPECL[`v:real^3`;`x:real^3`]DIST_POS_LE) +THEN ASSUME_TAC(ISPECL[`x':real^3`;`x:real^3`]DIST_POS_LE) +THEN MP_TAC(ISPECL[`dist((v:real^3),x)`;`h1:real`;`h:real`] REAL_LE_LMUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`dist((x':real^3),x)`;`dist((v:real^3),x)* (h1:real)`;`dist((v:real^3),x)* (h:real)`] REAL_LE_LMUL) +THEN RESA_TAC +THEN REPEAT (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; +ASM_SET_TAC[]]);; + + + + + + +let finish_avoids1_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (E':(real^3->bool)->bool) (v:real^3) (w:real^3). +FAN(x,V,E) /\ {v,w} IN E /\ E' SUBSET E +==> +?h:real. +&1> h /\ +h> &0 /\ +rw_dart_fan x V E ((x:real^3),(v:real^3),(w:real^3),sigma_fan x V E v w) h INTER {v | ?e. e IN E' /\ v IN aff_ge {x} e}={}`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[xfan; IN_ELIM_THM] +THEN MP_TAC(ISPECL[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`]set_edges_is_finite_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL [`(E':(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`] FINITE_SUBSET) +THEN RESA_TAC +THEN ABBREV_TAC`n=CARD (E':(real^3->bool)->bool)` +THEN REPEAT(POP_ASSUM MP_TAC) +THEN SPEC_TAC (`(E':(real^3->bool)->bool)`,`(E':(real^3->bool)->bool)`) +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC +THENL(*1*)[ +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`E':(real^3->bool)->bool`]CARD_EQ_0) +THEN RESA_TAC +THEN EXISTS_TAC`&1 / &2` +THEN REWRITE_TAC[REAL_ARITH`&1/ &2 > &0`;REAL_ARITH`&1 > &1/ &2`] +THEN ASM_SET_TAC[];(*1*) + +REPEAT GEN_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC "A") +THEN REPEAT STRIP_TAC +THEN MP_TAC(ISPEC`(E':(real^3->bool)->bool)` CHOOSE_SUBSET) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`n:num `th)) +THEN REWRITE_TAC[ARITH_RULE `n:num <= SUC n`; HAS_SIZE] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` t SUBSET E' /\ E' SUBSET E ==> (t:(real^3->bool)->bool) SUBSET E`) +THEN RESA_TAC +THEN REMOVE_THEN "A" (fun th-> MP_TAC(ISPEC`(t:(real^3->bool)->bool)`th)) +THEN RESA_TAC +THEN SUBGOAL_THEN `~((E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)= {})` ASSUME_TAC +THENL(*2*)[ +STRIP_TAC +THEN MP_TAC(SET_RULE`(E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)={} /\ t SUBSET E' ==> t= E'`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`CARD (t:(real^3->bool)->bool)=n` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC;(*2*) + +SUBGOAL_THEN`?e. e IN (E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)` +ASSUME_TAC +THENL(*3*)[ +ASM_SET_TAC[];(*3*) + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`e IN (E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)/\ +(E':(real^3->bool)->bool) SUBSET (E:(real^3->bool)->bool) /\ t SUBSET E' ==> e IN E'/\ e IN E/\ ~(e IN t) /\ {e} UNION t SUBSET E'`) +THEN RESA_TAC +THEN MP_TAC(ISPECL [`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;`(E':(real^3->bool)->bool)`] FINITE_SUBSET) +THEN RESA_TAC +THEN ASSUME_TAC(SET_RULE`e IN {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`) +THEN MP_TAC(ISPECL[`e:real^3->bool`;`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `e IN {e:(real^3->bool)} UNION (t:(real^3->bool)->bool) +==> ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e PSUBSET {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))DELETE e`;`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`]CARD_PSUBSET) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`FINITE ( {e:(real^3->bool)} UNION (t:(real^3->bool)->bool))` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN DISCH_TAC +THEN MP_TAC(ARITH_RULE`CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) < CARD ( {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) +/\ CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) = CARD ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))-1 +<=>CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) +1= CARD ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th;]) +THEN REWRITE_TAC[ARITH_RULE`A=A`; ] +THEN MP_TAC(SET_RULE`~(e IN t)==>({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e=t`) +THEN RESA_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`(CARD (E':(real^3->bool)->bool)=SUC n)` +THEN REWRITE_TAC[ARITH_RULE`SUC n=(n:num) +1`] +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;`E':(real^3->bool)->bool`]CARD_SUBSET_EQ) +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MA") +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`]expand_edge_graph_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(w:real^3)`; `(v':real^3)`;` (w':real^3)`]finish_avoids_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN STRIP_TAC +THEN ABBREV_TAC`h1= max (h:real) (h':real)` +THEN EXISTS_TAC`h1:real` +THEN STRIP_TAC +THENL(*4*)[ +POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC;(*4*) + +STRIP_TAC +THENL(*5*)[ +POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC;(*5*) + +REMOVE_THEN "MA" MP_TAC +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) +THEN REWRITE_TAC[UNION;IN_ELIM_THM;EXTENSION; INTER;] +THEN GEN_TAC +THEN EQ_TAC +THENL(*6*)[ + +ASM_REWRITE_TAC[IN_SING] +THEN STRIP_TAC +THENL[ + POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)` ;`(h1:real)`;` (h':real)`]continuous_set_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"h1" +THEN REWRITE_TAC[REAL_ARITH`h'<= max (h:real) (h':real)`] +THEN RESA_TAC +THEN ASM_SET_TAC[]; + + POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)` ;`(h1:real)`;` (h:real)`]continuous_set_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"h1" +THEN REWRITE_TAC[REAL_ARITH`h<= max (h:real) (h':real)`] +THEN RESA_TAC +THEN ASM_SET_TAC[]]; + +ASM_SET_TAC[]]]]]]]);; + + + + + + + +let rw_dart_avoids_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3). +FAN(x,V,E) /\ {v,w} IN E +==> +?h:real. +&1> h /\ +h> &0 /\ +rw_dart_fan x V E ((x:real^3),(v:real^3),(w:real^3),sigma_fan x V E v w) h SUBSET yfan(x,V,E) `, + +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`]finish_avoids1_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`A SUBSET A`;yfan;xfan] +THEN RESA_TAC +THEN EXISTS_TAC`h:real` +THEN ASM_REWRITE_TAC[] +THEN ASM_SET_TAC[]);; + + + + +(*------------------------------------------------------------------------*) +(*------------------------------------------------------------------------*) + + + +let r_fan=new_definition`r_fan (a:real) (b:real) (c:real) = { y:real^3 | y$1 > &0 /\ y$2 > a /\ y$2 < b /\ y$3 > &0 /\ y$3 < c}`;; + + + +let r1_le_fan=new_definition`r1_le_fan (a:real)={ y:real^3 | y$1 > a}`;; + + +let r2_le_fan=new_definition`r2_le_fan (a:real)={ y:real^3 | y$2 > a}`;; + + + +let r3_le_fan=new_definition`r3_le_fan (a:real)={ y:real^3 | y$3 > a}`;; + + + +let r1_ge_fan=new_definition`r1_ge_fan (a:real)={ y:real^3 | y$1 < a}`;; + + +let r2_ge_fan=new_definition`r2_ge_fan (a:real)={ y:real^3 | y$2 < a}`;; + +let r3_ge_fan=new_definition`r3_ge_fan (a:real)={ y:real^3 | y$3 < a}`;; + + + + +let r_fan_is_inter_halfspace=prove(`!a:real b:real c:real. +r_fan a b c = r1_le_fan (&0) INTER r2_le_fan a INTER r2_ge_fan b INTER r3_le_fan (&0) INTER r3_ge_fan c`, +REWRITE_TAC[r_fan; r1_le_fan; r2_le_fan; r2_ge_fan; r3_le_fan; r3_ge_fan; INTER; IN_ELIM_THM]);; + + + + + +let r1_ge_is_convex_fan = prove(`!a:real. convex (r1_ge_fan a)/\ open (r1_ge_fan a) `,REWRITE_TAC[r1_ge_fan] THEN REWRITE_TAC[CONVEX_HALFSPACE_COMPONENT_LT;OPEN_HALFSPACE_COMPONENT_LT]);; + + +let r2_ge_is_convex_fan = prove(`!a:real. convex (r2_ge_fan a)/\ open (r2_ge_fan a)`, +REWRITE_TAC[r2_ge_fan] THEN REWRITE_TAC[CONVEX_HALFSPACE_COMPONENT_LT;OPEN_HALFSPACE_COMPONENT_LT]);; + +let r3_ge_is_convex_fan = prove(`!a:real. convex (r3_ge_fan a) /\ open(r3_ge_fan a)`, +REWRITE_TAC[r3_ge_fan] THEN REWRITE_TAC[CONVEX_HALFSPACE_COMPONENT_LT;OPEN_HALFSPACE_COMPONENT_LT]);; + +let r1_le_is_convex_fan = prove(`!a:real. convex (r1_le_fan a)/\ open (r1_le_fan a) `, +REWRITE_TAC[r1_le_fan] THEN REWRITE_TAC[CONVEX_HALFSPACE_COMPONENT_GT;OPEN_HALFSPACE_COMPONENT_GT]);; + +let r2_le_is_convex_fan = prove(`!a:real. convex (r2_le_fan a)/\ open (r2_le_fan a) `, +REWRITE_TAC[r2_le_fan] THEN REWRITE_TAC[CONVEX_HALFSPACE_COMPONENT_GT;OPEN_HALFSPACE_COMPONENT_GT]);; + +let r3_le_is_convex_fan = prove(`!a:real. convex (r3_le_fan a)/\ open (r3_le_fan a) `, +REWRITE_TAC[r3_le_fan] THEN REWRITE_TAC[CONVEX_HALFSPACE_COMPONENT_GT;OPEN_HALFSPACE_COMPONENT_GT]);; + +let r_is_connected_fan=prove(`!a:real b:real c:real. connected (r_fan a b c)/\convex (r_fan a b c) /\ open (r_fan a b c)`, + (let lemma = prove(`!a:real b:real c:real. convex (r_fan a b c)/\ open (r_fan a b c)`, +ASSUME_TAC (r_fan_is_inter_halfspace) THEN ASM_REWRITE_TAC[] THEN +ASSUME_TAC (r1_ge_is_convex_fan) THEN ASSUME_TAC ( r2_ge_is_convex_fan) THEN +ASSUME_TAC (r3_ge_is_convex_fan) THEN ASSUME_TAC(r1_le_is_convex_fan) THEN +ASSUME_TAC(r2_le_is_convex_fan) THEN ASSUME_TAC( r3_le_is_convex_fan) THEN +ASM_MESON_TAC[CONVEX_INTER;OPEN_INTER]) + in +SUBGOAL_THEN `!a:real b:real c:real. convex (r_fan a b c)/\ open (r_fan a b c) ` ASSUME_TAC +THENL [MESON_TAC[lemma]; + ASM_MESON_TAC[CONVEX_CONNECTED]]));; + + + + + +let rw_dart_is_image_set_spherical_coordinate=prove(`(!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 h:real. +FAN(x,V,E)/\ {v,u} IN E/\ &0 + IMAGE (change_spherical_coordinate_fan x v u) +(r_fan (azim x v u u) (azim_fan x V E v u) h)= + rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) (cos(h))) `, +(let lem=prove(`!x v u. {x,v,u}= {x,u,v}`,ASM_SET_TAC[]) in +( let lem1=prove(`!x v u. {x,v,u}= {v,x,u}`,SET_TAC[]) in + +REWRITE_TAC[azim_fan;r_fan; rw_dart_fan; change_spherical_coordinate_fan;IMAGE;INTER; +w_dart_fan;rcone_fan;EXTENSION;IN_ELIM_THM] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3 `;`(V:real^3->bool) `; +`(E:(real^3->bool)->bool)`;` u:real^3`;` v:real^3`]remark1_fan) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`~collinear {(x:real^3),(v:real^3),(u:real^3)}` +THEN GEN_REWRITE_TAC( LAND_CONV o ONCE_DEPTH_CONV)[lem1] +THEN ONCE_REWRITE_TAC[COLLINEAR_3] +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]orthonormal_e1_e2_e3_fan) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MP_TAC(th) THEN ASSUME_TAC(th)) +THEN REWRITE_TAC[orthonormal] +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]properties_coordinate) +THEN RESA_TAC +THEN EQ_TAC +THENL(*1*)[ +STRIP_TAC +THEN MP_TAC(ISPEC`(x'':real^3)$3`SIN_POS_PI2) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A /\ B <=> B /\ A`] +THEN STRIP_TAC +THENL(*2*)[ + + + + +REWRITE_TAC[dist;vector_norm;VECTOR_ARITH`(A+B)-A=(B:real^3)`; DOT_LADD;DOT_RADD;DOT_RMUL;DOT_LMUL;] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN REWRITE_TAC[REAL_ARITH`((x'':real^3)$1 * cos (x''$2) * sin (x''$3)) * x''$1 * cos (x''$2) * sin (x''$3) + + (x''$1 * sin (x''$2) * sin (x''$3)) * x''$1 * sin (x''$2) * sin (x''$3) + + (x''$1 * cos (x''$3)) * x''$1 * cos (x''$3)=(x''$1 * x''$1)* (( sin (x''$2) pow 2 +(cos (x''$2) pow 2)) * (sin (x''$3) pow 2)+ cos (x''$3) pow 2)`] +THEN ASSUME_TAC(ISPEC`(x'':real^3)$2`SIN_CIRCLE) +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN ASSUME_TAC(ISPEC`(x'':real^3)$3`SIN_CIRCLE) +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN MP_TAC(ISPEC`(x'':real^3)$1`SQRT_POW_2) +THEN MP_TAC(REAL_ARITH`(x'':real^3)$1> &0==> &0 <= (x'':real^3)$1`) +THEN RESA_TAC +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x'':real^3)$1`;`(x'':real^3)$1`]SQRT_MUL) +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ARITH`A*(A:real)=A pow 2`] +THEN ASM_REWRITE_TAC[e3_fan;DOT_LMUL] +THEN ONCE_REWRITE_TAC[GSYM vector_norm;] +THEN ASSUME_TAC(ISPEC`(v:real^3)-(x:real^3)`DOT_SQUARE_NORM) +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[REAL_ARITH`(A*B)*C *D pow 2=A*D*B *(C*D)`] +THEN SUBGOAL_THEN`~(norm((v:real^3)-(x:real^3))= &0)` ASSUME_TAC +THENL(*3*)[ + +ASM_REWRITE_TAC[NORM_EQ_0;VECTOR_ARITH`v-x=vec 0<=> x=v`];(*3*) + +MP_TAC(ISPEC`norm((v:real^3)-(x:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN MP_TAC(ISPEC`((v:real^3)-(x:real^3))`NORM_POS_LT) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`v-x=vec 0<=> x=v`;REAL_ARITH`A>B<=> B A> &0`] +THEN MATCH_MP_TAC REAL_LT_LMUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC COS_MONO_LT +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC];(*2*) + + + +SUBGOAL_THEN`azim (x:real^3) (v:real^3) (u:real^3) + (x + + (x''$1 * cos (x''$2) * sin (x''$3)) % e1_fan x v u + + (x''$1 * sin (x''$2) * sin (x''$3)) % e2_fan x v u + + (x''$1 * cos (x''$3)) % e3_fan x v u)= (x'':real^3)$2 ` ASSUME_TAC +THENL(*3*)[ + +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`(x + + (x''$1 * cos (x''$2) * sin (x''$3)) % e1_fan x v u + + (x''$1 * sin (x''$2) * sin ((x'':real^3)$3)) % e2_fan x v u + + (x''$1 * cos (x''$3)) % e3_fan (x:real^3) (v:real^3) (u:real^3))`; + `((u-x) dot (e3_fan (x:real^3) (v:real^3) (u:real^3))) *inv (norm((v:real^3)-(x:real^3)))`; + `(x''$1 * cos ((x'':real^3)$3)) * (inv (norm((v:real^3)-(x:real^3))))`; +`((u-x) dot (e1_fan (x:real^3) (v:real^3) (u:real^3)))`; +`x''$1 * sin ((x'':real^3)$3)`; +`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`;`&0`;`(x'':real^3)$2`]AZIM_UNIQUE) +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`&0+a=a`;] +THEN STRIP_TAC +THENL(*4*)[ + +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;]AZIM_REFL) +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC;(*4*) + +STRIP_TAC +THENL(*5*)[ + +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`] azim) +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC;(*5*) + +STRIP_TAC +THENL(*6*)[ + +MATCH_MP_TAC REAL_LT_MUL +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC;(*6*) + +STRIP_TAC +THENL(*7*)[ + +REWRITE_TAC[SIN_0;COS_0;VECTOR_ARITH`(A*B)%C=A%(B%C)`] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN ONCE_REWRITE_TAC[GSYM e3_fan] +THEN MATCH_MP_TAC(ISPECL[`e3_fan (x:real^3) (v:real^3) (u:real^3)`;`(u:real^3)-(x:real^3)`;` +((u - x) dot e1_fan x v u) % (e1_fan (x:real^3) (v:real^3) (u:real^3)) + + ((u - x) dot e3_fan x v u) % (e3_fan x v u)`]CROSS_DOT_CANCEL) +THEN ASM_REWRITE_TAC[DOT_RADD;DOT_RMUL;DOT_SYM] +THEN REDUCE_ARITH_TAC +THEN REWRITE_TAC[CROSS_RADD;CROSS_RMUL;CROSS_REFL] +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]ORTHONORMAL_CROSS) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[e1_fan] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE;e2_fan] +THEN REWRITE_TAC[VECTOR_ARITH`A%(B%C)=(B*A)%C`] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ONCE_REWRITE_TAC[GSYM DOT_RMUL] +THEN ONCE_REWRITE_TAC[GSYM e2_fan] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`&0<(e1_fan x v u cross e2_fan x v u) dot e3_fan (x:real^3) (v:real^3) (u:real^3)` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[DOT_RZERO] +THEN REAL_ARITH_TAC;(*7*) + +REWRITE_TAC[e3_fan] +THEN VECTOR_ARITH_TAC](*7*)](*6*)](*5*)](*4*);(*3*) + + + + +SUBGOAL_THEN`~collinear + {(x:real^3), (v:real^3), x + + (x''$1 * cos (x''$2) * sin (x''$3)) % e1_fan x v (u:real^3) + + (x''$1 * sin (x''$2) * sin ((x'':real^3)$3)) % e2_fan x v u + + (x''$1 * cos (x''$3)) % e3_fan x v u}`ASSUME_TAC +THENL(*4*)[ + +ONCE_REWRITE_TAC[lem] +THEN REWRITE_TAC[collinear1_fan] +THEN ASM_REWRITE_TAC[aff;AFFINE_HULL_2; IN_ELIM_THM; REAL_ARITH`A+B= &1<=>A= &1-B`] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[VECTOR_ARITH`A+B=(&1-c) % A+ c % D<=>B=c%(D-A)`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`((x''$1 * cos (x''$2) * sin (x''$3)) % e1_fan x v u + + (x''$1 * sin (x''$2) * sin (x''$3)) % e2_fan x v u + + (x''$1 * cos ((x'':real^3)$3)) % e3_fan x v (u:real^3)) dot e1_fan x v u = + ((v':real) % ((v:real^3) - (x:real^3))) dot e1_fan x v u` ASSUME_TAC +THENL(*5*)[ +ASM_REWRITE_TAC[];(*5*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[DOT_LADD;DOT_LMUL] +THEN ASM_REWRITE_TAC[DOT_SYM] +THEN REDUCE_ARITH_TAC +THEN SUBGOAL_THEN`((x''$1 * cos (x''$2) * sin (x''$3)) % e1_fan x v u + + (x''$1 * sin (x''$2) * sin (x''$3)) % e2_fan x v u + + (x''$1 * cos ((x'':real^3)$3)) % e3_fan x v (u:real^3)) dot e2_fan x v u = + ((v':real) % ((v:real^3) - (x:real^3))) dot e2_fan x v u` ASSUME_TAC +THENL(*6*)[ +ASM_REWRITE_TAC[];(*6*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[DOT_LADD;DOT_LMUL] +THEN ASM_REWRITE_TAC[DOT_SYM] +THEN REDUCE_ARITH_TAC +THEN REWRITE_TAC[REAL_ENTIRE] +THEN STRIP_TAC +THENL(*7*)[ + +REPEAT (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC;(*7*) + +STRIP_TAC +THENL(*8*)[ + +REPEAT (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC;(*8*) + + +MP_TAC(ISPEC`(x'':real^3)$2`SIN_CIRCLE) +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; + +REPEAT (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC]; + +REPEAT (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC](*7*)](*6*)](*5*);(*4*) + + +REPEAT(POP_ASSUM MP_TAC) +THEN DISJ_CASES_TAC(ARITH_RULE`CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))>1 +\/ ~(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) >1)`) +THENL(*5*)[ +ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[wedge;IN_ELIM_THM] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC`(x'':real^3)$2 > azim (x:real^3) (v:real^3) u (u:real^3)` +THEN REWRITE_TAC[AZIM_REFL] +THEN REAL_ARITH_TAC;(*5*) + + +ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`]one_edge_fan) +THEN RESA_TAC +THEN REWRITE_TAC[DIFF;IN_ELIM_THM] +THEN STRIP_TAC +THENL(*6*)[ + +ASM_SET_TAC[];(*6*) + +STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`(x:real^3) + + (x''$1 * cos (x''$2) * sin ((x'':real^3)$3)) % e1_fan x (v:real^3) (u:real^3) + + (x''$1 * sin (x''$2) * sin (x''$3)) % e2_fan x v u + + (x''$1 * cos (x''$3)) % e3_fan x v u`]AZIM_EQ_0_GE_ALT) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;]AZIM_REFL) +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC](*6*)](*5*)](*4*)](*3*)](*2*);(*1*) + + + +ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN DISJ_CASES_TAC(ARITH_RULE`CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))>1 +\/ ~(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) >1)`) +THENL(*2*)[ +ASM_REWRITE_TAC[wedge;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN EXISTS_TAC`vector[(dist((x:real^3),(x':real^3)));(azim (x:real^3) (v:real^3) (u:real^3) (x':real^3));(arcV (x:real^3) (x':real^3) (v:real^3))]:real^3` +THEN ASM_REWRITE_TAC[VECTOR_3;AZIM_REFL;REAL_ARITH`A> &0 <=> &0 &0 < dist((x:real^3),(x':real^3))`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*4*)[ +STRIP_TAC +THENL(*5*)[ + +REWRITE_TAC[ARCV_ANGLE; angle;] +THEN MP_TAC(ISPECL[`((x':real^3) - (x:real^3)) `;`((v:real^3) - (x:real^3))`]VECTOR_ANGLE_RANGE) +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`((x':real^3) - (x:real^3)) `;`((v:real^3) - (x:real^3))`]COLLINEAR_VECTOR_ANGLE) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-B= vec 0<=> B=A`;] +THEN ONCE_REWRITE_TAC[GSYM COLLINEAR_3;] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,C,A}`] +THEN DISCH_TAC +THEN FIND_ASSUM MP_TAC `~collinear {(x:real^3),(v:real^3),(x':real^3)}` +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[DE_MORGAN_THM] +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC;(*5*) + +MP_TAC(ISPECL[`v:real^3`;`x:real^3`]DIST_EQ_0) +THEN RESA_TAC +THEN ASSUME_TAC(ISPECL[`v:real^3`;`x:real^3`]DIST_POS_LE) +THEN MP_TAC(REAL_ARITH`~(dist((v:real^3),(x:real^3))= &0)/\ &0 <= dist((v:real^3),(x:real^3))==> &0 < dist((v:real^3),(x:real^3))`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x':real^3`;`x:real^3`]DIST_EQ_0) +THEN RESA_TAC +THEN ASSUME_TAC(ISPECL[`x':real^3`;`x:real^3`]DIST_POS_LE) +THEN MP_TAC(REAL_ARITH`~(dist((x':real^3),(x:real^3))= &0)/\ &0 <= dist((x':real^3),(x:real^3))==> &0 < dist((x':real^3),(x:real^3))`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`dist ((v:real^3),(x:real^3)) * cos (h:real)`;`((x':real^3) - x) dot ((v:real^3) - (x:real^3))`; `dist((x':real^3),(x:real^3))`]REAL_LT_RDIV_EQ) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`cos (h:real)`;`(((x':real^3) - x) dot ((v:real^3) - (x:real^3)) )/ dist ((x':real^3),(x:real^3)) `; `dist((v:real^3),(x:real^3))`]REAL_LT_RDIV_EQ) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B=B*A`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[REAL_ARITH`(A*B)*C =C* A*B`] +THEN REWRITE_TAC[REAL_ARITH`A B>A`;] +THEN ASM_REWRITE_TAC[real_div;REAL_ARITH`(A*B)*C =A*(B *C)`] +THEN ONCE_REWRITE_TAC[GSYM REAL_INV_MUL;] +THEN ONCE_REWRITE_TAC[GSYM real_div;] +THEN REWRITE_TAC[dist;arcV] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 < (h:real) /\ h< pi/ &2==> &0<= h /\ h<=pi`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`h:real`ACS_COS) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`cos (h:real)`;`(((x':real^3) - x) dot ((v:real^3) - (x:real^3))) / (norm (x' - x) * norm (v - x))` ;]ACS_MONO_LT) +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ARITH`A>B<=> B B>A`] +THEN MP_TAC(ISPECL[`(x':real^3)-(x:real^3)`;`(v:real^3)-(x:real^3)`]NORM_CAUCHY_SCHWARZ_DIV) +THEN MP_TAC(ISPEC`(((x':real^3)-(x:real^3)) dot ((v:real^3)-(x:real^3))) / (norm (x' - x) * norm (v - x))`REAL_ABS_LE) +THEN REAL_ARITH_TAC](*5*);(*4*) + + +MATCH_MP_TAC(ISPECL[`u:real^3`;`x:real^3`;`v:real^3`;`x':real^3`;`e1_fan (x:real^3) (v:real^3) (u:real^3)`; +`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`;`dist((x:real^3),(x':real^3))`;`arcV (x:real^3) (x':real^3) (v:real^3)`;`azim (x:real^3) (v:real^3) (u:real^3) (x':real^3)`]SPHERICAL_COORDINATES) +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`azim x v u (x+e1_fan (x:real^3) (v:real^3) (u:real^3))= &0` ASSUME_TAC +THENL(*5*)[ + +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x + e1_fan (x:real^3) (v:real^3) (u:real^3)`; + `((u-x) dot (e3_fan (x:real^3) (v:real^3) (u:real^3))) *inv (norm((v:real^3)-(x:real^3)))`; + `&0`; +`((u-x) dot (e1_fan (x:real^3) (v:real^3) (u:real^3)))`;`&1`; +`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`;`&0`;`&0`]AZIM_UNIQUE) +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`&0+a=a`;REAL_ARITH`&0<= &0/\ &0 < &1`] +THEN STRIP_TAC +THENL(*6*)[ +MP_TAC(PI_WORKS) +THEN REAL_ARITH_TAC;(*6*) + +STRIP_TAC +THENL(*7*)[ + +REWRITE_TAC[SIN_0;COS_0;VECTOR_ARITH`(A*B)%C=A%(B%C)`] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN ONCE_REWRITE_TAC[GSYM e3_fan] +THEN MATCH_MP_TAC(ISPECL[`e3_fan (x:real^3) (v:real^3) (u:real^3)`;`(u:real^3)-(x:real^3)`;` +((u - x) dot e1_fan x v u) % (e1_fan (x:real^3) (v:real^3) (u:real^3)) + + ((u - x) dot e3_fan x v u) % (e3_fan x v u)`]CROSS_DOT_CANCEL) +THEN ASM_REWRITE_TAC[DOT_RADD;DOT_RMUL;DOT_SYM] +THEN REDUCE_ARITH_TAC +THEN REWRITE_TAC[CROSS_RADD;CROSS_RMUL;CROSS_REFL] +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]ORTHONORMAL_CROSS) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[e1_fan] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE;e2_fan] +THEN REWRITE_TAC[VECTOR_ARITH`A%(B%C)=(B*A)%C`] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ONCE_REWRITE_TAC[GSYM DOT_RMUL] +THEN ONCE_REWRITE_TAC[GSYM e2_fan] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`&0<(e1_fan x v u cross e2_fan x v u) dot e3_fan (x:real^3) (v:real^3) (u:real^3)` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[DOT_RZERO] +THEN REAL_ARITH_TAC;(*7*) + +REWRITE_TAC[SIN_0;COS_0] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN VECTOR_ARITH_TAC](*7*)](*6*);(*5*) + + +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x + e1_fan (x:real^3) (v:real^3) (u:real^3)`]AZIM_EQ_0_ALT) +THEN RESA_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ONCE_REWRITE_TAC[COLLINEAR_3] +THEN REWRITE_TAC[ VECTOR_ARITH`((A:real^3)+(B:real^3))-A=B`;] +THEN ONCE_REWRITE_TAC[GSYM DOT_CAUCHY_SCHWARZ_EQUAL] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0 pow 2= &0`;REAL_ARITH `A=B:real <=> B=A`] +THEN REDUCE_ARITH_TAC +THEN ASM_REWRITE_TAC[DOT_EQ_0;VECTOR_ARITH`A-B=vec 0<=> A=B:real^3`]](*5*)](*4*)](*3*);(*2*) + + + + + + + +ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`]one_edge_fan) +THEN RESA_TAC +THEN REWRITE_TAC[DIFF;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN EXISTS_TAC`vector[(dist((x:real^3),(x':real^3)));(azim (x:real^3) (v:real^3) (u:real^3) (x':real^3));(arcV (x:real^3) (x':real^3) (v:real^3))]:real^3` +THEN ASM_REWRITE_TAC[VECTOR_3;AZIM_REFL;REAL_ARITH`A> &0 <=> &0 &0 < dist((x:real^3),(x':real^3))`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[azim] +THEN SUBGOAL_THEN`~collinear{(x:real^3),(v:real^3),(x':real^3)}` ASSUME_TAC +THENL(*4*)[ + +POP_ASSUM (fun th-> REWRITE_TAC[]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[]) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MA") +THEN ONCE_REWRITE_TAC[lem1] +THEN ASM_REWRITE_TAC[COLLINEAR_3;COLLINEAR_LEMMA;VECTOR_ARITH`v-x=vec 0<=> v=x`] +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]AFF_GE_2_1) +THEN RESA_TAC +THEN STRIP_TAC +THENL(*5*)[ + +REMOVE_THEN "MA" MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC;(*5*) + +REMOVE_THEN "MA" MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`&1- (c:real)` +THEN EXISTS_TAC`c:real` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(x':real^3)=(&1 - (c:real)) % (x:real^3)+ c % (v:real^3)<=>x'-x=c%(v-x)`] +THEN REAL_ARITH_TAC](*5*);(*4*) + + + +STRIP_TAC +THENL(*5*)[ +STRIP_TAC +THENL(*6*)[ + +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x':real^3`]AZIM_EQ_0_GE_ALT) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x':real^3`]azim) +THEN REAL_ARITH_TAC;(*6*) + + +STRIP_TAC +THENL(*7*)[ + +REWRITE_TAC[ARCV_ANGLE; angle;] +THEN MP_TAC(ISPECL[`((x':real^3) - (x:real^3)) `;`((v:real^3) - (x:real^3))`]VECTOR_ANGLE_RANGE) +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`((x':real^3) - (x:real^3)) `;`((v:real^3) - (x:real^3))`]COLLINEAR_VECTOR_ANGLE) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-B= vec 0<=> B=A`;] +THEN ONCE_REWRITE_TAC[GSYM COLLINEAR_3;] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,C,A}`] +THEN DISCH_TAC +THEN FIND_ASSUM MP_TAC `~collinear {(x:real^3),(v:real^3),(x':real^3)}` +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[DE_MORGAN_THM] +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC;(*7*) + +MP_TAC(ISPECL[`v:real^3`;`x:real^3`]DIST_EQ_0) +THEN RESA_TAC +THEN ASSUME_TAC(ISPECL[`v:real^3`;`x:real^3`]DIST_POS_LE) +THEN MP_TAC(REAL_ARITH`~(dist((v:real^3),(x:real^3))= &0)/\ &0 <= dist((v:real^3),(x:real^3))==> &0 < dist((v:real^3),(x:real^3))`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x':real^3`;`x:real^3`]DIST_EQ_0) +THEN RESA_TAC +THEN ASSUME_TAC(ISPECL[`x':real^3`;`x:real^3`]DIST_POS_LE) +THEN MP_TAC(REAL_ARITH`~(dist((x':real^3),(x:real^3))= &0)/\ &0 <= dist((x':real^3),(x:real^3))==> &0 < dist((x':real^3),(x:real^3))`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`dist ((v:real^3),(x:real^3)) * cos (h:real)`;`((x':real^3) - x) dot ((v:real^3) - (x:real^3))`; `dist((x':real^3),(x:real^3))`]REAL_LT_RDIV_EQ) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`cos (h:real)`;`(((x':real^3) - x) dot ((v:real^3) - (x:real^3)) )/ dist ((x':real^3),(x:real^3)) `; `dist((v:real^3),(x:real^3))`]REAL_LT_RDIV_EQ) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B=B*A`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[REAL_ARITH`(A*B)*C =C* A*B`] +THEN REWRITE_TAC[REAL_ARITH`A B>A`;] +THEN ASM_REWRITE_TAC[real_div;REAL_ARITH`(A*B)*C =A*(B *C)`] +THEN ONCE_REWRITE_TAC[GSYM REAL_INV_MUL;] +THEN ONCE_REWRITE_TAC[GSYM real_div;] +THEN REWRITE_TAC[dist;arcV] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 < (h:real) /\ h< pi/ &2==> &0<= h /\ h<=pi`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`h:real`ACS_COS) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`cos (h:real)`;`(((x':real^3) - x) dot ((v:real^3) - (x:real^3))) / (norm (x' - x) * norm (v - x))` ;]ACS_MONO_LT) +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ARITH`A>B<=> B B>A`] +THEN MP_TAC(ISPECL[`(x':real^3)-(x:real^3)`;`(v:real^3)-(x:real^3)`]NORM_CAUCHY_SCHWARZ_DIV) +THEN MP_TAC(ISPEC`(((x':real^3)-(x:real^3)) dot ((v:real^3)-(x:real^3))) / (norm (x' - x) * norm (v - x))`REAL_ABS_LE) +THEN REAL_ARITH_TAC](*7*)](*6*);(*5*) + +MATCH_MP_TAC(ISPECL[`u:real^3`;`x:real^3`;`v:real^3`;`x':real^3`;`e1_fan (x:real^3) (v:real^3) (u:real^3)`; +`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`;`dist((x:real^3),(x':real^3))`;`arcV (x:real^3) (x':real^3) (v:real^3)`;`azim (x:real^3) (v:real^3) (u:real^3) (x':real^3)`]SPHERICAL_COORDINATES) +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`azim x v u (x+e1_fan (x:real^3) (v:real^3) (u:real^3))= &0` ASSUME_TAC +THENL(*6*)[ + +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x + e1_fan (x:real^3) (v:real^3) (u:real^3)`; + `((u-x) dot (e3_fan (x:real^3) (v:real^3) (u:real^3))) *inv (norm((v:real^3)-(x:real^3)))`; + `&0`; +`((u-x) dot (e1_fan (x:real^3) (v:real^3) (u:real^3)))`;`&1`; +`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`;`&0`;`&0`]AZIM_UNIQUE) +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`&0+a=a`;REAL_ARITH`&0<= &0/\ &0 < &1`] +THEN STRIP_TAC +THENL(*7*)[ +MP_TAC(PI_WORKS) +THEN REAL_ARITH_TAC;(*7*) + +STRIP_TAC +THENL(*8*)[ + +REWRITE_TAC[SIN_0;COS_0;VECTOR_ARITH`(A*B)%C=A%(B%C)`] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN ONCE_REWRITE_TAC[GSYM e3_fan] +THEN MATCH_MP_TAC(ISPECL[`e3_fan (x:real^3) (v:real^3) (u:real^3)`;`(u:real^3)-(x:real^3)`;` +((u - x) dot e1_fan x v u) % (e1_fan (x:real^3) (v:real^3) (u:real^3)) + + ((u - x) dot e3_fan x v u) % (e3_fan x v u)`]CROSS_DOT_CANCEL) +THEN ASM_REWRITE_TAC[DOT_RADD;DOT_RMUL;DOT_SYM] +THEN REDUCE_ARITH_TAC +THEN REWRITE_TAC[CROSS_RADD;CROSS_RMUL;CROSS_REFL] +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]ORTHONORMAL_CROSS) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[e1_fan] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE;e2_fan] +THEN REWRITE_TAC[VECTOR_ARITH`A%(B%C)=(B*A)%C`] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ONCE_REWRITE_TAC[GSYM DOT_RMUL] +THEN ONCE_REWRITE_TAC[GSYM e2_fan] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`&0<(e1_fan x v u cross e2_fan x v u) dot e3_fan (x:real^3) (v:real^3) (u:real^3)` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[DOT_RZERO] +THEN REAL_ARITH_TAC;(*8*) + +REWRITE_TAC[SIN_0;COS_0] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN VECTOR_ARITH_TAC](*8*)](*7*);(*6*) + + +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x + e1_fan (x:real^3) (v:real^3) (u:real^3)`]AZIM_EQ_0_ALT) +THEN RESA_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ONCE_REWRITE_TAC[COLLINEAR_3] +THEN REWRITE_TAC[ VECTOR_ARITH`((A:real^3)+(B:real^3))-A=B`;] +THEN ONCE_REWRITE_TAC[GSYM DOT_CAUCHY_SCHWARZ_EQUAL] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0 pow 2= &0`;REAL_ARITH `A=B:real <=> B=A`] +THEN REDUCE_ARITH_TAC +THEN ASM_REWRITE_TAC[DOT_EQ_0;VECTOR_ARITH`A-B=vec 0<=> A=B:real^3`]](*6*)](*5*)](*4*)](*3*)](*2*)](*1*))));; + + + + +let connected_rw_dart_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 h:real. +FAN(x,V,E)/\ {v,u} IN E/\ &0 connected(rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) (cos(h)))`, +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`v:real^3`; +` u:real^3` ;`h:real`]rw_dart_is_image_set_spherical_coordinate) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN ASSUME_TAC(ISPECL[`(azim (x:real^3) (v:real^3) (u:real^3) u)`; `(azim_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) `;`h:real`] r_is_connected_fan) +THEN MP_TAC(ISPECL[`change_spherical_coordinate_fan (x:real^3) (v:real^3) (u:real^3)`;`r_fan (azim x v u u) (azim_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) (h:real)`]CONTINUOUS_ON_EQ_CONTINUOUS_AT) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`change_spherical_coordinate_fan (x:real^3) (v:real^3) (u:real^3)`;`r_fan (azim x v u u) (azim_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) (h:real)`] CONNECTED_CONTINUOUS_IMAGE) +THEN RESA_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN GEN_TAC +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`; +`u:real^3`;`x':real^3`]continuous_change_spherical_coordinate_fan) +THEN REWRITE_TAC[change_spherical_coordinate_fan] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN DISCH_TAC +THEN MATCH_MP_TAC CONTINUOUS_ADD +THEN ASM_REWRITE_TAC[] +THEN SIMP_TAC[CONTINUOUS_CONST]);; + + +let not_empty_rw_dart_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3. +FAN(x,V,E)/\ {v,u} IN E +==> +(!h:real. &0 +~(rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) (cos(h))={}))`, +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`v:real^3`] +THEN MRESA_TAC rw_dart_is_image_set_spherical_coordinate[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`h:real`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[IMAGE_EQ_EMPTY;r_fan;EXTENSION;IN_ELIM_THM;IN;EMPTY;NOT_FORALL_THM;AZIM_REFL;azim_fan] +THEN DISJ_CASES_TAC(ARITH_RULE`~(CARD (set_of_edge (v:real^3) V E) > 1)\/ CARD (set_of_edge v V E) > 1`) +THENL[ +ASM_REWRITE_TAC[] +THEN EXISTS_TAC`vector[&1; pi; h/ &2]:real^3` +THEN SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH] +THEN MP_TAC PI_WORKS +THEN ASM_TAC +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E = {u:real^3})\/ ~(set_of_edge v V E = {u})`) +THENL[ +MRESA_TAC CARD_SING[`u:real^3`; `(set_of_edge v V E):real^3->bool`] +THEN FIND_ASSUM MP_TAC `CARD ((set_of_edge v V E):real^3->bool) >1` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun TH-> REWRITE_TAC[TH]) +THEN ARITH_TAC; + +DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (u:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))= &0) \/ ~(azim (x:real^3) (v:real^3) (u:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) = &0)`) +THENL[ +MRESA_TAC SIGMA_FAN[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(v:real^3)`;`(u:real^3)`] +THEN MRESA_TAC UNIQUE_AZIM_0_POINT_FAN[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))`;`v:real^3`]; + +MRESA_TAC azim[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))`] +THEN EXISTS_TAC`vector[&1; (azim x v u ((sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))))/ &2;h/ &2]:real^3` +THEN SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH] +THEN ASM_TAC +THEN REAL_ARITH_TAC]]]);; + + + +let JGIYDLE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3. +FAN(x,V,E)/\ {v,u} IN E +==> +(!h:real. &0 +~(rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) (cos(h))={})) +/\(!h:real h1:real. h1 <= h +==> +(rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) h SUBSET rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) h1)) + +/\ +(?h:real. +&1> h /\ +h> &0 /\ +rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) h SUBSET yfan(x,V,E)) +/\ +(!h:real. &0 connected(rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) (cos(h))))`, +MESON_TAC[not_empty_rw_dart_fan;continuous_set_fan;rw_dart_avoids_fan;connected_rw_dart_fan]);; + + + + +end;; diff --git a/legacy/oldfan/JUTSTKG.hl b/legacy/oldfan/JUTSTKG.hl new file mode 100755 index 0000000..afd7050 --- /dev/null +++ b/legacy/oldfan/JUTSTKG.hl @@ -0,0 +1,1342 @@ + +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + + +module Jutstkg = struct + + + +open Sphere;; +open Fan_defs;; +open Hypermap_of_fan;; +open Tactic_fan;; +open Lemma_fan;; +open Fan;; +open Hypermap_of_fan;; +open Node_fan;; +open Azim_node;; +open Sum_azim_node;; +open Disjoint_fan;; +open Lead_fan;; +open Fan_misc;; +open Leads_into_fan;; +open Fully_surrounded;; +open Sin_azim_cross_dot;; +open Leads_intos;; +open Hypermap;; +open Dartset_leads_into;; + + + + + + + +let exists_point_notx_in_xfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) /\ ~(E={}) +==> ?v. v IN xfan(x,V,E) /\ ~(v=x)`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[] +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`;xfan;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"YEU") +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(y:real^3->bool)`] +THEN REMOVE_THEN "YEU" MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] +THEN MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v:real^3)`;`(w:real^3)`] +THEN EXISTS_TAC `v:real^3` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC `y:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN SET_TAC[]);; + + + +let x_in_xfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) /\ ~(E={}) +==> x IN xfan(x,V,E)`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[] +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`;xfan;IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC `y:real^3->bool` +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"YEU") +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(y:real^3->bool)`] +THEN REMOVE_THEN "YEU" MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] +THEN MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v:real^3)`;`(w:real^3)`] +THEN ASM_TAC THEN SET_TAC[]);; + + + +let xfan_notempty_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) /\ ~(E={}) +==> ~(xfan(x,V,E)={})`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[] +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`] +THEN EXISTS_TAC `x:real^3` +THEN ASM_TAC +THEN SET_TAC[x_in_xfan]);; + + + + + + + + +let xfan_closed_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +==> closed (xfan(x,V,E))`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[xfan;SET_RULE`{v | ?e. E e /\ v IN aff_ge {x} e}= UNIONS{y | ?x'. x' IN E /\ y = aff_ge {x} x'}`] +THEN MATCH_MP_TAC CLOSED_UNIONS +THEN MRESA_TAC set_edges_is_finite_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESAL_TAC FINITE_IMAGE[`(\e:real^3->bool. aff_ge {x:real^3} e)`;`E:(real^3->bool)->bool`][IMAGE;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") THEN DISCH_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(x':real^3->bool)`] +THEN REMOVE_THEN "YEU"MP_TAC THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] +THEN MRESA_TAC closed_aff_ge_1_2[`x:real^3`;`v:real^3`;`w:real^3`]);; + + +let topological_component_subset_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool. +U IN topological_component_yfan (x,V,E) +==> U SUBSET yfan(x,V,E)`, +REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[CONNECTED_COMPONENT_SUBSET]);; + + + + + + + + + +let aff_gt_connect_bound_not_inter_edges_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 y:real^3 z:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ DISJOINT {x} {y,z} +/\ (!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan (x,V,E)) +==> +aff_gt {x} {y,z} INTER aff_ge {x} {v,u}={}`, + +REWRITE_TAC[SET_RULE`A={}<=> ~(?w. w IN A)`;INTER;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") +THEN REPEAT STRIP_TAC +THEN MRESA_TAC scale_in_edges_fan[`x:real^3`;`y:real^3`;`z:real^3`;`w:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MP_TAC(REAL_ARITH`&0 &0 <= a`) THEN RESA_TAC +THEN MRESA_TAC scale_aff_ge_fan[`x:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`w:real^3`;`a:real`][VECTOR_ARITH`(A+B-C)+C=A+B:real^3`]) +THEN MRESA_TAC in_aff_gt_1_2[`x:real^3`;`y:real^3`;`z:real^3 `;`t:real`] +THEN REMOVE_THEN "YEU" (fun th-> MRESAL1_TAC th`t:real`[yfan]) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[SET_RULE`~((&1 - t) % y + t % z IN (:real^3) DIFF xfan (x,V,E))<=>(&1 - t) % y + t % z IN xfan (x,V,E)`;xfan;IN_ELIM_THM] +THEN EXISTS_TAC`{v,u}:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN SET_TAC[IN]);; + + + + + + + + +let aff_gt_connect_bound_subset_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) y:real^3 z:real^3. +FAN(x,V,E) /\ DISJOINT {x} {y,z} +/\ (!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan (x,V,E)) +==> aff_gt {x} {y,z} SUBSET yfan (x,V,E)`, + +REPEAT STRIP_TAC +THEN +REWRITE_TAC[yfan;xfan;SET_RULE`aff_gt {x} {y, z} SUBSET + (:real^3) DIFF {v | ?e. E e /\ v IN aff_ge {x} e} +<=> (!e. e IN E ==> aff_gt {x} {y,z} INTER aff_ge {x} e={})`] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN MRESA_TAC aff_gt_connect_bound_not_inter_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` w:real^3`;`y:real^3`;`z:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM(th)] ));; + + + + +let exists_point_notxin_convex_in_xfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) z:real^3. +FAN(x,V,E) /\ ~(x=z) /\ ~(E={}) +==> ?v. v IN xfan(x,V,E) /\ ~(x IN convex hull{v,z})`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[] +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`;xfan;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"YEU") +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(y:real^3->bool)`] +THEN REMOVE_THEN "YEU" MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] +THEN MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v:real^3)`;`(w:real^3)`] +THEN DISJ_CASES_TAC(SET_RULE`~(x IN convex hull{v,z:real^3})\/ (x IN convex hull{v,z})`) +THENL[ +EXISTS_TAC `v:real^3` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC `y:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN SET_TAC[]; +EXISTS_TAC `w:real^3` +THEN STRIP_TAC +THENL[ +EXISTS_TAC `y:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN SET_TAC[]; +MRESA1_TAC CONVEX_HULL_SUBSET_AFFINE_HULL`{v,z:real^3}` +THEN MP_TAC(SET_RULE`x IN convex hull {v, z:real^3}/\ convex hull {v, z} SUBSET affine hull {v, z} +==> x IN affine hull {v, z}`) +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA1_TAC CONVEX_HULL_SUBSET_AFFINE_HULL`{w,z:real^3}` +THEN MP_TAC(SET_RULE`x IN convex hull {w, z:real^3}/\ convex hull {w, z} SUBSET affine hull {w, z} +==> x IN affine hull {w, z}`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(x=z) /\ ~(x=v) /\ ~(x=w)==> DISJOINT {x:real^3} {v,z} /\ DISJOINT{x} {w,z}`) THEN RESA_TAC +THEN MRESAL_TAC sym_line_fan[`x:real^3`;`v:real^3`;`z:real^3`][aff] +THEN MRESAL_TAC sym_line_fan[`x:real^3`;`w:real^3`;`z:real^3`][aff] +THEN MRESA_TAC POINT_IN_LINE1[`x:real^3` ;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[aff] +THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM(th)]) +THEN ASM_REWRITE_TAC[SYM aff]]]);; + + + +let notempty_xfan_inter_segment_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) z:real^3 v:real^3. +FAN(x,V,E) /\ v IN xfan(x,V,E) +==> ~(xfan(x,V,E) INTER segment[v,z] ={})`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`;IN_ELIM_THM;INTER;segment] +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`&0` +THEN REWRITE_TAC[REAL_ARITH`&1- &0= &1 /\ &0<= &0 /\ &0<= &1`] +THEN REDUCE_VECTOR_TAC);; + + + +let xfan_inter_segment_closed_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) z:real^3 v:real^3. +FAN(x,V,E) ==> closed(xfan(x,V,E) INTER segment[v,z])`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC CLOSED_INTER +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CLOSED_SEGMENT;xfan_closed_fan]);; + + + +let point_in_yfan_not_x_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool z:real^3. +FAN(x,V,E) /\ ~(E={}) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +==> ~(x=z)`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC topological_component_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` U:real^3->bool`] +THEN MP_TAC(SET_RULE`U SUBSET yfan (x:real^3,V:real^3->bool,E)/\ z IN U ==> z IN yfan(x,V,E)`) +THEN RESA_TAC +THEN MRESA_TAC x_in_xfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan] +THEN SET_TAC[]);; + + +let zpoint_in_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool z:real^3. +FAN(x,V,E) /\ ~(E={}) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +==> z IN yfan(x,V,E)`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC topological_component_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` U:real^3->bool`] +THEN MP_TAC(SET_RULE`U SUBSET yfan (x:real^3,V:real^3->bool,E)/\ z IN U ==> z IN yfan(x,V,E)`) +THEN RESA_TAC +THEN SET_TAC[]);; + + + + +let connect_insidepoint_to_bound_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool z:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +==> ?y. ~(y=x)/\ y IN xfan(x,V,E) /\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan(x,V,E))`, +REPEAT STRIP_TAC +THEN MRESA_TAC nonsetedge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;` z:real^3`] +THEN MRESA_TAC exists_point_notxin_convex_in_xfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` z:real^3`] +THEN EXISTS_TAC`closest_point (xfan (x:real^3,V:real^3->bool,E) INTER segment[v,z]) (z:real^3)` +THEN MRESA_TAC xfan_inter_segment_closed_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` z:real^3`;`v:real^3`] +THEN MRESA_TAC notempty_xfan_inter_segment_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` z:real^3`;`v:real^3`] +THEN MRESA_TAC CLOSEST_POINT_EXISTS[`xfan (x:real^3,V:real^3->bool,E) INTER segment[v,z]`;`(z:real^3)`] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MP_TAC (SET_RULE`closest_point (xfan (x:real^3,V:real^3->bool,E) INTER segment [v,z:real^3]) z IN + xfan (x,V,E) INTER segment [v,z]==> closest_point (xfan (x,V,E) INTER segment [v,z]) z IN + xfan (x,V,E)/\ closest_point (xfan (x,V,E) INTER segment [v,z]) z IN segment [v,z]`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"EM") THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN ASSUME_TAC(th)) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SEGMENT_CONVEX_HULL] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`closest_point (xfan (x:real^3,V:real^3->bool,E) INTER convex hull {v, z}) z IN + convex hull {v, z} /\ ~(x IN convex hull {v, z})==> ~(closest_point (xfan (x,V,E) INTER convex hull {v, z} ) z = x)`) +THEN RESA_TAC +THEN STRIP_TAC +THENL[ASM_REWRITE_TAC[SEGMENT_CONVEX_HULL]; +ABBREV_TAC`y1=closest_point (xfan (x:real^3,V:real^3->bool,E) INTER segment [v,z]) z` +THEN SUBGOAL_THEN`!t. &0< t /\ t< &1==>dist (z,(&1 - t) % y1 + t % z) t<= &1`;NORM_MUL] +THEN MP_TAC(REAL_ARITH`t< &1==> t<= &1`) THEN RESA_TAC +THEN RESA_TAC +THEN MRESAL_TAC REAL_LT_RMUL[`&1-t:real`;`&1:real`;`norm (z - y1:real^3)`][REAL_ARITH`&1*A=A`;REAL_ARITH`&1-t< &1<=> &0< t`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MATCH_MP_TAC(REAL_ARITH`&0<= A /\ ~(A= &0) ==> &0 < A`) +THEN REWRITE_TAC[NORM_POS_LE;NORM_EQ_0;VECTOR_ARITH`A-B= vec 0<=>A=B`] +THEN STRIP_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN MRESA_TAC topological_component_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`] +THEN MP_TAC(SET_RULE`z:real^3 IN U /\ U SUBSET yfan(x,V,E) ==> z IN yfan(x:real^3,V:real^3->bool,E)`) +THEN ASM_REWRITE_TAC[yfan] +THEN SET_TAC[]; +POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"NHIEU") +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[yfan;DIFF;IN_ELIM_THM;SET_RULE`(&1 - t) % y1 + t % z IN (:real^3)`] +THEN STRIP_TAC +THEN MP_TAC (REAL_ARITH`&0 &0<= t /\ t:real<= &1`) THEN RESA_TAC +THEN MRESA_TAC segment_in_segment[`v:real^3`;`z:real^3`;`y1:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`t:real`) +THEN MP_TAC(SET_RULE`(&1 - t) % y1 + t % z IN xfan (x:real^3,V:real^3->bool,E) /\ (&1 - t) % y1 + t % z IN segment [v,z]==> (&1 - t) % y1 + t % z IN xfan (x,V,E) INTER segment [v,z]`) +THEN RESA_TAC +THEN REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th`(&1 - t) % y1 + t % z:real^3`) +THEN REMOVE_THEN "NHIEU"(fun th-> MRESA1_TAC th`t:real`) +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]]);; + + + + + + + +let point_in_aff_gt_in_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) y:real^3 z:real^3 w:real^3. +FAN(x,V,E) /\ DISJOINT {x} {y,z} /\ w IN aff_gt {x} {y,z} +/\ (!t. &0 < t /\ t < &1 ==> (&1 - t) % y + t % z IN yfan (x,V,E)) +==> w IN yfan(x,V,E)`, +REPEAT STRIP_TAC +THEN MRESA_TAC aff_gt_connect_bound_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`y:real^3`;`z:real^3`] +THEN ASM_TAC THEN SET_TAC[]);; + + + + +let segment_subset_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) y:real^3 z:real^3 w:real^3. +FAN(x,V,E) /\ DISJOINT {x} {y,z} /\ z IN yfan(x,V,E) /\ w IN aff_gt {x} {y,z} +/\ (!t. &0 < t /\ t < &1 ==> (&1 - t) % y + t % z IN yfan (x,V,E)) +==> segment[w,z] SUBSET yfan(x,V,E)`, + +REWRITE_TAC[segment;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC aff_gt_connect_bound_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC segmentsubset_aff_gt[`x:real^3`;`y:real^3`;`z:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real`) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`u<= &1==> u< &1\/ u= &1`) +THEN RESA_TAC +THENL[ +ASM_TAC THEN SET_TAC[]; +ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - &1) % w + &1 % z=z:real^3`]]);; + + +let exists_in_aff_gt_disjoint=prove(`!x:real^3 v:real^3 u:real^3. +DISJOINT {x} {v,u} ==> ?y:real^3. y IN aff_gt {x} {v, u}`, +REPEAT STRIP_TAC +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0 % x+ &1 / &2 % v+ &1/ &2 %u:real^3 ` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1/ &2` +THEN EXISTS_TAC`&1/ &2` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC);; + + + +let aff_gt_subset_component_y_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool y:real^3 z:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +/\ DISJOINT {x} {y,z} +/\ (!t. &0 < t /\ t < &1 ==> (&1 - t) % y + t % z IN yfan (x,V,E)) +==> aff_gt {x} {y,z} SUBSET U`, +REPEAT STRIP_TAC +THEN MRESA_TAC expand_element_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`U:real^3->bool`;`z:real^3`] +THEN MRESA_TAC exists_in_aff_gt_disjoint[`x:real^3`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC CONVEX_AFF_GT[`{x:real^3}`;`{y,z:real^3}`] +THEN MRESA1_TAC CONVEX_CONNECTED`aff_gt {x:real^3} {y,z:real^3}` +THEN MRESA_TAC aff_gt_connect_bound_subset_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC CONNECTED_COMPONENT_MAXIMAL[`yfan(x:real^3, (V:real^3->bool) ,E)`;`aff_gt {x:real^3} {y,z}`;`y':real^3`;] +THEN MATCH_MP_TAC(SET_RULE`aff_gt {x} {y, z} SUBSET connected_component (yfan (x,V,E)) y'/\ connected_component (yfan (x:real^3, (V:real^3->bool),E)) y'= connected_component (yfan (x,V,E)) z==> aff_gt {x} {y, z} SUBSET connected_component (yfan (x,V,E)) z`) +THEN ASM_REWRITE_TAC[CONNECTED_COMPONENT_EQ_EQ;] +THEN MRESA_TAC point_in_aff_gt_in_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`y:real^3`;`z:real^3`;`y':real^3`] +THEN MRESA_TAC nonsetedge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC zpoint_in_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`z:real^3`] +THEN MRESA_TAC CONNECTED_COMPONENT_OF_SUBSET [`segment [y',z:real^3]`;`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`z:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESA_TAC segment_subset_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`y:real^3`;`z:real^3`;`y':real^3`] +THEN REWRITE_TAC[SEGMENT_CONVEX_HULL] +THEN MRESA1_TAC CONVEX_CONVEX_HULL`{y',z:real^3}` +THEN MRESA1_TAC CONVEX_CONNECTED `convex hull {y', z:real^3}` +THEN MRESA1_TAC CONNECTED_IFF_CONNECTED_COMPONENT`convex hull {y', z:real^3}` +THEN POP_ASSUM(fun th-> MRESA_TAC th[`y':real^3`;`z:real^3`]) +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESAL_TAC expansion1_convex_fan[`y':real^3`;`z:real^3`;`&0`][REAL_ARITH`&0<= &0 /\ &0<= &1`;VECTOR_ARITH`(&1- &0)%v+ &0 % u=v`] +THEN MRESAL_TAC expansion1_convex_fan[`y':real^3`;`z:real^3`;`&1`][REAL_ARITH`&0<= &1 /\ &1 <= &1`;VECTOR_ARITH`(&1- &1)%v+ &1 % u=u`]);; + + + + + + +let exists_connect_point_in_xfanto_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool z:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +==> ?y. ~(y=x) /\ y IN xfan(x,V,E) /\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN U)`, + +REPEAT STRIP_TAC +THEN MRESA_TAC connect_insidepoint_to_bound_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `U:real^3->bool`;`z:real^3`] +THEN EXISTS_TAC `y:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC nonsetedge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;` z:real^3`] +THEN MP_TAC(SET_RULE`~(x=z) /\ ~(y=x)==> DISJOINT {x} {y,z:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC aff_gt_subset_component_y_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC(SET_RULE`aff_gt {x:real^3} {y, z} SUBSET U /\ (&1 - t) % y + t % z IN aff_gt {x} {y, z}==> (&1 - t) % y + t % z IN U`) +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC AFF_GT_1_2[`(x:real^3)` ;` (y:real^3)`;`(z:real^3) `;][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC `&1- t:real` +THEN EXISTS_TAC `t:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1- t<=> t< &1`;REAL_ARITH`&0 + &1 - t + t = &1`] +THEN VECTOR_ARITH_TAC);; + + + + + + +let aff_ge_1_1_subset_xfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) y:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ y IN xfan(x,V,E) /\ ~(x=y) +==> aff_ge {x} {y} SUBSET xfan(x,V,E)`, + +REWRITE_TAC[xfan;IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[IN] +THEN RESA_TAC +THEN EXISTS_TAC`e:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC aff_ge_1_1_subset_aff_ge_fan[`x:real^3`;`v:real^3`;`w:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)] THEN ASM_REWRITE_TAC[] THEN ASSUME_TAC(th)) +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)] THEN GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[IN]THEN ASM_REWRITE_TAC[] THEN ASSUME_TAC(th)) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN SET_TAC[]);; + + +let point_in_yfan_and_point_in_xfan_indepent_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool y:real^3 z:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +/\ y IN xfan(x,V,E) +/\ ~(y=x) /\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan (x,V,E)) +==> ~collinear {x,y,z}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC nonsetedge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC zpoint_in_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`z:real^3`] +THEN ASM_REWRITE_TAC[collinear_fan;SET_RULE`~(y=x)<=> ~(x=y)`] +THEN STRIP_TAC +THEN MRESA_TAC place_there_point_line_fan[`x:real^3`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC aff_ge_1_1_subset_xfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`y:real^3`] +THEN MP_TAC(SET_RULE`(&1 - t) % y + t % z IN aff_ge {x:real^3} {y}/\ aff_ge {x} {y} SUBSET xfan (x,V:real^3->bool,E) ==> (&1 - t) % y + t % z IN xfan (x,V,E)`) +THEN RESA_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th`t:real`) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[yfan] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + + + +(*CASE 1*) + + + +let exists_edge_component_yfan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (y:real^3). + FAN(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) /\ v IN V +/\ ~(y IN set_of_edge v V E) +==> +(?(w:real^3). (w IN (set_of_edge v V E)) /\ +(!(w1:real^3). (w1 IN (set_of_edge v V E)) ==> azim1 x v y w <= azim1 x v y w1))`, + +(let lemma = prove + (`!X:real->bool. + FINITE X /\ ~(X = {}) + ==> ?a. a IN X /\ !x. x IN X ==> a <= x`, + MESON_TAC[INF_FINITE]) in + +REPEAT STRIP_TAC +THEN MRESA_TAC exists_edge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v':real^3`;`v:real^3`] +THEN MRESA_TAC FINITE_IMAGE [`azim1 (x:real^3) v y`;`(set_of_edge v (V:real^3->bool) (E:(real^3->bool)->bool))`] +THEN MP_TAC(SET_RULE`v' IN set_of_edge v V E==> ~(set_of_edge v (V:real^3->bool) (E:(real^3->bool)->bool)= {}) `) +THEN RESA_TAC +THEN MRESA_TAC IMAGE_EQ_EMPTY[`azim1 (x:real^3) v y`;`(set_of_edge v (V:real^3->bool) (E:(real^3->bool)->bool))`] +THEN MRESA1_TAC lemma`IMAGE (azim1 (x:real^3) v y) (set_of_edge v (V:real^3->bool) (E:(real^3->bool)->bool)) +` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`x':real^3` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`(?x'. x' IN set_of_edge v V E /\ azim1 x v y w1 = azim1 x v y (x':real^3))`ASSUME_TAC +THENL[ +EXISTS_TAC`w1:real^3` +THEN ASM_REWRITE_TAC[]; +REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th`azim1 x v y (w1:real^3)`)]));; + + + + + + + + + + + + + + + +let not_azim_points_in_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool y:real^3 z:real^3 u:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +/\ u IN V +/\ y IN aff_ge {x} {u} +/\ y IN xfan (x,V,E) +/\ ~(y=x) + /\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan (x,V,E)) +==>(!(w1:real^3). (w1 IN (set_of_edge u V E)) ==> ~(azim x u z w1= &0))`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"YEU") +THEN DISCH_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (u:real^3)`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC nonsetedge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;` z:real^3`] +THEN MRESA_TAC no_origin_aff_ge_is_aff_gt[`x:real^3`;`u:real^3`;`y:real^3`] +THEN MRESA_TAC in_aff_gt_eq_azim[`x:real^3`;`y:real^3`;`u:real^3`;`z:real^3`;`w1:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(SYM(th))) +THEN MRESA_TAC point_in_yfan_and_point_in_xfan_indepent_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;` z:real^3`] +THEN MRESA_TAC aff_ge_1_1_subset_aff_fan[`y:real^3`;`x:real^3`;`u:real^3`] +THEN MRESA_TAC permutes_4points_collinear1[`x:real^3`;`y:real^3`;`u:real^3`;`w1:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`y:real^3`;`w1:real^3`] +THEN STRIP_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`y:real^3`;`z:real^3`;`w1:real^3`] +THEN MRESA_TAC aff_ge_2_1_is_exists_point_inaff_ge_1_2[`x:real^3`;`y:real^3`;`z:real^3`;`w1:real^3`] +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`x:real^3`;`u:real^3`;`w1:real^3`] +THEN MP_TAC(SET_RULE`y IN aff_ge {x} {u}/\ aff_ge {x} {u, w1} = + aff_gt {x} {u, w1} UNION aff_ge {x} {u} UNION aff_ge {x} {w1}==> y IN aff_ge {x} {u, w1:real^3}`) +THEN POP_ASSUM(fun th -> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`u:real^3`;`w1:real^3`;`y:real^3`] +THEN MP_TAC(SET_RULE`(&1 - t) % y + t % z IN aff_ge {x} {y, w1} + /\ aff_ge {x} {y, w1:real^3} SUBSET aff_ge {x} {u, w1}==> (&1 - t) % y + t % z IN aff_ge {x} {u, w1}`) +THEN RESA_TAC +THEN SUBGOAL_THEN`aff_ge {x} {u,w1} SUBSET xfan(x:real^3,V:real^3->bool,E)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[xfan; SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`{u,w1:real^3}` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN SET_TAC[IN]; +MP_TAC(SET_RULE`(&1 - t) % y + t % z IN aff_ge {x:real^3} {u, w1}/\ aff_ge {x} {u, w1} SUBSET xfan (x,V:real^3->bool,E) +==> (&1 - t) % y + t % z IN xfan (x,V,E)`) +THEN RESA_TAC +THEN REMOVE_THEN "YEU"(fun th -> MRESA1_TAC th`t:real` ) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan] +THEN SET_TAC[]]);; + + +let exists_edge_bounded_topological_component_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool y:real^3 z:real^3 u:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +/\ u IN V +/\ y IN aff_ge {x} {u} +/\ y IN xfan(x,V,E) +/\ ~(y=x) +/\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan (x,V,E)) +==> ?w. {u,w} IN E /\ z IN w_dart_fan x V E (x,u,w,sigma_fan x V E u w)`, + +REPEAT STRIP_TAC +THEN MRESA_TAC nonsetedge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC zpoint_in_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`z:real^3`] +THEN MRESA_TAC v_subset_xfan[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC set_of_edge_subset_edges[`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`] +THEN MP_TAC (SET_RULE`V SUBSET xfan (x,(V:real^3->bool),(E:(real^3->bool)->bool)) /\ set_of_edge u V E SUBSET V==> set_of_edge u V E SUBSET xfan (x,V,E)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE` z IN yfan (x,(V:real^3->bool),(E:(real^3->bool)->bool)) /\ set_of_edge u V E SUBSET xfan (x,V,E)/\ yfan (x,V,E)= (:real^3) DIFF xfan (x,V,E) +==> ~(z IN set_of_edge u V E)`) +THEN ASM_REWRITE_TAC[yfan] +THEN STRIP_TAC +THEN MRESA_TAC exists_edge_component_yfan[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (u:real^3)`; `(z:real^3)`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[w_dart_fan] +THEN FIND_ASSUM MP_TAC(`(!v:real^3. v IN V==>CARD (set_of_edge v V E) >1)`) +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`u:real^3` th)) +THEN FIND_ASSUM MP_TAC(`(u:real^3) IN V`) +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[wedge;IN_ELIM_THM] +THEN MRESA_TAC point_in_yfan_and_point_in_xfan_indepent_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;` z:real^3`] +THEN MRESA_TAC aff_ge_1_1_subset_aff_fan[`y:real^3`;`x:real^3`;`u:real^3`] +THEN MRESA_TAC permutes_4points_collinear[`x:real^3`;`y:real^3`;`u:real^3`;`z:real^3`] +THEN MRESA_TAC not_azim_points_in_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` U:real^3->bool`;`y:real^3`;`z:real^3`;`u:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`) +THEN MRESA_TAC azim[`x:real^3`;`u:real^3`;`w:real^3`;`z:real^3`] +THEN REMOVE_ASSUM_TAC +THEN MP_TAC(REAL_ARITH`&0<= azim x u w z ==> azim x u w z = &0 \/ &0< azim x u w (z:real^3)`) +THEN RESA_TAC +THENL(*1*)[ MRESA_TAC AZIM_COMPL_EQ_0[`x:real^3`;`u:real^3`;`w:real^3`;`z:real^3`];(*1*) +ABBREV_TAC`w1=sigma_fan x V E u w:real^3` +THEN SUBGOAL_THEN`~(set_of_edge u V E = {w:real^3})`ASSUME_TAC +THENL(*2*)[ +STRIP_TAC +THEN FIND_ASSUM (MP_TAC)`CARD (set_of_edge (u:real^3) V E) > 1` +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN SUBGOAL_THEN `FINITE {(w:real^3)}` ASSUME_TAC +THENL (*3*)[SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY]; +MRESAL_TAC CARD_PSUBSET[`{}:real^3->bool`;`{w:real^3}`][SET_RULE`{} PSUBSET {w}`] +THEN MRESAL_TAC CARD_DELETE[`w:real^3`;`{w:real^3}`][SET_RULE`w IN {w}/\ {w} DELETE w= {}`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CARD_CLAUSES] +THEN ARITH_TAC];(*2*) + +MRESA_TAC SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w1:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC not_azim_points_in_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` U:real^3->bool`;`y:real^3`;`z:real^3`;`u:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w1:real^3`) +THEN REMOVE_THEN "YEU" (fun th-> MRESAL1_TAC th`w1:real^3`[azim1]) +THEN MP_TAC(REAL_ARITH`&2 * pi - azim x u z w <= &2 * pi - azim x u z w1==> azim x u z (w1:real^3) <= azim x u z w`) +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`u:real^3`;`z:real^3`;`w1:real^3`;` w:real^3`] +THEN MP_TAC(REAL_ARITH` azim x u z w = azim x u z w1 + azim x u w1 w /\ &0<= azim x u z w1 +==> &2 * pi - azim x u z w <= &2 * pi - azim x u w1 (w:real^3)`) +THEN ASM_REWRITE_TAC[azim] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(SYM(th))) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"BE") +THEN SUBGOAL_THEN`~(azim x u w1 (w:real^3)= &0)` ASSUME_TAC +THENL[ STRIP_TAC +THEN MRESA_TAC UNIQUE_AZIM_0_POINT_FAN[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(u:real^3)`;`(w1:real^3)`;`w:real^3`]; + +MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`z:real^3`;`w:real^3`] +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`w1:real^3`;`w:real^3`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&2 * pi - azim x u z w <= &2 * pi - azim x u w1 w + ==> &2 * pi - azim x u z w < &2 * pi - azim x u w1 w \/ azim x u z w = azim x u w1 (w:real^3)`) +THEN RESA_TAC +THEN REMOVE_THEN"BE" MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A+B=B<=>A= &0`]]]]);; + + + + + +let aff_gt_in_w_dart_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) u:real^3 w:real^3 y:real^3. +FAN(x,V,E) /\ {u,w} IN E +/\ y IN w_dart_fan x V E ((x:real^3),(u:real^3),(w:real^3),(sigma_fan x V E u w:real^3)) +/\ fan80(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> aff_gt {x} {u,y} SUBSET w_dart_fan x V E ((x:real^3),(u:real^3),(w:real^3),(sigma_fan x V E u w:real^3)) `, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "CON") +THEN DISCH_THEN(LABEL_TAC "BE") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "BE" MP_TAC +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `u:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge u V E = {w} \/ ~(set_of_edge u V E = {w:real^3})`) +THENL[ +MRESA_TAC CARD_SING[`w:real^3`; `(set_of_edge u V E):real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; +REMOVE_THEN "CON" MP_TAC +THEN ASM_REWRITE_TAC[SUBSET; w_dart_fan;wedge;IN_ELIM_THM;] +THEN STRIP_TAC THEN GEN_TAC THEN STRIP_TAC +THEN MRESA_TAC aff_gt_inter_aff_gt [`(x:real^3)`;`(u:real^3)`;`(y:real^3)`] +THEN MP_TAC(SET_RULE`aff_gt {x} {u, y} = aff_gt {x, u} {y} INTER aff_gt {x, y} {u} +/\ x' IN aff_gt {x} {u, y:real^3} ==> x' IN aff_gt {x,u} {y}`) THEN RESA_TAC +THEN MRESA_TAC aff_gt_imp_not_collinear[`x:real^3`;`y:real^3`;`u:real^3`; `x':real^3`] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`w:real^3`;`x':real^3`;`y:real^3`;]]);; + + + + + +let condition_rw_dart_fan_inter_aff_gt_is_not_empty=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 z:real^3 h:real. +FAN(x,V,E)/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) /\ ~collinear {x,v,z} +/\ {v,u} IN E /\ z IN w_dart_fan x V E (x,v,u,sigma_fan x V E v u) +/\ &0 +~(rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u ) (cos(h)) INTER aff_gt {x} {v,z}={})`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt_in_w_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`z:real^3`] +THEN MP_TAC(SET_RULE`aff_gt {x} {v, z} SUBSET w_dart_fan x V E (x,v,u,sigma_fan x V E v u) ==> +(w_dart_fan x V E (x,v,u,sigma_fan x V E v u) INTER + rcone_fan x v (cos h)) INTER + aff_gt {x} {v, z}= rcone_fan x v (cos h) INTER + aff_gt {x} {v, z:real^3}`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[rw_dart_fan;SET_RULE`~(A={})<=> ?y. y IN A`] +THEN MRESA_TAC not_empty_rcone_fan_inter_aff_gt[`x:real^3`;`v:real^3`;`z:real^3`;`h:real`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + + + +let exists_edge_rw_dart_fan_inter_aff_gt_not_empty_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool y:real^3 z:real^3 u:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +/\ u IN V +/\ y IN aff_ge {x} {u} +/\ y IN xfan(x,V,E) +/\ ~(y=x) +/\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan (x,V,E)) +==> ?w. {u,w} IN E /\ +(!h. &0 ~((rw_dart_fan x V E (x,u,w,sigma_fan x V E u w) (cos h)) INTER aff_gt {x} {u,z}={}))`, + +REPEAT STRIP_TAC +THEN MRESA_TAC exists_edge_bounded_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`;`u:real^3`] +THEN EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC THEN STRIP_TAC +THEN MATCH_MP_TAC condition_rw_dart_fan_inter_aff_gt_is_not_empty +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN MRESA_TAC point_in_yfan_and_point_in_xfan_indepent_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;` z:real^3`] +THEN MRESA_TAC aff_ge_1_1_subset_aff_fan[`y:real^3`;`x:real^3`;`u:real^3`] +THEN MRESA_TAC permutes_4points_collinear[`x:real^3`;`y:real^3`;`u:real^3`;`z:real^3`]);; + + + + + +let exists_edge_rw_dart_fan_inter_topological_component_not_empty_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool y:real^3 z:real^3 u:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +/\ u IN V +/\ y IN aff_ge {x} {u} +/\ y IN xfan(x,V,E) +/\ ~(y=x) +/\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan (x,V,E)) + +==> ?w. {u,w} IN E +/\(!h. &0 ~((rw_dart_fan x V E (x,u,w,sigma_fan x V E u w) (cos h)) INTER U={}))`, + +REPEAT STRIP_TAC +THEN MRESA_TAC nonsetedge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;` z:real^3`] +THEN MP_TAC(SET_RULE`~(x=z) /\ ~(y=x)==> DISJOINT {x} {y,z:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC aff_gt_subset_component_y_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC exists_edge_rw_dart_fan_inter_aff_gt_not_empty_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN EXISTS_TAC `w:real^3` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC THEN STRIP_TAC +THEN REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th`h:real`) +THEN MATCH_MP_TAC(SET_RULE`~(rw_dart_fan x V E (x,u,w,sigma_fan x V E u w) (cos h) INTER aff_gt {x} {u, z} = {}) +/\ aff_gt {x:real^3} {y, z} SUBSET U /\ aff_gt {x} {u, z} =aff_gt {x} {y, z} +==> ~(rw_dart_fan x V E (x,u,w,sigma_fan x V E u w) (cos h) INTER U = {})`) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC aff_gt_1_2_scale_fan +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN MRESA_TAC aff_ge_1_1_subset_aff_fan[`y:real^3`;`x:real^3`;`u:real^3`] +THEN MRESA_TAC point_in_yfan_and_point_in_xfan_indepent_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;` z:real^3`] +THEN MRESA_TAC permutes_4points_collinear[`x:real^3`;`y:real^3`;`u:real^3`;`z:real^3`] +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC `y IN aff_ge {x} {u:real^3}` +THEN FIND_ASSUM MP_TAC ` ~(x=u:real^3)` +THEN FIND_ASSUM MP_TAC ` ~(y=x:real^3)` +THEN REPEAT REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`u:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`t2:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH` (t1 % x + t2 % u) - x= ((t1+t2)- &1) %x+ t2%(u-x)`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0<= t2==> t2= &0 \/ &0< t2`) +THEN RESA_TAC +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[] +THEN VECTOR_ARITH_TAC);; + + + + + + +let exists_dart_leads_into_edge_eq_topological_component_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool y:real^3 z:real^3 u:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +/\ u IN V +/\ y IN aff_ge {x} {u} +/\ y IN xfan(x,V,E) +/\ ~(y=x) +/\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan(x,V,E)) +==> ?w. {u,w} IN E /\ dart_leads_into x V E u w = U`, + +REPEAT STRIP_TAC +THEN MRESA_TAC exists_edge_rw_dart_fan_inter_topological_component_not_empty_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`;`u:real^3`;] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MA") +THEN MRESA_TAC not_empty_rw_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC DART_LEADS_INTO[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`u:real^3`;`w:real^3`;] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC rw_dart_avoids_fan[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"OI") +THEN MP_TAC(REAL_ARITH`&1> h' /\ h' > &0==> -- &1 < h' /\ h'< &1 /\ -- &1 <= h' /\ h'<= &1/\ &0 < h' /\ h' <= &1`) THEN RESA_TAC +THEN MRESA1_TAC ACS_BOUNDS_LT`h':real` +THEN MRESAL_TAC ACS_MONO_LT[`&0`;`h':real`][ACS_0;REAL_ARITH`-- &1 <= &0`] +THEN MRESA1_TAC COS_ACS `h':real` +THEN ABBREV_TAC`h1= min (h:real) (acs h')/ &2` +THEN MP_TAC(REAL_ARITH`h1= min (h:real) (acs h')/ &2 /\ &0 &0< h1 /\ h1< h /\ h1 h'<= cos h1`) THEN RESA_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESAL1_TAC th `h1:real`[SET_RULE`~(A={})<=> ?y. y IN A`]) +THEN REMOVE_THEN "YEU"(fun th-> MRESA_TAC th [`h1:real`;`y':real^3`]) +THEN EXISTS_TAC `w:real^3` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "EM") +THEN DISCH_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN POP_ASSUM(fun th -> REWRITE_TAC[SYM(th);]) +THEN DISCH_TAC +THEN MRESA_TAC expand_element_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`U:real^3->bool`;`z:real^3`] +THEN REMOVE_THEN "MA"(fun th-> MRESA1_TAC th `h1:real`) +THEN MP_TAC(SET_RULE`rw_dart_fan x V E (x,u,w,sigma_fan x V E u w) (cos h1) SUBSET + connected_component (yfan (x,V,E)) y'/\ +~(rw_dart_fan x V E (x,u,w,sigma_fan x V E u w) (cos h1) INTER + connected_component (yfan (x,V,E)) z = + {}) +==> +~( connected_component (yfan (x,V,E)) y' INTER + connected_component (yfan (x,V,E)) z = + {})`) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[CONNECTED_COMPONENT_OVERLAP] +THEN SET_TAC[]);; + + +(*CASE 2*) + + + +let not_azim_points1_in_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool y:real^3 z:real^3 u:real^3 w:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +/\ {u,w} IN E +/\ y IN aff_gt {x} {u,w} +/\ y IN xfan (x,V,E) +/\ ~(y=x) + /\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan (x,V,E)) +==> ~(azim x y z w= &0)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"YEU") +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC nonsetedge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;` z:real^3`] +THEN MRESA_TAC point_in_yfan_and_point_in_xfan_indepent_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;` z:real^3`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`w:real^3`;`u:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;] +THEN STRIP_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`y:real^3`;`z:real^3`;`w:real^3`] +THEN STRIP_TAC +THEN MRESA_TAC th3[`x:real^3`;`y:real^3`;`w:real^3`] +THEN MRESA_TAC aff_ge_2_1_is_exists_point_inaff_ge_1_2[`x:real^3`;`y:real^3`;`z:real^3`;`w:real^3`] +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`x:real^3`;`u:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE`aff_ge {x} {u, w} = + aff_gt {x} {u, w} UNION aff_ge {x} {u} UNION aff_ge {x} {w} +/\ y IN aff_gt {x} {u,w}==> y IN aff_ge {x:real^3} {u,w}`) +THEN POP_ASSUM(fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN RESA_TAC +THEN MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`u:real^3`; `w:real^3`;`y:real^3`] +THEN SUBGOAL_THEN`aff_ge {x} {u,w} SUBSET xfan(x:real^3,V:real^3->bool,E)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[xfan; SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`{u,w:real^3}` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN SET_TAC[IN]; +MP_TAC(SET_RULE`(&1 - t) % y + t % z IN aff_ge {x:real^3} {y, w}/\ aff_ge {x} {y, w} SUBSET aff_ge {x} {u, w} /\aff_ge {x} {u, w} SUBSET xfan (x,V:real^3->bool,E) +==> (&1 - t) % y + t % z IN xfan (x,V,E)`) +THEN RESA_TAC +THEN REMOVE_THEN "YEU"(fun th -> MRESA1_TAC th`t:real` ) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[yfan] +THEN SET_TAC[]]);; + + + +let not_azim_points2_in_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool y:real^3 z:real^3 u:real^3 w:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +/\ {u,w} IN E +/\ y IN aff_gt {x} {u,w} +/\ y IN xfan (x,V,E) +/\ ~(y=x) + /\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan (x,V,E)) +==> ~(azim x y z u= &0)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN MATCH_MP_TAC not_azim_points1_in_yfan +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN EXISTS_TAC`U:real^3->bool` +THEN EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]);; + + + + + + + + + + + + + + +let exists_dart_leads_into_edge_eq_topological1_component_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool y:real^3 z:real^3 v:real^3 u:real^3 w:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ y IN aff_gt {x} {v,u} +/\ y IN xfan(x,V,E) +/\ ~(y=x) +/\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan(x,V,E)) +/\ &0<((v-x) cross (y-x)) dot (z-x) + +==> dart_leads_into x V E v u = U`, + + +REPEAT STRIP_TAC +THEN MRESA_TAC connected_component_of_faces_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN MRESA_TAC fan_run_in_small_is_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"HA") +THEN MRESA_TAC not_empty_rw_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC DART_LEADS_INTO[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`u:real^3`;`w:real^3`;] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC rw_dart_avoids_fan[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"OI") +THEN MP_TAC(REAL_ARITH`&1> h'' /\ h'' > &0==> -- &1 < h'' /\ h''< &1 /\ -- &1 <= h'' /\ h''<= &1/\ &0 < h'' /\ h'' <= &1`) THEN RESA_TAC +THEN MRESA1_TAC ACS_BOUNDS_LT`h'':real` +THEN MRESAL_TAC ACS_MONO_LT[`&0`;`h'':real`][ACS_0;REAL_ARITH`-- &1 <= &0`] +THEN MRESA1_TAC COS_ACS `h'':real` +THEN ABBREV_TAC`h1= min h (min (h':real) (acs h''))/ &2` +THEN MP_TAC(REAL_ARITH`h1= min h (min (h':real) (acs h''))/ &2 /\ &0< h /\ &0 &0< h1 /\ h1< h /\ h1 h''<= cos h1`) THEN RESA_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESAL1_TAC th `h1:real`[SET_RULE`~(A={})<=> ?y. y IN A`]) +THEN REMOVE_THEN "YEU"(fun th-> MRESA_TAC th [`h1:real`;`y':real^3`]) +THEN MRESA_TAC exists_rw_dart_inter_aff_gt1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;` w:real^3`;`h1:real`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MA1") +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC point_in_yfan_and_point_in_xfan_indepent_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;` z:real^3`] +THEN MRESA_TAC exists_open_not_collinear[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`] +THEN SUBGOAL_THEN`(!h. &0 < h /\ h < t1 / &2 ==> ~collinear {x, v, (&1 - h) % u + h % w:real^3})`ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CHANGE") +THEN GEN_TAC THEN STRIP_TAC +THEN REMOVE_THEN "CHANGE"(fun th-> MRESA1_TAC th`h'''':real`) +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +MP_TAC(REAL_ARITH`&0< t1 /\ t1<= &1==> &0< t1/ &2 /\ t1/ &2 < &1`) +THEN RESA_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN RESA_TAC +THEN MRESA_TAC condition_4point_aff_gt_1_2inter_aff_gt_1_2[`x:real^3`;`y:real^3`;`z:real^3`;`v:real^3`;` u:real^3`;`w:real^3`;`t1/ &2:real`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MA2") +THEN ABBREV_TAC`t2=min h ( min h''' t) / &2:real` +THEN MP_TAC(REAL_ARITH`t2=min h ( min h''' t) / &2:real /\ &0 t2< h''' /\ t2< t /\ &0< t2/\ t2< h`) +THEN RESA_TAC +THEN REMOVE_THEN "MA1"(fun th-> MRESA1_TAC th `t2:real`) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y1. y1 IN A`;INTER;IN_ELIM_THM] +THEN RESA_TAC +THEN REMOVE_THEN "MA2"(fun th-> MRESA1_TAC th `t2:real`) +THEN MRESA_TAC nonsetedge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;` z:real^3`] +THEN MP_TAC(SET_RULE`~(x=z) /\ ~(y=x)==> DISJOINT {x} {y,z:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC aff_gt_subset_component_y_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`] +THEN MP_TAC(SET_RULE`~(aff_gt {x} {y, z} INTER aff_gt {x} {v, (&1 - t2) % u + t2 % w} = {})/\ +aff_gt {x} {y, z} SUBSET U==> ~(U INTER aff_gt {x:real^3} {v, (&1 - t2) % u + t2 % w} = {})`) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y2. y2 IN A`;INTER;IN_ELIM_THM] +THEN RESA_TAC +THEN MRESA_TAC expand_element_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`U:real^3->bool`;`y2:real^3`] +THEN MRESA_TAC dart_leads_into_fan_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN MP_TAC(SET_RULE`y1 IN rw_dart_fan x V E (x,u,w,v) (cos h1) +/\ rw_dart_fan x V E (x,u,w,v) (cos h1) SUBSET (dart_leads_into x V E u w) +==> y1 IN (dart_leads_into x V E u (w:real^3))`) +THEN RESA_TAC +THEN MRESA_TAC expand_element_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(dart_leads_into x V E u w):real^3->bool`;`y1:real^3`] +THEN MRESA_TAC zpoint_in_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y2:real^3`] +THEN MRESA_TAC zpoint_in_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(dart_leads_into x V E u w):real^3->bool`;`y1:real^3`] +THEN ASM_REWRITE_TAC[CONNECTED_COMPONENT_EQ_EQ] +THEN MRESA_TAC CONVEX_AFF_GT[`{x:real^3}`;`{v, (&1 - t2) % u + t2 % w:real^3}`] +THEN MRESA_TAC CONVEX_CONNECTED[`aff_gt {x} {v, (&1 - t2) % u + t2 % w}:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONNECTED_IFF_CONNECTED_COMPONENT] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`y1:real^3`;`y2:real^3`]) +THEN REMOVE_THEN "HA" (fun th-> MRESA1_TAC th `t2:real`) +THEN MRESA_TAC CONNECTED_COMPONENT_OF_SUBSET[`aff_gt {x} {v, (&1 - t2) % u + t2 % w:real^3}:real^3-> bool`;`yfan (x:real^3,(V:real^3->bool),(E:(real^3->bool)->bool)):real^3->bool`;`y1:real^3`;`y2:real^3`] +]);; + + + + + +let JUTSTKG=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +==> ?v u. {v,u} IN E /\ dart_leads_into x V E v u = U`, + +REPEAT STRIP_TAC +THEN MRESA_TAC exists_point_in_component_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)` ;`U:real^3->bool`] +THEN MRESA_TAC connect_insidepoint_to_bound_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)` ;`U:real^3->bool`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN ASSUME_TAC th) +THEN REWRITE_TAC[xfan;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[IN] +THEN RESA_TAC +THEN SUBGOAL_THEN `{v,w:real^3} IN E`ASSUME_TAC +THENL(*1*)[POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th);IN]);(*1*) +MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN MRESAL_TAC aff_ge_eq_aff_gt_union_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`][UNION;IN_ELIM_THM] +THEN STRIP_TAC +THENL(*2*)[ +STRIP_TAC +THEN MRESA_TAC point_in_yfan_and_point_in_xfan_indepent_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;` z:real^3`] +THEN DISJ_CASES_TAC(REAL_ARITH`&0 < ((v - x) cross (y - x)) dot (z - x) \/ &0< --(((v - x) cross (y - x)) dot (z - x)) \/ ((v - x:real^3) cross (y - x)) dot (z - x)= &0`) +THENL(*3*)[ +MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC exists_dart_leads_into_edge_eq_topological1_component_fan[`x:real^3`;`(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`;`v:real^3`;`w:real^3`;`inverse1_sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (w:real^3) (v:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*3*) + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL(*4*)[ +MRESA_TAC aff_gt_1_2_cross_dotr_4point_neg[`x:real^3`;`y:real^3`;`z:real^3`;`v:real^3`;`w:real^3`;] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`) +THEN STRIP_TAC +THEN MRESA_TAC exists_dart_leads_into_edge_eq_topological1_component_fan[`x:real^3`;`(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`;`w:real^3`;`v:real^3`;`inverse1_sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*4*) + +MRESA_TAC aff_gt_1_2_cross_dotr_4point_zero[`x:real^3`;`y:real^3`;`z:real^3`;`v:real^3`;`w:real^3`;] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN RESA_TAC +THEN MRESA_TAC not_azim_points1_in_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC not_azim_points1_in_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`;`w:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`~(azim x y z v = &0) /\ &0<= azim x y z v==> &0< azim x y z (v:real^3) `) +THEN ASM_REWRITE_TAC[azim] +THEN STRIP_TAC +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`w:real^3`;`y:real^3`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`w:real^3`;`v:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`azim x y z (v:real^3)< pi \/ pi<= azim x y z (v:real^3)`) +THENL(*5*)[ +MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`y:real^3`; `v:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*5*) + +POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt2_subset_aff_ge [`x:real^3`;`w:real^3`; `v:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`y:real^3`;`z:real^3`;`w:real^3`;`v:real^3`] +THEN MP_TAC(REAL_ARITH`azim x y z v = azim x y z w + pi/\ +azim x y z v < &2 * pi/\ ~(azim x y z w = &0) /\ &0 <= azim x y z w +==> &0< azim x y z w /\ azim x y z w < pi +`) +THEN ASM_REWRITE_TAC[azim] +THEN STRIP_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`y:real^3`; `w:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC](*5*)](*4*)](*3*);(*2*) + + +STRIP_TAC +THEN MRESA_TAC exists_dart_leads_into_edge_eq_topological_component_fan[`x:real^3`;`(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`;`v:real^3`] +THEN EXISTS_TAC `v:real^3` +THEN EXISTS_TAC `w':real^3` +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`; +` (w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC exists_dart_leads_into_edge_eq_topological_component_fan[`x:real^3`;`(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`;`w:real^3`] +THEN EXISTS_TAC `w:real^3` +THEN EXISTS_TAC `w':real^3` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]]]);; + + + + +end;; + + diff --git a/legacy/oldfan/LEMMA.hl b/legacy/oldfan/LEMMA.hl new file mode 100755 index 0000000..4416ad0 --- /dev/null +++ b/legacy/oldfan/LEMMA.hl @@ -0,0 +1,4744 @@ + +module Lemma_fan = struct + +open Sphere;; +open Fan_defs;; +open Tactic_fan;; + + +(* ========================================================================== *) +(* COLLINEAR *) +(* ========================================================================== *) + +let th3a12=prove(`!x v u.(~ collinear {x,v,u} ==> DISJOINT {x,u} {v})`, + (let th=prove(`{x,v,u}={x,v,u}`, SET_TAC[]) in +REPEAT GEN_TAC THEN REWRITE_TAC[th;IN_DISJOINT] THEN MATCH_MP_TAC MONO_NOT THEN +REWRITE_TAC[COLLINEAR_3;COLLINEAR_LEMMA; VECTOR_ARITH` a-b= vec 0 <=> a = b`; IN_SING] THEN STRIP_TAC + THEN REPEAT(POP_ASSUM MP_TAC) THEN DISCH_THEN(LABEL_TAC "a") THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC +THEN ASM_REWRITE_TAC[] THEN SET_TAC[]));; + + +let th3a=prove(`!x v u.(~ collinear {x,v,u} ==> DISJOINT {x,v} {u})`, + (let th=prove(`{x,v,u}={x,u,v}`, SET_TAC[]) in +REPEAT GEN_TAC THEN REWRITE_TAC[th;IN_DISJOINT] THEN MATCH_MP_TAC MONO_NOT THEN +REWRITE_TAC[COLLINEAR_3;COLLINEAR_LEMMA; VECTOR_ARITH` a-b= vec 0 <=> a = b`; IN_SING] THEN STRIP_TAC + THEN REPEAT(POP_ASSUM MP_TAC) THEN DISCH_THEN(LABEL_TAC "a") THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC +THEN ASM_REWRITE_TAC[] THEN SET_TAC[]));; + let th3b=prove(`!x v u. ~ collinear {x,v,u} ==> ~(x=v) `, +REPEAT GEN_TAC THEN REWRITE_TAC[COLLINEAR_3;COLLINEAR_LEMMA; VECTOR_ARITH` a-b= vec 0 <=> a = b`; DE_MORGAN_THM] THEN SET_TAC[]);; +let th3b1=prove(`!x v u. ~ collinear {x,v,u} ==> ~(x=u) `, +(let th=prove(`{x,v,u}={x,u,v}`, SET_TAC[]) in +REWRITE_TAC[th;th3b]));; + + let th3c= prove(`!x v u. ~ collinear {x,v,u} ==> ~(u IN aff {x,v})`, +REPEAT GEN_TAC THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff; AFFINE_HULL_2; IN_ELIM_THM;COLLINEAR_3;COLLINEAR_LEMMA; VECTOR_ARITH` a-b= vec 0 <=> a = b`; DE_MORGAN_THM] +THEN STRIP_TAC THEN REPEAT(POP_ASSUM MP_TAC) THEN REWRITE_TAC[REAL_ARITH `u'+v'= &1 <=> v'= &1 -u'`] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[VECTOR_ARITH`(u = u' % x + (&1 - u') % v) <=> (u - v = u' % (x-v))`] THEN SET_TAC[]);; + + +let th3d=prove(`!x v u. ~(x=v)/\ ~(x=u) ==> DISJOINT {x} {v,u}`, +SET_TAC[]);; + +let th3=prove(`!x v u. ~ collinear {x,v,u} ==> ~ (x=v) /\ ~(x=u) /\ DISJOINT {x,v} {u}/\ DISJOINT {x,u} {v} /\DISJOINT {x} {v,u} /\ ~(u IN aff {x,v})`, +MESON_TAC[th3a;th3b;th3b1;th3c;th3d;th3a12]);; + + +let collinear1_fan=prove(`!x v u. ~ collinear {x,u,v} <=> ~(u IN aff {x,v})/\ ~ (x=v)`, +(let lem=prove(`!x v u. {x,v,u}= {x,u,v}`,SET_TAC[]) in +REPEAT GEN_TAC THEN EQ_TAC +THENL[ +MESON_TAC[th3;lem]; +REWRITE_TAC[SET_RULE`~(t1) /\ ~ t2<=> ~(t2\/ t1)`;COLLINEAR_3_EXPAND;aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN MATCH_MP_TAC MONO_NOT THEN MATCH_MP_TAC MONO_OR THEN STRIP_TAC +THENL[ +REWRITE_TAC[]; + +STRIP_TAC THEN EXISTS_TAC`u':real` THEN EXISTS_TAC`&1- (u':real)` THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC]]));; + + +let collinear_fan=prove(`!x v u. ~ collinear {x,v,u} <=> ~(u IN aff {x,v})/\ ~ (x=v)`, +(let lem=prove(`!x v u. {x,v,u}= {x,u,v}`,SET_TAC[]) in +MESON_TAC[collinear1_fan;lem]));; + + + + +let properties_inside_collinear0_fan=prove(`!(x:real^3) (u:real^3) (w:real^3) a:real. +&0 ~collinear{x,(&1 - a) % u + a % w,u}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[collinear1_fan] +THEN STRIP_TAC THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v % u +<=> a % w = u' % x + (v+a- &1) % u`] +THEN MP_TAC(REAL_ARITH`&0< a ==> ~(a= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +a % w = u' % x + (v+a- &1) % u:real^3 +==> (inv ( a))%(a % w) = (inv (a))%(u' % x + (v+a- &1) % u) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC `(inv a * (u':real))` +THEN EXISTS_TAC `(inv a * (v +a - &1 :real))` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv a * (u') + inv a * (v +a - &1)=inv a* (a+ (u'+v) - &1)`;REAL_ARITH`t3'+ &1 - &1=t3'`]);; + + +let properties_inside_collinear1_fan=prove(`!(x:real^3) (u:real^3) (w:real^3) a:real. +&0 ~collinear{x,(&1 - a) % u + a % w,w}`, +REPEAT STRIP_TAC THEN +MRESAL_TAC properties_inside_collinear0_fan[`(x:real^3)`;` (w:real^3)`;`(u:real^3)`;`&1-a:real`][VECTOR_ARITH`(&1 - (&1 - a)) % w + (&1 - a) % u=(&1 - a) % u + a % w`;] +THENL[ ASM_TAC THEN REAL_ARITH_TAC; +STRIP_TAC THENL[ASM_TAC THEN REAL_ARITH_TAC; +ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[]]]);; + + + +let properties_inside_collinear_fan=prove(`!(x:real^3) (u:real^3) (w:real^3) a:real. +&0 ~collinear{x,(&1 - a) % u + a % w,u} +/\ ~collinear{x,(&1 - a) % u + a % w,w}`, + +MESON_TAC[SET_RULE`{A,B,C}={A,C,B}`;properties_inside_collinear0_fan;properties_inside_collinear1_fan] +);; + + +let notcoplanar_imp_notcollinear_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3. +~coplanar {x,v,u,w}==> ~collinear {x,u,w} /\ ~collinear {x,v,u} +/\ ~collinear {x,v,w}`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`x:real^3`;`u:real^3`;`w:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN RESA_TAC +THEN MRESAL_TAC NOT_COPLANAR_NOT_COLLINEAR [`x:real^3`;`v:real^3`;`w:real^3`;`u:real^3`][SET_RULE`{A,B,C,D}={A,B,D,C}`]);; + + + + +(* ========================================================================== *) +(* COLLINEAR and CONTINUOUS *) +(* ========================================================================== *) + + + +let collinear_continuous_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 c:real. +(\(t:real^1). (&1- drop(t))%u + drop(t) %w - (&1 -c)%x - c% v) continuous_on (:real^1)`, + SIMP_TAC[CONTINUOUS_ON_EQ_CONTINUOUS_AT;OPEN_UNIV;DIMINDEX_1] +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[drop] +THEN MATCH_MP_TAC CONTINUOUS_ADD +THEN STRIP_TAC +THENL[ + MATCH_MP_TAC CONTINUOUS_VMUL +THEN REWRITE_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS1] +THEN MATCH_MP_TAC REAL_CONTINUOUS_SUB +THEN SIMP_TAC[REAL_CONTINUOUS_CONST;REAL_CONTINUOUS_AT_COMPONENT; DIMINDEX_1; ARITH]; +REPEAT(MATCH_MP_TAC CONTINUOUS_SUB +THEN SIMP_TAC[CONTINUOUS_CONST]) +THEN MATCH_MP_TAC CONTINUOUS_VMUL +THEN REWRITE_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS1] +THEN SIMP_TAC[REAL_CONTINUOUS_AT_COMPONENT; DIMINDEX_1; ARITH]]);; + + + +let collinear1_continuous_fan=prove(`!u:real^3 w:real^3 t:real^1. +(\(t:real^1). (&1- drop(t))%u + drop(t) %w) continuous at t`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[drop] +THEN MATCH_MP_TAC CONTINUOUS_ADD +THEN STRIP_TAC +THENL[ + MATCH_MP_TAC CONTINUOUS_VMUL +THEN REWRITE_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS1] +THEN MATCH_MP_TAC REAL_CONTINUOUS_SUB +THEN SIMP_TAC[REAL_CONTINUOUS_CONST;REAL_CONTINUOUS_AT_COMPONENT; DIMINDEX_1; ARITH]; + MATCH_MP_TAC CONTINUOUS_VMUL +THEN REWRITE_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS1] +THEN SIMP_TAC[REAL_CONTINUOUS_CONST;REAL_CONTINUOUS_AT_COMPONENT; DIMINDEX_1; ARITH]]);; + + + +let CONTINUOUS_CLOSED_PREIMAGE_CONSTANT = prove + (`!f:real^M->real^N s a. + f continuous_on s /\ closed s ==> closed {x | x IN s /\ f(x) = a}`, + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `{x | x IN s /\ (f:real^M->real^N)(x) = a} = {}` THEN + ASM_REWRITE_TAC[CLOSED_EMPTY] THEN ONCE_REWRITE_TAC[SET_RULE + `{x | x IN s /\ f(x) = a} = {x | x IN s /\ f(x) IN {a}}`] THEN + MATCH_MP_TAC CONTINUOUS_CLOSED_PREIMAGE THEN + ASM_REWRITE_TAC[CLOSED_SING] THEN SET_TAC[]);; + +let open_collinear_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 c:real. +open{t| ~((\(t:real^1). (&1- drop(t))%u + drop(t) %w - (&1 -c)%x - c% v)(t)= vec 0)}`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[OPEN_CLOSED;DIFF; IN_ELIM_THM;] +THEN MP_TAC(ISPECL[`(\(t:real^1). (&1- drop(t))%u + drop(t) %w - (&1 -c)%x - c% v:real^3)`;`(:real^1)`; +`((vec 0):real^3)`]CONTINUOUS_CLOSED_PREIMAGE_CONSTANT) +THEN SIMP_TAC[CLOSED_UNIV; DIMINDEX_1; collinear_continuous_fan]);; + + +let open_vector_angle_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 c:real a:real. +(!t. ~((&1 - t) % u + t % w = x)) +==> +open{t| ~((\(t:real^1). vector_angle (v - x) (((&1 - drop(t)) % u + drop(t) % w) - x))(t) = a)}`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[OPEN_CLOSED;DIFF; IN_ELIM_THM;] +THEN MP_TAC(ISPECL[`lift o (\(t:real^1). vector_angle (v - x:real^3) (((&1 - drop(t)) % u + drop(t) % w) - x))`;`(:real^1)`; +`lift (a:real)`]CONTINUOUS_CLOSED_PREIMAGE_CONSTANT) +THEN REWRITE_TAC[o_DEF;LIFT_EQ] +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN SIMP_TAC[CLOSED_UNIV; DIMINDEX_1;] +THEN REWRITE_TAC[GSYM o_DEF] +THEN REWRITE_TAC[GSYM FORALL_LIFT_FUN] +THEN MP_TAC(ISPECL[`x:real^3 `;`v:real^3 `;`u:real^3`;` w:real^3`;` &0`]collinear_continuous_fan) +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN SIMP_TAC[CONTINUOUS_ON_EQ_CONTINUOUS_AT;OPEN_UNIV;DIMINDEX_1] +THEN MATCH_MP_TAC MONO_FORALL +THEN GEN_TAC +THEN DISCH_THEN (LABEL_TAC"MA") +THEN STRIP_TAC +THEN REMOVE_THEN "MA" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(\(t:real^1). ((&1- drop(t))%(u:real^3) + drop(t) %(w:real^3)) - (x:real^3) )`;`(\(t:real^3). lift (vector_angle ((v:real^3)-(x:real^3)) t))`;`x':real^1`] CONTINUOUS_AT_COMPOSE) +THEN ASM_REWRITE_TAC[GSYM o_ASSOC] +THEN REWRITE_TAC[o_DEF] +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`;GSYM(o_DEF)] +THEN REWRITE_TAC[GSYM(REAL_CONTINUOUS_CONTINUOUS1);GSYM(I_DEF);I_O_ID] +THEN MATCH_MP_TAC(ISPECL[`(v:real^3)-(x:real^3)`;`(&1 - drop x') % u + drop x' % w - x:real^3 +`]REAL_CONTINUOUS_AT_VECTOR_ANGLE) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A+B-C= vec 0<=> A+B=C:real^3`]);; + + + + + +(* ========================================================================== *) +(* CYCLIC SET *) +(* ========================================================================== *) + +let subset_cyclic_set_fan=prove(`!x:real^3 v:real^3 V:real^3->bool W:real^3->bool. +V SUBSET W /\ cyclic_set W x v ==> cyclic_set V x v`, + +REPEAT GEN_TAC THEN REWRITE_TAC[cyclic_set] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`V:real^3->bool`;`W:real^3->bool`]FINITE_SUBSET) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN SET_TAC[]);; + + + +let property_of_cyclic_set=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. + cyclic_set {u, w1, w2} x v +==> ~(v=x) /\ ~(u=x)/\ ~collinear {vec 0, v-x, u-x}`, + +(let th= prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. +x IN {x,w1,w2}`, SET_TAC[]) in + +(let th1=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. +x IN affine hull {x,v} +`,REPEAT GEN_TAC THEN REWRITE_TAC[AFFINE_HULL_2;INTER; IN_ELIM_THM] THEN EXISTS_TAC`&1` THEN EXISTS_TAC `&0` THEN + MESON_TAC[REAL_ARITH`&1+ &0= &1`; VECTOR_ARITH`x= &1 % x + &0 % v`]) +in + +(let th2=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. +x IN {x,w1,w2} INTER affine hull {x,v} +`, REWRITE_TAC[INTER;IN_ELIM_THM] THEN REWRITE_TAC[th;th1]) in + + +REPEAT GEN_TAC THEN +REWRITE_TAC[COLLINEAR_LEMMA;DE_MORGAN_THM;VECTOR_ARITH`a-b=vec 0 <=> a=b`;cyclic_set;] THEN STRIP_TAC + THEN ASM_REWRITE_TAC[VECTOR_ARITH`(v:real^3)=(x:real^3) <=> x=v`] THEN STRIP_TAC +THENL[ STRIP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") THEN DISCH_TAC +THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3`; `w1:real^3`; `w2:real^3`] th2) THEN ASM_TAC THEN SET_TAC[]; + +STRIP_TAC THENL[ + +STRIP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") THEN DISCH_TAC +THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3`; `w1:real^3`; `w2:real^3`] th2) THEN ASM_TAC THEN SET_TAC[]; + +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"a") +THEN DISCH_TAC +THEN REMOVE_THEN "a" MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`(c:real) % ((v:real^3)-(x:real^3))=(u:real^3)-x <=> u = (&1 - c) % x+c % v`] +THEN DISCH_TAC +THEN SUBGOAL_THEN `(u:real^3) IN affine hull {(x:real^3),(v:real^3)}` ASSUME_TAC +THENL[ +REWRITE_TAC[AFFINE_HULL_2; IN_ELIM_THM] +THEN EXISTS_TAC `&1 - (c:real)` +THEN EXISTS_TAC`c:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - (c:real) +c= &1`;]; + +MP_TAC(ISPECL[`u:real^3`; `v:real^3`; `u:real^3`; `w1:real^3`; `w2:real^3`]th) +THEN DISCH_TAC +THEN ASM_TAC +THEN SET_TAC[INTER] +]]]))));; + +let property_of_cyclic_set1=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. + cyclic_set {u, w1, w2} x v ==> ~collinear {x, v, w1}`, + +(let th=prove(`{u,w1,w2}={w1,u,w2}`,SET_TAC[]) in + +REPEAT GEN_TAC THEN DISCH_TAC +THEN MP_TAC (SPECL [`x:real^3`; `v:real^3`; `w1:real^3`;`u:real^3`; `w2:real^3`] property_of_cyclic_set) THEN ASM_REWRITE_TAC[th] THEN STRIP_TAC THEN ASM_REWRITE_TAC[COLLINEAR_3]));; + +let property_of_cyclic_set2=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. + cyclic_set {u, w1, w2} x v +==> ~collinear {x, v, w2}`, +( let th=prove(`{u,w1,w2}={w2,w1,u}`,SET_TAC[]) in +( let th1=prove(`{u,w1,w2}={w1,w2,u}`,SET_TAC[]) in + +REPEAT GEN_TAC THEN DISCH_TAC +THEN MP_TAC (SPECL [`x:real^3`; `v:real^3`; `w2:real^3`;`w1:real^3`; `u:real^3`] property_of_cyclic_set) +THEN ASM_REWRITE_TAC[th] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN MESON_TAC[th1;COLLINEAR_3])));; + +let property_of_cyclic_set3=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. + cyclic_set {u, w1, w2} x v +==> ~ collinear {x, v, u}`, +( let th=prove(`{u,w1,w2}={w1,u,w2}`,SET_TAC[]) in + +REPEAT GEN_TAC THEN DISCH_TAC +THEN MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`;`w1:real^3`; `w2:real^3`] property_of_cyclic_set) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_MESON_TAC[COLLINEAR_3;th]));; + + + +let properties_of_cyclic_set=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. + cyclic_set {u, w1, w2} x v +==> ~(v=x) /\ ~(u=x)/\ ~collinear {vec 0, v-x, u-x} +/\ ~collinear {x, v, u} +/\ ~collinear {x, v, w1} +/\ ~collinear {x, v, w2}`, + +MESON_TAC[property_of_cyclic_set;property_of_cyclic_set2;property_of_cyclic_set1;property_of_cyclic_set3]);; + + + + + + + +(* ========================================================================== *) +(* the properties in normal vector *) +(* ========================================================================== *) + + + +let imp_norm_not_zero_fan=prove(`!v:real^3 x:real^3. ~(v = x) ==> ~(norm ( v - x) = &0)`, +REPEAT GEN_TAC THEN REPEAT STRIP_TAC THEN SUBGOAL_THEN `(v:real^3)-(x:real^3)= vec 0` ASSUME_TAC THENL + [POP_ASSUM MP_TAC THEN MESON_TAC[NORM_EQ_0]; + SUBGOAL_THEN `(v:real^3) = (x:real^3)` ASSUME_TAC THENL + [POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC; + ASM_TAC THEN SET_TAC[]]]);; + + +let imp_norm_gl_zero_fan=prove(`!v:real^3 x:real^3. ~(v = x) ==> inv(norm ( v - x)) > &0`, +REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `~(norm ( (v:real^3) - (x:real^3)) = &0)` ASSUME_TAC THENL + [ASM_MESON_TAC[imp_norm_not_zero_fan]; + MP_TAC (ISPEC `(v:real^3)-(x:real^3)` NORM_POS_LE) THEN DISCH_TAC THEN + SUBGOAL_THEN `norm((v:real^3)-(x:real^3))> &0` ASSUME_TAC THENL + [POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + MP_TAC (ISPEC `norm((v:real^3)-(x:real^3))` REAL_LT_INV_EQ) THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]);; + + +let imp_inv_norm_not_zero_fan=prove(`!v:real^3 x:real^3. ~(v = x) ==> ~(inv(norm ( v - x)) = &0)`, +REPEAT GEN_TAC THEN DISCH_TAC THEN SUBGOAL_THEN `inv(norm ((v:real^3) - (x:real^3))) > &0` ASSUME_TAC +THENL + [ASM_MESON_TAC[imp_norm_gl_zero_fan]; + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]);; + + +let imp_norm_ge_zero_fan=prove(`!v:real^3 x:real^3. ~(v = x) ==> inv(norm ( v - x)) >= &0`, +REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `~(norm ( (v:real^3) - (x:real^3)) = &0)` ASSUME_TAC THENL + [ASM_MESON_TAC[imp_norm_not_zero_fan]; + MP_TAC (ISPEC `(v:real^3)-(x:real^3)` NORM_POS_LE) THEN DISCH_TAC THEN + SUBGOAL_THEN `norm((v:real^3)-(x:real^3))> &0` ASSUME_TAC THENL + [POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + MP_TAC (ISPEC `norm((v:real^3)-(x:real^3))` REAL_LT_INV_EQ) THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]]);; + +let norm_of_normal_vector_is_unit_fan=prove(`!v:real^3 x:real^3. ~(v = x) ==> norm(inv(norm ( v - x))% (v-x))= &1`, +REPEAT GEN_TAC THEN DISCH_TAC THEN REWRITE_TAC[NORM_MUL] THEN SUBGOAL_THEN ` inv(norm ( (v:real^3) - (x:real^3))) >= &0` ASSUME_TAC THENL[ ASM_MESON_TAC[imp_norm_ge_zero_fan]; + SUBGOAL_THEN ` ~(norm ( (v:real^3) - (x:real^3))= &0)` ASSUME_TAC THENL + [ASM_MESON_TAC[imp_norm_not_zero_fan]; + SUBGOAL_THEN ` abs(inv(norm ( (v:real^3) - (x:real^3))))= inv(norm ( (v:real^3) - (x:real^3)))` ASSUME_TAC THENL + [ASM_MESON_TAC[REAL_ABS_REFL;REAL_ARITH `(a:real)>= &0 <=> &0 <= a`; ]; + MP_TAC(ISPEC `norm ( (v:real^3) - (x:real^3))` REAL_MUL_LINV)THEN ASM_REWRITE_TAC[]]]]);; + + + +let norm_origin_fan=prove(`!x:real^3. + (\(y:real^3). lift(norm(y-x))) continuous_on (:real^3) `, +GEN_TAC +THEN MP_TAC(ISPECL[`(\(y:real^3). y-(x:real^3))`;`(\(y:real^3). lift(norm(y)))`;`(:real^3)`]CONTINUOUS_ON_COMPOSE) +THEN REWRITE_TAC[o_DEF] +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[CONTINUOUS_ON_LIFT_NORM;GSYM(o_DEF)] +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN SIMP_TAC[CONTINUOUS_ON_CONST;CONTINUOUS_ON_ID]);; + +let REAL_ABS_SUB_NORM = prove + (`!x y. abs(norm(x) - norm(y)) <= norm(x - y)`, + REWRITE_TAC[REAL_ARITH `abs(x - y) <= a <=> x <= y + a /\ y <= x + a`] THEN + MESON_TAC[NORM_TRIANGLE_SUB; NORM_SUB]);; + + + +let IMP_NORM_FAN=prove(`!va:real^3 vb:real^3. ~(va = vb) +==> ~(norm (va-vb) = &0) /\ &0 <= norm (va-vb) /\ &0 < norm (va-vb) /\ &0 <= inv (norm (va-vb)) +/\ &0 < inv (norm (va-vb)) /\ inv (norm (va-vb)) * norm (va-vb) = &1`, +REPEAT GEN_TAC +THEN DISCH_TAC +THEN MRESA_TAC imp_norm_not_zero_fan[`va:real^3`;`vb:real^3`] +THEN ASSUME_TAC(ISPEC`va-vb:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(norm(va-vb:real^3)= &0) /\ &0 <= norm(va-vb:real^3)==> &0 dist (v,x) % e3_fan x v u = v - x`, +REPEAT GEN_TAC THEN REWRITE_TAC[e3_fan; dist; VECTOR_ARITH `(a:real) % (b:real)% (v:real^3)=(a*b)%v`] THEN +MESON_TAC[imp_norm_not_zero_fan; REAL_MUL_RINV; VECTOR_ARITH `&1 %(v:real^3)=v`]);; + +let norm_dot_fan=prove(`!x:real^3. norm x = &1 ==> x dot x = &1`, + ASM_MESON_TAC[NORM_POW_2; REAL_ARITH `&1 pow 2= &1`]);; + + + let e3_is_normal_fan=prove(`!x:real^3 v:real^3 u:real^3. ~(v=x) ==> e3_fan x v u dot e3_fan x v u = &1`, +REPEAT GEN_TAC THEN REWRITE_TAC[e3_fan]THEN DISCH_TAC +THEN SUBGOAL_THEN `norm(inv(norm((v:real^3)-(x:real^3))) %(v-x)) pow 2= &1 pow 2` ASSUME_TAC THENL + [ASM_MESON_TAC[norm_of_normal_vector_is_unit_fan] ; +ASM_MESON_TAC[NORM_POW_2; REAL_ARITH `&1 pow 2= &1`]]);; + + let e2_is_normal_fan= prove(`!x:real^3 v:real^3 u:real^3. ~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) ==> e2_fan x v u dot e2_fan x v u = &1`, +REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `~((e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3))= vec 0)` ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[e3_fan;CROSS_LMUL] +THEN DISCH_TAC THEN MP_TAC(ISPECL [`v:real^3`; `x:real^3`] imp_inv_norm_not_zero_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL [`inv(norm((v:real^3)-(x:real^3)))`; `((v:real^3) -(x:real^3)) cross ((u:real^3)-(x:real^3))`; `(vec 0):real^3`] VECTOR_MUL_LCANCEL_IMP) +THEN ASM_REWRITE_TAC[VECTOR_MUL_RZERO;CROSS_EQ_0 ]; + +MP_TAC(ISPECL [`(e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3))`; `((vec 0):real^3)`] norm_of_normal_vector_is_unit_fan) THEN +ASM_REWRITE_TAC[] THEN REWRITE_TAC[e2_fan; VECTOR_ARITH`(v:real^3)- vec 0 = v`] THEN MESON_TAC[norm_dot_fan]]);; + + let e2_orthogonal_e3_fan=prove(`!x:real^3 v:real^3 u:real^3. +~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) ==> (e2_fan x v u) dot (e3_fan x v u)= &0`, +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[e2_fan;e3_fan;CROSS_LMUL;DOT_RMUL;] THEN VEC3_TAC);; + + + + let e1_is_normal_fan=prove(`!x:real^3 v:real^3 u:real^3. +~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) ==> e1_fan x v u dot e1_fan x v u = &1`, +REPEAT GEN_TAC THEN STRIP_TAC THEN +REWRITE_TAC[e1_fan;DOT_CROSS] THEN +MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3` ] e2_orthogonal_e3_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3` ] e2_is_normal_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3` ] e3_is_normal_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC);; + + let e1_orthogonal_e3_fan=prove(`!x:real^3 v:real^3 u:real^3. ~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) +==> (e1_fan x v u) dot (e3_fan x v u)= &0`, +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[e1_fan;DOT_CROSS_SELF] );; + + + let e1_orthogonal_e2_fan=prove(`!x:real^3 v:real^3 u:real^3. ~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) +==> (e1_fan x v u) dot (e2_fan x v u)= &0`, +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[e1_fan;DOT_CROSS_SELF] );; + + + let e1_cross_e2_dot_e3_fan=prove(`!x:real^3 v:real^3 u:real^3. ~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) ==> +&0 < (e1_fan x v u cross e2_fan x v u) dot e3_fan x v u`, +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[e1_fan;CROSS_TRIPLE] +THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3` ] e1_is_normal_fan) +THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[e1_fan] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC);; + + + + let orthonormal_e1_e2_e3_fan=prove(`!x:real^3 v:real^3 u:real^3. ~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) ==> +(orthonormal (e1_fan x v u) (e2_fan x v u) (e3_fan x v u))`, +REPEAT GEN_TAC THEN REWRITE_TAC[orthonormal] THEN DISCH_TAC THEN +ASM_MESON_TAC[e1_is_normal_fan;e2_is_normal_fan;e3_is_normal_fan;e1_orthogonal_e2_fan; +e1_orthogonal_e3_fan;e2_orthogonal_e3_fan;e1_cross_e2_dot_e3_fan]);; + + + + let dot_e2_fan=prove(`!x:real^3 v:real^3 u:real^3. ~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) +==> (u-x) dot e2_fan x v u = &0`, +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[e2_fan;DOT_RMUL;DOT_CROSS_SELF] THEN REAL_ARITH_TAC);; + +let vdot_e2_fan=prove(`!x:real^3 v:real^3 u:real^3. ~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) +==> (v-x) dot e2_fan x v u = &0`, +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[e2_fan;e3_fan;CROSS_LMUL;DOT_RMUL;DOT_CROSS_SELF] THEN REAL_ARITH_TAC);; + +let vcross_e3_fan=prove(`!x:real^3 v:real^3 u:real^3. ~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) +==> +(v - x) cross (e3_fan x v u) = vec 0`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[e3_fan;CROSS_RMUL;CROSS_REFL] THEN VECTOR_ARITH_TAC);; + +let udot_e1_fan=prove(`!x:real^3 v:real^3 u:real^3. +~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) +==> &0 < (u - x) dot e1_fan x v u `, +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[e1_fan; e2_fan;CROSS_LMUL;DOT_RMUL;DOT_SYM;DOT_LMUL;CROSS_TRIPLE] +THEN SUBGOAL_THEN `~((e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3))= vec 0)` ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[e3_fan;CROSS_LMUL] +THEN DISCH_TAC THEN MP_TAC(ISPECL [`v:real^3`; `x:real^3`] imp_inv_norm_not_zero_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL [`inv(norm((v:real^3)-(x:real^3)))`; `((v:real^3) -(x:real^3)) cross ((u:real^3)-(x:real^3))`; `(vec 0):real^3`] VECTOR_MUL_LCANCEL_IMP) +THEN ASM_REWRITE_TAC[VECTOR_MUL_RZERO;CROSS_EQ_0 ]; +MP_TAC(ISPECL [`(e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3))`; `((vec 0):real^3)`]imp_norm_gl_zero_fan) THEN +ASM_REWRITE_TAC[REAL_ARITH`(a:real)> &0 <=> &0 < (a:real)`;VECTOR_ARITH `(a:real^3)- vec 0=a`] THEN DISCH_TAC + THEN MP_TAC(ISPEC `e3_fan (x:real^3) (v:real^3) (u:real^3) cross (u-x)`DOT_POS_LT) THEN ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[REAL_LT_MUL]]);; + +let udot_e1_fan1=prove(`!x:real^3 v:real^3 u:real^3. +~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) +==> &0 <= (u - x) dot e1_fan x v u `, +REPEAT GEN_TAC THEN STRIP_TAC THEN +MP_TAC(ISPECL[`x:real^3` ;`v:real^3` ;`u:real^3`]udot_e1_fan) THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC);; + +let vdot_e1_fan=prove(`!x:real^3 v:real^3 u:real^3. +~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) +==> (v - x) dot e1_fan x v u = &0`, +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]e3_mul_dist_fan) THEN RES_TAC THEN SYM_ASSUM_TAC THEN +REWRITE_TAC[DOT_SYM;DOT_LMUL] THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]e1_orthogonal_e3_fan) THEN RESA_TAC THEN +REAL_ARITH_TAC);; + + + + + + +let properties_coordinate=prove(`!x:real^3 v:real^3 u:real^3. +~(collinear {x, v, u}) +==> (orthonormal (e1_fan x v u) (e2_fan x v u) (e3_fan x v u)) +/\ dist (v,x) % e3_fan x v u = v - x +/\ ((v - x) cross (e3_fan x v u) = vec 0) +/\ (v-x) dot e2_fan x v u = &0 +/\ ((u-x) dot e2_fan x v u = &0) +/\ &0 <= (u - x) dot e1_fan x v u +/\ &0 < (u - x) dot e1_fan x v u +/\ (v - x) dot e1_fan x v u = &0`, +( let lem=prove(`!a b c. {a,b,c}={b,a,c}`,SET_TAC[]) in +REPEAT GEN_TAC THEN DISCH_THEN(LABEL_TAC "a") THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]th3) + THEN RED_TAC THEN REMOVE_THEN "a" MP_TAC THEN REWRITE_TAC[lem;] THEN GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[COLLINEAR_3] +THEN +ASM_MESON_TAC[orthonormal_e1_e2_e3_fan;e3_mul_dist_fan; dot_e2_fan;vdot_e2_fan;vcross_e3_fan;udot_e1_fan;udot_e1_fan1;vdot_e1_fan]));; + + +let module_of_vector =prove(`!x:real^3 v:real^3 u:real^3 w:real^3 r:real psi:real h:real. + ~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) +/\ (&0 < r) /\ (w=(r * cos psi) % e1_fan x v u + (r * sin psi) % e2_fan x v u + h % (v-x)) +==> +sqrt(((w cross (e3_fan x v u)) dot e1_fan x v u) pow 2 + ((w cross (e3_fan x v u)) dot e2_fan x v u) pow 2) = r`, +REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[CROSS_LADD;CROSS_LMUL;] THEN +MP_TAC(ISPECL [`x:real^3`; `v:real^3`; `u:real^3` ] orthonormal_e1_e2_e3_fan) THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "a") THEN +MP_TAC (ISPECL [`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`; +`e3_fan (x:real^3) (v:real^3) (u:real^3)`]ORTHONORMAL_CROSS) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ISPECL [`x:real^3`; `v:real^3`; `u:real^3` ]vcross_e3_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]CROSS_SKEW) + THEN DISCH_TAC THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[DOT_LADD;DOT_LMUL;DOT_LZERO;DOT_LNEG] + THEN REMOVE_THEN "a" MP_TAC THEN REWRITE_TAC[orthonormal] THEN DISCH_TAC THEN ASM_REWRITE_TAC[DOT_SYM] + THEN REWRITE_TAC[REAL_ARITH `-- &0 = &0`; REAL_ARITH`(a:real)* &0 = &0`; REAL_ARITH `(a:real) * &1 = a`; +REAL_ARITH `(a:real) + &0 = a`;REAL_ARITH `&0 + (a:real) = a`;REAL_POW_MUL; REAL_ARITH `-- &1 pow 2 = &1`; +REAL_ARITH `(d:real) * (b:real) + d * (c:real) = d * ( b + c)`;SIN_CIRCLE; sqrt] THEN MATCH_MP_TAC SELECT_UNIQUE +THEN REWRITE_TAC[BETA_THM] THEN GEN_TAC THEN EQ_TAC + + THENL[ + STRIP_TAC THEN SUBGOAL_THEN `((y:real) - (r:real))* (y + r) = &0` ASSUME_TAC + THENL[ + REWRITE_TAC[REAL_ADD_LDISTRIB; REAL_ARITH `((a:real)- (b:real)) * (c:real)= a *c - b * c`; +REAL_ARITH`(y:real) * (r:real)= r * y`; REAL_ARITH `((a:real) +(b:real)) - ((b:real) + (c:real))= a - c`; +REAL_ARITH `(a:real)- (c:real)= &0 <=> a = c`] + THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + MP_TAC (ISPECL [`(y:real)- (r:real)`; `(y:real)+(r:real)` ]REAL_ENTIRE) THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC + THENL + [POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC]]; + + DISCH_TAC THEN ASM_REWRITE_TAC[] + THEN REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC]);; + + +(* ========================================================================== *) +(* COPLANAR (^_^) *) +(* ========================================================================== *) + + + +let azim_line_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 t:real^1. +~coplanar {x,v,u,(&1-drop(t))%u+drop(t)%w} +==> (\(t:real^1). azim x v u ((&1 - drop(t)) % u + drop(t) % w)) real_continuous at t`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1; o_DEF; CONTINUOUS_AT_LIFT_COMPONENT] +THEN MP_TAC(ISPECL[`(\(t:real^1). ((&1 - drop(t)) % (u:real^3) + drop(t) %(w:real^3)))`;`(\(w:real^3). lift(azim (x:real^3) (v:real^3) (u:real^3) w))`;`t:real^1`] CONTINUOUS_AT_COMPOSE) +THEN REWRITE_TAC[o_DEF] +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[ISPECL[`u:real^3`;`w:real^3`;`t:real^1`]collinear1_continuous_fan] +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`((&1 - drop(t)) % (u:real^3) + drop(t) %(w:real^3))`]REAL_CONTINUOUS_AT_AZIM) +THEN REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1; o_DEF; CONTINUOUS_AT_LIFT_COMPONENT] +THEN ASM_MESON_TAC[]);; + + + + + + + +let continuous_coplanar_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3. + ~(coplanar{x,v,u,w}) +==>(!t:real. ~(t= &0) ==> ~coplanar {x,v,u,(&1-t)%u+t%w} )`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC`~(coplanar{x,v,u,w:real^3})` +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[COPLANAR_DET_EQ_0;VECTOR_ARITH`((&1 - t) % u + t % w) - x=(&1 - t) % (u-x) + t % (w - x):real^3`;DET_3;VECTOR_3;VECTOR_ADD_COMPONENT;VECTOR_MUL_COMPONENT +;REAL_ARITH`(v - x)$1 * (u - x)$2 * ((&1 - t) * (u - x)$3 + t * (w - x)$3) + + (v - x)$2 * (u - x)$3 * ((&1 - t) * (u - x)$1 + t * (w - x)$1) + + (v - x)$3 * (u - x)$1 * ((&1 - t) * (u - x)$2 + t * (w - x)$2) - + (v - x)$1 * (u - x)$3 * ((&1 - t) * (u - x)$2 + t * (w - x)$2) - + (v - x)$2 * (u - x)$1 * ((&1 - t) * (u - x)$3 + t * (w - x)$3) - + (v - x)$3 * (u - x)$2 * ((&1 - t) * (u - x)$1 + t * (w - x)$1)= +t*((v - x)$1 * (u - x)$2 * ((w - x)$3) + + (v - x)$2 * (u - x)$3 * ( (w - x)$1) + + (v - x)$3 * (u - x)$1 * ((w - x)$2) - + (v - x)$1 * (u - x)$3 * ((w - x)$2) - + (v - x)$2 * (u - x)$1 * ( (w - x)$3) - + (v - x)$3 * (u - x)$2 * ( (w - x)$1)):real`;REAL_ENTIRE] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + + + + +let open_is_not_zero_fan=prove(`open{y:real^1 | ?x. ~(x = &0) /\ y = lift x}`, +(let equality_real_fan=prove(`{y:real^1 | ?x. ~(x = &0) /\ y = lift x}={y:real^1 | ~(drop y = &0)}`, +REWRITE_TAC[EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +STRIP_TAC +THEN ASM_REWRITE_TAC[LIFT_DROP]; +STRIP_TAC +THEN EXISTS_TAC`drop (x:real^1)` +THEN ASM_REWRITE_TAC[LIFT_DROP]])in +(let ngu=prove(`{x | x IN (:real^1) /\ x = vec 0}={x | x IN (:real^1) /\ x$1 = &0}`, +REWRITE_TAC[EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL[STRIP_TAC +THEN ASM_REWRITE_TAC[VEC_COMPONENT]; +SIMP_TAC[IN_UNIV;CART_EQ;LAMBDA_BETA;VEC_COMPONENT;DIMINDEX_1;ARITH_RULE`1<=i /\ i<=1<=>i=1`]]) +in +REWRITE_TAC[equality_real_fan] +THEN REWRITE_TAC[OPEN_CLOSED;DIFF; IN_ELIM_THM;] +THEN MP_TAC(ISPECL[`(\(t:real^1). t)`;`(:real^1)`;`(vec 0):real^1`]CONTINUOUS_CLOSED_PREIMAGE_CONSTANT) +THEN MP_TAC(ISPECL[`0`;`1`]VEC_COMPONENT) +THEN SIMP_TAC[CONTINUOUS_ON_ID;CLOSED_UNIV; DIMINDEX_1;drop;ngu])));; + + + + + + + + + + + +let azim_continuous_when_not_coplanar=prove(`!x:real^3 v:real^3 u:real^3 w:real^3. +~coplanar {x,v,u,w} +==> (\(t:real). azim x v u ((&1 - t) % u + t % w)) real_continuous_on {t:real| ~(t= &0)}`, +REWRITE_TAC[REAL_CONTINUOUS_ON;o_DEF;IMAGE;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASSUME_TAC(open_is_not_zero_fan) +THEN MRESA_TAC CONTINUOUS_ON_EQ_CONTINUOUS_AT[`(\t:real^1. lift (azim x v u ((&1 - drop t) % u + drop t % w))):real^1->real^1`;`{y:real^1| ?x. ~(x = &0) /\ y = lift x}`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[LIFT_DROP] +THEN MRESAL_TAC azim_line_fan[`x:real^3`;` v:real^3`;` u:real^3`;` w:real^3`;` (lift x''):real^1`][REAL_CONTINUOUS_CONTINUOUS1; o_DEF;LIFT_DROP] +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `x'':real`));; + + +let injective_azim_coplanar=prove(`!x:real^3 v:real^3 u:real^3 w:real^3. +~coplanar {x,v,u,w} +==> +!a:real b:real. ~(a= &0) /\ ~(b= &0)/\ (\(t:real). azim x v u ((&1 - t) % u + t % w))a=(\(t:real). azim x v u ((&1 - t) % u + t % w))b==>a=b`, +REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th -> MP_TAC(ISPEC`a:real`th)THEN ASSUME_TAC(th)) +THEN POP_ASSUM(fun th -> MP_TAC(ISPEC`b:real`th)) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`] +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR[`x:real^3`;`v:real^3`;`(&1 - a) % u + a % w:real^3`;`u:real^3`] +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR[`x:real^3`;`v:real^3`;`(&1 - b) % u + b % w:real^3`;`u:real^3`] +THEN MRESA_TAC AZIM_EQ [`x:real^3`;`v:real^3`;`u:real^3`;`(&1 - b) % u + b % w:real^3`;`(&1 - a) % u + a % w:real^3`;] +THEN MRESA_TAC AZIM_EQ_0 [`x:real^3`;`v:real^3`;`(&1 - a) % u + a % w:real^3`;`(&1 - b) % u + b % w:real^3`;] +THEN MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR [`x:real^3`;`v:real^3`;`(&1 - a) % u + a % w:real^3`;`(&1 - b) % u + b % w:real^3`;] +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`~coplanar {x,v,u,w:real^3}` +THEN REWRITE_TAC[COPLANAR_DET_EQ_0;VECTOR_ARITH`((&1 - t) % u + t % w) - x=(&1 - t) % (u-x) + t % (w - x):real^3`;DET_3;VECTOR_3;VECTOR_ADD_COMPONENT;VECTOR_MUL_COMPONENT] +THEN STRIP_TAC +THEN REWRITE_TAC[REAL_ARITH`(v - x)$1 * + ((&1 - a) * (u - x)$2 + a * (w - x)$2) * + ((&1 - b) * (u - x)$3 + b * (w - x)$3) + + (v - x)$2 * + ((&1 - a) * (u - x)$3 + a * (w - x)$3) * + ((&1 - b) * (u - x)$1 + b * (w - x)$1) + + (v - x)$3 * + ((&1 - a) * (u - x)$1 + a * (w - x)$1) * + ((&1 - b) * (u - x)$2 + b * (w - x)$2) - + (v - x)$1 * + ((&1 - a) * (u - x)$3 + a * (w - x)$3) * + ((&1 - b) * (u - x)$2 + b * (w - x)$2) - + (v - x)$2 * + ((&1 - a) * (u - x)$1 + a * (w - x)$1) * + ((&1 - b) * (u - x)$3 + b * (w - x)$3) - + (v - x)$3 * + ((&1 - a) * (u - x)$2 + a * (w - x)$2) * + ((&1 - b) * (u - x)$1 + b * (w - x)$1)= +(b-a)*((v - x)$1 * (u - x)$2 * (w - x)$3 + + (v - x)$2 * (u - x)$3 * (w - x)$1 + + (v - x)$3 * (u - x)$1 * (w - x)$2 - + (v - x)$1 * (u - x)$3 * (w - x)$2 - + (v - x)$2 * (u - x)$1 * (w - x)$3 - + (v - x)$3 * (u - x)$2 * (w - x)$1)`;REAL_ENTIRE] +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC);; + + + + + + + + + + + + + + +(* ========================================================================== *) +(* the sphere coordinate is the definiton of frame in flyspeck *) +(* ========================================================================== *) + + +let SINCOS_PRINCIPAL_VALUE_FAN = prove( +`!x:real. ?y:real. (&0<= y /\ y < &2* pi) /\ (sin(y) = sin(x) /\ cos(y) = cos(x))`, + GEN_TAC THEN MP_TAC(SPECL [`x:real`] SINCOS_PRINCIPAL_VALUE) THEN STRIP_TAC THEN +DISJ_CASES_TAC(REAL_ARITH`((y:real) < &0)\/ (&0 <= y)`) THENL +[ EXISTS_TAC `(y:real)+ &2 * pi` THEN ASSUME_TAC(PI_POS) +THEN ASM_REWRITE_TAC[SIN_PERIODIC;COS_PERIODIC] THEN REPEAT(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; + EXISTS_TAC `(y:real)` THEN ASSUME_TAC(PI_POS) +THEN ASM_REWRITE_TAC[] THEN REPEAT(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC]);; + +let sin_of_u_fan=prove(`!x:real^3 v:real^3 u:real^3 r1:real psi:real h1:real. + ~collinear {u,x,v} /\ ~(v=x) /\ ~(u=x)/\ ~collinear {vec 0, v-x, u-x} /\ &0 < r1 +/\ u - x = (r1 * cos psi) % (e1_fan x v u) + (r1 * sin psi) % (e2_fan x v u) + h1 % (v-x) +==> sin psi = &0`, +REPEAT GEN_TAC THEN STRIP_TAC THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] dot_e2_fan) + THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[DOT_LADD;DOT_LMUL] + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] vdot_e2_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] e2_is_normal_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] e1_orthogonal_e2_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[REAL_ARITH`(a:real)* &0 = &0`; REAL_ARITH`(a:real)+ &0= a`; REAL_ARITH`&0 + (a:real)= a`; + REAL_ARITH`(a:real) * &1= a`] + THEN DISCH_TAC + THEN MATCH_MP_TAC(ISPECL [`sin (psi:real)`;`&0`; `r1:real`] REAL_EQ_LCANCEL_IMP) THEN ASM_REWRITE_TAC[] + THEN REPEAT(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC);; + +let cos_of_u_fan=prove(`!x:real^3 v:real^3 u:real^3 r1:real psi:real h1:real. + ~collinear {u,x,v} /\ ~(v=x) /\ ~(u=x)/\ ~collinear {vec 0, v-x, u-x} /\ &0 < r1 +/\ u - x = (r1 * cos psi) % (e1_fan x v u) + (r1 * sin psi) % (e2_fan x v u) + h1 % (v-x) +==> cos psi = &1`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3`; `(u:real^3)-(x:real^3)`; `r1:real`; `psi:real`; `h1:real`]module_of_vector) THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) +THEN POP_ASSUM MP_TAC + THEN MP_TAC(ISPECL[`(u:real^3)-(x:real^3)`; `e3_fan (x:real^3) (v:real^3)(u:real^3)`;`e1_fan (x:real^3) (v:real^3)(u:real^3)`]CROSS_TRIPLE) THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN MP_TAC(ISPECL[`(u:real^3)-(x:real^3)`; `e3_fan (x:real^3) (v:real^3)(u:real^3)`;`e2_fan (x:real^3) (v:real^3)(u:real^3)`]CROSS_TRIPLE) THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] orthonormal_e1_e2_e3_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN +MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3)(u:real^3)`; `e2_fan (x:real^3) (v:real^3)(u:real^3)`;`e3_fan (x:real^3) (v:real^3)(u:real^3)`]ORTHONORMAL_CROSS )THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN STRIP_TAC THEN +POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN +POP_ASSUM (fun th-> REWRITE_TAC[CROSS_SKEW;th]) + THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3`] dot_e2_fan)THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC THEN MP_TAC(ISPECL[ `e2_fan (x:real^3) (v:real^3)(u:real^3)`;`(u:real^3)-(x:real^3)`]DOT_SYM) THEN DISCH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`&0 pow 2 +(a:real)=a`] THEN +MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] udot_e1_fan1) THEN ASM_REWRITE_TAC[DOT_LNEG;] THEN DISCH_TAC + THEN MP_TAC(ISPECL[ `e1_fan (x:real^3) (v:real^3)(u:real^3)`;`(u:real^3)-(x:real^3)`]DOT_SYM) THEN DISCH_TAC THEN +POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN REWRITE_TAC[POW_2_SQRT_ABS;REAL_ABS_NEG] THEN + MP_TAC(ISPECL[ `((u:real^3)-(x:real^3)) dot e1_fan (x:real^3) (v:real^3)(u:real^3)`] + REAL_ABS_REFL) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "a") THEN DISCH_TAC +THEN + MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3`; `r1:real`; `psi:real`; `h1:real`] sin_of_u_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH` + (r1 * cos psi) % e1_fan x v u + (r1 * &0) % e2_fan x v u + h1 % (v - x)= + (r1 * cos psi) % e1_fan x v u + h1 % (v - x)`] THEN DISCH_TAC THEN + SUBGOAL_THEN`((u:real^3) - (x:real^3)) dot e1_fan x (v:real^3) u = (((r1:real) * cos (psi:real)) % e1_fan x v u + (h1:real) % (v - x)) dot e1_fan x v u` ASSUME_TAC + +THENL[ASM_MESON_TAC[]; + +POP_ASSUM MP_TAC THEN REWRITE_TAC[DOT_LADD;DOT_LMUL] THEN POP_ASSUM MP_TAC THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]e3_mul_dist_fan) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`] +e1_orthogonal_e3_fan) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[DOT_LMUL;DOT_SYM] +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`] +e1_is_normal_fan) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`(a:real)* &1+ (b:real)*(c:real)* &0= a`] THEN REPEAT DISCH_TAC + THEN MP_TAC(ISPECL[`&1`;`cos (psi:real)`; `r1:real`]REAL_EQ_LCANCEL_IMP) THEN REWRITE_TAC[REAL_ARITH`(a:real)* &1=a`; REAL_ARITH`&1 = (a:real) <=> a= &1`] THEN DISCH_TAC THEN POP_ASSUM MATCH_MP_TAC THEN REPEAT(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC]);; + + + + +let sincos_of_u_fan=prove(`!x:real^3 v:real^3 u:real^3 r1:real psi:real h1:real. + ~collinear {u,x,v} /\ ~(v=x) /\ ~(u=x)/\ ~collinear {vec 0, v-x, u-x} /\ &0 < r1 +/\ u - x = (r1 * cos psi) % (e1_fan x v u) + (r1 * sin psi) % (e2_fan x v u) + h1 % (v-x) +==> sin psi = &0 /\ cos psi = &1`, +MESON_TAC[cos_of_u_fan;sin_of_u_fan]);; + + + + +let sincos1_of_u_fan=prove(`!x:real^3 v:real^3 u:real^3 r1:real psi:real h1:real. + ~collinear {x,v,u} /\ &0 < r1 +/\ u - x = (r1 * cos psi) % (e1_fan x v u) + (r1 * sin psi) % (e2_fan x v u) + h1 % (v-x) +==> sin psi = &0 /\ cos psi = &1`, + +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC`~collinear {x,v,u:real^3}` +THEN ONCE_REWRITE_TAC[SET_RULE`{X,V,U}={U,X,V}`] +THEN DISCH_TAC +THEN FIND_ASSUM MP_TAC`~collinear {x,v,u:real^3}` +THEN ONCE_REWRITE_TAC[SET_RULE`{X,V,U}={V,X,U}`] +THEN ONCE_REWRITE_TAC[COLLINEAR_3] +THEN DISCH_TAC +THEN MRESA_TAC th3[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`] +THEN MRESA_TAC sincos_of_u_fan[`(x:real^3)`;`(v:real^3)`;` (u:real^3)`;`r1:real`; `psi:real`; `h1:real`]) +;; + + + + + + + + + +(*------------------------------------------------------------*) +(* change spherical coordinate in fan *) +(*------------------------------------------------------------*) + + + +let change_spherical_coordinate_fan= new_definition`change_spherical_coordinate_fan (x:real^3) (v:real^3) (u:real^3) = ((\t. let r = t$1 and theta = t$2 and phi = t$3 in + x +(r * cos theta * sin phi) % e1_fan x v u + + (r * sin theta * sin phi) % e2_fan x v u + + (r * cos phi) % e3_fan x v u):real^3->real^3) ` ;; + + + + + +(*---------------------------------------------------------------------------------------*) +(* the function of change coordinate is(spherecial) continuous *) +(*---------------------------------------------------------------------------------------*) + + +let REAL_CONTINUOUS_AT_COMPONENT = prove + (`!i a. 1 <= i /\ i <= dimindex(:N) + ==> (\x:real^N. x$i) real_continuous at a`, + REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1; o_DEF; + CONTINUOUS_AT_LIFT_COMPONENT]);; + + + let continuous_change_spherical_coordinate_fan = prove + (`!x':real^3 v:real^3 u:real^3 x:real^3. +((\t. let r = t$1 and theta = t$2 and phi = t$3 in + (r * cos theta * sin phi) % e1_fan x' v u + + (r * sin theta * sin phi) % e2_fan x' v u + + (r * cos phi) % e3_fan x' v u)) + continuous at x`, +REPEAT STRIP_TAC THEN +CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN + REPEAT(MATCH_MP_TAC CONTINUOUS_ADD THEN CONJ_TAC) THEN + MATCH_MP_TAC CONTINUOUS_VMUL THEN + REWRITE_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS1] THEN + REPEAT(MATCH_MP_TAC REAL_CONTINUOUS_MUL THEN CONJ_TAC) THEN + SIMP_TAC[REAL_CONTINUOUS_AT_COMPONENT; DIMINDEX_3; ARITH] THEN + MATCH_MP_TAC(REWRITE_RULE[o_DEF] REAL_CONTINUOUS_AT_COMPOSE) THEN + SIMP_TAC[REAL_CONTINUOUS_AT_COMPONENT; DIMINDEX_3; ARITH] THEN + REWRITE_TAC[REAL_CONTINUOUS_WITHIN_SIN; REAL_CONTINUOUS_WITHIN_COS]);; + + + +(* ========================================================================== *) +(* AFFINE *) +(* ========================================================================== *) + +(* local definitions *) + +let complement_set= new_definition`complement_set {x:real^3, v:real^3} = {y:real^3| ~(y IN aff {x,v})} `;; + + + +let AFF_GT_1_1 = prove + (`!x v. + DISJOINT {x} {v} + ==> aff_gt {x} {v} = + {y | ?t1 t2. + &0 < t2 /\ + t1 + t2 = &1 /\ + y = t1 % x + t2 % v}`, + AFF_TAC);; + + +let AFF_LT_2_1 = prove + (`!x v w. + DISJOINT {x,v} {w} + ==> aff_lt {x,v} {w} = + {y | ?t1 t2 t3. + t3 < &0 /\ + t1 + t2 + t3 = &1 /\ + y = t1 % x + t2 % v + t3 % w}`, + AFF_TAC);; + + + +let AFF_GE_2_1 = prove + (`!x v w. + DISJOINT {x,v} {w} + ==> aff_ge {x,v} {w} = + {y | ?t1 t2 t3. + &0 <= t3 /\ + t1 + t2 + t3 = &1 /\ + y = t1 % x + t2 % v + t3 % w}`, + AFF_TAC);; + +let AFF_GE_1_2 = prove + (`!x v w. + DISJOINT {x} {v,w} + ==> aff_ge {x} {v,w} = + {y | ?t1 t2 t3. + &0 <= t2 /\ &0 <= t3 /\ + t1 + t2 + t3 = &1 /\ + y = t1 % x + t2 % v + t3 % w}`, + AFF_TAC);; + + +let AFF_GT_1_2=prove(`!x v w. + DISJOINT {x} {v, w} + ==> aff_gt {x} {v, w} = + {y | ?t1 t2 t3. + &0 < t2 /\ + &0 < t3 /\ + t1 + t2 + t3 = &1 /\ + y = t1 % x + t2 % v + t3 % w}`, +AFF_TAC);; + +let AFF_GT_2_2=prove(`!x u v w. + DISJOINT {x, u} {v, w} + ==> aff_gt {x, u} {v, w} = + {y | ?t1 t2 t3 t4. + &0 < t3 /\ + &0 < t4 /\ + t1 + t2 + t3 +t4= &1 /\ + y = t1 % x + t2 %u + t3 % v + t4 % w}`, +AFF_TAC);; + + + +let AFF_GE_1_10 = prove + (`!x v w. + DISJOINT {x} {v} + ==> aff_ge {x} {v} = + {y | ?t1 t2. + &0 <= t2 /\ + t1 + t2 = &1 /\ + y = t1 % x + t2 % v }`, + AFF_TAC);; + +let AFF_GE_1_1=prove(`!x:real^3 v:real^3. +~(x=v) +==> aff_ge {x} {v} = {y:real^3 | ?t1:real t2:real. (&0 <= t2 ) /\ (t1 + t2 = &1) /\ (y = t1 % x + t2 % v )}`, +(let lemma=prove(`!x v. ~(x=v) <=> DISJOINT {x} {v} `, + +REWRITE_TAC[DISJOINT; INTER; IN_SING; EXTENSION; EMPTY; IN_ELIM_THM] THEN ASM_SET_TAC[]) in + +REWRITE_TAC[lemma] THEN AFF_TAC));; + + + + + +let affine_hull_2_fan= prove(`(!x:real^3 v:real^3. aff {x , v} = {y:real^3| ?t1:real t2:real. (t1 + t2 = &1 )/\ (y = t1 % x + t2 % v )})`, +REWRITE_TAC[aff;AFFINE_HULL_2] THEN ASM_SET_TAC[]);; + + + + +let aff_subset_aff_ge=prove(`!x:real^3 v:real^3 w:real^3. +DISJOINT {x,v} {w} +==> aff {x,v} SUBSET aff_ge {x,v} {w}`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN +MP_TAC(ISPECL[`(x:real^3) `;` (v:real^3)`;` (w:real^3)`]AFF_GE_2_1) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC +THEN ASM_REWRITE_TAC[aff; AFFINE_HULL_2; SUBSET; AFF_GE_2_1; IN_ELIM_THM] + THEN GEN_TAC THEN STRIP_TAC + THEN EXISTS_TAC`u:real` THEN EXISTS_TAC`v':real` THEN EXISTS_TAC`&0` + THEN ASM_REWRITE_TAC[VECTOR_ARITH`a=b +c + &0 % d<=>a=b+c`] + THEN REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC);; + + + + +let COMPLEMENT_SET_FAN=prove(`!x:real^3 v:real^3 u:real^3 y:real^3 w:real^3 t1:real t2:real t3:real. +~( w IN aff {x, v}) /\ ~(t3 = &0) /\ (t1 + t2 + t3 = &1) +==> t1 % x + t2 % v + t3 % w IN + complement_set {x, v}`, + REPEAT GEN_TAC THEN ASSUME_TAC(affine_hull_2_fan) THEN STRIP_TAC THEN +REWRITE_TAC[complement_set; IN_ELIM_THM] THEN ASM_REWRITE_TAC[] THEN +REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN REPEAT(POP_ASSUM MP_TAC) THEN DISCH_TAC THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT DISCH_TAC THEN + SUBGOAL_THEN ` (t3:real) % w =((t1':real)- (t1:real)) % (x:real^3) + ((t2':real)- (t2:real)) % (v:real^3) ` ASSUME_TAC + THENL + [POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC; + REPEAT(POP_ASSUM MP_TAC) THEN DISCH_THEN(LABEL_TAC "b") THEN DISCH_THEN(LABEL_TAC "c") THEN DISCH_THEN(LABEL_TAC "d") + THEN REPEAT STRIP_TAC THEN USE_THEN "c" MP_TAC THEN REWRITE_TAC[CONTRAPOS_THM] THEN + EXISTS_TAC `((t1':real) - (t1:real))/(t3:real)` THEN EXISTS_TAC `((t2':real) - (t2:real))/(t3:real)` + THEN SUBGOAL_THEN `((t1':real) - (t1:real))/(t3:real)+ ((t2':real) - (t2:real))/(t3:real) = &1` ASSUME_TAC THENL + [REWRITE_TAC[real_div] THEN REWRITE_TAC[REAL_ARITH `a*b+c*b=(a+c)*b`] THEN + SUBGOAL_THEN `(t1':real) - (t1:real) + (t2':real) - (t2:real) - (t3:real) = &0` ASSUME_TAC THENL + [REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; + SUBGOAL_THEN `(t1':real) - (t1:real) + (t2':real) - (t2:real) = (t3:real)` ASSUME_TAC THENL + [POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + ASM_MESON_TAC[REAL_MUL_RINV]]]; + ASM_REWRITE_TAC[] THEN REWRITE_TAC[real_div] THEN + REWRITE_TAC[VECTOR_ARITH ` (((t1':real) - (t1:real)) * inv (t3:real)) % (x:real^3) + (((t2':real) - (t2:real)) * inv t3) % (v:real^3) = inv t3 % ((t1' - t1) % x + (t2' - t2) % v)`] THEN + SUBGOAL_THEN `(t3:real) % (w:real^3) = t3 %( inv t3 % (((t1':real) - (t1:real)) % (x:real^3) + ((t2':real) - (t2:real)) % (v:real^3)))` ASSUME_TAC THENL + [REWRITE_TAC[VECTOR_ARITH ` (t3:real) % (inv t3 % (((t1':real) - (t1:real)) % (x:real^3) + ((t2':real) - (t2:real)) % (v:real^3)))= (t3 * inv t3) % ((t1' - t1) % x + (t2' - t2) % v) `] THEN + SUBGOAL_THEN `((t3:real) * inv (t3:real) = &1) ` ASSUME_TAC THENL + [ASM_MESON_TAC[REAL_MUL_RINV]; + ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC]; + ASM_MESON_TAC[VECTOR_MUL_LCANCEL_IMP]]]]);; + + + +let aff_ge_inter_aff_ge=prove(`!(x:real^3) (v:real^3) (w:real^3). +~collinear {x,v,w} +==> +aff_ge {x} {v , w} = aff_ge {x , v} {w} INTER aff_ge {x , w} {v}`, + + REPEAT STRIP_TAC THEN MRESA_TAC th3 [`x:real^3`;`v:real^3`;`w:real^3`] + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GE_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GE_2_1) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`w:real^3`;`v:real^3`]AFF_GE_2_1) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;EXTENSION]THEN GEN_TAC THEN EQ_TAC +THENL(*1*)[ +STRIP_TAC THEN STRIP_TAC +THENL(*2*)[ + EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN EXISTS_TAC `t3:real` THEN ASM_MESON_TAC[]; +EXISTS_TAC `(t1:real)` THEN + EXISTS_TAC `(t3:real)` THEN EXISTS_TAC `(t2:real)` +THEN + ASM_MESON_TAC[REAL_ARITH `(t1:real)+ (t3:real) +(t2:real)=t1 + t2 + t3`;VECTOR_ARITH ` t1 % x + t2 % v + t3 % w = (t1:real) % (x:real^3) + (t3:real) % (w:real^3) + (t2:real) % (v:real^3)`]](*2*); + + STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(PATH_CONV "rrlr" o ONCE_DEPTH_CONV )[th] THEN ASSUME_TAC(th)) THEN POP_ASSUM MP_TAC + THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(PATH_CONV "rrlr" o ONCE_DEPTH_CONV )[SYM(th)] THEN ASSUME_TAC(th)) +THEN DISJ_CASES_TAC(SET_RULE`t3 - t2' = &0 \/ ~((t3:real) - (t2':real) = &0) `) +THENL[POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A-B= &0 <=> A=B`] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`t1':real` +THEN EXISTS_TAC`t3':real` +THEN EXISTS_TAC`t2':real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % w + t3' % v = t1' % x + t3' % v + t2' % w`; +REAL_ARITH`t1' + t3' + t2'=t1' + t2' + t3'`] +THEN ASM_TAC THEN REAL_ARITH_TAC; + +REWRITE_TAC[VECTOR_ARITH + `a % x + b % y + c % z= a1 % x + b1 % z + c1 % y <=> (c-b1) % z = (a1-a) % x + (c1-b)% y`] + THEN REWRITE_TAC[REAL_ARITH`a+b+c=a1+b1+c1<=> c1-b=(a-a1)+(c-b1)`] +THEN MRESA1_TAC REAL_MUL_LINV`t3 - t2'` + THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC +THEN MP_TAC(SET_RULE` +(t3 - t2') % w = (t1' - t1) % x + (t3' - t2) % v:real^3 +==> (inv (t3 - t2'))%((t3 - t2') % w ) = (inv (t3 - t2'))%((t1' - t1) % x + (t3' - t2) % v:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`&1 %A=A`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN ASSUME_TAC(SYM(th))) +THEN STRIP_TAC +THEN SUBGOAL_THEN`w IN aff{(x:real^3),v}` ASSUME_TAC +THENL[REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM;] THEN EXISTS_TAC`inv(t3-t2') *(t1'-t1)` +THEN EXISTS_TAC`inv(t3-t2') *(t3'-t2)` THEN ASM_REWRITE_TAC[REAL_ARITH`A*B+A*C=A*(B+C)`]; + +ASM_SET_TAC[]]]]);; + + +let SCALE_AFF_TAC th=REPEAT GEN_TAC +THEN DISCH_TAC +THEN REPEAT GEN_TAC +THEN MRESAL_TAC th[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`&1 - a* t2- a* t3:real` +THEN EXISTS_TAC`a* t2:real` +THEN EXISTS_TAC`a* t3:real` +THEN ONCE_REWRITE_TAC[TAUT`A/\B/\C/\D<=>D/\ A/\B/\C`] +THEN STRIP_TAC +THENL[ +ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC `t1+t2+t3= &1:real` +THEN REWRITE_TAC[REAL_ARITH`A+B+C= &1<=>A= &1- B -C:real`] +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] +THEN VECTOR_ARITH_TAC; + +MP_TAC(ISPECL[`a:real`;`(t2:real)`]REAL_LT_MUL) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`a:real`;`(t3:real)`] +THEN MRESA_TAC REAL_LE_MUL[`a:real`;`(t2:real)`] +THEN MRESA_TAC REAL_LE_MUL[`a:real`;`(t3:real)`] +THEN ASM_TAC +THEN REAL_ARITH_TAC];; + + +let scale_aff_ge_fan=prove(`!x:real^3 v:real^3 u:real^3. + DISJOINT {x} {v,u} +==> +(!y:real^3 a:real. y IN aff_ge {x} {v,u} /\ &0 <= a==> a%(y-x)+x IN aff_ge{x} {v,u})`, +SCALE_AFF_TAC AFF_GE_1_2);; + +let scale_aff_gt_fan=prove(`!x:real^3 v:real^3 u:real^3. + DISJOINT {x} {v,u} +==> +(!y:real^3 a:real. y IN aff_gt {x} {v,u} /\ &0 < a==> a%(y-x)+x IN aff_gt{x} {v,u})`, +SCALE_AFF_TAC AFF_GT_1_2);; + + + +let origin_is_not_aff_gt_fan=prove(`!x:real^3 v:real^3 u:real^3. + ~(u IN aff {x,v}) /\ DISJOINT {x} {v,u}==> ~(x IN aff_gt {x} {v,u})`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN REWRITE_TAC[GSYM FORALL_NOT_THM;DE_MORGAN_THM] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`~( &0< (t2:real))\/ ( &0< (t2:real))`) +THENL[ASM_MESON_TAC[]; +DISJ_CASES_TAC(REAL_ARITH`~( &0< (t3:real))\/ ( &0< (t3:real))`) +THENL[ASM_MESON_TAC[]; +DISJ_CASES_TAC(REAL_ARITH`~( t1+t2+(t3:real)= &1)\/ ( t1+t2+(t3:real)= &1)`) +THENL[ASM_MESON_TAC[]; +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A+B+C= &1<=>A= &1- B -C:real`] +THEN DISCH_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(t3:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[VECTOR_ARITH`A=( &1-B-C) %A+B%E+C%D <=> C%(D-A)= (--B)%(E-A)`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`t3 % (u - x) = (--t2) % (v - x):real^3 ==> (inv (t3))%(t3 % (u - x)) = (inv (t3))%((--t2) % (v - x))`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[VECTOR_ARITH`A-B=C%(V-B)<=>A=( &1-C)%B+C%V`] +THEN FIND_ASSUM MP_TAC `~(u IN aff {x,v}:real^3->bool)` +THEN MATCH_MP_TAC MONO_NOT +THEN STRIP_TAC +THEN REWRITE_TAC[aff; AFFINE_HULL_2; IN_ELIM_THM] +THEN EXISTS_TAC`&1 - inv t3 * --t2:real` +THEN EXISTS_TAC`inv t3 * --t2:real` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC]]]);; + + + + + + + +let properties_of_collinear4_points_fan=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +~collinear{x,v,u} +/\ v1 IN aff_gt {x} {v,u} +==> ~collinear{x,v1,v}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(u:real^3) `;] +THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(u:real^3) `;] +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[collinear1_fan;] +THEN FIND_ASSUM MP_TAC`~(u IN aff {x, v:real^3})` +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % u = u' % x + v' % v <=> t3 % u = (u'-t1) % x + (v'-t2) % v`;] +THEN MP_TAC (REAL_ARITH`&0< t3==> ~(t3= &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV `(t3:real)` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`t3 % u = (u'-t1) % x + (v'-t2) % v ==> (inv (t3)) % (t3) % ( u) = (inv (t3)) % ( (u'-t1) % x + (v'-t2) % v:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C:real^3)`;VECTOR_ARITH`A%(B+C)=A%B+A%C`]) +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`inv t3 * ((u' - t1):real)` +THEN EXISTS_TAC`inv t3 * ((v' - t2):real)` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t3 * (u' - t1) + inv t3 * (v' - t2)=inv t3 *(t3+ (u'+v') -( t1+ t2+t3))`;REAL_ARITH`A+ &1- &1=A`]);; + + + + +let properties_of_coplanar=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +~collinear{x,v,u} +/\ v1 IN aff_gt {x} {v,u} +==> coplanar{x,v1,v,u}`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[coplanar] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(u:real^3) `;] +THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(u:real^3) `;] +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) +THEN STRIP_TAC +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN SUBGOAL_THEN`(x:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL[REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; +SUBGOAL_THEN`(v:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL[ REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; +SUBGOAL_THEN`(u:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; +SUBGOAL_THEN`(v1:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t3:real` +THEN ASM_REWRITE_TAC[]; +ASM_TAC +THEN SET_TAC[]]]]]);; + + + + +let aff_gt_subset_aff_ge=prove(`!x:real^3 v:real^3 u:real^3. +DISJOINT {x} {v,u} +==> +aff_gt {x} {v,u} SUBSET aff_ge {x} {v,u}`, +REPEAT STRIP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t3:real` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + + +let aff_gt1_subset_aff_ge=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +DISJOINT {x} {v,u} /\ ~collinear {x,v1,u} +/\ v1 IN aff_ge {x} {v,u} +==> +aff_gt {x} {v1,u} SUBSET aff_ge {x} {v,u}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v1:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v1:real^3`;`u:real^3`][IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % (t1 % x + t2 % v + t3 % u) + t3' % u +=(t1'+ t2'*t1) % x + (t2'* t2) % v + (t2' * t3 + t3') % u:real^3`] +THEN STRIP_TAC +THEN EXISTS_TAC`t1' + t2' * t1:real` +THEN EXISTS_TAC`t2' * t2:real` +THEN EXISTS_TAC`t2' * t3 +t3':real` +THEN MP_TAC(REAL_ARITH`&0 &0<= t2'`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t2:real`] +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t3:real`] +THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t2' * t1) + t2' * t2 + t2' * t3 + t3'= +t1'+t2'*(t1+t2+t3)+t3'`; REAL_ARITH`A* &1=A`] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + +let aff_gt12_subset_aff_ge=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +DISJOINT {x} {v,u} /\ ~collinear {x,v1,v} +/\ v1 IN aff_ge {x} {v,u} +==> +aff_gt {x} {v1,v} SUBSET aff_ge {x} {v,u}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v1:real^3`;`v:real^3`] +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v1:real^3`;`v:real^3`][IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % (t1 % x + t2 % v + t3 % u) + t3' % v +=(t1'+ t2'*t1) % x + (t2'* t2+t3') % v + (t2' * t3 ) % u:real^3`] +THEN STRIP_TAC +THEN EXISTS_TAC`t1' + t2' * t1:real` +THEN EXISTS_TAC`t2' * t2 +t3':real` +THEN EXISTS_TAC`t2' * t3 :real` +THEN MP_TAC(REAL_ARITH`&0 &0<= t2'`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t2:real`] +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t3:real`] +THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t2' * t1) + (t2' * t2 +t3')+ t2' * t3 = +t1'+t2'*(t1+t2+t3)+t3'`; REAL_ARITH`A* &1=A`] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + +let aff_gt2_subset_aff_ge=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +DISJOINT {x} {v,u} /\ ~collinear {x,v1,u} /\ ~collinear {x,v1,v} +/\ v1 IN aff_gt {x} {v,u} +==> +azim x v1 v u= pi`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v1:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESA_TAC AZIM_EQ_PI[`x:real^3`;`v1:real^3`;`v:real^3`;`u:real^3`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`v1 = t1 % x + t2 % v + t3 % u +<=> t2 % v = (--t1) % x + v1 + (--t3) % u`] +THEN MP_TAC(REAL_ARITH`&0 ~( t2= &0)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 -- t3< &0`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2:real` +THEN MRESA1_TAC REAL_LT_INV`t2:real` +THEN MRESAL_TAC REAL_LT_LMUL[`inv t2:real`;`-- t3:real`;`&0`][REAL_ARITH`A * &0= &0`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`t2 % v = --t1 % x + v1 + --t3 % u:real^3 ==> (inv (t2))%(t2 % v ) = (inv (t2))%( --t1 % x + v1 + --t3 % u)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C+D)=A%B+A%C+A%D`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN MRESAL_TAC AFF_LT_2_1[`x:real^3`;`v1:real^3`;`u:real^3`][IN_ELIM_THM;SUBSET] +THEN EXISTS_TAC`(inv t2 * --t1):real` +THEN EXISTS_TAC`inv t2:real` +THEN EXISTS_TAC`(inv t2 * --t3):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t2 * (--t1) + inv t2 + inv t2 * (--t3)= +inv t2 * (t2+ &1 -(t1 +t2 +t3))`; REAL_ARITH`A+ &1- &1=A`]);; + + + +let remove_variable_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 t1:real t2:real t3:real. + &0 < t3 +/\ w = t1 % x + t2 % v + t3 % u +==> u= inv(t3) % w - (inv(t3)*t1) % x- (inv(t3) * t2) % v`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[VECTOR_ARITH`w = t1'' % x + t2'' % v + t3'' % u <=> t3'' % u = w-t1'' % x - t2'' % (v:real^3)`] +THEN MP_TAC(REAL_ARITH `&0 < (t3:real) ==> ~(t3 = &0)`) +THEN MP_TAC(ISPEC`(t3:real)`REAL_LT_INV) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC(th)) +THEN STRIP_TAC THEN STRIP_TAC +THEN MP_TAC(ISPEC`(t3:real)`REAL_MUL_LINV) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC(th)) +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3 % u = w-t1 % x - t2 % v:real^3 +==> (inv (t3))%(t3 % u) = (inv (t3))%( w-t1 % x - t2 % v:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`&1 %A=A`;VECTOR_ARITH`A%(B-C-D)=A%B-A%C-A%D`] THEN ASSUME_TAC(th)));; + + + +let aff_gt_inter_aff_gt=prove(`!(x:real^3) (v:real^3) (w:real^3). +~collinear {x,v,w} +==> +aff_gt {x} {v , w} = aff_gt {x , v} {w} INTER aff_gt {x , w} {v}`, + + REPEAT STRIP_TAC THEN MRESA_TAC th3 [`x:real^3`;`v:real^3`;`w:real^3`] + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GT_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GT_2_1) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`w:real^3`;`v:real^3`]AFF_GT_2_1) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;EXTENSION]THEN GEN_TAC THEN EQ_TAC +THENL(*1*)[ +STRIP_TAC THEN STRIP_TAC +THENL(*2*)[ + EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN EXISTS_TAC `t3:real` THEN ASM_MESON_TAC[]; +EXISTS_TAC `(t1:real)` THEN + EXISTS_TAC `(t3:real)` THEN EXISTS_TAC `(t2:real)` +THEN + ASM_MESON_TAC[REAL_ARITH `(t1:real)+ (t3:real) +(t2:real)=t1 + t2 + t3`;VECTOR_ARITH ` t1 % x + t2 % v + t3 % w = (t1:real) % (x:real^3) + (t3:real) % (w:real^3) + (t2:real) % (v:real^3)`]](*2*); + + STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(PATH_CONV "rrlr" o ONCE_DEPTH_CONV )[th] THEN ASSUME_TAC(th)) THEN POP_ASSUM MP_TAC + THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(PATH_CONV "rrlr" o ONCE_DEPTH_CONV )[SYM(th)] THEN ASSUME_TAC(th)) +THEN DISJ_CASES_TAC(SET_RULE`t3 - t2' = &0 \/ ~((t3:real) - (t2':real) = &0) `) +THENL[POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A-B= &0 <=> A=B`] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`t1':real` +THEN EXISTS_TAC`t3':real` +THEN EXISTS_TAC`t2':real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % w + t3' % v = t1' % x + t3' % v + t2' % w`; +REAL_ARITH`t1' + t3' + t2'=t1' + t2' + t3'`] +THEN ASM_TAC THEN REAL_ARITH_TAC; + +REWRITE_TAC[VECTOR_ARITH + `a % x + b % y + c % z= a1 % x + b1 % z + c1 % y <=> (c-b1) % z = (a1-a) % x + (c1-b)% y`] + THEN REWRITE_TAC[REAL_ARITH`a+b+c=a1+b1+c1<=> c1-b=(a-a1)+(c-b1)`] +THEN MRESA1_TAC REAL_MUL_LINV`t3 - t2'` + THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC +THEN MP_TAC(SET_RULE` +(t3 - t2') % w = (t1' - t1) % x + (t3' - t2) % v:real^3 +==> (inv (t3 - t2'))%((t3 - t2') % w ) = (inv (t3 - t2'))%((t1' - t1) % x + (t3' - t2) % v:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`&1 %A=A`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN ASSUME_TAC(SYM(th))) +THEN STRIP_TAC +THEN SUBGOAL_THEN`w IN aff{(x:real^3),v}` ASSUME_TAC +THENL[REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM;] THEN EXISTS_TAC`inv(t3-t2') *(t1'-t1)` +THEN EXISTS_TAC`inv(t3-t2') *(t3'-t2)` THEN ASM_REWRITE_TAC[REAL_ARITH`A*B+A*C=A*(B+C)`]; + +ASM_SET_TAC[]]]]);; + + + +let aff_gt3_subset_aff_gt=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +DISJOINT {x} {v,u} /\ ~collinear{x,v,v1} +/\ v1 IN aff_gt {x} {v,u} +==> +aff_gt {x} {v,v1} SUBSET aff_gt {x} {v,u}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`v1:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`v1:real^3`][IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % v + t3' % (t1 % x + t2 % v + t3 % u) +=(t1'+ t3'*t1) % x + (t2'+ t3' * t2) % v + (t3' * t3) % u:real^3`] +THEN STRIP_TAC +THEN EXISTS_TAC`t1' + t3' * t1:real` +THEN EXISTS_TAC`t2' + t3' * t2:real` +THEN EXISTS_TAC`t3' * t3:real` +THEN MRESA_TAC REAL_LT_MUL[`t3':real`;`t2:real`] +THEN MRESA_TAC REAL_LT_MUL[`t3':real`;`t3:real`] +THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t3' * t1) + (t2' + t3' * t2) + t3' * t3= +t1'+ t2' + t3'*(t1+t2+t3)`; REAL_ARITH`A* &1=A`] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + + + +let aff_ge1_subset_aff_ge=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +DISJOINT {x} {v,u} /\ ~collinear{x,v1,u} +/\ v1 IN aff_ge {x} {v,u} +==> +aff_ge {x} {v1,u} SUBSET aff_ge {x} {v,u}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v1:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v1:real^3`;`u:real^3`][IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % (t1 % x + t2 % v + t3 % u) + t3' % u +=(t1'+ t2'*t1) % x + (t2'* t2) % v + (t2' * t3 + t3') % u:real^3`] +THEN STRIP_TAC +THEN EXISTS_TAC`t1' + t2' * t1:real` +THEN EXISTS_TAC`t2' * t2:real` +THEN EXISTS_TAC`t2' * t3 +t3':real` +THEN MP_TAC(REAL_ARITH`&0 &0<= t2'`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t2:real`] +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t3:real`] +THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t2' * t1) + t2' * t2 + t2' * t3 + t3'= +t1'+t2'*(t1+t2+t3)+t3'`; REAL_ARITH`A* &1=A`] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + +let aff_ge_1_1_subset_aff_ge_fan=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +DISJOINT {x} {v,u} /\ ~(x=v1) +/\ v1 IN aff_ge {x} {v,u} +==> +aff_ge {x} {v1} SUBSET aff_ge {x} {v,u}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`v1:real^3`][IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % (t1 % x + t2 % v + t3 % u) +=(t1'+ t2'*t1) % x + (t2'* t2) % v + (t2' * t3 ) % u:real^3`] +THEN STRIP_TAC +THEN EXISTS_TAC`t1' + t2' * t1:real` +THEN EXISTS_TAC`t2' * t2:real` +THEN EXISTS_TAC`t2' * t3 :real` +THEN MP_TAC(REAL_ARITH`&0 &0<= t2'`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t2:real`] +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t3:real`] +THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t2' * t1) + t2' * t2 + t2' * t3 = +t1'+t2'*(t1+t2+t3)`; REAL_ARITH`A* &1=A`]);; + + + +let decomposition_planar_by_angle_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3. +~ collinear {x,v,u} /\ ~collinear {x,v,w} +/\ w IN aff_ge {x,v} {u} +==> u IN aff_gt {x} {v,w} \/ w IN aff_ge {x} {v,u}`, +REPEAT STRIP_TAC +THEN MRESAL_TAC aff_ge_inter_aff_ge[`(x:real^3)`;`(v:real^3)`;`(u:real^3)`][INTER; IN_ELIM_THM] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`v:real^3`;`w:real^3`; `u:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v:real^3`;`w:real^3`; `u:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(&0 < t2) \/ &0 <= --(t2:real)`) +THENL[ +SUBGOAL_THEN `u IN aff_gt {x} {v,w:real^3}` ASSUME_TAC +THENL[ +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t3:real` +THEN MP_TAC(REAL_ARITH`&0< t3==> &0 <= t3:real`) +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC THEN SET_TAC[]]; +MRESA_TAC remove_variable_fan[`x:real^3`; `v:real^3`; `w:real^3`;`u:real^3`;`t1:real`;`t2:real`;`t3:real`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th);]) +THEN DISCH_TAC +THEN REWRITE_TAC[VECTOR_ARITH`inv t3 % u - (inv t3 * t1) % x - (inv t3 * t2) % v +=(--inv t3 * t1) % x + inv t3 % u + (inv t3 * (--t2)) % v`] +THEN MP_TAC(REAL_ARITH`&0 ~( t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t3:real` +THEN MRESA1_TAC REAL_LT_INV`t3:real` +THEN MP_TAC(REAL_ARITH`&0< inv t3==> &0 <= inv t3`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`inv t3:real`;`-- (t2:real)`] +THEN DISCH_TAC +THEN SUBGOAL_THEN `w IN aff_ge {x, u} {v:real^3}` ASSUME_TAC +THENL[ +MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`u:real^3`;`v:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`(--inv t3 * t1):real` +THEN EXISTS_TAC`inv t3:real` +THEN EXISTS_TAC`(inv t3 * --t2):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`--inv t3 * t1 + inv t3 + inv t3 * --t2= +inv t3 * (t3+ &1- (t1 +t2 + t3))`; REAL_ARITH`a + &1 - &1 =a`]; +POP_ASSUM MP_TAC THEN SET_TAC[]]]);; + + +let point_in_aff_ge=prove(`!(x:real^3) (v:real^3) (w:real^3). +~collinear {x,v,w} +==> +x IN aff_ge {x} {v,w} +/\ v IN aff_ge {x} {v,w} +/\ w IN aff_ge {x} {v,w}`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN MRESA_TAC th3 [`x:real^3`;`v:real^3`;`w:real^3`] + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GE_1_2) +THEN RESA_TAC + THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THENL[ EXISTS_TAC`&1:real` +THEN EXISTS_TAC`&0:real` +THEN EXISTS_TAC`&0:real` +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ EXISTS_TAC`&0:real` +THEN EXISTS_TAC`&1:real` +THEN EXISTS_TAC`&0:real` +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC; + +EXISTS_TAC`&0:real` +THEN EXISTS_TAC`&0:real` +THEN EXISTS_TAC`&1:real` +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC]]);; + + +let aff_ge_subset_aff_gt_union_aff_ge=prove(`!(x:real^3) (v:real^3) (w:real^3). +~collinear {x,v,w} +==> +aff_ge {x} {v , w} SUBSET (aff_gt {x , v} {w}) UNION (aff_ge {x} {v})`, +REPEAT STRIP_TAC THEN MRESA_TAC th3 [`x:real^3`;`v:real^3`;`w:real^3`] + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GE_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GT_2_1) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`]AFF_GE_1_1) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[SUBSET; UNION;IN_ELIM_THM] + THEN GEN_TAC THEN +REWRITE_TAC[REAL_ARITH `(&0 <= (t3:real)) <=> (&0 < t3) \/ ( t3 = &0)`; TAUT `(a \/ b) /\ (c \/ d) /\ e /\ f <=> ((a \/ b)/\ c /\ e /\ f) \/ ((a \/ b) /\ d /\ e /\ f)`; EXISTS_OR_THM] THEN +MATCH_MP_TAC MONO_OR THEN +SUBGOAL_THEN `((?t1:real t2:real t3:real. + (&0 < t2 \/ t2 = &0) /\ + &0< t3 /\ + t1 + t2 + t3 = &1 /\ + (x':real^3) = t1 % x + t2 % v + t3 % w) + ==> (?t1 t2 t3. + &0< t3 /\ t1 + t2 + t3 = &1 /\ x' = t1 % x + t2 % v + t3 % w))` ASSUME_TAC +THENL +[MESON_TAC[]; + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC MONO_EXISTS THEN GEN_TAC THEN MATCH_MP_TAC MONO_EXISTS THEN GEN_TAC THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN GEN_TAC THEN + REWRITE_TAC[REAL_ARITH `(&0< (t2:real) \/ (t2 = &0)) <=> ( &0<= t2)`] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC [REAL_ARITH `(a:real)+ &0 = a`; VECTOR_ARITH `&0 % (w:real^3) = vec 0`; + VECTOR_ARITH ` ((x':real^3) = (t1:real) % (x:real^3) + (t2:real) % (v:real^3) + vec 0)<=> ( x' = t1 % x + t2 % v )` ] + THEN MESON_TAC[]]);; + +let pos_in_aff_ge_fan=prove(`!x:real^3 v:real^3 u:real^3 a:real. +DISJOINT {x} {v,u} +/\ &0 +(&1-a)%v + a % u IN aff_ge {x} {v,u:real^3}`, + +REPEAT STRIP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1 -a:real` +THEN EXISTS_TAC`a:real` +THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 <= &1 - a /\ &0 <= a`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC);; + + + +let aff_gt1_subset_aff_gt=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +DISJOINT {x} {v,u} /\ ~collinear {x,v1,u} +/\ v1 IN aff_gt {x} {v,u} +==> +aff_gt {x} {v1,u} SUBSET aff_gt {x} {v,u}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v1:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v1:real^3`;`u:real^3`][IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % (t1 % x + t2 % v + t3 % u) + t3' % u +=(t1'+ t2'*t1) % x + (t2'* t2) % v + (t2' * t3 + t3') % u:real^3`] +THEN STRIP_TAC +THEN EXISTS_TAC`t1' + t2' * t1:real` +THEN EXISTS_TAC`t2' * t2:real` +THEN EXISTS_TAC`t2' * t3 +t3':real` +THEN MP_TAC(REAL_ARITH`&0 &0<= t2'`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`t2':real`;`t2:real`] +THEN MRESA_TAC REAL_LT_MUL[`t2':real`;`t3:real`] +THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t2' * t1) + t2' * t2 + t2' * t3 + t3'= +t1'+t2'*(t1+t2+t3)+t3'`; REAL_ARITH`A* &1=A`] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + +let aff_ge_eq_aff_gt_union_aff_ge=prove(`!(x:real^3) (v:real^3) (w:real^3). +~collinear {x,v,w} +==> +aff_ge {x} {v , w} = (aff_gt {x} {v,w}) UNION (aff_ge {x} {v}) UNION (aff_ge {x} {w})`, + +REPEAT STRIP_TAC THEN MRESA_TAC th3 [`x:real^3`;`v:real^3`;`w:real^3`] + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GE_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GT_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`]AFF_GE_1_1) + THEN MP_TAC(ISPECL[`x:real^3`;`w:real^3`]AFF_GE_1_1) THEN RESA_TAC THEN RESA_TAC + THEN ASM_REWRITE_TAC[EXTENSION;UNION;IN_ELIM_THM] +THEN GEN_TAC THEN EQ_TAC +THENL[STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0<= t2/\ &0<=t3==> (t2= &0)\/ (t3= &0)\/ (&0 x = y + z`; + VECTOR_ARITH `x - y = z:real^N <=> x = y + z`] THEN + REWRITE_TAC[VECTOR_ADD_RID; REAL_ADD_RID] THEN SET_TAC[]);; + + +let aff_ge1_1_subset_aff_ge=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +DISJOINT {x} {v,u} /\ ~(x=v1) +/\ v1 IN aff_ge {x} {v,u} +==> +aff_ge {x} {v1} SUBSET aff_ge {x} {v,u}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`v1:real^3`;][IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % (t1 % x + t2 % v + t3 % u) +=(t1'+ t2'*t1) % x + (t2'* t2) % v + (t2' * t3 ) % u:real^3`] +THEN STRIP_TAC +THEN EXISTS_TAC`t1' + t2' * t1:real` +THEN EXISTS_TAC`t2' * t2:real` +THEN EXISTS_TAC`t2' * t3:real` +THEN MP_TAC(REAL_ARITH`&0 &0<= t2'`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t2:real`] +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t3:real`] +THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t2' * t1) + t2' * t2 + t2' * t3 = +t1'+t2'*(t1+t2+t3)`; REAL_ARITH`A* &1=A`] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + + +let properties1_inside_fan=prove(`!x:real^3 u:real^3 w:real^3. +DISJOINT {x} {u,w} +/\ &0 (&1-a)%u+ a%w IN aff_ge {x} {u,w:real^3}`, +REPEAT STRIP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1 -a:real` +THEN EXISTS_TAC`a:real` +THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 <= &1 - a /\ &0 <= a`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC);; + + + + +let properties_inside_collinear1_fan=prove(`!x:real^3 u:real^3 w:real^3. +~collinear{x,u,w} +/\ &0 aff_ge {x} {u} INTER aff_ge {x} {(&1-a)%u+ a%w,w:real^3} SUBSET aff_ge {x} {}`, + +REPEAT STRIP_TAC +THEN MRESA_TAC properties_inside_collinear_fan[`(x:real^3)`;`(u:real^3)`;`(w:real^3)`;`a:real`] +THEN MRESA_TAC th3[`(x:real^3)`;`((&1-a)%u+ a%w:real^3)`;`(w:real^3)`] +THEN MRESA_TAC th3[`(x:real^3)`;`u:real^3`;`(w:real^3)`] +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`(&1-a)%u+ a%w:real^3`;`w:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`u:real^3`][IN_ELIM_THM;INTER;SUBSET;AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_1] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`&1` +THEN REDUCE_VECTOR_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0<= t2' /\ &0 <= t3==> (t2'= &0 /\ t3 = &0)\/ (&0< t2' \/ &0 (t2'* a + t3) % w = (t1-t1') % x +( t2-t2' * (&1-a))% u :real^3`] +THEN MRESA_TAC REAL_LT_MUL[`t2':real`;`a:real`] +THEN MP_TAC(REAL_ARITH` &0< t2'*(a) /\ &0<= t3 ==> &0 < t2'*(a)+t3 /\ ~(t2'*(a)+t3:real= &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2'*(a)+t3:real` +THEN MRESA1_TAC REAL_LT_INV`t2'*(a)+t3:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(t2'* a + t3) % w = (t1-t1') % x +( t2-t2' * (&1-a))% u:real^3 + ==> (inv (t2' * a+t3))%((t2'* a + t3) % w) = (inv (t2' * a+t3))%( (t1-t1') % x +( t2-t2' * (&1-a))% u)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`w IN aff {x,u:real^3}`ASSUME_TAC +THENL[REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`(inv (t2' * a+t3)) * (t1 - t1'):real` +THEN EXISTS_TAC`(inv (t2' * a+t3) * (t2 - t2' *(&1- a))):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (t2' * a + t3) * (t1 - t1') + inv (t2' * a + t3) * (t2 - t2' * (&1 - a)) += inv (t2' * a + t3) * ((t2'*a +t3)+(t1 + t2) -(t1'+ t2' +t3) ):real`; REAL_ARITH`A+ &1- &1= A`]; +ASM_MESON_TAC[]]; + +STRIP_TAC THEN +REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % u = t1' % x + t2' % ((&1 - a) % u + a % w) + t3 % w +<=> (t2'* a + t3) % w = (t1-t1') % x +( t2-t2' * (&1-a))% u :real^3`] +THEN MP_TAC(REAL_ARITH`&0 &0<=a`) THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`a:real`] +THEN MP_TAC(REAL_ARITH` &0<= t2'*(a) /\ &0< t3 ==> &0 < t2'*(a)+t3 /\ ~(t2'*(a)+t3:real= &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2'*(a)+t3:real` +THEN MRESA1_TAC REAL_LT_INV`t2'*(a)+t3:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(t2'* a + t3) % w = (t1-t1') % x +( t2-t2' * (&1-a))% u:real^3 + ==> (inv (t2' * a+t3))%((t2'* a + t3) % w) = (inv (t2' * a+t3))%( (t1-t1') % x +( t2-t2' * (&1-a))% u)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`w IN aff {x,u:real^3}`ASSUME_TAC +THENL[ +REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`(inv (t2' * a+t3)) * (t1 - t1'):real` +THEN EXISTS_TAC`(inv (t2' * a+t3) * (t2 - t2' *(&1- a))):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (t2' * a + t3) * (t1 - t1') + inv (t2' * a + t3) * (t2 - t2' * (&1 - a)) += inv (t2' * a + t3) * ((t2'*a +t3)+(t1 + t2) -(t1'+ t2' +t3) ):real`; REAL_ARITH`A+ &1- &1= A`]; +ASM_MESON_TAC[]]]);; + + + + + +let exists_in_aff_gt=prove(`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u} ==> ?y:real^3. y IN aff_gt {x} {v, u}`, +REPEAT STRIP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0 % x+ &1 / &2 % v+ &1/ &2 %u:real^3 ` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1/ &2` +THEN EXISTS_TAC`&1/ &2` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC);; + + + +let in_aff_2_2_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3. +~coplanar {x,v,u,w} +==> +(!t:real. &0< t /\ t< &1 +==> (!t1:real t2:real t3:real. &0t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w) IN aff_gt {x,v} {u,w}))`, + + +REPEAT STRIP_TAC +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`] +THEN SUBGOAL_THEN `DISJOINT {x,v:real^3} {u,w:real^3}` ASSUME_TAC +THENL[ +REWRITE_TAC[DISJOINT_SYM;SET_RULE`{v:real^3,w:real^3}= {v} UNION {w}`;DISJOINT_UNION] +THEN REWRITE_TAC[SET_RULE`{v} UNION {w}={v:real^3,w:real^3}`] +THEN ONCE_REWRITE_TAC[DISJOINT_SYM] +THEN ASM_REWRITE_TAC[]; +MRESAL_TAC AFF_GT_2_2[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t3*(&1-t):real` +THEN EXISTS_TAC`t3*(t):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`t1 +t2+ t3 * (&1 - t) + t3 * t = t1+t2+t3:real`;VECTOR_ARITH`t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w) = + t1 % x + t2 % v + (t3 * (&1 - t)) % u + (t3 * t) % w:real^3`] +THEN STRIP_TAC THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_TAC +THEN REAL_ARITH_TAC]);; + + + + + + + +let condition_to_in_aff_gt_by_angle=prove(`!x:real^3 v:real^3 u:real^3 s1:real. +~collinear {x,v,u} /\ &0< (v - x) dot (u - x) /\ &0< s1 +/\ s1< atn ((norm ((v - x) cross (u - x))) * inv((v - x) dot (u - x))) +==> +sin s1 % e1_fan x v u + cos s1 % e3_fan x v u + x IN aff_gt {x} {v, u}`, +REPEAT STRIP_TAC +THEN ASSUME_TAC(ISPEC`(norm ((v - x) cross (u - x)) * inv ((v - x) dot (u - x))):real`ATN_BOUNDS) +THEN MP_TAC (REAL_ARITH`s1< atn ((norm ((v - x) cross (u - x))) * inv((v - x) dot (u - x))) +/\ atn ((norm ((v - x) cross (u - x))) * inv((v - x) dot (u - x))) < pi/ &2 +==> s1< pi / &2`) THEN RESA_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN REWRITE_TAC[VECTOR_ARITH`sin s1 % e1_fan x v u + cos s1 % e3_fan x v u + x = + t1 % x + t2 % v + t3 % u +<=> sin s1 % e1_fan x v u + cos s1 % e3_fan x v u = + (t1- &1) % x + t2 % v + t3 % u`;e1_fan;e2_fan;e3_fan;CROSS_LMUL;CROSS_RMUL] +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_ARITH`-- (A-B) = B-A:real^3`] +THEN SUBGOAL_THEN`~(norm((v:real^3)-(x:real^3))= &0)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[NORM_EQ_0;VECTOR_ARITH`v-x=vec 0<=> x=v`]; +MP_TAC(ISPEC`norm((v:real^3)-(x:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; REAL_ARITH`(((A*B)*D)*D)=A*B*(D pow 2)`;] +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`A%(B-C)=A%B-A%C`] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;DOT_SQUARE_NORM;REAL_ARITH`(A*B*C pow 2) * D pow 2=A*B*(C*D) pow 2`;REAL_ARITH`A* &1 pow 2=A`;NORM_MUL;REAL_ABS_INV;REAL_ABS_NORM;REAL_INV_MUL;REAL_INV_INV +; ] +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B*C) * D pow 2= A*C * D*(D*B)`;REAL_ARITH`A*B* &1= A*B`;VECTOR_ARITH`A-B+C%D-C%E=A-B+C%(D-E)`;VECTOR_ARITH`A-C%D+B%D=A+(B-C)%D`; +REAL_ARITH`A*B-(C*D*B)*E=B*(A-C*D*E)`] +THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] +THEN SUBGOAL_THEN`~(norm((v - x) cross (u - x:real^3))= &0)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[NORM_EQ_0] +THEN MP_TAC(ISPECL[`v-x:real^3`;`u-x:real^3`]CROSS_EQ_0) +THEN ONCE_REWRITE_TAC[GSYM COLLINEAR_3;] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[]; +MP_TAC(ISPEC`norm((v - x) cross (u - x:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`(v - x) cross (u - x:real^3)`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(norm ((v - x) cross (u - x:real^3)) = &0)/\ &0 <= norm ((v - x) cross (u - x:real^3))==> &0< norm ((v - x) cross (u - x:real^3)) `) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`norm((v - x) cross (u - x:real^3))` + +THEN ASSUME_TAC(ISPEC`(v - x:real^3)`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(norm ((v - x:real^3)) = &0)/\ &0 <= norm ((v - x:real^3))==> &0< norm ((v - x:real^3)) `) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`norm((v - x:real^3))` +THEN MRESA1_TAC COS_POS_PI2`s1:real` +THEN MRESA1_TAC SIN_POS_PI2`s1:real` +THEN EXISTS_TAC`&1-(sin s1 * norm (v - x) * inv (norm ((v - x) cross (u - x)))) +-(inv (norm (v - x)) * + (cos s1 - + sin s1 * inv (norm ((v - x) cross (u - x))) * ((v - x) dot (u - x:real^3))))` +THEN EXISTS_TAC `(inv (norm (v - x)) * + (cos s1 - + sin s1 * inv (norm ((v - x) cross (u - x))) * ((v - x) dot (u - x:real^3))))` +THEN EXISTS_TAC`(sin s1 * norm (v - x) * inv (norm ((v - x) cross (u - x:real^3))))` +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0 B --(pi / &2) < s1`) +THEN RESA_TAC +THEN MRESAL_TAC TAN_MONO_LT[`s1:real`;`atn (norm ((v - x) cross (u - x)) * inv ((v - x) dot (u - x))):real`][ATN_TAN] +THEN MRESAL_TAC REAL_LT_LMUL[`inv (norm ((v - x) cross (u - x:real^3)))`;`tan s1:real`;`norm ((v - x) cross (u - x)) * inv ((v - x) dot (u - x:real^3))`][REAL_ARITH`A*B*C=(A*B)*C`;REAL_ARITH`&1*A=A`] +THEN MP_TAC(REAL_ARITH`&0<(v - x) dot (u - x:real^3)==> ~((v - x) dot (u - x:real^3)= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(v - x) dot (u - x:real^3)`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(cos s1= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`cos s1`REAL_MUL_LINV) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LT_RMUL[`inv (norm ((v - x) cross (u - x:real^3)))* tan s1:real`;`inv ((v - x) dot (u - x:real^3))`;`(v - x) dot (u - x:real^3)`][REAL_ARITH`(A*B)*C=A*C*B`;tan] + +THEN MRESAL_TAC REAL_LT_RMUL[`inv (norm ((v - x) cross (u - x:real^3)))* ((v - x) dot (u - x:real^3))* sin s1 / cos s1`;`&1`;`cos s1`][REAL_ARITH`&1* A=A`;real_div;REAL_ARITH`(A*B*C*D)*E=(C*A*B)*(D*E)`;REAL_ARITH`A* &1=A`] +THEN ASM_TAC THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ +MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]; + +STRIP_TAC +THENL[ +REAL_ARITH_TAC; +VECTOR_ARITH_TAC]]]]]);; + + + + + + + + +let condition1_to_in_aff_gt_by_angle=prove(`!x:real^3 v:real^3 u:real^3 s1:real. +~collinear {x,v,u} /\ &0< s1 /\ s1< pi/ &2 +/\ (v - x) dot (u - x:real^3) <= &0 +==> +sin s1 % e1_fan x v u + cos s1 % e3_fan x v u + x IN aff_gt {x} {v, u}`, + +REPEAT STRIP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN REWRITE_TAC[VECTOR_ARITH`sin s1 % e1_fan x v u + cos s1 % e3_fan x v u + x = + t1 % x + t2 % v + t3 % u +<=> sin s1 % e1_fan x v u + cos s1 % e3_fan x v u = + (t1- &1) % x + t2 % v + t3 % u`;e1_fan;e2_fan;e3_fan;CROSS_LMUL;CROSS_RMUL] +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_ARITH`-- (A-B) = B-A:real^3`] +THEN SUBGOAL_THEN`~(norm((v:real^3)-(x:real^3))= &0)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[NORM_EQ_0;VECTOR_ARITH`v-x=vec 0<=> x=v`]; +MP_TAC(ISPEC`norm((v:real^3)-(x:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; REAL_ARITH`(((A*B)*D)*D)=A*B*(D pow 2)`;] +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`A%(B-C)=A%B-A%C`] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;DOT_SQUARE_NORM;REAL_ARITH`(A*B*C pow 2) * D pow 2=A*B*(C*D) pow 2`;REAL_ARITH`A* &1 pow 2=A`;NORM_MUL;REAL_ABS_INV;REAL_ABS_NORM;REAL_INV_MUL;REAL_INV_INV +; ] +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B*C) * D pow 2= A*C * D*(D*B)`;REAL_ARITH`A*B* &1= A*B`;VECTOR_ARITH`A-B+C%D-C%E=A-B+C%(D-E)`;VECTOR_ARITH`A-C%D+B%D=A+(B-C)%D`; +REAL_ARITH`A*B-(C*D*B)*E=B*(A-C*D*E)`] +THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] +THEN SUBGOAL_THEN`~(norm((v - x) cross (u - x:real^3))= &0)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[NORM_EQ_0] +THEN MP_TAC(ISPECL[`v-x:real^3`;`u-x:real^3`]CROSS_EQ_0) +THEN ONCE_REWRITE_TAC[GSYM COLLINEAR_3;] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[]; +MP_TAC(ISPEC`norm((v - x) cross (u - x:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`(v - x) cross (u - x:real^3)`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(norm ((v - x) cross (u - x:real^3)) = &0)/\ &0 <= norm ((v - x) cross (u - x:real^3))==> &0< norm ((v - x) cross (u - x:real^3)) `) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`norm((v - x) cross (u - x:real^3))` + +THEN ASSUME_TAC(ISPEC`(v - x:real^3)`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(norm ((v - x:real^3)) = &0)/\ &0 <= norm ((v - x:real^3))==> &0< norm ((v - x:real^3)) `) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`norm((v - x:real^3))` +THEN MRESA1_TAC COS_POS_PI2`s1:real` +THEN MRESA1_TAC SIN_POS_PI2`s1:real` +THEN EXISTS_TAC`&1-(sin s1 * norm (v - x) * inv (norm ((v - x) cross (u - x)))) +-(inv (norm (v - x)) * + (cos s1 - + sin s1 * inv (norm ((v - x) cross (u - x))) * ((v - x) dot (u - x:real^3))))` +THEN EXISTS_TAC `(inv (norm (v - x)) * + (cos s1 - + sin s1 * inv (norm ((v - x) cross (u - x))) * ((v - x) dot (u - x:real^3))))` +THEN EXISTS_TAC`(sin s1 * norm (v - x) * inv (norm ((v - x) cross (u - x:real^3))))` +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0 B sin s1 * inv (norm ((v - x) cross (u - x))) * ((v - x) dot (u - x)) < cos s1`) +THEN ASM_REWRITE_TAC[REAL_ARITH`A *B *C<= &0<=> &0<= A*B*(-- C)`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN MP_TAC(REAL_ARITH`&0< sin s1==> &0<= sin s1`) THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN MP_TAC(REAL_ARITH`&0< inv (norm ((v - x) cross (u - x)))==> &0<= inv (norm ((v - x) cross (u - x)))`) THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ +MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THENL[ +REAL_ARITH_TAC; +VECTOR_ARITH_TAC]]]]]);; + + + + + + +let scale_in_edges_fan=prove(`!(x:real^3) (v:real^3) (u:real^3) (w:real^3). +DISJOINT {x} {v,u} +/\ w IN aff_gt {x} {v,u} +==> +(?a t:real. &0 w-x = ((t1+t2+t3)- &1) % x + (((t1+t2+t3) -t1)- t3)% (v-x) + t3 % (u-x):real^3`] +THEN ASM_REWRITE_TAC[REAL_ARITH`&1- &1= &0`] THEN REDUCE_VECTOR_TAC +THEN MP_TAC(REAL_ARITH`&0< t2 /\ &0< t3 /\ t1+t2+t3= &1 ==> ~(&1-t1= &0)/\ &0< &1- t1`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV `(&1-t1:real)` +THEN MRESA1_TAC REAL_LT_INV `(&1-t1:real)` +THEN MRESA_TAC REAL_LT_MUL [`inv(&1-t1:real)`;`t3:real`] +THEN MRESA_TAC REAL_LT_MUL [`inv(&1-t1:real)`;`t2:real`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[REAL_ARITH`inv (&1 - t1) * t2=inv (&1 - t1) * ((t1+t2+t3)-t1)- inv(&1-t1)*t3:real`] +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +w - x = (&1 - t1 - t3) % (v - x) + t3 % (u - x):real^3 +==> (inv (&1- t1))%(w - x ) = (inv (&1-t1))%((&1 - t1 - t3) % (v - x) + t3 % (u - x)) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`;REAL_ARITH`inv (&1 - t1) * (&1 - t1 - t3)=inv (&1 - t1) * (&1 - t1) - inv (&1 - t1) * (t3)`;VECTOR_ARITH`(&1-A)%(U-X)+A%(V-X)=(&1-A)%U+A%V-X`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`inv(&1- t1:real)` +THEN EXISTS_TAC`inv(&1-t1) *t3:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`A< &1<=> &0< &1- A`]);; + + + + +let aff_gt_imp_not_collinear=prove(`!x u v w:real^3. +~collinear{x,v,u}/\ w IN aff_gt{x,v} {u}==> ~collinear{x,v,w}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(u:real^3) `;] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN ASM_REWRITE_TAC[collinear_fan;aff;AFFINE_HULL_2;IN_ELIM_THM;] +THEN DISCH_THEN(LABEL_TAC"A") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % u = u' % x + v' % v<=> +t3 % u = (u'-t1) % x + (v'-t2) % v`] +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t3:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`t3 % u = (u' - t1) % x + (v' - t2) % v:real^3 + ==> (inv (t3))%(t3 % u ) = (inv (t3))%( (u' - t1) % x + (v' - t2) % v)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`(inv (t3)) * (u' - t1):real` +THEN EXISTS_TAC`(inv (t3)) * (v' -t2):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (t3) * (u' - t1) + inv (t3) * (v'- t2) += inv (t3) * (t3+ (u'+v')- (t1 + t2 +t3)):real`; REAL_ARITH`A+ &1- &1= A`]);; + + +let aff_gt_1_2_scale_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 a:real. +&0< a /\ a % (u-x)= w-x /\ ~collinear {x,w,v} +==> aff_gt {x} {u,v} =aff_gt {x} {w,v}`, +REPEAT GEN_TAC +THEN GEOM_ORIGIN_TAC `x:real^3` +THEN REDUCE_VECTOR_TAC +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(a= &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV `a:real` +THEN MRESA1_TAC REAL_LT_INV`a:real` +THEN FIND_ASSUM(MP_TAC)`a %u=w:real^3` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +a%u=w:real^3 +==> (inv (a))%(a%u) = (inv (a))%(w)`) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C:real^3`] +THEN REWRITE_TAC[VECTOR_ARITH`&1 % u= inv a % w<=> inv a % w= u`] +THEN STRIP_TAC +THEN MRESA_TAC COLLINEAR_SPECIAL_SCALE[`a:real`;`u:real^3`;`v:real^3`] +THEN MRESA_TAC th3[`((vec 0):real^3)` ;` (u:real^3)`;`(v:real^3) `;] +THEN MRESA_TAC th3[`((vec 0):real^3)` ;` (w:real^3)`;`(v:real^3) `;] +THEN MRESAL_TAC AFF_GT_1_2[`(vec 0):real^3`;`u:real^3`;`v:real^3`][IN_ELIM_THM;EXTENSION] +THEN MRESAL_TAC AFF_GT_1_2[`(vec 0):real^3`;`w:real^3`;`v:real^3`][IN_ELIM_THM] +THEN REDUCE_VECTOR_TAC +THEN GEN_TAC THEN EQ_TAC +THENL[ STRIP_TAC +THEN EXISTS_TAC`&1- inv a * t2-t3:real` +THEN EXISTS_TAC `inv a * t2:real` +THEN EXISTS_TAC `t3:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - inv a * t2 - t3 + inv a * t2 + t3 = &1`;VECTOR_ARITH`(A*B)%C=B%(A%C)`] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THEN EXISTS_TAC`&1- a * t2-t3:real` +THEN EXISTS_TAC `a * t2:real` +THEN EXISTS_TAC `t3:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - a * t2 - t3 + a * t2 + t3 = &1`;VECTOR_ARITH`(A*B)%C=B%(A%C)`] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]]);; + + + + +let in_aff_gt_1_2=prove(`!x:real^3 v:real^3 u:real^3 t:real. +DISJOINT {x} {v,u} /\ &0< t /\ t< &1==> (&1-t)% v+ t% u IN aff_gt {x} {v,u}`, +REPEAT STRIP_TAC +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM;] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1 - t:real` +THEN EXISTS_TAC`t:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1 - t<=> t< &1`;REAL_ARITH`&0 + &1 - t + t= &1`] +THEN VECTOR_ARITH_TAC);; + + +let sym_line1_fan=prove(`!x y z:real^N. x IN aff {y, z} /\ ~(x=y) +==> z IN aff {x,y}`, +REPEAT GEN_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(v= &0)\/ ~(v= &0)`) +THENL[ ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN RESA_TAC +THEN REDUCE_VECTOR_TAC +THEN RESA_TAC +THEN SET_TAC[]; +MP_TAC(ISPEC`(v:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`inv(v:real)` +THEN EXISTS_TAC`-- inv(v:real) *u` +THEN ASM_REWRITE_TAC[REAL_ARITH` inv v + --inv v * u = inv v * (v+ &1- (u+v)) `;REAL_ARITH`A+ &1 - &1= A`;VECTOR_ARITH`inv v % (u % y + v % z) + (--inv v * u) % y=(inv v * v) % z `] +THEN REDUCE_VECTOR_TAC]);; + + + +let POINT_IN_LINE=prove(`!x y:real^N. x IN aff {x,y}`, +REPEAT GEN_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC);; + +let POINT_IN_LINE1=prove(`!x y:real^N. y IN aff {x,y}`, +REPEAT GEN_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC);; + + +let AFFINE_HULL_AFFINE_EQ =prove(`!s:real^N->bool. affine hull (affine hull s)= affine hull s`, +STRIP_TAC THEN MATCH_MP_TAC AFFINE_HULLS_EQ +THEN ASSUME_TAC(ISPEC `s:real^N->bool` AFFINE_AFFINE_HULL) +THEN MRESA1_TAC AFFINE_HULL_EQ`affine hull s:real^N->bool` +THEN MRESA_TAC HULL_SUBSET[`affine:(real^N->bool)->bool`;` s:real^N->bool`;] +THEN SET_TAC[]);; + +let sym_line0_fan=prove( `!x y z:real^N. x IN aff {y, z} /\ DISJOINT {x} {y,z} +==> aff {x,z} SUBSET aff {x,y}`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`DISJOINT {x} {y,z}==> ~(x=y:real^N)`) +THEN RESA_TAC +THEN MRESA_TAC sym_line1_fan[`x:real^N`;`y:real^N`;`z:real^N`] +THEN MP_TAC(SET_RULE`x IN aff {x, y} /\ z IN aff {x, y} ==> {x, z:real^N} SUBSET aff {x, y}`) +THEN REWRITE_TAC[POINT_IN_LINE;] +THEN RESA_TAC +THEN MRESA_TAC HULL_MONO[`affine:(real^N->bool)->bool`;` {x, z:real^N}`;`aff {x, y:real^N}`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_AFFINE_EQ ]);; + + +let sym_line_fan=prove(`!x y z:real^N. x IN aff {y, z} /\ DISJOINT {x} {y,z} +==> aff {x,z} = aff {x,y}`, +REPEAT STRIP_TAC +THEN MRESA_TAC sym_line0_fan[`x:real^N`;`y:real^N`;`z:real^N`] +THEN MRESA_TAC sym_line0_fan[`x:real^N`;`z:real^N`;`y:real^N`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + +let sym_line01_fan=prove(`!x y z:real^N. x IN aff {y, z} /\ DISJOINT {y} {x,z} +==> aff {y,x} SUBSET aff {y,z}`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`y IN aff {y, z} /\ x IN aff {y, z} ==> {y,x:real^N} SUBSET aff {y,z}`) +THEN ASM_REWRITE_TAC[POINT_IN_LINE;] +THEN STRIP_TAC +THEN MRESA_TAC HULL_MONO[`affine:(real^N->bool)->bool`;` {y,x:real^N}`;`aff { y,z:real^N}`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_AFFINE_EQ ]);; + + +let sym_line02_fan=prove(`!x y z:real^N. x IN aff {y, z} /\ DISJOINT {y} {x,z} +==> aff {y,z} SUBSET aff {y,x}`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`DISJOINT {y} {x,z}==> ~(x=y:real^N)`) +THEN RESA_TAC +THEN MRESA_TAC sym_line1_fan[`x:real^N`;`y:real^N`;`z:real^N`] +THEN MP_TAC(SET_RULE`y IN aff {y, x} /\ z IN aff {y, x} ==> {y,z:real^N} SUBSET aff {y,x}`) +THEN ASM_REWRITE_TAC[POINT_IN_LINE;] +THEN STRIP_TAC +THEN MRESA_TAC HULL_MONO[`affine:(real^N->bool)->bool`;` {y,z:real^N}`;`aff { y,x:real^N}`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_AFFINE_EQ ] +THEN POP_ASSUM MP_TAC +THEN ASSUME_TAC(SET_RULE`{y,x}={x,y}`) +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[th;]) +THEN REWRITE_TAC[aff] +THEN RESA_TAC);; + + + +let sym_line_fan0=prove(`!x y z:real^N. x IN aff {y, z} /\ DISJOINT {x} {y,z} /\ DISJOINT {y} {x,z} +==> aff {x,z} = aff {y,z}`, +REPEAT STRIP_TAC +THEN MRESA_TAC sym_line_fan[`x:real^N`;`y:real^N`;`z:real^N`] +THEN SUBGOAL_THEN `y IN aff {x,z:real^N}` ASSUME_TAC +THENL[ASM_REWRITE_TAC[POINT_IN_LINE1]; +MRESA_TAC sym_line_fan[`y:real^N`;`x:real^N`;`z:real^N`] +THEN ASSUME_TAC(SET_RULE`{x,y}={y,x:real^N}`) +THEN ASM_REWRITE_TAC[]]);; + + +let sym_line_fan1=prove(`!x y z:real^N. x IN aff {y, z} /\ DISJOINT {y} {x,z} +==> aff {y,z} = aff {y,x}`, +REPEAT STRIP_TAC +THEN MRESA_TAC sym_line01_fan[`x:real^N`;`y:real^N`;`z:real^N`] +THEN MRESA_TAC sym_line02_fan[`x:real^N`;`y:real^N`;`z:real^N`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + +let aff_ge_1_1_subset_aff_fan=prove(`!x y z:real^3. ~(y=z) /\ x IN aff_ge {y} {z} ==> x IN aff {y,z} `, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GE_1_1[`y:real^3`;`z:real^3`][IN_ELIM_THM] +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN ASM_REWRITE_TAC[]);; + + +let place_there_point_line_fan=prove(`!x:real^3 y:real^3 z:real^3. +~(x=y)/\ z IN aff {x,y}==> ?t:real. &0 (u+v)< u `] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&1< u==> &0< u /\ ~(u= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV `u:real` +THEN MRESA1_TAC REAL_INV_LT_1 `u:real` +THEN MRESA1_TAC REAL_MUL_LINV `u:real` +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC `&0` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &0 /\ &1 + &0 = &1/\ u+ &1 - &1 =u`;VECTOR_ARITH`(&1 - inv u) % y + inv u % (u % x + v % y)=(&1 - inv u*(u+ &1- (u+v))) % y + (inv u * u) % x /\ (&1 - &1) % y + &1 % x = &1 % x + &0 % y`]]);; + + + + +let permutes_4points_collinear=prove(`!x y z w:real^N. +~(x=y)/\ ~(x=z) /\ y IN aff {x,z}/\ ~collinear{x,y,w}==> ~collinear{x,z,w}`, +REWRITE_TAC[collinear_fan] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`~(x=y)/\ ~(x=z) ==> DISJOINT {x} {y, z:real^N}`) +THEN RESA_TAC +THEN MRESA_TAC sym_line_fan1[`y:real^N`;`x:real^N`;`z:real^N`]);; + + +let permutes_4points_collinear1=prove(`!x y z w:real^N. +~(x=y)/\ ~(x=z) /\ y IN aff {x,z}/\ ~collinear{x,z,w}==> ~collinear{x,y,w}`, +REWRITE_TAC[collinear_fan] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`~(x=y)/\ ~(x=z) ==>DISJOINT {x} {y, z:real^N}`) +THEN RESA_TAC +THEN MRESA_TAC sym_line01_fan[`y:real^N`;`x:real^N`;`z:real^N`] +THEN ASM_TAC THEN SET_TAC[]);; + + +let in_aff_gt_eq_azim=prove(`!x y z w0 w1:real^3. +~(x=z) /\ y IN aff_gt {x} {z}==> azim x y w0 w1=azim x z w0 w1`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GT_1_1[`x:real^3`;`z:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT {x} {z}<=> ~(x=z)`] +THEN ASM_TAC +THEN GEOM_ORIGIN_TAC `x:real^3` +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`u % (x + vec 0) + v%(x+ z)= (u+v)%x+v %z`;VECTOR_ARITH`(x + y = &1 % x + v % z)<=> y = v % z`] +THEN RESA_TAC +THEN ASM_TAC THEN SET_TAC[AZIM_SPECIAL_SCALE]);; + +let no_origin_aff_ge_is_aff_gt=prove(`!x y z:real^3. +~(x=y) /\ ~(x=z) /\ z IN aff_ge {x} {y}==> z IN aff_gt {x} {y}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GT_1_1[`x:real^3`;`y:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT {x} {z}<=> ~(x=z)`] +THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`y:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT {x} {z}<=> ~(x=z)`] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0<= t2==> t2= &0 \/ &0< t2`) +THEN RESA_TAC +THEN REDUCE_ARITH_TAC +THEN RESA_TAC +THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN ASM_REWRITE_TAC[]);; + + + + +let aff_ge_2_1_is_exists_point_inaff_ge_1_2=prove(`!x:real^3 y:real^3 z:real^3 w:real^3. +DISJOINT {x} {y,w} /\ DISJOINT {x,y} {w}/\ z IN aff_ge {x,y} {w}==> ?t. &0 &0< &1 -t2 /\ &1< &1 -t2 /\ &0<= &1 -t2 /\ ~(&1- t2= &0) `) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`&1-t2` +THEN MRESA1_TAC REAL_LE_INV`&1-t2` +THEN MRESA1_TAC REAL_MUL_LINV `&1- t2:real` +THEN MRESA1_TAC REAL_INV_LT_1`&1- t2` +THEN EXISTS_TAC`inv(&1 - t2)* t1:real` +THEN EXISTS_TAC`inv(&1 - t2)* t2 + &1 - inv(&1 - t2):real` +THEN EXISTS_TAC`inv(&1 - t2)* t3` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1 - t2) * t1 + + (inv (&1 - t2) * t2 + &1 - inv (&1 - t2)) + + inv (&1 - t2) * t3= inv (&1 - t2) * (t1 +t2+t3)+ &1 - inv (&1 - t2) /\ inv (&1 - t2) * &1 + &1 - inv (&1 - t2) = &1`;VECTOR_ARITH`(&1 - inv (&1 - t2)) % y + inv (&1 - t2) % (t1 % x + t2 % y + t3 % w) = + (inv (&1 - t2) * t1) % x + + (inv (&1 - t2) * t2 + &1 - inv (&1 - t2)) % y + + (inv (&1 - t2) * t3) % w`;REAL_ARITH`inv (&1 - t2) * t2 + &1 - inv (&1 - t2)= &1 - inv (&1 - t2) *(&1-t2)`;REAL_ARITH`&0<= &1 - &1`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[]]);; + + + + +let point_in_aff_gt_2_1_change_point_in_aff_gt_1_2=prove(` !x:real^3 v:real^3 u:real^3 y:real^3. + ~collinear {x,v,u} +/\ y IN aff_gt {x} {v,u} +==> u IN aff_gt {x,v} {y}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN REMOVE_THEN "YEU" MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`;] +THEN MRESA_TAC th3[`x:real^3`;`y:real^3`;`v:real^3`;] +THEN MRESA_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`;] +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`v:real^3`;`y:real^3`;][IN_ELIM_THM] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0< t3==> ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`t3:real` +THEN MRESA1_TAC REAL_MUL_LINV`t3:real` +THEN EXISTS_TAC`-- inv t3 * t1:real` +THEN EXISTS_TAC`-- inv t3 * t2:real` +THEN EXISTS_TAC`inv t3 :real` +THEN ASM_REWRITE_TAC[REAL_ARITH`--inv t3 * t1 + --inv t3 * t2 + inv t3= inv t3 *( t3 + &1- (t1+t2+t3))`;REAL_ARITH`A+ &1- &1 =A`;VECTOR_ARITH`(--inv t3 * t1) % x + + (--inv t3 * t2) % v + + inv t3 % (t1 % x + t2 % v + t3 % u)= (inv t3 * t3) % u`] +THEN VECTOR_ARITH_TAC);; + +let pos_in_aff_gt_fan=prove(`!x:real^3 v:real^3 u:real^3 a:real. +DISJOINT {x} {v,u} +/\ &0 +(&1-a)%v + a % u IN aff_gt {x} {v,u:real^3}`, + +REPEAT STRIP_TAC +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1 -a:real` +THEN EXISTS_TAC`a:real` +THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 < &1 - a /\ &0 < a`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC);; + + +let pos_in_aff_gt_2_1_fan=prove(`!x:real^3 v:real^3 u:real^3 a:real. +DISJOINT {x,v} {u} +/\ &0 +(&1-a)%v + a % u IN aff_gt {x,v} {u:real^3}`, + +REPEAT STRIP_TAC +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1 -a:real` +THEN EXISTS_TAC`a:real` +THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 < &1 - a /\ &0 < a`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC);; + + + + + + +(* ========================================================================== *) +(* SEGMENT (^_^) *) +(* ========================================================================== *) + + +let segment_in_segment=prove(`!x y z:real^N. z IN segment [x,y]==> (!t. &0<= t /\ t<= &1 ==> (&1-t) %z +t %y IN segment[x,y])`, +REWRITE_TAC[segment;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`(&1- t)* u+t:real` +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - t) % ((&1 - u) % x + u % y) + t % y = + (&1 - ((&1 - t) * u + t)) % x + ((&1 - t) * u + t) % y:real^N`] +THEN STRIP_TAC +THENL[MATCH_MP_TAC REAL_LE_ADD +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &1- t<=> t<= &1`]; + +REWRITE_TAC[REAL_ARITH`(&1 - t) * u + t <= &1<=> &0<= (&1 - t) * (&1-u)`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &1- t<=> t<= &1`]]);; + +let segmentsubset_aff_gt=prove(`!x y z w:real^N. +DISJOINT {x} {y,z}/\ w IN aff_gt {x} {y,z} +==> !t. &0<= t /\ t< &1 ==> (&1-t) %w+t%z IN aff_gt {x} {y,z}`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GT_1_2[`x:real^N`;`y:real^N`;`z:real^N`][IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`(&1-t)*t1:real` +THEN EXISTS_TAC`(&1-t)*t2:real` +THEN EXISTS_TAC`(&1-t)*t3+t:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - t) % (t1 % x + t2 % y + t3 % z) + t % z = + ((&1 - t) * t1) % x + ((&1 - t) * t2) % y + ((&1 - t) * t3 + t) % z:real^N`;REAL_ARITH`(&1 - t) * t1 + (&1 - t) * t2 + (&1 - t) * t3 + t=(&1 - t) * (t1 + t2 +t3) + t/\ (&1 - t) * &1 + t = &1`] +THEN STRIP_TAC +THENL[MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1- t<=> t< &1`]; + +MATCH_MP_TAC (REAL_ARITH`&0 &0< A+B`) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1- t<=> t< &1`]]);; + +(* ========================================================================== *) +(* SOME LINEAR FUNCTIONS (^_^) *) +(* ========================================================================== *) + + +let linear_aff_fan=prove(`!x:real^3 v:real^3 u:real^3. +linear (\(t:real^2). t$1 %(v-x)+t$2 %(u-x))`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC LINEAR_COMPOSE_ADD +THEN STRIP_TAC +THEN MATCH_MP_TAC LINEAR_VMUL_COMPONENT +THEN SIMP_TAC[LINEAR_ID; DIMINDEX_2; ARITH]);; + +let linear1_aff_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3. +linear (\(t:real^3). t$1 %(v-x)+t$2 %(u-x)+t$3 %(w-u))`, +REPEAT STRIP_TAC +THEN REPEAT(MATCH_MP_TAC LINEAR_COMPOSE_ADD THEN STRIP_TAC) +THEN MATCH_MP_TAC LINEAR_VMUL_COMPONENT +THEN SIMP_TAC[LINEAR_ID; DIMINDEX_3; ARITH]);; + + + + + +let linear_inj_fan=prove(`!x:real^3 v:real^3 u:real^3. +~collinear{x,v,u} +==>(!(a:real^2) (b:real^2). (\(t:real^2). t$1 %(v-x)+t$2 %(u-x))(a)=(\(t:real^2). t$1 %(v-x)+t$2 %(u-x))(b) ==>a=b)`, + +REPEAT GEN_TAC +THEN DISCH_TAC +THEN ASSUME_TAC(ISPECL[`x:real^3`;` v:real^3`;`u:real^3`]linear_aff_fan) +THEN MP_TAC(ISPEC`(\(t:real^2). t$1 %(v-x)+t$2 %(u-x):real^3)`LINEAR_INJECTIVE_0) +THEN RESP_TAC +THEN REMOVE_ASSUM_TAC +THEN GEN_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(a:real^2)$2= &0 \/ ~(a$2= &0)`) +THENL[ +ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[VECTOR_MUL_EQ_0;VECTOR_ARITH`A-B=vec 0<=> B=A`] +THEN MP_TAC(ISPECL[`x:real^3`;` v:real^3`;`u:real^3`]th3) +THEN RESA_TAC +THEN ASM_TAC +THEN SIMP_TAC[ LAMBDA_BETA;CART_EQ; DIMINDEX_2; FORALL_2; VEC_COMPONENT; ARITH]; + +REWRITE_TAC[VECTOR_ARITH`A+B=vec 0<=>B= --A`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`a$2 % (u - x) = --((a:real^2)$1 % (v - x:real^3)) ==> (inv (a$2)) % a$2 % (u - x) = (inv (a$2)) % (--(a$1 % (v - x)))`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C:real^3)`]) +THEN MP_TAC(ISPEC`(a:real^2)$2`REAL_MUL_LINV) +THEN RESA_TAC +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[VECTOR_ARITH`A-B=C%(--(D%(U-B)))<=> A= (&1+C*D)%B+(--C*D)%U:real^3`] +THEN MP_TAC(ISPECL[`x:real^3`;` v:real^3`;`u:real^3`]th3) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN DISCH_THEN(LABEL_TAC"A") +THEN DISCH_TAC +THEN SUBGOAL_THEN `F`ASSUME_TAC +THENL[ +REMOVE_THEN "A" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`(&1 + inv ((a:real^2)$2) * a$1)` +THEN EXISTS_TAC`(--inv ((a:real^2)$2) * a$1)` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; +ASM_MESON_TAC[]]]);; + + + + + +(* ========================================================================== *) +(* AFFINE AND DOT *) +(* ========================================================================== *) + + +let exp_aff_ge_by_dot=prove(`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u} +==> aff_ge {x,v} {u}={w:real^3| (w-x) dot (e2_fan x v u)= &0 /\ &0 <= (w-x) dot (e1_fan x v u) }`, +(let CROSS_LAGRANGE1 = prove + (`!x y z. (x cross y) cross z = (x dot z) % y - (z dot y) % x`, + VEC3_TAC) in + +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]th3) THEN RES_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]AFF_GE_2_1) THEN RESA_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]properties_coordinate) THEN RESA_TAC + THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC +THENL[ +STRIP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`(a % x + b +c) -x= (a- &1)% x + b + c `] THEN +REMOVE_ASSUM_TAC THEN SYM_ASSUM_TAC THEN REWRITE_TAC[VECTOR_ARITH`((a-(a+b+c)) % x + b % v +c % u)= b % (v-x) + c % (u-x)`] +THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL] + THEN REDUCE_ARITH_TAC + THEN ASM_MESON_TAC[REAL_LE_MUL] ; + +STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") + THEN DISCH_THEN(LABEL_TAC"b") +THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3)( v:real^3) (u:real^3)`; +`e3_fan (x:real^3) (v:real^3) (u:real^3)`;]ORTHONORMAL_IMP_SPANNING) THEN ASM_REWRITE_TAC[SPAN_3;EXTENSION] + THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(x':real^3)-(x:real^3)`th)) THEN REWRITE_TAC[SET_RULE`(a:real^3) IN (:real^3)`;IN_ELIM_THM] THEN RES_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL] + THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"c") + THEN FIND_ASSUM(MP_TAC)`orthonormal (e1_fan (x:real^3) (v:real^3) (u:real^3)) (e2_fan x v u) (e3_fan x v u)` + THEN REWRITE_TAC[orthonormal] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN ASM_REWRITE_TAC[DOT_SYM] + THEN REDUCE_ARITH_TAC + THEN DISCH_TAC THEN REMOVE_THEN "c" MP_TAC THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC THEN DISCH_THEN (LABEL_TAC"a") + THEN REMOVE_THEN "b" MP_TAC THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL;] THEN REWRITE_TAC[DOT_SYM] THEN ASM_REWRITE_TAC[] + THEN REDUCE_ARITH_TAC + THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC + THEN ASM_REWRITE_TAC[e1_fan;e2_fan;CROSS_LMUL;VECTOR_ARITH`a% b% v=(a*b)%v`;CROSS_LAGRANGE1] + THEN REDUCE_VECTOR_TAC THEN REWRITE_TAC[VECTOR_ARITH`a%(x- b % v)+ c % v=(c- a* b) % v+ a % x `; +e3_fan;VECTOR_ARITH`a% b% v=(a*b)%v`] + THEN STRIP_TAC THEN +EXISTS_TAC +`&1 - ((((w:real) - + ((u':real) * inv (norm (inv (norm ((v:real^3) - (x:real^3))) % (v - x) cross ((u:real^3) - x)))) * + (inv (norm (v - x)) % (v - x) dot (u - x))) * + inv (norm (v - x)))+ +((u':real) * inv (norm (e3_fan (x:real^3) (v:real^3) (u:real^3) cross (u - x)))))` + THEN EXISTS_TAC +`(((w:real) - + ((u':real) * inv (norm (inv (norm ((v:real^3) - (x:real^3))) % (v - x) cross ((u:real^3) - x)))) * + (inv (norm (v - x)) % (v - x) dot (u - x))) * + inv (norm (v - x)))` + THEN EXISTS_TAC +` ((u':real) * inv (norm (e3_fan (x:real^3) (v:real^3) (u:real^3) cross (u - x))))` +THEN +STRIP_TAC +THENL[ + +SUBGOAL_THEN `~(collinear {vec 0, v-x, u-x})==> ~((e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3))= vec 0)` ASSUME_TAC +THENL[ + MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[e3_fan;CROSS_LMUL] +THEN DISCH_TAC THEN MP_TAC(ISPECL [`v:real^3`; `x:real^3`] imp_inv_norm_not_zero_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL [`inv(norm((v:real^3)-(x:real^3)))`; `((v:real^3) -(x:real^3)) cross ((u:real^3)-(x:real^3))`; `(vec 0):real^3`] VECTOR_MUL_LCANCEL_IMP) +THEN ASM_REWRITE_TAC[VECTOR_MUL_RZERO;CROSS_EQ_0 ]; + +POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM COLLINEAR_3] +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{a,b,c}={b,a,c}`] THEN RED_TAC +THEN +MP_TAC(ISPECL [`(e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3))`; `((vec 0):real^3)`] imp_norm_ge_zero_fan) + THEN REDUCE_VECTOR_TAC THEN RES_TAC THEN +MP_TAC(ISPECL[`u':real`;`inv (norm ((e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3))))`] +REAL_LE_MUL) THEN RES_TAC THEN POP_ASSUM MATCH_MP_TAC THEN POP_ASSUM MP_TAC + THEN REAL_ARITH_TAC]; + +STRIP_TAC THENL[REAL_ARITH_TAC; +REWRITE_TAC[e3_fan] THEN POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]]));; + + + + + + +let exp_aff_ge_by_dot_1_1=prove(`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u} +==> +aff_ge {x} {v}={w:real^3| (w-x) dot (e2_fan x v u)= &0 /\ &0 <= (w-x) dot (e3_fan x v u) +/\ (w-x) dot (e1_fan x v u)= &0 }`, + +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]th3) + THEN RES_TAC THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`]AFF_GE_1_1) THEN RESA_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]properties_coordinate) THEN RESA_TAC + THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC +THENL[ +STRIP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`(a % x + b) -x= (a- &1)% x + b `] +THEN +REMOVE_ASSUM_TAC THEN SYM_ASSUM_TAC THEN REWRITE_TAC[VECTOR_ARITH`((a-(a+b)) % x + b % v)= b % (v-x)`] +THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL] + THEN REDUCE_ARITH_TAC THEN POP_ASSUM MP_TAC + THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM(th)])`dist (v,x) % e3_fan x v u = v- x:real^3` + THEN REWRITE_TAC[DOT_LMUL] + THEN FIND_ASSUM(MP_TAC)`orthonormal (e1_fan (x:real^3) (v:real^3) (u:real^3)) (e2_fan x v u) (e3_fan x v u)` + THEN REWRITE_TAC[orthonormal] THEN RESA_TAC THEN REDUCE_ARITH_TAC THEN MP_TAC(ISPECL[`v:real^3`;`x:real^3`]DIST_POS_LE) + THEN MESON_TAC[REAL_LE_MUL]; + +STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") + THEN DISCH_THEN(LABEL_TAC"b") THEN DISCH_THEN (LABEL_TAC "c") +THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3)( v:real^3) (u:real^3)`; +`e3_fan (x:real^3) (v:real^3) (u:real^3)`;]ORTHONORMAL_IMP_SPANNING) THEN ASM_REWRITE_TAC[SPAN_3;EXTENSION] + THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(x':real^3)-(x:real^3)`th)) THEN REWRITE_TAC[SET_RULE`(a:real^3) IN (:real^3)`;IN_ELIM_THM] THEN RES_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL] + THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"d") + THEN FIND_ASSUM(MP_TAC)`orthonormal (e1_fan (x:real^3) (v:real^3) (u:real^3)) (e2_fan x v u) (e3_fan x v u)` + THEN REWRITE_TAC[orthonormal] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN ASM_REWRITE_TAC[DOT_SYM] + THEN REDUCE_ARITH_TAC + THEN REMOVE_THEN "c" MP_TAC THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL] + THEN ASM_REWRITE_TAC[DOT_SYM] + THEN REDUCE_ARITH_TAC THEN DISCH_TAC + THEN DISCH_TAC THEN REMOVE_THEN "d" MP_TAC THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC + THEN DISCH_TAC + THEN REMOVE_THEN "b" MP_TAC THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL;] THEN REWRITE_TAC[DOT_SYM] THEN ASM_REWRITE_TAC[] + THEN REDUCE_ARITH_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[e3_fan;VECTOR_ARITH`a% b% v=(a*b)%v`; +VECTOR_ARITH`a-b=c %(v-b)<=> a= (&1-c) % b + c % v`] THEN DISCH_THEN (LABEL_TAC"a") + THEN STRIP_TAC THEN +EXISTS_TAC +`&1 - (w:real) * (inv (norm ((v:real^3) - (x:real^3))))` + THEN EXISTS_TAC +`(w:real) * (inv (norm ((v:real^3) - (x:real^3))))` +THEN +STRIP_TAC +THENL[ +MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_ge_zero_fan) THEN RES_TAC THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; +STRIP_TAC THENL[REAL_ARITH_TAC; +ASM_REWRITE_TAC[]]]]);; + + + + + + + + +(****************************************************************************) +(* the conditions to add azim *) +(****************************************************************************) + + + + + +let sum1_azim_fan=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. + cyclic_set {u, w1, w2} x v /\ (azim x v u w1 + azim x v w1 w2) < &2 * pi +==> +azim x v u w2 = azim x v u w1+ azim x v w1 w2 +`, +( let th=prove(`!x v u. {v,x,u}={x,v,u}/\{v,x,u}={u,x,v}`,SET_TAC[]) in + + +REPEAT GEN_TAC THEN STRIP_TAC +THEN MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`;`w1:real^3`; `w2:real^3`] property_of_cyclic_set) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`;`w1:real^3`; `w2:real^3`] property_of_cyclic_set1) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`;`w1:real^3`; `w2:real^3`] property_of_cyclic_set2) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`v:real^3`; `x:real^3`; `u:real^3`]COLLINEAR_3) THEN ASM_REWRITE_TAC[] THEN +DISCH_TAC THEN SUBGOAL_THEN `~collinear {(x:real^3),(v:real^3),(u:real^3)}/\ ~collinear {(u:real^3),(x:real^3),(v:real^3)}` ASSUME_TAC +THENL[ASM_MESON_TAC[th]; + +MP_TAC (SPECL [`x:real^3`; `v:real^3`; `w1:real^3`; `w2:real^3`] azim) + THEN STRIP_TAC +THEN POP_ASSUM(MP_TAC o SPECL [`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]) + THEN MP_TAC(ISPECL[`(x:real^3)`; `(v:real^3)`; `(u:real^3)`] orthonormal_e1_e2_e3_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`; `(v:real^3)`; `(u:real^3)`] e3_mul_dist_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN MP_TAC(SPEC `psi:real` SINCOS_PRINCIPAL_VALUE_FAN ) THEN STRIP_TAC THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`u:real^3`]AZIM_EXISTS) THEN STRIP_TAC +THEN +POP_ASSUM (fun th-> MP_TAC (ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]th)) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3` ;`r1':real`; `psi':real`; `h1':real`]sincos_of_u_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + +THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`; `w1:real^3`; `h1':real`; `h1:real`; `r1':real`; `r1:real`; +`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`; `psi':real`; `y:real` ] AZIM_UNIQUE) + THEN ASM_REWRITE_TAC[COS_ADD;SIN_ADD;REAL_ARITH` &1 * (a:real) - &0 * (b:real)=a`;REAL_ARITH`&0 * (a:real) + &1 * (b:real)=b`] +THEN DISCH_TAC THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`; `w2:real^3`; `h1':real`; `h2:real`; `r1':real`; `r2:real`; +`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`; `psi':real`; `azim (x:real^3) (v:real^3) (u:real^3) (w1:real^3) + azim x v w1 (w2:real^3)` ] AZIM_UNIQUE) +THEN DISCH_TAC THEN POP_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THENL[ ASM_MESON_TAC[REAL_LE_ADD]; + + +ASM_REWRITE_TAC[COS_ADD;SIN_ADD;REAL_ARITH` &1 * (a:real) - &0 * (b:real)=a`;REAL_ARITH`&0 * (a:real) + &1 * (b:real)=b`] + ]]));; + + + + + + + +let sum3_azim_fan=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. +((azim x v u w1 + azim x v w1 w2) < &2 * pi) +/\ +(~collinear {(x:real^3),(v:real^3),(w1:real^3)}) +/\(~collinear {(x:real^3),(v:real^3),(w2:real^3)}) +/\ (~collinear {(x:real^3),(v:real^3),(u:real^3)}) +==> +azim x v u w2 = azim x v u w1+ azim x v w1 w2 +`, (let th=prove(`!x v u. {x,v,u}={v,x,u}`,SET_TAC[]) in + (let th1=prove(`!x v u. {x,v,u}={u,x,v}`,SET_TAC[]) in + +REPEAT GEN_TAC THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "a") + +THEN USE_THEN "a" MP_TAC THEN GEN_REWRITE_TAC ( LAND_CONV o ONCE_DEPTH_CONV)[th] THEN DISCH_THEN(LABEL_TAC "b") + +THEN USE_THEN "a" MP_TAC THEN GEN_REWRITE_TAC ( LAND_CONV o ONCE_DEPTH_CONV)[th1] THEN DISCH_TAC + +THEN USE_THEN "b" MP_TAC THEN +GEN_REWRITE_TAC ( LAND_CONV o ONCE_DEPTH_CONV)[COLLINEAR_3] THEN STRIP_TAC +THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]th3) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC (SPECL [`x:real^3`; `v:real^3`; `w1:real^3`; `w2:real^3`] azim) + THEN STRIP_TAC +THEN POP_ASSUM(MP_TAC o SPECL [`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]) + THEN MP_TAC(ISPECL[`(x:real^3)`; `(v:real^3)`; `(u:real^3)`] orthonormal_e1_e2_e3_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`; `(v:real^3)`; `(u:real^3)`] e3_mul_dist_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN MP_TAC(SPEC `psi:real` SINCOS_PRINCIPAL_VALUE_FAN ) THEN STRIP_TAC THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`u:real^3`]AZIM_EXISTS) THEN STRIP_TAC +THEN +POP_ASSUM (fun th-> MP_TAC (ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]th)) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3` ;`r1':real`; `psi':real`; `h1':real`]sincos_of_u_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + +THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`; `w1:real^3`; `h1':real`; `h1:real`; `r1':real`; `r1:real`; +`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`; `psi':real`; `y:real` ] AZIM_UNIQUE) + THEN ASM_REWRITE_TAC[COS_ADD;SIN_ADD;REAL_ARITH` &1 * (a:real) - &0 * (b:real)=a`;REAL_ARITH`&0 * (a:real) + &1 * (b:real)=b`] +THEN DISCH_TAC THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`; `w2:real^3`; `h1':real`; `h2:real`; `r1':real`; `r2:real`; +`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`; `psi':real`; `azim (x:real^3) (v:real^3) (u:real^3) (w1:real^3) + azim x v w1 (w2:real^3)` ] AZIM_UNIQUE) +THEN DISCH_TAC THEN POP_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THENL[ + ASM_MESON_TAC[REAL_LE_ADD]; + +ASM_REWRITE_TAC[COS_ADD;SIN_ADD;REAL_ARITH` &1 * (a:real) - &0 * (b:real)=a`;REAL_ARITH`&0 * (a:real) + &1 * (b:real)=b`]])));; + + + +let sum2_azim_fan=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. + cyclic_set {u, w1, w2} x v /\ azim x v u w1 <= azim x v u w2 +==> +azim x v u w2 = azim x v u w1 + azim x v w1 w2 +`, + +(let th=prove(`!x v u. {v,x,u}={x,v,u}/\{v,x,u}={u,x,v}`,SET_TAC[]) in + +REWRITE_TAC[REAL_ARITH`(a:real)=(b:real)+(c:real) <=> c=a-b`] THEN +REPEAT GEN_TAC THEN STRIP_TAC +THEN MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`;`w1:real^3`; `w2:real^3`] property_of_cyclic_set) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`;`w1:real^3`; `w2:real^3`] property_of_cyclic_set1) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`;`w1:real^3`; `w2:real^3`] property_of_cyclic_set2) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`v:real^3`; `x:real^3`; `u:real^3`]COLLINEAR_3) THEN ASM_REWRITE_TAC[] THEN +DISCH_TAC THEN SUBGOAL_THEN `~collinear {(x:real^3),(v:real^3),(u:real^3)}/\ ~collinear {(u:real^3),(x:real^3),(v:real^3)}` ASSUME_TAC +THENL[ASM_MESON_TAC[th]; +MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`; `w1:real^3`] azim) + THEN STRIP_TAC +THEN POP_ASSUM(MP_TAC o SPECL [`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]) +THEN MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`; `w2:real^3`] azim) THEN STRIP_TAC +THEN POP_ASSUM(MP_TAC o SPECL [`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]) +THEN MP_TAC(ISPECL[`(x:real^3)`; `(v:real^3)`; `(u:real^3)`] orthonormal_e1_e2_e3_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`; `(v:real^3)`; `(u:real^3)`] e3_mul_dist_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN DISCH_THEN (LABEL_TAC"a") THEN DISCH_THEN (LABEL_TAC"b") +THEN REPEAT STRIP_TAC + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN DISCH_THEN (LABEL_TAC"c") THEN REPEAT STRIP_TAC + THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3` ;`r1:real`; `psi:real`; `h1':real`]sincos_of_u_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3` ;`r1':real`; `psi':real`; `h1:real`]sincos_of_u_fan) + THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN DISCH_TAC + THEN REMOVE_THEN "b" MP_TAC THEN REMOVE_THEN "c" MP_TAC + THEN ASM_REWRITE_TAC[COS_ADD;SIN_ADD;REAL_ARITH` &1 * (a:real) - &0 * (b:real)=a`;REAL_ARITH`&0 * (a:real) + &1 * (b:real)=b`] + THEN REPEAT STRIP_TAC + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `w1:real^3`; `w2:real^3`; `h2:real`; `h2':real`; `r2':real`; `r2:real`; +`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`; `azim (x:real^3) (v:real^3) (u:real^3) (w1:real^3)`; `azim (x:real^3) (v:real^3) (u:real^3) (w2:real^3) - azim x v u (w1:real^3)` ] AZIM_UNIQUE) +THEN DISCH_TAC THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`(a:real)+(b:real)-a=b`; REAL_ARITH`(&0 <= (a:real)-(b:real))<=> b<= a`] THEN MP_TAC(ISPEC `azim (x:real^3) (v:real^3) (u:real^3) (w1:real^3)` REAL_NEG_LE0) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`azim (x:real^3) (v:real^3) (u:real^3) (w2:real^3)`;`&2 * pi`;`--azim (x:real^3) (v:real^3) (u:real^3) (w1:real^3)`;`&0`]REAL_LTE_ADD2 ) +THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC]));; + + + + +let sum4_azim_fan=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. + azim x v u w1 <= azim x v u w2 +/\ (~collinear {(x:real^3),(v:real^3),(w1:real^3)}) +/\(~collinear {(x:real^3),(v:real^3),(w2:real^3)}) +/\ (~collinear {(x:real^3),(v:real^3),(u:real^3)}) + +==> +azim x v u w2 = azim x v u w1 + azim x v w1 w2 +`,(let th=prove(`!x v u. {x,v,u}={v,x,u}`,SET_TAC[]) in +(let th1=prove(`!x v u. {x,v,u}={u,x,v}`,SET_TAC[]) in + +REWRITE_TAC[REAL_ARITH`(a:real)=(b:real)+(c:real) <=> c=a-b`] THEN + +REPEAT GEN_TAC THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "a1") + +THEN USE_THEN "a1" MP_TAC THEN GEN_REWRITE_TAC ( LAND_CONV o ONCE_DEPTH_CONV)[th] THEN DISCH_THEN(LABEL_TAC "b1") + +THEN USE_THEN "a1" MP_TAC THEN GEN_REWRITE_TAC ( LAND_CONV o ONCE_DEPTH_CONV)[th1] THEN DISCH_TAC + +THEN USE_THEN "b1" MP_TAC THEN +GEN_REWRITE_TAC ( LAND_CONV o ONCE_DEPTH_CONV)[COLLINEAR_3] THEN STRIP_TAC +THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]th3) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`; `w1:real^3`] azim) + THEN STRIP_TAC +THEN POP_ASSUM(MP_TAC o SPECL [`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]) +THEN MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`; `w2:real^3`] azim) THEN STRIP_TAC +THEN POP_ASSUM(MP_TAC o SPECL [`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]) +THEN MP_TAC(ISPECL[`(x:real^3)`; `(v:real^3)`; `(u:real^3)`] orthonormal_e1_e2_e3_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`; `(v:real^3)`; `(u:real^3)`] e3_mul_dist_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN DISCH_THEN (LABEL_TAC"a") THEN DISCH_THEN (LABEL_TAC"b") +THEN REPEAT STRIP_TAC + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN DISCH_THEN (LABEL_TAC"c") THEN REPEAT STRIP_TAC + THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3` ;`r1:real`; `psi:real`; `h1':real`]sincos_of_u_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3` ;`r1':real`; `psi':real`; `h1:real`]sincos_of_u_fan) + THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN DISCH_TAC + THEN REMOVE_THEN "b" MP_TAC THEN REMOVE_THEN "c" MP_TAC + THEN ASM_REWRITE_TAC[COS_ADD;SIN_ADD;REAL_ARITH` &1 * (a:real) - &0 * (b:real)=a`;REAL_ARITH`&0 * (a:real) + &1 * (b:real)=b`] + THEN REPEAT STRIP_TAC + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `w1:real^3`; `w2:real^3`; `h2:real`; `h2':real`; `r2':real`; `r2:real`; +`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`; `azim (x:real^3) (v:real^3) (u:real^3) (w1:real^3)`; `azim (x:real^3) (v:real^3) (u:real^3) (w2:real^3) - azim x v u (w1:real^3)` ] AZIM_UNIQUE) +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`(a:real)+(b:real)-a=b`; REAL_ARITH`(&0 <= (a:real)-(b:real))<=> b<= a`] THEN MP_TAC(ISPEC `azim (x:real^3) (v:real^3) (u:real^3) (w1:real^3)` REAL_NEG_LE0) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`azim (x:real^3) (v:real^3) (u:real^3) (w2:real^3)`;`&2 * pi`;`--azim (x:real^3) (v:real^3) (u:real^3) (w1:real^3)`;`&0`]REAL_LTE_ADD2 ) +THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC +)));; + + + + +let sum5_azim_fan=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. + azim x v w1 w2 <= azim x v u w2 +/\ (~collinear {(x:real^3),(v:real^3),(w1:real^3)}) +/\(~collinear {(x:real^3),(v:real^3),(w2:real^3)}) +/\ (~collinear {(x:real^3),(v:real^3),(u:real^3)}) + +==> +azim x v u w2 = azim x v u w1 + azim x v w1 w2 +`, +REPEAT STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_THEN(LABEL_TAC"1") THEN REPEAT STRIP_TAC + THEN DISJ_CASES_TAC(REAL_ARITH`(azim x v u w2)= &0 \/ ~(azim x v u w2 = &0)`) +THENL(*1*)[ +SUBGOAL_THEN`azim x v w1 w2 = &0` ASSUME_TAC +THENL(*2*)[ +REPEAT(POP_ASSUM MP_TAC) THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w1:real^3`;`w2:real^3`]azim) THEN REAL_ARITH_TAC; +(*2*) +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w1:real^3`;`w2:real^3`]AZIM_EQ_0_SYM) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`w2:real^3`]AZIM_EQ_0_SYM) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +SUBGOAL_THEN`azim x v w2 w1 = azim x v w2 u` ASSUME_TAC +THENL(*3*)[ASM_MESON_TAC[];(*3*) +REWRITE_TAC[REAL_ARITH`&0 = a + &0 <=> a= &0`] THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w2:real^3`;`u:real^3`;`w1:real^3`]AZIM_EQ_ALT) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`]AZIM_EQ_0) THEN ASM_REWRITE_TAC[]]]; + DISJ_CASES_TAC(REAL_ARITH`(azim x v w1 w2)= &0 \/ ~(azim x v w1 w2 = &0)`) +THENL(*4*)[ +ASM_REWRITE_TAC[REAL_ARITH`b = a + &0 <=> b= a`] THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w1:real^3`;`w2:real^3`]AZIM_EQ_0_ALT) THEN ASM_REWRITE_TAC[]THEN ASM_MESON_TAC[AZIM_EQ_ALT] ;(*4*) +REMOVE_THEN"1" MP_TAC THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w1:real^3`;`w2:real^3`]AZIM_COMPL +) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`w2:real^3`]AZIM_COMPL +) THEN ASM_REWRITE_TAC[REAL_ARITH`a=b-c <=> c= b-a`] THEN DISCH_TAC THEN DISCH_TAC + THEN ASM_REWRITE_TAC[REAL_ARITH`a-b=c+a-d<=> d=b+c`;REAL_ARITH`a-b<=a-d<=> d<=b`] THEN ASM_MESON_TAC[sum4_azim_fan]] +]);; + + + + +(* ========================================================================== *) +(* AZIM *) +(* ========================================================================== *) + + + + +let th = prove + (`!x:real^3 v:real^3 u:real^3 w:real^3. + ~collinear {x,v,u} /\ ~collinear{x,v,w} + ==> {y:real^3 | ~collinear {x,v,y} /\ azim x v u w = azim x v u y} = + aff_gt {x , v} {w}`, + GEOM_ORIGIN_TAC `x:real^3` THEN + GEOM_BASIS_MULTIPLE_TAC 3 `v:real^3` THEN + X_GEN_TAC `v:real` THEN ASM_CASES_TAC `v = &0` THENL + [ASM_REWRITE_TAC[VECTOR_MUL_LZERO; INSERT_AC; COLLINEAR_2]; ALL_TAC] THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; REAL_LE_LT] THEN DISCH_TAC THEN + MAP_EVERY X_GEN_TAC [`u:real^3`; `w:real^3`] THEN + ASM_CASES_TAC `w:real^3 = vec 0` THENL + [ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_2]; ALL_TAC] THEN + ASM_CASES_TAC `w:real^3 = v % basis 3` THENL + [ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_2]; ALL_TAC] THEN + ASM_SIMP_TAC[AZIM_SPECIAL_SCALE; COLLINEAR_SPECIAL_SCALE] THEN + ASM_CASES_TAC `w:real^3 = basis 3` THENL + [ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_2]; ALL_TAC] THEN + ASM_SIMP_TAC[AFF_GT_SPECIAL_SCALE; IN_SING; FINITE_INSERT; FINITE_EMPTY] THEN + POP_ASSUM_LIST(K ALL_TAC) THEN REWRITE_TAC[COLLINEAR_BASIS_3; AZIM_ARG] THEN + DISCH_TAC THEN MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `{y:real^3 | (dropout 3 y:real^2) IN + aff_gt {vec 0} {dropout 3 (w:real^3)}}` THEN + CONJ_TAC THENL + [REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN X_GEN_TAC `y:real^3` THEN + POP_ASSUM MP_TAC THEN + MAP_EVERY SPEC_TAC + [`(dropout 3:real^3->real^2) u`,`u:real^2`; + `(dropout 3:real^3->real^2) v`,`v:real^2`; + `(dropout 3:real^3->real^2) w`,`w:real^2`; + `(dropout 3:real^3->real^2) y`,`y:real^2`] THEN + SIMP_TAC[AFF_GT_1_1; SET_RULE `DISJOINT {x} {y} <=> ~(x = y)`] THEN + REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN ONCE_REWRITE_TAC[SWAP_EXISTS_THM] THEN + ONCE_REWRITE_TAC[TAUT `a /\ b /\ c <=> a /\ c /\ b`] THEN + REWRITE_TAC[REAL_ARITH `t1 + t2 = &1 <=> t1 = &1 - t2`] THEN + REWRITE_TAC[RIGHT_EXISTS_AND_THM; EXISTS_REFL] THEN + ASM_CASES_TAC `y:real^2 = vec 0` THEN ASM_REWRITE_TAC[] THENL + [ASM_MESON_TAC[VECTOR_MUL_EQ_0; REAL_LT_IMP_NZ]; ALL_TAC] THEN + RULE_ASSUM_TAC(REWRITE_RULE[COMPLEX_VEC_0]) THEN + GEN_REWRITE_TAC LAND_CONV [EQ_SYM_EQ] THEN + ASM_SIMP_TAC[ARG_EQ; COMPLEX_CMUL; COMPLEX_FIELD + `~(w = Cx(&0)) /\ ~(z = Cx(&0)) ==> ~(w / z = Cx(&0))`] THEN + ASM_SIMP_TAC[COMPLEX_FIELD + `~(u = Cx(&0)) ==> (w / u = x * y / u <=> w = x * y)`]; + SUBGOAL_THEN `~(w:real^3 = vec 0) /\ ~(w = basis 3)` ASSUME_TAC THENL + [ASM_MESON_TAC[DROPOUT_BASIS_3; DROPOUT_0]; ALL_TAC] THEN + ASM_SIMP_TAC[AFF_GT_1_1; AFF_GT_2_1; DISJOINT_INSERT; IN_INSERT; + DISJOINT_EMPTY; NOT_IN_EMPTY] THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN X_GEN_TAC `y:real^3` THEN + REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + ONCE_REWRITE_TAC[SWAP_EXISTS_THM] THEN + GEN_REWRITE_TAC (RAND_CONV o BINDER_CONV) [SWAP_EXISTS_THM] THEN + ONCE_REWRITE_TAC[TAUT `a /\ b /\ c <=> a /\ c /\ b`] THEN + REWRITE_TAC[REAL_ARITH `t1 + t2 = &1 <=> t1 = &1 - t2`] THEN + REWRITE_TAC[RIGHT_EXISTS_AND_THM; EXISTS_REFL] THEN + SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VECTOR_ADD_COMPONENT; + VECTOR_MUL_COMPONENT; BASIS_COMPONENT; ARITH; DIMINDEX_2; + DROPOUT_BASIS_3; FORALL_2; dropout; LAMBDA_BETA] THEN + ONCE_REWRITE_TAC[SWAP_EXISTS_THM] THEN + REWRITE_TAC[REAL_MUL_RZERO; REAL_ADD_LID; RIGHT_EXISTS_AND_THM] THEN + REWRITE_TAC[REAL_ARITH `y = t * &1 + s <=> t = y - s`; EXISTS_REFL]]);; + + + +let th1=prove(`(!x:real^3 v:real^3 u:real^3 w:real^3 t1:real t2:real t3:real. (t3 > &0) /\ (t1 + t2 + t3 = &1) +/\ DISJOINT {x,v} {w} /\ ~collinear {x,v,u}/\ ~collinear {x,v,w} + ==> azim x v u w = + azim x v u (t1 % x + t2 % v + t3 % w))`, +REPEAT GEN_TAC THEN STRIP_TAC THEN ASSUME_TAC(AFF_GT_2_1) +THEN POP_ASSUM(MP_TAC o ISPECL [`x:real^3`;`v:real^3`;`w:real^3`]) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN ABBREV_TAC `(y:real^3)= (t1:real) % (x:real^3) + (t2:real) % (v:real^3) + (t3:real) % (w:real^3)` + THEN SUBGOAL_THEN `(y:real^3) IN aff_gt {(x:real^3),(v:real^3)} {w:real^3}` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC `t1:real` +THEN EXISTS_TAC `t2:real` THEN EXISTS_TAC `t3:real` +THEN EXPAND_TAC "y" THEN ASM_MESON_TAC[REAL_ARITH`(a:real)> &0 <=> &0 < a ` ]; + + POP_ASSUM MP_TAC THEN +ASSUME_TAC(th) THEN POP_ASSUM(MP_TAC o ISPECL [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`]) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN REWRITE_TAC[IN_ELIM_THM] THEN ASM_SET_TAC[]]);; + + let th2= prove(`!x:real^3 v:real^3 w:real^3. ~(x=v)==> (w IN complement_set {x,v}==> ~ collinear {x,v,w})`, +REPEAT GEN_TAC THEN DISCH_TAC THEN REWRITE_TAC[CONTRAPOS_THM; COLLINEAR_3;COLLINEAR_LEMMA; complement_set; IN_ELIM_THM;affine_hull_2_fan] THEN STRIP_TAC +THENL[ +ASM_MESON_TAC[VECTOR_ARITH`(x-v= vec 0)<=> (x=v)`]; + EXISTS_TAC `&0` THEN EXISTS_TAC `&1` THEN REWRITE_TAC[REAL_ARITH`&0+ &1 = &1`; VECTOR_ARITH`&0 % x= vec 0`; VECTOR_ARITH`w=vec 0 + &1 % v <=> w - v = vec 0`] THEN ASM_SET_TAC[]; +EXISTS_TAC `c:real` THEN EXISTS_TAC `&1 - (c:real)` THEN REWRITE_TAC[REAL_ARITH`c+ &1 - c = &1`; VECTOR_ARITH`w=c % x + (&1 - c) % v <=> w - v = c % (x-v)`] THEN ASM_SET_TAC[]]);; + + + + +(* ========================================================================== *) +(* CARD *) +(* ========================================================================== *) + + +let CARD_SING=prove(`!x:real^3 s:real^3->bool. + FINITE s +/\ s={x} +==> +CARD s = 1`, +REPEAT STRIP_TAC THEN +MP_TAC(SET_RULE`(s:real^3->bool)={(x:real^3)} ==> ~(s={}) /\ x IN s /\ s DELETE x ={}`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPEC`s:real^3->bool`CARD_EQ_0) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`x:real^3`;`s:real^3->bool`]CARD_DELETE) THEN ASM_REWRITE_TAC[CARD_CLAUSES] + THEN ARITH_TAC);; + + + +(* ========================================================================== *) +(* CLOSED AFF *) +(* ========================================================================== *) + + + + + + + +let closed_aff_ge_2_1=prove(`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u} +==> +closed (aff_ge {x,v} {u})`, +(let lemma=prove(`!x:real^3 v:real^3 u:real^3. +{w:real^3| (w-x) dot (e2_fan x v u)= &0 /\ &0 <= (w-x) dot (e1_fan x v u) } +={w:real^3| (w-x) dot (e2_fan x v u)= &0} INTER {w:real^3| (w-x) dot (e1_fan x v u) >= &0 }`, +REWRITE_TAC[INTER; IN_ELIM_THM;REAL_ARITH`&0<=a <=> a >= &0`]) in +( +let lemma1=prove(`!x:real^3 v:real^3 u:real^3. +closed {w:real^3| (w-x) dot (e2_fan x v u)= &0}`, +REWRITE_TAC[ DOT_SYM] THEN REWRITE_TAC[DOT_RSUB;REAL_ARITH`a-b= &0<=> a=b`;] + THEN REPEAT GEN_TAC THEN MP_TAC(ISPECL[`e2_fan (x:real^3) (v:real^3) (u:real^3)`; +` e2_fan (x:real^3) (v:real^3) (u:real^3) dot x`]CLOSED_HYPERPLANE) THEN ASM_SET_TAC[]) in + ( +let lemma2=prove(`!x:real^3 v:real^3 u:real^3. +closed {w:real^3| (w-x) dot (e1_fan x v u) >= &0 }`, +REWRITE_TAC[ DOT_SYM] THEN REWRITE_TAC[DOT_RSUB;REAL_ARITH`a-b>= &0<=> a>=b`;] + THEN REPEAT GEN_TAC THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`; +` e1_fan (x:real^3) (v:real^3) (u:real^3) dot x`]CLOSED_HALFSPACE_GE) THEN ASM_SET_TAC[]) in + +REPEAT STRIP_TAC THEN +ASM_MESON_TAC[exp_aff_ge_by_dot;lemma;lemma1;lemma2;CLOSED_INTER]))));; + + + + + +let closed_aff_ge_1_2=prove(`!(x:real^3) (v:real^3) (w:real^3). +~collinear {x, v, w} +==> +closed (aff_ge {x} {v , w})`, +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC (th) THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASSUME_TAC(th)) +THEN MRESA_TAC aff_ge_inter_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC closed_aff_ge_2_1[`x:real^3`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC closed_aff_ge_2_1[`x:real^3`;`v:real^3`;`w:real^3`] +THEN ASM_MESON_TAC[CLOSED_INTER]);; + + + + + +let closed_halfline_fan=prove(`!(x:real^3) (v:real^3) (u:real^3). +~collinear {x,v,u} +==> +closed (aff_ge {x} { v})`, + + +(let lemma=prove(`!x v u :real^3. +{w:real^3| (w-x) dot (e2_fan x v u)= &0 /\ &0 <= (w-x) dot (e3_fan x v u) +/\ (w-x) dot (e1_fan x v u)= &0 }= {w:real^3| (w-x) dot (e2_fan x v u)= &0} INTER +({w:real^3| (w-x) dot (e1_fan x v u)= &0} INTER {w:real^3| &0 <= (w-x) dot (e3_fan x v u)})`, +REWRITE_TAC[INTER;IN_ELIM_THM] THEN ASM_SET_TAC[]) in + + +(let lemma1=prove(`!x:real^3 v:real^3 u:real^3. +closed {w:real^3| (w-x) dot (e2_fan x v u)= &0}`, +REWRITE_TAC[ DOT_SYM] THEN REWRITE_TAC[DOT_RSUB;REAL_ARITH`a-b= &0<=> a=b`;] + THEN REPEAT GEN_TAC THEN MP_TAC(ISPECL[`e2_fan (x:real^3) (v:real^3) (u:real^3)`; +` e2_fan (x:real^3) (v:real^3) (u:real^3) dot x`]CLOSED_HYPERPLANE) THEN ASM_SET_TAC[]) in + +(let lemma3=prove(`!x:real^3 v:real^3 u:real^3. +closed {w:real^3| (w-x) dot (e1_fan x v u)= &0}`, +REWRITE_TAC[ DOT_SYM] THEN REWRITE_TAC[DOT_RSUB;REAL_ARITH`a-b= &0<=> a=b`;] + THEN REPEAT GEN_TAC THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`; +` e1_fan (x:real^3) (v:real^3) (u:real^3) dot x`]CLOSED_HYPERPLANE) THEN ASM_SET_TAC[]) in + +(let lemma2=prove(`!x:real^3 v:real^3 u:real^3. +closed {w:real^3| &0 <= (w-x) dot (e3_fan x v u) }`, +REWRITE_TAC[ DOT_SYM] THEN REWRITE_TAC[DOT_RSUB;REAL_ARITH`&0 <= a-b<=> a>=b`;] + THEN REPEAT GEN_TAC THEN MP_TAC(ISPECL[`e3_fan (x:real^3) (v:real^3) (u:real^3)`; +` e3_fan (x:real^3) (v:real^3) (u:real^3) dot x`]CLOSED_HALFSPACE_GE) THEN ASM_SET_TAC[]) in +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`x:real^3`;` v:real^3`; `u:real^3`]exp_aff_ge_by_dot_1_1) + THEN REWRITE_TAC[lemma] +THEN RESA_TAC THEN ASSUME_TAC(ISPECL[`x:real^3`;` v:real^3`; `u:real^3`]lemma1) THEN ASSUME_TAC(ISPECL[`x:real^3`;` v:real^3`; `u:real^3`]lemma2) THEN ASSUME_TAC(ISPECL[`x:real^3`;` v:real^3`; `u:real^3`]lemma3) + THEN SUBGOAL_THEN`closed({w:real^3| (w-x) dot (e1_fan x v u)= &0} INTER {w:real^3| &0 <= (w-x) dot (e3_fan x v u)})` +ASSUME_TAC +THENL[ASM_MESON_TAC[CLOSED_INTER]; +ASM_MESON_TAC[CLOSED_INTER]])))));; + + + + + +(*--------------------------------------------------------------------------------------------*) +(* The properties of ballnorm_fan (x:real^3)={y:real^3 | dist(x,y) = &1} *) +(*--------------------------------------------------------------------------------------------*) + + + + + +let ballnorm_fan=new_definition`ballnorm_fan (x:real^3)={y:real^3 | dist(x,y) = &1}`;; + + +let closed_ballnorm_fan=prove(`!x:real^3. closed (ballnorm_fan x)`, +GEN_TAC THEN REWRITE_TAC[ballnorm_fan] THEN +SUBGOAL_THEN `{y:real^3 | dist((x:real^3),(y:real^3)) = &1} = frontier( ball((x:real^3), &1))` ASSUME_TAC + THENL [ASSUME_TAC(REAL_ARITH `&0 < &1`) THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[frontier; CLOSURE_BALL; INTERIOR_OPEN; OPEN_BALL; + REAL_LT_IMP_LE] THEN + REWRITE_TAC[EXTENSION; IN_DIFF; IN_ELIM_THM; IN_BALL; IN_CBALL] THEN + REAL_ARITH_TAC; + ASM_REWRITE_TAC[] THEN MESON_TAC[FRONTIER_CLOSED]]);; + +let bounded_ballnorm_fan=prove(`!x:real^3 . bounded(ballnorm_fan x)`, +REPEAT GEN_TAC THEN REWRITE_TAC[ballnorm_fan;bounded] THEN + EXISTS_TAC `norm(x:real^3) + &1` THEN REWRITE_TAC[ dist; IN_ELIM_THM] + THEN GEN_TAC THEN STRIP_TAC THEN ASSUME_TAC(NORM_TRIANGLE_SUB) THEN +POP_ASSUM (MP_TAC o ISPECL [`(x':real^3)`; `(x:real^3)`] o INST_TYPE [`:real^3`,`:real^3`]) + THEN REWRITE_TAC[NORM_SUB] THEN ASM_REWRITE_TAC[]);; + +let bounded_ballnorm_fans=prove(`!x:real^3 v:real^3 w:real^3. bounded (aff_ge {x} {v, w} INTER ballnorm_fan x)`, +REPEAT GEN_TAC THEN ASSUME_TAC (bounded_ballnorm_fan) THEN +POP_ASSUM (MP_TAC o ISPEC `x:real^3`) THEN DISCH_TAC THEN +SUBGOAL_THEN `aff_ge {x} {(v:real^3), (w:real^3)} INTER ballnorm_fan x SUBSET ballnorm_fan (x:real^3)` ASSUME_TAC THENL +[ASM_SET_TAC[]; +ASM_MESON_TAC[BOUNDED_SUBSET ]]);; + + + +(*--------------------------------------------------------------------------------------------*) +(* The properties of fan in norm ball *) +(*--------------------------------------------------------------------------------------------*) + + + + +let closed_aff_ge_ballnorm_fan=prove(`!(x:real^3) (v:real^3) (w:real^3). +~collinear{x,v,w} +==> +closed (aff_ge {x} {v, w} INTER ballnorm_fan x)`, +ASM_MESON_TAC[closed_aff_ge_1_2; closed_ballnorm_fan;CLOSED_INTER]);; + + + + + +let compact_aff_ge_ballnorm_fan=prove(` +!(x:real^3) (v:real^3) (w:real^3). +~collinear{x,v,w} +==> +compact (aff_ge {x} {v, w} INTER ballnorm_fan x)`, +REPEAT GEN_TAC THEN DISCH_TAC THEN +SUBGOAL_THEN `closed (aff_ge {x} {v, w} INTER ballnorm_fan x)` ASSUME_TAC +THENL + [ASM_MESON_TAC[closed_aff_ge_ballnorm_fan]; + ASSUME_TAC(bounded_ballnorm_fans) + THEN + POP_ASSUM (MP_TAC o ISPECL [`x:real^3`; `v:real^3`; `w:real^3`]) THEN + ASM_MESON_TAC[BOUNDED_CLOSED_IMP_COMPACT ]]);; + + + + + + + +let closed_point_fan=prove(` +(!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u} +==> +closed (aff_ge {x} {v} INTER ballnorm_fan x) )`, +REPEAT GEN_TAC THEN DISCH_TAC THEN +SUBGOAL_THEN `closed (aff_ge {(x:real^3)} {(v:real^3)})` ASSUME_TAC THENL + [ASM_MESON_TAC[ closed_halfline_fan]; + SUBGOAL_THEN `closed (ballnorm_fan (x:real^3))` ASSUME_TAC THENL + [ASM_MESON_TAC[closed_ballnorm_fan]; + ASM_MESON_TAC[CLOSED_INTER]]]);; + + + +(* ========================================================================== *) +(* RCONE *) +(* ========================================================================== *) + + +(* rcone^0(x,v,h) *) + +let rcone_fan = new_definition `rcone_fan (x:real^3) (v:real^3) (h:real) = {y:real^3 | (y-x) dot (v-x) >(dist(y,x)*dist(v,x)*h)}`;; + + +let origin_not_in_rcone_fan=prove(`!(x:real^3) (v:real^3) (h:real). ~(x IN rcone_fan x v h)`, +REPEAT GEN_TAC +THEN REWRITE_TAC[rcone_fan; IN_ELIM_THM; VECTOR_ARITH`x-x= vec 0`; DOT_LZERO;DIST_REFL] +THEN REDUCE_ARITH_TAC +THEN REAL_ARITH_TAC);; + + +let conditions_in_rcone_fan=prove(`!x v u w:real^3 s:real. +~collinear {x,v,u}/\ w IN aff_gt {x} {v,u} /\ &0 w IN rcone_fan x v (cos s) `, + +REWRITE_TAC[rcone_fan;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_TAC +THEN DISCH_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(u:real^3)`;] +THEN MRESAL_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;` (u:real^3) `;][IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[dist;VECTOR_ARITH`(t1 % x + t2 % v + t3 % u) - x=((t1+t2+t3)- &1) % x + t2 % (v-x) + t3 % (u-x)`;REAL_ARITH`&1 - &1= &0`;REAL_ARITH`A>B<=> B &0<= t3`) THEN RESA_TAC +THEN MRESA1_TAC REAL_ABS_REFL`t3:real` +THEN MRESA_TAC NORM_MUL[`t3:real`;`u-x:real^3`] +THEN MP_TAC(REAL_ARITH`&0< t2==> &0<= t2`) THEN RESA_TAC +THEN MRESA1_TAC REAL_ABS_REFL`t2:real` +THEN MRESA_TAC NORM_MUL[`t2:real`;`v-x:real^3`] +THEN MRESA_TAC REAL_LT_LMUL[`t3:real`;`norm (u - x) * norm (v - x:real^3) * (cos s):real`;`(u - x) dot (v - x:real^3)`] +THEN MRESA1_TAC COS_BOUNDS`s:real` +THEN MRESA1_TAC DOT_POS_LE`(v - x):real^3` +THEN MRESA_TAC REAL_LE_MUL[`t2:real`;`(v-x) dot (v-x:real^3)`;] +THEN MRESA_TAC REAL_LE_LMUL[`t2*((v - x:real^3) dot (v-x)):real`;`cos s:real`;`&1`] +THEN POP_ASSUM MP_TAC THEN REDUCE_ARITH_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[DOT_SQUARE_NORM;] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH` t3 * norm (u - x) * norm (v - x) * cos s< t3 * ((u - x) dot (v - x)) +/\(t2 * norm (v - x) pow 2) * cos s <= t2 * ((v - x) dot (v - x)) +==> (t2 * norm (v - x:real^3) + t3 * norm (u - x)) * norm (v - x) * cos s< t2 * ((v - x) dot (v - x))+ t3 * ((u - x) dot (v - x))`) +THEN RESA_TAC +THEN MRESA_TAC NORM_TRIANGLE[`t2 %(v - x:real^3)`;`t3 % (u - x:real^3)`] +THEN MRESA1_TAC NORM_POS_LE`(v - x):real^3` +THEN MRESA1_TAC COS_POS_PI2`(s):real` +THEN MP_TAC(REAL_ARITH`&0< cos s:real ==> &0<= cos s`) THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`norm (v-x:real^3)`;`cos s:real`] +THEN MRESA_TAC REAL_LE_RMUL[`norm (t2 % (v - x) + t3 % (u - x):real^3):real`;`t2 * norm (v - x:real^3) + t3 * norm (u - x)`;`norm (v - x:real^3) * cos s`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC);; + + + +let not_empty_rcone_fan_inter_aff_gt=prove(`!x v u:real^3 h:real. +~collinear {x,v,u} /\ &0< h /\ h<= pi==> +~(rcone_fan x v (cos h) INTER aff_gt {x} {v, u}={})`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN SUBGOAL_THEN`~(norm((v:real^3)-(x:real^3))= &0)` ASSUME_TAC +THENL(*1*)[ASM_REWRITE_TAC[NORM_EQ_0;VECTOR_ARITH`v-x=vec 0<=> x=v`]; +ASM_REWRITE_TAC[rcone_fan;SET_RULE`~(A={})<=> ?y. y IN A`;INTER;IN_ELIM_THM] +THEN DISJ_CASES_TAC(REAL_ARITH`(v - x) dot (u - x:real^3) <= &0 \/ &0< (v - x) dot (u - x)`) +THENL(*2*)[ABBREV_TAC`s1= min h (pi / &2) / &2:real` +THEN MP_TAC(REAL_ARITH` &0< pi /\ min h (pi / &2) / &2 =s1 /\ &0< h:real ==> &0<= s1 /\ &0 REWRITE_TAC[SYM(th); REAL_ARITH`&1* &1= &1`]) +THEN RESA_TAC +THEN REDUCE_ARITH_TAC +THEN MP_TAC(ISPEC`norm((v:real^3)-(x:real^3))`REAL_MUL_LINV) +THEN REWRITE_TAC[REAL_ARITH`A*B*D *D=(B*D) *D *A`;REAL_ARITH`A>B<=> B &0< norm (v - x) `) +THEN RESA_TAC +THEN MATCH_MP_TAC COS_MONO_LT +THEN ASM_REWRITE_TAC[];(*3*) +MRESA_TAC condition1_to_in_aff_gt_by_angle[`x:real^3`;`v:real^3`;`u:real^3`;`s1:real`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[e3_fan]](*3*);(*2*) +SUBGOAL_THEN`&0<(atn ((norm ((v - x) cross (u - x))) * inv((v - x) dot (u - x:real^3))))` ASSUME_TAC +THENL(*3*)[MP_TAC(ISPEC`(v - x) dot (u - x:real^3)`REAL_LT_INV) +THEN RESA_TAC +THEN ASSUME_TAC(PI_WORKS) +THEN MP_TAC(REAL_ARITH`&0< pi ==> --(pi / &2) < &0`) +THEN RESA_TAC +THEN MRESAL_TAC ATN_MONO_LT[`&0:real`;` (norm ((v - x) cross (u - x)) * inv ((v - x) dot (u - x))):real`][ ATN_0] +THEN POP_ASSUM MATCH_MP_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`~(norm((v - x) cross (u - x:real^3))= &0)` ASSUME_TAC +THENL(*4*)[ +ASM_REWRITE_TAC[NORM_EQ_0] +THEN MP_TAC(ISPECL[`v-x:real^3`;`u-x:real^3`]CROSS_EQ_0) +THEN ONCE_REWRITE_TAC[GSYM COLLINEAR_3;] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[];(*4*) + +POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`(v - x) cross (u - x:real^3)`NORM_POS_LE) +THEN REAL_ARITH_TAC](*4*);(*3*) + + ASSUME_TAC(ISPEC`(norm ((v - x) cross (u - x)) * inv ((v - x) dot (u - x))):real`ATN_BOUNDS) +THEN ABBREV_TAC`s2= atn ((norm ((v - x) cross (u - x))) * inv((v - x) dot (u - x))):real` +THEN ABBREV_TAC`s1= min (h:real) (s2:real) / &2` +THEN MP_TAC(REAL_ARITH`&0< h /\ s1= min (h:real) (s2) / &2 /\ &0< pi /\ &0< s2 /\ s2 < pi/ &2==> &0<= s1 /\ &0 REWRITE_TAC[SYM(th); REAL_ARITH`&1* &1= &1`]) +THEN RESA_TAC +THEN REDUCE_ARITH_TAC +THEN MP_TAC(ISPEC`norm((v:real^3)-(x:real^3))`REAL_MUL_LINV) +THEN REWRITE_TAC[REAL_ARITH`A*B*D *D=(B*D) *D *A`;REAL_ARITH`A>B<=> B &0< norm (v - x) `) +THEN RESA_TAC +THEN MATCH_MP_TAC COS_MONO_LT +THEN ASM_REWRITE_TAC[];(*4*) +MRESA_TAC condition_to_in_aff_gt_by_angle[`x:real^3`;`v:real^3`;`u:real^3`;`s1:real`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[e3_fan]]]]]);; + + + + +(* ========================================================================== *) +(* TOPOLOGY COMPONENT YFAN *) +(* ========================================================================== *) + + + + +let in_topological_component_yfan_is_connected=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool. +U IN topological_component_yfan (x,V,E) +==> connected U`, +REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[CONNECTED_CONNECTED_COMPONENT]);; + + + +let exists_point_in_component_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool. +U IN topological_component_yfan (x,V,E) +==> ?z. z IN U`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`y:real^3` +THEN ASM_REWRITE_TAC[CONNECTED_COMPONENT_SET;IN_ELIM_THM] +THEN EXISTS_TAC`{y:real^3}` +THEN ASM_REWRITE_TAC[CONNECTED_SING;IN_SING] +THEN ASM_TAC THEN SET_TAC[]);; + +let in_topological_component_yfan_is_connected=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool. +U IN topological_component_yfan (x,V,E) +==> connected U`, +REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[CONNECTED_CONNECTED_COMPONENT]);; + + +let expand_element_in_topological_component_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool z:real^3. + U IN topological_component_yfan (x,V,E) +/\ z IN U +==> U=connected_component (yfan(x,V,E)) z`, +REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y:real^3`;`z:real^3`]);; + + + +(* ========================================================================== *) +(* BASIC PROPERTIES OF CONVEX *) +(* ========================================================================== *) + +let expansion_convex_fan=prove(`!(v:real^3) (u:real^3) (w:real^3) (t:real) s:real. +&0 <= t /\ t<= &1 +/\ &0 <=s /\ s <= &1 +==> (&1-s)%v+s%((&1-t)%u+ t%w) IN convex hull{v,u,w}`, + +REWRITE_TAC[REAL_ARITH`A<= &1 <=> &0<= &1 -A`] +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[CONVEX_HULL_3; IN_ELIM_THM;] +THEN EXISTS_TAC`&1 - (s:real)` +THEN EXISTS_TAC`(s:real)*(&1 - (t:real))` +THEN EXISTS_TAC`(s:real)*(t:real)` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`s%((&1-t)%u+ t%w)= (s*(&1-t))%u+ (s*t)%w:real^3`] +THEN STRIP_TAC +THENL[MATCH_MP_TAC REAL_LE_MUL +THEN ASM_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[MATCH_MP_TAC REAL_LE_MUL +THEN ASM_TAC +THEN REAL_ARITH_TAC; +REAL_ARITH_TAC]]);; + + +let expansion1_convex_fan=prove(`!(v:real^3) (u:real^3) s:real. +&0 <=s /\ s <= &1 +==> (&1-s)%v+s%u IN convex hull{v,u}`, +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3)`;` (u:real^3)`;` &0`;`s:real`]expansion_convex_fan) +THEN ASM_REWRITE_TAC[SET_RULE`{A,B,B}={A,B}`] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN REAL_ARITH_TAC);; + + + +(* ========================================================================== *) +(* CROSS_DOT (^_^) *) +(* ========================================================================== *) + + +let JBDNJJB=prove(`!u:real^3 v:real^3 w:real^3. +~collinear {vec 0, u, v} /\ ~collinear {vec 0, u, w} +==> +?t:real. &0< t /\ sin(azim (vec 0) u v w)=t *(u cross v) dot w`, + +REPEAT STRIP_TAC +THEN MRESA_TAC th3[`((vec 0):real^3)`;` (u:real^3)`;` (v:real^3)`] +THEN MRESA_TAC properties_coordinate[`((vec 0):real^3)`;` (u:real^3)`;` (v:real^3)`] +THEN MRESA_TAC azim[`((vec 0):real^3)`;` (u:real^3)`;` (v:real^3)`;`(w:real^3)`] +THEN POP_ASSUM (fun th->MRESA_TAC th [`e1_fan ((vec 0):real^3) (u:real^3) (v:real^3)`;`e2_fan ((vec 0):real^3) (u:real^3) (v:real^3)`;`e3_fan ((vec 0):real^3) (u:real^3) (v:real^3)`]) +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"YEU EM") +THEN DISCH_TAC THEN DISCH_TAC +THEN MRESA_TAC sincos1_of_u_fan[`((vec 0):real^3)`;` (u:real^3)`;` (v:real^3)`;`r1:real`; `psi:real`; `h1:real`] +THEN REMOVE_THEN "YEU EM" MP_TAC +THEN ASM_REWRITE_TAC[COS_ADD;SIN_ADD;] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`w = + (r2 * cos (azim (vec 0) u v w)) % e1_fan (vec 0) u v + + (r2 * sin (azim (vec 0) u v w)) % e2_fan (vec 0) u v + + h2 % u ==> +(u cross v) dot w = +(u cross v) dot ((r2 * cos (azim (vec 0) u v w)) % e1_fan (vec 0) u v + + (r2 * sin (azim (vec 0) u v w)) % e2_fan (vec 0) u v + + h2 % u)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[DOT_LADD; DOT_RADD; DOT_LMUL; DOT_RMUL;DOT_CROSS_SELF; e2_fan;e1_fan;e3_fan; +VECTOR_ARITH`A- vec 0= A`;CROSS_LADD; CROSS_RADD; CROSS_LMUL; CROSS_RMUL;CROSS_REFL;CROSS_RNEG;CROSS_LNEG;] +THEN REDUCE_ARITH_TAC +THEN REWRITE_TAC[NORM_MUL;REAL_INV_MUL; REAL_ABS_INV;REAL_INV_INV;REAL_ABS_NORM;DOT_SQUARE_NORM +;REAL_ARITH`(r2 * sin (azim (vec 0) u v w)) * + (norm u * inv (norm (u cross v))) * + inv (norm u) * + norm (u cross v) pow 2 =(r2* norm(u cross v)) * sin (azim (vec 0) u v w) * + ( inv (norm u) * norm u)* +( inv (norm (u cross v))* norm (u cross (v:real^3)))` +] +THEN MP_TAC(ISPECL[`u:real^3`;`(vec 0) :real^3`]imp_norm_not_zero_fan) +THEN REDUCE_VECTOR_TAC +THEN RESA_TAC +THEN MP_TAC(ISPEC`(norm(u:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`u:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(&0 =norm(u:real^3)) /\ &0 <= norm(u:real^3)==> &0 &0 ~((r2:real)*norm(u cross v:real^3)= &0)`) +THEN REDUCE_VECTOR_TAC +THEN RESA_TAC +THEN MP_TAC(ISPEC`(r2 * norm(u cross v:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(r2 * norm(u cross v:real^3))`REAL_LT_INV) +THEN RESA_TAC +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(u cross v) dot w = (r2 * norm (u cross v)) * sin (azim (vec 0) u v w) ==> +inv (r2 * norm (u cross v))*(r2 * norm (u cross v)) * sin (azim (vec 0) u v w)= inv (r2 * norm (u cross v)) *((u cross v) dot w)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (r2 * norm (u cross v)) * (r2 * norm (u cross v)) * + sin (azim (vec 0) u v w)=(inv (r2 * norm (u cross v)) * (r2 * norm (u cross v)))* + sin (azim (vec 0) u v w)`] +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`inv (r2 * norm (u cross v)):real` +THEN ASM_REWRITE_TAC[]]);; + + + + + + +let cross_dot_fully_surrounded_fan=prove(`!x:real^3 v1:real^3 u1:real^3 v:real^3. +~collinear{x,v1,u1} +/\ ~collinear{x,v1,v} +/\ &0< azim x v1 v u1 +/\ azim x v1 v u1 < pi +==> &0 < ((v1 - x) cross (v - x)) dot (u1 - x)`, + +REPEAT STRIP_TAC +THEN MRESA1_TAC SIN_POS_PI`azim x v1 v (u1:real^3)` +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AZIM_TRANSLATION[`-- x:real^3`;`x:real^3`;`v1:real^3`;` v:real^3`;`u1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`x-x= vec 0`;VECTOR_ARITH`(-- X)+A= A-X:real^3`] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN MRESA_TAC JBDNJJB[`(v1-x):real^3`;`v-x:real^3`;`u1-x:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM COLLINEAR_3;] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN MRESAL_TAC REAL_LT_LMUL_EQ [` &0:real `;`(((v1 - x) cross (v - x)) dot ((u1 - x):real^3)):real`;`t:real`][REAL_ARITH`a * &0 = &0`]);; + + +let cross_dot_fully_surrounded_ge_fan=prove(`!x:real^3 v1:real^3 u1:real^3 v:real^3. +~collinear{x,v1,u1} +/\ ~collinear{x,v1,v} +/\ &0<= azim x v1 v u1 +/\ azim x v1 v u1 <= pi +==> &0 <= ((v1 - x) cross (v - x)) dot (u1 - x)`, +REPEAT STRIP_TAC +THEN MRESA1_TAC SIN_POS_PI_LE`azim x v1 v (u1:real^3)` +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AZIM_TRANSLATION[`-- x:real^3`;`x:real^3`;`v1:real^3`;` v:real^3`;`u1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`x-x= vec 0`;VECTOR_ARITH`(-- X)+A= A-X:real^3`] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN MRESA_TAC JBDNJJB[`(v1-x):real^3`;`v-x:real^3`;`u1-x:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM COLLINEAR_3;] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_LMUL_EQ [` &0:real `;`(((v1 - x) cross (v - x)) dot ((u1 - x):real^3)):real`;`t:real`][REAL_ARITH`a * &0 = &0`]);; + + +let coplanar_is_cross_fan=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +~collinear{x,v,u} +/\ v1 IN aff_gt {x} {v,u} +==> ((v-x) cross (u-x)) dot (v1-x)= &0`, +REPEAT STRIP_TAC +THEN MRESA_TAC properties_of_coplanar[`x:real^3`;`v:real^3`;`u:real^3`;`v1:real^3`] +THEN ONCE_REWRITE_TAC[DOT_SYM;] +THEN REWRITE_TAC[DOT_CROSS_DET] +THEN ONCE_REWRITE_TAC[GSYM COPLANAR_DET_EQ_0] +THEN ASM_REWRITE_TAC[]);; + + + + + + +let cut_inside_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 w1:real^3. +~collinear {x,v,w1} /\ ~collinear {x,u,w} /\ ~collinear {x,v,u} +/\ ~collinear {x,v,w} +/\ &0< azim x u w v /\ azim x u w v < pi +/\ &0< azim x v u w1 /\ azim x v u w1 < pi +/\ &0< azim x v w1 w /\ azim x v w1 w < pi +==> ~(aff_ge {x,v} {w1} INTER aff_gt {x} {u,w:real^3}={})`, +REWRITE_TAC[SET_RULE`~(A={})<=> ?x. x IN A`;IN_ELIM_THM; INTER] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w1:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`u:real^3`;`w:real^3`] +THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"CON") +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`;`w1:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"CON BE") +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`;`w:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"CON EM") +THEN ABBREV_TAC`a1=(v-x):real^3` +THEN ABBREV_TAC`a2=(w1-x):real^3` +THEN ABBREV_TAC`a3=(w-x) :real^3` +THEN ABBREV_TAC`a4=(u-x):real^3` +THEN ABBREV_TAC`va=a1 cross a2:real^3` +THEN ABBREV_TAC`vb=a3 cross a4:real^3` +THEN EXISTS_TAC`(vb:real^3) cross (va:real^3)+(x:real^3)` +THEN STRIP_TAC +THENL(*2*)[ +EXISTS_TAC`&1-(vb:real^3) dot (a2:real^3)+ vb dot (a1:real^3)` +THEN EXISTS_TAC`(vb:real^3) dot (a2:real^3)` +THEN EXISTS_TAC`--((vb:real^3) dot (a1:real^3))` +THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 - vb dot a2 + vb dot a1) + vb dot a2 + --(vb dot a1) = &1`] +THEN SUBGOAL_THEN `&0<= --((vb:real^3) dot (a1:real^3))` ASSUME_TAC +THENL(*3*)[ +EXPAND_TAC"vb" +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[DOT_LNEG] +THEN REMOVE_THEN "CON"MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[] +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_MUL_LNEG] +THEN EXPAND_TAC"a1" +THEN EXPAND_TAC"a2" +THEN VECTOR_ARITH_TAC];(*2*) +ONCE_REWRITE_TAC[CROSS_SKEW] +THEN EXPAND_TAC"vb" +THEN REWRITE_TAC[CROSS_LAGRANGE;] +THEN EXISTS_TAC`&1+(va:real^3) dot (a4:real^3)- va dot (a3:real^3)` +THEN EXISTS_TAC`((va:real^3) dot (a3:real^3))` +THEN EXISTS_TAC`--(va:real^3) dot (a4:real^3)` +THEN ASM_REWRITE_TAC[DOT_LNEG;VECTOR_MUL_LNEG;REAL_ARITH`(&1 + va dot a4 - va dot a3) + va dot a3 + --(va dot a4) = &1`;] +THEN STRIP_TAC +THENL(*3*)[ +EXPAND_TAC"va" +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[DOT_LNEG;CROSS_TRIPLE] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +EXPAND_TAC"a3" +THEN EXPAND_TAC"a4" +THEN REWRITE_TAC[VECTOR_ARITH`(&1+A-B)%X+B%U+ --(A%V)=X-(A%(V-X)-B%(U-X))`] +THEN VECTOR_ARITH_TAC]]);; + + + + +let exists_cut_in_edge_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 w1:real^3. +~collinear {x,v,w1} /\ ~collinear {x,u,w} /\ ~collinear {x,v,u} +/\ ~collinear {x,v,w} +/\ &0< azim x u w v /\ azim x u w v < pi +/\ &0< azim x v u w1 /\ azim x v u w1 < pi +/\ &0< azim x v w1 w /\ azim x v w1 w < pi +==> ?a. &0< a /\ a< &1 +/\ (&1-a) %u + a % w IN aff_ge {x,v} {w1:real^3}`, + +REPEAT STRIP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w1:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`u:real^3`;`w:real^3`] +THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] +THEN MRESA_TAC cut_inside_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[SET_RULE`~(A={})<=> ?x. x IN A`;INTER;] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`inv(&1-t1')*t3'` +THEN MP_TAC(REAL_ARITH`&0< t2' /\ &0< t3' /\ t1'+t2'+t3'= &1==> &0 < &1- t1' /\ ~(&1- t1' = &0)/\ t2'+t3'= &1- t1'`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`&1- (t1':real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`&1- (t1':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2' + t3' = &1 - t1':real +==> (inv ( &1 - t1'))*(t2' + t3') = (inv ( &1 - t1'))*( &1 - t1':real) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1 -A*C=A*B`;REAL_ARITH`A< &1 <=> &0< &1-A`] +THEN STRIP_TAC +THEN MRESA_TAC REAL_LT_MUL[`inv (&1- t1'):real`;`t2':real`;] +THEN MRESA_TAC REAL_LT_MUL[`inv (&1- t1'):real`;`t3':real`;] +THEN REWRITE_TAC[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`; VECTOR_ARITH`A%(t2' % u + t3' % w)= A%((t1'%x +t2' % u + t3' % w) - t1' %x) :real^3`] +THEN FIND_ASSUM MP_TAC`x' = t1' % x + t2' % u + t3' % w:real^3` +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(t1 % x + t2 % v + t3 % w1) - t1' % x=(t1-t1') % x + t2 % v + t3 % w1`; +VECTOR_ARITH`A%(B+C+D)=A%B+A%C+A%D`;VECTOR_ARITH`A%B%C=(A*B)%C`] +THEN EXISTS_TAC`(inv (&1 - t1') * (t1 - t1')):real` +THEN EXISTS_TAC`(inv (&1 - t1') * t2):real` +THEN EXISTS_TAC`(inv (&1 - t1') * t3):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1 - t1') * (t1 - t1') + inv (&1 - t1') * t2 + inv (&1 - t1') * t3 +=inv (&1 - t1') * ((t1 +t2 + t3)-t1')`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN REAL_ARITH_TAC);; + + + +let properties_of_fully_surrounded1_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 w1:real^3. +~coplanar {x,v,u,w}/\ &0< azim x u w v /\ azim x u w v < pi +==> &0 < azim x v u w /\ azim x v u w < pi`, +REPEAT STRIP_TAC +THEN MRESA_TAC azim[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`;`(w:real^3)`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THENL[ + MP_TAC(REAL_ARITH` &0<= azim x v u (w:real^3) ==> azim x v u w = &0 \/ &0< azim x v u w`) +THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`]; + +MP_TAC(REAL_ARITH` (azim x v u w = pi) \/ (pi < azim x v u w) \/ azim x v u w< pi`) +THEN RESA_TAC +THENL[ +MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`]; + +MP_TAC(REAL_ARITH`pi< azim x v u w /\ azim x v u w < &2 * pi ==> &0< azim x v u w - pi /\ azim x v u w - pi< pi`) +THEN RESA_TAC +THEN MRESAL1_TAC SIN_POS_PI`azim x v u (w:real^3) -pi`[SIN_SUB; SIN_PI; COS_PI;REAL_ARITH`&0< A * -- &1 -B * &0 <=> A < &0`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AZIM_TRANSLATION[`-- x:real^3`;`x:real^3`;`v:real^3`;` u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`x-x= vec 0`;VECTOR_ARITH`(-- X)+A= A-X:real^3`] +THEN DISCH_TAC +THEN MRESA_TAC JBDNJJB[`(v-x):real^3`;`u-x:real^3`;`w-x:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM COLLINEAR_3;] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESAL_TAC REAL_LT_LMUL_EQ[`(((v - x) cross (u - x)) dot (w - x:real^3))`;`&0`;`t:real`][REAL_ARITH`A * &0= &0`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[DOT_LNEG;CROSS_TRIPLE] +THEN MRESA1_TAC SIN_POS_PI`azim x u (w:real^3) v` +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AZIM_TRANSLATION[`-- x:real^3`;`x:real^3`;`u:real^3`;` w:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`x-x= vec 0`;VECTOR_ARITH`(-- X)+A= A-X:real^3`] +THEN DISCH_TAC +THEN MRESA_TAC JBDNJJB[`(u-x):real^3`;`w-x:real^3`;`v-x:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM COLLINEAR_3;] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESAL_TAC REAL_LT_LMUL_EQ[`&0`;`(((u - x) cross (w - x)) dot (v - x:real^3))`;`t':real`][REAL_ARITH`A * &0= &0`] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]) +;; + + + + +let inequality4_aim_in_convex_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 a:real. +~coplanar {x,v,u,w}/\ &0< azim x u w v /\ azim x u w v < pi +/\ &0< a /\ a < &1 +==> +&0< azim x v u ((&1 - a) % u + a % w) +/\ azim x v u ((&1 - a) % u + a % w)< azim x v u w `, + +REPEAT STRIP_TAC +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC properties_of_fully_surrounded1_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN MRESA_TAC WEDGE_LUNE_GT[`x:real^3`;` v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MP_TAC(SYM(th))) +THEN DISCH_TAC +THEN MRESA_TAC in_aff_2_2_fan[`x:real^3`;` v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `a:real`) +THEN POP_ASSUM(fun th-> MRESAL_TAC th [`&0:real`;`&0`;`&1`][REAL_ARITH`&0< &1/\ &0+ &0 + &1 = &1`;wedge;IN_ELIM_THM]) +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REDUCE_VECTOR_TAC +THEN DISCH_TAC THEN DISCH_TAC +THEN ASM_REWRITE_TAC[]);; + + + + + +let cut_in_angle_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 y:real^3. + ~coplanar {x,v,u,w} /\ ~collinear {x,u,y} +/\ &0< azim x u w v /\ azim x u w v< pi +/\ azim x u w y< azim x u w v /\ &0< azim x u w y +==> let a1=(v-x):real^3 in + let a2=w-x:real^3 in + let a3=(y-x):real^3 in + let a4=(u-x) :real^3 in + let va=a1 cross a2:real^3 in + let vb=a3 cross a4:real^3 in + let v3= (vb:real^3) cross (va:real^3)+(x:real^3) +in v3 IN aff_gt {x} {v,w:real^3}`, + +REPEAT STRIP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ABBREV_TAC`a1=(v-x):real^3` +THEN ABBREV_TAC`a2=(y-x):real^3` +THEN ABBREV_TAC`a3=(u-x) :real^3` +THEN ABBREV_TAC`a4=w-x:real^3` +THEN ABBREV_TAC`va=a1 cross a4:real^3` +THEN ABBREV_TAC`vb=a2 cross a3:real^3` +THEN ABBREV_TAC`v3= (vb:real^3) cross (va:real^3)+(x:real^3)` +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(w:real^3) `;] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&1-(vb:real^3) dot (a4:real^3)+vb dot (a1:real^3)` +THEN EXISTS_TAC`((vb:real^3) dot (a4:real^3))` +THEN EXISTS_TAC`(--((vb:real^3) dot (a1:real^3)))` +THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 - vb dot a4 + vb dot a1) + (vb dot a4) + --(vb dot a1) = &1`;VECTOR_ARITH`(&1-A+B)%X+ (A)%U+ (--B) %V=A%(U-X)- B%(V-X)+X`] +THEN EXPAND_TAC"v3" +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_ARITH`--(A-B)+C=B-A+C:real^3`] +THEN MP_TAC(REAL_ARITH`azim x u w v< pi +/\ azim x u w y< azim x u w v==>azim x u w (y:real^3)< pi`) +THEN RESA_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`u:real^3`;`y:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW; ] +THEN ASM_REWRITE_TAC[DOT_LNEG] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE;] THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN ASM_REWRITE_TAC[DOT_LNEG;REAL_ARITH`--(--A)=A`] +THEN DISCH_TAC +THEN MP_TAC(REAL_ARITH`azim x u w y< azim x u w v==> azim x u w y<= azim x u w (v:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`u:real^3`;`w:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x u w y< azim x u w v/\ &0< azim x u w y/\ azim x u w v < pi /\ azim x u w v = azim x u w y + azim x u y v==> ~(azim x u y (v:real^3)= &0)/\ &0< azim x u y v/\ azim x u y v < pi/\ ~(azim x u y (v:real^3)= pi)`) +THEN RESA_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`u:real^3`;`v:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[CROSS_SKEW; ] +THEN ASM_REWRITE_TAC[DOT_LNEG] );; + + + +(* ========================================================================== *) +(* GRAPH (^_^) *) +(* ========================================================================== *) + + + + + + + + + +let GRAPH = prove + (`!E. graph E <=> !e. e IN E ==> e HAS_SIZE 2`, + REWRITE_TAC[graph; IN]);; + + + + +let CARD_2_FAN=prove(`!v:A w:A. ~(v=w) +==> CARD {v,w}=2`, +REPEAT STRIP_TAC +THEN SUBGOAL_THEN`FINITE {v,w:A}`ASSUME_TAC +THENL[ SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY]; + +ASSUME_TAC(SET_RULE `v:A IN {v:A,w:A} `) +THEN MP_TAC(ISPECL[`v:A`;`{v:A,w:A}`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `v IN {v,w}==>{v:A,w:A} DELETE v PSUBSET {v,w}`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`{v:A,w:A} DELETE v`;`{v:A,w:A}`]CARD_PSUBSET) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`FINITE {v:A,w:A}` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN DISCH_TAC +THEN MP_TAC(ARITH_RULE`CARD ({v, w} DELETE v) < CARD {v, w}/\ CARD ({v, w} DELETE v) = CARD {v, w}-1 +<=>CARD ({v, w} DELETE v) +1= CARD {v:A, w:A}`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th;]) +THEN REWRITE_TAC[ARITH_RULE`A=A`] +THEN DISCH_TAC +THEN SUBGOAL_THEN `w:A IN ({v:A,w:A} DELETE v)` ASSUME_TAC +THENL[ +ASM_SET_TAC[]; +MP_TAC(ISPECL[`{v:A,w:A}`;`v:A`] FINITE_DELETE) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`w:A`;`{v:A,w:A} DELETE v`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `w IN ({v,w} DELETE v)==>{v:A,w:A} DELETE v DELETE w PSUBSET {v,w} DELETE v`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`{v:A,w:A} DELETE v DELETE w`;`{v:A,w:A} DELETE v`]CARD_PSUBSET) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`FINITE ({v:A,w:A} DELETE v)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN DISCH_TAC +THEN MP_TAC(ARITH_RULE`CARD ({v, w} DELETE v DELETE w) < CARD ({v, w} DELETE v)/\ CARD ({v, w} DELETE v DELETE w) = CARD ({v, w} DELETE v)-1 +<=>CARD ({v, w} DELETE v DELETE w) +1= CARD ({v:A, w:A} DELETE v)`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th;]) +THEN REWRITE_TAC[ARITH_RULE`A=A`] +THEN DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[]) +THEN POP_ASSUM (fun th->REWRITE_TAC[]) +THEN ASSUME_TAC(SET_RULE `{v, w} DELETE v:A DELETE w:A={}`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th;CARD_CLAUSES; ARITH_RULE `0+1=1`]) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"B") +THEN DISCH_TAC +THEN REMOVE_THEN "B" MP_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th);ARITH_RULE` 1+1=2`]) +THEN SET_TAC[]]]);; + + + +(* ========================================================================== *) +(* CONDITION OF CROSS DOT 4 POINT (^_^) *) +(* ========================================================================== *) + + +let condition_cross_dot_4point=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + let va = a1 cross a2 in + let vb = a3 cross a4 in + let v3 = va cross vb + x in + ~collinear {x,v,u} +/\ &0<(a1 cross a2) dot a4 /\ &0 < --((a1 cross a2) dot a3) +==> v3 IN aff_gt {x} {v,u}`, +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ABBREV_TAC`a1=(y-x):real^3` +THEN ABBREV_TAC`a2=(z-x):real^3` +THEN ABBREV_TAC`a3=(v-x) :real^3` +THEN ABBREV_TAC`a4=u-x:real^3` +THEN ABBREV_TAC`va=a1 cross a2:real^3` +THEN ABBREV_TAC`vb=a3 cross a4:real^3` +THEN ABBREV_TAC`v3= (va:real^3) cross (vb:real^3)+(x:real^3)` +THEN REPEAT STRIP_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(u:real^3) `;] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&1-(va:real^3) dot (a4:real^3)+va dot (a3:real^3)` +THEN EXISTS_TAC`((va:real^3) dot (a4:real^3))` +THEN EXISTS_TAC`(--((va:real^3) dot (a3:real^3)))` +THEN ASM_REWRITE_TAC[REAL_ARITH` (&1 - va dot a4 + va dot a3) + (va dot a4) + --(va dot a3) = &1`] +THEN EXPAND_TAC"v3" +THEN EXPAND_TAC"vb" +THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_ARITH`A+ B + --U%C=A +B-U%C:real^3`] +THEN EXPAND_TAC"a3" +THEN EXPAND_TAC"a4" +THEN VECTOR_ARITH_TAC);; + + + + +let aff_gt_2_1_crossr_dot_4point=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + ~collinear {x,y,z} +/\ u IN aff_gt {x,y} {z} +/\ &0<(a1 cross a2) dot a3 +==> &0<(a1 cross a4) dot a3 `, +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`y:real^3`;`z:real^3`] +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`y:real^3`;`z:real^3`][IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(u' % x + v' % y + w % z) - x=((u'+v'+w) - &1) % x + v' % (y-x) + w % (z - x)`;REAL_ARITH`&1- &1= &0`] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[CROSS_RMUL;CROSS_RADD;CROSS_REFL;] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[DOT_LMUL] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]);; + + +let aff_gt_2_1_rcross_dot_4pointl=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + ~collinear {x,y,z} +/\ u IN aff_gt {x,z} {y} +/\ &0<(a1 cross a2) dot a3 +==> &0<(a4 cross a2) dot a3 `, +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`z:real^3`;`y:real^3`] +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`z:real^3`;`y:real^3`][IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(u' % x + v' % z + w % y) - x=((u'+v'+w) - &1) % x + v' % (z-x) + w % (y - x)`;REAL_ARITH`&1- &1= &0`] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[CROSS_LMUL;CROSS_LADD;CROSS_REFL;] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[DOT_LMUL] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]);; + + + + +let aff_gt_2_1_cross_dotr_4point=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + ~collinear {x,y,v} +/\ u IN aff_gt {x,y} {v} +/\ &0<(a1 cross a2) dot a3 +==> &0<(a1 cross a2) dot a4 `, +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`y:real^3`;`v:real^3`] +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`y:real^3`;`v:real^3`][IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(u' % x + v' % z + w % y) - x=((u'+v'+w) - &1) % x + v' % (z-x) + w % (y - x)`;REAL_ARITH`&1- &1= &0`] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[DOT_RMUL;DOT_RADD;DOT_CROSS_SELF] +THEN REDUCE_ARITH_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]);; + + +let aff_gt_2_1_cross_dotl_4point=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + ~collinear {x,z,v} +/\ u IN aff_gt {x,z} {v} +/\ &0<(a1 cross a2) dot a3 +==> &0<(a1 cross a2) dot a4 `, +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`z:real^3`;`v:real^3`] +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`z:real^3`;`v:real^3`][IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(u' % x + v' % z + w % y) - x=((u'+v'+w) - &1) % x + v' % (z-x) + w % (y - x)`;REAL_ARITH`&1- &1= &0`] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[DOT_RMUL;DOT_RADD;DOT_CROSS_SELF] +THEN REDUCE_ARITH_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]);; + + + + + +let aff_gt_2_1r_rcross_dotl_4point=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + ~collinear {x,v,y} +/\ u IN aff_gt {x,v} {y} +/\ &0<(a1 cross a2) dot a3 +==> &0<(a4 cross a2) dot a3 `, +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`y:real^3`] +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`v:real^3`;`y:real^3`][IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(u' % x + v' % z + w % y) - x=((u'+v'+w) - &1) % x + v' % (z-x) + w % (y - x)`;REAL_ARITH`&1- &1= &0`] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[CROSS_LMUL;CROSS_LADD;DOT_LMUL;DOT_LADD;DOT_CROSS_SELF] +THEN REDUCE_ARITH_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]);; + + + + + +let aff_gt_1_2_cross_dotr_4point=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + ~collinear {x,v,u} +/\ y IN aff_gt {x} {v,u} +/\ &0<(a1 cross a2) dot a3 + ==> &0< --((a1 cross a2) dot a4)`, + +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(u' % x + v' % z + w % y) - x=((u'+v'+w) - &1) % x + v' % (z-x) + w % (y - x)`;REAL_ARITH`&1- &1= &0`] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[CROSS_LNEG;CROSS_LMUL;CROSS_LADD;CROSS_REFL;DOT_LMUL;DOT_LADD;] +THEN ONCE_REWRITE_TAC[CROSS_SKEW;CROSS_TRIPLE] +THEN REWRITE_TAC[CROSS_TRIPLE;CROSS_REFL;DOT_LZERO] +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[DOT_LNEG;REAL_ARITH`--(A* (--B))=A*B`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE;] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC REAL_LT_RCANCEL_IMP[`&0`;`((u - x) cross (z - x)) dot (v - x:real^3)`;`t3:real`;][REAL_ARITH`&0 * A= &0`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC);; + + + + + +let aff_gt_1_2_cross_dotr_4point_neg=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + ~collinear {x,v,u} +/\ y IN aff_gt {x} {v,u} +/\ &0< --((a1 cross a2) dot a3) + ==> &0< ((a1 cross a2) dot a4)`, +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(u' % x + v' % z + w % y) - x=((u'+v'+w) - &1) % x + v' % (z-x) + w % (y - x)`;REAL_ARITH`&1- &1= &0`] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[CROSS_LNEG;CROSS_LMUL;CROSS_LADD;CROSS_REFL;DOT_LMUL;DOT_LADD;] +THEN ONCE_REWRITE_TAC[CROSS_SKEW;CROSS_TRIPLE] +THEN REWRITE_TAC[CROSS_TRIPLE;CROSS_REFL;DOT_LZERO] +THEN REDUCE_ARITH_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[DOT_LNEG;REAL_ARITH`--(A* (--B))=A*B`] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[DOT_LNEG;REAL_ARITH`-- --A=A`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE;] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE;] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC REAL_LT_RCANCEL_IMP[`&0`;`((z - x) cross (u - x)) dot (v - x):real^3`;`t3:real`;][REAL_ARITH`&0 * A= &0`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC);; + + + +let aff_gt_1_2_cross_dotr_4point_zero=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + ~collinear {x,v,u} +/\ y IN aff_gt {x} {v,u} +/\ (a1 cross a2) dot a3= &0 + ==> ((a1 cross a2) dot a4)= &0`, + +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(u' % x + v' % z + w % y) - x=((u'+v'+w) - &1) % x + v' % (z-x) + w % (y - x)`;REAL_ARITH`&1- &1= &0`] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[CROSS_LNEG;CROSS_LMUL;CROSS_LADD;CROSS_REFL;DOT_LMUL;DOT_LADD;] +THEN ONCE_REWRITE_TAC[CROSS_SKEW;CROSS_TRIPLE] +THEN REWRITE_TAC[CROSS_TRIPLE;CROSS_REFL;DOT_LZERO] +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[DOT_LNEG;REAL_ARITH`--(A* (--B))=A*B`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[REAL_ENTIRE] +THEN STRIP_TAC +THEN ASM_TAC THEN REAL_ARITH_TAC);; + + +let exists_esilon_real=prove(`!a:real b:real. +&0 ?t. &0< t /\ t< &1 /\ +(!h. &0< h /\ h< t==> &0< a- h * b)`, +REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`b <= &0 \/ &0< b`) +THENL[ EXISTS_TAC`&1/ &2` +THEN REWRITE_TAC[REAL_ARITH`&0< &1/ &2 /\ &1/ &2< &1`;] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC(REAL_ARITH`&0 &0< a-h*b`) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= --B<=> B<= &0`] +THEN ASM_TAC THEN REAL_ARITH_TAC; +ABBREV_TAC`t1= (min (inv (b:real) * a) (&1)) / &2` +THEN MRESA1_TAC REAL_LT_INV`b:real` +THEN MRESA_TAC REAL_LT_MUL[`inv b:real`;`a:real`] +THEN MP_TAC(REAL_ARITH`&0 < inv b * a /\ t1= (min (inv (b:real) * a) (&1)) / &2 +==> &0< t1 /\ t1< &1 /\ t1< inv b * a`) +THEN RESA_TAC +THEN EXISTS_TAC `t1:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`h &0< inv b *a- h`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`b:real`;`inv b *a- h:real`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`b * (inv b * a - h)= (inv b * b) * a- h *b `] +THEN MP_TAC(REAL_ARITH`&0 ~(b= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`b:real` +THEN REAL_ARITH_TAC]);; + + + +let invariant_cross_dotr_esilon_3piont=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + &0<(a1 cross a2) dot a3 + ==> +?t. &0< t /\ t< &1 /\ +(!h. &0< h /\ h< t==> + &0< ((a1 cross a2) dot ((&1 - h) % v + h % u-x)))`, + +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - h) % v + h % u-x=(&1 - h) % (v-x) + h % (u-x)`;] +THEN REWRITE_TAC[DOT_RMUL;DOT_RADD;] +THEN REWRITE_TAC[REAL_ARITH`(&1-h)*A+h*B=A-h*(A-B)`] +THEN MATCH_MP_TAC exists_esilon_real +THEN ASM_REWRITE_TAC[]);; + + + +let invariant_rcross_dot_esilon_3piont=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + &0<(a1 cross a2) dot a3 + ==> +?t. &0< t /\ t< &1 /\ +(!h. &0< h /\ h< t==> + &0< (((&1 - h) % y + h % u-x) cross a2) dot a3)`, +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - h) % v + h % u-x=(&1 - h) % (v-x) + h % (u-x)`;] +THEN REWRITE_TAC[CROSS_LMUL;CROSS_LADD;DOT_LMUL;DOT_LADD;] +THEN REWRITE_TAC[REAL_ARITH`(&1-h)*A+h*B=A-h*(A-B)`] +THEN MATCH_MP_TAC exists_esilon_real +THEN ASM_REWRITE_TAC[]);; + + +let invariant_crossr_dot_esilon_3piont=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + &0<(a1 cross a2) dot a3 + ==> +?t. &0< t /\ t< &1 /\ +(!h. &0< h /\ h< t==> + &0< (a1 cross ((&1 - h) % z + h % u-x)) dot a3)`, +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - h) % v + h % u-x=(&1 - h) % (v-x) + h % (u-x)`;] +THEN REWRITE_TAC[CROSS_RMUL;CROSS_RADD;DOT_LMUL;DOT_LADD;] +THEN REWRITE_TAC[REAL_ARITH`(&1-h)*A+h*B=A-h*(A-B)`] +THEN MATCH_MP_TAC exists_esilon_real +THEN ASM_REWRITE_TAC[]);; + + + +let condition_4point_aff_gt_1_2inter_aff_gt_1_2=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3 w:real^3 a:real. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + let a5 = w - x in + + ~collinear {x,v,u} +/\ ~collinear {x,u,w} +/\ ~collinear {x,y,z} +/\ &0< a /\ a< &1 +/\ y IN aff_gt {x} {v,u} +/\ &0<(a3 cross a4) dot a5 +/\ (!h. &0< h /\ h< a==> ~collinear {x,v,(&1-h)%u+h%w}) +/\ &0<(a3 cross a1) dot a2 + ==> ?t. &0< t /\ t< &1 /\ +(!h. &0< h /\ h< t==> ~(aff_gt {x} {y,z} INTER aff_gt {x} {v,(&1-h)%u+h%w}={}))`, + +REPEAT STRIP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN MRESA_TAC aff_gt_1_2_cross_dotr_4point[`x:real^3`;`y:real^3`;`z:real^3`;`v:real^3`;`u:real^3`;] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN MRESA_TAC invariant_cross_dotr_esilon_3piont[`x:real^3`; `z:real^3`;`y:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[DOT_LNEG] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN MRESA_TAC point_in_aff_gt_2_1_change_point_in_aff_gt_1_2[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN MRESA_TAC aff_gt_2_1r_rcross_dotl_4point[`x:real^3`;`y:real^3`;`z:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC invariant_rcross_dot_esilon_3piont[`x:real^3`; `u:real^3`;`z:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN ABBREV_TAC`t1= min (min t t') a:real` +THEN MP_TAC(REAL_ARITH`&0 &0< t1 /\ t1 < &1`) +THEN RESA_TAC +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[SET_RULE`~(A={})<=> ?y1. y1 IN A`] +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`a1=(y-x):real^3` +THEN ABBREV_TAC`a2=(z-x):real^3` +THEN ABBREV_TAC`a3=(v-x) :real^3` +THEN ABBREV_TAC`a4=(&1 - h) % u + h % w-x:real^3` +THEN ABBREV_TAC`va=a1 cross a2:real^3` +THEN ABBREV_TAC`vb=a3 cross a4:real^3` +THEN ABBREV_TAC`v3= (vb:real^3) cross (va:real^3)+(x:real^3)` +THEN EXISTS_TAC `v3:real^3` +THEN MP_TAC(REAL_ARITH`h h MRESA1_TAC th `h:real`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN REWRITE_TAC[DOT_LNEG] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN REWRITE_TAC[GSYM DOT_LNEG] +THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] +THEN RESA_TAC +THEN MRESA_TAC th3[`x:real^3`;`u:real^3`;`w:real^3`;] +THEN MRESA_TAC pos_in_aff_gt_2_1_fan [`x:real^3`;`u:real^3`;`w:real^3`;`h:real`] +THEN MRESAL_TAC aff_gt_2_1_cross_dotl_4point[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`(&1 - h) % u + h % w:real^3`][VECTOR_ARITH`((&1 - h) % u + h % w) - x=(&1 - h) % u + h % w - x`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN MRESA_TAC aff_gt_inter_aff_gt [`(x:real^3)`;`(v:real^3)`;`(u:real^3)`] +THEN MP_TAC(SET_RULE`y IN aff_gt {x} {v, u} /\ aff_gt {x} {v, u} = aff_gt {x, v} {u} INTER aff_gt {x, u} {v} +==> y IN aff_gt {x, v} {u:real^3}`) +THEN RESA_TAC +THEN MRESAL_TAC aff_gt_2_1r_rcross_dotl_4point[`x:real^3`;`u:real^3`;`(&1 - h) % u + h % w:real^3`;`v:real^3`;`y:real^3`][VECTOR_ARITH`((&1 - h) % u + h % w) - x=(&1 - h) % u + h % w - x`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[DOT_LNEG] +THEN STRIP_TAC +THEN MRESAL_TAC condition_cross_dot_4point[`x:real^3`;`v:real^3`;`(&1 - h) % u + h % w:real^3`;`y:real^3`;`z:real^3` ][VECTOR_ARITH`((&1 - h) % u + h % w) - x=(&1 - h) % u + h % w - x`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC condition_cross_dot_4point[`x:real^3`; `z:real^3`;`y:real^3` ;`v:real^3`;`(&1 - h) % u + h % w:real^3`][VECTOR_ARITH`((&1 - h) % u + h % w) - x=(&1 - h) % u + h % w - x`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[GSYM CROSS_RNEG] +THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] +THEN REWRITE_TAC[DOT_LNEG;REAL_ARITH`--(--A)=A`] +THEN REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th`h:real`) +THEN REMOVE_THEN "LINH" (fun th-> MRESA1_TAC th`h:real`) +THEN SET_TAC[]);; + + + + + + + +end;; diff --git a/legacy/oldfan/RWXUYZZ.hl b/legacy/oldfan/RWXUYZZ.hl new file mode 100755 index 0000000..bec6649 --- /dev/null +++ b/legacy/oldfan/RWXUYZZ.hl @@ -0,0 +1,1519 @@ + +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + + +module Dartset_leads_into = struct + + + +open Sphere;; +open Fan_defs;; +open Hypermap_of_fan;; +open Tactic_fan;; +open Lemma_fan;; +open Fan;; +open Hypermap_of_fan;; +open Node_fan;; +open Azim_node;; +open Sum_azim_node;; +open Disjoint_fan;; +open Lead_fan;; +open Fan_misc;; +open Leads_into_fan;; +open Fully_surrounded;; +open Sin_azim_cross_dot;; +open Leads_intos;; +open Hypermap;; + + +(* ========================================================================== *) +(* FAN AND CONVEX *) +(* ========================================================================== *) + + +let angle_is_small_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ fan80(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> + azim x v u w <= azim x v u (sigma_fan x V E v u) `, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "BE") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "BE" MP_TAC +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `v:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge v V E = {u} \/ ~(set_of_edge v V E = {u:real^3})`) +THENL(*1*)[ +MRESA_TAC CARD_SING[`u:real^3`; `(set_of_edge v V E):real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) +THEN ASM_TAC THEN ARITH_TAC;(*1*) +MRESA_TAC SIGMA_FAN[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` sigma_fan x V E v (u:real^3)`;` (v:real^3)`] +THEN POP_ASSUM MP_TAC THEN RESA_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`] +THEN ABBREV_TAC`w1=(sigma_fan x V E v u) :real^3` +THEN MRESA_TAC properties_of_fully_surrounded1_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN DISJ_CASES_TAC(REAL_ARITH` azim x v u w1 < azim x v u w\/ azim x v u w <= azim x v u w1 `) +THENL(*2*)[ +MP_TAC(REAL_ARITH`azim x v u w1 < azim x v u w ==> azim x v u w1 <= azim x v u w`) +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`;`w:real^3`] +THEN MP_TAC(REAL_ARITH` &0< azim x v u w1 /\ azim x v u w1 < azim x v u w /\ azim x v u w = azim x v u w1 + azim x v w1 w +==> &0< azim x v w1 w /\ azim x v w1 w <= azim x v u w`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x v w1 w <= azim x v u w /\ azim x v u w < pi +==> azim x v w1 w < pi`) +THEN RESA_TAC +THEN MRESA_TAC exists_cut_in_edge_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[SET_RULE`~(A={})<=> ?x. x IN A`;INTER] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ABBREV_TAC`va=(&1-a)%u + a%w:real^3` +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w1:real^3`;`va:real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*3*)[ +MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v:real^3)`;`(w1:real^3)`] +THEN MRESA_TAC not_cut_in_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MP_TAC(SET_RULE`w1 IN aff_gt {x} {v, va} + /\ w1 IN aff_ge {x} {v, w1}==> ~(aff_gt {x} {v, va} INTER aff_ge {x:real^3} {v, w1}={})`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`{v,w1:real^3} IN E` +THEN SET_TAC[];(*3*) +MRESA_TAC pos_in_aff_ge_fan [`x:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MP_TAC(SET_RULE`va IN aff_ge {x} {v, w1:real^3} /\ va IN aff_ge {x} {u, w} +==>va IN aff_ge {x} {u, w} INTER aff_ge {x} {v, w1:real^3} `) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPECL[`{(u:real^3),(w:real^3)}`;`{(v:real^3),(w1:real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] +THEN DISCH_TAC THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`~(v=u) /\ DISJOINT{x,v} {w} ==> ~(v IN {u,w:real^3}) `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(v IN {u,w:real^3})/\ ~(u=w)==> ~({u, w} INTER {v, w1} = {u, w:real^3})`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~({u, w} INTER {v, w1} = {u, w:real^3}) ==> {u, w} INTER {v, w1} PSUBSET {u, w} `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{u, w} INTER {v, w1} PSUBSET {u, w:real^3} ==> {u, w} INTER {v, w1} SUBSET {u}\/ {u, w} INTER {v, w1} SUBSET {w} `) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*4*)[ +MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v, w1:real^3}`; `{u:real^3}`][DISJOINT;SET_RULE`{x} INTER {u} = {}<=> ~(x=u:real^3)`] +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{u:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] +THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v, w1}) SUBSET aff_ge {x} {u}/\ aff_ge {x} {u} SUBSET aff {x, u}/\ va IN aff_ge {x} ({u, w} INTER {v, w1})==> va IN aff {x,u}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % u +<=> a % w = u' % x + (v''+a- &1) % u`] +THEN MP_TAC(REAL_ARITH`&0< a==> ~(a = &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`a % w = u' % x + (v' + a - &1) % u:real^3 ==> (inv (a))%(a % w ) = (inv (a))%( u' % x + (v' + a - &1) % u)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN `w IN aff {x,u:real^3}` ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`(inv a * u'):real` +THEN EXISTS_TAC`(inv a * (v' + a - &1)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv a * u' + inv a * (v' + a - &1) =inv a * ( a+ (u' + v') - &1)`;REAL_ARITH`A+ &1- &1=A`];(*5*) +POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `~(w IN aff {x, u:real^3})` +THEN SET_TAC[]](*5*);(*4*) + +FIND_ASSUM MP_TAC`{u,w:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`w:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v, w1:real^3}`; `{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {w} = {}<=> ~(x=w:real^3)`] +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{w:real^3}`][SET_RULE`{x} UNION {w}={x,w}`;GSYM aff] +THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v, w1}) SUBSET aff_ge {x} {w}/\ aff_ge {x} {w} SUBSET aff {x, w}/\ va IN aff_ge {x} ({u, w} INTER {v, w1})==> va IN aff {x,w}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % w +<=> (&1-a) % u = u' % x + (v''-a) % w`] +THEN MP_TAC(REAL_ARITH`a < &1==> ~(&1- a= &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`&1-a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(&1-a) % u = u' % x + (v' - a) % w:real^3 ==> (inv (&1-a))%((&1-a) % u ) = (inv (&1-a))%( u' % x + (v' - a) % w)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN `u IN aff {x,w:real^3}` ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`(inv (&1-a) * u'):real` +THEN EXISTS_TAC`(inv (&1-a) * (v' - a)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1-a') * u' + inv (&1-a') * (v' - a') =inv (&1-a') * ( (u' + v') - a')`;];(*5*) + +POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `~(u IN aff {x, w:real^3})` +THEN SET_TAC[]](*5*)](*4*)](*3*);(*2*) + +ASM_REWRITE_TAC[]]]);; + + + +let angle_is_smallpi_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ fan80(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> +&0< azim x v u w /\ azim x v u w MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN SUBGOAL_THEN`~(azim x v u (w:real^3)= &0)`ASSUME_TAC +THENL[STRIP_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`]; +MATCH_MP_TAC(REAL_ARITH`~(azim x v u (w:real^3)= &0)/\ &0<= azim x v u w ==> &0 < azim x v u w`) +THEN ASM_REWRITE_TAC[azim]]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "BE") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "BE" MP_TAC +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC angle_is_small_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w:real^3`] +THEN ASM_TAC THEN REAL_ARITH_TAC]);; + + + + +let exists_rw_dart_inter_aff_gt_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 . +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ fan80(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> +(?h:real. &0< h /\ +(!t:real. &0< t /\ t< h==> +(!s:real. &0 +~(rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),(sigma_fan x V E v (u:real^3))) (cos(s)) INTER aff_gt {x} {v, (&1-t)%u+t%w}={}) +)))`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "BE") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "BE" MP_TAC +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `v:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge v V E = {u} \/ ~(set_of_edge v V E = {u:real^3})`) +THENL(*1*)[ +MRESA_TAC CARD_SING[`u:real^3`; `(set_of_edge v V E):real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) +THEN ASM_TAC THEN ARITH_TAC;(*1*) + +MRESA_TAC SIGMA_FAN[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` sigma_fan x V E v (u:real^3)`;` (v:real^3)`] +THEN POP_ASSUM MP_TAC THEN RESA_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`] +THEN ABBREV_TAC`w1=(sigma_fan x V E v u) :real^3` +THEN MRESA_TAC properties_of_fully_surrounded1_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN DISJ_CASES_TAC(REAL_ARITH` azim x v u w1 < azim x v u w\/ azim x v u w <= azim x v u w1 `) +THENL(*2*)[ +MP_TAC(REAL_ARITH`azim x v u w1 < azim x v u w ==> azim x v u w1 <= azim x v u w`) +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`;`w:real^3`] +THEN MP_TAC(REAL_ARITH` &0< azim x v u w1 /\ azim x v u w1 < azim x v u w /\ azim x v u w = azim x v u w1 + azim x v w1 w +==> &0< azim x v w1 w /\ azim x v w1 w <= azim x v u w`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x v w1 w <= azim x v u w /\ azim x v u w < pi +==> azim x v w1 w < pi`) +THEN RESA_TAC +THEN MRESA_TAC exists_cut_in_edge_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[SET_RULE`~(A={})<=> ?x. x IN A`;INTER] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ABBREV_TAC`va=(&1-a)%u + a%w:real^3` +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w1:real^3`;`va:real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*3*)[ +MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v:real^3)`;`(w1:real^3)`] +THEN MRESA_TAC not_cut_in_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MP_TAC(SET_RULE`w1 IN aff_gt {x} {v, va} + /\ w1 IN aff_ge {x} {v, w1}==> ~(aff_gt {x} {v, va} INTER aff_ge {x:real^3} {v, w1}={})`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`{v,w1:real^3} IN E` +THEN SET_TAC[];(*3*) + +MRESA_TAC pos_in_aff_ge_fan [`x:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MP_TAC(SET_RULE`va IN aff_ge {x} {v, w1:real^3} /\ va IN aff_ge {x} {u, w} +==>va IN aff_ge {x} {u, w} INTER aff_ge {x} {v, w1:real^3} `) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPECL[`{(u:real^3),(w:real^3)}`;`{(v:real^3),(w1:real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] +THEN DISCH_TAC THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`~(v=u) /\ DISJOINT{x,v} {w} ==> ~(v IN {u,w:real^3}) `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(v IN {u,w:real^3})/\ ~(u=w)==> ~({u, w} INTER {v, w1} = {u, w:real^3})`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~({u, w} INTER {v, w1} = {u, w:real^3}) ==> {u, w} INTER {v, w1} PSUBSET {u, w} `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{u, w} INTER {v, w1} PSUBSET {u, w:real^3} ==> {u, w} INTER {v, w1} SUBSET {u}\/ {u, w} INTER {v, w1} SUBSET {w} `) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*4*)[ +MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v, w1:real^3}`; `{u:real^3}`][DISJOINT;SET_RULE`{x} INTER {u} = {}<=> ~(x=u:real^3)`] +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{u:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] +THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v, w1}) SUBSET aff_ge {x} {u}/\ aff_ge {x} {u} SUBSET aff {x, u}/\ va IN aff_ge {x} ({u, w} INTER {v, w1})==> va IN aff {x,u}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % u +<=> a % w = u' % x + (v''+a- &1) % u`] +THEN MP_TAC(REAL_ARITH`&0< a==> ~(a = &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`a % w = u' % x + (v' + a - &1) % u:real^3 ==> (inv (a))%(a % w ) = (inv (a))%( u' % x + (v' + a - &1) % u)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN `w IN aff {x,u:real^3}` ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`(inv a * u'):real` +THEN EXISTS_TAC`(inv a * (v' + a - &1)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv a * u' + inv a * (v' + a - &1) =inv a * ( a+ (u' + v') - &1)`;REAL_ARITH`A+ &1- &1=A`];(*5*) +POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `~(w IN aff {x, u:real^3})` +THEN SET_TAC[]](*5*);(*4*) + +FIND_ASSUM MP_TAC`{u,w:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`w:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v, w1:real^3}`; `{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {w} = {}<=> ~(x=w:real^3)`] +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{w:real^3}`][SET_RULE`{x} UNION {w}={x,w}`;GSYM aff] +THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v, w1}) SUBSET aff_ge {x} {w}/\ aff_ge {x} {w} SUBSET aff {x, w}/\ va IN aff_ge {x} ({u, w} INTER {v, w1})==> va IN aff {x,w}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % w +<=> (&1-a) % u = u' % x + (v''-a) % w`] +THEN MP_TAC(REAL_ARITH`a < &1==> ~(&1- a= &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`&1-a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(&1-a) % u = u' % x + (v' - a) % w:real^3 ==> (inv (&1-a))%((&1-a) % u ) = (inv (&1-a))%( u' % x + (v' - a) % w)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN `u IN aff {x,w:real^3}` ASSUME_TAC +THENL(*5*)[REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`(inv (&1-a) * u'):real` +THEN EXISTS_TAC`(inv (&1-a) * (v' - a)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1-a') * u' + inv (&1-a') * (v' - a') =inv (&1-a') * ( (u' + v') - a')`;];(*5*) + +POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `~(u IN aff {x, w:real^3})` +THEN SET_TAC[]](*5*)](*4*)](*3*);(*2*) + +EXISTS_TAC`&1` +THEN REWRITE_TAC[REAL_ARITH`&0< &1`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC`va=(&1-t)%u + t%w:real^3` +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`t:real`] +THEN MRESA_TAC inequality4_aim_in_convex_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`t:real`] +THEN ASM_REWRITE_TAC[rw_dart_fan;w_dart_fan] +THEN SUBGOAL_THEN`aff_gt {x} {v,va:real^3} SUBSET wedge x v u w1` ASSUME_TAC +THENL(*3*)[ +REWRITE_TAC[SUBSET; IN_ELIM_THM; wedge] +THEN GEN_TAC +THEN MRESAL_TAC aff_gt_inter_aff_gt [`(x:real^3)`;`(v:real^3)`;`(va:real^3)`][INTER;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESAL_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`va:real^3`;`x':real^3`][IN_ELIM_THM] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`; `x':real^3`;`va:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*3*) + +MP_TAC(SET_RULE`aff_gt {x} {v, va:real^3} SUBSET wedge x v u w1 ==> (wedge x v u w1 INTER rcone_fan x v (cos s)) INTER aff_gt {x} {v, va}=(rcone_fan x v (cos s)) INTER aff_gt {x} {v, va}`) +THEN RESA_TAC +THEN REWRITE_TAC[rcone_fan;INTER;IN_ELIM_THM] +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`;IN_ELIM_THM] +THEN DISJ_CASES_TAC(REAL_ARITH`(v - x) dot (va - x:real^3) <= &0 \/ &0< (v - x) dot (va - x)`) +THENL(*4*)[ +ABBREV_TAC`s1= s/ &2:real` +THEN MP_TAC(REAL_ARITH`&0< s /\ s< pi/ &2/\ s1= s/ &2 /\ &0< pi ==> &0<= s1 /\ s1< s /\ s <= pi/\ &0 REWRITE_TAC[SYM(th); REAL_ARITH`&1* &1= &1`]) +THEN RESA_TAC +THEN REDUCE_ARITH_TAC +THEN SUBGOAL_THEN`~(norm((v:real^3)-(x:real^3))= &0)` ASSUME_TAC +THENL(*5*)[ ASM_REWRITE_TAC[NORM_EQ_0;VECTOR_ARITH`v-x=vec 0<=> x=v`];(*5*) + +MP_TAC(ISPEC`norm((v:real^3)-(x:real^3))`REAL_MUL_LINV) +THEN REWRITE_TAC[REAL_ARITH`A*B*D *D=(B*D) *D *A`;REAL_ARITH`A>B<=> B &0< norm (v - x) `) +THEN RESA_TAC +THEN MATCH_MP_TAC COS_MONO_LT +THEN ASM_REWRITE_TAC[];(*6*) + +MRESA_TAC condition1_to_in_aff_gt_by_angle[`x:real^3`;`v:real^3`;`va:real^3`;`s1:real`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[e3_fan]](*6*)](*5*);(*4*) +SUBGOAL_THEN`&0<(atn ((norm ((v - x) cross (va - x))) * inv((v - x) dot (va - x))))` ASSUME_TAC +THENL(*5*)[ +MP_TAC(ISPEC`(v - x) dot (va - x:real^3)`REAL_LT_INV) +THEN RESA_TAC +THEN ASSUME_TAC(PI_WORKS) +THEN MP_TAC(REAL_ARITH`&0< pi ==> --(pi / &2) < &0`) +THEN RESA_TAC +THEN MRESAL_TAC ATN_MONO_LT[`&0:real`;` (norm ((v - x) cross (va - x)) * inv ((v - x) dot (va - x))):real`][ ATN_0] +THEN POP_ASSUM MATCH_MP_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`~(norm((v - x) cross (va - x:real^3))= &0)` ASSUME_TAC +THENL(*6*)[ASM_REWRITE_TAC[NORM_EQ_0] +THEN MP_TAC(ISPECL[`v-x:real^3`;`va-x:real^3`]CROSS_EQ_0) +THEN ONCE_REWRITE_TAC[GSYM COLLINEAR_3;] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`(v - x) cross (va - x:real^3)`NORM_POS_LE) +THEN REAL_ARITH_TAC];(*5*) + +ABBREV_TAC`s1= min (s:real) (atn ((norm ((v - x) cross (va - x))) * inv((v - x) dot (va - x)))) / &2` +THEN ASSUME_TAC(ISPEC`(norm ((v - x) cross (u - x)) * inv ((v - x) dot (u - x))):real`ATN_BOUNDS) +THEN MP_TAC(REAL_ARITH`&0< s /\ s< pi/ &2/\ s1= min (s:real) (atn ((norm ((v - x) cross (va - x))) * inv((v - x) dot (va - x)))) / &2 + /\ &0< pi /\ &0< (atn ((norm ((v - x) cross (va - x))) * inv((v - x) dot (va - x)))) +/\ (atn ((norm ((v - x) cross (va - x))) * inv((v - x) dot (va - x)))) < pi/ &2 +==> &0<= s1 /\ s1< s /\ s <= pi/\ &0 REWRITE_TAC[SYM(th); REAL_ARITH`&1* &1= &1`]) +THEN RESA_TAC +THEN REDUCE_ARITH_TAC +THEN SUBGOAL_THEN`~(norm((v:real^3)-(x:real^3))= &0)` ASSUME_TAC +THENL(*6*)[ASM_REWRITE_TAC[NORM_EQ_0;VECTOR_ARITH`v-x=vec 0<=> x=v`];(*6*) +MP_TAC(ISPEC`norm((v:real^3)-(x:real^3))`REAL_MUL_LINV) +THEN REWRITE_TAC[REAL_ARITH`A*B*D *D=(B*D) *D *A`;REAL_ARITH`A>B<=> B &0< norm (v - x) `) +THEN RESA_TAC +THEN MATCH_MP_TAC COS_MONO_LT +THEN ASM_REWRITE_TAC[]; +MRESA_TAC condition_to_in_aff_gt_by_angle[`x:real^3`;`v:real^3`;`va:real^3`;`s1:real`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[e3_fan]]]]]]]]);; + + + + + + + +let exists_point_inside_domain_cone_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 s:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0CARD (set_of_edge v V E) >1) +==> +(?y:real^3. y IN rw_dart_fan x V E ((x:real^3),(u:real^3),(w:real^3),(w2:real^3)) (cos(s)) /\ +azim x v u y< azim x v u w)`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "BE") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "BE" MP_TAC +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `u:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge u V E = {w} \/ ~(set_of_edge u V E = {w:real^3})`) +THENL(*1*)[ +MRESA_TAC CARD_SING[`w:real^3`; `(set_of_edge u V E):real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC;(*1*) + +MRESA_TAC not_empty_rw_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`; `w:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `s:real`) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`;rw_dart_fan;INTER; w_dart_fan;wedge;IN_ELIM_THM;] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x u w y< azim x u w v==> azim x u w y<= azim x u w (v:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`u:real^3`;`w:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN MP_TAC(REAL_ARITH`azim x u w y< azim x u w v/\ &0< azim x u w y/\ azim x u w v < pi /\ azim x u w v = azim x u w y + azim x u y v==> ~(azim x u y (v:real^3)= &0)/\ &0< azim x u y v/\ azim x u y v < pi/\ ~(azim x u y (v:real^3)= pi)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN REPEAT DISCH_TAC +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR[`x:real^3`;`v:real^3`;`y:real^3`;`u:real^3`] +THEN SUBGOAL_THEN`~(azim x v u (y:real^3)= &0)`ASSUME_TAC +THENL(*2*)[ +STRIP_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[];(*2*) + +SUBGOAL_THEN`~(azim x v u (y:real^3)= pi)`ASSUME_TAC +THENL(*3*)[ + +STRIP_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[];(*3*) + +MP_TAC(REAL_ARITH`~(azim x v u y=pi)==>pi< azim x v u y \/ azim x v u (y:real^3) < pi`) +THEN RESA_TAC +THENL(*4*)[ + +MRESA_TAC AZIM_COMPL[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN MRESA_TAC azim[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN MP_TAC(REAL_ARITH`pi< azim x v u y /\ azim x v u y < &2 * pi /\ azim x v y u = &2 * pi - azim x v u y +==> azim x v y u< pi/\ &0 REWRITE_TAC[SYM(th)]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`u:real^3`;`v:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;CROSS_TRIPLE;] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[DOT_LNEG] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*4*) + +DISJ_CASES_TAC(REAL_ARITH`azim x v u w <= azim x v u (y:real^3) \/ azim x v u y < azim x v u w`) +THENL(*5*)[ +ABBREV_TAC`a1=(v-x):real^3` +THEN ABBREV_TAC`a2=(y-x):real^3` +THEN ABBREV_TAC`a3=(u-x) :real^3` +THEN ABBREV_TAC`a4=w-x:real^3` +THEN ABBREV_TAC`va=a1 cross a4:real^3` +THEN ABBREV_TAC`vb=a2 cross a3:real^3` +THEN ABBREV_TAC`v3= (vb:real^3) cross (va:real^3)+(x:real^3)` +THEN ABBREV_TAC`v4= &1/ &2 % v3+ &1/ &2 % u:real^3` +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;CROSS_TRIPLE;] +THEN ONCE_REWRITE_TAC[CROSS_SKEW; ] +THEN ASM_REWRITE_TAC[DOT_LNEG] +THEN STRIP_TAC +THEN SUBGOAL_THEN `v3 IN aff_gt {x,u} {y:real^3}` ASSUME_TAC +THENL(*6*)[ +MRESA_TAC th3[`(x:real^3)` ;` (u:real^3)`;`(y:real^3) `;] +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`u:real^3`;`y:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&1-(va:real^3) dot (a2:real^3)+va dot (a3:real^3)` +THEN EXISTS_TAC`((va:real^3) dot (a2:real^3))` +THEN EXISTS_TAC`(--((va:real^3) dot (a3:real^3)))` +THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 - va dot a3 + va dot a2) + (va dot a3) + --(va dot a2) = &1`;VECTOR_ARITH`(&1-A+B)%X+ (A)%U+ (--B) %V=A%(U-X)- B%(V-X)+X`] +THEN EXPAND_TAC"v3" +THEN EXPAND_TAC"vb" +THEN ONCE_REWRITE_TAC[CROSS_SKEW; ] +THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_ARITH`--(A-B)+C=B-A+C:real^3`];(*6*) +SUBGOAL_THEN `(v4:real^3) IN aff_gt {x,u} {y:real^3}` ASSUME_TAC +THENL(*7*)[ +POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;` (u:real^3)`;`(y:real^3) `;] +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`u:real^3`;`y:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`&1/ &2 * t1:real` +THEN EXISTS_TAC`&1/ &2 * t2+ &1/ &2:real` +THEN EXISTS_TAC`&1/ &2*t3:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 / &2 * t1 + (&1 / &2 * t2 + &1 / &2) + &1 / &2 * t3 = &1/ &2*(t1+t2+t3)+ &1/ &2`; REAL_ARITH`&1/ &2 * &1 + &1/ &2= &1`;VECTOR_ARITH`(&1 / &2 * t1) % x + (&1 / &2 * t2 + &1 / &2) % u + (&1 / &2 * t3) % y= &1/ &2 %(t1 % x + t2 % u + t3 % y)+ &1/ &2 % u`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*7*) +MRESA_TAC aff_gt_imp_not_collinear[`x:real^3`;`y:real^3`;`u:real^3`; `v4:real^3`] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`w:real^3`; `v4:real^3`;`y:real^3`] +THEN EXISTS_TAC`v4:real^3` +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN `v3 IN aff_gt {x,v} {w:real^3}` ASSUME_TAC +THENL(*8*)[ + +MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(w:real^3) `;] +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&1-(vb:real^3) dot (a4:real^3)+vb dot (a1:real^3)` +THEN EXISTS_TAC`((vb:real^3) dot (a4:real^3))` +THEN EXISTS_TAC`(--((vb:real^3) dot (a1:real^3)))` +THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 - vb dot a4 + vb dot a1) + (vb dot a4) + --(vb dot a1) = &1`;VECTOR_ARITH`(&1-A+B)%X+ (A)%U+ (--B) %V=A%(U-X)- B%(V-X)+X`] +THEN EXPAND_TAC"v3" +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_ARITH`--(A-B)+C=B-A+C:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`;`y:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;CROSS_TRIPLE;] +THEN ONCE_REWRITE_TAC[CROSS_SKEW; ] +THEN ASM_REWRITE_TAC[DOT_LNEG] +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESA_TAC azim[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN FIND_ASSUM(MP_TAC)`~(azim x v u (y:real^3)= &0)` +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*8*) + +REMOVE_THEN "YEU EM"(fun th-> ASM_REWRITE_TAC[SYM(th)]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_imp_not_collinear[`x:real^3`;`w:real^3`;`v:real^3`; `v3:real^3`] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`; `v3:real^3`;`w:real^3`] +THEN SUBGOAL_THEN`~(coplanar{x,v,u,v3:real^3})`ASSUME_TAC +THENL(*9*)[ +STRIP_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`v3:real^3`] +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`];(*9*) + +SUBGOAL_THEN`~(azim x u v3 (v:real^3)= &0)`ASSUME_TAC +THENL(*10*)[ +POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR[`x:real^3`;`u:real^3`;`v3:real^3`;`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN ASM_REWRITE_TAC[];(*10*) +MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`v3:real^3`] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`v:real^3`; `v3:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;] +THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;] +THEN RESA_TAC +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`v3:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&2 * pi - azim x u y v = &2 * pi - azim x u v3 v==> azim x u v3 v= azim x u y v `) +THEN RESA_TAC +THEN MRESAL_TAC inequality4_aim_in_convex_fan[`x:real^3`;`v:real^3`;`u:real^3`;`v3:real^3`;`&1/ &2`][REAL_ARITH`&1- &1/ &2= &1/ &2/\ &0< &1/ &2 /\ &1/ &2< &1`;VECTOR_ARITH`A+B=B+A:real^3`] +THEN MATCH_MP_TAC conditions_in_rcone_fan +THEN EXISTS_TAC `y:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC th3[`(x:real^3)` ;` (u:real^3)`;`(y:real^3) `;] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`u:real^3`;`y:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&1/ &2 *(&1-(va:real^3) dot (a2:real^3)+va dot (a3:real^3))` +THEN EXISTS_TAC`&1/ &2 *((va:real^3) dot (a2:real^3))+ &1/ &2` +THEN EXISTS_TAC`&1/ &2 *(--((va:real^3) dot (a3:real^3)))` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 / &2 * t1 + (&1 / &2 * t2 + &1 / &2) + &1 / &2 * t3 = &1/ &2*(t1+t2+t3)+ &1/ &2`; REAL_ARITH`&1/ &2 * &1 + &1/ &2= &1`;VECTOR_ARITH`(&1 / &2 * t1) % x + (&1 / &2 * t2 + &1 / &2) % u + (&1 / &2 * t3) % y= &1/ &2 %(t1 % x + t2 % u + t3 % y)+ &1/ &2 % u`;REAL_ARITH`(&1 - va dot a3 + va dot a2) + (va dot a3) + --(va dot a2) = &1`;VECTOR_ARITH`(&1-A+B)%X+ (A)%U+ (--B) %V=A%(U-X)- B%(V-X)+X`] +THEN EXPAND_TAC"v4" +THEN EXPAND_TAC"v3" +THEN EXPAND_TAC"vb" +THEN ONCE_REWRITE_TAC[CROSS_SKEW; ] +THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_ARITH`--(A-B)+C=B-A+C:real^3`] +THEN MP_TAC(REAL_ARITH`&0< --(va dot (a3:real^3))==> &0 < &1 / &2 * --(va dot a3)`) +THEN RESA_TAC +THEN MATCH_MP_TAC(REAL_ARITH`&0<= (va dot (a2:real^3))==> &0 < &1 / &2 * (va dot a2)+ &1/ &2`) +THEN MRESA_TAC cross_dot_fully_surrounded_ge_fan[`x:real^3`;`v:real^3`;`y:real^3`;`w:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`y:real^3`] +THEN REWRITE_TAC[azim] +THEN MATCH_MP_TAC(REAL_ARITH`azim x v u y = azim x v u w + azim x v w y/\ &0<= azim x v u w /\ azim x v u y < pi ==>azim x v w y <= pi`) +THEN ASM_REWRITE_TAC[azim]](*10*)](*9*)](*8*)](*7*)](*6*);(*5*) +EXISTS_TAC`y:real^3` +THEN REMOVE_THEN "YEU EM" (fun th-> REWRITE_TAC[SYM(th)]) +THEN ASM_REWRITE_TAC[]]]]]]);; + + + + +let exists_cut_rcone_fan_with_edge_run_fan=prove( +`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 s:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0CARD (set_of_edge v V E) >1) +==> +(?t:real. &0< t /\ t< &1 /\ +~(rw_dart_fan x V E ((x:real^3),(u:real^3),(w:real^3),(sigma_fan x V E u w:real^3)) (cos(s)) INTER aff_gt {x} {v, (&1-t)%u+t%w}={}))`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "BE") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "BE" MP_TAC +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `u:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge u V E = {w} \/ ~(set_of_edge u V E = {w:real^3})`) +THENL[ +MRESA_TAC CARD_SING[`w:real^3`; `(set_of_edge u V E):real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; +MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN ASM_REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`;rw_dart_fan;INTER; w_dart_fan;wedge;IN_ELIM_THM;] +THEN MRESA_TAC inequality3_aim_in_convex_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;` w:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"NHO EM") +THEN MRESA_TAC exists_point_inside_domain_cone_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;`s:real`] +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[rw_dart_fan;INTER; w_dart_fan;wedge;IN_ELIM_THM;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x u w y< azim x u w v==> azim x u w y<= azim x u w (v:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`u:real^3`;`w:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN MP_TAC(REAL_ARITH`azim x u w y< azim x u w v/\ &0< azim x u w y/\ azim x u w v < pi /\ azim x u w v = azim x u w y + azim x u y v==> ~(azim x u y (v:real^3)= &0)/\ &0< azim x u y v/\ azim x u y v < pi/\ ~(azim x u y (v:real^3)= pi)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN REPEAT DISCH_TAC +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR[`x:real^3`;`v:real^3`;`y:real^3`;`u:real^3`] +THEN SUBGOAL_THEN`~(azim x v u (y:real^3)= &0)`ASSUME_TAC +THENL[STRIP_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[]; +MP_TAC(REAL_ARITH`&0<= azim x v u (y:real^3) /\ ~(azim x v u y= &0)==> &0< azim x v u y`) +THEN ASM_REWRITE_TAC[azim] THEN STRIP_TAC +THEN MRESA_TAC angle_is_smallpi_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN ABBREV_TAC`a1=(v-x):real^3` +THEN ABBREV_TAC`a2=(y-x):real^3` +THEN ABBREV_TAC`a3=(u-x) :real^3` +THEN ABBREV_TAC`a4=w-x:real^3` +THEN ABBREV_TAC`va=a2 cross a1:real^3` +THEN ABBREV_TAC`vb=a4 cross a3:real^3` +THEN ABBREV_TAC`v3=(va:real^3) cross (vb:real^3)+(x:real^3)` +THEN MRESA_TAC cut_in_angle_fan[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN DISCH_TAC +THEN MRESA_TAC scale_in_edges_fan[`(x:real^3)`;`(u:real^3)`;`(w:real^3)`;`(v3:real^3)`] +THEN EXISTS_TAC`t:real` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`y:real^3` +THEN REMOVE_THEN "YEU EM" (fun th-> REWRITE_TAC[SYM(th)]) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0 ~(t= &0)`) THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(a= &0)`) THEN RESA_TAC +THEN MRESA_TAC continuous_coplanar_fan [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `t:real`) +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`(&1 - t) % u + t % w:real^3`] +THEN MRESAL_TAC aff_gt_1_2_scale_fan[`x:real^3`;`v:real^3`;`v3:real^3`;`(&1 - t) % u + t % w:real^3`;`a:real`][VECTOR_ARITH`(&1 - t) % u + t % w - x = ((&1 - t) % u + t % w) - x`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN MRESAL_TAC COLLINEAR_SPECIAL_SCALE[`a:real`;`(v3 - x):real^3`;`v-x:real^3`][VECTOR_ARITH`(&1 - t) % u + t % w - x = ((&1 - t) % u + t % w) - x`] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"a1" +THEN ONCE_REWRITE_TAC[GSYM COLLINEAR_3] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,C,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;` (v3:real^3)`;`(v:real^3) `;] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v3:real^3`;`v:real^3`][IN_ELIM_THM;] +THEN EXPAND_TAC"v3" +THEN EXPAND_TAC"va" +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN REWRITE_TAC[CROSS_LAGRANGE;] +THEN MP_TAC(REAL_ARITH`azim x u w y < azim x u w v /\ azim x u w v< pi==> azim x u w y< pi`) +THEN RESA_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`u:real^3`;`y:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[DOT_LNEG] +THEN STRIP_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[DOT_LNEG] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0< --(vb dot (a1:real^3))==> ~(--(vb dot (a1:real^3))= &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV `(--(vb dot (a1:real^3)):real)` +THEN MRESA1_TAC REAL_LT_INV `(--(vb dot (a1:real^3)):real)` +THEN MRESA_TAC REAL_LT_MUL [`inv(--(vb dot (a1:real^3)):real)`;`--(vb dot (a2:real^3)):real`] +THEN EXISTS_TAC`&1- inv (--(vb dot (a1:real^3)))- inv (--(vb dot a1)) * --(vb dot a2)` +THEN EXISTS_TAC`inv (--(vb dot (a1:real^3)))` +THEN EXISTS_TAC`inv (--(vb dot a1)) * --(vb dot (a2:real^3))` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1- T1 -T2 +T1 +T2 = &1`;VECTOR_ARITH`A%(--(B%X-C%Y)+Z)=(A*(--B))%X-(A*(--C))%Y+A%Z:real^3`] +THEN EXPAND_TAC"a1" +THEN EXPAND_TAC"a2" +THEN VECTOR_ARITH_TAC]]);; + + + + + + + + + +let aff_gt_in_rw_dart_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 y:real^3 s:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0CARD (set_of_edge v V E) >1) +==> aff_gt {x} {u,y} SUBSET rw_dart_fan x V E ((x:real^3),(u:real^3),(w:real^3),(sigma_fan x V E u w:real^3)) (cos(s)) `, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "CON") +THEN DISCH_THEN(LABEL_TAC "BE") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "BE" MP_TAC +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `u:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge u V E = {w} \/ ~(set_of_edge u V E = {w:real^3})`) +THENL[MRESA_TAC CARD_SING[`w:real^3`; `(set_of_edge u V E):real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; +REMOVE_THEN "CON" MP_TAC +THEN ASM_REWRITE_TAC[rw_dart_fan;INTER; SUBSET; w_dart_fan;wedge;IN_ELIM_THM;] +THEN STRIP_TAC THEN GEN_TAC THEN STRIP_TAC +THEN MRESA_TAC aff_gt_inter_aff_gt [`(x:real^3)`;`(u:real^3)`;`(y:real^3)`] +THEN MP_TAC(SET_RULE`aff_gt {x} {u, y} = aff_gt {x, u} {y} INTER aff_gt {x, y} {u} +/\ x' IN aff_gt {x} {u, y:real^3} ==> x' IN aff_gt {x,u} {y}`) THEN RESA_TAC +THEN MRESA_TAC aff_gt_imp_not_collinear[`x:real^3`;`y:real^3`;`u:real^3`; `x':real^3`] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`w:real^3`;`x':real^3`;`y:real^3`;] +THEN MATCH_MP_TAC conditions_in_rcone_fan +THEN EXISTS_TAC`y:real^3` +THEN ASM_REWRITE_TAC[]]);; + + + + +let exists_rw_dart_inter_aff_gt1_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 s:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0CARD (set_of_edge v V E) >1) +==> +(?h:real. &0< h /\ +(!t:real. &0< t /\ t< h==> +~(rw_dart_fan x V E ((x:real^3),(u:real^3),(w:real^3),(sigma_fan x V E u w:real^3)) (cos(s)) INTER aff_gt {x} {v, (&1-t)%u+t%w}={}) +))`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "BE") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "BE" MP_TAC +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `u:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge u V E = {w} \/ ~(set_of_edge u V E = {w:real^3})`) +THENL[ MRESA_TAC CARD_SING[`w:real^3`; `(set_of_edge u V E):real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; +MRESA_TAC exists_cut_rcone_fan_with_edge_run_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;`u:real^3`;`w:real^3`;`s:real`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`;INTER;IN_ELIM_THM;] +THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"OK") THEN DISCH_TAC +THEN USE_THEN "OK" MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[rw_dart_fan;] +THEN ASM_REWRITE_TAC[INTER; w_dart_fan;wedge;IN_ELIM_THM;] +THEN STRIP_TAC +THEN EXISTS_TAC`t:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`vt= (&1 - t':real) % u + t' % w :real^3` +THEN ABBREV_TAC`a1=(v-x):real^3` +THEN ABBREV_TAC`a2=vt-x:real^3` +THEN ABBREV_TAC`a3=(y-x):real^3` +THEN ABBREV_TAC`a4=(u-x) :real^3` +THEN ABBREV_TAC`va=a1 cross a2:real^3` +THEN ABBREV_TAC`vb=a3 cross a4:real^3` +THEN ABBREV_TAC`v3=(vb:real^3) cross (va:real^3)+(x:real^3)` +THEN MP_TAC(REAL_ARITH`&0< t'/\ t'< t /\ t< &1==> ~(t'= &0) /\ t'< &1`) THEN RESA_TAC +THEN MRESA_TAC in_aff_gt_1_2[`x:real^3`;`u:real^3`;`w:real^3 `;`t':real`] +THEN MRESA_TAC aff_gt_inter_aff_gt [`(x:real^3)`;`(u:real^3)`;`(w:real^3)`] +THEN MP_TAC(SET_RULE`aff_gt {x} {u, w} = aff_gt {x, u} {w} INTER aff_gt {x, w} {u} +/\ vt IN aff_gt {x} {u, w:real^3} ==> vt IN aff_gt {x,u} {w}`) THEN RESA_TAC +THEN MRESA_TAC aff_gt_imp_not_collinear[`x:real^3`;`w:real^3`;`u:real^3`; `vt:real^3`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN ASM_REWRITE_TAC[DE_MORGAN_THM] THEN STRIP_TAC +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`v:real^3`;`vt:real^3`;`w:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;] +THEN RESA_TAC +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`v:real^3`;`vt:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN STRIP_TAC +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`y:real^3`;`vt:real^3`;`w:real^3`;] +THEN MP_TAC(REAL_ARITH`&0< azim x u w y /\ azim x u w y< azim x u w v /\ azim x u w v< pi==> +azim x u w y<= azim x u w v/\ ~(azim x u w y = &0 \/ azim x u w y= pi)`) THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`w:real^3`;`y:real^3`] +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`y:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`] +THEN ASM_REWRITE_TAC[DE_MORGAN_THM] THEN STRIP_TAC +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`y:real^3`;`w:real^3`] +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`y:real^3`;`vt:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN STRIP_TAC +THEN MRESA_TAC continuous_coplanar_fan [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `t':real`) +THEN MRESA_TAC cut_in_angle_fan[`x:real^3`;`v:real^3`;`u:real^3`;`vt:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN MRESA_TAC aff_gt_in_rw_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`y:real^3`;`s:real`] +THEN EXISTS_TAC`v3:real^3` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(SET_RULE`aff_gt {x} {u, y} SUBSET rw_dart_fan x V E (x,u,w,v) (cos s) +/\ v3 IN aff_gt {x} {u, y} ==> v3 IN rw_dart_fan x V E (x,u,w,v) (cos s)`) +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC cut_in_angle_fan[`x:real^3`;`y:real^3`;`v:real^3`;`u:real^3`;`vt:real^3`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[CROSS_LNEG;CROSS_RNEG] +THEN ONCE_REWRITE_TAC[GSYM CROSS_RNEG] +THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`u:real^3`;`w:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"NHO EM") +THEN MP_TAC(REAL_ARITH`azim x u w y< azim x u w v/\ &0< azim x u w y/\ azim x u w v < pi /\ azim x u w v = azim x u w y + azim x u y v==> ~(azim x u y (v:real^3)= &0 \/ azim x u y (v:real^3)= pi)`) +THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`u:real^3`;`v:real^3`;`y:real^3`] +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASM_REWRITE_TAC[DE_MORGAN_THM] THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0<=azim x v u y /\ ~(azim x v u y= &0)==> &0< azim x v u y`) +THEN ASM_REWRITE_TAC[azim] THEN RESA_TAC +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`vt:real^3`] +THEN MRESAL_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`vt:real^3`][DE_MORGAN_THM] +THEN MP_TAC(REAL_ARITH`&0<=azim x v u vt /\ ~(azim x v u vt= &0)==> &0< azim x v u vt`) +THEN ASM_REWRITE_TAC[azim] THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(t= &0)`) THEN RESA_TAC +THEN MRESA_TAC continuous_coplanar_fan [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `t:real`) +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`(&1-t) %u+ t%w:real^3`] +THEN MRESA_TAC aff_gt_inter_aff_gt [`(x:real^3)`;`(v:real^3)`;`((&1-t) %u+ t%w:real^3)`] +THEN MP_TAC(SET_RULE`aff_gt {x} {v, (&1-t) %u+ t%w} = aff_gt {x, v} {(&1-t) %u+ t%w} INTER aff_gt {x, (&1-t) %u+ t%w} {v} +/\ y IN aff_gt {x} {v, (&1-t) %u+ t%w:real^3} ==> y IN aff_gt {x,v} {(&1-t) %u+ t%w}`) THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`;`(&1-t) %u+ t%w:real^3`;] +THEN MRESA_TAC inequality4_aim_in_convex_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`t:real`] +THEN MRESA_TAC angle_is_smallpi_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MP_TAC(REAL_ARITH`azim x v u w< pi /\ azim x v u ((&1 - t) % u + t % w) < azim x v u w +==> azim x v u ((&1 - t) % u + t % w) < pi`) THEN RESA_TAC +THEN ABBREV_TAC`vs= (&1 - t:real) % u + t % w :real^3` +THEN MRESA_TAC in_aff_gt_1_2[`x:real^3`;`u:real^3`;`w:real^3 `;`t:real`] +THEN MP_TAC(SET_RULE`aff_gt {x} {u, w} = aff_gt {x, u} {w} INTER aff_gt {x, w} {u} +/\ vs IN aff_gt {x} {u, w:real^3} ==> vs IN aff_gt {x,u} {w}`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t:real` +THEN MRESA1_TAC REAL_LT_INV`t:real` +THEN MRESA_TAC REAL_LT_MUL[`inv t:real`;`t':real`] +THEN MRESA_TAC REAL_LT_LMUL[`inv t:real`;`t':real`;`t:real`] + +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`v:real^3`;`vs:real^3`;`w:real^3`;] +THEN REMOVE_THEN"NHO EM" MP_TAC +THEN DISCH_TAC THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`v:real^3`;`vs:real^3`] +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC inequality4_aim_in_convex_fan[`x:real^3`;`v:real^3`;`u:real^3`;`vs:real^3`;`inv (t) * t':real`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM(th)]) +THEN STRIP_TAC +THEN MATCH_MP_TAC(SET_RULE`azim x v u ((&1 - inv t * t') % u + (inv t * t') % vs) < azim x v u vs /\ +(&1 - inv t * t') % u + (inv t * t') % vs = vt ==> azim x v u vt < azim x v u vs`) +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"vs" +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - inv t * t') % u + (inv t * t') % ((&1 - t) % u + t % w) += (&1 - (inv t * t) * t') % u + ((inv t * t) *t') % w`;REAL_ARITH`&1* A=A`]]);; + + + + + +let there_exists_component_contain_aff_gt_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ fan80(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> + (?h:real. &0< h /\ (?y:real^3. + aff_gt {x} {v, (&1-h)%u+h%w} SUBSET connected_component (yfan(x,V,E)) y ))`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "BE") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "BE" MP_TAC +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `u:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN MRESA_TAC fan_run_in_small_is_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `h/ &2`) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0< h==> ~(h/ &2 = &0)/\ &0< h/ &2 /\ h/ &2 < h`) THEN RESA_TAC +THEN DISCH_TAC +THEN EXISTS_TAC`h/ &2 :real` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`&1/ &2 % v + &1/ &2 %((&1 - h / &2) % u + h / &2 % w:real^3)` +THEN MATCH_MP_TAC CONNECTED_COMPONENT_MAXIMAL +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC CONVEX_AFF_GT[`{x:real^3}`;`{v, (&1 - h / &2) % u + h / &2 % w:real^3}`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC continuous_coplanar_fan [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `h/ &2:real`) +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`(&1-h/ &2) %u+ h / &2 %w:real^3`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - h/ &2) % (u:real^3) + h / &2 % (w:real^3)`;] +THEN MRESAL_TAC in_aff_gt_1_2[`x:real^3`;`v:real^3`;`(&1 - h / &2) % u + h / &2 % w:real^3 `;`&1/ &2:real`] +[REAL_ARITH`&1/ &2 < &1 /\ &0< &1/ &2 `; REAL_ARITH`&1 - &1/ &2 = &1/ &2` ] +THEN MATCH_MP_TAC CONVEX_CONNECTED +THEN ASM_REWRITE_TAC[]);; + + + +let CONNECTED_COMPONENT_OF_SUBSET = prove + (`!s t x y. s SUBSET t /\ connected_component s x y + ==> connected_component t x y`, + REWRITE_TAC[connected_component] THEN SET_TAC[]);; + +let connected_component_of_faces_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +==> +dart_leads_into x V E v u = dart_leads_into x V E u w`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "BE") +THEN DISCH_THEN(LABEL_TAC"con") +THEN USE_THEN "con" MP_TAC +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC exists_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"ANH") +THEN MRESA_TAC exists_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;` w:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"YEU") +THEN ABBREV_TAC`h00= min h' (pi/ &2) / &2 :real` +THEN MP_TAC(REAL_ARITH`&0< h' /\ &0< pi /\ h00= min h' (pi/ &2) / &2 :real==> &0< h00 /\ h00 < pi / &2`) +THEN REWRITE_TAC[PI_WORKS] +THEN RESA_TAC +THEN MRESA_TAC exists_rw_dart_inter_aff_gt1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;` w:real^3`;`h00:real`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`] +THEN DISCH_THEN (LABEL_TAC"EM") +THEN MRESA_TAC exists_rw_dart_inter_aff_gt_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`] +THEN DISCH_THEN (LABEL_TAC"NHIEU") +THEN MRESA_TAC fan_run_in_small_is_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"HA") +THEN ABBREV_TAC`h1' = min h'' h''' / &2 :real` +THEN ABBREV_TAC`h1= min h1' h'''' / &2 :real` +THEN MP_TAC(REAL_ARITH`&0< h'' /\ &0 < h''' /\ h1'= min h'' h''' / &2 ==> &0< h1' /\ h1'< h'' /\ h1' < h'''`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0< h1'/\ h1'< h'' /\ h1' < h''' /\ &0 < h'''' /\ h1= min h1' h'''' / &2 ==> &0< h1 /\ h1< h'' /\ h1 < h''' /\ h1< h''''`) +THEN RESA_TAC +THEN ABBREV_TAC`h2= min h (pi/ &2) / &2 :real` +THEN MP_TAC(REAL_ARITH`&0< h /\ &0< pi /\ h2= min h (pi/ &2) / &2 :real==> &0< h2 /\ h2 < pi / &2`) +THEN REWRITE_TAC[PI_WORKS] +THEN RESA_TAC +THEN REMOVE_THEN "NHIEU" (fun th-> MRESAL1_TAC th `h1:real`[INTER;IN_ELIM_THM]) +THEN POP_ASSUM (fun th-> MRESA1_TAC th `h2:real`) +THEN MP_TAC(REAL_ARITH`&0< h2 /\ h2= min h (pi/ &2) / &2 :real==> h2 < h`) +THEN RESA_TAC +THEN USE_THEN "ANH" (fun th -> MP_TAC(ISPECL[`h2:real`;`y:real^3`]th)) +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"LAM") +THEN REMOVE_THEN "EM" (fun th-> MRESAL1_TAC th `h1:real`[INTER;IN_ELIM_THM]) +THEN MP_TAC(REAL_ARITH`&0< h00 /\ h00= min h' (pi/ &2) / &2 :real==> h00 < h'`) +THEN RESA_TAC +THEN USE_THEN "YEU" (fun th -> MP_TAC(ISPECL[`h00:real`;`y':real^3`]th)) +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN RESA_TAC +THEN SUBGOAL_THEN `U=U':real^3->bool` ASSUME_TAC +THENL[ +REMOVE_THEN "LAM" (fun th-> REWRITE_TAC[SYM(th)]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN REWRITE_TAC[CONNECTED_COMPONENT_EQ_EQ] +THEN MRESA_TAC CONVEX_AFF_GT[`{x:real^3}`;`{v, (&1 - h1) % u + h1 % w:real^3}`] +THEN MRESA_TAC CONVEX_CONNECTED[`aff_gt {x} {v, (&1 - h1) % u + h1 % w}:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONNECTED_IFF_CONNECTED_COMPONENT] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`y:real^3`;`y':real^3`]) +THEN REMOVE_THEN "HA" (fun th-> MRESA1_TAC th `h1:real`) +THEN MRESA_TAC CONNECTED_COMPONENT_OF_SUBSET[`aff_gt {x} {v, (&1 - h1) % u + h1 % w:real^3}:real^3-> bool`;`yfan (x:real^3,(V:real^3->bool),(E:(real^3->bool)->bool)):real^3->bool`;`y:real^3`;`y':real^3`] +THEN ASM_TAC THEN SET_TAC[]; +SUBGOAL_THEN`dart_leads_into x V E v u= U:real^3->bool` ASSUME_TAC +THENL[ +REMOVE_ASSUM_TAC +THEN MATCH_MP_TAC unique_dart_leads_into +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`h:real` +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`dart_leads_into x V E u w= U':real^3->bool` ASSUME_TAC +THENL[ MATCH_MP_TAC unique_dart_leads_into +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`h':real` +THEN ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[]]]]);; + + + + +(************************) + +let dart_leads_into1 = new_definition + `dart_leads_into1 (x,V,E) (v,u) = @s. s IN topological_component_yfan (x,V,E) /\ + (?eps. (eps < &1) /\ + rw_dart_fan x V E (x,v,u,sigma_fan x V E v u) eps SUBSET s)`;; + + +let dartset_leads_into = new_definition + `dartset_leads_into (x,V,E) ds = + @s. (!y. (y IN ds) ==> (s = dart_leads_into1 (x,V,E) y))`;; + + + +let exists_dartset_leads_into_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> +?s:real^3->bool. !y. y IN ds==> s= dart_leads_into x V E (pr2 y) (pr3 y)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`dart_leads_into x V E (pr2 x') (pr3 x'):real^3->bool` +THEN ASM_REWRITE_TAC[orbit_map;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(x' IN d1_fan (x,V,E) )\/ (x' IN d1_fan (x:real^3,V,E))`) +THENL[MRESA_TAC id_power_enf_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`x':real^3#real^3#real^3#real^3` ;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]; +SPEC_TAC (`y:real^3#real^3#real^3#real^3`,`y:real^3#real^3#real^3#real^3`) +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC +THENL[ +REWRITE_TAC[POWER_0;I_THM] +THEN SET_TAC[]; + +POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':real^3#real^3#real^3#real^3` ) +THEN ABBREV_TAC`y1=(f1_fan x V E POWER n) (x':real^3#real^3#real^3#real^3)` +THEN DISCH_THEN(LABEL_TAC "EM") +THEN ASM_REWRITE_TAC[COM_POWER;o_DEF] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`y1:real^3#real^3#real^3#real^3`[ARITH_RULE`(n:num)>= 0`]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`n:num`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x':real^3#real^3#real^3#real^3`) +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`y:real^3#real^3#real^3#real^3`; `y1:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"EM") THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`u=pr2 (f1_fan x V E y1):real^3` +THEN ABBREV_TAC`w=pr3 (f1_fan x V E y1):real^3` +THEN ABBREV_TAC`v=sigma_fan x V E u w:real^3` +THEN REMOVE_THEN "EM" MP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC connected_component_of_faces_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`]]]);; + + + + +let dartset_leads_into_fan = new_definition + `dartset_leads_into_fan x V E ds = + @s. (!y. (y IN ds) ==> (s = dart_leads_into x V E (pr2 y) (pr3 y)))`;; + + + +let DARTSET_LEADS_INTO_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> +(!y. y IN ds==> dartset_leads_into_fan x V E ds= dart_leads_into x V E (pr2 y) (pr3 y))`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[dartset_leads_into_fan] +THEN MRESA_TAC exists_dartset_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`] +THEN SELECT_ELIM_TAC +THEN EXISTS_TAC`s:real^3->bool` + THEN ASM_REWRITE_TAC[]);; + + + + + + + + +let UNIQUE_DARTSET_LEADS_INTO_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds s. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ (!y. y IN ds==> s= dart_leads_into x V E (pr2 y) (pr3 y)) +==> dartset_leads_into_fan x V E ds= s`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC FACE_FAN_NOT_EMPTY[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`] +THEN STRIP_TAC +THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`));; + + + + +let equality_dart_leads_into=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y y1. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ y IN ds /\ y1 IN ds + +==>dart_leads_into x V E (pr2 y) (pr3 y)= dart_leads_into x V E (pr2 y1) (pr3 y1)`, +REPEAT STRIP_TAC +THEN MRESA_TAC exists_dartset_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3` THEN ASSUME_TAC(th)) +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y1:real^3#real^3#real^3#real^3`));; + + +let UNIQUE_DARTSET_LEADS_INTO1_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds s. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ y IN ds /\ s= dart_leads_into x V E (pr2 y) (pr3 y) +==> dartset_leads_into_fan x V E ds= s`, +REPEAT STRIP_TAC +THEN SUBGOAL_THEN`(!y. y IN ds==> s= dart_leads_into (x:real^3) V E (pr2 y) (pr3 y))` ASSUME_TAC +THENL[REPEAT STRIP_TAC +THEN MRESA_TAC equality_dart_leads_into[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`;`y':real^3#real^3#real^3#real^3`]; +MRESA_TAC UNIQUE_DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`s:real^3->bool`]]);; + + +let exists_point_dart_leads_into_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> ?y. y IN ds /\ dartset_leads_into_fan x V E ds =dart_leads_into x V E (pr2 y) (pr3 y)`, + +REPEAT STRIP_TAC +THEN MRESA_TAC FACE_FAN_NOT_EMPTY[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`] +THEN STRIP_TAC +THEN EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC UNIQUE_DARTSET_LEADS_INTO1_FAN [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(dart_leads_into x V E (pr2 y) (pr3 y)):real^3->bool`]);; + + + + + + +let dartset_leads_into_is_topological_component_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> dartset_leads_into_fan x V E ds IN topological_component_yfan (x,V,E)`, +REPEAT STRIP_TAC +THEN MRESA_TAC exists_point_dart_leads_into_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;] +THEN MRESA_TAC properties_of_elements_in_face_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC dart_leads_into_fan_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`pr2(y):real^3`; `pr3(y):real^3`]);; + + +let dartset_leads_into_subset_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds:real^3#real^3#real^3#real^3->bool. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> +dartset_leads_into_fan x V E ds SUBSET yfan (x,V,E)`, +REPEAT STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[CONNECTED_COMPONENT_SUBSET]);; + + + + +let RWXUYZZ=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds:real^3#real^3#real^3#real^3->bool. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> +(?s:real^3->bool. !y. y IN ds==> s= dart_leads_into x V E (pr2 y) (pr3 y)) +/\ dartset_leads_into_fan x V E ds IN topological_component_yfan (x,V,E)`, +MESON_TAC[dartset_leads_into_is_topological_component_yfan;exists_dartset_leads_into_fan]);; + + + + +end;; + + diff --git a/legacy/oldfan/TACTIC.hl b/legacy/oldfan/TACTIC.hl new file mode 100644 index 0000000..408dcf6 --- /dev/null +++ b/legacy/oldfan/TACTIC.hl @@ -0,0 +1,37 @@ +module Tactic_fan = struct + + +(* ========================================================================== *) +(* TAC_TIC *) +(* ========================================================================== *) + + + +let ASM_TAC=REPEAT(POP_ASSUM MP_TAC);; +let RED_TAC=ASM_REWRITE_TAC[] THEN DISCH_TAC;; +let RES_TAC=ASM_REWRITE_TAC[] THEN STRIP_TAC;; +let REDA_TAC=ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[];; +let RESA_TAC=ASM_REWRITE_TAC[] THEN STRIP_TAC THEN ASM_REWRITE_TAC[];; +let REDAL_TAC (th: thm list) =ASM_REWRITE_TAC th THEN DISCH_TAC THEN ASM_REWRITE_TAC th;; +let RESAL_TAC (th: thm list) = ASM_REWRITE_TAC th THEN STRIP_TAC THEN ASM_REWRITE_TAC th;; +let REMOVE_ASSUM_TAC=POP_ASSUM(fun th-> REWRITE_TAC[]);; +let SYM_ASSUM_TAC=POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]);; +let SYM_ASSUM1_TAC=POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]THEN ASSUME_TAC(th));; +let RESP_TAC=ASM_REWRITE_TAC[] THEN STRIP_TAC THEN POP_ASSUM(fun th->REWRITE_TAC[th]);; +let RESPL_TAC (th: thm list) =ASM_REWRITE_TAC th THEN STRIP_TAC THEN POP_ASSUM(fun th->REWRITE_TAC [th]);; +let REDUCE_ARITH_TAC=REWRITE_TAC[REAL_ARITH`&0 * a= &0`; REAL_ARITH`a * &0 = &0`; REAL_ARITH`a + &0 = a`; +REAL_ARITH`a- &0 =a`;REAL_ARITH`&0 +a =a`;REAL_ARITH`&1 * a =a`;REAL_ARITH`a * &1 =a`;REAL_ARITH`(A+B)-B=A`];; +let REDUCE_VECTOR_TAC=REWRITE_TAC[VECTOR_ARITH`&0 % a= vec 0`; VECTOR_ARITH`a % vec 0= vec 0`;VECTOR_ARITH`a + vec 0 = a`; +VECTOR_ARITH`vec 0 +a =a`; VECTOR_ARITH`a- vec 0 =a`;VECTOR_ARITH`&1 % a =a`;VECTOR_ARITH`a- b =vec 0<=> a=b`];; + +let MRESA_TAC th1 (th: term list) = MP_TAC(ISPECL th th1) THEN RESA_TAC;; +let MRESA1_TAC th1 th = MP_TAC(ISPEC th th1) THEN RESA_TAC;; + +let MRESAL_TAC th1 (th: term list) (th2: thm list) =MP_TAC(ISPECL th th1) THEN ASM_REWRITE_TAC th2 THEN STRIP_TAC THEN ASM_REWRITE_TAC th2;; + +let MRESAL1_TAC th1 th (th2: thm list) =MP_TAC(ISPEC th th1) THEN ASM_REWRITE_TAC th2 THEN STRIP_TAC THEN ASM_REWRITE_TAC th2;; + +let ASM_SET_TAC l = + (TRY(POP_ASSUM_LIST(MP_TAC o end_itlist CONJ))) THEN SET_TAC l;; + +end;; diff --git a/legacy/oldfan/ULEKUUB.hl b/legacy/oldfan/ULEKUUB.hl new file mode 100755 index 0000000..f540229 --- /dev/null +++ b/legacy/oldfan/ULEKUUB.hl @@ -0,0 +1,371 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + +(*flyspeck_needs "general/sphere.hl";; +flyspeck_needs "fan/introduction.hl";;*) + + +module Azim_node = struct + + + +open Sphere;; +open Fan_defs;; +open Tactic_fan;; +open Lemma_fan;; +open Hypermap;; +open Fan;; +open Hypermap_of_fan;; +open Node_fan;; + + + + + +(*let lemma62=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 w:real^3 w1:real^3. +a IN a_node_fan x V E (x,v,w,w1)==>(?n. a=(x,v,(power_map_points sigma_fan x V E v w n),(power_map_points sigma_fan x V E v w (SUC n))))`, +REWRITE_TAC[a_node_fan; IN_ELIM_THM; ] THEN REWRITE_TAC[node_fan] THEN REWRITE_TAC[power_n_fan]);;*) + +(* local definitions *) + +let complement_set= new_definition`complement_set {x:real^3, v:real^3} = {y:real^3| ~(y IN aff {x,v})} `;; + +let subset_aff=prove(`!x:real^3 v:real^3. (aff{x, v} SUBSET (UNIV:real^3->bool))`, REPEAT GEN_TAC THEN SET_TAC[]);; + + + +let union_aff=prove(`!x v:real^3. (UNIV:real^3->bool) = aff{x, v} UNION complement_set {x, v} `, +REPEAT GEN_TAC THEN REWRITE_TAC[complement_set] THEN SET_TAC[]);; + + + + + + + + +(*---------------------------------------------------------------*) +(* the properties of if_azims_fan *) +(*---------------------------------------------------------------*) + + + + +(* azim pf powers of node map *) + +let if_azims_fan= new_definition` +if_azims_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) + = if i = CARD(set_of_edge v V E) + then &2 * pi + else azim x v u (power_map_points sigma_fan x V E v u i)`;; + +let if_azims_works_fan=prove( +`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num). +( &0 <= if_azims_fan x V E v u i) /\ if_azims_fan x V E v u i <= &2 * pi`, +REPEAT GEN_TAC THEN REWRITE_TAC[REAL_ARITH `(a:real) <= (b:real) <=> (b >= a)`; if_azims_fan; azim;COND_ELIM_THM] + THEN MP_TAC(ISPECL [`x:real^3`; `v:real^3`; `u:real^3`; +`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`]azim) + THEN STRIP_TAC + THEN ASSUME_TAC(PI_WORKS) THEN ASM_REWRITE_TAC[] + THEN REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC);; + + + + + +let MONO_AZIM_POWER_SIGMA_FAN=prove(`! (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num). +FAN(x,V,E) /\ ({v,u} IN E) /\ ~(power_map_points (sigma_fan) x V E v u (SUC i) = u) +==> azim x v u (power_map_points (sigma_fan) x V E v u i)<= azim x v u (power_map_points (sigma_fan) x V E v u (SUC i)) +`, +REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT(POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"1") +THEN USE_THEN "1" MP_TAC THEN REWRITE_TAC[FAN;fan6; power_map_points] +THEN REPEAT STRIP_TAC +THEN REPEAT(POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"1") THEN REPEAT STRIP_TAC + THEN MP_TAC (ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (u:real^3)`]properties_of_set_of_edge) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(i:num)`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]image_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC (ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`power_map_points (sigma_fan)(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`]properties_of_set_of_edge) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;`power_map_points (sigma_fan)(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`]MONO_AZIM_SIGMA_FAN) THEN ASM_REWRITE_TAC[]);; + + + + + +let SUM_IF_AZIMS_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num). +FAN(x,V,E) /\ ({v,u} IN E) +/\(0 + if_azims_fan x V E v u (SUC i)= if_azims_fan x V E v u i + azim x v ((power_map_points sigma_fan x V E v u i)) (power_map_points sigma_fan x V E v u (SUC i))`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"a") THEN USE_THEN "a" MP_TAC + THEN REWRITE_TAC[FAN;fan6] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "b") + THEN REPEAT STRIP_TAC +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` (u:real^3)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`(i:num)`; `(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] image_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`SUC(i:num)`; `(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] image_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (SUC(i:num))`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN SUBGOAL_THEN `~((i:num)=CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))` ASSUME_TAC +THENL(*1*)[ +REPEAT(POP_ASSUM MP_TAC) THEN ARITH_TAC;(*1*) + +DISJ_CASES_TAC(ARITH_RULE ` SUC (i:num)= CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) \/ ~(SUC i=CARD(set_of_edge v V E))`) +THENL(*2*)[ + +MP_TAC(ISPECL[`SUC (i:num)`; `(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]ORDER_POWER_SIGMA_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +REWRITE_TAC[if_azims_fan] THEN ASM_REWRITE_TAC[] THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) + THEN REMOVE_THEN "b" (fun th->MP_TAC (ISPEC`{(v:real^3),(u:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))}`th) THEN ASSUME_TAC(th)) + THEN REWRITE_TAC[SET_RULE`{(a:real^3)} UNION {b,c}={a,b,c}`] THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN DISCH_TAC THEN +DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (u:real^3) (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))= &0) \/ ~(azim (x:real^3) (v:real^3) (u:real^3) (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) = &0)`) +THENL(*3*)[ + +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`; ` (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))` ]UNIQUE_AZIM_0_POINT_FAN) + THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`i:num`;`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] key_lemma_cyclic_fan) + THEN ASM_REWRITE_TAC[] THEN ASM_SET_TAC[];(*3*) + + MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`;` (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))`]AZIM_COMPL) THEN +ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC];(*2*) + +ASM_REWRITE_TAC[if_azims_fan] THEN MP_TAC(ARITH_RULE`i:num < CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) /\ ~(SUC(i) = CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))==> SUC(i)bool) (E:(real^3->bool)->bool))`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASSUME_TAC(ARITH_RULE`0bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] key_lemma_cyclic_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;`i:num`]MONO_AZIM_POWER_SIGMA_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN SUBGOAL_THEN `{(u:real^3),power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num),power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (SUC(i:num))} SUBSET set_of_edge v V E` ASSUME_TAC +THENL(*3*)[ +ASM_SET_TAC[];(*3*) + +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (u:real^3)`;` (v:real^3)`]properties_of_graph) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`]CYCLIC_SET_EDGE_FAN) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;`{(u:real^3),power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num),power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (SUC(i:num))}`;`set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)` ]subset_cyclic_set_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`;`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (SUC(i:num))`]sum2_azim_fan) THEN ASM_REWRITE_TAC[]]]]);; + +let azim_i_fan=new_definition` +azim_i_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) += azim x v (power_map_points sigma_fan x V E v u i) (power_map_points sigma_fan x V E v u (SUC i))`;; + + + + +let SUM_EQ_IF_AZIMS_FAN=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ ({v,u} IN E) +/\ ~(set_of_edge v V E ={u}) +/\ ~(1=CARD(set_of_edge v V E )) +/\ (i< CARD(set_of_edge v V E)) +==> +sum (0..i) (azim_i_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) += if_azims_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (SUC i)`, + + +INDUCT_TAC +THENL[ +REPEAT STRIP_TAC THEN +ASM_REWRITE_TAC[SUM_CLAUSES_NUMSEG;azim_i_fan;power_map_points;if_azims_fan; ARITH_RULE`SUC 0=1`]; + +POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "a") +THEN REPEAT STRIP_TAC +THEN +ASSUME_TAC(ARITH_RULE`0<= SUC (i:num)`)THEN ASSUME_TAC(ARITH_RULE`0< SUC (i:num)`) THEN +MP_TAC(ARITH_RULE`SUC (i:num)bool) (E:(real^3->bool)->bool))==> i< CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))`) THEN +ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +ASM_REWRITE_TAC[SUM_CLAUSES_NUMSEG] + THEN REMOVE_THEN"a"(fun th-> MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]th)) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool) `;`(v:real^3) `;`(u:real^3)`;` (SUC(i:num))`]SUM_IF_AZIMS_FAN) + THEN ASM_REWRITE_TAC[azim_i_fan] THEN REAL_ARITH_TAC]);; + + + + + +let SUM_AZIMS_EQ_2PI_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ ({v,u} IN E) +/\ ~(set_of_edge v V E ={u}) +/\ (1 +sum (0..(CARD(set_of_edge v V E )-1)) (azim_i_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) += &2 *pi`, +REPEAT STRIP_TAC THEN +MP_TAC(ARITH_RULE`(1 CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))-1 < CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ARITH_RULE`(1 ~(1=CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ARITH_RULE`(1 SUC(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))-1)= CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))-1`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]SUM_EQ_IF_AZIMS_FAN) + THEN ASM_REWRITE_TAC[if_azims_fan]);; + + +let AZIM_LE_POWER_SIGMA_FAN=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (j:num). +FAN(x,V,E) /\ ({v,u} IN E) +/\ ~(set_of_edge v V E ={u}) +/\ (j + azim x v u (power_map_points sigma_fan x V E v u j) < azim x v u (power_map_points sigma_fan x V E v u i)`, +INDUCT_TAC +THENL(*1*)[ +ARITH_TAC;(*1*) + +REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_THEN(LABEL_TAC"1") THEN DISCH_THEN (LABEL_TAC"a") THEN USE_THEN "a" MP_TAC + THEN REWRITE_TAC[FAN;fan6] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "b") + THEN REPEAT STRIP_TAC +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` (u:real^3)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`(i:num)`; `(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] image_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`SUC(i:num)`; `(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] image_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (SUC(i:num))`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + + +THEN ASSUME_TAC(ARITH_RULE`i< SUC(i:num)`) THEN ASSUME_TAC(ARITH_RULE`0< SUC(i:num)`) + THEN MP_TAC(ARITH_RULE`SUC(i)< CARD(set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))==> i< CARD(set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`SUC(i:num)`;`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] key_lemma_cyclic_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;`i:num`]MONO_AZIM_POWER_SIGMA_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + +THEN DISJ_CASES_TAC(ARITH_RULE `(j:num)< (i:num) \/ (i <= j)`) +THENL[ +REMOVE_THEN "1" (fun th-> MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`; `(j:num)`] th)) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; + +MP_TAC(ARITH_RULE`(j:num) < SUC(i:num) ==> j <= i`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ARITH_RULE` (j:num) <= (i:num) /\ i<= j==> j=i`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] + THEN SUBGOAL_THEN`~(azim x v u (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) ((i:num))) = azim x v u (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (SUC(i:num))))` ASSUME_TAC +THENL[ +STRIP_TAC THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;`u:real^3`;` power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`;` power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (SUC(i:num))`]UNIQUE_AZIM_POINT_FAN) +THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`(i:num)`;`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]MONO_POWER_MAP_POINTS1_FAN) + THEN ASM_REWRITE_TAC[]; + +REPEAT(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC]]]);; + + + + +let SUM_AZIM_POWER_SIGMA_FAN=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (j:num). +FAN(x,V,E) /\ ({v,u} IN E) +/\ ~(set_of_edge v V E ={u}) +/\ (j + azim x v u (power_map_points sigma_fan x V E v u i)= azim x v u (power_map_points sigma_fan x V E v u j) + azim x v (power_map_points sigma_fan x V E v u j) (power_map_points sigma_fan x V E v u i)`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"a") THEN USE_THEN "a" MP_TAC + THEN REWRITE_TAC[FAN;fan6] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "b") + THEN REPEAT STRIP_TAC +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` (u:real^3)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`(i:num)`; `(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] image_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`(j:num)`; `(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] image_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN + MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) ((j:num))`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + + THEN SUBGOAL_THEN `{(u:real^3),power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (j:num),power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) ((i:num))} SUBSET set_of_edge v V E` ASSUME_TAC +THENL[ASM_SET_TAC[]; + +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (u:real^3)`;` (v:real^3)`]properties_of_graph) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`]CYCLIC_SET_EDGE_FAN) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;`{(u:real^3),power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (j:num),power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) ((i:num))}`;`set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)` ]subset_cyclic_set_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`(i:num)`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;` (j:num)`] +AZIM_LE_POWER_SIGMA_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + +MP_TAC(REAL_ARITH`(azim x v u (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) ((j:num))) < azim x v u (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) ((i:num))))==>(azim x v u (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) ((j:num))) <= azim x v u (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) ((i:num))))`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (j:num)`;`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) ((i:num))`]sum2_azim_fan) THEN ASM_REWRITE_TAC[]]);; + + + + + + +let SUM1_IFAZIMS_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) (j:num). +FAN(x,V,E) /\ ({v,u} IN E) +/\ ~(set_of_edge v V E ={u}) +/\ (j + if_azims_fan x V E v u i= if_azims_fan x V E v u j + azim x v ((power_map_points sigma_fan x V E v u j)) (power_map_points sigma_fan x V E v u i)`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`(i:num) < CARD(set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))==> ~(i=CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ARITH_RULE`(j:num) < i /\(i:num) < CARD(set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))==> ~(j=CARD(set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN +ASM_REWRITE_TAC[if_azims_fan] +THEN +ASM_MESON_TAC[SUM_AZIM_POWER_SIGMA_FAN]);; + + + + + +let ULEKUUB=prove(`(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) (j:num). +FAN(x,V,E) /\ ({v,u} IN E) +/\ ~(set_of_edge v V E ={u}) +/\ (j + if_azims_fan x V E v u i= if_azims_fan x V E v u j + azim x v ((power_map_points sigma_fan x V E v u j)) (power_map_points sigma_fan x V E v u i)) +/\ + +(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ ({v,u} IN E) +/\ ~(set_of_edge v V E ={u}) +/\ (1 +sum (0..(CARD(set_of_edge v V E )-1)) (azim_i_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) += &2 *pi) +`, +MESON_TAC[SUM1_IFAZIMS_FAN; SUM_AZIMS_EQ_2PI_FAN]);; + + + + + + +end;; diff --git a/legacy/oldfan/VBTIKLP.hl b/legacy/oldfan/VBTIKLP.hl new file mode 100755 index 0000000..4789f59 --- /dev/null +++ b/legacy/oldfan/VBTIKLP.hl @@ -0,0 +1,1025 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + + +module Sum_azim_node = struct + + + + +open Sphere;; +open Fan_defs;; +open Hypermap_of_fan;; +open Tactic_fan;; +open Lemma_fan;; +open Fan;; +open Hypermap_of_fan;; +open Node_fan;; +open Azim_node;; + + + +(* ========================================================================== *) +(* UNIONS IN NODE OF FAN *) +(* ========================================================================== *) + + +(*wedge2_fan=aff_gt*) + + +let lemma_disjiont_exists_fan2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 n:num. + ~(v=x) /\ ~(u=x) /\ (~(collinear {x, v, u})) /\ {v,u} IN E /\ (v IN V) /\ (u IN V) /\ fan (x,V,E) + ==> if_azims_fan x V E v u (0) = &0`, +REPEAT GEN_TAC THEN REWRITE_TAC[fan;fan1] THEN STRIP_TAC + THEN MP_TAC(ISPECL [`v:real^3`; `(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]remark_finite_fan1) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN SUBGOAL_THEN `(u:real^3) IN set_of_edge (v:real^3) (V:real^3->bool)(E:(real^3->bool)->bool)` ASSUME_TAC + THENL[ + REWRITE_TAC[set_of_edge; IN_ELIM_THM] THEN ASM_REWRITE_TAC[]; + SUBGOAL_THEN ` ~( 0 = CARD (set_of_edge (v:real^3) (V:real^3->bool)(E:((real^3)->bool)->bool))) ` ASSUME_TAC + THENL[ + STRIP_TAC + THEN MP_TAC(ISPEC `set_of_edge (v:real^3) (V:real^3->bool) (E:((real^3)->bool)->bool)`CARD_EQ_0) + THEN ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]; + SUBGOAL_THEN `azim (x:real^3) (v:real^3) (u:real^3) (u:real^3)= &0` ASSUME_TAC + THENL[ + ASM_MESON_TAC[ AZIM_REFL]; + REWRITE_TAC[if_azims_fan; power_map_points;azim;] THEN ASM_REWRITE_TAC[]]]]);; + + + + + + +let lemma_disjiont_exists_fan3=prove( +`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 y:real^3 n:num. + ~(v=x) /\ ~(u=x) /\ (~(collinear {x, v, u})) /\ {v,u} IN E /\ (v IN V) /\ (u IN V) /\ fan (x,V,E) + ==> (if_azims_fan x V E v u 0 <= azim x v u y)`, +REPEAT GEN_TAC THEN STRIP_TAC + THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3`; `y:real^3`] azim) + THEN STRIP_TAC + THEN MP_TAC(ISPECL[`x:real^3` ; `(V:real^3->bool)`; `(E:(real^3->bool)->bool)` ;`v:real^3` ;`u:real^3`; `n:num`]lemma_disjiont_exists_fan2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[azim]);; + + +let wedge2_fan=new_definition`wedge2_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) = +{y:real^3 | ( if_azims_fan x V E v u i = azim x v u y)/\ ( y IN complement_set {x, v})}`;; + + + +let aff_gt_subset_wedge_fan2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 i:num. + ~(i= CARD (set_of_edge v V E)) +/\ ~collinear {x,v,u} /\ ~collinear {x,v, power_map_points sigma_fan x V E v u i} +==> + aff_gt {x , v} {power_map_points sigma_fan x V E v u i} SUBSET wedge2_fan x V E v u i `, + +REWRITE_TAC[SUBSET] THEN REPEAT GEN_TAC THEN +ASSUME_TAC(affine_hull_2_fan) +THEN STRIP_TAC THEN ASSUME_TAC(th3) +THEN POP_ASSUM (MP_TAC o ISPECL [`x:real^3`;`v:real^3`;`(power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))`]) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN ASSUME_TAC(AFF_GT_2_1) + THEN POP_ASSUM (MP_TAC o ISPECL [`x:real^3`;`v:real^3`;`(power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))`]) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] +THEN GEN_TAC THEN REWRITE_TAC[wedge2_fan; IN_ELIM_THM; LEFT_IMP_EXISTS_THM] THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN SUBGOAL_THEN `~((t3:real) = &0)` ASSUME_TAC +THENL + [REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; +ASSUME_TAC(th1) +THEN POP_ASSUM( MP_TAC o ISPECL[`x:real^3`;` v:real^3`;` u:real^3`;` power_map_points sigma_fan x V E v u i` ;`t1:real` ;`t2:real` ;`t3:real`]) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +SUBGOAL_THEN `t1 % x + t2 % v + t3 % power_map_points sigma_fan x V E v u i IN + complement_set {x, v}` ASSUME_TAC +THENL + [ASM_MESON_TAC[COMPLEMENT_SET_FAN]; +ASM_REWRITE_TAC[] THEN REWRITE_TAC[if_azims_fan;] +THEN ASM_MESON_TAC[REAL_ARITH`((t3:real)> &0) <=> (&0 < t3)`]]]);; + + + +let wedge_fan2_subset_aff_gt=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 i:num. + ~collinear {x,v,u} /\ ~collinear {x, v, power_map_points sigma_fan x V E v u i} +/\ ~(i= CARD (set_of_edge v V E)) +==> +wedge2_fan x V E v u i SUBSET aff_gt {x , v} {power_map_points sigma_fan x V E v u i}`, +REPEAT GEN_TAC THEN +ASSUME_TAC(affine_hull_2_fan) THEN +STRIP_TAC THEN ASSUME_TAC(th3) +THEN POP_ASSUM (MP_TAC o ISPECL [`x:real^3`;`v:real^3`;`(power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))`]) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN ASSUME_TAC(AFF_GT_2_1) + THEN POP_ASSUM (MP_TAC o ISPECL [`x:real^3`;`v:real^3`;`(power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))`]) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[SUBSET] THEN GEN_TAC + THEN REWRITE_TAC[wedge2_fan;IN_ELIM_THM] THEN REWRITE_TAC[if_azims_fan; azim] THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC + THEN ASSUME_TAC(th2) THEN POP_ASSUM(MP_TAC o ISPECL[`x:real^3`; `v:real^3`;`x':real^3`]) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASSUME_TAC(th) +THEN POP_ASSUM (MP_TAC o SPECL [`x:real^3`;`v:real^3`;`u:real^3`;`(power_map_points sigma_fan x (V:real^3->bool) (E:(real^3->bool)->bool) v u (i:num)):real^3`;]) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[EXTENSION] THEN DISCH_TAC + THEN POP_ASSUM (MP_TAC o ISPEC `x':real^3`)THEN + REWRITE_TAC[IN_ELIM_THM] THEN ASM_REWRITE_TAC[]);; + + + +let wedge_fan2_equal_aff_gt=prove( +` !x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 i:num. + ~collinear {x,v,u} /\ ~collinear {x, v, power_map_points sigma_fan x V E v u i} +/\ ~(i= CARD (set_of_edge v V E)) +==> + wedge2_fan x V E v u i = aff_gt {x , v} {power_map_points sigma_fan x V E v u i} `, +REPEAT GEN_TAC THEN STRIP_TAC THEN +SUBGOAL_THEN `wedge2_fan x V E v u i SUBSET aff_gt {x , v} {power_map_points sigma_fan x V E v u i}` ASSUME_TAC +THENL + [ ASM_MESON_TAC[ wedge_fan2_subset_aff_gt;aff_gt_subset_wedge_fan2]; + SUBGOAL_THEN ` + aff_gt {(x:real^3), (v:real^3)} {power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)} SUBSET wedge2_fan (x:real^3) V E (v:real^3) (u:real^3) (i:num)` ASSUME_TAC +THENL[ASM_MESON_TAC[aff_gt_subset_wedge_fan2]; + ASM_SET_TAC[]]]);; + + +let wedge_fan2_equal_aff_gt_fan=prove(` !x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 i:num. +FAN(x,V,E)/\ ({v,u} IN E) +/\ ~(i= CARD (set_of_edge v V E)) +==> + wedge2_fan x V E v u i = aff_gt {x , v} {power_map_points sigma_fan x V E v u i} `, + + REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"a") THEN USE_THEN "a" MP_TAC + THEN REWRITE_TAC[FAN;fan6] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "b") + THEN REPEAT STRIP_TAC +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` (u:real^3)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`(i:num)`; `(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] image_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN + MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN USE_THEN "b" (fun th-> MP_TAC(ISPEC`{(v:real^3),(u:real^3)}`th)) THEN REMOVE_THEN "b" (fun th-> MP_TAC(ISPEC`{(v:real^3),(power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))}`th)) THEN ASM_REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] THEN DISCH_TAC THEN DISCH_TAC THEN ASM_MESON_TAC[wedge_fan2_equal_aff_gt]);; + + +(*****wedge3_fan=w_dart_fan*******) + +let wedge3_fan=new_definition`wedge3_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) = +{y:real^3 | ( if_azims_fan x V E v u (i) < azim x v u y)/\ +(azim x v u y < if_azims_fan x V E v u (SUC i)) /\( y IN complement_set {x, v})}`;; + + + + + + + + +let w_dart_eq_wedge3_fan=prove(` !x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 i:num. + FAN(x,V,E) /\ ({v,u} IN E) +/\ (i< CARD (set_of_edge v V E)) +/\ CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))> 1 +==> +w_dart_fan x V E (x,v,power_map_points sigma_fan x V E v u i, power_map_points sigma_fan x V E v u (SUC i)) += wedge3_fan x V E v u i`, + +REPEAT GEN_TAC THEN STRIP_TAC + THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_THEN(LABEL_TAC "a") THEN USE_THEN "a" MP_TAC THEN REWRITE_TAC[FAN;fan6] THEN +STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"1") THEN REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3 `;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;` v:real^3`]th4) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +ASM_REWRITE_TAC[w_dart_fan;wedge;wedge3_fan;complement_set; IN_ELIM_THM;collinear_fan] + THEN DISJ_CASES_TAC(ARITH_RULE`i=0 \/ 0< (i:num)`) +THENL[ + +MP_TAC(ARITH_RULE`CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) > 1 ==> ~(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))= 0)/\ ~(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))=1)`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +ASM_REWRITE_TAC[power_map_points;if_azims_fan;ARITH_RULE`SUC 0 =1`;AZIM_REFL;] THEN ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]; + +MP_TAC(ARITH_RULE`(i:num)bool) (E:(real^3->bool)->bool))==> ~(i=CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC(ISPECL[`x:real^3 `;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;`i:num`]SUM_IF_AZIMS_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC "bc") THEN ASM_REWRITE_TAC[if_azims_fan;EXTENSION;IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC +THENL[ + +STRIP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`azim (x:real^3) (v:real^3) ( power_map_points sigma_fan (x:real^3) + (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) (x':real^3) < azim (x:real^3) (v:real^3) +( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) +(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (power_map_points sigma_fan (x:real^3) (V:real^3->bool) +(E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) ) +==> azim (x:real^3) (v:real^3) (u:real^3) ( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) + (v:real^3) (u:real^3) (i:num)) + azim (x:real^3) (v:real^3) ( power_map_points sigma_fan (x:real^3) (V:real^3->bool) + (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) (x':real^3)< azim (x:real^3) (v:real^3) (u:real^3) +( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) + + azim (x:real^3) (v:real^3) ( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num)) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) +( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) )`) + THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "bc" MP_TAC THEN GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o REDEPTH_CONV) [if_azims_fan;power_map_points] + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) THEN DISCH_TAC + THEN ASSUME_TAC (ISPECL[`x:real^3 `;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;`SUC i:num`]if_azims_works_fan) + THEN MP_TAC(REAL_ARITH`azim (x:real^3) (v:real^3) (u:real^3) ( power_map_points sigma_fan (x:real^3) + (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) + azim (x:real^3) (v:real^3) +( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) +(x':real^3)< if_azims_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) + (v:real^3) (u:real^3) (SUC(i:num)) /\ if_azims_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) + (v:real^3) (u:real^3) (SUC(i:num)) <= &2 *pi ==> azim (x:real^3) (v:real^3) (u:real^3) +( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) + + azim (x:real^3) (v:real^3) ( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num)) (x':real^3)< &2 * pi`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`x':real^3`]collinear_fan) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`i:num`;`x:real^3 `;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`]IN2_ORBITS_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`SUC(i:num)`;`x:real^3 `;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`]IN2_ORBITS_FAN) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC + THEN REMOVE_THEN "1" (fun th-> MP_TAC(ISPEC`{(v:real^3),(u:real^3)}`th)THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`{(v:real^3),( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num))}`th)) THEN ASM_REWRITE_TAC[SET_RULE`{a}UNION {b,c}={a,b,c}`]THEN DISCH_TAC THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num))`; `x':real^3`]sum3_azim_fan) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[] + THEN ASM_REWRITE_TAC[REAL_ARITH`(a:real) < a +b <=> &0 < b`; REAL_ARITH`(a:real) + c< a +b<=> c< b`;]; + +STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN DISCH_THEN(LABEL_TAC"ma1") THEN DISCH_THEN(LABEL_TAC"ma2") THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] THEN +MP_TAC(REAL_ARITH`azim (x:real^3) (v:real^3) (u:real^3) ( power_map_points sigma_fan (x:real^3) + (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) < azim (x:real^3) (v:real^3) (u:real^3) +(x':real^3) +==> azim (x:real^3) (v:real^3) (u:real^3) ( power_map_points sigma_fan (x:real^3) + (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) <= azim (x:real^3) (v:real^3) (u:real^3) +(x':real^3) +`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN + MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`x':real^3`]collinear_fan) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`i:num`;`x:real^3 `;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`]IN2_ORBITS_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`SUC(i:num)`;`x:real^3 `;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`]IN2_ORBITS_FAN) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC + THEN REMOVE_THEN "1" (fun th-> MP_TAC(ISPEC`{(v:real^3),(u:real^3)}`th)THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`{(v:real^3),( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num))}`th)) THEN ASM_REWRITE_TAC[SET_RULE`{a}UNION {b,c}={a,b,c}`]THEN DISCH_TAC THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num))`; `x':real^3`]sum4_azim_fan) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN REMOVE_THEN "ma1" MP_TAC THEN REMOVE_THEN "ma2" MP_TAC +THEN ASM_REWRITE_TAC[power_map_points] THEN REAL_ARITH_TAC]]);; + + + + + + + + +let UNION_FAN=prove( +`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E)/\ ({v,u}IN E) +==> + (UNIV:real^3->bool) = aff {x,v} UNION (UNIONS {wedge3_fan x V E v u i|i| 0 <= i /\ i< CARD(set_of_edge v V E) }) +UNION + (UNIONS {wedge2_fan x V E v u i|i| 0 <= i /\ i< CARD(set_of_edge v V E) } ) +`, + +REPEAT STRIP_TAC THEN REWRITE_TAC[EXTENSION; UNION;IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC +THENL(*1*)[ +STRIP_TAC THEN DISJ_CASES_TAC(SET_RULE`(x':real^3) IN aff {(x:real^3),(v:real^3)} \/ ~((x':real^3) IN aff {x,v})`) +THENL(*2*)[ +ASM_SET_TAC[];(*2*) + +ASM_REWRITE_TAC[] + THEN DISJ_CASES_TAC(SET_RULE`(x':real^3) IN (UNIONS {wedge2_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)|i| 0 <= i /\ i< CARD(set_of_edge v V E)} ) + \/ ~((x':real^3) IN (UNIONS {wedge2_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)|i| 0 <= i/\ i< CARD(set_of_edge v V E)}) )`) +THENL(*3*)[ +ASM_REWRITE_TAC[];(*3*) +ASM_REWRITE_TAC[] + THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[UNIONS;IN_ELIM_THM;NOT_EXISTS_THM;DE_MORGAN_THM;ARITH_RULE `(0 <= (i:num))`] + THEN DISCH_TAC THEN SUBGOAL_THEN`!i:num. ~((x':real^3) IN wedge2_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))\/ ~(i< CARD(set_of_edge v V E)) ` ASSUME_TAC +THENL(*4*)[ +ASM_SET_TAC[];(*4*) + +POP_ASSUM MP_TAC THEN REWRITE_TAC[wedge2_fan;IN_ELIM_THM] THEN DISCH_THEN(LABEL_TAC"100") + THEN SUBGOAL_THEN`(~((x':real^3) IN set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)))` ASSUME_TAC +THENL(*5*)[ +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`]SIMP_ORBITS_POINTS_FAN) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) + THEN REWRITE_TAC[IN_ELIM_THM] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") THEN STRIP_TAC + THEN REMOVE_THEN "a"(fun th-> MP_TAC(ISPEC`i:num`th)) + THEN MP_TAC(ARITH_RULE`(i:num) < CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))==> ~(i=CARD(set_of_edge v V E))`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[if_azims_fan;complement_set; IN_ELIM_THM] + THEN ASM_MESON_TAC[remark_power_map_points];(*5*) + +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`]SIMP_ORBITS_POINTS_FAN) THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN(LABEL_TAC"a") + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;`x':real^3`]exists_inverse_in_orbits_sigma_fan) THEN ASM_REWRITE_TAC[azim1] + THEN STRIP_TAC + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"b") +THEN DISCH_TAC THEN DISCH_TAC + THEN REMOVE_THEN "b" MP_TAC + THEN REMOVE_THEN "a"(fun th->REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") THEN DISCH_TAC + THEN REWRITE_TAC[IN_ELIM_THM] + THEN STRIP_TAC + THEN EXISTS_TAC`wedge3_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)` + THEN STRIP_TAC +THENL(*6*)[ +EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[];(*6*) + +ASM_REWRITE_TAC[wedge3_fan; complement_set; IN_ELIM_THM;] + THEN SUBGOAL_THEN`if_azims_fan x (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) < azim (x:real^3) v u (x':real^3)` ASSUME_TAC +THENL(*7*)[ +MP_TAC(ARITH_RULE`(i:num) < CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))==> ~(i=CARD(set_of_edge v V E))`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[if_azims_fan;complement_set; IN_ELIM_THM] + THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`(i:num)=0 \/ 0< i`) +THENL(*8*)[ + +ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC THEN ASM_REWRITE_TAC[AZIM_REFL] + THEN POP_ASSUM (fun th->REWRITE_TAC[]) + THEN POP_ASSUM (fun th->REWRITE_TAC[]) + THEN POP_ASSUM (fun th->REWRITE_TAC[]) + THEN POP_ASSUM (fun th->REWRITE_TAC[]) + THEN POP_ASSUM (fun th->REWRITE_TAC[]) + THEN POP_ASSUM (fun th->REWRITE_TAC[]) + THEN POP_ASSUM (fun th->REWRITE_TAC[]) + THEN POP_ASSUM (fun th->MP_TAC(ISPEC`0`th)) THEN DISCH_THEN(LABEL_TAC"a") + THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[if_azims_fan;power_map_points;DE_MORGAN_THM; complement_set; IN_ELIM_THM;AZIM_REFL;ARITH_RULE`(~(0 (0=a))`] + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x':real^3`]azim ) THEN POP_ASSUM MP_TAC + THEN REAL_ARITH_TAC;(*8*) + +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;] u_IN_ORBITS_FAN) THEN DISCH_TAC + THEN SUBGOAL_THEN `~(u=(x':real^3))` ASSUME_TAC +THENL(*9*)[ +ASM_SET_TAC[];(*9*) + + DISCH_TAC THEN REMOVE_THEN "a"(fun th-> MP_TAC(ISPEC`u:real^3`th)) THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[REAL_ARITH`(b:real)- a<= b-c <=> c <= a`] THEN DISCH_THEN(LABEL_TAC"b1") + THEN MP_TAC(ARITH_RULE`0< (i:num)/\ i ~(0=CARD(set_of_edge v V E))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN USE_THEN"100"(fun th-> MP_TAC(ISPEC`0`th)) THEN +REWRITE_TAC[if_azims_fan] THEN ASM_REWRITE_TAC[power_map_points;AZIM_REFL;complement_set; IN_ELIM_THM] + THEN MP_TAC(ARITH_RULE`i ~(i=CARD(set_of_edge v V E))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN USE_THEN"100"(fun th-> MP_TAC(ISPEC`i:num`th)) THEN +REWRITE_TAC[if_azims_fan] THEN ASM_REWRITE_TAC[power_map_points;AZIM_REFL;complement_set; IN_ELIM_THM] + + THEN GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b <=> b=a`] THEN DISCH_TAC +THEN +DISJ_CASES_TAC(SET_RULE`collinear {(x:real^3),v,x'} \/ ~collinear {x,v,x'}`) +THENL(*10*)[ + +POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC( LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [SET_RULE`{a,b,c}= {a,c,b}`] + THEN REWRITE_TAC[COLLINEAR_3_EXPAND;] + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;` (v:real^3)`] remark1_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN SUBGOAL_THEN `(x':real^3) IN aff {x,v}` ASSUME_TAC +THENL(*11*)[ +REWRITE_TAC[aff; AFFINE_HULL_2; IN_ELIM_THM] THEN EXISTS_TAC`u':real` THEN EXISTS_TAC`&1 -(u':real)` THEN ASM_REWRITE_TAC[] + THEN REAL_ARITH_TAC;(*11*) +ASM_MESON_TAC[]](*11*);(*10*) + +STRIP_TAC +THENL(*11*)[ +POP_ASSUM MP_TAC THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;` (v:real^3)`] remark1_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`i:num`;`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] remark_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x':real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num))`]AZIM_EQ_ALT) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num))`;`x':real^3`]AZIM_EQ_0_ALT) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN DISCH_TAC THEN MP_TAC(ISPECL[`(x:real^3) `;`(v:real^3)`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num))`;` (x':real^3)`] AZIM_COMPL) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`(x:real^3) `;`(v:real^3)`;` (u:real^3)`;`(x':real^3)`] AZIM_COMPL) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN DISCH_TAC + THEN REMOVE_THEN"b1" MP_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`b-a<= b-c <=> c<= a`] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`; `( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num))`;` (x':real^3)`]sum5_azim_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num))`;` (x':real^3)`]azim) THEN POP_ASSUM MP_TAC + THEN POP_ASSUM(fun th->REWRITE_TAC[]) + THEN POP_ASSUM(fun th->REWRITE_TAC[]) + THEN POP_ASSUM(fun th->REWRITE_TAC[]) + THEN POP_ASSUM(fun th->REWRITE_TAC[]) + THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*11*) +REPEAT (POP_ASSUM MP_TAC) THEN ARITH_TAC](*11*)](*10*)](*9*)](*8*);(*7*) + + +ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"b") THEN DISCH_THEN(LABEL_TAC"c") + THEN DISJ_CASES_TAC(ARITH_RULE`SUC (i:num)= CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))\/ ~(SUC (i)= CARD(set_of_edge v V E))`) +THENL(*8*)[ + +ASM_REWRITE_TAC[if_azims_fan] THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x':real^3`]azim) THEN REAL_ARITH_TAC; +(*8*) +DISJ_CASES_TAC(ARITH_RULE`(i:num)=0 \/ 0 REWRITE_TAC[SYM(th)]THEN ASSUME_TAC(SYM(th))) + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;] u_IN_ORBITS_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;`w:real^3`] IN_ORBITS_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN SUBGOAL_THEN `~(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (w:real^3)=(x':real^3))` ASSUME_TAC +THENL(*10*)[ASM_SET_TAC[];(*10*) + +REMOVE_THEN "a" (fun th -> MP_TAC(ISPEC`sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (w:real^3)`th)) THEN ASM_REWRITE_TAC[REAL_ARITH`b-a<= b-c <=> c<= a`]THEN DISCH_THEN(LABEL_TAC"b1") + THEN MP_TAC(ARITH_RULE`(i:num)=0/\ i ~(0=CARD(set_of_edge v V E))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN USE_THEN"100"(fun th-> MP_TAC(ISPEC`i:num`th)) THEN +REWRITE_TAC[if_azims_fan] THEN ASM_REWRITE_TAC[power_map_points;AZIM_REFL;complement_set; IN_ELIM_THM] + + THEN GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b <=> b=a`] THEN DISCH_TAC + + THEN MP_TAC(ARITH_RULE`(i:num)=0/\ ~(SUC(i) =CARD(set_of_edge (v:real^3) V E))==> ~(SUC(0)=CARD(set_of_edge v V E))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN USE_THEN"100"(fun th-> MP_TAC(ISPEC`SUC(0):num`th)) THEN +REWRITE_TAC[if_azims_fan] THEN ASM_REWRITE_TAC[power_map_points;AZIM_REFL;complement_set; IN_ELIM_THM] + + THEN GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b <=> b=a`] THEN REWRITE_TAC[power_map_points] +THEN +DISJ_CASES_TAC(SET_RULE`collinear {(x:real^3),v,x'} \/ ~collinear {x,v,x'}`) +THENL(*11*)[ +POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC( LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [SET_RULE`{a,b,c}= {a,c,b}`] + THEN REWRITE_TAC[COLLINEAR_3_EXPAND;] + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;` (v:real^3)`] remark1_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN SUBGOAL_THEN `(x':real^3) IN aff {x,v}` ASSUME_TAC +THENL(*12*)[ +REWRITE_TAC[aff; AFFINE_HULL_2; IN_ELIM_THM] THEN EXISTS_TAC`u':real` THEN EXISTS_TAC`&1 -(u':real)` THEN ASM_REWRITE_TAC[] + THEN REAL_ARITH_TAC;(*12*) +ASM_MESON_TAC[]](*12*);(*11*) + +STRIP_TAC THENL(*12*)[ + +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;` (v:real^3)`] remark1_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(SET_RULE`(u:real^3)=(w:real^3) /\ {v,u} IN (E:(real^3->bool)->bool)==> {v,w} IN E`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + + THEN MP_TAC(ISPECL[`SUC(0):num`;`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`] remark_power_map_points) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x':real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (SUC(0):num))`]AZIM_EQ_ALT) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (SUC(0):num))`;`x':real^3`]AZIM_EQ_0_ALT) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(v:real^3)`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (SUC(0):num))`;` (x':real^3)`] AZIM_COMPL) THEN ASM_REWRITE_TAC[power_map_points] + THEN MP_TAC(ISPECL[`(x:real^3) `;`(v:real^3)`;` (u:real^3)`;`(x':real^3)`] AZIM_COMPL) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN DISCH_TAC + THEN REMOVE_THEN"b1" MP_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`b-a<= b-c <=> c<= a`] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (SUC(0):num))`;`w:real^3`;` (x':real^3)`]sum5_azim_fan) + THEN ASM_REWRITE_TAC[power_map_points;REAL_ARITH`a=b+c <=> c=a-b`] THEN +DISCH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`a-b a< b+c`] + THEN MP_TAC(ARITH_RULE` (i:num) < (CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))) /\ ~(SUC(i)=CARD(set_of_edge v V E)) ==> SUC(i) < CARD(set_of_edge v V E)`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`; `SUC(i):num`; `i:num`] cyclic_power_sigma_fan) THEN ASM_REWRITE_TAC[power_map_points;ARITH_RULE`0< SUC 0`; ] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3))`; `w:real^3`; ] UNIQUE_AZIM_0_POINT_FAN) THEN ASM_REWRITE_TAC[power_map_points; ] + THEN DISCH_TAC THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`;` (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3))`; `w:real^3`]AZIM_COMPL) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`c c REWRITE_TAC[SYM(th)]THEN ASSUME_TAC(SYM(th))) + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;`i:num`] i_IN_ORBITS_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;`w:real^3`] IN_ORBITS_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN SUBGOAL_THEN `~(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (w:real^3)=(x':real^3))` ASSUME_TAC +THENL(*10*)[ ASM_SET_TAC[];(*10*) + +REMOVE_THEN "a" (fun th -> MP_TAC(ISPEC`sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (w:real^3)`th)) THEN ASM_REWRITE_TAC[REAL_ARITH`b-a<= b-c <=> c<= a`]THEN DISCH_THEN(LABEL_TAC"b1") + THEN MP_TAC(ARITH_RULE`i ~(i=CARD(set_of_edge v V E))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN USE_THEN"100"(fun th-> MP_TAC(ISPEC`i:num`th)) THEN +REWRITE_TAC[if_azims_fan] THEN ASM_REWRITE_TAC[power_map_points;AZIM_REFL;complement_set; IN_ELIM_THM] + + THEN GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b <=> b=a`] THEN DISCH_TAC + THEN USE_THEN"100"(fun th-> MP_TAC(ISPEC`SUC(i):num`th)) THEN +REWRITE_TAC[if_azims_fan] THEN ASM_REWRITE_TAC[power_map_points;AZIM_REFL;complement_set; IN_ELIM_THM] + + THEN GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b <=> b=a`] THEN REWRITE_TAC[power_map_points] +THEN +DISJ_CASES_TAC(SET_RULE`collinear {(x:real^3),v,x'} \/ ~collinear {x,v,x'}`) +THENL(*11*)[ +POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC( LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [SET_RULE`{a,b,c}= {a,c,b}`] + THEN REWRITE_TAC[COLLINEAR_3_EXPAND;] + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;` (v:real^3)`] remark1_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN SUBGOAL_THEN `(x':real^3) IN aff {x,v}` ASSUME_TAC +THENL(*12*)[ +REWRITE_TAC[aff; AFFINE_HULL_2; IN_ELIM_THM] THEN EXISTS_TAC`u':real` THEN EXISTS_TAC`&1 -(u':real)` THEN ASM_REWRITE_TAC[] + THEN REAL_ARITH_TAC;(*12*) +ASM_MESON_TAC[]](*12*);(*11*) + +STRIP_TAC THENL(*12*)[ +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;` (v:real^3)`] remark1_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`i:num`;`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] remark_power_map_points) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`SUC(i):num`;`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] remark_power_map_points) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x':real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (SUC(i):num))`]AZIM_EQ_ALT) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (SUC(i):num))`;`x':real^3`]AZIM_EQ_0_ALT) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC + THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x':real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) ((i):num))`]AZIM_EQ_ALT) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) ((i):num))`;`x':real^3`]AZIM_EQ_0_ALT) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(v:real^3)`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (SUC(i):num))`;` (x':real^3)`] AZIM_COMPL) THEN ASM_REWRITE_TAC[power_map_points] + THEN MP_TAC(ISPECL[`(x:real^3) `;`(v:real^3)`;` (w:real^3)`;`(x':real^3)`] AZIM_COMPL) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN DISCH_TAC +THEN + REMOVE_THEN "c" MP_TAC THEN ASM_REWRITE_TAC[if_azims_fan] THEN DISCH_TAC THEN +MP_TAC(REAL_ARITH`azim x v u w< azim (x:real^3) v u x'==> azim x v u w<= azim (x:real^3) v u x'`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`(u:real^3)`;`w:real^3`;` (x':real^3)`]sum4_azim_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;`i:num`] SUM_IF_AZIMS_FAN) THEN ASM_REWRITE_TAC[if_azims_fan;power_map_points] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[REAL_ARITH`a+b b c<= a`] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (SUC(i):num))`;`w:real^3`;` (x':real^3)`]sum5_azim_fan) + THEN ASM_REWRITE_TAC[power_map_points;REAL_ARITH`a=b+c <=> c=a-b`] +THEN DISCH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`a-b a< b+c`] +THEN MP_TAC(ARITH_RULE` (i:num) < (CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))) /\ ~(SUC(i)=CARD(set_of_edge v V E)) ==> SUC(i) < CARD(set_of_edge v V E)`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`; `SUC(i):num`; `i:num`] cyclic_power_sigma_fan) THEN ASM_REWRITE_TAC[power_map_points;ARITH_RULE`i< SUC i`; ] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (w:real^3))`; `w:real^3`; ] UNIQUE_AZIM_0_POINT_FAN) THEN ASM_REWRITE_TAC[power_map_points; ] + THEN DISCH_TAC THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`;` (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (w:real^3))`; `w:real^3`]AZIM_COMPL) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`c cbool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E)/\ ({v,u}IN E) +==> +({w_dart_fan x V E (x,v,w,(sigma_fan x V E v w))|w| {v,w} IN E } += {wedge3_fan x V E v u i|i| 0 <= i/\ i< CARD(set_of_edge v V E) }) +`, + +(let lem= prove(`!x v u w. +(&0 < azim x v u w) <=> ~(azim x v u w= &0)`, +MESON_TAC[azim; REAL_ARITH`&0 <= a==> (&0 < a) <=> ~(a= &0)`]) in +( let lem1=prove(`!x v. ~(x = v)==>(!u. ~(u IN aff {x, v}) <=> ~collinear {x, v, u})`, +MESON_TAC[collinear_fan]) in +(let lem2=prove(`!v0 v1 w. + ~collinear{v0,v1,w} ==> +!x. ( ~(azim v0 v1 w x = &0)/\ ~collinear{v0,v1,x} <=> ~(x IN aff_ge {v0,v1} {w}) /\ ~collinear{v0,v1,x})`, +MESON_TAC[AZIM_EQ_0_GE_ALT]) in + +REPEAT STRIP_TAC THEN REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC +THENL(*1*)[ +REWRITE_TAC[GSYM(EXTENSION)] THEN STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`] properties_of_set_of_edge_fan) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] ORBITS_EQ_SET_EDGE_FAN) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] SIMP_ORBITS_POINTS_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)])THEN DISCH_TAC +THEN POP_ASSUM(fun th->GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[th]) + THEN REWRITE_TAC[IN_ELIM_THM;] THEN STRIP_TAC THEN EXISTS_TAC `i:num` THEN +ASM_REWRITE_TAC[ARITH_RULE`0<= (i:num)`] + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`]CARD_SET_OF_ORBITS_POINTS_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC +THEN +DISJ_CASES_TAC(ARITH_RULE`(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))>1 \/ ~((CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))> 1)`) +THENL[ +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;`i:num`] w_dart_eq_wedge3_fan) + THEN ASM_REWRITE_TAC[power_map_points]; + +MP_TAC(ARITH_RULE`(i:num)bool) (E:(real^3->bool)->bool)) /\ ~(CARD(set_of_edge v V E)>1)==> i=0`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +ASM_REWRITE_TAC[w_dart_fan;wedge3_fan;if_azims_fan;power_map_points] + THEN DISJ_CASES_TAC(ARITH_RULE` 0= CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) \/ ~(0=CARD(set_of_edge v V E))`) +THENL[ + +REPEAT (POP_ASSUM MP_TAC) THEN ARITH_TAC; + +MP_TAC(ARITH_RULE`~(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))>1) /\ ~(0=CARD(set_of_edge v V E))==> SUC (0)=CARD(set_of_edge v V E)`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +ASM_REWRITE_TAC[complement_set;IN_ELIM_THM;AZIM_REFL;azim] + + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] ORBITS_EQ_SET_EDGE_FAN) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] SIMP_ORBITS_POINTS_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)])THEN + POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) THEN REWRITE_TAC[ARITH_RULE`(a:num) < SUC 0 <=> a=0`;SET_RULE`{f i| i=0}={f 0}`; +power_map_points] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;` (v:real^3)`] remark1_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`]lem1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN ASM_REWRITE_TAC[lem] THEN POP_ASSUM (fun th-> REWRITE_TAC[]) + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]lem2) THEN POP_ASSUM (fun th-> REWRITE_TAC[th] THEN ASSUME_TAC(th)) +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]aff_subset_aff_ge) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th] THEN ASSUME_TAC(th)) THEN DISCH_TAC + THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[th;collinear_fan;]) THEN ASM_REWRITE_TAC[GSYM(DE_MORGAN_THM);] + THEN ASM_SET_TAC[]]]; + +REWRITE_TAC[GSYM(EXTENSION)] THEN STRIP_TAC +THEN EXISTS_TAC`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) ((i):num)) ` THEN +MP_TAC(ISPECL[`i:num`;`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] remark_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th->REWRITE_TAC[th]) + THEN DISJ_CASES_TAC(ARITH_RULE`(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))>1 \/ ~((CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))> 1)`) +THENL[ +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;`i:num`] w_dart_eq_wedge3_fan) + THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC THEN POP_ASSUM(fun th->REWRITE_TAC[th]); + +MP_TAC(ARITH_RULE`(i:num)bool) (E:(real^3->bool)->bool)) /\ ~(CARD(set_of_edge v V E)>1)==> i=0`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +ASM_REWRITE_TAC[w_dart_fan;wedge3_fan;if_azims_fan;power_map_points] + THEN DISJ_CASES_TAC(ARITH_RULE` 0= CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) \/ ~(0=CARD(set_of_edge v V E))`) +THENL[ +REPEAT (POP_ASSUM MP_TAC) THEN ARITH_TAC; + +MP_TAC(ARITH_RULE`~(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))>1) /\ ~(0=CARD(set_of_edge v V E))==> SUC (0)=CARD(set_of_edge v V E)`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +ASM_REWRITE_TAC[complement_set;IN_ELIM_THM;AZIM_REFL;azim] + + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] ORBITS_EQ_SET_EDGE_FAN) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] SIMP_ORBITS_POINTS_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)])THEN + POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) THEN REWRITE_TAC[ARITH_RULE`(a:num) < SUC 0 <=> a=0`;SET_RULE`{f i| i=0}={f 0}`; +power_map_points] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;` (v:real^3)`] remark1_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`]lem1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN ASM_REWRITE_TAC[lem] THEN POP_ASSUM (fun th-> REWRITE_TAC[]) + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]lem2) THEN POP_ASSUM (fun th-> REWRITE_TAC[th] THEN ASSUME_TAC(th)) +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]aff_subset_aff_ge) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th] THEN ASSUME_TAC(th)) THEN DISCH_TAC + THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[th;collinear_fan;]) THEN ASM_REWRITE_TAC[GSYM(DE_MORGAN_THM);] + THEN ASM_SET_TAC[]]]]))));; + + + + +let eq_set_aff_gt=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E)/\ ({v,u}IN E) +==> {aff_gt {x,v} {w} |w| {v,w} IN E} +={wedge2_fan x V E v u i|i| 0 <= i /\ i< CARD(set_of_edge v V E) }`, + +REPEAT STRIP_TAC THEN REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC +THENL[ +REWRITE_TAC[GSYM(EXTENSION)] THEN STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`] properties_of_set_of_edge_fan) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] ORBITS_EQ_SET_EDGE_FAN) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] SIMP_ORBITS_POINTS_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)])THEN DISCH_TAC +THEN POP_ASSUM(fun th->GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[th]) + THEN REWRITE_TAC[IN_ELIM_THM;] THEN STRIP_TAC THEN EXISTS_TAC `i:num` THEN + ASM_REWRITE_TAC[ARITH_RULE`0 <= i`] + + THEN MP_TAC(ARITH_RULE`(i:num) < CARD(set_of_edge v V E) ==> ~(i= CARD(set_of_edge (v:real^3) (V:real^3->bool)(E:(real^3->bool)->bool)))`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;`i:num`] wedge_fan2_equal_aff_gt_fan) + + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]); + +REWRITE_TAC[GSYM(EXTENSION)] THEN STRIP_TAC +THEN EXISTS_TAC`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) ((i):num)) ` THEN +MP_TAC(ISPECL[`i:num`;`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] remark_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th->REWRITE_TAC[th]) + + THEN MP_TAC(ARITH_RULE`(i:num) < CARD(set_of_edge v V E) ==> ~(i= CARD(set_of_edge (v:real^3) (V:real^3->bool)(E:(real^3->bool)->bool)))`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;`i:num`] wedge_fan2_equal_aff_gt_fan) + + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)])]);; + + + + + + +let UNION1_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). + +FAN(x,V,E)/\ ({v,u}IN E) +==> + (UNIV:real^3->bool) = aff {x,v} UNION (UNIONS {w_dart_fan x V E (x,v,w,(sigma_fan x V E v w))|w| {v,w} IN E }) +UNION + (UNIONS {aff_gt {x,v} {w} |w| {v,w} IN E} ) +`, + +REPEAT STRIP_TAC + THEN MP_TAC (ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`]UNION_FAN) THEN ASM_REWRITE_TAC[] + THEN MP_TAC (ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`]eq_set_wdart_fan) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN MP_TAC (ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`]eq_set_aff_gt ) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN ASM_SET_TAC[]);; + + + +(* ========================================================================== *) +(* DISJOINT IN NODE OF FAN *) +(* ========================================================================== *) + + + +let disjoint_set_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (w1:real^3). +FAN(x,V,E)/\ ({v,w}IN E) /\ ({v,w1}IN E) +==> + w_dart_fan x V E (x,v,w,(sigma_fan x V E v w)) INTER + aff_gt {x,v} {w1}={}`, + +(let lem =prove(`!x:real^3. + FINITE {x} +==> +CARD {x} = 1`,MESON_TAC[CARD_SING]) in +(let lem1=prove(`!x v. ~(x = v)==>(!u. ~(u IN aff {x, v}) <=> ~collinear {x, v, u})`, +MESON_TAC[collinear_fan]) in +(let lem2=prove(`!v0 v1 w. + ~collinear{v0,v1,w} ==> +!x. ( &0 = azim v0 v1 w x /\ ~collinear{v0,v1,x} <=> (x IN aff_ge {v0,v1} {w}) /\ ~collinear{v0,v1,x})`, +MESON_TAC[AZIM_EQ_0_GE_ALT]) in + + +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w1:real^3)`] properties_of_set_of_edge_fan) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`] ORBITS_EQ_SET_EDGE_FAN) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`] SIMP_ORBITS_POINTS_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)])THEN DISCH_TAC +THEN POP_ASSUM(fun th->GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[th]) + THEN REWRITE_TAC[IN_ELIM_THM;] THEN STRIP_TAC + THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ARITH_RULE`i< CARD(set_of_edge (v:real^3) V E)==> ~(i=CARD(set_of_edge v V E))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`i:num`] wedge_fan2_equal_aff_gt_fan) + + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) + THEN DISJ_CASES_TAC(ARITH_RULE`(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))>1 \/ ~((CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))> 1)`) +THENL(*1*)[ + MP_TAC(ARITH_RULE`CARD(set_of_edge (v:real^3) V E)>1==> 0< CARD(set_of_edge v V E)`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN + MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`0:num`] w_dart_eq_wedge3_fan) + THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[wedge2_fan;wedge3_fan;EXTENSION] THEN GEN_TAC THEN +REWRITE_TAC[INTER; EMPTY;IN_ELIM_THM] + THEN DISJ_CASES_TAC(ARITH_RULE`(i:num)=0 \/ (0< i)`) +THENL(*2*)[ +ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC;(*2*) + + MP_TAC(ARITH_RULE`CARD(set_of_edge (v:real^3) V E)>1==> ~(0= CARD(set_of_edge v V E))/\ ~(SUC 0= CARD(set_of_edge v V E))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN +ASM_REWRITE_TAC[if_azims_fan] +THEN +MP_TAC(ARITH_RULE` (0< i)==> SUC (0)= i \/ SUC 0 bool) (E:(real^3->bool)->bool)={w} \/ ~(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={w})`) +THENL(*4*)[ + MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`;` (v:real^3)`]remark1_fan) + THEN ASM_REWRITE_TAC[IN_SING] THEN DISCH_TAC THEN ASM_REWRITE_TAC[power_map_points] THEN REAL_ARITH_TAC;(*4*) + +MP_TAC(ISPECL[`i:num`;`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`SUC (0):num`] AZIM_LE_POWER_SIGMA_FAN) + THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC](*4*)](*3*)](*2*);(*1*) + + + MP_TAC(ARITH_RULE`~(CARD(set_of_edge (v:real^3) V E)>1) /\ (i< CARD(set_of_edge v V E))==> i=0/\ ~(0=CARD(set_of_edge (v:real^3) V E))`) THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[wedge2_fan;w_dart_fan;if_azims_fan;power_map_points;complement_set;AZIM_REFL;EXTENSION] THEN GEN_TAC THEN +REWRITE_TAC[DIFF;INTER;IN_ELIM_THM;GSYM(EXTENSION);COND_ELIM_THM] + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`;` (v:real^3)`] remark1_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;]lem1) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]lem2) THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[th] ) THEN ASM_REWRITE_TAC[collinear_fan] +THEN +DISJ_CASES_TAC(SET_RULE`set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={w} \/ ~(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={w})`) + + +THENL(*2*)[ +ASM_SET_TAC[];(*2*) + +MP_TAC(ARITH_RULE`~(CARD(set_of_edge (v:real^3) V E)>1) /\ ~(0= CARD(set_of_edge v V E))==> (1=CARD(set_of_edge (v:real^3) V E))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(SET_RULE`w IN set_of_edge (v:real^3) V E==> {w} SUBSET set_of_edge (v:real^3) V E`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`{(w:real^3)}`;`set_of_edge (v:real^3) V E`] FINITE_SUBSET) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN +MP_TAC(ISPEC`w:real^3`lem) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`{(w:real^3)}`;`set_of_edge (v:real^3) V E`]CARD_SUBSET_EQ) + THEN ASM_REWRITE_TAC[]]]))));; + + +let disjiont1_cor6dot1 = prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 i:num. +wedge3_fan x V E v u i INTER aff {x,v}={}`, +REPEAT GEN_TAC THEN REWRITE_TAC[wedge3_fan; INTER] THEN REWRITE_TAC[complement_set; FUN_EQ_THM; EMPTY] THEN +GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN MESON_TAC[]);; + + + +let disjoint_fan1=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3). +FAN(x,V,E)/\ ({v,w}IN E) +==> + w_dart_fan x V E (x,v,w,(sigma_fan x V E v w)) INTER aff {x,v}={}`, +REPEAT STRIP_TAC + THEN DISJ_CASES_TAC(ARITH_RULE`(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))>1 \/ ~((CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))> 1)`) + +THENL[ + MP_TAC(ARITH_RULE`CARD(set_of_edge (v:real^3) V E)>1==> (0bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`0:num`] w_dart_eq_wedge3_fan) + THEN ASM_REWRITE_TAC[power_map_points;] THEN DISCH_TAC THEN ASM_REWRITE_TAC[disjiont1_cor6dot1]; + + MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`;` (v:real^3)`] remark1_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[w_dart_fan;INTER; IN_ELIM_THM;COND_ELIM_THM] + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]aff_subset_aff_ge) THEN ASM_REWRITE_TAC[] + THEN ASM_SET_TAC[]]);; + + + + + + + +let disjoint_fan2=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (w1:real^3). +FAN(x,V,E)/\ ({v,w}IN E) /\ ({v,w1}IN E) /\ ~(w=w1) +==> + w_dart_fan x V E (x,v,w,(sigma_fan x V E v w)) INTER + w_dart_fan x V E (x,v,w1,(sigma_fan x V E v w1))={}`, +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w1:real^3)`] properties_of_set_of_edge_fan) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`] ORBITS_EQ_SET_EDGE_FAN) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`] SIMP_ORBITS_POINTS_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)])THEN DISCH_TAC +THEN POP_ASSUM(fun th->GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[th]) + THEN REWRITE_TAC[IN_ELIM_THM;] THEN STRIP_TAC + THEN ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(ARITH_RULE`(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))>1 \/ ~((CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))> 1)`) +THENL(*1*)[ + MP_TAC(ARITH_RULE`CARD(set_of_edge (v:real^3) V E)>1==> 0< CARD(set_of_edge v V E)`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN + MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`0:num`] w_dart_eq_wedge3_fan) + THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] + THEN + MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`i:num`] w_dart_eq_wedge3_fan) + THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC THEN ASM_REWRITE_TAC[wedge3_fan;INTER] + THEN POP_ASSUM(fun th -> REWRITE_TAC[]) + THEN POP_ASSUM(fun th -> REWRITE_TAC[]) + THEN POP_ASSUM MP_TAC + THEN POP_ASSUM MP_TAC + THEN POP_ASSUM MP_TAC THEN DISJ_CASES_TAC(ARITH_RULE`i:num =0 \/ SUC(0) <= i`) +THENL(*2*)[ +ASM_REWRITE_TAC[power_map_points];(*2*) + +DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[if_azims_fan] THEN +MP_TAC(ARITH_RULE`CARD(set_of_edge (v:real^3) V E)>1==> ~(SUC 0= CARD(set_of_edge v V E))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN +MP_TAC(ARITH_RULE`i ~(i= CARD(set_of_edge v V E))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] + THEN MP_TAC(ARITH_RULE`SUC 0<= i ==> i:num = SUC 0 \/ SUC(0) < i`) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THENL(*3*)[ +ASM_REWRITE_TAC[EMPTY;EXTENSION;IN_ELIM_THM] THEN GEN_TAC THEN REAL_ARITH_TAC;(*3*) + + MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`;` (v:real^3)`] remark1_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +DISJ_CASES_TAC(SET_RULE`set_of_edge (v:real^3) V E ={w} \/ ~(set_of_edge (v:real^3) V E ={w})`) +THENL(*4*)[ +MP_TAC(ISPECL[`w:real^3`;`set_of_edge (v:real^3) V E`]CARD_SING) THEN ASM_REWRITE_TAC[] THEN +POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) THEN REPEAT(POP_ASSUM MP_TAC) THEN ARITH_TAC;(*4*) + +MP_TAC(ISPECL[`i:num`;`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`SUC (0):num`] AZIM_LE_POWER_SIGMA_FAN) + THEN ASM_REWRITE_TAC[] THEN ASM_REWRITE_TAC[EMPTY;EXTENSION;IN_ELIM_THM] THEN REAL_ARITH_TAC]]]; + +POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") THEN DISCH_TAC THEN +MP_TAC(ARITH_RULE`~(CARD(set_of_edge (v:real^3) V E)>1) /\ (i < CARD(set_of_edge v V E)) +==> (i:num =0)`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[power_map_points]]);; + + +let disjoint_fan3=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3). +FAN(x,V,E)/\ ({v,w}IN E) +==>aff{x,v} INTER aff_gt {x,v} {w}={}`, +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`;` (v:real^3)`] remark1_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN DISJ_CASES_TAC(SET_RULE`aff{(x:real^3),(v:real^3)} INTER aff_gt {x,v} {(w:real^3)}={} \/ (?(u:real^3). u IN aff{x,v} INTER aff_gt {x,v} {w})`) + THENL[ +ASM_SET_TAC[]; + +POP_ASSUM MP_TAC THEN STRIP_TAC THEN POP_ASSUM MP_TAC +THEN + MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GT_2_1) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`]affine_hull_2_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"a") THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;] + THEN STRIP_TAC +THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v = t1' % x + t2' % v + t3 % w <=> t3 % w = (t1 - t1') % x + (t2 -t2') % v`] + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM(th);REAL_ARITH`a+b+c=d+e <=> c = (d-a)+ (e-b)`]) +THEN DISCH_TAC THEN MP_TAC(REAL_ARITH`&0 < (t3:real) ==> ~(t3= &0)`) + THEN ASM_REWRITE_TAC[]THEN DISCH_TAC + THEN MP_TAC(ISPEC`t3:real`REAL_MUL_LINV) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN DISCH_TAC + THEN MP_TAC(SET_RULE` (t3:real) = (t1- t1') + (t2-t2') ==> (inv t3) *(t3:real) = (inv t3) * ((t1- t1')+ (t2-t2'))`) + THEN ASM_REWRITE_TAC[REAL_ARITH`a*(b+c)= a *b + a*c`] THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) + THEN DISCH_TAC THEN DISCH_TAC + THEN MP_TAC(SET_RULE` (t3:real) % w= (t1- t1') % (x:real^3) + (t2-t2') % v ==> (inv t3) % ((t3:real)% w) = (inv t3) % ((t1- t1') %x+ (t2-t2') % v)`) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`m% (n% p)=a%(b % x + c % v)<=> (m*n) %p = (a *b)%x + (a*c)% v`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) + THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(SYM(th))) THEN REWRITE_TAC[VECTOR_ARITH`&1 %w=w`] + THEN DISCH_TAC + THEN SUBGOAL_THEN`w IN aff{(x:real^3),v}` ASSUME_TAC +THENL[ +REMOVE_THEN"a"(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) THEN EXISTS_TAC`inv t3 * (t1-t1')` THEN EXISTS_TAC`inv t3 * (t2-t2')` + THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM(fun th-> REWRITE_TAC[th]); +ASM_SET_TAC[]]]);; + + + + + +let remark3_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (w1:real^3). +FAN(x,V,E)/\ ({v,w}IN E) /\ ({v,w1}IN E) /\ ~(w=w1) +==> + aff_gt{x,v} {w} INTER + aff_gt {x,v} {w1}={}`, +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w1:real^3)`] properties_of_set_of_edge_fan) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`] ORBITS_EQ_SET_EDGE_FAN) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`] SIMP_ORBITS_POINTS_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)])THEN DISCH_TAC +THEN POP_ASSUM(fun th->GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[th]) + THEN REWRITE_TAC[IN_ELIM_THM;] THEN STRIP_TAC + THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN DISJ_CASES_TAC(ARITH_RULE`i:num =0 \/ 0 < i`) +THENL[ +ASM_REWRITE_TAC[power_map_points]; + + MP_TAC(ARITH_RULE`i ~(i= CARD(set_of_edge v V E)) /\ ~(0=CARD(set_of_edge (v:real^3) V E))`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`i:num`] wedge_fan2_equal_aff_gt_fan) + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`0:num`] wedge_fan2_equal_aff_gt_fan) + THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC THEN DISCH_TAC + THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) + THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) + + THEN ASM_REWRITE_TAC[wedge2_fan;if_azims_fan;power_map_points;INTER;IN_ELIM_THM;AZIM_REFL;] + THEN DISCH_TAC THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) + THEN DISJ_CASES_TAC(REAL_ARITH`azim x v w w1 = &0 \/ ~(azim x v w w1 = &0)`) +THENL[ + MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`w1:real^3`] UNIQUE_AZIM_0_POINT_FAN) + THEN ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[EMPTY;EXTENSION;IN_ELIM_THM] THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]]);; + + +let VBTIKLP=prove(`(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E)/\ ({v,u}IN E) +==> + (UNIV:real^3->bool) = aff {x,v} UNION (UNIONS {w_dart_fan x V E (x,v,w,(sigma_fan x V E v w))|w| {v,w} IN E }) +UNION + (UNIONS {aff_gt {x,v} {w} |w| {v,w} IN E} )) +/\ +(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3). +FAN(x,V,E)/\ ({v,w}IN E) +==> + w_dart_fan x V E (x,v,w,(sigma_fan x V E v w)) INTER aff {x,v}={}) +/\ +(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (w1:real^3). +FAN(x,V,E)/\ ({v,w}IN E) /\ ({v,w1}IN E) +==> + w_dart_fan x V E (x,v,w,(sigma_fan x V E v w)) INTER + (aff_gt {x,v} {w1})={}) +/\ +(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (w1:real^3). +FAN(x,V,E)/\ ({v,w}IN E) /\ ({v,w1}IN E) /\ ~(w=w1) +==> + w_dart_fan x V E (x,v,w,(sigma_fan x V E v w)) INTER + w_dart_fan x V E (x,v,w1,(sigma_fan x V E v w1))={}) +/\ +(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (w1:real^3). +FAN(x,V,E)/\ ({v,w}IN E) /\ ({v,w1}IN E) /\ ~(w=w1) +==> + aff_gt{x,v} {w} INTER + aff_gt {x,v} {w1}={}) +/\ (!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3). +FAN(x,V,E)/\ ({v,w}IN E) +==>aff{x,v} INTER aff_gt {x,v} {w}={}) +`, +MESON_TAC[UNION1_FAN;disjoint_set_fan;disjoint_fan1;disjoint_fan2;remark3_fan;disjoint_fan3]);; + + + +end;; diff --git a/legacy/oldfan/ch_fan/FAN_DEF.ml b/legacy/oldfan/ch_fan/FAN_DEF.ml new file mode 100644 index 0000000..96f094a --- /dev/null +++ b/legacy/oldfan/ch_fan/FAN_DEF.ml @@ -0,0 +1,24 @@ + +(* definition of fan as ordered pairs *) +(* This is the correct definition to use!! *) + +let CASE_FAN_FINITE = new_definition `CASE_FAN_FINITE (V,E):bool <=> FINITE V /\ ~(V SUBSET {})`;; + +let CASE_FAN_ORIGIN = new_definition `CASE_FAN_ORIGIN (V,E) <=> ~((vec 0) IN (V:real^3 -> bool))`;; + +let CASE_FAN_INDEPENDENCE = + new_definition `CASE_FAN_INDEPENDENCE (V,E) <=> + (!e. e IN E ==> ~collinear ({vec 0} UNION e))`;; + +let CASE_FAN_INTERSECTION = + new_definition`CASE_FAN_INTERSECTION(V,E):bool<=> + (!e1 e2. (e1 IN E UNION {{v}| v IN V}) /\ (e2 IN E UNION {{v}| v IN V}) + ==> ((aff_ge {vec 0 } e1) INTER (aff_ge {vec 0} e2) = aff_ge {vec 0} (e1 INTER e2)))`;; + + +let FANO=new_definition`FANO(V,E) <=> + ((UNIONS E) SUBSET V) /\ graph(E) /\ CASE_FAN_FINITE(V,E) /\ CASE_FAN_ORIGIN(V,E)/\ + CASE_FAN_INDEPENDENCE(V,E)/\ CASE_FAN_INTERSECTION(V,E)`;; + +let FANO_OF_FAN = prove( `!V E. (FAN(vec 0 , V , E) <=> FANO(V,E))`, + REWRITE_TAC[FAN;FANO;CASE_FAN_FINITE;CASE_FAN_ORIGIN;CASE_FAN_INDEPENDENCE;CASE_FAN_INTERSECTION;fan1;fan2;fan6;fan7]);; diff --git a/legacy/oldfan/ch_fan/fan_definition.hl b/legacy/oldfan/ch_fan/fan_definition.hl new file mode 100644 index 0000000..02c5770 --- /dev/null +++ b/legacy/oldfan/ch_fan/fan_definition.hl @@ -0,0 +1,37 @@ +hypermap_tybij;; +type_of `tuple_hypermap`;; +type_of `hypermap`;; +restrict;; + +(* restriction of a function to a domain, identity outside domain *) + +let restrict = define `restrict (f:A->A) X = (\x. if (X x) then (f x) else x)`;; + +(* essentailly the same as fan.ml set_of_edges + +let edge_at = define `edge_at (V,E) v = { w | E {v,w} }`;; (* set_of_edges v E *) +*) + +let dart_set = + define `dart_set (V,E) = ({(v,v) | set_of_edges v E = EMPTY} UNION {(v,w) | E {v,w} })`;; + +(* check order of args in sigma_fan fan.ml *) + +let face_map_of_fan = + define `face_map_of_fan' (V,E) (v,w) = + if (E {v,w}) then (w,inverse_sigma_fan (vec 0) V E w v) else (v,w)`;; + +let edge_map_of_fan = + define `edge_map_of_fan (V,E) (v,w) = (w,v)`;; + +let node_map_of_fan = + define `node_map_of_fan (V,E) (v,w) = (v,sigma_fan (vec 0) V E v w)`;; + +(* text:hyp(V,E) *) + +let hyp_of_fano = define `hyp_of_fano (V,E) = + (let D = dart_set (V,E) in + hypermap( D ,(restrict (edge_map_of_fan (V,E)) D ) , + (restrict (node_map_of_fan (V,E)) D) , + (restrict (face_map_of_fan (V,E)) D) ))`;; + diff --git a/legacy/oldfan/ch_fan/fan_definition2.hl b/legacy/oldfan/ch_fan/fan_definition2.hl new file mode 100644 index 0000000..852250c --- /dev/null +++ b/legacy/oldfan/ch_fan/fan_definition2.hl @@ -0,0 +1,7 @@ +hypermap_tybij;; +type_of `tuple_hypermap`;; +type_of `hypermap`;; + +(* text:hyp(V,E) *) +let `hyp_of_fano (V,E) = + hypermap( , , , )`;; diff --git a/legacy/oldfan/ch_fan/fan_summary.hl b/legacy/oldfan/ch_fan/fan_summary.hl new file mode 100644 index 0000000..4d582a0 --- /dev/null +++ b/legacy/oldfan/ch_fan/fan_summary.hl @@ -0,0 +1,31 @@ +(* Fan summary file created by thales Dec 7, 2009 *) + +(* mark unfinished material *) + +let NOT_FOUND = + let NOT_IN_SYSTEM = define `NOT_IN_SYSTEM = F` in + let FALSE_ALL = prove(`NOT_IN_SYSTEM ==> x`,MESON_TAC[NOT_IN_SYSTEM]) in + fun x -> INST [(x,`x:bool`)] FALSE_ALL ;; + + +(* FAN DEFINED *) + + +let CTVTAQA_t = `! V E E'. FANO(V,E) /\ (E' SUBSET E) ==> FANO(V,E')`;; +let CTVTAQA = NOT_FOUND CTVTAQA_t ;; + +XOHLED;; + +(* remarks follow in text, formal proof? *) + +AAUHTVE;; (* contains the essential content of the lemma *) + +ULEKUUB;; (* from chapter on trig. phrased in terms of hypermaps. The lemma isn't exactly proved. *) + + +VBTIKLP;; + + +IBZWFFH;; + +(* JGIYDLE;; not done *) diff --git a/legacy/oldfan/definition_fan.hl b/legacy/oldfan/definition_fan.hl new file mode 100755 index 0000000..8899c8f --- /dev/null +++ b/legacy/oldfan/definition_fan.hl @@ -0,0 +1,231 @@ +module Definition_fan = struct + + +open Sphere;; +open Fan_defs;; + + +(* ========================================================================== *) +(* FAN *) +(* ========================================================================== *) + + + +let graph = new_definition `graph E <=> (!e. E e ==> (e HAS_SIZE 2))`;; + +let fan1 = new_definition`fan1(x,V,E):bool <=> FINITE V /\ ~(V SUBSET {}) `;; + +let fan2 = new_definition`fan2(x,V,E):bool <=> ~(x IN V)`;; + +let fan3=new_definition`fan3(x,V,E):bool <=> (!v. (v IN V) ==> cyclic_set {w | {v,w} IN E } x v)`;; + +let fan4 = new_definition`fan4(x,V,E):bool<=> (!e. (e IN E) ==> (aff_gt {x} e INTER V={}))`;; + +let fan5 = new_definition`fan5(x,V,E):bool<=> (!e f. (e IN E)/\ (f IN E) /\ ~(e=f) ==> (aff_gt {x} e INTER aff_gt {x} f ={}))`;; + +let fan = new_definition`fan(x,V,E)<=> ((UNIONS E) SUBSET V) /\ graph(E)/\ fan1(x,V,E)/\ fan2(x,V,E)/\ fan3(x,V,E)/\ fan4 (x,V,E) /\ fan5(x,V,E)`;; + +let base_point_fan=new_definition`base_point_fan (x,V,E)=x`;; + +let set_of_edge=new_definition`set_of_edge v V E={w|{v,w} IN E /\ w IN V}`;; + + +let fan6= new_definition`fan6(x,V,E):bool<=>(!e. (e IN E) ==> ~(collinear ({x} UNION e)))`;; + +let fan7= new_definition`fan7(x,V,E):bool<=> (!e1 e2. (e1 IN E UNION {{v}| v IN V}) /\ (e2 IN E UNION {{v}| v IN V}) +==> ((aff_ge {x} e1) INTER (aff_ge {x} e2) = aff_ge {x} (e1 INTER e2)))`;; + + + +let FAN=new_definition`FAN(x,V,E) <=> ((UNIONS E) SUBSET V) /\ graph(E) /\ fan1(x,V,E) /\ fan2(x,V,E)/\ +fan6(x,V,E)/\ fan7(x,V,E)`;; + +(* ========================================================================== *) +(* DEFINITION OF SIGMA_FAN AND INVERSE1_SIGMA_FAN (^_^) *) +(* ========================================================================== *) + + +let sigma_fan=new_definition`sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)= +(if (set_of_edge v V E = {u} ) then u + else (@(w:real^3). (w IN (set_of_edge v V E)) /\ ~(w=u) /\ +(!(w1:real^3). (w1 IN (set_of_edge v V E))/\ ~(w1=u) ==> azim x v u w <= azim x v u w1)))`;; + + +(* This extends sigma to have a larger domain + of R^3 rather than just V. It is the + identity outside V (compare the definition + of `permutes` ). *) + + + + +let extension_sigma_fan=new_definition`extension_sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)= +(if ~(u IN set_of_edge v V E ) then u + else (sigma_fan x V E v u))`;; + + + +let azim1=new_definition`azim1 (x:real^3) (v:real^3) (u:real^3) (w:real^3)= &2 * pi- azim x v u w`;; + + + +let inverse1_sigma_fan=new_definition`inverse1_sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3)= @g. (!w:real^3. {v,w} IN E==> {v, g w} IN E) +/\ (!w:real^3. {v,w} IN E==> (sigma_fan x V E v)( g w) =w) +/\ (!w:real^3. {v,w} IN E==> g (sigma_fan x V E v w) =w)`;; + + + +(* ========================================================================== *) +(* DEFINITION OF HYPERMAP OF FAN *) +(* ========================================================================== *) + + + +let d1_fan =new_definition` +d1_fan (x,V,E) ={(x':real^3,v:real^3,w:real^3,w1:real^3)| (x'=x) /\ ({v,w} IN E)/\ (w1 = sigma_fan x V E v w)}`;; + + +let d20_fan=new_definition`d20_fan (x,V,E)={ (x',v,v,v)| (x'=x) /\ (V v) /\ ((set_of_edge v V E) ={})}`;; + +let d_fan=new_definition`d_fan (x,V,E)= d1_fan (x,V,E) UNION d20_fan (x,V,E)`;; + + +let inverse_sigma_fan_alt=new_definition`inverse_sigma_fan_alt x V E v w = @a. sigma_fan x V E v a=w`;; + +let e_fan=new_definition` e_fan (x:real^3) V E = (\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). (x,w,v,(sigma_fan x V E w v)))`;; + + +let f_fan=new_definition`f_fan (x:real^3) V E = (\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). (x,w,(inverse_sigma_fan_alt x V E w v),v) )`;; + +(* This is the same as f_fan, + but easier to use *) + +let f1_fan=new_definition`f1_fan (x:real^3) V E = (\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). (x,w,(inverse1_sigma_fan x V E w v),v) )`;; + + + +let n_fan=new_definition`n_fan (x:real^3) V E =(\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). (x,v,(sigma_fan x V E v w),(sigma_fan x V E v (sigma_fan x V E v w))))`;; + +(* i_fan corrects the 4th coordinate to be + the dart *) + +let i_fan=new_definition`i_fan (x:real^3) V E=(\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). (x,v,w,(sigma_fan x V E v w)))`;; + +let pr1=new_definition`pr1=(\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). x)`;; + +let pr2=new_definition`pr2=(\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). v)`;; + +let pr3=new_definition`pr3=(\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). w)`;; + +let pr4=new_definition`pr4=(\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). w1)`;; + +(* if f = sigma, the power_map_points gives + iterates of sigma (for fixed x v) *) + + +let power_map_points= new_recursive_definition num_RECURSION `(power_map_points f x V E v w 0 = w)/\(power_map_points f x V E v w (SUC n)= f x V E v (power_map_points f x V E v w n))`;; + +(* This is the composition operator (o), + specialized to functions on 4-tuples *) + +let o_funs=new_definition`!(f:real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3) (g:real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3). o_funs f g =(\(x:real^3,y:real^3,z:real^3,t:real^3). f (pr1 (g(x,y,z,t)),pr2(g(x,y,z,t)),pr3(g(x,y,z,t)),pr4(g(x,y,z,t))))`;; + +(* powers of permutations *) + +let power_maps= new_recursive_definition num_RECURSION `(power_maps (f:real^3->(real^3->bool)->((real^3->bool)->bool)->real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) 0 = i_fan (x:real^3) V E) /\ (power_maps f x V E (SUC n)= o_funs (f x V E) (power_maps f x V E n))`;; + + +(* powers of node map *) + + + + +let power_n_fan= new_definition`power_n_fan x V E n=( \(x,v,w,w1). (x,v,(power_map_points sigma_fan x V E v w n),(power_map_points sigma_fan x V E v w (SUC n))))`;; + + +(* the node of a dart, in a special form + for fans *) + + +let a_node_fan=new_definition`a_node_fan x V E (x,v,w,w1)={a | ?n. a=(power_maps n_fan x V E n) (x,v,w,sigma_fan x V E v w)}`;; + + +(* The set X(V,E) *) + +let xfan= new_definition`xfan (x,V,E)={v | ?e. (E e)/\(v IN aff_ge {x} e)}`;; + +(* See comment by AS in fan_defs.hl. The correct definition is there. *) +let yfan_deprecated= new_definition`yfan_deprecated (x,V,E)={v:real^3 | ?e. ( E e )/\(~(v IN aff_ge {x} e))}`;; + + + + + + + +let hypermap_of_fanx = new_definition + `hypermap_of_fanx (x:real^3,V:real^3->bool,E:(real^3->bool)->bool) = + (let p = ( \ t. res (t x V E ) (d1_fan (x,V,E)) ) in + hypermap( d_fan (x,V,E) , p e_fan, p n_fan, p f_fan))`;; + + +let hypermap1_of_fanx = new_definition + `hypermap1_of_fanx (x:real^3,V:real^3->bool,E:(real^3->bool)->bool) = + (let p = ( \ t. res (t x V E ) (d1_fan (x,V,E)) ) in + hypermap( d_fan (x,V,E) , p e_fan, p n_fan, p f1_fan))`;; + + + + + +(* +W^0_{dart}(x,v,w...) +*) + +let w_dart_fan=new_definition`w_dart_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) ((y:real^3),(v:real^3),(w:real^3),(w1:real^3))= +if (CARD (set_of_edge v V E) > 1) then wedge x v w (sigma_fan x V E v w) +else +(if set_of_edge v V E ={w} then (UNIV:real^3->bool) DIFF aff_ge {x,v} {w} +else (if set_of_edge v V E ={} then (UNIV:real^3->bool) DIFF aff {x,v} else {}))`;; + + + + +let if_azims_fan= new_definition` +if_azims_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) + = if i = CARD(set_of_edge v V E) + then &2 * pi + else azim x v u (power_map_points sigma_fan x V E v u i)`;; + + + +(* rcone^0(x,v,h) *) + +let rcone_fan = new_definition `rcone_fan (x:real^3) (v:real^3) (h:real) = {y:real^3 | (y-x) dot (v-x) >(dist(y,x)*dist(v,x)*h)}`;; + + +(* +W^0_{dart}(x,epsilon) +*) + +let rw_dart_fan= new_definition`rw_dart_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) ((y:real^3),(v:real^3),(w:real^3),(w1:real^3)) (h:real)= w_dart_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) ((y:real^3),(v:real^3),(w:real^3),(w1:real^3)) INTER rcone_fan x v h`;; + + +(* +azim(x), x dart. +*) + + +let azim_fan=new_definition`azim_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) += if (CARD (set_of_edge v V E) > 1) then azim x v w (sigma_fan x V E v w) else &2* pi`;; + + + + +let fan81=new_definition`fan81 (x:real^3,(V:real^3->bool),(E:(real^3->bool)->bool)):bool<=>(!v:real^3 u:real^3. {v,u} IN E ==> azim_fan x V E v u bool),(E:(real^3->bool)->bool)):bool<=>(!v:real^3 u:real^3. {v,u} IN E ==> &0< azim x v u (sigma_fan x V E v u) /\ azim x v u (sigma_fan x V E v u) FINITE V /\ ~(V SUBSET {})`;; + + let fan_origin = new_definition `fan_origin (V,E) <=> ~(vec 0 IN V)`;; + + let fan_nonparallel = new_definition `fan_nonparallel (V,E) <=> (!e. (e IN E) ==> ~(collinear ({vec 0} UNION e)))`;; + + let fan_intersection = new_definition `fan_intersection(V,E):bool<=> (!e1 e2. (e1 IN E UNION {{v}| v IN V}) /\ (e2 IN E UNION {{v}| v IN V}) +==> ((aff_ge {vec 0} e1) INTER (aff_ge {vec 0} e2) = aff_ge {vec 0} (e1 INTER e2)))`;; + + let fan = new_definition `fan (V,E) <=> ((UNIONS E) SUBSET V) /\ graph(E) /\ fan_card(V,E) /\ fan_origin(V,E)/\ +fan_nonparallel(V,E)/\ fan_intersection(V,E)`;; + + +(* move to fan_misc.hl *) + let fan_of_FAN = prove(`!V E. FAN((vec 0), V,E) = fan(V,E)`, + REWRITE_TAC[fan,fan_origin,fan_card,fan_nonparallel,fan_intersection, + FAN, fan1,fan2,fan6,fan7] THEN MESON_TAC[] + );; + + + + let CTVTAQA_concl = `!V E E'. fan (V,E) /\ (E' SUBSET E) ==> fan (V,E')`;; + + let XOLHLED_concl = `!V E v. fan (V,E) /\ (v IN V) ==> cyclic_set(set_of_edge v V E) (vec 0) v`;; (* introduction.hl:XOHLED *) + + let AAUHTVE_concl = `!V E. fan(V,E) ==> + (hypermap_of_fan (V,E)) + (!d. d IN dart1_of_fan ==> (e_fan_pair (V,E) (e_fan_pair (V,E) d) = d)) /\ + (!d. d IN dart1_of_fan ==> (e_fan_pair (V,E) (e_fa + + + let PIIJBJK_concl= `!x V E . FAN (x,V,E) /\ fan81 (x,V,E) ==> conforming_fan (x,V,E)`;; + + + + +end;; + diff --git a/legacy/oldfan/fantopology.ml b/legacy/oldfan/fantopology.ml new file mode 100644 index 0000000..032257c --- /dev/null +++ b/legacy/oldfan/fantopology.ml @@ -0,0 +1,3042 @@ +(* ========================================================================= *) +(* Elementary topology in Euclidean space. *) +(* ========================================================================= *) + +parse_as_infix ("open_in",(12,"right"));; +parse_as_infix ("closed_in",(12,"right"));; + +let open_in = new_definition + `s open_in u <=> + s SUBSET u /\ + !x. x IN s ==> ?e. &0 < e /\ + !x'. x' IN u /\ dist(x',x) < e ==> x' IN s`;; + +let closed_in = new_definition + `s closed_in u <=> s SUBSET u /\ (u DIFF s) open_in u`;; + +let OPEN_IN_SUBSET = prove + (`!s u. s open_in u ==> s SUBSET u`, + SIMP_TAC[open_in]);; + +let OPEN_IN_EMPTY = prove + (`!u. {} open_in u`, + REWRITE_TAC[open_in; EMPTY_SUBSET; NOT_IN_EMPTY]);; + +let OPEN_IN_REFL = prove + (`!u. u open_in u`, + SIMP_TAC[open_in; SUBSET_REFL] THEN MESON_TAC[REAL_LT_01]);; + +let OPEN_IN_UNIONS = prove + (`!u. (!s. s IN f ==> s open_in u) ==> (UNIONS f) open_in u`, + REWRITE_TAC[open_in; SUBSET; IN_UNIONS] THEN MESON_TAC[]);; + +let OPEN_IN_UNION = prove + (`!s t u. s open_in u /\ t open_in u ==> (s UNION t) open_in u`, + REWRITE_TAC[open_in; IN_UNION; SUBSET] THEN MESON_TAC[]);; + +let OPEN_IN_INTER = prove + (`!s t u. s open_in u /\ t open_in u ==> (s INTER t) open_in u`, + REPEAT GEN_TAC THEN REWRITE_TAC[open_in; IN_INTER] THEN MATCH_MP_TAC(TAUT + `(a /\ c ==> e) /\ (b /\ d ==> f) ==> (a /\ b) /\ (c /\ d) ==> e /\ f`) THEN + CONJ_TAC THENL [SET_TAC[]; ALL_TAC] THEN + REWRITE_TAC[AND_FORALL_THM] THEN MATCH_MP_TAC MONO_FORALL THEN + GEN_TAC THEN DISCH_THEN(fun th -> STRIP_TAC THEN MP_TAC th) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN(CONJUNCTS_THEN2 + (X_CHOOSE_TAC `d1:real`) (X_CHOOSE_TAC `d2:real`)) THEN + MP_TAC(SPECL [`d1:real`; `d2:real`] REAL_DOWN2) THEN + ASM_MESON_TAC[REAL_LT_TRANS]);; + +let OPEN_IN_SUBOPEN = prove + (`!s u. s open_in u <=> + !x. x IN s ==> ?t. t open_in u /\ x IN t /\ t SUBSET s`, + REPEAT GEN_TAC THEN EQ_TAC THENL + [MESON_TAC[SUBSET_REFL]; REWRITE_TAC[open_in; SUBSET] THEN MESON_TAC[]]);; + +let CLOSED_IN_SUBSET = prove + (`!s u. s closed_in u ==> s SUBSET u`, + SIMP_TAC[closed_in]);; + +let CLOSED_IN_EMPTY = prove + (`!u. {} closed_in u`, + REWRITE_TAC[closed_in; EMPTY_SUBSET; DIFF_EMPTY; OPEN_IN_REFL]);; + +let CLOSED_IN_REFL = prove + (`!u. u closed_in u`, + REWRITE_TAC[closed_in; SUBSET_REFL; DIFF_EQ_EMPTY; OPEN_IN_EMPTY]);; + +let CLOSED_IN_UNION = prove + (`!s t u. s closed_in u /\ t closed_in u ==> (s UNION t) closed_in u`, + let lemma = prove + (`s DIFF (t UNION u) = (s DIFF t) INTER (s DIFF u)`,SET_TAC[]) in + SIMP_TAC[closed_in; lemma; OPEN_IN_INTER] THEN SET_TAC[]);; + +let CLOSED_IN_INTER = prove + (`!s t u. s closed_in u /\ t closed_in u ==> (s INTER t) closed_in u`, + let lemma = prove + (`s DIFF (t INTER u) = (s DIFF t) UNION (s DIFF u)`,SET_TAC[]) in + SIMP_TAC[closed_in; lemma; OPEN_IN_UNION] THEN SET_TAC[]);; + +let CLOSED_IN_INTERS = prove + (`!u. ~(f = {}) /\ (!s. s IN f ==> s closed_in u) ==> (INTERS f) closed_in u`, + let lemma = prove + (`s DIFF (INTERS f) = UNIONS {t | ?u. u IN f /\ (t = s DIFF u)}`, + GEN_REWRITE_TAC I [EXTENSION] THEN + REWRITE_TAC[IN_DIFF; IN_UNIONS; IN_INTERS; IN_ELIM_THM] THEN + MESON_TAC[IN_DIFF]) in + REWRITE_TAC[closed_in; lemma] THEN REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[OPEN_IN_UNIONS; IN_ELIM_THM; LEFT_IMP_EXISTS_THM] THEN + POP_ASSUM_LIST(MP_TAC o end_itlist CONJ) THEN SET_TAC[]);; + +let OPEN_IN_CLOSED_IN = prove + (`!s u. s SUBSET u ==> (s open_in u <=> (u DIFF s) closed_in u)`, + REPEAT GEN_TAC THEN REWRITE_TAC[closed_in; SUBSET_DIFF] THEN + REWRITE_TAC[open_in; IN_DIFF; IN_DIFF; SUBSET] THEN MESON_TAC[]);; + +let OPEN_IN_CLOSED_IN_EQ = prove + (`!s u. s open_in u <=> s SUBSET u /\ (u DIFF s) closed_in u`, + MESON_TAC[OPEN_IN_CLOSED_IN; OPEN_IN_SUBSET]);; + +let OPEN_IN_DIFF = prove + (`!s t u. s open_in u /\ t closed_in u ==> (s DIFF t) open_in u`, + let lemma = prove + (`s SUBSET u ==> ((s DIFF t) = s INTER (u DIFF t))`,SET_TAC[]) in + SIMP_TAC[OPEN_IN_SUBSET; lemma; closed_in; OPEN_IN_INTER]);; + +let CLOSED_IN_DIFF = prove + (`!s t u. s closed_in u /\ t open_in u ==> (s DIFF t) closed_in u`, + let lemma = prove + (`s SUBSET u ==> ((s DIFF t) = s INTER (u DIFF t))`,SET_TAC[]) in + SIMP_TAC[CLOSED_IN_SUBSET; lemma] THEN + SIMP_TAC[CLOSED_IN_INTER; GSYM OPEN_IN_CLOSED_IN; OPEN_IN_SUBSET]);; + + + +(* ------------------------------------------------------------------------- *) +(* The "universal" versions are what we use most of the time. *) +(* ------------------------------------------------------------------------- *) + +let open_def_fan = new_definition + `open_fan s <=> !x. x IN s ==> ?e. &0 < e /\ !x'. dist(x',x) < e ==> x' IN s`;; + +let closed_fan = new_definition + `closed_fan(s:real^N->bool) <=> open_fan(UNIV DIFF s)`;; + +let OPEN_IN_FAN = prove + (`!s:real^N->bool. open_fan s <=> s open_in UNIV`, + REWRITE_TAC[open_def_fan; open_in; SUBSET_UNIV; IN_UNIV]);; + + +let CLOSED_IN_FAN = prove + (`!s:real^N->bool. closed_fan s <=> s closed_in UNIV`, + REWRITE_TAC[closed_fan; closed_in; SUBSET_UNIV; OPEN_IN_FAN]);; + +let OPEN_EMPTY_FAN = prove + (`open_fan {}`, + REWRITE_TAC[OPEN_IN_FAN; OPEN_IN_EMPTY]);; + +let OPEN_UNIV_FAN = prove + (`open_fan(UNIV:real^N->bool)`, + REWRITE_TAC[OPEN_IN_FAN; OPEN_IN_REFL]);; + +let OPEN_UNIONS_FAN = prove + (`(!s. s IN f ==> open_fan s) ==> open_fan(UNIONS f)`, + REWRITE_TAC[OPEN_IN_FAN; OPEN_IN_UNIONS]);; + +let OPEN_UNION_FAN = prove + (`!s t. open_fan s /\ open_fan t ==> open_fan(s UNION t)`, + REWRITE_TAC[OPEN_IN_FAN; OPEN_IN_UNION]);; + +let OPEN_INTER_FAN = prove + (`!s t. open_fan s /\ open_fan t ==> open_fan(s INTER t)`, + REWRITE_TAC[OPEN_IN_FAN; OPEN_IN_INTER]);; + +let OPEN_SUBOPEN_FAN = prove + (`!s. open_fan s <=> !x. x IN s ==> ?t. open_fan t /\ x IN t /\ t SUBSET s`, +REWRITE_TAC[OPEN_IN_FAN; GSYM OPEN_IN_SUBOPEN]);; + +let CLOSED_EMPTY_FAN = prove + (`closed_fan {}`, + REWRITE_TAC[CLOSED_IN_FAN; CLOSED_IN_EMPTY]);; + +let CLOSED_UNIV_FAN = prove + (`closed_fan(UNIV:real^N->bool)`, + REWRITE_TAC[CLOSED_IN_FAN; CLOSED_IN_REFL]);; + +let CLOSED_UNION_FAN = prove + (`!s t. closed_fan s /\ closed_fan t ==> closed_fan(s UNION t)`, + REWRITE_TAC[CLOSED_IN_FAN; CLOSED_IN_UNION]);; + +let CLOSED_INTER_FAN = prove + (`!s t. closed_fan s /\ closed_fan t ==> closed_fan(s INTER t)`, + REWRITE_TAC[CLOSED_IN_FAN; CLOSED_IN_INTER]);; + +let lemma_closed_inters_fan1 = prove + (`s DIFF (INTERS f) = UNIONS {t | ?u. u IN f /\ (t = s DIFF u)}`, + GEN_REWRITE_TAC I [EXTENSION] THEN + REWRITE_TAC[IN_DIFF; IN_UNIONS; IN_INTERS; IN_ELIM_THM] THEN + MESON_TAC[IN_DIFF]);; + +let CLOSED_INTERS_FAN = prove( +`!f. (!s:real^N->bool. s IN f ==> closed_fan s) ==> closed_fan(INTERS f)`, + REWRITE_TAC[closed_fan; lemma_closed_inters_fan1] THEN REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[OPEN_UNIONS_FAN; IN_ELIM_THM; LEFT_IMP_EXISTS_THM]);; + +let OPEN_CLOSED_FAN = prove + (`!s:real^N->bool. open_fan s <=> closed_fan(UNIV DIFF s)`, + SIMP_TAC[OPEN_IN_FAN; CLOSED_IN_FAN; OPEN_IN_CLOSED_IN; SUBSET_UNIV]);; + +let OPEN_DIFF_FAN = prove + (`!s t. open_fan s /\ closed_fan t ==> open_fan(s DIFF t)`, + REWRITE_TAC[OPEN_IN_FAN; CLOSED_IN_FAN; OPEN_IN_DIFF]);; + +let CLOSED_DIFF_FAN = prove + (`!s t. closed_fan s /\ open_fan t ==> closed_fan(s DIFF t)`, + REWRITE_TAC[OPEN_IN_FAN; CLOSED_IN_FAN; CLOSED_IN_DIFF]);; + +let OPEN_INTERS_FAN = prove + (`!s. FINITE s /\ (!t. t IN s ==> open_fan t) ==> open_fan(INTERS s)`, +REWRITE_TAC[GSYM IMP_IMP] THEN MATCH_MP_TAC FINITE_INDUCT_STRONG + THEN REWRITE_TAC[INTERS_INSERT; INTERS_0; OPEN_UNIV_FAN; IN_INSERT] THEN + MESON_TAC[OPEN_INTER_FAN]);; + +let CLOSED_UNIONS_FAN = prove + (`!s. FINITE s /\ (!t. t IN s ==> closed_fan t) ==> closed_fan(UNIONS s)`, + REWRITE_TAC[GSYM IMP_IMP] THEN MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + REWRITE_TAC[UNIONS_INSERT; UNIONS_0; CLOSED_EMPTY_FAN; IN_INSERT] THEN + MESON_TAC[CLOSED_UNION_FAN]);; + + + +(* ------------------------------------------------------------------------- *) +(* Open balls. *) +(* ------------------------------------------------------------------------- *) + + +let ball_fan = new_definition + `ball_fan(x,e) = { y | dist(x,y) < e}`;; + +let IN_BALL_FAN = prove + (`!x y e. y IN (ball_fan(x,e)) <=> dist(x,y) < e`, + REWRITE_TAC[ball_fan; IN_ELIM_THM]);; + +let OPEN_BALL_FAN = prove + (`!x e. open_fan(ball_fan(x,e))`, + REWRITE_TAC[open_def_fan; ball_fan; IN_ELIM_THM] + THEN ONCE_REWRITE_TAC[DIST_SYM] THEN + MESON_TAC[REAL_SUB_LT; REAL_LT_SUB_LADD; REAL_ADD_SYM; REAL_LET_TRANS; + DIST_TRIANGLE_ALT]);; + +let CENTRE_IN_BALL = prove + (`!x e. x IN ball_fan(x,e) <=> &0 < e`, + MESON_TAC[IN_BALL_FAN; DIST_REFL]);; + +let OPEN_CONTAINS_BALL_FAN = prove + (`!s. open_fan s <=> !x. x IN s ==> ?e. &0 < e /\ ball_fan(x,e) SUBSET s`, + REWRITE_TAC[open_def_fan; SUBSET; IN_BALL_FAN] THEN REWRITE_TAC[DIST_SYM]);; + +let BALL_EQ_EMPTY_FAN = prove + (`!x e. (ball_fan(x,e) = {}) <=> e <= &0`, + REWRITE_TAC[EXTENSION; IN_BALL_FAN; NOT_IN_EMPTY; REAL_NOT_LT] THEN + MESON_TAC[DIST_POS_LE; REAL_LE_TRANS; DIST_REFL]);; + +(* ------------------------------------------------------------------------- *) +(* Basic "localization" results are handy for connectedness. *) +(* ------------------------------------------------------------------------- *) + + let OPEN_IN_OPEN_FAN = prove + (`!s:real^N->bool u. s open_in u <=> ?t. open_fan t /\ (s = u INTER t)`, + REPEAT GEN_TAC THEN EQ_TAC THENL + [REWRITE_TAC[open_in] THEN DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC); + DISCH_THEN(CHOOSE_THEN(CONJUNCTS_THEN2 MP_TAC SUBST_ALL_TAC)) THEN + REWRITE_TAC[open_def_fan; open_in; SUBSET; IN_INTER] THEN MESON_TAC[]] THEN + GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [RIGHT_IMP_EXISTS_THM] THEN + REWRITE_TAC[SKOLEM_THM] THEN DISCH_THEN(X_CHOOSE_TAC `d:real^N->real`) THEN + EXISTS_TAC `UNIONS {b | ?x:real^N. (b = ball_fan(x,d x)) /\ x IN s}` THEN + CONJ_TAC THENL + [MATCH_MP_TAC OPEN_UNIONS_FAN THEN + ASM_SIMP_TAC[IN_ELIM_THM; LEFT_IMP_EXISTS_THM; OPEN_BALL_FAN]; + GEN_REWRITE_TAC I [EXTENSION] THEN + REWRITE_TAC[IN_INTER; IN_UNIONS; IN_ELIM_THM] THEN + ASM_MESON_TAC[SUBSET; DIST_REFL; DIST_SYM; IN_BALL_FAN]]);; + +let CLOSED_IN_CLOSED_FAN = prove + (`!s:real^N->bool u. s closed_in u <=> ?t. closed_fan t /\ (s = u INTER t)`, + REPEAT GEN_TAC THEN REWRITE_TAC[closed_in; closed_fan; OPEN_IN_OPEN_FAN] THEN + GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [GSYM EXISTS_DIFF] THEN + REWRITE_TAC[RIGHT_AND_EXISTS_THM] THEN AP_TERM_TAC THEN ABS_TAC THEN + SET_TAC[]);; + +(* ------------------------------------------------------------------------- *) +(* These "transitivity" results are handy too. *) +(* ------------------------------------------------------------------------- *) + +let OPEN_IN_TRANS_FAN = prove + (`!s t u. s open_in t /\ t open_in u ==> s open_in u`, + ASM_MESON_TAC[OPEN_IN_OPEN_FAN; OPEN_INTER_FAN; INTER_ASSOC]);; + +let OPEN_IN_OPEN_TRANS_FAN = prove + (`!s t. s open_in t /\ open_fan t ==> open_fan s`, + MESON_TAC[OPEN_IN_FAN; OPEN_IN_TRANS_FAN; OPEN_UNIV_FAN]);; + +let CLOSED_IN_TRANS_FAN = prove + (`!s t u. s closed_in t /\ t closed_in u ==> s closed_in u`, + ASM_MESON_TAC[CLOSED_IN_CLOSED_FAN; CLOSED_INTER_FAN; INTER_ASSOC]);; + +let CLOSED_IN_CLOSED_TRANS_FAN = prove + (`!s t. s closed_in t /\ closed_fan t ==> closed_fan s`, + MESON_TAC[CLOSED_IN_FAN; CLOSED_IN_TRANS_FAN; CLOSED_UNIV_FAN]);; + +(* ------------------------------------------------------------------------- *) +(* Connectedness. *) +(* ------------------------------------------------------------------------- *) + + +let connected_fan = new_definition + `connected_fan s <=> + ~(?e1 e2. open_fan e1 /\ open_fan e2 /\ s SUBSET (e1 UNION e2) /\ + (e1 INTER e2 INTER s = {}) /\ + ~(e1 INTER s = {}) /\ ~(e2 INTER s = {}))`;; + +(* error in old file*) +let CONNECTED_CLOPEN_FAN = prove + (`!s. connected_fan s <=> + !t. t open_in s /\ t closed_in s ==> (t = {}) \/ (t = s)`, + GEN_TAC THEN REWRITE_TAC[connected_fan; OPEN_IN_OPEN_FAN; CLOSED_IN_CLOSED_FAN] THEN GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o BINDER_CONV) [GSYM EXISTS_DIFF] THEN + ONCE_REWRITE_TAC[TAUT `(~a <=> b) <=> (a <=> ~b)`] THEN REWRITE_TAC[NOT_FORALL_THM; NOT_IMP; GSYM CONJ_ASSOC; DE_MORGAN_THM] THEN + ONCE_REWRITE_TAC[TAUT `a /\ b /\ c /\ d <=> b /\ a /\ c /\ d`] THEN +REWRITE_TAC[LEFT_AND_EXISTS_THM] THEN REWRITE_TAC[GSYM closed] THEN + ONCE_REWRITE_TAC[SWAP_EXISTS_THM] THEN AP_TERM_TAC THEN ABS_TAC THEN + REWRITE_TAC[LEFT_AND_EXISTS_THM; RIGHT_AND_EXISTS_THM] THEN + ONCE_REWRITE_TAC[SWAP_EXISTS_THM] THEN AP_TERM_TAC THEN ABS_TAC THEN + REWRITE_TAC[TAUT `(a /\ b) /\ (c /\ d) /\ e <=> a /\ c /\ b /\ d /\ e`] THEN + REWRITE_TAC[RIGHT_EXISTS_AND_THM; UNWIND_THM2; closed_fan] +THEN AP_TERM_TAC +THEN AP_TERM_TAC +THEN SET_TAC[]);; + + +let CONNECTED_EMPTY_FAN = prove + (`connected_fan {}`, + REWRITE_TAC[connected_fan; INTER_EMPTY]);; + + +(* ------------------------------------------------------------------------- *) +(* Limit points. *) +(* ------------------------------------------------------------------------- *) + +parse_as_infix ("limit_point_of_fan",(12,"right"));; + + +let limit_point_of_fan = new_definition + `x limit_point_of_fan s <=> + !t. x IN t /\ open_fan t ==> ?y. ~(y = x) /\ y IN s /\ y IN t`;; + +let LIMPT_APPROACHABLE_FAN = prove + (`!x s. x limit_point_of_fan s <=> + !e. &0 < e ==> ?x'. x' IN s /\ ~(x' = x) /\ dist(x',x) < e`, + REPEAT GEN_TAC THEN REWRITE_TAC[limit_point_of_fan] THEN + MESON_TAC[open_def_fan; DIST_SYM; OPEN_BALL_FAN; CENTRE_IN_BALL; IN_BALL_FAN]);; + +let LIMPT_APPROACHABLE_LE_FAN = prove + (`!x s. x limit_point_of_fan s <=> + !e. &0 < e ==> ?x'. x' IN s /\ ~(x' = x) /\ dist(x',x) <= e`, + REPEAT GEN_TAC THEN REWRITE_TAC[LIMPT_APPROACHABLE_FAN] THEN + MATCH_MP_TAC(TAUT `(~a <=> ~b) ==> (a <=> b)`) THEN + REWRITE_TAC[NOT_FORALL_THM; NOT_IMP; NOT_EXISTS_THM] THEN + REWRITE_TAC[TAUT `~(a /\ b /\ c) <=> c ==> ~(a /\ b)`; APPROACHABLE_LT_LE]);; + +let LIMPT_UNIV_FAN = prove + (`!x:real^N. x limit_point_of_fan UNIV`, + GEN_TAC THEN REWRITE_TAC[LIMPT_APPROACHABLE_FAN; IN_UNIV] THEN + X_GEN_TAC `e:real` THEN DISCH_TAC THEN + SUBGOAL_THEN `?c:real^N. norm(c) = e / &2` CHOOSE_TAC THENL + [ASM_SIMP_TAC[VECTOR_CHOOSE_SIZE; REAL_HALF; REAL_LT_IMP_LE]; + ALL_TAC] THEN + EXISTS_TAC `x + c:real^N` THEN + REWRITE_TAC[dist; VECTOR_EQ_ADDR] THEN ASM_REWRITE_TAC[VECTOR_ADD_SUB] THEN + SUBGOAL_THEN `&0 < e / &2 /\ e / &2 < e` + (fun th -> ASM_MESON_TAC[th; NORM_0; REAL_LT_REFL]) THEN + SIMP_TAC[REAL_LT_LDIV_EQ; REAL_LT_RDIV_EQ; REAL_OF_NUM_LT; ARITH] THEN + UNDISCH_TAC `&0 < e` THEN REAL_ARITH_TAC);; + +let CLOSED_LIMPT_FAN = prove + (`!s. closed_fan s <=> !x. x limit_point_of_fan s ==> x IN s`, + REWRITE_TAC[closed_fan] THEN ONCE_REWRITE_TAC[OPEN_SUBOPEN_FAN] THEN + REWRITE_TAC[limit_point_of_fan; IN_DIFF; IN_UNIV; SUBSET] THEN MESON_TAC[]);; + +let LIMPT_SUBSET_FAN = prove + (`!x s t. x limit_point_of_fan s /\ s SUBSET t ==> x limit_point_of_fan t`, + REWRITE_TAC[limit_point_of_fan; SUBSET] THEN MESON_TAC[]);; + +let LIMPT_EMPTY_FAN = prove + (`!x. ~(x limit_point_of_fan {})`, + REWRITE_TAC[LIMPT_APPROACHABLE_FAN; NOT_IN_EMPTY] THEN MESON_TAC[REAL_LT_01]);; + +let CLOSED_POSITIVE_ORTHANT_FAN = prove + (`closed_fan {x:real^N | !i. 1 <= i /\ i <= dimindex(:N) + ==> &0 <= x$i}`, + REWRITE_TAC[CLOSED_LIMPT_FAN; LIMPT_APPROACHABLE_FAN] THEN + REWRITE_TAC[IN_ELIM_THM] THEN X_GEN_TAC `x:real^N` THEN DISCH_TAC THEN + X_GEN_TAC `i:num` THEN STRIP_TAC THEN REWRITE_TAC[GSYM REAL_NOT_LT] THEN + DISCH_TAC THEN FIRST_X_ASSUM(MP_TAC o SPEC `--(x:real^N $ i)`) THEN + ASM_REWRITE_TAC[REAL_LT_RNEG; REAL_ADD_LID; NOT_EXISTS_THM] THEN + X_GEN_TAC `y:real^N` THEN + MATCH_MP_TAC(TAUT `(a ==> ~c) ==> ~(a /\ b /\ c)`) THEN DISCH_TAC THEN + MATCH_MP_TAC(REAL_ARITH `!b. abs x <= b /\ b <= a ==> ~(a + x < &0)`) THEN + EXISTS_TAC `abs((y - x :real^N)$i)` THEN + ASM_SIMP_TAC[dist; COMPONENT_LE_NORM] THEN + ASM_SIMP_TAC[VECTOR_SUB_COMPONENT; REAL_ARITH + `x < &0 /\ &0 <= y ==> abs(x) <= abs(y - x)`]);; + +(* ------------------------------------------------------------------------- *) +(* Interior of a set. *) +(* ------------------------------------------------------------------------- *) + +let interior_fan = new_definition + `interior_fan s = {x | ?t. open_fan t /\ x IN t /\ t SUBSET s}`;; + +let INTERIOR_EQ_FAN = prove + (`!s. (interior_fan s = s) <=> open_fan s`, + GEN_TAC THEN REWRITE_TAC[EXTENSION; interior_fan; IN_ELIM_THM] THEN + GEN_REWRITE_TAC RAND_CONV [OPEN_SUBOPEN_FAN] THEN MESON_TAC[SUBSET]);; + +let INTERIOR_OPEN_FAN = prove + (`!s. open_fan s ==> (interior_fan s = s)`, + MESON_TAC[INTERIOR_EQ_FAN]);; + +let OPEN_INTERIOR_FAN = prove + (`!s. open_fan(interior_fan s)`, + GEN_TAC THEN REWRITE_TAC[interior_fan] THEN GEN_REWRITE_TAC I [OPEN_SUBOPEN_FAN] THEN + REWRITE_TAC[SUBSET; IN_ELIM_THM] THEN MESON_TAC[]);; + +let INTERIOR_INTERIOR_FAN = prove + (`!s. interior_fan(interior_fan s) = interior_fan s`, + MESON_TAC[INTERIOR_EQ_FAN; OPEN_INTERIOR_FAN]);; + +let INTERIOR_SUBSET_FAN = prove + (`!s. (interior_fan s) SUBSET s`, + REWRITE_TAC[SUBSET; interior_fan; IN_ELIM_THM] THEN MESON_TAC[]);; + +let SUBSET_INTERIOR_FAN = prove + (`!s t. s SUBSET t ==> (interior_fan s) SUBSET (interior_fan t)`, + REWRITE_TAC[interior_fan; SUBSET; IN_ELIM_THM] THEN MESON_TAC[]);; + +let INTERIOR_MAXIMAL_FAN = prove + (`!s t. t SUBSET s /\ open_fan t ==> t SUBSET (interior_fan s)`, + REWRITE_TAC[interior_fan; SUBSET; IN_ELIM_THM] THEN MESON_TAC[]);; + +let INTERIOR_UNIQUE_FAN = prove + (`!s t. t SUBSET s /\ open_fan t /\ (!t'. t' SUBSET s /\ open_fan t' ==> t' SUBSET t) + ==> (interior_fan s = t)`, + MESON_TAC[SUBSET_ANTISYM; INTERIOR_MAXIMAL_FAN; INTERIOR_SUBSET_FAN; + OPEN_INTERIOR_FAN]);; + +let IN_INTERIOR_FAN = prove + (`!x s. x IN interior_fan s <=> ?e. &0 < e /\ ball_fan(x,e) SUBSET s`, + REWRITE_TAC[interior_fan; IN_ELIM_THM] THEN + MESON_TAC[OPEN_CONTAINS_BALL_FAN; SUBSET_TRANS; CENTRE_IN_BALL; OPEN_BALL_FAN]);; + +(* ------------------------------------------------------------------------- *) +(* Closure of a set. *) +(* ------------------------------------------------------------------------- *) + +let closure_fan = new_definition + `closure_fan s = s UNION {x | x limit_point_of_fan s}`;; + +let CLOSURE_INTERIOR_FAN = prove + (`!s:real^N->bool. closure_fan s = UNIV DIFF (interior_fan (UNIV DIFF s))`, + REWRITE_TAC[EXTENSION; closure_fan; IN_UNION; IN_DIFF; IN_UNIV; interior_fan; + IN_ELIM_THM; limit_point_of_fan; SUBSET] THEN + MESON_TAC[]);; + +let lemma_interior_closure = prove(`!s t. UNIV DIFF (UNIV DIFF t) = t`,SET_TAC[]);; + +let INTERIOR_CLOSURE_FAN = prove + (`!s:real^N->bool. interior_fan s = UNIV DIFF (closure_fan (UNIV DIFF s))`, + REWRITE_TAC[CLOSURE_INTERIOR_FAN; lemma_interior_closure]);; + + let lemma_closed_closure = prove(`UNIV DIFF (UNIV DIFF s) = s`,SET_TAC[]);; + +let CLOSED_CLOSURE_FAN = prove + (`!s. closed_fan(closure_fan s)`, + REWRITE_TAC[closed_fan; CLOSURE_INTERIOR_FAN; lemma_closed_closure; OPEN_INTERIOR_FAN]);; + +let CLOSURE_HULL_FAN = prove + (`!s. closure_fan s = closed_fan hull s`, + GEN_TAC THEN MATCH_MP_TAC(GSYM HULL_UNIQUE) THEN + REWRITE_TAC[CLOSED_CLOSURE_FAN; SUBSET] THEN + REWRITE_TAC[closure_fan; IN_UNION; IN_ELIM_THM; CLOSED_LIMPT_FAN] THEN + MESON_TAC[limit_point_of_fan]);; + +let CLOSURE_EQ_FAN = prove + (`(closure_fan s = s) <=> closed_fan s`, + SIMP_TAC[CLOSURE_HULL_FAN; HULL_EQ; CLOSED_INTERS_FAN]);; + +let CLOSURE_CLOSED_FAN = prove + (`!s. closed_fan s ==> (closure_fan s = s)`, + MESON_TAC[CLOSURE_EQ_FAN]);; + +let CLOSURE_CLOSURE_FAN = prove + (`!s. closure_fan (closure_fan s) = closure_fan s`, + REWRITE_TAC[CLOSURE_HULL_FAN; HULL_HULL]);; + +let CLOSURE_SUBSET_FAN = prove + (`!s. s SUBSET (closure_fan s)`, + REWRITE_TAC[CLOSURE_HULL_FAN; HULL_SUBSET]);; + +let SUBSET_CLOSURE_FAN = prove + (`!s t. s SUBSET t ==> (closure_fan s) SUBSET (closure_fan t)`, + REWRITE_TAC[CLOSURE_HULL_FAN; HULL_MONO]);; + +let CLOSURE_MINIMAL_FAN = prove + (`!s t. s SUBSET t /\ closed_fan t ==> (closure_fan s) SUBSET t`, + REWRITE_TAC[HULL_MINIMAL; CLOSURE_HULL_FAN]);; + +let CLOSURE_UNIQUE_FAN = prove + (`!s t. s SUBSET t /\ closed_fan t /\ + (!t'. s SUBSET t' /\ closed_fan t' ==> t SUBSET t') + ==> (closure_fan s = t)`, + REWRITE_TAC[CLOSURE_HULL_FAN; HULL_UNIQUE]);; + +(* ------------------------------------------------------------------------- *) +(* Frontier (aka boundary). *) +(* ------------------------------------------------------------------------- *) + +let frontier_fan = new_definition + `frontier_fan s = (closure_fan s) DIFF (interior_fan s)`;; + +let FRONTIER_CLOSED_FAN = prove + (`!s. closed_fan(frontier_fan s)`, + SIMP_TAC[frontier_fan; CLOSED_DIFF_FAN; CLOSED_CLOSURE_FAN; OPEN_INTERIOR_FAN]);; + + let frotier_closures_fan = prove(`s DIFF (UNIV DIFF t) = s INTER t`,SET_TAC[]);; + +let FRONTIER_CLOSURES_FAN = prove + (`!s:real^N->bool. frontier_fan s = (closure_fan s) INTER (closure_fan(UNIV DIFF s))`, + REWRITE_TAC[frontier_fan; INTERIOR_CLOSURE_FAN; frotier_closures_fan]);; + + +let FRONTIER_STRADDLE_FAN = prove + (`!a:real^N s. + a IN frontier_fan s <=> + !e. &0 < e ==> (?x. x IN s /\ dist(a,x) < e) /\ + (?x. ~(x IN s) /\ dist(a,x) < e)`, + REPEAT GEN_TAC THEN REWRITE_TAC[FRONTIER_CLOSURES_FAN; IN_INTER] THEN + REWRITE_TAC[closure_fan; IN_UNION; IN_ELIM_THM; limit_point_of_fan; + IN_UNIV; IN_DIFF] THEN + ASM_MESON_TAC[IN_BALL_FAN; SUBSET; OPEN_CONTAINS_BALL_FAN; + CENTRE_IN_BALL; OPEN_BALL_FAN; DIST_REFL]);; + +let FRONTIER_SUBSET_CLOSED_FAN = prove + (`!s. closed_fan s ==> (frontier_fan s) SUBSET s`, + MESON_TAC[frontier_fan; CLOSURE_CLOSED_FAN; SUBSET_DIFF]);; + + + + + +(* ------------------------------------------------------------------------- *) +(* A variant of nets (slightly non-standard but good for our purposes). *) +(* ------------------------------------------------------------------------- *) + +let net_tybij_fan = new_type_definition "net_fan" ("mk_net_fan","netord_fan") + (prove + (`?g:A->A->bool. !x y. (!z. g z x ==> g z y) \/ (!z. g z y ==> g z x)`, + EXISTS_TAC `\x:A y:A. F` THEN REWRITE_TAC[]));; + +let NET_FAN = prove + (`!n x y. (!z. netord_fan n z x ==> netord_fan n z y) \/ + (!z. netord_fan n z y ==> netord_fan n z x)`, + REWRITE_TAC[net_tybij_fan; ETA_AX]);; + +let OLDNET_FAN = prove + (`!n x y. netord_fan n x x /\ netord_fan n y y + ==> ?z. netord_fan n z z /\ + !w. netord_fan n w z ==> netord_fan n w x /\ netord_fan n w y`, + MESON_TAC[NET_FAN]);; + +(* ------------------------------------------------------------------------- *) +(* Common nets and the "within" modifier for nets. *) +(* ------------------------------------------------------------------------- *) + +parse_as_infix("within_fan",(14,"right"));; +parse_as_infix("in_direction_fan",(14,"right"));; + +let at_fan = new_definition + `at_fan a = mk_net_fan(\x y. &0 < dist(x,a) /\ dist(x,a) <= dist(y,a))`;; + +let at_infinity_fan = new_definition + `at_infinity_fan = mk_net_fan(\x y. norm(x) >= norm(y))`;; + +let sequentially_fan = new_definition + `sequentially_fan = mk_net_fan(\m:num n. m >= n)`;; + +let within_fan = new_definition + `net_fan within_fan s = mk_net_fan(\x y. netord_fan net_fan x y /\ x IN s)`;; + +let in_direction_fan = new_definition + `a in_direction_fan v = (at_fan a) within_fan {b | ?c. &0 <= c /\ (b - a = c % v)}`;; + +(* ------------------------------------------------------------------------- *) +(* Prove that they are all nets. *) +(* ------------------------------------------------------------------------- *) + +let NET_PROVE_FAN_TAC[def] = + REWRITE_TAC[GSYM FUN_EQ_THM; def] THEN + REWRITE_TAC[ETA_AX] THEN + ASM_SIMP_TAC[GSYM(CONJUNCT2 net_tybij_fan)];; + +let AT_FAN = prove + (`!a:real^N x y. + netord_fan(at_fan a) x y <=> &0 < dist(x,a) /\ dist(x,a) <= dist(y,a)`, + GEN_TAC THEN NET_PROVE_FAN_TAC[at_fan] THEN + MESON_TAC[REAL_LE_TOTAL; REAL_LE_REFL; REAL_LE_TRANS; REAL_LET_TRANS]);; + +let AT_INFINITY_FAN = prove + (`!a:real^N x y. netord_fan at_infinity_fan x y <=> norm(x) >= norm(y)`, + GEN_TAC THEN NET_PROVE_FAN_TAC[at_infinity_fan] THEN + REWRITE_TAC[real_ge; REAL_LE_REFL] THEN + MESON_TAC[REAL_LE_TOTAL; REAL_LE_REFL; REAL_LE_TRANS]);; + +let SEQUENTIALLY_FAN = prove + (`!m n. netord_fan sequentially_fan m n <=> m >= n`, + NET_PROVE_FAN_TAC[sequentially_fan] THEN REWRITE_TAC[GE; LE_REFL] THEN + MESON_TAC[LE_CASES; LE_REFL; LE_TRANS]);; + +let WITHIN_FAN = prove + (`!n s x y. netord_fan(n within_fan s) x y <=> netord_fan n x y /\ x IN s`, + GEN_TAC THEN GEN_TAC THEN REWRITE_TAC[within_fan; GSYM FUN_EQ_THM] THEN + REWRITE_TAC[GSYM(CONJUNCT2 net_tybij_fan); ETA_AX] THEN + MESON_TAC[NET_FAN]);; + +let IN_DIRECTION_FAN = prove + (`!a v x y. netord_fan(a in_direction_fan v) x y <=> + &0 < dist(x,a) /\ dist(x,a) <= dist(y,a) /\ + ?c. &0 <= c /\ (x - a = c % v)`, + REWRITE_TAC[WITHIN_FAN; AT_FAN; in_direction_fan; IN_ELIM_THM; CONJ_ACI]);; + +let WITHIN_UNIV_FAN = prove + (`!x:real^N. at_fan x within_fan UNIV = at_fan x`, + REWRITE_TAC[within_fan; at_fan; IN_UNIV] THEN REWRITE_TAC[ETA_AX; net_tybij_fan]);; + +(* ------------------------------------------------------------------------- *) +(* Identify trivial limits, where we can't approach arbitrarily closely. *) +(* ------------------------------------------------------------------------- *) + +let trivial_limit_fan = new_definition + `trivial_limit_fan net_fan <=> + (!a:A b. a = b) \/ + ?a:A b. ~(a = b) /\ !x. ~(netord_fan(net_fan) x a) /\ ~(netord_fan(net_fan) x b)`;; + +let TRIVIAL_LIMIT_WITHIN_FAN = prove + (`!a:real^N. trivial_limit_fan (at_fan a within_fan s) <=> ~(a limit_point_of_fan s)`, + REWRITE_TAC[trivial_limit_fan; LIMPT_APPROACHABLE_LE_FAN; WITHIN_FAN; AT_FAN; DIST_NZ] THEN + REPEAT GEN_TAC THEN EQ_TAC THENL + [DISCH_THEN(DISJ_CASES_THEN MP_TAC) THENL + [MESON_TAC[REAL_LT_01; REAL_LT_REFL; VECTOR_CHOOSE_DIST; + DIST_REFL; REAL_LT_IMP_LE]; + DISCH_THEN(X_CHOOSE_THEN `b:real^N` (X_CHOOSE_THEN `c:real^N` + STRIP_ASSUME_TAC)) THEN + SUBGOAL_THEN `&0 < dist(a,b:real^N) \/ &0 < dist(a,c:real^N)` MP_TAC THEN + ASM_MESON_TAC[DIST_TRIANGLE; DIST_SYM; GSYM DIST_NZ; GSYM DIST_EQ_0; + REAL_ARITH `x <= &0 + &0 ==> ~(&0 < x)`]]; + REWRITE_TAC[NOT_FORALL_THM; NOT_IMP; LEFT_IMP_EXISTS_THM] THEN + X_GEN_TAC `e:real` THEN DISCH_TAC THEN DISJ2_TAC THEN + EXISTS_TAC `a:real^N` THEN + SUBGOAL_THEN `?b:real^N. dist(a,b) = e` MP_TAC THENL + [ASM_SIMP_TAC[VECTOR_CHOOSE_DIST; REAL_LT_IMP_LE]; ALL_TAC] THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `b:real^N` THEN + DISCH_THEN(SUBST_ALL_TAC o SYM) THEN + ASM_MESON_TAC[REAL_NOT_LE; DIST_REFL; DIST_NZ; DIST_SYM]]);; + + +let TRIVIAL_LIMIT_AT_FAN = prove + (`!a. ~(trivial_limit_fan (at_fan a))`, + ONCE_REWRITE_TAC[GSYM WITHIN_UNIV_FAN] THEN + REWRITE_TAC[TRIVIAL_LIMIT_WITHIN_FAN; LIMPT_UNIV_FAN]);; + +let TRIVIAL_LIMIT_AT_INFINITY_FAN = prove + (`~(trivial_limit_fan at_infinity_fan)`, + REWRITE_TAC[trivial_limit_fan; AT_INFINITY_FAN; real_ge] THEN + MESON_TAC[REAL_LE_REFL; VECTOR_CHOOSE_SIZE; REAL_LT_01; REAL_LT_LE]);; + +let TRIVIAL_LIMIT_SEQUENTIALLY_FAN = prove + (`~(trivial_limit_fan sequentially_fan)`, + REWRITE_TAC[trivial_limit_fan; SEQUENTIALLY_FAN] THEN + MESON_TAC[GE_REFL; NOT_SUC]);; + +(* ------------------------------------------------------------------------- *) +(* Limits, defined as vacuously true when the limit is trivial. *) +(* ------------------------------------------------------------------------- *) + +parse_as_infix("-->",(12,"right"));; + +let lim_fan = new_definition + `(f --> l) net_fan <=> + trivial_limit_fan net_fan \/ + !e. &0 < e ==> ?y. (?x. netord_fan(net_fan) x y) /\ + !x. netord_fan(net_fan) x y ==> dist(f(x),l) < e`;; + +(* ------------------------------------------------------------------------- *) +(* Show that they yield usual definitions in the various cases. *) +(* ------------------------------------------------------------------------- *) + +let LIM_WITHIN_LE_FAN = prove + (`!f:real^M->real^N l a s. + (f --> l)(at_fan a within_fan s) <=> + !e. &0 < e ==> ?d. &0 < d /\ + !x. x IN s /\ &0 < dist(x,a) /\ dist(x,a) <= d + ==> dist(f(x),l) < e`, + REPEAT GEN_TAC THEN + REWRITE_TAC[lim_fan; AT_FAN; WITHIN_FAN; TRIVIAL_LIMIT_WITHIN_FAN] THEN + REWRITE_TAC[LIMPT_APPROACHABLE_LE_FAN; DIST_NZ] THEN EQ_TAC THENL + [DISCH_THEN(DISJ_CASES_THEN MP_TAC) THENL + [ALL_TAC; MATCH_MP_TAC MONO_FORALL] THEN MESON_TAC[REAL_LTE_TRANS]; + MATCH_MP_TAC(TAUT `(b ==> a ==> c) ==> (a ==> ~b \/ c)`) THEN + DISCH_TAC THEN MATCH_MP_TAC MONO_FORALL THEN + X_GEN_TAC `e:real` THEN ASM_CASES_TAC `&0 < e` THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN(X_CHOOSE_THEN `d:real` STRIP_ASSUME_TAC) THEN + SUBGOAL_THEN `?b:real^M. dist(a,b) = d` MP_TAC THENL + [ASM_SIMP_TAC[VECTOR_CHOOSE_DIST; REAL_LT_IMP_LE]; ALL_TAC] THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `b:real^M` THEN + DISCH_THEN(SUBST_ALL_TAC o SYM) THEN + ASM_MESON_TAC[REAL_NOT_LE; DIST_REFL; DIST_NZ; DIST_SYM]]);; + +let LIM_WITHIN_FAN = prove + (`!f:real^M->real^N l a s. + (f --> l) (at_fan a within_fan s) <=> + !e. &0 < e + ==> ?d. &0 < d /\ + !x. x IN s /\ &0 < dist(x,a) /\ dist(x,a) < d + ==> dist(f(x),l) < e`, + REWRITE_TAC[LIM_WITHIN_LE_FAN] THEN + ONCE_REWRITE_TAC[TAUT `a /\ b /\ c ==> d <=> c ==> a /\ b ==> d`] THEN + REWRITE_TAC[APPROACHABLE_LT_LE]);; + +let LIM_AT_FAN = prove + (`!f l:real^N a:real^M. + (f --> l) (at_fan a) <=> + !e. &0 < e + ==> ?d. &0 < d /\ !x. &0 < dist(x,a) /\ dist(x,a) < d + ==> dist(f(x),l) < e`, + ONCE_REWRITE_TAC[GSYM WITHIN_UNIV_FAN] THEN + REWRITE_TAC[LIM_WITHIN_FAN; IN_UNIV]);; + +let LIM_AT_INFINITY_FAN = prove + (`!f l. (f --> l) at_infinity_fan <=> + !e. &0 < e ==> ?b. !x. norm(x) >= b ==> dist(f(x),l) < e`, + REWRITE_TAC[lim_fan; AT_INFINITY_FAN; TRIVIAL_LIMIT_AT_INFINITY_FAN] THEN + REPEAT GEN_TAC THEN EQ_TAC THENL [MESON_TAC[REAL_LE_REFL]; ALL_TAC] THEN + MATCH_MP_TAC MONO_FORALL THEN + MESON_TAC[real_ge; REAL_LE_REFL; VECTOR_CHOOSE_SIZE; + REAL_ARITH `&0 <= b \/ (!x. x >= &0 ==> x >= b)`]);; + +let LIM_SEQUENTIALLY_FAN = prove + (`!s l. (s --> l) sequentially_fan <=> + !e. &0 < e ==> ?N. !n. N <= n ==> dist(s(n),l) < e`, + REWRITE_TAC[lim_fan; SEQUENTIALLY_FAN; GE; LE_REFL; TRIVIAL_LIMIT_SEQUENTIALLY_FAN] THEN + MESON_TAC[LE_REFL]);; + +(* ------------------------------------------------------------------------- *) +(* The expected monotonicity property. *) +(* ------------------------------------------------------------------------- *) + +let LIM_WITHIN_SUBSET_FAN = prove + (`!f l a s. + (f --> l) (at_fan a within_fan s) /\ t SUBSET s ==> (f --> l) (at_fan a within_fan t)`, + REWRITE_TAC[LIM_WITHIN_FAN; SUBSET] THEN MESON_TAC[]);; + +(* ------------------------------------------------------------------------- *) +(* Interrelations between restricted and unrestricted limits. *) +(* ------------------------------------------------------------------------- *) + +let LIM_AT_WITHIN_FAN = prove + (`!f l a s. (f --> l)(at_fan a) ==> (f --> l)(at_fan a within_fan s)`, + REWRITE_TAC[LIM_AT_FAN; LIM_WITHIN_FAN] THEN MESON_TAC[]);; + +let LIM_WITHIN_OPEN_FAN = prove + (`!f l a:real^M s. + a IN s /\ open_fan s ==> ((f --> l)(at_fan a within_fan s) <=> (f --> l)(at_fan a))`, + REPEAT STRIP_TAC THEN EQ_TAC THEN SIMP_TAC[LIM_AT_WITHIN_FAN] THEN + REWRITE_TAC[LIM_AT_FAN; LIM_WITHIN_FAN] THEN + MATCH_MP_TAC MONO_FORALL THEN X_GEN_TAC `e:real` THEN + ASM_CASES_TAC `&0 < e` THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN(X_CHOOSE_THEN `d1:real` STRIP_ASSUME_TAC) THEN + FIRST_X_ASSUM(MP_TAC o SPEC `a:real^M` o GEN_REWRITE_RULE I [open_def_fan]) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN(X_CHOOSE_THEN `d2:real` STRIP_ASSUME_TAC) THEN + MP_TAC(SPECL [`d1:real`; `d2:real`] REAL_DOWN2) THEN ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[REAL_LT_TRANS]);; + +(* ------------------------------------------------------------------------- *) +(* Another limit point characterization. *) +(* ------------------------------------------------------------------------- *) + +let LIMPT_SEQUENTIAL_FAN = prove + (`!x:real^N s. + x limit_point_of_fan s <=> + ?f. (!n. f(n) IN (s DELETE x)) /\ (f --> x) sequentially_fan`, + REPEAT GEN_TAC THEN + REWRITE_TAC[LIMPT_APPROACHABLE_FAN; LIM_SEQUENTIALLY_FAN; IN_DELETE] THEN + EQ_TAC THENL [ALL_TAC; MESON_TAC[GE; LE_REFL]] THEN + DISCH_THEN(MP_TAC o GEN `n:num` o SPEC `inv(&n + &1)`) THEN + SIMP_TAC[REAL_LT_INV_EQ; REAL_ARITH `&0 <= x ==> &0 < x + &1`; REAL_POS] THEN + REWRITE_TAC[SKOLEM_THM] THEN MATCH_MP_TAC MONO_EXISTS THEN + X_GEN_TAC `f:num->real^N` THEN REWRITE_TAC[FORALL_AND_THM] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC FORALL_POS_MONO_1 THEN + CONJ_TAC THENL [MESON_TAC[REAL_LT_TRANS]; ALL_TAC] THEN + X_GEN_TAC `n:num` THEN EXISTS_TAC `n:num` THEN REWRITE_TAC[GSYM GE] THEN + MATCH_MP_TAC SEQ_MONO_LEMMA THEN ASM_REWRITE_TAC[] THEN + SIMP_TAC[REAL_LE_INV2; GE; REAL_OF_NUM_LE; REAL_LE_RADD; GE_REFL; + REAL_POS; REAL_ARITH `&0 <= x ==> &0 < x + &1`]);; + + +(* ------------------------------------------------------------------------- *) +(* Basic arithmetical combining theorems for limits. *) +(* ------------------------------------------------------------------------- *) + +let NET_DILEMMA_FAN = prove + (`!net. (?a. (?x. netord_fan net_fan x a) /\ (!x. netord_fan net_fan x a ==> P x)) /\ + (?b. (?x. netord_fan net_fan x b) /\ (!x. netord_fan net_fan x b ==> Q x)) + ==> ?c. (?x. netord_fan net_fan x c) /\ (!x. netord_fan net_fan x c ==> P x /\ Q x)`, + MESON_TAC[NET_FAN]);; + +let LIM_LINEAR_FAN = prove + (`!net_fan:(A)net_fan h f l. + (f --> l) net_fan /\ linear h ==> ((\x. h(f x)) --> h l) net_fan`, + REPEAT GEN_TAC THEN REWRITE_TAC[lim_fan] THEN + ASM_CASES_TAC `trivial_limit_fan (net_fan:(A)net_fan)` THEN ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN FIRST_ASSUM(X_CHOOSE_THEN `B:real` STRIP_ASSUME_TAC o + MATCH_MP LINEAR_BOUNDED_POS) THEN + X_GEN_TAC `e:real` THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `e / B`) THEN + ASM_SIMP_TAC[REAL_LT_DIV; dist; GSYM LINEAR_SUB; REAL_LT_RDIV_EQ] THEN + ASM_MESON_TAC[REAL_LET_TRANS; REAL_MUL_SYM]);; + +let LIM_CONST_FAN = prove + (`!net_fan a:real^N. ((\x. a) --> a) net_fan`, + SIMP_TAC[lim_fan; DIST_REFL; trivial_limit_fan] THEN MESON_TAC[]);; + +let LIM_CMUL_FAN = prove + (`!f l c. (f --> l) net_fan ==> ((\x. c % f x) --> c % l) net_fan`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC LIM_LINEAR_FAN THEN + ASM_REWRITE_TAC[REWRITE_RULE[ETA_AX] + (MATCH_MP LINEAR_COMPOSE_CMUL LINEAR_ID)]);; + +let LIM_NEG_FAN = prove + (`!f l:real^N. (f --> l) net_fan ==> ((\x. --(f x)) --> --l) net_fan`, + REPEAT GEN_TAC THEN REWRITE_TAC[lim_fan; dist] THEN + REWRITE_TAC[VECTOR_ARITH `--x - --y = --(x - y:real^N)`; NORM_NEG]);; +(* error in old file*) + +let LIM_ADD_FAN = prove + (`!net_fan:(A)net_fan f g l m. + (f --> l) net_fan /\ (g --> m) net_fan ==> ((\x. f(x) + g(x)) --> l + m) net_fan`, + REPEAT GEN_TAC THEN REWRITE_TAC[lim_fan] THEN + ASM_CASES_TAC `trivial_limit_fan (net_fan:(A)net_fan)` THEN + ASM_REWRITE_TAC[AND_FORALL_THM] THEN + DISCH_TAC THEN X_GEN_TAC `e:real` THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `e / &2`) THEN ASM_REWRITE_TAC[REAL_HALF] THEN + DISCH_THEN(MP_TAC o MATCH_MP NET_DILEMMA_FAN) THEN REWRITE_TAC[MONO_EXISTS] THEN + MESON_TAC[REAL_HALF; DIST_TRIANGLE_ADD; REAL_LT_ADD2; REAL_LET_TRANS]);; + + +let LIM_SUB_FAN = prove + (`!net_fan:(A)net_fan f g l m. + (f --> l) net_fan /\ (g --> m) net_fan ==> ((\x. f(x) - g(x)) --> l - m) net_fan`, + REWRITE_TAC[real_sub; VECTOR_SUB] THEN ASM_SIMP_TAC[LIM_ADD_FAN; LIM_NEG_FAN]);; + +let LIM_NULL_FAN = prove + (`!net_fan f l. (f --> l) net_fan <=> ((\x. f(x) - l) --> vec 0) net_fan`, + REWRITE_TAC[lim_fan; dist; VECTOR_SUB_RZERO]);; + +(* ------------------------------------------------------------------------- *) +(* We need some non-triviality conditions on these two. *) +(* ------------------------------------------------------------------------- *) + +let LIM_NORM_BOUND_FAN = prove + (`!f (l:real^N) net_fan:(A)net_fan. + ~(trivial_limit_fan net_fan) /\ (f --> l) net_fan /\ + (?y. (?x. netord_fan net_fan x y) /\ !x. netord_fan net_fan x y ==> norm(f x) <= e) + ==> norm(l) <= e`, + REPEAT GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + ASM_REWRITE_TAC[lim_fan] THEN DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + STRIP_TAC THEN REWRITE_TAC[GSYM REAL_NOT_LT] THEN + ONCE_REWRITE_TAC[GSYM REAL_SUB_LT] THEN DISCH_TAC THEN + SUBGOAL_THEN + `?x:A. dist(f(x):real^N,l) < norm(l:real^N) - e /\ norm(f x) <= e` + (CHOOSE_THEN MP_TAC) THENL [ASM_MESON_TAC[NET_FAN]; ALL_TAC] THEN + REWRITE_TAC[REAL_NOT_LT; REAL_LE_SUB_RADD; DE_MORGAN_THM; dist] THEN + ASM_MESON_TAC[NORM_TRIANGLE; NORM_SUB; VECTOR_SUB_ADD; + REAL_ARITH `nl <= nd + nx /\ nx <= e ==> nl <= nd + e`]);; + +let LIM_UNIQUE_FAN = prove + (`!net_fan:(A)net_fan f l:real^N l'. + ~(trivial_limit_fan net_fan) /\ (f --> l) net_fan /\ (f --> l') net_fan ==> (l = l')`, + REPEAT GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + DISCH_THEN(ASSUME_TAC o REWRITE_RULE[VECTOR_SUB_REFL] o MATCH_MP LIM_SUB_FAN) THEN + SUBGOAL_THEN `!e. &0 < e ==> norm(l:real^N - l') <= e` MP_TAC THENL + [GEN_TAC THEN DISCH_TAC THEN MATCH_MP_TAC LIM_NORM_BOUND_FAN THEN + MAP_EVERY EXISTS_TAC [`\x:A. vec 0 : real^N`; `net_fan:(A)net_fan`] THEN + ASM_SIMP_TAC[NORM_0; REAL_LT_IMP_LE] THEN ASM_MESON_TAC[trivial_limit_fan]; + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN REWRITE_TAC[DIST_NZ; dist] THEN + DISCH_TAC THEN DISCH_THEN(MP_TAC o SPEC `norm(l - l':real^N) / &2`) THEN + ASM_SIMP_TAC[REAL_LT_RDIV_EQ; REAL_LE_RDIV_EQ; REAL_OF_NUM_LT; ARITH] THEN + UNDISCH_TAC `&0 < norm(l - l':real^N)` THEN REAL_ARITH_TAC]);; + +(* ------------------------------------------------------------------------- *) +(* Limit under bilinear function (surprisingly tedious, but important). *) +(* ------------------------------------------------------------------------- *) + +let NORM_BOUND_LEMMA_FAN = prove + (`!x:real^M y:real^N e. + &0 < e + ==> ?d. &0 < d /\ + !x' y'. norm(x' - x) < d /\ norm(y' - y) < d + ==> norm(x') * norm(y' - y) + norm(x' - x) * norm(y) + < e`, + REPEAT STRIP_TAC THEN + EXISTS_TAC `min (&1) (e / &2 / (norm(x:real^M) + norm(y:real^N) + &1))` THEN + ASM_SIMP_TAC[REAL_LT_MIN; REAL_LT_DIV; REAL_OF_NUM_LT; NORM_POS_LE; ARITH; + REAL_LT_RDIV_EQ; REAL_ARITH `&0 <= x /\ &0 <= y ==> &0 < x + y + &1`] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC REAL_LET_TRANS THEN EXISTS_TAC + `(norm(x:real^M) + &1) * norm(y' - y) + norm(x' - x) * norm(y:real^N)` THEN + CONJ_TAC THENL + [REWRITE_TAC[REAL_LE_RADD; GSYM REAL_ADD_RDISTRIB] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN REWRITE_TAC[NORM_POS_LE] THEN + ASM_MESON_TAC[NORM_TRIANGLE_SUB; REAL_ARITH + `x' <= x + d /\ d < &1 ==> x' <= x + &1`]; + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `(norm(x:real^M) + norm(y:real^N) + &1) * + (norm(x' - x) + norm(y' - y))` THEN + CONJ_TAC THENL [ALL_TAC; REPEAT(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC] THEN + MATCH_MP_TAC(REAL_ARITH + `y * xd <= p * xd /\ x * yd <= p * yd + ==> x * yd + xd * y <= p * (xd + yd)`) THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_RMUL THEN REWRITE_TAC[NORM_POS_LE] THENL + [MP_TAC(ISPEC `x:real^M` NORM_POS_LE); + MP_TAC(ISPEC `y:real^N` NORM_POS_LE)] THEN + REAL_ARITH_TAC]);; + +(*let LIM_BILINEAR_FAN = prove + (;; +g`!net_fan:(A)net_fan (h:real^M->real^N->real^P) f g l m. + (f --> l) net_fan /\ (g --> m) net_fan /\ bilinear h + ==> ((\x. h (f x) (g x)) --> (h l m)) net_fan`;; +,;; + e( REPEAT GEN_TAC THEN REWRITE_TAC[lim_fan] THEN + ASM_CASES_TAC `trivial_limit_fan (net_fan:(A)net_fan)` THEN + ASM_REWRITE_TAC[AND_FORALL_THM; CONJ_ASSOC] THEN + STRIP_TAC THEN X_GEN_TAC `e:real` THEN DISCH_TAC THEN + FIRST_ASSUM(X_CHOOSE_THEN `B:real` STRIP_ASSUME_TAC o MATCH_MP + BILINEAR_BOUNDED_POS) THEN + MP_TAC(ISPECL [`l:real^M`; `m:real^N`; `e / B`] NORM_BOUND_LEMMA_FAN) THEN + ASM_SIMP_TAC[REAL_LT_RDIV_EQ; REAL_MUL_LZERO] THEN + DISCH_THEN(X_CHOOSE_THEN `d:real` STRIP_ASSUME_TAC) THEN + FIRST_X_ASSUM(MP_TAC o SPEC `d:real`) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN(MP_TAC o MATCH_MP NET_DILEMMA_FAN));; + THEN +;; +e(REWRITE_TAC[MONO_EXISTS]);; + +THEN;; + +e(X_GEN_TAC `c:A`);; +MONO_AND;; +e(DISCH_TAC);; + +e( MATCH_MP_TAC MONO_AND);; + +THEN REWRITE_TAC[] THEN + MATCH_MP_TAC MONO_FORALL THEN X_GEN_TAC `a:A` THEN + MATCH_MP_TAC MONO_IMP THEN REWRITE_TAC[dist] THEN + DISCH_THEN(fun th -> FIRST_X_ASSUM(ASSUME_TAC o C MATCH_MP th)) THEN + ONCE_REWRITE_TAC[VECTOR_ARITH + `h a b - h c d :real^N = (h a b - h a d) + (h a d - h c d)`] THEN + MATCH_MP_TAC NORM_TRIANGLE_LT THEN + ASM_SIMP_TAC[GSYM BILINEAR_LSUB; GSYM BILINEAR_RSUB] THEN + FIRST_X_ASSUM(fun th -> + MP_TAC(SPECL [`(f:A->real^M) a`; `(g:A->real^N) a - m`] th) THEN + MP_TAC(SPECL [`(f:A->real^M) a - l`; `m:real^N`] th)) THEN + REPEAT(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC);; +*) + +(* ------------------------------------------------------------------------- *) +(* These are special for limits out of the same vector space. *) +(* ------------------------------------------------------------------------- *) + +let LIM_WITHIN_ID_FAN = prove + (`!a s. ((\x. x) --> a) (at_fan a within_fan s)`, + REWRITE_TAC[LIM_WITHIN_FAN] THEN MESON_TAC[]);; + +let LIM_AT_ID_FAN = prove + (`!a. ((\x. x) --> a) (at_fan a)`, + ONCE_REWRITE_TAC[GSYM WITHIN_UNIV_FAN] THEN REWRITE_TAC[LIM_WITHIN_ID_FAN]);; + +let LIM_AT_ZERO_FAN = prove + (`!f:real^M->real^N l a. + (f --> l) (at_fan a) <=> ((\x. f(a + x)) --> l) (at_fan(vec 0))`, + REPEAT GEN_TAC THEN REWRITE_TAC[LIM_AT_FAN] THEN + AP_TERM_TAC THEN ABS_TAC THEN + ASM_CASES_TAC `&0 < e` THEN ASM_REWRITE_TAC[] THEN + AP_TERM_TAC THEN ABS_TAC THEN + ASM_CASES_TAC `&0 < d` THEN ASM_REWRITE_TAC[] THEN + EQ_TAC THEN DISCH_TAC THEN X_GEN_TAC `x:real^M` THENL + [FIRST_X_ASSUM(MP_TAC o SPEC `a + x:real^M`) THEN + REWRITE_TAC[dist; VECTOR_ADD_SUB; VECTOR_SUB_RZERO]; + FIRST_X_ASSUM(MP_TAC o SPEC `x - a:real^M`) THEN + REWRITE_TAC[dist; VECTOR_SUB_RZERO; VECTOR_SUB_ADD2]]);; + +(* ------------------------------------------------------------------------- *) +(* It's also sometimes useful to extract the limit point from the net. *) +(* ------------------------------------------------------------------------- *) + +let netlimit_fan = new_definition + `netlimit_fan net_fan = @a. !x. ~(netord_fan net_fan x a)`;; + +let NETLIMIT_WITHIN_FAN = prove + (`!a:real^N s. ~(trivial_limit_fan (at_fan a within_fan s)) + ==> (netlimit_fan (at_fan a within_fan s) = a)`, + REWRITE_TAC[trivial_limit_fan; netlimit_fan; AT_FAN; WITHIN_FAN; DE_MORGAN_THM] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC SELECT_UNIQUE THEN REWRITE_TAC[] THEN + SUBGOAL_THEN + `!x:real^N. ~(&0 < dist(x,a) /\ dist(x,a) <= dist(a,a) /\ x IN s)` + ASSUME_TAC THENL + [ASM_MESON_TAC[DIST_REFL; REAL_NOT_LT]; ASM_MESON_TAC[]]);; + +(* ------------------------------------------------------------------------- *) +(* Useful lemmas on closure and set of possible sequential limits. *) +(* ------------------------------------------------------------------------- *) + +let CLOSURE_SEQUENTIAL_FAN = prove + (`!s l:real^N. + l IN closure_fan(s) <=> ?x. (!n. x(n) IN s) /\ (x --> l) sequentially_fan`, + REWRITE_TAC[closure_fan; IN_UNION; LIMPT_SEQUENTIAL_FAN; IN_ELIM_THM; IN_DELETE] THEN + REPEAT GEN_TAC THEN MATCH_MP_TAC(TAUT + `((b ==> c) /\ (~a /\ c ==> b)) /\ (a ==> c) ==> (a \/ b <=> c)`) THEN + CONJ_TAC THENL [MESON_TAC[]; ALL_TAC] THEN DISCH_TAC THEN + EXISTS_TAC `\n:num. l:real^N` THEN + ASM_REWRITE_TAC[LIM_CONST_FAN]);; + +let CLOSED_SEQUENTIAL_LIMITS_FAN = prove + (`!s. closed_fan s <=> + !x l. (!n. x(n) IN s) /\ (x --> l) sequentially_fan ==> l IN s`, + MESON_TAC[CLOSURE_SEQUENTIAL_FAN; CLOSURE_CLOSED_FAN; + CLOSED_LIMPT_FAN; LIMPT_SEQUENTIAL_FAN; IN_DELETE]);; + +let CLOSURE_APPROACHABLE_FAN = prove + (`!x s. x IN closure_fan(s) <=> !e. &0 < e ==> ?y. y IN s /\ dist(y,x) < e`, + REWRITE_TAC[closure_fan; LIMPT_APPROACHABLE_FAN; IN_UNION; IN_ELIM_THM] THEN + MESON_TAC[DIST_REFL]);; + +let CLOSED_APPROACHABLE_FAN = prove + (`!x s. closed_fan s + ==> ((!e. &0 < e ==> ?y. y IN s /\ dist(y,x) < e) <=> x IN s)`, + MESON_TAC[CLOSURE_CLOSED_FAN; CLOSURE_APPROACHABLE_FAN]);; + +(* ------------------------------------------------------------------------- *) +(* Closed balls. *) +(* ------------------------------------------------------------------------- *) + +let cball_fan = new_definition + `cball_fan(x,e) = { y | dist(x,y) <= e}`;; + +let IN_CBALL_FAN = prove + (`!x y e. y IN cball_fan(x,e) <=> dist(x,y) <= e`, + REWRITE_TAC[cball_fan; IN_ELIM_THM]);; + +let CLOSED_CBALL_FAN = prove + (`!x:real^N e. closed_fan(cball_fan(x,e))`, + REWRITE_TAC[CLOSED_SEQUENTIAL_LIMITS_FAN; IN_CBALL_FAN; dist] THEN + GEN_TAC THEN GEN_TAC THEN X_GEN_TAC `s:num->real^N` THEN + X_GEN_TAC `y:real^N` THEN STRIP_TAC THEN + MATCH_MP_TAC(ISPEC `\n. x - (s:num->real^N) n` LIM_NORM_BOUND_FAN) THEN + EXISTS_TAC `sequentially_fan` THEN REWRITE_TAC[TRIVIAL_LIMIT_SEQUENTIALLY_FAN] THEN + ASM_SIMP_TAC[LIM_SUB_FAN; LIM_CONST_FAN; SEQUENTIALLY_FAN] THEN MESON_TAC[GE_REFL]);; + +let CENTRE_IN_CBALL_FAN = prove + (`!x e. x IN cball_fan(x,e) <=> &0 <= e`, + MESON_TAC[IN_CBALL_FAN; DIST_REFL]);; + +let BALL_SUBSET_CBALL_FAN = prove + (`!x e. ball_fan(x,e) SUBSET cball_fan(x,e)`, + REWRITE_TAC[IN_BALL_FAN; IN_CBALL_FAN; SUBSET] THEN REAL_ARITH_TAC);; + +let OPEN_CONTAINS_CBALL_FAN = prove + (`!s. open_fan s <=> !x. x IN s ==> ?e. &0 < e /\ cball_fan(x,e) SUBSET s`, + GEN_TAC THEN REWRITE_TAC[OPEN_CONTAINS_BALL_FAN] THEN EQ_TAC THENL + [ALL_TAC; ASM_MESON_TAC[SUBSET_TRANS; BALL_SUBSET_CBALL_FAN]] THEN + MATCH_MP_TAC MONO_FORALL THEN GEN_TAC THEN MATCH_MP_TAC MONO_IMP THEN + REWRITE_TAC[SUBSET; IN_BALL_FAN; IN_CBALL_FAN] THEN + DISCH_THEN(X_CHOOSE_THEN `e:real` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `e / &2` THEN ASM_REWRITE_TAC[REAL_HALF] THEN + SUBGOAL_THEN `e / &2 < e` (fun th -> ASM_MESON_TAC[th; REAL_LET_TRANS]) THEN + ASM_SIMP_TAC[REAL_LT_LDIV_EQ; REAL_OF_NUM_LT; ARITH] THEN + UNDISCH_TAC `&0 < e` THEN REAL_ARITH_TAC);; + +let IN_INTERIOR_CBALL_FAN = prove + (`!x s. x IN interior_fan s <=> ?e. &0 < e /\ cball_fan(x,e) SUBSET s`, + REWRITE_TAC[interior_fan; IN_ELIM_THM] THEN + MESON_TAC[OPEN_CONTAINS_CBALL_FAN; SUBSET_TRANS; + BALL_SUBSET_CBALL_FAN; CENTRE_IN_BALL; OPEN_BALL_FAN]);; + +let LIMPT_BALL_FAN = prove + (`!x:real^N y e. y limit_point_of_fan ball_fan(x,e) <=> &0 < e /\ y IN cball_fan(x,e)`, + REPEAT GEN_TAC THEN ASM_CASES_TAC `&0 < e` THENL + [ALL_TAC; ASM_MESON_TAC[LIMPT_EMPTY_FAN; REAL_NOT_LT; BALL_EQ_EMPTY_FAN]] THEN + ASM_REWRITE_TAC[] THEN EQ_TAC THENL + [MESON_TAC[CLOSED_CBALL_FAN; CLOSED_LIMPT_FAN; LIMPT_SUBSET_FAN; BALL_SUBSET_CBALL_FAN]; + REWRITE_TAC[IN_CBALL_FAN; LIMPT_APPROACHABLE_FAN; IN_BALL_FAN]] THEN + DISCH_TAC THEN X_GEN_TAC `d:real` THEN DISCH_TAC THEN + ASM_CASES_TAC `y:real^N = x` THEN ASM_REWRITE_TAC[DIST_NZ] THENL + [MP_TAC(SPECL [`d:real`; `e:real`] REAL_DOWN2) THEN + ASM_REWRITE_TAC[] THEN + GEN_MESON_TAC 0 40 1 [VECTOR_CHOOSE_DIST; DIST_SYM; REAL_LT_IMP_LE]; + ALL_TAC] THEN + MP_TAC(SPECL [`norm(y:real^N - x)`; `d:real`] REAL_DOWN2) THEN + RULE_ASSUM_TAC(REWRITE_RULE[DIST_NZ; dist]) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN(X_CHOOSE_THEN `k:real` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `(y:real^N) - (k / dist(y,x)) % (y - x)` THEN + REWRITE_TAC[dist; VECTOR_ARITH `(y - c % z) - y = --c % z`] THEN + REWRITE_TAC[NORM_MUL; REAL_ABS_DIV; REAL_ABS_NORM; REAL_ABS_NEG] THEN + ASM_SIMP_TAC[REAL_DIV_RMUL; REAL_LT_IMP_NZ] THEN + REWRITE_TAC[VECTOR_ARITH `x - (y - k % (y - x)) = (&1 - k) % (x - y)`] THEN + ASM_SIMP_TAC[REAL_ARITH `&0 < k ==> &0 < abs k`; NORM_MUL] THEN + ASM_SIMP_TAC[REAL_ARITH `&0 < k /\ k < d ==> abs k < d`] THEN + MATCH_MP_TAC REAL_LTE_TRANS THEN EXISTS_TAC `norm(x:real^N - y)` THEN + ASM_REWRITE_TAC[] THEN GEN_REWRITE_TAC RAND_CONV [GSYM REAL_MUL_LID] THEN + MATCH_MP_TAC REAL_LT_RMUL THEN CONJ_TAC THENL + [ALL_TAC; ASM_MESON_TAC[NORM_SUB]] THEN + MATCH_MP_TAC(REAL_ARITH `&0 < k /\ k < &1 ==> abs(&1 - k) < &1`) THEN + ASM_SIMP_TAC[REAL_LT_LDIV_EQ; REAL_LT_RDIV_EQ; REAL_MUL_LZERO; + REAL_MUL_LID]);; + +let CLOSURE_BALL_FAN = prove + (`!x:real^N e. &0 < e ==> (closure_fan(ball_fan(x,e)) = cball_fan(x,e))`, + SIMP_TAC[EXTENSION; closure_fan; IN_ELIM_THM; IN_UNION; LIMPT_BALL_FAN] THEN + REWRITE_TAC[IN_BALL_FAN; IN_CBALL_FAN] THEN REAL_ARITH_TAC);; + +let INTERIOR_CBALL_FAN = prove + (`!x:real^N e. &0 <= e ==> (interior_fan(cball_fan(x,e)) = ball_fan(x,e))`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC INTERIOR_UNIQUE_FAN THEN + REWRITE_TAC[BALL_SUBSET_CBALL_FAN; OPEN_BALL_FAN] THEN + X_GEN_TAC `t:real^N->bool` THEN + SIMP_TAC[SUBSET; IN_CBALL_FAN; IN_BALL_FAN; REAL_LT_LE] THEN STRIP_TAC THEN + X_GEN_TAC `z:real^N` THEN DISCH_TAC THEN DISCH_THEN(SUBST_ALL_TAC o SYM) THEN + FIRST_X_ASSUM(MP_TAC o SPEC `z:real^N` o GEN_REWRITE_RULE I [open_def_fan]) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN(X_CHOOSE_THEN `d:real` MP_TAC) THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + ASM_CASES_TAC `z:real^N = x` THENL + [FIRST_X_ASSUM SUBST_ALL_TAC THEN + FIRST_X_ASSUM(X_CHOOSE_TAC `k:real` o MATCH_MP REAL_DOWN) THEN + SUBGOAL_THEN `?w:real^N. dist(w,x) = k` STRIP_ASSUME_TAC THENL + [ASM_MESON_TAC[VECTOR_CHOOSE_DIST; DIST_SYM; REAL_LT_IMP_LE]; + ASM_MESON_TAC[REAL_NOT_LE; DIST_REFL; DIST_SYM]]; + RULE_ASSUM_TAC(REWRITE_RULE[DIST_NZ]) THEN + DISCH_THEN(MP_TAC o SPEC `z + ((d / &2) / dist(z,x)) % (z - x:real^N)`) THEN + REWRITE_TAC[dist; VECTOR_ADD_SUB; NORM_MUL; REAL_ABS_DIV; + REAL_ABS_NORM; REAL_ABS_NUM] THEN + ASM_SIMP_TAC[REAL_DIV_RMUL; GSYM dist; REAL_LT_IMP_NZ] THEN + ASM_SIMP_TAC[REAL_LT_LDIV_EQ; REAL_OF_NUM_LT; ARITH] THEN + ASM_REWRITE_TAC[REAL_ARITH `abs d < d * &2 <=> &0 < d`] THEN + DISCH_THEN(ANTE_RES_THEN MP_TAC) THEN REWRITE_TAC[dist] THEN + REWRITE_TAC[VECTOR_ARITH `x - (z + k % (z - x)) = (&1 + k) % (x - z)`] THEN + REWRITE_TAC[REAL_NOT_LE; NORM_MUL] THEN + GEN_REWRITE_TAC LAND_CONV [GSYM REAL_MUL_LID] THEN + ONCE_REWRITE_TAC[NORM_SUB] THEN + ASM_SIMP_TAC[REAL_LT_RMUL_EQ; GSYM dist] THEN + MATCH_MP_TAC(REAL_ARITH `&0 < x ==> &1 < abs(&1 + x)`) THEN + ONCE_REWRITE_TAC[DIST_SYM] THEN + ASM_SIMP_TAC[REAL_LT_DIV; REAL_OF_NUM_LT; ARITH]]);; + +let FRONTIER_BALL_FAN = prove + (`!a e. &0 < e + ==> (frontier_fan(ball_fan(a,e)) = {x | dist(a,x) = e})`, + SIMP_TAC[frontier_fan; CLOSURE_BALL_FAN; INTERIOR_OPEN_FAN; OPEN_BALL_FAN; + REAL_LT_IMP_LE] THEN + REWRITE_TAC[EXTENSION; IN_DIFF; IN_ELIM_THM; IN_BALL_FAN; IN_CBALL_FAN] THEN + REAL_ARITH_TAC);; + +let FRONTIER_CBALL_FAN = prove + (`!a e. &0 < e + ==> (frontier_fan(cball_fan(a,e)) = {x | dist(a,x) = e})`, + SIMP_TAC[frontier_fan; INTERIOR_CBALL_FAN; CLOSED_CBALL_FAN; CLOSURE_CLOSED_FAN; + REAL_LT_IMP_LE] THEN + REWRITE_TAC[EXTENSION; IN_DIFF; IN_ELIM_THM; IN_BALL_FAN; IN_CBALL_FAN] THEN + REAL_ARITH_TAC);; + +let SUBSET_BALL_FAN = prove + (`!x d e. d <= e ==> ball_fan(x,d) SUBSET ball_fan(x,e)`, + REWRITE_TAC[SUBSET; IN_BALL_FAN] THEN MESON_TAC[REAL_LTE_TRANS]);; + +let SUBSET_CBALL_FAN = prove + (`!x d e. d <= e ==> cball_fan(x,d) SUBSET cball_fan(x,e)`, + REWRITE_TAC[SUBSET; IN_CBALL_FAN] THEN MESON_TAC[REAL_LE_TRANS]);; + +(* ------------------------------------------------------------------------- *) +(* Boundedness. *) +(* ------------------------------------------------------------------------- *) + +let bounded_fan = new_definition + `bounded_fan s <=> ?a. !x:real^N. x IN s ==> norm(x) <= a`;; + +let BOUNDED_EMPTY_FAN = prove + (`bounded_fan {}`, + REWRITE_TAC[bounded_fan; NOT_IN_EMPTY]);; + +let BOUNDED_SUBSET_FAN = prove + (`!s t. bounded_fan t /\ s SUBSET t ==> bounded_fan s`, + MESON_TAC[bounded_fan; SUBSET]);; + +let BOUNDED_CLOSURE_FAN = prove + (`!s:real^N->bool. bounded_fan s ==> bounded_fan(closure_fan s)`, + REWRITE_TAC[bounded_fan; CLOSURE_SEQUENTIAL_FAN] THEN + MESON_TAC[LIM_NORM_BOUND_FAN; TRIVIAL_LIMIT_SEQUENTIALLY_FAN; trivial_limit_fan]);; + +let BOUNDED_CBALL_FAN = prove + (`!x:real^N e. bounded_fan(cball_fan(x,e))`, + REPEAT GEN_TAC THEN REWRITE_TAC[bounded_fan] THEN + EXISTS_TAC `norm(x:real^N) + e` THEN REWRITE_TAC[IN_CBALL_FAN; dist] THEN + MESON_TAC[NORM_SUB; NORM_TRIANGLE_SUB; + REAL_ARITH `b <= c + a ==> a <= e ==> b <= c + e`]);; + +let BOUNDED_BALL_FAN = prove + (`!x e. bounded_fan(ball_fan(x,e))`, + MESON_TAC[BALL_SUBSET_CBALL_FAN; BOUNDED_CBALL_FAN; BOUNDED_SUBSET_FAN]);; + +let FINITE_IMP_BOUNDED_FAN = prove + (`!s:real^N->bool. FINITE s ==> bounded_fan s`, + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN REWRITE_TAC[BOUNDED_EMPTY_FAN] THEN + REWRITE_TAC[bounded_fan; IN_INSERT] THEN X_GEN_TAC `x:real^N` THEN GEN_TAC THEN + DISCH_THEN(CONJUNCTS_THEN2 (X_CHOOSE_TAC `B:real`) STRIP_ASSUME_TAC) THEN + EXISTS_TAC `norm(x:real^N) + abs B` THEN REPEAT STRIP_TAC THEN + ASM_MESON_TAC[NORM_POS_LE; REAL_ARITH + `(y <= b /\ &0 <= x ==> y <= x + abs b) /\ x <= x + abs b`]);; + +let BOUNDED_UNION_FAN = prove + (`!s t. bounded_fan (s UNION t) <=> bounded_fan s /\ bounded_fan t`, + REWRITE_TAC[bounded_fan; IN_UNION] THEN MESON_TAC[REAL_LE_MAX]);; + +let BOUNDED_POS_FAN = prove + (`!s. bounded_fan s <=> ?b. &0 < b /\ !x. x IN s ==> norm(x) <= b`, + REWRITE_TAC[bounded_fan] THEN + MESON_TAC[REAL_ARITH `&0 < &1 + abs(y) /\ (x <= y ==> x <= &1 + abs(y))`]);; + +let BOUNDED_INTER_FAN = prove + (`!s t. bounded_fan s \/ bounded_fan t ==> bounded_fan (s INTER t)`, + MESON_TAC[BOUNDED_SUBSET_FAN; INTER_SUBSET]);; + +(* ------------------------------------------------------------------------- *) +(* Compactness (the definition is the one based on convegent subsequences). *) +(* ------------------------------------------------------------------------- *) + +let compact_fan = new_definition + `compact_fan s <=> + !f:num->real^N. + (!n. f(n) IN s) + ==> ?l r. l IN s /\ (!m n:num. m < n ==> r(m) < r(n)) /\ + ((f o r) --> l) sequentially_fan`;; + +let MONOTONE_BIGGER_FAN = prove + (`!r. (!m n. m < n ==> r(m) < r(n)) ==> !n:num. n <= r(n)`, + GEN_TAC THEN DISCH_TAC THEN INDUCT_TAC THEN + ASM_MESON_TAC[LE_0; ARITH_RULE `n <= m /\ m < p ==> SUC n <= p`; LT]);; + +let LIM_SUBSEQUENCE_FAN = prove + (`!s r. (!m n. m < n ==> r(m) < r(n)) /\ (s --> l) sequentially_fan + ==> (s o r --> l) sequentially_fan`, + REWRITE_TAC[LIM_SEQUENTIALLY_FAN; o_THM] THEN + MESON_TAC[MONOTONE_BIGGER_FAN; LE_TRANS]);; + +let MONOTONE_SUBSEQUENCE_FAN = prove + (`!s:num->real. ?r:num->num. + (!m n. m < n ==> r(m) < r(n)) /\ + ((!m n. m <= n ==> s(r(m)) <= s(r(n))) \/ + (!m n. m <= n ==> s(r(n)) <= s(r(m))))`, + GEN_TAC THEN + ASM_CASES_TAC `!n:num. ?p. n < p /\ !m. p <= m ==> s(m) <= s(p)` THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[NOT_FORALL_THM; NOT_EXISTS_THM; NOT_IMP; DE_MORGAN_THM] THEN + REWRITE_TAC[RIGHT_OR_EXISTS_THM; SKOLEM_THM; REAL_NOT_LE; REAL_NOT_LT] THENL + [ABBREV_TAC `N = 0`; DISCH_THEN(X_CHOOSE_THEN `N:num` MP_TAC)] THEN + DISCH_THEN(X_CHOOSE_THEN `next:num->num` STRIP_ASSUME_TAC) THEN + (MP_TAC o prove_recursive_functions_exist num_RECURSION) + `(r 0 = next(SUC N)) /\ (!n. r(SUC n) = next(r n))` THEN + MATCH_MP_TAC MONO_EXISTS THEN GEN_TAC THEN STRIP_TAC THENL + [SUBGOAL_THEN `!m:num n:num. r n <= m ==> s(m) <= s(r n):real` + ASSUME_TAC THEN TRY CONJ_TAC THEN TRY DISJ2_TAC THEN + GEN_TAC THEN INDUCT_TAC THEN ASM_REWRITE_TAC[LT; LE] THEN + ASM_MESON_TAC[REAL_LE_TRANS; REAL_LE_REFL; LT_IMP_LE; LT_TRANS]; + SUBGOAL_THEN `!n. N < (r:num->num) n` ASSUME_TAC THEN + TRY(CONJ_TAC THENL [GEN_TAC; DISJ1_TAC THEN GEN_TAC]) THEN + INDUCT_TAC THEN ASM_REWRITE_TAC[LT; LE] THEN + TRY STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[REAL_LT_REFL; LT_LE; LTE_TRANS; REAL_LE_REFL; + REAL_LT_LE; REAL_LE_TRANS; LT]]);; + +let CONVERGENT_BOUNDED_INCREASING_FAN = prove + (`!s:num->real b. (!m n. m <= n ==> s m <= s n) /\ (!n. abs(s n) <= b) + ==> ?l. !e. &0 < e ==> ?N. !n. N <= n ==> abs(s n - l) < e`, + REPEAT STRIP_TAC THEN + MP_TAC(SPEC `\x. ?n. (s:num->real) n = x` REAL_COMPLETE) THEN + REWRITE_TAC[] THEN ANTS_TAC THENL + [ASM_MESON_TAC[REAL_ARITH `abs(x) <= b ==> x <= b`]; ALL_TAC] THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `l:real` THEN STRIP_TAC THEN + X_GEN_TAC `e:real` THEN STRIP_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `l - e`) THEN + ASM_MESON_TAC[REAL_ARITH `&0 < e ==> ~(l <= l - e)`; + REAL_ARITH `x <= y /\ y <= l /\ ~(x <= l - e) ==> abs(y - l) < e`]);; + +let CONVERGENT_BOUNDED_MONOTONE_FAN = prove + (`!s:num->real b. (!n. abs(s n) <= b) /\ + ((!m n. m <= n ==> s m <= s n) \/ + (!m n. m <= n ==> s n <= s m)) + ==> ?l. !e. &0 < e ==> ?N. !n. N <= n ==> abs(s n - l) < e`, + REPEAT STRIP_TAC THENL + [ASM_MESON_TAC[CONVERGENT_BOUNDED_INCREASING_FAN]; ALL_TAC] THEN + MP_TAC(SPEC `\n. --((s:num->real) n)` CONVERGENT_BOUNDED_INCREASING_FAN) THEN + ASM_REWRITE_TAC[REAL_LE_NEG2; REAL_ABS_NEG] THEN + ASM_MESON_TAC[REAL_ARITH `abs(x - --l) = abs(--x - l)`]);; + +let COMPACT_REAL_LEMMA_FAN = prove + (`!s b. (!n:num. abs(s n) <= b) + ==> ?l r. (!m n:num. m < n ==> r(m) < r(n)) /\ + !e. &0 < e ==> ?N. !n. N <= n ==> abs(s(r n) - l) < e`, + REPEAT GEN_TAC THEN DISCH_TAC THEN ONCE_REWRITE_TAC[SWAP_EXISTS_THM] THEN + MP_TAC(SPEC `s:num->real` MONOTONE_SUBSEQUENCE_FAN) THEN + MATCH_MP_TAC MONO_EXISTS THEN GEN_TAC THEN DISCH_TAC THEN ASM_SIMP_TAC[] THEN + MATCH_MP_TAC CONVERGENT_BOUNDED_MONOTONE_FAN THEN ASM_MESON_TAC[]);; + +let COMPACT_LEMMA_FAN = prove + (`!s. bounded_fan s /\ (!n. (x:num->real^N) n IN s) + ==> !d. d <= dimindex(:N) + ==> ?l:real^N r. (!m n. m < n ==> r m < (r:num->num) n) /\ + !e. &0 < e + ==> ?N. !n i. 1 <= i /\ i <= d + ==> N <= n + ==> abs(x(r n)$i - l$i) < e`, + GEN_TAC THEN REWRITE_TAC[bounded_fan] THEN + DISCH_THEN(CONJUNCTS_THEN2 (X_CHOOSE_TAC `b:real`) ASSUME_TAC) THEN + INDUCT_TAC THENL + [REWRITE_TAC[ARITH_RULE `1 <= i /\ i <= 0 <=> F`; CONJ_ASSOC] THEN + DISCH_TAC THEN EXISTS_TAC `\n:num. n` THEN REWRITE_TAC[]; + ALL_TAC] THEN + DISCH_TAC THEN FIRST_X_ASSUM(MP_TAC o check (is_imp o concl)) THEN + ASM_SIMP_TAC[ARITH_RULE `SUC d <= n ==> d <= n`] THEN STRIP_TAC THEN + MP_TAC(SPECL [`\n:num. (x:num->real^N) (r n) $ (SUC d)`; `b:real`] + COMPACT_REAL_LEMMA_FAN) THEN + REWRITE_TAC[] THEN ANTS_TAC THENL + [ASM_MESON_TAC[REAL_LE_TRANS; COMPONENT_LE_NORM; ARITH_RULE `1 <= SUC n`]; + ALL_TAC] THEN + DISCH_THEN(X_CHOOSE_THEN `y:real` (X_CHOOSE_THEN `s:num->num` + STRIP_ASSUME_TAC)) THEN + MAP_EVERY EXISTS_TAC + [`(lambda k. if k = SUC d then y else (l:real^N)$k):real^N`; + `(r:num->num) o (s:num->num)`] THEN + ASM_SIMP_TAC[o_THM] THEN X_GEN_TAC `e:real` THEN DISCH_TAC THEN + REPEAT(FIRST_ASSUM(C UNDISCH_THEN (MP_TAC o SPEC `e:real`) o concl)) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN(X_CHOOSE_TAC `N1:num`) THEN + DISCH_THEN(X_CHOOSE_TAC `N2:num`) THEN EXISTS_TAC `N1 + N2:num` THEN + FIRST_ASSUM(fun th -> SIMP_TAC[LAMBDA_BETA; MATCH_MP(ARITH_RULE + `SUC d <= n ==> !i. 1 <= i /\ i <= SUC d ==> 1 <= i /\ i <= n`) th]) THEN + REWRITE_TAC[LE] THEN REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN TRY COND_CASES_TAC THEN + ASM_MESON_TAC[MONOTONE_BIGGER_FAN; LE_TRANS; + ARITH_RULE `N1 + N2 <= n ==> N2 <= n:num /\ N1 <= n`; + ARITH_RULE `1 <= i /\ i <= d /\ SUC d <= n + ==> ~(i = SUC d) /\ 1 <= SUC d /\ d <= n /\ i <= n`]);; + +let BOUNDED_CLOSED_IMP_COMPACT_FAN = prove + (`!s:real^N->bool. bounded_fan s /\ closed_fan s ==> compact_fan s`, + REPEAT STRIP_TAC THEN REWRITE_TAC[compact_fan] THEN + X_GEN_TAC `x:num->real^N` THEN DISCH_TAC THEN + MP_TAC(ISPEC `s:real^N->bool` COMPACT_LEMMA_FAN) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN(MP_TAC o SPEC `dimindex(:N)`) THEN + REWRITE_TAC[LE_REFL] THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `l:real^N` THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `r:num->num` THEN ASM_SIMP_TAC[] THEN + STRIP_TAC THEN MATCH_MP_TAC(TAUT `(b ==> a) /\ b ==> a /\ b`) THEN + REPEAT STRIP_TAC THENL + [FIRST_ASSUM(MATCH_MP_TAC o REWRITE_RULE[CLOSED_SEQUENTIAL_LIMITS_FAN]) THEN + EXISTS_TAC `(x:num->real^N) o (r:num->num)` THEN + ASM_REWRITE_TAC[o_THM]; + ALL_TAC] THEN + REWRITE_TAC[LIM_SEQUENTIALLY_FAN] THEN X_GEN_TAC `e:real` THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `e / &2 / &(dimindex(:N))`) THEN + ASM_SIMP_TAC[REAL_LT_DIV; REAL_OF_NUM_LT; DIMINDEX_NONZERO; + REAL_HALF; ARITH_RULE `0 < n <=> ~(n = 0)`] THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `N:num` THEN + REWRITE_TAC[dist] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC(MATCH_MP (REAL_ARITH `a <= b ==> b < e ==> a < e`) + (SPEC_ALL NORM_LE_L1)) THEN + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `sum (1..dimindex(:N)) + (\k. e / &2 / &(dimindex(:N)))` THEN + CONJ_TAC THENL + [MATCH_MP_TAC SUM_LE_NUMSEG THEN + SIMP_TAC[o_THM; LAMBDA_BETA; vector_sub] THEN + ASM_MESON_TAC[REAL_LT_IMP_LE; LE_TRANS]; + ASM_SIMP_TAC[SUM_CONST_NUMSEG; ADD_SUB; REAL_DIV_LMUL; REAL_OF_NUM_EQ; + DIMINDEX_NONZERO; REAL_LE_REFL; REAL_LT_LDIV_EQ; ARITH; + REAL_OF_NUM_LT; REAL_ARITH `x < x * &2 <=> &0 < x`]]);; + +(* ------------------------------------------------------------------------- *) +(* Completeness. *) +(* ------------------------------------------------------------------------- *) + +let cauchy_fan = new_definition + `cauchy_fan (s:num->real^N) <=> + !e. &0 < e ==> ?N. !m n. m >= N /\ n >= N ==> dist(s m,s n) < e`;; + +let complete_fan = new_definition + `complete_fan s <=> + !f:num->real^N. (!n. f n IN s) /\ cauchy_fan f + ==> ?l. l IN s /\ (f --> l) sequentially_fan`;; + +let CAUCHY_FAN = prove + (`!s:num->real^N. + cauchy_fan s <=> !e. &0 < e ==> ?N. !n. n >= N ==> dist(s n,s N) < e`, + REPEAT GEN_TAC THEN REWRITE_TAC[cauchy_fan; GE] THEN EQ_TAC THENL + [MESON_TAC[LE_REFL]; DISCH_TAC] THEN + X_GEN_TAC `e:real` THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `e / &2`) THEN ASM_REWRITE_TAC[REAL_HALF] THEN + MESON_TAC[DIST_TRIANGLE_HALF_L]);; + +let CONVERGENT_IMP_CAUCHY_FAN = prove + (`!s l. (s --> l) sequentially_fan ==> cauchy_fan s`, + REWRITE_TAC[LIM_SEQUENTIALLY_FAN; cauchy_fan] THEN + REPEAT GEN_TAC THEN DISCH_TAC THEN X_GEN_TAC `e:real` THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `e / &2`) THEN + ASM_SIMP_TAC[REAL_LT_DIV; REAL_OF_NUM_LT; ARITH] THEN + ASM_MESON_TAC[GE; LE_REFL; DIST_TRIANGLE_HALF_L]);; + +let CAUCHY_IMP_BOUNDED_FAN = prove + (`!s:num->real^N. cauchy_fan s ==> bounded_fan {y | ?n. y = s n}`, + REWRITE_TAC[cauchy_fan; bounded_fan; IN_ELIM_THM] THEN GEN_TAC THEN + DISCH_THEN(MP_TAC o SPEC `&1`) THEN REWRITE_TAC[REAL_LT_01] THEN + DISCH_THEN(X_CHOOSE_THEN `N:num` (MP_TAC o SPEC `N:num`)) THEN + REWRITE_TAC[GE_REFL] THEN DISCH_TAC THEN + SUBGOAL_THEN `!n:num. N <= n ==> norm(s n :real^N) <= norm(s N) + &1` + ASSUME_TAC THENL + [ASM_MESON_TAC[GE; dist; DIST_SYM; NORM_TRIANGLE_SUB; + REAL_ARITH `a <= b + c /\ c < &1 ==> a <= b + &1`]; + MP_TAC(ISPECL [`\n:num. norm(s n :real^N)`; `0..N`] + UPPER_BOUND_FINITE_SET_REAL) THEN + SIMP_TAC[FINITE_NUMSEG; IN_NUMSEG; LE_0; LEFT_IMP_EXISTS_THM] THEN + ASM_MESON_TAC[LE_CASES; + REAL_ARITH `x <= a \/ x <= b ==> x <= abs a + abs b`]]);; + + +let COMPACT_IMP_COMPLETE_FAN = prove + (`!s:real^N->bool. compact_fan s ==> complete_fan s`, + GEN_TAC THEN REWRITE_TAC[complete_fan; compact_fan] + THEN MATCH_MP_TAC MONO_FORALL + THEN X_GEN_TAC `f:num->real^N` + THEN DISCH_THEN(fun th -> STRIP_TAC THEN MP_TAC th)THEN + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC MONO_EXISTS THEN GEN_TAC THEN + DISCH_THEN(X_CHOOSE_THEN `r:num->num` STRIP_ASSUME_TAC) THEN + FIRST_X_ASSUM(MP_TAC o MATCH_MP (REWRITE_RULE[IMP_CONJ] LIM_ADD_FAN)) THEN + DISCH_THEN(MP_TAC o SPEC `\n. (f:num->real^N)(n) - f(r n)`) THEN + DISCH_THEN(MP_TAC o SPEC `vec 0: real^N`) THEN ASM_REWRITE_TAC[o_THM] THEN + REWRITE_TAC[VECTOR_ADD_RID; VECTOR_SUB_ADD2; ETA_AX] THEN + DISCH_THEN MATCH_MP_TAC THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [cauchy_fan]) THEN + REWRITE_TAC[GE; lim_fan; SEQUENTIALLY_FAN; dist; VECTOR_SUB_RZERO] THEN + SUBGOAL_THEN `!n:num. n <= r(n)` MP_TAC THENL [INDUCT_TAC; ALL_TAC] THEN + ASM_MESON_TAC[ LE_TRANS; LE_REFL; LT; LET_TRANS; LE_0; LE_SUC_LT]);; + +let COMPLETE_UNIV_FAN = prove + (`complete_fan(:real^N)`, + REWRITE_TAC[complete_fan; IN_UNIV] THEN X_GEN_TAC `x:num->real^N` THEN + DISCH_TAC THEN FIRST_ASSUM(MP_TAC o MATCH_MP CAUCHY_IMP_BOUNDED_FAN) THEN + DISCH_THEN(ASSUME_TAC o MATCH_MP BOUNDED_CLOSURE_FAN) THEN + MP_TAC(ISPEC `closure_fan {y:real^N | ?n:num. y = x n}` + COMPACT_IMP_COMPLETE_FAN) THEN + ASM_SIMP_TAC[BOUNDED_CLOSED_IMP_COMPACT_FAN; CLOSED_CLOSURE_FAN; complete_fan] THEN + DISCH_THEN(MP_TAC o SPEC `x:num->real^N`) THEN + ANTS_TAC THENL [ALL_TAC; MESON_TAC[]] THEN + ASM_REWRITE_TAC[closure_fan; IN_ELIM_THM; IN_UNION] THEN MESON_TAC[]);; + +let COMPLETE_EQ_CLOSED_FAN = prove + (`!s:real^N->bool. complete_fan s <=> closed_fan s`, + GEN_TAC THEN EQ_TAC THENL + [REWRITE_TAC[complete_fan; CLOSED_LIMPT_FAN; LIMPT_SEQUENTIAL_FAN] THEN + REWRITE_TAC[RIGHT_IMP_FORALL_THM] THEN GEN_TAC THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN MATCH_MP_TAC MONO_FORALL THEN + MESON_TAC[CONVERGENT_IMP_CAUCHY_FAN; IN_DELETE; LIM_UNIQUE_FAN; + TRIVIAL_LIMIT_SEQUENTIALLY_FAN]; + REWRITE_TAC[complete_fan; CLOSED_SEQUENTIAL_LIMITS_FAN] THEN DISCH_TAC THEN + X_GEN_TAC `f:num->real^N` THEN STRIP_TAC THEN + MP_TAC(REWRITE_RULE[complete_fan] COMPLETE_UNIV_FAN) THEN + DISCH_THEN(MP_TAC o SPEC `f:num->real^N`) THEN + ASM_REWRITE_TAC[IN_UNIV] THEN ASM_MESON_TAC[]]);; + +let CONVERGENT_EQ_CAUCHY_FAN = prove + (`!s. (?l. (s --> l) sequentially_fan) <=> cauchy_fan s`, + GEN_TAC THEN EQ_TAC THENL + [REWRITE_TAC[LEFT_IMP_EXISTS_THM; CONVERGENT_IMP_CAUCHY_FAN]; + REWRITE_TAC[REWRITE_RULE[complete_fan; IN_UNIV] COMPLETE_UNIV_FAN]]);; + +(* ------------------------------------------------------------------------- *) +(* Total boundedness. *) +(* ------------------------------------------------------------------------- *) + +let COMPACT_IMP_TOTALLY_BOUNDED_FAN = prove + (`!s:real^N->bool. + compact_fan s + ==> !e. &0 < e ==> ?k. FINITE k /\ k SUBSET s /\ + s SUBSET (UNIONS(IMAGE (\x. ball_fan(x,e)) k))`, + GEN_TAC THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[NOT_FORALL_THM; NOT_IMP; NOT_EXISTS_THM] THEN + REWRITE_TAC[TAUT `~(a /\ b /\ c) <=> a /\ b ==> ~c`; SUBSET] THEN + DISCH_THEN(X_CHOOSE_THEN `e:real` STRIP_ASSUME_TAC) THEN + SUBGOAL_THEN + `?x:num->real^N. !n. x(n) IN s /\ !m. m < n ==> ~(dist(x(m),x(n)) < e)` + MP_TAC THENL + [SUBGOAL_THEN + `?x:num->real^N. + !n. x(n) = @y. y IN s /\ !m. m < n ==> ~(dist(x(m),y) < e)` + MP_TAC THENL + [MATCH_MP_TAC(MATCH_MP WF_REC WF_num) THEN SIMP_TAC[]; ALL_TAC] THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `x:num->real^N` THEN + DISCH_TAC THEN MATCH_MP_TAC num_WF THEN X_GEN_TAC `n:num` THEN + FIRST_X_ASSUM(SUBST1_TAC o SPEC `n:num`) THEN STRIP_TAC THEN + CONV_TAC SELECT_CONV THEN + FIRST_X_ASSUM(MP_TAC o SPEC `IMAGE (x:num->real^N) {m | m < n}`) THEN + SIMP_TAC[FINITE_IMAGE; FINITE_NUMSEG_LT; NOT_FORALL_THM; NOT_IMP] THEN + REWRITE_TAC[IN_UNIONS; IN_IMAGE; IN_ELIM_THM] THEN ASM_MESON_TAC[IN_BALL_FAN]; + ALL_TAC] THEN + REWRITE_TAC[compact_fan; NOT_FORALL_THM] THEN MATCH_MP_TAC MONO_EXISTS THEN + X_GEN_TAC `x:num->real^N` THEN REWRITE_TAC[NOT_IMP; FORALL_AND_THM] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[NOT_EXISTS_THM] THEN REPEAT STRIP_TAC THEN + FIRST_X_ASSUM(MP_TAC o MATCH_MP CONVERGENT_IMP_CAUCHY_FAN) THEN + REWRITE_TAC[cauchy_fan] THEN DISCH_THEN(MP_TAC o SPEC `e:real`) THEN + ASM_REWRITE_TAC[o_THM; NOT_EXISTS_THM; NOT_IMP; NOT_FORALL_THM; NOT_IMP] THEN + X_GEN_TAC `N:num` THEN MAP_EVERY EXISTS_TAC [`N:num`; `SUC N`] THEN + CONJ_TAC THENL [ARITH_TAC; ASM_MESON_TAC[LT]]);; + +(* ------------------------------------------------------------------------- *) +(* Heine-Borel theorem (following Burkill & Burkill vol. 2) *) +(* ------------------------------------------------------------------------- *) + +let HEINE_BOREL_LEMMA_FAN = prove + (`!s:real^N->bool. + compact_fan s + ==> !t. s SUBSET (UNIONS t) /\ (!b. b IN t ==> open_fan b) + ==> ?e. &0 < e /\ + !x. x IN s ==> ?b. b IN t /\ ball_fan(x,e) SUBSET b`, + GEN_TAC THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[NOT_FORALL_THM; NOT_IMP; NOT_EXISTS_THM] THEN + DISCH_THEN(CHOOSE_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + DISCH_THEN(MP_TAC o GEN `n:num` o SPEC `&1 / (&n + &1)`) THEN + SIMP_TAC[REAL_LT_DIV; REAL_LT_01; REAL_ARITH `x <= y ==> x < y + &1`; + FORALL_AND_THM; REAL_POS; NOT_FORALL_THM; NOT_IMP; SKOLEM_THM; compact_fan] THEN + MATCH_MP_TAC MONO_EXISTS THEN GEN_TAC THEN REWRITE_TAC[NOT_EXISTS_THM] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN MAP_EVERY X_GEN_TAC [`l:real^N`; `r:num->num`] THEN + STRIP_TAC THEN + SUBGOAL_THEN `?b:real^N->bool. l IN b /\ b IN t` STRIP_ASSUME_TAC THENL + [ASM_MESON_TAC[SUBSET; IN_UNIONS]; ALL_TAC] THEN + SUBGOAL_THEN `?e. &0 < e /\ !z:real^N. dist(z,l) < e ==> z IN b` + STRIP_ASSUME_TAC THENL [ASM_MESON_TAC[open_def_fan]; ALL_TAC] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [LIM_SEQUENTIALLY_FAN]) THEN + DISCH_THEN(MP_TAC o SPEC `e / &2`) THEN + SUBGOAL_THEN `&0 < e / &2` (fun th -> + REWRITE_TAC[th; o_THM] THEN MP_TAC(GEN_REWRITE_RULE I [REAL_ARCH_INV] th)) + THENL [ASM_REWRITE_TAC[REAL_HALF]; ALL_TAC] THEN + DISCH_THEN(X_CHOOSE_THEN `N1:num` STRIP_ASSUME_TAC) THEN + DISCH_THEN(X_CHOOSE_THEN `N2:num` STRIP_ASSUME_TAC) THEN + FIRST_X_ASSUM(MP_TAC o SPECL + [`(r:num->num)(N1 + N2)`; `b:real^N->bool`]) THEN + ASM_REWRITE_TAC[SUBSET] THEN X_GEN_TAC `x:real^N` THEN DISCH_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN MATCH_MP_TAC DIST_TRIANGLE_HALF_R THEN + EXISTS_TAC `(f:num->real^N)(r(N1 + N2:num))` THEN CONJ_TAC THENL + [ALL_TAC; FIRST_X_ASSUM MATCH_MP_TAC THEN ARITH_TAC] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [IN_BALL_FAN]) THEN + MATCH_MP_TAC(REAL_ARITH `a <= b ==> x < a ==> x < b`) THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `inv(&N1)` THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE] THEN REWRITE_TAC[real_div; REAL_MUL_LID] THEN + MATCH_MP_TAC REAL_LE_INV2 THEN + REWRITE_TAC[REAL_OF_NUM_ADD; REAL_OF_NUM_LE; REAL_OF_NUM_LT] THEN + ASM_MESON_TAC[ARITH_RULE `(~(n = 0) ==> 0 < n)`; LE_ADD; MONOTONE_BIGGER_FAN; + LT_IMP_LE; LE_TRANS]);; + +let COMPACT_IMP_HEINE_BOREL_FAN = prove + (`!s. compact_fan (s:real^N->bool) + ==> !f. (!t. t IN f ==> open_fan t) /\ s SUBSET (UNIONS f) + ==> ?f'. f' SUBSET f /\ FINITE f' /\ s SUBSET (UNIONS f')`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM(MP_TAC o SPEC `f:(real^N->bool)->bool` o + MATCH_MP HEINE_BOREL_LEMMA_FAN) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN(X_CHOOSE_THEN `e:real` (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [RIGHT_IMP_EXISTS_THM] THEN + REWRITE_TAC[SKOLEM_THM; SUBSET; IN_BALL_FAN] THEN + DISCH_THEN(X_CHOOSE_TAC `B:real^N->real^N->bool`) THEN + FIRST_ASSUM(MP_TAC o SPEC `e:real` o + MATCH_MP COMPACT_IMP_TOTALLY_BOUNDED_FAN) THEN + ASM_REWRITE_TAC[SUBSET; IN_UNIONS; IN_IMAGE; IN_BALL_FAN] THEN + REWRITE_TAC[LEFT_AND_EXISTS_THM] THEN ONCE_REWRITE_TAC[SWAP_EXISTS_THM] THEN + REWRITE_TAC[GSYM CONJ_ASSOC; UNWIND_THM2] THEN + DISCH_THEN(X_CHOOSE_THEN `k:real^N->bool` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `IMAGE (B:real^N->real^N->bool) k` THEN + ASM_SIMP_TAC[FINITE_IMAGE; SUBSET; IN_IMAGE; LEFT_IMP_EXISTS_THM] THEN + ASM_MESON_TAC[IN_BALL_FAN]);; + +(* ------------------------------------------------------------------------- *) +(* Bolzano-Weierstrass property. *) +(* ------------------------------------------------------------------------- *) + +let HEINE_BOREL_IMP_BOLZANO_WEIERSTRASS_FAN = prove + (`!s:real^N->bool. + (!f. (!t. t IN f ==> open_fan t) /\ s SUBSET (UNIONS f) + ==> ?f'. f' SUBSET f /\ FINITE f' /\ s SUBSET (UNIONS f')) + ==> !t. INFINITE t /\ t SUBSET s ==> ?x. x IN s /\ x limit_point_of_fan t`, + REWRITE_TAC[RIGHT_IMP_FORALL_THM; limit_point_of_fan] THEN REPEAT GEN_TAC THEN + ONCE_REWRITE_TAC[TAUT `a ==> b /\ c ==> d <=> c ==> ~d ==> a ==> ~b`] THEN + REWRITE_TAC[NOT_FORALL_THM; NOT_EXISTS_THM; RIGHT_AND_FORALL_THM] THEN + DISCH_TAC THEN REWRITE_TAC[SKOLEM_THM] THEN + DISCH_THEN(X_CHOOSE_TAC `f:real^N->real^N->bool`) THEN + DISCH_THEN(MP_TAC o SPEC + `{t:real^N->bool | ?x:real^N. x IN s /\ (t = f x)}`) THEN + REWRITE_TAC[INFINITE; SUBSET; IN_ELIM_THM; IN_UNIONS; NOT_IMP] THEN + ANTS_TAC THENL [ASM_MESON_TAC[]; ALL_TAC] THEN + DISCH_THEN(X_CHOOSE_THEN `g:(real^N->bool)->bool` STRIP_ASSUME_TAC) THEN + MATCH_MP_TAC FINITE_SUBSET THEN + EXISTS_TAC `{x:real^N | x IN t /\ (f(x):real^N->bool) IN g}` THEN + CONJ_TAC THENL + [MATCH_MP_TAC FINITE_IMAGE_INJ_GENERAL THEN ASM_MESON_TAC[SUBSET]; + SIMP_TAC[SUBSET; IN_ELIM_THM] THEN X_GEN_TAC `u:real^N` THEN + DISCH_TAC THEN SUBGOAL_THEN `(u:real^N) IN s` ASSUME_TAC THEN + ASM_MESON_TAC[SUBSET]]);; + +(* ------------------------------------------------------------------------- *) +(* Complete the chain of compactness variants. *) +(* ------------------------------------------------------------------------- *) + +let BOLZANO_WEIERSTRASS_IMP_BOUNDED_FAN = prove + (`!s:real^N->bool. + (!t. INFINITE t /\ t SUBSET s ==> ?x. x IN s /\ x limit_point_of_fan t) + ==> bounded_fan s`, + GEN_TAC THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + SIMP_TAC[compact_fan; bounded_fan] THEN + REWRITE_TAC[NOT_FORALL_THM; NOT_EXISTS_THM; SKOLEM_THM; NOT_IMP] THEN + REWRITE_TAC[REAL_NOT_LE] THEN + DISCH_THEN(X_CHOOSE_TAC `beyond:real->real^N`) THEN + (MP_TAC o prove_recursive_functions_exist num_RECURSION) + `(f(0) = beyond(&0)) /\ + (!n. f(SUC n) = beyond(norm(f n) + &1):real^N)` THEN + DISCH_THEN(X_CHOOSE_THEN `x:num->real^N` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `IMAGE (x:num->real^N) UNIV` THEN + SUBGOAL_THEN + `!m n. m < n ==> norm((x:num->real^N) m) + &1 < norm(x n)` + ASSUME_TAC THENL + [GEN_TAC THEN INDUCT_TAC THEN ASM_REWRITE_TAC[LT] THEN + ASM_MESON_TAC[REAL_LT_TRANS; REAL_ARITH `b < b + &1`]; + ALL_TAC] THEN + SUBGOAL_THEN `!m n. ~(m = n) ==> &1 < dist((x:num->real^N) m,x n)` + ASSUME_TAC THENL + [REPEAT GEN_TAC THEN REPEAT_TCL DISJ_CASES_THEN ASSUME_TAC + (SPECL [`m:num`; `n:num`] LT_CASES) THEN + ASM_MESON_TAC[dist; LT_CASES; NORM_TRIANGLE_SUB; NORM_SUB; + REAL_ARITH `x + &1 < y /\ y <= x + d ==> &1 < d`]; + ALL_TAC] THEN + REPEAT CONJ_TAC THENL + [ASM_MESON_TAC[INFINITE_IMAGE_INJ; num_INFINITE; DIST_REFL; + REAL_ARITH `~(&1 < &0)`]; + REWRITE_TAC[SUBSET; IN_IMAGE; IN_UNIV; LEFT_IMP_EXISTS_THM] THEN + GEN_TAC THEN INDUCT_TAC THEN ASM_MESON_TAC[]; + ALL_TAC] THEN + X_GEN_TAC `l:real^N` THEN REWRITE_TAC[LIMPT_APPROACHABLE_FAN] THEN + REWRITE_TAC[IN_IMAGE; IN_UNIV; LEFT_AND_EXISTS_THM] THEN + ONCE_REWRITE_TAC[SWAP_EXISTS_THM] THEN REWRITE_TAC[UNWIND_THM2] THEN + STRIP_TAC THEN FIRST_ASSUM(MP_TAC o SPEC `&1 / &2`) THEN + CONV_TAC REAL_RAT_REDUCE_CONV THEN + DISCH_THEN(X_CHOOSE_THEN `k:num` STRIP_ASSUME_TAC) THEN + FIRST_X_ASSUM(MP_TAC o SPEC `dist((x:num->real^N) k,l)`) THEN + ASM_SIMP_TAC[DIST_POS_LT] THEN + DISCH_THEN(X_CHOOSE_THEN `m:num` STRIP_ASSUME_TAC) THEN + ASM_CASES_TAC `m:num = k` THEN + ASM_MESON_TAC[DIST_TRIANGLE_HALF_L; REAL_LT_TRANS; REAL_LT_REFL]);; + +let SEQUENCE_INFINITE_LEMMA_FAN = prove + (`!f l. (!n. ~(f(n) = l)) /\ (f --> l) sequentially_fan + ==> INFINITE {y:real^N | ?n. y = f n}`, + REWRITE_TAC[INFINITE] THEN REPEAT STRIP_TAC THEN MP_TAC(ISPEC + `IMAGE (\y:real^N. dist(y,l)) {y | ?n:num. y = f n}` INF_FINITE) THEN + ASM_SIMP_TAC[GSYM MEMBER_NOT_EMPTY; IN_IMAGE; FINITE_IMAGE; IN_ELIM_THM] THEN + ASM_MESON_TAC[LIM_SEQUENTIALLY_FAN; LE_REFL; REAL_NOT_LE; DIST_POS_LT]);; + +let SEQUENCE_UNIQUE_LIMPT_FAN = prove + (`!f l. (!n. ~(f(n) = l)) /\ (f --> l) sequentially_fan + ==> !l'. l' limit_point_of_fan {y:real^N | ?n. y = f n} + ==> (l' = l)`, + REWRITE_TAC[LIMPT_APPROACHABLE_FAN; IN_ELIM_THM; LEFT_AND_EXISTS_THM] THEN + ONCE_REWRITE_TAC[SWAP_EXISTS_THM] THEN REWRITE_TAC[UNWIND_THM2] THEN + REPEAT STRIP_TAC THEN ABBREV_TAC `e = dist(l':real^N,l)` THEN + SUBGOAL_THEN `~(&0 < e)` (fun th -> ASM_MESON_TAC[th; DIST_POS_LT]) THEN + DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [LIM_SEQUENTIALLY_FAN]) THEN + DISCH_THEN(MP_TAC o SPEC `e / &2`) THEN ASM_REWRITE_TAC[REAL_HALF] THEN + DISCH_THEN(X_CHOOSE_TAC `N:num`) THEN MP_TAC(ISPEC + `(e / &2) INSERT + (IMAGE (\n. if dist((f:num->real^N) n,l') = &0 then e / &2 + else dist((f:num->real^N) n,l')) + {n | n < N})` + INF_FINITE) THEN + ASM_SIMP_TAC[FINITE_RULES; FINITE_IMAGE; FINITE_NUMSEG_LT; + NOT_EMPTY_INSERT] THEN + ABBREV_TAC(mk_eq(`d:real`,mk_comb(`inf`, + `(e / &2) INSERT + (IMAGE (\n. if dist((f:num->real^N) n,l') = &0 then e / &2 + else dist((f:num->real^N) n,l')) + {n | n < N})` +))) THEN + REWRITE_TAC[IN_INSERT; IN_IMAGE; IN_ELIM_THM] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + SUBGOAL_THEN `&0 < d` ASSUME_TAC THENL + [FIRST_X_ASSUM(DISJ_CASES_THEN STRIP_ASSUME_TAC) THEN ASM_REWRITE_TAC[] THEN + REPEAT COND_CASES_TAC THEN + ASM_MESON_TAC[REAL_HALF; REAL_LT_LE; DIST_POS_LE]; + ALL_TAC] THEN + FIRST_X_ASSUM(MP_TAC o SPEC `d:real`) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN(X_CHOOSE_THEN `k:num` STRIP_ASSUME_TAC) THEN + DISCH_THEN(fun th -> MP_TAC(SPEC `e / &2` th) THEN + MP_TAC(SPEC `dist((f:num->real^N) k,l')` th)) THEN + ASM_REWRITE_TAC[GSYM REAL_NOT_LT; DE_MORGAN_THM] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + REWRITE_TAC[NOT_EXISTS_THM] THEN DISCH_THEN(MP_TAC o SPEC `k:num`) THEN + ASM_REWRITE_TAC[DIST_EQ_0; NOT_LT; GSYM REAL_NOT_LE] THEN + ASM_MESON_TAC[DIST_TRIANGLE_HALF_R; REAL_LT_REFL; REAL_LTE_TRANS]);; + +let BOLZANO_WEIERSTRASS_IMP_CLOSED_FAN = prove + (`!s:real^N->bool. + (!t. INFINITE t /\ t SUBSET s ==> ?x. x IN s /\ x limit_point_of_fan t) + ==> closed_fan s`, + REPEAT STRIP_TAC THEN REWRITE_TAC[CLOSED_SEQUENTIAL_LIMITS_FAN] THEN + MAP_EVERY X_GEN_TAC [`f:num->real^N`; `l:real^N`] THEN + DISCH_TAC THEN + MAP_EVERY (MP_TAC o ISPECL [`f:num->real^N`; `l:real^N`]) + [SEQUENCE_UNIQUE_LIMPT_FAN; SEQUENCE_INFINITE_LEMMA_FAN] THEN + MATCH_MP_TAC(TAUT + `(~d ==> a /\ ~(b /\ c)) ==> (a ==> b) ==> (a ==> c) ==> d`) THEN + DISCH_TAC THEN CONJ_TAC THENL [ASM_MESON_TAC[]; STRIP_TAC] THEN + FIRST_X_ASSUM(MP_TAC o SPEC `{y:real^N | ?n:num. y = f n}`) THEN + ASM_REWRITE_TAC[NOT_IMP] THEN CONJ_TAC THENL + [REWRITE_TAC[SUBSET; IN_ELIM_THM]; + ABBREV_TAC `t = {y:real^N | ?n:num. y = f n}`] THEN + ASM_MESON_TAC[]);; + +(* ------------------------------------------------------------------------- *) +(* Hence express everything as an equivalence. *) +(* ------------------------------------------------------------------------- *) + +let COMPACT_EQ_HEINE_BOREL_FAN = prove + (`!s:real^N->bool. + compact_fan s <=> + !f. (!t. t IN f ==> open_fan t) /\ s SUBSET (UNIONS f) + ==> ?f'. f' SUBSET f /\ FINITE f' /\ s SUBSET (UNIONS f')`, + GEN_TAC THEN EQ_TAC THEN SIMP_TAC[COMPACT_IMP_HEINE_BOREL_FAN] THEN + DISCH_THEN(MP_TAC o MATCH_MP HEINE_BOREL_IMP_BOLZANO_WEIERSTRASS_FAN) THEN + DISCH_TAC THEN MATCH_MP_TAC BOUNDED_CLOSED_IMP_COMPACT_FAN THEN + ASM_SIMP_TAC[BOLZANO_WEIERSTRASS_IMP_BOUNDED_FAN; + BOLZANO_WEIERSTRASS_IMP_CLOSED_FAN]);; + + + + +let COMPACT_EQ_BOLZANO_WEIERSTRASS_FAN = prove + (`!s:real^N->bool. + compact_fan s <=> + !t. INFINITE t /\ t SUBSET s ==> ?x. x IN s /\ x limit_point_of_fan t`, + GEN_TAC THEN EQ_TAC THENL + [SIMP_TAC[COMPACT_EQ_HEINE_BOREL_FAN; HEINE_BOREL_IMP_BOLZANO_WEIERSTRASS_FAN]; + SIMP_TAC[BOLZANO_WEIERSTRASS_IMP_BOUNDED_FAN; BOLZANO_WEIERSTRASS_IMP_CLOSED_FAN; + BOUNDED_CLOSED_IMP_COMPACT_FAN]]);; + +let COMPACT_EQ_BOUNDED_CLOSED_FAN = prove + (`!s:real^N->bool. compact_fan s <=> bounded_fan s /\ closed_fan s`, + GEN_TAC THEN EQ_TAC THEN REWRITE_TAC[BOUNDED_CLOSED_IMP_COMPACT_FAN] THEN + SIMP_TAC[COMPACT_EQ_BOLZANO_WEIERSTRASS_FAN; BOLZANO_WEIERSTRASS_IMP_BOUNDED_FAN; + BOLZANO_WEIERSTRASS_IMP_CLOSED_FAN]);; + +let COMPACT_IMP_BOUNDED_FAN = prove + (`!s. compact_fan s ==> bounded_fan s`, + SIMP_TAC[COMPACT_EQ_BOUNDED_CLOSED_FAN]);; + +let COMPACT_IMP_CLOSED_FAN = prove + (`!s. compact_fan s ==> closed_fan s`, + SIMP_TAC[COMPACT_EQ_BOUNDED_CLOSED_FAN]);; + +(* ------------------------------------------------------------------------- *) +(* In particular, some common special cases. *) +(* ------------------------------------------------------------------------- *) + +let COMPACT_EMPTY_FAN = prove + (`compact_fan {}`, + REWRITE_TAC[compact_fan; NOT_IN_EMPTY]);; + +let COMPACT_UNION_FAN = prove + (`!s t. compact_fan s /\ compact_fan t ==> compact_fan (s UNION t)`, + SIMP_TAC[COMPACT_EQ_BOUNDED_CLOSED_FAN; BOUNDED_UNION_FAN; CLOSED_UNION_FAN]);; + +let COMPACT_INTER_FAN = prove + (`!s t. compact_fan s /\ compact_fan t ==> compact_fan (s INTER t)`, + SIMP_TAC[COMPACT_EQ_BOUNDED_CLOSED_FAN; BOUNDED_INTER_FAN; CLOSED_INTER_FAN]);; + +let COMPACT_INTER_CLOSED_FAN = prove + (`!s t. compact_fan s /\ closed_fan t ==> compact_fan (s INTER t)`, + SIMP_TAC[COMPACT_EQ_BOUNDED_CLOSED_FAN; CLOSED_INTER_FAN] THEN + MESON_TAC[BOUNDED_SUBSET_FAN; INTER_SUBSET]);; + +let CLOSED_INTER_COMPACT_FAN = prove + (`!s t. closed_fan s /\ compact_fan t ==> compact_fan (s INTER t)`, + MESON_TAC[COMPACT_INTER_CLOSED_FAN; INTER_COMM]);; + +let FINITE_IMP_CLOSED_FAN = prove + (`!s. FINITE s ==> closed_fan s`, + MESON_TAC[BOLZANO_WEIERSTRASS_IMP_CLOSED_FAN; INFINITE; FINITE_SUBSET]);; + +let FINITE_IMP_COMPACT_FAN = prove + (`!s. FINITE s ==> compact_fan s`, + SIMP_TAC[COMPACT_EQ_BOUNDED_CLOSED_FAN; FINITE_IMP_CLOSED_FAN; FINITE_IMP_BOUNDED_FAN]);; + +let COMPACT_SING_FAN = prove + (`!a. compact_fan {a}`, + SIMP_TAC[FINITE_IMP_COMPACT_FAN; FINITE_RULES]);; + +let CLOSED_SING_FAN = prove + (`!a. closed_fan {a}`, + MESON_TAC[COMPACT_EQ_BOUNDED_CLOSED_FAN; COMPACT_SING_FAN]);; + +let COMPACT_CBALL_FAN = prove + (`!x e. compact_fan(cball_fan(x,e))`, + REWRITE_TAC[COMPACT_EQ_BOUNDED_CLOSED_FAN; BOUNDED_CBALL_FAN; CLOSED_CBALL_FAN]);; + +let COMPACT_FRONTIER_BOUNDED_FAN = prove + (`!s. bounded_fan s ==> compact_fan(frontier_fan s)`, + SIMP_TAC[frontier_fan; COMPACT_EQ_BOUNDED_CLOSED_FAN; + CLOSED_DIFF_FAN; OPEN_INTERIOR_FAN; CLOSED_CLOSURE_FAN] THEN + MESON_TAC[SUBSET_DIFF; BOUNDED_SUBSET_FAN; BOUNDED_CLOSURE_FAN]);; + +let COMPACT_FRONTIER_FAN = prove + (`!s. compact_fan s ==> compact_fan (frontier_fan s)`, + MESON_TAC[COMPACT_EQ_BOUNDED_CLOSED_FAN; COMPACT_FRONTIER_BOUNDED_FAN]);; + +let FRONTIER_SUBSET_COMPACT_FAN = prove + (`!s. compact_fan s ==> frontier_fan s SUBSET s`, + MESON_TAC[FRONTIER_SUBSET_CLOSED_FAN; COMPACT_EQ_BOUNDED_CLOSED_FAN]);; + +let open_delete_fan = prove(`s DELETE x = s DIFF {x}`,SET_TAC[]);; + +let OPEN_DELETE_FAN = prove + (`!s x. open_fan s ==> open_fan(s DELETE x)`, + + SIMP_TAC[ open_delete_fan; OPEN_DIFF_FAN; CLOSED_SING_FAN]);; + +(* ------------------------------------------------------------------------- *) +(* Finite intersection property. I could make it an equivalence in fact. *) +(* ------------------------------------------------------------------------- *) + let compact_imp_fip_fan = prove(`(s = UNIV DIFF t) <=> (UNIV DIFF s = t)`,SET_TAC[]);; + +let COMPACT_IMP_FIP_FAN = prove + (`!s:real^N->bool f. + compact_fan s /\ + (!t. t IN f ==> closed_fan t) /\ + (!f'. FINITE f' /\ f' SUBSET f ==> ~(s INTER (INTERS f') = {})) + ==> ~(s INTER (INTERS f) = {})`, + REPEAT GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [COMPACT_EQ_HEINE_BOREL_FAN]) THEN + DISCH_THEN(MP_TAC o SPEC `IMAGE (\t:real^N->bool. UNIV DIFF t) f`) THEN + ASM_SIMP_TAC[FORALL_IN_IMAGE] THEN + DISCH_THEN(fun th -> REPEAT STRIP_TAC THEN MP_TAC th) THEN + ASM_SIMP_TAC[OPEN_DIFF_FAN; CLOSED_DIFF_FAN; OPEN_UNIV_FAN; CLOSED_UNIV_FAN; NOT_IMP] THEN + CONJ_TAC THENL + [UNDISCH_TAC `(s:real^N->bool) INTER INTERS f = {}` THEN + ONCE_REWRITE_TAC[SUBSET; EXTENSION] THEN + REWRITE_TAC[IN_UNIONS; EXISTS_IN_IMAGE] THEN SET_TAC[]; + DISCH_THEN(X_CHOOSE_THEN `g:(real^N->bool)->bool` MP_TAC) THEN + FIRST_X_ASSUM(MP_TAC o SPEC `IMAGE (\t:real^N->bool. UNIV DIFF t) g`) THEN + ASM_CASES_TAC `FINITE(g:(real^N->bool)->bool)` THEN + ASM_SIMP_TAC[FINITE_IMAGE] THEN ONCE_REWRITE_TAC[SUBSET; EXTENSION] THEN + REWRITE_TAC[FORALL_IN_IMAGE; IN_INTER; IN_INTERS; IN_IMAGE; IN_DIFF; + IN_UNIV; NOT_IN_EMPTY; compact_imp_fip_fan; UNWIND_THM1; IN_UNIONS] THEN + SET_TAC[]]);; + +(* ------------------------------------------------------------------------- *) +(* Bounded closed nest property (proof does not use Heine-Borel). *) +(* ------------------------------------------------------------------------- *) + +let BOUNDED_CLOSED_NEST_FAN = prove + (`!s. (!n. closed_fan(s n)) /\ (!n. ~(s n = {})) /\ + (!m n. m <= n ==> s(n) SUBSET s(m)) /\ + bounded_fan(s 0) + ==> ?a:real^N. !n:num. a IN s(n)`, + GEN_TAC THEN REWRITE_TAC[GSYM MEMBER_NOT_EMPTY; SKOLEM_THM] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + DISCH_THEN(CONJUNCTS_THEN2 + (X_CHOOSE_TAC `a:num->real^N`) STRIP_ASSUME_TAC) THEN + SUBGOAL_THEN `compact_fan(s 0:real^N->bool)` MP_TAC THENL + [ASM_MESON_TAC[BOUNDED_CLOSED_IMP_COMPACT_FAN]; ALL_TAC] THEN + REWRITE_TAC[compact_fan] THEN + DISCH_THEN(MP_TAC o SPEC `a:num->real^N`) THEN + ANTS_TAC THENL [ASM_MESON_TAC[SUBSET; LE_0]; ALL_TAC] THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `l:real^N` THEN + REWRITE_TAC[LIM_SEQUENTIALLY_FAN; o_THM] THEN + DISCH_THEN(X_CHOOSE_THEN `r:num->num` STRIP_ASSUME_TAC) THEN + GEN_REWRITE_TAC I [TAUT `p <=> ~(~p)`] THEN + GEN_REWRITE_TAC RAND_CONV [NOT_FORALL_THM] THEN + DISCH_THEN(X_CHOOSE_THEN `N:num` MP_TAC) THEN + MP_TAC(ISPECL [`l:real^N`; `(s:num->real^N->bool) N`] + CLOSED_APPROACHABLE_FAN) THEN + ASM_MESON_TAC[SUBSET; LE_REFL; LE_TRANS; LE_CASES; MONOTONE_BIGGER_FAN]);; + +(* ------------------------------------------------------------------------- *) +(* Decreasing case does not even need compactness, just completeness. *) +(* ------------------------------------------------------------------------- *) + +let DECREASING_CLOSED_NEST_FAN = prove + (`!s. (!n. closed_fan(s n)) /\ (!n. ~(s n = {})) /\ + (!m n. m <= n ==> s(n) SUBSET s(m)) /\ + (!e. &0 < e ==> ?n. !x y. x IN s(n) /\ y IN s(n) ==> dist(x,y) < e) + ==> ?a:real^N. !n:num. a IN s(n)`, + GEN_TAC THEN REWRITE_TAC[GSYM MEMBER_NOT_EMPTY; SKOLEM_THM] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + DISCH_THEN(CONJUNCTS_THEN2 + (X_CHOOSE_TAC `a:num->real^N`) STRIP_ASSUME_TAC) THEN + SUBGOAL_THEN `?l:real^N. (a --> l) sequentially_fan` MP_TAC THENL + [ASM_MESON_TAC[cauchy_fan; GE; SUBSET; LE_TRANS; LE_REFL; + complete_fan; COMPLETE_UNIV_FAN; IN_UNIV]; + ASM_MESON_TAC[LIM_SEQUENTIALLY_FAN; CLOSED_APPROACHABLE_FAN; + SUBSET; LE_REFL; LE_TRANS; LE_CASES]]);; + +(* ------------------------------------------------------------------------- *) +(* Strengthen it to the intersection actually being a singleton. *) +(* ------------------------------------------------------------------------- *) + +let DECREASING_CLOSED_NEST_SING_FAN = prove + (`!s. (!n. closed_fan(s n)) /\ (!n. ~(s n = {})) /\ + (!m n. m <= n ==> s(n) SUBSET s(m)) /\ + (!e. &0 < e ==> ?n. !x y. x IN s(n) /\ y IN s(n) ==> dist(x,y) < e) + ==> ?a:real^N. INTERS {t | ?n:num. t = s n} = {a}`, + GEN_TAC THEN DISCH_TAC THEN + FIRST_ASSUM(MP_TAC o MATCH_MP DECREASING_CLOSED_NEST_FAN) THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `a:real^N` THEN + DISCH_TAC THEN REWRITE_TAC[EXTENSION; IN_INTERS; IN_SING; IN_ELIM_THM] THEN + ASM_MESON_TAC[DIST_POS_LT; REAL_LT_REFL; SUBSET; LE_CASES]);; + +(* ------------------------------------------------------------------------- *) +(* Define continuity over a net to take in restrictions of the set. *) +(* ------------------------------------------------------------------------- *) + +parse_as_infix ("continuous_fan",(12,"right"));; + +let continuous_fan = new_definition + `f continuous_fan net_fan <=> (f --> f(netlimit_fan net_fan)) net_fan`;; + +let CONTINUOUS_WITHIN_FAN = prove + (`!f x:real^M. f continuous_fan (at_fan x within_fan s) <=> (f --> f(x)) (at_fan x within_fan s)`, +REPEAT GEN_TAC THEN REWRITE_TAC[continuous_fan] +THEN ASM_CASES_TAC `trivial_limit_fan(at_fan (x:real^M) within_fan s)` THENL + [ASM_REWRITE_TAC[lim_fan]; ASM_SIMP_TAC[NETLIMIT_WITHIN_FAN]]);; + +let CONTINUOUS_AT_FAN = prove + (`!f (x:real^N). f continuous_fan (at_fan x) <=> (f --> f(x)) (at_fan x)`, + ONCE_REWRITE_TAC[GSYM WITHIN_UNIV_FAN] THEN + REWRITE_TAC[CONTINUOUS_WITHIN_FAN; IN_UNIV]);; + +(* ------------------------------------------------------------------------- *) +(* Derive the epsilon-delta forms, which we often use as "definitions" *) +(* ------------------------------------------------------------------------- *) + +let continuous_within_fan = prove + (`f continuous_fan (at_fan x within_fan s) <=> + !e. &0 < e + ==> ?d. &0 < d /\ + !x'. x' IN s /\ dist(x',x) < d ==> dist(f(x'),f(x)) < e`, + REWRITE_TAC[CONTINUOUS_WITHIN_FAN; LIM_WITHIN_FAN] THEN + REWRITE_TAC[GSYM DIST_NZ] THEN MESON_TAC[DIST_REFL]);; + +let continuous_at_fan = prove + (`f continuous_fan (at_fan x) <=> + !e. &0 < e ==> ?d. &0 < d /\ + !x'. dist(x',x) < d ==> dist(f(x'),f(x)) < e`, + ONCE_REWRITE_TAC[GSYM WITHIN_UNIV_FAN] THEN + REWRITE_TAC[continuous_within_fan; IN_UNIV]);; + +(* ------------------------------------------------------------------------- *) +(* For setwise continuity, just start from the epsilon-delta definitions. *) +(* ------------------------------------------------------------------------- *) + +parse_as_infix ("continuous_on_fan",(12,"right"));; +parse_as_infix ("uniformly_continuous_on_fan",(12,"right"));; + +let continuous_on_fan = new_definition + `f continuous_on_fan s <=> + !x. x IN s ==> !e. &0 < e + ==> ?d. &0 < d /\ + !x'. x' IN s /\ dist(x',x) < d + ==> dist(f(x'),f(x)) < e`;; + +let uniformly_continuous_on_fan = new_definition + `f uniformly_continuous_on_fan s <=> + !e. &0 < e + ==> ?d. &0 < d /\ + !x x'. x IN s /\ x' IN s /\ dist(x',x) < d + ==> dist(f(x'),f(x)) < e`;; + +(* ------------------------------------------------------------------------- *) +(* Some simple consequential lemmas. *) +(* ------------------------------------------------------------------------- *) + +let UNIFORMLY_CONTINUOUS_IMP_CONTINUOUS_FAN = prove + (`!f s. f uniformly_continuous_on_fan s ==> f continuous_on_fan s`, + REWRITE_TAC[uniformly_continuous_on_fan; continuous_on_fan] THEN MESON_TAC[]);; + +let CONTINUOUS_AT_IMP_CONTINUOUS_WITHIN_FAN = prove + (`!f s x. f continuous_fan (at_fan x) ==> f continuous_fan (at_fan x within_fan s)`, + SIMP_TAC[LIM_AT_WITHIN_FAN; CONTINUOUS_AT_FAN; CONTINUOUS_WITHIN_FAN]);; + +let CONTINUOUS_AT_IMP_CONTINUOUS_ON_FAN = prove + (`!f s. (!x. x IN s ==> f continuous_fan (at_fan x)) ==> f continuous_on_fan s`, + REWRITE_TAC[continuous_at_fan; continuous_on_fan] THEN MESON_TAC[]);; + +let CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN_FAN = prove + (`!f s. f continuous_on_fan s <=> !x. x IN s ==> f continuous_fan (at_fan x within_fan s)`, + REWRITE_TAC[continuous_on_fan; continuous_within_fan]);; + +let CONTINUOUS_ON_FAN = prove + (`!f (s:real^N->bool). + f continuous_on_fan s <=> !x. x IN s ==> (f --> f(x)) (at_fan x within_fan s)`, + REWRITE_TAC[CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN_FAN; CONTINUOUS_WITHIN_FAN]);; + +let CONTINUOUS_ON_EQ_CONTINUOUS_AT_FAN = prove + (`!f:real^M->real^N s. + open_fan s ==> (f continuous_on_fan s <=> (!x. x IN s ==> f continuous_fan (at_fan x)))`, + SIMP_TAC[CONTINUOUS_ON_FAN; CONTINUOUS_AT_FAN; LIM_WITHIN_OPEN_FAN]);; + +let CONTINUOUS_WITHIN_SUBSET_FAN = prove + (`!f s t x. f continuous_fan (at_fan x within_fan s) /\ t SUBSET s + ==> f continuous_fan (at_fan x within_fan t)`, + REWRITE_TAC[CONTINUOUS_WITHIN_FAN] THEN MESON_TAC[LIM_WITHIN_SUBSET_FAN]);; + +let CONTINUOUS_ON_SUBSET_FAN = prove + (`!f s t. f continuous_on_fan s /\ t SUBSET s ==> f continuous_on_fan t`, + REWRITE_TAC[CONTINUOUS_ON_FAN] THEN MESON_TAC[SUBSET; LIM_WITHIN_SUBSET_FAN]);; + +let CONTINUOUS_ON_INTERIOR_FAN = prove + (`!f:real^M->real^N s x. + f continuous_on_fan s /\ x IN interior_fan(s) ==> f continuous_fan at_fan x`, + REWRITE_TAC[interior_fan; IN_ELIM_THM] THEN + MESON_TAC[CONTINUOUS_ON_EQ_CONTINUOUS_AT_FAN; CONTINUOUS_ON_SUBSET_FAN]);; + +(* ------------------------------------------------------------------------- *) +(* Characterization of various kinds of continuity in terms of sequences. *) +(* ------------------------------------------------------------------------- *) + +let CONTINUOUS_WITHIN_SEQUENTIALLY_FAN = prove + (`!f a:real^N. + f continuous_fan (at_fan a within_fan s) <=> + !x. (!n. x(n) IN s) /\ (x --> a) sequentially_fan + ==> ((f o x) --> f(a)) sequentially_fan`, + REPEAT GEN_TAC THEN REWRITE_TAC[continuous_within_fan] THEN EQ_TAC THENL + [REWRITE_TAC[LIM_SEQUENTIALLY_FAN; o_THM] THEN MESON_TAC[]; ALL_TAC] THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[NOT_FORALL_THM; NOT_IMP; NOT_EXISTS_THM] THEN + DISCH_THEN(X_CHOOSE_THEN `e:real` (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + DISCH_THEN(MP_TAC o GEN `n:num` o SPEC `&1 / (&n + &1)`) THEN + SIMP_TAC[REAL_LT_DIV; REAL_OF_NUM_LT; REAL_OF_NUM_LE; REAL_POS; ARITH; + REAL_ARITH `&0 <= n ==> &0 < n + &1`; NOT_FORALL_THM; SKOLEM_THM] THEN + MATCH_MP_TAC MONO_EXISTS THEN REWRITE_TAC[NOT_IMP; FORALL_AND_THM] THEN + X_GEN_TAC `y:num->real^N` THEN REWRITE_TAC[LIM_SEQUENTIALLY_FAN; o_THM] THEN + STRIP_TAC THEN CONJ_TAC THENL [ALL_TAC; ASM_MESON_TAC[LE_REFL]] THEN + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC FORALL_POS_MONO_1 THEN + CONJ_TAC THENL [ASM_MESON_TAC[REAL_LT_TRANS]; ALL_TAC] THEN + X_GEN_TAC `n:num` THEN EXISTS_TAC `n:num` THEN X_GEN_TAC `m:num` THEN + DISCH_TAC THEN MATCH_MP_TAC REAL_LTE_TRANS THEN + EXISTS_TAC `&1 / (&m + &1)` THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[REAL_LE_INV2; real_div; REAL_ARITH `&0 <= x ==> &0 < x + &1`; + REAL_POS; REAL_MUL_LID; REAL_LE_RADD; REAL_OF_NUM_LE]);; + +let CONTINUOUS_AT_SEQUENTIALLY_FAN = prove + (`!f a:real^N. + f continuous_fan (at_fan a) <=> + !x. (x --> a) sequentially_fan + ==> ((f o x) --> f(a)) sequentially_fan`, + ONCE_REWRITE_TAC[GSYM WITHIN_UNIV_FAN] THEN + REWRITE_TAC[CONTINUOUS_WITHIN_SEQUENTIALLY_FAN; IN_UNIV]);; + +let CONTINUOUS_ON_SEQUENTIALLY_FAN = prove + (`!f s:real^N->bool. + f continuous_on_fan s <=> + !x a. a IN s /\ (!n. x(n) IN s) /\ (x --> a) sequentially_fan + ==> ((f o x) --> f(a)) sequentially_fan`, + REWRITE_TAC[CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN_FAN; + CONTINUOUS_WITHIN_SEQUENTIALLY_FAN] THEN MESON_TAC[]);; + +let UNIFORMLY_CONTINUOUS_ON_SEQUENTIALLY_FAN = prove + (`!f s:real^N->bool. + f uniformly_continuous_on_fan s <=> + !x y. (!n. x(n) IN s) /\ (!n. y(n) IN s) /\ + ((\n. x(n) - y(n)) --> vec 0) sequentially_fan + ==> ((\n. f(x(n)) - f(y(n))) --> vec 0) sequentially_fan`, + REPEAT GEN_TAC THEN REWRITE_TAC[uniformly_continuous_on_fan] THEN + REWRITE_TAC[LIM_SEQUENTIALLY_FAN; dist; VECTOR_SUB_RZERO] THEN + EQ_TAC THENL [MESON_TAC[]; ALL_TAC] THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[NOT_FORALL_THM; NOT_IMP; NOT_EXISTS_THM] THEN + DISCH_THEN(X_CHOOSE_THEN `e:real` (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + DISCH_THEN(MP_TAC o GEN `n:num` o SPEC `&1 / (&n + &1)`) THEN + SIMP_TAC[REAL_LT_DIV; REAL_OF_NUM_LT; REAL_OF_NUM_LE; REAL_POS; ARITH; + REAL_ARITH `&0 <= n ==> &0 < n + &1`; NOT_FORALL_THM; SKOLEM_THM] THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `x:num->real^N` THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `y:num->real^N` THEN + REWRITE_TAC[NOT_IMP; FORALL_AND_THM] THEN STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[NORM_SUB] THEN CONJ_TAC THENL + [MATCH_MP_TAC FORALL_POS_MONO_1 THEN + CONJ_TAC THENL [ASM_MESON_TAC[REAL_LT_TRANS]; ALL_TAC] THEN + X_GEN_TAC `n:num` THEN EXISTS_TAC `n:num` THEN X_GEN_TAC `m:num` THEN + DISCH_TAC THEN MATCH_MP_TAC REAL_LTE_TRANS THEN + EXISTS_TAC `&1 / (&m + &1)` THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[REAL_LE_INV2; real_div; REAL_ARITH `&0 <= x ==> &0 < x + &1`; + REAL_POS; REAL_MUL_LID; REAL_LE_RADD; REAL_OF_NUM_LE]; + EXISTS_TAC `e:real` THEN ASM_REWRITE_TAC[] THEN + EXISTS_TAC `\x:num. x` THEN ASM_REWRITE_TAC[LE_REFL]]);; + +(* ------------------------------------------------------------------------- *) +(* Combination results for pointwise continuity. *) +(* ------------------------------------------------------------------------- *) + +let CONTINUOUS_CONST_FAN = prove + (`!net c. (\x. c) continuous_fan net_fan`, + REWRITE_TAC[continuous_fan; LIM_CONST_FAN]);; + +let CONTINUOUS_CMUL_FAN = prove + (`!f c net. f continuous_fan net_fan ==> (\x. c % f(x)) continuous_fan net_fan`, + REWRITE_TAC[continuous_fan; LIM_CMUL_FAN]);; + +let CONTINUOUS_NEG_FAN = prove + (`!f net. f continuous_fan net_fan ==> (\x. --(f x)) continuous_fan net_fan`, + REWRITE_TAC[continuous_fan; LIM_NEG_FAN]);; + +let CONTINUOUS_ADD_FAN = prove + (`!f g net. f continuous_fan net_fan /\ g continuous_fan net_fan + ==> (\x. f(x) + g(x)) continuous_fan net_fan`, + REWRITE_TAC[continuous_fan; LIM_ADD_FAN]);; + +let CONTINUOUS_SUB_FAN = prove + (`!f g net. f continuous_fan net_fan /\ g continuous_fan net_fan + ==> (\x. f(x) - g(x)) continuous_fan net_fan`, + REWRITE_TAC[continuous_fan; LIM_SUB_FAN]);; + +(* ------------------------------------------------------------------------- *) +(* Same thing for setwise continuity. *) +(* ------------------------------------------------------------------------- *) + +let CONTINUOUS_ON_CONST_FAN = prove + (`!s c. (\x. c) continuous_on_fan s`, + SIMP_TAC[CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN_FAN; CONTINUOUS_CONST_FAN]);; + +let CONTINUOUS_ON_CMUL_FAN = prove + (`!f c s. f continuous_on_fan s ==> (\x. c % f(x)) continuous_on_fan s`, + SIMP_TAC[CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN_FAN; CONTINUOUS_CMUL_FAN]);; + +let CONTINUOUS_ON_NEG_FAN = prove + (`!f s. f continuous_on_fan s + ==> (\x. --(f x)) continuous_on_fan s`, + SIMP_TAC[CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN_FAN; CONTINUOUS_NEG_FAN]);; + +let CONTINUOUS_ON_ADD_FAN = prove + (`!f g s. f continuous_on_fan s /\ g continuous_on_fan s + ==> (\x. f(x) + g(x)) continuous_on_fan s`, + SIMP_TAC[CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN_FAN; CONTINUOUS_ADD_FAN]);; + +let CONTINUOUS_ON_SUB_FAN = prove + (`!f g s. f continuous_on_fan s /\ g continuous_on_fan s + ==> (\x. f(x) - g(x)) continuous_on_fan s`, + SIMP_TAC[CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN_FAN; CONTINUOUS_SUB_FAN]);; + +(* ------------------------------------------------------------------------- *) +(* Same thing for uniform continuity, using sequential formulations. *) +(* ------------------------------------------------------------------------- *) + +let UNIFORMLY_CONTINUOUS_ON_CONST_FAN = prove + (`!s c. (\x. c) uniformly_continuous_on_fan s`, + REWRITE_TAC[UNIFORMLY_CONTINUOUS_ON_SEQUENTIALLY_FAN; o_DEF; + VECTOR_SUB_REFL; LIM_CONST_FAN]);; + +let UNIFORMLY_CONTINUOUS_ON_CMUL_FAN = prove + (`!f c s. f uniformly_continuous_on_fan s + ==> (\x. c % f(x)) uniformly_continuous_on_fan s`, + REPEAT GEN_TAC THEN REWRITE_TAC[UNIFORMLY_CONTINUOUS_ON_SEQUENTIALLY_FAN] THEN + REPEAT(MATCH_MP_TAC MONO_FORALL THEN GEN_TAC) THEN + DISCH_THEN(fun th -> DISCH_TAC THEN MP_TAC th) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN(MP_TAC o MATCH_MP LIM_CMUL_FAN) THEN + ASM_SIMP_TAC[VECTOR_SUB_LDISTRIB; VECTOR_MUL_RZERO]);; + +let UNIFORMLY_CONTINUOUS_ON_NEG_FAN = prove + (`!f s. f uniformly_continuous_on_fan s + ==> (\x. --(f x)) uniformly_continuous_on_fan s`, + ONCE_REWRITE_TAC[VECTOR_NEG_MINUS1] THEN + REWRITE_TAC[UNIFORMLY_CONTINUOUS_ON_CMUL_FAN]);; + +let UNIFORMLY_CONTINUOUS_ON_ADD_FAN = prove + (`!f g s. f uniformly_continuous_on_fan s /\ g uniformly_continuous_on_fan s + ==> (\x. f(x) + g(x)) uniformly_continuous_on_fan s`, + REPEAT GEN_TAC THEN REWRITE_TAC[UNIFORMLY_CONTINUOUS_ON_SEQUENTIALLY_FAN] THEN + REWRITE_TAC[AND_FORALL_THM] THEN + REPEAT(MATCH_MP_TAC MONO_FORALL THEN GEN_TAC) THEN + DISCH_THEN(fun th -> DISCH_TAC THEN MP_TAC th) THEN + ASM_REWRITE_TAC[o_DEF] THEN DISCH_THEN(MP_TAC o MATCH_MP LIM_ADD_FAN) THEN + MATCH_MP_TAC EQ_IMP THEN + REWRITE_TAC[VECTOR_ADD_LID] THEN AP_THM_TAC THEN BINOP_TAC THEN + REWRITE_TAC[FUN_EQ_THM] THEN VECTOR_ARITH_TAC);; + +let UNIFORMLY_CONTINUOUS_ON_SUB_FAN = prove + (`!f g s. f uniformly_continuous_on_fan s /\ g uniformly_continuous_on_fan s + ==> (\x. f(x) - g(x)) uniformly_continuous_on_fan s`, + REWRITE_TAC[VECTOR_SUB] THEN + SIMP_TAC[UNIFORMLY_CONTINUOUS_ON_NEG_FAN; UNIFORMLY_CONTINUOUS_ON_ADD_FAN]);; + +(* ------------------------------------------------------------------------- *) +(* Identity function is continuous in every sense. *) +(* ------------------------------------------------------------------------- *) + +let CONTINUOUS_WITHIN_ID_FAN = prove + (`!net_fan a s. (\x. x) continuous_fan (at_fan a within_fan s)`, + REWRITE_TAC[continuous_within_fan] THEN MESON_TAC[]);; + +let CONTINUOUS_AT_ID_FAN = prove + (`!net_fan s. (\x. x) continuous_fan (at_fan a)`, + REWRITE_TAC[continuous_at_fan] THEN MESON_TAC[]);; + +let CONTINUOUS_ON_ID_FAN = prove + (`!s. (\x. x) continuous_on_fan s`, + REWRITE_TAC[continuous_on_fan] THEN MESON_TAC[]);; + +let UNIFORMLY_CONTINUOUS_ON_ID_FAN = prove + (`!s. (\x. x) uniformly_continuous_on_fan s`, + REWRITE_TAC[uniformly_continuous_on_fan] THEN MESON_TAC[]);; + +(* ------------------------------------------------------------------------- *) +(* Continuity of all kinds is preserved under composition. *) +(* ------------------------------------------------------------------------- *) + +let CONTINUOUS_WITHIN_COMPOSE_FAN = prove + (`!f g x s. f continuous_fan (at_fan x within_fan s) /\ + g continuous_fan (at_fan (f x) within_fan IMAGE f s) + ==> (g o f) continuous_fan (at_fan x within_fan s)`, + REPEAT GEN_TAC THEN REWRITE_TAC[continuous_within_fan; o_THM; IN_IMAGE] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + MATCH_MP_TAC MONO_FORALL THEN X_GEN_TAC `e:real` THEN + ASM_MESON_TAC[]);; + +let CONTINUOUS_AT_COMPOSE_FAN = prove + (`!f g x. f continuous_fan (at_fan x) /\ g continuous_fan (at_fan (f x)) + ==> (g o f) continuous_fan (at_fan x)`, + ONCE_REWRITE_TAC[GSYM WITHIN_UNIV_FAN] THEN + MESON_TAC[CONTINUOUS_WITHIN_COMPOSE_FAN; IN_IMAGE; CONTINUOUS_WITHIN_SUBSET_FAN; + SUBSET_UNIV; IN_UNIV]);; + +let CONTINUOUS_ON_COMPOSE_FAN = prove + (`!f g s. f continuous_on_fan s /\ g continuous_on_fan (IMAGE f s) + ==> (g o f) continuous_on_fan s`, + REWRITE_TAC[CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN_FAN] THEN + MESON_TAC[IN_IMAGE; CONTINUOUS_WITHIN_COMPOSE_FAN]);; + + +let UNIFORMLY_CONTINUOUS_ON_COMPOSE_FAN = prove + (`!f g s. f uniformly_continuous_on_fan s /\ + g uniformly_continuous_on_fan (IMAGE f s) + ==> (g o f) uniformly_continuous_on_fan s`, +(let lemma1 = prove + (`(!y. ((?x. (y = f x) /\ P x) /\ Q y ==> R y)) <=> + (!x. P x /\ Q (f x) ==> R (f x))`, + MESON_TAC[]) in + REPEAT GEN_TAC THEN + REWRITE_TAC[uniformly_continuous_on_fan; o_THM; IN_IMAGE] THEN + ONCE_REWRITE_TAC[SWAP_FORALL_THM] THEN REWRITE_TAC[lemma1] THEN + ONCE_REWRITE_TAC[TAUT `a /\ b /\ c <=> b /\ a /\ c`] THEN + ONCE_REWRITE_TAC[SWAP_FORALL_THM] THEN REWRITE_TAC[lemma1] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + MATCH_MP_TAC MONO_FORALL THEN + X_GEN_TAC `e:real` THEN ASM_CASES_TAC `&0 < e` THEN ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[]));; + +(* ------------------------------------------------------------------------- *) +(* Continuity in terms of open preimages. *) +(* ------------------------------------------------------------------------- *) +let CONTINUOUS_AT_OPEN_FAN = prove + (`!f:real^M->real^N x. + f continuous_fan (at_fan x) <=> + !t. open_fan t /\ f(x) IN t + ==> ?s. open_fan s /\ x IN s /\ + !x'. x' IN s ==> f(x') IN t`, + REPEAT GEN_TAC THEN REWRITE_TAC[continuous_at_fan] THEN EQ_TAC THENL + [DISCH_TAC THEN X_GEN_TAC `t:real^N->bool` THEN + DISCH_THEN(CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN + GEN_REWRITE_TAC LAND_CONV [open_def_fan] THEN + DISCH_THEN(MP_TAC o SPEC `(f:real^M->real^N) x`) THEN + ASM_MESON_TAC[IN_BALL_FAN; DIST_SYM; OPEN_BALL_FAN; CENTRE_IN_BALL]; + DISCH_TAC THEN X_GEN_TAC `e:real` THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `ball_fan((f:real^M->real^N) x,e)`) THEN + ASM_SIMP_TAC[OPEN_BALL_FAN; CENTRE_IN_BALL] THEN + MESON_TAC[open_def_fan; IN_BALL_FAN; REAL_LT_TRANS; DIST_SYM]]);; + + +let CONTINUOUS_ON_OPEN_FAN = prove + (`!f:real^M->real^N s. + f continuous_on_fan s <=> + !t. t open_in (IMAGE f s) ==> {x | x IN s /\ f(x) IN t} open_in s`, + REPEAT GEN_TAC THEN REWRITE_TAC[continuous_on_fan] THEN EQ_TAC THENL + [REWRITE_TAC[open_in; SUBSET; IN_ELIM_THM] THEN + DISCH_TAC THEN X_GEN_TAC `t:real^N->bool` THEN STRIP_TAC THEN + CONJ_TAC THENL [ASM_MESON_TAC[DIST_REFL]; ALL_TAC] THEN + X_GEN_TAC `x:real^M` THEN STRIP_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `(f:real^M->real^N) x`) THEN + ASM_REWRITE_TAC[IN_IMAGE] THEN ASM_MESON_TAC[]; + DISCH_TAC THEN X_GEN_TAC `x:real^M` THEN + DISCH_TAC THEN X_GEN_TAC `e:real` THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o + SPEC `ball_fan((f:real^M->real^N) x,e) INTER (IMAGE f s)`) THEN + ANTS_TAC THENL + [ASM_MESON_TAC[OPEN_IN_OPEN_FAN; INTER_COMM; OPEN_BALL_FAN]; ALL_TAC] THEN + REWRITE_TAC[open_in; SUBSET; IN_INTER; IN_ELIM_THM; IN_BALL_FAN; IN_IMAGE] THEN + REWRITE_TAC[AND_FORALL_THM] THEN DISCH_THEN(MP_TAC o SPEC `x:real^M`) THEN + ASM_MESON_TAC[DIST_REFL; DIST_SYM]]);; + +(* ------------------------------------------------------------------------- *) +(* Similarly in terms of closed sets. *) +(* ------------------------------------------------------------------------- *) + +let CONTINUOUS_ON_CLOSED_FAN = prove + (`!f:real^M->real^N s. + f continuous_on_fan s <=> + !t. t closed_in (IMAGE f s) ==> {x | x IN s /\ f(x) IN t} closed_in s`, + REPEAT GEN_TAC THEN ONCE_REWRITE_TAC[CONTINUOUS_ON_OPEN_FAN] THEN EQ_TAC THEN + DISCH_TAC THEN X_GEN_TAC `t:real^N->bool` THEN + FIRST_X_ASSUM(MP_TAC o SPEC `IMAGE (f:real^M->real^N) s DIFF t`) THENL + [REWRITE_TAC[closed_in]; REWRITE_TAC[OPEN_IN_CLOSED_IN_EQ]] THEN + MATCH_MP_TAC(TAUT`d /\ (b <=> e) ==> ((a ==> b) ==> c /\ a ==> d /\ e)`) THEN + (CONJ_TAC THENL [SIMP_TAC[SUBSET; IN_ELIM_THM]; ALL_TAC] THEN + AP_THM_TAC THEN AP_TERM_TAC THEN + REWRITE_TAC[EXTENSION; IN_DIFF; IN_IMAGE; IN_ELIM_THM] THEN MESON_TAC[]));; + +(* ------------------------------------------------------------------------- *) +(* The "global" cases. *) +(* ------------------------------------------------------------------------- *) + +let CONTINOUS_OPEN_PREIMAGE_FAN = prove + (`!f:real^M->real^N s. + (!x. f continuous_fan (at_fan x)) /\ s SUBSET (IMAGE f UNIV) /\ open_fan s + ==> open_fan {x | f(x) IN s}`, + REPEAT STRIP_TAC THEN + MP_TAC(SPECL [`f:real^M->real^N`; `(:real^M)`] + CONTINUOUS_ON_OPEN_FAN) THEN + ASM_SIMP_TAC[CONTINUOUS_AT_IMP_CONTINUOUS_ON_FAN; IN_UNIV; GSYM OPEN_IN_FAN] THEN + DISCH_THEN MATCH_MP_TAC THEN + UNDISCH_TAC `open_fan(s:real^N->bool)` THEN + REWRITE_TAC[open_def_fan; open_in] THEN ASM_MESON_TAC[]);; + +let OPEN_TRANSLATION_FAN = prove + (`!s a:real^N. open_fan s ==> open_fan(IMAGE (\x. a + x) s)`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPECL [`\x:real^N. x - a`; `s:real^N->bool`] + CONTINOUS_OPEN_PREIMAGE_FAN) THEN + ASM_SIMP_TAC[CONTINUOUS_SUB_FAN; CONTINUOUS_AT_ID_FAN; CONTINUOUS_CONST_FAN] THEN + MATCH_MP_TAC(TAUT `a /\ b = c ==> (a ==> b) ==> c`) THEN + CONJ_TAC THENL + [REWRITE_TAC[SUBSET]; AP_TERM_TAC THEN REWRITE_TAC[EXTENSION]] THEN + REWRITE_TAC[IN_ELIM_THM; IN_IMAGE; IN_UNIV] THEN + ASM_MESON_TAC[VECTOR_ARITH `(a + x) - a = x:real^N`; + VECTOR_ARITH `a + (x - a) = x:real^N`]);; + +(* ------------------------------------------------------------------------- *) +(* Preservation of compactness and connectedness under continuous function. *) +(* ------------------------------------------------------------------------- *) + +let COMPACT_CONTINUOUS_IMAGE_FAN = prove + (`!f:real^M->real^N s. + f continuous_on_fan s /\ compact_fan s ==> compact_fan(IMAGE f s)`, + REPEAT GEN_TAC THEN REWRITE_TAC[continuous_on_fan; compact_fan] THEN + STRIP_TAC THEN X_GEN_TAC `y:num->real^N` THEN + REWRITE_TAC[IN_IMAGE; SKOLEM_THM; FORALL_AND_THM] THEN + DISCH_THEN(X_CHOOSE_THEN `x:num->real^M` STRIP_ASSUME_TAC) THEN + FIRST_X_ASSUM(MP_TAC o SPEC `x:num->real^M`) THEN ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[SWAP_EXISTS_THM] THEN MATCH_MP_TAC MONO_EXISTS THEN + X_GEN_TAC `r:num->num` THEN + DISCH_THEN(X_CHOOSE_THEN `l:real^M` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `(f:real^M->real^N) l` THEN ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL [ASM_MESON_TAC[]; ALL_TAC] THEN + REWRITE_TAC[LIM_SEQUENTIALLY_FAN] THEN + FIRST_X_ASSUM(MP_TAC o SPEC `l:real^M`) THEN + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC MONO_FORALL THEN X_GEN_TAC `e:real` THEN + DISCH_THEN(fun th -> DISCH_TAC THEN MP_TAC th) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN(X_CHOOSE_THEN `d:real` STRIP_ASSUME_TAC) THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [LIM_SEQUENTIALLY_FAN]) THEN + DISCH_THEN(MP_TAC o SPEC `d:real`) THEN ASM_REWRITE_TAC[o_THM] THEN + ASM_MESON_TAC[]);; + +let CONNECTED_CONTINUOUS_IMAGE_FAN = prove + (`!f:real^M->real^N s. + f continuous_on_fan s /\ connected_fan s ==> connected_fan(IMAGE f s)`, + REPEAT GEN_TAC THEN REWRITE_TAC[CONTINUOUS_ON_OPEN_FAN] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[CONNECTED_CLOPEN_FAN; NOT_FORALL_THM; NOT_IMP; DE_MORGAN_THM] THEN + REWRITE_TAC[closed_in] THEN + DISCH_THEN(X_CHOOSE_THEN `t:real^N->bool` STRIP_ASSUME_TAC) THEN + FIRST_X_ASSUM(fun th -> MP_TAC(SPEC `t:real^N->bool` th) THEN + MP_TAC(SPEC `IMAGE (f:real^M->real^N) s DIFF t` th)) THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `{x | x IN s /\ (f:real^M->real^N) x IN IMAGE f s DIFF t} = + s DIFF {x | x IN s /\ f x IN t}` + SUBST1_TAC THENL + [UNDISCH_TAC `t SUBSET IMAGE (f:real^M->real^N) s` THEN + REWRITE_TAC[EXTENSION; IN_IMAGE; IN_DIFF; IN_ELIM_THM; SUBSET] THEN + MESON_TAC[]; + REPEAT STRIP_TAC THEN + EXISTS_TAC `{x | x IN s /\ (f:real^M->real^N) x IN t}` THEN + ASM_REWRITE_TAC[] THEN POP_ASSUM_LIST(MP_TAC o end_itlist CONJ) THEN + REWRITE_TAC[IN_IMAGE; SUBSET; IN_ELIM_THM; NOT_IN_EMPTY; EXTENSION] THEN + MESON_TAC[]]);; + +(* ------------------------------------------------------------------------- *) +(* Continuity implies uniform continuity on a compact domain. *) +(* ------------------------------------------------------------------------- *) + +let COMPACT_UNIFORMLY_CONTINUOUS_FAN = prove + (`!f:real^M->real^N s. + f continuous_on_fan s /\ compact_fan s ==> f uniformly_continuous_on_fan s`, + REPEAT GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN + REWRITE_TAC[continuous_on_fan; RIGHT_IMP_EXISTS_THM; SKOLEM_THM] THEN + DISCH_THEN(X_CHOOSE_TAC `d:real^M->real->real`) THEN + REWRITE_TAC[uniformly_continuous_on_fan] THEN X_GEN_TAC `e:real` THEN + DISCH_TAC THEN FIRST_X_ASSUM(MP_TAC o MATCH_MP HEINE_BOREL_LEMMA_FAN) THEN + DISCH_THEN(MP_TAC o SPEC + `{b | ?x:real^M. x IN s /\ (b = ball_fan(x,d x (e / &2)))}`) THEN + REWRITE_TAC[SUBSET; IN_UNIONS; IN_ELIM_THM; IN_BALL_FAN] THEN + ANTS_TAC THENL + [ASM_MESON_TAC[CENTRE_IN_BALL; REAL_HALF; OPEN_BALL_FAN]; ALL_TAC] THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `k:real` THEN STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN MAP_EVERY X_GEN_TAC [`u:real^M`; `v:real^M`] THEN + STRIP_TAC THEN FIRST_X_ASSUM(fun th -> MP_TAC(SPEC `v:real^M` th) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN(CHOOSE_THEN MP_TAC)) THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + DISCH_THEN(fun th -> + MP_TAC(SPEC `u:real^M` th) THEN MP_TAC(SPEC `v:real^M` th)) THEN + ASM_REWRITE_TAC[DIST_REFL] THEN + FIRST_X_ASSUM(X_CHOOSE_THEN `w:real^M` (CONJUNCTS_THEN2 ASSUME_TAC + SUBST_ALL_TAC)) THEN + REWRITE_TAC[IN_BALL_FAN] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN + REPEAT DISCH_TAC THEN MATCH_MP_TAC DIST_TRIANGLE_HALF_L THEN + ASM_MESON_TAC[REAL_HALF]);; + +(* ------------------------------------------------------------------------- *) +(* Continuity of inverse function on compact domain. *) +(* ------------------------------------------------------------------------- *) + +let CONTINUOUS_ON_INVERSE_FAN = prove + (`!f:real^M->real^N g s. + f continuous_on_fan s /\ compact_fan s /\ (!x. x IN s ==> (g(f(x)) = x)) + ==> g continuous_on_fan (IMAGE f s)`, + REPEAT STRIP_TAC THEN REWRITE_TAC[CONTINUOUS_ON_CLOSED_FAN] THEN + SUBGOAL_THEN `IMAGE g (IMAGE (f:real^M->real^N) s) = s` SUBST1_TAC THENL + [REWRITE_TAC[EXTENSION; IN_IMAGE] THEN ASM_MESON_TAC[]; ALL_TAC] THEN + X_GEN_TAC `t:real^M->bool` THEN DISCH_TAC THEN + REWRITE_TAC[CLOSED_IN_CLOSED_FAN] THEN + EXISTS_TAC `IMAGE (f:real^M->real^N) t` THEN CONJ_TAC THENL + [ASM_MESON_TAC[COMPACT_EQ_BOUNDED_CLOSED_FAN; BOUNDED_SUBSET_FAN; CLOSED_IN_SUBSET; + CONTINUOUS_ON_SUBSET_FAN; CLOSED_IN_CLOSED_TRANS_FAN; COMPACT_CONTINUOUS_IMAGE_FAN]; + REWRITE_TAC[EXTENSION; IN_INTER; IN_ELIM_THM; IN_IMAGE] THEN + ASM_MESON_TAC[CLOSED_IN_SUBSET; SUBSET]]);; + +(* ------------------------------------------------------------------------- *) +(* Topological properties of linear functions. *) +(* ------------------------------------------------------------------------- *) + +let LINEAR_LIM_0_FAN = prove + (`!f. linear f ==> (f --> vec 0) (at_fan (vec 0))`, + REPEAT STRIP_TAC THEN REWRITE_TAC[LIM_AT_FAN] THEN + FIRST_X_ASSUM(MP_TAC o MATCH_MP LINEAR_BOUNDED_POS) THEN + DISCH_THEN(X_CHOOSE_THEN `B:real` STRIP_ASSUME_TAC) THEN + X_GEN_TAC `e:real` THEN DISCH_TAC THEN EXISTS_TAC `e / B` THEN + ASM_SIMP_TAC[REAL_LT_DIV] THEN REWRITE_TAC[dist; VECTOR_SUB_RZERO] THEN + ASM_MESON_TAC[REAL_MUL_SYM; REAL_LET_TRANS; REAL_LT_RDIV_EQ]);; +(*error in old file*) +let LINEAR_CONTINUOUS_AT_FAN = prove + (`!f:real^M->real^N a. linear f ==> f continuous_fan (at_fan a)`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPEC `\x. (f:real^M->real^N) (a + x) - f(a)` LINEAR_LIM_0_FAN) THEN + ANTS_TAC THENL + [POP_ASSUM MP_TAC THEN SIMP_TAC[linear] THEN + REPEAT STRIP_TAC THEN VECTOR_ARITH_TAC; + ALL_TAC THEN + REWRITE_TAC[GSYM LIM_NULL_FAN; CONTINUOUS_AT_FAN]THEN + GEN_REWRITE_TAC RAND_CONV [LIM_AT_ZERO_FAN] THEN SIMP_TAC[]]);; + + +let LINEAR_CONTINUOUS_WITHIN_FAN = prove + (`!f:real^M->real^N s a. linear f ==> f continuous_fan (at_fan x within_fan s)`, + SIMP_TAC[CONTINUOUS_AT_IMP_CONTINUOUS_WITHIN_FAN; LINEAR_CONTINUOUS_AT_FAN]);; + + +let LINEAR_CONTINUOUS_ON_FAN = prove + (`!f:real^M->real^N s. linear f ==> f continuous_on_fan s`, + MESON_TAC[LINEAR_CONTINUOUS_AT_FAN; CONTINUOUS_AT_IMP_CONTINUOUS_ON_FAN]);; + +(* ------------------------------------------------------------------------- *) +(* Topological stuff lifted from and dropped to R *) +(* ------------------------------------------------------------------------- *) + +let OPEN_LIFT_FAN = prove + (`!s. open_fan(IMAGE lift s) <=> + !x. x IN s ==> ?e. &0 < e /\ !x'. abs(x' - x) < e ==> x' IN s`, + REWRITE_TAC[open_def_fan; FORALL_LIFT; LIFT_IN_IMAGE_LIFT; DIST_LIFT]);; + +let BOUNDED_LIFT_FAN = prove + (`!s. bounded_fan(IMAGE lift s) <=> ?a. !x. x IN s ==> abs(x) <= a`, + REWRITE_TAC[bounded_fan; FORALL_LIFT; NORM_LIFT; LIFT_IN_IMAGE_LIFT]);; + +let LIMPT_APPROACHABLE_LIFT_FAN = prove + (`!x s. (lift x) limit_point_of_fan (IMAGE lift s) <=> + !e. &0 < e ==> ?x'. x' IN s /\ ~(x' = x) /\ abs(x' - x) < e`, + REWRITE_TAC[LIMPT_APPROACHABLE_FAN; EXISTS_LIFT; LIFT_IN_IMAGE_LIFT; + LIFT_EQ; DIST_LIFT]);; + +let CLOSED_LIFT_FAN = prove + (`!s. closed_fan (IMAGE lift s) <=> + !x. (!e. &0 < e ==> ?x'. x' IN s /\ ~(x' = x) /\ abs(x' - x) < e) + ==> x IN s`, + GEN_TAC THEN REWRITE_TAC[CLOSED_LIMPT_FAN; LIMPT_APPROACHABLE_FAN] THEN + ONCE_REWRITE_TAC[FORALL_LIFT] THEN + REWRITE_TAC[LIMPT_APPROACHABLE_LIFT_FAN; LIFT_EQ; DIST_LIFT; + EXISTS_LIFT; LIFT_IN_IMAGE_LIFT]);; + +let CONTINUOUS_AT_LIFT_RANGE_FAN = prove + (`!f x. (lift o f) continuous_fan (at_fan x) <=> + !e. &0 < e + ==> ?d. &0 < d /\ + (!x'. norm(x' - x) < d + ==> abs(f x' - f x) < e)`, + REWRITE_TAC[continuous_at_fan; o_THM; DIST_LIFT] THEN REWRITE_TAC[dist]);; + +let CONTINUOUS_ON_LIFT_RANGE_FAN = prove + (`!f s. (lift o f) continuous_on_fan s <=> + !x. x IN s + ==> !e. &0 < e + ==> ?d. &0 < d /\ + (!x'. x' IN s /\ norm(x' - x) < d + ==> abs(f x' - f x) < e)`, + REWRITE_TAC[continuous_on_fan; o_THM; DIST_LIFT] THEN REWRITE_TAC[dist]);; + +let CONTINUOUS_AT_LIFT_NORM_FAN = prove + (`!x. (lift o norm) continuous_fan (at_fan x)`, + REWRITE_TAC[CONTINUOUS_AT_LIFT_RANGE_FAN; NORM_LIFT] THEN + MESON_TAC[REAL_ABS_SUB_NORM; REAL_LET_TRANS]);; + +let CONTINUOUS_ON_LIFT_NORM_FAN = prove + (`!s. (lift o norm) continuous_on_fan s`, + REWRITE_TAC[CONTINUOUS_ON_LIFT_RANGE_FAN; NORM_LIFT] THEN + MESON_TAC[REAL_ABS_SUB_NORM; REAL_LET_TRANS]);; + +let CONTINUOUS_AT_LIFT_COMPONENT_FAN = prove + (`!i a. 1 <= i /\ i <= dimindex(:N) + ==> (\x:real^N. lift(x$i)) continuous_fan (at_fan a)`, + SIMP_TAC[continuous_at_fan; DIST_LIFT; GSYM VECTOR_SUB_COMPONENT] THEN + MESON_TAC[dist; REAL_LET_TRANS; COMPONENT_LE_NORM]);; + +let CONTINUOUS_ON_LIFT_COMPONENT_FAN = prove + (`!i s. 1 <= i /\ i <= dimindex(:N) + ==> (\x:real^N. lift(x$i)) continuous_on_fan s`, + SIMP_TAC[continuous_on_fan; DIST_LIFT; GSYM VECTOR_SUB_COMPONENT] THEN + MESON_TAC[dist; REAL_LET_TRANS; COMPONENT_LE_NORM]);; + +(* ------------------------------------------------------------------------- *) +(* Hence some handy theorems on distance, diameter etc. of/from a set. *) +(* ------------------------------------------------------------------------- *) + +let BOUNDED_HAS_SUP_FAN = prove + (`!s. bounded_fan(IMAGE lift s) /\ ~(s = {}) + ==> (!x. x IN s ==> x <= sup s) /\ + (!b. (!x. x IN s ==> x <= b) ==> sup s <= b)`, + REWRITE_TAC[BOUNDED_LIFT_FAN; IMAGE_EQ_EMPTY] THEN + MESON_TAC[SUP; REAL_ARITH `abs(x) <= a ==> x <= a`]);; + +let BOUNDED_HAS_INF_FAN = prove + (`!s. bounded_fan(IMAGE lift s) /\ ~(s = {}) + ==> (!x. x IN s ==> inf s <= x) /\ + (!b. (!x. x IN s ==> b <= x) ==> b <= inf s)`, + REWRITE_TAC[BOUNDED_LIFT_FAN; IMAGE_EQ_EMPTY] THEN + MESON_TAC[INF; REAL_ARITH `abs(x) <= a ==> --a <= x`]);; + +let COMPACT_ATTAINS_SUP_FAN = prove + (`!s. compact_fan (IMAGE lift s) /\ ~(s = {}) + ==> ?x. x IN s /\ !y. y IN s ==> y <= x`, + REWRITE_TAC[COMPACT_EQ_BOUNDED_CLOSED_FAN] THEN REPEAT STRIP_TAC THEN + MP_TAC(SPEC `s:real->bool` BOUNDED_HAS_SUP_FAN) THEN ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN EXISTS_TAC `sup s` THEN ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[CLOSED_LIFT_FAN; REAL_ARITH `s <= s - e <=> ~(&0 < e)`; + REAL_ARITH `x <= s /\ ~(x <= s - e) ==> abs(x - s) < e`]);; + +let COMPACT_ATTAINS_INF_FAN = prove + (`!s. compact_fan (IMAGE lift s) /\ ~(s = {}) + ==> ?x. x IN s /\ !y. y IN s ==> x <= y`, + REWRITE_TAC[COMPACT_EQ_BOUNDED_CLOSED_FAN] THEN REPEAT STRIP_TAC THEN + MP_TAC(SPEC `s:real->bool` BOUNDED_HAS_INF_FAN) THEN ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN EXISTS_TAC `inf s` THEN ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[CLOSED_LIFT_FAN; REAL_ARITH `s + e <= s <=> ~(&0 < e)`; + REAL_ARITH `s <= x /\ ~(s + e <= x) ==> abs(x - s) < e`]);; + +let CONTINUOUS_ATTAINS_SUP_FAN = prove + (`!f:real^N->real s. + compact_fan s /\ ~(s = {}) /\ (lift o f) continuous_on_fan s + ==> ?x. x IN s /\ !y. y IN s ==> f(y) <= f(x)`, + REPEAT STRIP_TAC THEN + MP_TAC(SPEC `IMAGE (f:real^N->real) s` COMPACT_ATTAINS_SUP_FAN) THEN + ASM_SIMP_TAC[GSYM IMAGE_o; COMPACT_CONTINUOUS_IMAGE_FAN; IMAGE_EQ_EMPTY] THEN + MESON_TAC[IN_IMAGE]);; + +let CONTINUOUS_ATTAINS_INF_FAN = prove + (`!f:real^N->real s. + compact_fan s /\ ~(s = {}) /\ (lift o f) continuous_on_fan s + ==> ?x. x IN s /\ !y. y IN s ==> f(x) <= f(y)`, + REPEAT STRIP_TAC THEN + MP_TAC(SPEC `IMAGE (f:real^N->real) s` COMPACT_ATTAINS_INF_FAN) THEN + ASM_SIMP_TAC[GSYM IMAGE_o; COMPACT_CONTINUOUS_IMAGE_FAN; IMAGE_EQ_EMPTY] THEN + MESON_TAC[IN_IMAGE]);; + +let DISTANCE_ATTAINS_SUP_FAN = prove + (`!s a. compact_fan s /\ ~(s = {}) + ==> ?x. x IN s /\ !y. y IN s ==> dist(a,y) <= dist(a,x)`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC CONTINUOUS_ATTAINS_SUP_FAN THEN + ASM_REWRITE_TAC[CONTINUOUS_ON_LIFT_RANGE_FAN] THEN REWRITE_TAC[dist] THEN + ASM_MESON_TAC[REAL_LET_TRANS; REAL_ABS_SUB_NORM; NORM_NEG; + VECTOR_ARITH `(a - x) - (a - y) = --(x - y):real^N`]);; + +(* ------------------------------------------------------------------------- *) +(* For *minimal* distance, we only need closure, not compactness. *) +(* ------------------------------------------------------------------------- *) + +let DISTANCE_ATTAINS_INF_FAN = prove + (`!s a:real^N. + closed_fan s /\ ~(s = {}) + ==> ?x. x IN s /\ !y. y IN s ==> dist(a,x) <= dist(a,y)`, + REPEAT GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + DISCH_THEN(X_CHOOSE_TAC `b:real^N`) THEN + MP_TAC(ISPECL [`\x:real^N. dist(a,x)`; `cball_fan(a:real^N,dist(b,a)) INTER s`] + CONTINUOUS_ATTAINS_INF_FAN) THEN + ANTS_TAC THENL + [ASM_SIMP_TAC[COMPACT_EQ_BOUNDED_CLOSED_FAN; CLOSED_INTER_FAN; BOUNDED_INTER_FAN; + BOUNDED_CBALL_FAN; CLOSED_CBALL_FAN; GSYM MEMBER_NOT_EMPTY] THEN + REWRITE_TAC[dist; CONTINUOUS_ON_LIFT_RANGE_FAN; IN_INTER; IN_CBALL_FAN] THEN + ASM_MESON_TAC[REAL_LET_TRANS; REAL_ABS_SUB_NORM; NORM_NEG; REAL_LE_REFL; + NORM_SUB; VECTOR_ARITH `(a - x) - (a - y) = --(x - y):real^N`]; + MATCH_MP_TAC MONO_EXISTS THEN REWRITE_TAC[IN_INTER; IN_CBALL_FAN] THEN + ASM_MESON_TAC[DIST_SYM; REAL_LE_TOTAL; REAL_LE_TRANS]]);; + +(* ------------------------------------------------------------------------- *) +(* And so we have continuity of inverse. *) +(* ------------------------------------------------------------------------- *) + +let LIM_INV_FAN = prove + (`!net_fan:(A)net_fan f l. + ((lift o f) --> lift l) net_fan /\ ~(l = &0) + ==> ((lift o inv o f) --> lift(inv l)) net_fan`, + REPEAT GEN_TAC THEN REWRITE_TAC[lim_fan] THEN + ASM_CASES_TAC `trivial_limit_fan(net_fan:(A)net_fan)` THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[o_THM; DIST_LIFT] THEN STRIP_TAC THEN + X_GEN_TAC `e:real` THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `min (abs(l) / &2) ((l pow 2 * e) / &2)`) THEN + REWRITE_TAC[REAL_LT_MIN] THEN ANTS_TAC THENL + [ASM_SIMP_TAC[GSYM REAL_ABS_NZ; REAL_LT_DIV; REAL_OF_NUM_LT; ARITH] THEN + MATCH_MP_TAC REAL_LT_DIV THEN REWRITE_TAC[REAL_OF_NUM_LT; ARITH] THEN + ONCE_REWRITE_TAC[GSYM REAL_POW2_ABS] THEN + ASM_SIMP_TAC[REAL_LT_MUL; GSYM REAL_ABS_NZ; REAL_POW_LT]; + ALL_TAC] THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `a:A` THEN + MATCH_MP_TAC MONO_AND THEN REWRITE_TAC[] THEN + MATCH_MP_TAC MONO_FORALL THEN X_GEN_TAC `b:A` THEN + MATCH_MP_TAC MONO_IMP THEN REWRITE_TAC[] THEN + SIMP_TAC[REAL_LT_RDIV_EQ; REAL_OF_NUM_LT; ARITH] THEN STRIP_TAC THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP (REAL_ARITH + `abs(x - l) * &2 < abs l ==> ~(x = &0)`)) THEN + ASM_SIMP_TAC[REAL_SUB_INV; REAL_ABS_DIV; REAL_LT_LDIV_EQ; + GSYM REAL_ABS_NZ; REAL_ENTIRE] THEN + FIRST_ASSUM(MATCH_MP_TAC o MATCH_MP (REAL_ARITH + `abs(x - y) * &2 < b * c ==> c * b <= d * &2 ==> abs(y - x) < d`)) THEN + ASM_SIMP_TAC[GSYM REAL_MUL_ASSOC; REAL_LE_LMUL_EQ] THEN + ONCE_REWRITE_TAC[GSYM REAL_POW2_ABS] THEN ONCE_REWRITE_TAC[REAL_MUL_SYM] THEN + ASM_SIMP_TAC[REAL_ABS_MUL; REAL_POW_2; REAL_MUL_ASSOC; GSYM REAL_ABS_NZ; + REAL_LE_RMUL_EQ] THEN + ASM_SIMP_TAC[REAL_ARITH `abs(x - y) * &2 < abs y ==> abs y <= &2 * abs x`]);; + +let CONTINUOUS_INV_FAN = prove + (`!net f. (lift o f) continuous_fan net_fan /\ ~(f(netlimit_fan net_fan) = &0) + ==> (lift o inv o f) continuous_fan net_fan`, + REWRITE_TAC[continuous_fan; LIM_INV_FAN; o_THM]);; + +let CONTINUOUS_AT_WITHIN_INV_FAN = prove + (`!f s a:real^N. + (lift o f) continuous_fan (at_fan a within_fan s) /\ ~(f a = &0) + ==> (lift o inv o f) continuous_fan (at_fan a within_fan s)`, + REPEAT GEN_TAC THEN + ASM_CASES_TAC `trivial_limit_fan (at_fan (a:real^N) within_fan s)` THENL + [ASM_REWRITE_TAC[continuous_fan; lim_fan]; + ASM_SIMP_TAC[NETLIMIT_WITHIN_FAN; CONTINUOUS_INV_FAN]]);; + +let CONTINUOUS_AT_INV_FAN = prove + (`!f a. (lift o f) continuous_fan at_fan a /\ ~(f a = &0) + ==> (lift o inv o f) continuous_fan at_fan a`, + ONCE_REWRITE_TAC[GSYM WITHIN_UNIV_FAN] THEN + REWRITE_TAC[CONTINUOUS_AT_WITHIN_INV_FAN]);; + +(* ------------------------------------------------------------------------- *) +(* Preservation properties for pasted sets. *) +(* ------------------------------------------------------------------------- *) + +let BOUNDED_PASTECART_FAN = prove + (`!s:real^M->bool t:real^N->bool. + bounded_fan s /\ bounded_fan t ==> bounded_fan {pastecart x y | x IN s /\ y IN t}`, + REPEAT GEN_TAC THEN REWRITE_TAC[bounded_fan; IN_ELIM_THM] THEN + ASM_MESON_TAC[NORM_PASTECART; REAL_LE_ADD2; REAL_LE_TRANS]);; + +let CLOSED_PASTECART_FAN = prove + (`!s:real^M->bool t:real^N->bool. + closed_fan s /\ closed_fan t ==> closed_fan {pastecart x y | x IN s /\ y IN t}`, + REPEAT GEN_TAC THEN REWRITE_TAC[CLOSED_SEQUENTIAL_LIMITS_FAN] THEN + REWRITE_TAC[LIM_SEQUENTIALLY_FAN; IN_ELIM_THM; dist] THEN STRIP_TAC THEN + MAP_EVERY X_GEN_TAC + [`z:num->real^(M,N)finite_sum`; `l:real^(M,N)finite_sum`] THEN + DISCH_THEN(CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN + REWRITE_TAC[SKOLEM_THM; LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`x:num->real^M`; `y:num->real^N`] THEN + REWRITE_TAC[FORALL_AND_THM] THEN STRIP_TAC THEN + MAP_EVERY EXISTS_TAC + [`fstcart(l:real^(M,N)finite_sum)`; `sndcart(l:real^(M,N)finite_sum)`] THEN + REWRITE_TAC[PASTECART_FST_SND] THEN + CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THENL + [EXISTS_TAC `x:num->real^M`; EXISTS_TAC `y:num->real^N`] THEN + ASM_REWRITE_TAC[] THEN X_GEN_TAC `e:real` THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `e:real`) THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC MONO_EXISTS THEN ASM_REWRITE_TAC[] THEN + GEN_TAC THEN MATCH_MP_TAC MONO_FORALL THEN GEN_TAC THEN + MATCH_MP_TAC MONO_IMP THEN REWRITE_TAC[] THEN + MATCH_MP_TAC(REAL_ARITH `x <= y ==> y < a ==> x < a`) THEN + MESON_TAC[NORM_FSTCART; FSTCART_SUB; FSTCART_PASTECART; + NORM_SNDCART; SNDCART_SUB; SNDCART_PASTECART]);; + +let COMPACT_PASTECART_FAN = prove + (`!s:real^M->bool t:real^N->bool. + compact_fan s /\ compact_fan t ==> compact_fan {pastecart x y | x IN s /\ y IN t}`, + SIMP_TAC[COMPACT_EQ_BOUNDED_CLOSED_FAN; BOUNDED_PASTECART_FAN; CLOSED_PASTECART_FAN]);; + +(* ------------------------------------------------------------------------- *) +(* Hence some useful properties follow quite easily. *) +(* ------------------------------------------------------------------------- *) + +let COMPACT_MULTIPLES_FAN = prove + (`!s:real^N->bool c. compact_fan s ==> compact_fan (IMAGE (\x. c % x) s)`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC COMPACT_CONTINUOUS_IMAGE_FAN THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC CONTINUOUS_AT_IMP_CONTINUOUS_ON_FAN THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC LINEAR_CONTINUOUS_AT_FAN THEN + REWRITE_TAC[linear] THEN CONJ_TAC THEN VECTOR_ARITH_TAC);; + +let COMPACT_NEGATIONS_FAN = prove + (`!s:real^N->bool. compact_fan s ==> compact_fan (IMAGE (--) s)`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC COMPACT_CONTINUOUS_IMAGE_FAN THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC CONTINUOUS_AT_IMP_CONTINUOUS_ON_FAN THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC LINEAR_CONTINUOUS_AT_FAN THEN + REWRITE_TAC[linear] THEN CONJ_TAC THEN VECTOR_ARITH_TAC);; + +let COMPACT_SUMS_FAN = prove + (`!s:real^N->bool t. + compact_fan s /\ compact_fan t ==> compact_fan {x + y | x IN s /\ y IN t}`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `{x + y | x IN s /\ y IN t} = + IMAGE (\z. fstcart z + sndcart z :real^N) + {pastecart x y | x IN s /\ y IN t}` + SUBST1_TAC THENL + [REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_IMAGE] THEN + GEN_TAC THEN EQ_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[FSTCART_PASTECART; SNDCART_PASTECART; PASTECART_FST_SND]; + ALL_TAC] THEN + MATCH_MP_TAC COMPACT_CONTINUOUS_IMAGE_FAN THEN + ASM_SIMP_TAC[COMPACT_PASTECART_FAN] THEN + MATCH_MP_TAC CONTINUOUS_AT_IMP_CONTINUOUS_ON_FAN THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC LINEAR_CONTINUOUS_AT_FAN THEN + REWRITE_TAC[linear; FSTCART_ADD; FSTCART_CMUL; SNDCART_ADD; + SNDCART_CMUL] THEN + CONJ_TAC THEN VECTOR_ARITH_TAC);; + +let COMPACT_DIFFERENCES_FAN = prove + (`!s:real^N->bool t. + compact_fan s /\ compact_fan t ==> compact_fan {x - y | x IN s /\ y IN t}`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `{x - y | x:real^N IN s /\ y IN t} = + {x + y | x IN s /\ y IN (IMAGE (--) t)}` + (fun th -> ASM_SIMP_TAC[th; COMPACT_SUMS_FAN; COMPACT_NEGATIONS_FAN]) THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_IMAGE] THEN + ONCE_REWRITE_TAC[VECTOR_ARITH `(x:real^N = --y) <=> (y = --x)`] THEN + SIMP_TAC[VECTOR_SUB; GSYM CONJ_ASSOC; UNWIND_THM2] THEN + MESON_TAC[VECTOR_NEG_NEG]);; + +let COMPACT_TRANSLATION_FAN = prove + (`!s a:real^N. compact_fan s ==> compact_fan (IMAGE (\x. a + x) s)`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPECL [`{a:real^N}`; `s:real^N->bool`] COMPACT_SUMS_FAN) THEN + ASM_REWRITE_TAC[COMPACT_SING_FAN] THEN + MATCH_MP_TAC EQ_IMP THEN AP_TERM_TAC THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_SING; IN_IMAGE] THEN MESON_TAC[]);; + +let COMPACT_AFFINITY_FAN = prove + (`!s a:real^N c. + compact_fan s ==> compact_fan (IMAGE (\x. a + c % x) s)`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `(\x:real^N. a + c % x) = (\x. a + x) o (\x. c % x)` + SUBST1_TAC THENL [REWRITE_TAC[o_DEF]; ALL_TAC] THEN + ASM_SIMP_TAC[IMAGE_o; COMPACT_TRANSLATION_FAN; COMPACT_MULTIPLES_FAN]);; + +(* ------------------------------------------------------------------------- *) +(* Hence we get the following. *) +(* ------------------------------------------------------------------------- *) + +let COMPACT_SUP_MAXDISTANCE_FAN = prove + (`!s:real^N->bool. + compact_fan s /\ ~(s = {}) + ==> ?x y. x IN s /\ y IN s /\ + !u v. u IN s /\ v IN s ==> norm(u - v) <= norm(x - y)`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPECL [`{x - y:real^N | x IN s /\ y IN s}`; `vec 0:real^N`] + DISTANCE_ATTAINS_SUP_FAN) THEN + ANTS_TAC THENL + [ASM_SIMP_TAC[COMPACT_DIFFERENCES_FAN] THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM; NOT_IN_EMPTY] THEN + ASM_MESON_TAC[MEMBER_NOT_EMPTY]; + REWRITE_TAC[IN_ELIM_THM; dist; VECTOR_SUB_RZERO; VECTOR_SUB_LZERO; + NORM_NEG] THEN + MESON_TAC[]]);; + +(* ------------------------------------------------------------------------- *) +(* We can state this in terms of diameter of a set. *) +(* ------------------------------------------------------------------------- *) + +let diameter_fan = new_definition + `diameter_fan s = + if s = {} then &0 + else sup {norm(x - y) | x IN s /\ y IN s}`;; + +let DIAMETER_BOUNDED_FAN = prove + (`!s. bounded_fan s + ==> (!x:real^N y. x IN s /\ y IN s ==> norm(x - y) <= diameter_fan s) /\ + (!d. &0 <= d /\ d < diameter_fan s + ==> ?x y. x IN s /\ y IN s /\ norm(x - y) > d)`, + GEN_TAC THEN DISCH_TAC THEN + ASM_CASES_TAC `s:real^N->bool = {}` THEN + ASM_REWRITE_TAC[diameter_fan; NOT_IN_EMPTY; REAL_LET_ANTISYM] THEN + MP_TAC(SPEC `{norm(x - y:real^N) | x IN s /\ y IN s}` SUP) THEN + ABBREV_TAC `b = sup {norm(x - y:real^N) | x IN s /\ y IN s}` THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN + REWRITE_TAC[NOT_IN_EMPTY; real_gt] THEN ANTS_TAC THENL + [CONJ_TAC THENL [ASM_MESON_TAC[MEMBER_NOT_EMPTY]; ALL_TAC]; + MESON_TAC[REAL_NOT_LE]] THEN + SIMP_TAC[VECTOR_SUB; LEFT_IMP_EXISTS_THM] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [bounded_fan]) THEN + MESON_TAC[REAL_ARITH `x <= y + z /\ y <= b /\ z<= b ==> x <= b + b`; + NORM_TRIANGLE; NORM_NEG]);; + +let DIAMETER_BOUNDED_BOUND_FAN = prove + (`!s x y. bounded_fan s /\ x IN s /\ y IN s ==> norm(x - y) <= diameter_fan s`, + MESON_TAC[DIAMETER_BOUNDED_FAN]);; + +let DIAMETER_COMPACT_ATTAINED_FAN = prove + (`!s:real^N->bool. + compact_fan s /\ ~(s = {}) + ==> ?x y. x IN s /\ y IN s /\ (norm(x - y) = diameter_fan s)`, + GEN_TAC THEN DISCH_TAC THEN + FIRST_ASSUM(MP_TAC o MATCH_MP COMPACT_SUP_MAXDISTANCE_FAN) THEN + REPEAT(MATCH_MP_TAC MONO_EXISTS THEN GEN_TAC) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + MP_TAC(SPEC `s:real^N->bool` DIAMETER_BOUNDED_FAN) THEN + RULE_ASSUM_TAC(REWRITE_RULE[COMPACT_EQ_BOUNDED_CLOSED_FAN]) THEN + ASM_REWRITE_TAC[real_gt] THEN STRIP_TAC THEN + REWRITE_TAC[GSYM REAL_LE_ANTISYM] THEN + ASM_MESON_TAC[NORM_POS_LE; REAL_NOT_LT]);; + +(* ------------------------------------------------------------------------- *) +(* Related results with closure as the conclusion. *) +(* ------------------------------------------------------------------------- *) + +let CLOSED_MULTIPLES_FAN = prove + (`!s:real^N->bool c. closed_fan s ==> closed_fan (IMAGE (\x. c % x) s)`, + REPEAT GEN_TAC THEN + ASM_CASES_TAC `s :real^N->bool = {}` THEN + ASM_REWRITE_TAC[CLOSED_EMPTY_FAN; IMAGE_CLAUSES] THEN + ASM_CASES_TAC `c = &0` THENL + [SUBGOAL_THEN `IMAGE (\x:real^N. c % x) s = {(vec 0)}` + (fun th -> REWRITE_TAC[th; CLOSED_SING_FAN]) THEN + ASM_REWRITE_TAC[EXTENSION; IN_IMAGE; IN_SING; VECTOR_MUL_LZERO] THEN + ASM_MESON_TAC[MEMBER_NOT_EMPTY]; + ALL_TAC] THEN + REWRITE_TAC[CLOSED_SEQUENTIAL_LIMITS_FAN; IN_IMAGE; SKOLEM_THM] THEN + STRIP_TAC THEN X_GEN_TAC `x:num->real^N` THEN X_GEN_TAC `l:real^N` THEN + DISCH_THEN(CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN + DISCH_THEN(X_CHOOSE_THEN `y:num->real^N` MP_TAC) THEN + REWRITE_TAC[FORALL_AND_THM] THEN STRIP_TAC THEN + EXISTS_TAC `inv(c) % l :real^N` THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_RINV; VECTOR_MUL_LID] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN EXISTS_TAC `\n:num. inv(c) % x n:real^N` THEN + ASM_REWRITE_TAC[] THEN CONJ_TAC THENL + [ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; VECTOR_MUL_LID]; + MATCH_MP_TAC LIM_CMUL_FAN THEN + FIRST_ASSUM(fun th -> REWRITE_TAC[SYM(SPEC_ALL th)]) THEN + ASM_REWRITE_TAC[ETA_AX]]);; + +let CLOSED_NEGATIONS_FAN = prove + (`!s:real^N->bool. closed_fan s ==> closed_fan (IMAGE (--) s)`, + REPEAT GEN_TAC THEN + SUBGOAL_THEN `IMAGE (--) s = IMAGE (\x:real^N. --(&1) % x) s` + SUBST1_TAC THEN SIMP_TAC[CLOSED_MULTIPLES_FAN] THEN + REWRITE_TAC[VECTOR_ARITH `--(&1) % x = --x`] THEN REWRITE_TAC[ETA_AX]);; + +(* ------------------------------------------------------------------------- *) +(* A cute way of denoting open and closed intervals using overloading. *) +(* ------------------------------------------------------------------------- *) + +let open_interval_fan = new_definition + `open_interval_fan(a:real^N,b:real^N) = + {x:real^N | !i. 1 <= i /\ i <= dimindex(:N) + ==> a$i < x$i /\ x$i < b$i}`;; + +let closed_interval_fan = new_definition + `closed_interval_fan(l:(real^N#real^N)list) = + {x:real^N | !i. 1 <= i /\ i <= dimindex(:N) + ==> FST(HD l)$i <= x$i /\ x$i <= SND(HD l)$i}`;; + +make_overloadable "interval_fan" `:A`;; + +overload_interface("interval_fan",`open_interval_fan`);; +overload_interface("interval_fan",`closed_interval_fan`);; + +let interval_fan = prove + (`(interval_fan (a,b) = {x:real^N | !i. 1 <= i /\ i <= dimindex(:N) + ==> a$i < x$i /\ x$i < b$i}) /\ + (interval_fan [a,b] = {x:real^N | !i. 1 <= i /\ i <= dimindex(:N) + ==> a$i <= x$i /\ x$i <= b$i})`, + REWRITE_TAC[open_interval_fan; closed_interval_fan; HD; FST; SND]);; + +let IN_INTERVAL_FAN = prove + (`(!x:real^N. + x IN interval_fan (a,b) <=> + !i. 1 <= i /\ i <= dimindex(:N) + ==> a$i < x$i /\ x$i < b$i) /\ + (!x:real^N. + x IN interval_fan [a,b] <=> + !i. 1 <= i /\ i <= dimindex(:N) + ==> a$i <= x$i /\ x$i <= b$i)`, + REWRITE_TAC[interval_fan; IN_ELIM_THM]);; + + +(* ------------------------------------------------------------------------- *) +(* Some stuff for half-infinite intervals too; maybe I need a notation? *) +(* ------------------------------------------------------------------------- *) + +let CLOSED_INTERVAL_LEFT_FAN = prove + (`!b:real^N. + closed_fan + {x:real^N | !i. 1 <= i /\ i <= dimindex(:N) ==> x$i <= b$i}`, + REWRITE_TAC[CLOSED_LIMPT_FAN; LIMPT_APPROACHABLE_FAN; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN REWRITE_TAC[GSYM REAL_NOT_LT] THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `(x:real^N)$i - (b:real^N)$i`) THEN + ASM_REWRITE_TAC[REAL_SUB_LT] THEN + DISCH_THEN(X_CHOOSE_THEN `z:real^N` MP_TAC) THEN + REPEAT(DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + REWRITE_TAC[dist; REAL_NOT_LT] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `abs((z - x :real^N)$i)` THEN + ASM_SIMP_TAC[COMPONENT_LE_NORM] THEN + ASM_SIMP_TAC[VECTOR_SUB_COMPONENT] THEN + ASM_SIMP_TAC[REAL_ARITH `z <= b /\ b < x ==> x - b <= abs(z - x)`]);; + +let CLOSED_INTERVAL_RIGHT_FAN = prove + (`!a:real^N. + closed_fan + {x:real^N | !i. 1 <= i /\ i <= dimindex(:N) ==> a$i <= x$i}`, + REWRITE_TAC[CLOSED_LIMPT_FAN; LIMPT_APPROACHABLE_FAN; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN REWRITE_TAC[GSYM REAL_NOT_LT] THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `(a:real^N)$i - (x:real^N)$i`) THEN + ASM_REWRITE_TAC[REAL_SUB_LT] THEN + DISCH_THEN(X_CHOOSE_THEN `z:real^N` MP_TAC) THEN + REPEAT(DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + REWRITE_TAC[dist; REAL_NOT_LT] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `abs((z - x :real^N)$i)` THEN + ASM_SIMP_TAC[COMPONENT_LE_NORM] THEN + ASM_SIMP_TAC[VECTOR_SUB_COMPONENT] THEN + ASM_SIMP_TAC[REAL_ARITH `x < a /\ a <= z ==> a - x <= abs(z - x)`]);; + +(* ------------------------------------------------------------------------- *) +(* Closure of halfspaces and hyperplanes. *) +(* ------------------------------------------------------------------------- *) + +let LIM_LIFT_DOT_FAN = prove + (`!f:real^M->real^N a. + (f --> l) net_fan ==> ((lift o (\y. a dot f(y))) --> lift(a dot l)) net_fan`, + REPEAT GEN_TAC THEN ASM_CASES_TAC `a = vec 0:real^N` THENL + [ASM_REWRITE_TAC[DOT_LZERO; LIFT_NUM; o_DEF; LIM_CONST_FAN]; ALL_TAC] THEN + REWRITE_TAC[lim_fan] THEN MATCH_MP_TAC MONO_OR THEN REWRITE_TAC[] THEN + DISCH_TAC THEN X_GEN_TAC `e:real` THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `e / norm(a:real^N)`) THEN + ASM_SIMP_TAC[REAL_LT_DIV; NORM_POS_LT; REAL_LT_RDIV_EQ] THEN + REWRITE_TAC[dist; o_THM; GSYM LIFT_SUB; GSYM DOT_RSUB; NORM_LIFT] THEN + ONCE_REWRITE_TAC[DOT_SYM] THEN + MESON_TAC[NORM_CAUCHY_SCHWARZ_ABS; REAL_MUL_SYM; REAL_LET_TRANS]);; + +let CONTINUOUS_AT_LIFT_DOT_FAN = prove + (`!a:real^N x. (lift o (\y. a dot y)) continuous_fan at_fan x`, + REPEAT GEN_TAC THEN REWRITE_TAC[CONTINUOUS_AT_FAN; o_THM] THEN + MATCH_MP_TAC LIM_LIFT_DOT_FAN THEN REWRITE_TAC[LIM_AT_FAN] THEN MESON_TAC[]);; + +let CONTINUOUS_ON_LIFT_DOT_FAN = prove + (`!s x. (lift o (\y. a dot y)) continuous_on_fan s`, + SIMP_TAC[CONTINUOUS_AT_IMP_CONTINUOUS_ON_FAN; CONTINUOUS_AT_LIFT_DOT_FAN]);; + +let CLOSED_HALFSPACE_LE_FAN = prove + (`!a:real^N b. closed_fan {x | a dot x <= b}`, + REPEAT GEN_TAC THEN + MP_TAC(ISPECL [`(:real^N)`; `a:real^N`] CONTINUOUS_ON_LIFT_DOT_FAN) THEN + REWRITE_TAC[CONTINUOUS_ON_CLOSED_FAN; GSYM CLOSED_IN_FAN] THEN + DISCH_THEN(MP_TAC o SPEC + `IMAGE lift {r | ?x:real^N. (a dot x = r) /\ r <= b}`) THEN + ANTS_TAC THENL + [ALL_TAC; + MATCH_MP_TAC EQ_IMP THEN AP_TERM_TAC THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_IMAGE; IN_UNIV] THEN + REWRITE_TAC[o_DEF] THEN MESON_TAC[LIFT_DROP]] THEN + REWRITE_TAC[CLOSED_IN_CLOSED_FAN] THEN + EXISTS_TAC `{x | !i. 1 <= i /\ i <= dimindex(:1) + ==> (x:real^1)$i <= (lift b)$i}` THEN + REWRITE_TAC[CLOSED_INTERVAL_LEFT_FAN] THEN + SIMP_TAC[EXTENSION; IN_IMAGE; IN_UNIV; IN_ELIM_THM; IN_INTER; IN_INTERVAL_FAN; + VEC_COMPONENT; DIMINDEX_1; LAMBDA_BETA; o_THM] THEN + SIMP_TAC[ARITH_RULE `1 <= i /\ i <= 1 <=> (i = 1)`] THEN + REWRITE_TAC[GSYM drop; LEFT_FORALL_IMP_THM; EXISTS_REFL] THEN + MESON_TAC[LIFT_DROP]);; + +let CLOSED_HALFSPACE_GE_FAN = prove + (`!a:real^N b. closed_fan {x | a dot x >= b}`, + REWRITE_TAC[REAL_ARITH `a >= b <=> --a <= --b`] THEN + REWRITE_TAC[GSYM DOT_LNEG; CLOSED_HALFSPACE_LE_FAN]);; + +let CLOSED_HYPERPLANE_FAN = prove + (`!a b. closed_fan {x | a dot x = b}`, + REPEAT GEN_TAC THEN REWRITE_TAC[GSYM REAL_LE_ANTISYM] THEN + REWRITE_TAC[REAL_ARITH `b <= a dot x <=> a dot x >= b`] THEN + REWRITE_TAC[SET_RULE `{x | P x /\ Q x} = {x | P x} INTER {x | Q x}`] THEN + SIMP_TAC[CLOSED_INTER_FAN; CLOSED_HALFSPACE_LE_FAN; CLOSED_HALFSPACE_GE_FAN]);; + + + + diff --git a/legacy/oldfan/fully_surrounded.hl b/legacy/oldfan/fully_surrounded.hl new file mode 100755 index 0000000..f69dce1 --- /dev/null +++ b/legacy/oldfan/fully_surrounded.hl @@ -0,0 +1,139 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + + +module Fully_surrounded = struct + + + +open Sphere;; +open Fan_defs;; +open Hypermap_of_fan;; +open Tactic_fan;; +open Lemma_fan;; +open Fan;; +open Hypermap_of_fan;; +open Node_fan;; +open Azim_node;; +open Sum_azim_node;; +open Disjoint_fan;; +open Lead_fan;; +open Fan_misc;; +open Leads_into_fan;; + + +(* ========================================================================== *) +(* FAN AND CONVEX *) +(* ========================================================================== *) + + +let fan81=new_definition`fan81 (x:real^3,(V:real^3->bool),(E:(real^3->bool)->bool)):bool<=>(!v:real^3 u:real^3. {v,u} IN E ==> azim_fan x V E v u bool),(E:(real^3->bool)->bool)):bool<=>(!v:real^3 u:real^3. {v,u} IN E ==> &0< azim x v u (sigma_fan x V E v u) /\ azim x v u (sigma_fan x V E v u) bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> d_fan(x,V,E)=d1_fan(x,V,E)`, +REPEAT STRIP_TAC +THEN MRESA_TAC fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN ASM_REWRITE_TAC[d_fan;] +THEN SET_TAC[]);; + + +let properties_of_elements_in_face_fully_surroundedfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ y IN ds +==> {pr2 y, pr3 y} IN E`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y IN ds /\ ds SUBSET d_fan (x,V,E)==> y IN d_fan (x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr2;pr3]);; + + + + + +let properties_fully_surrounded=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ (&0< azim x u w v ) /\ (azim x u w v ~coplanar {x,v,u,w}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{x,v,u,w}={x,u,w,v}`] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`{v,u} IN (E:(real^3->bool)->bool)` +THEN REWRITE_TAC[SET_RULE`{v,u}={u,v}`] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`w:real^3`;`v:real^3`] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + + + + + +let exists_edge_fully_surround_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) w:real^3. +FAN(x,V,E) /\ w IN V +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> ?v. {w,v} IN E /\ v IN V`, +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`) +THEN SUBGOAL_THEN`~(set_of_edge (w:real^3) V E={})`ASSUME_TAC +THENL[ POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "YEU") THEN STRIP_TAC THEN REMOVE_THEN "YEU" MP_TAC +THEN ASM_REWRITE_TAC[CARD_CLAUSES] THEN ARITH_TAC; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`; set_of_edge;IN_ELIM_THM]]);; + + + + +let nonsetedge_fully_surround_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +(!v. v IN V==>CARD (set_of_edge v V E) >1)/\ FAN(x,V,E) +==> ~(E={})`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[] +THEN POP_ASSUM (fun th-> MP_TAC th THEN REWRITE_TAC[FAN;fan1] THEN STRIP_TAC THEN ASSUME_TAC(th)) +THEN FIND_ASSUM MP_TAC(`~((V:real^3->bool) SUBSET {})`) +THEN REWRITE_TAC[SET_RULE`~(V SUBSET {})<=> ?w. w IN V`] +THEN STRIP_TAC +THEN MRESA_TAC exists_edge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`] +THEN ASM_TAC THEN SET_TAC[]);; + +let v_subset_xfan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> V SUBSET xfan(x,V,E)`, +REWRITE_TAC[xfan;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC exists_edge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` x':real^3`] +THEN EXISTS_TAC`{x',v:real^3}` +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v:real^3`;`x':real^3`] +THEN MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(x':real^3)`;`(v:real^3)`] +THEN ASM_TAC THEN SET_TAC[IN]);; + + + + +end;; diff --git a/legacy/oldfan/hypermap_of_fan.hl b/legacy/oldfan/hypermap_of_fan.hl new file mode 100755 index 0000000..3d16ba2 --- /dev/null +++ b/legacy/oldfan/hypermap_of_fan.hl @@ -0,0 +1,1010 @@ +module Hypermap_of_fan = struct + +open Sphere;; +open Fan_defs;; +open Tactic_fan;; +open Lemma_fan;; +open Hypermap;; +open Fan;; + +(* ========================================================================== *) +(* DEFINITION OF HYPERMAP OF FAN *) +(* ========================================================================== *) + + + +let d1_fan =new_definition` +d1_fan (x,V,E) ={(x':real^3,v:real^3,w:real^3,w1:real^3)| (x'=x) /\ ({v,w} IN E)/\ (w1 = sigma_fan x V E v w)}`;; + + +let d20_fan=new_definition`d20_fan (x,V,E)={ (x',v,v,v)| (x'=x) /\ (V v) /\ ((set_of_edge v V E) ={})}`;; + +let d_fan=new_definition`d_fan (x,V,E)= d1_fan (x,V,E) UNION d20_fan (x,V,E)`;; + + +let inverse_sigma_fan_alt=new_definition`inverse_sigma_fan_alt x V E v w = @a. sigma_fan x V E v a=w`;; + +let e_fan=new_definition` e_fan (x:real^3) V E = (\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). (x,w,v,(sigma_fan x V E w v)))`;; + + +let f_fan=new_definition`f_fan (x:real^3) V E = (\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). (x,w,(inverse_sigma_fan_alt x V E w v),v) )`;; + +(* This is the same as f_fan, + but easier to use *) + +let f1_fan=new_definition`f1_fan (x:real^3) V E = (\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). (x,w,(inverse1_sigma_fan x V E w v),v) )`;; + + + +let n_fan=new_definition`n_fan (x:real^3) V E =(\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). (x,v,(sigma_fan x V E v w),(sigma_fan x V E v (sigma_fan x V E v w))))`;; + +(* i_fan corrects the 4th coordinate to be + the dart *) + +let i_fan=new_definition`i_fan (x:real^3) V E=(\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). (x,v,w,(sigma_fan x V E v w)))`;; + +let pr1=new_definition`pr1=(\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). x)`;; + +let pr2=new_definition`pr2=(\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). v)`;; + +let pr3=new_definition`pr3=(\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). w)`;; + +let pr4=new_definition`pr4=(\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). w1)`;; + +(* if f = sigma, the power_map_points gives + iterates of sigma (for fixed x v) *) + + +let power_map_points= new_recursive_definition num_RECURSION `(power_map_points f x V E v w 0 = w)/\(power_map_points f x V E v w (SUC n)= f x V E v (power_map_points f x V E v w n))`;; + +(* This is the composition operator (o), + specialized to functions on 4-tuples *) + + +let o_funs=new_definition`!(f:real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3) (g:real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3). o_funs f g =(\(x:real^3,y:real^3,z:real^3,t:real^3). f (pr1 (g(x,y,z,t)),pr2(g(x,y,z,t)),pr3(g(x,y,z,t)),pr4(g(x,y,z,t))))`;; + +(* powers of permutations *) + +let power_maps= new_recursive_definition num_RECURSION `(power_maps (f:real^3->(real^3->bool)->((real^3->bool)->bool)->real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) 0 = i_fan (x:real^3) V E) /\ (power_maps f x V E (SUC n)= o_funs (f x V E) (power_maps f x V E n))`;; + + +(* powers of node map *) + + + + +let power_n_fan= new_definition`power_n_fan x V E n=( \(x,v,w,w1). (x,v,(power_map_points sigma_fan x V E v w n),(power_map_points sigma_fan x V E v w (SUC n))))`;; + + +(* the node of a dart, in a special form + for fans *) + + +let a_node_fan=new_definition`a_node_fan x V E (x,v,w,w1)={a | ?n. a=(power_maps n_fan x V E n) (x,v,w,sigma_fan x V E v w)}`;; + + +(* The set X(V,E) *) + +let xfan= new_definition`xfan (x,V,E)={v | ?e. (E e)/\(v IN aff_ge {x} e)}`;; + +(* See comment by AS in fan_defs.hl. The correct definition is there. *) +let yfan_deprecated= new_definition`yfan_deprecated (x,V,E)={v:real^3 | ?e. ( E e )/\(~(v IN aff_ge {x} e))}`;; + + + + + + + +let hypermap_of_fanx = new_definition + `hypermap_of_fanx (x:real^3,V:real^3->bool,E:(real^3->bool)->bool) = + (let p = ( \ t. res (t x V E ) (d1_fan (x,V,E)) ) in + hypermap( d_fan (x,V,E) , p e_fan, p n_fan, p f_fan))`;; + + +let hypermap1_of_fanx = new_definition + `hypermap1_of_fanx (x:real^3,V:real^3->bool,E:(real^3->bool)->bool) = + (let p = ( \ t. res (t x V E ) (d1_fan (x,V,E)) ) in + hypermap( d_fan (x,V,E) , p e_fan, p n_fan, p f1_fan))`;; + + + + + +(* +W^0_{dart}(x,v,w...) +*) + +let w_dart_fan=new_definition`w_dart_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) ((y:real^3),(v:real^3),(w:real^3),(w1:real^3))= +if (CARD (set_of_edge v V E) > 1) then wedge x v w (sigma_fan x V E v w) +else +(if set_of_edge v V E ={w} then (UNIV:real^3->bool) DIFF aff_ge {x,v} {w} +else (if set_of_edge v V E ={} then (UNIV:real^3->bool) DIFF aff {x,v} else {}))`;; + + + + +(* ========================================================================== *) +(* ORBITS NODE FAN *) +(* ========================================================================== *) + + + + + + +let image_power_map_points=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ (u IN set_of_edge v V E) +==> power_map_points (sigma_fan) x V E v u i IN set_of_edge v V E`, +INDUCT_TAC THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[power_map_points] +THENL[ +ASM_MESON_TAC[]; +REPEAT (POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC "a") THEN REPEAT DISCH_TAC +THEN REMOVE_THEN "a" (fun th -> MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3)`] th)) THEN +ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN DISJ_CASES_TAC(SET_RULE `set_of_edge v V E ={power_map_points (sigma_fan) x V E v u i}\/ ~(set_of_edge v V E ={power_map_points (sigma_fan) x V E v u i})`) +THENL[ASM_MESON_TAC[sigma_fan]; +ASM_MESON_TAC[SIGMA_FAN]]]);; + + +let IN2_ORBITS_FAN=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ ({v,u} IN E) +==> {v,power_map_points (sigma_fan) x V E v u i} IN E`, +MESON_TAC[image_power_map_points;properties_of_set_of_edge_fan]);; + +let IN1_ORBITS_FAN=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ (u IN set_of_edge v V E) +==> {v,power_map_points (sigma_fan) x V E v u i} IN E`, +MESON_TAC[image_power_map_points;properties_of_set_of_edge_fan]);; + + +let remark_power_map_points=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ ({v,u} IN E) +==> +power_map_points (sigma_fan) x V E v u i IN set_of_edge v V E +/\ {v,power_map_points sigma_fan x V E v u i} IN E +/\ + ~(collinear {x,v,power_map_points sigma_fan x V E v u i}) +/\ ~(x = power_map_points (sigma_fan) x V E v u i) /\ + ~(v = power_map_points (sigma_fan) x V E v u i) /\ + DISJOINT {x, v} {power_map_points (sigma_fan) x V E v u i} /\ + ~((power_map_points (sigma_fan) x V E v u i) IN aff {x, v}) /\ + DISJOINT {x} {v, (power_map_points (sigma_fan) x V E v u i)} `, +MESON_TAC[IN2_ORBITS_FAN;remark1_fan;image_power_map_points;properties_of_set_of_edge_fan]);; + + + + + + + +(* ========================================================================== *) +(* PERMUTES OF E_FAN N_FAN F1_FAN (^_^) *) +(* ========================================================================== *) + + + +(* Proof Lemma 6.1 [AAUHTVE] *) + +let node_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) n:num. power_maps n_fan x V E n=power_n_fan x V E n`, +GEN_TAC THEN GEN_TAC THEN GEN_TAC THEN REWRITE_TAC[power_maps; n_fan; power_n_fan; power_map_points] THEN INDUCT_TAC THEN REWRITE_TAC[power_maps; power_map_points;i_fan;] THEN REWRITE_TAC[power_map_points; power_maps] THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[n_fan;o_funs; pr1; pr2; pr3; pr4]);; + + + + + +let EQ_PAIR_4=prove(`!a:real^3 b:real^3 c:real^3 d:real^3 a1:real^3 b1:real^3 c1:real^3 d:real^3. +(a,b,c,d)=(a1,b1,c1,d1) <=> a=a1 /\ b=b1 /\ c=c1 /\ d=d1`, +REPEAT GEN_TAC THEN EQ_TAC +THENL[ +DISCH_TAC THEN MP_TAC(SET_RULE`(a,b,c,d)=(a1,b1,c1,d1)==>pr1(a,b,c,d)=pr1(a1,b1,c1,d1)`) THEN REWRITE_TAC[pr1] + THEN MP_TAC(SET_RULE`(a,b,c,d)=(a1,b1,c1,d1)==>pr2(a,b,c,d)=pr2(a1,b1,c1,d1)`) THEN REWRITE_TAC[pr2] THEN +MP_TAC(SET_RULE`(a,b,c,d)=(a1,b1,c1,d1)==>pr3(a,b,c,d)=pr3(a1,b1,c1,d1)`) THEN REWRITE_TAC[pr3] THEN +MP_TAC(SET_RULE`(a,b,c,d)=(a1,b1,c1,d1)==>pr4(a,b,c,d)=pr4(a1,b1,c1,d1)`) THEN REWRITE_TAC[pr4] THEN ASM_REWRITE_TAC[] + THEN SET_TAC[]; +SET_TAC[]]);; + + + +let MONO_N_FAN=prove(` !x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +==> (!a b. a IN d1_fan(x,V,E) /\ b IN d1_fan (x,V,E)/\ n_fan x V E a =n_fan x V E b ==> a=b)`, + +REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[n_fan;EQ_PAIR_4] + THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN POP_ASSUM (fun th -> REWRITE_TAC[]) + THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`x:real^3`; `(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`;`w:real^3`;`v:real^3` ]remark1_fan) + THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`x:real^3`; `(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`;`w':real^3`;`v:real^3` ]remark1_fan) + THEN ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[MONO_SIGMA_FAN;]);; + + +let SUR_N_FAN=prove(` !x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +==> (!a. a IN d1_fan(x,V,E) ==>(?b. b IN d1_fan(x,V,E) /\ n_fan x V E b = a))`, + +REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN REPEAT STRIP_TAC + THEN MP_TAC(ISPECL[`x:real^3`;` (V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] SUR_SIGMA_FAN) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN EXISTS_TAC`(x:real^3,v:real^3,w':real^3,w:real^3)` + THEN ASM_REWRITE_TAC[n_fan] THEN EXISTS_TAC`x:real^3` THEN EXISTS_TAC`v:real^3` + THEN EXISTS_TAC`w':real^3` THEN EXISTS_TAC`w:real^3` THEN ASM_REWRITE_TAC[]);; + + + +let simp_inverse_sigma_fan_alt=prove(`!x V E v w. +inverse_sigma_fan_alt x V E v w= inverse (sigma_fan x V E v) w`, +REWRITE_TAC[inverse] THEN MESON_TAC[inverse_sigma_fan_alt]);; + + + +let SUR_F1_FAN=prove(` !x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +==> (!a. a IN d1_fan(x,V,E) ==>(?b. b IN d1_fan(x,V,E) /\ f1_fan x V E b = a))`, +REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN REPEAT STRIP_TAC + THEN EXISTS_TAC`(x:real^3,sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) v w, v:real^3,sigma_fan x V E (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) v w) v)` + THEN ASM_REWRITE_TAC[f_fan;EQ_PAIR_4;] + THEN STRIP_TAC +THENL[ +EXISTS_TAC`x:real^3` THEN EXISTS_TAC`sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) v w` + THEN EXISTS_TAC`v:real^3` THEN EXISTS_TAC`sigma_fan x V E (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) v w) v` +THEN ASM_REWRITE_TAC[] THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) ={w:real^3}) \/ ~(set_of_edge v V E ={w})`) +THENL[ +REWRITE_TAC[sigma_fan;SET_RULE`{a,b}={b,a}`] THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[]) THEN POP_ASSUM (fun th-> REWRITE_TAC[]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); + +MP_TAC(ISPECL[`x:real^3`;` (V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`]remark1_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`x:real^3`;` (V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`]SIGMA_FAN) + THEN ASM_REWRITE_TAC[remark1_fan] THEN STRIP_TAC + THEN MP_TAC(ISPECL[`x:real^3`;` (V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`sigma_fan x V E v w:real^3`;`v:real^3`]remark1_fan) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN POP_ASSUM (fun th-> REWRITE_TAC[]) THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={b,a}`]]; + +REWRITE_TAC[f1_fan] THEN MP_TAC(ISPECL[`x:real^3`;` (V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`]INVERSE1_SIGMA_FAN) + THEN ASM_REWRITE_TAC[EQ_PAIR_4] THEN STRIP_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`w:real^3`th)) + THEN ASM_REWRITE_TAC[]]);; + + + + + +let MONO_F1_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +==> (!a b. a IN d1_fan(x,V,E) /\ b IN d1_fan (x,V,E)/\ f1_fan x V E a =f1_fan x V E b ==> a=b)`, +REWRITE_TAC[d1_fan;IN_ELIM_THM]THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[f1_fan;EQ_PAIR_4] + THEN STRIP_TAC THEN ASM_REWRITE_TAC[]);; + + +let MONO_E_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +==> (!a b. a IN d1_fan(x,V,E) /\ b IN d1_fan (x,V,E)/\ e_fan x V E a =e_fan x V E b ==> a=b)`, +REWRITE_TAC[d1_fan;IN_ELIM_THM]THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[e_fan;EQ_PAIR_4] + THEN STRIP_TAC THEN ASM_REWRITE_TAC[]);; + + +let SUR_E_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +==> (!a. a IN d1_fan(x,V,E) ==>(?b. b IN d1_fan(x,V,E) /\ e_fan x V E b = a))`, + +REWRITE_TAC[d1_fan; IN_ELIM_THM] THEN REPEAT STRIP_TAC + THEN EXISTS_TAC`(x:real^3,w:real^3,v:real^3, sigma_fan x (V:real^3->bool) (E:(real^3->bool)->bool) w v)` +THEN ASM_REWRITE_TAC[e_fan] THEN EXISTS_TAC`x:real^3` THEN EXISTS_TAC`w:real^3` + THEN EXISTS_TAC`v:real^3` THEN EXISTS_TAC`sigma_fan x (V:real^3->bool) (E:(real^3->bool)->bool) w v` +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={b,a}`]);; + + + + + + +let permuters_of_enf_fan=prove(` !x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +==> (!a b. a IN d1_fan(x,V,E) /\ b IN d1_fan (x,V,E)/\ n_fan x V E a =n_fan x V E b ==> a=b) +/\ (!a. a IN d1_fan(x,V,E) ==>(?b. b IN d1_fan(x,V,E) /\ n_fan x V E b = a)) +/\ (!a b. a IN d1_fan(x,V,E) /\ b IN d1_fan (x,V,E)/\ f1_fan x V E a =f1_fan x V E b ==> a=b) +/\ (!a. a IN d1_fan(x,V,E) ==>(?b. b IN d1_fan(x,V,E) /\ f1_fan x V E b = a)) +/\ (!a b. a IN d1_fan(x,V,E) /\ b IN d1_fan (x,V,E)/\ e_fan x V E a =e_fan x V E b ==> a=b) +/\ (!a. a IN d1_fan(x,V,E) ==>(?b. b IN d1_fan(x,V,E) /\ e_fan x V E b = a)) +`,MESON_TAC[MONO_N_FAN;SUR_N_FAN;MONO_F1_FAN;SUR_F1_FAN;MONO_E_FAN;SUR_E_FAN]);; + + + + + + + +(* ========================================================================== *) +(* PROPERTIES OF E_FAN N_FAN F1_FAN (^_^) *) +(* ========================================================================== *) + + +let condition_hypermap_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E)==> (!a. a IN d1_fan(x,V,E)==> e_fan x V E((n_fan x V E) (f1_fan x V E a))=a)`, +REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[f1_fan;n_fan; e_fan; EQ_PAIR_4] + THEN MP_TAC(ISPECL[`x:real^3`;` (V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`w:real^3`]INVERSE1_SIGMA_FAN) + THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[]) + THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`v:real^3`th)) + THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={b,a}`] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[]);; + + + +let plain_hypermap_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E)==> (!a. a IN d1_fan(x,V,E)==> +(e_fan x V E) (e_fan x V E a) =a)`, +REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[e_fan; EQ_PAIR_4]);; + + +let e_fan_no_fix_point=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E)==> (!a. a IN d1_fan(x,V,E) ==> ~(e_fan x V E a=a ))`, +REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[e_fan; EQ_PAIR_4] + THEN STRIP_TAC THEN MP_TAC(ISPECL[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`]remark1_fan) + THEN ASM_MESON_TAC[]);; + +let f_fan_no_fix_point=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E)==> (!a. a IN d1_fan(x,V,E) ==> ~(f1_fan x V E a=a ))`, +REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[f1_fan; EQ_PAIR_4] +THEN STRIP_TAC THEN MP_TAC(ISPECL[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`]remark1_fan) + THEN ASM_MESON_TAC[]);; + + + +(* from hypermap.hl *) + +(******************************) +parse_as_infix("POWER",(24,"right"));; + +let POWER = new_recursive_definition num_RECURSION + `(!(f:A->A). f POWER 0 = I) /\ + (!(f:A->A) (n:num). f POWER (SUC n) = (f POWER n) o f)`;; + +let POWER_0 = prove(`!f:A->A. f POWER 0 = I`, + REWRITE_TAC[POWER]);; + +let POWER_1 = prove(`!f:A->A. f POWER 1 = f`, + REWRITE_TAC[POWER; ONE; I_O_ID]);; + +let POWER_2 = prove(`!f:A->A. f POWER 2 = f o f`, + REWRITE_TAC[POWER; TWO; POWER_1]);; + +let orbit_map = new_definition `orbit_map (f:A->A) (x:A) = {(f POWER n) x | n >= 0}`;; +(**************************************************) + +let POWER_RIGHT=prove(`!k:num f:A->A. f POWER SUC(k) = f o (f POWER k)`, +INDUCT_TAC +THENL[REWRITE_TAC[POWER;o_DEF; I_DEF]; +REWRITE_TAC[POWER;o_ASSOC] THEN GEN_TAC THEN POP_ASSUM(fun th -> MP_TAC(SPEC`f:A->A`th)) THEN DISCH_TAC + THEN +POP_ASSUM(fun th-> REWRITE_TAC[SYM(th);POWER])]) ;; + + + +let power_n_fan=prove(`!l:num x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 w:real^3. +FAN(x,V,E)/\ ({v,w} IN E)==> +(n_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) POWER l) (x,v,w,sigma_fan x V E v w)= (x,v, power_map_points sigma_fan x V E v w l, power_map_points sigma_fan x V E v w (SUC l) )`, +INDUCT_TAC +THENL[REWRITE_TAC[POWER; power_map_points;I_DEF]; +POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") THEN REPEAT STRIP_TAC THEN + REMOVE_THEN "a" (fun th -> MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;`(w:real^3)`]th)) +THEN ASM_REWRITE_TAC[POWER_RIGHT; o_DEF;] +THEN DISCH_TAC THEN ASM_REWRITE_TAC[n_fan;power_map_points] ]);; + + + +let distinct_nodes=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) . +FAN(x,V,E)==> (!k:num l:num a. a IN d1_fan(x,V,E) ==> +(((n_fan x V E) POWER k) o (e_fan x V E)) a= ((e_fan x V E)o((n_fan x V E) POWER l)) a==> (n_fan x V E POWER l) a=a)`, +REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN +ASM_REWRITE_TAC[o_DEF;e_fan] THEN +MP_TAC(ISPECL[`l:num`;` x:real^3 `;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` w:real^3`]power_n_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`k:num`;` x:real^3 `;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` w:real^3`;` v:real^3`]power_n_fan) + THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={b,a}`] THEN DISCH_TAC THEN ASM_REWRITE_TAC[EQ_PAIR_4] THEN STRIP_TAC + THEN POP_ASSUM(fun th-> REWRITE_TAC[]) THEN POP_ASSUM(fun th-> REWRITE_TAC[]) + THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]THEN ASSUME_TAC(th)) + THEN ASM_REWRITE_TAC[power_map_points] THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]));; + + + + +let edge_lie_different_nodes=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E)==> (!n:num a. a IN d1_fan(x,V,E) ==> ~(e_fan x V E a =(n_fan x V E POWER n) a)) `, + +REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN +ASM_REWRITE_TAC[e_fan] THEN +MP_TAC(ISPECL[`n:num`;` x:real^3 `;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` w:real^3`]power_n_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[EQ_PAIR_4] + THEN STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`]remark1_fan) + THEN ASM_MESON_TAC[]);; + + + + +(* ========================================================================== *) +(* REPRESENTATION OF HYPERMAP OF FAN (^_^) *) +(* ========================================================================== *) + + + + +let finite_d1_fan=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) ==> FINITE (d1_fan (x,V,E))`, +REPEAT GEN_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "EM" MP_TAC +THEN REWRITE_TAC[FAN;fan1] +THEN STRIP_TAC +THEN MRESA_TAC set_edges_is_finite_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC FINITE_PRODUCT[`V:real^3->bool`;`V:real^3->bool`] +THEN MRESA_TAC FINITE_IMAGE[`(\(a,b:real^3). (x,a,b,sigma_fan x V E a b))`;`{x,y | x IN (V:real^3->bool) /\ y IN V}`] +THEN MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`(IMAGE (\(a,b). x,a,b,sigma_fan x V E a b) {x,y | x IN V /\ y IN (V:real^3->bool)})` +THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM;d1_fan;SUBSET] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`(v:real^3,w:real^3)` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC THEN ASM_REWRITE_TAC[]);; + + + +let finite_d20_fan=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) ==> FINITE (d20_fan (x,V,E))`, + +REPEAT GEN_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "EM" MP_TAC +THEN REWRITE_TAC[FAN;fan1] +THEN STRIP_TAC +THEN MRESA_TAC FINITE_IMAGE[`(\b:real^3. (x:real^3,b,b,b))`;`V:real^3->bool`] +THEN MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`(IMAGE (\b:real^3. (x:real^3,b,b,b)) (V:real^3->bool))` +THEN ASM_REWRITE_TAC[d20_fan;SUBSET;IMAGE;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[IN]);; + + + +let finite_d_fan=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) +==> FINITE (d_fan (x,V,E))`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[d_fan;FINITE_UNION] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[finite_d1_fan;finite_d20_fan]);; + +let subset_d_fan=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +d1_fan (x,V,E) SUBSET d_fan (x,V,E) /\ d20_fan (x,V,E) SUBSET d_fan(x,V,E)`, +REWRITE_TAC[d_fan] THEN SET_TAC[]);; + + +let FACE_FAN_NOT_EMPTY=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds s. +FAN(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> ~(ds={})`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC lemma_face_representation[`hypermap1_of_fanx(x:real^3,V,E)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC FACE_FINITE[`hypermap1_of_fanx(x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`] +THEN STRIP_TAC +THEN MRESA1_TAC CARD_EQ_0`face (hypermap1_of_fanx (x:real^3,V,E)) x'` +THEN MRESA_TAC FACE_NOT_EMPTY[`hypermap1_of_fanx(x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC);; + + + + + + + +let into_domain_e_fan=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) +==> (!y. y IN d_fan (x,V,E)==> ((p e_fan ) y) IN (d_fan (x,V,E)))`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[res;] +THEN DISJ_CASES_TAC(SET_RULE`~(y IN d1_fan (x,V,E) )\/ (y IN d1_fan (x:real^3,V,E))`) +THENL[ +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[e_fan;d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC subset_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MATCH_MP_TAC(SET_RULE`x,w,v,sigma_fan x V E w v IN d1_fan (x,V,E) /\ d1_fan (x,V,E) SUBSET d_fan (x,V,E) +==>x,w,v,sigma_fan x V E w v IN d_fan (x:real^3,V,E)`) +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E w (v:real^3)` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]]);; + + + + +let into_domain1_e_fan=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) ==> (!y. y IN d1_fan (x,V,E)==> (e_fan x V E y IN d1_fan (x,V,E)))`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[e_fan;d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E w (v:real^3)` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]);; + + + + + +let e_fan_permutes=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) +==> (p e_fan) permutes (d_fan (x,V,E))`, +REPEAT STRIP_TAC +THEN MRESA_TAC finite_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC PERMUTES_FINITE_SURJECTIVE[`d_fan (x:real^3,V,E)`;`res (e_fan x V E) (d1_fan (x:real^3,V,E))`] +THEN STRIP_TAC +THENL[ +REWRITE_TAC[res;d_fan;UNION;IN_ELIM_THM;DE_MORGAN_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[]; + +MRESA_TAC into_domain_e_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(y IN d1_fan (x,V,E) )\/ (y IN d1_fan (x:real^3,V,E))`) +THENL[EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[res]; +MRESA_TAC permuters_of_enf_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN REWRITE_TAC[res] +THEN EXISTS_TAC`b:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC subset_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN ASM_TAC THEN SET_TAC[]]]);; + +let into_domain_f1_fan= prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) +==> (!y. y IN d_fan (x,V,E)==> ((p f1_fan ) y) IN (d_fan (x,V,E)))`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[res;] +THEN DISJ_CASES_TAC(SET_RULE`~(y IN d1_fan (x,V,E) )\/ (y IN d1_fan (x:real^3,V,E))`) +THENL[ +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[f1_fan;d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC subset_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MATCH_MP_TAC(SET_RULE`x,w,inverse1_sigma_fan x V E w v,v IN d1_fan (x,V,E) /\ d1_fan (x,V,E) SUBSET d_fan (x,V,E) +==>x,w,inverse1_sigma_fan x V E w v,v IN d_fan (x:real^3,V,E)`) +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`inverse1_sigma_fan x V E w v:real^3` +THEN EXISTS_TAC`(v:real^3)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]]);; + + + + +let into_domain1_f1_fan= prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E)==> (!y. y IN d1_fan (x,V,E)==> (f1_fan x V E y IN d1_fan (x,V,E)))`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[f1_fan;d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`inverse1_sigma_fan x V E w v:real^3` +THEN EXISTS_TAC`(v:real^3)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]);; + + + + + +let f1_fan_permutes=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) +==> (p f1_fan) permutes (d_fan (x,V,E))`, + +REPEAT STRIP_TAC +THEN MRESA_TAC finite_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC PERMUTES_FINITE_SURJECTIVE[`d_fan (x:real^3,V,E)`;`res (f1_fan x V E) (d1_fan (x:real^3,V,E))`] +THEN STRIP_TAC +THENL[ +REWRITE_TAC[res;d_fan;UNION;IN_ELIM_THM;DE_MORGAN_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[]; +MRESA_TAC into_domain_f1_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(y IN d1_fan (x,V,E) )\/ (y IN d1_fan (x:real^3,V,E))`) +THENL[ +EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[res]; +MRESA_TAC permuters_of_enf_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN REWRITE_TAC[res] +THEN EXISTS_TAC`b:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC subset_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN ASM_TAC THEN SET_TAC[]]]);; + + + + + +let into_domain_n_fan= prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) +==> (!y. y IN d_fan (x,V,E)==> ((p n_fan ) y) IN (d_fan (x,V,E)))`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[res;] +THEN DISJ_CASES_TAC(SET_RULE`~(y IN d1_fan (x,V,E) )\/ (y IN d1_fan (x:real^3,V,E))`) +THENL[ +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[n_fan;d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC subset_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MATCH_MP_TAC(SET_RULE`x,v,sigma_fan x V E v w,sigma_fan x V E v (sigma_fan x V E v w) IN d1_fan (x,V,E) /\ d1_fan (x,V,E) SUBSET d_fan (x,V,E) +==>x,v,sigma_fan x V E v w,sigma_fan x V E v (sigma_fan x V E v w) IN d_fan (x:real^3,V,E)`) +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E v w:real^3` +THEN EXISTS_TAC`sigma_fan x V E v (sigma_fan x V E v (w:real^3))` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`(sigma_fan x V E v (w:real^3)):real^3`]]);; + + + +let into_domain1_n_fan= prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) ==> (!y. y IN d1_fan (x,V,E)==> (n_fan x V E y IN d1_fan (x,V,E)))`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[n_fan;d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E v w:real^3` +THEN EXISTS_TAC`sigma_fan x V E v (sigma_fan x V E v (w:real^3))` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`(sigma_fan x V E v (w:real^3)):real^3`]);; + + + +let n_fan_permutes=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) +==> (p n_fan) permutes (d_fan (x,V,E))`, + +REPEAT STRIP_TAC +THEN MRESA_TAC finite_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC PERMUTES_FINITE_SURJECTIVE[`d_fan (x:real^3,V,E)`;`res (n_fan x V E) (d1_fan (x:real^3,V,E))`] +THEN STRIP_TAC +THENL[ +REWRITE_TAC[res;d_fan;UNION;IN_ELIM_THM;DE_MORGAN_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[]; +MRESA_TAC into_domain_n_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(y IN d1_fan (x,V,E) )\/ (y IN d1_fan (x:real^3,V,E))`) +THENL[ +EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[res]; +MRESA_TAC permuters_of_enf_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN REWRITE_TAC[res] +THEN EXISTS_TAC`b:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC subset_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN ASM_TAC THEN SET_TAC[]]]);; + + +let id_enf_fan=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool) y:real^3#real^3#real^3#real^3. +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) /\ ~(y IN d1_fan (x,V,E)) +==> (p e_fan) y=y /\ (p n_fan) y=y/\ (p f1_fan) y=y`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[res;d_fan;UNION;IN_ELIM_THM;DE_MORGAN_THM]);; + +let id_power_enf_fan=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool) y:real^3#real^3#real^3#real^3 n:num p. +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) /\ ~(y IN d1_fan (x,V,E)) +==> ((p e_fan) POWER n) y=y /\ ((p n_fan) POWER n)y=y/\ ((p f1_fan) POWER n) y=y`, +(let lem=prove(`!f:A->A x:A. f x = x ==> !m. (f POWER m) x = x`, +MRESA_TAC power_map_fix_point[`1:num`] +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[POWER_1;ARITH_RULE`m*1=m:num`]) in +REPEAT STRIP_TAC +THEN MRESA_TAC id_enf_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC lem[`(p e_fan):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC lem[`(p n_fan):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC lem[`(p f1_fan):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`]));; + + + + +let into_domain_efn_fan=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) +==> (!y. y IN d1_fan (x,V,E)==> (p e_fan ) y = e_fan x V E y) +/\ (!y. y IN d1_fan (x,V,E)==> (p n_fan ) y = n_fan x V E y) +/\(!y. y IN d1_fan (x,V,E)==> (p f1_fan ) y = f1_fan x V E y) +`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[res;]);; + + + + +let power_map_fix_set = prove(`!n f:A->A g:A->A s:A->bool. (!x:A. x IN s ==> f x= g x) /\ (!x:A. x IN s ==> g x IN s) ==> (!x. x IN s==>(f POWER n) x = (g POWER n) x)`, + INDUCT_TAC THENL[REWRITE_TAC[MULT; POWER; I_THM]; + REWRITE_TAC[POWER; o_DEF] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") +THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN +POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"EM") THEN DISCH_THEN(LABEL_TAC"NHO") THEN DISCH_TAC +THEN REMOVE_THEN "YEU" (fun th -> MRESA_TAC th[`f:A->A`;`g:A->A`;`s:A->bool`]) +THEN POP_ASSUM (fun th-> MRESA1_TAC th `g (x:A):A`) +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "EM" (fun th -> MRESA1_TAC th `x:A`) +THEN REMOVE_THEN "NHO" (fun th -> MRESA1_TAC th `x:A`)]);; + + + + + + +let into_domain_power_efn_fan=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool) n:num p. +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) +==> (!y. y IN d1_fan (x,V,E)==> ((p e_fan ) POWER n)y = ((e_fan x V E) POWER n) y) +/\ (!y. y IN d1_fan (x,V,E)==> ((p n_fan ) POWER n) y = ((n_fan x V E) POWER n) y) +/\(!y. y IN d1_fan (x,V,E)==> ((p f1_fan ) POWER n) y = ((f1_fan x V E) POWER n) y)`, +REPEAT GEN_TAC THEN REPEAT DISCH_TAC +THEN MRESA_TAC into_domain_efn_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC into_domain1_n_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC into_domain1_f1_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC into_domain1_e_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC power_map_fix_set[`n:num`; +`(p e_fan):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`; +`(e_fan x V E):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`;`d1_fan (x:real^3,V,E)`;] +THEN MRESA_TAC power_map_fix_set[`n:num`; +`(p n_fan):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`; +`(n_fan x V E):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`;`d1_fan (x:real^3,V,E)`;] +THEN MRESA_TAC power_map_fix_set[`n:num`; +`(p f1_fan):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`; +`(f1_fan x V E):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`;`d1_fan (x:real^3,V,E)`;]);; + + + + +let power_fun_in_domain=prove(`!n f:A->A s:A->bool.(!y. y IN s==> f y IN s)==> (!y. y IN s==> (f POWER n) y IN s)`, + INDUCT_TAC THENL[REWRITE_TAC[POWER_0; I_THM]; +POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"YEU") +THEN REPEAT STRIP_TAC THEN REMOVE_THEN "YEU" (fun th-> MRESA_TAC th[`f:A->A`;`s:A->bool`]) +THEN REWRITE_TAC[COM_POWER;o_DEF] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:A`)]);; + + + +let into_domain1_power_efn_fan= prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool) n:num. +FAN(x,V,E) ==> (!y. y IN d1_fan (x,V,E)==> (((e_fan x V E) POWER n) y IN d1_fan (x,V,E))) +/\ (!y. y IN d1_fan (x,V,E)==> (((n_fan x V E) POWER n) y IN d1_fan (x,V,E))) +/\(!y. y IN d1_fan (x,V,E)==> (((f1_fan x V E) POWER n) y IN d1_fan (x,V,E)))`, +REPEAT GEN_TAC THEN DISCH_TAC +THEN MRESA_TAC into_domain1_e_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;] +THEN MRESA_TAC into_domain1_f1_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;] +THEN MRESA_TAC into_domain1_n_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;] +THEN MRESA_TAC power_fun_in_domain[`n:num`;`e_fan x V (E:(real^3->bool)->bool)`;`d1_fan (x:real^3,V,E)`;] +THEN MRESA_TAC power_fun_in_domain[`n:num`;`f1_fan x V (E:(real^3->bool)->bool)`;`d1_fan (x:real^3,V,E)`;] +THEN MRESA_TAC power_fun_in_domain[`n:num`;`n_fan x V (E:(real^3->bool)->bool)`;`d1_fan (x:real^3,V,E)`;]);; + + + + + + +let lemma_hypermap1_of_fanx=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E)) ) ==> +(p e_fan) o (p n_fan) o (p f1_fan)= I`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC EQ_EXT +THEN ASM_REWRITE_TAC[I_THM;o_DEF] +THEN GEN_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(x' IN d1_fan (x,V,E) )\/ (x' IN d1_fan (x:real^3,V,E))`) +THENL[ +MRESA_TAC id_enf_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`x':real^3#real^3#real^3#real^3`]; +MRESA_TAC into_domain_efn_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `x':real^3#real^3#real^3#real^3` ) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `f1_fan x V E x':real^3#real^3#real^3#real^3` ) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"YEU") +THEN MRESA_TAC into_domain1_f1_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `x':real^3#real^3#real^3#real^3` ) +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th `(n_fan x V E (f1_fan x V E x')):real^3#real^3#real^3#real^3` ) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain1_n_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `f1_fan x V E x':real^3#real^3#real^3#real^3` ) +THEN RESA_TAC +THEN MRESA_TAC condition_hypermap_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `x':real^3#real^3#real^3#real^3` )]);; + + + + + + + + + +let hypermap_of_fan_rep=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool) p. +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E)) ) ==> +dart ( hypermap1_of_fanx (x,V,E)) =d_fan (x,V,E) /\ edge_map (hypermap1_of_fanx (x,V,E)) = p e_fan /\ node_map (hypermap1_of_fanx (x,V,E)) = p n_fan /\ face_map (hypermap1_of_fanx (x,V,E)) = p f1_fan `, +REPEAT GEN_TAC THEN DISCH_TAC +THEN REWRITE_TAC[hypermap1_of_fanx] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC finite_d_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC e_fan_permutes[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC n_fan_permutes[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC f1_fan_permutes[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC lemma_hypermap1_of_fanx[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC lemma_hypermap_rep[`d_fan (x:real^3,V,E):real^3#real^3#real^3#real^3->bool`; +`(p e_fan):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`; +`(p n_fan):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`; +`(p f1_fan):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`]);; + +let properties_of_f1_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) y y1. +FAN(x,V,E) /\ y = f1_fan x V E y1 /\ y1 IN d1_fan (x,V,E) +==> pr3 y1 =pr2 y /\ {pr2 y1, pr3 y1} IN E /\ {pr2 y, pr3 y} IN E /\ +pr2 y1= sigma_fan x V E (pr2 y) (pr3 y)`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan; IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr2;pr3;f1_fan] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]);; + + + +(* ========================================================================== *) +(* PROPERTIES OF HYPERMAP OF FAN (^_^) *) +(* ========================================================================== *) + + + +let face_subset_dart_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> ds SUBSET d_fan (x,V,E)`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA_TAC lemma_face_representation[`hypermap1_of_fanx(x:real^3,V,E)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC lemma_face_subset[`hypermap1_of_fanx(x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`]);; + + + + +let properties_of_elements_in_face_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y. +FAN(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ y IN ds +==> {pr2 y, pr3 y} IN E\/ pr2 y= pr3 y`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y IN ds /\ ds SUBSET d_fan (x,V,E)==> y IN d_fan (x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[d_fan;d1_fan;d20_fan;UNION;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr2;pr3]);; + +let fully_surrounded_is_non_isolated_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> d20_fan(x,V,E)={}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") +THEN REWRITE_TAC[SET_RULE`A={}<=> ~(?y. y IN A)`] +THEN REWRITE_TAC[d20_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th`v:real^3`[IN;CARD_CLAUSES]) +THEN POP_ASSUM MP_TAC THEN ARITH_TAC);; + + + + + +let AAUHTVE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E)/\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E)) ) ==> +FINITE (d_fan (x,V,E)) +/\ (p e_fan) permutes (d_fan (x,V,E)) +/\ (p n_fan) permutes (d_fan (x,V,E)) +/\ (p f1_fan) permutes (d_fan (x,V,E)) +/\(p e_fan) o (p n_fan) o (p f1_fan)= I +/\ (!a. a IN d1_fan(x,V,E)==> (e_fan x V E) (e_fan x V E a) =a) +/\ (!a. a IN d1_fan(x,V,E) ==> ~(e_fan x V E a=a )) +/\ (!a. a IN d1_fan(x,V,E) ==> ~(f1_fan x V E a=a )) +/\ (!k:num l:num a. a IN d1_fan(x,V,E) ==> +(((n_fan x V E) POWER k) o (e_fan x V E)) a= ((e_fan x V E)o((n_fan x V E) POWER l)) a==> (n_fan x V E POWER l) a=a) + +/\ (!n:num a. a IN d1_fan(x,V,E) ==> ~(e_fan x V E a =(n_fan x V E POWER n) a))`, + +MESON_TAC[lemma_hypermap1_of_fanx;e_fan_permutes;n_fan_permutes;finite_d_fan;f1_fan_permutes;plain_hypermap_fan;e_fan_no_fix_point;f_fan_no_fix_point;distinct_nodes;edge_lie_different_nodes]);; + +(********************************) + + + + +end;; diff --git a/legacy/oldfan/introduction1.hl b/legacy/oldfan/introduction1.hl new file mode 100755 index 0000000..c1ccdeb --- /dev/null +++ b/legacy/oldfan/introduction1.hl @@ -0,0 +1,1493 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + +(*flyspeck_needs "general/sphere.hl";;*) + + +module Fan = struct + + +(* +# use "/home/truong/Desktop/googlecode/hol_light/hol.ml";; +needs "/home/truong/Desktop/googlecode/hol_light/Multivariate/flyspeck.ml";; +needs "/home/truong/Desktop/googlecode/flyspeck/text_formalization/general/sphere.hl";; +*) + + +open Sphere;; +open Fan_defs;; +open Tactic_fan;; +open Lemma_fan;; +open Hypermap;; + + +(* ========================================================================== *) +(* FAN *) +(* ========================================================================== *) + + + +let graph = new_definition `graph E <=> (!e. E e ==> (e HAS_SIZE 2))`;; + +let fan1 = new_definition`fan1(x,V,E):bool <=> FINITE V /\ ~(V SUBSET {}) `;; + +let fan2 = new_definition`fan2(x,V,E):bool <=> ~(x IN V)`;; + +let fan3=new_definition`fan3(x,V,E):bool <=> (!v. (v IN V) ==> cyclic_set {w | {v,w} IN E } x v)`;; + +let fan4 = new_definition`fan4(x,V,E):bool<=> (!e. (e IN E) ==> (aff_gt {x} e INTER V={}))`;; + +let fan5 = new_definition`fan5(x,V,E):bool<=> (!e f. (e IN E)/\ (f IN E) /\ ~(e=f) ==> (aff_gt {x} e INTER aff_gt {x} f ={}))`;; + +let fan = new_definition`fan(x,V,E)<=> ((UNIONS E) SUBSET V) /\ graph(E)/\ fan1(x,V,E)/\ fan2(x,V,E)/\ fan3(x,V,E)/\ fan4 (x,V,E) /\ fan5(x,V,E)`;; + +let base_point_fan=new_definition`base_point_fan (x,V,E)=x`;; + +let set_of_edge=new_definition`set_of_edge v V E={w|{v,w} IN E /\ w IN V}`;; + + +let fan6= new_definition`fan6(x,V,E):bool<=>(!e. (e IN E) ==> ~(collinear ({x} UNION e)))`;; + +let fan7= new_definition`fan7(x,V,E):bool<=> (!e1 e2. (e1 IN E UNION {{v}| v IN V}) /\ (e2 IN E UNION {{v}| v IN V}) +==> ((aff_ge {x} e1) INTER (aff_ge {x} e2) = aff_ge {x} (e1 INTER e2)))`;; + + + +let FAN=new_definition`FAN(x,V,E) <=> ((UNIONS E) SUBSET V) /\ graph(E) /\ fan1(x,V,E) /\ fan2(x,V,E)/\ +fan6(x,V,E)/\ fan7(x,V,E)`;; + + + +(* ========================================================================== *) +(* Invariance theorems *) +(* ========================================================================== *) + + + +let GRAPH = prove + (`!E. graph E <=> !e. e IN E ==> e HAS_SIZE 2`, + REWRITE_TAC[graph; IN]);; + +let CYCLIC_SET = prove + (`cyclic_set W v w <=> + ~(v = w) /\ + FINITE W /\ + (!p q h. p IN W /\ q IN W /\ p - q = h % (v - w) ==> p = q) /\ + W INTER affine hull {v, w} = {}`, + REWRITE_TAC[cyclic_set; IN; VECTOR_ARITH `p - q:real^N = r <=> p = q + r`]);; + +let CYCLIC_SET_TRANSLATION_EQ = prove + (`!a:real^N s x y. + cyclic_set (IMAGE (\x. a + x) s) (a + x) (a + y) <=> cyclic_set s x y`, + REWRITE_TAC[CYCLIC_SET] THEN GEOM_TRANSLATE_TAC[]);; + +let CYCLIC_SET_LINEAR_IMAGE = prove + (`!f:real^M->real^N s x y. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (cyclic_set (IMAGE f s) (f x) (f y) <=> cyclic_set s x y)`, + GEN_REWRITE_TAC (funpow 4 BINDER_CONV o RAND_CONV o TOP_DEPTH_CONV) + [CYCLIC_SET; RIGHT_FORALL_IMP_THM; IMP_CONJ; FORALL_IN_IMAGE] THEN + GEOM_TRANSFORM_TAC[]);; + +add_translation_invariants [CYCLIC_SET_TRANSLATION_EQ];; + +add_linear_invariants [CYCLIC_SET_LINEAR_IMAGE];; + +let GRAPH_TRANSLATION_EQ = prove + (`!a:real^N E. graph (IMAGE (IMAGE (\x. a + x)) E) <=> graph E`, + REWRITE_TAC[GRAPH] THEN GEOM_TRANSLATE_TAC[]);; + +let GRAPH_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (graph(IMAGE (IMAGE f) E) <=> graph E)`, + REWRITE_TAC[GRAPH] THEN GEOM_TRANSFORM_TAC[]);; + +let FAN1_TRANSLATION_EQ = prove + (`!a:real^N x V E. + fan1(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + fan1(x,V,E)`, + REWRITE_TAC[fan1] THEN GEOM_TRANSLATE_TAC[]);; + +let FAN1_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (fan1(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> fan1(x,V,E))`, + REWRITE_TAC[fan1] THEN GEOM_TRANSFORM_TAC[]);; + +let FAN2_TRANSLATION_EQ = prove + (`!a:real^N x V E. + fan2(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + fan2(x,V,E)`, + REWRITE_TAC[fan2] THEN GEOM_TRANSLATE_TAC[]);; + +let FAN2_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (fan2(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> fan2(x,V,E))`, + REWRITE_TAC[fan2] THEN GEOM_TRANSFORM_TAC[]);; + +let FAN3_TRANSLATION_EQ = prove + (`!a:real^N x V E. + fan3(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + fan3(x,V,E)`, + REWRITE_TAC[fan3] THEN GEOM_TRANSLATE_TAC[]);; + +let FAN3_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (fan3(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> fan3(x,V,E))`, + let lemma = prove + (`{w | {a,w} IN IMAGE (IMAGE f) s} = + IMAGE f {w |w| {a,f w} IN IMAGE (IMAGE f) s}`, + MATCH_MP_TAC(SET_RULE + `(!y. P y ==> ?x. y = f x) ==> {w | P w} = IMAGE f {w | P(f w)}`) THEN + REWRITE_TAC[IN_IMAGE; EXTENSION; IN_IMAGE; IN_INSERT; NOT_IN_EMPTY] THEN + MESON_TAC[]) in + REWRITE_TAC[fan3; FORALL_IN_IMAGE; lemma] THEN GEOM_TRANSFORM_TAC[]);; + +let FAN4_TRANSLATION_EQ = prove + (`!a:real^N x V E. + fan4(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + fan4(x,V,E)`, + REWRITE_TAC[fan4] THEN GEOM_TRANSLATE_TAC[]);; + +let FAN4_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (fan4(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> fan4(x,V,E))`, + REWRITE_TAC[fan4] THEN GEOM_TRANSFORM_TAC[]);; + +let FAN5_TRANSLATION_EQ = prove + (`!a:real^N x V E. + fan5(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + fan5(x,V,E)`, + REWRITE_TAC[fan5] THEN GEOM_TRANSLATE_TAC[]);; + +let FAN5_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (fan5(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> fan5(x,V,E))`, + GEN_REWRITE_TAC (funpow 4 BINDER_CONV o RAND_CONV o TOP_DEPTH_CONV) + [fan5; IMP_CONJ; RIGHT_FORALL_IMP_THM; FORALL_IN_IMAGE] THEN + GEOM_TRANSFORM_TAC[]);; + +let FAN6_TRANSLATION_EQ = prove + (`!a:real^N x V E. + fan6(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + fan6(x,V,E)`, + REWRITE_TAC[fan6] THEN GEOM_TRANSLATE_TAC[]);; + +let FAN6_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (fan6(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> fan6(x,V,E))`, + REWRITE_TAC[fan6] THEN GEOM_TRANSFORM_TAC[]);; + +let FAN7_TRANSLATION_EQ = prove + (`!a:real^N x V E. + fan7(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + fan7(x,V,E)`, + REWRITE_TAC[fan7] THEN + REWRITE_TAC[SET_RULE + `e IN s UNION {f x | t x} <=> e IN s \/ ?x. t x /\ e = f x`] THEN + GEOM_TRANSLATE_TAC[]);; + +let FAN7_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (fan7(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> fan7(x,V,E))`, + REWRITE_TAC[fan7; IN_UNION] THEN + REWRITE_TAC[LEFT_OR_DISTRIB; RIGHT_OR_DISTRIB; + TAUT `a \/ b ==> c <=> (a ==> c) /\ (b ==> c)`] THEN + GEN_REWRITE_TAC (funpow 4 BINDER_CONV o RAND_CONV o TOP_DEPTH_CONV) + [FORALL_AND_THM; IMP_CONJ; RIGHT_FORALL_IMP_THM] THEN + REWRITE_TAC[FORALL_IN_GSPEC] THEN REWRITE_TAC[IMP_IMP] THEN + GEOM_TRANSFORM_TAC[]);; + +add_translation_invariants + [GRAPH_TRANSLATION_EQ; + FAN1_TRANSLATION_EQ; + FAN2_TRANSLATION_EQ; + FAN3_TRANSLATION_EQ; + FAN4_TRANSLATION_EQ; + FAN5_TRANSLATION_EQ; + FAN6_TRANSLATION_EQ; + FAN7_TRANSLATION_EQ];; + +add_linear_invariants + [GRAPH_LINEAR_IMAGE_EQ; + FAN1_LINEAR_IMAGE_EQ; + FAN2_LINEAR_IMAGE_EQ; + FAN3_LINEAR_IMAGE_EQ; + FAN4_LINEAR_IMAGE_EQ; + FAN5_LINEAR_IMAGE_EQ; + FAN6_LINEAR_IMAGE_EQ; + FAN7_LINEAR_IMAGE_EQ];; + +let FAN_TRANSLATION_EQ = prove + (`!a:real^N x V E. + FAN(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + FAN(x,V,E)`, + REWRITE_TAC[FAN] THEN GEOM_TRANSLATE_TAC[]);; + +let FAN_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (FAN(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> FAN(x,V,E))`, + REWRITE_TAC[FAN] THEN GEOM_TRANSFORM_TAC[]);; + +add_translation_invariants [FAN_TRANSLATION_EQ];; +add_linear_invariants [FAN_LINEAR_IMAGE_EQ];; + +let BASE_POINT_FAN_TRANSLATION_EQ = prove + (`!a x V E. + base_point_fan(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) = + a + base_point_fan(x,V,E)`, + REWRITE_TAC[base_point_fan]);; + +let BASE_POINT_FAN_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f + ==> base_point_fan(f x,IMAGE f V,IMAGE (IMAGE f) E) = + f(base_point_fan(x,V,E))`, + REWRITE_TAC[base_point_fan]);; + +let SET_OF_EDGE_TRANSLATION_EQ = prove + (`!a:real^N x V E. + set_of_edge (a + x) (IMAGE (\x. a + x) V) + (IMAGE (IMAGE (\x. a + x)) E) = + IMAGE (\x. a + x) (set_of_edge x V E)`, + REWRITE_TAC[set_of_edge] THEN GEOM_TRANSLATE_TAC[]);; + +let SET_OF_EDGE_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> set_of_edge (f x) (IMAGE f V) (IMAGE (IMAGE f) E) = + IMAGE f (set_of_edge x V E)`, + let lemma = prove + (`{w | {a,w} IN IMAGE (IMAGE f) s /\ P w} = + {f w |w| {a,f w} IN IMAGE (IMAGE f) s /\ P(f w)}`, + MATCH_MP_TAC(SET_RULE + `(!y. P y ==> ?x. y = f x) ==> {w | P w} = {f w |w| P(f w)}`) THEN + REWRITE_TAC[IN_IMAGE; EXTENSION; IN_IMAGE; IN_INSERT; NOT_IN_EMPTY] THEN + MESON_TAC[]) in + REWRITE_TAC[set_of_edge; lemma] THEN + GEOM_TRANSFORM_TAC[] THEN SET_TAC[]);; + +add_translation_invariants + [BASE_POINT_FAN_TRANSLATION_EQ; SET_OF_EDGE_TRANSLATION_EQ];; + +add_linear_invariants + [BASE_POINT_FAN_LINEAR_IMAGE_EQ; SET_OF_EDGE_LINEAR_IMAGE_EQ];; + + + + + + + +let CTVTAQA=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (E1:(real^3->bool)->bool). +FAN(x,V,E) /\ E1 SUBSET E +==> +FAN(x,V,E1)`, +REPEAT GEN_TAC +THEN REWRITE_TAC[FAN;fan1;fan2;fan6;fan7;graph] +THEN ASM_SET_TAC[]);; + + + +(* ========================================================================== *) +(* SET_OF_EDGE *) +(* ========================================================================== *) + + +let set_of_edge_subset_edges=prove(`!(V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3). + set_of_edge v V E SUBSET V`, +REWRITE_TAC[set_of_edge] THEN SET_TAC[]);; + + + +let remark_fan1=prove(`!v w V E. +(v IN V) /\ (w IN V) ==> +((w IN set_of_edge v V E)<=>(v IN set_of_edge w V E))`, + +(let lemma=prove(`{w,v}={v,w}`, SET_TAC[]) in +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[set_of_edge;IN_ELIM_THM] THEN ASM_REWRITE_TAC[] THEN MESON_TAC[lemma]));; + +let remark_finite_fan1=prove(`!v:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). FINITE V ==> FINITE (set_of_edge v V E)`, +REPEAT GEN_TAC THEN DISCH_TAC + THEN MP_TAC(ISPECL [`(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))`; `V:real^3->bool`] FINITE_SUBSET) + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[set_of_edge] THEN SET_TAC[] );; + +let properties_of_set_of_edge=prove(`!v:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) u:real^3. +UNIONS E SUBSET V +==> +({v,u} IN E <=> u IN set_of_edge v V E)`, +REPEAT GEN_TAC THEN REWRITE_TAC[UNIONS; SUBSET; set_of_edge ; IN_ELIM_THM] +THEN STRIP_TAC + THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `u:real^3`th)) THEN REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN DISCH_TAC + THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `{(v:real^3),(u:real^3)}`th)) THEN SET_TAC[]);; + + + + +let expand_edge_graph_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (e:real^3->bool). +FAN(x,V,E) /\ e IN E +==> ?v:real^3 w:real^3. e={v,w}`, +REPEAT GEN_TAC +THEN REWRITE_TAC[FAN;IN] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC `graph (E:(real^3->bool)->bool)` +THEN REWRITE_TAC[graph] +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`e:real^3->bool`th)) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[HAS_SIZE] +THEN STRIP_TAC +THEN SUBGOAL_THEN `~((e:real^3->bool)={})` ASSUME_TAC +THENL[ +STRIP_TAC +THEN MP_TAC(ISPEC`(e:real^3->bool)`CARD_EQ_0) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MP_TAC(SET_RULE `~((e:real^3->bool)={})==> ?v:real^3. v IN e`) +THEN RESA_TAC +THEN SUBGOAL_THEN`~((e:real^3->bool) DELETE v={})` ASSUME_TAC +THENL[ +STRIP_TAC +THEN MP_TAC(ISPECL[`v:real^3`;`(e:real^3->bool)`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(e:real^3->bool)`;`v:real^3`] FINITE_DELETE) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(e:real^3->bool) DELETE v`CARD_EQ_0) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MP_TAC(SET_RULE `~((e:real^3->bool)DELETE v={})==> ?w:real^3. w IN (e:real^3->bool)DELETE v/\ w IN e`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `(v IN (e:real^3->bool))/\ (w IN (e:real^3->bool))==> {v,w} SUBSET e`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `(w IN (e:real^3->bool)DELETE v)==> ~(v=w)`) +THEN RESA_TAC +THEN MP_TAC(ISPECL [`{v:real^3,w:real^3}`;`(e:(real^3->bool))`] FINITE_SUBSET) +THEN RESA_TAC +THEN ASSUME_TAC(SET_RULE `v:real^3 IN {v:real^3,w:real^3} `) +THEN MP_TAC(ISPECL[`v:real^3`;`{v:real^3,w:real^3}`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `v IN {v,w}==>{v:real^3,w:real^3} DELETE v PSUBSET {v,w}`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`{v:real^3,w:real^3} DELETE v`;`{v:real^3,w:real^3}`]CARD_PSUBSET) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`FINITE {v:real^3,w:real^3}` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN DISCH_TAC +THEN MP_TAC(ARITH_RULE`CARD ({v, w} DELETE v) < CARD {v, w}/\ CARD ({v, w} DELETE v) = CARD {v, w}-1 +<=>CARD ({v, w} DELETE v) +1= CARD {v:real^3, w:real^3}`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th;]) +THEN REWRITE_TAC[ARITH_RULE`A=A`] +THEN DISCH_TAC +THEN SUBGOAL_THEN `w:real^3 IN ({v:real^3,w:real^3} DELETE v)` ASSUME_TAC +THENL[ +ASM_SET_TAC[]; +MP_TAC(ISPECL[`{v:real^3,w:real^3}`;`v:real^3`] FINITE_DELETE) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`w:real^3`;`{v:real^3,w:real^3} DELETE v`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `w IN ({v,w} DELETE v)==>{v:real^3,w:real^3} DELETE v DELETE w PSUBSET {v,w} DELETE v`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`{v:real^3,w:real^3} DELETE v DELETE w`;`{v:real^3,w:real^3} DELETE v`]CARD_PSUBSET) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`FINITE ({v:real^3,w:real^3} DELETE v)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN DISCH_TAC +THEN MP_TAC(ARITH_RULE`CARD ({v, w} DELETE v DELETE w) < CARD ({v, w} DELETE v)/\ CARD ({v, w} DELETE v DELETE w) = CARD ({v, w} DELETE v)-1 +<=>CARD ({v, w} DELETE v DELETE w) +1= CARD ({v:real^3, w:real^3} DELETE v)`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th;]) +THEN REWRITE_TAC[ARITH_RULE`A=A`] +THEN DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[]) +THEN POP_ASSUM (fun th->REWRITE_TAC[]) +THEN ASSUME_TAC(SET_RULE `{v, w} DELETE v:real^3 DELETE w:real^3={}`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th;CARD_CLAUSES; ARITH_RULE `0+1=1`]) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"B") +THEN DISCH_TAC +THEN REMOVE_THEN "B" MP_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th);ARITH_RULE` 1+1=2`]) +THEN FIND_ASSUM MP_TAC`CARD (e:real^3->bool)=2` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`{v:real^3,w:real^3}`;`e:real^3->bool`]CARD_SUBSET_EQ) +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) +THEN RESA_TAC +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)])]]]);; + + + + + +let add_edge_graph_fan=prove(`!(V:A->bool) (E:(A->bool)->bool) v:A u:A. + v IN V /\ u IN V /\ E1=E UNION {{v,u}} /\ UNIONS E SUBSET V==> UNIONS E1 SUBSET V`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[UNIONS; SUBSET; UNION; IN_ELIM_THM;IN_SING] +THEN DISCH_THEN(LABEL_TAC "YEU") +THEN REPEAT STRIP_TAC +THENL[SUBGOAL_THEN`(?u. u IN E /\ x IN (u:A->bool))`ASSUME_TAC +THENL[ +EXISTS_TAC`u':A->bool` THEN ASM_REWRITE_TAC[]; +REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th `x:A`)]; +ASM_TAC THEN SET_TAC[]]);; + + +let garph_add_edge_is_garph=prove(`!(V:A->bool) (E:(A->bool)->bool) v:A u:A. + E1=E UNION {{v,u}} /\ ~(v=u) /\ graph E==> graph E1`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[GRAPH; UNION;IN_ELIM_THM;IN_SING] +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN GEN_TAC THEN STRIP_TAC +THENL[REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th `e:A->bool`); +ASM_REWRITE_TAC[HAS_SIZE] THEN STRIP_TAC +THEN MRESA_TAC CARD_2_FAN[`v:A`;`u:A`] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY]]);; + +let add_edge_into_collinear_fan=prove(`!x:real^3 (E:(real^3->bool)->bool) v:real^3 u:real^3. +~collinear {x,v,u} /\ +(!e. e IN E ==> ~collinear ({x} UNION e)) +==> +(!e. e IN E UNION {{v, u}} ==> ~collinear ({x} UNION e))`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV)[UNION;] +THEN REWRITE_TAC[IN_ELIM_THM;IN_SING] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"YEU") +THEN STRIP_TAC +THENL[REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th `e:real^3->bool`); +ASM_REWRITE_TAC[SET_RULE`{X} UNION {A,B}={X,A,B}`]]);; + + +let properties_edges_eq_fan=prove(`!e:A-> bool v:A u:A. +FINITE e /\ ~(e={v,u}) /\ ~(v=u) /\ CARD e=2 ==> ~(v IN e)\/ ~(u IN e)`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "YEU") +THEN ONCE_REWRITE_TAC[SET_RULE`~A \/ ~B<=> ~(A/\B)`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`v IN e /\ u IN e ==> {v:A,u} SUBSET e`) +THEN RESA_TAC +THEN MRESA_TAC CARD_2_FAN[`v:A`;`u:A`] +THEN REMOVE_THEN "YEU" MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN STRIP_TAC +THEN MRESA_TAC CARD_SUBSET_EQ[`{v,u:A}`;`e:A->bool`]);; + + + + +(* ========================================================================== *) +(* BASIC FAN *) +(* ========================================================================== *) + + +let set_edges_is_finite_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E)==> FINITE E`, +REPEAT GEN_TAC +THEN REWRITE_TAC[FAN;fan1;graph] +THEN STRIP_TAC +THEN MP_TAC(ISPEC `V:real^3->bool`FINITE_POWERSET) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`UNIONS (E:(real^3->bool)->bool) SUBSET (V:real^3->bool)==> E SUBSET {t| t SUBSET V}`) +THEN RESA_TAC + THEN MP_TAC(ISPECL [`(E:(real^3->bool)->bool)`;`{t| t SUBSET (V:real^3->bool)}`] FINITE_SUBSET) +THEN ASM_SET_TAC[]);; + + + +let properties_of_set_of_edge_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3. +FAN(x,V,E) +==> +({v,u} IN E <=> u IN set_of_edge v V E)`, +REWRITE_TAC[FAN] THEN REPEAT GEN_TAC THEN REWRITE_TAC[UNIONS; SUBSET; set_of_edge ; IN_ELIM_THM] +THEN STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"a") THEN STRIP_TAC + THEN REMOVE_THEN "a"(fun th-> MP_TAC(ISPEC `u:real^3`th)) THEN REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN DISCH_TAC + THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `{(v:real^3),(u:real^3)}`th)) THEN SET_TAC[]);; + + + +let properties_of_graph=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (v:real^3). +FAN(x,V,E) /\{v,u} IN E==> v IN V`, + +REPEAT GEN_TAC THEN REWRITE_TAC[FAN] THEN STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_THEN(LABEL_TAC "a") THEN REPEAT STRIP_TAC THEN +REMOVE_THEN "a" MP_TAC THEN REWRITE_TAC[UNIONS; SUBSET; IN_ELIM_THM] THEN DISCH_TAC + THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`v:real^3` th)) THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC THEN EXISTS_TAC `{(v:real^3),(u:real^3)}` THEN ASM_TAC THEN SET_TAC[]);; + + +let properties_of_graph1=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (v:real^3). +FAN(x,V,E) /\{v,u} IN E==> u IN V`, +ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN SET_TAC[properties_of_graph]);; + + +let th4=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (v:real^3). +FAN(x,V,E) /\{v,u} IN E==> ~(x=v)`, +REPEAT GEN_TAC THEN STRIP_TAC THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (u:real^3)`; `(v:real^3)`]properties_of_graph) THEN ASM_REWRITE_TAC[] THEN REPEAT(POP_ASSUM MP_TAC) THEN REWRITE_TAC[FAN;fan2] THEN SET_TAC[]);; + +let remark4_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (v:real^3). +FAN(x,V,E) /\ {v,u} IN E==> ~ (x=v) /\ ~(x=u) /\ DISJOINT {x,v} {u}/\ DISJOINT {x,u} {v} /\ DISJOINT {x} {v,u} /\ ~(u IN aff {x,v})`, + +REPEAT GEN_TAC THEN REWRITE_TAC[FAN;fan6] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") THEN REPEAT DISCH_TAC THEN REMOVE_THEN"a"(fun th->MP_TAC(ISPEC`{(v:real^3),(u:real^3)}`th)) THEN ASM_REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] THEN REWRITE_TAC[th3]);; + + +let collinears_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (v:real^3). +FAN(x,V,E) /\{v,u} IN E==>( ~ collinear {x,v,u} <=> ~(u IN aff {x,v}))`, +MESON_TAC[remark4_fan;collinear_fan]);; + +let remark1_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (v:real^3). +FAN(x,V,E) ==> +FINITE (set_of_edge v V E) +/\({v,u} IN E <=> u IN set_of_edge v V E)/\ +({v,u} IN E==> +~ collinear {x,v,u}/\ +~ (x=v) /\ ~(x=u)/\ ~(v=u) /\ DISJOINT {x,v} {u}/\ DISJOINT {x,u} {v} /\DISJOINT {x} {v,u} /\ ~(u IN aff {x,v}) /\ v IN V /\ u IN V/\ ( ~ collinear {x,v,u} <=> ~(u IN aff {x,v})))`, +MESON_TAC[FAN;fan1;remark_finite_fan1;remark4_fan; properties_of_graph; SET_RULE`DISJOINT {x,v} {u} ==> ~(v=u)`;collinears_fan;properties_of_set_of_edge_fan;properties_of_graph1]);; + + + + + + +(* ========================================================================== *) +(* EXISTS SIGMA_FAN *) +(* ========================================================================== *) + + + +let sigma_fan=new_definition`sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)= +(if (set_of_edge v V E = {u} ) then u + else (@(w:real^3). (w IN (set_of_edge v V E)) /\ ~(w=u) /\ +(!(w1:real^3). (w1 IN (set_of_edge v V E))/\ ~(w1=u) ==> azim x v u w <= azim x v u w1)))`;; + + +(* This extends sigma to have a larger domain + of R^3 rather than just V. It is the + identity outside V (compare the definition + of `permutes` ). *) + + + + +let extension_sigma_fan=new_definition`extension_sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)= +(if ~(u IN set_of_edge v V E ) then u + else (sigma_fan x V E v u))`;; + + + + + +let exists_sigma_fan=prove(` +(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +~ (set_of_edge v V E= {u} ) +/\ FAN(x,V,E) /\ (u IN (set_of_edge v V E)) +==> +(?(w:real^3). (w IN (set_of_edge v V E)) /\ ~(w=u) /\ +(!(w1:real^3). (w1 IN (set_of_edge v V E))/\ ~(w1=u) ==> azim x v u w <= azim x v u w1)))`, +(let lemma = prove + (`!X:real->bool. + FINITE X /\ ~(X = {}) + ==> ?a. a IN X /\ !x. x IN X ==> a <= x`, + MESON_TAC[INF_FINITE]) in + + +MP_TAC(lemma) THEN DISCH_THEN(LABEL_TAC "a") THEN REPEAT GEN_TAC THEN REWRITE_TAC[FAN;fan1] THEN STRIP_TAC THEN MP_TAC (ISPECL[`(v:real^3)` ;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]remark_finite_fan1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + +SUBGOAL_THEN `FINITE ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3))` ASSUME_TAC +THENL[(*2*) +ASM_MESON_TAC[FINITE_DELETE_IMP];(*2*) + +DISJ_CASES_TAC(SET_RULE`((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3)={})\/ + ~((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3)={})`) +THENL[(*3*) +POP_ASSUM MP_TAC THEN REWRITE_TAC[DELETE;EXTENSION;IN_ELIM_THM] THEN DISCH_TAC + THEN SUBGOAL_THEN `set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={u:real^3}` ASSUME_TAC +THENL[(*4*) +ASM_TAC THEN SET_TAC[];(*4*) +ASM_TAC THEN SET_TAC[]](*4*);(*3*) +SUBGOAL_THEN`~(IMAGE (azim x v u) ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3))={})` ASSUME_TAC +THENL[(*4*) +REWRITE_TAC[IMAGE_EQ_EMPTY] THEN ASM_MESON_TAC[];(*4*) + +SUBGOAL_THEN` FINITE (IMAGE (azim x v u) ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3)))` ASSUME_TAC +THENL[(*5*) +ASM_MESON_TAC[FINITE_IMAGE];(*5*) +REMOVE_THEN "a" (fun th ->MP_TAC(ISPEC `(IMAGE (azim x v u) ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3)))` th)) + THEN ASM_REWRITE_TAC[IMAGE;DELETE;IN_ELIM_THM] THEN STRIP_TAC THEN EXISTS_TAC`x':real^3` + THEN ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[] +](*5*)](*4*)](*3*)](*2*)(*1*)));; + + + +let SIGMA_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +~ (set_of_edge v V E= {u} ) +/\ FAN(x,V,E) /\ (u IN (set_of_edge v V E)) +==> +((sigma_fan x V E v u) IN (set_of_edge v V E)) /\ ~((sigma_fan x V E v u)=u) /\ +(!(w1:real^3). (w1 IN (set_of_edge v V E))/\ ~(w1=u) ==> azim x v u (sigma_fan x V E v u) <= azim x v u w1)`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN ONCE_REWRITE_TAC[sigma_fan] + THEN MP_TAC(ISPECL[`(x:real^3)`; `(V:real^3->bool)`; `(E:(real^3->bool)->bool)`; `(v:real^3)`; `(u:real^3)`]exists_sigma_fan) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN SELECT_ELIM_TAC THEN EXISTS_TAC`w:real^3` THEN ASM_REWRITE_TAC[]);; + + + + + +let sigma_fan_in_set_of_edge=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ (u IN (set_of_edge v V E)) +==> +((sigma_fan x V E v u) IN (set_of_edge v V E))`, + +REPEAT STRIP_TAC THEN DISJ_CASES_TAC(SET_RULE`~ (set_of_edge v V E= {u:real^3} )\/ (set_of_edge v V E= {u} )`) +THENL[ + MP_TAC(ISPECL[`(x:real^3)`; `(V:real^3->bool)`; `(E:(real^3->bool)->bool)`; `(v:real^3)`; `(u:real^3)`]SIGMA_FAN) +THEN ASM_TAC +THEN SET_TAC[]; +ASM_REWRITE_TAC[sigma_fan;IN_SING]]);; + + + +(* ========================================================================== *) +(* CONDITION UNIQUE FOINT AND SIGMA_FAN *) +(* ========================================================================== *) + + + + + +let UNIQUE_FOINT_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) w:real^3. +FAN(x,V,E) /\ ({v,u} IN E) /\ ({v,w} IN E)/\ + ~(aff_ge {x} {v,u} INTER aff_ge {x} {v,w}=aff_ge {x} {v}) +==> u=w`, +REPEAT GEN_TAC THEN REWRITE_TAC[FAN;fan7;fan6] THEN STRIP_TAC + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN DISCH_THEN (LABEL_TAC "a") THEN REPEAT STRIP_TAC + THEN REMOVE_THEN "a" (fun th-> MP_TAC(ISPECL[`{(v:real^3),(u:real^3)}`;`{(v:real^3),(w:real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] + THEN DISJ_CASES_TAC(SET_RULE`~((u:real^3)=(w:real^3))\/ ((u:real^3)=(w:real^3))`) +THENL +[ MP_TAC(SET_RULE`~((u:real^3)=(w:real^3))==> {(v:real^3),(u:real^3)} INTER {(v:real^3),(w:real^3)}={v}`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[]; +ASM_TAC THEN SET_TAC[]]);; + + + + + + + + + +let UNIQUE1_POINT_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) w:real^3. +FAN(x,V,E) /\ ({v,u} IN E) /\ ({v,w} IN E)/\ w IN aff_gt {x,v} {u} +==> u=w`, +REPEAT GEN_TAC THEN STRIP_TAC THEN MATCH_MP_TAC UNIQUE_FOINT_FAN THEN +EXISTS_TAC `x:real^3` THEN EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `E:(real^3->bool)->bool` THEN EXISTS_TAC `v:real^3` + THEN ASM_REWRITE_TAC[] THEN REPEAT(POP_ASSUM MP_TAC) + THEN REWRITE_TAC[FAN;fan1;fan2;fan6;fan7] THEN REPEAT STRIP_TAC THEN REPEAT(POP_ASSUM MP_TAC) + THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC + THEN DISCH_THEN (LABEL_TAC "a") + THEN DISCH_THEN (LABEL_TAC "b") THEN REPEAT DISCH_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "a" (fun th-> MP_TAC(ISPEC `{(v:real^3),(w:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th-> MP_TAC(ISPEC `{(v:real^3),(u:real^3)}`th)) + THEN ASM_REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] + THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "c") + THEN DISCH_TAC THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (w:real^3)`]th3) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]th3) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]AFF_GT_2_1) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN REMOVE_THEN "c" MP_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC + THEN SUBGOAL_THEN` aff_ge {(x:real^3)} {(v:real^3)} SUBSET aff {x,v}` ASSUME_TAC +THENL (*1*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]AFF_GE_1_10) +THEN MP_TAC(SET_RULE`~((x:real^3) = (v:real^3))==> DISJOINT {x} {v}`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[aff;AFFINE_HULL_2] THEN ASM_TAC THEN SET_TAC[];(*1*) + +SUBGOAL_THEN `~((w:real^3) IN aff_ge {x} {v})` ASSUME_TAC +THENL (*2*)[ +ASM_TAC THEN SET_TAC[];(*2*) + +POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "d") THEN DISJ_CASES_TAC(REAL_ARITH `(&0 <= (t2:real))\/ (&0 <= (-- (t2:real)))`) +THENL (*3*)[ + SUBGOAL_THEN `(w:real^3) IN aff_ge {(x:real^3)} {(v:real^3),(u:real^3)}` ASSUME_TAC +THENL (*4*)[ + MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]AFF_GE_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC `t1:real` + THEN EXISTS_TAC `t2:real` THEN EXISTS_TAC `t3:real` THEN ASM_REWRITE_TAC[] + THEN REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC;(*4*) + + SUBGOAL_THEN `(w:real^3) IN aff_ge {(x:real^3)} {(v:real^3),(w:real^3)}` ASSUME_TAC +THENL (*5*)[ + MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (w:real^3)`]AFF_GE_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC `&0:real` + THEN EXISTS_TAC `&0:real` THEN EXISTS_TAC `&1:real` THEN REWRITE_TAC[VECTOR_ARITH`w= &0 % x+ &0 % v + &1 % w `] THEN REAL_ARITH_TAC;(*5*) + +ASM_TAC THEN SET_TAC[]](*5*)](*4*);(*3*) + + SUBGOAL_THEN `(u:real^3) IN aff_ge {(x:real^3)} {(v:real^3),(w:real^3)}` ASSUME_TAC +THENL (*4*)[ + MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (w:real^3)`]AFF_GE_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC `inv(t3:real) *(--(t1:real))` + THEN EXISTS_TAC `inv(t3:real)*(--(t2:real))` THEN EXISTS_TAC `inv(t3:real)` +THEN MP_TAC(ISPEC `t3:real` REAL_LT_INV) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(REAL_ARITH`&0< inv(t3:real)==> (&0 <= inv(t3:real))`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL [`inv (t3:real)`;`(--(t2:real))`] REAL_LE_MUL) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`inv(t3:real) * -- (t1:real)+ inv(t3) * --(t2:real) +inv (t3)=inv (t3)*(&1-t1-t2)`] THEN +MP_TAC(REAL_ARITH`(t1:real)+(t2:real)+(t3:real)= &1 ==> &1 - t1- t2=t3`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN +MP_TAC(REAL_ARITH`&0<(t3:real)==> ~(t3= &0)`) THEN ASM_REWRITE_TAC[VECTOR_ARITH` + (inv t3 * --t1) % x + + (inv t3 * --t2) % v + + inv t3 % (t1 % x + t2 % v + t3 % u)= (inv t3 * t3) % u ` +] THEN DISCH_TAC +THEN MP_TAC(ISPEC `t3:real` REAL_MUL_LINV) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH ` v= &1 % v`];(*4*) + + SUBGOAL_THEN `(u:real^3) IN aff_ge {(x:real^3)} {(v:real^3),(u:real^3)}` ASSUME_TAC +THENL (*5*)[ + MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]AFF_GE_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC `&0:real` + THEN EXISTS_TAC `&0:real` THEN EXISTS_TAC `&1:real` THEN REWRITE_TAC[VECTOR_ARITH`u= &0 % x+ &0 % v + &1 % u `] THEN REAL_ARITH_TAC;(*5*) +ASM_TAC THEN SET_TAC[]](*5*)](*4*)](*3*)](*2*)](*1*));; + + +let UNIQUE_AZIM_POINT_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) w:real^3 w1:real^3. +FAN(x,V,E) /\ ({v,u} IN E) /\ ({v,w} IN E) /\ { v, w1} IN E /\ (azim x v u w =azim x v u w1) +==> w=w1`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(th) THEN ASSUME_TAC(th)) THEN REWRITE_TAC[FAN;fan6] THEN REPEAT STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_TAC + THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_THEN (LABEL_TAC "a") THEN REPEAT DISCH_TAC + THEN REMOVE_THEN "a"(fun th ->MP_TAC(ISPEC`{(v:real^3),(u:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM(fun th ->MP_TAC(ISPEC `{(v:real^3),(w:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM(fun th ->MP_TAC(ISPEC `{(v:real^3),(w1:real^3)}`th)) THEN ASM_REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] + THEN REPEAT STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;`(v:real^3) `;`(u:real^3) `;`w:real^3`;` w1:real^3`] AZIM_EQ) THEN +ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;` w1:real^3`]UNIQUE1_POINT_FAN) THEN ASM_REWRITE_TAC[] );; + + +let UNIQUE_AZIM_0_POINT_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) w:real^3. +FAN(x,V,E) /\ ({v,u} IN E) /\ ({v,w} IN E) /\ (azim x v u w = &0) +==> u=w`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(th) THEN ASSUME_TAC(th)) THEN REWRITE_TAC[FAN;fan6] THEN REPEAT STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_TAC + THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_THEN (LABEL_TAC "a") THEN REPEAT DISCH_TAC + THEN REMOVE_THEN "a"(fun th ->MP_TAC(ISPEC`{(v:real^3),(u:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM(fun th ->MP_TAC(ISPEC `{(v:real^3),(w:real^3)}`th)) THEN ASM_REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] + THEN REPEAT STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;`(v:real^3) `;`(u:real^3) `;`w:real^3`] AZIM_EQ_0_ALT) THEN +ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;` w:real^3`]UNIQUE1_POINT_FAN) THEN ASM_REWRITE_TAC[] );; + + + + +let UNIQUE_SIGMA_FAN=prove(` +(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3). +~ (set_of_edge v V E= {u} ) +/\ FAN(x,V,E) /\ (u IN (set_of_edge v V E)) +/\ (w IN (set_of_edge v V E)) /\ ~(w=u) /\ +(!(w1:real^3). (w1 IN (set_of_edge v V E))/\ ~(w1=u) ==> azim x v u w <= azim x v u w1) +==> sigma_fan x V E v u=w)`, + + ( let th=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) w:real^3. +FAN(x,V,E) /\ ({v,u} IN E) /\ ({v,w} IN E) +==> (w IN aff_gt {x,v} {u} ==> u=w)`, MESON_TAC[UNIQUE1_POINT_FAN] +) in + +ASSUME_TAC(th) THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT(POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"123") THEN +DISCH_TAC THEN DISCH_THEN(LABEL_TAC "1") + THEN DISCH_THEN(LABEL_TAC "2") THEN DISCH_THEN(LABEL_TAC "3") THEN DISCH_THEN(LABEL_TAC "4") + THEN DISCH_THEN(LABEL_TAC"a") + THEN MP_TAC(ISPECL[`(x:real^3)`; `(V:real^3->bool)`; `(E:(real^3->bool)->bool)` ;`(v:real^3)`; `(u:real^3)`]SIGMA_FAN) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN REMOVE_THEN "a" (fun th->MP_TAC(ISPEC `sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)` th)) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM (fun th-> MP_TAC(ISPEC `w:real^3` th)) THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"b") + THEN REPEAT DISCH_TAC + THEN SUBGOAL_THEN `azim x v u (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) = azim x v u (w:real^3)` ASSUME_TAC +THENL[ +REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; +REMOVE_THEN "123" (fun th->MP_TAC (ISPECL[`(x:real^3)`; `(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`; `(v:real^3)` ; `(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))`;`(w:real^3)`]th)) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +REMOVE_THEN"1" MP_TAC +THEN REWRITE_TAC[FAN;fan6;fan7] THEN STRIP_TAC THEN +POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "c") THEN DISCH_THEN (LABEL_TAC "d") + THEN REMOVE_THEN"2" MP_TAC THEN REMOVE_THEN"3" MP_TAC THEN REMOVE_THEN"b" MP_TAC + THEN REWRITE_TAC[set_of_edge;IN_ELIM_THM] THEN REPEAT STRIP_TAC + THEN REMOVE_THEN "c" MP_TAC THEN DISCH_TAC + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(w:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(u:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))}`th) THEN ASSUME_TAC(th)) + THEN REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] THEN REPEAT STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`; `(v:real^3)`; `(u:real^3)` ;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))`; `(w:real^3)`]AZIM_EQ ) + THEN ASM_REWRITE_TAC[] + THEN ASM_MESON_TAC[]]));; + + + +(* ========================================================================== *) +(* CYCLIC SET FAN *) +(* ========================================================================== *) + + + + + +let CYCLIC_SET_EDGE_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3). +FAN(x,V,E) /\ v IN V +==> cyclic_set (set_of_edge v V E) x v`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN REPEAT (POP_ASSUM MP_TAC) +THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(th) +THEN ASSUME_TAC(th)) THEN REWRITE_TAC[FAN; cyclic_set;fan1;fan2;fan6;fan7] THEN STRIP_TAC THEN STRIP_TAC THEN STRIP_TAC + THENL(*1*)[ASM_TAC THEN SET_TAC[];(*1*) +STRIP_TAC + THENL (*2*)[ASM_TAC THEN SET_TAC[remark_finite_fan1];(*2*) + STRIP_TAC THENL(*3*)[ + +ASM_REWRITE_TAC[set_of_edge;IN_ELIM_THM] THEN +REPEAT GEN_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + DISCH_THEN(LABEL_TAC "a") THEN DISCH_THEN(LABEL_TAC "b") +THEN STRIP_TAC THEN STRIP_TAC THEN +REMOVE_THEN "a" (fun th-> MP_TAC(ISPEC `{(v:real^3), (p:real^3)}` th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th-> MP_TAC(ISPEC `{(v:real^3), (q:real^3)}` th)) + THEN ASM_REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] THEN REPEAT STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (p:real^3)`]th3) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (q:real^3)`]th3) THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM (fun th-> REWRITE_TAC[]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) + THEN REPEAT STRIP_TAC THEN SUBGOAL_THEN `(q:real^3) IN aff_gt {(x:real^3),(v:real^3)} {(p:real^3)}` ASSUME_TAC + +THENL (*4*)[ + MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (p:real^3)`]AFF_GT_2_1) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] + THEN EXISTS_TAC `--(h:real)` THEN EXISTS_TAC `(h:real)` THEN EXISTS_TAC `&1` THEN REWRITE_TAC[VECTOR_ARITH`q= (-- (h:real)) % x + (h:real) % v + &1 % (q+ h% (x-v))`] THEN REAL_ARITH_TAC;(*4*) + +ASM_MESON_TAC[UNIQUE1_POINT_FAN]](*4*);(*3*) + +REWRITE_TAC[INTER;EXTENSION;IN_ELIM_THM] THEN GEN_TAC +THEN SUBGOAL_THEN`(x':real^3) IN set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) ==> ~(x' IN aff {x,v})` +ASSUME_TAC +THENL(*4*)[ +ASM_REWRITE_TAC[set_of_edge;IN_ELIM_THM] THEN +REPEAT GEN_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + DISCH_THEN(LABEL_TAC "a") THEN DISCH_THEN(LABEL_TAC "b") +THEN STRIP_TAC THEN STRIP_TAC THEN +REMOVE_THEN "a" (fun th-> MP_TAC(ISPEC `{(v:real^3), (x':real^3)}` th) ) + THEN ASM_REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] THEN STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (x':real^3)`]th3) THEN ASM_MESON_TAC[]; (*4*) + +EQ_TAC THENL(*5*)[ + +POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "a") THEN STRIP_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[aff];(*5*) + +ASM_TAC THEN SET_TAC[]](*5*)](*4*)] (*3*)]]);; + + +let XOHLED=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3). +FAN(x,V,E) /\ v IN V +==> cyclic_set (set_of_edge v V E) x v`, +MESON_TAC[CYCLIC_SET_EDGE_FAN]);; + + +(* ========================================================================== *) +(* SIGMA_FAN IS PERMUTES (^_^) *) +(* ========================================================================== *) + + +let azim1=new_definition`azim1 (x:real^3) (v:real^3) (u:real^3) (w:real^3)= &2 * pi- azim x v u w`;; + + +let exists_inverse_sigma_fan_alt=prove(` +(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +~ (set_of_edge v V E= {u} ) +/\ FAN(x,V,E) /\ (u IN (set_of_edge v V E)) +==> +(?(w:real^3). (w IN (set_of_edge v V E)) /\ ~(w=u) /\ +(!(w1:real^3). (w1 IN (set_of_edge v V E))/\ ~(w1=u) ==> azim1 x v u w <= azim1 x v u w1))) +`, +(let lemma = prove + (`!X:real->bool. + FINITE X /\ ~(X = {}) + ==> ?a. a IN X /\ !x. x IN X ==> a <= x`, + MESON_TAC[INF_FINITE]) in +MP_TAC(lemma) THEN DISCH_THEN(LABEL_TAC "a") THEN REPEAT GEN_TAC THEN REWRITE_TAC[FAN;fan1] THEN STRIP_TAC THEN MP_TAC (ISPECL[`(v:real^3)` ;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]remark_finite_fan1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +SUBGOAL_THEN `FINITE ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3))` ASSUME_TAC +THENL[(*2*) + +ASM_MESON_TAC[FINITE_DELETE_IMP];(*2*) +DISJ_CASES_TAC(SET_RULE`((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3)={})\/ + ~((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3)={})`) +THENL[(*3*) +POP_ASSUM MP_TAC THEN REWRITE_TAC[DELETE;EXTENSION;IN_ELIM_THM] THEN DISCH_TAC + THEN SUBGOAL_THEN `set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={u:real^3}` ASSUME_TAC +THENL[(*4*) +ASM_TAC THEN SET_TAC[];(*4*) +ASM_TAC THEN SET_TAC[](*4*)]; + +SUBGOAL_THEN`~(IMAGE ( azim1 x v u) ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3))={})` ASSUME_TAC +THENL[(*4*) +REWRITE_TAC[IMAGE_EQ_EMPTY] THEN ASM_MESON_TAC[];(*4*) +SUBGOAL_THEN` FINITE (IMAGE (azim1 x v u) ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3)))` ASSUME_TAC +THENL[(*5*) +ASM_MESON_TAC[FINITE_IMAGE];(*5*) +REMOVE_THEN "a" (fun th ->MP_TAC(ISPEC `(IMAGE (azim1 x v u) ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3)))` th)) + THEN ASM_REWRITE_TAC[IMAGE;DELETE;IN_ELIM_THM]THEN STRIP_TAC +THEN EXISTS_TAC`x':real^3` + THEN ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[] +](*5*)](*4*)](*3*)](*2*)(*1*)));; + + + + +let SUR_SIGMA_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ ({v,u} IN E) +==> ?w. {v,w} IN E /\sigma_fan x V E v w= u +`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE `(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={(u:real^3)})\/ ~(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={(u:real^3)})`) +THENL(*1*)[ +EXISTS_TAC`u:real^3` THEN ASM_REWRITE_TAC[sigma_fan];(*1*) + +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]properties_of_set_of_edge_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]exists_inverse_sigma_fan_alt) THEN ASM_REWRITE_TAC[azim1;] THEN STRIP_TAC THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`]properties_of_set_of_edge_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN EXISTS_TAC `w:real^3` THEN ASM_REWRITE_TAC[] + THEN MATCH_MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;` (u:real^3)`] UNIQUE_SIGMA_FAN) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "be") THEN DISCH_TAC +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={w} \/ ~(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={w})`) +THENL(*2*)[ +FIND_ASSUM(MP_TAC)`u:real^3 IN set_of_edge v V E` THEN POP_ASSUM(fun th->REWRITE_TAC[th;IN_SING]) THEN ASM_TAC THEN SET_TAC[] ;(*2*) + +ASM_REWRITE_TAC[] THEN GEN_TAC THEN STRIP_TAC THEN +DISJ_CASES_TAC(SET_RULE`~(azim (x:real^3) v w u <= azim x v w w1)\/ (azim (x:real^3) v w u <= azim x v w w1)`) +THENL(*3*)[ +ASM_REWRITE_TAC[] THEN SUBGOAL_THEN`azim (x:real^3) v w w1 <= azim x v w u` ASSUME_TAC +THENL(*4*)[ +POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*4*) + SUBGOAL_THEN `{(w:real^3),(w1:real^3),(u:real^3)} SUBSET set_of_edge v V E` ASSUME_TAC +THENL(*5*)[ +ASM_TAC THEN SET_TAC[];(*5*) +FIND_ASSUM(MP_TAC)`FAN((x:real^3),V,E)` THEN REWRITE_TAC[FAN;fan6] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "b") THEN STRIP_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (u:real^3)`;` (v:real^3)`]properties_of_graph) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`]CYCLIC_SET_EDGE_FAN) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;`{(w:real^3), (w1:real^3),(u:real^3)}`;`set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)` ]subset_cyclic_set_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`;`w1:real^3`;`u:real^3`]sum2_azim_fan) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`;`w1:real^3`]azim) THEN STRIP_TAC THEN STRIP_TAC + THEN SUBGOAL_THEN`azim (x:real^3) v w1 u <= azim x v w u` ASSUME_TAC +THENL(*6*)[ REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC;(*6*) +POP_ASSUM MP_TAC THEN POP_ASSUM(fun th->REWRITE_TAC[]) THEN ASM_REWRITE_TAC[] THEN +MP_TAC (ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(w1:real^3)`]properties_of_set_of_edge) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN REMOVE_THEN "b" (fun th->MP_TAC (ISPEC`{(v:real^3),(w:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(u:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),w1}`th) THEN ASSUME_TAC(th)) + THEN REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC +THEN + DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (u:real^3) (w1:real^3)= &0) \/ ~(azim (x:real^3) (v:real^3) (u:real^3) (w1:real^3) = &0)`) +THENL(*7*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;`w1:real^3`]UNIQUE_AZIM_0_POINT_FAN) +THEN ASM_TAC THEN SET_TAC[];(*7*) + + DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (u:real^3) (w:real^3)= &0) \/ ~(azim (x:real^3) (v:real^3) (u:real^3) (w:real^3) = &0)`) +THENL(*8*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;`w:real^3`]UNIQUE_AZIM_0_POINT_FAN) +THEN ASM_TAC THEN SET_TAC[];(*8*) + MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`;` (w1:real^3)`]AZIM_COMPL) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`;` (w:real^3)`]AZIM_COMPL) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[] + THEN FIND_ASSUM(MP_TAC o (SPEC`w1:real^3`))`!w1:real^3. w1 IN set_of_edge v V E /\ ~(w1 = u) + ==> &2 * pi - azim x v u w <= &2 * pi - azim x v u w1` + THEN REMOVE_THEN "be" MP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] THEN DISJ_CASES_TAC(SET_RULE`~(w1:real^3=u)\/ (w1=u)`) +THENL(*9*)[ +ASM_REWRITE_TAC[REAL_ARITH`&2 * pi -(a:real)<= &2 *pi - b <=> b <= a`] THEN DISJ_CASES_TAC(SET_RULE `(azim(x:real^3) v u w =azim x v u w1)\/ ~(azim(x:real^3) v u w =azim x v u w1)`) +THENL(*10*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;` (w:real^3)`;`(w1:real^3)`]UNIQUE_AZIM_POINT_FAN) THEN ASM_REWRITE_TAC[];(*10*) +POP_ASSUM MP_TAC THEN REAL_ARITH_TAC](*10*);(*9*) +SUBGOAL_THEN `azim (x:real^3) v w u= azim x v w w1` ASSUME_TAC +THENL(*10*)[POP_ASSUM(fun th->REWRITE_TAC[th]);(*10*) +REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC](*10*)(*9*)](*8*)](*7*)](*6*)](*5*)](*4*)](*3*); +ASM_TAC THEN SET_TAC[]]]]);; + + + + + + +let MONO_SIGMA_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3). +FAN(x,V,E) /\ ({v,u} IN E) +/\ ({v,w} IN E)/\ + (sigma_fan x V E v u= sigma_fan x V E v w) +==> u=w +`, +REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT(POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"1") +THEN USE_THEN "1" MP_TAC THEN REWRITE_TAC[FAN;fan6] +THEN REPEAT STRIP_TAC THEN REPEAT(POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"1") THEN +DISCH_THEN (LABEL_TAC"a") THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_THEN(LABEL_TAC "b") THEN +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (u:real^3)`;` (v:real^3)`]properties_of_graph) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={(u:real^3)})\/ ~((set_of_edge v V E={u}))`) +THENL(*1*)[ +POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[set_of_edge; EXTENSION;IN_ELIM_THM] +THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`w:real^3`th)) THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "a" MP_TAC THEN REWRITE_TAC[UNIONS;SUBSET; IN_ELIM_THM] +THEN DISCH_TAC THEN POP_ASSUM (fun th->MP_TAC(ISPEC`w:real^3`th)) +THEN ASM_REWRITE_TAC[IN_SING;LEFT_IMP_EXISTS_THM] +THEN STRIP_TAC THEN POP_ASSUM (fun th->MP_TAC(ISPEC`{(v:real^3),(w:real^3)}`th)) + THEN ASM_TAC THEN SET_TAC[];(*1*) + +DISJ_CASES_TAC(SET_RULE`(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={(w:real^3)})\/ ~((set_of_edge v V E={w}))`) +THENL(*2*)[ + +POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[set_of_edge; EXTENSION;IN_ELIM_THM] +THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`u:real^3`th)) THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "a" MP_TAC THEN REWRITE_TAC[UNIONS;SUBSET; IN_ELIM_THM] +THEN DISCH_TAC THEN POP_ASSUM (fun th->MP_TAC(ISPEC`u:real^3`th)) +THEN ASM_REWRITE_TAC[IN_SING;LEFT_IMP_EXISTS_THM] +THEN STRIP_TAC THEN POP_ASSUM (fun th->MP_TAC(ISPEC`{(v:real^3),(u:real^3)}`th)) + THEN ASM_TAC THEN SET_TAC[];(*2*) + + +MP_TAC(ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (u:real^3)`]properties_of_set_of_edge) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN +MP_TAC(ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (w:real^3)`]properties_of_set_of_edge) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]SIGMA_FAN) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(w:real^3)`th)) +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`]SIGMA_FAN) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(u:real^3)`th)) + THEN ASM_REWRITE_TAC[] +THEN MP_TAC (ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`]properties_of_set_of_edge) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN REMOVE_THEN "b" (fun th->MP_TAC (ISPEC`{(v:real^3),(w:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(u:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))}`th) THEN ASSUME_TAC(th)) + THEN REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN +DISJ_CASES_TAC(SET_RULE`~((u:real^3)=(w:real^3))\/ u=w`) + +THENL(*3*)[ +ASM_REWRITE_TAC[] THEN SUBGOAL_THEN `{(w:real^3),(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)),(u:real^3)}SUBSET set_of_edge v V E` ASSUME_TAC +THENL(*4*)[ ASM_TAC THEN SET_TAC[];(*4*) + +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`]CYCLIC_SET_EDGE_FAN) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;`{(w:real^3), (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)),(u:real^3)}`;`set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)` ]subset_cyclic_set_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (w:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`;` (u:real^3)`]sum2_azim_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (LABEL_TAC "c") THEN + DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (w:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))= &0) \/ ~(azim (x:real^3) (v:real^3) (w:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) = &0)`) + +THENL(*5*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`]UNIQUE_AZIM_0_POINT_FAN) +THEN ASM_TAC THEN SET_TAC[];(*5*) + +DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (w:real^3) (u:real^3)= &0) \/ ~(azim (x:real^3) (v:real^3) (w:real^3) (u:real^3) = &0)`) + +THENL(*6*)[ + +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;`(u:real^3)`]UNIQUE_AZIM_0_POINT_FAN) +THEN ASM_TAC THEN SET_TAC[];(*6*) + + DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) (u:real^3)= &0) \/ ~(azim (x:real^3) (v:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) (u:real^3) = &0)`) + +THENL(*7*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`;` (u:real^3)`]UNIQUE_AZIM_0_POINT_FAN) +THEN ASM_TAC THEN SET_TAC[];(*7*) + +MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`;` (u:real^3)`]AZIM_COMPL) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (w:real^3)`;` (u:real^3)`]AZIM_COMPL) THEN +ASM_REWRITE_TAC[REAL_ARITH`&2 * pi - ((a:real)+(b:real))= --(a:real)+ (&2 * pi - b)`] THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_ARITH`b <= (a:real)+(b:real)<=> &0 <= a`] + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;`(w:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`] azim)THEN REPEAT(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC +(*7*)](*6*)](*5*)](*4*)];(*3*) + +ASM_REWRITE_TAC[](*3*)]]]);; + + + + +let permutes_sigma_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ ({v,u} IN E) +==> +(extension_sigma_fan x V E v) permutes (set_of_edge v V E)`, +REPEAT GEN_TAC THEN STRIP_TAC THEN FIND_ASSUM(MP_TAC)`FAN((x:real^3), V, E)` THEN REWRITE_TAC[FAN;fan1] THEN STRIP_TAC +THEN MP_TAC(ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`]remark_finite_fan1) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)`;`extension_sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3)`]PERMUTES_FINITE_INJECTIVE) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THENL[ +GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[extension_sigma_fan]; +STRIP_TAC +THENL[ +GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[extension_sigma_fan] THEN DISJ_CASES_TAC(SET_RULE`set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={(x':real^3)}\/ ~(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={(x':real^3)})`) +THENL[ASM_REWRITE_TAC[sigma_fan;IN_SING]; +ASM_MESON_TAC[SIGMA_FAN]]; +REPEAT GEN_TAC THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[extension_sigma_fan] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (x':real^3)`]properties_of_set_of_edge) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN +MP_TAC(ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (y:real^3)`]properties_of_set_of_edge) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN +ASM_MESON_TAC[MONO_SIGMA_FAN]]]);; + + + + +(* ========================================================================== *) +(* INVERSE OF SIGMA_FAN *) +(* ========================================================================== *) + + + + +let azim1=new_definition`azim1 (x:real^3) (v:real^3) (u:real^3) (w:real^3)= &2 * pi- azim x v u w`;; + + + + + + +let exists_function_inverse_sigma_fan_alt=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3). +FAN(x,V,E) ==> +(?g. (!w:real^3. {v,w} IN E==> {v, g w} IN E) +/\ (!w:real^3. {v,w} IN E==> (sigma_fan x V E v)( g w) =w) +/\ (!w:real^3. {v,w} IN E==> g (sigma_fan x V E v w) =w)) +`, +REPEAT STRIP_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`] sigma_fan_in_set_of_edge) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3)`;`set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)`; `set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)`]BIJECTIVE_ON_LEFT_RIGHT_INVERSE) + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`] properties_of_set_of_edge_fan) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] + +THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`] MONO_SIGMA_FAN) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`] SUR_SIGMA_FAN) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[]);; + +(* +This is the same as inverse_sigma_fan_alt, +but easier to use. +*) + + + +let inverse1_sigma_fan=new_definition`inverse1_sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3)= @g. (!w:real^3. {v,w} IN E==> {v, g w} IN E) +/\ (!w:real^3. {v,w} IN E==> (sigma_fan x V E v)( g w) =w) +/\ (!w:real^3. {v,w} IN E==> g (sigma_fan x V E v w) =w)`;; + + + +let INVERSE1_SIGMA_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3). +FAN(x,V,E) ==> +( (!w:real^3. {v,w} IN E==> {v, inverse1_sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) w} IN E) +/\ (!w:real^3. {v,w} IN E==> (sigma_fan x V E v)( inverse1_sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) w) =w) +/\ (!w:real^3. {v,w} IN E==> inverse1_sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (sigma_fan x V E v w) =w))`, +REPEAT GEN_TAC THEN STRIP_TAC THEN ONCE_REWRITE_TAC[inverse1_sigma_fan] THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3) `]exists_function_inverse_sigma_fan_alt) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN SELECT_ELIM_TAC THEN EXISTS_TAC`g:real^3->real^3` THEN ASM_REWRITE_TAC[]);; + + + + + +(* ========================================================================== *) +(* PROPERTIES OF FAN *) +(* ========================================================================== *) + + + + +let properties_of_fan7=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {v1,u1} IN E /\ v IN aff_ge {x} {v1,u1} +==> v = v1 \/ v = u1`, + +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN; fan6; fan7] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`v:real^3`] +THEN STRIP_TAC + THEN POP_ASSUM (fun th-> MP_TAC(ISPECL[`{(v:real^3),(u:real^3)}`;`{(v1:real^3),(u1:real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] +THEN SUBGOAL_THEN `(v:real^3) IN aff_ge {(x:real^3)} {(v:real^3),(u:real^3)}` ASSUME_TAC +THENL(*1*)[ + MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]AFF_GE_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC `&0:real` + THEN EXISTS_TAC `&1:real` THEN EXISTS_TAC `&0:real` +THEN REWRITE_TAC[VECTOR_ARITH`w= &0 % x+ &1 % w + &0 % v `] THEN REAL_ARITH_TAC; + +DISCH_TAC +THEN MP_TAC(SET_RULE`v IN aff_ge {x} {v, u} /\ v IN aff_ge {x} {v1, u1} ==> v IN aff_ge {x} {v, u} INTER aff_ge {x:real^3} {v1, u1:real^3}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`{v, u} INTER {v1, u1:real^3}={} \/ ~({v, u} INTER {v1, u1}={})`) +THENL(*2*)[ +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`aff_ge {x:real^3} {}= {y| ?t1. t1= &1 /\ y= t1 %x}` ASSUME_TAC +THENL(*3*)[ +ASSUME_TAC(SET_RULE `DISJOINT {x:real^3} {}`) +THEN AFF_TAC; + +ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[]];(*2*) + +DISJ_CASES_TAC(SET_RULE`~(v IN {v, u} INTER {v1, u1:real^3}) \/ (v IN {v, u} INTER {v1, u1})`) +THENL(*3*)[ +SUBGOAL_THEN`({v:real^3, u} INTER {v1, u1}={u})` ASSUME_TAC +THENL(*4*)[ + ASM_TAC +THEN SET_TAC[];(*4*) + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN` aff_ge {(x:real^3)} {(u:real^3)} SUBSET aff {x,u}` ASSUME_TAC +THENL(*5*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (u:real^3)`;]AFF_GE_1_1) +THEN MP_TAC(SET_RULE`~((x:real^3) = (u:real^3))==> DISJOINT {x} {u}`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[aff;AFFINE_HULL_2] THEN ASM_TAC THEN SET_TAC[];(*5*) + +FIND_ASSUM MP_TAC`{v,u:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN DISCH_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v:real^3`;`u:real^3`] +THEN ASM_TAC +THEN SET_TAC[]]];(*3*) + +POP_ASSUM MP_TAC +THEN SET_TAC[]]]]) ;; + + + + + + +let properties1_of_fan7=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {v1,u1} IN E /\ v IN aff_ge {x} {v1} +==> v = v1`, + +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN; fan6; fan7] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u1:real^3`;`v1:real^3`] +THEN MP_TAC(SET_RULE`(v1:real^3) IN V==> (?v. v IN V /\ {v1} = {v})`) +THEN REDA_TAC +THEN STRIP_TAC + THEN POP_ASSUM (fun th-> MP_TAC(ISPECL[`{(v:real^3),(u:real^3)}`;`{(v1:real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] +THEN SUBGOAL_THEN `(v:real^3) IN aff_ge {(x:real^3)} {(v:real^3),(u:real^3)}` ASSUME_TAC +THENL(*1*)[ + MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]AFF_GE_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC `&0:real` + THEN EXISTS_TAC `&1:real` THEN EXISTS_TAC `&0:real` +THEN REWRITE_TAC[VECTOR_ARITH`w= &0 % x+ &1 % w + &0 % v `] THEN REAL_ARITH_TAC; +DISCH_TAC +THEN MP_TAC(SET_RULE`v IN aff_ge {x} {v, u:real^3} /\ v IN aff_ge {x} {v1} ==> v IN aff_ge {x} {v, u} INTER aff_ge {x:real^3} {v1}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`{v, u:real^3} INTER {v1}={} \/ ~({v, u} INTER {v1}={})`) +THENL(*2*)[ +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`aff_ge {x:real^3} {}= {y| ?t1. t1= &1 /\ y= t1 %x}` ASSUME_TAC +THENL(*3*)[ +ASSUME_TAC(SET_RULE `DISJOINT {x:real^3} {}`) +THEN AFF_TAC; +ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[]];(*2*) + +DISJ_CASES_TAC(SET_RULE`~(v IN {v, u} INTER {v1:real^3}) \/ (v IN {v, u} INTER {v1})`) +THENL(*3*)[ +SUBGOAL_THEN`({v:real^3, u} INTER {v1:real^3}={u})` ASSUME_TAC +THENL(*4*)[ + ASM_TAC +THEN SET_TAC[]; +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN` aff_ge {(x:real^3)} {(u:real^3)} SUBSET aff {x,u}` ASSUME_TAC +THENL(*5*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (u:real^3)`;]AFF_GE_1_1) +THEN MP_TAC(SET_RULE`~((x:real^3) = (u:real^3))==> DISJOINT {x} {u}`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[aff;AFFINE_HULL_2] THEN ASM_TAC THEN SET_TAC[]; +FIND_ASSUM MP_TAC`{v,u:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN DISCH_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN ASM_TAC +THEN SET_TAC[]]];(*3*) + +POP_ASSUM MP_TAC +THEN SET_TAC[]]]]) ;; + + + + + +let expand_elements_by_azim_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 x1:real x2:real x3:real. +FAN(x,V,E)/\ {v,u} IN E /\ &0 < x1 /\ &0<= x2 +/\ x2 < &2 * pi +/\ &0< x3 +/\ x3 < pi/ &2 +==> +azim x v u + (x + + (x1 * cos (x2) * sin (x3)) % e1_fan x v u + + (x1 * sin (x2) * sin (x3)) % e2_fan x v u + + (x1 * cos (x3)) % e3_fan x v u) = x2`, + +(let lem=prove(`!x v u. {x,v,u}= {x,u,v}`,SET_TAC[]) in + (let lem1=prove(`!x v u. {x,v,u}= {v,x,u}`,SET_TAC[]) in + +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3 `;`(V:real^3->bool) `; +`(E:(real^3->bool)->bool)`;` u:real^3`;` v:real^3`]remark1_fan) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`~collinear {(x:real^3),(v:real^3),(u:real^3)}` +THEN GEN_REWRITE_TAC( LAND_CONV o ONCE_DEPTH_CONV)[lem1] +THEN ONCE_REWRITE_TAC[COLLINEAR_3] +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]orthonormal_e1_e2_e3_fan) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MP_TAC(th) THEN ASSUME_TAC(th)) +THEN REWRITE_TAC[orthonormal] +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]properties_coordinate) +THEN RESA_TAC +THEN MP_TAC(ISPEC`x3:real`SIN_POS_PI2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`(x + + (x1 * cos (x2) * sin (x3)) % e1_fan x v u + + (x1 * sin (x2) * sin (x3)) % e2_fan x v u + + (x1 * cos (x3)) % e3_fan (x:real^3) (v:real^3) (u:real^3))`; + `((u-x) dot (e3_fan (x:real^3) (v:real^3) (u:real^3))) *inv (norm((v:real^3)-(x:real^3)))`; + `(x1 * cos (x3)) * (inv (norm((v:real^3)-(x:real^3))))`; +`((u-x) dot (e1_fan (x:real^3) (v:real^3) (u:real^3)))`; +`x1 * sin (x3:real)`; +`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`;`&0`;`x2:real`]AZIM_UNIQUE) +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`&0+a=a`;] +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC REAL_LT_MUL +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +STRIP_TAC +THENL[ + +REWRITE_TAC[SIN_0;COS_0;VECTOR_ARITH`(A*B)%C=A%(B%C)`] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN ONCE_REWRITE_TAC[GSYM e3_fan] +THEN MATCH_MP_TAC(ISPECL[`e3_fan (x:real^3) (v:real^3) (u:real^3)`;`(u:real^3)-(x:real^3)`;` +((u - x) dot e1_fan x v u) % (e1_fan (x:real^3) (v:real^3) (u:real^3)) + + ((u - x) dot e3_fan x v u) % (e3_fan x v u)`]CROSS_DOT_CANCEL) +THEN ASM_REWRITE_TAC[DOT_RADD;DOT_RMUL;DOT_SYM] +THEN REDUCE_ARITH_TAC +THEN REWRITE_TAC[CROSS_RADD;CROSS_RMUL;CROSS_REFL] +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]ORTHONORMAL_CROSS) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[e1_fan] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE;e2_fan] +THEN REWRITE_TAC[VECTOR_ARITH`A%(B%C)=(B*A)%C`] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ONCE_REWRITE_TAC[GSYM DOT_RMUL] +THEN ONCE_REWRITE_TAC[GSYM e2_fan] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`&0<(e1_fan x v u cross e2_fan x v u) dot e3_fan (x:real^3) (v:real^3) (u:real^3)` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[DOT_RZERO] +THEN REAL_ARITH_TAC; +REWRITE_TAC[e3_fan] +THEN VECTOR_ARITH_TAC]])));; + + +let one_edge_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ ~(CARD (set_of_edge v V E) > 1) +==> set_of_edge v V E={u}`, +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool) `;`u:real^3 `;`v:real^3`]remark1_fan) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`(u:real^3) IN set_of_edge v V E==> ~(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={})/\ {(u:real^3)} SUBSET set_of_edge v V E`) +THEN RESA_TAC +THEN MP_TAC(ISPECL [`{(u:real^3)}`;`set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)`] FINITE_SUBSET) +THEN RESA_TAC +THEN ASSUME_TAC(SET_RULE`u IN {(u:real^3)} /\ {(u:real^3)} DELETE u= {} /\ {} PSUBSET {(u:real^3)}`) +THEN MP_TAC(ISPECL[`(u:real^3)`;`{(u:real^3)}`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`{}:real^3->bool`;`{(u:real^3)}`]CARD_PSUBSET) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CARD_CLAUSES] +THEN REPEAT DISCH_TAC +THEN MP_TAC(ARITH_RULE` 0 = CARD ({(u:real^3)}) - 1 /\ 0 < CARD ({u}) <=> 1= CARD {u}`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`~(CARD (set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) > 1)==> CARD (set_of_edge v V E) <= 1`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`{u:real^3}`;`set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)`]CARD_SUBSET_LE) +THEN ASM_SET_TAC[]);; + + + + + + +end;; diff --git a/legacy/oldfan/leads_into.hl b/legacy/oldfan/leads_into.hl new file mode 100755 index 0000000..9e87fd9 --- /dev/null +++ b/legacy/oldfan/leads_into.hl @@ -0,0 +1,215 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + + +module Leads_into_fan = struct + + + +open Sphere;; +open Fan_defs;; +open Hypermap_of_fan;; +open Tactic_fan;; +open Lemma_fan;; +open Fan;; +open Hypermap_of_fan;; +open Node_fan;; +open Azim_node;; +open Sum_azim_node;; +open Disjoint_fan;; +open Lead_fan;; + + +(****************************************************************************) +(****************************LEADS INTO**************************************) +(****************************************************************************) + +let dart_leads_into=new_definition`dart_leads_into (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)= +@(U:real^3->bool). ?h:real. &0 (rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) (cos(s)) SUBSET U /\ connected_component (yfan(x,V,E)) y=U))`;; + + + + + + +let exists_leads_into_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3. +FAN(x,V,E)/\ {v,u} IN E +==> +?(U:real^3->bool). ?h:real. &0 (rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) (cos(s)) SUBSET U /\ connected_component (yfan(x,V,E)) y=U))`, +REPEAT STRIP_TAC +THEN MRESA_TAC JGIYDLE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN ASM_TAC +THEN DISCH_TAC +THEN DISCH_TAC +THEN DISCH_THEN (LABEL_TAC "BE") +THEN DISCH_THEN (LABEL_TAC "YEU") +THEN DISCH_TAC +THEN DISCH_TAC +THEN DISCH_THEN (LABEL_TAC "EM") +THEN DISCH_THEN (LABEL_TAC "NHIEU") +THEN MP_TAC(REAL_ARITH`h> &0/\ &1>h ==> -- &1< (h:real)/\ -- &1<= (h:real) /\ h< &1 /\ &0 MRESA1_TAC th `acs(h:real)`) +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[EXTENSION] +THEN REWRITE_TAC[EMPTY;IN;NOT_FORALL_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM IN] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[GSYM FUN_EQ_THM] +THEN EXISTS_TAC`(connected_component (yfan((x:real^3),(V:real^3->bool) ,(E:(real^3->bool)->bool))) (x':real^3)):real^3->bool` +THEN EXISTS_TAC`acs(h:real)` +THEN ASM_REWRITE_TAC[] +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM IN] +THEN DISCH_TAC +THEN ASSUME_TAC(PI_WORKS) +THEN MP_TAC(REAL_ARITH` &0< s /\ acs (h:real)< pi/ &2 /\ &0< pi ==> &0<= (s:real)/\ acs h<= pi`) +THEN RESA_TAC +THEN MRESAL_TAC COS_MONO_LT[`s:real`;`acs(h:real)`][] +THEN MP_TAC(REAL_ARITH` h< cos(s:real)==>h<= cos(s:real)`) +THEN RESA_TAC +THEN REMOVE_THEN "NHIEU"(fun th-> MRESA1_TAC th `acs(h:real)`) +THEN REMOVE_THEN "YEU" (fun th-> MRESA_TAC th[`cos(s:real)`;`h:real`]) +THEN MRESA_TAC CONNECTED_COMPONENT_MAXIMAL [`yfan(x:real^3,(V:real^3->bool),(E:(real^3->bool)->bool))`;`rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) (h:real)`;`x':real^3`] +THEN STRIP_TAC +THENL[ +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; +MATCH_MP_TAC CONNECTED_COMPONENT_EQ +THEN ASM_TAC +THEN SET_TAC[]]);; + + + + +let DART_LEADS_INTO=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3. +FAN(x,V,E)/\ {v,u} IN E +==> +?h:real. &0 (rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) (cos(s)) SUBSET dart_leads_into x V E v u /\ connected_component (yfan(x,V,E)) y=dart_leads_into x V E v u))`, + +REPEAT STRIP_TAC +THEN ONCE_REWRITE_TAC[dart_leads_into] +THEN MRESA_TAC exists_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`] + THEN SELECT_ELIM_TAC +THEN EXISTS_TAC`U:real^3->bool` +THEN EXISTS_TAC`h:real` + THEN ASM_REWRITE_TAC[]);; + + +let unique_dart_leads_into=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 (U:real^3->bool). +FAN(x,V,E)/\ {v,u} IN E +/\(?h:real. &0 (rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) (cos(s)) SUBSET U /\ connected_component (yfan(x,V,E)) y=U))) +==> dart_leads_into x V E v u =U`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN MRESA_TAC DART_LEADS_INTO [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC "BE") +THEN MRESA_TAC JGIYDLE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC "YEU") +THEN DISCH_THEN (LABEL_TAC "EM") +THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC +THEN DISCH_THEN (LABEL_TAC "MAI") +THEN ASSUME_TAC(PI_WORKS) +THEN MP_TAC(REAL_ARITH`&0 +-- &1< (min (min (h:real) (h':real)/ &2) (pi/ &3)) /\ +-- &1<= (min (min (h:real) (h':real)/ &2) (pi/ &3)) /\ + (min (min (h:real) (h':real)/ &2) (pi/ &3))< pi/ &2 /\ + &0 <(min (min (h:real) (h':real)/ &2) (pi/ &3)) /\ + (min (min (h:real) (h':real)/ &2) (pi/ &3))<= pi/ &2 /\ + (min (min (h:real) (h':real)/ &2) (pi/ &3))< h /\ + (min (min (h:real) (h':real)/ &2) (pi/ &3))< h' +`) +THEN RESA_TAC +THEN REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th ` (min (min (h:real) (h':real)/ &2) (pi/ &3))`) +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[EXTENSION] +THEN REWRITE_TAC[EMPTY;IN;NOT_FORALL_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM IN] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[GSYM FUN_EQ_THM] +THEN REMOVE_THEN "BE" (fun th-> MRESA_TAC th[`(min ((min (h:real) (h':real))/ &2) (pi/ &3))`;`x':real^3`]) +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "A" (fun th-> MRESA_TAC th[`(min ((min (h:real) (h':real))/ &2) (pi/ &3))`;`x':real^3`]) +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + +let dart_leads_into_fan_in_topological_component_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3. +FAN(x,V,E)/\ {v,u} IN E +==> dart_leads_into x V E v u IN topological_component_yfan (x,V,E)`, +REPEAT STRIP_TAC +THEN MRESA_TAC not_empty_rw_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC DART_LEADS_INTO[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`;] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC rw_dart_avoids_fan[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"OI") +THEN MP_TAC(REAL_ARITH`&1> h' /\ h' > &0==> -- &1 < h' /\ h'< &1 /\ -- &1 <= h' /\ h'<= &1/\ &0 < h' /\ h' <= &1`) THEN RESA_TAC +THEN MRESA1_TAC ACS_BOUNDS_LT`h':real` +THEN MRESAL_TAC ACS_MONO_LT[`&0`;`h':real`][ACS_0;REAL_ARITH`-- &1 <= &0`] +THEN MRESA1_TAC COS_ACS `h':real` +THEN ABBREV_TAC`h1= min (h:real) (acs h')/ &2` +THEN MP_TAC(REAL_ARITH`h1= min (h:real) (acs h')/ &2 /\ &0 &0< h1 /\ h1< h /\ h1 h'<= cos h1`) THEN RESA_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESAL1_TAC th `h1:real`[SET_RULE`~(A={})<=> ?y. y IN A`]) +THEN REMOVE_THEN "YEU"(fun th-> MRESA_TAC th [`h1:real`;`y:real^3`]) +THEN POP_ASSUM(fun th -> REWRITE_TAC[SYM(th);IN_ELIM_THM;topological_component_yfan;]) +THEN EXISTS_TAC`y:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC continuous_set_fan[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`(cos h1:real)`;`(h':real)`] +THEN ASM_TAC THEN SET_TAC[]);; + + +let connected_dart_leads_into_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3. +FAN(x,V,E)/\ {v,u} IN E +==> connected(dart_leads_into x V E v u )`, +REPEAT STRIP_TAC +THEN MRESA_TAC dart_leads_into_fan_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN MATCH_MP_TAC in_topological_component_yfan_is_connected +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[]);; + + + + +end;; diff --git a/legacy/oldfan/node_fan.hl b/legacy/oldfan/node_fan.hl new file mode 100755 index 0000000..4bea51d --- /dev/null +++ b/legacy/oldfan/node_fan.hl @@ -0,0 +1,645 @@ + +module Node_fan = struct + + +open Sphere;; +open Fan_defs;; +open Tactic_fan;; +open Lemma_fan;; +open Fan;; +open Hypermap_of_fan;; + + + +(* ========================================================================== *) +(* NODE OF HYPERMAP OF FAN (^_^) *) +(* ========================================================================== *) + + + +let CARD_SIGMA_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3). +FAN(x,V,E) ==> +CARD( IMAGE (sigma_fan x V E v) (set_of_edge v V E))= CARD(set_of_edge v V E) +`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN MATCH_MP_TAC CARD_IMAGE_INJ THEN STRIP_TAC +THENL[ +REPEAT GEN_TAC THEN STRIP_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`x':real^3`]properties_of_set_of_edge_fan) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`y:real^3`]properties_of_set_of_edge_fan) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN +ASM_MESON_TAC[MONO_SIGMA_FAN]; +POP_ASSUM MP_TAC THEN REWRITE_TAC[FAN;fan1] THEN MESON_TAC[remark_finite_fan1]]);; + +let MONO_AZIM_SIGMA_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3). +FAN(x,V,E) /\ ({v,u} IN E) +/\ ({v,w} IN E) /\ ~(sigma_fan x V E v w =u) +==> (azim x v u w <= azim x v u (sigma_fan x V E v w))`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT(POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"1") +THEN USE_THEN "1" MP_TAC THEN REWRITE_TAC[FAN;fan6] +THEN REPEAT STRIP_TAC +THEN REPEAT(POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"1") THEN +DISCH_THEN (LABEL_TAC"a") THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_THEN(LABEL_TAC "b") + THEN REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (u:real^3)`;` (v:real^3)`]properties_of_graph) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN DISJ_CASES_TAC(SET_RULE`({(w:real^3)}=set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) \/ ~({(w:real^3)}=set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))`) +THENL(*1*)[ +ASM_REWRITE_TAC[sigma_fan] THEN REAL_ARITH_TAC;(*1*) + +DISJ_CASES_TAC(SET_RULE`((u:real^3)=(w:real^3))\/ ~(u=w)`) +THENL (*2*)[ + +ASM_REWRITE_TAC[AZIM_REFL] THEN MESON_TAC[azim];(*2*) + +DISJ_CASES_TAC(SET_RULE`(azim (x:real^3) (v:real^3) (u:real^3) (w:real^3) <= azim (x:real^3) (v:real^3) (u:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) ) \/ ~(azim (x:real^3) (v:real^3) (u:real^3) (w:real^3) <= azim (x:real^3) (v:real^3) (u:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) )`) + THENL (*3*)[ +ASM_REWRITE_TAC[];(*3*) + +SUBGOAL_THEN`azim (x:real^3) (v:real^3) (u:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) +<= azim (x:real^3) (v:real^3) (u:real^3) (w:real^3) ` ASSUME_TAC +THENL(*4*)[ +POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*4*) + +MP_TAC(ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (u:real^3)`]properties_of_set_of_edge) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN +MP_TAC(ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (w:real^3)`]properties_of_set_of_edge) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`]SIGMA_FAN) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "c") THEN + SUBGOAL_THEN `{(u:real^3),(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)),(w:real^3)}SUBSET set_of_edge v V E` ASSUME_TAC +THENL(*5*)[ +ASM_TAC THEN SET_TAC[];(*5*) + +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`]CYCLIC_SET_EDGE_FAN) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;`{(u:real^3), (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)),(w:real^3)}`;`set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)` ]subset_cyclic_set_fan) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`;` (w:real^3)`]sum2_azim_fan) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN SUBGOAL_THEN `azim (x:real^3) (v:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) (w:real^3)<= azim x v u w` ASSUME_TAC + +THENL(*6*)[ +MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3`; `sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)`]azim) THEN REPEAT(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC;(*6*) + +POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[])THEN ASM_REWRITE_TAC[] THEN +MP_TAC (ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`]properties_of_set_of_edge) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN REMOVE_THEN "b" (fun th->MP_TAC (ISPEC`{(v:real^3),(w:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(u:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))}`th) THEN ASSUME_TAC(th)) + THEN REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] +THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] + THEN + DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (w:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))= &0) \/ ~(azim (x:real^3) (v:real^3) (w:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) = &0)`) +THENL(*7*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`]UNIQUE_AZIM_0_POINT_FAN) +THEN ASM_TAC THEN SET_TAC[];(*7*) + +DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (w:real^3) (u:real^3)= &0) \/ ~(azim (x:real^3) (v:real^3) (w:real^3) (u:real^3) = &0)`) + +THENL(*8*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;`(u:real^3)`]UNIQUE_AZIM_0_POINT_FAN) +THEN ASM_TAC THEN SET_TAC[];(*8*) + +MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;`w:real^3`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`]AZIM_COMPL) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (w:real^3)`;` (u:real^3)`]AZIM_COMPL) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`&2 * pi - a<= &2 * pi - (b:real) <=> b<= (a:real)`] + THEN REMOVE_THEN "c" (fun th -> MP_TAC(ISPEC `u:real^3` th) ) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN STRIP_TAC + THEN SUBGOAL_THEN `azim (x:real^3) (v:real^3) (w:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) = azim x v w u` ASSUME_TAC + +THENL(*9*)[ +POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*9*) + +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`;`u:real^3`]UNIQUE_AZIM_POINT_FAN) + THEN ASM_REWRITE_TAC[]]]]]]]]]]);; + + + + +let MONO_POWER_SIGMA_FAN=prove(`!(i:num) (j:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ ({v,u} IN E)/\(j u=power_map_points sigma_fan x V E v u (i-j)`, +INDUCT_TAC THENL +[ARITH_TAC; + +INDUCT_TAC THENL +[REWRITE_TAC[ARITH_RULE `SUC i- 0 =SUC (i:num)`;power_map_points] THEN ASM_TAC THEN SET_TAC[]; + +REWRITE_TAC[ARITH_RULE `SUC (i:num)-SUC (j:num)= i - j`; ARITH_RULE `SUC(j:num) < SUC (i) <=> j < i`;power_map_points] + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "a") THEN DISCH_TAC + THEN REPEAT GEN_TAC THEN STRIP_TAC THEN + MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;` (u:real^3)`]properties_of_set_of_edge_fan) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN MP_TAC(ISPECL[`(i:num)`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]image_power_map_points) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(j:num)`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]image_power_map_points) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`]properties_of_set_of_edge_fan) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (j:num)`]properties_of_set_of_edge_fan) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN MP_TAC(ISPECL[` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`;`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (j:num)`]MONO_SIGMA_FAN) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN REMOVE_THEN "a"(fun th-> MP_TAC(ISPECL[`(j:num) `;`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]th)) + THEN ASM_REWRITE_TAC[]]]);; + + + + + + +let MONO_POWER_MAP_POINTS1_FAN=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ (u IN set_of_edge v V E) /\ ~(set_of_edge v V E={u}) +==> ~(power_map_points (sigma_fan) x V E v u i=power_map_points (sigma_fan) x V E v u (SUC i)) +`, +INDUCT_TAC THENL[ +REWRITE_TAC[power_map_points] THEN REPEAT GEN_TAC THEN STRIP_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]SIGMA_FAN) THEN ASM_MESON_TAC[]; +REPEAT GEN_TAC THEN POP_ASSUM + (fun th-> MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]th))THEN REWRITE_TAC[power_map_points] + THEN STRIP_TAC THEN STRIP_TAC THEN REPEAT(POP_ASSUM MP_TAC) +THEN DISCH_THEN (LABEL_TAC "a") THEN DISCH_THEN (LABEL_TAC "b") +THEN USE_THEN "b" MP_TAC THEN REWRITE_TAC[FAN] +THEN STRIP_TAC +THEN DISCH_TAC THEN DISCH_TAC +THEN REMOVE_THEN "a" MP_TAC THEN MP_TAC(ARITH_RULE `SUC (i:num)< CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))==> i < CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))`) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC MONO_NOT THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(i:num)`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]image_power_map_points) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC +THEN MP_TAC(ISPECL[`SUC (i:num)`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]image_power_map_points) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[` (v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))`] properties_of_set_of_edge) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[` (v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (SUC (i:num)))`] properties_of_set_of_edge) + THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`;`sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))`]MONO_SIGMA_FAN) +THEN ASM_MESON_TAC[]]);; + + + + + + + + + +let set_of_orbits_points_fan = new_definition `set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) = {power_map_points sigma_fan x V E v u i| 0<=i }`;; + +let number_of_orbits_fan = new_definition `number_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) = CARD(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))`;; + + + +let addition_sigma_fan = prove(`!(m:num) (n:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +power_map_points sigma_fan x V E v u (m + n) = (power_map_points sigma_fan x V E v (power_map_points sigma_fan x V E v u n) m) `, +INDUCT_TAC +THENL [ +REWRITE_TAC[power_map_points; ARITH_RULE`0 + n:num =n`]; +REWRITE_TAC[ARITH_RULE` SUC (m:num) + n= SUC(m+n)`; power_map_points] THEN REPEAT GEN_TAC + THEN POP_ASSUM(ASSUME_TAC o GSYM o (ISPECL[`(n:num) `;`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`])) + THEN ASM_TAC THEN SET_TAC[]]);; + + + + + + +let fix_point_sigma_fan=prove(`! (q:num) (i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +(power_map_points (sigma_fan) x V E v u i=u) +==>power_map_points sigma_fan x V E v u (q * i)=u +`, +INDUCT_TAC THENL[ +ASM_REWRITE_TAC[ARITH_RULE`0 * i:num = 0`;power_map_points]; +REWRITE_TAC[ARITH_RULE`SUC q * i:num= q * i + i`] THEN REPEAT GEN_TAC THEN + POP_ASSUM(MP_TAC o (ISPECL[`(i:num) `;`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`])) + THEN DISCH_THEN(LABEL_TAC "a") THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[addition_sigma_fan]]);; + +let i_IN_ORBITS_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num). + power_map_points (sigma_fan) x V E v u i IN set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`, +REWRITE_TAC[set_of_orbits_points_fan; IN_ELIM_THM] THEN REPEAT GEN_TAC THEN EXISTS_TAC`i:num` THEN REWRITE_TAC[power_map_points] THEN SIMP_TAC[] THEN ARITH_TAC);; + +let u_IN_ORBITS_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . + u IN set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`, +REWRITE_TAC[set_of_orbits_points_fan; IN_ELIM_THM] THEN REPEAT GEN_TAC THEN EXISTS_TAC`0` THEN REWRITE_TAC[power_map_points] THEN SIMP_TAC[] THEN ARITH_TAC);; + + +let IN_ORBITS_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3). + w IN set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) +==> sigma_fan x V E v w IN set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`, + +REPEAT GEN_TAC THEN REWRITE_TAC[set_of_orbits_points_fan; IN_ELIM_THM] THEN STRIP_TAC THEN EXISTS_TAC`SUC i` THEN ASM_REWRITE_TAC[power_map_points] THEN ARITH_TAC);; + + +let ORBITS_SUBSET_EDGE_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ ({v,u} IN E) +==> set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) +SUBSET set_of_edge v V E`, +REPEAT GEN_TAC THEN STRIP_TAC + THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;` (u:real^3)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[set_of_orbits_points_fan;SUBSET; IN_ELIM_THM] THEN DISCH_TAC THEN GEN_TAC THEN STRIP_TAC +THEN MP_TAC(ISPECL[`(i:num)`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]image_power_map_points) THEN ASM_REWRITE_TAC[]);; + + +let CARD_ORBITS_EDGE_FAN_LE=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ ({v,u} IN E) +==> CARD(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) ) +<=CARD( set_of_edge v V E)`, +REPEAT GEN_TAC THEN STRIP_TAC + THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;` (u:real^3)`]ORBITS_SUBSET_EDGE_FAN) + THEN ASM_REWRITE_TAC[] THEN REPEAT (POP_ASSUM MP_TAC) +THEN REWRITE_TAC[FAN;fan1] THEN REPEAT STRIP_TAC + THEN MP_TAC(ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`] remark_finite_fan1) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(ISPECL[`set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`;`set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)`]CARD_SUBSET) + THEN ASM_REWRITE_TAC[]);; + + + + +let FINITE_ORBITS_SIGMA_FAN=prove( `!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ ({v,u} IN E) +==> FINITE(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) `, + +REPEAT GEN_TAC THEN DISCH_TAC THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;` (u:real^3)`] ORBITS_SUBSET_EDGE_FAN)THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[FAN;fan1] THEN STRIP_TAC + THEN MP_TAC(ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`] remark_finite_fan1) + THEN ASM_REWRITE_TAC[] THEN MESON_TAC[FINITE_SUBSET]);; + + + +let ORBITS_SIGMA_FAN=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ ({v,u} IN E)/\ +(power_map_points (sigma_fan) x V E v u i=u) /\ ~(i=0) +==> set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) = +{power_map_points sigma_fan x V E v u j| j < i } +`, +REPEAT STRIP_TAC THEN REWRITE_TAC[set_of_orbits_points_fan; EXTENSION; IN_ELIM_THM] +THEN GEN_TAC THEN EQ_TAC +THENL [ +STRIP_TAC THEN ASM_REWRITE_TAC[] THEN +FIND_ASSUM (MP_TAC o (SPEC `i':num`) o MATCH_MP DIVMOD_EXIST) `~(i:num = 0)` + THEN REPEAT STRIP_TAC + THEN EXISTS_TAC`r:num` THEN ASM_REWRITE_TAC[ARITH_RULE`q * (i:num) + r = r+ q * i`;addition_sigma_fan] + THEN MP_TAC (SPECL [`(q:num)`;` (i:num)`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3)`]fix_point_sigma_fan) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[]; + +STRIP_TAC THEN EXISTS_TAC `j:num` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC]);; + +(***********lemmas in hypermap.ml***************) + + +let IMAGE_SEG = prove(`!(n:num) (f:num->A). IMAGE f {i:num | i < n:num} = {f (i:num) | i < n}`, + REPEAT STRIP_TAC + THEN REWRITE_TAC[IMAGE; IN_ELIM_THM] THEN ASM_SET_TAC[]);; + +let FINITE_SERIES = prove(`!(n:num) (f:num->A). FINITE {f(i) | i < n}`, + REPEAT GEN_TAC + THEN ONCE_REWRITE_TAC[SYM(SPECL[`n:num`; `f:num->A`] IMAGE_SEG)] + THEN MATCH_MP_TAC FINITE_IMAGE + THEN REWRITE_TAC[FINITE_NUMSEG_LT]);; + +let CARD_FINITE_SERIES_LE = prove(`!(n:num) (f:num->A). CARD {f(i) | i < n} <= n`, + REPEAT GEN_TAC + THEN ONCE_REWRITE_TAC[SYM(SPECL[`n:num`; `f:num->A`] IMAGE_SEG)] + THEN MP_TAC(ISPEC `f:num ->A` (MATCH_MP CARD_IMAGE_LE (SPEC `n:num` FINITE_NUMSEG_LT))) + THEN REWRITE_TAC[CARD_NUMSEG_LT]);; + +let LEMMA_INJ = prove(`!(n:num) (f:num->A).(!i:num j:num. i < n /\ j < i ==> ~(f i = f j)) ==> (!i:num j:num. i < n /\ j < n /\ f i = f j ==> i = j)`, + REPEAT GEN_TAC + THEN DISCH_TAC THEN MATCH_MP_TAC WLOG_LT + THEN STRIP_TAC THENL[ARITH_TAC; ALL_TAC] + THEN STRIP_TAC THENL[MESON_TAC[]; ALL_TAC] + THEN ASM_MESON_TAC[]);; + +let CARD_FINITE_SERIES_EQ = prove(`!(n:num) (f:num->A). (!i:num j:num. i < n /\ j < i ==> ~(f i = f j)) ==> CARD {f(i) | i < n} = n`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1" o MATCH_MP LEMMA_INJ) + THEN ONCE_REWRITE_TAC[GSYM IMAGE_SEG] + THEN GEN_REWRITE_TAC(RAND_CONV o ONCE_DEPTH_CONV) [GSYM (SPEC `n:num` CARD_NUMSEG_LT)] + THEN MATCH_MP_TAC CARD_IMAGE_INJ + THEN REWRITE_TAC[FINITE_NUMSEG_LT] + THEN REWRITE_TAC[IN_ELIM_THM] + THEN ASM_REWRITE_TAC[]);; + + + +(**************************************) + + +let CARD_ORBITS_SIGMA_FAN_LE=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ ({v,u} IN E)/\ +(power_map_points (sigma_fan) x V E v u i=u) /\ ~(i=0) +==> CARD(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))<=i`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN MP_TAC(ISPECL[`(i:num)`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]ORBITS_SIGMA_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ISPECL[`i:num`;`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`]CARD_FINITE_SERIES_LE) THEN ASM_TAC THEN SET_TAC[]);; + + + + +let exists_inverse_in_orbits_sigma_fan=prove(` +!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (y:real^3). + FAN(x,V,E) /\({v,u} IN E)/\ ~(y IN set_of_orbits_points_fan x V E v u) +==> +(?(w:real^3). (w IN (set_of_orbits_points_fan x V E v u)) /\ ~(w=y) /\ +(!(w1:real^3). (w1 IN (set_of_orbits_points_fan x V E v u))/\ ~(w1=y) ==> azim1 x v y w <= azim1 x v y w1)) +`, + +(let lemma = prove + (`!X:real->bool. + FINITE X /\ ~(X = {}) + ==> ?a. a IN X /\ !x. x IN X ==> a <= x`, + MESON_TAC[INF_FINITE]) in + +MP_TAC(lemma) THEN DISCH_THEN(LABEL_TAC "a") THEN REPEAT GEN_TAC +THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "ba") +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` (u:real^3)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;` (u:real^3)`]FINITE_ORBITS_SIGMA_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +SUBGOAL_THEN `FINITE ((set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) (v:real^3) (u:real^3) DELETE (y:real^3))` ASSUME_TAC +THENL[(*1*) + +ASM_MESON_TAC[FINITE_DELETE_IMP];(*1*) +DISJ_CASES_TAC(SET_RULE`(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) DELETE (y:real^3)={})\/ + ~(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) DELETE (y:real^3)={})`) +THENL(*2*)[ +MP_TAC (ISPECL[`y:real^3`;`set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`]DELETE_NON_ELEMENT) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;` (u:real^3)`]u_IN_ORBITS_FAN) + THEN ASM_TAC THEN SET_TAC[];(*2*) +SUBGOAL_THEN`~(IMAGE ( azim1 x v y) (set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) DELETE (y:real^3))={})` ASSUME_TAC +THENL(*3*)[ +REWRITE_TAC[IMAGE_EQ_EMPTY] THEN ASM_MESON_TAC[];(*3*) + +SUBGOAL_THEN` FINITE (IMAGE (azim1 x v y) (set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) DELETE (y:real^3)))` ASSUME_TAC +THENL(*4*)[ +ASM_MESON_TAC[FINITE_IMAGE];(*4*) + +REMOVE_THEN "a" (fun th ->MP_TAC(ISPEC `(IMAGE (azim1 x v y) (set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) DELETE (y:real^3)))` th)) + THEN ASM_REWRITE_TAC[IMAGE;DELETE;IN_ELIM_THM]THEN STRIP_TAC +THEN EXISTS_TAC`x':real^3` + THEN ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[]]]]]));; + + + + + + + + +let key_lemma_cyclic_fan=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ (0 < i) /\(i< CARD(set_of_edge v V E)) /\ ({v,u} IN E) +==> ~(power_map_points (sigma_fan) x V E v u i=u) +`, +INDUCT_TAC +THENL(*1*)[ARITH_TAC;(*1*) +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[power_map_points] THEN +MP_TAC(ISPECL[` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]ORBITS_SUBSET_EDGE_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN DISJ_CASES_TAC(SET_RULE`(sigma_fan x V E v (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))= u)\/ ~(sigma_fan x V E v (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))= u)`) +THENL(*2*)[ +ASM_REWRITE_TAC[] THEN MP_TAC(ISPECL[`SUC (i:num)`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]CARD_ORBITS_SIGMA_FAN_LE) + THEN ASM_REWRITE_TAC[power_map_points; ARITH_RULE`~(SUC i = 0)`] THEN STRIP_TAC + THEN SUBGOAL_THEN `CARD(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) PSUBSET set_of_edge v V E` ASSUME_TAC +THENL(*4*)[ +ASM_REWRITE_TAC[PSUBSET] THEN DISJ_CASES_TAC(SET_RULE`(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) = set_of_edge v V E)\/ ~(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) = set_of_edge v V E)`) +THENL(*5*)[ +SUBGOAL_THEN`CARD(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) =CARD( set_of_edge v V E)`ASSUME_TAC +THENL(*6*)[ +POP_ASSUM(fun th->REWRITE_TAC[th]);(*6*) +POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC](*6*);(*5*) + +POP_ASSUM(fun th->REWRITE_TAC[th])](*5*);(*4*) + + +POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[PSUBSET_MEMBER] THEN STRIP_TAC + THEN MP_TAC(ISPECL[` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;`y:real^3`] +exists_inverse_in_orbits_sigma_fan) + THEN ASM_REWRITE_TAC[] THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={(u:real^3)})\/ ~(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={(u:real^3)})`) +THENL(*5*)[ +POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") + THEN DISCH_THEN(LABEL_TAC "b") THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[IN_SING] THEN DISCH_TAC + THEN REMOVE_THEN "b" MP_TAC THEN ASM_REWRITE_TAC[u_IN_ORBITS_FAN];(*5*) + +ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN +DISJ_CASES_TAC(SET_RULE`(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={(w:real^3)})\/ ~(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={(w:real^3)})`) +THENL(*6*)[ + +POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") + THEN DISCH_THEN(LABEL_TAC "b") THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[IN_SING] THEN DISCH_TAC + THEN REMOVE_THEN "b" MP_TAC THEN ASM_REWRITE_TAC[];(*6*) + +MP_TAC(ISPECL[` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`u:real^3`;` (w:real^3)`]IN_ORBITS_FAN) + THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC THEN STRIP_TAC +THEN POP_ASSUM(fun th->MP_TAC(ISPEC `sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)` th)) + THEN ASM_REWRITE_TAC[] + THEN DISJ_CASES_TAC(SET_RULE`sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)=(y:real^3) \/ ~(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)=(y:real^3))`) +THENL(*7*)[ +POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC + THEN ASM_REWRITE_TAC[];(*7*) + +ASM_REWRITE_TAC[azim1;REAL_ARITH` (a:real) - b <= a - c <=> c<=b`] THEN STRIP_TAC +THEN +SUBGOAL_THEN `sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) IN set_of_edge v V E` ASSUME_TAC +THENL(*8*)[ + ASM_TAC THEN SET_TAC[];(*8*) + +SUBGOAL_THEN `(w:real^3) IN set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)` ASSUME_TAC +THENL(*9*)[ + ASM_TAC THEN SET_TAC[];(*9*) + +SUBGOAL_THEN `{(y:real^3),sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3),(w:real^3)} SUBSET set_of_edge v V E` ASSUME_TAC + +THENL(*10*)[ + ASM_TAC THEN SET_TAC[];(*10*) + +FIND_ASSUM(MP_TAC)`FAN((x:real^3),V,E)` THEN REWRITE_TAC[FAN;fan6] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "b") THEN STRIP_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (u:real^3)`;` (v:real^3)`]properties_of_graph) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`]CYCLIC_SET_EDGE_FAN) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;`{(y:real^3),sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3),(w:real^3)}`;`set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)` ]subset_cyclic_set_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`y:real^3`;`sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)`;`w:real^3`]sum2_azim_fan) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`y:real^3`;`sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)`]azim) +THEN STRIP_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `azim (x:real^3) (v:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) (w:real^3) <= azim (x:real^3) (v:real^3) (y:real^3) (w:real^3)` +ASSUME_TAC +THENL(*11*)[ +REPEAT(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC;(*11*) + +POP_ASSUM MP_TAC THEN POP_ASSUM(fun th ->REWRITE_TAC[]) THEN ASM_REWRITE_TAC[] THEN +MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` (y:real^3)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` (w:real^3)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (w:real^3) (y:real^3)= &0) \/ ~(azim (x:real^3) (v:real^3) (w:real^3) (y:real^3) = &0)`) +THENL(*12*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;`(y:real^3)`]UNIQUE_AZIM_0_POINT_FAN) +THEN ASM_REWRITE_TAC[];(*12*) + +DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (w:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))= &0) \/ ~(azim (x:real^3) (v:real^3) (w:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) = &0)`) +THENL(*13*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`; ` (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))` ]UNIQUE_AZIM_0_POINT_FAN) + THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`] SIGMA_FAN) + THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN SET_TAC[];(*13*) + + REMOVE_THEN "b" (fun th->MP_TAC (ISPEC`{(v:real^3),(w:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(y:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))}`th) THEN ASSUME_TAC(th)) + THEN REWRITE_TAC[SET_RULE`{(a:real^3)} UNION {b,c}={a,b,c}`] THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;`(w:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`]AZIM_COMPL) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (w:real^3)`;` (y:real^3)`]AZIM_COMPL) THEN +ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[REAL_ARITH`(a - (b:real) <= (a:real)- (c:real))<=> c <= b`] + THEN STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`; `(w:real^3)`] SIGMA_FAN) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(y:real^3)`th)) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN SUBGOAL_THEN`azim (x:real^3) (v:real^3) (w:real^3) (y:real^3) = azim x v w (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))` ASSUME_TAC +THENL(*14*)[ +POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*14*) + +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`(w:real^3)`;` (y:real^3)`; ` (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))` ]UNIQUE_AZIM_POINT_FAN) + THEN ASM_REWRITE_TAC[] + +]]]]]]]]]]]]; +ASM_REWRITE_TAC[]]]);; + + + + + +let cyclic_power_sigma_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) (j:num). +FAN(x,V,E) /\ (i< CARD(set_of_edge v V E)) /\ (j ~(power_map_points (sigma_fan) x V E v u i= power_map_points (sigma_fan) x V E v u j) +`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN STRIP_TAC THEN +MP_TAC(ISPECL[`(i:num)`;` (j:num)`;` (x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]MONO_POWER_SIGMA_FAN) + THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE` j < i ==> 0 < (i:num)-(j:num)`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ARITH_RULE` (j:num) <(i:num)==> i-j <= i`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ARITH_RULE` (i :num )-(j:num) <= i /\ i< CARD(set_of_edge (v:real^3)(V:real^3->bool) (E:(real^3->bool)->bool))==> i-j bool) (E:(real^3->bool)->bool))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(i:num)-(j:num)`;` (x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]key_lemma_cyclic_fan) + THEN ASM_REWRITE_TAC[] THEN MESON_TAC[]);; + + + + + +let CARD_SET_OF_ORBITS_POINTS_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ ({v,u} IN E) +==> CARD(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))= CARD(set_of_edge v V E)`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN +SUBGOAL_THEN`{power_map_points (sigma_fan) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) |i| (i< CARD(set_of_edge v V E))} +SUBSET set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) +`ASSUME_TAC +THENL[ REWRITE_TAC[set_of_orbits_points_fan;SUBSET;IN_ELIM_THM] + THEN GEN_TAC THEN STRIP_TAC THEN EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC; + +SUBGOAL_THEN`CARD {power_map_points (sigma_fan) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) |i| (i< CARD(set_of_edge v V E))} +<= CARD (set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))` +ASSUME_TAC +THENL[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] FINITE_ORBITS_SIGMA_FAN) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`{power_map_points (sigma_fan) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) |i| (i< CARD(set_of_edge v V E))}`;`set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`]CARD_SUBSET) THEN ASM_REWRITE_TAC[]; + +MP_TAC(SPECL[`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]cyclic_power_sigma_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))`;`power_map_points (sigma_fan) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`]CARD_FINITE_SERIES_EQ) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]CARD_ORBITS_EDGE_FAN_LE) + THEN ASM_REWRITE_TAC[] THEN REPEAT (POP_ASSUM MP_TAC) THEN ARITH_TAC]]);; + + +let ORBITS_EQ_SET_EDGE_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ ({v,u} IN E) +==> +set_of_edge v V E += set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`, + +REWRITE_TAC[SET_RULE`(set_of_edge v V E += set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))<=> (set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)= set_of_edge v V E) `] THEN +REPEAT STRIP_TAC THEN MATCH_MP_TAC CARD_SUBSET_EQ THEN +STRIP_TAC THENL[REPEAT (POP_ASSUM MP_TAC) THEN REWRITE_TAC[FAN;fan1] THEN MESON_TAC[remark_finite_fan1]; +ASM_MESON_TAC[ORBITS_SUBSET_EDGE_FAN;CARD_SET_OF_ORBITS_POINTS_FAN]]);; + + +let SIMP_ORBITS_POINTS_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ ({v,u} IN E) +==> +{power_map_points (sigma_fan) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) |i| (i< CARD(set_of_edge v V E))} += set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) +`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN`{power_map_points (sigma_fan) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) |i| (i< CARD(set_of_edge v V E))} +SUBSET set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) +`ASSUME_TAC +THENL[ + REWRITE_TAC[set_of_orbits_points_fan;SUBSET;IN_ELIM_THM] + THEN GEN_TAC THEN STRIP_TAC THEN EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC; + +POP_ASSUM MP_TAC THEN MP_TAC(SPECL[`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]cyclic_power_sigma_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))`;`power_map_points (sigma_fan) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`]CARD_FINITE_SERIES_EQ) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"a") + THEN MP_TAC(SPECL[`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]CARD_SET_OF_ORBITS_POINTS_FAN) THEN ASM_REWRITE_TAC[SET_RULE`a=b<=> b=a`] THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] FINITE_ORBITS_SIGMA_FAN) THEN ASM_REWRITE_TAC[] + THEN MESON_TAC[CARD_SUBSET_EQ]]);; + + +let ORDER_POWER_SIGMA_FAN=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ (i=CARD(set_of_edge v V E)) /\ ({v,u} IN E) +==> power_map_points (sigma_fan) x V E v u i= u +`, +REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `power_map_points (sigma_fan) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) IN set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)` ASSUME_TAC +THENL[ + REWRITE_TAC[ set_of_orbits_points_fan; IN_ELIM_THM] THEN EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC; + +POP_ASSUM MP_TAC THEN MP_TAC(SPECL[`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]SIMP_ORBITS_POINTS_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th);]) THEN REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))`;`i':num`;`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]MONO_POWER_SIGMA_FAN) THEN ASM_REWRITE_TAC[] + THEN DISJ_CASES_TAC(ARITH_RULE`(0<(i':num))\/ i'=0`) +THENL[ +DISCH_TAC THEN +MP_TAC(ARITH_RULE`0 < (i':num)/\ i'< CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) ==> (CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))- (i':num) < CARD (set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ARITH_RULE`(i':num)< CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))==> 0< CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))-i'`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN +MP_TAC(ISPECL[`CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))-(i':num)`; `(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]key_lemma_cyclic_fan) + THEN ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]; + +ASM_REWRITE_TAC[power_map_points]]]);; + + + + + + + +end;; diff --git a/legacy/oldhypermap/ch_hypermap/hypermap_summary.hl b/legacy/oldhypermap/ch_hypermap/hypermap_summary.hl new file mode 100644 index 0000000..2974b5a --- /dev/null +++ b/legacy/oldhypermap/ch_hypermap/hypermap_summary.hl @@ -0,0 +1,52 @@ +(* summary of hypermap.ml file *) + +permutes;; + +(* `orbit_map f x` set of iterates of x under f. *) +exist_hypermap;; (* existence theorem for hypermap type *) +hypermap_tybij;; (* type construction of hypermap *) +dart;; (* extracts darts *) +edge_map;; (* extracts edge_map *) +node_map;; (* extracts node_map *) +face_map;; (* extracts face_map *) + +edge;; (* orbit under edge map *) +node;; (* orbit under node map *) +face ;; (* orbit under face map *) + +(* paths done by a new recursive definition *) +comb_component;; (* combinatorial component *) +set_of_orbits;; (* of a permutation f *) +number_of_orbits;; (* cardinality *) + +edge_set;; (* set of all edges *) +node_set;; +face_set;; +set_of_components;; (* set of all combinatorial components *) + +number_of_edges;; +number_of_nodes;; +number_of_faces;; +number_of_components;; + +plain_hypermap;; +planar_hypermap;; +simple_hypermap;; + +dart_degenerate;; +dart_nondegenerate;; + +connected_hypermap;; + +edge_path;; (* `edge_path H x i = e^i x` *) +node_path;; +face_path;; + +(* contour path stuff.... *) + +shift;; (* rotates e,n,f by triality *) + +(* walkup transformations *) + + +iso;; (* isomorphism of hypermap *) diff --git a/legacy/oldleg/assembly.ml b/legacy/oldleg/assembly.ml new file mode 100644 index 0000000..33d711b --- /dev/null +++ b/legacy/oldleg/assembly.ml @@ -0,0 +1,1072 @@ +(* Main estimate file*) +(* Author: PHAN HOANG CHON *) +(*========================================================*) + +(* +needs "database_more.ml";; +needs "definitions_kepler.ml";; +(* removed convex.ml by thales, not compatible with other loads *) +(* needs "Multivariate/convex.ml";; *) +needs "geomdetail.ml";; (* Writen by Nguyen Quang TRuong *) +*) + +(*========================================================*) +(* These definitions are defined by other authors*) +(*========================================================*) +(*Some constant*) + +(*arctan2 function is defined in definition_kepler.ml*) + +let delta_tet = new_definition (`delta_tet = sqrt8 * atn2(&5, sqrt2)`);; + +let delta_oct = new_definition (`delta_oct = (( &3* pi_rt18 - delta_tet)*( &1 / &2 ))`);; + +(*========================================================*) + +let lambda_v = new_definition (`lambda_v = (-- &4)* delta_oct `);; + +let lambda_s = new_definition (`lambda_s = (&1)/(&3) `);; + +let lambda_oct = new_definition (`lambda_oct = (lambda_v , lambda_s) `);; + +(*========================================================*) + +(* benign redefinition *) +let open_ball = new_definition `open_ball (x:real^3) (r:real)= { y | norm(y-x)< r }`;; + + + +(*========================================================*) + +(* There is a mistake in this definition. For example: let d={x,y,z,t} be a quarter with 2*t0= &2 * t0 ))`;; +*) + +(*========================================================*) + +(* benign redef *) +let diag = new_definition ` diag d q s = ( quarter q s /\ + ( ? x y. + ! v1 v2. + x IN q /\ y IN q /\ + v1 IN q /\ v2 IN q /\ + { x, y } = d /\ d3 x y >= &2 * t0 /\ + d3 x y >= d3 v1 v2 ))`;; + +(* benign *) +let find_diagonal = new_definition ` find_diagonal q s:real^3->bool = @{x, y}. {x , y} SUBSET q /\ diag {x , y} q s `;; + +let find_dia = new_definition ` find_dia q (s:real^3->bool) = + let d = find_diagonal q s in + @(u,v). u IN d /\ v IN d /\ ~( u = v ) `;; + +(* thales, nov 11. anchor is already defined in geomdetail.ml *) +let anchor_alt = new_definition ` anchor_alt (v:real^3) v1 v2 = ( d3 v1 v2 <= sqrt ( &8 ) /\ + d3 v1 v2 >= &2 * t0 /\ d3 v v1 <= &2 * t0 /\ d3 v v2 <= &2 * t0 )`;; + +(* Definition 7.20 =============================================*) + +let context = new_definition ` context (v , w) s (p:num, r) = ( + CARD { d | diag { v , w } d s } = p /\ + CARD { t | &2 * t0 <= d3 v w /\ anchor_alt t v w } = (p + r ))`;; + +let cotext = new_definition ` cotext (v , w) (s:real^3->bool) = @( (p:num) , (r:num) ). + CARD { d | diag { v , w } d s } = p /\ + CARD { t | &2 * t0 <= d3 v w /\ anchor_alt t v w } = (p + r )`;; + +(* Definition 7.21 =============================================*) + +let VC1 = new_definition ` VC1 v s d = VC v d INTER conv s `;; + +let VCt = new_definition ` VCt x t s d + = VC1 x s d INTER open_ball x t `;; + +(* Definition 7.22 =============================================*) + +let sv = new_definition ` sv x p d = lambda_v * vol(VC1 x p d) + lambda_s * solid x (conv0 p) `;; + +let gamma = new_definition ` gamma (v1 , v2 , v3 , v4) d = + ( &1 / &4 ) * ( sv v1 { v1 , v2 , v3 , v4 } d + + sv v2 { v1 , v2 , v3 , v4 } d + + sv v3 { v1 , v2 , v3 , v4 } d + + sv v4 { v1 , v2 , v3 , v4 } d )`;; + +let volan = new_definition ` volan v0 (v0 , v1, v2, v3 ) = + let x01 = dist(v0,v1) pow 2 in + let x02 = dist(v0,v2) pow 2 in + let x03 = dist(v0,v3) pow 2 in + let x12 = dist(v1,v2) pow 2 in + let x13 = dist(v1,v3) pow 2 in + let x23 = dist(v2,v3) pow 2 in + ( x01 * ( x02 + x12 - x01 ) * ( chi_x x23 x13 x03 x01 x02 x12 ) ) / + ( &48 * (ups_x x01 x02 x12) * sqrt( delta_x x01 x02 x03 x23 x13 x12 )) + + ( x01 * ( x03 + x13 - x01 ) * ( chi_x x23 x12 x02 x01 x03 x13 ) ) / + ( &48 * (ups_x x01 x03 x13) * sqrt( delta_x x01 x02 x03 x23 x13 x12 )) + + ( x02 * ( x01 + x12 - x02 ) * ( chi_x x13 x23 x03 x02 x01 x12 ) ) / + ( &48 * (ups_x x02 x01 x12) * sqrt( delta_x x01 x02 x03 x23 x13 x12 )) + + ( x01 * ( x03 + x23 - x02 ) * ( chi_x x13 x12 x01 x02 x03 x23 ) ) / + ( &48 * (ups_x x02 x03 x23) * sqrt( delta_x x01 x02 x03 x23 x13 x12 )) + + ( x02 * ( x01 + x13 - x03 ) * ( chi_x x12 x23 x02 x03 x01 x13 ) ) / + ( &48 * (ups_x x03 x01 x13) * sqrt( delta_x x01 x02 x03 x23 x13 x12 )) + + ( x02 * ( x02 + x23 - x03 ) * ( chi_x x12 x13 x01 x03 x02 x23 ) ) / + ( &48 * (ups_x x03 x02 x23) * sqrt( delta_x x01 x02 x03 x23 x13 x12 )) `;; + +let svan =new_definition ` svan v0 ( v0 , v1, v2, v3) = + lambda_v * volan v0 ( v0 , v1, v2, v3) + + lambda_s * solid v0 ( conv0 { v0 , v1, v2, v3}) `;; + +(* Definition 7.23 =================================================*) + +let eta_pos = new_definition ` eta_pos (q:real^3->bool) (s:real^3->bool) = + let d = find_diagonal q s in + let f1 = d UNION ( @{u}. ( q DIFF d ) u ) in + let f2 = d UNION ( @{v}. ( q DIFF f1) v ) in + ( max_real ( radV f1 ) ( radV f2) )`;; + +(* The definition 7.24 =============================================*) + +let sv0 = new_definition ` sv0 v s d = sovo v (VCt v t0 s d) lambda_oct `;; + +let v_hat = new_definition `v_hat v q s = if ( quarter q s ) /\ ( v IN find_diagonal q s ) + then ( @u. u IN (find_diagonal q s DIFF {v} )) + else v `;; + +let sigma = new_definition ` sigma v0 ( v0 , v1 , v2, v3 ) ( s:real^3->bool ) = + let q = { v0 , v1 , v2 , v3 } in + if ( quasi_reg_tet q s ) then + if radV q < sqrt2 then gamma ( v0 , v1 , v2, v3 ) s + else svan v0 ( v0 , v1 , v2, v3 ) + else if ( eta_pos q s ) < sqrt2 then + if ( cotext ( find_dia q s ) s = (1,1) ) \/( cotext ( find_dia q s ) s = (4,0) ) then + gamma (v0 , v1 , v2, v3 ) s + else gamma ( v0 , v1 , v2, v3 ) s + ( &1 / &2 )* ( ( sv0 v0 q s ) - ( sv0 ( v_hat v0 q s ) q s )) + else if ( cotext ( find_dia q s ) s = (1,1) ) then svan v0 ( v0 , v1, v2, v3 ) + else ( if ( cotext ( find_dia q s ) s = (4,0) ) then + ( &1 / &2 )* ( ( svan v0 ( v0 , v1, v2, v3 )) + ( svan ( v_hat v0 q s ) ( v0 , v1, v2, v3 ))) + else ( &1 / &2 )* ( ( svan v0 ( v0 , v1, v2, v3 )) + ( svan ( v_hat v0 q s ) ( v0 , v1, v2, v3 ))) + + ( &1 / &2 )* ( ( sv0 v0 q s - sv0 ( v_hat v0 q s) q s ))) `;; + +let A_1 = new_definition ` A_1 v0 ( v0 , v1 , v2 , v3 ) (s:real^3->bool) = + let q = { v0 , v1 , v2 , v3 } in + -- vol( VC1 v0 q s ) + (( solid v0 q )/ ( &3 * delta_oct )) + + (( sigma v0 ( v0 , v1 , v2, v3 ) s ) / (&4 * delta_oct )) `;; +(*=====================================================================*) +(* this definition is writen by anhtamct ==============================*) +let ball3_lambda = new_definition ` ball3_lambda (x:real^3) (r:real) (Lambda:real^3 -> bool) = + ((open_ball x r ) INTER ( UNIONS ( IMAGE (\v. open_ball v (&1) ) Lambda ) ))`;; +let truncated_packing = new_definition ` truncated_packing x r Lambda = Lambda INTER (ball3_lambda x r Lambda) `;; +(*=====================================================================*) +(* these definition are writen by Hoang Le Truong =====================*) +let graph = new_definition `graph E <=> (!e. E e ==> (e HAS_SIZE 2))`;; +let fan1 = new_definition`fan1(x,V,E):bool <=> FINITE V /\ ~(V SUBSET {}) `;; +let fan2 = new_definition`fan2(x,V,E):bool <=> ~(x IN V)`;; + +let fan3=new_definition`fan3(x,V,E):bool <=> (!v. (v IN V) ==> cyclic_set {w | {v,w} IN E } x v)`;; + +let fan4 = new_definition`fan4(x,V,E):bool<=> (!e. (e IN E) ==> (aff_gt {x} e INTER V={}))`;; + +let fan5 = new_definition`fan5(x,V,E):bool<=> (!e f. (e IN E)/\ (f IN E) /\ ~(e=f) ==> (aff_gt {x} e INTER aff_gt {x} f ={}))`;; +let fan = new_definition`fan(x,V,E)<=> ((UNIONS E) SUBSET V) /\ graph(E)/\ fan1(x,V,E)/\ fan2(x,V,E)/\ fan3(x,V,E)/\ fan4 (x,V,E) /\ fan5(x,V,E)`;; +let X= new_definition`X fan(x,V,E)={v | ?e. (E e)/\(v IN aff_ge {x} e)}`;; +let Y= new_definition`Y fan(x,V,E)={v:real^3 | ?e. (E e)/\(~(v IN aff_ge {x} e))}`;; +(*=====================================================================*) +(* Definition 8.9 =====================================================*) +let tru_pack =new_definition ` tru_pack (v:real^3) (r:real) (s:real^3->bool) = + { x | center_pac s v /\ x IN s /\ x IN open_ball v r }`;; +let v_std = new_definition ` v_std (s:real^3->bool) (v0:real^3) = ( tru_pack v0 ( &2 * t0 ) s ) DIFF {v0}`;; +let e_std = new_definition ` e_std (s:real^3->bool) (v0:real^3) = + { { u , v } | u IN (tru_pack v0 ( &2 * t0 ) s ) DIFF {v0} /\ + v IN (tru_pack v0 ( &2 * t0 ) s ) DIFF {v0} /\ + ~(u = v) /\ d3 u v <= ( &2 * t0 ) }`;; + +(*=====================================================================*) +(* Definition 26 in collection_geom file ==============================*) +let condC = new_definition ` condC (M13:real) (m12:real) (m14:real) (M24:real) (m34:real) (m23:real) = + (( m12 + m23 >= M13 ) /\ ( m14 + m34 >= M13 ) /\ ( m12 + m14 > M24 ) /\ ( m23 + m34 > M24 ) /\ + ( delta_x (M13 pow 2) (m12 pow 2) (m14 pow 2) (M24 pow 2) (m34 pow 2) (m23 pow 2) >= &0 ))` ;; +(*=====================================================================*) +(* Begin to prove lemma 8.30 *) +(*=====================================================================*) + +(* lemma_grap*) + +let in_lemma2 = REWRITE_CONV[IN_ELIM_THM] + `e IN {{u, v} | u IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + v IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + ~(u = v) /\ + d3 u v <= &2 * t0}`;; + +let in_inv = prove (`{{u, v} | u IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + v IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + ~(u = v) /\ + d3 u v <= &2 * t0} e <=> e IN {{u, v} | u IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + v IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + ~(u = v) /\ + d3 u v <= &2 * t0}`,SET_TAC[]);; + +let lemma_graph = prove(`center_pac (s:real^3->bool) (v0:real^3) ==> graph (e_std s v0)`, REWRITE_TAC[e_std;tru_pack;graph] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[SET_RULE `{x | x IN s /\ x IN open_ball v0 (&2 * t0)}= s INTER open_ball v0 (&2 * t0)`] + THEN GEN_TAC THEN REWRITE_TAC[in_inv] THEN REWRITE_TAC[in_lemma2] + THEN REWRITE_TAC[ARITH_RULE `2 = SUC (SUC 0)`;HAS_SIZE_CLAUSES]THEN REPEAT STRIP_TAC + THEN EXISTS_TAC`u:real^3` THEN EXISTS_TAC`{v:real^3}` + THEN ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY] THEN EXISTS_TAC `v:real^3` THEN EXISTS_TAC `{}:real^3->bool` + THEN ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]);; +(*==============================================================================*) +(* end lemma_graph*) +(*==============================================================================*) + +(*unions_lemma*) + +let uni_lemma1 = prove( ` UNIONS + {{u, v} | u IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + v IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + ~(u = v) /\ + d3 u v <= &2 * t0} =UNIONS + {{u1, v1} | u1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + v1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + ~(u1 = v1) /\ + d3 u1 v1 <= &2 * t0}`,SET_TAC[]);; + +let in_lemma1 = REWRITE_CONV[IN_ELIM_THM] +`u IN + {{u1, v1} | u1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + v1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + ~(u1 = v1) /\ + d3 u1 v1 <= &2 * t0}`;; + +let in_lemma = ONCE_REWRITE_CONV[IN_ELIM_THM] +`x IN + {y | ?u. u IN + {{u1, v1} | u1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + v1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + ~(u1 = v1) /\ + d3 u1 v1 <= &2 * t0} /\ + y IN u}`;; + +let exist_lemma = prove(` (?u. (?u1 v1. + (u1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + v1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + ~(u1 = v1) /\ + d3 u1 v1 <= &2 * t0) /\ + u = {u1, v1}) /\ + x IN u) <=> (?u1 v1. + (u1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + v1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + ~(u1 = v1) /\ + d3 u1 v1 <= &2 * t0 /\ + x IN { u1, v1 }))`, MESON_TAC[]);; + +let cha_lemma1 = prove (`{x | ?u. u IN + {{u1, v1} | u1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + v1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + ~(u1 = v1) /\ + d3 u1 v1 <= &2 * t0} /\ + x IN u} = {y | ?u. u IN + {{u1, v1} | u1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + v1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + ~(u1 = v1) /\ + d3 u1 v1 <= &2 * t0} /\ + y IN u}`,SET_TAC[]);; + +let exist_lemma1 = prove(` (?u1 v1. + u1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + v1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + ~(u1 = v1) /\ + d3 u1 v1 <= &2 * t0 /\ + x = u1 \/ + u1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + v1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + ~(u1 = v1) /\ + d3 u1 v1 <= &2 * t0 /\ + x = v1) <=> + ( ?v1. + x IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + v1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + ~(x = v1) /\ + d3 x v1 <= &2 * t0 ) \/ + ( ?u1. + u1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + x IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + ~(u1 = x) /\ + d3 u1 x <= &2 * t0 )`,MESON_TAC[]);; + +let unions_lemma = prove (`!(v0:real^3) (s:real^3->bool). center_pac (s:real^3->bool) (v0:real^3) ==> UNIONS (e_std s v0) SUBSET v_std s v0`, + REPEAT GEN_TAC THEN REWRITE_TAC[e_std;v_std;tru_pack] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[SET_RULE` {x | x IN s /\ x IN open_ball v0 (&2 * t0)}= s INTER open_ball v0 (&2 * t0)`] THEN + ONCE_REWRITE_TAC[uni_lemma1] THEN REWRITE_TAC[SUBSET;UNIONS] THEN ONCE_REWRITE_TAC[cha_lemma1] THEN + ONCE_REWRITE_TAC[in_lemma] THEN GEN_TAC THEN ONCE_REWRITE_TAC[in_lemma1] THEN REWRITE_TAC[exist_lemma] THEN + REWRITE_TAC[SET_RULE ` x IN {u1 , v1} <=> x = u1 \/ x = v1`] THEN + REWRITE_TAC[TAUT ` u1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + v1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + ~(u1 = v1) /\ + d3 u1 v1 <= &2 * t0 /\ + (x = u1 \/ x = v1) <=> ( u1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + v1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + ~(u1 = v1) /\ + d3 u1 v1 <= &2 * t0 /\ + x = u1) \/ ( u1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + v1 IN s INTER open_ball v0 (&2 * t0) DIFF {v0} /\ + ~(u1 = v1) /\ + d3 u1 v1 <= &2 * t0 /\ + x = v1 )`] THEN + REWRITE_TAC[exist_lemma1] THEN STRIP_TAC);; +(*==================================================================================*) +(* end of unions_lemma*) +(*==================================================================================*) + +(*fan1_lemma*) + +let lemma7_1 = new_axiom `!(v0:real^3) (s:real^3->bool) r:real. center_pac (s:real^3->bool) (v0:real^3) ==> + FINITE (tru_pack v0 r s )`;; + +let fini_lemma = prove(` FINITE (tru_pack v0 (&2 * t0) s) + ==> FINITE (tru_pack v0 (&2 * t0) s DIFF {v0})`, REWRITE_TAC[FINITE_DIFF]);; + +let infi_lemma2 = prove(`center_pac s v0 ==> FINITE (tru_pack v0 (&2 * t0) s) `, REWRITE_TAC[lemma7_1]);; + +let fini_lemma1 = prove(`!(v0:real^3) (s:real^3->bool). center_pac s v0 ==> FINITE ( v_std s v0 )`, + REPEAT GEN_TAC THEN REWRITE_TAC[v_std] THEN DISCH_TAC THEN + MATCH_MP_TAC ( fini_lemma) THEN + UNDISCH_TAC `center_pac (s:real^3->bool) (v0:real^3)` THEN REWRITE_TAC[infi_lemma2]);; + +let fan1_lemma = prove(`!(v0:real^3) (s:real^3->bool). center_pac (s:real^3->bool) (v0:real^3) /\ ~( v_std s v0 = {}) ==> + fan1 (v0 , v_std s v0 , e_std s v0 )` , REPEAT GEN_TAC THEN REWRITE_TAC[fan1] THEN + REWRITE_TAC[TAUT `center_pac s v0 /\ ~(v_std s v0 = {} ) ==> FINITE ( v_std s v0 ) /\ ~(v_std s v0 SUBSET {}) <=> + ( center_pac s v0 /\ ~( v_std s v0 = {}) ==> FINITE ( v_std s v0 ) ) /\ + ( center_pac s v0 /\ ~( v_std s v0 = {}) ==> ~(v_std s v0 SUBSET {}))`] THEN + REWRITE_TAC[SET_RULE ` ~( v_std s v0 SUBSET {}) <=> ~( v_std s v0 = {})`] THEN + MESON_TAC[fini_lemma1]);; +(*======================================================================================*) +(* end of fan1_lemma*) +(*======================================================================================*) + +(* fan2_lemma*) + +let fan2_lemma = prove(`!(v0:real^3) (s:real^3->bool). center_pac s v0 ==> fan2 (v0,v_std s v0,e_std s v0 )`, + REPEAT GEN_TAC THEN REWRITE_TAC[fan2;v_std;DIFF] THEN SET_TAC[]);; +(*======================================================================================*) +(*end of fan2_lemma*) +(*======================================================================================*) + +(* fan3_lemma*) + +let lemmaf3 = prove(`{v, w} IN + {{x, y} | x IN tru_pack v0 (&2 * t0) s DIFF {v0} /\ + y IN tru_pack v0 (&2 * t0) s DIFF {v0} /\ + ~(x = y) /\ + d3 x y <= &2 * t0} <=> + (?x y. + (x IN tru_pack v0 (&2 * t0) s DIFF {v0} /\ + y IN tru_pack v0 (&2 * t0) s DIFF {v0} /\ + ~(x = y) /\ + d3 x y <= &2 * t0) /\ + {v, w} = {x, y})`, REWRITE_TAC[IN_ELIM_THM]);; + +let lemma_subset = prove ( `{w | ?x y. + (x IN tru_pack v0 (&2 * t0) s DIFF {v0} /\ + y IN tru_pack v0 (&2 * t0) s DIFF {v0} /\ + ~(x = y) /\ + d3 x y <= &2 * t0) /\ + {v, w} = {x, y}} SUBSET tru_pack v0 (&2 * t0) s DIFF {v0}`, SET_TAC[]);; + +let lemmaf32 = prove (` FINITE (tru_pack v0 (&2 * t0) s DIFF {v0}) + ==> FINITE + {w | ?x y. + (x IN tru_pack v0 (&2 * t0) s DIFF {v0} /\ + y IN tru_pack v0 (&2 * t0) s DIFF {v0} /\ + ~(x = y) /\ + d3 x y <= &2 * t0) /\ + {v, w} = {x, y}} <=> ( FINITE (tru_pack v0 (&2 * t0) s DIFF {v0}) /\ {w | ?x y. + (x IN tru_pack v0 (&2 * t0) s DIFF {v0} /\ + y IN tru_pack v0 (&2 * t0) s DIFF {v0} /\ + ~(x = y) /\ + d3 x y <= &2 * t0) /\ + {v, w} = {x, y}} SUBSET + tru_pack v0 (&2 * t0) s DIFF {v0} ) + ==> FINITE + {w | ?x y. + (x IN tru_pack v0 (&2 * t0) s DIFF {v0} /\ + y IN tru_pack v0 (&2 * t0) s DIFF {v0} /\ + ~(x = y) /\ + d3 x y <= &2 * t0) /\ + {v, w} = {x, y}}`, MESON_TAC[lemma_subset]);; + +let lemmaf33 = prove(` FINITE (tru_pack v0 (&2 * t0) s DIFF {v0}) + ==> FINITE + {w | ?x y. + (x IN tru_pack v0 (&2 * t0) s DIFF {v0} /\ + y IN tru_pack v0 (&2 * t0) s DIFF {v0} /\ + ~(x = y) /\ + d3 x y <= &2 * t0) /\ + {v, w} = {x, y}}`, REWRITE_TAC[lemmaf32] THEN REWRITE_TAC[FINITE_SUBSET]);; + +let lemmaf34 = prove (` condC (#2.6) (&2) (&2) (#2.6) (&2) (&2)`, REWRITE_TAC[condC;delta_x] THEN REAL_ARITH_TAC);; + +(* prove lemma have_not_prove*) + +let lemma_c = REWRITE_CONV[IN_ELIM_THM]`&1 / (h + &1) % p + h / (h + &1) % v IN + {w | ?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ w = a % p + b % v}`;; + +let lemma_2 = REWRITE_CONV[IN_ELIM_THM]`&1 / (h + &1) % p + h / (h + &1) % v IN + {w | ?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ w = a % q + b % v0}`;; + +let lemma_c1 = prove (` &0 <= h ==> &0 <= &1 / (h + &1)`, DISCH_TAC THEN MATCH_MP_TAC (REAL_LE_DIV) THEN UNDISCH_TAC `&0 <= h` + THEN REWRITE_TAC[MESON[]` &0 <= h ==> &0 <= &1 /\ &0 <= h + &1 <=> ( &0 <= h ==> &0 <= &1 ) /\ (&0 <= h ==> &0 <= h + &1 )`] + THEN REAL_ARITH_TAC);; + +let lemma_c11 = prove (`&0 < &1 / ( h + &1) ==> &0 <= &1 / (h + &1) `, REAL_ARITH_TAC);; + +let lemma_c111 = prove (`h >= &0 ==> &0 <= &1 / (h + &1)`, DISCH_TAC THEN MATCH_MP_TAC (lemma_c1) + THEN UNDISCH_TAC `h:real >= &0` THEN REAL_ARITH_TAC);; + +let lemma_ch = prove (` &0 <= h ==> &0 <= h / (h + &1)`, DISCH_TAC THEN MATCH_MP_TAC (REAL_LE_DIV) THEN UNDISCH_TAC `&0 <= h` + THEN REWRITE_TAC[MESON[]` &0 <= h ==> &0 <= h /\ &0 <= h + &1 <=> ( &0 <= h ==> &0 <= h ) /\ (&0 <= h ==> &0 <= h + &1 )`] + THEN REAL_ARITH_TAC);; + +let lemma_ch1 = prove (`&0 < h / ( h + &1) ==> &0 <= h / (h + &1) `, REAL_ARITH_TAC);; + +let lemma_ch11 = prove (`h >= &0 ==> &0 <= h / (h + &1)`, DISCH_TAC THEN MATCH_MP_TAC (lemma_ch) + THEN UNDISCH_TAC `h:real >= &0` THEN REAL_ARITH_TAC);; + +let lemma_1 = prove (` h >= &0 ==> &1 / (h + &1) + h / (h + &1) = &1`, STRIP_TAC THEN + REWRITE_TAC[REAL_ARITH `&1 / (h + &1) + h / (h + &1) = (h + &1)/ (h + &1)`] THEN + MATCH_MP_TAC (REAL_DIV_REFL) THEN UNDISCH_TAC `h >= &0` THEN REAL_ARITH_TAC);; + +let le1_diag_trape = prove (` p:real^3 = q + (h:real) % (v0 - v) /\ h >= &0 + ==> &1 / (h + &1) % p + h / (h + &1) % v IN {w | ?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ w = a % p + b % v}`, + REWRITE_TAC[lemma_c]THEN STRIP_TAC THEN EXISTS_TAC ` &1 / (h+ &1)` THEN EXISTS_TAC ` h:real / (h+ &1)` THEN + UNDISCH_TAC `h:real >= &0` THEN + REWRITE_TAC[MESON[] ` h >= &0 + ==> &0 <= &1 / (h + &1) /\ + &0 <= h / (h + &1) /\ + &1 / (h + &1) + h / (h + &1) = &1 /\ + &1 / (h + &1) % p + h / (h + &1) % v = + &1 / (h + &1) % p + h / (h + &1) % v <=> + ( h >= &0 ==> &0 <= &1 / (h + &1) ) /\ + ( h >= &0 ==> &0 <= h / (h + &1) ) /\ + ( h >= &0 ==> &1 / (h + &1) + h / (h + &1) = &1 ) /\ + ( h >= &0 ==> &1 / (h + &1) % p + h / (h + &1) % v = + &1 / (h + &1) % p + h / (h + &1) % v )`] THEN + REWRITE_TAC[lemma_c111;lemma_ch11;lemma_1]);; + +let diag_trape = prove (` !(p:real^3) (q:real^3) (v0:real^3) (v:real^3) (h:real). p = q + h % (v0 - v) /\ h >= &0 ==> + ~(conv {p, v} INTER conv {q, v0} = {})`, REPEAT GEN_TAC THEN DISCH_TAC THEN + REWRITE_TAC[SET_RULE ` ~(conv {p, v} INTER conv {q, v0} = {}) <=> ? x. x IN conv {p, v} /\ x IN conv {q, v0}`] THEN + EXISTS_TAC ` (&1/(h + &1)) % (p:real^3) + ((h:real)/(h + &1)) % (v:real^3)` THEN + UNDISCH_TAC `p:real^3 = q + h % (v0 - v) /\ h >= &0 ` THEN REWRITE_TAC[CONV_SET2] THEN + REWRITE_TAC[MESON[] ` p = q + h % (v0 - v) /\ h >= &0 + ==> &1 / (h + &1) % p + h / (h + &1) % v IN + {w | ?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ w = a % p + b % v} /\ + &1 / (h + &1) % p + h / (h + &1) % v IN + {w | ?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ w = a % q + b % v0} <=> + ( p = q + h % (v0 - v) /\ h >= &0 + ==> &1 / (h + &1) % p + h / (h + &1) % v IN + {w | ?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ w = a % p + b % v} ) /\ + ( p = q + h % (v0 - v) /\ h >= &0 + ==> &1 / (h + &1) % p + h / (h + &1) % v IN + {w | ?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ w = a % q + b % v0} )`] THEN + REWRITE_TAC[le1_diag_trape] THEN REWRITE_TAC[lemma_2] THEN STRIP_TAC THEN + EXISTS_TAC ` &1 / (h+ &1)` THEN EXISTS_TAC ` h:real / (h+ &1)` THEN UNDISCH_TAC `h >= &0` THEN + REWRITE_TAC[MESON[] ` h >= &0 + ==> &0 <= &1 / (h + &1) /\ + &0 <= h / (h + &1) /\ + &1 / (h + &1) + h / (h + &1) = &1 /\ + &1 / (h + &1) % p + h / (h + &1) % v = + &1 / (h + &1) % q + h / (h + &1) % v0 <=> + ( h >= &0 ==> &0 <= &1 / (h + &1) ) /\ + ( h >= &0 ==> &0 <= h / (h + &1) ) /\ + ( h >= &0 ==> &1 / (h + &1) + h / (h + &1) = &1 ) /\ + ( h >= &0 ==> &1 / (h + &1) % p + h / (h + &1) % v = + &1 / (h + &1) % q + h / (h + &1) % v0 )`] THEN + REWRITE_TAC[lemma_c111; lemma_ch11; lemma_1] THEN DISCH_TAC THEN + REWRITE_TAC[VECTOR_ARITH `&1 / (h + &1) % p + h / (h + &1) % v = &1 / (h + &1) % q + h / (h + &1) % v0 <=> + &1 / (h + &1) % p = &1 / (h + &1) % q + h / (h + &1) % v0 - ( h / (h + &1) % v )`] THEN + REWRITE_TAC[VECTOR_ARITH `&1 / (h + &1) % p = &1 / (h + &1) % q + h / (h + &1) % v0 - h / (h + &1) % v + <=> &1 / (h + &1) % p = &1 / (h + &1) % q + h / (h + &1) % (v0 - v)`] THEN ASM_REWRITE_TAC[] THEN + VECTOR_ARITH_TAC ) ;; + +let inv_diag = prove(`!(p:real^3) (q:real^3) (v0:real^3) (v:real^3) (h:real). p = q + h % (v0 - v) /\ conv {p, v} INTER conv {q, v0} = {} ==> ~(h >= &0)`, + REWRITE_TAC[TAUT `p = q + h % (v0 - v) /\ conv {p, v} INTER conv {q, v0} = {} + ==> ~(h >= &0) <=> p = q + h % (v0 - v) ==> ( conv {p, v} INTER conv {q, v0} = {} ==> ~(h >= &0) )`] THEN + REWRITE_TAC[TAUT ` conv {p, v} INTER conv {q, v0} = {} + ==> ~(h >= &0) <=> ( h >= &0 ==> ~(conv {p, v} INTER conv {q, v0} = {}))`] THEN + REWRITE_TAC[TAUT `p = q + h % (v0 - v)==> h >= &0 + ==> ~(conv {p, v} INTER conv {q, v0} = {}) <=> ( p = q + h % (v0 - v) /\ h >= &0 ) ==> ~(conv {p, v} INTER conv {q, v0} = {})`] THEN + REWRITE_TAC[diag_trape]);; + +let inv1_diag = prove (`!(p:real^3) (q:real^3) (v0:real^3) (v:real^3) (h:real). + conv {p, v} INTER conv {q, v0} = {} /\ h >= &0 ==> ~(p = q + h % (v0 - v))`, MESON_TAC[diag_trape]);; + +let vec_le = prove (` (h:real) % ( v0:real^3 - v ) = -- h % (v - v0)`, VECTOR_ARITH_TAC);; + + +let diag_trape1 = prove ( ` !(p:real^3) (q:real^3) (v0:real^3) (v:real^3) (h:real). p = q + h % (v0 - v) /\ h <= &0 ==> + ~(conv {p, v0} INTER conv {q, v} = {})`, REWRITE_TAC[REAL_ARITH ` h <= &0 <=> -- h >= &0`] THEN + ONCE_REWRITE_TAC[vec_le] THEN REWRITE_TAC[diag_trape]);; + +let inv_diag1 = prove(`!(p:real^3) (q:real^3) (v0:real^3) (v:real^3) (h:real). p = q + h % (v0 - v) /\ conv {p, v0} INTER conv {q, v} = {} ==> ~(h <= &0)`, + REWRITE_TAC[TAUT `p = q + h % (v0 - v) /\ conv {p, v0} INTER conv {q, v} = {} + ==> ~(h <= &0) <=> p = q + h % (v0 - v) ==> ( conv {p, v0} INTER conv {q, v} = {} ==> ~(h <= &0) )`] THEN + REWRITE_TAC[TAUT ` conv {p, v0} INTER conv {q, v} = {} + ==> ~(h <= &0) <=> ( h <= &0 ==> ~(conv {p, v0} INTER conv {q, v} = {}))`] THEN + REWRITE_TAC[TAUT `p = q + h % (v0 - v)==> h <= &0 + ==> ~(conv {p, v0} INTER conv {q, v} = {}) <=> ( p = q + h % (v0 - v) /\ h <= &0 ) ==> ~(conv {p, v0} INTER conv {q, v} = {})`] THEN + REWRITE_TAC[diag_trape1]);; + +let inv1_diag1 = prove (`!(p:real^3) (q:real^3) (v0:real^3) (v:real^3) (h:real). + conv {p, v0} INTER conv {q, v} = {} /\ h <= &0 ==> ~(p = q + h % (v0 - v))`, MESON_TAC[diag_trape1]);; + +let lemma_3_4 = new_axiom (` !(v1:real^3) (v2:real^3) (v3:real^3) (v4:real^3). + !(m12:real) (m23:real) (m34:real) (m14:real) (M13:real) (M24:real). + d3 v1 v2 >= m12 /\ + d3 v2 v3 >= m23 /\ + d3 v3 v4 >= m34 /\ + d3 v4 v1 >= m14 /\ + d3 v1 v3 < M13 /\ + d3 v2 v4 <= M24 /\ + condC M13 m12 m14 M24 m34 m23 + ==> conv {v1 , v3} INTER conv {v2 , v4} = {}`);; + +let lemma_3_4_c = new_axiom (` !(p:real^3) (q:real^3) (v:real^3) (v0:real^3). + d3 p q >= m12 /\ + d3 q v >= m23 /\ + d3 v v0 >= m34 /\ + d3 v0 p >= m14 /\ + d3 p v < M13 /\ + d3 q v0 <= M24 /\ + condC M13 m12 m14 M24 m34 m23 + ==> conv {p , v} INTER conv {q , v0} = {}`);; + +let affine_two_points = prove (`!(x:real^3) (y:real^3). affine {z | ?u v. u + v = &1 /\ z = u % x + v % y}`, REPEAT GEN_TAC THEN + REWRITE_TAC[affine] THEN REPEAT GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN EXISTS_TAC `( u:real) * u' + v * u''` THEN EXISTS_TAC ` u:real * v' + v * v''` THEN + REWRITE_TAC[REAL_RING `(u * u' + v * u'') + u * v' + v * v'' = u * (u' + v') + v * (u'' + v'')`] THEN + ASM_REWRITE_TAC[] THEN REWRITE_TAC[REAL_RING `u * &1 + v * &1 = u + v`] THEN ASM_REWRITE_TAC[] THEN + VECTOR_ARITH_TAC);; + +let ch_le = prove (`(!x y u v. x IN t /\ y IN t /\ u + v = &1 ==> u % x + v % y IN t) <=> + (!v1 v2 r s. v1 IN t /\ v2 IN t /\ r + s = &1 ==> r % v1 + s % v2 IN t)`, MESON_TAC[]);; + +let sub_aff = prove ( ` ! (t:real^3->bool) v1:real^3 v2:real^3 . affine t /\ {v1 , v2} SUBSET t ==> + {w | ?r s. r + s = &1 /\ w = r % v1 + s % v2} SUBSET t`, REPEAT GEN_TAC THEN REWRITE_TAC[affine] THEN + REWRITE_TAC[SET_RULE `{v1, v2} SUBSET t <=> v1 IN t /\ v2 IN t`] THEN STRIP_TAC THEN REWRITE_TAC[SUBSET] THEN + GEN_TAC THEN ONCE_REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `!x:real^3 y:real^3 u:real v. x IN (t:real^3->bool) /\ y IN t /\ u + v = &1 ==> u % x + v % y IN t` THEN + ONCE_REWRITE_TAC[ch_le] THEN UNDISCH_TAC `v1:real^3 IN t:real^3->bool` THEN UNDISCH_TAC `v2:real^3 IN t:real^3->bool` THEN + UNDISCH_TAC `r + s = &1 ` THEN MESON_TAC[]);; + +let ans = prove (` INTERS {t:real^3->bool | affine t /\ {v1:real^3, v2} SUBSET t} = {w:real^3 | ?r:real s. r + s = &1 /\ w = r % v1 + s % v2} + <=> INTERS {t | affine t /\ {v1, v2} SUBSET t} SUBSET {w | ?r s. r + s = &1 /\ w = r % v1 + s % v2} /\ + {w | ?r s. r + s = &1 /\ w = r % v1 + s % v2} SUBSET INTERS {t | affine t /\ {v1, v2} SUBSET t} `, SET_TAC[]);; + +let anss = SET_RULE `(!t:real^3->bool. affine t /\ {v1, v2} SUBSET t ==> {w | ?r s. r + s = &1 /\ w = r % v1 + s % v2} SUBSET t ) ==> + {w | ?r s. r + s = &1 /\ w = r % v1 + s % v2} SUBSET INTERS {t | affine t /\ {v1, v2} SUBSET t}`;; + +let chon = SET_RULE `!s:A->bool. s IN { t | P t} ==> INTERS { t| P t} SUBSET s`;; + +let subset_two_points = SET_RULE `{a , b } SUBSET s <=> a IN s /\ b IN s`;; + +let sub_1 = prove (`{w | ?r s. r + s = &1 /\ w = r % (v1:real^3) + s % (v2:real^3)} SUBSET + INTERS {(t:real^3->bool) | affine t /\ {v1, v2} SUBSET t}`, MATCH_MP_TAC(anss) THEN REWRITE_TAC[sub_aff]);; + +let AFF_HULL_TWO_POINTS = prove (` ! v1:real^3 v2:real^3 . affine hull {v1 , v2} = { w | ? r s . r + s = &1 /\ w = r % v1 + s % v2 }`, + REPEAT GEN_TAC THEN REWRITE_TAC[hull] THEN REWRITE_TAC[ans] THEN REWRITE_TAC[sub_1] THEN MATCH_MP_TAC(chon) THEN + REWRITE_TAC[IN_ELIM_THM] THEN REWRITE_TAC[affine_two_points] THEN REWRITE_TAC[subset_two_points] THEN + REWRITE_TAC[IN_ELIM_THM] THEN CONJ_TAC THENL [EXISTS_TAC `&1`; EXISTS_TAC `&0`] THENL [EXISTS_TAC `&0`; EXISTS_TAC `&1`] + THENL [REWRITE_TAC[REAL_ARITH ` &1 + &0 = &1`]; REWRITE_TAC[REAL_ARITH ` &0 + &1 = &1`]] THEN VECTOR_ARITH_TAC);; + +let fa4 = prove(`(p:real^3) = (q:real^3) + (h:real) % ((v0:real^3) - (v:real^3)) /\ h = &0 ==> p = q`, + REWRITE_TAC[TAUT` p = q + h % (v0 - v) /\ h = &0 ==> p = q <=> h = &0 /\ p = q + h % (v0 - v) ==> p = q`]THEN + REWRITE_TAC[TAUT `h = &0 /\ p = q + h % (v0 - v) ==> p = q <=> h = &0 ==> p = q + h % (v0 - v) ==> p = q`] THEN + DISCH_TAC THEN ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC);; + +let tam = prove (` (p:real^3) = (q:real^3) + (h:real) % ((v0:real^3) - (v:real^3)) /\ ~(h = &0) ==> + ~(conv {p, v} INTER conv {q, v0} = {}) \/ ~(conv {p, v0} INTER conv {q, v} = {})`, + REWRITE_TAC[REAL_ARITH `~(h = &0) <=> (h > &0 \/ h < &0)`] THEN + REWRITE_TAC[TAUT ` p = q + h % (v0 - v) /\ (h > &0 \/ h < &0) <=> p = q + h % (v0 - v) /\ h > &0 \/ + p = q + h % (v0 - v) /\ h < &0 `] THEN STRIP_TAC + THENL[ MATCH_MP_TAC(TAUT ` ~(conv {(p:real^3) , (v:real^3)} INTER conv {(q:real^3), (v0:real^3)} = {}) ==> + ~(conv {p, v} INTER conv {q, v0} = {}) \/ ~(conv {p, v0} INTER conv {q, v} = {})`); + MATCH_MP_TAC(TAUT ` ~(conv {(p:real^3) , (v0:real^3)} INTER conv {(q:real^3), (v:real^3)} = {}) ==> + ~(conv {p, v} INTER conv {q, v0} = {}) \/ ~(conv {p, v0} INTER conv {q, v} = {})`)] + THENL[MATCH_MP_TAC(diag_trape);MATCH_MP_TAC(diag_trape1)] THEN EXISTS_TAC ` h:real` + THENL[STRIP_TAC THENL[ASM_REWRITE_TAC[]; UNDISCH_TAC ` h > &0 ` ] THEN REAL_ARITH_TAC ; + STRIP_TAC THENL[ASM_REWRITE_TAC[]; UNDISCH_TAC ` h < &0 ` ] THEN REAL_ARITH_TAC]);; + +let tam1 = prove (` (p:real^3) = (q:real^3) + (h:real) % ( (v0:real^3) - (v:real^3)) /\ ~(p = q ) + ==> ~(conv {p, v} INTER conv {q, v0} = {}) \/ ~(conv {p, v0} INTER conv {q, v} = {})`, + STRIP_TAC THEN MATCH_MP_TAC(tam) THEN STRIP_TAC + THENL[ASM_REWRITE_TAC[];UNDISCH_TAC `~(p:real^3 = q)` THEN UNDISCH_TAC `p:real^3 = q + h % (v0 - v)`] + THEN REWRITE_TAC[TAUT` ~(p = q) ==> ~(h = &0) <=> h = &0 ==> p = q`] THEN MESON_TAC[fa4]);; + +let tam2 = prove (` ~(p:real^3 = q) /\ conv {p, v:real^3} INTER conv {q, v0:real^3} = {} /\ conv {p, v0} INTER conv {q, v} = {} + ==> ~(p = q + (h:real) % (v0 - v) )`, MESON_TAC[tam1]);; + +let c_nov16 = prove (` ~(p:real^3 = q) ==> (!(x:real^3) (y:real^3). x IN (s:real^3->bool) /\ y IN s /\ ~(x = y) ==> norm (x - y) >= &2) /\ + (v0:real^3) IN s ==> (v:real^3) IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0) + ==> (((v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + (p IN s /\ norm (p - v0) < &2 * t0 /\ ~(p = v0)) /\ + ~(v = p) /\ norm (v - p) <= &2 * t0) \/ + ((p IN s /\ norm (p - v0) < &2 * t0 /\ ~(p = v0)) /\ + (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + ~(p = v) /\ norm (p - v) <= &2 * t0)) + ==> (((v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + (q IN s /\ norm (q - v0) < &2 * t0 /\ ~(q = v0)) /\ + ~(v = q) /\ norm (v - q) <= &2 * t0) \/ + ((q IN s /\ norm (q - v0) < &2 * t0 /\ ~(q = v0)) /\ + (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + ~(q = v) /\ norm (q - v) <= &2 * t0)) + ==> ~(p = q + h % (v0 - v))`, + REWRITE_TAC[MESON[NORM_SUB]` (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + (p IN s /\ norm (p - v0) < &2 * t0 /\ ~(p = v0)) /\ + ~(v = p) /\ norm (v - p) <= &2 * t0 \/ + (p IN s /\ norm (p - v0) < &2 * t0 /\ ~(p = v0)) /\ + (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + ~(p = v) /\ norm (p - v) <= &2 * t0 + <=> (p IN s /\ norm (p - v0) < &2 * t0 /\ ~(p = v0)) /\ + (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + ~(p = v) /\ norm (p - v) <= &2 * t0 `] THEN REPEAT STRIP_TAC THEN + UNDISCH_TAC `p:real^3 = q + (h:real) % (v0 - v)` THEN + REWRITE_TAC[MESON[]`p = q + h % (v0 - v) ==> F <=> ~(p = q + h % (v0 - v))`] THEN + MATCH_MP_TAC(tam2) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN MATCH_MP_TAC(lemma_3_4) THEN + EXISTS_TAC ` &2` THEN EXISTS_TAC ` &2` THEN EXISTS_TAC ` &2` THEN EXISTS_TAC ` &2` THEN + EXISTS_TAC ` #2.6` THEN EXISTS_TAC ` #2.6` THEN REWRITE_TAC[lemmaf34] THEN REWRITE_TAC[d3;dist] + THENL[UNDISCH_TAC ` norm (q:real^3 - v0) < &2 * t0` ; UNDISCH_TAC` norm (q:real^3 - v) <= &2 * t0` ] THEN + REWRITE_TAC[t0] THEN REWRITE_TAC[REAL_ARITH ` &2 * #1.255 = #2.51`] + THENL[REWRITE_TAC[TAUT ` norm (q - v0) < #2.51 + ==> norm (p - q) >= &2 /\ + norm (q - v) >= &2 /\ + norm (v - v0) >= &2 /\ + norm (v0 - p) >= &2 /\ + norm (p - v) < #2.6 /\ + norm (q - v0) <= #2.6 + <=> ( norm (q - v0) < #2.51 + ==> norm (p - q) >= &2 /\ + norm (q - v) >= &2 /\ + norm (v - v0) >= &2 /\ + norm (v0 - p) >= &2 /\ + norm (p - v) < #2.6) /\ + (norm (q - v0) < #2.51 + ==> norm (q - v0) <= #2.6 )`] THEN CONJ_TAC THENL [DISCH_TAC ; REAL_ARITH_TAC]; + REWRITE_TAC[TAUT `norm (q - v) <= #2.51 + ==> norm (p - q) >= &2 /\ + norm (q - v0) >= &2 /\ + norm (v0 - v) >= &2 /\ + norm (v - p) >= &2 /\ + norm (p - v0) < #2.6 /\ + norm (q - v) <= #2.6 + <=> ( norm (q - v) <= #2.51 + ==> norm (p - q) >= &2 /\ + norm (q - v0) >= &2 /\ + norm (v0 - v) >= &2 /\ + norm (v - p) >= &2 /\ + norm (p - v0) < #2.6 ) /\ + ( norm (q - v) <= #2.51 + ==> norm (q - v) <= #2.6 ) `] THEN CONJ_TAC THENL [DISCH_TAC ; REAL_ARITH_TAC]] + THENL[UNDISCH_TAC `norm (p:real^3 - v) <= &2 * t0` THEN REWRITE_TAC[t0] THEN REWRITE_TAC[REAL_ARITH ` &2 * #1.255 = #2.51`] THEN + REWRITE_TAC[TAUT ` norm (p - v) <= #2.51 + ==> norm (p - q) >= &2 /\ + norm (q - v) >= &2 /\ + norm (v - v0) >= &2 /\ + norm (v0 - p) >= &2 /\ + norm (p - v) < #2.6 <=> ( norm (p - v) <= #2.51 + ==> norm (p - q) >= &2 /\ + norm (q - v) >= &2 /\ + norm (v - v0) >= &2 /\ + norm (v0 - p) >= &2 ) /\ (norm (p - v) <= #2.51 ==> + norm (p - v) < #2.6 )`] THEN CONJ_TAC THENL [DISCH_TAC; REAL_ARITH_TAC] THEN + UNDISCH_TAC ` ~(p:real^3 = v0)` THEN UNDISCH_TAC ` v0:real^3 IN s:real^3->bool` THEN + UNDISCH_TAC` !x:real^3 y:real^3. x IN s:real^3->bool /\ y IN s /\ ~(x = y) ==> norm (x - y) >= &2` THEN + UNDISCH_TAC ` p:real^3 IN s:real^3->bool` THEN UNDISCH_TAC `q:real^3 IN (s:real^3->bool)` THEN + UNDISCH_TAC ` ~(p:real^3 = q)` THEN UNDISCH_TAC ` v:real^3 IN (s:real^3->bool)` + THEN UNDISCH_TAC ` ~(q:real^3 = v)` THEN UNDISCH_TAC ` ~(v:real^3 = v0)` ; + UNDISCH_TAC` norm (p:real^3 - v0) < &2 * t0` THEN REWRITE_TAC[t0] THEN REWRITE_TAC[REAL_ARITH ` &2 * #1.255 = #2.51`] THEN + REWRITE_TAC[TAUT ` norm (p - v0) < #2.51 + ==> norm (p - q) >= &2 /\ + norm (q - v0) >= &2 /\ + norm (v0 - v) >= &2 /\ + norm (v - p) >= &2 /\ + norm (p - v0) < #2.6 <=> (norm (p - v0) < #2.51 + ==> norm (p - q) >= &2 /\ + norm (q - v0) >= &2 /\ + norm (v0 - v) >= &2 /\ + norm (v - p) >= &2 ) /\ (norm (p - v0) < #2.51 + ==> norm (p - v0) < #2.6)`] THEN CONJ_TAC THENL [DISCH_TAC; REAL_ARITH_TAC] THEN + UNDISCH_TAC ` p:real^3 IN (s:real^3->bool) ` THEN UNDISCH_TAC ` q:real^3 IN (s:real^3->bool) ` THEN + UNDISCH_TAC ` v:real^3 IN (s:real^3->bool) ` THEN UNDISCH_TAC ` v0:real^3 IN (s:real^3->bool) ` THEN + UNDISCH_TAC ` ~(p:real^3 = q) ` THEN UNDISCH_TAC ` ~(p:real^3 = v) ` THEN + UNDISCH_TAC ` ~(v:real^3 = v0) ` THEN UNDISCH_TAC ` ~(q:real^3 = v0) ` THEN + UNDISCH_TAC ` !x:real^3 y:real^3. x IN (s:real^3->bool) /\ y IN s /\ ~(x = y) ==> norm (x - y) >= &2 `] + THEN MESON_TAC[NORM_SUB]);; + +let c_nov17 = prove (` ( ~(p:real^3 = q) /\ (!(x:real^3) (y:real^3). x IN (s:real^3->bool) /\ y IN s /\ ~(x = y) ==> norm (x - y) >= &2) /\ + (v0:real^3) IN s /\ (v:real^3) IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0) + /\ (((v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + (p IN s /\ norm (p - v0) < &2 * t0 /\ ~(p = v0)) /\ + ~(v = p) /\ norm (v - p) <= &2 * t0) \/ + ((p IN s /\ norm (p - v0) < &2 * t0 /\ ~(p = v0)) /\ + (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + ~(p = v) /\ norm (p - v) <= &2 * t0)) + /\ (((v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + (q IN s /\ norm (q - v0) < &2 * t0 /\ ~(q = v0)) /\ + ~(v = q) /\ norm (v - q) <= &2 * t0) \/ + ((q IN s /\ norm (q - v0) < &2 * t0 /\ ~(q = v0)) /\ + (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + ~(q = v) /\ norm (q - v) <= &2 * t0)) ) + ==> ~(p = q + h % (v0 - v))`, + REWRITE_TAC[TAUT ` ~(p = q) /\ + (!x y. x IN s /\ y IN s /\ ~(x = y) ==> norm (x - y) >= &2) /\ + v0 IN s /\ + v IN s /\ + norm (v - v0) < &2 * t0 /\ + ~(v = v0) /\ + ((v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + (p IN s /\ norm (p - v0) < &2 * t0 /\ ~(p = v0)) /\ + ~(v = p) /\ + norm (v - p) <= &2 * t0 \/ + (p IN s /\ norm (p - v0) < &2 * t0 /\ ~(p = v0)) /\ + (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + ~(p = v) /\ + norm (p - v) <= &2 * t0) /\ + ((v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + (q IN s /\ norm (q - v0) < &2 * t0 /\ ~(q = v0)) /\ + ~(v = q) /\ + norm (v - q) <= &2 * t0 \/ + (q IN s /\ norm (q - v0) < &2 * t0 /\ ~(q = v0)) /\ + (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + ~(q = v) /\ + norm (q - v) <= &2 * t0) + ==> ~(p = q + h % (v0 - v)) <=> + ~(p:real^3 = q) + ==> (!(x:real^3) (y:real^3). x IN (s:real^3->bool) /\ y IN s /\ ~(x = y) ==> norm (x - y) >= &2) /\ + (v0:real^3) IN s ==> (v:real^3) IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0) + ==> (((v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + (p IN s /\ norm (p - v0) < &2 * t0 /\ ~(p = v0)) /\ + ~(v = p) /\ norm (v - p) <= &2 * t0) \/ + ((p IN s /\ norm (p - v0) < &2 * t0 /\ ~(p = v0)) /\ + (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + ~(p = v) /\ norm (p - v) <= &2 * t0)) + ==> (((v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + (q IN s /\ norm (q - v0) < &2 * t0 /\ ~(q = v0)) /\ + ~(v = q) /\ norm (v - q) <= &2 * t0) \/ + ((q IN s /\ norm (q - v0) < &2 * t0 /\ ~(q = v0)) /\ + (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + ~(q = v) /\ norm (q - v) <= &2 * t0)) + ==> ~(p = q + h % (v0 - v))`] THEN REWRITE_TAC[c_nov16]);; + +let fa2 = REWRITE_CONV[IN_ELIM_THM] `{v, q} IN + {{u, v'} | (u IN s /\ norm (u - v0) < &2 * t0 /\ ~(u = v0)) /\ + (v' IN s /\ norm (v' - v0) < &2 * t0 /\ ~(v' = v0)) /\ + ~(u = v') /\ + norm (u - v') <= &2 * t0}`;; + +let fa1 = REWRITE_CONV[IN_ELIM_THM]`p IN {w | {v, w} IN e_std s v0}`;; + +let c_nov1_17 = prove( ` center_pac (s:real^3->bool) (v0:real^3) + ==> (v IN v_std s v0 + ==> (!p q h. + {w | {v, w} IN e_std s v0} p /\ + {w | {v, w} IN e_std s v0} q /\ + p = q + h % (v0 - v) + ==> p = q))`, + REWRITE_TAC[SET_RULE `{w | {v, w} IN e_std s v0} p <=> p IN {w | {v, w} IN e_std s v0}`] THEN + REWRITE_TAC[fa1] THEN REPEAT DISCH_TAC THEN REPEAT GEN_TAC THEN + UNDISCH_TAC `(v:real^3) IN v_std (s:real^3->bool) v0` THEN UNDISCH_TAC `center_pac (s:real^3->bool) v0` THEN + REWRITE_TAC[TAUT `center_pac s v0 + ==> v IN v_std s v0 + ==> {v, p} IN e_std s v0 /\ {v, q} IN e_std s v0 /\ p = q + h % (v0 - v) + ==> p = q <=> + ~(p = q ) /\ center_pac s v0 /\ v IN v_std s v0 /\ {v, p} IN e_std s v0 /\ {v, q} IN e_std s v0 + ==> ~(p = q + h % (v0 - v))`] THEN + REWRITE_TAC[TAUT ` ~(p = q) /\ + center_pac s v0 /\ + v IN v_std s v0 /\ + {v, p} IN e_std s v0 /\ + {v, q} IN e_std s v0 + ==> ~(p = q + h % (v0 - v)) <=> + ~(p = q) ==> ( center_pac s v0 ==> ( v IN v_std s v0 /\ + {v, p} IN e_std s v0 /\ + {v, q} IN e_std s v0 + ==> ~(p = q + h % (v0 - v)))) `] THEN DISCH_TAC THEN DISCH_TAC THEN + REWRITE_TAC[v_std;e_std;tru_pack] THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[SET_RULE ` v IN {x | x IN s /\ x IN open_ball v0 (&2 * t0)} DIFF {v0} <=> + v IN s /\ v IN open_ball v0 (&2 * t0) /\ ~ ( v = v0)`] THEN + ONCE_REWRITE_TAC[SET_RULE `{{u, v} | (u IN s /\ u IN open_ball v0 (&2 * t0) /\ ~(u = v0)) /\ + (v IN s /\ v IN open_ball v0 (&2 * t0) /\ ~(v = v0)) /\ + ~(u = v) /\ + d3 u v <= &2 * t0} = + {{u, v'} | (u IN s /\ u IN open_ball v0 (&2 * t0) /\ ~(u = v0)) /\ + (v' IN s /\ v' IN open_ball v0 (&2 * t0) /\ ~(v' = v0)) /\ + ~(u = v') /\ + d3 u v' <= &2 * t0}`] THEN UNDISCH_TAC ` center_pac (s:real^3->bool) v0` THEN + REWRITE_TAC[center_pac;packing_trg;d3;dist;open_ball] THEN + REWRITE_TAC[SET_RULE `u IN {y | norm (y - v0) < &2 * t0} <=> norm (u - v0) < &2 * t0`] THEN + REWRITE_TAC[SET_RULE ` (s:real^3->bool) x <=> x IN s`] THEN REWRITE_TAC[SET_RULE ` ~(v0 IN (=) u) <=> ~ (u = v0)`] THEN + REWRITE_TAC[fa2] THEN REWRITE_TAC[SET_RULE ` {v, p} = {u, v'} <=> ( v = u /\ p = v') \/ ( v = v' /\ p = u )`] THEN + REPEAT DISCH_TAC THEN UNDISCH_TAC `(p:real^3) = (q:real^3) + (h:real) % ((v0:real^3) - (v:real^3))` THEN + REWRITE_TAC[TAUT ` p = q + h % (v0 - v) ==> F <=> ~(p = q + h % (v0 - v))`] THEN MATCH_MP_TAC(c_nov17) THEN + ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[]);; + +let c_nov18 = prove(` ! x:real^3. x IN affine hull {v1:real^3 , v2:real^3} ==> norm ( x - v1) = norm (x - v2) + norm (v2 - v1) \/ + norm ( x - v2) = norm (x - v1) + norm (v2 - v1) \/ norm ( v1 - v2) = norm ( x - v1) + norm (x - v2)`, + GEN_TAC THEN REWRITE_TAC[AFF_HULL_TWO_POINTS] THEN REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN UNDISCH_TAC ` (r:real) + (s:real) = &1 ` THEN + REWRITE_TAC [REAL_ARITH ` r + s = &1 <=> r = &1 - s`] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[VECTOR_ARITH ` ((&1 - s) % v1 + s % v2) - v1 = s % ( v2 - v1) `] THEN + REWRITE_TAC[VECTOR_ARITH ` ((&1 - s) % v1 + s % v2) - v2 = (&1 - s) % (v1 - v2)`] THEN REWRITE_TAC[NORM_MUL] THEN + REWRITE_TAC[TAUT ` abs s * norm (v2 - v1) = abs (&1 - s) * norm (v1 - v2) + norm (v2 - v1) \/ + abs (&1 - s) * norm (v1 - v2) = abs s * norm (v2 - v1) + norm (v2 - v1) \/ + norm (v1 - v2) = abs s * norm (v2 - v1) + abs (&1 - s) * norm (v1 - v2) <=> + ~( abs s * norm (v2 - v1) = abs (&1 - s) * norm (v1 - v2) + norm (v2 - v1)) /\ + ~( abs (&1 - s) * norm (v1 - v2) = abs s * norm (v2 - v1) + norm (v2 - v1)) ==> + norm (v1 - v2) = abs s * norm (v2 - v1) + abs (&1 - s) * norm (v1 - v2)`] THEN + DISCH_TAC THEN REWRITE_TAC[NORM_SUB] THEN + REWRITE_TAC[REAL_ARITH ` abs s * norm (v1 - v2) + abs (&1 - s) * norm (v1 - v2) + = (abs s + abs (&1 - s))*norm (v1 - v2)`] THEN + MATCH_MP_TAC(REAL_ARITH` (abs s + abs (&1 - s)) = &1 ==> norm (v1 - v2) = (abs s + abs (&1 - s)) * norm (v1 - v2)`) THEN + MATCH_MP_TAC(REAL_ARITH ` abs s = s /\ abs (&1 - s) = (&1 - s) ==> abs s + abs (&1 - s) = &1`) THEN + REWRITE_TAC[REAL_ABS_REFL] THEN + UNDISCH_TAC ` ~(abs (s:real) * norm (v2:real^3 - v1:real^3) = + abs (&1 - s) * norm (v1 - v2) + norm (v2 - v1)) /\ + ~(abs (&1 - s) * norm (v1 - v2) = + abs s * norm (v2 - v1) + norm (v2 - v1))` THEN + REWRITE_TAC[TAUT ` ~(abs s * norm (v2 - v1) = abs (&1 - s) * norm (v1 - v2) + norm (v2 - v1)) /\ + ~(abs (&1 - s) * norm (v1 - v2) = abs s * norm (v2 - v1) + norm (v2 - v1)) + ==> &0 <= s /\ &0 <= &1 - s <=> + ~(&0 <= s /\ &0 <= &1 - s ) /\ ~(abs s * norm (v2 - v1) = abs (&1 - s) * norm (v1 - v2) + norm (v2 - v1)) + ==> (abs (&1 - s) * norm (v1 - v2) = abs s * norm (v2 - v1) + norm (v2 - v1))`] THEN + STRIP_TAC THEN REWRITE_TAC[NORM_SUB] THEN + REWRITE_TAC[REAL_ARITH ` abs (&1 - s) * norm (v1 - v2) = abs s * norm (v1 - v2) + norm (v1 - v2) <=> + abs (&1 - s) * norm (v1 - v2) - abs s * norm (v1 - v2) = norm (v1 - v2)`] THEN + REWRITE_TAC[REAL_ARITH `abs (&1 - s) * norm (v1 - v2) - abs s * norm (v1 - v2) = + ( abs (&1 - s) - abs s ) * norm (v1 - v2)`] THEN + REWRITE_TAC[REAL_ARITH ` (abs (&1 - s) - abs s) * norm (v1 - v2) = norm (v1 - v2) <=> + norm (v1 - v2) = (abs (&1 - s) - abs s) * norm (v1 - v2)`] THEN + MATCH_MP_TAC( REAL_RING `(abs (&1 - s:real) - abs s) = &1 ==> + norm (v1 - v2) = (abs (&1 - s) - abs s) * norm (v1 - v2)`) THEN + MATCH_MP_TAC(REAL_ARITH ` abs (&1 - s) = (&1 - s) /\ abs s = -- s ==> abs (&1 - s) - abs s = &1`) THEN + REWRITE_TAC[REAL_ARITH ` abs s = --s <=> abs (--s) = --s`] THEN REWRITE_TAC[REAL_ABS_REFL] THEN + UNDISCH_TAC ` ~(abs s * norm ((v2:real^3) - (v1:real^3)) = + abs (&1 - s) * norm (v1 - v2) + norm (v2 - v1))` THEN + REWRITE_TAC[TAUT ` ~(abs s * norm (v2 - v1) = abs (&1 - s) * norm (v1 - v2) + norm (v2 - v1)) + ==> &0 <= &1 - s /\ &0 <= --s <=> ~(&0 <= &1 - s /\ &0 <= --s) ==> + abs s * norm (v2 - v1) = abs (&1 - s) * norm (v1 - v2) + norm (v2 - v1)`] THEN + REWRITE_TAC[REAL_ARITH ` abs s * norm (v2 - v1) = abs (&1 - s) * norm (v1 - v2) + norm (v2 - v1) + <=> norm (v2 - v1) = abs s * norm (v2 - v1) - abs (&1 - s) * norm (v1 - v2)`] THEN + REWRITE_TAC[NORM_SUB] THEN + REWRITE_TAC[REAL_ARITH ` abs s * norm (v1 - v2) - abs (&1 - s) * norm (v1 - v2) = ( abs s - abs (&1 - s)) * norm (v1 - v2)`] THEN + DISCH_TAC THEN MATCH_MP_TAC(REAL_RING ` (abs s - abs (&1 - s)) = &1 ==> norm (v1 - v2) = (abs s - abs (&1 - s)) * norm (v1 - v2)`) THEN + REWRITE_TAC[REAL_ARITH ` abs (&1 - s) = abs (s - &1)`] THEN + MATCH_MP_TAC(REAL_ARITH ` abs s = s /\ abs (s - &1) = (s - &1) ==> abs s - abs (s - &1) = &1`) THEN REWRITE_TAC[REAL_ABS_REFL] THEN + UNDISCH_TAC `~(&0 <= &1 - s /\ &0 <= --s)` THEN UNDISCH_TAC ` ~(&0 <= s /\ &0 <= &1 - s)` THEN REAL_ARITH_TAC);; + +let c_inv_nov18 = prove (` ~(norm ( x:real^3 - v1:real^3) = norm (x - v2:real^3) + norm (v2 - v1)) /\ + ~(norm ( x - v2) = norm (x - v1) + norm (v2 - v1)) /\ + ~(norm ( v1 - v2) = norm ( x - v1) + norm (x - v2)) ==> ~(x IN affine hull {v1 , v2})`, MESON_TAC[c_nov18]);; + +let fa5 = prove( `!a:real b:real c:real. a >= &2 /\ a <= #2.51 /\ b >= &2 /\ b <= #2.51 /\ c >= &2 /\ c <= #2.51 + ==> ~(a = b + c) /\ ~(b = a + c) /\ ~(c = a + b)`, REAL_ARITH_TAC);; + +let c_nov18e = prove( `(!x:real^3 y:real^3. x IN (s:real^3->bool) /\ y IN s /\ ~(x = y) ==> norm (x - y) >= &2) /\ v0:real^3 IN s + ==> v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0) + ==> (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + (w IN s /\ norm (w - v0) < &2 * t0 /\ ~(w = v0)) /\ + ~(v = w) /\ norm (v - w) <= &2 * t0 \/ + (w IN s /\ norm (w - v0) < &2 * t0 /\ ~(w = v0)) /\ + (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + ~(w = v) /\ norm (w - v) <= &2 * t0 + ==> ~(w IN affine hull {v0, v})`, + REWRITE_TAC[MESON[NORM_SUB] ` (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + (w IN s /\ norm (w - v0) < &2 * t0 /\ ~(w = v0)) /\ + ~(v = w) /\ norm (v - w) <= &2 * t0 \/ + (w IN s /\ norm (w - v0) < &2 * t0 /\ ~(w = v0)) /\ + (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + ~(w = v) /\ norm (w - v) <= &2 * t0 <=> (w IN s /\ norm (w - v0) < &2 * t0 /\ ~(w = v0)) /\ + (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + ~(w = v) /\ norm (w - v) <= &2 * t0 `] THEN REPEAT STRIP_TAC THEN + UNDISCH_TAC ` w:real^3 IN affine hull {v0:real^3, v:real^3}` THEN + REWRITE_TAC[TAUT ` w IN affine hull {v0, v} ==> F <=> ~(w IN affine hull {v0, v})`] THEN + MATCH_MP_TAC(c_inv_nov18) THEN + UNDISCH_TAC ` !x:real^3 y:real^3. x IN (s:real^3->bool) /\ y IN s /\ ~(x = y) ==> norm (x - y) >= &2` THEN + UNDISCH_TAC ` v0:real^3 IN (s:real^3->bool)` THEN UNDISCH_TAC ` v:real^3 IN (s:real^3->bool)` THEN + UNDISCH_TAC ` w:real^3 IN (s:real^3->bool)` THEN UNDISCH_TAC ` norm (v:real^3 - v0) < &2 * t0` THEN + UNDISCH_TAC ` norm (w:real^3 - v0) < &2 * t0` THEN UNDISCH_TAC ` norm (w:real^3 - v) <= &2 * t0` THEN + UNDISCH_TAC ` ~(v:real^3 = v0)` THEN UNDISCH_TAC ` ~(w:real^3 = v0)` THEN UNDISCH_TAC ` ~(w:real^3 = v)` THEN + REWRITE_TAC[t0] THEN REWRITE_TAC[REAL_ARITH ` &2 * #1.255 = #2.51`] THEN REWRITE_TAC[NORM_SUB] THEN + REPEAT DISCH_TAC THEN MATCH_MP_TAC(fa5) THEN UNDISCH_TAC `norm (v0:real^3 - w) < #2.51` THEN + REWRITE_TAC[TAUT ` norm (v0 - w) < #2.51 + ==> norm (v0 - w) >= &2 /\ + norm (v0 - w) <= #2.51 /\ + norm (v - w) >= &2 /\ + norm (v - w) <= #2.51 /\ + norm (v - v0) >= &2 /\ + norm (v - v0) <= #2.51 + <=> (norm (v0 - w) < #2.51 + ==> norm (v0 - w) >= &2 /\ + norm (v - w) >= &2 /\ + norm (v - w) <= #2.51 /\ + norm (v - v0) >= &2 /\ + norm (v - v0) <= #2.51 ) /\ + (norm (v0 - w) < #2.51 + ==> norm (v0 - w) <= #2.51 )`] THEN + CONJ_TAC THENL[DISCH_TAC; REAL_ARITH_TAC] THEN UNDISCH_TAC ` norm (v:real^3 - v0) < #2.51` THEN + REWRITE_TAC[TAUT ` norm (v - v0) < #2.51 + ==> norm (v0 - w) >= &2 /\ + norm (v - w) >= &2 /\ + norm (v - w) <= #2.51 /\ + norm (v - v0) >= &2 /\ + norm (v - v0) <= #2.51 + <=> (norm (v - v0) < #2.51 + ==> norm (v0 - w) >= &2 /\ + norm (v - w) >= &2 /\ + norm (v - w) <= #2.51 /\ + norm (v - v0) >= &2 ) /\ + (norm (v - v0) < #2.51 + ==> norm (v - v0) <= #2.51 )`] THEN CONJ_TAC THENL[DISCH_TAC;REAL_ARITH_TAC] THEN + ASM_MESON_TAC[NORM_SUB]);; + +let c_nov18e1 = prove ( `((!x:real^3 y:real^3. x IN (s:real^3->bool) /\ y IN s /\ ~(x = y) ==> norm (x - y) >= &2) /\ v0:real^3 IN s ) /\ + (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + ((v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + (w IN s /\ norm (w - v0) < &2 * t0 /\ ~(w = v0)) /\ + ~(v = w) /\ norm (v - w) <= &2 * t0 \/ + (w IN s /\ norm (w - v0) < &2 * t0 /\ ~(w = v0)) /\ + (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + ~(w = v) /\ norm (w - v) <= &2 * t0 ) + ==> ~(w IN affine hull {v0, v})`, + REWRITE_TAC[TAUT ` ((!x y. x IN s /\ y IN s /\ ~(x = y) ==> norm (x - y) >= &2) /\ v0 IN s) /\ + (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + ((v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + (w IN s /\ norm (w - v0) < &2 * t0 /\ ~(w = v0)) /\ + ~(v = w) /\ + norm (v - w) <= &2 * t0 \/ + (w IN s /\ norm (w - v0) < &2 * t0 /\ ~(w = v0)) /\ + (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + ~(w = v) /\ + norm (w - v) <= &2 * t0) + ==> ~(w IN affine hull {v0, v}) + <=> + ((!x y. x IN s /\ y IN s /\ ~(x = y) ==> norm (x - y) >= &2) /\ v0 IN s) + ==> (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) + ==> ((v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + (w IN s /\ norm (w - v0) < &2 * t0 /\ ~(w = v0)) /\ + ~(v = w) /\ + norm (v - w) <= &2 * t0 \/ + (w IN s /\ norm (w - v0) < &2 * t0 /\ ~(w = v0)) /\ + (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + ~(w = v) /\ + norm (w - v) <= &2 * t0) + ==> ~(w IN affine hull {v0, v})`] THEN REWRITE_TAC[c_nov18e]);; + +let c_nov18e2 = prove( `center_pac (s:real^3->bool) (v0:real^3) ==> + (v:real^3 IN v_std s v0 + ==> {w | {v, w} IN e_std s v0} INTER affine hull {v0, v} = {})`, + DISCH_TAC THEN REWRITE_TAC[v_std;e_std;tru_pack] THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[SET_RULE ` u IN {x | x IN s /\ x IN open_ball v0 (&2 * t0)} DIFF {v0} <=> + u IN s /\ u IN open_ball v0 (&2 * t0) /\ ~(u = v0)`] THEN + REWRITE_TAC[open_ball] THEN REWRITE_TAC[SET_RULE ` v IN {y | norm (y - v0) < &2 * t0} <=> norm (v - v0) < &2 * t0 `] THEN + ONCE_REWRITE_TAC[SET_RULE ` {{u, v} | (u IN s /\ norm (u - v0) < &2 * t0 /\ ~(u = v0)) /\ + (v IN s /\ norm (v - v0) < &2 * t0 /\ ~(v = v0)) /\ + ~(u = v) /\ d3 u v <= &2 * t0} = + {{u, v'} | (u IN s /\ norm (u - v0) < &2 * t0 /\ ~(u = v0)) /\ + (v' IN s /\ norm (v' - v0) < &2 * t0 /\ ~(v' = v0)) /\ + ~(u = v') /\ d3 u v' <= &2 * t0}`] THEN + UNDISCH_TAC ` center_pac (s:real^3->bool) (v0:real^3)` THEN REWRITE_TAC[center_pac; packing_trg;d3;dist] THEN + REWRITE_TAC[SET_RULE ` {w | {v, w} IN + {{u, v'} | (u IN s /\ norm (u - v0) < &2 * t0 /\ ~(u = v0)) /\ + (v' IN s /\ norm (v' - v0) < &2 * t0 /\ ~(v' = v0)) /\ + ~(u = v') /\ norm (u - v') <= &2 * t0}} INTER affine hull {v0, v} = {} + <=> !w. w IN {w | {v, w} IN + {{u, v'} | (u IN s /\ norm (u - v0) < &2 * t0 /\ ~(u = v0)) /\ + (v' IN s /\ norm (v' - v0) < &2 * t0 /\ ~(v' = v0)) /\ + ~(u = v') /\ norm (u - v') <= &2 * t0}} + ==> ~(w IN affine hull {v0, v})`] THEN DISCH_TAC THEN DISCH_TAC THEN GEN_TAC THEN DISCH_TAC THEN + UNDISCH_TAC ` (!x:real^3 y:real^3. (s:real^3->bool) x /\ s y /\ ~(x = y) ==> norm (x - y) >= &2) /\ s (v0:real^3)` THEN + REWRITE_TAC[SET_RULE ` (s:real^3->bool) x <=> x IN s `] THEN REWRITE_TAC[SET_RULE `~(y IN (=) x) <=> ~(x = y)`] THEN DISCH_TAC THEN + UNDISCH_TAC `(w:real^3) IN + {w | {v:real^3, w} IN + {{u:real^3, v'} | (u IN (s:real^3->bool) /\ norm (u - v0:real^3) < &2 * t0 /\ ~(u = v0)) /\ + (v' IN s /\ norm (v' - v0) < &2 * t0 /\ ~(v' = v0)) /\ + ~(u = v') /\ norm (u - v') <= &2 * t0}}` THEN ONCE_REWRITE_TAC[IN_ELIM_THM] THEN + REWRITE_TAC[fa2] THEN REWRITE_TAC[SET_RULE ` {v, w} = {u, v'} <=> ( v = u /\ w = v') \/ (v = v' /\ w = u)`] THEN + REWRITE_TAC[TAUT ` ((u IN s /\ norm (u - v0) < &2 * t0 /\ ~(u = v0)) /\ + (v' IN s /\ norm (v' - v0) < &2 * t0 /\ ~(v' = v0)) /\ + ~(u = v') /\ norm (u - v') <= &2 * t0) /\ + (v = u /\ w = v' \/ v = v' /\ w = u) + <=> (((u IN s /\ norm (u - v0) < &2 * t0 /\ ~(u = v0)) /\ + (v' IN s /\ norm (v' - v0) < &2 * t0 /\ ~(v' = v0)) /\ + ~(u = v') /\ norm (u - v') <= &2 * t0) /\ + v = u /\ w = v') \/ (((u IN s /\ norm (u - v0) < &2 * t0 /\ ~(u = v0)) /\ + (v' IN s /\ norm (v' - v0) < &2 * t0 /\ ~(v' = v0)) /\ + ~(u = v') /\ norm (u - v') <= &2 * t0) /\ + v = v' /\ w = u)`] THEN DISCH_TAC THEN MATCH_MP_TAC(c_nov18e1) THEN ASM_MESON_TAC[]);; + +let c_nov18e3 = prove( `center_pac (s:real^3->bool) (v0:real^3) + ==> (v:real^3 IN v_std s v0 + ==> (!p q h. + {w | {v, w} IN e_std s v0} p /\ + {w | {v, w} IN e_std s v0} q /\ + p = q + h % (v0 - v) + ==> p = q)) /\ + (v IN v_std s v0 + ==> {w | {v, w} IN e_std s v0} INTER affine hull {v0, v} = {})`, + REWRITE_TAC[TAUT ` center_pac s v0 + ==> (v IN v_std s v0 + ==> (!p q h. + {w | {v, w} IN e_std s v0} p /\ + {w | {v, w} IN e_std s v0} q /\ + p = q + h % (v0 - v) + ==> p = q)) /\ + (v IN v_std s v0 + ==> {w | {v, w} IN e_std s v0} INTER affine hull {v0, v} = {}) + <=> ( center_pac s v0 + ==> (v IN v_std s v0 + ==> (!p q h. + {w | {v, w} IN e_std s v0} p /\ + {w | {v, w} IN e_std s v0} q /\ + p = q + h % (v0 - v) + ==> p = q))) /\ + ( center_pac s v0 + ==> (v IN v_std s v0 + ==> {w | {v, w} IN e_std s v0} INTER affine hull {v0, v} = {}))`] THEN + REWRITE_TAC[c_nov18e2;c_nov1_17]);; + +let fan3_lemma = prove(`!(v0:real^3) (s:real^3->bool). center_pac s v0 ==> fan3 (v0,v_std s v0,e_std s v0 )`, REPEAT GEN_TAC THEN + REWRITE_TAC[fan3;cyclic_set] THEN DISCH_TAC THEN GEN_TAC THEN + REWRITE_TAC[TAUT ` v IN v_std s v0 + ==> ~(v0 = v) /\ + FINITE {w | {v, w} IN e_std s v0} /\ + (!p q h. + {w | {v, w} IN e_std s v0} p /\ + {w | {v, w} IN e_std s v0} q /\ + p = q + h % (v0 - v) + ==> p = q) /\ + {w | {v, w} IN e_std s v0} INTER affine hull {v0, v} = {} <=> + ( v IN v_std s v0 ==> ~(v0 = v)) /\ ( v IN v_std s v0 ==> FINITE {w | {v, w} IN e_std s v0}) /\ + ( v IN v_std s v0 ==> (!p q h. + {w | {v, w} IN e_std s v0} p /\ + {w | {v, w} IN e_std s v0} q /\ + p = q + h % (v0 - v) + ==> p = q)) /\ + ( v IN v_std s v0 ==> {w | {v, w} IN e_std s v0} INTER affine hull {v0, v} = {})`] THEN + CONJ_TAC THENL[REWRITE_TAC[v_std;DIFF] THEN SET_TAC[]; ALL_TAC] THEN + CONJ_TAC THENL[REWRITE_TAC[e_std] THEN ONCE_REWRITE_TAC[SET_RULE `{{u, v} | u IN tru_pack v0 (&2 * t0) s DIFF {v0} /\ + v IN tru_pack v0 (&2 * t0) s DIFF {v0} /\ + ~(u = v) /\ + d3 u v <= &2 * t0} = {{x, y} | x IN tru_pack v0 (&2 * t0) s DIFF {v0} /\ + y IN tru_pack v0 (&2 * t0) s DIFF {v0} /\ + ~(x = y) /\ + d3 x y <= &2 * t0}`] THEN DISCH_TAC THEN ONCE_REWRITE_TAC[lemmaf3] THEN + MATCH_MP_TAC (lemmaf33) THEN MATCH_MP_TAC (fini_lemma) THEN + UNDISCH_TAC `center_pac (s:real^3->bool) (v0:real^3)` THEN REWRITE_TAC[infi_lemma2]; + UNDISCH_TAC `center_pac (s:real^3->bool) (v0:real^3)` THEN REWRITE_TAC[c_nov18e3]]);; + +(*=====================================================================*) +(* end of fan3_lemma*) +(*=====================================================================*) diff --git a/legacy/oldleg/collect_geom.ml b/legacy/oldleg/collect_geom.ml new file mode 100644 index 0000000..e89ff2d --- /dev/null +++ b/legacy/oldleg/collect_geom.ml @@ -0,0 +1,7385 @@ +needs "Multivariate/vectors.ml";; (* Eventually should load entire *) + + +(* let DOT_BASIS_BASIS_UNEQUAL = prove(`!i j. ~(i = j) ==> (basis i) dot (basis j) = &0`, + SIMP_TAC[basis; dot; LAMBDA_BETA] THEN ONCE_REWRITE_TAC[COND_RAND] THEN + SIMP_TAC[SUM_0; REAL_MUL_RZERO; REAL_MUL_LZERO; COND_ID]);; *) + +needs "Examples/analysis.ml";; (* multivariate-complex theory. *) +needs "Examples/transc.ml";; (* Then it won't need these three. *) +needs "convex_header.ml";; +needs "definitions_kepler.ml";; +needs "geomdetail.ml";; + +prioritize_real();; + +let ups_x = new_definition ` ups_x x1 x2 x6 = + --x1 * x1 - x2 * x2 - x6 * x6 + + &2 * x1 * x6 + + &2 * x1 * x2 + + &2 * x2 * x6 `;; +let rho = new_definition ` rho (x12 :real) x13 x14 x23 x24 x34 = + --(x14 * x14 * x23 * x23) - + x13 * x13 * x24 * x24 - + x12 * x12 * x34 * x34 + + &2 * + (x12 * x14 * x23 * x34 + + x12 * x13 * x24 * x34 + + x13 * x14 * x23 * x24) `;; +let chi = new_definition ` chi x12 x13 x14 x23 x24 x34 = + x13 * x23 * x24 + + x14 * x23 * x24 + + x12 * x23 * x34 + + x14 * x23 * x34 + + x12 * x24 * x34 + + x13 * x24 * x34 - + &2 * x23 * x24 * x34 - + x12 * x34 * x34 - + x14 * x23 * x23 - + x13 * x24 * x24 `;; +let delta = new_definition ` delta x12 x13 x14 x23 x24 x34 = + --(x12 * x13 * x23) - + x12 * x14 * x24 - + x13 * x14 * x34 - + x23 * x24 * x34 + + x12 * x34 * (--x12 + x13 + x14 + x23 + x24 - x34) + + x13 * x24 * (x12 - x13 + x14 + x23 - x24 + x34 ) + + x14 * x23 * ( x12 + x13 - x14 - x23 + x24 + x34 ) `;; + +let eta_v = new_definition ` eta_v v1 v2 (v3: real^N) = + let e1 = dist (v2, v3) in + let e2 = dist (v1, v3) in + let e3 = dist (v2, v1) in + e1 * e2 * e3 / sqrt ( ups_x (e1 pow 2 ) ( e2 pow 2) ( e3 pow 2 ) ) `;; + + +let max_real3 = new_definition ` max_real3 x y z = max_real (max_real x y ) z `;; +let ups_x_pow2 = new_definition` ups_x_pow2 x y z = ups_x ( x*x ) ( y * y) ( z * z)`;; +let plane_norm = new_definition ` + plane_norm p <=> + (?n v0. ~(n = vec 0) /\ p = {v | n dot (v - v0) = &0}) `;; + + +let delta_x34 = new_definition ` delta_x34 x12 x13 x14 x23 x24 x34 = +-- &2 * x12 * x34 + +(--x13 * x14 + + --x23 * x24 + + x13 * x24 + + x14 * x23 + + --x12 * x12 + + x12 * x14 + + x12 * x24 + + x12 * x13 + + x12 * x23) `;; + + +let plane_3p = new_definition `plane_3p (a:real^3) b c = + {x | ~collinear {a, b, c} /\ + (?ta tb tc. ta + tb + tc = &1 /\ x = ta % a + tb % b + tc % c)}`;; + + +(* end new_definition *) + +(* NGUYEN DUC PHUONG *) +(* Definition of Cayley – Menger square cm3 *) +let cm3_ups_x = new_definition `!(v1:real^3) (v2:real^3) (v3:real^3). + cm3_ups_x v1 v2 v3 = + (((v2 - v1)$2 * (v3 - v1)$3 ) - ((v2 - v1)$3 * (v3 - v1)$2)) pow 2 + + (((v2 - v1)$3 * (v3 - v1)$1 ) - ((v2 - v1)$1 * (v3 - v1)$3)) pow 2 + + (((v2 - v1)$1 * (v3 - v1)$2 ) - ((v2 - v1)$2 * (v3 - v1)$1)) pow 2 `;; + +(* Nguyen Tuyen Hoang, Nguyen Duc Phuong *) + +(* The polynomial ups can be expressed as a Cayley- Menger square *) + +let lemma_cm3 = prove (`!(x:real^3) y. +(x-y)$1 = x$1 - y$1 /\ (x-y)$2 = x$2 - y$2 /\ (x-y)$3 = x$3 - y$3`, + +(REPEAT GEN_TAC) THEN (REPEAT CONJ_TAC) THENL +[(MESON_TAC[VECTOR_SUB_COMPONENT;DIMINDEX_3;ARITH_RULE `1 <= 1 /\ 1 <= 3`]); +(MESON_TAC[VECTOR_SUB_COMPONENT;DIMINDEX_3;ARITH_RULE `1 <= 2 /\ 2 <= 3`]); +(MESON_TAC[VECTOR_SUB_COMPONENT;DIMINDEX_3;ARITH_RULE `1 <= 3 /\ 3 <= 3`])]);; + +let lemma7 = prove ( `! (v1 : real ^3)(v2: real^3)(v3:real^3). + cm3_ups_x v1 v2 v3 = + ups_x (norm (v1 -v2) pow 2) (norm (v2 -v3) pow 2) (norm (v3 -v1) pow 2) / &4`, + + (REPEAT GEN_TAC) THEN + (REWRITE_TAC[cm3_ups_x; ups_x]) THEN + (REWRITE_TAC[GSYM DOT_SQUARE_NORM;DOT_3;REAL_POW_2]) THEN + (REWRITE_TAC[lemma_cm3]) THEN + REAL_ARITH_TAC );; + +let pow_g = prove ( `! (x:real). &0 <= x pow 2`, + GEN_TAC THEN REWRITE_TAC[REAL_POW_2; REAL_LE_SQUARE]);; + +let lemma8 = prove ( `! (v1:real^3)(v2:real^3)(v3:real^3). +&0 <= ups_x (norm (v1 - v2) pow 2)(norm (v2 - v3) pow 2)(norm (v3 - v1) pow 2)`, + (REPEAT GEN_TAC) +THEN (MATCH_MP_TAC (REAL_ARITH `&0 <= a/ &4 ==> &0 <= a `)) +THEN (REWRITE_TAC[GSYM lemma7]) +THEN (REWRITE_TAC[cm3_ups_x]) + +THEN (ABBREV_TAC `(a:real) = (((v2:real^3) - v1)$2 * (v3 - v1)$3 - (v2 - v1)$3 * (v3 - v1)$2) pow 2`) +THEN (FIRST_X_ASSUM ((LABEL_TAC "1") o GSYM)) +THEN (ABBREV_TAC `(b:real) = (((v2:real^3) - v1)$3 * (v3 - v1)$1 - (v2 - v1)$1 * (v3 - v1)$3) pow 2`) +THEN (FIRST_X_ASSUM((LABEL_TAC "2") o GSYM)) +THEN (ABBREV_TAC `(c:real) = (((v2:real^3) - v1)$1 * (v3 - v1)$2 - (v2 - v1)$2 * (v3 - v1)$1) pow 2`) +THEN (FIRST_X_ASSUM((LABEL_TAC "3") o GSYM)) + +THEN (MATCH_MP_TAC (SPEC_ALL REAL_LE_ADD)) +THEN CONJ_TAC +THEN (ASM_REWRITE_TAC[pow_g]) +THEN (MATCH_MP_TAC (SPEC_ALL REAL_LE_ADD)) +THEN CONJ_TAC +THEN (ASM_REWRITE_TAC[pow_g]));; + +(* ========== *) +(* QUANG TRUONG *) +(* ============ *) +let GONTONG = REAL_RING ` ((a + b) + c = a + b + c ) `;; +let SUB_SUM_SUB = REAL_RING ` (a - ( b + c ) = a - b - c )/\( a - (b- c) = a - b + c )` ;; + +(* lemma 4, p 7 *) +let JVUNDLC = prove(`!a b c s. + s = (a + b + c) / &2 + ==> &16 * s * (s - a) * (s - b) * (s - c) = + ups_x (a pow 2) (b pow 2) (c pow 2)`, SIMP_TAC [ ups_x] THEN +REWRITE_TAC[REAL_FIELD` a / &2 - b = ( a - &2 * b ) / &2 `] THEN +REWRITE_TAC[REAL_FIELD ` &16 * ( a / &2 ) * ( b / &2 ) * (c / &2 ) * +( d / &2 ) = a * b * c * d `] THEN REAL_ARITH_TAC);; + +let SET_TAC = + let basicthms = + [NOT_IN_EMPTY; IN_UNIV; IN_UNION; IN_INTER; IN_DIFF; IN_INSERT; + IN_DELETE; IN_REST; IN_INTERS; IN_UNIONS; IN_IMAGE] in + let allthms = basicthms @ map (REWRITE_RULE[IN]) basicthms @ + [IN_ELIM_THM; IN] in + let PRESET_TAC = + TRY(POP_ASSUM_LIST(MP_TAC o end_itlist CONJ)) THEN + REPEAT COND_CASES_TAC THEN + REWRITE_TAC[EXTENSION; SUBSET; PSUBSET; DISJOINT; SING] THEN + REWRITE_TAC allthms in + fun ths -> + PRESET_TAC THEN + (if ths = [] then ALL_TAC else MP_TAC(end_itlist CONJ ths)) THEN + MESON_TAC[];; + + let SET_RULE tm = prove(tm,SET_TAC[]);; + +(* some TRUONG TACTICS *) + +let PHA = REWRITE_TAC[ MESON[] ` (a/\b)/\c <=> a/\ b /\ c `];; + +let NGOAC = REWRITE_TAC[ MESON[] ` a/\b/\c <=> (a/\b)/\c `];; + +let DAO = NGOAC THEN REWRITE_TAC[ MESON[]` a /\ b <=> b /\ a`];; + +let PHAT = REWRITE_TAC[ MESON[] ` (a\/b)\/c <=> a\/b\/c `];; + +let NGOACT = REWRITE_TAC[ GSYM (MESON[] ` (a\/b)\/c <=> a\/b\/c `)];; + +let KHANANG = PHA THEN REWRITE_TAC[ MESON[]` ( a\/ b ) /\ c <=> a /\ c \/ b /\ c `] THEN + REWRITE_TAC[ MESON[]` a /\ ( b \/ c ) <=> a /\ b \/ a /\ c `];; + +let ATTACH thm = MATCH_MP (MESON[]` ! a b. ( a ==> b ) ==> ( a <=> a /\ b )`) thm;; + +let NHANH tm = ONCE_REWRITE_TAC[ ATTACH (tm)];; +let STRIP_TR = REPEAT STRIP_TAC THEN REPEAT (FIRST_X_ASSUM MP_TAC) + THEN REWRITE_TAC[IMP_IMP] THEN PHA;; + + +let elimin = REWRITE_RULE[IN];; + +let CONV_EM = prove(`conv {} = {}:real^A->bool`, + REWRITE_TAC[conv;sgn_ge;affsign;UNION_EMPTY;FUN_EQ_THM;elimin +NOT_IN_EMPTY;lin_combo;SUM_CLAUSES] + THEN REAL_ARITH_TAC);; + +let CONV_SING = prove(`!u. conv {u:real^A} = {u}`, + REWRITE_TAC[conv;sgn_ge;affsign;FUN_EQ_THM;UNION_EMPTY;lin_combo;SUM_SING;VSUM_SING; + elimin IN_SING] THEN REPEAT GEN_TAC THEN + REWRITE_TAC[TAUT `(p <=> q) = ((p ==> q) /\ (q ==> p))`] THEN + REPEAT STRIP_TAC THENL [ASM_MESON_TAC[VECTOR_MUL_LID]; + ASM_REWRITE_TAC[]] THEN EXISTS_TAC `\ (v:real^A). &1` THEN + MESON_TAC[VECTOR_MUL_LID;REAL_ARITH `&0 <= &1`] );; + +let IN_ACT_SING = SET_RULE `! a x. ({a} x <=> a = x ) /\ ( x IN {a} <=> x = a) /\ {a} a`;; + +let IN_SET2 = SET_RULE `!a b x. + (x IN {a, b} <=> x = a \/ x = b) /\ ({a, b} x <=> x = a \/ x = b)`;; + +let SUM_DIS2 = prove(`! x y f. ~(x=y) ==> sum {x,y} f = f x + f y `,REWRITE_TAC[ + SET_RULE ` ~( x = y) + <=> ~(x IN {y})`] THEN MESON_TAC[ FINITE_RULES; SUM_CLAUSES; SUM_SING]);; + + +let VSUM_DIS2 = prove(` ! x y f. ~(x=y) ==> vsum {x,y} f = f x + f y`, REWRITE_TAC[ + SET_RULE ` ~( x = y) + <=> ~(x IN {y})`] THEN MESON_TAC[ FINITE_RULES; VSUM_CLAUSES; VSUM_SING]);; + +let NOV10 = prove(` ! x y. (x = y + ==> (!x. y = x <=> + (?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ x = a % y + b % y))) `, +REWRITE_TAC[GSYM VECTOR_ADD_RDISTRIB] THEN +REWRITE_TAC[ MESON[VECTOR_MUL_LID]` a + b = &1 /\ x = (a + b) % y <=> a + b = &1 /\ +x = y`]THEN REPEAT GEN_TAC THEN DISCH_TAC THEN GEN_TAC THEN NGOAC THEN +REWRITE_TAC[LEFT_EXISTS_AND_THM] THEN MATCH_MP_TAC (MESON[]` a ==> ( x = y <=> a /\ + y = x )`)THEN EXISTS_TAC `&0` THEN EXISTS_TAC ` &1` THEN REAL_ARITH_TAC);; + + +let TRUONG_LEMMA = prove + ( `!x y x':real^N. + (?f. x' = f x % x + f y % y /\ (&0 <= f x /\ &0 <= f y) /\ + f x + f y = &1) <=> + (?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ x' = a % x + b % y)` , + REPEAT GEN_TAC THEN EQ_TAC +THENL [MESON_TAC[]; STRIP_TAC] THEN + ASM_CASES_TAC `y:real^N = x` THENL + [EXISTS_TAC `\x:real^N. &1 / &2`; + EXISTS_TAC `\u:real^N. if u = x then (a:real) else b`] THEN + ASM_REWRITE_TAC[GSYM VECTOR_ADD_RDISTRIB] THEN + CONV_TAC REAL_RAT_REDUCE_CONV);; + +let CONV_SET2 = prove(` ! x y:real^A. conv {x,y} = {w | ? a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ + w = a%x + b%y}`, +ONCE_REWRITE_TAC[ MESON[] ` (! a b. P a b ) <=> ( ! a b. a = b \/ ~( a= b) + ==> P a b )`] THEN +REWRITE_TAC[ MESON[]` a \/ b ==> c <=> ( a==> c) /\ ( b==> c)`] THEN +SIMP_TAC[] THEN REWRITE_TAC[ SET_RULE ` {a,a} = {a}`; CONV_SING; FUN_EQ_THM; + IN_ELIM_THM] THEN REWRITE_TAC[ IN_ACT_SING] THEN REWRITE_TAC[NOV10] THEN +REWRITE_TAC[conv; sgn_ge; affsign; lin_combo] THEN +REWRITE_TAC[UNION_EMPTY; IN_SET2] THEN +ONCE_REWRITE_TAC[ MESON[]` ~(x = y) ==> (!x'. (?f. P f x') <=> l x') <=> + ~(x = y) ==> (!x'. (?f. ~(x=y) /\ P f x') <=> l x')`] THEN +REWRITE_TAC[ MESON[VSUM_DIS2; SUM_DIS2]` ~(x = y) /\x' = vsum {x, y} ff /\ l /\ +sum {x, y} f = &1 <=> ~(x = y) /\ x' = ff x + ff y /\ l /\ f x + f y = &1 `] THEN +REWRITE_TAC[ MESON[]` (!w. w = x \/ w = y ==> &0 <= f w) <=> &0 <= f x /\ &0 <= f y`] +THEN ONCE_REWRITE_TAC[ GSYM (MESON[]` ~(x = y) ==> (!x'. (?f. P f x') <=> l x') <=> + ~(x = y) ==> (!x'. (?f. ~(x=y) /\ P f x') <=> l x')`)] THEN +REPEAT GEN_TAC THEN DISCH_TAC THEN GEN_TAC THEN REWRITE_TAC[ TRUONG_LEMMA]);; + +let LE_OF_ZPGPXNN = prove(` ! a b v v1 v2 . &0 <= a /\ &0 <= b /\ a + b = &1 /\ + v = a % v1 + b % v2 ==> dist ( v,v1) + dist (v,v2) = dist(v1,v2)`, +SIMP_TAC[dist; REAL_ARITH ` a + b = &1 <=> b = &1 - a `] THEN +REWRITE_TAC[VECTOR_ARITH ` (a % v1 + (&1 - a) % v2) - v1 = ( a - &1 )%( v1 - v2)`] THEN +REWRITE_TAC[VECTOR_ARITH` (a % v1 + (&1 - a) % v2) - v2 = a % ( v1 - v2) `] THEN +SIMP_TAC[NORM_MUL; GSYM REAL_ABS_REFL] THEN REWRITE_TAC[ REAL_ARITH ` abs ( a - &1 ) + = abs ( &1 - a ) `] THEN REAL_ARITH_TAC);; + +let LENGTH_EQUA = prove(` ! v v1 v2. v IN conv {v1,v2} ==> dist (v,v1) + + dist (v,v2) = dist (v1,v2) `,REWRITE_TAC[CONV_SET2; IN_ELIM_THM] THEN +MESON_TAC[LE_OF_ZPGPXNN]);; + +let simp_def2 = new_axiom`(!a b v0. + aff_gt {a, b} {v0} = + {x | ?ta tb t. + ta + tb + t = &1 /\ &0 < t /\ x = ta % a + tb % b + t % v0} /\ + aff_ge {a, b} {v0} = + {x | ?ta tb t. + ta + tb + t = &1 /\ + &0 <= t /\ + x = ta % a + tb % b + t % v0}) /\ + (!x y z. + conv0 {x, y, z} = + {t | ?a b c. + a + b + c = &1 /\ + &0 < a /\ + &0 < b /\ + &0 < c /\ + t = a % x + b % y + c % z}) /\ + (!x y z. + affine hull {x, y, z} = + {t | ?a b c. a + b + c = &1 /\ t = a % x + b % y + c % z})/\ + (!v1 v2 v3. + aff_lt {v2, v3} {v1} = + {x | ?t2 t3 t1. + t2 + t3 + t1 = &1 /\ + t1 < &0 /\ + x = t2 % v2 + t3 % v3 + t1 % v1}) `;; + +(* lemma 10. p 14 *) +let ZPGPXNN = prove(`!v1 v2 v. dist (v1,v2) < dist (v,v1) + dist (v,v2) ==> + ~(v IN conv {v1, v2})`, +REWRITE_TAC[MESON[] `a ==> ~ b <=> ~(a /\ b )`] THEN REWRITE_TAC[CONV_SET2; IN_ELIM_THM] +THEN MESON_TAC[LE_OF_ZPGPXNN; REAL_ARITH ` a < b ==> ~ ( a = b ) `]);; + +let REDUCE_T2 = MESON[]` !P Q. + (!v1 v2 v3 t1 t2 t3. P v1 t1 v2 t2 v3 t3 <=> P v2 t2 v1 t1 v3 t3) /\ + (!v1 v2 v3. Q v1 v2 v3 <=> Q v2 v1 v3) /\ + (!v1 v2 v3 t1 t2 t3. + ~(t1 = &0 /\ t3 = &0) /\ P v1 t1 v2 t2 v3 t3 ==> Q v1 v2 v3) + ==> (!v1 v2 v3 t1 t2 t3. + ~(t1 = &0 /\ t2 = &0 /\ t3 = &0) /\ P v1 t1 v2 t2 v3 t3 + ==> Q v1 v2 v3)`;; + +let VEC_PER2_3 = VECTOR_ARITH `((a:real^N ) + b + c = b + a + c)/\ + ( (a:real^N ) + b + c = c + b + a )`;; +let PER2_IN3 = SET_RULE ` {a,b,c} = {b,a,c} /\ {a,b,c} = {c,b,a}`;; + +let REDUCE_T3 = MESON[]`!P Q. + (!v1 v2 v3 t1 t2 t3. P v1 t1 v2 t2 v3 t3 <=> P v3 t3 v2 t2 v1 t1) /\ + (!v1 v2 v3. Q v1 v2 v3 <=> Q v3 v2 v1) /\ + (!v1 v2 v3 t1 t2 t3. ~(t1 = &0) /\ P v1 t1 v2 t2 v3 t3 ==> Q v1 v2 v3) + ==> (!v1 v2 v3 t1 t2 t3. + ~(t1 = &0 /\ t3 = &0) /\ P v1 t1 v2 t2 v3 t3 ==> Q v1 v2 v3)`;; + + +let SUB_PACKING = prove(`!sub s. + packing s /\ sub SUBSET s + ==> (!x y. x IN sub /\ y IN sub /\ ~(x = y) ==> &2 <= d3 x y)`, +REWRITE_TAC[ packing; GSYM d3] THEN SET_TAC[]);; + + +let PAIR_EQ_EXPAND = + SET_RULE `{a,b} = {c,d} <=> a = c /\ b = d \/ a = d /\ b = c`;; + +let IN_SET3 = SET_RULE ` x IN {a,b,c} <=> x = a \/ x = b \/ x = c `;; +let IN_SET4 = SET_RULE ` x IN {a,b,c,d} <=> x = a \/ x = b \/ x = c \/ x = d `;; + +(* le 8. p 13 *) +let SGFCDZO = prove(`! (v1:real^3) v2 v3 t1 t2 t3. + t1 % v1 + t2 % v2 + t3 % v3 = vec 0 /\ + t1 + t2 + t3 = &0 /\ + ~(t1 = &0 /\ t2 = &0 /\ t3 = &0) + ==> collinear {v1, v2, v3}`, +ONCE_REWRITE_TAC[MESON[]` a /\ b/\c <=> c /\ a /\ b `] THEN +MATCH_MP_TAC REDUCE_T2 THEN +CONJ_TAC THENL [SIMP_TAC[VEC_PER2_3; REAL_ADD_AC]; CONJ_TAC THENL + [SIMP_TAC[PER2_IN3]; MATCH_MP_TAC REDUCE_T3]] THEN +CONJ_TAC THENL [SIMP_TAC[REAL_ADD_AC; VEC_PER2_3]; +CONJ_TAC THENL [SIMP_TAC[PER2_IN3]; REWRITE_TAC[]]] THEN +REPEAT GEN_TAC THEN REWRITE_TAC[collinear] THEN +STRIP_TAC THEN EXISTS_TAC `v2 - (v3:real^3)` THEN +ONCE_REWRITE_TAC[MESON[]` x IN s /\ y IN s <=> + ( x = y \/ ~ ( x = y))/\ x IN s /\ y IN s `] THEN +REWRITE_TAC[IN_SET3] THEN REPEAT GEN_TAC THEN +REWRITE_TAC[MESON[]` (a \/ b) /\ c ==> d <=> (a /\ c ==> d) /\ (b /\ c ==> d)`] +THEN CONJ_TAC THENL [DISCH_TAC THEN EXISTS_TAC `&0` THEN +FIRST_X_ASSUM MP_TAC THEN MATCH_MP_TAC (MESON[]` (a ==> c) ==> a /\ b ==> c `) THEN +MESON_TAC[VECTOR_MUL_LZERO; VECTOR_SUB_EQ]; STRIP_TAC] THENL [ + +ASM_MESON_TAC[] ; + +EXISTS_TAC ` t3 / t1 ` THEN ASM_SIMP_TAC[] THEN STRIP_TR THEN +ONCE_REWRITE_TAC[MESON[VECTOR_MUL_LCANCEL]` + ~(t1 = &0) /\ a ==> x = y <=> ~(t1 = &0) /\ a ==> t1 % x = t1 % y`] THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN SIMP_TAC[REAL_DIV_LMUL] THEN +ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN +REWRITE_TAC[ VECTOR_ARITH ` ( a + b + (c:real^N) ) - vec 0 = vec 0 <=> + a = -- ( b + c ) `; REAL_ARITH` a + b + c = &0 <=> a = -- ( b + c ) `] THEN +SIMP_TAC[VECTOR_SUB_LDISTRIB] THEN +MESON_TAC[VECTOR_ARITH ` --(t2 % v2 + t3 % v3) - --(t2 + t3) % v2 - + (t3 % v2 - t3 % v3) = vec 0`]; + +EXISTS_TAC ` ( -- t2 ) / t1 ` THEN ASM_SIMP_TAC[] THEN STRIP_TR THEN +ONCE_REWRITE_TAC[MESON[VECTOR_MUL_LCANCEL]` + ~(t1 = &0) /\ a ==> x = y <=> ~(t1 = &0) /\ a ==> t1 % x = t1 % y`] THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN SIMP_TAC[REAL_DIV_LMUL] THEN +ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN +REWRITE_TAC[ VECTOR_ARITH ` ( a + b + (c:real^N) ) - vec 0 = vec 0 <=> + a = -- ( b + c ) `; REAL_ARITH` a + b + c = &0 <=> a = -- ( b + c ) `] THEN +SIMP_TAC[VECTOR_SUB_LDISTRIB] THEN +MESON_TAC[VECTOR_ARITH ` --(t2 % v2 + t3 % v3) - --(t2 + t3) % v3 - + (--t2 % v2 - --t2 % v3) = vec 0`]; + + +EXISTS_TAC ` ( -- t3) / t1 ` THEN ASM_SIMP_TAC[] THEN STRIP_TR THEN +ONCE_REWRITE_TAC[MESON[VECTOR_MUL_LCANCEL]` + ~(t1 = &0) /\ a ==> x = y <=> ~(t1 = &0) /\ a ==> t1 % x = t1 % y`] THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN SIMP_TAC[REAL_DIV_LMUL] THEN +ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN +REWRITE_TAC[ VECTOR_ARITH ` ( a + b + (c:real^N) ) - vec 0 = vec 0 <=> + a = -- ( b + c ) `; REAL_ARITH` a + b + c = &0 <=> a = -- ( b + c ) `] THEN +SIMP_TAC[VECTOR_SUB_LDISTRIB] THEN MESON_TAC[VECTOR_ARITH ` --(t2 + t3) % v2 +- --(t2 % v2 + t3 % v3) - (--t3 % v2 - --t3 % v3) = vec 0`]; + + +ASM_MESON_TAC[]; + + +EXISTS_TAC ` &1 ` THEN ASM_SIMP_TAC[VECTOR_MUL_LID]; + + +EXISTS_TAC ` t2 / t1 ` THEN ASM_SIMP_TAC[] THEN STRIP_TR THEN +ONCE_REWRITE_TAC[MESON[VECTOR_MUL_LCANCEL]` + ~(t1 = &0) /\ a ==> x = y <=> ~(t1 = &0) /\ a ==> t1 % x = t1 % y`] THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN SIMP_TAC[REAL_DIV_LMUL] THEN +ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN +REWRITE_TAC[ VECTOR_ARITH ` ( a + b + (c:real^N) ) - vec 0 = vec 0 <=> + a = -- ( b + c ) `; REAL_ARITH` a + b + c = &0 <=> a = -- ( b + c ) `] THEN +SIMP_TAC[VECTOR_SUB_LDISTRIB] THEN +MESON_TAC[VECTOR_ARITH ` --(t2 + t3) % v3 - --(t2 % v2 + t3 % v3) - + (t2 % v2 - t2 % v3) = vec 0`]; + +EXISTS_TAC ` -- &1 ` THEN ASM_MESON_TAC[VECTOR_ARITH ` v3 - v2 = -- &1 % (v2 - v3)`]; + + +ASM_MESON_TAC[]]);; + + +(* le 2. p 6 *) +let RHUFIIB = prove( ` !x12 x13 x14 x23 x24 x34. + rho x12 x13 x14 x23 x24 x34 * ups_x x34 x24 x23 = + chi x12 x13 x14 x23 x24 x34 pow 2 + + &4 * delta x12 x13 x14 x23 x24 x34 * x34 * x24 * x23 `, +REWRITE_TAC[rho; chi; delta; ups_x] THEN REAL_ARITH_TAC);; + + +let RIGHT_END_POINT = prove( `!x aa bb. + (?a b. &0 < a /\ b = &0 /\ a + b = &1 /\ x = a % aa + b % bb) <=> x = aa`, +REPEAT GEN_TAC THEN EQ_TAC THENL [STRIP_TR THEN +REWRITE_TAC[ MESON[REAL_ARITH `b = &0 /\ a + b = &1 <=> b= &0 /\ a = &1 `]` + b = &0 /\ a + b = &1 /\ P a b <=> b = &0 /\ a = &1 /\ P (&1 ) ( &0 ) `] THEN +MESON_TAC[VECTOR_ARITH ` &1 % aa + &0 % bb = aa `]; +DISCH_TAC THEN EXISTS_TAC ` &1 ` THEN EXISTS_TAC ` &0 ` THEN +REWRITE_TAC[REAL_ARITH ` &0 < &1 /\ &1 + &0 = &1 `] THEN +ASM_MESON_TAC[VECTOR_ARITH ` &1 % aa + &0 % bb = aa `]]);; + +let LEFT_END_POINT = prove(` !x aa bb. + (?a b. a = &0 /\ &0 < b /\ a + b = &1 /\ x = &0 % aa + &1 % bb) + <=> x = bb `, +REWRITE_TAC[VECTOR_ARITH ` &0 % aa + &1 % bb = bb `] THEN +MESON_TAC[REAL_ARITH ` &0 = &0 /\ &0 < &1 /\ &0 + &1 = &1 `]);; + + +let CONV_CONV0 = prove(`! x a b. x IN conv {a,b} <=> x = a \/ x = b \/ x IN conv0 {a,b} `, +REWRITE_TAC[CONV_SET2; CONV0_SET2; IN_ELIM_THM] THEN +REWRITE_TAC[REAL_ARITH ` &0 <= a <=> a = &0 \/ &0 < a `] THEN +KHANANG THEN REWRITE_TAC[EXISTS_OR_THM] THEN +SIMP_TAC[MESON[REAL_ARITH ` ~(a = &0 /\ b = &0 /\ a + b = &1)`]` + ~(a = &0 /\ b = &0 /\ a + b = &1 /\ las )` ] THEN +REWRITE_TAC[MESON[REAL_ARITH ` a = &0 /\ a + b = &1 <=> a = &0 /\ b = &1 `]` + a = &0 /\ &0 < b /\ a + b = &1 /\ x = a % aa + b % ba <=> + a = &0 /\ &0 < b /\ a + b = &1 /\ x = &0 % aa + &1 % ba`] THEN +MESON_TAC[ RIGHT_END_POINT; LEFT_END_POINT]);; + + + + +let CON3_SUB_CONE3 = prove(` ! w1 v1 v2 v3. conv {v1, v2, v3} SUBSET cone w1 {v1,v2,v3}`, +REWRITE_TAC[CONV_SET3; cone; GSYM aff_ge_def; simp_def] THEN +REWRITE_TAC[ SET_RULE ` {x | p x} SUBSET {x | q x} <=> ( ! x. p x ==> q x)`] THEN +MESON_TAC[ REAL_ARITH ` &0 + a = a `; VECTOR_ARITH ` &0 % x + y = y `]);; + + + +let QHSEWMI = prove (` !v1 v2 v3 w1 w2. + ~(conv {w1, w2} INTER conv {v1, v2, v3} = {}) /\ + ~(w1 IN conv {v1, v2, v3}) + ==> w2 IN cone w1 {v1, v2, v3}`, +REWRITE_TAC[INTER_DIF_EM_EX] THEN REPEAT GEN_TAC THEN REWRITE_TAC[CONV_CONV0] THEN +STRIP_TAC THENL [ASM_MESON_TAC[]; +ASM_MESON_TAC[CON3_SUB_CONE3;SET_RULE`a SUBSET b <=> (! x. x IN a ==> x IN b )`]; +ASM_MESON_TAC[REWRITE_RULE[INTER_DIF_EM_EX] AFF_LE_CONE ]]);; + + +let GONTONG = REWRITE_TAC[REAL_ARITH ` ( a + b ) + c = a + b + c `];; + +(* le 27. p 20 *) +let MAEWNPU = prove(` ?b c. + !x12 x13 x14 x23 x24 x34. + delta x12 x13 x14 x23 x24 x34 = + --x12 * x34 pow 2 + + b x12 x13 x14 x23 x24 * x34 + + c x12 x13 x14 x23 x24 `, +REWRITE_TAC[delta; REAL_ARITH ` a - b = a + -- b `; + REAL_ARITH ` a * (b + c )= a * b + a * c ` ] THEN +REWRITE_TAC[REAL_ARITH ` a * b * -- c = -- a * b * c /\ -- ( a * b ) = -- a * b `] THEN +REWRITE_TAC[REAL_ARITH` x12 * x34 * x23 + x12 * x34 * x24 + + --x12 * x34 * x34 = x12 * x34 * x23 + x12 * x34 * x24 + + -- x12 * ( x34 pow 2 ) `] THEN +REWRITE_TAC[REAL_ARITH ` ( a + b ) + c = a + b + c `] THEN +REWRITE_TAC[REAL_ARITH ` a + b * c pow 2 + d = b * c pow 2 + a + d `] THEN +ONCE_REWRITE_TAC[REAL_ARITH `a + b + c + d + e = a + d + b + c + e `] THEN +REWRITE_TAC[REAL_ARITH ` a * b * c = ( a * b ) * c `] THEN +REPLICATE_TAC 30 ( ONCE_REWRITE_TAC[REAL_ARITH ` a * x pow 2 + b * x + d + e + = a * x pow 2 + b * x + e + d `] THEN GONTONG THEN REWRITE_TAC[ REAL_ARITH + ` a * x pow 2 + b * x + d * x + e = a * x pow 2 + ( b + d) * x + e`]) THEN +REPLICATE_TAC 50 ( ONCE_REWRITE_TAC[REAL_ARITH ` a * x pow 2 + b * x + d + e + = a * x pow 2 + b * x + e + d `] THEN GONTONG THEN ONCE_REWRITE_TAC[ REAL_ARITH ` a * x pow 2 + b * x + (d * x) * h + e + = a * x pow 2 + ( b + d * h ) * x + e`]) THEN +EXISTS_TAC ` (\ x12 x13 x14 x23 x24. --x13 * x14 + + --x23 * x24 + + x13 * x24 + + x14 * x23 + + --x12 * x12 + + x12 * x14 + + x12 * x24 + + x12 * x13 + + x12 * x23 ) ` THEN +EXISTS_TAC ` (\ x12 x13 x14 x23 x24. (x14 * x23) * x12 + + (x14 * x23) * x13 + + (--x14 * x23) * x14 + + (--x14 * x23) * x23 + + (x14 * x23) * x24 + + (--x12 * x13) * x23 + + (--x12 * x14) * x24 + + (x13 * x24) * x12 + + (--x13 * x24) * x13 + + (x13 * x24) * x14 + + (x13 * x24) * x23 + + (--x13 * x24) * x24 ) ` THEN +SIMP_TAC[]);; + +(* ----new ------- *) + +let DELTA_COEFS = new_specification ["b_coef"; "c_coef"] MAEWNPU;; + + +let DELTA_X34 = prove(` !x12 x13 x14 x23 x24 x34. + delta x12 x13 x14 x23 x24 x34 = + --x12 * x34 pow 2 + + (--x13 * x14 + + --x23 * x24 + + x13 * x24 + + x14 * x23 + + --x12 * x12 + + x12 * x14 + + x12 * x24 + + x12 * x13 + + x12 * x23) * + x34 + + (x14 * x23) * x12 + + (x14 * x23) * x13 + + (--x14 * x23) * x14 + + (--x14 * x23) * x23 + + (x14 * x23) * x24 + + (--x12 * x13) * x23 + + (--x12 * x14) * x24 + + (x13 * x24) * x12 + + (--x13 * x24) * x13 + + (x13 * x24) * x14 + + (x13 * x24) * x23 + + (--x13 * x24) * x24`, REWRITE_TAC[delta] THEN REAL_ARITH_TAC);; + +let C_COEF_FORMULA = prove(`! x12 x13 x14 x23 x24. c_coef x12 x13 x14 x23 x24 + = (x14 * x23) * x12 + + (x14 * x23) * x13 + + (--x14 * x23) * x14 + + (--x14 * x23) * x23 + + (x14 * x23) * x24 + + (--x12 * x13) * x23 + + (--x12 * x14) * x24 + + (x13 * x24) * x12 + + (--x13 * x24) * x13 + + (x13 * x24) * x14 + + (x13 * x24) * x23 + + (--x13 * x24) * x24`, MP_TAC DELTA_COEFS THEN +NHANH (MESON[]` (!x12 x13 x14 x23 x24 x34. p x12 x13 x14 x23 x24 x34) + ==> (! x12 x13 x14 x23 x24. p x12 x13 x14 x23 x24 (&0) ) `) THEN +REWRITE_TAC[DELTA_X34] THEN +REWRITE_TAC[REAL_ARITH ` &0 pow 2 = &0 `; REAL_MUL_RZERO; REAL_ADD_LID] THEN +SIMP_TAC[]);; + +let BC_DEL_FOR = prove(` ! x12 x13 x14 x23 x24. b_coef x12 x13 x14 x23 x24 = + --x13 * x14 + + --x23 * x24 + + x13 * x24 + + x14 * x23 + + --x12 * x12 + + x12 * x14 + + x12 * x24 + + x12 * x13 + + x12 * x23 /\ + c_coef x12 x13 x14 x23 x24 = + (x14 * x23) * x12 + + (x14 * x23) * x13 + + (--x14 * x23) * x14 + + (--x14 * x23) * x23 + + (x14 * x23) * x24 + + (--x12 * x13) * x23 + + (--x12 * x14) * x24 + + (x13 * x24) * x12 + + (--x13 * x24) * x13 + + (x13 * x24) * x14 + + (x13 * x24) * x23 + + (--x13 * x24) * x24 `, REWRITE_TAC[C_COEF_FORMULA] THEN +MP_TAC DELTA_COEFS THEN NHANH (MESON[]` (!x12 x13 x14 x23 x24 x34. +p x12 x13 x14 x23 x24 x34) + ==> (! x12 x13 x14 x23 x24. p x12 x13 x14 x23 x24 (&1) ) `) THEN +REWRITE_TAC[DELTA_X34; C_COEF_FORMULA] THEN +REWRITE_TAC[REAL_ARITH ` a + b + c = a + b' + c <=> b = b' `] THEN +SIMP_TAC[REAL_RING` a * &1 = a `]);; + +let AGBWHRD = prove(` !x12 x13 x14 x23 x24 x12 x13 x14 x23 x24. + b_coef x12 x13 x14 x23 x24 pow 2 + + &4 * x12 * c_coef x12 x13 x14 x23 x24 = + ups_x x12 x23 x13 * ups_x x12 x24 x14`, REWRITE_TAC[BC_DEL_FOR; ups_x] THEN +REAL_ARITH_TAC);; + + +let COLLINEAR_EX = prove(` ! x y (z:real^3) . collinear {x,y,z} <=> ( ? a b c. a + b + c = &0 /\ ~ ( a = &0 /\ +b = &0 /\ c = &0 ) /\ a % x + b % y + c % z = vec 0 ) `, +REWRITE_TAC[collinear] THEN +REPEAT GEN_TAC THEN +STRIP_TR THEN +EQ_TAC THENL [ +NHANH (SET_RULE` (!x' y'. x' IN {x, y, z} /\ y' IN {x, y, z} ==> P x' y' ) + ==> P x y /\ P x z `) THEN +STRIP_TR THEN +DISJ_CASES_TAC (MESON[]` c = &0 /\ c' = &0 \/ ~( c = &0 /\ c' = &0 ) `) THENL [ +ASM_SIMP_TAC[VECTOR_ARITH ` x - y = &0 % t <=> y = x`] THEN +DISCH_TAC THEN +EXISTS_TAC ` &1 ` THEN EXISTS_TAC ` &1 ` THEN +EXISTS_TAC ` -- &2 ` THEN +REWRITE_TAC[REAL_ARITH ` &1 + &1 + -- &2 = &0 /\ + ~(&1 = &0 /\ &1 = &0 /\ -- &2 = &0)`; VECTOR_ARITH` &1 % x + &1 % x + + -- &2 % x = vec 0`]; + + + +NHANH (MESON[VECTOR_MUL_LCANCEL]` x = c % u /\ + y = c' % u ==> c' % x = c' % (c % u) /\ c % y = c % c' % u `) THEN +REWRITE_TAC[VECTOR_ARITH ` x = c' % c % u /\ y = c % c' % u <=> + x = y /\ y = c % c' % u`] THEN +REWRITE_TAC[VECTOR_ARITH ` c' % (x - y) = c % (x - z) <=> (c - c' ) % x + c' % y + + -- c % z = vec 0 `] THEN +ASM_MESON_TAC[REAL_ARITH ` (( c - b ) + b + -- c = &0 ) /\ (~( c = &0 ) + <=> ~( -- c = &0 ))`]];REWRITE_TAC[GSYM collinear] THEN MESON_TAC[SGFCDZO]]);; + + +let MAX_REAL_LESS_EX = prove(`!x y a. max_real x y <= a <=> x <= a /\ y <= a`, +REWRITE_TAC[max_real; COND_EXPAND; COND_ELIM_THM;COND_RAND; COND_RATOR] THEN +REPEAT GEN_TAC THEN +MESON_TAC[REAL_ARITH ` (~ ( b < a ) /\ b <= c ==> a <= c)`; REAL_ARITH ` a < b /\ b <= c ==> a <= c `]);; + + +let MAX_REAL3_LESS_EX = prove(`! x y z a. max_real3 x y z <= a <=> x <= a /\ +y <= a /\ z <= a `, REWRITE_TAC[max_real3; MAX_REAL_LESS_EX] THEN MESON_TAC[]);; + + +MESON[]` (!x y z. + (P x y z <=> P y x z) /\ + (P x y z <=> P x z y) /\ + (Q x y z <=> Q y x z) /\ + (Q x y z <=> Q x z y)) /\ + (!x y z. P x y z ==> Q x y z) + ==> (!x y z. P x y z ==> Q x y z /\ Q y x z /\ Q z x y)`;; +(* ========== *) + +let UPS_X_SYM = prove(` ! x y z. ups_x x y z = ups_x y x z /\ + ups_x x y z = ups_x x z y `, REWRITE_TAC[ups_x] THEN REAL_ARITH_TAC);; + +let PER_MUL3 = REAL_ARITH ` a*b*c = b * a * c /\ a *b *c = a * c * b `;; + +let ETA_X_SYM = prove(` ! x y z. &0 <= x /\ &0 <= y /\ &0 <= z /\ &0 <= ups_x x y z ==> + eta_x x y z = eta_x y x z /\ eta_x x y z = eta_x x z y `, +REWRITE_TAC[eta_x] THEN +NHANH (MESON[UPS_X_SYM]` &0 <= ups_x x y z ==> &0 <= ups_x y x z + /\ &0 <= ups_x x z y `) THEN +NHANH (MESON[REAL_LE_MUL]`&0 <= x /\ &0 <= y /\ &0 <= z /\ las ==> + &0 <= x * y * z`) THEN +PHA THEN NHANH (MESON[REAL_LE_DIV; REAL_ARITH ` a * b * c = b * a * c + /\ a * b * c = a * c * b `]` + &0 <= ups_x x y z /\ &0 <= aa /\ &0 <= bb /\ &0 <= x * y * z + ==> &0 <= (x * y * z) / ups_x x y z /\ + &0 <= (y * x * z) / aa /\ + &0 <= (x * z * y) / bb`) THEN +SIMP_TAC[SQRT_INJ] THEN +MESON_TAC[UPS_X_SYM; PER_MUL3]);; + +let ETA_Y_SYM = prove(` ! x y z. &0 <= ups_x (x * x) (y * y) (z * z) ==> + eta_y x y z = eta_y y x z /\ eta_y x y z = eta_y x z y `, +REWRITE_TAC[eta_y] THEN REPEAT LET_TAC THEN MESON_TAC[ETA_X_SYM; REAL_LE_SQUARE]);; + + + +let ETA_Y_SYMM = MESON[UPS_X_SYM; ETA_Y_SYM]` ! x y z. &0 <= ups_x (x * x) (y * y) (z * z) + ==> eta_y x y z = eta_y x z y /\ + eta_y x y z = eta_y y x z /\ + eta_y x y z = eta_y z x y /\ + eta_y x y z = eta_y y z x /\ + eta_y x y z = eta_y z y x`;; + + +let IMPLY_POS = prove(`! x y z . &0 <= ups_x (x * x) (y * y) (z * z) ==> + &0 <= ((z * z) * (x * x) * y * y) / ups_x (z * z) (x * x) (y * y) /\ + &0 <= ((x * x) * (y * y) * z * z) / ups_x (x * x) (y * y) (z * z) /\ + &0 <= ((y * y) * (z * z) * x * x) / ups_x (y * y) (z * z) (x * x) `, MP_TAC + REAL_LE_SQUARE THEN MP_TAC REAL_LE_MUL THEN MESON_TAC[UPS_X_SYM; REAL_LE_DIV]);; + +let POW2_COND = MESON[REAL_ABS_REFL; REAL_LE_SQUARE_ABS]` ! a b. &0 <= a /\ &0 <= b ==> +( a <= b <=> a pow 2 <= b pow 2 ) `;; + + +let TRUONGG = prove(`! x y z. &0 < ups_x_pow2 z x y ==> + ((z * z) * (x * x) * y * y) / ups_x (z * z) (x * x) (y * y) - + z pow 2 / &4 = ( z pow 2 * (( z pow 2 - x pow 2 - y pow 2 ) pow 2 )) + / (&4 * ups_x_pow2 z x y )`, +REWRITE_TAC[ups_x; ups_x_pow2] THEN CONV_TAC REAL_FIELD);; + +let RE_TRUONGG = REWRITE_RULE[GSYM ups_x_pow2] TRUONGG;; + +let HVXIKHW = prove(` !x y z. + &0 <= x /\ &0 <= y /\ &0 <= z /\ &0 < ups_x_pow2 x y z + ==> max_real3 x y z / &2 <= eta_y x y z`, +REWRITE_TAC[REAL_ARITH` a / &2 <= b <=> a <= &2 * b `; MAX_REAL3_LESS_EX] THEN +REWRITE_TAC[eta_x; ups_x_pow2] THEN +NHANH (REAL_ARITH` &0 < a ==> &0 <= a `) THEN +DAO THEN REPEAT GEN_TAC THEN +REWRITE_TAC[MESON[ETA_Y_SYMM]` &0 <= ups_x (x * x) (y * y) (z * z) /\ las + ==> z <= &2 * eta_y x y z /\ x <= &2 * eta_y x y z /\ y <= &2 * eta_y x y z + <=> &0 <= ups_x (x * x) (y * y) (z * z) /\ las + ==> z <= &2 * eta_y z x y /\ x <= &2 * eta_y x y z /\ y <= &2 * eta_y y z x`] THEN +REWRITE_TAC[eta_y] THEN CONV_TAC (TOP_DEPTH_CONV let_CONV) THEN REWRITE_TAC[eta_x] +THEN NHANH (SPEC_ALL IMPLY_POS) THEN +NHANH (SPEC_ALL (prove(` ! a b x y. &0 <= a / b /\ &0 <= x /\ &0 <= y ==> + &0 <= &2 * sqrt ( a/b) /\ &0 <= &2 * sqrt x /\ &0 <= &2 * sqrt y `, +REWRITE_TAC[REAL_ARITH ` &0 <= &2 * a <=> &0 <= a `] THEN +SIMP_TAC[SQRT_WORKS]))) THEN SIMP_TAC[POW2_COND] THEN +REWRITE_TAC[REAL_ARITH ` x <= ( &2 * y ) pow 2 <=> x / &4 <= y pow 2 `] THEN +SIMP_TAC[ SQRT_POW_2] THEN REWRITE_TAC[ GSYM ups_x_pow2] THEN +REWRITE_TAC[REAL_FIELD` a / b <= c <=> &0 <= c - a / b `] THEN +SIMP_TAC[ups_x_pow2; UPS_X_SYM; RE_TRUONGG] THEN DAO THEN +MATCH_MP_TAC (MESON[]` (a4 ==> l) ==> (a1/\a2/\a3/\a4/\a5) ==> l `) THEN +MP_TAC REAL_LE_SQUARE THEN MP_TAC REAL_LE_MUL THEN MP_TAC REAL_LE_DIV THEN +REWRITE_TAC[GSYM REAL_POW_2] THEN MESON_TAC[REAL_ARITH ` &0 < a ==> &0 <= &4 * a `]);; + + +let EXISTS_INV = REAL_FIELD` ~( a = &0 ) <=> a * &1 / a = &1 /\ &1 / a * a = &1 `;; + + +let MIDDLE_POINT = prove(` ! x y (z:real^3) . collinear {x,y,z} ==> x IN conv {y,z} \/ +y IN conv {x,z} \/ z IN conv {x,y} `, REWRITE_TAC[COLLINEAR_EX] THEN REPEAT +GEN_TAC THEN +MATCH_MP_TAC (prove(`(!(a:real) (b:real) (c:real). P a b c <=> P (--a) (--b) (--c)) /\ + ((?a b c. &0 <= a /\ P a b c) ==> l) ==> ( ? a b c. P a b c ) ==> l `, + DISCH_TAC THEN ASM_MESON_TAC[REAL_ARITH ` ! a. a <= &0 \/ &0 <= a`; + REAL_ARITH ` a <= &0 <=> &0 <= -- a `])) THEN +CONJ_TAC THENL [MESON_TAC[REAL_ARITH` a = &0 <=> -- a = &0 `; REAL_ARITH ` a + b + c = &0 + <=> --a + --b + --c = &0`; VECTOR_ARITH ` a % x + b % y + c % z = vec 0 + <=> --a % x + --b % y + --c % z = vec 0 `]; STRIP_TAC] THEN +DISJ_CASES_TAC (REAL_ARITH ` &0 < b \/ b <= &0`) THENL +[STRIP_TR THEN REWRITE_TAC[VECTOR_ARITH ` a + b + c % z = vec 0 <=> + --c % z = a + b `] THEN +NHANH (MESON[VECTOR_MUL_LCANCEL]` a % x = y ==> (&1 / a) % a % x = &1 / a % y `) THEN +REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC] THEN +REWRITE_TAC[MESON[]` a1/\a2/\a3/\a4/\a5 ==> l <=> a1 /\ a5 /\ a2 ==> + a3/\a4 ==> l `] THEN +NHANH (REAL_FIELD ` &0 <= a /\ &0 < b /\ a + b + c = &0 ==> + a / ( -- c ) + b /( -- c ) = &1 /\ ~ ( -- c = &0 )/\ &0 < -- c `) THEN +SIMP_TAC[EXISTS_INV] THEN +ONCE_REWRITE_TAC[MESON[POS_EQ_INV_POS]` a /\ &0 < c <=> a /\ &0 < &1 / c `] THEN +REWRITE_TAC[VECTOR_MUL_LID; CONV_SET2; IN_ELIM_THM; GSYM (REAL_ARITH` a / b = + &1 / b * a `)] THEN +ONCE_REWRITE_TAC[REAL_ARITH` a / b = &1 / b * a `] THEN +MP_TAC (GEN_ALL (MESON[REAL_ARITH`( a * &1 = a ) /\ ( &0 < a ==> &0 <= a )`; + REAL_LE_MUL]` &0 < &1 / c * &1 /\ ( &0 <= a \/ &0 < a ) ==> &0 <= &1 / c * a `)) THEN +MESON_TAC[]; STRIP_TR THEN +NHANH (MESON[REAL_ARITH` &0 <= c \/ c <= &0`]` a + b + v = &0 ==> + &0 <= v \/ v <= &0 `) THEN +REWRITE_TAC[MESON[]` a1/\(a2 /\ (aa\/ bb))/\ dd <=> + (aa\/bb) /\ a1/\a2/\dd`] THEN SPEC_TAC (`a:real`, `a:real`) THEN +SPEC_TAC (`b:real`, `b:real`) THEN SPEC_TAC (`c:real`, `c:real`) THEN +KHANANG THEN REWRITE_TAC[(prove( `&0 <= c /\ &0 <= a /\ a + b + c = &0 /\ + ~(a = &0 /\ b = &0 /\ c = &0) /\ a % x + b % y + c % z = vec 0 /\ + b <= &0 <=> --a <= &0 /\ &0 <= --b /\ --b + --c + --a = &0 /\ + ~(--b = &0 /\ --c = &0 /\ --a = &0) /\ --b % y + --c % z + -- a % x = vec 0 /\ + --c <= &0`, MESON_TAC[ +REAL_ARITH ` (a = &0 <=> --a = &0) /\ ( b <= &0 <=> &0 <= -- b ) /\ + (&0 <= a <=> --a <= &0) /\ + (a + b + c = &0 <=> --b + --c + -- a = &0)`; +VECTOR_ARITH` a % x + b % y + c % z = vec 0 <=> + --b % y + --c % z + --a % x = vec 0 `]))] THEN +REWRITE_TAC[MESON[]` a \/ b ==> c <=> (a ==> c) /\(b==>c)`] THEN +REWRITE_TAC[MESON[REAL_ARITH `&0 <= a <=> a = &0 \/ &0 < a `]` + c <= &0 /\ &0 <= a /\ l <=> ( a = &0 \/ &0 < a ) /\ c <= &0 /\ l`] THEN +KHANANG THEN +REWRITE_TAC[MESON[REAL_ARITH `a = &0 /\ c <= &0 /\ a + b + c = &0 /\ b <= &0 + ==> a = &0 /\ b = &0 /\ c = &0`]`a = &0 /\ c <= &0 /\ + a + b + c = &0 /\ ~(a = &0 /\ b = &0 /\ c = &0) /\a2/\ b <= &0 <=> F `] THEN +NHANH (MESON[REAL_FIELD ` &0 < a /\ + a + b + c = &0 ==> -- b / a + -- c / a = &1 `]`&0 < a /\ c <= &0 /\ + a + b + c = &0 /\ l ==> --b / a + --c / a = &1 `) THEN +REWRITE_TAC[VECTOR_ARITH ` a % x + b % y + c % z = vec 0 <=> + a % x = -- b % y + -- c % z `] THEN +NHANH (MESON[VECTOR_MUL_LCANCEL]` a % x = y ==> &1 / a % a % x = &1 / a % y `) THEN +REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; REAL_ARITH ` &1 / a * b + = b / a `;VECTOR_MUL_LID ] THEN PHA THEN +PURE_ONCE_REWRITE_TAC[MESON[REAL_FIELD ` &0 < a ==> a / a = &1`]` + &0 < a /\ P ( a / a) <=> &0 < a /\ P ( &1 ) `] THEN +REWRITE_TAC[VECTOR_MUL_LID ] THEN +REWRITE_TAC[MESON[SET_RULE ` {a,b} = {b,a}`]` y IN conv {x, z} \/ z IN conv {x, y} + <=> y IN conv {z,x} \/ z IN conv {x,y} `] THEN +REWRITE_TAC[CONV_SET2; IN_ELIM_THM] THEN +REWRITE_TAC[ REAL_ARITH ` a <= &0 <=> &0 <= -- a `] THEN +MESON_TAC[REAL_LE_DIV; REAL_ARITH ` &0 < a ==> &0 <= a `]]);; + +(* +let REAL_SQRTSOSFIELD = + let inv_tm = `inv:real->real` + and sqrt_tm = `sqrt:real->real` in + let prenex_conv = + TOP_DEPTH_CONV BETA_CONV THENC + PURE_REWRITE_CONV[FORALL_SIMP; EXISTS_SIMP; real_div; + REAL_INV_INV; REAL_INV_MUL; GSYM REAL_POW_INV] THENC + NNFC_CONV THENC DEPTH_BINOP_CONV `(/\)` CONDS_CELIM_CONV THENC + PRENEX_CONV + and setup_conv = NNF_CONV THENC WEAK_CNF_CONV THENC CONJ_CANON_CONV + and core_rule t = + try REAL_ARITH t + with Failure _ -> try REAL_RING t + with Failure _ -> REAL_SOS t + and is_inv = + let is_div = is_binop `(/):real->real->real` in + fun tm -> (is_div tm or (is_comb tm & rator tm = inv_tm)) & + not(is_ratconst(rand tm)) + and is_sqrt tm = is_comb tm & rator tm = sqrt_tm in + let SQRT_HYP_THM = prove + (`!x. &0 <= x ==> &0 <= sqrt x /\ (sqrt x) * (sqrt x) = x`, + MESON_TAC[SQRT_POS_LE; SQRT_POW_2; REAL_POW_2]) in + let BASIC_REAL_FIELD tm = + let is_freeinv t = is_inv t & free_in t tm + and is_freesqrt t = is_sqrt t & free_in t tm in + let itms = setify(map rand (find_terms is_freeinv tm)) in + let hyps = map (fun t -> SPEC t REAL_MUL_RINV) itms in + let tm' = itlist (fun th t -> mk_imp(concl th,t)) hyps tm in + let itms' = map (curry mk_comb inv_tm) itms in + let gvs = map (genvar o type_of) itms' in + let tm'' = subst (zip gvs itms') tm' in + let stms = setify(map rand (find_terms is_freesqrt tm'')) in + let syps = map (fun t -> SPEC t SQRT_HYP_THM) stms in + let tm''' = itlist (fun th t -> mk_imp(concl th,t)) syps tm'' in + let stms' = map (curry mk_comb sqrt_tm) stms in + let hvs = map (genvar o type_of) stms' in + let tm'''' = subst (zip hvs stms') tm''' in + let th1 = setup_conv tm'''' in + let cjs = conjuncts(rand(concl th1)) in + let ths = map core_rule cjs in + let th2 = EQ_MP (SYM th1) (end_itlist CONJ ths) in + rev_itlist (C MP) (syps @ hyps) + (INST (zip itms' gvs @ zip stms' hvs) th2) in + fun tm -> + let th0 = prenex_conv tm in + let tm0 = rand(concl th0) in + let avs,bod = strip_forall tm0 in + let th1 = setup_conv bod in + let ths = map BASIC_REAL_FIELD (conjuncts(rand(concl th1))) in + EQ_MP (SYM th0) (GENL avs (EQ_MP (SYM th1) (end_itlist CONJ ths)));; + +*) +let IN_CONV_COLLINEAR = prove(` ! (v:real^3) v1 v2. v IN conv {v1,v2} ==> +collinear {v,v1,v2} `, REWRITE_TAC[COLLINEAR_EX] THEN +REWRITE_TAC[COLLINEAR_EX; CONV_SET2; IN_ELIM_THM] THEN +REWRITE_TAC[VECTOR_ARITH ` v = a % v1 + b % v2 <=> + &1 % v + -- a % v1 + -- b % v2 = vec 0 `] THEN +MESON_TAC[REAL_ARITH `~ ( &1 = &0 ) /\ (a + b = &1 <=> &1 + --a + --b = &0 )`]);; + +let COLLINERA_AS_IN_CONV2 = prove(` ! x y (z:real^3) . collinear {x,y,z} <=> +x IN conv {y,z} \/ +y IN conv {x,z} \/ z IN conv {x,y}`, +MESON_TAC[PER_SET3; IN_CONV_COLLINEAR; MIDDLE_POINT]);; + + +let LENGTH_EQ_EX = prove(`!v v1 v2. + dist (v1,v) + dist (v,v2) = dist (v1,v2) <=> + ~(dist (v1,v2) < dist (v1,v) + dist (v,v2))`, +REPEAT GEN_TAC THEN +REWRITE_TAC[REAL_ARITH ` ~( a < b) <=> b <= a `] THEN +EQ_TAC THENL [REAL_ARITH_TAC; +NHANH (MESON[DIST_TRIANGLE]` dist (v1,v) + dist (v,v2) <= dist (v1,v2) + ==> dist(v1,v2) <= dist (v1,v) + dist (v,v2)`) THEN +REAL_ARITH_TAC]);; + + +let BETWEEN_IMP_IN_CONVEX_HULL = new_axiom` !v v1 v2. dist(v1,v) + dist(v,v2) = +dist(v1,v2) + ==> (?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ v = a % v1 + b % v2)`;; +(* HARRISON have proved this lemma as following, but it must be loaded after convex.ml *) +(* let BETWEEN_IFF_IN_CONVEX_HULL = prove + (`!v v1 v2:real^N. + dist(v1,v) + dist(v,v2) = dist(v1,v2) <=> v IN convex hull {v1,v2}`, + REPEAT GEN_TAC THEN ASM_CASES_TAC `v1:real^N = v2` THENL + [ASM_REWRITE_TAC[INSERT_AC; CONVEX_HULL_SING; IN_SING] THEN NORM_ARITH_TAC; + REWRITE_TAC[CONVEX_HULL_2_ALT; IN_ELIM_THM] THEN EQ_TAC THENL + [DISCH_TAC THEN EXISTS_TAC `dist(v1:real^N,v) / dist(v1,v2)` THEN + ASM_SIMP_TAC[REAL_LE_LDIV_EQ; REAL_LE_RDIV_EQ; DIST_POS_LT] THEN CONJ_TAC + THENL [FIRST_ASSUM(SUBST1_TAC o SYM) THEN NORM_ARITH_TAC; ALL_TAC] THEN + MATCH_MP_TAC VECTOR_MUL_LCANCEL_IMP THEN + EXISTS_TAC `dist(v1:real^N,v2)` THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; VECTOR_ADD_LDISTRIB; REAL_SUB_LDISTRIB; + REAL_DIV_LMUL; DIST_EQ_0] THEN + FIRST_ASSUM(MP_TAC o GEN_REWRITE_RULE I [DIST_TRIANGLE_EQ] o SYM) THEN + FIRST_ASSUM(SUBST1_TAC o SYM) THEN + REWRITE_TAC[dist; REAL_ARITH `(a + b) * &1 - a = b`] THEN + VECTOR_ARITH_TAC; + STRIP_TAC THEN ASM_REWRITE_TAC[dist] THEN + REWRITE_TAC[VECTOR_ARITH `a - (a + b:real^N) = --b`; + VECTOR_ARITH `(a + u % (b - a)) - b = (&1 - u) % (a - b)`; + NORM_NEG; NORM_MUL; GSYM REAL_ADD_LDISTRIB] THEN + REWRITE_TAC[NORM_SUB] THEN REPEAT(POP_ASSUM MP_TAC) THEN + CONV_TAC REAL_FIELD]]);; + +From this, your version follows easily: + + let BETWEEN_IMP_IN_CONVEX_HULL = prove + (`!v v1 v2. dist(v1,v) + dist(v,v2) = dist(v1,v2) + ==> (?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ + v = a % v1 + b % v2)`, + REWRITE_TAC[BETWEEN_IFF_IN_CONVEX_HULL; CONVEX_HULL_2; IN_ELIM_THM] THEN + REWRITE_TAC[CONJ_ASSOC]);; +*) + + + +let PRE_HE = prove(` ! x y z. let p = ( x + y + z ) / &2 in + ups_x_pow2 x y z = &16 * p * ( p - x ) * ( p - y ) * ( p - z ) `, +CONV_TAC (TOP_DEPTH_CONV let_CONV) THEN +REWRITE_TAC[ups_x_pow2; ups_x] THEN REAL_ARITH_TAC);; + +let PRE_HER = prove(`!x y z. + ups_x_pow2 x y z = + &16 * + (x + y + z) / &2 * + ((x + y + z) / &2 - x) * + ((x + y + z) / &2 - y) * + ((x + y + z) / &2 - z)`, +REWRITE_TAC[ups_x_pow2; ups_x] THEN REAL_ARITH_TAC);; + + +let TRIVIVAL_LE = prove(`!v1 v2 v3. + ~(v2 = v3 /\ v1 = v2) + ==> ~(dist (v1,v2) + dist (v1,v3) + dist (v2,v3) = &0)`, +SIMP_TAC[DE_MORGAN_THM; DIST_NZ] THEN +NHANH (MESON[DIST_POS_LE]`&0 < dist (v2,v3) \/ &0 < dist (v1,v2) ==> + &0 <= dist(v1,v3) `) THEN MP_TAC DIST_POS_LE THEN KHANANG THEN +REWRITE_TAC[OR_IMP_EX] THEN +NHANH (MESON[DIST_POS_LE]`&0 < dist (v2,v3) /\ &0 <= dist (v1,v3) + ==> &0 <= dist(v1,v2) `) THEN +SIMP_TAC[REAL_ARITH`( &0 < a /\ &0 <= b ) /\ &0 <= c ==> ~(c + b + a = &0 ) `] THEN +NHANH (MESON[DIST_POS_LE]`&0 < dist (v1,v2) /\ &0 <= dist (v1,v3) ==> + &0 <= dist(v2,v3) `) THEN +MESON_TAC[REAL_ARITH ` &0 < a /\ &0 <= b /\ &0 <= c ==> ~( a + b + c = &0 ) `]);; + + + +let MID_COND = prove(` ! v v1 v2. v IN conv {v1,v2} <=> dist(v1,v) + dist(v,v2) + = dist(v1,v2) `, REPEAT GEN_TAC THEN EQ_TAC THENL [MESON_TAC[LENGTH_EQUA; DIST_SYM]; +REWRITE_TAC[CONV_SET2; IN_ELIM_THM] THEN +MESON_TAC[DIST_SYM; BETWEEN_IMP_IN_CONVEX_HULL]]);; + + +(* lemma 9. p 13 *) +let FHFMKIY = prove(`!(v1:real^3) v2 v3 x12 x13 x23. + x12 = dist (v1,v2) pow 2 /\ + x13 = dist (v1,v3) pow 2 /\ + x23 = dist (v2,v3) pow 2 + ==> (collinear {v1, v2, v3} <=> ups_x x12 x13 x23 = &0)`, +REPEAT STRIP_TAC THEN ASM_SIMP_TAC[] THEN REWRITE_TAC[COLLINERA_AS_IN_CONV2] + THEN REWRITE_TAC[REAL_ARITH ` x pow 2 = x * x `; GSYM ups_x_pow2] THEN +REWRITE_TAC[PRE_HER] THEN REWRITE_TAC[REAL_ENTIRE] THEN +ONCE_REWRITE_TAC[MESON[]`( v1 IN conv {v2, v3} \/ a \/ b <=> l ) <=> +(v1 = v2 /\ v1 = v3 ) \/ ~(v1 = v2 /\ v1 = v3) ==> ( v1 IN conv {v2, v3} +\/ a \/ b <=> l )`] THEN REWRITE_TAC[OR_IMP_EX] THEN +SIMP_TAC[DIST_SYM; DIST_REFL; MESON[]` a= b/\ a= c <=> b = c /\ a= b`] THEN +SIMP_TAC[SET_RULE ` {a,a} = {a} /\ a IN {a} `; CONV_SING; + REAL_ARITH ` (&0 + &0 + &0)/ &2 = &0 `] THEN SIMP_TAC[ TRIVIVAL_LE; +REAL_ARITH `~( &16 = &0) /\(~( a = &0) ==> ~( a / &2 = &0))`] THEN +REWRITE_TAC[REAL_ARITH ` (a+ b + c ) / &2 - a = &0 <=> b + c = a `] THEN +REWRITE_TAC[REAL_ARITH ` (a+ b + c ) / &2 - b = &0 <=> c + a = b `] THEN +REWRITE_TAC[REAL_ARITH ` (a+ b + c ) / &2 - c = &0 <=> a + b = c `] THEN +REWRITE_TAC[MESON[SET_RULE `{a,b} = {b,a} `]`v2 IN conv {v1, v3} \/ v3 IN +conv {v1, v2} <=> v2 IN conv {v3,v1} \/ v3 IN conv {v1, v2}`] THEN +REWRITE_TAC[MID_COND] THEN MESON_TAC[DIST_SYM]);; + +(* le 11. p 14 *) +(* NGUYEN QUANG TRUONG *) + + +(* These following lemma are Multivariate/convex.ml *) +let AFFINE_HULL_EXPLICIT = new_axiom` + !p. affine hull p = + {y | ?s u. + FINITE s /\ + ~(s = {}) /\ + s SUBSET p /\ + sum s u = &1 /\ + vsum s (\v. u v % v) = y}` ;; + +let affine_dependent = new_definition + `affine_dependent (s:real^N -> bool) <=> + ?x. x IN s /\ x IN (affine hull (s DELETE x))`;; + +let AFFINE_DEPENDENT_EXPLICIT_FINITE = new_axiom +`!s. FINITE(s:real^N -> bool) + ==> (affine_dependent s <=> + ?u. sum s u = &0 /\ + (?v. v IN s /\ ~(u v = &0)) /\ + vsum s (\v. u v % v) = vec 0)`;; + + let AFFINE_HULL_FINITE = prove + (`!s:real^N->bool. + FINITE s + ==> affine hull s = {y | ?u. sum s u = &1 /\ vsum s (\v. u v % v) = y}`, + GEN_TAC THEN DISCH_TAC THEN + REWRITE_TAC[EXTENSION; AFFINE_HULL_EXPLICIT; IN_ELIM_THM] THEN + X_GEN_TAC `x:real^N` THEN EQ_TAC THEN REWRITE_TAC[LEFT_IMP_EXISTS_THM] THENL + [MAP_EVERY X_GEN_TAC [`t:real^N->bool`; `f:real^N->real`] THEN + STRIP_TAC THEN + EXISTS_TAC `\x:real^N. if x IN t then f x else &0` THEN + REWRITE_TAC[] THEN ONCE_REWRITE_TAC[COND_RAND] THEN + ONCE_REWRITE_TAC[COND_RATOR] THEN REWRITE_TAC[VECTOR_MUL_LZERO] THEN + ASM_SIMP_TAC[GSYM VSUM_RESTRICT_SET; GSYM SUM_RESTRICT_SET] THEN + ASM_SIMP_TAC[SET_RULE `t SUBSET s ==> {x | x IN s /\ x IN t} = t`]; + X_GEN_TAC `f:real^N->real` THEN + ASM_CASES_TAC `s:real^N->bool = {}` THEN + ASM_REWRITE_TAC[SUM_CLAUSES; REAL_OF_NUM_EQ; ARITH] THEN STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`s:real^N->bool`; `f:real^N->real`] THEN + ASM_REWRITE_TAC[GSYM EXTENSION; SUBSET_REFL]]);; + + let IN_AFFINE_HULL_IMP_COLLINEAR = prove + (`!a b c:real^N. a IN (affine hull {b,c}) ==> collinear {a,b,c}`, + REPEAT GEN_TAC THEN MAP_EVERY ASM_CASES_TAC + [`a:real^N = b`; `a:real^N = c`; `b:real^N = c`] THEN + TRY(ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_SING; COLLINEAR_2] THEN NO_TAC) THEN + SIMP_TAC[AFFINE_HULL_FINITE; FINITE_INSERT; FINITE_SING] THEN + SIMP_TAC[SUM_CLAUSES; VSUM_CLAUSES; FINITE_RULES; REAL_ADD_RID] THEN + ASM_REWRITE_TAC[IN_INSERT; IN_ELIM_THM; NOT_IN_EMPTY; VECTOR_ADD_RID] THEN + DISCH_THEN(X_CHOOSE_THEN `f:real^N->real` STRIP_ASSUME_TAC) THEN + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {c,b,a}`] THEN + ASM_REWRITE_TAC[COLLINEAR_3; COLLINEAR_LEMMA; VECTOR_SUB_EQ] THEN + EXISTS_TAC `(f:real^N->real) c` THEN EXPAND_TAC "a" THEN + FIRST_X_ASSUM(SUBST1_TAC o MATCH_MP (REAL_ARITH + `b + c = &1 ==> b = &1 - c`)) THEN VECTOR_ARITH_TAC);; + + + let AFFINE_DEPENDENT_3_IMP_COLLINEAR = prove + (`!a b c:real^N. affine_dependent{a,b,c} ==> collinear{a,b,c}`, + REPEAT GEN_TAC THEN + MAP_EVERY ASM_CASES_TAC + [`a:real^N = b`; `a:real^N = c`; `b:real^N = c`] THEN + TRY(ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_SING; COLLINEAR_2] THEN NO_TAC) THEN + REWRITE_TAC[affine_dependent; IN_INSERT; NOT_IN_EMPTY] THEN STRIP_TAC THEN + FIRST_X_ASSUM SUBST_ALL_TAC THENL + [ALL_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {b,a,c}`]; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {c,b,a}`]] THEN + MATCH_MP_TAC IN_AFFINE_HULL_IMP_COLLINEAR THEN + FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (MESON[] + `x IN s ==> s = t ==> x IN t`)) THEN + AP_TERM_TAC THEN ASM SET_TAC[]);; + +(* LEMMA 11 *) +let FAFKVLR = prove + (`!v1 v2 v3 v:real^N. + ~collinear{v1,v2,v3} /\ v IN (affine hull {v1,v2,v3}) + + ==> ?t1 t2 t3. v = t1 % v1 + t2 % v2 + t3 % v3 /\ + t1 + t2 + t3 = &1 /\ + !ta tb tc. v = ta % v1 + tb % v2 + tc % v3 /\ + + ta + tb + tc = &1 + ==> ta = t1 /\ tb = t2 /\ tc = t3`, + REPEAT GEN_TAC THEN + MAP_EVERY ASM_CASES_TAC + [`v1:real^N = v2`; `v2:real^N = v3`; `v1:real^N = v3`] THEN + TRY(ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_SING; COLLINEAR_2] THEN NO_TAC) THEN + SIMP_TAC[AFFINE_HULL_FINITE; FINITE_INSERT; FINITE_SING; IN_ELIM_THM] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + SIMP_TAC[SUM_CLAUSES; VSUM_CLAUSES; FINITE_INSERT; FINITE_SING; + SUM_SING; VSUM_SING] THEN + ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; LEFT_IMP_EXISTS_THM] THEN + X_GEN_TAC `f:real^N->real` THEN STRIP_TAC THEN + MAP_EVERY EXISTS_TAC + [`(f:real^N->real) v1`; `(f:real^N->real) v2`; `(f:real^N->real) v3`] THEN + ASM_REWRITE_TAC[] THEN REPEAT GEN_TAC THEN EXPAND_TAC "v" THEN + DISCH_TAC THEN MATCH_MP_TAC(TAUT `(~p ==> F) ==> p`) THEN DISCH_TAC THEN + UNDISCH_TAC `~collinear{v1:real^N,v2,v3}` THEN REWRITE_TAC[] THEN + MATCH_MP_TAC AFFINE_DEPENDENT_3_IMP_COLLINEAR THEN + SIMP_TAC[AFFINE_DEPENDENT_EXPLICIT_FINITE; FINITE_INSERT; FINITE_RULES; + SUM_CLAUSES; VSUM_CLAUSES] THEN + ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY] THEN + EXISTS_TAC `\x. if x = v1 then f v1 - ta + else if x = v2 then f v2 - tb + else (f:real^N->real) v3 - tc` THEN + ASM_REWRITE_TAC[REAL_ADD_RID; VECTOR_ADD_RID] THEN REPEAT CONJ_TAC THENL + [ASM_REAL_ARITH_TAC; + ASM_REWRITE_TAC[EXISTS_OR_THM; RIGHT_OR_DISTRIB; UNWIND_THM2] THEN + ASM_REWRITE_TAC[REAL_SUB_0] THEN ASM_MESON_TAC[]; + ASM_REWRITE_TAC[VECTOR_ARITH + `(a - a') % x + (b - b') % y + (c - c') % z = vec 0 <=> + a % x + b % y + c % z = a' % x + b' % y + c' % z`] THEN + ASM_MESON_TAC[]]);; + + + + let FAFKVLR_ALT = prove + (`!v1 v2 v3 v:real^N. + ~collinear{v1,v2,v3} /\ v IN (affine hull {v1,v2,v3}) + ==> ?!(t1,t2,t3). v = t1 % v1 + t2 % v2 + t3 % v3 /\ + t1 + t2 + t3 = &1`, + REWRITE_TAC(map(REWRITE_RULE[ETA_AX]) + [EXISTS_UNIQUE; FORALL_PAIR_THM; EXISTS_PAIR_THM]) THEN + REWRITE_TAC[PAIR_EQ; GSYM CONJ_ASSOC; FAFKVLR]);; + + +let equivalent_lemma = prove(` (?t1 t2 t3. + !v1 v2 v3 (v:real^N). + v IN affine hull {v1, v2, v3} /\ ~collinear {v1, v2, v3} + ==> v = + t1 v1 v2 v3 v % v1 + t2 v1 v2 v3 v % v2 + t3 v1 v2 v3 v % v3 /\ + t1 v1 v2 v3 v + t2 v1 v2 v3 v + t3 v1 v2 v3 v = &1 /\ + (!ta tb tc. + v = ta % v1 + tb % v2 + tc % v3 /\ ta + tb + tc = &1 + ==> ta = t1 v1 v2 v3 v /\ + tb = t2 v1 v2 v3 v /\ + tc = t3 v1 v2 v3 v)) <=> + + ( !v1 v2 v3 (v:real^N). + v IN affine hull {v1, v2, v3} /\ ~collinear {v1, v2, v3} + ==> (?t1 t2 t3. + v = t1 % v1 + t2 % v2 + t3 % v3 /\ + t1 + t2 + t3 = &1 /\ + (!ta tb tc. + v = ta % v1 + tb % v2 + tc % v3 /\ ta + tb + tc = &1 + ==> ta = t1 /\ tb = t2 /\ tc = t3))) `, +REWRITE_TAC[GSYM SKOLEM_THM; LEFT_FORALL_IMP_THM; RIGHT_EXISTS_IMP_THM]);; + + + let LAMBDA_TRIPLED_THM = prove + (`!t. (\(x,y,z). t x y z) = (\p. t (FST p) (FST(SND p)) (SND(SND p)))`, + REWRITE_TAC[FUN_EQ_THM; FORALL_PAIR_THM]);; + + let FORALL_TRIPLED_THM = prove + (`!P. (!(x,y,z). P x y z) <=> (!x y z. P x y z)`, + REWRITE_TAC[LAMBDA_TRIPLED_THM] THEN REWRITE_TAC[FORALL_PAIR_THM]);; + + let EXISTS_TRIPLED_THM = prove + (`!P. (?(x,y,z). P x y z) <=> (?x y z. P x y z)`, + REWRITE_TAC[LAMBDA_TRIPLED_THM] THEN REWRITE_TAC[EXISTS_PAIR_THM]);; + + let EXISTS_UNIQUE_TRIPLED_THM = prove + (`!P. (?!(x,y,z). P x y z) <=> + (?x y z. P x y z /\ + (!x' y' z'. P x' y' z' ==> x' = x /\ y' = y /\ z' = z))`, + REWRITE_TAC[REWRITE_RULE[ETA_AX] EXISTS_UNIQUE] THEN + REWRITE_TAC[FORALL_TRIPLED_THM; EXISTS_TRIPLED_THM] THEN + REWRITE_TAC[EXISTS_PAIR_THM; FORALL_PAIR_THM; PAIR_EQ]);; + + + let theoremmm = prove + (`( !v1 v2 v3 v:real^N. + v IN affine hull {v1, v2, v3} /\ ~collinear {v1, v2, v3} + ==> (?t1 t2 t3. + v = t1 % v1 + t2 % v2 + t3 % v3 /\ + t1 + t2 + t3 = &1 /\ + (!ta tb tc. + v = ta % v1 + tb % v2 + tc % v3 /\ + ta + tb + tc = &1 + ==> ta = t1 /\ tb = t2 /\ tc = t3)) ) + <=> + ( !v1 v2 v3 v:real^N. + ~collinear {v1, v2, v3} /\ v IN affine hull {v1, v2, v3} + ==> (?!(t1,t2,t3). v = t1 % v1 + t2 % v2 + t3 % v3 /\ + t1 + t2 + t3 = &1))`, + REWRITE_TAC[EXISTS_UNIQUE_TRIPLED_THM] THEN REWRITE_TAC[CONJ_ACI]);; + + + + +let FAFKVLR = prove(` (?t1 t2 t3. + !v1 v2 v3 (v:real^N). + v IN affine hull {v1, v2, v3} /\ ~collinear {v1, v2, v3} + ==> v = + t1 v1 v2 v3 v % v1 + t2 v1 v2 v3 v % v2 + t3 v1 v2 v3 v % v3 /\ + t1 v1 v2 v3 v + t2 v1 v2 v3 v + t3 v1 v2 v3 v = &1 /\ + (!ta tb tc. + v = ta % v1 + tb % v2 + tc % v3 /\ ta + tb + tc = &1 + ==> ta = t1 v1 v2 v3 v /\ + tb = t2 v1 v2 v3 v /\ + tc = t3 v1 v2 v3 v)) `, +SIMP_TAC[equivalent_lemma; FAFKVLR]);; +let LEMMA11 = FAFKVLR;; +let lemma11 = REWRITE_RULE[equivalent_lemma] FAFKVLR;; +let COEFS = new_specification ["coef1"; "coef2"; "coef3"] FAFKVLR;; + +let lem11 = REWRITE_RULE[simp_def2; IN_ELIM_THM] lemma11;; + +let REAL_PER3 = REAL_ARITH `!a b c. a + b + c = b + a + c /\ a + b + c = c + b + a `;; + + +MESON[VEC_PER2_3]` (!ta tb tc. + v = ta % v1 + tb % v2 + tc % v3 ==> ta = t1 /\ tb = t2 /\ tc = t3) /\bbb/\ + v = ta''' % v1 + tb''' % v2 + t''' % v3 /\ + v = ta'' % v3 + tb'' % v1 + t'' % v2 /\ + v = ta' % v2 + tb' % v3 + t' % v1 /\ +aa ==> t' = t1 /\ t'' = t2 /\ t''' = t3 `;; + + +let IN_CONV3_EQ = prove(`! (v:real^3) v1 v2 v3. ~collinear {v1,v2,v3} ==> (v IN conv {v1, v2, v3} <=> + v IN aff_ge {v1,v2} {v3} /\ + v IN aff_ge {v2,v3} {v1} /\ v IN aff_ge {v3,v1} {v2} )`, +REWRITE_TAC[CONV_SET3; simp_def2; IN_ELIM_THM] THEN +REPEAT GEN_TAC THEN DISCH_TAC THEN EQ_TAC THENL [ +MESON_TAC[REAL_ARITH` a + b + c = b + a + c /\ a + b + c = c + b + a `; + VECTOR_ARITH `(a:real^N) + b + c = b + a + c /\ a + b + c = c + b + a `; lem11]; +NHANH (MESON[]` (? a b c. P a b c /\ Q c /\ R a b c) /\ aa /\ bb ==> + (? a b c. P a b c /\ R a b c) `) THEN +FIRST_X_ASSUM MP_TAC THEN +REWRITE_TAC[IMP_IMP] THEN +REWRITE_TAC[MESON[]` ~a/\ b <=> b /\ ~ a `] THEN +PHA THEN +NHANH (SPEC_ALL lem11) THEN +STRIP_TR THEN REWRITE_TAC[MESON[]` (v = w:real^N) /\ a <=> a /\ v = w `] THEN PHA] THEN +NHANH (MESON[VEC_PER2_3; REAL_PER3]` ta + tb + t = &1 /\ + &0 <= t /\ + ta' + tb' + t' = &1 /\ + &0 <= t' /\ + ta'' + tb'' + t'' = &1 /\ + &0 <= t'' /\ +a1/\ +a2/\ + t1 + t2 + t3 = &1 /\ + (!ta tb tc. + ta + tb + tc = &1 /\ v = ta % v1 + tb % v2 + tc % v3 + ==> ta = t1 /\ tb = t2 /\ tc = t3) /\ + v = t1 % v1 + t2 % v2 + t3 % v3 /\ +a3/\ + v = ta'' % v3 + tb'' % v1 + t'' % v2 /\ + v = ta' % v2 + tb' % v3 + t' % v1 /\ + v = ta % v1 + tb % v2 + t % v3 ==> t1 = t' /\ t2 = t'' /\ t3 = t`) THEN +MESON_TAC[]);; + + +let IN_CONV03_EQ = prove( +`! (v:real^3) v1 v2 v3. ~collinear {v1,v2,v3} ==> +(v IN conv0 {v1, v2, v3} <=> v IN aff_gt {v1,v2} {v3} /\ + v IN aff_gt {v2,v3} {v1} /\ v IN aff_gt {v3,v1} {v2} )`, +REWRITE_TAC[CONV_SET3; simp_def2; IN_ELIM_THM] THEN +REPEAT GEN_TAC THEN DISCH_TAC THEN EQ_TAC THENL [ +MESON_TAC[REAL_ARITH` a + b + c = b + a + c /\ a + b + c = c + b + a `; + VECTOR_ARITH `(a:real^N) + b + c = b + a + c /\ a + b + c = c + b + a `; lem11]; +NHANH (MESON[]` (? a b c. P a b c /\ Q c /\ R a b c) /\ aa /\ bb ==> + (? a b c. P a b c /\ R a b c) `) THEN +FIRST_X_ASSUM MP_TAC THEN +REWRITE_TAC[IMP_IMP] THEN +REWRITE_TAC[MESON[]` ~a/\ b <=> b /\ ~ a `] THEN +PHA THEN +NHANH (SPEC_ALL lem11) THEN +STRIP_TR THEN REWRITE_TAC[MESON[]` (v = w:real^N) /\ a <=> a /\ v = w `]] + THEN PHA THEN NHANH (MESON[VEC_PER2_3; REAL_PER3]` + ta + tb + t = &1 /\ + &0 < t /\ + ta' + tb' + t' = &1 /\ + &0 < t' /\ + ta'' + tb'' + t'' = &1 /\ + &0 < t'' /\ a33 /\ a22 /\ + t1 + t2 + t3 = &1 /\ + (!ta tb tc. + ta + tb + tc = &1 /\ v = ta % v1 + tb % v2 + tc % v3 + ==> ta = t1 /\ tb = t2 /\ tc = t3) /\ + v = t1 % v1 + t2 % v2 + t3 % v3 /\ a11 /\ + v = ta'' % v3 + tb'' % v1 + t'' % v2 /\ + v = ta' % v2 + tb' % v3 + t' % v1 /\ + v = ta % v1 + tb % v2 + t % v3 ==> + t1 = t' /\ t2 = t'' /\ t3 = t `) THEN MESON_TAC[]);; + + + +let AFFINE_SET_GEN_BY_TWO_POINTS = +prove(`! a b. affine {x | ?ta tb. ta + tb = &1 /\ x = ta % a + tb % b}`, +REWRITE_TAC[affine; IN_ELIM_THM] THEN +REPEAT GEN_TAC THEN +STRIP_TAC THEN +EXISTS_TAC ` u * ta + v * ta' ` THEN +EXISTS_TAC ` u * tb + v * tb' ` THEN +REWRITE_TAC[REAL_ARITH ` (u * ta + v * ta') + u * tb + v * tb' = + u * (ta + tb) + v * (ta' + tb' ) `] THEN +ASM_SIMP_TAC[REAL_ARITH ` a * &1 = a `] THEN +CONV_TAC VECTOR_ARITH);; + + + +let GENERATING_POINT_IN_SET_AFF = prove(` ! a b. {a,b} SUBSET {x | ?ta tb. +ta + tb = &1 /\ x = ta % a + tb % b}`,REWRITE_TAC[SET2_SU_EX; IN_ELIM_THM] +THEN REPEAT GEN_TAC THEN +MESON_TAC[REAL_ARITH` &0 + &1 = &1 /\ a + b = b + a`; VECTOR_ARITH ` + a = &0 % b + &1 % a /\ a = &1 % a + &0 % b `]);; + + +let AFF_2POINTS_INTERPRET = prove(`!a b. aff {a, b} = {x | ?ta tb. ta + tb = &1 /\ x = ta % a + tb % b}`, +REWRITE_TAC[aff; hull] THEN +REPEAT GEN_TAC THEN +REWRITE_TAC[GSYM SUBSET_ANTISYM_EQ] THEN +SIMP_TAC[INTERS_SUBSET; AFFINE_SET_GEN_BY_TWO_POINTS; + GENERATING_POINT_IN_SET_AFF] THEN +REWRITE_TAC[SUBSET; IN_ELIM_THM] THEN +REWRITE_TAC[SUBSET; IN_ELIM_THM; IN_INTERS; affine] THEN +SET_TAC[]);; + + +let IN_AFF_GE_INTERPRET_TO_AFF_GT_AND_AFF = prove(` ! v v1 v2 v3 . +v IN aff_ge {v1,v2} {v3} <=> v IN aff_gt {v1,v2} {v3} \/ + v IN aff {v1,v2} `, +REWRITE_TAC[simp_def2; AFF_2POINTS_INTERPRET; IN_ELIM_THM ] THEN +REWRITE_TAC [REAL_ARITH ` &0 <= a <=> &0 < a \/ a = &0 `] THEN +MESON_TAC[REAL_ARITH ` (&0 <= a <=> &0 < a \/ a = &0 )/\( a + &0 = a ) `; + VECTOR_ARITH ` a + &0 % c = a `]);; + +let DOWN_TAC = REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[IMP_IMP] THEN PHA;; +let IMP_IMP_TAC = REWRITE_TAC[IMP_IMP] THEN PHA;; + + +let AFFINE_AFF_HULL = prove(` ! s. affine ( aff s ) `, +REWRITE_TAC[aff; AFFINE_AFFINE_HULL]);; + + +let AFFINE_CONTAIN_LINE = prove(`! a b s. affine s /\ {a,b} SUBSET s ==> + aff {a,b} SUBSET s `, +REWRITE_TAC[affine ; AFF_2POINTS_INTERPRET; IN_ELIM_THM] THEN SET_TAC[]);; + +let VECTOR_SUB_DISTRIBUTE = VECTOR_ARITH ` ! a x y. a % x - a % y = a % ( x - y ) `;; + + +let CHANGE_SIDE = prove(` ~( a = &0 ) ==> ( x = a % y <=> ( &1 / a) % x = y )`, +MESON_TAC[ VECTOR_ARITH ` ( a * b ) % x = a % b % x `; VECTOR_MUL_LID; + REAL_FIELD `~( a = &0 ) ==> a * &1 / a = &1 `; VECTOR_MUL_LCANCEL]);; + + +let PRE_INVERSE_SUB = prove(` ! a b v w. {a, b} SUBSET aff {v, w} /\ ~(a = b) + ==> {v, w} SUBSET aff {a, b}`, +REWRITE_TAC[AFF_2POINTS_INTERPRET; SET2_SU_EX; IN_ELIM_THM] THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN +REWRITE_TAC[IMP_IMP] THEN PHA THEN +NHANH (MESON[]` (a:real^N) = b /\ gg /\ a' = b' /\ ll ==> a - a' = b - b' `) THEN +REWRITE_TAC[VECTOR_ARITH` (ta % v + tb % w) - (ta' % v + tb' % w) = + ( ta - ta') % v + ( tb - tb' ) % w `] THEN +PHA THEN REWRITE_TAC[MESON[]` a = &1 /\ b <=> b /\ a = &1 `] THEN PHA THEN +NHANH (REAL_ARITH ` ta + tb = &1 /\ ta' + tb' = &1 ==> ta' - ta = tb - tb' `) THEN +REWRITE_TAC[VECTOR_ARITH ` a + ( x - y ) % b = a - ( y - x) % b `] THEN +REWRITE_TAC[MESON[]` a - b = ta % v - tb % w /\aa/\ + ta = tb <=> a - b = ta % v - ta % w /\ aa /\ ta = tb `] THEN +ASM_CASES_TAC `(ta:real) = ta' ` THENL [ASM_SIMP_TAC[REAL_SUB_REFL; +VECTOR_MUL_LZERO; VECTOR_SUB_RZERO; VECTOR_SUB_EQ] THEN MESON_TAC[]; ALL_TAC] THEN +REWRITE_TAC[VECTOR_SUB_DISTRIBUTE] THEN FIRST_X_ASSUM MP_TAC THEN +ONCE_REWRITE_TAC[REAL_ARITH` ~( a = b) <=> ~( a - b = &0 )`] THEN IMP_IMP_TAC THEN +REWRITE_TAC[MESON[]` ~( a = b:real) /\ l <=> l /\ ~(a = b) `; MESON[]` +a = d % b /\ l <=> l /\ a = d % b `] THEN PHA THEN +REWRITE_TAC[MESON[CHANGE_SIDE]` x = a % y /\ ~( a = &0 ) <=> &1 / a % x = y /\ + ~( a = &0 )`] THEN NHANH (MESON[VECTOR_MUL_LCANCEL]` ta - ta' = tb' - tb /\ + a = b /\ l ==> tb % a = tb % b /\ ta % a = ta % b `) THEN +ONCE_REWRITE_TAC[MESON[]` a = (b:real^n) /\ l <=> l /\ a = b `] THEN PHA +THEN REWRITE_TAC[GSYM VECTOR_SUB_DISTRIBUTE] THEN +ONCE_REWRITE_TAC[VECTOR_ARITH` a = (b:real^N) /\ a1 = (b1:real^N) /\ a2 = + (b2:real^N) <=> a2 = b2 /\ a + a2 = b + b2 /\ a2 - a1 = b2 - b1 `] THEN +REWRITE_TAC[VECTOR_ARITH` (ta % v + tb % w) - (ta % v - ta % w) = ( ta + tb ) % w `; + VECTOR_ARITH` tb % v - tb % w + ta % v + tb % w = ( ta + tb ) % v `] THEN +REWRITE_TAC[VECTOR_MUL_ASSOC; VECTOR_ARITH` a - ( x % a - y % b ) = +(&1 - x ) % a + y % b `] THEN REWRITE_TAC[VECTOR_ARITH` a % x - b % y + x = +(a + &1 ) % x + --b % y `] THEN +REWRITE_TAC[MESON[]` a = &1 /\ b = &1 /\ l <=> a = &1 /\ l /\b = &1 `] THEN +DAO THEN MATCH_MP_TAC (MESON[]`( a1 /\a2/\a3/\a5 ==> l) ==> +(a1/\a2/\a3/\a4/\a5/\a6 ==> l ) `) THEN PURE_ONCE_REWRITE_TAC[ MESON[]` + a + b = &1 /\ P ( a + b ) <=> a + b = &1 /\ P (&1) `] THEN +REWRITE_TAC[VECTOR_MUL_LID] THEN MESON_TAC[REAL_FIELD ` ~(ta - ta' = &0) + ==> (tb * &1 / (ta - ta') + &1) + --(tb * &1 / (ta - ta')) = &1 /\ + &1 - ta * &1 / (ta - ta') + ta * &1 / (ta - ta') = &1 `]);; + + + +let LEMMA5 = prove( +`!(a:real^N) b x. line x /\ {a, b} SUBSET x /\ ~(a = b) ==> x = aff {a, b}`, +REWRITE_TAC[line; GSYM aff] THEN REPEAT GEN_TAC THEN STRIP_TAC THEN +REWRITE_TAC[GSYM SUBSET_ANTISYM_EQ] THEN ASM_SIMP_TAC[AFFINE_AFF_HULL; +AFFINE_CONTAIN_LINE] THEN STRIP_TR THEN +ABBREV_TAC ` (ki : bool ) = aff {(v:real^N), (w:real^N)} + SUBSET aff {(a:real^N), (b:real^N)}` THEN +REWRITE_TAC[MESON[]` a/\b/\c ==> d <=> b ==> a/\c ==> d `] THEN SIMP_TAC[] +THEN DISCH_TAC THEN IMP_IMP_TAC THEN +NHANH (MESON[PRE_INVERSE_SUB]`{a, b} SUBSET aff {v, w} /\ aa /\ ~(a = b) + ==> {v, w} SUBSET aff {a, b} `) THEN +NHANH (MESON[AFFINE_AFF_HULL]` aa /\ v SUBSET aff {a, b} ==> affine (aff {a,b})`) +THEN DOWN_TAC THEN MESON_TAC[AFFINE_CONTAIN_LINE]);; + +let RCEABUJ = LEMMA5;; + + +let COL_EQ_UPS_0 = GEN_ALL (MESON[FHFMKIY]` collinear {(v1:real^3), v2, v3} <=> + ups_x (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v2,v3) pow 2) = &0`);; + + + +let EQ_POW2_COND = prove(`!a b. &0 <= a /\ &0 <= b ==> (a = b <=> a pow 2 = b pow 2)`, +REWRITE_TAC[REAL_ARITH` a = b <=> a <= b /\ b <= a `] THEN SIMP_TAC[POW2_COND]);; + + +let D3_POS_LE = MESON[d3; DIST_POS_LE]` ! x y. &0 <= d3 x y `;; + + +let delta_x12 = new_definition ` delta_x12 x12 x13 x14 x23 x24 x34 = + -- x13 * x23 + -- x14 * x24 + x34 * ( -- x12 + x13 + x14 + x23 + x24 + -- x34 ) + + -- x12 * x34 + x13 * x24 + x14 * x23 `;; + +let delta_x13 = new_definition` delta_x13 x12 x13 x14 x23 x24 x34 = + -- x12 * x23 + -- x14 * x34 + x12 * x34 + x24 * ( x12 + -- x13 + x14 + x23 + + -- x24 + x34 ) + -- x13 * x24 + x14 * x23 `;; + +let delta_x14 = new_definition`delta_x14 x12 x13 x14 x23 x24 x34 = + --x12 * x24 + + --x13 * x34 + + x12 * x34 + + x13 * x24 + + x23 * (x12 + x13 + --x14 + --x23 + x24 + x34) + + --x14 * x23`;; + + + +let DIST_POW2_DOT = +prove(` ! a (b:real^N) . dist (a,b) pow 2 = ( a - b ) dot ( a- b) `, +SIMP_TAC[dist; vector_norm; DOT_POS_LE; SQRT_WORKS]);; + + + +(* the following lemma is in Multivariate/convex.ml *) +let AFFINE_HULL_3 = new_axiom` affine hull {a,b,c} = + { u % a + v % b + w % c | u + v + w = &1}`;; + + +let LET_TR = CONV_TAC (TOP_DEPTH_CONV let_CONV);; + + +(* BEGINING *) +(* lemma 16 SDIHJZK *) + +let TO_UYCH = prove(` &0 < ups_x a12 a13 a23 ==> + delta_x12 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 + + delta_x13 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 + + delta_x14 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 = + &1 `, +REWRITE_TAC[ups_x; delta_x12; delta_x13; delta_x14] THEN CONV_TAC REAL_FIELD);; + + + + +let NOT_UPS_X_ZERO_IMP_SMT = prove(`~(ups_x a12 a13 a23 = &0) + ==> (delta_x13 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23) pow 2 * a12 + + delta_x13 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 * + delta_x14 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 * + (a12 + a13 - a23) + + (delta_x14 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23) pow 2 * a13 + = + a01 - delta a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 /\ + +(delta_x14 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23) pow 2 * a23 + + delta_x14 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 * + delta_x12 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 * + (a23 + a12 - a13) + + (delta_x12 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23) pow 2 * a12 + = + a02 - delta a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 /\ + +(delta_x12 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23) pow 2 * a13 + + delta_x12 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 * + delta_x13 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 * + (a13 + a23 - a12) + + (delta_x13 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23) pow 2 * a23 = + a03 - delta a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23`, +ONCE_REWRITE_TAC[REAL_FIELD` ~( a = &0 ) ==> ( x = y ) /\ ( xx = yy ) /\ ( xxx = yyy) + <=> ~( a = &0 ) ==> ( x * a pow 2 = y * a pow 2 ) /\ + ( xx * a pow 2 = yy * a pow 2 ) /\ + ( xxx * a pow 2 = yyy * a pow 2 ) `] THEN +SIMP_TAC[REAL_FIELD` ~( a = &0 ) ==> ( b - c / a ) * a pow 2 = b * a pow 2 - c * a ` + ; REAL_ADD_RDISTRIB] THEN +SIMP_TAC[REAL_ARITH` ( a * b ) * c = a * b * c `; + REAL_FIELD` ~ ( a = &0 ) ==> ( b / a ) pow 2 * c * a pow 2 = + b pow 2 * c `; REAL_FIELD ` ~ ( a = &0 ) ==> b / a * c / a * d * + a pow 2 = b * c * d `] THEN DISCH_TAC THEN +REWRITE_TAC[delta_x12; delta_x13; delta_x14; delta; ups_x] THEN REAL_ARITH_TAC);; + + +let TROI_OI_DAT_HOI = MESON[ lemma8; dist; DIST_SYM]` &0 <= + ups_x ( dist((v1:real^3),v2) pow 2) (dist(v2,v3) pow 2) + (dist(v1,v3) pow 2)`;; + + + +let ZERO_LE_UPS_X = MESON[TROI_OI_DAT_HOI; d3; DIST_SYM]` + &0 <= ups_x (d3 x y pow 2) (d3 x z pow 2) (d3 y z pow 2) `;; + + +let UPS_X_EQ_ZERO_COND = prove(` ! v1 v2 (v3: real^3). (collinear {v1, v2, v3} <=> + ups_x (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) + (dist (v2,v3) pow 2) = + &0) `, +MP_TAC FHFMKIY THEN MESON_TAC[]);; + + + +let NORM_POW2_SUM2 = prove(` norm ( a % x + b % y ) pow 2 = + a pow 2 * norm x pow 2 + &2 * ( a * b ) * ( x dot y ) + + b pow 2 * norm y pow 2 `, REWRITE_TAC[vector_norm] THEN +SIMP_TAC[DOT_POS_LE; SQRT_WORKS] THEN CONV_TAC VECTOR_ARITH);; + + + +let X_DOT_X_EQ = prove( ` x dot x = norm x pow 2 `, +SIMP_TAC[vector_norm; DOT_POS_LE; SQRT_WORKS]);; + + + +let SUB_DIST_POW2_INTERPRETE = prove(`! x y (v:real^N) c. +dist(x,v) pow 2 - dist(y,v) pow 2 = c <=> +( &2 % v - ( x + y )) dot ( y - x ) = c `, +SIMP_TAC[DIST_POW2_DOT; DOT_SUB_ADD; VECTOR_ARITH` + (x - v - (y - v)) dot (x - v + y - v) = (&2 % v - (x + y)) dot (y - x) `]);; + + +let SDIHJZK = prove(`! (v1:real^3) v2 v3 (a01: real) a02 a03. + ~collinear {v1, v2, v3} /\ + (let x12 = d3 v1 v2 pow 2 in + let x13 = d3 v1 v3 pow 2 in + let x23 = d3 v2 v3 pow 2 in delta a01 a02 a03 x12 x13 x23 = &0) + ==> (?!v0. a01 = d3 v0 v1 pow 2 /\ + a02 = d3 v0 v2 pow 2 /\ + a03 = d3 v0 v3 pow 2 /\ + (let x12 = d3 v1 v2 pow 2 in + let x13 = d3 v1 v3 pow 2 in + let x23 = d3 v2 v3 pow 2 in + let vv = ups_x x12 x13 x23 in + let t1 = delta_x12 a01 a02 a03 x12 x13 x23 / vv in + let t2 = delta_x13 a01 a02 a03 x12 x13 x23 / vv in + let t3 = delta_x14 a01 a02 a03 x12 x13 x23 / vv in + v0 = t1 % v1 + t2 % v2 + t3 % v3 /\ t1 + t2 + t3 = &1 ))`, +REPEAT GEN_TAC THEN +LET_TR THEN +STRIP_TAC THEN +REWRITE_TAC[EXISTS_UNIQUE] THEN +EXISTS_TAC ` delta_x12 a01 a02 a03 (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) + (d3 v2 v3 pow 2) / + ups_x (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) (d3 v2 v3 pow 2) % + v1 + + delta_x13 a01 a02 a03 (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) + (d3 v2 v3 pow 2) / + ups_x (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) (d3 v2 v3 pow 2) % + v2 + + delta_x14 a01 a02 a03 (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) + (d3 v2 v3 pow 2) / + ups_x (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) (d3 v2 v3 pow 2) % + v3 ` THEN +UNDISCH_TAC `~collinear {(v1:real^3), v2, v3}` THEN +MP_TAC (GEN_ALL ZERO_LE_UPS_X) THEN +REWRITE_TAC[UPS_X_EQ_ZERO_COND] THEN +REWRITE_TAC[MESON[]` a ==> b ==> c <=> a /\ b ==> c `; d3] THEN +NHANH (MESON[REAL_ARITH ` &0 <= a <=> &0 < a \/ a = &0 `]` + (!(x:real^3) y z. + &0 <= ups_x (dist (x,y) pow 2) (dist (x,z) pow 2) (dist (y,z) pow 2)) /\ + ~(ups_x (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v2,v3) pow 2) = &0) + ==> &0 < ups_x (dist ((v1:real^3),v2) pow 2) (dist (v1,v3) pow 2) (dist (v2,v3) pow 2) `) THEN +REWRITE_TAC[ GSYM d3] THEN +STRIP_TAC THEN +CONJ_TAC THENL [ + +UNDISCH_TAC ` &0 < ups_x (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) (d3 v2 v3 pow 2)` THEN +ABBREV_TAC ` a12 = d3 v1 v2 pow 2 ` THEN ABBREV_TAC ` a13 = d3 v1 v3 pow 2 ` THEN +ABBREV_TAC ` a23 = d3 v2 v3 pow 2 ` THEN SIMP_TAC[TO_UYCH] THEN +REWRITE_TAC[MESON[d3; dist] ` aa = d3 a b pow 2 <=> aa = norm ( a- b ) pow 2 `] THEN +ONCE_REWRITE_TAC[VECTOR_ARITH ` a - b = a - &1 % b `] THEN +NHANH (GSYM TO_UYCH) THEN SIMP_TAC[] THEN +SIMP_TAC[VECTOR_ARITH ` (a % v1 + b % v2 + c % v3) - (a + b + c) % v2 = + (b % v2 + c % v3 + a % v1) - (b + c + a) % v2 /\ + (a % v1 + b % v2 + c % v3) - (a + b + c) % v3 = + (c % v3 + a % v1 + b % v2 ) - ( c + a + b ) % v3 `] THEN +REWRITE_TAC[VECTOR_ARITH` ( a % v1 + b % v2 + c % v3) - + ( a + b + c ) % v1 = b % ( v2 - v1 ) + c % ( v3 - v1 ) `] THEN +REWRITE_TAC[NORM_POW2_SUM2 ; REAL_ARITH ` &2 * ( a * b ) * c = a * b * &2 * c `] THEN +REWRITE_TAC[VECTOR_ARITH ` &2 * ( x dot y ) = x dot x + y dot y - ( x - y ) dot ( x - y ) `] THEN +REWRITE_TAC[VECTOR_ARITH` v1 - v3 - (v2 - v3) = (v1:real^3) - v2 `] THEN +REWRITE_TAC[X_DOT_X_EQ; GSYM dist; GSYM d3] THEN +SIMP_TAC[D3_SYM] THEN ASM_SIMP_TAC[] THEN STRIP_TAC THEN +UNDISCH_TAC ` ~(ups_x a12 a13 a23 = &0)` THEN NHANH NOT_UPS_X_ZERO_IMP_SMT THEN +ASM_SIMP_TAC[REAL_DIV_LZERO; REAL_SUB_RZERO]; +MESON_TAC[]]);; + + + +let HALF_OF_LE16 = prove(` ! (v1:real^3) v2 v3 (a01: real) a02 a03. + ~collinear {v1, v2, v3} /\ + (let x12 = d3 v1 v2 pow 2 in + let x13 = d3 v1 v3 pow 2 in + let x23 = d3 v2 v3 pow 2 in delta a01 a02 a03 x12 x13 x23 = &0) +==> ?v0. (v0 IN aff {v1, v2, v3} /\ + a01 = d3 v0 v1 pow 2 /\ + a02 = d3 v0 v2 pow 2 /\ + a03 = d3 v0 v3 pow 2 /\ + (let x12 = d3 v1 v2 pow 2 in + let x13 = d3 v1 v3 pow 2 in + let x23 = d3 v2 v3 pow 2 in + let vv = ups_x x12 x13 x23 in + let t1 = delta_x12 a01 a02 a03 x12 x13 x23 / vv in + let t2 = delta_x13 a01 a02 a03 x12 x13 x23 / vv in + let t3 = delta_x14 a01 a02 a03 x12 x13 x23 / vv in + v0 = t1 % v1 + t2 % v2 + t3 % v3)) `, +REPEAT GEN_TAC THEN LET_TR THEN STRIP_TAC THEN REWRITE_TAC[EXISTS_UNIQUE] THEN +EXISTS_TAC ` delta_x12 a01 a02 a03 (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) + (d3 v2 v3 pow 2) / + ups_x (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) (d3 v2 v3 pow 2) % + v1 + + delta_x13 a01 a02 a03 (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) + (d3 v2 v3 pow 2) / + ups_x (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) (d3 v2 v3 pow 2) % + v2 + + delta_x14 a01 a02 a03 (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) + (d3 v2 v3 pow 2) / + ups_x (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) (d3 v2 v3 pow 2) % + v3 ` THEN +UNDISCH_TAC `~collinear {(v1:real^3), v2, v3}` THEN +MP_TAC (GEN_ALL ZERO_LE_UPS_X) THEN +REWRITE_TAC[UPS_X_EQ_ZERO_COND] THEN +REWRITE_TAC[MESON[]` a ==> b ==> c <=> a /\ b ==> c `; d3] THEN +NHANH (MESON[REAL_ARITH ` &0 <= a <=> &0 < a \/ a = &0 `]` + (!(x:real^3) y z. + &0 <= ups_x (dist (x,y) pow 2) (dist (x,z) pow 2) (dist (y,z) pow 2)) /\ + ~(ups_x (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v2,v3) pow 2) = &0) + ==> &0 < ups_x (dist ((v1:real^3),v2) pow 2) (dist (v1,v3) pow 2) (dist (v2,v3) pow 2) `) THEN +REWRITE_TAC[ GSYM d3] THEN +STRIP_TAC THEN +UNDISCH_TAC ` &0 < ups_x (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) (d3 v2 v3 pow 2)` THEN +ABBREV_TAC ` a12 = d3 v1 v2 pow 2 ` THEN ABBREV_TAC ` a13 = d3 v1 v3 pow 2 ` THEN +ABBREV_TAC ` a23 = d3 v2 v3 pow 2 ` THEN SIMP_TAC[TO_UYCH] THEN +REWRITE_TAC[MESON[d3; dist] ` aa = d3 a b pow 2 <=> aa = norm ( a- b ) pow 2 `] THEN +ONCE_REWRITE_TAC[VECTOR_ARITH ` a - b = a - &1 % b `] THEN +NHANH (GSYM TO_UYCH) THEN SIMP_TAC[] THEN +SIMP_TAC[VECTOR_ARITH ` (a % v1 + b % v2 + c % v3) - (a + b + c) % v2 = + (b % v2 + c % v3 + a % v1) - (b + c + a) % v2 /\ + (a % v1 + b % v2 + c % v3) - (a + b + c) % v3 = + (c % v3 + a % v1 + b % v2 ) - ( c + a + b ) % v3 `] THEN +REWRITE_TAC[VECTOR_ARITH` ( a % v1 + b % v2 + c % v3) - + ( a + b + c ) % v1 = b % ( v2 - v1 ) + c % ( v3 - v1 ) `] THEN +REWRITE_TAC[NORM_POW2_SUM2 ; REAL_ARITH ` &2 * ( a * b ) * c = a * b * &2 * c `] THEN +REWRITE_TAC[VECTOR_ARITH ` &2 * ( x dot y ) = x dot x + y dot y - ( x - y ) dot ( x - y ) `] THEN +REWRITE_TAC[VECTOR_ARITH` v1 - v3 - (v2 - v3) = (v1:real^3) - v2 `] THEN +REWRITE_TAC[X_DOT_X_EQ; GSYM dist; GSYM d3] THEN +SIMP_TAC[D3_SYM] THEN ASM_SIMP_TAC[] THEN STRIP_TAC THEN +UNDISCH_TAC ` ~(ups_x a12 a13 a23 = &0)` THEN NHANH NOT_UPS_X_ZERO_IMP_SMT THEN +ASM_SIMP_TAC[REAL_DIV_LZERO; REAL_SUB_RZERO] THEN +REWRITE_TAC[aff; AFFINE_HULL_3; IN_ELIM_THM] THEN ASM_MESON_TAC[]);; + + + + +let EQ_SUB_DIST_POW2_IMP_IDENTIFIED = prove(` ! v1 v2 v3 (u:real^N) w. +{u,w} SUBSET affine hull {v1,v2,v3} /\ +dist (u,v2) pow 2 - dist (u,v1) pow 2 = dist (w,v2) pow 2 - dist (w,v1) pow 2 /\ +dist (u,v3) pow 2 - dist (u,v1) pow 2 = dist (w,v3) pow 2 - dist (w,v1) pow 2 ==> +w = u `, +REPEAT GEN_TAC THEN ONCE_REWRITE_TAC[DIST_SYM] THEN +SIMP_TAC[SUB_DIST_POW2_INTERPRETE ] THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +SIMP_TAC[SUB_DIST_POW2_INTERPRETE ] THEN +ONCE_REWRITE_TAC[REAL_ARITH` a = b <=> a - b = &0 `] THEN +SIMP_TAC[GSYM DOT_LSUB] THEN +SIMP_TAC[GSYM DOT_LSUB; VECTOR_ARITH` a - b - ( aa - b ) = + (a:real^N) - aa `; GSYM VECTOR_SUB_LDISTRIB; AFFINE_HULL_3; + SET2_SU_EX; IN_ELIM_THM] THEN STRIP_TAC THEN +REPEAT (FIRST_X_ASSUM MP_TAC ) THEN +REWRITE_TAC[MESON[]` a ==> b ==> c <=> b /\ a ==> c `] THEN +NHANH (MESON[]` a = (aa:real^N) /\ la /\ b = bb /\ lb ==> + a - b = aa - bb `) THEN +REWRITE_TAC[REAL_ARITH` a + b = &1 <=> a = &1 - b `] THEN PHA THEN +STRIP_TAC THEN FIRST_X_ASSUM MP_TAC THEN UNDISCH_TAC`u' = &1 - (v + w')` THEN +UNDISCH_TAC`u'' = &1 - (v' + w'')` THEN SIMP_TAC[] THEN +SIMP_TAC[VECTOR_ARITH` ((&1 - (v' + w'')) % v1 + v' % v2 + w'' % v3) - + ((&1 - (v + w')) % v1 + v % v2 + w' % v3) = + ( v - v' ) % ( v1 - v2 ) + (w' - w'' ) % ( v1 - v3 ) `] THEN +REPEAT STRIP_TAC THEN +ONCE_REWRITE_TAC[VECTOR_ARITH ` a = b <=> b - a = vec 0` ] THEN +REWRITE_TAC[GSYM DOT_EQ_0] THEN FIRST_X_ASSUM MP_TAC THEN +REWRITE_TAC[MESON[]` a = b ==> a dot a = &0 <=> a = b ==> + a dot b = &0 `] THEN +REWRITE_TAC[DOT_RADD; DOT_RMUL; REAL_ARITH ` a * ( b dot c ) + aa * bb = &0 + <=> a * &2 * ( b dot c ) + aa * &2 * bb = &0 `] THEN +ONCE_REWRITE_TAC[GSYM DOT_LMUL] THEN +ABBREV_TAC ` as = &2 % ((w:real^N) - u) dot (v1 - v2)` THEN +ABBREV_TAC ` bs = &2 % ((w:real^N) - u) dot (v1 - v3)` THEN +DISCH_TAC THEN ASM_SIMP_TAC[] THEN REAL_ARITH_TAC);; + +(* lemma 16 SDIHJZK *) + +let SDIHJZK = prove(`! (v1:real^3) v2 v3 (a01: real) a02 a03. + ~collinear {v1, v2, v3} /\ + (let x12 = d3 v1 v2 pow 2 in + let x13 = d3 v1 v3 pow 2 in + let x23 = d3 v2 v3 pow 2 in delta a01 a02 a03 x12 x13 x23 = &0) + ==> (?v0. v0 IN aff {v1,v2,v3} /\ + a01 = d3 v0 v1 pow 2 /\ + a02 = d3 v0 v2 pow 2 /\ + a03 = d3 v0 v3 pow 2 /\ + (! vv0. vv0 IN aff {v1,v2,v3} /\ + a01 = d3 vv0 v1 pow 2 /\ + a02 = d3 vv0 v2 pow 2 /\ + a03 = d3 vv0 v3 pow 2 ==> vv0 = v0 ) /\ + (let x12 = d3 v1 v2 pow 2 in + let x13 = d3 v1 v3 pow 2 in + let x23 = d3 v2 v3 pow 2 in + let vv = ups_x x12 x13 x23 in + let t1 = delta_x12 a01 a02 a03 x12 x13 x23 / vv in + let t2 = delta_x13 a01 a02 a03 x12 x13 x23 / vv in + let t3 = delta_x14 a01 a02 a03 x12 x13 x23 / vv in + v0 = t1 % v1 + t2 % v2 + t3 % v3))`, +REPEAT GEN_TAC THEN NHANH (SPEC_ALL HALF_OF_LE16 ) THEN STRIP_TAC THEN +EXISTS_TAC `v0:real^3` THEN ASM_SIMP_TAC[] THEN +GEN_TAC THEN UNDISCH_TAC ` (v0:real^3) IN aff {v1, v2, v3}` THEN +ONCE_REWRITE_TAC[REAL_ARITH ` a1 = b1 /\ a2 = b2 /\ a3 = b3 <=> + a2 - a1 = b2 - b1 /\ a3 - a1 = b3 - b1 /\ a1 = b1 `] THEN +REWRITE_TAC[aff; SET2_SU_EX] THEN REWRITE_TAC[d3] THEN +PHA THEN MESON_TAC[SET2_SU_EX; EQ_SUB_DIST_POW2_IMP_IDENTIFIED]);; + + + +let SDIHJZK_INTERPRETE = prove(`!(v1:real^3) v2 v3 a01 a02 a03. + ~collinear {v1, v2, v3} /\ + delta a01 a02 a03 (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) (d3 v2 v3 pow 2) = + &0 + ==> (?v0. v0 IN aff {v1, v2, v3} /\ + a01 = d3 v0 v1 pow 2 /\ + a02 = d3 v0 v2 pow 2 /\ + a03 = d3 v0 v3 pow 2 /\ + (!vv0. vv0 IN aff {v1, v2, v3} /\ + a01 = d3 vv0 v1 pow 2 /\ + a02 = d3 vv0 v2 pow 2 /\ + a03 = d3 vv0 v3 pow 2 + ==> vv0 = v0) /\ + v0 = + delta_x12 a01 a02 a03 (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) + (d3 v2 v3 pow 2) / + ups_x (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) (d3 v2 v3 pow 2) % + v1 + + delta_x13 a01 a02 a03 (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) + (d3 v2 v3 pow 2) / + ups_x (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) (d3 v2 v3 pow 2) % + v2 + + delta_x14 a01 a02 a03 (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) + (d3 v2 v3 pow 2) / + ups_x (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) (d3 v2 v3 pow 2) % + v3)`, MP_TAC SDIHJZK THEN LET_TR THEN SIMP_TAC[]);; + + + +let DELTA_RRR_INTERPRETE = prove(` delta r r r a b c = -- a * b * c + r * ups_x a b c `, +REWRITE_TAC[delta; ups_x] THEN REAL_ARITH_TAC);; + + +let NOT_UPS_X_EQ_0_IMP = prove(` ~( ups_x a b c = &0 ) + ==> delta ( ( a * b * c ) / ups_x a b c ) ( ( a * b * c ) / ups_x a b c ) + ( ( a * b * c ) / ups_x a b c ) a b c = &0 `, +REWRITE_TAC[DELTA_RRR_INTERPRETE ] THEN CONV_TAC REAL_FIELD);; + + + + +let COL_EQ_UPS_0 = GEN_ALL (MESON[FHFMKIY]` collinear {(v1:real^3), v2, v3} <=> + ups_x (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v2,v3) pow 2) = &0`);; + + +(* CDEUSDF POST ZERO_LE_UPS_X *) + + + + +let PROVE_EXISTS_RADV = prove(`!(va:real^3) vb vc. + ~collinear {va, vb, vc} + ==> (?p. p IN affine hull {va, vb, vc} /\ + (?c. ( !w. w IN {va, vb, vc} ==> c = dist (p,w)) /\ + (!p'. p' IN affine hull {va, vb, vc} /\ + ( !w. w IN {va, vb, vc} ==> c = dist (p',w)) + ==> p = p'))) `, +REWRITE_TAC[COL_EQ_UPS_0] THEN +NHANH (NOT_UPS_X_EQ_0_IMP ) THEN +REWRITE_TAC[GSYM COL_EQ_UPS_0] THEN +REWRITE_TAC[GSYM d3] THEN +NHANH (SPEC_ALL SDIHJZK_INTERPRETE) THEN +REWRITE_TAC[EXISTS_UNIQUE] THEN +REPEAT STRIP_TAC THEN +ABBREV_TAC ` r = (d3 va vb pow 2 * d3 va vc pow 2 * d3 vb vc pow 2) / + ups_x (d3 va vb pow 2) (d3 va vc pow 2) (d3 vb vc pow 2) ` THEN +EXISTS_TAC ` v0 :real^3` THEN +UNDISCH_TAC ` (v0:real^3) IN aff {va, vb, vc}` THEN +SIMP_TAC[aff; SET_RULE ` (! x. x IN {a,b,c} ==> P x ) <=> + P a /\ P b /\ P c `] THEN +DISCH_TAC THEN EXISTS_TAC ` sqrt ( r ) ` THEN +UNDISCH_TAC ` (d3 va vb pow 2 * d3 va vc pow 2 * d3 vb vc pow 2) / + ups_x (d3 va vb pow 2) (d3 va vc pow 2) (d3 vb vc pow 2) = r` THEN +NHANH (MESON[REAL_LE_SQUARE_POW; REAL_LE_DIV; REAL_LE_MUL; + ZERO_LE_UPS_X ]` (d3 va vb pow 2 * d3 va vc pow 2 * d3 vb vc pow 2) / + ups_x (d3 va vb pow 2) (d3 va vc pow 2) (d3 vb vc pow 2) = + r ==> &0 <= r `) THEN +SIMP_TAC[SQRT_WORKS; EQ_POW2_COND; D3_POS_LE] THEN +ASM_MESON_TAC[aff]);; + + + + +let COND_FOR_CIRCUMCENTER_PROPERTIESS = prove(`~collinear {(v1:real^3), v2, v3} + ==> circumcenter {v1, v2, v3} IN affine hull {v1, v2, v3} /\ + (?c. !v. v IN {v1, v2, v3} ==> c = dist (circumcenter {v1, v2, v3}, v))`, +NHANH (MESON[PROVE_EXISTS_RADV]`~collinear {(va:real^3), vb, vc} + ==> (?p. p IN affine hull {va, vb, vc} /\ + (?c. (!w. w IN {va, vb, vc} ==> c = dist (p,w)))) `) THEN +REWRITE_TAC[IN; circumcenter] THEN MESON_TAC[EXISTS_THM]);; + + +let DELTA_X14_RRR = prove(` delta_x14 r r r a b c = a * ( b + c - a ) `, +REWRITE_TAC[delta_x14] THEN REAL_ARITH_TAC);; + + +let DELTA_X1I_RRR = prove(` delta_x12 r r r a b c = c * ( b + a - c ) /\ + delta_x13 r r r a b c = b * ( c + a - b ) /\ + delta_x14 r r r a b c = a * (c + b - a) `, +REWRITE_TAC[delta_x12; delta_x13; delta_x14] THEN REAL_ARITH_TAC);; + + + + + +let PRE_RADV_COND = prove(` ~ collinear {va,vb,vc} ==> +(? c. ! w. {va,vb,(vc:real^3)} w ==> c = dist(circumcenter {va,vb,vc} , w )) `, +NHANH (COND_FOR_CIRCUMCENTER_PROPERTIESS ) THEN MESON_TAC[IN]);; + + +let NOT_COL_IMP_RADV_PROPERTIY = prove(` ~collinear {(va:real^3), vb, vc} + ==> ( ! w. {va, vb, vc} w ==> + radV {va, vb, vc} = dist (circumcenter {va, vb, vc},w)) `, +NHANH (PRE_RADV_COND ) THEN SIMP_TAC[EXISTS_THM; radV]);; + + + + +let CIRCUMCENTER_FORMULAR2 = prove(`! (va:real^3) vb vc a b c. + a = d3 vb vc /\ b = d3 va vc /\ c = d3 va vb /\ ~collinear {va, vb, vc} + ==> + (let al_a = + (a pow 2 * (b pow 2 + c pow 2 - a pow 2)) / + (ups_x (a pow 2) (b pow 2) (c pow 2)) in + let al_b = + (b pow 2 * (a pow 2 + c pow 2 - b pow 2)) / + (ups_x (a pow 2) (b pow 2) (c pow 2)) in + let al_c = + (c pow 2 * (a pow 2 + b pow 2 - c pow 2)) / + (ups_x (a pow 2) (b pow 2) (c pow 2)) in + al_a % va + al_b % vb + al_c % vc = circumcenter {va, vb, vc})`, +REWRITE_TAC[COL_EQ_UPS_0] THEN +NHANH (NOT_UPS_X_EQ_0_IMP) THEN +REWRITE_TAC[GSYM COL_EQ_UPS_0; GSYM d3] THEN +NHANH (SPEC_ALL SDIHJZK_INTERPRETE ) THEN +REPEAT STRIP_TAC THEN +ABBREV_TAC ` r = (d3 va vb pow 2 * d3 va vc pow 2 * d3 vb vc pow 2) / + ups_x (d3 va vb pow 2) (d3 va vc pow 2) (d3 vb vc pow 2) ` THEN +UNDISCH_TAC ` v0 = + delta_x12 r r r (d3 va vb pow 2) (d3 va vc pow 2) (d3 vb vc pow 2) / + ups_x (d3 va vb pow 2) (d3 va vc pow 2) (d3 vb vc pow 2) % + va + + delta_x13 r r r (d3 va vb pow 2) (d3 va vc pow 2) (d3 vb vc pow 2) / + ups_x (d3 va vb pow 2) (d3 va vc pow 2) (d3 vb vc pow 2) % + vb + + delta_x14 r r r (d3 va vb pow 2) (d3 va vc pow 2) (d3 vb vc pow 2) / + ups_x (d3 va vb pow 2) (d3 va vc pow 2) (d3 vb vc pow 2) % + vc` THEN +LET_TR THEN +UNDISCH_TAC ` a = d3 vb vc ` THEN +UNDISCH_TAC ` b = d3 va vc ` THEN +UNDISCH_TAC ` c = d3 va vb ` THEN +SIMP_TAC[DELTA_X1I_RRR] THEN +SIMP_TAC[MESON[UPS_X_SYM]` ups_x a b c = ups_x c b a `] THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +SIMP_TAC[] THEN +REPEAT STRIP_TAC THEN +UNDISCH_TAC ` ~collinear {(va:real^3), vb, vc} ` THEN +NHANH (COND_FOR_CIRCUMCENTER_PROPERTIESS) THEN +REWRITE_TAC[SET_RULE ` (! x. x IN {a,b,c} ==> P x ) + <=> P a /\ P b /\ P c `] THEN +REWRITE_TAC[SET_RULE ` (! x. x IN {a,b,c} ==> P x ) + <=> P a /\ P b /\ P c `; MESON[]` (? cc. cc = a /\ cc = b /\ cc = c) + <=> a = b /\ a = c `] THEN +UNDISCH_TAC ` v0 IN aff {va, vb, (vc:real^3)}` THEN +REWRITE_TAC[aff; SET_RULE ` a IN s ==> b /\ aa IN s /\ l ==> + ll <=> b ==> {a,aa} SUBSET s /\ l ==> ll `] THEN +DISCH_TAC THEN +UNDISCH_TAC` r = d3 v0 va pow 2 ` THEN +UNDISCH_TAC` r = d3 v0 vb pow 2 ` THEN +UNDISCH_TAC` r = d3 v0 vc pow 2 ` THEN +REWRITE_TAC[MESON[]` r = a1 ==> r = a2 ==> r = a3 ==> l ==> ll <=> + r = a1 /\ l /\ a2 = a3 /\ a1 = a3 ==> ll `;d3] THEN +ONCE_REWRITE_TAC[MESON[]` dist(a,b) = s <=> s = dist(a,b) `] THEN +SIMP_TAC[DIST_POS_LE; EQ_POW2_COND] THEN +ONCE_REWRITE_TAC[REAL_ARITH` a = b <=> a - b = &0 `] THEN +MESON_TAC[EQ_SUB_DIST_POW2_IMP_IDENTIFIED ]);; + + + + +let NOT_COLL_IMP_RADV_FORMULAR = prove(`! (va:real^3) vb vc a b c. + a = d3 vb vc /\ b = d3 va vc /\ c = d3 va vb /\ ~collinear {va, vb, vc} + ==> radV {va, vb, vc} = eta_y a b c`, +REWRITE_TAC[COL_EQ_UPS_0] THEN +NHANH (NOT_UPS_X_EQ_0_IMP) THEN +REWRITE_TAC[GSYM COL_EQ_UPS_0; GSYM d3] THEN +NHANH (SPEC_ALL SDIHJZK_INTERPRETE ) THEN +REPEAT STRIP_TAC THEN +ABBREV_TAC ` r = (d3 va vb pow 2 * d3 va vc pow 2 * d3 vb vc pow 2) / + ups_x (d3 va vb pow 2) (d3 va vc pow 2) (d3 vb vc pow 2) ` THEN +LET_TR THEN +UNDISCH_TAC ` a = d3 vb vc ` THEN +UNDISCH_TAC ` b = d3 va vc ` THEN +UNDISCH_TAC ` c = d3 va vb ` THEN +SIMP_TAC[DELTA_X1I_RRR] THEN +SIMP_TAC[MESON[UPS_X_SYM]` ups_x a b c = ups_x c b a `] THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +SIMP_TAC[] THEN +REPEAT STRIP_TAC THEN +UNDISCH_TAC ` ~collinear {(va:real^3), vb, vc} ` THEN +NHANH (COND_FOR_CIRCUMCENTER_PROPERTIESS) THEN +REWRITE_TAC[SET_RULE ` (! x. x IN {a,b,c} ==> P x ) + <=> P a /\ P b /\ P c `] THEN +REWRITE_TAC[SET_RULE ` (! x. x IN {a,b,c} ==> P x ) + <=> P a /\ P b /\ P c `; MESON[]` (? cc. cc = a /\ cc = b /\ cc = c) + <=> a = b /\ a = c `] THEN +UNDISCH_TAC ` v0 IN aff {va, vb, (vc:real^3)}` THEN +REWRITE_TAC[aff; SET_RULE ` a IN s ==> b /\ aa IN s /\ l ==> + ll <=> b ==> {a,aa} SUBSET s /\ l ==> ll `] THEN +DISCH_TAC THEN +UNDISCH_TAC` r = d3 v0 va pow 2 ` THEN +UNDISCH_TAC` r = d3 v0 vb pow 2 ` THEN +UNDISCH_TAC` r = d3 v0 vc pow 2 ` THEN +REWRITE_TAC[MESON[]` r = a1 ==> r = a2 ==> r = a3 ==> l ==> ll <=> + r = a1 /\ l /\ a2 = a3 /\ a1 = a3 ==> ll `;d3] THEN +ONCE_REWRITE_TAC[MESON[]` dist(a,b) = s <=> s = dist(a,b) `] THEN +SIMP_TAC[DIST_POS_LE; EQ_POW2_COND] THEN +ONCE_REWRITE_TAC[REAL_ARITH` a = b <=> a - b = &0 `] THEN +REWRITE_TAC[MESON[]` ( a /\ a1 = &0 /\ a2 = &0 ) /\ b1 = &0 /\ b2 = &0 <=> + b1 = &0 /\ b2 = &0 /\ a /\ b1 = a1 /\ b2 = a2 `] THEN +NHANH (SPEC_ALL EQ_SUB_DIST_POW2_IMP_IDENTIFIED ) THEN +STRIP_TAC THEN +UNDISCH_TAC ` ~collinear {(va:real^3), vb, vc}` THEN +NHANH (NOT_COL_IMP_RADV_PROPERTIY ) THEN +FIRST_X_ASSUM MP_TAC THEN +SIMP_TAC[] THEN +SIMP_TAC[SET_RULE ` (!w. {va, vb, vc} w ==> P w ) <=> + P va /\ P vb /\ P vc `] THEN +REPEAT STRIP_TAC THEN +EXPAND_TAC "a" THEN +EXPAND_TAC "b" THEN +EXPAND_TAC "c" THEN +UNDISCH_TAC ` r - dist ((v0:real^3),vc) pow 2 = &0 ` THEN +SIMP_TAC[REAL_ARITH` a - b = &0 <=> b = a `] THEN +EXPAND_TAC "r" THEN +REWRITE_TAC[eta_y; eta_x] THEN +LET_TR THEN +MP_TAC (GEN_ALL ZERO_LE_UPS_X) THEN +SIMP_TAC[GSYM REAL_POW_2] THEN +SIMP_TAC[REAL_ARITH` a * b * c = c * b * a `; + UPS_X_SYM; d3] THEN +MP_TAC (MESON[d3; DIST_POS_LE]` &0 <= d3 v0 vc `) THEN +MP_TAC (MESON[REAL_LE_DIV; REAL_LE_MUL_EQ; REAL_LE_POW_2;REAL_LE_MUL; ZERO_LE_UPS_X; +SQRT_WORKS]` &0 <= ((d3 va vb pow 2 * d3 va vc pow 2 * d3 vb vc pow 2) / + ups_x (d3 va vb pow 2) (d3 va vc pow 2) (d3 vb vc pow 2)) /\ + &0 <= sqrt ((d3 va vb pow 2 * d3 va vc pow 2 * d3 vb vc pow 2) / + ups_x (d3 va vb pow 2) (d3 va vc pow 2) (d3 vb vc pow 2)) `) THEN +REWRITE_TAC[MESON[]` a ==> b ==> c <=> b /\ a ==> c `] THEN +MATCH_MP_TAC (MESON[]` (a1 /\ a3 ==> l) ==> a1 /\a2 /\a3 ==> l`) THEN +SIMP_TAC[d3; EQ_POW2_COND; SQRT_WORKS]);; + + +let CDEUSDF = prove(`!(va:real^3) vb vc a b c. + a = d3 vb vc /\ b = d3 va vc /\ c = d3 va vb /\ ~collinear {va, vb, vc} + ==> (?p. p IN affine hull {va, vb, vc} /\ + (?c. ( !w. w IN {va, vb, vc} ==> c = dist (p,w)) /\ + (!p'. p' IN affine hull {va, vb, vc} /\ + ( !w. w IN {va, vb, vc} ==> c = dist (p',w)) + ==> p = p'))) /\ + (let al_a = + (a pow 2 * (b pow 2 + c pow 2 - a pow 2)) / + (ups_x (a pow 2) (b pow 2) (c pow 2)) in + let al_b = + (b pow 2 * (a pow 2 + c pow 2 - b pow 2)) / + (ups_x (a pow 2) (b pow 2) (c pow 2)) in + let al_c = + (c pow 2 * (a pow 2 + b pow 2 - c pow 2)) / + (ups_x (a pow 2) (b pow 2) (c pow 2)) in + al_a % va + al_b % vb + al_c % vc = circumcenter {va, vb, vc}) /\ + radV {va, vb, vc} = eta_y a b c`, +SIMP_TAC[PROVE_EXISTS_RADV; CIRCUMCENTER_FORMULAR2; NOT_COLL_IMP_RADV_FORMULAR ]);; + +let LEMMA17 = CDEUSDF;; + +let DIST_EQ_IS_UNIQUE = prove(` {u, w} SUBSET affine hull {v1, v2, v3} /\ + dist (u,v2) = dist (u,v1) /\ dist (u,v3) = dist (u,v1) /\ + dist (w,v2) = dist (w,v1) /\ dist (w,v3) = dist (w,v1) ==> + u = w `, +SIMP_TAC[EQ_POW2_COND; DIST_POS_LE] THEN ONCE_REWRITE_TAC[REAL_ARITH` + a = b <=> a - b = &0 `] THEN MESON_TAC[EQ_SUB_DIST_POW2_IMP_IDENTIFIED]);; + + +let NEVER_USED_AGAIN = prove(` p IN affine hull {va, vb, vc} /\ c = dist (p,va) +/\ c = dist (p,vb) /\ c = dist (p,vc) ==> + (! p'. p' IN affine hull {va, vb, vc} /\ + dist (p',vb) = dist (p',va) /\ + dist (p',vc) = dist (p',va) <=> + p' IN affine hull {va, vb, vc} /\ + c = dist (p',va) /\ + c = dist (p',vb) /\ + c = dist (p',vc) )`, +MESON_TAC[DIST_EQ_IS_UNIQUE; SET2_SU_EX]);; + + + +let TRUONG_WELL = prove(`! (va:real^3) vb vc. ~collinear {va, vb, vc} + ==> (?p. p IN affine hull {va, vb, vc} /\ + (?c. !w. w IN {va, vb, vc} ==> c = dist (p,w)) /\ + (!p'. p' IN affine hull {va, vb, vc} /\ + (?c. !w. w IN {va, vb, vc} ==> c = dist (p',w)) + ==> p = p'))`, +NHANH (SPEC_ALL PROVE_EXISTS_RADV) THEN REPEAT STRIP_TAC THEN EXISTS_TAC `p:real^3` +THEN CONJ_TAC THENL [ASM_SIMP_TAC[]; CONJ_TAC] THENL [ASM_MESON_TAC[]; +REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN +REWRITE_TAC[SET_RULE` (!a. a IN {x,y,z} ==> p a) + <=> p x /\ p y /\ p z `] THEN +REWRITE_TAC[MESON[]` (?c. c = a /\ c = b /\ c = cc ) <=> + b = a /\ cc = a `]] THEN +REWRITE_TAC[MESON[]` a ==> b ==> c <=> a /\b ==> c `] THEN + PHA THEN MESON_TAC[NEVER_USED_AGAIN ]);; + + + + +let NGAY_MONG6 = MESON[TRUONG_WELL] `! va vb (vc:real^3). + ~collinear {va, vb, vc} ==> (?p. p IN affine hull {va, vb, vc} /\ + (?c. !w. w IN {va, vb, vc} ==> c = dist (p,w)) ) `;; + + +let CIRCUMCENTER_PROPTIES = prove(`!va vb (vc:real^3). + ~collinear {va, vb, vc} + ==> circumcenter {va, vb, vc} IN affine hull {va, vb, vc} /\ +(?c. !w. w IN {va, vb, vc} + ==> c = dist (circumcenter {va, vb, vc},w))`, +NHANH (SPEC_ALL NGAY_MONG6) THEN REWRITE_TAC[IN; +circumcenter; EXISTS_THM] THEN SIMP_TAC[]);; + + + + + + +let SIMP_DOT_ALEM = prove( `&0 < (b - a) dot x <=> x dot (a - b) < &0`, +SIMP_TAC[DOT_SYM] THEN +REWRITE_TAC[ REAL_ARITH ` a < &0 <=> &0 < -- a `; GSYM DOT_RNEG] THEN +REWRITE_TAC[VECTOR_ARITH ` -- ((a:real^N) - b) = b - a `]);; + + + + +let MONG7_ROI = prove(` ! p a (b:real^A). dist (p,a) = dist (p,b) <=> + (p - &1 / &2 % ( a + b )) dot ( a - b) = &0 `, +REWRITE_TAC[ REAL_ARITH ` a = b <=> ~ ( a < b) /\ ~( b < a ) `; +DIST_LT_HALF_PLANE] THEN +REWRITE_TAC[VECTOR_ARITH` (p - &1 / &2 % (a + b)) dot (a - b) + = &1 / &2 * ( (&2 % p - (a + b ) ) dot ( a- b ) ) `] THEN +REWRITE_TAC[REAL_ARITH `( &1 / &2 * a < &0 <=> a < &0) /\ +(&0 < &1 / &2 * a <=> &0 < a )`] THEN +REWRITE_TAC[SIMP_DOT_ALEM] THEN +SIMP_TAC[VECTOR_ARITH` (a - b) dot (c - d) = (b - a) dot (d - c)`; DOT_SYM; +VECTOR_ADD_SYM] THEN MESON_TAC[]);; + +let LEMMA26 = prove(`!v1 v2 (v3:real^3) p. + ~collinear {v1, v2, v3} /\ p = circumcenter {v1, v2, v3} + ==> (p - &1 / &2 % (v1 + v2)) dot (v1 - v2) = &0 /\ + (p - &1 / &2 % (v2 + v3)) dot (v2 - v3) = &0 /\ + (p - &1 / &2 % (v3 + v1)) dot (v3 - v1) = &0`, +NHANH (SPEC_ALL CIRCUMCENTER_PROPTIES) THEN +NHANH (SET_RULE` (?c. !w. w IN {v1, v2, v3} ==> c = P w) ==> P v1 = P v2 + /\ P v2 = P v3 /\ P v3 = P v1 `) THEN +SIMP_TAC[MONG7_ROI]);; + +let POXDVXO = LEMMA26;; + + + +let NOT_COLL_IMP_RADV_EQ_ETA_Y = MESON[prove(`!va vb vc a b c. + a = d3 vb vc /\ b = d3 va vc /\ c = d3 va vb /\ ~collinear {va, vb, vc} + ==> radV {va, vb, vc} = eta_y (d3 vb vc) (d3 va vc) (d3 va vb)`, +SIMP_TAC[CDEUSDF])]` + !va vb vc . ~collinear {va, vb, vc} + ==> radV {va, vb, vc} = eta_y (d3 vb vc) (d3 va vc) (d3 va vb)`;; + + + g ` ! x (y:real^N). collinear {x,y} `;; +e (REPEAT GEN_TAC THEN REWRITE_TAC[collinear]);; +e (EXISTS_TAC ` x -(y: real^N)`);; +e (ASM_SIMP_TAC[SET_RULE` a = b ==> {a,b,c} = {a,c} `]);; +e (REWRITE_TAC[IN_SET2]);; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; + +e (ASM_SIMP_TAC[] THEN EXISTS_TAC ` &0 ` THEN CONV_TAC VECTOR_ARITH);; + +e (ASM_SIMP_TAC[] THEN EXISTS_TAC ` &1 ` THEN CONV_TAC VECTOR_ARITH);; + +e (ASM_SIMP_TAC[] THEN EXISTS_TAC ` -- &1 ` THEN CONV_TAC VECTOR_ARITH);; + +e (ASM_SIMP_TAC[] THEN EXISTS_TAC ` &0 ` THEN CONV_TAC VECTOR_ARITH);; +let COLLINEAR2 = top_thm();; + + +let TWO_EQ_IMP_COL3 = prove(` ! (x:real^N) y z . x = y ==> collinear {x, y, z} `, +STRIP_TR THEN SIMP_TAC[SET_RULE` a = b ==> {a,b,c} = {a,c} `; COLLINEAR2]);; + + +let NOT_CO_IMP_DIST_POS = prove(`! x y z. ~ collinear {x,y,z} ==> &0 < dist (x,y) `, +NHANH (MESON[TWO_EQ_IMP_COL3]` ~collinear {x, y, z} ==> ~( x= y) `) THEN +SIMP_TAC[DIST_POS_LT]);; + + +let NOT_COLL_IMP_POS_SUM = prove( ` !x y z. + ~collinear {x, y, z} ==> &0 < ( d3 x y + d3 y z + d3 z x) / &2 `, +NHANH (SPEC_ALL NOT_CO_IMP_DIST_POS) THEN +NHANH (MESON[DIST_POS_LE]` ~collinear {x, y, z} ==> + &0 <= dist (y,z) /\ &0 <= dist (z,x) `) THEN +SIMP_TAC[d3] THEN REAL_ARITH_TAC);; + +let PER_SET2 = SET_RULE ` {a,b} = {b,a} `;; + + +let COLLINEAR_AS_IN_CONV2 = MESON[PER_SET2; COLLINERA_AS_IN_CONV2]`! x y (z:real^3). collinear {x, y, z} <=> + x IN conv {y, z} \/ y IN conv {z, x} \/ z IN conv {x, y}`;; + +let COLLINEAR_IMP_POS_UPS2 = prove(` ! x y (z:real^3). ~ collinear {x,y,z} ==> + &0 < ups_x_pow2 ( d3 x y ) ( d3 y z ) ( d3 z x ) `, +REWRITE_TAC[PRE_HER] THEN NHANH (SPEC_ALL NOT_COLL_IMP_POS_SUM ) THEN +REWRITE_TAC[COLLINEAR_AS_IN_CONV2] THEN REWRITE_TAC[MID_COND] THEN +REWRITE_TAC[LENGTH_EQ_EX] THEN REWRITE_TAC[DE_MORGAN_THM] THEN +SIMP_TAC[d3] THEN REPEAT GEN_TAC THEN SIMP_TAC[ +prove(` &0 < a ==> ( &0 < &16 * a * b <=> &0 < b ) `, +REWRITE_TAC[REAL_ARITH ` &0 < &16 * a <=> &0 < a `] THEN +REWRITE_TAC[REAL_LT_MUL_EQ])] THEN +REWRITE_TAC[REAL_ARITH ` (a + b + c ) / &2 - a = ( b + c - a ) / &2 `] THEN +REWRITE_TAC[REAL_ARITH ` (a + b + c ) / &2 - b = ( c + a - b ) / &2 `] THEN +REWRITE_TAC[REAL_ARITH ` (a + b + c ) / &2 - c = ( a + b - c ) / &2 `] THEN +REWRITE_TAC[REAL_ARITH ` a < b + c <=> &0 < ( b + c - a ) / &2 `] THEN +SIMP_TAC[DIST_SYM] THEN SIMP_TAC[REAL_ARITH ` a + b - c = b + a - c `] THEN +SIMP_TAC[REAL_LT_MUL]);; + + + +let RADV_FORMULAR = MESON[CDEUSDF]` !(va:real^3) vb vc. + ~collinear {va, vb, vc} + ==> radV {va, vb, vc} = eta_y (d3 vb vc) (d3 va vc) (d3 va vb)`;; + + + +let MUL3_SYM = REAL_ARITH ` ! a b c. a * b * c = b * a * c /\ + a * b * c = c * b * a `;; + +let ETA_X_SYMM = prove(` ! a b c. eta_x a b c = eta_x b a c /\ + eta_x a b c = eta_x c b a `,SIMP_TAC[eta_x; MUL3_SYM; UPS_X_SYM]);; + +let ETA_Y_SYYM = prove(` ! x y z. eta_y x y z = eta_y y x z /\ +eta_y x y z = eta_y z y x `, REWRITE_TAC[eta_y] THEN +CONV_TAC (TOP_DEPTH_CONV let_CONV) THEN MESON_TAC[ETA_X_SYMM]);; + + + +let NOT_COL3_IMP_DIFF = MESON[PER_SET3; TWO_EQ_IMP_COL3]`!a b c. +~collinear {a, b, c} ==> ~(a = b \/ a = c \/ b = c)`;; + +let LET_TR = CONV_TAC (TOP_DEPTH_CONV let_CONV);; + + +let POW2_COND_LT = MESON[POW2_COND; REAL_ARITH ` &0 < a ==> &0 <= a `]` + !a b. &0 < a /\ &0 < b ==> (a <= b <=> a pow 2 <= b pow 2)`;; + + +let ETA_Y_2 = prove(` eta_y (&2) (&2) (&2) = &2 / sqrt (&3) `, +REWRITE_TAC[eta_y; eta_x; ups_x] THEN +LET_TR THEN +REWRITE_TAC[REAL_ARITH ` ((&2 * &2) * (&2 * &2) * &2 * &2) / + (--(&2 * &2) * &2 * &2 - (&2 * &2) * &2 * &2 - (&2 * &2) * &2 * &2 + + &2 * (&2 * &2) * &2 * &2 + + &2 * (&2 * &2) * &2 * &2 + + &2 * (&2 * &2) * &2 * &2) = &4 / &3 `] THEN +MP_TAC (MESON[REAL_LT_DIV; MESON[SQRT_POS_LT; REAL_ARITH` &0 < &3 `] ` +&0 < sqrt (&3) `; REAL_ARITH ` &0 < &2 /\ &0 < &4 /\ &0 < &3 `] ` &0 < &4 / &3 +/\ &0 < &2 / sqrt (&3) `) THEN +REWRITE_TAC[REAL_ARITH` a = b <=> a <= b /\ b <= a `] THEN +SIMP_TAC[SQRT_POS_LT; POW2_COND_LT] THEN +REWRITE_TAC[GSYM (REAL_ARITH` a = b <=> a <= b /\ b <= a `)] THEN +SIMP_TAC[REAL_LT_IMP_LE; SQRT_POW_2] THEN +REWRITE_TAC[REAL_FIELD` (a/ b) pow 2 = a pow 2 / ( b pow 2 ) `] THEN +SIMP_TAC[REAL_ARITH ` &0 <= &3 `; SQRT_POW_2] THEN +REAL_ARITH_TAC);; + +let D3_POS_LE = MESON[d3; DIST_POS_LE]` ! x y. &0 <= d3 x y `;; + + +(* le 19. p 17 *) +let BYOWBDF = new_axiom`! a b c a' b' ( c':real). &0 < a /\ + a <= a' /\ + &0 < b /\ + b <= b' /\ + &0 < c /\ + c <= c' /\ + a' pow 2 <= b pow 2 + c pow 2 /\ + b' pow 2 <= a pow 2 + c pow 2 /\ + c' pow 2 <= a pow 2 + b pow 2 + ==> eta_y a b c <= eta_y a' b' c' `;; + + +let LEMMA25 = prove(` !(a:real^3) b c. + packing {a, b, c} /\ ~ collinear {a,b,c} + ==> &2 / sqrt (&3) <= radV {a, b, c} `, +SIMP_TAC[RADV_FORMULAR] THEN REPEAT GEN_TAC THEN +ASM_CASES_TAC ` (? x. x IN { d3 b c, d3 c a, d3 a b } /\ &4 / sqrt (&3) + <= x ) ` THENL [DOWN_TAC THEN STRIP_TAC THEN DOWN_TAC THEN +NHANH (SPEC_ALL COLLINEAR_IMP_POS_UPS2) THEN +REWRITE_TAC[d3] THEN NHANH (MESON[DIST_POS_LE; HVXIKHW]` +&0 < ups_x_pow2 (dist (a,b)) (dist (b,c)) (dist (c,a)) + ==> max_real3 (dist (a,b)) (dist (b,c)) (dist (c,a)) / &2 <= + eta_y (dist (a,b)) (dist (b,c)) (dist (c,a)) `) THEN +REWRITE_TAC[REAL_ARITH` a / &2 <= b <=> a <= &2 * b `; MAX_REAL3_LESS_EX] THEN +NHANH (SET_RULE ` x IN { a , b, c } /\ a1/\a2/\a3/\a4 /\ c <= aa /\ a <= aa + /\ b <= aa ==> x <= aa `) THEN REWRITE_TAC[MESON[]` a/ b <= aa /\ l <=> l +/\ a/b <= aa `] THEN PHA THEN DAO THEN +NHANH (MESON[REAL_LE_TRANS]` a <= b /\ c <= a /\ l ==> c <= b `) THEN +MATCH_MP_TAC (MESON[]` ( b ==> c ) ==> a/\b ==> c `) THEN +REWRITE_TAC[REAL_ARITH ` &4 / a <= &2 * b <=> &2 / a <= b `] THEN +MESON_TAC[DIST_SYM; ETA_Y_SYYM]; REWRITE_TAC[packing] THEN +NHANH (SPEC_ALL NOT_COL3_IMP_DIFF) THEN +NHANH (SET_RULE` (!u v. {a, b, c} u /\ {a, b, c} v /\ ~(u = v) ==> P u v ) + /\ l /\ ~(a = b \/ a = c \/ b = c) ==> P a b /\ P b c /\ P c a `) THEN +DOWN_TAC THEN REWRITE_TAC[NOT_EXISTS_THM] THEN +NHANH (SET_RULE` (! x. ~( x IN {a,b,c} /\ P x )) ==> ~ P a /\ ~P b /\ ~P c`) THEN +SIMP_TAC[MESON[REAL_LE_DIV; SQRT_POS_LE; REAL_ARITH ` &0 <= &3 /\ &0 <= &4 `]` + &0 <= &4 / sqrt (&3) `; D3_POS_LE; POW2_COND] THEN +REWRITE_TAC[REAL_ARITH` ~( a <= b ) <=> b < a `] THEN +REWRITE_TAC[REAL_FIELD` ( &4 / a ) pow 2 = &16 / ( a pow 2 ) `] THEN +SIMP_TAC[REAL_ARITH` &0 <= &3 `; SQRT_POW_2] THEN +NHANH (REAL_ARITH ` a < &16 / &3 ==> a <= &2 pow 2 + &2 pow 2 `) THEN +PHA THEN REWRITE_TAC[MESON[]` a <= b + c /\ d <=> d /\ a <= b + c `] THEN +REWRITE_TAC[GSYM d3] THEN PHA THEN +NHANH (MESON[REAL_ARITH `&0 < &2 `; BYOWBDF]`&2 <= d3 a b /\ + &2 <= d3 b c /\ &2 <= d3 c a /\ d3 a b pow 2 <= &2 pow 2 + &2 pow 2 /\ + d3 c a pow 2 <= &2 pow 2 + &2 pow 2 /\ d3 b c pow 2 <= &2 pow 2 + &2 pow 2 +==> eta_y (&2) (&2) (&2) <= eta_y (d3 a b) (d3 b c) (d3 c a) `) THEN +DAO THEN MATCH_MP_TAC (TAUT` (a ==> b) ==> a /\ c ==> b `) THEN +SIMP_TAC[ETA_Y_2;D3_SYM; ETA_Y_SYYM] THEN MESON_TAC[ETA_Y_SYYM]]);; + +let HMWTCNS = LEMMA25;; + + +let COEF1_POS_EQ_V1_IN = prove(`!v1 v2 v3 (v:real^3). ~collinear {v1, v2, v3} /\ +v IN affine hull {v1, v2, v3} ==> + ( &0 < coef1 v1 v2 v3 v <=> v IN aff_gt {v2, v3} {v1} ) `, DAO THEN +NHANH (SPEC_ALL COEFS) THEN REWRITE_TAC[simp_def2; IN_ELIM_THM] THEN +MESON_TAC[REAL_ADD_AC; VEC_PER2_3]);; + + +let COEFS1_EQ_0_IFF_V_IN_AFF = prove(` !v1 v2 v3 v. + ~collinear {v1, v2, v3} /\ v IN affine hull {v1, v2, v3} ==> + (&0 = coef1 v1 v2 v3 v <=> v IN aff {v2, v3}) `, +DAO THEN NHANH (SPEC_ALL COEFS) THEN +REWRITE_TAC[AFF_2POINTS_INTERPRET; IN_ELIM_THM] THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN EQ_TAC THENL [ +DOWN_TAC THEN DAO THEN PURE_ONCE_REWRITE_TAC[MESON[]` &0 = a /\ + P a <=> &0 = a /\ P ( &0 ) `] THEN REWRITE_TAC[VECTOR_MUL_LZERO; + VECTOR_ADD_LID; REAL_ADD_LID] THEN MESON_TAC[]; +STRIP_TAC THEN DOWN_TAC THEN DAO THEN +MESON_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID; REAL_ADD_LID]]);; + + +let cayleytr = new_definition ` + cayleytr x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 = + &2 * x23 * x25 * x34 + + &2 * x23 * x24 * x35 + + -- &1 * x23 pow 2 * x45 + + -- &2 * x15 * x23 * x34 + + -- &2 * x15 * x23 * x24 + + &2 * x15 * x23 pow 2 + + -- &2 * x14 * x23 * x35 + + -- &2 * x14 * x23 * x25 + + &2 * x14 * x23 pow 2 + + &4 * x14 * x15 * x23 + + -- &2 * x13 * x25 * x34 + + -- &2 * x13 * x24 * x35 + + &4 * x13 * x24 * x25 + + &2 * x13 * x23 * x45 + + -- &2 * x13 * x23 * x25 + + -- &2 * x13 * x23 * x24 + + &2 * x13 * x15 * x34 + + -- &2 * x13 * x15 * x24 + + -- &2 * x13 * x15 * x23 + + &2 * x13 * x14 * x35 + + -- &2 * x13 * x14 * x25 + + -- &2 * x13 * x14 * x23 + + -- &1 * x13 pow 2 * x45 + + &2 * x13 pow 2 * x25 + + &2 * x13 pow 2 * x24 + + &4 * x12 * x34 * x35 + + -- &2 * x12 * x25 * x34 + + -- &2 * x12 * x24 * x35 + + &2 * x12 * x23 * x45 + + -- &2 * x12 * x23 * x35 + + -- &2 * x12 * x23 * x34 + + -- &2 * x12 * x15 * x34 + + &2 * x12 * x15 * x24 + + -- &2 * x12 * x15 * x23 + + -- &2 * x12 * x14 * x35 + + &2 * x12 * x14 * x25 + + -- &2 * x12 * x14 * x23 + + &2 * x12 * x13 * x45 + + -- &2 * x12 * x13 * x35 + + -- &2 * x12 * x13 * x34 + + -- &2 * x12 * x13 * x25 + + -- &2 * x12 * x13 * x24 + + &4 * x12 * x13 * x23 + + -- &1 * x12 pow 2 * x45 + + &2 * x12 pow 2 * x35 + + &2 * x12 pow 2 * x34 `;; + + +let LTCTBAN = prove(` cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 = +ups_x x12 x13 x23 * x45 pow 2 + cayleytr x12 x13 x14 x15 x23 x24 x25 x34 x35 ( &0 ) +* x45 + cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 ( &0 ) `, +REWRITE_TAC[ups_x; cayleyR;cayleytr] THEN REAL_ARITH_TAC);; + + +let COEF1_NEG_IFF_V1_IN_AFF_LT = prove(` ! v1 v2 v3 v. ~collinear {v1, v2, v3} /\ + v IN affine hull {v1, v2, v3} + ==> (coef1 v1 v2 v3 v < &0 <=> v IN aff_lt {v2, v3} {v1}) `, +DAO THEN NHANH (SPEC_ALL COEFS) THEN REWRITE_TAC[simp_def2; IN_ELIM_THM] THEN +MESON_TAC[REAL_ADD_AC; VEC_PER2_3]);; + +let condA = new_definition `condA (v1:real^3) v2 v3 v4 x12 x13 x14 x23 x24 x34 = + ( ~ ( v1 = v2 ) /\ coplanar {v1,v2,v3,v4} /\ + ( dist ( v1, v2) pow 2 ) = x12 /\ + dist (v1,v3) pow 2 = x13 /\ + dist (v1,v4) pow 2 = x14 /\ + dist (v2,v3) pow 2 = x23 /\ dist (v2,v4) pow 2 = x24 )`;; + + +let det_vec3 = new_definition ` det_vec3 (a:real^3) (b:real^3) (c:real^3) = + a$1 * b$2 * c$3 + b$1 * c$2 * a$3 + c$1 * a$2 * b$3 - + ( a$1 * c$2 * b$3 + b$1 * a$2 * c$3 + c$1 * b$2 * a$3 ) `;; + + +(* the following lemmas has been proved as follow, but it +run after some files that are not conmpatibale here *) + +let COPLANAR_DET_VEC3_EQ_0 = new_axiom `!v0 v1 (v2: real^3) v3. + coplanar {v0,v1,v2,v3} <=> + det_vec3 ( v1 - v0 ) ( v2 - v0 ) ( v3 - v0 ) = &0`;; + + +let NONCOPLANAR_3_BASIS = new_axiom + (`!v1 v2 v3 v0 v:real^3. + ~coplanar {v0, v1, v2, v3} + ==> (?t1 t2 t3. + v = t1 % (v1 - v0) + t2 % (v2 - v0) + t3 % (v3 - v0) /\ + (!ta tb tc. + v = ta % (v1 - v0) + tb % (v2 - v0) + tc % (v3 - v0) + ==> ta = t1 /\ tb = t2 /\ tc = t3))`);; + + +let COPLANAR = new_axiom`2 <= dimindex(:N) + ==> !s:real^N->bool. coplanar s <=> ?u v w. s SUBSET affine hull {u,v,w}`;; + + +let COPLANAR_3 = new_axiom `!a b c:real^N. 2 <= dimindex(:N) ==> coplanar {a,b,c}`;; + +(* +needs "Multivariate/determinants.ml";; +needs "Multivariate/convex.ml";; + +(* ------------------------------------------------------------------------- *) +(* Flyspeck definitions we use. *) +(* ------------------------------------------------------------------------- *) + +let plane = new_definition + `plane x = (?u v w. ~(collinear {u,v,w}) /\ (x = affine hull {u,v,w}))`;; + +let coplanar = new_definition `coplanar S = (?x. plane x /\ S SUBSET x)`;; + + + +let COPLANAR_DET_EQ_0 = prove + (`!v0 v1 (v2: real^3) v3. + coplanar {v0,v1,v2,v3} <=> + det(vector[v1 - v0; v2 - v0; v3 - v0]) = &0`, + REPEAT GEN_TAC THEN REWRITE_TAC[DET_EQ_0_RANK; RANK_ROW] THEN + REWRITE_TAC[rows; row; LAMBDA_ETA] THEN + ONCE_REWRITE_TAC[SIMPLE_IMAGE_GEN] THEN + REWRITE_TAC[GSYM numseg; DIMINDEX_3] THEN + CONV_TAC(ONCE_DEPTH_CONV NUMSEG_CONV) THEN + SIMP_TAC[IMAGE_CLAUSES; VECTOR_3] THEN EQ_TAC THENL + [REWRITE_TAC[coplanar; plane; LEFT_AND_EXISTS_THM; LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC + [`p:real^3->bool`; `a:real^3`; `b:real^3`; `c:real^3`] THEN + DISCH_THEN(CONJUNCTS_THEN2 STRIP_ASSUME_TAC MP_TAC) THEN + FIRST_X_ASSUM SUBST1_TAC THEN + W(MP_TAC o PART_MATCH lhand AFFINE_HULL_INSERT_SUBSET_SPAN o + rand o lhand o snd) THEN + REWRITE_TAC[GSYM IMP_CONJ_ALT] THEN + DISCH_THEN(MP_TAC o MATCH_MP SUBSET_TRANS) THEN + DISCH_THEN(MP_TAC o ISPEC `\x:real^3. x - a` o MATCH_MP IMAGE_SUBSET) THEN + ONCE_REWRITE_TAC[SIMPLE_IMAGE_GEN] THEN + REWRITE_TAC[IMAGE_CLAUSES; GSYM IMAGE_o; o_DEF; VECTOR_ADD_SUB; IMAGE_ID; + SIMPLE_IMAGE] THEN + REWRITE_TAC[INSERT_SUBSET] THEN STRIP_TAC THEN + GEN_REWRITE_TAC LAND_CONV [GSYM DIM_SPAN] THEN MATCH_MP_TAC LET_TRANS THEN + EXISTS_TAC `CARD {b - a:real^3,c - a}` THEN + CONJ_TAC THENL + [MATCH_MP_TAC SPAN_CARD_GE_DIM; + SIMP_TAC[CARD_CLAUSES; FINITE_RULES] THEN ARITH_TAC] THEN + REWRITE_TAC[FINITE_INSERT; FINITE_RULES] THEN + GEN_REWRITE_TAC RAND_CONV [GSYM SPAN_SPAN] THEN + MATCH_MP_TAC SPAN_MONO THEN REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET] THEN + MP_TAC(VECTOR_ARITH `!x y:real^3. x - y = (x - a) - (y - a)`) THEN + DISCH_THEN(fun th -> REPEAT CONJ_TAC THEN + GEN_REWRITE_TAC LAND_CONV [th]) THEN + MATCH_MP_TAC SPAN_SUB THEN ASM_REWRITE_TAC[]; + + DISCH_TAC THEN + MP_TAC(ISPECL [`{v1 - v0,v2 - v0,v3 - v0}:real^3->bool`; `2`] + LOWDIM_EXPAND_BASIS) THEN + ASM_REWRITE_TAC[ARITH_RULE `n <= 2 <=> n < 3`; DIMINDEX_3; ARITH] THEN + DISCH_THEN(X_CHOOSE_THEN `t:real^3->bool` + (CONJUNCTS_THEN2 MP_TAC STRIP_ASSUME_TAC)) THEN + CONV_TAC(LAND_CONV HAS_SIZE_CONV) THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`a:real^3`; `b:real^3`] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC) THEN + REWRITE_TAC[coplanar; plane] THEN + EXISTS_TAC `affine hull {v0,v0 + a,v0 + b}:real^3->bool` THEN + CONJ_TAC THENL + [MAP_EVERY EXISTS_TAC [`v0:real^3`; `v0 + a:real^3`; `v0 + b:real^3`] THEN + REWRITE_TAC[COLLINEAR_3; COLLINEAR_LEMMA; + VECTOR_ARITH `--x = vec 0 <=> x = vec 0`; + VECTOR_ARITH `u - (u + a):real^3 = --a`; + VECTOR_ARITH `(u + b) - (u + a):real^3 = b - a`] THEN + REWRITE_TAC[DE_MORGAN_THM; VECTOR_SUB_EQ; + VECTOR_ARITH `b - a = c % -- a <=> (c - &1) % a + &1 % b = vec 0`] THEN + ASM_REWRITE_TAC[] THEN CONJ_TAC THENL + [ASM_MESON_TAC[IN_INSERT; INDEPENDENT_NONZERO]; ALL_TAC] THEN + DISCH_THEN(X_CHOOSE_TAC `u:real`) THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [independent]) THEN + REWRITE_TAC[DEPENDENT_EXPLICIT] THEN + MAP_EVERY EXISTS_TAC [`{a:real^3,b}`; + `\x:real^3. if x = a then u - &1 else &1`] THEN + REWRITE_TAC[FINITE_INSERT; FINITE_RULES; SUBSET_REFL] THEN + CONJ_TAC THENL + [EXISTS_TAC `b:real^3` THEN ASM_REWRITE_TAC[IN_INSERT] THEN + REAL_ARITH_TAC; + ALL_TAC] THEN + SIMP_TAC[VSUM_CLAUSES; FINITE_RULES] THEN + ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; VECTOR_ADD_RID]; + ALL_TAC] THEN + W(MP_TAC o PART_MATCH (lhs o rand) AFFINE_HULL_INSERT_SPAN o + rand o snd) THEN + ANTS_TAC THENL + [REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY] THEN + REWRITE_TAC[VECTOR_ARITH `u = u + a <=> a = vec 0`] THEN + ASM_MESON_TAC[INDEPENDENT_NONZERO; IN_INSERT]; + ALL_TAC] THEN + DISCH_THEN SUBST1_TAC THEN + ONCE_REWRITE_TAC[SIMPLE_IMAGE_GEN] THEN + REWRITE_TAC[SIMPLE_IMAGE; IMAGE_CLAUSES; IMAGE_ID; VECTOR_ADD_SUB] THEN + MATCH_MP_TAC SUBSET_TRANS THEN EXISTS_TAC + `IMAGE (\v:real^3. v0 + v) (span{v1 - v0, v2 - v0, v3 - v0})` THEN + ASM_SIMP_TAC[IMAGE_SUBSET] THEN + REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_IMAGE] THEN CONJ_TAC THENL + [EXISTS_TAC `vec 0:real^3` THEN REWRITE_TAC[SPAN_0] THEN VECTOR_ARITH_TAC; + REWRITE_TAC[VECTOR_ARITH `v1:real^N = v0 + x <=> x = v1 - v0`] THEN + REWRITE_TAC[UNWIND_THM2] THEN REPEAT CONJ_TAC THEN + MATCH_MP_TAC SPAN_SUPERSET THEN REWRITE_TAC[IN_INSERT]]]);; + + + +let COPLANAR = prove + (`2 <= dimindex(:N) + ==> !s:real^N->bool. coplanar s <=> ?u v w. s SUBSET affine hull {u,v,w}`, + DISCH_TAC THEN GEN_TAC THEN REWRITE_TAC[coplanar; plane] THEN + REWRITE_TAC[LEFT_AND_EXISTS_THM] THEN + ONCE_REWRITE_TAC[MESON[] + `(?x u v w. p x u v w) <=> (?u v w x. p x u v w)`] THEN + REWRITE_TAC[GSYM CONJ_ASSOC; RIGHT_EXISTS_AND_THM; UNWIND_THM2] THEN + EQ_TAC THENL [MESON_TAC[]; REWRITE_TAC[LEFT_IMP_EXISTS_THM]] THEN + MAP_EVERY X_GEN_TAC [`u:real^N`; `v:real^N`; `w:real^N`] THEN DISCH_TAC THEN + SUBGOAL_THEN + `s SUBSET {u + x:real^N | x | x IN span {y - u | y IN {v,w}}}` + MP_TAC THENL + [FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP + (REWRITE_RULE[IMP_CONJ] SUBSET_TRANS)) THEN + REWRITE_TAC[AFFINE_HULL_INSERT_SUBSET_SPAN]; + ALL_TAC] THEN + ONCE_REWRITE_TAC[SIMPLE_IMAGE_GEN] THEN + DISCH_THEN(MP_TAC o ISPEC `\x:real^N. x - u` o MATCH_MP IMAGE_SUBSET) THEN + REWRITE_TAC[GSYM IMAGE_o; o_DEF; VECTOR_ADD_SUB; IMAGE_ID; SIMPLE_IMAGE] THEN + REWRITE_TAC[IMAGE_CLAUSES] THEN + MP_TAC(ISPECL [`{v - u:real^N,w - u}`; `2`] LOWDIM_EXPAND_BASIS) THEN + ANTS_TAC THENL + [ASM_REWRITE_TAC[] THEN MATCH_MP_TAC LE_TRANS THEN + EXISTS_TAC `CARD{v - u:real^N,w - u}` THEN + SIMP_TAC[DIM_LE_CARD; FINITE_INSERT; FINITE_RULES] THEN + SIMP_TAC[CARD_CLAUSES; FINITE_RULES] THEN ARITH_TAC; + ALL_TAC] THEN + DISCH_THEN(X_CHOOSE_THEN `t:real^N->bool` + (CONJUNCTS_THEN2 MP_TAC STRIP_ASSUME_TAC)) THEN + CONV_TAC(LAND_CONV HAS_SIZE_CONV) THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`a:real^N`; `b:real^N`] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC) THEN + UNDISCH_TAC `span {v - u, w - u} SUBSET span {a:real^N, b}` THEN + REWRITE_TAC[GSYM IMP_CONJ_ALT] THEN + DISCH_THEN(ASSUME_TAC o MATCH_MP SUBSET_TRANS) THEN + MAP_EVERY EXISTS_TAC [`u:real^N`; `u + a:real^N`; `u + b:real^N`] THEN + CONJ_TAC THENL + [REWRITE_TAC[COLLINEAR_3; COLLINEAR_LEMMA; + VECTOR_ARITH `--x = vec 0 <=> x = vec 0`; + VECTOR_ARITH `u - (u + a):real^N = --a`; + VECTOR_ARITH `(u + b) - (u + a):real^N = b - a`] THEN + REWRITE_TAC[DE_MORGAN_THM; VECTOR_SUB_EQ; + VECTOR_ARITH `b - a = c % -- a <=> (c - &1) % a + &1 % b = vec 0`] THEN + ASM_REWRITE_TAC[] THEN CONJ_TAC THENL + [ASM_MESON_TAC[IN_INSERT; INDEPENDENT_NONZERO]; ALL_TAC] THEN + DISCH_THEN(X_CHOOSE_TAC `u:real`) THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [independent]) THEN + REWRITE_TAC[DEPENDENT_EXPLICIT] THEN + MAP_EVERY EXISTS_TAC [`{a:real^N,b}`; + `\x:real^N. if x = a then u - &1 else &1`] THEN + REWRITE_TAC[FINITE_INSERT; FINITE_RULES; SUBSET_REFL] THEN + CONJ_TAC THENL + [EXISTS_TAC `b:real^N` THEN ASM_REWRITE_TAC[IN_INSERT] THEN + REAL_ARITH_TAC; + ALL_TAC] THEN + SIMP_TAC[VSUM_CLAUSES; FINITE_RULES] THEN + ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; VECTOR_ADD_RID]; + ALL_TAC] THEN + W(MP_TAC o PART_MATCH (lhs o rand) AFFINE_HULL_INSERT_SPAN o rand o snd) THEN + ANTS_TAC THENL + [REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY] THEN + REWRITE_TAC[VECTOR_ARITH `u = u + a <=> a = vec 0`] THEN + ASM_MESON_TAC[INDEPENDENT_NONZERO; IN_INSERT]; + ALL_TAC] THEN + DISCH_THEN SUBST1_TAC THEN + FIRST_ASSUM(MP_TAC o ISPEC `\x:real^N. u + x` o MATCH_MP IMAGE_SUBSET) THEN + REWRITE_TAC[GSYM IMAGE_o; o_DEF; IMAGE_ID; + ONCE_REWRITE_RULE[VECTOR_ADD_SYM] VECTOR_SUB_ADD] THEN + MATCH_MP_TAC(REWRITE_RULE[IMP_CONJ_ALT] SUBSET_TRANS) THEN + REWRITE_TAC[SUBSET; FORALL_IN_IMAGE] THEN + REWRITE_TAC[SIMPLE_IMAGE; IMAGE_CLAUSES; VECTOR_ADD_SUB] THEN + SET_TAC[]);; + +(* this LEMMA in determinants.ml *) +let DET_3 = new_axiom`!A:real^3^3. + det(A) = A$1$1 * A$2$2 * A$3$3 + + A$1$2 * A$2$3 * A$3$1 + + A$1$3 * A$2$1 * A$3$2 - + A$1$1 * A$2$3 * A$3$2 - + A$1$2 * A$2$1 * A$3$3 - + A$1$3 * A$2$2 * A$3$1`;; + + +let det_vec3 = new_definition ` det_vec3 (a:real^3) (b:real^3) (c:real^3) = + a$1 * b$2 * c$3 + b$1 * c$2 * a$3 + c$1 * a$2 * b$3 - + ( a$1 * c$2 * b$3 + b$1 * a$2 * c$3 + c$1 * b$2 * a$3 ) `;; + + +let DET_VEC3_EXPAND = prove + (`det (vector [a; b; (c:real^3)] ) = det_vec3 a b c`, + REWRITE_TAC[det_vec3; DET_3; VECTOR_3] THEN REAL_ARITH_TAC);; + +let COPLANAR_DET_VEC3_EQ_0 = prove( `!v0 v1 (v2: real^3) v3. + coplanar {v0,v1,v2,v3} <=> + det_vec3 ( v1 - v0 ) ( v2 - v0 ) ( v3 - v0 ) = &0`, REWRITE_TAC[COPLANAR_DET_EQ_0; DET_VEC3_EXPAND]);; + + + +let COPLANAR_3 = prove + (`!a b c:real^N. 2 <= dimindex(:N) ==> coplanar {a,b,c}`, + SIMP_TAC[COPLANAR; SUBSET] THEN MESON_TAC[HULL_INC]);; + +let NONCOPLANAR_4_DISTINCT = prove + (`!a b c d:real^N. + ~(coplanar{a,b,c,d}) /\ 2 <= dimindex(:N) + ==> ~(a = b) /\ ~(a = c) /\ ~(a = d) /\ + ~(b = c) /\ ~(b = d) /\ ~(c = d)`, + REPEAT GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN REWRITE_TAC[DE_MORGAN_THM] THEN + STRIP_TAC THEN ASM_SIMP_TAC[INSERT_AC; COPLANAR_3]);; + + + +let NONCOPLANAR_3_BASIS = prove + (`!v1 v2 v3 v0 v:real^3. + ~coplanar {v0, v1, v2, v3} + ==> (?t1 t2 t3. + v = t1 % (v1 - v0) + t2 % (v2 - v0) + t3 % (v3 - v0) /\ + (!ta tb tc. + v = ta % (v1 - v0) + tb % (v2 - v0) + tc % (v3 - v0) + ==> ta = t1 /\ tb = t2 /\ tc = t3))`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM(MP_TAC o MATCH_MP (REWRITE_RULE[IMP_CONJ] + NONCOPLANAR_4_DISTINCT)) THEN + REWRITE_TAC[DIMINDEX_3; ARITH] THEN STRIP_TAC THEN + SUBGOAL_THEN `independent {v1 - v0:real^3,v2 - v0,v3 - v0}` ASSUME_TAC THENL + [FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE RAND_CONV [COPLANAR_DET_EQ_0]) THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN REWRITE_TAC[independent] THEN + DISCH_TAC THEN MATCH_MP_TAC DET_DEPENDENT_ROWS THEN + REWRITE_TAC[rows; row; LAMBDA_ETA; GSYM IN_NUMSEG; DIMINDEX_3] THEN + ONCE_REWRITE_TAC[SIMPLE_IMAGE] THEN + CONV_TAC(ONCE_DEPTH_CONV NUMSEG_CONV) THEN + ASM_REWRITE_TAC[IMAGE_CLAUSES; VECTOR_3]; + ALL_TAC] THEN + MP_TAC(ISPECL [`(:real^3)`; `{v1 - v0:real^3,v2 - v0,v3 - v0}`] + CARD_GE_DIM_INDEPENDENT) THEN + ASM_REWRITE_TAC[DIM_UNIV; SUBSET_UNIV] THEN ANTS_TAC THENL + [SIMP_TAC[CARD_CLAUSES; FINITE_INSERT; FINITE_RULES] THEN + ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; DIMINDEX_3; ARITH; + VECTOR_ARITH `x - a:real^N = y - a <=> x = y`]; + ALL_TAC] THEN + REWRITE_TAC[SUBSET; IN_UNIV; SPAN_BREAKDOWN_EQ; SPAN_EMPTY] THEN + DISCH_THEN(MP_TAC o SPEC `v:real^3`) THEN + MAP_EVERY (fun t -> MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC t) + [`t1:real`; `t2:real`; `t3:real`] THEN + REWRITE_TAC[IN_SING; VECTOR_ARITH + `a - b - c - d:real^N = vec 0 <=> a = b + c + d`] THEN + DISCH_THEN SUBST1_TAC THEN REWRITE_TAC[] THEN + MAP_EVERY X_GEN_TAC [`ta:real`; `tb:real`; `tc:real`] THEN + REWRITE_TAC[VECTOR_ARITH + `t1 % x + t2 % y + t3 % z = ta % x + tb % y + tc % z <=> + (t1 - ta) % x + (t2 - tb) % y + (t3 - tc) % z = vec 0`] THEN + STRIP_TAC THEN FIRST_ASSUM(MP_TAC o GEN_REWRITE_RULE I [independent]) THEN + REWRITE_TAC[DEPENDENT_EXPLICIT; NOT_EXISTS_THM] THEN + DISCH_THEN(MP_TAC o SPECL + [`{v1 - v0:real^3,v2 - v0,v3 - v0}`; + `\v:real^3. if v = v1 - v0 then t1 - ta + else if v = v2 - v0 then t2 - tb + else t3 - tc`]) THEN + SIMP_TAC[FINITE_INSERT; FINITE_RULES; SUBSET_REFL; VSUM_CLAUSES] THEN + ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; VECTOR_ADD_RID; + RIGHT_OR_DISTRIB; EXISTS_OR_THM; UNWIND_THM2; + VECTOR_ARITH `x - a:real^N = y - a <=> x = y`] THEN + SIMP_TAC[DE_MORGAN_THM; REAL_SUB_0]);; + +*) + + + + + + +let DET_VEC3_AND_DELTA = prove(`!(a:real^3) b c d. + &4 * ( det_vec3 (a - d) (b - d) (c - d) ) pow 2 = + delta ( d3 a d pow 2) + (d3 b d pow 2) + (d3 c d pow 2) (d3 a b pow 2) (d3 a c pow 2) (d3 b c pow 2) `, +SIMP_TAC[d3; dist] THEN +REWRITE_TAC[GSYM (MESON[VECTOR_ARITH ` (a :real^N) - b = ( a - x ) - ( b - x ) `]` + delta (norm (a - d) pow 2) (norm (b - d) pow 2) + (norm (c - d) pow 2) (norm ((a - d) - (b - d )) pow 2) +(norm ((a - d) - ( c - d )) pow 2) (norm ((b - d ) - ( c - d )) pow 2) = + delta (norm (a - d) pow 2) (norm (b - d) pow 2) (norm (c - d) pow 2) +(norm (a - b) pow 2) (norm (a - c) pow 2) (norm (b - c) pow 2) `)] THEN +SIMP_TAC[ vector_norm; DOT_POS_LE; SQRT_WORKS] THEN +REWRITE_TAC[DOT_3] THEN +REWRITE_TAC[MESON[lemma_cm3]`((a:real^3) - d - (b - d))$1 = (a - d)$1 - (b - d)$1 /\ + (a - d - (b - d))$2 = (a - d)$2 - (b - d)$2 /\ + (a - d - (b - d))$3 = (a - d)$3 - (b - d)$3 `] THEN +REWRITE_TAC[delta; det_vec3] THEN +REAL_ARITH_TAC);; + + + +let POLFLZY = prove(` !(x1:real^3) x2 x3 x4. + let x12 = dist (x1,x2) pow 2 in + let x13 = dist (x1,x3) pow 2 in + let x14 = dist (x1,x4) pow 2 in + let x23 = dist (x2,x3) pow 2 in + let x24 = dist (x2,x4) pow 2 in + let x34 = dist (x3,x4) pow 2 in + coplanar {x1, x2, x3, x4} <=> delta x12 x13 x14 x23 x24 x34 = &0 `, +LET_TR THEN REPEAT GEN_TAC THEN MP_TAC (GSYM (SPECL [` x2 :real^3`; +` x3:real^3`;` x4:real^3`; ` x1 :real^3`] DET_VEC3_AND_DELTA)) THEN +SIMP_TAC[d3; DIST_SYM] THEN REWRITE_TAC[REAL_ARITH ` &4 * a = &0 <=> a = &0 `] +THEN SIMP_TAC[GSYM ( REAL_FIELD ` x = &0 <=> x pow 2 = &0 `); +COPLANAR_DET_VEC3_EQ_0]);; + + +let LEMMA15 = POLFLZY;; + +let muy_delta = new_definition ` muy_delta = delta `;; + +(* LEMMA29 *) +let VCRJIHC = prove(`!(v1:real^3) v2 v3 v4 x34 x12 x13 x14 x23 x24. + condA v1 v2 v3 v4 x12 x13 x14 x23 x24 x34 + ==> muy_delta x12 x13 x14 x23 x24 (dist (v3,v4) pow 2) = &0`, +REWRITE_TAC[condA; muy_delta] THEN MP_TAC POLFLZY THEN LET_TR THEN MESON_TAC[]);; + + +let ZERO_NEUTRAL = REAL_ARITH ` ! x. &0 * x = &0 /\ x * &0 = &0 /\ &0 + x = x /\ x + &0 = x /\ x - &0 = x /\ + -- &0 = &0 `;; + +let EQUATE_CONEFS_POLINOMIAL_POW2 = prove( `!a b c aa bb cc. ( ! x. + a * x pow 2 + b * x + c = aa * x pow 2 + bb * x + cc ) <=> + a = aa /\ b = bb /\ c = cc`, REPEAT GEN_TAC THEN EQ_TAC THENL [ +NHANH (MESON[]` (! (x:real). P x ) ==> P ( &0 ) /\ P ( &1 ) /\ P ( -- &1 )`) THEN +REAL_ARITH_TAC THEN REAL_ARITH_TAC; SIMP_TAC[]]);; + +let GJWYYPS = prove(`!x12 x13 x14 x15 x23 x24 x25 x34 x35 a b c. + (! x45. cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 = + a * x45 pow 2 + b * x45 + c ) + ==> b pow 2 - &4 * a * c = + &16 * delta x12 x13 x14 x23 x24 x34 * delta x12 x13 x15 x23 x25 x35`, +ONCE_REWRITE_TAC[LTCTBAN] THEN REPEAT GEN_TAC THEN +REWRITE_TAC[EQUATE_CONEFS_POLINOMIAL_POW2] THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] +THEN SIMP_TAC[] THEN DISCH_TAC THEN REWRITE_TAC[ups_x; cayleytr; cayleyR; + delta; ZERO_NEUTRAL] THEN REAL_ARITH_TAC);; + +let LEMMA51 = GJWYYPS ;; + +g `!v1 v2 (v:real^3). ~(v1 = v2) ==> (collinear {v, v1, v2} <=> v IN aff {v1, v2})`;; +e (REWRITE_TAC[COLLINEAR_EX]);; +e (NHANH (MESON[]` a % b + c = vec 0 ==> ( a = &0 \/ ~(a = &0 ))`));; +e (KHANANG);; +e (NGOAC THEN PURE_ONCE_REWRITE_TAC[MESON[]` P a /\ a = &0 <=> P ( &0 ) + /\ a = &0 `]);; +e (REWRITE_TAC[REAL_ADD_LID; VECTOR_MUL_LZERO; VECTOR_ADD_LID]);; +e (REWRITE_TAC[REAL_ARITH ` a + b= &0 <=> a = -- b `; VECTOR_ARITH` a % x + b % y = vec 0 + <=> a % x = ( -- b) % y`]);; +e (NHANH (MESON[REAL_ARITH ` a = &0 <=> -- a = &0 `; VECTOR_MUL_LCANCEL]` (b = --c /\ ~(b = &0 /\ c = &0)) /\ b % v1 = --c % v2 + ==> v1 = v2 `));; +e (SIMP_TAC[]);; +e (REWRITE_TAC[AFF_2POINTS_INTERPRET; IN_ELIM_THM]);; +e (REPEAT GEN_TAC THEN DISCH_TAC THEN EQ_TAC);; +e (REWRITE_TAC[VECTOR_ARITH ` a % v + b % v1 + c % v2 = vec 0 <=> + a % v = ( -- b) % v1 + ( --c ) % v2 `]);; +e (PHA THEN REWRITE_TAC[MESON[CHANGE_SIDE]` a % v = v1 /\ + ~(a = &0) <=> v = &1 / a % v1 /\ ~( a = &0 ) `]);; +e (REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * b = b / a`]);; +e (REWRITE_TAC[AFF_2POINTS_INTERPRET; IN_ELIM_THM]);; +e (MESON_TAC[REAL_FIELD ` ~ ( a = &0 ) /\ a = -- (b + c) ==> + ( -- b) / a + ( -- c) / a = &1 `]);; +e (STRIP_TAC);; +e (EXISTS_TAC ` &1 `);; +e (EXISTS_TAC ` -- ta`);; +e (EXISTS_TAC ` -- tb`);; +e (PHA);; +e (ASM_SIMP_TAC[REAL_ARITH` ~(&1 = &0 ) /\ -- ( -- a + -- b ) = a + b `]);; +e (CONV_TAC VECTOR_ARITH);; + +let NOT_TOW_EQ_IMP_COL_EQUAVALENT = top_thm();; + + +let LEMMA30 = prove(`!v1 v2 v3 v4 x12 x13 x14 x23 x24 x34 a b c. + condA v1 v2 v3 v4 x12 x13 x14 x23 x24 x34 /\ + (!x12 x13 x14 x23 x24 x34. + muy_delta x12 x13 x14 x23 x24 x34 = + a x12 x13 x14 x23 x24 * x34 pow 2 + + b x12 x13 x14 x23 x24 * x34 + + c x12 x13 x14 x23 x24 ) + ==> (v3 IN aff {v1, v2} \/ v4 IN aff {v1, v2} <=> + b x12 x13 x14 x23 x24 pow 2 - + &4 * a x12 x13 x14 x23 x24 * c x12 x13 x14 x23 x24 = + &0)`, +REWRITE_TAC[muy_delta; DELTA_COEFS; EQUATE_CONEFS_POLINOMIAL_POW2 ] THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN SIMP_TAC[] THEN REPEAT GEN_TAC THEN +DISCH_TAC THEN REWRITE_TAC[REAL_ARITH` a - b * -- c * d = a + b * c * d `; +AGBWHRD] THEN DOWN_TAC THEN SIMP_TAC[condA; REAL_ENTIRE; +GSYM NOT_TOW_EQ_IMP_COL_EQUAVALENT] THEN ONCE_REWRITE_TAC[MESON[PER_SET3]` + p {v3, v1, v2} \/ p {v4, v1, v2} <=> p {v1,v2,v3} \/ p {v1,v2,v4} `] THEN +ONCE_REWRITE_TAC[MESON[UPS_X_SYM]` ups_x x12 x23 x13 = &0 \/ +ups_x x12 x24 x14 = &0 <=> ups_x x12 x13 x23 = &0 \/ +ups_x x12 x14 x24 = &0 `] THEN MESON_TAC[UPS_X_SYM; PER_SET3; FHFMKIY]);; + +let EWVIFXW = LEMMA30;; + + + +let WITH_COEF1 = prove(` ! (v1:real^3) (v2:real^3) (v3:real^3) (v:real^3). + ~ collinear {v1,v2,v3} /\ v IN affine hull {v1, v2, v3} + ==> ( &0 < coef1 v1 v2 v3 v <=> v IN aff_gt {v2,v3} {v1} ) /\ + ( &0 = coef1 v1 v2 v3 v <=> v IN aff {v2,v3} ) /\ + ( coef1 v1 v2 v3 v < &0 <=> v IN aff_lt {v2,v3} {v1} ) `, +SIMP_TAC[COEF1_POS_EQ_V1_IN; COEFS1_EQ_0_IFF_V_IN_AFF; COEF1_NEG_IFF_V1_IN_AFF_LT]);; + +let PER_COEF1_COEF2 = prove(` ! (v1:real^3) (v2:real^3) (v3:real^3) (v:real^3). + v IN affine hull {v1, v2, v3} /\ ~collinear {v1, v2, v3} +==> coef1 v2 v3 v1 v = coef2 v1 v2 v3 v ` , +NHANH (SPEC_ALL COEFS) THEN +ONCE_REWRITE_TAC[MESON[PER_SET3]` p {a,b,c} = p {b,c,a} `] THEN +NHANH (SPEC_ALL COEFS) THEN MESON_TAC[VEC_PER2_3; REAL_PER3]);; + + +let PER_COEF1_COEF3 = prove(` ! (v1:real^3) (v2:real^3) (v3:real^3) (v:real^3). + v IN affine hull {v1, v2, v3} /\ ~collinear {v1, v2, v3} +==> coef1 v3 v1 v2 v = coef3 v1 v2 v3 v `, NHANH (SPEC_ALL COEFS) THEN +ONCE_REWRITE_TAC[MESON[PER_SET3]` p {a,b,c} = p {c,a,b} `] THEN +NHANH (SPEC_ALL COEFS) THEN MESON_TAC[VEC_PER2_3; REAL_PER3]);; + +let PER_COEF1 = prove( ` ! (v1:real^3) (v2:real^3) (v3:real^3) (v:real^3). + v IN affine hull {v1, v2, v3} /\ ~collinear {v1, v2, v3} +==> coef1 v3 v1 v2 v = coef3 v1 v2 v3 v /\ coef1 v2 v3 v1 v = coef2 v1 v2 v3 v `, +SIMP_TAC[PER_COEF1_COEF2; PER_COEF1_COEF3]);; + + + +let LEMMA12 = prove(`! (v1:real^3) (v2:real^3) (v3:real^3) (v:real^3). +~ collinear {v1,v2,v3} /\ v IN affine hull {v1, v2, v3} + ==> ( &0 < coef1 v1 v2 v3 v <=> v IN aff_gt {v2,v3} {v1} ) /\ + ( &0 = coef1 v1 v2 v3 v <=> v IN aff {v2,v3} ) /\ + ( coef1 v1 v2 v3 v < &0 <=> v IN aff_lt {v2,v3} {v1} ) /\ + ( &0 < coef2 v1 v2 v3 v <=> v IN aff_gt {v3,v1} {v2} ) /\ + ( &0 = coef2 v1 v2 v3 v <=> v IN aff {v3,v1} ) /\ + ( coef2 v1 v2 v3 v < &0 <=> v IN aff_lt {v3,v1} {v2} )/\ + ( &0 < coef3 v1 v2 v3 v <=> v IN aff_gt {v1,v2} {v3} ) /\ + ( &0 = coef3 v1 v2 v3 v <=> v IN aff {v1,v2} ) /\ + ( coef3 v1 v2 v3 v < &0 <=> v IN aff_lt {v1,v2} {v3})`, +MP_TAC WITH_COEF1 THEN SIMP_TAC[PER_SET3; GSYM PER_COEF1_COEF3; PER_COEF1]);; + +let CNXIFFC = LEMMA12;; + + +let NGAY_23_THANG1 = prove(`! (v1:real^3) (v2:real^3) (v3:real^3) (v:real^3). ~collinear {v1, v2, v3} /\ v IN affine hull {v1, v2, v3} ==> + ( v IN aff_ge {v2, v3} {v1} <=> &0 <= coef1 v1 v2 v3 v ) /\ + ( v IN aff_ge {v3,v1} {v2} <=> &0 <= coef2 v1 v2 v3 v ) /\ + ( v IN aff_ge {v1,v2} {v3} <=> &0 <= coef3 v1 +v2 v3 v ) `, +REWRITE_TAC[IN_AFF_GE_INTERPRET_TO_AFF_GT_AND_AFF; REAL_ARITH ` &0 <= a + <=> &0 < a \/ &0 = a `] THEN SIMP_TAC[CNXIFFC]);; + + +let MYOQCBS = prove(` !(v1:real^3) v2 v3 v. + ~collinear {v1, v2, v3} /\ v IN affine hull {v1, v2, v3} + ==> (v IN conv {v1, v2, v3} <=> + &0 <= coef1 v1 v2 v3 v /\ + &0 <= coef2 v1 v2 v3 v /\ + &0 <= coef3 v1 v2 v3 v) /\ + (v IN conv0 {v1, v2, v3} <=> + &0 < coef1 v1 v2 v3 v /\ + &0 < coef2 v1 v2 v3 v /\ + &0 < coef3 v1 v2 v3 v) `, +SIMP_TAC[IN_CONV3_EQ; IN_CONV03_EQ; NGAY_23_THANG1; CNXIFFC ] THEN MESON_TAC[]);; + +let LEMMA51 = GJWYYPS;; +let LEMMA50 = LTCTBAN;; +let muy_v = new_definition ` muy_v (x1: real^N ) (x2:real^N) (x3:real^N) (x4:real^N) +(x5:real^N) x45 = + (let x12 = dist (x1,x2) pow 2 in + let x13 = dist (x1,x3) pow 2 in + let x14 = dist (x1,x4) pow 2 in + let x15 = dist (x1,x5) pow 2 in + let x23 = dist (x2,x3) pow 2 in + let x24 = dist (x2,x4) pow 2 in + let x25 = dist (x2,x5) pow 2 in + let x34 = dist (x3,x4) pow 2 in + let x35 = dist (x3,x5) pow 2 in + cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45) `;; + +let REMOVE_TAC = MATCH_MP_TAC (MESON[]` a ==> b ==> a `);; + +let ALE = MESON[LTCTBAN]`!x12 x13 x14 x15 x23 x24 x25 x34 x35. + (!a b c. (! x. + cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x = + a * x pow 2 + b * x + c ) + ==> b pow 2 - &4 * a * c = &0) + ==> cayleytr x12 x13 x14 x15 x23 x24 x25 x34 x35 (&0) pow 2 - + &4 * + ups_x x12 x13 x23 * + cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 (&0) = + &0`;; + +let DISCRIMINANT_OF_CAY = MESON[LTCTBAN; GJWYYPS]`cayleytr x12 x13 x14 x15 x23 x24 x25 x34 x35 (&0) pow 2 - + &4 * ups_x x12 x13 x23 * cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 (&0) = + &16 * delta x12 x13 x14 x23 x24 x34 * delta x12 x13 x15 x23 x25 x35`;; + +let NOT_TWO_EQ_IMP_COL_EQUAVALENT = NOT_TOW_EQ_IMP_COL_EQUAVALENT;; + +let GDLRUZB = prove(` ! (v1:real^3) (v2:real^3) (v3:real^3) (v4:real^3) (v5:real^3) a b c. + coplanar {v1, v2, v3, v4} \/ coplanar {v1, v2, v3, v5} <=> + (! a b c. (! x. muy_v v1 v2 v3 v4 v5 x = a * x pow 2 + b * x + c ) + ==> b pow 2 - &4 * a * c = &0) `,REWRITE_TAC[muy_v] THEN LET_TR THEN +REPEAT GEN_TAC THEN EQ_TAC THENL [DISCH_TAC THEN +NHANH (MESON[GJWYYPS]` (!x45. cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 = + a * x45 pow 2 + b * x45 + c) + ==> b pow 2 - &4 * a * c = + &16 * + delta x12 x13 x14 x23 x24 x34 * + delta x12 x13 x15 x23 x25 x35`) THEN SIMP_TAC[] THEN +UNDISCH_TAC ` coplanar {(v1:real^3), v2, v3, v4}\/ coplanar {v1, v2, v3, v5}` THEN +MP_TAC LEMMA15 THEN LET_TR THEN REWRITE_TAC[REAL_FIELD` &16 * a * b = &0 +<=> a = &0 \/ b = &0 `] THEN SIMP_TAC[]; NHANH (SPEC_ALL ALE) THEN +REWRITE_TAC[DISCRIMINANT_OF_CAY ] THEN MP_TAC POLFLZY THEN LET_TR THEN +REWRITE_TAC[REAL_FIELD` &16 * a * b = &0 <=> a = &0 \/ b = &0 `] THEN +MESON_TAC[]]);; + + +let DET_VECC3_AND_DELTA = prove(` (! d a b c . + delta (d3 d a pow 2) (d3 d b pow 2) (d3 d c pow 2) (d3 a b pow 2) + (d3 a c pow 2) + (d3 b c pow 2) = + &4 * det_vec3 (a - d) (b - d) (c - d) pow 2) `, MESON_TAC[D3_SYM; +DET_VEC3_AND_DELTA]);; + + +let DELTA_POS_4POINTS = prove(`!x1 x2 x3 (x4:real^3). + &0 <= + delta (dist (x1,x2) pow 2) (dist (x1,x3) pow 2) (dist (x1,x4) pow 2) + (dist (x2,x3) pow 2) + (dist (x2,x4) pow 2) + (dist (x3,x4) pow 2)`, REWRITE_TAC[GSYM d3] THEN SIMP_TAC[D3_SYM] THEN +MP_TAC (DET_VECC3_AND_DELTA) THEN SIMP_TAC[] THEN DISCH_TAC THEN MP_TAC + REAL_LE_SQUARE_POW THEN MESON_TAC[REAL_ARITH` &0 <= x <=> &0 <= &4 * x `]);; + + + +let DIST_POW2_DOT = +prove(` ! a (b:real^N) . dist (a,b) pow 2 = ( a - b ) dot ( a- b) `, +SIMP_TAC[dist; vector_norm; DOT_POS_LE; SQRT_WORKS]);; + +(* this lemma is proved as below, but it take quite a long time to run it *) +let CAYLEYR_5POINTS = new_axiom` !x1 x2 x3 x4 (x5 :real^3). + let x12 = dist (x1,x2) pow 2 in + let x13 = dist (x1,x3) pow 2 in + let x14 = dist (x1,x4) pow 2 in + let x15 = dist (x1,x5) pow 2 in + let x23 = dist (x2,x3) pow 2 in + let x24 = dist (x2,x4) pow 2 in + let x25 = dist (x2,x5) pow 2 in + let x34 = dist (x3,x4) pow 2 in + let x35 = dist (x3,x5) pow 2 in + let x45 = dist (x4,x5) pow 2 in + cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 = &0 `;; + +(* let CAYLEYR_5POINTS = prove(` !x1 x2 x3 x4 (x5 :real^3). + let x12 = dist (x1,x2) pow 2 in + let x13 = dist (x1,x3) pow 2 in + let x14 = dist (x1,x4) pow 2 in + let x15 = dist (x1,x5) pow 2 in + let x23 = dist (x2,x3) pow 2 in + let x24 = dist (x2,x4) pow 2 in + let x25 = dist (x2,x5) pow 2 in + let x34 = dist (x3,x4) pow 2 in + let x35 = dist (x3,x5) pow 2 in + let x45 = dist (x4,x5) pow 2 in + cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 = &0 `, +LET_TR THEN REWRITE_TAC[ DIST_POW2_DOT] THEN REPEAT GEN_TAC THEN +REWRITE_TAC[ MESON[VECTOR_ARITH` (a:real^n) - b = a - x - ( b - x ) `]` + AA ( (x1 - x5 ) dot ( x1 - x5)) ((x2 - x3) dot (x2 - x3)) + ((x2 - x4) dot (x2 - x4)) + ((x2 - x5) dot (x2 - x5)) + ((x3 - x4) dot (x3 - x4)) + ((x3 - x5) dot (x3 - x5)) + ((x4 - x5) dot (x4 - x5)) = + AA ( (x1 - x5 ) dot ( x1 - x5)) ((x2 - x1 - ( x3 - x1 )) dot (x2 - x1 - ( x3 - x1 ))) + ((x2 - x1 - ( x4 - x1 )) dot (x2 - x1 - ( x4 - x1 ))) + ((x2 - x1 - ( x5 - x1 )) dot (x2 - x1 - ( x5 - x1 ))) + ((x3 - x1 - ( x4 - x1 )) dot (x3 - x1 - ( x4 - x1 ))) + ((x3 - x1 - ( x5 - x1 )) dot (x3 - x1 - ( x5 - x1 ))) + ((x4 - x1 - ( x5 - x1 )) dot (x4 - x1 - ( x5 - x1 ))) ` ] THEN +SIMP_TAC[VECTOR_ARITH ` ((x4: real^N) - x1 - (x5 - x1)) = x1 - x5 - ( x1 - x4 ) `] THEN +ABBREV_TAC ` x12 = (x1 - ( x2:real^3)) ` THEN +ABBREV_TAC ` x13 = (x1 - ( x3:real^3)) ` THEN +ABBREV_TAC ` x14 = (x1 - ( x4:real^3)) ` THEN +ABBREV_TAC ` x15 = (x1 - ( x5:real^3)) ` THEN +REWRITE_TAC[DOT_3] THEN REWRITE_TAC[lemma_cm3; cayleyR] THEN REAL_AROTH_TAC);; *) + + +let UPS_X_POS = MESON[lemma8; UPS_X_SYM; NORM_SUB]` &0 <= + ups_x (norm ((x1 : real^3) - x2) pow 2) (norm (x1 - x3) pow 2) + (norm (x2 - x3) pow 2) `;; + +let UPS_X_SYM = MESON[UPS_X_SYM]` !x y z. ups_x x y z = ups_x y x z /\ ups_x x y z = ups_x x z y + /\ ups_x x y z = ups_x x z y `;; + +let LEMMA3 = prove(` !x1 x2 x3 x4 (x5 :real^3). + let x12 = dist (x1,x2) pow 2 in + let x13 = dist (x1,x3) pow 2 in + let x14 = dist (x1,x4) pow 2 in + let x15 = dist (x1,x5) pow 2 in + let x23 = dist (x2,x3) pow 2 in + let x24 = dist (x2,x4) pow 2 in + let x25 = dist (x2,x5) pow 2 in + let x34 = dist (x3,x4) pow 2 in + let x35 = dist (x3,x5) pow 2 in + let x45 = dist (x4,x5) pow 2 in + &0 <= ups_x x12 x13 x23 /\ + &0 <= delta x12 x13 x14 x23 x24 x34 /\ + cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 = &0 `, MP_TAC +CAYLEYR_5POINTS THEN LET_TR THEN +SIMP_TAC[ dist; UPS_X_POS; DELTA_POS_4POINTS]);; + + +(* LEMMA 3 *) +let NUHSVLM = LEMMA3;; + +let LEMMA52 = prove( `! v1 v2 v3 v4 (v5:real^3). + muy_v v1 v2 v3 v4 v5 ( (d3 v4 v5) pow 2 ) = &0 `, +REWRITE_TAC[muy_v; d3] THEN MP_TAC LEMMA3 THEN +LET_TR THEN SIMP_TAC[]);; + +let PFDFWWV = LEMMA52;; + +let PRE_VIET = +REAL_ARITH `!x x1 x2. (x - x1) * (x - x2) = x pow 2 - (x1 + x2) * x + x1 * x2 /\ + a * (x - x1) * (x - x2) = a * x pow 2 + ( -- a * (x1 + x2)) * x + a * x1 * x2 `;; + + +let VIET_THEOREM = prove(`! x1 x2 a b c. (!x. a * x pow 2 + b * x + c = +a * (x - x1) * (x - x2)) ==> -- b = a * ( x1 + x2 ) /\ c = a * x1 * x2 `, +REWRITE_TAC[PRE_VIET; REAL_LDISTRIB;REAL_SUB_LDISTRIB; +REAL_ARITH ` a - b * c = a + -- b * c `; REAL_ARITH` ( a + b ) + c = +a + b + c `] THEN +REWRITE_TAC[REAL_MUL_ASSOC; EQUATE_CONEFS_POLINOMIAL_POW2] THEN +SIMP_TAC[] THEN REAL_ARITH_TAC);; + +let ADD_SUB_POW2_EX = REAL_RING ` ( a + b ) pow 2 = a pow 2 + &2 * a * b + b pow 2 /\ +( a - b ) pow 2 = a pow 2 - &2 * a * b + b pow 2 `;; + +let PRESENT_SUB_POW2 = REAL_RING` ! a b. ( a - b ) pow 2 = ( a + b ) pow 2 + - &4 * a * b `;; + +let DIST_ROOT_AND_DISCRIMINANT = prove(` ! a b c x1 x2. ( ! x. a * x pow 2 + b * x + c = + a * ( x - x1 ) * ( x - x2 ) ) + ==> ( a pow 2 ) * ( x1 - x2 ) pow 2 = b pow 2 - &4 * a * c `, +NHANH (SPEC_ALL VIET_THEOREM) THEN REWRITE_TAC[PRESENT_SUB_POW2] THEN +SIMP_TAC[REAL_ARITH ` -- b = a <=> b = -- a `] THEN REAL_ARITH_TAC);; + +(* le 33. P 22 MARKED *) + +let REAL_EQ_TO_LE_LT = REAL_ARITH ` + ( a = b <=> ~( a < b \/ b < a ) )`;; + +let FEBRUARY_13_09 = prove(` &0 < (u - v) dot (&2 % x - (u + v)) <=> + &0 < (u - v) dot (x - &1 / &2 % (u + v)) `, +ONCE_REWRITE_TAC[MESON[REAL_ARITH ` &0 < a <=> &0 < &2 * a `]` (a <=> &0 < b ) <=> + ( a <=> &0 < &2 * b ) `] THEN ONCE_REWRITE_TAC[VECTOR_ARITH ` x * (a dot b) = + a dot x % b `] THEN +REWRITE_TAC[GSYM VECTOR_SUB_DISTRIBUTE; VECTOR_MUL_ASSOC] THEN +REWRITE_TAC[REAL_ARITH ` &2 * &1 / &2 = &1 `; VECTOR_MUL_LID]);; + +let SUB_DOT_NEG_TO_POS = MESON[VECTOR_ARITH ` ( a - b ) dot x = +-- (( b - a ) dot x ) `; REAL_ARITH ` -- a < &0 <=> &0 < a `] +`! a b. ( a - b ) dot x < &0 <=> &0 < ( b - a ) dot x `;; + + +let LEMMA6 = prove(` !(u:real^3) v. ~(u = v) ==> plane_norm (bis u v) `, +REWRITE_TAC[plane_norm; bis] THEN REPEAT STRIP_TAC THEN +EXISTS_TAC ` (u: real^3) - v ` THEN +EXISTS_TAC ` &1 / &2 % ((u: real^3) + v )` THEN +REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM] THEN ASM_SIMP_TAC[VECTOR_SUB_EQ] THEN +REWRITE_TAC[REAL_EQ_TO_LE_LT; DIST_LT_HALF_PLANE;FEBRUARY_13_09; + SUB_DOT_NEG_TO_POS] THEN SIMP_TAC[VECTOR_ADD_SYM] THEN MESON_TAC[]);; + +let BXVMKNF = LEMMA6;; + + +let b_coef = BC_DEL_FOR;; +let c_coef = b_coef ;; + +let DELTA_X34_B = prove(` ! x12 x13 x14 x23 x24 x. delta_x34 x12 x13 x14 x23 x24 x = + -- &2 * x12 * x + b_coef x12 x13 x14 x23 x24 `, REWRITE_TAC[ delta_x34; b_coef]);; + + + + +let EQ_POW2_COND = prove(`!a b. &0 <= a /\ &0 <= b ==> (a = b <=> a pow 2 = b pow 2)`, +REWRITE_TAC[REAL_ARITH` a = b <=> a <= b /\ b <= a `] THEN SIMP_TAC[POW2_COND]);; + + +let EQ_SQRT_POW2_EQ = prove(` &0 <= a /\ &0 <= b ==> ( a = sqrt b <=> a pow 2 = b ) `, +SIMP_TAC[SQRT_WORKS; EQ_POW2_COND]);; + + +let LEMMA33 = prove(` !x34 x12 x13 v1 x14 v3 x23 v2 v4 x24 x34' x34'' a. + condA v1 v2 v3 v4 x12 x13 x14 x23 x24 x34 /\ + (! x. muy_delta x12 x13 x14 x23 x24 x = a * ( x - x34' ) * ( x - x34'')) +/\ x34' <= x34'' + ==> delta_x34 x12 x13 x14 x23 x24 x34' = + sqrt (ups_x x12 x13 x23 * ups_x x12 x14 x24) /\ + delta_x34 x12 x13 x14 x23 x24 x34'' = + --sqrt (ups_x x12 x13 x23 * ups_x x12 x14 x24) `, +REWRITE_TAC[muy_delta; DELTA_X34_B; DELTA_COEFS] THEN +SIMP_TAC[EQUATE_CONEFS_POLINOMIAL_POW2; PRE_VIET; +REAL_ARITH ` -- a = b <=> b = -- a`] THEN +SIMP_TAC[REAL_RING `-- &2 * x12 * x34' + -- --x12 * (x34' + x34'') = a <=> + -- &2 * x12 * x34'' + -- --x12 * (x34' + x34'') = -- a `] THEN +REWRITE_TAC[REAL_ARITH` -- &2 * x12 * x34'' + -- --x12 * (x34' + x34'') + = x12 * ( x34' - x34'' ) `; condA] THEN REPEAT STRIP_TAC THEN +EXPAND_TAC "x12" THEN EXPAND_TAC "x13" THEN EXPAND_TAC "x23" THEN +EXPAND_TAC "x14" THEN EXPAND_TAC "x24" THEN +UNDISCH_TAC ` x34' <= (x34'':real)` THEN +ONCE_REWRITE_TAC[REAL_ARITH ` a <= b <=> &0 <= b - a `] THEN +ONCE_REWRITE_TAC[ REAL_ARITH ` a * ( b - c ) = -- ( a * ( c - b ) ) `] THEN +MP_TAC (GEN_ALL TROI_OI_DAT_HOI) THEN MP_TAC REAL_LE_POW_2 THEN +REWRITE_TAC[REAL_ARITH` -- a = -- b <=> a = b `] THEN +SIMP_TAC[UPS_X_SYM; REAL_LE_MUL; EQ_SQRT_POW2_EQ ] THEN +ASM_SIMP_TAC[] THEN REPEAT STRIP_TAC THEN +ONCE_REWRITE_TAC[ REAL_ARITH ` ( a * b ) pow 2 = a pow 2 * b pow 2 `] THEN +REWRITE_TAC[PRESENT_SUB_POW2] THEN +REWRITE_TAC[REAL_SUB_LDISTRIB; REAL_ARITH ` a pow 2 * b pow 2 = +( -- a * b ) pow 2 /\ a pow 2 * &4 * b = -- a * &4 * -- a * b `] THEN +UNDISCH_TAC `b_coef x12 x13 x14 x23 x24 = --a * (x34' + x34'')` THEN +UNDISCH_TAC `c_coef x12 x13 x14 x23 x24 = a * x34' * x34''` THEN +UNDISCH_TAC `(a: real) = --x12` THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +SIMP_TAC[] THEN SIMP_TAC[REAL_ARITH` -- -- a = a /\ ( -- a * b) pow 2 = + ( a * b ) pow 2 /\ ( a * -- b) pow 2 = ( a * b ) pow 2 `; REAL_ADD_SYM; + REAL_MUL_SYM] THEN SIMP_TAC[REAL_ADD_SYM; REAL_MUL_SYM] THEN +ONCE_REWRITE_TAC[REAL_ARITH ` ( a * b ) pow 2 = ( b * -- a ) pow 2 `] THEN +SIMP_TAC[] THEN REPEAT STRIP_TAC THEN EXPAND_TAC "a" THEN +REWRITE_TAC[REAL_RING ` a - -- c * b * &4 = a + &4 * c * b `] THEN +MESON_TAC[AGBWHRD; UPS_X_SYM]);; + +let CMUDPKT = LEMMA33;; + +(* ============= *) + + +let LEMMA_OF_LE20 = prove(` ! x y z: real^3. + &2 <= d3 x y /\ + d3 x y <= #2.52 /\ + &2 <= d3 x z /\ + d3 x z <= #2.2 /\ + &2 <= d3 y z /\ + d3 y z <= #2.2 + ==> ~collinear {x, y, z} `, +MP_TAC JVUNDLC THEN +SIMP_TAC[] THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +REWRITE_TAC[MESON[]` (! a b c s. P a b c = s ==> Q a b c ) <=> + (! a b c . Q a b c ) `] THEN +SIMP_TAC[COL_EQ_UPS_0] THEN +MATCH_MP_TAC (TAUT` a ==> b ==> a `) THEN +REWRITE_TAC[GSYM d3] THEN +REWRITE_TAC[REAL_ENTIRE] THEN +CONV_TAC REAL_FIELD);; + + + +let LT_POW2_EQ_LT = MESON[POW2_COND_LT; REAL_ARITH ` a <= b <=> ~ ( b < a ) `] +`&0 < a /\ &0 < b ==> ( a < b <=> a pow 2 < b pow 2 ) `;; + + + + +let ETA_Y_LT_SQRT2 = prove(`eta_y #2.2 #2.2 #2.52 < sqrt #2`, +REWRITE_TAC[eta_y; eta_x; ups_x] THEN LET_TR THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN MP_TAC (REAL_FIELD ` &14641 / &8131< &2 `) + THEN MP_TAC (REAL_FIELD ` &0 < &2 /\ &0 < &14641 / &8131 `) THEN +NHANH (SPEC_ALL SQRT_POS_LT) THEN REWRITE_TAC[ REAL_ARITH ` #2 = &2 `] THEN +SIMP_TAC[REAL_ARITH ` &0 < a ==> &0 <= a `;SQRT_POS_LT; LT_POW2_EQ_LT; SQRT_WORKS]);; + +let ETA_YY_LT_SQRT2 = MESON[ETA_Y_LT_SQRT2; REAL_ARITH ` #2 = &2 `]` + eta_y #2.2 #2.2 #2.52 < sqrt ( &2 ) `;; + +let THANG_DEU = prove(` &2 <= x ==> &2 pow 2 <= x pow 2 `, +NHANH (REAL_ARITH ` &2 <= x ==> &0 <= &2 /\ &0 <= x `) +THEN MESON_TAC[POW2_COND]);; + +let LEMMA19 = BYOWBDF;; + +MESON[BYOWBDF; REAL_ARITH ` a + b = b + a `]` !a b c a' b' c'. + &0 < a /\ + a <= a' /\ + &0 < b /\ + b <= b' /\ + &0 < c /\ + c <= c' /\ + a' pow 2 <= b pow 2 + c pow 2 /\ + b' pow 2 <= c pow 2 + a pow 2 /\ + c' pow 2 <= a pow 2 + b pow 2 + ==> eta_y a b c <= eta_y a' b' c' `;; + + + + +let LEMMA20 = prove(` ! x y z: real^3. + &2 <= d3 x y /\ + d3 x y <= #2.52 /\ + &2 <= d3 x z /\ + d3 x z <= #2.2 /\ + &2 <= d3 y z /\ + d3 y z <= #2.2 + ==> ~collinear {x, y, z} /\ radV {x, y, z} < sqrt (&2)`, +REPEAT GEN_TAC THEN +NHANH (SPEC_ALL LEMMA_OF_LE20) THEN +SIMP_TAC[RADV_FORMULAR] THEN +MP_TAC (REAL_ARITH ` #2.2 pow 2 <= &2 pow 2 + &2 pow 2 /\ + #2.52 pow 2 <= &2 pow 2 + &2 pow 2 `) THEN +IMP_IMP_TAC THEN +NHANH THANG_DEU THEN +PHA THEN +NHANH (MESON[REAL_ARITH ` + a <= b + c /\ b <= bb /\ c <= cc ==> a <= bb + cc `]` + #2.2 pow 2 <= &2 pow 2 + &2 pow 2 /\ + #2.52 pow 2 <= &2 pow 2 + &2 pow 2 /\ + a1 /\ + &2 pow 2 <= d3 x y pow 2 /\ + a2 /\ + a3 /\ + &2 pow 2 <= d3 x z pow 2 /\ + a4 /\ + a5 /\ + &2 pow 2 <= d3 y z pow 2 /\ last + ==> #2.2 pow 2 <= d3 x z pow 2 + d3 x y pow 2 /\ + #2.2 pow 2 <= d3 x y pow 2 + d3 y z pow 2 /\ + #2.52 pow 2 <= d3 y z pow 2 + d3 x z pow 2 `) THEN +MP_TAC (REAL_ARITH`! a b c. a <= b /\ b < c ==> a < c`) THEN +MESON_TAC[BYOWBDF; ETA_YY_LT_SQRT2 ; REAL_ARITH ` b + c = c + b /\ + ( &2 <= a ==> &0 < a) `]);; + +let BFYVLKP = LEMMA20;; + +let NGAY23_THANG2_09 = prove(` &2 <= y /\ y <= sqrt (&8) ==> + &2 pow 2 <= y * y /\ y * y <= &8 `, +REWRITE_TAC[ GSYM REAL_POW_2] THEN DISCH_TAC THEN CONJ_TAC THENL +[ASM_MESON_TAC[REAL_ARITH ` &2 <= a ==> &0 <= &2 /\ &0 <= a `;POW2_COND]; +ASM_MESON_TAC[ SQRT_WORKS; REAL_ARITH ` &0 <= &8 `; + POW2_COND; REAL_ARITH `&2 <= a /\ a <= b ==> &0 <= b /\ &0 <= a `]]);; + + + +let ETA_Y_SQRT8_2_251 = prove(` eta_y ( sqrt (&8) ) (&2) #2.51 < #1.453`, +REWRITE_TAC[eta_y; eta_x; ups_x; GSYM POW_2] THEN +LET_TR THEN +REWRITE_TAC[MESON[SQRT_WORKS; REAL_ARITH ` &0 <= &8 `]` sqrt (&8) pow 2 = &8 `] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +MP_TAC (REAL_FIELD ` &0 < &20160320000 / &9551113999 /\ &0 < #1.453 `) THEN +NHANH (SPEC_ALL SQRT_POS_LT) THEN +SIMP_TAC[LT_POW2_EQ_LT; REAL_ARITH ` &0 < a ==> &0 <= a `; SQRT_POW_2] THEN +DISCH_TAC THEN +CONV_TAC REAL_FIELD );; + +MESON[BYOWBDF; REAL_ARITH ` a + b = b + a `]` !a b c a' b' c'. + &0 < a /\ + a <= a' /\ + &0 < b /\ + b <= b' /\ + &0 < c /\ + c <= c' /\ + a' pow 2 <= b pow 2 + c pow 2 /\ + b' pow 2 <= c pow 2 + a pow 2 /\ + c' pow 2 <= a pow 2 + b pow 2 + ==> eta_y a b c <= eta_y a' b' c' `;; + + +(* le 21 *) +let LEMMA21 = prove(` ! y. &2 <= y /\ y <= sqrt8 ==> eta_y y (&2) #2.51 < #1.453`, +REWRITE_TAC[sqrt8; GSYM POW_2] THEN +NHANH (NGAY23_THANG2_09) THEN +REWRITE_TAC[sqrt8; GSYM POW_2] THEN +NHANH (REAL_ARITH ` &2 pow 2 <= y pow 2 /\ y pow 2 <= &8 + ==> &2 pow 2 <= #2.51 pow 2 + y pow 2 /\ + #2.51 pow 2 <= y pow 2 + &2 pow 2 /\ + &8 <= &2 pow 2 + #2.51 pow 2 `) THEN +NHANH (REAL_ARITH ` &2 <= a ==> &0 < a /\ &0 < &2 /\ &0 < #2.51 /\ (! a. a <= a ) `) THEN +GEN_TAC THEN +MP_TAC (MESON[SQRT_WORKS; REAL_ARITH ` &0 <= &8 `]` sqrt (&8) pow 2 = &8 `) THEN +MESON_TAC[REAL_ADD_SYM; BYOWBDF; ETA_Y_SQRT8_2_251; + REAL_ARITH ` a <= b /\ b < c ==> a < c `]);; + +let WDOMZXH = LEMMA21;; + + + + +let CDEUSDF_CHANGE = CDEUSDF;; + + +let CIRCUMCENTER_FORMULAR = prove(` ! va vb vc. ~collinear {va, vb, vc} + ==> circumcenter {va, vb, vc} = + (d3 vb vc pow 2 * + (d3 va vc pow 2 + d3 va vb pow 2 - d3 vb vc pow 2)) / + (ups_x (d3 vb vc pow 2) (d3 va vc pow 2) (d3 va vb pow 2)) % + va + + (d3 va vc pow 2 * + (d3 vb vc pow 2 + d3 va vb pow 2 - d3 va vc pow 2)) / + (ups_x (d3 vb vc pow 2) (d3 va vc pow 2) (d3 va vb pow 2)) % + vb + + (d3 va vb pow 2 * + (d3 vb vc pow 2 + d3 va vc pow 2 - d3 va vb pow 2)) / + (ups_x (d3 vb vc pow 2) (d3 va vc pow 2) (d3 va vb pow 2)) % + vc `, +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +MP_TAC CDEUSDF_CHANGE THEN LET_TR THEN MESON_TAC[]);; + +let LE_EX = REAL_ARITH ` &0 <= a <=> a = &0 \/ &0 < a `;; + +let SUM_UPS_X_1 = prove(`!a b c. + &0 < ups_x a b c + ==> (c * (b + a - c)) / ups_x a b c + + (a * (c + b - a)) / ups_x a b c + + (b * (c + a - b)) / ups_x a b c = + &1`, REWRITE_TAC[ups_x] THEN CONV_TAC REAL_FIELD);; + + +let LEMMA18 = prove(` !x (y:real^3) z p. + d3 x z pow 2 < d3 x y pow 2 + d3 y z pow 2 /\ + ~collinear {x, y, z} /\ + p = circumcenter {x, y, z} + ==> p IN aff_gt {x, z} {y} `, +SIMP_TAC[CIRCUMCENTER_FORMULAR] THEN +REWRITE_TAC[ UPS_X_EQ_ZERO_COND; GSYM d3 ] THEN +REPEAT GEN_TAC THEN MP_TAC ZERO_LE_UPS_X THEN +IMP_IMP_TAC THEN REWRITE_TAC[LE_EX] THEN +REWRITE_TAC[MESON[]`( a \/ b ) /\ c /\ ~a /\ e <=> + b /\ c /\ ~a /\ e `] THEN ONCE_REWRITE_TAC[REAL_ARITH + ` a < b + c <=> &0 < b + c - a `] THEN +REWRITE_TAC[d3; GSYM UPS_X_EQ_ZERO_COND] THEN +ONCE_REWRITE_TAC[VECTOR_ARITH` (a:real^N) + b + c = a + c + b `] THEN +NHANH (MESON[TWO_EQ_IMP_COL3; PER_SET3]`~collinear {x, y, z} ==> ~ ( x = z)`) +THEN REWRITE_TAC[DIST_NZ; simp_def2; IN_ELIM_THM] THEN +STRIP_TAC THEN SIMP_TAC[DIST_SYM] THEN UNDISCH_TAC +` &0 < ups_x (dist (x,y) pow 2) (dist (x,z) pow 2) +(dist ((y:real^3),z) pow 2) ` THEN +SIMP_TAC [MESON[UPS_X_SYM]` ups_x x y z = ups_x z y x `] THEN +DOWN_TAC THEN +ONCE_REWRITE_TAC[MESON[REAL_ARITH `a + b - c = b + a - c `]` ( &0 + < a + b - c /\ l ==> ll ) <=> ( &0 < b + a - c /\ l ==> ll )`] THEN +STRIP_TAC THEN EXISTS_TAC ` (dist ((y:real^3),z) pow 2 * + (dist (x,z) pow 2 + dist (x,y) pow 2 - dist (y,z) pow 2)) / + ups_x (dist (x,y) pow 2) (dist (x,z) pow 2) (dist (y,z) pow 2) ` THEN +EXISTS_TAC `(dist ((x:real^3),y) pow 2 * + (dist (y,z) pow 2 + dist (x,z) pow 2 - dist (x,y) pow 2)) / + ups_x (dist (x,y) pow 2) (dist (x,z) pow 2) (dist (y,z) pow 2)` THEN +EXISTS_TAC ` (dist ((x:real^3),z) pow 2 * + (dist (y,z) pow 2 + dist (x,y) pow 2 - dist (x,z) pow 2)) / + ups_x (dist (x,y) pow 2) (dist (x,z) pow 2) (dist (y,z) pow 2) ` THEN +CONJ_TAC THENL [UNDISCH_TAC `&0 < ups_x (dist (x,y) pow 2) + (dist (x,z) pow 2) (dist ((y:real^3),z) pow 2)` THEN +REWRITE_TAC[SUM_UPS_X_1]; CONJ_TAC] THENL [DOWN_TAC THEN +REWRITE_TAC[MESON[POW_2]` ( a pow 2) * b = ( a * a ) * b `] THEN +MESON_TAC[REAL_LT_MUL; REAL_LT_DIV]; SIMP_TAC[]]);; + +let WSMRDKN = LEMMA18;; +let LEMMA19 = BYOWBDF;; + + + +MESON[POW2_COND; REAL_ARITH `&2 <= a /\ a <= b ==> &0 <= b /\ &0 <= a `]` + &2 <= y /\ y <= b ==> y pow 2 <= b pow 2 `;; + + +let FACTOR_OF_QUADRARTIC = prove(`! a b c x. ~(a = &0) /\ +&0 <= b pow 2 - &4 * a * c ==> a * x pow 2 + b * x + c = + a * + (x - (--b + sqrt (b pow 2 - &4 * a * c)) / (&2 * a)) * + (x - (--b - sqrt (b pow 2 - &4 * a * c)) / (&2 * a))` , +REWRITE_TAC[PRE_VIET] THEN SIMP_TAC[REAL_FIELD ` ~( a = &0 ) ==> +-- a * ( ( --b + del) / ( &2 * a ) + ( --b - del) / ( &2 * a )) = b `] THEN +REWRITE_TAC[REAL_FIELD ` a / b * a' / b = ( a * a' ) / ( b pow 2 ) `] THEN +REWRITE_TAC[REAL_FIELD ` a / b * a' / b = ( a * a' ) / ( b pow 2 ) `; + REAL_DIFFSQ; GSYM REAL_POW_2] THEN SIMP_TAC[SQRT_WORKS] THEN +SIMP_TAC[REAL_FIELD ` ~ ( a = &0 ) ==> a * (--b pow 2 - + (b pow 2 - &4 * a * c)) / (&2 * a) pow 2 = c `]);; + + +let COMPUTE_TO_QUA_POLY = prove(` #2.696 <= x /\ x <= sqrt8 ==> +x pow 2 * ( &1 / eta_y x #2.45 #2.45 pow 2 - + &1 / eta_y x ( &2 ) #2.51 pow 2 ) = &4331842500 / &363188227801 * x pow 4 + + -- &45702201 / &302530802 * x pow 2 + + &529046001 / &2520040000 `, REWRITE_TAC[eta_y; eta_x; ups_x] THEN +LET_TR THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +NHANH (MESON[REAL_ARITH ` #2.696 <= x /\ x <= sqrt8 ==> + &0 <= #2.696 /\ &0 <= x `; REAL_LE_MUL2] ` #2.696 <= x /\ x <= sqrt8 ==> + #2.696 * #2.696 <= x * x /\ x * x <= sqrt8 * sqrt8 `) THEN +NHANH (MESON[REAL_ARITH ` #2.696 * #2.696 <= x ==> &0 <= #2.696 * #2.696 /\ &0 <= x `; REAL_LE_MUL2] ` + #2.696 * #2.696 <= x /\ x <= hh ==> (#2.696 * #2.696) * #2.696 * #2.696 <= x * x /\ + x * x <= hh * hh `) THEN +REWRITE_TAC[sqrt8] THEN +REWRITE_TAC[REAL_POLY_CONV ` (--(x * x) * x * x - &16 - &3969126001 / &100000000 + + &2 * (x * x) * &63001 / &10000 + + &2 * (x * x) * &4 + + &63001 / &1250) `] THEN +REWRITE_TAC[REAL_POLY_CONV ` + (--(x * x) * x * x - &5764801 / &160000 - &5764801 / &160000 + + &2 * (x * x) * &2401 / &400 + + &2 * (x * x) * &2401 / &400 + + &5764801 / &80000) `] THEN +REWRITE_TAC[REAL_ARITH ` x pow 4 = ( x pow 2 ) pow 2 `] THEN +MP_TAC (REAL_ARITH ` ~ ( -- &1 = &0 ) /\ &0 <= ( &103001 / &5000 ) pow 2 - &4 * ( -- &1 ) * -- &529046001 / &100000000 `) THEN +SIMP_TAC[FACTOR_OF_QUADRARTIC] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +REWRITE_TAC[REAL_ARITH ` (&252004 / &625) = ( &502 / &25 ) * ( &502 / &25 ) `] THEN +REWRITE_TAC[MESON[REAL_ARITH ` &0 <= &502 / &25 /\ x * x = x pow 2 `; POW_2_SQRT]` + sqrt ( ( &502 / &25 ) * ( &502 / &25 )) = ( &502 / &25 ) `] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +REWRITE_TAC[ GSYM POW_2] THEN +REWRITE_TAC[REAL_ARITH ` a * x pow 2 + b * x = ( a * x + b ) * x `] THEN +REWRITE_TAC[MESON[SQRT_WORKS; REAL_ARITH ` &0 <= &8`]` sqrt (&8) pow 2 = &8 `] THEN +NHANH (REAL_FIELD ` (&113569 / &15625 <= x pow 2 /\ x pow 2 <= &8) + ==> &0 <= (-- &1 * x pow 2 + &2401 / &100) /\ + &0 <= (x pow 2 - &2601 / &10000 ) /\ + &0 <= -- ((x pow 2 - &203401 / &10000) )/\ &0 <= &5764801 / &160000 /\ +&0 <= &63001 / &2500`) THEN +MP_TAC REAL_LE_POW_2 THEN +REWRITE_TAC[REAL_ARITH ` -- &1 * a * b = a * -- b `] THEN +REWRITE_TAC[REAL_FIELD ` ( &1 / a ) pow 2 = &1 / ( a pow 2 ) `] THEN +MP_TAC REAL_LE_MUL THEN +MP_TAC REAL_LE_DIV THEN +SIMP_TAC[ SQRT_WORKS] THEN +REWRITE_TAC[REAL_SUB_LDISTRIB] THEN +REWRITE_TAC[REAL_FIELD ` &1 / ( a / b ) = b / a `] THEN +SIMP_TAC[REAL_FIELD ` &113569 / &15625 <= a ==> a * ( b / ( a * c )) = b / c `] THEN +REWRITE_TAC[REAL_POLY_CONV ` ((-- &1 * x pow 2 + &2401 / &100) * x pow 2) / (&5764801 / &160000) - + ((x pow 2 - &2601 / &10000) * --(x pow 2 - &203401 / &10000)) / + (&63001 / &2500) `] THEN +REWRITE_TAC[REAL_ARITH ` a pow 4 = a pow 2 pow 2 `]);; + +REAL_ARITH ` &4650694416 = ( &68196 ) pow 2 `;; +REAL_ARITH` &4650694416 / &363188227801 = ( &68196 / &602651 ) pow 2 `;; + + +let PHAN_TICH = prove( `! x. &4331842500 / &363188227801 * + (x pow 2 - &488365801 / &44090000) * + (x pow 2 - &2081667 / &1310000) = + &4331842500 / &363188227801 * x pow 4 + + -- &45702201 / &302530802 * x pow 2 + + &529046001 / &2520040000` , REAL_ARITH_TAC);; + +let Q_TR = prove(`! x. #2.696 <= x /\ x <= sqrt8 ==> + x pow 2 * + (&1 / eta_y x #2.45 #2.45 pow 2 - &1 / eta_y x (&2) #2.51 pow 2) <= &0 `, +SIMP_TAC[COMPUTE_TO_QUA_POLY; GSYM PHAN_TICH ] THEN +NHANH (MESON[REAL_ARITH ` #2.696 <= x /\ x <= hh ==> &0 <= #2.696 /\ &0 <= x` + ; REAL_LE_MUL2] ` #2.696 <= x /\ x <= hh ==> + #2.696 * #2.696 <= x * x /\ x * x <= hh * hh `) THEN +REWRITE_TAC[REAL_ARITH ` + &4331842500 / &363188227801 * a <= &0 <=> a <= &0 `] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +REWRITE_TAC[REAL_ARITH ` &0 <= + &4331842500 / &363188227801 * a <=> &0 <= a `; sqrt8; GSYM POW_2; + MESON[SQRT_WORKS; REAL_ARITH ` &0 <= &8 `]` sqrt (&8) pow 2 = &8 `] THEN +NHANH (REAL_ARITH ` &113569 / &15625 <= x pow 2 /\ + x pow 2 <= &8 ==> x pow 2 - &488365801 / &44090000 <= &0 /\ + x pow 2 - &2081667 / &1310000 >= &0 `) THEN +REWRITE_TAC[ REAL_ARITH ` ( a >= &0 <=> &0 <= a)/\ (a <= &0 <=> &0 <= -- a ) `] THEN +REWRITE_TAC[REAL_ARITH ` -- ( a * b ) = -- a * b `] THEN +MESON_TAC[REAL_LE_MUL]);; + +let SQRT8_LT = prove(` sqrt (&8) < &4 * #2.45 `, +MP_TAC (REAL_ARITH ` &0 < &8 /\ &0 < &4 * #2.45`) THEN +SIMP_TAC[SQRT_POS_LT; LT_POW2_EQ_LT] THEN +SIMP_TAC[REAL_LT_IMP_LE; SQRT_WORKS] THEN REAL_ARITH_TAC);; + + + +let SQRT8_POW2 = MESON[SQRT_WORKS; REAL_ARITH ` &0 <= &8 `]` sqrt (&8) pow 2 = &8 `;; + + +let IM_UP_POS = prove(`! x. #2.696 <= x /\ x <= sqrt8 ==> +&0 < ups_x (x * x) (#2.45 * #2.45) (#2.45 * #2.45) /\ +&0 < ups_x (x * x) (&2 * &2) (#2.51 * #2.51) `, +REWRITE_TAC[ups_x] THEN +REWRITE_TAC[REAL_IDEAL_CONV [` (x:real) pow 2 `]` + --(x * x) * x * x - + (#2.45 * #2.45) * #2.45 * #2.45 - + (#2.45 * #2.45) * #2.45 * #2.45 + + &2 * (x * x) * #2.45 * #2.45 + + &2 * (x * x) * #2.45 * #2.45 + + &2 * (#2.45 * #2.45) * #2.45 * #2.45 `] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +REWRITE_TAC[REAL_POLY_CONV ` --(x * x) * x * x - &16 - &3969126001 / &100000000 + + &2 * (x * x) * &63001 / &10000 + + &2 * (x * x) * &4 + + &63001 / &1250 `] THEN +NHANH (REAL_ARITH` #2.696 <= x /\ x <= s ==> &0 <= #2.696 /\ + &0 <= x /\ &0 <= s `) THEN +ONCE_REWRITE_TAC[MESON[]` a /\ b ==> c <=> b ==> a ==> c `] THEN +SIMP_TAC[POW2_COND; sqrt8; SQRT8_POW2] THEN +NHANH (REAL_ARITH` #2.696 pow 2 <= x /\ x <= &8 ==> + &0 < &2401 / &100 + -- &1 * x /\ &0 < x /\ + ~ ( -- &1 = &0 ) /\ &0 <= ( &103001 / &5000 ) pow 2 - &4 * -- &1 * + -- &529046001 / &100000000 `) THEN +SIMP_TAC[REAL_ARITH ` x pow 4 = x pow 2 pow 2 `; FACTOR_OF_QUADRARTIC] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +REWRITE_TAC[REAL_ARITH ` &252004 / &625 = ( &502 / &25) pow 2 `] THEN +REWRITE_TAC[MESON[POW_2_SQRT; REAL_ARITH ` &0 <= &502 / &25 `]` + sqrt ((&502 / &25) pow 2) = &502 / &25 `] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +NHANH (REAL_ARITH ` &113569 / &15625 <= x pow 2 /\ x pow 2 <= &8 ==> + &0 < x pow 2 - &2601 / &10000 /\ &0 < -- (x pow 2 - &203401 / &10000) `) THEN +REWRITE_TAC[REAL_ARITH ` -- &1 * a * b = a * --b `] THEN +SIMP_TAC[REAL_LT_MUL]);; + + +let IMP_ETAY_POS = prove( `! x. #2.696 <= x /\ x <= sqrt8 ==> +&0 < eta_y x #2.45 #2.45 /\ &0 < eta_y x (&2) #2.51 `, +REWRITE_TAC[eta_y; eta_x] THEN +LET_TR THEN +NHANH (MESON[REAL_ARITH ` &0 <= #2.696`; REAL_LE_MUL2]` + #2.696 <= x ==> #2.696 * #2.696 <= x * x `) THEN +NHANH (REAL_ARITH ` #2.696 * #2.696 <= x * x ==> + &0 < ((x * x) * (#2.45 * #2.45) * #2.45 * #2.45) /\ + &0 < ((x * x) * (&2 * &2) * #2.51 * #2.51) `) THEN +MESON_TAC[IM_UP_POS; REAL_LT_DIV; SQRT_POS_LT]);; + + +let REAL_LE_RDIV_0 = prove(` ! a b. &0 < b ==> ( &0 <= a / b <=> &0 <= a ) `, +REWRITE_TAC[REAL_ARITH ` &0 <= a <=> &0 < a \/ a = &0 `] THEN +SIMP_TAC[REAL_LT_RDIV_0] THEN +SIMP_TAC[REAL_FIELD `&0 < b ==> ( a / b = &0 <=> a = &0 ) `]);; + + +let NHSJMDH = prove(` ! y. #2.696 <= y /\ y <= sqrt8 ==> + eta_y y (&2) (#2.51) <= eta_y y #2.45 (#2.45) `, +NHANH (SPEC_ALL Q_TR) THEN +ONCE_REWRITE_TAC[MESON[]` a /\ b ==> c <=> a ==> b ==> c `] THEN +NHANH (MESON[REAL_ARITH ` &0 <= #2.696`; REAL_LE_MUL2]` + #2.696 <= x ==> #2.696 * #2.696 <= x * x `) THEN +REWRITE_TAC[POW_2] THEN +NHANH (REAL_ARITH `#2.696 * #2.696 <= y ==> &0 < y `) THEN +REWRITE_TAC[REAL_ARITH ` a * b <= &0 <=> &0 <= a * -- b `] THEN +SIMP_TAC[REAL_LE_MUL_EQ] THEN +ONCE_REWRITE_TAC[MESON[]`( a/\b ) /\ c <=> ( a /\ c ) /\ b `] THEN +NHANH (SPEC_ALL IMP_ETAY_POS) THEN +NHANH (REAL_ARITH ` &0 < eta_y a b c ==> ~(eta_y a b c = &0 ) `) THEN +REWRITE_TAC[GSYM REAL_POSSQ] THEN SIMP_TAC[REAL_FIELD ` &0 < a /\ + &0 < b ==> -- (&1 / a - &1 / b) = (a - b) / ( a * b ) `] THEN +PHA THEN SIMP_TAC[REAL_LT_MUL; REAL_LE_RDIV_0] THEN +REWRITE_TAC[GSYM REAL_DIFFSQ] THEN +SIMP_TAC[REAL_LT_ADD; REAL_LE_MUL_EQ] THEN REAL_ARITH_TAC);; + + + + + + + + + + + + + + + + + + +(* NEW WORKS *) +let SQRT8_LE = MESON[ REAL_ARITH ` &0 <= &8`; SQRT_WORKS]` &0 <= sqrt (&8) `;; + +let RELATE_POW2 = prove(` ( a = &0 <=> a pow 2 = &0 ) /\ + ( &0 < a pow 2 <=> &0 < a \/ ~( &0 <= a )) `, +MP_TAC (REAL_FIELD ` a = &0 <=> a pow 2 = &0 `) THEN DISCH_TAC THEN +CONJ_TAC THENL [ASM_SIMP_TAC[]; MP_TAC REAL_LE_POW_2] THEN +MP_TAC (REAL_ARITH `( ! a. &0 < a \/ ~(&0 <= a) \/ a = &0 )`) THEN +MP_TAC (REAL_FIELD ` a = &0 <=> a pow 2 = &0 `) THEN +REWRITE_TAC[REAL_ARITH ` A <= b <=> A = b \/ A < b `] THEN +MESON_TAC[REAL_ARITH ` ~ ( a = &0 /\ ( &0 < a \/ ~( &0 <= a ) )) `]);; + +let LT_POW2_COND = prove(`!a b. &0 <= a /\ &0 <= b ==> (a < b <=> a pow 2 < b pow 2)`, +REPEAT GEN_TAC THEN ASM_CASES_TAC ` a = &0 ` THENL +[ASM_SIMP_TAC[REAL_ARITH` &0 pow 2 = &0 `] THEN MESON_TAC[RELATE_POW2]; +ASM_SIMP_TAC[REAL_LE_LT]] THEN STRIP_TAC THENL [ASM_MESON_TAC[LT_POW2_EQ_LT]; +EXPAND_TAC "b"] THEN UNDISCH_TAC `&0 < a ` THEN REWRITE_TAC[REAL_ARITH ` + &0 pow 2 = &0 /\ (a < &0 <=> ~(&0 <= a))`] THEN MP_TAC REAL_LE_POW_2 THEN +MESON_TAC[REAL_LT_IMP_LE]);; + + +let POS_IMP_POW2 = MESON[REAL_LE_TRANS; POW2_COND]` &0 <= a /\ a <= b ==> a pow 2 + <= b pow 2 `;; + + +let SQRT8_LE_EQ_8_LESS_POW2 = prove(` sqrt (&8 ) <= a ==> &8 <= a pow 2 `, +MP_TAC SQRT8_LE THEN MESON_TAC[SQRT8_POW2; POS_IMP_POW2]);; + + +let MINIMAL_QUADRATIC_POLY = prove(` +! b c (x:real). ( &4 * c - b pow 2 ) / &4 <= x pow 2 + b * x + c `, +ONCE_REWRITE_TAC[REAL_ARITH ` a <= b <=> &0 <= b - a `] THEN +REWRITE_TAC[REAL_ARITH ` (x pow 2 + b * x + c) - (&4 * c - b pow 2) / &4 + = ( x + b / &2 ) pow 2 `; REAL_LE_POW_2]);; + +let GREATER_THAN_MID_QUADRATIC_PO = prove(` ! b c x x0. -- b / &2 <= x0 /\ x0 <= x ==> + x0 pow 2 + b * x0 + c <= x pow 2 + b * x + c `, +REWRITE_TAC[REAL_ARITH ` x0 pow 2 + b * x0 + c <= x pow 2 + b * x + c + <=> &0 <= ( x - x0 ) * ( x + x0 + b ) `] THEN +MESON_TAC[REAL_ARITH ` --b / &2 <= x0 /\ x0 <= x ==> + &0 <= x - x0 /\ &0 <= x + x0 + b `; REAL_LE_MUL]);; + +(* PERMAINENCE *) +(* MARCH WORKS *) + +let SQRT8_TWO_TWO = prove(` sqrt (&8) <= &2 + &2 `, +MP_TAC SQRT8_LE THEN NHANH (MESON[REAL_ARITH ` &0 <= &2 + &2 `] +`&0 <= sqrt (&8) ==> &0 <= &2 + &2 `) THEN SIMP_TAC[POW2_COND] THEN +SIMP_TAC[REAL_ARITH ` &0 <= &8 `; SQRT_WORKS] THEN REAL_ARITH_TAC);; + + +let A_POS_DELTA = prove(` &0 < delta (#3.2 pow 2 ) (sqrt8 pow 2 ) (&2 pow 2) (sqrt8 pow 2) +(&2 pow 2) (&2 pow 2) `, REWRITE_TAC[delta; sqrt8; SQRT8_POW2] THEN REAL_ARITH_TAC);; + +(* le 35. p 22 *) +let THADGSB = new_axiom` !M13 m12 m14 M24 m34 m23 v1 v2 v3 v4. + (!x. x IN {M13, m12, m14, M24, m34, m23} ==> &0 <= x) /\ + M13 < m12 + m23 /\ + M13 < m14 + m34 /\ + M24 < m12 + m14 /\ + M24 < m23 + m34 /\ + &0 < + delta (M13 pow 2) (m12 pow 2) (m14 pow 2) (M24 pow 2) (m34 pow 2) + (m23 pow 2) /\ + CARD {v1, v2, v3, v4} = 4 /\ + m12 <= d3 v1 v2 /\ + m23 <= d3 v2 v3 /\ + m34 <= d3 v3 v4 /\ + m14 <= d3 v1 v4 /\ + d3 v1 v3 <= M13 /\ + d3 v2 v4 <= M24 ==> conv {v1,v3} INTER conv {v2,v4} = {} `;; + +let MET_LAM_ROI = prove(` #3.2 < sqrt8 + &2 /\ #3.2 < &2 + &2 /\ sqrt8 < sqrt8 + &2 /\ +sqrt8 < &2 + &2 `, +REWRITE_TAC[sqrt8; REAL_ARITH ` a < sqrt (&8) + b <=> a - b < sqrt (&8) `] THEN +REWRITE_TAC[REAL_ARITH ` sqrt (&8) - &2 < sqrt (&8) `] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN MP_TAC SQRT8_LE THEN +MP_TAC (REAL_ARITH` &0 <= &6 / &5 /\ &0 <= &4 `) THEN +SIMP_TAC[LT_POW2_COND ] THEN SIMP_TAC[LT_POW2_COND; SQRT8_POW2 ] THEN +REAL_ARITH_TAC);; + + +let PROVE_POS_THINGS = prove(` ! x. x IN {#3.2 , sqrt8, &2 , sqrt8, &2, &2 } ==> &0 <= x `, +REWRITE_TAC[SET_RULE `( !x. x IN {a,b,c,d,s,e} ==> p x ) <=> + p a /\ p b /\ p c /\ p d /\ p s /\ p e `;sqrt8; SQRT8_LE] THEN REAL_ARITH_TAC);; + + + +let IMP_GT_THAN_TWO = prove(` ! v1 v2 w1 (w2:real^3). + CARD {v1, w1,v2, w2} = 4 /\ + packing {v1, w1,v2, w2} +==> &2 <= d3 w1 v2 /\ + &2 <= d3 v2 w2 /\ + &2 <= d3 v1 w2 `, +REWRITE_TAC[CARD4; packing; GSYM d3; sqrt8] THEN SET_TAC[]);; + +(* THADGSB *) + +let JGYWWBX = prove(` ~ (?v1 v2 w1 (w2:real^3). + CARD {v1, v2, w1, w2} = 4 /\ + packing {v1, v2, w1, w2} /\ + dist (v1,w1) >= sqrt8 /\ + dist (v1,v2) <= #3.2 /\ + dist (w1,w2) <= sqrt8 /\ + ~(conv {v1, v2} INTER conv {w1, w2} = {}))`, +MP_TAC (MESON[ REAL_ARITH ` &0 <= &8 /\ &0 <= &2 /\ &0 <= #3.2 `; + SQRT_WORKS]` &0 <= sqrt (&8) /\ &0 <= &2 /\ &0 <= #3.2`) THEN +MP_TAC MET_LAM_ROI THEN +REWRITE_TAC[MESON[]` CARD s = 4 /\ b /\ c <=> ( CARD s = 4 /\ b ) /\ c `] THEN +ONCE_REWRITE_TAC[SET_RULE ` {v1, v2, w1, w2} = {v1,w1,v2,w2} `] THEN +NHANH (SPEC_ALL IMP_GT_THAN_TWO ) THEN MP_TAC PROVE_POS_THINGS THEN +MP_TAC A_POS_DELTA THEN REWRITE_TAC[GSYM d3; REAL_ARITH ` a >= b <=> b <= a `] + THEN IMP_IMP_TAC THEN DISCH_TAC THEN NGOAC THEN +MATCH_MP_TAC (MESON[]` (! v1 v2 w1 w2. P v1 v2 w1 w2 ==> Q v1 v2 w1 w2) + ==> ~(? v1 v2 w1 w2. P v1 v2 w1 w2 /\ ~( Q v1 v2 w1 w2)) `) THEN +REPEAT GEN_TAC THEN FIRST_X_ASSUM MP_TAC THEN ABBREV_TAC `M13 = #3.2 ` THEN +PHA THEN REWRITE_TAC[sqrt8] THEN MP_TAC (SPECL [`M13:real`; `sqrt8`; `&2`;`sqrt8` +;`&2 `; `&2`; `v1:real^3` ; `w1:real^3`; `v2:real^3`; `w2:real^3`] THADGSB) THEN +SIMP_TAC[D3_SYM; sqrt8]);; + +let LEMMA37 = JGYWWBX;; + + +let LEMMA_FOR_PAHFWSI = prove(`! v1 v2 v3 v4. CARD {v1, v2, v3, v4} = 4 /\ + packing {v1, v2, v3, v4} /\ + dist (v1,v3) <= #3.2 /\ + #2.51 <= dist (v1,v2) /\ + dist (v2,v4) <= #2.51 +==> (!x. x IN {#3.2, #2.51, &2, #2.51, &2, &2} ==> &0 <= x) /\ + #3.2 < #2.51 + &2 /\ + #3.2 < &2 + &2 /\ + #2.51 < #2.51 + &2 /\ + #2.51 < &2 + &2 /\ + &0 < + delta (#3.2 pow 2) (#2.51 pow 2) (&2 pow 2) (#2.51 pow 2) (&2 pow 2) + (&2 pow 2) /\ + CARD {v1, v2, v3, v4} = 4 /\ + #2.51 <= d3 v1 v2 /\ + &2 <= d3 v2 v3 /\ + &2 <= d3 v3 v4 /\ + &2 <= d3 v1 v4 /\ + d3 v1 v3 <= #3.2 /\ + d3 v2 v4 <= #2.51 `, +REWRITE_TAC[SET_RULE ` (!x. x IN {a,b,c,d,e,f} ==> P x ) <=> + P a /\ P b /\ P c /\ P d /\ P e /\ P f `; REAL_ARITH ` + &0 <= #2.51 /\ + &0 <= &2 /\ + &0 <= &2 /\ + &0 <= #3.2 /\ + &0 <= &2 /\ + &0 <= #2.51 /\ #2.51 < &2 + #2.51 /\ + #2.51 < &2 + &2 /\ + #3.2 < &2 + &2 /\ + #3.2 < #2.51 + &2 /\ #3.2 < &2 + #2.51 /\ + #2.51 < #2.51 + &2 `] THEN SIMP_TAC[GSYM d3] THEN +REWRITE_TAC[CARD4; packing; delta; d3] THEN CONV_TAC REAL_RAT_REDUCE_CONV +THEN SET_TAC[]);; + +let PAHFWSI = prove(` !(v1:real^3) v2 v3 v4. + CARD {v1, v2, v3, v4} = 4 /\ + packing {v1, v2, v3, v4} /\ + dist (v1,v3) <= #3.2 /\ + #2.51 <= dist (v1,v2) /\ + dist (v2,v4) <= #2.51 + ==> conv {v1, v3} INTER conv {v2, v4} = {} `, REPEAT GEN_TAC THEN +MP_TAC (SPECL [` #3.2 `; `#2.51`;` &2 `; ` #2.51 `;` &2 `; `&2`] THADGSB) THEN +NHANH (SPEC_ALL LEMMA_FOR_PAHFWSI ) THEN SIMP_TAC[]);; +let LEMMA38 = PAHFWSI;; + +let LEMMA_OF_39 = prove(` ! (v1:real^3) v2 w1 w2. + CARD {v1, v2, w1, w2} = 4 /\ + packing {v1, v2, w1, w2} /\ + dist (w1,w2) <= #2.51 /\ + dist (v1,v2) <= #3.07 +==> (!x. x IN {#2.51, &2, &2, #3.07, &2, &2} ==> &0 <= x) /\ + #2.51 < &2 + &2 /\ + #2.51 < &2 + &2 /\ + #3.07 < &2 + &2 /\ + #3.07 < &2 + &2 /\ + &0 < + delta (#2.51 pow 2) (&2 pow 2) (&2 pow 2) (#3.07 pow 2) (&2 pow 2) + (&2 pow 2) /\ + CARD {w1, v1, w2, v2} = 4 /\ + &2 <= d3 w1 v1 /\ + &2 <= d3 v1 w2 /\ + &2 <= d3 w2 v2 /\ + &2 <= d3 w1 v2 /\ + d3 w1 w2 <= #2.51 /\ + d3 v1 v2 <= #3.07 `, +REWRITE_TAC[SET_RULE ` (!x. x IN {a,b,c,d,e,f} ==> P x ) <=> + P a /\ P b /\ P c /\ P d /\ P e /\ P f `; delta; GSYM d3] THEN CONV_TAC +REAL_RAT_REDUCE_CONV THEN REPEAT GEN_TAC THEN STRIP_TAC THEN CONJ_TAC THENL +[ASM_MESON_TAC[SET_RULE ` {v1, v2, w1, w2} = {w1, v1, w2, v2}`];DOWN_TAC] + THEN REWRITE_TAC[CARD4; packing; d3] THEN SET_TAC[]);; + + +let UVGVIXB = prove(` ! (v1:real^3) v2 w1 w2. + CARD {v1, v2, w1, w2} = 4 /\ + packing {v1, v2, w1, w2} /\ + dist (w1,w2) <= #2.51 /\ + dist (v1,v2) <= #3.07 + ==> conv {w1, w2} INTER conv {v1, v2} = {}`, NHANH (SPEC_ALL LEMMA_OF_39) + THEN SIMP_TAC[ SPECL [ ` #2.51 `; `&2 `; `&2 `; `#3.07 `; `&2 `; ` &2 `; +` w1:real^3 `; ` v1:real^3`;` w2:real^3`; `v2:real^3 `] THADGSB ]);; + +let LEMMA39 = UVGVIXB;; + +let LEMMA_OF_LEMMA40 = prove(`! v1 v2 w1 (w2:real^3). CARD {v1, v2, w1, w2} = 4 /\ + packing {v1, v2, w1, w2} /\ + dist (v1,v2) <= #3.2 /\ + dist (w1,w2) <= #2.51 /\ + #2.2 <= dist (v1,w1) +==> (!x. x IN {#3.2, #2.2, &2, #2.51, &2, &2} ==> &0 <= x) /\ + #3.2 < #2.2 + &2 /\ + #3.2 < &2 + &2 /\ + #2.51 < #2.2 + &2 /\ + #2.51 < &2 + &2 /\ + &0 < + delta (#3.2 pow 2) (#2.2 pow 2) (&2 pow 2) (#2.51 pow 2) (&2 pow 2) + (&2 pow 2) /\ + CARD {v1, w1, v2, w2} = 4 /\ + #2.2 <= d3 v1 w1 /\ + &2 <= d3 w1 v2 /\ + &2 <= d3 v2 w2 /\ + &2 <= d3 v1 w2 /\ + d3 v1 v2 <= #3.2 /\ + d3 w1 w2 <= #2.51 `, +REWRITE_TAC[SET_RULE ` (! x. x IN {a,b,c,d,e,f} ==> P x ) <=> + P a /\ P b /\ P c /\ P d /\ P e /\ P f `; delta] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN SIMP_TAC[SET_RULE ` +{v1, v2, w1, w2} = {v1, w1, v2, w2} `; packing] THEN +SIMP_TAC[CARD4; GSYM d3] THEN SET_TAC[]);; + +let PJFAYXI = prove(`! (v1:real^3) v2 w1 w2. + CARD {v1, v2, w1, w2} = 4 /\ packing {v1, v2, w1, w2} /\ + dist (v1,v2) <= #3.2 /\ + dist (w1,w2) <= #2.51 /\ + #2.2 <= dist (v1,w1) + ==> conv {v1, v2} INTER conv {w1, w2} = {}`, +NHANH (SPEC_ALL LEMMA_OF_LEMMA40) THEN SIMP_TAC[ +SPECL [ ` #3.2 `; `#2.2 `; `&2 `; `#2.51 `; `&2 `; ` &2 `; + ` v1:real^3 `; ` w1:real^3`;` v2:real^3`; `w2:real^3 `] THADGSB ]);; + +let LEMMA40 = PJFAYXI;; + + + +let LEOF41 = prove( +`#3.114467 < x ==> delta (#2.51 pow 2) (&2 pow 2) (&2 pow 2) (&2 pow 2) + (&2 pow 2) (x pow 2) < &0`, +NHANH (MESON[REAL_ARITH ` #3.114467 < x ==> &0 < #3.114467 /\ &0 < x `; + LT_POW2_EQ_LT]` #3.114467 < x ==> ( #3.114467 ) pow 2 < x pow 2 `) THEN +REWRITE_TAC[delta] THEN CONV_TAC REAL_RAT_REDUCE_CONV THEN +REWRITE_TAC[ REAL_POLY_CONV ` -- &126002 / &625 - &4 * &4 * x pow 2 - &4 * &4 * x pow 2 + + &63001 / &10000 * x pow 2 * + (-- &63001 / &10000 + &4 + &4 + &4 + &4 - x pow 2) + + &4 * &4 * (&23001 / &10000 + &4 + &0 + x pow 2) + + &4 * &4 * (&63001 / &10000 + -- &4 + &4 + x pow 2) `] THEN +REWRITE_TAC[REAL_ARITH ` a pow 4 = a pow 2 pow 2 `] THEN +REWRITE_TAC[REAL_ARITH ` a * x pow 2 + b * x = ( a * x + b ) * x `] THEN +NHANH (REAL_ARITH `&9699904694089 / &1000000000000 < x pow 2 + ==> -- &63001 / &10000 * x pow 2 + &6111033999 / &100000000 < &0` ) THEN +NHANH (REAL_ARITH `&9699904694089 / &1000000000000 < x ==> &0 < x `) THEN +REWRITE_TAC[REAL_ARITH ` a < &0 <=> &0 < -- a `; + REAL_ARITH ` -- ( a * b ) = -- a * b `] THEN MESON_TAC[REAL_LT_MUL]);; + + +let LEMMA41 = prove(`! v1 v2 v3 (v4:real^3). + CARD {v1,v2,v3,v4} = 4 /\ + d3 v1 v2 = #2.51 /\ + d3 v1 v3 = &2 /\ + d3 v1 v4 = &2 /\ + d3 v2 v3 = &2 /\ + d3 v2 v4 = &2 + ==> d3 v3 v4 <= #3.114467 `, +REPEAT GEN_TAC THEN MP_TAC LEMMA3 THEN LET_TR THEN +REWRITE_TAC[REAL_ARITH ` x <= #3.114467 <=> ~ (#3.114467 < x ) `] THEN +REWRITE_TAC[REAL_ARITH ` x <= #3.114467 <=> ~ (#3.114467 < x ) `; + MESON[]` a ==> ~ b <=> a /\ b ==> F `] THEN PHA THEN +NHANH (SPEC_ALL (prove(`! (v1:real^3) v2 v3 v4. d3 v1 v2 = #2.51 /\ +d3 v1 v3 = &2 /\ d3 v1 v4 = &2 /\ d3 v2 v3 = &2 /\ d3 v2 v4 = &2 /\ +#3.114467 < d3 v3 v4 ==> delta (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) +(dist (v1,v4) pow 2) (dist (v2,v3) pow 2) (dist (v2,v4) pow 2) + (dist (v3,v4) pow 2) < &0 `, SIMP_TAC[d3] THEN MESON_TAC[LEOF41]))) THEN +REWRITE_TAC[REAL_ARITH ` a < &0 <=> ~( &0 <= a ) `; d3] THEN MESON_TAC[]);; + +let YXWIPMH = LEMMA41;; + +let LEMMA_OF_L42 = prove(`sqrt8 <= d3 v2 v4 /\ #3.488 <= x + ==> -- &1 * x pow 2 * d3 v2 v4 pow 2 + + -- &1 * x pow 4 + + &103001 / &5000 * x pow 2 + + -- &529046001 / &100000000 < + &0`, +MP_TAC SQRT8_LE THEN +IMP_IMP_TAC THEN +NHANH (MESON[REAL_ARITH ` &0 <= a /\ a <= b /\ #3.488 <= x ==> &0 <= b /\ + &0 <= #3.488 /\ &0 <= x `; POW2_COND]` + &0 <= a /\ a <= b /\ #3.488 <= x ==> a pow 2 <= b pow 2 /\ + #3.488 pow 2 <= x pow 2 `) THEN +REWRITE_TAC[SQRT8_POW2; sqrt8] THEN +NHANH (MESON[REAL_ARITH ` &0 <= a /\ a <= b /\ #3.488 <= x ==> &0 <= b /\ + &0 <= #3.488 /\ &0 <= x `; POW2_COND]` + &0 <= a /\ a <= b /\ #3.488 <= x ==> a pow 2 <= b pow 2 /\ + #3.488 pow 2 <= x pow 2 `) THEN +REWRITE_TAC[SQRT8_POW2] THEN +NHANH (MESON[REAL_ARITH ` &0 <= &8 /\ &0 <= #3.488 pow 2 `; REAL_LE_MUL2]` &8 <= a /\ + #3.488 pow 2 <= b ==> &8 * #3.488 pow 2 <= a * b `) THEN +REWRITE_TAC[REAL_ARITH` a pow 4 = a pow 2 pow 2 `] THEN +NHANH (MESON[REAL_ARITH ` #3.488 pow 2 <= x ==> &0 <= #3.488 pow 2 /\ + &0 <= x `; POW2_COND]` #3.488 pow 2 <= x ==> #3.488 pow 2 pow 2 <= x pow 2 `) THEN +REWRITE_TAC[REAL_ARITH ` a + -- &1 * x pow 2 + b * x + c = + a + -- &1 * ( x pow 2 + -- b * x + -- c ) `] THEN +NHANH (prove(` #3.488 pow 2 <= x pow 2 ==> + #3.488 pow 2 pow 2 + + --(&103001 / &5000) * #3.488 pow 2 + + --(-- &529046001 / &100000000) <= x pow 2 pow 2 + + --(&103001 / &5000) * x pow 2 + + --(-- &529046001 / &100000000) `, +MP_TAC (REAL_ARITH ` -- ( --(&103001 / &5000)) / &2 <= #3.488 pow 2 `) THEN +MESON_TAC[GREATER_THAN_MID_QUADRATIC_PO ])) THEN +REAL_ARITH_TAC);; + + + +let LEMMA_IN_LEMMA42_P25 = prove(` ! v1 v2 v3 v4 x. + d3 v1 v2 = #2.51 /\ + d3 v1 v4 = #2.51 /\ + d3 v2 v3 = &2 /\ + d3 v3 v4 = &2 /\ + sqrt8 <= d3 v2 v4 /\ + #3.488 <= x +==> delta (d3 v1 v2 pow 2) ( x pow 2) (d3 v1 v4 pow 2) + (d3 v2 v3 pow 2) + (d3 v2 v4 pow 2) + (d3 v3 v4 pow 2) < &0 `, +SIMP_TAC[] THEN +NHANH (MESON[REAL_ARITH` #3.488 <= x ==> &0 <= #3.488 /\ &0 <= x `; POW2_COND]` + #3.488 <= x ==> (#3.488 pow 2 <= x pow 2 ) `) THEN +REWRITE_TAC[delta] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +REWRITE_TAC[REAL_POLY_CONV `--(&63001 / &10000 * x pow 2 * &4) - + &63001 / &10000 * &63001 / &10000 * d3 v2 v4 pow 2 - + x pow 2 * &63001 / &2500 - + &4 * d3 v2 v4 pow 2 * &4 + + &63001 / &10000 * + &4 * + (-- &63001 / &10000 + + x pow 2 + + &63001 / &10000 + + &4 + + d3 v2 v4 pow 2 - &4) + + x pow 2 * + d3 v2 v4 pow 2 * + (&63001 / &10000 - x pow 2 + + &63001 / &10000 + + &4 - d3 v2 v4 pow 2 + + &4) + + &63001 / &10000 * + &4 * + (&63001 / &10000 + + x pow 2 - &63001 / &10000 - &4 + + d3 v2 v4 pow 2 + + &4) `] THEN +REWRITE_TAC[REAL_IDEAL_CONV [` y pow 2 `] `-- &1 * x pow 4 * y pow 2 + + -- &1 * x pow 2 * y pow 4 + + &103001 / &5000 * x pow 2 * y pow 2 + + -- &529046001 / &100000000 * y pow 2 `] THEN +REWRITE_TAC[MESON[]` a/\ #3.488 <= x /\ c <=> (a/\ #3.488 <= x )/\ c`] THEN +NHANH (LEMMA_OF_L42) THEN +REWRITE_TAC[sqrt8] THEN +NHANH (SQRT8_LE_EQ_8_LESS_POW2) THEN +REPEAT GEN_TAC THEN +STRIP_TAC THEN +UNDISCH_TAC ` &8 <= d3 v2 v4 pow 2 ` THEN +UNDISCH_TAC ` -- &1 * x pow 2 * d3 v2 v4 pow 2 + + -- &1 * x pow 4 + + &103001 / &5000 * x pow 2 + + -- &529046001 / &100000000 < + &0 ` THEN +ABBREV_TAC ` xx = (-- &1 * x pow 2 * d3 v2 v4 pow 2 + + -- &1 * x pow 4 + + &103001 / &5000 * x pow 2 + + -- &529046001 / &100000000)` THEN +NHANH (REAL_ARITH ` &8 <= a ==> &0 < a `) THEN +REWRITE_TAC[REAL_ARITH ` ( a * b < &0 <=> &0 < ( -- a ) * b )/\ + ( a < &0 <=> &0 < -- a )`] THEN +SIMP_TAC[REAL_LT_MUL]);; + +let PAATDXJ =prove(` ! v1 v2 v3 (v4:real^3). + CARD {v1,v2,v3,v4} = 4 /\ + d3 v1 v2 = #2.51 /\ + d3 v1 v4 = #2.51 /\ + d3 v2 v3 = &2 /\ + d3 v3 v4 = &2 /\ + sqrt8 <= d3 v2 v4 + ==> d3 v1 v3 < #3.488 `, +MP_TAC LEMMA3 THEN LET_TR THEN REWRITE_TAC[REAL_ARITH ` a < b <=> ~ ( b <= a )`] +THEN REWRITE_TAC[MESON[]` a ==> ~ b <=> ~( a /\b)`] THEN +PHA THEN NHANH (SPEC_ALL LEMMA_IN_LEMMA42_P25) THEN +REWRITE_TAC[REAL_ARITH` a < b <=> ~(b <= a ) `] THEN SIMP_TAC[d3]);; + + +(* the following lemma are in Multivariate/convex.ml *) + + +let CONVEX_FINITE = new_axiom `!s:real^N->bool. + FINITE s + ==> (convex s <=> + !u. (!x. x IN s ==> &0 <= u x) /\ + sum s u = &1 + ==> vsum s (\x. u(x) % x) IN s)`;; + +let CONVEX_BALL = new_axiom `!x:real^N e. convex( normball x e) `;; + +let CONVEX_HULL_FINITE = new_axiom ` + !s. FINITE s + ==> convex hull s = + {y:real^N | ?u. (!x. x IN s ==> &0 <= u x) /\ + sum s u = &1 /\ + vsum s (\x. u(x) % x) = y} `;; + +let CONVEX_HULL4 = +MATCH_MP CONVEX_HULL_FINITE (MESON[ FINITE_RULES]` FINITE {(v1:real^N),v2,v3,v4} `);; + + + +let CONVEX_EXPLICIT = new_axiom `!s:real^N->bool. + convex s <=> + !t u. FINITE t /\ t SUBSET s /\ (!x. x IN t ==> &0 <= u x) /\ + sum t u = &1 + ==> vsum t (\x. u(x) % x) IN s`;; + +let CONVEX_HULL_FINITE_STEP = new_axiom +`((?u. (!x. x IN {} ==> &0 <= u x) /\ + sum {} u = w /\ + vsum {} (\x. u(x) % x) = y) <=> w = &0 /\ y = vec 0) /\ + (FINITE(s:real^N->bool) + ==> ((?u. (!x. x IN (a INSERT s) ==> &0 <= u x) /\ + sum (a INSERT s) u = w /\ + vsum (a INSERT s) (\x. u(x) % x) = y) <=> + ?v. &0 <= v /\ + ?u. (!x. x IN s ==> &0 <= u x) /\ + sum s u = w - v /\ + vsum s (\x. u(x) % x) = y - v % a))`;; + +let CONVEX_HULL_4_EQUIV = prove(` ! v1 v2 v3 (v4:real^N). + conv {v1,v2,v3,v4} = { x | ? a b c d. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + &0 <= d /\ + a + b + c + d = &1 /\ + a % v1 + b % v2 + c % v3 + d % v4 = x } `, +REWRITE_TAC[conv; FUN_EQ_THM; affsign; lin_combo; UNION_EMPTY; + IN_ELIM_THM; sgn_ge] THEN +REWRITE_TAC[MESON[]` x = vsum aa bb /\ a /\ b <=> + a /\ b /\ vsum aa bb = x `] THEN +ONCE_REWRITE_TAC[SET_RULE ` a s ==> b <=> s IN a ==> b `] THEN + SIMP_TAC[CONVEX_HULL_FINITE_STEP; FINITE_INSERT; FINITE_RULES] THEN + REWRITE_TAC[REAL_ARITH `x - y = z:real <=> x = y + z`; + VECTOR_ARITH `x - y = z:real^N <=> x = y + z`] THEN + REWRITE_TAC[VECTOR_ADD_RID; REAL_ADD_RID] THEN MESON_TAC[IN]);; + + +let TXDIACY = prove(`! (a:real^3) b c d (v0: real^3) r. + {a, b, c, d} SUBSET normball v0 r + ==> convex hull {a, b, c, d} SUBSET normball v0 r `, +REPEAT GEN_TAC THEN MP_TAC (MESON[CONVEX_BALL]` convex (normball (v0:real^3) r)`) THEN +NHANH (MESON[FINITE6] ` {a, b, c, d} SUBSET s ==> FINITE {(a:real^3),b,c,d} `) THEN +REWRITE_TAC[CONVEX_HULL4; CONVEX_EXPLICIT] THEN +IMP_IMP_TAC THEN +REWRITE_TAC[SET_RULE ` {a | P a } SUBSET b <=> (! a. P a ==> a IN b)`] THEN +REWRITE_TAC[MESON[]` (! y. ( ? u. P u y ) ==> Q y ) <=> + (! y u. P u y ==> Q y ) `] THEN +REWRITE_TAC[MESON[]`(!y u. P u /\ Q u /\ R u = y ==> Z y) <=> + (!u. P u /\ Q u ==> Z (R u)) `] THEN MESON_TAC[]);; +let LEMMA14 = TXDIACY;; + + +let ECSEVNC = prove(`?t1 t2 t3 t4. + !v1 v2 v3 v4 (v: real^3). + ~coplanar {v1, v2, v3, v4} + ==> t1 v1 v2 v3 v4 v + + t2 v1 v2 v3 v4 v + + t3 v1 v2 v3 v4 v + + t4 v1 v2 v3 v4 v = + &1 /\ + v = + t1 v1 v2 v3 v4 v % v1 + + t2 v1 v2 v3 v4 v % v2 + + t3 v1 v2 v3 v4 v % v3 + + t4 v1 v2 v3 v4 v % v4 /\ + (!ta tb tc td. + v = ta % v1 + tb % v2 + tc % v3 + td % v4 /\ + ta + tb + tc + td = &1 + ==> ta = t1 v1 v2 v3 v4 v /\ + tb = t2 v1 v2 v3 v4 v /\ + tc = t3 v1 v2 v3 v4 v /\ + td = t4 v1 v2 v3 v4 v) `, +REWRITE_TAC[GSYM SKOLEM_THM; RIGHT_EXISTS_IMP_THM] THEN REPEAT +GEN_TAC THEN NHANH (SPEC_ALL (prove(`!v1 v2 v3 v0 v:real^3. + ~coplanar {v0, v1, v2, v3} ==> (?t1 t2 t3. v - v0 = t1 % (v1 - v0) + + t2 % (v2 - v0) + t3 % (v3 - v0) /\ (!ta tb tc. v - v0 = ta % (v1 - v0) + + tb % (v2 - v0) + tc % (v3 - v0) ==> ta = t1 /\ + tb = t2 /\ tc = t3))`, SIMP_TAC[NONCOPLANAR_3_BASIS]))) THEN +STRIP_TAC THEN EXISTS_TAC ` &1 - t1 - t2 - t3 ` THEN +EXISTS_TAC ` t1:real ` THEN EXISTS_TAC ` t2:real ` THEN +EXISTS_TAC ` t3:real ` THEN CONJ_TAC THENL [REAL_ARITH_TAC; + CONJ_TAC] THENL [UNDISCH_TAC ` (v:real^3) - v1 = t1 % (v2 - v1) + +t2 % (v3 - v1) + t3 % (v4 - v1)` THEN +CONV_TAC VECTOR_ARITH; REPEAT GEN_TAC] THEN +REWRITE_TAC[MESON[]` a /\ b ==> c <=> b ==> a ==> c `; + REAL_ARITH ` ta + tb + tc + td = &1 <=> ta = &1 - tb - tc - td `] THEN +SIMP_TAC[] THEN REWRITE_TAC[VECTOR_ARITH ` v = (&1 - tb - tc - td) % v1 + + tb % v2 + tc % v3 + td % v4 <=> v - v1 = tb % ( v2 - v1 ) + +tc % ( v3 - v1 ) + td % ( v4 - v1 ) `] THEN ASM_MESON_TAC[]);; + +let LEMMA76 = ECSEVNC;; + +let COEFS_4 = new_specification ["COEF4_1"; "COEF4_2"; "COEF4_3"; "COEF4_4"] ECSEVNC ;; + + + + + +let COEF_1_EQ_ZERO = prove(` ! v1 v2 v3 v4 (v:real^3). + ~ coplanar {v1,v2,v3,v4} ==> + ( COEF4_1 v1 v2 v3 v4 v = &0 <=> v IN aff {v2,v3,v4} ) `, +REWRITE_TAC[aff; AFFINE_HULL_3; IN_ELIM_THM] THEN +NHANH (SPEC_ALL COEFS_4) THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN +ONCE_REWRITE_TAC[REAL_ARITH` u + v + w = &0 + u + v + w `] THEN +ONCE_REWRITE_TAC[VECTOR_ARITH` u + v + w = &0 % v1 + u + v + w `] THEN +ASM_MESON_TAC[]);; + + +let EQ_IMP_COPLANAR = prove(`! a b c (d:real^3). ( a = b \/ a = c \/ a = d ) + ==> coplanar {a,b,c,d} `, +REPEAT STRIP_TAC THENL [ +ASM_SIMP_TAC[SET_RULE ` a INSERT ( a INSERT s ) = a INSERT s `] THEN +MP_TAC (DIMINDEX_3) THEN MESON_TAC[COPLANAR_3; ARITH_RULE` a = 3 ==> 2 <= a `]; +ONCE_REWRITE_TAC[SET_RULE` {a,b,v,c} = {a,v,b,c} `] THEN +ASM_SIMP_TAC[SET_RULE ` a INSERT ( a INSERT s ) = a INSERT s `] THEN +MP_TAC (DIMINDEX_3) THEN MESON_TAC[COPLANAR_3; ARITH_RULE` a = 3 ==> 2 <= a `]; +ONCE_REWRITE_TAC[SET_RULE` {a,b,v,c} = {a,c,v,b} `] THEN +ASM_SIMP_TAC[SET_RULE ` a INSERT ( a INSERT s ) = a INSERT s `] THEN +MP_TAC (DIMINDEX_3) THEN MESON_TAC[COPLANAR_3; ARITH_RULE` a = 3 ==> 2 <= a `]]);; + + + + + +let AFFINE_HULL_FINITE_STEP_GEN = prove + (`!P:real^N->real->bool. + ((?u. (!x. x IN {} ==> P x (u x)) /\ + sum {} u = w /\ vsum {} (\x. u(x) % x) = y) <=> + w = &0 /\ y = vec 0) /\ + (FINITE(s:real^N->bool) /\ + (!y. a IN s /\ P a y ==> P a (y / &2)) /\ + (!x y. a IN s /\ P a x /\ P a y ==> P a (x + y)) + ==> ((?u. (!x. x IN (a INSERT s) ==> P x (u x)) /\ + sum (a INSERT s) u = w /\ + vsum (a INSERT s) (\x. u(x) % x) = y) <=> + ?v u. P a v /\ (!x. x IN s ==> P x (u x)) /\ + sum s u = w - v /\ + vsum s (\x. u(x) % x) = y - v % a))`, + GEN_TAC THEN SIMP_TAC[SUM_CLAUSES; VSUM_CLAUSES; NOT_IN_EMPTY] THEN + CONJ_TAC THENL [MESON_TAC[]; ALL_TAC] THEN DISCH_TAC THEN + ASM_CASES_TAC `(a:real^N) IN s` THEN ASM_REWRITE_TAC[] THENL + [ASM_SIMP_TAC[SET_RULE `a IN s ==> a INSERT s = s`] THEN EQ_TAC THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THENL + [X_GEN_TAC `u:real^N->real` THEN STRIP_TAC THEN + EXISTS_TAC `(u:real^N->real) a / &2` THEN + EXISTS_TAC `\x:real^N. if x = a then u x / &2 else u x`; + MAP_EVERY X_GEN_TAC [`v:real`; `u:real^N->real`] THEN + STRIP_TAC THEN + EXISTS_TAC `\x:real^N. if x = a then u x + v else u x`] THEN + ASM_SIMP_TAC[] THEN (CONJ_TAC THENL [ASM_MESON_TAC[]; ALL_TAC]) THEN + ONCE_REWRITE_TAC[COND_RAND] THEN ONCE_REWRITE_TAC[COND_RATOR] THEN + ASM_SIMP_TAC[VSUM_CASES; SUM_CASES] THEN + ASM_SIMP_TAC[GSYM DELETE; SUM_DELETE; VSUM_DELETE] THEN + ASM_SIMP_TAC[SET_RULE `a IN s ==> {x | x IN s /\ x = a} = {a}`] THEN + REWRITE_TAC[SUM_SING; VSUM_SING] THEN + (CONJ_TAC THENL [REAL_ARITH_TAC; VECTOR_ARITH_TAC]); + EQ_TAC THEN REWRITE_TAC[LEFT_IMP_EXISTS_THM] THENL + [X_GEN_TAC `u:real^N->real` THEN STRIP_TAC THEN + EXISTS_TAC `(u:real^N->real) a` THEN + EXISTS_TAC `u:real^N->real` THEN ASM_SIMP_TAC[IN_INSERT] THEN + REPEAT(FIRST_X_ASSUM(SUBST1_TAC o SYM)) THEN + CONJ_TAC THENL [REAL_ARITH_TAC; VECTOR_ARITH_TAC]; + MAP_EVERY X_GEN_TAC [`v:real`; `u:real^N->real`] THEN + STRIP_TAC THEN + EXISTS_TAC `\x:real^N. if x = a then v:real else u x` THEN + ASM_SIMP_TAC[IN_INSERT] THEN CONJ_TAC THENL + [ASM_MESON_TAC[]; ALL_TAC] THEN + ONCE_REWRITE_TAC[COND_RAND] THEN ONCE_REWRITE_TAC[COND_RATOR] THEN + ASM_SIMP_TAC[VSUM_CASES; SUM_CASES] THEN + ASM_SIMP_TAC[GSYM DELETE; SUM_DELETE; VSUM_DELETE] THEN + ASM_SIMP_TAC[SET_RULE `~(a IN s) ==> {x | x IN s /\ x = a} = {}`] THEN + ASM_SIMP_TAC[SET_RULE `~(a IN s) ==> s DELETE a = s`] THEN + REWRITE_TAC[SUM_CLAUSES; VSUM_CLAUSES] THEN + CONJ_TAC THENL [REAL_ARITH_TAC; VECTOR_ARITH_TAC]]]);; + + + +let THEOREM_RE_AFF_LT31 = prove + (`!v1 v2 v3 vv x:real^N. + ~(v1 = vv) /\ ~(v2 = vv) /\ ~(v3 = vv) + ==> ((?f. f vv < &0 /\ + sum {v1, v2, v3, vv} f = &1 /\ + x = vsum {v1, v2, v3, vv} (\v. f v % v)) <=> + {x | ?a b c t. + a + b + c + t = &1 /\ + x = a % v1 + b % v2 + c % v3 + t % vv /\ + t < &0} + x)`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC + `?f. (!x:real^N. x IN {v1, v2, v3, vv} ==> vv = x ==> f x < &0) /\ + sum {v1, v2, v3, vv} f = &1 /\ + vsum {v1, v2, v3, vv} (\v. f v % v) = x` THEN + CONJ_TAC THENL + [ASM_REWRITE_TAC[FORALL_IN_INSERT; NOT_IN_EMPTY] THEN MESON_TAC[]; + SIMP_TAC[AFFINE_HULL_FINITE_STEP_GEN; + REAL_ARITH `x < &0 /\ y < &0 ==> x + y < &0`; + REAL_ARITH `x < &0 ==> x / &2 < &0`; + FINITE_INSERT; CONJUNCT1 FINITE_RULES; RIGHT_EXISTS_AND_THM] THEN + ASM_REWRITE_TAC[IN_ELIM_THM; + REAL_ARITH `x - y:real = z <=> x = y + z`; + VECTOR_ARITH `x - y:real^N = z <=> x = y + z`] THEN + REWRITE_TAC[VECTOR_ADD_RID; REAL_ADD_RID] THEN MESON_TAC[]]);; + +let AFF_LT31 = prove(` ! v1 v2 v3 (vv: real^N). ~ (vv IN {v1,v2,v3} ) ==> +aff_lt {v1,v2,v3} {vv} = + { x| ? a b c t. t < &0 /\ a + b + c + t = &1 /\ + x = a % v1 + b % v2 + c % v3 + t % vv } `, +REWRITE_TAC[IN_SET3; DE_MORGAN_THM; aff_lt_def;FUN_EQ_THM; + affsign; lin_combo; sgn_lt] THEN +REWRITE_TAC[SET_RULE` {v1, v2, v3} UNION {vv} = {v1, v2, v3, vv}`] THEN +REWRITE_TAC[SET_RULE` a /\ (!w. {vv} w ==> f w < &0) /\ b + <=> f vv < &0 /\ b /\ a `] THEN +SIMP_TAC[THEOREM_RE_AFF_LT31; IN_ELIM_THM] THEN SET_TAC[]);; + +let AFF_LT21 = prove(`! a b (v0:real^N). ~ ( a = v0 ) /\ ~( b = v0 ) ==> +aff_lt {a,b} {v0} = + {x | ? ta tb t. + ta + tb + t = &1 /\ + t < &0 /\ + x = ta % a + tb % b + t % v0} `, +REWRITE_TAC[SET_RULE` ~(a = v0) /\ ~(b = v0) <=> + ~ ( v0 IN {a,b} ) `] THEN +ONCE_REWRITE_TAC[SET_RULE` {a,b} = {a,b,b} `] THEN SIMP_TAC[AFF_LT31] THEN +SIMP_TAC[AFF_LT31; FUN_EQ_THM; IN_ELIM_THM] THEN +REWRITE_TAC[VECTOR_ARITH` a % b + c % b + x = ( a + c ) % b + x `] THEN +MESON_TAC[REAL_ARITH` a + b + c = ( a + b ) + c `; +VECTOR_ARITH ` a % v = ( a + &0 ) % v `; REAL_ARITH ` + a + b = a + &0 + b `]);; + + +let INSET3 = SET_RULE` a IN {a,b,c} /\ b IN {a,b,c} /\ c IN {a,b,c} `;; + + + + + + +let AFF_GT33 = prove(`! (v1:real^N) v2 v3 w1 w2 w3. + {v1, v2, v3} INTER {w1, w2, w3} = {} + ==> aff_gt {v1, v2, v3} {w1, w2, w3} = + {x | ?a1 a2 a3 b1 b2 b3. + &0 < b1 /\ + &0 < b2 /\ + &0 < b3 /\ + a1 + a2 + a3 + b1 + b2 + b3 = &1 /\ + x = + a1 % v1 + a2 % v2 + a3 % v3 + b1 % w1 + b2 % w2 + b3 % w3}`, +REWRITE_TAC[aff_gt_def; FUN_EQ_THM; affsign; lin_combo; sgn_gt] THEN +REPEAT STRIP_TAC THEN +MATCH_MP_TAC EQ_TRANS THEN +REWRITE_TAC[SET_RULE ` ( a INSERT b ) UNION c = + b UNION ( a INSERT c ) /\ {} UNION b = b `] THEN +EXISTS_TAC ` (? f. x = vsum {v3, v2, v1, w1, w2, w3} (\v. f v % v) /\ + (!(w:real^N). w IN {v3,v2,v1, w1, w2, w3} ==> w IN {w1,w2,w3} ==> &0 < f w) /\ + sum {v3, v2, v1, w1, w2, w3} f = &1 ) ` THEN +REWRITE_TAC[SET_RULE` (!x. ({v1, v2, v3} INTER {w1, w2, w3}) x <=> {} x) + <=> {v1, v2, v3} INTER {w1, w2, w3} = {} `] THEN +CONJ_TAC THENL [ +FIRST_X_ASSUM MP_TAC THEN +REWRITE_TAC[SET_RULE` (!x. ({v1, v2, v3} INTER {w1, w2, w3}) x <=> {} x) + <=> {v1, v2, v3} INTER {w1, w2, w3} = {} `] THEN +MESON_TAC[SET_RULE` {v1, v2, v3} INTER {w1, w2, w3} = {} ==> + ( (!w. {w1, w2, w3} w ==> &0 < f w) <=> + (!w. w IN {v3, v2, v1, w1, w2, w3} + ==> w IN {w1, w2, w3} + ==> &0 < f w) ) `]; +REWRITE_TAC[MESON[]` a /\ (!z. P z ) /\ aa = &1 <=> + (!z. P z ) /\ aa = &1 /\ a `]] THEN +ONCE_REWRITE_TAC[MESON[]` a = vsum b c <=> vsum b c = a `] THEN + SIMP_TAC[AFFINE_HULL_FINITE_STEP_GEN;FINITE_INSERT; CONJUNCT1 FINITE_RULES; + RIGHT_EXISTS_AND_THM; + REAL_ARITH `&0 < x /\ &0 < y ==> &0 < x + y`; + REAL_ARITH `&0 < x ==> &0 < x / &2 `] THEN +FIRST_X_ASSUM MP_TAC THEN +REWRITE_TAC[SET_RULE` (!x. ({v1, v2, v3} INTER {w1, w2, w3}) x <=> {} x) + <=> {v1, v2, v3} INTER {w1, w2, w3} = {} `; SET_RULE` ( a INSERT s ) INTER ss = {} <=> +~ ( a IN ss ) /\ s INTER ss = {} `] THEN +SIMP_TAC[INSET3] THEN +SIMP_TAC[INSET3; REAL_ARITH` a - b = c <=> a = b + c `; + VECTOR_ARITH` a:real^N - b = c <=> a = b + c `] THEN +REWRITE_TAC[ GSYM RIGHT_EXISTS_AND_THM; ZERO_NEUTRAL; + IN_ELIM_THM; VECTOR_ARITH ` a + vec 0 = a `] THEN +DISCH_TAC THEN +MESON_TAC[REAL_ARITH` a + b + c + d = c + b + a + d `; + VECTOR_ARITH` ( a:real^N ) + b + c + d = c + b + a + d `]);; + + +g `! (v1:real^N) v2 v3 w1 w2 w3. + {v1, v2, v3} INTER {w1, w2, w3} = {} + ==> aff_ge {v1, v2, v3} {w1, w2, w3} = + {x | ?a1 a2 a3 b1 b2 b3. + &0 <= b1 /\ + &0 <= b2 /\ + &0 <= b3 /\ + a1 + a2 + a3 + b1 + b2 + b3 = &1 /\ + x = + a1 % v1 + a2 % v2 + a3 % v3 + b1 % w1 + b2 % w2 + b3 % w3}`;; +e (REWRITE_TAC[aff_gt_def; aff_ge_def; FUN_EQ_THM; affsign; lin_combo; sgn_gt; sgn_ge]);; +e (REPEAT STRIP_TAC);; +e (MATCH_MP_TAC EQ_TRANS );; +e (REWRITE_TAC[SET_RULE ` ( a INSERT b ) UNION c = + b UNION ( a INSERT c ) /\ {} UNION b = b `]);; +e (EXISTS_TAC ` (? f. x = vsum {v3, v2, v1, w1, w2, w3} (\v. f v % v) /\ + (!(w:real^N). w IN {v3,v2,v1, w1, w2, w3} ==> w IN {w1,w2,w3} ==> &0 <= f w) /\ + sum {v3, v2, v1, w1, w2, w3} f = &1 ) `);; +e (CONJ_TAC);; +e (FIRST_X_ASSUM MP_TAC);; +e (REWRITE_TAC[SET_RULE` (!x. ({v1, v2, v3} INTER {w1, w2, w3}) x <=> {} x) + <=> {v1, v2, v3} INTER {w1, w2, w3} = {} `]);; +e (MESON_TAC[SET_RULE` {v1, v2, v3} INTER {w1, w2, w3} = {} ==> + ( (!w. {w1, w2, w3} w ==> &0 <= f w) <=> + (!w. w IN {v3, v2, v1, w1, w2, w3} + ==> w IN {w1, w2, w3} + ==> &0 <= f w) ) `]);; +e (REWRITE_TAC[MESON[]` a /\ (!z. P z ) /\ aa = &1 <=> + (!z. P z ) /\ aa = &1 /\ a `]);; +e (ONCE_REWRITE_TAC[MESON[]` a = vsum b c <=> vsum b c = a `]);; +e ( SIMP_TAC[AFFINE_HULL_FINITE_STEP_GEN;FINITE_INSERT; CONJUNCT1 FINITE_RULES; + RIGHT_EXISTS_AND_THM; + REAL_ARITH `&0 <= x /\ &0 <= y ==> &0 <= x + y`; + REAL_ARITH `&0 <= x ==> &0 <= x / &2 `]);; +e (FIRST_X_ASSUM MP_TAC);; +e (REWRITE_TAC[SET_RULE` (!x. ({v1, v2, v3} INTER {w1, w2, w3}) x <=> {} x) + <=> {v1, v2, v3} INTER {w1, w2, w3} = {} `; SET_RULE` ( a INSERT s ) INTER ss = {} <=> +~ ( a IN ss ) /\ s INTER ss = {} `]);; +e (SIMP_TAC[INSET3]);; +e (SIMP_TAC[INSET3; REAL_ARITH` a - b = c <=> a = b + c `; + VECTOR_ARITH` a:real^N - b = c <=> a = b + c `]);; +e (REWRITE_TAC[ GSYM RIGHT_EXISTS_AND_THM; ZERO_NEUTRAL; + IN_ELIM_THM; VECTOR_ARITH ` a + vec 0 = a `]);; +e (DISCH_TAC);; +e (MESON_TAC[REAL_ARITH` a + b + c + d = c + b + a + d `; + VECTOR_ARITH` ( a:real^N ) + b + c + d = c + b + a + d `]);; +let AFF_GE33 = top_thm();; + + +let AFF_GE_12 = prove(`!v0 (a:real^N) b. + ~(v0 = a \/ v0 = b) + ==> aff_ge {v0} {a, b} = + {x | ?tv ta tb. + &0 <= ta /\ + &0 <= tb /\ + tv + ta + tb = &1 /\ + x = tv % v0 + ta % a + tb % b}`, +REWRITE_TAC[SET_RULE ` ~(v0 = a \/ v0 = b) <=> {v0} INTER {a,b} = {} `] THEN +ONCE_REWRITE_TAC[SET_RULE` {a} = {a,a} `] THEN +ONCE_REWRITE_TAC[SET_RULE` {a,a} = {a,a,a} `] THEN +ONCE_REWRITE_TAC[SET_RULE` {a,b,b,b} = {a,b,b} `] THEN +SIMP_TAC[AFF_GE33] THEN REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM] THEN +REPEAT STRIP_TAC THEN +REWRITE_TAC[GSYM VECTOR_ADD_RDISTRIB; VECTOR_ARITH` a % v + + b % v + y = ( a + b ) % v + y `] THEN GONTONG THEN EQ_TAC THENL [ +MESON_TAC[REAL_ARITH` a1 + a2 + a3 + b1 + b2 + b3 = + ( a1 + a2 + a3 ) + b1 + b2 + b3 `; REAL_ARITH ` &0 <= a +/\ &0 <= b ==> &0 <= a + b `];STRIP_TAC] THEN EXISTS_TAC` tv: real ` +THEN EXISTS_TAC` &0 ` THEN EXISTS_TAC` &0` THEN EXISTS_TAC` ta :real ` + THEN EXISTS_TAC` &0` THEN EXISTS_TAC` tb:real ` THEN +ASM_SIMP_TAC[REAL_ARITH ` a <= a `; ZERO_NEUTRAL]);; + + +let INSET3 = SET_RULE` a IN {a, b, c} /\ b IN {a, b, c} /\ c IN {a, b, c} + /\ {a, b, c} a /\ {a, b, c} b /\ {a, b, c} c `;; + + + +let AFF_LE_LT33 = prove(`! (v1:real^N) v2 v3 w1 w2 w3. + {v1, v2, v3} INTER {w1, w2, w3} = {} + ==> aff_le {v1, v2, v3} {w1, w2, w3} = + {x | ?a1 a2 a3 b1 b2 b3. + b1 <= &0 /\ + b2 <= &0 /\ + b3 <= &0 /\ + a1 + a2 + a3 + b1 + b2 + b3 = &1 /\ + x = + a1 % v1 + a2 % v2 + a3 % v3 + b1 % w1 + b2 % w2 + b3 % w3} /\ + aff_lt {v1, v2, v3} {w1, w2, w3} = + {x | ?a1 a2 a3 b1 b2 b3. + b1 < &0 /\ + b2 < &0 /\ + b3 < &0 /\ + a1 + a2 + a3 + b1 + b2 + b3 = &1 /\ + x = + a1 % v1 + a2 % v2 + a3 % v3 + b1 % w1 + b2 % w2 + b3 % w3} `, +REWRITE_TAC[IN_ELIM_THM; aff_le_def; FUN_EQ_THM; aff_lt_def; + affsign; lin_combo; sgn_lt; sgn_le] THEN +REWRITE_TAC[SET_RULE` {v1, v2, v3} UNION {w1, w2, w3} = + {v1,v2,v3,w1,w2,w3} `] THEN +ONCE_REWRITE_TAC[SET_RULE` {w1, w2, w3} w ==> P w <=> + w IN {v1,v2,v3,w1,w2,w3} ==> {w1,w2,w3} w ==> P w `] THEN +REWRITE_TAC[MESON[]` a = vsum aa bb /\ + (! w. P w ) /\ b <=> (! w. P w ) /\ b /\ vsum aa bb = a `] THEN + SIMP_TAC[AFFINE_HULL_FINITE_STEP_GEN; + REAL_ARITH `( x < &0 /\ y < &0 ==> x + y < &0) /\ ( x <= &0 /\ y <= &0 ==> x + y <= &0)`; + REAL_ARITH ` (x < &0 ==> x / &2 < &0 ) /\ (x <= &0 ==> x / &2 <= &0 )`; + FINITE_INSERT; CONJUNCT1 FINITE_RULES +; RIGHT_EXISTS_AND_THM] THEN +SIMP_TAC[ GSYM RIGHT_EXISTS_AND_THM; SET_RULE ` + (!x. ({v1, v2, v3} INTER s ) x <=> {} x) <=> + ~ ( s v1 ) /\ ~ ( s v2 ) /\ ~ ( s v3 ) `; INSET3] THEN +REWRITE_TAC[REAL_ARITH` a - b = c <=> a = b + c`; REAL_ARITH ` + a + &0 = a `; VECTOR_ARITH` (a:real^N) - b = c <=> a = b + c`; + VECTOR_ARITH` a + vec 0 = a `] THEN +MESON_TAC[]);; + + + + +let AFF_GES_LTS = prove(` ! a b c (v0 :real^N). + ~ ( a = v0 ) /\ ~( b = v0 ) /\ ~( c = v0 ) ==> +aff_gt {a, b} {v0} = + {x | ?ta tb t. + ta + tb + t = &1 /\ &0 < t /\ x = ta % a + tb % b + t % v0} /\ +aff_ge {a, b} {v0} = + {x | ?ta tb t. + ta + tb + t = &1 /\ + &0 <= t /\ + x = ta % a + tb % b + t % v0} /\ +aff_lt {a,b,c} {v0} = + { x| ? ta tb tc t. t < &0 /\ ta + tb + tc + t = &1 /\ + x = ta % a + tb % b + tc % c + t % v0 } /\ +aff_gt {a,b,c} {v0} = + { x| ? ta tb tc t. &0 < t /\ ta + tb + tc + t = &1 /\ + x = ta % a + tb % b + tc % c + t % v0 } `, +ONCE_REWRITE_TAC[SET_RULE` {a} = {a,a,a} `] THEN +ONCE_REWRITE_TAC[SET_RULE` {a,b,b,b} = {a,b,b} `] THEN +ONCE_REWRITE_TAC[SET_RULE` {a,b,c,c} = {a,b,c} `] THEN +NHANH (SET_RULE` ~(a = v0) /\ ~(b = v0) /\ ~(c = v0) ==> + {a,b,b} INTER {v0,v0,v0} = {} /\ {a,b,c} INTER {v0,v0,v0} = {} `) THEN +SIMP_TAC[AFF_LE_LT33; AFF_GE33; AFF_GT33] THEN +REWRITE_TAC[GSYM VECTOR_ADD_RDISTRIB; VECTOR_ARITH` a % x + b % x + y + = ( a + b ) % x + y `] THEN +REWRITE_TAC[REAL_ARITH` (a + b ) + c = a + b + c `] THEN +REPEAT STRIP_TAC THENL [ +REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM] THEN GEN_TAC THEN +EQ_TAC THENL [MESON_TAC[REAL_ARITH ` &0 < a /\ &0 < b ==> &0 < a + b `; + REAL_ARITH ` a + b + c + d = a + ( b + c ) + d `]; +MESON_TAC[REAL_ARITH ` a + b + c = a + b / &2 + b / &2 + c / &3 + + c / &3 + c / &3 `; REAL_ARITH` &0 < a <=> &0 < a / &3 `; + REAL_ARITH` a = a / &2 + a / &2 /\ b = b / &3 + b / &3 + b / &3 /\ b = + ( b / &3 + b / &3 ) + b / &3 `]]; +REPEAT STRIP_TAC THEN +REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM] THEN GEN_TAC THEN +EQ_TAC THENL [ +MESON_TAC[REAL_ARITH ` ( &0 < a /\ &0 < b ==> &0 < a + b ) /\ ( &0 <= a /\ &0 <= b ==> &0 <= a + b ) `; + REAL_ARITH ` a + b + c + d = a + ( b + c ) + d `] ; +MESON_TAC[REAL_ARITH ` a + b + c = a + b / &2 + b / &2 + c / &3 + + c / &3 + c / &3 `; REAL_ARITH` ( &0 < a <=> &0 < a / &3) /\ ( &0 <= a <=> &0 <= a / &3) `; + REAL_ARITH` a = a / &2 + a / &2 /\ b = b / &3 + b / &3 + b / &3 /\ b = ( b / &3 + b / &3 ) + b / &3 `]]; +REPEAT STRIP_TAC THEN +REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM] THEN GEN_TAC THEN +EQ_TAC THENL [MESON_TAC[REAL_ARITH ` ( &0 < a /\ &0 < b ==> &0 < a + b ) +/\ ( &0 <= a /\ &0 <= b ==> &0 <= a + b ) `; REAL_ARITH ` ( a < &0 /\ b < &0 +==> a + b < &0 )`; REAL_ARITH ` a + b + c + d = a + ( b + c ) + d `]; STRIP_TAC] THEN +EXISTS_TAC `ta :real` THEN +EXISTS_TAC `tb :real` THEN +EXISTS_TAC `tc :real` THEN +REPEAT (EXISTS_TAC ` t / &3 `) THEN +ASM_MESON_TAC[REAL_ARITH` a < &0 <=> a / &3 < &0 `; + REAL_ARITH ` a = a / &3 + a / &3 + a / &3 `]; +REPEAT STRIP_TAC THEN +REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM] THEN GEN_TAC THEN +EQ_TAC THENL [MESON_TAC[REAL_ARITH ` ( &0 < a /\ &0 < b ==> &0 < a + b ) /\ ( &0 <= a /\ &0 <= b + ==> &0 <= a + b ) `; REAL_ARITH ` ( a < &0 /\ b < &0 ==> a + b < &0 )`; + REAL_ARITH ` a + b + c + d = a + ( b + c ) + d `]; STRIP_TAC] THEN +EXISTS_TAC `ta :real` THEN +EXISTS_TAC `tb :real` THEN +EXISTS_TAC `tc :real` THEN +REPEAT (EXISTS_TAC ` t / &3 `) THEN +ASM_MESON_TAC[REAL_ARITH ` a = a / &3 + a / &3 + a / &3 `; + REAL_ARITH ` &0 < a <=> &0 < a / &3 `]]);; + + +let AFF_GES_GTS = prove(` ! a b c (v0:real^N). +~(a = v0) /\ ~(b = v0) /\ ~(c = v0) + ==> aff_gt {a, b} {v0} = + {x | ?ta tb t. + ta + tb + t = &1 /\ + &0 < t /\ + x = ta % a + tb % b + t % v0} /\ + aff_ge {a, b} {v0} = + {x | ?ta tb t. + ta + tb + t = &1 /\ + &0 <= t /\ + x = ta % a + tb % b + t % v0} /\ + aff_lt {a, b, c} {v0} = + {x | ?ta tb tc t. + t < &0 /\ + ta + tb + tc + t = &1 /\ + x = ta % a + tb % b + tc % c + t % v0} /\ + aff_gt {a, b, c} {v0} = + {x | ?ta tb tc t. + &0 < t /\ + ta + tb + tc + t = &1 /\ + x = ta % a + tb % b + tc % c + t % v0} /\ + aff_ge {a, b, c} {v0} = + {x | ?ta tb tc t. + &0 <= t /\ + ta + tb + tc + t = &1 /\ + x = ta % a + tb % b + tc % c + t % v0} `, +REPEAT GEN_TAC THEN +REWRITE_TAC[MESON[]` (a ==> a1 /\ a2 /\ a3 /\ a4 /\ a5) <=> + ( a ==> a1 /\ a2 /\ a3 /\a4 ) /\ ( a ==> a5) `] THEN +REWRITE_TAC[AFF_GES_LTS] THEN +NHANH (SET_RULE` ~(a = v0) /\ ~(b = v0) /\ ~(c = v0) + ==> {a,b,c} INTER {v0,v0,v0} = {} `) THEN +ONCE_REWRITE_TAC[SET_RULE` {v} = {v,v,v} `] THEN +ONCE_REWRITE_TAC[SET_RULE` {a, b, c, c, c} = {a,b,c} `] THEN +SIMP_TAC[AFF_GE33] THEN +REPEAT STRIP_TAC THEN +REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM; GSYM VECTOR_ADD_RDISTRIB] THEN +GEN_TAC THEN EQ_TAC THENL [ +MESON_TAC[REAL_ARITH` &0 <= a /\ &0 <= b ==> &0 <= a + b `]; +STRIP_TAC THEN +EXISTS_TAC ` ta :real` THEN +EXISTS_TAC ` tb :real` THEN +EXISTS_TAC ` tc :real` THEN +REPEAT ( EXISTS_TAC ` t / &3 `) THEN +ASM_MESON_TAC[REAL_ARITH` a = a / &3 + a / &3 + a / &3 `; + REAL_ARITH` &0 <= a <=> &0 <= a / &3 `]]);; + + +let COEF_1_POS_NEG = prove(` ! v1 v2 v3 v4 (v:real^3). + ~ coplanar {v1,v2,v3,v4} ==> + ( COEF4_1 v1 v2 v3 v4 v > &0 <=> v IN aff_gt {v2,v3,v4} {v1} ) /\ +( COEF4_1 v1 v2 v3 v4 v < &0 <=> v IN aff_lt {v2,v3, v4} {v1} ) `, +NHANH (MESON[EQ_IMP_COPLANAR]`~coplanar {v1, v2, v3, v4} ==> + ~ ( v2 = v1 ) /\ ~ ((v3:real^3) = v1 ) /\ ~ (v4 = v1 ) `) THEN +SIMP_TAC[AFF_GES_LTS] THEN NHANH (SPEC_ALL COEFS_4) THEN +REWRITE_TAC[IN_ELIM_THM; REAL_ARITH ` a > b <=> b < a `] THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN +ONCE_REWRITE_TAC[REAL_ARITH ` a + b + c + t = t + a + b + c `] THEN +ONCE_REWRITE_TAC[VECTOR_ARITH ` (a:real^N) + b + c + t = t + a + b + c `] THEN +ASM_MESON_TAC[]);; + + +let ALL_ABOUT_COEF_1 = prove(` ! v1 v2 v3 v4 (v:real^3). + ~ coplanar {v1,v2,v3,v4} ==> + ( COEF4_1 v1 v2 v3 v4 v < &0 <=> v IN aff_lt {v2,v3, v4} {v1} ) /\ + ( COEF4_1 v1 v2 v3 v4 v = &0 <=> v IN aff {v2,v3,v4} ) /\ + ( COEF4_1 v1 v2 v3 v4 v > &0 <=> v IN aff_gt {v2,v3,v4} {v1} )`, +SIMP_TAC[COEF_1_EQ_ZERO ; COEF_1_POS_NEG ]);; + +let PER_COEF1_WITH_COEF2 = prove(`! v1 v2 v3 v4 (v:real^3). + ~coplanar {v1, v2, v3, v4} ==> + COEF4_2 v1 v2 v3 v4 v = COEF4_1 v2 v3 v4 v1 v `, +NHANH (SPEC_ALL COEFS_4) THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN +MP_TAC (SPECL [` v2:real^3 `; `v3:real^3`; `v4:real^3`; ` v1:real^3`; + `v:real^3 `] COEFS_4) THEN +UNDISCH_TAC ` ~coplanar {v1, v2, v3, (v4:real^3)}` THEN +IMP_IMP_TAC THEN +REWRITE_TAC[MESON[SET_RULE` {v1, v2, v3, v4} = {v2, v3, v4, v1}`]` + ~coplanar {v1, v2, v3, v4} /\ + (~coplanar {v2, v3, v4, v1} ==> l ) <=> ~coplanar {v1, v2, v3, v4} + /\ l `] THEN +ONCE_REWRITE_TAC[GSYM (REAL_ARITH` a + b + c + d = b + c + d + a `)] THEN +ONCE_REWRITE_TAC[GSYM (VECTOR_ARITH` (a:real^N) + b + c + d = b + c + d + a `)] THEN +ASM_MESON_TAC[]);; + +let PER_COEF1_WITH_COEF3 = prove(`! v1 v2 v3 v4 (v:real^3). + ~coplanar {v1, v2, v3, v4} ==> + COEF4_3 v1 v2 v3 v4 v = COEF4_1 v3 v4 v1 v2 v `, +NHANH (SPEC_ALL COEFS_4) THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN +MP_TAC (SPECL [`v3:real^3`; `v4:real^3`; ` v1:real^3`; ` v2:real^3`; + `v:real^3 `] COEFS_4) THEN +UNDISCH_TAC ` ~coplanar {v1, v2, v3, (v4:real^3)}` THEN +IMP_IMP_TAC THEN +REWRITE_TAC[MESON[SET_RULE` {v1, v2, v3, v4} = {v3, v4, v1, v2}`]` + ~coplanar {v1, v2, v3, v4} /\ + (~coplanar {v3, v4, v1, v2} ==> l ) <=> ~coplanar {v1, v2, v3, v4} + /\ l `] THEN +ONCE_REWRITE_TAC[GSYM (REAL_ARITH` a + b + c + d = c + d + a + b`)] THEN +ONCE_REWRITE_TAC[GSYM (VECTOR_ARITH` (a:real^N) + b + c + d = c + d + a + b`)] + THEN ASM_MESON_TAC[]);; + +let PER_COEF1_WITH_COEF4 = prove(`! v1 v2 v3 v4 (v:real^3). + ~coplanar {v1, v2, v3, v4} ==> + COEF4_4 v1 v2 v3 v4 v = COEF4_1 v4 v1 v2 v3 v `, +NHANH (SPEC_ALL COEFS_4) THEN +REPEAT GEN_TAC THEN +ONCE_REWRITE_TAC[SET_RULE` {v1, v2, v3, v4} = {v4,v1, v2, v3}`] THEN +NHANH (SPEC_ALL COEFS_4) THEN +MESON_TAC[REAL_ARITH` ta + tb + tc + td = td + ta + tb + tc`; + VECTOR_ARITH` ta + tb + tc + td = td + ta + tb + (tc:real^N)`]);; + +let ALL_ABOUT_COEF_2 = prove(` ! v1 v2 v3 v4 (v:real^3). + ~ coplanar {v1,v2,v3,v4} ==> + ( COEF4_2 v1 v2 v3 v4 v < &0 <=> v IN aff_lt {v1,v3, v4} {v2} ) /\ + ( COEF4_2 v1 v2 v3 v4 v = &0 <=> v IN aff {v1,v3,v4} ) /\ + ( COEF4_2 v1 v2 v3 v4 v > &0 <=> v IN aff_gt {v1,v3,v4} {v2} )`, +SIMP_TAC[PER_COEF1_WITH_COEF2] THEN MP_TAC ALL_ABOUT_COEF_1 THEN +MESON_TAC[SET_RULE` {v1, v2, v3, v4} = {v2, v3, v4, v1}`; +SET_RULE` {v1, v2, v3} = {v2, v3,v1}`]);; + + + + +let ALL_ABOUT_COEF_3 = prove(` ! v1 v2 v3 v4 (v:real^3). + ~ coplanar {v1,v2,v3,v4} ==> + ( COEF4_3 v1 v2 v3 v4 v < &0 <=> v IN aff_lt {v2,v1, v4} {v3} ) /\ + ( COEF4_3 v1 v2 v3 v4 v = &0 <=> v IN aff {v2,v1,v4} ) /\ + ( COEF4_3 v1 v2 v3 v4 v > &0 <=> v IN aff_gt {v2,v1,v4} {v3} ) `, +SIMP_TAC[PER_COEF1_WITH_COEF3] THEN +ONCE_REWRITE_TAC[SET_RULE` {v2, v1, v4} = {v4,v1,v2} `] THEN +ONCE_REWRITE_TAC[SET_RULE` {v1, v4, v3, v2} = {v3,v4,v1,v2} `] THEN +SIMP_TAC[ALL_ABOUT_COEF_1]);; + +let SRGTIHY = prove(` ! v1 v2 v3 v4 (v:real^3). + ~ coplanar {v1,v2,v3,v4} ==> + ( COEF4_1 v1 v2 v3 v4 v < &0 <=> v IN aff_lt {v2,v3, v4} {v1} ) /\ + ( COEF4_1 v1 v2 v3 v4 v = &0 <=> v IN aff {v2,v3,v4} ) /\ + ( COEF4_1 v1 v2 v3 v4 v > &0 <=> v IN aff_gt {v2,v3,v4} {v1} ) /\ + ( COEF4_2 v1 v2 v3 v4 v < &0 <=> v IN aff_lt {v1,v3, v4} {v2} ) /\ + ( COEF4_2 v1 v2 v3 v4 v = &0 <=> v IN aff {v1,v3,v4} ) /\ + ( COEF4_2 v1 v2 v3 v4 v > &0 <=> v IN aff_gt {v1,v3,v4} {v2} ) /\ + ( COEF4_3 v1 v2 v3 v4 v < &0 <=> v IN aff_lt {v2,v1, v4} {v3} ) /\ + ( COEF4_3 v1 v2 v3 v4 v = &0 <=> v IN aff {v2,v1,v4} ) /\ + ( COEF4_3 v1 v2 v3 v4 v > &0 <=> v IN aff_gt {v2,v1,v4} {v3} )/\ + ( COEF4_4 v1 v2 v3 v4 v < &0 <=> v IN aff_lt {v2,v1, v3} {v4} ) /\ + ( COEF4_4 v1 v2 v3 v4 v = &0 <=> v IN aff {v2,v1,v3} ) /\ + ( COEF4_4 v1 v2 v3 v4 v > &0 <=> v IN aff_gt {v2,v1,v3} {v4} )`, +SIMP_TAC[ALL_ABOUT_COEF_1; ALL_ABOUT_COEF_2; ALL_ABOUT_COEF_3; + PER_COEF1_WITH_COEF4] THEN +ONCE_REWRITE_TAC[SET_RULE` {v2, v1, v3} = {v1,v2,v3}`] THEN +ONCE_REWRITE_TAC[SET_RULE` {v1, v3, v2, v4} = {v4,v1,v2,v3}`] THEN +SIMP_TAC[ALL_ABOUT_COEF_1]);; +let LEMMA77 = SRGTIHY;; + + + let CONV0_4 = prove + (`conv0 {v1, v2, v3, v4} = + {x:real^N | ?a b c d. + &0 < a /\ + &0 < b /\ + &0 < c /\ + &0 < d /\ + a + b + c + d = &1 /\ + a % v1 + b % v2 + c % v3 + d % v4 = x}`, + REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM] THEN X_GEN_TAC `y:real^N` THEN + REWRITE_TAC[conv0; affsign; sgn_gt; lin_combo; UNION_EMPTY] THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC + `?f. (!w:real^N. w IN {v1, v2, v3, v4} ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ + vsum {v1, v2, v3, v4} (\v. f v % v) = y` THEN + CONJ_TAC THENL [REWRITE_TAC[IN] THEN MESON_TAC[]; ALL_TAC] THEN + SIMP_TAC[AFFINE_HULL_FINITE_STEP_GEN; + REAL_ARITH `&0 < x /\ &0 < y ==> &0 < x + y`; + REAL_ARITH `&0 < x ==> &0 < x / &2`; + FINITE_INSERT; CONJUNCT1 FINITE_RULES; RIGHT_EXISTS_AND_THM] THEN + ASM_REWRITE_TAC[IN_ELIM_THM; + REAL_ARITH `x - y:real = z <=> x = y + z`; + VECTOR_ARITH `x - y:real^N = z <=> x = y + z`] THEN + REWRITE_TAC[VECTOR_ADD_RID; REAL_ADD_RID] THEN MESON_TAC[]);; + +(* ======================= *) +(* LEMMA 81 *) +(* ======================= *) + +let ARIKWRQ = prove(`! v1 v2 v3 (v4:real^3). + let s = {v1,v2,v3,v4} in + CARD s = 4 /\ ~ coplanar s ==> + conv s = aff_ge ( s DIFF {v1} ) {v1} INTER + aff_ge ( s DIFF {v2} ) {v2} INTER + aff_ge ( s DIFF {v3} ) {v3} INTER + aff_ge ( s DIFF {v4} ) {v4} `, LET_TR THEN +SIMP_TAC[CARD4; SET_RULE ` ~(v1 IN {v2, v3, v4}) /\ ~(v2 = v3 \/ v3 = v4 \/ v4 = v2) + ==> {v1, v2, v3, v4} DIFF {v1} = {v2,v3,v4} /\ + {v1, v2, v3, v4} DIFF {v2} = {v3,v4,v1} /\ + {v1, v2, v3, v4} DIFF {v3} = {v4,v1,v2} /\ + {v1, v2, v3, v4} DIFF {v4} = {v1,v2,v3} `] THEN +REWRITE_TAC[CARD4; IN_SET3;DE_MORGAN_THM] THEN +SIMP_TAC[AFF_GES_GTS] THEN +REWRITE_TAC[CONVEX_HULL_4_EQUIV] THEN +REPEAT STRIP_TAC THEN +REWRITE_TAC[SET_RULE ` a = b <=> (! x. x IN a <=> x IN b ) `; + IN_INTER; IN_ELIM_THM] THEN +GEN_TAC THEN EQ_TAC THENL [ +ASM_MESON_TAC[REAL_ARITH` a + b + c + d = d + a + b + c `; + VECTOR_ARITH` (a:real^N) + b + c + d = d + a + b + c `]; +FIRST_X_ASSUM MP_TAC ] THEN +NHANH (SPEC ` x: real^3` (GEN ` v:real^3` (SPEC_ALL COEFS_4))) THEN +ABBREV_TAC ` aa = COEF4_1 v1 v2 v3 v4 x ` THEN +ABBREV_TAC ` bb = COEF4_2 v1 v2 v3 v4 x ` THEN +ABBREV_TAC ` cc = COEF4_3 v1 v2 v3 v4 x ` THEN +ABBREV_TAC ` dd = COEF4_4 v1 v2 v3 v4 x ` THEN +REWRITE_TAC[MESON[]` a ==> b ==> c <=> a /\ b ==> c `] THEN PHA THEN +NHANH (MESON[REAL_ARITH` a + b + c + d = d + a + b + c `; + VECTOR_ARITH` (a:real^N) + b + c + d = d + a + b + c `]` +aa + bb + cc + dd = &1 /\ + x = aa % v1 + bb % v2 + cc % v3 + dd % v4 /\ + (!ta tb tc td. + x = ta % v1 + tb % v2 + tc % v3 + td % v4 /\ ta + tb + tc + td = &1 + ==> ta = aa /\ tb = bb /\ tc = cc /\ td = dd) /\ + (?ta tb tc t. + &0 <= t /\ + ta + tb + tc + t = &1 /\ + x = ta % v2 + tb % v3 + tc % v4 + t % v1) /\ + (?ta tb tc t. + &0 <= t /\ + ta + tb + tc + t = &1 /\ + x = ta % v3 + tb % v4 + tc % v1 + t % v2) /\ + (?ta tb tc t. + &0 <= t /\ + ta + tb + tc + t = &1 /\ + x = ta % v4 + tb % v1 + tc % v2 + t % v3) /\ + (?ta tb tc t. + &0 <= t /\ + ta + tb + tc + t = &1 /\ + x = ta % v1 + tb % v2 + tc % v3 + t % v4) + ==> &0 <= aa /\ &0 <= bb /\ &0 <= cc /\ &0 <= dd`) THEN +MATCH_MP_TAC (MESON[]` ( a1 /\ a2 /\ a3 ==> l) ==> + aa /\ ( a1 /\ a2 /\ a4 ) /\ a3 ==> l `) THEN MESON_TAC[]);; + + + + + +(* ================ *) +(* LEMMA 82 *) +(* ================= *) + + + + +let MXHKOXR = prove(`! v1 v2 v3 (v4:real^3). let s = {v1,v2,v3,v4} in + CARD s = 4 /\ ~ coplanar s ==> + conv0 s = aff_gt ( s DIFF {v1} ) {v1} INTER + aff_gt ( s DIFF {v2} ) {v2} INTER + aff_gt ( s DIFF {v3} ) {v3} INTER + aff_gt ( s DIFF {v4} ) {v4} `, LET_TR THEN +SIMP_TAC[CARD4; SET_RULE ` ~(v1 IN {v2, v3, v4}) /\ ~(v2 = v3 \/ v3 = v4 \/ v4 = v2) + ==> {v1, v2, v3, v4} DIFF {v1} = {v2,v3,v4} /\ + {v1, v2, v3, v4} DIFF {v2} = {v3,v4,v1} /\ + {v1, v2, v3, v4} DIFF {v3} = {v4,v1,v2} /\ + {v1, v2, v3, v4} DIFF {v4} = {v1,v2,v3} `] THEN +REWRITE_TAC[CARD4; IN_SET3;DE_MORGAN_THM] THEN +SIMP_TAC[AFF_GES_GTS; CONV0_4 ] THEN +REPEAT STRIP_TAC THEN +REWRITE_TAC[SET_RULE ` a = b <=> (! x. x IN a <=> x IN b ) `; + IN_INTER; IN_ELIM_THM] THEN +GEN_TAC THEN EQ_TAC THENL [ +ASM_MESON_TAC[REAL_ARITH` a + b + c + d = d + a + b + c `; + VECTOR_ARITH` (a:real^N) + b + c + d = d + a + b + c `]; +FIRST_X_ASSUM MP_TAC ] THEN +NHANH (SPEC ` x: real^3` (GEN ` v:real^3` (SPEC_ALL COEFS_4))) THEN +ABBREV_TAC ` aa = COEF4_1 v1 v2 v3 v4 x ` THEN +ABBREV_TAC ` bb = COEF4_2 v1 v2 v3 v4 x ` THEN +ABBREV_TAC ` cc = COEF4_3 v1 v2 v3 v4 x ` THEN +ABBREV_TAC ` dd = COEF4_4 v1 v2 v3 v4 x ` THEN +REWRITE_TAC[MESON[]` a ==> b ==> c <=> a /\ b ==> c `] THEN PHA THEN +NHANH (MESON[REAL_ARITH` a + b + c + d = d + a + b + c `; + VECTOR_ARITH` (a:real^N) + b + c + d = d + a + b + c `]` +aa + bb + cc + dd = &1 /\ + x = aa % v1 + bb % v2 + cc % v3 + dd % v4 /\ + (!ta tb tc td. + x = ta % v1 + tb % v2 + tc % v3 + td % v4 /\ ta + tb + tc + td = &1 + ==> ta = aa /\ tb = bb /\ tc = cc /\ td = dd) /\ + (?ta tb tc t. + &0 < t /\ + ta + tb + tc + t = &1 /\ + x = ta % v2 + tb % v3 + tc % v4 + t % v1) /\ + (?ta tb tc t. + &0 < t /\ + ta + tb + tc + t = &1 /\ + x = ta % v3 + tb % v4 + tc % v1 + t % v2) /\ + (?ta tb tc t. + &0 < t /\ + ta + tb + tc + t = &1 /\ + x = ta % v4 + tb % v1 + tc % v2 + t % v3) /\ + (?ta tb tc t. + &0 < t /\ + ta + tb + tc + t = &1 /\ + x = ta % v1 + tb % v2 + tc % v3 + t % v4) +==> &0 < aa /\ &0 < bb /\ &0 < cc /\ &0 < dd `) THEN +MATCH_MP_TAC (MESON[]` ( a1 /\ a2 /\ a3 ==> l) ==> + aa /\ ( a1 /\ a2 /\ a4 ) /\ a3 ==> l `) THEN MESON_TAC[]);; + + + let CONV0_4 = prove + (`conv0 {v1, v2, v3, v4} = + {x:real^N | ?a b c d. + &0 < a /\ + &0 < b /\ + &0 < c /\ + &0 < d /\ + a + b + c + d = &1 /\ + a % v1 + b % v2 + c % v3 + d % v4 = x}`, + REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM] THEN X_GEN_TAC `y:real^N` THEN + REWRITE_TAC[conv0; affsign; sgn_gt; lin_combo; UNION_EMPTY] THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC + `?f. (!w:real^N. w IN {v1, v2, v3, v4} ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ + vsum {v1, v2, v3, v4} (\v. f v % v) = y` THEN + CONJ_TAC THENL [REWRITE_TAC[IN] THEN MESON_TAC[]; ALL_TAC] THEN + SIMP_TAC[AFFINE_HULL_FINITE_STEP_GEN; + REAL_ARITH `&0 < x /\ &0 < y ==> &0 < x + y`; + REAL_ARITH `&0 < x ==> &0 < x / &2`; + FINITE_INSERT; CONJUNCT1 FINITE_RULES; RIGHT_EXISTS_AND_THM] THEN + ASM_REWRITE_TAC[IN_ELIM_THM; + REAL_ARITH `x - y:real = z <=> x = y + z`; + VECTOR_ARITH `x - y:real^N = z <=> x = y + z`] THEN + REWRITE_TAC[VECTOR_ADD_RID; REAL_ADD_RID] THEN MESON_TAC[]);; + + +let CONV0_4POINTS = CONV0_4;; + + + +(* ================== *) +(* LEMMA 78 *) + +(* ================== *) + + +let ZRFMKPY = prove(` ! v1 v2 v3 v4 (v:real^3). + ~coplanar {v1, v2, v3, v4} + ==> (v IN conv {v1, v2, v3, v4} <=> + &0 <= COEF4_1 v1 v2 v3 v4 v /\ + &0 <= COEF4_2 v1 v2 v3 v4 v /\ + &0 <= COEF4_3 v1 v2 v3 v4 v /\ + &0 <= COEF4_4 v1 v2 v3 v4 v) /\ + (v IN conv0 {v1, v2, v3, v4} <=> + &0 < COEF4_1 v1 v2 v3 v4 v /\ + &0 < COEF4_2 v1 v2 v3 v4 v /\ + &0 < COEF4_3 v1 v2 v3 v4 v /\ + &0 < COEF4_4 v1 v2 v3 v4 v) `, +NHANH (SPEC_ALL COEFS_4) THEN REWRITE_TAC[CONVEX_HULL_4_EQUIV; +CONV0_4POINTS; IN_ELIM_THM] THEN MESON_TAC[]);; + +let LEMMA78 = ZRFMKPY;; + + + +(* APRIL WORKS *) +(* =========== *) +(* NGUYEN QUANG TRUONG *) +let IMP_TAC = IMP_IMP_TAC;; + + + +let QUAANG_TRUOONN = prove(` ! v0 v1 v2 v3 (v4:real^N). + CARD {v0, v1, v2, v3, v4} = 5 /\ + (?x. ~(x = v0) /\ x IN cone v0 {v1, v3} INTER cone v0 {v2, v4}) + ==> ~(conv {v1, v3} INTER cone v0 {v2, v4} = {})`, +REWRITE_TAC[CONV_SET2; cone; CARD5; SET_RULE ` a INTER b = {} <=> + ~ (? x. a x /\ b x ) `; GSYM aff_ge_def; IN; IN_INTER] THEN +NHANH (SET_RULE ` ~{v1, v2, v3, v4} v0 ==> + ~ ( v0 = v1 \/ v0 = v3 ) /\ ~ ( v0 = v2 \/ v0 = v4 ) `) THEN +ONCE_REWRITE_TAC[MESON[]` a /\ b ==> c <=> a ==> b ==> c `] THEN +SIMP_TAC[AFF_GE_12] THEN REWRITE_TAC[DE_MORGAN_THM] THEN +REWRITE_TAC[IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN +UNDISCH_TAC ` (x:real^N) = tv % v0 + ta % v1 + tb % v3` THEN +UNDISCH_TAC ` (x:real^N) = tv' % v0 + ta' % v2 + tb' % v4` THEN +REWRITE_TAC[MESON[]` x = a + ==> x = (b:real^N) ==> c <=> x = a /\ a = b ==> c `] THEN +REWRITE_TAC[VECTOR_ARITH` a % v + d = b % v + e <=> + ( a - b ) % v + d = e `] THEN +ASM_CASES_TAC ` &0 < ta + tb ` THENL [DOWN_TAC THEN +REWRITE_TAC[MESON[VECTOR_MUL_LCANCEL; REAL_FIELD ` &0 < a ==> ~ ( &1 / a = &0 )`]` + &0 < ta + tb /\ aaa /\ + aa = ta % v1 + tb % v3 <=> &0 < ta + tb /\ aaa /\ + &1 / ( ta + tb ) % aa = &1 / ( ta + tb ) % ( ta % v1 + tb % v3) `] THEN +REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; REAL_ARITH ` + &1 / a * b = b / a `] THEN STRIP_TAC THEN DOWN_TAC THEN +NHANH (MESON[REAL_LE_RDIV_0]`&0 <= ta /\ &0 <= tb /\ a1 /\ &0 <= ta' /\ + &0 <= tb' /\ a2 /\ + &0 < ta + tb /\ a3 ==> &0 <= ta / (ta + tb) /\ &0 <= tb / (ta + tb) /\ + &0 <= ta' / (ta + tb) /\ &0 <= tb' / (ta + tb) `) THEN ASM_MESON_TAC[ +REAL_FIELD` tv + ta + tb = &1 /\ tv' + ta' + tb' = &1 /\ + &0 < ta + tb ==> (tv' - tv) / (ta + tb) + ta' / (ta + tb) + + tb' / (ta + tb) = &1 /\ ta / ( ta + tb ) + tb / ( ta + tb ) = &1`]; +DOWN_TAC THEN +NHANH (MESON[REAL_ARITH` &0 <= a /\ &0 <= b /\ ~( &0 < a + b ) +==> a = &0 /\ b = &0 `]`&0 <= ta /\ &0 <= tb /\a1/\a2 /\a3/\a4 /\ + ~(&0 < ta + tb) /\ a5 ==> ta = &0 /\ tb = &0`) THEN +PURE_ONCE_REWRITE_TAC[MESON[]` P ta tb /\ ta = &0 /\ tb = &0 + <=> P ( &0 ) ( &0 ) /\ ta = &0 /\ tb = &0 `] THEN +REWRITE_TAC[ZERO_NEUTRAL; VECTOR_MUL_LZERO; VECTOR_ADD_LID] THEN +REWRITE_TAC[VECTOR_ARITH` (tv' - tv) % v + a = vec 0 <=> tv' % v + a + = tv % v `; MESON[]` a = b /\ b = c <=> a = c /\ b = c `] THEN +MESON_TAC[VECTOR_ARITH ` &1 % v = v `]]);; + +(* le 80. p 51 *) +(* ================ *) + +let JVDAFRS = prove(` ! v0 v1 v2 v3 (v4:real^N). + CARD {v0, v1, v2, v3, v4} = 5 /\ + (?x. ~(x = v0) /\ x IN cone v0 {v1, v3} INTER cone v0 {v2, v4}) + ==> ~(conv {v1, v3} INTER cone v0 {v2, v4} = {} /\ + conv {v2, v4} INTER cone v0 {v1, v3} = {})`, MESON_TAC[QUAANG_TRUOONN]);; + +(* LEMMA 22 *) +(* =========================== *) + +let SQRT8_POS = MESON[REAL_ARITH ` &0 < &8 `; SQRT_POS_LT]` &0 < sqrt (&8) `;; + +let SQRT8_LT_4_45 = prove(` sqrt8 < #4.45 `, +SIMP_TAC[sqrt8; REAL_ARITH ` &0 < #4.45 `; MESON[REAL_ARITH ` &0 < &8 `; +SQRT_POS_LT]` &0 < sqrt (&8) `; LT_POW2_EQ_LT; SQRT8_POW2] THEN REAL_ARITH_TAC);; + + +let PROVE_NOT_COLLINEAR = prove(` ! v0 v1 (v2:real^3). + &2 <= d3 v0 v1 /\ + d3 v0 v1 <= #2.51 /\ + #2.45 <= d3 v1 v2 /\ + d3 v1 v2 <= #2.51 /\ + #2.77 <= d3 v0 v2 /\ + d3 v0 v2 <= sqrt8 + ==> ~ collinear {v0, v1, v2}`, +REWRITE_TAC[COLLINEAR_AS_IN_CONV2; MID_COND; d3; LENGTH_EQ_EX; DE_MORGAN_THM] THEN +SIMP_TAC[DIST_SYM] THEN +REPEAT GEN_TAC THEN +ABBREV_TAC ` a = dist(v0,v1:real^3)` THEN +ABBREV_TAC ` b = dist(v0,v2:real^3)` THEN +ABBREV_TAC ` c = dist(v1,v2:real^3)` THEN +MP_TAC SQRT8_LT_4_45 THEN +REAL_ARITH_TAC);; + + + +let BPOW8APOW2CPOW2 = prove(`&2 <= a /\ + a <= #2.51 /\ + #2.45 <= c /\ + c <= #2.51 /\ + #2.77 <= b /\ + b <= sqrt8 +==> b pow 2 <= &8 /\ a pow 2 <= #2.51 pow 2 /\ c pow 2 <= #2.51 pow 2 `, +REWRITE_TAC[MESON[]` a1 /\ a2 /\a3 /\a4 /\a5 /\a6 ==> l <=> + a1 /\a3 /\a5 ==> a2 /\a4 /\a6 ==> l `] THEN +NHANH (REAL_ARITH`&2 <= a /\ #2.45 <= c /\ #2.77 <= b ==> + &0 < a /\ &0 < b /\ &0 < c /\ &0 < #2.51 `) THEN +SIMP_TAC[sqrt8; POW2_COND_LT; SQRT8_POS; SQRT8_POW2]);; + + +let IMP_PRE_LE_19 = prove(`&2 <= a /\ + a <= #2.51 /\ + #2.45 <= c /\ + c <= #2.51 /\ + #2.77 <= b /\ + b <= sqrt8 + ==> &0 < &2 /\ + &2 <= a /\ + &0 < #2.77 /\ + #2.77 <= b /\ + &0 < #2.45 /\ + #2.45 <= c /\ + a pow 2 <= #2.77 pow 2 + #2.45 pow 2 /\ + b pow 2 <= &2 pow 2 + #2.45 pow 2 /\ + c pow 2 <= &2 pow 2 + #2.77 pow 2 `, +CONV_TAC REAL_RAT_REDUCE_CONV THEN NHANH (BPOW8APOW2CPOW2 ) THEN REAL_ARITH_TAC);; + + + +let ZEDIDCF = prove(` ! v0 v1 (v2:real^3). + &2 <= d3 v0 v1 /\ + d3 v0 v1 <= #2.51 /\ + #2.45 <= d3 v1 v2 /\ + d3 v1 v2 <= #2.51 /\ + #2.77 <= d3 v0 v2 /\ + d3 v0 v2 <= sqrt8 + ==> sqrt2 < radV {v0, v1, v2}`, +NHANH (SPEC_ALL PROVE_NOT_COLLINEAR) THEN +SIMP_TAC[RADV_FORMULAR] THEN REPEAT GEN_TAC THEN +SIMP_TAC[d3; DIST_SYM] THEN +ABBREV_TAC ` a = dist(v0,v1:real^3)` THEN +ABBREV_TAC ` b = dist(v0,v2:real^3)` THEN +ABBREV_TAC ` c = dist(v1,v2:real^3)` THEN +NHANH (IMP_PRE_LE_19 ) THEN NHANH (SPEC_ALL BYOWBDF) THEN +SIMP_TAC[ETA_Y_SYYM] THEN STRIP_TAC THEN +UNDISCH_TAC ` eta_y #2.77 #2.45 (&2) <= eta_y a b c ` THEN +ABBREV_TAC ` l = eta_y a b c ` THEN +REWRITE_TAC[eta_y; eta_x; ups_x; sqrt2] THEN LET_TR THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +MP_TAC (prove(` sqrt (&2) < sqrt (&93993025 / &46231104) `, +SIMP_TAC[SQRT_WORKS; REAL_ARITH ` &0 <= &2 /\ + &0 <= &93993025 / &46231104 `; LT_POW2_COND] THEN REAL_ARITH_TAC)) +THEN REAL_ARITH_TAC);; + + +(* ==================== *) + +let condC = new_definition ` condC M13 m12 m14 M24 m34 (m23:real) = + ((! x. x IN {M13, m12, m14, M24, m34, m23 } ==> &0 <= x ) /\ + M13 <= m12 + m23 /\ + M13 <= m14 + m34 /\ + M24 < m12 + m14 /\ + M24 < m23 + m34 /\ + &0 <= delta (M13 pow 2) (m12 pow 2) (m14 pow 2) (M24 pow 2) (m34 pow 2 ) + (m23 pow 2 ) )`;; + + +let CXWOCGN = new_axiom` !M13 m12 m14 M24 m34 m23 (v1:real^3) v2 v3 v4. + condC M13 m12 m14 M24 m34 m23 /\ + CARD {v1,v2,v3,v4} = 4 /\ + m12 <= d3 v1 v2 /\ + m23 <= d3 v2 v3 /\ + m34 <= d3 v3 v4 /\ + m14 <= d3 v1 v4 /\ + d3 v1 v3 < M13 /\ + d3 v2 v4 <= M24 ==> + conv {v1,v3} INTER conv {v2,v4} = {} `;; +SPECL [` sqrt (&8 ) `; ` &2 `; ` &2 `; ` sqrt (&8) `; ` &2 `; + ` &2 `; ` u :real^3 `; ` w : real^3 `; ` v :real^3 `; ` u + v - ( w:real^3 )`] CXWOCGN;; + + +g ` a < sqrt (&8) ==> ~ ( &2 <= &1 / &2 * a ) `;; +e (ASM_CASES_TAC ` &0 <= a `);; +e (UNDISCH_TAC `&0 <= a `);; +e (SIMP_TAC[REAL_LT_IMP_LE; SQRT8_POS; LT_POW2_COND; REAL_ARITH ` + &2 <= &1 / &2 * a <=> &4 <= a `; REAL_ARITH` &0 <= &4 `; + POW2_COND; SQRT8_POW2]);; +e (REAL_ARITH_TAC);; +e (FIRST_X_ASSUM MP_TAC);; +e (REAL_ARITH_TAC);; +let LT_SQ8_IMP_LT2 = top_thm();; + + + +let LE_FOR_LEMMA36 = prove(`(CARD {u, v, w} = 3 /\ packing {u, v, w} /\ dist (u,v) < sqrt8) /\ + ~(dist (u,v) / &2 < dist (w,&1 / &2 % (u + v))) ==> + condC (sqrt (&8)) (&2) (&2) (sqrt (&8)) (&2) (&2) /\ + CARD {u, w, v, u + v - w} = 4 /\ + &2 <= d3 u w /\ + &2 <= d3 w v /\ + &2 <= d3 v (u + v - w) /\ + &2 <= d3 u (u + v - w) /\ + d3 u v < sqrt (&8) /\ + d3 w (u + v - w) <= sqrt (&8) `, +REWRITE_TAC[condC; delta; SQRT8_POW2] THEN +REWRITE_TAC[SET_RULE ` (! x. x IN ( a INSERT b ) ==> p x ) <=> + p a /\ (! x. x IN b ==> p x ) `; NOT_IN_EMPTY] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +SIMP_TAC[SQRT8_POS; REAL_LT_IMP_LE; d3; sqrt8; packing] THEN +SIMP_TAC[REAL_LT_IMP_LE; SQRT8_POS; LT_POW2_COND; + REAL_ARITH ` &0 <= &4 `; POW2_COND; SQRT8_POW2] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +REWRITE_TAC[NORM_ARITH` dist (v,u + v - w) = dist (u,w) /\ + dist (u,u + v - w) = dist (v,w) /\ + dist (w,u + v - w) = &2 * dist (w,&1 / &2 % (u + v)) `] THEN +STRIP_TAC THEN CONJ_TAC THENL [ +UNDISCH_TAC `CARD {(u:real^3), v, w} = 3` THEN +REWRITE_TAC[CARD3; CARD4; IN_SET3] THEN +REWRITE_TAC[DE_MORGAN_THM] THEN DAO THEN +STRIP_TAC THEN CONJ_TAC THENL [ +NHANH (NORM_ARITH`u + v - w = w ==> dist (w,u) = &1 / &2 * dist (u,v) `) THEN +UNDISCH_TAC `dist ((u:real^3),v) < sqrt (&8)` THEN + NHANH (LT_SQ8_IMP_LT2 ) THEN DOWN_TAC THEN SET_TAC[]; +REWRITE_TAC[VECTOR_ARITH ` ((v:real^N) = u + v - w <=> u = w )`; + VECTOR_ARITH ` ((u:real^N) = u + v - w <=> v = w ) `] THEN ASM_MESON_TAC[]]; +DAO THEN CONJ_TAC THENL [REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN +REAL_ARITH_TAC;DOWN_TAC THEN REWRITE_TAC[CARD3] THEN SET_TAC[]]]);; +let MIDDLE_POINT_IN_CONV2 = prove(` &1 / &2 % ( u + v ) IN conv {u,v} `, +REWRITE_TAC[CONV_SET2; IN_ELIM_THM; VECTOR_ADD_LDISTRIB] THEN +MESON_TAC[REAL_ARITH ` &0 <= &1 / &2 `; REAL_ARITH` &1 / &2 + &1 / &2 = &1 `]);; + +let INTER_DISJONT_EX = +SET_RULE ` ( a INTER b = {} ) <=> (! x. ~ (x IN a /\ x IN b )) `;; + + +(* LEMMA36 *) + +(* ================== *) +let ZZSBSIO = prove(` ! (u:real^3) v w. CARD {u,v,w} = 3 /\ packing {u,v,w} /\ + dist (u,v) < sqrt8 ==> dist (u,v) / &2 < dist (w, &1 / &2 % ( u + v )) `, +REWRITE_TAC[MESON[]` a ==> b <=> ~ ( a /\ ~ b ) `] THEN +NHANH (LE_FOR_LEMMA36) THEN +NHANH (SPEC_ALL CXWOCGN) THEN +REPEAT STRIP_TAC THEN +FIRST_X_ASSUM MP_TAC THEN +REWRITE_TAC[INTER_DISJONT_EX] THEN +MESON_TAC[MIDDLE_POINT_IN_CONV2 ; VECTOR_ARITH ` + u + v = w + u + v - (w:real^N) `]);; + + + + +MATCH_MP (SPEC_ALL AFFINE_HULL_FINITE) (MESON[FINITE_RULES] ` FINITE {(a:real^N),b,c} `) ;; + + + +let PLANE_IMP_AFFINE = prove(`plane (p:real^N -> bool ) ==> affine p `, +MESON_TAC[plane; AFFINE_AFFINE_HULL]);; + + +let AFFINE = new_axiom `!V:real^N->bool. + affine V <=> + !(s:real^N->bool) (u:real^N->real). + FINITE s /\ ~(s = {}) /\ s SUBSET V /\ sum s u = &1 + ==> vsum s (\x. u x % x) IN V`;; + + +let PLANE_IMP_AFFINE = prove(` plane (p:real^N -> bool ) ==> affine p `, +REWRITE_TAC[plane; AFFINE_HULL_3; affine; FUN_EQ_THM; IN_ELIM_THM] THEN +STRIP_TAC THEN ASM_SIMP_TAC[IN] THEN REPEAT STRIP_TAC THEN ASM_SIMP_TAC[] THEN +SIMP_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC] THEN +REWRITE_TAC[VECTOR_ARITH` (( a:real^N) + b + c ) + a' + b' + c' + = ( a + a' ) + ( b + b') + c + c' `] THEN EXISTS_TAC ` u' * u'' + v' * u''' ` THEN +EXISTS_TAC ` (u' * v'' + v' * v''')` THEN EXISTS_TAC ` (u' * w' + v' * w'')` THEN +ASM_SIMP_TAC[prove(` u' + v' = &1 /\ + u''' + v''' + w'' = &1 /\ + u'' + v'' + w' = &1 ==> + (u' * u'' + v' * u''') + (u' * v'' + v' * v''') + u' * w' + v' * w'' = &1 `, +SIMP_TAC[REAL_ARITH` a + b = &1 <=> a = &1 - b `] THEN REAL_ARITH_TAC); + GSYM VECTOR_ADD_RDISTRIB]);; + + + + +let IMP_AFFINE_HULL_SUBSET = prove(` FINITE a /\ a SUBSET s /\ +~( a = {} )/\ affine s ==> ( affine hull a ) SUBSET s `, +SIMP_TAC[AFFINE_HULL_FINITE; SUBSET; IN_ELIM_THM] THEN +REWRITE_TAC[ GSYM SUBSET] THEN MESON_TAC[AFFINE]);; + + + +let SET_EQ_EX = SET_RULE `a = b <=> (! x. x IN a <=> x IN b ) `;; +let SET_EQ_TO_SUBSET = SET_RULE ` a = b <=> a SUBSET b /\ b SUBSET a `;; + + + + +let OTHORGONAL_QUATER_FOR = prove(` delta x12 ( x12 + x23 ) ( x12 + x24 ) x23 x24 x34 = + x12 * ups_x x23 x24 x34 `, REWRITE_TAC[delta; ups_x] THEN REAL_ARITH_TAC);; + + +let ORTHOGONAL_CROSS_PRODUCT = prove(` u dot ( cross u v ) = &0 /\ + v dot ( cross u v ) = &0 `, +REWRITE_TAC[cross; triple_of_real3; real3_of_triple; mk_vec3] THEN +LET_TR THEN REWRITE_TAC[DOT_3; VECTOR_3] THEN REAL_ARITH_TAC);; + + + +let PITHAGOR_CROSS = prove(` dist (a + cross (b - a) (c - a),b) pow 2 = +dist (b,a) pow 2 + norm ( cross (b - a) (c - a) ) pow 2 `, +REWRITE_TAC[vector_norm; dist] THEN +SIMP_TAC[DOT_POS_LE; SQRT_WORKS] THEN +REWRITE_TAC[VECTOR_ARITH` ((a:real^N) + b) - c = b - (c - a ) `] THEN +ABBREV_TAC ` ab = ( b - (a:real^3)) ` THEN +ABBREV_TAC ` ac = ( c - (a:real^3)) ` THEN +REWRITE_TAC[DOT_LSUB; DOT_RSUB] THEN +SIMP_TAC[ORTHOGONAL_CROSS_PRODUCT; DOT_SYM] THEN +REAL_ARITH_TAC);; + + +let PITHAGOR_NORM = prove(` a dot b = &0 ==> dist (a,b) pow 2 = norm a pow 2 + + norm b pow 2 `, +SIMP_TAC[dist; vector_norm; DOT_POS_LE; SQRT_WORKS] THEN +SIMP_TAC[DOT_LSUB; DOT_RSUB; DOT_SYM] THEN REAL_ARITH_TAC);; + + + + + + + + + +prove(` dist ( cross a b, a ) pow 2 = norm (cross a b) pow 2 + + norm a pow 2 /\dist ( cross a b, b ) pow 2 = norm (cross a b) pow 2 + + norm b pow 2 `, +SIMP_TAC[DOT_SYM;ORTHOGONAL_CROSS_PRODUCT ; PITHAGOR_NORM; DIST_SYM]);; + + + + + + + + +let VEC3_EQ_EX= prove(`! a (b:real^3). a = b <=> a$1 = b$1 /\ a$2 = b$2 /\ a$3 = b$3 `, +SIMP_TAC[CART_EQ; DIMINDEX_3] THEN +REWRITE_TAC[ARITH_RULE`1 <= i /\ i <= 3 <=> + i = 1 \/ i = 2 \/ i = 3 `] THEN MESON_TAC[]);; + + +g ` cross (b - a) (c - d) = cross (a - b) (d - c )`;; +e (REWRITE_TAC[cross; triple_of_real3; real3_of_triple; mk_vec3]);; +e (LET_TR);; +e (REWRITE_TAC[lemma_cm3 ]);; +e (REWRITE_TAC[VEC3_EQ_EX]);; +e (REWRITE_TAC[VEC3_EQ_EX; VECTOR_3]);; +e (REAL_ARITH_TAC);; +let CROSS_CONVERT = top_thm();; + + + +g ` &4 * norm (cross (b - a) (c - a)) pow 2 = + ups_x (dist (a,b) pow 2) (dist (a,c) pow 2) (dist (b,c) pow 2)`;; +e (REWRITE_TAC[MESON[ +prove(` dist(b,c) pow 2 = (a - c - (a - b)) dot (a - c - (a - b)) `, +SIMP_TAC[dist; vector_norm; DOT_POS_LE; SQRT_WORKS] THEN +MESON_TAC[VECTOR_ARITH` b - (c:real^N) = (a - c) - ( a - b) `])]` + ups_x aa bb (dist (b,c) pow 2 ) = + ups_x aa bb (( a - c - (a - b)) dot (a - c - (a - b))) `]);; +e (ONCE_REWRITE_TAC[CROSS_CONVERT]);; +e (SIMP_TAC[ups_x;DIST_SYM; dist; vector_norm; DOT_POS_LE; SQRT_WORKS]);; +e (REWRITE_TAC[cross; triple_of_real3; real3_of_triple; mk_vec3]);; +e (LET_TR);; +e (REWRITE_TAC[DOT_3; VECTOR_3]);; +e (ABBREV_TAC ` ab = a - (b:real^3) `);; +e (ABBREV_TAC ` cc = a - (c:real^3) `);; +e (REWRITE_TAC[lemma_cm3 ] THEN REAL_ARITH_TAC);; + +let NORM_CROSS_PRODUCT_UPS_X = top_thm();; + + +g ` ! u v (w:real^3). ~ collinear {a,b,c} ==> ~ coplanar { + a + cross (b - a ) ( c - a ),a,b,c} `;; +e (MP_TAC POLFLZY);; +e (LET_TR);; +e (SIMP_TAC[]);; +e (DISCH_TAC);; +e (REWRITE_TAC[NORM_ARITH` dist (a + b ,a) = norm (b ) `]);; +e (REWRITE_TAC[NORM_ARITH`dist (a + c,b) = + dist ( c, b - a ) `]);; +e (SIMP_TAC[prove(` dist ( cross a b, a ) pow 2 = norm (cross a b) pow 2 + + norm a pow 2 /\dist ( cross a b, b ) pow 2 = norm (cross a b) pow 2 + + norm b pow 2 `, +SIMP_TAC[DOT_SYM;ORTHOGONAL_CROSS_PRODUCT ; PITHAGOR_NORM; DIST_SYM])]);; +e (REWRITE_TAC[GSYM dist]);; +e (SIMP_TAC[DIST_SYM; OTHORGONAL_QUATER_FOR]);; +e (ONCE_REWRITE_TAC[REAL_ARITH` a * b = &0 <=> ( &4 * a ) * b = &0 `]);; +e (SIMP_TAC[NORM_CROSS_PRODUCT_UPS_X]);; +e (REWRITE_TAC[REAL_ENTIRE]);; +e (MESON_TAC[FHFMKIY]);; +let NOT_COLLINEAR_IMP_CROSS_NOT_COPLANAR = top_thm();; + + + + +let ORTHOGONAL_IMP_PITHAGOR = prove(` (x:real^N) dot ((a:real^N) - b) = &0 ==> + dist (a + x,b) pow 2 = norm x pow 2 + dist (a,b) pow 2`, +SIMP_TAC[dist; vector_norm; DOT_POS_LE; SQRT_WORKS] THEN +REWRITE_TAC[VECTOR_ARITH` (a + c) - b = c + a - (b:real^N)`] THEN +ABBREV_TAC ` aa = ( a - (b:real^N)) ` THEN +SIMP_TAC[DOT_LADD; DOT_RADD; DOT_SYM; ZERO_NEUTRAL]);; + + + +let NOT_COL_AND_ORTHO_IMP_NOT_COPL = prove(`! a b c (x:real^3). + ~collinear {a, b, c} /\ x dot (a - b) = &0 /\ + x dot (a - c) = &0 /\ ~(x = vec 0) + ==> ~coplanar {a + x, a, b, c}`, +MP_TAC POLFLZY THEN LET_TR THEN SIMP_TAC[] THEN +SIMP_TAC[ORTHOGONAL_IMP_PITHAGOR ] THEN +SIMP_TAC[ORTHOGONAL_IMP_PITHAGOR; NORM_ARITH ` dist (a + x,a) = norm x `] THEN +SIMP_TAC[ORTHOGONAL_IMP_PITHAGOR; NORM_ARITH ` dist (a + x,a) = norm x `; +OTHORGONAL_QUATER_FOR] THEN SIMP_TAC[COL_EQ_UPS_0] THEN +SIMP_TAC[COL_EQ_UPS_0; GSYM NORM_POS_LT; REAL_ENTIRE; MESON[RELATE_POW2]` + a pow 2 = &0 <=> a = &0 `; REAL_ARITH ` &0 < a ==> ~( a = &0 ) `]);; + + + + + +let PLANE_NORM_IMP_AFFINE = prove(`! p. plane_norm p ==> affine p `, +REWRITE_TAC[plane_norm; affine] THEN GEN_TAC THEN STRIP_TAC THEN +ASM_SIMP_TAC[IN_ELIM_THM; MESON[]` a = &1 <=> &1 = a `] THEN +ONCE_REWRITE_TAC[ VECTOR_ARITH ` ( a + b ) - c = ( a + b ) - &1 % c `] THEN +ASM_SIMP_TAC[ VECTOR_ARITH` (u % x + v % y) - (u + v) % v0 = +u % ( x - v0 ) + v % ( y - v0 ) `; DOT_RADD; DOT_RMUL; ZERO_NEUTRAL]);; + + + + +let IN_PLANE_IMP_OTHORGONAL = prove(` + n dot (x - v0) = &0 /\ n dot (y - v0) = &0 /\ n dot (z - v0) = &0 ==> + n dot ( x - y ) = &0 /\ n dot ( x - z ) = &0 `, +SIMP_TAC[DOT_RSUB] THEN REAL_ARITH_TAC);; + + + + + g `(n:real^N) dot (x - v0) = &0 /\ + n dot (y - v0) = &0 /\ + n dot (z - v0) = &0 /\ + ~(n = vec 0) /\ + x' = a1 % (x + n) + a2 % x + a3 % y + a4 % z /\ + a1 + a2 + a3 + a4 = &1 /\ + n dot (x' - v0) = &0 + ==> a1 = &0`;; +e (STRIP_TAC);; +e (UNDISCH_TAC ` (n:real^N) dot (x' - v0) = &0`);; +e (ASM_SIMP_TAC[VECTOR_ARITH`(a1 % x + y ) - v0 = a1 % ( x - v0 ) + y - v0 + a1 % v0 `]);; +e (ONCE_REWRITE_TAC[ VECTOR_ARITH` a % x - y = + a % ( x - y ) + a % y - y `]);; +e (ASM_SIMP_TAC[DOT_RADD; VECTOR_ARITH` ( a + b ) - (c:real^N) + = b + a - c `; DOT_RMUL; ZERO_NEUTRAL]);; +e (ASM_SIMP_TAC[DOT_RADD; VECTOR_ARITH` ( a + b ) - (c:real^N) + = b + a - c `; DOT_RMUL; ZERO_NEUTRAL; DOT_RSUB; +REAL_ARITH` ((a4 * (n dot v0) - n dot v0 + a3 * (n dot v0)) + a2 * (n dot v0)) + + a1 * (n dot v0) = ( a1 + a2 + a3 + a4 ) * ( n dot v0 ) - n dot v0 `; + REAL_ARITH ` &1 * a - a = &0 `]);; +e (ASM_MESON_TAC[REAL_ENTIRE; GSYM DOT_EQ_0]);; +let IMP_A1_EQ_0 = top_thm();; + + + + + +let LEMMA7 = prove(` !x y z (p:real^3 -> bool). + plane_norm p /\ ~collinear {x, y, z} /\ {x, y, z} SUBSET p + ==> p = aff {x, y, z}`, +NHANH (PLANE_IMP_AFFINE) THEN +REPEAT STRIP_TAC THEN +REWRITE_TAC[aff; SET_EQ_TO_SUBSET] THEN CONJ_TAC THENL [ +UNDISCH_TAC ` plane_norm (p:real^3 -> bool ) ` THEN +REWRITE_TAC[plane_norm] THEN +STRIP_TAC THEN +UNDISCH_TAC ` {(x:real^3), y, z} SUBSET p` THEN +ASM_SIMP_TAC[SET3_SUBSET; IN_ELIM_THM] THEN +NHANH (IN_PLANE_IMP_OTHORGONAL ) THEN +DOWN_TAC THEN +NHANH (MESON[NOT_COL_AND_ORTHO_IMP_NOT_COPL]` + ~collinear {(x:real^3), y, z} /\ + ~(n = vec 0) /\a1 /\a2 /\a4 /\a3/\ + n dot (x - y) = &0 /\ + n dot (x - z) = &0 ==> ~coplanar { x + n ,x,y,z} `) THEN +REWRITE_TAC[SUBSET; IN_ELIM_THM] THEN +REPEAT STRIP_TAC THEN +UNDISCH_TAC `~coplanar {x + n, x, y, (z:real^3)} ` THEN +NHANH (SPEC `x' :real^3` (GEN `v :real^3` ( SPEC_ALL COEFS_4 ))) THEN +ABBREV_TAC ` a1 = COEF4_1 (x + n) x y z x'` THEN +ABBREV_TAC ` a2 = COEF4_2 (x + n) x y z x'` THEN +ABBREV_TAC ` a3 = COEF4_3 (x + n) x y z x'` THEN +ABBREV_TAC ` a4 = COEF4_4 (x + n) x y z x'` THEN +STRIP_TAC THEN +DOWN_TAC THEN +REWRITE_TAC[AFFINE_HULL_3; IN_ELIM_THM] THEN +NHANH (MESON[IMP_A1_EQ_0]` ~(n = vec 0) /\ + aa1 /\ + n dot (x - v0) = &0 /\ + n dot (y - v0) = &0 /\ + n dot (z - v0) = &0 /\ + aa2 /\aa3 /\ + n dot (x' - v0) = &0 /\aa4/\aa5 /\aa6/\aa7/\ + ~coplanar {x + n, x, y, z} /\ + a1 + a2 + a3 + a4 = &1 /\ + x' = a1 % (x + n) + a2 % x + a3 % y + a4 % z /\ l ==> + a1 = &0 `) THEN +PURE_ONCE_REWRITE_TAC[MESON[]` P a1 /\ a1 = &0 <=> P (&0) /\ + a1 = &0 `] THEN +REWRITE_TAC[ZERO_NEUTRAL; VECTOR_ARITH` &0 % x + y = y `] THEN +MESON_TAC[]; +ASM_MESON_TAC[PLANE_NORM_IMP_AFFINE ; FINITE_RULES; +SET_RULE` ~({(x:real^N), y, z} = {} )`; IMP_AFFINE_HULL_SUBSET]]);; + +let SMWTDMU = LEMMA7;; + + +g ` det_vec3 v1 v2 v3 = ( cross v1 v2 ) dot v3 `;; +e (REWRITE_TAC[det_vec3; cross; triple_of_real3; + real3_of_triple; mk_vec3; DOT_3; VECTOR_3]);; +e (LET_TR);; +e (REWRITE_TAC[det_vec3; cross; triple_of_real3; + real3_of_triple; mk_vec3; DOT_3; VECTOR_3]);; +e (REAL_ARITH_TAC);; +let DET_VEC3_AS_CROSS_DOT = top_thm();; + + + +g ` ! v1 v2 (v3:real^3). collinear {v1,v2,v3} <=> + norm (cross (v2 - v1) (v3 - v1)) pow 2 = &0 `;; +e (REWRITE_TAC[COL_EQ_UPS_0]);; +e (REWRITE_TAC[GSYM NORM_CROSS_PRODUCT_UPS_X]);; +e (REAL_ARITH_TAC);; +let COL_EQ_NORM_CROSS = top_thm();; + +let COLLINEAR_IMP_COPLANAR = prove(` ! v1 v2 v3 v3 (v:real^3). collinear {v1,v2,v3} ==> +coplanar {v1,v2,v3,v} `, +REWRITE_TAC[COPLANAR_DET_VEC3_EQ_0; COL_EQ_NORM_CROSS; DET_VEC3_AS_CROSS_DOT ] THEN +REWRITE_TAC[GSYM RELATE_POW2; NORM_EQ_0] THEN REPEAT GEN_TAC THEN +SIMP_TAC[VECTOR_ARITH ` vec 0 dot x = &0 `]);; + +(* MAY WORKS, LEMMA 85 ; VBVYGGT *) + + + + +let POS_EQ_NOT_COPLANANR = prove(` &0 < delta (dist ((x1:real^3),x2) pow 2) (dist (x1,x3) pow 2) + (dist (x1,x4) pow 2) + (dist (x2,x3) pow 2) + (dist (x2,x4) pow 2) + (dist (x3,x4) pow 2) <=> ~coplanar {x1, x2, x3, x4} `, +MP_TAC (DELTA_POS_4POINTS) THEN MP_TAC POLFLZY THEN LET_TR THEN +REWRITE_TAC[REAL_ARITH` a <= b <=> a = b \/ a < b `] THEN +MESON_TAC[REAL_ARITH` ~( a = b /\ a < b ) `]);; + +let SUM_CHI_EQ_2DELTA = prove(` let chi11 = chi x12 x13 x14 x23 x24 x34 in + let chi22 = chi x12 x24 x23 x14 x13 x34 in + let chi33 = chi x34 x13 x23 x14 x24 x12 in + let chi44 = chi x34 x24 x14 x23 x13 x12 in + &2 * delta x12 x13 x14 x23 x24 x34 = chi11 + chi22 + chi33 + chi44`, LET_TR THEN +REWRITE_TAC[chi; delta] THEN REAL_ARITH_TAC);; + +let NOT_0_IMP_SUM_CHI_1 = prove(`~(delta x12 x13 x14 x23 x24 x34 = &0) + ==> chi x12 x13 x14 x23 x24 x34 / (&2 * delta x12 x13 x14 x23 x24 x34) + + chi x12 x24 x23 x14 x13 x34 / (&2 * delta x12 x13 x14 x23 x24 x34) + + chi x34 x13 x23 x14 x24 x12 / (&2 * delta x12 x13 x14 x23 x24 x34) + + chi x34 x24 x14 x23 x13 x12 / (&2 * delta x12 x13 x14 x23 x24 x34) = + &1`, MP_TAC SUM_CHI_EQ_2DELTA THEN +LET_TR THEN CONV_TAC REAL_FIELD);; + +(* MAY WORKS *) + +let PROVE_DIST_FROM_V1 = prove(` ~coplanar {v1, v2, v3, v4} ==> +let x12 = dist (v1,v2) pow 2 in + let x13 = dist (v1,v3) pow 2 in + let x14 = dist (v1,v4) pow 2 in + let x23 = dist (v2,v3) pow 2 in + let x24 = dist (v2,v4) pow 2 in + let x34 = dist (v3,v4) pow 2 in + let chi11 = chi x12 x13 x14 x23 x24 x34 in + let chi22 = chi x12 x24 x23 x14 x13 x34 in + let chi33 = chi x34 x13 x23 x14 x24 x12 in + let chi44 = chi x34 x24 x14 x23 x13 x12 in + p = + &1 / (&2 * delta x12 x13 x14 x23 x24 x34) % + (chi11 % v1 + chi22 % v2 + chi33 % v3 + chi44 % v4) + ==> d3 p v1 pow 2 = + ( &1 / &2 ) * rho x12 x13 x14 x23 x24 x34 / (&2 * delta x12 x13 x14 x23 x24 x34) `, +REWRITE_TAC[ GSYM POS_EQ_NOT_COPLANANR] THEN +NHANH (REAL_ARITH` a < b ==> ~( b = a ) `) THEN +NHANH NOT_0_IMP_SUM_CHI_1 THEN +LET_TR THEN REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; + REAL_ARITH` ( &1 / a ) * b = b / a `] THEN +ABBREV_TAC ` a1 = chi (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) + (dist (v2,v4) pow 2) + (dist (v3,v4) pow 2) / + (&2 * + delta (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) + (dist (v2,v4) pow 2) + (dist (v3,(v4:real^3)) pow 2))` THEN +ABBREV_TAC ` a2 = chi (dist (v1,v2) pow 2) (dist (v2,v4) pow 2) (dist (v2,v3) pow 2) + (dist (v1,v4) pow 2) + (dist (v1,v3) pow 2) + (dist (v3,v4) pow 2) / + (&2 * + delta (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) + (dist (v2,v4) pow 2) + (dist (v3,(v4:real^3)) pow 2)) ` THEN +REWRITE_TAC[ GSYM d3] THEN +ABBREV_TAC ` a3 = chi (d3 v3 v4 pow 2) (d3 v1 v3 pow 2) (d3 v2 v3 pow 2) (d3 v1 v4 pow 2) + (d3 v2 v4 pow 2) + (d3 v1 v2 pow 2) / + (&2 * + delta (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) (d3 v1 v4 pow 2) + (d3 v2 v3 pow 2) + (d3 v2 v4 pow 2) + (d3 v3 v4 pow 2)) ` THEN +ABBREV_TAC ` a4 = chi (d3 v3 v4 pow 2) (d3 v2 v4 pow 2) (d3 v1 v4 pow 2) (d3 v2 v3 pow 2) + (d3 v1 v3 pow 2) + (d3 v1 v2 pow 2) / + (&2 * + delta (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) (d3 v1 v4 pow 2) + (d3 v2 v3 pow 2) + (d3 v2 v4 pow 2) + (d3 v3 v4 pow 2)) ` THEN +SIMP_TAC[REAL_ARITH` a + b = &1 <=> a = &1 - b `] THEN +REPEAT STRIP_TAC THEN +REWRITE_TAC[d3; dist; NORM_POW_2; VECTOR_ARITH` + (((&1 - (a2 + a3 + a4)) % v1 + a2 % v2 + a3 % v3 + a4 % v4) - v1) = + a2 % ( v2 - v1 ) + a3 % (v3 - v1 ) + a4 % ( v4 - v1 ) `; + VECTOR_ARITH` ( a + b ) dot ( a + b ) = a dot a + &2 * ( a dot b ) + + b dot b `] THEN +REWRITE_TAC[DOT_RADD; DOT_LMUL; DOT_RMUL] THEN +REWRITE_TAC[X_DOT_X_EQ] THEN +REWRITE_TAC[DOT_NORM_NEG; VECTOR_ARITH` v2 - v1 - (v4 - v1) + = (v2:real^N) - v4 `] THEN +SIMP_TAC[GSYM dist; DIST_SYM; GSYM d3; D3_SYM] THEN +EXPAND_TAC "a2" THEN +EXPAND_TAC "a3" THEN +EXPAND_TAC "a4" THEN +REWRITE_TAC[GSYM d3 ] THEN +ABBREV_TAC ` x12 = d3 v1 v2 pow 2 ` THEN +ABBREV_TAC ` x13 = d3 v1 v3 pow 2 ` THEN +ABBREV_TAC ` x14 = d3 v1 v4 pow 2 ` THEN +ABBREV_TAC ` x23 = d3 v2 v3 pow 2 ` THEN +ABBREV_TAC ` x24 = d3 v2 v4 pow 2 ` THEN +ABBREV_TAC ` x34 = d3 v3 v4 pow 2 ` THEN +UNDISCH_TAC ` &0 < delta x12 x13 x14 x23 x24 x34 ` THEN +ONCE_REWRITE_TAC[REAL_FIELD` &0 < a ==> b = c <=> &0 < a + ==> b * ( &2 * a) pow 2 = c * ( &2 * a ) pow 2 `] THEN +ONCE_REWRITE_TAC[REAL_ARITH` &0 < a <=> &0 < &2 * a `] THEN +SIMP_TAC[REAL_FIELD` &0 < b ==> ( a / b ) * b pow 2 = a * b `; + REAL_RDISTRIB; REAL_FIELD` &0 < b ==> ( a / b ) * ( aa / b ) * c * +b pow 2 = a * aa * c `; REAL_ADD_LDISTRIB] THEN +SIMP_TAC[REAL_LDISTRIB; REAL_ARITH` (a*b)*c = a *b * c `; + REAL_FIELD` &0 < b ==> ( a / b ) * ( a / b ) * c * b pow 2 = a pow 2 * c `; + REAL_ARITH` &2 * a * b * c / &2 * d = a * b * d * c `] THEN +SIMP_TAC[REAL_FIELD` &0 < a ==> ( b / a ) * ( bb / a ) * a pow 2 + * d = b * bb * d `] THEN +SIMP_TAC[REAL_FIELD` &0 < a ==> b / a / &2 * a pow 2 = + a * b / &2 `] THEN +REWRITE_TAC[chi; rho; delta] THEN +REAL_ARITH_TAC);; + + + +let PROVE_EQ_DIST_FROM4 = prove(` ~coplanar {v1, v2, v3, v4} ==> +let x12 = dist (v1,v2) pow 2 in + let x13 = dist (v1,v3) pow 2 in + let x14 = dist (v1,v4) pow 2 in + let x23 = dist (v2,v3) pow 2 in + let x24 = dist (v2,v4) pow 2 in + let x34 = dist (v3,v4) pow 2 in + let chi11 = chi x12 x13 x14 x23 x24 x34 in + let chi22 = chi x12 x24 x23 x14 x13 x34 in + let chi33 = chi x34 x13 x23 x14 x24 x12 in + let chi44 = chi x34 x24 x14 x23 x13 x12 in + p = + &1 / (&2 * delta x12 x13 x14 x23 x24 x34) % + (chi11 % v1 + chi22 % v2 + chi33 % v3 + chi44 % v4) +==> +d3 p v2 pow 2 = ( &1 / &2 ) * rho x12 x13 x14 x23 x24 x34 / (&2 * delta x12 x13 x14 x23 x24 x34) /\ +d3 p v3 pow 2 = ( &1 / &2 ) * rho x12 x13 x14 x23 x24 x34 / (&2 * delta x12 x13 x14 x23 x24 x34) /\ +d3 p v4 pow 2 = + ( &1 / &2 ) * rho x12 x13 x14 x23 x24 x34 / (&2 * delta x12 x13 x14 x23 x24 x34) `, +REWRITE_TAC[ GSYM POS_EQ_NOT_COPLANANR] THEN +NHANH (REAL_ARITH` a < b ==> ~( b = a ) `) THEN +NHANH NOT_0_IMP_SUM_CHI_1 THEN +LET_TR THEN REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; + REAL_ARITH` ( &1 / a ) * b = b / a `] THEN +ABBREV_TAC ` a1 = chi (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) + (dist (v2,v4) pow 2) + (dist (v3,v4) pow 2) / + (&2 * + delta (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) + (dist (v2,v4) pow 2) + (dist (v3,(v4:real^3)) pow 2))` THEN +ABBREV_TAC ` a2 = chi (dist (v1,v2) pow 2) (dist (v2,v4) pow 2) (dist (v2,v3) pow 2) + (dist (v1,v4) pow 2) + (dist (v1,v3) pow 2) + (dist (v3,v4) pow 2) / + (&2 * + delta (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) + (dist (v2,v4) pow 2) + (dist (v3,(v4:real^3)) pow 2)) ` THEN +REWRITE_TAC[ GSYM d3] THEN +ABBREV_TAC ` a3 = chi (d3 v3 v4 pow 2) (d3 v1 v3 pow 2) (d3 v2 v3 pow 2) (d3 v1 v4 pow 2) + (d3 v2 v4 pow 2) + (d3 v1 v2 pow 2) / + (&2 * + delta (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) (d3 v1 v4 pow 2) + (d3 v2 v3 pow 2) + (d3 v2 v4 pow 2) + (d3 v3 v4 pow 2)) ` THEN +ABBREV_TAC ` a4 = chi (d3 v3 v4 pow 2) (d3 v2 v4 pow 2) (d3 v1 v4 pow 2) (d3 v2 v3 pow 2) + (d3 v1 v3 pow 2) + (d3 v1 v2 pow 2) / + (&2 * + delta (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) (d3 v1 v4 pow 2) + (d3 v2 v3 pow 2) + (d3 v2 v4 pow 2) + (d3 v3 v4 pow 2)) ` THEN +ONCE_REWRITE_TAC[MESON[VECTOR_ARITH` &1 % x = x `]` d3 a b pow 2 = + aa <=> d3 a ( &1 % b ) pow 2 = aa `] THEN +ONCE_REWRITE_TAC[MESON[]` a = &1 <=> &1 = a `] THEN +SIMP_TAC[] THEN +STRIP_TAC THEN STRIP_TAC THEN +REWRITE_TAC[d3; dist] THEN +REWRITE_TAC[VECTOR_ARITH` (a1 % v1 + a2 % v2 + a3 % v3 + a4 % v4) - (a1 + a2 + a3 + a4) % v2 + = a1 % ( v1 - v2 ) + a3 % ( v3 - v2 ) + a4 % (v4 - v2 ) `; + VECTOR_ARITH` (a1 % v1 + a2 % v2 + a3 % v3 + a4 % v4) - (a1 + a2 + a3 + a4) % v3 + = a1 % ( v1 - v3 ) + a2 % ( v2 - v3 ) + a4 % (v4 - v3 )`; + VECTOR_ARITH` (a1 % v1 + a2 % v2 + a3 % v3 + a4 % v4) - (a1 + a2 + a3 + a4) % v4 = + a1 % ( v1 - v4 ) + a2 % ( v2 - v4 ) + a3 % (v3 - v4 )`] THEN +REWRITE_TAC[NORM_POW_2] THEN +REWRITE_TAC[DOT_LADD; DOT_RADD; DOT_LMUL; DOT_RMUL; GSYM NORM_POW_2] THEN +REWRITE_TAC[DOT_NORM_NEG; VECTOR_ARITH` v3 - v4 - (v2 - v4) = + (v3:real^N) - v2 `; GSYM dist; GSYM d3 ] THEN +EXPAND_TAC "a1" THEN +EXPAND_TAC "a2" THEN +EXPAND_TAC "a3" THEN +EXPAND_TAC "a4" THEN +REWRITE_TAC[GSYM d3 ] THEN +REWRITE_TAC[prove(` d3 (v4 - v3) (v1 - v3) = d3 v1 v4 `, +REWRITE_TAC[d3] THEN CONV_TAC NORM_ARITH)] THEN +SIMP_TAC[D3_SYM] THEN +ABBREV_TAC ` x12 = d3 v1 v2 pow 2 ` THEN +ABBREV_TAC ` x13 = d3 v1 v3 pow 2 ` THEN +ABBREV_TAC ` x14 = d3 v1 v4 pow 2 ` THEN +ABBREV_TAC ` x23 = d3 v2 v3 pow 2 ` THEN +ABBREV_TAC ` x24 = d3 v2 v4 pow 2 ` THEN +ABBREV_TAC ` x34 = d3 v3 v4 pow 2 ` THEN +UNDISCH_TAC ` &0 < delta x12 x13 x14 x23 x24 x34 ` THEN +ONCE_REWRITE_TAC[REAL_FIELD` &0 < a ==> ( b = c ) /\ ( bb = cc ) /\ ( bbb = ccc ) +<=> &0 < a + ==> ( b * ( &2 * a) pow 2 = c * ( &2 * a ) pow 2 ) /\ +( bb * ( &2 * a) pow 2 = cc * ( &2 * a ) pow 2 ) /\ +( bbb * ( &2 * a) pow 2 = ccc * ( &2 * a ) pow 2 ) `] THEN +ONCE_REWRITE_TAC[REAL_ARITH` &0 < a <=> &0 < &2 * a `] THEN +SIMP_TAC[REAL_FIELD` &0 < b ==> ( a / b ) * b pow 2 = a * b `; + REAL_RDISTRIB; REAL_FIELD` &0 < b ==> ( a / b ) * ( aa / b ) * c * +b pow 2 = a * aa * c `; REAL_ADD_LDISTRIB] THEN +SIMP_TAC[REAL_LDISTRIB; REAL_ARITH` (a*b)*c = a *b * c `; + REAL_FIELD` &0 < b ==> ( a / b ) * ( a / b ) * c * b pow 2 = a pow 2 * c `; + REAL_ARITH` &2 * a * b * c / &2 * d = a * b * d * c `] THEN +SIMP_TAC[REAL_FIELD` &0 < a ==> ( b / a ) * ( bb / a ) * a pow 2 + * d = b * bb * d `] THEN +SIMP_TAC[REAL_FIELD` &0 < a ==> b / a / &2 * a pow 2 = + a * b / &2 `] THEN SIMP_TAC[REAL_FIELD` &0 < b ==> ( a / b ) * b pow 2 = a * b `; + REAL_RDISTRIB; REAL_FIELD` &0 < b ==> ( a / b ) * ( aa / b ) * c * +b pow 2 = a * aa * c `; REAL_ADD_LDISTRIB] THEN +SIMP_TAC[REAL_LDISTRIB; REAL_ARITH` (a*b)*c = a *b * c `; + REAL_FIELD` &0 < b ==> ( a / b ) * ( a / b ) * c * b pow 2 = a pow 2 * c `; + REAL_ARITH` &2 * a * b * c / &2 * d = a * b * d * c `] THEN +SIMP_TAC[REAL_FIELD` &0 < a ==> ( b / a ) * ( bb / a ) * a pow 2 + * d = b * bb * d `] THEN +SIMP_TAC[REAL_FIELD` &0 < a ==> b / a / &2 * a pow 2 = + a * b / &2 `] THEN +DISCH_TAC THEN REWRITE_TAC[chi; rho; delta] THEN +REAL_ARITH_TAC);; + + + +(* the following lemma is in Multivariate/convex.ml *) +let AFFINE_HULL_FINITE_STEP = new_axiom +`((?u. sum {} u = w /\ vsum {} (\x. u(x) % x) = y) <=> + w = &0 /\ y = vec 0) /\ + (FINITE(s:real^N->bool) + ==> ((?u. sum (a INSERT s) u = w /\ + vsum (a INSERT s) (\x. u(x) % x) = y) <=> + ?v u. sum s u = w - v /\ + vsum s (\x. u(x) % x) = y - v % a))`;; + +let AFFINE_HULL_3 = prove + (`affine hull {a,b,c} = + { u % a + v % b + w % c | u + v + w = &1}`, + SIMP_TAC[AFFINE_HULL_FINITE; FINITE_INSERT; FINITE_RULES] THEN + SIMP_TAC[AFFINE_HULL_FINITE_STEP; FINITE_INSERT; FINITE_RULES] THEN + REWRITE_TAC[REAL_ARITH `x - y = z:real <=> x = y + z`; + VECTOR_ARITH `x - y = z:real^N <=> x = y + z`] THEN + REWRITE_TAC[VECTOR_ADD_RID; REAL_ADD_RID] THEN SET_TAC[]);; + +let AFFINE_HULL_4 = prove + (`affine hull {a,b,c,d} = + { u % a + v % b + w % c + z % d | u + v + w + z = &1}`, + SIMP_TAC[AFFINE_HULL_FINITE; FINITE_INSERT; FINITE_RULES] THEN + SIMP_TAC[AFFINE_HULL_FINITE_STEP; FINITE_INSERT; FINITE_RULES] THEN + REWRITE_TAC[REAL_ARITH `x - y = z:real <=> x = y + z`; + VECTOR_ARITH `x - y = z:real^N <=> x = y + z`] THEN + REWRITE_TAC[VECTOR_ADD_RID; REAL_ADD_RID] THEN SET_TAC[]);; + + +let PROVE_EXISTS_CIR_OF_FOUR_POINTS = prove(`!(v1:real^3) v2 v3 v4. + CARD {v1, v2, v3, v4} = 4 /\ ~coplanar {v1, v2, v3, v4} + ==> (? p. p IN affine hull {v1, v2, v3, v4} /\ + (?r. !v. v IN {v1, v2, v3, v4} + ==> r = dist (p, v))) `, +NHANH (REWRITE_RULE[RIGHT_FORALL_IMP_THM] (GEN `p:real^3` PROVE_DIST_FROM_V1)) THEN +NHANH (REWRITE_RULE[RIGHT_FORALL_IMP_THM] (GEN `p:real^3` PROVE_EQ_DIST_FROM4 )) THEN +REPEAT GEN_TAC THEN REPEAT LET_TAC THEN ABBREV_TAC `rr = &1 / &2 * + rho x12 x13 x14 x23 x24 x34 / (&2 * delta x12 x13 x14 x23 x24 x34) ` THEN +REWRITE_TAC[GSYM POS_EQ_NOT_COPLANANR] THEN +NHANH (SPEC_ALL REAL_POS_NZ) THEN ASM_SIMP_TAC[] THEN +NHANH (NOT_0_IMP_SUM_CHI_1 ) THEN ASM_SIMP_TAC[] THEN +REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; + REAL_ARITH ` &1 / a * b = b / a `] THEN +REWRITE_TAC[FORALL_IN_CLAUSES; MESON[]`(? r. (r:real) = a /\ + r = b /\ r = c /\ r = d ) <=> a = b /\ a = c /\ a = d `] THEN +REWRITE_TAC[MESON[]` (! x. x = a ==> P a ) <=> P a `] THEN DISCH_TAC THEN +EXISTS_TAC ` chi11 / (&2 * delta x12 x13 x14 x23 x24 x34) % (v1:real^3) + + chi22 / (&2 * delta x12 x13 x14 x23 x24 x34) % v2 + + chi33 / (&2 * delta x12 x13 x14 x23 x24 x34) % v3 + + chi44 / (&2 * delta x12 x13 x14 x23 x24 x34) % v4 ` THEN +CONJ_TAC THENL [REWRITE_TAC[AFFINE_HULL_4; IN_ELIM_THM] THEN +FIRST_X_ASSUM MP_TAC THEN MESON_TAC[NOT_0_IMP_SUM_CHI_1 ]; +FIRST_X_ASSUM MP_TAC THEN SIMP_TAC[d3; DIST_POS_LE; EQ_POW2_COND]]);; + + + + + + + + + + + + +let IMP_PROPERTIES_OF_CIR4 = prove(`!(v1:real^3) v2 v3 v4. + CARD {v1, v2, v3, v4} = 4 /\ ~coplanar {v1, v2, v3, v4} + ==> circumcenter {v1, v2, v3, v4} IN affine hull {v1, v2, v3, v4} /\ + (?r. !v. v IN {v1, v2, v3, v4} + ==> r = dist (circumcenter {v1, v2, v3, v4},v))`, +NHANH (SPEC_ALL PROVE_EXISTS_CIR_OF_FOUR_POINTS ) THEN REWRITE_TAC[circumcenter; IN] +THEN MESON_TAC[EXISTS_THM]);; + + + + +let DIST_EQ_IMP_ORTHOGONAL = prove(` dist (pp,v2) = dist (pp,v1) /\ + dist (p,v2) = dist (p,v1) ==> + (pp - p ) dot (v2 - v1 ) = &0 `, +REWRITE_TAC[MONG7_ROI; DOT_LSUB] THEN REAL_ARITH_TAC);; + + + +let IMP_OTHO4 = prove(` n dot (v2 - v1) = &0 /\ + n dot (v3 - v1) = &0 /\ + n dot (v4 - v1) = &0 /\ + x IN affine hull {v1,v2,v3,v4} /\ + y IN affine hull {v1,v2,v3,v4} ==> + n dot (x - y ) = &0 `, +REWRITE_TAC[AFFINE_HULL_4; IN_ELIM_THM] THEN STRIP_TAC THEN +DOWN_TAC THEN IMP_TAC THEN SIMP_TAC[REAL_ARITH`a + b = c <=> a = c - b `] THEN +PHA THEN REWRITE_TAC[VECTOR_ARITH` ((&1 - (v' + w' + z')) % v1 + v' % v2 + + w' % v3 + z' % v4) - ((&1 - (v + w + z)) % v1 + v % v2 + w % v3 + z % v4) = + ( v' - v ) % ( v2 - v1 ) + ( w' - w ) % ( v3 - v1 ) + + ( z' - z ) % ( v4 - v1 ) `] THEN +SIMP_TAC[DOT_RADD; DOT_RMUL; ZERO_NEUTRAL]);; + + + + + +let UNIQUE_EXISISTING_PROPERTY_C4 = prove(`!(v1:real^3) v2 v3 v4. + CARD {v1, v2, v3, v4} = 4 /\ ~coplanar {v1, v2, v3, v4} + ==> (!p. p IN affine hull {v1, v2, v3, v4} /\ + (?r. !v. v IN {v1, v2, v3, v4} ==> r = dist (p,v)) + ==> p = circumcenter {v1, v2, v3, v4}) `, +NHANH (SPEC_ALL IMP_PROPERTIES_OF_CIR4 ) THEN +REPEAT GEN_TAC THEN +ABBREV_TAC ` pp = circumcenter {(v1:real^3), v2, v3, v4}` THEN +REPEAT STRIP_TAC THEN +DOWN_TAC THEN +REWRITE_TAC[FORALL_IN_CLAUSES] THEN +REWRITE_TAC[MESON[]` r = a /\ r = b /\ r = c /\ r = d <=> r = a /\ b = a /\ c = a + /\ d = a `] THEN +PHA THEN +NHANH (MESON[DIST_EQ_IMP_ORTHOGONAL ]`dist (pp,v2) = dist (pp,v1) /\ + dist (pp,v3) = dist (pp,v1) /\ + dist (pp,v4) = dist (pp,v1) /\a11/\a2/\ + dist (p,v2) = dist (p,v1) /\ + dist (p,v3) = dist (p,v1) /\ + dist (p,v4) = dist (p,v1) ==> + ( p - pp) dot ( v2 - v1 ) = &0 /\ + ( p - pp ) dot ( v3 - v1 ) = &0 /\ + ( p - pp ) dot ( v4 - v1 ) = &0 `) THEN +ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN +REWRITE_TAC[GSYM DOT_EQ_0] THEN MESON_TAC[IMP_OTHO4 ]);; + + + + +let PROVE_IN_AFFINE_HULL_4 = prove( +`~(delta x12 x13 x14 x23 x24 x34 = &0) + ==> &1 / (&2 * delta x12 x13 x14 x23 x24 x34) % + (chi x12 x13 x14 x23 x24 x34 % v1 + + chi x12 x24 x23 x14 x13 x34 % v2 + + chi x34 x13 x23 x14 x24 x12 % v3 + + chi x34 x24 x14 x23 x13 x12 % v4) IN + affine hull {(v1:real^3), v2, v3, v4}`, +REWRITE_TAC[AFFINE_HULL_4; IN_ELIM_THM; VECTOR_ADD_LDISTRIB; + VECTOR_MUL_ASSOC; REAL_ARITH ` ( &1 / a ) * b = b/a `] + THEN MESON_TAC[NOT_0_IMP_SUM_CHI_1]);; + + + +(* VBVYGGT , le 85 *) + + + +MESON[POW_2_SQRT; DIST_POS_LE]` dist (x,y) pow 2 = r ==> dist (x,y) = sqrt ( r ) `;; + +(* LEMMA 85 *) +let VBVYGGT = prove(`!(v1:real^3) v2 v3 v4. + CARD {v1, v2, v3, v4} = 4 /\ ~coplanar {v1, v2, v3, v4} + ==> circumcenter {v1, v2, v3, v4} IN affine hull {v1, v2, v3, v4} /\ + (?r. !v. v IN {v1, v2, v3, v4} + ==> r = dist (circumcenter {v1, v2, v3, v4},v)) /\ + (!p. p IN affine hull {v1, v2, v3, v4} /\ + (?r. !v. v IN {v1, v2, v3, v4} ==> r = dist (p,v)) + ==> p = circumcenter {v1, v2, v3, v4}) /\ + (let x12 = dist (v1,v2) pow 2 in + let x13 = dist (v1,v3) pow 2 in + let x14 = dist (v1,v4) pow 2 in + let x23 = dist (v2,v3) pow 2 in + let x24 = dist (v2,v4) pow 2 in + let x34 = dist (v3,v4) pow 2 in + let chi11 = chi x12 x13 x14 x23 x24 x34 in + let chi22 = chi x12 x24 x23 x14 x13 x34 in + let chi33 = chi x34 x13 x23 x14 x24 x12 in + let chi44 = chi x34 x24 x14 x23 x13 x12 in + circumcenter {v1, v2, v3, v4} = + &1 / (&2 * delta x12 x13 x14 x23 x24 x34) % + (chi11 % v1 + chi22 % v2 + chi33 % v3 + chi44 % v4)) `, +NHANH (SPEC_ALL UNIQUE_EXISISTING_PROPERTY_C4 ) THEN +NHANH (SPEC_ALL IMP_PROPERTIES_OF_CIR4 ) THEN +REWRITE_TAC[MESON[]` (a /\ b1/\b2) /\ b ==> b1 /\b2/\ b/\ d <=> a /\ b1 /\b2/\b==>d `] THEN +NHANH (REWRITE_RULE[RIGHT_FORALL_IMP_THM] ( GEN `p: real^3 `PROVE_DIST_FROM_V1)) THEN +NHANH (REWRITE_RULE[RIGHT_FORALL_IMP_THM] ( GEN `p: real^3 ` PROVE_EQ_DIST_FROM4)) THEN +REPEAT GEN_TAC THEN REPEAT LET_TAC THEN ABBREV_TAC `rr = &1 / &2 * + rho x12 x13 x14 x23 x24 x34 / (&2 * delta x12 x13 x14 x23 x24 x34) ` THEN +REWRITE_TAC[MESON[]` (! x. x = a ==> P x ) <=> P a `] THEN +REWRITE_TAC[GSYM POS_EQ_NOT_COPLANANR] THEN +NHANH (REAL_ARITH` &0 < a ==> ~( a = &0 )`) THEN +NHANH (PROVE_IN_AFFINE_HULL_4 ) THEN +UNDISCH_TAC ` dist ((v1:real^3),v2) pow 2 = x12` THEN +UNDISCH_TAC ` dist ((v1:real^3),v3) pow 2 = x13` THEN +UNDISCH_TAC ` dist ((v1:real^3),v4) pow 2 = x14` THEN +UNDISCH_TAC ` dist ((v2:real^3),v3) pow 2 = x23` THEN +UNDISCH_TAC ` dist ((v2:real^3),v4) pow 2 = x24` THEN +UNDISCH_TAC ` dist ((v3:real^3),v4) pow 2 = x34` THEN +UNDISCH_TAC ` chi x12 x13 x14 x23 x24 x34 = chi11 ` THEN +UNDISCH_TAC ` chi x12 x24 x23 x14 x13 x34 = chi22 ` THEN +UNDISCH_TAC ` chi x34 x13 x23 x14 x24 x12 = chi33` THEN +UNDISCH_TAC ` chi x34 x24 x14 x23 x13 x12 = chi44` THEN +REWRITE_TAC[MESON[]` a = b ==> P a <=> a = b ==> P b `] THEN +ABBREV_TAC ` w = &1 / (&2 * delta x12 x13 x14 x23 x24 x34) % + (chi11 % (v1:real^3) + chi22 % v2 + chi33 % v3 + chi44 % v4)` THEN +REWRITE_TAC[MESON[]` a /\ b ==> c <=> a ==> b ==> c `] +THEN REPLICATE_TAC 13 DISCH_TAC THEN +REWRITE_TAC[FORALL_IN_CLAUSES;d3] THEN PHA THEN +NHANH (MESON[POW_2_SQRT; DIST_POS_LE]` dist (x,y) pow 2 = r + ==> dist (x,y) = sqrt ( r ) `) THEN MESON_TAC[]);; + +(* lemma 85 *) +(* let VBVYGGT = new_axiom `!(v1:real^3) v2 v3 v4. + CARD {v1, v2, v3, v4} = 4 /\ ~coplanar {v1, v2, v3, v4} + ==> circumcenter {v1, v2, v3, v4} IN affine hull {v1, v2, v3, v4} /\ + (?r. !v. v IN {v1, v2, v3, v4} + ==> r = dist (circumcenter {v1, v2, v3, v4},v)) /\ + (!p. p IN affine hull {v1, v2, v3, v4} /\ + (?r. !v. v IN {v1, v2, v3, v4} ==> r = dist (p,v)) + ==> p = circumcenter {v1, v2, v3, v4}) /\ + (let x12 = dist (v1,v2) pow 2 in + let x13 = dist (v1,v3) pow 2 in + let x14 = dist (v1,v4) pow 2 in + let x23 = dist (v2,v3) pow 2 in + let x24 = dist (v2,v4) pow 2 in + let x34 = dist (v3,v4) pow 2 in + let chi11 = chi x12 x13 x14 x23 x24 x34 in + let chi22 = chi x12 x24 x23 x14 x13 x34 in + let chi33 = chi x34 x13 x23 x14 x24 x12 in + let chi44 = chi x34 x24 x14 x23 x13 x12 in + circumcenter {v1, v2, v3, v4} = + &1 / (&2 * delta x12 x13 x14 x23 x24 x34) % + (chi11 % v1 + chi22 % v2 + chi33 % v3 + chi44 % v4)) `;; *) + + + +let NOT_COPLANAR_IMP_EXISTS_CIR = prove(`! (v1:real^3) v2 v3 v4. + CARD {v1, v2, v3, v4} = 4 /\ ~coplanar {v1, v2, v3, v4} + ==> circumcenter {v1, v2, v3, v4} IN affine hull {v1, v2, v3, v4} /\ + (?r. !v. v IN {v1, v2, v3, v4} + ==> r = dist (circumcenter {v1, v2, v3, v4},v)) `, +MESON_TAC[VBVYGGT]);; + + + + +let THREE_POINTS_COP = prove(` ! v1 v2 (v3:real^3). coplanar {v1,v2,v3} `, +MESON_TAC[DIMINDEX_3; ARITH_RULE` 2 <= 3 `; COPLANAR_3]);; + + + + +let PER_SET4 = SET_RULE ` {a,b,c,d} = {b,a,c,d} /\ + {a,b,c,d} = {c,b,a,d} /\ + {a,b,c,d} = {d,b,c,a} `;; + + +let NOT_COPLANAR_IMP_CARD4 = prove(` ~ coplanar {(v1:real^3), v2, v3, v4} +==> CARD {v1, v2, v3, v4} = 4 `, REWRITE_TAC[CARD4; IN_SET3] THEN +MP_TAC (GEN_ALL THREE_POINTS_COP ) THEN +MESON_TAC[PER_SET4; SET_RULE` {a,a,b,c} = {a,b,c} `]);; + + +let NOT_COPLANAR_IMP_EXISTS_CIR2 = MESON[NOT_COPLANAR_IMP_EXISTS_CIR ; +NOT_COPLANAR_IMP_CARD4 ]` ! (v1:real^3) v2 v3 v4. ~ coplanar {v1, v2, v3, v4} + ==> circumcenter {v1, v2, v3, v4} IN affine hull {v1, v2, v3, v4} /\ + (?r. !v. v IN {v1, v2, v3, v4} + ==> r = dist (circumcenter {v1, v2, v3, v4},v)) `;; + + + +let NOT_COPLANAR_IMP_RADV_PROPERTIES = prove(` ~coplanar {(v1:real^3), v2, v3, v4} ==> + (! w. {v1, v2, v3, v4} w ==> radV {v1, v2, v3, v4} + = dist (circumcenter {v1,v2,v3,v4} ,w) ) `, +NHANH (SPEC_ALL NOT_COPLANAR_IMP_EXISTS_CIR2) THEN +REWRITE_TAC[IN; radV] THEN MESON_TAC[EXISTS_THM]);; + + + +let ZJEWPAP = ` ! v1 v2 v3 (v4:real^3). + let s = {v1, v2, v3, v4} in CARD s = 4 /\ ~ coplanar s + ==> radV {v1,v2,v3} <= radV s `;; + + + +let PHA = REWRITE_TAC[MESON[]` ( a ==> b ==> c <=> a /\ b ==> c ) /\ + ( (a /\ b ) /\ c <=> a /\ b /\ c ) `];; + + +let NOT_COL_EQ_UPS_X_POS = prove(`! v1 v2 v3. ~ collinear {(v1:real^3), v2, v3} <=> + &0 < ups_x (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) + (dist (v2,v3) pow 2) `, +MP_TAC (GEN_ALL ZERO_LE_UPS_X) THEN REWRITE_TAC[UPS_X_EQ_ZERO_COND] THEN +REWRITE_TAC[UPS_X_EQ_ZERO_COND; REAL_ARITH` a <= b <=> a = b \/ a < b `] THEN +REWRITE_TAC[d3] THEN MESON_TAC[REAL_ARITH` ~( a = b /\ a < b ) `]);; + + +let ETA_Y_POW2_EQ = prove(`(dist (v1,v2) pow 2 * dist (v1,v3) pow 2 * dist (v2,v3) pow 2) / + ups_x (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v2,v3) pow 2) = +( eta_y (d3 v2 v3) (d3 v1 v3) (d3 v1 v2)) pow 2 `, +REWRITE_TAC[eta_y;d3; eta_x] THEN LET_TR THEN +REWRITE_TAC[GSYM REAL_POW_2; GSYM d3 ] THEN +SIMP_TAC[MESON[UPS_X_SYM]` ups_x a b c = ups_x c b a `; +REAL_ARITH ` a * b * c = c * b * a `] THEN +MESON_TAC[SQRT_WORKS; REAL_LE_SQUARE_POW; REAL_LE_MUL; + REAL_LE_DIV; d3 ; ZERO_LE_UPS_X; UPS_X_SYM]);; + + +let ETA_Y_POS_LE = prove(` &0 <= eta_y (d3 v1 v2) (d3 v1 v3) (d3 v2 v3) `, +REWRITE_TAC[eta_y; eta_x] THEN LET_TR THEN REWRITE_TAC[GSYM REAL_POW_2] THEN +MESON_TAC[REAL_LE_POW_2; REAL_LE_MUL; ZERO_LE_UPS_X; REAL_LE_DIV; + SQRT_POS_LE]);; + + +(* lemma 87 *) +let ZJEWPAP = prove(` ! v1 v2 v3 (v4:real^3). + let s = {v1, v2, v3, v4} in CARD s = 4 /\ ~ coplanar s + ==> radV {v1,v2,v3} <= radV s `, +LET_TR THEN +NHANH (MESON[COLLINEAR_IMP_COPLANAR ]`~coplanar {v1, v2, v3, v4} + ==> ~ collinear {(v1:real^3),v2,v3} `) THEN +SIMP_TAC[NOT_COLL_IMP_RADV_EQ_ETA_Y] THEN +REWRITE_TAC[MESON[]` a /\ b /\ c <=> (a/\b)/\c`] THEN +NHANH (SPEC_ALL VBVYGGT) THEN +REPEAT GEN_TAC THEN +NHANH (NOT_COPLANAR_IMP_RADV_PROPERTIES) THEN +ABBREV_TAC ` pp = circumcenter {(v1:real^3), v2, v3, v4}` THEN +MP_TAC (SPECL [`pp :real^3`; ` v1: real^3`; `v2:real^3`; ` v3:real^3`] DELTA_POS_4POINTS ) THEN +REWRITE_TAC[REWRITE_RULE[IN] FORALL_IN_CLAUSES; + FORALL_IN_CLAUSES ] THEN +REWRITE_TAC[MESON[]` ( a ==> b ==> c <=> a /\ b ==> c ) /\ + ( (a /\ b ) /\ c <=> a /\ b /\ c ) `] THEN +REPEAT STRIP_TAC THEN +UNDISCH_TAC ` &0 <= + delta (dist ((pp:real^3),v1) pow 2) (dist (pp,v2) pow 2) (dist (pp,v3) pow 2) + (dist (v1,v2) pow 2) + (dist (v1,v3) pow 2) + (dist (v2,v3) pow 2)` THEN +ABBREV_TAC `p1 = dist ((pp:real^3),v1)` THEN +ABBREV_TAC `p2 = dist ((pp:real^3),v2)` THEN +ABBREV_TAC `p3 = dist ((pp:real^3),v3)` THEN + REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC THEN MATCH_MP_TAC +(MESON[]` a ==> b ==> a `)) THEN +EXPAND_TAC "p1" THEN +EXPAND_TAC "p2" THEN +EXPAND_TAC "p3" THEN +FIRST_X_ASSUM MP_TAC THEN +REWRITE_TAC[NOT_COL_EQ_UPS_X_POS ] THEN +REWRITE_TAC[NOT_COL_EQ_UPS_X_POS; DELTA_RRR_INTERPRETE] THEN +SIMP_TAC[REAL_FIELD` &0 < a ==> -- b * c + r * a = a * ( r - ( b * c ) / a ) `] THEN +SIMP_TAC[ETA_Y_POW2_EQ; REAL_LE_MUL_EQ] THEN +UNDISCH_TAC ` radV {(v1:real^3), v2, v3, v4} = p1 ` THEN +SIMP_TAC[] THEN +EXPAND_TAC "p1" THEN +UNDISCH_TAC `r = dist ((pp: real^3),v4)` THEN +SIMP_TAC[] THEN +REPLICATE_TAC 3 REMOVE_TAC THEN +SIMP_TAC[ETA_Y_SYYM; REAL_ARITH` &0 <= a - b <=> b <= a `] THEN +MESON_TAC[DIST_POS_LE; POW2_COND; ETA_Y_POS_LE ]);; + + + + + +let NOT_EQ_BASIS_IMP_OTHORGANAL = MESON[DOT_BASIS_BASIS_UNEQUAL] +` ! i j. ~( i = j ) ==> basis i dot basis j = &0 `;; + + +let BASIS_DIS_OTHORGONAL = +MESON[ARITH_RULE` ~( 1 = 2 \/ 1 = 3 \/ 2 = 3 ) `; NOT_EQ_BASIS_IMP_OTHORGANAL] +` basis 1 dot basis 2 = &0 /\ + basis 1 dot basis 3 = &0 /\ + basis 2 dot basis 3 = &0 ` ;; + + +let NORM_BASIS_VEC3 = prove(` ! i. i = 1 \/ i = 2 \/ i = 3 ==> +norm (( basis i ):real^3 ) = &1 `, +MESON_TAC[DIMINDEX_3; ARITH_RULE` i = 1 \/ i = 2 \/ i = 3 <=> + 1 <= i /\ i <= 3`; NORM_BASIS]);; + + +let AAA_LEMMA = prove(` &0 < a /\ + a <= b /\ + b <= c /\ ll ==> &0 <= b pow 2 - a pow 2 /\ &0 <= c pow 2 - b pow 2 `, +REWRITE_TAC[REAL_ARITH` &0 <= a - b <=> b <= a `] THEN +MESON_TAC[REAL_LT_IMP_LE; POW2_COND; POS_IMP_POW2; REAL_LE_TRANS]);; + + +let LLEEMAA = prove(` &0 < a /\ + a <= b /\ + b <= c /\ + &0 < a' /\ + a' <= b' /\ + b' <= c' /\ + a <= a' /\ + b <= b' /\ + c <= c' /\ l ==> &0 <= a' pow 2 - a pow 2 /\ + &0 <= b' pow 2 - b pow 2 /\ + &0 <= c' pow 2 - c pow 2 `, +REWRITE_TAC[REAL_ARITH` &0 <= a - b <=> b <= a `] THEN +MESON_TAC[POS_IMP_POW2; REAL_ARITH` a < b ==> a <= b `; + REAL_LE_TRANS]);; + + + +let TYUNJLA = prove(` !(e1:real^3) e2 e3 a b c a' b' c' t1 t2 t3. + e1 = basis 1 /\ + e2 = basis 2 /\ + e3 = basis 3 /\ + &0 < a /\ + a <= b /\ + b <= c /\ + &0 < a' /\ + a' <= b' /\ + b' <= c' /\ + a <= a' /\ + b <= b' /\ + c <= c' /\ + (!x. x IN {t1, t2, t3} ==> &0 < x) /\ + t1 + t2 + t3 < &1 /\ + v = + ((t1 + t2 + t3) * a) % e1 + + ((t2 + t3) * sqrt (b pow 2 - a pow 2)) % e2 + + (t3 * sqrt (c pow 2 - b pow 2)) % e3 /\ + v' = ((t1 + t2 + t3) * a') % e1 + + ((t2 + t3) * sqrt (b' pow 2 - a' pow 2)) % e2 + + (t3 * sqrt (c' pow 2 - b' pow 2)) % e3 ==> + norm v <= norm v' `, +REPEAT STRIP_TAC THEN FIRST_X_ASSUM MP_TAC THEN +FIRST_X_ASSUM MP_TAC THEN +SIMP_TAC[POW2_COND; NORM_POS_LE; NORM_POW_2; DOT_LADD; DOT_RADD; +DOT_LMUL; DOT_RMUL] THEN ASM_SIMP_TAC[] THEN +SIMP_TAC[GSYM NORM_POW_2; NORM_BASIS_VEC3 ] THEN +SIMP_TAC[BASIS_DIS_OTHORGONAL; MESON[DOT_SYM; BASIS_DIS_OTHORGONAL] + ` basis 2 dot basis 1 = &0 /\ basis 3 dot basis 1 = &0 /\ + basis 3 dot basis 2 = &0 `; ZERO_NEUTRAL] THEN +REWRITE_TAC[REAL_ARITH` (a * x ) * ( b * x ) * c = a * b * c * x pow 2 `] THEN +REPEAT STRIP_TAC THEN DOWN_TAC THEN +NHANH (AAA_LEMMA) THEN PHA THEN +NHANH (MESON[AAA_LEMMA]` &0 < a /\ a <= b /\ b <= c /\ aa <= a /\ l ==> + &0 <= b pow 2 - a pow 2 /\ &0 <= c pow 2 - b pow 2 `) THEN +SIMP_TAC[SQRT_WORKS] THEN +ONCE_REWRITE_TAC[REAL_ARITH` a <= b <=> &0 <= b - a `] THEN +REWRITE_TAC[REAL_ARITH` ((t1 + t2 + t3) * (t1 + t2 + t3) * &1 pow 2 * a' pow 2 + + (t2 + t3) * (t2 + t3) * &1 pow 2 * (b' pow 2 - a' pow 2) + + t3 * t3 * &1 pow 2 * (c' pow 2 - b' pow 2)) - + ((t1 + t2 + t3) * (t1 + t2 + t3) * &1 pow 2 * a pow 2 + + (t2 + t3) * (t2 + t3) * &1 pow 2 * (b pow 2 - a pow 2) + + t3 * t3 * &1 pow 2 * (c pow 2 - b pow 2)) = + t1 * ( t1 + &2 * t2 + &2 * t3 ) * ( a' pow 2 - a pow 2 ) + + t2 * (t2 + &2 * t3 ) * ( b' pow 2 - b pow 2 ) + + t3 pow 2 * ( c' pow 2 - c pow 2 ) `] THEN +REWRITE_TAC[REAL_ARITH` &0 <= a - b <=> b <= a `] THEN +PHA THEN NHANH (LLEEMAA) THEN STRIP_TAC THEN +UNDISCH_TAC ` (!x. x IN {t1, t2, t3} ==> &0 < x)` THEN +REPLICATE_TAC 3 ( FIRST_X_ASSUM MP_TAC) THEN +REWRITE_TAC[FORALL_IN_CLAUSES] THEN PHA THEN +NHANH (REAL_ARITH` &0 < t1 /\ &0 < t2 /\ &0 < t3 ==> + &0 <= t1 /\ &0 <= t2 /\ &0 <= t1 + &2 * t2 + &2 * t3 /\ + &0 <= t2 + &2 * t3 `) THEN +MESON_TAC[REAL_LE_ADD; REAL_LE_MUL; REAL_LE_POW_2]);; + +let LEMMA83 = TYUNJLA ;; + + + +(* This lemma will be proved by Harrison *) +let NORM_TOWARD_FORTH_POINT = new_axiom`!(v1:real^3) v2 v3 w. + ~coplanar {v1, v2, v3, w} + ==> (?nor. norm nor = &1 /\ + (!x. x IN aff_ge {v1, v2, v3} {w} <=> + (?xx h. + xx IN affine hull {v1, v2, v3} /\ + &0 <= h /\ + x = xx + h % nor)) /\ + (!x y. + {x, y} SUBSET affine hull {v1, v2, v3} + ==> nor dot (x - y) = &0))`;; + + +let DELTA_TRIPLE_SUB_H_EXPAND = prove(` +delta (a01 - h) (a02 - h) (a03 - h) x12 x13 x23 = + delta a01 a02 a03 x12 x13 x23 - h * ups_x x12 x13 x23 `, +REWRITE_TAC[delta;ups_x] THEN REAL_ARITH_TAC);; + +let PROVE_EXISTS_H_DELTA_0 = prove(`&0 < ups_x x12 x13 x23 /\ &0 <= delta a01 a02 a03 x12 x13 x23 + ==> (?h. &0 <= h /\ h = ( delta a01 a02 a03 x12 x13 x23 ) / ups_x x12 x13 x23 /\ + delta (a01 - h) (a02 - h) (a03 - h) x12 x13 x23 = &0 )`, +REWRITE_TAC[DELTA_TRIPLE_SUB_H_EXPAND] THEN +DISCH_TAC THEN +EXISTS_TAC`( delta a01 a02 a03 x12 x13 x23 ) / ups_x x12 x13 x23` THEN +ASM_SIMP_TAC[REAL_LT_IMP_LE; REAL_LE_DIV] THEN +FIRST_X_ASSUM MP_TAC THEN CONV_TAC REAL_FIELD);; + + + +let FIRST_POINT_IN_AFF3 = prove(` ! w v1 v2. w IN aff {w,v1,v2} `, +REWRITE_TAC[aff; AFFINE_HULL_3; IN_ELIM_THM] THEN REPEAT GEN_TAC THEN +EXISTS_TAC ` &1 ` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0` THEN +REWRITE_TAC[ZERO_NEUTRAL] THEN CONV_TAC VECTOR_ARITH);; + +let THREE_GEN_POINTS_IN_AFF3 = MESON[PER_SET3; FIRST_POINT_IN_AFF3 ]` a IN aff {a,b,c} /\ + b IN aff {a,b,c} /\ c IN aff {a,b,c} `;; + + +(* LEMMA73 *) +let OFGJQUS = prove(` ! v1 v2 v3 (v4:real^3) a01 a02 a03 . + let x12 = d3 v1 v2 pow 2 in + let x13 = d3 v1 v3 pow 2 in + let x23 = d3 v2 v3 pow 2 in + CARD {v1, v2, v3, v4} = 4 /\ + + ~coplanar {v1, v2, v3, v4} /\ + &0 <= a01 /\ &0 <= a02 /\ &0 <= a03 /\ + delta a01 a02 a03 x12 x13 x23 >= &0 + ==> (?v0. v0 IN aff_ge {v1, v2, v3} {v4} /\ + d3 v0 v1 pow 2 = a01 /\ + d3 v0 v2 pow 2 = a02 /\ + d3 v0 v3 pow 2 = a03 /\ + (!vv0. vv0 IN aff_ge {v1, v2, v3} {v4} /\ + d3 vv0 v1 pow 2 = a01 /\ + d3 vv0 v2 pow 2 = a02 /\ + d3 vv0 v3 pow 2 = a03 + ==> vv0 = v0) /\ + ( v0 IN aff {v1,v2,v3} <=> + delta a01 a02 a03 x12 x13 x23 = &0 )) `, +REPEAT GEN_TAC THEN +REPEAT LET_TAC THEN +NHANH (MESON[COLLINEAR_IMP_COPLANAR ]`~coplanar {v1, v2, v3, v4} + ==> ~ collinear {(v1:real^3),v2,v3} `) THEN +REWRITE_TAC[NOT_COL_EQ_UPS_X_POS] THEN +PHA THEN REWRITE_TAC[MESON[]` ( &0 < a ) /\ l <=> l /\ &0 < a `] THEN +PHA THEN +REWRITE_TAC[d3 ; REAL_ARITH` a >= b <=> b <= a `; + GSYM (MESON[]` ( &0 < a ) /\ l <=> l /\ &0 < a `)] THEN +EXPAND_TAC "x12" THEN +EXPAND_TAC "x13" THEN +EXPAND_TAC "x23" THEN +REWRITE_TAC[d3] THEN NHANH (PROVE_EXISTS_H_DELTA_0 ) THEN +NHANH (SPEC_ALL NORM_TOWARD_FORTH_POINT ) THEN +NHANH (MESON[COLLINEAR_IMP_COPLANAR]`~coplanar {v1, v2, v3, v4} + ==> ~ collinear {(v1:real^3),v2,v3} `) THEN +STRIP_TAC THEN +FIRST_X_ASSUM MP_TAC THEN +UNDISCH_TAC ` ~collinear {(v1:real^3), v2, v3}` THEN +PHA THEN +REWRITE_TAC[GSYM d3] THEN +NHANH (SPEC_ALL SDIHJZK_INTERPRETE) THEN +STRIP_TAC THEN +EXISTS_TAC ` (v0:real^3) + sqrt (h) % nor ` THEN +CONJ_TAC THENL [ +ASM_MESON_TAC[SQRT_WORKS; d3; aff]; +UNDISCH_TAC ` !x y. {x, y} SUBSET affine hull {v1, v2, v3} + ==> (nor:real^3) dot (x - y) = &0`] THEN +NHANH (MESON[]` (! x y. P x y ) ==> P v0 v1 /\ P v0 v2 /\ P v0 v3 `) THEN +SIMP_TAC[SET2_SU_EX; GSYM aff; THREE_GEN_POINTS_IN_AFF3 ] THEN +UNDISCH_TAC ` (v0:real^3) IN aff {v1, v2, v3}` THEN +SIMP_TAC[] THEN +NHANH (MESON[REAL_MUL_RZERO; DOT_LMUL]`nor dot v = &0 ==> + sqrt h % nor dot v = &0 `) THEN +SIMP_TAC[ORTHOGONAL_IMP_PITHAGOR; d3; NORM_MUL; REAL_ARITH ` (a * b ) pow 2 = +a pow 2 * b pow 2 `; REAL_POW2_ABS] THEN +STRIP_TAC THEN +STRIP_TAC THEN +UNDISCH_TAC ` &0 <= h ` THEN +UNDISCH_TAC` norm (nor:real^3) = &1` THEN +SIMP_TAC[SQRT_WORKS; REAL_ARITH` &1 pow 2 = &1`; REAL_MUL_RID] THEN +REPLICATE_TAC 2 DISCH_TAC THEN +UNDISCH_TAC `a01 - h = d3 v0 v1 pow 2` THEN +UNDISCH_TAC `a02 - h = d3 v0 v2 pow 2` THEN +UNDISCH_TAC `a03 - h = d3 v0 v3 pow 2` THEN +SIMP_TAC[REAL_ARITH` a - b = c <=> c = a - b `; d3 ; + REAL_ARITH` a + b - a = b `] THEN +REPEAT STRIP_TAC THENL [ +UNDISCH_TAC` vv0 IN aff_ge {v1, v2, v3} {(v4:real^3)} ` THEN +UNDISCH_TAC ` !x. (x:real^3) IN aff_ge {v1, v2, v3} {v4} <=> + (?xx h. + xx IN affine hull {v1, v2, v3} /\ &0 <= h /\ x = xx + h % nor) ` THEN +SIMP_TAC[] THEN +REPEAT STRIP_TAC THEN +REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN PHA THEN DAO THEN + +PURE_ONCE_REWRITE_TAC[MESON[]`a = b /\ P a <=> a = b /\ P b `] THEN +UNDISCH_TAC`!x y. + (x:real^3) IN aff {v1, v2, v3} /\ y IN aff {v1, v2, v3} + ==> nor dot (x - y) = &0 /\ sqrt h % nor dot (x - y) = &0` THEN +PHA THEN +NHANH (MESON[THREE_GEN_POINTS_IN_AFF3; aff]`(!x y. + x IN aff {v1, v2, v3} /\ y IN aff {v1, v2, v3} ==> P x y ) /\ + a1 /\ a2 /\ xx IN affine hull {v1, v2, v3} /\ l ==> + P xx v1 /\ P xx v2 /\ P xx v3 `) THEN +NHANH (MESON[DOT_LMUL; REAL_MUL_RZERO]` nor dot (xx - v1) = &0 /\ l ==> + ( h' % nor) dot ( xx - v1 ) = &0 `) THEN +DAO THEN +ONCE_REWRITE_TAC[MESON[]` a1/\a2/\a3/\a4/\a5/\a6/\a7/\l ==> las + <=> a1/\a2/\a3/\a4/\a5/\a6/\a7 ==> l ==> las `] THEN +SIMP_TAC[ORTHOGONAL_IMP_PITHAGOR] THEN +REWRITE_TAC[MESON[]` a1 /\a2/\a3/\ (! x. P x ) /\ l <=> (a1 /\a2/\a3) + /\ (! x. P x ) /\ l`] THEN +REWRITE_TAC[REAL_ARITH` c + a = aa /\ c + b = bb /\ c + d = dd + <=> c + a = aa /\ a - b = aa - bb /\ d - b = dd - bb `] THEN +REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN +PHA THEN +SIMP_TAC[MESON[]` a1/\a2/\a3/\a4 <=> (a1/\a2/\a3)/\a4 `] THEN +REWRITE_TAC[REAL_ARITH` a3 = aa3 - h /\ a2 = aa2 - h /\ + a1 = aa1 - h <=> a2 - a1 = aa2 - aa1 /\ a3 - a1 = aa3 - aa1 /\ + a3 = aa3 - h `] THEN +STRIP_TAC THEN + +UNDISCH_TAC`dist ((v0:real^3),v2) pow 2 - dist (v0,v1) pow 2 = a02 - a01` THEN +UNDISCH_TAC`dist ((v0:real^3),v3) pow 2 - dist (v0,v1) pow 2 = a03 - a01` THEN +UNDISCH_TAC`dist ((xx:real^3),v2) pow 2 - dist (xx,v1) pow 2 = a02 - a01` THEN +UNDISCH_TAC`dist ((xx:real^3),v3) pow 2 - dist (xx,v1) pow 2 = a03 - a01` THEN + +UNDISCH_TAC `(v0:real^3) IN aff {v1, v2, v3}` THEN +UNDISCH_TAC `(xx:real^3) IN affine hull {v1, v2, v3}` THEN +PHA THEN +REWRITE_TAC[MESON[]` a1 = a /\ b1 = b /\ a2 = a /\ b2 = b <=> + a1 = a /\ b1 = b /\ b1 = b2 /\ a1 = a2 `] THEN +REWRITE_TAC[aff; MESON[SET2_SU_EX]` a IN s /\ b IN s /\ a1 + /\a2 /\ l <=> a1/\a2/\ {a,b} SUBSET s /\ l `] THEN +NHANH (SPEC_ALL EQ_SUB_DIST_POW2_IMP_IDENTIFIED) THEN +UNDISCH_TAC ` dist ((v0:real^3),v3) pow 2 = a03 - h` THEN +UNDISCH_TAC` norm (h' % (nor:real^3)) pow 2 + dist ((xx:real^3),v2) pow 2 = a02` THEN +PHA THEN DAO THEN +REWRITE_TAC[MESON[]` a /\ b ==> c <=> a ==> b ==> c `] THEN +SIMP_TAC[REAL_ARITH` a - b = c <=> a = b + c `] THEN +SIMP_TAC[REAL_ARITH` a + b + c = d <=> b = d - a - c `] THEN +REWRITE_TAC[REAL_ARITH` a02 - norm (h' % nor) pow 2 - (a02 - a01) + a03 - a01 = a03 - h + <=> norm (h' % nor) pow 2 = h `] THEN +REPLICATE_TAC 7 DISCH_TAC THEN +SIMP_TAC[NORM_MUL; REAL_ARITH` (a*b) pow 2 = a pow 2 * b pow 2 `; + REAL_POW2_ABS] THEN +UNDISCH_TAC` norm (nor:real^3) = &1 ` THEN +SIMP_TAC[REAL_ARITH` a * &1 pow 2 = a `] THEN +UNDISCH_TAC ` &0 <= h ` THEN +UNDISCH_TAC ` &0 <= h' ` THEN +MESON_TAC[SQRT_WORKS; EQ_POW2_COND]; + + + + +EQ_TAC THENL[ +UNDISCH_TAC `(v0:real^3) IN aff {v1, v2, v3}` THEN +UNDISCH_TAC` !(x:real^3) y. + x IN aff {v1, v2, v3} /\ y IN aff {v1, v2, v3} + ==> nor dot (x - y) = &0 /\ sqrt h % nor dot (x - y) = &0 ` THEN +PHA THEN +NHANH (MESON[]` (! x y. x IN aff {v1, v2, v3} /\ y IN aff {v1, v2, v3} ==> l x y ) + /\ a IN aff {v1, v2, v3} /\ b IN aff {v1, v2, v3} ==> l a b `) THEN +REWRITE_TAC[VECTOR_ARITH` a - ( a + s % x ) = ( -- s ) % x `; + DOT_RMUL; GSYM NORM_POW_2] THEN +UNDISCH_TAC ` norm (nor:real^3) = &1 ` THEN +SIMP_TAC[REAL_ARITH` a * &1 pow 2 = a `; DOT_LMUL; GSYM NORM_POW_2; + REAL_ARITH` ( -- a ) * a = &0 <=> a pow 2 = &0 `] THEN +UNDISCH_TAC` &0 <= h ` THEN +UNDISCH_TAC` delta (a01 - h) (a02 - h) (a03 - h) (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) + (d3 v2 v3 pow 2) = + &0 ` THEN +SIMP_TAC[SQRT_WORKS; d3] THEN +MESON_TAC[REAL_ARITH` a - &0 = a `]; +ABBREV_TAC ` tu = delta a01 a02 a03 (dist ((v1:real^3),v2) pow 2) (dist (v1,v3) pow 2) + (dist (v2,v3) pow 2) ` THEN +UNDISCH_TAC` h = + tu / + ups_x (dist ((v1:real^3),v2) pow 2) (dist (v1,v3) pow 2) (dist (v2,v3) pow 2)` THEN +PHA THEN SIMP_TAC[REAL_ARITH` &0 / a = &0 `] THEN +STRIP_TAC THEN +SIMP_TAC[SQRT_0; VECTOR_MUL_LZERO; VECTOR_ADD_RID] THEN +UNDISCH_TAC` (v0:real^3) IN aff {v1, v2, v3}` THEN +SIMP_TAC[]]]);; + +(* END *) + + + + + + + + + + + + +let PROVE_THE_HYPOTHESI_FOR_74 = prove(` (let s = {v1, v2, v3, v4} in + CARD s = 4 /\ + + ~coplanar s /\ + eta_y (d3 v1 v2 ) (d3 v1 v3) (d3 v2 v3) <= r ) +==> ( let x12 = d3 v1 v2 pow 2 in + let x13 = d3 v1 v3 pow 2 in + let x23 = d3 v2 v3 pow 2 in + CARD {v1, v2, v3, v4} = 4 /\ + + ~coplanar {v1, v2, v3, v4} /\ + &0 <= r pow 2 /\ + &0 <= r pow 2 /\ + &0 <= r pow 2 /\ + delta (r pow 2) (r pow 2) (r pow 2) x12 x13 x23 >= &0 ) `, +REPEAT LET_TAC THEN +SIMP_TAC[REAL_LE_POW_2] THEN +REWRITE_TAC[DELTA_RRR_INTERPRETE] THEN +EXPAND_TAC "s" THEN +NHANH (MESON[COLLINEAR_IMP_COPLANAR]` ~ coplanar {v1, v2, v3, v} ==> + ~ collinear {v1, v2, (v3:real^3)} `) THEN +REWRITE_TAC[NOT_COL_EQ_UPS_X_POS] THEN +EXPAND_TAC "x12" THEN +EXPAND_TAC "x13" THEN +EXPAND_TAC "x23" THEN +REWRITE_TAC[d3] THEN +SIMP_TAC[REAL_FIELD` &0 < a ==> -- x * y + r * a = a * ( r - (x * y ) / a )`] THEN +SIMP_TAC[ETA_Y_POW2_EQ;d3; ETA_Y_SYYM] THEN +MP_TAC ETA_Y_POS_LE THEN +DAO THEN PHA THEN +REWRITE_TAC[d3] THEN DAO THEN +NHANH (MESON[POS_IMP_POW2]` a <= b /\ &0 <= a ==> + a pow 2 <= b pow 2 `) THEN +ONCE_REWRITE_TAC[REAL_ARITH` a <= b <=> &0 <= b - a `] THEN +REWRITE_TAC[REAL_ARITH` a >= &0 <=> &0 <= a `] THEN +SIMP_TAC[REAL_LT_IMP_LE; REAL_LE_MUL]);; + + + +(* OFGJQUS *) +(* LEMMA 74 *) + +let LFYTDXC = prove(` ? p. ! v1 v2 v3 (v4:real^3) r. + let s = {v1, v2, v3, v4} in + CARD s = 4 /\ + + ~coplanar s /\ + eta_y (d3 v1 v2 ) (d3 v1 v3 ) (d3 v2 v3 ) <= r + ==> p v1 v2 v3 v4 r IN aff_ge {v1, v2, v3} {v4} /\ + r = d3 ( p v1 v2 v3 v4 r ) v1 /\ + r = d3 ( p v1 v2 v3 v4 r ) v2 /\ + r = d3 ( p v1 v2 v3 v4 r ) v3 /\ + (!w. w IN aff_ge {v1, v2, v3} {v4} /\ + r = d3 w v1 /\ + r = d3 w v2 /\ + r = d3 w v3 + ==> w = ( p v1 v2 v3 v4 r ) ) `, +REWRITE_TAC[GSYM SKOLEM_THM] THEN +REPEAT GEN_TAC THEN (MP_TAC PROVE_THE_HYPOTHESI_FOR_74 ) THEN LET_TAC THEN +REWRITE_TAC[RIGHT_EXISTS_IMP_THM] THEN +MP_TAC (SPECL [`v1:real^3`;`v2:real^3`;`v3:real^3`;` v4:real^3`; + ` r pow 2 `; ` r pow 2 `; ` r pow 2 `] OFGJQUS) THEN REPEAT LET_TAC THEN +REWRITE_TAC[MESON[]` ( a ==> b ) ==> a ==> c <=> a /\ b ==> c`] + THEN EXPAND_TAC "s" THEN REWRITE_TAC[MESON[]` ( a ==> b) ==> c /\ a ==> l <=> + a /\ b /\ c ==> l `] THEN MATCH_MP_TAC (MESON[]` (c /\ b ==> l ) ==> +a /\ b /\ c ==> l `) THEN NHANH (MESON[ETA_Y_POS_LE; REAL_LE_TRANS] +` eta_y (d3 v1 v2) (d3 v1 v3) (d3 v2 v3) <= r ==> &0 <= r ` ) THEN +STRIP_TAC THEN EXISTS_TAC `v0:real^3` THEN ASM_MESON_TAC[D3_POS_LE; + GSYM EQ_POW2_COND]);; + + + +let LEMMA74 = LFYTDXC;; +let point_eq = new_specification ["point_eq"] LFYTDXC;; + + + +let INSERT_SUBSET = SET_RULE` {} SUBSET s /\ + ( ( a INSERT s ) SUBSET ss <=> a IN ss /\ s SUBSET ss ) `;; + + +let IMP_TAC = REWRITE_TAC[MESON[]` a /\ b ==> c <=> a ==> b ==> c `];; + +let IMP_OTHORGONAL_AFF3 = prove(`!v1 v2 v3 u. + u dot (v1 - v2) = &0 /\ u dot (v1 - v3) = &0 + ==> (!x y. {x, y} SUBSET aff {v1, v2, v3} ==> u dot (x - y) = &0)`, +REWRITE_TAC[aff; AFFINE_HULL_3; INSERT_SUBSET; IN_ELIM_THM] THEN +REPEAT STRIP_TAC THEN DOWN_TAC THEN +REWRITE_TAC[MESON[]` a /\ b ==> c <=> a ==> b ==> c `] THEN +SIMP_TAC[REAL_ARITH` a + b = &1 <=> a = &1 - b `] THEN +REWRITE_TAC[VECTOR_ARITH` ((&1 - (v + w)) % v1 + v % v2 + w % v3) - + ((&1 - (v' + w')) % v1 + v' % v2 + w' % v3) = + ( v' - v ) % ( v1 - v2 ) + ( w' - w ) % ( v1 - v3 ) `] THEN REPEAT STRIP_TAC + THEN ASM_SIMP_TAC[DOT_RADD; DOT_RMUL; ZERO_NEUTRAL]);; + + +(* MONG7_ROI *) + +let DIST_EQ_IMP_OTHORGONAL = prove(` ! a b p q. dist (p,a) = dist (p,b) /\ dist (q,a) = dist(q,b) +==> ( p - q ) dot ( a - b ) = &0 `, +REWRITE_TAC[MONG7_ROI; DOT_LSUB] THEN REAL_ARITH_TAC);; + +let NOT_COPLANAR_IMP_NOT_COLLINEAR = + MATCH_MP (MESON[]` (a ==> b) ==> ~ b ==> ~ a `) (SPEC_ALL COLLINEAR_IMP_COPLANAR);; + + +(* LEMMA 75 *) +let TIEEBHT = prove(` !v1 v2 v3 (v4:real^3) r p p' u. let s = {v1,v2,v3,v4} in +let x12 = d3 v1 v2 in +let x13 = d3 v1 v3 in +let x23 = d3 v2 v3 in +~ coplanar s /\ +CARD s = 4 /\ +eta_y x12 x13 x23 <= r /\ +p' = point_eq v1 v2 v3 v4 r /\ +p = circumcenter {v1,v2,v3} /\ u IN aff {v1,v2,v3} ==> +( p' - p ) dot ( u - p ) = &0 `, +REPEAT STRIP_TAC THEN LET_TR THEN NHANH NOT_COPLANAR_IMP_NOT_COLLINEAR THEN +NHANH PRE_RADV_COND THEN MP_TAC ( SPEC_ALL point_eq) THEN LET_TR THEN +REWRITE_TAC[MESON[]` ( a /\ b /\ c ==> l ) ==> + ( b /\ bb ) /\ a /\ c /\ las ==> ll <=> + a /\ b /\ c /\ bb /\ las /\ l ==> ll `] THEN +NGOAC THEN REWRITE_TAC[MESON[]` a /\ p = circumcenter {v1, v2, v3} + <=> p = circumcenter {v1, v2, v3} /\ a `] THEN PHA THEN +NHANH (SPEC_ALL CIRCUMCENTER_PROPTIES) THEN +REWRITE_TAC[MESON[]` a = b /\ P b <=> a = b /\ P a `] THEN +REWRITE_TAC[REWRITE_RULE[IN] FORALL_IN_CLAUSES] THEN +REWRITE_TAC[MESON[]`(? c. c = a /\ c = b /\ c = d ) <=> + a = b /\ a = d `; MESON[]` r = a /\ r = b /\ r = c /\ l <=> + a = b /\ a = c /\ r = c /\ l `; d3] THEN +NHANH (MESON[DIST_EQ_IMP_OTHORGONAL]` (dist (p,v1) = dist (p,v2) /\ +dist (p,v1) = dist (p,v3)) /\ a1 /\a2 /\a3/\ dist (p',v1) = dist (p',v2) /\ + dist (p',v1) = dist (p',v3) /\ l ==> ( p' - p ) dot ( v1 - v2 ) = &0 /\ + (p' - p ) dot ( v1 - v3 ) = &0 `) THEN +REWRITE_TAC[GSYM aff] THEN STRIP_TAC THEN +UNDISCH_TAC` (p:real^3) IN aff {v1, v2, v3}` THEN +UNDISCH_TAC` (u:real^3) IN aff {v1, v2, v3}` THEN +PHA THEN REWRITE_TAC[GSYM SET2_SU_EX] THEN +REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN PHA THEN +MESON_TAC[IMP_OTHORGONAL_AFF3 ]);; + + +(* lemma 89 *) +let PVLJZLA = prove( `! (v1:real^3) v2 v3 v4. + let s = {v1, v2, v3, v4} in + ~coplanar s + ==> (circumcenter s IN conv0 s <=> + orientation s v1 (\x. &0 < x) /\ + orientation s v2 (\x. &0 < x) /\ + orientation s v3 (\x. &0 < x) /\ + orientation s v4 (\x. &0 < x))`, +REWRITE_TAC[orientation; affsign] THEN +REPEAT GEN_TAC THEN +LET_TR THEN +REWRITE_TAC[lin_combo] THEN +REWRITE_TAC[SET_RULE` s DIFF {a} UNION {a} = s UNION {a} `; + SET_RULE` {a,b,c,d} UNION {a} = {a,b,c,d} /\ + {a,b,c,d} UNION {b} = {a,b,c,d} /\ + {a,b,c,d} UNION {c} = {a,b,c,d} /\ + {a,b,c,d} UNION {d} = {a,b,c,d}`] THEN +REWRITE_TAC[MESON[]`a = b /\ c /\ d <=> c /\ d /\ b = a `] THEN +REWRITE_TAC[SET_RULE` (!w. {v1} w ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ l + <=> (!w. w IN {v1,v2,v3,v4} ==> {v1} w ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ l `; + SET_RULE` (!w. {v2} w ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ l + <=> (!w. w IN {v1,v2,v3,v4} ==> {v2} w ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ l `; + SET_RULE` (!w. {v2} w ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ l + <=> (!w. w IN {v1,v2,v3,v4} ==> {v2} w ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ l `; + SET_RULE` (!w. {v3} w ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ l + <=> (!w. w IN {v1,v2,v3,v4} ==> {v3} w ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ l `; + SET_RULE` (!w. {v4} w ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ l + <=> (!w. w IN {v1,v2,v3,v4} ==> {v4} w ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ l `] THEN + SIMP_TAC[AFFINE_HULL_FINITE_STEP_GEN; + REAL_ARITH `&0 < x /\ &0 < y ==> &0 < x + y`; + REAL_ARITH ` &0 < x ==> &0 < x / &2`; + FINITE_INSERT; CONJUNCT1 FINITE_RULES +; RIGHT_EXISTS_AND_THM] THEN +NHANH (NOT_COPLANAR_IMP_CARD4) THEN +SIMP_TAC[IN_ACT_SING; CARD4; IN_SET3; DE_MORGAN_THM] THEN +REWRITE_TAC[REAL_ARITH` a - b = c <=> a = b + c `; ZERO_NEUTRAL; + VECTOR_ARITH`(a:real^N) - b = c <=> a = b + c `; VECTOR_ARITH` x + + vec 0 = x `] THEN +REWRITE_TAC[CONV0_4; IN_ELIM_THM] THEN +NHANH (SPEC ` circumcenter {(v1:real^3), v2, v3, v4} ` ( GEN `v:real^3` (SPEC_ALL COEFS_4))) THEN +STRIP_TAC THEN +EQ_TAC THENL [ +MESON_TAC[]; +UNDISCH_TAC ` !ta tb tc td. + circumcenter {v1, v2, v3, v4} = + ta % v1 + tb % v2 + tc % v3 + td % v4 /\ + ta + tb + tc + td = &1 + ==> ta = COEF4_1 v1 v2 v3 v4 (circumcenter {v1, v2, v3, v4}) /\ + tb = COEF4_2 v1 v2 v3 v4 (circumcenter {v1, v2, v3, v4}) /\ + tc = COEF4_3 v1 v2 v3 v4 (circumcenter {v1, v2, v3, v4}) /\ + td = COEF4_4 v1 v2 v3 v4 (circumcenter {v1, v2, v3, v4})` THEN +REWRITE_TAC[MESON[]`&0 < v /\ ( ? b . P v b ) <=> + (? b. &0 < v /\ P v b ) `] THEN +REWRITE_TAC[MESON[]` &1 = a /\ aa = b <=> a = &1 /\ b = aa `] THEN +ABBREV_TAC ` (vv:real^3) = circumcenter {v1, v2, v3, v4} ` THEN +ABBREV_TAC ` a1 = COEF4_1 v1 v2 v3 v4 vv ` THEN +ABBREV_TAC ` a2 = COEF4_2 v1 v2 v3 v4 vv ` THEN +ABBREV_TAC ` a3 = COEF4_3 v1 v2 v3 v4 vv ` THEN +ABBREV_TAC ` a4 = COEF4_4 v1 v2 v3 v4 vv ` THEN PHA THEN +IMP_TAC THEN STRIP_TAC THEN STRIP_TAC THEN +REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN PHA THEN +NHANH (MESON[]`(!ta tb tc td. + vv = ta % v1 + tb % v2 + tc % v3 + td % v4 /\ ta + tb + tc + td = &1 + ==> ta = a1 /\ tb = a2 /\ tc = a3 /\ td = a4) /\ + a111 /\ + v + v' + v'' + v''' = &1 /\ + v % v1 + v' % v2 + v'' % v3 + v''' % v4 = vv /\ + (?v v' v'' v'''. + &0 < v' /\ + v + v' + v'' + v''' = &1 /\ + v % v1 + v' % v2 + v'' % v3 + v''' % v4 = vv) /\ + (?v v' v'' v'''. + &0 < v'' /\ + v + v' + v'' + v''' = &1 /\ + v % v1 + v' % v2 + v'' % v3 + v''' % v4 = vv) /\ + (?v v' v'' v'''. + &0 < v''' /\ + v + v' + v'' + v''' = &1 /\ + v % v1 + v' % v2 + v'' % v3 + v''' % v4 = vv) ==> + &0 < v' /\ &0 < v'' /\ &0 < v''' `) THEN MESON_TAC[]]);; + + + + +let IMP_IN_AFF_LT = prove(`CARD {v1, v2, v3, v4} = 4 ==> ( (?v v' v'' v'''. + v < &0 /\ + &1 = v + v' + v'' + v''' /\ vv = + v % v1 + v' % v2 + v'' % v3 + v''' % v4) <=> + vv IN aff_lt {v2,v3,v4} {v1} ) `, +REWRITE_TAC[CARD4; IN_SET3; DE_MORGAN_THM] THEN SIMP_TAC[AFF_GES_GTS; IN_ELIM_THM] +THEN REMOVE_TAC THEN +MESON_TAC[REAL_ARITH` a + b + c + d = d + a + b + c `; + VECTOR_ARITH` a + b + c + d = d + a + b + (c:real^N)`]);; + + + + +(* LEMMA 85 *) +let VBVYGGT = new_axiom `!(v1:real^3) v2 v3 v4. + CARD {v1, v2, v3, v4} = 4 /\ ~coplanar {v1, v2, v3, v4} + ==> circumcenter {v1, v2, v3, v4} IN affine hull {v1, v2, v3, v4} /\ + (?r. !v. v IN {v1, v2, v3, v4} + ==> r = dist (circumcenter {v1, v2, v3, v4},v)) /\ + (!p. p IN affine hull {v1, v2, v3, v4} /\ + (?r. !v. v IN {v1, v2, v3, v4} ==> r = dist (p,v)) + ==> p = circumcenter {v1, v2, v3, v4}) /\ + (let x12 = dist (v1,v2) pow 2 in + let x13 = dist (v1,v3) pow 2 in + let x14 = dist (v1,v4) pow 2 in + let x23 = dist (v2,v3) pow 2 in + let x24 = dist (v2,v4) pow 2 in + let x34 = dist (v3,v4) pow 2 in + let chi11 = chi x12 x13 x14 x23 x24 x34 in + let chi22 = chi x12 x24 x23 x14 x13 x34 in + let chi33 = chi x34 x13 x23 x14 x24 x12 in + let chi44 = chi x34 x24 x14 x23 x13 x12 in + circumcenter {v1, v2, v3, v4} = + &1 / (&2 * delta x12 x13 x14 x23 x24 x34) % + (chi11 % v1 + chi22 % v2 + chi33 % v3 + chi44 % v4)) `;; + + + + + + +(* lemma 88 *) +let VSMPQYO = prove(` ! v1 v2 v3 (v4:real^3). + CARD {v1, v2, v3, v4} = 4 /\ ~ coplanar {v1,v2,v3,v4} + ==> (let s = {v1, v2, v3, v4} in + let x12 = dist (v1,v2) pow 2 in + let x13 = dist (v1,v3) pow 2 in + let x14 = dist (v1,v4) pow 2 in + let x23 = dist (v2,v3) pow 2 in + let x24 = dist (v2,v4) pow 2 in + let x34 = dist (v3,v4) pow 2 in + orientation s v1 (\t. t < &0) <=> + chi x12 x13 x14 x23 x24 x34 < &0) `, +REWRITE_TAC[orientation; affsign; lin_combo] THEN REPEAT GEN_TAC THEN +LET_TAC THEN EXPAND_TAC "s" THEN +REWRITE_TAC[CARD4; SET_RULE` ( a INSERT s) DIFF {a} UNION {a} = + a INSERT s `] THEN +REWRITE_TAC[MESON[]` a = b /\ c /\ d <=> c /\ d /\ b = a `] THEN +ONCE_REWRITE_TAC[SET_RULE` {v1} w ==> P <=> w IN {v1,v2,v3,v4} ==> + {v1} w ==> P `] THEN SIMP_TAC[AFFINE_HULL_FINITE_STEP_GEN; + REAL_ARITH `x < &0 /\ y < &0 ==> x + y < &0`; + REAL_ARITH `x < &0 ==> x / &2 < &0`; + FINITE_INSERT; CONJUNCT1 FINITE_RULES +; RIGHT_EXISTS_AND_THM] THEN +SIMP_TAC[IN_ACT_SING; IN_SET3; DE_MORGAN_THM] THEN +SIMP_TAC[REAL_ARITH` a - b = c <=> a = b + c `; ZERO_NEUTRAL; + VECTOR_ARITH` a - b = c <=> a = b + (c:real^y)`; VECTOR_ADD_RID; + RIGHT_AND_EXISTS_THM] THEN +REWRITE_TAC[GSYM DE_MORGAN_THM; GSYM IN_SET3] THEN +REWRITE_TAC[DE_MORGAN_THM] THEN +REWRITE_TAC[MESON[]` a1 /\ ~ a /\ ~ b /\ ~ ( c = d ) <=> a1 /\ ~ ( a \/ b \/ + c = d ) `; GSYM CARD4 ] THEN NHANH (SPEC_ALL VBVYGGT) THEN STRIP_TAC THEN +UNDISCH_TAC ` CARD {(v1:real^3), v2, v3, v4} = 4` THEN +SIMP_TAC[IMP_IN_AFF_LT ] THEN +UNDISCH_TAC `~coplanar {(v1:real^3), v2, v3, v4}` THEN +SIMP_TAC[ GSYM SRGTIHY] THEN +NHANH (SPECL [` v1:real^3`; `v2:real^3`;`v3:real^3`;`v4:real^3`; + ` circumcenter {(v1:real^3), v2, v3, v4} `] COEFS_4) THEN +MP_TAC (GEN_ALL SUM_CHI_EQ_2DELTA ) THEN +ABBREV_TAC ` p = circumcenter {(v1:real^3), v2, v3, v4}` THEN +ABBREV_TAC `c1 = COEF4_1 v1 v2 v3 v4 p` THEN +ABBREV_TAC `c2 = COEF4_2 v1 v2 v3 v4 p` THEN +ABBREV_TAC `c3 = COEF4_3 v1 v2 v3 v4 p` THEN +ABBREV_TAC `c4 = COEF4_4 v1 v2 v3 v4 p` THEN +PHA THEN STRIP_TAC THEN +REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN +REPEAT LET_TAC THEN EXPAND_TAC "chi11" THEN +EXPAND_TAC "chi22" THEN EXPAND_TAC "chi33" THEN +EXPAND_TAC "chi44" THEN +REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; + REAL_ARITH` ( &1 / a ) * b = b / a `] THEN +REWRITE_TAC[GSYM POS_EQ_NOT_COPLANANR ] THEN +REPLICATE_TAC 7 STRIP_TAC THEN +UNDISCH_TAC ` dist ((v1:real^3),v2) pow 2 = x12 ` THEN +UNDISCH_TAC ` dist ((v1:real^3),v3) pow 2 = x13 ` THEN +UNDISCH_TAC ` dist ((v1:real^3),v4) pow 2 = x14 ` THEN +UNDISCH_TAC ` dist ((v2:real^3),v3) pow 2 = x23 ` THEN +UNDISCH_TAC ` dist ((v2:real^3),v4) pow 2 = x24 ` THEN +UNDISCH_TAC ` dist ((v3:real^3),v4) pow 2 = x34 ` THEN +REWRITE_TAC[MESON[]` a = b ==> P a <=> a = b ==> P b `] THEN +NHANH (REAL_ARITH` &0 < a ==> ~( a = &0 ) `) THEN +NHANH (NOT_0_IMP_SUM_CHI_1 ) THEN REPEAT STRIP_TAC THEN +UNDISCH_TAC ` &0 < delta x12 x13 x14 x23 x24 x34 ` THEN +ONCE_REWRITE_TAC[ +prove(` &0 < p a ==> ( aa <=> q a < &0) <=> &0 < p a ==> ( aa <=> ( q a ) / ( &2 * p a ) < &0 ) `, +REWRITE_TAC[REAL_ARITH` a < &0 <=> &0 < -- a `; + REAL_ARITH ` -- ( a / b ) = ( -- a ) / b `] THEN +MESON_TAC[REAL_LT_RDIV_0; REAL_ARITH` &0 < a <=> &0 < &2 * a `])] THEN +ABBREV_TAC ` c11 = chi x12 x13 x14 x23 x24 x34 / (&2 * delta x12 x13 x14 x23 x24 x34) ` THEN +ABBREV_TAC ` c22 = chi x12 x24 x23 x14 x13 x34 / (&2 * delta x12 x13 x14 x23 x24 x34) ` THEN +ABBREV_TAC ` c33 = chi x34 x13 x23 x14 x24 x12 / (&2 * delta x12 x13 x14 x23 x24 x34) ` THEN +ABBREV_TAC ` c44 = chi x34 x24 x14 x23 x13 x12 / (&2 * delta x12 x13 x14 x23 x24 x34) ` THEN +REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC THEN REMOVE_TAC) THEN +REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN UNDISCH_TAC +` (p:real^3) = c11 % v1 + c22 % v2 + c33 % v3 + c44 % v4` THEN MESON_TAC[]);; + + + + + + + + + + + + +let SQRT4_EQ2 = prove(` sqrt ( &4 ) = &2 `, +REWRITE_TAC[REAL_ARITH` &4 = &2 pow 2 `] THEN +MESON_TAC[POW_2_SQRT; REAL_ARITH` &0 <= &2 `]);; + + + + + + + + + +let RHUFIIB = prove( ` !x12 x13 x14 x23 x24 x34. + rho x12 x13 x14 x23 x24 x34 * ups_x x34 x24 x23 = + chi x12 x13 x14 x23 x24 x34 pow 2 + + &4 * delta x12 x13 x14 x23 x24 x34 * x34 * x24 * x23 `, +REWRITE_TAC[rho; chi; delta; ups_x] THEN REAL_ARITH_TAC);; + + +(* lemma 84 *) +let SHOGYBS = prove(` ! x1 x2 x3 (x4:real^3). + ~coplanar {x1,x2,x3,x4} ==> + let x12 = dist (x1,x2) pow 2 in + let x13 = dist (x1,x3) pow 2 in + let x14 = dist (x1,x4) pow 2 in + let x23 = dist (x2,x3) pow 2 in + let x24 = dist (x2,x4) pow 2 in + let x34 = dist (x3,x4) pow 2 in + &0 <= rho x12 x13 x14 x23 x24 x34 `, +ONCE_REWRITE_TAC[SET_RULE` {v1,v2,v3,v4} = {v2,v3,v4,v1} `] THEN +NHANH (NOT_COPLANAR_IMP_NOT_COLLINEAR) THEN +ONCE_REWRITE_TAC[GSYM (SET_RULE` {v1,v2,v3,v4} = {v2,v3,v4,v1} `)] THEN +REWRITE_TAC[NOT_COL_EQ_UPS_X_POS] THEN REPEAT GEN_TAC THEN +MP_TAC (SPEC_ALL DELTA_POS_4POINTS) THEN +REPEAT LET_TAC THEN MP_TAC (SPEC_ALL RHUFIIB) THEN DOWN_TAC THEN +NHANH (MESON[REAL_LE_POW_2]` a pow 2 = b ==> &0 <= b `) THEN DAO THEN +SIMP_TAC[UPS_X_SYM] THEN +REWRITE_TAC[MESON[REAL_FIELD` &0 < a ==> (b * a = c <=> b = c / a )`]` + &0 < a /\a1 /\a2/\ b * a = c /\l <=> &0 < a /\a1 /\a2/\ b = c / a /\ l `] THEN +MP_TAC (REAL_ARITH` &0 <= &4 `) THEN PHA THEN +NHANH (MESON[REAL_LT_IMP_LE; REAL_LE_DIV; + REAL_LE_MUL; REAL_LE_ADD; REAL_LE_POW_2]` &0 <= &4 /\ + &0 < ups_x x23 x24 x34 /\a1/\ + &0 <= delta x12 x13 x14 x23 x24 x34 /\ a2 /\ + &0 <= x34 /\a3 /\ &0 <= x24 /\a4 /\ &0 <= x23 /\a5/\ + &0 <= x14 /\a6 /\ &0 <= x13 /\a7 /\a8 /\ &0 <= x12 ==> + &0 <= &4 * delta x12 x13 x14 x23 x24 x34 * x34 * x24 * x23 `) THEN +ABBREV_TAC ` aaa = &4 * delta x12 x13 x14 x23 x24 x34 * x34 * x24 * x23 ` THEN STRIP_TAC THEN +FIRST_X_ASSUM MP_TAC THEN UNDISCH_TAC ` rho x12 x13 x14 x23 x24 x34 = + (chi x12 x13 x14 x23 x24 x34 pow 2 + aaa) / ups_x x23 x24 x34 ` THEN +UNDISCH_TAC`&0 < ups_x x23 x24 x34` THEN MESON_TAC[REAL_LT_IMP_LE; REAL_LE_DIV; + REAL_LE_MUL; REAL_LE_ADD; REAL_LE_POW_2]);; + + +(* le 86 . GDRQXLG *) + + +let GDRQXLG = prove(` ! v1 v2 v3 (v4:real^3). + let s = {v1, v2, v3, v4} in +let x12 = dist (v1,v2) pow 2 in + let x13 = dist (v1,v3) pow 2 in + let x14 = dist (v1,v4) pow 2 in + let x23 = dist (v2,v3) pow 2 in + let x24 = dist (v2,v4) pow 2 in + let x34 = dist (v3,v4) pow 2 in + CARD s = 4 /\ ~coplanar s + ==> radV s = + sqrt ( rho x12 x13 x14 x23 x24 x34) / + (&2 * sqrt (delta x12 x13 x14 x23 x24 x34))`, +REPEAT GEN_TAC THEN REPEAT LET_TAC THEN EXPAND_TAC "s" THEN +NHANH (NOT_COPLANAR_IMP_RADV_PROPERTIES) THEN +NHANH (REWRITE_RULE[RIGHT_FORALL_IMP_THM] (GEN `p:real^3` PROVE_DIST_FROM_V1 )) THEN +NHANH (REWRITE_RULE[RIGHT_FORALL_IMP_THM] (GEN `p:real^3` PROVE_EQ_DIST_FROM4 ) ) THEN +REWRITE_TAC[GSYM POS_EQ_NOT_COPLANANR] THEN +NHANH (REAL_ARITH` &0 < a ==> ~( a = &0 )`) THEN +NHANH (PROVE_IN_AFFINE_HULL_4 ) THEN LET_TR THEN +REWRITE_TAC[MESON[]`(!x. x = a ==> p x) <=> p a `] THEN +ABBREV_TAC `taa = (&1 / (&2 * + delta (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) + (dist (v2,v4) pow 2) + (dist (v3,v4) pow 2)) % + (chi (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) + (dist (v2,v4) pow 2) + (dist (v3,v4) pow 2) % + (v1:real^3) + + chi (dist (v1,v2) pow 2) (dist (v2,v4) pow 2) (dist (v2,v3) pow 2) + (dist (v1,v4) pow 2) + (dist (v1,v3) pow 2) + (dist (v3,v4) pow 2) % + v2 + + chi (dist (v3,v4) pow 2) (dist (v1,v3) pow 2) (dist (v2,v3) pow 2) + (dist (v1,v4) pow 2) + (dist (v2,v4) pow 2) + (dist (v1,v2) pow 2) % + v3 + + chi (dist (v3,v4) pow 2) (dist (v2,v4) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) + (dist (v1,v3) pow 2) + (dist (v1,v2) pow 2) % + v4)) ` THEN +REWRITE_TAC[ POS_EQ_NOT_COPLANANR] THEN NGOAC THEN +NHANH (SPEC_ALL UNIQUE_EXISISTING_PROPERTY_C4 ) THEN +REWRITE_TAC[FORALL_IN_CLAUSES] THEN ABBREV_TAC ` abc = &1 / &2 * + rho (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) (dist (v2,v4) pow 2) (dist (v3,v4) pow 2) / + (&2 * + delta (dist ((v1:real^3),v2) pow 2) (dist (v1,v3) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) + (dist (v2,v4) pow 2) + (dist (v3,v4) pow 2)) ` THEN REWRITE_TAC[d3] THEN +NHANH (MESON[POW_2_SQRT; DIST_POS_LE]` dist (taa,v2) pow 2 = a ==> + dist(taa,v2) = sqrt a `) THEN PHA THEN +NHANH (MESON[]`(!p. p IN affine hull {v1, v2, v3, v4} /\ + (?r. r = dist (p,v1) /\ + r = dist (p,v2) /\ + r = dist (p,v3) /\ + r = dist (p,v4)) + ==> p = circumcenter {v1, v2, v3, v4}) /\ a11 /\ + taa IN affine hull {v1, v2, v3, v4} /\ + dist (taa,v2) pow 2 = abc /\ + dist (taa,v2) = sqrt abc /\ + dist (taa,v3) pow 2 = abc /\ + dist (taa,v3) = sqrt abc /\ + dist (taa,v4) pow 2 = abc /\ + dist (taa,v4) = sqrt abc /\ + dist (taa,v1) pow 2 = abc /\ + dist (taa,v1) = sqrt abc /\ lll ==> taa = circumcenter {v1, v2, v3, v4} `) THEN +NHANH (SET_RULE ` (!w. {v1, v2, v3, v4} w ==> P w ) ==> P v1 `) THEN PHA THEN +REWRITE_TAC[MESON[]` a = dist (aa,b) /\ ta = aa <=> ta = aa /\ a = dist (ta,b) `] THEN +NHANH (MESON[]` a = b /\ a1 /\ a2 /\ c = a ==> c = b `) THEN NHANH (SPEC_ALL SHOGYBS) THEN +MP_TAC (SPECL [`v1:real^3`;` v2:real^3`;`v3:real^3`;`v4:real^3`] +DELTA_POS_4POINTS) THEN REPEAT LET_TAC THEN IMP_TAC THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN +REWRITE_TAC[MESON[]` a = b ==> P a <=> a = b ==> P b `] THEN +REWRITE_TAC[MESON[]` a = b ==> a = c <=> a = b ==> c = b `] THEN REPEAT STRIP_TAC THEN +UNDISCH_TAC ` &1 / &2 * rho x12 x13 x14 x23 x24 x34 / (&2 * delta x12 x13 x14 x23 x24 x34) = + abc ` THEN UNDISCH_TAC ` &0 <= rho x12 x13 x14 x23 x24 x34 ` THEN +ABBREV_TAC ` edl = delta x12 x13 x14 x23 x24 x34 ` THEN UNDISCH_TAC` &0 <= edl ` THEN +SIMP_TAC[REAL_ARITH` &0 <= &4 `; GSYM SQRT_MUL; GSYM SQRT4_EQ2] THEN +SIMP_TAC[REAL_ARITH` &0 <= &4 `; REAL_LE_MUL; GSYM SQRT_DIV] THEN +REWRITE_TAC[SQRT4_EQ2] THEN MESON_TAC[REAL_FIELD` &1 / &2 * x34 / (&2 * edl) = x34 / (&4 * edl)`]);; + + +let BAJSVHC = ` ! v1 v2 v3 v4 (v5:real^3). + CARD {v1, v2, v3, v4, v5} = 5 /\ + ~coplanar {v1, v2, v3, v4} /\ + v5 IN aff_ge {v1, v3} {v2, v4} /\ + ~(v5 IN aff {v1, v3}) + ==> aff_ge {v1, v3} {v2, v4} = + aff_ge {v1, v3} {v2, v5} UNION aff_ge {v1, v3} {v4, v5} /\ + aff_gt {v1, v3} {v2, v5} INTER aff_gt {v1, v3} {v4, v5} = {}`;; +let LEMMA104 = BAJSVHC;; + + + + + +let AFF_GE22 = prove(`!v1 v2 w1 (w2:real^N). + {v1, v2} INTER {w1, w2} = {} + ==> aff_ge {v1, v2} {w1, w2} = + {x | ?a1 a2 b1 b2. + &0 <= b1 /\ + &0 <= b2 /\ + a1 + a2 + b1 + b2 = &1 /\ + x = a1 % v1 + a2 % v2 + b1 % w1 + b2 % w2}`, +REWRITE_TAC[aff_ge_def; affsign; FUN_EQ_THM; lin_combo; sgn_ge] THEN +REWRITE_TAC[MESON[]` (a = aa )/\ (! w. P w ) /\ b <=> + (!w. P w ) /\ b /\ ( aa = a ) `] THEN +ONCE_REWRITE_TAC[SET_RULE` {w1, w2} w ==> P w <=> w IN ( v1 INSERT ( v2 + INSERT {w1, w2} )) ==> {w1, w2} w ==> P w `; + SET_RULE` {a,b} UNION {c,d} = {a,b,c,d} `] THEN +SIMP_TAC[AFFINE_HULL_FINITE_STEP_GEN; + REAL_ARITH `&0 <= x /\ &0 <= y ==> &0 <= x + y`; + REAL_ARITH `&0 <= x ==> &0 <= x / &2`; + FINITE_INSERT; CONJUNCT1 FINITE_RULES +; RIGHT_EXISTS_AND_THM] THEN +SIMP_TAC[SET_RULE`(!x. ({v1, v2} INTER {w1, w2}) x <=> {} x) + <=> ~ ({w1,w2} v1 ) /\ ~({w1,w2} v2 )`; + SET_RULE` {a,b} a /\ {a,b} b `] THEN +REPEAT STRIP_TAC THEN REWRITE_TAC[RIGHT_AND_EXISTS_THM; IN_ELIM_THM; + REAL_ARITH` a - b = c <=> a = b + c `; ZERO_NEUTRAL; + VECTOR_ARITH` a - b = c <=> a = b + (c:real^N)`; VECTOR_ADD_RID; + REAL_ARITH` &1 = a <=> a = &1 `]);; + + + + + +let PROVE_UNION_AFF22_SUBSET = prove(` ! v1 v2 v3 v4 (v5:real^3). + CARD {v1, v2, v3, v4, v5} = 5 /\ ~coplanar {v1, v2, v3, v4} /\ + v5 IN aff_ge {v1, v3} {v2, v4} /\ + ~(v5 IN aff {v1, v3}) + ==> aff_ge {v1, v3} {v2, v5} UNION aff_ge {v1, v3} {v4, v5} + SUBSET aff_ge {v1, v3} {v2, v4} `, +REWRITE_TAC[UNION_SUBSET] THEN +ONCE_REWRITE_TAC[MESON[INSERT_AC]` a /\ b SUBSET + s {v1,v2} <=> a /\ b SUBSET s {v2,v1} `] THEN +MATCH_MP_TAC (MESON[]` (! v1 v2 v3 v4 v5. P v1 v2 v3 v4 v5 <=> + P v1 v4 v3 v2 v5 ) /\ (! v1 v2 v3 v4 v5. + P v1 v2 v3 v4 v5 ==> Q v1 v2 v3 v4 v5 ) ==> + (! v1 v2 v3 v4 v5. P v1 v2 v3 v4 v5 ==> + Q v1 v2 v3 v4 v5 /\ Q v1 v4 v3 v2 v5 ) `) THEN +SIMP_TAC[INSERT_AC] THEN REPEAT GEN_TAC THEN +ONCE_REWRITE_TAC[SET_RULE ` {a,b,c,d,e} = {e,a,b,c,d}`] THEN +REWRITE_TAC[CARD5] THEN +NHANH (SET_RULE` ~(v1 IN {v2, v3, v4}) /\ + ~(v2 = v3 \/ v3 = v4 \/ v4 = v2) ==> + {v1,v3} INTER {v2,v4} = {} `) THEN +NHANH (SPEC_ALL AFF_GE22) THEN PHA THEN +REWRITE_TAC[IN_ELIM_THM; MESON[]` a = b /\ a1 /\ v IN a /\l <=> + a = b /\ a1 /\ v IN b /\ l`] THEN +NHANH (SET_RULE` ~(v5 IN {v1, v2, v3, v4}) /\ + ~(v1 IN {v2, v3, v4}) /\ + ~(v2 = v3 \/ v3 = v4 \/ v4 = v2) /\ l ==> + {v1,v3} INTER {v2,v5} = {} /\ + {v1,v3} INTER {v4,v5} = {} `) THEN +SIMP_TAC[AFF_GE22] THEN STRIP_TAC THEN +SIMP_TAC[UNION_SUBSET; SUBSET; IN_ELIM_THM] THEN +GEN_TAC THEN STRIP_TAC THEN +UNDISCH_TAC ` x = a1' % v1 + a2' % v3 + b1' % v2 + b2' % (v5:real^3)` THEN +UNDISCH_TAC ` v5 = a1 % v1 + a2 % v3 + b1 % v2 + b2 % (v4:real^3)` THEN +PHA THEN +PURE_ONCE_REWRITE_TAC[MESON[]` a = b /\ P a <=> a = b /\ P (b:real^3) `] THEN +REWRITE_TAC[VECTOR_ARITH` a1' % v1 + a2' % v3 + b1' % v2 + + b2' % (a1 % v1 + a2 % v3 + b1 % v2 + b2 % v4) = + (a1' + b2' * a1 ) % v1 + (a2' + b2' * a2 ) % v3 + + (b1' + b2' * b1 ) % v2 + (b2' * b2 ) % v4 `] THEN +STRIP_TAC THEN EXISTS_TAC `a1' + b2' * a1` THEN +EXISTS_TAC `a2' + b2' * a2` THEN +EXISTS_TAC `b1' + b2' * b1` THEN EXISTS_TAC `b2' * b2` THEN +ASM_SIMP_TAC[REAL_LE_ADD; REAL_LE_MUL; +prove(`a1 + a2 + b1 + b2 = &1 /\ a1' + a2' + b1' + b2' = &1 + ==> (a1' + b2' * a1) + (a2' + b2' * a2) + (b1' + b2' * b1) + b2' * b2 = &1`, +SIMP_TAC[REAL_ARITH` a + b = c <=> a = c - b `] THEN REAL_ARITH_TAC)]);; + + + + + + + + + +(* AFF_GES_GTS *) + +let AFF_GT21 = MESON[AFF_GES_GTS]`!a b v0. + ~(a = v0) /\ ~(b = v0) + ==> aff_gt {a, b} {v0} = + {x | ?ta tb t. + ta + tb + t = &1 /\ + &0 < t /\ + x = ta % a + tb % b + t % v0}`;; + let AFF_GE21 = MESON[AFF_GES_GTS]`!a b v0. + ~(a = v0) /\ ~(b = v0) + ==> aff_ge {a, b} {v0} = + {x | ?ta tb t. + ta + tb + t = &1 /\ + &0 <= t /\ + x = ta % a + tb % b + t % v0}`;; + + +let AFF_GT31 = MESON[AFF_GES_GTS]`!a b c v0. + ~(a = v0) /\ ~(b = v0) /\ ~(c = v0 ) + ==> aff_gt {a, b, c} {v0} = + {x | ?ta tb tc t. + &0 < t /\ + ta + tb + tc + t = &1 /\ + x = ta % a + tb % b + tc % c + t % v0}`;; +let AFF_GE31 = MESON[AFF_GES_GTS]`!a b c v0. + ~(a = v0) /\ ~(b = v0) /\ ~(c = v0 ) + ==> aff_ge {a, b, c} {v0} = + {x | ?ta tb tc t. + &0 <= t /\ + ta + tb + tc + t = &1 /\ + x = ta % a + tb % b + tc % c + t % v0}`;; + + + + + + + +let AFF_GE21_SUBSET_AFF22 = prove(`{a,b} INTER {x,y} = {} +==> aff_ge {a,b} {y} SUBSET aff_ge {a,b} {x,y} `, +NHANH (SET_RULE ` {a,b} INTER {x,y} = {} ==> + ~ ( a = y ) /\ ~ ( b = y ) `) THEN +SIMP_TAC[AFF_GE22; AFF_GE21; SUBSET; IN_ELIM_THM] THEN +REPEAT STRIP_TAC THEN +EXISTS_TAC`ta :real` THEN +EXISTS_TAC`tb :real` THEN +EXISTS_TAC`&0 ` THEN +EXISTS_TAC`t :real` THEN +ASM_SIMP_TAC[REAL_LE_REFL; ZERO_NEUTRAL; +VECTOR_MUL_LZERO; VECTOR_ADD_LID]);; + + + + + + + + + + +let V5_IN_AFF21_IMP_SET_EQ = prove(` (v5:real^3) IN aff_ge {v1, v3} {v4} /\ + ~coplanar {v1, v2, v3, v4} /\ + ~(v5 IN aff {v1, v3}) /\ CARD {v1, v2, v3, v4, v5} = 5 + ==> aff_ge {v1, v3} {v2, v4} = aff_ge {v1, v3} {v2, v5}`, +REWRITE_TAC[CARD5] THEN NHANH (SET_RULE` ~(v1 IN {v2, v3, v4, v5}) /\ + ~(v2 IN {v3, v4, v5}) /\ ~(v3 = v4 \/ v4 = v5 \/ v5 = v3) ==> {v1,v3} INTER {v2,v4} = {} `) THEN +NHANH (AFF_GE21_SUBSET_AFF22 ) THEN REWRITE_TAC[ GSYM CARD5] THEN +REWRITE_TAC[MESON[]` x IN s /\l <=> l /\ x IN s `] THEN PHA THEN +NHANH (SET_RULE ` a SUBSET b /\ x IN a ==> x IN b `) THEN ONCE_REWRITE_TAC[MESON[]` a1 /\ a2 /\ CARD s = 5 + /\ a4 /\ a5 /\ a6 <=>a4 /\ a5 /\ CARD s = 5 /\ a1 /\a6 /\a2 `] THEN +NHANH (SPEC_ALL PROVE_UNION_AFF22_SUBSET ) THEN SIMP_TAC[UNION_SUBSET; SET_EQ_TO_SUBSET] THEN +SIMP_TAC[GSYM SET_EQ_TO_SUBSET; CARD5] THEN NHANH (SET_RULE` ~(v1 IN {v2, v3, v4, v5}) /\ + ~(v2 IN {v3, v4, v5}) /\ ~(v3 = v4 \/ v4 = v5 \/ v5 = v3) ==> + {v1, v3} INTER {v2, v5} = {} `) THEN SIMP_TAC[AFF_GE22] THEN +REWRITE_TAC[GSYM SET_EQ_TO_SUBSET; SET_RULE ` {v1, v3} INTER {v2, v4} = {} + <=> ~(v1 = v4) /\ ~(v3 = v4) /\ ~(v1 = v2) /\ ~(v3 = v2)`] THEN +ONCE_REWRITE_TAC[MESON[]` a /\b ==> c <=> a ==> b ==> c `] THEN SIMP_TAC[AFF_GE21] THEN +REWRITE_TAC[IN_ELIM_THM; AFF_2POINTS_INTERPRET] THEN REPEAT STRIP_TAC THEN +ASM_CASES_TAC `t = &0 ` THENL [UNDISCH_TAC `ta + tb + t = &1` THEN +UNDISCH_TAC `(v5:real^3) = ta % v1 + tb % v3 + t % v4` THEN UNDISCH_TAC` t = &0 ` THEN +SIMP_TAC[ZERO_NEUTRAL; VECTOR_MUL_LZERO; VECTOR_ADD_RID] THEN PHA THEN ASM_MESON_TAC[]; +REWRITE_TAC[SUBSET; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN +UNDISCH_TAC `x = a1 % v1 + a2 % v3 + b1 % v2 + b2 % (v4:real^3)` THEN +ONCE_REWRITE_TAC[MESON[]` a ==> b <=> ~b ==> ~ a `] THEN DISCH_TAC THEN +ONCE_REWRITE_TAC[VECTOR_ARITH` x = a <=> x = a - (b2 /t) % (v5:real^3) + (b2 /t) % (v5:real^3)`] THEN +UNDISCH_TAC` (v5:real^3) = ta % v1 + tb % v3 + t % v4 ` THEN SIMP_TAC[] THEN +REWRITE_TAC[VECTOR_ARITH` (a1 % v1 + a2 % v3 + b1 % v2 + b2 % v4) - + tt % (ta % v1 + tb % v3 + t % v4) = ( a1 - tt * ta ) % v1 + ( a2 - tt * tb ) % v3 + b1 % v2 + + ( b2 - tt * t ) % v4 `] THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +UNDISCH_TAC`~(t = &0 )` THEN SIMP_TAC[REAL_FIELD` ~( a = &0) ==> b / a * a = b `; + REAL_SUB_REFL; VECTOR_MUL_LZERO; VECTOR_ADD_RID] THEN UNDISCH_TAC`ta + tb + t = &1` THEN +UNDISCH_TAC ` a1 + a2 + b1 + b2 = &1 ` THEN PHA THEN DAO THEN NHANH (REAL_FIELD` ~(t = &0) /\ + a1 + a2 + b1 + b2 = &1 /\ ta + tb + t = &1 ==> a1 - b2 / t * ta + a2 - b2 / t * tb + b1 + b2 / t = &1`) THEN +UNDISCH_TAC ` &0 <= b2 ` THEN UNDISCH_TAC ` &0 <= t ` THEN PHA THEN +NHANH (MESON[REAL_LE_DIV]` &0 <= t /\ &0 <= b /\ l ==> &0 <= b / t `) THEN +REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[VECTOR_ARITH` ((a:real^N) + b ) + c = + a + b + c `] THEN MESON_TAC[]]);; + + + + + + + + + + + + + + +let AFF_GT22 = prove( `{(a:real^N), b} INTER {x, y} = {} + ==> aff_gt {a, b} {x, y} = + {w | ?ta tb tx ty. + &0 < tx /\ + &0 < ty /\ + ta + tb + tx + ty = &1 /\ + w = ta % a + tb % b + tx % x + ty % y}`, +REWRITE_TAC[aff_gt_def; FUN_EQ_THM; affsign; sgn_gt; + lin_combo] THEN +ONCE_REWRITE_TAC[SET_RULE` {x, y} w ==> P <=> + w IN ({a, b} UNION {x, y}) ==> {x, y} w ==> P`] THEN +REWRITE_TAC[MESON[]` a = b /\ cc /\ j <=> cc /\ j + /\ b = a `] THEN +REWRITE_TAC[SET_RULE` {a, b} UNION {x, y} = + {a,b,x,y}`] THEN + SIMP_TAC[AFFINE_HULL_FINITE_STEP_GEN; + REAL_ARITH `&0 < x /\ &0 < y ==> &0 < x + y`; + REAL_ARITH `&0 < x ==> &0 < x / &2`; + FINITE_INSERT; CONJUNCT1 FINITE_RULES +; RIGHT_EXISTS_AND_THM] THEN +NHANH (SET_RULE` (!x'. ({a, b} INTER {x, y}) x' <=> {} x') + ==> ~( {x,y} a ) /\ ~( {x,y} b ) /\ {x,y} x /\ {x,y} y `) THEN +SIMP_TAC[RIGHT_AND_EXISTS_THM; REAL_ARITH` a - b = c + <=> a = b + c `; ZERO_NEUTRAL; VECTOR_ARITH` (a:real^N) - b + = c <=> a = b + c `; VECTOR_ADD_RID; IN_ELIM_THM] THEN +SIMP_TAC[EQ_SYM_EQ]);; + + + + +let PROVE_B1B2_POS = prove(` ~((?ta tb t. ta + tb + t = &1 /\ &0 <= t /\ v5 = ta % v1 + tb % v3 + t % v2) \/ + (?ta tb t. ta + tb + t = &1 /\ &0 <= t /\ v5 = ta % v1 + tb % v3 + t % v4)) /\ + ~coplanar {v1, v2, v3, v4} /\ + &0 <= b1 /\ + &0 <= b2 /\ + a1 + a2 + b1 + b2 = &1 /\ + v5 = a1 % v1 + a2 % v3 + b1 % v2 + b2 % v4 /\ l + ==> &0 < b1 /\ &0 < b2 `, +ASM_CASES_TAC `b1 = &0 ` THENL [ +ASM_SIMP_TAC[ZERO_NEUTRAL; VECTOR_MUL_LZERO; VECTOR_ADD_LID] THEN +MESON_TAC[]; ASM_CASES_TAC `b2 = &0 ` THENL [ +ASM_SIMP_TAC[ZERO_NEUTRAL; VECTOR_MUL_LZERO; VECTOR_ADD_LID; VECTOR_ADD_RID] +THEN MESON_TAC[]; ASM_SIMP_TAC[REAL_ARITH` a <= b <=> b = a \/ a < b `]]]);; + + + +let NOT_COPLANAR_AND_SUM_IMP_UNIQUE = prove( +` ~coplanar {(v1:real^3), v2, v3, v4} ==> +(! x s1 s2 s3 s4 t1 t2 t3 t4. + t1 + t2 + t3 + t4 = &1 /\ + x = t1 % v1 + t2 % v2 + t3 % v3 + t4 % v4 /\ + s1 + s2 + s3 + s4 = &1 /\ + x = s1 % v1 + s2 % v2 + s3 % v3 + s4 % v4 ==> + s1 = t1 /\ s2 = t2 /\ s3 = t3 /\ s4 = t4 ) `, +NHANH (SPEC_ALL (REWRITE_RULE[RIGHT_FORALL_IMP_THM] COEFS_4)) +THEN MESON_TAC[]);; + + + +g ` ! (v1:real^3) (v2:real^3) (v3:real^3) (v4:real^3) (v5:real^3). + CARD {v1, v2, v3, v4, v5} = 5 /\ + ~coplanar {v1, v2, v3, v4} /\ + v5 IN aff_ge {v1, v3} {v2, v4} /\ + ~(v5 IN aff {v1, v3}) + ==> aff_ge {v1, v3} {v2, v4} = + aff_ge {v1, v3} {v2, v5} UNION aff_ge {v1, v3} {v4, v5} /\ + aff_gt {v1, v3} {v2, v5} INTER aff_gt {v1, v3} {v4, v5} = {}`;; +e (SIMP_TAC[GSYM SUBSET_ANTISYM_EQ; PROVE_UNION_AFF22_SUBSET; +EMPTY_SUBSET ]);; +e (REPEAT GEN_TAC);; +e (ASM_CASES_TAC ` (v5:real^3) IN aff_ge {v1,v3} {v2} \/ + v5 IN aff_ge {v1,v3} {v4} `);; +e (DOWN_TAC);; +e (SPEC_TAC (`v2:real^3`,`v2:real^3`));; +e (SPEC_TAC (`v4:real^3`,`v4:real^3`));; +e (ONCE_REWRITE_TAC[MESON[]` a /\ b ==> c <=> + a ==> b ==> c `]);; +e (MATCH_MP_TAC (MESON[]`(! a b. L a b <=> L b a ) /\ (! a b . P a ==> L a b ) ==> (! a b. P b \/ P a ==> + L a b ) `));; +e (CONJ_TAC);; +e (SIMP_TAC[UNION_COMM; INTER_COMM; INSERT_AC]);; +e (PHA);; +e (ONCE_REWRITE_TAC[MESON[]`a1 /\a2/\a3/\a4/\a5 <=> + a4 /\ a1 /\a3/\a5/\a2`]);; +e (NHANH (V5_IN_AFF21_IMP_SET_EQ));; +e (SIMP_TAC[SET_RULE` a = b ==> a SUBSET (b UNION cc )`]);; +e (ONCE_REWRITE_TAC[MESON[]`a IN s /\ b /\ ss = tt ==> l + <=> ss = tt ==> a IN s /\ b ==> l`]);; +e (ONCE_REWRITE_TAC[GSYM (MESON[]`a1 /\a2/\a3/\a4/\a5 <=> + a4 /\ a1 /\a3/\a5/\a2`)]);; +e (ONCE_REWRITE_TAC[SET_RULE ` {a,b,c,d,e} = {e,a,b,c,d}`]);; +e (REWRITE_TAC[CARD5]);; +e (NHANH (SET_RULE` ~(v1 IN {v2, v3, v4}) /\ + ~(v2 = v3 \/ v3 = v4 \/ v4 = v2) ==> + {v1,v3} INTER {v2,v4} = {} `));; +e (NHANH (SPEC_ALL AFF_GE22));; +e (PHA);; +e (REWRITE_TAC[IN_ELIM_THM; MESON[]` a = b /\ a1 /\ v IN a /\l <=> + a = b /\ a1 /\ v IN b /\ l`]);; +e (REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; DE_MORGAN_THM]);; +e (PHA);; +e (NHANH (MESON[AFF_GE21]` ~(v1 = v4) /\ + ~(v2 = v3) /\ + ~(v3 = v4) /\ ll ==> + aff_ge {v1,v3} {v4} = + {x | ?ta tb t. + ta + tb + t = &1 /\ + &0 <= t /\ + x = ta % v1 + tb % v3 + t % v4}`));; +e (REWRITE_TAC[MESON[]` a IN s /\ l <=> l /\ a IN s `]);; +e (REWRITE_TAC[MESON[]` a IN s /\ l <=> l /\ a IN s `; + MESON[]` a = b /\ x IN a <=> a = b /\ x IN b `; IN_ELIM_THM]);; +e (PHA);; +e (REWRITE_TAC[MESON[]` a = b /\ x IN a <=> + x IN b /\ a = b `; IN_ELIM_THM]);; +e (NHANH (SET_RULE` ~(v5 = v1) /\ + ~(v5 = v2) /\ + ~(v5 = v3) /\ + ~(v5 = v4) /\ + ~(v1 = v2) /\ + ~(v1 = v3) /\ + ~(v1 = v4) /\ + ~(v2 = v3) /\ + ~(v3 = v4) /\ + ~(v4 = v2) /\ l ==> {v1, v3} INTER {v2, v5} = {} /\ + {v1,v3} INTER {v4,v5} = {} `));; +e (SIMP_TAC[AFF_GT22]);; +e (REWRITE_TAC[SET_RULE` a INTER b SUBSET {} <=> (! x. ~( x IN a + /\ x IN b ))`]);; +e (REWRITE_TAC[SET_RULE` a INTER b SUBSET {} <=> (! x. ~( x IN a + /\ x IN b ))`; IN_ELIM_THM] THEN REPEAT STRIP_TAC);; +e (ASM_CASES_TAC ` t = &0 `);; + + + +e (UNDISCH_TAC `v5 = ta % v1 + tb % v3 + t % (v4:real^3)`);; +e (UNDISCH_TAC `ta + tb + t = &1`);; +e (UNDISCH_TAC `t = &0`);; +e (UNDISCH_TAC `~(v5 IN aff {v1, (v3:real^3)})`);; +e (SIMP_TAC[ZERO_NEUTRAL; VECTOR_MUL_LZERO; VECTOR_ADD_RID; + AFF_2POINTS_INTERPRET; IN_ELIM_THM]);; +e (MESON_TAC[]);; +e (REPLICATE_TAC 13 (FIRST_X_ASSUM MP_TAC));; +e (PURE_ONCE_REWRITE_TAC[MESON[]` a = b ==> p a <=> a = b ==> p b `]);; + + +e (REWRITE_TAC[ VECTOR_ARITH` ta' % v1 + tb' % v3 + tx % v2 + ty % (ta % v1 + tb % v3 + t % v4) = + ( ta' + ty * ta ) % v1 + ( tb' + ty * tb ) % v3 + tx % v2 + ( ty * t ) % v4 `]);; + + +e (REWRITE_TAC[VECTOR_ARITH` (ta'' + ty' * ta) % v1 + + (tb'' + ty' * tb) % v3 + + tx' % v4 + + (ty' * t) % v4 = + (ta'' + ty' * ta ) % v1 + (tb'' + ty' * tb ) % v3 + &0 % v2 + (tx' + ty' * t ) % v4 `]);; + +e (REPEAT STRIP_TAC);; +e (UNDISCH_TAC `ta + tb + t = &1`);; +e (UNDISCH_TAC `ta' + tb' + tx + ty = &1`);; +e (UNDISCH_TAC `ta'' + tb'' + tx' + ty' = &1`);; +e (PHA);; +e (NHANH (REAL_FIELD`ta'' + tb'' + tx' + ty' = &1 /\ ta' + tb' + tx + ty = &1 /\ ta + tb + t = &1 ==> + (ta' + ty * ta) + (tb' + ty * tb) + tx + (ty * t) = &1 /\ + (ta'' + ty' * ta) + (tb'' + ty' * tb) + &0 + (tx' + ty' * t ) = &1 `));; +e (MATCH_MP_TAC (MESON[]` (b ==> c) ==> ( a /\ b ==> c)`));; +e (UNDISCH_TAC `x = + (ta' + ty * ta) % v1 + (tb' + ty * tb) % v3 + tx % v2 + (ty * t) % (v4:real^3)`);; +e (UNDISCH_TAC `x = + (ta'' + ty' * ta) % v1 + + (tb'' + ty' * tb) % v3 + + &0 % v2 + + (tx' + ty' * t) % (v4:real^3)`);; +e (UNDISCH_TAC `~coplanar {v1, v2, v3, (v4:real^3)}`);; +e (ONCE_REWRITE_TAC[SET_RULE` {v1, v2, v3, v4} = + {v1,v3,v2,v4}`]);; +e (PHA THEN ONCE_REWRITE_TAC[MESON[]`a1/\a2/\a3/\a4/\a5 <=> + a1/\a5/\a2/\a4/\a3`]);; +e (ABBREV_TAC ` t11 = (ta'' + ty' * ta) `);; +e (ABBREV_TAC ` t33 = (tb'' + ty' * tb) `);; +e (ABBREV_TAC ` t44 = (tx' + ty' * t) `);; +e (ABBREV_TAC ` s11 = (ta' + ty * ta) `);; +e (ABBREV_TAC ` s33 = (tb' + ty * tb) `);; +e (ABBREV_TAC ` s44 = (ty * t) `);; +e (NHANH (SPEC_ALL (REWRITE_RULE[RIGHT_FORALL_IMP_THM] COEFS_4)));; +e (NHANH (MESON[]`(! x. p x ) ==> p (x:real^3)`));; +e (PHA);; +e (NHANH (MESON[]`(!ta tb tc td. + x = ta % v1 + tb % v3 + tc % v2 + td % v4 /\ ta + tb + tc + td = &1 + ==> ta = COEF4_1 v1 v3 v2 v4 x /\ + tb = COEF4_2 v1 v3 v2 v4 x /\ + tc = COEF4_3 v1 v3 v2 v4 x /\ + td = COEF4_4 v1 v3 v2 v4 x) /\ + t11 + t33 + &0 + t44 = &1 /\ + x = t11 % v1 + t33 % v3 + &0 % v2 + t44 % v4 /\ + s11 + s33 + tx + s44 = &1 /\ + x = s11 % v1 + s33 % v3 + tx % v2 + s44 % v4 ==> + tx = &0 `));; +e (STRIP_TAC);; +e (UNDISCH_TAC `&0 < tx `);; +e (UNDISCH_TAC ` tx = &0 `);; +e (MESON_TAC[REAL_ARITH`~( a = &0 /\ &0 < a )`]);; + + + +e (DOWN_TAC);; +e (ONCE_REWRITE_TAC[MESON[]` a/\b/\c ==> l <=> b ==> a /\ c ==> l`]);; +e (REWRITE_TAC[CARD5]);; +e (NHANH (SET_RULE` ~(v1 IN {v2, v3, v4, v5}) /\ + ~(v2 IN {v3, v4, v5}) /\ + ~(v3 = v4 \/ v4 = v5 \/ v5 = v3) ==> + ~(v1 = v2 ) /\ ~(v3 = v2) /\ ~(v1 = v4) /\ ~ (v3 = v4) /\ + {v1,v3} INTER {v2,v4} = {} /\ + {v1, v3} INTER {v2, v5} = {} /\ + {v1, v3} INTER {v4, v5} = {}`));; +e (SIMP_TAC[AFF_GE22; AFF_GT22; AFF_GE21]);; +e (REWRITE_TAC[IN_ELIM_THM]);; +e (STRIP_TAC THEN STRIP_TAC);; +e (DOWN_TAC);; + +(* *) +e (NHANH (PROVE_B1B2_POS ));; +e (REPEAT STRIP_TAC);; +e (REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM; SUBSET; IN_UNION]);; +e (REPEAT STRIP_TAC);; +e (ABBREV_TAC ` r = b1 * b2' - b1' * b2`);; +e (ASM_CASES_TAC ` &0 <= r `);; +e (UNDISCH_TAC `x = a1' % v1 + a2' % v3 + b1' % v2 + b2' % (v4:real^3)`);; +e (ONCE_REWRITE_TAC[MESON[VECTOR_ARITH` a = a - b + (b:real^N)`]` x = a ==> l <=> + x = a - ( b1' / b1 ) % v5 + ( b1' / b1 ) % v5 ==> l `]);; +e (UNDISCH_TAC `v5 = a1 % v1 + a2 % v3 + b1 % v2 + b2 % (v4:real^3)`);; +e (PHA THEN PURE_ONCE_REWRITE_TAC[MESON[]`v = b /\ x = aa - t % v + t % v <=> + v = b /\ x = aa - t % b + t % v `]);; +e (REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC]);; +e (IMP_TAC);; +e (DISCH_TAC);; +e (UNDISCH_TAC` &0 < b1 `);; +e (SIMP_TAC[REAL_FIELD` &0 < b ==> a / b * b = a `]);; +e (REWRITE_TAC[VECTOR_ARITH` (a1' % v1 + a2' % v3 + b1' % v2 + b2' % v4) - + (b1 % v1 + + b2 % v3 + + b1' % v2 + + bb % v4) = (a1' - b1 ) % v1 + + (a2' - b2 ) % v3 + ( b2' - bb ) % v4 `]);; +e (SIMP_TAC[REAL_FIELD`&0 < b ==> a - x / b * c = ( a * b - x * c ) / b `]);; +e (REPEAT STRIP_TAC THEN DISJ2_TAC);; +e (EXISTS_TAC`(a1' * b1 - b1' * a1) / b1 `);; +e (EXISTS_TAC`(a2' * b1 - b1' * a2) / b1`);; +e (EXISTS_TAC`(b2' * b1 - b1' * b2) / b1`);; +e (EXISTS_TAC`b1' / b1`);; +e (SIMP_TAC[VECTOR_ARITH` (a+b) + (c:real^N) = a + b + c `]);; +e (ASM_SIMP_TAC[REAL_LE_DIV; REAL_ARITH` b1 * b2' - b1' * b2 + = b2' * b1 - b1' * b2 `]);; +e (ASM_MESON_TAC[REAL_FIELD` &0 < b1 /\ a1 + a2 + b1 + b2 = &1 /\ + a1' + a2' + b1' + b2' = &1 /\ b1 * b2' - b1' * b2 = r ==> + (a1' * b1 - b1' * a1) / b1 + (a2' * b1 - b1' * a2) / b1 + r / b1 + b1' / b1 = + &1 `]);; +e (UNDISCH_TAC `x = a1' % v1 + a2' % v3 + b1' % v2 + b2' % (v4:real^3)`);; +e (ONCE_REWRITE_TAC[MESON[VECTOR_ARITH` a = a - b + (b:real^N)`]` x = a ==> l <=> + x = a - ( b2' / b2 ) % v5 + ( b2' / b2 ) % v5 ==> l `]);; +e (UNDISCH_TAC `v5 = a1 % v1 + a2 % v3 + b1 % v2 + b2 % (v4:real^3)`);; +e (PHA THEN PURE_ONCE_REWRITE_TAC[MESON[]`v = b /\ x = aa - t % v + t % v <=> + v = b /\ x = aa - t % b + t % v `]);; +e (REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC]);; +e (UNDISCH_TAC` &0 < b2 `);; +e (ONCE_REWRITE_TAC[MESON[]` a ==> b /\ c ==> l <=> + b ==> a /\ c ==> l`]);; +e (DISCH_TAC);; +e (IMP_TAC THEN SIMP_TAC[REAL_FIELD` &0 < b2 ==> b2' / b2 * b2 = b2'`]);; +e (REWRITE_TAC[VECTOR_ARITH`(a1' % v1 + a2' % v3 + b1' % v2 + a44 % v4) - + (a11 % v1 + a33 % v3 + a22 % v2 + a44 % v4) + + a55 % v5 = + (a1' - a11) % v1 + (a2' - a33) % v3 + (b1' - a22) % v2 + a55 % v5`]);; +e (REPEAT STRIP_TAC THEN DISJ1_TAC);; +e (EXISTS_TAC` (a1' - b2' / b2 * a1) `);; +e (EXISTS_TAC` (a2' - b2' / b2 * a2) `);; +e (EXISTS_TAC` (b1' - b2' / b2 * b1) `);; +e (EXISTS_TAC` b2' / b2 `);; +e (UNDISCH_TAC ` ~( &0 <= r )`);; +e (ASM_SIMP_TAC[REAL_LE_DIV; REAL_FIELD` &0 < b2 ==> + b1' - b2' / b2 * b1 = ( -- ( b1 * b2' - b1' * b2 ))/ b2 `; + REAL_ARITH` ~( &0 <= a) <=> &0 <= -- a /\ ~( a = &0 ) `]);; +e (STRIP_TAC);; +e (EXPAND_TAC "r");; +e (ASM_SIMP_TAC[REAL_FIELD` &0 < b2 /\ a1' + a2' + b1' + b2' = &1 /\ a1 + a2 + b1 + b2 = &1 + ==> --(a1 * b2' - a1' * b2) / b2 + + --(a2 * b2' - a2' * b2) / b2 + + --(b1 * b2' - b1' * b2) / b2 + + b2' / b2 = + &1 `]);; +e (REWRITE_TAC[SET_RULE`a INTER b SUBSET {} <=> (! x. ~( x IN a /\ x IN b ))`; IN_ELIM_THM]);; +e (GEN_TAC);; +e (ASM_SIMP_TAC[VECTOR_ARITH` ta % v1 + + tb % v3 + + tx % v2 + + ty % (a1 % v1 + a2 % v3 + b1 % v2 + b2 % v4) + = (ta + ty * a1 ) % v1 + ( tb + ty * a2 ) % v3 + + ( tx + ty * b1 ) % v2 + ( ty * b2 ) % v4 `; + VECTOR_ARITH` ta % v1 + + tb % v3 + + tx % v4 + + ty % (a1 % v1 + a2 % v3 + b1 % v2 + b2 % v4) = + ( ta + ty * a1 ) % v1 + ( tb + ty * a2 ) % v3 + + ( ty * b1 ) % v2 + ( tx + ty * b2 ) % v4 `]);; +e (ONCE_REWRITE_TAC[MESON[]` ~ a <=> a ==> F `] THEN STRIP_TAC);; +e (UNDISCH_TAC` ta + tb + tx + ty = &1 `);; +e (UNDISCH_TAC` a1 + a2 + b1 + b2 = &1 `);; +e (UNDISCH_TAC` ta' + tb' + tx' + ty' = &1 `);; +e (PHA);; +e (NHANH (REAL_FIELD`ta' + tb' + tx' + ty' = &1 /\ + a1 + a2 + b1 + b2 = &1 /\ + ta + tb + tx + ty = &1 ==> + (ta' + ty' * a1) + (tb' + ty' * a2) + (ty' * b1) + + (tx' + ty' * b2) = &1 /\ + (ta + ty * a1) + (tb + ty * a2) + (tx + ty * b1) + + (ty * b2) = &1 `));; +e (STRIP_TAC);; +e (UNDISCH_TAC `x = + (ta + ty * a1) % v1 + + (tb + ty * a2) % v3 + + (tx + ty * b1) % v2 + + (ty * b2) % (v4:real^3)`);; +e (UNDISCH_TAC `(ta + ty * a1) + (tb + ty * a2) + (tx + ty * b1) + ty * b2 = &1`);; +e (UNDISCH_TAC`x = + (ta' + ty' * a1) % v1 + + (tb' + ty' * a2) % v3 + + (ty' * b1) % v2 + + (tx' + ty' * b2) % (v4:real^3) `);; +e (UNDISCH_TAC`(ta' + ty' * a1) + (tb' + ty' * a2) + ty' * b1 + tx' + ty' * b2 = &1 `);; +e (UNDISCH_TAC `~coplanar {(v1:real^3), v2, v3, v4}`);; +e (PHA);; +e (ONCE_REWRITE_TAC[SET_RULE` {a,b,c,d} = {a,c,b,d}`]);; +e (NHANH (NOT_COPLANAR_AND_SUM_IMP_UNIQUE));; +e (PHA);; +e (NHANH (MESON[]`(!x s1 s2 s3 s4 t1 t2 t3 t4. + t1 + t2 + t3 + t4 = &1 /\ + x = t1 % v1 + t2 % v3 + t3 % v2 + t4 % v4 /\ + s1 + s2 + s3 + s4 = &1 /\ + x = s1 % v1 + s2 % v3 + s3 % v2 + s4 % v4 + ==> s1 = t1 /\ s2 = t2 /\ s3 = t3 /\ s4 = t4) /\ + (ta' + ty' * a1) + (tb' + ty' * a2) + ty' * b1 + tx' + ty' * b2 = &1 /\ + x = + (ta' + ty' * a1) % v1 + + (tb' + ty' * a2) % v3 + + (ty' * b1) % v2 + + (tx' + ty' * b2) % v4 /\ + (ta + ty * a1) + (tb + ty * a2) + (tx + ty * b1) + ty * b2 = &1 /\ + x = + (ta + ty * a1) % v1 + + (tb + ty * a2) % v3 + + (tx + ty * b1) % v2 + + (ty * b2) % v4 ==> + ty' * b1 = (tx + ty * b1) /\ + (tx' + ty' * b2) = (ty * b2) `));; +e (NHANH (REAL_FIELD`a = b /\ aa = bb ==> + a * bb - b * aa = &0 `));; + +e (STRIP_TAC);; +e (FIRST_X_ASSUM MP_TAC);; +e (ONCE_REWRITE_TAC[REAL_ARITH` a = &0 <=> -- a = &0 `]);; +e (ONCE_REWRITE_TAC[REAL_ARITH` a = &0 <=> -- a = &0 `]);; +e (REWRITE_TAC[REAL_POLY_CONV` --((ty' * b1) * ty * b2 - (tx + ty * b1) * (tx' + ty' * b2)) `]);; +e (UNDISCH_TAC ` &0 < b1 `);; +e (UNDISCH_TAC ` &0 < b2 `);; +e (UNDISCH_TAC ` &0 < tx `);; +e (UNDISCH_TAC ` &0 < ty `);; +e (UNDISCH_TAC ` &0 < tx' `);; +e (UNDISCH_TAC ` &0 < ty' `);; +e (PHA);; +e (NHANH (MESON[REAL_LT_MUL]` + &0 < ty' /\ &0 < tx' /\ &0 < ty /\ &0 < tx /\ &0 < b2 /\ &0 < b1 + ==> &0 < b1 * tx' * ty /\ &0 < b2 * tx * ty' /\ &0 < tx * tx' `));; +e (MESON_TAC[REAL_LT_IMP_NZ; REAL_LT_ADD]);; +let BAJSVHC = top_thm();; + + + + + diff --git a/legacy/oldleg/collect_geom_a.ml b/legacy/oldleg/collect_geom_a.ml new file mode 100644 index 0000000..84325ab --- /dev/null +++ b/legacy/oldleg/collect_geom_a.ml @@ -0,0 +1,6 @@ +let DOT_BASIS_BASIS_UNEQUAL = prove(`!i j. ~(i = j) ==> (basis i) dot (basis j) = &0`, + SIMP_TAC[basis; dot; LAMBDA_BETA] THEN ONCE_REWRITE_TAC[COND_RAND] THEN + SIMP_TAC[SUM_0; REAL_MUL_RZERO; REAL_MUL_LZERO; COND_ID]);; + + + diff --git a/legacy/oldleg/collect_geom_error.ml b/legacy/oldleg/collect_geom_error.ml new file mode 100644 index 0000000..d753ffe --- /dev/null +++ b/legacy/oldleg/collect_geom_error.ml @@ -0,0 +1,70 @@ +(* Moved by Thales from collect_geom.ml on Nov 11, 2008 because of + syntax and proof errors. *) + +(* VUONG ANH QUYEN *) +let line_exists = prove +( ` ? l:real^N ->real^N ->(real^N->bool). ! (u:real^N) v. ~(u = v) + ==> (line (l u v))/\(u IN (l u v))/\(v IN (l u v))/\ + (! d:real^N->bool. (line d)/\ (u IN d)/\ (v IN d) ==> d = l u v)` + +let pr1 = prove +( ` ! (t:real) t'. ~(t = t') ==> +( (&1 - t') / (t - t') * t + (&1 - (&1 - t') / (t - t')) * t' = &1) /\ + ((&1 - t') / (t - t') * (&1 - t) + (&1 - (&1 - t') / (t - t')) * (&1 - t') = &0)`, +REPEAT GEN_TAC THEN ABBREV_TAC ` m:real = (&1 - t') / (t - t')` THEN +FIRST_X_ASSUM(LABEL_TAC "m" o GSYM) THEN +ONCE_REWRITE_TAC[REAL_ARITH ` ~(t:real = t') <=> ~(t - t' = &0)`] THEN +DISCH_TAC THEN FIRST_X_ASSUM (MP_TAC o (MATCH_MP REAL_DIV_RMUL)) THEN +DISCH_TAC THEN CONJ_TAC THENL +[REWRITE_TAC[ARITH_RULE `m * t + (&1 - m) * t' = m * (t - t') + t'`]; + REWRITE_TAC[ARITH_RULE `m * (&1 - t) + (&1 - m) * (&1 - t') = &1 - t' - m * (t - t')`]] THEN +ASM_REWRITE_TAC[] THEN ARITH_TAC) in + +let pr2 = prove +(`! (a:real^N) b u v. (a IN aff {u,v})/\(b IN aff {u,v}) ==>(aff {a,b} SUBSET aff {u,v})`, +REPEAT GEN_TAC THEN +DISCH_THEN (MP_TAC o (MATCH_MP (SET_RULE `! (a:A) b (M:A->bool). a IN M /\ b IN M ==> {a,b} SUBSET M`))) THEN +DISCH_THEN (MP_TAC o (MATCH_MP aff_SUBSET)) THEN +REWRITE_TAC[MATCH_MP aff_affine (SPEC_ALL affine_aff)] ) in + +let pr3 = prove +(` ! (u:real^N) v a b. ~(u = v)/\ (u IN aff {a,b}) /\ (v IN aff {a,b}) ==> (a IN aff {u,v})`, +REPEAT GEN_TAC THEN REWRITE_TAC[aff_2;IN_ELIM_THM] THEN STRIP_TAC THEN +ASM_CASES_TAC ` t:real = t'` THENL +[ ASM_MESON_TAC[]; EXISTS_TAC ` (&1 - t') / (t - t')` THEN + ASM_REWRITE_TAC[VECTOR_ADD_LDISTRIB;VECTOR_MUL_ASSOC ] THEN + ONCE_REWRITE_TAC[ VECTOR_ARITH ` ( (m:real^N) + n) + ( p + q) = ( m + p) +( n + q)`] THEN + ONCE_REWRITE_TAC[GSYM VECTOR_ADD_RDISTRIB ] THEN FIRST_X_ASSUM(MP_TAC o (MATCH_MP pr1)) THEN + MESON_TAC[ VECTOR_ARITH ` a:real^N = &1 % a + &0 % b`] ]) in + +let pr4 = prove +( `! (a:real^N) b u v. ~( u = v )/\ ( u IN aff {a,b})/\ (v IN aff {a,b}) ==> (aff {u,v} = aff {a,b})`, +REPEAT GEN_TAC THEN ONCE_REWRITE_TAC[GSYM SUBSET_ANTISYM_EQ] THEN DISCH_TAC THEN CONJ_TAC THENL +[ ASM_MESON_TAC[pr2];MATCH_MP_TAC(pr2)] THEN CONJ_TAC THENL +[ ASM_MESON_TAC[pr3];UNDISCH_TAC `~(u:real^N = v) /\ u IN aff {a, b} /\ v IN aff {a, b}` THEN +ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`] THEN MESON_TAC[pr3] ] ) in + +ABBREV_TAC ` l = (\ (u:real^N) v. aff {u,v})` THEN FIRST_X_ASSUM(LABEL_TAC "l" o GSYM) THEN +EXISTS_TAC `l:real^N ->real^N->(real^N->bool)` THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN +ASM_REWRITE_TAC[] THEN REPEAT CONJ_TAC THENL +[ ASM_MESON_TAC[line]; MP_TAC(SPEC ` ({u,v} :real^N->bool)` SUBSET_aff) THEN SET_TAC[]; + MP_TAC(SPEC ` ({u,v} :real^N->bool)` SUBSET_aff) THEN SET_TAC[];GEN_TAC THEN REWRITE_TAC[line] THEN + STRIP_TAC THEN ASM_MESON_TAC[pr4]]);; + +let line_match_def = new_specification ["line_match"] line_exists;; + +let line_unique = prove +(`! u:real^N v. ~(u = v) ==> (?! (d:real^N->bool). (line d)/\(u IN d)/\(v IN d))`, +MESON_TAC[line_match_def]);; + +let lemma4 = prove +(`! u:real^N v. ~(u=v) ==> aff {u,v} = line_match u v`, +REPEAT GEN_TAC THEN DISCH_TAC THEN +FIRST_ASSUM(MP_TAC o (MATCH_MP line_match_def)) THEN STRIP_TAC THEN +FIRST_ASSUM(MATCH_MP_TAC o (SPEC ` (aff {u, v}):real^N->bool`)) THEN +REPEAT CONJ_TAC THENL + [ ASM_MESON_TAC[line]; MP_TAC(SPEC ` ({u,v} :real^N->bool)` SUBSET_aff) THEN SET_TAC[]; + MP_TAC(SPEC ` ({u,v} :real^N->bool)` SUBSET_aff) THEN SET_TAC[]]);; + + diff --git a/legacy/oldleg/collect_geom_spec.ml b/legacy/oldleg/collect_geom_spec.ml new file mode 100644 index 0000000..c3b7f2c --- /dev/null +++ b/legacy/oldleg/collect_geom_spec.ml @@ -0,0 +1,2122 @@ +(* Nguyen Quang Truong *) +needs "Multivariate/vectors.ml";; (* Eventually should load entire *) +needs "Examples/analysis.ml";; (* multivariate-complex theory. *) +needs "Examples/transc.ml";; (* Then it won't need these three. *) +needs "convex_header.ml";; +needs "definitions_kepler.ml";; +let ups_x = new_definition ` ups_x x1 x2 x6 = + --x1 * x1 - x2 * x2 - x6 * x6 + + &2 * x1 * x6 + + &2 * x1 * x2 + + &2 * x2 * x6 `;; +let rho = new_definition ` rho (x12 :real) x13 x14 x23 x24 x34 = + --(x14 * x14 * x23 * x23) - + x13 * x13 * x24 * x24 - + x12 * x12 * x34 * x34 + + &2 * + (x12 * x14 * x23 * x34 + + x12 * x13 * x24 * x34 + + x13 * x14 * x23 * x24) `;; +let chi = new_definition ` chi x12 x13 x14 x23 x24 x34 = + x13 * x23 * x24 + + x14 * x23 * x24 + + x12 * x23 * x34 + + x14 * x23 * x34 + + x12 * x24 * x34 + + x13 * x24 * x34 - + &2 * x23 * x24 * x34 - + x12 * x34 * x34 - + x14 * x23 * x23 - + x13 * x24 * x24 `;; +let delta = new_definition ` delta x12 x13 x14 x23 x24 x34 = + --(x12 * x13 * x23) - + x12 * x14 * x24 - + x13 * x14 * x34 - + x23 * x24 * x34 + + x12 * x34 * (--x12 + x13 + x14 + x23 + x24 - x34) + + x13 * x24 * (x12 - x13 + x14 + x23 - x24 + x34 ) + + x14 * x23 * ( x12 + x13 - x14 - x23 + x24 + x34 ) `;; + +let eta_v = new_definition ` eta_v v1 v2 (v3: real^N) = + let e1 = dist (v2, v3) in + let e2 = dist (v1, v3) in + let e3 = dist (v2, v1) in + e1 * e2 * e3 / sqrt ( ups_x (e1 pow 2 ) ( e2 pow 2) ( e3 pow 2 ) ) `;; + +let plane_norm = new_definition ` + plane_norm p <=> + (?n v0. ~(n = vec 0) /\ p = {v | n dot (v - v0) = &0}) `;; + +let circumradius = new_definition ` circumradius s = (@r. ? x. x IN s /\ + r = dist( x , circumcenter s ) )`;; + +let delta_x12 = new_definition ` delta_x12 x12 x13 x14 x23 x24 x34 = + -- x13 * x23 + -- x14 * x24 + x34 * ( -- x12 + x13 + x14 + x23 + x24 + -- x34 ) + + -- x12 * x34 + x13 * x24 + x14 * x23 `;; + +let delta_x13 = new_definition` delta_x13 x12 x13 x14 x23 x24 x34 = + -- x12 * x23 + -- x14 * x34 + x12 * x34 + x24 * ( x12 + -- x13 + x14 + x23 + + -- x24 + x34 ) + -- x13 * x24 + x14 * x23 `;; + +let delta_x14 = new_definition`delta_x14 x12 x13 x14 x23 x24 x34 = + --x12 * x24 + + --x13 * x34 + + x12 * x34 + + x13 * x24 + + x23 * (x12 + x13 + --x14 + --x23 + x24 + x34) + + --x14 * x23`;; + +let delta_x34 = new_definition` delta_x34 x12 x13 x14 x23 x24 x34 = +-- &2 * x12 * x34 + + --x13 * x14 + + --x23 * x24 + + x13 * x24 + + x14 * x23 + + --x12 * x12 + + x12 * x14 + + x12 * x24 + + x12 * x13 + + x12 * x23`;; + +let delta_x23 = new_definition ` delta_x23 x12 x13 x14 x23 x24 x34 = + --x12 * x13 + + --x24 * x34 + + x12 * x34 + + x13 * x24 + + --x14 * x23 + + x14 * (x12 + x13 - x14 - x23 + x24 + x34) `;; + + +let max_real3 = new_definition ` max_real3 x y z = max_real (max_real x y ) z `;; +let ups_x_pow2 = new_definition` ups_x_pow2 x y z = ups_x ( x*x ) ( y * y) ( z * z)`;; + + +let condA = new_definition `condA (v1:real^3) v2 v3 v4 x12 x13 x14 x23 x24 x34 = + ( ~ ( v1 = v2 ) /\ coplanar {v1,v2,v3,v4} /\ + ( dist ( v1, v2) pow 2 ) = x12 /\ + dist (v1,v3) pow 2 = x13 /\ + dist (v1,v4) pow 2 = x14 /\ + dist (v2,v3) pow 2 = x23 /\ dist (v2,v4) pow 2 = x24 )`;; +(* def 26. p 22 *) +let condC = new_definition ` condC M13 m12 m14 M24 m34 (m23:real) = + ((! x. x IN {M13, m12, m14, M24, m34, m23 } ==> &0 <= x ) /\ + M13 <= m12 + m23 /\ + M13 <= m14 + m34 /\ + M24 < m12 + m14 /\ + M24 < m23 + m34 /\ + &0 <= delta (M13 pow 2) (m12 pow 2) (m14 pow 2) (M24 pow 2) (m34 pow 2 ) + (m23 pow 2 ) )`;; + +let condF = new_definition` condF m14 m24 m34 M23 M13 M12 = + ((!x. x IN {m14, m24, m34, M23, M13, M12} ==> &0 < x) /\ + M12 < m14 + m24 /\ + M13 < m14 + m34 /\ + M23 < m24 + m34 /\ + &0 < + delta (m14 pow 2) (m24 pow 2) (m34 pow 2) (M23 pow 2) (M13 pow 2) + (M12 pow 2)) `;; + +let condS = new_definition ` condS m m34 M13 M23 <=> + (!t. t IN {m, m34, M13, M23} ==> &0 < t) /\ + M13 < m + m34 /\ + M23 < m + m34 /\ + M13 pow 2 < M23 pow 2 + &4 * m * m /\ + M23 pow 2 < M13 pow 2 + &4 * m * m /\ + (!r. delta (&4 * m * m) (M13 pow 2) (M23 pow 2) r (M13 pow 2) (M23 pow 2) = &0 + ==> r < &4 * m34 * m34) `;; + +let cos_arc = new_definition` cos_arc (a:real) b c = + ( a pow 2 + b pow 2 - c pow 2 )/ ( &2 * a * b ) `;; + +let muy_v = new_definition ` muy_v (x1: real^N ) (x2:real^N) (x3:real^N) (x4:real^N) +(x5:real^N) x45 = + (let x12 = dist (x1,x2) pow 2 in + let x13 = dist (x1,x3) pow 2 in + let x14 = dist (x1,x4) pow 2 in + let x15 = dist (x1,x5) pow 2 in + let x23 = dist (x2,x3) pow 2 in + let x24 = dist (x2,x4) pow 2 in + let x25 = dist (x2,x5) pow 2 in + let x34 = dist (x3,x4) pow 2 in + let x35 = dist (x3,x5) pow 2 in + cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45) `;; +(* dedinition of E. page 34 *) +let sqrt_of_ge_root = new_definition ` +sqrt_of_ge_root y14 y24 y34 y12 y13 y23 y15 y25 y35 = + (@r. ?le ge a. + le <= ge /\ + r = sqrt ge /\ + (!x. cayleyR (y12 pow 2) (y13 pow 2) (y14 pow 2) + (y15 pow 2) + (y23 pow 2) + (y24 pow 2) + (y25 pow 2) + (y34 pow 2) + (y35 pow 2) + x = + a * (x - le) * (x - ge))) `;; +(* Lemma 2, page 6 *) +let RHUFIIB = ` !x12 x13 x14 x23 x24 x34. + rho x12 x13 x14 x23 x24 x34 * ups_x x34 x24 x23 = + chi x12 x13 x14 x23 x24 x34 pow 2 + + &4 * delta x12 x13 x14 x23 x24 x34 * x34 * x24 * x23 `;; +(* Lemma 3, *) +let NUHSVLM = ` !x1 x2 x3 x4 (x5 :real^3). + let x12 = dist (x1,x2) pow 2 in + let x13 = dist (x1,x3) pow 2 in + let x14 = dist (x1,x4) pow 2 in + let x15 = dist (x1,x5) pow 2 in + let x23 = dist (x2,x3) pow 2 in + let x24 = dist (x2,x4) pow 2 in + let x25 = dist (x2,x5) pow 2 in + let x34 = dist (x3,x4) pow 2 in + let x35 = dist (x3,x5) pow 2 in + let x45 = dist (x4,x5) pow 2 in + &0 <= ups_x x12 x13 x23 /\ + &0 <= delta x12 x13 x14 x23 x24 x34 /\ + cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 = &0 `;; +(* lemma 4, page 7 *) +let JVUNDLC = ` ! a b (c:real ) s. s = ( a + b + c ) / &2 ==> + &16 * s * (s - a) * (s - b) * (s - c) = + ups_x (a pow 2) (b pow 2) (c pow 2)`;; +(* lemma 5, page 12 *) +let RCEABUJ = ` ! a (b:real^3) x. line x /\ {a,b} SUBSET x /\ ~( a = b) + ==> x = aff {a,b} `;; +(* lem 6. p 12 *) +let BXVMKNF = ` ! u v:real ^3. ~( u=v) ==> plane_norm ( bis u v ) `;; +(* la 7. p 12 *) +let SMWTDMU = ` !x y z p. + plane p /\ ~collinear {x, y, z} /\ {x, y, z} SUBSET p + ==> p = aff {x, y, z}`;; +(* le 8. p 12 *) +let SGFCDZO = `! v1 v2 v3:real^3 t1 t2 (t3:real). + t1 % v1 + t2 % v2 + t3 % v3 = vec 0 /\ + t1 + t2 + t3 = &0 /\ + ~(t1 = &0 /\ t2 = &0 /\ t3 = &0) + ==> collinear {v1, v2, v3}`;; +let lemma8 = SGFCDZO;; +(* le 9. p 13 *) +let FHFMKIY = ` ! (v1: real^3) v2 v3 x12 x13 x23. + x12 = dist (v1,v2) pow 2 /\ + x13 = dist (v1,v3) pow 2 /\ + x23 = dist (v2,v3) pow 2 + ==> (collinear {v1, v2, v3} <=> ups_x x12 x13 x23 = &0)`;; +let lemma9 = FHFMKIY;; +(* le 10. p 14 *) +let ZPGPXNN = `! v1 v2 (v:real^3). + dist (v1,v2) < dist (v,v1) + dist (v,v2) ==> ~(v IN conv {v1, v2})`;; +let lemma10 = ZPGPXNN;; +(* le 11. p14 *) +let FAFKVLR = new_axiom ` ? t1 t2 t3. ! v1 v2 v3 (v:real^3). + v IN ( affine hull {v1,v2,v3} ) /\ + ~collinear {v1, v2, v3} + ==> v = t1 v1 v2 v3 v % v1 + t2 v1 v2 v3 v % v2 + t3 v1 v2 v3 v % v3 /\ + t1 v1 v2 v3 v + t2 v1 v2 v3 v + t3 v1 v2 v3 v = &1 /\ + (!ta tb tc. v = ta % v1 + tb % v2 + tc % v3 + ==> ta = t1 v1 v2 v3 v /\ + tb = t2 v1 v2 v3 v /\ + tc = t3 v1 v2 v3 v )`;; + +let equivalent_lemma = prove(` (?t1 t2 t3. + !v1 v2 v3 (v:real^N). + v IN affine hull {v1, v2, v3} /\ ~collinear {v1, v2, v3} + ==> v = + t1 v1 v2 v3 v % v1 + t2 v1 v2 v3 v % v2 + t3 v1 v2 v3 v % v3 /\ + t1 v1 v2 v3 v + t2 v1 v2 v3 v + t3 v1 v2 v3 v = &1 /\ + (!ta tb tc. + v = ta % v1 + tb % v2 + tc % v3 + ==> ta = t1 v1 v2 v3 v /\ + tb = t2 v1 v2 v3 v /\ + tc = t3 v1 v2 v3 v)) <=> + + ( !v1 v2 v3 (v:real^N). + v IN affine hull {v1, v2, v3} /\ ~collinear {v1, v2, v3} + ==> (?t1 t2 t3. + v = t1 % v1 + t2 % v2 + t3 % v3 /\ + t1 + t2 + t3 = &1 /\ + (!ta tb tc. + v = ta % v1 + tb % v2 + tc % v3 + ==> ta = t1 /\ tb = t2 /\ tc = t3))) `, +REWRITE_TAC[GSYM SKOLEM_THM; LEFT_FORALL_IMP_THM; RIGHT_EXISTS_IMP_THM]);; + +let lemma11 = REWRITE_RULE[equivalent_lemma] FAFKVLR;; +(* let COEFS = new_specification ["coef1"; "coef2"; "coef3"] FAFKVLR;; *) +let plane_3p = new_definition `plane_3p (a:real^3) b c = + {x | ~collinear {a, b, c} /\ + (?ta tb tc. ta + tb + tc = &1 /\ x = ta % a + tb % b + tc % c)}`;; +(* le 12. p 15 *) +let CNXIFFC = ` ! (v1:real^3) (v2:real^3) (v3:real^3) (v:real^3). ~ collinear {v1,v2,v3} /\ v IN affine hull +{v1, v2, v3} + ==> ( &0 < coef1 v1 v2 v3 v <=> v IN aff_gt {v2,v3} {v1} ) /\ + ( &0 = coef1 v1 v2 v3 v <=> v IN aff {v2,v3} ) /\ + ( coef1 v1 v2 v3 v < &0 <=> v IN aff_lt {v2,v3} {v1} ) /\ + ( &0 < coef2 v1 v2 v3 v <=> v IN aff_gt {v3,v1} {v2} ) /\ + ( &0 = coef2 v1 v2 v3 v <=> v IN aff {v3,v1} ) /\ + ( coef2 v1 v2 v3 v < &0 <=> v IN aff_lt {v3,v1} {v2} )/\ + ( &0 < coef3 v1 v2 v3 v <=> v IN aff_gt {v1,v2} {v3} ) /\ + ( &0 = coef3 v1 v2 v3 v <=> v IN aff {v1,v2} ) /\ + ( coef3 v1 v2 v3 v < &0 <=> v IN aff_lt {v1,v2} {v3})`;; +let lemma12 = CNXIFFC;; +(* le 13. p 15 *) +let MYOQCBS = ` ! v1 v2 v3 (v:real^3). ~ collinear {v1,v2,v3}/\ + v IN affine hull {v1,v2,v3} ==> + ( v IN conv {v1,v2,v3} <=> &0 <= coef1 v1 v2 v3 v /\ &0 <= coef2 v1 v2 v3 v /\ + &0 <= coef3 v1 v2 v3 v ) /\ + ( v IN conv0 {v1,v2,v3} <=> &0 < coef1 v1 v2 v3 v /\ &0 < coef2 v1 v2 v3 v /\ + &0 < coef3 v1 v2 v3 v )`;; +let lemma13 = MYOQCBS;; +(* le 14. p 15 *) + +let TXDIACY = `! (a:real^3) b c d (v0: real^3) r. + {a, b, c, d} SUBSET normball v0 r + ==> convex hull {a, b, c, d} SUBSET normball v0 r `;; + +(* le 15. p 16 *) +let POLFLZY = ` ! x1 x2 x3 (x4: real^3). + let x12 = dist (x1,x2) pow 2 in + let x13 = dist (x1,x3) pow 2 in + let x14 = dist (x1,x4) pow 2 in + let x23 = dist (x2,x3) pow 2 in + let x24 = dist (x2,x4) pow 2 in + let x34 = dist (x3,x4) pow 2 in + coplanar {x1, x2, x3, x4} <=> delta x12 x13 x14 x23 x24 x34 = &0 `;; +(* =============== *) +(* ==== * ===== *) +(* == * * == *) +(* * *) +(* 3 rd time *) +(* =============== *) + +(* le 16 *) +let SDIHJZK = `! (v1:real^3) v2 v3 (a01: real) a02 a03. + ~collinear {v1, v2, v3} /\ + (let x12 = d3 v1 v2 pow 2 in + let x13 = d3 v1 v3 pow 2 in + let x23 = d3 v2 v3 pow 2 in delta a01 a02 a03 x23 x13 x12 = &0) + ==> (?!v0. a01 = d3 v0 v1 pow 2 /\ + a02 = d3 v0 v2 pow 2 /\ + a03 = d3 v0 v3 pow 2 /\ + (let x12 = d3 v1 v2 pow 2 in + let x13 = d3 v1 v3 pow 2 in + let x23 = d3 v2 v3 pow 2 in + let vv = ups_x x12 x13 x23 in + let t1 = delta_x12 a01 a02 a03 x23 x13 x12 / vv in + let t2 = delta_x13 a01 a02 a03 x23 x13 x12 / vv in + let t3 = delta_x14 a01 a02 a03 x23 x13 x12 / vv in + v0 = t1 % v1 + t2 % v2 + t3 % v3))`;; + +(* le 17, p 17 *) +let CDEUSDF = `!(va:real^3) vb vc a b c. + a = d3 vb vc /\ b = d3 va vc /\ c = d3 va vb /\ ~collinear {va, vb, vc} + ==> (?p. p IN affine hull {va, vb, vc} /\ + (?c. !w. w IN {va, vb, vc} ==> c = dist (p,w)) /\ + (!p'. p' IN affine hull {va, vb, vc} /\ + (?c. !w. w IN {va, vb, vc} ==> c = dist (p',w)) + ==> p = p')) /\ + (let al_a = + (a pow 2 * (b pow 2 + c pow 2 - a pow 2)) / + (ups_x (a pow 2) (b pow 2) (c pow 2)) in + let al_b = + (b pow 2 * (a pow 2 + c pow 2 - b pow 2)) / + (ups_x (a pow 2) (b pow 2) (c pow 2)) in + let al_c = + (c pow 2 * (a pow 2 + b pow 2 - c pow 2)) / + (ups_x (a pow 2) (b pow 2) (c pow 2)) in + al_a % va + al_b % vb + al_c % vc = circumcenter {va, vb, vc}) /\ + radV {va, vb, vc} = eta_y a b c`;; + +let CDEUSDF_CHANGE = `!(va:real^3) vb vc a b c. + a = d3 vb vc /\ b = d3 va vc /\ c = d3 va vb /\ ~collinear {va, vb, vc} + ==> (?p. p IN affine hull {va, vb, vc} /\ + (?c. !w. w IN {va, vb, vc} ==> c = dist (p,w)) /\ + (!p'. p' IN affine hull {va, vb, vc} /\ + (?c. !w. w IN {va, vb, vc} ==> c = dist (p',w)) + ==> p = p')) /\ + (let al_a = + (a pow 2 * (b pow 2 + c pow 2 - a pow 2)) / + (ups_x (a pow 2) (b pow 2) (c pow 2)) in + let al_b = + (b pow 2 * (a pow 2 + c pow 2 - b pow 2)) / + (ups_x (a pow 2) (b pow 2) (c pow 2)) in + let al_c = + (c pow 2 * (a pow 2 + b pow 2 - c pow 2)) / + (ups_x (a pow 2) (b pow 2) (c pow 2)) in + al_a % va + al_b % vb + al_c % vc = circumcenter {va, vb, vc}) /\ + radV {va, vb, vc} = eta_y a b c`;; +(* le 18, p 17 *) +let WSMRDKN = `!x y z p. + d3 x z pow 2 < d3 x y pow 2 + d3 y z pow 2 /\ + ~collinear {x, y, z} /\ + p = circumcenter {x, y, z} + ==> p IN aff_gt {x, z} {y} `;; + + +(* le 19. p 17 *) +let BYOWBDF = `! a b c a' b' ( c':real). +&0 < a /\ + a <= a' /\ + &0 < b /\ + b <= b' /\ + &0 < c /\ + c <= c' /\ + a' pow 2 <= b pow 2 + c pow 2 /\ + b' pow 2 <= a pow 2 + c pow 2 /\ + c' pow 2 <= a pow 2 + b pow 2 + ==> eta_y a b c <= eta_y a' b' c' `;; + +(* le 20, p 18 *) +let BFYVLKP = ` ! x y z: real^3. + &2 <= d3 x y /\ + d3 x y <= #2.52 /\ + &2 <= d3 x z /\ + d3 x z <= #2.2 /\ + &2 <= d3 y z /\ + d3 y z <= #2.2 + ==> ~collinear {x, y, z} /\ radV {x, y, z} < sqrt (&2)`;; +(* le 21. p 18 *) +let WDOMZXH = ` ! y. &2 <= y /\ y <= sqrt8 ==> eta_y y (&2) #2.51 < #1.453`;; +(* le 22. p 18 *) +let ZEDIDCF = ` ! v0 v1 (v2:real^3). + &2 <= d3 v0 v1 /\ + d3 v0 v1 <= #2.51 /\ + #2.45 <= d3 v1 v2 /\ + d3 v1 v2 <= #2.51 /\ + #2.77 <= d3 v0 v2 /\ + d3 v0 v2 <= sqrt8 + ==> sqrt2 < radV {v0, v1, v2}`;; +(* le 23, p 19 *) +let NHSJMDH = ` ! y. #2.696 <= y /\ y <= sqrt8 ==> + eta_y y (&2) (#2.51) <= eta_y y #2.45 (#2.45) `;; + +(* le 24 , p 19 *) +let HVXIKHW = ` ! x y z. &0 <= x /\ &0 <= y /\ &0 <= z /\ + &0 < ups_x_pow2 x y z ==> max_real3 x y z / &2 <= eta_y x y z `;; +(* le 25. p 19 *) +let HMWTCNS = ` ! a b (c:real^3). + packing {a, b, c} /\ ~ collinear {a,b,c} + ==> &2 / sqrt (&3) <= radV {a, b, c}`;; +(* le 26 . p 20 *) +let POXDVXO = ` ! v1 v2 (v3:real^3) p. + ~collinear {v1, v2, v3} /\ + p = circumcenter {v1, v2, v3} + ==> (p - &1 / &2 % (v1 + v2)) dot (v1 - v2) = &0 /\ + ( p - &1 / &2 % ( v2 + v3 )) dot (v2 - v3 ) = &0 /\ + ( p - &1 / &2 % ( v3 + v1 )) dot ( v3 - v1 ) = &0 `;; +(* le 27. p 20 *) +let MAEWNPU = new_axiom ` ? b c. ! x12 x13 x14 x23 x24 x34. + delta x12 x13 x14 x23 x24 x34 = -- x12 * ( x34 pow 2 ) + b x12 x13 x14 x23 x24 * x34 + + c x12 x13 x14 x23 x24`;; + +let DELTA_COEFS = new_specification ["b_coef"; "c_coef"] MAEWNPU;; +(* le 28. p 20 *) +let AGBWHRD = ` ! x12 x13 x14 x23 x24. + !x12 x13 x14 x23 x24. + b_coef x12 x13 x14 x23 x24 pow 2 + + &4 * x12 * c_coef x12 x13 x14 x23 x24 = + ups_x x12 x23 x13 * ups_x x12 x24 x14 `;; + +(* le 29 . p 21 *) +let VCRJIHC = ` ! x34 x12 x13 v1 x14 v3 x23 v2 v4 x24. + condA v1 v2 v3 v4 x12 x13 x14 x23 x24 x34 ==> + muy_delta x12 x13 x14 x23 x24 ( dist( v3,v4) pow 2 ) = &0 `;; +(* le 30. p21 *) +let EWVIFXW = ` !v1 v2 v3 v4 x12 x13 x14 x23 x24 x34 a b c. + condA v1 v2 v3 v4 x12 x13 x14 x23 x24 x34 /\ + (!x12 x13 x14 x23 x24 x34. + muy_delta x12 x13 x14 x23 x24 x34 = + a x12 x13 x14 x23 x24 * x34 pow 2 + + b x12 x13 x14 x23 x24 * x34 + + c x12 x13 x14 x23 x24 ) + ==> (v3 IN aff {v1, v2} \/ v4 IN aff {v1, v2} <=> + b x12 x13 x14 x23 x24 pow 2 - + &4 * a x12 x13 x14 x23 x24 * c x12 x13 x14 x23 x24 = + &0)`;; + +(* le 31. p 21 *) +let FFBNQOB = ` !v1 v2 v3 v4 x12 x13 x14 x23 x24 x34. + !v1 v2 v3 v4 x12 x13 x14 x23 x24 x34. + condA v1 v2 v3 v4 x12 x13 x14 x23 x24 x34 /\ + ~(conv {v3, v4} INTER affine hull {v1, v2} = {}) + ==> muy_delta x12 x13 x14 x23 x24 (dist (v3,v4) pow 2) = &0 /\ + (!root. muy_delta x12 x13 x14 x23 x24 root = &0 + ==> root <= dist (v3,v4) pow 2) `;; +(* le 32 . p 21 *) +let CHHSZEO = `!v1 v2 v3 v4 x12 x13 x14 x23 x24 x34. + condA v1 v2 v3 v4 x12 x13 x14 x23 x24 x34 /\ + conv {v3, v4} INTER affine hull {v1, v2} = {} + ==> muy_delta x12 x13 x14 x23 x24 (dist (v3,v4) pow 2) = &0 /\ + (!root. muy_delta x12 x13 x14 x23 x24 root = &0 + ==>dist (v3,v4) pow 2 <= root )`;; + +(* le 33. P 22 *) + +let CMUDPKT = ` !x34 x12 x13 v1 x14 v3 x23 v2 v4 x24 x34' x34'' a. + condA v1 v2 v3 v4 x12 x13 x14 x23 x24 x34 /\ x34' <= x34'' /\ + (! x. muy_delta x12 x13 x14 x23 x24 x = a * ( x - x34' ) * ( x - x34'')) + ==> delta_x34 x12 x13 x14 x23 x24 x34' = + sqrt (ups_x x12 x13 x23 * ups_x x12 x14 x24) /\ + delta_x34 x12 x13 x14 x23 x24 x34' = + --sqrt (ups_x x12 x13 x23 * ups_x x12 x14 x24) `;; + +(* le 34. p 22 *) +let CXWOCGN = ` !M13 m12 m14 M24 m34 m23 (v1:real^3) v2 v3 v4. + condC M13 m12 m14 M24 m34 m23 /\ + CARD {v1,v2,v3,v4} = 4 /\ + m12 <= d3 v1 v2 /\ + m23 <= d3 v2 v3 /\ + m34 <= d3 v3 v4 /\ + m14 <= d3 v1 v4 /\ + d3 v1 v3 < M13 /\ + d3 v2 v4 <= M24 ==> + conv {v1,v3} INTER conv {v2,v4} = {} `;; + +(* le 35. p 22 *) +let THADGSB = ` !M13 m12 m14 M24 m34 m23 v1 v2 v3 v4. + (!x. x IN {M13, m12, m14, M24, m34, m23} ==> &0 <= x) /\ + M13 < m12 + m23 /\ + M13 < m14 + m34 /\ + M24 < m12 + m14 /\ + M24 < m23 + m34 /\ + &0 < + delta (M13 pow 2) (m12 pow 2) (m14 pow 2) (M24 pow 2) (m34 pow 2) + (m23 pow 2) /\ + CARD {v1, v2, v3, v4} = 4 /\ + m12 <= d3 v1 v2 /\ + m23 <= d3 v2 v3 /\ + m34 <= d3 v3 v4 /\ + m14 <= d3 v1 v4 /\ + d3 v1 v3 <= M13 /\ + d3 v2 v4 <= M24 ==> conv {v1,v3} INTER conv {v2,v4} = {} `;; +(* le 36. p 23 *) +let ZZSBSIO = ` ! u v w. CARD {u,v,w} = 3 /\ packing {u,v,w} /\ + dist (u,v) < sqrt8 ==> dist (u,v) / &2 < dist (w, &1 / &2 % ( u + v )) `;; + +(* le 37. p24 *) +let JGYWWBX = ` ~ (?v1 v2 w1 (w2:real^3). + CARD {v1, v2, w1, w2} = 4 /\ + packing {v1, v2, w1, w2} /\ + dist (v1,w2) >= sqrt8 /\ + dist (v1,v2) <= #3.2 /\ + dist (w1,w2) <= sqrt8 /\ + ~(conv {v1, v2} INTER conv {w1, w2} = {}))`;; +(* le 38. p 24 *) +let PAHFWSI = ` !(v1:real^3) v2 v3 v4. + CARD {v1, v2, v3, v4} = 4 /\ + packing {v1, v2, v3, v4} /\ + dist (v1,v3) <= #3.2 /\ + #2.51 <= dist (v1,v2) /\ + dist (v2,v4) <= #2.51 + ==> conv {v1, v3} INTER conv {v2, v4} = {} `;; +(* le 39. p 24 *) +let UVGVIXB = ` ! (v1:real^3) v2 w1 w2. + CARD {v1, v2, w1, w2} = 4 /\ + packing {v1, v2, w1, w2} /\ + dist (w1,w2) <= #2.51 /\ + dist (v1,v2) <= #3.07 + ==> conv {w1, w2} INTER conv {v1, v2} = {}`;; +(* le 40 . p 25 *) +let PJFAYXI = ` ! (v1:real^3) v2 w1 w2. + CARD {v1, v2, w1, w2} = 4 /\ + packing {v1, v2, w1, w2} /\ + dist (v1,v2) <= #3.2 /\ + dist (w1,w2) <= #2.51 /\ + #2.2 <= dist (v1,w1) + ==> conv {v1, v2} INTER conv {w1, w2} = {}`;; +(* le 41. p 25 *) +let YXWIPMH = ` ! v1 v2 v3 (v4:real^3). + CARD {v1,v2,v3,v4} = 4 /\ + d3 v1 v2 = #2.51 /\ + d3 v1 v3 = &2 /\ + d3 v1 v4 = &2 /\ + d3 v2 v3 = &2 /\ + d3 v2 v4 = &2 + ==> d3 v3 v4 <= #3.114467 `;; +(* le 42. p 25 *) +let PAATDXJ = ` ! v1 v2 v3 (v4:real^3). + CARD {v1,v2,v3,v4} = 4 /\ + d3 v1 v2 = #2.51 /\ + d3 v1 v4 = #2.51 /\ + d3 v2 v3 = &2 /\ + d3 v3 v4 = &2 /\ + sqrt8 <= d3 v2 v4 + ==> d3 v1 v3 < #3.488 `;; + +(* le 43 . p 26 *) +let YJHQPAL = ` +!m14 m24 m34 M23 M13 M12. + condF m14 m24 m34 M23 M13 M12 + ==> ~(?v1 v2 v3 v4. + coplanar {v1, v2, v3, v4} /\ + v4 IN conv {v1, v2, v3} /\ + (let y12 = d3 v1 v2 in + let y13 = d3 v1 v3 in + let y14 = d3 v1 v4 in + let y23 = d3 v2 v3 in + let y24 = d3 v2 v4 in + let y34 = d3 v3 v4 in + m14 <= y14 /\ + m24 <= y24 /\ + m34 <= y34 /\ + y23 <= M23 /\ + y13 <= M13 /\ + y12 <= M12))`;; +(* le 44 . p 27 *) +let MPXSJDI = ` !m M13 M23 m34. condS m m34 M13 M23 + ==> ~(?v1 v2 v3 v4. + coplanar {v1, v2, v3, v4} /\ + v4 IN conv {v1, v2, v3} /\ + m <= d3 v1 v4 /\ + m <= d3 v2 v4 /\ + m34 <= d3 v3 v4 /\ + d3 v2 v3 <= M23 /\ + d3 v1 v3 <= M13)`;; +(* le 45. p 30 *) + +let VMZBXSQ = ` !v0 v1 v2 (v3: real^3). + packing {v0, v1, v2, v3} /\ + CARD {v0, v1, v2, v3} = 4 /\ + d3 v0 v1 <= #2.51 /\ + d3 v0 v2 <= #2.51 /\ + d3 v0 v3 <= #2.51 /\ + d3 v1 v2 <= #3.2 /\ + #2.51 <= d3 v1 v3 + ==> rcone_gt v0 v3 (d3 v0 v3 / #2.51) INTER cone v0 {v1, v2} = {}`;; +let LEMMA45 = VMZBXSQ;; +(* le 46 . p 31 *) +let QNXDWNU = ` !v0 v1 v2 (v3:real^3). + packing {v0, v1, v2, v3} /\ + CARD {v0, v1, v2, v3} = 4 /\ + d3 v0 v2 <= #2.23 /\ + d3 v0 v3 <= #2.23 /\ + #2.77 <= d3 v2 v3 /\ + d3 v2 v3 <= sqrt8 /\ + (!x. x IN {v0, v2, v3} ==> d3 v1 x <= #2.51) + ==> rcone_gt v0 v1 (d3 v0 v1 / #2.77) INTER cone v0 {v2, v3} = {}`;; +let LEMMA46 = QNXDWNU ;; +(* le 47. p 32 *) +let PNUMEHN = `! v0 v1 v2 (v3 :real^3). packing {v0,v1,v2,v3} /\ + #2.51 <= d3 v1 v2 /\ #2.51 <= d3 v1 v3 /\ + d3 v2 v3 <= #3.2 ==> + let y = d3 v0 v1 in + let h = cos_arc y ( #1.255 ) ( #1.6 ) in + cone v0 {v2,v3} INTER rcone_gt v0 v1 h = {} `;; +let LEMAA47 = PNUMEHN ;; + +(* le 48 . p 33 *) +let HLAHAUS = ` !v0 v1 v2 (v3:real^3). + packing {v0, v1, v2, v3} /\ + d3 v1 v2 = &2 /\ + #3.2 <= d3 v1 v3 /\ + d3 v2 v3 <= #3.2 /\ + ( let y = d3 v0 v1 in + #2.2 <= y /\ y <= #2.51 ) + ==> (let y = d3 v0 v1 in + let h = cos_arc y #2.255 #1.6 in + cone v0 {v2, v3} INTER rcone_gt v0 v1 h = {})`;; +(* le 49 . p 33 *) + +let RISDLIH = ` ! v0 v1 v2 (v3:real^3). d3 v0 v2 <= #2.51 /\ + d3 v0 v3 <= #2.51 /\ + d3 v1 v2 = &2 /\ + #3.2 <= d3 v1 v3 /\ + (let y = d3 v0 v1 in + &2 <= y /\ y <= #2.2 /\ d3 v2 v3 <= #3.2 ) + ==> ((let y = d3 v0 v1 in let h = cos_arc y #1.255 #1.6 in h = &1))`;; +(* ====================== *) + +(* lemma 50. p 34 *) + +let LTCTBAN = `! x12 x13 x14 x15 x23 x24 x25 x34 x35 x45. + cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 = +ups_x x12 x13 x23 * x45 pow 2 + cayleytr x12 x13 x14 x15 x23 x24 x25 x34 x35 ( &0 ) +* x45 + cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 ( &0 ) `;; +(* lemma 51. p 34 *) +let GJWYYPS = `!x12 x13 x14 x15 x23 x24 x25 x34 x35 a b c. + (! x45. cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 = + a * x45 pow 2 + b * x45 + c ) + ==> b pow 2 - &4 * a * c = + &16 * delta x12 x13 x14 x23 x24 x34 * delta x12 x13 x15 x23 x25 x35`;; + +(* le 52 *) +let PFDFWWV = ` ! v1 v2 v3 v4 (v5:real^3). + muy_v v1 v2 v3 v4 v5 ( (d3 v4 v5) pow 2 ) = &0 `;; +(* le 53 .p 35 *) +let GDLRUZB = `!v1 v2 v3 v4 v5 a b c. + coplanar {v1, v2, v3, v4} \/ coplanar {v1, v2, v3, v5} <=> + (!a b c. + (!x. muy_v v1 v2 v3 v4 v5 x = a * x pow 2 + b * x + c) + ==> b pow 2 - &4 * a * c = &0)`;; +(* le 54. p 35 *) +let KGSNYDS = `! v1 v2 v3 v4 (v5:real^3). + ~ collinear {v1,v2,v3} /\ conv {v4,v5} INTER affine hull {v1,v2,v3} = {} + ==> muy_v v1 v2 v3 v4 v5 (( d3 v4 v5) pow 2 ) = &0 /\ + (! x. muy_v v1 v2 v3 v4 v5 x = &0 ==> + x <= ( d3 v4 v5) pow 2 ) `;; +(* le 55. p 36 *) +let KGSNYDS = `! v1 v2 v3 v4 (v5:real^3). + ~ collinear {v1,v2,v3} /\ ~ (conv0 {v4,v5} INTER affine hull {v1,v2,v3} = {} ) + ==> muy_v v1 v2 v3 v4 v5 (( d3 v4 v5) pow 2 ) = &0 /\ + (! x. muy_v v1 v2 v3 v4 v5 x = &0 ==> + d3 v4 v5 pow 2 <= x )`;; +(* le 56. p 36 *) +let QHSEWMI = `!v1 v2 v3 w1 w2. + ~(conv {w1, w2} INTER conv {v1, v2, v3} = {}) /\ + ~(w1 IN conv {v1, v2, v3}) + ==> w2 IN cone w1 {v1, v2, v3}`;; +(* lemma 57. p 36 *) +let LEMMA57 = ` !v1 v2 v3 w1 (w2: real^3). + packing {v1, v2, v3, w1, w2} /\ + CARD {v1, v2, v3, w1, w2} = 5 /\ + ~collinear {v1, v2, v3} /\ + radV {v1, v2, v3} < sqrt2 /\ + d3 w1 w2 < sqrt8 + ==> conv {v1, v2, v3} INTER conv {w1, w2} = {}`;; +let DOUFCOI = LEMMA57;; + + +let LEMMA58 = `! m12 m13 m14 m25 m35 m45 M23 M34 M24 M15. + (!x. x IN {m12, m13, m14, m25, m35, m45, M23, M34, M24, M15} + ==> &0 <= x) /\ + condC M15 m12 m13 M23 m35 m25 /\ + condC M15 m13 m14 M34 m45 m35 /\ + condC M15 m12 m24 M24 m45 m25 /\ + condF m25 m35 m45 M34 M24 M23 /\ + condF m12 m13 m14 M34 M24 M23 /\ + M15 < sqrt_of_ge_root m12 m13 m14 M34 M24 M23 m25 m35 m45 + ==> ~(?(v1:real^3) v2 v3 v4 v5. + CARD {v11, v2, v3, v4, v5} = 5 /\ + ~collinear {v2, v3, v4} /\ + ~(conv {v1, v5} INTER conv {v2, v3, v4} = {}) /\ + (let x12 = dist (x1,x2) in + let x13 = dist (x1,x3) in + let x14 = dist (x1,x4) in + let x15 = dist (x1,x5) in + let x23 = dist (x2,x3) in + let x24 = dist (x2,x4) in + let x25 = dist (x2,x5) in + let x34 = dist (x3,x4) in + let x35 = dist (x3,x5) in + let x45 = dist (x4,x5) in + x15 <= M15 /\ + x23 <= M23 /\ + x24 <= M24 /\ + x34 <= M34 /\ + x12 >= m12 /\ + x13 >= m13 /\ + x14 >= m14 /\ + x25 >= m25 /\ + x35 >= m35 /\ + x45 >= m45)) `;; +let UQQVJON = LEMMA58;; + + + +(* lemma 59. p 36 *) +let LEMMA59 = ` !v1 v2 v3 v4 ( v5:real^3). + packing {v1, v2, v3, v4, v5} /\ + CARD {v1, v2, v3, v4,v5} = 5 /\ + d3 v2 v3 <= #2.52 /\ + d3 v3 v4 <= #2.52 /\ + d3 v4 v2 <= #2.52 /\ + d3 v1 v5 <= sqrt8 /\ + ~(conv {v1, v5} INTER conv {v2, v3, v4} = {}) + ==> (!aa bb. + aa IN {v1, v5} /\ bb IN {v2, v3, v4} ==> d3 aa bb <= #2.2)`;; +let FRCXQKB = LEMMA59 ;; +(* lemma 60 , p 38 *) +let LEMMA60 = `!v0 v1 v2 v3 v4. + packing {v1, v2, v3, v4, v0} /\ + CARD {v1, v2, v3, v4, v0} = 5 /\ + (!x. x IN {v1, v2, v3, v4} ==> d3 v0 x <= #2.51) /\ + d3 v1 v3 <= #2.51 /\ + d3 v2 v4 <= #2.51 + ==> {v0} = cone v0 {v1, v3} INTER cone v0 {v1, v4}`;; +let ZHBBLXP = LEMMA60 ;; +(* le 62. p 40 *) +let LEMMA62 = ` ! v0 v1 v2 v (w:real^3). + ~ ( CARD {v0, v1, v2, v, w} = 5 /\ + ~(conv {v, w} INTER cone v0 {v1, v2} = {}) /\ + (!u. u IN {v1, v2, v, w} ==> &2 <= d3 u v0 /\ d3 u v0 <= #2.51) /\ + #3.2 <= d3 v v1 /\ + &2 <= d3 v v2 /\ + &2 <= d3 w v2 /\ + &2 <= d3 w v1 /\ + d3 v w <= #2.2 /\ + &2 <= d3 v2 v1 /\ + d3 v1 v2 <= #3.2 ) `;; +let VNZLYWT = LEMMA62;; +(* le 63. p 42 *) +let LEMMA63 = ` ! v0 v1 v2 v3 (w:real^3). +CARD {v0, v1, v2, v3, w} = 5 /\ + #2.51 <= d3 w v0 /\ + d3 w v0 <= sqrt8 /\ + d3 v1 v3 <= sqrt8 /\ + (!u. u IN {v0, v1, v2, v3, w} ==> d3 u v0 <= #2.51) /\ + ~(conv {v1, v3} INTER conv {v0, w, v2} = {}) + ==> min (d3 v1 v2) (d3 v2 v3) <= #2.51 /\ + (min (d3 v1 v2) (d3 v2 v3) = #2.51 + ==> d3 v1 v2 = #2.51 /\ d3 v2 v3 = two_t0) `;; +let VAXNRNE = LEMMA62;; +(* le 64. p 42 *) +let LEMMA64 = `! v0 v1 v2 v3 (v4:real^3). + CARD {v0, v1, v2, v3, v4} = 5 /\ + (!u v. u IN {v0, v2} /\ v IN {v1, v3, v4} ==> d3 u v <= two_t0) /\ + d3 v1 v3 <= sqrt8 /\ + d3 v0 v2 <= sqrt8 /\ + ~(conv {v1, v3} INTER conv {v0, v2, v4} = {}) + ==> d3 v1 v4 <= #3.2`;; +let GMOKOTN = LEMMA64;; +(* le 65. p 43 *) +let LEMMA65 = ` ! v0 v1 v2 (v3:real^3). + CARD {v0, v1, v2, v3} = 4 /\ + d3 v0 v1 <= two_t0 /\ + twp_t0 <= d3 v1 v2 /\ + (?a b c. + {a, b, c} = {v0, v2, v3} /\ + d3 a b <= two_t0 /\ + d3 b c <= two_t0 /\ + d3 a c <= sqrt8) + ==> rcone_gt v0 v1 (d3 v0 v1 / sqrt8) INTER cone v0 {v2, v3} = {} `;; +let EFXWFNQ = LEMMA65;; +(* lemma 66. p 43 *) +let LEMMA66 = ` ! v1 v2 v3 (v0:real^3). + CARD {v0, v1, v2, v3} = 4 /\ + packing {v0, v1, v2, v3} /\ + d3 v1 v2 <= #2.51 /\ + d3 v2 v3 <= #2.51 /\ + d3 v1 v3 <= sqrt8 /\ + ~(normball v0 (sqrt (&2)) INTER conv {v1, v2, v3} = {}) + ==> (!x. x IN {v1, v2, v3} ==> d3 v0 x <= #2.51) `;; +let LOKDUSSU = LEMMA66 ;; + +(* le 67. p 44 *) +let LEMMA67 = ` ! v1 v2 v3 (v0:real^3). + CARD {v0, v1, v2, v3} = 4 /\ + packing {v0, v1, v2, v3} /\ + d3 v1 v2 <= #2.51 /\ + d3 v2 v3 <= #2.51 /\ + d3 v1 v3 <= sqrt8 ==> +normball vo ( #1.255 ) INTER conv {v1,v2,v3} = {} `;; +let FFSXOWD = LEMMA67 ;; + +(* le 68 . p 44 *) + + +let LEMMA68 = ` ! v v1 v2 v3 (v4:real^3). +CARD {v, v1, v2, v3, v4} = 5 /\ + packing {v1, v2, v3, v4, v} /\ + (!x y. {x, y} SUBSET {v1, v2, v3, v4} ==> d3 x y <= sqrt8) + ==> ~(v IN conv {v1, v2, v3, v4}) `;; +let ZODWCKJ = LEMMA68 ;; + +(* le 69 . p45 *) + +let LEMMA69 = ` ! v v1 v2 v3 (v4:real^3). +CARD {v, v1, v2, v3, v4} = 5 /\ + packing {v1, v2, v3, v4, v} /\ + (!x y. {x, y} SUBSET {v1, v2, v3, v4} /\ ~ ( {x,y} = {v1,v2} ) ==> d3 x y < sqrt8) +==> ~ ( v IN conv {v1,v2,v3,v4} ) `;; +let KCGHSFF = LEMMA69 ;; + +(* le 70. p 45 *) + + +let LEMMA70 = ` ! v5 v1 v2 v3 (v4:real^3). +CARD {v5, v1, v2, v3, v4} = 5 /\ + packing {v1, v2, v3, v4, v5} /\ + (!x y. + {x, y} SUBSET {v1, v2, v3, v4, v5} /\ ~({x, y} = {v1, v4}) + ==> d3 x y <= sqrt8) + ==> ~(v5 IN conv {v1, v2, v3, v4}) `;; +let TEAULMK = LEMMA70 ;; + (* le 71 , p 46 *) +let LEMMA71 = ` ! w v v0 v1 (v2:real^3). + let t = #2.51 in + CARD {w, v, v0, v1, v2} = 5 /\ + packing {w, v, v0, v1, v2} /\ + d3 v v1 <= t /\ + d3 v v2 <= t /\ + d3 v0 v1 <= t /\ + d3 v0 v2 <= t /\ + d3 v0 v <= sqrt8 /\ + t <= d3 v0 w /\ + d3 v0 w <= sqrt8 /\ + w IN cone v0 {v1, v2, v} + ==> d3 w v <= t `;; +let EIYPZVL = LEMMA71;; +(* le 72. p 47 *) +let LEMMA72 = ` ! w v1 v2 v3 (v4:real^3). + CARD {w, v1, v2, v3, v4} = 5 /\ + packing {w, v1, v2, v3, v4} /\ + (let t = #2.51 in + d3 v2 v3 <= t /\ + d3 v3 v4 <= t /\ + d3 v2 v4 <= t /\ + t <= d3 v1 v2 /\ + t <= d3 v1 v3 /\ + d3 v1 v4 <= t /\ + d3 v1 w <= sqrt8 /\ + d3 v1 v2 <= sqrt8 /\ + d3 v1 v3 <= sqrt8) + ==> ~(w IN cone v1 {v2, v3, v4}) `;; +let VZETXZC = LEMMA72 ;; +(* le 73 . p 47 *) +let LEMMA73 = ` ! v1 v2 v3 (v4:real^3) a01 a02 a03 . + let x12 = d3 v1 v2 pow 2 in + let x13 = d3 v1 v3 pow 2 in + let x23 = d3 v2 v3 pow 2 in + CARD {v1, v2, v3, v4} = 4 /\ + packing {v1, v2, v3, v4} /\ + ~coplanar {v1, v2, v3, v4} /\ + &0 <= a01 /\ &0 <= a02 /\ &0 <= a03 /\ + delta a01 a02 a03 x12 x13 x23 >= &0 + ==> (?v0. v0 IN aff_ge {v1, v2, v3} {v4} /\ + d3 v0 v1 pow 2 = a01 /\ + d3 v0 v2 pow 2 = a02 /\ + d3 v0 v3 pow 2 = a03 /\ + (!vv0. vv0 IN aff_ge {v1, v2, v3} {v4} /\ + d3 vv0 v1 pow 2 = a01 /\ + d3 vv0 v2 pow 2 = a02 /\ + d3 vv0 v3 pow 2 = a03 + ==> vv0 = v0) /\ + ( v0 IN aff {v1,v2,v3} <=> + delta a01 a02 a03 x12 x13 x23 = &0 )) `;; +(* le 74 . p 48 *) +let LFYTDXC = new_axiom ` ? p. ! v1 v2 v3 (v4:real^3) r. + let s = {v1, v2, v3, v4} in + CARD s = 4 /\ + packing s /\ + ~coplanar s /\ + eta_y (d3 v1 v2 pow 2) (d3 v1 v3 pow 2) (d3 v2 v3 pow 2) <= r + ==> p v1 v2 v3 v4 r IN aff_ge {v1, v2, v3} {v4} /\ + r = d3 ( p v1 v2 v3 v4 r ) v1 /\ + r = d3 ( p v1 v2 v3 v4 r ) v2 /\ + r = d3 ( p v1 v2 v3 v4 r ) v3 /\ + (!w. w IN aff_ge {v1, v2, v3} {v4} /\ + r = d3 w v1 /\ + r = d3 w v2 /\ + r = d3 w v3 + ==> w = ( p v1 v2 v3 v4 r ) ) `;; + +let LEMMA74 = LFYTDXC;; +let point_eq = new_specification ["point_eq"] LFYTDXC;; + + +(* le 75 . p 48 *) +let LEMMA75 = ` !v1 v2 v3 (v4:real^3) r p p' u. let s = {v1,v2,v3,v4} in +let x12 = d3 v1 v2 pow 2 in +let x13 = d3 v1 v3 pow 2 in +let x23 = d3 v2 v3 pow 2 in +~ coplanar s /\ +CARD s = 4 /\ +eta_y x12 x13 x23 < r /\ +p' = point_eq v1 v2 v3 v4 r /\ +p = circumcenter {v1,v2,v3} /\ u IN aff {v1,v2,v3} ==> +( p' - p ) dot ( u - p ) = &0 `;; +let TIEEBHT = LEMMA75;; + +(* le 76 . p49 *) +let LEMMA76 = new_axiom` ?t1 t2 t3 t4. + !v1 v2 v3 v4 (v: real^3). + ~coplanar {v1, v2, v3, v4} + ==> t1 v1 v2 v3 v4 v + + t2 v1 v2 v3 v4 v + + t3 v1 v2 v3 v4 v + + t4 v1 v2 v3 v4 v = + &1 /\ + v = + t1 v1 v2 v3 v4 v % v1 + + t2 v1 v2 v3 v4 v % v2 + + t3 v1 v2 v3 v4 v % v3 + + t4 v1 v2 v3 v4 v % v4 /\ + (!ta tb tc td. + v = ta % v1 + tb % v2 + tc % v3 + td % v4 /\ + ta + tb + tc + td = &1 + ==> ta = t1 v1 v2 v3 v4 v /\ + tb = t2 v1 v2 v3 v4 v /\ + tc = t3 v1 v2 v3 v4 v /\ + td = t4 v1 v2 v3 v4 v) `;; +let ECSEVNC = LEMMA76 ;; +let COEFS_4 = new_specification ["COEF4_1"; "COEF4_2"; "COEF4_3"; "COEF4_4"] ECSEVNC ;; + +(* le 77. p 49 *)let LEMMA77 = ` ! v1 v2 v3 v4 (v:real^3). + ~ coplanar {v1,v2,v3,v4} ==> + ( COEF4_1 v1 v2 v3 v4 v < &0 <=> v IN aff_lt {v2,v3, v4} {v1} ) /\ + ( COEF4_1 v1 v2 v3 v4 v = &0 <=> v IN aff {v2,v3,v4} ) /\ + ( COEF4_1 v1 v2 v3 v4 v > &0 <=> v IN aff_gt {v2,v3,v4} {v1} ) /\ + ( COEF4_2 v1 v2 v3 v4 v < &0 <=> v IN aff_lt {v1,v3, v4} {v2} ) /\ + ( COEF4_2 v1 v2 v3 v4 v = &0 <=> v IN aff {v1,v3,v4} ) /\ + ( COEF4_2 v1 v2 v3 v4 v > &0 <=> v IN aff_gt {v1,v3,v4} {v2} ) /\ + ( COEF4_3 v1 v2 v3 v4 v < &0 <=> v IN aff_lt {v2,v1, v4} {v3} ) /\ + ( COEF4_3 v1 v2 v3 v4 v = &0 <=> v IN aff {v2,v1,v4} ) /\ + ( COEF4_3 v1 v2 v3 v4 v > &0 <=> v IN aff_gt {v2,v1,v4} {v3} )/\ + ( COEF4_4 v1 v2 v3 v4 v < &0 <=> v IN aff_lt {v2,v1, v3} {v4} ) /\ + ( COEF4_4 v1 v2 v3 v4 v = &0 <=> v IN aff {v2,v1,v3} ) /\ + ( COEF4_4 v1 v2 v3 v4 v > &0 <=> v IN aff_gt {v2,v1,v3} {v4} )`;; + +(* le 78 . p 50 *) +let LEMMA78 = ` ! v1 v2 v3 v4 (v:real^3). + ~coplanar {v1, v2, v3, v4} + ==> (v IN conv {v1, v2, v3, v4} <=> + &0 <= COEF4_1 v1 v2 v3 v4 v /\ + &0 <= COEF4_2 v1 v2 v3 v4 v /\ + &0 <= COEF4_3 v1 v2 v3 v4 v /\ + &0 <= COEF4_4 v1 v2 v3 v4 v) /\ + (v IN conv0 {v1, v2, v3, v4} <=> + &0 < COEF4_1 v1 v2 v3 v4 v /\ + &0 < COEF4_2 v1 v2 v3 v4 v /\ + &0 < COEF4_3 v1 v2 v3 v4 v /\ + &0 < COEF4_4 v1 v2 v3 v4 v) `;; +let ZRFMKPY = LEMMA78;; + + +(* le 79 . p 50 *) +let LEMMA79 = ` ! v0 v1 v2 v3 (v4:real^3). + let tt = #2.51 in + let ss = sqrt (&8) in + CARD {v0, v1, v2, v3, v4} = 5 /\ + packing {v1, v2, v3, v4, v0} /\ + (!v. v IN {v2, v3, v4} ==> d3 v1 v <= #2.51 /\ &2 <= d3 v1 v) /\ + tt < d3 v1 v0 /\ + d3 v1 v0 < ss /\ + d3 v0 v3 <= tt /\ + d3 v2 v4 <= tt /\ + d3 v0 v4 < ss /\ + d3 v0 v2 < ss /\ + ~( tt < d3 v0 v2 /\ tt < d3 v0 v4 ) + ==> ~ ( v3 IN aff_ge {v0,v1} {v2,v4} ) `;; + +let COEBRMF = LEMMA79 ;; + +(* le 80. p 51 *) +let LEMMA80 = ` ! v0 v1 v2 v3 (v4:real^N). + CARD {v0, v1, v2, v3, v4} = 5 /\ + (?x. ~(x = v0) /\ x IN cone v0 {v1, v3} INTER cone v0 {v2, v4}) + ==> ~(conv {v1, v3} INTER cone v0 {v2, v4} = {} /\ + conv {v2, v4} INTER cone v0 {v1, v3} = {})`;; +let JVDAFRS = LEMMA80;; + +let LEMMA81 = ` ! v1 v2 v3 (v4:real^3). + let s = {v1,v2,v3,v4} in + CARD s = 4 /\ ~ coplanar s ==> + conv s = aff_ge ( s DIFF {v1} ) {v1} INTER + aff_ge ( s DIFF {v2} ) {v2} INTER + aff_ge ( s DIFF {v3} ) {v3} INTER + aff_ge ( s DIFF {v4} ) {v4} `;; +let ARIKWRQ = LEMMA81 ;; + +(* le 82. p 52 *) +let LEMMA82 = ` ! v1 v2 v3 (v4:real^3). let s = {v1,v2,v3,v4} in + CARD s = 4 /\ coplanar s ==> + conv0 s = aff_gt ( s DIFF {v1} ) {v1} INTER + aff_gt ( s DIFF {v2} ) {v2} INTER + aff_gt ( s DIFF {v3} ) {v3} INTER + aff_gt ( s DIFF {v4} ) {v4} `;; +(* le 83. p 52 *) +let LEMMA83 = ` !(e1:real^3) e2 e3 a b c a' b' c' t1 t2 t3. + e1 = basis 1 /\ + e2 = basis 2 /\ + e3 = basis 3 /\ + &0 < a /\ + a <= b /\ + b <= c /\ + &0 < a' /\ + a' <= b' /\ + b' <= c' /\ + a <= a' /\ + b <= b' /\ + c <= c' /\ + (!x. x IN {t1, t2, t3} ==> &0 < x) /\ + t1 + t2 + t3 < &1 /\ + v = + ((t1 + t2 + t3) * a) % e1 + + ((t2 + t3) * sqrt (b pow 2 - a pow 2)) % e2 + + (t3 * sqrt (c pow 2 - b pow 2)) % e3 /\ + v' = ((t1 + t2 + t3) * a') % e1 + + ((t2 + t3) * sqrt (b' pow 2 - a' pow 2)) % e2 + + (t3 * sqrt (c' pow 2 - b' pow 2)) % e3 ==> + norm v <= norm v' `;; +let TYUNJNA = LEMMA83 ;; + +(* le 84. p 53 *) +let LEMMA84 = ` ! x1 x2 x3 (x4:real^3). + CARD {x1,x2,x3,x4} = 4 ==> + let x12 = dist (x1,x2) pow 2 in + let x13 = dist (x1,x3) pow 2 in + let x14 = dist (x1,x4) pow 2 in + let x23 = dist (x2,x3) pow 2 in + let x24 = dist (x2,x4) pow 2 in + let x34 = dist (x3,x4) pow 2 in + &0 <= rho x12 x13 x14 x23 x24 x34 `;; +let SHOGYBS = LEMMA84;; + +(* le 85. p53 *) + +let VBVYGGT = ` ! v1 v2 v3 (v4:real^3). + CARD {v1, v2, v3, v4} = 4 /\ ~coplanar {v1, v2, v3, v4} + ==> (?!p. p = circumcenter {v1, v2, v3, v4} /\ + (let x12 = dist (v1,v2) pow 2 in + let x13 = dist (v1,v3) pow 2 in + let x14 = dist (v1,v4) pow 2 in + let x23 = dist (v2,v3) pow 2 in + let x24 = dist (v2,v4) pow 2 in + let x34 = dist (v3,v4) pow 2 in + let chi11 = chi x12 x13 x14 x34 x24 x23 in + let chi22 = chi x12 x24 x23 x34 x13 x14 in + let chi33 = chi x34 x13 x23 x12 x24 x14 in + let chi44 = chi x34 x24 x14 x12 x13 x23 in + p = + &1 / (&2 * delta x12 x13 x14 x23 x24 x34) % + (chi11 % v1 + chi22 % v2 + chi33 % v3 + chi44 % v4))) `;; +let LEMMA85 = VBVYGGT;; + +(* le 86. p 54 *) + +let GDRQXLG = ` ! v1 v2 v3 (v4:real^3). + let s = {v1, v2, v3, v4} in +let x12 = dist (v1,v2) pow 2 in + let x13 = dist (v1,v3) pow 2 in + let x14 = dist (v1,v4) pow 2 in + let x23 = dist (v2,v3) pow 2 in + let x24 = dist (v2,v4) pow 2 in + let x34 = dist (v3,v4) pow 2 in + + CARD s = 4 /\ ~coplanar s + ==> radV s = + sqrt (rho x12 x13 x14 x23 x24 x34) / + (&2 * sqrt (delta x12 x13 x14 x23 x24 x34))` ;; +let LEMMA86 = GDRQXLG;; + +(* le 87. p 54 *) + +let ZJEWPAP = ` ! v1 v2 v3 (v4:real^3). + let s = {v1, v2, v3, v4} in CARD s = 4 /\ ~ coplanar s + ==> radV {v1,v2,v3} <= radV s `;; + + +(* LE 88, p 55 *) +let LEMMA88 = ` ! v1 v2 v3 (v4:real^3). + CARD {v1, v2, v3, v4} = 4 + ==> (let s = {v1, v2, v3, v4} in + let x12 = dist (v1,v2) pow 2 in + let x13 = dist (v1,v3) pow 2 in + let x14 = dist (v1,v4) pow 2 in + let x23 = dist (v2,v3) pow 2 in + let x24 = dist (v2,v4) pow 2 in + let x34 = dist (v3,v4) pow 2 in + orientation s v1 (\t. t < &0) <=> + chi x12 x13 x14 x23 x24 x34 < &0) `;; +let VSMPQYO = LEMMA88;; + +(* LE 89. p 55 *) + +let LEMMA89 = ` ! (v1:real^3) v2 v3 v4. + let s = {v1, v2, v3, v4} in + ~coplanar s + ==> (circumcenter s IN conv0 s <=> + orientation s v1 (\x. &0 < x) /\ + orientation s v2 (\x. &0 < x) /\ + orientation s v3 (\x. &0 < x) /\ + orientation s v4 (\x. &0 < x))`;; +let PVLJZLA = LEMMA89;; +(* le 90. p 55 *) + +let IAALCFJ = ` ! (v1:real^3) v2 v3 v4. + let s = {v1, v2, v3, v4} in + CARD s = 4 /\ + packing s /\ + (!x y. {x, y} SUBSET s ==> d3 x y <= sqrt8) /\ + orientation s v1 (\x. x < &0) + ==> (!x. x IN {v2, v3, v4} ==> orientation s x (\x. &0 <= x))`;; +let LEMMA90 = IAALCFJ ;; + +(* le 91 . p 55 *) + +let YOEEQPC = ` ! (v1:real^3) v2 v3 v4. + let s = {v1, v2, v3, v4} in + let tt = #2.51 in + CARD s = 4 /\ + packing s /\ + tt <= d3 v2 v4 /\ + d3 v2 v4 <= sqrt8 /\ + d3 v2 v3 <= tt /\ + d3 v3 v4 <= tt /\ + orientation s v1 (\x. x < &0) + ==> (!x. x IN {v2, v3, v4} ==> d3 v1 x <= tt)`;; + +(* le 92. p 56 *) +let YJTLEGD = ` ! (v1:real^3) v2 v3 v0. + let s = {v1, v2, v3, v0} in + let tt = #2.51 in + CARD s = 4 /\ + packing s /\ + (!x y. {x, y} SUBSET {v1, v2, v3} ==> d3 x y <= tt) /\ + orientation s v0 (\x. x < &0) + ==> (!x. x IN {v1, v2, v3} ==> &2 <= d3 v0 x /\ d3 v0 x <= tt)`;; + +let LEMMA92 = YJTLEGD;; + +(* le 93. p 56 *) +let NJBVVWG = `! (v1:real^3) v2 v3 v4 x. + let s = {v1, v2, v3, v4} in + CARD s = 4 /\ packing s /\ x IN s /\ radV (s DELETE x) < sqrt (&2) + ==> orientation s x (\x. &0 < x)`;; + +let LEMMA93 = NJBVVWG ;; + + + +(* le 95 . p 57 *) +let GLQHFGH = ` !v0 v1 v2 (v3:real^3). + let s = {v0, v1, v2, v3} in + CARD s = 4 /\ + packing s /\ + (!x y. {x, y} SUBSET {v1, v2, v3} ==> d3 x y <= sqrt8) + ==> (~(conv {v1, v2, v3} INTER voronoi v0 s = {}) + ==> orientation s v0 (\x. x < &0)) /\ + (~(conv {v1, v2, v3} INTER voronoi_le v0 s = {}) + ==> orientation s v0 (\x. x <= &0))`;; +let LEMMA95 = GLQHFGH;; +(* le 97. p 58 *) +let TCQPONA = ` ! (v:real^3) v1 v2 v3. + CARD {v, v1, v2, v3} = 4 /\ + packing {v, v1, v2, v3} /\ + (!a b. {a, b} SUBSET {v1, v2, v3} ==> d3 a b <= #2.51) /\ + ~(conv {v1, v2, v3} INTER voronoi v {v1, v2, v3} = {}) + ==> (!x. x IN {v1, v2, v3} ==> &2 <= d3 x v /\ d3 x v < #2.51)`;; +let LEMMA97 = TCQPONA ;; + +(* le 98. p 59 *) +let CEWWWDQ = ` ! (v:real^3) v1 v2 v3. + let s = {v, v1, v2, v3} in + let dd = #2.51 in + CARD s = 4 /\ + packing s /\ + d3 v1 v3 <= dd /\ + d3 v2 v3 <= dd /\ + d3 v1 v3 <= sqrt8 /\ + ~(conv (s DELETE v) INTER voronoi v s = {}) + ==> (!x. x IN {v1, v2, v3} ==> &2 <= d3 v x /\ d3 v x <= dd)`;; +let LEMMA98 = CEWWWDQ;; + +(* le 99. *) +let CKLAKTB = ` !(w:real^3) v0 v1 v2 x. + (!x y. {x, y} SUBSET {v0, v1, v2} ==> d3 x y < sqrt (&8)) /\ + CARD {w, v0, v1, v2} = 4 /\ packing {w, v0, v1, v2} /\ + ~(conv {x, w} INTER cone v0 {v1, v2} = {}) /\ + d3 x v0 < d3 x v1 /\ + d3 x v0 < d3 x v2 /\ + d3 x w < d3 x v0 + ==> ~(conv {x, w} INTER conv {v0, v1, v2} = {})`;; +let LEMMA99 = CKLAKTB ;; + +(* le 100. p 60 *) + +let UMMNOJN = ` ! (x:real^3) w v0 v1 v2. + CARD {w, v0, v1, v2} = 4 /\ + packing {w, v0, v1, v2} /\ + conv {x, w} INTER cone v0 {v1, v2} = {} /\ + d3 x v0 < d3 x v1 /\ + d3 x v0 < d3 x v2 /\ + d3 x w < d3 x v0 /\ + (!x y. {x, y} SUBSET {v0, v1, v2} ==> d3 x y < sqrt (&8)) /\ + ((!x y. {x, y} SUBSET {v0, v1, v2} ==> d3 x y <= #2.51) \/ + (?x y. + {x, y} SUBSET {v0, v1, v2} /\ + ~(d3 x y <= #2.51) /\ + (!xx yy. + {xx, yy} SUBSET {v0, v1, v2} /\ ~(d3 xx yy <= #2.51) + ==> {xx, yy} = {x, y}))) ==> + (! x. x IN {v0,v1,v2} ==> d3 w x <= #2.51 )/\ + ~ ( conv {x,w} INTER conv {v0,v1,v2} = {} ) `;; +let LEMMA100 = UMMNOJN;; +(* le 101, not presented in the book *) + +(* le 102. p 60 *) +let XBNRPGQ = ` ! v0 v1 w0 (w1:real^3) c0 c1. + let s = {v0, v1, w0, w1} in + let F' = {v0, v1, w1} in + CARD {v0, v1, w0, w1} = 4 /\ + packing {v0, v1, w0, w1} /\ + sqrt (&2) <= radV s /\ + ~coplanar s /\ + radV {v0, v1, w0} < sqrt (&2) /\ + c0 = circumcenter {v0, v1, w0} /\ + d3 v0 c1 = sqrt (&2) /\ + d3 v1 c1 = sqrt (&2) /\ + d3 w0 c1 = sqrt (&2) /\ + c1 IN aff_gt {v0, v1, w0} {w1} /\ + radV F' < sqrt (&2) /\ + (?u v w. + F' = {u, v, w} /\ + d3 u v <= #2.51 /\ + d3 v w <= #2.51 /\ + d3 u w <= sqrt (&8) /\ + (?xa. xa IN F' /\ d3 xa w0 > #2.51)) + ==> conv {c0, c1} INTER aff {v0, v1, w0} = {}` ;; +let LEMMA102 = XBNRPGQ;; + +(* le 103. p 61 *) + +let MITDERY = ` ! v0 v w (w':real^3) c. + let tt = #2.51 in + let s = {v0, v, w, w'} in + CARD s = 4 /\ + tt <= d3 v v0 /\ + d3 v v0 <= sqrt8 /\ + tt < d3 w w' /\ + d3 w w' <= sqrt8 /\ + (!x y. + {x, y} SUBSET s /\ ~({x, y} = {v, v0} \/ {x, y} = {w, w'}) + ==> d3 x y <= tt) /\ + c <= radV s + ==> rogers v0 w v w' c SUBSET conv s`;; +let LEMMA103 = MITDERY;; + +(* le 104. p 61 *) +let BAJSVHC = ` ! v1 v2 v3 v4 (v5:real^3). + CARD {v1, v2, v3, v4, v5} = 5 /\ + ~coplanar {v1, v2, v3, v4} /\ + v5 IN aff_ge {v1, v3} {v2, v4} /\ + ~(v5 IN aff {v1, v3}) + ==> aff_ge {v1, v3} {v2, v4} = + aff_ge {v1, v3} {v2, v5} UNION aff_ge {v1, v3} {v4, v5} /\ + aff_gt {v1, v3} {v2, v5} INTER aff_gt {v1, v3} {v4, v5} = {}`;; +let LEMMA104 = BAJSVHC;; + +(* le 105. p 62 *) + +let TBMYVLM = ` !v0 v1 v2 v3 (v4:real^3) . + let s = {v0, v1, v2, v3, v4} in + CARD s = 5 /\ + (!x. x IN {v1, v2, v3} ==> ~coplanar (s DELETE x)) /\ + v4 IN cone v0 {v1, v2, v3} + ==> (!x. x IN + aff_ge {v0, v4} {v1, v2} UNION + aff_ge {v0, v4} {v1, v3} UNION + aff_ge {v0, v4} {v2, v3}) /\ + (!x y. + ~(x = y) /\ {x, y} SUBSET {v1, v2, v3} + ==> aff_gt {v0, v4} ({v1, v2, v3} DELETE x) INTER + aff_gt {v0, v4} ({v1, v2, v3} DELETE y) = + {})`;; +let LEMMA105 = TBMYVLM;; +(* le 106. p 63 *) +let TQLZOUG = ` !v0 (v1:real^3) v2 v3 R R0 c3 s. + s = {v0, v1, v2, v3} /\ + p = circumcenter s /\ + c3 = circumcenter {v0, v1, v2} /\ + R = rogers v0 v1 v2 v3 (radV s) /\ + R0 = rogers0 v0 v1 v2 v3 (radV s) /\ + CARD s = 4 /\ + packing s /\ + (!x. x IN {v1, v2, v3} ==> orientation s x (\x. &0 < x)) /\ + d3 v1 v2 < sqrt (&8) /\ + d3 v2 v3 < sqrt (&8) /\ + d3 v3 v1 < sqrt (&8) + ==> voronoi v0 s INTER + aff_ge {v0, p} {v1, c3} INTER + cone v0 {v1, v2, v3} SUBSET + R /\ + R0 = + voronoi v0 s INTER + aff_gt {v0, p} {v1, c3} INTER + cone0 v0 {v1, v2, v3}`;; +let LEMMA106 = TQLZOUG;; + +(* le 107. p 64 *) + +let UREVUCX = ` !v0 v1 v2 (v3:real^3). + let s = {v0, v1, v2, v3} in + CARD s = 4 /\ + packing s /\ + (!x. x IN {v1, v2, v3} ==> orientation s x (\x. &0 < x)) /\ + (!x y. {x, y} SUBSET {v1, v2, v3} ==> d3 x y < sqrt (&8)) + ==> UNIONS {rogers0 v0 u v w (radV s) | {u, v, w} = {v1, v2, v3}} SUBSET + cone v0 {v1, v2, v3} INTER voronoi v0 s /\ + cone v0 {v1, v2, v3} INTER voronoi v0 s SUBSET + UNIONS {rogers v0 u v w (radV s) | {u, v, w} = {v1, v2, v3}}`;; +let LEMMA107 = UREVUCX;; + + +(* le 108. p 65 *) +let RKWVONN = ` !v0 v1 v2 (v3:real^3). + let s = {v0, v1, v2, v3} in + CARD s = 4 /\ + packing s /\ + (!x. x IN {v1, v2, v3} ==> orientation s x (\x. &0 < x)) /\ + (!x y. {x, y} SUBSET {v1, v2, v3} ==> d3 x y < sqrt (&8)) + ==> voronoi_le v0 s INTER aff_le {v1, v2, v3} {v0} SUBSET + cone v0 {v1, v2, v3}`;; +let LEMMA108 = RKWVONN;; + + + +let phi_fun = new_definition ` phi_fun S v u = + { x| ? x'. x' IN aff_gt {v} {x} /\ dist (x',u ) = dist (x',v) /\ + ( ! w. w IN S ==> dist (x',v) <= dist (x',w) ) }`;; + +(* le 109. p 65 *) +let EMLLARA = ` !u (v:real^3) w. + (collinear {u, v, w} ==> bis u v INTER bis v w = {}) /\ + ( ~collinear {u, v, w} ==> line ( bis u v INTER bis v w )) `;; + +let LEMMA109 = EMLLARA;; + +(* le 110. p 66 *) +let DKCSJPZ = `! u v (w:real^3) x p. + let s = {u, v, w} in + x IN phi_fun s v u INTER phi_fun s v w /\ + ~(u = w) /\ + plane p /\ + v IN p /\ + bis u v INTER bis v w SUBSET p + ==> x IN p`;; + +let LEMMA110 = DKCSJPZ;; + + +let phi_fun' = new_definition ` phi_fun' S v u w = + {x | FINITE S /\ + (?x''. x IN aff_gt {v} {x'', u} /\ + dist (x'',u) = dist (x'',v) /\ + dist (x'',u) = dist (x'',w) /\ + (!w'. w' IN S ==> dist (x'',v) <= dist (x'',w')))} `;; + +(* le 111. p 66 *) +let QXSXGMC = ` ! (u:real^3) v S. convex ( phi_fun S u v ) `;; +let LEMMA111 = QXSXGMC;; + +(* le 112 . p 67 *) + +let IXOUEVV = ` ! u v (w:real^3) S. + FINITE ( S UNION { u, v, w} ) /\ + packing ( S UNION { u, v, w} ) /\ + dist (u,v) < sqrt (&8) + ==> phi_fun' S v u w SUBSET phi_fun S v u `;; + +let LEMMA112 = IXOUEVV;; + +(* le 113. p 67 *) +let KMTAMFH = ` ! v0 v1 v2 (v3:real^3). + let S = {v0, v1, v2, v3} in + CARD S = 4 /\ + ~coplanar S /\ + d3 v1 v2 < sqrt (&8) /\ + d3 v2 v3 < sqrt (&8) /\ + ~(cone v2 {v1, v3} INTER phi_fun {v0, v1, v3} v2 v0 = {}) + ==> orientation S v0 (\x. x <= &0)`;; +let LEMMA113 = KMTAMFH;; + +(* le 114. p 68 *) +let JHOQMMR = ` ! v0 v1 u1 (u2:real^3). + let s = {v0, v1, u1, u2} in + let y = d3 v1 v0 in + let bb = eta_y (&2) #2.51 y in + CARD s = 4 /\ + packing s /\ + d3 v0 v1 < sqrt (&8) /\ + d3 v0 u1 < sqrt (&8) /\ + d3 v0 u2 < sqrt (&8) /\ + d3 u1 u2 < sqrt (&8) /\ + #2.51 < d3 v1 v0 /\ + ((?a b. + {a, b} SUBSET {v0, u1, u2} /\ + #2.51 < d3 a b /\ + (!aa bb. + {aa, bb} SUBSET {v0, u1, u2} /\ ~({aa, bb} = {a, b}) + ==> d3 aa bb <= #2.51)) \/ + (!aa bb. + {aa, bb} SUBSET {v0, u1, u2} /\ ~({aa, bb} = {a, b}) + ==> d3 aa bb <= #2.51)) /\ + x IN cone v0 {u1, u2} INTER rcone_gt v0 v1 (y / ( &2 * bb )) + ==> (!x. x IN {d3 v1 u1, d3 v1 u2, d3 v0 u1, d3 v0 u2} ==> x <= #2.51) /\ + radV s < bb`;; +let LEMMA114 = JHOQMMR;; + +(* le 115. pa 68 *) +let YFTQMLF = ` ! v0 v1 u1 (u2:real^3). + let s = {v0, v1, u1, u2} in + let y = d3 v1 v0 in + let bb = eta_y (&2) #2.51 y in + CARD s = 4 /\ + packing s /\ + d3 v0 v1 < sqrt (&8) /\ + d3 v0 u1 < sqrt (&8) /\ + d3 v0 u2 < sqrt (&8) /\ + d3 u1 u2 < sqrt (&8) /\ + #2.51 < d3 v1 v0 /\ + ((?a b. + {a, b} SUBSET {v0, u1, u2} /\ + #2.51 < d3 a b /\ + (!aa bb. + {aa, bb} SUBSET {v0, u1, u2} /\ ~({aa, bb} = {a, b}) + ==> d3 aa bb <= #2.51)) \/ + (!aa bb. + {aa, bb} SUBSET {v0, u1, u2} /\ ~({aa, bb} = {a, b}) + ==> d3 aa bb <= #2.51)) /\ + ~(w' IN affine hull {v0, v1, u1}) /\ + ~(cone v0 {u1, u2} INTER rogers v0 u1 v1 w' bb = {}) + ==> (!x. x IN {d3 v1 u1, d3 v1 u2, d3 v0 u1, d3 v0 u2} ==> x <= #2.51) /\ + radV s < bb`;; +let LEMMA115 = YFTQMLF ;; + +(* LE 116 . p 69 *) +let GQMZTHN = ` !(v0:real^3) v1 w u1 u2 b p y. + let s = {v0, v1, w, u1, u2} in + CARD s = 5 /\ + packing s /\ + d3 v0 u1 < sqrt (&8) /\ + d3 v0 u2 < sqrt (&8) /\ + d3 u1 u2 < sqrt (&8) /\ + d3 w v0 <= #2.51 /\ + #2.51 < d3 v0 v1 /\ + d3 v0 v1 < sqrt (&8) /\ + d3 v1 w <= #2.51 /\ + ((?a b. + {a, b} SUBSET {v0, u1, u2} /\ + #2.51 < d3 a b /\ + (!aa bb. + {aa, bb} SUBSET {v0, u1, u2} /\ ~({aa, bb} = {a, b}) + ==> d3 aa bb <= #2.51)) \/ + (!a b. {a, b} SUBSET {v0, u1, u2} ==> d3 a b <= #2.51)) /\ + y = d3 v0 v1 /\ + b = eta_y (&2) #2.51 y /\ + ~(phi_fun {w, u1, u2} v0 w INTER + cone v0 {u1, u2} INTER + rogers0 v0 w v1 p b = + {}) /\ + ~(p IN affine hull {v0, w, v1}) + ==> d3 w u1 <= #2.51 /\ + d3 w u2 <= #2.51 /\ + ((?u. u IN {u1, u2} /\ + ~(rogers0 v0 w v1 p b INTER cone v0 {w, u} = {})) \/ + d3 u1 u2 < sqrt (&8) /\ + v1 IN cone0 v0 {w, u1, u2} /\ + d3 v1 u1 <= #2.51 /\ + d3 w u2 <= #2.51 \/ + #2.51 < d3 u1 u2 /\ + d3 u1 u2 < sqrt (&8) /\ + w IN aff_ge {v0, v1} {u1, u2})`;; +let LEMMA116 = GQMZTHN;; + +(* definition in page 70 *) +let split = new_definition` split v0 v1 w u1 w' p = + ( radV {v0, v1, w, u1} < eta_y (d3 w v0) (&2) #2.51 /\ + u1 IN aff_ge {v0, v1, w} {p} + ==> w' IN aff_gt {v0, v1} {w, u1} /\ + radV {v0, v1, w, w'} >= eta_y (d3 v0 v1) (&2) #2.51 /\ + d3 w' v1 <= #2.51 /\ + d3 w' v0 <= #2.51 /\ + #2.77 <= d3 w' w ) `;; + + +(* le 117. p 68 *) +let KWOHVUP = `! (v0:real^3) v1 w u1 u2 w' b p y. + let s = {v0, v1, w, u1, u2, w'} in + let ca = sqrt (&8) in + let ha = #2.51 in + CARD s = 6 /\ + packing s /\ + ~(p IN affine hull {v0, w, v1}) /\ + split v0 v1 w u1 w' p /\ + d3 v0 u1 < ca /\ + d3 v0 u2 < ca /\ + d3 u1 u2 < ca /\ + d3 v0 v1 < ca /\ + ha < d3 v0 v1 /\ + d3 w v0 <= ha /\ + d3 w v1 <= ha /\ + ((?a b. + {a, b} SUBSET {v0, u1, u2} /\ + #2.51 < d3 a b /\ + (!aa bb. + {aa, bb} SUBSET {v0, u1, u2} /\ ~({aa, bb} = {a, b}) + ==> d3 aa bb <= #2.51)) \/ + (!a b. {a, b} SUBSET {v0, u1, u2} ==> d3 a b <= #2.51)) /\ + y = d3 v1 v0 /\ + b = eta_y (&2) ha y /\ + ~(phi_fun {v1, w, u1, u2} v0 u1 INTER + cone v0 {u1, u2} INTER + rogers0 v0 w v1 p b = + {}) + ==> d3 v0 v1 <= #2.51 /\ + d3 v1 u1 <= #2.51 /\ + d3 v1 w <= #2.51 /\ + u2 IN aff_gt {v0, u1} {v1, w} \/ + d3 v0 u1 <= ha /\ + d3 v1 u1 <= ha /\ + d3 u1 w < ha /\ + rogers0 v0 w v1 p b SUBSET aff_ge {v0, v1, w} {u1} \/ + (!v u. v IN {v0, v1} /\ u IN {u1, u2} ==> d3 u v <= #2.51) /\ + d3 w' v0 <= ha /\ + d3 w' v1 <= ha /\ + w' IN aff_gt {v0, v1} {u1, u2}`;; +let LEMMA117 = KWOHVUP;; + + +(* le 118. p 72 *) +let UJCUNAS = ` !v0 v1 w u1 u2 w' p F_SET R b y. + let s = {v0, v1, w, u1, u2, w'} in + let zzz = #2.51 in + let set_d = {v0, u1, u2} in + CARD s = 6 /\ + packing s /\ + ~(p IN affine hull {v0, w, v1}) /\ + split v0 v1 w u1 w' p /\ + split v0 v1 w u2 w' p /\ + d3 v0 u1 < sqrt8 /\ + d3 v0 u2 < sqrt8 /\ + d3 u1 u2 < sqrt8 /\ + d3 w v0 <= zzz /\ + zzz < d3 v0 v1 /\ + d3 v0 v1 < sqrt8 /\ + d3 v1 w <= zzz /\ + ((?a b. + {a, b} SUBSET set_d /\ + zzz < d3 a b /\ + (!aa bb. + {aa, bb} SUBSET set_d /\ ~({aa, bb} = {a, b}) + ==> d3 aa bb <= zzz)) \/ + (!a b. {a, b} SUBSET set_d ==> d3 a b <= zzz)) /\ + y = d3 v1 v0 /\ + b = eta_y (&2) zzz y /\ + F_SET = cone v0 {u1, u2} /\ + R = rogers0 v0 w v1 p b + ==> d3 w u1 <= zzz /\ + d3 w u2 <= zzz /\ + (!u. u = u1 \/ u = u2 ==> ~(R INTER cone v0 {w, u} = {})) \/ + d3 w u1 <= zzz /\ + d3 w u2 <= zzz /\ + d3 u1 u2 < sqrt8 /\ + v1 IN cone0 v0 {w, u1, u2} /\ + d3 v1 u1 <= zzz /\ + d3 v1 u2 <= zzz \/ + d3 w u1 <= zzz /\ + d3 w u2 <= zzz /\ + zzz < d3 u1 u2 /\ + d3 u1 u2 < sqrt8 /\ + w IN aff_ge {v0, v1} {u1, u2} \/ + (?u u'. + {u, u'} = {u1, u2} /\ + d3 v0 u <= zzz /\ + d3 v1 u <= zzz /\ + d3 u w <= zzz /\ + u' IN aff_gt {v0, u} {v1, w}) \/ + (?u. u IN {u1, u2} /\ + d3 v0 u <= zzz /\ + d3 v1 u <= zzz /\ + d3 u w <= zzz /\ + R SUBSET aff_ge {v0, v1, w} {u}) \/ + (!v u''. v IN {v0, v1} /\ u'' IN {u1, u2} ==> d3 v u'' <= zzz) /\ + d3 w' v0 <= zzz /\ + d3 w' v1 <= zzz /\ + w' IN aff_gt {v0, v1} {u1, u2}`;; +let LEMMA118 = UJCUNAS;; +(* le 119 . p 73 *) + +let DVLHHMF = ` ! R' R0 b v0 v w w' u. + let s = {v0, v, w, w', u} in + let zz = #2.51 in + CARD s = 5 /\ + packing s /\ + zz < d3 v0 v /\ + d3 v0 v < sqrt8 /\ + zz < d3 w w' /\ + (!v' w''. v' IN {v0, v} /\ w'' IN {w, w', u} ==> d3 v' w'' <= zz) /\ + b = eta_y (&2) zz (d3 v v0) /\ + b <= radV {v0, v, w, w'} /\ + ~(conv {w, u} INTER aff_ge {v0, v} {w'} = {}) /\ + R0 = rogers0 v0 w v u b /\ + R' = R0 INTER voronoi v0 {w, u} INTER phi_fun {v0, w, u} v0 u /\ + ~(R' = {}) + ==> (!x. x IN R' ==> ~(conv {x, u} INTER conv {v0, v, w'} = {})) /\ + d3 u w' <= zz`;; + +let LEMMA119 = DVLHHMF;; + +(* le 120 . 74 *) +let UIXOFDB = ` !v0 v1 v1' w1 w2 b b'. + let s = {v0, v1, v1', w1, w2} in + let zz = #2.51 in + CARD s = 5 /\ + packing s /\ + zz <= d3 v0 v1 /\ + d3 v0 v1 < sqrt8 /\ + zz <= d3 v0 v1' /\ + d3 v0 v1' < sqrt8 /\ + (!v w. v IN {v0, v1} /\ w IN {w1, w2} ==> d3 v w <= zz) /\ + ~coplanar {v0, v1, w1, w2} /\ + b' = d3 v0 v1' / (&2 * eta_y (d3 v0 v1') (&2) zz) /\ + b = d3 v0 v1 / (&2 * eta_y (d3 v0 v1) (&2) zz) + ==> rogers0 v0 w1 v1 w2 b INTER rcone_ge v0 v1' b' = {}`;; +let LEMMA120 = UIXOFDB;; + +(* le 121. p74 *) +let MJNUTQH = ` !v0 v1 v2 w1 w2 p1 p2. + let s = {v0, v1, v2, w1, w2} in + let zz = #2.51 in + CARD s = 5 /\ + packing s /\ + zz <= d3 v0 v1 /\ + d3 v0 v1 < sqrt8 /\ + zz <= d3 v0 v2 /\ + d3 v0 v2 < sqrt8 /\ + (!w. w IN {w1, w2} ==> d3 v0 w <= zz) /\ + d3 v1 w1 <= zz /\ + d3 v2 w2 <= zz /\ + ~coplanar {v0, v1, w1, p1} /\ + ~coplanar {v0, v2, w2, p2} /\ + b1 = eta_y (d3 v0 v1) (&2) zz /\ + b2 = eta_y (d3 v0 v2) (&2) zz /\ + ~(rogers v0 w1 v1 p1 b1 INTER rogers v0 w2 v2 p2 b2 = {}) + ==> d3 v1 w2 <= zz /\ + (d3 w1 w2 <= zz /\ + (~(rogers0 v0 w2 v2 p2 b2 INTER aff_ge {v0} {v1, w1} = {}) \/ + aff_ge {v0, v1, w1} {w2} = aff_ge {v0, v1, w1} {p1}) \/ + zz < d3 w1 w2 /\ + ~(phi_fun {v0, v1, w1, w2} v0 w2 INTER rogers v0 w1 v1 p1 b1 = {}) /\ + radV {v0, v1, w1, w2} < b1 /\ + aff_ge {v0, v1, w1} {w2} = aff_ge {v0, v1, w1} {p1}) \/ + d3 v2 w1 <= zz /\ + (d3 w1 w2 <= zz /\ + (~(rogers0 v0 w1 v1 p1 b1 INTER aff_ge {v0} {v2, w2} = {}) \/ + aff_ge {v0, v2, w2} {w1} = aff_ge {v0, v2, w2} {p2}) \/ + zz < d3 w1 w2 /\ + ~(phi_fun {v0, v1, w1, w2} v0 w1 INTER rogers v0 w2 v2 p2 b2 = {}) /\ + radV {v0, v2, w1, w2} < b2 /\ + aff_ge {v0, v2, w2} {w2} = aff_ge {v0, v2, w2} {p2})`;; + +let LEMMA121 = MJNUTQH;; + +(* le 122 . 75 *) + +let MPJEZGP = ` !t0 t1 t2 t3 t4 v0 v1 v2 v3 v4. + CARD {v0, v1, v2, v3, v4} = 5 /\ + t0 % v0 + t1 % v1 + t2 % v2 + t3 % v3 + t4 % v4 = vec 0 /\ + t4 < &0 /\ + t0 + t1 + t2 + t3 + t4 = &0 + ==> ((!t. t IN {t1, t2, t3} ==> &0 <= t) <=> v4 IN cone v0 {v1, v2, v3}) /\ + (&0 <= t1 /\ &0 <= t3 /\ t2 <= &0 <=> + ~(cone v0 {v2, v4} INTER cone v0 {v1, v3} = {})) /\ + (&0 <= t1 /\ &0 <= t2 /\ t3 <= &0 <=> + ~(cone v0 {v3, v4} INTER cone v0 {v1, v2} = {})) /\ + (&0 <= t1 /\ &0 <= t2 /\ t3 <= &0 <=> + ~(cone v0 {v1, v4} INTER cone v0 {v2, v3} = {})) /\ + (&0 <= t1 /\ t2 <= &0 /\ t3 <= &0 <=> v1 IN cone v0 {v2, v3, v4}) /\ + (&0 <= t2 /\ t1 <= &0 /\ t3 <= &0 <=> v2 IN cone v0 {v1, v3, v4}) /\ + (&0 <= t3 /\ t1 <= &0 /\ t2 <= &0 <=> v3 IN cone v0 {v2, v1, v4}) /\ + (&0 <= t0 /\ t1 <= &0 /\ t2 <= &0 /\ t3 <= &0 <=> + v0 IN conv {v1, v2, v3, v4}) /\ + ~(t0 < &0 /\ (!t. t IN {t1, t2, t3} ==> t <= &0))`;; + +let LEMMA122 = MPJEZGP;; + + +(* le 123 . p 76 *) +let GFVQUPP = ` !x1 x2 x3 x4. + let x12 = dist (x1,x2) pow 2 in + let x13 = dist (x1,x3) pow 2 in + let x14 = dist (x1,x4) pow 2 in + let x23 = dist (x2,x3) pow 2 in + let x24 = dist (x2,x4) pow 2 in + let x34 = dist (x3,x4) pow 2 in + (!x. x IN {x12, x13, x14, x34, x24} ==> x <= #2.517 pow 2) /\ + #2.65 pow 2 <= x23 + ==> delta_x23 x12 x13 x14 x34 x24 x23 > &0`;; + +let LEMMA123 = GFVQUPP;; + + +(* le 124 . p 76 *) +let TFKALQL = ` !v1 v2 v3 v4. + let s = {v1, v2, v3, v4} in + let x12 = dist (v1,v2) pow 2 in + let x13 = dist (v1,v3) pow 2 in + let x14 = dist (v1,v4) pow 2 in + let x23 = dist (v2,v3) pow 2 in + let x24 = dist (v2,v4) pow 2 in + let x34 = dist (v3,v4) pow 2 in + CARD s = 4 /\ + packing s /\ + x12 <= #2.3 pow 2 /\ + (!x. x IN {x13, x14, x34, x24} ==> x <= #2.517 pow 2) /\ + #2.51 pow 2 <= x23 + ==> delta_x23 x12 x13 x24 x34 x24 x23 > &0`;; + +let LEMMA124 = TFKALQL;; + +(* le 125 . p 77 *) + +let AAGNQFL = `!v0 v1 v2 v3 v4. + let s = {v0, v1, v2, v3, v4} in + CARD s = 5 /\ + packing s /\ + (!u v. + {u, v} SUBSET s /\ ~({u, v} = {v1, v3} \/ {u, v} = {v2, v4}) + ==> d3 u v <= #2.51) /\ + v1 IN cone v0 {v2, v3, v4} + ==> d3 v1 v3 < #2.65`;; + +let LEMMA125 = AAGNQFL;; + +(* le 126 . p 77 *) +let QOKQFRE = ` !v0 v1 v2 v3 v4. + let s = {v0, v1, v2, v3, v4} in + CARD s = 5 /\ + packing s /\ + (!u v. + {u, v} SUBSET s /\ ~({u, v} = {v1, v3} \/ {u, v} = {v2, v4}) + ==> d3 u v <= #2.51) /\ + d3 v0 v1 <= #2.3 /\ + v1 IN cone v0 {v2, v3, v4} + ==> d3 v1 v3 < #2.51`;; + +let LEMMA126 = QOKQFRE ;; + +let quadp = new_definition ` quadp v0 v1 v2 v3 v4 = + ~ (cone0 v0 {v1,v3} INTER cone0 v0 {v2,v4} = {} ) `;; + +let quadc0 = new_definition ` quadc0 v0 v1 v2 v3 v4 = + (@h. quadp v0 v1 v2 v3 v4 /\ + h = + cone0 v0 {v1, v2, v3} INTER + cone0 v0 {v1, v3} INTER + cone0 v0 {v1, v3, v4}) `;; +(* le 127. p 78 *) +let DFLUMBW = `!v0 v1 v2 v3 v4. + CARD {v0, v1, v2, v3, v4} = 5 /\ quadp v0 v1 v2 v3 v4 + ==> quadc0 v0 v1 v2 v3 v4 = quadc0 v0 v2 v3 v4 v1`;; + +let LEMMA127 = DFLUMBW;; + +(* le 128 . p 78 *) + +let HTYDGWI = ` !v0 v1 v2 v3 v4. + CARD {v0, v1, v2, v3, v4} = 5 /\ + packing {v0, v1, v2, v3, v4} /\ + (!v. v IN {v1, v2, v3, v4} ==> d3 v0 v <= #2.51) /\ + quadp v0 v1 v2 v3 v4 /\ + d3 v1 v3 < sqrt8 /\ + d3 v2 v4 < sqrt8 + ==> d3 v1 v2 <= #2.51 /\ + d3 v2 v3 <= #2.51 /\ + d3 v3 v4 <= #2.51 /\ + d3 v1 v4 <= #2.51`;; +let LEMMA128 = HTYDGWI;; +(* le 129. p 79 *) +let XLHACRX = ` !v0 v1 v2 v3 v4 w. + CARD {v0, v1, v2, v3, v4, w} = 6 /\ + packing {v0, v1, v2, v3, v4, w} /\ + (!x. x IN {v1, v2, v3, v4} ==> d3 v0 x <= #2.51) /\ + quadp v0 v1 v2 v3 v4 /\ + d3 v1 v3 < sqrt8 /\ + d3 v2 v4 < sqrt8 /\ + w IN quadc0 v0 v1 v2 v3 v4 /\ + d3 w v0 < sqrt8 + ==> (!x. x IN {v1, v2, v3, v4} ==> d3 w x <= #2.51)`;; +let LEMMA129 = XLHACRX;; + +let c_def38 = new_definition ` c_def38 S v' v1 v2 v3 v4 h1 h2 h3 h4 l k + = ( CARD ({v', v1, v2, v3, v4} UNION S) = 5 + CARD S /\ + packing ({v', v1, v2, v3, v4} UNION S) /\ + quadp v' v1 v2 v3 v4 /\ + S SUBSET quadc0 v' v1 v2 v3 v4 /\ + (!vi. vi IN {v1, v2, v3, v4} ==> &2 <= d3 vi v' /\ d3 vi v' <= k) /\ + d3 v1 v2 <= k /\ + d3 v2 v3 <= k /\ + d3 v3 v4 <= k /\ + d3 v4 v1 <= k /\ + &2 <= d3 v1 v2 /\ + &2 <= d3 v2 v3 /\ + &2 <= d3 v3 v4 /\ + &2 <= d3 v4 v1 /\ + &2 <= d3 v1 v3 /\ + &2 <= d3 v2 v4 /\ + (!v. v IN S + ==> &2 <= d3 v v' /\ + d3 v v' <= l /\ + h1 <= d3 v v1 /\ + h2 <= d3 v v2 /\ + h3 <= d3 v v3 /\ + h4 <= d3 v v4) )`;; + + +g ` ! h1 h2 h3 h4 l k. + (! x. x IN {h1,h2,h3,h4,l } ==> &2 <= x /\ x <= sqrt8 ) /\ + #2.51 <= k /\ k <= #2.517 /\ + c_def38 S v' v1 v2 v3 v4 h1 h2 h3 h4 l k /\ + h `;; +(* le 131 . p 80 *) +let GMEPVPW = ` ! k. #2.51 <= k /\ + k <= #2.517 /\ + ~(?v0 v1 v2 v3 v4 (w1:real^3) w2. + CARD {v0, v1, v2, v3, v4, w1, w2} = 7 /\ + packing {v0, v1, v2, v3, v4, w1, w2} /\ + c_def38 {w1, w2} v0 v1 v2 v3 v4 (&2) (&2) (&2) (&2) k k /\ + (!vv. vv IN {v1, v2, v3, v4} ==> d3 v0 vv <= k) /\ + d3 v1 v2 <= k /\ + d3 v2 v3 <= k /\ + d3 v3 v4 <= k /\ + d3 v4 v1 <= k)`;; +let LEMMA131 = GMEPVPW;; + + + +(* le 132 . p 80 *) +let VTIVSIF = ` !v0 (v1:real^3) v2 v3 v4 v5. + CARD {v0, v1, v2, v3, v4, v5} = 6 /\ + packing {v0, v1, v2, v3, v4, v5} /\ + quadp v0 v1 v2 v3 v4 /\ + v5 IN quadc0 v0 v1 v2 v3 v4 /\ + (!vv. vv IN {v1, v2, v3, v4} ==> d3 v0 vv <= #2.51) /\ + d3 v1 v2 <= #2.51 /\ + d3 v2 v3 <= #2.51 /\ + d3 v3 v4 <= #2.51 /\ + d3 v4 v1 <= #2.51 /\ + (!xx. xx IN {v2, v3, v4} ==> #2.51 <= d3 v5 xx) + ==> #2.51 < d3 v0 v5`;; + +let LEMMA132 = VTIVSIF;; + +(* le 133 . p 81 *) +let TPXUMUZ = ` !v0 v1 v2 v3 v4 v5. + CARD {v0, v1, v2, v3, v4, v5} = 6 /\ + packing {v0, v1, v2, v3, v4, v5} /\ + quadp v0 v1 v2 v3 v4 /\ + v5 IN quadc0 v0 v1 v2 v3 v4 /\ + (!u v. + {u, v} SUBSET {v0, v1, v2, v3, v4, v5} /\ + ~({u, v} = {v1, v3} \/ + {u, v} = {v2, v4} \/ + {u, v} = {v5, v4} \/ + {u, v} = {v5, v3}) + ==> d3 u v <= #2.51) /\ + #2.51 <= d3 v5 v3 /\ + #2.51 <= d3 v5 v4 + ==> (d3 v5 v4 <= sqrt8 \/ d3 v5 v3 <= sqrt8) /\ + (d3 v5 v4 <= #3.02 /\ d3 v5 v3 <= #3.02) /\ + #2.3 <= d3 v5 v0 `;; + +let LEMMA133 = TPXUMUZ;; + + +(* le 134. p 82 *) + +let YWPHYZU = ` !v0 v1 v2 v3 v4 v5. + CARD {v0, v1, v2, v3, v4, v5} = 6 /\ + packing {v0, v1, v2, v3, v4, v5} /\ + d3 v0 v5 < sqrt8 /\ + (!u v. u IN {v0, v5} /\ v IN {v1, v2} ==> d3 u v <= #2.51) /\ + ~(conv {v3, v4} INTER conv {v0, v1, v5} = {}) /\ + ~(conv {v3, v4} INTER conv {v0, v2, v5} = {}) + ==> sqrt8 < d3 v3 v4`;; + +let LEMMA134 = YWPHYZU;; + +(* le 135 . p 82 *) + +let PYURAKS = ` !v0 w w' v1 v2 v3. + CARD {v0, w, w', v1, v2, v3} = 6 /\ + packing {v0, w, w', v1, v2, v3} /\ + d3 v1 v2 < sqrt8 /\ + d3 v1 v3 <= #2.51 /\ + d3 v2 v3 <= #2.51 /\ + {w, w'} SUBSET cone v0 {v1, v2, v3} /\ + d3 v0 w <= sqrt8 + ==> sqrt8 < d3 v0 w'`;; + +let LEMMA135 = PYURAKS;; + + + +let small = new_definition ` small s = + ( CARD s = 3 /\ + packing s /\ + (!x y. {(x:real^3) , y} SUBSET s ==> d3 x y < sqrt8) /\ + (!x y z. + {x, y, z} = s /\ #2.51 < d3 x y /\ #2.51 < d3 y z + ==> radV s < sqrt (&2)) ) `;; +(* le 136 . p *) + +let BLATMSI = ` !v1 v2 v3 v4 w w' s. + CARD {v1, v2, v3, v4, w, w'} = 6 /\ + packing {v1, v2, v3, v4, w, w'} /\ + s = {v1, v2, v3, v4} /\ + (!v. v IN s ==> small (s DELETE v)) /\ + ~(conv {w, w'} INTER conv s = {}) /\ + d3 w w' < sqrt8 + ==> ~(conv {w, w'} INTER conv0 s = {})`;; + +let LEMMA136 = BLATMSI;; + +(* le 137. p 84 *) + +let MLTDJJV = ` !v1 v2 v3 v0 w w' s. + CARD {v1, v2, v3, v0, w, w'} = 6 /\ + packing {v1, v2, v3, v0, w, w'} /\ + s = {v1, v2, v3, v0} /\ + d3 w w' < sqrt8 /\ + (!v. v IN s ==> small (s DELETE v)) /\ + (!x y. {x, y} SUBSET {v1, v2, v3} ==> d3 x y <= #2.51) + ==> conv {w, w'} INTER conv s = {} `;; + +let LEMMA137 = MLTDJJV;; + + +(* le 138 . p 85 *) +let ZDKDXFM = ` !v0 v1 v2 v3 w w'. + CARD {v0, v1, v2, v3, w, w'} = 6 /\ + packing {v0, v1, v2, v3, w, w'} /\ + d3 w w' < sqrt8 /\ + (!v. v IN {v0, v1, v2, v3} ==> small ({v0, v1, v2, v3} DELETE v)) /\ + #2.51 < d3 v1 v3 /\ + #2.51 < d3 v2 v0 /\ + ~(conv {w, w'} INTER conv0 {v0, v1, v2, v3} = {}) + ==> #2.51 < d3 w w' /\ + (!u vi. u IN {w, w'} /\ vi IN {v0, v1, v2, v3} ==> d3 u vi <= #2.51)`;; + +(* le 139 . 85 *) +let XHMHKIZ = ` !v0 v1 v2 v3 w. + CARD {v0, v1, v2, v3, w} = 5 /\ + packing {v0, v1, v2, v3, w} /\ + (!x y. {x, y} SUBSET {v1, v2, v3} ==> d3 x y <= sqrt8) /\ + ~(conv {v0, w} INTER conv0 {v0, v1, v2, v3} = {}) + ==> ~(conv {v0, w} INTER conv0 {v1, v2, v3} = {})`;; + +(* le 140 . p 86 *) +let TIMIDQM = ` !v0 v1 v2 w0 w1 w2 x. + CARD {v0, v1, v2, w0, w1, w2} = 6 /\ + packing {v0, v1, v2, w0, w1, w2} /\ + small {v0, v1, v2} /\ + small {w0, w1, w2} /\ + x IN conv {v0, v1, v2} INTER conv {w0, w1, w2} + ==> (?v0' v1' v2' w0' w1' w2'. + {v0, v1, v2} = {v0', v1', v2'} /\ + {w0, w1, w2} = {w0', w1', w2'} /\ + d3 w0' w1' <= #2.51 /\ + d3 w1' w2' <= #2.51 /\ + #2.51 < d3 w0' w2' /\ + d3 v0' v2' < sqrt8 /\ + d3 v0' v1' <= #2.51 /\ + d3 v1' v2' <= #2.51 /\ + #2.51 < d3 v0' v2' /\ + d3 v0' v2' < sqrt8 /\ + ~(conv {v0', v2'} INTER {w0, w1, w2} = {}) /\ + ~(conv {w0', w2'} INTER {v0, v1, v2} = {}))`;; + +let LEMMA140 = TIMIDQM;; + +(* le 141 . p 87 *) + + +let KGTJGLX = ` !u0 v1 v2 w1 w2. + CARD {u0, v1, v2, w1, w2} = 5 /\ + packing {u0, v1, v2, w1, w2} /\ + small {u0, v1, v2} /\ + small {u0, w1, w2} /\ + ~(conv0 {u0, v1, v2} INTER conv0 {u0, w1, w2} = {}) + ==> ~(conv {v1, v2} INTER conv {u0, w1, w2} = {} /\ + conv {w1, w2} INTER conv {u0, v1, v2} = {})`;; + +let LEMMA141 = KGTJGLX;; + +(* le 142 . p 87 *) + +let RTBONNT = ` !v1 v2 v3 v4 w1 w2 w3. + CARD {v1, v2, v3, v4, w1, w2, w3} = 7 /\ + packing {v1, v2, v3, v4, w1, w2, w3} /\ + Sv = {v1, v2, v3, v4} /\ + Sw = {w1, w2, w3} /\ + small Sw /\ + (!v. v IN Sv ==> small (Sv DELETE v)) + ==> conv Sv INTER conv Sw = {}`;; + +let LEMMA142 = RTBONNT ;; + +(* le 143 . p88 *) + + +let JMHCAKG = ` !v1 v2 v3 v4 w1 w2 w3. + let sv = {v1, v2, v3, v4} in + let sw = {w1, w2, w3} in + let s = {v1, v2, v3, v4, w1, w2} in + v1 = w1 /\ + CARD s = 6 /\ + packing s /\ + small sw /\ + (!v. v IN sv ==> small (sv DELETE v)) /\ + (?vv. ~(vv = v1) /\ vv IN conv sv INTER conv sw) + ==> (?ww1 ww2 ww3 vv1 vv2 vv3 vv4. + {ww1, ww2, ww3} = {w1, w2, w3} /\ + {vv1, vv2, vv3, vv4} = {v1, v2, v3, v4} /\ + ~(conv {ww1, ww3} INTER conv {vv2, vv3, vv4} = {}) /\ + ~(conv {vv2, vv4} INTER conv {ww1, ww2, ww3} = {}) /\ + #2.51 < d3 ww1 ww3 /\ + #2.51 < d3 vv2 vv4 /\ + d3 ww1 vv4 <= #2.51 /\ + d3 vv4 ww3 <= #2.51 /\ + d3 ww3 vv2 <= #2.51 /\ + d3 vv2 ww1 <= #2.51) \/ + (?ww1 ww2 ww3 vv1 vv2 vv3 vv4. + {ww1, ww2, ww3} = {w1, w2, w3} /\ + {vv1, vv2, vv3, vv4} = {v1, v2, v3, v4} /\ + (?vi vj. + ~(vi = vj) /\ + {vi, vj} SUBSET sv /\ + ~(conv {ww2, ww3} INTER conv (sv DELETE vi) = {} \/ + conv {ww2, ww3} INTER conv (sv DELETE vj) = {})) /\ + #2.51 < d3 vv2 vv3 /\ + #2.51 < d3 vv1 vv3 /\ + (!wi vj. wi IN {ww2, ww3} /\ vj IN sv ==> d3 wi vj <= #2.51))`;; + +let LEMMA143 = JMHCAKG ;; + + +(* le 144. p 89 *) +let UGQMJJA = `!v1 v2 v3 v4 w3 w1 w2. + CARD {v1, v2, v3, v4, w1} = 5 /\ + packing {v1, v2, v3, v4, w1} /\ + w1 = v1 /\ + w2 = v2 /\ + sv = {v1, v2, v3, v4} /\ + sw = {w1, w2, w3} /\ + small sw /\ + (!v. v IN sv ==> small (sv DELETE v)) /\ + (?x. ~(x IN conv {v1, v2}) /\ x IN conv sv INTER conv sw) + ==> (?ww1 vv2. + {ww1, vv2} = {w1, v2} /\ + ~(conv {ww1, w3} INTER conv {vv2, v3, v4} = {}) /\ + #2.51 < d3 ww1 w3) \/ + ~(conv {v3, v4} INTER conv sw = {}) /\ #2.51 < d3 v3 v4`;; + +let LEMMA144 = UGQMJJA;; + + +(* le 145. p 89 *) +let ZILQMDQ = ` !v1 v2 v3 v4 w1 w2 w3 w4. + let sv = {v1, v2, v3, v4} in + let sw = {w1, w2, w3, w4} in + CARD {v1, v2, v3, v4, w1, w2, w3, w4} = 8 /\ + packing {v1, v2, v3, v4, w1, w2, w3, w4} /\ + (!v. v IN sv ==> small (sv DELETE v)) /\ + (!w. w IN sw ==> small (sw DELETE w)) + ==> conv sv INTER conv sw = {}`;; + +let LEMMA145 = ZILQMDQ ;; + + +(* le 146. p 90 *) + +let AQKANYN = ` !v1 v2 v3 v4 w1 w2 w3 w4. + let sv = {v1, v2, v3, v4} in + let sw = {w1, w2, w3, w4} in + CARD {v1, v2, v3, v4, w2, w3, w4} = 7 /\ + packing {v1, v2, v3, v4, w2, w3, w4} /\ + w1 = v1 /\ + (!v. v IN sv ==> small (sv DELETE v)) /\ + (!w. w IN sw ==> small (sw DELETE w)) + ==> conv sv INTER conv sw = {v1}`;; + + +let LEMMA146 = AQKANYN;; \ No newline at end of file diff --git a/legacy/oldleg/geomdetail.ml b/legacy/oldleg/geomdetail.ml new file mode 100644 index 0000000..1d50d2b --- /dev/null +++ b/legacy/oldleg/geomdetail.ml @@ -0,0 +1,2839 @@ +(* ================================ *) +(* ===== NGUYEN QUANG TRUONG ====== *) + +(* + +Note: I have split the file into 2 pieces: geomdetail.ml and geomdetail_08.ml. Not everything in geomdetail_08.ml loads with the Multivariate directory, but these are the parts that are least likely to be used in the revision of the proof in 2009. Everything in this file now loads with Multivariate. --tch July 14, 2009 + +*) +let voronoi_trg = new_definition ` voronoi_trg v S = { x | !w. ((S w) /\ ~(w=v)) +==> (dist ( x , v ) < dist ( x , w )) }`;; + + +let conv0_2 = new_definition ` conv0_2 s = conv0 s `;; + + +let convex = new_definition `convex s <=> !x y u v. x IN s /\ y IN s /\ &0 <= u /\ + &0 <= v /\ (u + v = &1) ==> (u % x + v % y) IN s`;; + +let aff = new_definition `aff = ( hull ) affine`;; + + + +let conv_trg = new_definition ` conv_trg s = convex hull s`;; + +let border = new_definition ` border s = { x | ! ep. ep > &0 /\ ( ? a b. ~ (b IN s ) /\ + dist (b, x) < ep /\ a IN s /\ dist (a, x) < ep ) }`;; + +let packing_trg = new_definition `packing_trg (s:real^3 -> bool) = (! x y. s x /\ s y /\ ( ~(x=y)) + ==> dist ( x, y) >= &2 ) `;; + +let center_pac = new_definition ` center_pac s v = ( packing_trg s /\ s v )`;; + +let centered_pac = new_definition ` centered_pac s v = ( packing s /\ v IN s )`;; + +let d3 = new_definition ` d3 x y = dist (x,y)`;; + +let voronoi2 = new_definition ` voronoi2 v S = {x| x IN voronoi_trg v S /\ d3 x v < &2 }`;; + +let voro2 = new_definition ` voro2 v s = {x| x IN voronoi v s /\ d3 x v < &2 }`;; + +let t0 = new_definition ` t0 = #1.255`;; + + +let quasi_tri = new_definition ` quasi_tri tri s = ( packing s /\ + tri SUBSET s /\ + (? a b c. ~( a=b \/ b=c\/ c=a) /\ { a, b, c } = tri ) /\ + (! x y. ( x IN tri /\ y IN tri /\ (~(x=y)) ) ==> ( d3 x y <= &2 * t0 )))`;; + + +let simplex = new_definition ` simplex (d:real^3 -> bool) s = ( packing s /\ + d SUBSET s /\ +( ? v1 v2 v3 v4. ~( v1 = v2 \/ v3 = v4 ) /\ {v1, v2 } INTER {v3, v4 } = {}/\ {v1,v2,v3,v4} = d ) + )`;; + +let quasi_reg_tet = new_definition ` quasi_reg_tet x s = ( simplex x s /\ + (! v w. ( v IN x /\ w IN x /\ + ( ~ ( v = w))) + ==> ( d3 v w <= &2 * t0 )) )`;; + +let quarter = new_definition ` quarter (q:real^3 -> bool) s = + ( packing s /\ + simplex q s /\ + (?v w. + v IN q /\ + w IN q /\ + &2 * t0 <= d3 v w /\ + d3 v w <= sqrt (&8) /\ + (!x y. + x IN q /\ y IN q /\ ~({x, y} = {v, w}) + ==> d3 x y <= &2 * t0)))`;; + +let diagonal = new_definition ` diagonal d1 d2 q s = ( quarter q s /\ + {d1, d2} SUBSET q /\ + (!x y. x IN q /\ y IN q ==> d3 x y <= d3 d1 d2))`;; + + let strict_qua = new_definition ` strict_qua d s = ( quarter d s /\ + ( ? x y. x IN d /\ y IN d /\ &2 * t0 < d3 x y /\ d3 x y < sqrt( &8 ) ))`;; + +let strict_qua2 = new_definition ` strict_qua2 d (ch:real^3 -> bool ) s = ( quarter d s /\ ch SUBSET d + /\ ( ? x y. ~( x = y ) /\ ch = {x,y} /\ &2 * t0 < d3 x y /\ d3 x y < sqrt ( &8 ) ) )`;; + + + +let quartered_oct = new_definition `quartered_oct (v:real^3) (w:real^3) (v1:real^3) (v2:real^3) (v3:real^3) (v4:real^3) s = + ( packing s /\ + ( &2 * t0 < dist (v,w) /\ dist (v,w) < sqrt (&8) ) /\ + (!x. x IN {v1, v2, v3, v4} + ==> dist (x,v) <= &2 * t0 /\ dist (x,w) <= &2 * t0) /\ + {v, w, v1, v2, v3, v4} SUBSET s /\ + (&2 <= dist (v1,v2) /\ dist (v1,v2) <= &2 * t0) /\ + (&2 <= dist (v2,v3) /\ dist (v2,v3) <= &2 * t0) /\ + (&2 <= dist (v3,v4) /\ dist (v3,v4) <= &2 * t0) /\ + &2 <= dist (v4,v1) /\ + dist (v4,v1) <= &2 * t0 ) `;; + + +let adjacent_pai = new_definition ` adjacent_pai v v1 v3 v2 v4 s = ( strict_qua2 { v , v1 , v3 , v2 } { v1 , v3 } s + /\ strict_qua2 { v , v1 , v3 , v4 } { v1 , v3 } s /\ + ( conv0 { v , v1 , v3 , v2 } INTER conv0 { v , v1 , v3 , v4 } = {} ) )`;; + +let conflicting_dia = new_definition ` conflicting_dia v v1 v3 v2 v4 s = ( adjacent_pai v v1 v3 v2 v4 s +/\ adjacent_pai v v2 v4 v1 v3 s )`;; + + let interior_pos = new_definition `interior_pos v v1 v3 v2 v4 s = ( conflicting_dia v v1 v3 v2 v4 s + /\ ~( conv0 { v1, v3 } INTER conv0 { v , v2 , v4 } = {} ))`;; + +let isolated_qua = new_definition ` isolated_qua q s = ( quarter q s /\ ~( ? v v1 v2 v3 v4. q = + {v, v1, v2, v3} /\ adjacent_pai v v1 v2 v3 v4 s))`;; + +let isolated_pai = new_definition ` isolated_pai q1 q2 s = ( isolated_qua q1 s /\ isolated_qua q2 s /\ + ~ (conv0 q1 INTER conv0 q2 = {}))`;; + +let anchor = new_definition ` anchor (v:real^3) v1 v2 s = ( {v, v1, v2} SUBSET s /\ d3 v1 v2 <= sqrt ( &8 ) /\ + d3 v1 v2 >= &2 * t0 /\ d3 v v1 <= &2 * t0 /\ d3 v v2 <= &2 * t0 )`;; + +let anchor_points = new_definition ` anchor_points v w s = { t | &2 * t0 <= d3 v w /\ + anchor t v w s }`;; + +let Q_SYS = new_definition ` Q_SYS s = {q | quasi_reg_tet q s \/ + strict_qua q s /\ + (?c d. + !qq. c IN q /\ + d IN q /\ + d3 c d > &2 * t0 /\ + (quasi_reg_tet qq s \/ strict_qua qq s) /\ + conv0 {c, d} INTER conv0 qq = {}) \/ + strict_qua q s /\ + (CARD + {t | ?v w. + v IN q /\ w IN q /\ &2 * t0 < d3 v w /\ anchor t v w s} > + 4 \/ + CARD + {t | ?v w. + v IN q /\ w IN q /\ &2 * t0 < d3 v w /\ anchor t v w s} = + 4 /\ + ~(?v1 v2 v3 v4 v w. v IN q /\ + w IN q /\ + {v1, v2, v3, v4} SUBSET anchor_points v w s + /\ + + &2 * t0 < d3 v w /\ + quartered_oct v w v1 v2 v3 v4 s)) + \/ (? v w v1 v2 v3 v4. q = { v, w, v1, v2} /\ quartered_oct v w v1 v2 v3 v4 s ) + \/ (? v v1 v3 v2 v4. ( q = {v, v1, v2, v3} \/ q = {v, v1, v3, v4} ) /\ + interior_pos v v1 v3 v2 v4 s /\ anchor_points v1 v3 s = { v, v2, v4} /\ + anchor_points v2 v4 s = { v, v1, v3 } )}`;; + +let barrier = new_definition ` barrier s = { { (v1 : real^3 ) , ( v2 :real^3 ) , (v3 :real^3) } | + quasi_tri { v1 , v2 , v3 } s \/ + (? v4. ( { v1 , v2 , v3 } UNION { v4 }) IN Q_SYS s ) } `;; + +let obstructed = new_definition ` obstructed x y s = ( ? bar. bar IN barrier s /\ + ( ~ (conv0_2 { x , y } INTER conv_trg bar = {})))`;; + +let obstruct = new_definition ` obstruct x y s = ( ? bar. bar IN barrier s /\ + ( ~ (conv0 { x , y } INTER conv bar = {})))`;; + +let unobstructed = new_definition ` unobstructed x y s = ( ~( obstructed x y s ))`;; + +let VC_trg = new_definition ` VC_trg x s = { z | d3 x z < &2 /\ ~obstructed x z s /\ + (! y. y IN s /\ ~ ( x = y ) /\ ~(obstructed z y s) ==> d3 x z < d3 y z )} `;; + +let VC_INFI_trg = new_definition ` VC_INFI_trg s = { z | ( ! x. x IN s /\ + ~( z IN VC_trg x s ))}`;; + + +let lambda_x = new_definition `lambda_x x s = {w | w IN s /\ d3 w x < &2 /\ +~obstructed w x s }`;; + +let lambda_y = new_definition ` lambda_y y s = { w| w IN s /\ d3 w y < &2 /\ + ~obstruct w y s} `;; + +let VC = new_definition `VC v s = { x | v IN lambda_x x s /\ +(!w. w IN lambda_x x s /\ ~(w = v) ==> d3 x v < d3 x w) }`;; + +let VC_INFI = new_definition ` VC_INFI s = { z | ( ! x. ~( z IN VC x s ))}`;; + + +let SET_TAC = + let basicthms = + [NOT_IN_EMPTY; IN_UNIV; IN_UNION; IN_INTER; IN_DIFF; IN_INSERT; + IN_DELETE; IN_REST; IN_INTERS; IN_UNIONS; IN_IMAGE] in + let allthms = basicthms @ map (REWRITE_RULE[IN]) basicthms @ + [IN_ELIM_THM; IN] in + let PRESET_TAC = + TRY(POP_ASSUM_LIST(MP_TAC o end_itlist CONJ)) THEN + REPEAT COND_CASES_TAC THEN + REWRITE_TAC[EXTENSION; SUBSET; PSUBSET; DISJOINT; SING] THEN + REWRITE_TAC allthms in + fun ths -> + PRESET_TAC THEN + (if ths = [] then ALL_TAC else MP_TAC(end_itlist CONJ ths)) THEN + MESON_TAC[];; + + let SET_RULE tm = prove(tm,SET_TAC[]);; + +(* some TRUONG TACTICS *) + +let PHA = REWRITE_TAC[ MESON[] ` (a/\b)/\c <=> a/\ b /\ c `];; + +let NGOAC = REWRITE_TAC[ MESON[] ` a/\b/\c <=> (a/\b)/\c `];; + +let DAO = NGOAC THEN REWRITE_TAC[ MESON[]` a /\ b <=> b /\ a`];; + +let PHAT = REWRITE_TAC[ MESON[] ` (a\/b)\/c <=> a\/b\/c `];; + +let NGOACT = REWRITE_TAC[ GSYM (MESON[] ` (a\/b)\/c <=> a\/b\/c `)];; + +let KHANANG = PHA THEN REWRITE_TAC[ MESON[]` ( a\/ b ) /\ c <=> a /\ c \/ b /\ c `] THEN + REWRITE_TAC[ MESON[]` a /\ ( b \/ c ) <=> a /\ b \/ a /\ c `];; + +let ATTACH thm = MATCH_MP (MESON[]` ! a b. ( a ==> b ) ==> ( a <=> a /\ b )`) thm;; + +let CUTHE1 th = MATCH_MP (MESON[]` ( ! a. P a ) ==> P a `) th ;; + +let CUTHE2 th = MATCH_MP (MESON[]` ( ! a b. P a b ) ==> P a b`) th ;; + +let CUTHE3 th = MATCH_MP (MESON[]` ( ! a b c. P a b c ) ==> P a b c`) th ;; + +let CUTHE4 th = MATCH_MP (MESON[]` ( ! a b c d. P a b c d ) ==> P a b c d`) th ;; + +let CUTHE5 th = MATCH_MP (MESON[]` ( ! a b c d e. P a b c d e) ==> P a b c d e`) th ;; + +let CUTHE6 th = MATCH_MP (MESON[]` ( ! a b c d e f. P a b c d e f) ==> P a b c d e f`) th ;; + +let CUTHE7 th = MATCH_MP (MESON[]` ( ! a b c d e f h. P a b c d e f h) ==> P a b c d e f h`) th ;; + +let NHANH tm = ONCE_REWRITE_TAC[ ATTACH (tm)];; + + +let trg_sub_bo = prove ( `A SUBSET B <=> (!x. A x ==> B x)`, SET_TAC[] );; + +let trg_sub_se = prove ( `A SUBSET B <=> (!x. x IN A ==> x IN B )`, SET_TAC[] );; + +let trg_setbool = prove (`x IN A <=> A x `, SET_TAC[] );; + +let trg_boolset = prove (` A x <=> x IN A `, SET_TAC[] );; + +let trg_in_union = prove (` x IN ( A UNION B ) <=> x IN A \/ x IN B `, SET_TAC[]);; + +let not_in_set3 = prove ( `~ ( x IN { z | A z /\ B z /\ C z } ) <=> ~ A x \/ ~ B x \/ ~ C x `, + SET_TAC[]);; + +let trg_d3_sym = prove ( `! x y. d3 x y = d3 y x `, SIMP_TAC[d3; DIST_SYM]);; + +let affine_hull_e = prove (`affine hull {} = {}`, + REWRITE_TAC[AFFINE_EMPTY; AFFINE_HULL_EQ]);; + +let wlog = MESON[]` (! a b. ( P a b = P b a ) /\ ( Q a b \/ Q b a ) ) ==> ((? a b . P a b ) <=> ( ? a b. P a b + /\ Q a b ))`;; + +let wlog_real = MESON[REAL_ARITH `( ! a b:real. a <= b \/ b <= a )`] ` +(! a:real b:real . P a b = P b a ) ==> ((? a:real b . P a b ) <=> ( ? a b. P a b + /\ a <= b ))`;; + +let dkdx = MESON[REAL_ARITH ` ! a b:real. a <= b \/ b <= a `]`! P. (!a b u v m n p . P a b u v m n p <=> P b a v u m n p) + ==> ((?a b u v m n p. P a b u v m n p) <=> (?a b u v m n p. P a b u v m n p /\ a <= b))`;; + + +let tarski_arith = new_axiom `! bar. bar IN barrier s /\ + ~(conv_trg bar INTER conv0_2 { v0 , x } ={}) /\ + ~ ( v0 IN bar ) /\ + x IN voronoi2 v0 s /\ + ~ ( x IN UNIONS {aff_ge {v0} {v1, v2} | {v0, v1, v2} IN barrier s} ) + ==> { v0 } UNION bar IN Q_SYS s `;; + +let simp_def = new_axiom ` (! a x y (z:real^A). + aff_ge {a} {x, y, z} = { t | ? s i j k. &0 <= i + /\ &0 <= j /\ &0 <= k /\ s + i + j + k = &1 /\ + t = s % a + i % x + j % y + k % z }) /\ + + (!v0 v1 v2. + aff_ge {v0} {v1, v2} = + {t | ?u v w. + &0 <= v /\ + &0 <= w /\ + u + v + w = &1 /\ + t = u % v0 + v % v1 + w % v2}) /\ + (!v0 v1 v2 v3. + aff_gt {v0} {v1, v2, v3} = + {t | ?x y z w. + &0 < y /\ + &0 < z /\ + &0 < w /\ + x + y + z + w = &1 /\ + t = x % v0 + y % v1 + z % v2 + w % v3}) /\ + (!v0 v1 v2 v3. + aff_le {v1, v2, v3} {v0} = + {t | ?a b c d. + d <= &0 /\ + a + b + c + d = &1 /\ + t = a % v1 + b % v2 + c % v3 + d % v0}) /\ + ( ! v0 v1. conv0_2 { v0, v1 } = { x | ? t. &0 < t /\ t < &1 /\ x = t % v0 + (&1 - t ) % v1 } ) /\ + (! s. conv_trg s = conv s )`;; + + +let AFFINE_HULL_SINGLE = prove(`!x. affine hull {x} = {x}`, + SIMP_TAC[AFFINE_SING; AFFINE_HULL_EQ]);; + +let usefull = MESON[] ` (!x. a x ==> b x ) ==>(?x. a x ) ==> c ==> d <=> + (!x. a x ==> b x) ==> (?x. a x /\ b x ) ==> c ==> d `;; + +let v1_in_convex3 = prove (` ! v1 v2 v3. v1 IN {t | ?a b c. + &0 <= a /\ &0 <= b /\ &0 <= c /\ a + b + c = &1 /\ + t = a % v1 + b % v2 + c % v3}`, REPEAT GEN_TAC THEN REWRITE_TAC[ IN_ELIM_THM] THEN +EXISTS_TAC ` &1 ` THEN EXISTS_TAC ` &0 ` THEN EXISTS_TAC ` &0 ` THEN +REWRITE_TAC[ VECTOR_ARITH ` &1 % v1 + &0 % v2 + &0 % v3 = v1 `] THEN REAL_ARITH_TAC);; + + +let v3_in_convex3 = prove( `! v1 v2 v3. v3 IN + {t | ?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + t = a % v1 + b % v2 + c % v3}`, REWRITE_TAC[IN_ELIM_THM] THEN REPEAT GEN_TAC +THEN REPLICATE_TAC 2 (EXISTS_TAC `&0`) THEN EXISTS_TAC ` &1` THEN REWRITE_TAC[VECTOR_MUL_LZERO; + VECTOR_ADD_LID; VECTOR_MUL_LID] THEN REAL_ARITH_TAC);; + + +let v1v2v3_in_convex3 = prove (` ! v1 v2 v3 . v1 IN {t | ?a b c. &0 <= a /\ &0 <= b /\ &0 <= c /\ +a + b + c = &1 /\ t = a % v1 + b % v2 + c % v3} + /\ v2 IN {t | ?a b c. &0 <= a /\ &0 <= b /\ &0 <= c /\ a + b + c = &1 /\ t = a % v1 + b % v2 + c % v3} + /\ v3 IN {t | ?a b c. &0 <= a /\ &0 <= b /\ &0 <= c /\ a + b + c = &1 /\ t = a % v1 + b % v2 + c % v3}`, +REWRITE_TAC[v1_in_convex3; v3_in_convex3] THEN REPEAT GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN +EXISTS_TAC ` &0` THEN EXISTS_TAC ` &1` THEN EXISTS_TAC ` &0` THEN +REWRITE_TAC[VECTOR_ARITH` v2 = &0 % v1 + &1 % v2 + &0 % v3`] THEN REAL_ARITH_TAC);; + + +let convex3 = prove( `!v1 v2 v3. + convex + {t | ?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + t = a % v1 + b % v2 + c % v3}`, +REWRITE_TAC[convex; IN_ELIM_THM] THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN +EXISTS_TAC ` u * a + v * a'` THEN +EXISTS_TAC ` u * b + v * b'` THEN +EXISTS_TAC ` u * c + v * c'` THEN +REPEAT (FIRST_X_ASSUM MP_TAC) THEN +REWRITE_TAC[MESON[] ` a==> b==> c <=> a /\ b==> c`] THEN PHA THEN +REWRITE_TAC[ MESON[]` &0 <= a /\ l <=> l /\ &0 <= a `] THEN PHA THEN +NHANH (MESON[REAL_LE_MUL; REAL_ARITH ` &0 <= a /\ &0 <= b ==> &0 <= a +b `]` &0 <= v /\ + &0 <= u /\ + &0 <= c' /\ + &0 <= b' /\ + &0 <= a' /\ + &0 <= c /\ + &0 <= b /\ + &0 <= a ==> &0 <= u * c + v * c' /\ + &0 <= u * b + v * b' /\ + &0 <= u * a + v * a'`) THEN +REWRITE_TAC[REAL_ARITH` ( a + y ) + ( b + x ) + c + z = ( a + b + c) + ( + y + x + z ) `] THEN +REWRITE_TAC[REAL_ARITH ` a * b + a * c = a * ( b + c) `] THEN +SIMP_TAC[] THEN +REWRITE_TAC[ REAL_ARITH ` a * &1 = a `] THEN SIMP_TAC[] THEN +REWRITE_TAC[VECTOR_ARITH` u % (a % v1 + b % v2 + c % v3) + v % (a' % v1 + b' % v2 + c' % v3) = + (u * a + v * a') % v1 + (u * b + v * b') % v2 + (u * c + v * c') % v3`]);; + +let INTERS_SUBSET = SET_RULE `! P t0. P t0 ==> INTERS { t| P t } SUBSET t0`;; + +let SET3_SUBSET = SET_RULE`! a b c. {a,b,c} SUBSET s <=> a IN s /\ b IN s /\ c IN s `;; + +let SUM_TWO_RATIO = REAL_FIELD ` ~(a + b = &0) <=> a / ( a + b) + b /(a+b) = &1`;; + +let minconvex3 = prove(`!t v1 v2 v3. + convex t /\ {v1, v2, v3} SUBSET t + ==> (!a b c. + &0 <= a /\ &0 <= b /\ &0 <= c /\ a + b + c = &1 + ==> a % v1 + b % v2 + c % v3 IN t)`, +REPEAT GEN_TAC THEN +REWRITE_TAC[convex; SET3_SUBSET] THEN +STRIP_TAC THEN +REPEAT GEN_TAC THEN +ONCE_REWRITE_TAC[ MESON[]` &0 <= a /\ &0 <= b /\ l<=> ( a + b = &0 \/ + ~( a + b = &0)) /\ &0 <= a /\ &0 <= b /\ l`] THEN +REWRITE_TAC[RIGHT_OR_DISTRIB] THEN +REWRITE_TAC[ MESON[]` a \/ b ==> c <=> ( a ==> c ) /\ ( b ==> c )`] THEN +REWRITE_TAC[REAL_ARITH` a + b = &0 /\ &0 <= a /\ &0 <= b /\ &0 <= c /\ a + b + c = &1 + <=> &0 = a /\ &0 = b /\ &1 = c `] THEN +ONCE_REWRITE_TAC[ EQ_SYM_EQ] THEN +SIMP_TAC[] THEN +ASM_REWRITE_TAC[ VECTOR_MUL_LZERO; VECTOR_MUL_LID; VECTOR_ADD_LID] THEN +REWRITE_TAC[MESON[]`&0 = a + b <=> a + b = &0`; SUM_TWO_RATIO] THEN +NHANH (MESON[REAL_ARITH ` &0 <= a /\ &0 <= b ==> &0 <= a + b `]` + dau /\ &0 <= a /\ &0 <= b /\ l ==> &0 <= a + b `) THEN +NHANH (MESON[REAL_LE_DIV]` (aa /\ &0 <= a /\ &0 <= b /\ bb) /\ &0 <= a + b + ==> &0 <= a / (a + b) /\ &0 <= b / (a + b)`) THEN +REWRITE_TAC[GSYM SUM_TWO_RATIO] THEN +PHA THEN +NHANH (MESON[REAL_DIV_LMUL]` ~(a + b = &0) ==> a = (a+b) *(a/(a+b)) /\ b = + (a+b) *(b/(a+b))`) THEN +REWRITE_TAC[MESON[VECTOR_MUL_RCANCEL]` ( dau /\ a = (a + b) * a / (a + b) /\ b = (a + b) * b / (a + b)) + /\ l ==> a % v1 + b % v2 + c % v3 IN t <=> + ( dau /\ a = (a + b) * a / (a + b) /\ b = (a + b) * b / (a + b)) + /\ l ==> ((a + b) * a / (a + b)) % v1 + ((a + b) * b / (a + b)) % v2 + c % v3 IN t`] THEN +REWRITE_TAC[ VECTOR_ARITH ` ((a + b) * a / (a + b)) % v1 + ((a + b) * b / (a + b)) % v2 + c % v3 + = (a + b) % ( (a / (a + b)) % v1 + (b / (a + b)) % v2) + c % v3 `] THEN +REWRITE_TAC[SUM_TWO_RATIO] THEN +ASM_MESON_TAC[ REAL_ARITH` a + b + c = (a + b ) + c`]);; + + +let EQ_EXPAND = MESON[] `(a <=> b) <=> ( a ==> b ) /\ ( b ==> a )` ;; + + + +let OTHER_CONVEX_CONDI = prove(` ! s. convex s <=> (! a b c v1 v2 v3. {v1, v2, v3} SUBSET s /\ + &0 <= a /\ &0 <= b /\ &0 <= c /\ a + b + c = &1 + ==> a % v1 + b % v2 + c % v3 IN s)`, +REWRITE_TAC[EQ_EXPAND; MESON[minconvex3]`!s. (convex s + ==> (!a b c v1 v2 v3. + {v1, v2, v3} SUBSET s /\ + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 + ==> a % v1 + b % v2 + c % v3 IN s))`; convex] THEN STRIP_TAC THEN +REWRITE_TAC[SET3_SUBSET] THEN DISCH_TAC THEN +REWRITE_TAC[REAL_ARITH`&0 <= u /\ &0 <= v /\ u + v = &1 <=> + &0 <= u /\ &0 <= v / &2 /\ u + v/ &2 + v / &2 = &1`] THEN +ONCE_REWRITE_TAC[MESON[REAL_ARITH` a = a / &2 + a / &2`]` u % x + v % y = + u % x + ( v/ &2 + v/ &2 ) % y `] THEN REWRITE_TAC[ VECTOR_ADD_RDISTRIB] THEN +ASM_MESON_TAC[]);; + + +(* ============== *) + + +let convex3_in_inters = prove (` ! v1 v2 v3. {t | ?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + t = a % v1 + b % v2 + c % v3} SUBSET + INTERS {t | convex t /\ {v1, v2, v3} SUBSET t} `, +REPEAT GEN_TAC THEN +MATCH_MP_TAC (SET_RULE ` ( ! x. x IN A ==> x IN B ) ==> A SUBSET B`) THEN +REWRITE_TAC[IN_ELIM_THM] THEN REWRITE_TAC[IN_INTERS] THEN +REWRITE_TAC[MESON[] `( !x. (?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + x = a % v1 + b % v2 + c % v3) + ==> (!t. convex t /\ {v1, v2, v3} SUBSET t ==> x IN t)) + <=>( !x. (?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + x = a % v1 + b % v2 + c % v3) + ==> (!t. convex t /\ {v1, v2, v3} SUBSET t /\ (?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + x = a % v1 + b % v2 + c % v3) ==> x IN t)) `] THEN +GEN_TAC THEN DISCH_TAC THEN GEN_TAC THEN FIRST_X_ASSUM MP_TAC THEN +REWRITE_TAC[ IN_ELIM_THM ; TAUT ` a ==> b ==> c <=> a /\ b ==> c `] THEN +MESON_TAC[minconvex3]);; + + +(* =========== *) + + + +let simpl_conv3 =prove(` ! v1 v2 v3. conv_trg {v1 , v2 ,v3} = {t | ?a b c. &0 <= a /\ &0 <= b /\ &0 <= c /\ a + b + c = &1 +/\ t = a % v1 + b % v2 + c % v3}`, REPEAT GEN_TAC THEN +REWRITE_TAC[conv; hull] THEN REPEAT GEN_TAC THEN +REWRITE_TAC[ SET_RULE` a = b <=> a SUBSET b /\ b SUBSET a `] THEN +REWRITE_TAC[conv_trg; hull] THEN +MATCH_MP_TAC (MATCH_MP ( MESON[] `(! a b. P a b) ==> P a b` ) (MESON[INTERS_SUBSET ]` + ! P t0 . ( P t0 /\ aa ) ==> INTERS {t | P t} SUBSET t0 /\ aa`)) THEN + REWRITE_TAC[convex3] THEN REWRITE_TAC[ SET_RULE `{v1 , v2, v3} SUBSET a <=> + v1 IN a /\ v2 IN a /\ v3 IN a`] THEN REWRITE_TAC [ v1v2v3_in_convex3] THEN +REWRITE_TAC[ SET_RULE` v1 IN t /\ v2 IN t /\ v3 IN t <=> {v1, v2, v3} SUBSET t`] THEN +REWRITE_TAC[convex3_in_inters]);; + + + + + + + + + + + + + + + + + + + + + + +(* =========== begining lemma 8.2 ========== *) + +let near = new_definition ` near (v0:real^N) (r:real) s = { x | x IN s /\ + dist(x,v0) < r } `;; + +let near2t0 = new_definition ` near2t0 v0 s = { x | x IN s /\ dist(v0,x) < &2 * t0 }`;; + +let e_plane = new_definition ` e_plane (a:real^N) (b:real^N) x = ( ~( a=b) /\ dist(a,x) = dist(b,x))`;; + +let min_dist = new_definition ` min_dist (x:real^3) s = ((?u. u IN s /\ + (!w. w IN s /\ ~(u = w) ==> dist (u,x) < dist (w,x))) \/ + (?u v. + u IN s /\ + v IN s /\ + ~(u = v) /\ + dist (u,x) = dist (v,x) /\ + (!w. w IN s ==> dist (u,x) <= dist (w,x)))) `;; + + +let exists_min_dist = new_axiom ` ! (x :real^3) (s:real^3 -> bool). + ~(s = {}) /\ packing s + ==> min_dist x s`;; + + +let tarski_FFSXOWD = new_axiom ` !v0 v1 v2 v3 s. + packing s /\ + ~(v1 = v2 \/ v2 = v3 \/ v3 = v1) /\ + dist (v1,v2) <= #2.51 /\ + dist (v2,v3) <= #2.51 /\ + dist (v3,v1) < sqrt (&8) /\ + {v1, v2, v3} SUBSET s /\ + ~(v0 IN {v1, v2, v3}) + ==> normball v0 #1.255 INTER conv {v1, v2, v3} = {} `;; + + +(* ========== simplize.ml ============ *) + +let SET3_SUBSET = SET_RULE`! a b c. {a,b,c} SUBSET s <=> a IN s /\ b IN s /\ c IN s `;; + + +let FINITE6 = MESON[ FINITE_RULES ] `! a b c d e f. + FINITE {} /\ + FINITE {a} /\ + FINITE {a, b} /\ + FINITE {a, b, c} /\ + FINITE {a, b, c, d} /\ + FINITE {a, b, c, d, e} /\ + FINITE {a, b, c, d, e, f} `;; + +(* ========= new simplizing ========== *) + +let elimin = REWRITE_RULE[IN];; + +let CONV_EM = prove(`conv {} = {}:real^A->bool`, + REWRITE_TAC[conv;sgn_ge;affsign;UNION_EMPTY;FUN_EQ_THM;elimin +NOT_IN_EMPTY;lin_combo;SUM_CLAUSES] + THEN REAL_ARITH_TAC);; + +let CONV_SING = prove(`!u. conv {u:real^A} = {u}`, + REWRITE_TAC[conv;sgn_ge;affsign;FUN_EQ_THM;UNION_EMPTY;lin_combo;SUM_SING;VSUM_SING; + elimin IN_SING] THEN REPEAT GEN_TAC THEN + REWRITE_TAC[TAUT `(p <=> q) = ((p ==> q) /\ (q ==> p))`] THEN + REPEAT STRIP_TAC THENL [ASM_MESON_TAC[VECTOR_MUL_LID]; + ASM_REWRITE_TAC[]] THEN EXISTS_TAC `\ (v:real^A). &1` THEN + MESON_TAC[VECTOR_MUL_LID;REAL_ARITH `&0 <= &1`] );; + + +let NOV9 = prove(`!x y z.(x = y /\ y = z + ==> conv {y, z} = + {w | ?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + w = a % y + b % y + c % z})`, +SIMP_TAC[] THEN REWRITE_TAC[SET_RULE` {a,a} = {a}`] THEN +REWRITE_TAC[ CONV_SING; GSYM VECTOR_ADD_RDISTRIB] THEN +REWRITE_TAC[ MESON[]` a + b + c = &1 /\ w = (a + b + c) % z <=>a + b + c = &1 /\ + w = &1 % z `; VECTOR_MUL_LID] THEN REWRITE_TAC[ FUN_EQ_THM] THEN +REWRITE_TAC[ SET_RULE ` {a} x <=> a = x `; IN_ELIM_THM] THEN +REPEAT GEN_TAC THEN DISCH_TAC THEN GEN_TAC THEN +NGOAC THEN REWRITE_TAC[ LEFT_EXISTS_AND_THM] THEN +MATCH_MP_TAC (MESON[] ` a ==> ( z = x <=> a /\ x = z )`) THEN +REPLICATE_TAC 2 (EXISTS_TAC `&0`) THEN EXISTS_TAC ` &1` THEN REAL_ARITH_TAC);; + + +let IN_ACT_SING = SET_RULE `! a x. ({a} x <=> a = x ) /\ ( x IN {a} <=> x = a) /\ {a} a`;; + + +let NOV10 = prove(` ! x y. (x = y + ==> (!x. y = x <=> + (?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ x = a % y + b % y))) `, +REWRITE_TAC[GSYM VECTOR_ADD_RDISTRIB] THEN +REWRITE_TAC[ MESON[VECTOR_MUL_LID]` a + b = &1 /\ x = (a + b) % y <=> a + b = &1 /\ +x = y`]THEN REPEAT GEN_TAC THEN DISCH_TAC THEN GEN_TAC THEN NGOAC THEN +REWRITE_TAC[LEFT_EXISTS_AND_THM] THEN MATCH_MP_TAC (MESON[]` a ==> ( x = y <=> a /\ + y = x )`)THEN EXISTS_TAC `&0` THEN EXISTS_TAC ` &1` THEN REAL_ARITH_TAC);; + + + + + +let IN_SET2 = SET_RULE `!a b x. + (x IN {a, b} <=> x = a \/ x = b) /\ ({a, b} x <=> x = a \/ x = b)`;; + + +let VSUM_DIS2 = prove(` ! x y f. ~(x=y) ==> vsum {x,y} f = f x + f y`, REWRITE_TAC[ + SET_RULE ` ~( x = y) + <=> ~(x IN {y})`] THEN MESON_TAC[ FINITE_RULES; VSUM_CLAUSES; VSUM_SING]);; + +let SUM_DIS2 = prove(`! x y f. ~(x=y) ==> sum {x,y} f = f x + f y `,REWRITE_TAC[ + SET_RULE ` ~( x = y) + <=> ~(x IN {y})`] THEN MESON_TAC[ FINITE_RULES; SUM_CLAUSES; SUM_SING]);; + + +let TRUONG_LEMMA = prove + ( `!x y x':real^N. + (?f. x' = f x % x + f y % y /\ (&0 <= f x /\ &0 <= f y) /\ + f x + f y = &1) <=> + (?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ x' = a % x + b % y)` , + REPEAT GEN_TAC THEN EQ_TAC +THENL [MESON_TAC[]; STRIP_TAC] THEN + ASM_CASES_TAC `y:real^N = x` THENL + [EXISTS_TAC `\x:real^N. &1 / &2`; + EXISTS_TAC `\u:real^N. if u = x then (a:real) else b`] THEN + ASM_REWRITE_TAC[GSYM VECTOR_ADD_RDISTRIB] THEN + CONV_TAC REAL_RAT_REDUCE_CONV);; + + +let NOV11 = prove(`! z. {z} = + {w | ?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + w = a % z + b % z + c % z}`, +REWRITE_TAC[ FUN_EQ_THM; IN_ACT_SING; IN_ELIM_THM] THEN +REWRITE_TAC[GSYM VECTOR_ADD_RDISTRIB] THEN +REWRITE_TAC[ MESON[VECTOR_MUL_LID]`a + b + c = &1 /\ + x = (a + b + c) % z <=> a + b + c = &1 /\ x = z`] THEN +NGOAC THEN MATCH_MP_TAC (MESON[]` (? a b c. P a b c) ==> (! z x. z = x <=> + (? a b c. P a b c /\ x = z))`) THEN +REPLICATE_TAC 2 (EXISTS_TAC `&0`) THEN +EXISTS_TAC `&1` THEN REAL_ARITH_TAC);; + + + +let CONV2_CONV3 = prove(` !x' y z. + (?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ x' = a % y + b % z) + ==> (?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + x' = a % y + b % y + c % z)`, +REPEAT GEN_TAC THEN REWRITE_TAC[ VECTOR_ARITH` a % y + b % y + c % z = (a+b) %y + c%z`] THEN STRIP_TAC THEN +REPLICATE_TAC 2 (EXISTS_TAC `a/ &2`) THEN +EXISTS_TAC `b:real` THEN +REWRITE_TAC[ REAL_ARITH` a / &2 + a / &2 = a /\ a / &2 + a / &2 + b = a + b `] THEN +ASM_SIMP_TAC[] THEN +ASM_REAL_ARITH_TAC);; + + +let CONV3_CONV2 = prove(`! x' y z. (?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + x' = a % y + b % y + c % z) + ==> (?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ x' = a % y + b % z)`, +REPEAT GEN_TAC THEN STRIP_TAC THEN EXISTS_TAC ` a + b:real` THEN +EXISTS_TAC `c:real` THEN +REWRITE_TAC[VECTOR_ADD_RDISTRIB] THEN +REWRITE_TAC[VECTOR_ARITH` (a % y + b % y) + c % z = a % y + b % y + c % z `] THEN +ASM_SIMP_TAC[REAL_ARITH ` a + b + c = (a + b) + c`] THEN +ASM_REAL_ARITH_TAC);; + + +let CONV_SET2 = prove(` ! x y:real^A. conv {x,y} = {w | ? a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ + w = a%x + b%y}`, +ONCE_REWRITE_TAC[ MESON[] ` (! a b. P a b ) <=> ( ! a b. a = b \/ ~( a= b) + ==> P a b )`] THEN +REWRITE_TAC[ MESON[]` a \/ b ==> c <=> ( a==> c) /\ ( b==> c)`] THEN +SIMP_TAC[] THEN +REWRITE_TAC[ SET_RULE ` {a,a} = {a}`; CONV_SING; FUN_EQ_THM; IN_ELIM_THM] THEN +REWRITE_TAC[ IN_ACT_SING] THEN +REWRITE_TAC[NOV10] THEN +REWRITE_TAC[conv; sgn_ge; affsign; lin_combo] THEN +REWRITE_TAC[UNION_EMPTY; IN_SET2] THEN +ONCE_REWRITE_TAC[ MESON[]` ~(x = y) ==> (!x'. (?f. P f x') <=> l x') <=> + ~(x = y) ==> (!x'. (?f. ~(x=y) /\ P f x') <=> l x')`] THEN +REWRITE_TAC[ MESON[VSUM_DIS2; SUM_DIS2]` ~(x = y) /\ + x' = vsum {x, y} ff /\ l /\ sum {x, y} f = &1 <=> ~(x = y) /\ + x' = ff x + ff y /\ l /\ f x + f y = &1 `] THEN +REWRITE_TAC[ MESON[]` (!w. w = x \/ w = y ==> &0 <= f w) <=> &0 <= f x /\ &0 <= f y`] THEN +ONCE_REWRITE_TAC[ GSYM (MESON[]` ~(x = y) ==> (!x'. (?f. P f x') <=> l x') <=> + ~(x = y) ==> (!x'. (?f. ~(x=y) /\ P f x') <=> l x')`)] THEN +REPEAT GEN_TAC THEN DISCH_TAC THEN GEN_TAC THEN +REWRITE_TAC[ TRUONG_LEMMA]);; + + +let CONV3_A_EQ = prove(`! x y z. (x = y \/ y = z \/ z = x + ==> conv {x, y, z} = + {w | ?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + w = a % x + b % y + c % z})`, +MATCH_MP_TAC (MESON[] `(! a b c. P a b c <=> P b a c) /\ (! a b c. a = b \/ b = c ==> P a b c) + ==> (! a b c. a = b \/ b = c \/ c = a ==> P a b c )`) THEN +SIMP_TAC[ MESON[ SET_RULE ` {a,b,c} = {b,a,c} `]`conv {x, y, z} = conv {y,x,z}`] THEN +SIMP_TAC[ MESON[ REAL_ARITH` a + b + c = b + a + c`; VECTOR_ARITH` a % x + b % y + c % z + = b % y + a % x + c % z `]` (?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + w = a % x + b % y + c % z) + <=> (?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + w = a % y + b % x + c % z)`] THEN +MATCH_MP_TAC (MESON[]` (! a b c. P a b c <=> P c b a ) /\ (! a b c. a = b ==> P a b c) + ==> (! a b c. a = b \/ b = c ==> P a b c)`) THEN +SIMP_TAC[ MESON[SET_RULE `{a,b,c} ={c,b,a} `]` conv {a,b,c} = conv {c,b,a}`] THEN +SIMP_TAC[ MESON[REAL_ARITH` a + b + c = c + b + a`; VECTOR_ARITH` a % x + b % y + c % z + = c % z + b % y + a % x `]`(?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + w = a % x + b % y + c % z) <=> + (?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + w = a % z + b % y + c % x)`] THEN +REWRITE_TAC[ SET_RULE`{a,a,b} = {a,b}`] THEN +ONCE_REWRITE_TAC[ MESON[]` x = y ==> conv {y,z} = s <=> x = y /\( y = z \/ + ~(y=z))==> conv {y,z} = s `] THEN +KHANANG THEN REWRITE_TAC[ MESON[]` a \/ b ==> c <=> (a==> c) /\ (b==> c)`] THEN +SIMP_TAC[] THEN REWRITE_TAC[SET_RULE`{a,a} ={a}`; CONV_SING] THEN +SIMP_TAC[NOV11] THEN REWRITE_TAC [ GSYM NOV11] THEN +REWRITE_TAC[CONV_SET2] THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN + REWRITE_TAC[ FUN_EQ_THM; IN_ELIM_THM] THEN +GEN_TAC THEN REWRITE_TAC[MESON[]` (a <=> b ) <=> ( a ==> b) /\ (b==> a)`] THEN +REWRITE_TAC[CONV2_CONV3; CONV3_CONV2]);; + + +let VSUM_DIS3 = prove( `! x y z f. ~(x=y\/y=z\/z=x) ==> vsum {x,y,z} f = f x + f y + f z `, +NHANH (SET_RULE` ~(x = y \/ y = z \/ z = x) ==> ({x} INTER {y,z} = {}) `) THEN +REWRITE_TAC[ GSYM DISJOINT; SET_RULE `{x, y, z} = {x} UNION {y,z}` ] THEN +REWRITE_TAC[MESON[FINITE6; VSUM_UNION]` aa /\ DISJOINT {x} {y, z} + ==> vsum ({x} UNION {y, z}) f = ab <=> aa /\ DISJOINT {x} {y, z} ==> + vsum {x} f + vsum {y,z} f = ab `] THEN + MESON_TAC[VSUM_SING; VSUM_DIS2]);; + + +let SUM_DIS3 = prove(` ! x y z f. ~(x = y \/ y = z \/ z = x) ==> sum {x, y, z} f = + f x + f y + f z `, +NHANH (SET_RULE` ~(x = y \/ y = z \/ z = x) ==> ({x} INTER {y,z} = {}) `) THEN +REWRITE_TAC[ GSYM DISJOINT; SET_RULE `{x, y, z} = {x} UNION {y,z}` ] THEN +REWRITE_TAC[MESON[FINITE6; SUM_UNION]` aa /\ DISJOINT {x} {y, z} + ==> sum ({x} UNION {y, z}) f = ab <=> aa /\ DISJOINT {x} {y, z} ==> + sum {x} f + sum {y,z} f = ab `] THEN MESON_TAC[ SUM_SING; SUM_DIS2]);; + + + +let EQ_EXPAND = MESON[] `(a <=> b) <=> ( a ==> b ) /\ ( b ==> a )` ;; + + + +let CONV_SET3 = prove(`! x y z:real^A. conv {x,y,z} = { w | ? a b c. &0 <= a /\ &0 <= b /\ &0 <= c /\ +a + b + c = &1 /\ w = a % x + b % y + c % z } `, +REPEAT GEN_TAC THEN +ONCE_REWRITE_TAC[ MESON[]` conv {x,y,z} = s <=> (x = y \/ y= z \/ z = x ) \/ + ~(x = y \/ y= z \/ z = x ) ==> conv {x,y,z} = s`] THEN +ONCE_REWRITE_TAC[ MESON[]` a \/ b ==> c <=> ( a ==> c ) /\(b==>c)`] THEN +REWRITE_TAC[CONV3_A_EQ] THEN +REWRITE_TAC[conv; FUN_EQ_THM; affsign; IN_ELIM_THM; sgn_ge; lin_combo; UNION_EMPTY] THEN +DISCH_TAC THEN GEN_TAC THEN FIRST_X_ASSUM MP_TAC THEN +ONCE_REWRITE_TAC[ MESON[]` a ==> ((?f. P f ) <=> la ) <=> + a ==> ((?f. a /\ P f ) <=> la ) `] THEN REWRITE_TAC[MESON[VSUM_DIS3]` ~(x = y \/ +y = z \/ z = x) /\ x' = vsum {x, y, z} f /\ l <=> ~(x = y \/ y = z \/ z = x) /\ +x' = f x + f y + f z /\ l `] THEN +REWRITE_TAC[ MESON[SUM_DIS3]` ~(x = y \/ y = z \/ z = x) /\ P /\ Q /\ sum {x,y,z} f = &1 + <=> ~(x = y \/ y = z \/ z = x) /\ P /\ Q /\ ( f x + f y + f z ) = &1`] THEN +REWRITE_TAC[SET_RULE ` (!w. {x, y, z} w ==> &0 <= f w) <=> &0 <= f x /\ + &0 <= f y /\ &0 <= f z `] THEN +ONCE_REWRITE_TAC[ GSYM (MESON[]` a ==> ((?f. P f ) <=> la ) <=> + a ==> ((?f. a /\ P f ) <=> la ) `)] THEN DISCH_TAC THEN +REWRITE_TAC[ EQ_EXPAND] THEN +REWRITE_TAC[ MESON[]` (?f. x' = f x % x + f y % y + f z % z /\ + (&0 <= f x /\ &0 <= f y /\ &0 <= f z) /\ + f x + f y + f z = &1) + ==> (?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + x' = a % x + b % y + c % z)`] THEN STRIP_TAC THEN +EXISTS_TAC ` (\d. if d = (x:real^A) then (a:real) else ( if d = (y:real^A) then + (b:real) else c ))` THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN +REWRITE_TAC[ MESON[]`~( a \/ b ) <=> ~a /\ ~b `] THEN SIMP_TAC[]);; + +(* ========== *) +let CONV3_EQ = prove(` ! x y z. conv_trg {x,y,z} = conv {x,y,z} `, REWRITE_TAC[simpl_conv3; +CONV_SET3]);; +(* ========= *) + +let CONV_BAR_EQ = prove(`! bar s. bar IN barrier s ==> conv bar = conv_trg bar `, +REWRITE_TAC[barrier; IN_ELIM_THM] THEN MESON_TAC[CONV_SET3; simpl_conv3]);; + +let OBSTRUCT_EQ = prove(`!x y s. obstruct x y s <=> obstructed x y s`, +REWRITE_TAC[obstruct; obstructed] THEN REWRITE_TAC[obstruct; obstructed; conv0_2] THEN +MESON_TAC[CONV_BAR_EQ]);; + +(* === repare VC === *) + +(* ==== CARD ASSERTION ==== *) + + +let CARD_CLAUSES_IMP = prove(` !a s. + FINITE s + ==> CARD (a INSERT s) <= SUC (CARD s) /\ + (a IN s ==> CARD (a INSERT s) = CARD s) /\ + (~(a IN s) ==> CARD (a INSERT s) = SUC (CARD s))`, +ONCE_REWRITE_TAC[ MESON[] ` ( a ==> b /\ c ) <=> ( a ==> b ) /\ ( a ==> c )`] THEN +REWRITE_TAC[ MESON[CARD_CLAUSES] ` FINITE s ==> ( a IN s ==> CARD (a INSERT s) = CARD s ) /\ + (~(a IN s) ==> CARD (a INSERT s) = SUC (CARD s))`] THEN +MESON_TAC[ CARD_CLAUSES; ARITH_RULE ` a <= SUC a /\ a <= a `]);; + +(* =================== *) + +let CARD_SING = prove( `! a: A. CARD {a} = 1`, REWRITE_TAC[ MESON[ FINITE6; CARD_EQ_NSUM ] +` CARD {a} = nsum {a} (\x. 1)`] THEN REWRITE_TAC[ NSUM_SING ]);; + +let CARD_SET2 = prove( ` ! a b . ( CARD {a, b} = 2 <=> ~(a = b)) /\ (CARD {a, b} = 1 <=> a = b ) `, +REWRITE_TAC[ MESON[ FINITE6; CARD_CLAUSES ] ` CARD {a,b} = (if a IN {b} then CARD {b} else SUC (CARD {b}))`] +THEN REWRITE_TAC[ MESON[ FINITE6; CARD_CLAUSES ] ` CARD {a} = (if a IN {} then CARD {} else SUC (CARD {}))`] +THEN REWRITE_TAC[ NOT_IN_EMPTY; IN_SING; CARD_CLAUSES; ADD1] THEN +MESON_TAC[ ARITH_RULE ` ~( 0+ 1 = 2 ) /\ (0 + 1) + 1 = 2 /\ ~((0 + 1) + 1 = 1 ) /\ 0 + 1 = 1 `]);; + +(* ============== *) + +let CARD_EQUATION = prove(`!(s: A -> bool) t. + FINITE s /\ FINITE t + ==> CARD (s UNION t) + CARD (s INTER t) = CARD s + CARD t `, +NHANH (MESON[FINITE_INTER; FINITE_UNION] `FINITE s /\ FINITE t ==> FINITE ( s UNION t ) /\ + FINITE ( s INTER t ) `) THEN MESON_TAC[ CARD_EQ_NSUM; NSUM_INCL_EXCL]);; + + +let CARD_DISJOINT = prove(` ! s: A -> bool t. FINITE s /\ FINITE t ==> + ( CARD s + CARD t = CARD ( s UNION t ) <=> s INTER t ={} )`, +MESON_TAC[CARD_EQUATION; ARITH_RULE ` a + b = a <=> b = 0 `; FINITE_INTER; CARD_EQ_0]);; + + +let CARD2 = prove(` ! a b . CARD {a,b} <= 2 /\ ( CARD {a,b} = 2 <=> ~(a = b ) )`, +REWRITE_TAC[ MESON[ CARD_SET2] ` CARD {a, b} = 2 <=> ~(a = b)`] THEN MP_TAC CARD_SET2 THEN +ONCE_REWRITE_TAC[ MESON[] ` CARD {a, b} <= 2 <=> + ( a = b \/ ~( a = b)) /\ CARD {a, b} <= 2`] THEN KHANANG THEN +REWRITE_TAC[ MESON[CARD_SET2] `a = b /\ CARD {a, b} <= 2 \/ ~(a = b) /\ CARD {a, b} <= 2 + <=> a = b /\ 1 <= 2 \/ ~(a = b) /\ 2 <= 2`] THEN +MESON_TAC[ARITH_RULE ` 1 <= 2 /\ 2 <= 2 `]);; + + +let CARD3 = prove(`! a b c . CARD {a,b,c} <= 3 /\ + ( CARD {a,b,c} = 3 <=> ~( a =b \/ b= c\/ c= a ))`, +REWRITE_TAC[ SET_RULE ` {a,b,c} = {a} UNION {b,c}`] THEN +REWRITE_TAC[ ARITH_RULE ` CARD ({a} UNION {b, c}) <= 3 <=> + CARD ({a} UNION {b, c}) + CARD ({a} INTER {b, c}) <= 3 + CARD ({a} INTER {b, c})`] THEN +REWRITE_TAC[ ARITH_RULE ` CARD ({a} UNION {b, c}) = 3 <=> + CARD ({a} UNION {b, c}) + CARD ({a} INTER {b, c}) = 3 + CARD ({a} INTER {b, c})`] THEN +REWRITE_TAC[ MESON[ FINITE_RULES; CARD_EQUATION] ` CARD ({a} UNION {b, c}) + CARD ({a} INTER {b, c}) + = CARD {a} + CARD {b,c} `] THEN REWRITE_TAC[ CARD_SING] THEN +REWRITE_TAC[ ARITH_RULE `! a b. (1 + a <= 3 + b <=> a <= 2 + b ) /\ + (1 + a = 3 + b <=> a = 2 + b )`] THEN +REWRITE_TAC[ MESON[CARD2; ARITH_RULE ` a <= b ==> a <= b + c: num`] ` CARD {b, c} <= 2 + CARD ({a} INTER {b, c})`] THEN +ONCE_REWRITE_TAC[ MESON[CARD2]` CARD {b, c} = P b c <=> CARD {b, c} <= 2 /\ CARD {b, c} = P b c`] THEN +REWRITE_TAC[ ARITH_RULE ` a <= 2 /\ a = 2 + b <=> a = 2 /\ b = 0`] THEN +REWRITE_TAC[ MESON[FINITE_RULES; CARD2; FINITE_INTER; CARD_EQ_0] ` CARD {b, c} = 2 /\ CARD ({a} INTER {b, c}) = 0 + <=> ~(b=c) /\ {a} INTER {b, c} = {}`] THEN SET_TAC[]);; + +(* ========= *) + + +let CARD4 = prove(`!a b c d. + CARD {a, b, c, d} <= 4 /\ + (CARD {a, b, c, d} = 4 <=> + ~(a IN {b, c, d}) /\ ~(b = c \/ c = d \/ d = b))`, +NHANH (MESON[FINITE6; CARD_CLAUSES_IMP]` CARD {a, b, c, d} <= 4 ==> CARD {a, b, c, d} + <= SUC (CARD {b,c,d})`) THEN +NHANH ( MESON[CARD3] ` aa <= SUC (CARD {b, c, d}) ==> CARD {b,c,d} <= 3 `) THEN +REWRITE_TAC[ ARITH_RULE ` CARD {a, b, c, d} <= 4 /\ + CARD {a, b, c, d} <= SUC (CARD {b, c, d}) /\ + CARD {b, c, d} <= 3 <=> + CARD {a, b, c, d} <= SUC (CARD {b, c, d}) /\ CARD {b, c, d} <= 3`] THEN +SIMP_TAC[MESON[FINITE_RULES; CARD_CLAUSES_IMP] ` CARD {a, b, c, d} <= SUC + (CARD {b, c, d})`; CARD3; CARD_CLAUSES_IMP] THEN +REWRITE_TAC[ ARITH_RULE ` CARD {a, b, c, d} = 4 <=> CARD {a, b, c, d} + CARD ( {a} + INTER {b,c,d} ) = 4 + CARD ({a} INTER {b,c,d})`] THEN +REWRITE_TAC[ SET_RULE ` {a,b,c,d} = {a} UNION {b,c,d} ` ] THEN +REWRITE_TAC[ MESON[FINITE_RULES; CARD_EQUATION; CARD_SING] ` CARD ({a} UNION {b, c, d}) + CARD ({a} INTER {b, c, d}) + = 1 + CARD {b,c,d} `] THEN +NHANH (MESON[CARD3] ` 1 + CARD {b, c, d} = aa ==> CARD {b,c,d} <= 3 `) THEN +REWRITE_TAC[ ARITH_RULE `1 + CARD {b, c, d} = 4 + CARD ({a} INTER {b, c, d}) /\ + CARD {b, c, d} <= 3 <=> + CARD {b, c, d} = 3 /\ CARD ({a} INTER {b, c, d}) = 0`] THEN +REWRITE_TAC[ CARD3] THEN +MESON_TAC[ FINITE_RULES; FINITE_INTER; CARD_EQ_0; SET_RULE ` + {a} INTER {b, c, d} = {} <=> ~(a IN {b, c, d})` ]);; + + +let CARD5 = prove(` ! a b c d e. CARD {a,b,c,d,e} <= 5 /\ + ( CARD {a,b,c,d,e} = 5 <=> ~( a IN {b,c,d,e}) /\ + ~(b IN {c, d, e}) /\ ~(c = d \/ d = e \/ e = c))`, +ONCE_REWRITE_TAC[ MESON[ FINITE_RULES; CARD_CLAUSES_IMP] ` CARD {a, b, c, d, e} <= 5 <=> + CARD {a, b, c, d, e} <= SUC ( CARD {b,c,d,e} ) ==> CARD {a, b, c, d, e} <= 5`] THEN +ONCE_REWRITE_TAC[ MESON[CARD4] ` aa ==> CARD {a, b, c, d, e} <= 5 <=> + aa /\ CARD {b,c,d,e} <= 4 ==> CARD {a, b, c, d, e} <= 5`] THEN +REWRITE_TAC[ ARITH_RULE ` a <= SUC b /\ b <= 4 ==> a <= 5 `] THEN +REWRITE_TAC[ ARITH_RULE ` CARD {a, b, c, d, e} = 5 <=> + CARD {a, b, c, d, e} + CARD ({a} INTER {b,c,d,e} ) = 5 + CARD ({a} INTER {b,c,d,e} )`] THEN +REWRITE_TAC[ SET_RULE ` {a,b,c,d,e} = {a} UNION {b,c,d,e} `] THEN +REWRITE_TAC[ MESON[FINITE_RULES; CARD_EQUATION; CARD_SING ]` CARD ({a} UNION {b, c, d, e}) + + CARD ({a} INTER {b, c, d, e}) = 1 + CARD {b,c,d,e} `] THEN +ONCE_REWRITE_TAC[ MESON[ CARD4] ` 1 + CARD {b, c, d, e} = aa <=> CARD {b,c,d,e} <= 4 /\ + 1 + CARD {b, c, d, e} = aa `] THEN +REWRITE_TAC[ ARITH_RULE ` a <= 4 /\ 1 + a = 5 + b <=> a = 4 /\ b = 0`] THEN +REWRITE_TAC[ CARD4; MESON[FINITE_RULES; FINITE_INTER; CARD_EQ_0] ` + CARD ({a} INTER {b, c, d, e}) = 0 <=> {a} INTER {b, c, d, e} ={} `] THEN SET_TAC[]);; +(* ============ *) + +let set_3elements = prove(`(?a b c. ~(a = b \/ b = c \/ c = a) /\ {a, b, c} = {v1, v2, v3}) <=> + ~(v1 = v2 \/ v2 = v3 \/ v3 = v1)`, REWRITE_TAC[GSYM CARD3] THEN +MESON_TAC[]);; + + +let db_t0 = prove(`&2 * t0 = &2 * #1.255 /\ &2 * t0 = #2.51 /\ &2 * #1.255 = #2.51`, + REWRITE_TAC[t0] THEN REAL_ARITH_TAC);; + + +let without_lost = MESON[] ` ! P x. (!a b. P a b <=> P b a) /\ (?a b. P a b /\ x = a) + ==> (?a b. P a b /\ (x = a \/ x = b))`;; + +let condi_of_wlofg = MESON[]` (!a b. P a b <=> P b a) + ==> ((?a b. P a b /\ (x = a \/ x = b)) <=> (?a b. P a b /\ x = a))`;; + + +(* ============ *) + let CARD_SET_OF_LIST_LE = prove + (`!l. CARD(set_of_list l) <= LENGTH l`, + LIST_INDUCT_TAC THEN + SIMP_TAC[LENGTH; set_of_list; CARD_CLAUSES; FINITE_SET_OF_LIST] THEN + ASM_ARITH_TAC);; + + let HAS_SIZE_SET_OF_LIST = prove + (`!l. (set_of_list l) HAS_SIZE (LENGTH l) <=> PAIRWISE (\x y. ~(x = y)) l`, + REWRITE_TAC[HAS_SIZE; FINITE_SET_OF_LIST] THEN LIST_INDUCT_TAC THEN + ASM_SIMP_TAC[CARD_CLAUSES; LENGTH; set_of_list; PAIRWISE; ALL; + FINITE_SET_OF_LIST; GSYM ALL_MEM; IN_SET_OF_LIST] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[SUC_INJ] THEN + ASM_MESON_TAC[CARD_SET_OF_LIST_LE; ARITH_RULE `~(SUC n <= n)`]);; + +(* ====================In your theorem we want the n=4 case, so we instantiate it: +=========================== *) + + let HAS_SIZE_SET_OF_LIST_4 = prove + (`!a b c d:A. {a,b,c,d} HAS_SIZE 4 <=> PAIRWISE (\x y. ~(x = y)) [a;b;c;d]`, + REPEAT GEN_TAC THEN MP_TAC(ISPEC `[a;b;c;d]:A list`HAS_SIZE_SET_OF_LIST) THEN + REWRITE_TAC[LENGTH; set_of_list; ARITH]) ;; + +(* ============================================================================ + Then finally, using this and a bit of straightforward rearrangement, +we can collapse the desired theorem to a lemma that MESON can prove +automatically: +===============================================================================*) + + let SET_OF_4 = prove + (`! a b c d. ( ? v1 v2 v3 v4:A. ~( v1 = v2 \/ v3 = v4 ) /\ + {v1, v2 } INTER {v3, v4 } = {} /\ + { a , b , c , d } = { v1 , v2, v3 ,v4}) <=> + ~ ( a = b \/ a = c \/ a = d \/ b = c \/ b = d \/ c = d )`, + REPEAT GEN_TAC THEN + REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; INTER_EMPTY; SET_RULE + `(a INSERT s) INTER t = {} <=> ~(a IN t) /\ s INTER t = {}`] THEN + MP_TAC(MESON[] + `(?v1 v2 v3 v4:A. {a,b,c,d} = {v1,v2,v3,v4} /\ {v1,v2,v3,v4} HAS_SIZE 4) <=> + {a,b,c,d} HAS_SIZE 4`) THEN + REWRITE_TAC[HAS_SIZE_SET_OF_LIST_4; PAIRWISE; ALL; DE_MORGAN_THM; CONJ_ACI]);; + + +let def_simplex = prove(`! s a b c d. simplex {a, b, c, d} s <=> + packing s /\ + {a, b, c, d} SUBSET s /\ + ~ ( a = b \/ a = c \/ a = d \/ b = c \/ b = d \/ c = d ) `, REWRITE_TAC[ simplex] +THEN REPEAT GEN_TAC THEN MATCH_MP_TAC (MESON[] ` ( x <=> y ) ==> ( a /\ b /\ x <=> +a /\ b /\ y ) `) THEN ONCE_REWRITE_TAC[MESON[]` {v1, v2, v3, v4} = {a, b, c, d} <=> + {a, b, c, d} = {v1, v2, v3, v4} ` ] THEN REWRITE_TAC[ SET_OF_4]);; + + +let strict_qua2_imply_strict_qua = prove(`! q d s. strict_qua2 q d s ==> strict_qua q s `, +REWRITE_TAC[ strict_qua2; strict_qua] THEN NHANH (SET_RULE` d = {x, y} ==> x IN d /\ + y IN d `) THEN MESON_TAC[ SET_RULE ` x IN d /\ d SUBSET s ==> x IN s `]);; + +(* ========== have added to database more =====================*) + + +let strict_qua2_interior_pos = prove( `!s v v1 v2 v3 v4. + interior_pos v v1 v3 v2 v4 s + ==> strict_qua2 {v, v1, v3, v2} {v1, v3} s /\ + strict_qua2 {v, v1, v3, v4} {v1, v3} s /\ + strict_qua2 {v, v2, v4, v1} {v2, v4} s /\ + strict_qua2 {v, v2, v4, v3} {v2, v4} s`, +REWRITE_TAC[ interior_pos; conflicting_dia; adjacent_pai] THEN MESON_TAC[]);; + + +let RELATE_Q_SYS = prove (` ! q s. (?v v1 v3 v2 v4. + (q = {v, v1, v2, v3} \/ q = {v, v1, v3, v4}) /\ + interior_pos v v1 v3 v2 v4 s /\ + anchor_points v1 v3 s = {v, v2, v4} /\ + anchor_points v2 v4 s = {v, v1, v3}) + ==> strict_qua q s`, +NHANH (MATCH_MP (MESON[]`( ! a b c d e f. P a b c d e f ) + ==> P a b c d e f`) strict_qua2_interior_pos) THEN +NHANH (MATCH_MP (MESON[] `( ! x y z. P x y z ) ==> P x y z `) + strict_qua2_imply_strict_qua) THEN +MESON_TAC[ SET_RULE ` {v, v1, v2 , v3 } = {v, v1, v3, v2}`]);; + +(* ======= *) + +let strict_qua_in_oct = prove (`! (q:real^3 -> bool) (s:real^3 -> bool ). (?v w v1 v2 v3 v4. + q = {v, w, v1, v2} /\ quartered_oct v w v1 v2 v3 v4 s) + ==> strict_qua q s `, + +REWRITE_TAC[ quartered_oct; strict_qua; quarter] THEN +ONCE_REWRITE_TAC[ GSYM (MESON[ DIST_TRIANGLE]` dist (v,w) <= dist (v,v1) + dist (v1,w) /\ + dist (v,w) <= dist (v,v2) + dist (v2,w) /\ + q = {v, w, v1, v2} <=> + q = {v, w, v1, v2} `)] THEN +ONCE_REWRITE_TAC[SET_RULE ` (!x. x IN {v1, v2, v3, v4} + ==> dist (x,v) <= &2 * t0 /\ dist (x,w) <= &2 * t0) <=> + (!x. x IN {v1, v2, v3, v4} + ==> dist (x,v) <= &2 * t0 /\ dist (x,w) <= &2 * t0) /\ + dist (v1,v) <= &2 * t0 /\ + dist (v1,w) <= &2 * t0 /\ + dist (v2,v) <= &2 * t0 /\ + dist (v2,w) <= &2 * t0 `] THEN +PHA THEN REWRITE_TAC[ GSYM d3 ] THEN +ONCE_REWRITE_TAC[ SET_RULE ` q = {v, w, v1, v2} <=> q = {v, w, v1, v2} /\ + v IN q /\ w IN q `] THEN +REWRITE_TAC[ MESON[]` d3 v w <= d3 v v1 + d3 v1 w /\ + d3 v w <= d3 v v2 + d3 v2 w /\ + (q = {v, w, v1, v2} /\ v IN q /\ w IN q) /\ + packing s /\ + &2 * t0 < d3 v w /\ + d3 v w < sqrt (&8) /\ last <=> ((q = {v, w, v1, v2} /\ v IN q /\ w IN q) /\ + packing s /\ + &2 * t0 < d3 v w /\ + d3 v w < sqrt (&8) ) /\ d3 v w <= d3 v v1 + d3 v1 w /\ + d3 v w <= d3 v v2 + d3 v2 w /\ last ` ] THEN +REWRITE_TAC[ MESON[]` (?v w v1 v2 v3 v4. + ((q = {v, w, v1, v2} /\ v IN q /\ w IN q) /\ + packing s /\ + &2 * t0 < d3 v w /\ + d3 v w < sqrt (&8)) /\ + last v w v1 v2 v3 v4 ) + ==> aa /\ bb /\ cc /\ + (?x y. x IN q /\ y IN q /\ &2 * t0 < d3 x y /\ d3 x y < sqrt (&8)) <=> + (?v w v1 v2 v3 v4. + ((q = {v, w, v1, v2} /\ v IN q /\ w IN q) /\ + packing s /\ + &2 * t0 < d3 v w /\ + d3 v w < sqrt (&8)) /\ + last v w v1 v2 v3 v4) + ==> aa /\ bb /\ cc `] THEN +REWRITE_TAC[ simplex] THEN PHA THEN SIMP_TAC[] THEN REWRITE_TAC[ d3 ] THEN +ONCE_REWRITE_TAC[ MESON[ prove( + `dist (v,w) <= dist (v,v1) + dist (v1,w) /\ + dist (v1,v) <= &2 * t0 /\ + dist (v1,w) <= &2 * t0 /\ + &2 * t0 < dist (v,w) /\ + dist (v,w) < sqrt (&8) + ==> &0 < dist (v,v1) /\ &0 < dist (v1,w)`, SIMP_TAC[ DIST_SYM; t0] THEN + REAL_ARITH_TAC)] ` + &2 * t0 < dist (v,w) /\ + dist (v,w) < sqrt (&8) /\ + dist (v,w) <= dist (v,v1) + dist (v1,w) /\ + dist (v,w) <= dist (v,v2) + dist (v2,w) /\ + (!x. x IN {v1, v2, v3, v4} + ==> dist (x,v) <= &2 * t0 /\ dist (x,w) <= &2 * t0) /\ + dist (v1,v) <= &2 * t0 /\ + dist (v1,w) <= &2 * t0 /\ + dist (v2,v) <= &2 * t0 /\ + dist (v2,w) <= &2 * t0 /\ + last <=> + &2 * t0 < dist (v,w) /\ + dist (v,w) < sqrt (&8) /\ + dist (v,w) <= dist (v,v1) + dist (v1,w) /\ + dist (v,w) <= dist (v,v2) + dist (v2,w) /\ + (!x. x IN {v1, v2, v3, v4} + ==> dist (x,v) <= &2 * t0 /\ dist (x,w) <= &2 * t0) /\ + dist (v1,v) <= &2 * t0 /\ + dist (v1,w) <= &2 * t0 /\ + dist (v2,v) <= &2 * t0 /\ + dist (v2,w) <= &2 * t0 /\ + &0 < dist (v,v1) /\ + &0 < dist (v1,w) /\ &0 < dist (v,v2) /\ + &0 < dist (v2,w) /\ + last `] THEN +REWRITE_TAC[ t0] THEN +ONCE_REWRITE_TAC[ REAL_ARITH ` &2 <= dist (v1,v2) <=> &2 <= dist (v1,v2) /\ + &0 < dist(v1,v2) `] THEN +REWRITE_TAC[ MESON[] ` &0 < dist ( a, b ) /\ sau <=> sau /\ &0 < dist ( a,b) `] THEN PHA THEN +ONCE_REWRITE_TAC[ MESON[ DIST_NZ]` &0 < dist(a,b) <=> &0 < dist(a,b) /\ ~(a=b) `] THEN +PHA THEN +REWRITE_TAC[ MESON[]` ~(a=b) /\ last <=> last /\ ~( a=b) `] THEN PHA THEN +REWRITE_TAC[ MESON[] ` q = {v, w, v1, v2} /\ + v IN q /\ + w IN q /\ + packing s /\ last <=> packing s /\ q = {v, w, v1, v2} /\ + v IN q /\ + w IN q /\ + last `] THEN +REWRITE_TAC[ MESON[] ` (?v w v1 v2 v3 v4. + packing s /\ last v w v1 v2 v3 v4 ) <=> packing s /\ (?v w v1 v2 v3 v4. + last v w v1 v2 v3 v4 ) `] THEN SIMP_TAC[] THEN +REWRITE_TAC[ MESON[] ` q = {v, w, v1, v2} /\ last <=> last /\ q = {v, w, v1, v2} `] THEN +ONCE_REWRITE_TAC[ SET_RULE ` {v, w, v1, v2, v3, v4} SUBSET s /\ + q = {v, w, v1, v2} <=> {v, w, v1, v2, v3, v4} SUBSET s /\ + q = {v, w, v1, v2} /\ q SUBSET s `] THEN +REWRITE_TAC[ MESON[] ` ~(v = v1) /\ + ~(v1 = w) /\ + ~(v = v2) /\ + ~(v2 = w) /\ + ~(v4 = v1) /\ + ~(v3 = v4) /\ + ~(v2 = v3) /\ + ~(v1 = v2) /\ + {v, w, v1, v2, v3, v4} SUBSET s /\ + q = {v, w, v1, v2} /\ + q SUBSET s <=> {v, w, v1, v2, v3, v4} SUBSET s /\ + q SUBSET s /\ ( ~(v = v1) /\ + ~(v1 = w) /\ + ~(v = v2) /\ + ~(v2 = w) /\ + ~(v4 = v1) /\ + ~(v3 = v4) /\ + ~(v2 = v3) /\ + ~(v1 = v2) /\ q = {v, w, v1, v2} ) `] THEN +REWRITE_TAC[ MESON[] ` a /\ b/\ c <=> ( a/\ b) /\ c `] THEN +REWRITE_TAC[ MESON[]` a /\ b <=> b /\ a `] THEN +REWRITE_TAC[ MESON[] ` (?v w v1 v2 v3 v4. + q = {v, w, v1, v2} /\ + ~(v1 = v2) /\ + ~(v2 = v3) /\ + ~(v3 = v4) /\ + ~(v4 = v1) /\ + ~(v2 = w) /\ + ~(v = v2) /\ + ~(v1 = w) /\ + ~(v = v1) /\ + q SUBSET s /\ la v w v1 v2 v3 v4 ) <=> + q SUBSET s /\ (?v w v1 v2 v3 v4. + q = {v, w, v1, v2} /\ + ~(v1 = v2) /\ + ~(v2 = v3) /\ + ~(v3 = v4) /\ + ~(v4 = v1) /\ + ~(v2 = w) /\ + ~(v = v2) /\ + ~(v1 = w) /\ + ~(v = v1) /\ + la v w v1 v2 v3 v4 ) `] THEN SIMP_TAC[] THEN +ONCE_REWRITE_TAC[ MESON[ REAL_ARITH ` &0 < &2 * #1.255 /\ +( ! a b c. a < b /\ b < c ==> a < c )`; DIST_NZ ] ` &2 * #1.255 < dist (v,w) + <=> ~(v=w) /\ &2 * #1.255 < dist (v,w) ` ] THEN PHA THEN +REWRITE_TAC[ MESON[] ` (~(v = w) /\ &2 * #1.255 < dist (v,w) /\ v IN q /\ w IN q <=> + &2 * #1.255 < dist (v,w) /\ v IN q /\ w IN q /\ ~(v = w)) /\ + (a /\ b /\ c <=> (a /\ b) /\ c) `] THEN +REWRITE_TAC[ MESON[] ` ~(v = w) /\ &2 * #1.255 < dist (v,w) /\ v IN q /\ w IN q <=> + &2 * #1.255 < dist (v,w) /\ v IN q /\ w IN q /\ ~(v = w) + `] THEN +REWRITE_TAC[ MESON[] ` a /\ b /\ c <=> (a/\b) /\ c `] THEN +REWRITE_TAC [MESON[] ` aa /\ ~(v = w) <=> ~(v=w) /\ aa `] THEN PHA THEN +REWRITE_TAC[ MESON[]` ~(v = w) /\ + ~(v = v1) /\ + ~(v1 = w) /\ + ~(v = v2) /\ + ~(v2 = w) /\ + ~(v4 = v1) /\ + ~(v3 = v4) /\ + ~(v2 = v3) /\ + ~(v1 = v2) /\ + q = {v, w, v1, v2} /\ last <=> (~(v = w) /\ + ~(v = v1) /\ + ~(v1 = w) /\ + ~(v = v2) /\ + ~(v2 = w) /\ + ~(v4 = v1) /\ + ~(v3 = v4) /\ + ~(v2 = v3) /\ + ~(v1 = v2) /\ + q = {v, w, v1, v2}) /\ last `] THEN +SIMP_TAC[ SET_RULE ` {v1, v2, v3, v4} = q <=> q = {v1, v2, v3, v4}`] THEN +ONCE_REWRITE_TAC[ MESON[ SET_RULE ` ~(v = w) /\ + ~(v = v1) /\ + ~(v1 = w) /\ + ~(v = v2) /\ + ~(v2 = w) /\ + ~(v4 = v1) /\ + ~(v3 = v4) /\ + ~(v2 = v3) /\ + ~(v1 = v2) ==> + ( {v, w} INTER {v1, v2 } = {} /\ ~(v = w \/ v1 = v2 ) )` ] ` + ~(v = w) /\ + ~(v = v1) /\ + ~(v1 = w) /\ + ~(v = v2) /\ + ~(v2 = w) /\ + ~(v4 = v1) /\ + ~(v3 = v4) /\ + ~(v2 = v3) /\ + ~(v1 = v2) /\ + q = {v, w, v1, v2} <=> + (q = {v, w, v1, v2} /\ + {v, w} INTER {v1, v2} = {} /\ + ~(v = w \/ v1 = v2)) /\ + ~(v = w) /\ + ~(v = v1) /\ + ~(v1 = w) /\ + ~(v = v2) /\ + ~(v2 = w) /\ + ~(v4 = v1) /\ + ~(v3 = v4) /\ + ~(v2 = v3) /\ + ~(v1 = v2) `] THEN +PHA THEN ONCE_REWRITE_TAC[MESON[]` (?v w v1 v2 v3 v4. + q = {v, w, v1, v2} /\ + {v, w} INTER {v1, v2} = {} /\ + ~(v = w \/ v1 = v2) /\ + last v w v1 v2 v3 v4) <=> + (?v w v1 v2. + q = {v, w, v1, v2} /\ + {v, w} INTER {v1, v2} = {} /\ + ~(v = w \/ v1 = v2)) /\ + (?v w v1 v2 v3 v4. + q = {v, w, v1, v2} /\ + {v, w} INTER {v1, v2} = {} /\ + ~(v = w \/ v1 = v2) /\ + last v w v1 v2 v3 v4) `] THEN SIMP_TAC[] THEN PHA THEN +MATCH_MP_TAC (MESON[] `(! q s. gi q s ==> cc q s ) ==> + ( ! q s. a q /\ gi q s /\ b s ==> cc q s ) `) THEN +REWRITE_TAC[ MESON[] ` {v, w, v1, v2, v3, v4} SUBSET s /\ a <=> a /\ + {v, w, v1, v2, v3, v4} SUBSET s `] THEN +REWRITE_TAC[ MESON[]` q = {v, w, v1, v2} /\ a <=> a /\ q = {v, w, v1, v2} `] THEN PHA THEN +ONCE_REWRITE_TAC[SET_RULE ` {v, w, v1, v2, v3, v4} SUBSET s /\ q = {v, w, v1, v2} <=> + {v, w, v1, v2, v3, v4} SUBSET s /\ q = {v, w, v1, v2} /\ q SUBSET s `] THEN +NGOAC THEN ONCE_REWRITE_TAC[MESON[] ` (?v w v1 v2 v3 v4. aaa v w v1 v2 v3 v4 /\ + q SUBSET s ) <=> q SUBSET s /\ (?v w v1 v2 v3 v4. aaa v w v1 v2 v3 v4)`] THEN PHA THEN +SIMP_TAC[] THEN +REWRITE_TAC[ MESON[]` dist (v1,v2) <= &2 * #1.255 /\ + &0 < dist (v1,v2) /\ + &2 <= dist (v1,v2) /\ + dist (v2,w) <= &2 * #1.255 /\ + dist (v2,v) <= &2 * #1.255 /\ + dist (v1,w) <= &2 * #1.255 /\ + dist (v1,v) <= &2 * #1.255 /\ + last <=> + &0 < dist (v1,v2) /\ + &2 <= dist (v1,v2) /\ + last /\ + dist (v1,v2) <= &2 * #1.255 /\ + dist (v2,w) <= &2 * #1.255 /\ + dist (v2,v) <= &2 * #1.255 /\ + dist (v1,w) <= &2 * #1.255 /\ + dist (v1,v) <= &2 * #1.255 `] THEN PHA THEN +ONCE_REWRITE_TAC[ SET_RULE ` q = {v, w, v1, v2} <=> + q = {v, w, v1, v2} /\ + (!x y. + ~({x, y} = {v, w}) /\ x IN q /\ y IN q + ==> (x = v \/ x = w \/ x = v1 \/ x = v2) /\ + (y = v \/ y = w \/ y = v1 \/ y = v2) /\ + ~(x = v /\ y = w \/ x = w /\ y = v)) `] THEN +REWRITE_TAC[ MESON[] ` ~( a\/ b ) <=> ~ a /\ ~ b `] THEN +NGOAC THEN REWRITE_TAC[ MESON[] ` a /\ ( b \/ c ) <=> a /\ b \/ a /\ c `] THEN + +PHA THEN REWRITE_TAC[ MESON[]` day /\ ~(x = v /\ y = w) /\ + ~(x = w /\ y = v) <=> + ~(x = v /\ y = w) /\ + ~(x = w /\ y = v) /\ day `] THEN +PHA THEN REWRITE_TAC[ MESON[] ` ( a \/ b ) /\c <=> a /\ c \/ b /\ c `] THEN PHA THEN +REWRITE_TAC[ MESON[] ` (a\/b) \/ c <=> a \/ b\/ c`] THEN +REWRITE_TAC[ MESON[] ` ~(x = v /\ y = w) /\ + ~(x = w /\ y = v) /\ + (x = v /\ y = v \/ + x = w /\ y = v \/ + x = v1 /\ y = v \/ + x = v2 /\ y = v \/ + x = v /\ y = w \/ + last) <=> + ~(x = v /\ y = w) /\ + ~(x = w /\ y = v) /\ + (x = v /\ y = v \/ x = v1 /\ y = v \/ x = v2 /\ y = v \/ last) `] THEN +REWRITE_TAC[ MESON[ SET_RULE ` ~({x, y} = {v, w}) <=> ~(x = v /\ y = w) /\ ~(x = w /\ y = v)`] + ` (!x y. + ~({x, y} = {v, w}) /\ x IN q /\ y IN q + ==> ~(x = v /\ y = w) /\ ~(x = w /\ y = v) /\ last x y) + <=> (!x y. ~({x, y} = {v, w}) /\ x IN q /\ y IN q ==> last x y) `] THEN +ONCE_REWRITE_TAC[ MESON[DIST_REFL; REAL_ARITH ` a = &0 ==> a <= &2 * #1.255 `] + ` x = v /\ y = v <=> x = v /\ y = v /\ dist(x,y) <= &2 * #1.255 `] THEN +REWRITE_TAC[ MESON[]` ( ! x y. P x y ) /\ last <=> last /\ ( ! x y. P x y)`] THEN PHA THEN +ONCE_REWRITE_TAC[MESON[]` dist (v1,v2) <= &2 * #1.255 /\ + dist (v2,w) <= &2 * #1.255 /\ + dist (v2,v) <= &2 * #1.255 /\ + dist (v1,w) <= &2 * #1.255 /\ + dist (v1,v) <= &2 * #1.255 /\ + (!x y. ~({x, y} = {v, w}) /\ x IN q /\ y IN q ==> last x y) <=> + dist (v1,v2) <= &2 * #1.255 /\ + dist (v2,w) <= &2 * #1.255 /\ + dist (v2,v) <= &2 * #1.255 /\ + dist (v1,w) <= &2 * #1.255 /\ + dist (v1,v) <= &2 * #1.255 /\ + (!x y. + ~({x, y} = {v, w}) /\ x IN q /\ y IN q + ==> + dist (v1,v2) <= &2 * #1.255 /\ + dist (v2,w) <= &2 * #1.255 /\ + dist (v2,v) <= &2 * #1.255 /\ + dist (v1,w) <= &2 * #1.255 /\ + dist (v1,v) <= &2 * #1.255 /\ last x y) `] THEN +REWRITE_TAC[ MESON[ DIST_SYM]`dist (v1,v2) <= &2 * #1.255 /\ + dist (v2,w) <= &2 * #1.255 /\ + dist (v2,v) <= &2 * #1.255 /\ + dist (v1,w) <= &2 * #1.255 /\ + dist (v1,v) <= &2 * #1.255 /\ + (x = v /\ y = v /\ dist (x,y) <= &2 * #1.255 \/ + x = v1 /\ y = v \/ + x = v2 /\ y = v \/ + last) <=> + dist (v1,v2) <= &2 * #1.255 /\ + dist (v2,w) <= &2 * #1.255 /\ + dist (v2,v) <= &2 * #1.255 /\ + dist (v1,w) <= &2 * #1.255 /\ + dist (v1,v) <= &2 * #1.255 /\ + (x = v /\ y = v /\ dist (x,y) <= &2 * #1.255 \/ + x = v1 /\ y = v /\ dist (x,y) <= &2 * #1.255 \/ + x = v2 /\ y = v /\ dist (x,y) <= &2 * #1.255 \/ + last) `] THEN +REWRITE_TAC[ MESON[]` a \/ b \/ c <=> (a \/ b ) \/ c `] THEN +REWRITE_TAC[ MESON[] ` ((((a \/ x = v2 /\ y = v1) \/ x = v /\ y = v2) \/ x = w /\ y = v2) \/ + x = v1 /\ y = v2) \/ + x = v2 /\ y = v2 /\ dist (x,y) <= &2 * #1.255 <=> + (((x = v2 /\ y = v1 \/ x = v /\ y = v2) \/ x = w /\ y = v2) \/ + x = v1 /\ y = v2) \/ + x = v2 /\ y = v2 /\ dist (x,y) <= &2 * #1.255 \/ + a `] THEN +REWRITE_TAC[ GSYM (MESON[]` a \/ b \/ c <=> (a \/ b ) \/ c `)] THEN +REWRITE_TAC[MESON[DIST_SYM ]` dist (v1,v2) <= &2 * #1.255 /\ + dist (v2,w) <= &2 * #1.255 /\ + dist (v2,v) <= &2 * #1.255 /\ + dist (v1,w) <= &2 * #1.255 /\ + dist (v1,v) <= &2 * #1.255 /\ + (x = v2 /\ y = v1 \/ + x = v /\ y = v2 \/ + x = w /\ y = v2 \/ + x = v1 /\ y = v2 \/ last ) + <=> dist (v1,v2) <= &2 * #1.255 /\ + dist (v2,w) <= &2 * #1.255 /\ + dist (v2,v) <= &2 * #1.255 /\ + dist (v1,w) <= &2 * #1.255 /\ + dist (v1,v) <= &2 * #1.255 /\ + ((x = v2 /\ y = v1 \/ + x = v /\ y = v2 \/ + x = w /\ y = v2 \/ + x = v1 /\ y = v2 ) /\ dist( x,y) <= &2 * #1.255 \/ last ) `] THEN +REWRITE_TAC[ MESON[]` a \/ b \/ c <=> (a \/ b ) \/ c `] THEN +REWRITE_TAC[ MESON[]` ((((a \/ x = v1 /\ y = w) \/ + x = v2 /\ y = w) \/ + x = v /\ y = v1) \/ + x = w /\ y = v1) \/ + x = v1 /\ y = v1 /\ dist (x,y) <= &2 * #1.255 <=> + (((x = v1 /\ y = w \/ + x = v2 /\ y = w) \/ + x = v /\ y = v1) \/ + x = w /\ y = v1) \/ + x = v1 /\ y = v1 /\ dist (x,y) <= &2 * #1.255 \/ a `] THEN +REWRITE_TAC[ GSYM (MESON[]` a \/ b \/ c <=> (a \/ b ) \/ c `)] THEN +REWRITE_TAC[ MESON[ DIST_SYM ] ` + dist (v1,v2) <= &2 * #1.255 /\ + dist (v2,w) <= &2 * #1.255 /\ + dist (v2,v) <= &2 * #1.255 /\ + dist (v1,w) <= &2 * #1.255 /\ + dist (v1,v) <= &2 * #1.255 /\ + (x = v1 /\ y = w \/ + x = v2 /\ y = w \/ + x = v /\ y = v1 \/ + x = w /\ y = v1 \/ + last) <=> + dist (v1,v2) <= &2 * #1.255 /\ + dist (v2,w) <= &2 * #1.255 /\ + dist (v2,v) <= &2 * #1.255 /\ + dist (v1,w) <= &2 * #1.255 /\ + dist (v1,v) <= &2 * #1.255 /\ + ((x = v1 /\ y = w \/ + x = v2 /\ y = w \/ + x = v /\ y = v1 \/ + x = w /\ y = v1) /\ + dist (x,y) <= &2 * #1.255 \/ + last) `] THEN +REWRITE_TAC[ MESON[] ` x = v1 /\ y = v2 /\ dist (x,y) <= &2 * #1.255 + <=> (x = v1 /\ y = v2) /\ dist (x,y) <= &2 * #1.255 `] THEN +REWRITE_TAC[ GSYM (MESON[]` a \/ b \/ c <=> (a \/ b ) \/ c `)] THEN +REWRITE_TAC[ MESON[]` a /\ c \/ b /\ c <=> ( a\/ b) /\ c `] THEN NGOAC THEN +ONCE_REWRITE_TAC[ MESON[] ` ( ! x y. P x y ==> L x y /\ TT x y ) <=> + ( ! x y. P x y ==> L x y /\ TT x y ) /\ ( ! x y. P x y ==> TT x y ) `] THEN +NGOAC THEN +REWRITE_TAC[ MESON[]` a /\ (!x y. + (~({x, y} = {v, w}) /\ x IN q) /\ y IN q + ==> dist (x,y) <= &2 * #1.255) <=> (!x y. + (~({x, y} = {v, w}) /\ x IN q) /\ y IN q + ==> dist (x,y) <= &2 * #1.255) /\ a `] THEN +REWRITE_TAC[ MESON[]` ((( a /\dist (v,w) < sqrt (&8)) /\ + &2 * #1.255 < dist (v,w)) /\ + v IN q) /\ + w IN q + <=> (((dist (v,w) < sqrt (&8)) /\ + &2 * #1.255 < dist (v,w)) /\ + v IN q) /\ + w IN q /\ a `] THEN PHA THEN +ONCE_REWRITE_TAC[MESON[ REAL_ARITH ` a < b ==> a <= b `]` (?v w v1 v2 v3 v4. + (!x y. + ~({x, y} = {v, w}) /\ x IN q /\ y IN q + ==> dist (x,y) <= &2 * #1.255) /\ + dist (v,w) < sqrt (&8) /\ + &2 * #1.255 < dist (v,w) /\ + v IN q /\ + w IN q /\ last v w v1 v2 v3 v4 ) + <=> (?v w. + (!x y. + ~({x, y} = {v, w}) /\ x IN q /\ y IN q + ==> dist (x,y) <= &2 * #1.255) /\ + dist (v,w) <= sqrt (&8) /\ + &2 * #1.255 <= dist (v,w) /\ + v IN q /\ + w IN q) /\ (?v w v1 v2 v3 v4. + (!x y. + ~({x, y} = {v, w}) /\ x IN q /\ y IN q + ==> dist (x,y) <= &2 * #1.255) /\ + dist (v,w) < sqrt (&8) /\ + &2 * #1.255 < dist (v,w) /\ + v IN q /\ + w IN q /\ last v w v1 v2 v3 v4 )`] THEN PHA THEN +REPEAT GEN_TAC THEN MATCH_MP_TAC (MESON[] ` ( b ==> d ) ==> (a /\ b /\ c ==> d) `) THEN +MESON_TAC[]);; + +(* ======== *) + +let WHEN_IN_Q_SYS = prove (`! q s. q IN Q_SYS s ==> quasi_reg_tet q s \/ strict_qua q s \/ +(?v v1 v3 v2 v4. + (q = {v, v1, v2, v3} \/ q = {v, v1, v3, v4}) /\ + interior_pos v v1 v3 v2 v4 s /\ + anchor_points v1 v3 s = {v, v2, v4} /\ + anchor_points v2 v4 s = {v, v1, v3})`, +REWRITE_TAC[ Q_SYS; IN_ELIM_THM] THEN MESON_TAC[strict_qua_in_oct] );; + +(* ====== *) + + +let CASES_OF_Q_SYS = prove (`!q s. q IN Q_SYS s ==> quasi_reg_tet q s \/ strict_qua q s`, +NHANH (MATCH_MP (MESON[]` ( ! a b. P a b) ==> P a b` ) WHEN_IN_Q_SYS) THEN +REPEAT GEN_TAC THEN MATCH_MP_TAC (MESON[]` ( c ==> b) ==> aa /\ ( a \/ b\/ c ) + ==> a \/ b `) THEN REWRITE_TAC[ RELATE_Q_SYS]);; + +(* ======= *) + + +let simplex_interior_pos = prove(`!s v v1 v2 v3 v4. + interior_pos v v1 v3 v2 v4 s + ==> simplex {v, v1, v3, v2} s /\ + simplex {v, v1, v3, v4} s /\ + simplex {v, v2, v4, v1} s /\ + simplex {v, v2, v4, v3} s`, +ONCE_REWRITE_TAC[ MESON[strict_qua2_interior_pos]` +interior_pos v v1 v3 v2 v4 s <=> + interior_pos v v1 v3 v2 v4 s /\ strict_qua2 {v, v1, v3, v2} {v1, v3} s /\ + strict_qua2 {v, v1, v3, v4} {v1, v3} s /\ + strict_qua2 {v, v2, v4, v1} {v2, v4} s /\ + strict_qua2 {v, v2, v4, v3} {v2, v4} s `] THEN +REWRITE_TAC[ strict_qua2 ] THEN +NGOAC THEN REWRITE_TAC[ MESON[]` a /\ quarter {v, v1, v2, v3} s <=> + quarter {v, v1, v2, v3} s /\ a `] THEN PHA THEN +REPEAT GEN_TAC THEN MATCH_MP_TAC (MESON[] ` (a /\ b/\c /\ d ==> las ) + ==> ( a/\ b/\ c/\ d /\ dd ==> las ) `) THEN +NGOAC THEN REWRITE_TAC[ MESON[] `(( a /\ packing s ) /\ + simplex {v, v1, v2, v3} s) <=> simplex {v, v1, v2, v3} s /\ packing s /\ a`] THEN +REWRITE_TAC[MESON[]` packing s /\ a <=> a /\ packing s`] THEN PHA THEN +MESON_TAC[quarter]);; + +(* =========== *) + + +let QUA_TET_IMPLY_QUA_TRI = prove(` ! s v0 v1 v2 . (?v4. quasi_reg_tet ({v0, v1, v2} UNION {v4}) s) + ==> quasi_tri {v0, v1, v2} s`, REWRITE_TAC[ quasi_reg_tet; quasi_tri] THEN +REWRITE_TAC[ SET_RULE ` {a,b,c} UNION {d} = {a,b,c,d} `; def_simplex; set_3elements] THEN +MESON_TAC[SET_RULE ` {a,b,c} SUBSET {a,b,c,d} ` ; SUBSET; SUBSET_TRANS]);; + + +let PAIR_D3 = prove(` ! i j u w. {u,w} = {i,j} ==> d3 i j = d3 u w `, +REWRITE_TAC[ SET_RULE ` {u, w} = {i, j} <=> u= i /\ w = j \/ u = j /\ w = i `] THEN +MESON_TAC[ trg_d3_sym]);; + + +let PAIR_DIST = prove(` ! i j u w. {u,w} = {i,j} ==> dist(i,j) = dist(u,w) `, +REWRITE_TAC[ SET_RULE ` {u, w} = {i, j} <=> u= i /\ w = j \/ u = j /\ w = i `] THEN +MESON_TAC[ DIST_SYM]);; + + + +(* ============== *) + +let DIAGONAL_QUA = prove(`!a b q s. + a IN q /\ + b IN q /\ + &2 * t0 < d3 a b /\ + quarter q s + ==> diagonal a b q s `, +REWRITE_TAC[diagonal; SET_RULE ` a IN q /\ b IN q /\ &2 * t0 < d3 a b /\ quarter q s + ==> quarter q s /\ {a, b} SUBSET q /\ l <=> a IN q /\ b IN q /\ &2 * t0 < d3 a b + /\ quarter q s ==> l`] THEN REWRITE_TAC[quarter] THEN NGOAC THEN +REWRITE_TAC[ MESON[] ` a /\ (? u v. P u v ) <=> (? u v. a /\ P u v ) `] THEN +REWRITE_TAC[ REAL_ARITH ` a < b <=> ~( b <= a ) `] THEN +PHA THEN REWRITE_TAC[ MESON[]` a IN q /\ b IN q /\ ~(d3 a b <= &2 * t0) /\ las <=> +las /\ a IN q /\ b IN q /\ ~(d3 a b <= &2 * t0) `] THEN PHA THEN +NHANH (MESON[]` (!x y. + x IN q /\ y IN q /\ ~({x, y} = {v, w}) ==> d3 x y <= &2 * t0) /\ + a IN q /\ + b IN q /\ + ~(d3 a b <= &2 * t0) ==> {a,b} = {v,w} `) THEN +NHANH (MESON[ PAIR_D3] ` aa /\ {a, b} = {v, w} ==> d3 a b = d3 v w `) THEN +MESON_TAC[ PAIR_D3; REAL_ARITH` (a <= a) /\ ( a <= b /\ b <= c ==> a <= c ) `]);; + + + + +let NOV2 = prove( `!a b c v4. + (?i j. i IN {a, b, c} /\ j IN {a, b, c} /\ ~(i = j) /\ #2.51 < d3 i j) /\ + (?v w. + v IN {a, b, c, v4} /\ + w IN {a, b, c, v4} /\ + #2.51 <= d3 v w /\ + d3 v w <= sqrt (&8) /\ + (!x y. + x IN {a, b, c, v4} /\ y IN {a, b, c, v4} /\ ~({x, y} = {v, w}) + ==> d3 x y <= #2.51)) + ==> (?i j. + i IN {a, b, c} /\ + j IN {a, b, c} /\ + #2.51 < d3 i j /\ + (!x y. + x IN {a, b, c} /\ y IN {a, b, c} /\ ~({x, y} = {i, j}) + ==> d3 x y <= #2.51))`, +REWRITE_TAC[ MESON[] ` (? i j. P i j ) /\ (? v w. Q v w ) <=> ( ? i j u w. P i j /\ Q u w ) `] THEN +REWRITE_TAC[ MESON[] ` (i IN {a, b, c} /\ j IN {a, b, c} /\ ~(i = j) /\ #2.51 < d3 i j) /\ aa <=> + aa /\ (i IN {a, b, c} /\ j IN {a, b, c} /\ ~(i = j) /\ #2.51 < d3 i j)`] THEN +PHA THEN +REWRITE_TAC[ REAL_ARITH ` a < b <=> ~( b <= a ) `] THEN +NHANH (MESON[ SET_RULE ` x IN {a,b,c} ==> x IN {a,b,c,d} ` ] ` (!x y. + x IN {a, b, c, v4} /\ y IN {a, b, c, v4} /\ ~({x, y} = {u, w}) + ==> d3 x y <= #2.51) /\ + i IN {a, b, c} /\ + j IN {a, b, c} /\ + ~(i = j) /\ + ~(d3 i j <= #2.51) + ==> {i,j} = {u,w} `) THEN PHA THEN +NHANH ( MESON[ PAIR_D3] ` ~(d3 i j <= #2.51) /\ + {i, j} = {u, w} ==> d3 i j = d3 u w `) THEN +PHA THEN REWRITE_TAC[ MESON[]` {i, j} = {u, w} /\ a <=> a /\ {i, j} = {u, w}`] THEN +REWRITE_TAC[ MESON[] ` (! x y. P x y ) /\ a <=> a /\ (! x y. P x y) `] THEN PHA THEN +NHANH ( MESON[ SET_RULE ` x IN {a,b,c} ==> x IN {a,b,c,d} `] ` {i, j} = {u, w} /\ + (!x y. + x IN {a, b, c, v4} /\ y IN {a, b, c, v4} /\ ~({x, y} = {u, w}) + ==> d3 x y <= #2.51) + ==> (!x y. + x IN {a, b, c} /\ y IN {a, b, c} /\ ~({x, y} = {i, j}) + ==> d3 x y <= #2.51)`) THEN MESON_TAC[]);; + + + +let TRIANGLE_IN_STRICT_QUA = prove( `!s a b c. + (?v4. strict_qua ( {a,b,c} UNION {v4}) s) + ==> quasi_tri {a,b,c} s \/ + (?aa bb. + {aa, bb} SUBSET {a,b,c} /\ + #2.51 < dist (aa,bb) /\ + (!x y. + ~({x, y} = {aa, bb}) /\ {x, y} SUBSET {a,b,c} + ==> dist (x,y) <= #2.51))`, +REWRITE_TAC[ strict_qua; quarter; simplex] THEN +REWRITE_TAC[SET_RULE `{a, b, c} UNION {d} = {a,b,c,d}`;MESON[]` {v1, v2, v3, v4'} = + {a, b, c, v4} <=> {a, b, c, v4} = {v1, v2, v3, v4'} `; SET_OF_4] THEN +REWRITE_TAC[ quasi_tri] THEN +NHANH (MESON[] ` {a, b, c, v4} SUBSET s ==> ((!i j. + i IN {a, b, c} /\ j IN {a, b, c} /\ ~(i = j) + ==> d3 i j <= &2 * t0) \/ + (?i j. + i IN {a, b, c} /\ j IN {a, b, c} /\ ~(i = j) + /\ ~(d3 i j <= &2 * t0))) `) THEN PHA THEN +NHANH (SET_RULE ` {a, b, c, v4} SUBSET s ==> {a, b, c} SUBSET s `) THEN +REPEAT GEN_TAC THEN KHANANG THEN +MATCH_MP_TAC (MESON[] ` ((? a. P a) ==> l) /\ ((?a. Q a ) ==> l ) ==> + (?a . P a \/ Q a ) ==> l `) THEN +REWRITE_TAC[ MESON[]` (?v4. packing s /\ + packing s /\ + {a, b, c, v4} SUBSET s /\ + {a, b, c} SUBSET s /\ + (!i j. + i IN {a, b, c} /\ j IN {a, b, c} /\ ~(i = j) + ==> d3 i j <= &2 * t0) /\ + ~(a = b \/ a = c \/ a = v4 \/ b = c \/ b = v4 \/ c = v4) /\ + (?v w. + v IN {a, b, c, v4} /\ + w IN {a, b, c, v4} /\ + &2 * t0 <= d3 v w /\ + d3 v w <= sqrt (&8) /\ + (!x y. + x IN {a, b, c, v4} /\ + y IN {a, b, c, v4} /\ + ~({x, y} = {v, w}) + ==> d3 x y <= &2 * t0)) /\ + (?x y. + x IN {a, b, c, v4} /\ + y IN {a, b, c, v4} /\ + &2 * t0 < d3 x y /\ + d3 x y < sqrt (&8))) + ==> packing s /\ + {a, b, c} SUBSET s /\ + (?a' b' c'. + ~(a' = b' \/ b' = c' \/ c' = a') /\ {a', b', c'} = {a, b, c}) /\ + (!x y. + x IN {a, b, c} /\ y IN {a, b, c} /\ ~(x = y) + ==> d3 x y <= &2 * t0) \/ + (?aa bb. + {aa, bb} SUBSET {a, b, c} /\ + #2.51 < dist (aa,bb) /\ + (!x y. + ~({x, y} = {aa, bb}) /\ {x, y} SUBSET {a, b, c} + ==> dist (x,y) <= #2.51))`] THEN +REWRITE_TAC[ GSYM d3; REAL_ARITH ` ~( a <= b ) <=> b < a `] THEN +REWRITE_TAC[ t0; REAL_ARITH` &2 * #1.255 = #2.51 `] THEN +REWRITE_TAC[ SET_RULE ` {aa, bb} SUBSET s <=> aa IN s /\ bb IN s `] THEN +ONCE_REWRITE_TAC[ MESON[]`(? x y. P x y ) /\ a <=> a /\ (? x y. P x y )`] THEN PHA THEN +ONCE_REWRITE_TAC[ MESON[] ` (? x y . P x y ) /\ a /\ b <=> a /\ b /\ (? x y. P x y)`] THEN +NHANH (CUTHE4 NOV2 ) THEN MESON_TAC[]);; + +(* ================== *) + + +let A_LEMMA = prove(`!s v0 v1 v2. + quasi_tri {v0, v1, v2} s + ==> (!xx yy. + ~(xx = yy) /\ {xx, yy} SUBSET {v1, v2, v0} + ==> &2 <= dist (xx,yy) /\ dist (xx,yy) <= sqrt (&8)) /\ + ((!aa bb. + aa IN {v1, v2, v0} /\ bb IN {v1, v2, v0} + ==> dist (aa,bb) <= #2.51) \/ + (?aa bb. + {aa, bb} SUBSET {v1, v2, v0} /\ + #2.51 < dist (aa,bb) /\ + (!x y. + ~({x, y} = {aa, bb}) /\ {x, y} SUBSET {v1, v2, v0} + ==> dist (x,y) <= #2.51)))`, +REWRITE_TAC[ MESON[]` a /\ {v0, v1, v2} SUBSET s /\ c <=> ( a /\ {v0, v1, v2} + SUBSET s) /\ c ` ] THEN NHANH (MESON[SET_RULE ` {x,y} SUBSET b /\ b SUBSET s ==> + s x /\ s y `]` (!u v. s u /\ s v /\ ~(u = v) ==> &2 <= dist (u,v)) /\ + {v0, v1, v2} SUBSET s ==> (!xx yy. + ~(xx = yy) /\ {xx, yy} SUBSET {v0, v1, v2} + ==> &2 <= dist (xx,yy) ) `) THEN +REWRITE_TAC[ quasi_tri; set_3elements; packing; MESON[] ` a /\ {v0, v1, v2} SUBSET s /\ c <=> + ( a /\ {v0, v1, v2} SUBSET s)/\c` ] THEN +NHANH (MESON[ SET_RULE ` x IN a /\ a SUBSET s ==> s x ` ] ` (!u v. s u /\ s v /\ + ~(u = v) ==> &2 <= dist (u,v)) /\ {v0, v1, v2} SUBSET s ==> (!x y. + x IN {v0, v1, v2} /\ y IN {v0, v1, v2} /\ ~(x = y) + ==> &2 <= dist (x,y))`) THEN PHA THEN +REWRITE_TAC[ SET_RULE ` x IN {v0, v1, v2} /\ y IN {v0, v1, v2} /\ ~(x = y) <=> + ~(x = y) /\ {x, y } SUBSET {v0, v1, v2}`] THEN +REWRITE_TAC[ t0] THEN +ONCE_REWRITE_TAC[ MESON[ MATCH_MP REAL_LT_RSQRT (REAL_ARITH ` (&2 * #1.255) pow 2 < &8 `); REAL_ARITH` a <= b /\ b < c ==> a <= c ` ]` + d3 x y <= &2 * #1.255 <=> d3 x y <= &2 * #1.255 /\ d3 x y <= sqrt( &8 ) `] THEN +REWRITE_TAC[ REAL_ARITH ` &2 * #1.255 = #2.51`] THEN +NHANH ( MESON[d3; DIST_SYM; DIST_REFL; REAL_ARITH ` &0 <= #2.51 `]` (!x y. + ~(x = y) /\ {x, y} SUBSET {v0, v1, v2} + ==> d3 x y <= #2.51 /\ d3 x y <= sqrt (&8)) + ==> (!x y. + {x, y} SUBSET {v0, v1, v2} + ==> d3 x y <= #2.51 )`) THEN +REWRITE_TAC[ GSYM d3] THEN REWRITE_TAC[ SET_RULE ` a IN s /\ b IN s <=> + {a,b} SUBSET s `] THEN +MESON_TAC[ SET_RULE` {v0, v1, v2} = {v1, v2, v0}`]);; + + + +let NOV1 = prove(` ! s v0 v1 v2 . (?v4. quasi_reg_tet ({v0, v1, v2} UNION {v4}) s) + ==> (!xx yy. + ~(xx = yy) /\ {xx, yy} SUBSET {v1, v2, v0} + ==> &2 <= dist (xx,yy) /\ dist (xx,yy) <= sqrt (&8)) /\ + ((!aa bb. + aa IN {v1, v2, v0} /\ bb IN {v1, v2, v0} ==> dist (aa,bb) <= #2.51) \/ + (?aa bb. + {aa, bb} SUBSET {v1, v2, v0} /\ + #2.51 < dist (aa,bb) /\ + (!x y. + ~({x, y} = {aa, bb}) /\ {x, y} SUBSET {v1, v2, v0} + ==> dist (x,y) <= #2.51)))`, NHANH (CUTHE4 QUA_TET_IMPLY_QUA_TRI) THEN +REPEAT GEN_TAC THEN MATCH_MP_TAC (MESON[]` (b ==> c) ==> a /\ b ==> c `) THEN + REWRITE_TAC[ A_LEMMA]);; + + + +(* ================ *) + + + +(* ======= have added to database_more =========== *) + + + +let DOT_SUB_ADD = VECTOR_ARITH `! a b. b dot b - a dot a = (b - a) dot (b + a)` ;; + +let DIST_LT_HALF_PLANE = prove(`!x:real^A a:real^A b:real^A. + dist(x,a) < dist(x,b) <=> &0 < (a - b) dot (&2 % x - (a + b))`, +ABBREV_TAC ` an a b x = ((a:real^A) - b) dot (&2 % x - (a + b))` THEN +REWRITE_TAC[dist; vector_norm] THEN +REWRITE_TAC[MESON[DOT_POS_LE; SQRT_MONO_LT_EQ]` sqrt ( x dot x) < sqrt (y dot y) <=> + x dot x < y dot y `] THEN +REWRITE_TAC[DOT_LSUB; DOT_RSUB] THEN +SIMP_TAC[DOT_SYM] THEN +ONCE_REWRITE_TAC[ GSYM REAL_SUB_LT] THEN +REWRITE_TAC[ REAL_ARITH ` x dot x - + b dot x - + (b dot x - b dot b) - + (x dot x - a dot x - (a dot x - a dot a)) = + &2 * (a dot x - b dot x) + b dot b - a dot a`] THEN +REWRITE_TAC[GSYM DOT_LSUB; GSYM DOT_RMUL] THEN +REWRITE_TAC[DOT_SUB_ADD; VECTOR_ARITH `(b - a) dot (b + a) = + ( -- ( a - b) ) dot ( a + b) `] THEN +REWRITE_TAC[VECTOR_ARITH ` (a - b) dot &2 % x + --(a - b) dot (a + b) = + (a-b) dot ( &2 % x - (a+b))`] THEN +ASM_REWRITE_TAC[REAL_ARITH ` a - &0 = a` ]);; + + +let OR_IMP_EX = MESON[]` ! a b c. a \/ b ==> c <=> (a ==> c) /\ ( b ==> c)` ;; + + +let HALF_PLANE_CONV = prove(`! a b:real^N. convex { x| x | dist(x,a) < dist (x,b) }`, +REWRITE_TAC[DIST_LT_HALF_PLANE; convex; IN_ELIM_THM] THEN +REWRITE_TAC[VECTOR_ARITH ` &2 % (u % x + v % y) - (a + b) + = u % ( &2 % x ) + v % ( &2 % y ) - &1 % (a + b )`] THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN SIMP_TAC[] THEN +REWRITE_TAC[VECTOR_ARITH ` (a - b) dot (u % &2 % x + + v % &2 % y - (u + v) % (a + b)) = u * (a - b) dot (&2 % x - (a + b)) + + v * (a - b) dot (&2 % y - (a + b))`] THEN +REWRITE_TAC[REAL_ARITH` &0 <= u /\ &0 <= v /\ &1 = u + v <=> + &0 = u /\ &1 = v \/ &0 < u /\ &0 <= v /\ &1 = u + v`] THEN +KHANANG THEN +REWRITE_TAC[OR_IMP_EX] THEN +ONCE_REWRITE_TAC[ EQ_SYM_EQ] THEN SIMP_TAC[] THEN +REWRITE_TAC[REAL_POLY_CLAUSES] THEN +SIMP_TAC[ REAL_ARITH ` a + &0 = a `] THEN +NHANH (MESON[REAL_LT_MUL]` &0 < (a - b) dot (&2 % x - (a + b)) /\ + &0 < (a - b) dot (&2 % y - (a + b)) /\ + &0 < u /\ l ==> &0 < u * ((a - b) dot (&2 % x - (a + b)))`) THEN +NHANH (MESON[REAL_ARITH` &0 < a ==> &0 <= a `; REAL_LE_MUL]` + &0 < (a - b) dot (&2 % y - (a + b)) /\ + &0 < u /\ + &0 <= v /\ l ==> &0 <= v * ((a - b) dot (&2 % y - (a + b)))`) + THEN REAL_ARITH_TAC);; + +let HALF_PLANE_CONV_EP = REWRITE_RULE[convex; IN_ELIM_THM] HALF_PLANE_CONV;; + +let VORONOI_CONV = prove( ` ! (s:real^A -> bool) v. convex (voronoi v s )`, +REWRITE_TAC[voronoi] THEN REPEAT GEN_TAC THEN +REWRITE_TAC[convex; IN_ELIM_THM] THEN MESON_TAC[HALF_PLANE_CONV_EP]);; + +let CONVEX_IM_CONV2_SU = prove(`! s u v. convex s /\ u IN s /\ v IN s ==> conv {u,v} SUBSET s `, +REWRITE_TAC[convex; CONV_SET2] THEN SET_TAC[]);; + +(* have not added *) + +let U_IN_CONV2 = prove(`! u v. u IN conv {u,v} `, +REWRITE_TAC[ CONV_SET2; IN_ELIM_THM] THEN REPEAT GEN_TAC +THEN EXISTS_TAC `&1` THEN EXISTS_TAC `&0 ` THEN +REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO; VECTOR_ADD_RID] THEN +REAL_ARITH_TAC);; + +let UV_IN_CONV2 = prove(` ! u v. u IN conv {u,v} /\ v IN conv {u,v} `, +MESON_TAC[U_IN_CONV2; SET_RULE ` {u,v} = {v,u} `]);; + +let CONVEX_AS_CONV2 = prove(` ! s. convex s ==> ( ! u v. u IN s /\ v IN s <=> + conv {u,v} SUBSET s )`, REWRITE_TAC[ EQ_EXPAND] THEN +SIMP_TAC[CONVEX_IM_CONV2_SU ] THEN MESON_TAC[SUBSET; UV_IN_CONV2]);; + + + + + + +let CONV0_SING = prove(`! x:real^A . conv0 {x} = {x} `, +REWRITE_TAC[conv0; FUN_EQ_THM; affsign; lin_combo] THEN +REWRITE_TAC[UNION_EMPTY; VSUM_SING; SUM_SING; IN_ACT_SING; sgn_gt] THEN +REWRITE_TAC[MESON[REAL_ARITH` &0 < &1 `]` (!w. x = w ==> &0 < f w) /\ + f x = &1 <=> f x = &1 `] THEN +REWRITE_TAC[MESON[VECTOR_MUL_LID]` (?f. x' = f x % x /\ f x = &1) <=> + x' = x /\ (? f. f x = &1 ) `] THEN +MESON_TAC[prove(`!x:real^A. ? f. f x = &1`, GEN_TAC THEN EXISTS_TAC + `(\x:real^A. &1)` THEN MESON_TAC[])]);; + + +let NOV10' = prove(`! x y. (x = y + ==> (!x. y = x <=> + (?a b. &0 < a /\ &0 < b /\ a + b = &1 /\ x = a % y + b % y)))`, +REWRITE_TAC[GSYM VECTOR_ADD_RDISTRIB] THEN +REWRITE_TAC[MESON[VECTOR_MUL_LID]` a + b = &1 /\ + x = (a + b) % y <=> a + b = &1 /\ x = y `] THEN +MESON_TAC[prove(` ?a b. &0 < a /\ &0 < b /\ a + b = &1`, REPEAT + (EXISTS_TAC ` &1 / &2 `) THEN REAL_ARITH_TAC)]);; + + +let CONV0_SET2 = prove(` ! x y:real^A. conv0 {x,y} = {w | ? a b. &0 < a /\ &0 < b /\ a + b = &1 /\ + w = a%x + b%y}`, +ONCE_REWRITE_TAC[ MESON[] ` (! a b. P a b ) <=> ( ! a b. a = b \/ ~( a= b) + ==> P a b )`] THEN +REWRITE_TAC[ MESON[]` a \/ b ==> c <=> ( a==> c) /\ ( b==> c)`] THEN +SIMP_TAC[] THEN +REWRITE_TAC[ SET_RULE ` {a,a} = {a}`; CONV0_SING; FUN_EQ_THM; IN_ELIM_THM] THEN +REWRITE_TAC[ IN_ACT_SING; NOV10'] THEN +REWRITE_TAC[conv0 ; sgn_gt; affsign; lin_combo] THEN +REWRITE_TAC[UNION_EMPTY; IN_SET2] THEN +ONCE_REWRITE_TAC[ MESON[]` ~(x = y) ==> (!x'. (?f. P f x') <=> l x') <=> + ~(x = y) ==> (!x'. (?f. ~(x=y) /\ P f x') <=> l x')`] THEN +REWRITE_TAC[ MESON[VSUM_DIS2; SUM_DIS2]` ~(x = y) /\ + x' = vsum {x, y} ff /\ l /\ sum {x, y} f = &1 <=> ~(x = y) /\ + x' = ff x + ff y /\ l /\ f x + f y = &1 `] THEN +REWRITE_TAC[ MESON[]` (!w. w = x \/ w = y ==> &0 < f w) <=> &0 < f x /\ &0 < f y`] THEN +ONCE_REWRITE_TAC[ GSYM (MESON[]` ~(x = y) ==> (!x'. (?f. P f x') <=> l x') <=> + ~(x = y) ==> (!x'. (?f. ~(x=y) /\ P f x') <=> l x')`)] THEN +REPEAT GEN_TAC THEN DISCH_TAC THEN GEN_TAC THEN +REWRITE_TAC[ EQ_EXPAND] THEN +SIMP_TAC[ MESON[]` ((?f. x' = f x % x + f y % y /\ (&0 < f x /\ &0 < f y) /\ f x + f y = &1) + ==> (?a b. &0 < a /\ &0 < b /\ a + b = &1 /\ x' = a % x + b % y)) `] THEN +STRIP_TAC THEN EXISTS_TAC ` (\(d:real^A). if d = x then (a:real) else b )` THEN +ASM_SIMP_TAC[]);; + + +let CONV02_SU_CONV2 = prove(` ! u v. conv0 {u,v} SUBSET conv {u,v} `, +REWRITE_TAC[ CONV_SET2; CONV0_SET2] THEN +MP_TAC (REAL_ARITH ` ! a . &0 < a ==> &0 <= a `) THEN SET_TAC[]);; + + +let CONVEX_IM_CONV02_SU = prove(`! s u v. convex s /\ u IN s /\ v IN s ==> +conv0 {u, v} SUBSET s`, +MESON_TAC[CONV02_SU_CONV2; CONVEX_IM_CONV2_SU; SUBSET_TRANS]);; + +let PAIR_EQ_EXPAND = + SET_RULE `{a,b} = {c,d} <=> a = c /\ b = d \/ a = d /\ b = c`;; + +let IN_SET3 = SET_RULE ` x IN {a,b,c} <=> x = a \/ x = b \/ x = c `;; + +let IN_SET4 = SET_RULE ` x IN {a,b,c,d} <=> x = a \/ x = b \/ x = c \/ x = d `;; + +let FOUR_IN = SET_RULE `!a b c d. a IN {a,b,c,d} /\ b IN {a,b,c,d} /\c IN {a,b,c,d} /\ d IN {a,b,c,d} ` ;; + + + + + +(* TAG 1 *) + +let DIA_OF_QUARTER = prove(`! a b q s. diagonal a b q s ==> &2 * t0 <= d3 a b /\ d3 a b + <= sqrt (&8) `, +REWRITE_TAC[ diagonal; quarter] THEN +REWRITE_TAC[ SET_RULE ` {a,b} SUBSET s <=> a IN s /\ b IN s `] THEN +REWRITE_TAC[ SET_RULE ` {a,b} SUBSET s <=> a IN s /\ b IN s `; t0] THEN +MESON_TAC[PAIR_D3; MATCH_MP REAL_LE_RSQRT (REAL_ARITH ` (&2 * #1.255) pow 2 <= &8 `); + REAL_ARITH ` a <= b /\ b <= c ==> a <= c `]);; + +let D3_REFL = prove(` !x. d3 x x = &0 ` , MESON_TAC[d3; DIST_REFL]);; + +let db_t0_sq8 = MATCH_MP REAL_LT_RSQRT (REAL_ARITH ` #2.51 pow 2 < &8 `);; + +let def_obstructed = prove(`!s x y. + obstructed x y s <=> + (?bar. bar IN barrier s /\ ~(conv0 {x, y} INTER conv bar = {}))`, + REWRITE_TAC[ obstructed; conv0_2] THEN REWRITE_TAC[ simp_def]);; + +let SUB_PACKING = prove(`!sub s. + packing s /\ sub SUBSET s + ==> (!x y. x IN sub /\ y IN sub /\ ~(x = y) ==> &2 <= d3 x y)`, +REWRITE_TAC[ packing; GSYM d3] THEN SET_TAC[]);; + + + + +let SHORT_EDGES = prove(` ! a b c w. d3 c a <= &2 * t0 /\ + d3 c b <= &2 * t0 /\ + (!aa. aa IN {a, b, c} ==> d3 aa w <= &2 * t0) + ==> (!x y. + x IN {a, b, c, w} /\ y IN {a, b, c, w} /\ ~({x, y} = {a, b}) + ==> d3 x y <= &2 * t0)`, +REPEAT GEN_TAC THEN +REWRITE_TAC[ IN_SET3; IN_SET4; PAIR_EQ_EXPAND; t0] THEN +MESON_TAC[ D3_REFL; trg_d3_sym; REAL_ARITH ` &0 <= &2 * #1.255`]);; + + + +(* == CARD ASSERTIONN == *) +(* changing truong *) + +let OBS_SYM = prove(` ! a b s. obstructed a b s <=> obstructed b a s `, + REWRITE_TAC[ def_obstructed] THEN SIMP_TAC[ SET_RULE` {a,b} = {b,a}`]);; + +(* need VC *) +let OBS_IMP_NOT_IN_VC = prove(`!x w s. obstructed x w s ==> ~(x IN VC w s \/ w IN VC x s)`, +REWRITE_TAC[VC; lambda_x; IN_ELIM_THM] THEN MESON_TAC[ OBS_SYM]);; + + +let IN_Q_IMP_BAR = +prove(` {v0, v1, v2, w} IN Q_SYS s ==> {v0,v1,v2} IN barrier s `, +REWRITE_TAC[ barrier; SET_RULE` {a,b,c} UNION {d} = {a,b,c,d} `; IN_ELIM_THM] + THEN MESON_TAC[]);; + + +let v_near2t0_v = MESON[near2t0; t0; DIST_REFL; SET_RULE ` x IN { x | P x} <=> P x ` ; + REAL_ARITH ` &0 < &2 * #1.255 `] ` w IN s ==> w IN near2t0 w s `;; + +(* need VC *) +let in_VC = prove( +`!w s x. + w IN s /\ + dist (w,x) < &2 /\ + (!w'. s w' /\ ~(w' = w) ==> dist (x,w) < dist (x,w')) /\ + ~obstructed w x s + ==> x IN VC w s`, REWRITE_TAC[ VC; lambda_x ; d3; IN_ELIM_THM] THEN + MESON_TAC[ DIST_SYM; SET_RULE ` i IN x <=> x i `]);; + + +let MEETING_CONDITION = prove(` ! x y v1 v2 v3. ~(conv0 {x, y} INTER conv_trg {v1, v2, v3} = {}) /\ dist (x,y) < t0 + ==> ~(normball x #1.255 INTER conv {v1, v2, v3} = {})`, +REWRITE_TAC[ GSYM conv0_2; simp_def] THEN +REWRITE_TAC[ SET_RULE ` ~( a INTER b = {} ) <=> (? d. d IN a /\ d IN b )`; + IN_ELIM_THM] THEN +NHANH (MESON[ VECTOR_ARITH ` x = &1 % x ` ]` d = t % x + (&1 - t) % y ==> + x = &1 % x `) THEN +NHANH (VECTOR_ARITH ` d = t % x + (&1 - t) % y /\ x = &1 % x + ==> d - x = (t - &1) % ( x - y)`) THEN +NHANH ( MESON[NORM_MUL]` d - x = (t - &1) % (x - y) ==> norm ( d - x ) = + abs ( t- &1 ) * norm ( x-y)`) THEN +REWRITE_TAC[ GSYM dist] THEN +NHANH (REAL_ARITH `&0 < t /\ t < &1 /\ aa ==> abs (t - &1) < &1`) THEN +NHANH (MESON[DIST_POS_LE]` dist (d,x) = abs (t - &1) * dist (x,y) ==> &0 <= dist(x,y)`) THEN +PHA THEN +REWRITE_TAC[ REAL_ARITH ` abs (t - &1) < &1 <=> &0 < &1 - abs (t - &1) `] THEN +NHANH (MESON[REAL_LE_MUL_EQ] ` &0 <= dist (x,y) /\ + &0 < &1 - abs (t - &1) ==> &0 <= dist (x,y) * (&1 - abs (t - &1))`) THEN +REWRITE_TAC[ REAL_ARITH ` a * ( b - c ) = a * b - a * c `] THEN +REWRITE_TAC[ REAL_ARITH ` &0 <= a - b <=> b <= a `] THEN +NHANH (REAL_ARITH ` dist (d,x) = abs (t - &1) * dist (x,y) /\ + (&0 <= dist (x,y) /\ &0 < &1 - abs (t - &1)) /\ + dist (x,y) * abs (t - &1) <= dist (x,y) * &1 + ==> dist(d,x) <= dist(x,y)`) THEN +NGOAC THEN NHANH (MESON[]`(? d . ( ? t. PP t d /\ dist (d,x) <= dist (x,y)) /\ aa d ) ==> (? d. dist (d,x) + <= dist (x,y) /\ aa d ) `) THEN +PHA THEN REPEAT GEN_TAC THEN +MATCH_MP_TAC (MESON[] ` (b /\ c ==> d) ==> ( a/\ b/\ c )==> d `) THEN +REWRITE_TAC[normball; IN_ELIM_THM; GSYM t0] THEN +REWRITE_TAC[ MESON[]` (? a . P a ) /\ aa <=> (? a. aa /\ P a ) `] THEN +MESON_TAC[ REAL_ARITH ` a < b /\ c <= a ==> c < b `]);; + + +(* needs VC *) +let VC_DISJOINT = prove ( `! s a b. ( ~( a = b ) ==> VC a s INTER VC b s = {}) /\ + VC a s INTER VC_INFI s = {} `, +REWRITE_TAC[ VC_INFI; SET_RULE ` VC a s INTER {z | !x. ~(z IN VC x s)} = {} `] THEN +REWRITE_TAC[ VC; lambda_x ] THEN +REWRITE_TAC[ SET_RULE` a INTER b = {} <=> (! x. ~( x IN a /\ x IN b ))`] THEN +REWRITE_TAC[ SET_RULE ` x IN { x | p x } <=> p x `] THEN +REWRITE_TAC[ MESON[] ` ! a P. a ==> (!x. ~P x) <=> a ==> (!x. ~a \/ ~P x) `] THEN +REWRITE_TAC[ MESON[] ` a = b \/ + ~(((a IN s /\ d3 a x < &2 /\ ~obstructed a x s) /\ + (!w. (w IN s /\ d3 w x < &2 /\ ~obstructed w x s) /\ ~(w = a) + ==> d3 x a < d3 x w)) /\ + (b IN s /\ d3 b x < &2 /\ ~obstructed b x s) /\ + (!w. (w IN s /\ d3 w x < &2 /\ ~obstructed w x s) /\ ~(w = b) + ==> d3 x b < d3 x w)) <=> + ~(~(a = b) /\ + ((a IN s /\ d3 a x < &2 /\ ~obstructed a x s) /\ + (!w. (w IN s /\ d3 w x < &2 /\ ~obstructed w x s) /\ ~(w = a) + ==> d3 x a < d3 x w)) /\ + (b IN s /\ d3 b x < &2 /\ ~obstructed b x s) /\ + (!w. (w IN s /\ d3 w x < &2 /\ ~obstructed w x s) /\ ~(w = b) + ==> d3 x b < d3 x w)) `] THEN PHA THEN +MESON_TAC[ REAL_ARITH ` ! a b. ~( a < b /\ b < a ) `]);; + + +let DIAGONAL_STRICT_QUA = prove(` !a b q s. + a IN q /\ b IN q /\ &2 * t0 < d3 a b /\ strict_qua q s + ==> diagonal a b q s`, +REWRITE_TAC[ SET_RULE ` a IN q /\ b IN q /\ l ==> aa /\ {a,b} SUBSET q /\ bb + <=> a IN q /\ b IN q /\ l ==> aa /\ bb `] THEN +REWRITE_TAC[ MESON[]` a /\ b/\ c /\ d /\ e ==> d /\ f <=> a /\ b/\ c /\ d /\ e ==> f `] THEN +MESON_TAC[strict_qua; DIAGONAL_QUA]);; + +(* ========== *) + +let DIAGONAL_BARRIER = prove(` ! s v1 v2 bar .v1 IN bar /\ v2 IN bar /\ bar IN barrier s /\ &2 * t0 < d3 v1 v2 + ==> (? w. diagonal v1 v2 ( w INSERT bar ) s )`, +REWRITE_TAC[ barrier; IN_ELIM_THM] THEN +PHA THEN REWRITE_TAC[ MESON[] ` a /\ b /\ (? u v w. P u v w ) /\ d <=> + (? u v w. P u v w /\ a /\ b /\ d ) `] THEN +KHANANG THEN +REWRITE_TAC[ MESON[]` (? a b c. P a b c) /\ l <=> (?a b c. P a b c /\ l)`] THEN +REWRITE_TAC[ quasi_tri; t0] THEN +NHANH ( REAL_ARITH ` &2 * #1.255 < a ==> ~( a = &0 ) `) THEN +REWRITE_TAC[d3; DIST_EQ_0] THEN +NGOAC THEN +PURE_ONCE_REWRITE_TAC[ MESON[]` P {a,b,c} /\ bar = {a,b,c} <=> P bar /\ bar + = {a,b,c} `] THEN +REWRITE_TAC[quasi_tri; REAL_ARITH ` a <= b <=> ~( b < a ) `] THEN PHA THEN +REWRITE_TAC[ MESON[]` ~((!x y. + x IN bar /\ y IN bar /\ ~(x = y) ==> ~(&2 * #1.255 < dist (x,y))) /\ + aaa /\ + v1 IN bar /\ + v2 IN bar /\ + &2 * #1.255 < dist (v1,v2) /\ + ~(v1 = v2))`] THEN +NHANH (CUTHE2 CASES_OF_Q_SYS) THEN +REWRITE_TAC[ MESON[]` (? a . P a ) /\ l <=> (? a. P a /\ l ) `] THEN +KHANANG THEN +PURE_ONCE_REWRITE_TAC[ MESON[]` P bar /\ bar = s /\ l <=> P s /\ bar = s /\ l`] THEN +NHANH (MESON[QUA_TET_IMPLY_QUA_TRI] ` quasi_reg_tet ({v0, v1, v2} UNION {v4}) s ==> + quasi_tri {v0, v1, v2} s`) THEN +REWRITE_TAC[ quasi_tri] THEN +REWRITE_TAC[d3;t0; REAL_ARITH ` a <= &2 * #1.255 <=> ~(&2 * #1.255 < a ) `] THEN PHA THEN +REWRITE_TAC[ MESON[]` ~((!x y. + x IN {v1', v2', v3} /\ y IN {v1', v2', v3} /\ ~(x = y) + ==> ~(&2 * #1.255 < dist (x,y))) /\ + bar = {v1', v2', v3} /\ + v1 IN bar /\ + v2 IN bar /\ + &2 * #1.255 < dist (v1,v2) /\ + ~(v1 = v2))`] THEN +REWRITE_TAC[ GSYM d3; GSYM t0] THEN +REWRITE_TAC[ MESON[]` strict_qua ({v1', v2', v3} UNION {v4}) s /\ bar = {v1', v2', v3} /\ l <=> + strict_qua (bar UNION {v4}) s /\ bar = {v1', v2', v3} /\ l`] THEN +ONCE_REWRITE_TAC[ SET_RULE ` bar UNION {v4} = v4 INSERT bar `] THEN +MESON_TAC[ DIAGONAL_STRICT_QUA; SET_RULE ` x IN bar ==> x IN ( a INSERT bar)`]);; + + +(* ======= end simplizee.ml =========== *) + +(* ======= im_le_82.ml ================ *) + +let quasi_tri_case = prove( ` ! s x y. (?v1 v2 v3. + ~(x IN {v1, v2, v3}) /\ + quasi_tri {v1, v2, v3} s /\ + ~(conv0 {x, y} INTER conv_trg {v1, v2, v3} = {}) /\ + dist (x,y) < t0) + ==> (?v1 v2 v3. + packing s /\ + ~(v1 = v2 \/ v2 = v3 \/ v3 = v1) /\ + dist (v1,v2) <= #2.51 /\ + dist (v2,v3) <= #2.51 /\ + dist (v3,v1) < sqrt (&8) /\ + {v1, v2, v3} SUBSET s /\ + ~(x IN {v1, v2, v3}) /\ + ~(conv0 {x, y} INTER conv_trg {v1, v2, v3} = {}) /\ + dist (x,y) < t0)`, +REWRITE_TAC[ quasi_tri; set_3elements] THEN PHA THEN + REWRITE_TAC[ d3; MESON[t0; REAL_ARITH ` &2 * #1.255 = #2.51 `] ` &2 * t0 = #2.51 `] THEN +REWRITE_TAC[ MESON[]` a /\ b /\ c /\ d /\e /\ f <=> a /\ b /\ c /\ (d /\e) /\ f`] THEN +ONCE_REWRITE_TAC[ SET_RULE ` ~(v1 = v2 \/ v2 = v3 \/ v3 = v1) /\ + (!x y. + x IN {v1, v2, v3} /\ y IN {v1, v2, v3} /\ ~(x = y) + ==> dist (x,y) <= #2.51) + <=> ~(v1 = v2 \/ v2 = v3 \/ v3 = v1) /\ + (!x y. + x IN {v1, v2, v3} /\ y IN {v1, v2, v3} /\ ~(x = y) + ==> dist (x,y) <= #2.51) /\ + dist (v1,v2) <= #2.51 /\ + dist (v2,v3) <= #2.51 /\ + dist (v3,v1) <= #2.51 `] THEN +ONCE_REWRITE_TAC[MESON[ REAL_ARITH ` &2 * #1.255 = #2.51 `; MATCH_MP REAL_LT_RSQRT (REAL_ARITH `(&2 * #1.255) pow 2 < &8`); + REAL_ARITH` a <= b /\ b < c ==> a < c `] ` + a /\ dist (v3,v1) <= #2.51 <=> a /\ dist (v3,v1) < sqrt ( &8 ) /\ dist (v3,v1) <= #2.51`] THEN + MESON_TAC[]);; + + + +(* ----------- have added to database_more --------------*) + + + +let OCT23 = prove(`! s v1 v2 v3 v4. + {v1, v2, v3} UNION {v4} IN Q_SYS s + ==> packing s /\ + ~(v1 = v2 \/ v2 = v3 \/ v3 = v1) /\ + {v1, v2, v3} SUBSET s` , +REPEAT GEN_TAC THEN MP_TAC (prove(`! q s. q IN Q_SYS s ==> quasi_reg_tet q s \/ strict_qua q s \/ +(?v v1 v3 v2 v4. + (q = {v, v1, v2, v3} \/ q = {v, v1, v3, v4}) /\ + interior_pos v v1 v3 v2 v4 s /\ + anchor_points v1 v3 s = {v, v2, v4} /\ + anchor_points v2 v4 s = {v, v1, v3})`, +REWRITE_TAC[ Q_SYS; IN_ELIM_THM] THEN MESON_TAC[strict_qua_in_oct] )) THEN +MATCH_MP_TAC (MESON[]`((!q s. q IN Q_SYS s ==> R q s) + ==> R ({v1, v2, v3} UNION {v4}) s + ==> last v1 v2 v3 s) + ==> (!q s. q IN Q_SYS s ==> R q s) + ==> {v1, v2, v3} UNION {v4} IN Q_SYS s + ==> last v1 v2 v3 s`) THEN +DISCH_TAC THEN +REWRITE_TAC[ quasi_reg_tet; strict_qua ] THEN + PHA THEN KHANANG THEN +REWRITE_TAC[ quarter] THEN +PHA THEN +REWRITE_TAC[ MESON[]` packing s /\simplex ({v1, v2, v3} UNION {v4}) s /\ last <=> + simplex ({v1, v2, v3} UNION {v4}) s /\ packing s /\ last`] THEN +REWRITE_TAC[ SET_RULE ` {v1, v2, v3} UNION {v4} = { v1, v2, v3, v4} `] THEN +MP_TAC (MESON[ def_simplex; SET_RULE ` {a, b, c, d} SUBSET s ==> {a, b, c} SUBSET s `] ` + simplex {v1, v2, v3, v4} s ==> packing s /\ ~(v1 = v2 \/ v2 = v3 \/ v3 = v1) /\ {v1, v2, v3} SUBSET s `) THEN +MATCH_MP_TAC (MESON[]` (cc ==> last) + ==> (aa ==> last) + ==> aa /\ la1 \/ aa /\ la2 \/ cc + ==> last`) THEN +REWRITE_TAC[ MESON[]` a = b /\ (aa /\ bb b s) /\ last <=> bb a s /\ aa /\ a = b /\ last`] THEN +REWRITE_TAC[def_simplex] THEN +ONCE_REWRITE_TAC[ MESON[simplex_interior_pos]` interior_pos v v1 v3 v2 v4 s <=> interior_pos v v1 v3 v2 v4 s + /\ simplex {v, v1, v3, v2} s /\ + simplex {v, v1, v3, v4} s /\ + simplex {v, v2, v4, v1} s /\ + simplex {v, v2, v4, v3} s `] THEN PHA THEN +REWRITE_TAC[ MESON[]` {v1, v2, v3, v4} = {v, v1', v2', v3'} /\ + aa /\ simplex {v, v1', v3', v2'} s /\ ss + <=> ( simplex {v, v1', v3', v2'} s /\ {v1, v2, v3, v4} = {v, v1', v2', v3'}) /\ aa /\ ss `] THEN +REWRITE_TAC[ MESON[SET_RULE ` {v, v1, v2 , v3} = {v, v1, v3, v2} ` ] ` + (simplex {v, v1', v3', v2'} s /\ {v1, v2, v3, v4} = {v, v1', v2', v3'}) /\ ff <=> + simplex {v1, v2, v3, v4} s /\ {v1, v2, v3, v4} = {v, v1', v2', v3'} /\ ff`] THEN +MESON_TAC[ def_simplex; SET_RULE ` {v1, v2, v3, v4} SUBSET s ==> {v1, v2, v3} SUBSET s`]);; + + +(* ================== *) + + +let OCT24 = prove(`! s x y. (?v1 v2 v3. + ~(x IN {v1, v2, v3}) /\ + (?v4. (!vv1 vv2 vv3. + {vv1, vv2, vv3} = {v1, v2, v3} ==> ~(#2.51 < dist (vv3,vv1))) /\ + {v1, v2, v3} UNION {v4} IN Q_SYS s) /\ + ~(conv0 {x, y} INTER conv_trg {v1, v2, v3} = {}) /\ + dist (x,y) < t0) ==> +(?v1 v2 v3. + packing s /\ + ~(v1 = v2 \/ v2 = v3 \/ v3 = v1) /\ + dist (v1,v2) <= #2.51 /\ + dist (v2,v3) <= #2.51 /\ + dist (v3,v1) < sqrt (&8) /\ + {v1, v2, v3} SUBSET s /\ + ~(x IN {v1, v2, v3}) /\ + ~(conv0 {x, y} INTER conv_trg {v1, v2, v3} = {}) /\ + dist (x,y) < t0)`, +ONCE_REWRITE_TAC[ MESON[OCT23] ` {v1, v2, v3} UNION {v4} IN Q_SYS s <=> + {v1, v2, v3} UNION {v4} IN Q_SYS s /\ packing s /\ + ~(v1 = v2 \/ v2 = v3 \/ v3 = v1) /\ + {v1, v2, v3} SUBSET s `] THEN +ONCE_REWRITE_TAC[ MESON[ SET_RULE` {v1, v3 , v2 } = { v1, v2 , v3} /\ { v2, v1, v3 } = { v1, v2, v3 }`]` + (!vv1 vv2 vv3. + {vv1, vv2, vv3} = {v1, v2, v3} ==> ~(#2.51 < dist (vv3,vv1))) + <=> (!vv1 vv2 vv3. + {vv1, vv2, vv3} = {v1, v2, v3} ==> ~(#2.51 < dist (vv3,vv1))) /\ ~(#2.51 < dist (v3,v1)) /\ + ~(#2.51 < dist (v2,v1)) /\ + ~(#2.51 < dist (v3,v2)) `] THEN +REWRITE_TAC[ REAL_ARITH ` ~( a < b ) <=> b <= a`] THEN SIMP_TAC[ DIST_SYM] THEN +MESON_TAC[MESON[ MATCH_MP REAL_LT_RSQRT (REAL_ARITH `(&2 * #1.255) pow 2 < &8`); + REAL_ARITH ` &2 * #1.255 = #2.51 /\ ( a <= b /\ b < c ==> a < c ) `]` dist (v1,v3) <= #2.51 + <=> dist (v1,v3) <= #2.51 /\ dist (v1,v3) < sqrt (&8) `]);; + + + +(* ============= *) + + +let quasi_reg_tet_case = prove (`! s x y. (?v1 v2 v3. + (?v4 vv1 vv2 vv3. + {vv1, vv2, vv3} = {v1, v2, v3} /\ + #2.51 < dist (vv3,vv1) /\ + {v1, v2, v3} UNION {v4} IN Q_SYS s /\ + quasi_reg_tet ({v1, v2, v3} UNION {v4}) s) /\ + ~(x IN {v1, v2, v3}) /\ + ~(conv0 {x, y} INTER conv_trg {v1, v2, v3} = {})) + ==> (?v1 v2 v3. + packing s /\ + ~(v1 = v2 \/ v2 = v3 \/ v3 = v1) /\ + dist (v1,v2) <= #2.51 /\ + dist (v2,v3) <= #2.51 /\ + dist (v3,v1) < sqrt (&8) /\ + {v1, v2, v3} SUBSET s /\ + ~(x IN {v1, v2, v3}) /\ + ~(conv0 {x, y} INTER conv_trg {v1, v2, v3} = {}))`, +REWRITE_TAC[quasi_reg_tet; SET_RULE ` {v1, v2, v3} UNION {v4} = {v1, v2, v3, v4} `; def_simplex] THEN +REWRITE_TAC[ MESON[]` (packing s /\ + {v1, v2, v3, v4} SUBSET s /\ + ~(v1 = v2 \/ v1 = v3 \/ v1 = v4 \/ v2 = v3 \/ v2 = v4 \/ v3 = v4)) /\ a <=> + a /\ ~(v1 = v2 \/ v1 = v3 \/ v1 = v4 \/ v2 = v3 \/ v2 = v4 \/ v3 = v4) /\ (packing s /\ + {v1, v2, v3, v4} SUBSET s + ) `] THEN +ONCE_REWRITE_TAC[ ATTACH (MESON[ SET_RULE` v1 IN {v1, v2, v3, v4} /\ v2 IN { v1, v2, v3, v4} /\ v3 IN { v1, v2, v3, v4} `] ` + (!v w. + v IN {v1, v2, v3, v4} /\ w IN {v1, v2, v3, v4} /\ ~(v = w) + ==> d3 v w <= &2 * t0) /\ + ~(v1 = v2 \/ v1 = v3 \/ v1 = v4 \/ v2 = v3 \/ v2 = v4 \/ v3 = v4) /\last + ==> d3 v1 v2 <= &2 * t0 /\ d3 v2 v3 <= &2 * t0 /\ d3 v3 v1 <= &2 * t0 `)] THEN +REWRITE_TAC[ t0; GSYM d3; REAL_ARITH ` &2 * #1.255 = #2.51 `] THEN +ONCE_REWRITE_TAC[ ATTACH (MESON[ MATCH_MP REAL_LT_RSQRT (REAL_ARITH `(&2 * #1.255) pow 2 < &8`) ; REAL_ARITH ` &2 * #1.255 = #2.51 /\ ( a <= b /\ b < c ==> a < c ) `] + ` d3 v1 v2 <= #2.51 /\ + d3 v2 v3 <= #2.51 /\ + d3 v3 v1 <= #2.51 ==> d3 v3 v1 < sqrt (&8) `)] THEN +MESON_TAC[ SET_RULE ` {v1, v2, v3, v4} SUBSET s ==> {v1, v2, v3} SUBSET s`]);; + +let DIST_PAIR_LEMMA = prove + (`{a,b} = {c,d} ==> dist(a,b) = dist(c,d)`, + REWRITE_TAC[PAIR_EQ_EXPAND] THEN MESON_TAC[DIST_SYM]);; + +let OTHER_LEMMA = prove + (`!a:real^3 b c d. + (?v w. + v IN {a, b, c, d} /\ + w IN {a, b, c, d} /\ + &2 * t0 <= d3 v w /\ + d3 v w <= sqrt (&8) /\ + (!x y. + x IN {a, b, c, d} /\ + y IN {a, b, c, d} /\ + ~(x = v /\ y = w \/ x = w /\ y = v) + ==> d3 x y <= &2 * t0)) /\ + (?x y. + x IN {a, b, c, d} /\ + y IN {a, b, c, d} /\ + &2 * t0 < d3 x y /\ + d3 x y < sqrt (&8)) /\ + &2 * t0 < d3 d b + ==> &2 * t0 < d3 d b /\ + d3 d b < sqrt (&8) /\ + (!x y. + x IN {a, b, c, d} /\ + y IN {a, b, c, d} /\ + ~({x, y} = {d, b}) + ==> d3 x y <= &2 * t0)`, REWRITE_TAC [d3] THEN + REPEAT GEN_TAC THEN REWRITE_TAC[t0; CONJ_ASSOC] THEN + DISCH_THEN(CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN + REWRITE_TAC[GSYM CONJ_ASSOC; GSYM PAIR_EQ_EXPAND] THEN + REWRITE_TAC[LEFT_AND_EXISTS_THM; LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`v:real^3`; `w:real^3`] THEN + DISCH_THEN(CONJUNCTS_THEN2 STRIP_ASSUME_TAC MP_TAC) THEN + ASM_CASES_TAC `{v,w} = {d,b:real^3}` THENL + [FIRST_ASSUM(SUBST_ALL_TAC o MATCH_MP DIST_PAIR_LEMMA) THEN + FIRST_X_ASSUM SUBST_ALL_TAC; + FIRST_X_ASSUM(MP_TAC o SPECL [`d:real^3`; `b:real^3`]) THEN + ASM_REWRITE_TAC[GSYM REAL_NOT_LT; IN_INSERT]] THEN + ASM_REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`x:real^3`; `y:real^3`] THEN STRIP_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPECL [`x:real^3`; `y:real^3`]) THEN + ASM_REWRITE_TAC[GSYM REAL_NOT_LT] THEN ASM_MESON_TAC[DIST_PAIR_LEMMA]);; + + +(* ======OCT 23====== *) + +let hard_case = prove(`! s x y. (?v1 v2 v3. + (?v4 vv1 vv2 vv3. + {vv1, vv2, vv3} = {v1, v2, v3} /\ + #2.51 < dist (vv3,vv1) /\ + {v1, v2, v3} UNION {v4} IN Q_SYS s /\ + strict_qua ({v1, v2, v3} UNION {v4}) s) /\ + ~(x IN {v1, v2, v3}) /\ + ~(conv0 {x, y} INTER conv_trg {v1, v2, v3} = {})) + ==> (?v1 v2 v3. + packing s /\ + ~(v1 = v2 \/ v2 = v3 \/ v3 = v1) /\ + dist (v1,v2) <= #2.51 /\ + dist (v2,v3) <= #2.51 /\ + dist (v3,v1) < sqrt (&8) /\ + {v1, v2, v3} SUBSET s /\ + ~(x IN {v1, v2, v3}) /\ + ~(conv0 {x, y} INTER conv_trg {v1, v2, v3} = {}))`, +REWRITE_TAC[ SET_RULE ` {v1, v2, v3} UNION { v4} = { v1, v2, v3 , v4} `; + strict_qua] THEN +REWRITE_TAC [ REAL_ARITH ` #2.51 = &2 * #1.255`] THEN +PURE_ONCE_REWRITE_TAC[ MESON[]` (?v4 v1 v2 v3. P v4 v1 v2 v3) <=> (?a b c d. P a b c d)`] THEN +ONCE_REWRITE_TAC[MESON[SET_RULE ` {b, c, d} = {v1, v2, v3} ==> {v1, v2, v3, a} = { a, b, c ,d }`] + ` (? a b c d. {b, c, d} = {v1, v2, v3} /\ P a b c d v1 v2 v3 {v1, v2, v3, a} ) + <=> (? a b c d. {b, c, d} = {v1, v2, v3} /\ P a b c d v1 v2 v3 { a, b, c ,d })`] THEN +REWRITE_TAC[quarter] THEN +REWRITE_TAC[quarter;def_simplex] THEN PHA THEN +REWRITE_TAC[MESON[]`&2 * #1.255 < dist (d,b) /\ a <=> a /\ &2 * #1.255 < dist (d,b)`] THEN PHA THEN +REWRITE_TAC[ GSYM t0; GSYM d3] THEN +REWRITE_TAC[ SET_RULE ` ~({a, b} = {c, d}) <=> ~(a = c /\ b = d \/ a = d /\ b = c)`] THEN +NHANH (MATCH_MP (MESON[]` (! a b c d. P a b c d ) ==> P a b c d`) OTHER_LEMMA ) THEN PHA THEN +PURE_ONCE_REWRITE_TAC[ MESON[]` ~(a = b \/ a = c \/ a = d \/ b = c \/ b = d \/ c = d) + /\ aa <=> aa /\ ~(a = b \/ a = c \/ a = d \/ b = c \/ b = d \/ c = d)`] THEN PHA THEN +NHANH (SET_RULE ` ~(a = b \/ a = c \/ a = d \/ b = c \/ b = d \/ c = d) + ==> ~({b, c} = {d,b} ) /\ ~({c,d} = {d,b})`) THEN +NHANH (SET_RULE` ~({b, c} = {d, b}) /\ + ~({c, d} = {d, b}) ==> b IN {a, b, c, d} /\ + c IN {a, b, c, d} /\ d IN {a, b, c, d} `) THEN PHA THEN +NHANH (MESON[]` (!x y. + x IN {a, b, c, d} /\ y IN {a, b, c, d} /\ ~({x, y} = {d, b}) + ==> d3 x y <= &2 * t0) /\ + aaa /\ + ~({b, c} = {d, b}) /\ + ~({c, d} = {d, b}) /\ + b IN {a, b, c, d} /\ + c IN {a, b, c, d} /\ + d IN {a, b, c, d} + ==> d3 b c <= &2 * t0 /\ d3 c d <= &2 * t0`) THEN +REWRITE_TAC[ MESON[]`{b, c, d} = {v1, v2, v3} /\ a <=> a /\ {b, c, d} = {v1, v2, v3} `] THEN +PHA THEN REWRITE_TAC[ MESON[]`{a, b, c, d} SUBSET s /\ aa <=> aa /\ {a, b, c, d} SUBSET s`] THEN +REWRITE_TAC[ MESON[]` ~(a = b \/ a = c \/ a = d \/ b = c \/ b = d \/ c = d) /\ aa + <=> aa /\ ~(a = b \/ a = c \/ a = d \/ b = c \/ b = d \/ c = d) `] THEN +REWRITE_TAC[ MESON[]` (?a b c d. aa a b c d /\ packing s /\ P a b c d ) + <=> packing s /\ (? a b c d. aa a b c d /\ P a b c d)`] THEN +SIMP_TAC[] THEN PHA THEN +REWRITE_TAC[ MESON[]` d3 d b < sqrt (&8)/\ a<=> a /\ d3 d b < sqrt (&8)`] THEN +PHA THEN NHANH (SET_RULE ` {b, c, d} = {v1, v2, v3} /\ + ~(a = b \/ a = c \/ a = d \/ b = c \/ b = d \/ c = d) /\ + {a, b, c, d} SUBSET s /\ last + ==> {v1, v2, v3} SUBSET s /\ ~( b = c \/ c= d \/ d= b )`) THEN PHA THEN +REWRITE_TAC[ MESON[]` d3 b c <= &2 * t0 /\ + d3 c d <= &2 * t0 /\ a <=> a /\ d3 b c <= &2 * t0 /\ + d3 c d <= &2 * t0 `] THEN +MESON_TAC[]);; + + +(* =========== *) + +let OCTOR23 = prove(`(?v1 v2 v3. + ~(x IN {v1, v2, v3}) /\ + (?v4 vv1 vv2 vv3. + {vv1, vv2, vv3} = {v1, v2, v3} /\ + #2.51 < dist (vv3,vv1) /\ + {v1, v2, v3} UNION {v4} IN Q_SYS s) /\ + ~(conv0 {x, y} INTER conv_trg {v1, v2, v3} = {}) /\ + dist (x,y) < t0) +==> (?v1 v2 v3. + packing s /\ + ~(v1 = v2 \/ v2 = v3 \/ v3 = v1) /\ + dist (v1,v2) <= #2.51 /\ + dist (v2,v3) <= #2.51 /\ + dist (v3,v1) < sqrt (&8) /\ + {v1, v2, v3} SUBSET s /\ + ~(x IN {v1, v2, v3}) /\ + ~(conv0 {x, y} INTER conv_trg {v1, v2, v3} = {}) /\ + dist (x,y) < t0)`, +REWRITE_TAC[ MESON[]` a /\ (?v4 vv1 vv2 vv3. + {vv1, vv2, vv3} = {v1, v2, v3} /\ + #2.51 < dist (vv3,vv1) /\ + {v1, v2, v3} UNION {v4} IN Q_SYS s) /\ b <=> (?v4 vv1 vv2 vv3. + {vv1, vv2, vv3} = {v1, v2, v3} /\ + #2.51 < dist (vv3,vv1) /\ + {v1, v2, v3} UNION {v4} IN Q_SYS s) /\ a /\ b `] THEN +NGOAC THEN REWRITE_TAC[ MESON[]` (( a /\ ~(x IN {v1, v2, v3})) /\ + ~(conv0 {x, y} INTER conv_trg {v1, v2, v3} = {})) /\ + dist (x,y) < t0 <=> a /\ ( ~(x IN {v1, v2, v3}) /\ + ~(conv0 {x, y} INTER conv_trg {v1, v2, v3} = {}) /\ + dist (x,y) < t0)`] THEN +NGOAC THEN MATCH_MP_TAC (MESON[]` ((? a b c. P a b c ) ==> (? a b c. Q a b c) ) + ==> (? a b c. P a b c /\ d ) ==> ( ? a b c. Q a b c /\ d )`) THEN +ONCE_REWRITE_TAC[ prove (`!q s. + q IN Q_SYS s <=> + q IN Q_SYS s /\ + (quasi_reg_tet q s \/ + strict_qua q s \/ + (?v v1 v3 v2 v4. + (q = {v, v1, v2, v3} \/ q = {v, v1, v3, v4}) /\ + interior_pos v v1 v3 v2 v4 s /\ + anchor_points v1 v3 s = {v, v2, v4} /\ + anchor_points v2 v4 s = {v, v1, v3}))`, MP_TAC WHEN_IN_Q_SYS THEN + REWRITE_TAC[ MESON[]` (! q s. P q s ==> R q s ) ==> ( ! q s. P q s <=> P q s + /\ R q s ) `])] THEN +KHANANG THEN +MATCH_MP_TAC (MESON[]` ((?v1 v2 v3. (?a b c d. P v1 v2 v3 a b c d) /\ cc v1 v2 v3) ==> las) /\ + ((?v1 v2 v3. (?a b c d. Q v1 v2 v3 a b c d) /\ cc v1 v2 v3) ==> las) /\ + ((?v1 v2 v3. (?a b c d. R v1 v2 v3 a b c d) /\ cc v1 v2 v3) ==> las) + ==> (?v1 v2 v3. + (?a b c d. + P v1 v2 v3 a b c d \/ + Q v1 v2 v3 a b c d \/ + R v1 v2 v3 a b c d) /\ + cc v1 v2 v3) + ==> las`) THEN +SIMP_TAC[quasi_reg_tet_case; hard_case] THEN +REWRITE_TAC[ MESON[]` a /\ as \/ b /\ as <=> ( a \/ b ) /\ as `] THEN +NHANH (MATCH_MP (MESON[]` (! q s. P q s) ==> P q s`) RELATE_Q_SYS) THEN + +MATCH_MP_TAC (MESON[]` ((? v1 v2 v3 . (? a b c d. aa a b c d v1 v2 v3 /\ bb a b c d v1 v2 v3 + /\ cc a b c d v1 v2 v3 /\ ee a b c d v1 v2 v3 ) + /\ las v1 v2 v3 ) ==> last ) + ==> (? v1 v2 v3 . (? a b c d. aa a b c d v1 v2 v3 /\ bb a b c d v1 v2 v3 + /\ cc a b c d v1 v2 v3 /\ dd a b c d v1 v2 v3 /\ ee a b c d v1 v2 v3 ) + /\ las v1 v2 v3 ) ==> last `) THEN +REWRITE_TAC[ hard_case]);; + +(* ============ *) + + +let OCTO23 = prove (` ! s x y. (?v1 v2 v3. + ~(x IN {v1, v2, v3}) /\ + (quasi_tri {v1, v2, v3} s \/ (?v4. {v1, v2, v3} UNION {v4} IN Q_SYS s)) /\ + ~(conv0 {x, y} INTER conv_trg {v1, v2, v3} = {}) /\ + dist (x,y) < t0) + ==> (?v1 v2 v3. + packing s /\ + ~(v1 = v2 \/ v2 = v3 \/ v3 = v1) /\ + dist (v1,v2) <= #2.51 /\ + dist (v2,v3) <= #2.51 /\ + dist (v3,v1) < sqrt (&8) /\ + {v1, v2, v3} SUBSET s /\ + ~(x IN {v1, v2, v3}) /\ + ~(conv0 {x, y} INTER conv_trg {v1, v2, v3} = {}) /\ + dist (x,y) < t0) `, +REWRITE_TAC[MESON[]` (?v4. {v1, v2, v3} UNION {v4} IN Q_SYS s) <=> + (?v4 vv1 vv2 vv3. + ({vv1, vv2, vv3} = {v1, v2, v3} /\ #2.51 < dist (vv3,vv1)) /\ + {v1, v2, v3} UNION {v4} IN Q_SYS s) \/ + (?v4. (!vv1 vv2 vv3. + {vv1, vv2, vv3} = {v1, v2, v3} ==> ~(#2.51 < dist (vv3,vv1))) /\ + {v1, v2, v3} UNION {v4} IN Q_SYS s) `] THEN KHANANG THEN REPEAT GEN_TAC THEN +REWRITE_TAC[ MESON[]` (?a b c. P a b c \/ Q a b c \/ R a b c) <=> + (?a b c. P a b c) \/ (?a b c. Q a b c) \/ (?a b c. R a b c) `] THEN +MATCH_MP_TAC (MESON[]` ( a ==> l ) /\ ( b==> l ) /\ ( c==> l ) ==> a \/ b\/ c ==> l `) THEN +REWRITE_TAC[ quasi_tri_case; OCT24; OCTOR23 ]);; + + + + +(* ===== *) + +let IN_AFF_GE_CON = prove(`!x y v3 v2. + ~(conv0 {x, y} INTER conv_trg {x, v2, v3} = {}) + ==> y IN aff_ge {x} {v2, v3}`, +REWRITE_TAC[ GSYM conv0_2; simpl_conv3; simp_def; SET_RULE` ~( a INTER b = {}) <=> + (? x . x IN a /\ x IN b )`; IN_ELIM_THM] THEN +NGOAC THEN +REWRITE_TAC[ MESON[]` (?x'. (?t. P t /\ x' = t % x + (&1 - t) % y) /\ + (?a b c. Q a b c /\ x' = a % x + b % v2 + c % v3)) <=> + (?a b c t. P t /\ Q a b c /\ t % x + (&1 - t) % y = a % x + b % v2 + c % v3)`] THEN +REWRITE_TAC[ VECTOR_ARITH ` t % x + (&1 - t) % y = a % x + b % v2 + c % v3 + <=> (&1 - t ) % y = ( a - t ) % x + b % v2 + c % v3 `] THEN +REWRITE_TAC[ MESON[]` t < &1 /\ a <=> a /\ t < &1 `] THEN PHA THEN +NHANH (REAL_ARITH` t < &1 ==> ~ ( &1 - t = &0 )`) THEN +REWRITE_TAC[ MESON[]` (t < &1 /\ ~(&1 - t = &0)) /\ aa <=> aa /\ ~(&1 - t = &0) /\ + t < &1 `] THEN +REWRITE_TAC[ MESON[]` (t < &1 /\ ~(&1 - t = &0)) /\ aa <=> t < &1 /\ aa /\ ~(&1 - t = &0) + `] THEN PHA THEN +ONCE_REWRITE_TAC[ MESON[REAL_FIELD `! a b. ~ ( b = &0 ) <=> a = b * a / b /\ ~ ( b = &0 ) `] ` + ~ ( b = &0 ) <=> ( ! a . a = b * a / b ) /\ ~ ( b = &0 )`] THEN +PHA THEN REWRITE_TAC[ MESON[ VECTOR_MUL_RCANCEL ] ` (&1 - t) % y = (a - t) % x + b % v2 + c % v3 /\ + (!a. a = (&1 - t) * a / (&1 - t)) /\ las + <=> (&1 - t) % y = ((&1 - t) * (a - t ) / (&1 - t)) % x + ((&1 - t) * b / (&1 - t)) % v2 + ((&1 - t) * c / (&1 - t)) % v3 /\ + (!a. a = (&1 - t) * a / (&1 - t)) /\ las `] THEN +REWRITE_TAC[ VECTOR_ARITH ` ( a * b ) % v1 + ( a * c ) % v2 + ( a * d ) % v3 = a % ( b % v1 + c % v2 + d % v3 ) `] THEN +REWRITE_TAC[ MESON[ VECTOR_MUL_LCANCEL_IMP; VECTOR_MUL_RCANCEL ] ` (&1 - t) % y = + (&1 - t) % + ((a - t) / (&1 - t) % x + b / (&1 - t) % v2 + c / (&1 - t) % v3) /\ + tttt /\ + ~(&1 - t = &0) /\ l <=> y = + + ((a - t) / (&1 - t) % x + b / (&1 - t) % v2 + c / (&1 - t) % v3) /\ + tttt /\ + ~(&1 - t = &0) /\ l `] THEN +REWRITE_TAC[ REAL_ARITH ` t < &1 <=> &0 < &1 - t `] THEN +REWRITE_TAC[ MESON[]`&0 <= a /\ &0 <= b /\ + &0 <= c /\ las <=> &0 <= a /\ las /\ &0 <= b /\ + &0 <= c `] THEN PHA THEN +REWRITE_TAC[ MESON[REAL_ARITH ` &0 < a ==> &0 <= a `; REAL_LE_DIV ]` + &0 < &1 - t /\ &0 <= a /\ &0 <= b <=> + &0 < &1 - t /\ + &0 <= a /\ + &0 <= b /\ + &0 <= a / (&1 - t) /\ + &0 <= b / (&1 - t) `] THEN +MESON_TAC[MESON[REAL_FIELD `~(&1 - t = &0) /\ a + b + c = &1 + ==> (a - t) / (&1 - t) + b / (&1 - t) + c / (&1 - t) = &1 `]` + a + b + c = &1 /\ + y = (a - t) / (&1 - t) % x + b / (&1 - t) % v2 + c / (&1 - t) % v3 /\ + cccc /\ + ~(&1 - t = &0) /\ las + <=> a + b + c = &1 /\ cccc /\ ~(&1 - t = &0) /\ las /\ y = (a - t) / (&1 - t) % x + b / (&1 - t) % v2 + c / (&1 - t) % v3 + /\ (a - t) / (&1 - t) + b / (&1 - t) + c / (&1 - t) = &1 `]);; + + +(* ============= *) + +let xxii = MATCH_MP REAL_LT_RSQRT (REAL_ARITH `(&2 * #1.255) pow 2 < &8`);; + + +let import_le = prove( `!x y s. + x IN s /\ + dist (x,y) < t0 /\ + ~(y IN UNIONS {aff_ge {x} {w1, w2} | w1,w2 | {x, w1, w2} IN barrier s}) + ==> ~obstructed x y s`, +REWRITE_TAC[ MESON[]` a /\ b /\ ~c ==> ~d <=> a /\ b /\ d ==> c`] THEN +REWRITE_TAC[ obstructed ; barrier] THEN +REWRITE_TAC[ IN_ELIM_THM] THEN +ONCE_REWRITE_TAC[ MESON[]` (? a . P a ) <=> ( ? a. ( x IN a \/ ~( x IN a )) /\ P a)`] THEN +REWRITE_TAC[ MESON[] ` (?b. aa b /\ (?u v w. P u v w /\ b = {u, v, w}) /\ cc b) <=> + (?u v w. aa {u, v, w} /\ P u v w /\ cc {u, v, w}) `] THEN +REWRITE_TAC[ MESON[]` (x IN {v1, v2, v3} \/ ~(x IN {v1, v2, v3})) /\ a <=> + x IN {v1, v2, v3} /\ a \/ ~(x IN {v1, v2, v3}) /\ a `] THEN +ONCE_REWRITE_TAC[ MESON[]`(? a c b. P a b c \/ Q a b c ) + <=> ( ? a b c. Q a b c \/ P a b c) `] THEN +ONCE_REWRITE_TAC[ MESON[]` aa /\ (?a c b. P a b c \/ Q a b c) <=> + aa /\ (?a b c. P a b c /\ aa \/ Q a b c) `] THEN PHA THEN +REWRITE_TAC[conv0_2] THEN +REWRITE_TAC[ MESON[]` (?a. P a \/ Q a) <=> (?a. P a) \/ (?a. Q a)`] THEN +NHANH (MATCH_MP (MESON[]` (! a b c. P a b c) ==> P a b c `) OCTO23) THEN +NHANH (MATCH_MP (MESON[]` (! x y a b c. P x y a b c ) ==> P x y a b c `) + MEETING_CONDITION) THEN +ONCE_REWRITE_TAC[MESON[]` v1 /\ v2/\ v3 /\ v4 /\ v5/\ v6 /\ v7 /\ las + <=> ( v1 /\ v2/\ v3 /\ v4 /\ v5/\ v6 /\ v7) /\ las`] THEN +NHANH (MATCH_MP (MESON[]` (! a b c d e. P a b c d e ) ==> P a b c d e`) tarski_FFSXOWD ) THEN +PHA THEN +REWRITE_TAC[ MESON[]` normball x #1.255 INTER conv {v1, v2, v3} = {} /\ a + <=> a /\ normball x #1.255 INTER conv {v1, v2, v3} = {} `] THEN +PHA THEN SIMP_TAC[ MESON[]` ~ a /\ a <=> F `] THEN +REPEAT GEN_TAC THEN MATCH_MP_TAC (MESON[]` (c ==> l) ==> a /\ b/\ c==> l`) THEN +REWRITE_TAC[SET_RULE ` x IN {a, b, c} <=> x = a \/ x = b \/ x = c `] THEN +MATCH_MP_TAC (MESON[]` (!a b c. P a b c <=> P b a c) /\ + ((?a b c. (x = a \/ x = c) /\ P a b c) ==> las) + ==> (?a b c. (x = a \/ x = b \/ x = c) /\ P a b c) + ==> las`) THEN +SIMP_TAC[ MESON[SET_RULE ` { a, b, c} = { b , a, c} ` ]` !v1 v2 v3. + (quasi_tri {v1, v2, v3} s \/ + (?v4. {v1, v2, v3} UNION {v4} IN Q_SYS s)) /\ + ~(conv0 {x, y} INTER conv_trg {v1, v2, v3} = {}) <=> + (quasi_tri {v2, v1, v3} s \/ + (?v4. {v2, v1, v3} UNION {v4} IN Q_SYS s)) /\ + ~(conv0 {x, y} INTER conv_trg {v2, v1, v3} = {})`] THEN +MATCH_MP_TAC (MESON[]` (!a b c. P a b c <=> P c b a ) /\ + ((?a b c. (x = a ) /\ P a b c) ==> las) + ==> (?a b c. (x = a \/ x = c) /\ P a b c) + ==> las`) THEN +SIMP_TAC[ MESON[SET_RULE ` { a, b, c} = {c , b , a} ` ]` !v1 v2 v3. + (quasi_tri {v1, v2, v3} s \/ (?v4. {v1, v2, v3} UNION {v4} IN Q_SYS s)) /\ + ~(conv0 {x, y} INTER conv_trg {v1, v2, v3} = {}) <=> + (quasi_tri {v3, v2, v1} s \/ (?v4. {v3, v2, v1} UNION {v4} IN Q_SYS s)) /\ + ~(conv0 {x, y} INTER conv_trg {v3, v2, v1} = {})`] THEN +PURE_ONCE_REWRITE_TAC[ MESON[]` (?v1 v2 v3. x = v1 /\ P x v1 v2 v3) <=> + (?v1 v2 v3. x = v1 /\ P x x v2 v3) `] THEN +NHANH (MATCH_MP (MESON[]` (! a b c d. P a b c d) ==> P a b c d`) IN_AFF_GE_CON) THEN +MATCH_MP_TAC (MESON[]` ((? v1 v2 v3. P v1 v2 v3 /\ PP v1 v2 v3 ) + ==> last ) + ==> (? v1 v2 v3. a v1 /\ P v1 v2 v3 /\ b v2 v3 /\ PP v1 v2 v3 ) + ==> last `) THEN +REWRITE_TAC[ IN_UNIONS; IN_ELIM_THM] THEN +MESON_TAC[]);; + + + + + + +(* ======================== end im_le_82.ml =============================== *) + +let lemma_of_lemma82 = prove (` ! (x:real^3) (v0:real^3) s Z. centered_pac s v0 /\ Z = UNIONS {e_plane u v | u IN near2t0 v0 s /\ v IN near2t0 v0 s} /\ + x IN normball v0 t0 DIFF Z + ==> (?w. w IN near2t0 v0 s /\ x IN voronoi w s)`, REPEAT GEN_TAC THEN REWRITE_TAC[centered_pac] THEN +REWRITE_TAC[ SET_RULE `packing s /\ v0 IN s <=> packing s /\ v0 IN s /\ ~(s={})`] THEN +REWRITE_TAC[MESON[exists_min_dist] ` (packing s /\ v0 IN s /\ ~(s = {})) /\ + Z = UNIONS {e_plane u v | u IN near2t0 v0 s /\ v IN near2t0 v0 s} /\ + x IN normball v0 t0 DIFF Z <=>(packing s /\ v0 IN s /\ ~(s = {})) /\ + Z = UNIONS {e_plane u v | u IN near2t0 v0 s /\ v IN near2t0 v0 s} /\ + x IN normball v0 t0 DIFF Z /\ min_dist x s `] THEN +SIMP_TAC[normball; min_dist] THEN +REWRITE_TAC[SET_RULE` x IN a DIFF b <=> x IN a /\ ~( x IN b )`] THEN +REWRITE_TAC[SET_RULE ` x IN { x | P x } <=> P x `] THEN PHA THEN +REWRITE_TAC[MESON[]` dist (x,v0) < t0 /\ + ~(x IN Z) /\ + ((?u. u IN s /\ (!w. w IN s /\ ~(u = w) ==> dist (u,x) < dist (w,x))) \/ + (?u v. + u IN s /\ + v IN s /\ + ~(u = v) /\ + dist (u,x) = dist (v,x) /\ + (!w. w IN s ==> dist (u,x) <= dist (w,x)))) <=> + dist (x,v0) < t0 /\ + ~(x IN Z) /\ + ((?u. u IN s /\ (!w. w IN s /\ ~(u = w) ==> dist (u,x) < dist (w,x))) \/ + ( ~(x IN Z) /\ (?u v. + u IN s /\ + v IN s /\ + ~(u = v) /\ + dist (u,x) = dist (v,x) /\ + (!w. w IN s ==> dist (u,x) <= dist (w,x)) /\ dist (x,v0) < t0 ))) `] THEN +REWRITE_TAC[MESON[DIST_TRIANGLE] ` v0 IN s /\ + ~(s = {}) /\ + Z = UNIONS {e_plane u v | u IN near2t0 v0 s /\ v IN near2t0 v0 s} /\ + dist (x,v0) < t0 /\ + ~(x IN Z) /\ + ((?u. u IN s /\ (!w. w IN s /\ ~(u = w) ==> dist (u,x) < dist (w,x))) \/ + ~(x IN Z) /\ + (?u v. + u IN s /\ + v IN s /\ + ~(u = v) /\ + dist (u,x) = dist (v,x) /\ + (!w. w IN s ==> dist (u,x) <= dist (w,x)) /\ + dist (x,v0) < t0)) <=> + v0 IN s /\ + ~(s = {}) /\ + Z = UNIONS {e_plane u v | u IN near2t0 v0 s /\ v IN near2t0 v0 s} /\ + dist (x,v0) < t0 /\ + ~(x IN Z) /\ + ((?u. u IN s /\ (!w. w IN s /\ ~(u = w) ==> dist (u,x) < dist (w,x))) \/ + ~(x IN Z) /\ + (?u v. + u IN s /\ + dist (u,v0) <= dist (u,x) + dist (x,v0) /\ + dist (u,x) <= dist (v0,x) /\ + v IN s /\ + dist (v,v0) <= dist (v,x) + dist (x,v0) /\ + dist (v,x) <= dist (v0,x) /\ + ~(u = v) /\ + dist (u,x) = dist (v,x) /\ + (!w. w IN s ==> dist (u,x) <= dist (w,x)) /\ + dist (x,v0) < t0)) `] THEN +REWRITE_TAC[MESON[] ` u IN s /\ + dist (u,v0) <= dist (u,x) + dist (x,v0) /\ + dist (u,x) <= dist (v0,x) /\ + v IN s /\ + dist (v,v0) <= dist (v,x) + dist (x,v0) /\ + dist (v,x) <= dist (v0,x) /\ + ~(u = v) /\ + dist (u,x) = dist (v,x) /\ + (!w. w IN s ==> dist (u,x) <= dist (w,x)) /\ + dist (x,v0) < t0 <=> + u IN s /\ + (dist (u,v0) <= dist (u,x) + dist (x,v0) /\ + dist (u,x) <= dist (v0,x) /\ + dist (x,v0) < t0) /\ + v IN s /\ + (dist (v,v0) <= dist (v,x) + dist (x,v0) /\ + dist (v,x) <= dist (v0,x) /\ + dist (x,v0) < t0) /\ + ~(u = v) /\ + dist (u,x) = dist (v,x) /\ + (!w. w IN s ==> dist (u,x) <= dist (w,x))`] THEN +SIMP_TAC[DIST_SYM] THEN +REWRITE_TAC[REAL_ARITH ` dist (u,v0) <= dist (u,x) + dist (v0,x) /\ + dist (u,x) <= dist (v0,x) /\ + dist (v0,x) < t0 + <=> dist (u,v0) <= dist (u,x) + dist (v0,x) /\ + dist (u,x) <= dist (v0,x) /\ + dist (v0,x) < t0 /\ dist(u, v0) < &2 * t0 `] THEN +REWRITE_TAC[ MESON[] ` a /\ b /\c/\ d /\ e ==> f <=> a/\b/\c/\d ==> e ==> f `] THEN SIMP_TAC[] THEN +REWRITE_TAC[ IN_UNIONS; e_plane; near2t0] THEN +REWRITE_TAC[SET_RULE ` x IN { x | P x } <=> P x `] THEN +REWRITE_TAC[IN_ELIM_THM] THEN REWRITE_TAC[ MESON[] ` (?t. (?u v. + ((u IN s /\ dist (v0,u) < &2 * t0) /\ + v IN s /\ + dist (v0,v) < &2 * t0) /\ + t = e_plane u v) /\ + x IN t ) + <=> (?u v. + ((u IN s /\ dist (v0,u) < &2 * t0) /\ + v IN s /\ + dist (v0,v) < &2 * t0) /\ + x IN e_plane u v) `] THEN +REWRITE_TAC[ SET_RULE ` x IN e_plane u v <=> e_plane u v x `; e_plane] THEN +PHA THEN SIMP_TAC[ MESON[DIST_SYM] ` ~(?u v. + u IN s /\ + dist (v0,u) < &2 * t0 /\ + v IN s /\ + dist (v0,v) < &2 * t0 /\ + ~(u = v) /\ + dist (u,x) = dist (v,x)) /\ + (?u v. + u IN s /\ + dist (u,v0) <= dist (u,x) + dist (v0,x) /\ + dist (u,x) <= dist (v0,x) /\ + dist (v0,x) < t0 /\ + dist (u,v0) < &2 * t0 /\ + v IN s /\ + dist (v,v0) <= dist (v,x) + dist (v0,x) /\ + dist (v,x) <= dist (v0,x) /\ + dist (v0,x) < t0 /\ + dist (v,v0) < &2 * t0 /\ + ~(u = v) /\ + dist (u,x) = dist (v,x) /\ + (!w. w IN s ==> dist (u,x) <= dist (w,x))) <=> F `] THEN +REWRITE_TAC[voronoi] THEN REWRITE_TAC[ SET_RULE ` x IN { x | P x } <=> P x `] THEN +REWRITE_TAC[ MESON[] ` dist (v0,x) < t0 /\ + ~(?u v. + u IN s /\ + dist (v0,u) < &2 * t0 /\ + v IN s /\ + dist (v0,v) < &2 * t0 /\ + ~(u = v) /\ + dist (u,x) = dist (v,x)) /\ + (?u. u IN s /\ (!w. w IN s /\ ~(u = w) ==> dist (u,x) < dist (w,x))) + <=> dist (v0,x) < t0 /\ + ~(?u v. + u IN s /\ + dist (v0,u) < &2 * t0 /\ + v IN s /\ + dist (v0,v) < &2 * t0 /\ + ~(u = v) /\ + dist (u,x) = dist (v,x)) /\ + (?u. u IN s /\dist (v0,x) < t0 /\ (!w. w IN s /\ ~(u = w) ==> dist (u,x) < dist (w,x)))`] THEN +REWRITE_TAC[ MESON[DIST_TRIANGLE] `(?u. u IN s /\ + dist (v0,x) < t0 /\ + (!w. w IN s /\ ~(u = w) ==> dist (u,x) < dist (w,x))) <=> + (?u. u IN s /\ + dist (v0,x) < t0 /\ + dist (u,v0) <= dist (u,x) + dist (x,v0) /\ + (!w. w IN s /\ ~(u = w) ==> dist (u,x) < dist (w,x))) `] THEN +REWRITE_TAC[ MESON[] ` ( a ==> b==> c <=> a/\b ==> c ) `] THEN PHA THEN +ONCE_REWRITE_TAC[ MESON[] ` a /\ b /\ c ==> d <=> a/\c /\b ==> d `] THEN PHA THEN +ONCE_REWRITE_TAC[MESON[] ` !P. (?u. P u) /\ v0 IN s <=> + ((?u. u = v0 /\ P u) \/ (?u. ~(u = v0) /\ P u)) /\ v0 IN s`] THEN +REWRITE_TAC[t0] THEN ONCE_REWRITE_TAC[MESON[ DIST_REFL; REAL_ARITH ` &0 < &2 * #1.255 ` ] ` u = v0 /\ las <=> u = v0 /\ dist(u,v0 ) < &2 * #1.255 /\ las `] THEN +REWRITE_TAC[ MESON[] ` ((?u. u = v0 /\ + dist (u,v0) < &2 * #1.255 /\ + u IN s /\ + dist (v0,x) < #1.255 /\ + dist (u,v0) <= dist (u,x) + dist (x,v0) /\ + (!w. w IN s /\ ~(u = w) ==> dist (u,x) < dist (w,x))) \/ + (?u. ~(u = v0) /\ + u IN s /\ + dist (v0,x) < #1.255 /\ + dist (u,v0) <= dist (u,x) + dist (x,v0) /\ + (!w. w IN s /\ ~(u = w) ==> dist (u,x) < dist (w,x)))) /\ + v0 IN s <=> + ((?u. u = v0 /\ + dist (u,v0) < &2 * #1.255 /\ + u IN s /\ + v0 IN s /\ + dist (v0,x) < #1.255 /\ + dist (u,v0) <= dist (u,x) + dist (x,v0) /\ + (!w. w IN s /\ ~(u = w) ==> dist (u,x) < dist (w,x))) \/ + (?u. ~(u = v0) /\ + u IN s /\ + v0 IN s /\ + dist (v0,x) < #1.255 /\ + dist (u,v0) <= dist (u,x) + dist (x,v0) /\ + (!w. w IN s /\ ~(u = w) ==> dist (u,x) < dist (w,x)))) /\ + v0 IN s `] THEN REWRITE_TAC[ MESON[] ` ~(u = v0) /\ + u IN s /\ + v0 IN s /\ + dist (v0,x) < #1.255 /\ + dist (u,v0) <= dist (u,x) + dist (x,v0) /\ + (!w. w IN s /\ ~(u = w) ==> dist (u,x) < dist (w,x)) <=> + ~(u = v0) /\ + + u IN s /\ + v0 IN s /\ ( dist (u,x) < dist (v0,x) /\ + dist (v0,x) < #1.255 /\ + dist (u,v0) <= dist (u,x) + dist (x,v0) ) /\ + (!w. w IN s /\ ~(u = w) ==> dist (u,x) < dist (w,x)) `] THEN SIMP_TAC[DIST_SYM] THEN +PURE_ONCE_REWRITE_TAC[ REAL_ARITH ` ( dist (u,x) < dist (v0,x) /\ + dist (v0,x) < #1.255 /\ + dist (u,v0) <= dist (u,x) + dist (v0,x)) <=> + (dist (u,x) < dist (v0,x) /\ + dist (v0,x) < #1.255 /\ + dist (u,v0) <= dist (u,x) + dist (v0,x)) /\ + dist (u,v0) < &2 * #1.255 ` ] THEN +MATCH_MP_TAC (MESON[] `((?u. u = v0 /\ + dist (u,v0) < &2 * #1.255 /\ + u IN s /\ + v0 IN s /\ + dist (v0,x) < #1.255 /\ + dist (u,v0) <= dist (u,x) + dist (v0,x) /\ + (!w. w IN s /\ ~(u = w) ==> dist (u,x) < dist (w,x))) \/ + (?u. ~(u = v0) /\ + u IN s /\ + v0 IN s /\ + ((dist (u,x) < dist (v0,x) /\ + dist (v0,x) < #1.255 /\ + dist (u,v0) <= dist (u,x) + dist (v0,x)) /\ + dist (u,v0) < &2 * #1.255) /\ + (!w. w IN s /\ ~(u = w) ==> dist (u,x) < dist (w,x))) + ==> (?w. w IN s /\ + dist (v0,w) < &2 * #1.255 /\ + (!w'. s w' /\ ~(w' = w) ==> dist (w,x) < dist (w',x)))) + ==> packing s /\ + ~(s = {}) /\ + Z = + UNIONS + {e_plane u v | u IN s /\ + dist (u,v0) < &2 * #1.255 /\ + v IN s /\ + dist (v,v0) < &2 * #1.255} /\ + dist (v0,x) < #1.255 /\ + ~(?u v. + u IN s /\ + dist (u,v0) < &2 * #1.255 /\ + v IN s /\ + dist (v,v0) < &2 * #1.255 /\ + ~(u = v) /\ + dist (u,x) = dist (v,x)) /\ + ((?u. u = v0 /\ + dist (u,v0) < &2 * #1.255 /\ + u IN s /\ + v0 IN s /\ + dist (v0,x) < #1.255 /\ + dist (u,v0) <= dist (u,x) + dist (v0,x) /\ + (!w. w IN s /\ ~(u = w) ==> dist (u,x) < dist (w,x))) \/ + (?u. ~(u = v0) /\ + u IN s /\ + v0 IN s /\ + ((dist (u,x) < dist (v0,x) /\ + dist (v0,x) < #1.255 /\ + dist (u,v0) <= dist (u,x) + dist (v0,x)) /\ + dist (u,v0) < &2 * #1.255) /\ + (!w. w IN s /\ ~(u = w) ==> dist (u,x) < dist (w,x)))) /\ + v0 IN s + ==> (?w. w IN s /\ + dist (v0,w) < &2 * #1.255 /\ + (!w'. s w' /\ ~(w' = w) ==> dist (w,x) < dist (w',x))) `) THEN +MESON_TAC [DIST_SYM; SET_RULE ` ! x s. s x <=> x IN s ` ]);; + + + diff --git a/legacy/oldleg/geomdetail_08.ml b/legacy/oldleg/geomdetail_08.ml new file mode 100644 index 0000000..f45efed --- /dev/null +++ b/legacy/oldleg/geomdetail_08.ml @@ -0,0 +1,1420 @@ + +(* tchales, This does not run in Multivariate *) + + +let TRIANGLE_IN_BARRIER = prove(` ! s v0 v1 v2 . {v0, v1, v2} IN barrier s + ==> (!xx yy. + ~(xx = yy) /\ {xx, yy} SUBSET {v1, v2, v0} + ==> &2 <= dist (xx,yy) /\ dist (xx,yy) <= sqrt (&8)) /\ + ((!aa bb. + aa IN {v1, v2, v0} /\ bb IN {v1, v2, v0} ==> dist (aa,bb) <= #2.51) \/ + (?aa bb. + {aa, bb} SUBSET {v1, v2, v0} /\ + #2.51 < dist (aa,bb) /\ + (!x y. + ~({x, y} = {aa, bb}) /\ {x, y} SUBSET {v1, v2, v0} + ==> dist (x,y) <= #2.51)))`, +REWRITE_TAC[ barrier; IN_ELIM_THM] THEN +REWRITE_TAC[ GSYM (MESON[]` P {x, y, z} <=> + (?a b c. P {a, b, c} /\ {x, y, z} = {a, b, c})`)] THEN +MP_TAC A_LEMMA THEN +REWRITE_TAC[ MESON[]` (! a b c d. P a b c d ==> las a b c d ) ==> (! a b c d . + P a b c d \/ Q a b c d ==> las a b c d) <=> + (! a b c d. P a b c d ==> las a b c d ) ==> (! a b c d . + Q a b c d ==> las a b c d)`] THEN DISCH_TAC THEN +NHANH (CUTHE2 CASES_OF_Q_SYS) THEN +REPEAT GEN_TAC THEN +MATCH_MP_TAC (MESON[]` ((? a. Q a) ==> l) /\ ((?a. R a ) ==> l) ==> + (? a. P a /\ ( Q a \/ R a )) ==> l `) THEN +REWRITE_TAC[ NOV1] THEN +NHANH (CUTHE4 TRIANGLE_IN_STRICT_QUA) THEN +MATCH_MP_TAC (MESON[]` (b ==> l) /\ ( a /\ c ==> l) ==> a /\ ( b \/ c ) ==> l`) THEN +ASM_REWRITE_TAC[] THEN +REWRITE_TAC[ strict_qua; quarter; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`; def_simplex] THEN +PHA THEN +REWRITE_TAC[ MESON[]` a /\ a /\ l <=> a /\ l `; packing ] THEN +MATCH_MP_TAC (MESON[] `(a ==> aa) /\ (b ==> bb) ==> a /\ b ==> aa /\ (cc \/ bb)`) THEN +SIMP_TAC[ SET_RULE `{a,b,c} = {c,a,b} `] THEN +NHANH (SET_RULE ` {v0, v1, v2, v4} SUBSET s ==> {v0,v1,v2} SUBSET s `) THEN +NHANH ( MESON[SET_RULE ` x IN a /\ a SUBSET s ==> s x `]`(!u v. s u /\ s v /\ ~(u = v) ==> &2 <= dist (u,v)) /\ + ({v0, v1, v2, v4} SUBSET s /\ {v0, v1, v2} SUBSET s) /\ l ==> + (!u v. u IN {v0,v1,v2} /\ v IN {v0,v1,v2} /\ ~(u = v) ==> &2 <= dist (u,v))`) THEN +REWRITE_TAC[t0] THEN +NHANH ( MESON[PAIR_D3] ` d3 v w <= sqrt (&8) ==> (! x y. x IN {v0, v1, v2, v4} /\ + y IN {v0, v1, v2, v4} /\ {x,y} = {v,w} ==> d3 x y <= sqrt (&8) )`) THEN +REWRITE_TAC[ SET_RULE ` {a,b} SUBSET s <=> a IN s /\ b IN s `] THEN +SIMP_TAC[ SET_RULE ` {a,b,c} = {c,a,b} `] THEN +REWRITE_TAC[ GSYM d3 ] THEN +MESON_TAC[ MATCH_MP REAL_LE_RSQRT (REAL_ARITH ` (&2 * #1.255 ) pow 2 <= &8 `); + SET_RULE ` x IN {a,b,c} ==> x IN {a,b,c,d} `; REAL_ARITH ` a <= b /\ b <= c ==> a <= c `]);; + +(* ============== *) + + + +(* lemma 8.2 *) + + + + + +let le1_82 = prove (`!s v0 Y. + centered_pac s v0 /\ + w IN near2t0 v0 s /\ + Y = + UNIONS + {aff_ge {w} {w1, w2} | w IN near2t0 v0 s /\ {w, w1, w2} IN barrier s} + ==> UNIONS {aff_ge {w} {w1, w2} | w1,w2 | {w, w1, w2} IN barrier s} SUBSET + Y`, SIMP_TAC[] THEN SET_TAC[]);; + + + +let rhand_subset_lhand = prove (` ! (s:real^3 -> bool) (v0:real^3) Z Y. + centered_pac s v0 /\ + Y = + UNIONS + {aff_ge {w} {w1, w2} | w IN near2t0 v0 s /\ {w, w1, w2} IN barrier s} /\ + Z = UNIONS {e_plane u v | u IN near2t0 v0 s /\ v IN near2t0 v0 s} + ==> + normball v0 t0 INTER voronoi v0 s DIFF (Y UNION Z) SUBSET + normball v0 t0 INTER VC v0 s DIFF (Y UNION Z)`, REWRITE_TAC[ SET_RULE ` a INTER b DIFF c SUBSET a INTER d DIFF c <=> + (!x. x IN a INTER b DIFF c ==> x IN d) ` ] THEN +REWRITE_TAC[ GSYM ( MESON[centered_pac; le1_82; prove (` ! x s. centered_pac s x ==> x IN near2t0 x s `, REWRITE_TAC[ + centered_pac; near2t0] THEN REWRITE_TAC[ MESON [DIST_REFL; t0; REAL_ARITH ` &0 < &2 * #1.255 `] ` + packing s /\ v0 IN s <=> packing s /\ v0 IN s /\ dist (v0,v0) < &2 * t0`] THEN + SET_TAC[] ) ] ` !s v0 Z Y. + centered_pac s v0 /\ + Y = + UNIONS + {aff_ge {w} {w1, w2} | w IN near2t0 v0 s /\ {w, w1, w2} IN barrier s} /\ + Z = UNIONS {e_plane u v | u IN near2t0 v0 s /\ v IN near2t0 v0 s} /\ + UNIONS {aff_ge {v0} {w1, w2} | w1,w2 | {v0, w1, w2} IN barrier s} SUBSET + Y + ==> last <=> + centered_pac s v0 /\ + Y = + UNIONS + {aff_ge {w} {w1, w2} | w IN near2t0 v0 s /\ {w, w1, w2} IN barrier s} /\ + Z = UNIONS {e_plane u v | u IN near2t0 v0 s /\ v IN near2t0 v0 s} + ==> last `)] THEN +REWRITE_TAC[SET_RULE ` x IN a INTER b DIFF c <=> x IN a /\ x IN b /\ ~( x IN c )`] THEN +REWRITE_TAC[ MESON[] ` centered_pac s v0 /\ + Y = + UNIONS + {aff_ge {w} {w1, w2} | w IN near2t0 v0 s /\ {w, w1, w2} IN barrier s} /\ + Z = UNIONS {e_plane u v | u IN near2t0 v0 s /\ v IN near2t0 v0 s} /\ + UNIONS {aff_ge {v0} {w1, w2} | w1,w2 | {v0, w1, w2} IN barrier s} SUBSET + Y + ==> (!x. x IN normball v0 t0 /\ x IN voronoi v0 s /\ ~(x IN Y UNION Z) + ==> x IN VC v0 s) <=> + centered_pac s v0 /\ + Y = + UNIONS + {aff_ge {w} {w1, w2} | w IN near2t0 v0 s /\ {w, w1, w2} IN barrier s} /\ + Z = UNIONS {e_plane u v | u IN near2t0 v0 s /\ v IN near2t0 v0 s} /\ + UNIONS {aff_ge {v0} {w1, w2} | w1,w2 | {v0, w1, w2} IN barrier s} SUBSET + Y + ==> (!x. x IN normball v0 t0 /\ + x IN voronoi v0 s /\ + ~(x IN Y UNION Z) /\ + UNIONS + {aff_ge {v0} {w1, w2} | w1,w2 | {v0, w1, w2} IN barrier s} SUBSET + Y + ==> x IN VC v0 s) `] THEN +ONCE_REWRITE_TAC[ SET_RULE ` ~(x IN Y UNION Z) /\ + UNIONS {aff_ge {v0} {w1, w2} | w1,w2 | {v0, w1, w2} IN barrier s} SUBSET + Y <=> + ~(x IN + UNIONS {aff_ge {v0} {w1, w2} | w1,w2 | {v0, w1, w2} IN barrier s}) /\ + ~(x IN Y UNION Z) /\ + UNIONS {aff_ge {v0} {w1, w2} | w1,w2 | {v0, w1, w2} IN barrier s} SUBSET + Y `] THEN REWRITE_TAC[ centered_pac ] THEN +REWRITE_TAC[ MESON[] ` (packing s /\ v0 IN s) /\ + Y = + UNIONS + {aff_ge {w} {w1, w2} | w IN near2t0 v0 s /\ {w, w1, w2} IN barrier s} /\ + Z = UNIONS {e_plane u v | u IN near2t0 v0 s /\ v IN near2t0 v0 s} /\ + UNIONS {aff_ge {v0} {w1, w2} | w1,w2 | {v0, w1, w2} IN barrier s} SUBSET + Y + ==> (!x. x IN normball v0 t0 /\ + x IN voronoi v0 s /\ + ~(x IN + UNIONS + {aff_ge {v0} {w1, w2} | w1,w2 | {v0, w1, w2} IN barrier s}) /\ + ~(x IN Y UNION Z) /\ + UNIONS + {aff_ge {v0} {w1, w2} | w1,w2 | {v0, w1, w2} IN barrier s} SUBSET + Y + ==> x IN VC v0 s) <=> + (packing s /\ v0 IN s) /\ + Y = + UNIONS + {aff_ge {w} {w1, w2} | w IN near2t0 v0 s /\ {w, w1, w2} IN barrier s} /\ + Z = UNIONS {e_plane u v | u IN near2t0 v0 s /\ v IN near2t0 v0 s} /\ + UNIONS {aff_ge {v0} {w1, w2} | w1,w2 | {v0, w1, w2} IN barrier s} SUBSET + Y + ==> (!x. v0 IN s /\ + x IN normball v0 t0 /\ + x IN voronoi v0 s /\ + ~(x IN + UNIONS + {aff_ge {v0} {w1, w2} | w1,w2 | {v0, w1, w2} IN barrier s}) /\ + ~(x IN Y UNION Z) /\ + UNIONS + {aff_ge {v0} {w1, w2} | w1,w2 | {v0, w1, w2} IN barrier s} SUBSET + Y + ==> x IN VC v0 s) `] THEN +REPEAT GEN_TAC THEN DISCH_TAC THEN REWRITE_TAC[normball] THEN +REWRITE_TAC[ SET_RULE ` z IN { x | P x } <=> P z `] THEN +REWRITE_TAC[ voronoi; VC; lambda_x; d3 ] THEN +REWRITE_TAC[ SET_RULE ` x IN { x | P x } <=> P x `] THEN +REWRITE_TAC[MESON[DIST_SYM ; import_le ] ` v0 IN s /\ + dist (x,v0) < t0 /\ + (!w. s w /\ ~(w = v0) ==> dist (x,v0) < dist (x,w)) /\ + ~(x IN + UNIONS {aff_ge {v0} {w1, w2} | w1,w2 | {v0, w1, w2} IN barrier s}) /\ + ~(x IN Y UNION Z) /\ + UNIONS {aff_ge {v0} {w1, w2} | w1,w2 | {v0, w1, w2} IN barrier s} SUBSET + Y <=> + v0 IN s /\ + dist (x,v0) < t0 /\ + (!w. s w /\ ~(w = v0) ==> dist (x,v0) < dist (x,w)) /\ + ~(x IN + UNIONS {aff_ge {v0} {w1, w2} | w1,w2 | {v0, w1, w2} IN barrier s}) /\ + ~(x IN Y UNION Z) /\ + UNIONS {aff_ge {v0} {w1, w2} | w1,w2 | {v0, w1, w2} IN barrier s} SUBSET + Y /\ + ~obstructed v0 x s `] THEN +ONCE_REWRITE_TAC[MESON[t0; REAL_ARITH ` #1.255 < &2 /\ (! a b (c:real). a < b +/\ b < c ==> a < c ) `; DIST_SYM ]` dist ( x, v0 ) < t0 <=> dist ( x, v0 ) < t0 /\ + dist ( v0, x) < &2 `] THEN +SIMP_TAC[ DIST_SYM ] THEN +MESON_TAC[ SET_RULE ` ! s x. s x <=> x IN s `]);; + + + +(* ++++++++++++++++++++++++++++ *) + + + + +let lhand_subset_rhand = prove(` ! (s:real^3 -> bool) (v0:real^3) Z Y. + centered_pac s v0 /\ + Y = + UNIONS + {aff_ge {w} {w1, w2} | w IN near2t0 v0 s /\ {w, w1, w2} IN barrier s} /\ + Z = UNIONS {e_plane u v | u IN near2t0 v0 s /\ v IN near2t0 v0 s} + ==> normball v0 t0 INTER VC v0 s DIFF (Y UNION Z) SUBSET + normball v0 t0 INTER voronoi v0 s DIFF (Y UNION Z)`, +REWRITE_TAC[ SET_RULE ` a INTER b DIFF c SUBSET a INTER d DIFF c <=> + a INTER b DIFF c DIFF d = {} `] THEN +REWRITE_TAC[ SET_RULE ` a = {} <=> (! x. ~ (x IN a))`] THEN +REWRITE_TAC[ SET_RULE` x IN a DIFF b <=> x IN a /\ ~( x IN b ) `] THEN +REWRITE_TAC[ SET_RULE ` x IN a INTER b <=> x IN a /\ x IN b `] THEN PHA THEN +REWRITE_TAC[ SET_RULE ` x IN normball v0 t0 /\ x IN VC v0 s /\ ~(x IN Y UNION Z) /\ P x <=> + x IN normball v0 t0 DIFF Z /\ x IN VC v0 s /\ ~(x IN Y UNION Z) /\ P x `] THEN +REWRITE_TAC[MESON[lemma_of_lemma82]` + centered_pac s v0 /\ + Y = + UNIONS + {aff_ge {w} {w1, w2} | w IN near2t0 v0 s /\ {w, w1, w2} IN barrier s} /\ + Z = UNIONS {e_plane u v | u IN near2t0 v0 s /\ v IN near2t0 v0 s} + ==> (!x. ~(x IN normball v0 t0 DIFF Z /\ + x IN VC v0 s /\ + ~(x IN Y UNION Z) /\ + ~(x IN voronoi v0 s))) <=> + centered_pac s v0 /\ + Y = + UNIONS + {aff_ge {w} {w1, w2} | w IN near2t0 v0 s /\ {w, w1, w2} IN barrier s} /\ + Z = UNIONS {e_plane u v | u IN near2t0 v0 s /\ v IN near2t0 v0 s} + ==> (!x. ~(x IN normball v0 t0 DIFF Z /\ + (?w. w IN near2t0 v0 s /\ x IN voronoi w s) /\ + x IN VC v0 s /\ + ~(x IN Y UNION Z) /\ + ~(x IN voronoi v0 s))) `] THEN +REWRITE_TAC[ MESON[] ` + (?w. w IN near2t0 v0 s /\ x IN voronoi w s) /\ + x IN VC v0 s /\ + ~(x IN Y UNION Z) /\ + ~(x IN voronoi v0 s) <=> + (?w. w IN near2t0 v0 s /\ x IN voronoi w s /\ ~(w = v0)) /\ + x IN VC v0 s /\ + ~(x IN Y UNION Z) /\ + ~(x IN voronoi v0 s) `] THEN +REWRITE_TAC[ MESON[near2t0] ` + (?w. w IN near2t0 v0 s /\ x IN voronoi w s /\ ~(w = v0)) <=> + (?w. w IN {x | x IN s /\ dist (v0,x) < &2 * t0} /\ + x IN voronoi w s /\ + ~(w = v0)) `] THEN +REWRITE_TAC[ SET_RULE` a IN { a | p a } <=> p a `] THEN +REWRITE_TAC[ voronoi; lambda_x] THEN +REWRITE_TAC[ SET_RULE ` x IN { v | P v } <=> P x `] THEN PHA THEN +REWRITE_TAC[ MESON[] ` a /\ b /\ d ==> c <=> b /\ d ==> a ==> c `] THEN +REPEAT GEN_TAC THEN DISCH_TAC THEN +REWRITE_TAC[centered_pac] THEN +MATCH_MP_TAC (MESON[]` (a /\ b ==> (!x. ~b \/ P x)) ==> a /\ b ==> (!x. P x)`) THEN +REWRITE_TAC[ MESON[] ` ~(v0 IN s) \/ ~(x IN normball v0 t0 DIFF Z /\ last) <=> + ~(v0 IN s /\ x IN normball v0 t0 DIFF Z /\ last)`] THEN +REWRITE_TAC[ MESON[]` + v0 IN s /\ + x IN normball v0 t0 DIFF Z /\ + (?w. w IN s /\ + dist (v0,w) < &2 * t0 /\ + (!w'. s w' /\ ~(w' = w) ==> dist (x,w) < dist (x,w')) /\ + ~(w = v0)) /\ + last <=> + x IN normball v0 t0 DIFF Z /\ + (?w. w IN s /\ + v0 IN s /\ + dist (v0,w) < &2 * t0 /\ + (!w'. s w' /\ ~(w' = w) ==> dist (x,w) < dist (x,w')) /\ + ~(w = v0)) /\ + last`] THEN +REWRITE_TAC[ MESON[ SET_RULE` x IN s <=> s x `] ` + (?w. w IN s /\ + v0 IN s /\ + dist (v0,w) < &2 * t0 /\ + (!w'. s w' /\ ~(w' = w) ==> dist (x,w) < dist (x,w')) /\ + ~(w = v0)) <=> + (?w. w IN s /\ + v0 IN s /\ + dist (x,w) < dist (x,v0) /\ + dist (v0,w) < &2 * t0 /\ + (!w'. s w' /\ ~(w' = w) ==> dist (x,w) < dist (x,w')) /\ + ~(w = v0)) `] THEN +REWRITE_TAC[ SET_RULE ` x IN a DIFF b <=> x IN a /\ ~ ( x IN b ) `] THEN +REWRITE_TAC[ MESON[normball ; SET_RULE `x IN { x | p x } <=> p x `] ` x IN normball v0 t0 + <=> dist (x,v0) < t0 `] THEN +REWRITE_TAC[ MESON[REAL_ARITH ` a < b /\ b < c ==> a < c `]` + (dist (x,v0) < t0 /\ ~(x IN Z)) /\ + (?w. w IN s /\ + v0 IN s /\ + dist (x,w) < dist (x,v0) /\ + dist (v0,w) < &2 * t0 /\ + (!w'. s w' /\ ~(w' = w) ==> dist (x,w) < dist (x,w')) /\ + ~(w = v0)) /\ las + <=> (dist (x,v0) < t0 /\ ~(x IN Z)) /\ + (?w. w IN s /\ + v0 IN s /\ dist(x,w) < t0 /\ + dist (x,w) < dist (x,v0) /\ + dist (v0,w) < &2 * t0 /\ + (!w'. s w' /\ ~(w' = w) ==> dist (x,w) < dist (x,w')) /\ + ~(w = v0)) /\ las `] THEN +ASM_SIMP_TAC[] THEN PHA THEN +REWRITE_TAC[ MESON[] ` a /\ b /\ c /\ d /\ las <=> (a /\ d ) /\ b /\ c /\ las `] THEN +ONCE_REWRITE_TAC[ MESON[near2t0; SET_RULE ` x IN { x | p x } <=> p x ` ]` (w IN s /\ dist (v0,w) < &2 * t0) <=> + w IN near2t0 v0 s /\ (w IN s /\ dist (v0,w) < &2 * t0) `] THEN +REWRITE_TAC[ SET_RULE ` ~ ( x IN a UNION b) <=> ~( x IN a ) /\ ~ (x IN b)`] THEN PHA THEN + SIMP_TAC[MESON[] ` a /\ a /\ b <=> a /\ b `] THEN +REWRITE_TAC[ MESON[] ` a/\ b /\ ( ? w. P w ) /\ la <=> b /\ ( ? w. a /\ P w ) /\ la `] THEN +ONCE_REWRITE_TAC[ MESON[ SET_RULE ` w IN near2t0 v0 s + ==> UNIONS {aff_ge {w} {w1, w2} | w1,w2 | {w, w1, w2} IN barrier s} SUBSET + UNIONS + {aff_ge {w} {w1, w2} | w IN near2t0 v0 s /\ {w, w1, w2} IN barrier s} `] + ` w IN near2t0 v0 s /\ + w IN s /\ last + <=> UNIONS {aff_ge {w} {w1, w2} | w1,w2 | {w, w1, w2} IN barrier s} SUBSET + UNIONS + {aff_ge {w} {w1, w2} | w IN near2t0 v0 s /\ {w, w1, w2} IN barrier s} /\ + w IN near2t0 v0 s /\ + w IN s /\ last `] THEN +REWRITE_TAC[ MESON[] ` a /\ b /\ c /\ d /\ last <=> a /\ b /\ ( c/\ d ) /\ last `] THEN +REWRITE_TAC[ SET_RULE ` ~ ( x IN a ) /\ b SUBSET a <=> ~ ( x IN a )/\ ~( x IN b ) /\ b SUBSET a`] THEN PHA THEN +REWRITE_TAC[ MESON[DIST_SYM; import_le ] ` dist (x,v0) < t0 /\ + x IN VC v0 s /\ + ~(x IN + UNIONS + {aff_ge {w} {w1, w2} | w IN near2t0 v0 s /\ + {w, w1, w2} IN barrier s}) /\ + ~(x IN + UNIONS + {aff_ge {w} {w1, w2} | w1,w2 | {w, w1, w2} IN barrier s}) /\ + UNIONS + {aff_ge {w} {w1, w2} | w1,w2 | {w, w1, w2} IN barrier s} SUBSET + UNIONS + {aff_ge {w} {w1, w2} | w IN near2t0 v0 s /\ + {w, w1, w2} IN barrier s} /\ + w IN near2t0 v0 s /\ + w IN s /\ + dist (v0,w) < &2 * t0 /\ + (!w'. s w' /\ ~(w' = w) ==> dist (x,w) < dist (x,w')) /\ + dist (x,w) < t0 /\ + dist (x,w) < dist (x,v0) /\ + ~(w = v0) + <=> dist (x,v0) < t0 /\ + x IN VC v0 s /\ + ~(x IN + UNIONS + {aff_ge {w} {w1, w2} | w IN near2t0 v0 s /\ + {w, w1, w2} IN barrier s}) /\ + ~(x IN + UNIONS + {aff_ge {w} {w1, w2} | w1,w2 | {w, w1, w2} IN barrier s}) /\ + UNIONS + {aff_ge {w} {w1, w2} | w1,w2 | {w, w1, w2} IN barrier s} SUBSET + UNIONS + {aff_ge {w} {w1, w2} | w IN near2t0 v0 s /\ + {w, w1, w2} IN barrier s} /\ + w IN near2t0 v0 s /\ + w IN s /\ + dist (v0,w) < &2 * t0 /\ + (!w'. s w' /\ ~(w' = w) ==> dist (x,w) < dist (x,w')) /\ + dist (x,w) < t0 /\ + dist (x,w) < dist (x,v0) /\ + ~(w = v0) /\ ~obstructed w x s `] THEN +ONCE_REWRITE_TAC[ MESON[t0; REAL_ARITH ` #1.255 < &2 /\ (! a b c. a < b /\ b < c ==> a < c )` ] ` + dist (x,w) < t0 /\ dist (x,w) < dist (x,v0) /\ last <=> + dist (x,w) < &2 /\ dist (x,w) < t0 /\ dist (x,w) < dist (x,v0) /\ last`] THEN +REWRITE_TAC[ MESON[ in_VC; DIST_SYM ] `w IN s /\ + dist (v0,w) < &2 * t0 /\ + (!w'. s w' /\ ~(w' = w) ==> dist (x,w) < dist (x,w')) /\ + dist (x,w) < &2 /\ + dist (x,w) < t0 /\ + dist (x,w) < dist (x,v0) /\ + ~(w = v0) /\ + ~obstructed w x s <=> + dist (v0,w) < &2 * t0 /\ + dist (x,w) < t0 /\ + ~(w = v0) /\ + dist (x,w) < dist (x,v0) /\ + w IN s /\ + (!w'. s w' /\ ~(w' = w) ==> dist (x,w) < dist (x,w')) /\ + dist (x,w) < &2 /\ + ~obstructed w x s` ] THEN +REWRITE_TAC[ MESON[DIST_SYM] ` dist(x,w) < &2 <=> dist (w,x) < &2 `] THEN +REWRITE_TAC[MESON[in_VC]` w IN s /\ + (!w'. s w' /\ ~(w' = w) ==> dist (x,w) < dist (x,w')) /\ + dist (w,x) < &2 /\ + ~obstructed w x s + <=> w IN s /\ + (!w'. s w' /\ ~(w' = w) ==> dist (x,w) < dist (x,w')) /\ + dist (w,x) < &2 /\ + ~obstructed w x s /\ x IN VC w s ` ] THEN +REWRITE_TAC[ MESON[]` ~(w = v0) /\ + dist (x,w) < dist (x,v0) /\ + w IN s /\ + (!w'. s w' /\ ~(w' = w) ==> dist (x,w) < dist (x,w')) /\ + dist (w,x) < &2 /\ + ~obstructed w x s /\ + x IN VC w s <=> + + dist (x,w) < dist (x,v0) /\ + w IN s /\ + (!w'. s w' /\ ~(w' = w) ==> dist (x,w) < dist (x,w')) /\ + dist (w,x) < &2 /\ + ~obstructed w x s /\ + ~(w = v0) /\ x IN VC w s `] THEN +ONCE_REWRITE_TAC[ MESON[]` dist (x,v0) < t0 /\ + x IN VC v0 s /\ last <=> dist (x,v0) < t0 /\ last /\ x IN VC v0 s `] +THEN PHA THEN +ONCE_REWRITE_TAC[SET_RULE ` x IN a /\ x IN b <=> ~ ( a INTER b = {} ) /\ x IN a /\ x IN b `] THEN +SIMP_TAC[ MESON[VC_DISJOINT ] ` ~(w = v0) /\ + ~(VC w s INTER VC v0 s = {}) /\ + x IN VC w s /\ + x IN VC v0 s <=> F `]);; + + +(* +++++++++++++++++++++++++ *) + +let lemma82_FOCUDTG = prove (`! (s:real^3 -> bool) (v0:real^3) Z Y. + centered_pac s v0 /\ + Y = + UNIONS + {aff_ge {w} {w1, w2} | w IN near2t0 v0 s /\ {w, w1, w2} IN barrier s} /\ + Z = UNIONS {e_plane u v | u IN near2t0 v0 s /\ v IN near2t0 v0 s} + ==> normball v0 t0 INTER VC v0 s DIFF (Y UNION Z) = + normball v0 t0 INTER voronoi v0 s DIFF (Y UNION Z)`, + REWRITE_TAC[ SET_RULE ` a ==> (b = c) <=> a ==>( b SUBSET c /\ c SUBSET b ) `] + THEN MESON_TAC[ lhand_subset_rhand; rhand_subset_lhand] );; + +(* ========= END LEMMA 8.2 ======== *) + +let a_le_sub = SET_RULE ` w IN near2t0 v0 s + ==> UNIONS {aff_ge {w} {w1, w2} | w1,w2 | {w, w1, w2} IN barrier s} SUBSET + UNIONS + {aff_ge {w} {w1, w2} | w IN near2t0 v0 s /\ {w, w1, w2} IN barrier s} `;; + + + + + + + + + + + + + + + + + + + + + + +(* ============= BEGIN LEMMA 8.3 =========== *) + + +let barrier' = new_definition ` barrier' v0 s = + {{a, b, c} | {a, b, c} IN barrier s /\ v0 IN {a, b, c} \/ + (?q. diagonal a b q s /\ q IN Q_SYS s /\ c IN anchor_points a b s)} `;; + + +let lemma7_7_CXRHOVG = new_axiom `!s q1 q2 v w. + {v, w} SUBSET q1 INTER q2 /\ quarter q2 s /\ diagonal v w q1 s /\ q1 IN Q_SYS s + ==> q2 IN Q_SYS s `;; + + +let tarski_UMMNOJN = new_axiom` !x w v0 v1 v2. + ~(conv {x, w} INTER cone v0 {v1, v2} = {}) /\ + dist (x,v0) < dist (x,v1) /\ + dist (x,v0) < dist (x,v2) /\ + dist (x,w) < dist (x,v0) /\ + (!xx yy. + ~(xx = yy) /\ {xx, yy} SUBSET {v1, v2, v0} + ==> &2 <= dist (xx,yy) /\ dist (xx,yy) <= sqrt (&8)) /\ + ((!aa bb. + aa IN {v1, v2, v0} /\ bb IN {v1, v2, v0} + ==> dist (aa,bb) <= #2.51) \/ + (?aa bb. + {aa, bb} SUBSET {v1, v2, v0} /\ + #2.51 < dist (aa,bb) /\ + (!x y. + ~({x, y} = {aa, bb}) /\ {x, y} SUBSET {v1, v2, v0} + ==> dist (x,y) <= #2.51))) + ==> (!a. a IN {v1, v2, v0} ==> dist (w,a) <= #2.51) /\ + ~(conv {v0, v1, v2} INTER conv0 {x, w} = {}) `;; + +(* ================ *) + +let TRIANGLE_IN_BARRIER' = prove( +`!s v0 v1 v2. + {v0, v1, v2} IN barrier' v0 s + ==> (!xx yy. + ~(xx = yy) /\ {xx, yy} SUBSET {v1, v2, v0} + ==> &2 <= dist (xx,yy) /\ dist (xx,yy) <= sqrt (&8)) /\ + ((!aa bb. + aa IN {v1, v2, v0} /\ bb IN {v1, v2, v0} + ==> dist (aa,bb) <= #2.51) \/ + (?aa bb. + {aa, bb} SUBSET {v1, v2, v0} /\ + #2.51 < dist (aa,bb) /\ + (!x y. + ~({x, y} = {aa, bb}) /\ {x, y} SUBSET {v1, v2, v0} + ==> dist (x,y) <= #2.51))) `, +REWRITE_TAC[ barrier'; IN_ELIM_THM] THEN MATCH_MP_TAC (MESON[] ` (!s v0 v1 v2. + (?a b c. + ({a, b, c} IN barrier s /\ v0 IN {a, b, c} \/ + (?q. diagonal a b q s /\ c IN anchor_points a b s)) /\ + {v0, v1, v2} = {a, b, c}) + ==> las s v0 v1 v2 ) + ==> (!s v0 v1 v2. + (?a b c. + ({a, b, c} IN barrier s /\ v0 IN {a, b, c} \/ + (?q. diagonal a b q s /\ + q IN Q_SYS s /\ + c IN anchor_points a b s)) /\ + {v0, v1, v2} = {a, b, c}) + ==> las s v0 v1 v2 )`) THEN +REWRITE_TAC[ MESON[]` ( ? a b c. ( P {a,b,c} \/ Q a b c ) /\ {v0, v1, v2} = {a, b, c} ) <=> + P {v0, v1, v2} \/ ( ? a b c. Q a b c /\ {v0, v1, v2} = {a, b, c} ) `] THEN +REPEAT GEN_TAC THEN +MATCH_MP_TAC (MESON[]` (a ==> l) /\ (c ==> l) ==> a /\ b \/ c ==> l`) THEN +REWRITE_TAC[ TRIANGLE_IN_BARRIER] THEN +NHANH (CUTHE4 DIA_OF_QUARTER) THEN +REWRITE_TAC[ anchor_points; IN_ELIM_THM; anchor] THEN +NHANH (MESON[diagonal; quarter] ` diagonal a b q s ==> packing s `) THEN PHA THEN +REWRITE_TAC[ MESON[] ` packing s /\ aa /\ bb /\ cc /\ {c, a, b} SUBSET s /\ l + <=> ( packing s /\ {c, a, b} SUBSET s ) /\ aa /\ bb /\ cc /\ l `] THEN +NHANH (CUTHE2 SUB_PACKING ) THEN +REWRITE_TAC[GSYM d3] THEN +REWRITE_TAC[ REAL_ARITH ` &2 * t0 <= d3 a b <=> d3 a b <= &2 * t0 /\ &2 * t0 = d3 a b \/ &2 * t0 + < d3 a b `; t0; REAL_ARITH ` &2 * #1.255 = #2.51 ` ] THEN +REWRITE_TAC[ SET_RULE ` {x,y} SUBSET s <=> x IN s /\ y IN s`] THEN +SIMP_TAC[ SET_RULE `!a b c. {c, a, b} = {a, b, c}`] THEN PHA THEN +REWRITE_TAC[ MESON[]` a /\ b /\ a /\ l <=> a /\ b /\ l `] THEN +KHANANG THEN +REWRITE_TAC[ MESON[]` (?q. P q /\ l1 \/ P q /\ l2) <=> (?q. P q) /\ (l1 \/ l2)`] THEN +PHA THEN +MATCH_MP_TAC (MESON[] ` ((? a b c. Q a b c) ==> l) ==> (? a b c. P a b c /\ Q a b c ) ==> l `) THEN +REWRITE_TAC[ MESON[]` ( a \/ b ) /\ c <=> a /\ c \/ b /\ c `] THEN +ONCE_REWRITE_TAC[ MESON[]` (d3 a b <= #2.51 /\ l <=> l /\ d3 a b <= #2.51) /\ + (#2.51 < d3 a b /\ l <=> l /\ #2.51 < d3 a b) `] THEN PHA THEN +REWRITE_TAC[ MESON[]` d3 c a <= #2.51 /\ + d3 c b <= #2.51 /\ + d3 a b <= #2.51 /\ l <=> ( d3 a b <= #2.51 /\ + d3 c a <= #2.51 /\ + d3 c b <= #2.51 ) /\ l `] THEN +NHANH ( CUTHE3 ( +prove(`! a b c. d3 a b <= #2.51 /\ d3 c a <= #2.51 /\ + d3 c b <= #2.51 ==> (!aa bb. aa IN {a,b,c} /\ bb IN {a,b,c} ==> d3 aa bb <= #2.51)`, +REWRITE_TAC[ SET_RULE ` x IN {a,b,c} <=> x = a \/ x= b \/ x= c `] THEN +MESON_TAC[ D3_REFL; trg_d3_sym; REAL_ARITH ` &0 <= #2.51 `]))) THEN +REWRITE_TAC[ MESON[] ` d3 a b <= sqrt (&8) /\ + d3 a b >= #2.51 /\ + d3 c a <= #2.51 /\ + d3 c b <= #2.51 /\ + #2.51 < d3 a b /\ + l <=> + d3 a b >= #2.51 /\ + l /\ + #2.51 < d3 a b /\ + d3 a b <= sqrt (&8) /\ + d3 c a <= #2.51 /\ + d3 c b <= #2.51 `] THEN +NHANH (CUTHE3 ( +prove(`!a b c. + #2.51 < d3 a b /\ + d3 a b <= sqrt (&8) /\ + d3 c a <= #2.51 /\ + d3 c b <= #2.51 + ==> (?aa bb. + aa IN {a, b, c} /\ + bb IN {a, b, c} /\ + #2.51 < d3 aa bb /\ + (!x y. + ~({x, y} = {aa, bb}) /\ x IN {a, b, c} /\ y IN {a, b, c} + ==> d3 x y <= #2.51)) /\ + (!xx yy. + ~(xx = yy) /\ xx IN {a,b,c} /\ yy IN {a,b,c} + ==> d3 xx yy <= sqrt (&8))`, +REWRITE_TAC[ MESON[]` (? a b. P a b ) /\ l <=> (? a b. P a b /\ l ) `] THEN +REWRITE_TAC[ SET_RULE ` x IN {a,b,c} <=> x = a \/ x = b \/ x = c `] THEN +REPEAT GEN_TAC THEN DISCH_TAC THEN EXISTS_TAC `a:real^3` THEN EXISTS_TAC `b:real^3` +THEN FIRST_X_ASSUM MP_TAC THEN +REWRITE_TAC[ SET_RULE `{a,b} ={x,y} <=> a = x /\ b = y \/ a = y /\ b = x `] THEN +MESON_TAC[trg_d3_sym; db_t0_sq8; D3_REFL; REAL_ARITH ` &0 <= #2.51 /\ (! a b c. a <= b /\ b < c ==> a <= c )`]))) THEN +PHA THEN +ONCE_REWRITE_TAC[ MESON[] `(! x y. P x y ) /\ l <=> l /\ (! x y. P x y) `] THEN +PHA THEN +ONCE_REWRITE_TAC[ SET_RULE ` {v0, v1, v2} = {a, b, c} <=> {v1, v2, v0} = {a, b, c}`] THEN +NHANH ( MESON[db_t0_sq8 ; REAL_ARITH ` a <= b /\ b < c ==> a <= c `]` (!aa bb. aa IN {a, b, c} /\ bb IN {a, b, c} ==> d3 aa bb <= #2.51) /\ + {v1, v2, v0} = {a, b, c} /\ + (!x y. x IN {a, b, c} /\ y IN {a, b, c} /\ ~(x = y) ==> &2 <= d3 x y) + ==> (! x y. ~(x=y) /\ x IN {v1,v2,v0} /\ y IN {v1,v2,v0}==> &2 <= d3 x y /\ + d3 x y <= sqrt (&8)) `) THEN +PHA THEN REWRITE_TAC[ MESON[]` {v1, v2, v0} = {a, b, c} /\ l <=> l /\ {v1, v2, v0} = {a, b, c}`] THEN PHA THEN +PURE_ONCE_REWRITE_TAC[ MESON[]` P {a,b,c} /\ Q {a,b,c} /\ R {a,b,c} /\ {v1,v2,v0} = {a,b,c} <=> P {v1,v2,v0} /\ + Q {v1,v2,v0} /\ R {v1,v2,v0} /\ {v1,v2,v0} = {a,b,c} ` ] THEN +MESON_TAC[]);; + + +(* ----------- +-------------- *) + + +let NOV6 = prove(` ! s v0 v1 v2 w. packing s /\ + CARD {v0, v1, v2, w} = 4 /\ + (!a. a IN {v1, v2, v0} ==> dist (w,a) <= #2.51) /\ + {v0, v1, v2, w} SUBSET s /\ + (?a b c. + {a, b, c} = {v0, v1, v2} /\ + &2 * t0 <= d3 a b /\ + d3 a b <= sqrt (&8) /\ + c IN anchor_points a b s) + ==> quarter {v0, v1, v2, w} s`, +REWRITE_TAC[ quarter; def_simplex] THEN +REWRITE_TAC[ prove(`! v0 v1 v2 w. CARD {v0, v1, v2, w} = 4 <=> ~(v0 = v1 \/ v0 = v2 \/ v0 = w \/ v1 = v2 \/ v1 = w \/ v2 = w)`, + REWRITE_TAC[ CARD4] THEN SET_TAC[])] THEN +SIMP_TAC[] THEN +NHANH ( SET_RULE ` {a, b, c} = {v0, v1, v2} ==> a IN {v0,v1,v2,w} /\ + b IN {v0,v1,v2,w} `) THEN +REWRITE_TAC[ MESON[]` (!a . P a ) /\ a /\ (? a b c. Q a b c) <=> + a /\ (?a b c. Q a b c /\ (!a . P a ))`] THEN +REWRITE_TAC[ anchor_points; anchor; IN_ELIM_THM] THEN PHA THEN +SIMP_TAC[ SET_RULE ` {v1, v2, v0} = {v0, v1, v2}`] THEN +PURE_ONCE_REWRITE_TAC[ MESON []` {a, b, c} = {v0, v1, v2} /\ P {v0, v1, v2} + <=> {a, b, c} = {v0, v1, v2} /\ P {a, b, c}`] THEN +ONCE_REWRITE_TAC[ DIST_SYM] THEN +REWRITE_TAC[ GSYM d3 ] THEN +REWRITE_TAC[ MESON[t0; REAL_ARITH ` #2.51 = &2 * #1.255 `] ` #2.51 = &2 * t0 `] THEN +NHANH (CUTHE4 SHORT_EDGES) THEN +PURE_ONCE_REWRITE_TAC[ SET_RULE ` {a, b, c, w} = w INSERT {a,b,c} `] THEN +PURE_ONCE_REWRITE_TAC[ GSYM (MESON []` {a, b, c} = {v0, v1, v2} /\ P {v0, v1, v2} + <=> {a, b, c} = {v0, v1, v2} /\ P {a, b, c}`)] THEN MESON_TAC[]);; + +(* ============ *) + +let NOV7 = prove(`!s v0 v1 v2 w x . CARD {v0, v1, v2, w, x} = 5 /\ + (!a. a IN {v1, v2, v0} ==> dist (w,a) <= #2.51) /\ + {v0, v1, v2, w} SUBSET s /\ + (?a b c. + (?q. diagonal a b q s /\ q IN Q_SYS s /\ c IN anchor_points a b s) /\ + {v0, v1, v2} = {a, b, c}) + ==> {v0, v1, v2, w} IN Q_SYS s`, +ONCE_REWRITE_TAC[ SET_RULE ` {v0, v1, v2, w, x} = {x,v0, v1, v2, w}`] THEN +REWRITE_TAC[CARD5; GSYM CARD4] THEN +NHANH (CUTHE4 DIA_OF_QUARTER) THEN +NHANH (MESON[diagonal; quarter] `diagonal a b q s ==> packing s `) THEN +PHA THEN REWRITE_TAC[ MESON[]` (?q. diagonal a b q s /\ a1 /\ a2 /\ a3 /\ q IN Q_SYS s /\ a4) <=> + a1 /\ a2 /\ a3 /\ a4 /\ (?q. diagonal a b q s /\ q IN Q_SYS s) `] THEN +NHANH ( MESON[NOV6]` CARD {v0, v1, v2, w} = 4 /\ + (!a. a IN {v1, v2, v0} ==> dist (w,a) <= #2.51) /\ + {v0, v1, v2, w} SUBSET s /\ + (?a b c. + (packing s /\ + &2 * t0 <= d3 a b /\ + d3 a b <= sqrt (&8) /\ + c IN anchor_points a b s /\ + (?q. diagonal a b q s /\ q IN Q_SYS s)) /\ + {v0, v1, v2} = {a, b, c}) + ==> quarter {v0, v1, v2, w} s`) THEN +PHA THEN REWRITE_TAC[ MESON[]` (? a. P a) /\ aa <=> (? a . P a /\ aa )`] THEN +NHANH (MESON[diagonal] ` diagonal a b q s ==> {a,b} SUBSET q `) THEN +PHA THEN REWRITE_TAC[ MESON[]` (? a. P a) /\ aa <=> (? a . P a /\ aa )`] THEN +NHANH (SET_RULE ` {v0, v1, v2} = {a, b, c} ==> {a,b} SUBSET {v0,v1,v2,w} `) THEN +REWRITE_TAC[ SET_RULE ` {a, b} SUBSET q /\ aa /\ bb /\ {a, b} SUBSET {v0, v1, v2, w} <=> + {a, b} SUBSET q INTER {v0, v1, v2, w} /\ aa /\ bb`] THEN +MESON_TAC[lemma7_7_CXRHOVG]);; + + +let lemma8_3_OVOAHCG =prove(`!s v0 v1 v2 w x. {v0, v1, v2, w} SUBSET s /\ CARD {v0,v1,v2,w,x} = 5 /\ + centered_pac s v0 /\ + ~(conv {x, w} INTER aff_ge {v0} {v1, v2} = {}) /\ + {v0, v1, v2} IN barrier' v0 s /\ + unobstructed v0 x s /\ + dist (x,v0) < dist (x,v1) /\ + dist (x,v0) < dist (x,v2) + ==> ~(x IN VC w s)`, +REPEAT GEN_TAC THEN ONCE_REWRITE_TAC[ MESON[] ` a ==> ~b <=> a /\ b ==> ~b`] THEN +REWRITE_TAC[IN_ELIM_THM] THEN +NHANH (MESON[CARD5] ` CARD {x, w, v0, v1, v2} = 5 ==> ~(x IN {w,v0,v1,v2})`) THEN +NHANH ( SET_RULE ` ~(x IN {w,v0,v1,v2}) ==> ~( x = w ) `) THEN +PHA THEN REWRITE_TAC[ MESON[]` unobstructed v0 x s /\ a <=> a /\ + unobstructed v0 x s `] THEN REWRITE_TAC[ MESON[]` ~(x = w) /\ a <=> a /\ ~(x = w) `] + THEN PHA THEN +NHANH (SET_RULE ` ~(v0 IN {v1, v2, w, x}) ==> ~( v0 = w )`) THEN +NGOAC THEN MATCH_MP_TAC (MESON[] ` (a ==> c) ==> ( a /\ b ==> c ) `) THEN PHA THEN +REWRITE_TAC[ unobstructed] THEN +REWRITE_TAC[ MESON[] ` ~(v0 = w) /\ centered_pac s v0 /\ aa /\ bb /\ cc /\ + x IN VC w s /\ ~obstructed v0 x s /\ las <=> + aa /\ bb /\ cc /\ las /\ ( centered_pac s v0 /\ ~(v0 = w) /\ + ~obstructed v0 x s /\ x IN VC w s )`] THEN +NHANH (CUTHE4 (prove(` ! s v0 w x . centered_pac s v0 /\ ~(v0 = w) /\ ~obstructed v0 x s /\ x IN VC w s +==> d3 w x < d3 v0 x`, REWRITE_TAC[ VC; lambda_x; IN_ELIM_THM] THEN PURE_ONCE_REWRITE_TAC +[ MESON[] `( !s v0 w x. a v0 x s w ==> b v0 x w ) <=> ( ! s v0 w x. ( d3 v0 x < &2 \/ +~(d3 v0 x < &2)) /\ a v0 x s w ==> b v0 x w) `] THEN MESON_TAC[centered_pac; trg_d3_sym; + REAL_ARITH` ~(d3 v0 x < &2) /\ d3 w x < &2 ==> d3 w x < d3 v0 x`]))) THEN +NHANH (CUTHE4 TRIANGLE_IN_BARRIER') THEN +PHA THEN +ONCE_REWRITE_TAC[MESON[] ` a1 /\ a2 /\ a3 /\ a4 /\ +~(conv {x, w} INTER aff_ge {v0} {v1, v2} = {}) /\ aa /\ bb /\ cc /\ dd /\ a5 <=> aa /\ + bb /\ cc /\ dd /\ ~(conv {x, w} INTER aff_ge {v0} {v1, v2} = {}) /\ a3 /\ a4 /\ + a5 /\ a1 /\ a2`] THEN ONCE_REWRITE_TAC[ trg_d3_sym] THEN REWRITE_TAC[d3] THEN +REWRITE_TAC[MESON[aff_ge_def; cone]` aff_ge {v0} {v1, v2} = cone v0 {v1,v2}`] THEN +ONCE_REWRITE_TAC[ MESON[] ` CARD {v0, v1, v2, w, x} = 5 /\ a1 /\ a2 /\ a3 /\ a4 /\ a5 /\ a6 /\ l <=> + a1 /\ a2 /\ a3 /\ a4 /\ a5 /\ a6 /\ CARD {v0, v1, v2, w, x} = 5 /\ l`] THEN +NHANH (CUTHE5 tarski_UMMNOJN) THEN +PHA THEN REWRITE_TAC[ MESON[] ` ( a \/ b ) /\ c <=> c /\ ( a \/ b ) `] THEN +REWRITE_TAC[ MESON[] `{v0, v1, v2} IN barrier' v0 s /\ a <=> + a /\ {v0, v1, v2} IN barrier' v0 s`] THEN +REWRITE_TAC[ barrier'; IN_ELIM_THM] THEN +PURE_ONCE_REWRITE_TAC[ MESON[]` (?a b c. + ( P {a, b, c} \/ + Q a b c ) /\ + {v0, v1, v2} = {a, b, c}) + <=> P {v0, v1, v2} \/ (? a b c. Q a b c /\ {v0, v1, v2} = {a, b, c})`] THEN PHA THEN +ONCE_REWRITE_TAC[ MESON[] ` ~(conv {v0, v1, v2} INTER conv0 {x, w} = {}) /\ aa /\ (b \/ bb) <=> + ~(conv {v0, v1, v2} INTER conv0 {x, w} = {}) /\ + aa /\ + (~(conv {v0, v1, v2} INTER conv0 {x, w} = {}) /\ b \/ bb)`] THEN +REWRITE_TAC[ SET_RULE ` conv {v0, v1, v2} INTER conv0 {x, w} = + conv0 {x, w} INTER conv {v0, v1, v2}`] THEN +NHANH (MESON[ def_obstructed] ` ~(conv0 {x, w} INTER conv {v0, v1, v2} = {}) /\ + {v0, v1, v2} IN barrier s /\ l ==> obstructed x w s `) THEN +PHA THEN REWRITE_TAC[ MESON[] ` {v0, v1, v2, w} SUBSET s /\ a <=> a /\ {v0, v1, v2, w} + SUBSET s`] THEN +REWRITE_TAC[ MESON[] ` (!a. a IN {v1, v2, v0} ==> dist (w,a) <= #2.51) /\ a <=> + a /\ (!a. a IN {v1, v2, v0} ==> dist (w,a) <= #2.51)`] THEN +REWRITE_TAC[ MESON[]` CARD {v0, v1, v2, w, x} = 5 /\ a <=> + a /\ CARD {v0, v1, v2, w, x} = 5 `] THEN +PHA THEN +ONCE_REWRITE_TAC[ MESON[] ` ( a \/ b) /\ a1 /\ a2 /\ {v0, v1, v2, w} SUBSET s <=> ( a \/ + a2 /\ a1 /\ {v0, v1, v2, w} SUBSET s /\ b) /\ a1 /\ a2 /\ {v0, v1, v2, w} SUBSET s`] THEN +NHANH (CUTHE6 NOV7) THEN +NHANH (prove(` {v0, v1, v2, w} IN Q_SYS s ==> {v0,v1,v2} IN barrier s `, + REWRITE_TAC[ barrier; SET_RULE` {a,b,c} UNION {d} = {a,b,c,d} `; IN_ELIM_THM] + THEN MESON_TAC[])) THEN +ONCE_REWRITE_TAC[ MESON[] ` ~(conv0 {x, w} INTER conv {v0, v1, v2} = {}) /\ a1 + /\ ( a \/ b ) /\ l <=> ~(conv0 {x, w} INTER conv {v0, v1, v2} = {}) /\ a1 + /\ ( a \/ b /\ ~(conv0 {x, w} INTER conv {v0, v1, v2} = {}) ) /\ l`] THEN +PHA THEN NHANH (MESON[def_obstructed] ` {v0, v1, v2} IN barrier s /\ + ~(conv0 {x, w} INTER conv {v0, v1, v2} = {}) ==> obstructed x w s`) THEN +REWRITE_TAC[ MESON[]` (a /\ b \/ a /\ c ) <=> a /\ ( b \/ c ) `] THEN +DAO THEN +REWRITE_TAC[ MESON[] `( obstructed x w s /\ b \/ obstructed x w s + /\ c ) <=> obstructed x w s /\ ( b \/ c ) `] THEN PHA THEN +REWRITE_TAC[MESON[ OBS_IMP_NOT_IN_VC] ` a1/\a2/\a3 /\ obstructed x w s /\ l + ==> ~(x IN VC w s)`]);; + +let lambda_x = prove(` ! x s. lambda_x x s ={w | w IN s /\ d3 w x < &2 /\ ~obstruct w x s}`, +REWRITE_TAC[lambda_x; OBSTRUCT_EQ]);; + +(* ==== end repare VC === *) + + +(* LEMMA 8.1 *) + + + +let TCQPONA = new_axiom ` ! s v v1 v2 v3. + packing s /\ + CARD {v, v1, v2, v3} = 4 /\ + {v, v1, v2, v3} SUBSET s /\ + d3 v1 v2 <= &2 * t0 /\ + d3 v2 v3 <= &2 * t0 /\ + d3 v3 v1 <= &2 * t0 /\ + ~(conv {v1, v2, v3} INTER voronoi v s = {}) + ==> (!x. x IN {v1, v2, v3} ==> &2 <= d3 x v /\ d3 x v <= &2 * t0)`;; + + + +let CEWWWDQ = new_axiom ` !s v v1 v2 v3. + packing s /\ + CARD {v, v1, v2, v3} = 4 /\ + {v, v1, v2, v3} SUBSET s /\ + d3 v1 v2 <= &2 * t0 /\ + d3 v2 v3 <= &2 * t0 /\ + d3 v1 v3 <= sqrt (&8) /\ + ~(conv {v1, v2, v3} INTER voronoi v s = {}) + ==> (!x. x IN {v1, v2, v3} ==> &2 <= d3 x v /\ d3 x v <= &2 * t0)`;; + + + + +let QHSEWMI = new_axiom ` !v1 v2 v3 w1 w2. + ~(conv {w1, w2} INTER conv {v1, v2, v3} = {}) /\ + ~(w1 IN conv {v1,v2,v3}) + ==> w2 IN cone w1 {v1, v2, v3}`;; + + + + +(* =================== *) + +let BAR_TRI = prove(` ! b s. b IN barrier s <=> (? x y z . b = {x,y,z} /\ {x,y,z} IN barrier s)`, +REWRITE_TAC[ barrier ; IN_ELIM_THM] THEN MESON_TAC[]);; + + + + + +let NOV20 = prove(` ! v0 x' y z. v0 IN {x', y, z} <=> (?yy zz. {v0, yy, zz} = {x', y, z})`, +REPEAT GEN_TAC THEN +REWRITE_TAC[EQ_EXPAND] THEN +REWRITE_TAC[SET_RULE `((?yy zz. {v0, yy, zz} = {x', y, z}) + ==> v0 IN {x', y, z})`] THEN +REWRITE_TAC[IN_SET3] THEN +MESON_TAC[SET_RULE ` x = a + ==> {x, b, c} = {a, b, c} /\ + {x, b, c} = {b, a, c} /\ + {x, b, c} = {b, c, a}`]);; + + + +let X_IN_VOR_X = prove(` ! x:real^A s. x IN voronoi x s `, +REWRITE_TAC[voronoi; IN_ELIM_THM; DIST_REFL; DIST_POS_LT] THEN +MESON_TAC[DIST_POS_LT]);; + +let IN_VO2_EQ = prove(` ! s v0 x . x IN voro2 v0 s <=> + (!w. s w /\ ~(w = v0) ==> d3 x v0 < d3 x w) /\ d3 x v0 < &2`, +REWRITE_TAC[voro2; voronoi; IN_ELIM_THM; d3]);; + +let IN_VO_EQ = prove(`! x s v0 . x IN voronoi v0 s <=> (!w. s w /\ + ~(w = v0) ==> dist(x,v0) < dist(x,w))`, REWRITE_TAC[voronoi; IN_ELIM_THM]);; + + +let IN_BAR_DISTINCT = prove(` ! a b c s. {a,b,c} IN barrier s ==> + ~( a = b\/ b= c \/ c = a)`, +REWRITE_TAC[barrier; IN_ELIM_THM; quasi_tri;set_3elements] THEN +KHANANG THEN REWRITE_TAC[EXISTS_OR_THM] THEN NHANH ( MESON[]` (?v1 v2 v3. + (a1 /\ a2 v1 v2 v3 /\ + ~(v1 = v2 \/ v2 = v3 \/ v3 = v1) /\ + a3 v1 v2 v3 ) /\ + {a, b, c} = {v1, v2, v3}) ==> (?v1 v2 v3. + ~(v1 = v2 \/ v2 = v3 \/ v3 = v1) /\ + {a, b, c} = {v1, v2, v3})`) THEN +ONCE_REWRITE_TAC[MESON[EQ_SYM_EQ]` {a,b,c} = {x,y,z} <=> {x,y,z} = {a,b,c}` ] THEN +REWRITE_TAC[ set_3elements] THEN MESON_TAC[OCT23]);; + + +let FOUR_POINTS = prove(`!a b c d s. + {a, b, c} IN barrier s /\ ~(d IN {a, b, c}) ==> CARD {a, b, c, d} = 4`, +NHANH (CUTHE4 IN_BAR_DISTINCT) THEN ONCE_REWRITE_TAC[ +SET_RULE ` {a,b,c,d} = {d,a,b,c} `] THEN MESON_TAC[CARD4]);; + + +(* ========= *) + + +let IN_Q_SYS_IMP4 = prove(`!q s. q IN Q_SYS s ==> + (?a b c d. {a, b, c} UNION {d} = q)`, +NHANH (SPEC_ALL CASES_OF_Q_SYS) THEN +REWRITE_TAC[quasi_reg_tet; strict_qua; quarter; simplex] THEN +REWRITE_TAC[SET_RULE` {a,b,c,d} = {a,b,c} UNION {d} `] THEN +MESON_TAC[]);; + + +let SET2_SU_EX = SET_RULE` {(a:A),b} SUBSET s <=> a IN s /\ b IN s `;; +let D3_SYM = MESON[trg_d3_sym]` ! x y. d3 x y = d3 y x `;; + + +let EXISTS_DIA = prove(`! q s. quarter q s ==> (? a b. diagonal a b q s)`, +REWRITE_TAC[quarter; diagonal] THEN +REWRITE_TAC[SET2_SU_EX] THEN +SIMP_TAC[] THEN +NHANH (MESON[REAL_LE_TRANS]`&2 * t0 <= d3 v w /\ a1 /\ (!x y. P x y ==> d3 x y <= &2 * t0) + ==> (!x y. P x y ==> d3 x y <= d3 v w)`) THEN +MP_TAC PAIR_D3 THEN +REWRITE_TAC[MESON[REAL_ARITH ` a = b ==> a <= b `] ` a ==> b = c:real <=> + a ==> ( b = c /\ b <= c )`] THEN +MESON_TAC[]);; + + +let QUARTER_EQ_EX_DIA = prove(`! q s. quarter q s <=> (? a b. diagonal a b q s)`, +REWRITE_TAC[EQ_EXPAND; EXISTS_DIA; diagonal] THEN MESON_TAC[]);; + + +let IN_Q_IMP = prove(`!q s. + q IN Q_SYS s ==> + quasi_reg_tet q s \/ + (?a b q1. + {a, b} SUBSET q INTER q1 /\ quarter q s /\ diagonal a b q1 s /\ q1 IN Q_SYS s)`, +REWRITE_TAC[MESON[CASES_OF_Q_SYS]` (q IN Q_SYS s ==> a ) <=> q IN Q_SYS s + /\ (quasi_reg_tet q s \/ strict_qua q s) ==> a `] THEN +KHANANG THEN +REWRITE_TAC[MESON[]` a \/ b ==> c <=> (a ==> c) /\ ( b==> c) `] THEN +SIMP_TAC[] THEN +REWRITE_TAC[strict_qua] THEN +NHANH (SPEC_ALL EXISTS_DIA) THEN +NHANH (MESON[diagonal]` diagonal d1 d2 q s ==> {d1, d2} SUBSET q `) THEN +REWRITE_TAC[SUBSET_INTER] THEN +MESON_TAC[]);; + +let NOV21 = prove(` ! q s. quasi_reg_tet q s ==> q IN Q_SYS s`, +REWRITE_TAC[Q_SYS; IN_ELIM_THM] THEN REWRITE_TAC[ MESON[]` a ==> a \/ b `]);; + + +let NOVE21 = prove(` ! q s. quasi_reg_tet q s \/ + (?a b q1. + {a, b} SUBSET q1 INTER q /\ quarter q s /\ diagonal a b q1 s /\ q1 IN Q_SYS s) + ==> q IN Q_SYS s `, +MP_TAC NOV21 THEN REWRITE_TAC[OR_IMP_EX] THEN SIMP_TAC[] THEN +MP_TAC lemma7_7_CXRHOVG THEN MESON_TAC[]);; + + +let COND_Q_SYS =prove(`!q s. + q IN Q_SYS s <=> quasi_reg_tet q s \/ + (?a b q1. {a, b} SUBSET q INTER q1 /\ quarter q s /\ + diagonal a b q1 s /\ q1 IN Q_SYS s)`, REWRITE_TAC[EQ_EXPAND] THEN +REWRITE_TAC[IN_Q_IMP] THEN MESON_TAC[INTER_COMM; NOVE21]);; + +(* ============ *) + +let SET4_SUB_EX = SET_RULE ` {a,b,c,d} SUBSET s <=> + a IN s /\ b IN s /\ c IN s /\ (d:A) IN s `;; + + + +let IMP_QUA_RE_TE = prove(`!s v0 x y z. v0 IN s /\ packing s /\ + {x, y, z} SUBSET s /\ + (!aa bb. aa IN {y, z, x} /\ bb IN {y, z, x} ==> dist (aa,bb) <= #2.51) /\ + ~(voronoi v0 s INTER conv {x, y, z} = {}) /\ + CARD {x, y, z, v0} = 4 ==> quasi_reg_tet {v0,x,y,z} s `, +NHANH (SET_RULE ` (! aa bb. aa IN {y, z, x} /\ bb IN {y, z, x} ==> P aa bb ) + ==> P x y /\ P y z /\ P z x `) THEN +ONCE_REWRITE_TAC[ SET_RULE `{a,b,c,d} = {d,a,b,c}`] THEN +REWRITE_TAC[ SET_RULE ` v0 IN s /\ packing s /\ + {x, y, z} SUBSET s /\ l <=> packing s /\ {v0,x,y,z} SUBSET s /\ l `] THEN +REWRITE_TAC[ MESON[]` a /\ b/\ ( c1 /\ c2 ) /\ d /\ e <=> c1 /\ a /\ e + /\ b /\ c2 /\d `] THEN +ONCE_REWRITE_TAC[INTER_COMM] THEN +REWRITE_TAC[ GSYM db_t0; GSYM d3] THEN PHA THEN +NHANH (SPEC_ALL TCQPONA) THEN +REWRITE_TAC[quasi_reg_tet; def_simplex; CARD4;IN_SET3; IN_SET4; + DE_MORGAN_THM; SET4_SUB_EX; db_t0] THEN +SIMP_TAC[] THEN PHA THEN DAO THEN +REWRITE_TAC[ MESON[D3_SYM]` (!x'. x' = x \/ x' = y \/ x' = z ==> + d3 x' v0 <= #2.51 /\ &2 <= d3 x' v0) /\ a1 /\ + d3 z x <= #2.51 /\ + d3 y z <= #2.51 /\ + d3 x y <= #2.51 /\ + l ==> (!v w. ~(v = w) /\ + (v = z \/ v = v0 \/ v = x \/ v = y) /\ + (w = z \/ w = v0 \/ w = x \/ w = y) + ==> d3 v w <= #2.51)`]);; + +(* =========== *) + +let SET3_U_SET1 = SET_RULE ` {a,b,c} UNION {d} = {a,b,c,d} `;; + + +let IN_BA_IM_PA_SU = prove(`! s x y z. {x, y, z} IN barrier s ==> +packing s /\ {x, y, z} SUBSET s`, +REWRITE_TAC[barrier; IN_ELIM_THM] THEN +NHANH (SPEC_ALL CASES_OF_Q_SYS) THEN REPEAT GEN_TAC THEN +REWRITE_TAC[quasi_tri] THEN KHANANG THEN +REWRITE_TAC[MESON[]` (?a b c. P a b c \/ Q a b c) ==> l <=> + ((?a b c . P a b c ) ==> l) /\ ((?a b c. Q a b c) ==> l)`] THEN +REWRITE_TAC[MESON[]` (?v1 v2 v3. (packing s /\ + {v1, v2, v3} SUBSET s /\P v1 v2 v3 ) /\ + {x, y, z} = {v1, v2, v3}) ==> packing s /\ {x, y, z} SUBSET s`] THEN +REWRITE_TAC[quasi_reg_tet; strict_qua; quarter; SET3_U_SET1; def_simplex] THEN +REWRITE_TAC[SET_RULE ` {a,b,c,d} SUBSET s <=> {a,b,c} SUBSET s /\ d IN s `] THEN +MESON_TAC[]);; + + +let FIRST_NOV22 = prove(` ! s v0 x y z. {x, y, z} IN barrier s /\ + (!xx yy. + ~(xx = yy) /\ {xx, yy} SUBSET {y, z, x} + ==> &2 <= dist (xx,yy) /\ dist (xx,yy) <= sqrt (&8)) /\ + (!aa bb. aa IN {y, z, x} /\ bb IN {y, z, x} ==> dist (aa,bb) <= #2.51) /\ + v0 IN s /\ + ~(voronoi v0 s INTER conv {x, y, z} = {}) /\ + CARD {x, y, z, v0} = 4 + ==> {v0, x, y, z} IN Q_SYS s`, +NHANH (SPEC_ALL IN_BA_IM_PA_SU ) THEN +PHA THEN +ONCE_REWRITE_TAC[MESON[]` a1 /\ a2 /\ a3 /\ a4 /\ a5 /\ a6 /\ a7 /\ a8 <=> + a1 /\ a4 /\ a6 /\ a2 /\ a3 /\ a5 /\ a7 /\ a8 `] THEN +NHANH (SPEC_ALL IMP_QUA_RE_TE) THEN +MESON_TAC[COND_Q_SYS]);; + + + +let QUA_TRI_EDGE = prove(` ! q s. quasi_tri q s ==> + (! a b. a IN q /\ b IN q ==> d3 a b <= &2 * t0 )`,REWRITE_TAC[quasi_tri; db_t0] +THEN MP_TAC D3_REFL THEN MP_TAC (REAL_ARITH ` &0 <= #2.51 `) THEN MESON_TAC[]);; + + +let BAR_WI_LONG_ED = prove(`!bar s. + bar IN barrier s /\ (?a b. #2.51 < d3 a b /\ a IN bar /\ b IN bar) + ==> (?w. w INSERT bar IN Q_SYS s /\ strict_qua (w INSERT bar) s)`, +REWRITE_TAC[barrier; IN_ELIM_THM] THEN REPEAT GEN_TAC THEN STRIP_TAC THENL +[REPEAT (FIRST_X_ASSUM MP_TAC);REPEAT (FIRST_X_ASSUM MP_TAC)] + THENL [NHANH (SPEC_ALL QUA_TRI_EDGE); +ABBREV_TAC ` an w s = (w:real^3 INSERT (bar:real^3 -> bool) IN Q_SYS s)`] THENL +[REWRITE_TAC[ GSYM db_t0]; NHANH (SPEC_ALL CASES_OF_Q_SYS)] THENL +[MESON_TAC[REAL_ARITH ` a <= b <=> ~( b < a )`]; +NHANH (MESON[QUA_TET_IMPLY_QUA_TRI]`quasi_reg_tet ({v0, v1, v2} UNION {v4}) s ==> + quasi_tri {v0, v1, v2} s`)] THEN NHANH (SPEC_ALL QUA_TRI_EDGE) THEN +STRIP_TAC THENL [ASM_MESON_TAC[db_t0; REAL_ARITH` a <= b <=> ~( b < a ) `]; +ASM_MESON_TAC[SET_RULE ` s UNION {a} = a INSERT s `]]);; + +(* ======= *) + +let PER_SET3 = SET_RULE ` {a,b,c} = {a,c,b} /\ {a,b,c} = {b,a,c} /\ + {a,b,c} = {c,a,b} /\ {a,b,c} = {b,c,a} /\ {a,b,c} = {c,b,a} `;; + +let EXI_THIRD_PO =prove( ` ! a b c x y: A. {x,y} SUBSET {a,b,c} /\ ~(x=y) + ==> (? z. {x,y,z} = {a,b,c} ) `, REPEAT GEN_TAC THEN +REWRITE_TAC[SET2_SU_EX] THEN REWRITE_TAC[SET2_SU_EX; IN_SET3] THEN +KHANANG THEN REWRITE_TAC[MESON[]`x = a /\ y = a /\ ~(x = y) <=> F`] THEN +MESON_TAC[ PER_SET3]);; + + + + +let IMP_QUA = prove(` ! a b c s v0. packing s /\ + CARD {v0, a, b, c} = 4 /\ + {v0, a, b, c} SUBSET s /\ + d3 a b <= &2 * t0 /\ + d3 b c <= &2 * t0 /\ &2 * t0 <= d3 a c /\ + d3 a c <= sqrt (&8) /\ + (!x. x IN {a, b, c} ==> &2 <= d3 x v0 /\ d3 x v0 <= &2 * t0) +==> quarter {v0, a, b, c} s `, +REWRITE_TAC[quarter; def_simplex; CARD4; IN_SET3; DE_MORGAN_THM] THEN +SIMP_TAC[] THEN REPEAT GEN_TAC THEN STRIP_TAC THEN +EXISTS_TAC `a:real^3` THEN EXISTS_TAC `c:real^3` THEN +ASM_SIMP_TAC[FOUR_IN] THEN REWRITE_TAC[IN_SET4; PAIR_EQ_EXPAND] THEN +MP_TAC (MESON[REAL_ARITH ` &0 <= #2.51`; db_t0]` &0 <= &2*t0 `) THEN +ASM_MESON_TAC[D3_SYM; D3_REFL]);; + + +let QUA_RE_TE_EDGE = prove(`! a b q s. quasi_reg_tet q s /\ a IN q /\ b IN q + ==> d3 a b <= &2 * t0 `, REWRITE_TAC[quasi_reg_tet] THEN MP_TAC D3_REFL THEN +REWRITE_TAC[db_t0] THEN MESON_TAC[REAL_ARITH `&0 <= #2.51 `]);; + +(* ========= *) + + +let CONSI_OF_LE77 = prove(`!s v0 v4 w x y z. + quarter ({x, y, z} UNION {v0}) s /\ + aa IN {x, y, z} /\ + bb IN {x, y, z} /\ + {x, y, z} UNION {v4} IN Q_SYS s /\ + diagonal aa bb ({x, y, z} UNION {v4}) s + ==> {x, y, z} UNION {v0} IN Q_SYS s`, +REWRITE_TAC[MESON[]` quarter q s /\ a <=>a/\quarter q s `] THEN +PHA THEN NHANH (SET_RULE ` aa IN {x, y, z} /\ bb IN {x, y, z} /\ l + ==> (!v0 v4. + {aa, bb} SUBSET + ({x, y, z} UNION {v4}) INTER ({x, y, z} UNION {v0}))`) THEN +PHA THEN NHANH (MESON[]` diagonal aa bb ({x, y, z} UNION {v4}) s /\ + quarter ({x, y, z} UNION {v0}) s /\ + (!v0 v4. P v0 v4) ==> P v0 v4 `) THEN MESON_TAC[lemma7_7_CXRHOVG]);; + + + + + + + + + +let IMP_IN_Q_SYS = prove( ` ! s v0 x y z . {x, y, z} IN barrier s /\ v0 IN s /\ + ~(voronoi v0 s INTER conv {x, y, z} = {}) /\ + CARD {x, y, z, v0} = 4 + ==> {v0, x, y, z} IN Q_SYS s`, +NHANH (CUTHE4 TRIANGLE_IN_BARRIER) THEN +KHANANG THEN +REWRITE_TAC[OR_IMP_EX] THEN +REWRITE_TAC[FIRST_NOV22] THEN +REPEAT GEN_TAC THEN +MATCH_MP_TAC (MESON[]`(a /\ c ==> d ) ==> a /\ b /\ c ==> d `) THEN +NHANH (SPEC_ALL IN_BA_IM_PA_SU) THEN +REWRITE_TAC[MESON[]` a /\ b /\ c ==> d <=> b ==> a /\ c ==> d`] THEN +NHANH (MESON[DIST_NZ; REAL_ARITH ` &0 < #2.51 /\ ( a < b /\ b < c ==> a < c )`]` + #2.51 < dist (aa,bb) ==> ~( aa = bb ) `) THEN +REWRITE_TAC[ MESON[]` a /\ ( b /\ c ) /\ l <=> (a /\ c ) /\ b /\ l`] THEN +NHANH (SPEC_ALL EXI_THIRD_PO) THEN +REWRITE_TAC[MESON[]` a/\ b/\ c/\ d <=> c /\ a/\b/\d`] THEN +STRIP_TAC THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN +ONCE_REWRITE_TAC[ EQ_SYM_EQ] THEN +REWRITE_TAC[MESON[]` a = b ==> P a <=> a = b ==> P b `] THEN +ONCE_REWRITE_TAC[ EQ_SYM_EQ] THEN +ONCE_REWRITE_TAC[ SET_RULE ` {x, y, z, v0} = {v0,y,z,x} `] THEN +REWRITE_TAC[CARD4; GSYM CARD3] THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +REWRITE_TAC[MESON[]` a = b ==> P a <=> a = b ==> P b `] THEN +REWRITE_TAC[IMP_IMP] THEN PHA THEN +REWRITE_TAC[MESON[]` (! a b. P a b ) /\l <=> l/\(!a b. P a b)`] THEN +PHA THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +REWRITE_TAC[CARD3] THEN +NHANH (SET_RULE ` ~(aa = bb \/ bb = z' \/ z' = aa) /\ + (!x' y'. + ~({x', y'} = {aa, bb}) /\ {x', y'} SUBSET {aa, bb, z'} + ==> P x' y') ==> + P bb z' /\ P z' aa `) THEN +PHA THEN +REWRITE_TAC[MESON[CARD4]` ~(v0 IN {aa, bb, z'}) /\ + ~(aa = bb \/ bb = z' \/ z' = aa) /\ l <=> CARD {v0,aa,bb,z'} = 4 /\ l `] THEN +ONCE_REWRITE_TAC[ SET_RULE ` {v0, aa, bb, z'} = {v0,bb,z',aa}`] THEN +SIMP_TAC[SET_RULE ` {y,z,x} = {x,y,z} `] THEN +REWRITE_TAC[ GSYM d3; GSYM db_t0] THEN +REWRITE_TAC[ GSYM d3; GSYM db_t0; SET2_SU_EX] THEN +REWRITE_TAC[MESON[]` (aa IN {x, y, z} /\ bb IN {x, y, z}) /\a1 /\a2 /\ + &2 * t0 < d3 aa bb /\a3 /\ a4 /\ a5 /\ l <=> (aa IN {x, y, z} /\ bb IN {x, y, z} + /\ a5 /\ &2 * t0 < d3 aa bb) /\ a1 /\ a2 /\ a3 /\ a4 /\ l `] THEN +NHANH (SPEC_ALL DIAGONAL_BARRIER) THEN +NHANH (SPEC_ALL DIA_OF_QUARTER) THEN +REWRITE_TAC[ GSYM LEFT_AND_EXISTS_THM] THEN +PHA THEN +REWRITE_TAC[MESON[]` d3 aa bb <= sqrt (&8) /\ l <=>l/\d3 aa bb <= sqrt (&8)`] THEN +REWRITE_TAC[MESON[]` a = b /\ P b <=> a = b /\ P a`] THEN +PHA THEN REWRITE_TAC[MESON[]` ~ ( a INTER b = {}) /\ l <=> l/\ ~ ( a INTER b = {})`] + THEN PHA THEN +REWRITE_TAC[SET_RULE` v0 IN s /\ + a1 /\ + {aa, bb, z'} SUBSET s /\ + CARD {v0, aa, bb, z'} = 4 /\ + l /\ + las <=> + l /\ a1 /\ CARD {v0, aa, bb, z'} = 4 /\ {v0, bb, z', aa} SUBSET s /\ las`] THEN +ONCE_REWRITE_TAC[MESON[SET_RULE ` {v0, aa, bb, z'} = {v0,bb,z',aa}`]` CARD {v0, aa, bb, z'} =4 + <=> CARD {v0,bb,z',aa} = 4 `] THEN +ONCE_REWRITE_TAC[INTER_COMM] THEN +ONCE_REWRITE_TAC[MESON[SET_RULE ` {a,b,c} = {b,c,a}`]` + conv {a,b,c} = conv {b,c,a} `] THEN +ONCE_REWRITE_TAC[MESON[D3_SYM]` d3 aa bb <= sqrt (&8) <=> d3 bb aa <= sqrt (&8)`] THEN +NHANH (SPEC_ALL CEWWWDQ) THEN +NHANH (REAL_ARITH ` a < b ==> a <= b `) THEN +ONCE_REWRITE_TAC[MESON[]` ( a/\ b ) /\ c <=> c /\ b /\ a `] THEN +PHA THEN +NHANH (MESON[IMP_QUA; D3_SYM]` packing s /\ + CARD {v0, bb, z', aa} = 4 /\ + {v0, bb, z', aa} SUBSET s /\ + d3 bb z' <= &2 * t0 /\ + d3 z' aa <= &2 * t0 /\ + d3 bb aa <= sqrt (&8) /\ a2 /\ + (!x. x IN {bb, z', aa} ==> &2 <= d3 x v0 /\ d3 x v0 <= &2 * t0) /\ + &2 * t0 <= d3 aa bb /\ a1 ==> quarter {v0, bb, z', aa} s`) THEN +REWRITE_TAC[MESON[]`( ? a. P a ) /\ l <=> l /\ (?a. P a) `] THEN +REWRITE_TAC[barrier; IN_ELIM_THM] THEN +REWRITE_TAC[MESON[]` P b /\ a = b <=> a = b /\ P a `] THEN +REWRITE_TAC[GSYM LEFT_AND_EXISTS_THM] THEN +PHA THEN +REWRITE_TAC[MESON[]`( a < b /\ l <=> l /\ a < b ) /\ + ( ( x \/ y ) /\ z <=> z /\ ( x \/ y ))`] THEN +REWRITE_TAC[ MESON[]` a IN s /\ b /\ c <=> c /\ a IN s /\ b `] THEN +NHANH (SPEC_ALL QUA_TRI_EDGE) THEN +PHA THEN +REWRITE_TAC[MESON[real_lt]`&2 * t0 < d3 aa bb /\ + (a1 /\ (!a b. a IN s /\ b IN s ==> d3 a b <= &2 * t0) \/ a2) /\ + aa IN s /\ + bb IN s <=> + &2 * t0 < d3 aa bb /\ a2 /\ aa IN s /\ bb IN s`] THEN +NHANH (SPEC_ALL CASES_OF_Q_SYS) THEN +REWRITE_TAC[LEFT_AND_EXISTS_THM] THEN +KHANANG THEN +NHANH (MESON[SET_RULE ` a IN s ==> a IN ( s UNION t )`; QUA_RE_TE_EDGE]` + quasi_reg_tet ({x, y, z} UNION {v4}) s /\ + aa IN {x, y, z} /\ + bb IN {x, y, z} ==> d3 aa bb <= &2 * t0 `) THEN +DAO THEN +REWRITE_TAC [REAL_ARITH ` a <= b <=> ~( b < a ) `] THEN +REWRITE_TAC[MESON[]`(?v4. ~(&2 * t0 < d3 aa bb) /\ P v4 \/ Q v4) /\ a1 /\ &2 * t0 < d3 aa bb <=> + (?v4. Q v4) /\ a1 /\ &2 * t0 < d3 aa bb`] THEN +REWRITE_TAC[LEFT_AND_EXISTS_THM] THEN +PHA THEN +NHANH (MESON[SET_RULE` a IN s ==> a IN ( s UNION t ) `; DIAGONAL_STRICT_QUA]` + bb IN {x, y, z} /\ + aa IN {x, y, z} /\ a1 /\ + strict_qua ({x, y, z} UNION {v4}) s /\ + a2 /\ + &2 * t0 < d3 aa bb /\ l ==> diagonal aa bb ({x, y, z} UNION {v4}) s `) THEN +NHANH (MESON[strict_qua]` strict_qua q s /\ l ==> quarter q s `) THEN +PHA THEN +REWRITE_TAC[SET_RULE ` {v0, bb, z', aa} = {aa,bb,z'} UNION {v0}`] THEN +DAO THEN +REWRITE_TAC[MESON[]` a = b /\ l <=> l/\ a= b `] THEN +REWRITE_TAC[MESON[]` quarter q s /\ + &2 * t0 < d3 aa bb /\l <=> &2 * t0 < d3 aa bb /\l /\ quarter q s`] THEN +PHA THEN +REWRITE_TAC[MESON[]` quarter ({aa, bb, z'} UNION {v0}) s /\ + a1 /\ + {aa, bb, z'} = {x, y, z} /\ l <=> l /\ a1 /\ {aa, bb, z'} = {x, y, z} + /\ quarter ({x, y, z} UNION {v0}) s`] THEN +REWRITE_TAC[MESON[]` a IN Q_SYS s /\ l <=> l /\ a IN Q_SYS s`] THEN +REWRITE_TAC[MESON[]` a IN s /\ b /\ l <=>l /\ a IN s /\b `] THEN +REWRITE_TAC[ MESON[]` diagonal aa bb ({x, y, z} UNION {v4}) s /\ l <=> + l /\ diagonal aa bb ({x, y, z} UNION {v4}) s`] THEN +PHA THEN +NHANH (MESON[CONSI_OF_LE77]` quarter ({x, y, z} UNION {v0}) s /\ + aa IN {x, y, z} /\ + bb IN {x, y, z} /\ + {x, y, z} UNION {v4} IN Q_SYS s /\a1/\ + diagonal aa bb ({x, y, z} UNION {v4}) s + ==> {x, y, z} UNION {v0} IN Q_SYS s`) THEN +DAO THEN +REWRITE_TAC[GSYM RIGHT_AND_EXISTS_THM] THEN +REWRITE_TAC[MESON[SET_RULE ` {x, y, z} UNION {v0} = {y, v0, x} UNION {z} `;CASES_OF_Q_SYS]` + {x, y, z} UNION {v0} IN Q_SYS s /\ last + ==> {y, v0, x} UNION {z} IN Q_SYS s /\ + quasi_reg_tet ({y, v0, x} UNION {z}) s \/ + {y, v0, x} UNION {z} IN Q_SYS s /\ + strict_qua ({y, v0, x} UNION {z}) s`]);; + +(* ========= *) + + +let POS_EQ_INV_POS = prove(`!x. &0 < x <=> &0 < &1 / x`, GEN_TAC THEN EQ_TAC +THENL [REWRITE_TAC[MESON[REAL_LT_RDIV_0; REAL_ARITH ` &0 < &1 `]`! b. &0 < b + ==> &0 < &1 / b `];REWRITE_TAC[] THEN +MESON_TAC[MESON[REAL_LT_RDIV_0; REAL_ARITH ` &0 < &1 `]` &0 < b + ==> &0 < &1 / b `; REAL_FIELD ` &1 / ( &1 / x ) = x ` ]]);; + + +let STRIP_TR = REPEAT STRIP_TAC THEN REPEAT (FIRST_X_ASSUM MP_TAC) + THEN REWRITE_TAC[IMP_IMP] THEN PHA;; + +let INTER_DIF_EM_EX = SET_RULE `! a b. ~(a INTER b = {}) <=> (? x. x IN a /\ x IN b ) `;; + + + + +let AFF_LE_CONE =prove(` ! a b x y z. ~( conv0 {a,b} INTER conv {x,y,z} = {}) + ==> ( b IN aff_le {x,y,z} {a}) /\ ( b IN cone a {x,y,z}) `, +REWRITE_TAC[CONV_SET3; CONV0_SET2; INTER_DIF_EM_EX; IN_ELIM_THM] THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN +REWRITE_TAC[IMP_IMP] THEN PHA THEN REWRITE_TAC[MESON[]` x' = aa /\a1 + /\a2 /\a3/\a4 /\ x' = bb <=> x' = aa /\a1 /\a2 /\a3/\a4 /\ aa = bb `] +THEN REWRITE_TAC[ VECTOR_ARITH ` a + b:real^N = c <=> b = c - a`] THEN +NHANH (MESON[VECTOR_MUL_LCANCEL]` b' % b = a ==> (&1 / b') % (b' % b) + = (&1 / b') % a `) THEN REWRITE_TAC[VECTOR_MUL_ASSOC; + VECTOR_SUB_LDISTRIB; VECTOR_ADD_LDISTRIB; simp_def] THEN +NHANH (MESON[POS_EQ_INV_POS]` &0 < a ==> &0 < &1 / a `) THEN +REWRITE_TAC[VECTOR_ARITH ` a - b % x = a + ( -- b ) % x `] THEN +MP_TAC (REAL_FIELD `! b. &0 < b ==> &1 / b * b = &1 `) THEN +REWRITE_TAC[IMP_IMP] THEN PHA THEN REWRITE_TAC[REAL_ARITH ` a / b * c += (a * c) / b`; REAL_MUL_LID; VECTOR_ARITH ` a - b % x = a + (--b) % x `] THEN +REWRITE_TAC[REAL_ARITH ` -- ( a / b ) = ( -- a ) / b `] THEN +NHANH (MESON[REAL_ARITH ` a / m + b / m + c / m + d / m = ( a + b + c + d ) / m `]` + b' / b' % b = (a'' / b' % x + b'' / b' % y + c / b' % z) + --a' / b' % a + ==> a'' / b' + b'' / b' + c / b' + -- a' / b' = ( a'' + b'' + c + -- a' ) / b' `) + THEN NHANH (MESON[REAL_ARITH ` a' + b' = &1 /\ a'' + b'' + c = &1 + ==> a'' + b'' + c + --a' = b' `]` a' + b' = &1 /\a1 /\a2 /\a3 /\a4 /\ + a'' + b'' + c = &1 /\ l ==> a'' + b'' + c + --a' = b'`) THEN +MP_TAC (REAL_ARITH ` ! a. a < &0 ==> a <= &0 `) THEN REWRITE_TAC[ IN_ELIM_THM] + THEN NHANH (MESON[]`(!b. &0 < b ==> b / b = &1) /\ --a' / b' < &0 /\ + &0 < a' /\ &0 < &1 / a' /\ &0 < b' /\ l ==> b' / b' = &1 `) THEN +REWRITE_TAC[MESON[] ` a /\ b' / b' = &1 ==> l <=> b' / b' = &1 ==> a ==> l`] THEN +SIMP_TAC[VECTOR_MUL_LID] THEN PHA THEN NHANH (MESON[REAL_LT_DIV] +` &0 < a' /\ &0 < &1 / a' /\ &0 < b' /\ l ==> &0 < a' / b' `) THEN +REWRITE_TAC[REAL_ARITH ` &0 < a' / b' <=> --a' / b' < &0 `] THEN +REWRITE_TAC[ MESON[]` a = x / y /\ x = y <=> a = y/ y /\ x = y `] THEN +REWRITE_TAC[ VECTOR_ARITH ` ((a:real^N) + b ) + c = a + b + c `] THEN +STRIP_TR THENL [MESON_TAC[VECTOR_MUL_LID]; +REWRITE_TAC[cone; GSYM aff_ge_def; simp_def; IN_ELIM_THM]] THEN +MP_TAC VECTOR_MUL_LID THEN SIMP_TAC[VECTOR_ARITH ` a + b + c + (d:real^N) + = b + c + d + a `] THEN REWRITE_TAC[MESON[]` &0 <= a /\ l <=> l /\ &0 <= a `] + THEN SIMP_TAC[ REAL_ARITH ` a + b + c + d = b + c + d + a `] THEN +REWRITE_TAC[ MESON[]` &0 < a /\ l <=> l /\ &0 < a `] THEN PHA THEN +NHANH (MESON[REAL_ARITH ` &0 < b ==> &0 <= b `; REAL_LE_DIV]` &0 <= c /\ + &0 <= b'' /\ &0 <= a'' /\ &0 < b' /\ &0 < a' ==> +&0 <= a'' / b' /\ &0 <= b''/ b' /\ &0 <= c/ b' `) THEN +NHANH (MESON[REAL_FIELD ` &0 < b' ==> b' / b' = &1 `]`(&0 <= c /\ &0 +<= b'' /\ &0 <= a'' /\ &0 < b' /\ &0 < a') ==> b' / b' = &1 `) THEN +REWRITE_TAC[ MESON[]` a / a = &1 /\ l <=> l /\ a / a = &1 `] THEN DAO THEN +REWRITE_TAC[IMP_IMP] THEN REWRITE_TAC[ MESON[]`b' / b' = &1 /\ &0 < a' /\ + &0 < b' /\ l <=> &0 < a' /\ l /\ &0 < b' /\ b' / b' = &1 `] THEN +REWRITE_TAC[ MESON[]` a = (b:real^N) /\ l <=> l /\ b = a `] THEN +PHA THEN REWRITE_TAC[ MESON[]` aaa = b' / b' % b /\ &0 < b' /\ + b' / b' = &1 <=> &0 < b' /\ b' / b' = &1 /\ aaa = &1 % b `] +THEN REWRITE_TAC[ VECTOR_MUL_LID] THEN MESON_TAC[]);; + + +let NOVE30 = prove(`! P l. ( ! x y z i j k s. ( P x y z i j k s <=> P y x z j i k s) + /\ ( l x y z <=> l y x z ) ) /\ (! x y z i j k s. i <= j /\ P x y z i j k s ==> +l x y z ) ==> (! x y z i j k s. P x y z i j k s ==> l x y z ) `, +ONCE_REWRITE_TAC[ MESON[]` a ==> (!x y z i j k s. P x y z i j k s ==> l x y z) <=> + (a ==> (!x y z i j k s. i <= j /\ P x y z i j k s ==> l x y z)) /\(a ==> + (!x y z i j k s. ~(i <= j) /\ P x y z i j k s ==> l x y z)) `] THEN REPEAT +GEN_TAC THEN +CONJ_TAC THENL [MESON_TAC[]; MESON_TAC[REAL_ARITH ` ~( a <= b ) ==> b <= a `]]);; + + + +let NOVE31 = prove(`! P l. ( ! x y z i j k s. ( P x y z i j k s <=> P z y x k j i s ) + /\ ( l x y z <=> l z y x ) ) /\ (! x y z i j k s. i <= j /\ i <= k /\ P x y z i j k s + ==> l x y z ) ==> (! x y z i j k s. i <= j /\ P x y z i j k s ==> l x y z ) `, +ONCE_REWRITE_TAC[ MESON[]` a ==> (!x y z i j k s. P x y z i j k s ==> l x y z) <=> + (a ==> (!x y z i j k s. i <= k /\ P x y z i j k s ==> l x y z)) /\(a ==> + (!x y z i j k s. ~(i <= k) /\ P x y z i j k s ==> l x y z)) `] THEN REPEAT +GEN_TAC THEN CONJ_TAC THENL [MESON_TAC[]; MESON_TAC[REAL_LE_TRANS; +REAL_ARITH ` ~( a <= b ) ==> b <= a `]]);; + + + + +let IMP_IN_BA = prove(`! x y z a s. {x,y,z} UNION {a} IN Q_SYS s ==> {x,y,z} IN barrier s `, +REWRITE_TAC[barrier; IN_ELIM_THM] THEN MESON_TAC[]);; + + + +let IMP_IN_AFF4 = prove(` ! s v0 xx x y z. xx IN cone v0 {x, y, z} /\ + ~(xx IN UNIONS {aff_ge {v0} {v1, v2} | v1,v2 | barrier s {v0, v1, v2}}) /\ + {v0, x, y, z} IN Q_SYS s ==> xx IN aff_gt {v0} {x, y, z}`, +REWRITE_TAC[cone; GSYM aff_ge_def; simp_def; IN_ELIM_THM] THEN +REPLICATE_TAC 3 GEN_TAC THEN REWRITE_TAC[MESON[]` ( ! x y z. (? s i j k. + P s i j k x y z ) /\ Q x y z ==> l x y z) <=> ( ! x y z i j k s. +P s i j k x y z /\ Q x y z ==> l x y z ) `] THEN MATCH_MP_TAC NOVE30 THEN +CONJ_TAC THENL [MESON_TAC[PER_SET3; REAL_ARITH ` a + b + c = b + a + c ` ; + VECTOR_ARITH `(a:real^N ) + b + c = b + a + c `]; MATCH_MP_TAC NOVE31 THEN +CONJ_TAC]THENL [MESON_TAC[PER_SET3; REAL_ARITH ` a + b + c = c + b + a ` ; + VECTOR_ARITH `(a:real^N ) + b + c = c + b + a `]; PHA] THEN +REWRITE_TAC[MESON[REAL_ARITH ` &0 <= i <=> i = &0 \/ &0 < i `]` + &0 <= i /\ &0 <= j /\ &0 <= k /\ l <=> ( i = &0 \/ &0 < i ) /\ &0 <= j /\ + &0 <= k /\ l `] THEN KHANANG THEN REPEAT GEN_TAC THEN +STRIP_TAC THENL [REPEAT (FIRST_X_ASSUM MP_TAC) THEN REPLICATE_TAC 3 DISCH_TAC + THEN REWRITE_TAC[IMP_IMP] THEN ASM_SIMP_TAC[] THEN REWRITE_TAC[VECTOR_MUL_LZERO; +VECTOR_ADD_LID; REAL_ADD_LID] THEN REWRITE_TAC[SET_RULE ` {v0, x, y, z} = {v0,y,z} + UNION {x} `] THEN NHANH (SPEC_ALL IMP_IN_BA) THEN REWRITE_TAC[IN_UNIONS; +IN_ELIM_THM] THEN REWRITE_TAC[MESON[IN]` barrier s a /\ l <=> a IN barrier s /\ +l`] THEN PHA THEN REWRITE_TAC[MESON[]` (? t. (? v1 v2 . P v1 v2 /\ t = Q v1 v2 ) +/\ xx IN t ) <=> (? v1 v2. P v1 v2 /\ xx IN Q v1 v2 ) `] THEN REWRITE_TAC[IN_ELIM_THM] + THEN MESON_TAC[]; STRIP_TR THEN REWRITE_TAC[MESON[REAL_ARITH ` i <= j /\ &0 < i +==> &0 < j `]` i <= j /\ i <= k /\ &0 < i /\l <=> i <= j /\ i <= k /\ &0 < j /\ + &0 < k /\ &0 < i /\ l`] THEN MESON_TAC[]]);; + + + + + +let VORO2_EX =prove(`! v0 s. voro2 v0 s = {x | (!w. s w /\ ~(w = v0) ==> + d3 x v0 < d3 x w) /\ d3 x v0 < &2} `, REWRITE_TAC[voro2; voronoi; d3 ] + THEN SET_TAC[]);; + + + +let LEMMA81 = prove(`!(X:real^3 -> bool) Z s v0:real^3 . + centered_pac s v0 /\ + Z = UNIONS {aff_ge {v0} {v1, v2} | v1,v2 | {v0, v1, v2} IN barrier s} /\ + X = UNIONS + {aff_gt {v0} {v1, v2, v3} INTER + aff_le {v1, v2, v3} {v0} INTER + voro2 v0 s | v1,v2,v3 | {v0, v1, v2, v3} IN Q_SYS s} + ==> voro2 v0 s SUBSET X UNION Z UNION VC v0 s`, +REPEAT GEN_TAC THEN ONCE_REWRITE_TAC[SET_RULE ` as SUBSET a UNION b UNION c <=> +( as DIFF (b UNION c)) SUBSET a`] THEN REWRITE_TAC[SUBSET; IN_DIFF; IN_UNION; + VC; lambda_x; IN_ELIM_THM; voro2;voronoi; GSYM d3; DE_MORGAN_THM; centered_pac] + THEN ABBREV_TAC ` ketluan x = ((x:real^3) IN (X:real^3 -> bool))` THEN SIMP_TAC[] + THEN PHA THEN REWRITE_TAC[MESON[]` a /\b/\e/\c==>d <=> c ==> a/\b/\e==>d`] THEN + DISCH_TAC THEN REWRITE_TAC[GSYM (MESON[]` a /\b/\e/\c==>d <=> c ==> a/\b/\e==>d`)] +THEN REWRITE_TAC[MESON[trg_d3_sym]` d3 x v0 < &2 /\ aa/\ + ((~(d3 v0 x < &2) \/ l) \/ l') <=> d3 x v0 < &2 /\ aa/\ (l\/ l')`; IN] THEN +PHA THEN REWRITE_TAC[MESON[]` (!w. s w /\ ~(w = v0) ==> d3 x v0 < d3 x w) /\ + aa /\ bb /\ (cc \/ ~(!w. s w /\ dd w /\ ee w /\ ~(w = v0) ==> d3 x v0 < d3 x w)) <=> + (!w. s w /\ ~(w = v0) ==> d3 x v0 < d3 x w) /\ aa /\ bb /\ cc`] THEN +REWRITE_TAC[obstruct] THEN ONCE_REWRITE_TAC[BAR_TRI] THEN +REWRITE_TAC[ MESON[]`(?bar. (?x y z. bar = {x, y, z} /\ P {x, y, z}) /\ Q bar) <=> + (?x y z. P {x, y, z} /\ Q {x, y, z})`] THEN NHANH (MESON[]` ~(conv0 {v0, x} INTER +conv {x', y, z} = {}) ==> v0 IN {x' ,y,z} \/ ~( v0 IN {x', y,z})`) THEN KHANANG THEN +NHANH (MESON[IN_SET3; SET_RULE` x = a ==> {x,b,c} = {a,b,c} /\ {x,b,c} = {b,c,a} /\ + {x,b,c} = {b,a,c} `]` x IN {a,b,c} ==> (? yy zz. {x,yy,zz} = {a,b,c})`) THEN +REWRITE_TAC[EXISTS_OR_THM] THEN NGOAC THEN REWRITE_TAC[MESON[]`(?x' y z. P {x', y, z} +/\ (?yy zz. {x, yy, zz} = {x', y, z})) <=> (?y z. P {x, y, z})`] THEN +NHANH (CUTHE4 IN_AFF_GE_CON) THEN PHA THEN +REWRITE_TAC[SET_RULE` ~UNIONS {aff_ge {v0} {v1, v2} | v1,v2 | barrier s {v0, v1, v2}} x /\ +((?y z. {v0, y, z} IN barrier s /\ aaa y z /\ x IN aff_ge {v0} {y, z} /\ + bbb y z) \/ last) <=> ~UNIONS {aff_ge {v0} {v1, v2} | v1,v2 | barrier s {v0, v1, v2}} x /\ + last`] THEN REWRITE_TAC[DE_MORGAN_THM] THEN SIMP_TAC[GSYM NOV20] THEN +REWRITE_TAC[d3; GSYM IN_VO_EQ] THEN NHANH (MESON[X_IN_VOR_X; VORONOI_CONV]` x IN voronoi v0 s + ==> v0 IN voronoi v0 s /\ convex (voronoi v0 s )`) THEN +NHANH (MESON[CONVEX_IM_CONV02_SU ]` x IN voronoi v0 s /\ v0 IN voronoi v0 s /\ + convex (voronoi v0 s) ==> conv0 {v0,x} SUBSET voronoi v0 s `) THEN PHA THEN +DISCH_TAC THEN GEN_TAC THEN STRIP_TAC THENL [REPEAT (FIRST_X_ASSUM MP_TAC) THEN +REWRITE_TAC[ IMP_IMP] THEN PHA THEN NHANH (SET_RULE` conv0 {v0, x} SUBSET voronoi v0 s +/\a1 /\a2 /\a3 /\ ~(conv0 {v0, x} INTER conv {x', y, z} = {}) /\ l ==> + ~( voronoi v0 s INTER conv {x', y, z} = {})`) THEN NHANH (MESON[FOUR_POINTS] +` {x', y, z} IN barrier s /\ a1 /\ ~(v0 IN {x', y, z}) ==> CARD {x',y,z, v0} = 4 `) + THEN PHA THEN NHANH (SET_RULE ` conv0 {v0, x} SUBSET s /\ a1 /\a2 /\a3 /\ + ~(conv0 {v0, x} INTER s1 = {}) /\ l ==> ~( s INTER s1 = {}) `) THEN PHA THEN +REWRITE_TAC[MESON[]`( s x /\ l <=>l/\ s x)/\ (a IN barrier s /\ l <=> + l /\ a IN barrier s) `] THEN NHANH (SPEC_ALL (REWRITE_RULE[CONV3_EQ] IN_AFF_GE_CON)) + THEN PHA THEN REWRITE_TAC[SET_RULE ` ~UNIONS {aff_ge {v0} {v1, v2} | v1,v2 | + barrier s {v0, v1, v2}} x /\ a1 /\ x IN aff_ge {v0} {y, z} /\ + a2 /\ a3/\ {v0, y, z} IN barrier s /\ a4 <=> F `] ; REPEAT (FIRST_X_ASSUM MP_TAC)] + THEN REWRITE_TAC[ IMP_IMP] THEN PHA THEN +NHANH (SET_RULE` conv0 {v0, x} SUBSET voronoi v0 s /\a1 /\a2 /\a3 /\ + ~(conv0 {v0, x} INTER conv {x', y, z} = {}) /\ l ==> + ~( voronoi v0 s INTER conv {x', y, z} = {})`) THEN +NHANH (MESON[FOUR_POINTS]` {x', y, z} IN barrier s /\ a1 /\ + ~(v0 IN {x', y, z}) ==> CARD {x',y,z, v0} = 4 `) THEN PHA THEN NHANH (SET_RULE ` + conv0 {v0, x} SUBSET s /\ a1 /\a2 /\a3 /\ ~(conv0 {v0, x} INTER s1 = {}) /\ l +==> ~( s INTER s1 = {}) `) THEN PHA THEN REWRITE_TAC[MESON[]`( s x /\ l <=>l/\ + s x)/\ (a IN barrier s /\ l <=> l /\ a IN barrier s) `] THEN PHA THEN +NHANH (MESON[IMP_IN_Q_SYS; IN]` CARD {x', y, z, v0} = 4 /\ + ~(voronoi v0 s INTER conv {x', y, z} = {}) /\ {x', y, z} IN barrier s /\ + s v0 ==> {v0,x',y,z} IN Q_SYS s `) THEN NHANH (SPEC_ALL AFF_LE_CONE) THEN PHA THEN +ONCE_REWRITE_TAC[MESON[IN] ` ~ UNIONS s x <=> ~ ( x IN UNIONS s ) `] THEN +ONCE_REWRITE_TAC[MESON[]` a1 /\a /\ b /\ x IN cone v0 {x', y, z} /\ l <=>a /\ b /\ l /\ + x IN cone v0 {x', y, z} /\ a1 `] THEN PHA THEN REWRITE_TAC[MESON[]` a IN Q_SYS s /\ + b /\ c <=> b /\ c /\ a IN Q_SYS s`] THEN NHANH (SPEC_ALL IMP_IN_AFF4) THEN +NGOAC THEN REWRITE_TAC[MESON[]` (a /\ b ) /\ x IN aff_gt {v0} {x', y, z} <=> + x IN aff_gt {v0} {x', y, z}/\ b/\ a `] THEN PHA THEN DAO THEN +REWRITE_TAC[GSYM VORO2_EX] THEN REWRITE_TAC[prove(`dist (x,v0) < &2 /\a1/\a2/\a3 /\ +x IN voronoi v0 s /\ l <=> a1/\a2/\a3 /\ l /\ x IN voro2 v0 s`, REWRITE_TAC[GSYM d3; + voro2; IN_ELIM_THM] THEN MESON_TAC[])] THEN REWRITE_TAC[MESON[]`x IN aff_le a s /\ + l <=> l /\ x IN aff_le a s `] THEN DAO THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +SIMP_TAC[] THEN ONCE_REWRITE_TAC[MESON[]` (! x. P x ) /\ a = b /\ l <=> b = a /\ l /\ + (! x . P x )`] THEN SIMP_TAC[] THEN MATCH_MP_TAC (MESON[]` ( a1 /\a2/\a3/\a4 ==> l ) +==> ( a1/\a2/\a3/\a4/\a5 ==> l ) `) THEN REWRITE_TAC[IN_UNIONS; IN_ELIM_THM] THEN +REWRITE_TAC[ MESON[]` (?t. (? a b c. P a b c /\ t = Q a b c ) /\ x IN t ) + <=> (? a b c. P a b c /\ x IN Q a b c ) `] THEN REWRITE_TAC[IN_INTER] THEN +SET_TAC[]);; diff --git a/legacy/oldleg/hull.ml b/legacy/oldleg/hull.ml new file mode 100644 index 0000000..f615175 --- /dev/null +++ b/legacy/oldleg/hull.ml @@ -0,0 +1,131 @@ +(*VUONG ANH QUYEN *) +(* DEFINITIONS OF AFFINE HULL. *) +(* ==================================================================== *) + +(* -------------------------------------------------------------------- *) +(* Two ways to define affine set & affine hull. *) +(* -------------------------------------------------------------------- *) + +(* Define as in convex.ml *) +(* -------------------------------------------------------------------- *) + +(* Define using affine combination *) +(* -------------------------------------------------------------------- *) + +let affine_comb = new_definition `!(s:real^N->bool). affine_comb s = ! (n:num) (t:num->real) (v:num->real^N). + ( sum (1..n) (\i. t i) = &1)/\(!i. ((1..n) i) ==>(s (v i))) + ==> (s (vsum (1..n) (\i. (t i) % (v i))))`;; + +let aff_comb = new_definition `! (S:real^N -> bool) (w:real^N). aff_comb S w =( + ? (n:num) (t:num->real) (v:num->real^N). + ( sum (1..n) (\i. t i) = &1 ) /\ + (w = vsum (1..n) (\i. (t i) % (v i)))/\ (!i. ((1..n) i) ==> (S (v i))) )`;; + +(* Some simple properties of affine, aff, affine_comb, aff_comb, hull *) +(* -------------------------------------------------------------------- *) + +let affine_INTERS = prove + ( `(!s. s IN f ==> affine s) ==> affine(INTERS f)`, + (REWRITE_TAC[affine;INTERS;IN;IN_ELIM_THM] THEN MESON_TAC[]));; + +let affine_aff = prove + ( `!(s:real^N->bool). affine (aff s)`, + (GEN_TAC THEN REWRITE_TAC[aff] THEN MESON_TAC[affine_INTERS;P_HULL]));; + +let aff_affine = prove + ( `!s. affine S ==> aff S = S`, + (SIMP_TAC[HULL_EQ;aff;affine_INTERS]));; + +let SUBSET_hull = prove + (`! s P. s SUBSET (P hull s)`, + REPEAT GEN_TAC THEN REWRITE_TAC[SUBSET;hull;IN_INTERS] THEN SET_TAC[]);; + +let SUBSET_aff = prove + ( `!(S:real^N->bool). S SUBSET aff S`, MESON_TAC [SUBSET;aff;SUBSET_hull]);; + +let SUBSET_affcomb = prove +(`!(S:real^N->bool). S SUBSET (aff_comb S)`, +GEN_TAC THEN REWRITE_TAC[SUBSET;IN;aff_comb] THEN GEN_TAC THEN STRIP_TAC THEN +EXISTS_TAC `1` THEN EXISTS_TAC `(\(i:num). &1)` THEN EXISTS_TAC `(\(i:num). x:real^N)` THEN +ASM_SIMP_TAC[SUM_SING_NUMSEG;NUMSEG_SING;VSUM_SING;VECTOR_MUL_LID;IN;IN_SING]);; + +let aff_SUBSET = prove + (`!A B. A SUBSET B ==> aff A SUBSET aff B`, + (REPEAT GEN_TAC THEN + REWRITE_TAC [aff; hull;SUBSET;IN;INTERS;IN_INTERS;IN_ELIM_THM] THEN MESON_TAC[]));; + +let INTERS_SUBSET = prove +(`!(S:(A->bool)->bool) (u:A->bool). u IN S ==> (INTERS S) SUBSET u`, + REPEAT GEN_TAC THEN REWRITE_TAC[SUBSET;IN_INTERS] THEN MESON_TAC[]);; + +let hull_SUBSET = prove +( `!(P:(A->bool)->bool) (S:A->bool) (u:A->bool). (S SUBSET u)/\(P u) ==> (P hull S) SUBSET u`, + REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[hull] THEN MATCH_MP_TAC (INTERS_SUBSET) THEN + ASM_REWRITE_TAC[IN;IN_ELIM_THM]);; + +(* Some lemmas need using *) +(* --------------------------------------------------------------- *) + + +(* VSUM_2 -> hull_error.ml *) + +let REAL_OF_NUM_NOT_EQ = prove + ( `!n m. ~(m = n) <=> ~(&m = &n)`, MESON_TAC[REAL_OF_NUM_EQ]);; + +let VMUL_CASES = prove + (`!(P:A->bool) (t:A->real) (t':A->real) (v:A->real^N) (v':A->real^N). (if P i then t i else t' i) % (if P i then v i else v' i) = (if P i then ( t i % v i) else (t' i % v' i))`, + REPEAT GEN_TAC THEN REPEAT COND_CASES_TAC THEN ASM_MESON_TAC[]);; + +(* Relation between affine and affine_comb *) +(* --------------------------------------------------------------- *) + +(* affcomb_imp_aff -> hull_error.ml *) + + +let comb_trans = prove ( + `! (n:num) (t:num->real) (v:num->real^N). +~(n=0)/\(sum (1..n+1) (\i. t i) = &1)==> +(vsum (1..n+1) (\i. (t i) % (v i)) = vsum (1..n) (\i. (&1 / &n) % ((&n * (t i)) % (v i) + (&1 - &n * (t i)) % (v (n+1)))))`, + REPEAT GEN_TAC THEN + REWRITE_TAC[ REAL_OF_NUM_NOT_EQ;VSUM_CMUL_NUMSEG; VECTOR_ADD_LDISTRIB;VSUM_ADD_NUMSEG] THEN + REWRITE_TAC[GSYM VSUM_CMUL_NUMSEG; VECTOR_MUL_ASSOC;REAL_MUL_ASSOC;REAL_SUB_LDISTRIB] THEN + STRIP_TAC THEN (FIRST_ASSUM (MP_TAC o MATCH_MP REAL_DIV_RMUL)) THEN STRIP_TAC THEN + ASM_REWRITE_TAC[REAL_MUL_LID;REAL_MUL_RID] THEN + REWRITE_TAC[MATCH_MP VSUM_CLAUSES_RIGHT (ARITH_RULE ` (0 < (n+1))/\(1 <= (n+1))`)] THEN + ASM_REWRITE_TAC[ ARITH_RULE `! (n:num). (n + 1)-1 = n`;VSUM_RMUL] THEN + ASM_REWRITE_TAC[SUM_CONST_NUMSEG;SUM_SUB_NUMSEG;REAL_MUL_SYM; ARITH_RULE `(n+1) -1 = n`] THEN + (UNDISCH_TAC `sum (1..n + 1) (\i. t i) = &1`) THEN + ASM_REWRITE_TAC [MATCH_MP SUM_CLAUSES_RIGHT (ARITH_RULE ` (0 < (n+1))/\(1 <= (n+1))`);ARITH_RULE `(n+1) - 1 = n`] THEN + STRIP_TAC THEN + FIRST_ASSUM (MP_TAC o MATCH_MP (ARITH_RULE ` (a + b= &1) ==> (&1 - a = b)`)) THEN REWRITE_TAC[ETA_AX] THEN + MESON_TAC[vsum]);; + + + +(* aff_imp_affcomb -> hull_error.ml *) + + +(* The equality between two ways of defining, aff & aff_comb *) +(* ------------------------------------------------------------------*) + +(* affine_affcomb -> hull_error.ml *) + +(* aff_eq_affcomb -> hull_error.ml *) + +(* convex, added by thales *) + +let conv0pt = prove(`conv {} = {}:real^A->bool`, + REWRITE_TAC[conv;sgn_ge;affsign;UNION_EMPTY;FUN_EQ_THM;elimin NOT_IN_EMPTY;lin_combo;SUM_CLAUSES] + THEN REAL_ARITH_TAC);; + +let conv1pt = prove(`!u. conv {u:real^A} = {u}`, + REWRITE_TAC[conv;sgn_ge;affsign;FUN_EQ_THM;UNION_EMPTY;lin_combo;SUM_SING;VSUM_SING;elimin IN_SING] THEN + REPEAT GEN_TAC THEN + REWRITE_TAC[TAUT `(p <=> q) = ((p ==> q) /\ (q ==> p))`] THEN + REPEAT STRIP_TAC THENL + [ASM_MESON_TAC[VECTOR_MUL_LID]; + ASM_REWRITE_TAC[]] THEN + EXISTS_TAC `\ (v:real^A). &1` THEN + MESON_TAC[VECTOR_MUL_LID;REAL_ARITH `&0 <= &1`] + );; + diff --git a/legacy/oldleg/hull_error.ml b/legacy/oldleg/hull_error.ml new file mode 100644 index 0000000..975dcdb --- /dev/null +++ b/legacy/oldleg/hull_error.ml @@ -0,0 +1,149 @@ +(* The following lemmas were removed from hull.ml on + November 11, 2008 by T Hales, because the proofs are in error. + They can be returned to hull.ml when the proofs are corrected. +*) + + +let VSUM_2 = prove + ( `! (v:num->real^N). vsum (1..2) v = (v 1) + (v 2)`, + GEN_TAC THEN REWRITE_TAC[vsum; SUM_2] THEN VECTOR_ARITH_TAC);; + + +let affcomb_imp_aff = prove + ( `!(S:real^N->bool). affine_comb S ==> affine S`, + GEN_TAC THEN REWRITE_TAC[affine;affine_comb] THEN STRIP_TAC THEN REPEAT GEN_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`2`;`(\i. if (i=1) then t else (&1-t))`;`(\i. if (i=1) then (u:real^N) else (v:real^N))`]) + THEN SIMP_TAC[SUM_2;VSUM_2;ARITH_RULE `~(1=2)/\(!t. t + (&1 - t) = &1)`] THEN MESON_TAC[]);; + + +let aff_imp_affcomb = prove +( `!(S:real^N->bool). affine S ==> affine_comb S`, +GEN_TAC THEN REWRITE_TAC[affine;affine_comb] THEN +DISCH_THEN (LABEL_TAC "1") THEN INDUCT_TAC THENL +[ SIMP_TAC[SUM_CLAUSES_NUMSEG; ARITH_RULE `~(1=0) /\ ~ ( &1 = &0)`]; ALL_TAC ] THEN +REPEAT GEN_TAC THEN REWRITE_TAC[ADD1] THEN ASM_CASES_TAC `( n = 0)` THENL +[ ASM_SIMP_TAC[ARITH_RULE `0+1=1`] THEN REWRITE_TAC[SUM_SING_NUMSEG;NUMSEG_SING;VSUM_SING] THEN +STRIP_TAC THEN ASM_SIMP_TAC[VECTOR_MUL_LID] THEN FIRST_ASSUM (MATCH_MP_TAC o SPEC `1`) THEN +REWRITE_TAC[IN_SING; GSYM IN]; ALL_TAC ] THEN +DISCH_THEN(CONJUNCTS_THEN2 (LABEL_TAC "3") (LABEL_TAC "4")) THEN +UNDISCH_TAC (`sum (1..n + 1) (\i. t i) = &1`) THEN UNDISCH_TAC (`~(n=0)`) THEN +REWRITE_TAC[IMP_IMP] THEN DISCH_THEN (LABEL_TAC "5") THEN +FIRST_ASSUM(MP_TAC o (MATCH_MP comb_trans)) THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN +ABBREV_TAC `(f:num->real^N) (i:num) = (&n * (t:num->real) i) % (v:num->real^N) i + (&1 - &n * t i) % v (n + 1)` THEN +FIRST_X_ASSUM ((LABEL_TAC "6") o GSYM) THEN +ABBREV_TAC `(ts:num->real) (i:num) = &1 / &n` THEN +FIRST_X_ASSUM ((LABEL_TAC "7") o GSYM) THEN +FIRST_ASSUM(MATCH_MP_TAC o (SPECL [`(ts:num->real)`;`(f:num->real^N)`])) THEN CONJ_TAC THENL +[ ASM_REWRITE_TAC[SUM_CONST_NUMSEG; ARITH_RULE ` (n+1) - 1 = n`] THEN +USE_THEN "5" (MP_TAC o (MATCH_MP (TAUT ` A/\B ==> A`))) THEN +MESON_TAC[REAL_OF_NUM_NOT_EQ;REAL_DIV_LMUL]; GEN_TAC ] THEN ASM_REWRITE_TAC[] THEN +DISCH_THEN (LABEL_TAC "8") THEN +USE_THEN "1" (MATCH_MP_TAC o (SPECL [`(v:num->real^N) (i:num)`;`(v:num->real^N) ((n:num) +1)`;`(&n * t i):real`])) THEN +CONJ_TAC THENL +[ USE_THEN "4" (MATCH_MP_TAC o (SPEC `i:num`)) THEN UNDISCH_TAC (`(1..n) i`) THEN + REWRITE_TAC[numseg;IN_ELIM_THM] THEN ARITH_TAC; + USE_THEN "4" (MATCH_MP_TAC o (SPEC `(n+1):num`)) THEN UNDISCH_TAC (`(1..n) i`) THEN + REWRITE_TAC[numseg;IN_ELIM_THM] THEN ARITH_TAC]);; + + +let affine_affcomb = prove +( ` !(S:real^N->bool). affine(aff_comb S)`, +REWRITE_TAC[affine;aff_comb] THEN REPEAT GEN_TAC THEN STRIP_TAC THEN EXISTS_TAC `(n:num) + (n':num)` THEN +ABBREV_TAC `(ts:num->real) (i:num) = (if ((1..n) i) then ((t:real)*((t':num->real) i)) else (&1 - t)*((t'':num->real)(i - n)) )` THEN +FIRST_X_ASSUM(LABEL_TAC "ts" o GSYM) THEN +EXISTS_TAC `ts : num->real` THEN +ABBREV_TAC `(vs:num->real^N) (i:num) = (if ((1..n) i) then (v':num->real^N) i else (v'':num->real^N) (i - n) )` THEN +FIRST_X_ASSUM(LABEL_TAC "vs" o GSYM) THEN +EXISTS_TAC `vs:num->real^N` THEN REPEAT CONJ_TAC THENL +[ASM_REWRITE_TAC[GSYM (MATCH_MP SUM_COMBINE_R (ARITH_RULE `1 <= n+1 /\ n <= n+n'`))] THEN + REWRITE_TAC[MATCH_MP SUM_CASES (SPEC_ALL FINITE_NUMSEG);IN;numseg;IN_ELIM_THM] THEN +SIMP_TAC[ARITH_RULE `((1 <= i /\ i <= n) /\ ~(1 <= i /\ i <= n))= F`] THEN +SIMP_TAC[ARITH_RULE `((n + 1 <= i /\ i <= n + n')/\1 <= i /\ i <= n)= F`] THEN +SIMP_TAC[ARITH_RULE `((n + 1 <= i /\ i <= n + n') /\ ~(1 <= i /\ i <= n))= (1 + n <= i /\ i <= n' + n)`] THEN +REWRITE_TAC[EMPTY_GSPEC;SUM_CLAUSES;REAL_ADD_LID;REAL_ADD_RID;REAL_ADD_AC] THEN +REWRITE_TAC[SUM_LMUL;SUM_OFFSET;GSYM numseg] THEN +UNDISCH_TAC `sum (1..n) (\i. t' i) = &1` THEN REWRITE_TAC[ETA_AX] THEN DISCH_TAC THEN +ASM_REWRITE_TAC[ARITH_RULE `!(i:num). (i+n)-n=i`;REAL_MUL_RID] THEN ARITH_TAC; +ASM_REWRITE_TAC[VMUL_CASES] THEN REWRITE_TAC [MATCH_MP VSUM_CASES (SPECL [`1`;`n+n':num`] FINITE_NUMSEG)] THEN +REWRITE_TAC [IN;IN_ELIM_THM;numseg] THEN +REWRITE_TAC [ARITH_RULE `((1 <= i /\ i <= n + n') /\ 1 <= i /\ i <= n) = (1 <= i /\ i <= n)`] THEN +REWRITE_TAC [ARITH_RULE `((1 <= i /\ i <= n + n') /\ ~(1 <= i /\ i <= n)) = (1+n <= i /\ i <= n' + n)`] THEN +REWRITE_TAC[GSYM VECTOR_MUL_ASSOC;GSYM numseg;VSUM_LMUL;VSUM_OFFSET;ARITH_RULE `!(i:num).(i+n)-n = i`]; ALL_TAC] THEN +GEN_TAC THEN ASM_REWRITE_TAC[] THEN COND_CASES_TAC THENL +[ UNDISCH_TAC `(1..n) i` ;UNDISCH_TAC `~(1..n) i`] THEN REWRITE_TAC[IMP_IMP;IN;IN_ELIM_THM;numseg] THENL +[REWRITE_TAC[ARITH_RULE `((1 <= i /\ i <= n) /\ 1 <= i /\ i <= n + n')=(1 <= i /\ i <= n)`]; + REWRITE_TAC[ARITH_RULE `(~(1 <= i /\ i <= n) /\ 1 <= i /\ i <= n + n')=(1 <= (i - n) /\ (i-n) <= n')`]] THEN +DISCH_TAC THENL +[FIRST_ASSUM(MATCH_MP_TAC o (SPEC `i:num`));FIRST_ASSUM(MATCH_MP_TAC o (SPEC `(i-n):num`))] THEN +ASM_REWRITE_TAC[numseg;IN;IN_ELIM_THM]);; + + +let aff_eq_affcomb = prove +( `!(S:real^N->bool). aff S = aff_comb S`, +GEN_TAC THEN MATCH_MP_TAC SUBSET_ANTISYM THEN CONJ_TAC THENL +[ REWRITE_TAC[aff] THEN MATCH_MP_TAC(hull_SUBSET) THEN MESON_TAC[SUBSET_affcomb;affine_affcomb]; + REWRITE_TAC[SUBSET;IN;aff_comb] THEN REPEAT GEN_TAC THEN STRIP_TAC THEN + MP_TAC ( MATCH_MP aff_imp_affcomb (SPEC `S:real^N->bool` affine_aff)) THEN + ASM_REWRITE_TAC[affine_comb] THEN DISCH_TAC THEN + FIRST_X_ASSUM(MATCH_MP_TAC o (SPECL [`n:num`;`t:num->real`;`v:num->real^N`])) THEN + ASM_REWRITE_TAC[] THEN GEN_TAC THEN FIRST_X_ASSUM (MP_TAC o (SPEC `i:num`)) THEN + MATCH_MP_TAC(TAUT `(B==>C) ==> ((A==>B)==> A ==> C)`) THEN + MP_TAC (SPEC `S:real^N->bool` SUBSET_aff) THEN MESON_TAC [SUBSET;IN]]);; + +let aff_2 = prove (` ! (a:real^N) (b:real^N). aff {a,b} = {u| ?(t:real). u = t % a + (&1 - t) % b}`, +REPEAT GEN_TAC THEN (ABBREV_TAC `(M:real^N ->bool) = {u| ?(t:real). u = t % a + (&1 - t) % b}`) THEN +FIRST_X_ASSUM(LABEL_TAC "M" o GSYM) THEN +MATCH_MP_TAC(SUBSET_ANTISYM) THEN CONJ_TAC THENL +[ REWRITE_TAC[aff] THEN MATCH_MP_TAC(hull_SUBSET) THEN CONJ_TAC THENL + [ ASM_REWRITE_TAC[SET_RULE ` {a,b} SUBSET M <=> (a IN M /\ b IN M)`;IN_ELIM_THM;IN] THEN + CONJ_TAC THENL [EXISTS_TAC `&1`; EXISTS_TAC `&0`] THEN VECTOR_ARITH_TAC; + ASM_REWRITE_TAC[affine;IN_ELIM_THM] THEN REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + EXISTS_TAC ` t * t' + (&1- t) * t''` THEN + REWRITE_TAC[ARITH_RULE ` &1 - (t * t' + (&1 - t) * t'') = t * (&1 - t') + (&1 - t) * (&1 - t'')`] THEN + VECTOR_ARITH_TAC + ] ; + ASM_REWRITE_TAC[SUBSET;IN_ELIM_THM;IN;aff_eq_affcomb;aff_comb] THEN GEN_TAC THEN STRIP_TAC THEN + ABBREV_TAC `(ts: num ->real) i = ( if ( i = 1) then t else ( &1 - t))` THEN + FIRST_X_ASSUM(LABEL_TAC "ts" o GSYM) THEN + ABBREV_TAC `(vs: num ->real^N) i = ( if ( i = 1) then a else b)` THEN + FIRST_X_ASSUM(LABEL_TAC "vs" o GSYM) THEN + EXISTS_TAC `2` THEN EXISTS_TAC `(ts:num->real)` THEN EXISTS_TAC ` (vs:num->real^N) ` THEN + ASM_REWRITE_TAC[SUM_2;VSUM_2;ARITH_RULE `~(2=1) /\ (t + &1 - t = &1)`] THEN + GEN_TAC THEN STRIP_TAC THEN COND_CASES_TAC THEN ONCE_REWRITE_TAC[GSYM IN] THEN SET_TAC[] +]);; + + + +(* + + +let conv_insert = prove(`!S (v:real^3). + FINITE S ==> + (conv (v INSERT S) = {x | ?s t. (conv S s) /\ &0 <= t /\ t <= &1 /\ (x = t % s + (&1-t) % v)})`, + REWRITE_TAC[conv;affsign;sgn_ge;FUN_EQ_THM;lin_combo;UNION_EMPTY]; + SIMP_TAC[FINITE_INSERT;FINITE_RULES;VSUM_CLAUSES;SUM_CLAUSES]; + REPEAT STRIP_TAC; + ASM_REWRITE_TAC[elimin IN_INSERT;IN_ELIM_THM]; + REWRITE_TAC[TAUT `(p <=> q) = ((p ==> q) /\ (q ==> p))`] ; + (* *) + DISJ_CASES_TAC (TAUT `(v IN S) \/ ~((v:real^3) IN S)`);; + + REPEAT STRIP_TAC; + EXISTS_TAC `x:real^3`; + EXISTS_TAC `&1`; + ASM_REWRITE_TAC[REAL_ARITH `&0 <= (&1) /\ (&1 <= (&1)) /\ (&1 - &1 = &0)`;VECTOR_MUL_LID;VECTOR_MUL_LZERO;VECTOR_ADD_RID;]; + ASM_MESON_TAC[]; + (* 2 *) + ABBREV_TAC `g = \w. (if (w=v:real^3) then (t* f v + (&1 - t)) else t * f w)`; + EXISTS_TAC `g:real^3->real`; + CONJ_TAC; + EXPAND_TAC "g"; + ASM_REWRITE_TAC[]; + UNDISCH_TAC `FINITE (S:real^3->bool)`; + (* to here *) + + + +*) + + diff --git a/legacy/oldlocal/PQCSXWG_old.hl b/legacy/oldlocal/PQCSXWG_old.hl new file mode 100644 index 0000000..869f04b --- /dev/null +++ b/legacy/oldlocal/PQCSXWG_old.hl @@ -0,0 +1,138 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Section: Appendix *) +(* Chapter: Local Fan *) +(* Author: John Harrison *) +(* Date: 2013-07-12 *) +(* ========================================================================== *) + +module Pqcsxwg = struct + + +let mk_simplex1 = new_definition `mk_simplex1 v0 v1 v2 x1 x2 x3 x4 x5 x6 = + (let uinv = &1 / ups_x x1 x2 x6 in + let d = delta_x x1 x2 x3 x4 x5 x6 in + let d5 = delta_x5 x1 x2 x3 x4 x5 x6 in + let d6 = delta_x4 x1 x2 x3 x4 x5 x6 in + let vcross = (v1 - v0) cross (v2 - v0) in + v0 + uinv % ((&2 * sqrt d) % vcross + d5 % (v1 - v0) + d6 % (v2 - v0)))`;; + +let PQCSXWG1_concl = `!v0 v1 v2 v3 x1 x2 x3 x4 x5 x6. + &0 < x1 /\ &0 < x2 /\ &0 < x3 /\ &0 < x4 /\ &0 < x5 /\ &0 < x6 /\ + ~collinear {v0,v1,v2} /\ + x1 = dist(v1,v0) pow 2 /\ + x2 = dist(v2,v0) pow 2 /\ + x6 = dist(v1,v2) pow 2 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 /\ + v3 = mk_simplex1 v0 v1 v2 x1 x2 x3 x4 x5 x6 ==> + (x3 = dist(v3,v0) pow 2 /\ + x5 = dist(v3,v1) pow 2 /\ + x4 = dist(v3,v2) pow 2 /\ + (v1 - v0) dot ((v2 - v0) cross (v3 - v0)) > &0)`;; + +let PQCSXWG2_concl = `!(v0:real^3) v1 v2 v3 x1 x2 x3 x4 x5 x6. + &0 < x1 /\ &0 < x2 /\ &0 < x3 /\ &0 < x4 /\ &0 < x5 /\ &0 < x6 /\ + ~collinear {v0,v1,v2} /\ + x1 = dist(v1,v0) pow 2 /\ + x2 = dist(v2,v0) pow 2 /\ + x6 = dist(v1,v2) pow 2 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 /\ + v3 = mk_simplex1 v0 v1 v2 x1 x2 x3 x4 x5 x6 ==> + (\q. mk_simplex1 v0 v1 v2 x1 x2 x3 x4 q x6) continuous atreal x5`;; + +(* ------------------------------------------------------------------------- *) +(* The main result. *) +(* ------------------------------------------------------------------------- *) + +let MK_SIMPLEX_TRANSLATION = prove + (`!a v0 v1 v2 x1 x2 x3 x4 x5 x6. + mk_simplex1 (a + v0) (a + v1) (a + v2) x1 x2 x3 x4 x5 x6 = + a + mk_simplex1 v0 v1 v2 x1 x2 x3 x4 x5 x6`, + REPEAT GEN_TAC THEN REWRITE_TAC[mk_simplex1] THEN + CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN + REWRITE_TAC[VECTOR_ARITH `(a + x) - (a + y):real^N = x - y`] THEN + REWRITE_TAC[GSYM VECTOR_ADD_ASSOC]);; + +add_translation_invariants [MK_SIMPLEX_TRANSLATION];; + +let PQCSXWG1 = prove + (PQCSXWG1_concl, + GEOM_ORIGIN_TAC `v0:real^3` THEN REPEAT GEN_TAC THEN + REWRITE_TAC[mk_simplex1; VECTOR_SUB_RZERO; VECTOR_ADD_LID] THEN + REPEAT LET_TAC THEN REWRITE_TAC[CONJ_ASSOC] THEN + DISCH_THEN(CONJUNCTS_THEN2 MP_TAC SUBST1_TAC) THEN + REWRITE_TAC[GSYM CONJ_ASSOC] THEN + DISCH_THEN(STRIP_ASSUME_TAC o GSYM) THEN + REWRITE_TAC[dist; VECTOR_SUB_RZERO] THEN + REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC] THEN + REWRITE_TAC[CROSS_RADD; CROSS_RMUL; + VECTOR_ARITH `(a + x % b + c) - b:real^N = a + (x - &1) % b + c`; + VECTOR_ARITH `(a + b + x % c) - c:real^N = a + b + (x - &1) % c`] THEN + SUBGOAL_THEN + `!a b c. norm(a % vcross + b % v1 + c % v2:real^3) pow 2 = + norm(a % vcross) pow 2 + norm(b % v1 + c % v2) pow 2` + (fun th -> REWRITE_TAC[th]) + THENL + [REPEAT GEN_TAC THEN MATCH_MP_TAC NORM_ADD_PYTHAGOREAN THEN + EXPAND_TAC "vcross" THEN REWRITE_TAC[orthogonal] THEN VEC3_TAC; + ALL_TAC] THEN + REWRITE_TAC[CROSS_REFL; VECTOR_MUL_RZERO; VECTOR_ADD_RID; real_gt] THEN + REWRITE_TAC[DOT_RADD; DOT_RMUL; DOT_CROSS_SELF] THEN + REWRITE_TAC[REAL_MUL_RZERO; REAL_ADD_RID] THEN + REWRITE_TAC[VEC3_RULE `v1 dot (v2 cross v) = (v1 cross v2) dot v`] THEN + SUBGOAL_THEN `~(vcross:real^3 = vec 0)` ASSUME_TAC THENL + [EXPAND_TAC "vcross" THEN REWRITE_TAC[CROSS_EQ_0] THEN ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[GSYM NORM_POW_2; NORM_POS_LT; REAL_POW_LT; REAL_LT_MUL_EQ; + REAL_ARITH `&0 < x * &2 * y <=> &0 < x * y`; SQRT_POS_LT]] THEN + SUBGOAL_THEN `&0 < ups_x x1 x2 x6` ASSUME_TAC THENL + [FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I + [Collect_geom2.NOT_COL_EQ_UPS_X_POS]) THEN + MAP_EVERY EXPAND_TAC ["x1"; "x2"; "x6"] THEN REWRITE_TAC[DIST_SYM]; + EXPAND_TAC "uinv" THEN + ASM_SIMP_TAC[REAL_LT_DIV; REAL_OF_NUM_LT; ARITH]] THEN + REWRITE_TAC[NORM_MUL; REAL_POW_MUL; REAL_POW2_ABS] THEN + ASM_SIMP_TAC[SQRT_POW_2; REAL_LT_IMP_LE] THEN + REWRITE_TAC[REAL_ARITH `x * &2 pow 2 * y = &4 * x * y`] THEN + REWRITE_TAC[NORM_POW_2; VECTOR_ARITH + `(a + b) dot (a + b:real^3) = a dot a + b dot b + &2 * a dot b`] THEN + REWRITE_TAC[DOT_LMUL] THEN REWRITE_TAC[DOT_RMUL] THEN + ONCE_REWRITE_TAC[REAL_ARITH + `x3:real = a + b /\ x5 = a + c /\ x4 = a + d <=> + x3 = a + b /\ x3 - x5 = b - c /\ x3 - x4 = b - d`] THEN + REWRITE_TAC[REAL_ARITH + `(b * b * x + c * c * y + &2 * b * c * z) - + ((b - &1) * (b - &1) * x + c * c * y + &2 * (b - &1) * c * z) = + (&2 * b - &1) * x + &2 * c * z /\ + (b * b * x + c * c * y + &2 * b * c * z) - + (b * b * x + (c - &1) * (c - &1) * y + &2 * b * (c - &1) * z) = + (&2 * c - &1) * y + &2 * b * z`] THEN + RULE_ASSUM_TAC(REWRITE_RULE[DIST_0]) THEN + ASM_REWRITE_TAC[GSYM NORM_POW_2; REAL_ARITH + `x = (&2 * b - &1) * y + &2 * c * z <=> + b * y + c * z = (y + x) / &2`] THEN + EXPAND_TAC "vcross" THEN REWRITE_TAC[NORM_POW_2; DOT_CROSS] THEN + ASM_REWRITE_TAC[GSYM NORM_POW_2] THEN + SUBST1_TAC(VECTOR_ARITH `(v2:real^3) dot v1 = v1 dot v2`) THEN + REWRITE_TAC[GSYM REAL_POW_2] THEN + SUBGOAL_THEN `(v1:real^3) dot v2 = ((x1 + x2) - x6) / &2` SUBST1_TAC THENL + [MAP_EVERY EXPAND_TAC ["x1"; "x2"; "x6"] THEN + REWRITE_TAC[dist; NORM_POW_2; DOT_RSUB; DOT_LSUB] THEN + REWRITE_TAC[DOT_SYM] THEN REAL_ARITH_TAC; + ALL_TAC] THEN + REWRITE_TAC[REAL_ARITH + `(&4 * u pow 2 * d) * x + (u * e) * (u * e) * y + (u * f) * (u * f) * z + + &2 * (u * e) * (u * f) * j = + u pow 2 * (&4 * d * x + e pow 2 * y + f pow 2 * z + &2 * e * f * j)`] THEN + REWRITE_TAC[REAL_ARITH + `(u * d) * x + (u * e) * y:real = z <=> u * (d * x + e * y) = z`] THEN + EXPAND_TAC "uinv" THEN MATCH_MP_TAC(REAL_FIELD + `&0 < u /\ + u pow 2 * x = y /\ u * a = b /\ u * c = d + ==> x = (&1 / u) pow 2 * y /\ + (&1 / u) * b = a /\ (&1 / u) * d = c`) THEN + ASM_REWRITE_TAC[] THEN MAP_EVERY EXPAND_TAC ["uinv"; "d"; "d5"; "d6"] THEN + REPEAT(FIRST_X_ASSUM(MP_TAC o MATCH_MP REAL_LT_IMP_NZ)) THEN + REWRITE_TAC[Nonlin_def.delta_x5; Nonlin_def.delta_x4] THEN + REWRITE_TAC[Sphere.ups_x; Sphere.delta_x] THEN CONV_TAC REAL_RING);; + +end;; diff --git a/legacy/oldlocal/XBJRPHC.hl b/legacy/oldlocal/XBJRPHC.hl new file mode 100644 index 0000000..d08d447 --- /dev/null +++ b/legacy/oldlocal/XBJRPHC.hl @@ -0,0 +1,765 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Section: Conclusions *) +(* Chapter: Local Fan *) +(* Lemma: XBJRPHC, PQCSXWG *) +(* Author: John Harrison *) +(* Date: 2013-07-02 *) +(* ========================================================================== *) + +(* +The continuity of the functions dihV and azim. + +Removed from project July 22, 2013. All the necessary theorems have been duplicated in flyspeck.ml +*) + +module Xbjrphc = struct + +(* ========================================================================= *) +(* More complex analysis. *) +(* ========================================================================= *) + +needs "Multivariate/flyspeck.ml";; + +(* ------------------------------------------------------------------------- *) +(* Some of the material at the top of the file may be repetitive. + It was patched together from various email messages from J.H. to T.H. *) +(* ------------------------------------------------------------------------- *) + +(* + let REAL_CONTINUOUS_AT_DIHV = prove + (`!v w w1 w2:real^N. + ~collinear {v, w, w2} ==> dihV v w w1 real_continuous at w2`, + REPEAT STRIP_TAC THEN GEN_REWRITE_TAC LAND_CONV [GSYM ETA_AX] THEN + REWRITE_TAC[dihV] THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN + GEN_REWRITE_TAC LAND_CONV [GSYM o_DEF] THEN + MATCH_MP_TAC REAL_CONTINUOUS_CONTINUOUS_AT_COMPOSE THEN CONJ_TAC THENL + [MATCH_MP_TAC CONTINUOUS_SUB THEN CONJ_TAC THEN + MATCH_MP_TAC CONTINUOUS_MUL THEN + SIMP_TAC[CONTINUOUS_CONST; o_DEF; CONTINUOUS_SUB; CONTINUOUS_AT_ID; + CONTINUOUS_AT_LIFT_DOT2]; + GEN_REWRITE_TAC LAND_CONV [GSYM ETA_AX] THEN + REWRITE_TAC[ARCV_ANGLE; angle] THEN + REWRITE_TAC[VECTOR_SUB_RZERO; ETA_AX] THEN + MATCH_MP_TAC REAL_CONTINUOUS_WITHIN_VECTOR_ANGLE THEN + POP_ASSUM MP_TAC THEN GEOM_ORIGIN_TAC `v:real^N` THEN + REWRITE_TAC[VECTOR_SUB_RZERO; CONTRAPOS_THM; VECTOR_SUB_EQ] THEN + MAP_EVERY X_GEN_TAC [`z:real^N`; `w:real^N`] THEN + ASM_CASES_TAC `w:real^N = vec 0` THEN + ASM_REWRITE_TAC[COLLINEAR_LEMMA_ALT] THEN DISCH_THEN(MP_TAC o AP_TERM + `(%) (inv((w:real^N) dot w)):real^N->real^N`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; DOT_EQ_0] THEN + MESON_TAC[VECTOR_MUL_LID]]);; +*) + +(* ------------------------------------------------------------------------- *) +(* A few general lemmas. *) +(* ------------------------------------------------------------------------- *) + +let COLLINEAR_3_DOT_MULTIPLES = prove + (`!a b c:real^N. + collinear {a,b,c} <=> + ((b - a) dot (b - a)) % (c - a) = ((c - a) dot (b - a)) % (b - a)`, + GEOM_ORIGIN_TAC `a:real^N` THEN REWRITE_TAC[VECTOR_SUB_RZERO] THEN + REPEAT GEN_TAC THEN ASM_CASES_TAC `b:real^N = vec 0` THENL + [ASM_REWRITE_TAC[COLLINEAR_2; INSERT_AC; DOT_RZERO; VECTOR_MUL_LZERO]; + ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[GSYM DOT_CAUCHY_SCHWARZ_EQUAL; GSYM DOT_EQ_0] THEN + REWRITE_TAC[GSYM DOT_EQ_0; DOT_RSUB; DOT_LSUB; DOT_RMUL; DOT_LMUL] THEN + REWRITE_TAC[DOT_SYM] THEN CONV_TAC REAL_RING]);; + +let CONTINUOUS_CONTINUOUS_WITHINREAL = prove + (`!f x s. f continuous (atreal x within s) <=> + (f o drop) continuous (at (lift x) within IMAGE lift s)`, + REWRITE_TAC[REALLIM_WITHINREAL_WITHIN; CONTINUOUS_WITHIN; + CONTINUOUS_WITHINREAL; o_DEF; LIFT_DROP; LIM_WITHINREAL_WITHIN]);; + +let CONTINUOUS_CONTINUOUS_ATREAL = prove + (`!f x. f continuous (atreal x) <=> (f o drop) continuous (at (lift x))`, + REWRITE_TAC[REALLIM_ATREAL_AT; CONTINUOUS_AT; + CONTINUOUS_ATREAL; o_DEF; LIFT_DROP; LIM_ATREAL_AT]);; + +let REAL_CONTINUOUS_REAL_CONTINUOUS_WITHINREAL = prove + (`!f x s. f real_continuous (atreal x within s) <=> + (f o drop) real_continuous (at (lift x) within IMAGE lift s)`, + REWRITE_TAC[REALLIM_WITHINREAL_WITHIN; REAL_CONTINUOUS_WITHIN; + REAL_CONTINUOUS_WITHINREAL; o_DEF; LIFT_DROP; + LIM_WITHINREAL_WITHIN]);; + +let REAL_CONTINUOUS_REAL_CONTINUOUS_ATREAL = prove + (`!f x. f real_continuous (atreal x) <=> + (f o drop) real_continuous (at (lift x))`, + REWRITE_TAC[REALLIM_ATREAL_AT; REAL_CONTINUOUS_AT; + REAL_CONTINUOUS_ATREAL; o_DEF; LIFT_DROP; LIM_ATREAL_AT]);; + +(* ------------------------------------------------------------------------- *) +(* Stronger dihV continuity results. *) +(* ------------------------------------------------------------------------- *) + +let CONTINUOUS_WITHIN_CX_VECTOR_ANGLE_COMPOSE = prove + (`!f:real^M->real^N g x s. + ~(f x = vec 0) /\ ~(g x = vec 0) /\ + f continuous (at x within s) /\ + g continuous (at x within s) + ==> (\x. Cx(vector_angle (f x) (g x))) continuous (at x within s)`, + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `trivial_limit(at (x:real^M) within s)` THEN + ASM_SIMP_TAC[CONTINUOUS_TRIVIAL_LIMIT; vector_angle] THEN + SUBGOAL_THEN + `(cacs o (\x. Cx(((f x:real^N) dot g x) / (norm(f x) * norm(g x))))) + continuous (at (x:real^M) within s)` + MP_TAC THENL + [MATCH_MP_TAC CONTINUOUS_WITHIN_COMPOSE THEN CONJ_TAC THENL + [REWRITE_TAC[CX_DIV; CX_MUL] THEN REWRITE_TAC[WITHIN_UNIV] THEN + MATCH_MP_TAC CONTINUOUS_COMPLEX_DIV THEN + ASM_SIMP_TAC[NETLIMIT_WITHIN; COMPLEX_ENTIRE; CX_INJ; NORM_EQ_0] THEN + REWRITE_TAC[CONTINUOUS_CX_LIFT; GSYM CX_MUL; LIFT_CMUL] THEN + ASM_SIMP_TAC[CONTINUOUS_WITHIN_LIFT_DOT2] THEN + MATCH_MP_TAC CONTINUOUS_MUL THEN + ASM_SIMP_TAC[CONTINUOUS_LIFT_NORM_COMPOSE; o_DEF]; + MATCH_MP_TAC CONTINUOUS_WITHIN_SUBSET THEN + EXISTS_TAC `{z | real z /\ abs(Re z) <= &1}` THEN + REWRITE_TAC[CONTINUOUS_WITHIN_CACS_REAL] THEN + REWRITE_TAC[SUBSET; FORALL_IN_IMAGE; IN_UNIV; IN_ELIM_THM] THEN + REWRITE_TAC[REAL_CX; RE_CX; NORM_CAUCHY_SCHWARZ_DIV]]; + ASM_SIMP_TAC[CONTINUOUS_WITHIN; CX_ACS; o_DEF; + NORM_CAUCHY_SCHWARZ_DIV] THEN + MATCH_MP_TAC(REWRITE_RULE[IMP_CONJ] LIM_TRANSFORM_EVENTUALLY) THEN + SUBGOAL_THEN + `eventually (\y. ~((f:real^M->real^N) y = vec 0) /\ + ~((g:real^M->real^N) y = vec 0)) + (at x within s)` + MP_TAC THENL + [REWRITE_TAC[EVENTUALLY_AND] THEN CONJ_TAC THENL + [UNDISCH_TAC `(f:real^M->real^N) continuous (at x within s)`; + UNDISCH_TAC `(g:real^M->real^N) continuous (at x within s)`] THEN + REWRITE_TAC[CONTINUOUS_WITHIN; tendsto] THENL + [DISCH_THEN(MP_TAC o SPEC `norm((f:real^M->real^N) x)`); + DISCH_THEN(MP_TAC o SPEC `norm((g:real^M->real^N) x)`)] THEN + ASM_REWRITE_TAC[NORM_POS_LT] THEN + MATCH_MP_TAC(REWRITE_RULE[IMP_CONJ] EVENTUALLY_MONO) THEN + REWRITE_TAC[] THEN CONV_TAC NORM_ARITH; + MATCH_MP_TAC(REWRITE_RULE[IMP_CONJ] EVENTUALLY_MONO) THEN + SIMP_TAC[CX_ACS; NORM_CAUCHY_SCHWARZ_DIV]]]);; + +let REAL_CONTINUOUS_WITHIN_DIHV_COMPOSE = prove + (`!f:real^M->real^N g h k x s. + ~collinear {f x,g x,h x} /\ ~collinear {f x,g x,k x} /\ + f continuous (at x within s) /\ g continuous (at x within s) /\ + h continuous (at x within s) /\ k continuous (at x within s) + ==> (\x. dihV (f x) (g x) (h x) (k x)) real_continuous (at x within s)`, + REPEAT STRIP_TAC THEN REWRITE_TAC[dihV] THEN + CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN + REWRITE_TAC[ARCV_ANGLE; angle; REAL_CONTINUOUS_CONTINUOUS; o_DEF] THEN + REWRITE_TAC[VECTOR_SUB_RZERO] THEN + MATCH_MP_TAC CONTINUOUS_WITHIN_CX_VECTOR_ANGLE_COMPOSE THEN + ASM_REWRITE_TAC[VECTOR_SUB_EQ; GSYM COLLINEAR_3_DOT_MULTIPLES] THEN + CONJ_TAC THEN MATCH_MP_TAC CONTINUOUS_SUB THEN CONJ_TAC THEN + MATCH_MP_TAC CONTINUOUS_MUL THEN REWRITE_TAC[o_DEF] THEN + ASM_SIMP_TAC[CONTINUOUS_WITHIN_LIFT_DOT2; o_DEF; CONTINUOUS_SUB]);; + +let REAL_CONTINUOUS_AT_DIHV_COMPOSE = prove + (`!f:real^M->real^N g h k x. + ~collinear {f x,g x,h x} /\ ~collinear {f x,g x,k x} /\ + f continuous (at x) /\ g continuous (at x) /\ + h continuous (at x) /\ k continuous (at x) + ==> (\x. dihV (f x) (g x) (h x) (k x)) real_continuous (at x)`, + ONCE_REWRITE_TAC[GSYM WITHIN_UNIV] THEN + REWRITE_TAC[REAL_CONTINUOUS_WITHIN_DIHV_COMPOSE]);; + +let REAL_CONTINUOUS_WITHINREAL_DIHV_COMPOSE = prove + (`!f:real->real^N g h k x s. + ~collinear {f x,g x,h x} /\ ~collinear {f x,g x,k x} /\ + f continuous (atreal x within s) /\ g continuous (atreal x within s) /\ + h continuous (atreal x within s) /\ k continuous (atreal x within s) + ==> (\x. dihV (f x) (g x) (h x) (k x)) real_continuous + (atreal x within s)`, + REWRITE_TAC[CONTINUOUS_CONTINUOUS_WITHINREAL; + REAL_CONTINUOUS_REAL_CONTINUOUS_WITHINREAL] THEN + SIMP_TAC[o_DEF; REAL_CONTINUOUS_WITHIN_DIHV_COMPOSE; LIFT_DROP]);; + +let REAL_CONTINUOUS_ATREAL_DIHV_COMPOSE = prove + (`!f:real->real^N g h k x. + ~collinear {f x,g x,h x} /\ ~collinear {f x,g x,k x} /\ + f continuous (atreal x) /\ g continuous (atreal x) /\ + h continuous (atreal x) /\ k continuous (atreal x) + ==> (\x. dihV (f x) (g x) (h x) (k x)) real_continuous (atreal x)`, + ONCE_REWRITE_TAC[GSYM WITHINREAL_UNIV] THEN + REWRITE_TAC[REAL_CONTINUOUS_WITHINREAL_DIHV_COMPOSE]);; + +let AFF_GE_2_1_0 = prove + (`!v w. DISJOINT {vec 0, v} {w} + ==> aff_ge {vec 0, v} {w} = {s % v + t % w |s,t| &0 <= t}`, + SIMP_TAC[AFF_GE_2_1; VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[TAUT `p /\ q /\ r <=> q /\ p /\ r`] THEN + ONCE_REWRITE_TAC[MESON[] `(?a b c. P a b c) <=> (?c b a. P a b c)`] THEN + REWRITE_TAC[REAL_ARITH `t + u = &1 <=> t = &1 - u`; UNWIND_THM2] THEN + SET_TAC[]);; + +let AFF_GE_2_1_0_DROPOUT_3 = prove + (`!w z:real^3. + ~collinear{vec 0,basis 3,z} + ==> (w IN aff_ge {vec 0,basis 3} {z} <=> + (dropout 3 w) IN aff_ge {vec 0:real^2} {dropout 3 z})`, + REPEAT GEN_TAC THEN + ASM_CASES_TAC `z:real^3 = vec 0` THENL + [ASM_REWRITE_TAC[COLLINEAR_2; INSERT_AC]; ALL_TAC] THEN + ASM_CASES_TAC `z:real^3 = basis 3` THENL + [ASM_REWRITE_TAC[COLLINEAR_2; INSERT_AC]; ALL_TAC] THEN + REWRITE_TAC[COLLINEAR_BASIS_3] THEN DISCH_TAC THEN + ASM_SIMP_TAC[AFF_GE_2_1_0; SET_RULE `DISJOINT s {a} <=> ~(a IN s)`; + IN_INSERT; NOT_IN_EMPTY; AFF_GE_1_1_0] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + MATCH_MP_TAC(MESON[] + `(!t. ((?s. P s t) <=> Q t)) ==> ((?s t. P s t) <=> (?t. Q t))`) THEN + X_GEN_TAC `t:real` THEN EQ_TAC THENL + [STRIP_TAC THEN + ASM_REWRITE_TAC[DROPOUT_ADD; DROPOUT_MUL; DROPOUT_BASIS_3] THEN + VECTOR_ARITH_TAC; + STRIP_TAC THEN EXISTS_TAC `(w:real^3)$3 - t * (z:real^3)$3` THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [CART_EQ]) THEN + ASM_REWRITE_TAC[CART_EQ; FORALL_2; FORALL_3; DIMINDEX_2; DIMINDEX_3] THEN + REWRITE_TAC[VECTOR_ADD_COMPONENT; VECTOR_MUL_COMPONENT] THEN + SIMP_TAC[dropout; LAMBDA_BETA; DIMINDEX_2; ARITH; BASIS_COMPONENT; + DIMINDEX_3] THEN + CONV_TAC REAL_RING]);; + +let REAL_CONTINUOUS_AT_AZIM_SHARP = prove + (`!v w w1 w2. + ~collinear{v,w,w1} /\ ~collinear{v,w,w2} /\ ~(w2 IN aff_ge {v,w} {w1}) + ==> (azim v w w1) real_continuous at w2`, + GEOM_ORIGIN_TAC `v:real^3` THEN + GEOM_BASIS_MULTIPLE_TAC 3 `w:real^3` THEN + X_GEN_TAC `w:real` THEN ASM_CASES_TAC `w = &0` THENL + [ASM_REWRITE_TAC[VECTOR_MUL_LZERO; INSERT_AC; COLLINEAR_2]; ALL_TAC] THEN + ASM_SIMP_TAC[REAL_LE_LT; COLLINEAR_SPECIAL_SCALE] THEN + DISCH_TAC THEN REPEAT GEN_TAC THEN + REPEAT(DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + W(MP_TAC o PART_MATCH (lhs o rand) AFF_GE_SPECIAL_SCALE o + rand o rand o lhand o goal_concl) THEN + ASM_REWRITE_TAC[FINITE_INSERT; FINITE_EMPTY; IN_SING] THEN ANTS_TAC THENL + [POP_ASSUM_LIST(MP_TAC o end_itlist CONJ) THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN REWRITE_TAC[DE_MORGAN_THM] THEN + DISCH_THEN(STRIP_ASSUME_TAC o GSYM) THENL + [ASM_REWRITE_TAC[COLLINEAR_2; INSERT_AC]; + ASM_REWRITE_TAC[COLLINEAR_2; INSERT_AC]; + ASM_SIMP_TAC[COLLINEAR_LEMMA_ALT; BASIS_NONZERO; DIMINDEX_3; ARITH] THEN + MESON_TAC[]]; + DISCH_THEN SUBST1_TAC THEN DISCH_TAC] THEN + ASM_SIMP_TAC[AZIM_SPECIAL_SCALE; AZIM_ARG] THEN + MATCH_MP_TAC(REWRITE_RULE[o_DEF] + REAL_CONTINUOUS_CONTINUOUS_AT_COMPOSE) THEN + CONJ_TAC THENL + [REWRITE_TAC[complex_div] THEN MATCH_MP_TAC CONTINUOUS_COMPLEX_MUL THEN + REWRITE_TAC[CONTINUOUS_CONST; ETA_AX] THEN + SIMP_TAC[LINEAR_CONTINUOUS_AT; LINEAR_DROPOUT; DIMINDEX_3; DIMINDEX_2; + ARITH]; + ALL_TAC] THEN + MATCH_MP_TAC REAL_CONTINUOUS_AT_WITHIN THEN + MATCH_MP_TAC REAL_CONTINUOUS_AT_ARG THEN + MP_TAC(ISPECL [`w2:real^3`; `w1:real^3`] AFF_GE_2_1_0_DROPOUT_3) THEN + ASM_REWRITE_TAC[] THEN + REPEAT(FIRST_X_ASSUM(MP_TAC o + GEN_REWRITE_RULE RAND_CONV [COLLINEAR_BASIS_3])) THEN + SPEC_TAC(`(dropout 3:real^3->real^2) w2`,`v2:real^2`) THEN + SPEC_TAC(`(dropout 3:real^3->real^2) w1`,`v1:real^2`) THEN + POP_ASSUM_LIST(K ALL_TAC) THEN + GEOM_BASIS_MULTIPLE_TAC 1 `v1:complex` THEN + X_GEN_TAC `w:real` THEN ASM_CASES_TAC `w = &0` THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO] THEN + GEN_REWRITE_TAC LAND_CONV [REAL_LE_LT] THEN ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN X_GEN_TAC `z:complex` THEN + DISCH_THEN(K ALL_TAC) THEN DISCH_THEN(K ALL_TAC) THEN + REWRITE_TAC[CONTRAPOS_THM; COMPLEX_BASIS; COMPLEX_CMUL] THEN + REWRITE_TAC[COMPLEX_MUL_RID; RE_DIV_CX; IM_DIV_CX; real] THEN + ASM_SIMP_TAC[REAL_DIV_EQ_0; REAL_LE_RDIV_EQ; REAL_MUL_LZERO] THEN + STRIP_TAC THEN + W(MP_TAC o PART_MATCH (lhs o rand) AFF_GE_1_1_0 o rand o goal_concl) THEN + ASM_REWRITE_TAC[COMPLEX_VEC_0; CX_INJ] THEN DISCH_THEN SUBST1_TAC THEN + REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC `Re z / w` THEN + ASM_SIMP_TAC[REAL_LE_DIV; REAL_LT_IMP_LE; COMPLEX_EQ] THEN + ASM_SIMP_TAC[COMPLEX_CMUL; CX_DIV; COMPLEX_DIV_RMUL; CX_INJ] THEN + REWRITE_TAC[RE_CX; IM_CX]);; + + +(* ------------------------------------------------------------------------- *) +(* Some general lemmas. *) +(* ------------------------------------------------------------------------- *) + +let LINEAR_CONTINUOUS_COMPOSE = prove + (`!net f:A->real^N g:real^N->real^P. + f continuous net /\ linear g ==> (\x. g(f x)) continuous net`, + REWRITE_TAC[continuous; LIM_LINEAR]);; + +let CONTINUOUS_LIFT_COMPONENT = prove + (`!net f:A->real^N i. f continuous net ==> (\x. lift(f x$i)) continuous net`, + REPEAT GEN_TAC THEN + SUBGOAL_THEN `linear(\x:real^N. lift (x$i))` MP_TAC THENL + [REWRITE_TAC[LINEAR_LIFT_COMPONENT]; REWRITE_TAC[GSYM IMP_CONJ_ALT]] THEN + REWRITE_TAC[LINEAR_CONTINUOUS_COMPOSE]);; + +let CONTINUOUS_CROSS = prove + (`!net:(A)net f g. + f continuous net /\ g continuous net + ==> (\x. (f x) cross (g x)) continuous net`, + REPEAT STRIP_TAC THEN ONCE_REWRITE_TAC[CONTINUOUS_COMPONENTWISE_LIFT] THEN + REWRITE_TAC[cross; VECTOR_3; DIMINDEX_3; FORALL_3; LIFT_SUB] THEN + REPEAT CONJ_TAC THEN MATCH_MP_TAC CONTINUOUS_SUB THEN + REWRITE_TAC[LIFT_CMUL] THEN CONJ_TAC THEN MATCH_MP_TAC CONTINUOUS_MUL THEN + ASM_SIMP_TAC[o_DEF; CONTINUOUS_LIFT_COMPONENT]);; + +let CONTINUOUS_ON_CROSS = prove + (`!f:real^N->real^3 g s. + f continuous_on s /\ g continuous_on s + ==> (\x. (f x) cross (g x)) continuous_on s`, + SIMP_TAC[CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN; CONTINUOUS_CROSS]);; + +let CROSS_LSUB = prove + (`!x y z. (x - y) cross z = x cross z - y cross z`, + VEC3_TAC);; + +let CROSS_RSUB = prove + (`!x y z. x cross (y - z) = x cross y - x cross z`, + VEC3_TAC);; + +let CONTINUOUS_WITHIN_CX_VECTOR_ANGLE_COMPOSE = prove + (`!f:real^M->real^N g x s. + ~(f x = vec 0) /\ ~(g x = vec 0) /\ + f continuous (at x within s) /\ + g continuous (at x within s) + ==> (\x. Cx(vector_angle (f x) (g x))) continuous (at x within s)`, + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `trivial_limit(at (x:real^M) within s)` THEN + ASM_SIMP_TAC[CONTINUOUS_TRIVIAL_LIMIT; vector_angle] THEN + SUBGOAL_THEN + `(cacs o (\x. Cx(((f x:real^N) dot g x) / (norm(f x) * norm(g x))))) + continuous (at (x:real^M) within s)` + MP_TAC THENL + [MATCH_MP_TAC CONTINUOUS_WITHIN_COMPOSE THEN CONJ_TAC THENL + [REWRITE_TAC[CX_DIV; CX_MUL] THEN REWRITE_TAC[WITHIN_UNIV] THEN + MATCH_MP_TAC CONTINUOUS_COMPLEX_DIV THEN + ASM_SIMP_TAC[NETLIMIT_WITHIN; COMPLEX_ENTIRE; CX_INJ; NORM_EQ_0] THEN + REWRITE_TAC[CONTINUOUS_CX_LIFT; GSYM CX_MUL; LIFT_CMUL] THEN + ASM_SIMP_TAC[CONTINUOUS_WITHIN_LIFT_DOT2] THEN + MATCH_MP_TAC CONTINUOUS_MUL THEN + ASM_SIMP_TAC[CONTINUOUS_LIFT_NORM_COMPOSE; o_DEF]; + MATCH_MP_TAC CONTINUOUS_WITHIN_SUBSET THEN + EXISTS_TAC `{z | real z /\ abs(Re z) <= &1}` THEN + REWRITE_TAC[CONTINUOUS_WITHIN_CACS_REAL] THEN + REWRITE_TAC[SUBSET; FORALL_IN_IMAGE; IN_UNIV; IN_ELIM_THM] THEN + REWRITE_TAC[REAL_CX; RE_CX; NORM_CAUCHY_SCHWARZ_DIV]]; + ASM_SIMP_TAC[CONTINUOUS_WITHIN; CX_ACS; o_DEF; + NORM_CAUCHY_SCHWARZ_DIV] THEN + MATCH_MP_TAC(REWRITE_RULE[IMP_CONJ] LIM_TRANSFORM_EVENTUALLY) THEN + SUBGOAL_THEN + `eventually (\y. ~((f:real^M->real^N) y = vec 0) /\ + ~((g:real^M->real^N) y = vec 0)) + (at x within s)` + MP_TAC THENL + [REWRITE_TAC[EVENTUALLY_AND] THEN CONJ_TAC THENL + [UNDISCH_TAC `(f:real^M->real^N) continuous (at x within s)`; + UNDISCH_TAC `(g:real^M->real^N) continuous (at x within s)`] THEN + REWRITE_TAC[CONTINUOUS_WITHIN; tendsto] THENL + [DISCH_THEN(MP_TAC o SPEC `norm((f:real^M->real^N) x)`); + DISCH_THEN(MP_TAC o SPEC `norm((g:real^M->real^N) x)`)] THEN + ASM_REWRITE_TAC[NORM_POS_LT] THEN + MATCH_MP_TAC(REWRITE_RULE[IMP_CONJ] EVENTUALLY_MONO) THEN + REWRITE_TAC[] THEN CONV_TAC NORM_ARITH; + MATCH_MP_TAC(REWRITE_RULE[IMP_CONJ] EVENTUALLY_MONO) THEN + SIMP_TAC[CX_ACS; NORM_CAUCHY_SCHWARZ_DIV]]]);; + +(* ------------------------------------------------------------------------- *) +(* Additional lemmas about aff_ge {vec 0,v} {w}. *) +(* ------------------------------------------------------------------------- *) + +let AFF_GE_2_1_0 = prove + (`!v w. DISJOINT {vec 0, v} {w} + ==> aff_ge {vec 0, v} {w} = {s % v + t % w |s,t| &0 <= t}`, + SIMP_TAC[AFF_GE_2_1; VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[TAUT `p /\ q /\ r <=> q /\ p /\ r`] THEN + ONCE_REWRITE_TAC[MESON[] `(?a b c. P a b c) <=> (?c b a. P a b c)`] THEN + REWRITE_TAC[REAL_ARITH `t + u = &1 <=> t = &1 - u`; UNWIND_THM2] THEN + SET_TAC[]);; + +let AFF_GE_2_1_0_DROPOUT_3 = prove + (`!w z:real^3. + ~collinear{vec 0,basis 3,z} + ==> (w IN aff_ge {vec 0,basis 3} {z} <=> + (dropout 3 w) IN aff_ge {vec 0:real^2} {dropout 3 z})`, + REPEAT GEN_TAC THEN + ASM_CASES_TAC `z:real^3 = vec 0` THENL + [ASM_REWRITE_TAC[COLLINEAR_2; INSERT_AC]; ALL_TAC] THEN + ASM_CASES_TAC `z:real^3 = basis 3` THENL + [ASM_REWRITE_TAC[COLLINEAR_2; INSERT_AC]; ALL_TAC] THEN + REWRITE_TAC[COLLINEAR_BASIS_3] THEN DISCH_TAC THEN + ASM_SIMP_TAC[AFF_GE_2_1_0; SET_RULE `DISJOINT s {a} <=> ~(a IN s)`; + IN_INSERT; NOT_IN_EMPTY; AFF_GE_1_1_0] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + MATCH_MP_TAC(MESON[] + `(!t. ((?s. P s t) <=> Q t)) ==> ((?s t. P s t) <=> (?t. Q t))`) THEN + X_GEN_TAC `t:real` THEN EQ_TAC THENL + [STRIP_TAC THEN + ASM_REWRITE_TAC[DROPOUT_ADD; DROPOUT_MUL; DROPOUT_BASIS_3] THEN + VECTOR_ARITH_TAC; + STRIP_TAC THEN EXISTS_TAC `(w:real^3)$3 - t * (z:real^3)$3` THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [CART_EQ]) THEN + ASM_REWRITE_TAC[CART_EQ; FORALL_2; FORALL_3; DIMINDEX_2; DIMINDEX_3] THEN + REWRITE_TAC[VECTOR_ADD_COMPONENT; VECTOR_MUL_COMPONENT] THEN + SIMP_TAC[dropout; LAMBDA_BETA; DIMINDEX_2; ARITH; BASIS_COMPONENT; + DIMINDEX_3] THEN + CONV_TAC REAL_RING]);; + +let AFF_GE_2_1_0_SEMIALGEBRAIC = prove + (`!x y z:real^3. + ~collinear {vec 0,x,y} /\ ~collinear {vec 0,x,z} + ==> (z IN aff_ge {vec 0,x} {y} <=> + (x cross y) cross x cross z = vec 0 /\ + &0 <= (x cross z) dot (x cross y))`, + let lemma0 = prove + (`~(y = vec 0) ==> ((?s. x = s % y) <=> y cross x = vec 0)`, + REWRITE_TAC[CROSS_EQ_0] THEN SIMP_TAC[COLLINEAR_LEMMA_ALT]) + and lemma1 = prove + (`!x y:real^N. + ~(y = vec 0) + ==> ((?t. &0 <= t /\ x = t % y) <=> + (?t. x = t % y) /\ &0 <= x dot y)`, + REPEAT STRIP_TAC THEN REWRITE_TAC[LEFT_AND_EXISTS_THM] THEN + AP_TERM_TAC THEN REWRITE_TAC[FUN_EQ_THM] THEN X_GEN_TAC `t:real` THEN + ASM_CASES_TAC `x:real^N = t % y` THEN + ASM_SIMP_TAC[DOT_LMUL; REAL_LE_MUL_EQ; DOT_POS_LT]) in + REPEAT GEN_TAC THEN + MAP_EVERY (fun t -> ASM_CASES_TAC t THENL + [ASM_REWRITE_TAC[COLLINEAR_2; INSERT_AC]; ALL_TAC]) + [`x:real^3 = vec 0`; `y:real^3 = vec 0`; `y:real^3 = x`] THEN + STRIP_TAC THEN + ASM_SIMP_TAC[AFF_GE_2_1_0; IN_ELIM_THM; SET_RULE + `DISJOINT {a,b} {c} <=> ~(a = c) /\ ~(b = c)`] THEN + ONCE_REWRITE_TAC[SWAP_EXISTS_THM] THEN + REWRITE_TAC[RIGHT_EXISTS_AND_THM; VECTOR_ARITH + `a:real^N = b + c <=> a - c = b`] THEN + RULE_ASSUM_TAC(REWRITE_RULE[GSYM CROSS_EQ_0]) THEN + ASM_SIMP_TAC[lemma0; lemma1; CROSS_RMUL; CROSS_RSUB; VECTOR_SUB_EQ]);; + +let AZIM_IN_UPPER_HALFSPACE = prove + (`!v w x y. azim v w x y <= pi <=> + &0 <= ((w - v) cross (x - v)) dot (y - v)`, + GEOM_ORIGIN_TAC `v:real^3` THEN REWRITE_TAC[VECTOR_SUB_RZERO] THEN + REWRITE_TAC[GSYM Local_lemmas.SIN_AZIM_POS_PI_LT; + Polar_fan.SIN_AZIM_MUTUAL_CROSS]);; + +(* ------------------------------------------------------------------------- *) +(* Single-variable continuity for azim with slightly sharper hypothesis. *) +(* ------------------------------------------------------------------------- *) + +let REAL_CONTINUOUS_AT_AZIM_SHARP = prove + (`!v w w1 w2. + ~collinear{v,w,w1} /\ ~(w2 IN aff_ge {v,w} {w1}) + ==> (\w2. azim v w w1 w2) real_continuous at w2`, + GEOM_ORIGIN_TAC `v:real^3` THEN + GEOM_BASIS_MULTIPLE_TAC 3 `w:real^3` THEN + X_GEN_TAC `w:real` THEN ASM_CASES_TAC `w = &0` THENL + [ASM_REWRITE_TAC[VECTOR_MUL_LZERO; INSERT_AC; COLLINEAR_2]; ALL_TAC] THEN + ASM_SIMP_TAC[REAL_LE_LT; COLLINEAR_SPECIAL_SCALE] THEN + DISCH_TAC THEN REPEAT GEN_TAC THEN + REPEAT(DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + W(MP_TAC o PART_MATCH (lhs o rand) AFF_GE_SPECIAL_SCALE o + rand o rand o lhand o goal_concl) THEN + ASM_REWRITE_TAC[FINITE_INSERT; FINITE_EMPTY; IN_SING] THEN ANTS_TAC THENL + [POP_ASSUM_LIST(MP_TAC o end_itlist CONJ) THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN REWRITE_TAC[DE_MORGAN_THM] THEN + DISCH_THEN(STRIP_ASSUME_TAC o GSYM) THENL + [ASM_REWRITE_TAC[COLLINEAR_2; INSERT_AC]; + ASM_REWRITE_TAC[COLLINEAR_2; INSERT_AC]; + ASM_SIMP_TAC[COLLINEAR_LEMMA_ALT; BASIS_NONZERO; DIMINDEX_3; ARITH] THEN + MESON_TAC[]]; + DISCH_THEN SUBST1_TAC THEN DISCH_TAC] THEN + ASM_SIMP_TAC[AZIM_SPECIAL_SCALE; AZIM_ARG] THEN + MATCH_MP_TAC(REWRITE_RULE[o_DEF] + REAL_CONTINUOUS_CONTINUOUS_AT_COMPOSE) THEN + CONJ_TAC THENL + [REWRITE_TAC[complex_div] THEN MATCH_MP_TAC CONTINUOUS_COMPLEX_MUL THEN + REWRITE_TAC[CONTINUOUS_CONST; ETA_AX] THEN + SIMP_TAC[LINEAR_CONTINUOUS_AT; LINEAR_DROPOUT; DIMINDEX_3; DIMINDEX_2; + ARITH]; + ALL_TAC] THEN + MATCH_MP_TAC REAL_CONTINUOUS_AT_WITHIN THEN + MATCH_MP_TAC REAL_CONTINUOUS_AT_ARG THEN + MP_TAC(ISPECL [`w2:real^3`; `w1:real^3`] AFF_GE_2_1_0_DROPOUT_3) THEN + ASM_REWRITE_TAC[] THEN + REPEAT(FIRST_X_ASSUM(MP_TAC o + GEN_REWRITE_RULE RAND_CONV [COLLINEAR_BASIS_3])) THEN + SPEC_TAC(`(dropout 3:real^3->real^2) w2`,`v2:real^2`) THEN + SPEC_TAC(`(dropout 3:real^3->real^2) w1`,`v1:real^2`) THEN + POP_ASSUM_LIST(K ALL_TAC) THEN + GEOM_BASIS_MULTIPLE_TAC 1 `v1:complex` THEN + X_GEN_TAC `w:real` THEN ASM_CASES_TAC `w = &0` THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO] THEN + GEN_REWRITE_TAC LAND_CONV [REAL_LE_LT] THEN ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN X_GEN_TAC `z:complex` THEN + DISCH_THEN(K ALL_TAC) THEN + REWRITE_TAC[CONTRAPOS_THM; COMPLEX_BASIS; COMPLEX_CMUL] THEN + REWRITE_TAC[COMPLEX_MUL_RID; RE_DIV_CX; IM_DIV_CX; real] THEN + ASM_SIMP_TAC[REAL_DIV_EQ_0; REAL_LE_RDIV_EQ; REAL_MUL_LZERO] THEN + STRIP_TAC THEN + W(MP_TAC o PART_MATCH (lhs o rand) AFF_GE_1_1_0 o rand o goal_concl) THEN + ASM_REWRITE_TAC[COMPLEX_VEC_0; CX_INJ] THEN DISCH_THEN SUBST1_TAC THEN + REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC `Re z / w` THEN + ASM_SIMP_TAC[REAL_LE_DIV; REAL_LT_IMP_LE; COMPLEX_EQ] THEN + ASM_SIMP_TAC[COMPLEX_CMUL; CX_DIV; COMPLEX_DIV_RMUL; CX_INJ] THEN + REWRITE_TAC[RE_CX; IM_CX]);; + +(* ------------------------------------------------------------------------- *) +(* General continuity of dihV composed with other functions. *) +(* ------------------------------------------------------------------------- *) + +let REAL_CONTINUOUS_WITHIN_DIHV_COMPOSE = prove + (`!f:real^M->real^N g h k x s. + ~collinear {f x,g x,h x} /\ ~collinear {f x,g x,k x} /\ + f continuous (at x within s) /\ g continuous (at x within s) /\ + h continuous (at x within s) /\ k continuous (at x within s) + ==> (\x. dihV (f x) (g x) (h x) (k x)) real_continuous (at x within s)`, + REPEAT STRIP_TAC THEN REWRITE_TAC[dihV] THEN + CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN + REWRITE_TAC[ARCV_ANGLE; angle; REAL_CONTINUOUS_CONTINUOUS; o_DEF] THEN + REWRITE_TAC[VECTOR_SUB_RZERO] THEN + MATCH_MP_TAC CONTINUOUS_WITHIN_CX_VECTOR_ANGLE_COMPOSE THEN + ASM_REWRITE_TAC[VECTOR_SUB_EQ; GSYM COLLINEAR_3_DOT_MULTIPLES] THEN + CONJ_TAC THEN MATCH_MP_TAC CONTINUOUS_SUB THEN CONJ_TAC THEN + MATCH_MP_TAC CONTINUOUS_MUL THEN REWRITE_TAC[o_DEF] THEN + ASM_SIMP_TAC[CONTINUOUS_WITHIN_LIFT_DOT2; o_DEF; CONTINUOUS_SUB]);; + +let REAL_CONTINUOUS_AT_DIHV_COMPOSE = prove + (`!f:real^M->real^N g h k x. + ~collinear {f x,g x,h x} /\ ~collinear {f x,g x,k x} /\ + f continuous (at x) /\ g continuous (at x) /\ + h continuous (at x) /\ k continuous (at x) + ==> (\x. dihV (f x) (g x) (h x) (k x)) real_continuous (at x)`, + ONCE_REWRITE_TAC[GSYM WITHIN_UNIV] THEN + REWRITE_TAC[REAL_CONTINUOUS_WITHIN_DIHV_COMPOSE]);; + +let REAL_CONTINUOUS_WITHINREAL_DIHV_COMPOSE = prove + (`!f:real->real^N g h k x s. + ~collinear {f x,g x,h x} /\ ~collinear {f x,g x,k x} /\ + f continuous (atreal x within s) /\ g continuous (atreal x within s) /\ + h continuous (atreal x within s) /\ k continuous (atreal x within s) + ==> (\x. dihV (f x) (g x) (h x) (k x)) real_continuous + (atreal x within s)`, + REWRITE_TAC[CONTINUOUS_CONTINUOUS_WITHINREAL; + REAL_CONTINUOUS_REAL_CONTINUOUS_WITHINREAL] THEN + SIMP_TAC[o_DEF; REAL_CONTINUOUS_WITHIN_DIHV_COMPOSE; LIFT_DROP]);; + +let REAL_CONTINUOUS_ATREAL_DIHV_COMPOSE = prove + (`!f:real->real^N g h k x. + ~collinear {f x,g x,h x} /\ ~collinear {f x,g x,k x} /\ + f continuous (atreal x) /\ g continuous (atreal x) /\ + h continuous (atreal x) /\ k continuous (atreal x) + ==> (\x. dihV (f x) (g x) (h x) (k x)) real_continuous (atreal x)`, + ONCE_REWRITE_TAC[GSYM WITHINREAL_UNIV] THEN + REWRITE_TAC[REAL_CONTINUOUS_WITHINREAL_DIHV_COMPOSE]);; + +(* ------------------------------------------------------------------------- *) +(* General continuity of azim composed with other functions. *) +(* ------------------------------------------------------------------------- *) + +let REAL_CONTINUOUS_WITHIN_AZIM_COMPOSE = prove + (`!f:real^M->real^3 g h k x s. + ~collinear {f x,g x,h x} /\ ~collinear {f x,g x,k x} /\ + ~(k x IN aff_ge {f x,g x} {h x}) /\ + f continuous (at x within s) /\ g continuous (at x within s) /\ + h continuous (at x within s) /\ k continuous (at x within s) + ==> (\x. azim (f x) (g x) (h x) (k x)) real_continuous (at x within s)`, + let lemma = prove + (`!s t u f:real^M->real^N g h. + (closed s /\ closed t) /\ s UNION t = UNIV /\ + (g continuous_on (u INTER s) /\ h continuous_on (u INTER t)) /\ + (!x. x IN u INTER s ==> g x = f x) /\ + (!x. x IN u INTER t ==> h x = f x) + ==> f continuous_on u`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `u:real^M->bool = (u INTER s) UNION (u INTER t)` + SUBST1_TAC THENL [ASM SET_TAC[]; ALL_TAC] THEN + MATCH_MP_TAC CONTINUOUS_ON_UNION_LOCAL THEN + REWRITE_TAC[CLOSED_IN_CLOSED] THEN REPEAT CONJ_TAC THENL + [EXISTS_TAC `s:real^M->bool` THEN ASM SET_TAC[]; + EXISTS_TAC `t:real^M->bool` THEN ASM SET_TAC[]; + ASM_MESON_TAC[CONTINUOUS_ON_EQ]; + ASM_MESON_TAC[CONTINUOUS_ON_EQ]]) in + REPEAT STRIP_TAC THEN REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS; o_DEF] THEN + SUBGOAL_THEN + `(\x:real^M. Cx(azim (f x) (g x) (h x) (k x))) = + (\z. Cx(azim (vec 0) (fstcart z) + (fstcart(sndcart z)) (sndcart(sndcart z)))) o + (\x. pastecart (g x - f x) (pastecart (h x - f x) (k x - f x)))` + SUBST1_TAC THENL + [REWRITE_TAC[FUN_EQ_THM; o_THM; FSTCART_PASTECART; SNDCART_PASTECART] THEN + X_GEN_TAC `y:real^M` THEN + SUBST1_TAC(VECTOR_ARITH `vec 0 = (f:real^M->real^3) y - f y`) THEN + SIMP_TAC[ONCE_REWRITE_RULE[VECTOR_ADD_SYM] AZIM_TRANSLATION; VECTOR_SUB]; + MATCH_MP_TAC CONTINUOUS_WITHIN_COMPOSE THEN + ASM_SIMP_TAC[CONTINUOUS_PASTECART; CONTINUOUS_SUB]] THEN + MATCH_MP_TAC CONTINUOUS_AT_WITHIN THEN + SUBGOAL_THEN + `!z. ~collinear {vec 0,fstcart z,fstcart(sndcart z)} /\ + ~collinear {vec 0,fstcart z,sndcart(sndcart z)} /\ + ~(sndcart(sndcart z) IN aff_ge {vec 0,fstcart z} {fstcart(sndcart z)}) + ==> (\z. Cx(azim (vec 0) (fstcart z) (fstcart(sndcart z)) + (sndcart(sndcart z)))) + continuous (at z)` + MATCH_MP_TAC THENL + [ALL_TAC; + ASM_SIMP_TAC[FSTCART_PASTECART; SNDCART_PASTECART; GSYM COLLINEAR_3] THEN + REPEAT(CONJ_TAC THENL [ASM_MESON_TAC[INSERT_AC]; ALL_TAC]) THEN + SUBST1_TAC(VECTOR_ARITH `vec 0 = (f:real^M->real^3) x - f x`) THEN + ONCE_REWRITE_TAC[SET_RULE `{a,b} = {a} UNION {b}`] THEN + REWRITE_TAC[GSYM IMAGE_UNION; SET_RULE + `{a - b:real^3} = IMAGE (\x. x - b) {a}`] THEN + REWRITE_TAC[ONCE_REWRITE_RULE[VECTOR_ADD_SYM] AFF_GE_TRANSLATION; + VECTOR_SUB] THEN + ASM_REWRITE_TAC[IN_IMAGE; VECTOR_ARITH `a + x:real^3 = b + x <=> a = b`; + UNWIND_THM1; SET_RULE `{a} UNION {b} = {a,b}`]] THEN + ONCE_REWRITE_TAC[SET_RULE + `(!x. ~P x /\ ~Q x /\ ~R x ==> J x) <=> + (!x. x IN UNIV DIFF (({x | P x} UNION {x | Q x}) UNION {x | R x}) + ==> J x)`] THEN + MATCH_MP_TAC(MESON[CONTINUOUS_ON_EQ_CONTINUOUS_AT] + `open s /\ f continuous_on s ==> !z. z IN s ==> f continuous at z`) THEN + CONJ_TAC THENL + [REWRITE_TAC[GSYM closed] THEN + MATCH_MP_TAC(MESON[] + `!t'. s UNION t = s UNION t' /\ closed(s UNION t') + ==> closed(s UNION t)`) THEN + EXISTS_TAC + `{z | (fstcart z cross fstcart(sndcart z)) cross + fstcart z cross sndcart(sndcart z) = vec 0 /\ + &0 <= (fstcart z cross sndcart(sndcart z)) dot + (fstcart z cross fstcart(sndcart z))}` THEN + CONJ_TAC THENL + [MATCH_MP_TAC(SET_RULE + `(!x. ~(x IN s) ==> (x IN t <=> x IN t')) + ==> s UNION t = s UNION t'`) THEN + REWRITE_TAC[AFF_GE_2_1_0_SEMIALGEBRAIC; IN_UNION; IN_ELIM_THM; + DE_MORGAN_THM]; + ALL_TAC] THEN + MATCH_MP_TAC CLOSED_UNION THEN CONJ_TAC THENL + [MATCH_MP_TAC CLOSED_UNION THEN CONJ_TAC THEN + REWRITE_TAC[GSYM DOT_CAUCHY_SCHWARZ_EQUAL] THEN + ONCE_REWRITE_TAC[GSYM REAL_SUB_0] THEN + REWRITE_TAC[GSYM LIFT_EQ; LIFT_NUM] THEN + SIMP_TAC[SET_RULE `{x | f x = a} = {x | x IN UNIV /\ f x IN {a}}`] THEN + MATCH_MP_TAC CONTINUOUS_CLOSED_PREIMAGE THEN + SIMP_TAC[CLOSED_UNIV; CLOSED_SING; LIFT_SUB; REAL_POW_2; LIFT_CMUL] THEN + MATCH_MP_TAC CONTINUOUS_ON_SUB THEN + CONJ_TAC THEN MATCH_MP_TAC CONTINUOUS_ON_MUL THEN + REWRITE_TAC[o_DEF] THEN REPEAT CONJ_TAC THEN + MATCH_MP_TAC CONTINUOUS_ON_LIFT_DOT2 THEN CONJ_TAC; + ONCE_REWRITE_TAC[MESON[LIFT_DROP; real_ge] + `&0 <= x <=> drop(lift x) >= &0`] THEN + REWRITE_TAC[SET_RULE + `{z | f z = vec 0 /\ drop(g z) >= &0} = + {z | z IN UNIV /\ f z IN {vec 0}} INTER + {z | z IN UNIV /\ g z IN {k | drop(k) >= &0}}`] THEN + MATCH_MP_TAC CLOSED_INTER THEN + CONJ_TAC THEN MATCH_MP_TAC CONTINUOUS_CLOSED_PREIMAGE THEN + REWRITE_TAC[CLOSED_SING; drop; CLOSED_UNIV; + CLOSED_HALFSPACE_COMPONENT_GE] THEN + REPEAT((MATCH_MP_TAC CONTINUOUS_ON_CROSS ORELSE + MATCH_MP_TAC CONTINUOUS_ON_LIFT_DOT2) THEN CONJ_TAC)] THEN + TRY(GEN_REWRITE_TAC LAND_CONV [GSYM o_DEF]) THEN + SIMP_TAC[CONTINUOUS_ON_COMPOSE; LINEAR_CONTINUOUS_ON; + LINEAR_FSTCART; LINEAR_SNDCART]; + MATCH_MP_TAC lemma THEN + MAP_EVERY EXISTS_TAC + [`{z | z IN UNIV /\ lift((fstcart z cross (fstcart(sndcart z))) dot + (sndcart(sndcart z))) IN {x | x$1 >= &0}}`; + `{z | z IN UNIV /\ lift((fstcart z cross (fstcart(sndcart z))) dot + (sndcart(sndcart z))) IN {x | x$1 <= &0}}`; + `\z. Cx(dihV (vec 0:real^3) (fstcart z) + (fstcart(sndcart z)) (sndcart(sndcart z)))`; + `\z. Cx(&2 * pi - dihV (vec 0:real^3) (fstcart z) + (fstcart(sndcart z)) (sndcart(sndcart z)))`] THEN + CONJ_TAC THENL + [CONJ_TAC THEN MATCH_MP_TAC CONTINUOUS_CLOSED_PREIMAGE THEN + REWRITE_TAC[CLOSED_UNIV; CLOSED_HALFSPACE_COMPONENT_GE; + CLOSED_HALFSPACE_COMPONENT_LE] THEN + MATCH_MP_TAC CONTINUOUS_ON_LIFT_DOT2 THEN + (CONJ_TAC THENL [MATCH_MP_TAC CONTINUOUS_ON_CROSS; ALL_TAC]) THEN + ONCE_REWRITE_TAC[GSYM o_DEF] THEN + SIMP_TAC[CONTINUOUS_ON_COMPOSE; LINEAR_CONTINUOUS_ON; + LINEAR_FSTCART; LINEAR_SNDCART]; + ALL_TAC] THEN + CONJ_TAC THENL + [REWRITE_TAC[EXTENSION; IN_UNION; IN_UNIV; IN_ELIM_THM] THEN + REAL_ARITH_TAC; + ALL_TAC] THEN + CONJ_TAC THENL + [CONJ_TAC THEN MATCH_MP_TAC CONTINUOUS_AT_IMP_CONTINUOUS_ON THEN + REWRITE_TAC[FORALL_PASTECART; IN_DIFF; IN_UNIV; IN_UNION; IN_INTER; + FSTCART_PASTECART; SNDCART_PASTECART; IN_ELIM_THM; DE_MORGAN_THM] THEN + MAP_EVERY X_GEN_TAC [`x:real^3`; `y:real^3`; `z:real^3`] THEN + REPEAT STRIP_TAC THEN REWRITE_TAC[CX_SUB] THEN + TRY(MATCH_MP_TAC CONTINUOUS_SUB THEN REWRITE_TAC[CONTINUOUS_CONST]) THEN + GEN_REWRITE_TAC LAND_CONV [GSYM o_DEF] THEN + REWRITE_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS] THEN + MATCH_MP_TAC REAL_CONTINUOUS_AT_DIHV_COMPOSE THEN + ASM_REWRITE_TAC[FSTCART_PASTECART; SNDCART_PASTECART; + CONTINUOUS_CONST] THEN + ONCE_REWRITE_TAC[GSYM o_DEF] THEN + SIMP_TAC[CONTINUOUS_AT_COMPOSE; LINEAR_CONTINUOUS_AT; + LINEAR_FSTCART; LINEAR_SNDCART]; + ALL_TAC] THEN + REWRITE_TAC[FORALL_PASTECART; IN_DIFF; IN_UNIV; IN_UNION; IN_INTER; CX_INJ; + FSTCART_PASTECART; SNDCART_PASTECART; IN_ELIM_THM; DE_MORGAN_THM] THEN + CONJ_TAC THENL + [REWRITE_TAC[GSYM drop; LIFT_DROP; real_ge] THEN + MAP_EVERY X_GEN_TAC [`x:real^3`; `y:real^3`; `z:real^3`] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC(GSYM AZIM_DIHV_SAME_STRONG) THEN + ASM_REWRITE_TAC[AZIM_IN_UPPER_HALFSPACE; VECTOR_SUB_RZERO]; + REWRITE_TAC[GSYM drop; LIFT_DROP] THEN + MAP_EVERY X_GEN_TAC [`x:real^3`; `y:real^3`; `z:real^3`] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC(GSYM AZIM_DIHV_COMPL) THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC(REAL_ARITH + `(x <= pi ==> x = pi) ==> pi <= x`) THEN + ASM_REWRITE_TAC[AZIM_IN_UPPER_HALFSPACE; VECTOR_SUB_RZERO] THEN + ASM_SIMP_TAC[REAL_ARITH `x <= &0 ==> (&0 <= x <=> x = &0)`] THEN + REWRITE_TAC[Local_lemmas.CROSS_DOT_COPLANAR] THEN + ASM_SIMP_TAC[GSYM AZIM_EQ_0_PI_EQ_COPLANAR; AZIM_EQ_0_GE_ALT]]]);; + +let REAL_CONTINUOUS_AT_AZIM_COMPOSE = prove + (`!f:real^M->real^3 g h k x. + ~collinear {f x,g x,h x} /\ ~collinear {f x,g x,k x} /\ + ~(k x IN aff_ge {f x,g x} {h x}) /\ + f continuous (at x) /\ g continuous (at x) /\ + h continuous (at x) /\ k continuous (at x) + ==> (\x. azim (f x) (g x) (h x) (k x)) real_continuous (at x)`, + ONCE_REWRITE_TAC[GSYM WITHIN_UNIV] THEN + REWRITE_TAC[REAL_CONTINUOUS_WITHIN_AZIM_COMPOSE]);; + +let REAL_CONTINUOUS_WITHINREAL_AZIM_COMPOSE = prove + (`!f:real->real^3 g h k x s. + ~collinear {f x,g x,h x} /\ ~collinear {f x,g x,k x} /\ + ~(k x IN aff_ge {f x,g x} {h x}) /\ + f continuous (atreal x within s) /\ g continuous (atreal x within s) /\ + h continuous (atreal x within s) /\ k continuous (atreal x within s) + ==> (\x. azim (f x) (g x) (h x) (k x)) real_continuous + (atreal x within s)`, + REWRITE_TAC[CONTINUOUS_CONTINUOUS_WITHINREAL; + REAL_CONTINUOUS_REAL_CONTINUOUS_WITHINREAL] THEN + SIMP_TAC[o_DEF; REAL_CONTINUOUS_WITHIN_AZIM_COMPOSE; LIFT_DROP]);; + +let REAL_CONTINUOUS_ATREAL_AZIM_COMPOSE = prove + (`!f:real->real^3 g h k x. + ~collinear {f x,g x,h x} /\ ~collinear {f x,g x,k x} /\ + ~(k x IN aff_ge {f x,g x} {h x}) /\ + f continuous (atreal x) /\ g continuous (atreal x) /\ + h continuous (atreal x) /\ k continuous (atreal x) + ==> (\x. azim (f x) (g x) (h x) (k x)) real_continuous (atreal x)`, + ONCE_REWRITE_TAC[GSYM WITHINREAL_UNIV] THEN + REWRITE_TAC[REAL_CONTINUOUS_WITHINREAL_AZIM_COMPOSE]);; + + + + +end;; diff --git a/legacy/oldlocal/ch_local/CKQOWSA.hl b/legacy/oldlocal/ch_local/CKQOWSA.hl new file mode 100644 index 0000000..d75a073 --- /dev/null +++ b/legacy/oldlocal/ch_local/CKQOWSA.hl @@ -0,0 +1,25 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Lemma: CKQOWSA *) +(* Chapter: local *) +(* Author: Thomas C. Hales *) +(* Date: 2010-03-12 *) +(* ========================================================================== *) + +flyspeck_needs "general/sphere.hl";; + +let tarski_3point_concl = `!v0 v1 v2. {v0,v1,v2} SUBSET ball_annulus /\ + packing {v0,v1,v2} /\ + dist(v1,v2) <= &2 * h0 /\ ~(v0 IN {v1,v2}) ==> + ( aff_ge {vec 0} {v0} INTER aff_ge {vec 0 } { v1,v2} = {vec 0})`;; + +let tarski_4point_concl = `!v0 v1 v2 v3. {v0,v1,v2,v3} SUBSET ball_annulus /\ + packing {v0,v1,v2,v3} /\ + dist(v1,v3) <= &2 * h0 /\ dist (v0,v2) <= &2 * h0 /\ + ({v0,v2} INTER {v1,v3} = {}) ==> + ( aff_ge {vec 0} {v0,v2} INTER aff_ge {vec 0} {v1,v3} = {vec 0})`;; + +let CKQOWSA_concl = `!V. packing V /\ V SUBEST ball_annulus ==> + fan (vec 0,V,ESTD V)`;; + diff --git a/legacy/oldlocal/ch_local/cyclic_definition.hl b/legacy/oldlocal/ch_local/cyclic_definition.hl new file mode 100644 index 0000000..960f00d --- /dev/null +++ b/legacy/oldlocal/ch_local/cyclic_definition.hl @@ -0,0 +1,16 @@ + +(* called azim(x) in text *) + +let define_latex (a,b,c) = + + +let azimdart = define `azimdart (V,E) (v,w) = + azim (vec 0) v w (sigma_fan (vec 0) V E v w)`;; + + +let cyclic_fan = `cyclic_fan (V,E,F1) = + FANO(V,E) /\ + face_set (hyp_of_fano(V,E)) F1 /\ + (!x. (F1 x) ==> azimdart (V,E) x <= pi) + +`;; diff --git a/legacy/oldlocal/ch_local/local_defs.hl b/legacy/oldlocal/ch_local/local_defs.hl new file mode 100644 index 0000000..c752da8 --- /dev/null +++ b/legacy/oldlocal/ch_local/local_defs.hl @@ -0,0 +1,201 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Definitions *) +(* Chapter: Tame Hypermap *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-07 *) +(* ========================================================================== *) + +(* + +Definitions file for Local Fans + +This file was split off from tame/tame_defs.hl in July 2010 +when it was discovered that there are many incompatible +definitions betwen the Local Fans chapter and the Tame chapter. + +This file is not currently part of the build. +*) + +flyspeck_needs "hypermap/hypermap.hl";; +flyspeck_needs "fan/fan_defs.hl";; +flyspeck_needs "packing/pack_defs.hl";; + +module Local_fan_defs = struct + + +let cwedge = new_definition `cwedge v0 v1 w1 w2 = + {y | &0 <= azim v0 v1 w1 y /\ + azim v0 v1 w1 y <= azim v0 v1 w1 w2}`;; + +let cw_dart_fan=new_definition +`cw_dart_fan (V:real^3->bool) (E:(real^3->bool)->bool) ((v:real^3),(w:real^3))= +if (CARD (set_of_edge v V E) > 1) +then cwedge (vec 0) v w (sigma_fan (vec 0) V E v w) +else (:real^3)`;; + +let local_fan = new_definition `local_fan (V,E,f) <=> + FAN (vec 0,V,E) /\ + f IN face_set_of_fan (V,E) /\ + (hypermap_of_fan (V,E)) iso (cyclic_hypermap I I (CARD f))`;; + +let convex_local_fan = new_definition `convex_local_fan (V,E,f) <=> + local_fan (V,E,f) /\ + (!x. (x IN f) ==> azim_dart (V,E) x <= pi) /\ + (!x. (x IN f) ==> V SUBSET cw_dart_fan V E x)`;; + +let rho_node1 = new_definition + `rho_node1 (V:A1,E:A2,f:A3#A4->bool) v = @w. (v,w) IN f`;; + +let order_permutation = new_definition + `order_permutation (p:A->A) = (minimal) { m | (p POWER m = I) /\ (m > 0) }`;; + +let is_cyclic_permutation = new_definition + `is_cyclic_permutation rho s <=> + rho permutes s /\ s HAS_SIZE (order_permutation rho)`;; + +let interior_angle = new_definition + `interior_angle (V,E,f) v = azim_dart (V,E) (v,(rho_node1 (V,E,f) v))`;; + +let cw_node_fan = new_definition + `cw_node_fan (V,E,f) v = cw_dart_fan V E (v,rho_node1(V,E,f) v)`;; + +let w_node_fan = new_definition (* 4th component is ignored *) + `w_node_fan (V,E,f) v = w_dart_fan (vec 0) V E (vec 0,v,rho_node1(V,E,f) v,v)`;; + +let localization = new_definition `localization (V,E,f) = + {v | v IN V /\ (?w. w IN V /\ (v,w) IN f)}, + { {v,w} | {v,w} IN E /\ (v,w) IN f}, + f`;; + +let is_generic_clf = new_definition `is_generic_clf (V,E,f:A) <=> + (! v w (u:real^3). (u IN V) /\ {v,w} IN E ==> + aff_ge { vec 0 } { v , w} INTER aff_lt { vec 0 } {u } = {})`;; + +let is_circular_clf = new_definition `is_circular_clf (V,E,f:A) <=> + (? v w (u:real^3). (u IN V) /\ {v,w} IN E /\ + ~( aff_gt { vec 0 } { v , w} INTER aff_lt { vec 0 } {u } = {}))`;; + +let is_lunar_clf = new_definition `is_lunar_clf (V,E,f:A) (v,w) <=> + v IN V /\ w IN V /\ ~(is_circular_clf (V,E,f)) /\ + collinear {(vec 0) , v, w}`;; + +let is_flat = new_definition `is_flat (V,E,f) v <=> + interior_angle (V,E,f) v = pi`;; + + +let is_deformation_clf = new_definition + `is_deformation_clf phi V s = (!v x. v IN V ==> (phi v) continuous at x within s)`;; + +let node_deform = new_definition + `node_deform phi V t = { phi v t | v IN V}`;; + +let edge_deform = new_definition + `edge_deform phi V E t = { {phi v t, phi w t} | {v,w} IN E}`;; + +let face_deform = new_definition + `face_deform phi V f t = { (phi v t, phi w t) | (v,w) IN f}`;; + +let per = new_definition +`per(V,E,f) v k = sum (0..k-1) + ( \ i. arcV (vec 0) ((rho_node1 (V,E,f) POWER i) v) ((rho_node1 (V,E,f) POWER (i+1)) v))`;; + +let perimeter = new_definition +`perimeter(V,E,f) = per(V,E,f) (CHOICE V) (CARD(f))`;; + + +let perimeterbound = new_definition `perimeterbound (V,E) = + (!f. f IN face_set_of_fan (V,E) ==> + sum f (\ (v,w). arcV (vec 0) (v:real^3) w ) <= &2 * pi)`;; + + +let special_fan = new_definition +`special_fan (V,E,f,S) <=> packing V /\ V SUBSET ball_annulus /\ convex_local_fan (V,E,f) /\ + S SUBSET E /\ + (! v w. {v,w} IN S ==>( dist(v,w) = &2 * h0)) /\ + (! v w. {v,w} IN E ==> (dist(v,w) <= &2 * h0)) /\ + (! v w. v IN V /\ w IN V /\ ~(v=w) /\ ~({v,w} IN E) ==> &2 * h0 <= dist(v,w))`;; + +let r_special = new_definition + `r_special (V,E,f,S) = CARD(E) - CARD(S)`;; + +let s_special = new_definition + `s_special (V,E,f,S) = CARD(S)`;; + +let d2_tame = new_definition (* deprecate *) + `d2_tame r s = if (r + 2*s > 3) + then #0.103 * (&2 - &s) + #0.2759 * (&r + &2* &s - &4) + else #0.0`;; + +let tame_table_d = new_definition + `tame_table_d r s = if (r + 2*s > 3) + then #0.103 * (&2 - &s) + #0.2759 * (&r + &2* &s - &4) + else #0.0`;; (* preferred term *) + + +let d2_special = new_definition + `d2_special (V,E,f,S) = d2_tame (r_special (V,E,f,S)) (s_special (V,E,f,S))`;; + +let vertex_datum = new_definition + `vertex_datum p k = IMAGE p (0..(k-1))`;; + +let edge_datum = new_definition + `edge_datum p k = { { p i, p ((i+1) MOD k) } |i| i IN (0..(k-1)) }`;; + +let face_datum = new_definition + `face_datum p k = { (p i, p ((i+1) MOD k)) |i| i IN (0..(k-1)) }`;; + +let special_datum = new_definition + `special_datum p k J = { (p i, (p((i+1) MOD k))) | i | i IN J }`;; + +let fan_datum = new_definition + `fan_datum p k J <=> + IMAGE p (0..(k-1)) SUBSET ball_annulus /\ + (!i j. (i < k) /\ (j < k) /\ dist(p i,p j) < &2 ==> (i=j)) /\ + (!i. (i dist(p i, p ((i+1) MOD k)) = &2 * h0) /\ + (!i. (i dist(p i, p ((i+1) MOD k)) <= &2 * h0) /\ + (!i j. (i+1 &2 * h0 <= dist(p i, p j)) /\ + (CARD(J) <= 3) /\ (3 <= k) /\ (k + CARD(J) <= 6) /\ + (!i. (i azim (vec 0) (p i) (p ((i+1) MOD k)) (p ((i + k - 1) MOD k)) <= pi) /\ + (!i j. (i p j IN cwedge (vec 0) (p i) (p ((i+1) MOD k)) (p ((i + k - 1) MOD k)) )`;; + +let vertex_slice = new_definition + `vertex_slice (V,E,f) v j = { (rho_node1 (V,E,f) POWER i) v | i IN (1..j) }`;; + +let edge_slice = new_definition + `edge_slice (V,E,f) v j = { (rho_node1 (V,E,f) POWER j) v, v } INSERT + { {(rho_node1 (V,E,f) POWER i) v , (rho_node1 (V,E,f) POWER (i+1)) v } | i IN (1..(j-1)) }`;; + +let face_slice = new_definition + `face_slice (V,E,f) v j = ( (rho_node1 (V,E,f) POWER j) v, v ) INSERT + { ((rho_node1 (V,E,f) POWER i) v , (rho_node1 (V,E,f) POWER (i+1)) v ) | i IN (1..(j-1)) }`;; + +let kmin = new_definition + `kmin = (minimal) + ({ k | (k=0) /\ (! V E f S. special_fan (V,E,f,S) ==> + tauVEF (V,E,f) >= d2_special (V,E,f,S) ) } UNION + { k | ? V E f S. (k= CARD(E)) /\ special_fan (V,E,f,S) /\ tauVEF(V,E,f) < d2_special (V,E,f,S) } )`;; + +let taumin = new_definition + `taumin = inf ( + { tauVEF (V,E,f) - d2_special (V,E,f,S) | special_fan (V,E,f,S) /\ (kmin = CARD E) } UNION + { t | (t= &0) /\ (kmin = 0) })`;; + +let minimal_fan = new_definition + `minimal_fan (V,E,f,S) <=> special_fan (V,E,f,S) /\ (kmin = CARD E) /\ + (taumin = tauVEF (V,E,f) - d2_special (V,E,f,S))`;; + +let s_extremal_edge = new_definition + `s_extremal_edge (V,E,f,S) (v,w) <=> (v,w ) IN S \/ (dist(v,w) IN {&2, &2 * h0 }) `;; + +let s_minimal_edge = new_definition + `s_minimal_edge (V,E,f,S) (v,w) <=> (v,w) IN S \/ (dist(v,w) = &2) `;; + +let special_feature_extreme_edge = new_definition + `special_feature_extreme_edge (V,E,f,S) = (!v w. {v,w} IN E ==> s_extremal_edge (V,E,f,S) (v,w))`;; + + + + +end;; diff --git a/legacy/oldlocal/ch_local/local_defs2.hl b/legacy/oldlocal/ch_local/local_defs2.hl new file mode 100644 index 0000000..c42c7f1 --- /dev/null +++ b/legacy/oldlocal/ch_local/local_defs2.hl @@ -0,0 +1,126 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Definitions File *) +(* Chapter: Local Fan *) +(* Author: Thomas C. Hales *) +(* Date: 2010-02-25 *) +(* ========================================================================== *) + + + + +module Local_defs = struct + +(* the definition of hypermap *) + +let exist_hypermap = prove(`?H:((A->bool)#(A->A)#(A->A)#(A->A)). FINITE (FST H) /\ (FST(SND H)) permutes (FST H) /\ (FST(SND(SND H))) permutes (FST H) /\ (SND(SND(SND H))) permutes (FST H) /\ (FST(SND H)) o (FST(SND(SND H))) o (SND(SND(SND H))) = I`,EXISTS_TAC +`({},I,I,I):(A->bool)#(A->A)#(A->A)#(A->A)` THEN REWRITE_TAC[FINITE_RULES; PERMUTES_I; I_O_ID]);; + +let hypermap_tybij = (new_type_definition "hypermap" ("hypermap", "tuple_hypermap")exist_hypermap);; + +let dart = new_definition `dart (H:(A)hypermap) = FST (tuple_hypermap H)`;; + +let edge_map = new_definition `edge_map (H:(A)hypermap) = FST(SND(tuple_hypermap H))`;; + +let node_map = new_definition `node_map (H:(A)hypermap) = FST(SND(SND(tuple_hypermap H)))`;; + +let face_map = new_definition `face_map (H:(A)hypermap) = SND(SND(SND(tuple_hypermap H)))`;; + +(* edges, nodes and faces of a hypermap *) + +parse_as_infix("POWER",(24,"right"));; + +let POWER = new_recursive_definition num_RECURSION + `(!(f:A->A). f POWER 0 = I) /\ + (!(f:A->A) (n:num). f POWER (SUC n) = (f POWER n) o f)`;; + +let orbit_map = new_definition `orbit_map (f:A->A) (x:A) = {(f POWER n) x | n >= 0}`;; + +let edge = new_definition `edge (H:(A)hypermap) (x:A) = orbit_map (edge_map H) x`;; + +let node = new_definition `node (H:(A)hypermap) (x:A) = orbit_map (node_map H) x`;; + +let face = new_definition `face (H:(A)hypermap) (x:A) = orbit_map (face_map H) x`;; + +(* some definitions on orbits *) + +let set_of_orbits = new_definition `set_of_orbits (D:A->bool) (f:A->A) = {orbit_map f x | x IN D}`;; + +let number_of_orbits = new_definition `number_of_orbits (D:A->bool) (f:A->A) = CARD(set_of_orbits D f)`;; + + +(* the orbits on hypermaps*) + +let edge_set = new_definition `edge_set (H:(A)hypermap) = set_of_orbits (dart H) (edge_map H)`;; + +let node_set = new_definition `node_set (H:(A)hypermap) = set_of_orbits (dart H) (node_map H)`;; + +let face_set = new_definition `face_set (H:(A)hypermap) = set_of_orbits (dart H) (face_map H)`;; + + +(* some special kinds of hypergraphs *) + +let plain_hypermap = new_definition `plain_hypermap (H:(A)hypermap) <=> edge_map H o edge_map H = I`;; + + +let simple_hypermap = new_definition `simple_hypermap (H:(A)hypermap) <=> + (!x:A. x IN dart H ==> (node H x) INTER (face H x) = {x})`;; + +(* fan definitions *) + +let graph = new_definition `graph E <=> (!e. E e ==> (e HAS_SIZE 2))`;; + +let fan1 = new_definition`fan1(x,V,E):bool <=> FINITE V /\ ~(V SUBSET {}) `;; + +let fan2 = new_definition`fan2(x,V,E):bool <=> ~(x IN V)`;; + +let fan6= new_definition`fan6(x,V,E):bool<=>(!e. (e IN E) ==> ~(collinear ({x} UNION e)))`;; + +let fan7= new_definition`fan7(x,V,E):bool<=> (!e1 e2. (e1 IN E UNION {{v}| v IN V}) /\ (e2 IN E UNION {{v}| v IN V}) +==> ((aff_ge {x} e1) INTER (aff_ge {x} e2) = aff_ge {x} (e1 INTER e2)))`;; + +let FAN=new_definition`FAN(x,V,E) <=> ((UNIONS E) SUBSET V) /\ graph(E) /\ fan1(x,V,E) /\ fan2(x,V,E)/\ +fan6(x,V,E)/\ fan7(x,V,E)`;; + + +let base_point_fan=new_definition`base_point_fan (x,V,E)=x`;; + +let set_of_edges=new_definition`set_of_edges v E={w|{v,w} IN E}`;; + +let set_of_edge=new_definition`set_of_edge v V E={w|{v,w} IN E /\ w IN V}`;; + +(* local fan def. To Here. *) + +let zfan = new_definition `zfan (V,E) = FAN (vec 0 ,V,E)`;; + +let hypermap_of_fan = `hypermap_of_zfan + (V,E) = `;; + +let tuple_of_dart = `tuple_of_dart (V,E) + (v,w) = + (vec 0 , v , w, ...)`;; + +let azim_fandart = `azim_fandart H (v,w) = + (let (v0,v1,v2,v3) = tuple_of_dart H (v,w) + in azim v0 v1 v2 v3) `;; + +let WRGCVDR1_concl = `!(V,E,f). convex_local_fan (V,E,f) ==> BIJ (\ (v,w). v) f V`;; + +let WRGCVDR2_concl = `!(V,E,f). convex_local_fan (V,E,f) ==> cyclic_permutation rho_convex_local_fan V`;; + +(* nd = FST *) + + +let LVDUCXU1_concl = `!V E f. zfan (V,E) /\ + (f IN face_set(hypermap_of_zfan (V,E))) + ==> local_fan (localization(V,E,f)) + `;; + +let LVDUCXU2_concl = `!V E f x. zfan (V,E) /\ + (f IN face_set(hypermap_of_zfan (V,E))) /\ + (x IN f) + ==> (tuple_of_dart H x = tuple_of_dart + + +end;; diff --git a/legacy/oldlocal/ch_local/local_fan.ml b/legacy/oldlocal/ch_local/local_fan.ml new file mode 100644 index 0000000..819e227 --- /dev/null +++ b/legacy/oldlocal/ch_local/local_fan.ml @@ -0,0 +1,211 @@ +(* +Created Nov 26, 2009 +THALES +Compute irreducible cyclic fans. +*) + +(* +Needs. +k nodes, k edges {i,i+1}, +cyclic map on both +Each node is 2, 2h0 or free. +Each node is flat or not flat. + +Each edge is in G or not, +Each edge is 2, 2h0, or free. + +*) +open List;; + +(* from lpproc.ml *) +let upto = + let rec rangeA a i j = if (i >= j) then a + else rangeA ((j-1)::a) i (j-1) in + rangeA [] 0;; + + +(* minimal fan definition *) + +type node_t = N2 | N2h0 | Nfree;; +type edge_t = E2 | E2h0 | Gset;; + + +type minimal_fan = { + node : node_t list; + nodeflats : bool list; + edge : edge_t list; +};; + +let mk_minimal_fan nhts nflts e = + { + node = nhts; + nodeflats = nflts; + edge = e; + };; + + +(* generating minimal_fan *) + +let node_of_int i = if (i=0) then N2 else if (i=1) then N2h0 else Nfree;; +let edge_of_int i = if (i=0) then E2 else if (i=1) then E2h0 else Gset;; +let bool_of_int i = if (i=0) then false else true;; + +let base modulus len k = + let rec baselist modulus len k acc = + if len <= 0 then acc else + if (k=0) then baselist modulus (len-1) 0 (0::acc) + else + baselist modulus (len - 1) (k/modulus) ((k mod modulus) :: acc) in + baselist modulus len k [];; + +let rec pow base exp = + if exp = 0 then 1 else base*(pow base (exp-1));; + +let mk_x len (a,b,c) (r,s,t) = + let (n,nf,e) = (base a len r, base b len s, base c len t) in + mk_minimal_fan + (map node_of_int n) + (map bool_of_int nf) + (map edge_of_int e);; + +(* reading data from a record *) + +let kn mf = length (mf.node);; +let sn mf = List.length (filter ((=) Gset) mf.edge);; +let rn mf = kn mf - sn mf;; + +let posmod i m = + let j = i mod m in + if (j<0) then j+m else j;; + +let part xs i = nth xs (posmod i (length xs));; + +let number mf = upto(length mf.edge);; + +let g_edge mf i = (part mf.edge i = Gset);; +(* let nong_edge mf i = not(g_edge mf i);; *) +let gminimal_edge mf i = not(part mf.edge i = E2h0);; + +let flat_node mf i = part mf.nodeflats i;; +let nonflat_node mf i = not(flat_node mf i);; +let bound_node mf i = not(part mf.node i = Nfree);; + +(* irreducibility *) + +(* extreme_edge is built into construction of edge types *) + +let card mf = (sn mf <= 3) && (3 <= sn mf + rn mf) && (rn mf + 2 * sn mf <= 6);; + +let extreme_edge mf = true;; + +let flat_exists mf = + let has i = (kn mf <= 4) or + flat_node mf i or flat_node mf (i+1) or flat_node mf (i+2) or flat_node mf (i+3) in + for_all has (number mf);; + +let no_triple_flat mf = + let triple_flat i = flat_node mf i && flat_node mf (i+1) && flat_node mf (i+2) in + not (exists triple_flat (number mf));; + +let balance mf = + let es = mf.edge in + let has_balance i = (part es i = part es (i+1)) or (part es i = Gset) or (part es (i+1) = Gset) in + for_all has_balance (number mf);; + +let g_flat mf = + let gg = g_edge mf in + let nf = nonflat_node mf in + let has_gflat i = nf i or nf (i+1) or not(gg (i-1) or gg i or gg(i+1) ) in + for_all has_gflat (number mf);; + +let flat_middle mf = + let nf = nonflat_node mf in + let has i = nf i or nf (i+1) or (part mf.edge i = E2 ) in + for_all has (number mf);; + +let minimal_node mf = + let has i = (part mf.node i = N2) or (gminimal_edge mf i) or (gminimal_edge mf (i-1)) in + for_all has (number mf);; + +let minimal_node_flat mf = + let has i = (nonflat_node mf i) or (part mf.node i = N2) or (gminimal_edge mf i && gminimal_edge mf (i-1)) in + for_all has (number mf);; + +let flat_extremal mf = + let has i = nonflat_node mf i or nonflat_node mf (i+1) or bound_node mf i or bound_node mf (i+1) in + for_all has (number mf);; + +let extremal_node mf = + let has i = flat_node mf i or flat_node mf (i+1) or flat_node mf (i+2) or bound_node mf (i+1) in + for_all has (number mf);; + +let flat_extremal_node mf = + let has i = flat_node mf i or nonflat_node mf (i+1) or flat_node mf (i+2) or flat_node mf (i+3) or bound_node mf (i+1) or bound_node mf (i+2) in + for_all has (number mf);; + +let flat_extremal_node_sym mf = + let has i = flat_node mf i or flat_node mf (i+1) or nonflat_node mf (i+2) or flat_node mf (i+3) or bound_node mf (i+1) or bound_node mf (i+2) in + for_all has (number mf);; + +let flat_count mf = + length (filter not mf.nodeflats) > 2;; + +let irreducible = + fold_right (fun r s m -> r m && s m) + [card;extreme_edge;flat_exists;no_triple_flat;balance;g_flat; + flat_middle;minimal_node;minimal_node_flat;flat_extremal; + extremal_node;flat_extremal_node;flat_extremal_node_sym; + flat_count] +(fun t->true);; + + +(* symmetry reductions, add to the list of solutions only if it is shift-distinct from other solutions *) + +let shift_one (x::xs) = xs @ [x];; + +let shift a = { node = shift_one a.node; nodeflats = shift_one a.nodeflats; edge = shift_one a.edge };; + +let rec shiftk k a = if (k<=0) then a else shift (shiftk (k-1) a);; + +let add_if_new a xs = + if (exists (fun i -> mem (shiftk i a) xs) (upto (kn a))) then xs else a::xs;; +let add_if_irred a xs = if (irreducible a ) then add_if_new a xs else xs;; +(* let add_if_irred a xs = if (irreducible a ) then a ::xs else xs;; *) + +let rec mk_all mkfn (imin,jmin,kmin) (imax,jmax,kmax) (i, j, k) acc = + let acc' = add_if_irred (mkfn (i, j, k)) acc in + let mka = mk_all mkfn (imin,jmin,kmin) (imax,jmax,kmax) in + if (k+1 < kmax) then mka (i,j,(k+1)) acc' + else if (j+1 < jmax) then mka (i,(j+1),kmin) acc' + else if (i+1 < imax) then mka ((i+1),jmin,kmin) acc' + else acc';; + +(* no flats *) +let a3 = mk_all (mk_x 3 (3,1,3)) (0,0,0) (pow 3 3,1,pow 3 3) (0,0,0) [];; +length a3;; + +(* no flats *) +let a4nf = mk_all (mk_x 4 (3,1,3)) (0,0,0) (pow 3 4,1,pow 3 4) (0,0,0) [];; +length a4nf;; + +(* exactly one flat *) +let a4f = mk_all (mk_x 4 (3,2,3)) (0,1,0) (pow 3 4,2,pow 3 4) (0,1,0) [];; +length a4f;; + +(* no Gset *) +(* +let a5ng =mk_all (mk_x 5 (3,2,2)) (0,0,0) (pow 3 5,pow 2 5,pow 2 5) (0,0,0) [];; +length a5ng;; +*) + +let a5 = mk_all (mk_x 5 (3,2,3)) (0,0,0) (pow 3 5,pow 2 5,pow 3 5) (0,0,0) [];; +length a5;; + +(* no Gset *) +let a6 = mk_all (mk_x 6 (3,2,2)) (0,0,0) (pow 3 6,pow 2 6,pow 2 6) (0,0,0) [];; +length a6;; + +(* degrees of freedom *) + +let freedom a = (kn a) - 3 + length (filter ((=) Nfree) a.node) - length (filter (fun t->t) a.nodeflats);; +map freedom a4nf;; diff --git a/legacy/oldlocal/nguyenquangtruong270983/JBDNJJB.hl b/legacy/oldlocal/nguyenquangtruong270983/JBDNJJB.hl new file mode 100644 index 0000000..4e832aa --- /dev/null +++ b/legacy/oldlocal/nguyenquangtruong270983/JBDNJJB.hl @@ -0,0 +1,305 @@ + +(* +JBDNJJB + +This is code that Nguyen Quang Truong sent me purporting to be a proof of JBDNJJB. +However, it seems to be buggy. --Thales + +Here is the proof of this lemma. It should be loaded after loading +sphere.hl and trg2.ml. +*) + +parse_as_infix("re_eqvl",(12,"right"));; + +let re_eqvl = new_definition ` a re_eqvl (b:real) + <=> (? t. &0 < t /\ a = t * b )`;; + + + + +let VEC_DIV_MOV = prove( +` ~( a = &0 ) ==> (( b / a ) % x = y <=> +b % x = a % y ) `, +SIMP_TAC[MESON[VECTOR_MUL_LCANCEL]` ~( a = &0 ) ==> +(( b / a ) % x = y <=> a % ( b / a) % x = a % y ) `; +VECTOR_MUL_ASSOC; REAL_DIV_LMUL]);; + + +g `sin ( azim ( vec 0 ) u v w ) re_eqvl (u cross v ) dot w `;; +e (ASM_CASES_TAC `(u:real^3) = vec 0 ` THENL [ + +ASM_SIMP_TAC[AZIM_DEGENERATE; CROSS_0; DOT_LZERO; +SIN_0; re_eqvl] THEN EXISTS_TAC `&1` THEN REAL_ARITH_TAC; + + +ASM_CASES_TAC` collinear {vec 0, u, (v:real^3)}`] + +THENL [ + + +FIRST_X_ASSUM MP_TAC THEN ASM_SIMP_TAC[GSYM CROSS_EQ_0] THEN +REWRITE_TAC[CROSS_EQ_0] THEN +ASM_SIMP_TAC[AZIM_DEGENERATE; CROSS_0; DOT_LZERO; +SIN_0; re_eqvl] THEN +DISCH_TAC THEN +EXISTS_TAC `&1 ` THEN +REAL_ARITH_TAC; + +ASM_CASES_TAC` collinear {vec 0, u, (w:real^3)}`] THENL [ + +FIRST_X_ASSUM MP_TAC THEN ASM_SIMP_TAC[GSYM CROSS_EQ_0] THEN +REWRITE_TAC[CROSS_EQ_0] THEN +ONCE_REWRITE_TAC[GSYM CROSS_TRIPLE] THEN +ONCE_REWRITE_TAC[SET_RULE[]` {a,b} = {b,a}`] THEN +ASM_SIMP_TAC[AZIM_DEGENERATE;GSYM CROSS_EQ_0] THEN +ASM_SIMP_TAC[CROSS_EQ_0] THEN +ASM_SIMP_TAC[AZIM_DEGENERATE; CROSS_0; DOT_LZERO; +SIN_0; re_eqvl; SET_RULE[]` {a,b} = {b,a}`] THEN +DISCH_TAC THEN +EXISTS_TAC `&1 ` THEN +REAL_ARITH_TAC; +ABBREV_TAC ` e3 = &1 / norm (u:real^3) % u ` THEN +ABBREV_TAC `v' = v - (e3 dot v) % (e3:real^3) ` THEN +ABBREV_TAC `(e1:real^3) = &1 / norm (v') % v' ` THEN +ABBREV_TAC ` e2 = e3 cross e1 ` THEN +SUBGOAL_THEN `orthonormal e1 e2 e3 ` ASSUME_TAC] + + + + + + + + + + + + +THENL [ +REWRITE_TAC[orthonormal] THEN +EXPAND_TAC "e2" THEN +REWRITE_TAC[DOT_CROSS_SELF; DOT_CROSS] THEN +SUBGOAL_THEN `~((v':real^3) = vec 0)` ASSUME_TAC THENL [ + + +EXPAND_TAC "v'" THEN +EXPAND_TAC "e3" THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN +ASSUME_TAC2 (ISPECL [`u:real^3 `;` v:real^3 `] + NOT_EQ_VEC0_IMP_EQU_AFF_COLL) THEN +UNDISCH_TAC `~ collinear {vec 0, u, (v:real^3)}` THEN +FIRST_X_ASSUM MP_TAC THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +SIMP_TAC[] THEN +DISCH_TAC THEN +REWRITE_TAC[AFF2_VEC0; IN_ELIM_THM; VECTOR_ARITH` vec 0 = +x - y <=> x = y `] THEN +MESON_TAC[]; + + +SUBGOAL_THEN `e3 dot (e3:real^3) = &1 /\ e1 dot (e1:real^3) += &1 ` ASSUME_TAC] THENL [ + +EXPAND_TAC "e3" THEN +EXPAND_TAC "e1" THEN +REWRITE_TAC[DOT_LMUL; DOT_RMUL; GSYM NORM_POW_2] THEN +UNDISCH_TAC `~((u:real^3) = vec 0 ) ` THEN +UNDISCH_TAC `~((v':real^3) = vec 0) ` THEN +REWRITE_TAC[GSYM NORM_EQ_0] THEN +PHA THEN CONV_TAC REAL_FIELD; + + + +SUBGOAL_THEN `e1 dot (e3: real^3) = &0 ` ASSUME_TAC] THENL [ + + +EXPAND_TAC "e1" THEN +EXPAND_TAC "v'" THEN +REWRITE_TAC[DOT_LSUB; DOT_LMUL; REAL_MUL_RID] THEN +ASM_SIMP_TAC[REAL_MUL_RID; DOT_SYM; REAL_SUB_REFL; +REAL_MUL_RZERO]; + + + +ASM_SIMP_TAC[DOT_SYM] THEN +ONCE_REWRITE_TAC[DOT_SYM] THEN +ONCE_REWRITE_TAC[GSYM CROSS_TRIPLE] THEN +EXPAND_TAC "e2" THEN +REWRITE_TAC[DOT_CROSS] THEN +ASM_SIMP_TAC[DOT_SYM] THEN +REAL_ARITH_TAC]; + +MP_TAC (let ddd = (let dd = SPEC_ALL (SPECL [`v: real^3 `;` vec 0 : real^3 +`;`u:real^3 `; +`w:real^3 `] SPHERICAL_COORDINATES) in SPEC `dist(vec 0, w:real^3 )` +(GEN `r:real` dd)) in +SPEC ` azim ( vec 0 ) u v w ` (GEN `theta: real` +(SPEC `arcV ( vec 0) w (u:real^3) ` (GEN `phi: real` ddd)))) THEN +ANTS_TAC]);; + + + + + +e (ASM_REWRITE_TAC[dist; VECTOR_SUB_RZERO] THEN +EXPAND_TAC "e3" THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN +UNDISCH_TAC `~((u:real^3) = vec 0 ) ` THEN +SIMP_TAC[GSYM NORM_EQ_0; REAL_FIELD` ~( x = &0) ==> +x * &1 / x = &1 `; VECTOR_MUL_LID] THEN +SUBGOAL_THEN `DISJOINT {vec 0, u} {v:real^3 }` ASSUME_TAC + + +THENL [ + + + +REWRITE_TAC[DISJOINT; SET_RULE[]` {a,b} INTER {c} = {} +<=> ~( c = a ) /\ ~( c = b ) `] THEN +(let drt = STRIP_TAC THEN +UNDISCH_TAC `~ collinear { vec 0, u, (v:real^3)} ` THEN +ASM_SIMP_TAC[INSERT_AC; COLLINEAR_2] in CONJ_TAC THENL [drt; +drt]); + + +FIRST_X_ASSUM MP_TAC THEN +NHANH AFF_GT_2_1 THEN +PHA THEN SIMP_TAC[] THEN +STRIP_TAC THEN +REWRITE_TAC[IN_ELIM_THM] THEN +EXPAND_TAC "e1" THEN +EXPAND_TAC "v'" THEN +SIMP_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID; +VECTOR_SUB_LDISTRIB] THEN +SUBGOAL_THEN `~( v - (e3 dot v) % (e3:real^3) += vec 0) ` ASSUME_TAC] THENL [ + + + +EXPAND_TAC "e3" THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN +UNDISCH_TAC `~ collinear {vec 0, u, (v:real^3)}` THEN +FIRST_X_ASSUM MP_TAC THEN +REWRITE_TAC[NORM_EQ_0] THEN +PAT_ONCE_REWRITE_TAC `\x. x ==> _ ` [EQ_SYM_EQ] THEN +NHANH (GSYM (ISPECL [`u:real^3 `;` v:real^3 `] +NOT_EQ_VEC0_IMP_EQU_AFF_COLL)) THEN +SIMP_TAC[] THEN DISCH_TAC THEN +REWRITE_TAC[AFF2_VEC0; IN_ELIM_THM; VECTOR_SUB_EQ] THEN +MESON_TAC[]; + + +ABBREV_TAC `r3 = e3 dot (v:real^3 ) ` THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN +ABBREV_TAC `e33 = r3 % (e3: real^3) ` THEN +EXPAND_TAC "e3" THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN +EXISTS_TAC ` &1 - &1 / norm ((v:real^3 ) - +e33) + (&1 / norm ((v:real^3) - e33) * r3) * &1 / norm (u:real^3) ` THEN +EXISTS_TAC `-- (&1 / norm ((v:real^3) - e33) * r3) * &1 / norm (u:real^3)` +THEN +EXISTS_TAC `&1 / norm ((v:real^3) - e33)` THEN +CONJ_TAC THENL [ + + +MATCH_MP_TAC REAL_LT_DIV THEN +UNDISCH_TAC `~((v:real^3) - e33 = vec 0) ` THEN +REWRITE_TAC[GSYM NORM_POS_LT] THEN +SIMP_TAC[] THEN REAL_ARITH_TAC; +CONJ_TAC THENL [REAL_ARITH_TAC; +CONV_TAC VECTOR_ARITH]]]);; + + +e (SUBGOAL_THEN `~( v - (e3 dot v) % (e3:real^3) += vec 0) ` ASSUME_TAC);; + + +e (EXPAND_TAC "e3" THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN +UNDISCH_TAC `~ collinear {vec 0, u, (v:real^3)}` THEN +UNDISCH_TAC ` ~( (u:real^3) = vec 0) ` THEN +REWRITE_TAC[NORM_EQ_0] THEN +PAT_ONCE_REWRITE_TAC `\x. x ==> _ ` [EQ_SYM_EQ] THEN +NHANH (GSYM (ISPECL [`u:real^3 `;` v:real^3 `] +NOT_EQ_VEC0_IMP_EQU_AFF_COLL)) THEN +SIMP_TAC[] THEN DISCH_TAC THEN +REWRITE_TAC[AFF2_VEC0; IN_ELIM_THM; VECTOR_SUB_EQ] THEN +MESON_TAC[]);; + + + +e (SUBST_ALL_TAC (SYM (ISPEC `u:real^3 ` NORM_EQ_0)));; +e (ASSUME_TAC2 (ISPECL [`&1 `;` u: real^3 `; ` norm (u:real^3)` +; `e3: real^3`] (GEN_ALL VEC_DIV_MOV)));; +e (SUBST_ALL_TAC (ISPEC `u:real^3 ` VECTOR_MUL_LID));; +e (FIRST_X_ASSUM SUBST_ALL_TAC);; +e (ABBREV_TAC ` azzz = azim (vec 0) u v w `);; +e (ABBREV_TAC `arrr = arcV (vec 0) w (u:real^3)`);; +e (ABBREV_TAC ` diii = dist( vec 0, (w:real^3))`);; + + +e (SIMP_TAC[VECTOR_ADD_LID]);; +e (DISCH_TAC);; +e (ABBREV_TAC `no_u = norm (u:real^3)`);; +e (ASM_REWRITE_TAC[]);; +e (UNDISCH_TAC ` (v:real^3) - (e3 dot v ) %e3 += v' `);; +e (ABBREV_TAC ` era = e3 dot (v:real^3) `);; +e (REWRITE_TAC[VECTOR_ARITH` a - b = (x:real^N) <=> +a = x + b `]);; +e (SIMP_TAC[CROSS_RADD; CROSS_RMUL; CROSS_LMUL; +CROSS_REFL; VECTOR_MUL_RZERO; VECTOR_ADD_RID]);; +e (REWRITE_TAC[VECTOR_ARITH` a = b + (c:real^N) <=> +a - c = b `]);; +e (DISCH_THEN SUBST_ALL_TAC);; +e (UNDISCH_TAC ` &1 / norm v' % (v':real^3) = e1 `);; +e (UNDISCH_TAC `~((v':real^3) = vec 0 ) `);; +e (SIMP_TAC[GSYM NORM_EQ_0; VEC_DIV_MOV; VECTOR_MUL_LID]);; +e (ABBREV_TAC `nov' = norm (v':real^3) `);; +e (SIMP_TAC[CROSS_RMUL]);; +e (STRIP_TAC);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[VECTOR_MUL_ASSOC; DOT_RADD; DOT_RMUL; +DOT_LMUL]);; +e (UNDISCH_TAC `orthonormal e1 e2 e3 `);; +e (REWRITE_TAC[orthonormal]);; +e (SIMP_TAC[DOT_SYM; REAL_MUL_RZERO; REAL_ADD_LID; REAL_ADD_RID]);; +e (DISCH_TAC);; +e (REWRITE_TAC[REAL_ARITH`(a * b * c ) * (d * e ) * &1 += (a * c * d * e ) * b `; re_eqvl]);; +e (EXISTS_TAC ` &1 / ( diii * sin arrr * no_u * nov') `);; +e (SUBGOAL_THEN ` &0 < diii * sin arrr * no_u * nov' ` +ASSUME_TAC);; +e (MATCH_MP_TAC ( +MESON[REAL_LT_MUL]` &0 < a /\ &0 < b /\ &0 < c /\ &0 < d +==> &0 < b * a * c * d `));; +e (CONJ_TAC);; +e (EXPAND_TAC "arrr");; +e (UNDISCH_TAC `~ collinear {vec 0, u, (w:real^3)}`);; +e (SIMP_TAC[ARC_SYM; NOT_COLL_IM_SIN_LT]);; + + + +e (UNDISCH_TAC `~(no_u = &0) `);; +e (UNDISCH_TAC ` ~(nov' = &0)`);; +e (UNDISCH_TAC `~ collinear {vec 0, u, (w:real^3)}`);; +e (NHANH NOT_COLLINEAR_IMP_2_UNEQUAL);; +e (STRIP_TAC);; +e (FIRST_X_ASSUM MP_TAC);; +e (SIMP_TAC[DIST_NZ]);; +e (EXPAND_TAC "diii");; +e (EXPAND_TAC "no_u");; +e (EXPAND_TAC "nov'");; +e (DISCH_TAC);; +e (PHA THEN CONV_TAC NORM_ARITH);; + + + +e (CONJ_TAC);; +e (MATCH_MP_TAC REAL_LT_DIV);; +e (FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC);; + + +e (FIRST_X_ASSUM MP_TAC);; +e (NHANH REAL_POS_NZ);; +e (SIMP_TAC[REAL_MUL_ASSOC; NOT_0_INVERTABLE; REAL_MUL_LID]);; diff --git a/legacy/oldlocal/nguyenquangtruong270983/WRGCVDR_CIZMRRH.hl b/legacy/oldlocal/nguyenquangtruong270983/WRGCVDR_CIZMRRH.hl new file mode 100644 index 0000000..06a1438 --- /dev/null +++ b/legacy/oldlocal/nguyenquangtruong270983/WRGCVDR_CIZMRRH.hl @@ -0,0 +1,2203 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Definitions: *) +(* Chapter: Local Fan *) +(* Author: Truong Nguyen Quang *) +(* Date: 2010-03 - 30 *) +(* ========================================================================== *) + +(* needs "/home/user1/flyspeck/working/flyspeck_needs.hl";; *) +(* =========== snapshot 1631 ===================== *) + +module Wrgcvdr (* : Trigonometry2_type *) = struct + +let build_sequence = + ["general/sphere.hl"; + "general/prove_by_refinement.hl"; +(* "leg/geomdetail.hl"; + "leg/affprops.hl"; + "leg/cayleyR_def.hl"; + "leg/collect_geom.hl"; +(* flyspeck_needs "leg/collect_geom2.hl";*) (* slow and rarely needed *) + "nonlinear/ineq.hl"; + "nonlinear/ineqdata3q1h.hl"; *) + "trigonometry/trig1.hl"; + "trigonometry/trig2.hl"; +(* "trigonometry/trigonometry.hl"; + "volume/vol1.hl"; *) + "hypermap/hypermap.hl"; + "fan/fan.hl"];; + +map flyspeck_needs build_sequence;; + +open Sphere;; +open Trigonometry1;; +open Trigonometry2;; +open Hypermap;; +open Fan;; +open Prove_by_refinement;; + + +let SET_TAC = let basicthms = +[NOT_IN_EMPTY; IN_UNIV; IN_UNION; IN_INTER; IN_DIFF; IN_INSERT; +IN_DELETE; IN_REST; IN_INTERS; IN_UNIONS; IN_IMAGE] in +let allthms = basicthms @ map (REWRITE_RULE[IN]) basicthms @ +[IN_ELIM_THM; IN] in +let PRESET_TAC = +TRY(POP_ASSUM_LIST(MP_TAC o end_itlist CONJ)) THEN +REPEAT COND_CASES_TAC THEN +REWRITE_TAC[EXTENSION; SUBSET; PSUBSET; DISJOINT; SING] THEN +REWRITE_TAC allthms in +fun ths -> +PRESET_TAC THEN +(if ths = [] then ALL_TAC else MP_TAC(end_itlist CONJ ths)) THEN +MESON_TAC ths ;; + +(* =========== improved SET_RULE ============= *) +let SET_RULE a = fun x -> prove(x, SET_TAC a );; + + + +let all_hy_map = let t1 = CONJ dart edge_map in +let t2 = CONJ t1 node_map in +CONJ t2 face_map;; + + + +let SPEC_HY_ELEMS = prove_by_refinement( +`! (H: (A)hypermap) . tuple_hypermap H = (D,e,n,f) <=> +dart H = D /\ edge_map H = e /\ node_map H = n /\ face_map H = f `, +[ REWRITE_TAC[dart; all_hy_map]; +GEN_TAC THEN EQ_TAC; +SIMP_TAC[FST; SND; PAIR]; +DISCH_TAC; +PAT_ONCE_REWRITE_TAC`\x. x = y ` [GSYM PAIR] THEN +REWRITE_TAC[PAIR_EQ] THEN ASM_SIMP_TAC[]; +PAT_ONCE_REWRITE_TAC`\x. x = y ` [GSYM PAIR] THEN +REWRITE_TAC[PAIR_EQ] THEN ASM_SIMP_TAC[]; +PAT_ONCE_REWRITE_TAC`\x. x = y ` [GSYM PAIR] THEN +REWRITE_TAC[PAIR_EQ] THEN ASM_SIMP_TAC[]]);; + +(* =============================== *) +(* =============================== *) + +let hypermap = prove_by_refinement( +`! H: (A) hypermap. tuple_hypermap H = D,e,n,f ==> +e permutes D /\ n permutes D /\ f permutes D /\ e o n o f = I `, +[REWRITE_TAC[SPEC_HY_ELEMS]; +GEN_TAC THEN MP_TAC (SPEC_ALL hypermap_lemma); +ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> b ==> a ==> c `]; +SIMP_TAC[]]);; + + +parse_as_infix("has_orders",(12,"right"));; +parse_as_infix("cyclic_on",(13,"right"));; + +let has_orders = new_definition ` (f: A -> A) has_orders k <=> +(! i. 0 < i /\ i < k ==> ~( ITER i f = I )) /\ +ITER k f = I `;; + +let cyclic_on = new_definition` f cyclic_on (S:A -> bool) <=> +(! x. x IN S ==> S = {z | ?n. z = ITER n f x }) `;; + + +let dih2k = new_definition` dih2k (H: (A) hypermap) k <=> +CARD (dart H) = 2 * k +/\ (! x. x IN (dart H) ==> let S = face H x in + dart H = S UNION (IMAGE (node_map H) S )) +/\ (face_map H ) has_orders k /\ +(edge_map H ) has_orders 2 /\ +(node_map H) has_orders 2 `;; + + +let EE = new_definition` EE v S = {w | {v,w} IN S }`;; + +let ord_pairs = new_definition` ord_pairs E = { a,b | {a,b} IN E } `;; + +let self_pairs = new_definition` self_pairs E V = { (v,v) | v IN V /\ + EE v E = {} } `;; + +let darts_of_hyp = new_definition` darts_of_hyp E V = ord_pairs E UNION +self_pairs E V `;; + +let e_of_hyp = new_definition` e_of_hyp ((a:real^3),(b:real^3)) = (b,a) `;; + +let n_of_hyp = new_definition` n_of_hyp (x,V,E) (v,u) = +(v, azim_cycle (EE v E) x v u) `;; + +let ivs_azim_cycle = new_definition`ivs_azim_cycle W v0 v w = +(@x. x IN W /\ azim_cycle W v0 v x = w ) `;; + + +let f_of_hyp = new_definition` f_of_hyp (x,V,E) (v,u) = +(u, ivs_azim_cycle (EE u E) x u v) `;; + +let HYP = new_definition` HYP (x,V,E) = (darts_of_hyp E V, +e_of_hyp, n_of_hyp (x,V,E), f_of_hyp (x,V,E)) `;; + + +let local_fan = new_definition ` local_fan (V,E,FF ) <=> + let H = hypermap ( HYP (vec 0, (V: real^3 -> bool), E)) in + FAN (vec 0, V, E) /\ + (?x. x IN ( dart H) /\ FF = face H x ) /\ +dih2k H (CARD FF ) `;; + + +let azim_in_fan = new_definition` azim_in_fan (v:real^3,w:real^3) E = +let d = (azim_cycle (EE v E) ( vec 0 ) v w) in + if CARD ( EE v E ) > 1 then + azim (vec 0 ) v w d else &2 * pi `;; + +let wedge_in_fan_gt = new_definition`wedge_in_fan_gt (v,w) E = + if CARD (EE v E) > 1 then +wedge (vec 0) v w (azim_cycle (EE v E) (vec 0 ) v w ) else if +EE v E = {w} then { x | ~ ( x IN aff_ge {vec 0, v} {w} ) } else +{ x | ~ ( x IN aff {vec 0, v} )} `;; + +let wedge_ge = new_definition `wedge_ge v0 v1 w1 w2 = { z | +&0 <= azim v0 v1 w1 z /\ azim v0 v1 w1 z <= azim v0 v1 w1 w2 }`;; + +let wedge_in_fan_ge = new_definition` wedge_in_fan_ge ((v:real^3),w) E = + if CARD (EE v E) > 1 then +wedge_ge (vec 0) v w (azim_cycle (EE v E) (vec 0 ) v w ) else { x:real^3 | T } `;; + +let convex_local_fan = new_definition + `convex_local_fan (V,E,FF) <=> + local_fan (V,E,FF) /\ + (!x. x IN FF ==> azim_in_fan x E <= pi /\ V SUBSET wedge_in_fan_ge x E)`;; + +(* this is the first assertion of AAUHTVE *) +let FIRST_AAUHTVE = new_axiom +`FAN (x,V,E) /\ HYP (x,V,E) = D,e,n,f + ==> FINITE D /\ + e permutes D /\ + n permutes D /\ + f permutes D /\ + e o n o f = I /\ + e o e = I `;; + + +let FST_SND_FORM_OF_4_TUPLE = GEN_ALL ( +prove_by_refinement(` FST X = D /\ FST (SND X) = e /\ +FST (SND (SND X)) = n /\ SND (SND (SND X)) = f <=> X = D,e,n,f `, +[EQ_TAC; +STRIP_TAC; +REPEAT (PAT_ONCE_REWRITE_TAC `\x. x = y `[GSYM PAIR] THEN + ASM_SIMP_TAC[PAIR_EQ]); +SIMP_TAC[PAIR_EQ]]));; +(* =================================================== *) + +let HYP_LEMMA = prove_by_refinement( +`! (x:real^3). FAN (x,V,E) ==> +tuple_hypermap (hypermap (HYP (x,V,E))) = HYP (x,V,E) `, +[GEN_TAC THEN ABBREV_TAC ` D = FST (HYP (x,V,E)) `; +ABBREV_TAC ` e = FST ( SND (HYP (x,V,E))) `; +ABBREV_TAC `n = FST (SND (SND (HYP (x,V,E)))) `; +ABBREV_TAC `f = SND (SND (SND (HYP (x,V,E)))) `; +REPEAT (DOWN THEN ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> b ==> a ==> c `]); +PHA; +REWRITE_TAC[FST_SND_FORM_OF_4_TUPLE]; +NHANH (FIRST_AAUHTVE); +SIMP_TAC[]; +SIMP_TAC[GSYM hypermap_tybij]]);; + + + + +let fan_expand = let t1 = CONJ fan fan1 in +let t2 = CONJ fan2 t1 in +let t3 = CONJ fan3 t2 in +let t4 = CONJ fan4 t3 in +let t5 = CONJ fan5 t4 in +let t6 = CONJ fan6 t5 in +let t7 = CONJ fan7 t6 in +CONJ FAN t7;; + +prove(` UNIONS E SUBSET V /\ {(u:real^3), v} IN E ==> v IN V `, +REWRITE_TAC[ UNIONS_SUBSET] THEN +STRIP_TAC THEN +MATCH_MP_TAC (SET_RULE[]` {u,v} SUBSET V ==> v IN V `) THEN +FIRST_X_ASSUM MATCH_MP_TAC THEN +ASM_SIMP_TAC[]);; + + + +let IN_V_OF_FAN_EXISTS_DART = GEN_ALL ( +prove_by_refinement( +` UNIONS E SUBSET (V:real^3 -> bool) /\ u IN V ==> + ? v. v IN V /\ (u,v) IN darts_of_hyp E V `, +[REWRITE_TAC[darts_of_hyp; IN_UNION; ord_pairs; self_pairs]; +PHA THEN DAO THEN STRIP_TAC THEN ASM_CASES_TAC `?(v:real^3). {u,v} IN E `; +(* Subgoal 1 *) +FIRST_X_ASSUM CHOOSE_TAC THEN EXISTS_TAC `v:real^3 `; +ASSUME_TAC2 (prove(` UNIONS E SUBSET V /\ {(u:real^3), v} IN E ==> v IN V `, +REWRITE_TAC[ UNIONS_SUBSET] THEN +STRIP_TAC THEN +MATCH_MP_TAC (SET_RULE[]` {u,v} SUBSET V ==> v IN V `) THEN +FIRST_X_ASSUM MATCH_MP_TAC THEN +ASM_SIMP_TAC[])); +ASM_REWRITE_TAC[] THEN EVERY_ASSUM (fun x -> SET_TAC[x]); +(* Subgoal 2 *) +EXISTS_TAC `u:real^3 ` THEN ASM_REWRITE_TAC[EE]; +DISJ2_TAC THEN FIRST_X_ASSUM MP_TAC THEN SET_TAC[]]));; + +(* ======================================================== *) + +let X_IN_ITS_ORBIT = prove(` (x:A) IN orbit_map f x `, +REWRITE_TAC[orbit_map; IN_ELIM_THM] THEN +EXISTS_TAC ` 0 ` THEN REWRITE_TAC[POWER; I_THM; GE_REFL]);; + +let X_IN_HYP_ORBITS = prove(`! (x:A). x IN edge H x /\ x IN node H x /\ x IN face H x `, +REWRITE_TAC[node; edge; face; X_IN_ITS_ORBIT]);; + + + + +let ELMS_OF_HYPERMAP_HYP = prove_by_refinement +(`FAN (x,V,E) + ==> dart (hypermap (HYP (x,V,E))) = darts_of_hyp E V /\ + edge_map (hypermap (HYP (x,V,E))) = e_of_hyp /\ + node_map (hypermap (HYP (x,V,E))) = n_of_hyp (x,V,E) /\ + face_map (hypermap (HYP (x,V,E))) = f_of_hyp (x,V,E)`, +[REWRITE_TAC[dart;edge_map; node_map; face_map]; +SIMP_TAC[HYP_LEMMA; HYP]]);; + + +let POWER_SND = prove_by_refinement +(`!n. f POWER SUC n = f o (f POWER n)`, +[INDUCT_TAC; +REWRITE_TAC[POWER; FUN_EQ_THM; o_THM; I_THM]; +DOWN THEN SIMP_TAC[POWER; FUN_EQ_THM; o_THM]]);; + + + + +let N_HYP_TO_AZIM_CYCLE_LEM = +prove_by_refinement( +`!n. (n_of_hyp (x,V,E) POWER n) (u,v) = u,((azim_cycle (EE u E) x u) POWER n) v`, +[INDUCT_TAC; +REWRITE_TAC[POWER; I_THM]; +ASM_REWRITE_TAC[POWER_SND; o_THM; n_of_hyp]]);; + + +prove(` UNIONS E SUBSET V /\ {a, b} IN E ==> a IN V /\ b IN V `, +REWRITE_TAC[UNIONS_SUBSET; +(GSYM o (SET_RULE[]))` {a,b} SUBSET V <=> a IN V /\ b IN V `] THEN +MESON_TAC[]);; + + + +let IN_DARTS_HYP_IMP_FST_SND_IN_V = prove_by_refinement +(`UNIONS E SUBSET V /\ (y:A#A) IN darts_of_hyp E V ==> FST y IN V /\ SND y IN V `, +[SIMP_TAC[darts_of_hyp; ord_pairs; self_pairs; IN_UNION; IN_ELIM_THM]; +STRIP_TAC; +(* sub 1 *) +ASM_SIMP_TAC[]; +MATCH_MP_TAC (prove(` UNIONS E SUBSET V /\ {a, b} IN E ==> a IN V /\ b IN V `, +REWRITE_TAC[UNIONS_SUBSET; +(GSYM o (SET_RULE[]))` {a,b} SUBSET V <=> a IN V /\ b IN V `] THEN +MESON_TAC[])); +ASM_SIMP_TAC[]; +(* sub 2 *) +ASM_SIMP_TAC[FST; SND]]);; + +let POWER_TO_ITER = prove(`! n. (f POWER n) = ITER n f `, +INDUCT_TAC THENL [ +REWRITE_TAC[POWER; ITER; FUN_EQ_THM; I_THM]; +ASM_REWRITE_TAC[POWER_SND; ITER; FUN_EQ_THM; o_THM]]);; + + +let SND_IN_SET_OF_DART_OF_FRST = prove( +` UNIONS (E:(A -> bool) -> bool) SUBSET (V:A -> bool) /\ y IN darts_of_hyp E V ==> +FST y = SND y \/ SND y IN set_of_edge (FST y) V E`, +REWRITE_TAC[set_of_edge; darts_of_hyp; ord_pairs; +self_pairs; IN_ELIM_THM; IN_UNION] THEN +STRIP_TAC THENL [ +ASM_SIMP_TAC[] THEN +DISJ2_TAC THEN +ASM_MESON_TAC[prove(` UNIONS E SUBSET V /\ {(u:A), v} IN E ==> v IN V `, +REWRITE_TAC[ UNIONS_SUBSET] THEN +STRIP_TAC THEN +MATCH_MP_TAC (SET_RULE[]` {u,v} SUBSET V ==> v IN V `) THEN +FIRST_X_ASSUM MATCH_MP_TAC THEN +ASM_SIMP_TAC[])]; +ASM_SIMP_TAC[]]);; + + + +let UNI_E_IMP_EE_EQ_SET_OF_EDGE = +prove(` UNIONS E SUBSET V ==> EE (v:A) E = set_of_edge v V E `, +REWRITE_TAC[EE; set_of_edge] THEN +REWRITE_TAC[UNIONS_SUBSET; FUN_EQ_THM; IN_ELIM_THM] +THEN REWRITE_TAC[MESON[]`( a <=> a /\ b ) <=> a ==> b `] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC (SET_RULE[]` {v:A,b} SUBSET V ==> b IN V `) +THEN ASM_MESON_TAC[]);; + + + +let types_in_th th = let t = frees (concl (SPEC_ALL th)) in + map dest_var t;; + + +let IN_ORD_PAIRS_IMP_IMP_IN_TOO = +prove_by_refinement( +`y IN ord_pairs E ==> ((FST y):A,d) IN darts_of_hyp E V ==> + ((FST y),d) IN ord_pairs E `, +[REWRITE_TAC[ord_pairs; darts_of_hyp; +self_pairs; IN_ELIM_THM] THEN +REPEAT STRIP_TAC; +(* sub 1 *) +EXISTS_TAC `FST (y:A#A)` THEN +EXISTS_TAC `d: A` THEN +DOWN; +REWRITE_TAC[IN_UNION; IN_ELIM_THM]; +STRIP_TAC; +DOWN_TAC; +SIMP_TAC[PAIR_EQ]; +(* sub 2 *) +DOWN_TAC; +IMP_TAC THEN IMP_TAC THEN SIMP_TAC[]; +SIMP_TAC[EE; PAIR_EQ]; SET_TAC[]]);; + + + + +let IN_ORD_PAIRS_IMP_SND_IN_EE_FST = prove( +`y IN ord_pairs E ==> SND y IN (EE (FST y) E) ` , +REWRITE_TAC[ord_pairs; EE; IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_SIMP_TAC[]);; + + + + + + +let IN_SELF_PAIRS_IMP_FST_EQ_SND_FORALL = +prove_by_refinement( +`! (v:A). y IN self_pairs E V /\ FST y,v IN darts_of_hyp E V ==> FST y = v`, +[GEN_TAC THEN REWRITE_TAC[self_pairs; darts_of_hyp]; +REWRITE_TAC[IN_ELIM_THM; ord_pairs; IN_UNION; EE]; +STRIP_TAC; +DOWN; +ASM_SIMP_TAC[PAIR_EQ]; +STRIP_TAC; +ASM SET_TAC[]; +DOWN THEN SIMP_TAC[PAIR_EQ]]);; + + + + +(* John is helping me in this lemma *) +let CYCLIC_SET_IMP_STABLE_SET = new_axiom +`cyclic_set (W:real^3 -> bool) v w ==> +(! x. x IN W ==> W = { y | ? n. y = ITER n (azim_cycle W v w) x})`;; + + + +let choose_nd_point = new_specification ["choose_nd_point"] + (REWRITE_RULE[RIGHT_IMP_EXISTS_THM; SKOLEM_THM] IN_V_OF_FAN_EXISTS_DART);; + + + + + + +let FAN_IMP_BIJ_V_NODE_OF_HYP = +prove_by_refinement( +`FAN ((x:real^3),V,E) /\ + f = + (\u. if u IN V + then node (hypermap (HYP (x,V,E))) (u,choose_nd_point u E V) + else {}) + ==> BIJ f V {node (hypermap (HYP (x,V,E))) y | y | y IN darts_of_hyp E V}`, +[STRIP_TAC; +ASM_SIMP_TAC[]; +FIRST_X_ASSUM (fun x -> REWRITE_TAC[x]); +ASSUME_TAC choose_nd_point; +REWRITE_TAC[BIJ] THEN CONJ_TAC; +(* subgoal 1 *) +REWRITE_TAC[INJ] THEN CONJ_TAC; +(* subgoal 1.1 *) +GEN_TAC THEN SIMP_TAC[]; +UNDISCH_TAC `FAN ((x:real^3),V,E) `; +REWRITE_TAC[FAN] THEN REPEAT STRIP_TAC; +ASM SET_TAC[]; +(* subgoal 1.2 *) +IMP_TAC THEN IMP_TAC THEN SIMP_TAC[]; +NHANH (MESON[X_IN_HYP_ORBITS] `node H (x:A) = A ==> x IN A `); +REPEAT STRIP_TAC; +DOWN; +ASM_SIMP_TAC[node; ELMS_OF_HYPERMAP_HYP; orbit_map; IN_ELIM_THM]; +STRIP_TAC; +DOWN THEN REWRITE_TAC[N_HYP_TO_AZIM_CYCLE_LEM]; +SIMP_TAC[PAIR_EQ]; +(* suggoal 2 *) +REWRITE_TAC[SURJ] THEN CONJ_TAC; +(* subgoal 2.1 *) +GEN_TAC THEN SIMP_TAC[]; +UNDISCH_TAC `FAN ((x:real^3),V,E) `; +REWRITE_TAC[FAN] THEN REPEAT STRIP_TAC; +ASM SET_TAC[]; +(* subgaol 2.2 *) +GEN_TAC; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC ` FST (y:real^3 # real^3 )`; +UNDISCH_TAC ` FAN ((x:real^3),V,E) `; +REWRITE_TAC[FAN] THEN STRIP_TAC; +ASSUME_TAC2 (ISPECL [`E:(real^3 -> bool) -> bool `; +` y: real^3 # real^3`;`V:real^3 -> bool `] + (GEN_ALL IN_DARTS_HYP_IMP_FST_SND_IN_V)); +ASM_SIMP_TAC[node; REWRITE_RULE[FAN] ELMS_OF_HYPERMAP_HYP]; +MP_TAC (ISPECL [`x: real^3 `;` V:real^3 -> bool `; +` E: (real^3 -> bool) -> bool`; + `FST (y:real^3# real^3 ) `] XOHLED); +ANTS_TAC; +REPLICATE_TAC 5 DOWN; +PHA THEN ASM_SIMP_TAC[FAN]; +REWRITE_TAC[orbit_map;N_HYP_TO_AZIM_CYCLE_LEM]; +MP_TAC (ISPEC `y: real^3#real^3` (GSYM PAIR)); +ABBREV_TAC `fy = FST (y:real^3#real^3)`; +ABBREV_TAC `sy = SND (y:real^3#real^3)`; +SIMP_TAC[N_HYP_TO_AZIM_CYCLE_LEM]; +DISCH_TAC; +FIRST_X_ASSUM (MP_TAC o (SPECL [`fy: real^3 `])); +DISCH_THEN (MP_TAC o SPEC_ALL) THEN ANTS_TAC; +(* sub I *) +ASM_SIMP_TAC[]; +(* sub II *) +REPEAT STRIP_TAC; +ASSUME_TAC2 (SPEC_ALL (ISPECL [`fy:real^3`] (GEN_ALL UNI_E_IMP_EE_EQ_SET_OF_EDGE))); +FIRST_X_ASSUM (SUBST_ALL_TAC o SYM); +ASM_CASES_TAC `(y:real^3 # real^3) IN ord_pairs E `; +ASSUME_TAC (UNDISCH (SPEC_ALL ( +ISPECL [`V: real^3 -> bool `;` y:real^3 # real^3 `;` (choose_nd_point: real^3 -> +((real^3 -> bool) -> bool) ->(real^3 -> bool) -> real^3) fy E V`;` +E:(real^3 -> bool) -> bool `] + (GEN_ALL IN_ORD_PAIRS_IMP_IMP_IN_TOO)))); +DOWN; +ASM_REWRITE_TAC[]; +DOWN THEN NHANH IN_ORD_PAIRS_IMP_SND_IN_EE_FST; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; + +DOWN_TAC THEN NHANH CYCLIC_SET_IMP_STABLE_SET; +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC o (SPEC `sy:real^3 `)); + +FIRST_ASSUM (ASSUME_TAC o (SPEC `(choose_nd_poind: real^3 -> +((real^3 -> bool) -> bool) ->(real^3 -> bool) -> real^3) fy E V`)); + + +DOWN THEN DOWN THEN DISCH_THEN ASSUME_TAC2; +FIRST_ASSUM (fun x -> PAT_ONCE_REWRITE_TAC `\x. x = a ==> b ` [x]); +STRIP_TAC; + +REWRITE_TAC[EXTENSION]; +GEN_TAC THEN EQ_TAC; +(* sub 2.1 *) +REWRITE_TAC[IN_ELIM_THM; ARITH_RULE` n >= 0 `]; +DISCH_THEN CHOOSE_TAC; +ASM_SIMP_TAC[PAIR_EQ; POWER_TO_ITER]; +DOWN THEN DOWN; +SET_TAC[]; +(* sub 2.2 *) +REWRITE_TAC[IN_ELIM_THM; ARITH_RULE` n >= 0 `]; +DISCH_THEN CHOOSE_TAC; +ASM_SIMP_TAC[PAIR_EQ; POWER_TO_ITER]; +DOWN THEN DOWN; +SET_TAC[]; +(* sub IIIIII *) + +ASSUME_TAC2 (prove(`y IN darts_of_hyp E (V:real^3 -> bool) + /\ ~(y IN ord_pairs E) +==> y IN self_pairs E V `, +REWRITE_TAC[darts_of_hyp; IN_UNION] +THEN CONV_TAC TAUT)); +UNDISCH_TAC `fy,choose_nd_point fy E V IN darts_of_hyp E (V:real^3 -> bool) `; +DOWN; +EXPAND_TAC "fy"; +PHA; +NHANH IN_SELF_PAIRS_IMP_FST_EQ_SND_FORALL; +STRIP_TAC; +UNDISCH_TAC `y IN darts_of_hyp E (V:real^3 -> bool) `; +UNDISCH_TAC `y IN self_pairs E (V:real^3 -> bool) `; +PHA; +UNDISCH_TAC `y = (fy:real^3), (sy: real^3 ) `; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +EXPAND_TAC "fy"; +DISCH_THEN (fun x -> PAT_REWRITE_TAC`\x. x /\ y ==> z ` [GSYM x]); +NHANH IN_SELF_PAIRS_IMP_FST_EQ_SND_FORALL; +DOWN; +ASM_REWRITE_TAC[]; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[]]);; + + + + + + + + + + +let ITER_N_I = prove(`! n. ITER n I = I`, +INDUCT_TAC THENL [ +REWRITE_TAC[ITER; FUN_EQ_THM; I_THM]; +ASM_REWRITE_TAC[ITER; FUN_EQ_THM; I_THM]]);; + + + + + + +let HAS_ORDERS_IMP_ORBIT_MAP_FIRST_ROW = +prove_by_refinement( +`(f: A -> A) has_orders k /\ ~ (k = 0 ) ==> +(! x. orbit_map f x = { y| ? n. 0 <= n /\ n < k /\ y = ITER n f x }) `, +[ REWRITE_TAC[has_orders; orbit_map; POWER_TO_ITER]; +REWRITE_TAC[FUN_EQ_THM]; +REPEAT STRIP_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EQ_TAC; +STRIP_TAC; +EXISTS_TAC `n MOD k `; +ASM_SIMP_TAC[LE_0; DIVISION]; +ASSUME_TAC2 (SPECL [` n: num `;` k:num `] DIVISION); +FIRST_X_ASSUM (fun x -> PAT_ONCE_REWRITE_TAC `\x. x = y ` [x]); +REWRITE_TAC[GSYM ITER_ADD; GSYM ITER_MUL]; +UNDISCH_TAC `!x. ITER k (f: A -> A) x = I x`; +SIMP_TAC[GSYM FUN_EQ_THM; ETA_AX; ITER_N_I; I_THM]; +STRIP_TAC; +REWRITE_TAC[ARITH_RULE` n >= 0 `]; +EXISTS_TAC `n: num `; +ASM_REWRITE_TAC[]]);; + + + +let FINITE_OF_N_FIRST_ELMS = +prove_by_refinement( +`! k (x:A). FINITE {y | ?n. n < k /\ y = ITER n f x}`, +[INDUCT_TAC; +REWRITE_TAC[ ARITH_RULE ` ~( n < 0 ) `; EMPTY_GSPEC; FINITE_EMPTY]; +REWRITE_TAC[ARITH_RULE` x < SUC k <=> x < k \/ x = k `]; +KHANANG; +REWRITE_TAC[SET_RULE[]` { y | ? n. P n y \/ Q n y } = {y | ? n. P n y } + UNION { y | ? n. Q n y } `]; +DOWN; +REWRITE_TAC[LE_0; SET_RULE[]` {y| ? n. n = k /\ y = P n } = { P k } `]; +SIMP_TAC[FINITE_UNION; FINITE_SINGLETON]]);; + + + + + +let F_HAS_ORDERS_IMP_FINITE_ORBIT = +prove_by_refinement( +` (f: A -> A) has_orders k /\ ~( k = 0 ) ==> +(! x. FINITE (orbit_map f x )) `, +[NHANH HAS_ORDERS_IMP_ORBIT_MAP_FIRST_ROW; +SIMP_TAC[] THEN STRIP_TAC; +SPEC_TAC (`k:num `,` k:num`); +INDUCT_TAC; +REWRITE_TAC[ ARITH_RULE ` ~( n < 0 ) `; EMPTY_GSPEC; FINITE_EMPTY]; +REWRITE_TAC[ARITH_RULE` x < SUC k <=> x < k \/ x = k `]; +KHANANG; +REWRITE_TAC[SET_RULE[]` { y | ? n. P n y \/ Q n y } = {y | ? n. P n y } + UNION { y | ? n. Q n y } `]; +DOWN; +REWRITE_TAC[LE_0; SET_RULE[]` {y| ? n. n = k /\ y = P n } = { P k } `]; +SIMP_TAC[FINITE_UNION; FINITE_SINGLETON]]);; + + + + + + + +let CARD_CLAUSES2 = prove(`FINITE (S: A -> bool) + ==> (!x. x IN S ==> CARD (x INSERT S) = CARD S) /\ + (!x. ~(x IN S) ==> CARD (x INSERT S) = SUC (CARD S))`, +SIMP_TAC[CARD_CLAUSES]);; + + +let CARD_INSERT_GE_AND_LE = prove( +`FINITE (S: A -> bool) ==> CARD S <= CARD (x INSERT S ) /\ +CARD (x INSERT S) <= SUC ( CARD S)`, +SIMP_TAC[CARD_CLAUSES] THEN +COND_CASES_TAC THENL [ +DISCH_TAC THEN ARITH_TAC; +DISCH_TAC THEN ARITH_TAC]);; + + + + + +let HAVING_ORDERS_K_IMP_CARD_ORBIT_LE_K = +prove_by_refinement( +`(f: A -> A) has_orders k /\ ~( k = 0 ) ==> +(! x. CARD (orbit_map f x) <= k )`, +[SIMP_TAC[HAS_ORDERS_IMP_ORBIT_MAP_FIRST_ROW ]; +STRIP_TAC; +SPEC_TAC (`k: num `,` k: num`); +INDUCT_TAC; +REWRITE_TAC[LE_0; ARITH_RULE ` ~( n < 0 ) `; EMPTY_GSPEC; CARD_CLAUSES]; +REWRITE_TAC[ARITH_RULE` x < SUC k <=> x < k \/ x = k `]; +GEN_TAC; +KHANANG; +REWRITE_TAC[SET_RULE[]` { y | ? n. P n y \/ Q n y } = {y | ? n. P n y } + UNION { y | ? n. Q n y } `]; +DOWN; +REWRITE_TAC[LE_0; SET_RULE[]` {y| ? n. n = k /\ y = P n } = { P k } `]; +SIMP_TAC[SET_RULE[]` a UNION {x} = x INSERT a `]; +MP_TAC (SPECL [`k' :num `;`x: A `] FINITE_OF_N_FIRST_ELMS); +NHANH (ISPEC ` ITER k' f (x:A) ` ( GEN `x :A ` CARD_INSERT_GE_AND_LE)); +STRIP_TAC THEN STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC `x: A `)); +DOWN; +ARITH_TAC]);; + +(* CARD_LE_K_OF_SET_K_FIRST_ELMS +|- CARD {ITER i f x | i < k} <= k *) +let CARD_LE_K_OF_SET_K_FIRST_ELMS = +BETA_RULE (SPECL [`k: num `;`(\i. ITER i (f: A -> A) x )`] +CARD_FINITE_SERIES_LE);; + + + + + + +let CARD_K_FIRST_ELMS_EQ_K = +prove_by_refinement( +`! k (f: A -> A). CARD {ITER n f x | n < k} = k ==> + CARD {ITER n f x | n < k - 1} = k - 1 /\ + (!i. i < k - 1 ==> ~(ITER i f x = ITER ( k - 1 ) f x))`, +[INDUCT_TAC; +REWRITE_TAC[ARITH_RULE ` ~( a < 0 - 1 ) `; LT]; +REWRITE_TAC[SET_RULE[]` {ITER n f x | n | F} = {} `; CARD_CLAUSES]; +ARITH_TAC; +GEN_TAC; +REWRITE_TAC[ARITH_RULE ` a < SUC k <=> a < k \/ a = k `]; +REWRITE_TAC[SET_RULE[]` { ITER n f x | n < k \/ n = k } = ITER k f x INSERT { ITER n f x | n < k } `]; +ASM_CASES_TAC ` ITER k f (x:A) IN {ITER n f x | n < k} `; +MP_TAC (SPEC_ALL FINITE_OF_N_FIRST_ELMS); +REWRITE_TAC[SET_RULE[]` {y | ?n. n < k /\ y = ITER n f x} = {ITER n f x | n < k} `]; +ASM_SIMP_TAC[CARD_CLAUSES; FINITE_OF_N_FIRST_ELMS]; +DISCH_TAC THEN MP_TAC CARD_LE_K_OF_SET_K_FIRST_ELMS; +ARITH_TAC; +DOWN; +MP_TAC (SPEC_ALL FINITE_OF_N_FIRST_ELMS); +REWRITE_TAC[SET_RULE[]` {y | ?n. n < k /\ y = ITER n f x} = {ITER n f x | n < k} `]; +SIMP_TAC[ARITH_RULE ` SUC k - 1 = k `; CARD_CLAUSES; SUC_INJ]; +DISCH_TAC; +SET_TAC[]]);; + + +let FINITENESS_OF_K_FIRST_ELMS = prove_by_refinement( +`! k (f: num -> A). FINITE { f n | n < k }`, +[INDUCT_TAC; +REWRITE_TAC[LT; SET_RULE[]` {f n | n | F } = {} `; FINITE_RULES]; +REWRITE_TAC[ARITH_RULE` n < SUC k <=> n < k \/ n = k `; + SET_RULE[]` {(f: num -> A) n | n < k \/ n = k} = f k INSERT {f n | n < k } `]; +ASM_REWRITE_TAC[FINITE_INSERT]]);; + + +let LT_SUC_E = ARITH_RULE` i < SUC k <=> i < k \/ i = k `;; + +(* |- !k. CARD {f i | i < k} <= k *) +let CARD_K_FIRST_ELMS_LE_K = +GEN `k: num ` (SPECL [`k: num `;` f: num -> A `] CARD_FINITE_SERIES_LE);; + + + +let REMOVE_TAC = MATCH_MP_TAC (TAUT ` a ==> b ==> a `);; + + + +let CARD_N_FIRST_ELMS_UNDUCTIVE = prove_by_refinement( +`! k (f: num -> A ). CARD { f n | n < k} = k <=> + CARD {f n | n < k - 1} = k - 1 /\ + (!i. i < k - 1 ==> ~(f i = f ( k - 1 )))`, +[REPEAT GEN_TAC; +ASM_CASES_TAC ` k = 0 `; +ASM_SIMP_TAC[ARITH_RULE` ~( x < 0 - 1 ) `; LT; ARITH_RULE` 0 - 1 = 0 `]; +DOWN; +NHANH (ARITH_RULE` ~( k = 0 ) ==> (! n. n < k <=> n < k - 1 \/ n = k - 1 ) `); +SIMP_TAC[]; +STRIP_TAC; +REWRITE_TAC[SET_RULE[]` {(f:num -> A) n | n < k - 1 \/ n = k - 1} + = f ( k - 1 ) INSERT {f n | n < k - 1 }`]; +MP_TAC (SPECL [` k - 1 `;` f: num -> A `] FINITENESS_OF_K_FIRST_ELMS); +DISCH_TAC; +EQ_TAC; +(* sub 1 *) +ASM_SIMP_TAC[CARD_CLAUSES]; +COND_CASES_TAC; +(* sub 1.1 *) +MP_TAC (SPEC ` k - 1 ` CARD_K_FIRST_ELMS_LE_K); +UNDISCH_TAC ` ~( k = 0 ) `; +MESON_TAC[ARITH_RULE `~ ( ~(k = 0) /\ a <= k - 1 /\ a = k ) `]; +(* sub 1.2 *) +UNDISCH_TAC ` ~( k = 0 ) `; +SIMP_TAC[ARITH_RULE ` ~( k = 0 ) ==> ( SUC x = k <=> x = k - 1 )`]; +MATCH_MP_TAC (TAUT ` a ==> b ==> a `); +MATCH_MP_TAC (TAUT ` a ==> b ==> a `); +DOWN; +REWRITE_TAC[IN_ELIM_THM]; +MESON_TAC[]; +(* SUB 2 *) +STRIP_TAC; +SUBGOAL_THEN ` ~( f ( k - 1 ) IN {(f: num -> A) n | n < k - 1})` ASSUME_TAC; +DOWN THEN REWRITE_TAC[IN_ELIM_THM]; +MESON_TAC[]; +ASM_SIMP_TAC[CARD_CLAUSES]; +UNDISCH_TAC `~( k = 0 ) `; +ARITH_TAC]);; + + + + + +let CARD_ADD1_LE = prove_by_refinement( +`! f: num -> A. CARD { f n | n < k + 1 } <= CARD {f n | n < k } + 1 `, +[REWRITE_TAC[ARITH_RULE` a < v + 1 <=> a < v \/ a = v `; + SET_RULE[]` {(f: num -> A) n | n < k \/ n = k} = f k INSERT {f n | n < k } `]; +GEN_TAC; +MP_TAC (SPEC_ALL FINITENESS_OF_K_FIRST_ELMS); +SIMP_TAC[CARD_CLAUSES]; +COND_CASES_TAC; +DISCH_TAC THEN ARITH_TAC; +DISCH_TAC THEN ARITH_TAC]);; + + + + + +let CARD_LT_KT_LE_ADDT = +prove_by_refinement( +` CARD { (f: num -> A) n | n < k + t } <= CARD {f n | n < k } + t `, +[SPEC_TAC (`t:num `,` t:num `); +INDUCT_TAC; +REWRITE_TAC[ADD_0; LE_REFL]; +REWRITE_TAC[ADD1]; +REWRITE_TAC[ARITH_RULE` a + b + 1 = (a + b ) + 1 `]; +MP_TAC (SPECL [` k + (t:num) `;` f: num -> A `] (GEN_ALL CARD_ADD1_LE)); +DOWN THEN ARITH_TAC]);; + + + + + +let CARD_KS_EQ_K_EQ_ALL_LE = prove_by_refinement +(`! k (f: num -> A ). CARD { f n | n < k} = k <=> +(! kk. kk <= k ==> CARD { f n | n < kk} = kk ) `, +[REPEAT STRIP_TAC; +EQ_TAC; +REPEAT STRIP_TAC; +ASM_CASES_TAC ` CARD {(f: num -> A) n | n < kk} = kk`; +ASM_SIMP_TAC[]; +ASSUME_TAC (SPEC `kk: num ` CARD_K_FIRST_ELMS_LE_K ); +UNDISCH_TAC ` kk <= (k:num ) `; +NHANH (ARITH_RULE` kk <= (k:num) ==> k = kk + k - kk`); +STRIP_TAC; +UNDISCH_TAC `CARD {(f:num -> A) n | n < k} = k`; +FIRST_ASSUM (fun x -> ONCE_REWRITE_TAC[x]); + MP_TAC (SPECL [`kk : num `;` f: num -> A `;` k - (kk: num ) `] + (GEN_ALL CARD_LT_KT_LE_ADDT)); +REPEAT STRIP_TAC; +UNDISCH_TAC `~(CARD {(f: num -> A) n | n < kk} = kk) `; +UNDISCH_TAC ` CARD {(f: num -> A) i | i < kk} <= kk`; +PHA; +REWRITE_TAC[ARITH_RULE` a <= b /\ ~( a = b ) <=> a < (b: num) `]; +DOWN THEN DOWN; +MESON_TAC[ARITH_RULE` ~( a <= b + c /\ a = kk + c /\ b < (kk: num) ) `]; +(* SUB 2 *) +DISCH_THEN (MP_TAC o (SPEC `k: num `)); +SIMP_TAC[LE_REFL]]);; + + + + + + +let CARD_K_ELMS_EQ_K_IMP_ALL_DISTINCT = +prove_by_refinement( +`! k (f: num -> A). CARD {f n | n < k} = k +==> (!i j. i < k /\ j < k /\ ~( i = j) ==> ~( f i = f j )) `, +[INDUCT_TAC; +REWRITE_TAC[LT]; +ONCE_REWRITE_TAC[CARD_N_FIRST_ELMS_UNDUCTIVE]; +REWRITE_TAC[ARITH_RULE` SUC k - 1 = k `]; +FIRST_X_ASSUM NHANH; +REWRITE_TAC[ARITH_RULE` a < SUC b <=> a < b \/ a = b `]; +MESON_TAC[]]);; + + + + + + + +let CARD_UNION_NOT_DISTJ_LT = +prove_by_refinement( +` FINITE (s: A -> bool) /\ FINITE t /\ ~( s INTER t = {} ) ==> + CARD (s UNION t) < CARD s + CARD t `, +[NGOAC; +NHANH CARD_UNION_GEN; +REWRITE_TAC[SET_RULE[]` ~( x = {} ) <=> (?a. {a} SUBSET x ) `]; +NHANH (MESON[FINITE_INTER]` FINITE s /\ FINITE t ==> FINITE (s INTER t)`); +STRIP_TAC; +UNDISCH_TAC `FINITE ((s: A -> bool) INTER t)`; +DOWN THEN PHA; +NHANH CARD_SUBSET; +REWRITE_TAC[CARD_SINGLETON]; +STRIP_TAC; +UNDISCH_TAC `CARD ((s: A -> bool) UNION t) = +(CARD s + CARD t) - CARD (s INTER t)`; +ONCE_REWRITE_TAC[ARITH_RULE` a < b <=> 0 < b - a `]; +ASSUME_TAC2 (SPEC_ALL CARD_UNION_LE); +ASSUME_TAC (SET_RULE[]` (s INTER t) SUBSET (s: A -> bool) `); +ASSUME_TAC2 (SPECL [`(s:A -> bool) INTER t `;` s: A -> bool`] CARD_SUBSET); +DOWN THEN DOWN THEN REMOVE_TAC; +DOWN THEN DOWN THEN PHA THEN ARITH_TAC]);; + + + + + + + +let CARD_ITER_K_EK_IMP_DIST = prove_by_refinement( +`! k (f: A -> A). CARD {ITER n f x | n < k} = k ==> + (!i j. i < k /\ j < k /\ ~(i = j ) ==> ~(ITER i f x = ITER j f x))`, +[REPEAT GEN_TAC; +REWRITE_TAC[BETA_RULE (SPECL [`k: num `; +`(\n. ITER n (f:A -> A) x ) `] CARD_K_ELMS_EQ_K_IMP_ALL_DISTINCT)]]);; + + + + + + + + +let DIH2K_IMP_PRE_SIMPLE_HYP = prove_by_refinement +(`FINITE ( dart H ) /\ +dih2k (H:(A)hypermap) k /\ ~( k = 0 ) +==> (! x. x IN dart H ==> ~( node_map H x IN face H (x:A) )) `, +[REWRITE_TAC[ dih2k; simple_hypermap]; +STRIP_TAC; +GEN_TAC; +ASM_CASES_TAC `node_map H x IN face H (x:A) `; +(* subgoal 1 *) +FIRST_X_ASSUM NHANH; +LET_TAC; +STRIP_TAC; +SUBGOAL_THEN ` ~( (S: A -> bool) INTER (IMAGE (node_map H) S) = {}) ` ASSUME_TAC; +ASSUME_TAC (SPEC_ALL face_refl); +DOWN; +NHANH (ISPECL [`node_map (H:(A) hypermap)`;`S: A -> bool `;`x:A `] FUN_IN_IMAGE); +UNDISCH_TAC `node_map H (x:A) IN S`; +ASM_REWRITE_TAC[]; +SET_TAC[]; +ASSUME_TAC2 lemma_face_subset; +ASSUME_TAC2 (SPECL [`face H (x:A) `;` dart (H:(A) hypermap)`] FINITE_SUBSET); +ASSUME_TAC2 (ISPECL [` node_map (H:(A) hypermap) `;`face H (x:A) `] FINITE_IMAGE); +REPLICATE_TAC 5 DOWN; +PHA THEN ASM_REWRITE_TAC[]; +STRIP_TAC; +ASSUME_TAC2 (SPECL [`S: A -> bool `;` IMAGE (node_map H) + (S: A -> bool) `] (GEN_ALL CARD_UNION_NOT_DISTJ_LT)); +ASSUME_TAC2 (ISPECL [`node_map (H:(A) hypermap)`;` S:A -> bool`] CARD_IMAGE_LE); +ASSUME_TAC2 (SPECL [`face_map (H:(A) hypermap)`;`k: num `] +(GEN_ALL HAVING_ORDERS_K_IMP_CARD_ORBIT_LE_K)); +DOWN; +ASM_REWRITE_TAC[GSYM face]; +DISCH_THEN (MP_TAC o (SPEC `x: A`)); +ASM_REWRITE_TAC[] THEN STRIP_TAC; +DOWN THEN DOWN THEN DOWN THEN PHA; +NHANH (ARITH_RULE`a < b + c /\ c <= b /\ b <= k ==> a < 2 * k `); +FIRST_ASSUM (fun x -> REWRITE_TAC[SYM x]); +STRIP_TAC; +ASM_MESON_TAC[ARITH_RULE` x = 2 * k ==> ~(x < 2 * k ) `]; +(* subgoal 2 *) +ASM_REWRITE_TAC[]]);; + + + +let ITER1 = prove(`ITER 1 f = (f:A -> A) `, +REWRITE_TAC[ARITH_RULE` 1 = SUC 0 `; ITER; FUN_EQ_THM]);; + + + + + + +let DIH2K_IMP_SIMPLE_HYPERMAP = prove_by_refinement( + ` FINITE ( dart H ) /\ +dih2k (H:(A)hypermap) k /\ ~( k = 0 ) ==> simple_hypermap H`, +[NHANH DIH2K_IMP_PRE_SIMPLE_HYP; +REWRITE_TAC[ dih2k; simple_hypermap]; +STRIP_TAC; +GEN_TAC; +ASSUME_TAC (ARITH_RULE` ~( 2 = 0 ) `); +ASSUME_TAC2 (SPECL [`2`; `node_map (H:(A) hypermap) `] (GEN_ALL HAS_ORDERS_IMP_ORBIT_MAP_FIRST_ROW)); +FIRST_X_ASSUM (MP_TAC o (SPEC `x:A `)); +REWRITE_TAC[GSYM node]; +REPEAT STRIP_TAC; +REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM; SET_RULE[]` (a INTER b) x <=> x IN a /\ x IN b `]; +REWRITE_TAC[SET_RULE[]` {s} a <=> a = s `]; +GEN_TAC THEN EQ_TAC; +ASM_SIMP_TAC[IN_ELIM_THM; ARITH_RULE` x < 2 <=> x = 0 \/ x = 1 `]; +STRIP_TAC; +(* sub 1.1 *) +REPLICATE_TAC 3 DOWN; +SIMP_TAC[ITER]; +(* sub 1.2 *) +REPLICATE_TAC 3 DOWN; +SIMP_TAC[ITER; ITER1]; +ASM_MESON_TAC[]; +(* sub 2 *) +SIMP_TAC[X_IN_HYP_ORBITS]]);; + + + + + +let IN_ORBIT_IMP_ORBIT_SUBSET = prove_by_refinement( +`! x (y:A) f. x IN orbit_map f y ==> orbit_map f x SUBSET orbit_map f y `, +[REPEAT GEN_TAC; +REWRITE_TAC[orbit_map; IN_ELIM_THM; SUBSET; POWER_TO_ITER]; +REPEAT STRIP_TAC; +ASM_SIMP_TAC[]; +REWRITE_TAC[ITER_ADD]; +EXISTS_TAC `n' + (n:num) `; +REWRITE_TAC[ARITH_RULE ` a >= 0 `]]);; + + + + + + +let IN_FACE_IMP_SUBSET_FACE = prove( +`! (x:A). x IN face H y ==> face H x SUBSET face H y `, +REWRITE_TAC[face] THEN +NHANH IN_ORBIT_IMP_ORBIT_SUBSET THEN +SIMP_TAC[]);; + + + + + + +let HAS_ORDK_IN_ORBIT_IMP_SAME_ORBIT = prove_by_refinement( +` (f:A -> A) has_orders k /\ x IN orbit_map f y /\ ~( k = 0 ) ==> +orbit_map f x = orbit_map f y `, +[NHANH IN_ORBIT_IMP_ORBIT_SUBSET; +SIMP_TAC[SET_RULE[]` a = b <=> a SUBSET b /\ b SUBSET a `]; +STRIP_TAC; +ASSUME_TAC2 HAS_ORDERS_IMP_ORBIT_MAP_FIRST_ROW; +UNDISCH_TAC `(x:A) IN orbit_map f y`; +ASM_REWRITE_TAC[]; +REWRITE_TAC[SUBSET; IN_ELIM_THM]; +REPEAT STRIP_TAC; +ASM_REWRITE_TAC[ITER_ADD]; +ASM_CASES_TAC ` (n:num) <= n' `; +EXISTS_TAC ` n' - (n:num) `; +ASM_SIMP_TAC[ARITH_RULE` n <= (n': num) ==> n' - n + n = n' `]; +ASM_ARITH_TAC; +EXISTS_TAC ` (k: num) - n + n' `; +ASM_SIMP_TAC[ARITH_RULE` n < k ==> (k - n + n') + n = n' + (k:num) `]; +UNDISCH_TAC `(f: A -> A) has_orders k `; +SIMP_TAC[has_orders; GSYM ITER_ADD; I_THM]; +REMOVE_TAC THEN ASM_ARITH_TAC]);; + + + + + + + + + + +let LOCAL_FAN_IMP_FF_SUBSET_DARTS = prove_by_refinement( +` local_fan ((V:real^3 -> bool),E,FF) ==> FF SUBSET darts_of_hyp E V`, +[REWRITE_TAC[local_fan]; +LET_TAC; +STRIP_TAC; +DOWN_TAC; +NHANH lemma_face_subset; +STRIP_TAC; +UNDISCH_TAC ` face H (x:real^3#real^3) SUBSET dart H`; +ASSUME_TAC2 (SPEC `(vec 0): real^3 ` HYP_LEMMA); +REWRITE_TAC[dart]; +EXPAND_TAC "H"; +FIRST_X_ASSUM (fun x -> REWRITE_TAC[x]); +ASM_REWRITE_TAC[HYP]]);; + + + + + + +let LOCAL_IMP_FINITE_DARTS = prove_by_refinement( +` local_fan ((V:real^3 -> bool),E,FF) ==> FINITE (darts_of_hyp E V) `, +[REWRITE_TAC[local_fan] THEN LET_TAC; +EXPAND_TAC "H"; +NHANH HYP_LEMMA; +REWRITE_TAC[dart]; +REWRITE_TAC[GSYM hypermap_tybij; HYP]; +SIMP_TAC[]]);; + + + + +let LOCAL_FAN_FINITE_FF = prove_by_refinement( +` local_fan ((V:real^3 -> bool),E,FF) ==> FINITE FF `, +[NHANH LOCAL_FAN_IMP_FF_SUBSET_DARTS; +NHANH LOCAL_IMP_FINITE_DARTS; +PHA THEN IMP_TAC THEN REMOVE_TAC; +REWRITE_TAC[FINITE_SUBSET]]);; + + + + + + + + + +let DIH_IMP_EVERY_NODE_INTER_FACE = prove_by_refinement +(` dih2k (H:(A) hypermap) k +==> (! x y. {x,y} SUBSET dart H ==> ? d. d IN node H x /\ d IN face H y ) `, +[REWRITE_TAC[dih2k; INSERT_SUBSET]; +REPEAT STRIP_TAC; +UNDISCH_TAC `(y:A) IN dart H `; +FIRST_X_ASSUM NHANH; +REWRITE_TAC[let_CONV` let S = face H (y:A) in dart H = S UNION IMAGE (node_map H) S`]; +STRIP_TAC; +UNDISCH_TAC `(x:A) IN dart H`; +ASM_REWRITE_TAC[IN_UNION]; +STRIP_TAC; +EXISTS_TAC `x:A`; +ASM_SIMP_TAC[node_refl]; +DOWN; +REWRITE_TAC[IN_IMAGE]; +STRIP_TAC; +EXISTS_TAC `x':A`; +ASM_REWRITE_TAC[node; orbit_map; IN_ELIM_THM]; +EXISTS_TAC `1 `; +REWRITE_TAC[ARITH_RULE` 1 >= 0 `; POWER_1]; +REWRITE_TAC[ARITH_RULE` 1 >= 0 `; POWER_1]; +UNDISCH_TAC `node_map (H:(A) hypermap ) has_orders 2`; +REWRITE_TAC[has_orders; FUN_EQ_THM; ITER; ARITH_RULE`2 = SUC 1 `; ITER1; I_THM]; +SIMP_TAC[EQ_SYM_EQ]]);; + + + + + + + + + + +let LOCAL_FAN_IMP_BIJ_FF_NODES = prove_by_refinement( +`local_fan ((V:real^3 -> bool),E,FF) /\ + f = (\y. node (hypermap (HYP (vec 0,V,E))) y ) ==> +BIJ f FF {node (hypermap (HYP (vec 0,V,E))) y | y | y IN darts_of_hyp E V} `, +[REWRITE_TAC[local_fan]; +LET_TAC; +REWRITE_TAC[dih2k]; +STRIP_TAC; +ASM_REWRITE_TAC[BIJ; INJ; SURJ]; +PHA; +CONJ_TAC; +(* SUB 1 *) +GEN_TAC; +ASSUME_TAC2 (ISPEC `(vec 0): real^3 ` HYP_LEMMA); +DOWN; +REWRITE_TAC[GSYM hypermap_tybij; HYP]; +ASSUME_TAC2 (ISPECL [`H: (real^3 # real^3)hypermap `; +`x:real^3 # real^3 `] lemma_face_subset); +ASSUME_TAC2 (SPEC `(vec 0): real^3 ` (GEN `x: real^3 ` ELMS_OF_HYPERMAP_HYP)); +PHA THEN STRIP_TAC; +UNDISCH_TAC `face H (x:real^3 # real^3) SUBSET dart H`; +DOWN; +DOWN_TAC THEN STRIP_TAC; +EXPAND_TAC "H"; +USE_FIRST `dart (hypermap (HYP (vec 0,V,E))) = darts_of_hyp E (V:real^3 -> bool) ` + ( fun x -> REWRITE_TAC[GSYM x]); +REPLICATE_TAC 3 DOWN; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +ASM_REWRITE_TAC[IN_ELIM_THM; SUBSET]; +MESON_TAC[]; +(* SUB 2.1 *) +CONJ_TAC; +(* sub 2.1.1 *) +REPEAT STRIP_TAC; +MP_TAC LOCAL_FAN_FINITE_FF; +ANTS_TAC THENL [ +REWRITE_TAC[local_fan; dih2k] THEN +LET_TAC THEN ASM_SIMP_TAC[] THEN +ASM_MESON_TAC[]; +ASM_CASES_TAC ` CARD (FF:real^3 # real^3 -> bool) = 0`]; +(* sub I *) +DOWN THEN PHA; +NHANH (MESON[CARD_EQ_0]` CARD FF = 0 /\ FINITE FF ==> FF = {} `); +STRIP_TAC; +MP_TAC (ISPECL [`H: (real^3#real^3) hypermap `;` x: real^3 # real^3 `] face_refl); +DOWN; +ASM_SIMP_TAC[NOT_IN_EMPTY]; +(* SUB II *) +MP_TAC (ISPECL [` CARD (FF: (real^3 # real^3 ) -> bool) `;` y: real^3 # real^3 `; + `face_map (H:(real^3 # real^3) hypermap) `;` x: real^3 # real^3 `] +(GEN_ALL HAS_ORDK_IN_ORBIT_IMP_SAME_ORBIT)); +ANTS_TAC THENL [ +ASM_REWRITE_TAC[GSYM face]; +REWRITE_TAC[GSYM face]]; +DISCH_TAC; +MP_TAC (ISPECL [` CARD (FF: (real^3 # real^3 ) -> bool) `;` x': real^3 # real^3 `; + `face_map (H:(real^3 # real^3) hypermap) `;` x: real^3 # real^3 `] +(GEN_ALL HAS_ORDK_IN_ORBIT_IMP_SAME_ORBIT)); +ANTS_TAC THENL [ +ASM_REWRITE_TAC[GSYM face]; +ASM_REWRITE_TAC[GSYM face]]; +REPEAT STRIP_TAC; +MP_TAC (ISPECL [`CARD (FF: real^3 # real^3 -> bool) `; +` H: (real^3 # real^3) hypermap `] (GEN_ALL DIH2K_IMP_SIMPLE_HYPERMAP)); +ANTS_TAC; +(* SUB GOAL *) + + +ASM_SIMP_TAC[dih2k]; +EXPAND_TAC "H"; +ASSUME_TAC2 (SPEC `(vec 0): real^3 ` (GEN `x: real^ 3 ` ELMS_OF_HYPERMAP_HYP)); +MP_TAC (REWRITE_RULE[local_fan] LOCAL_IMP_FINITE_DARTS); +ANTS_TAC THENL [ +LET_TAC THEN +REWRITE_TAC[dih2k] THEN +ASM_MESON_TAC[]; +ASM_REWRITE_TAC[]]; + +(* =============== *) +(* SUB *) +NHANH lemma_simple_hypermap; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPEC `y: real^3 # real^3 `)); +UNDISCH_TAC `node H x' = node H (y: real^3 # real^3 ) `; +DISCH_THEN (fun x -> REWRITE_TAC[SYM x]); +ASM_REWRITE_TAC[]; +UNDISCH_TAC `face H x' = face H (x: real^3 # real^3 ) `; +DISCH_THEN (fun x -> REWRITE_TAC[SYM x]); +ASM_REWRITE_TAC[]; +SET_TAC[]; + + +(* ---------------------------------- *) +ASSUME_TAC2 (SPEC `(vec 0): real^3 ` (GEN `x: real^3 ` ELMS_OF_HYPERMAP_HYP)); +DOWN; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +ASM_SIMP_TAC[]; +STRIP_TAC; +ASSUME_TAC2 (ISPEC `H:(real^3 # real^3 ) hypermap ` lemma_face_subset); +CONJ_TAC; +STRIP_TAC THEN DOWN THEN PHA; +SET_TAC[]; +REWRITE_TAC[IN_ELIM_THM]; +REPEAT STRIP_TAC; +MP_TAC (ISPECL [`CARD (FF: real^3#real^3->bool) `;` H : (real^3#real^3)hypermap`] + ( GEN_ALL DIH_IMP_EVERY_NODE_INTER_FACE)); +ANTS_TAC THENL [ +REWRITE_TAC[dih2k] THEN +ASM_SIMP_TAC[]; +DISCH_THEN (MP_TAC o (SPECL [`y:real^3 # real^3 `;`x:real^3# real^3`]))]; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +DISCH_THEN ASSUME_TAC2; +FIRST_X_ASSUM CHOOSE_TAC; +EXISTS_TAC `d: real^3 # real^3 `; +FIRST_X_ASSUM MP_TAC THEN NHANH lemma_node_identity; +ASM_SIMP_TAC[]]);; + + + + + +(* local_fan (V,E,FF) /\ f = (\y. node (hypermap (HYP (vec 0,V,E))) y) + ==> BIJ f FF + {node (hypermap (HYP (vec 0,V,E))) y | y | y IN darts_of_hyp E V} +*) + +REWRITE_RULE[MESON[]` (! h. a /\ h = f ==> BIJ h S C ) <=> ( a ==> BIJ f S C ) `] + (GEN `f: real^3#real^3->real^3#real^3->bool ` LOCAL_FAN_IMP_BIJ_FF_NODES);; + + +(* +val it : thm = + |- local_fan (V,E,FF) + ==> BIJ (\y. node (hypermap (HYP (vec 0,V,E))) y) FF + {node (hypermap (HYP (vec 0,V,E))) y | y | y IN darts_of_hyp E V} + +*) + +REWRITE_RULE[MESON[]` (! h. a /\ h = f ==> BIJ h S C ) <=> ( a ==> BIJ f S C ) `] + (GEN `f: real^3->real^3#real^3->bool` FAN_IMP_BIJ_V_NODE_OF_HYP);; + +FAN_IMP_BIJ_V_NODE_OF_HYP ;; +(* val it : thm = + |- FAN (x,V,E) /\ + f = + (\u. if u IN V + then node (hypermap (HYP (x,V,E))) (u,choose_nd_point u E V) + else {}) + ==> BIJ f V + {node (hypermap (HYP (x,V,E))) y | y | y IN darts_of_hyp E V} + +*) + + + + +let F_INVERSE_F = prove(` (? y. f y = x ) ==> f ( (inverse f) x ) = x`, +REWRITE_TAC[FUN_EQ_THM; I_THM; o_THM; inverse; IN_IMAGE] +THEN ASM_MESON_TAC[]);; + +let F_INVERSE_F_F = MESON[F_INVERSE_F]` f ( inverse f (f x)) = f x `;; + +let INJ_IMP_INVERSE_FF = MESON[F_INVERSE_F_F]`(!y. f y = f x ==> y = x ) ==> inverse f ( f x ) = x `;; + +let BIJ_AND_BIJ_INVERSE = prove(` BIJ f S1 S2 /\ (! x. f x IN S2 ==> x IN S1 ) +==> BIJ (inverse f) S2 S1 `, +REWRITE_TAC[BIJ; INJ; SURJ] THEN +ASM_MESON_TAC[F_INVERSE_F ]);; + + + + + + + + +let INVERSE_FUNCTION_OF_BIJ = prove_by_refinement( +`BIJ (f:A -> B) S1 S2 /\ g = (\x. if x IN S2 then (@t. t IN S1 /\ f t = x ) else tt ) +==> BIJ g S2 S1 `, +[REWRITE_TAC[BIJ; INJ; SURJ]; +STRIP_TAC; +SUBGOAL_THEN `(!x. (x:B) IN S2 ==> g x IN (S1: A -> bool) /\ f ( g x ) = x )` ASSUME_TAC; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM NHANH; +SIMP_TAC[]; +MESON_TAC[]; +(* ================= *) +CONJ_TAC; +ASM_MESON_TAC[]; +CONJ_TAC; +FIRST_X_ASSUM NHANH; +SIMP_TAC[]; +REPEAT STRIP_TAC; +EXISTS_TAC `(f:A -> B) x `; +ASM_MESON_TAC[]]);; + + + + + +let TOW_BIJS_IMP_BIJ_BETWEEN_FIRST = prove_by_refinement( +` BIJ (f:B -> A ) S1 V /\ BIJ (g:C -> A) S2 V /\ +ff = (\x. if x IN S1 then (@a. a IN S2 /\ f x = g a) else aa) +==> BIJ ff S1 S2 `, +[REWRITE_TAC[BIJ; INJ; SURJ]; +STRIP_TAC; +SUBGOAL_THEN ` (!x. (x:B) IN S1 ==> ff x IN (S2: C -> bool) /\ (f:B -> A) x = g ( ff x )) ` ASSUME_TAC; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +ASM_MESON_TAC[]; +ASM_MESON_TAC[]]);; + + + + + + + +let INDENT_IN_S1_IMP_BIJ = +prove(` BIJ (f: A -> B) S1 S2 /\ (! x. x IN S1 ==> f x = g x ) +==> BIJ g S1 S2 `, +REWRITE_TAC[BIJ; INJ; SURJ] THEN +MESON_TAC[]);; + + + + + + +let IN_NODE_IMP_FIRST_EQ = prove_by_refinement( +` FAN (x,V,E) /\ a IN ( node (hypermap (HYP (x,V,E))) b ) + ==> FST a = FST b `, +[REWRITE_TAC[node]; +NHANH ELMS_OF_HYPERMAP_HYP; +IMP_TAC; +SIMP_TAC[]; +STRIP_TAC; +REWRITE_TAC[IN_ELIM_THM; orbit_map]; +STRIP_TAC; +DOWN; +PAT_ONCE_REWRITE_TAC `\x. a = P x ==> y ` [GSYM PAIR]; +REWRITE_TAC[N_HYP_TO_AZIM_CYCLE_LEM]; +PAT_ONCE_REWRITE_TAC `\x. x = a ==> y ` [GSYM PAIR]; +REWRITE_TAC[PAIR_EQ]; +SIMP_TAC[]]);; + + + +let LOCAL_FAN_IMP_FAN = prove(` local_fan (V,E,FF) ==> FAN ( vec 0, V,E) `, +REWRITE_TAC[local_fan] THEN +LET_TAC THEN SIMP_TAC[]);; + + + + + + +let BIJ_BETWEEN_FF_AND_V = prove_by_refinement( +`local_fan (V,E,FF) /\ k = (\x. FST x ) +==> BIJ k FF V `, +[ABBREV_TAC ` f = + (\u. if (u:real^3) IN V + then node (hypermap (HYP (vec 0,V,E))) (u,choose_nd_point u E V) + else {}) `; +ABBREV_TAC `h = (\y. node (hypermap (HYP (vec 0,V,E))) y) ` ; +DOWN_TAC; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +STRIP_TAC; +ASSUME_TAC2 ( +prove(` local_fan (V,E,FF) /\ + f = + (\u. if (u:real^3) IN V + then node (hypermap (HYP (vec 0,V,E))) (u,choose_nd_point u E V) + else {}) /\ + h = (\y. node (hypermap (HYP (vec 0,V,E))) y) + ==> BIJ h FF + {node (hypermap (HYP (vec 0,V,E))) y | y | y IN darts_of_hyp E V} /\ + BIJ f V + {node (hypermap (HYP (vec 0,V,E))) y | y | y IN darts_of_hyp E V}`, +SIMP_TAC[FAN_IMP_BIJ_V_NODE_OF_HYP ; LOCAL_FAN_IMP_BIJ_FF_NODES] THEN +REWRITE_TAC[local_fan] THEN LET_TAC THEN +EXPAND_TAC "H" THEN +SIMP_TAC[FAN_IMP_BIJ_V_NODE_OF_HYP])); +DOWN; +NHANH (REWRITE_RULE[RIGHT_FORALL_IMP_THM] + (GEN `ff: B -> C ` (REWRITE_RULE[TAUT` a/\b/\c ==> d <=> + a /\ b ==> c ==> d `] TOW_BIJS_IMP_BIJ_BETWEEN_FIRST))); +REWRITE_TAC[MESON[]` (! x. x = a ==> P x ) <=> P a `]; +ABBREV_TAC ` ff = (\x. if x IN FF then @a. a IN V /\ +(h:real^3#real^3->real^3#real^3->bool) x = f (a:real^3) else aa) `; +STRIP_TAC; +SUBGOAL_THEN `(!x. x IN FF ==> (ff: real^3#real^3->real^3) + x = k x ) ` ASSUME_TAC; +SUBGOAL_THEN ` (! x. (x:real^3 # real^3) IN FF ==> ff x IN (V:real^3 -> bool) /\ + (h:real^3#real^3->real^3#real^3->bool) x = f ( ff x )) ` ASSUME_TAC; + +(* SUBGOAL 1 *) +EXPAND_TAC "ff"; +SIMP_TAC[]; +STRIP_TAC THEN STRIP_TAC; +CONV_TAC SELECT_CONV; +DOWN_TAC; +REWRITE_TAC[BIJ; INJ; SURJ]; +MESON_TAC[]; +(* end 1 *) + +(* sub 2 *) +FIRST_X_ASSUM NHANH; +STRIP_TAC; +STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (ISPECL [` hypermap (HYP (vec 0,V,E)) `;` x: real^3 # real^3 `] node_refl); +ASM_REWRITE_TAC[]; +ASSUME_TAC2 LOCAL_FAN_IMP_FAN; +DOWN THEN PHA; +NHANH IN_NODE_IMP_FIRST_EQ; +EXPAND_TAC "k"; +SIMP_TAC[EQ_SYM_EQ]; +(* subgoal -------------------------- *) +(* oooooooooooooooooooooooooooooooooo *) + +DOWN THEN DOWN; +PHA; +REWRITE_TAC[INDENT_IN_S1_IMP_BIJ ]]);; + + + + + + +let IN_ORBIT_MAP_IMP_F_Y = prove(` (y:A) IN orbit_map f x ==> f y IN orbit_map f x `, +REWRITE_TAC[orbit_map; IN_ELIM_THM] THEN +STRIP_TAC THEN +EXISTS_TAC ` n + 1 ` THEN +ASM_REWRITE_TAC[ARITH_RULE ` a >= 0 /\ +n + 1 = SUC n`; COM_POWER; I_THM; o_THM]);; + + + + + + + + + + + + +let SURJ_IMP_S2_EQ_IMAGE_S1 = prove(` SURJ (f:A ->B) S1 S2 ==> IMAGE f S1 = S2 `, +REWRITE_TAC[IMAGE; SURJ] THEN SET_TAC[]);; + + + + + + + +let WRGCVDR = prove_by_refinement( +`local_fan (V,E,FF) /\ k = (\x. FST x) + ==> BIJ k FF V /\ + ((!x. x IN V ==> x,hro x IN FF) /\ + (!x. x IN FF ==> x = FST x,hro (FST x)) + ==> (!x. x IN V ==> V = orbit_map hro x))`, +[STRIP_TAC; +ASSUME_TAC2 BIJ_BETWEEN_FF_AND_V; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +DOWN_TAC; +REWRITE_TAC[local_fan; dih2k]; +LET_TAC; +STRIP_TAC; +SUBGOAL_THEN ` (x:real^3), (hro:real^3 -> real^3) x IN FF ` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_SIMP_TAC[]; +DOWN; +UNDISCH_TAC ` FF = face H (x':real^3 # real^3 ) `; +SIMP_TAC[] THEN STRIP_TAC; +NHANH lemma_face_identity; +DOWN_TAC THEN REWRITE_TAC[BIJ]; +NHANH (prove(` SURJ (f:A ->B) S1 S2 ==> IMAGE f S1 = S2 `, +REWRITE_TAC[IMAGE; SURJ] THEN SET_TAC[])); +STRIP_TAC; +EXPAND_TAC "V"; +REPLICATE_TAC 3 DOWN THEN PHA; +SIMP_TAC[]; +STRIP_TAC; +REWRITE_TAC[face; IMAGE; orbit_map; IN_ELIM_THM]; +SUBGOAL_THEN ` (! n. (face_map H POWER n) (x,(hro:real^3 -> real^3 ) x) = +((hro POWER n) x, (hro POWER ( n + 1 )) x )) ` ASSUME_TAC; +INDUCT_TAC; +REWRITE_TAC[POWER; I_THM; ARITH_RULE` 0 + 1 = 1`; POWER_1]; +ASM_REWRITE_TAC[COM_POWER; o_THM]; +DOWN THEN ONCE_REWRITE_TAC[EQ_SYM_EQ]; +NHANH in_orbit_lemma; +ASSUME_TAC2 (SPEC `(vec 0):real^3 ` (GEN `x:real^3 ` ELMS_OF_HYPERMAP_HYP)); +DOWN; +ASM_SIMP_TAC[FUN_EQ_THM]; +STRIP_TAC; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +STRIP_TAC; +SUBGOAL_THEN `f_of_hyp (vec 0,(V:real^3 -> bool),E) ((face_map H POWER n) (x,hro x)) IN (FF: real^3 # real^3 -> bool) ` + ASSUME_TAC; +ASM_SIMP_TAC[]; +DOWN; +NHANH IN_ORBIT_MAP_IMP_F_Y; +REWRITE_TAC[GSYM face]; +ASM_SIMP_TAC[]; +(* gggggggggggggggggggg *) +DOWN; +ASM_REWRITE_TAC[f_of_hyp]; +DOWN_TAC; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +STRIP_TAC; +DOWN; +UNDISCH_TAC `face H (x,(hro: real^3 -> real^3) x) = face H x' `; +SIMP_TAC[]; +DISCH_TAC; +UNDISCH_TAC `face H (x':real^3 # real^3 ) = FF`; +SIMP_TAC[]; +FIRST_ASSUM NHANH; +REWRITE_TAC[PAIR_EQ]; +SIMP_TAC[GSYM ADD1; COM_POWER; o_THM]; +(* iiiiiiiiiiiiiiiiiiiiiiii *) +REWRITE_TAC[FUN_EQ_THM]; +GEN_TAC THEN EQ_TAC; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +DOWN; +ASM_SIMP_TAC[]; +STRIP_TAC; +EXISTS_TAC `n: num `; +ASM_SIMP_TAC[]; +(* ::::::::::::::::::: *) +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC `(hro POWER n) (x: real^3 ), (hro POWER (n + 1)) x `; +ASM_REWRITE_TAC[]; +EXISTS_TAC `n:num `; +ASM_REWRITE_TAC[]]);; + + + + + + +let SET_TAC = +let basicthms = +[NOT_IN_EMPTY; IN_UNIV; IN_UNION; IN_INTER; IN_DIFF; IN_INSERT; +IN_DELETE; IN_REST; IN_INTERS; IN_UNIONS; IN_IMAGE] in +let allthms = basicthms @ map (REWRITE_RULE[IN]) basicthms @ +[IN_ELIM_THM; IN] in +let PRESET_TAC = +TRY(POP_ASSUM_LIST(MP_TAC o end_itlist CONJ)) THEN +REPEAT COND_CASES_TAC THEN +REWRITE_TAC[EXTENSION; SUBSET; PSUBSET; DISJOINT; SING] THEN +REWRITE_TAC allthms in +fun ths -> +PRESET_TAC THEN +(if ths = [] then ALL_TAC else MP_TAC(end_itlist CONJ ths)) THEN +MESON_TAC[];; + +let SET_RULE tm = prove(tm,SET_TAC[]);; + + +(* ====================================== *) + +(* ============ MFMPCVM ================ *) + +(* ===================================== *) +let rho_fan = new_specification ["rho_fan"] +(MATCH_MP +(MESON[]`(! a b c d e. P a b c d e) ==> ? e. ! a b c d. P a b c d e `) +(GEN_ALL WRGCVDR));; + +rho_fan;; +(* ================================= *) +(* PJRIMCV *) +(* ================================= *) +let interior_angle = new_definition +` interior_angle v E = azim_in_fan (v, rho_fan v) E `;; + + +let wedge_fan_gt = new_definition +` wedge_fan_gt v E = wedge_in_fan_gt (v, rho_fan v) E `;; + + +let wedge_fan_ge = new_definition +`wedge_fan_ge v E = wedge_in_fan_ge (v, rho_fan v) E`;; + + + +(* ============================= *) +(* localization *) +(* BIFQATK *) +(* ============================= *) + +let v_prime = new_definition `v_prime V FF = {v| v IN V /\ + (?w. (v,w) IN FF )} `;; + +let e_prime = new_definition ` e_prime E FF = {{v,w} | {v,w} IN E /\ +(v,w) IN FF } `;; + + +let IMP_FAN_V_PRIME_E_PRIME = prove_by_refinement +(`FAN (v, V, E) /\ (?x. x IN dart (hypermap (HYP (v,V,E))) /\ +FF = face ( hypermap (HYP (v, V, E))) x) +==> FAN (v, v_prime V FF , e_prime E FF ) `, +[REWRITE_TAC[FAN; v_prime; e_prime]; +STRIP_TAC; +CONJ_TAC; +REWRITE_TAC[UNIONS_SUBSET; IN_ELIM_THM]; +REPEAT STRIP_TAC; +DOWN THEN SIMP_TAC[]; +DOWN; +MP_TAC (SPEC `v: real^3 ` (GEN `x: real^3 ` ELMS_OF_HYPERMAP_HYP)); +ANTS_TAC THENL [ +ASM_REWRITE_TAC[FAN]; +DOWN THEN DOWN]; +REWRITE_TAC[face]; +SIMP_TAC[]; +STRIP_TAC THEN STRIP_TAC THEN STRIP_TAC; +NHANH_PAT `\x. x ==> y ` IN_ORBIT_MAP_IMP_F_Y; +REWRITE_TAC[f_of_hyp]; +UNDISCH_TAC ` {v', (w:real^3) } IN E `; +UNDISCH_TAC ` UNIONS E SUBSET (V: real^3 -> bool) `; +REWRITE_TAC[UNIONS_SUBSET]; +DISCH_THEN NHANH; +SET_TAC[]; + + + +UNDISCH_TAC ` graph (E:(real^3 -> bool) -> bool) `; +REWRITE_TAC[graph]; +DISCH_TAC; +CONJ_TAC; +DOWN THEN SET_TAC[]; + +REWRITE_TAC[fan1; fan2; fan6; fan7]; + + +CONJ_TAC; +DOWN_TAC; +REWRITE_TAC[fan1]; +STRIP_TAC; +CONJ_TAC; +UNDISCH_TAC `FINITE (V:real^3 -> bool) `; +MATCH_MP_TAC (REWRITE_RULE[TAUT` a /\ b ==> c <=> +b ==> a ==> c `] FINITE_SUBSET); +SET_TAC[]; + + +DOWN THEN DOWN; +NHANH (MESON[face_refl]` FF = face H x ==> x IN FF `); +REPEAT STRIP_TAC; +MP_TAC (SPEC `v:real^3 ` (GEN `x:real^3 ` ELMS_OF_HYPERMAP_HYP)); +ANTS_TAC THENL [ +ASM_REWRITE_TAC[FAN; graph; fan1]; +STRIP_TAC]; +UNDISCH_TAC `x IN dart (hypermap (HYP (v,V,E)))`; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASSUME_TAC2 ( +ISPEC `x:real^3#real^3 ` (GEN `y:A#A ` IN_DARTS_HYP_IMP_FST_SND_IN_V)); +UNDISCH_TAC `(x:real^3 # real^3 ) IN FF `; +REWRITE_TAC[]; +ONCE_REWRITE_TAC[GSYM PAIR]; +ABBREV_TAC ` fx = FST (x:real^3 # real^3) `; +ASM SET_TAC[]; +(* ---------------------------------------------------------------- *) + + + +DOWN_TAC THEN REWRITE_TAC[fan1; fan2]; +STRIP_TAC; +CONJ_TAC; +ASM SET_TAC[]; + +DOWN_TAC THEN REWRITE_TAC[fan6; fan7]; +SET_TAC[]]);; + +let E_PRIME_SUBSET_E = prove(` e_prime E FF SUBSET E `, +REWRITE_TAC[e_prime; SUBSET; IN_ELIM_THM] THEN +REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]);; + +let SUBSET_IMP_SO_DO_EE = +prove(` W1 SUBSET W2 ==> EE v W1 SUBSET EE v W2 `, +REWRITE_TAC[EE] THEN SET_TAC[]);; + + + + +let FST_SND_X_IN_EE_E_PRIME =prove(` +(x:A #A) IN FF /\ {FST x, SND x} IN E +==> FST x IN EE (SND x) (e_prime E FF ) /\ +SND x IN EE (FST x) (e_prime E FF) `, +PAT_ONCE_REWRITE_TAC`\x. x ==> y ` [GSYM PAIR] THEN +ABBREV_TAC ` ax = FST (x:A#A) ` THEN +REWRITE_TAC[EE; IN_ELIM_THM; e_prime] THEN +STRIP_TAC THEN +CONJ_TAC THENL [ +EXISTS_TAC `ax: A ` THEN +EXISTS_TAC `SND (x:A#A) ` THEN +ASM_SIMP_TAC[INSERT_COMM] ; +EXISTS_TAC `ax:A` THEN +EXISTS_TAC `SND (x:A#A) ` THEN +ASM_REWRITE_TAC[]]);; + + + + +let W_SUBSET_SINGLETON_IMP_IDE = +prove(` W SUBSET {p} ==> azim_cycle W v w p = p `, +SIMP_TAC[azim_cycle]);; + + + + +let CYCLIC_MAP_IMP_CIRCLE_ITSELF = +prove_by_refinement(` +(!(x:A). x IN W ==> W = orbit_map f x ) /\ y IN W +==> (?x. x IN W /\ y = f x )`, [ +IMP_TAC THEN DISCH_TAC; +FIRST_ASSUM (NHANH_PAT `\x. x ==> l`); +STRIP_TAC; +UNDISCH_TAC `y:A IN W `; +FIRST_ASSUM (fun x -> PAT_ONCE_REWRITE_TAC`\x. x ==> y ` [x]); +NHANH IN_ORBIT_MAP_IMP_F_Y; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +FIRST_ASSUM (NHANH_PAT `\x. x ==> y `); +STRIP_TAC; +UNDISCH_TAC `y:A IN W `; +FIRST_ASSUM (fun x -> PAT_REWRITE_TAC`\x. x ==> y `[x]); +REWRITE_TAC[orbit_map; IN_ELIM_THM; POWER_FUNCTION; GSYM COM_POWER_FUNCTION]; +STRIP_TAC; +EXISTS_TAC `(f POWER n) (y:A) `; +CONJ_TAC; +ASM_REWRITE_TAC[lemma_in_orbit]; +FIRST_X_ASSUM ACCEPT_TAC]);; + + + + + + + + + + + + + + + + +(* ================================= *) +(* definition 7.8 RTPRRJS *) +(* chapter: Local Fan *) +(* ================================= *) + + +let generic = new_definition` generic V E <=> +(! v w u. {v,w} IN E /\ u IN V ==> aff_ge { vec 0 } {v,w} INTER +aff_lt {vec 0} {u} = {} )`;; + + +let circular = new_definition ` circular V E <=> +(? v w u. {v,w} IN E /\ u IN V /\ ~(aff_gt { vec 0 } {v,w} INTER +aff_lt {vec 0} {u} = {}) )`;; + + +let lunar = new_definition +` lunar (v,w) V E <=> ~(circular V E) /\ {v,w} SUBSET V /\ +~( v = w ) /\ collinear {vec 0, v, w } `;; + +open Aff_sgn_tac;; +let AFF_SGN_TRULE tm = prove (tm, AFF_SGN_TAC);; + + +let DIH2K_IMP_NODE_MAP_X_DIFF_X = +prove(`FINITE (dart H) /\ dih2k H k /\ ~(k = 0) ==> +(!x. x IN dart H ==> ~((node_map H) x = x )) `, +NHANH DIH2K_IMP_PRE_SIMPLE_HYP THEN +STRIP_TAC THEN FIRST_ASSUM NHANH THEN +MESON_TAC[face_refl]);; + + + + +let FAN_IMP_FINITE_DARTS = +prove(` FAN ((x:real^3),V,E) ==> FINITE (darts_of_hyp E V) `, +NHANH HYP_LEMMA THEN +SIMP_TAC[GSYM hypermap_tybij; HYP]);; + + + +let FAN_IMP_NOT_EMPTY_DARTS = +prove(` FAN ((x:real^N),V,E) ==> ~(darts_of_hyp E V = {} ) `, +REWRITE_TAC[darts_of_hyp; FAN; fan1; ord_pairs; self_pairs; EE] +THEN SET_TAC[]);; + + + + + + + +let FAN7_SIMPLE = +prove(`!x. fan7 ((x:real^N),V,E) ==> (!a b. a IN V /\ b IN V +==> aff_ge {x} {a} INTER aff_ge {x} {b} = +aff_ge {x} ({a} INTER {b})) `, +REWRITE_TAC[fan7] THEN SET_TAC[]);; + + + + + +let FAN_IMP_DIFF = +prove(`FAN (x,V,E) ==> (!v. v IN V \/ v IN UNIONS E ==> ~( v = x )) `, +REWRITE_TAC[FAN; fan2] THEN SET_TAC[]);; + + + +let AFF_GE_TO_AFF_GT2_GE1 = prove_by_refinement( +` ~( u = x ) /\ ~( v = x ) ==> +aff_ge {x} {u,v} = aff_gt {x} {u,v} UNION aff_ge {x} {u} +UNION aff_ge {x} {v} `, +[SIMP_TAC[ +AFF_SGN_TRULE` ~( u = x ) /\ ~( v = x ) ==> +aff_ge {x} {u,v} = {w| ? tx tu tv. &0 <= tu /\ &0 <= tv /\ +tx + tu + tv = &1 /\ w = tx % x + tu % u + tv % v } `]; +SIMP_TAC[ +AFF_SGN_TRULE` ~( u = x ) /\ ~( v = x ) ==> +aff_gt {x} {u,v} = {w| ? tx tu tv. &0 < tu /\ &0 < tv /\ +tx + tu + tv = &1 /\ w = tx % x + tu % u + tv % v } `]; +SIMP_TAC[ +AFF_SGN_TRULE` ~( u = x ) ==> +aff_ge {x} {u} = {w| ? tx tu . &0 <= tu /\ +tx + tu = &1 /\ w = tx % x + tu % u} `]; +REWRITE_TAC[SET_RULE` a = b <=> (!x. x IN a <=> x IN b) `; IN_ELIM_THM; IN_UNION]; +REPEAT STRIP_TAC; +EQ_TAC; +STRIP_TAC; +ASM_CASES_TAC ` tu = &0 `; +DISJ2_TAC THEN DISJ2_TAC; +EXISTS_TAC ` tx: real `; +EXISTS_TAC `tv:real`; +ASM_SIMP_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID]; +ASM_REAL_ARITH_TAC; +(* ========= *) +ASM_CASES_TAC ` tv = &0 `; +DISJ2_TAC THEN DISJ1_TAC; +EXISTS_TAC `tx:real`; +EXISTS_TAC `tu:real`; +ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID]; +ASM_REAL_ARITH_TAC; +DISJ1_TAC; +ASM_MESON_TAC[REAL_ARITH` &0 <= a /\ ~(a = &0 ) <=> &0 < a `]; +(* _______________ *) +STRIP_TAC; +ASM_MESON_TAC[REAL_ARITH` &0 <= a /\ ~(a = &0 ) <=> &0 < a `]; +(* iiiii *) +EXISTS_TAC `tx:real`; +EXISTS_TAC `tu:real `; +EXISTS_TAC ` &0 `; +ASM_SIMP_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID; REAL_ADD_RID]; +REAL_ARITH_TAC; +(* yyyyyyyyyyyy *) +EXISTS_TAC ` tx:real `; +EXISTS_TAC ` &0 `; +EXISTS_TAC `tu:real`; +ASM_SIMP_TAC[REAL_ADD_LID; VECTOR_MUL_LZERO; VECTOR_ADD_LID]; +REAL_ARITH_TAC]);; + + + + + + + +let AFF_GE_INTER_AFF_LT_IMP_NOT_EQ_COL = +prove_by_refinement(`~((v:real^3) = vec 0)/\ +~( u = vec 0 ) /\ +~(aff_ge {vec 0} {v} INTER aff_lt {vec 0} {u} = {}) +==> ~ (u = v ) /\ collinear {vec 0, u, v } `, +[ONCE_REWRITE_TAC[EQ_SYM_EQ]; +STRIP_TAC THEN DOWN; +ASM_SIMP_TAC[AFF_GE_1_1; +REWRITE_RULE[SET_RULE` DISJOINT {a} {b} <=> ~( a = b ) `] +AFF_LT_1_1; SET_RULE` ~( {} = a INTER b ) <=> ?x. x IN a /\ x IN b `]; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +CONJ_TAC; +STRIP_TAC; +UNDISCH_TAC` x = t1' % vec 0 + t2' % (u:real^3) `; +ASM_SIMP_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +REWRITE_TAC[VECTOR_ARITH` a % x = b % x <=> (a - b ) % x = vec 0 `]; +REWRITE_TAC[VECTOR_MUL_EQ_0]; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +ASM_SIMP_TAC[DE_MORGAN_THM]; +ASM_REAL_ARITH_TAC; +(* hhhhhhhhhh *) +ASM_REWRITE_TAC[COLLINEAR_LEMMA]; +EXISTS_TAC ` t2' / (t2:real) `; +DOWN; +ASM_SIMP_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID]; + +ASM_CASES_TAC ` t2 = &0 `; +ASM_SIMP_TAC[VECTOR_ARITH` &0 % x = c <=> c = vec 0`;VECTOR_MUL_EQ_0]; +ASM_REAL_ARITH_TAC; +ASSUME_TAC2 (REAL_FIELD` ~( t2 = &0) ==> t2' = t2 * (t2' / t2 ) `); +FIRST_ASSUM SUBST1_TAC; +REWRITE_TAC[GSYM VECTOR_MUL_ASSOC; VECTOR_MUL_LCANCEL]; +DOWN THEN ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[]; +REPEAT STRIP_TAC; +ASM_REAL_ARITH_TAC]);; + + + + + + + + +let CIZMRRH = prove_by_refinement +(`local_fan (V,E,FF) ==> +generic V E /\ ~(circular V E \/ (? v w. lunar (v,w) V E )) \/ +circular V E /\ ~(generic V E \/ (? v w. lunar (v,w) V E )) \/ +(? v w. lunar (v,w) V E ) /\ ~( generic V E \/ circular V E ) `, +[ASM_CASES_TAC `(!v w u. + {(v:real^3), w} IN E /\ u IN V + ==> aff_ge {vec 0} {v, w} INTER aff_lt {vec 0} {u} = {})`; +REWRITE_TAC[convex_local_fan; generic]; +STRIP_TAC; +DISJ1_TAC; +ASM_REWRITE_TAC[circular; lunar; DE_MORGAN_THM]; +CONJ_TAC; +REWRITE_TAC[NOT_EXISTS_THM; +TAUT` ~( a /\ b /\ c) <=> a /\ b ==> ~c `]; +ASM_MESON_TAC[ +SET_RULE` a INTER b = {} /\ aa SUBSET a ==> aa INTER b = {} `; +AFF_GT_SUBSET_AFF_GE]; +REWRITE_TAC[GSYM circular; NOT_EXISTS_THM; DE_MORGAN_THM]; +REPEAT GEN_TAC THEN DISJ2_TAC; +ASM_CASES_TAC `{v:real^3, w} SUBSET V `; +DISJ2_TAC; +REWRITE_TAC[GSYM (TAUT` ~ a ==> b <=> a \/ b `)]; + +DOWN_TAC; +REWRITE_TAC[local_fan]; +LET_TAC; +NHANH FAN_IMP_NOT_EMPTY_DARTS; +NHANH ELMS_OF_HYPERMAP_HYP; +ASM_SIMP_TAC[]; +IMP_TAC; +REWRITE_TAC[TAUT`(a/\b)/\c <=> a/\b/\c`]; +IMP_TAC; +IMP_TAC; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[]; +NHANH (MESON[dih2k]` dih2k H d ==> CARD (dart H) = 2 * d `); +MP_TAC (ISPEC `H: (real^3#real^3)hypermap ` hypermap_lemma); +REPEAT STRIP_TAC; +ASSUME_TAC2 (ISPEC `dart (H:(real^3#real^3)hypermap)` CARD_EQ_0); +UNDISCH_TAC` ~( {} = dart (H:(real^3#real^3)hypermap)) `; +REWRITE_TAC[]; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +DOWN; +ASM_REWRITE_TAC[ARITH_RULE`2 * k = 0 <=> k = 0 `]; +ONCE_REWRITE_TAC[TAUT` a ==> b <=> ~ b ==> ~ a `]; +STRIP_TAC; +ASSUME_TAC2 ( +ISPECL [`CARD (FF:real^3#real^3 -> bool) `;`H:(real^3#real^3) hypermap `] +(GEN_ALL DIH2K_IMP_NODE_MAP_X_DIFF_X)); +DOWN_TAC; +REWRITE_TAC[FAN; INSERT_SUBSET; EMPTY_SUBSET]; +STRIP_TAC; +ASSUME_TAC2 (SPEC `v:real^3 ` IN_V_OF_FAN_EXISTS_DART); +DOWN; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM NHANH; +STRIP_TAC; +DOWN THEN DOWN; +UNDISCH_TAC` darts_of_hyp E (V:real^3 -> bool) = dart H `; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[]; +STRIP_TAC; +REWRITE_TAC[darts_of_hyp; IN_UNION; self_pairs; IN_ELIM_THM]; +ONCE_REWRITE_TAC[TAUT`a\/b <=> b\/a`]; +DISCH_THEN DISJ_CASES_TAC; +DOWN THEN STRIP_TAC; +UNDISCH_TAC `n_of_hyp (vec 0,(V:real^3 -> bool),E) = node_map H`; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[]; +STRIP_TAC; +REWRITE_TAC[n_of_hyp]; +UNDISCH_TAC` EE (v'':real^3) E = {} `; +DOWN THEN DOWN; +SIMP_TAC[PAIR_EQ; EMPTY_SUBSET; W_SUBSET_SINGLETON_IMP_IDE]; +(* --------------------------------------------------- *) +DOWN; +REWRITE_TAC[ord_pairs; IN_ELIM_THM; PAIR_EQ]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +UNDISCH_TAC` (w:real^3) IN V `; +UNDISCH_TAC ` {(a:real^3),b} IN E `; +PHA; +UNDISCH_TAC `!v w u. + {(v:real^3), w} IN E /\ u IN V + ==> {} = aff_ge {vec 0} {v, w} INTER aff_lt {vec 0} {u}`; +DISCH_TAC; +FIRST_ASSUM NHANH; +DOWN_TAC; +REWRITE_TAC[fan2]; +REWRITE_TAC[SET_RULE` ~( x IN s) <=> (!a. a IN s ==> ~(a = x )) `]; +REPLICATE_TAC 10 (IMP_TAC THEN DISCH_TAC); +FIRST_X_ASSUM NHANH; +STRIP_TAC; +REWRITE_TAC[COLLINEAR_LEMMA; DE_MORGAN_THM]; +CONJ_TAC THENL [ +EXPAND_TAC "a" THEN +FIRST_ASSUM ACCEPT_TAC; +CONJ_TAC THENL [ +FIRST_ASSUM ACCEPT_TAC; +REWRITE_TAC[]]]; + +ASSUME_TAC2 (ISPEC `vec 0:real^3 ` FAN7_SIMPLE); +DOWN THEN PHA THEN STRIP_TAC; +STRIP_TAC; +ASM_CASES_TAC `c = &0 ` THENL [ +UNDISCH_TAC `w = c % (a:real^3)` THEN +ASM_REWRITE_TAC[VECTOR_MUL_LZERO]; +ASM_CASES_TAC ` c = &1 `] THENL [ +UNDISCH_TAC `w = c % (a:real^3) ` THEN +ASM_SIMP_TAC[VECTOR_MUL_LID] THEN +EXPAND_TAC "a" THEN +FIRST_X_ASSUM ACCEPT_TAC; +ASM_CASES_TAC ` &0 < c `]; +(* ---------- sub 1 ---------- *) +UNDISCH_TAC` w IN (V:real^3 -> bool) `; +UNDISCH_TAC` v IN (V:real^3 -> bool) `; +PHA; +FIRST_ASSUM NHANH; +UNDISCH_TAC`~(w = (v:real^3)) `; +SIMP_TAC[SET_RULE`~(a = b) <=> {a} INTER {b} = {} `; INTER_COMM]; +REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING]; +ASSUME_TAC2 (AFF_SGN_TRULE`!v. ~((v:real^3) = vec 0) ==> +aff_ge {vec 0} {v} = { x| ?t0 tv. &0 <= tv /\ t0 + tv = &1 /\ +x = t0 % (vec 0) + tv % v } `); +ASSUME_TAC2 (SPEC `w:real^3` (AFF_SGN_TRULE`!v. ~((v:real^3) = vec 0) ==> +aff_ge {vec 0} {v} = { x| ?t0 tv. &0 <= tv /\ t0 + tv = &1 /\ +x = t0 % (vec 0) + tv % v } `)); +DOWN THEN DOWN THEN PHA THEN SIMP_TAC[]; +REPEAT STRIP_TAC; +DOWN; +UNDISCH_TAC ` ~((w:real^3) = vec 0) `; +PHA; +MATCH_MP_TAC (SET_RULE` a IN S ==> ~(~(a = x ) /\ S = {x}) `); +REWRITE_TAC[IN_INTER; IN_ELIM_THM]; +CONJ_TAC; +EXISTS_TAC` &1 - c `; +EXISTS_TAC `c:real`; +UNDISCH_TAC `&0 < c `; +SIMP_TAC[REAL_ARITH` &0 < a ==> &0 <= a `; +REAL_ARITH` &1 - c + c = &1 `; VECTOR_MUL_RZERO; +VECTOR_ADD_LID]; +ASM_REWRITE_TAC[]; +(* ============================ *) +EXISTS_TAC `&0 `; +EXISTS_TAC `&1 `; + +SIMP_TAC[VECTOR_MUL_LID; VECTOR_MUL_RZERO; +VECTOR_ADD_LID]; +REAL_ARITH_TAC; +UNDISCH_TAC ` ~(c = &0 ) `; +DOWN; +PHA; +REWRITE_TAC[REAL_ARITH` ~(&0 < c) /\ ~(c = &0) <=> c < &0 `]; +STRIP_TAC; +UNDISCH_TAC` {} = aff_ge {vec 0} {a, b} INTER aff_lt {vec 0} {(w:real^3)}`; +EXPAND_TAC "a"; +EXPAND_TAC "b"; +ASSUME_TAC2 (AFF_SGN_TRULE` ~((w:real^3) = vec 0) ==> +aff_lt {vec 0} {w} = {x | ? t0 tw . tw < &0 /\ t0 + tw = &1 /\ +x = t0 % (vec 0) + tw % w }`); +ASSUME_TAC2 ( +AFF_SGN_TRULE` ~((v:real^3) = vec 0) /\ ~( v' = vec 0) ==> +aff_ge {vec 0} {v,v'} = {x | ? t0 tv tv' . &0 <= tv /\ +&0 <= tv' /\ t0 + tv + tv' = &1 /\ +x = t0 % (vec 0) + tv % v + tv' % v' }`); +MATCH_MP_TAC ( +SET_RULE` -- (w:real^3) IN S ==> {} = S ==> F `); +DOWN THEN DOWN THEN PHA THEN SIMP_TAC[]; +REMOVE_TAC; +REWRITE_TAC[IN_INTER; IN_ELIM_THM]; +CONJ_TAC; +EXISTS_TAC` &1 + c `; +EXISTS_TAC ` -- (c:real) `; +EXISTS_TAC `&0 `; +ASM_REWRITE_TAC[VECTOR_MUL_LNEG; VECTOR_MUL_RZERO; VECTOR_MUL_LZERO; +VECTOR_ADD_RID; VECTOR_ADD_LID]; +DOWN THEN REAL_ARITH_TAC; +(* =================== *) +EXISTS_TAC `&2 `; +EXISTS_TAC ` -- &1 `; +REWRITE_TAC[VECTOR_MUL_LNEG; VECTOR_MUL_LID; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +REAL_ARITH_TAC; +(* +++++++++++++++++++++++++++++++++++++++++++++++++ *) +(* ================================================= *) +ASM_SIMP_TAC[]; +(* ************************************************* *) +(* ================================================= *) +DOWN; +REWRITE_TAC[NOT_FORALL_THM; TAUT` ~( a ==> b) <=> a /\ ~ b `; +local_fan]; +LET_TAC; +REPEAT STRIP_TAC; +DOWN_TAC; +NHANH FAN_IMP_DIFF; +STRIP_TAC; +SUBGOAL_THEN ` (v:real^3) IN UNIONS E /\ w IN UNIONS E ` ASSUME_TAC +THENL [REWRITE_TAC[IN_UNIONS] THEN +ASM_MESON_TAC[SET_RULE` a IN {a,b} /\ b IN {a,b} `]; +DOWN_TAC]; +REWRITE_TAC[MESON[]`(!x. P x \/ Q x ==> R x) <=> +(! x. P x ==> R x ) /\ (!x. Q x ==> R x ) `]; +STRIP_TAC; +DOWN THEN DOWN; +FIRST_X_ASSUM NHANH; +UNDISCH_TAC `(u:real^3) IN V `; +FIRST_ASSUM NHANH; +REPEAT STRIP_TAC; +ASSUME_TAC2 ( +AFF_SGN_TRULE` ~((v:real^3) = vec 0 ) /\ ~(w = vec 0 ) ==> +aff_ge {vec 0} {v, w} = {x | ? t0 tv tw. &0 <= tv /\ &0 <= tw /\ +t0 + tv + tw = &1 /\ x = t0 % (vec 0) + tv % v + tw % w } `); +ASSUME_TAC2 ( +ISPECL [`(vec 0):real^3 `;`u:real^3`] (REWRITE_RULE[DISJOINT; +SET_RULE` {a} INTER {b} = {} <=> ~( b = a )`] AFF_LT_1_1)); +SUBGOAL_THEN` ~ (generic (V:real^3 -> bool) E )` ASSUME_TAC +THENL [REWRITE_TAC[generic] THEN +ASM_MESON_TAC[]; +UNDISCH_TAC `~(aff_ge {vec 0} {(v:real^3), w} INTER +aff_lt {vec 0} {u} = {})`]; +ASSUME_TAC2 ( +ISPECL [` v:real^3 `;` (vec 0): real^3 `;` w:real^3 `] +(GEN_ALL AFF_GE_TO_AFF_GT2_GE1)); +DOWN THEN SIMP_TAC[]; +STRIP_TAC; +REWRITE_TAC[SET_RULE`( a UNION b ) INTER c = {} <=> a INTER c = {} /\ +b INTER c = {} `]; +STRIP_TAC; +ASM_SIMP_TAC[]; +DOWN THEN REWRITE_TAC[DE_MORGAN_THM]; +DISCH_TAC; +ASM_CASES_TAC ` circular (V:real^3 -> bool) E ` THENL [ +ASM_SIMP_TAC[lunar]; +DISJ2_TAC]; +ASM_SIMP_TAC[lunar]; +DOWN THEN DOWN THEN STRIP_TAC; +(* there are three subgoal here *) +(* -------- sub 1 -------------- *) +REWRITE_TAC[circular]; +ASM_MESON_TAC[]; +(* --------- sub 2 -------------- *) +DISCH_TAC; +EXISTS_TAC `v:real^3`; +EXISTS_TAC `u:real^3 `; +ASSUME_TAC2 AFF_GE_INTER_AFF_LT_IMP_NOT_EQ_COL; +DOWN; +ASM_SIMP_TAC[INSERT_COMM; INSERT_SUBSET; EMPTY_SUBSET]; +DISCH_TAC; +MATCH_MP_TAC (SET_RULE`v IN UNIONS E /\ UNIONS E SUBSET V ==> v IN V `); +DOWN_TAC; +SIMP_TAC[FAN]; +(* -------------- sub 3 ------------- *) +DISCH_TAC; +EXISTS_TAC `u:real^3 `; +EXISTS_TAC `w:real^3 `; +ASSUME_TAC2 ( +SPEC `w:real^3 ` (GEN `v:real^3 ` AFF_GE_INTER_AFF_LT_IMP_NOT_EQ_COL)); +ASM_SIMP_TAC[]; +ASM_SIMP_TAC[INSERT_COMM; INSERT_SUBSET; EMPTY_SUBSET]; +MATCH_MP_TAC (SET_RULE`v IN UNIONS E /\ UNIONS E SUBSET V ==> v IN V `); +DOWN_TAC; +SIMP_TAC[FAN]]);; + +end;; diff --git a/legacy/oldnonlinear/cutlemmas.hl b/legacy/oldnonlinear/cutlemmas.hl new file mode 100644 index 0000000..3349f59 --- /dev/null +++ b/legacy/oldnonlinear/cutlemmas.hl @@ -0,0 +1,1406 @@ +(* +let truncate_gamma23_x_A = new_definition `truncate_gamma23_x_A iw1 m1 m2 m6 = + scalar6 + (compose6 (truncate_gamma3f_x (#0.14) m1 m2 m6) + dummy6 dummy6 dummy6 proj_x1 proj_x2 proj_x6) + iw1 + + (dih_x - (mk_126 (truncate_dih_x (#0.14)) + constant6 (#0.08))) * + uni((truncate_gamma2_x m1), proj_x1)`;; +*) + +let truncate_gamma23_x_C = new_definition `truncate_gamma23_x_C d iw1 m1 m2 m6 = + scalar6 + (compose6 (truncate_gamma3f_x (#0.14) m1 m2 m6) + dummy6 dummy6 dummy6 proj_x1 proj_x2 proj_x6) + iw1 + + (dih_x - (mk_126 (truncate_dih_x (#0.14)) + constant6 (d))) * + uni((truncate_gamma2_x m1), proj_x1)`;; + + +let truncate_gamma23_x_B = new_definition + `truncate_gamma23_x_B m1 = + (dih_x - constant6 (&2 * #0.08)) * + uni((truncate_gamma2_x m1),proj_x1)`;; + +(* +let nonf_truncate_gamma23_x_A = prove_by_refinement( + `!iw1 m1 m2 m6 x1 x2 x3 x4 x5 x6. + truncate_gamma23_x_A iw1 m1 m2 m6 x1 x2 x3 x4 x5 x6 = + truncate_gamma3f_x #0.14 m1 m2 m6 (&0) (&0) (&0) x1 x2 x6 * iw1 + + (dih_x x1 x2 x3 x4 x5 x6 - + (truncate_dih_x #0.14 x1 x2 (&2) (&2) (&2) x6 + #0.08)) * + truncate_gamma2_x m1 x1`, + (* {{{ proof *) + [ +REWRITE_TAC[truncate_gamma23_x_A;add6;scalar6;compose6;sub6;mul6;mk_126;mk_135;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6;dummy6;constant6;two6;uni] + ]);; + (* }}} *) +*) + +let nonf_truncate_gamma23_x_B = prove_by_refinement( + `! m1 x1 x2 x3 x4 x5 x6. + truncate_gamma23_x_B m1 x1 x2 x3 x4 x5 x6 = + (dih_x x1 x2 x3 x4 x5 x6 - &2 * #0.08) * truncate_gamma2_x m1 x1 `, + (* {{{ proof *) + [ +REWRITE_TAC[truncate_gamma23_x_B;add6;scalar6;compose6;sub6;mul6;mk_126;mk_135;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6;dummy6;constant6;two6;uni] + ]);; + (* }}} *) + +let nonf_truncate_gamma23_x_C = prove_by_refinement( + `!iw1 m1 m2 m6 x1 x2 x3 x4 x5 x6. + truncate_gamma23_x_C d iw1 m1 m2 m6 x1 x2 x3 x4 x5 x6 = + truncate_gamma3f_x #0.14 m1 m2 m6 (&0) (&0) (&0) x1 x2 x6 * iw1 + + (dih_x x1 x2 x3 x4 x5 x6 - + (truncate_dih_x #0.14 x1 x2 (&2) (&2) (&2) x6 + d)) * + truncate_gamma2_x m1 x1`, + (* {{{ proof *) + [ +REWRITE_TAC[truncate_gamma23_x_C;add6;scalar6;compose6;sub6;mul6;mk_126;mk_135;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6;dummy6;constant6;two6;uni] + ]);; + (* }}} *) + +let nonf_truncate_gamma3f_x = prove_by_refinement( + `!d m4 m5 m6 x1 x2 x3 x4 x5 x6. + truncate_gamma3f_x d m4 m5 m6 x1 x2 x3 x4 x5 x6 = + truncate_vol3r_456 d x1 x2 x3 x4 x5 x6 - + truncate_vol3f d m4 m5 m6 x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[truncate_gamma3f_x;sub6]) + ]);; + (* }}} *) + +let nonf_truncate_gamma23_x = prove_by_refinement( + `!iw1 iw2 m1 m2 m3 m5 m6 x1 x2 x3 x4 x5 x6. + truncate_gamma23_x iw1 iw2 m1 m2 m3 m5 m6 x1 x2 x3 x4 x5 x6 = +truncate_gamma3f_x #0.14 m1 m2 m6 (&0) (&0) (&0) x1 x2 x6 * iw1 + + truncate_gamma3f_x #0.14 m1 m3 m5 (&0) (&0) (&0) x1 x3 x5 * iw2 + + (dih_x x1 x2 x3 x4 x5 x6 - + (truncate_dih_x #0.14 x1 x2 (&2) (&2) (&2) x6 + + truncate_dih_x #0.14 x1 (&2) x3 (&2) x5 (&2))) * + truncate_gamma2_x m1 x1`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[truncate_gamma23_x;add6;scalar6;compose6;sub6;mul6;mk_126;mk_135;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6;dummy6;constant6;two6;uni]) + ]);; + (* }}} *) + +let nonf_truncate_sol_x = prove_by_refinement( + `!c x1 x2 x3 x4 x5 x6. + truncate_sol_x c x1 x2 x3 x4 x5 x6 = truncate_dih_x c x1 x2 x3 x4 x5 x6 + + truncate_dih_x c x2 x3 x1 x5 x6 x4 + truncate_dih_x c x3 x1 x2 x6 x4 x5 - pi`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[truncate_sol_x;add6;sub6;constant6;Sphere.rotate2;Sphere.rotate3]) + ]);; + (* }}} *) + +let nonf_truncate_vol_x = prove_by_refinement( + `!c x1 x2 x3 x4 x5 x6. + truncate_vol_x c x1 x2 x3 x4 x5 x6 = (truncate_sqrt c (delta_x x1 x2 x3 x4 x5 x6)) / &12`, + (* {{{ proof *) + [ + REWRITE_TAC[truncate_vol_x;scalar6;uni;]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let nonf_truncate_vol3r_456 = prove_by_refinement( + `!c x1 x2 x3 x4 x5 x6. + truncate_vol3r_456 c x1 x2 x3 x4 x5 x6 = + truncate_vol_x c (&2) (&2) (&2) x4 x5 x6`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[mk_456;truncate_vol3r_456;compose6;two6;proj_x4;proj_x5;proj_x6;constant6]) + ]);; + (* }}} *) + +let nonf_truncate_vol3f = prove_by_refinement( + `!c m4 m5 m6 x1 x2 x3 x4 x5 x6. + truncate_vol3f c m4 m5 m6 x1 x2 x3 x4 x5 x6 = + ((truncate_sol_x c x5 (&2) x4 (&2) x6 (&2) + + truncate_sol_x c x6 (&2) x5 (&2) x4 (&2) + + truncate_sol_x c x4 (&2) x6 (&2) x5 (&2)) * + &2 * + mm1 / pi - + ((lfun (sqrt x4 * #0.5) * m4) * truncate_dih_x c x4 (&2) x6 (&2) x5 (&2) + + (lfun (sqrt x5 * #0.5) * m5) * truncate_dih_x c x5 (&2) x4 (&2) x6 (&2) + + (lfun (sqrt x6 * #0.5) * m6) * truncate_dih_x c x6 (&2) x5 (&2) x4 (&2)) * + &8 * + mm2 / pi )`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[truncate_vol3f;add6;scalar6;mul6;uni;proj_y4;proj_y5;proj_y6;Sphere.rotate5;Sphere.rotate6;Sphere.rotate4;sub6;mk_456;compose6;two6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6;constant6]) + ]);; + (* }}} *) + +let functional_delta_pent_x = prove_by_refinement( + `delta_pent_x = compose6 + delta_x proj_x1 proj_x2 proj_x6 four6 four6 (constant6 (#10.4976))`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;Sphere.delta_pent_x;proj_x1;proj_x2;proj_x6;four6;constant6;compose6]; + REPEAT WEAK_STRIP_TAC; + AP_TERM_TAC; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* +let promote_pow3r = INST_TYPE [(`:real`,`:A`);(`:real`,`:B`);(`:real`,`:C`);(`:real`,`:D`);(`:real`,`:E`)] promote_pow3;; +*) + + +(* +let dih_y_div_sqrtdelta_posbranch = new_definition + `dih_y_div_sqrtdelta_posbranch = y_of_x dih_x_div_sqrtdelta_posbranch`;; +*) + + +(* +let rhof_x = define `rhof_x x = rho (sqrt x)`;; +*) + + +(* +let ineq_lemma = prove_by_refinement( + `!a x b. &0 <= a /\ &0 <= b /\ a pow 2 <= x /\ x <= b pow 2 ==> a <= sqrt x /\ sqrt x <= b`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + STRIP_TAC; + SUBGOAL_THEN `&0 <= x` MP_TAC; + ASM_MESON_TAC [REAL_LE_TRANS;Collect_geom.REAL_LE_SQUARE_POW]; + ASM_MESON_TAC[Collect_geom.POW2_COND;SQRT_WORKS]; + ]);; + (* }}} *) +*) + + + +(* +let ineq_square = prove_by_refinement( + `((!y1 y2 y3 y4 y5 y6. + ineq + [(a1,y1,b1);(a2,y2,b2);(a3,y3,b3);(a4,y4,b4);(a5,y5,b5);(a6,y6,b6)] + (P y1 y2 y3 y4 y5 y6)) ==> + ((&0 <= a1 /\ &0 <= a2 /\ &0 <= a3 /\ &0 <= a4 /\ &0 <= a5 /\ &0 <= a6 /\ + &0 <= b1 /\ &0 <= b2 /\ &0 <= b3 /\ &0 <= b4 /\ &0 <= b5 /\ &0 <= b6 )) ==> + (!x1 x2 x3 x4 x5 x6. + ineq [(a1 pow 2,x1,b1 pow 2);(a2 pow 2,x2,b2 pow 2);(a3 pow 2,x3,b3 pow 2); + (a4 pow 2,x4,b4 pow 2);(a5 pow 2,x5,b5 pow 2);(a6 pow 2,x6,b6 pow 2)] + (P (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6))))`, + (* {{{ proof *) + [ + REWRITE_TAC[ineq]; + REPEAT STRIP_TAC; + FIRST_X_ASSUM (fun t-> MP_TAC (SPECL [`sqrt x1`;`sqrt x2`;`sqrt x3`;`sqrt x4`;`sqrt x5`;`sqrt x6`] t)); + ASM_MESON_TAC[ineq_lemma]; + ]);; + (* }}} *) +*) + + + + +let gamma3f_135_n_alt = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + gamma3f_135_n y1 y2 y3 y4 y5 y6 = gamma3f_135_s_n y1 y2 y3 y4 y5 y6 + + (&8 * mm2/ pi) * + (y_of_x lmdih_x_n y1 y2 y3 y4 y5 y6 + + y_of_x lmdih3_x_n y1 y2 y3 y4 y5 y6 + + y_of_x lmdih5_x_n y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.gamma3f_135_n;gamma3f_135_s_n;lmdih_x_n;lmdih3_x_n;lmdih5_x_n;Sphere.y_of_x;Sphere.delta_y]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let gamma3f_126_n_alt = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + gamma3f_126_n y1 y2 y3 y4 y5 y6 = gamma3f_126_s_n y1 y2 y3 y4 y5 y6 + + (&8 * mm2/ pi) * + (y_of_x lmdih_x_n y1 y2 y3 y4 y5 y6 + + y_of_x lmdih2_x_n y1 y2 y3 y4 y5 y6 + + y_of_x lmdih6_x_n y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.gamma3f_126_n;gamma3f_126_s_n;lmdih_x_n;lmdih2_x_n;lmdih6_x_n;Sphere.y_of_x;Sphere.delta_y]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let gamma23f_n_alt = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6 w1 w2 f. gamma23f_n y1 y2 y3 y4 y5 y6 w1 w2 sqrt2 f = + gamma3f_126_n y1 y2 sqrt2 sqrt2 sqrt2 y6 / &w1 + + gamma3f_135_n y1 sqrt2 y3 sqrt2 y5 sqrt2 / &w2 + + gamma3f_vLR_n y1 y2 y3 y4 y5 y6 f`, + (* {{{ proof *) + [ + REWRITE_TAC[gamma3f_vLR_n;Sphere.gamma23f_n]; + ]);; + (* }}} *) + +let gamma23f_126_03_n_alt = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6 f. gamma23f_126_03_n y1 y2 y3 y4 y5 y6 w1 sqrt2 f = + gamma3f_126_n y1 y2 sqrt2 sqrt2 sqrt2 y6 / &w1 + + gamma3f_vL_n y1 y2 y3 y4 y5 y6 f`, + (* {{{ proof *) + [ + REWRITE_TAC[gamma3f_vL_n;Sphere.gamma23f_126_03_n]; + ]);; + (* }}} *) + +let gamma3f_vLR_n0_case = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. &2 * h0 <= y1 ==> gamma3f_vLR_n y1 y2 y3 y4 y5 y6 lmfun = + gamma3f_vLR_n0 y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[gamma3f_vLR_n;gamma3f_vLR_n0;Sphere.vol2f;]; + ASM_SIMP_TAC[lmfun0;REAL_MUL_RZERO;REAL_SUB_RZERO]; + ]);; + (* }}} *) + +let gamma3f_vLR_nlfun_case = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. y1 <= &2 * h0 ==> gamma3f_vLR_n y1 y2 y3 y4 y5 y6 lmfun = + gamma3f_vLR_nlfun y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[gamma3f_vLR_n;Sphere.vol2f;gamma3f_vLR_nlfun]; + ASM_SIMP_TAC[lmfun_lfun]; + ]);; + (* }}} *) + +let gamma3f_vL_n0_case = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. &2 * h0 <= y1 ==> gamma3f_vL_n y1 y2 y3 y4 y5 y6 lmfun = + gamma3f_vL_n0 y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[gamma3f_vL_n;Sphere.vol2f;gamma3f_vL_n0]; + ASM_SIMP_TAC[lmfun0;REAL_MUL_RZERO;REAL_SUB_RZERO]; + ]);; + (* }}} *) + +let gamma3f_vL_nlfun_case = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. y1 <= &2 * h0 ==> gamma3f_vL_n y1 y2 y3 y4 y5 y6 lmfun = + gamma3f_vL_nlfun y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[gamma3f_vL_n;Sphere.vol2f;gamma3f_vL_nlfun]; + ASM_SIMP_TAC[lmfun_lfun]; + ]);; + (* }}} *) + + +let rr f s = REWRITE_RULE[Sphere.y_of_x] (f s);; + +let lmdih_n0 = rr prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. (&2 * h0 <= y1 ) ==>(y_of_x lmdih_x_n y1 y2 y3 y4 y5 y6 = &0 )`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.y_of_x;lmdih_x_n]; + REPEAT STRIP_TAC; + ASM_SIMP_TAC[REWRITE_RULE[Sphere.y_of_x] lmdih0]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let lmdih2_n0 = rr prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. (&2 * h0 <= y2 ) ==>(y_of_x lmdih2_x_n y1 y2 y3 y4 y5 y6 = &0 )`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.y_of_x;lmdih_x_n;lmdih2_x_n;Sphere.lmdih2_x_div_sqrtdelta_posbranch;Sphere.rotate2]; + REPEAT STRIP_TAC; + ASM_SIMP_TAC[REWRITE_RULE[Sphere.y_of_x] lmdih0]; + REAL_ARITH_TAC; + ]);; + +let lmdih3_n0 = rr prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. (&2 * h0 <= y3 ) ==>(y_of_x lmdih3_x_n y1 y2 y3 y4 y5 y6 = &0 )`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.y_of_x;lmdih_x_n;lmdih3_x_n;Sphere.lmdih3_x_div_sqrtdelta_posbranch;Sphere.rotate3]; + REPEAT STRIP_TAC; + ASM_SIMP_TAC[REWRITE_RULE[Sphere.y_of_x] lmdih0]; + REAL_ARITH_TAC; + ]);; + +let lmdih5_n0 = rr prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. (&2 * h0 <= y5 ) ==>(y_of_x lmdih5_x_n y1 y2 y3 y4 y5 y6 = &0 )`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.y_of_x;lmdih_x_n;lmdih5_x_n;Sphere.lmdih5_x_div_sqrtdelta_posbranch;Sphere.rotate5]; + REPEAT STRIP_TAC; + ASM_SIMP_TAC[REWRITE_RULE[Sphere.y_of_x] lmdih0]; + REAL_ARITH_TAC; + ]);; + +let lmdih6_n0 = rr prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. (&2 * h0 <= y6 ) ==>(y_of_x lmdih6_x_n y1 y2 y3 y4 y5 y6 = &0 )`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.y_of_x;lmdih_x_n;lmdih6_x_n;Sphere.lmdih6_x_div_sqrtdelta_posbranch;Sphere.rotate6]; + REPEAT STRIP_TAC; + ASM_SIMP_TAC[REWRITE_RULE[Sphere.y_of_x] lmdih0]; + REAL_ARITH_TAC; + ]);; + + +let lmdih_ldih_n = rr prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. (&0 <= y1 /\ y1 <= &2 * h0) ==>(y_of_x lmdih_x_n y1 y2 y3 y4 y5 y6 = y_of_x ldih_x_n y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.y_of_x;lmdih_x_n;ldih_x_n]; + REPEAT STRIP_TAC; + ASM_SIMP_TAC[REWRITE_RULE[Sphere.y_of_x] lmdih_ldih]; + ]);; + (* }}} *) + +let lmdih2_ldih2_n = rr prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. (&0 <= y2 /\ y2 <= &2 * h0) ==>(y_of_x lmdih2_x_n y1 y2 y3 y4 y5 y6 = y_of_x ldih2_x_n y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.y_of_x;Sphere.lmdih2_x_div_sqrtdelta_posbranch;Sphere.rotate2;Sphere.ldih2_x_div_sqrtdelta_posbranch;lmdih2_x_n;ldih2_x_n]; + REPEAT STRIP_TAC; + ASM_SIMP_TAC[REWRITE_RULE[Sphere.y_of_x] lmdih_ldih]; + ]);; + (* }}} *) + +let lmdih3_ldih3_n = rr prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. (&0 <= y3 /\ y3 <= &2 * h0) ==>(y_of_x lmdih3_x_n y1 y2 y3 y4 y5 y6 = y_of_x ldih3_x_n y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.y_of_x;Sphere.lmdih3_x_div_sqrtdelta_posbranch;Sphere.rotate3;Sphere.ldih3_x_div_sqrtdelta_posbranch;lmdih3_x_n;ldih3_x_n]; + REPEAT STRIP_TAC; + ASM_SIMP_TAC[REWRITE_RULE[Sphere.y_of_x] lmdih_ldih]; + ]);; + (* }}} *) + +let lmdih5_ldih5_n = rr prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. (&0 <= y5 /\ y5 <= &2 * h0) ==>(y_of_x lmdih5_x_n y1 y2 y3 y4 y5 y6 = y_of_x ldih5_x_n y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.y_of_x;Sphere.lmdih5_x_div_sqrtdelta_posbranch;Sphere.rotate5;Sphere.ldih5_x_div_sqrtdelta_posbranch;lmdih5_x_n;ldih5_x_n]; + REPEAT STRIP_TAC; + ASM_SIMP_TAC[REWRITE_RULE[Sphere.y_of_x] lmdih_ldih]; + ]);; + (* }}} *) + +let lmdih6_ldih6_n = rr prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. (&0 <= y6 /\ y6 <= &2 * h0) ==>(y_of_x lmdih6_x_n y1 y2 y3 y4 y5 y6 = y_of_x ldih6_x_n y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.y_of_x;Sphere.lmdih6_x_div_sqrtdelta_posbranch;Sphere.rotate6;Sphere.ldih6_x_div_sqrtdelta_posbranch;lmdih6_x_n;ldih6_x_n]; + REPEAT STRIP_TAC; + ASM_SIMP_TAC[REWRITE_RULE[Sphere.y_of_x] lmdih_ldih]; + ]);; + (* }}} *) + + + + + + +let gamma23f' = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6 w1 w2 f. gamma23f y1 y2 y3 y4 y5 y6 w1 w2 sqrt2 f = + gamma3f_126 y1 y2 y3 y4 y5 y6 f / &w1 + gamma3f_135 y1 y2 y3 y4 y5 y6 f / &w2 + + gamma3f_vLR y1 y2 y3 y4 y5 y6 f `, + (* {{{ proof *) + [ + REWRITE_TAC[gamma23f;gamma3f_126;gamma3f_135;gamma3f_vLR]; + ]);; + (* }}} *) + +let gamma23f_126_03' = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6 w1 f. gamma23f_126_03 y1 y2 y3 y4 y5 y6 w1 sqrt2 f = + gamma3f_126 y1 y2 y3 y4 y5 y6 f / &w1 + gamma3f_vL y1 y2 y3 y4 y5 y6 f `, + (* {{{ proof *) + [ + REWRITE_TAC[gamma23f_126_03;gamma3f_126;gamma3f_vL]; + ]);; + (* }}} *) + +let gamma23f_v' = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6 w1 f. gamma23f_red_03 y1 y2 y3 y4 y5 y6 sqrt2 f = + gamma3f_v y1 y2 y3 y4 y5 y6 f `, + (* {{{ proof *) + [ + REWRITE_TAC[gamma23f_red_03;gamma3f_v]; + ]);; + (* }}} *) + + +let gamma3f_vLR0_case = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. &2 * h0 <= y1 ==> gamma3f_vLR y1 y2 y3 y4 y5 y6 lmfun = + gamma3f_vLR0 y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[gamma3f_vLR;Sphere.vol2f;gamma3f_vLR0]; + ASM_SIMP_TAC[lmfun0;REAL_MUL_RZERO;REAL_SUB_RZERO]; + ]);; + (* }}} *) + + +let gamma3f_vLR_lfun_case = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. y1 <= &2 * h0 ==> gamma3f_vLR y1 y2 y3 y4 y5 y6 lmfun = + gamma3f_vLR_lfun y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[gamma3f_vLR;Sphere.vol2f;gamma3f_vLR_lfun]; + ASM_SIMP_TAC[lmfun_lfun]; + ]);; + (* }}} *) + +let gamma3f_vL0_case = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. &2 * h0 <= y1 ==> gamma3f_vL y1 y2 y3 y4 y5 y6 lmfun = + gamma3f_vL0 y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[gamma3f_vL;Sphere.vol2f;gamma3f_vL0]; + ASM_SIMP_TAC[lmfun0;REAL_MUL_RZERO;REAL_SUB_RZERO]; + ]);; + (* }}} *) + +let gamma3f_vL_lfun_case = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. y1 <= &2 * h0 ==> gamma3f_vL y1 y2 y3 y4 y5 y6 lmfun = + gamma3f_vL_lfun y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[gamma3f_vL;Sphere.vol2f;gamma3f_vL_lfun]; + ASM_SIMP_TAC[lmfun_lfun]; + ]);; + (* }}} *) + + +let gamma3f_v0_case = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. &2 * h0 <= y1 ==> gamma3f_v y1 y2 y3 y4 y5 y6 lmfun = + gamma3f_v0 y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[gamma3f_v;Sphere.vol2f;gamma3f_v0]; + ASM_SIMP_TAC[lmfun0;REAL_MUL_RZERO;REAL_SUB_RZERO]; + ]);; + (* }}} *) + +let gamma3f_v_lfun_case = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. y1 <= &2 * h0 ==> gamma3f_v y1 y2 y3 y4 y5 y6 lmfun = + gamma3f_v_lfun y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[gamma3f_v;Sphere.vol2f;gamma3f_v_lfun]; + ASM_SIMP_TAC[lmfun_lfun]; + ]);; + (* }}} *) + +let gamma3f_126_expand = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. gamma3f_126 y1 y2 y3 y4 y5 y6 f = + vol3r y1 y2 y6 sqrt2 - ((&2 * mm1 / pi) * + (&2 * dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + &2 * dih2_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + + &2 * dih6_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + dih3_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + + dih4_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + dih5_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - &3 * pi) - + (&8 * mm2 / pi) * + (f (y1 / &2) * dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + + f (y2 / &2) * dih2_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + + f (y6 / &2) * dih6_y y1 y2 sqrt2 sqrt2 sqrt2 y6))`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[gamma3f_126;Sphere.gamma3f;]; + MESON_TAC[vol3f_palt]; + ]);; + (* }}} *) + + + + +let gamma3f_135_expand = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. gamma3f_135 y1 y2 y3 y4 y5 y6 f = + vol3r y1 y3 y5 sqrt2 - ( (&2 * mm1 / pi) * + (&2 * dih_y y1 sqrt2 y3 sqrt2 y5 sqrt2 + &2 * dih3_y y1 sqrt2 y3 sqrt2 y5 sqrt2 + + &2 * dih5_y y1 sqrt2 y3 sqrt2 y5 sqrt2 + dih2_y y1 sqrt2 y3 sqrt2 y5 sqrt2 + + dih4_y y1 sqrt2 y3 sqrt2 y5 sqrt2 + dih6_y y1 sqrt2 y3 sqrt2 y5 sqrt2 - &3 * pi) - + (&8 * mm2 / pi) * + (f (y1 / &2) * dih_y y1 sqrt2 y3 sqrt2 y5 sqrt2 + + f (y3 / &2) * dih3_y y1 sqrt2 y3 sqrt2 y5 sqrt2 + + f (y5 / &2) * dih5_y y1 sqrt2 y3 sqrt2 y5 sqrt2))`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[gamma3f_135;Sphere.gamma3f;]; + MESON_TAC[vol3f_135_palt]; + ]);; + (* }}} *) + + +let ldih_x_135_s2 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. ldih_x_135_s2 x1 x2 x3 x4 x5 x6 = + lfun (sqrt x1 / #2.0) * dih_x_135_s2 x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + REWRITE_TAC[ldih_x_135_s2';dih_x_135_s2]; + ]);; + (* }}} *) + + + + +(* +let taum_template_B_x_alt = prove_by_refinement( + `!x1 x12 x15 x2 x3 x34 x4 x45 x5 x6. + taum_template_B_x x15 x45 x34 x12 x1 x2 x3 x4 x5 x6 = + taum_x x1 x3 x4 x34 (edge_flat2_x x5 x1 x4 (&0) x45 x15) + (edge_flat2_x x2 x1 x3 (&0) x12 x12) + + flat_term_x x2 + + flat_term_x x5 `, + (* {{{ proof *) + + [ + REWRITE_TAC[Sphere.taum_template_B_x]; + REPEAT LET_TAC; + ASM_MESON_TAC[]; + ]);; + + (* }}} *) + +let dih_template_B_x_alt = prove_by_refinement( + `!x6 x25 x34 x5 x4 x45 x15 x2 x1 x3 x12. + dih_template_B_x x15 x45 x34 x12 x25 x1 x2 x3 x4 x5 x6 = + dih_x x1 x2 x5 x25 x15 x12 - + dih_x x1 x3 x4 x34 (edge_flat2_x x5 x1 x4 (&0) x45 x15) + (edge_flat2_x x2 x1 x3 (&0) x12 x12)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.dih_template_B_x]; + REPEAT LET_TAC; + ASM_MESON_TAC[]; + ]);; + (* }}} *) + +let delta_template_B_x_alt = prove_by_refinement( + `!x6 x25 x34 x5 x4 x45 x15 x2 x1 x3 x12. + delta_template_B_x x15 x45 x34 x12 x1 x2 x3 x4 x5 x6 = + delta_x x1 x3 x4 x34 (edge_flat2_x x5 x1 x4 (&0) x45 x15) + (edge_flat2_x x2 x1 x3 (&0) x12 x12)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_template_B_x]; + REPEAT LET_TAC; + ASM_MESON_TAC[]; + ]);; + (* }}} *) + + +let tau_lowform_x_alt = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + tau_lowform_x x1 x2 x3 x4 x5 x6 = + rho (sqrt x1) * pi - (pi + sol0) + + sqp (delta_x x1 x2 x3 x4 x5 x6) * rhazim_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 + + sqn (delta_x x1 x2 x3 x4 x5 x6) * rhazim2_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 + + sqn (delta_x x1 x2 x3 x4 x5 x6) * rhazim3_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + REWRITE_TAC[tau_lowform_x]; + REPEAT LET_TAC; + ASM_MESON_TAC[]; + ]);; + (* }}} *) + +*) + +let taum_3flat_x_alt = prove_by_refinement( + `!x1 x2 x3 x23 x13 x12. + taum_3flat_x x1 x2 x3 x23 x13 x12 = + (taum_x x1 x2 x3 + ( edge_flat2_x x23 x2 x3 (&0) (&4) (&4) ) + ( edge_flat2_x x13 x1 x3 (&0) (&4) (&4) ) + ( edge_flat2_x x12 x1 x2 (&0) (&4) (&4) ) + + flat_term_x x12 + flat_term_x x23 + flat_term_x x13)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.taum_3flat_x]; + REPEAT LET_TAC; + ASM_MESON_TAC[]; + ]);; + (* }}} *) + + +let taum_2flat_x_alt = prove_by_refinement( + `!x1 x2 x3 x4 x13 x12. + taum_2flat_x x1 x2 x3 x4 x13 x12 = + (taum_x x1 x2 x3 x4 + ( edge_flat2_x x13 x1 x3 (&0) (&4) (&4) ) + ( edge_flat2_x x12 x1 x2 (&0) (&4) (&4) ) + + flat_term_x x12 + flat_term_x x13)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.taum_2flat_x]; + REPEAT LET_TAC; + ASM_MESON_TAC[]; + ]);; + (* }}} *) + + +let taum_1flat_x_alt = prove_by_refinement( + `!x1 x2 x3 x4 x5 x12. + taum_1flat_x x1 x2 x3 x4 x5 x12 = + (taum_x x1 x2 x3 x4 x5 + ( edge_flat2_x x12 x1 x2 (&0) (&4) (&4) ) + + flat_term_x x12)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.taum_1flat_x]; + REPEAT LET_TAC; + ASM_MESON_TAC[]; + ]);; + (* }}} *) + + +let euler_3flat_x_alt = prove_by_refinement( + `!x1 x2 x3 x23 x13 x12. + euler_3flat_x x1 x2 x3 x23 x13 x12 = + (eulerA_x x1 x2 x3 + ( edge_flat2_x x23 x2 x3 (&0) (&4) (&4) ) + ( edge_flat2_x x13 x1 x3 (&0) (&4) (&4) ) + ( edge_flat2_x x12 x1 x2 (&0) (&4) (&4) ) )`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.euler_3flat_x]; + REPEAT LET_TAC; + ASM_MESON_TAC[]; + ]);; + (* }}} *) + + +let euler_2flat_x_alt = prove_by_refinement( + `!x1 x2 x3 x4 x13 x12. + euler_2flat_x x1 x2 x3 x4 x13 x12 = + (eulerA_x x1 x2 x3 x4 + ( edge_flat2_x x13 x1 x3 (&0) (&4) (&4) ) + ( edge_flat2_x x12 x1 x2 (&0) (&4) (&4) ) )`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.euler_2flat_x]; + REPEAT LET_TAC; + ASM_MESON_TAC[]; + ]);; + (* }}} *) + + +let euler_1flat_x_alt = prove_by_refinement( + `!x1 x2 x3 x4 x5 x12. + euler_1flat_x x1 x2 x3 x4 x5 x12 = + (eulerA_x x1 x2 x3 x4 x5 + ( edge_flat2_x x12 x1 x2 (&0) (&4) (&4) ) )`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.euler_1flat_x]; + REPEAT LET_TAC; + ASM_MESON_TAC[]; + ]);; + (* }}} *) + +let upper_dih_x_y = prove_by_refinement( + `!a1 a2 a3 a4 a5 a6 x1 x2 x3 x4 x5 x6. + (a1 pow 2 <= x1) /\ (a2 pow 2 <= x2) /\ (a3 pow 2 <= x3) /\ (a4 pow 2 <= x4) /\ + (a5 pow 2 <= x5) /\ (a6 pow 2 <= x6) ==> + (upper_dih_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + upper_dih_x x1 x2 x3 x4 x5 x6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.upper_dih_y;Sphere.y_of_x;LET_DEF;LET_END_DEF]; + ASM_MESON_TAC[sq_pow2]; + ]);; + (* }}} *) + + +(* function delta_top_x is deprecated: +let delta_top_x_alt = prove_by_refinement( + `!a. delta_y (sqrt x4) (sqrt x9) (sqrt x6) a (sqrt x5) (sqrt x8) = + delta_top_x (a:real) (x1:real) (x2:real) (x3:real) (x4:real) + (x5:real) (x6:real) (x7:real) (x8:real) (x9:real) + `, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_top_x]; + ]);; + (* }}} *) +*) + + +let functional_euler_3flat_x = prove_by_refinement( + `let x4r = compose6 edge_flat2_x proj_x4 proj_x2 proj_x3 zero6 four6 four6 in + let x5r = compose6 edge_flat2_x proj_x5 proj_x1 proj_x3 zero6 four6 four6 in + let x6r = compose6 edge_flat2_x proj_x6 proj_x1 proj_x2 zero6 four6 four6 in + ( euler_3flat_x = + compose6 eulerA_x proj_x1 proj_x2 proj_x3 x4r x5r x6r)`, + (* {{{ proof *) + [ +BY(REWRITE_TAC[FUN_EQ_THM;Sphere.euler_3flat_x;compose6;four6;zero6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6;constant6;LET_DEF;LET_END_DEF]) + ]);; + (* }}} *) + +let functional_euler_2flat_x = prove_by_refinement( + ` + let x5r = compose6 edge_flat2_x proj_x5 proj_x1 proj_x3 zero6 four6 four6 in + let x6r = compose6 edge_flat2_x proj_x6 proj_x1 proj_x2 zero6 four6 four6 in + ( euler_2flat_x = + compose6 eulerA_x proj_x1 proj_x2 proj_x3 proj_x4 x5r x6r)`, + (* {{{ proof *) + [ +BY(REWRITE_TAC[FUN_EQ_THM;Sphere.euler_2flat_x;compose6;four6;zero6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6;constant6;LET_DEF;LET_END_DEF]) + ]);; + (* }}} *) + +let functional_euler_1flat_x = prove_by_refinement( + ` + let x6r = compose6 edge_flat2_x proj_x6 proj_x1 proj_x2 zero6 four6 four6 in + ( euler_1flat_x = + compose6 eulerA_x proj_x1 proj_x2 proj_x3 proj_x4 proj_x5 x6r)`, + (* {{{ proof *) + [ +BY(REWRITE_TAC[FUN_EQ_THM;Sphere.euler_1flat_x;compose6;four6;zero6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6;constant6;LET_DEF;LET_END_DEF]) + ]);; + (* }}} *) + + +let functional_taum_3flat_x = prove_by_refinement( + `let x4r = compose6 edge_flat2_x proj_x4 proj_x2 proj_x3 zero6 four6 four6 in + let x5r = compose6 edge_flat2_x proj_x5 proj_x1 proj_x3 zero6 four6 four6 in + let x6r = compose6 edge_flat2_x proj_x6 proj_x1 proj_x2 zero6 four6 four6 in + ( taum_3flat_x = + compose6 taum_x proj_x1 proj_x2 proj_x3 x4r x5r x6r + + uni(flat_term_x,proj_x4) + + uni(flat_term_x,proj_x5) + + uni(flat_term_x,proj_x6))`, + (* {{{ proof *) + [ +(REWRITE_TAC[FUN_EQ_THM;Sphere.taum_3flat_x;compose6;four6;add6;uni;zero6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6;constant6;LET_DEF;LET_END_DEF]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + +let functional_taum_2flat_x = prove_by_refinement( + ` + let x5r = compose6 edge_flat2_x proj_x5 proj_x1 proj_x3 zero6 four6 four6 in + let x6r = compose6 edge_flat2_x proj_x6 proj_x1 proj_x2 zero6 four6 four6 in + ( taum_2flat_x = + compose6 taum_x proj_x1 proj_x2 proj_x3 proj_x4 x5r x6r + + uni(flat_term_x,proj_x5) + + uni(flat_term_x,proj_x6))`, + (* {{{ proof *) + [ +(REWRITE_TAC[FUN_EQ_THM;Sphere.taum_2flat_x;compose6;four6;add6;uni;zero6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6;constant6;LET_DEF;LET_END_DEF]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + +let functional_taum_1flat_x = prove_by_refinement( + ` + let x6r = compose6 edge_flat2_x proj_x6 proj_x1 proj_x2 zero6 four6 four6 in + ( taum_1flat_x = + compose6 taum_x proj_x1 proj_x2 proj_x3 proj_x4 proj_x5 x6r + + uni(flat_term_x,proj_x6))`, + (* {{{ proof *) + [ +(REWRITE_TAC[FUN_EQ_THM;Sphere.taum_1flat_x;compose6;four6;add6;uni;zero6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6;constant6;LET_DEF;LET_END_DEF]); + ]);; + (* }}} *) + +let functional_delta_x_126_s2 = prove_by_refinement( + `domain6 + (\x1 x2 x3 x4 x5 x6. + &0 <= x1 /\ &0 <= x2 /\ &0 <= x6) + delta_x_126_s2 ( mk_126 delta_x)`, + (* {{{ proof *) + [ + REWRITE_TAC[domain6;Nonlinear_lemma.delta_x_126_s2;Sphere.delta_y;mk_126;compose6;proj_x1;proj_x2;proj_x6;two6;constant6;Nonlinear_lemma.sqrt2_sqrt2]; + BY(ASM_SIMP_TAC[sqrt_sqrt]) + ]);; + (* }}} *) + + +let functional_delta_x_135_s2 = prove_by_refinement( + `domain6 + (\x1 x2 x3 x4 x5 x6. + &0 <= x1 /\ &0 <= x3 /\ &0 <= x5) + delta_x_135_s2 ( mk_135 delta_x)`, + (* {{{ proof *) + [ + REWRITE_TAC[domain6;Nonlinear_lemma.delta_x_135_s2;Sphere.delta_y;mk_135;compose6;proj_x1;proj_x3;proj_x5;two6;constant6;Nonlinear_lemma.sqrt2_sqrt2]; + BY(ASM_SIMP_TAC[sqrt_sqrt]) + ]);; + (* }}} *) + +let functional_vol3_x_135_s2 = prove_by_refinement( + `domain6 + (\x1 x2 x3 x4 x5 x6. + &0 <= x1 /\ &0 <= x3 /\ &0 <= x5) + vol3_x_135_s2 ( mk_135 vol_x)`, + (* {{{ proof *) + [ +REWRITE_TAC[domain6;Nonlinear_lemma.vol3_x_135_s2;mk_135;Sphere.vol3r;compose6;proj_x1;proj_x3;proj_x5;two6;constant6;Sphere.vol_y;Sphere.y_of_x;Nonlinear_lemma.sqrt2_sqrt2]; + ASM_SIMP_TAC[sqrt_sqrt]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.vol_x;Sphere.delta_x]; + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + + +let functional_dih_x_126_s2 = prove_by_refinement( + `domain6 + (\x1 x2 x3 x4 x5 x6. + &0 <= x1 /\ &0 <= x2 /\ &0 <= x6) + dih_x_126_s2 (mk_126 dih_x)`, + (* {{{ proof *) + [ +REWRITE_TAC[domain6;Nonlinear_lemma.dih_x_126_s2;constant6;compose6;mk_126;two6;proj_x1;proj_x2;proj_x6;Sphere.dih_y;LET_DEF;LET_END_DEF;Nonlinear_lemma.sqrt2_sqrt2]; + BY(ASM_SIMP_TAC[sqrt_sqrt]) + ]);; + (* }}} *) + +let functional_dih2_x_126_s2 = prove_by_refinement( + `domain6 + (\x1 x2 x3 x4 x5 x6. + &0 <= x1 /\ &0 <= x2 /\ &0 <= x6) + dih2_x_126_s2 ( mk_126 dih2_x)`, + (* {{{ proof *) + [ +REWRITE_TAC[domain6;Nonlinear_lemma.dih2_x_126_s2;mk_126;compose6;proj_x1;proj_x2;two6;proj_x6;constant6;Sphere.sqrt2]; + REPEAT WEAK_STRIP_TAC; +GMATCH (ISPECL (replicate `&0` 6) Nonlinear_lemma.dih2_x_y); + REPEAT (POP_ASSUM MP_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + +let functional_dih3_x_126_s2 = prove_by_refinement( + `domain6 + (\x1 x2 x3 x4 x5 x6. + &0 <= x1 /\ &0 <= x2 /\ &0 <= x6) + dih3_x_126_s2 ( mk_126 dih3_x)`, + (* {{{ proof *) + [ + REWRITE_TAC[domain6;Nonlinear_lemma.dih3_x_126_s2; mk_126;compose6;proj_x1;proj_x2;two6;proj_x6; constant6;Sphere.sqrt2]; + REPEAT WEAK_STRIP_TAC; +GMATCH (ISPECL (replicate `&0` 6) Nonlinear_lemma.dih3_x_y); + REPEAT (POP_ASSUM MP_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + +let functional_dih4_x_126_s2 = prove_by_refinement( + ` dih4_x_126_s2= ( mk_126 dih4_x)`, + (* {{{ proof *) + [ +REWRITE_TAC[FUN_EQ_THM;Nonlinear_lemma.dih4_x_126_s2;mk_126;compose6;proj_x1;proj_x2;two6;proj_x6;constant6;Sphere.sqrt2;Sphere.dih4_x]; + ]);; + (* }}} *) + + +let functional_dih5_x_126_s2 = prove_by_refinement( + ` dih5_x_126_s2= ( mk_126 dih5_x)`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;Nonlinear_lemma.dih5_x_126_s2; mk_126;compose6;proj_x1;proj_x2; two6;proj_x6;constant6; Sphere.sqrt2;Sphere.dih5_x]; + ]);; + (* }}} *) + + +let functional_dih6_x_126_s2 = prove_by_refinement( + ` dih6_x_126_s2= ( mk_126 dih6_x)`, + (* {{{ proof *) + [ +REWRITE_TAC[FUN_EQ_THM;Nonlinear_lemma.dih6_x_126_s2;mk_126;compose6;proj_x1;proj_x2;two6;proj_x6;constant6;Sphere.sqrt2;Sphere.dih6_x]; + ]);; + (* }}} *) + +let functional_dih_x_135_s2 = prove_by_refinement( + `domain6 + (\x1 x2 x3 x4 x5 x6. + &0 <= x1 /\ &0 <= x3 /\ &0 <= x5) + dih_x_135_s2 (mk_135 dih_x)`, + (* {{{ proof *) + [ +REWRITE_TAC[domain6;Nonlinear_lemma.dih_x_135_s2;constant6;compose6;mk_135;two6;proj_x1;proj_x3;proj_x5;Sphere.dih_y;LET_DEF;LET_END_DEF;Nonlinear_lemma.sqrt2_sqrt2]; + BY(ASM_SIMP_TAC[sqrt_sqrt]) + ]);; + (* }}} *) + + +let functional_dih2_x_135_s2 = prove_by_refinement( + `domain6 + (\x1 x2 x3 x4 x5 x6. + &0 <= x1 /\ &0 <= x3 /\ &0 <= x5) + dih2_x_135_s2 ( mk_135 dih2_x)`, + (* {{{ proof *) + [ +REWRITE_TAC[domain6;Nonlinear_lemma.dih2_x_135_s2;mk_135;compose6;proj_x1;proj_x3;two6;proj_x5;constant6;Sphere.sqrt2]; + REPEAT WEAK_STRIP_TAC; +GMATCH (ISPECL (replicate `&0` 6) Nonlinear_lemma.dih2_x_y); + REPEAT (POP_ASSUM MP_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + +let functional_dih3_x_135_s2 = prove_by_refinement( + `domain6 + (\x1 x2 x3 x4 x5 x6. + &0 <= x1 /\ &0 <= x3 /\ &0 <= x5) + dih3_x_135_s2 ( mk_135 dih3_x)`, + (* {{{ proof *) + [ +REWRITE_TAC[domain6;Nonlinear_lemma.dih3_x_135_s2;mk_135;compose6;proj_x1;proj_x3;two6;proj_x5;constant6;Sphere.sqrt2]; + REPEAT WEAK_STRIP_TAC; +GMATCH (ISPECL (replicate `&0` 6) Nonlinear_lemma.dih3_x_y); + REPEAT (POP_ASSUM MP_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + +let functional_dih4_x_135_s2 = prove_by_refinement( + ` dih4_x_135_s2= ( mk_135 dih4_x)`, + (* {{{ proof *) + [ +REWRITE_TAC[FUN_EQ_THM;Nonlinear_lemma.dih4_x_135_s2;mk_135;compose6;proj_x1;proj_x3;two6;proj_x5;constant6;Sphere.sqrt2;Sphere.dih4_x]; + ]);; + (* }}} *) + + +let functional_dih5_x_135_s2 = prove_by_refinement( + ` dih5_x_135_s2= ( mk_135 dih5_x)`, + (* {{{ proof *) + [ +REWRITE_TAC[FUN_EQ_THM;Nonlinear_lemma.dih5_x_135_s2;mk_135;compose6;proj_x1;proj_x3;two6;proj_x5;constant6;Sphere.sqrt2;Sphere.dih5_x]; + ]);; + (* }}} *) + + +let functional_dih6_x_135_s2 = prove_by_refinement( + ` dih6_x_135_s2= ( mk_135 dih6_x)`, + (* {{{ proof *) + [ +REWRITE_TAC[FUN_EQ_THM;Nonlinear_lemma.dih6_x_135_s2;mk_135;compose6;proj_x1;proj_x3;two6;proj_x5;constant6;Sphere.sqrt2;Sphere.dih6_x]; + ]);; + (* }}} *) + + + +let functional_ldih_x_126_s2 = prove_by_refinement( + ` ldih_x_126_s2= uni (lfun, (proj_y1 / two6)) * dih_x_126_s2`, + (* {{{ proof *) + [ +BY(REWRITE_TAC[FUN_EQ_THM;Nonlinear_lemma.ldih_x_126_s2;mk_126;compose6;proj_x1;proj_x2;two6;proj_x6;constant6;Sphere.sqrt2;uni;mul6;div6;proj_y1;arith `&2 = #2.0`]) + ]);; + (* }}} *) + +let functional_ldih2_x_126_s2 = prove_by_refinement( + ` ldih2_x_126_s2= uni (lfun, (proj_y2 / two6)) * dih2_x_126_s2`, + (* {{{ proof *) + [ +BY(REWRITE_TAC[FUN_EQ_THM;Nonlinear_lemma.ldih2_x_126_s2;mk_126;compose6;proj_x1;proj_x2;two6;proj_x6;constant6;Sphere.sqrt2;uni;mul6;div6;proj_y2;arith `&2 = #2.0`]) + ]);; + (* }}} *) + + +let functional_ldih6_x_126_s2 = prove_by_refinement( + ` ldih6_x_126_s2= uni (lfun, (proj_y6 / two6)) * dih6_x_126_s2`, + (* {{{ proof *) + [ +BY(REWRITE_TAC[FUN_EQ_THM;Nonlinear_lemma.ldih6_x_126_s2;mk_126;compose6;proj_x1;proj_x2;two6;proj_x6;constant6;Sphere.sqrt2;uni;mul6;div6;proj_y6;arith `&2 = #2.0`]) + ]);; + (* }}} *) + + +let functional_ldih_x_135_s2 = prove_by_refinement( + ` ldih_x_135_s2= uni (lfun, (proj_y1 / two6)) * dih_x_135_s2`, + (* {{{ proof *) + [ +BY(REWRITE_TAC[FUN_EQ_THM;Nonlinear_lemma.ldih_x_135_s2;mk_135;compose6;proj_x1;proj_x2;two6;proj_x6;constant6;Sphere.sqrt2;uni;mul6;div6;proj_y1;arith `&2 = #2.0`]) + ]);; + (* }}} *) + +let functional_ldih3_x_135_s2 = prove_by_refinement( + ` ldih3_x_135_s2= uni (lfun, (proj_y3 / two6)) * dih3_x_135_s2`, + (* {{{ proof *) + [ +BY(REWRITE_TAC[FUN_EQ_THM;Nonlinear_lemma.ldih3_x_135_s2;mk_135;compose6;proj_x1;proj_x2;two6;proj_x6;constant6;Sphere.sqrt2;uni;mul6;div6;proj_y3;arith `&2 = #2.0`]) + ]);; + (* }}} *) + + +let functional_ldih5_x_135_s2 = prove_by_refinement( + ` ldih5_x_135_s2= uni (lfun, (proj_y5 / two6)) * dih5_x_135_s2`, + (* {{{ proof *) + [ +BY(REWRITE_TAC[FUN_EQ_THM;Nonlinear_lemma.ldih5_x_135_s2;mk_135;compose6;proj_x1;proj_x2;two6;proj_x6;constant6;Sphere.sqrt2;uni;mul6;div6;proj_y5;arith `&2 = #2.0`]) + ]);; + (* }}} *) + +let functional_ldih_x_126_n = prove_by_refinement( + `ldih_x_126_n = mk_126 ldih_x_n`, + (* {{{ proof *) + [ +BY(REWRITE_TAC[FUN_EQ_THM;Nonlinear_lemma.ldih_x_126_n;mk_126;Nonlinear_lemma.sqrt2_sqrt2;proj_x1;proj_x2;proj_x6;compose6;two6;constant6]) + ]);; + (* }}} *) + +(* this differs from C++ code? *) + +let functional_ldih2_x_126_n = prove_by_refinement( + `ldih2_x_126_n = mk_126 (rotate2 ldih_x_n)`, + (* {{{ proof *) + [ +(REWRITE_TAC[FUN_EQ_THM;Nonlinear_lemma.ldih2_x_126_n;functional_ldih_x_126_n;mk_126;Sphere.rotate2;Nonlinear_lemma.sqrt2_sqrt2;proj_x1;proj_x2;proj_x6;compose6;two6;constant6]); + REWRITE_TAC[Nonlinear_lemma.ldih2_x_n;Nonlinear_lemma.ldih_x_n;Sphere.ldih2_x_div_sqrtdelta_posbranch;Sphere.rotate2]; + REPEAT WEAK_STRIP_TAC; + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + REWRITE_TAC[Sphere.delta_x]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + +let functional_ldih6_x_126_n = prove_by_refinement( + `ldih6_x_126_n = mk_126 (rotate6 ldih_x_n)`, + (* {{{ proof *) + [ +(REWRITE_TAC[FUN_EQ_THM;Nonlinear_lemma.ldih6_x_126_n;functional_ldih_x_126_n;mk_126;Sphere.rotate6;Nonlinear_lemma.sqrt2_sqrt2;proj_x1;proj_x2;proj_x6;compose6;two6;constant6]); + REWRITE_TAC[Nonlinear_lemma.ldih6_x_n;Nonlinear_lemma.ldih_x_n;Sphere.ldih6_x_div_sqrtdelta_posbranch;Sphere.rotate6]; + REPEAT WEAK_STRIP_TAC; + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + REWRITE_TAC[Sphere.delta_x]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let functional_ldih_x_135_n = prove_by_refinement( + `ldih_x_135_n = mk_135 ldih_x_n`, + (* {{{ proof *) + [ +BY(REWRITE_TAC[FUN_EQ_THM;Nonlinear_lemma.ldih_x_135_n;mk_135;Nonlinear_lemma.sqrt2_sqrt2;proj_x1;proj_x3;proj_x5;compose6;two6;constant6]) + ]);; + (* }}} *) + + +let functional_ldih3_x_135_n = prove_by_refinement( + `ldih3_x_135_n = mk_135 (rotate3 ldih_x_n)`, + (* {{{ proof *) + [ +(REWRITE_TAC[FUN_EQ_THM;Nonlinear_lemma.ldih3_x_135_n;functional_ldih_x_135_n;mk_135;Sphere.rotate2;Nonlinear_lemma.sqrt2_sqrt2;proj_x1;proj_x3;proj_x5;compose6;two6;constant6]); + REWRITE_TAC[Nonlinear_lemma.ldih3_x_n;Nonlinear_lemma.ldih_x_n;Sphere.ldih3_x_div_sqrtdelta_posbranch;Sphere.rotate3]; + REPEAT WEAK_STRIP_TAC; + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + REWRITE_TAC[Sphere.delta_x]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let functional_ldih5_x_135_n = prove_by_refinement( + `ldih5_x_135_n = mk_135 (rotate5 ldih_x_n)`, + (* {{{ proof *) + [ +(REWRITE_TAC[FUN_EQ_THM;Nonlinear_lemma.ldih5_x_135_n;functional_ldih_x_135_n;mk_135;Sphere.rotate5;Nonlinear_lemma.sqrt2_sqrt2;proj_x1;proj_x3;proj_x5;compose6;two6;constant6]); + REWRITE_TAC[Nonlinear_lemma.ldih5_x_n;Nonlinear_lemma.ldih_x_n;Sphere.ldih5_x_div_sqrtdelta_posbranch;Sphere.rotate5]; + REPEAT WEAK_STRIP_TAC; + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + REWRITE_TAC[Sphere.delta_x]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let functional_taum_x1 = prove_by_refinement( + `!a b. + domain6 + (\x1 x2 x3 x4 x5 x6. &0 <= a /\ &0 <= b) + (taum_x1 a b) + (compose6 taum_x four6 four6 four6 + (constant6 (a*a)) (constant6 (b*b)) proj_x1)`, + (* {{{ proof *) + [ + REWRITE_TAC[domain6;compose6;four6;constant6;Sphere.taum_x1; Sphere.taum_y1;Sphere.taum_x;Nonlinear_lemma.taum_123;proj_x1; Sphere.rhazim_x;Sphere.rhazim2_x; Collect_geom2.SQRT4_EQ2; Sphere.rhazim3_x]; + BY(SIMP_TAC[Nonlinear_lemma.sqrtxx]) + ]);; + (* }}} *) + +let functional_taum_x2 = prove_by_refinement( + `!a b. + domain6 + (\x1 x2 x3 x4 x5 x6. &0 <= a /\ &0 <= b) + (taum_x2 a b) + (compose6 taum_x four6 four6 four6 + (constant6 (a*a)) (constant6 (b*b)) proj_x2)`, + (* {{{ proof *) + [ + REWRITE_TAC[domain6;compose6;four6;constant6;Sphere.taum_x2; Sphere.taum_y2;Sphere.taum_x;Nonlinear_lemma.taum_123;proj_x2; Sphere.rhazim_x;Sphere.rhazim2_x; Collect_geom2.SQRT4_EQ2; Sphere.rhazim3_x]; + BY(SIMP_TAC[Nonlinear_lemma.sqrtxx]) + ]);; + (* }}} *) + + +let functional_taum_x1_x2 = prove_by_refinement( + `!a. + domain6 + (\x1 x2 x3 x4 x5 x6. &0 <= a) + (taum_x1_x2 a) + (compose6 taum_x four6 four6 four6 + (constant6 (a*a)) proj_x1 proj_x2)`, + (* {{{ proof *) + [ + REWRITE_TAC[domain6;compose6;four6;constant6;Sphere.taum_x1_x2; Sphere.taum_y1_y2;Sphere.taum_x;Nonlinear_lemma.taum_123;proj_x2; proj_x1;Sphere.rhazim_x;Sphere.rhazim2_x; Collect_geom2.SQRT4_EQ2; Sphere.rhazim3_x]; + BY(SIMP_TAC[Nonlinear_lemma.sqrtxx]) + ]);; + (* }}} *) + +let functional_delta_sub1_x = prove_by_refinement( + `!a. delta_sub1_x a = compose6 delta_x + (constant6 a) proj_x2 proj_x3 proj_x4 proj_x5 proj_x6`, + (* {{{ proof *) + [ + (REWRITE_TAC[FUN_EQ_THM; Sphere.delta_sub1_x;constant6;compose6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6 ]) + ]);; + (* }}} *) + +let functional_taum_sub1_x = prove_by_refinement( + `!a. taum_sub1_x a = compose6 taum_x + (constant6 a) proj_x2 proj_x3 proj_x4 proj_x5 proj_x6`, + (* {{{ proof *) + [ + (REWRITE_TAC[FUN_EQ_THM; Sphere.taum_sub1_x;constant6;compose6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6 ]) + ]);; + (* }}} *) + + + +let functional_taum_sub246_x = prove_by_refinement( + `!a b c. taum_sub246_x a b c = compose6 taum_x + proj_x1 (constant6 a) proj_x3 (constant6 b) proj_x5 (constant6 c)`, + (* {{{ proof *) + [ + (REWRITE_TAC[FUN_EQ_THM; Sphere.taum_sub246_x;constant6;compose6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6 ]) + ]);; + (* }}} *) + +let functional_taum_sub345_x = prove_by_refinement( + `!a b c. taum_sub345_x a b c = compose6 taum_x + proj_x1 proj_x2 (constant6 a) (constant6 b) (constant6 c) proj_x6`, + (* {{{ proof *) + [ + (REWRITE_TAC[FUN_EQ_THM; Sphere.taum_sub345_x;constant6;compose6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6 ]) + ]);; + (* }}} *) + + +(* +let functional1_vol2r_x = + new_definition `vol2r_x x = &2 * pi * (&2 - (x / &4)) / &3`;; + +let functional_vol2r_x1 = + new_definition `vol2r_x1 = promote1_to_6 vol2r_x`;; + + +(* +let functional1_vol2_x = + new_definition `vol2_x x = &2 * pi * (&2 - (sqrt x) / &4) / &3`;; + +let functional_vol2_x1 = + new_definition `vol2_x1 = promote1_to_6 vol2_x`;; +*) + +let functional_gamma3f_x_v_lfun = prove_by_refinement( + ` + let vv_term_m1 = scalar6 (unit6 - scalar6 proj_y1 (&1 / sqrt8)) (&4 * mm1) in + let (vv_term_m2) = + (scalar6 (uni(flat_term_x,proj_x1)) (-- &16 * mm2 /sol0)) in + domain6 + (\x1 x2 x3 x4 x5 x6. + &0 <= x1 /\ &0 <= x2 /\ &0 <= x3 /\ &0 <= x4 /\ &0 <= x5 /\ &0 <= x6) + gamma3f_x_v_lfun ((dih_x - constant6 (&2 * #0.03)) * + ((vol2r_x1 - vv_term_m1 ) + vv_term_m2))`, + (* {{{ proof *) + [ + rt[domain6;LET_DEF;LET_END_DEF;Nonlinear_lemma.gamma3f_x_v_lfun;mul6;sub6;Nonlinear_lemma.gamma3f_v_lfun;constant6;Sphere.vol2r;functional_vol2_x1;functional1_vol2_x;promote1_to_6;mul6;add6;scalar6;uni;proj_x1;Sphere.dih_y;Nonlinear_lemma.sqrt2_sqrt2;proj_y1;functional_vol2r_x1;functional1_vol2r_x;Sphere.lfun;unit6;Sphere.flat_term_x;Sphere.flat_term;Nonlinear_lemma.sqrt8_sqrt2]; + simp[sqrt_sqrt] + st/r + AP_TERM_TAC +sgthen `(sqrt x1 / &2) pow 2 = x1 / &4` SUBST1_TAC +rt[arith `(sqrt x1 / &2) pow 2 = (sqrt x1 * sqrt x1) / &4`] +asimp[sqrt_sqrt] +ABBREV_TAC `a = &2 * pi * (&2 - x1/ &4) / &3` +rt[arith `((a:real) - b + c = a - (b - c))`] +AP_TERM_TAC + ]);; + (* }}} *) +1;; +*) + + (* +let taud_D2_num_x_y = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + &0 <= y1 /\ &0 <= y2 /\ &0 <= y3 ==> + taud_v4_D2_num y1 y2 y3 y4 y5 y6 = y_of_x taud_D2_num_x y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.taud_v4_D2_num;Nonlin_def.taud_D2_num_x]; + F_REWRITE_TAC; + REWRITE_TAC[GSYM mu_y]; + REWRITE_TAC[GSYM Sphere.delta_y]; + ASM_SIMP_TAC[Nonlinear_lemma.sqrtxx]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + *) + +(* arclength_x_345 deprecated *) + +(* this could be rewriten further with eulerA_x *) + +(* +let functional_sol_euler_x_divsqrtdelta = prove_by_refinement( + `let a = uni(sqrt,proj_x1 * proj_x2 * proj_x3) + + proj_y1 * (proj_x2 + proj_x3 - proj_x4) * constant6 (#0.5) + + proj_y2 * (proj_x1 + proj_x3 - proj_x5) * constant6 (#0.5) + + proj_y3 * (proj_x1 + proj_x2 - proj_x6) * constant6 (#0.5) in + (sol_euler_x_div_sqrtdelta = + (uni(matan,(delta_x / (a * a * constant6 (&4))))) / a)`, + (* {{{ proof *) + [ + LET_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[uni;Sphere.sol_euler_x_div_sqrtdelta; div6;mul6;add6;sub6;constant6;proj_y1;proj_y2; proj_y3;proj_x1;proj_x2;proj_x3; proj_x4;proj_x5;proj_x6]; + REWRITE_TAC[REAL_ARITH `x * #0.5 = x/ &2`;REAL_ARITH `&4 * a pow 2 = a* a * &4`]; + REPEAT STRIP_TAC; + FIRST_X_ASSUM (ASSUME_TAC o (ISPECL [`x:real`;`x':real`; `x'':real`;`x''':real`;`x'''':real`; `x''''':real`])); + ASM_REWRITE_TAC[]; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + ]);; + (* }}} *) +*) + +(* +let functional_vol3f_x_sqrt2_lmplus = prove_by_refinement( + ` (domain6 + (\x1 x2 x3 x4 x5 x6. + (&2 * h0) pow 2 <= x1 /\ &0 <= x2 /\ &0 <=x6) + vol3f_x_sqrt2_lmplus + (constant6 ( &2 * mm1 / pi ) * + (two6 * compose6 dih_x proj_x1 proj_x2 two6 two6 two6 proj_x6 + + two6 * compose6 dih2_x proj_x1 proj_x2 two6 two6 two6 proj_x6 + + two6 * compose6 dih6_x proj_x1 proj_x2 two6 two6 two6 proj_x6 + + compose6 dih3_x proj_x1 proj_x2 two6 two6 two6 proj_x6 + + compose6 dih4_x proj_x1 proj_x2 two6 two6 two6 proj_x6 + + compose6 dih5_x proj_x1 proj_x2 two6 two6 two6 proj_x6 - + constant6 ( &3 * pi)) + - (constant6 (&8 * mm2 / pi)) * + (compose6 ldih2_x proj_x1 proj_x2 two6 two6 two6 proj_x6 + + compose6 ldih6_x proj_x1 proj_x2 two6 two6 two6 proj_x6)))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF;domain6; two6;constant6;mul6;add6;sub6;proj_x1;compose6;proj_x2; proj_x3;proj_x4;proj_x5;proj_x6]; + BY(REWRITE_TAC[Nonlinear_lemma.vol3f_x_sqrt2_lmplus_alt]) + ]);; + (* }}} *) +*) + + + +(* +let functional_vol3f_x_lfun = prove_by_refinement( + ` (domain6 + (\x1 x2 x3 x4 x5 x6. + &0 <= x1 /\ &0 <= x2 /\ &0 <=x6) + vol3f_x_lfun + (constant6 ( &2 * mm1 / pi ) * + (two6 * compose6 dih_x proj_x1 proj_x2 two6 two6 two6 proj_x6 + + two6 * compose6 dih2_x proj_x1 proj_x2 two6 two6 two6 proj_x6 + + two6 * compose6 dih6_x proj_x1 proj_x2 two6 two6 two6 proj_x6 + + compose6 dih3_x proj_x1 proj_x2 two6 two6 two6 proj_x6 + + compose6 dih4_x proj_x1 proj_x2 two6 two6 two6 proj_x6 + + compose6 dih5_x proj_x1 proj_x2 two6 two6 two6 proj_x6 - + constant6 ( &3 * pi)) + - (constant6 (&8 * mm2 / pi)) * + (compose6 ldih_x proj_x1 proj_x2 two6 two6 two6 proj_x6 + + compose6 ldih2_x proj_x1 proj_x2 two6 two6 two6 proj_x6 + + compose6 ldih6_x proj_x1 proj_x2 two6 two6 two6 proj_x6))) + `, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF; two6; domain6;constant6;mul6;add6;sub6;proj_x1; compose6;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6]; + BY(REWRITE_TAC[Nonlinear_lemma.vol3f_x_lfun_alt]) + ]);; + (* }}} *) +*) + + +(* +let functional_ldih_x = prove_by_refinement( + `ldih_x = + (unit6 * constant6 h0 + proj_y1 * constant6 ( -- #0.5))* + (unit6 / (constant6 h0 - unit6)) * dih_x`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[add6;mul6;div6;sub6;constant6]; + REWRITE_TAC[proj_y1;Sphere.ldih_x;Nonlinear_lemma.unit6;Sphere.lfun]; + REAL_ARITH_TAC; + ]);; + (* }}} *) +*) + + +(* +let functional_lfun_y1 = prove_by_refinement( + `lfun_y1 = (unit6 * constant6 h0 + proj_x1 * constant6 (-- &1))* + (unit6 / (constant6 h0 - unit6))`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[add6;mul6;div6;sub6;constant6]; + REWRITE_TAC[Sphere.lfun_y1;Sphere.lfun; Nonlinear_lemma.unit6;Nonlinear_lemma.proj_x1]; +REAL_ARITH_TAC; + ]);; + (* }}} *) +*) + +(* +let functional_vol_x = prove_by_refinement( + `vol_x = uni(sqrt,delta_x) / constant6 (&12)`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[FUN_EQ_THM;uni;Sphere.vol_x;constant6;div6]); + ]);; + (* }}} *) +*) + +let x1cube = new_definition `x1cube = proj_x1 * proj_x1 * proj_x1`;; + +let functional_ldih_x_n = prove_by_refinement( + `ldih_x_n = uni(sqn,delta_x) * ldih_x_div_sqrtdelta_posbranch`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[FUN_EQ_THM;Nonlinear_lemma.ldih_x_n;mul6;uni]) + ]);; + (* }}} *) + + diff --git a/legacy/oldnonlinear/deprecated_main_estimate_ineq.hl b/legacy/oldnonlinear/deprecated_main_estimate_ineq.hl new file mode 100644 index 0000000..23b44d4 --- /dev/null +++ b/legacy/oldnonlinear/deprecated_main_estimate_ineq.hl @@ -0,0 +1,1784 @@ +addtex (Section,"Main Estimate","Deformation num1 and general facts");; + +addtex(Comment,"2065952723", +" +%See Mathematica numerical calculation. +% old idv: eqn:gg'' calc:Lexell. +The derivatives have been computed in Mathematica and converted to +HOL format. (formal proof: derived_form_sum_dih444). +This second derivative calculation shows that + function $\\tau$ does not have a interior local minimum. + +Let +\\[ +g(s;a,b,c,e_1,e_2,e_3) = \\sum_{i=1}^3 \\dih_i(2,2,2,a+s,b,c) e_i, +\\] +where $\\dih_i$ is given by Definition~\\ref{def:tau}. +Note linearity in $e_i$, so that extremality appears at endpoints for $e_i$ +in $e_i\\in\\leftclosed1,1+\\sol_0/\\pi\\rightclosed$. Hence various +calculations drop to three dimensions. + +Let $\\Delta = \\Delta(4,4,4,a^2,b^2,c^2)$. +Let primes denote derivatives with respect to the variable $s$. +Assume $a,b,c\\in\\leftclosed2/\\hm,4\\rightclosed$. +The idea is to show on various domains: +\\begin{equation}\\label{eqn:calc:Lexell} +(16-a^2) ^2 a^2( \\Delta (g'(0;a,b,c,e_1,e_2,e_3))^2 +- 0.01\\Delta^{3/2}g''(0;a,b,c,e_1,e_2,e_3))\\ge 0. +\\end{equation} +(The factors of $\\Delta$ clear the denominator.) +The variables $a,b,c$ appear in even powers. +");; + +skip + { +idv = "2065952723 A1"; +doc = " + % 2013-06-01. Deprecated. Replaced with 1834976363. + + This is the case that $a_2 \\le 15.53$. + $a_2$ upper bound changed on 2011-Jan-21. + If larger than 15.53, it must be in a hexagon, and two consecutive straight vertices. + Warning: this is verified by custom code (using cfsqp heuristics) + in the interval arithmetic calculations. + + Fixed statement 2013-06-01. + "; +tags=[Main_estimate;Flypaper["UPONLFY"];Tex;Deprecated]; +ineq = all_forall `ineq + [ + (&1 , e1, &1 + sol0/ pi); + (&1 , e2, &1 + sol0/ pi); + (&1 , e3, &1 + sol0/ pi); + ((&2 / h0) pow 2, a2, #15.53); + ((&2 / h0) pow 2, b2, &4 pow 2); + ((&2 / h0) pow 2, c2, &4 pow 2) + ] + (num1 e1 e2 e3 a2 b2 c2 > &0 \/ + num1 e1 e2 e3 a2 b2 c2 < &0 \/ + num2 e1 e2 e3 a2 b2 c2 < &0)`; +};; + +(* +skip +{ + idv = "BIXPCGW 6652007036 a"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus); + (&2,y2, sqrt8); + (&2,y3, sqrt8); + (&2,y4, sqrt8); + (&2,y5, sqrt8); + (&2,y6, sqrt8) + ] + ((dih_y y1 y2 y3 y4 y5 y6 < #2.8) \/ (delta_y y1 y2 y3 y4 y5 y6 < &60))`; + doc = " + OXLZLEZ.mod 'azim_c4' QX and QU + If $X$ is a $4$-cell then $\\dih(X) < 2.8$."; + tags=[Marchal;Flypaper["OXLZLEZ";];Cfsqp;Clusterlp;Tex;Xconvert]; +};; +*) + +(* +skip (* removed Dec 1, 2012 *) +{ + idv = "BIXPCGW 7080972881 a"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2 * hminus,y2, sqrt8); + (&2,y3, sqrt8); + (&2,y4, sqrt8); + (&2,y5, sqrt8); + (&2,y6, sqrt8) + ] + ((dih_y y1 y2 y3 y4 y5 y6 < #2.3) \/ (delta_y y1 y2 y3 y4 y5 y6 < &60))`; + doc = " + OXLZLEZ.mod 'g_qxd' QXD + If $X$ is a $4$-cell with a critical edge next to the spine, then $\\dih(X) < 2.3$."; + tags=[Marchal;Flypaper["OXLZLEZ";];Cfsqp;Clusterlp;Tex;Xconvert]; +};; +*) + +(* +skip (* removed Dec 1, 2012 *) +{ + idv = "BIXPCGW 1738910218 a"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, sqrt8); + (&2,y3, sqrt8); + (&2,y4, &2 * hplus); + (&2,y5, sqrt8); + (&2,y6, sqrt8) + ] + ( (dih_y y1 y2 y3 y4 y5 y6 < #2.3) \/ (delta_y y1 y2 y3 y4 y5 y6 < &60))`; + doc = " + OXLZLEZ.mod 'g_qxd' QXD + If $X$ is a $4$-cell with a critical edge opposite spine, then $\\dih(X) < 2.3$."; + tags=[Marchal;Flypaper["OXLZLEZ";];Cfsqp;Clusterlp;Tex;Xconvert]; +};; +*) + +skip (* removed Dec 1, 2012 *) +{ + idv = "BIXPCGW 7274157868"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, sqrt8); + (&2,y3, sqrt8); + (&2,y4, sqrt8); + (&2,y5, sqrt8); + (&2,y6, sqrt8) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun > #0.0057) \/ + (dih_y y1 y2 y3 y4 y5 y6 < #2.3))`; + doc = " + OXLZLEZ.mod 'g_qxd' QXD + If $X$ is a $4$-cell with a single critical edge (the spine), and if $\\dih(X)\\ge 2.3$, + then $\\gamma(X,L) > 0.0057$."; + tags=[Marchal;Flypaper["OXLZLEZ";];Cfsqp;Clusterlp;Tex;Xconvert;Branching;Split[0;1;2;3;4;5]]; +};; + +(* deprecaed , Feb 18, 2013. not used. Removed 2013-06-27. *) +let mk_QITNPEA i3 i4 i5 i6 = + let template = `\ y3m y3M y4m y4M y5m y5M y6m y6M w m. ineq + [(&2 * hminus, y1, &2 * hplus); + (&2 ,y2, &2 *hminus); + (y3m,y3,y3M); + (y4m,y4,y4M); + (y5m,y5,y5M); + (y6m,y6,y6M)] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &w + &m * beta_bump_force_y y1 y2 y3 y4 y5 y6 + - #0.0105256 + #0.00522841*dih_y y1 y2 y3 y4 y5 y6 > #0.0) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2))` in + let x i = List.nth [`&2`; `&2 * hminus`; `sqrt8`] i in + let X i = x (i+1) in + let mid i = if (i=1) then 1 else 0 in + let w = 1 + mid i3 + mid i4 + mid i5 + mid i6 in + let m = if (w =2) && (i4 = 1) then `1` else `0` in + mk_tplate template [x i3;X i3; x i4;X i4; x i5;X i5; x i6 ;X i6; mk_small_numeral w; m];; + +let skip_QITNPEA i3 i4 i5 i6 = if (i3+i4+i5+i6 = 0) then () else + skip{ + idv = Printf.sprintf "QITNPEA4 %d %d %d %d 3803737830" i3 i4 i5 i6; + ineq = mk_QITNPEA i3 i4 i5 i6; + doc = " + OXLZLEZ.mod 'gaz7' + This is a $4$-cell (nonquarter) inequality for four leaves."; + tags=(if (i3,i4,i5,i6)=(0,0,0,1) then [Tex] else []) @ [Marchal;Cfsqp;Xconvert;Flypaper["OXLZLEZ";];Penalty(50.0,500.0);Branching;Split (split_F4 i3 i4 i5 i6)]; + };; + + for i3=0 to 1 do +for i4 = 0 to 1 do + for i5 = 0 to 1 do + for i6 = 0 to 1 do + skip_QITNPEA i3 i4 i5 i6; done done done done;; + + + +skip (* deprecated Feb 18, 2013 not used. Removed 2013-06-27. *) +{ + idv = "QITNPEA4 3803737830 supercritical"; + ineq = all_forall`ineq + [&2 * hminus,y1,&2 * hplus; &2,y2,&2 * hminus; &2,y3,&2 * hminus; + &2 * hplus, + y4, + sqrt8; &2,y5,&2 * hminus; &2,y6,&2 * hminus] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun + - #0.0105256 + + #0.00522841 * dih_y y1 y2 y3 y4 y5 y6 > + #0.0) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2))`; + doc=""; + tags=[Marchal;Cfsqp;Xconvert;Flypaper["OXLZLEZ";"Nov2012"];Penalty(50.0,500.0);Branching;Split[0];Deprecated]; +};; + +skip +{ + idv = "BIXPCGW 2300537674"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (&2,y4, &2 * hminus); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun > &0) \/ (dih_y y1 y2 y3 y4 y5 y6 < #1.65))`; + doc = " + OXLZLEZ.mod 'azim_nqu' + Consequence of 'QITNPEA 5653753305'. Skipped out on 2012-06-22. Dropped from OXLZLEZ.mod + If $X$ is a quarter such that $\\gamma(X,L)\\le 0$, then $\\dih(X) < 1.65$."; + tags=[Marchal;Flypaper["OXLZLEZ";];Cfsqp;Clusterlp;Tex;Xconvert;Branching;Split[0]]; +};; + +skip +{ + idv = "GRKIBMP A"; + ineq = all_forall `ineq + [((&2),y1, (&2 * hplus)); + (&1,y2,&1); + (&1,y3,&1); + (&1,y4,&1); + (&1,y5,&1); + (&1,y6,&1) + ] + (y_of_x (gamma2_x1_div_a (h0cut y1)) y1 y2 y3 y4 y5 y6 > #0.008 )`; + doc = "gamma2 at least 0.008 per azim along critical edge. Deprecated Jan 23, 2013."; + tags=[Marchal;Flypaper["OXLZLEZ";"Nov2012"];Cfsqp;Clusterlp;Tex;Xconvert; + Branching;Split[0]]; +};; + +skip +{ + idv = "GRKIBMP B"; + ineq = all_forall `ineq + [((&2 * hplus),y1, (sqrt8)); + (&1,y2,&1); + (&1,y3,&1); + (&1,y4,&1); + (&1,y5,&1); + (&1,y6,&1) + ] + (y_of_x (gamma2_x1_div_a (&0)) y1 y2 y3 y4 y5 y6 >= &0 )`; + doc = "gamma2 nonnegative in general. Deprecated Jan 23, 2013."; + tags=[Marchal;Flypaper["OXLZLEZ";"Nov2012"];Cfsqp;Clusterlp;Tex;Xconvert;Sharp; + Branching;]; +};; + +skip +{ + idv = "GRKIBMP"; + ineq = all_forall `ineq + [((&2 * hminus),y1, (&2 * hplus)); + (&1,y2,&1); + (&1,y3,&1); + (&1,y4,&1); + (&1,y5,&1); + (&1,y6,&1) + ] + (y_of_x (gamma2_x1_div_a (h0cut y1)) y1 y2 y3 y4 y5 y6 > #0.008 )`; + doc = "gamma2 averages at least 0.008 per azim. + Replaced with GRKIBMP A"; + tags=[Marchal;Flypaper["OXLZLEZ";"Jun2012"];Cfsqp;Clusterlp;Tex;Xconvert; + Branching;Split[0]]; +};; + +skip + { + idv = "GLFVCVK2 a"; + ineq = all_forall `ineq + [ (#2.0,y,&2 * h0 ) ] + (vol2r y sqrt2 - vol2f y sqrt2 lfun > &0)`; + doc = "If $X$ is a $2$-cell, then $\\gamma(X,L)\\ge0$. + It seems that there is a bug in this inequality. + It should be `(y/ &2) * vol2r y sqrt2 - vol2f y sqrt2 lfun > &0`. + Fortunately the error works in our favor, so there is no need to + change it. This applied to 'GLFVCVK2 b' as well. + Deprecated. Replaced by a stronger inequality GRKIBMP."; + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Cfsqp]; + };; + +skip + { + idv = "GLFVCVK2 b"; + ineq = all_forall `ineq + [ (&2 * h0,y,sqrt8 ) ] + (vol2r y sqrt2 - (&2 * mm1 / pi) * &2 * pi * (&1 - y / (sqrt2 * &2)) > &0)`; + doc = "If $X$ is a $2$-cell, then $\\gamma(X,L)\\ge0$. + See the comments about the bug in 'GLFVCVK2 a'. Again the error works in + our favor. + Deprecated. Replaced by a stronger inequality GRKIBMP."; + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Cfsqp;Sharp;Eps 1.0e-15]; + };; + +(******************************************************************************) +(* MARCHAL 1-CELL NONNEGATIVITY *) +(******************************************************************************) + + + +addtex(Comment,"","Marchal 1-cell");; + +skip +{ + idv = "HJKDESR1a"; + ineq = all_forall `ineq + [ (sqrt2, r, sqrt2) ] + ( &4 * pi * (r pow 3) / (&3) - (&2 * mm1 / pi) * &4 * pi >= &0) `; + doc = + "%old idv: 3148025108 , Packing Marchal 1-cell + If $X$ is a $1$-cell, then $\\gamma(X,M)\\ge 0$. + (The desired inequality is the + special case $r=\\sqrt2$ of the formal specification.). + Deprecated. Replaced with HJKDESR1a in Merge_ineq. 11/22/2012 +"; +(* [ (#1.246, r, sqrt2) ] *) + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Cfsqp;Eps 1.0e-7;Sharp]; +};; + +(******************************************************************************) +(* MARCHAL CELL_CLUSTER 2/3-CELL INEQS QY (SKIP) *) +(******************************************************************************) + + +addtex(Section,"Packing -- Cluster Inequality -- Three and four leaves","");; + +addtex(Comment,"", +"The cases of three and four leaves have been solved as a minor linear program. +The details of the model and data for the linear program are contained in the +glpk directory. Here we simply list the nonlinear inequalities that get used. +");; + + +skip +{ + idv = "QITNPEA 4003532128 b"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (#2.1 ,y4, sqrt8); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ( (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 < #0.14 ) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 < #0.14) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2) \/ + (gamma23f_n y1 y2 y3 y4 y5 y6 1 1 sqrt2 lmfun - #0.00457511 + - #0.00609451*dih_y y1 y2 y3 y4 y5 y6 > #0.0) + )`; + doc = " + Note the lower bound on $y_4$ is $2.1$. + This is an inequality for $23$-cells used to prove the cluster inequality. + We may use monotonicity so that rad2 is exactly 2. + May 25, 2011. Replaced with symmetrical version. + June 24, 2012. Entirely deprecated."; + tags=[Marchal;Cfsqp;Cfsqp_branch 3; + Clusterlp;Flypaper["OXLZLEZ"];Tex;Xconvert;Branching;Split[0]; + Set_rad2;Delta126min (0.14-. 1.0e-12); + Delta135min (0.14 -. 1.0e-12)]; +};; + +(* Dec 27, 2010 tested to see if 'QITNPEA 4003532128 b' can be + split into a left-and-right inequality. It cannot be done + with a correction term of the form + + #0.004 * (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2) +*) + +skip +{ + idv = "QITNPEA 4003532128 b sym"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (#2.1 ,y4, sqrt8); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ( (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 < #0.14 ) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 < #0.14) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2) \/ + (y2 < y3) \/ (y2 < y5) \/ (y2 < y6) \/ + (gamma23f_n y1 y2 y3 y4 y5 y6 1 1 sqrt2 lmfun - #0.00457511 + - #0.00609451*dih_y y1 y2 y3 y4 y5 y6 > #0.0) + )`; + doc = " + Note the lower bound on $y_4$ is $2.1$. + This is an inequality for $23$-cells used to prove the cluster inequality. + We may use monotonicity so that rad2 is exactly 2. + By symmetry we may assume that y2 is the longest of y2,y3,y5,y6. + June 24, 2012. Entirely deprecated."; + tags=[Marchal;Cfsqp;Cfsqp_branch 6; + Clusterlp;Flypaper["OXLZLEZ"];Tex;Xconvert;Branching;Split[0]; + Set_rad2;Delta126min (0.14-. 1.0e-12); + Delta135min (0.14 -. 1.0e-12)]; +};; + + +skip +{ + idv = "QITNPEA 4003532128 b2"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (#2.1 ,y4, #2.1); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ( (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 < #0.14 ) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 < #0.14) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2) \/ + (gamma23f_n y1 y2 y3 y4 y5 y6 1 1 sqrt2 lmfun - #0.00457511 + - #0.00609451*dih_y y1 y2 y3 y4 y5 y6 > #0.0) + )`; + doc = " + Note the lower bound on $y_4$ is $2.1$. + This is an inequality for $23$-cells used to prove the cluster inequality. + We may use monotonicity so that $y_4=2.1$. + June 24, 2012. Entirely deprecated."; +(* Dec 27, 2010 tested to see if it can be split into a left-and-right inequality. It cannot be done + with a correction term of the form + + #0.004 * (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2) *) + tags=[Marchal;Cfsqp;Cfsqp_branch 3;Clusterlp;Flypaper["OXLZLEZ"];Tex;Xconvert;Branching;Split[0];Delta126min (0.14-. 1.0e-12); + Delta135min (0.14 -. 1.0e-12)]; +};; + +skip +{ + idv = "QITNPEA 4003532128 c"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2 ,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (#2.1 ,y4, #2.1); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ( (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 < #0.14 ) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 < &0) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 > #0.14) \/ + ( gamma23f_126_03_n y1 y2 y3 y4 y5 y6 1 sqrt2 lmfun + - #0.00457511 + - #0.00609451*dih_y y1 y2 y3 y4 y5 y6 > #0.0) + )`; + doc = " + Inititally, $y_4$ extends to $\\sqrt8$, but we use monotonicity +to reduced it to the lower bound. + This gives an upper bound $0.08$ on the dihedral angle of the $3$-cell. + This is an inequality for $23$-cells used to prove the cluster inequality. +June 24, 2012. Entirely deprecated. +"; + tags=[Marchal;Cfsqp;Cfsqp_branch 3;Clusterlp;Flypaper["OXLZLEZ"];Tex;Xconvert;Branching;Split[0];Delta126min (0.14 -. 1.0e-12); + Delta135min (0.0); Delta135max(0.14 +. 1.0e-12)]; + (* d4 > 67 > Tan[Pi/2 - 0.03] Sqrt[4 1.0] ==> dih <= 0.03. *) + (* (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 > #0.14) \/ dropped 12/23/2010 *) +};; + +skip +{ + idv = "QITNPEA 4003532128 d"; +(* removed gamma3f y1 y2 y6 sqrt2 lmfun + from term on Nov 29, 2010 *) + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (#2.1 ,y4, sqrt8); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + (( + gamma23f_red_03 y1 y2 y3 y4 y5 y6 sqrt2 lmfun + - #0.00457511 + - #0.00609451*dih_y y1 y2 y3 y4 y5 y6 > #0.0) \/ + (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 > #0.14 ) \/ + (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 < &0 ) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 > #0.14) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 < &0) )`; + doc = " + This gives an upper bound $0.08$ on the dihedral angle of the $3$-cell. + This is an inequality for $23$-cells used to prove the cluster inequality. +June 24, 2012. Entirely deprecated. +"; + tags=[Marchal;Cfsqp;Clusterlp;Tex;Flypaper["OXLZLEZ"];Xconvert;Branching;Split[0]]; + (* d4 > 25 > Tan[Pi/2 - 0.08] Sqrt[4 1.0] ==> dih <= 0.08. *) +};; + +skip +{ + idv = "GLFVCVK3-a"; + ineq = all_forall `ineq + [(&2 , y1, sqrt8); + (&2,y2,sqrt8); + (sqrt2,y3,sqrt2); + (sqrt2,y4,sqrt2); + (sqrt2,y5,sqrt2); + (&2,y6,sqrt8) + ] + (((vol_y y1 y2 y3 y4 y5 y6 - ( (&2 * mm1 / pi) * + (&2 * dih_y y1 y2 y3 y4 y5 y6 + &2 * dih2_y y1 y2 y3 y4 y5 y6 + + &2 * dih6_y y1 y2 y3 y4 y5 y6 + dih3_y y1 y2 y3 y4 y5 y6 + + dih4_y y1 y2 y3 y4 y5 y6 + dih5_y y1 y2 y3 y4 y5 y6 - &3 * pi) - + (&8 * mm2 / pi) * + (lmfun (y1 / &2) * dih_y y1 y2 y3 y4 y5 y6 + + lmfun (y2 / &2) * dih2_y y1 y2 y3 y4 y5 y6 + + lmfun (y6 / &2) * dih6_y y1 y2 y3 y4 y5 y6))) >= &0)\/ + (delta_y y1 y2 y3 y4 y5 y6 < #0.99) )`; + doc = " + %4869905472 + If $X$ is a $3$-cell, then $\\gamma(X,L)\\ge0$. + The inequality is sharp at $(2,2,2)$. + This case treats delta > #0.99. + I have used vol3f\\_palt and vol3r\\_alt to expand their definitions. + Replaced with -sharp and -nonsharp inequalities, May 27, 2011."; + (* (eta_y y1 y2 y6 > sqrt2) \/ *) + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Cfsqp;Sharp;Eps 1.0e-8;Xconvert;Branching;Split[0;1;5];Widthcutoff 0.002;Deprecated]; +};; + + +skip +{ + idv = "GLFVCVK3-a sharp"; + ineq = all_forall `ineq + [(&2 , y1, #2.001); + (&2,y2,#2.001); + (sqrt2,y3,sqrt2); + (sqrt2,y4,sqrt2); + (sqrt2,y5,sqrt2); + (&2,y6,#2.001) + ] + ((vol_y y1 y2 y3 y4 y5 y6 - ( (&2 * mm1 / pi) * + (&2 * dih_y y1 y2 y3 y4 y5 y6 + &2 * dih2_y y1 y2 y3 y4 y5 y6 + + &2 * dih6_y y1 y2 y3 y4 y5 y6 + dih3_y y1 y2 y3 y4 y5 y6 + + dih4_y y1 y2 y3 y4 y5 y6 + dih5_y y1 y2 y3 y4 y5 y6 - &3 * pi) - + (&8 * mm2 / pi) * + (lmfun (y1 / &2) * dih_y y1 y2 y3 y4 y5 y6 + + lmfun (y2 / &2) * dih2_y y1 y2 y3 y4 y5 y6 + + lmfun (y6 / &2) * dih6_y y1 y2 y3 y4 y5 y6)) >= &0)\/ + (delta_y y1 y2 y3 y4 y5 y6 < #0.99) )`; + doc = " + Deprecated. Replaced with QZECFIC June 24, 2012. + %4869905472 + If $X$ is a $3$-cell, then $\\gamma(X,L)\\ge0$. + The inequality is sharp at $(2,2,2)$. + I have used vol3f\\_palt and vol3r\\_alt to expand their definitions. + May 25, 2011. By symmetry, wlog y1 < y2 < y6. + "; + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Branching;Cfsqp;Sharp;Eps 1.0e-8;Xconvert;Branching;]; +};; + +skip +{ + idv = "GLFVCVK3-a nonsharp"; + ineq = all_forall `ineq + [(#2.001 , y1, sqrt8); + (&2,y2,sqrt8); + (sqrt2,y3,sqrt2); + (sqrt2,y4,sqrt2); + (sqrt2,y5,sqrt2); + (&2,y6,sqrt8) + ] + ((vol_y y1 y2 y3 y4 y5 y6 - ( (&2 * mm1 / pi) * + (&2 * dih_y y1 y2 y3 y4 y5 y6 + &2 * dih2_y y1 y2 y3 y4 y5 y6 + + &2 * dih6_y y1 y2 y3 y4 y5 y6 + dih3_y y1 y2 y3 y4 y5 y6 + + dih4_y y1 y2 y3 y4 y5 y6 + dih5_y y1 y2 y3 y4 y5 y6 - &3 * pi) - + (&8 * mm2 / pi) * + (lmfun (y1 / &2) * dih_y y1 y2 y3 y4 y5 y6 + + lmfun (y2 / &2) * dih2_y y1 y2 y3 y4 y5 y6 + + lmfun (y6 / &2) * dih6_y y1 y2 y3 y4 y5 y6)) >= &0)\/ + (y1 < y2) \/ (y2 < y6) \/ + (delta_y y1 y2 y3 y4 y5 y6 < #0.99) )`; + doc = " + Deprecated. Replaced with QZECFIC June 24, 2012. + %4869905472 + If $X$ is a $3$-cell, then $\\gamma(X,L)\\ge0$. + The inequality is sharp at $(2,2,2)$. + I have used vol3f\\_palt and vol3r\\_alt to expand their definitions. + May 25, 2011. By symmetry, wlog y1 > y2 > y6. + "; + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Cfsqp;Sharp;Eps 1.0e-8;Xconvert;Branching;Split[0;1;5];Widthcutoff 0.003;]; +};; + + +skip +{ + idv = "GLFVCVK3-b"; + ineq = all_forall `ineq + [(&2,y1,sqrt8); + (sqrt2,y2,sqrt2); + (&2,y3,sqrt8); + (sqrt2,y4,sqrt2); + (&2,y5,sqrt8); + (sqrt2,y6,sqrt2) + ] + (( &1 / &12 - + ( (&2 * mm1 / pi) * + (y_of_x sol_euler_x_div_sqrtdelta y1 y2 y3 y4 y5 y6 + + y_of_x sol_euler156_x_div_sqrtdelta y1 y2 y3 y4 y5 y6 + + y_of_x sol_euler345_x_div_sqrtdelta y1 y2 y3 y4 y5 y6) - + (&8 * mm2 / pi) * + (y_of_x lmdih_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 + + y_of_x lmdih3_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 + + y_of_x lmdih5_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6) + ) > &0) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ + (delta_y y1 y2 y3 y4 y5 y6 > #1.0 ) )`; + doc = " + Deprecated. Replaced with QZECFIC June 24, 2012. + %4869905472 + If $X$ is a $3$-cell, then $\\gamma(X,L)\\ge0$. + When $\\eta=\\sqrt{2}$, (which is equivalent to the vanishing of $\\Delta$), + the inequality is sharp. + A term $\\Delta(y_1,\\sqrt2,y_3,\\sqrt2,y_5,\\sqrt2)$ has been + factored out, from the function that appears in part a."; + (* vol3r y1 y3 y5 sqrt2 - vol3f y1 y3 y5 sqrt2 lmfun > &0 *) + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Cfsqp;Xconvert;Branching;Split[0;2;4]]; +};; + + + + +(******************************************************************************) +(* DEPRECATED F23 SERIES *) +(******************************************************************************) + +(* F23 *) + +addtex(Comment,"", +"This is one of the longest (and slowest running) computations in the entire list. +Deprecated June 24, 2012. Replaced with entirely different series. + +Changes: +Dec 27, 2010. split into two cases _F23b _F23b2: + by monotonicity of x4, either rad2=2 or x4=2. + +Dec 27, 2010, in template_F23c upper bound on y4 changed from sqrt8 to 2, + by monotonicity, + Also rad2 constraint dropped. (y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2) + + +Symmetries: + horizontal: (edge 3,edge 5) <-> (edge 2,edge 6) + vertical: (edge 2,edge 3) <-> (edge 6, edge 5) + By sqrt2 arguments, both triangles (1,3,5) and (1,2,6) have a subcritical edge: + eta[2hminus,2hminus,2hminus]^2 > 2. + In case (c), we apply a horizontal symmetry, so that Delta135 < Delta126. + + 0* means [2,2 hminus], 1* means [2 hminus,sqrt8] +Cases (i3,i5) : (0*,0*) (1*,0*) (0*,1*), eliminate (1*,1*) by rad2 arguments. +By applying a vertical symmetry, we may assume that y2 is subcritical: i2=0*. + (i3,i5,i6) : (0*,0*,0*), (0*,0*,1*), (1*,0*,0*), (1*,0*,1*), (0*,1*,0*), (0*,1*,1*) + We eliminate (1*,0*,0*) -> (0*,1*,0*) by vertical symmetry, leaving + (0*,0*,0*), (0*,0*,1*), (1*,0*,1*), (0*,1*,0*), (0*,1*,1*) + (0*,0*,0*) (b) (d), symmetries are still available, + we may assume that (y2 < y6) (y2 < y3) (y2 < y5) + (c) assume (y2 < y6) + (0*,0*,1*) no symmetry + (1*,0*,1*) (b) (d), sym gives (y2 (0*,0*,1*). + (c) no sym +(0*,1*,1*) (b) (d), sym gives (y2 0.14 Delta135 > 0.14, rad2=2. + Uses gamma23f_n. + Warning! The constraint rad2=2 is given in the tags, but not stated formally! +(b2): Delta126 > 0.14, Delta135 > 0.14, y4=2. + Uses gamma23f_n. +(c): Delta126 > 0.14, 0 < Delta135 < 0.14. + Uses gamma23f_126_03_n, justified by 'QITNPEA 4003532128 a'. + Rad disjunct dropped, allowing y4=2 by monotonicity. +(_): Eliminated by c-symmetry: 0 < Delta126 < 0.14, Delta135 > 0.14 +(d): 0 < Delta126 < 0.14, 0 < Delta135 < 0.14. + Uses gamma23f_red_03, justified by 'QITNPEA 4003532128 a' +");; + +let template_F23b = `\ y3m y3M y5m y5M y6m y6M w1 w2. ineq + [(&2 * hminus, y1, &2 * hplus); + (&2 ,y2, &2 *hminus); + (y3m,y3,y3M); + (&2 ,y4, sqrt8 ); + (y5m,y5,y5M); + (y6m,y6,y6M)] + ( (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 < #0.14 ) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 < #0.14) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2) \/ + (gamma23f_n y1 y2 y3 y4 y5 y6 w1 w2 sqrt2 lmfun > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6) + )`;; + +let template_F23b2 = `\ y3m y3M y5m y5M y6m y6M w1 w2. ineq + [(&2 * hminus, y1, &2 * hplus); + (&2 ,y2, &2 *hminus); + (y3m,y3,y3M); + (&2 ,y4, &2 ); + (y5m,y5,y5M); + (y6m,y6,y6M)] + ( + (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 < #0.14 ) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 < #0.14) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2) \/ + (gamma23f_n y1 y2 y3 y4 y5 y6 w1 w2 sqrt2 lmfun > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6) + )`;; + +let template_F23c = `\ y3m y3M y5m y5M y6m y6M (w1:num) (w2:num). ineq + [(&2 * hminus, y1, &2 * hplus); + (&2 ,y2, &2 *hminus); + (y3m,y3,y3M); + (&2 ,y4, &2 ); + (y5m,y5,y5M); + (y6m,y6,y6M)] + ( + (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 < #0.14 ) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 > #0.14) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 < &0) \/ + (gamma23f_126_03_n y1 y2 y3 y4 y5 y6 w1 sqrt2 lmfun > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6) + )`;; + +let template_F23d = `\ y3m y3M y5m y5M y6m y6M (w1:num) (w2:num). ineq + [(&2 * hminus, y1, &2 * hplus); + (&2 ,y2, &2 *hminus); + (y3m,y3,y3M); + (&2 ,y4, sqrt8 ); + (y5m,y5,y5M); + (y6m,y6,y6M)] + ((gamma23f_red_03 y1 y2 y3 y4 y5 y6 sqrt2 lmfun > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2) \/ + (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 > #0.14 ) \/ + (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 < &0 ) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 > #0.14) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 < &0) )`;; + +let ineq_F23 i3 i5 i6 j = + let template = List.nth [template_F23b;template_F23b2;template_F23c;template_F23d] j in + let x i = List.nth [`&2`; `&2 * hminus` ; `sqrt8`] i in + let X i = x (i+1) in + let mid i = if (i>0) then 1 else 0 in + let m = mk_small_numeral in + let w1 = 1 + mid i6 in + let w2 = 1 + mid i3 + mid i5 in + mk_tplate template [x i3;X i3; x i5;X i5; x i6 ;X i6; m w1; m w2];; + +let tags_F23 = + let min14 = 0.14 -. 1.0e-12 in + let max14 = 0.14 +. 1.0e-12 in + let tag_all = [Marchal;Cfsqp_branch 3;Flypaper["OXLZLEZ";]; + Xconvert;Penalty(200.0,5000.0);Branching;] in + [[Set_rad2;Delta126min min14;Delta135min min14] @ tag_all; + [Delta126min min14;Delta135min min14] @ tag_all; + [Delta126min min14;Delta135min (0.0);Delta135max max14] @ tag_all; + tag_all];; + +let make_F23 i j = + let (i3,i5,i6) = List.nth [(0,0,0);(0,0,1);(1,0,1);(0,1,1);(0,1,0)] i in (* wlog by symmetry *) + let ext = List.nth ["b";"b2";"c";"d"] j in + let tg0 = (List.nth tags_F23 j) in + let tg = (if (i=0) then [Tex] else []) @ [Split (split_F4 i3 0 i5 i6)] @ tg0 in + { + idv = Printf.sprintf "ZTGIJCF23 %d %d %d 7907792228 %s" i3 i5 i6 ext; + ineq = ineq_F23 i3 i5 i6 j; + doc = "This is the $2$- and $3$-cell inequality for five or more leaves."; + tags=tg + };; + +for j=0 to 3 do + for i = 0 to 3 do + skip (make_F23 i j) done done ;; + +skip(make_F23 4 2);; (* 0,1,0 c was left out earlier, inserted May 29, 2011 *) + + +(* +let template_F23b2_tags= [Marchal;Cfsqp_branch 3;Delta126min c14;Delta135min c14];; + +let template_F23b_tags=Set_rad2 :: templateF23b2_tags;; + +let template_F23c_tags= + [Marchal;Cfsqp_branch 3;Delta126min c14;Delta135min (0.0);Delta135max c14u];; +*) + +skip + { +idv="5512912661"; +doc = "If diag >= 3, then 3/1.26 > 2.38 and we can contract. + 15.53: arc[2,2,2.52]2 < arc[2,2,Sqrt[15.53]]. + Added May 16, 2011. + Case where some edge is at least 3.15. + I don't think this is ever used. Doch!... + May 25, 2012. Added back in. It is needed for the + case List.nth quad_cases_left 1 in check_completeness. + In particular, when lo[0;1;2;3]; str=[0]; + diags [3.01,6.00]; (0,1,[2,2.52]),(1,2,[2.52,3.01]),(2,3,[2.0,2.0]), + (0,3,[2.52,3.01]). Under these conditions diag02 <= 3.15 and + can be used to deform edge12 down to 2.52. + Note that arc 2. 2. (3.15/h0) < arc 2.52 2. 3.01 + so c2 can be a diag>3.01 if one of its endpoints has ht 2. + + 2013-06-23. In latest revisions, in text expansion of check_completeness, + this is again deprecated. + "; +tags=[Main_estimate;Cfsqp;Tex;Flypaper["UPONLFY"];Deprecated]; +ineq = all_forall `ineq + [ + (&1 , e1, &1 + sol0/ pi); + (&1 , e2, &1 + sol0/ pi); + (&1 , e3, &1 + sol0/ pi); + (#2.38 pow 2, a2, #3.01 pow 2); + ((&2) pow 2, b2, #2.52 pow 2); + ((#3.15 /h0) pow 2, c2, #15.53) + ] + ((num1 e1 e2 e3 a2 b2 c2 ) > &0) `; +};; + + +skip + { +idv="8964099283"; +doc = "If diag >= 3, then 3/1.26 > 2.38 and we can contract. + 15.53: arc[2,2,2.52]2 < arc[2,2,Sqrt[15.53]]. + This is the case of three long edges. + Added May 16, 2011. + Note: May 2012. This is strictly contained in + 6843920790. So it is not separated needed. We change + its status to 'skip'"; +tags=[Main_estimate;Cfsqp;Tex;Flypaper["UPONLFY"];]; +ineq = all_forall `ineq + [ + (&1 , e1, &1 + sol0/ pi); + (&1 , e2, &1 + sol0/ pi); + (&1 , e3, &1 + sol0/ pi); + (#2.38 pow 2, a2, #3.01 pow 2); + (#2.38 pow 2, b2, #3.01 pow 2); + (#2.38 pow 2, c2, #15.53) + ] + ((num1 e1 e2 e3 a2 b2 c2 ) > &0) `; +};; + +skip +{ + idv="8430954724"; + doc="Used to maintain nonreflexivity when making num1-deformations. + The big angle on a skinny triangle (ear) is obtuse. + Reduced variables. Used on obtuse_sloc in check_completeness.hl to + show that a hexagon (k=6) with three straights has an obtuse angle. + The three straights give 3 arc[2.52,2.52,2] > arc[2,2,3.75]. + Use monotonicity to drop to exactly 3.75. + Added 2013-06-02. Deprecated 2013-06-27."; + tags=[Flypaper["UPONLFY"];Main_estimate;Cfsqp;Xconvert;Tex;Deprecated]; + ineq = Sphere.all_forall `ineq [ + (&2,y1,&2); + (&2,y2,&2); + (&2,y3,&2); + (#3.75,y4,#3.75); + (&2 / h0,y5,#2.52); + (&2 / h0,y6,&2 * #2.52) + ] +((delta4_y y1 y2 y3 y4 y5 y6 < &0) \/ (delta_y y1 y2 y3 y4 y5 y6 < &0))`; +};; + +skip +{ + idv="3405144397-numerical"; + doc="old name: test8* + Local-fan/Main-estimate/terminal-pent/both-ears-under-20. + ear dih inequality when delta < 20"; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (&2,y5,&2); + (#3.01,y6,#3.237) + ] +( + (delta_y y1 y2 y3 y4 y5 y6 > &20) \/ + (dih_y y1 y2 y3 y4 y5 y6 < (#1.75 - #1.109) / &2) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +skip +{ + idv="3405144397"; + doc="ear dih ineq when delta < 20. + Local-fan/Main-estimate/Terminal-pent/both-ears-under-20. + Adaptation of 9459075374. + (EAR) A bound on the delta of an ear in a pent, + The disjunct (dih_y y1 y2 y3 y4 y5 y6 < #0.3205 = (1.75-1.109)/2) has been 'linearized'. + Tan[0.3205]^2 = (>=) 0.110186 + In more detail, this calc shows that delta > 20 or dih < 0.3205 + By 4887115291, we know that the combined angle at the crowded node of a pent is + at least 1.75. If both ears have delta < 20, then combined angle + is at least 1.109 + 2 * 0.3205 = 1.75, so a cross diag <= 3.01. + Hence wlog one of the two ears has delta >= 20. + "; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(50.0,500.0);]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.52,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.24); + (&2,y6,#2.52) + ] +(let tan2lower = #0.110186 in + (delta_y y1 y2 y3 y4 y5 y6 > &20) \/ + (&4 * x1_delta_y y1 y2 y3 y4 y5 y6 < tan2lower * delta4_squared_y y1 y2 y3 y4 y5 y6) + )`; +};; + +skip +{ + idv="8146670324"; + doc="old name: local max v4*, WNLKGOQ, 1671775772 (with #0.12->#0.1) + better local max test. + This is the numerator of the 2nd derivative of the function taud. + Case delta > 20. + Replaced with 1347067436 below. taum -> taud. + "; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.237); + (&2,y5,&2); + (&2,y6,&2) + ] + (y_of_x taud_D1_num_x y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x taud_D1_num_x y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x taud_D2_num_x y1 y2 y3 y4 y5 y6 < &0 \/ + taum y1 y2 y3 y4 y5 y6 > #0.12 \/ + delta_y y1 y2 y3 y4 y5 y6 < &20)`; +};; + +skip +{ + idv="9504486349"; + doc="When delta <= 20, delta is monotonic decreasing in y1. + Hence smallest y1 on the comain delta <= 20 occurs when delta =20. + This gives a lower bound flat_term (y1 @ del20) <= taud on the domain delta <= 20. + 2013-05-29 replaced with 3078028960"; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Tex;Xconvert;Penalty(500.0,5000.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] + ( + y_of_x delta_x1 y1 y2 y3 y4 y5 y6 < &0 \/ + delta_y y1 y2 y3 y4 y5 y6 > &20 \/ + delta_y y1 y2 y3 y4 y5 y6 < &0 +)`; +};; + +skip +{ + idv="8723570049"; + doc="local fan/main estimate/terminal pent + y1=2.52, delta>=20, falls into taum>=0.12 case. + deprecated 2013-05-25. taum is useless. We need taud here. It is post 2nd deriv since y1=2.52."; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0);Deprecated]; + ineq = all_forall `ineq [ + (#2.52,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.237); + (&2,y5,&2); + (&2,y6,&2) + ] +(taum y1 y2 y3 y4 y5 y6 > #0.12 \/ +delta_y y1 y2 y3 y4 y5 y6 < &20 +)`; +};; + +skip +{ + idv="old 1008824382"; + doc=" + local fan/main estimate/terminal pent + LHS(135,delta=20) RHS(126,delta=0) + sqrt(20) .> 4.47. + 0.705 comes by combining mu_y and flat_term2_x terms. + "; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237) + ] +(taum y1 y2 y3 y4 y5 y6 + + #0.705 * y_of_x (flat_term2_135_x (&20) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + (#0.012 + #0.01 * (#2.52 * &2 - y1 - y3 )) * #4.47 + + y_of_x (flat_term2_126_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + > #0.616 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &20 \/ + y_of_x (delta_135_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &20 \/ + y_of_x (delta_126_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 +)`; +};; + +skip +{ + idv="4910585280"; + doc="local fan/main estimate/appendix/terminal hex + 2nd derivative test for taud. + Replaced with 6877738680."; + tags=[Main_estimate;Flypaper ["LIAULBV"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] + (y_of_x taud_D1_num_x y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x taud_D1_num_x y1 y2 y3 y4 y5 y6 < &0 \/ + (y_of_x taud_D2_num_x y1 y2 y3 y4 y5 y6 < &0 \/ + taum y1 y2 y3 y4 y5 y6 > &0 \/ + delta_y y1 y2 y3 y4 y5 y6 < &15))`; +};; + +skip + { + idv="test 8405387449"; (* was "test D"; *) + doc = ""; + tags=[Main_estimate;Cfsqp;Tex;Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.55); + (&2 * h0,y6,#3.01)] + ((dih_y y1 y2 y3 y4 y5 y6 < #1.1) ) `; + };; + +skip + { + idv="test 8405387449"; (* was "test D"; *) + doc = ""; + tags=[Main_estimate;Cfsqp;Tex;Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.55); + (&2 * h0,y6,#3.01)] + ((dih_y y1 y2 y3 y4 y5 y6 < #1.1) ) `; + };; + + +addtex(Comment,"skip 8063547910", +"0.477 bound, quad case both diags > 3.01, y9 long [2.52,sqrt8]. + In this case top edge deformations have been fully applied, + so that all short top edges are 2. + Then we extremize y9, folding the case y9=sqrt8 into 7697147739. + What remains is y9=2.52. But then the diagonal has length + Solve[Delta[x,2,2,x,2,2.52]==0,x](*x < 3.01 *) + so a diagonal can be drawn, and we drop into the triangle section. + ");; + +skip +{ + idv="8063547910"; + doc=""; + tags=[Flypaper["FHOLLLW"];Main_estimate;Quad_cluster 0.001;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0); + Deprecated]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.108); + (#2.0,y5,&2); + (#2.0,y6,&2); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (#2.52,y9,#2.52)] +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > #0.477) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ))`; +};; + + (* +Note: XXX +Constant in head.mod is 0.616, +Why don't we use that instead of 0.696?? +I'll use the smaller constant in check_completeness. + May 13, 2012 . tchales +Fixed 2013-05-05. + +2013-06-17. constant->0.513 +*) + +skip +{ + idv="4680581274 derived a"; + doc="This derived inequality summarizes the series."; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Quad_cluster 0.001;Xconvert;Tex;Penalty(50.0,5000.0)]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.166); + (#2.0,y5,&2); + (#2.0,y6,&2); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (#3.01,y9,#3.01)] +( + ( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > #0.513) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ))`; +};; + +skip +{ + idv="7697147739 derived a"; + doc="Summary of the series. Derived inequality. + 2013-05-05, 0.696 -> 0.616. "; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Quad_cluster 0.001;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.108); + (#2.0,y5,&2); + (#2.0,y6,&2); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (sqrt8,y9,sqrt8)] +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > #0.616 - #0.11) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ))`; +};; + +skip +{ + idv="7697147739 a"; + doc="quad case both diags > 3.01, y9 long + Diagonal upper bound by + Solve[Delta[x,2,2,x,2,Sqrt[8]]==0,x] (*x < 3.108 *) + 2013-05-05, 0.696 -> 0.616. + Deprecated 2013-06-17"; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Quad_cluster 0.001;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.108); + (#2.0,y5,&2); + (#2.0,y6,&2); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (sqrt8,y9,sqrt8)] +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > #0.616 - #0.11) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &25) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ))`; +};; + +skip +{ + idv="7697147739 delta issue"; + doc="quad case both diags > 3.01, y9 long + Diagonal upper bound by + Solve[Delta[x,2,2,x,2,Sqrt[8]]==0,x] (*x < 3.108 *) + Deprecated 2013-06-17"; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Quad_cluster 0.001;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.166); + (#2.0,y5,&2); + (#2.0,y6,&2); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (sqrt8,y9,sqrt8)] +(( delta_y y1 y2 y3 y4 y5 y6 > &25) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ))`; +};; + +skip +{ + idv="7697147739 delta top issue"; + doc="quad case top neg delta. + Solve[Delta[x,2,2,x,2,Sqrt[8]]==0,x] (*x < 3.108 *) + Added 2013-05-05. + Deprecated 2013-06-17."; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert]; + ineq = all_forall `ineq [ + (#3.108,y1,&4); + (sqrt8,y2,sqrt8); + (&2,y3,&2); + (#3.108,y4,&4); + (&2,y5,&2); + (&2,y6,&2)] +(delta_y y1 y2 y3 y4 y5 y6 < &0)`; +};; + +addtex(Comment,"", +" +This is the calculation of quadrilaterals (non ad hoc). TameTableD[r,s], + for (r+s=4): (4,0), (3,1) (2,2). +By triangulating cases away, we may assume that both diagonals are => 3.01. +If there is adjacent short edges [2,2.52], we may deform so that both =2. +We can extremize the long edges [2.52,3.01]. + +In the case (4,0), when top edges are 2, some diagonal < 3.01, so nothing to do here. + +In the case (3,1), there are two cases, depending on y9. Both can be eliminated +without further interval calculations as follows: + In fact, + Solve[Delta[x, 2, 2, x, 2, 2.52] == 0, x], gives x< 3.01, so one is impossible. + Solve[Delta[x,2,2,x,2,3.01]==0,x], gives x < 3.166. This domain + was already encountered in the Quad 0.696 case. + Since tameTableD[3,1] < 0.696 - 0.11, this is covered by a previous quad ineq. + +Now consider (2,2). Six cases total up to symmetry. + factor of 2 whether the long edges are adjacent. + factor of 3 the number {0,1,2} of the long edges that are minimal 2.52. + Also, the shorter diagonal can slice in two distinguishable ways, if long edges are adjc. + + Here are the shorter diagonal upper bounds in the six cases: +Solve[Delta[x,2.52,2,x,2.52,2]==0,x] (* < 3.22 *) +Solve[Delta[x,2.52,2,x,2,2.52]==0,x] (* < 3.18 *) + +Solve[Delta[x,3.01,2,x,2.52,2]==0,x] (* < 3.41 *) +Solve[Delta[x,3.01,2,x,2,2.52]==0,x] (* < 3.33 *) + +Solve[Delta[x,3.01,2,x,3.01,2]==0,x] (* < 3.62 *) +Solve[Delta[x,3.01,2,x,2,3.01]==0,x] (* < 3.47 *) + +In cases where the two top long edges are separated +by the diagonal, we can triangulate using the following triangle calcs. + +This reduces everything to three quad cases, where the long top edges are y8,y9. +If y8, y9 are both 3.01, use 8964099283 to show it is nonoptimal. +If y8, y9 are both 2.52, triangulate using the long diagonal. + +This leaves one quad case, where y8=2.52 and y9=3.01, not separated by short diag. +If long diag <= 3.41, it is covered by the calcs for short diag (which is <= 3.41). +Else long diag [3.41,3.634]. Triangulate by the long diag. Run the quad cluster. + + +So in the end, all quad cases can be replaced by triangulations except this last case. +");; + +(* +Deprecated remark: +If the shorter diag <= 3.15, we slice and use two triangle calcs. +If the shorter diag >= 3.15, we use a num1 calc to show it is nonoptimal. +*) + + +skip +{ + idv="3456082115"; + doc=" tameTableD[2,2] + Triangulate quad with diagonal y4. + Use if both long edges are 2.52. + Deprecated. It is a special case of 4922521904"; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.22); + (#2.52,y5,#2.52); + (&2,y6,&2) + ] +( + ( taum y1 y2 y3 y4 y5 y6 > tame_table_d 2 2 / &2) + )`; +};; + +skip +{ + idv="7720405539"; + doc="Main estimate/quad/upper echelon. + tameTableD[2,2] + Triangulate quad with diagonal y4. + Use if exactly one long edge is 2.52. + Deprecate 2013-06-16."; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.41); + (#2.52,y5,#2.52); + (&2,y6,&2) + ] +( + ( taum y1 y2 y3 y4 y5 y6 > tame_table_d 2 2 / &2 - #0.2) + )`; +};; + +skip +{ + idv="2739661360"; + doc="Main estimate/quad/upper echelon. + tameTableD[2,2] + Triangulate quad with diagonal y4. + Use if some long edge is 3.01 and if diag <= 3.41. + Deprecate 2013-06-16."; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.41); + (#3.01,y5,#3.01); + (&2,y6,&2) + ] +( + ( taum y1 y2 y3 y4 y5 y6 > tame_table_d 2 2 / &2 + #0.2) + )`; +};; + +skip +{ + idv="9269152105"; + doc="Main estimate/quad/upper echelon. + tameTableD[2,2] + Triangulate quad with diagonal y4. + Use if both long edges are 3.01 and if 3.41 <= diag <= 3.62. + If diag <= 3.41, then it falls into the previous case. + 2013-06-13. Deprecated. "; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.41,y4,#3.62); + (#3.01,y5,#3.01); + (&2,y6,&2) + ] +( + ( taum y1 y2 y3 y4 y5 y6 > tame_table_d 2 2 / &2 ) + )`; +};; + +skip +{ + idv="4922521904"; + doc="Main estimate/quad case/ tameTableD[2,2] + Triangulate quad with diagonal y4. + This is the case two top edges =2.52. + We use whichever diagonal separates long edges. + Its bound comes from top delta: + Solve[Delta[3.01, 2, 2.52, x, 2.52, 2] == 0, x] (* x < 3.339 *) "; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.339); + (#2.52,y5,#2.52); + (&2,y6,&2) + ] +( + ( taum y1 y2 y3 y4 y5 y6 > tame_table_d 2 2 / &2 ) + )`; +};; + +skip { + idv="1637868761"; + doc=" Triangulate quad with diagonal y4. + Case both diags > 3.01, y6, y9 long (2.52 and 3.01), + short diagonal doesn't separate long edges. + Triangulate by long diagonal (at least 3.41 for otherwise it drops into case + where short diagonal separates long edges). + Solve[Delta[x, 2, 2, 3.01, 2.52, 3.01] == 0, x] (* x < 3.634 *) + + Removed. May 25, 2012. + check_completeness.hl works without it. + Insted we subdivide at 3.41 and use deformation 5512912661 on the + piece with a diag >= 3.41. +"; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Quad_cluster 0.001;Xconvert;Tex;Penalty(1500.0,3000.0)]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.41,y4,#3.634); + (#2.0,y5,&2); + (#2.52,y6,#2.52); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (#3.01,y9,#3.01)] +( + tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > tame_table_d 2 2 \/ + delta_y y1 y2 y3 y4 y5 y6 < &30 \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ))`; +};; + +skip +{ + idv="8748498390"; + doc=" 0.513 estimate, A-piece triangle. + One diagonal exactly 3.01. Added 2013-06-13. Upper bound on y1 in error. + Replaced with 9096461391"; + tags=[Flypaper["FHOLLLW"];Cfsqp;Main_estimate;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.1); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); + (#2.52,y5,#3.01); + (#3.01,y6,#3.01) + ] + ( taum y1 y2 y3 y4 y5 y6 + #0.12 * (y1 - &2) > #0.403 )`; +};; + + +(* SKIPPED MATERIAL *) + +skip { +idv = "OMKYNLT 2 1"; +tags = [Cfsqp;Flypaper["OMKYNLT"];Main_estimate;Tex;Xconvert]; +doc = "This is the inequality of $\\tau > d(r,s)$ on triangles. + We can skip this. It is a special case of 5541487347."; +ineq = all_forall `ineq + [ + (#2.0,y1,#2.52); + (#2.0,y2,#2.52); + (#2.0,y3,#2.52); + (&2,y4,&2); + (&2,y5,&2); + (&2 * h0, y6, &2 * h0) + ] +( taum y1 y2 y3 y4 y5 y6 > tame_table_d 2 1)`; +};; + +skip { +idv = "OMKYNLT 1 2"; +tags = [Cfsqp;Flypaper["OMKYNLT"];Main_estimate;Tex;Xconvert]; +doc = " + %old idv 8880534953 + This is the inequality of $\\tau > d(r,s)$ on triangles. Note that + the optimal point is not $(2,2,2)$ as one might have expected. + This is a special case of 6833979866 and can be skipped."; +ineq = all_forall `ineq + [ + (#2.0,y1,#2.52); + (#2.0,y2,#2.52); + (#2.0,y3,#2.52); + (&2,y4,&2); + (&2 * h0,y5,&2 * h0); + (&2 * h0,y6,&2 * h0) + ] +( taum y1 y2 y3 y4 y5 y6 > tame_table_d 1 2)`; +};; + +(* added on May 8, 2011 *) + +skip { +idv = "OMKYNLT 0 3"; +tags = [Cfsqp;Flypaper["OMKYNLT"];Main_estimate;Tex;Xconvert]; +doc = "This is the inequality of $\\tau > d(r,s)$ on triangles. + This is a special case of 4010906068 and can be skipped, a variant of '1080462150' "; +ineq = all_forall `ineq + [ + (#2.0,y1,#2.52); + (#2.0,y2,#2.52); + (#2.0,y3,#2.52); + (#2.52,y4,#2.52); + (#2.52,y5,#2.52); + (#2.52,y6,#2.52) +] +( taum y1 y2 y3 y4 y5 y6 > tame_table_d 0 3)`; +};; + + +skip +{ + idv="1107929058"; + doc="triangle 2,1. + This is identical to 'OMKYNLT 2 1', so we skip it here."; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (&2,y5,&2); + (#2.52,y6,#2.52) + ] +( + taum y1 y2 y3 y4 y5 y6 > tame_table_d 2 1 + )`; +};; + +skip +{ + idv="7645170609"; + doc="triangle 2,1. Special case of 5541487347. Deprecated 2013-06-04"; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (&2,y5,&2); + (sqrt8,y6,sqrt8) + ] +( + taum y1 y2 y3 y4 y5 y6 > tame_table_d 2 1 + )`; +};; + +(* skip 2,1 long edge 3.01 *) + +(* 1,2 cases short-long patterns on y5,y6 aa, ab, ac, bb, bc, cc. +*) + +skip +{ + idv="1532755966"; + doc="triangle 1,2-aa. + This is identical to 'OMKYNLT 1 2' so we skip it here."; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#2.52,y5,#2.52); + (#2.52,y6,#2.52) + ] +( + taum y1 y2 y3 y4 y5 y6 > tame_table_d 1 2 + )`; +};; + +skip +{ + idv="7097350062a"; + doc="triangle 1,2-ab. + Modified constant to tame_table_d 1 2 on May 23, 2012. + Appended 'a' to idv. + Special case of 6833979866"; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#2.52,y5,#2.52); + (sqrt8,y6,sqrt8) + ] +( + taum y1 y2 y3 y4 y5 y6 > tame_table_d 1 2 + )`; +(* was tame_table_d 1 2 + (tame_table_d 2 1 - #0.11) *) +};; + +skip +{ + idv="2900061606"; + doc="triangle 1,2-ac. Special case of 6833979866"; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#2.52,y5,#2.52); + (#3.01,y6,#3.01) + ] +( + taum y1 y2 y3 y4 y5 y6 > tame_table_d 1 2 + (tame_table_d 2 1 - #0.11) + )`; +};; + +skip +{ + idv="2200527225"; + doc="triangle 1,2-bb. Special case of 6833979866"; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (sqrt8,y5,sqrt8); + (sqrt8,y6,sqrt8) + ] +( + taum y1 y2 y3 y4 y5 y6 > tame_table_d 1 2 + &2 *(tame_table_d 2 1 - #0.11) + )`; +};; + +skip +{ + idv="3106201101"; + doc="triangle 1,2-bc. Special case of 6833979866"; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (sqrt8,y5,sqrt8); + (#3.01,y6,#3.01) + ] +( + taum y1 y2 y3 y4 y5 y6 > tame_table_d 1 2 + &2 *(tame_table_d 2 1 - #0.11) + )`; +};; + +skip +{ + idv="9816718044"; + doc="triangle 1,2-cc. Special case of 6833979866"; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.01); + (#3.01,y6,#3.01) + ] +( + taum y1 y2 y3 y4 y5 y6 > tame_table_d 1 2 + &2 *(tame_table_d 2 1 - #0.11) + )`; +};; + +(* 0,3 patterns: extremize all the way from 2.52 to 3.01 without stopping at sqrt8. + The case is given by the number of top edges {0,1,2,3} of length 3.01 +*) + +skip +{ + idv="1080462150"; + doc="triangle 0,3. Special case of 4010906068"; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#2.52,y4,#2.52); + (#2.52,y5,#2.52); + (#2.52,y6,#2.52) + ] +( + taum y1 y2 y3 y4 y5 y6 > tame_table_d 0 3 + &3 *(tame_table_d 2 1 - #0.11) + )`; +};; + +skip +{ + idv="4143829594"; + doc="triangle 0,3. Special case of 4010906068"; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#2.52,y4,#2.52); + (#2.52,y5,#2.52); + (#3.01,y6,#3.01) + ] +( + taum y1 y2 y3 y4 y5 y6 > tame_table_d 0 3 + &3 *(tame_table_d 2 1 - #0.11) + )`; +};; + +skip +{ + idv="7459553847"; + doc="triangle 0,3. Special case of 4010906068"; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#2.52,y4,#2.52); + (#3.01,y5,#3.01); + (#3.01,y6,#3.01) + ] +( + taum y1 y2 y3 y4 y5 y6 > tame_table_d 0 3 + &3 *(tame_table_d 2 1 - #0.11) + )`; +};; + +skip +{ + idv="4528012043"; + doc="triangle 0,3. Special case of 4010906068"; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.01); + (#3.01,y5,#3.01); + (#3.01,y6,#3.01) + ] +( + taum y1 y2 y3 y4 y5 y6 > tame_table_d 0 3 + &3 *(tame_table_d 2 1 - #0.11) + )`; +};; + +skip +{ + idv="5026777310"; + doc="pentagon case, clipped A-piece triangle. + prove constraint on edge lengths. + ??Corollary of 5766053833. + Deprecated 2013-4-20. Replaced with 5026777310a"; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.01); + (#3.01,y5,#3.01); + (&2,y6,#2.52) + ] +( + ( taum y1 y2 y3 y4 y5 y6 > tame_table_d 4 1 - &2 * #0.11) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +skip +{ + idv="6029974545"; + doc="triangle 1,2 ad hoc case. + If the y4 edge is extremal at 2.52, we get at least tame_table_d[0,3] > 0.477-0.11. + So that case folds into the [0,3] case. + This is a special case of 5405130650."; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#2.52,y5,sqrt8); + (sqrt8,y6,#3.01) + ] +( + taum y1 y2 y3 y4 y5 y6 + #0.1 * (#3.01 - y6) > #0.477 - #0.11 + )`; +};; + +skip +{ + idv="5766053833"; + doc="triangle 1,2, ad hoc 0.696 case. (J case). Removed 2013-06-03. "; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (sqrt8,y5,#3.01); + (sqrt8,y6,#3.01) + ] +( + taum y1 y2 y3 y4 y5 y6 + #0.1 * (#3.01 - y5) + #0.1 * (#3.01 - y6) > + #0.696 - &2 * #0.11 + )`; +};; diff --git a/legacy/oldnonlinear/mdtau.hl b/legacy/oldnonlinear/mdtau.hl new file mode 100644 index 0000000..d7d9bd8 --- /dev/null +++ b/legacy/oldnonlinear/mdtau.hl @@ -0,0 +1,237 @@ +(* ========================================================================== *) +(* FLYSPECK - CODE INFORMAL *) +(* *) +(* Chapter: Nonlinear *) +(* Author: Thomas C. Hales *) +(* Date: 2012-04-15 *) +(* ========================================================================== *) + + +(* +Define the functions mdtau and mdtau2. + +In basic terms, +mdtau = Sqrt[delta] * D[taumar,y1] +However, we need to rework the formula in such a way that it extends to delta=0. + +mdtau2 = D[taumar,{y1,2}]. + +mdtau2uf = mdtau2 * uf, where uf is the positive factor defined below. + +In /interval_code, taylorInterval.cc, wide.cc, there is a version mdtau_y_LC, mdtau2_y_LC +The "LC" signifies "locally constant", meaning no derivatives are to be used in interval computations. + + ("mdtau_y_LC","Lib::mdtau_y_LC"); + ("mdtau2uf_y_LC","Lib::mdtau2uf_y_LC"); + ("mdtau_y","Lib::mdtau_y_LC"); + ("mdtau2uf_y","Lib::mdtau2uf_y_LC"); + +*) + +module Mdtau = struct + +let dua = new_definition `dua a b c = &2 * (b + c - a)`;; + +(* corrected June 25, 2012, I had left out the sqrt! *) + +let safesqrt = new_definition `safesqrt x = if (x >= &0) then sqrt x else (&0)`;; + +let mdtau_y = new_definition `mdtau_y y1 y2 y3 y4 y5 y6 = + let x1 = y1 * y1 in + let x2 = y2 * y2 in + let x3 = y3 * y3 in + let x4 = y4 * y4 in + let x5 = y5 * y5 in + let x6 = y6 * y6 in + let chain0 = &2 * y1 in + let Pchain = &2 in + let chain2 = &4 * x1 in + let u135 = ups_x x1 x3 x5 in + let u126 = ups_x x1 x2 x6 in + let u234 = ups_x x2 x3 x4 in + let uf = &4 * u135 * u126 * u234 * y1 * y2 * y3 in + let du135 = dua x1 x3 x5 in + let du126 = dua x1 x2 x6 in + let Luf = (du135 / u135 + du126/u126 ) * chain0 + &1 / y1 in + let n4 = x2*x3 + x1*x4 - x2*x5 - x3*x6 + x5*x6 - + x1*(-- x1 + x2 + x3 - x4 + x5 + x6) in + let del4 = -- n4 in + let n5 = x1*x3 - x1*x4 + x2*x5 - x3*x6 + x4*x6 - + x2*(x1 - x2 + x3 + x4 - x5 + x6) in // - del5 + let n6 = x1*x2 - x1*x4 - x2*x5 + x4*x5 - + x3*(x1 + x2 - x3 + x4 + x5 - x6) + x3*x6 in // - del6 + let Dn4 = &2* x1 - x2 - x3 + &2 *x4 - x5 - x6 in + let del = delta_x x1 x2 x3 x4 x5 x6 in + let del1 = -- (x1*x4) + x2*x5 - x3*x5 - x2*x6 + x3*x6 + + x4*(-- x1 + x2 + x3 - x4 + x5 + x6) in + let del2 = x1*x4 - x3*x4 - x2*x5 - x1*x6 + + x3*x6 + x5*(x1 - x2 + x3 + x4 - x5 + x6) in + let del3 = x1*x4 - x2*x4 - x1*x5 + x2*x5 - + x3*x6 + (x1 + x2 - x3 + x4 + x5 - x6)*x6 in + let Pdel = del1 * chain0 in + let Ldel = Pdel/del in + let sd4 = &4 *x1*del in + let sd5 = &4 *x2*del in + let sd6 = &4 *x3*del in + let Dsd4 = &4 *del + &4 *x1*del1 in + let m4diff = &2 *Dn4*sd4 - n4* Dsd4 in + let m4 = m4diff*chain0*u234*y2*y3 in + let m5 = -- &4 *x2*u234*del3* &2 *x1*u135*y3 in + let m6 = -- &4 *x3*u234*del2* &2 *x1*u126*y2 in + let const1 = (sol_y (&2) (&2) (&2) (&2) (&2) (&2)) /pi in + let rhoy1 = rho(y1) in + let rhoy2 = rho(y2) in + let rhoy3 = rho(y3) in + let Prhoy1 = const1 /(#0.52) in + let rr = rhoy1 * m4 + rhoy2 * m5 + rhoy3 * m6 in + let term1 = Prhoy1 * pi * safesqrt(del) in + let t = sqrt(&4 * x1)/del4 in + let t2 = t*t in + let term2a = del * t * matan(t2 *del) in + let term2 = term2a * Prhoy1 in + let term3 = rr/uf in + term1+term2+term3`;; + +(* +let mdtau2_y = new_definition `mdtau2_y y1 y2 y3 y4 y5 y6 = + let x1 = y1 * y1 in + let x2 = y2 * y2 in + let x3 = y3 * y3 in + let x4 = y4 * y4 in + let x5 = y5 * y5 in + let x6 = y6 * y6 in + let chain0 = &2 * y1 in + let Pchain = &2 in + let chain2 = &4 * x1 in + let u135 = ups_x x1 x3 x5 in + let u126 = ups_x x1 x2 x6 in + let u234 = ups_x x2 x3 x4 in + let uf = &4 * u135 * u126 * u234 * y1 * y2 * y3 in + let du135 = dua x1 x3 x5 in + let du126 = dua x1 x2 x6 in + let Luf = (du135 / u135 + du126/u126 ) * chain0 + &1 / y1 in + let n4 = x2*x3 + x1*x4 - x2*x5 - x3*x6 + x5*x6 - + x1*(-- x1 + x2 + x3 - x4 + x5 + x6) in + let del4 = -- n4 in + let n5 = x1*x3 - x1*x4 + x2*x5 - x3*x6 + x4*x6 - + x2*(x1 - x2 + x3 + x4 - x5 + x6) in // - del5 + let n6 = x1*x2 - x1*x4 - x2*x5 + x4*x5 - + x3*(x1 + x2 - x3 + x4 + x5 - x6) + x3*x6 in // - del6 + let Dn4 = &2* x1 - x2 - x3 + &2 *x4 - x5 - x6 in + let del = delta_x x1 x2 x3 x4 x5 x6 in + let del1 = -- (x1*x4) + x2*x5 - x3*x5 - x2*x6 + x3*x6 + + x4*(-- x1 + x2 + x3 - x4 + x5 + x6) in + let del2 = x1*x4 - x3*x4 - x2*x5 - x1*x6 + + x3*x6 + x5*(x1 - x2 + x3 + x4 - x5 + x6) in + let del3 = x1*x4 - x2*x4 - x1*x5 + x2*x5 - + x3*x6 + (x1 + x2 - x3 + x4 + x5 - x6)*x6 in + let Pdel = del1 * chain0 in + let Ldel = Pdel/del in + let sd4 = &4 *x1*del in + let sd5 = &4 *x2*del in + let sd6 = &4 *x3*del in + let Dsd4 = &4 *del + &4 *x1*del1 in + let m4diff = &2 *Dn4*sd4 - n4* Dsd4 in + let m4 = m4diff*chain0*u234*y2*y3 in + let m5 = -- &4 *x2*u234*del3* &2 *x1*u135*y3 in + let m6 = -- &4 *x3*u234*del2* &2 *x1*u126*y2 in + let const1 = (sol_y (&2) (&2) (&2) (&2) (&2) (&2)) /pi in + let rhoy1 = rho(y1) in + let rhoy2 = rho(y2) in + let rhoy3 = rho(y3) in + let Prhoy1 = const1 /(#0.52) in + let rr = rhoy1 * m4 + rhoy2 * m5 + rhoy3 * m6 in + let D2n4 = &2 in + let D2sd4 = -- &8*x1*x4 + &8*(--(x1*x4) + x2*x5 - x3*x5 - x2*x6 + x3*x6 + + x4*(-- x1 + x2 + x3 - x4 + x5 + x6)) in + let Dm4diff = &2 * D2n4 * sd4 + Dn4 * Dsd4 - n4 *D2sd4 in + let Pm4 = (Dm4diff * chain2 + m4diff * Pchain ) * u234 * y2 * y3 in + let Ddel3 = x4 - x5 + x6 in + let Ddel2 = x4 + x5 - x6 in + let Pm5 = (Ddel3 * x1 * u135 + del3 * &1 * u135 + del3 * x1 * du135) * + chain0 * (-- &4 * x2 * u234 * &2 * y3) in + let Pm6 = (Ddel2 * x1 * u126 + del2 * &1 * u126 + del2 * x1 * du126) * + chain0 * (-- &4 * x3 * u234 * &2 * y2) in + let PrrC = &2 * Prhoy1 * m4 + rhoy1 * Pm4 + rhoy2 * Pm5 + rhoy3 * Pm6 in + let P2tauNum = (PrrC) + (-- Luf - #0.5 * Ldel) * rr in + let P2tau = P2tauNum/ (uf * safesqrt(del)) in + P2tau`;; +*) + + +(* +mdtau2uf = mdtau2 * uf, where uf = &4 * u135 * u126 * u234 * y1 * y2 * y3 +*) + +let mdtau2uf_y = new_definition `mdtau2uf_y y1 y2 y3 y4 y5 y6 = + let x1 = y1 * y1 in + let x2 = y2 * y2 in + let x3 = y3 * y3 in + let x4 = y4 * y4 in + let x5 = y5 * y5 in + let x6 = y6 * y6 in + let chain0 = &2 * y1 in + let Pchain = &2 in + let chain2 = &4 * x1 in + let u135 = ups_x x1 x3 x5 in + let u126 = ups_x x1 x2 x6 in + let u234 = ups_x x2 x3 x4 in + let uf = &4 * u135 * u126 * u234 * y1 * y2 * y3 in + let du135 = dua x1 x3 x5 in + let du126 = dua x1 x2 x6 in + let Luf = (du135 / u135 + du126/u126 ) * chain0 + &1 / y1 in + let n4 = x2*x3 + x1*x4 - x2*x5 - x3*x6 + x5*x6 - + x1*(-- x1 + x2 + x3 - x4 + x5 + x6) in + let del4 = -- n4 in + let n5 = x1*x3 - x1*x4 + x2*x5 - x3*x6 + x4*x6 - + x2*(x1 - x2 + x3 + x4 - x5 + x6) in // - del5 + let n6 = x1*x2 - x1*x4 - x2*x5 + x4*x5 - + x3*(x1 + x2 - x3 + x4 + x5 - x6) + x3*x6 in // - del6 + let Dn4 = &2* x1 - x2 - x3 + &2 *x4 - x5 - x6 in + let del = delta_x x1 x2 x3 x4 x5 x6 in + let del1 = -- (x1*x4) + x2*x5 - x3*x5 - x2*x6 + x3*x6 + + x4*(-- x1 + x2 + x3 - x4 + x5 + x6) in + let del2 = x1*x4 - x3*x4 - x2*x5 - x1*x6 + + x3*x6 + x5*(x1 - x2 + x3 + x4 - x5 + x6) in + let del3 = x1*x4 - x2*x4 - x1*x5 + x2*x5 - + x3*x6 + (x1 + x2 - x3 + x4 + x5 - x6)*x6 in + let Pdel = del1 * chain0 in + let Ldel = Pdel/del in + let sd4 = &4 *x1*del in + let sd5 = &4 *x2*del in + let sd6 = &4 *x3*del in + let Dsd4 = &4 *del + &4 *x1*del1 in + let m4diff = &2 *Dn4*sd4 - n4* Dsd4 in + let m4 = m4diff*chain0*u234*y2*y3 in + let m5 = -- &4 *x2*u234*del3* &2 *x1*u135*y3 in + let m6 = -- &4 *x3*u234*del2* &2 *x1*u126*y2 in + let const1 = (sol_y (&2) (&2) (&2) (&2) (&2) (&2)) /pi in + let rhoy1 = rho(y1) in + let rhoy2 = rho(y2) in + let rhoy3 = rho(y3) in + let Prhoy1 = const1 /(#0.52) in + let rr = rhoy1 * m4 + rhoy2 * m5 + rhoy3 * m6 in + let D2n4 = &2 in + let D2sd4 = -- &8*x1*x4 + &8*(--(x1*x4) + x2*x5 - x3*x5 - x2*x6 + x3*x6 + + x4*(-- x1 + x2 + x3 - x4 + x5 + x6)) in + let Dm4diff = &2 * D2n4 * sd4 + Dn4 * Dsd4 - n4 *D2sd4 in + let Pm4 = (Dm4diff * chain2 + m4diff * Pchain ) * u234 * y2 * y3 in + let Ddel3 = x4 - x5 + x6 in + let Ddel2 = x4 + x5 - x6 in + let Pm5 = (Ddel3 * x1 * u135 + del3 * &1 * u135 + del3 * x1 * du135) * + chain0 * (-- &4 * x2 * u234 * &2 * y3) in + let Pm6 = (Ddel2 * x1 * u126 + del2 * &1 * u126 + del2 * x1 * du126) * + chain0 * (-- &4 * x3 * u234 * &2 * y2) in + let PrrC = &2 * Prhoy1 * m4 + rhoy1 * Pm4 + rhoy2 * Pm5 + rhoy3 * Pm6 in + let P2tauNum = (PrrC) + (-- Luf - #0.5 * Ldel) * rr in + let P2tau_uf = P2tauNum/ (safesqrt(del)) in + P2tau_uf`;; + + + let mdtau_y_LC = new_definition `mdtau_y_LC = mdtau_y`;; + +(* let mdtau2_y_LC = new_definition `mdtau2_y_LC = mdtau2_y`;; *) + + let mdtau2uf_y_LC = new_definition `mdtau2uf_y_LC = mdtau2uf_y`;; + + end;; diff --git a/legacy/oldnonlinear/nonlinear/break_quad_jul2013.hl b/legacy/oldnonlinear/nonlinear/break_quad_jul2013.hl new file mode 100644 index 0000000..85a7838 --- /dev/null +++ b/legacy/oldnonlinear/nonlinear/break_quad_jul2013.hl @@ -0,0 +1,471 @@ +(* ************************************************************************** *) +(* July 2013. + T. Hales + Notes on breaking up the quadrilateral inequalities in ineq.hl into pieces of at most + 6 variables. +*) +(* ************************************************************************** *) + + +(* ************************************************************************** *) +(* INEQ "3862621143 revised" *) +(* ************************************************************************** *) + +(* +This inequality is not quite in final form. The inequalities are still too slow. +*) + +(* If dih < 2.15 then Main-inequality d(4) implies the result. WLOG dih > 2.15. *) + +(* +One way to break up quad 386..revised appears in the following inequalities. +Another approach: +Change num1 lower bound from 2.38 to 2.9/h0. Then both back edges can +be deformed to 2. Even the front edges can be deformed to 2, by obtuseness of front angle +and the sign of dih in the inequality. So all top edges=2. +This is contrary to the diagonal constraints in 386...revised. +*) + +run + { + idv="test dih"; + doc = "The denominator should be cleared, upper bound increased to &4*h0, delta_y bound made 0"; + tags=[]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2,y4,&2 * h0); + (#3.9,y5,#4.2); + (&2,y6,&2 * h0)] + ( + dih_y y1 y2 y3 y4 y5 y6 < #2.15 / &2 \/ + delta_y y1 y2 y3 y4 y5 y6 < #0.1)`; + };; + +run +{ + idv="test dih 2"; + doc=" + (EAR) A bound on the dih of an ear in a quad, + The disjunct (dih_y y1 y2 y3 y4 y5 y6 < #2.15 / &2 has been 'linearized'. + Tan[2.15 / 2]^2 = (>=) 3.418 + In more detail, this calc shows that delta > 0 or dih < 2.15 / 2 + "; + tags=[Xconvert;]; + ineq = Sphere.all_forall `ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2,y4,&2 * h0); + (#3.9,y5,&4 * h0); + (&2,y6,&2 * h0)] +(let tan2lower = #3.418 in + ((&4 * x1_delta_y y1 y2 y3 y4 y5 y6 < tan2lower * delta4_squared_y y1 y2 y3 y4 y5 y6) \/ + delta_y y1 y2 y3 y4 y5 y6 < &0))`; +};; + + +(* an ineq in main_estimate_ineq.hl, gives that both sides are acute. when cross_diag > 3.01 *) + +run2 + { + idv="test side azim 3862621143"; + doc = "This allows us to restrict the domain on both sides to delta > 16. + Tan[2.15 - Pi/2]^2 >= 0.4277. + Too slow!! (992 secs). + "; + tags=[Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2 ,y4, &2 * h0); + (#3.01,y5,#3.9); + (&2,y6,&2 * h0)] +(let tan2lower = #0.4277 in + ( + &4 * x1_delta_y y1 y2 y3 y4 y5 y6 < tan2lower * delta4_squared_y y1 y2 y3 y4 y5 y6) \/ + // dih_y y1 y2 y3 y4 y5 y6 < #2.15 - pi / &2 \/ + delta_y y1 y2 y3 y4 y5 y6 < &0 \/ + delta_y y1 y2 y3 y4 y5 y6 > &16)`; + };; + +run2 + { + idv="test side' 3862621143"; + doc = ""; + tags=[Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2 ,y4, &2 * h0); + (#3.01,y5,#3.9); + (&2,y6,&2 * h0)] + (taum y1 y2 y3 y4 y5 y6 > #0.453 * dih_y y1 y2 y3 y4 y5 y6 - #0.77 / &2 \/ + delta_y y1 y2 y3 y4 y5 y6 < &16 \/ dih_y y1 y2 y3 y4 y5 y6 < #2.15 - pi / &2 +)`; + };; + + +(* ************************************************************************** *) +(* INEQ "4240815464 a" *) +(* ************************************************************************** *) + + +skip + { + idv="5365514595"; (* test full 4240815464 *) + doc = " + The following inequalities make 4240815464 into a derived inequality. + If dih > 1.621, then the main_estimate d(4) inequality implies this, so wlog dih < 1.621. + We may take y4 <= 3.36, for otherwise dih > 1.621. + When 3.01 <= y4 <= 3.36, dih < 1.621 ==> Delta(back) > 98 ==> taum(back) > 0. + We replace the back taum with 0, and run the 6D ineq on the front simplex. + - + When 2.62 <= y4 <= 3.01, use taum(back) >= 1.03. to remove the back simplex. Run on the front. + - + When 2.52 <= y4 <= 3.01, use a custom linear lower bound on tam(back) to remove the back simplex. + - + passes when we zero out back term. "; + tags=[]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (#3.01 ,y4, #3.36); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0); + (&2,y7,&2 * h0); + (&2,y8,&2 * h0); + (&2,y9,&2 * h0) +] + ( + taum y1 y2 y3 y4 y5 y6 + taum y7 y2 y3 y4 y8 y9 + + #0.7573 * dih_y y1 y2 y3 y4 y5 y6 - #1.433 > &0 \/ + dih_y y1 y2 y3 y4 y5 y6 > #1.621)`; + };; + +add + { + idv="3397113841"; (* test dih (delta4) 4240815464 *) + doc = "Justifies linearized dih when y4 >= 3.36"; + tags=[Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (#3.36 ,y4, #3.36); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0)] + ( + delta4_y y1 y2 y3 y4 y5 y6 < &0)`; + };; + +add + { + idv="6078657299"; (* test dih 4240815464 *) + doc = "Monotonic in y4. + y4 > 3.36 ==> dih > 1.621. + Tan[Pi - 1.621]^2 >= 396.1. + "; + tags=[Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (#3.36 ,y4, #3.36); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0)] + (let tan2lower = #396.1 in + ((&4 * x1_delta_y y1 y2 y3 y4 y5 y6 < tan2lower * delta4_squared_y y1 y2 y3 y4 y5 y6) \/ +// dih_y y1 y2 y3 y4 y5 y6 > #1.621 \/ + delta_y y1 y2 y3 y4 y5 y6 < &0))`; + };; + +add + { + idv="8384429938"; (* test delta98 lindih 4240815464 *) + doc = "Justifies linearlized dih on [3.01,3.36] s.t. delta<98."; + tags=[Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (#3.01 ,y4, #3.36); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) +// (&2,y7,&2 * h0) +] + ( +// delta_y (&2 * h0) y2 y3 y4 (&2) (&2) > &98 \/ + y_of_x (delta_234_x ((&2 * h0) pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &98 \/ + delta4_y y1 y2 y3 y4 y5 y6 < &0 +)`; + };; + +add + { + idv="9893763499"; (* test delta98 4240815464 *) + doc = "Use monotonicity of Delta to reduce to y7=2.52, y8=2, y9=2. Shows dih>1.621 ==> delta>98"; + tags=[Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (#3.01 ,y4, #3.36); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) +// (&2,y7,&2 * h0) +] + (let tan2lower = #396.1 in + ((&4 * x1_delta_y y1 y2 y3 y4 y5 y6 < tan2lower * delta4_squared_y y1 y2 y3 y4 y5 y6) \/ +// dih_y y1 y2 y3 y4 y5 y6 > #1.621 \/ +// delta_y (&2 * h0) y2 y3 y4 (&2) (&2) > &98 \/ + y_of_x (delta_234_x ((&2 * h0) pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &98 +))`; + };; + +add + { + idv="5429228381"; (* test back98 4240815464 *) + doc = "taum lower bound on back simplex when y4 in [3.01,3.36]"; + tags=[Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (#3.01 ,y4, #3.36); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) +] + ( + taum y1 y2 y3 y4 y5 y6 > -- #0.07 \/ + delta_y y1 y2 y3 y4 y5 y6 < &98)`; + };; + +add + { + idv="3508342905"; (* test front98 4240815464 *) + doc = "lower bound on front simplex when y4 in [3.01,3.36]"; + tags=[Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (#3.01 ,y4, #3.36); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) +] + ( + taum y1 y2 y3 y4 y5 y6 - #0.07 + + #0.7573 * dih_y y1 y2 y3 y4 y5 y6 - #1.433 > &0 \/ + dih_y y1 y2 y3 y4 y5 y6 > #1.621 \/ + delta_y y1 y2 y3 y4 y5 y6 < &98)`; + };; + +add + { + idv="2862885615"; (* test front103 4240815464 *) + doc = "lower bound on front simplex when y4 [2.62,3.01]"; + tags=[Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (#2.62 ,y4, #3.01); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) +] + ( + taum y1 y2 y3 y4 y5 y6 + #0.103 + + #0.7573 * dih_y y1 y2 y3 y4 y5 y6 - #1.433 > &0 \/ + dih_y y1 y2 y3 y4 y5 y6 > #1.621)`; + };; + +add + { + idv="1611600345"; (* test back 4240815464 *) + doc = "lower bound on back simplex when y4 in [2.52,2.62]"; + tags=[Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (#2.52 ,y4, #2.62); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) +] + ( + taum y1 y2 y3 y4 y5 y6 > #0.095 + #0.14 * (y2 + y3 - &4) )`; + };; + +add + { + idv="2608321088"; (* test front 4240815464 *) + doc = ""; + tags=[Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (#2.52 ,y4, #2.62); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) +] + ( + taum y1 y2 y3 y4 y5 y6 + #0.095 + #0.14 * (y2 + y3 - y4) + + #0.7573 * dih_y y1 y2 y3 y4 y5 y6 - #1.433 > &0 \/ + dih_y y1 y2 y3 y4 y5 y6 > #1.621)`; + };; + + +(* ************************************************************************** *) +(* DEPRECATED INEQ 704377224150 *) +(* ************************************************************************** *) + +skip + { + idv="test azim 70437224150"; + doc = ""; + tags=[]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (#2.65,y4,sqrt8); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0)] + (dih_y y1 y2 y3 y4 y5 y6 > #1.215)`; + };; + +skip + { + idv="old test front 70437224150"; + doc = ""; + tags=[]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2 * h0,y4,#2.77); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0)] + (taum y1 y2 y3 y4 y5 y6 + #0.0842 + #0.16 * (y2 + y3 - &4) + -- #0.018 * (y4 - &2 * h0) + #4.72 * dih_y y1 y2 y3 y4 y5 y6 > #6.235)`; + };; + +skip + { + idv="old test back 70437224150"; + doc = ""; + tags=[]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2 * h0,y4,#2.84); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0)] + (taum y1 y2 y3 y4 y5 y6 > #0.0842 + #0.16 * (y2 + y3 - &4) - #0.018 * (y4 - &2 * h0))`; + };; + +skip + { + idv="test front 70437224150"; + doc = ""; + tags=[]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2 * h0,y4,#2.65); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0)] + (taum y1 y2 y3 y4 y5 y6 + #0.0842 + #0.17 * (y2 + y3 - &4) + -- #0.01 * (y4 - &2 * h0) + #4.72 * dih_y y1 y2 y3 y4 y5 y6 > #6.248)`; + };; + +skip + { + idv="test back 70437224150"; + doc = ""; + tags=[]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2 * h0,y4,#2.65); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0)] + (taum y1 y2 y3 y4 y5 y6 > #0.0842 + #0.17 * (y2 + y3 - &4) - #0.01 * (y4 - &2 * h0))`; + };; + +skip + { + idv="test"; + doc = ""; + tags=[]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (#3.23,y4,#3.4); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0)] + (dih_y y1 y2 y3 y4 y5 y6 > #1.544)`; + };; + +skip + { + idv="test front"; + doc = ""; + tags=[]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2 * h0,y4,#2.84); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0)] + (taum y1 y2 y3 y4 y5 y6 + #0.0842 + #0.16 * (y2 + y3 - &4) + -- #0.018 * (y4 - &2 * h0) + #0.972 * dih_y y1 y2 y3 y4 y5 y6 > #1.707)`; + };; + +skip + { +idv="test"; +doc = "If minor diag >= 3, then 3/1.26 > 2.38 and we can contract. + 15.53: arc[2,2,2.52]2 < arc[2,2,Sqrt[15.53]]. + Added May 12, 2011. + c2 upper bound changed from 15.53 to 16.0 on May 23."; +tags=[]; +ineq = Sphere.all_forall `ineq + [ + (&1 , e1, &1 + sol0/ pi); + (&1 , e2, &1 + sol0/ pi); + (&1 , e3, &1 + sol0/ pi); + ((&2 / h0) pow 2, a2, (&2 * h0) pow 2); + ((&2/ h0) pow 2, b2, #3.01 pow 2); + ((#2.9 / h0) pow 2, c2,#16.0) + ] + ((num1 e1 e2 e3 a2 b2 c2 ) > &0) `; +};; diff --git a/legacy/oldnonlinear/nonlinear/experiments/oracle.hl b/legacy/oldnonlinear/nonlinear/experiments/oracle.hl new file mode 100644 index 0000000..ef347ad --- /dev/null +++ b/legacy/oldnonlinear/nonlinear/experiments/oracle.hl @@ -0,0 +1,134 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: nonlinear inequalities *) +(* Author: Roland Zumkeller *) +(* Date: 2010 *) +(* ========================================================================== *) + + +(* +ssh -t wh opt/bin/dmtcp/dmtcp_restart flyspeck.dmtcp +rsync -ahv ~/doc/flyspeck/ wh:ext/flyspeck/ --exclude .svn +*) + +module Oracle = struct + +#load "unix.cma";; (* on Mac OS unix.cma needs to be pre-cooked into the toplevel with ocamlmktop *) + +let sergei_path = "sergei/bin/sergei";; + +let dest_decimal x = match strip_comb x with + | (dec,[a;b]) -> div_num (dest_numeral a) (dest_numeral b) + | (sqrt8,[]) when sqrt8 = `sqrt8` -> div_num (Int 3880899) (Int 1372105) + | _ -> failwith ("dest_decimal: '" ^ string_of_term x ^ "'") ;; + +let string_of_num' x = string_of_float (float_of_num x);; (* rounding :( *) + +let rec sergei_of_ccl t = + let soh = sergei_of_ccl in + if is_var t then fst (dest_var t) else + let (f,xs) = strip_comb t in + let ifix i = let [a;b] = xs in "(" ^ soh a ^ " " ^ i ^ " " ^ soh b ^ ")" in + let ifix_swapped i = let [b;a] = xs in "(" ^ soh a ^ " " ^ i ^ " " ^ soh b ^ ")" in + (if not (is_const f) then failwith ("Oracle error: " ^ string_of_term f)); + match fst (dest_const f) with + | "real_gt" | "real_ge" | "real_sub" -> ifix "-" + | "real_lt" | "real_le" -> ifix_swapped "-" + | "real_add" -> ifix "+" + | "real_mul" -> ifix "*" + | "real_div" -> ifix "/" + | "real_pow" -> ifix "^" + | "\\/" -> ifix "\\/" + | "atn" -> let [a] = xs in "Atan [" ^ soh a ^ "]" + | "sqrt" -> let [a] = xs in "Sqrt [" ^ soh a ^ "]" + | "real_neg" -> let [a] = xs in "(-" ^ soh a ^ ")" + | "pi" -> let [] = xs in "Pi" + | "real_of_num" -> let [a] = xs in string_of_num' (dest_numeral a) (* is this line redundant ? *) + | "NUMERAL" -> let [a] = xs in string_of_num' (dest_numeral t) + | "DECIMAL" -> string_of_num' (dest_decimal t) + | "atn2" -> let [ab] = xs in let (a,b) = dest_pair ab in "(" ^ soh a ^ " ATN2 " ^ soh b ^ ")" + | s -> failwith ("Encountered unknown constant '" ^ s ^ "'");; + +let sergei_of_goal (asms,ccl) = + print_endline "Converting HOL term to sergei format..."; + let vars = map (fun (_,axb) -> + let (ax,xb) = dest_conj (concl axb) in + let (a,x) = dest_binary "real_le" ax in + let (x',b) = dest_binary "real_le" xb in + if x <> x' then + failwith ("Malformed assumption: " ^ string_of_term x' ^ + " should be " ^ string_of_term x ^ ".") + else + string_of_num' (dest_decimal a) ^ " <= " ^ + string_of_term x ^ " <= " ^ + string_of_num' (dest_decimal b) ^ " ->\n") asms + in List.fold_right (^) vars "" ^ " " ^ sergei_of_ccl ccl;; + +let SERGEI_TAC : tactic = fun (asms,ccl) -> + print_endline ("Running sergei [" ^ sergei_path ^ "]:"); + let (pin,pout) = Unix.open_process ("time " ^ sergei_path ^ " -nv -e0.00001") in + Pervasives.output_string pout (sergei_of_goal (asms,ccl)); + close_out pout; + (try while true do + print_endline ("sergei> " ^ input_line pin); + flush stdout + done with End_of_file -> ()); + close_in pin; NO_TAC (asms,ccl);; + +let SERGEI_DUMP : tactic = fun gl -> + print_endline (sergei_of_goal gl); NO_TAC gl;; + +let rec SINGLE_CONV c = c + ORELSEC (fun t -> if is_comb t then + ((RATOR_CONV (SINGLE_CONV c)) ORELSEC (RAND_CONV (SINGLE_CONV c))) t + else failwith "SINGLE_CONV");; + +let SINGLE_REWR_TAC e = CONV_TAC (CHANGED_CONV (SINGLE_CONV (REWR_CONV e)));; + +let ineq' = define + `(! c. ineq' [] c <=> c) +/\ (!a x b xs c. ineq' (CONS (a,x,b) xs) c <=> a <= x /\ x <= b ==> ineq' xs c)`;; + +(* + valid: (except for x=0, y<=0) + useful: y >= 0 (1st & 2nd quadrant) +*) +let ATN2_ATN = prove (`atn2(x,y) = &2 * atn(y / (sqrt (x*x + y*y) + x))`, CHEAT_TAC);; + +let ATN2_90 = prove (`atn2(x,y) = atn2(--y,x) - pi/(&2)`, CHEAT_TAC);; + +let ATN2_30 = prove (`atn2(x,y) = atn2(sqrt (&3) * x - y, x + sqrt (&3) * y) - pi/(&6)`, CHEAT_TAC);; + +let ATN2_60 = prove (`atn2(x,y) = atn2(x - sqrt (&3) * y, sqrt (&3) * x + y) - pi/(&3)`, CHEAT_TAC);; + +let ATN2_45 = prove (`atn2(x,y) = atn2(x-y,x+y) - pi/(&4)`, CHEAT_TAC);; + +(* rotates atan by atan(t): +valid if we don't cross the discontinuous line *) +let ATN2_ROT_TAN = prove (`atn2 (x,y) = atn2 (x - y*t, y + x*t) - atn t`, CHEAT_TAC);; + +(* + valid : x >= 0 (1st & 4th quadrant) + useful: x >= 0 and y fixed (1st & 4th quadrant) +*) +let ATN2_ATN_XPOS = prove (`atn2(x,y) = atn(y/x)`, CHEAT_TAC);; + +(* rotate such that sign y becomes constant, then use ATN2_ATN. if we + manage to make both sign x and sign y positive, then ATN2_ATN_POS is + valid and useful (smaller formula) *) + +let delta = [ Sphere.taum; Sphere.sol_y; Sphere.const1; Sphere.lnazim; + Sphere.delta_x; Sphere.delta_x4; Sphere.ly; Sphere.interp; Sphere.rhazim; Sphere.tauq; + Pack_defs.lmfun (*COND*); Sphere.rho; Sphere.arclength; Sphere.ups_x; Sphere.dih_x; Sphere.dih_y; +Enclosed.enclosed; +Quadratic_root_plus.quadratic_root_plus; +Abc_of_quadratic.abc_of_quadratic; +Mur.muR; Cayleyr.cayleyR ];; + +let PREP = + ((REPEAT GEN_TAC) THEN (REWRITE_TAC [prove (`ineq = ineq'`, CHEAT_TAC)]) THEN (REWRITE_TAC [ineq'])) THEN + ((REWRITE_TAC delta) THEN (CONV_TAC (TOP_DEPTH_CONV let_CONV)) THEN (REPEAT DISCH_TAC));; + + +end;; diff --git a/legacy/oldnonlinear/nonlinear/experiments/test.hl b/legacy/oldnonlinear/nonlinear/experiments/test.hl new file mode 100644 index 0000000..5984a5f --- /dev/null +++ b/legacy/oldnonlinear/nonlinear/experiments/test.hl @@ -0,0 +1,3643 @@ + + + + + +(* PRE MAY 2012 STARTS HERE *) + +CE to hexall 5A1: + +{4.0367249999999996746,4.0367249999999996746,4.0367249999999996746,5.9464250000000058449,6.3876093749999940385,1.000000000000000222} {4.0367249999999996746,4.0367249999999996746,4.0367249999999996746,5.9464250000000058449,6.3876093749999940385,1.000000000000000222} isolated point +function 0 value=[2.2566633457319120737,2.2566633457353155734] +T0 partial 0: [21.159337943191999898,21.159337943193165188] +T0 partial 1: [68.637638901404642411,68.63763890140612034] +T0 partial 2: [8.103456502905828529,8.103456502906908554] +T0 partial 3: [-65.817170105080634812,-65.817170105079782161] +T0 partial 4: [52.739287222031975944,52.739287222032274371] +T0 partial 5: [-0,0] +counterexample found +FAIL + + +let all_forall = Sphere.all_forall;; +Parse_ineq.execute_cfsqp;; +(* still need pent cases with 2 flats *) + + + + + + + +Parse_ineq.execute_cfsqp +{ +idv = "test 298"; +doc = "298 supplement for pent_acute case. No use."; +tags= [Tex;Cfsqp;Xconvert;Penalty(1000.0,10000.0);Flypaper]; +ineq = all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2 * h0 ,y4,&4*h0); + (sqrt(&10),y5,#3.915); + (&2,y6,&2 * h0) + ] ( + ( dih3_y y1 y2 y3 y4 y5 y6 < dih_y y3 (#2.52) (&2) (#2.52) (#2.52) (&2) \/ delta4_y y1 y2 y3 y4 y5 y6 < &0 + ))`; +};; + +Parse_ineq.execute_cfsqp +{ +idv = "test 298"; +doc = "298 supplement for pent_acute case. No use."; +tags= [Tex;Cfsqp;Xconvert;Penalty(1000.0,10000.0);Flypaper]; +ineq = all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (#3.0 ,y4,&4*h0); + (sqrt(&10),y5,#3.915); + (&2,y6,&2 * h0) + ] ( + ( dih2_y y1 y2 y3 y4 y5 y6 < &0 \/ dih_y y1 y2 y3 y4 y5 y6 < #1.15 \/ delta4_y y1 y2 y3 y4 y5 y6 < &0 + ))`; +};; + + +Parse_ineq.execute_cfsqp +{ +idv = "test pent"; +doc = "298 supplement for pent case"; +tags= [Tex;Cfsqp;Xconvert;Penalty(1000.0,10000.0);Flypaper]; +ineq = all_forall `ineq + [ + (&2,y1,&2); + (&2,y2,&2); + (&2,y3,&2); + (&2*h0 ,y4,&4); + (&2,y5,#3.915); + (&2,y6,&2 * h0) + ] ( + ( y4 < #3.416 \/ delta4_y y1 y2 y3 y4 y5 y6 < &0 ) + )`; +};; + + +Parse_ineq.execute_cfsqp +{ +idv = "test pent"; +doc = "298 supplement for pent case"; +tags= [Tex;Cfsqp;Xconvert;Penalty(1000.0,10000.0);Flypaper]; +ineq = all_forall `ineq + [ + (&2,y1,&2); + (&2,y2,&2); + (&2,y3,&2); + (&2*h0 ,y4,&4); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) + ] ( + ( sol_y y1 y2 y3 y4 y5 y6 > #0.46 \/ dih_y y1 y2 y3 y4 y5 y6 > #2.614 ) + )`; +};; + + + +Parse_ineq.execute_cfsqp +{ +idv = "test pent"; +doc = "298 supplement for pent case"; +tags= [Tex;Cfsqp;Xconvert;Penalty(1000.0,10000.0);Flypaper]; +ineq = all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2*h0 ,y4,&4 * h0); + (&2,y5,#3.915); + (&2,y6,&2 * h0); + (&2,y6,& + ] ( + ( taum y1 y2 y3 y4 y5 y6 > &0 \/ delta4_y y1 y2 y3 y4 y5 y6 < &0 ) + )`; +};; + + + + +Parse_ineq.execute_cfsqp +{ +idv = "test W"; +doc = ""; +tags= [Tex;Cfsqp;Xconvert;Penalty(1000.0,10000.0);Flypaper]; +ineq = all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2 ,y4,&2); + (#2.9,y5,#3.47); + (#2.9,y6,#3.93) + ] ( + (dih_y y1 y2 y3 y4 y5 y6 < #1.47) + )`; +};; + +Parse_ineq.execute_cfsqp +{ +idv = "test W2"; +doc = ""; +tags= [Tex;Cfsqp;Xconvert;Penalty(1000.0,10000.0);Flypaper]; +ineq = all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2 * h0,y4,&2 * h0); + (#2.9,y5,#3.47); + (#2.9,y6,#3.47) + ] ( + (dih_y y1 y2 y3 y4 y5 y6 < #1.64) + )`; +};; + +Parse_ineq.execute_cfsqp +{ +idv = "test W3 junk"; +doc = ""; +tags= [Tex;Cfsqp;Xconvert;Penalty(1000.0,10000.0);Flypaper]; +ineq = all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2 * h0,y4,&4 * h0); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) + ] ( + (arclength y2 y3 y4 > #2.42 - #0.88) \/ + (taum y1 y2 y3 y4 y5 y6 > #0.103) + )`; +};; + + + + + + + + +1;; + + + +1;; + +(* SECTION 1607135856 *) + +Parse_ineq.execute_cfsqp +{ +idv = "test 1607135856 F"; +doc = " +"; +tags= [Tex;Cfsqp;Xconvert;Penalty(100.0,10000.0);Flypaper]; +ineq = all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2 * h0,y4,&4 * h0); + (&2,y5,&2); + (&2 * h0,y6,&4 * h0) + ] ( + let costheta = -- #0.915903125 in + let cos1981 = -- #0.39879 in + let tan2lower = #0.15043 in + (delta_y y1 y2 y3 y4 y5 y6 > &14) \/ +(&4 * x1_delta_y y1 y2 y3 y4 y5 y6 < tan2lower * delta4_squared_y y1 y2 y3 y4 y5 y6) \/ + (delta4_y y1 y2 y3 y4 y5 y6 > &0) \/ + (y_of_x (law_cosines_126_x cos1981) y1 y2 y3 y4 y5 y6 > &0) \/ + (y_of_x (law_cosines_234_x costheta) y1 y2 y3 y4 y5 y6 < &0) + )`; +(* Cos[arc[2,2,3.915]] = -0.915903125 + segment with dih > pi/2. + (dih_y y1 y2 y3 y4 y5 y6 > pi - #0.37) \/, removed. + Tan[Pi-0.37]^2 approx 0.150438 + *) +};; + +skip +{ +idv = "test 1607135856 F"; +doc = " +"; +tags= [Tex;Cfsqp;Xconvert;Penalty(100.0,10000.0);Flypaper]; +ineq = all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2 * h0,y4,&4 * h0); + (&2,y5,&2); + (&2 * h0,y6,&4 * h0) + ] ( + let costheta = -- #0.915903125 in + let cos1981 = -- #0.39879 in + let tan2lower = #0.15043 in + (delta_y y1 y2 y3 y4 y5 y6 > &14) \/ +(&4 * x1_delta_y y1 y2 y3 y4 y5 y6 < tan2lower * delta4_squared_y y1 y2 y3 y4 y5 y6) \/ + (delta4_y y1 y2 y3 y4 y5 y6 > &0) \/ + (y_of_x (law_cosines_126_x cos1981) y1 y2 y3 y4 y5 y6 > &0) \/ + (y_of_x (law_cosines_234_x costheta) y1 y2 y3 y4 y5 y6 < &0) + )`; +(* Cos[arc[2,2,3.915]] = -0.915903125 + segment with dih > pi/2. + (dih_y y1 y2 y3 y4 y5 y6 > pi - #0.37) \/, removed. + Tan[Pi-0.37]^2 approx 0.150438 + *) +};; + + +Parse_ineq.execute_cfsqp +{ +idv = "test 1607135856 G"; +doc = " +"; +tags= [Tex;Cfsqp;Xconvert;Penalty(50000.0,10000.0);Flypaper]; +ineq = all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2 * h0,y4,&4 * h0); + (&2,y5,&2); + (&2 * h0,y6,&4 * h0) + ] ( + let costheta = -- #0.915903125 in + let cos1981 = -- #0.39879 in + let tan2lower = #0.15043 in + (taum y1 y2 y3 y4 y5 y6 > #0.75) \/ + (y_of_x (law_cosines_234_x costheta) y1 y2 y3 y4 y5 y6 < &0) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &14) \/ +(&4 * x1_delta_y y1 y2 y3 y4 y5 y6 < tan2lower * delta4_squared_y y1 y2 y3 y4 y5 y6) \/ + (delta4_y y1 y2 y3 y4 y5 y6 > &0) \/ + (y_of_x (law_cosines_126_x cos1981) y1 y2 y3 y4 y5 y6 > &0) + )`; +(* arc[2,2,3.915]==2.72855... + (dih_y y1 y2 y3 y4 y5 y6 > pi - #0.37) \/ (arclength y2 y3 y4 < #2.7285) , removed *) +};; + + + +Parse_ineq.execute_cfsqp +{ +idv = "test 1607135856 C extra"; +doc = " +"; +tags= [Tex;Cfsqp;Xconvert;Penalty(10.0,10000.0);Flypaper]; +ineq = all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2 * h0,y4,&4 * h0); + (&2,y5,&2); + (&2,y6,&2) + ] ( + (dih_y y1 y2 y3 y4 y5 y6 - dih2_y y1 y2 y3 y4 y5 y6 > #1.52) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &36) \/ + (delta4_y y1 y2 y3 y4 y5 y6 > &0) \/ + (dih_y y1 y2 y3 y4 y5 y6 > #2.614) \/ + (dih_y y1 y2 y3 y4 y5 y6 < #2.274) + )`; +};; + + +Parse_ineq.execute_cfsqp +{ +idv = "test 1607135856 extra"; +doc = " +"; +tags= [Tex;Cfsqp;Xconvert;Penalty(1000.0,10000.0);Flypaper]; +ineq = all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2 * h0,y4,&4 * h0); + (&2,y5,&2); + (&2 * h0,y6,&4 * h0) + ] ( + (arclength y2 y3 y4 < #2.8) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &21) \/ + (dih_y y1 y2 y3 y4 y5 y6 > pi - #0.37) \/ + (dih_y y1 y2 y3 y4 y5 y6 < #1.52) \/ + (arclength y1 y2 y6 > #1.981) + )`; +(* Solve[arc[2, 2, y] == 2.793, y] ==> y <= 3.9395 *) +};; + + + + +1;; +(* SECTION 2986512815 *) + + +let tt = +{ +idv = "test ineq"; +doc = "This is a trivial inequality"; +tags=[Cfsqp]; +ineq = all_forall `ineq +[ + (&1,x1,&1) +] +(&0 < &1)`; +};; + +testsplit_idq true tt;; + +Parse_ineq.execute_cfsqp +{ +idv = "test 2986512815"; +doc = "The terms have been generated by Mathematica. +"; +tags= [Tex;Cfsqp;Eps 1.0e-8;Penalty(1000.0,100000.0);Flypaper]; +ineq = all_forall `ineq + [ + (&1,e1,&1 + sol0/pi); + (&1,e2,&1 + sol0/pi); + (&1,e3,&1 + sol0/pi); + (&1,e4,&1 + sol0/pi); + ((&2 / h0) pow 2, a2, (&2 * h0) pow 2); + ((&2 / h0) pow 2, b2, (&2 * h0) pow 2); + ((&2 / h0) pow 2, c2, (&2 * h0) pow 2); + (&2 pow 2, d2, #3.915 pow 2); + (&2 pow 2, y2, #3.915 pow 2) + ] + (num1 e1 e2 e3 y2 b2 a2 * num1 e4 e2 e3 y2 c2 d2 > &0 \/ +delta_x (&4) (&4) (&4) a2 b2 y2 > &10 \/ +delta_x (&4) (&4) (&4) c2 d2 y2 > &10 \/ + delta_x (&4) (&4) (&4) a2 b2 y2 < &0 \/ + delta_x (&4) (&4) (&4) c2 d2 y2 < &0 \/ +num2 e4 e2 e3 y2 c2 d2 < &0 \/ +eulerA_x (&4) (&4) (&4) c2 d2 y2 < &0 +\/ + (dih_x (&4) (&4) (&4) a2 b2 y2 + dih_x (&4) (&4) (&4) d2 c2 y2 > pi) + )`; +};; + + + + (* break into 2 cases: d2 <= 3.915, and d2 >= 3.915 *) + +(* \/ \/ num2 e1 e2 e3 y2 b2 a2 < &0 + + *) + +Parse_ineq.execute_cfsqp { +idv = "test 2986512815 y"; +doc = "The terms have been generated by Mathematica. +"; +tags= [Tex;Cfsqp;Eps 1.0e-8;Penalty(1000.0,10000.0);Flypaper;Xconvert]; +ineq = all_forall `ineq + [ + (&1,e1,&1 + sol0/pi); + (&1,e2,&1 + sol0/pi); + (&1,e3,&1 + sol0/pi); + (&1,e4,&1 + sol0/pi); + (&2 / h0, a, &2 * h0); + (&2 / h0, b, &2 * h0); + (&2 / h0, c, &2 * h0); + (&2, d, #4.0); + (&2, y, #3.915) + ] + (delta_y (&2) (&2) (&2) a b y > &10 \/ + delta_y (&2) (&2) (&2) c d y > &10 \/ + delta_y (&2) (&2) (&2) a b y < &0 \/ + delta_y (&2) (&2) (&2) c d y < &0 \/ + num1 e1 e2 e3 y b a * num1 e4 e2 e3 y c d > &0 \/ + num2 e1 e2 e3 y b a < &0 \/ + (dih_y (&2) (&2) (&2) a b y + dih_y (&2) (&2) (&2) d c y > pi) )`; +};; + + { +idv = "2986512815 XXX"; +doc = ""; +tags= [Tex;Cfsqp;Eps 1.0e-8;Flypaper;Xconvert;Penalty(1000.0,2000.0)]; + +ineq = all_forall `ineq + [ + (&1,e1,&1 + sol0/pi); + (&1,e2,&1 + sol0/pi); + (&1,e3,&1 + sol0/pi); + (&1,e4,&1 + sol0/pi); + (&0,t1,&1); + (&0,t2,&1); + (&2 / h0, a, &2 * h0); + (&2 / h0, b, &2 * h0); + (&2 / h0, c, &2 * h0); + (&2, d, #4.0); + (&2, y, #3.915) + ] +((t1 * num1 e1 e2 e3 y b a / ( y * (&16 - y pow 2)) + + t2 * num1 e4 e2 e3 y c d / ( y * (&16 - y pow 2)) > &10) \/ +(t1 * num1 e1 e2 e3 y b a / ( y * (&16 - y pow 2)) + + t2 * num1 e4 e2 e3 y c d / ( y * (&16 - y pow 2)) < -- &10) \/ + (t1 pow 3 * num2 e1 e2 e3 y b a / ( (y * (&16 - y pow 2)) pow 2) + + t2 pow 3 * num2 e4 e2 e3 y c d / ( (y * (&16 - y pow 2)) pow 2) < &0) \/ + (delta_y (&2) (&2) (&2) a b y > &1) \/ + (delta_y (&2) (&2) (&2) a b y < &0) \/ + (delta_y (&2) (&2) (&2) c d y > &1) \/ + (delta_y (&2) (&2) (&2) c d y < &0) \/ + (dih_y (&2) (&2) (&2) a b y + dih_y (&2) (&2) (&2) d c y > pi) )`; +};; + + +Parse_ineq.execute_cfsqp + { +idv = "2986512815 t0"; +doc = ""; +tags= [Tex;Cfsqp;Eps 1.0e-8;Flypaper;Xconvert;Penalty(1000.0,2000.0)]; + +ineq = all_forall `ineq + [ + (&1,e1,&1 + sol0/pi); + (&1,e2,&1 + sol0/pi); + (&1,e3,&1 + sol0/pi); + (&1,e4,&1 + sol0/pi); + (&2 / h0, a, &2 * h0); + (&2 / h0, b, &2 * h0); + (&2 / h0, c, &2 * h0); + (&2, d, #4.0); + (&2, y, #3.915) + ] +((num1 e1 e2 e3 y b a / (sqrt(delta_y (&2) (&2) (&2) a b y) * y * (&16 - y pow 2)) + + num1 e4 e2 e3 y c d / (sqrt(delta_y (&2) (&2) (&2) c d y) * y * (&16 - y pow 2)) > &10) \/ +(num1 e1 e2 e3 y b a / (sqrt(delta_y (&2) (&2) (&2) a b y) * y * (&16 - y pow 2)) + + num1 e4 e2 e3 y c d / (sqrt(delta_y (&2) (&2) (&2) c d y) * y * (&16 - y pow 2)) < -- &10) \/ + (num2 e1 e2 e3 y b a / (sqrt(delta_y (&2) (&2) (&2) a b y) pow 3 * (y * (&16 - y pow 2)) pow 2) + + num2 e4 e2 e3 y c d / (sqrt(delta_y (&2) (&2) (&2) c d y) pow 3 * (y * (&16 - y pow 2)) pow 2) < &0) \/ + (delta_y (&2) (&2) (&2) a b y < &1) \/ + (delta_y (&2) (&2) (&2) c d y < &1) \/ + (dih_y (&2) (&2) (&2) a b y + dih_y (&2) (&2) (&2) d c y > pi) )`; +};; + +Parse_ineq.execute_cfsqp + { +idv = "2986512815 t1"; +doc = ""; +tags= [Tex;Cfsqp;Eps 1.0e-8;Flypaper;Xconvert;Penalty(1000.0,2000.0)]; + +ineq = all_forall `ineq + [ + (&1,e1,&1 + sol0/pi); + (&1,e2,&1 + sol0/pi); + (&1,e3,&1 + sol0/pi); + (&1,e4,&1 + sol0/pi); + (&0,t,&1); + (&2 / h0, a, &2 * h0); + (&2 / h0, b, &2 * h0); + (&2 / h0, c, &2 * h0); + (&2, d, #4.0); + (&2, y, #3.915) + ] +( (num1 e1 e2 e3 y b a / ( y * (&16 - y pow 2)) + + t * num1 e4 e2 e3 y c d / (sqrt(delta_y (&2) (&2) (&2) c d y) * y * (&16 - y pow 2)) > &10) \/ +(num1 e1 e2 e3 y b a / (y * (&16 - y pow 2)) + + t* num1 e4 e2 e3 y c d / (sqrt(delta_y (&2) (&2) (&2) c d y) * y * (&16 - y pow 2)) < -- &10) \/ + (num2 e1 e2 e3 y b a / ( (y * (&16 - y pow 2)) pow 2) + + t pow 3 * num2 e4 e2 e3 y c d / (sqrt(delta_y (&2) (&2) (&2) c d y) pow 3 * (y * (&16 - y pow 2)) pow 2) < &0) \/ + (delta_y (&2) (&2) (&2) a b y < &0) \/ + (delta_y (&2) (&2) (&2) a b y > &1) \/ + (delta_y (&2) (&2) (&2) c d y < &1)) `; +};; + + +Parse_ineq.execute_cfsqp + { +idv = "2986512815 t2"; +doc = ""; +tags= [Tex;Cfsqp;Eps 1.0e-8;Flypaper;Xconvert;Penalty(1000.0,2000.0)]; + +ineq = all_forall `ineq + [ + (&1,e1,&1 + sol0/pi); + (&1,e2,&1 + sol0/pi); + (&1,e3,&1 + sol0/pi); + (&1,e4,&1 + sol0/pi); + (&0,t,&1); + (&2 / h0, a, &2 * h0); + (&2 / h0, b, &2 * h0); + (&2 / h0, c, &2 * h0); + (&2, d, #4.0); + (&2, y, #3.915) + ] +((t * num1 e1 e2 e3 y b a / (sqrt(delta_y (&2) (&2) (&2) a b y) * y * (&16 - y pow 2)) + + num1 e4 e2 e3 y c d / ( y * (&16 - y pow 2)) > &10) \/ +(t * num1 e1 e2 e3 y b a / (sqrt(delta_y (&2) (&2) (&2) a b y) * y * (&16 - y pow 2)) + + num1 e4 e2 e3 y c d / ( y * (&16 - y pow 2)) < -- &10) \/ + (t pow 3 * num2 e1 e2 e3 y b a / (sqrt(delta_y (&2) (&2) (&2) a b y) pow 3 * (y * (&16 - y pow 2)) pow 2) + + num2 e4 e2 e3 y c d / ( (y * (&16 - y pow 2)) pow 2) < &0) \/ + (delta_y (&2) (&2) (&2) a b y < &1) \/ + (delta_y (&2) (&2) (&2) c d y > &1) \/ + (delta_y (&2) (&2) (&2) c d y < &0) )`; +};; + + +Parse_ineq.execute_cfsqp { +idv = "2986512815 test"; +doc = "The terms have been generated by Mathematica. +Deprecated. Replaced with u1 below. (The second derivative is always negative for each +simplex so the sum is negative.) +"; +tags= [Tex;Cfsqp;Eps 1.0e-8;Flypaper;Xconvert;Deprecated]; +ineq = all_forall `ineq + [ + (&1,e1,&1 + sol0/pi); + (&1,e2,&1 + sol0/pi); + (&1,e3,&1 + sol0/pi); + (&1,e4,&1 + sol0/pi); + (&2 / h0, a, &2 * h0); + (&2 / h0, b, &2 * h0); + (&2 / h0, c, &2 * h0); + (&2, d, #4.0); + (&2, y, #3.915) + ] + ((let term1 = ((&4 * ((sqrt ((((-- &4) * (c pow 4)) + (((-- &4) * (((d pow 2) + ((-- &1) * +(y pow 2))) pow 2)) + ((c pow 2) * ((&8 * (y pow 2)) + ((-- &1) * ((d pow 2) +* ((-- &8) + (y pow 2)))))))))) * (((-- &1) * ((y pow 2) * ((&8 * e1) + ((&8 +* e3) + (e2 * ((-- &16) + (y pow 2))))))) + (((b pow 2) * ((&8 * e3) + (e1 * +((-- &8) + (y pow 2))))) + ((a pow 2) * ((&8 * e1) + (e3 * ((-- &8) + (y +pow 2))))))))) + (&4 * ((sqrt ((((-- &4) * (a pow 4)) + (((-- &4) * (((b pow +2) + ((-- &1) * (y pow 2))) pow 2)) + ((a pow 2) * ((&8 * (y pow 2)) + ((-- +&1) * ((b pow 2) * ((-- &8) + (y pow 2)))))))))) * (((-- &1) * ((y pow 2) * +((&8 * e1) + ((&8 * e3) + (e4 * ((-- &16) + (y pow 2))))))) + (((c pow 2) * +((&8 * e3) + (e1 * ((-- &8) + (y pow 2))))) + ((d pow 2) * ((&8 * e1) + (e3 * +((-- &8) + (y pow 2)))))))))) in + let term2 = ((&4 * (((sqrt ((((-- &4) * (c pow 4)) + (((-- &4) * (((d pow 2) + ((-- &1) * +(y pow 2))) pow 2)) + ((c pow 2) * ((&8 * (y pow 2)) + ((-- &1) * ((d pow 2) +* ((-- &8) + (y pow 2)))))))))) pow 3) * (((-- &8) * ((a pow 6) * ((&8 * (e1 +* ((-- &16) + (&3 * (y pow 2))))) + (e3 * (&128 + (((-- &8) * (y pow 2)) + (y +pow 4))))))) + (((-- &8) * (((b pow 2) + ((-- &1) * (y pow 2))) * (((y pow 4) +* ((e2 * (((-- &16) + (y pow 2)) pow 2)) + ((&8 * (e1 * ((-- &16) + (&3 * (y +pow 2))))) + (&8 * (e3 * ((-- &16) + (&3 * (y pow 2)))))))) + (((b pow 2) * +((y pow 2) * ((&16 * (e3 * (&16 + ((-- &3) * (y pow 2))))) + ((e2 * (((-- +&16) + (y pow 2)) pow 2)) + (e1 * ((-- &512) + ((&48 * (y pow 2)) + ((-- &3) +* (y pow 4))))))))) + ((b pow 4) * ((&8 * (e3 * ((-- &16) + (&3 * (y pow +2))))) + (e1 * (&128 + (((-- &8) * (y pow 2)) + (y pow 4)))))))))) + (((-- +&4) * ((a pow 2) * ((&6 * ((y pow 4) * ((&8 * (e1 * ((-- &16) + (&3 * (y pow +2))))) + (e3 * (&128 + (((-- &8) * (y pow 2)) + (y pow 4))))))) + (((-- &4) * +((b pow 2) * ((y pow 2) * ((e2 * (((-- &16) + (y pow 2)) pow 2)) + ((&4 * (e1 +* ((-- &32) + (((-- &2) * (y pow 2)) + (y pow 4))))) + (&4 * (e3 * ((-- &32) ++ (((-- &2) * (y pow 2)) + (y pow 4)))))))))) + ((b pow 4) * ((&6 * (e3 * +(&128 + (((-- &40) * (y pow 2)) + (&3 * (y pow 4)))))) + (e1 * ((-- &768) + +((&208 * (y pow 2)) + (((-- &20) * (y pow 4)) + (y pow 6))))))))))) + ((-- +&4) * ((a pow 4) * ((&2 * ((y pow 2) * ((e1 * (&384 + ((-- &72) * (y +pow 2)))) + ((e2 * (((-- &16) + (y pow 2)) pow 2)) + ((-- &4) * (e3 * (&160 + +(((-- &14) * (y pow 2)) + (y pow 4))))))))) + ((b pow 2) * ((&6 * (e1 * (&128 ++ (((-- &40) * (y pow 2)) + (&3 * (y pow 4)))))) + (e3 * ((-- &768) + ((&208 +* (y pow 2)) + (((-- &20) * (y pow 4)) + (y pow 6))))))))))))))) + (&4 * +(((sqrt ((((-- &4) * (a pow 4)) + (((-- &4) * (((b pow 2) + ((-- &1) * (y pow +2))) pow 2)) + ((a pow 2) * ((&8 * (y pow 2)) + ((-- &1) * ((b pow 2) * ((-- +&8) + (y pow 2)))))))))) pow 3) * (((-- &8) * ((c pow 6) * ((&8 * (e3 * ((-- +&16) + (&3 * (y pow 2))))) + (e1 * (&128 + (((-- &8) * (y pow 2)) + (y pow +4))))))) + (((-- &8) * (((d pow 2) + ((-- &1) * (y pow 2))) * (((y pow 4) * +((e4 * (((-- &16) + (y pow 2)) pow 2)) + ((&8 * (e1 * ((-- &16) + (&3 * (y +pow 2))))) + (&8 * (e3 * ((-- &16) + (&3 * (y pow 2)))))))) + (((d pow 2) * +((y pow 2) * ((e1 * (&256 + ((-- &48) * (y pow 2)))) + ((e4 * (((-- &16) + (y +pow 2)) pow 2)) + (e3 * ((-- &512) + ((&48 * (y pow 2)) + ((-- &3) * (y pow +4))))))))) + ((d pow 4) * ((&8 * (e1 * ((-- &16) + (&3 * (y pow 2))))) + (e3 +* (&128 + (((-- &8) * (y pow 2)) + (y pow 4)))))))))) + (((-- &4) * ((c pow +4) * ((&2 * ((y pow 2) * ((e3 * (&384 + ((-- &72) * (y pow 2)))) + ((e4 * +(((-- &16) + (y pow 2)) pow 2)) + ((-- &4) * (e1 * (&160 + (((-- &14) * (y +pow 2)) + (y pow 4))))))))) + ((d pow 2) * ((&6 * (e3 * (&128 + (((-- &40) * +(y pow 2)) + (&3 * (y pow 4)))))) + (e1 * ((-- &768) + ((&208 * (y pow 2)) + +(((-- &20) * (y pow 4)) + (y pow 6)))))))))) + ((-- &4) * ((c pow 2) * ((&6 * +((y pow 4) * ((&8 * (e3 * ((-- &16) + (&3 * (y pow 2))))) + (e1 * (&128 + +(((-- &8) * (y pow 2)) + (y pow 4))))))) + (((-- &4) * ((d pow 2) * ((y pow +2) * ((e4 * (((-- &16) + (y pow 2)) pow 2)) + ((&4 * (e1 * ((-- &32) + (((-- +&2) * (y pow 2)) + (y pow 4))))) + (&4 * (e3 * ((-- &32) + (((-- &2) * (y pow +2)) + (y pow 4)))))))))) + ((d pow 4) * ((&6 * (e1 * (&128 + (((-- &40) * (y +pow 2)) + (&3 * (y pow 4)))))) + (e3 * ((-- &768) + ((&208 * (y pow +2)) + (((-- &20) * (y pow 4)) + (y pow 6))))))))))))))))) in + term1 * term1 - #0.01 * term2 > &0) \/ + (delta_y (&2) (&2) (&2) a b y < &0) \/ + (delta_y (&2) (&2) (&2) c d y < &0) \/ + (dih_y (&2) (&2) (&2) a b y + dih_y (&2) (&2) (&2) d c y > pi) )`; +};; + + +(* END SECTION 2986512815 *) + +(* SECTION 2065952723 *) + +Parse_ineq.execute_cfsqp + { +idv = "test 2065952723 A"; +doc = "See explanation in 2065952723. This is the branch when $a_2 \\le 15.99$. +"; +tags = [Flypaper;Tex]; +ineq = all_forall `ineq + [ + (&1 , e1, &1 + sol0/ pi); + (&1 , e2, &1 + sol0/ pi); + (&1 , e3, &1 + sol0/ pi); + ((&2 / h0) pow 2, a2, #15.53); + ((&2 / h0) pow 2, b2, &4 pow 2); + ((&2 / h0) pow 2, c2, &4 pow 2) + ] + (num_combo1 e1 e2 e3 a2 b2 c2 > &0) `; +};; + +Parse_ineq.execute_cfsqp + { +idv = "2065952723 C-2"; +doc = "See explanation in 2065952723. Used to replace extremal edges with minimal edges in a + hexagon."; +(* 15.53 > 3.94^2, arc[2,2,3.94] > 2 arc[2,2,2 hmid], to get the upper bound. + Lower via, arc[2,2,2.9] < arc[2hmid,2hmid,2] 2. *) +tags = [Flypaper;Tex]; +ineq = all_forall `ineq + [ + (&1 , e1, &1 + sol0/ pi); + (&1 , e2, &1 + sol0/ pi); + (&1 , e3, &1 + sol0/ pi); + ((&2 / h0) pow 2, a2, (&2 * h0) pow 2); + ((&2 / h0) pow 2, b2, &4); + (#2.98 pow 2, c2, #15.53) + ] + ((num1 e1 e2 e3 a2 b2 c2 ) > &0) `; +};; + + +Parse_ineq.execute_cfsqp + { +idv = "old test 2065952723 B"; +doc = ""; +tags = [Flypaper;Tex;Eps 1.0e-8]; +ineq = all_forall `ineq + [ + (&4,x1,&4); + (&4,x2,&4); + (&4,x3,&4); + (#15.99,x4,#16); + ((&2 / h0) pow 2, x5, &4 pow 2); + ((&2 / h0) pow 2, x6, &4 pow 2) + ] + ( (x5 + x6 > #15.5) \/ (delta_x x1 x2 x3 x4 x5 x6 < &0))`; +};; + +Parse_ineq.execute_cfsqp { +idv = "old test 2065952723 C"; +doc = ""; +tags = [Flypaper;Tex;Penalty (500.0,50000.0)]; +ineq = all_forall `ineq + [ + (&1 , e1, &1 + sol0/ pi); + (&1 , e2, &1 + sol0/ pi); + (&1 , e3, &1 + sol0/ pi); + (#15.99,a2,#16); + ((&2 / h0) pow 2, b2, &4 pow 2); + ((&2 / h0) pow 2, c2, &4 pow 2) + ] +((((&2 / &25) * (((-- &32) * ((a2 pow 3) * e1)) + ((&2 * ((a2 pow 4) * e1)) + +((&32 * (a2 * ((b2 pow 2) * e1))) + (((-- &2) * ((a2 pow 2) * ((b2 pow 2) * +e1))) + (((-- &64) * (a2 * (b2 * (c2 * e1)))) + ((&4 * ((a2 pow 2) * (b2 * +(c2 * e1)))) + ((&32 * (a2 * ((c2 pow 2) * e1))) + (((-- &2) * ((a2 pow 2) * +((c2 pow 2) * e1))) + ((&3200 * ((a2 pow 2) * (e1 pow 2))) + (((-- &200) * +((a2 pow 3) * (e1 pow 2))) + ((&131072 * e2) + ((&8192 * (a2 * e2)) + ((&512 +* ((a2 pow 2) * e2)) + ((&48 * ((a2 pow 3) * e2)) + (((-- &24576) * (b2 * +e2)) + (((-- &1536) * (a2 * (b2 * e2))) + (((-- &48) * ((a2 pow 2) * (b2 * +e2))) + (((-- &6) * ((a2 pow 3) * (b2 * e2))) + ((&1536 * ((b2 pow 2) * e2)) ++ ((&16 * (a2 * ((b2 pow 2) * e2))) + ((&8 * ((a2 pow 2) * ((b2 pow 2) * +e2))) + (((-- &16) * ((b2 pow 3) * e2)) + (((-- &2) * (a2 * ((b2 pow 3) * +e2))) + (((-- &24576) * (c2 * e2)) + (((-- &1536) * (a2 * (c2 * e2))) + (((-- +&144) * ((a2 pow 2) * (c2 * e2))) + ((&3072 * (b2 * (c2 * e2))) + ((&224 * +(a2 * (b2 * (c2 * e2)))) + ((&16 * ((a2 pow 2) * (b2 * (c2 * e2)))) + (((-- +&144) * ((b2 pow 2) * (c2 * e2))) + ((&4 * (a2 * ((b2 pow 2) * (c2 * e2)))) + +(((-- &1) * ((a2 pow 2) * ((b2 pow 2) * (c2 * e2)))) + ((&1536 * ((c2 pow 2) +* e2)) + ((&144 * (a2 * ((c2 pow 2) * e2))) + (((-- &48) * (b2 * ((c2 pow 2) +* e2))) + (((-- &18) * (a2 * (b2 * ((c2 pow 2) * e2)))) + (((-- &48) * ((c2 +pow 3) * e2)) + (((-- &3200) * ((a2 pow 2) * (e1 * e2))) + (((-- &3200) * (a2 +* (b2 * (e1 * e2)))) + ((&400 * ((a2 pow 2) * (b2 * (e1 * e2)))) + ((&3200 * +(a2 * (c2 * (e1 * e2)))) + (((-- &204800) * (e2 pow 2)) + (((-- &12800) * (a2 +* (e2 pow 2))) + ((&25600 * (b2 * (e2 pow 2))) + ((&3200 * (a2 * (b2 * (e2 +pow 2)))) + (((-- &200) * (a2 * ((b2 pow 2) * (e2 pow 2)))) + ((&25600 * (c2 +* (e2 pow 2))) + (((-- &3200) * (b2 * (c2 * (e2 pow 2)))) + ((&131072 * e3) + +((&8192 * (a2 * e3)) + ((&512 * ((a2 pow 2) * e3)) + ((&48 * ((a2 pow 3) * +e3)) + (((-- &24576) * (b2 * e3)) + (((-- &1536) * (a2 * (b2 * e3))) + (((-- +&144) * ((a2 pow 2) * (b2 * e3))) + ((&1536 * ((b2 pow 2) * e3)) + ((&144 * +(a2 * ((b2 pow 2) * e3))) + (((-- &48) * ((b2 pow 3) * e3)) + (((-- &24576) * +(c2 * e3)) + (((-- &1536) * (a2 * (c2 * e3))) + (((-- &48) * ((a2 pow 2) * +(c2 * e3))) + (((-- &6) * ((a2 pow 3) * (c2 * e3))) + ((&3072 * (b2 * (c2 * +e3))) + ((&224 * (a2 * (b2 * (c2 * e3)))) + ((&16 * ((a2 pow 2) * (b2 * (c2 * +e3)))) + (((-- &48) * ((b2 pow 2) * (c2 * e3))) + (((-- &18) * (a2 * ((b2 pow +2) * (c2 * e3)))) + ((&1536 * ((c2 pow 2) * e3)) + ((&16 * (a2 * ((c2 pow 2) +* e3))) + ((&8 * ((a2 pow 2) * ((c2 pow 2) * e3))) + (((-- &144) * (b2 * ((c2 +pow 2) * e3))) + ((&4 * (a2 * (b2 * ((c2 pow 2) * e3)))) + (((-- &1) * ((a2 +pow 2) * (b2 * ((c2 pow 2) * e3)))) + (((-- &16) * ((c2 pow 3) * e3)) + (((-- +&2) * (a2 * ((c2 pow 3) * e3))) + (((-- &3200) * ((a2 pow 2) * (e1 * +e3))) + ((&3200 * (a2 * (b2 * (e1 * e3)))) + (((-- &3200) * (a2 * (c2 * (e1 * +e3)))) + ((&400 * ((a2 pow 2) * (c2 * (e1 * e3)))) + (((-- &409600) * (e2 * +e3)) + (((-- &25600) * (a2 * (e2 * e3))) + ((&51200 * (b2 * (e2 * e3))) + +((&3200 * (a2 * (b2 * (e2 * e3)))) + (((-- &3200) * ((b2 pow 2) * (e2 * e3))) ++ ((&51200 * (c2 * (e2 * e3))) + ((&3200 * (a2 * (c2 * (e2 * e3)))) + (((-- +&400) * (a2 * (b2 * (c2 * (e2 * e3))))) + (((-- &3200) * ((c2 pow 2) * (e2 * +e3))) + (((-- &204800) * (e3 pow 2)) + (((-- &12800) * (a2 * (e3 pow 2))) + +((&25600 * (b2 * (e3 pow 2))) + ((&25600 * (c2 * (e3 pow 2))) + ((&3200 * (a2 +* (c2 * (e3 pow 2)))) + (((-- &3200) * (b2 * (c2 * (e3 pow 2)))) + ((-- &200) * +(a2 * ((c2 pow 2) * (e3 pow +2))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +)))))))))))))))))))))) > &0) \/ (b2 + c2 < #16.0) \/ (b2 + c2 > #16.5)) +`; +};; + +Parse_ineq.execute_cfsqp { +idv = "test 2065952723"; +doc = " +%See Mathematica numerical calculation. +% old idv: eqn:gg'' calc:Lexell. +The derivatives have been computed in Mathematica and converted to +HOL format. +This is a + calculation of the sign of a second derivative to show that the + function $\\tau$ does not have a interior local minimum as a function of the + edge lengths. It initially appears to depend on six variables, but + the dependence on three of the variables is linear and is + extremal at the endpoints. + +Let +\\[ +g(s;a,b,c,e_1,e_2,e_3) = \\sum_{i=1}^3 \\dih_i(2,2,2,a+s,b,c) e_i, +\\] +where $\\dih_i$ is given by Definition~\\ref{def:tau}. +Let $\\Delta = \\Delta(4,4,4,a^2,b^2,c^2)$. +Let primes denote derivatives with respect to the variable $s$. +Assume that +$e_i\\in\\leftclosed1,1+\\sol_0/\\pi\\rightclosed$, that +$a,b,c\\in\\leftclosed2/\\hm,4\\rightclosed$. +%We restrict $a$ further to $a\\le 3.8$. +Then +\\begin{equation}\\label{eqn:calc:Lexell} +(16-a^2) ^2 a^2( \\Delta (g'(0;a,b,c,e_1,e_2,e_3))^2 +- 0.01\\Delta^{3/2}g''(0;a,b,c,e_1,e_2,e_3))\\ge 0. +\\end{equation} +(The factors of $\\Delta$ clear the denominator in +(\\ref{eqn:calc:Lexell}) to simplify the inequality to be proved.) +%Sum of squares methods may be the easiest way to prove this inequality near the +%minimum. +%The quantities deriv1 and deriv2 are for reference only. +Variables $e_i$ are linear and variables $a,b,c$ appear in even powers. +"; +(* + +*) +tags = [Flypaper;Tex;Eps 1.0e-8]; +ineq = all_forall `ineq + [ + (&1 , e1, &1 + sol0/ pi); + (&1 , e2, &1 + sol0/ pi); + (&1 , e3, &1 + sol0/ pi); + ((&2 / h0) pow 2, a2, &4 pow 2); + ((&2 / h0) pow 2, b2, &4 pow 2); + ((&2 / h0) pow 2, c2, &4 pow 2) + ] + (((num1 e1 e2 e3 a2 b2 c2 ) pow 2 - #0.01 * num2 e1 e2 e3 a2 b2 c2 > &0) \/ (a2 > #15.9))`; +};; + +Parse_ineq.execute_cfsqp + { +idv = "2065952723 C-1"; +doc = "See explanation in 2065952723. At this point we have a hexagon. + This is the case when neither $v_4$ nor $v_5$ is flat. + "; +(* arc[2,2,3.94] > 2 arc[2,2,2 hmid], to get the upper bound *) +(* bug fixed on domain, 12/30/2010 *) +tags = [Flypaper;Tex;Eps 1.0e-8]; +ineq = all_forall `ineq + [ + (&1 , e1, &1 + sol0/ pi); + (&1 , e2, &1 + sol0/ pi); + (&1 , e3, &1 + sol0/ pi); + ((&2 / h0) pow 2, a2, (&2 * h0) pow 2); + ( (&2 / h0) pow 2, b2, (&2 * h0) pow 2); + (#3.4 pow 2, c2, #3.94 pow 2) + ] + (num1 e1 e2 e3 a2 b2 c2 > &0) `; +};; + +Parse_ineq.execute_cfsqp + { +idv = "2065952723 A"; +doc = "See explanation in 2065952723. This is the branch when $a_2 \\le 15.99$. +"; +tags = [Flypaper;Tex]; +ineq = all_forall `ineq + [ + (&1 , e1, &1 + sol0/ pi); + (&1 , e2, &1 + sol0/ pi); + (&1 , e3, &1 + sol0/ pi); + ((&2 / h0) pow 2, a2, #15.99); + ((&2 / h0) pow 2, b2, &4 pow 2); + ((&2 / h0) pow 2, c2, &4 pow 2) + ] + (num_combo1 e1 e2 e3 a2 b2 c2 > &0) `; +};; + + + + +Parse_ineq.execute_cfsqp { +idv = "test not used"; +doc = ""; +tags = [Flypaper;Tex;Eps 1.0e-8]; +ineq = all_forall `ineq + [ + (&4,x1,&4); + (&4,x2,&4); + (&4,x3,&4); + (#15.99,x4,#16); + ((&2 / h0) pow 2, x5, &4 pow 2); + ((&2 / h0) pow 2, x6, &4 pow 2) + ] + ((delta_x x1 x2 x3 x4 x5 x6 < &0) \/ (x5 + x6 < #16.5))`; +};; + +(* END SECTION 2065952723 *) + +let make_WHW i j = + let r = match i with + 0 -> [`&2`;`&2`;`&2`] + |1 -> [`&2 * h0`;`&2`;`&2`] + |2 -> [`&2`;`&2 * h0`;`&2`] + |3 -> [`&2`;`&2`;`&2 * h0`] + | _ -> failwith "make_WHW" in + let s = match j with + 0 -> [`&2`;`&2 * h0`] + | 1 -> [`&2 * h0`;`&2`] + | _ -> failwith "make_WHW j" in + let t1 = r @ s in + let t = map (fun x -> let v = mk_comb (`(pow)`,x) in mk_comb(v,`2`) ) t1 in +{ +idv = Printf.sprintf "PQFYWHW B'' %d %d" i j; +doc = "Pentagons with two flats + (that are not adjacent) satisfy the bound $D[4,1]$. When $y_{15}=y_{45}=2$ and + $y_{34} = 2h_0$, then the lines $\\{\\v_2,\\v_3\\}$ and $\\{\\v_4,\\v_5\\}$ +are parallel and the dihedral inequality is sharp. + % The sharp case is i=3, j=0. +The constants $d(5,0) Ineq.add (make_WHW i j)) [(0,0);(1,0);(2,0);(3,0);(0,1);(1,1);(2,1);(3,1)];; + + +testsplit_idq true +(* Parse_ineq.execute_cfsqp *) + { +idv = "old test"; +doc = ""; +tags = []; +ineq = all_forall `ineq + [ +(#0.99999999999999988898,x1, #0.99999999999999988898); +(#1.0438699140229557027,x2, #1.0438699140229557027); +(#1.1316097420688666642,x3, #1.1316097420688666642); +(#15.937380962222855274,x4, #15.99000000000000199); +(#6.705845301083399157,x5, #6.7321743512219729411); +(#9.207105064247926407,x6, #9.2334341143865010793) + ] + (let alpha = &0 in + (num2 x1 x2 x3 x4 x5 x6 * (#1.0 - alpha) * (-- &1) + num1 x1 x2 x3 x4 x5 x6 * alpha > &0))`; +};; + + +Parse_ineq.execute_cfsqp + { +idv = "old test"; +doc = ""; +tags = [Penalty(50.0,5000.0)]; +ineq = all_forall `ineq + [ +(#5.8959281250000064034,x1,#5.8959281250000064034); +(#4.0068859374999998835,x2,#4.0068859374999998835); +(#6.2035000000000062315,x3,#6.2035000000000062315); +(#4.0367249999999996746,x4,#4.0367249999999996746); +(#20.069634375000017457,x5,#20.069634375000017457); +(#1.000000000000000222,x6,#1.000000000000000222) + ] ( let x12 = &2 pow 2 in + let x23 = &2 pow 2 in + let x14 = (&2 * h0) pow 2 in + let cos242 = -- #0.75 in + delta_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 < &10 \/ + factor345_hexall_x cos242 x1 x2 x3 x4 x5 x6 > &0 \/ + eulerA_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 < #1.72)`; +};; + + + + +(* *) + + + +Parse_ineq.execute_cfsqp + {ineq = + `!diag y1 y2 y3 y4 y5 y6. + ineq + [&2,y1,&2 * h0; &2,y2,&2 * h0; &2,y3,&2 * h0; &2,y4,&2 * h0; + &2, + y5, + &2 * h0; &2,y6,&2 * h0; &2 * h0,diag,#3.9985] + (let y23 = &2 in + let y56 = &2 in + let y16 = &2 in + let y34 = &2 in + let y13 = edge_flat y2 y1 y3 y23 (&2) in + let y46 = edge_flat y5 y4 y6 y56 (&2) in + taum y1 y3 y4 y34 diag y13 + + flat_term y2 + + taum y4 y6 y1 y16 diag y46 + + flat_term y5 > + tame_table_d 6 0 \/ + dih_y y1 y3 y4 y34 diag y13 + dih_y y1 y6 y4 y46 diag y16 < + dih_y y1 y2 y6 (&2 * h0) y16 (&2) \/ + dih_y y1 y3 y4 y34 diag y13 + dih_y y1 y6 y4 y46 diag y16 > pi \/ + dih_y y6 y1 y4 diag y46 y16 < dih_y y6 y1 y5 (&2 * h0) y56 y16 \/ + dih_y y3 y1 y4 diag y34 y13 < dih_y y3 y2 y4 (&2 * h0) y34 y23 \/ + delta_y y1 y3 y4 y34 diag y13 < &0 \/ + delta_y y4 y6 y1 y16 diag y13 < &0)`; + idv = "GYQVFXJ hexA 0"; + doc = + "This inequality is the main hexagon inequality\n with two flat nodes $\\v_2$ $\\v_5$, at opposite vertices of the hexagon.\n This is an effective quadrilateral, with variables $y_1,\\ldots,y_6$ and diagonal\n $y_{14}$.\n Some reductions are used beyond those mentioned in the flypaper.\n \\begin{enumerate}\n \\item $y_{34}=y_{16}=2$.\n \\item if the diag $y_{14}$ is greater than $3.7$, \n then $y_{12}=y_{23}=y_{45}=y_{56}=2$. \n \\item $y_{14}\\le 3.9985$.\n \\item By symmetry, we can assume that $y_{12}\\le y_{56}$.\n \\end{enumerate}\n The reductions are justified by the preceding calculations.\n There are three cases, depending on whether the edges at $\\v_2$ and $\\v_5$\n are as short or as long as possible.\n "; + tags = [Tex; Flypaper; Penalty (5., 50.); Xconvert]};; + +Parse_ineq.execute_cfsqp + {ineq = + `!diag y1 y2 y3 y4. + ineq + [&2,y1,&2 * h0; &2,y2,&2 * h0; &2,y3,&2 * h0; &2,y4,&2 * h0; + &2 * h0,diag,#3.75] + (let y23 = &2 in + let y34 = &2 in + let y13 = edge_flat y2 y1 y3 y23 (&2) in + (( taum y1 y3 y4 y34 diag y13 + + flat_term y2 > + (tame_table_d 6 0) / &2 ) \/ (dih_y y1 y2 y4 (&2 * h0) diag (&2) > dih_y y1 y3 y4 y34 diag y13)))`; + idv = "GYQVFXJ hexA 0 test1"; + doc = + " "; + tags = [Tex; Flypaper; Penalty (5., 50.); Xconvert]};; + +(* SECTION PROIQUZ *) + +Parse_ineq.execute_cfsqp + { +ineq = all_forall `ineq + [ +(&2 pow 2,x1,(&2 *h0) pow 2); +(&2 pow 2,x2,(&2 * h0) pow 2); +(&2 pow 2,x3,(&2 * h0) pow 2); +(&2 pow 2,x4,(&2 *h0) pow 2); +((&2 * h0) pow 2,x5,(&4 * h0) pow 2); +(&1,x6,&1) + ] + ( + let x12 = &2 pow 2 in + let x23 = x12 in + let x14 = &2 pow 2 in + (delta_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 > &60) \/ + (dih1_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 > #2.425) \/ + (dih1_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 < #2.274))`; + idv = "old PROIQUZ hexall 5A1a-old"; + doc = "split a hex along a shortish diagonal. Flat at node 2. Case $y_5 + 0.1 \\le y_3+y_4$."; + tags = [Tex; Flypaper; Penalty (2000., 15000.);Widthcutoff 0.01] + (* + This case treats Delta bounded away from 0. + By the bounds [2.274,2.425] on dihedral, we have delta4 <0. + The upper bound is the trivial triangle inequality bound: y5 <= y3 + y4 <= 4 h0. + This shows that we can apply 206...A1 arc[2,2,Sqrt[15.53]] < 2.79. *) +};; + + + +Parse_ineq.execute_cfsqp + { +ineq = all_forall `ineq + [ +(&2 pow 2,x1,(&2 *h0) pow 2); +(&2 pow 2,x2,(&2 * h0) pow 2); +(&2 pow 2,x3,(&2 * h0) pow 2); +(&2 pow 2,x4,(&2 *h0) pow 2); +((&2 * h0) pow 2,x5,(&4 * h0) pow 2); +(&1,x6,&1) + ] + ( + let x12 = &2 pow 2 in + let x23 = x12 in + let x14 = &2 pow 2 in + (arclength_x_345 x1 x2 x3 x4 x5 x6 < #2.79) \/ + (sqrt(x5) + #0.1 > sqrt(x3) + sqrt(x4)) \/ + (delta_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 < &10) \/ + (dih1_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 > #2.425))`; + idv = "old PROIQUZ hexall 5A1b"; + doc = "split a hex along a shortish diagonal. Flat at node 2. Case $y_5 + 0.1 \\le y_3+y_4$."; + tags = [Tex; Flypaper; Penalty (2000., 15000.);Widthcutoff 0.01] + (* + This case treats Delta bounded away from 0. + The upper bound is the trivial triangle inequality bound: y5 <= y3 + y4 <= 4 h0. + This shows that we can apply 206...A1 arc[2,2,Sqrt[15.53]] < 2.79. *) +};; + +Parse_ineq.execute_cfsqp + { +ineq = all_forall `ineq + [ +(&2 pow 2,x1,(&2 *h0) pow 2); +(&2 pow 2,x2,(&2 * h0) pow 2); +(&2 pow 2,x3,(&2 * h0) pow 2); +(&2 pow 2,x4,(&2 *h0) pow 2); +((&2 * h0) pow 2,x5,(&4 * h0) pow 2); +(&1,x6,&1) + ] + ( + let x12 = &2 pow 2 in + let x23 = x12 in + let x14 = &2 pow 2 in + + (sqrt(x5) + #0.1 > sqrt(x3) + sqrt(x4)) \/ + (delta_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 < &10) \/ + (dih1_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 > #2.425))`; + idv = "old old PROIQUZ hexall 5A1b"; + doc = "split a hex along a shortish diagonal. Flat at node 2. Case $y_5 + 0.1 \\le y_3+y_4$."; + tags = [Tex; Flypaper; Penalty (2000., 15000.);Widthcutoff 0.01] + (* + This case treats Delta bounded away from 0. + The upper bound is the trivial triangle inequality bound: y5 <= y3 + y4 <= 4 h0. + This shows that we can apply 206...A1 arc[2,2,Sqrt[15.53]] < 2.79. *) +};; + + + + + { +ineq = all_forall `ineq + [ +(&2 pow 2,x1,(&2 *h0) pow 2); +(&2 pow 2,x2,(&2 * h0) pow 2); +(&2 pow 2,x3,(&2 * h0) pow 2); +(&2 pow 2,x4,(&2 *h0) pow 2); +((&2 * h0) pow 2,x5,(&4 * h0) pow 2); +(&1,x6,&1) + ] + ( + let x12 = &2 pow 2 in + let x23 = x12 in + let x14 = &2 pow 2 in + (arclength_x_345 x1 x2 x3 x4 x5 x6 < #2.79) \/ + (sqrt(x5) + #0.1 > sqrt(x3) + sqrt(x4)) \/ + (delta_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 < &10) \/ + (dih1_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 > #2.425))`; + idv = "old PROIQUZ hexall 5A1a"; + doc = "split a hex along a shortish diagonal. Flat at node 2. Case $y_5 + 0.1 \\le y_3+y_4$."; + tags = [Tex; Flypaper; Penalty (2000., 15000.);Widthcutoff 0.01] + (* + This case treats Delta bounded away from 0. + The upper bound is the trivial triangle inequality bound: y5 <= y3 + y4 <= 4 h0. *) +};; + + +let PROQUZ_hexall_5A1_ineq = `\b_loc b2425 b24. +`ineq + [ +(&2 pow 2,x1,(&2 *h0) pow 2); +(&2 pow 2,x2,(&2 * h0) pow 2); +(&2 pow 2,x3,(&2 * h0) pow 2); +(&2 pow 2,x4,(&2 *h0) pow 2); +((&2 * h0) pow 2,x5,(&4 * h0) pow 2); +(&1,x6,&1) + ] + ( + let x12 = &2 pow 2 in + let x23 = x12 in + let x14 = &2 pow 2 in + (sqrt(x5) + #0.1 > sqrt(x3) + sqrt(x4)) \/ + (sqrt(x5) + #0.1 < sqrt(x3) + sqrt(x4) /\ b_loc) \/ + (delta_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 < &10) \/ + (taum_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 > tame_table_d 6 0 / &2) \/ + (dih1_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 > #2.425) \/ + (dih1_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 < #2.425 /\ b2425) \/ + (dih_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 > &0 ) \/ + (dih_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 < &0 /\ b24 ) +)`;; + +let PROIQUZ_hexall_5A1_idq t i = { + ineq = t; + idv = Printf.sprintf "old PROIQUZ hexall 5A1 %d" i; + doc = "split a hex along a shortish diagonal. Flat at node 2. Case $y_5 + 0.1 \\le y_3+y_4$."; + tags = [Tex; Flypaper; Penalty (5., 500.);Widthcutoff 0.01] + (* + This case treats Delta bounded away from 0. + The upper bound is the trivial triangle inequality bound: y5 <= y3 + y4 <= 4 h0. *) +};; + + + +Parse_ineq.execute_cfsqp + { +ineq = all_forall `ineq + [ +(&2,y1,&2 *h0); +(&2,y2,&2 * h0); +(&2,y3,&2 * h0); +(&2,y4,&2 *h0); +(&2 * h0,y34,#3.3); +(&2,y12,&2*h0); +(&2,y14,&2 * h0) + ] + ( + let y23 = y12 in + let y13 = edge_flat y2 y1 y3 y23 y12 in + (delta4_y y1 y3 y4 y34 y14 y13 > &0) \/ (delta_y y1 y3 y4 y34 y14 y13 > &10) \/ + (arclength y3 y4 y34 > #2.42) + )`; + idv = "old PROIQUZ hexall 1-d"; + doc = "split a hex along a shortish diagonal. Flat at y2. Old version of hexall 1..."; + tags = [Tex; Flypaper; Penalty (5., 50.); Xconvert;Deprecated] +};; + + +Parse_ineq.execute_cfsqp + { +ineq = all_forall `ineq + [ +(&2,y1,&2 *h0); +(&2,y2,&2 * h0); +(&2,y3,&2 * h0); +(&2,y4,&2 *h0); +(&2,y12,&2*h0); +(&2 * h0,y34,#4.72); +(&2,y14,&2 * h0) + ] + ( + let y23 = y12 in + let y13 = edge_flat y2 y1 y3 y23 y12 in + (delta_y y1 y3 y4 y34 y14 y13 > &10) \/ + (delta_y y1 y3 y4 y34 y14 y13 < &0) \/ + (delta4_y y1 y3 y4 y34 y14 y13 < &10) \/ + (upper_dih_y y1 y3 y4 y34 y14 y13 < dih_y y1 y2 y4 (&2 * h0) y14 y12) \/ + (arclength y3 y4 y34 > #2.42) + )`; + idv = "old PROIQUZ hexall 1-a"; + doc = "split a hex along a shortish diagonal. Flat at y2. hexall 1..."; + tags = [Tex; Flypaper; Penalty (500., 8000.); Xconvert;Deprecated] +};; + +let euler_ap = new_definition `euler_ap y1 y2 y3 y4 y5 y6 = + y1*y2*y3 + y1*(y2*y2 + y3*y3 - y4*y4)/ &2 + y2*(y1*y1 + y3*y3 - y5*y5)/ &2 + + y3*(y1*y1 + y2*y2 - y6*y6)/ &2`;; + +Parse_ineq.execute_cfsqp + { +ineq = all_forall `ineq + [ +(&2,y1,&2 *h0); +(&2,y2,&2 * h0); +(&2,y3,&2 * h0); +(&2,y4,&2 *h0); +(&2,y12,&2*h0); +(&2 * h0,y34,#4.72); +(&2,y14,&2 * h0) + ] + ( + let y23 = y12 in + let cos242 = -- #0.75 in + let y13 = edge_flat y2 y1 y3 y23 y12 in + (delta_y y1 y3 y4 y34 y14 y13 > &10) \/ + (delta_y y1 y3 y4 y34 y14 y13 < &0) \/ + (delta4_y y1 y3 y4 y34 y14 y13 > &10) \/ + (euler_ap y1 y3 y4 y34 y14 y13 < &0) \/ + (y34 pow 2 > y3 pow 2 + y4 pow 2 - &2 * y3 * y4 * cos242) + )`; + idv = "old PROIQUZ hexall 1-b"; + doc = "split a hex along a shortish diagonal. Flat at y2. "; + (* // upper approximation cos(2.42) *) + tags = [Tex; Flypaper;Penalty (5., 5000.); Xconvert;Deprecated] + (* If euler < 0, and a flat then tau(quad) >= tau(tri) + flatTerm[2] + >= (sol+pi) -sol0 + >= 2pi - sol0 >> tameTableD[6,0]/2, and the estimate holds *) +};; + +let dih1_hexall_x = new_definition `dih1_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 (x6:real) = + dih_x x1 x3 x4 x5 x14 (edge_flat2_x x2 x1 x3 (&0) x23 x12)`;; + + + + + +1;; +(* (dih_y y1 y3 y4 y34 y14 y13 < dih_y y1 y2 y4 (&2 * h0) y14 y12) *) + +for y14=0 to 1 do +for y2 = 0 to 1 do +for i = 0 to 2 do + Parse_ineq.execute_cfsqp (make_hexall y14 y2 i) done done done;; + + + + { +ineq = all_forall `ineq + [ +(&2 pow 2,x1,(&2 *h0) pow 2); +(&2 pow 2,x2,(&2 * h0) pow 2); +(&2 pow 2,x3,(&2 * h0) pow 2); +(&2 pow 2,x4,(&2 *h0) pow 2); +((&2 * h0) pow 2,x5,(&4 * h0) pow 2); +(&1,x6,&1) + ] + ( + let x12 = &2 pow 2 in + let x23 = x12 in + let x14 = &2 pow 2 in + (taum_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 > tame_table_d 6 0 / &2) \/ + (dih1_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 > #2.425) \/ + (delta_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 < &0) \/ + (sqrt(x5) + #0.1 > sqrt(x3) + sqrt(x4)) \/ + (dih_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 > &0 ))`; + idv = "old PROIQUZ hexall 5A"; + doc = "split a hex along a shortish diagonal. Flat at node 2. Case $y_5 + 0.1 \\le y_3+y_4$."; + tags = [Tex; Flypaper; Penalty (5., 500.)] + (* The upper bound is the trivial triangle inequality bound: y5 <= y3 + y4 <= 4 h0. *) +};; + + +Parse_ineq.execute_cfsqp + { +ineq = all_forall `ineq + [ +(&2 pow 2,x1,(&2 *h0) pow 2); +(&2 pow 2,x2,(&2 * h0) pow 2); +(&2 pow 2,x3,(&2 * h0) pow 2); +(&2 pow 2,x4,(&2 *h0) pow 2); +((&2 * h0) pow 2,x5,(&4 * h0) pow 2); +(&1,x6,&1) + ] + ( + let x12 = &2 pow 2 in + let x23 = x12 in + let x14 = &2 pow 2 in + ( #0.871 * delta4_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 < + sqrt (&4 * x1 * delta_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6) \/ + (delta_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 > &10) \/ + (delta_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 < &0) \/ + (delta4_hexall_x x14 x12 x23 x1 x2 x3 x4 x5 x6 > &10) + ) +)`; + idv = "old PROIQUZ hexall 5AZ"; + doc = "split a hex along a shortish diagonal. Flat at node 2. Case $y_5 + 0.1 \\le y_3+y_4$."; + tags = [Tex; Flypaper; Penalty (50., 5000.)] + (* The upper bound is the trivial triangle inequality bound: y5 <= y3 + y4 <= 4 h0. *) +};; + + + + +Parse_ineq.execute_cfsqp + { + ineq = all_forall `ineq + [ + (&2,y1,&2 *h0); + (&2,y3,&2 * h0); + (&2,y4,&2 * h0); + (#2.52,y34,&4); + (&2,y13,#4.05) + ] + ( + let y12 = &2 in + let y2 = &2 in + let y23 = &2 in + let y14 = &2 in + (( arclength y3 y4 y34 < &0) \/ + (dih_y y1 y3 y4 y34 y14 y13 > #2.588) \/ + (arclength y1 y3 y13 > arclength y1 y2 y12 + arclength y2 y3 y23) ))`; + idv = "hexall test5"; + doc = ""; + tags = [Tex; Flypaper; Penalty (5., 50.); Xconvert] +};; + +Parse_ineq.execute_cfsqp + { + ineq = all_forall `ineq + [ + (&2,y1,&2 *h0); + (&2,y3,&2 * h0); + (&2,y4,&2 * h0); + (#2.52,y34,&4); + (&2,y13,#4.05) + ] + ( + let y12 = &2 in + let y2 = &2 in + let y23 = &2 in + let y14 = &2 in + (( arclength y3 y4 y34 < #2.57573) \/ + (dih_y y1 y3 y4 y34 y14 y13 > #2.4776) \/ + (arclength y1 y3 y13 > arclength y1 y2 y12 + arclength y2 y3 y23) ))`; + idv = "hexall test6"; + doc = ""; + tags = [Tex; Flypaper; Penalty (5., 50.); Xconvert] +};; + + +(* end of hex analysis PROIQUZ *) + + + + +(* deprecated *) +let sql = new_definition `sql x = + if (x < &1) + then &3/ &8 + (&3*x)/ &4 - x pow 2 / &8 + + (&1 - x) pow 3 * ((&12/ &10) * x * (&1 - x) - &4/ &10) + else sqrt x`;; + +(* deprecated (* upper bound when d4 < 0 *) *) +let upper_dih_x_large = new_definition `upper_dih_x_large x1 x2 x3 x4 x5 x6 = + (let d = delta_x x1 x2 x3 x4 x5 x6 in + let d4 = delta_x4 x1 x2 x3 x4 x5 x6 in ( + if (d < &1) then + pi + &2 * sqrt x1 * sql d * matan (&4 * x1 * d / (d4 pow 2) ) / d4 + else dih_x x1 x2 x3 x4 x5 x6))`;; + + + +(* deprecated *) +let upper_dih_y_large = new_definition `upper_dih_y_large = y_of_x upper_dih_x_large`;; + +(* deprecated *) +let vol_xl = new_definition + `vol_xl x1 x2 x3 x4 x5 x6 = sql (delta_x x1 x2 x3 x4 x5 x6) / &12`;; + +let vol_yl = new_definition `vol_yl = y_of_x vol_xl`;; + +let vol3rl = new_definition `vol3rl y1 y2 y3 r = vol_yl r r r y1 y2 y3`;; + +let sol_yu_large = new_definition `sol_yu_large y1 y2 y3 y4 y5 y6 = + upper_dih_y y1 y2 y3 y4 y5 y6 + + upper_dih_y y2 y3 y1 y5 y6 y4 + + upper_dih_y_large y3 y1 y2 y6 y4 y5 - pi`;; + +let vol3fu_large = new_definition ` vol3fu_large y1 y2 y3 r f = + (&2 * mm1 / pi) * + (sol_yu_large y1 y2 r r r y3 + sol_yu_large y2 y3 r r r y1 + sol_yu_large y3 y1 r r r y2) - + (&8 * mm2 / pi) * + (f (y1 / &2) * upper_dih_y y1 y2 r r r y3 + + f (y2 / &2) * upper_dih_y y2 y3 r r r y1 + + f (y3 / &2) * upper_dih_y y3 y1 r r r y2)`;; + +let gamma3fl_large = new_definition `gamma3fl_large y1 y2 y3 r f = vol3rl y1 y2 y3 r - vol3fu_large y1 y2 y3 r f`;; + + + +(* tests May 2011 *) + +Ineq.add + { +idv = "test 2065952723 C-3"; +doc = "See explanation in 2065952723. Used to replace extremal edges with minimal edges in a + hexagon. Used in hexagons when every oparc >= 2.42, and after it is established that the + edges (b2) adjacent to the oparc are mimial (via Bp1), this gives that the edge not adjacent to +the oparc is minimal."; +(* 15.53 > 3.94^2, arc[2,2,3.94] > 2 arc[2,2,2 hmid], to get the upper bound. + Lower via, arc[2,2,2.53]+arc[2,2,2] < 2.42 + *) +tags = [Flypaper["UPONLFY"];Tex]; +ineq = all_forall `ineq + [ + (&1 , e1, &1 + sol0/ pi); + (&1 , e2, &1 + sol0/ pi); + (&1 , e3, &1 + sol0/ pi); + ((&2 / h0) pow 2, a2, (&2 * h0) pow 2); + ((&2 / h0) pow 2, b2, &4); + (#2.53 pow 2, c2, #15.53) + ] + ((num1 e1 e2 e3 a2 b2 c2 ) > &0) `; +};; + + +(* Tests May 2011 *) + + + + + +addtex (Section,"Experiments","");; + +Parse_ineq.execute_cfsqp + { +idv = "2065952723 experiment"; +doc = "In a pentagon with one long edge, we can contract the long edge, using 2 diags"; +tags = [Cfsqp;Tex;Flypaper[];]; +ineq = all_forall `ineq + [ + (&1 , e1, &1 + sol0/ pi); + (&1 , e2, &1 + sol0/ pi); + (&1 , e3, &1 + sol0/ pi); + (&2 pow 2, a2, #3.01 pow 2); + (#2.38 pow 2, b2, #15.53); + (#2.38 pow 2, c2, #15.53) + ] + ((num1 e1 e2 e3 a2 b2 c2 > &0) ) `; +};; + + +Parse_ineq.execute_cfsqp + { +idv = "hex experiment, reflex vertex."; +doc = "can go reflexive in a hex"; +tags = [Cfsqp;Tex;Flypaper[];]; +ineq = all_forall `ineq + [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] + ( taum y1 y2 y3 y4 y5 y6 > &0 \/ + (delta_y y1 y2 y3 y4 y5 y6 < (#0.24 pow 2) * ups_x (y2 * y2) (y3* y3) (y4*y4)))`; +};; + + + +Parse_ineq.execute_cfsqp + { +idv = "hex experiment contraction."; +doc = "another failed experiment"; +tags = [Cfsqp;Tex;Flypaper[];]; +ineq = all_forall `ineq + [ + (&1 , e1, &1 + sol0/ pi); + (&1 , e2, &1 + sol0/ pi); + (&1 , e3, &1 + sol0/ pi); + (&1 , e4, &1 + sol0/ pi); + (#3.35 pow 2, a2, #3.915 pow 2); + ((&2/ h0) pow 2, b2,&4); + ((&2/ h0) pow 2, c2,&4); + (#3.01 pow 2, r2,#3.915 pow 2); + (#3.01 pow 2, s2,#3.915 pow 2) + ] + (( rat1 e1 e2 e3 a2 b2 c2 + rat1 e4 e2 e3 a2 r2 s2 > &0) + \/ delta_x (&4) (&4) (&4) a2 b2 c2 < &0 + eulerA_x (&4) (&4) (&4) a2 r2 s2 < &0 \/ + (dih_x (&4) (&4) (&4) a2 b2 c2 > #2.588 )) `; +};; + + +Parse_ineq.execute_cfsqp + { +idv = "hex experiment"; +doc = "cut away a triangle with penalty 0.08"; +tags = [Cfsqp;Tex;Flypaper[];]; +ineq = all_forall `ineq + [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.35); + (&2,y5,&2); + (&2,y6,&2) + ] + ( taum y1 y2 y3 y4 y5 y6 > -- #0.08 \/ + (dih_y y1 y2 y3 y4 y5 y6 > #2.588))`; +};; + + +(* + + (e1 * dih_x (&4) (&4) (&4) a2 b2 c2 + e2 * dih_x (&4) (&4) (&4) b2 c2 a2 + + e3 * dih_x (&4) (&4) (&4) c2 a2 b2 - (pi + sol0) > -- #0.2) \/ + +*) + + +Parse_ineq.execute_cfsqp +{ + idv = "1928747871-0"; + doc="pure hexagon case"; + tags = [Cfsqp;Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] + (taum y1 y2 y3 y4 y5 y6 + > tame_table_d 6 0 \/ y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0 )`; +};; + +Parse_ineq.execute_cfsqp +{ + idv = "1928747871-1"; + doc="pure hexagon case"; + tags = [Cfsqp;Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +(let y126 = edge_flat y6 y1 (&2) (&2) y2 in +(let y135 = edge_flat y5 y1 (&2) (&2) y5 in +(let y234 = edge_flat y4 y2 (&2) (&2) y3 in + (taum y1 y2 y3 y4 y5 y6 + + taum y126 y1 y2 y6 (&2) (&2) + + taum y135 y1 y3 y5 (&2) (&2) + + taum y234 y2 y3 y4 (&2) (&2) + > &3 * #0.001 + tame_table_d 6 0 ) \/ + y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0 \/ + (y126 < #2.0 \/ y126 > #2.52 \/ + y135 < #2.0 \/ y135 > #2.52 \/ + y234 < #2.0 \/ y234 > #2.52))))`; +};; + + +Parse_ineq.execute_cfsqp +{ + idv = "1928747871-2"; + doc="pure hexagon case"; + tags = [Cfsqp;Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,#2.4); + (&2,y2,#2.4); + (&2,y3,#2.4); + (#3.01,y4,#3.47); + (#3.01,y5,#3.47); + (#3.01,y6,#3.47) + ] +((taum y1 y2 y3 y4 y5 y6 > tame_table_d 6 0 ) \/ + y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0)`; +};; + + +Parse_ineq.execute_cfsqp +{ + idv = "1928747871-(1)"; + doc="pure hexagon case, side triangle"; + tags = [Cfsqp;Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( +(let y234 = edge_flat y4 y3 (&2) (&2) y2 in +(taum y1 y2 y3 y4 y5 y6 + #0.013 > taum y234 y2 y3 y4 y5 y6) \/ +(y234 > #2.52) \/ (y234 < #2.0)))`; +};; + +Parse_ineq.execute_cfsqp +{ + idv = "1928747871-(2)"; + doc="pure hexagon case, side triangle (2)"; + tags = [Cfsqp;Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( +(taum y1 y2 y3 y4 y5 y6 + #0.001 > taum (#2.52) y2 y3 y4 y5 y6) \/ +(delta_y (#2.52) y2 y3 y4 y5 y6 < &0) \/ (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ +taum (#2.52) y2 y3 y4 y5 y6 > taum (&2) y2 y3 y4 y5 y6 +)`; +};; + + + +Parse_ineq.execute_cfsqp +{ + idv = "1928747871-(3)"; + doc="pure hexagon case, side triangle (3)"; + tags = [Cfsqp;Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + ( taum y1 y2 y3 y4 y5 y6 + #0.09 > taum (&2) y2 y3 y4 y5 y6) \/ + (delta_y (&2) y2 y3 y4 y5 y6 < &0) \/ +(delta_y (#2.52) y2 y3 y4 y5 y6 < &0) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) +)`; +};; + +(* taum (#2.52) y2 y3 y4 y5 y6 > taum (&2) y2 y3 y4 y5 y6 \/ + +*) + + + +Parse_ineq.execute_cfsqp +{ + idv = ""; + doc="upper bound on minor variable when top edges are 2. + This has been replaced with a delta version."; + tags = [Cfsqp;Penalty(50.0,500.0);Xconvert;Tex;Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#4.52) + ] +((y3 < #3.915) \/ (arclength y1 (&2) (&2) + arclength y2 (&2) (&2) < arclength y1 y2 y3) + \/ (y3 > y1 + y2) )`; +};; + + +Parse_ineq.execute_cfsqp +{ + idv = "test temp"; + doc="pure hexagon case"; + tags = [Cfsqp;Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.3,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] + (rhazim y1 y2 y3 y4 y5 y6 + #0.6 * (-- &2 * y1 + y2 + y3) > &0 \/ delta_y y1 y2 y3 y4 y5 y6 < &0)`; +};; + + + +add { +idv = "2065952723 C-3z"; +doc = "If minor diag >= 3, then 3/1.26 > 2.38 and we can contract. + 15.53: arc[2,2,2.52]2 < arc[2,2,Sqrt[15.53]]. + Added May 12, 2011. + Replace May 15, 2011, with an inequality with bigger upper b2 bound."; +tags = [Cfsqp;Tex;Flypaper[];Deprecated]; +ineq = all_forall `ineq + [ + (&1 , e1, &1 + sol0/ pi); + (&1 , e2, &1 + sol0/ pi); + (&1 , e3, &1 + sol0/ pi); + ((&2 / h0) pow 2, a2, (&2 * h0) pow 2); + ((&2 / h0) pow 2, b2, (&2 * h0) pow 2); + (#2.38 pow 2, c2, #15.53) + ] + ((num1 e1 e2 e3 a2 b2 c2 ) > &0) `; +};; + + +Parse_ineq.execute_cfsqp + { +idv = "206 ee2"; +doc = "FALSE"; +tags = [Cfsqp;Tex;Flypaper[];]; +ineq = all_forall `ineq + [ + (&1 , e1, &1 + sol0/ pi); + (&1 , e2, &1 + sol0/ pi); + (&1 , e3, &1 + sol0/ pi); + ((&2 ) pow 2, a2, (#3.01) pow 2); + ((&2) pow 2, b2, #3.01 pow 2); + (#2.38 pow 2, c2, #15.53) + ] + ((num1 e1 e2 e3 a2 b2 c2 ) > &0) `; +};; + + +Parse_ineq.execute_cfsqp +{ + idv = "un"; + doc="quad case both diags > 3.01, y5, y9 long"; + tags = [Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.22); + (#2.52,y5,#2.52); + (#2.0,y6,&2); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (#2.52,y9,#2.52)] +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > tame_table_d 2 2) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ))`; +};; + + + + +Parse_ineq.execute_cfsqp +{ + idv = "un"; + doc="quad case both diags > 3.01, y5, y9 long. + Triangulate if a diagonal <= 3.3."; + tags = [Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.3,y4,#3.41); + (#2.52,y5,#2.52); + (#2.0,y6,&2); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (#3.01,y9,#3.01)] +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > tame_table_d 2 2) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.3 ))`; +};; + + +Parse_ineq.execute_cfsqp +{ + idv = "un"; + doc="quad case both diags > 3.01, y5, y9 long"; + tags = [Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.62); + (#3.01,y5,#3.01); + (#2.0,y6,&2); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (#3.01,y9,#3.01)] +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > tame_table_d 2 2) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ))`; +};; + + +Parse_ineq.execute_cfsqp +{ + idv = "un"; + doc="quad case both diags > 3.01, y6, y9 long"; + tags = [Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.18); + (#2.0,y5,&2); + (#2.52,y6,#2.52); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (#2.52,y9,#2.52)] +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > tame_table_d 2 2) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ))`; +};; + + +Parse_ineq.execute_cfsqp +{ + idv = "un"; + doc="quad case both diags > 3.01, y6, y9 long"; + tags = [Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.33); + (#2.0,y5,&2); + (#2.52,y6,#2.52); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (#3.01,y9,#3.01)] +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > tame_table_d 2 2) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ))`; +};; + + +Parse_ineq.execute_cfsqp +{ + idv = "un"; + doc="quad case both diags > 3.01, y6, y9 long"; + tags = [Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.47); + (#2.0,y5,&2); + (#3.01,y6,#3.01); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (#3.01,y9,#3.01)] +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > tame_table_d 2 2) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ))`; +};; + + + +{ + idv="3916387088"; + doc="quad case both diags > 3.01, y8, y9 long + This case has been deprecated. We can deform y9 to shorten by 8964099283 + "; + tags = [Main_estimate;Quad_cluster 0.001;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0); + Deprecated]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.47); + (#2.0,y5,&2); + (#2.0,y6,&2); + (#2.0,y7,&2 * h0); + (#3.01,y8,#3.01); + (#3.01,y9,#3.01)] +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > tame_table_d 2 2) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ))`; +};; + +{ + idv="4033589145"; + doc="quad case both diags > 3.01, y8, y9 long. + This case is now triangulated with long diagonal."; + tags = [Main_estimate;Quad_cluster 0.001;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0); + Deprecated]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.18); + (#2.0,y5,&2); + (#2.0,y6,&2); + (#2.0,y7,&2 * h0); + (#2.52,y8,#2.52); + (#2.52,y9,#2.52)] +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > tame_table_d 2 2) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ))`; +};; + + + + +{ + idv="8035675159"; + doc="quad case both diags > 3.01, y8, y9 long"; + tags = [Main_estimate;Quad_cluster 0.001;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0); + Deprecated]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.33); + (#2.0,y5,&2); + (#2.0,y6,&2); + (#2.0,y7,&2 * h0); + (#2.52,y8,#2.52); + (#3.01,y9,#3.01)] +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > tame_table_d 2 2) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ))`; +};; + + +skip +{ + idv="5501385627"; + doc=" tameTableD[2,2]. + Triangulate quad with diagonal y4. + Case both diags > 3.01, y8, y9 long, short diagonal doesn't separate long edges. + Shorter diag < 3.15 + + This has delta=0 issues that are resolved by using tau_lowform_x. + Ran overnight May16-17, 2011 several hours and it didn't pass. + "; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.15); + (&2,y5,&2); + (&2,y6,&2) + ] +( + ( y_of_x tau_lowform_x y1 y2 y3 y4 y5 y6 > -- #0.2 ) + )`; +};; + + +skip +{ + idv="8672459448"; + doc=" tameTableD[2,2]. + Case both diags > 3.01, y8, y9 long (at 2.52 and 3.01), + short diagonal doesn't separate long edges. + Shorter diag < 3.15 + Triangulate quad with diagonal y4"; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.15); + (#3.01,y5,#3.01); + (#2.52,y6,#2.52) + ] +( + ( taum y1 y2 y3 y4 y5 y6 > tame_table_d 2 2 + #0.2 ) + )`; +};; + + + + + +experiment { + idv="4680581274 test modification"; + doc="quad case both diags > 3.01, y9 long"; + tags = [Main_estimate;Cfsqp;Quad_cluster 0.001;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.166); + (#2.0,y5,&2); + (#2.0,y6,&2); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (#3.01,y9,#3.01)] +(( (let d = delta_y y1 y2 y3 y4 y5 y6 in + (rho (y1) * pi - (pi + sol0) + + sqp d * y_of_x rhazim_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 + + sqn d * (#0.1 + - #0.02 * (y2 + y3 - &2 * #2.52) - #0.06 * (y4 - #3.166)) )) + + taum y7 y2 y3 y4 y8 y9 > #0.696 - #0.11) \/ + delta4_y y1 y2 y3 y4 y5 y6 > -- #11.2 \/ + delta_y y1 y2 y3 y4 y5 y6 < &0 \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ))`; +};; + +(* +y_of_x rhazim2_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 +*) + +(* + y_of_x rhazim2_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 + + y_of_x rhazim3_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 > #0.1 + - #0.02 * (y2 + y3 - &2 * #2.52) - #0.06 * (y4 - #3.166) +*) + + + +Ineq.add +{ + idv="5501385627 test"; + doc=" tameTableD[2,2]. + Triangulate quad with diagonal y4. + Case both diags > 3.01, y8, y9 long, diagonal doesn't separate long edges. + Shorter diag < 3.15 + + This has delta=0 issues that are resolved by using tau_lowform_x. + Ran overnight May16-17 several hours and it didn't pass. + "; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.15); + (&2,y5,&2); + (&2,y6,&2) + ] +( + ( y_of_x tau_lowform_x y1 y2 y3 y4 y5 y6 > -- #0.2 ) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &5) + )`; +};; + + +(* May 22, 2011 experiments *) + + +experiment { + idv=""; + doc=""; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.166); + (&2,y5,&2); + (&2,y6,&2) + ] +( + taum y1 y2 y3 y4 y5 y6 > -- #0.08 \/ + delta_y y1 y2 y3 y4 y5 y6 < -- &25 + )`; +};; + + + +experiment { + idv=""; + doc=""; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.166); + (sqrt8,y5,sqrt8); + (&2,y6,&2) + ] +( + taum y1 y2 y3 y4 y5 y6 > #0.696 - #0.11 + #0.08 + )`; +};; + +experiment { + idv=""; + doc=""; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( delta_y (#2.52) y2 y3 y4 (&2) (&2) > &0 \/ + (taum y1 y2 y3 y4 y5 y6 )/ &3 - sol0 + + #0.34 * (&2 * y4 - y5 - y6) > (#0.6)/ &3 + )`; +};; + +experiment { + idv="FALSE ONE."; + doc=" This shows that taum_residual is always negative on the given domain. + This should be rewritten in terms of the residual. + "; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.36); + (&2,y5,#2.52); + (&2,y6,#2.52) + ] +( +y_of_x tau_residual_x y1 y2 y3 y4 y5 y6 < &0 + \/ + (delta4_y y1 y2 y3 y4 y5 y6 > -- #11.2) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ + (taum y1 y2 y3 y4 y5 y6 > #0.25) + )`; +};; + +(* +(( taum y1 y2 y3 y4 y5 y6 - ((rho y1) * pi - (pi+sol0)))/ (#0.0001 + sqrt(delta_y y1 y2 y3 y4 y5 y6)) < &0) +*) + +experiment { + idv=""; + doc="Debug implementation test of tau_lowform "; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (#2.1,y1,#2.1); + (#2.2,y2,#2.2); + (#2.3,y3,#2.3); + (#3.6,y4,#3.6); + (#2.5,y5,#2.5); + (#2.6,y6,#2.6) + ] +( + ( y_of_x tau_lowform_x y1 y2 y3 y4 y5 y6 > taum y1 y2 y3 y4 y5 y6 - &1 ) + )`; +};; + +experiment +{ + idv=""; + doc="Aux 734849949. To show for some diag cut, the small delta > 37"; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.63); + (#3.01,y5,#3.651); + (&2,y6,&2) + ] +( + dih_y y1 y2 y3 y4 y5 y6 < #2.08 \/ + ((y4 - #3.2) > #0.55 * (y2 + y3 - &4)) + )`; +};; + +experiment +{ + idv=""; + doc="Aux 734849949. To show for some diag cut, the small delta > 37."; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (&2,y5,&2); + (#3.01,y6,#3.651) + ] +( + dih_y y1 y2 y3 y4 y5 y6 < #0.51 \/ + delta_y y1 y2 y3 y4 y5 y6 > &37 \/ + delta_y y1 y2 y3 y4 y5 y6 < &0 + )`; +};; + +experiment +{ + idv=""; + doc="Aux 734849949. To show for some diag cut, the small delta > 37."; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (&2,y5,&2); + (#3.01,y6,#3.651) + ] +( + taum y1 y2 y3 y4 y5 y6 > &0 \/ + delta_y y1 y2 y3 y4 y5 y6 < &37 + )`; +};; + + +experiment +{ + idv=""; + doc="Aux 734849949. To show for some diag cut, the small delta > 37."; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.356); + (&2,y5,&2); + (&2,y6,&2) + ] +( + dih_y y1 y2 y3 y4 y5 y6 > #2.08 + #0.51 \/ + delta_y y1 y2 y3 y4 y5 y6 > &37 \/ + delta_y y1 y2 y3 y4 y5 y6 < &0 + )`; +};; + +experiment +{ + idv="experiment May 18, 2011, 7348498949"; + doc="pentagon case, quad piece, cut along y9. + Upper bound on diagonal: + Solve[Delta[x, 2, 2, x, 2, 3.63] == 0, x](*x < 3.356 *) "; + tags = [Main_estimate;Quad_cluster 0.001;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0); + Widthcutoff 0.08]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.651); + (#2.0,y5,&2); + (#2.0,y6,&2); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (#3.01,y9,#3.63); + (#3.01,cd,#3.651) +] +(( delta_y y1 y2 y3 y4 y5 y6 > &65) \/ + (delta_y y3 y1 y7 cd y8 y5 > &65) \/ + ((y9 - #3.2) > #0.55 * (y2 + y7 - &4)) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < cd ))`; +};; + + +experiment +{ + idv="7348498949 37 616"; + doc="pentagon case, quad piece, cut along y9. + Upper bound on diagonal: + Use whichever diagonal produces the (2,2,diag) triangle with largest delta. + Solve[Delta[x, 2, 2, 3.01, 3.63, 2] == 0, x] (* x < 3.651 *) + shorter diag (not used): + Solve[Delta[x, 2, 2, x, 2, 3.63] == 0, x](*x < 3.356 *). + Experiment May 18, 9am, try 0.616 instead of 0.696. "; + tags = [Main_estimate;Quad_cluster 0.001;Cfsqp;Xconvert;Tex;Penalty(1500.0,5000.0); + (* Widthcutoff 0.08 *)]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.651); + (#2.0,y5,&2); + (#3.01,y6,#3.63); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (#2.0,y9,&2) +] +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > #0.616) \/ + ((y6 - #3.2) > #0.55 * (y2 + y1 - &4)) \/ + delta_y y7 y2 y3 y4 y8 y9 < &37 \/ + delta4_y y7 y2 y3 y4 y8 y9 > -- #11.2 \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ))`; +};; + +experiment +{ + idv=""; + doc="taum 1st deriv test."; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + ( tau_m_diff_quotient y1 y2 y3 y4 y5 y6 pow 2 > #0.031) \/ + (delta_y y1 y2 y3 y4 y5 y6 > &15) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +addtex(Section,"","skinny triangles");; + +add +{ + idv=""; + doc="linear bound on taum, 2,2,2."; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(1500.0,5000.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2); + (#2.0,y2,#2); + (&2,y3,#2); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (y_of_x tau_lowform_x y1 y2 y3 y4 y5 y6 > #4.488 - #1.4579 * y4 ) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +add +{ + idv=""; + doc="linear bound on taum, 2.52,2,2."; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(1500.0,5000.0);Deprecated]; + ineq = all_forall `ineq [ + (#2.52,y1,#2.52); + (#2.0,y2,#2); + (&2,y3,#2); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (y_of_x tau_lowform_x y1 y2 y3 y4 y5 y6 > #4.488 - #1.4579 * y4 ) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + + +add +{ + idv=""; + doc="linear bound on taum, flat,2,2."; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(1500.0,5000.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2); + (&2,y3,#2); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (?? > #4.488 - #1.4579 * y4 ) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + + + +add +{ + idv="test"; + doc="hexagon case, triangulated by large inner triangle. + Three outer triangles replaced with linear lower bounds. + Bottom edges 2,2,2. + "; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,&2); + (#2.0,y2,&2); + (&2,y3,&2); + (#3.01,y4,#3.47); + (#3.01,y5,#3.47); + (#3.01,y6,#3.47) + ] +( + ( taum y1 y2 y3 y4 y5 y6 + + #4.488 - #1.4579 * y4 + + #4.488 - #1.4579 * y5 + + #4.488 - #1.4579 * y6 +> #0.0) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0))`; +};; + +add +{ + idv="test"; + doc="hexagon case, triangulated by large inner triangle. + Three outer triangles replaced with linear lower bounds. + Bottom edges 2.52,2,2. + "; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (#2.52,y1,#2.52); + (#2.0,y2,&2); + (&2,y3,&2); + (#3.01,y4,#3.47); + (#3.01,y5,#3.737); + (#3.01,y6,#3.737) + ] +( + ( taum y1 y2 y3 y4 y5 y6 + + #4.488 - #1.4579 * y4 + + #3.2139 - #1.009 * y5 + + #3.2139 - #1.009 * y6 +> #0.0) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0))`; +};; + + +add +{ + idv="test"; + doc="hexagon case, triangulated by large inner triangle. + Three outer triangles replaced with linear lower bounds. + Bottom edges 2.52,2.52,2. + "; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (#2.52,y1,#2.52); + (#2.52,y2,#2.52); + (&2,y3,&2); + (#3.01,y4,#3.737); + (#3.01,y5,#3.737); + (#3.01,y6,#3.915) + ] +( + ( taum y1 y2 y3 y4 y5 y6 + + #3.2139 - #1.009 * y4 + + #3.2139 - #1.009 * y5 + + #3.2883 - #0.98119 * y6 +> #0.0) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0))`; +};; + + +add +{ + idv="test"; + doc="hexagon case, triangulated by large inner triangle. + Three outer triangles replaced with linear lower bounds. + Bottom edges 2.52,2.52,2.52 + "; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (#2.52,y1,#2.52); + (#2.52,y2,#2.52); + (#2.52,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( + ( taum y1 y2 y3 y4 y5 y6 + + #3.2883 - #1.009 * y4 + + #3.2883 - #1.009 * y5 + + #3.2883 - #0.98119 * y6 +> #0.0) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0))`; +};; + +(* +We get zeros via y2,y3 in {2,2.52} in +x /. Solve[Delta[2, y2, y3, x, 2, 2] == 0, x] // N // FullForm +{3.01, 3.4641016151377544, 3.7355742827650995, 3.914039468375351} +*) + +experiment. +{ + idv="test"; + doc="hexagon case, two oppositely situated flat vertices, making an effective quad. + Triangulated by short diagonal. + Bottom edges ?,2,2. + "; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,&2); + (&2,y3,&2); + (#3.01,y4,#3.47); + (#3.01,y5,#3.47); + (#3.01,y6,#3.47) + ] +( + let plow = (\y. #4.498 - #1.4579 * y) in + let pmid = (\y. #3.2139 - #1.0009 * y) in + let phi = (\y. #3.2883 - #0.98119 * y) in + let psol = (\(y:real). -- #0.552) in + ( taum y1 y2 y3 y4 y5 y6 + plow y4 + plow y5 + plow y6 > &0) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0))`; +};; + +(* OLD: +let template_ineq_hexx = +`\y2fix y3fix y4max y5min y5max y6min y6max p4 p5 p6. + ineq [ + (&2,y1,#2.52); + (y2fix,y2,y2fix); + (y3fix,y3,y3fix); + (#3.01,y4,y4max); + (y5min,y5,y5max); + (y6min,y6,y6max) + ] +( ( taum y1 y2 y3 y4 y5 y6 + p4 y4 + p5 y5 + p6 y6 > #0.723) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0))`;; +*) + + +(* OLD: +let mk_hex i4 i5 i6 = + (* we subtract off small correction terms to simplify proofs *) + let plo = `(\y. #4.498 - #0.02 - #1.4579 * y)` in + let pmid = `(\y. #3.2139 - #0.025 - #1.0009 * y)` in + let phi = `(\y. #3.2883 - #0.01 - #0.98119 * y)` in + let psol = `(\ (y:real). -- sol0 )` in + let y2fix = List.nth [`&2`;`#2.52`;`#2.52`] i4 in + let y3fix = List.nth [`&2`;`&2`;`#2.52`] i4 in + (* round up on these values *) + let (y3,y34,y37,y39) = (`#3.01`,`#3.46411`,`#3.73558`,`#3.91404`) in + let (p4,y4max) = List.nth [(plo,y34);(pmid,y37);(phi,y39)] i4 in + let vlo = [(y3,y34,plo);(y34,y37,psol)] in + let vhi = [(y3,y37,pmid);(y37,y39,psol)] in + let (y5min,y5max,p5) = + let v = if (i4<2) then vlo else vhi in List.nth v i5 in + let (y6min,y6max,p6) = + let v = if (i4<1) then vlo else vhi in List.nth v i6 in + let inq = + mk_tplate template_ineq_hexx + [y2fix;y3fix;y4max;y5min;y5max;y6min;y6max;p4;p5;p6] in + let s = string_of_int in + let ext = " "^(s i4)^(s i5)^(s i6) in + template_record_hexx inq ext;; + +*) + + +(* PENTAGONS, CHaff from May 22-23, 2011. *) + + +skip +{ + idv="6438897006"; + doc="pentagon case (4,1), quad piece, cut along y9 + The upper bound on the shorter diagonal determined by + Solve[Delta[x, 2, 2, x, 2, 3.01] == 0, x], (* x < 3.166 *). + Deprecated because it is a special case of 4680581274."; + tags = [Main_estimate;Quad_cluster 0.001;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0); + Deprecated]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.166); + (#2.0,y5,&2); + (#2.0,y6,&2); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (#3.01,y9,#3.01)] +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > tame_table_d 4 1 - #0.11) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ))`; +};; + + +let template_ineq_pent = +`\y1fix y2fix y3fix p5 p6. + ineq [ + (y1fix,y1,y1fix); + (y2fix,y2,y2fix); + (y3fix,y3,y3fix); + (&2,y4,&2); + (#3.01,y5,#3.23607); + (#3.01,y6,#3.23607) + ] +( + ( taum y1 y2 y3 y4 y5 y6 + p5 y5 + p6 y6 > #0.616) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ + (dih_y y1 y2 y3 y4 y5 y6 + dih_y y1 y2 (&2) (&2) (&2) y6 + + dih_y y1 (&2) y3 (&2) y5 (&2) < dih_y y1 y2 y3 (#3.01) (&2) (&2)) +)`;; + + +let template_record_pent inq ext = +{ + idv=("test5"^ext); + doc="pentagon case, triangulated with a large central triangle. + Wlog no vertex of the central triangle is flat, so y1,y2,y3 are extremal. + Outer triangles are removed and replaced with p bounds."; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = inq; +};; + + (* we subtract off small correction terms to make things easier to prove *) + + +(* +pmid: interp[x, {3.01, + taumar[2, 2, 2.52, 3.01, 2, 2]}, {3.23607, taumar[2, 2, 2.52, 3.23607, 2, + 2]}] // ExpandAll + +phi: interp[x, {3.01, + taumar[2, 2.52, + 2.52, 3.01, 2, 2]}, {3.23607, taumar[2, 2.52, 2.52, 3.23607, 2, 2]}] // + ExpandAll +*) + +let mk_pent i1 j4 = + let plo = `(\y. #4.498 - #0.02 - #1.4579 * y)` in + let pmid = `(\y. #0.713 - #0.177 * y)` in + let phi = `(\y. #0.752 - #0.174 * y)` in + let y1fix = List.nth [`&2`;`#2.52`] i1 in + let y2fix = List.nth [`&2`;`#2.52`;`#2.52`] j4 in + let y3fix = List.nth [`&2`;`&2`;`#2.52`] j4 in + let (p5) = if (i1<1 && j4<1) then plo + else (if (i1>0 && j4>0) then phi else pmid) in + let (p6) = if (i1<1 && j4<2) then plo + else (if (i1>0 && j4>1) then phi else pmid) in + let inq = + mk_tplate template_ineq_pent + [y1fix;y2fix;y3fix;p5;p6] in + let s = string_of_int in + let ext = " "^(s i1)^(s j4) in + template_record_pent inq ext;; + +(* closest case is 2 1 1*) + + for i1=0 to 1 do + for j4 = 0 to 2 do + experiment(mk_pent i1 j4) done done;; + + + +addtex(Comment,"", + " + The context is a pentagon whose top edges are all 2. + The diagonals are all at least 3.01. + Since tameTableD[5,0] < 0.696, the tameTableD[5,0] bound is a corollary of 0.696. + Thus, it is enough to treat 0.696. + + The general strategy is that there must exist a triangle with + minor diag <= 3.63 and angle <= 2.355. + The constant 2.355 comes from the tau calculation: + Solve[5x - 3(Pi + sol0) == 0.696, x] (* gives 2.354... *) + The constant 3.63 comes by an ineq that follows. + This triangle is cut from the pentagon, leaving a quad case that can be done directly. + The lower bound of tau on the cut triangle is 0. + ");; + +add +{ + idv="8655116269 a"; + doc="pentagon case, clipped smallest angled side triangle. + If dih clipped < 2.355, then y4 < 3.63. + "; + tags = [Main_estimate;Cfsqp;Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.63,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( +(dih_y y1 y2 y3 y4 y5 y6 > #2.355 )\/ +(delta4_y y1 y2 y3 y4 y5 y6 < &0) )`; +};; + + +add { + idv="8655116269 b"; + doc="pentagon case, clipped smallest angled side triangle. + Case dih > pi/2. + If dih clipped < 2.355, then y4 < 3.63. + The dih_y > #2.355 disjunct has been linearized, using delta4 < 0. + "; + tags = [Main_estimate;Cfsqp;Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.63,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( +( (let tan_sq_lower = &1 in + delta4_squared_y y1 y2 y3 y4 y5 y6 * tan_sq_lower > + &4 * x1_delta_y y1 y2 y3 y4 y5 y6 ) \/ +(delta4_y y1 y2 y3 y4 y5 y6 > &0) \/ + + (delta_y y1 y2 y3 y4 y5 y6 < &0) ))`; +};; + + +add +{ + idv="3193572903 a"; + doc="pentagon case, clipped smallest angled side triangle. + If all dih > 2.355, then tau >= 5 (2.355) - 3 (pi + sol0) > 0.696 =largest pent constant"; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.63); + (&2,y5,&2); + (&2,y6,&2) + ] +( + ( taum y1 y2 y3 y4 y5 y6 > #0.0) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ + (delta4_y y1 y2 y3 y4 y5 y6 < &0))`; +};; + + + +add +{ + idv="3193572903 b"; + doc="pentagon case, clipped smallest angled side triangle. + Case dih > pi/2. + If all dih > 2.355, then tau >= 5 (2.355) - 3 (pi + sol0) > 0.696 =largest pent constant"; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.63); + (&2,y5,&2); + (&2,y6,&2) + ] +( + ( taum y1 y2 y3 y4 y5 y6 > #0.0) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ +(delta4_y y1 y2 y3 y4 y5 y6 > &0) \/ +(let tan_sq_lower = &1 in + delta4_squared_y y1 y2 y3 y4 y5 y6 * tan_sq_lower > + &4 * x1_delta_y y1 y2 y3 y4 y5 y6 ) )`; +};; + + +add +{ + idv="2050588100 a"; + doc="pentagon case, clipped smallest angled side triangle. + Here is an additional linear constraint on edge lengths."; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.63); + (&2,y5,&2); + (&2,y6,&2) + ] +( + ( (y4 - #3.2) < #0.55 * (y2 + y3 - &4)) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ +(delta4_y y1 y2 y3 y4 y5 y6 < &0) )`; +};; + +add +{ + idv="2050588100 b"; + doc="pentagon case, clipped smallest angled side triangle. + Case dih > pi/2. + Here is an additional linear constraint on edge lengths. + Tan[Pi - 2.355]^2 is approx 1.00479. + The disjunct is a reworking of dih_y > 2.355."; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.63); + (&2,y5,&2); + (&2,y6,&2) + ] +( + ( (y4 - #3.2) < #0.55 * (y2 + y3 - &4)) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ +(delta4_y y1 y2 y3 y4 y5 y6 > &0) \/ +(let tan_sq_lower = #1.0047 in + delta4_squared_y y1 y2 y3 y4 y5 y6 * tan_sq_lower > + &4 * x1_delta_y y1 y2 y3 y4 y5 y6 ) + )`; +};; + + +add +{ + idv="7348498949 37"; + doc="pentagon case, quad piece, cut along y9. + Upper bound on diagonal: + Use whichever diagonal produces the (2,2,diag) triangle with largest delta. + Solve[Delta[x, 2, 2, 3.01, 3.63, 2] == 0, x] (* x < 3.651 *) + shorter diag calc (not used): + Solve[Delta[x, 2, 2, x, 2, 3.63] == 0, x](*x < 3.356 *) ; + + Pending replacement by 37 616"; + tags = [Main_estimate;Quad_cluster 0.001;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0); + (* Widthcutoff 0.08 *)]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.651); + (#2.0,y5,&2); + (#3.01,y6,#3.63); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (#2.0,y9,&2) +] +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > #0.696) \/ + ((y6 - #3.2) > #0.55 * (y2 + y1 - &4)) \/ + delta_y y7 y2 y3 y4 y8 y9 < &37 \/ + delta4_y y7 y2 y3 y4 y8 y9 > -- #11.2 \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ))`; +};; + + +add +{ + idv="7348498949 slit"; + doc=""; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.356); + (&2,y5,&2); + (#3.01,y6,#3.63) + ] +( let slit = #0.25 in taum y1 y2 y3 y4 y5 y6 + slit > #0.696 + \/ + ((y6 - #3.2) > #0.55 * (y1 + y2 - &4)) +)`; +};; + + +addtex (Section,"Tame Table D","Pentagons table[4,1]");; + +addtex(Comment,"", +" +The context is a pentagon with one edge in the range [2.52,3.01], obtained +by a cut on a hexagon. +All diagonals are at least 3.01. +All noncut top edges are 2. +This constant appears directly in the ad hoc LP inequalities +and as part of the tameTableD[6,0] calculation. +");; + +(* +tameTableD[4,1]=0.6548 = tameTableD[6,0]-tameTableD[2,1]. +*) + + +addtex(Comment,"", +" + We continue to contract the long edge, even make it less than 2.52, + until it reaches 2, in which case (0) the 0.696 estimate takes over. + + (1) Or until a diagonal hits 3.01, where the long edge lands in the triangle, + leaving a quad with top edges 2,2,2,3.01. The shortest edge of the quad + is given by Solve[Delta[x,2,2,x,2,3.01]==0,x], which implies x <= 3.166. + Cut along this diagonal to triangulate. + + (2) Or until two diagonals hit 3.01, triangulating the pent. + There are two diagonals, because after the first hits and is fixed at 3.01 + assuming the long edge lands in the quad, + we can continue contraction on the quad. + + Note: if a flat node develops (with some edge > 2), + the usual tricks can be used to dissolve it. +");; + +skip +{ + idv="4680581274 slit"; + doc="constant -11.2 was changed to 0, so we no longer need this."; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.166); + (&2,y5,&2); + (#3.01,y6,#3.01) + ] +( let slit = #0.25 in taum y1 y2 y3 y4 y5 y6 + slit > #0.696 - #0.11 )`; +};; + +skip +{ + idv="2428128897"; + doc=" delta=0 issues. + VERY GOOD DELTA ISSUE RESOLVER + If taum > 0.25, we can use the 'split' cases below to break off the skinny triangle. + If taum <= 0.25 then delta4_y < -- #11.2, which we can then assume everywhere. + - + Probably not needed now. + Actually, we can just use 4559601669, and settle for delta4 < 0, and drop this out. + Then we don't need slits at all. + "; + tags = [Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (delta4_y y1 y2 y3 y4 y5 y6 < -- #11.2) \/ + ( taum y1 y2 y3 y4 y5 y6 > #0.25) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + + +skip +{ + idv = "4240815464 b"; + doc="This is a variation of '4240815464 a' with a relaxed constant to make it quicker to prove."; + tags = [Cfsqp;Tablelp;Flypaper["KCBLRQC"];Tex;Xconvert;Lp;Penalty(10000.0,500.0);Dim_red_backsym;Quad_cluster 0.05]; + ineq = all_forall `ineq (dart_std4 y1 y2 y3 y4 y5 y6 y7 y8 y9) +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 + + #0.7573 *dih_y y1 y2 y3 y4 y5 y6 - #1.432 > #0.0) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < sqrt8 ) \/ + (y4 < #3.02) \/ +( delta_y y1 y2 y3 y4 y5 y6 < &0) \/ +( delta_y y7 y2 y3 y4 y8 y9 < &0)) `; +};; + +skip{ + idv = "4240815464 b reduced"; + doc="We can use dimension reduction methods to reduce the number of variables. + This is the reduced version that occurs when the cross diagonal is minimal. + See 'Quad convexity justification' comment. "; + tags = [Cfsqp;Lp_aux "4240815464 b";Tex;Xconvert]; + ineq = all_forall `ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2,y4,&2 * h0); + (&2 * h0,y5,sqrt8); + (&2,y6,&2 * h0) + ] +( taum y1 y2 y3 y4 y5 y6 + + #0.7573 *dih_y y1 y2 y3 y4 y5 y6 - #1.432 / &2 > #0.0)`; +};; + +skip{ + idv = "4240815464 front"; + doc="We can use dimension reduction methods to reduce the number of variables. + This is the reduced version that occurs when the cross diagonal is minimal. + See 'Quad convexity justification' comment. "; + tags = [Cfsqp;Lp_aux "4240815464 b";Tex;Xconvert]; + ineq = all_forall `ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2 * h0,y4,#3.02); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) + ] +( taum y1 y2 y3 y4 y5 y6 + (#0.101 + #0.12 * (y2 + y3 - &4) ) + + #0.7573 *dih_y y1 y2 y3 y4 y5 y6 - #1.432 > #0.0)`; +};; + +skip{ + idv = "4240815464 back"; + doc="We can use dimension reduction methods to reduce the number of variables. + This is the reduced version that occurs when the cross diagonal is minimal. + See 'Quad convexity justification' comment. "; + tags = [Cfsqp;Lp_aux "4240815464 b";Tex;Xconvert]; + ineq = all_forall `ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2 * h0,y4,#3.02); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) + ] +( taum y1 y2 y3 y4 y5 y6 > #0.101 + #0.12 * (y2 + y3 - &4) )`; +};; + + + +experiment + { + idv = "6944699408 b"; + doc=" + Don't use, we were able to get 6944699408 a to run in about 5min without it. + We can use dimension reduction methods to reduce the number of variables."; + tags = [Cfsqp;Tablelp;Flypaper["KCBLRQC"];Lp;Xconvert;Tex;Dim_red_backsym;Quad_cluster 0.0005]; + ineq = all_forall `ineq (dart_std4 y1 y2 y3 y4 y5 y6 y7 y8 y9) +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 + #0.972 * dih_y y1 y2 y3 y4 y5 y6 - #1.707 > #0.0) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < sqrt8 ) )`; +};; + +experiment{ + idv = "6944699408 b reduced"; + doc=" Don't use, we were able to get 6944699408 a to run in about 5min without it. +We can use dimension reduction methods to reduce the number of variables. + This is the reduced version that occurs when the cross diagonal is minimal. + See 'Quad convexity justification' comment. + " ; + tags = [Cfsqp;Lp_aux "6944699408 a";Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2,y4,&2 * h0); + (&2 * h0,y5,sqrt8); + (&2,y6,&2 * h0) + ] +( taum y1 y2 y3 y4 y5 y6 + #0.972 * dih_y y1 y2 y3 y4 y5 y6 - #1.707 / &2 > #0.0) `; +};; + + + +experiment{ + idv = "6944699408 front"; + doc=" Don't use, we were able to get 6944699408 a to run in about 5min without it. + We can use dimension reduction methods to reduce the number of variables. + This is the reduced version that occurs when the cross diagonal is minimal. + See 'Quad convexity justification' comment. + " ; + tags = [Cfsqp;Lp_aux "6944699408 a";Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2 * h0,y4,sqrt8); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) + ] +( taum y1 y2 y3 y4 y5 y6 + ( -- #0.08 * (y4 - #2.52) + #0.15 * (y2 + y3 - &4)) + #0.972 * dih_y y1 y2 y3 y4 y5 y6 - #1.707 > #0.0) `; +};; + +experiment{ + idv = "6944699408 back"; + doc=" Don't use, we were able to get 6944699408 a to run in about 5min without it. + We can use dimension reduction methods to reduce the number of variables. + This is the reduced version that occurs when the cross diagonal is minimal. + See 'Quad convexity justification' comment. + " ; + tags = [Cfsqp;Lp_aux "6944699408 a";Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2 * h0,y4,sqrt8); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) + ] +( taum y1 y2 y3 y4 y5 y6 > ( -- #0.08 * (y4 - #2.52) + #0.15 * (y2 + y3 - &4)) )`; +};; + + +let gamma3f_expand = new_definition `gamma3f_expand y1 y2 y6 r f = gamma3f y1 y2 y6 r f`;; + +let gamma3f_expand_alt = prove_by_refinement `gamma3f_expand y1 y2 y6 r lmfun = + vol_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - ( XXD)`, + [ + REWRITE_TAC[gamma3f_expand;Nonlinear_lemma.vol3f_palt;Sphere.gamma3f;Nonlinear_lemma.vol3r_alt]; + ]);; +Nonlinear_lemma.vol3f_palt;; + + + +let all_forall=Sphere.all_forall;; + + +Parse_ineq.execute_cfsqp +{ + idv="was 5202826650"; + doc="skinny triangle (ear) residual is positive, when y1=2.52, y3=2 + This domain falls within the preconditions of the residual function because of + 4559601669 and 2485876245 + "; + tags=[Flypaper[];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (y_of_x tau_residual_x y1 y2 y3 y4 y5 y6 > &0) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + + +Parse_ineq.execute_cfsqp +{ + idv="was 5202826650"; + doc="skinny triangle (ear) residual is positive, when y1=2.52, y3=2 + This domain falls within the preconditions of the residual function because of + 4559601669 and 2485876245 + "; + tags=[Flypaper[];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (#2.52,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.5,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (taum y1 y2 y3 y4 y5 y6 > taum (&2) y2 y3 y4 y5 y6) \/ + (delta_y y1 y2 y3 y4 y5 y6 < #0.00001) + )`; +};; + + + +Parse_ineq.execute_cfsqp +{ + idv="test "; + doc=" + "; + tags=[Flypaper[];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#4.6); + (#3.1,y5,#4.6); + (&2,y6,&2); + (&2,y12,#2.52) + ] +( + (dih_y y1 y2 y3 y4 y5 y6 > &0) \/ + (arclength y2 y3 y4 < #2.42) \/ + (delta_y y1 y2 y12 (&2) (&2) y5 < &0) \/ + (delta_y y1 y2 y3 y4 y5 y6 < #0.00001) + )`; +};; + + +Parse_ineq.execute_cfsqp +{ + idv="test "; + doc=" + "; + tags=[Flypaper[];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#4.6); + (&2,y6,&2); + (&2,yh,#2.52) + ] +(let y5 = edge_flat yh y1 y3 (&2) (&2) in + (taum y1 y2 y3 y4 y5 y6 + flat_term yh > &0) \/ + (arclength y2 y3 y4 > #2.54) \/ + (dih_y y1 y2 y3 y4 y5 y6 < dih_y y1 yh y2 (#3.01) (&2) (&2)) \/ + (delta_y y1 y2 y3 y4 y5 y6 < #0.00001) + )`; +};; + + + +Parse_ineq.execute_cfsqp +{ + idv="test HEX 3 FLATS"; + doc="hexagon with three alternating flats. + "; + tags=[Flypaper[];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y12,#2.52); + (&2,y23,#2.52); + (&2,y13,#2.52) + ] +(let y5 = edge_flat y13 y1 y3 (&2) (&2) in +let y6 = edge_flat y12 y1 y2 (&2) (&2) in +let y4 = edge_flat y23 y2 y3 (&2) (&2) in + (taum y1 y2 y3 y4 y5 y6 + flat_term y12 + flat_term y23 + flat_term y13 > &0) \/ + ( y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +Parse_ineq.execute_cfsqp +{ + idv="test HEX 3 FLATS"; + doc="hexagon with three alternating flats. + Not needed. + "; + tags=[Flypaper[];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y12,#2.52); + (&2,y23,#2.52); + (&2,y13,#2.52) + ] +(let y5 = edge_flat y13 y1 y3 (&2) (&2) in +let y6 = edge_flat y12 y1 y2 (&2) (&2) in +let y4 = edge_flat y23 y2 y3 (&2) (&2) in + (delta_y y1 y2 y3 y4 y5 y6 > &0) \/ + ( y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + + +Parse_ineq.execute_cfsqp +{ +idv = "was 298"; +doc = ""; +tags= [Tex;Cfsqp;Eps 1.0e-8;Penalty(1000.0,10000.0);Flypaper[]]; +ineq = all_forall `ineq + [ + (&1,e1,&1 + sol0/pi); + (&1,e2,&1 + sol0/pi); + (&1,e3,&1 + sol0/pi); + (#2.38 pow 2, a2, #3.7 pow 2); + (#2.38 pow 2, b2, #3.7 pow 2); + (#2.38 pow 2, c2, #3.7 pow 2) + ] ( + (num2 e1 e2 e3 a2 b2 c2 < &0) \/ + delta_x (&4) (&4) (&4) a2 b2 c2 < &0 \/ + y_of_x eulerA_x (&4) (&4) (&4) a2 b2 c2 < &0 + )`; +};; + + +Parse_ineq.execute_cfsqp +{ +idv = "was 298"; +doc = ""; +tags= [Tex;Cfsqp;Eps 1.0e-8;Penalty(5000.0,50000.0);Flypaper[]]; +ineq = all_forall `ineq + [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.73); + (#3.01,y5,#3.73); + (#3.01,y6,#3.73) + ] ( + let a2 = (&2 * arclength y2 y3 y4) pow 2 in + let b2 = (&2 * arclength y1 y3 y5) pow 2 in + let c2 = (&2 * arclength y1 y2 y6) pow 2 in + let e1 = rho y1 in + let e2 = rho y2 in + let e3 = rho y3 in + (num2 e1 e2 e3 a2 b2 c2 < &0) \/ + delta_x (&4) (&4) (&4) a2 b2 c2 < &0 \/ + y_of_x eulerA_x (&4) (&4) (&4) a2 b2 c2 < &0 + )`; +};; + + +(* NEW hex SERIES, Jun 2, 2011 *) + +(* def's borrowed from sphere.hl *) + +let delta_126_x = new_definition + `delta_126_x (x3s:real) (x4s:real) (x5s:real) (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + delta_x x1 x2 x3s x4s x5s x6`;; + +(* new *) +let delta_234_x = new_definition + `delta_234_x (x1s:real) (x5s:real) (x6s:real) (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + delta_x x1s x2 x3 x4 x5s x6s`;; + +(* new *) +let delta_135_x = new_definition + `delta_135_x (x2s:real) (x4s:real) (x6s:real) (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + delta_x x1 x2s x3 x4s x5 x6s`;; + +let taum_sub246_x = new_definition + `taum_sub246_x x2s x4s x6s (x1:real) (x2:real) x3 (x4:real) x5 (x6:real) = + taum_x x1 x2s x3 x4s x5 x6s`;; + +let taum_sub345_x = new_definition + `taum_sub345_x x3s x4s x5s (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + taum_x x1 x2 x3s x4s x5s x6`;; + +(* new *) +let taum_sub156_x = new_definition + `taum_sub156_x x1s x5s x6s (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + taum_x x1s x2 x3 x4 x5s x6s`;; + +let taum_3flat_x = new_definition + `taum_3flat_x x1 x2 x3 x23 x13 x12 = +let x5 = edge_flat2_x x13 x1 x3 (&0) (&4) (&4) in +let x6 = edge_flat2_x x12 x1 x2 (&0) (&4) (&4) in +let x4 = edge_flat2_x x23 x2 x3 (&0) (&4) (&4) in + (taum_x x1 x2 x3 x4 x5 x6 + flat_term_x x12 + flat_term_x x23 + flat_term_x x13)`;; + +let taum_2flat_x = new_definition + `taum_2flat_x x1 x2 x3 x4 x13 x12 = +let x5 = edge_flat2_x x13 x1 x3 (&0) (&4) (&4) in +let x6 = edge_flat2_x x12 x1 x2 (&0) (&4) (&4) in + (taum_x x1 x2 x3 x4 x5 x6 + flat_term_x x12 + flat_term_x x13)`;; + + +let taum_1flat_x = new_definition + `taum_1flat_x x1 x2 x3 x4 x5 x12 = +let x6 = edge_flat2_x x12 x1 x2 (&0) (&4) (&4) in + (taum_x x1 x2 x3 x4 x5 x6 + flat_term_x x12)`;; + + +let euler_3flat_x = new_definition + `euler_3flat_x x1 x2 x3 x23 x13 x12 = +let x5 = edge_flat2_x x13 x1 x3 (&0) (&4) (&4) in +let x6 = edge_flat2_x x12 x1 x2 (&0) (&4) (&4) in +let x4 = edge_flat2_x x23 x2 x3 (&0) (&4) (&4) in + (eulerA_x x1 x2 x3 x4 x5 x6)`;; + +let euler_2flat_x = new_definition +" `euler_2flat_x x1 x2 x3 x4 x13 x12 =" +let x5 = edge_flat2_x x13 x1 x3 (&0) (&4) (&4) in +let x6 = edge_flat2_x x12 x1 x2 (&0) (&4) (&4) in + (eulerA_x x1 x2 x3 x4 x5 x6)`;; + +let euler_1flat_x = new_definition + `euler_1flat_x x1 x2 x3 x4 x5 x12 = +let x6 = edge_flat2_x x12 x1 x2 (&0) (&4) (&4) in + (eulerA_x x1 x2 x3 x4 x5 x6)`;; + + +Parse_ineq.execute_cfsqp +{ + idv="5338748573"; + doc="full hexagon with three alternating flats. + Big alternating central triangle. + "; + tags=[Flypaper["SAUZWSD"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y12,#2.52); + (&2,y23,#2.52); + (&2,y13,#2.52) + ] +( + (y_of_x taum_3flat_x y1 y2 y3 y23 y13 y12 > #0.712 ) \/ + (y_of_x euler_3flat_x y1 y2 y3 y23 y13 y12 < &0) + )`; +};; + +Parse_ineq.execute_cfsqp +{ + idv="3306409086"; + doc="full hexagon with two flats, one hi, can zero out the hi ear. + Big alternating central triangle. + "; + tags=[Flypaper["SAUZWSD"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y12,#2.52); + (&2,y13,#2.52) + ] +( + (y_of_x taum_2flat_x y1 y2 y3 y4 y13 y12 + > #0.712 + #0.013) \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + (y_of_x euler_2flat_x y1 y2 y3 y4 y13 y12< &0) + )`; +};; + +Parse_ineq.execute_cfsqp +{ + idv="9075398267"; + doc="full hexagon with two flats, one lo + Big alternating central triangle. + To stabilize near delta=0, we erases and takes a penalty. + "; + tags=[Flypaper["SAUZWSD"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y12,#2.52); + (&2,y13,#2.52) + ] +( + (y_of_x taum_2flat_x y1 y2 y3 y4 y13 y12 + > #0.712 + sol0) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + ( y_of_x euler_2flat_x y1 y2 y3 y4 y13 y12< &0) + )`; +};; + +Parse_ineq.execute_cfsqp +{ + idv="1324821088"; + doc="full hexagon with one flat, hi,hi, can zero out both ears. + Big alternating central triangle. + "; + tags=[Flypaper["SAUZWSD"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (&2,y12,#2.52) + ] +( + (y_of_x taum_1flat_x y1 y2 y3 y4 y5 y12 > #0.712 + &2 * #0.013) \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + ( y_of_x euler_1flat_x y1 y2 y3 y4 y5 y12< &0) + )`; +};; + +Parse_ineq.execute_cfsqp +{ + idv="4108834026"; + doc="full hexagon with one flat, ears: hi,lo, can zero out hi ear. + Big alternating central triangle. + To stabilize near delta=0, we add a disjunct that erases and takes a penalty. + "; + tags=[Flypaper["SAUZWSD"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (&2,y12,#2.52) + ] +( + (y_of_x taum_1flat_x y1 y2 y3 y4 y5 y12 + + y_of_x (taum_sub246_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > #0.712 + #0.013) \/ + (y_of_x taum_1flat_x y1 y2 y3 y4 y5 y12 > #0.712 + #0.013 + sol0) \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + (y_of_x euler_1flat_x y1 y2 y3 y4 y5 y12< &0) + )`; +};; + +Parse_ineq.execute_cfsqp +{ + idv="6388508112"; + doc="full hexagon with one flat, ears: lo,lo + Big alternating central triangle. + If delta hi>0, take the penalty and erase. + By symmetry, wlog 0 < delta234 < delta135 + To stabilize near delta=0, we add disjuncts that erase and take a penalty. + "; + tags=[Flypaper["SAUZWSD"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (&2,y12,#2.52) + ] +( + (y_of_x taum_1flat_x y1 y2 y3 y4 y5 y12 + + y_of_x (taum_sub246_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > + #0.712 + sol0) \/ + (y_of_x taum_1flat_x y1 y2 y3 y4 y5 y12 + > #0.712 + &2 * sol0) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + ( y_of_x euler_1flat_x y1 y2 y3 y4 y5 y12< &0) + )`; +};; + + +Parse_ineq.execute_cfsqp +{ + idv="5493250206"; + doc="full hexagon with no flats, three ears: hi,hi,hi, can zero out all ears. + Big alternating central triangle. + "; + tags=[Flypaper["SAUZWSD"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( (taum y1 y2 y3 y4 y5 y6 + > #0.712 + &3 * #0.013) \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + ( y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +Parse_ineq.execute_cfsqp +{ + idv="2283016857"; + doc="full hexagon with no flats, three ears: hi,hi,lo, zero out hi ears. + Big alternating central triangle, extremal ears. + To stabilize near delta=0, we add a disjunct that erases and takes a penalty. + "; + tags=[Flypaper["SAUZWSD"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( (taum y1 y2 y3 y4 y5 y6 + +y_of_x (taum_sub345_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 + > #0.712 + &2 * #0.013) \/ + (taum y1 y2 y3 y4 y5 y6 + > #0.712 + &2 * #0.013 + sol0) \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6> &0 \/ + ( y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +Parse_ineq.execute_cfsqp +{ + idv="4872337467"; + doc="full hexagon with no flats, three ears: hi,lo,lo, zero out hi ear. + Big alternating central triangle, extremal ears. + By symmetry, wlog 0 < delta135 < delta126 + To stabilize near delta=0, we add disjuncts that erase and take a penalty. + "; + tags=[Flypaper["SAUZWSD"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( + (taum y1 y2 y3 y4 y5 y6 + +y_of_x (taum_sub345_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 + > #0.712 + #0.013 + sol0) \/ + (taum y1 y2 y3 y4 y5 y6 + > #0.712 + #0.013 + &2 * sol0) \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 \/ + y_of_x (delta_126_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + ( y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +Parse_ineq.execute_cfsqp +{ + idv="3615835903"; + doc="full hexagon with no flats, three ears: low, low, low + Big alternating central triangle, extremal ears. + By symmetry, wlog, we may order the delta terms. + 0 < delta234 < delta135 < delta126 + To stabilize near delta=0, we add disjuncts that erase and take a penalty. + "; + tags=[Flypaper["SAUZWSD"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( +(taum y1 y2 y3 y4 y5 y6 + +y_of_x (taum_sub345_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 + > #0.712 + &2 * sol0) \/ +(taum y1 y2 y3 y4 y5 y6 + > #0.712 + &3 * sol0) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 \/ + y_of_x (delta_126_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + ( y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +Parse_ineq.execute_cfsqp +{ + idv="2535350075"; + doc="full hexagon ear calculation. + This shows that if (delta hi > 0) and (delta lo >0) we can erase the ear with small penalty. + Hence, when we look at a lo ear, we can wrap it in with the hi ear case when + the hi ear exists: (delta hi>0). + "; + tags=[Flypaper["SAUZWSD"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,&2); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (taum y1 y2 y3 y4 y5 y6 > -- #0.013) \/ + (delta_y (#2.52) y2 y3 y4 y5 y6 < &0) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + + +(* PENTAGONS, June reprise *) + + diff --git a/legacy/oldnonlinear/nonlinear/experiments/test_may_2012.hl b/legacy/oldnonlinear/nonlinear/experiments/test_may_2012.hl new file mode 100644 index 0000000..e1dadcd --- /dev/null +++ b/legacy/oldnonlinear/nonlinear/experiments/test_may_2012.hl @@ -0,0 +1,143 @@ +(* MAY 2012 EXPERIMENTS TO SPEED THINGS UP. + Especially ZTG...F23 stuff. +*) + + +(* +let truncate_vol_x = new_definition(`truncate_vol_x c x1 x2 x3 x4 x5 x6 = + (truncate_sqrt c (delta_x x1 x2 x3 x4 x5 x6))/ (&12)`);; + +let truncate_sol_x = new_definition(`truncate_sol_x c x1 x2 x3 x4 x5 x6 = + (truncate_dih_x c x1 x2 x3 x4 x5 x6) + + (truncate_dih_x c x2 x3 x1 x5 x6 x4) + + (truncate_dih_x c x3 x1 x2 x6 x4 x5) - pi`);; + +let vol3r_123 = new_definition `vol3r_123 = + compose6 vol_x proj_x1 proj_x2 proj_x3 two6 two6 two6`;; + +let truncate_vol3r_123 = new_definition `truncate_vol3r_123 c = + compose6 (truncate_vol_x c) proj_x1 proj_x2 proj_x3 two6 two6 two6`;; + +let sol_x_123 = new_definition `sol_x_123 = + compose6 sol_x proj_x1 proj_x2 proj_x3 two6 two6 two6`;; + +let truncate_vol3f_123 = new_definition `truncate_vol3f_123' c f = + scalar6 (rotate4 sol_x_123 + rotate5 sol_x_123 + rotate6 sol_x_123) + (&2 * mm1/ pi) + - + scalar6 + ((uni(f,(scalar6 proj_y1 #0.5))) * rotate4 (truncate_dih_x c) + + (uni(f,(scalar6 proj_y1 #0.5))) * rotate5 (truncate_dih_x c) + + (uni(f,(scalar6 proj_y1 #0.5))) * rotate6 (truncate_dih_x c)) + (&8 * mm2 / pi)`;; + + +let vol3r_456 = new_definition `vol3r_456 = mk_456 vol_x`;; +let sol_x_456 = new_definition `sol_x_456 = mk_456 sol_x`;; + +*) + +(* +let gamma3f_456 = new_definition `gamma3f_456 d f a b c x4 x5 x6 = + truncate_vol3r_456 d a b c x4 x5 x6 - + truncate_vol3f_456 d f a b c x4 x5 x6`;; +*) + + + +(* +let truncate_sol_y = new_definition(`truncate_sol_y c + = y_of_x (truncate_sol_x c)`);; + +let truncate_vol3r = new_definition `truncate_vol3r c y1 y2 y3 r = + truncate_vol_y c r r r y1 y2 y3`;; + +let truncate_vol3r_x = new_definition `truncate_vol3r_x c x1 x2 x3 r2 = + truncate_vol_x c r2 r2 r2 x1 x2 x3`;; + +let truncate_vol3f = new_definition `truncate_vol3f c y1 y2 y3 r f = + (&2 * mm1 / pi) * + (truncate_sol_y c y1 y2 r r r y3 + + truncate_sol_y c y2 y3 r r r y1 + + truncate_sol_y c y3 y1 r r r y2) + - (&8 * mm2/pi) * + (f(y1/ &2)* truncate_dih_y c y1 y2 r r r y3 + + f(y2/ &2)* truncate_dih_y c y2 y3 r r r y1 + + f(y3/ &2)* truncate_dih_y c y3 y1 r r r y2)`;; + +let truncate_gamma3f = new_definition `truncate_gamma3f c y1 y2 y3 r f = + truncate_vol3r c y1 y2 y3 r - truncate_vol3f c y1 y2 y3 r f`;; + +let truncate_gamma3f_x = new_definition + `truncate_gamma3f_x c x1 x2 x3 r2 f2 = + truncate_vol3r_x c x1 x2 x3 r2 - truncate_vol3f_x c x1 x2 x3 r2 f2`;; + + +let truncate_gamma23f = new_definition + `truncate_gamma23f c y1 y2 y3 y4 y5 y6 w1 w2 r f = + (truncate_gamma3f c y1 y2 y6 r f / &w1 + + truncate_gamma3f c y1 y3 y5 r f / &w2 + + (dih_y y1 y2 y3 y4 y5 y6 - + truncate_dih_y c y1 y2 r r r y6 - + truncate_dih_y c y1 y3 r r r y5) * + (vol2r y1 r - vol2f y1 r f)/(&2 * pi)) `;; + +let vol2r_x = new_definition `vol2r_x x r2 = &2 * pi * + (r2 - (x / (&4)))/(&3)`;; + +let vol2f_x = new_definition `vol2f_x x r2 f2 = + (&2 * mm1 / pi) * &2 *pi* (&1- sqrt (x / r2) / &2) + - (&8 * mm2/pi) * &2 * pi * f2 (x/ (&2)) `;; + + + +(* use if we know sqrt is bounded away from 0 *) + + +note : f2 (x/ &2) = f(y / &2) when y^2 = x. +rework these definitions. I don't like the sqrt(x/ &2). + +let lmfun_x = new_definition `lmfun_x x = lmfun (sqrt (x / &2))`;; + *) + + + + +(* +let truncate_gamma23f_x = new_definition + `truncate_gamma23f_x c x1 x2 x3 x4 x5 x6 w1 w2 r2 f2 = + (truncate_gamma3f_x c x1 x2 x6 r2 f2 / &w1 + + truncate_gamma3f_x c x1 x3 x5 r2 f2 / &w2 + + (dih_x x1 x2 x3 x4 x5 x6 - + truncate_dih_x c x1 x2 r2 r2 r2 x6 - + truncate_dih_x c x1 x3 r2 r2 r2 x5) * + (vol2r_x x1 r2 - vol2f_x x1 r2 f2)/(&2 * pi)) `;; + +let truncate_gamma23_x_sample = new_definition + `truncate_gamma23_x_sample x1 x2 x3 x4 x5 x6 = truncate_gamma23f_x (#0.14) + x1 x2 x3 x4 x5 x6 1 1 (&2) lmfun_x`;; + +Ineq.make_F23 0 0;; + +let sample_ineq = + {ineq = + `!y1 y2 y3 y4 y5 y6. + ineq + [&2 * hminus,y1,&2 * hplus; &2,y2,&2 * hminus; &2,y3,&2 * hminus; + &2, + y4, + sqrt8; &2,y5,&2 * hminus; &2,y6,&2 * hminus] + (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 < #0.14 \/ + delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 < #0.14 \/ + y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2 \/ + y_of_x truncate_gamma23_x_sample y1 y2 y3 y4 y5 y6 > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6)`; + idv = "ZTG truncate test/first split"; + doc = " + Test on make_F23 0 0. + This is the $2$- and $3$-cell inequality for five or more leaves."; + tags = + [Tex; Split [0]; Set_rad2; Delta126min 0.139999999999; + Delta135min 0.139999999999; Marchal; Cfsqp_branch 3; + Flypaper ["OXLZLEZ"]; Penalty (200., 5000.);]};; +*) diff --git a/legacy/oldnonlinear/nonlinear/experiments/zumkeller_test.hl b/legacy/oldnonlinear/nonlinear/experiments/zumkeller_test.hl new file mode 100644 index 0000000..218b71d --- /dev/null +++ b/legacy/oldnonlinear/nonlinear/experiments/zumkeller_test.hl @@ -0,0 +1,398 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: nonlinear inequalities *) +(* Author: Roland Zumkeller *) +(* Date: 2010-08-30 *) +(* ========================================================================== *) + +(* + +Zumkeller's verification of nonlinear inequalities using Sergei package. +http://code.google.com/p/sergei/ + +Times are given in the format XhMM:SS for hours, minutes, seconds. +*) + +module Zumkeller_test = struct + +needs "nonlinear/oracle.hl";; +needs "nonlinear/ineq.hl";; +needs "general/update_database_310.ml";; + +(* commented out in ineq.hl: +g Ineq.I_3336871894;; +g Ineq.I_8880534953;; +*) + +g Ineq.I_5735387903;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#1.04`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e SERGEI_TAC;; (* done 0:03 *) + +g Ineq.I_5490182221;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#1.00`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e SERGEI_TAC;; (* done 0:04 *) + +g Ineq.I_2570626711;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#1.00`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e SERGEI_TAC;; (* done 0:06 *) + +g Ineq.I_3296257235;; +e PREP;; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e (ONCE_REWRITE_TAC [INST [`sqrt (&2048)`,`x:real`; `-- &16`,`y:real`] ATN2_ATN_XPOS]);; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e (ONCE_REWRITE_TAC [INST [(`#0.9`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e SERGEI_TAC;; (* done 27:51 *) +(* +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +SPEC_RULE;; +e (REWRITE_TAC [SPEC `y1:real` SQRT_POW_2]);; +sqrt;; +prove(`y1 = sqrt y1 * sqrt y1`, MESON_TAC[SQRT_POW_2]);; +INST ();; +g `y1 >= &0 ==> y1 = sqrt y1 * sqrt y1`;; +e (REWRITE_TAC [sqrt]);; +e (REAL_ARITH_TAC);; +e (MESON_TAC []);; +e (SUBST_ALL_TAC (prove(`y1 = sqrt y1 * sqrt y1`,ARITH_TAC)));; +e (SUBST_ALL_TAC (prove(`y2 = sqrt x2`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`y3 = sqrt x3`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`y4 = sqrt x4`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`y5 = sqrt x5`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`y6 = sqrt x6`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`y1*y1=x1`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`y2*y2=x2`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`y3*y3=x3`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`y4*y4=x4`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`y5*y5=x5`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`y6*y6=x6`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`(&1 + (y1 - &2) * -- &25 / &13) = (&63 - &25*y1) / &13`,ARITH_TAC)));; +e (SUBST_ALL_TAC (prove(`(&1 + (y2 - &2) * -- &25 / &13) = (&63 - &25*y2) / &13`,ARITH_TAC)));; +e (SUBST_ALL_TAC (prove(`(&1 + (y3 - &2) * -- &25 / &13) = (&63 - &25*y3) / &13`,ARITH_TAC)));; +e (SUBST_ALL_TAC (prove(`y1 = sqrt x1`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`y2 = sqrt x2`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`y3 = sqrt x3`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`y4 = sqrt x4`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`y5 = sqrt x5`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`y6 = sqrt x6`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`(#2.0 <= sqrt x1 /\ sqrt x1 <= #2.52) = (#4.0 <= x1 /\ x1 <= #6.3504)`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`(#2.0 <= sqrt x2 /\ sqrt x2 <= #2.52) = (#4.0 <= x2 /\ x2 <= #6.3504)`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`(#2.0 <= sqrt x3 /\ sqrt x3 <= #2.52) = (#4.0 <= x3 /\ x3 <= #6.3504)`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`(#2.0 <= sqrt x4 /\ sqrt x4 <= #2.52) = (#4.0 <= x4 /\ x4 <= #6.3504)`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`(#2.0 <= sqrt x5 /\ sqrt x5 <= #2.52) = (#4.0 <= x5 /\ x5 <= #6.3504)`,CHEAT_TAC)));; +e (SUBST_ALL_TAC (prove(`(#2.0 <= sqrt x6 /\ sqrt x6 <= #2.52) = (#4.0 <= x6 /\ x6 <= #6.3504)`,CHEAT_TAC)));; +e (ONCE_REWRITE_TAC [INST [(`#1.3`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e SERGEI_TAC;; +*) + +g Ineq.I_8519146937;; +e PREP;; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e (ONCE_REWRITE_TAC [INST [`sqrt (&2048)`,`x:real`; `-- &16`,`y:real`] ATN2_ATN_XPOS]);; +e (ONCE_REWRITE_TAC [INST [(`#0.9`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e SERGEI_TAC;; (* done 8:48 *) + +g Ineq.I_4667071578;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#0.9`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e SERGEI_TAC;; (* done 5:39 *) + +g Ineq.I_1395142356;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#0.9`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e SERGEI_TAC;; (* done 1h57:15 *) + +g Ineq.I_7394240696;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#1.1`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e SERGEI_TAC;; (* done 29:26 *) + +g Ineq.I_7726998381;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#0.9`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e SERGEI_TAC;; (* done 6:16 *) + +g Ineq.I_4047599236;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#0.9`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e SERGEI_TAC;; (* done 0:59 *) + +g Ineq.I_3526497018;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#0.94`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e SERGEI_TAC;; (* done 0:30 *) + +g Ineq.I_5957966880;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#0.9`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e SERGEI_TAC;; (* done 0:55 *) + +g Ineq.I_7043724150;; (* \/ *) +e PREP;; +e DISJ2_TAC;; (* 'quadratic_root_plus' *) +e DISJ1_TAC;; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e (ONCE_REWRITE_TAC [INST [`sqrt (&2048)`,`x:real`; `-- &16`,`y:real`] ATN2_ATN_XPOS]);; +e (ONCE_REWRITE_TAC [INST [(`-- #3.5`,`t:real`)] ATN2_ROT_TAN]);; +e SERGEI_TAC;; (* TODO *) + + +g Ineq.I_6944699408;; (* TODO \/ *) +g Ineq.I_4240815464;; (* TODO \/ *) +g Ineq.I_3862621143;; (* TODO \/ *) +g Ineq.I_5464178191;; (* TODO \/ *) + +g Ineq.I_3020140039;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#0.5`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e SERGEI_TAC;; (* done 3:11 *) + +g Ineq.I_9414951439;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#0.27`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e SERGEI_TAC;; (* TODO, sqrt8 *) + +g Ineq.I_8248508703;; +e PREP;; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e (ONCE_REWRITE_TAC [INST [`sqrt (&2048)`,`x:real`; `-- &16`,`y:real`] ATN2_ATN_XPOS]);; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e (SINGLE_REWR_TAC (INST [(`#0.45`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#1.95`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#1.95`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#0.45`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#1.95`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#1.95`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e SERGEI_TAC;; (* done 6h39:24 *) + +(* +e PREP;; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e (ONCE_REWRITE_TAC [INST [`sqrt (&2048)`,`x:real`; `-- &16`,`y:real`] ATN2_ATN_XPOS]);; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e (SINGLE_REWR_TAC (INST [(`#0.6`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#2.1`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#2.1`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#0.6`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#2.1`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#2.1`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e SERGEI_TAC;; (* takes 8h07:51 *) +*) + +g Ineq.I_3318775219;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#0.5`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e SERGEI_TAC;; (* done 1:32 *) + +g Ineq.I_9922699028;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#0.5`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e SERGEI_TAC;; (* done 0:27 *) + +g Ineq.I_5000076558;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#1.4`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e SERGEI_TAC;; (* done 2:24 *) + +g Ineq.I_9251360200;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#0.45`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e SERGEI_TAC;; (* done 5:19 *) + +g Ineq.I_9756015945;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#1.4`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e SERGEI_TAC;; (* done 1:10 *) + +g Ineq.I_181212899;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#0.6`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e SERGEI_TAC;; (* done 0:28 *) + +g Ineq.I_5760733457;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#0.95`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e SERGEI_TAC;; (* done 2:08 *) + +g Ineq.I_2563100177;; +e PREP;; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e (ONCE_REWRITE_TAC [INST [`sqrt (&2048)`,`x:real`; `-- &16`,`y:real`] ATN2_ATN_XPOS]);; +e (ONCE_REWRITE_TAC [INST [(`#1.3`,`t:real`)] ATN2_ROT_TAN]);; +e SERGEI_TAC;; (* TODO wide domain *) + +g Ineq.I_7931207804;; +e PREP;; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e (ONCE_REWRITE_TAC [INST [`sqrt (&2048)`,`x:real`; `-- &16`,`y:real`] ATN2_ATN_XPOS]);; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e (SINGLE_REWR_TAC (INST [(`#1.2`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#0.8`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#0.8`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#1.2`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#0.8`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#0.8`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e SERGEI_TAC;; (* done 9h45:15 *) + +g Ineq.I_9225295803;; +e PREP;; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e (ONCE_REWRITE_TAC [INST [`sqrt (&2048)`,`x:real`; `-- &16`,`y:real`] ATN2_ATN_XPOS]);; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e (ONCE_REWRITE_TAC [INST [(`#0.75`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e SERGEI_TAC;; (* done 9h00:00 (less than) *) + +g Ineq.I_9291937879;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#0.8`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e SERGEI_TAC;; (* done 3:30 *) + +g Ineq.I_7761782916;; (* TODO \/ *) + +g Ineq.I_4840774900;; +e PREP;; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e (ONCE_REWRITE_TAC [INST [`sqrt (&2048)`,`x:real`; `-- &16`,`y:real`] ATN2_ATN_XPOS]);; +e (SINGLE_REWR_TAC (INST [(`#0.45`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#0.02`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#0.02`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#0.4`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#0.02`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#0.02`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e SERGEI_TAC;; (* TODO, sqrt8*) + +g Ineq.I_9995621667;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#0.175`,`t:real`)] ATN2_ROT_TAN]);; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e SERGEI_TAC;; (* done 11:30 *) + +g Ineq.I_5769230427;; +e PREP;; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e (ONCE_REWRITE_TAC [INST [`sqrt (&2048)`,`x:real`; `-- &16`,`y:real`] ATN2_ATN_XPOS]);; +e (SINGLE_REWR_TAC (INST [(`#0.275`,`t:real`)] ATN2_ROT_TAN));; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`-- #2.5`,`t:real`)] ATN2_ROT_TAN));; (* TO DO establish that this rotation is valid *) + + +g Ineq.I_9229542852;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#0.7`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e SERGEI_TAC;; (* done 0:57 *) + +g Ineq.I_1550635295;; +e PREP;; +e (ONCE_REWRITE_TAC [INST [(`#0.7`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e SERGEI_TAC;; (* done 0:46 *) + +g Ineq.I_4491491732;; +e PREP;; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e (ONCE_REWRITE_TAC [INST [`sqrt (&2048)`,`x:real`; `-- &16`,`y:real`] ATN2_ATN_XPOS]);; +e (ONCE_REWRITE_TAC [INST [(`#0.56`,`t:real`)] ATN2_ROT_TAN]);; +e (ONCE_REWRITE_TAC [ATN2_ATN_XPOS]);; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e SERGEI_TAC;; (* done 1h20:00 (less than) *) + +g Ineq.I_8282573160;; +e PREP;; +e (CONV_TAC REAL_RAT_REDUCE_CONV);; +e (ONCE_REWRITE_TAC [INST [`sqrt (&2048)`,`x:real`; `-- &16`,`y:real`] ATN2_ATN_XPOS]);; +e (SINGLE_REWR_TAC (INST [(`#0.5`,`t:real`)] ATN2_ROT_TAN));; +e SERGEI_TAC;; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#1.8`,`t:real`)] ATN2_ROT_TAN));; +e SERGEI_TAC;; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#1.8`,`t:real`)] ATN2_ROT_TAN));; +e SERGEI_TAC;; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#0.5`,`t:real`)] ATN2_ROT_TAN));; +e SERGEI_TAC;; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#1.8`,`t:real`)] ATN2_ROT_TAN));; +e SERGEI_TAC;; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e (SINGLE_REWR_TAC (INST [(`#1.8`,`t:real`)] ATN2_ROT_TAN));; +e SERGEI_TAC;; +e (SINGLE_REWR_TAC ATN2_ATN_XPOS);; +e SERGEI_TAC;; (* TODO poly factor becomes zero --> rewrite *) + + +g Ineq.I_8611785756;; (* TODO \/ *) + +g Ineq.I_6224332984;; (* TODO \/ *) + +g Ineq.I_4198769118;; (* TODO acs *) + +g Ineq.I_1965189142;; (* TODO COND *) + +g Ineq.I_6096597438;; (* TODO COND *) + + +end;; diff --git a/legacy/oldnonlinear/nonlinear/fejestoth12.hl b/legacy/oldnonlinear/nonlinear/fejestoth12.hl new file mode 100644 index 0000000..4522954 --- /dev/null +++ b/legacy/oldnonlinear/nonlinear/fejestoth12.hl @@ -0,0 +1,221 @@ +(* ========================================================================== *) +(* NON FLYSPECK - FEJES TOTH KISSING CONJECTURE *) +(* *) +(* Nonlinear Inequalities *) +(* Chapter: Further Results *) +(* Section: Strong Dodecahedral Conjecture *) +(* Author: Thomas C. Hales *) +(* Date: 2010-05-18 *) +(* ========================================================================== *) + + +(* + old inequalities for fejes toth kissing 12 conjecture. + This material was removed from the File + text_formalization/nonlinear/strongdodec_ineq.hl + Oct 2012. + *) + +(* + +Nonlinear inequalities for Fejes Toth's full contact conjecture. +The inequalities in this section are not part of the Flyspeck project. + +I believe that none of these inequalities are needed any more, now +that the area estimates are all based on Lexell's theorem. + +*) + + +module Fejestoth12 = struct + +(* quadrilateral case, 5 subcases *) + +(* + +Q0: +When all four sides of the quadrilateral are 2, then some diagaonal has length +less than 3. Here are the other domain calculations (done in Mathematica). + +Similarly, +Q1: +Dihedral[2, 2, 2, 2, 2.52, x] + Dihedral[2, 2, 2, 2, 2, x] - + Dihedral[2, 2, 2, 3, 2.52, 2] < 0, when x >= 3.014 + +Q2: +Dihedral[2, 2, 2, 2, 2.52, x] + Dihedral[2, 2, 2, 2.52, 2, x] - + Dihedral[2, 2, 2, 3, 2, 2] < 0 , when x >= 3.39. + +Q3: +Dihedral[2, 2, 2, 2, 2.52, x] + Dihedral[2, 2, 2, 2, 2.52, x] - + Dihedral[2, 2, 2, 3, 2.52, 2.52] <0, when x >= 3.34. + +Q4: +Dihedral[2, 2, 2, 2.52, 2.52, x] + Dihedral[2, + 2, 2, 2, 2.52, x] - Dihedral[2, 2, 2, 3, 2.52, 2.52] < 0, when x >= 3.6. + +Q5: +Dihedral[2, 2, 2, 2.52, 2.52, x] + Dihedral[2, 2, 2, 2.52, 2.52, x] - + Dihedral[2, 2, 2, 3, 2.52, 2.52] < 0 , when x >= 3.81. +*) + + + +add { + idv= "9267276091 Q1"; + ineq = all_forall `ineq + [(#3.0,y1,#3.014);(&1,y2,&1);(&1,y3,&1);(&1,y4,&1);(&1,y5,&1);(&1,y6,&1) + ] + (taum_y1 (&2) (#2.52) y1 y2 y3 y4 y5 y6 + taum_y1 (&2) (&2) y1 y2 y3 y4 y5 y6 > + tame_table_d 3 1)`; + doc = "Fejes Toth quad case"; + tags = [Flypaper ["ZVLLGZK"];Tex;Cfsqp;Xconvert;Fejestoth]; +};; + +add { + idv= "9267276091 Q2"; + ineq = all_forall `ineq + [(#3.0,y1,#3.39);(&1,y2,&1);(&1,y3,&1);(&1,y4,&1);(&1,y5,&1);(&1,y6,&1) + ] + (taum_y1 (&2) (#2.52) y1 y2 y3 y4 y5 y6 + taum_y1 (#2.52) (&2) y1 y2 y3 y4 y5 y6 > + tame_table_d 2 2)`; + doc = "Fejes Toth quad case"; + tags = [Flypaper ["ZVLLGZK"];Tex;Cfsqp;Xconvert;Fejestoth]; +};; + +add { + idv= "9267276091 Q3"; + ineq = all_forall `ineq + [(#3.0,y1,#3.34);(&1,y2,&1);(&1,y3,&1);(&1,y4,&1);(&1,y5,&1);(&1,y6,&1) + ] + (taum_y1 (&2) (#2.52) y1 y2 y3 y4 y5 y6 + taum_y1 (&2) (#2.52) y1 y2 y3 y4 y5 y6 > + tame_table_d 2 2)`; + doc = "Fejes Toth quad case"; + tags = [Flypaper ["ZVLLGZK"];Tex;Cfsqp;Xconvert;Fejestoth]; +};; + +add { + idv= "9267276091 Q4"; + ineq = all_forall `ineq + [(#3.0,y1,#3.6);(&1,y2,&1);(&1,y3,&1);(&1,y4,&1);(&1,y5,&1);(&1,y6,&1) + ] + (taum_y1 (#2.52) (#2.52) y1 y2 y3 y4 y5 y6 + taum_y1 (&2) (#2.52) y1 y2 y3 y4 y5 y6 > + tame_table_d 1 3)`; + doc = "Fejes Toth quad case"; + tags = [Flypaper ["ZVLLGZK"];Tex;Cfsqp;Xconvert;Fejestoth]; +};; + +add { + idv= "9267276091 Q5"; + ineq = all_forall `ineq + [(#3.0,y1,#3.81);(&1,y2,&1);(&1,y3,&1);(&1,y4,&1);(&1,y5,&1);(&1,y6,&1) + ] + (taum_y1 (#2.52) (#2.52) y1 y2 y3 y4 y5 y6 + taum_y1 (#2.52) (#2.52) y1 y2 y3 y4 y5 y6 > + tame_table_d 0 4)`; + doc = "Fejes Toth quad case"; + tags = [Flypaper ["ZVLLGZK"];Tex;Cfsqp;Xconvert;Fejestoth]; +};; + + + +(* pentagon case, 6 subcases *) + +(* The perimeter is too large when at least four have length 2.52: + 4 arc[2,2,2.52] + arc[2,2,2] > 2 Pi. *) + +(* +Bounds on t and y1 from Mathematica. +dih[u_, v_, w_] := Dihedral[2, 2, 2, u, v, w]; + +P1: +fyp1[y_] := dih[3, 2, y] + dih[2, 2, y] - dih[3, 2, 2] <0, when y >= 3.29; +so y<=3.29,t<=3.29. + +P2: fyp2[y_] := dih[3, 2.52, y] + dih[2, 2, y] - dih[3, 2.52, 2], y>= 3.439. same for t. +P3,P4,P6: y<= 3.439, +P5: fyp5 [y_] := dih[3, 2.52, y] + dih[2.52, 2, y] - dih[3, 2.52, 2], y >= 3.715 + +t: 3.439 for P2, 3.723 for P3,P6, 3.715 for P4, P5 +ftp3 [t_] := dih[3, 2.52, t] + dih[2, 2.52, t] - dih[3, 2.52, 2.52] // N; +*) + +add { + idv= "9267276091 P1"; + ineq = all_forall `ineq + [ + (#3.0,y1,#3.29);(#3.0,y2,#3.29);(&1,y3,&1);(&1,y4,&1);(&1,y5,&1);(&1,y6,&1) + ] + (taum_y1 (&2) (&2) y1 y2 y3 y4 y5 y6 + taum_y2 (&2) (&2) y1 y2 y3 y4 y5 y6 + + taum_y1_y2 (&2) y1 y2 y3 y4 y5 y6 > + tame_table_d 5 0)`; + doc = "Fejes Toth pent case"; + tags = [Flypaper ["ZVLLGZK"];Tex;Cfsqp;Xconvert;Fejestoth]; +};; + +add { + idv= "9267276091 P2"; + ineq = all_forall `ineq + [ + (#3.0,y1,#3.439);(#3.0,y2,#3.439);(&1,y3,&1);(&1,y4,&1);(&1,y5,&1);(&1,y6,&1) + ] + (taum_y1 (&2) (&2) y1 y2 y3 y4 y5 y6 + taum_y2 (&2) (&2) y1 y2 y3 y4 y5 y6 + + taum_y1_y2 (#2.52) y1 y2 y3 y4 y5 y6 > + tame_table_d 4 1)`; + doc = "Fejes Toth pent case"; + tags = [Flypaper ["ZVLLGZK"];Tex;Cfsqp;Xconvert;Fejestoth]; +};; + +add { + idv= "9267276091 P3"; + ineq = all_forall `ineq + [ + (#3.0,y1,#3.723);(#3.0,y2,#3.439);(&1,y3,&1);(&1,y4,&1);(&1,y5,&1);(&1,y6,&1) + ] + (taum_y1 (#2.52) (&2) y1 y2 y3 y4 y5 y6 + taum_y2 (&2) (&2) y1 y2 y3 y4 y5 y6 + + taum_y1_y2 (#2.52) y1 y2 y3 y4 y5 y6 > + tame_table_d 3 2)`; + doc = "Fejes Toth pent case"; + tags = [Flypaper ["ZVLLGZK"];Tex;Cfsqp;Xconvert;Fejestoth]; +};; + + +add { + idv= "9267276091 P4"; + ineq = all_forall `ineq + [ + (#3.0,y1,#3.715);(#3.0,y2,#3.439);(&1,y3,&1);(&1,y4,&1);(&1,y5,&1);(&1,y6,&1) + ] + (taum_y1 (#2.52) (&2) y1 y2 y3 y4 y5 y6 + taum_y2 (&2) (&2) y1 y2 y3 y4 y5 y6 + + taum_y1_y2 (#2.52) y1 y2 y3 y4 y5 y6 > + tame_table_d 3 2)`; + doc = "Fejes Toth pent case"; + tags = [Flypaper ["ZVLLGZK"];Tex;Cfsqp;Xconvert;Fejestoth]; +};; + +add { + idv= "9267276091 P5"; + ineq = all_forall `ineq + [ + (#3.0,y1,#3.715);(#3.0,y2,#3.715);(&1,y3,&1);(&1,y4,&1);(&1,y5,&1);(&1,y6,&1) + ] + (taum_y1 (#2.52) (&2) y1 y2 y3 y4 y5 y6 + taum_y2 (#2.52) (&2) y1 y2 y3 y4 y5 y6 + + taum_y1_y2 (#2.52) y1 y2 y3 y4 y5 y6 > + tame_table_d 2 3)`; + doc = "Fejes Toth pent case"; + tags = [Flypaper ["ZVLLGZK"];Tex;Cfsqp;Xconvert;Fejestoth]; +};; + +add { + idv= "9267276091 P6"; + ineq = all_forall `ineq + [ + (#3.0,y1,#3.723);(#3.0,y2,#3.439);(&1,y3,&1);(&1,y4,&1);(&1,y5,&1);(&1,y6,&1) + ] + (taum_y1 (#2.52) (#2.52) y1 y2 y3 y4 y5 y6 + taum_y2 (&2) (&2) y1 y2 y3 y4 y5 y6 + + taum_y1_y2 (#2.52) y1 y2 y3 y4 y5 y6 > + tame_table_d 2 3)`; + doc = "Fejes Toth pent case"; + tags = [Flypaper ["ZVLLGZK"];Tex;Cfsqp;Xconvert;Fejestoth]; +};; + + end;; diff --git a/legacy/oldnonlinear/nonlinear/ineq_cell23.hl b/legacy/oldnonlinear/nonlinear/ineq_cell23.hl new file mode 100644 index 0000000..a4a4752 --- /dev/null +++ b/legacy/oldnonlinear/nonlinear/ineq_cell23.hl @@ -0,0 +1,67 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Nonlinear *) +(* Author: Thomas C. Hales *) +(* Date: 2012-06-15 *) +(* ========================================================================== *) + + +(* Oct 2012. thales. +This looks like junk. Can it be deleted? +*) + +Functional_equation.functional_overload();; + + + +module Ineq_cell23 = struct + open Sphere;; + open Ineq;; +end;; + +let newcases = ["QZECFIC wt1"; + "QZECFIC wt2"; + "GRKIBMP"; + "RQWUDDU"; + "TEWNSCJ"; + "TXQTPVC"; + "PEMKWKU"; + "FHBVYXZv2 a"; + "GLFVCVK4 2477216213 y4supercrit"; + "GLFVCVK4 2477216213 y4crit"; + "GLFVCVK4 2477216213 y4subcrit"; + "QITNPEAv2 4003532128"];; + + +let execute_interval bool = + let cases = [ + "GRKIBMP"; + ] in + map (fun t -> try (Auto_lib.testsplit bool t) with Failure _ -> [()]) cases;; + +type_of `dih4_x_div_sqrtdelta_posbranch`;; +Auto_lib.testsplit true "GRKIBMP";; +execute_interval true;; + +let idq = hd (Ineq.getexact "GLFVCVK4 2477216213 y4crit");; + let splits = Optimize.preprocess_split_idq idq;; + (fun (s,tags,testineq) -> Auto_lib.execute_interval true tags s testineq) (List.nth splits 7);; +let testsplit_idq ex idq = + let splits = Optimize.preprocess_split_idq idq in + map (fun (s,tags,testineq) -> execute_interval ex tags s testineq) splits;; + +cfsqp newcases;; + +one_cfsqp "QZECFIC wt1";; +one_cfsqp "QZECFIC wt2";; +one_cfsqp "GRKIBMP";; +one_cfsqp "RQWUDDU";; +one_cfsqp "TEWNSCJ";; +one_cfsqp "TXQTPVC";; +one_cfsqp "PEMKWKU";; +one_cfsqp "FHBVYXZv2 a";; +one_cfsqp "GLFVCVK4 2477216213 y4supercrit";; +one_cfsqp "GLFVCVK4 2477216213 y4crit";; +one_cfsqp "GLFVCVK4 2477216213 y4subcrit";; +one_cfsqp "QITNPEAv2 4003532128";; diff --git a/legacy/oldnonlinear/nonlinear/main_estimate_pent_hex_cut_may_2013.hl b/legacy/oldnonlinear/nonlinear/main_estimate_pent_hex_cut_may_2013.hl new file mode 100644 index 0000000..6c2ad34 --- /dev/null +++ b/legacy/oldnonlinear/nonlinear/main_estimate_pent_hex_cut_may_2013.hl @@ -0,0 +1,865 @@ +addtex(Comment,""," +The actual definitions of these functions need to be supplied. +For now, the functions only get used in cfsqp and interval verifications. + +The LC functions are implemented in intervals as locally constant functions. +");; + +(* true definitions in mdtau.hl *) + + +let mdtau_fake = new_definition + `mdtau (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) = &0`;; + +let mdtau2_fake = new_definition + `mdtau2 (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) = &0`;; + +addtex (Section,"Main Estimate","Ears, top edges 2,2,long");; + + +add +{ + idv="4322269127"; + doc="taum 1st deriv test. + This shows that the first derivative of tau (wrt y1) is nonzero. + Thus the optimal configuration has delta > 15 or (y1 minimal = 2) + It is implemented in interval code, using locally constant structures (LC)."; + tags=[Flypaper["TNNOPSI"];Main_estimate;Tex;Disallow_derivatives;Penalty(50.0,500.0);]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + ( mdtau_y_LC y1 y2 y3 y4 y5 y6 > &0) \/ + ( mdtau_y_LC y1 y2 y3 y4 y5 y6 < &0) \/ + (delta_y_LC y1 y2 y3 y4 y5 y6 > &15) \/ + (delta_y_LC y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +skip +{ + idv="4322269127 cfsqp version"; + doc="taum 1st deriv test. This is the cfsqp version of 4322269127. + It is not to be proved, only used as numerical evidence."; + tags=[Flypaper["TNNOPSI"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + ( mdtau y1 y2 y3 y4 y5 y6 pow 2 > #0.47) \/ // fake + (delta_y y1 y2 y3 y4 y5 y6 > &15) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + + +add +{ + idv="5556646409"; + doc="taum 2nd deriv test. This is a key inequality. + It asserts that taum has no local minimum on the given domain. + If the derivative is zero, then the second derivative is negative. + By symmetry, wlog y2 < y3. + The C++ code has been customized for this particular inequality. + The C++ has an embedded assumption that mdtau2_y_LC is on the domain delta>=15. + Case delta<=15 is done in 4322269127. + "; + tags=[Flypaper["TNNOPSI"];Main_estimate;Tex;Disallow_derivatives;Widthcutoff 0.004;Penalty(1500.0,5000.0);Cfsqp_branch 2]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (delta_y_LC y1 y2 y3 y4 y5 y6 < &15) \/ + (y2 < y3) \/ + (mdtau_y_LC y1 y2 y3 y4 y5 y6 > &0) \/ + (mdtau_y_LC y1 y2 y3 y4 y5 y6 < &0) \/ + (mdtau2uf_y_LC y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +skip +{ + idv="5556646409 cfsqp version"; + doc="taum 2nd deriv test. Cfsqp version -- only for testing."; + tags=[Flypaper["TNNOPSI"];Main_estimate;Cfsqp;Tex;Penalty(1500.0,5000.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (mdtau y1 y2 y3 y4 y5 y6 pow 2 > #0.004) \/ // fake + (mdtau2 y1 y2 y3 y4 y5 y6 < -- #0.004) \/ // fake + (delta_y y1 y2 y3 y4 y5 y6 < &15) + )`; +};; + +skip +{ + idv="5132343267"; + doc="delta monotonicity. + In the interval code for 5556646409, + the interval implementation of delta_y_LC assumes this monotonicity + results. This calculation is not cited explicitly in the code, but still needed. + - + Deprecated. This is a consequence of 4559601669, which asserts that + the wide angle of a skinny triangle (ear) is obtuse."; + tags=[Flypaper["TNNOPSI"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + ( delta4_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +skip +{ + idv="7479785942"; + doc="delta monotonicity (for edge y5 and by symmetry y6). + In the interval code for 5556646409, + the interval implementation of delta_y_LC assumes various monotonicity + results. This is among them. + - + This is a consequence of 2485876245. No separate verification is needed. + "; + tags=[Flypaper["TNNOPSI"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,&2); + (&2,y3,&2); + (&2,y4,#2.52); + (#3.01,y5,#3.915); + (&2,y6,#2.52) + ] +( + ( delta4_y y1 y2 y3 y4 y5 y6 > &0) + )`; +};; + +addtex (Section,"Main Estimate","June Hexagons, top edges all 2.");; + +addtex(Comment,"Main Estimate", +" +");; + +add +{ + idv="5338748573"; + doc="full hexagon with three alternating flats. + Big alternating central triangle. + Symmetries, wlog y1 #0.712 ) \/ + (y_of_x euler_3flat_x y1 y2 y3 y4 y5 y6 < &0) \/ + (y2 < y1) \/ (y3 < y2) + )`; +};; + +add +{ + idv="3306409086"; + doc="full hexagon with two flats, one hi, can zero out the hi ear. + Big alternating central triangle. + By symmetry wlog y5 < y6 + The constant 0.013 comes from 2535350075. + We add constant in on the hi case, even though it isn't needed here. + To permit simplification of the lo case later. + "; + tags=[Flypaper["SAUZWSD"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,#2.52); + (&2,y6,#2.52) + ] +( + (y_of_x taum_2flat_x y1 y2 y3 y4 y5 y6 + > #0.712 + #0.013) \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + (y_of_x euler_2flat_x y1 y2 y3 y4 y5 y6< &0) \/ + (y6 < y5) + )`; +};; + +add +{ + idv="9075398267"; + doc="full hexagon with two flats, one lo + Big alternating central triangle. + To stabilize near delta=0, we erases and takes a penalty. + By symmetry, wlog y5 < y6. + The constant 0.013 comes from 2535350075. + The extra disjuncts are justified by that calc and by + the stronger ineq proved in '3306...' + "; + tags=[Flypaper["SAUZWSD"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,#2.52); + (&2,y6,#2.52) + ] +( + (y_of_x taum_2flat_x y1 y2 y3 y4 y5 y6 + > #0.712 + sol0) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + ( y_of_x euler_2flat_x y1 y2 y3 y4 y5 y6< &0) \/ + (y6 < y5) + )`; +};; + +add +{ + idv="1324821088"; + doc="full hexagon with one flat, hi,hi, can zero out both ears. + Big alternating central triangle. + By symmetry, wlog y4 < y5. + The constant 0.013 comes from 2535350075. + We add constant in on the hi case, even though it isn't needed here. + To permit simplification of the lo case later. + "; + tags=[Flypaper["SAUZWSD"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (&2,y6,#2.52) + ] +( + (y_of_x taum_1flat_x y1 y2 y3 y4 y5 y6 > #0.712 + &2 * #0.013) \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y5 < y4 \/ + ( y_of_x euler_1flat_x y1 y2 y3 y4 y5 y6< &0) + )`; +};; + +add +{ + idv="4108834026"; + doc="full hexagon with one flat, ears: hi,lo, can zero out hi ear. + Big alternating central triangle. + To stabilize near delta=0, we add a disjunct that erases and takes a penalty. + The constant 0.013 comes from 2535350075. + The extra disjuncts are justified by that calc and by + the stronger ineq proved in '132482...' + "; + tags=[Flypaper["SAUZWSD"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (&2,y6,#2.52) + ] +( + (y_of_x taum_1flat_x y1 y2 y3 y4 y5 y6 + + y_of_x (taum_sub246_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > #0.712 + #0.013) \/ + (y_of_x taum_1flat_x y1 y2 y3 y4 y5 y6 > #0.712 + #0.013 + sol0) \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + (y_of_x euler_1flat_x y1 y2 y3 y4 y5 y6< &0) + )`; +};; + +add +{ + idv="6388508112"; + doc="full hexagon with one flat, ears: lo,lo + Big alternating central triangle. + If delta hi>0, take the penalty and erase. + By symmetry, wlog 0 < delta234 < delta135 + To stabilize near delta=0, we add disjuncts that erase and take a penalty. + "; + tags=[Flypaper["SAUZWSD"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (&2,y6,#2.52) + ] +( + (y_of_x taum_1flat_x y1 y2 y3 y4 y5 y6 + + y_of_x (taum_sub246_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > + #0.712 + sol0) \/ + (y_of_x taum_1flat_x y1 y2 y3 y4 y5 y6 + > #0.712 + &2 * sol0) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + ( y_of_x euler_1flat_x y1 y2 y3 y4 y5 y6< &0) + )`; +};; + + +add +{ + idv="5493250206"; + doc="full hexagon with no flats, three ears: hi,hi,hi, can zero out all ears. + Big alternating central triangle. + By symmetry y1 < y2 < y3 + "; + tags=[Flypaper["SAUZWSD"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( (taum y1 y2 y3 y4 y5 y6 + > #0.712 + &3 * #0.013) \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + ( y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) \/ + (y2 < y1) \/ (y3 < y2) + )`; +};; + +add +{ + idv="2283016857"; + doc="full hexagon with no flats, three ears: hi,hi,lo=126, zero out hi ears. + Big alternating central triangle, extremal ears. + To stabilize near delta=0, we add a disjunct that erases and takes a penalty. + By symmetry, y4 #0.712 + &2 * #0.013) \/ + (taum y1 y2 y3 y4 y5 y6 + > #0.712 + &2 * #0.013 + sol0) \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6> &0 \/ + ( y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) \/ (y5 < y4) + )`; +};; + +add +{ + idv="4872337467"; + doc="full hexagon with no flats, three ears: hi,lo,lo, zero out hi ear. + Big alternating central triangle, extremal ears. + By symmetry, wlog 0 < delta135 < delta126 + To stabilize near delta=0, we add disjuncts that erase and take a penalty. + "; + tags=[Flypaper["SAUZWSD"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( + (taum y1 y2 y3 y4 y5 y6 + +y_of_x (taum_sub345_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 + > #0.712 + #0.013 + sol0) \/ + (taum y1 y2 y3 y4 y5 y6 + > #0.712 + #0.013 + &2 * sol0) \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 \/ + y_of_x (delta_126_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + ( y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +add +{ + idv="3615835903"; + doc="full hexagon with no flats, three ears: low, low, low + Big alternating central triangle, extremal ears. + By symmetry, wlog, we may order the delta terms. + 0 < delta234 < delta135 < delta126 + To stabilize near delta=0, we add disjuncts that erase and take a penalty. + "; + tags=[Flypaper["SAUZWSD"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( +(taum y1 y2 y3 y4 y5 y6 + +y_of_x (taum_sub345_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 + > #0.712 + &2 * sol0) \/ +(taum y1 y2 y3 y4 y5 y6 + > #0.712 + &3 * sol0) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 \/ + y_of_x (delta_126_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + ( y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + + +add +{ + idv="2535350075"; + doc="full hexagon ear calculation. + This shows that if (delta hi > 0) and (delta lo >0) we can erase the ear with small penalty. + Hence, when we look at a lo ear, we can wrap it in with the hi ear case when + the hi ear exists: (delta hi>0). + By symmetry, wlog y2 < y3. + "; + tags=[Flypaper["SAUZWSD"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,&2); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (taum y1 y2 y3 y4 y5 y6 > -- #0.013) \/ + (y_of_x (delta_sub1_x (#2.52 pow 2)) y1 y2 y3 y4 y5 y6 < &0) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ (y3 < y2) + )`; +};; + +addtex (Section,"Main Estimate","Pentagons, all top edges 2");; +(* New Pentagons, June 3, 2011. + This section completely treats all kinds of + pentagons, modulo cases with a diagonal <= 3.01. *) + + +add +{ + idv="7067938795"; + doc="A pentagon cannot have two straights. This is the A-piece dihedral bound. + If a pentagon has two straights then + pi /2 < dih y1 _ _ 3.01 2 2 < dih_y. This is impossible, by this calc. + This estimate also gets used on straight+hi."; + tags=[Flypaper["EDZEPIH"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0);]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.24); + (#3.01,y6,#3.24) + ] +( + ( dih_y y1 y2 y3 y4 y5 y6 < pi / &2 - #0.46) + )`; +};; + + +add +{ + idv="9459075374"; + doc="(EAR) A bound on the delta of an ear in a pent, when the pent has a straight on the other side. + The disjunct (dih_y y1 y2 y3 y4 y5 y6 < #0.46) has been 'linearized'. + Tan[0.46]^2 = 0.245469... + In more detail, this calc shows that delta > 30.2 or dih < 0.46. + By obtuse calcs, we know that the combined angle at the node is + at least pi/2. If we have a straight node, and dih < 0.46, then + the combined angle is less than 0 + 0.46 + (pi/2 - 0.46) =pi/2 by + '7067938795'. Hence a flat on the other side ==> delta of this ear > 30.2. + "; + tags=[Flypaper["EDZEPIH"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0);]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.52,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.24); + (&2,y6,#2.52) + ] +(let tan2lower = #0.245468 in + (delta_y y1 y2 y3 y4 y5 y6 > #30.2) \/ + (&4 * x1_delta_y y1 y2 y3 y4 y5 y6 < tan2lower * delta4_squared_y y1 y2 y3 y4 y5 y6) + )`; +};; + + +add +{ + idv="2559885109"; + doc="(EAR) A pentagon lo ear bound"; + tags=[Flypaper["EDZEPIH"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0);]; + ineq = all_forall `ineq [ + (&2,y1,&2); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.24); + (&2,y5,&2); + (&2,y6,&2) + ] +( + ( taum y1 y2 y3 y4 y5 y6 > &0) + )`; +};; + +add +{ + idv="9861833891"; + doc="pent+hi+something that we can zero out. + This and '8199484193' do the case of no straight nodes. + "; + tags=[Flypaper["EDZEPIH"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.24); + (#3.01,y6,#3.24) + ] +( taum y1 y2 y3 y4 y5 y6 + + y_of_x (taum_sub345_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > #0.616 \/ + taum y1 y2 y3 y4 y5 y6 > #0.616 + )`; +};; + +add +{ + idv="8199484193"; + doc="pent+lo+something that we can zero out. + (We can zero out anything but a straight node.) + This and '9861833891' do the case of no straight nodes. + "; + tags=[Flypaper["EDZEPIH"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.24); + (#3.01,y6,#3.24) + ] +( taum y1 y2 y3 y4 y5 y6 + + y_of_x (taum_sub345_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 + > #0.616 + )`; +};; + + +add +{ + idv="3980286827"; + doc="pent+straight126+lo + The delta_pent >0 iff edge_flat y6 y1 y2 _ (&2) (&2) > #3.24 + The straight goes along 126. + the low is placed along 135. + The variable called y6 is in fact the ht of enclosed straight node + along the (1,2,6) face. The edge |v1-v2| is computed by taum_1flat. + delta_pent_x = delta_x x1 x2 x6 4 4 3.24^2. + "; + tags=[Flypaper["EDZEPIH"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.24); + (&2,y6,#2.52) + ] +( y_of_x taum_1flat_x y1 y2 y3 y4 y5 y6 + + y_of_x (taum_sub246_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 + > #0.616 \/ + y_of_x (delta_pent_x) y1 y2 y3 y4 y5 y6 > &0 + )`; +};; + +add +{ + idv="3221740746 a"; + doc="pent+straight126+hi + delta_pent_x = delta_x x1 x2 x6 4 4 3.24^2. + has non-standard ordering of variables, x3<->x6. + y6 = ht of the straight node on the y1-y2-* face. + "; + tags=[Flypaper["EDZEPIH"];Main_estimate;Cfsqp; + Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.24); + (&2,y6,#2.52) + ] +( y_of_x taum_1flat_x y1 y2 y3 y4 y5 y6 + + y_of_x (taum_sub246_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > #0.616 \/ + (y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 < #30.2) \/ + y_of_x (delta_pent_x) y1 y2 y3 y4 y5 y6 > &0 + )`; +};; + +(* We have finished the main part of the verification of pents. + These last calculations show that none of the three nodes on + the big inner triangle can be straight. So we don't need to + worry about this, when making calculations. *) + +add +{ + idv="8520556953"; + doc="(EAR) no straights on vertices of big inner triangle of pent. + This is the skinny triangle (ear) bound. + Upper bound on y6 is 1+Sqrt[5]. + Need to do a dih replacement. + Tan[1.001]^2 > 2.43621. + The disjunct implies dih < #1.001. + Combine this with '9977174768' + "; + tags=[Flypaper["EDZEPIH"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (&2,y5,&2); + (#3.01,y6,#3.23607) + ] +( + let tan2lower = #2.43621 in + ( &4 * x1_delta_y y1 y2 y3 y4 y5 y6 < tan2lower * delta4_squared_y y1 y2 y3 y4 y5 y6) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +add +{ + idv="9977174768"; + doc="no straight nodes on big inner triangle of pent. + Upper bound on y6 is 1+Sqrt[5]. + Tan[1.001]^2 > 2.43621. + The disjunct implies dih < pi - #1.001. + Combine this with '8520556953'. + "; + tags=[Flypaper["EDZEPIH"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.23607); + (&2,y5,&2); + (#3.01,y6,#3.23607) + ] +( dih_y y1 y2 y3 y4 y5 y6 < pi - #1.001)`; +};; + + +skip +{ + idv="6281973111"; + doc="no straight node on big inner triangle of pent. + Upper bound on y6 is 1+Sqrt[5]. + Moved to skipped May 26, 2012. It is a special case of '7067938795' + This is used to prove that the node of the pentagon with three + triangles is not straight: + (pi - 2 1.001) + 1.001 + 1.001 <= pi.) + "; + tags=[Flypaper["EDZEPIH"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.23607); + (#3.01,y6,#3.23607) + ] +( + ( dih_y y1 y2 y3 y4 y5 y6 < pi - &2 * #1.001) + )`; +};; + +Functional_equation.functional_overload();; + +(* May 9, 2013. taud function. taud_v4 seems to be the version that + works in all cases (pent and hex). *) + + + let add = Ineq.add;; + + let skip = Ineq.skip;; + + let all_forall = Sphere.all_forall;; + + +run +{ + idv="test"; + doc=" + local fan/main estimate/terminal pent + LHS(135,delta=20) RHS(126,delta=0) + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237) + ] +( + ((taum y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_126_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + y_of_x mu6_x +// y_of_x (mud_135_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + > #0.616) \/ + y_of_x (delta_126_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 > d )) +`; +};; + + + + + +(* Scratch area *) + +(* +let runhh i234 i126 i135 = try (run(make_hex_ear i234 i126 i135)) with _ -> () ;; +let run2hh i234 i126 i135 = try ( + let _ = run2(make_hex_ear i234 i126 i135) in ()) with _ -> () ;; + +*) + + + +let install_functions () = + let _ = map Parse_ineq.autogen_add [mu_y;delta_x1;taud;] in + let _ = map Parse_ineq.macro_add[ mud_135_x; + mud_126_x;mud_234_x;mudLs_234_x;mudLs_135_x;mudLs_126_x; + taud_x;nonfunctional_mu6_x;nonfunctional_taud_D1; + nonfunctional_taud_D2; + nonfunctional_edge2_126_x; + nonfunctional_edge2_135_x; + nonfunctional_edge2_234_x; + flat_term2_126_x; + flat_term2_135_x;flat_term2_234_x] in + let _ = map Function_list.function_add + [ functional_delta_x1;mu6_x;taud_x_ALT;taud_D2_num_x;taud_D1_num_x; + functional_mud_135_x;functional_mud_126_x;functional_mud_234_x;mudLs_234_x;mudLs_126_x;mudLs_135_x; + ups_126; + functional_edge2_126_x;functional_edge2_135_x;functional_edge2_234_x; + flat_term2_126_x;flat_term2_135_x;flat_term2_234_x] in + "remember to reload Auto_lib, etc.";; + +(* + map Parse_ineq.autogen_remove [edge_flatD_x1;taud_v4_D2_num;taud;taud_D2_num_x];; + map Parse_ineq.macro_remove [taud_D2_num_x;edge_126_x;edge_135_x; + functional_edge_135_x;flat_term_126_x;flat_term_135_x; + functional_edge_126_x;mudd_135_x;mudd_126_x; + mudd_135_x_v2;mudd_126_x_v2; +];; + + map Function_list.function_remove [mu_y;taud_x;delta_x1;functional_edge_126_x; + functional_edge_135_x;];; +*) + + +Parse_ineq.autogen_remove mudL_234_x;; +Function_list.function_remove mudL_234_x;; +1;; + + +(* + +flyspeck_needs "nonlinear/scripts.hl";; + + let run s = + let _ = Ineq.add s in + Scripts.one_cfsqp s.idv;; + + rflyspeck_needs "nonlinear/auto_lib.hl";; + + let run2 s = + let _ = Ineq.add s in + Auto_lib.testsplit true s.idv;; + + let run2f s = + let _ = Ineq.add s in + Auto_lib.testsplit false s.idv;; + + + +Auto_lib.testsplit true "7796879304";; +map (Auto_lib.testsplit true) cases;; + + +map Scripts.one_cfsqp cases;; +*) + +map (Auto_lib.testsplit true) ["test U1";"test U2";"test U3"; +"test U4";"test U5";"test U6"; +"test U7";"test U8";"test U9"; +"test U10";];; + + diff --git a/legacy/oldnonlinear/nonlinear/main_ineq_calcs.ml b/legacy/oldnonlinear/nonlinear/main_ineq_calcs.ml new file mode 100644 index 0000000..93da889 --- /dev/null +++ b/legacy/oldnonlinear/nonlinear/main_ineq_calcs.ml @@ -0,0 +1,69 @@ +#directory "/Users/thomashales/Desktop/googlecode/flyspeck/glpk";; +#use "sphere.ml";; + + + open Sphere_math;; + + let arc = arclength;; + + let rec binary_rec f a b eps = + let fa = f a in + if abs_float (fa) < eps then a + else + let c = (a +. b) /. 2. in + let fc = f c in + (if (fa *. fc <= 0.0) then binary_rec f a c eps + else binary_rec f c b eps);; + + let binary f a b eps = + let _ = (a < b) or failwith "a b inversion" in + let _ = f a *. f b <= 0.0 or failwith "same sign" in + binary_rec f a b eps;; + + let length_of_arc theta = + binary (fun x -> arc 2. 2. x -. theta) 2.0 4.0 (10.0** -8.0);; + + let tame_table_d r s = + if (r + 2 * s <= 3) then 0.0 + else + let r' = float_of_int r in + let s' = float_of_int s in + 0.103 *. (2.0 -. s') +. 0.2759 *. (r' +. 2.0 *. s' -. 4.0);; + +tame_table_d 3 1;; +tame_table_d 2 2;; +(* "2065952723 A1" +15.53 is the upper bound on the deforming edge. +Let's check that two adjacent standard edges fit within this bound. +Conclusion, whenever there is a pair of adjacent standard edges, they +are extremal 2 or 2.52; EXCEPT in something that starts out a hexagon +or protracted pent with two adjacent flats. +*) + + let check_206A1_constant = + let u = 2.0 *. arc 2. 2. 2.52 in + let m = length_of_arc u in + let m2 = m*.m in + (m2 < 15.53);; (* 15.319 *) + + let check_206A1_protracted51 = + let u = arc 2. 2. 2.52 +. arc 2. 2. sqrt8 in + let m = length_of_arc u in + let m2 = m*.m in + m2;; + (m2 < 15.53);; (* 15.319 *) + + let factoid1 = (* generic fans except for hexagons *) + let u = arc 2. 2. cstab +. arc 2. 2. 2.52 in + u < pi;; (* u = 3.0668... *) + + let two_flats_arc_min = 2.0 *. arc 2.52 2. 2. +. arc 2. 2. 2.;; + +dihedral;; +arc 2. 2. 2.52;; +Pervasives.cos 1.364;; +Pervasives.cos 2.98;; +arc 2. 2. 2. +. arc 2. 2. 2. +. arc 2.52 2. 2.;; +arc 2. 2.52 4.0;; +let dih = dih_y;; + dih 2.52 2. 2. diff --git a/legacy/oldnonlinear/nonlinear/partials.hl b/legacy/oldnonlinear/nonlinear/partials.hl new file mode 100644 index 0000000..3f1ff03 --- /dev/null +++ b/legacy/oldnonlinear/nonlinear/partials.hl @@ -0,0 +1,135 @@ + +(* for derivatives in 6 dimensions *) + +let HAS_SIZE_6 = define_finite_type 6;; + +let DIMINDEX_6 = MATCH_MP DIMINDEX_UNIQUE HAS_SIZE_6;; + +let lift_6 = new_definition `lift_6 (f:real->real->real->real->real->real->real) = + (\ (v:real^6). lift (f (v$1) (v$2) (v$3) (v$4) (v$5) (v$6)) )`;; + +let drop_6 = new_definition `drop_6 (f:real^6->real^1) = + (\x1 x2 x3 x4 x5 x6. drop (f (vector [x1;x2;x3;x4;x5;x6])))`;; + +let lambda_ext = prove_by_refinement( + `!P Q. (!i. 1 <= i /\ i <= dimindex (:B) ==> ((P:num->A) i = Q i)) = + (((lambda i. P i):A^B) = (lambda i. Q i))`, + (* {{{ proof *) + [ +REPEAT STRIP_TAC ; +REWRITE_TAC [GSYM LAMBDA_UNIQUE]; +SIMP_TAC [LAMBDA_BETA]; +MESON_TAC [] + ]);; + (* }}} *) + +let vector6 = prove_by_refinement( + `!(v:real^6). vector [v$1; v$2; v$3; v$4; v$5; v$6] = v`, + (* {{{ proof *) + [ +REWRITE_TAC [vector;GSYM LAMBDA_UNIQUE]; +REWRITE_TAC [DIMINDEX_6;ARITH_RULE `1 <= i /\ i <=6 <=> (i=1 \/ i=2 \/ i=3 \/ i=4 \/ i=5 \/ i=6)`]; +REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[EL;HD;TL;ARITH_RULE `1-1=0 /\ 2 - 1 = SUC 0 /\ 3 - 1 = SUC (SUC 0) /\ 4 - 1 = SUC (SUC(SUC 0)) /\ 5 - 1 = SUC (SUC(SUC(SUC 0))) /\ 6 - 1 = SUC(SUC(SUC(SUC(SUC 0))))`] + ]);; + (* }}} *) + +let vector6_comp = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + (vector:(A)list -> A^6) [x1;x2;x3;x4;x5;x6]$1 = x1 /\ + (vector:(A)list -> A^6) [x1;x2;x3;x4;x5;x6]$2 = x2 /\ + (vector:(A)list -> A^6) [x1;x2;x3;x4;x5;x6]$3 = x3 /\ + (vector:(A)list -> A^6) [x1;x2;x3;x4;x5;x6]$4 = x4 /\ + (vector:(A)list -> A^6) [x1;x2;x3;x4;x5;x6]$5 = x5 /\ + (vector:(A)list -> A^6) [x1;x2;x3;x4;x5;x6]$6 = x6 + `, + (* {{{ proof *) + [ +REWRITE_TAC [vector]; +SIMP_TAC [REWRITE_RULE[DIMINDEX_6] (INST_TYPE[`:6`,`:B`] LAMBDA_BETA); ARITH_RULE `1 <= 1 /\ 1 <=6 /\ 1 <= 2 /\ 2 <= 6 /\ 1 <= 3 /\ 3 <= 6 /\ 1 <= 4 /\ 4 <= 6 /\ 1 <= 5 /\ 5 <= 6 /\ 1 <= 6 /\ 6 <= 6 `;EL;HD;TL;ARITH_RULE `1-1=0 /\ 2 - 1 = SUC 0 /\ 3 - 1 = SUC (SUC 0) /\ 4 - 1 = SUC (SUC(SUC 0)) /\ 5 - 1 = SUC (SUC(SUC(SUC 0))) /\ 6 - 1 = SUC(SUC(SUC(SUC(SUC 0))))`] + ]);; + (* }}} *) + + +let lift6_drop6 = prove_by_refinement( + `!f. lift_6 (drop_6 f) = f`, + (* {{{ proof *) + [ +REWRITE_TAC [lift_6;drop_6;lift;drop]; +GEN_TAC ; +ONCE_REWRITE_TAC[FUN_EQ_THM]; +BETA_TAC; +GEN_TAC ; +REWRITE_TAC [(GSYM VECTOR_ONE)]; +AP_TERM_TAC ; +REWRITE_TAC [vector6] + ]);; + (* }}} *) + +let drop6_lift6 = prove_by_refinement( + `!f. drop_6 (lift_6 f) = f`, + (* {{{ proof *) + [ +REWRITE_TAC [lift_6;drop_6;vector6_comp;LIFT_DROP]; +GEN_TAC ; +REPEAT (MATCH_MP_TAC EQ_EXT THEN GEN_TAC); +BETA_TAC; +REWRITE_TAC [] + ]);; + (* }}} *) + + +(* f'' is the Hessian, viewed as a bilinear function at x. + I plan to use this always on a product X of compact intervals in 6-d, + such that X SUBSET P. We should be able to take `s = (:real^6)` in every case. *) + + +let derived_form2a = new_definition `derived_form2a + p (f:real^6->real) (f':real^6->real^6->real) + (f'':real^6 -> real^6 ->real^6 ->real) (x:real^6) (s:real^6->bool) = + ((!(y:real^6). p y ==> ((has_derivative) (lift o f) (lift o (f' y)) (at y)) ) /\ + (!t. p x ==> (has_derivative) (\u. lift (f' u t)) (\t'. lift (f'' x t t')) (at x within s)) /\ + (!(y:real^6) t t'. p y ==> (continuous) (\u. lift (f'' u t t')) (at y within s))) + `;; + + +let derived_form2b = new_definition `derived_form2b + p (f:real^6->real) (f':real^6->real^6->real) + (f'':real^6 -> real^6 ->real^6 ->real) (x:real^6) (s:real^6->bool) = + ((!(y:real^6). p y ==> ((has_derivative) (lift o f) (lift o (f' y)) (at y)) ) /\ + (!t. p x ==> (has_derivative) (\u. lift (f' u t)) (\t'. lift (f'' x t t')) (at x within s)) /\ ( open p) /\ + (!(y:real^6) t t'. p y ==> (continuous) (\u. lift (f'' u t t')) (at y within s))) + `;; + +(* Theorems needed: + + 1. Clairaut's theorem on equality of mixed partials. + This uses the continuity and openness assumptions, so they have beeen added + to derived_form2b. + Many proofs are available, google search "Equality of Mixed Partials" + For example, http://www.math.ubc.ca/~feldman/m226/mixed.pdf + + 2. Multivariate Taylor's theorem, + This can be deduced from REAL_TAYLOR by + taking t-derivative along a line segement `\t. f(x + t % v)` + + 3. Identification of Hessian as a bilinear function with the + matrix of second partials. This should follow from JACOBIAN_WORKS. + + Tactic needed: + Automatic generation of derived_form2b from f. + *) + + +(* +let mixed_equal = prove_by_refinement( + `!f f' f'' x s. derived_form2b p f f' f'' x s ==> + (!t t'. p y ==> f'' y t t' = f'' y t' t)`, + (* {{{ proof *) + [ + ]);; + (* }}} *) +*) + + + + diff --git a/legacy/oldnonlinear/nonlinear/temp_ineq.hl b/legacy/oldnonlinear/nonlinear/temp_ineq.hl new file mode 100644 index 0000000..ef3939d --- /dev/null +++ b/legacy/oldnonlinear/nonlinear/temp_ineq.hl @@ -0,0 +1,212 @@ +(* ========================================================================== *) +(* FLYSPECK - CODE FORMALIZATION *) +(* *) +(* Chapter: Linear Programming Inequalities *) +(* Author: Thomas C. Hales *) +(* Date: 2010-08-01 *) +(* ========================================================================== *) + + +(* Generate new linear inequalities that are needed for linear + programs. This file is part of the scaffolding of the project. It + was used extensively to generate new inequalities that have been used + in the linear programming part of the proof. These inequalities have + all been added to ineq.hl. + + This file has served its purpose and is no longer needed. + + Mathematica and Cfsqp both need to be installed before this code can + be executed. The mathematica runs are generated with the script found + in the file whose pathname is given by the string math_initf. + + There is also tight coordinate between this file and the linear programming + directory glpk/tame_archive/ + + WARNING: For the functions that write external files and reread them into a + reference, it seems that it is necessary to open this module for it to + function properly. +*) + + +(* + + There are several steps required to create an inequality and rerun + linear programs. This file automates these steps. + + 0/- Analyze output to find a triangle that is bad with + sorted_azim_weighted_diff darts_of_std_tri amx;; + 1/- Mathematica. holineq[Dihedral,{2,2,2,2,2,2},{2.52,2.25,2.52,2.52,2.52,2.52}]. + 2/- save, strip "\ " at the end of lines. + 3/- run Parse_ineq.execute_cfsqp new_ineq to check if it seems to be true. + If not, edit until it is correct. + 4/- change the domain info to something that is recognized by glpk model. + 5/- add new_ineq to put in archive. + 6/- Parse_ineq.lp_string() to generate model body.mod. + 7/- Save body.mod in directory: glpk/tame_archive. + 8/- Lpproc.make_model() to make the new model. + 9/- Rerun the linear programs. + +*) + +(* Interaction with inequality generation. Mathematica is needed for + the next bit. *) + + + + +flyspeck_needs "nonlinear/ineq.hl";; + +module Temp_ineq = struct + + + let all_forall = Sphere.all_forall;; + +let junkval = { + idv = "junk"; + doc="junk"; + tags=[]; + ineq = + all_forall `ineq [(&1,y,&2)] (y > &0)`; + };; + +(* ========================================================================== *) +(* Mathematica section. *) +(* ========================================================================== *) + +let mathfile = "/Applications/Mathematica\ 5.2.app/Contents/MacOS/MathKernel";; + +let math_initf= "/Users/thomashales/Desktop/googlecode/flyspeck/mathematica/auto_mkineq.m";; + +let mathtemp = "/tmp/mathtemp4.hl";; (* hardwired into mathematica code *) + +let command_string fn lb ub = +(mathfile^" -run \"<< "^math_initf^ ";\n runQuit["^fn^","^lb^","^ub^"];\"");; + +let command_string_p fn p lb ub = +(mathfile^" -run \"<< "^math_initf^ ";\n runQuitp["^fn^","^p^","^lb^","^ub^"];\"");; + +(* ========================================================================== *) +(* cfsqp and ineq creation section. The mathematica code produces a + guess of an inequality (that is often inaccurate). It is run to cfsqp + to correct the guess, then packaged into an ineq. *) +(* ========================================================================== *) + + + let cfsqp_margin idq = + let cfsqp_dir = flyspeck_dir^"/../cfsqp" in + let _ = Parse_ineq.mk_cc (cfsqp_dir ^ "/tmp/t.cc") idq in + let _ = Parse_ineq.compile() in + let _ = (0= Sys.command(cfsqp_dir^"/tmp/t.o > /tmp/cfsqp_out.txt")) or failwith "execution error" in + let s2 = process_to_string("grep 'constrained min:' /tmp/cfsqp_out.txt | sed 's/^constrained min://g' | tr -d '\n'") in float_of_string s2;; + +let padded_decimal_of_cfsqp idq = (* add padding to make nonlinear verifications easier *) + let r = cfsqp_margin idq in + let a = if r < 0.001 then 0.001 -. r else 0.0 in + let b = int_of_float (Pervasives.ceil (10000.0 *. a)) in + mk_binop `DECIMAL` (mk_numeral (Int b)) (mk_numeral (Int 10000));; + +let add_decimal ineq a = + let (quant,raw) = strip_forall ineq in + let (dom,gt) = dest_binop `ineq` raw in + let (lhs,rhs) = dest_binop `real_gt` gt in + let lhs' = mk_binop `real_add` lhs a in + let gt' = mk_binop `real_gt` lhs' rhs in + let raw' = mk_binop `ineq` dom gt' in + let ineq' = list_mk_forall (quant,raw') in + ineq';; + +let sqrt8_sqrt2 = prove_by_refinement( + `sqrt (&8) = &2 * sqrt2`, + (* {{{ proof *) + [ + SIMP_TAC[Sphere.sqrt2;SQRT_MUL; + REAL_ARITH `&8 = &4 * &2 /\ &0 <= &2 /\ &0 <= &4`;]; + REWRITE_TAC[REAL_ARITH `&4 = &2 pow 2 /\ abs(&2) = &2`;POW_2_SQRT_ABS]; + ]);; + (* }}} *) + +let constant_fix = [sqrt8_sqrt2;Sphere.h0;Sphere.sqrt2;Sphere.sqrt8; + REAL_ARITH `#2 = &2 /\ #2.0 = &2 /\ &2 * #1.26 = #2.52 /\ #2.00 = &2 `];; + +(* +problem: dart_std3 and dart_std3_big have the same "domain". +*) + +let reduced_dart_classes() = search_thml (term_match []) [omit `dart_std3_big`] (map (fun t-> ("",t)) (!Ineq.dart_classes));; + +let dart_class_rew() = map (REWRITE_RULE constant_fix) (map (GSYM o snd ) (reduced_dart_classes()));; + +let convert_domain ineq = snd (dest_eq (concl + (REWRITE_CONV ( constant_fix @ (dart_class_rew()) ) ineq)));; + +let adjust = + let zero = `&0` in + fun s idq -> + let a = padded_decimal_of_cfsqp idq in + if (a = zero) then idq else + { + idv = idq.idv; + doc = idq.doc ^ s^ "\n The inequality has been fitted to cfsqp margins."; + tags = idq.tags; + ineq = convert_domain(add_decimal idq.ineq a); + };; + +(* By loading the file mathtemp, the value of the reference tempval is + changed to the output of the mathematica run *) + + let tempval = ref junkval;; + +let generate_ineq_datum = + fun fname slb sub -> + let example = command_string fname slb sub in + let _ = Sys.command(example) in + let _ = loadt mathtemp in + adjust + ("\n Generated by generate_ineq_datum with input "^ + fname ^" "^slb^" "^sub^".") (!tempval);; + +let generate_ineq_datum_p = + fun fname sp slb sub -> + let example = command_string_p fname sp slb sub in + let _ = Sys.command(example) in + let _ = loadt mathtemp in + adjust ("\n Generated by generate_ineq_datum_p with input "^ + fname ^" "^sp^" "^slb^" "^sub^".") (!tempval);; + +(* ========================================================================== *) +(* Ocaml function section. *) +(* ========================================================================== *) + + +(* + +This is a quick hack that converts an Hol-light inequality (>) into a function +that gives the difference between the right and left hand sides of an +ineq LHS > RHS for given values y1..y6. + +It generates the code as a string, writes it to an external file, then +reads it back into the reference tempfn. + +It assumes that the inequality has this particular form (six free variables +named y1..y6. +*) + +let ocaml_funstring_of_ineq iqd = + let t = snd(strip_forall (Parse_ineq.prep_term (iqd.ineq))) in + let (_,tm) = dest_comb t in +let (lhs,rhs) = dest_binop `real_gt` tm in +let olhs = Parse_ineq.ocaml_string_of_term lhs in +let orhs = Parse_ineq.ocaml_string_of_term rhs in + "(fun y1 y2 y3 y4 y5 y6 -> " ^ olhs ^ " -. " ^ orhs ^ ");;";; + +let tempfn = ref (fun (y1:float) (y2:float) (y3:float) (y4:float) (y5:float) (y6:float) -> 0.0);; + +let ocaml_eval = + let tempfile = Filename.temp_file "ocaml_eval_" ".ml" in + fun iqd -> + let _ = Parse_ineq.output_filestring tempfile + ("tempfn := " ^ ocaml_funstring_of_ineq iqd) in + let _ = loadt tempfile in + !tempfn;; + +end;; diff --git a/legacy/oldnonlinear/nonlinear/test_ineq.hl b/legacy/oldnonlinear/nonlinear/test_ineq.hl new file mode 100644 index 0000000..998fa2c --- /dev/null +++ b/legacy/oldnonlinear/nonlinear/test_ineq.hl @@ -0,0 +1,480 @@ +(* tests of nonlinear inequalities from ineq.hl *) +(* removed from glpk model OXLZLEZ *) + +let do_betas x = all_forall (snd(dest_eq(concl(BETAS_CONV x))));; +let all_forall =Sphere.all_forall;; + + + +(* +let mk_tm23 i3 i5 i6 = + let x i = List.nth [`&2`; `&2 * hminus`; `&2 * hplus` ; `sqrt8`] i in + let X i = x (i+1) in + let mid i = if (i=1) then 1 else 0 in + let m = mk_small_numeral in + let w1 = 1 + mid i6 in + let w2 = 1 + mid i3 + mid i5 in + list_mk_comb (template23, [x i3;X i3; x i5;X i5; x i6 ;X i6; m w1; m w2]);; + +let mk_ineq23 i3 i5 i6 = all_forall (snd(dest_eq(concl(BETAS_CONV (mk_tm23 i3 i5 i6)))));; + +let add23 i3 i5 i6 = + add { + id = Printf.sprintf "ZTGIJCF23 %d %d %d 7907792228" i3 i5 i6; + ineq = mk_ineq23 i3 i5 i6; + doc = "This is the 2&3-cell inequality for five or more leaves."; + tags = [Cfsqp;Flypaper]; + };; + + for i3=0 to 2 do + for i5 = 0 to 2 do + for i6 = 0 to 2 do + add23 i3 i5 i6 done done done;; +*) + + +let _ = +{ + id = "QITNPEA 9507854632"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (#2 ,y4, #2.1); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ((gamma23f y1 y2 y3 y4 y5 y6 1 1 sqrt2 lmfun - #0.00242 + - #0.00609451*dih_y y1 y2 y3 y4 y5 y6 > #0.0) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2) \/ + (eta_y y1 y2 y6 > sqrt2 ) \/ + (eta_y y1 y3 y5 > sqrt2))`; + doc = " + Note the upper bound on $y_4$ is $2.1$. + This is an inequality for $23$-cells used to prove the cluster inequality."; + tags = [Tex;Cfsqp;Clusterlp]; +};; + +let _ = +{ + id = "QITNPEA 9507854632"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (#2 ,y4, #2.1); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ((gamma23f y1 y2 y3 y4 y5 y6 1 1 sqrt2 lmfun - #0.00242 + - #0.00609451*dih_y y1 y2 y3 y4 y5 y6 > #0.0) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2) \/ + (eta_y y1 y2 y6 > sqrt2 ) \/ + (eta_y y1 y3 y5 > sqrt2))`; + doc = " + Note the upper bound on $y_4$ is $2.1$. The same inequality holds when + $y_4\\ge 2.1$. In fact, \\ineq{4003532128} is even stronger. + This is an inequality for $23$-cells used to prove the cluster inequality."; + tags = [Tex;Cfsqp;Clusterlp]; +};; + +test_ineq { + id = "2"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (#2 ,y4, &2 * hminus); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ( (gamma4f y1 y2 y3 y4 y5 y6 lmfun > #0.0) \/ + (dih_y y1 y2 y3 y4 y5 y6 < #1.575) )`; + doc = "test"; + tags = []; +};; + +let _ = +{ + id = "QITNPEA 4 blades, 3 quarters, 1 23-cell"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (&2,y4, sqrt8); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus); + (&2,y7, &2 * hminus); + (&2,y8, &2 * hminus); + (&2,y9, &2 * hminus); + (&2,y10, &2 * hminus); + (&2,y11, &2 * hminus); + (&2,y12, &2 * hminus); + (&2,y13, &2 * hminus) + ] + ((gamma23f y1 y2 y3 y4 y5 y6 1 1 sqrt2 lmfun + + gamma4f y1 y3 y7 y9 y12 y5 lmfun + + gamma4f y1 y7 y8 y10 y13 y12 lmfun + + gamma4f y1 y8 y2 y11 y6 y13 lmfun > #0.0) \/ + ( + dih_y y1 y2 y3 y4 y5 y6 + + dih_y y1 y3 y7 y9 y12 y5 + + dih_y y1 y7 y8 y10 y13 y12 + + dih_y y1 y8 y2 y11 y6 y13 < &2 * pi + ) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2))`; + doc = " + This is a numerical test of the 4-blade inequality in the case of three quarters + and one 23-cell. It is too large to be directly checked by rigorous nonlinear + optimization. Instead it is broken into smaller pieces."; + tags = [Cfsqp;Clusterlp;Derived]; +};; + +let _ = +{ + id = "OCTAHEDRON OXLZLEZ TEST 4 blades, 3 quarters, 1 4-cell wt 1/2"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (&2 * hminus ,y4, &2 *hplus); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus); + (&2,y7, &2 * hminus); + (&2,y8, &2 * hminus); + (&2,y9, &2 * hminus); + (&2,y10, &2 * hminus); + (&2,y11, &2 * hminus); + (&2,y12, &2 * hminus); + (&2,y13, &2 * hminus) + ] + ((gamma4f y1 y2 y3 y4 y5 y6 lmfun / &2 + beta_bump_force_y y1 y2 y3 y4 y5 y6 + + gamma4f y1 y3 y7 y9 y12 y5 lmfun + + gamma4f y1 y7 y8 y10 y13 y12 lmfun + + gamma4f y1 y8 y2 y11 y6 y13 lmfun > #0.0) \/ + ( + dih_y y1 y2 y3 y4 y5 y6 + + dih_y y1 y3 y7 y9 y12 y5 + + dih_y y1 y7 y8 y10 y13 y12 + + dih_y y1 y8 y2 y11 y6 y13 > &2 * pi + ) \/ + ( + dih_y y1 y2 y3 y4 y5 y6 + + dih_y y1 y3 y7 y9 y12 y5 + + dih_y y1 y7 y8 y10 y13 y12 + + dih_y y1 y8 y2 y11 y6 y13 < &2 * pi - #0.002 + ) )`; + doc = " + This is a numerical test of the 4-blade inequality in the case of three quarters + and one 4-cell of wt 1/2. + This is the most important case of the inequality. + It is too large to be directly checked by rigorous nonlinear + optimization. Instead it is broken into smaller pieces."; + tags = [Cfsqp;Clusterlp;Derived]; +};; + + +let _ = +{ +id = "3611774025"; +ineq = all_forall `ineq +[ +(&2, x12, &2 * h0); +(&2, x13, &2 * h0); +(&2, x14, &2 * h0); +(&2, x15, &2 * h0); +(&2, x23, &2 * h0); +(&2, x24, &2 * h0); +(&2, x25, &2 * h0); +(&2, x34, &2 * h0); +(&2, x35, &2 * h0); +(&2, x45, &2 * h0) +] + (cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 < &0)`; +tags = []; +doc = "A Cayley Menger determinant is positive. This was part of Local Fan, but + is no longer needed."; +};; + + +(* +let I_1965189142= +all_forall `ineq +[(#1.0,h,#1.26); + (#3.0,k,#34.0)] + (#0.591 - #0.0331 *k + #0.506 * lmfun h <= + regular_spherical_polygon_area (cos (acs (h/ &2) - pi/ &6)) k)`;; + + + + +let I_6096597438= +all_forall `ineq + [(#3.0,k,#64.0)] + (#1.591 - #0.0331 *k + #0.506 * lmfun (#1.0) <= + regular_spherical_polygon_area (cos (#0.797)) k)`;; + +*) + +let ZZ = ();; + + + + + + + + +add { + id = "8082208587"; + doc="We can use extremal edge properties and the tame table D calculations + to reduce to the case where $y_4=\\sqrt8$ and $y_5,y_6$ are extremal."; + tags = [Cfsqp;Lp;Tex]; + ineq = all_forall `ineq + [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#2.52,y5,sqrt8); + (&2,y6,#2.52) + ] +(taum y1 y2 y3 sqrt8 y5 y6 > #0.2759)`; +};; + + +add { + id = "9620775909"; + doc="We can use dimension reduction methods to simplify this inequality."; + tags = [Cfsqp;Lp;Tex;Penalty(5.0,500.0)]; + ineq = all_forall `ineq + [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (sqrt8,y4,&2 * #2.52); + (#2.52,y5,sqrt8); + (&2,y6,#2.52); + (&2,y7,#2.52); + (&2,y8,#2.52); + (&2,y9,#2.52) + ] +((tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > #0.492) \/ + (enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < sqrt8 ))`; +};; + +add { + id = "test"; + doc = ""; + tags=[]; + ineq = all_forall `ineq + [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); + (#2.52,y5,sqrt8) + ] + (taum y1 y2 y3 y4 y5 sqrt8 > #0.3493)`; +};; + +add { + id = "test"; + doc = ""; + tags=[]; + ineq = all_forall `ineq + [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); + (#2.52,y5,sqrt8) + ] + (taum y1 y2 y3 y4 y5 sqrt8 > #0.3493)`; +};; + +add { + id = "9620775909 fake"; + doc="For reference only: + We can use dimension reduction methods to simplify this inequality. + The constant was 0.492."; + tags = [Cfsqp;Lp;Tex;Penalty(5.0,500.0)]; + ineq = all_forall `ineq + [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (sqrt8,y4,&2 * #2.52); + (#2.52,y5,sqrt8); + (&2,y6,#2.52); + (&2,y7,#2.52); + (&2,y8,#2.52); + (&2,y9,#2.52) + ] +((tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > #0.492) \/ + (enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < sqrt8 ))`; +};; + + + + + +let profile_apex5_d = new_definition + `profile_apex5_d r s = tame_table_d (r-1) (s+1)`;; + +let profile_std56_flat_free_d = new_definition + `profile_std56_flat_free_d r s = if (r,s) = (6,0) then #0.91 else + (&2 - &s)* #0.128 + (&r + &2 * &s - &4) * #0.44`;; + +let profile_apex4_d = new_definition + `profile_apex4_d r s = if (r,s)=(4,0) then #0.4773 else #0.3493`;; + +add { + id = ""; + doc = ""; + tags=[]; + ineq = all_forall `ineq + [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); + (#2.52,y5,sqrt8) + ] + (taum y1 y2 y3 y4 y5 sqrt8 > #0.3493)`; +};; + +(* In lp2009 but not graph0 *) + +(* +let I_3336871894= + all_forall `ineq + [ + (#2.0,y1,#2.52); + (#2.0,y2,#2.52); + (#2.0,y3,#2.52); + (#2.0,y4,#2.52); + (#2.0,y5,#2.52); + (#2.0,y6,#2.52)] +( taum y1 y2 y3 y4 y5 y6 >= #0.0)`;; + +let I_8880534953= + all_forall `ineq + [ + (#2.0,y1,#2.52); + (#2.0,y2,#2.52); + (#2.0,y3,#2.52); + (#2.0,y4,#2.52); + (#2.52,y5,sqrt8); + (#2.52,y6,sqrt8)] +( taum y1 y2 y3 y4 y5 y6 - #0.2759 > #0.0)`;; +*) + +(* These are inequalities found in the lp2009.cc file + that were not found in the graph0.mod file *) + +(* +add { + id = "5769230427"; + doc="deprecated and false"; + tags = [Cfsqp]; + ineq = all_forall `ineq + [ + (#2.0,y1,#2.52); + (#2.0,y2,#2.52); + (#2.0,y3,#2.52); + (#2.0,y4,#2.52); + (#3.0,y5,#3.3); + (#2.0,y6,#2.52)] +( (taum y1 y2 y3 y4 y5 y6) - + #0.231 - (#0.622 * (dih_y y1 y2 y3 y4 y5 y6)) + - (#2.09 / #2.0) - ((#0.54 / #2.0) * (y1 - #2.0)) + + (#0.578 * (y2 + y6 - #4.0)) > #0.0)`; +};; +*) + + + + +(*found in lp2009 but not graph0 *) + +let I_5464178191= + all_forall `ineq[ + (#2.0,y1,#2.52); + (#2.0,y2,#2.52); + (#2.0,y3,#2.52); + (#2.52,y4,#5.04); + (#2.0,y5,#2.52); + (#2.0,y6,#2.52); + (#2.0,y7,#2.52); + (#2.0,y8,#2.52); + (#2.0,y9,#2.52)] +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 - #0.206 > #0.0) \/ +( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #2.52 ) \/ +( delta_y y1 y2 y3 y4 y5 y6 < &0) \/ +( delta_y y7 y2 y3 y4 y8 y9 < &0))`;; + + +(* + +add { + id = "181212899"; + doc="This original version of the inequality. There are six derived versions."; + tags = [Cfsqp;Tex]; + ineq = all_forall `ineq[ + (#2.0, y1, #2.52); + (#2.0, y2, #2.52); + (#2.0, y3, #2.52); + (#2.52, y4, sqrt8); + (#2.0, y5, #2.52); + (#2.52, y6, sqrt8)] +(dih_y y1 y2 y3 y4 y5 y6 - #1.448 - +(#0.266 * (y1 - #2.0)) + +(#0.295 * (y2 - #2.0)) + +(#0.57 * (y3 - #2.0)) - +(#0.745 * (y4 - #2.52)) + +(#0.268 * (y5 - #2.0)) + +(#0.385 * (y6 - #2.52)) > #0.0)`; +};; + +*) + + +let iqd s dart sym t = + let c = mk_mconst (dart,tyR) in { + id = s; + doc = ""; + tags = [Cfsqp;Lp;] @ (if sym then [Lpsymmetry] else []); + ineq = Ineq.mk_tplate templateC (c:: t); +};; + +1;; + +let mk_QITNPEA' i3 i4 i5 i6 = + let template = `\ y3m y3M y4m y4M y5m y5M y6m y6M w m. ineq + [(&2 * hminus, y1, &2 * hplus); + (&2 ,y2, &2 *hminus); + (y3m,y3,y3M); + (y4m,y4,y4M); + (y5m,y5,y5M); + (y6m,y6,y6M)] + ((gamma4f y1 y2 y3 y4 y5 y6 lmfun / &w + &m *beta_bump_y y1 y2 y3 y4 y5 y6 + - #0.0105256 + #0.00522841*dih_y y1 y2 y3 y4 y5 y6 > #0.0) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2))` in + let x i = List.nth [`&2`; `&2 * hminus`; `sqrt8`] i in + let X i = x (i+1) in + let mid i = if (i=1) then 1 else 0 in + let w = 1 + mid i3 + mid i4 + mid i5 + mid i6 in + let m = if (w =2) && (i4 = 1) then `1` else `0` in + Ineq.mk_tplate template [x i3;X i3; x i4;X i4; x i5;X i5; x i6 ;X i6; mk_small_numeral w; m];; + +add { + id = "QITNPEA test"; + ineq = mk_QITNPEA' 0 1 0 0; + doc = "This is a $4$-cell (nonquarter) inequality for four blades."; + tags = [Cfsqp;Flypaper;Penalty(50.0,500.0)]; + };; + +let add = Parse_ineq.execute_cfsqp;; + + + diff --git a/legacy/oldnonlinear/nonlinear/test_jun2012_ZTG_series.hl b/legacy/oldnonlinear/nonlinear/test_jun2012_ZTG_series.hl new file mode 100644 index 0000000..88ec9cd --- /dev/null +++ b/legacy/oldnonlinear/nonlinear/test_jun2012_ZTG_series.hl @@ -0,0 +1,556 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Nonlinear *) +(* Author: Thomas C. Hales *) +(* Date: 2012-06-15 *) +(* ========================================================================== *) + +(* + + Started June 15 to speed up the ZTGIJCF23 calculations. + + First attempt to simplify gamma23 calculations, + via truncation. + + Abandoned June 23, 2012 when a better way of handling + the ZTGIJCF23 series was found. +*) + +Functional_equation.functional_overload();; + + +(* +let truncate_vol3f_456 = new_definition `truncate_vol3f_456 c f = + scalar6 ( mk_456 (rotate5 (truncate_sol_x c)) + + mk_456 (rotate6 (truncate_sol_x c)) + + mk_456 (rotate4 (truncate_sol_x c)) + ) (&2 * mm1/ pi) + - + scalar6 ( + (uni(f,(scalar6 proj_y4 #0.5))) * mk_456 (rotate4 (truncate_dih_x c)) + + (uni(f,(scalar6 proj_y5 #0.5))) * mk_456 (rotate5 (truncate_dih_x c)) + + (uni(f,(scalar6 proj_y6 #0.5))) * mk_456 (rotate6 (truncate_dih_x c)) + ) (&8 * mm2 / pi)`;; +*) + +(* +let gamma2_x = + new_definition `gamma2_x f x = (&8 - x)* sqrt x / (&24) - + ( (&2 * mm1/ pi) * (&1 - sqrt x / sqrt8) - (&8 * mm2 / pi) * f (sqrt x / &2))`;; +*) + + + + + +let gamma2_x_gamma2f = prove_by_refinement( + `!y f. + (&0 <= y ==> ((&2 * pi) * (gamma2_x f (y*y)) = + (vol2r y sqrt2)*(y / &2) - vol2f y sqrt2 f ))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REWRITE_TAC[gamma2_x;Sphere.vol2r;Sphere.vol2f;Nonlinear_lemma.sqrt8_sqrt2;Nonlinear_lemma.sqrt2_sqrt2]; + DISCH_TAC; + REPEAT (GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx); + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + + +let truncate_dih_x_dih_x = prove_by_refinement( + `!c. domain6 + (\x1 x2 x3 x4 x5 x6. &0 <= x1 /\ &0 <= c /\ c <= delta_x x1 x2 x3 x4 x5 x6) + (truncate_dih_x c) (dih_x)`, + (* {{{ proof *) + [ + REWRITE_TAC[domain6;truncate_dih_x;Sphere.dih_x;truncate_sqrt;LET_DEF;LET_END_DEF]; + REPEAT STRIP_TAC; + ABBREV_TAC `d =delta_x x1 x2 x3 x4 x5 x6`; + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + SUBGOAL_THEN `&0 <= d` ASSUME_TAC; + BY(ASM_MESON_TAC[REAL_LE_TRANS]); + ASM_SIMP_TAC[SQRT_MUL;arith `&0 <= &4`;Real_ext.REAL_PROP_NN_MUL2;]; + COND_CASES_TAC; + BY(ASM_MESON_TAC[arith `c <= d /\ d <= c ==> (d = c)`;arith `a * b * c = (a*b)*(c:real)`]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let truncate_sol_x_sol_x = prove_by_refinement( + `!c. domain6 + (\x1 x2 x3 x4 x5 x6. &0 <= x1 /\ &0 <= x2 /\ &0 <= x3 /\ &0 <= c /\ c <= delta_x x1 x2 x3 x4 x5 x6) + (truncate_sol_x c) (sol_x)`, + (* {{{ proof *) + [ + REWRITE_TAC[domain6;truncate_sol_x;Sphere.sol_x;add6;Sphere.rotate2;Sphere.rotate3;constant6;sub6]; + REPEAT STRIP_TAC; + MATCH_MP_TAC (arith `(a=a') /\ (b = b') /\ (c = c') ==> (a+b+c-pi =a'+b'+c'-pi)`); + BY(REPEAT CONJ_TAC THEN GMATCH_SIMP_TAC (REWRITE_RULE[domain6] (SPEC `c:real` truncate_dih_x_dih_x)) THEN ASM_REWRITE_TAC[] THEN FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.delta_x] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let truncate_sqrt_le = prove_by_refinement( + `!c d. (c <= d) ==> (truncate_sqrt c d = sqrt d)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[truncate_sqrt]; + COND_CASES_TAC; + REPEAT (POP_ASSUM MP_TAC); + BY(MESON_TAC[arith `c <= d /\ d <= c ==> (c = d)`]); + REPEAT (POP_ASSUM MP_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let truncate_dih_x_sym = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6 c. + truncate_dih_x c x1 x2 x3 x4 x5 x6 = truncate_dih_x c x1 x3 x2 x4 x6 x5`, + (* {{{ proof *) + [ + REWRITE_TAC[truncate_dih_x;truncate_sqrt;LET_DEF;LET_END_DEF]; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `delta_x x1 x3 x2 x4 x6 x5 = delta_x x1 x2 x3 x4 x5 x6` SUBST1_TAC; + REWRITE_TAC[Sphere.delta_x]; + BY(REAL_ARITH_TAC); + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + REWRITE_TAC[Sphere.delta_x4]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let truncate_dih_x_sym2 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6 c. + truncate_dih_x c x1 x2 x3 x4 x5 x6 = truncate_dih_x c x1 x5 x6 x4 x2 x3`, + (* {{{ proof *) + [ + REWRITE_TAC[truncate_dih_x;truncate_sqrt;LET_DEF;LET_END_DEF]; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `delta_x x1 x5 x6 x4 x2 x3 = delta_x x1 x2 x3 x4 x5 x6` SUBST1_TAC; + REWRITE_TAC[Sphere.delta_x]; + BY(REAL_ARITH_TAC); + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + REWRITE_TAC[Sphere.delta_x4]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let gamma3f_lemma = prove_by_refinement( + `!f y4 y5 y6 (a:real) (b:real) (c:real) (d:real). + (&0 <= y4 /\ &0 <= y5 /\ &0 <= y6 /\ (&0 <= d) /\ + d <= delta_y sqrt2 sqrt2 sqrt2 y4 y5 y6) ==> + (gamma3f y4 y5 y6 sqrt2 f = + truncate_vol3r_456 d a b c (y4*y4) (y5*y5) (y6*y6) - + truncate_vol3f_456 d f a b c (y4*y4) (y5*y5) (y6*y6))`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;Sphere.delta_y;truncate_vol3f_456;truncate_vol3r_456;mk_456;uni;scalar6;proj_y1;Sphere.rotate4;Sphere.rotate5;Sphere.rotate6;compose6;proj_x4;proj_x5;proj_x6;scalar6;add6;mul6;sub6;two6;sol_x_123;Sphere.gamma3f;constant6;Sphere.vol3r;Sphere.vol3f;truncate_vol_x;Nonlinear_lemma.sqrt2_sqrt2;LET_DEF;LET_END_DEF;Sphere.vol_y;Sphere.y_of_x;proj_y4;proj_y5;proj_y6;Sphere.dih_y;sol_y_sol_x]; + REPEAT STRIP_TAC; + ASM_SIMP_TAC[Nonlinear_lemma.sqrtxx;truncate_sqrt_le]; + BINOP_TAC; + REWRITE_TAC[Sphere.vol_x]; + BY(BY(REAL_ARITH_TAC)); + BINOP_TAC; + REWRITE_TAC[arith `e * a * b/c = (a*b/c)*(e:real)`]; + AP_TERM_TAC; + SUBGOAL_THEN `sol_x (y4 * y4) (y5 * y5) (&2) (&2) (&2) (y6 * y6) = sol_x (y5 * y5) (&2) (y4 * y4) (&2) (y6 * y6) (&2)` SUBST1_TAC; + BY(MESON_TAC[sol_x_sym;sol_x_sym2]); + SUBGOAL_THEN `sol_x (y5 * y5) (y6 * y6) (&2) (&2) (&2) (y4 * y4) = sol_x (y6 * y6) (&2) (y5 * y5) (&2) (y4 * y4) (&2)` SUBST1_TAC; + BY(MESON_TAC[sol_x_sym;sol_x_sym2]); + SUBGOAL_THEN ` sol_x (y6 * y6) (y4 * y4) (&2) (&2) (&2) (y5 * y5) = sol_x (y4 * y4) (&2) (y6 * y6) (&2) (y5 * y5) (&2)` SUBST1_TAC; + BY(MESON_TAC[sol_x_sym;sol_x_sym2]); + MATCH_MP_TAC (arith `(a = a')/\(b = b')/\(c=c') ==> (a+b+c = a'+b'+(c':real))`); + BY(REPEAT CONJ_TAC THEN GMATCH_SIMP_TAC (REWRITE_RULE[domain6] (SPEC `d:real` truncate_sol_x_sol_x)) THEN ASM_REWRITE_TAC[arith `&0 <= &2`;REAL_LE_SQUARE] THEN FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.delta_x] THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `a * #0.5 = a/ &2`;arith ` d * a * b/pi= (a * b/pi) * d`]; + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + MATCH_MP_TAC (arith `(a = a')/\(b = b')/\(c=c') ==> (u*a + v*b +w*c = u*a' + v*b' + w*(c':real))`); + SUBGOAL_THEN `d <= delta_x (y4 * y4) (y5 * y5) (&2) (&2) (&2) (y6 * y6) /\ d <= delta_x (y5 * y5) (y6 * y6) (&2) (&2) (&2) (y4 * y4) /\ d <= delta_x (y6 * y6) (y4 * y4) (&2) (&2) (&2) (y5 * y5)` ASSUME_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Sphere.delta_x]; + BY(BY(REAL_ARITH_TAC)); + SUBGOAL_THEN `truncate_dih_x (d) (y4 * y4) (&2) (y6 * y6) (&2) (y5 * y5) (&2) = truncate_dih_x (d) (y4 * y4) (y5 * y5) (&2) (&2) (&2) (y6 * y6) ` SUBST1_TAC; + BY(BY(MESON_TAC[truncate_dih_x_sym;truncate_dih_x_sym2])); + SUBGOAL_THEN `truncate_dih_x (d) (y5 * y5) (&2) (y4 * y4) (&2) (y6 * y6) (&2) = truncate_dih_x (d) (y5 * y5) (y6 * y6) (&2) (&2) (&2) (y4 * y4)` SUBST1_TAC; + BY(BY(MESON_TAC[truncate_dih_x_sym;truncate_dih_x_sym2])); + SUBGOAL_THEN ` truncate_dih_x (d) (y6 * y6) (&2) (y5 * y5) (&2) (y4 * y4) (&2) = truncate_dih_x (d) (y6 * y6) (y4 * y4) (&2) (&2) (&2) (y5 * y5)` SUBST1_TAC; + BY(BY(MESON_TAC[truncate_dih_x_sym;truncate_dih_x_sym2])); + BY(BY(REPEAT CONJ_TAC THEN GMATCH_SIMP_TAC (REWRITE_RULE[domain6;] (SPEC `d:real` truncate_dih_x_dih_x)) THEN ASM_REWRITE_TAC[REAL_LE_SQUARE])) + ]);; + (* }}} *) + + +(* Redo 2 and 3 cell calculations *) + +(* change to x *) + +module Test = struct + open Sphere;; + open Ineq;; +add + { + idv = "GLFVCVK2v2 a"; + ineq = all_forall `ineq + [ (#2.0 pow 2,x,(&2 * h0) pow 2 ) ] + (truncate_gamma2_x (&1) x > &0)`; + doc = "If $X$ is a $2$-cell, then $\\gamma(X,L)\\ge0$."; + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Cfsqp]; + };; + +add + { + idv = "GLFVCVK2v2 b"; + ineq = all_forall `ineq + [ ((&2 * h0) pow 2,x, &8 ) ] + (truncate_gamma2_x (&0) x > &0)`; + doc = "If $X$ is a $2$-cell, then $\\gamma(X,L)\\ge0$."; + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Cfsqp;Sharp;Eps 1.0e-15]; + };; + +add +{ + idv = "QITNPEA 4003532128 b sym v2"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (#2.1 ,y4, sqrt8); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ( (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 < #0.14 ) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 < #0.14) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2) \/ + (y2 < y3) \/ (y2 < y5) \/ (y2 < y6) \/ + (y_of_x + (truncate_gamma23_x (&1) (&1) (h0cut y1) (&1) (&1) (&1) (&1)) + y1 y2 y3 y4 y5 y6 - #0.00457511 + - #0.00609451*dih_y y1 y2 y3 y4 y5 y6 > #0.0) + )`; + doc = " + Note the lower bound on $y_4$ is $2.1$. + This is an inequality for $23$-cells used to prove the cluster inequality. + We may use monotonicity so that rad2 is exactly 2. + By symmetry we may assume that y2 is the longest of y2,y3,y5,y6"; + tags=[Marchal;Cfsqp;Cfsqp_branch 6; + Clusterlp;Flypaper["OXLZLEZ"];Tex;Xconvert;Branching;Split[0]; + Set_rad2;Delta126min (0.14-. 1.0e-12); + Delta135min (0.14 -. 1.0e-12)]; +};; + +add +{ + idv = "QITNPEA 4003532128 b2 v2"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (#2.1 ,y4, #2.1); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ( (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 < #0.14 ) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 < #0.14) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2) \/ + (y_of_x (truncate_gamma23_x (&1) (&1) (h0cut y1) (&1) (&1) (&1) (&1)) + y1 y2 y3 y4 y5 y6 - #0.00457511 + - #0.00609451*dih_y y1 y2 y3 y4 y5 y6 > #0.0) + )`; + doc = " + Note the lower bound on $y_4$ is $2.1$. + This is an inequality for $23$-cells used to prove the cluster inequality. + We may use monotonicity so that $y_4=2.1$"; + tags=[Marchal;Cfsqp;Cfsqp_branch 3;Clusterlp;Flypaper["OXLZLEZ"];Tex;Xconvert;Branching;Split[0];Delta126min (0.14-. 1.0e-12); + Delta135min (0.14 -. 1.0e-12)]; +};; + +add +{ + idv = "QITNPEA 4003532128 c v2"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2 ,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (#2.1 ,y4, #2.1); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ( (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 < #0.14 ) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 < &0) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 > #0.14) \/ + (y_of_x (truncate_gamma23_x_C (#0.08) (&1) (h0cut y1) (&1) (&1)) + y1 y2 y3 y4 y5 y6 + - #0.00457511 + - #0.00609451*dih_y y1 y2 y3 y4 y5 y6 > #0.0) + )`; + doc = " + Inititally, $y_4$ extends to $\\sqrt8$, but we use monotonicity +to reduced it to the lower bound. + This gives an upper bound $0.08$ on the dihedral angle of the $3$-cell. + This is an inequality for $23$-cells used to prove the cluster inequality."; + tags=[Marchal;Cfsqp;Cfsqp_branch 3;Clusterlp;Flypaper["OXLZLEZ"];Tex;Xconvert;Branching;Split[0];Delta126min (0.14 -. 1.0e-12); + Delta135min (0.0); Delta135max(0.14 +. 1.0e-12)]; + (* d4 > 67 > Tan[Pi/2 - 0.03] Sqrt[4 1.0] ==> dih <= 0.03. *) + (* (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 > #0.14) \/ dropped 12/23/2010 *) +};; + +add +{ + idv = "QITNPEA 4003532128 d v2"; +(* removed gamma3f y1 y2 y6 sqrt2 lmfun + from term on Nov 29, 2010 *) + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (#2.1 ,y4, sqrt8); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ( + (y_of_x (truncate_gamma23_x_B (h0cut y1)) y1 y2 y3 y4 y5 y6 + - #0.00457511 + - #0.00609451*dih_y y1 y2 y3 y4 y5 y6 > #0.0) \/ + (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 > #0.14 ) \/ + (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 < &0 ) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 > #0.14) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 < &0) )`; + doc = " + This gives an upper bound $0.08$ on the dihedral angle of the $3$-cell. + This is an inequality for $23$-cells used to prove the cluster inequality."; + tags=[Marchal;Cfsqp;Clusterlp;Tex;Flypaper["OXLZLEZ"];Xconvert;Branching;Split[0]]; + (* d4 > 25 > Tan[Pi/2 - 0.08] Sqrt[4 x1 0.14] ==> dih <= 0.08. *) +};; + +let template_F23b = `\ y3m y3M y5m y5M y6m y6M w1 w2. ineq + [(&2 * hminus, y1, &2 * hplus); + (&2 ,y2, &2 *hminus); + (y3m,y3,y3M); + (&2 ,y4, sqrt8 ); + (y5m,y5,y5M); + (y6m,y6,y6M)] + ( (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 < #0.14 ) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 < #0.14) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2) \/ + (y_of_x (truncate_gamma23_x (&1/ &w1) (&1/ &w2) + (h0cut y1) (h0cut y2) (h0cut y3) (h0cut y5) (h0cut y6)) y1 y2 y3 y4 y5 y6 > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6) + )`;; + +let template_F23b2 = `\ y3m y3M y5m y5M y6m y6M w1 w2. ineq + [(&2 * hminus, y1, &2 * hplus); + (&2 ,y2, &2 *hminus); + (y3m,y3,y3M); + (&2 ,y4, &2 ); + (y5m,y5,y5M); + (y6m,y6,y6M)] + ( + (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 < #0.14 ) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 < #0.14) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2) \/ + (y_of_x (truncate_gamma23_x (&1/ &w1) (&1/ &w2) + (h0cut y1) (h0cut y2) (h0cut y3) (h0cut y5) (h0cut y6)) + y1 y2 y3 y4 y5 y6 > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6) + )`;; + +let template_F23c = `\ y3m y3M y5m y5M y6m y6M (w1:num) (w2:num). ineq + [(&2 * hminus, y1, &2 * hplus); + (&2 ,y2, &2 *hminus); + (y3m,y3,y3M); + (&2 ,y4, &2 ); + (y5m,y5,y5M); + (y6m,y6,y6M)] + ( + (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 < #0.14 ) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 > #0.14) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 < &0) \/ + (y_of_x (truncate_gamma23_x_C (#0.08) (&1 / &w1) (h0cut y1) (h0cut y2) (h0cut y6)) y1 y2 y3 y4 y5 y6 > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6) + )`;; + +let template_F23c2 = `\ y3m y3M y5m y5M y6m y6M (w1:num) (w2:num). ineq + [(&2 * hminus, y1, &2 * hplus); + (&2 ,y2, &2 *hminus); + (y3m,y3,y3M); + (&2 ,y4, &2 ); + (y5m,y5,y5M); + (y6m,y6,y6M)] + ( + (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 < #0.14 ) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 > #0.14) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 < #0.03) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2) \/ + (y_of_x (truncate_gamma23_x_C (#0.08) (&1 / &w1) (h0cut y1) (h0cut y2) (h0cut y6)) y1 y2 y3 y4 y5 y6 > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6) + )`;; + +let template_F23c3 = `\ y3m y3M y5m y5M y6m y6M (w1:num) (w2:num). ineq + [(&2 * hminus, y1, &2 * hplus); + (&2 ,y2, &2 *hminus); + (y3m,y3,y3M); + (&2 ,y4, &2 ); + (y5m,y5,y5M); + (y6m,y6,y6M)] + ( + (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 < #0.14 ) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 > #0.03) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 < &0) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2) \/ + (y_of_x (truncate_gamma23_x_C (#0.037) (&1 / &w1) (h0cut y1) (h0cut y2) (h0cut y6)) y1 y2 y3 y4 y5 y6 > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6) + )`;; + +let template_F23d = `\ y3m y3M y5m y5M y6m y6M (w1:num) (w2:num). ineq + [(&2 * hminus, y1, &2 * hplus); + (&2 ,y2, &2 *hminus); + (y3m,y3,y3M); + (&2 ,y4, sqrt8 ); + (y5m,y5,y5M); + (y6m,y6,y6M)] + ((y_of_x (truncate_gamma23_x_B (h0cut y1)) y1 y2 y3 y4 y5 y6 > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2) \/ + (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 > #0.14 ) \/ + (delta_y y1 y2 sqrt2 sqrt2 sqrt2 y6 < &0 ) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 > #0.14) \/ + (delta_y y1 sqrt2 y3 sqrt2 y5 sqrt2 < &0) )`;; + +let ineq_F23 i3 i5 i6 j = + let _ = (j>=0 && j <=5) or failwith "ineq_F23" in + let template = List.nth [template_F23b;template_F23b2;template_F23c; + template_F23d;template_F23c2;template_F23c3] j in + let x i = List.nth [`&2`; `&2 * hminus` ; `sqrt8`] i in + let X i = x (i+1) in + let mid i = if (i>0) then 1 else 0 in + let m = mk_small_numeral in + let w1 = 1 + mid i6 in + let w2 = 1 + mid i3 + mid i5 in + mk_tplate template [x i3;X i3; x i5;X i5; x i6 ;X i6; m w1; m w2];; + +let tags_F23 = + let min14 = 0.14 -. 1.0e-12 in + let max14 = 0.14 +. 1.0e-12 in + let tag_all = [Marchal;Cfsqp_branch 3;Flypaper["OXLZLEZ";]; + Xconvert;Penalty(200.0,5000.0);Branching;] in + [[Set_rad2;Delta126min min14;Delta135min min14] @ tag_all; + [Delta126min min14;Delta135min min14] @ tag_all; + [Delta126min min14;Delta135min (0.0);Delta135max max14] @ tag_all; + tag_all;tag_all;tag_all];; + +let make_F23 i j = + let i3i5i6s = [(0,0,0);(0,0,1);(1,0,1);(0,1,1);(0,1,0)] in + let (i3,i5,i6) = + List.nth i3i5i6s i in (* wlog by symmetry *) + let ext = List.nth ["b";"b2";"c";"d";"c2";"c3"] j in + let tg0 = (List.nth tags_F23 j) in + let tg = (if (i=0) then [Tex] else []) @ [Split (split_F4 i3 0 i5 i6)] @ tg0 in + { + idv = Printf.sprintf "ZTGIJCF23v2 %d %d %d 7907792228 %s" i3 i5 i6 (ext); + ineq = ineq_F23 i3 i5 i6 j; + doc = "This is the $2$- and $3$-cell inequality for five or more leaves."; + tags=tg + };; + +let f23_cases = [ +(0,0);(0,1);(0,3);(0,4);(0,5); +(1,0);(1,1);(1,2);(1,3); +(2,0);(2,1);(2,2);(2,3); +(3,0);(3,1);(3,2);(3,3); +(4,4);(4,5)];; + +map (fun (i,j) -> add (make_F23 i j)) f23_cases;; + +end;; + + +map (fun t -> t.idv) (Ineq.getprefix "ZTGIJCF23v2");; + + +let ztg23v2 = [(* "GLFVCVK2v2 a"; "GLFVCVK2v2 b"; *) + "QITNPEA 4003532128 b sym v2"; + "QITNPEA 4003532128 b2 v2"; "QITNPEA 4003532128 c"; "QITNPEA 4003532128 d"; + (*"ZTGIJCF23v2 0 0 0 7907792228 b";*) + "ZTGIJCF23v2 0 0 0 7907792228 b2"; + "ZTGIJCF23v2 0 0 0 7907792228 c2"; + "ZTGIJCF23v2 0 0 0 7907792228 c3"; + "ZTGIJCF23v2 0 0 0 7907792228 d"; + "ZTGIJCF23v2 0 0 1 7907792228 b"; "ZTGIJCF23v2 0 0 1 7907792228 b2"; + "ZTGIJCF23v2 0 0 1 7907792228 c"; "ZTGIJCF23v2 0 0 1 7907792228 d"; + "ZTGIJCF23v2 0 1 0 7907792228 c2"; + "ZTGIJCF23v2 0 1 0 7907792228 c3"; + "ZTGIJCF23v2 0 1 1 7907792228 b"; + "ZTGIJCF23v2 0 1 1 7907792228 b2"; "ZTGIJCF23v2 0 1 1 7907792228 c"; + "ZTGIJCF23v2 0 1 1 7907792228 d"; "ZTGIJCF23v2 1 0 1 7907792228 b"; + "ZTGIJCF23v2 1 0 1 7907792228 b2"; "ZTGIJCF23v2 1 0 1 7907792228 c"; + "ZTGIJCF23v2 1 0 1 7907792228 d"];; + + +(* +let truncate_gamma23_x = new_definition `truncate_gamma23_x iw1 iw2 m1 m2 m3 m5 m6 = + scalar6 + (compose6 (truncate_gamma3f_x (#0.14) m1 m2 m6) + dummy6 dummy6 dummy6 proj_x1 proj_x2 proj_x6) + iw1 + + scalar6 + (compose6 (truncate_gamma3f_x (#0.14) m1 m3 m5) + dummy6 dummy6 dummy6 proj_x1 proj_x3 proj_x5) + iw2 + + (dih_x - + (mk_126 (truncate_dih_x (#0.14)) + + mk_135 (truncate_dih_x (#0.14)))) * + uni((truncate_gamma2_x m1),proj_x1)`;; + +let gamma23_008_x = new_definition `gamma23_008_x m1 = + compose6 (truncate_gamma3f_x (&0) m1 (&1) (&1)) + dummy6 dummy6 dummy6 proj_x1 proj_x2 proj_x6 + + + compose6 (truncate_gamma3f_x (&0) m1 (&1) (&1)) + dummy6 dummy6 dummy6 proj_x1 proj_x3 proj_x5 + + scalar6 (dih_x - (mk_126 (dih_x) + mk_135 (dih_x))) + (#0.008)`;; + +let gamma23_erase126_x = new_definition `gamma23_erase126_x m1 = + compose6 (truncate_gamma3f_x (&0) m1 (&1) (&1)) + dummy6 dummy6 dummy6 proj_x1 proj_x3 proj_x5 + + scalar6 (dih_x - mk_135 (dih_x)) + (#0.008)`;; + +let nonf_gamma23_008_x = prove_by_refinement( + `!m1 x1 x2 x3 x4 x5 x6. + gamma23_008_x m1 x1 x2 x3 x4 x5 x6 = + truncate_gamma3f_x (&0) m1 (&1) (&1) (&0) (&0) (&0) x1 x2 x6 + + truncate_gamma3f_x (&0) m1 (&1) (&1) (&0) (&0) (&0) x1 x3 x5 + + (dih_x x1 x2 x3 x4 x5 x6 - + (dih_x x1 x2 (&2) (&2) (&2) x6 + dih_x x1 (&2) x3 (&2) x5 (&2))) * + #0.008`, + (* {{{ proof *) + [ +(REWRITE_TAC[gamma23_008_x;mk_456;rotate5;rotate6;rotate4;scalar6;sub6;add6;mul6;constant6;compose6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6;two6;uni;proj_y4;proj_y5;proj_y6;dummy6;mk_126;mk_135]) + ]);; + (* }}} *) + +let nonf_gamma23_erase126_x = prove_by_refinement( + `!m1 x1 x2 x3 x4 x5 x6. + gamma23_erase126_x m1 x1 x2 x3 x4 x5 x6 = + truncate_gamma3f_x (&0) m1 (&1) (&1) (&0) (&0) (&0) x1 x3 x5 + + (dih_x x1 x2 x3 x4 x5 x6 - dih_x x1 (&2) x3 (&2) x5 (&2)) * #0.008 + `, + (* {{{ proof *) + [ +(REWRITE_TAC[gamma23_erase126_x;mk_456;rotate5;rotate6;rotate4;scalar6;sub6;add6;mul6;constant6;compose6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6;two6;uni;proj_y4;proj_y5;proj_y6;dummy6;mk_126;mk_135]) + ]);; + (* }}} *) + +let gamma23_full_x = new_definition `gamma23_full_x m1 = + (compose6 (gamma3_x m1) + dummy6 dummy6 dummy6 proj_x1 proj_x2 proj_x6) + + (compose6 (gamma3_x m1) + dummy6 dummy6 dummy6 proj_x1 proj_x3 proj_x5) + + (dih_x - (mk_126 dih_x + mk_135 dih_x)) * + uni((gamma2_x_div_azim m1),proj_x1)`;; + + +*) diff --git a/legacy/oldnonlinear/nonlinear/test_may2013_terminal_pent_hex_series.hl b/legacy/oldnonlinear/nonlinear/test_may2013_terminal_pent_hex_series.hl new file mode 100644 index 0000000..4e4d110 --- /dev/null +++ b/legacy/oldnonlinear/nonlinear/test_may2013_terminal_pent_hex_series.hl @@ -0,0 +1,2158 @@ + +(* DEPRECATED: + let taud = new_definition `taud y1 y2 y3 y4 y5 y6 = + #0.027 * safesqrt(delta_y y1 y2 y3 y4 y5 y6) + sol0 * (y1 - &2 * h0)/(&2 * h0 - &2)`;; + + let taud_v2 = new_definition `taud_v2 y1 y2 y3 y4 y5 y6 = + #0.027 * safesqrt(delta_y y1 y2 y3 y4 y5 y6) + sol0 * (y1 - &2 * h0)/(&2 * h0 - &2) + + safesqrt(delta_y y1 y2 y3 y4 y5 y6) * #0.04 * (#2.52 - y1)`;; + + let taud_v3 = new_definition `taud_v3 y1 y2 y3 y4 y5 y6 = + #0.023 * safesqrt(delta_y y1 y2 y3 y4 y5 y6) + sol0 * (y1 - &2 * h0)/(&2 * h0 - &2) + + safesqrt(delta_y y1 y2 y3 y4 y5 y6) * #0.055 * (#2.52 - y1)`;; + + let edge_flat50 = new_definition`edge_flat50 y1 y2 y3 y5 y6 = + sqrt(quadratic_root_plus (abc_of_quadratic ( + \x4. &50 - delta_x (y1*y1) (y2*y2) (y3*y3) x4 (y5*y5) (y6*y6))))`;; + + let edge_flat250_x = new_definition `edge_flat250_x x1 x2 x3 x4 x5 x6 = + (edge_flat (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x5) (sqrt x6)) pow 2`;; (* x4 dummy *) + + let edge_flat50_x = new_definition`edge_flat50_x x1 x2 x3 (x4:real) x5 x6 = + edge_flat (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x5) (sqrt x6)`;; + + + let fn_sub246 = new_definition + `fn_sub246 f (x2s:real) (x4s:real) (x6s:real) + (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + (f x1 x2s x3 x4s x5 x6s):real`;; + + let fn_sub345 = new_definition + `fn_sub345 f (x3s:real) (x4s:real) (x5s:real) + (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + (f x1 x2 x3s x4s x5s x6):real`;; + + let edge_flatD_x1 = new_definition `edge_flatD_x1 d x2 x3 x4 x5 x6 = + sqrt(quadratic_root_plus (abc_of_quadratic ( + \x1. d - delta_x x1 x2 x3 x4 x5 x6)))`;; + + let edge_126_x = new_definition `edge_126_x d x4 x5 = + compose6 (edge_flatD_x1) (constant6 d) proj_x1 proj_x2 proj_x6 (constant6 x4) (constant6 x5)`;; + + let edge_135_x = new_definition `edge_135_x d x4 x6 = + compose6 (edge_flatD_x1) (constant6 d) proj_x1 proj_x3 proj_x5 (constant6 x4) (constant6 x6)`;; + + let flat_term_126_x = new_definition `flat_term_126_x d x4 x5 = + uni(flat_term,edge_126_x d x4 x5)`;; + + let flat_term_135_x = new_definition `flat_term_135_x d x4 x6 = + uni(flat_term,edge_135_x d x4 x6)`;; + + let mudd_135_x_v2 = new_definition `mudd_135_x_v2 d x4 x6 = + mul6 (compose6 (promote3_to_6 mu_y) (uni(sqrt,edge2_135_x d x4 x6)) proj_y1 proj_y3 dummy6 dummy6 dummy6) + (constant6 (sqrt d))`;; + + let mudd_126_x_v2 = new_definition `mudd_126_x_v2 d x4 x5 = + mul6 (compose6 (promote3_to_6 mu_y) (uni(sqrt,edge2_126_x d x4 x5)) proj_y1 proj_y2 dummy6 dummy6 dummy6) + (constant6 (sqrt d))`;; + + let mudt_234_x = new_definition `mudt_234_x d y1 y5 y6 = + (mul6 (compose6 (mu6_x) (constant6 (y1*y1)) proj_x2 proj_x3 dummy6 dummy6 dummy6) + (uni(truncate_sqrt d,(delta_234_x (y1*y1) (y5*y5) (y6*y6)))))`;; + + let mudL_234_x = new_definition `mudL_234_x d1 d2 y1 y5 y6 = + (mul6 (compose6 (mu6_x) (constant6 (y1*y1)) proj_x2 proj_x3 dummy6 dummy6 dummy6) + (constant6 (&1/ (sqrt(d1)+sqrt(d2))) * (delta_234_x (y1*y1) (y5*y5) (y6*y6)) + constant6(sqrt(d1))))`;; + + + +*) + + + + +add +{ + idv="test4"; + doc="tau_residual"; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (y_of_x tau_residual_x y1 y2 y3 y4 y5 y6 > #0.027 + #0.04 * (#2.52 - y1)) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + + +add +{ + idv="test25353"; + doc="full hexagon ear calculation. + This shows that if (delta hi > 0) and (delta lo >0) we can erase the ear with small penalty. + Hence, when we look at a lo ear, we can wrap it in with the hi ear case when + the hi ear exists: (delta hi>0). + By symmetry, wlog y2 < y3. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,&2); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (taud_v2 y1 y2 y3 y4 y5 y6 > -- #0.013) \/ + (y_of_x (delta_sub1_x (#2.52 pow 2)) y1 y2 y3 y4 y5 y6 < &0) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ (y3 < y2) + )`; +};; +add +{ + idv="taud"; + doc=""; + tags=[Cfsqp;Xconvert]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2)] +((taum y1 y2 y3 y4 y5 y6 > taud y1 y2 y3 y4 y5 y6 + + safesqrt(delta_y y1 y2 y3 y4 y5 y6) * #0.04 * (#2.52 - y1)) \/ (delta_y y1 y2 y3 y4 y5 y6 < &20))`; +};; + + +add +{ + idv="local max"; + doc="test"; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (#3.01,y1,#3.915); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); + (&2,y5,#2.52); + (&2,y6,#2.52) + ] + (let delta' = delta4_y y1 y2 y3 y4 y5 y6 * (&2 * y4) in + let d = delta_y y1 y2 y3 y4 y5 y6 in + let delta'' = -- &8 * (y1 * y4) pow 2 + delta4_y y1 y2 y3 y4 y5 y6 * (&2) in + let mu = #0.1278 - #0.04 * y4 in + let mu' = -- #0.04 in + let h' = sol0 / (&2 * h0 - &2) in +( + #1.0 < (&2 * mu' * d + mu * delta' + h' * &2 * safesqrt(d)) pow 2 \/ + delta_y y1 y2 y3 y4 y5 y6 < &0 \/ + mu' * d * delta' - (&1 / &4) * mu * (delta' pow 2) + (&1 / &2) * mu * d * delta'' < -- #1.0 +))`; +};; + + + +add +{ + idv="local max2"; + doc="better local max test"; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (#3.01,y1,#3.915); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); + (&2,y5,#2.52); + (&2,y6,#2.52) + ] + (let d = delta_y y1 y2 y3 y4 y5 y6 in + let delta' = delta4_y y1 y2 y3 y4 y5 y6 * (&2 * y4) in + let delta'' = -- &8 * (y1 * y4) pow 2 + delta4_y y1 y2 y3 y4 y5 y6 * (&2) in + let mu = #0.1278 - #0.04 * y4 in + let mu' = -- #0.04 in +( + mu' * d * delta' - (&1 / &4) * mu * (delta' pow 2) + (&1 / &2) * mu * d * delta'' < &0 \/ + delta_y y1 y2 y3 y4 y5 y6 < &0 +))`; +};; + +add +{ + idv="local max debug"; + doc="local max numerical debug"; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (#2.1,y1,#2.1); + (#2.2,y2,#2.2); + (#2.3,y3,#2.3); + (#2.4,y4,#2.4); + (#2.5,y5,#2.5); + (#2.6,y6,#2.6) + ] + (let d = delta_y y1 y2 y3 y4 y5 y6 in + let delta' = delta4_y y1 y2 y3 y4 y5 y6 * (&2 * y4) in + let delta'' = -- &8 * (y1 * y4) pow 2 + delta4_y y1 y2 y3 y4 y5 y6 * (&2) in + let mu = #0.1278 - #0.04 * y4 in + let mu' = -- #0.04 in +( + (mu' * d * delta' - (&1 / &4) * mu * (delta' pow 2) + (&1 / &2) * mu * d * delta'') + / (d * safesqrt(d)) > &0 +))`; +};; +add +{ + idv="5556646409 small domain"; + doc="taum 2nd deriv test. + "; + tags=[Tex;Disallow_derivatives;Widthcutoff 0.004;Penalty(1500.0,5000.0);Cfsqp_branch 2]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.237); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (delta_y_LC y1 y2 y3 y4 y5 y6 < &15) \/ + (y2 < y3) \/ + (mdtau_y_LC y1 y2 y3 y4 y5 y6 > &0) \/ + (mdtau_y_LC y1 y2 y3 y4 y5 y6 < &0) \/ + (mdtau2uf_y_LC y1 y2 y3 y4 y5 y6 < &0) + )`; +};; +add +{ + idv="taud pent"; + doc="test"; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); + (&2,y5,#2.52); + (#3.01,z2,#3.237); + (#3.01,z5,#3.237) + ] +( (taum y1 y3 y4 (&2) z5 z2 + + taud_v3 y2 y3 y1 z2 (&2) (&2) + + taud_v3 y5 y4 y1 z5 (&2) (&2) +> #0.616) \/ + delta_y y1 y3 y4 (&2) z5 z2 < &0 \/ + delta_y y2 y3 y1 z2 (&2) (&2) < &0 \/ + delta_y y5 y4 y1 z5 (&2) (&2) < &0 \/ + (dih_y y1 y3 y4 (&2) z5 z2 + + dih_y y1 y3 y2 (&2) (&2) (z2) + + dih_y y1 y4 y5 (&2) (&2) (z5) < #1.75) +)`; +};; +add +{ + idv="taum pent"; + doc="test"; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); + (&2,y5,#2.52); + (#3.01,z2,#3.237); + (#3.01,z5,#3.237) + ] +( (taum y1 y3 y4 (&2) z5 z2 + + taum y2 y3 y1 z2 (&2) (&2) + + taum y5 y4 y1 z5 (&2) (&2) +> #0.616) \/ + delta_y y1 y3 y4 (&2) z5 z2 < &0 \/ + delta_y y2 y3 y1 z2 (&2) (&2) < &0 \/ + delta_y y5 y4 y1 z5 (&2) (&2) < &0 \/ + (dih_y y1 y3 y4 (&2) z5 z2 + + dih_y y1 y3 y2 (&2) (&2) (z2) + + dih_y y1 y4 y5 (&2) (&2) (z5) < #1.75) +)`; +};; +add +{ + idv="taum pent2"; + doc="test"; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); + (&2,y5,#2.52); + (#3.01,z2,#3.237); + (#3.01,z5,#3.237) + ] +( (taum y1 y3 y4 (&2) z5 z2 + + taud_v2 y2 y3 y1 z2 (&2) (&2) + + taud_v2 y5 y4 y1 z5 (&2) (&2) + > #0.616) \/ + delta_y y1 y3 y4 (&2) z5 z2 < &0 \/ + delta_y y2 y3 y1 z2 (&2) (&2) < &0 \/ + delta_y y5 y4 y1 z5 (&2) (&2) < &0 \/ + // extra delta constraints + delta_y y2 y3 y1 z2 (&2) (&2) > &50 \/ + delta_y y5 y4 y1 z5 (&2) (&2) > &50 \/ + (dih_y y1 y3 y4 (&2) z5 z2 + + dih_y y1 y3 y2 (&2) (&2) (z2) + + dih_y y1 y4 y5 (&2) (&2) (z5) < #1.75) +)`; +};; + +add +{ + idv="test5"; + doc="tau_residual pent"; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.237); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (y_of_x tau_residual_x y1 y2 y3 y4 y5 y6 > #0.023 + #0.055 * (#2.52 - y1) ) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +add +{ + idv="test6"; + doc="tau_residual pent"; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.1); + (&2,y3,#2.52); + (#3.01,y4,#3.237); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (y_of_x tau_residual_x y1 y2 y3 y4 y5 y6 > #0.018 + #0.07 * (#2.52 - y1) ) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +add +{ + idv="test7"; + doc="taum for small delta"; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.237); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (taum y1 y2 y3 y4 y5 y6 > &0) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ + (delta_y y1 y2 y3 y4 y5 y6 > &50) + )`; +};; + +add +{ + idv="test8"; + doc="taum for small delta"; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = Sphere.all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (&2,y5,&2); + (#3.01,y6,#3.237) + ] +( + (delta_y y1 y2 y3 y4 y5 y6 > &0) \/ + (dih_y y1 y2 y3 y4 y5 y6 < #0.096) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +add +{ + idv="4184277422"; + doc="old name: test10*."; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); + (&2,y5,#2.52); + (#3.01,z2,#3.237); + (#3.01,z5,#3.237) + ] +( (taum y1 y3 y4 (&2) z5 z2 + + taud_v4 y2 y3 y1 z2 (&2) (&2) + + taud_v4 y5 y4 y1 z5 (&2) (&2) +> #0.616) \/ + // delta_y y1 y3 y4 (&2) z5 z2 < &0 \/ + delta_y y2 y3 y1 z2 (&2) (&2) < &0 \/ + delta_y y2 y3 y1 z2 (&2) (&2) > &20 \/ + delta_y y5 y4 y1 z5 (&2) (&2) < &20 +)`; +};; + +run +{ + idv="test p"; + doc="taum for small delta"; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = Sphere.all_forall `ineq [ + (&2,y1,#2.52); + (#2.1,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.24); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (taum y1 y2 y3 y4 y5 y6 > #0.04) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &10) + )`; +};; + + +skip +{ + idv="1671775772"; + doc="old name: local max v4*, WNLKGOQ + better local max test. + This is the numerator of the 2nd derivative of the function taud. + Case delta > 20."; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.237); + (&2,y5,&2); + (&2,y6,&2) + ] + (y_of_x taud_D1_num_x y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x taud_D1_num_x y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x taud_D2_num_x y1 y2 y3 y4 y5 y6 < &0 \/ + taum y1 y2 y3 y4 y5 y6 > #0.1 \/ + delta_y y1 y2 y3 y4 y5 y6 < &20)`; +};; + +skip +{ + idv="7099408714"; + doc="old name: local max v4* + better local max test. + This is the numerator of the 2nd derivative of the function taud. + Old False version."; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] + (y_of_x taud_D2_num_x y1 y2 y3 y4 y5 y6 < &0 \/ + delta_y y1 y2 y3 y4 y5 y6 < &0)`; +};; + + +skip +{ + idv="2320951108"; + doc=" + local fan/main estimate/terminal pent + LHS(135,y1=2) RHS(126,y1=2.52), extra implicit assumption delta > 20. + mu sqrt(delta) >= 0.012 sqrt(&20) > 0.053. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237) + ] +( + (taum y1 y2 y3 y4 y5 y6 + + y_of_x (mud_135_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + #0.053 + > #0.616) +) +`; +};; + + + + + +add +{ + idv="test"; + doc=" + local fan/main estimate/terminal pent + LHS(135,y1=2.52) RHS(126,y1=2.52) + wlog. LHS delta on ears is >= 20, + mu sqrt(delta) >= 0.012 sqrt(&20) > 0.053. + If RHS delta >= 20. get 0.541 + 2 (0.053) > 0.616. + so wlog. RHS delta on ear is <= 20. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237) + ] +( + let d = &20 in + ((taum y1 y2 y3 y4 y5 y6 + + #0.053 + > #0.616) \/ + y_of_x (delta_126_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 > d )) +`; +};; + + +skip +{ + idv="9115820315"; + doc="old name: test9* test10* + full terminal pentagon test, using taud on ears. + assuming delta > 20 at y5."; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); +// (&2,y5,#2.52); + (#3.01,z2,#3.237); + (#3.01,z5,#3.237) + ] +( (taum y1 y3 y4 (&2) z5 z2 + + #0.12 + + taud y2 y3 y1 z2 (&2) (&2) // + // test + // &0 * taud y5 y4 y1 z5 (&2) (&2) +> #0.616) \/ +// \/ +// delta_y y1 y3 y4 (&2) z5 z2 < &0 \/ + delta_y y2 y3 y1 z2 (&2) (&2) < &0 // \/ +// delta_y y5 y4 y1 z5 (&2) (&2) < &20 +)`; +};; + +skip +{ + idv="test"; + doc="pent hi(126-345) hi(135-234) + full terminal pentagon test, using taud on ears. + assuming delta > 20 both sides."; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237) + ] +( + (taum y1 y2 y3 y4 y5 y6 + + y_of_x (mud_126_x_v1 (&2 * h0) (&2) (&2)) y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_126_x (&2 * h0) (&2) (&2)) y1 y2 y3 y4 y5 y6 + + y_of_x (mud_135_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_126_x (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 + > #0.616) \/ + y_of_x (delta_126_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &20 \/ + y_of_x (delta_135_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &20 ) +`; +};; + +add +{ + idv="test R"; + doc=" + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,&2); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.237); + (&2,y5,&2); + (&2,y6,&2) + ] +( + y4 > &2 \/ + delta_y y1 y2 y3 y4 y5 y6 > &20) +`; +};; + +(* HEX CASES *) + +let template_hex_ear = `\ y2m y2M y3m y3M y4m y4M d. ineq + [ + (#2.0,y1,#2.52); + (y2m,y2,y2M); + (y3m,y3,y3M); + (y4m,y4,y4M); + (&2,y5,&2); + (&2,y6,&2) + ] + (taud y1 y2 y3 y4 y5 y6 > d \/ + delta_y y1 y2 y3 y4 y5 y6 < &0)`;; + +let mk_ineq_hex_ear i2 i3 i4 d = + let x i = List.nth [`&2`;`#2.17`;`#2.34`;`#2.52`] i in + let X i = x (i+1) in + let y i = List.nth [`#3.01`;`#3.25`;`#3.5`;`#3.75`;`#3.915`] i in + let Y i = y (i+1) in + Ineq.mk_tplate template_hex [x i2;X i2; x i3;X i3; y i4;Y i4;d];; + +let make_hex_ear i2 i3 i4 d = + { + idv = Printf.sprintf "test %d %d %d" i2 i3 i4; + ineq = mk_ineq_hex i2 i3 i4 d; + doc = "local fan/main estimate/terminal hex/ear."; + tags=[Cfsqp;Xconvert;Penalty(50.0,500.0)]; + };; + + +let runh (i2,i3,i4,d) = try (run(make_hex_ear i2 i3 i4 d)) with _ -> () ;; + +(* +for i2=0 to 2 do + for i3 = 0 to 2 do + for i4 = 0 to 3 do + runh (i2,i3,i4,`&0`) done done done;; +*) + +map runh ;; + +let hex_ears = [ +(0,0,0,Some `-- #0.2`); +(0,0,1,Some `-- #0.552`); +(0,0,2,Some `-- #0.552`); +(0,0,3,None); +(0,1,0,Some `-- #0.05`); +(0,1,1,Some `-- #0.443`); +(0,1,2,Some `-- #0.552`); +(0,1,3,None); +(0,2,0,Some `#0.04`); +(0,2,1,Some `-- #0.29`); +(0,2,2,Some `-- #0.552`); +(0,2,3,Some `-- #0.552`); +(1,0,0,Some `-- #0.05`); +(1,0,1,Some `-- #0.45`); +(1,0,2,Some `-- #0.552`); +(1,0,3,None); +(1,1,0,Some `#0.04`); +(1,1,1,Some `-- #0.29`); +(1,1,2,Some ` -- #0.552`); +(1,1,3,Some ` -- #0.552`); +(1,2,0,Some `#0.08`); +(1,2,1,Some `-- #0.14`); +(1,2,2,Some `-- #0.552`); +(1,2,3,Some `-- #0.552`); +(2,0,0,Some ` #0.04`); +(2,0,1,Some `-- #0.29`); +(2,0,2,Some `-- #0.552`); +(2,0,3,Some `-- #0.552`); +(2,1,0,Some `#0.08`); +(2,1,1,Some `-- #0.14`); +(2,1,2,Some `-- #0.552`); +(2,1,3,Some `-- #0.552`); +(2,2,0,Some `#0.11`); +(2,2,1,Some `-- #0.017`); +(2,2,2,Some `-- #0.45`); +(2,2,3,Some `-- #0.552`); +];; + +let reformat_ear = + let f (i,j,k,d) = ((i,j,k),d) in + map f hex_ears;; + +let template_hex = `\ y1m y1M y2m y2M y3m y3M y4m y4M y5m y5M y6m y6M d1 d2 d3. ineq + [ + (y1m,y1,y1M); + (y2m,y2,y2M); + (y3m,y3,y3M); + (y4m,y4,y4M); + (y5m,y5,y5M); + (y6m,y6,y6M) + ] + (taum y1 y2 y3 y4 y5 y6 + d1 + d2 + d3 > #0.712 \/ + y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0)`;; + +let mk_ineq_hex i1 i2 i3 i4 i5 i6 d126 d234 d135 = + let x i = List.nth [`&2`;`#2.17`;`#2.34`;`#2.52`] i in + let X i = x (i+1) in + let y i = List.nth [`#3.01`;`#3.25`;`#3.5`;`#3.75`;`#3.915`] i in + let Y i = y (i+1) in + Ineq.mk_tplate template_hex [x i1 ; X i1;x i2;X i2; x i3;X i3; y i4;Y i4;y i5;Y i5;y i6;Y i6;d126;d234;d135];; + +let make_hex_ear i1 i2 i3 i4 i5 i6 = + let d126 = assoc (i1,i2,i6) reformat_ear in + let d135 = assoc (i1,i3,i5) reformat_ear in + let d234 = assoc (i2,i3,i4) reformat_ear in + let desome = function + | Some x -> x + | None -> failwith "none" in + let (d126',d135',d234') = (desome d126,desome d135,desome d234) in + { + idv = Printf.sprintf "test %d %d %d %d %d %d" i1 i2 i3 i4 i5 i6; + ineq = mk_ineq_hex i1 i2 i3 i4 i5 i6 d126' d135' d234'; + doc = "local fan/main estimate/terminal hex/body"; + tags=[Cfsqp;Xconvert;Penalty(50.0,500.0)]; + };; + +let runhh (i1,i2,i3,i4,i5,i6) = try (run(make_hex_ear i1 i2 i3 i4 i5 i6)) with _ -> () ;; + +runhh(1,1,0,0,0,3);; + +(* MANY NEGATIVE! +for i1=0 to 2 do +for i2=0 to 2 do + for i3 = 0 to 2 do + for i4 = 0 to 3 do + for i5 = i4 to 3 do + for i6 = i5 to 3 do + runhh (i1,i2,i3,i4,i5,i6) done done done done done done;; +*) + +skip +{ + idv="test"; + doc="local fan/main estimate/appendix/terminal hex. + full hexagon ear calculation. + This shows that if (delta hi > 0) and (delta lo >0) we can erase the ear with small penalty. + Hence, when we look at a lo ear, we can wrap it in with the hi ear case when + the hi ear exists: (delta hi>0). + By symmetry, wlog y2 < y3. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,&2); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (taud y1 y2 y3 y4 y5 y6 > -- #0.07) \/ + (y_of_x (delta_sub1_x (#2.52 pow 2)) y1 y2 y3 y4 y5 y6 < &0) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ (y3 < y2) + )`; +};; + +add +{ + idv="4328016440"; + doc=" + local fan/main estimate/appendix/terminal hex. + flat-flat-flat + full hexagon with three alternating flats. + Big alternating central triangle. + Symmetries, wlog y1 #0.712 ) \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) \/ + (y2 < y1) \/ (y3 < y2) + )`; +};; + +run2 +{ + idv="1156793592"; + doc=" + local fan/main estimate/appendix/terminal hex. + flat-flat-[234:nonflat,tau>=0] + Big alternating central triangle. + Symmetries, wlog y1 #0.712) \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) \/ + (y6 < y5) + )`; +};; + +run2 +{ + idv="5429733243"; + doc=" + local fan/main estimate/appendix/terminal hex. + flat-flat-[234:nonflat,y1=2,delta>100] + Big alternating central triangle. + Symmetries, wlog y1 &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &100 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) \/ + (y6 < y5) \/ + ( taum y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_126_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_135_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + y_of_x (mud_234_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 + + &0 - sol0 + > #0.712) + )`; +};; + +run2 +{ + idv="6941393103"; + doc=" + local fan/main estimate/appendix/terminal hex. + flat-flat-[234:nonflat,y1=2,0 #0.712) \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &100 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) \/ + (y6 < y5) + // ( taum y1 y2 y3 y4 y5 y6 + + // y_of_x (flat_term2_126_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + // y_of_x (flat_term2_135_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + // &0 - sol0 + // > #0.712) \/ + )`; +};; + +(* +run2 +{ + idv="test Z3"; + doc=" + local fan/main estimate/appendix/terminal hex/ + ear234(lo, tau< -0.07 becomes -- sol0) ear135(flat) ear126(flat) + full hexagon with two flats, one lo + Big alternating central triangle. + By symmetry, wlog y5 < y6. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( + ( taum y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_126_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_135_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + &0 - sol0 + > #0.712) \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &15 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) \/ + (y6 < y5) + )`; +};; +*) + + +add +{ + idv="test U1"; + doc=" + local fan/main estimate/appendix/terminal hex/ + full hexagon with two flats, one lo + Big alternating central triangle. + By symmetry, wlog y5 < y6. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( + ( taum y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_234_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + &0 + > #0.712) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) \/ + (y6 < y5) + )`; +};; + +add +{ + idv="test U2"; + doc=" + local fan/main estimate/appendix/terminal hex/ + full hexagon with two flats, one lo + Big alternating central triangle. + By symmetry, wlog y5 < y6. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( + ( taum y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_234_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + y_of_x (mud_126_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + &0 + > #0.712) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &100 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +run +{ + idv="test U3"; + doc=" + local fan/main estimate/appendix/terminal hex/ + full hexagon with two flats, one lo + Big alternating central triangle. + By symmetry, wlog y5 < y6. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( + ( taum y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_234_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + y_of_x (mudLs_126_x (#3.8729) (&10) (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + &0 + > #0.712) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &15 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &100 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +add +{ + idv="test U4"; + doc=" + local fan/main estimate/appendix/terminal hex/ + full hexagon with two flats, one lo + Big alternating central triangle. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( + ( taum y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_234_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + &0 - sol0 + + &0 + > #0.712) \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &15 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +add +{ + idv="test U5"; + doc=" + local fan/main estimate/appendix/terminal hex/ + full hexagon with two flats, one lo + Big alternating central triangle. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( + ( taum y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_234_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + y_of_x (mud_126_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + y_of_x (mud_135_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + &0 + > #0.712) \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &100 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &100 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) \/ + (y5 < y6) + )`; +};; + +add +{ + idv="test U6"; + doc=" + local fan/main estimate/appendix/terminal hex/ + full hexagon with two flats, one lo + Big alternating central triangle. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( + ( taum y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_234_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + y_of_x (mud_126_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + y_of_x (mudLs_135_x (#3.8729) (&10) (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + &0 + > #0.712) \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &100 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &15 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &100 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +add +{ + idv="test U7"; + doc=" + local fan/main estimate/appendix/terminal hex/ + full hexagon with two flats, one lo + Big alternating central triangle. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( + ( taum y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_234_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + y_of_x (mud_126_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + &0 - sol0 + + &0 + > #0.712) \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &100 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &15 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +add +{ + idv="test U8"; + doc=" + local fan/main estimate/appendix/terminal hex/ + full hexagon with two flats, one lo + Big alternating central triangle. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( + ( taum y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_234_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + y_of_x (mudLs_126_x (#3.8729) (&10) (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + y_of_x (mudLs_135_x (#3.8729) (&10) (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + &0 + > #0.712) \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &15 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &100 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &15 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &100 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) \/ + (y5 < y6) + )`; +};; + +add +{ + idv="test U9"; + doc=" + local fan/main estimate/appendix/terminal hex/ + full hexagon with two flats, one lo + Big alternating central triangle. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( + ( taum y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_234_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + y_of_x (mudLs_126_x (#3.8729) (&10) (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + &0 - sol0 + + &0 + > #0.712) \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &15 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &100 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &15 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +add +{ + idv="test U10"; + doc=" + local fan/main estimate/appendix/terminal hex/ + full hexagon with two flats, one lo + Big alternating central triangle. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( + ( taum y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_234_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + &0 - &2 * sol0 + + &0 + > #0.712) \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &15 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &15 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) \/ + (y5 < y6) + )`; +};; + + + +add +{ + idv="test V5"; + doc=" + local fan/main estimate/appendix/terminal hex/ + full hexagon with two flats, one lo + Big alternating central triangle. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( + ( taum y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_234_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + y_of_x (mud_126_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + &0 - sol0 + + &0 + > #0.712) \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &15 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &15 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +add +{ + idv="test V6"; + doc=" + local fan/main estimate/appendix/terminal hex/ + full hexagon with two flats, one lo + Big alternating central triangle. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( + ( taum y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_234_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + &0 - &2 * sol0 + + &0 + > #0.712) \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &15 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &15 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) \/ + (y5 < y6) + )`; +};; + + +add +{ + idv="test 3306409086 2013"; + doc=" + local fan/main estimate/appendix/terminal hex/ + ear234(tau >= -0.07) ear135(flat) ear126(flat) + full hexagon with two flats, + assumption tau-ear(234) >= - 0.07 + Big alternating central triangle. + By symmetry wlog y5 < y6 + secs(500). + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( + ( taum y1 y2 y3 y4 y5 y6 - #0.07 + + y_of_x (flat_term2_126_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_135_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + > #0.712) \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) \/ + (y6 < y5) + )`; +};; + +add +{ + idv="test 9075398267 2013"; + doc=" + local fan/main estimate/appendix/terminal hex/ + ear234(lo, tau< -0.07 becomes -- sol0) ear135(flat) ear126(flat) + full hexagon with two flats, one lo + Big alternating central triangle. + By symmetry, wlog y5 < y6. + secs(467) + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( + ( taum y1 y2 y3 y4 y5 y6 - sol0 + + y_of_x (flat_term2_126_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_135_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + > #0.712) \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) \/ + (y6 < y5) + )`; +};; + +add2 +{ + idv="test 1324821088 2013"; + doc=" + local fan/main estimate/appendix/terminal hex/ + ear234(flat) ear135(nonflat) ear126(nonflat) + one tau-nonflat > -0.07, other tau-nonfalt > 0. + This includes nonflats not y1=2. + full hexagon with one flat, hi,hi, can zero out both ears. + By symmetry, wlog y6 > y5. + sec(731) + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] + (( taum y1 y2 y3 y4 y5 y6 - #0.07 + + y_of_x (flat_term2_234_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + > #0.712) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) \/ + (y5 < y6) +)`; +};; + +add +{ + idv="test 1324821088 2013 b"; + doc="full hexagon with one flat, hi,hi, can zero out both ears. + Big alternating central triangle. + ear234(flat), ear126( + extra assumption, ear126 has delta < 50. + By symmetry, wlog y4 < y5. + The constant 0.013 comes from 2535350075. + We add constant in on the hi case, even though it isn't needed here. + To permit simplification of the lo case later. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] + (( taum y1 y2 y3 y4 y5 y6 - &2 * #0.07 + + y_of_x (flat_term2_234_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + > #0.712) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &50 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) +)`; +};; + +add +{ + idv="test 1324821088 2013 c"; + doc="full hexagon with one flat, hi,hi, can zero out both ears. + Big alternating central triangle. + ear234(flat), ear126( + extra assumption, ear126 has delta > 50. + By symmetry, wlog y4 < y5. + The constant 0.013 comes from 2535350075. + We add constant in on the hi case, even though it isn't needed here. + To permit simplification of the lo case later. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] + (( taum y1 y2 y3 y4 y5 y6 - &2 * #0.07 + + y_of_x (flat_term2_234_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + > #0.712) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (mud_126_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 > &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &50 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) +)`; +};; + +add +{ + idv="test 1324821088 2013 d"; + doc="full hexagon with one flat, hi,hi, can zero out both ears. + Big alternating central triangle. + ear234(flat), ear126( + extra assumption, ear126 has delta > 50. + By symmetry, wlog y4 < y5. + The constant 0.013 comes from 2535350075. + We add constant in on the hi case, even though it isn't needed here. + To permit simplification of the lo case later. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] + (( taum y1 y2 y3 y4 y5 y6 - #0.07 - sol0 + + y_of_x (flat_term2_234_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + > #0.712) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ +// y_of_x (mud_126_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 > -- #0.07 \/ + + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &10 \/ + y_of_x (delta_126_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) +)`; +};; + +add +{ + idv="test 1324821088 2013 e"; + doc="full hexagon with one flat, hi,hi, can zero out both ears. + Big alternating central triangle. + ear234(flat), ear126( + extra assumption, ear126 has delta > 50. + By symmetry, wlog y4 < y5. + The constant 0.013 comes from 2535350075. + We add constant in on the hi case, even though it isn't needed here. + To permit simplification of the lo case later. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] + (( taum y1 y2 y3 y4 y5 y6 - #0.07 + + y_of_x (mud_126_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + y_of_x (flat_term2_234_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + > #0.712) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &10 \/ + y_of_x (delta_126_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) +)`; +};; + +add +{ + idv="test 1324821088 2013 f"; + doc="full hexagon with one flat, hi,hi, can zero out both ears. + Big alternating central triangle. + ear234(flat), ear126( + extra assumption, ear126 has delta > 50. + By symmetry, wlog y4 < y5. + The constant 0.013 comes from 2535350075. + We add constant in on the hi case, even though it isn't needed here. + To permit simplification of the lo case later. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] + (( taum y1 y2 y3 y4 y5 y6 - &2 * sol0 + + y_of_x (flat_term2_234_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + > #0.712) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &15 \/ + y_of_x (delta_126_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) +)`; +};; + +add +{ + idv="test 1324821088 2013 g"; + doc="full hexagon with one flat, hi,hi, can zero out both ears. + Big alternating central triangle. + ear234(flat), ear126( + extra assumption, ear126 has delta > 50. + By symmetry, wlog y4 < y5. + The constant 0.013 comes from 2535350075. + We add constant in on the hi case, even though it isn't needed here. + To permit simplification of the lo case later. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] + (( taum y1 y2 y3 y4 y5 y6 - &2 * sol0 + + y_of_x (mud_126_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_234_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + > #0.712) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &15 \/ + y_of_x (delta_126_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) +)`; +};; + + +add2 +{ + idv="test B"; + doc=""; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( (taum y1 y2 y3 y4 y5 y6 > #0.712 ) \/ + y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0 \/ + y4 < y5 \/ y5 < y6 +)`; +};; + +add +{ + idv="test B1"; + doc="full hexagon tau+, tau+, tau- + Big alternating central triangle. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] + (( taum y1 y2 y3 y4 y5 y6 + + &0 - sol0 + > #0.712) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &15 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) \/ + (y5 < y6) +)`; +};; + +add +{ + idv="test B2"; + doc="full hexagon tau+, tau+, tau- + Big alternating central triangle. + extra assumption, ear126 has delta > 50. + sqrt(15)> 3.8729. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] + (( taum y1 y2 y3 y4 y5 y6 + + y_of_x (mudLs_234_x (#3.8729) (&10) (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + > #0.712) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &15 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &100 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) +)`; +};; + +add +{ + idv="test B3"; + doc="full hexagon tau+, tau+, tau- + Big alternating central triangle. + extra assumption, ear126 has delta > 50. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] + (( taum y1 y2 y3 y4 y5 y6 + + y_of_x (mud_126_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + > #0.712) \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &100 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) +)`; +};; + + +add +{ + idv="test C1"; + doc="full hexagon tau+, tau-, tau- + Big alternating central triangle. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] + (( taum y1 y2 y3 y4 y5 y6 + + &0 - sol0 + + &0 - sol0 + > #0.712) \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &15 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &15 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) +)`; +};; + +add +{ + idv="test C2"; + doc="full hexagon tau+, tau-, tau- + Big alternating central triangle. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] + (( taum y1 y2 y3 y4 y5 y6 + + y_of_x (mud_126_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + &0 - sol0 + > #0.712) \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &15 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &15 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) +)`; +};; + +add +{ + idv="test C3"; + doc="full hexagon tau+, tau-, tau- + Big alternating central triangle. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] + (( taum y1 y2 y3 y4 y5 y6 + + y_of_x (mud_126_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + y_of_x (mud_135_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + > #0.712) \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &15 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &15 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) +)`; +};; + +add +{ + idv="test D1"; + doc="full hexagon tau-, tau-, tau- + Big alternating central triangle. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] + (( taum y1 y2 y3 y4 y5 y6 + + &0 - &3 * sol0 + > #0.712) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &15 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &15 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &15 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) +)`; +};; + +add +{ + idv="test D2"; + doc="full hexagon tau-, tau-, tau- + Big alternating central triangle. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] + (( taum y1 y2 y3 y4 y5 y6 + + y_of_x (mud_126_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + &0 - &2 * sol0 + > #0.712) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &15 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &15 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &15 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) +)`; +};; + +add +{ + idv="test D3"; + doc="full hexagon tau-, tau-, tau- + Big alternating central triangle. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] + (( taum y1 y2 y3 y4 y5 y6 + + y_of_x (mud_126_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + y_of_x (mud_135_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + &0 - &1 * sol0 + > #0.712) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &15 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &15 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &15 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) +)`; +};; + +add +{ + idv="test D4"; + doc="full hexagon tau-, tau-, tau- + Big alternating central triangle. + "; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] + (( taum y1 y2 y3 y4 y5 y6 + + y_of_x (mud_126_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + y_of_x (mud_135_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + y_of_x (mud_234_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + > #0.712) \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &15 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &15 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &15 \/ + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0) +)`; +};; + + +add +{ + idv="test"; + doc=""; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,&2); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + taud y1 y2 y3 y4 y5 y6 > taud (#2.52) y2 y3 y4 y5 y6 \/ +delta_y y1 y2 y3 y4 y5 y6 < &0 \/ + delta_y (#2.52) y2 y3 y4 y5 y6 < &0 +)`; +};; + + + +add +{ + idv="test"; + doc=""; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (#2.0,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (taum y1 y2 y3 y4 y5 y6 > &0 \/ + (delta_y y1 y2 y3 y4 y5 y6 > &20) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + ))`; +};; + +add +{ + idv="test"; + doc=""; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (#2.0,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (y4 > #3.01 ) \/ + taum y1 y2 y3 y4 y5 y6 > -- #0.337 \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +skip +{ + idv="4795451128"; + doc="old name: taud hex* + test (also works with taud_v2)"; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); + (&2,y5,#2.52); + (&2,y6,#2.52); + (#3.01,z1,#3.915); + (#3.01,z3,#3.915); + (#3.01,z5,#3.915) + ] +( (taum y1 y3 y5 z1 z3 z5 + + taud y4 y3 y5 z1 (&2) (&2) + + taud y6 y5 y1 z3 (&2) (&2) + + taud y2 y1 y3 z5 (&2) (&2) > #0.712) \/ + delta_y y1 y3 y5 z1 z3 z5 < &0 \/ + delta_y y4 y3 y5 z1 (&2) (&2) < &0 \/ + delta_y y6 y5 y1 z3 (&2) (&2) < &0 \/ + delta_y y2 y1 y3 z5 (&2) (&2) < &0 \/ + y_of_x eulerA_x y1 y3 y5 z1 z3 z5 < &0)`; +};; + +run2 +{ + idv="1948775510"; + doc="was test Q. + local fan/main estimate/terminal pent + LHS(135,y1=2.52,delta=>20) RHS(126,delta=0) + "; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237) + ] +(taum y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_126_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + y_of_x (mud_135_x_v1 (&2 * h0) (&2) (&2)) y1 y2 y3 y4 y5 y6 + > #0.616 \/ + y_of_x (delta_135_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &20 \/ + y_of_x (delta_126_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 // \/ +// y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 +)`; +};; + +run +{ + idv="test-hex-numerical-taud"; + doc="For cfsqp only. + This is the numerator of the 2nd derivative of the function taud."; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] + (((y_of_x taud_D1_num_x y1 y2 y3 y4 y5 y6) pow 2 > &0) \/ + (y_of_x taud_D2_num_x y1 y2 y3 y4 y5 y6 < &0 \/ + taud y1 y2 y3 y4 y5 y6 > #0.0 \/ // can adjust this later. + delta_y y1 y2 y3 y4 y5 y6 < &15))`; +};; + + + +run +{ + idv="test 9692636487"; + doc="local fan/main estimate/appendix/terminal hex. + 2nd derivative test for taud."; + tags=[Main_estimate;Flypaper ["LIAULBV"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] + ( + (y_of_x taud_D2_num_x y1 y2 y3 y4 y5 y6 < &0 \/ + delta_y y1 y2 y3 y4 y5 y6 < &0) \/ + delta_y y1 y2 y3 y4 y5 y6 > &15 +)`; +};; + +add +{ + idv="2735164514"; + doc="l"; + tags=[Main_estimate;Flypaper ["LIAULBV"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +(y_of_x delta_x1 y1 y2 y3 y4 y5 y6 < &0 \/ +&0 < y_of_x (delta_sub1_x (&4)) y1 y2 y3 y4 y5 y6 ) +`; +};; + + + + +map Scripts.one_cfsqp ["test8"];; +map Scripts.one_cfsqp ["taum pent3"];; +Ineq.remove "test25353";; +Auto_lib.testsplit true "5556646409 small domain";; + + let flyspeck_needs_status filename (badfile,badmsg,ok) = + if not(ok) then (badfile,badmsg,ok) + else + try (flyspeck_needs filename); (badfile,badmsg,ok) + with Failure t -> (filename,t,false);; + + let flyspeck_needs_list filenames = + let (badfile,badmsg,ok) = itlist flyspeck_needs_status filenames ("","",true) in + if ok then report "full load completed" + else (report ("Failure in file "^badfile); report badmsg);; + +flyspeck_needs_status "../development/thales/session/test1.hl" ("","",true);; +flyspeck_needs_status "../development/thales/session/test2.hl" ("","",true);; + +map flyspeck_needs ["../development/thales/session/test1.hl"; "../development/thales/session/test2.hl"];; +flyspeck_needs_list ["../development/thales/session/test1.hl"; "../development/thales/session/test2.hl"];; +flyspeck_needs_list ["../development/thales/session/test1.hl"; "../development/thales/session/test1.hl"];; +rflyspeck_needs "../development/thales/session/test1.hl";; +Test1.test;; diff --git a/legacy/oldnonlinear/nonlinear/text_interface.hl b/legacy/oldnonlinear/nonlinear/text_interface.hl new file mode 100644 index 0000000..d5a7136 --- /dev/null +++ b/legacy/oldnonlinear/nonlinear/text_interface.hl @@ -0,0 +1,56 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: nonlinear inequalities *) +(* Author: Thomas Hales *) +(* Date: 2011-04-29 *) +(* ========================================================================== *) + +(* + +This file translates the low-level nonlinear inequalities into the higher-level form +in which they are used in the text part of the proof. + +Make a constant for each computer calculation of the text. +*) + + +module Text_interface = struct +1;; + + let get_flypaper_filter s idv = + mem s (Ineq.flypaper_ids idv);; + + let get_flypaper s = List.filter (get_flypaper_filter s) (!Ineq.ineqs);; + + let packing_chapter = ["TSKAJXY";"OXLZLEZ";"BIEFJHU";"WAZLDCD";"UKBRPFE"];; + + let local_chapter = ["SDCCMGA";"UPONLFY";"OUCPLRI";"OMKYNLT";"2986512815"; + "JNTEFVP";"PQFYWHW";"GYQVFXJ";"ZHPXLTX"];; + + let tame_chapter = ["TVAWGDR";"KCBLRQC"];; + + let further_chapter = ["TNVWUGK";"ZVLLGZK"];; + + Ineq.all_flypaper();; + + let TSKAJXY_idvs = get_flypaper "TSKAJXY";; + + let OXLZLEZ_idvs = get_flypaper "OXLZLEZ";; + + let ineq_tm u = u.ineq;; + let tms_of_ls = map ineq_tm o Ineq.getexact;; + +let packing_TSKAJXY = list_mk_conj (map ineq_tm TSKAJXY_idvs);; + +let TSKAJXY_HYPa = new_definition (mk_eq(`TSKAJXY_HYPa:bool`,packing_TSKAJXY));; + + +let overlooked idv = + List.length (List.filter (function Flypaper _ -> true | Lp -> true | Lp_aux _ -> true | _ -> false) idv.tags) = 0;; + +let ovv = List.filter overlooked (!Ineq.ineqs);; + +map (fun r -> r.idv) ovv;; + +end;; diff --git a/legacy/oldnonlinear/post.hl b/legacy/oldnonlinear/post.hl new file mode 100644 index 0000000..8641d66 --- /dev/null +++ b/legacy/oldnonlinear/post.hl @@ -0,0 +1,221 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Nonlinear *) +(* Author: Thomas C. Hales *) +(* Date: 2012-10-15 *) +(* ========================================================================== *) + +(* This file is not used. I think it can be deleted. *) + +(* This file connects inequalities from the book with the form in which +they appear in ineq.hl and main_estimate_ineq.hl + +In the proofs of the conclusions, inequalities from ineq.hl and main_estimate_ineq.hl may +be used freely. + +Here are the computer calculations mentioned by ID in Dense Sphere Packings + +packing.tex: +TSKAJXY (Lemma 6.92, gamma(X,L) \ge 0). +OXLZLEZ (Lemma 6.93, Gamma(epsilon) \ge 0) +BIEFJHU (Lemma 6.110, card V = 13, 14, 15) +WAZLDCD (Lemma 6.112, saturation lemma) +UKBRPFE (Lemma 6.112, saturation lemma) + +local.tex: +UPONLFY (tau* is increasing in y4) +5202826650 a (stability estimates, tautri-div-sqrt-delta \ge 0) + +supplement_local.tex: +1117202051 (the solid angle at a pole is at least pi/2) +4559601669 (the solid angle at a pole is at least pi/2) +with $k(s)\le 4$, by a \cc{various inequalities}{}, (k<=4 implies tau*(s,v)>0). + +tame.tex: +TVAWGDR (Delta >0 for certain simplex bounds) +KCBLRQC (b table estimates) + +*) + +(* +post form of "2065952723 A1" +4828966562, 8964099283, +6843920790, 5512912661, + main_estimate_ineq.hl +*) + +module Post = struct + +let post_206A1_concl = `!y1 y2 y3 y4 y5 y6 a b c. + (arclength (&2) (&2) a = arclength y2 y3 y4 /\ + arclength (&2) (&2) b = arclength y1 y3 y5 /\ + arclength (&2) (&2) c = arclength y1 y2 y6) /\ + &0 < y1 /\ &0 < y2 /\ &0 < y3 /\ &0 < y4 /\ &0 < y5 /\ &0 < y6 /\ + &0 < a /\ a < &4 /\ &0 < b /\ b < &4 /\ &0 < c /\ c < &4 ==> + (delta_y y1 y2 y3 y4 y5 y6 > &0 <=> delta_y (&2) (&2) (&2) a b c > &0)`;; + +(* proof : if delta_y > 0, then ?v1 v2 v3 v4. deltaV v1 v2 v3 v4 = delta_y y1 y2 y3 y4 y5 y6 + then let wi = 2* vi/|vi|, + then deltaV w1 w2 w3 w4 > 0, + also deltaV w1 w2 w3 w4 = delta_y (&2) (&2) (&2) a b c. + + Conversely, given deltaV w1 w2 w3 w4 = delta_y ..... a b c > &0. + Let vi = (y1/2) * wi and repeat the process +*) + +let post_206A1_concl2 = `!y1 y2 y3 y4 y5 y6 a b c e1 e2 e3 f'. + arclength (&2) (&2) a = arclength y2 y3 y4 /\ + arclength (&2) (&2) b = arclength y1 y3 y5 /\ + arclength (&2) (&2) c = arclength y1 y2 y6 /\ + &2 <= y1 /\ y1 <= #2.52 /\ + &2 <= y2 /\ y2 <= #2.52 /\ + &2 <= y3 /\ y3 <= #2.52 /\ + &0 < y4 /\ &0 < y5 /\ &0 < y6 /\ + y4 < y2 + y3 /\ y5 < y1 + y3 /\ y6 < y1 + y2 /\ + rho y1 = e1 /\ + rho y2 = e2 /\ + rho y3 = e3 /\ + (&0 < delta_y y1 y2 y3 y4 y5 y6 ) /\ + ((has_real_derivative) (\y. taum y1 y2 y3 y y5 y6) f' (atreal y4)) ==> + (?r. &0 < r /\ (f' = r * num1 e1 e2 e3 (a pow 2) (b pow 2) (c pow 2)))`;; + + +(* proof: +Rewrite the variables y1...y6 in terms of variables a,b,c,e1,e2,e3. +Use calc_derivative.hl to calculate the y4 derivative of taum +and to simplify the rational expression. +num1 appears as the numerator in that expression. +See the mathematica notes in sphere.hl next to the definition of num1. +*) + +let post_206A1_concl3 = `!y1 y2 y3 y4 y5 y6 a b c e1 e2 e3 f' f''. + arclength (&2) (&2) a = arclength y2 y3 y4 /\ + arclength (&2) (&2) b = arclength y1 y3 y5 /\ + arclength (&2) (&2) c = arclength y1 y2 y6 /\ + &2 <= y1 /\ y1 <= #2.52 /\ + &2 <= y2 /\ y2 <= #2.52 /\ + &2 <= y3 /\ y3 <= #2.52 /\ + &0 < y4 /\ &0 < y5 /\ &0 < y6 /\ + y4 < y2 + y3 /\ y5 < y1 + y3 /\ y6 < y1 + y2 /\ + rho y1 = e1 /\ + rho y2 = e2 /\ + rho y3 = e3 /\ + (&0 < delta_y y1 y2 y3 y4 y5 y6 ) /\ + (?eps. (&0 < eps) ==> + (!u. abs(u- y4) < eps ==> (has_real_derivative) (\y. taum y1 y2 y3 y y5 y6) (f' u) (atreal u))) /\ + ((has_real_derivative) f' f'' (atreal y4)) ==> + (?r. &0 < r /\ (f'' = r * num2 e1 e2 e3 (a pow 2) (b pow 2) (c pow 2)))`;; + +(* proof: +Rewrite the variables y1...y6 in terms of variables a,b,c,e1,e2,e3. +Use calc_derivative.hl to calculate the y4 second derivative of taum +and to simplify the rational expression. +num2 appears as the numerator in that expression. +See the mathematica notes in sphere.hl next to the definition of num2. +*) + +(* post form of 1117202051, 4559601669, 4559601669b, 2485876245a *) + +let post_delta4_concl = `!y1 y2 y3 y4 y5 y6. + &0 < delta_y y1 y2 y3 y4 y5 y6 /\ + &0 < y1 /\ + delta4_y y1 y2 y3 y4 y5 y6 < &0 ==> + pi/ &2 < dih_y y1 y2 y3 y4 y5 y6`;; + +let post_delta4_concl2 = `!y1 y2 y3 y4 y5 y6. + &0 < delta_y y1 y2 y3 y4 y5 y6 /\ + &0 < y1 /\ + &0 < delta4_y y1 y2 y3 y4 y5 y6 ==> + dih_y y1 y2 y3 y4 y5 y6 < pi/ &2 `;; + +(* proof: + See Sphere.dih_x;; +*) + +(* post form of 4322269127, 5556646409 *) + +let post_mdtau_concl = `!y1 y2 y3 y4 y5 y6 f'. + &0 < delta_y y1 y2 y3 y4 y5 y6 /\ + (has_real_derivative) (\y. taum y y2 y3 y4 y5 y6) f' (atreal y1) ==> + (?r. &0 < r /\ f' = r * mdtau_y y1 y2 y3 y4 y5 y6)`;; + +let post_mdtau2_concl = `!y1 y2 y3 y4 y5 y6 f' f''. + &0 < delta_y y1 y2 y3 y4 y5 y6 /\ + (?eps. (&0 < eps) /\ (!u. (has_real_derivative) (\y. taum y y2 y3 y4 y5 y6) (f' u) (atreal u))) /\ + (has_real_derivative) f' f'' (atreal y1) ==> + (?r. &0 < r /\ f'' = r * mdtau2uf_y y1 y2 y3 y4 y5 y6)`;; + +(* post form of hexagons SAUZWSD: + 5338748573, 3306409086, 9075398267, 1324821088, + 4108834026, 6388508112, 5493250206, 2283016857, 4872337467, 3615835903, 2535350075, + all top edges 2. + *) + +(* `!V E FF. convex_local_fan (V,E,FF) /\ + V HAS_SIZE 6 /\ (V SUBSET BB) /\ + (!v1 v2. {v1,v2} IN E ==> dist (v1,v2) = &2) /\ + (!w1 w2. ~({w1,w2} IN E) /\ (w1 IN V) /\ (w2 IN V) ==> (#3.01 <= dist(w1,w2))) /\ + (?v1 v2 v3 v4 v5 v6. + V = {v1,v2,v3,v4,v5,v6} /\ + E = {{v1,v2},{v2,v3},{v3,v4},{v4,v5},{v5,v6},{v6,v1}} /\ + (!w1 w2. {w1,w2} IN {{v1,v3},{v3,v5},{v5,v1}} ==> dist(w1,w2) <= #3.915))) + ==> (tau_fun V E FF > #0.712)`;; +*) + +(* better form of the preceding *) + + +let post_SAUZWSD_concl = `!v1 v2 v3 v4 v5 v6. +({v1,v2,v3,v4,v5,v6} SUBSET ball_annulus) /\ +(!w1 w2. {w1,w2} IN {{v1,v2},{v2,v3},{v3,v4},{v4,v5},{v5,v6},{v6,v1}} + ==> dist(w1,w2)= &2) /\ +(!w1 w2. {w1,w2} IN {{v1,v3},{v3,v5},{v5,v1}} + ==> (#3.01 <= dist(w1,w2) /\ dist(w1,w2) <= #3.915)) /\ +(!w w' w''. {w,w',w''} IN {{v2,v1,v3},{v4,v3,v5},{v6,v5,v1}} ==> + (norm w = &2 \/ norm w = #2.52 \/ w' IN aff_gt { vec 0 } {w',w''})) ==> + (tauV v1 v3 v5 + + tauV v1 v2 v3 + tauV v3 v4 v5 + tauV v5 v6 v1 > #0.712)`;; + +(* post form of "5202826650 a" *) + +(* See lemma OWZLKVY. + Some lemmas have already been proved about tau_residual_x in relation to taum. *) + +(* post form of pentagons EDZEPIH: + 7067938795, 9459075374, 2559885109, 9861833891, 8199484193, 3980286827, + "3221740746 a", 8520556953, 9977174768, + +*) + +let post_EDZEPIH_concl = `!v1 v2 v3 v4 v5. + {v1,v2,v3,v4,v5} SUBSET ball_annulus /\ + (!w1 w2. {w1,w2} IN {{v1,v2},{v2,v3},{v3,v4},{v4,v5},{v5,v1}} ==> dist(w1,w2)= &2) /\ + (!w1 w2. {w1,w2} IN {{v1,v3},{v1,v4}} + ==> (#3.01 <= dist(w1,w2) /\ (dist(w1,w2) <= #3.24))) /\ + (pi/ &2 <= dihV (vec 0) v1 v2 v3 + dihV (vec 0) v2 v3 v4 + dihV (vec 0) v3 v4 v5) /\ +(!w w' w''. {w,w',w''} IN {{v2,v1,v3},{v5,v4,v1}} ==> + (norm w = &2 \/ norm w = #2.52 \/ w' IN aff_gt { vec 0 } {w',w''})) ==> + (tauV v1 v3 v4 + tauV v1 v2 v3 + tauV v1 v4 v5 > #0.616)`;; + + +(* old form: +let post_EDZEPIH_concl = `!V E FF. convex_local_fan (V,E,FF) /\ + V HAS_SIZE 5 /\ (V SUBSET BB) /\ + (!v1 v2. {v1,v2} IN E ==> dist (v1,v2) = &2) /\ + (!w1 w2. ~({w1,w2} IN E) /\ (w1 IN V) /\ (w2 IN V) ==> (#3.01 <= dist(w1,w2))) /\ + (?v1 v2 v3 v4 v5. + V = {v1,v2,v3,v4,v5} /\ + E = {{v1,v2},{v2,v3},{v3,v4},{v4,v5},{v5,v1}} /\ + dist(v1,v3) <= #3.24 /\ + dist(v1,v4) <= #3.24 /\ + (norm v2 = &2 \/ norm v2 = #2.52 \/ azim (vec 0) v2 v3 v1 = pi) /\ + (norm v5 = &2 \/ norm v5 = #2.52 \/ azim (vec 0) v5 v1 v4 = pi) + ) + ==> (tau_fun V E FF > #0.616)`;; +*) + + + + +end;; diff --git a/legacy/oldnonlinear/removedef.hl b/legacy/oldnonlinear/removedef.hl new file mode 100644 index 0000000..685fb52 --- /dev/null +++ b/legacy/oldnonlinear/removedef.hl @@ -0,0 +1,312 @@ +(* deprecated 2013-08-17. +removed from Function_list.function_list: + + Functional_equation.x1cube; +Functional_equation.functional_arclength_234; +Functional_equation.functional_arclength_126; +Functional_equation.functional_dih3_x_div_sqrtdelta_posbranch; +Functional_equation.functional_dih5_x_div_sqrtdelta_posbranch; +Functional_equation.functional_dih_x_126_s2; +Functional_equation.functional_dih2_x_126_s2; +Functional_equation.functional_dih3_x_126_s2; +Functional_equation.functional_dih4_x_126_s2; +Functional_equation.functional_dih5_x_126_s2; +Functional_equation.functional_dih6_x_126_s2; +Functional_equation.functional_dih_x_135_s2; +Functional_equation.functional_dih2_x_135_s2; +Functional_equation.functional_dih3_x_135_s2; +Functional_equation.functional_dih4_x_135_s2; +Functional_equation.functional_dih5_x_135_s2; +Functional_equation.functional_dih6_x_135_s2; +Functional_equation.functional_ldih_x_126_s2; +Functional_equation.functional_ldih2_x_126_s2; +Functional_equation.functional_ldih6_x_126_s2; +Functional_equation.functional_ldih_x_135_s2; +Functional_equation.functional_ldih3_x_135_s2; +Functional_equation.functional_ldih5_x_135_s2; +Functional_equation.functional_edge_flat2_x; +Functional_equation.functional_euler_3flat_x; +Functional_equation.functional_euler_2flat_x; +Functional_equation.functional_euler_1flat_x; +Functional_equation.functional_taum_3flat_x; +Functional_equation.functional_taum_2flat_x; +Functional_equation.functional_taum_1flat_x; +Functional_equation.functional_delta_x_126_s2; +Functional_equation.functional_delta_x_135_s2; +Functional_equation.functional_delta_pent_x; +Functional_equation.functional_vol3_x_135_s2; +Functional_equation.functional_ldih_x_n; +Functional_equation.functional_ldih_x_126_n; +Functional_equation.functional_ldih2_x_126_n; +Functional_equation.functional_ldih6_x_126_n; +Functional_equation.functional_ldih_x_135_n; +Functional_equation.functional_ldih3_x_135_n; +Functional_equation.functional_ldih5_x_135_n; +Functional_equation.functional_taum_x1; +Functional_equation.functional_taum_x2; +Functional_equation.functional_taum_x1_x2; +Functional_equation.functional_delta_sub1_x; +Functional_equation.functional_taum_sub1_x; +Functional_equation.functional_taum_sub246_x; +Functional_equation.functional_taum_sub345_x; + +let legacy = ["unit", "x1", "x2", "x3", "x4", "x5", "x6", "y1", "y2", + "y3", "y4", "y5", "y6", "delta_x", "delta_x4", "x1_delta_x", + "delta4_squared_x", "vol_x", "sol", "rad2", "dih", "dih2", "dih3", + "dih4", "dih5", "dih6", "ldih_x", "ldih2_x", "ldih3_x", "ldih5_x", + "ldih6_x", "upper_dih_x", "eulerA_x", "rhazim_x", "rhazim2_x", + "rhazim3_x", "gchi1_x", "gchi2_x", "gchi3_x", "gchi4_x", "gchi5_x", + "gchi6_x", "x1cube", "x1square", "num1", "num2", "num_combo1", "rat1", + "rat2", "den2", "edge_flat2_x", "edge_flat_x", "flat_term_x", "taum_x", + "halfbump_x1", "halfbump_x4", "eta2_126", "eta2_135", "eta2_234", + "eta2_456", "vol3_x_sqrt", "vol3f_x_lfun", "vol3f_x_sqrt2_lmplus", + "arclength_x_123", "arclength_x_234", "arclength_x_126", + "arclength_x_345", "norm2hh_x", "asn797k", "asnFnhk", "lfun_y1", + "acs_sqrt_x1_d4", "acs_sqrt_x2_d4", "sol_euler_x_div_sqrtdelta", + "sol_euler345_x_div_sqrtdelta", "sol_euler156_x_div_sqrtdelta", + "sol_euler246_x_div_sqrtdelta", "dih_x_div_sqrtdelta_posbranch", + "dih2_x_div_sqrtdelta_posbranch", "dih3_x_div_sqrtdelta_posbranch", + "dih4_x_div_sqrtdelta_posbranch", "dih5_x_div_sqrtdelta_posbranch", + "dih6_x_div_sqrtdelta_posbranch", "ldih_x_div_sqrtdelta_posbranch", + "ldih2_x_div_sqrtdelta_posbranch", "ldih3_x_div_sqrtdelta_posbranch", + "ldih4_x_div_sqrtdelta_posbranch", "ldih5_x_div_sqrtdelta_posbranch", + "ldih6_x_div_sqrtdelta_posbranch", "surf_x", "vol3r_126_x", + "dih_x_126_s2", "dih2_x_126_s2", "dih3_x_126_s2", "dih4_x_126_s2", + "dih5_x_126_s2", "dih6_x_126_s2", "ldih_x_126_s2", "ldih2_x_126_s2", + "ldih6_x_126_s2", "dih_x_135_s2", "dih2_x_135_s2", "dih3_x_135_s2", + "dih4_x_135_s2", "dih5_x_135_s2", "dih6_x_135_s2", "ldih_x_135_s2", + "ldih3_x_135_s2", "ldih5_x_135_s2", "lfun_sqrtx1_div2", + "delta_x_135_s2", "delta_x_126_s2", "vol3_x_135_s2", + "gamma3f_x_vLR_lfun", "gamma3f_x_vLR0", "gamma3f_x_vL_lfun", + "gamma3f_x_vL0", "gamma3f_x_v_lfun", "gamma3f_x_v0", "ldih_x_126_n", + "ldih2_x_126_n", "ldih6_x_126_n", "ldih_x_135_n", "ldih3_x_135_n", + "ldih5_x_135_n", "gamma3f_126_x_s_n", "gamma3f_135_x_s_n", + "gamma3f_vLR_x_nlfun", "gamma3f_vLR_x_n0", "gamma3f_vL_x_nlfun", + "gamma3f_vL_x_n0", "tau_lowform_x", "tau_residual_x", + "mdtau_y_LC", "mdtau2uf_y_LC", "euler_3flat_x", "euler_2flat_x", + "euler_1flat_x", "taum_3flat_x", "taum_2flat_x", "taum_1flat_x", + "delta_pent_x", "ell_uvx", "ell_vx2", "selling_volume2", + "selling_surface_nn", "selling_surface_nn2_013", + "selling_surface_nn01_23", "selling_homog", "fcc_ineq", "taum_x1(&&)", + "taum_x2(&&)", "taum_x1_x2(&)", "arclength_x1(&&)", "arclength_x2(&&)", + "surfR126d(&)", "lindih(&)", "delta_126_x(&&&)", "delta_234_x(&&&)", + "delta_135_x(&&&)", "taum_sub1_x(&)", "delta_sub1_x(&)", + "taum_sub246_x(&&&)", "taum_sub345_x(&&&)"];; + +*) + +(* +removed from parse_ineq.hl: + +removed from autogen: + surfR;surfRy;surfRdyc2;surfy;dih4_y; + + (* deprecated: arclength_x_345; solRy;dihRy; *) + +removed from macros: + (* deprecated: + delta_template_B_x_alt; + taum_template_B_x_alt; + dih_template_B_x_alt; + dih_hexall_x; + dih1_hexall_x; + upper_dih_hexall_x; + delta_hexall_x; + delta4_hexall_x; + taum_hexall_x; + eulerA_hexall_x; + factor345_hexall_x; + law_cosines_234_x; + law_cosines_126_x; + tau_lowform_x_alt; +*) + upper_dih_y; + gamma3f_135_n;gamma3f_126_n;gamma23f_n;gamma23f_126_03_n; + taum_sub1_x; + taum_sub246_x; + taum_sub345_x; + taum_3flat_x_alt; + taum_2flat_x_alt; + taum_1flat_x_alt; + euler_3flat_x_alt; + euler_2flat_x_alt; + euler_1flat_x_alt; + delta_pent_x; + lmdih_x_div_sqrtdelta_posbranch; + lmdih2_x_div_sqrtdelta_posbranch; + lmdih3_x_div_sqrtdelta_posbranch; + lmdih5_x_div_sqrtdelta_posbranch; + lmdih6_x_div_sqrtdelta_posbranch; + ell_vx2; + upper_dih_x; +*) + +(* removed from optimize.hl: + + +(* generate function defs for these. *) +(* +let idem_assoc = map (fun a -> (a,a)) [ + "delta_x4";"delta4_squared_x";"x1_delta_x"; + "halfbump_x1";"halfbump_x4"; + "dih_x_div_sqrtdelta_posbranch";"dih2_x_div_sqrtdelta_posbranch"; + "dih3_x_div_sqrtdelta_posbranch";"dih4_x_div_sqrtdelta_posbranch"; + "dih5_x_div_sqrtdelta_posbranch";"dih6_x_div_sqrtdelta_posbranch"; + "ldih_x_div_sqrtdelta_posbranch";"ldih2_x_div_sqrtdelta_posbranch"; + "ldih3_x_div_sqrtdelta_posbranch";"ldih4_x_div_sqrtdelta_posbranch"; + "ldih5_x_div_sqrtdelta_posbranch";"ldih6_x_div_sqrtdelta_posbranch"; + "dih_x_126_s2"; "dih2_x_126_s2"; "dih3_x_126_s2"; + "dih4_x_126_s2"; "dih5_x_126_s2"; "dih6_x_126_s2"; + "ldih_x_126_s2"; "ldih2_x_126_s2"; "ldih6_x_126_s2"; + "dih_x_135_s2"; "dih2_x_135_s2"; "dih3_x_135_s2"; + "dih4_x_135_s2"; "dih5_x_135_s2"; "dih6_x_135_s2"; + "ldih_x_135_s2"; "ldih3_x_135_s2"; "ldih5_x_135_s2"; + "delta_x_126_s2"; "delta_x_135_s2"; + "vol3_x_sqrt";"vol3_x_135_s2"; + "sol_euler_x_div_sqrtdelta";"sol_euler345_x_div_sqrtdelta"; + "sol_euler156_x_div_sqrtdelta";"sol_euler246_x_div_sqrtdelta"; + "taum_x1";"taum_x2";"taum_x1_x2";"arclength_x1";"arclength_x2"; + "arclength_x_123";"arclength_x_234";"arclength_x_126"; + (* "arclength_x_345"; *) + "acs_sqrt_x1_d4";"acs_sqrt_x2_d4"; + "gchi2_x";"gchi3_x";"gchi4_x";"gchi5_x";"gchi6_x"; + "ldih_x";"ldih2_x";"ldih3_x";"ldih6_x"; + "vol3f_x_lfun"; "vol3f_x_sqrt2_lmplus"; + "gamma23f_126_w1"; + "gamma23f_red"; + "asn797k"; "asnFnhk"; "lfun_y1";"surf_x";"surfR126d"; + "sol"; "vol_x"; "gchi1_x";"eta2_126";"eta2_135"; + "gamma3f_x_vLR_lfun"; "gamma3f_x_vLR0"; + "gamma3f_x_vL_lfun"; "gamma3f_x_vL0"; + "gamma3f_x_v_lfun"; "gamma3f_x_v0"; + "monomial"; + "num1"; + + (* deprecated: + "dih_template_B_x";"taum_template_B_x";"delta_template_B_x"; + "dih_hexall_x";"dih1_hexall_x";"upper_dih_hexall_x"; + "delta_hexall_x";"delta4_hexall_x"; + "eulerA_hexall_x";"factor345_hexall_x"; + "law_cosines_234_x";"law_cosines_126_x"; + "delta_top_x"; + "taum_hexall_x"; + "tau_lowform_x"; + *) + "delta_126_x";"delta_234_x";"delta_135_x"; + "taum_x"; + "ldih_x_135_n"; "ldih3_x_135_n"; "ldih5_x_135_n"; + "ldih_x_126_n"; "ldih6_x_126_n"; + "gamma3f_vLR_x_nlfun";"gamma3f_vL_x_nlfun"; + "gamma3f_vLR_x_n0";"gamma3f_vL_x_n0"; + "gamma3f_135_x_s_n";"gamma3f_126_x_s_n"; + "eulerA_x"; + (* added may 2011 *) + "tau_residual_x"; + "edge_flat_x"; + "taum_sub1_x"; + "delta_sub1_x"; + "delta_pent_x"; + "taum_sub246_x"; + "taum_sub345_x"; + "taum_3flat_x"; + "taum_2flat_x"; + "taum_1flat_x"; + "euler_3flat_x"; + "euler_2flat_x"; + "euler_1flat_x"; + (* 2D hex perimeter problem *) + "ell_uvx"; + "ell_vx2"; + (* selling parameters for Phelan-Weaire workshop 2012 *) + "selling_surface_nn"; + "selling_surface_nn2_013"; + "selling_surface_nn01_23"; + "selling_homog"; + "selling_volume2"; + "fcc_ineq"; + ];; +*) + +removed from cpp_assoc: +(* + ("norm2hh_x","norm2hhx"); + ("ldih2_x_126_n","ldih2_x_126_n"); (* was n_ in fst *) + ("unit6","unit"); + ("proj_x1","x1");("proj_x2","x2");("proj_x3","x3"); + ("proj_x4","x4");("proj_x5","x5");("proj_x6","x6"); + ("sqrt_x1","y1"); ("sqrt_x2","y2"); ("sqrt_x3","y3"); + ("sqrt_x4","y4"); ("sqrt_x5","y5"); ("sqrt_x6","y6"); + ("dih_x","dih"); ("dih2_x","dih2");("dih3_x","dih3"); + ("dih4_x","dih4"); ("dih5_x","dih5");("dih6_x","dih6"); + ("rad2_x","rad2"); + ("delta_x","delta"); + ("rhazim_x","rhazim");("rhazim2_x","rhazim2"); + ("rhazim3_x","rhazim3"); + ("upper_dih_x","upper_dih"); +*) + +*) + + + +(* removed from optimize.hl + + +removed from X_FROZEN_COMPOUND: + +GSYM dih_x_126_s2); (GSYM dih2_x_126_s2); + GSYM dih3_x_126_s2; GSYM dih4_x_126_s2; + GSYM dih5_x_126_s2; GSYM dih6_x_126_s2; + GSYM ldih_x_126_s2; GSYM ldih2_x_126_s2;GSYM ldih6_x_126_s2; + (GSYM dih_x_135_s2); (GSYM dih2_x_135_s2); + GSYM dih3_x_135_s2; GSYM dih4_x_135_s2; + GSYM dih5_x_135_s2; GSYM dih6_x_135_s2; + GSYM ldih_x_135_s2; GSYM ldih3_x_135_s2;GSYM ldih5_x_135_s2; + GSYM delta_x_126_s2;GSYM delta_x_135_s2; + GSYM vol3_x_135_s2; + GSYM gamma3f_x_vLR_lfun;GSYM gamma3f_x_vLR0; + GSYM gamma3f_x_v_lfun;GSYM gamma3f_x_v0; + GSYM gamma3f_x_vL_lfun;GSYM gamma3f_x_vL0; + GSYM gamma3f_vLR_x_nlfun; GSYM gamma3f_vL_x_nlfun; + GSYM gamma3f_vLR_x_n0; GSYM gamma3f_vL_x_n0; + GSYM gamma3f_135_x_s_n; GSYM gamma3f_126_x_s_n; + + GSYM ldih_x_126_n; GSYM ldih2_x_126_n; GSYM ldih6_x_126_n; + GSYM ldih_x_135_n;GSYM ldih3_x_135_n;GSYM ldih5_x_135_n; + +removed from X_COMPOUND_DEF: + GSYM Sphere.taum_x1_x2;GSYM Sphere.taum_x1;GSYM Sphere.taum_x2; + GSYM Sphere.surf_x; + GSYM Sphere.surfR126d; + +removed from macro_expand: + (* Oct 20: Sphere.vol3f; *) + (* Sphere.pathL;Sphere.pathR; -- + removed May 24, 2011. for ineqdata cases to work. *) + gamma23f';gamma23f_126_03';gamma23f_v' ; + gamma23f_n_alt;gamma23f_126_03_n_alt; + gamma3f_135_n_alt;gamma3f_126_n_alt; + +removed from BRANCH_TAC +(* vol3f_palt; *) gamma3f_126_expand;gamma3f_135_expand; + gamma3f_vLR0_case;gamma3f_vLR_lfun_case; + gamma3f_vL0_case;gamma3f_vL_lfun_case; + gamma3f_v0_case;gamma3f_v_lfun_case; + (* dec 29 *) gamma3f_vL_nlfun_case;gamma3f_vL_n0_case; + gamma3f_vLR_n0_case;gamma3f_vLR_nlfun_case; + lmdih_ldih_n;lmdih2_ldih2_n;lmdih3_ldih3_n; + lmdih5_ldih5_n;lmdih6_ldih6_n; + lmdih_n0;lmdih2_n0;lmdih3_n0;lmdih5_n0;lmdih6_n0; + +removed from X_SQRT_COMPOUND_ORDER : +`upper_dih_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + upper_dih_x x1 x2 x3 x4 x5 x6 `; + +removed from X_SQRT_COMPOUND_ORDER_TAC: +upper_dih_x_y; + + + +*) + + diff --git a/legacy/oldpacking/BBDTRGC_def.hl b/legacy/oldpacking/BBDTRGC_def.hl new file mode 100644 index 0000000..fc4276c --- /dev/null +++ b/legacy/oldpacking/BBDTRGC_def.hl @@ -0,0 +1,31 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Definition: BBDTRGC *) +(* Chapter: Packing *) +(* Author: Thomas C. Hales *) +(* Date: Feb 14, 2010 *) +(* ========================================================================== *) + + +(* +Deprecated Dec 28, 2011. +Set and list versions of the Voronoi cell. The notation in the book is overloaded. +*) + + +module type Bbdtrgc_def_type = sig + val BBDTRGC_VORONOI_SET : thm + val BBDTRGC_VORONOI_LIST : thm +end;; + +flyspeck_needs "general/sphere.hl";; + +module Bbdtrgc : Bbdtrgc_def_type = struct + + let BBDTRGC_VORONOI_SET = Sphere.VORONOI_SET;; + + let BBDTRGC_VORONOI_LIST = Sphere.VORONOI_LIST;; + +end;; + diff --git a/legacy/oldpacking/DRUQUFE.hl b/legacy/oldpacking/DRUQUFE.hl new file mode 100644 index 0000000..723b29e --- /dev/null +++ b/legacy/oldpacking/DRUQUFE.hl @@ -0,0 +1,34 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Lemma: DRUQUFE *) +(* Chapter: Packing *) +(* Author: Thomas C. Hales *) +(* Date: Feb 14, 2010 *) +(* ========================================================================== *) + +(* +Deprecated Dec 28, 2011. Content moved to pack_concl.hl + +The corresponding theorem for `voronoi_open` has been proved by Nguyen Tat Thang. +Hopefully, his proof can be adapted to this context. + +The conclusion should be separated into three separate statements for useability. +*) + + + +module type Druqufe_type = sig + val DRUQUFE_concl : term +end;; + + + +module Druqufe : Druqufe_type = struct + + let DRUQUFE_concl = `!V (v:real^3). packing V /\ saturated V ==> + compact (voronoi_closed V v) /\ convex (voronoi_closed V v) /\ measurable (voronoi_closed V v)`;; + +end;; + + diff --git a/legacy/oldpacking/IDBEZAL.hl b/legacy/oldpacking/IDBEZAL.hl new file mode 100644 index 0000000..82b1201 --- /dev/null +++ b/legacy/oldpacking/IDBEZAL.hl @@ -0,0 +1,27 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Lemma: IDBEZAL *) +(* Chapter: Packing *) +(* Author: Thomas C. Hales *) +(* Date: Feb 14, 2010 *) +(* ========================================================================== *) + + + + + +module type Idbezal_type = sig + val IDBEZAL_concl : term +end;; + + + +module Idbezal : Idbezal_type = struct + + let IDBEZAL_concl = `!V ul k F. saturated V /\ packing V /\ vor_list V k ul /\ (k < 3) ==> + (F facet_of voronoi_list V ul <=> + (?vl. (F = voronoi_list V vl) /\ vor_list V (k+1) vl /\ (truncate_simplex k vl = ul)))`;; + +end;; + diff --git a/legacy/oldpacking/JJGTQMN_def.hl b/legacy/oldpacking/JJGTQMN_def.hl new file mode 100644 index 0000000..6934244 --- /dev/null +++ b/legacy/oldpacking/JJGTQMN_def.hl @@ -0,0 +1,25 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Definition: JJGTQMN *) +(* Chapter: Packing *) +(* Author: Thomas C. Hales *) +(* Date: Feb 14, 2010 *) +(* ========================================================================== *) + + + + + +module type Jjgtqmn_def_type = sig + val JJGTQMN : thm +end;; + +flyspeck_needs "general/sphere.hl";; + +module Jjgtqmn : Jjgtqmn_def_type = struct + + let JJGTQMN = Sphere.OMEGA_LIST;; + +end;; + diff --git a/legacy/oldpacking/JNRJQSM_def.hl b/legacy/oldpacking/JNRJQSM_def.hl new file mode 100644 index 0000000..c563a5b --- /dev/null +++ b/legacy/oldpacking/JNRJQSM_def.hl @@ -0,0 +1,33 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Definition: JNRJQSM *) +(* Chapter: Packing *) +(* Author: Thomas C. Hales *) +(* Date: Feb 14, 2010 *) +(* ========================================================================== *) + + +(* This is the truncation to initial segments. + NB. There is a shift in the index by 1, because we are viewing a list of length d+1 as a d-simplex. + d_j in the flypaper. +*) + + +module type Jnrjqsm_def_type = sig + val JNRJQSM : thm +end;; + +flyspeck_needs "general/sphere.hl";; + +module Jnrjqsm : Jnrjqsm_def_type = struct + +(* + let TRUNCATE_SIMPLEX = new_definition + `truncate_simplex j (ul:(A) list) = + @vl. ( LENGTH vl = j+1 /\ initial_sublist vl ul)`;; +*) + + let JNRJQSM = Sphere.TRUNCATE_SIMPLEX;; + +end;; diff --git a/legacy/oldpacking/KHEJKCI.hl b/legacy/oldpacking/KHEJKCI.hl new file mode 100644 index 0000000..68b32d3 --- /dev/null +++ b/legacy/oldpacking/KHEJKCI.hl @@ -0,0 +1,26 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Lemma: KHEJKCI *) +(* Chapter: Packing *) +(* Author: Thomas C. Hales *) +(* Date: Feb 14, 2010 *) +(* ========================================================================== *) + + + + + +module type Khejkci_type = sig + val KHEJKCI_concl: term +end;; + + + +module Khejkci : Khejkci_type = struct + + let KHEJKCI_concl = `!V k ul. saturated V /\ packing V /\ vor_list V k ul ==> + ((voronoi_list V ul) face_of (voronoi_closed V (HD ul)) )`;; + +end;; + diff --git a/legacy/oldpacking/NOPZSEH_def.hl b/legacy/oldpacking/NOPZSEH_def.hl new file mode 100644 index 0000000..9ca3460 --- /dev/null +++ b/legacy/oldpacking/NOPZSEH_def.hl @@ -0,0 +1,27 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Definition: NOPZSEH *) +(* Chapter: Packing *) +(* Author: Thomas C. Hales *) +(* Date: Feb 14, 2010 *) +(* ========================================================================== *) + +(* +In the text `vor_list` is written with a bar under `voronoi_list` bar V k + +*) + + + +module type Nopzseh_def_type = sig + val NOPZSEH : thm +end;; + +flyspeck_needs "general/sphere.hl";; + +module Nopzseh : Nopzseh_def_type = struct + + let NOPZSEH = Sphere.BARV;; + +end;; diff --git a/legacy/oldpacking/PHZVPFY_def.hl b/legacy/oldpacking/PHZVPFY_def.hl new file mode 100644 index 0000000..652ca6a --- /dev/null +++ b/legacy/oldpacking/PHZVPFY_def.hl @@ -0,0 +1,25 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Definition: PHZVPFY *) +(* Chapter: Packing *) +(* Author: Thomas C. Hales *) +(* Date: Feb 15, 2010 *) +(* ========================================================================== *) + + + + + +module type Phzvpfy_def_type = sig + val PHZVPFY : thm +end;; + +flyspeck_needs "general/sphere.hl";; + +module Phzvpfy : Phzvpfy_def_type = struct + + let PHZVPFY = Sphere.ROGERS;; + +end;; + diff --git a/legacy/oldpacking/RHWVGNP.hl b/legacy/oldpacking/RHWVGNP.hl new file mode 100644 index 0000000..88761ab --- /dev/null +++ b/legacy/oldpacking/RHWVGNP.hl @@ -0,0 +1,49 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Lemma: RHWVGNP *) +(* Chapter: Packing *) +(* Author: Thomas C. Hales *) +(* Date: Feb 14, 2010 *) +(* ========================================================================== *) + + + + +(* +There are two main separate conclusions +(1) The boundedness of the Voronoi cell +(2) The polyhedron. +The statement of the lemma has been broken into substatements. +All statements need a proof. + +Closely related theorems for `voronoi_open` have been proved by Thang. It might be possible +to adapt his proofs. + +Deprecated Dec 28, 2011. Content moved to pack_concl.hl +*) + + + +module type Rhwvgnp_type = sig + val RHWVGNP_concl : term + val VORONOI_BALL2_concl : term + val VORONOI_INTER_BIS_LE_concl : term + val VORONOI_POLYHEDRON_concl : term +end;; + + + +module Rhwvgnp : Rhwvgnp_type = struct + + let VORONOI_BALL2_concl = `!V (v:real^3). packing V /\ saturated V /\ (v IN V) ==> voronoi_closed V v SUBSET ball(v, &2)`;; + + let VORONOI_INTER_BIS_LE_concl = `!V (v:real^3). packing V /\ saturated V /\ (v IN V) ==> + (voronoi_closed V v =INTERS { bis_le v u | u IN V /\ u IN ball(v, &4) /\ ~(u=v) })`;; + + let VORONOI_POLYHEDRON_concl = `!V (v:real^3). packing V /\ saturated V /\ (v IN V) ==> + polyhedron (voronoi_closed V v)`;; + + let RHWVGNP_concl = VORONOI_POLYHEDRON_concl;; + +end;; diff --git a/legacy/oldpacking/TIWWFYQ.hl b/legacy/oldpacking/TIWWFYQ.hl new file mode 100644 index 0000000..e2521f7 --- /dev/null +++ b/legacy/oldpacking/TIWWFYQ.hl @@ -0,0 +1,37 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Lemma: TIWWFYQ *) +(* Chapter: Packing *) +(* Author: Thomas C. Hales *) +(* Date: Feb 14, 2010 *) +(* ========================================================================== *) + + + + +(* +R^3 is the union of Voronoi cells. + +We write this in pointwise form: for every p IN R^3, there exists a cell to which it belongs. + +Deprecated, Dec 28 2011. Content moved to pack_con.hl. +*) + + + +module type Tiwwfyq_def_type = sig + val TIWWFYQ_concl : term + +(* val TIWWFYQ : thm *) + +end;; + + + +module Tiwwfyq : Tiwwfyq_def_type = struct + + let TIWWFYQ_concl = `!V (p:real^3). packing V /\ saturated V ==> (?v. v IN V /\ p IN voronoi_closed V v)`;; + +end;; + diff --git a/legacy/oldpacking/ch_packing/TSKAJXY.hl b/legacy/oldpacking/ch_packing/TSKAJXY.hl new file mode 100644 index 0000000..ac5ec9d --- /dev/null +++ b/legacy/oldpacking/ch_packing/TSKAJXY.hl @@ -0,0 +1,69 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Packing *) +(* Lemma: TSKAJXY *) +(* Author: Thomas Hales *) +(* Date: 2011-07-31 *) +(* ========================================================================== *) + +(* + +TSKAJXY. + +`!V X. saturated V /\ packing V /\ mcell_set V X /\ critical_edge V X = {} ==> + gammaX V X lmfun >= &0`, + +I proved a few lemmas, but I realized that I need RVFXZBU, before going +very far, and this still hasn't been formalized. +The theorem is needed for the proof that `cell_param (mcell k V ul) = (k,ul)`. + +Return later. + -thales + +*) + + +let exists_eq = prove_by_refinement( + `!P Q. (!(x:A). (P x = Q x)) ==> ((?x. P x) <=> (?x. Q x))`, + (* {{{ proof *) + [ +MESON_TAC[] + ]);; + (* }}} *) + +let mcell_set_alt = prove_by_refinement( + `!V X. mcell_set V X = (?ul. (barV V 3 ul) /\ (X = mcell0 V ul \/ X = mcell1 V ul \/ X = mcell2 V ul \/ X = mcell3 V ul \/ X = mcell4 V ul))`, + (* {{{ proof *) + [ +REWRITE_TAC [Pack_defs.mcell_set;IN_ELIM_THM;IN] ; +REPEAT STRIP_TAC ; +ONCE_REWRITE_TAC[SWAP_EXISTS_THM]; +MATCH_MP_TAC exists_eq; +GEN_TAC ; +EQ_TAC; +REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]; +MP_TAC (ARITH_RULE `i=0 \/ i=1 \/ i=2 \/ i=3 \/ i>=4`); +REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN SIMP_TAC [Marchal_cells_2.MCELL_EXPLICIT]; +ASM_MESON_TAC [Marchal_cells_2.MCELL_EXPLICIT]; +REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]; +EXISTS_TAC `0` THEN (REWRITE_TAC[Marchal_cells_2.MCELL_EXPLICIT]); +EXISTS_TAC `1` THEN (REWRITE_TAC[Marchal_cells_2.MCELL_EXPLICIT]); +EXISTS_TAC `2` THEN (REWRITE_TAC[Marchal_cells_2.MCELL_EXPLICIT]); +EXISTS_TAC `3` THEN (REWRITE_TAC[Marchal_cells_2.MCELL_EXPLICIT]); +EXISTS_TAC `4` THEN (MESON_TAC[Marchal_cells_2.MCELL_EXPLICIT;ARITH_RULE `4 >= 4`]) + ]);; + (* }}} *) + +let mcell4_convex_hull = prove_by_refinement( + `!V X ul. barV V 3 vl /\ hl vl < sqrt(&2) ==> ?u0 u1 u2 u3. (vl = [u0;u1;u2;u3] /\ (mcell4 V vl = convex hull {u0,u1,u2,u3}))`, + (* {{{ proof *) + [ +REPEAT STRIP_TAC ; +ASM_REWRITE_TAC [Pack_defs.mcell4]; +SUBGOAL_THEN `?u0 u1 u2 u3. vl = [(u0:real^3);u1;u2;u3]` (fun t -> MP_TAC t THEN MESON_TAC[set_of_list]); +MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT; +ASM_MESON_TAC [] + ]);; + (* }}} *) + diff --git a/legacy/oldpacking/ch_packing/oxl_lemma.hl b/legacy/oldpacking/ch_packing/oxl_lemma.hl new file mode 100644 index 0000000..1fbbfae --- /dev/null +++ b/legacy/oldpacking/ch_packing/oxl_lemma.hl @@ -0,0 +1,316 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Packing *) +(* Author: Thomas C. Hales *) +(* Date: 2012-11-23 *) +(* ========================================================================== *) + +(* +Dec 21, 2012. + +Use nonlinear inequalities to prove OXLZLEZ + +The purpose of this file is to justify the hypothesis cc_bool_prep_v9. +by means of an induction argument. + +However, this was abandoned midstream, because there is difficultly +in applying the reduction step to the hypothesis 'txq' in OXL_def.hl. + +*) + +module Oxl_lemma = struct + + open Oxl_def;; + open Hales_tactic;; + +end;; + +(* +let cc_real_model_simple2 = prove_by_refinement( +`!cc n cc' x. + ~(n=0) /\ + cc_card_v9 cc = n /\ + cc_card_v9 cc' = (n+1) /\ + cc_bool_model_v9 cc /\ + cc_real_model_v9 cc' /\ + cc_bool_model_v9 cc' /\ + periodic (cc_azim_v9 cc) (n) /\ + periodic (cc_gg_v9 cc) (n) /\ + periodic (cc_gg3a_v9 cc) (n) /\ + periodic (cc_gg3b_v9 cc) (n) /\ + (cc_qy_v9 cc' x) /\ + (cc_qy_v9 cc' (x+1)) /\ + cc_azim_v9 cc 0 = cc_azim_v9 cc' x + cc_azim_v9 cc' (x+1) /\ + cc_gg_v9 cc 0 = cc_gg_v9 cc' x + cc_gg_v9 cc' (x+1) /\ + cc_gg3a_v9 cc 0 = cc_gg3a_v9 cc' x + cc_gg3a_v9 cc' (x+1) /\ + cc_gg3b_v9 cc 0 = cc_gg3b_v9 cc' x + cc_gg3b_v9 cc' (x+1) /\ + (!i. i IN 1..n - 1 ==> cc_azim_v9 cc i = cc_azim_v9 cc' (x + 1 +i)) /\ + (!i. i IN 1..n - 1 ==> cc_gg_v9 cc i = cc_gg_v9 cc' (x + 1 +i)) /\ + (!i. i IN 1..n - 1 ==> cc_gg3a_v9 cc i = cc_gg3a_v9 cc' (x + 1 +i)) /\ + (!i. i IN 1..n - 1 ==> cc_gg3b_v9 cc i = cc_gg3b_v9 cc' (x + 1 +i)) /\ + cc_subcrit_v9 cc 0 = cc_subcrit_v9 cc' x /\ + cc_crit_v9 cc 0 = cc_crit_v9 cc' x /\ + cc_supercrit_v9 cc 0 = cc_supercrit_v9 cc' x /\ + cc_small_v9 cc 0 = cc_small_v9 cc' x /\ + cc_small_eta_v9 cc 0 = cc_small_eta_v9 cc' x /\ + cc_4cell_v9 cc 0 = cc_4cell_v9 cc' x /\ + (!i. i IN 1..n - 1 ==> cc_subcrit_v9 cc i = cc_subcrit_v9 cc' (x + 1 +i)) /\ + (!i. i IN 1..n - 1 ==> cc_crit_v9 cc i = cc_crit_v9 cc' (x + 1 +i)) /\ + (!i. i IN 1..n - 1 ==> cc_supercrit_v9 cc i = cc_supercrit_v9 cc' (x + 1 +i)) /\ + (!i. i IN 1..n - 1 ==> cc_small_v9 cc i = cc_small_v9 cc' (x + 1 +i)) /\ + (!i. i IN 1..n - 1 ==> cc_small_eta_v9 cc i = cc_small_eta_v9 cc' (x + 1 +i)) /\ + (!i. i IN 1..n - 1 ==> cc_4cell_v9 cc i = cc_4cell_v9 cc' (x + 1 +i)) + ==> cc_real_model_v9 cc`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC cc_real_model_simple; + EXISTS_TAC `n:num`; + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `periodic (cc_subcrit_v9 cc) n /\ periodic (cc_crit_v9 cc) n /\ periodic (cc_supercrit_v9 cc) n /\ periodic (cc_small_v9 cc) n /\ periodic (cc_small_eta_v9 cc) n /\ periodic (cc_4cell_v9 cc) n` MP_TAC; + REPEAT (FIRST_X_ASSUM_ST `cc_bool_model_v9` MP_TAC); + EXPAND_TAC "n"; + BY(MESON_TAC[cc_bool_model_v9]); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `periodic (cc_hassmall_v9 cc) n /\ periodic (cc_qu_v9 cc) n /\ periodic (cc_qx_v9 cc) n /\ periodic (cc_qy_v9 cc) n ` MP_TAC; + EXPAND_TAC "n"; + MATCH_MP_TAC periodic_fn; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `cc_qy_v9 cc 0` ASSUME_TAC; + ASM_REWRITE_TAC[cc_qy_v9]; + BY(ASM_REWRITE_TAC[GSYM cc_qy_v9]); + SUBGOAL_THEN `(n = 4 /\ (?i. cc_4cell_v9 cc i /\ cc_crit_v9 cc i /\ cc_qu_v9 cc (i + 1) /\ cc_qu_v9 cc (i + 2) /\ cc_qu_v9 cc (i + 3))) <=> F` (unlist REWRITE_TAC); + BY(ASM_MESON_TAC[CASE_3Q1H]); + SUBGOAL_THEN `sum (0..n - 1) (cc_azim_v9 cc) = &2 * pi` (unlist REWRITE_TAC); + INTRO_TAC (cc_cut_sum) [`cc_azim_v9 cc'`;`x:num`]; + DISCH_THEN GMATCH_SIMP_TAC; + ASM_SIMP_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `cc_real_model_v9` MP_TAC); + FIRST_X_ASSUM_ST `cc_card_v9` MP_TAC; + COPY_TAC; + DISCH_THEN (SUBST1_TAC o GSYM); + REWRITE_TAC[cc_real_model_v9]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `n = cc_card_v9 cc' - 1` SUBST1_TAC; + FIRST_X_ASSUM_ST `~(n=0)` MP_TAC; + REPEAT (FIRST_X_ASSUM_ST `cc_card_v9` MP_TAC); + BY(ARITH_TAC); + BY(ASM_REWRITE_TAC[]); + COMMENT "done with exceptional conjuncts"; + SUBGOAL_THEN `!i. i IN 0..n-1 <=> (i=0 \/ i IN 1..n-1)` (unlist REWRITE_TAC); + REWRITE_TAC[IN_NUMSEG]; + BY(ARITH_TAC); + CONJ_TAC THEN REPEAT WEAK_STRIP_TAC THEN ASM_SIMP_TAC[cc_real_model_v9]; + ENOUGH_TO_SHOW_TAC `#0.606 <= cc_azim_v9 cc' x /\ #0.606 <= cc_azim_v9 cc' (x+1)`; + BY(REAL_ARITH_TAC); + REPEAT (FIRST_X_ASSUM_ST `cc_real_model_v9` MP_TAC); + BY(REWRITE_TAC[cc_real_model_v9] THEN DISCH_THEN (unlist REWRITE_TAC)); + REPEAT (FIRST_X_ASSUM_ST `cc_real_model_v9` MP_TAC); + BY(REWRITE_TAC[cc_real_model_v9] THEN DISCH_THEN (unlist REWRITE_TAC)); + SUBGOAL_THEN `~cc_4cell_v9 cc 0 /\ ~cc_qu_v9 cc 0 /\ ~cc_qx_v9 cc 0 /\ ~cc_4cell_v9 cc' x /\ ~cc_qu_v9 cc' x /\ ~cc_qx_v9 cc' x` MP_TAC; + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[cc_qy_v9;cc_qu_v9;cc_qx_v9]; + BY(MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `(!i. i = 0 \/ i IN 1..n - 1 ==> cc_4cell_v9 cc i ==> cc_azim_v9 cc i < #2.8) /\ (!i. i = 0 \/ i IN 1..n - 1 ==> cc_qu_v9 cc i ==> --cc_eps <= cc_gg_v9 cc i) /\ (!i. i = 0 \/ i IN 1..n - 1 ==> cc_qu_v9 cc i /\ ~cc_small_eta_v9 cc i ==> cc_eps <= cc_gg_v9 cc i) /\ (!i. i = 0 \/ i IN 1..n - 1 ==> cc_4cell_v9 cc i ==> a_spine5 + b_spine5 * cc_azim_v9 cc i <= cc_gg_v9 cc i) /\ (!i. i = 0 \/ i IN 1..n - 1 ==> cc_qu_v9 cc i ==> -- #0.0659 + #0.042 * cc_azim_v9 cc i <= cc_gg_v9 cc i) /\ (!i. i = 0 \/ i IN 1..n - 1 ==> cc_qu_v9 cc i ==> -- #0.0142852 + #0.00609451 * cc_azim_v9 cc i <= cc_gg_v9 cc i) /\ (!i. i = 0 \/ i IN 1..n - 1 ==> cc_qu_v9 cc i ==> #0.161517 - #0.119482 * cc_azim_v9 cc i <= cc_gg_v9 cc i) /\ (!i. i = 0 \/ i IN 1..n - 1 ==> cc_qx_v9 cc i ==> #0.0 <= cc_gg_v9 cc i) /\ (!i. i = 0 \/ i IN 1..n - 1 ==> cc_qx_v9 cc i /\ #2.3 < cc_azim_v9 cc i ==> cc_eps <= cc_gg_v9 cc i)` (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `cc_real_model_v9` MP_TAC; + REWRITE_TAC[cc_real_model_v9]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[MESON[] `((!i. p i ) /\ (!i. q i)) <=> (!i. p i /\ q i)`]; + GEN_TAC; + ASM_CASES_TAC `i = 0`; + BY(ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[]); +comment "unfinished, to here"; + (* +repeat conj then st/r then asimp[cc_real_model_v9] +rep 5 (fxa mp) then mt[] +fxast `cc_real_model_v9` mp +rt[cc_real_model_v9] +dthen (unlist amt) +rep 5 (fxa mp) then mt[] +fxast `cc_real_model_v9` mp +rt[cc_real_model_v9] + *) + ]);; + (* }}} *) +*) + +(* +g XSBYGIQ_concl;; + +let XSBYGIQ = prove_by_refinement( + XSBYGIQ_concl, + (* {{{ proof *) + [ + GOAL_TERM (fun w -> (ABBREV_TAC ( env w `bad_set = \cc. {i | i IN 0..(cc_card_v9 cc - 1) /\ cc_qy_v9 cc i /\ cc_qy_v9 cc (i+1) }`))); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!cc. FINITE (bad_set cc)`) ASSUME_TAC)); + GEN_TAC; + EXPAND_TAC "bad_set"; + MATCH_MP_TAC FINITE_SUBSET; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `0.. cc_card_v9 cc - 1`))); + REWRITE_TAC[FINITE_NUMSEG;SUBSET]; + REWRITE_TAC[IN_ELIM_THM]; + BY(MESON_TAC[]); + COMMENT "set up induction"; + REPEAT WEAK_STRIP_TAC; + PROOF_BY_CONTR_TAC; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `(!k. (!cc. (bad_set cc) HAS_SIZE k ==> ~( cc_bool_model_v9 cc /\ cc_real_model_v9 cc /\ sum (0..cc_card_v9 cc - 1) (cc_gg_v9 cc) < &0)))`))); + DISCH_THEN (C INTRO_TAC [`CARD(bad_set cc)`;`cc`]); + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[HAS_SIZE]); + INDUCT_TAC; + GEN_TAC; + REWRITE_TAC[HAS_SIZE_0]; + EXPAND_TAC "bad_set"; + ONCE_REWRITE_TAC[EXTENSION]; + REWRITE_TAC[IN_ELIM_THM;NOT_IN_EMPTY]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `?` MP_TAC; + REWRITE_TAC[]; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `cc'`))); + ASM_REWRITE_TAC[]; + REWRITE_TAC[cc_bool_prep_v9]; + GEN_TAC; + SUBGOAL_THEN `~(cc_card_v9 cc' = 0)` ASSUME_TAC; + BY(ASM_MESON_TAC[cc_bool_model_v9]); + ABBREV_TAC `x = i MOD cc_card_v9 cc'`; + FIRST_X_ASSUM_ST `cc_qy_v9` (C INTRO_TAC [`x`]); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `~` MP_TAC; + REWRITE_TAC[]; + EXPAND_TAC "x"; + GMATCH_SIMP_TAC MOD_IN_NUMSEG; + ASM_REWRITE_TAC[]; + INTRO_TAC periodic_fn [`cc'`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + CONJ_TAC; + EXPAND_TAC "x"; + GMATCH_SIMP_TAC (GSYM periodic_mod); + BY(ASM_REWRITE_TAC[]); + EXPAND_TAC "x"; + SUBGOAL_THEN `cc_qy_v9 cc' ((i DIV cc_card_v9 cc') * cc_card_v9 cc' + (i MOD cc_card_v9 cc' + 1))` MP_TAC; + INTRO_TAC (GSYM DIVISION) [`i`;`cc_card_v9 cc'`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `i DIV cc_card_v9 cc' * cc_card_v9 cc' + x + 1 = i + 1` SUBST1_TAC; + BY(FIRST_X_ASSUM_ST `DIV` MP_TAC THEN ARITH_TAC); + BY(ASM_REWRITE_TAC[]); + SUBST1_TAC (arith `i DIV cc_card_v9 cc' * cc_card_v9 cc' + i MOD cc_card_v9 cc' + 1 = (i MOD cc_card_v9 cc' + 1) + i DIV cc_card_v9 cc' * cc_card_v9 cc'`); + GMATCH_SIMP_TAC periodic_nk; + BY(ASM_SIMP_TAC[arith `~(n=0) ==> (0 < n)`]); + COMMENT "base case of induction completed, now induct step"; + REPEAT WEAK_STRIP_TAC; + COMMENT "pick element in bad set"; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `?x. x IN bad_set cc'`) MP_TAC)); + REWRITE_TAC[MEMBER_NOT_EMPTY]; + REWRITE_TAC[GSYM HAS_SIZE_0]; + FIRST_X_ASSUM_ST `SUC` MP_TAC; + REWRITE_TAC[HAS_SIZE]; + DISCH_THEN (unlist REWRITE_TAC); + BY(ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + COMMENT "construct reduced cc"; + ABBREV_TAC `n = cc_card_v9 cc' - 1`; + ABBREV_TAC `cutr = \ (f:num->real) j. if (0 = j MOD n) then f x + f (x+1) else f (x + 1 + (j MOD n))`; + ABBREV_TAC `cutb = \ (g:num->bool) j. if (0 = j MOD n) then g x else g (x + 1 + (j MOD n))`; + INTRO_TAC CC_EXISTS [`cutr (cc_azim_v9 cc')`;`cutr (cc_gg_v9 cc')`;`cutr (cc_gg3a_v9 cc')`;`cutr (cc_gg3b_v9 cc')`;`cutb (cc_subcrit_v9 cc')`;`cutb (cc_crit_v9 cc')`;`cutb (cc_supercrit_v9 cc')`;`cutb (cc_small_v9 cc')`;`cutb (cc_small_eta_v9 cc')`;`cutb (cc_4cell_v9 cc')`;`n`]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPEC ( env w `cc''`))))); + REWRITE_TAC[TAUT (`((x ==> ~y) ==> F) <=> x /\ y`)]; + COMMENT "size of n"; + SUBGOAL_THEN `~(cc_card_v9 cc'' = 0)` ASSUME_TAC; + INTRO_TAC CC_CARD2 [`cc'`]; + ASM_REWRITE_TAC[]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + COMMENT "periodicity"; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!f. periodic (cutr f) n`) ASSUME_TAC)); + REWRITE_TAC[periodic]; + EXPAND_TAC "cutr"; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN ` (i + n) MOD n = i MOD n` SUBST1_TAC; + BY(MESON_TAC[MOD_MULT_ADD;arith `(i + n) = (1 * n + i)`]); + BY(MESON_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!g. periodic (cutb g) n`) ASSUME_TAC)); + REWRITE_TAC[periodic]; + EXPAND_TAC "cutb"; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN ` (i + n) MOD n = i MOD n` SUBST1_TAC; + BY(MESON_TAC[MOD_MULT_ADD;arith `(i + n) = (1 * n + i)`]); + BY(MESON_TAC[]); + (COMMENT "bad_set"); + SUBGOAL_THEN `BIJ (\j. j+ (x + 1)) (1..(n-1)) ((x+2)..(x+n))` ASSUME_TAC; + REWRITE_TAC[BIJ;INJ]; + SUBCONJ_TAC; + REWRITE_TAC[IN_NUMSEG]; + BY(ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[SURJ]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[IN_NUMSEG]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `x' - (x + 1)`))); + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); + BY(ARITH_TAC); + SUBGOAL_THEN `1 <= n` ASSUME_TAC; + INTRO_TAC (CC_CARD2) [`cc'`]; + ASM_REWRITE_TAC[]; + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `x - 1` MP_TAC); + BY(ARITH_TAC); + SUBGOAL_THEN `!i. i IN 1..(n-1) ==> i MOD n = i` ASSUME_TAC; + REWRITE_TAC[IN_NUMSEG]; + GEN_TAC; + INTRO_TAC MOD_LT [`i`;`n`]; + BY(ARITH_TAC); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!f. cutr f 0 = (f:num->real) x + f (x + 1)`) ASSUME_TAC)); + EXPAND_TAC "cutr"; + GMATCH_SIMP_TAC MOD_0; + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); + BY(ARITH_TAC); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!g. cutb g 0 = (g:num->bool) x `) ASSUME_TAC)); + EXPAND_TAC "cutb"; + GMATCH_SIMP_TAC MOD_0; + REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC); + BY(ARITH_TAC); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!i f. i IN 1..(n-1) ==> cutr f i = f (x + 1 + i)`) ASSUME_TAC)); + REPEAT WEAK_STRIP_TAC; + EXPAND_TAC "cutr"; + GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o ISPEC ( env w `i`)))); + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + COND_CASES_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[IN_NUMSEG]; + BY(ARITH_TAC); + BY(REWRITE_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!i g. i IN 1..(n-1) ==> cutb g i = g (x + 1 + i)`) ASSUME_TAC)); + REPEAT WEAK_STRIP_TAC; + EXPAND_TAC "cutb"; + GOAL_TERM (fun w -> (FIRST_X_ASSUM_ST `MOD` (MP_TAC o ISPEC ( env w `i`)))); + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + COND_CASES_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[IN_NUMSEG]; + BY(ARITH_TAC); + BY(REWRITE_TAC[]); + (COMMENT " NOT FINISHED TO HERE, 4 CONJUNCTS TO GO. ") +(* NOT FINISHED *) + ]);; + (* }}} *) +*) + + + + + + + + + diff --git a/legacy/oldpacking/ky_packing/EMNWUUS.hl b/legacy/oldpacking/ky_packing/EMNWUUS.hl new file mode 100644 index 0000000..3d19d42 --- /dev/null +++ b/legacy/oldpacking/ky_packing/EMNWUUS.hl @@ -0,0 +1,494 @@ + +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: EMNWUUS *) +(* Chaper : Packing (Marchal Cells) *) +(* Date : October 3, 2010 *) +(* *) +(* ========================================================================= *) + +(* About this lemma: + +! I have proved EMNWUUS1. +! In part EMNWUUS2, I have prove the implication part (==>) +! and haven't done the ! Inverse part (<==). +! So the only thing to do with this lemma is to prove the following : +! +! `mcell0 V ul = {} /\ mcell1 V ul = {} /\ mcell2 V ul = {} /\ mcell3 V ul = {} +! ==> hl ul < sqrt (&2)` +*) + +(* ========================================================================= *) +(* FILES NEED TO BE LOADED *) +(* ========================================================================= *) + +flyspeck_needs "nonlinear/vukhacky_tactics.hl";; +flyspeck_needs "packing/pack_defs.hl";; +flyspeck_needs "packing/pack_concl.hl";; +flyspeck_needs "packing/pack1.hl";; + +module EMNWUUS = struct + +(* dmtcp: needs "flyspeck_load.hl";; *) + + + +open Pack_defs;; +open Pack_concl;; +open Vukhacky_tactics;; +open Pack1;; + +needs "marchal_cells.hl";; + +(* ============== Axioms in previous parts ===================================*) + +let XNHPWAB1 = new_axiom XNHPWAB1_concl;; + +let XNHPWAB4 = new_axiom XNHPWAB4_concl;; + +let WAUFCHE1 = new_axiom WAUFCHE1_concl;; + +let WAUFCHE2 = new_axiom WAUFCHE2_concl;; + +let OAPVION2 = new_axiom OAPVION2_concl;; + +let MHFTTZN1 = new_axiom MHFTTZN1_concl;; + +let MHFTTZN4 = new_axiom MHFTTZN4_concl;; + +(* ========================================================================= *) + +let EMNWUUS1 = prove_by_refinement ( EMNWUUS1_concl, +[ (REWRITE_TAC[mcell4] THEN REPEAT STRIP_TAC THEN EQ_TAC THEN COND_CASES_TAC); + (REPEAT STRIP_TAC); + (NEW_GOAL `set_of_list (ul:(real^3)list) = {}`); + (ASM_MESON_TAC[CONVEX_HULL_EQ_EMPTY]); + (NEW_GOAL `ul:(real^3)list = []`); + (NEW_GOAL `~(?h t. ul:(real^3)list = CONS h t)`); + STRIP_TAC; + (NEW_GOAL `(h:real^3) IN set_of_list ul`); + (REWRITE_TAC [ASSUME `ul = CONS (h:real^3) t`; IN_SET_OF_LIST;MEM]); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[list_CASES]); + (UNDISCH_TAC `barV V 3 (ul:(real^3)list)`); + (REWRITE_TAC[BARV]); + STRIP_TAC; + (NEW_GOAL `LENGTH (ul:(real^3)list) = 0`); + (ASM_MESON_TAC[ASSUME `ul:(real^3)list =[]`;LENGTH]); + (ASM_ARITH_TAC); + (MESON_TAC[]); + (MESON_TAC[]); + (MESON_TAC[]) ]);; + + +(* ========================================================================= *) + +g EMNWUUS2_concl;; +e (REPEAT GEN_TAC THEN STRIP_TAC);; +(* ! Note: The inverse part of this lemma has not been Done *) + +e (EQ_TAC);; + +e (REPEAT STRIP_TAC);; +(* Break into 4 cases *) + +(* =============== Case 1 ================================ *) (* OK *) + +e (REWRITE_TAC[mcell0]);; +e (REWRITE_TAC[SET_RULE `x DIFF y = {} <=> (!a. a IN x ==> a IN y)`]);; +e (REWRITE_TAC[ROGERS;IMAGE;IN;ball;SUBSET;IN_ELIM_THM]);; +e GEN_TAC;; +e (MATCH_MP_TAC BALL_CONVEX_HULL_LEMMA);; + +e (GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM]);; +e (STRIP_TAC);; + + (* New_subgoal 1.1 *) +e (NEW_GOAL `hl (truncate_simplex x' (ul:(real^3)list)) + <= hl (truncate_simplex (LENGTH ul - 1) ul)`);; +e (ASM_CASES_TAC `x' < LENGTH (ul:(real^3)list) - 1`);; +e (MATCH_MP_TAC (REAL_ARITH `a < b ==> a <= b`));; +e (NEW_GOAL `x' < (LENGTH (ul:(real^3)list) - 1) /\ LENGTH ul - 1 <= 3`);; +e (ASM_REWRITE_TAC[] THEN UNDISCH_TAC `barV V 3 ul`);; +e (REWRITE_TAC[BARV] THEN ARITH_TAC);; +e (UP_ASM_TAC);; +e (NEW_GOAL `ul IN barV V 3`);; +e (ASM_MESON_TAC[IN]);; +e (ASM_MESON_TAC[XNHPWAB4; ARITH_RULE `3 <= 3`]);; +e (MATCH_MP_TAC (REAL_ARITH `a = b ==> a <= b`));; +e (REWRITE_WITH `LENGTH (ul:(real^3)list) - 1 = x'`);; +e (ASM_ARITH_TAC);; + (* End subgoal 1.1 *) + + (* New subgoal 1.2 *) +e (NEW_GOAL `hl (truncate_simplex (LENGTH ul - 1) ul) = hl (ul:(real^3)list)`);; +e (AP_TERM_TAC);; +e (REWRITE_TAC[TRUNCATE_SIMPLEX]);; +e (MATCH_MP_TAC SELECT_UNIQUE);; +e (GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM;INITIAL_SUBLIST] THEN EQ_TAC);; +e STRIP_TAC;; +e (NEW_GOAL `LENGTH (ul:(real^3)list) = + LENGTH (y:(real^3)list) + LENGTH (yl:(real^3)list)`);; +e (ASM_MESON_TAC[LENGTH_APPEND]);; +e (NEW_GOAL `LENGTH (yl:(real^3)list) = 0`);; +e (ASM_ARITH_TAC);; +e (NEW_GOAL `(yl:(real^3)list) = []`);; +e (ASM_MESON_TAC[LENGTH_EQ_NIL]);; +e (ASM_MESON_TAC[APPEND_NIL]);; +e (REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ASM_ARITH_TAC);; +e (EXISTS_TAC `[]:(real^3)list`);; +e (ASM_MESON_TAC[APPEND_NIL]);; + (* End subgoal 1.2 *) + + (* New subgoal 1.3 *) + +e (NEW_GOAL `?u0 u1 u2 u3:real^3. ul = [u0;u1;u2;u3]`);; +e (ASM_MESON_TAC[BARV_3_EXPLICIT]);; +e (REPEAT (FIRST_X_ASSUM CHOOSE_TAC));; +e (REWRITE_TAC[ASSUME `ul = [u0:real^3; u1; u2; u3]`; HD]);; + + (* ---------------------------------------------- *) + (* Consider case x' = 0 *) + +e (ASM_CASES_TAC `x' = 0`);; +e (REWRITE_WITH `x:real^3 = u0`);; +e (MP_TAC (ASSUME `x:real^3 = omega_list_n V ul x'`));; +e (ASM_MESON_TAC[OMEGA_LIST_0_EXPLICIT; GSYM IN]);; +e (ASM_REWRITE_TAC[DIST_REFL]);; +e (MESON_TAC[SQRT_LT_0;REAL_ARITH `&0 <= &2 /\ &0 < &2`]);; + + (* ---------------------------------------------- *) + (* Consider case x' = 1 *) + +e (ASM_CASES_TAC `x' = 1`);; +e (REWRITE_WITH `x:real^3 = circumcenter {u0, u1}`);; +e (MP_TAC (ASSUME `x:real^3 = omega_list_n V ul x'`));; +e (ASM_MESON_TAC[OMEGA_LIST_1_EXPLICIT; GSYM IN]);; +e (ONCE_REWRITE_TAC[DIST_SYM]);; +e (REWRITE_WITH `dist (circumcenter {u0:real^3, u1},u0) + = hl (truncate_simplex x' (ul:(real^3)list))`);; +e (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1;HL;radV]);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC SELECT_UNIQUE);; +e (GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM; MESON[set_of_list] + `set_of_list [u0:real^3;u1] = {u0, u1}`] THEN EQ_TAC);; +e (DISCH_TAC THEN (FIRST_ASSUM MATCH_MP_TAC));; +e (SET_TAC[]);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `w IN {u0,u1:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (NEW_GOAL + `(!w. w IN {u0,u1:real^3} ==> radV {u0,u1} = dist (circumcenter {u0,u1},w))`);; +e (MATCH_MP_TAC OAPVION2);; +e (REWRITE_TAC[AFFINE_INDEPENDENT_2]);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `(radV {u0,u1:real^3} = dist (circumcenter {u0,u1},w))`);; +e (ASM_SIMP_TAC[]);; +e (NEW_GOAL `(radV {u0,u1:real^3} = dist (circumcenter {u0,u1},u0))`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (SET_TAC[]);; +e (ASM_MESON_TAC[]);; +e (ASM_REAL_ARITH_TAC);; + + (* ---------------------------------------------- *) + (* Consider case x' = 2 *) + +e (ASM_CASES_TAC `x' = 2`);; +e (REWRITE_WITH `x:real^3 = circumcenter {u0, u1, u2}`);; +e (MP_TAC (ASSUME `x:real^3 = omega_list_n V ul x'`));; +e (ASM_MESON_TAC[OMEGA_LIST_2_EXPLICIT; GSYM IN]);; +e (ONCE_REWRITE_TAC[DIST_SYM]);; +e (REWRITE_WITH `dist (circumcenter {u0:real^3, u1, u2},u0) + = hl (truncate_simplex x' (ul:(real^3)list))`);; +e (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2;HL;radV]);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC SELECT_UNIQUE);; +e (GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM; MESON[set_of_list] + `set_of_list [u0:real^3;u1;u2] = {u0, u1, u2}`] THEN EQ_TAC);; +e (DISCH_TAC THEN (FIRST_ASSUM MATCH_MP_TAC));; +e (SET_TAC[]);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `w IN {u0,u1:real^3,u2}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (NEW_GOAL `(!w. w IN {u0,u1:real^3, u2} ==> + radV {u0,u1,u2} = dist (circumcenter {u0,u1,u2},w))`);; +e (MATCH_MP_TAC OAPVION2);; +e (MATCH_MP_TAC AFFINE_INDEPENDENT_SUBSET);; +e (EXISTS_TAC `{u0, u1, u2, u3:real^3}`);; +e (REWRITE_TAC[SET_RULE `{a, b:A, c} SUBSET {a, b , c, d:A}`]);; +e (REWRITE_TAC[AFFINE_INDEPENDENT_IFF_CARD]);; +e STRIP_TAC;; +e (REWRITE_TAC[FINITE_SET_OF_LIST; MESON[set_of_list] + `{u0, u1, u2,u3} = set_of_list [u0;u1;u2:real^3;u3]`]);; +e (NEW_GOAL `aff_dim {u0,u1,u2,u3:real^3} = &3`);; +e (REWRITE_TAC[MESON[set_of_list] + `{u0, u1, u2,u3} = set_of_list [u0;u1;u2:real^3;u3]`]);; +e (MATCH_MP_TAC MHFTTZN1);; +e (EXISTS_TAC `V:real^3->bool`);; +e (ASM_MESON_TAC[ARITH_RULE `3 <= 3`]);; +e (ONCE_ASM_REWRITE_TAC[]);; +e (NEW_GOAL `FINITE {u1, u2, u3:real^3}`);; +e (REWRITE_TAC[FINITE_SET_OF_LIST; MESON[set_of_list] + `{u1, u2,u3} = set_of_list [u1;u2:real^3;u3]`]);; +e (MATCH_MP_TAC (ARITH_RULE + `(a = int_of_num 4) ==> (int_of_num 3 = a - int_of_num 1)`));; +e (MATCH_MP_TAC (ARITH_RULE `a = b ==> int_of_num a = int_of_num b`));; +e (NEW_GOAL `CARD {u0:real^3, u1, u2, u3} = + (if u0 IN {u1, u2, u3} then CARD {u1, u2, u3} + else SUC (CARD {u1, u2, u3} ))`);; +e (UP_ASM_TAC THEN REWRITE_TAC[CARD_CLAUSES]);; +e (UP_ASM_TAC THEN COND_CASES_TAC);; +e (DISCH_TAC);; +e (NEW_GOAL `aff_dim {u0:real^3, u1, u2, u3} < &3`);; +e (REWRITE_WITH `{u0,u1,u2,u3:real^3} = {u1, u2,u3}`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (NEW_GOAL `CARD {u1, u2, u3} = CARD {u0, u1, u2, u3} <=> + {u1, u2, u3:real^3} = {u0, u1, u2, u3}`);; +e (MATCH_MP_TAC SUBSET_CARD_EQ);; +e (STRIP_TAC);; +e (REWRITE_TAC[MESON[set_of_list] + `{u0, u1, u2, u3:real^3} = set_of_list [u0;u1;u2;u3]`;FINITE_SET_OF_LIST]);; +e (SET_TAC[]);; +e (ASM_MESON_TAC[]);; + +e (REWRITE_TAC[MESON[set_of_list] + `{u1:real^3,u2, u3} = set_of_list [u1;u2;u3]`]);; +e (MATCH_MP_TAC AFF_DIM_LE_LENGTH);; +e (REWRITE_TAC[LENGTH]);; +e (ARITH_TAC);; +e (NEW_GOAL `F`);; +e (ASM_MESON_TAC[ARITH_RULE `a = int_of_num 3 /\ a < int_of_num 3 ==> F`]);; +e (ASM_MESON_TAC[]);; +e STRIP_TAC;; +e (NEW_GOAL `CARD {u1:real^3, u2, u3} = 3`);; +e (NEW_GOAL `CARD {u1,u2,u3:real^3} <= 3`);; +e (MATCH_MP_TAC (ARITH_RULE + `a <= LENGTH [u1;u2;u3:real^3] /\ LENGTH [u1;u2;u3:real^3] <= b ==> a <= b`));; +e STRIP_TAC;; +e (REWRITE_TAC[MESON[set_of_list] + `{u1,u2,u3:real^3} = set_of_list [u1;u2;u3]`;CARD_SET_OF_LIST_LE]);; +e (REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (ASM_CASES_TAC `CARD {u1:real^3, u2, u3} <= 2`);; +e (NEW_GOAL `CARD {u0,u1,u2,u3:real^3} <= 3`);; +e (NEW_GOAL `CARD {u0:real^3, u1, u2, u3} = + (if u0 IN {u1,u2,u3} then CARD {u1,u2,u3} else SUC (CARD {u1,u2,u3}))`);; +e (NEW_GOAL `FINITE {u1,u2,u3:real^3}`);; +e (REWRITE_TAC[MESON[set_of_list] + `{u1,u2,u3:real^3} = set_of_list [u1;u2;u3]`;FINITE_SET_OF_LIST]);; +e (ASM_REWRITE_TAC[CARD_CLAUSES]);; +e (UP_ASM_TAC THEN COND_CASES_TAC);; +e (ASM_ARITH_TAC);; +e (ASM_ARITH_TAC);; +e (ABBREV_TAC `xl = list_of_set {u0, u1, u2, u3:real^3}`);; + + +e (NEW_GOAL `aff_dim {u0:real^3, u1, u2, u3} + < int_of_num (CARD {u0, u1, u2, u3})`);; +e (REWRITE_WITH `{u0,u1,u2,u3:real^3} = set_of_list (xl:(real^3)list)`);; +e (EXPAND_TAC "xl");; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC SET_OF_LIST_OF_SET);; +e (REWRITE_TAC[MESON[set_of_list] + `{u0, u1, u2, u3:real^3} = set_of_list [u0;u1;u2;u3]`;FINITE_SET_OF_LIST]);; +e (MATCH_MP_TAC AFF_DIM_LE_LENGTH);; +e (REWRITE_WITH `set_of_list (xl:(real^3)list) = {u0, u1, u2, u3:real^3}`);; +e (EXPAND_TAC "xl");; +e (MATCH_MP_TAC SET_OF_LIST_OF_SET);; +e (REWRITE_TAC[MESON[set_of_list] + `{u0,u1,u2,u3:real^3} = set_of_list [u0;u1;u2;u3]`;FINITE_SET_OF_LIST]);; +e (EXPAND_TAC "xl");; +e (MATCH_MP_TAC LENGTH_LIST_OF_SET);; +e (REWRITE_TAC[MESON[set_of_list] + `{u0,u1,u2,u3:real^3} = set_of_list [u0;u1;u2;u3]`;FINITE_SET_OF_LIST]);; +e (NEW_GOAL `F`);; +e (ASM_ARITH_TAC);; +e (ASM_MESON_TAC[]);; +e (ASM_ARITH_TAC);; +e ASM_ARITH_TAC;; +e (MATCH_MP_TAC (REAL_ARITH + `radV {u0,u1,u2:real^3} = a /\ radV {u0,u1,u2} = b ==> a = b`));; +e STRIP_TAC;; +e (ASM_REWRITE_TAC[]);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (SET_TAC[]);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REAL_ARITH_TAC);; + + (* ---------------------------------------------- *) + (* Consider case x' = 3 *) + +e (ASM_CASES_TAC `x' = 3`);; +e (REWRITE_WITH `x = circumcenter {u0,u1,u2,u3:real^3}`);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC OMEGA_LIST_3_EXPLICIT);; +e (ASM_MESON_TAC[GSYM IN]);; +e (NEW_GOAL `dist (u0,circumcenter {u0:real^3, u1, u2, u3}) + = hl (ul:(real^3)list)`);; +e (ASM_REWRITE_TAC[HL]);; +e (REWRITE_WITH `set_of_list [u0:real^3; u1; u2; u3] = {u0,u1,u2,u3}`);; +e (MESON_TAC[set_of_list]);; + + + +e (NEW_GOAL `(!w. w IN {u0,u1:real^3, u2,u3} ==> + radV {u0,u1,u2,u3} = dist (circumcenter {u0,u1,u2,u3},w))`);; +e (MATCH_MP_TAC OAPVION2);; +e (REWRITE_TAC[AFFINE_INDEPENDENT_IFF_CARD]);; +e STRIP_TAC;; +e (REWRITE_TAC[FINITE_SET_OF_LIST; MESON[set_of_list] + `{u0, u1, u2,u3} = set_of_list [u0;u1;u2:real^3;u3]`]);; +e (NEW_GOAL `aff_dim {u0,u1,u2,u3:real^3} = &3`);; +e (REWRITE_TAC[MESON[set_of_list] + `{u0, u1, u2,u3} = set_of_list [u0;u1;u2:real^3;u3]`]);; +e (MATCH_MP_TAC MHFTTZN1);; +e (EXISTS_TAC `V:real^3->bool`);; +e (ASM_MESON_TAC[ARITH_RULE `3 <= 3`]);; +e (ONCE_ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC (ARITH_RULE + `(a = int_of_num 4) ==> (int_of_num 3 = a - int_of_num 1)`));; +e (MATCH_MP_TAC (ARITH_RULE `a = b ==> int_of_num a = int_of_num b`));; + + +e (NEW_GOAL `FINITE {u1, u2, u3:real^3}`);; +e (REWRITE_TAC[FINITE_SET_OF_LIST; MESON[set_of_list] + `{u1, u2,u3} = set_of_list [u1;u2:real^3;u3]`]);; +e (NEW_GOAL `CARD {u0:real^3, u1, u2, u3} = + (if u0 IN {u1, u2, u3} then CARD {u1, u2, u3} + else SUC (CARD {u1, u2, u3} ))`);; +e (UP_ASM_TAC THEN REWRITE_TAC[CARD_CLAUSES]);; +e (UP_ASM_TAC THEN COND_CASES_TAC);; +e (DISCH_TAC);; +e (NEW_GOAL `aff_dim {u0:real^3, u1, u2, u3} < &3`);; +e (REWRITE_WITH `{u0,u1,u2,u3:real^3} = {u1, u2,u3}`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (NEW_GOAL `CARD {u1, u2, u3} = CARD {u0, u1, u2, u3} <=> + {u1, u2, u3:real^3} = {u0, u1, u2, u3}`);; +e (MATCH_MP_TAC SUBSET_CARD_EQ);; +e (STRIP_TAC);; +e (REWRITE_TAC[MESON[set_of_list] + `{u0, u1, u2, u3:real^3} = set_of_list [u0;u1;u2;u3]`;FINITE_SET_OF_LIST]);; +e (SET_TAC[]);; +e (ASM_MESON_TAC[]);; + +e (REWRITE_TAC[MESON[set_of_list] + `{u1:real^3,u2, u3} = set_of_list [u1;u2;u3]`]);; +e (MATCH_MP_TAC AFF_DIM_LE_LENGTH);; +e (REWRITE_TAC[LENGTH]);; +e (ARITH_TAC);; +e (NEW_GOAL `F`);; +e (ASM_MESON_TAC[ARITH_RULE `a = int_of_num 3 /\ a < int_of_num 3 ==> F`]);; +e (ASM_MESON_TAC[]);; +e STRIP_TAC;; +e (NEW_GOAL `CARD {u1:real^3, u2, u3} = 3`);; +e (NEW_GOAL `CARD {u1,u2,u3:real^3} <= 3`);; +e (MATCH_MP_TAC (ARITH_RULE + `a <= LENGTH [u1;u2;u3:real^3] /\ LENGTH [u1;u2;u3:real^3] <= b ==> a <= b`));; +e STRIP_TAC;; +e (REWRITE_TAC[MESON[set_of_list] + `{u1,u2,u3:real^3} = set_of_list [u1;u2;u3]`;CARD_SET_OF_LIST_LE]);; +e (REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (ASM_CASES_TAC `CARD {u1:real^3, u2, u3} <= 2`);; +e (NEW_GOAL `CARD {u0,u1,u2,u3:real^3} <= 3`);; +e (NEW_GOAL `CARD {u0:real^3, u1, u2, u3} = + (if u0 IN {u1,u2,u3} then CARD {u1,u2,u3} else SUC (CARD {u1,u2,u3}))`);; +e (NEW_GOAL `FINITE {u1,u2,u3:real^3}`);; +e (REWRITE_TAC[MESON[set_of_list] + `{u1,u2,u3:real^3} = set_of_list [u1;u2;u3]`;FINITE_SET_OF_LIST]);; +e (ASM_REWRITE_TAC[CARD_CLAUSES]);; +e (UP_ASM_TAC THEN COND_CASES_TAC);; +e (ASM_ARITH_TAC);; +e (ASM_ARITH_TAC);; +e (ABBREV_TAC `xl = list_of_set {u0, u1, u2, u3:real^3}`);; + + +e (NEW_GOAL `aff_dim {u0:real^3, u1, u2, u3} + < int_of_num (CARD {u0, u1, u2, u3})`);; +e (REWRITE_WITH `{u0,u1,u2,u3:real^3} = set_of_list (xl:(real^3)list)`);; +e (EXPAND_TAC "xl");; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC SET_OF_LIST_OF_SET);; +e (REWRITE_TAC[MESON[set_of_list] + `{u0, u1, u2, u3:real^3} = set_of_list [u0;u1;u2;u3]`;FINITE_SET_OF_LIST]);; +e (MATCH_MP_TAC AFF_DIM_LE_LENGTH);; +e (REWRITE_WITH `set_of_list (xl:(real^3)list) = {u0, u1, u2, u3:real^3}`);; +e (EXPAND_TAC "xl");; +e (MATCH_MP_TAC SET_OF_LIST_OF_SET);; +e (REWRITE_TAC[MESON[set_of_list] + `{u0,u1,u2,u3:real^3} = set_of_list [u0;u1;u2;u3]`;FINITE_SET_OF_LIST]);; +e (EXPAND_TAC "xl");; +e (MATCH_MP_TAC LENGTH_LIST_OF_SET);; +e (REWRITE_TAC[MESON[set_of_list] + `{u0,u1,u2,u3:real^3} = set_of_list [u0;u1;u2;u3]`;FINITE_SET_OF_LIST]);; +e (NEW_GOAL `F`);; +e (ASM_ARITH_TAC);; +e (ASM_MESON_TAC[]);; +e (ASM_ARITH_TAC);; +e ASM_ARITH_TAC;; +e (MATCH_MP_TAC (REAL_ARITH + `radV {u0,u1,u2:real^3,u3} = a /\ radV {u0,u1,u2,u3} = b ==> a = b`));; +e STRIP_TAC;; +e (ONCE_REWRITE_TAC[DIST_SYM] THEN FIRST_ASSUM MATCH_MP_TAC);; +e (SET_TAC[]);; +e (MESON_TAC[]);; + +e (ASM_MESON_TAC[]);; + +(* --------------------------------------------- *) + +e (UNDISCH_TAC `barV V 3 (ul:(real^3)list)`);; +e (REWRITE_TAC[BARV]);; +e (STRIP_TAC);; +e (NEW_GOAL `F`);; +e (ASM_ARITH_TAC);; +e (ASM_MESON_TAC[]);; + +(* +Here we have finished the first part `mcell0 V ul = {}`;there are 3 parts left: +mcell1 V ul = {} +mcell2 V ul = {} +mcell3 V ul = {} +*) + +(* =============== Case 2 =================================== *) ( Finished *) + +e (REWRITE_TAC[mcell1]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (REWRITE_TAC[]);; + +(* =============== Case 3 =================================== *) (* Finished *) + +e (REWRITE_TAC[mcell2]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (REWRITE_TAC[]);; + +(* =============== Case 4 =================================== *) ( Finished *) + +e (REWRITE_TAC[mcell3]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_MESON_TAC[]);; +e (MESON_TAC[]);; + + +(* =============== Reverse part =============================== *) + +(* .............................................................*) + + +(* ! Need to be done later ...................................... *) + +(* Good luck *) + +end;; diff --git a/legacy/oldpacking/ky_packing/UPFZBZM.hl b/legacy/oldpacking/ky_packing/UPFZBZM.hl new file mode 100644 index 0000000..ee2ba05 --- /dev/null +++ b/legacy/oldpacking/ky_packing/UPFZBZM.hl @@ -0,0 +1,847 @@ + +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: UPFZBZM *) +(* Chaper : Packing (Clusters) *) +(* Date : October 3, 2010 *) +(* *) +(* ========================================================================= *) + +(* ========================================================================= *) +(* FILES NEED TO BE LOADED *) +(* ========================================================================= *) + +(* dmtcp: needs "flyspeck_load.hl";; *) + +flyspeck_needs "nonlinear/vukhacky_tactics.hl";; +flyspeck_needs "packing/pack_defs.hl";; +flyspeck_needs "packing/pack_concl.hl";; +flyspeck_needs "packing/beta_pair_thm.hl";; +flyspeck_needs "packing/ky/UPFZBZM_support_lemmas.hl";; +(* Note that UPFZBZM_support_lemmas.hl also load a file including unproved + lemmas that need to be finished +*) + +module Upfzbzm = struct + +open Pack_defs;; +open Pack_concl;; +open Vukhacky_tactics;; + +(*-------------------------------------------------------------------------- *) + + let UPFZBZM_concl = + `!V. saturated V /\ packing V /\ cell_cluster_estimate V /\ + marchal_inequality /\ + lmfun_inequality V ==> + (?G. negligible_fun_0 G V /\ fcc_compatible G V)`;; + +(* ------------------------------------------------------------------------- *) + + + +(* ========================================================================= *) +(* THE THEOREM *) +(* ========================================================================= *) + +(* PART 1 OF THE LEMMA *) + +let FCC_COMPATABILITY_FUNC = prove_by_refinement ( + `!V. saturated V /\ packing V /\ cell_cluster_estimate V /\ + marchal_inequality /\ + lmfun_inequality V /\ G = (\u. --vol(voronoi_open V u) + + &8 * mm1 - &8 * mm2 * sum { v | v IN V /\ ~(u=v) /\ dist(u,v) <= &2*h0 } +(\v. lmfun (hl [u;v]))) +==> fcc_compatible G V`, + +[(REWRITE_TAC[lmfun_inequality;fcc_compatible]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[REAL_ARITH `a + --a + b - c = b - c`]); + (MATCH_MP_TAC (REAL_ARITH + `x = &8 * mm1 - &8 * (&12 * mm2) /\ y <= &8 * (&12 * mm2) ==> + x <= &8 * mm1 - y`)); + STRIP_TAC; + (REWRITE_TAC[SQRT_OF_32_lemma]); + (REWRITE_TAC[REAL_ARITH `a * b - a * c = a * (b - c)`]); + (REWRITE_TAC[m1_minus_12m2]); + (MATCH_MP_TAC REAL_LE_LMUL); + (REWRITE_TAC[REAL_ARITH `&0 <= &8`]); + (REWRITE_TAC[REAL_ARITH `&12 * mm2 = mm2 * &12`]); + (MATCH_MP_TAC REAL_LE_LMUL); + (REWRITE_TAC[ZERO_LE_MM2_LEMMA]); + (ASM_MESON_TAC[])]);; + + +(* ========================================================================= *) + + +(* ========================================================================= *) + +g `!V. saturated V /\ packing V /\ cell_cluster_estimate V /\ + marchal_inequality /\ + lmfun_inequality V /\ + G = (\u. --vol(voronoi_open V u) + + &8 * mm1 - &8 * mm2 * sum { v | v IN V /\ ~(u=v) /\ dist(u,v) <= &2*h0 } +(\v. lmfun (hl [u;v]))) +==> negligible_fun_0 G V`;; + +e (REWRITE_TAC[negligible_fun_0; negligible_fun_any_C]);; +e (REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; + +e (MP_TAC (SPEC `V:real^3->bool` KIZHLTL1));; +e (DISCH_THEN (LABEL_TAC "asm1"));; +e (USE_THEN "asm1" CHOOSE_TAC);; + +e (MP_TAC (SPEC `V:real^3->bool` KIZHLTL2));; +e (DISCH_THEN (LABEL_TAC "asm2"));; +e (USE_THEN "asm2" CHOOSE_TAC);; + +(* ! It appears that the constant used in KIZHLTL3 needs to be changed. *) +(* ! Rather than prove indirectly, better to directly prove the similar result for Lmfun, as in this adapted form of 'KIZHLTL3_concl' from 'packing/pack_concl.hl' +(so if KIZHLTL3_concl is just for Ky's lemma, then this needs to change) + +let KIZHLTL3_concl* = `!(V:real^3->bool) f. ?c. !r. saturated V /\ packing V /\ (&1 <= r) /\ + (?c1. !x. &2 <= x /\ x < sqrt(&8) ==> abs( f x) <= c1) + ==> + (( &8 * mm2 /pi)* + sum { X | X SUBSET ball(vec 0, r) /\ mcell_set V X } + ( \ X. sum (edgeX V X) ( \ {u,v}. (dihX V X (u ,v))*f (hl[u;v]))) + +c*r pow 2 <= + &8*mm2 * + sum (V INTER ball(vec 0,r)) + ( \u. sum { v | v IN V /\ ~(u=v) /\ dist(u,v) < sqrt(&8)} + ( \v. lmfun (hl [u;v]))))`;; + +( and the ?c from here becomes c'' in the proof below ) + +! instead of for F fun. The two have the same techinique: + +*) + +e (MP_TAC (SPEC `lmfun:real->real`(SPEC `V:real^3->bool` KIZHLTL3)));; +e (DISCH_THEN (LABEL_TAC "asm3"));; +e (USE_THEN "asm3" CHOOSE_TAC);; + +e (MP_TAC (SPEC `V:real^3->bool` SUM_GAMMAX_LMFUM_ESTIMATE));; +e (DISCH_THEN (LABEL_TAC "asm4"));; +e (USE_THEN "asm4" CHOOSE_TAC);; + +e (EXISTS_TAC `--(c + c' + c'' + c''')`);; + +e (GEN_TAC THEN DISCH_TAC);; +e (MP_TAC FINITE_PACK_LEMMA THEN DISCH_TAC);; + +e (REWRITE_WITH `sum (V INTER ball (vec 0,r)) + (\u. --vol (voronoi_open V u) + + &8 * mm1 - + &8 * + mm2 * + sum {v | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v]))) = +sum (V INTER ball (vec 0,r)) + (\u. --vol (voronoi_open V u)) + +sum (V INTER ball (vec 0,r)) + (\u. &8 * mm1 - &8 * + mm2 * + sum {v | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v])))`);; +e (MATCH_MP_TAC SUM_ADD);; +e (ASM_SIMP_TAC[]);; + +e (REWRITE_WITH `sum (V INTER ball (vec 0,r)) + (\u. &8 * mm1 - + &8 * + mm2 * + sum {v:real^3 | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v]))) = +sum (V INTER ball (vec 0,r)) + (\u. &8 * mm1) - +sum (V INTER ball (vec 0,r)) + (\u. &8 * + mm2 * + sum {v | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v])))`);; +e (MATCH_MP_TAC SUM_SUB);; +e (ASM_SIMP_TAC[]);; + +e (ASM_SIMP_TAC[SUM_NEG;SUM_CONST;SUM_LMUL]);; +e (MATCH_MP_TAC (REAL_ARITH `--A <= x - y + z ==> --x + y - z <= A `));; +e (REWRITE_TAC[REAL_ARITH `--(--x * y) = x * y`]);; + +e (ABBREV_TAC `T1' = sum (V INTER ball (vec 0,r)) (\u. vol (voronoi_open V u))`);; +e (ABBREV_TAC `T2' = &8 * &(CARD ((V:real^3 -> bool) INTER ball (vec 0,r))) * mm1`);; +e (ABBREV_TAC `T3' = &8 * + mm2 * sum (V INTER ball (vec 0,r)) + (\u. sum {v:real^3 | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v])))`);; + +e (ABBREV_TAC `B_0_r = {X | X SUBSET ball (vec 0, r) /\ mcell_set V X}`);; + +e (ABBREV_TAC `T1 = sum B_0_r vol`);; +e (ABBREV_TAC `T2 = --(&2 * mm1 / pi) * sum B_0_r (total_solid V)`);; +e (ABBREV_TAC `T3 = (&8 * mm2 / pi) * sum B_0_r (\X. sum (edgeX V X) + (\({u, v}). dihX V X (u,v) * lmfun (hl [u; v])))`);; + +e (MATCH_MP_TAC (REAL_ARITH + `T1 + c * r pow 2 <= T1' /\ + T2 + c' * r pow 2 <= -- T2' /\ + T3 + c'' * r pow 2 <= T3' /\ + c''' * r pow 2 <= T1 + T2 + T3 ==> + (c + c' + c'' + c''') * r pow 2 <= T1' - T2' + T3'`));; +e (REPEAT STRIP_TAC);; + +e (EXPAND_TAC "T1" THEN EXPAND_TAC "T1'");; +e (EXPAND_TAC "B_0_r");; +e (MP_TAC (ASSUME `!r. saturated V /\ packing V /\ &1 <= r + ==> sum {X | X SUBSET ball (vec 0,r) /\ mcell_set V X} vol + + c * r pow 2 <= + sum (V INTER ball (vec 0,r)) (\u. vol (voronoi_open V u))`));; +e (ASM_SIMP_TAC[]);; + +e (EXPAND_TAC "T2" THEN EXPAND_TAC "T2'");; +e (EXPAND_TAC "B_0_r");; +e (MATCH_MP_TAC(REAL_ARITH `t + z <= x * y ==> --x * y + z <= --t`));; +e (REWRITE_TAC[REAL_ARITH `a * b * c = b * a * c`]);; +e (MP_TAC (ASSUME `!r. saturated V /\ packing V /\ &1 <= r + ==> &(CARD (V INTER ball (vec 0,r))) * &8 * mm1 + c' * r pow 2 <= + (&2 * mm1 / pi) * + sum {X | X SUBSET ball (vec 0,r) /\ mcell_set V X} + (total_solid V)`));; +e (ASM_SIMP_TAC[]);; + + + +(* !!!!! This part may then become very easy (maybe little more than a rewrite) *) + +e (EXPAND_TAC "T3" THEN EXPAND_TAC "T3'");; +e (EXPAND_TAC "B_0_r");; +e (ABBREV_TAC `temp = &8 * mm2 * + sum ((V:real^3->bool) INTER ball (vec 0,r)) + (\u. sum {v | v IN V /\ ~(u = v) /\ dist (u,v) < sqrt (&8)} + (\v. lmfun (hl [u; v])))`);; + +e (MATCH_MP_TAC (REAL_ARITH `(a <= temp /\ temp <= b) ==> a <= b`));; +e STRIP_TAC;; + (* Break into 2 subgoals *) + (* First subgoal *) + + e (EXPAND_TAC "temp");; + e (MATCH_MP_TAC (ASSUME `!r. saturated V /\ + packing V /\ + &1 <= r /\ + (?c1. !x. &2 <= x /\ x < sqrt (&8) ==> abs (lmfun x) <= c1) + ==> (&8 * mm2 / pi) * + sum {X | (X:real^3 -> bool) SUBSET ball (vec 0,r) /\ mcell_set V X} + (\X. sum (edgeX V X) + (\({u, v}). dihX V X (u,v) * lmfun (hl [u; v]))) + + c'' * r pow 2 <= + &8 * + mm2 * + sum ((V:real^3->bool) INTER ball (vec 0,r)) + (\u. sum {v | v IN V /\ ~(u = v) /\ dist (u,v) < sqrt (&8)} + (\v. lmfun (hl [u; v])))`));; + + e (ASM_SIMP_TAC[]);; + e (EXISTS_TAC `&1`);; + e (GEN_TAC THEN DISCH_TAC);; + e (REWRITE_TAC[lmfun]);; + e (COND_CASES_TAC);; + e (UP_ASM_TAC THEN UP_ASM_TAC);; + e (REWRITE_TAC[h0]);; + e (MESON_TAC[REAL_ARITH `&2 <= x /\ x < sqrt (&8) ==> x <= #1.26 ==> F`]);; + e (REAL_ARITH_TAC);; + + (* second subgoal *) + e (EXPAND_TAC "temp");; + e (REWRITE_TAC[REAL_ARITH `a * b * c = (a * b) * c`]);; + e (MATCH_MP_TAC REAL_LE_LMUL);; + e (STRIP_TAC);; + e (MATCH_MP_TAC REAL_LE_MUL);; + e (REWRITE_TAC[REAL_ARITH `&0 <= &8`;ZERO_LE_MM2_LEMMA]);; + e (MATCH_MP_TAC SUM_LE);; + + e (STRIP_TAC);; + e (ASM_SIMP_TAC[]);; + e (GEN_TAC THEN DISCH_TAC);; + e (REWRITE_TAC[IN_ELIM_THM]);; + e (ABBREV_TAC + `temp_s1 = {v:real^3 | v IN V /\ ~(x = v) /\ dist (x,v) < sqrt (&8)}`);; + e (ABBREV_TAC + `temp_s2 = {v:real^3 | v IN V /\ ~(x = v) /\ dist (x,v) <= &2 * h0}`);; + e (MATCH_MP_TAC SUM_SUBSET_SIMPLE);; + e (REPEAT STRIP_TAC);; + (* Break into 3 subgoals *) + + (* First subgoal *) + e (NEW_GOAL `temp_s2 SUBSET (V INTER ball (x:real^3, &10))`);; + e (EXPAND_TAC "temp_s2");; + e (REWRITE_TAC[SUBSET]);; + e (GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM;IN_INTER] THEN DISCH_TAC);; + e (ASM_SIMP_TAC[ball;IN_ELIM_THM]);; + e (MATCH_MP_TAC + (REAL_ARITH `&2 * h0 < &10 /\ a <= &2 * h0 ==> a < &10`));; + e (ASM_REWRITE_TAC[h0] THEN REAL_ARITH_TAC);; + e (NEW_GOAL `FINITE (V INTER ball (x:real^3,&10))`);; + e (ASM_SIMP_TAC[]);; + e (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[FINITE_SUBSET]);; + + (* Second subgoal *) + e (EXPAND_TAC "temp_s1" THEN EXPAND_TAC "temp_s2");; + e (REWRITE_TAC[SUBSET;IN_ELIM_THM]);; + e (GEN_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[h0]);; + e (MATCH_MP_TAC + (REAL_ARITH `x < sqrt(&8) /\ sqrt(&8) < y ==> x <= y`));; + e (ASM_REWRITE_TAC[h0]);; + +e CHEAT_TAC;; (* ! Because it isn't true at all - see KIZHLTL3 above *) +e CHEAT_TAC;; + +(* !!!!! End of part that will become very easy *) + + + + (* ! There is a serious logical mistake here, we have to fix it right away *) + + +e (REWRITE_WITH `T1 + T2 + T3 = + sum B_0_r (\X:real^3->bool. gammaX V X lmfun)`);; +e (SUBGOAL_THEN `FINITE (B_0_r:(real^3->bool)->bool)` ASSUME_TAC);; +e (EXPAND_TAC "B_0_r");; +e (REWRITE_TAC[FINITE_MCELL_SET_LEMMA]);; + +e (SUBGOAL_THEN + `sum B_0_r (\X. gammaX V X lmfun) = + sum B_0_r (\X. vol X - (&2 * mm1 / pi) * total_solid V X) + + sum B_0_r + (\X. (&8 * mm2 / pi) * + sum (edgeX V X) (\({u, v}). dihX V X (u,v) * lmfun (hl [u; v])))` + ASSUME_TAC);; +e (REWRITE_TAC[gammaX]);; +e (MATCH_MP_TAC SUM_ADD);; +e (ASM_REWRITE_TAC[]);; +e (SUBGOAL_THEN + `sum B_0_r (\X. vol X - (&2 * mm1 / pi) * total_solid V X) = + sum B_0_r (\X. vol X) - sum B_0_r (\X. (&2 * mm1 / pi) * total_solid V X)` + ASSUME_TAC);; +e (ABBREV_TAC `temp1 = (\X. (&2 * mm1 / pi) * total_solid V X)`);; +e (ABBREV_TAC `temp2:(real^3->bool)->real = (\X. vol X)`);; + +e (REWRITE_WITH `(\X. vol X - (&2 * mm1 / pi) * total_solid V X) = + (\X. temp2 X - temp1 X)`);; +e (EXPAND_TAC "temp1" THEN EXPAND_TAC "temp2" THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC SUM_SUB);; +e (ASM_REWRITE_TAC[]);; + +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "T1" THEN EXPAND_TAC "T2" THEN EXPAND_TAC "T3");; +e (MATCH_MP_TAC (REAL_ARITH ` x1 = x2 /\ --y1 = y2 /\ z1 = z2 ==> + x1 + y1 + z1 = x2 - y2 + z2`));; +e (REPEAT STRIP_TAC);; +e (MATCH_MP_TAC SUM_EQ);; +e (GEN_TAC THEN DISCH_TAC THEN REWRITE_TAC[IN_ELIM_THM]);; +e (REWRITE_TAC[REAL_ARITH `--(--x * y) = x * y`]);; +e (REWRITE_TAC[SUM_LMUL]);; +e (REWRITE_TAC[REAL_EQ_MUL_LCANCEL]);; +e (DISJ2_TAC);; +e (MATCH_MP_TAC SUM_EQ);; +e (GEN_TAC THEN DISCH_TAC THEN REWRITE_TAC[IN_ELIM_THM]);; +e (REWRITE_TAC[SUM_LMUL]);; +e (EXPAND_TAC "B_0_r");; + +e (ASM_SIMP_TAC[]);; + +let NEGLIGIBLE_FUNC = top_thm();; + +(* ========================================================================= *) +(* Main theorm *) +(* ========================================================================= *) + +let UPFZBZM = prove (UPFZBZM_concl, + (REPEAT STRIP_TAC) THEN (ABBREV_TAC `G = (\u. --vol (voronoi_open V u) + + &8 * mm1 - + &8 * + mm2 * + sum {v:real^3 | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v])))`) THEN + (EXISTS_TAC `G:real^3->real`) THEN + (ASM_MESON_TAC[NEGLIGIBLE_FUNC;FCC_COMPATABILITY_FUNC]));; + + + +(* ========================================================================== *) +(* Continue back up of complementary lemmas *) +(* ========================================================================== *) + +let SUM_GAMMAX_LMFUM_ESTIMATE_concl = + `!V. ?c. !r. saturated V /\ packing V /\ &1 <= r /\ + cell_cluster_estimate V /\ marchal_inequality /\ + lmfun_inequality V ==> + c * r pow 2 <= sum {X | X SUBSET ball (vec 0, r) /\ mcell_set V X} + (\X. gammaX V X lmfun)`;; + +(* ---------------------- We prove it below ------------------------------- *) + +g SUM_GAMMAX_LMFUM_ESTIMATE_concl;; +e (GEN_TAC);; +e (EXISTS_TAC `c:real`);; +e (REPEAT STRIP_TAC);; + +e (SUBGOAL_THEN `!X. (critical_edgeX V X = {}) ==> + (!u v:real^3. {u, v} IN edgeX V X ==> + lmfun (hl [u; v]) >= marchal (hl [u ; v]))` ASSUME_TAC);; +e (REPEAT STRIP_TAC);; +e (SUBGOAL_THEN `~(hminus <= hl [u:real^3; v] /\ hl [u; v] <= hplus)` + ASSUME_TAC);; +e STRIP_TAC;; +e (SUBGOAL_THEN `critical_edgeX V X {u, v}` ASSUME_TAC);; +e (REWRITE_TAC[critical_edgeX]);; +e (REWRITE_TAC[IN_ELIM_THM]);; +e (EXISTS_TAC `u:real^3`);; +e (EXISTS_TAC `v:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (SUBGOAL_THEN `~ (critical_edgeX V X = {})` ASSUME_TAC);; +e (UP_ASM_TAC);; +e (SET_TAC[]);; +e (ASM_MESON_TAC[]);; +e (ASM_SIMP_TAC[lmfun_vs_marchal]);; + +(* We have already proved that : + +!X. critical_edgeX V X = {} + ==> (!u v. + {u, v} IN edgeX V X + ==> lmfun (hl [u; v]) >= marchal (hl [u; v])) +*) + +e (SUBGOAL_THEN + `!X. mcell_set V X /\ (critical_edgeX V X = {}) ==> gammaX V X lmfun >= &0` ASSUME_TAC);; +e (REPEAT STRIP_TAC);; +e (MATCH_MP_TAC (REAL_ARITH + `a >= gammaX V X marchal /\ gammaX V X marchal >= &0 ==> a >= &0`));; +e CONJ_TAC;; + + (* break into 2 small part *) + +e (REWRITE_TAC[gammaX]);; +e (MATCH_MP_TAC (REAL_ARITH `a <= b ==> x - y + b >= x - y + a`));; +e (MATCH_MP_TAC REAL_LE_LMUL);; +e STRIP_TAC;; +e (MATCH_MP_TAC REAL_LE_MUL);; +e CONJ_TAC;; +e REAL_ARITH_TAC;; +e (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`));; +e (MATCH_MP_TAC REAL_LT_DIV);; +e (REWRITE_TAC[PI_POS;ZERO_LT_MM2_LEMMA]);; + +e (MATCH_MP_TAC SUM_LE);; +e (REWRITE_TAC[FINITE_edgeX]);; +e (REWRITE_TAC[edgeX;IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (REWRITE_TAC[ASSUME `x = {u:real^3, v}`;BETA_THM]);; + +e (REWRITE_WITH `(\({u, v}). dihX V X (u,v) * marchal (hl [u; v])) {u, v} = + dihX V X (u,v) * marchal (hl [u; v])`);; +e (MATCH_MP_TAC BETA_PAIR_THM);; + +e (REWRITE_TAC[HL;DIHX_SYM]);; +e (REPEAT GEN_TAC);; +e (REWRITE_WITH `set_of_list [u':real^3; v'] = set_of_list [v'; u']`);; +e (REWRITE_TAC[set_of_list]);; +e (SET_TAC[]);; + +e (REWRITE_WITH `(\({u, v}). dihX V X (u,v) * lmfun (hl [u; v])) {u, v} = + dihX V X (u,v) * lmfun (hl [u; v])`);; +e (MATCH_MP_TAC BETA_PAIR_THM);; + +e (REWRITE_TAC[HL;DIHX_SYM]);; +e (REPEAT GEN_TAC);; +e (REWRITE_WITH `set_of_list [u':real^3; v'] = set_of_list [v'; u']`);; +e (REWRITE_TAC[set_of_list]);; +e (SET_TAC[]);; + +e (MATCH_MP_TAC (REAL_ARITH `&0 <= a * ( y - x) ==> a * x <= a * y`));; +e (MATCH_MP_TAC REAL_LE_MUL);; +e STRIP_TAC;; +e (REWRITE_TAC[DIHX_POS]);; +e (MATCH_MP_TAC (REAL_ARITH `a >= b ==> &0 <= a - b`));; +e (NEW_GOAL `{u, v} IN edgeX V X`);; +e (ASM_REWRITE_TAC[edgeX]);; +e (DEL_TAC THEN REPLICATE_TAC 3 UP_ASM_TAC THEN SET_TAC[]);; +e (ASM_MESON_TAC[]);; + +e (MP_TAC (ASSUME `marchal_inequality`));; +e (REWRITE_TAC[marchal_inequality]);; +e (DISCH_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC);; +e (ASM_REWRITE_TAC[]);; + +(* ------------------------------------------------------------------------ *) + +e (ABBREV_TAC `B_0_r = {X | X SUBSET ball (vec 0, r) /\ mcell_set V X}`);; +e (ABBREV_TAC `B_0_r_empty = B_0_r INTER {X| critical_edgeX V X = {}}`);; +e (ABBREV_TAC `B_0_r_no_empty = B_0_r INTER {X| ~(critical_edgeX V X = {})}`);; + +e (SUBGOAL_THEN + `B_0_r:(real^3->bool)->bool = B_0_r_empty UNION B_0_r_no_empty` ASSUME_TAC);; +e (EXPAND_TAC "B_0_r_empty");; +e (EXPAND_TAC "B_0_r_no_empty");; +e (EXPAND_TAC "B_0_r");; +e (SET_TAC[]);; +e (ASM_REWRITE_TAC[]);; + +e (SUBGOAL_THEN `FINITE (B_0_r:(real^3->bool)->bool)` ASSUME_TAC);; +e (EXPAND_TAC "B_0_r");; +e (REWRITE_TAC[FINITE_MCELL_SET_LEMMA]);; + +e (SUBGOAL_THEN `FINITE (B_0_r_empty:(real^3->bool)->bool)` ASSUME_TAC);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `(B_0_r:(real^3->bool)->bool)`);; +e (ASM_REWRITE_TAC[]);; +e (SET_TAC[]);; + +e (SUBGOAL_THEN `FINITE (B_0_r_no_empty:(real^3->bool)->bool)` ASSUME_TAC);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `(B_0_r:(real^3->bool)->bool)`);; +e (ASM_REWRITE_TAC[]);; +e (SET_TAC[]);; + +e (SUBGOAL_THEN `DISJOINT B_0_r_empty (B_0_r_no_empty:(real^3->bool)->bool)` ASSUME_TAC);; +e (REWRITE_TAC[IN_DISJOINT]);; +e (EXPAND_TAC "B_0_r_empty" THEN EXPAND_TAC "B_0_r_no_empty");; +e (STRIP_TAC);; +e (SUBGOAL_THEN `x IN {X | critical_edgeX V X = {}}` ASSUME_TAC);; +e (DEL_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (SUBGOAL_THEN `x IN {X | ~(critical_edgeX V X = {})}` ASSUME_TAC);; +e (DEL_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; + +e (REWRITE_WITH + `sum (B_0_r_empty UNION B_0_r_no_empty) (\X. gammaX V X lmfun) = + sum (B_0_r_empty) (\X. gammaX V X lmfun) + + sum (B_0_r_no_empty) (\X. gammaX V X lmfun)`);; +e (MATCH_MP_TAC SUM_UNION);; +e (ASM_REWRITE_TAC[]);; + +e (SUBGOAL_THEN `&0 <= sum B_0_r_empty (\X. gammaX V X lmfun)` ASSUME_TAC);; +e (MATCH_MP_TAC SUM_POS_LE);; +e STRIP_TAC;; + + e (ASM_REWRITE_TAC[]);; + e (EXPAND_TAC "B_0_r_empty");; + e (EXPAND_TAC "B_0_r");; + e (REWRITE_TAC[REAL_ARITH `&0 <= x <=> x >= &0`]);; + e (MP_TAC (ASSUME + `!X. mcell_set V X /\ critical_edgeX V X = {} ==> + gammaX V X lmfun >= &0`));; + e (SET_TAC[]);; + +e (MATCH_MP_TAC (REAL_ARITH `x <= a /\ &0 <= b ==> x <= b + a`));; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_WITH + `sum B_0_r_no_empty (\X. gammaX V X lmfun) = + sum B_0_r (\X. (gammaX V X lmfun) * + sum (critical_edgeX V X) (\e. critical_weight V X))`);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_WITH +`sum (B_0_r_empty UNION B_0_r_no_empty) + (\X. gammaX V X lmfun * sum (critical_edgeX V X) (\e. critical_weight V X)) = + sum B_0_r_empty + (\X. gammaX V X lmfun * sum (critical_edgeX V X) (\e. critical_weight V X)) + + sum B_0_r_no_empty + (\X. gammaX V X lmfun * sum (critical_edgeX V X) (\e. critical_weight V X))` +);; +e (MATCH_MP_TAC SUM_UNION);; +e (ASM_REWRITE_TAC[]);; + +e (SUBGOAL_THEN + `sum B_0_r_empty + (\X. gammaX V X lmfun * sum (critical_edgeX V X) + (\e. critical_weight V X)) = &0` ASSUME_TAC);; +e (MATCH_MP_TAC SUM_EQ_0);; +e (EXPAND_TAC "B_0_r_empty");; +e (GEN_TAC THEN REWRITE_TAC[IN_INTER;IN_ELIM_THM]);; +e (STRIP_TAC);; +e (MATCH_MP_TAC (MESON[REAL_MUL_RZERO] `x = &0 ==> y * x = &0`));; +e (MATCH_MP_TAC (MESON[SUM_CLAUSES] `x = {} ==> sum x f = &0`));; +e (ASM_REWRITE_TAC[]);; + + +e (ASM_REWRITE_TAC[REAL_ADD_LID]);; +e (MATCH_MP_TAC (SUM_EQ));; +e GEN_TAC;; +e (EXPAND_TAC "B_0_r_no_empty" THEN EXPAND_TAC "B_0_r");; +e (REWRITE_TAC[IN_INTER;IN_ELIM_THM]);; +e DISCH_TAC;; +e (MATCH_MP_TAC (MESON[REAL_MUL_RID] `x = &1 ==> y = y * x`));; +e (REWRITE_TAC[critical_weight]);; +e (SUBGOAL_THEN ) +e (SIMP_TAC[SUM_CONST]);; +e (NEW_GOAL `FINITE (critical_edgeX V x)`);; +e (ASM_SIMP_TAC[FINITE_critical_edgeX]);; +e (ASM_SIMP_TAC[SUM_CONST]);; +e (REWRITE_TAC[REAL_ARITH `a * &1 / a = (a * &1) / a`; REAL_MUL_RID]);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (MATCH_MP_TAC (MESON[REAL_OF_NUM_EQ] `~(x = 0) ==> ~ (&x = &0)`));; +e (UP_ASM_TAC THEN UP_ASM_TAC);; +e (MESON_TAC[CARD_EQ_0]);; + +(* ------------------------------------------------------------------------- *) + +e (ABBREV_TAC + `temp_set = {e:real^3->bool | (?X. X IN B_0_r /\ e IN critical_edgeX V X)}`);; +e (SUBGOAL_THEN `FINITE (temp_set:(real^3->bool)->bool)` ASSUME_TAC);; +e CHEAT_TAC;; + + (* Used CHEAT_TAC here. But it seems to be easy *) + +e (REWRITE_WITH + `sum B_0_r + (\X. gammaX V X lmfun * + sum (critical_edgeX V X) (\e. critical_weight V X)) = + sum B_0_r + (\X. sum (critical_edgeX V X) (\e. gammaX V X lmfun * critical_weight V X))`);; +e (REWRITE_TAC[GSYM SUM_LMUL]);; + +e (REWRITE_WITH + `sum B_0_r + (\X. sum (critical_edgeX V X) (\e. gammaX V X lmfun * critical_weight V X)) = + sum B_0_r + (\X. sum {e | e IN temp_set /\ critical_edgeX V X e} + (\e. gammaX V X lmfun * critical_weight V X))`);; +e (MATCH_MP_TAC SUM_EQ);; +e (GEN_TAC THEN DISCH_TAC THEN REWRITE_TAC[IN_ELIM_THM]);; +e (MATCH_MP_TAC (MESON[] `(s = r) ==> sum s f = sum r f`));; +e (REWRITE_TAC[SET_RULE + `(X = Y) <=> (!x. (x IN X ==> x IN Y) /\ (x IN Y ==> x IN X))`]);; +e (GEN_TAC THEN STRIP_TAC);; +e (REWRITE_TAC[IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (EXPAND_TAC "temp_set" THEN REWRITE_TAC[IN_ELIM_THM]);; +e (EXISTS_TAC `x:real^3 -> bool`);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[IN_ELIM_THM]);; +e (SET_TAC[]);; +e (REWRITE_WITH + `sum B_0_r + (\X. sum {e | e IN temp_set /\ critical_edgeX V X e} + (\e. gammaX V X lmfun * critical_weight V X)) = + sum temp_set + (\e. sum {X | X IN B_0_r /\ critical_edgeX V X e} + (\X. gammaX V X lmfun * critical_weight V X))`);; +e (MATCH_MP_TAC SUM_SUM_RESTRICT);; +e (ASM_REWRITE_TAC[]);; + + +(* need to continue *) + + + +(*-------------------- The lemma about sum of beta_bump ---------------------*) + + +g `!V X. saturated V /\ packing V /\ mcell_set V X ==> + sum {e | e IN critical_edgeX V X } (\e. beta_bump V e X) = &0`;; +e (REPEAT STRIP_TAC THEN UP_ASM_TAC);; +e (REWRITE_TAC[mcell_set; IN_ELIM_THM]);; +e (DISCH_TAC);; +e (REWRITE_TAC[beta_bump]);; +e (REPEAT LET_TAC);; +e (ASM_CASES_TAC `~(k = 4)`);; + + (* Two case. Here is CASE 1*) + +e (NEW_GOAL `!e. sum + {e',e'',p,vl | k = 4 /\ + critical_edgeX V X = {e', e''} /\ + e = e' /\ + p permutes 0..3 /\ + vl = left_action_list p ul /\ + e' = {EL 0 vl, EL 1 vl} /\ + e'' = {EL 2 vl, EL 3 vl}} + (\(e',e'',p,vl). (bump (hl [EL 0 vl; EL 1 vl]) - + bump (hl [EL 2 vl; EL 3 vl])) / + &4) = &0`);; +e GEN_TAC;; +e (ABBREV_TAC `SET1 = {e',e'',p,vl | k = 4 /\ + critical_edgeX V X = {e', e''} /\ + e = e' /\ + p permutes 0..3 /\ + vl = left_action_list p ul /\ + e' = {EL 0 vl, EL 1 vl} /\ + e'' = {EL 2 vl, EL 3 vl}}`);; + +e (NEW_GOAL + `SET1:(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list->bool = {}`);; +e (EXPAND_TAC "SET1");; +e (MP_TAC (ASSUME `~(k = 4)`));; +e (SET_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[SUM_CLAUSES]);; +e (ASM_REWRITE_TAC[SUM_0]);; + + (* Here is case 2 *) + +e (NEW_GOAL `k = 4`);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (SWITCH_TAC THEN DEL_TAC);; +e (SWITCH_TAC);; +e (UP_ASM_TAC THEN REWRITE_TAC[cell_params]);; +e DISCH_TAC;; + +(* ------------------------------------------------------------------------ *) + +e (NEW_GOAL `k <= 4 /\ ul IN barV V 3 /\ X = mcell k V ul`);; +e (NEW_GOAL ` (?k ul. k <= 4 /\ ul IN barV V 3 /\ X = mcell k V ul) /\ ((@(k,ul). k <= 4 /\ ul IN barV V 3 /\ X = mcell k V ul) = k,ul)`);; +e (ASM_REWRITE_TAC[]);; +e (CHOOSE_TAC (ASSUME `?i ul. X = mcell i V ul /\ ul IN barV V 3`));; +e (CHOOSE_TAC (ASSUME `?ul. X = mcell i V ul /\ ul IN barV V 3`));; +e (ASM_CASES_TAC `i <= 4`);; +e (EXISTS_TAC `i:num`);; +e (EXISTS_TAC `ul':(real^3) list`);; +e (ASM_REWRITE_TAC[]);; + +e (EXISTS_TAC `4`);; +e (EXISTS_TAC `ul':(real^3) list`);; +e (ASM_REWRITE_TAC[ARITH_RULE `4 <= 4`]);; +e (REWRITE_TAC[mcell]);; +e (COND_CASES_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC);; +e (MESON_TAC[ARITH_RULE `~(i <= 4) ==> (i = 0) ==> F`]);; +e (DEL_TAC);; +e (COND_CASES_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC);; +e (MESON_TAC[ARITH_RULE `~(i <= 4) ==> (i = 1) ==> F`]);; +e (DEL_TAC);; +e (COND_CASES_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC);; +e (MESON_TAC[ARITH_RULE `~(i <= 4) ==> (i = 2) ==> F`]);; +e (DEL_TAC);; +e (COND_CASES_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC);; +e (MESON_TAC[ARITH_RULE `~(i <= 4) ==> (i = 3) ==> F`]);; +e (DEL_TAC);; +e (COND_CASES_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[ARITH_RULE `4 = 0 ==> F`]);; +e (COND_CASES_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[ARITH_RULE `4 = 1 ==> F`]);; +e (COND_CASES_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[ARITH_RULE `4 = 2 ==> F`]);; +e (COND_CASES_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[ARITH_RULE `4 = 3 ==> F`]);; +e (REWRITE_TAC[]);; +e (UP_ASM_TAC);; + +e (ABBREV_TAC `P = (\k. k <= 4)`);; +e (ABBREV_TAC `Q = (\ul. ul IN barV V 3)`);; +e (ABBREV_TAC `R = (\k ul. X = mcell k V ul)`);; + +e (REWRITE_WITH +`(?k ul. k <= 4 /\ ul IN barV V 3 /\ X = mcell k V ul) /\ + (@(k,ul). k <= 4 /\ ul IN barV V 3 /\ X = mcell k V ul) = k,ul + ==> k <= 4 /\ ul IN barV V 3 /\ X = mcell k V ul <=> + (?k ul. P k /\ Q ul /\ R k ul) /\ (@(k,ul). P k /\ Q ul /\ R k ul) = k,ul + ==> P k /\ Q ul /\ R k ul`);; +e (EXPAND_TAC "P" THEN EXPAND_TAC "Q" THEN EXPAND_TAC "R");; +e (REWRITE_TAC[IN_ELIM_THM]);; +e (REWRITE_TAC[JOHN_SELECT_THM]);; +e (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN DEL_TAC THEN REPEAT STRIP_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN DEL_TAC THEN REPEAT STRIP_TAC);; + +(* ------------------------------------------------------------------------- *) + +e (REWRITE_WITH `{e | e IN critical_edgeX V X} = critical_edgeX V X`);; +e (SET_TAC[]);; +e (ASM_CASES_TAC `?e e'. ~ (e = e') /\ critical_edgeX V X = {e , e'}`);; +e (CHOOSE_TAC (ASSUME `?e e'. ~ (e = e') /\ critical_edgeX V X = {e, e'}`));; +e (CHOOSE_TAC (ASSUME `?e'. ~ (e = e') /\ critical_edgeX V X = {e, e'}`));; +e (UP_ASM_TAC THEN DEL_TAC THEN DEL_TAC THEN DISCH_TAC);; + +e (ASM_SIMP_TAC [SUM_SET_OF_2_ELEMENTS]);; +e (ABBREV_TAC `K1 = {e'',e''',p,(vl:(real^3)list) | {e, e'} = {e'', e'''} /\ + e' = e'' /\ + p permutes 0..3 /\ + vl = left_action_list p ul /\ + e'' = {EL 0 vl, EL 1 vl} /\ + e''' = {EL 2 vl, EL 3 vl}}`);; +e (REWRITE_WITH +` sum (K1:(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list->bool) + (\(e',e'',p,vl). (bump (hl [EL 0 vl; EL 1 vl]) - + bump (hl [EL 2 vl; EL 3 vl])) / + &4) = + sum K1 (\(e',e'',p,vl). --((bump (hl [EL 2 vl; EL 3 vl]) - + bump (hl [EL 0 vl; EL 1 vl])) / + &4))`);; +e (MATCH_MP_TAC SUM_EQ);; +e (EXPAND_TAC "K1" THEN REWRITE_TAC[IN;IN_ELIM_THM;BETA_THM]);; +e (REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[BETA_THM]);; +e (REAL_ARITH_TAC);; + +e (REWRITE_WITH +` sum (K1:(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list->bool) + (\(e',e'',p,vl). --((bump (hl [EL 2 vl; EL 3 vl]) - + bump (hl [EL 0 vl; EL 1 vl])) / + &4)) = +-- sum K1 (\(e',e'',p,vl). (bump (hl [EL 2 vl; EL 3 vl]) - + bump (hl [EL 0 vl; EL 1 vl])) / + &4)`);; + + +(* need to continue *) + + + + + +e (MESON_TAC[SUM_NEG;john_harrison_lemma1]);; +seans_fn();; +SUM_NEG;; +seans_fn();; + + +e (ABBREV_TAC `S1 = {e',e'',p,vl | k = 4 /\ + critical_edgeX V X = {e', e''} /\ + e = e' /\ + p permutes 0..3 /\ + vl = left_action_list p ul /\ + e' = {EL 0 vl, EL 1 (vl:(real^3)list)} /\ + e'' = {EL 2 vl, EL 3 vl}}`);; + + +search [`sum f (\x. s - t)`];; + + +e CHEAT_TAC;; +(* ! this may be difficult here *) + +(* -------------------------------------------------------*) + +e (MATCH_MP_TAC SUM_EQ_0);; +e (GEN_TAC THEN DISCH_TAC THEN REWRITE_TAC[IN_ELIM_THM]);; +e (NEW_GOAL `! e e'. (e = e') \/ ~(critical_edgeX V X = {e, e'})`);; +e (ASM_MESON_TAC[]);; +e (MATCH_MP_TAC SUM_EQ_0);; +e (GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM]);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[IN_ELIM_THM]);; +e (MATCH_MP_TAC (REAL_ARITH `a = &0 ==> a / &4 = &0`));; +e (MATCH_MP_TAC (REAL_ARITH `a = b ==> a - b = &0`));; +e (AP_TERM_TAC);; +e (REWRITE_TAC[HL]);; +e (AP_TERM_TAC);; +e (REWRITE_WITH `!a:real^3 b. set_of_list[a;b] = {a, b}`);; +e (MESON_TAC[set_of_list]);; +e (REWRITE_TAC[GSYM + (ASSUME `vl:(real^3)list = left_action_list (p:num->num) ul`)]);; +e (SUBGOAL_THEN `e':real^3->bool = e''`ASSUME_TAC);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; + +let SUM_BETA_BUMP_LEMMA = top_thm();; + +end;; diff --git a/legacy/oldpacking/ky_packing/UPFZBZM_axioms.hl b/legacy/oldpacking/ky_packing/UPFZBZM_axioms.hl new file mode 100644 index 0000000..99790ea --- /dev/null +++ b/legacy/oldpacking/ky_packing/UPFZBZM_axioms.hl @@ -0,0 +1,84 @@ + +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: UPFZBZM *) +(* Chaper : Packing (Clusters) *) +(* Date : October 3, 2010 *) +(* *) +(* ========================================================================= *) + + +(* ========================================================================= *) +(* Unproved lemmas for UPFZBZM *) +(* Chaper : Packing (Clusters) *) +(* *) + +(* ========================================================================= *) + + +module Upfzbzm_axioms = struct + +(* This file is to help other people who want to continue my work can see what are left. When all the axioms in this file are proved, the main theorem UPFZBZM +will be completed +*) + +(* ========================================================================= *) +(* LIST OF THINGS THAT HAS NOT BEEN PROVED *) +(* ========================================================================= *) + +let tau0_not_zero = new_axiom `~(tau0 = &0)`;; +let ZERO_LT_MM2_LEMMA = new_axiom `&0 < mm2`;; + +(* Can be proved by using the new calculation tool of Prof T.Hales *) + +let lmfun_vs_marchal = new_axiom + `!h. ~(hminus <= h /\ h <= hplus) ==> lmfun (h) >= marchal (h)`;; + +(* Prof T.Hales said he will formalize the above axiom *) + +let FINITE_MCELL_SET_LEMMA = new_axiom + `!V r. FINITE {X | X SUBSET ball (vec 0,r) /\ mcell_set V X}`;; + +(* This will be formalized by using the fact that: + - each mcell has a vertex v IN V. + - FINITE (B(0,r) INTER V) +*) + +let DIHX_SYM = new_axiom + `!u v V X. dihX V X (u,v) = dihX V X (v,u)`;; + +let KIZHLTL1 = new_axiom KIZHLTL1_concl;; +let KIZHLTL2 = new_axiom KIZHLTL2_concl;; +let KIZHLTL3 = new_axiom KIZHLTL3_concl;; + +(* Book lemmas from the previous parts. Will be formalized by someone else *) + +let SUM_GAMMAX_LMFUM_ESTIMATE_concl = + `!V. ?c. !r. saturated V /\ packing V /\ &1 <= r /\ + cell_cluster_estimate V /\ marchal_inequality /\ + lmfun_inequality V ==> + c * r pow 2 <= sum {X | X SUBSET ball (vec 0, r) /\ mcell_set V X} + (\X. gammaX V X lmfun)`;; + +let SUM_GAMMAX_LMFUM_ESTIMATE = new_axiom SUM_GAMMAX_LMFUM_ESTIMATE_concl;; +(* This axiom is the most important here *) + +let negligible_fun_any_C = new_axiom + `!f S. negligible_fun_0 f S <=> + (?C. (!r. &1 <= r ==> sum (S INTER ball ((vec 0),r)) f <= C * r pow 2))`;; +(* ! This is done in file "ky_lemma_negligible.hl" by T.Hales. + ! But I cannot load it. Maybe he used a newer version of HOL + *) + +let FINITE_PACK_LEMMA = new_axiom + `!V p:real^3 r. packing V ==> FINITE (V:real^3->bool INTER ball (p,r))` ;; + +let FINITE_PERMUTE_3 = new_axiom `FINITE {p | p permutes {0, 1, 2}}`;; +let FINITE_PERMUTE_4 = new_axiom `FINITE {p | p permutes {0, 1, 2, 3}}`;; + +(* The same technique apply for 2 above lemmas *) + +(* ========================================================================= *) +end;; diff --git a/legacy/oldpacking/ky_packing/UPFZBZM_support_lemmas.hl b/legacy/oldpacking/ky_packing/UPFZBZM_support_lemmas.hl new file mode 100644 index 0000000..0f38161 --- /dev/null +++ b/legacy/oldpacking/ky_packing/UPFZBZM_support_lemmas.hl @@ -0,0 +1,411 @@ + +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: UPFZBZM *) +(* Chaper : Packing (Clusters) *) +(* Date : October 3, 2010 *) +(* *) +(* ========================================================================= *) + +(* ========================================================================= *) +(* Supporting lemmas for UPFZBZM *) +(* Chaper : Packing (Clusters) *) +(* *) +(* ========================================================================= *) + +(* ========================================================================= *) +(* FILES NEED TO BE LOADED *) +(* ========================================================================= *) + + +flyspeck_needs "nonlinear/vukhacky_tactics.hl";; +flyspeck_needs "packing/pack_defs.hl";; +flyspeck_needs "packing/pack_concl.hl";; +flyspeck_needs "packing/beta_pair_thm.hl";; +(* Loading the list of unproved lemmas *) + +flyspeck_needs "packing/ky/UPFZBZM_axioms.hl";; + +module UPFZBZM_support_lemmas.hl + +open Pack_defs;; +open Pack_concl;; +open Vukhacky_tactics;; + +(*-------------------------------------------------------------------------- *) + + let UPFZBZM_concl = + `!V. saturated V /\ packing V /\ cell_cluster_estimate V /\ + marchal_inequality /\ + lmfun_inequality V ==> + (?G. negligible_fun_0 G V /\ fcc_compatible G V)`;; + +(* ------------------------------------------------------------------------- *) + + +(* ========================================================================= *) +(* SOME COMPLEMENTARY LEMMAS *) +(* ========================================================================= *) +(* Lemma 1 *) + + let john_harrison_lemma1 = prove + (`(\(x,y). P x y) = (\p. P (FST p) (SND p))`, + REWRITE_TAC[FUN_EQ_THM; FORALL_PAIR_THM]);; + + let john_harrison_lemma2 = MESON[] `(?x. P x) /\ (@x. P x) = a ==> P a`;; + + let JOHN_SELECT_THM = prove + (`(?x y. P x /\ Q y /\ R x y) /\ + (@(x,y). P x /\ Q y /\ R x y) = (a,b) + ==> P a /\ Q b /\ R a b`, + REWRITE_TAC[GSYM EXISTS_PAIRED_THM] THEN + REWRITE_TAC[john_harrison_lemma1] THEN + DISCH_THEN(MP_TAC o MATCH_MP john_harrison_lemma2) THEN + REWRITE_TAC[FST; SND]);; + +(* ------------------------------------------------------------------------- *) +(* Lemma 2 *) + +let SQRT_RULE_Euler_lemma = prove + (`!x y. x pow 2 = y /\ &0 <= x ==> x = sqrt y`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[GSYM (ASSUME `x pow 2 = y`);REAL_POW_2] THEN + ASM_SIMP_TAC[SQRT_MUL] THEN + ASM_MESON_TAC[GSYM REAL_POW_2;SQRT_POW_2]);; + +let SQRT_OF_32_lemma = prove_by_refinement ( + `sqrt (&32) = &8 * sqrt (&1 / &2)`, + [ (REWRITE_WITH `&8 = sqrt (&64)`); + (MATCH_MP_TAC SQRT_RULE_Euler_lemma); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&32 = &64 * (&1 / &2)`]); + (MATCH_MP_TAC SQRT_MUL); + (REAL_ARITH_TAC)]);; + +(* ------------------------------------------------------------------------- *) +(* Lemma 3 *) + +let m1_minus_12m2 = prove_by_refinement ( + `mm1 - &12 * mm2 = sqrt (&1 / &2)`, + +[ (REWRITE_TAC[mm1;mm2]); + (REWRITE_TAC [REAL_ARITH `a * (b / c) = (a * b) / c`]); + (REWRITE_WITH + `&12 * (&6 * sol0 - pi) * sqrt (&2) = ((&6 * sol0 - pi) * sqrt (&8)) * &6`); + (REWRITE_TAC[REAL_ARITH`&12 * a * b = (a * &2 * b) * &6`]); + (MATCH_MP_TAC (MESON[REAL_EQ_MUL_RCANCEL] `a = b ==> a * x = b * x`)); + (MATCH_MP_TAC (MESON[REAL_EQ_MUL_LCANCEL] `a = b ==> x * a = x * b`)); + + (REWRITE_TAC[REAL_ARITH `&8 = &4 * &2`]); + (REWRITE_WITH `sqrt (&4 * &2) = sqrt (&4) * sqrt (&2)`); + (MATCH_MP_TAC SQRT_MUL); + (REAL_ARITH_TAC); + (MATCH_MP_TAC (MESON[REAL_EQ_MUL_RCANCEL] `a = b ==> a * x = b * x`)); + (MATCH_MP_TAC SQRT_RULE_Euler_lemma); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `(m * &6) / (&6 * tau0) = m * &6 / (tau0 * &6)`]); + (REWRITE_WITH `((&6 * sol0 - pi) * sqrt (&8)) * &6 / (tau0 * &6) = + ((&6 * sol0 - pi) * sqrt (&8)) / tau0`); + (MATCH_MP_TAC REDUCE_WITH_DIV_Euler_lemma); + (REWRITE_TAC[REAL_ARITH `~(&6 = &0)`;tau0_not_zero]); + + (REWRITE_TAC[REAL_ARITH `a / b - c / b = (a - c) / b`]); + (REWRITE_TAC[REAL_ARITH `a * x - b * x = (a - b) * x`]); + (REWRITE_WITH `sol0 - (&6 * sol0 - pi) = tau0 / &4`); + (REWRITE_TAC[tau0]); + (REAL_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH + `(tau0 / &4 * x) / tau0 = (tau0 / tau0) * (x / &4)`]); + (REWRITE_WITH `sqrt (&8) / &4 = sqrt (&1 / &2)`); + (REWRITE_TAC[REAL_ARITH `&1 / &2 = &8 / &16`]); + (REWRITE_WITH `sqrt (&8 / &16) = sqrt (&8) / sqrt (&16)`); + (MATCH_MP_TAC SQRT_DIV THEN REAL_ARITH_TAC); + (REWRITE_WITH `sqrt (&16) = &4`); + + (MATCH_MP_TAC (MESON[] `a = b ==> b = a`)); + (MATCH_MP_TAC SQRT_RULE_Euler_lemma THEN REAL_ARITH_TAC); + (MATCH_MP_TAC (MESON[REAL_MUL_LID] `x = &1 ==> x * y = y`)); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[tau0_not_zero])]);; + + +(* ------------------------------------------------------------------------- *) +(* Lemma 4 *) + +let ZERO_LE_MM2_LEMMA = + MATCH_MP (REAL_ARITH `&0 < x ==> &0 <= x`) ZERO_LT_MM2_LEMMA;; + +(* ------------------------------------------------------------------------- *) +(* Lemma 5 *) + +let FINITE_edgeX = prove_by_refinement ( + `!V X. FINITE (edgeX V X)`, +[(REPEAT GEN_TAC THEN REWRITE_TAC[edgeX;VX]); + (COND_CASES_TAC); +(* Break into 2 subgoal *) + +(REWRITE_WITH `{{u:real^3, v} | {} u /\ {} v /\ ~(u = v)} = {}`); +(* New Subgoal 1.1 *) +(SET_TAC[]); (* End subgoal 1.1 *) +(MESON_TAC[FINITE_CASES]); (* End Subgoal 1 *) +(REPEAT LET_TAC); +(SUBGOAL_THEN + `FINITE (set_of_list (truncate_simplex (k - 1) (ul:(real^3)list)))` + ASSUME_TAC); +(REWRITE_TAC[FINITE_SET_OF_LIST]); +(ABBREV_TAC `S = set_of_list (truncate_simplex (k - 1) (ul:(real^3)list))`); +(MATCH_MP_TAC FINITE_SUBSET); +(EXISTS_TAC `{t:real^3->bool | t SUBSET S}`); +(STRIP_TAC); +(ASM_MESON_TAC[FINITE_POWERSET]); +(REWRITE_TAC[SUBSET;IN_ELIM_THM]); +(REPEAT STRIP_TAC); +(REPLICATE_TAC 5 UP_ASM_TAC); +(SET_TAC[])]);; + + +(* ------------------------------------------------------------------------- *) +(* Lemma 6 *) + +let FINITE_critical_edgeX = prove_by_refinement ( + `!V X. FINITE (critical_edgeX V X)`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[critical_edgeX]); + (REWRITE_WITH + `{{u:real^3, v} | {u, v} IN edgeX V X /\ hminus <= hl [u; v] /\ + hl [u; v] <= hplus} = + {{u, v} | hminus <= hl [u; v] /\ hl [u; v] <= hplus} INTER (edgeX V X)`); + (REPEAT GEN_TAC THEN SET_TAC[]); + (MESON_TAC[FINITE_edgeX;FINITE_INTER])]);; + + +(* ------------------------------------------------------------------------- *) +(* Lemma 7 *) + +let DIHV_LE_0 = prove_by_refinement ( + `!x:real^N y z t. &0 <= dihV x y z t`, +[ (REPEAT GEN_TAC THEN REWRITE_TAC[dihV]); + (REPEAT LET_TAC THEN REWRITE_TAC[arcV]); + (MATCH_MP_TAC (MESON[] `&0 <= acs y /\ acs y <= pi ==> &0 <= acs y`)); + (MATCH_MP_TAC ACS); + (REWRITE_TAC[GSYM REAL_ABS_BOUNDS; NORM_CAUCHY_SCHWARZ_DIV])]);; + + +(* ------------------------------------------------------------------------- *) +(* Lemma 8 *) + +let DIHV_SYM = prove_by_refinement ( + `!(x:real^N) y z t. dihV x y z t = dihV y x z t`, +[ (REPEAT GEN_TAC); + (REWRITE_TAC[dihV] THEN REPEAT LET_TAC); + (MATCH_MP_TAC (MESON[] + `!a b c d x. (a = b) /\ (c = d) ==> arcV x a c = arcV x b d`)); + (REPEAT STRIP_TAC); + (* Break into 2 subgoals with similar proofs *) + + (* Subgoal 1 *) + (EXPAND_TAC "vap'" THEN EXPAND_TAC "vap"); + + (REWRITE_WITH `(va':real^N) = va - vc`); + (EXPAND_TAC "va'" THEN EXPAND_TAC "va" THEN EXPAND_TAC "vc"); + (VECTOR_ARITH_TAC); + + (REWRITE_WITH `(vc':real^N) = --vc`); + (EXPAND_TAC "vc'" THEN EXPAND_TAC "vc"); + (VECTOR_ARITH_TAC); + + (REWRITE_WITH + `(--vc dot --vc) % (va:real^N - vc) = (vc dot vc) % va - (vc dot vc) % vc`); + (REWRITE_TAC[DOT_RNEG;DOT_LNEG;REAL_ARITH `-- --x = x `]); + (VECTOR_ARITH_TAC); + + (MATCH_MP_TAC (VECTOR_ARITH `a = b + c ==> x:real^N - b - c = x - a `)); + (REWRITE_WITH `((va:real^N - vc) dot --vc) % --vc = + (va dot vc) % vc - (vc dot vc) % vc`); + (REWRITE_TAC[DOT_RNEG;DOT_LNEG;VECTOR_MUL_LNEG; VECTOR_MUL_RNEG]); + (REWRITE_TAC[VECTOR_NEG_MINUS1;VECTOR_MUL_ASSOC]); + (REWRITE_TAC[REAL_ARITH `-- &1 * -- &1 * x = x`; + DOT_LSUB;VECTOR_SUB_RDISTRIB]); + (VECTOR_ARITH_TAC); + + (* Subgoal 2 *) + (EXPAND_TAC "vbp'" THEN EXPAND_TAC "vbp"); + (REWRITE_WITH `(vb':real^N) = vb - vc`); + (EXPAND_TAC "vb'" THEN EXPAND_TAC "vb" THEN EXPAND_TAC "vc"); + (VECTOR_ARITH_TAC); + + (REWRITE_WITH `(vc':real^N) = --vc`); + (EXPAND_TAC "vc'" THEN EXPAND_TAC "vc"); + (VECTOR_ARITH_TAC); + + (REWRITE_WITH + `(--vc dot --vc) % (vb:real^N - vc) = (vc dot vc) % vb - (vc dot vc) % vc`); + (REWRITE_TAC[DOT_RNEG;DOT_LNEG;REAL_ARITH `-- --x = x `]); + (VECTOR_ARITH_TAC); + + (MATCH_MP_TAC (VECTOR_ARITH `a = b + c ==> x:real^N - b - c = x - a `)); + (REWRITE_WITH `((vb:real^N - vc) dot --vc) % --vc = + (vb dot vc) % vc - (vc dot vc) % vc`); + (REWRITE_TAC[DOT_RNEG;DOT_LNEG;VECTOR_MUL_LNEG; VECTOR_MUL_RNEG]); + (REWRITE_TAC[VECTOR_NEG_MINUS1;VECTOR_MUL_ASSOC]); + (REWRITE_TAC[REAL_ARITH `-- &1 * -- &1 * x = x`; + DOT_LSUB;VECTOR_SUB_RDISTRIB]); + (VECTOR_ARITH_TAC)]);; + +(* ------------------------------------------------------------------------- *) +(* Lemma 9 *) + +let DIHX_POS = prove_by_refinement ( + `!u v V X. &0 <= dihX V X (u,v)`, +[(REPEAT GEN_TAC THEN REWRITE_TAC[dihX]); + (COND_CASES_TAC); + REAL_ARITH_TAC; + (LET_TAC THEN COND_CASES_TAC); + (REWRITE_TAC[dihX2] THEN LET_TAC THEN REWRITE_TAC[DIHV_LE_0]); + (COND_CASES_TAC); + (REWRITE_TAC[dihX3] THEN LET_TAC THEN MATCH_MP_TAC (SUM_POS_LE)); + STRIP_TAC; + + (REWRITE_TAC[left_action_list;TABLE]); + (ABBREV_TAC `P = {p | p permutes {0, 1, 2}}`); + (ABBREV_TAC +`VL = {vl:(real^3)list | ?p. p permutes {0, 1, 2} /\ + vl = REVERSE (REVERSE_TABLE (\i. EL (inverse p i) ul') + (LENGTH ul')) /\ + u = EL 0 vl /\ + v = EL 1 vl}`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `(VL:(real^3)list->bool) CROSS (P: (num->num)->bool)`); + STRIP_TAC; + (MATCH_MP_TAC FINITE_CROSS); + (NEW_GOAL `FINITE (P:(num->num)->bool)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[FINITE_PERMUTE_3]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "VL"); + (MATCH_MP_TAC FINITE_SUBSET); + (ABBREV_TAC + `f = (\(p:num->num). REVERSE (REVERSE_TABLE (\i. EL (inverse p i) + (ul':(real^3)list)) (LENGTH ul')))`); + (EXISTS_TAC `{vl:(real^3)list | ?p:num->num. p IN P /\ vl = f p}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN EXPAND_TAC "f"); + (REWRITE_TAC[SUBSET;IN;IN_ELIM_THM;BETA_THM]); + (MESON_TAC[]); + + (EXPAND_TAC "VL"); + (EXPAND_TAC "P"); + (REWRITE_TAC[CROSS;IN;IN_ELIM_THM;SUBSET]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `vl:(real^3)list`); + (EXISTS_TAC `p:(num->num)`); + (REPEAT STRIP_TAC); + (EXISTS_TAC `p:(num->num)`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + GEN_TAC; + (REWRITE_TAC[IN_ELIM_THM]); + (DISCH_TAC); + (CHOOSE_TAC (ASSUME `?vl p. + (p permutes {0, 1, 2} /\ + vl = left_action_list p ul' /\ + u:real^3 = EL 0 vl /\ + v = EL 1 vl) /\ + x = vl,p`)) ; + (CHOOSE_TAC (ASSUME `?p. + (p permutes {0, 1, 2} /\ + vl = left_action_list p ul' /\ + u:real^3 = EL 0 vl /\ + v = EL 1 vl) /\ + x = vl,p`)) ; + (UP_ASM_TAC THEN (REPEAT STRIP_TAC)); + (REWRITE_ONLY_TAC (ASSUME `x:(real^3)list#(num->num) = vl,p`)); + (REWRITE_TAC[DIHV_LE_0]); + (COND_CASES_TAC); + (REWRITE_TAC[dihX4]); + LET_TAC; + (MATCH_MP_TAC REAL_LE_MUL THEN REWRITE_TAC[REAL_ARITH `&0 <= &1 / &2`]); + (MATCH_MP_TAC SUM_POS_LE); + STRIP_TAC; + + (ABBREV_TAC `P = {p | p permutes {0, 1, 2, 3}}`); + (ABBREV_TAC +`VL = {vl:(real^3)list | ?p. p permutes {0, 1, 2, 3} /\ + vl = left_action_list p ul' /\ + u = EL 0 vl /\ + v = EL 1 vl}`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `(VL:(real^3)list->bool) CROSS (P: (num->num)->bool)`); + STRIP_TAC; + (MATCH_MP_TAC FINITE_CROSS); + (NEW_GOAL `FINITE (P:(num->num)->bool)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[FINITE_PERMUTE_4]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "VL"); + (MATCH_MP_TAC FINITE_SUBSET); + (ABBREV_TAC + `f = (\(p:num->num). left_action_list p (ul':(real^3)list))`); + (EXISTS_TAC `{vl:(real^3)list | ?p:num->num. p IN P /\ vl = f p}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN EXPAND_TAC "f"); + (REWRITE_TAC[SUBSET;IN;IN_ELIM_THM;BETA_THM]); + (MESON_TAC[]); + + (EXPAND_TAC "VL"); + (EXPAND_TAC "P"); + (REWRITE_TAC[CROSS;IN;IN_ELIM_THM;SUBSET]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `vl:(real^3)list`); + (EXISTS_TAC `p:(num->num)`); + (REPEAT STRIP_TAC); + (EXISTS_TAC `p:(num->num)`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + GEN_TAC; + (REWRITE_TAC[IN_ELIM_THM]); + (DISCH_TAC); + (CHOOSE_TAC (ASSUME `?vl p. + (p permutes {0, 1, 2, 3} /\ + vl = left_action_list p ul' /\ + u:real^3 = EL 0 vl /\ + v = EL 1 vl) /\ + x = vl,p`)) ; + (CHOOSE_TAC (ASSUME `?p. + (p permutes {0, 1, 2, 3} /\ + vl = left_action_list p ul' /\ + u:real^3 = EL 0 vl /\ + v = EL 1 vl) /\ + x = vl,p`)) ; + (UP_ASM_TAC THEN (REPEAT STRIP_TAC)); + (REWRITE_ONLY_TAC (ASSUME `x:(real^3)list#(num->num) = vl,p`)); + (REWRITE_TAC[DIHV_LE_0]); + REAL_ARITH_TAC ]);; + +(* ------------------------------------------------------------------------- *) +(* Lemma 10 *) + +let SUM_SET_OF_2_ELEMENTS = prove_by_refinement ( + `!s t f. ~(s = t) ==> sum {s:A,t} f = f s + f t`, +[(REPEAT STRIP_TAC); + (REWRITE_WITH `!s t f. f s = sum{s:A} f /\ f t = sum{t} f`); + (MESON_TAC[SUM_SING]); + (REWRITE_WITH `{s:A, t} = {s} UNION {t}`); + (SET_TAC[]); + (MATCH_MP_TAC SUM_UNION); + (REWRITE_TAC[FINITE_SING]); + (UP_ASM_TAC THEN SET_TAC[])]);; + + +end;; diff --git a/legacy/oldpacking/ky_packing/UPFZBZM_working.hl b/legacy/oldpacking/ky_packing/UPFZBZM_working.hl new file mode 100644 index 0000000..aaecace --- /dev/null +++ b/legacy/oldpacking/ky_packing/UPFZBZM_working.hl @@ -0,0 +1,969 @@ + + +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Author : VU KHAC KY *) +(* Book lemma: UPFZBZM *) +(* Chaper : Packing (Clusters) *) +(* Date : October 3, 2010 *) +(* *) +(* ========================================================================= *) + +(* ========================================================================= *) +(* FILES NEED TO BE LOADED *) +(* ========================================================================= *) + +(* +Note: This file has very uncertain status -- T. Hales +*) + +(* +needs "prove_by_refinement.hl";; +needs "flyspeck_needs.hl";; +needs "flyspeck_load.hl";; +*) + +flyspeck_needs "nonlinear/vukhacky_tactics.hl";; +flyspeck_needs "packing/pack_defs.hl";; +flyspeck_needs "packing/beta_pair_thm.hl";; +flyspeck_needs "packing/pack_concl.hl";; +flyspeck_needs "packing/pack1.hl";; + + +module Upfzbzm_working = struct + +open Pack_defs;; +open Pack_concl;; +open Vukhacky_tactics;; +open Pack1;; +(* open Prove_by_refinement;; *) + + + +(*-------------------------------------------------------------------------- *) + + let UPFZBZM_concl = + `!V. saturated V /\ packing V /\ cell_cluster_estimate V /\ + marchal_inequality /\ + lmfun_inequality V ==> + (?G. negligible_fun_0 G V /\ fcc_compatible G V)`;; + +(* ------------------------------------------------------------------------- *) + +(* ========================================================================= *) +(* LIST OF THINGS THAT ARE UNPROVED *) +(* ========================================================================= *) + +let tau0_not_zero = new_axiom `~(tau0 = &0)`;; +let ZERO_LT_MM2_LEMMA = new_axiom `&0 < mm2`;; +let lmfun_vs_marchal = new_axiom + `!h. ~(hminus <= h /\ h <= hplus) ==> lmfun (h) >= marchal (h)`;; +(* Tom said he will formalize 3 above axioms *) + +(* + let DIHX_POS = new_axiom `!u v V X. &0 <= dihX V X (u,v)`;; + Note: Finished but there is a CHEAT_TAC left. + + let FINITE_edgeX = new_axiom `!V X. FINITE (edgeX V X)`;; + Note: Finished + + let FINITE_critical_edgeX = new_axiom `!V X. FINITE (critical_edgeX V X)`;; + Note : Finished +*) + + +let FINITE_MCELL_SET_LEMMA = new_axiom + `!V r. FINITE {X | X SUBSET ball (vec 0,r) /\ mcell_set V X}`;; + + (* This will be formalized by using the fact that: + - each mcell has a vertex v IN V. + - FINITE (B(0,r) INTER V) + *) + + +let KIZHLTL1 = new_axiom + `!V. ?c. !r. saturated V /\ packing V /\ &1 <= r + ==> sum {X | X SUBSET ball (vec 0, r) /\ mcell_set V X} vol + + c * r pow 2 <= + sum (V INTER ball (vec 0,r)) (\u:real^3. vol (voronoi_open V u))`;; + +let KIZHLTL2 = new_axiom + `!V. ?c. !r. saturated V /\ packing V /\ &1 <= r + ==> &(CARD (V INTER ball (vec 0,r))) * &8 * mm1 + c * r pow 2 <= + (&2 * mm1 / pi) * + sum {X | X SUBSET ball (vec 0, r) /\ mcell_set V X} (total_solid V)`;; + +let KIZHLTL3 = new_axiom +`!V f. + ?c. !r. saturated V /\ + packing V /\ + &1 <= r /\ + (?c1. !x. &2 <= x /\ x < sqrt (&8) ==> abs (f x) <= c1) + ==> (&8 * mm2 / pi) * + sum {X | X SUBSET ball (vec 0, r) /\ mcell_set V X} + (\X. sum (edgeX V X) + (\({u, v}). dihX V X (u,v) * f (hl [u; v]))) + + c * r pow 2 <= + &8 * + mm2 * + sum (V INTER ball (vec 0,r)) + (\u. sum + {v | v IN V /\ ~(u = v) /\ dist (u,v) < sqrt (&8)} + (\v. f (hl [u; v])))`;; + +(* 3 axioms above are parts of KIZHLTL. They will be proved in another file *) + +let SUM_GAMMAX_LMFUM_ESTIMATE_concl = + `!V. ?c. !r. saturated V /\ packing V /\ &1 <= r /\ + cell_cluster_estimate V /\ marchal_inequality /\ + lmfun_inequality V ==> + c * r pow 2 <= sum {X | X SUBSET ball (vec 0, r) /\ mcell_set V X} + (\X. gammaX V X lmfun)`;; + +let SUM_GAMMAX_LMFUM_ESTIMATE = new_axiom SUM_GAMMAX_LMFUM_ESTIMATE_concl;; +(* This axiom is the most important thm here *) + +let negligible_fun_any_C = new_axiom + `!f S. negligible_fun_0 f S <=> + (?C. (!r. &1 <= r ==> sum (S INTER ball ((vec 0),r)) f <= C * r pow 2))`;; +(* This is done in file "ky_lemma_negligible.hl" *) + +(* In addition, there is 3 CHEAT_TAC that are used *) + +(* ========================================================================= *) + +let SUM_GAMMAX_LMFUM_ESTIMATE_concl = + `!V. ?c. !r. saturated V /\ packing V /\ &1 <= r /\ + cell_cluster_estimate V /\ marchal_inequality /\ + lmfun_inequality V ==> + c * r pow 2 <= sum {X | X SUBSET ball (vec 0, r) /\ mcell_set V X} + (\X. gammaX V X lmfun)`;; + +(* ---------------------- We prove it below ------------------------------- *) + +g SUM_GAMMAX_LMFUM_ESTIMATE_concl;; +e (GEN_TAC);; +e (EXISTS_TAC `c:real`);; +e (REPEAT STRIP_TAC);; + +e (SUBGOAL_THEN `!X. (critical_edgeX V X = {}) ==> + (!u v:real^3. {u, v} IN edgeX V X ==> + lmfun (hl [u; v]) >= marchal (hl [u ; v]))` ASSUME_TAC);; +e (REPEAT STRIP_TAC);; +e (SUBGOAL_THEN `~(hminus <= hl [u:real^3; v] /\ hl [u; v] <= hplus)` + ASSUME_TAC);; +e STRIP_TAC;; +e (SUBGOAL_THEN `critical_edgeX V X {u, v}` ASSUME_TAC);; +e (REWRITE_TAC[critical_edgeX]);; +e (REWRITE_TAC[IN_ELIM_THM]);; +e (EXISTS_TAC `u:real^3`);; +e (EXISTS_TAC `v:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (SUBGOAL_THEN `~ (critical_edgeX V X = {})` ASSUME_TAC);; +e (UP_ASM_TAC);; +e (SET_TAC[]);; +e (ASM_MESON_TAC[]);; +e (ASM_SIMP_TAC[lmfun_vs_marchal]);; + +(* We have already proved that : + +!X. critical_edgeX V X = {} + ==> (!u v. + {u, v} IN edgeX V X + ==> lmfun (hl [u; v]) >= marchal (hl [u; v])) +*) + +e (SUBGOAL_THEN + `!X. mcell_set V X /\ (critical_edgeX V X = {}) ==> gammaX V X lmfun >= &0` ASSUME_TAC);; +e (REPEAT STRIP_TAC);; +e (MATCH_MP_TAC (REAL_ARITH + `a >= gammaX V X marchal /\ gammaX V X marchal >= &0 ==> a >= &0`));; +e CONJ_TAC;; + + (* break into 2 small part *) + +e (REWRITE_TAC[gammaX]);; +e (MATCH_MP_TAC (REAL_ARITH `a <= b ==> x - y + b >= x - y + a`));; +e (MATCH_MP_TAC REAL_LE_LMUL);; +e STRIP_TAC;; +e (MATCH_MP_TAC REAL_LE_MUL);; +e CONJ_TAC;; +e REAL_ARITH_TAC;; +e (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`));; +e (MATCH_MP_TAC REAL_LT_DIV);; +e (REWRITE_TAC[PI_POS;ZERO_LT_MM2_LEMMA]);; + +e (MATCH_MP_TAC SUM_LE);; +e (REWRITE_TAC[FINITE_edgeX]);; +e (REWRITE_TAC[edgeX;IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (REWRITE_TAC[ASSUME `x = {u:real^3, v}`;BETA_THM]);; + +e (REWRITE_WITH `(\({u, v}). dihX V X (u,v) * marchal (hl [u; v])) {u, v} = + dihX V X (u,v) * marchal (hl [u; v])`);; +e (MATCH_MP_TAC BETA_PAIR_THM);; + +e (REWRITE_TAC[HL;DIHX_SYM]);; +e (REPEAT GEN_TAC);; +e (REWRITE_WITH `set_of_list [u':real^3; v'] = set_of_list [v'; u']`);; +e (REWRITE_TAC[set_of_list]);; +e (SET_TAC[]);; + +e (REWRITE_WITH `(\({u, v}). dihX V X (u,v) * lmfun (hl [u; v])) {u, v} = + dihX V X (u,v) * lmfun (hl [u; v])`);; +e (MATCH_MP_TAC BETA_PAIR_THM);; + +e (REWRITE_TAC[HL;DIHX_SYM]);; +e (REPEAT GEN_TAC);; +e (REWRITE_WITH `set_of_list [u':real^3; v'] = set_of_list [v'; u']`);; +e (REWRITE_TAC[set_of_list]);; +e (SET_TAC[]);; + +e (MATCH_MP_TAC (REAL_ARITH `&0 <= a * ( y - x) ==> a * x <= a * y`));; +e (MATCH_MP_TAC REAL_LE_MUL);; +e STRIP_TAC;; +e (REWRITE_TAC[DIHX_POS]);; +e (MATCH_MP_TAC (REAL_ARITH `a >= b ==> &0 <= a - b`));; +e (NEW_GOAL `{u, v} IN edgeX V X`);; +e (ASM_REWRITE_TAC[edgeX]);; +e (DEL_TAC THEN REPLICATE_TAC 3 UP_ASM_TAC THEN SET_TAC[]);; +e (ASM_MESON_TAC[]);; + +e (MP_TAC (ASSUME `marchal_inequality`));; +e (REWRITE_TAC[marchal_inequality]);; +e (DISCH_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC);; +e (ASM_REWRITE_TAC[]);; + +(* ------------------------------------------------------------------------ *) + +e (ABBREV_TAC `B_0_r = {X | X SUBSET ball (vec 0, r) /\ mcell_set V X}`);; +e (ABBREV_TAC `B_0_r_empty = B_0_r INTER {X| critical_edgeX V X = {}}`);; +e (ABBREV_TAC `B_0_r_no_empty = B_0_r INTER {X| ~(critical_edgeX V X = {})}`);; + +e (SUBGOAL_THEN + `B_0_r:(real^3->bool)->bool = B_0_r_empty UNION B_0_r_no_empty` ASSUME_TAC);; +e (EXPAND_TAC "B_0_r_empty");; +e (EXPAND_TAC "B_0_r_no_empty");; +e (EXPAND_TAC "B_0_r");; +e (SET_TAC[]);; +e (ASM_REWRITE_TAC[]);; + +e (SUBGOAL_THEN `FINITE (B_0_r:(real^3->bool)->bool)` ASSUME_TAC);; +e (EXPAND_TAC "B_0_r");; +e (REWRITE_TAC[FINITE_MCELL_SET_LEMMA]);; + +e (SUBGOAL_THEN `FINITE (B_0_r_empty:(real^3->bool)->bool)` ASSUME_TAC);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `(B_0_r:(real^3->bool)->bool)`);; +e (ASM_REWRITE_TAC[]);; +e (SET_TAC[]);; + +e (SUBGOAL_THEN `FINITE (B_0_r_no_empty:(real^3->bool)->bool)` ASSUME_TAC);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `(B_0_r:(real^3->bool)->bool)`);; +e (ASM_REWRITE_TAC[]);; +e (SET_TAC[]);; + +e (SUBGOAL_THEN `DISJOINT B_0_r_empty (B_0_r_no_empty:(real^3->bool)->bool)` ASSUME_TAC);; +e (REWRITE_TAC[IN_DISJOINT]);; +e (EXPAND_TAC "B_0_r_empty" THEN EXPAND_TAC "B_0_r_no_empty");; +e (STRIP_TAC);; +e (SUBGOAL_THEN `x IN {X | critical_edgeX V X = {}}` ASSUME_TAC);; +e (DEL_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (SUBGOAL_THEN `x IN {X | ~(critical_edgeX V X = {})}` ASSUME_TAC);; +e (DEL_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; + +e (REWRITE_WITH + `sum (B_0_r_empty UNION B_0_r_no_empty) (\X. gammaX V X lmfun) = + sum (B_0_r_empty) (\X. gammaX V X lmfun) + + sum (B_0_r_no_empty) (\X. gammaX V X lmfun)`);; +e (MATCH_MP_TAC SUM_UNION);; +e (ASM_REWRITE_TAC[]);; + +e (SUBGOAL_THEN `&0 <= sum B_0_r_empty (\X. gammaX V X lmfun)` ASSUME_TAC);; +e (MATCH_MP_TAC SUM_POS_LE);; +e STRIP_TAC;; + + e (ASM_REWRITE_TAC[]);; + e (EXPAND_TAC "B_0_r_empty");; + e (EXPAND_TAC "B_0_r");; + e (REWRITE_TAC[REAL_ARITH `&0 <= x <=> x >= &0`]);; + e (MP_TAC (ASSUME + `!X. mcell_set V X /\ critical_edgeX V X = {} ==> + gammaX V X lmfun >= &0`));; + e (SET_TAC[]);; + +e (MATCH_MP_TAC (REAL_ARITH `x <= a /\ &0 <= b ==> x <= b + a`));; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_WITH + `sum B_0_r_no_empty (\X. gammaX V X lmfun) = + sum B_0_r (\X. (gammaX V X lmfun) * + sum (critical_edgeX V X) (\e. critical_weight V X))`);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_WITH +`sum (B_0_r_empty UNION B_0_r_no_empty) + (\X. gammaX V X lmfun * sum (critical_edgeX V X) (\e. critical_weight V X)) = + sum B_0_r_empty + (\X. gammaX V X lmfun * sum (critical_edgeX V X) (\e. critical_weight V X)) + + sum B_0_r_no_empty + (\X. gammaX V X lmfun * sum (critical_edgeX V X) (\e. critical_weight V X))` +);; +e (MATCH_MP_TAC SUM_UNION);; +e (ASM_REWRITE_TAC[]);; + +e (SUBGOAL_THEN + `sum B_0_r_empty + (\X. gammaX V X lmfun * sum (critical_edgeX V X) + (\e. critical_weight V X)) = &0` ASSUME_TAC);; +e (MATCH_MP_TAC SUM_EQ_0);; +e (EXPAND_TAC "B_0_r_empty");; +e (GEN_TAC THEN REWRITE_TAC[IN_INTER;IN_ELIM_THM]);; +e (STRIP_TAC);; +e (MATCH_MP_TAC (MESON[REAL_MUL_RZERO] `x = &0 ==> y * x = &0`));; +e (MATCH_MP_TAC (MESON[SUM_CLAUSES] `x = {} ==> sum x f = &0`));; +e (ASM_REWRITE_TAC[]);; + + +e (ASM_REWRITE_TAC[REAL_ADD_LID]);; +e (MATCH_MP_TAC (SUM_EQ));; +e GEN_TAC;; +e (EXPAND_TAC "B_0_r_no_empty" THEN EXPAND_TAC "B_0_r");; +e (REWRITE_TAC[IN_INTER;IN_ELIM_THM]);; +e DISCH_TAC;; +e (MATCH_MP_TAC (MESON[REAL_MUL_RID] `x = &1 ==> y = y * x`));; +e (REWRITE_TAC[critical_weight]);; +e (SUBGOAL_THEN ) +e (SIMP_TAC[SUM_CONST]);; +e (NEW_GOAL `FINITE (critical_edgeX V x)`);; +e (ASM_SIMP_TAC[FINITE_critical_edgeX]);; +e (ASM_SIMP_TAC[SUM_CONST]);; +e (REWRITE_TAC[REAL_ARITH `a * &1 / a = (a * &1) / a`; REAL_MUL_RID]);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (MATCH_MP_TAC (MESON[REAL_OF_NUM_EQ] `~(x = 0) ==> ~ (&x = &0)`));; +e (UP_ASM_TAC THEN UP_ASM_TAC);; +e (MESON_TAC[CARD_EQ_0]);; + +(* ------------------------------------------------------------------------- *) + +e (ABBREV_TAC + `temp_set = {e:real^3->bool | (?X. X IN B_0_r /\ e IN critical_edgeX V X)}`);; +e (SUBGOAL_THEN `FINITE (temp_set:(real^3->bool)->bool)` ASSUME_TAC);; +e CHEAT_TAC;; + + (* Used CHEAT_TAC here. But it seems to be easy *) + +e (REWRITE_WITH + `sum B_0_r + (\X. gammaX V X lmfun * + sum (critical_edgeX V X) (\e. critical_weight V X)) = + sum B_0_r + (\X. sum (critical_edgeX V X) (\e. gammaX V X lmfun * critical_weight V X))`);; +e (REWRITE_TAC[GSYM SUM_LMUL]);; + +e (REWRITE_WITH + `sum B_0_r + (\X. sum (critical_edgeX V X) (\e. gammaX V X lmfun * critical_weight V X)) = + sum B_0_r + (\X. sum {e | e IN temp_set /\ critical_edgeX V X e} + (\e. gammaX V X lmfun * critical_weight V X))`);; +e (MATCH_MP_TAC SUM_EQ);; +e (GEN_TAC THEN DISCH_TAC THEN REWRITE_TAC[IN_ELIM_THM]);; +e (MATCH_MP_TAC (MESON[] `(s = r) ==> sum s f = sum r f`));; +e (REWRITE_TAC[SET_RULE + `(X = Y) <=> (!x. (x IN X ==> x IN Y) /\ (x IN Y ==> x IN X))`]);; +e (GEN_TAC THEN STRIP_TAC);; +e (REWRITE_TAC[IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (EXPAND_TAC "temp_set" THEN REWRITE_TAC[IN_ELIM_THM]);; +e (EXISTS_TAC `x:real^3 -> bool`);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[IN_ELIM_THM]);; +e (SET_TAC[]);; +e (REWRITE_WITH + `sum B_0_r + (\X. sum {e | e IN temp_set /\ critical_edgeX V X e} + (\e. gammaX V X lmfun * critical_weight V X)) = + sum temp_set + (\e. sum {X | X IN B_0_r /\ critical_edgeX V X e} + (\X. gammaX V X lmfun * critical_weight V X))`);; +e (MATCH_MP_TAC SUM_SUM_RESTRICT);; +e (ASM_REWRITE_TAC[]);; + + + + + + + + + + + +e (REWRITE_WITH +`sum temp_set + (\e. sum {X | X IN B_0_r /\ critical_edgeX V X e} + (\X. gammaX V X lmfun * critical_weight V X)) = +sum temp_set + (\e. sum {X | critical_edgeX V X e} + (\X. gammaX V X lmfun * critical_weight V X))`);; +e (MATCH_MP_TAC SUM_EQ);; +e (EXPAND_TAC "temp_set");; +e (REWRITE_TAC[IN_ELIM_THM]);; +e (GEN_TAC THEN DISCH_TAC);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC SUM_EQ_SUPERSET);; +e (REPEAT STRIP_TAC);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `{X:real^3->bool | X SUBSET ball (vec 0,r) /\ mcell_set V X}`);; + +e (EXPAND_TAC "B_0_r");; + THEN REWRITE_TAC[FINITE_MCELL_SET_LEMMA]);; +e (SET_TAC[]);; +e (SET_TAC[]);; +e (MESON_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[BETA_THM; IN_ELIM_THM]);; + + +FINITE_critical_edgeX;; +FINITE_MCELL_SET_LEMMA;; +e ();; + + + + +e CHEAT_TAC;; +seans_fn();; + + + + + + + + + + + + + + + + +(* ========================================================================== *) + +g `!u v V X. dihX V X (u,v) = dihX V X (v,u)`;; +e (REPEAT GEN_TAC);; +e (REWRITE_TAC[dihX] THEN COND_CASES_TAC);; +e (LET_TAC THEN COND_CASES_TAC);; +e (MESON_TAC[]);; +e (ASM_MESON_TAC[]);; +e (REPEAT LET_TAC THEN COND_CASES_TAC);; +e (REWRITE_TAC[dihX2]);; +e (REPEAT LET_TAC);; +e (REWRITE_WITH `ul':(real^3)list = ul''`);; +e (UP_ASM_TAC THEN MESON_TAC[PAIR_EQ]);; +e (REWRITE_TAC[DIHV_SYM]);; +e COND_CASES_TAC;; +e COND_CASES_TAC;; +e (ASM_MESON_TAC[]);; +e COND_CASES_TAC;; +e (ASM_MESON_TAC[]);; +e COND_CASES_TAC;; +e (REWRITE_TAC[dihX3]);; +e (REPEAT LET_TAC);; +e (REWRITE_WITH `ul':(real^3)list = ul''`);; +e (UP_ASM_TAC THEN MESON_TAC[PAIR_EQ]);; +e (REWRITE_WITH `ul'':(real^3)list = ul`);; +e (UNDISCH_TAC `k'',ul'' = (k:num),(ul:(real^3)list)` THEN MESON_TAC[PAIR_EQ]);; +e (UNDISCH_TAC `cell_params V X = k'',ul''`);; +e (REWRITE_TAC[cell_params]);; +e (SUBGOAL_THEN `k'':num = k /\ ul'':(real^3)list = ul `ASSUME_TAC);; +e (ASM_MESON_TAC[PAIR_EQ]);; +e (SUBGOAL_THEN `k':num = k /\ ul':(real^3)list = ul `ASSUME_TAC);; +e (ASM_MESON_TAC[PAIR_EQ]);; +e (ASM_REWRITE_TAC[]);; +e DISCH_TAC;; +e (SIMP_TAC[SUM_SING]);; + +e (NEW_GOAL +`?p vl. {vl,p | p permutes {0, 1, 2} /\ + vl = left_action_list p ul /\ + v = EL 0 (vl:(real^3)list) /\ + u = EL 1 vl} = + {(vl,p)}`);; +e (ASM_REWRITE_TAC[EXTENSION; IN_ELIM_THM;IN_SING]);; +e (SIMP_TAC[GSYM KY_SING_SET_LEMMA]);; + +e (ABBREV_TAC `p = (\k. if )`) +e (EXISTS_TAC) + +SET_RULE + +let KY_SING_SET_LEMMA = prove ( + `(!y. P y <=> y = x) ==> {y | P y} = {x}`, REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[EXTENSION; IN_ELIM_THM;IN_SING]);; + +e (REWRITE) + + +search [`x IN y`;`x IN z`];; +search [`x IN {y}`];; + +permutes;; + +permutes;; + + +seans_fn();; + + +e CHEAT_TAC;; + + + + + +dihX3;; + +(* ------------------------------------------------------------------------- *) +e (ASM_MESON_TAC[]);; +e COND_CASES_TAC;; +e COND_CASES_TAC;; +e (ASM_MESON_TAC[]);; +e COND_CASES_TAC;; +e (ASM_MESON_TAC[]);; +e COND_CASES_TAC;; +e (ASM_MESON_TAC[]);; +e COND_CASES_TAC;; +e (REWRITE_TAC[dihX4]);; +e (REPEAT LET_TAC);; +e (REWRITE_TAC[REAL_EQ_MUL_LCANCEL]);; +e DISJ2_TAC;; +e CHEAT_TAC;; + + +(* ------------------------------------------------------------------------- *) +e (ASM_MESON_TAC[]);; +e COND_CASES_TAC;; +e (MESON_TAC[]);; +e COND_CASES_TAC;; +e (ASM_MESON_TAC[]);; +e COND_CASES_TAC;; +e (ASM_MESON_TAC[]);; +e COND_CASES_TAC;; +e (ASM_MESON_TAC[]);; +e (MESON_TAC[]);; + + +search [`c * a = c * b`];; +SUM_EQ;; + + + +let FINITE_MCELL_SET_LEMMA = new_axiom + +g `!V r. FINITE {X | X SUBSET ball (vec 0,r) /\ mcell_set V X}`;; +e (REPEAT STRIP_TAC);; +e (REWRITE_TAC[mcell_set]);; + + +seans_fn();; + + +open Sphere;; + +let EMNWUUS1 = new_axiom EMNWUUS1_concl;; +let EMNWUUS2 = new_axiom EMNWUUS2_concl;; + +INTER;; + + + +g `!V X p r. packing V /\ saturated V /\ mcell_set V X /\ + ~(X INTER ball (p,r) = {}) ==> X SUBSET (ball (p, r + &3))`;; +e (REWRITE_TAC[GSYM MEMBER_NOT_EMPTY;SUBSET;ball;IN_ELIM_THM;INTER]);; +e (REPEAT STRIP_TAC);; +e (MATCH_MP_TAC(REAL_ARITH + `dist (p,x) < r /\ + dist (x,x') <= &3 /\ + dist (p,x') <= dist (p,x) + dist (x,x') ==> + dist (p,x') < r + &3 `));; +e (REPEAT STRIP_TAC);; (* 3 subgoals *) + (* Subgoal 1 *) +e (ASM_REWRITE_TAC[]);; (* Finish first subgoal *) + (* Subgoal 2 *) + +e (UNDISCH_TAC `mcell_set V X`);; +e (REWRITE_TAC[mcell_set;IN_ELIM_THM;mcell]);; +e (REPEAT STRIP_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REPEAT COND_CASES_TAC);; +(* Break into more 5 subgoals *) + +e (REWRITE_TAC[mcell0] THEN REPEAT DISCH_TAC);; +e (NEW_GOAL `~affine_dependent (set_of_list (ul:(real^3)list))`);; +e (UP_ASM_TAC THEN REWRITE_TAC[IN;IN_ELIM_THM;BARV]);; +VORONOI_NONDG;; + + + + + +(*-------------------- The lemma about sum of beta_bump ---------------------*) + + +g `!V X. saturated V /\ packing V /\ mcell_set V X ==> + sum {e | e IN critical_edgeX V X } (\e. beta_bump V e X) = &0`;; +e (REPEAT STRIP_TAC THEN UP_ASM_TAC);; +e (REWRITE_TAC[mcell_set; IN_ELIM_THM]);; +e (DISCH_TAC);; +e (REWRITE_TAC[beta_bump]);; +e (REPEAT LET_TAC);; +e (ASM_CASES_TAC `~(k = 4)`);; + + (* Two case. Here is CASE 1*) + +e (NEW_GOAL `!e. sum + {e',e'',p,vl | k = 4 /\ + critical_edgeX V X = {e', e''} /\ + e = e' /\ + p permutes 0..3 /\ + vl = left_action_list p ul /\ + e' = {EL 0 vl, EL 1 vl} /\ + e'' = {EL 2 vl, EL 3 vl}} + (\(e',e'',p,vl). (bump (hl [EL 0 vl; EL 1 vl]) - + bump (hl [EL 2 vl; EL 3 vl])) / + &4) = &0`);; +e GEN_TAC;; +e (ABBREV_TAC `SET1 = {e',e'',p,vl | k = 4 /\ + critical_edgeX V X = {e', e''} /\ + e = e' /\ + p permutes 0..3 /\ + vl = left_action_list p ul /\ + e' = {EL 0 vl, EL 1 vl} /\ + e'' = {EL 2 vl, EL 3 vl}}`);; + +e (NEW_GOAL + `SET1:(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list->bool = {}`);; +e (EXPAND_TAC "SET1");; +e (MP_TAC (ASSUME `~(k = 4)`));; +e (SET_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[SUM_CLAUSES]);; +e (ASM_REWRITE_TAC[SUM_0]);; + + (* Here is case 2 *) + +e (NEW_GOAL `k = 4`);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (SWITCH_TAC THEN DEL_TAC);; +e (SWITCH_TAC);; +e (UP_ASM_TAC THEN REWRITE_TAC[cell_params]);; +e DISCH_TAC;; + +(* ------------------------------------------------------------------------ *) + +e (NEW_GOAL `k <= 4 /\ ul IN barV V 3 /\ X = mcell k V ul`);; +e (NEW_GOAL ` (?k ul. k <= 4 /\ ul IN barV V 3 /\ X = mcell k V ul) /\ ((@(k,ul). k <= 4 /\ ul IN barV V 3 /\ X = mcell k V ul) = k,ul)`);; +e (ASM_REWRITE_TAC[]);; +e (CHOOSE_TAC (ASSUME `?i ul. X = mcell i V ul /\ ul IN barV V 3`));; +e (CHOOSE_TAC (ASSUME `?ul. X = mcell i V ul /\ ul IN barV V 3`));; +e (ASM_CASES_TAC `i <= 4`);; +e (EXISTS_TAC `i:num`);; +e (EXISTS_TAC `ul':(real^3) list`);; +e (ASM_REWRITE_TAC[]);; + +e (EXISTS_TAC `4`);; +e (EXISTS_TAC `ul':(real^3) list`);; +e (ASM_REWRITE_TAC[ARITH_RULE `4 <= 4`]);; +e (REWRITE_TAC[mcell]);; +e (COND_CASES_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC);; +e (MESON_TAC[ARITH_RULE `~(i <= 4) ==> (i = 0) ==> F`]);; +e (DEL_TAC);; +e (COND_CASES_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC);; +e (MESON_TAC[ARITH_RULE `~(i <= 4) ==> (i = 1) ==> F`]);; +e (DEL_TAC);; +e (COND_CASES_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC);; +e (MESON_TAC[ARITH_RULE `~(i <= 4) ==> (i = 2) ==> F`]);; +e (DEL_TAC);; +e (COND_CASES_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC);; +e (MESON_TAC[ARITH_RULE `~(i <= 4) ==> (i = 3) ==> F`]);; +e (DEL_TAC);; +e (COND_CASES_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[ARITH_RULE `4 = 0 ==> F`]);; +e (COND_CASES_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[ARITH_RULE `4 = 1 ==> F`]);; +e (COND_CASES_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[ARITH_RULE `4 = 2 ==> F`]);; +e (COND_CASES_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[ARITH_RULE `4 = 3 ==> F`]);; +e (REWRITE_TAC[]);; +e (UP_ASM_TAC);; + +e (ABBREV_TAC `P = (\k. k <= 4)`);; +e (ABBREV_TAC `Q = (\ul. ul IN barV V 3)`);; +e (ABBREV_TAC `R = (\k ul. X = mcell k V ul)`);; + +e (REWRITE_WITH +`(?k ul. k <= 4 /\ ul IN barV V 3 /\ X = mcell k V ul) /\ + (@(k,ul). k <= 4 /\ ul IN barV V 3 /\ X = mcell k V ul) = k,ul + ==> k <= 4 /\ ul IN barV V 3 /\ X = mcell k V ul <=> + (?k ul. P k /\ Q ul /\ R k ul) /\ (@(k,ul). P k /\ Q ul /\ R k ul) = k,ul + ==> P k /\ Q ul /\ R k ul`);; +e (EXPAND_TAC "P" THEN EXPAND_TAC "Q" THEN EXPAND_TAC "R");; +e (REWRITE_TAC[IN_ELIM_THM]);; +e (REWRITE_TAC[JOHN_SELECT_THM]);; + +e (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN DEL_TAC THEN REPEAT STRIP_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN DEL_TAC THEN REPEAT STRIP_TAC);; +e (REWRITE_WITH `{e | e IN critical_edgeX V X} = critical_edgeX V X`);; +e (SET_TAC[]);; + +(* ------------------------------------------------------------------------- *) + +e (ASM_CASES_TAC + `?(ed:real^3->bool) ed'. ~ (ed = ed') /\ critical_edgeX V X = {ed , ed'}`);; +e (FIRST_X_ASSUM CHOOSE_TAC THEN FIRST_X_ASSUM CHOOSE_TAC);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ASM_SIMP_TAC[SUM_SET_OF_2_ELEMENTS]);; + + +e (NEW_GOAL +`{e',e'',p,vl | {ed, ed'} = {e', e''} /\ + ed' = e' /\ + p permutes 0..3 /\ + vl = left_action_list p ul /\ + e' = {EL 0 vl, EL 1 vl} /\ + e'' = {EL 2 vl, EL 3 vl}} += {ed',ed:real^3->bool,p,vl | p permutes 0..3 /\ + vl = left_action_list p ul /\ + ed' = {EL 0 vl, EL 1 vl} /\ + ed = {EL 2 vl, EL 3 vl}}`);; +e (REWRITE_TAC[EXTENSION;IN;IN_ELIM_THM] THEN GEN_TAC THEN REPEAT STRIP_TAC);; +e (EQ_TAC);; +e (REPEAT STRIP_TAC);; +e (EXISTS_TAC `ed':real^3->bool` THEN EXISTS_TAC `ed:real^3->bool`);; +e (EXISTS_TAC `p:num->num` THEN EXISTS_TAC `vl:(real^3)list`);; +e (NEW_GOAL `ed':real^3->bool = e' /\ ed:real^3->bool = e''`);; +e (ASM_SET_TAC[]);; +e (REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (ASM_MESON_TAC[]);; +e (REWRITE_TAC[ASSUME `x :(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list + = e', e'', p, vl`]);; +e (REWRITE_TAC[PAIR_EQ]);; +e (ASM_REWRITE_TAC[]);; + + +e (REPEAT STRIP_TAC);; +e (EXISTS_TAC `ed'':real^3->bool` THEN EXISTS_TAC `ed''':real^3->bool`);; +e (EXISTS_TAC `p:num->num` THEN EXISTS_TAC `vl:(real^3)list`);; +e (REPEAT STRIP_TAC);; + + +e (SET_TAC[]);; +e (REWRITE_TAC[]);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; + + +e (REWRITE_TAC[ASSUME `x :(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list + = e', e'', p, vl`]);; +e (REWRITE_TAC[PAIR_EQ]);; +e (ASM_REWRITE_TAC[]);; + +seans_fn();; +e () + +e (EXISTS_TAC `ed':real^3->bool` THEN EXISTS_TAC `ed:real^3->bool`);; +e (NEW_GOAL `?(vl:(real^3)list). + ed' = {EL 0 vl, EL 1 vl} /\ ed = {EL 2 vl, EL 3 vl}`);; +e (NEW_GOAL `?ed1:real^3 ed2. ed = {ed1, ed2}`);; +e (NEW_GOAL `critical_edgeX V X ed`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[critical_edgeX;IN_ELIM_THM]);; +e (MESON_TAC[]);; +e (FIRST_X_ASSUM CHOOSE_TAC THEN FIRST_X_ASSUM CHOOSE_TAC);; + +e (NEW_GOAL `?ed1':real^3 ed2'. ed' = {ed1', ed2'}`);; +e (NEW_GOAL `critical_edgeX V X ed'`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[critical_edgeX;IN_ELIM_THM]);; +e (MESON_TAC[]);; +e (FIRST_X_ASSUM CHOOSE_TAC THEN FIRST_X_ASSUM CHOOSE_TAC);; + +e (EXISTS_TAC `[ed1':real^3;ed2';ed1;ed2]`);; +e (ASM_REWRITE_TAC[EL_0;EL_1;EL_2;EL_3]);; +e (FIRST_X_ASSUM CHOOSE_TAC);; +e (EXISTS_TAC `vl:(real^3)list`);; + +e (NEW_GOAL `?p. p permutes 0..3 /\ + (vl:(real^3)list) = left_action_list p ul`);; +e CHEAT_TAC;; +e (FIRST_X_ASSUM CHOOSE_TAC);; +e (EXISTS_TAC `p:num->num`);; +e (REWRITE_TAC[EXTENSION;IN;IN_ELIM_THM] THEN GEN_TAC THEN REPEAT STRIP_TAC);; +e (EQ_TAC);; +e (REPEAT STRIP_TAC);; + THEN REWRITE_TAC [SET_RULE `{y} x <=> y = x`]);; +e (REWRITE_TAC[ASSUME ]);; +e (REWRITE_TAC[PAIR_EQ]);; +e (NEW_GOAL `ed' = (e':real^3->bool) /\ (ed:real^3->bool) = e''`);; +e (ASM_SET_TAC[]);; +e (REPEAT STRIP_TAC);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; +e (NEW_GOAL `vl:(real^3)list = vl':(real^3)list`);; + + +e (ASM_SET_TAC[]);; + +seans_fn();; +e (EXISTS_TAC `(\x:real^3. if x = (EL 0 (ul:(real^3)list)) then (EL 0 vl) else if x = (EL 1 ul) then (EL 1 vl) else if x = (EL 2 ul) then (EL 2 vl) else (EL 3 vl))`);; +e (REWRITE_TAC[left_action_list]);; +inverse;; + + + + +ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1/\ 1 = SUC 0`;EL;HD]);; +e (REWRITE_TAC[EL;ARITH_RULE `2 = SUC 1`]);; +e (REWRITE_TAC[EL;ARITH_RULE `1 = SUC 0`]);; +TL;; + /\ 2 = SUC 1 /\ 1 = SUC 0`]);; +EL;; + +let EL_0 = prove (`!a b c d. EL 0 [a;b;c;d] = a`, REWRITE_TAC[EL;HD]);; + +let EL_1 = prove (`!a b c d. EL 1 [a;b;c;d] = b`, + REWRITE_TAC[EL;ARITH_RULE `1 = SUC 0`;TL;HD]);; +let EL_2 = prove (`!a b c d. EL 2 [a;b;c;d] = c`, + REWRITE_TAC[EL;ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`;TL;HD;EL_1]);; +let EL_3 = prove (`!a b c d. EL 3 [a;b;c;d] = d`, REWRITE_TAC + [EL;ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0 `;TL;HD;EL_2]);; + +critical_edgeX;; + + + + + + + + + + +e (MATCH_MP_TAC SING_SET_KY_LEMMA);; + + {ed, ed'} = {e', e''} /\ + ed' = e' /\ + p permutes 0..3 /\ + vl = left_action_list p ul /\ + e' = {EL 0 vl, EL 1 vl} /\ + e'' = {EL 2 vl, EL 3 vl}`);; + +e CHEAT_TAC;; +e (NEW_GOAL + `?y. {(e':real^3->bool,e'',p,vl)| {ed, ed'} = {e', e''} /\ + ed' = e' /\ + p permutes 0..3 /\ + vl = left_action_list p ul /\ + e' = {EL 0 vl, EL 1 vl} /\ + e'' = {EL 2 vl, EL 3 vl}} = {y}`);; + +e (ASM_MESON_TAC[SING_SET_KY_LEMMA]);; +SING_SET_KY_LEMMA;; + + + THEN SET_TAC[]);; +e (ASM_SET_TAC[]);; + +EXISTS_PAIRED_THM;; + + +(* +g `!P. (?! y:A. P y) ==> (?y. {x| P x} = {y})`;; + +e (REWRITE_TAC[EXISTS_UNIQUE] THEN REPEAT STRIP_TAC);; +e (EXISTS_TAC `y:A` THEN REWRITE_TAC[EXTENSION;IN;IN_ELIM_THM] THEN GEN_TAC);; +e (EQ_TAC);; +e (SET_TAC[]);; +e (REWRITE_TAC [SET_RULE `{y} x <=> y = x`]);; +e (ASM_MESON_TAC[]);; +let SING_SET_KY_LEMMA = top_thm();; + +*) + + + + + + let john_harrison_lemma1 = prove + (`(\(x,y). P x y) = (\p. P (FST p) (SND p))`, + REWRITE_TAC[FUN_EQ_THM; FORALL_PAIR_THM]);; + + let john_harrison_lemma2 = MESON[] `(?x. P x) /\ (@x. P x) = a ==> P a`;; + + let JOHN_SELECT_THM = prove + (`(?x y. P x /\ Q y /\ R x y) /\ + (@(x,y). P x /\ Q y /\ R x y) = (a,b) + ==> P a /\ Q b /\ R a b`, + REWRITE_TAC[GSYM EXISTS_PAIRED_THM] THEN + REWRITE_TAC[john_harrison_lemma1] THEN + DISCH_THEN(MP_TAC o MATCH_MP john_harrison_lemma2) THEN + REWRITE_TAC[FST; SND]);; + + + + + +SET_1 + +search [`x = {a}`];; + +SET_RULE +SUM_SUB;; +seans_fn();; +critical_edgeX;; + + +e CHEAT_TAC;; + + +(* -------------------------------------------------------*) + +e (MATCH_MP_TAC SUM_EQ_0);; +e (GEN_TAC THEN DISCH_TAC THEN REWRITE_TAC[IN_ELIM_THM]);; +e (NEW_GOAL `! e e'. (e = e') \/ ~(critical_edgeX V X = {e, e'})`);; +e (ASM_MESON_TAC[]);; +e (MATCH_MP_TAC SUM_EQ_0);; +e (GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM]);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[IN_ELIM_THM]);; +e (MATCH_MP_TAC (REAL_ARITH `a = &0 ==> a / &4 = &0`));; +e (MATCH_MP_TAC (REAL_ARITH `a = b ==> a - b = &0`));; +e (AP_TERM_TAC);; +e (REWRITE_TAC[HL]);; +e (AP_TERM_TAC);; +e (REWRITE_WITH `!a:real^3 b. set_of_list[a;b] = {a, b}`);; +e (MESON_TAC[set_of_list]);; +e (REWRITE_TAC[GSYM + (ASSUME `vl:(real^3)list = left_action_list (p:num->num) ul`)]);; +e (SUBGOAL_THEN `e':real^3->bool = e''`ASSUME_TAC);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; + +let SUM_BETA_BUMP_LEMMA = top_thm();; + + +end;; diff --git a/legacy/oldpacking/ky_packing/marchal_cells.hl b/legacy/oldpacking/ky_packing/marchal_cells.hl new file mode 100644 index 0000000..f44db52 --- /dev/null +++ b/legacy/oldpacking/ky_packing/marchal_cells.hl @@ -0,0 +1,680 @@ + +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: Marchal cells *) +(* Chaper : Packing (Clusters) *) +(* Date : October 3, 2010 *) +(* *) +(* ========================================================================= *) + +(* ========================================================================== *) +(* This file contains some lemmas that support for marchalcells part. *) +(* ========================================================================== *) + + + +(* dmtcp *) + +flyspeck_needs "nonlinear/vukhacky_tactics.hl";; +flyspeck_needs "packing/pack_defs.hl";; +flyspeck_needs "packing/pack_concl.hl";; +flyspeck_needs "packing/pack1.hl";; + + + +module Marchal_cells = struct + +open Pack_defs;; +open Pack_concl;; +open Vukhacky_tactics;; +open Pack1;; + + +let XNHPWAB1 = new_axiom XNHPWAB1_concl;; +let XNHPWAB4 = new_axiom XNHPWAB4_concl;; + +(* ========================================================================== *) + +let TRUNCATE_SIMPLEX_GENERAL_0 = prove_by_refinement ( + `!(xl:(real^3)list). ~(xl = []) ==> truncate_simplex 0 xl = [HD xl]`, +[ (REPEAT STRIP_TAC); + (REWRITE_TAC[TRUNCATE_SIMPLEX;INITIAL_SUBLIST]); + (MATCH_MP_TAC SELECT_UNIQUE); + (GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN EQ_TAC); + STRIP_TAC; + + (NEW_GOAL `?x xl. (y:(real^3)list) = CONS x xl /\ LENGTH xl = 0`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (NEW_GOAL `(xl':(real^3)list) = []`); + (ASM_MESON_TAC[LENGTH_EQ_NIL]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (MESON[] `x = y ==> [x] = [y]`)); + (ASM_REWRITE_TAC[APPEND;HD]); + STRIP_TAC; + + (ASM_REWRITE_TAC[LENGTH;HD;ARITH_RULE `SUC 0 = 0 + 1`]); + + (NEW_GOAL `?h:real^3 t. xl = CONS h t`); + (ASM_MESON_TAC[list_CASES]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `t:(real^3)list`); + (ASM_REWRITE_TAC[HD;APPEND])]);; + + + +let TRUNCATE_SIMPLEX_EXPLICIT_0 = prove_by_refinement ( + `!u0 u1 u2 u3:real^3. truncate_simplex 0 [u0] = [u0] /\ + truncate_simplex 0 [u0;u1] = [u0] /\ + truncate_simplex 0 [u0;u1;u2] = [u0] /\ + truncate_simplex 0 [u0;u1;u2;u3] = [u0]`, +[ (REPEAT STRIP_TAC); + (NEW_GOAL `~([u0:real^3] = [])`); + (MESON_TAC[NOT_CONS_NIL]); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_GENERAL_0;HD]); + (NEW_GOAL `~([u0:real^3;u1] = [])`); + (MESON_TAC[NOT_CONS_NIL]); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_GENERAL_0;HD]); + (NEW_GOAL `~([u0:real^3;u1;u2] = [])`); + (MESON_TAC[NOT_CONS_NIL]); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_GENERAL_0;HD]); + (NEW_GOAL `~([u0:real^3;u1;u2;u3] = [])`); + (MESON_TAC[NOT_CONS_NIL]); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_GENERAL_0;HD])]);; + + +(* -------------------------------------------------------------------------- *) + + +let TRUNCATE_SIMPLEX_GENERAL_1 = prove_by_refinement ( + `!ul vl a b:real^3. + (ul = APPEND [a;b] vl) ==> truncate_simplex 1 ul = [a;b]`, +[ (REPEAT STRIP_TAC); + (REWRITE_TAC[TRUNCATE_SIMPLEX;INITIAL_SUBLIST]); + (MATCH_MP_TAC SELECT_UNIQUE); + (GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN EQ_TAC); + STRIP_TAC; + + (NEW_GOAL `?x xl. (y:(real^3)list) = CONS x xl /\ LENGTH xl = 1`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `?z zl. (xl:(real^3)list) = CONS z zl /\ LENGTH zl = 0`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `(zl:(real^3)list) = []`); + (ASM_MESON_TAC[LENGTH_EQ_NIL]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (MESON[] `x = y /\ z = t ==> [x;z] = [y;t]`)); + (UNDISCH_TAC `ul:(real^3)list = APPEND y yl`); + (ASM_REWRITE_TAC[APPEND]); + (MESON_TAC[CONS_11]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[LENGTH;ARITH_RULE `SUC (SUC 0) = 1 + 1`]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[])]);; + + +(* -------------------------------------------------------------------------- *) + +let TRUNCATE_SIMPLEX_EXPLICIT_1 = prove_by_refinement ( + `!a b c (d:real^3). truncate_simplex 1 [a;b] = [a;b] /\ + truncate_simplex 1 [a;b;c] = [a;b] /\ + truncate_simplex 1 [a;b;c;d] = [a;b]`, +[ (REPEAT STRIP_TAC); + (NEW_GOAL `[a;b] = APPEND [a:real^3; b] []`); + (MESON_TAC[APPEND_NIL]); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_GENERAL_1]); + (NEW_GOAL `[a;b;c] = APPEND [a:real^3; b] [c]`); + (REWRITE_TAC[APPEND]); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_GENERAL_1]); + (NEW_GOAL `[a;b;c;d] = APPEND [a:real^3; b] [c;d]`); + (REWRITE_TAC[APPEND]); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_GENERAL_1])]);; + + +(* -------------------------------------------------------------------------- *) + +let TRUNCATE_SIMPLEX_GENERAL_2 = prove_by_refinement ( + `!a b c:real^3 ul vl. + ul = APPEND [a;b;c] vl ==> truncate_simplex 2 ul = [a;b;c]`, +[ (REPEAT STRIP_TAC); + (REWRITE_TAC[TRUNCATE_SIMPLEX;INITIAL_SUBLIST]); + (MATCH_MP_TAC SELECT_UNIQUE); + (GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN EQ_TAC); + STRIP_TAC; + + (NEW_GOAL `?x xl. (y:(real^3)list) = CONS x xl /\ LENGTH xl = 2`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `?z zl. (xl:(real^3)list) = CONS z zl /\ LENGTH zl = 1`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `?t tl. (zl:(real^3)list) = CONS t tl /\ LENGTH tl = 0`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `(tl:(real^3)list) = []`); + (ASM_MESON_TAC[LENGTH_EQ_NIL]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (MESON[] `x = y /\ z = t /\ s = r ==> [x;z;s] = [y;t;r]`)); + (UNDISCH_TAC `ul:(real^3)list = APPEND y yl`); + (ASM_REWRITE_TAC[APPEND;CONS_11]); + (MESON_TAC[]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[LENGTH;ARITH_RULE + `SUC (1 + 1) = 2 + 1 /\ SUC (SUC (SUC 0)) = 2 + 1`]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[])]);; + + +(* -------------------------------------------------------------------------- *) + +let TRUNCATE_SIMPLEX_EXPLICIT_2 = prove_by_refinement ( + `!a b c d:real^3. + truncate_simplex 2 [a; b; c] = [a; b; c] /\ + truncate_simplex 2 [a; b; c; d] = [a; b; c]`, +[ (REPEAT STRIP_TAC); + (NEW_GOAL `[a;b;c] = APPEND [a:real^3; b; c] []`); + (MESON_TAC[APPEND_NIL]); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_GENERAL_2]); + (NEW_GOAL `[a;b;c;d] = APPEND [a:real^3; b; c] [d]`); + (REWRITE_TAC[APPEND]); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_GENERAL_2])]);; + + +(* -------------------------------------------------------------------------- *) + +let TRUNCATE_SIMPLEX_EXPLICIT_3 = prove_by_refinement ( + `!a b c d:real^3. + truncate_simplex 3 [a; b; c; d] = [a; b; c; d]`, +[ (REPEAT STRIP_TAC); + (REWRITE_TAC[TRUNCATE_SIMPLEX;INITIAL_SUBLIST]); + (MATCH_MP_TAC SELECT_UNIQUE); + (GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN EQ_TAC); + STRIP_TAC; + + (NEW_GOAL `?x xl. (y:(real^3)list) = CONS x xl /\ LENGTH xl = 3`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `?z zl. (xl:(real^3)list) = CONS z zl /\ LENGTH zl = 2`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `?t tl. (zl:(real^3)list) = CONS t tl /\ LENGTH tl = 1`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `?w wl. (tl:(real^3)list) = CONS w wl /\ LENGTH wl = 0`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `(wl:(real^3)list) = []`); + (ASM_MESON_TAC[LENGTH_EQ_NIL]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `LENGTH [a;b;c;d:real^3] = + LENGTH (y:(real^3)list) + LENGTH (yl:(real^3)list)`); + (ASM_MESON_TAC[LENGTH_APPEND]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[LENGTH] THEN DISCH_TAC); + (NEW_GOAL `(yl:(real^3)list) = ([]:(real^3)list)`); + (REWRITE_TAC[GSYM LENGTH_EQ_NIL]); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[APPEND]); + + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[LENGTH;ARITH_RULE + `SUC (2 + 1) = 3 + 1 /\ SUC (SUC (SUC 0)) = 2 + 1`]); + + (EXISTS_TAC `[]:(real^3)list`); + (ASM_REWRITE_TAC[APPEND])]);; + + +(* -------------------------------------------------------------------------- *) + +let OMEGA_LIST_TRUNCATE_0 = prove_by_refinement ( + `!V u0:real^3 u1 u2 u3. + omega_list_n V [u0;u1;u2;u3] 0 = omega_list V [u0] `, +[ (REPEAT GEN_TAC); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH [u0:real^3] - 1 = 0`); + (REWRITE_TAC[LENGTH; ARITH_RULE `SUC 0 - 1 = 0`]); + (REWRITE_TAC[OMEGA_LIST_N]); + (MESON_TAC[HD])]);; + + +(* -------------------------------------------------------------------------- *) + +let OMEGA_LIST_TRUNCATE_1 = prove_by_refinement ( + `!V u0:real^3 u1 u2 u3. + omega_list_n V [u0;u1;u2;u3] 1 = omega_list V [u0;u1] `, +[ (REPEAT GEN_TAC); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH [u0:real^3;u1] - 1 = 1`); + (REWRITE_TAC[LENGTH; ARITH_RULE `SUC (SUC 0) - 1 = 1`]); + (REWRITE_TAC[ARITH_RULE `1 = SUC 0`; OMEGA_LIST_N]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`;TRUNCATE_SIMPLEX_EXPLICIT_1;HD])]);; + + + +let OMEGA_LIST_TRUNCATE_2 = prove_by_refinement ( + `!V u0:real^3 u1 u2 u3. + omega_list_n V [u0;u1;u2;u3] 2 = omega_list V [u0;u1;u2] `, +[ (REPEAT GEN_TAC); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH [u0:real^3;u1;u2] - 1 = 2`); + (REWRITE_TAC[LENGTH; ARITH_RULE `SUC (SUC (SUC 0)) - 1 = 2`]); + (REWRITE_TAC[ARITH_RULE `2 = SUC 1`; OMEGA_LIST_N]); + (REWRITE_TAC[ARITH_RULE `SUC 1 = 2`;TRUNCATE_SIMPLEX_EXPLICIT_2;HD]); + (REPEAT AP_TERM_TAC); + (REWRITE_TAC[ARITH_RULE `1 = SUC 0`; OMEGA_LIST_N;HD]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`;TRUNCATE_SIMPLEX_EXPLICIT_1;HD])]);; + + +(* -------------------------------------------------------------------------- *) + +(* -------------------------------------------------------------------------- *) +let OMEGA_LIST_0_EXPLICIT = prove_by_refinement ( + `!a:real^3 b c V ul. + saturated V /\ + packing V /\ + ul IN barV V 3 /\ + hl ul < sqrt (&2) /\ + ul = [a; b; c; d] + ==> omega_list_n V ul 0 = a`, +[ (REPEAT STRIP_TAC); + (REWRITE_TAC[OMEGA_LIST_N]); + (ASM_MESON_TAC[HD])]);; + + +(* -------------------------------------------------------------------------- *) + +let OMEGA_LIST_1_EXPLICIT = prove_by_refinement ( + `!a:real^3 b c d V ul. + saturated V /\ + packing V /\ + ul IN barV V 3 /\ + hl ul < sqrt (&2) /\ + ul = [a; b; c; d] + ==> omega_list_n V ul 1 = circumcenter {a, b}`, +[ (REPEAT STRIP_TAC); + (REWRITE_WITH `{a,b} = set_of_list [a;(b:real^3)]`); + (MESON_TAC[set_of_list]); + (REWRITE_WITH `circumcenter (set_of_list [a; b:real^3]) = omega_list V [a:real^3; b]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC XNHPWAB1); + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + (MP_TAC (ASSUME `ul IN barV V 3`) THEN REWRITE_TAC[IN;BARV]); + + (REPEAT STRIP_TAC); + (REWRITE_TAC[LENGTH;ARITH_RULE `SUC (SUC 0) = 1 + 1`]); + (NEW_GOAL `initial_sublist vl (ul:(real^3)list)`); + (UNDISCH_TAC `initial_sublist vl [a:real^3; b]`); + (REWRITE_TAC[INITIAL_SUBLIST] THEN STRIP_TAC); + (EXISTS_TAC `APPEND yl [c;d:real^3]`); + (REWRITE_TAC[APPEND_ASSOC; GSYM (ASSUME `[a:real^3; b] = APPEND vl yl`)]); + (ASM_REWRITE_TAC[APPEND]); + (ASM_MESON_TAC[]); + (MATCH_MP_TAC (REAL_ARITH `hl (ul:(real^3)list) < b /\ a < hl ul ==> a < b`)); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `[a;b:real^3] = truncate_simplex 1 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_WITH `[a;b;c;d:real^3] = truncate_simplex 3 ul`); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3]); + (NEW_GOAL `!i j. i < j /\ j <= 3 + ==> hl (truncate_simplex i (ul:(real^3)list)) + < hl (truncate_simplex j ul)`); + (MATCH_MP_TAC XNHPWAB4); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + (ASM_REWRITE_TAC[OMEGA_LIST_TRUNCATE_1])]);; + +(* -------------------------------------------------------------------------- *) + +let OMEGA_LIST_2_EXPLICIT = prove_by_refinement ( + `!a:real^3 b c d V ul. + saturated V /\ + packing V /\ + ul IN barV V 3 /\ + hl ul < sqrt (&2) /\ + ul = [a; b; c; d] + ==> omega_list_n V ul 2 = circumcenter {a, b , c}`, +[ (REPEAT STRIP_TAC); + (REWRITE_WITH `{a,b, c} = set_of_list [a;(b:real^3);c]`); + (MESON_TAC[set_of_list]); + (REWRITE_WITH `circumcenter (set_of_list [a; b:real^3;c]) = omega_list V [a;b;c]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC XNHPWAB1); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (MP_TAC (ASSUME `ul IN barV V 3`) THEN REWRITE_TAC[IN;BARV]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[LENGTH;ARITH_RULE `SUC (SUC (SUC 0)) = 2 + 1`]); + (NEW_GOAL `initial_sublist vl (ul:(real^3)list)`); + (UNDISCH_TAC `initial_sublist vl [a:real^3; b;c]`); + (REWRITE_TAC[INITIAL_SUBLIST] THEN STRIP_TAC); + (EXISTS_TAC `APPEND yl [d:real^3]`); + (REWRITE_TAC[APPEND_ASSOC; GSYM (ASSUME `[a:real^3; b; c] = APPEND vl yl`)]); + (ASM_REWRITE_TAC[APPEND]); + (ASM_MESON_TAC[]); + (MATCH_MP_TAC (REAL_ARITH `hl (ul:(real^3)list) < b /\ a < hl ul ==> a < b`)); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `[a;b:real^3;c] = truncate_simplex 2 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_WITH `[a;b;c;d:real^3] = truncate_simplex 3 ul`); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3]); + + (NEW_GOAL `!i j. i < j /\ j <= 3 + ==> hl (truncate_simplex i (ul:(real^3)list)) + < hl (truncate_simplex j ul)`); + (MATCH_MP_TAC XNHPWAB4); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + (ASM_REWRITE_TAC[OMEGA_LIST_TRUNCATE_2])]);; + + +(* -------------------------------------------------------------------------- *) + + +let OMEGA_LIST_3_EXPLICIT = prove_by_refinement ( + `!a:real^3 b c d V ul. + saturated V /\ + packing V /\ + ul IN barV V 3 /\ + hl ul < sqrt (&2) /\ + ul = [a; b; c; d] + ==> omega_list_n V ul 3 = circumcenter {a, b , c, d}`, +[ (REPEAT STRIP_TAC); + (REWRITE_WITH `{a,b, c,d} = set_of_list [a;(b:real^3);c;d]`); + (MESON_TAC[set_of_list]); + (REWRITE_WITH `circumcenter (set_of_list [a; b:real^3;c;d]) = omega_list V [a;b;c;d]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC XNHPWAB1); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[ARITH_RULE `3 <= 3`]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH [a:real^3; b; c; d] - 1 = 3`); + (REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (ASM_REWRITE_TAC[])]);; + + +(* ------------------------------------------------------------------------- *) + +let BARV_3_EXPLICIT = prove_by_refinement ( + `!V vl. barV V 3 vl ==> ? u0 u1 u2 u3. vl = [u0;u1;u2;u3]`, +[(REPEAT GEN_TAC); + (REWRITE_TAC[BARV]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?x0 xl. (vl:(real^3)list) = CONS x0 xl /\ LENGTH xl = 3`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `x0:real^3`); + + (NEW_GOAL `?x1 yl. (xl:(real^3)list) = CONS x1 yl /\ LENGTH yl = 2`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `x1:real^3`); + + (NEW_GOAL `?x2 zl. (yl:(real^3)list) = CONS x2 zl /\ LENGTH zl = 1`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `x2:real^3`); + + (NEW_GOAL `?x3 tl. (zl:(real^3)list) = CONS x3 tl /\ LENGTH tl = 0`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `x3:real^3`); + + (NEW_GOAL `(tl:(real^3)list) = []`); + (ASM_MESON_TAC[LENGTH_EQ_NIL]); + (ASM_REWRITE_TAC[])]);; + + +(* ------------------------------------------------------------------------- *) + +let BARV_K_EXPLICIT = prove_by_refinement ( + `!V a b c d. + barV V 3 [a; b; c; d] + ==> barV V 2 [a; b; c] /\ barV V 1 [a; b] /\ barV V 0 [a]`, +[ (REPEAT GEN_TAC); + (REWRITE_TAC[BARV]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[LENGTH;ARITH_RULE `SUC (SUC (SUC 0)) = 2 + 1`]); + (MATCH_MP_TAC (ASSUME + `!vl. initial_sublist vl [a:real^3; b; c; d] /\ 0 < LENGTH vl + ==> voronoi_nondg V vl`)); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `initial_sublist vl [a; b; c:real^3]` THEN + REWRITE_TAC[INITIAL_SUBLIST]); + (STRIP_TAC); + (EXISTS_TAC `APPEND yl [d:real^3]`); + (REWRITE_TAC[APPEND_ASSOC; GSYM (ASSUME `[a; b; c:real^3] = APPEND vl yl`)]); + (REWRITE_TAC[APPEND]); + (REWRITE_TAC[LENGTH]); + (ARITH_TAC); + + (MATCH_MP_TAC (ASSUME + `!vl. initial_sublist vl [a:real^3; b; c; d] /\ 0 < LENGTH vl + ==> voronoi_nondg V vl`)); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `initial_sublist vl [a; b:real^3]` THEN + REWRITE_TAC[INITIAL_SUBLIST]); + (STRIP_TAC); + (EXISTS_TAC `APPEND yl [c;d:real^3]`); + (REWRITE_TAC[APPEND_ASSOC; GSYM (ASSUME `[a; b:real^3] = APPEND vl yl`)]); + (REWRITE_TAC[APPEND]); + (REWRITE_TAC[LENGTH]); + (ARITH_TAC); + + (MATCH_MP_TAC (ASSUME + `!vl. initial_sublist vl [a:real^3; b; c; d] /\ 0 < LENGTH vl + ==> voronoi_nondg V vl`)); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `initial_sublist vl [a:real^3]` THEN + REWRITE_TAC[INITIAL_SUBLIST]); + (STRIP_TAC); + (EXISTS_TAC `APPEND yl [b;c;d:real^3]`); + (REWRITE_TAC[APPEND_ASSOC; GSYM (ASSUME `[a:real^3] = APPEND vl yl`)]); + (REWRITE_TAC[APPEND])]);; + + +(* ------------------------------------------------------------------------- *) + +let AFF_DIM_LE_LENGTH = prove_by_refinement ( + `!xl n. LENGTH xl = n ==> aff_dim (set_of_list (xl:(real^3)list)) < &n`, +[ (REPEAT GEN_TAC THEN DISCH_TAC); + (ABBREV_TAC `s = set_of_list (xl:(real^3)list)`); + (NEW_GOAL `?b. ~affine_dependent b /\ b SUBSET (s:real^3->bool) /\ + affine hull b = affine hull s`); + (MESON_TAC[AFFINE_BASIS_EXISTS]); + (FIRST_X_ASSUM CHOOSE_TAC); + (NEW_GOAL `aff_dim (s:real^3->bool) = aff_dim (b:real^3->bool)`); + (REWRITE_WITH `aff_dim (s:real^3->bool) = aff_dim (affine hull s) /\ + aff_dim (b:real^3->bool) = aff_dim (affine hull b)`); + (MESON_TAC[AFF_DIM_AFFINE_HULL]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `aff_dim (b:real^3->bool) = &(CARD b) - &1`); + (ASM_SIMP_TAC[AFF_DIM_AFFINE_INDEPENDENT]); + (NEW_GOAL `int_of_num (CARD (b:real^3->bool)) + <= int_of_num (CARD (s:real^3->bool))`); + (MATCH_MP_TAC (ARITH_RULE `a <= b ==> int_of_num a <= int_of_num b`)); + (MATCH_MP_TAC CARD_SUBSET); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "s"); + (REWRITE_TAC[FINITE_SET_OF_LIST]); + + (NEW_GOAL `int_of_num (CARD (s:real^3->bool)) + <= int_of_num (LENGTH (xl:(real^3)list))`); + (MATCH_MP_TAC (ARITH_RULE `a <= b ==> int_of_num a <= int_of_num b`)); + (EXPAND_TAC "s"); + (REWRITE_TAC[CARD_SET_OF_LIST_LE]); + (ASM_ARITH_TAC) ]);; + + +(* ------------------------------------------------------------------------ *) + +let CONVEX_HULL_SUBSET = prove_by_refinement ( + `!S (S':real^N->bool). + S SUBSET S' ==> (convex hull S) SUBSET (convex hull S')` , +[(REWRITE_TAC[SUBSET;convex;hull;IN;IN_ELIM_THM;INTERS]); + (REPEAT STRIP_TAC); + (NEW_GOAL `!x. S (x:real^N) ==> u x`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN DEL_TAC); + (DISCH_THEN (LABEL_TAC "asm1")); + (USE_THEN "asm1" (MP_TAC o SPEC `u:real^N->bool`) THEN DEL_TAC); + (DISCH_TAC THEN DISCH_TAC THEN SWITCH_TAC THEN DISCH_TAC THEN SWITCH_TAC); + (FIRST_X_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[])]);; + + +(* ------------------------------------------------------------------------- *) + +let BALL_CONVEX_HULL_LEMMA = prove_by_refinement ( + `!S s r x:real^N. + (!x. S x ==> dist (s,x) < r) + ==> (convex hull S) x + ==> dist (s,x) < r`, +[ (REPEAT STRIP_TAC); + (NEW_GOAL `S SUBSET ball (s:real^N, r)`); + (ASM_REWRITE_TAC[ball;SUBSET;IN;IN_ELIM_THM]); + (NEW_GOAL `(convex hull S) SUBSET ball (s:real^N, r)`); + (NEW_GOAL `convex hull ball(s:real^N,r) = ball (s,r)`); + (REWRITE_TAC[CONVEX_HULL_EQ;CONVEX_BALL]); + (ASM_MESON_TAC[CONVEX_HULL_SUBSET]); + (REWRITE_WITH `!a x r. dist (a,x:real^N) < r <=> x IN ball(a,r)`); + (REWRITE_TAC[IN;IN_ELIM_THM;ball] ); + (ASM_SET_TAC[])]);; + + +(* ------------------------------------------------------------------------- *) + +let CONVEX_RCONE_GT = prove_by_refinement ( + `!a:real^N b r. &0 <= r ==> convex (rcone_gt a b r)`, +[ (REPEAT STRIP_TAC); + (REWRITE_TAC[rcone_gt;convex;rconesgn;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `(u % x + v % y) - a = u % (x - a) + v % (y - a:real^N)`); + (ASM_REWRITE_TAC[VECTOR_SUB_LDISTRIB; VECTOR_MUL_LID; + VECTOR_ARITH `a - x % b + c - y % b = (a + c) - (x + y) % b`]); + (REWRITE_TAC[DOT_LADD;DOT_LMUL]); + (ASM_CASES_TAC `&0 < u`); + + (* 2 Subgoals *) + + (NEW_GOAL + `u * ((x:real^N - a) dot (b - a)) + v * ((y - a) dot (b - a)) > + u * dist (x,a) * dist (b,a) * r + v * dist (y,a) * dist (b,a) * r`); + (* Subgoal 1.1 *) + + (NEW_GOAL + `u * ((x:real^N - a) dot (b - a)) > u * dist (x,a) * dist (b,a) * r`); + (MATCH_MP_TAC (REAL_ARITH `&0 < a - b ==> a > b`)); + (REWRITE_TAC[REAL_ARITH `a * b * c * d = a * (b * c * d)`; + REAL_ARITH `a * b - a * c = a * (b - c)`]); + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL + `v * ((y:real^N - a) dot (b - a)) >= v * dist (y,a) * dist (b,a) * r`); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a - b ==> a >= b`)); + (REWRITE_TAC[REAL_ARITH `a * b * c * d = a * (b * c * d)`; + REAL_ARITH `a * b - a * c = a * (b - c)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL +`dist (u % x + v % y,a) * dist (b,a:real^N) * r <= + u * dist (x,a) * dist (b,a) * r + v * dist (y,a) * dist (b,a) * r`); + (* Subgoal 1.2 *) + + (MATCH_MP_TAC (REAL_ARITH `&0 <= a - b ==> b <= a`)); + (REWRITE_TAC[REAL_ARITH `(a * b * x + c * d * x) - e * x = + (a * b + c * d - e) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + STRIP_TAC; + (REWRITE_TAC[dist]); + (REWRITE_WITH `(u % x + v % y) - a = u % (x - a) + v % (y - a:real^N)`); + (ASM_REWRITE_TAC[VECTOR_SUB_LDISTRIB; VECTOR_MUL_LID; + VECTOR_ARITH `a - x % b + c - y % b = (a + c) - (x + y) % b`]); + (REWRITE_TAC[REAL_ARITH `&0 <= a + b - c <=> c <= a + b`]); + (MATCH_MP_TAC (REAL_ARITH + `m <= norm (u % (x - a:real^N)) + norm (v % (y - a)) /\ + norm (u % (x - a)) = b /\ + norm (v % (y - a)) = c ==> m <= b + c`)); + (REWRITE_TAC[NORM_TRIANGLE;NORM_MUL]); + (REWRITE_WITH `abs u = u /\ abs v = v`); + (ASM_SIMP_TAC[REAL_ABS_REFL]); + + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + +(* Subgoal 2 *) + + (NEW_GOAL `u = &0`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `v = &1`); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_MUL_LZERO;REAL_ADD_LID;REAL_MUL_LID]); + (ASM_REWRITE_TAC[VECTOR_MUL_LZERO;VECTOR_ADD_LID;VECTOR_MUL_LID])]);; + + + +(* ------------------------------------------------------------------------- *) + +let RCONE_GT_CONVEX_HULL_LEMMA = prove_by_refinement ( + `!a:real^N b r s. + (s SUBSET rcone_gt a b r) /\ &0 <= r ==> + (convex hull s SUBSET rcone_gt a b r)`, +[ (REPEAT STRIP_TAC); + (ASM_MESON_TAC[CONVEX_HULL_SUBSET;CONVEX_RCONE_GT; CONVEX_HULL_EQ])]);; + + + +end;; diff --git a/legacy/oldpacking/packing/development/Backup/GRUTOTI.hl b/legacy/oldpacking/packing/development/Backup/GRUTOTI.hl new file mode 100644 index 0000000..7a0dca0 --- /dev/null +++ b/legacy/oldpacking/packing/development/Backup/GRUTOTI.hl @@ -0,0 +1,7970 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: GRUTOTI *) +(* Chaper : Packing *) +(* *) +(* ========================================================================= *) +(* *) +(* flyspeck_needs "packing/marchal_cells_3.hl";; *) +(* *) +(* ========================================================================= *) + +let GRUTOTI1_concl = +`!V u0 u1 e. + saturated V /\ + packing V /\ + u0 IN V /\ + u1 IN V /\ + ~(u0 = u1) /\ + hl [u0;u1] < sqrt (&2) /\ + e = {u0, u1} + ==> sum {X | mcell_set V X /\ e IN edgeX V X } (\t. dihX V t (u0,u1)) = + &2 * pi`;; + +let GRUTOTI = prove_by_refinement (GRUTOTI1_concl, +[(REPEAT STRIP_TAC); + (NEW_GOAL `barV V 1 [u0;u1:real^3]`); + (MATCH_MP_TAC HL_LE_SQRT2_IMP_BARV_1); + (ASM_REWRITE_TAC[]); + (NEW_GOAL + `{k | k IN 1..3 /\ + voronoi_list V [u0;u1:real^3] = + UNIONS + {convex hull + ({omega_list_n V vl i | i IN 1..k - 1} UNION + voronoi_list V vl) | vl | barV V k vl /\ + truncate_simplex 1 vl = [u0;u1]}} = + 1..3`); + (MATCH_MP_TAC Rogers.GLTVHUM_lemma1); + (ASM_REWRITE_TAC[] THEN ARITH_TAC); + (NEW_GOAL + `3 IN {k | k IN 1..3 /\ + voronoi_list V [u0; u1] = + UNIONS + {convex hull + ({omega_list_n V vl i | i IN 1..k - 1} UNION voronoi_list V vl) | vl | + barV V k vl /\ + truncate_simplex 1 vl = [u0; u1]}}`); + (ASM_REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC); + (UP_ASM_TAC THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (REWRITE_WITH + `UNIONS + {convex hull ({omega_list_n V vl i | i IN 1..3 - 1} UNION voronoi_list V vl) | vl | barV V 3 vl /\ + truncate_simplex 1 vl = [u0; u1]} = + UNIONS {convex hull {omega_list_n V vl 1, omega_list_n V vl 2, + omega_list_n V vl 3} | vl | barV V 3 vl /\ + truncate_simplex 1 vl = [u0; u1]}`); + (ONCE_REWRITE_TAC[SET_EQ_LEMMA]); + (REWRITE_TAC[IN_UNIONS] THEN ONCE_REWRITE_TAC[IN] THEN + REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `t:real^3->bool` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?a. voronoi_list V vl = {a} /\ + a = circumcenter (set_of_list vl) /\ + hl vl = dist (HD vl,a)`); + (MATCH_MP_TAC Marchal_cells_2_new.VORONOI_LIST_3_SINGLETON_EXPLICIT); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `omega_list_n V vl 3 IN voronoi_list V vl`); + (REWRITE_WITH `omega_list_n V vl 3 = omega_list V vl`); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `(3 + 1) - 1 = 3`]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `omega_list_n V vl 3 = a`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; IN_NUMSEG; + ARITH_RULE `1 <= i /\ i <= 2 <=> i = 1 \/ i = 2`]); + (REWRITE_WITH `{omega_list_n V vl i | i = 1 \/ i = 2} = + {omega_list_n V vl 1,omega_list_n V vl 2}`); + (SET_TAC[]); + (REWRITE_WITH `{omega_list_n V vl 1, omega_list_n V vl 2} UNION + {circumcenter (set_of_list vl)} = {omega_list_n V vl 1, omega_list_n V vl 2, circumcenter (set_of_list vl)}`); + (SET_TAC[]); + + (EXISTS_TAC `t:real^3->bool` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?a. voronoi_list V vl = {a} /\ + a = circumcenter (set_of_list vl) /\ + hl vl = dist (HD vl,a)`); + (MATCH_MP_TAC Marchal_cells_2_new.VORONOI_LIST_3_SINGLETON_EXPLICIT); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `omega_list_n V vl 3 IN voronoi_list V vl`); + (REWRITE_WITH `omega_list_n V vl 3 = omega_list V vl`); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `(3 + 1) - 1 = 3`]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `omega_list_n V vl 3 = a`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; IN_NUMSEG; + ARITH_RULE `1 <= i /\ i <= 2 <=> i = 1 \/ i = 2`]); + (REWRITE_WITH `{omega_list_n V vl i | i = 1 \/ i = 2} = + {omega_list_n V vl 1,omega_list_n V vl 2}`); + (SET_TAC[]); + (REWRITE_WITH `{omega_list_n V vl 1, omega_list_n V vl 2} UNION + {circumcenter (set_of_list vl)} = {omega_list_n V vl 1, omega_list_n V vl 2, + circumcenter (set_of_list vl)}`); + (SET_TAC[]); + (STRIP_TAC); + +(* ======================================================================= *) + + (ABBREV_TAC `p = circumcenter {u0, u1:real^3}`); + (NEW_GOAL `aff_dim (u0 INSERT voronoi_list V [u0;u1]) = &3`); + (REWRITE_TAC[AFF_DIM_INSERT]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + + (NEW_GOAL `affine hull voronoi_list V [u0; u1] SUBSET + affine hull {x | &2 % (u0 - u1) dot x = norm u0 pow 2 - norm u1 pow 2}`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA); + (REWRITE_TAC[VORONOI_LIST; set_of_list; Packing3.VORONOI_SET_2]); + (ONCE_REWRITE_TAC[SET_RULE `a INTER b = b INTER a`]); + (ASM_SIMP_TAC[Pack2.INTER_VORONOI_SUBSET_BISECTOR]); + (NEW_GOAL + `affine hull {x | &2 % (u0 - u1) dot x = norm u0 pow 2 - norm u1 pow 2} = + {x:real^3 | &2 % (u0 - u1) dot x = norm u0 pow 2 - norm u1 pow 2}`); + (REWRITE_TAC[AFFINE_HULL_EQ]); + (REWRITE_TAC[AFFINE_HYPERPLANE]); + (NEW_GOAL + `~(u0 IN {x:real^3 | &2 % (u0 - u1) dot x = norm u0 pow 2 - norm u1 pow 2})`); + (REWRITE_TAC[IN; IN_ELIM_THM; NORM_POW_2]); + (ONCE_REWRITE_TAC [REAL_ARITH `a = b <=> a - b = &0`]); + (REWRITE_TAC[VECTOR_ARITH `&2 % (u0 - u1) dot u0 - (u0 dot u0 - u1 dot u1) = + (u0 - u1) dot (u0 - u1)`]); + (REWRITE_TAC[DOT_EQ_0] THEN ASM_NORM_ARITH_TAC); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[ARITH_RULE `a + &1 = b:int <=> a = b - &1`]); + (MATCH_MP_TAC Packing3.AFF_DIM_VORONOI_LIST); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `aff_dim (u0 INSERT voronoi_list V [u0; u1]) = &(dimindex (:3))`); + (ASM_REWRITE_TAC[DIMINDEX_3]); + (UP_ASM_TAC THEN REWRITE_TAC[AFF_DIM_EQ_FULL]); + (STRIP_TAC); + + (ABBREV_TAC `S = voronoi_list V [u0;u1]`); + (NEW_GOAL `!x. x IN S ==> (x - u0) dot (u1 - u0) = + dist (p, u0) * dist (u1, u0:real^3)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `p = inv (&2) % (u0 + (u1:real^3))`); + (EXPAND_TAC "p" THEN REWRITE_TAC[Rogers.CIRCUMCENTER_2; midpoint]); + (REWRITE_TAC[dist]); + (REWRITE_WITH `u1 - u0 = &2 % (p - u0:real^3)`); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; REAL_ARITH `abs (&2) = &2`; + REAL_ARITH `a * b * a = b * a pow 2`; NORM_POW_2; DOT_RMUL]); + (REWRITE_WITH `(x - u0) dot (p - u0:real^3) = + (p - u0) dot (p - u0) - (x - p) dot (u0 - p)`); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `(x - p) dot (u0 - p:real^3) = &0`); + (EXPAND_TAC "p"); + (REWRITE_WITH `{u0, u1} = set_of_list [u0; u1:real^3]`); + (REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `S SUBSET affine hull voronoi_list V [u0; u1]`); + (EXPAND_TAC "S"); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (ASM_SET_TAC[]); + (REWRITE_TAC[set_of_list]); + (NEW_GOAL `{u0,u1} SUBSET affine hull {u0,u1:real^3}`); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (ASM_SET_TAC[]); + (REAL_ARITH_TAC); + +(* ========================================================================= *) + + (ABBREV_TAC `S1 = {x:real^3 | &2 % (u0 - u1) dot x = + norm u0 pow 2 - norm u1 pow 2}`); + (ABBREV_TAC `S2:real^3->bool = (S1 DIFF (relative_interior S))`); + (NEW_GOAL `closed_in (subtopology euclidean (S1:real^3->bool)) S2`); + (EXPAND_TAC "S2"); + (MATCH_MP_TAC CLOSED_IN_DIFF); + (STRIP_TAC); + (NEW_GOAL `closed (S1:real^3->bool)`); + (EXPAND_TAC "S1" THEN REWRITE_TAC[CLOSED_HYPERPLANE]); + (MATCH_MP_TAC CLOSED_SUBSET); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + + (REWRITE_WITH `S1 = affine hull (S:real^3->bool)`); + (EXPAND_TAC "S"); + (NEW_GOAL `affine hull S1 = S1:real^3->bool`); + (REWRITE_TAC[AFFINE_HULL_EQ]); + (EXPAND_TAC "S1" THEN REWRITE_TAC[AFFINE_HYPERPLANE]); + (ONCE_REWRITE_TAC[GSYM (ASSUME `affine hull S1 = S1:real^3->bool`)]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC AFF_DIM_EQ_AFFINE_HULL); + (STRIP_TAC); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `INTERS {f x | x IN {a, b}} = f a INTER f b`]); + (DEL_TAC THEN EXPAND_TAC "S1"); + (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `aff_dim (S1:(real^3->bool)) = &(dimindex (:3)) - &1`); + (DEL_TAC THEN EXPAND_TAC "S1"); + (MATCH_MP_TAC AFF_DIM_HYPERPLANE); + (REWRITE_TAC[VECTOR_ARITH `&2 % (s - t) = vec 0 <=> s = t`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[DIMINDEX_3]); + (REWRITE_WITH `aff_dim (voronoi_list V [u0;u1:real^3]) = &3 - &1`); + (MATCH_MP_TAC Packing3.AFF_DIM_VORONOI_LIST); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_TAC[OPEN_IN_RELATIVE_INTERIOR]); + + (NEW_GOAL `closed (S2:real^3->bool)`); + (MATCH_MP_TAC CLOSED_IN_CLOSED_TRANS); + (EXISTS_TAC `S1:real^3->bool`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "S1"); + (REWRITE_TAC[CLOSED_HYPERPLANE]); + + + (NEW_GOAL `~(S2:real^3->bool = {})`); + (EXPAND_TAC "S2"); + (REWRITE_TAC [SET_RULE `A DIFF B = {} <=> A SUBSET B`]); + (REPEAT STRIP_TAC); + (NEW_GOAL `S1 SUBSET S:real^3->bool`); + (NEW_GOAL `relative_interior S SUBSET S:real^3->bool`); + (REWRITE_TAC[RELATIVE_INTERIOR_SUBSET]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `S1 = S:real^3->bool`); + (NEW_GOAL `S SUBSET S1:real^3->bool`); + (EXPAND_TAC "S"); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `INTERS {f x | x IN {a, b}} = f a INTER f b`]); + (EXPAND_TAC "S1"); + (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `bounded (S1:real^3->bool)`); + (REWRITE_TAC[ASSUME `S1 = S:real^3->bool`]); + (DEL_TAC THEN EXPAND_TAC "S"); + (MATCH_MP_TAC Packing3.BOUNDED_VORONOI_LIST); + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `~bounded (S1:real^3->bool)`); + (EXPAND_TAC "S1"); + (MATCH_MP_TAC UNBOUNDED_HYPERPLANE); + (REWRITE_TAC[VECTOR_ARITH `&2 % (u0 - u1) = vec 0 <=> u0 = u1`]); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `?z:real^3. z IN S2 /\ + (!w. w IN S2 ==> dist (u0,z) <= dist (u0,w))`); + (MATCH_MP_TAC DISTANCE_ATTAINS_INF); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + +(* ======================================================================== *) + + (ABBREV_TAC `a = dist (p, u0:real^3) / dist (z, u0)`); + (NEW_GOAL `&0 < a /\ a < &1`); + (EXPAND_TAC "a"); + (NEW_GOAL `~(u0:real^3 IN S1)`); + (EXPAND_TAC "S1" THEN REWRITE_TAC[IN; IN_ELIM_THM; NORM_POW_2]); + (REWRITE_TAC[REAL_ARITH `a = b - c <=> a + c - b = &0`]); + (REWRITE_TAC[VECTOR_ARITH `&2 % (u0 - u1) dot u0 + u1 dot u1 - u0 dot u0 = + (u0 - u1) dot (u0 - u1)`]); + (REWRITE_TAC[DOT_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `&0 < dist (p,u0:real^3)`); + (MATCH_MP_TAC DIST_POS_LT); + (EXPAND_TAC "p" THEN REWRITE_TAC[Rogers.CIRCUMCENTER_2; midpoint]); + (REWRITE_TAC[VECTOR_ARITH `inv (&2) % (u0 + u1) = u0 <=> u0 = u1`]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `&0 < dist (z,u0:real^3)`); + (MATCH_MP_TAC DIST_POS_LT); + (STRIP_TAC); + (NEW_GOAL `z:real^3 IN S1`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LT_DIV); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH + `dist (p,u0) / dist (z,u0:real^3) < &1 <=> dist (p,u0) < &1 * dist (z,u0)`); + (ASM_SIMP_TAC[REAL_LT_LDIV_EQ]); + (REWRITE_TAC[REAL_MUL_LID]); + (MATCH_MP_TAC Tactics_jordan.REAL_POW_2_LT); + (REPEAT STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[dist]); + (REWRITE_WITH `norm (z - u0:real^3) pow 2 = + norm (p - u0) pow 2 + norm (z - p) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (REWRITE_WITH `p = circumcenter (set_of_list [u0;u1:real^3])`); + (ASM_REWRITE_TAC[set_of_list]); + (ONCE_REWRITE_TAC[DOT_SYM]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ASSUME `voronoi_list V [u0; u1] = S`]); + (REWRITE_WITH `affine hull (S:real^3->bool) = S1`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (EXPAND_TAC "S"); + (NEW_GOAL `affine hull S1 = S1:real^3->bool`); + (REWRITE_TAC[AFFINE_HULL_EQ]); + (EXPAND_TAC "S1" THEN REWRITE_TAC[AFFINE_HYPERPLANE]); + (ONCE_REWRITE_TAC[GSYM (ASSUME `affine hull S1 = S1:real^3->bool`)]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC AFF_DIM_EQ_AFFINE_HULL); + (STRIP_TAC); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `INTERS {f x | x IN {a, b}} = f a INTER f b`]); + (DEL_TAC THEN EXPAND_TAC "S1"); + (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `aff_dim (S1:(real^3->bool)) = &(dimindex (:3)) - &1`); + (DEL_TAC THEN EXPAND_TAC "S1"); + (MATCH_MP_TAC AFF_DIM_HYPERPLANE); + (REWRITE_TAC[VECTOR_ARITH `&2 % (s - t) = vec 0 <=> s = t`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[DIMINDEX_3]); + (REWRITE_WITH `aff_dim (voronoi_list V [u0;u1:real^3]) = &3 - &1`); + (MATCH_MP_TAC Packing3.AFF_DIM_VORONOI_LIST); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[set_of_list]); + (NEW_GOAL `{u0, u1:real^3} SUBSET affine hull {u0, u1}`); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (ASM_SET_TAC[]); + (REWRITE_TAC[REAL_ARITH `a < a + b <=> &0 < b`; NORM_POW_2; DOT_POS_LT]); + (REWRITE_TAC[VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (STRIP_TAC); + (NEW_GOAL `~(z:real^3 IN S2)`); + (REWRITE_TAC[ASSUME `z = p:real^3`]); + (EXPAND_TAC "S2"); + (NEW_GOAL `p:real^3 IN relative_interior S`); + + + + (ABBREV_TAC `B = V INTER ball (p:real^3, &8)`); + (ABBREV_TAC `A = B DIFF {u0, u1:real^3}`); + (NEW_GOAL `FINITE (A:real^3->bool)`); + (EXPAND_TAC "A"); + (MATCH_MP_TAC FINITE_DIFF); + (EXPAND_TAC "B"); + (MATCH_MP_TAC Packing3.KIUMVTC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `?y. dist (p,y:real^3) = &4`); + (MATCH_MP_TAC VECTOR_CHOOSE_DIST); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + (UNDISCH_TAC `saturated (V:real^3->bool)`); + (REWRITE_TAC[saturated] THEN STRIP_TAC); + (NEW_GOAL `?z. z IN V /\ dist (y:real^3, z) < &2`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `z':real^3 IN A`); + (EXPAND_TAC "A" THEN EXPAND_TAC "B"); + (REWRITE_TAC[IN_DIFF; IN_INTER; IN_BALL]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `dist (p,z') <= dist (p, y) + dist (y, z':real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `dist (p, y) <= dist (p, z') + dist (z', y:real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[DIST_SYM]); + (STRIP_TAC); + (NEW_GOAL `&2 < dist (z', p:real^3)`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[] THEN ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_WITH `p = circumcenter (set_of_list [u0;u1:real^3])`); + (ASM_MESON_TAC[set_of_list]); + (NEW_GOAL `(!w. w IN set_of_list [u0;u1:real^3] + ==> dist (circumcenter (set_of_list [u0;u1]),w) = hl [u0;u1])`); + (MATCH_MP_TAC Rogers.HL_PROPERTIES); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `dist (circumcenter (set_of_list [u0; u1:real^3]),z') = + hl [u0; u1]`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[set_of_list]); + (NEW_GOAL `sqrt (&2) <= &2`); + (MATCH_MP_TAC Tactics_jordan.REAL_POW_2_LE); + (SIMP_TAC[REAL_ARITH `&0 <= &2`; SQRT_POS_LE; SQRT_POW_2]); + (REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `?a:real^3. a IN A /\ (!x. x IN A ==> dist (p,a) <= dist (p,x))`); + (MATCH_MP_TAC Packing3.REAL_FINITE_ARGMIN); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + + (ABBREV_TAC `d = inv (&4) * (dist (p, a') - dist (p, u0:real^3))`); + (NEW_GOAL `&0 < d`); + (EXPAND_TAC "d"); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&0 < a - b <=> a > b`]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (NEW_GOAL `!u v. u IN {u0,u1} /\ v IN V DIFF {u0,u1} ==> + dist (v,p) > dist (u,p:real^3)`); + (MATCH_MP_TAC Rogers.XYOFCGX); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[AFFINE_INDEPENDENT_2]); + (ASM_MESON_TAC[set_of_list]); + (REWRITE_WITH `radV {u0, u1:real^3} = hl [u0;u1]`); + (REWRITE_TAC[HL;set_of_list]); + (ASM_REWRITE_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + + (REWRITE_TAC[relative_interior; IN; IN_ELIM_THM]); + (ABBREV_TAC `St = S INTER ball (p:real^3, d)`); + (EXISTS_TAC `St:real^3->bool`); + (REPEAT STRIP_TAC); + + (REWRITE_TAC[open_in]); + (REPEAT STRIP_TAC); + (NEW_GOAL `S SUBSET affine hull (S:real^3->bool)`); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (EXISTS_TAC `d - dist (p:real^3, x)`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 < a - b <=> b < a`]); + (REWRITE_TAC[GSYM IN_BALL]); + (ASM_SET_TAC[]); + (EXPAND_TAC "St"); + (REWRITE_TAC[IN_INTER]); + (STRIP_TAC); + + + (NEW_GOAL `dist (x',x:real^3) < d`); + (NEW_GOAL `&0 <= dist (p,x:real^3)`); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `x' IN voronoi_closed V (u0:real^3)`); + (REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (ASM_CASES_TAC `w IN {u0, u1:real^3}`); + (ASM_CASES_TAC `w = u0:real^3`); + (REWRITE_TAC[ASSUME `w = u0:real^3`]); + (REAL_ARITH_TAC); + (NEW_GOAL `w = u1:real^3`); + (ASM_SET_TAC[]); + (REWRITE_TAC[ASSUME `w = u1:real^3`]); + (MATCH_MP_TAC (REAL_ARITH `a = b ==> a <= b`)); + + (NEW_GOAL `x':real^3 IN S1`); + (NEW_GOAL `affine hull S SUBSET affine hull (S1:real^3->bool)`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA); + (EXPAND_TAC "S1" THEN REWRITE_TAC[GSYM + (ASSUME `voronoi_list V [u0; u1] = S`); VORONOI_LIST; VORONOI_SET; + set_of_list; SET_RULE `INTERS {f v | v IN {a, b}} = f a INTER f b`]); + (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `x' IN S1 <=> x':real^3 IN affine hull S1`); + (REWRITE_WITH `affine hull S1 = S1:real^3->bool`); + (REWRITE_TAC[AFFINE_HULL_EQ]); + (EXPAND_TAC "S1" THEN REWRITE_TAC[AFFINE_HYPERPLANE]); + (ASM_SET_TAC[]); + + (UP_ASM_TAC THEN EXPAND_TAC "S1" THEN REWRITE_TAC[IN_ELIM_THM; NORM_POW_2]); + (ONCE_REWRITE_TAC[REAL_ARITH `a = b <=> a - b = &0`]); + (REWRITE_TAC[ + VECTOR_ARITH `&2 % (u0 - u1) dot x - (u0 dot u0 - u1 dot u1) = + (u1 - x) dot (u1 - x) - (u0 - x) dot (u0 - x)`]); + (REWRITE_TAC[REAL_ARITH `a - b = &0 <=> a = b`; GSYM NORM_POW_2; GSYM dist]); + (STRIP_TAC); + (REWRITE_TAC[DIST_EQ]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `dist (x', u0:real^3) <= dist (x', x) + dist (x, u0)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (x, u0:real^3) <= dist (x, p:real^3) + dist (p, u0)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (x,p:real^3) < d`); + (NEW_GOAL `x IN ball (p:real^3, d)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL]); + (REWRITE_TAC[DIST_SYM]); + (NEW_GOAL `dist (x',u0) < &2 * d + dist (p:real^3,u0)`); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `dist (p, w:real^3)- &2 * d <= dist (x',w)`); + (NEW_GOAL `dist (x, w:real^3) <= dist (x, x') + dist (x', w)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (p, w:real^3) <= dist (p, x) + dist (x, w)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (x, x':real^3) < d /\ dist (p, x:real^3) < d`); + (ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `dist (p, u0) + &4 * d <= dist (p, w:real^3)`); + (EXPAND_TAC "d"); + (REWRITE_TAC[REAL_ARITH `&4 * inv (&4) * a = a`]); + (REWRITE_TAC[REAL_ARITH `a + b - a = b`]); + + (ASM_CASES_TAC `w:real^3 IN B`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (NEW_GOAL `~(dist (p,w:real^3) < &8)`); + (REWRITE_TAC[GSYM IN_BALL]); + (ASM_SET_TAC[]); + (NEW_GOAL `dist (p,a':real^3) < &8`); + (REWRITE_TAC[GSYM IN_BALL]); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + + (NEW_GOAL `x' IN voronoi_closed V (u1:real^3)`); + (NEW_GOAL `x':real^3 IN S1`); + (NEW_GOAL `affine hull S SUBSET affine hull (S1:real^3->bool)`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA); + (EXPAND_TAC "S1" THEN REWRITE_TAC[GSYM + (ASSUME `voronoi_list V [u0; u1] = S`); VORONOI_LIST; VORONOI_SET; + set_of_list; SET_RULE `INTERS {f v | v IN {a, b}} = f a INTER f b`]); + (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `x' IN S1 <=> x':real^3 IN affine hull S1`); + (REWRITE_WITH `affine hull S1 = S1:real^3->bool`); + (REWRITE_TAC[AFFINE_HULL_EQ]); + (EXPAND_TAC "S1" THEN REWRITE_TAC[AFFINE_HYPERPLANE]); + (ASM_SET_TAC[]); + + (UP_ASM_TAC THEN EXPAND_TAC "S1" THEN REWRITE_TAC[IN_ELIM_THM; NORM_POW_2]); + (ONCE_REWRITE_TAC[REAL_ARITH `a = b <=> a - b = &0`]); + (REWRITE_TAC[ + VECTOR_ARITH `&2 % (u0 - u1) dot x - (u0 dot u0 - u1 dot u1) = + (u1 - x) dot (u1 - x) - (u0 - x) dot (u0 - x)`]); + (REWRITE_TAC[REAL_ARITH `a - b = &0 <=> a = b`; GSYM NORM_POW_2; GSYM dist]); + (STRIP_TAC); + (UNDISCH_TAC `x' IN voronoi_closed V (u0:real^3)`); + (REWRITE_TAC[voronoi_closed; IN_ELIM_THM; IN]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `dist (x', u1)= dist (x', u0:real^3)`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[DIST_EQ]); + (ASM_SIMP_TAC[]); + + (REWRITE_TAC[GSYM + (ASSUME `voronoi_list V [u0; u1] = S`); VORONOI_LIST; VORONOI_SET; + set_of_list; SET_RULE `INTERS {f v | v IN {a, b}} = f a INTER f b`]); + (ASM_REWRITE_TAC[IN_INTER]); + + (REWRITE_TAC[IN_BALL]); + (NEW_GOAL `dist (p,x':real^3) <= dist (p,x) + dist (x, x':real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (x,x':real^3) = dist (x',x)`); + (REWRITE_TAC[DIST_SYM]); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `St p <=> p:real^3 IN St`); + (REWRITE_TAC[IN]); + (EXPAND_TAC "St" THEN REWRITE_TAC[IN_INTER; IN_BALL; DIST_REFL]); + (STRIP_TAC); + (REWRITE_WITH `p = omega_list V [u0; u1]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `p = circumcenter (set_of_list [u0;u1:real^3])`); + (ASM_MESON_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[IN]); + (REWRITE_TAC[GSYM (ASSUME `voronoi_list V [u0;u1] = S`)]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `1` THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + +(* ======================================================================== *) + + (NEW_GOAL `?b. &0 < b /\ b < &1 /\ + rcone_gt u0 u1 b SUBSET aff_ge_alt {u0:real^3} S`); + + (EXISTS_TAC `a:real`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `A SUBSET B <=> (!x. ~(x IN B) ==> ~(x IN A))`]); + (REPEAT STRIP_TAC); + (NEW_GOAL `x:real^3 IN affine hull (u0 INSERT S)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[AFFINE_HULL_EXPLICIT_ALT; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (ABBREV_TAC `h = sum (s DELETE u0:real^3) u`); + (NEW_GOAL `(x - u0) dot (u1 - u0:real^3) = + h * dist (p, u0) * dist (u1, u0:real^3)`); + (EXPAND_TAC "x"); + (NEW_GOAL `u0 = vsum s (\v:real^3. (u:real^3->real) v % (u0:real^3))`); + (ASM_SIMP_TAC[VSUM_RMUL]); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `vsum (s:real^3->bool) (\v. u v % v) - u0:real^3 = + vsum s (\v. u v % v) - vsum s (\v:real^3. u v % u0)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_WITH `vsum s (\v. u v % v) - vsum s (\v:real^3. u v % u0:real^3) = + vsum s (\x. (\v. u v % v) x - (\v. u v % u0) x)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC VSUM_SUB); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_ARITH `a % x - a % y = a % (x - y)`]); + (REWRITE_WITH `vsum s (\x:real^3. u x % (x - u0)) dot (u1 - u0) = + sum s (\x. (\x. u x % (x - u0)) x dot (u1 - u0:real^3))`); + (ASM_SIMP_TAC[DOT_LSUM]); + (REWRITE_TAC[DOT_LMUL]); + (REWRITE_WITH `sum s (\x:real^3. u x * ((x - u0) dot (u1 - u0:real^3))) = + sum (s DELETE u0) (\x. u x * (dist (p,u0) * dist (u1,u0)))`); + (ASM_CASES_TAC `u0:real^3 IN s`); + (NEW_GOAL `s = u0 INSERT (s DELETE u0:real^3)`); + (ASM_SET_TAC[]); + (NEW_GOAL `FINITE (s DELETE u0:real^3)`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `s:real^3->bool` THEN ASM_REWRITE_TAC[] THEN SET_TAC[]); + + (REWRITE_WITH `sum s (\x:real^3. u x * ((x - u0) dot (u1 - u0:real^3))) = + sum (u0 INSERT (s DELETE u0)) (\x. u x * ((x - u0) dot (u1 - u0)))`); + (ASM_MESON_TAC[]); + (ABBREV_TAC `f = (\x:real^3. u x * ((x - u0) dot (u1 - u0:real^3)))`); + (REWRITE_WITH `sum (u0:real^3 INSERT (s DELETE u0)) f = + (if u0 IN (s DELETE u0) then sum (s DELETE u0) f + else f u0 + sum (s DELETE u0) f)`); + (MATCH_MP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt); + (ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_WITH `f (u0:real^3) = &0`); + (EXPAND_TAC "f"); + (REWRITE_TAC[VECTOR_ARITH `(u0 - u0) dot (u1 - u0) = &0`]); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&0 + a = a`]); + (MATCH_MP_TAC SUM_EQ); + (EXPAND_TAC "f"); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a * x = a * y * z <=> a * (x - y * z) = &0`]); + (NEW_GOAL `(x' - u0) dot (u1 - u0) - dist (p,u0) * dist (u1,u0:real^3) = &0`); + (REWRITE_TAC[REAL_ARITH `a - b = &0 <=> a = b`]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (REWRITE_WITH `s DELETE u0:real^3 = s`); + (ASM_SET_TAC[]); + (MATCH_MP_TAC SUM_EQ); + (REPEAT STRIP_TAC); + (REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `a * x = a * y * z <=> a * (x - y * z) = &0`]); + (NEW_GOAL `(x' - u0) dot (u1 - u0) - dist (p,u0) * dist (u1,u0:real^3) = &0`); + (REWRITE_TAC[REAL_ARITH `a - b = &0 <=> a = b`]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (NEW_GOAL `FINITE (s DELETE u0:real^3)`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `s:real^3->bool` THEN ASM_REWRITE_TAC[] THEN SET_TAC[]); + (ASM_SIMP_TAC[SUM_RMUL]); + + (ASM_CASES_TAC `h <= &0`); + (NEW_GOAL `~(x IN rcone_gt u0 (u1:real^3) a)`); + (REWRITE_TAC[rcone_gt; rconesgn; IN; IN_ELIM_THM]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (REAL_ARITH `&0 <= x /\ y <= &0 ==> ~(y > x)`)); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH `a * b * c <= &0 <=> &0 <= b * c * (--a)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (ABBREV_TAC `y = inv (h) % vsum (s DELETE u0) (\v:real^3. u v % v)`); + (NEW_GOAL `?t. t + h = &1 /\ x = t % u0 + h % (y:real^3)`); + (EXISTS_TAC `&1 - h`); + (STRIP_TAC); + (REAL_ARITH_TAC); + (ASM_CASES_TAC `u0:real^3 IN s`); + (REWRITE_TAC[GSYM (ASSUME `sum s (u:real^3->real) = &1`)]); + + (EXPAND_TAC "h"); + (REWRITE_WITH `sum s u = sum (u0 INSERT (s DELETE u0)) (u:real^3->real)`); + (REWRITE_WITH `(u0 INSERT (s DELETE u0:real^3)) = s`); + (ASM_SET_TAC[]); + (NEW_GOAL `FINITE (s DELETE u0:real^3)`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `s:real^3->bool` THEN ASM_REWRITE_TAC[] THEN SET_TAC[]); + + (SIMP_TAC[Marchal_cells_2_new.SUM_CLAUSES_alt; + ASSUME `FINITE (s DELETE u0:real^3)`]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[REAL_ARITH `(a + b:real) - b = a`]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_MUL_ASSOC]); + (REWRITE_WITH `h * inv h = &1`); + (NEW_GOAL `~(h = &0)`); + (ASM_REAL_ARITH_TAC); + (ASM_SIMP_TAC[Trigonometry2.REAL_MUL_LRINV]); + (REWRITE_TAC[VECTOR_MUL_LID]); + (EXPAND_TAC "x"); + + (REWRITE_WITH `vsum s (\v. u v % v) = + vsum (u0 INSERT (s DELETE u0)) (\v:real^3. u v % v)`); + (REWRITE_WITH `(u0 INSERT (s DELETE u0:real^3)) = s`); + (ASM_SET_TAC[]); + (SIMP_TAC[Marchal_cells_2_new.VSUM_CLAUSES_alt; + ASSUME `FINITE (s DELETE u0:real^3)`]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (REFL_TAC); + + (NEW_GOAL `h = &1`); + (EXPAND_TAC "h" THEN REWRITE_WITH `s DELETE u0:real^3 = s`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "y" THEN REWRITE_TAC[ASSUME `h = &1`]); + (REWRITE_WITH `s DELETE u0:real^3 = s`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[REAL_ARITH `inv (&1) = &1 /\ &1 - &1 = &0`]); + (VECTOR_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `~(y:real^3 IN S)`); + (STRIP_TAC); + (NEW_GOAL `x IN aff_ge_alt {u0:real^3} S`); + (REWRITE_TAC[IN; aff_ge_alt; lin_combo]); + + (ABBREV_TAC `f = (\v:real^3. if v = u0 then t + else if v = y then h else &0)`); + (EXISTS_TAC `f:real^3->real`); + (EXISTS_TAC `{y:real^3}`); + + (REPEAT STRIP_TAC); + (REWRITE_TAC[FINITE_SING]); + (ASM_SET_TAC[]); + + (REWRITE_TAC[SET_RULE `{a} UNION {b} = {a, b}`]); + (REWRITE_WITH `vsum {u0:real^3, y} (\v. f v % v) = + (\v. f v % v) u0 + (\v. f v % v) y`); + (MATCH_MP_TAC Geomdetail.VSUM_DIS2); + (STRIP_TAC); + (NEW_GOAL `~(u0:real^3 IN S)`); + (EXPAND_TAC "S"); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `v IN {a,b} <=> v = a \/ v = b`]); + (STRIP_TAC); + (NEW_GOAL `u0 IN voronoi_closed V (u1:real^3)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,u1) <= dist (u0,u0:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `(f:real^3->real) u0 = t`); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `(f:real^3->real) y = h`); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `~(u0:real^3 IN S)`); + (EXPAND_TAC "S"); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `v IN {a,b} <=> v = a \/ v = b`]); + (STRIP_TAC); + (NEW_GOAL `u0 IN voronoi_closed V (u1:real^3)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,u1) <= dist (u0,u0:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[]); + + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `~({y:real^3} u0)`); + (REWRITE_WITH `~({y} u0) <=> ~(u0:real^3 IN {y})`); + (MESON_TAC[IN]); + (REWRITE_TAC[IN_SING]); + (STRIP_TAC); + + (NEW_GOAL `~(u0:real^3 IN S)`); + (EXPAND_TAC "S"); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `v IN {a,b} <=> v = a \/ v = b`]); + (STRIP_TAC); + + (NEW_GOAL `u0 IN voronoi_closed V (u1:real^3)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,u1) <= dist (u0,u0:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (COND_CASES_TAC); + (ASM_REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (REWRITE_TAC[SET_RULE `{a} UNION {b} = {a,b}`]); + (REWRITE_WITH `sum {u0:real^3, y} f = f u0 + f y`); + (MATCH_MP_TAC Geomdetail.SUM_DIS2); + (STRIP_TAC); + (NEW_GOAL `~(u0:real^3 IN S)`); + (EXPAND_TAC "S"); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `v IN {a,b} <=> v = a \/ v = b`]); + (STRIP_TAC); + (NEW_GOAL `u0 IN voronoi_closed V (u1:real^3)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,u1) <= dist (u0,u0:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `(f:real^3->real) u0 = t`); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `(f:real^3->real) y = h`); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `~(u0:real^3 IN S)`); + (EXPAND_TAC "S"); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `v IN {a,b} <=> v = a \/ v = b`]); + (STRIP_TAC); + (NEW_GOAL `u0 IN voronoi_closed V (u1:real^3)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,u1) <= dist (u0,u0:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `y:real^3 IN S2`); + (EXPAND_TAC "S2"); + (NEW_GOAL `y:real^3 IN S1`); + (NEW_GOAL `y:real^3 IN affine hull S`); + (REWRITE_TAC[AFFINE_HULL_EXPLICIT_ALT]); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `s DELETE u0:real^3`); + (EXISTS_TAC `(\v:real^3. inv h * u v)`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[FINITE_DELETE]); + (ASM_SET_TAC[]); + (REWRITE_TAC[SUM_LMUL]); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[Trigonometry2.REAL_MUL_LRINV; + REAL_ARITH `~(h <= &0) ==> ~(h = &0)`]); + (REWRITE_TAC[GSYM VECTOR_MUL_ASSOC]); + (ASM_SIMP_TAC[VSUM_LMUL; FINITE_DELETE]); + (NEW_GOAL `affine hull S1 = S1:real^3->bool`); + (REWRITE_TAC[AFFINE_HULL_EQ]); + (EXPAND_TAC "S1" THEN REWRITE_TAC[AFFINE_HYPERPLANE]); + + (NEW_GOAL `affine hull S SUBSET affine hull (S1:real^3->bool)`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA); + (EXPAND_TAC "S"); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `INTERS {f x | x IN {a, b}} = f a INTER f b`]); + (DEL_TAC THEN EXPAND_TAC "S1"); + (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + + (NEW_GOAL `relative_interior S SUBSET S:real^3->bool`); + (REWRITE_TAC[RELATIVE_INTERIOR_SUBSET]); + (ASM_SET_TAC[]); + +(* OK until here *) +(* ========================================================================= *) + + (NEW_GOAL `dist (z,u0) <= dist (y,u0:real^3)`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ASM_SIMP_TAC[]); + (UNDISCH_TAC `x:real^3 IN rcone_gt u0 u1 a`); + (REWRITE_TAC[rcone_gt; rconesgn; IN; IN_ELIM_THM]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `dist (t % u0 + h % y,u0) = h * dist (y, u0:real^3)`); + (REWRITE_TAC[dist]); + (REWRITE_WITH `(t % u0 + h % y:real^3) - u0 = (t % u0 + h % y) - (t + h) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `(t % u0 + h % y) - (t + h) % u0 = h % (y - u0)`]); + (REWRITE_TAC[NORM_MUL]); + (REWRITE_WITH `abs h = h`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REAL_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH `~(a > b) <=> a <= b`]); + (REWRITE_WITH `h * dist (p,u0:real^3) * dist (u1,u0) = + (h * dist (z,u0)) * dist (u1,u0) * a`); + (EXPAND_TAC "a"); + (REWRITE_TAC[REAL_ARITH `(a * b) * c * d / b = (a * d * c) * (b / b)`]); + (REWRITE_WITH `dist (z,u0) / dist (z,u0:real^3) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[DIST_EQ_0]); + (STRIP_TAC); + + (NEW_GOAL `~(u0:real^3 IN S1)`); + (EXPAND_TAC "S1" THEN REWRITE_TAC[IN; IN_ELIM_THM; NORM_POW_2]); + (REWRITE_TAC[REAL_ARITH `a = b - c <=> a + c - b = &0`]); + (REWRITE_TAC[VECTOR_ARITH `&2 % (u0 - u1) dot u0 + u1 dot u1 - u0 dot u0 = + (u0 - u1) dot (u0 - u1)`]); + (REWRITE_TAC[DOT_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `z:real^3 IN S1`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH + `(a * x) * b * c <= (a * y) * b * c <=> &0 <= a * b * c *(y - x)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (UP_ASM_TAC THEN STRIP_TAC); + + (ABBREV_TAC `W = aff_ge_alt {u0:real^3} S`); + (ABBREV_TAC `c = max b (hl[u0;u1:real^3] / sqrt (&2))`); + (NEW_GOAL `&0 < c /\ c < &1`); + (EXPAND_TAC "c" THEN REWRITE_TAC[REAL_LT_MAX]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "c" THEN REWRITE_TAC[REAL_MAX_LT]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `hl [u0; u1:real^3] / sqrt (&2) < &1 <=> + hl [u0; u1] < &1 * sqrt (&2)`); + (MATCH_MP_TAC REAL_LT_LDIV_EQ); + (ASM_SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `rcone_gt u0 u1 c SUBSET + W INTER (rcone_gt u0 u1 (hl [u0; u1:real^3] / sqrt (&2)))`); + (REWRITE_TAC[SUBSET_INTER]); + (STRIP_TAC); + (NEW_GOAL `rcone_gt (u0:real^3) u1 c SUBSET rcone_gt u0 u1 b`); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "c" THEN REAL_ARITH_TAC); + (ASM_SET_TAC[]); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "c" THEN REAL_ARITH_TAC); + + (ABBREV_TAC `C = ball (u0:real^3,&1) INTER rcone_gt u0 u1 c`); + (NEW_GOAL `C SUBSET + UNIONS + {rogers V vl | vl | barV V 3 vl /\ truncate_simplex 1 vl = [u0; u1]}`); + (REWRITE_TAC[SUBSET]); + (REPEAT STRIP_TAC); + (NEW_GOAL `x IN ball (u0:real^3,&1) /\ x IN aff_ge_alt {u0} S`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + +(* OK until here *) +(* ===========================================================================*) + + (NEW_GOAL `(x:real^3) IN convex hull (u0 INSERT S)`); + (REWRITE_TAC[CONVEX_HULL_EXPLICIT; IN; IN_ELIM_THM]); + + (UP_ASM_TAC THEN REWRITE_TAC[IN; aff_ge_alt; lin_combo]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `{u0:real^3} UNION q`); + (EXISTS_TAC `f:real^3->real`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[SET_RULE `{a} UNION b = a INSERT b`; FINITE_INSERT]); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ASM_CASES_TAC `x':real^3 IN q`); + (FIRST_ASSUM MATCH_MP_TAC); + (UP_ASM_TAC THEN MESON_TAC[IN]); + (REWRITE_WITH `x' = u0:real^3`); + (NEW_GOAL `x' IN ({u0:real^3} UNION q)`); + (ASM_REWRITE_TAC[IN]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[REAL_ARITH `&0 <= x <=> ~(x < &0)`]); + (STRIP_TAC); + (UNDISCH_TAC `x IN ball (u0:real^3,&1)`); + (ASM_REWRITE_TAC[IN_BALL; SET_RULE `{u} UNION q = u INSERT (q DELETE u)`]); + (REWRITE_WITH `vsum (u0 INSERT (q DELETE u0:real^3)) (\v. f v % v) = + (if u0 IN (q DELETE u0) then vsum (q DELETE u0) (\v. f v % v) + else (\v. f v % v) u0 + vsum (q DELETE u0) (\v. f v % v))`); + (MATCH_MP_TAC Marchal_cells_2_new.VSUM_CLAUSES_alt); + (ASM_REWRITE_TAC[FINITE_DELETE]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[dist]); + (REWRITE_WITH `!a. a - u0 = a - (sum ({u0:real^3} UNION q) f) % u0`); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + + + (NEW_GOAL `sum ({u0} UNION q) f = f u0 + sum (q DELETE u0:real^3) f`); + (REWRITE_TAC[SET_RULE `{u} UNION q = u INSERT (q DELETE u)`]); + (REWRITE_WITH `sum (u0 INSERT (q DELETE u0:real^3)) f = + (if u0 IN (q DELETE u0) then sum (q DELETE u0) f + else f u0 + sum (q DELETE u0) f)`); + (MATCH_MP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt); + (ASM_REWRITE_TAC[FINITE_DELETE]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_ADD_RDISTRIB; + VECTOR_ARITH `(a + b) - (a + c:real^3) = b - c`; + ASSUME `sum ({u0} UNION q) f = f u0 + sum (q DELETE u0:real^3) f`; ]); + (ABBREV_TAC `h = sum (q DELETE u0:real^3) f`); + (ABBREV_TAC `y = inv (h) % vsum (q DELETE u0) (\v:real^3. f v % v)`); + (NEW_GOAL `h > &1`); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `vsum (q DELETE u0) (\v. f v % v) = h % y:real^3`); + (EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_MUL_ASSOC]); + (REWRITE_WITH `h * inv h = &1`); + (ASM_SIMP_TAC [Trigonometry2.REAL_MUL_LRINV; REAL_ARITH `h > &1 ==> ~(h = &0)`]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `h % a - h % b = h % (a - b)`; NORM_MUL]); + (REWRITE_TAC[REAL_ARITH `~(a < b) <=> b <= a`]); + + (NEW_GOAL `norm (p - u0) <= norm (y - u0:real^3)`); + (MATCH_MP_TAC Tactics_jordan.REAL_POW_2_LE); + (REWRITE_TAC[NORM_POS_LE]); + (REWRITE_WITH + `norm (y - u0) pow 2 = norm (p - u0) pow 2 + norm (y - p:real^3) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (REWRITE_WITH `p = circumcenter (set_of_list [u0;u1:real^3])`); + (ASM_REWRITE_TAC[set_of_list]); + (ONCE_REWRITE_TAC[DOT_SYM]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ASSUME `voronoi_list V [u0; u1] = S`]); + (REWRITE_TAC[AFFINE_HULL_EXPLICIT_ALT; IN; IN_ELIM_THM]); + (EXISTS_TAC `q DELETE u0:real^3`); + (EXISTS_TAC `(\v:real^3. inv h * f v)`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[FINITE_DELETE]); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[SUM_LMUL]); + (ASM_SIMP_TAC [Trigonometry2.REAL_MUL_LRINV; REAL_ARITH `h > &1 ==> ~(h = &0)`]); + (REWRITE_TAC[GSYM VECTOR_MUL_ASSOC]); + (ASM_REWRITE_TAC[VSUM_LMUL]); + + (REWRITE_TAC[set_of_list]); + (NEW_GOAL `{u0, u1:real^3} SUBSET affine hull {u0, u1}`); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (ASM_SET_TAC[]); + (REWRITE_TAC[REAL_ARITH `a <= a + b <=> &0 <= b`; NORM_POW_2; DOT_POS_LE]); + + (NEW_GOAL `&1 <= norm (p - u0:real^3)`); + (EXPAND_TAC "p"); + (REWRITE_TAC[CIRCUMCENTER_2; midpoint; + VECTOR_ARITH `inv (&2) % (u0 + u1) - u0 = inv (&2) % (u1 - u0)`; + NORM_MUL; REAL_ARITH `abs (inv(&2)) = inv (&2)`]); + (REWRITE_TAC[GSYM dist]); + (REWRITE_WITH `&1 = inv (&2) * &2`); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `inv (&2) * &2 <= inv (&2) * a <=> &2 <= a`]); + (MP_TAC (ASSUME `packing (V:real^3->bool)`)); + (REWRITE_TAC[packing] THEN STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]); + (REWRITE_WITH `abs h = h`); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `h <= h * norm (y - u0:real^3)`); + (REWRITE_TAC[REAL_ARITH `h <= h * a <=> &0 <= h * (a - &1)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + +(* ========================================================================== *) + (NEW_GOAL `~(S:real^3->bool = {})`); + (STRIP_TAC); + (NEW_GOAL `~(aff_dim (u0:real^3 INSERT S) = &3)`); + (REWRITE_TAC[ASSUME `S:real^3->bool = {}`; AFF_DIM_SING]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (SWITCH_TAC); + (UP_ASM_TAC THEN SIMP_TAC[CONVEX_HULL_INSERT; + ASSUME `~(S:real^3->bool = {})`]); + (REWRITE_WITH `convex hull S = S:real^3->bool`); + (REWRITE_TAC[CONVEX_HULL_EQ]); + (EXPAND_TAC "S" THEN REWRITE_TAC[Packing3.CONVEX_VORONOI_LIST]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[IN_UNIONS; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (EXISTS_TAC `rogers V vl`); + (REPEAT STRIP_TAC); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + + (ASM_SIMP_TAC[Marchal_cells_2.ROGERS_EXPLICIT]); + (REWRITE_TAC[CONVEX_HULL_4; IN_ELIM_THM]); + + (UNDISCH_TAC `(t:real^3->bool) b'`); + (ASM_REWRITE_TAC[CONVEX_HULL_3; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (EXISTS_TAC `u:real`); + (EXISTS_TAC `v * u'`); + (EXISTS_TAC `v * v'`); + (EXISTS_TAC `v * w`); + (ASM_SIMP_TAC[REAL_LE_MUL]); + (STRIP_TAC); + + (REWRITE_TAC[REAL_ARITH `u + v * u' + v * v' + v * w = u + v * (u' + v' +w)`]); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (ASM_REWRITE_TAC[HD]); + (VECTOR_ARITH_TAC); + +(* ========================================================================= *) +(* ========================================================================== *) + + (NEW_GOAL + `!X. mcell_set V X /\ ~NULLSET (X INTER C) + ==> (?k vl. + 2 <= k /\ + barV V 3 vl /\ + X = mcell k V vl /\ + truncate_simplex 1 vl = [u0; u1])`); + + (REWRITE_TAC[mcell_set_2; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `~NULLSET (X INTER UNIONS + {rogers V vl | vl | barV V 3 vl /\ truncate_simplex 1 vl = [u0; u1]})`); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER C)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER + UNIONS + {rogers V vl | vl | barV V 3 vl /\ truncate_simplex 1 vl = [u0; u1]}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[INTER_UNIONS]); + (STRIP_TAC); + + (NEW_GOAL + `!s. ~NULLSET (UNIONS s) /\ FINITE s ==> (?t. t IN s /\ ~NULLSET t)`); + (MESON_TAC[NEGLIGIBLE_UNIONS]); + (ABBREV_TAC `St = {X INTER x | x IN + {rogers V vl | vl | barV V 3 vl /\ + truncate_simplex 1 vl = [u0; u1]}}`); + (NEW_GOAL `?t. t IN St /\ ~NULLSET t`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "St"); + (ABBREV_TAC `Sr = {rogers V vl | vl | barV V 3 vl /\ + truncate_simplex 1 vl = [u0; u1]}`); + (ABBREV_TAC `f = (\x:real^3->bool. X INTER x)`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y:real^3->bool | ?x:real^3->bool. x IN Sr /\ y = f x }`); + (STRIP_TAC); + + + + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (ABBREV_TAC `Ss = {vl | barV V 3 vl /\ truncate_simplex 1 vl = [u0; u1]}`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y | ?vl. vl IN Ss /\ y = rogers V vl}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (ABBREV_TAC `Sx = V INTER ball (u0:real^3, &4)`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y | ?u0 u1 u2 u3:real^3. + u0 IN Sx /\ + u1 IN Sx /\ + u2 IN Sx /\ + u3 IN Sx /\ + y = [u0; u1; u2; u3]}`); + (STRIP_TAC); + (MATCH_MP_TAC Ajripqn.FINITE_SET_LIST_LEMMA); + (EXPAND_TAC "Sx"); + (MATCH_MP_TAC Pack2.KIUMVTC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "Ss"); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `?v0 v1 v2 v3. x = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v0:real^3`); + (EXISTS_TAC `v1:real^3`); + (EXISTS_TAC `v2:real^3`); + (EXISTS_TAC `v3:real^3`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `{v0, v1, v2, v3:real^3} SUBSET Sx`); + (EXPAND_TAC "Sx"); + (REWRITE_TAC[SUBSET_INTER]); + (REWRITE_WITH `{v0, v1, v2, v3:real^3} = set_of_list x`); + (ASM_REWRITE_TAC[set_of_list]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `HD (truncate_simplex 1 x) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 x) = v0:real^3`); + (REWRITE_TAC[ASSUME `x = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (REWRITE_WITH `u0 = v0:real^3`); + (ASM_MESON_TAC[]); + (REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (EXPAND_TAC "Sr" THEN EXPAND_TAC "Ss"); + (SET_TAC[]); + (REWRITE_WITH `{X INTER x:real^3->bool | x IN Sr} = {f x | x IN Sr}`); + (EXPAND_TAC "f"); + (REFL_TAC); + (SET_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "St" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `x SUBSET UNIONS {mcell i V vl | i <= 4}`); + (ASM_REWRITE_TAC[SUBSET; IN_UNIONS; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?i. i <= 4 /\ x' IN mcell i V vl`); + (MATCH_MP_TAC Sltstlo.SLTSTLO1); + (ASM_REWRITE_TAC[IN]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `mcell i' V vl`); + (STRIP_TAC); + (EXISTS_TAC `i':num` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN]); + + (NEW_GOAL `~NULLSET (X INTER UNIONS {mcell i V vl | i <= 4})`); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (t)`); + (REWRITE_TAC[ASSUME `t:real^3->bool = X INTER x`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER UNIONS {mcell i V vl | i <= 4}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[INTER_UNIONS]); + (STRIP_TAC); + + (NEW_GOAL + `!s. ~NULLSET (UNIONS s) /\ FINITE s ==> (?t. t IN s /\ ~NULLSET t)`); + (MESON_TAC[NEGLIGIBLE_UNIONS]); + (ABBREV_TAC `Sx = {X INTER x | x IN {mcell i V vl | i <= 4}}`); + (NEW_GOAL `?t. t IN Sx /\ ~NULLSET t`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "Sx"); + (ABBREV_TAC `Sy = {mcell i V vl | i <= 4}`); + (ABBREV_TAC `f = (\x:real^3->bool. X INTER x)`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y:real^3->bool | ?x:real^3->bool. x IN Sy /\ y = f x }`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (EXPAND_TAC "Sy"); + (REWRITE_TAC[GSYM IN_NUMSEG_0]); + (ABBREV_TAC `g = (\i:num. mcell i V vl)`); + (REWRITE_WITH `{mcell i V vl | i IN 0..4} = {g i | i IN 0..4}`); + (EXPAND_TAC "g" THEN REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y:real^3->bool | ?i. i IN 0..4 /\ y = g i}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (REWRITE_TAC[FINITE_NUMSEG]); + (SET_TAC[]); + (REWRITE_WITH `{X INTER x:real^3->bool | x IN Sy} = {f x | x IN Sy}`); + (EXPAND_TAC "f" THEN REWRITE_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "Sx" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + +(* ========================================================================= *) + + (NEW_GOAL `i = i' /\ mcell i V ul = mcell i' V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[GSYM Ajripqn.UP_TO_4_KY_LEMMA]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `ul IN barV V 3` THEN REWRITE_TAC[IN]); + (UNDISCH_TAC `~NULLSET t'`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + +(* ========================================================================= *) + + (ASM_CASES_TAC `i' = 0`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER C)`); + (REWRITE_TAC[]); + (REWRITE_WITH `X INTER C = {}:real^3->bool`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell0]); + (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `C SUBSET ball (u0:real^3, sqrt (&2))`); + (NEW_GOAL `ball (u0:real^3, &1) SUBSET ball (u0, sqrt (&2))`); + (MATCH_MP_TAC SUBSET_BALL); + (MATCH_MP_TAC (REAL_ARITH `a < b ==> a <= b`)); + (REWRITE_TAC[Marchal_cells_2_new.ZERO_LT_SQRT_2]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `i' = 1`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER C)`); + (REWRITE_TAC[]); + (REWRITE_WITH `X INTER C = {}:real^3->bool`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell1]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[HD; TL]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 vl) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 vl) = v0:real^3`); + (REWRITE_TAC[ASSUME `vl = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = v1:real^3`); + (REWRITE_TAC[ASSUME `vl = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `C SUBSET (rcone_gt u0 u1 (hl [u0:real^3; u1] / sqrt (&2)))`); + (EXPAND_TAC "C"); + (SET_TAC[ASSUME `rcone_gt u0 u1 c SUBSET + W INTER rcone_gt u0 u1 (hl [u0:real^3; u1] / sqrt (&2))`]); + (UP_ASM_TAC THEN SET_TAC[]); + (SET_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + (ASM_ARITH_TAC); + +(* ========================================================================= *) + + (ABBREV_TAC `f1 = + (\ul. dist (u0:real^3, + closest_point (affine hull {u1, EL 2 ul, mxi V ul}) u0))`); + + (ABBREV_TAC `P1 = { (f1:(real^3)list->real) ul |ul | barV V 3 ul /\ + ~NULLSET (mcell 3 V ul INTER C) /\ + truncate_simplex 1 ul = [u0; u1]}`); + + (NEW_GOAL `~(P1 = {}) ==> (?b:real. b IN P1 /\ (!x. x IN P1 ==> b <= x))`); + (STRIP_TAC); + (MATCH_MP_TAC INF_FINITE_LEMMA); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "P1"); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x | P x} = {f x | x IN {y | P y}}`]); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x IN s} = {y | ?x. x IN s /\ y = f x}`]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y | ?v0:real^3 v1 u2 u3. + v0 IN (V INTER ball (u0:real^3, &4)) /\ + v1 IN (V INTER ball (u0, &4)) /\ + u2 IN (V INTER ball (u0, &4)) /\ + u3 IN (V INTER ball (u0, &4)) /\ + y = [v0; v1; u2; u3]}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SET_LIST_LEMMA); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?v0 v1 u2 u3. x = [v0; v1; u2; u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v0:real^3` THEN EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (x:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (x:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (NEW_GOAL `set_of_list x SUBSET ball (u0:real^3,&4)`); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + (NEW_GOAL `set_of_list x SUBSET V:real^3->bool`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + + (ABBREV_TAC `r1 = (if (P1 = {}:real->bool) then &1 + else (@b. b IN P1 /\ (!x. x IN P1 ==> b <= x)))`); + (NEW_GOAL `&0 < r1`); + (EXPAND_TAC "r1"); + (COND_CASES_TAC); + (REAL_ARITH_TAC); + (NEW_GOAL `?b:real. b IN P1 /\ (!x. x IN P1 ==> b <= x)`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `P = (\b:real. b IN P1 /\ (!x. x IN P1 ==> b <= x))`); + (ABBREV_TAC `zz = (@) (P:real->bool)`); + (NEW_GOAL `(P:real->bool) zz`); + (EXPAND_TAC "zz"); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b':real`); + (EXPAND_TAC "P" THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "P" THEN REWRITE_TAC[]); + (EXPAND_TAC "P1" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "f1"); + (MATCH_MP_TAC DIST_POS_LT); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `closest_point (affine hull {u1, EL 2 ul, mxi V ul}) u0 = u0 + <=> u0 IN (affine hull {u1:real^3, EL 2 ul, mxi V ul})`); + (MATCH_MP_TAC CLOSEST_POINT_REFL); + (REWRITE_TAC[CLOSED_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_EQ_EMPTY] THEN SET_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (mcell 3 V ul INTER C)`); + (REWRITE_TAC[] THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 3 V ul`); + (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]); + (REWRITE_TAC[MCELL_EXPLICIT; mcell3]); + (COND_CASES_TAC); + + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, v2, mxi V [u0; u1; v2; v3]}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_WITH `affine hull {u0, u1, v2, mxi V [u0; u1; v2; v3]} = + affine hull {u1, v2, mxi V [u0; u1; v2; v3]}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + (REWRITE_WITH `affine hull {u1, v2, mxi V [u0; u1; v2; v3]} = + affine hull {u1, EL 2 ul, mxi V ul}`); + (ASM_REWRITE_TAC[EL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`; HD; TL]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + +(* ========================================================================= *) + + (ABBREV_TAC `f2 = + (\ul. dist (u0:real^3, + closest_point (affine hull {u1, EL 2 ul, EL 3 ul}) u0))`); + + (ABBREV_TAC `P2 = { (f2:(real^3)list->real) ul |ul | barV V 3 ul /\ + ~NULLSET (mcell 4 V ul INTER C) /\ + truncate_simplex 1 ul = [u0; u1]}`); + + (NEW_GOAL `~(P2 = {}) ==> (?b:real. b IN P2 /\ (!x. x IN P2 ==> b <= x))`); + (STRIP_TAC); + (MATCH_MP_TAC INF_FINITE_LEMMA); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "P2"); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x | P x} = {f x | x IN {y | P y}}`]); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x IN s} = {y | ?x. x IN s /\ y = f x}`]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y | ?v0:real^3 v1 u2 u3. + v0 IN (V INTER ball (u0:real^3, &4)) /\ + v1 IN (V INTER ball (u0, &4)) /\ + u2 IN (V INTER ball (u0, &4)) /\ + u3 IN (V INTER ball (u0, &4)) /\ + y = [v0; v1; u2; u3]}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SET_LIST_LEMMA); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?v0 v1 u2 u3. x = [v0; v1; u2; u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v0:real^3` THEN EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (x:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (x:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (NEW_GOAL `set_of_list x SUBSET ball (u0:real^3,&4)`); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + (NEW_GOAL `set_of_list x SUBSET V:real^3->bool`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + + (ABBREV_TAC `r2 = (if (P2 = {}:real->bool) then &1 + else (@b. b IN P2 /\ (!x. x IN P2 ==> b <= x)))`); + + (NEW_GOAL `&0 < r2`); + (EXPAND_TAC "r2"); + (COND_CASES_TAC); + (REAL_ARITH_TAC); + (NEW_GOAL `?b:real. b IN P2 /\ (!x. x IN P2 ==> b <= x)`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `P = (\b:real. b IN P2 /\ (!x. x IN P2 ==> b <= x))`); + (ABBREV_TAC `zz = (@) (P:real->bool)`); + (NEW_GOAL `(P:real->bool) zz`); + (EXPAND_TAC "zz"); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b':real`); + (EXPAND_TAC "P" THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "P" THEN REWRITE_TAC[]); + (EXPAND_TAC "P2" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "f2"); + (MATCH_MP_TAC DIST_POS_LT); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `closest_point (affine hull {u1, EL 2 ul, EL 3 ul}) u0 = u0 + <=> u0 IN (affine hull {u1:real^3, EL 2 ul, EL 3 ul})`); + (MATCH_MP_TAC CLOSEST_POINT_REFL); + (REWRITE_TAC[CLOSED_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_EQ_EMPTY] THEN SET_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (mcell 4 V ul INTER C)`); + (REWRITE_TAC[] THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 4 V ul`); + (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4]); + (COND_CASES_TAC); + + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, v2, v3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_WITH `affine hull {u0, u1, v2, v3:real^3} = + affine hull {u1, v2, v3}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + (REWRITE_WITH `affine hull {u1, v2, v3:real^3} = + affine hull {u1, EL 2 ul, EL 3 ul}`); + (ASM_REWRITE_TAC[EL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; HD; TL]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + +(* ========================================================================= *) + + (ABBREV_TAC `r = min (&1) (min r1 r2)`); + (NEW_GOAL `&0 < r`); + (EXPAND_TAC "r"); + (UNDISCH_TAC `&0 < r1` THEN UNDISCH_TAC `&0 < r2` THEN REAL_ARITH_TAC); + +(* ========================================================================= *) + + (ABBREV_TAC `f3 = + (\ul. (((smallest_angle_line (EL 2 ul) (mxi V ul) u0 u1) - u0) + dot (u1 - u0)) / + (norm ((smallest_angle_line (EL 2 ul) (mxi V ul) u0 u1) - u0) + * norm (u1 - u0)))`); + + (ABBREV_TAC `P3 = {(f3:(real^3)list->real) ul |ul | barV V 3 ul /\ + ~NULLSET (mcell 3 V ul INTER C) /\ + truncate_simplex 1 ul = [u0; u1]}`); + + (NEW_GOAL `~(P3 = {}) ==> (?b:real. b IN P3 /\ (!x. x IN P3 ==> x <= b))`); + (STRIP_TAC); + (MATCH_MP_TAC SUP_FINITE_LEMMA); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "P3"); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x | P x} = {f x | x IN {y | P y}}`]); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x IN s} = {y | ?x. x IN s /\ y = f x}`]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y | ?v0:real^3 v1 u2 u3. + v0 IN (V INTER ball (u0:real^3, &4)) /\ + v1 IN (V INTER ball (u0, &4)) /\ + u2 IN (V INTER ball (u0, &4)) /\ + u3 IN (V INTER ball (u0, &4)) /\ + y = [v0; v1; u2; u3]}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SET_LIST_LEMMA); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?v0 v1 u2 u3. x = [v0; v1; u2; u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v0:real^3` THEN EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (x:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (x:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (NEW_GOAL `set_of_list x SUBSET ball (u0:real^3,&4)`); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + (NEW_GOAL `set_of_list x SUBSET V:real^3->bool`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + + (ABBREV_TAC `d1 = (if (P3 = {}:real->bool) then c + else (@b. b IN P3 /\ (!x. x IN P3 ==> x <= b)))`); + + (NEW_GOAL `d1 < &1`); + (EXPAND_TAC "d1"); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?b:real. b IN P3 /\ (!x. x IN P3 ==> x <= b)`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `P = (\b:real. b IN P3 /\ (!x. x IN P3 ==> x <= b))`); + (ABBREV_TAC `zz = (@) (P:real->bool)`); + (NEW_GOAL `(P:real->bool) zz`); + (EXPAND_TAC "zz"); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b':real`); + (EXPAND_TAC "P" THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "P" THEN REWRITE_TAC[]); + (EXPAND_TAC "P3" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "f3"); + + (ABBREV_TAC `xx = smallest_angle_line (EL 2 ul) (mxi V ul) u0 u1`); + (MATCH_MP_TAC REAL_DIV_LT_1_TACTICS); + (STRIP_TAC); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a /\ ~(a = &0) ==> &0 < a`)); + (STRIP_TAC); + (SIMP_TAC[REAL_LE_MUL; NORM_POS_LE]); + (REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "xx"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN + REWRITE_TAC[smallest_angle_line; smallest_angle_set]); + (STRIP_TAC); + (ABBREV_TAC `Q = (\x:real^3. x IN convex hull {EL 2 ul, mxi V ul} /\ + (!y. y IN convex hull {EL 2 ul, mxi V ul} + ==> ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0))))`); + (NEW_GOAL `(Q:real^3->bool) u0`); + (REWRITE_TAC[ASSUME `u0 = (@) (Q:real^3->bool)`]); + (MATCH_MP_TAC SELECT_AX); + (EXPAND_TAC "Q"); + (MATCH_MP_TAC SMALLEST_ANGLE_LINE_EXISTS); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?v1 v2 v3. ul = [u0; v1; v2; v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (ul:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[ASSUME `v0 = u0:real^3`]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `EL 2 ul = v2:real^3`); + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (mcell 3 V ul INTER C)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 3 V ul` THEN STRIP_TAC); + (REWRITE_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; ASSUME `ul = [u0; v1; v2; v3:real^3]`; + SET_RULE `{a,b,c} UNION {d} = {a,b, c,d}`]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, v1, v2, mxi V ul}`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (UNDISCH_TAC `u0 IN convex hull {v2, mxi V ul}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN + EXISTS_TAC `mxi V ul`); + (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (STRIP_TAC); + (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (UP_ASM_TAC THEN EXPAND_TAC "Q"); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (mcell 3 V ul INTER C)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 3 V ul`); + (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]); + (REWRITE_TAC[MCELL_EXPLICIT; mcell3]); + (COND_CASES_TAC); + (NEW_GOAL `?v2 v3. ul = [u0;u1;v2;v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0;v1;v2;v3:real^3]`]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_TAC[GSYM (ASSUME `u0 = (@) (Q:real^3->bool)`)]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, v2, mxi V ul}`); + (REWRITE_TAC[ASSUME `ul = [u0; u1; v2; v3:real^3]`; + CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_WITH `affine hull {u0, u1, v2, mxi V [u0; u1; v2; v3]} = + affine hull {u1, v2, mxi V [u0; u1; v2; v3]}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + + (NEW_GOAL `convex hull {EL 2 ul, mxi V ul} SUBSET + affine hull {EL 2 ul, mxi V ul}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (NEW_GOAL `affine hull {EL 2 ul, mxi V ul} SUBSET + affine hull {u1, v2, mxi V [u0; u1; v2; v3]}`); + (MATCH_MP_TAC AFFINE_SUBSET_KY_LEMMA); + (ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]); + (SET_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN + UNDISCH_TAC `u0 IN convex hull {EL 2 ul, mxi V ul}` THEN SET_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (MATCH_MP_TAC (REAL_ARITH `(a <= b) /\ ~(a = b) ==> a < b`)); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ; NORM_CAUCHY_SCHWARZ_EQ]); + (NEW_GOAL `xx IN convex hull {(EL 2 ul) ,(mxi V ul)}`); + (MATCH_MP_TAC SMALLEST_ANGLE_IN_CONVEX_HULL); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?v1 v2 v3. ul = [u0; v1; v2; v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (ul:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[ASSUME `v0 = u0:real^3`]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `EL 2 ul = v2:real^3`); + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (mcell 3 V ul INTER C)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 3 V ul` THEN STRIP_TAC); + (REWRITE_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; ASSUME `ul = [u0; v1; v2; v3:real^3]`; + SET_RULE `{a,b,c} UNION {d} = {a,b, c,d}`]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, v1, v2, mxi V ul}`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (UNDISCH_TAC `u0 IN convex hull {v2, mxi V ul}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN + EXISTS_TAC `mxi V ul`); + (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (STRIP_TAC); + (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (mcell 3 V ul INTER C)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 3 V ul`); + (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]); + (REWRITE_TAC[MCELL_EXPLICIT; mcell3]); + (COND_CASES_TAC); + (NEW_GOAL `?v2 v3. ul = [u0;u1;v2;v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, v2, mxi V ul}`); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (ABBREV_TAC `m = mxi V ul`); + (NEW_GOAL `mxi V [u0; u1;v2;v3] = m`); + (EXPAND_TAC "m" THEN AP_TERM_TAC THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (ABBREV_TAC `k1 = norm (xx - u0:real^3)`); + (ABBREV_TAC `k2 = norm (u1 - u0:real^3)`); + (UNDISCH_TAC `xx IN convex hull {EL 2 ul, m:real^3}`); + (ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `2 = SUC 1/\ 1 = SUC 0`; + CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (UNDISCH_TAC `k1 % (u1 - u0) = k2 % (xx - u0:real^3)`); + (ASM_REWRITE_TAC[]); + + (STRIP_TAC); + + (REWRITE_TAC[coplanar]); + (NEW_GOAL `~(k2 = &0)`); + (EXPAND_TAC "k2"); + (REWRITE_TAC[NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> b = a`]); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `~(v = &0)`); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN + EXISTS_TAC `v2:real^3`); + (MATCH_MP_TAC (SET_RULE `{a,b,c} SUBSET X /\ d IN X ==> {a,b,c,d} SUBSET X`)); + (STRIP_TAC); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `(k2 - k1:real) / (k2 * v)`); + (EXISTS_TAC `k1 / (k2 * v)`); + (EXISTS_TAC `(--k2 * u) / (k2 * v)`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]); + (REWRITE_WITH `k2 - k1 + k1 + --k2 * u = k2 * (u + v) - k1 + k1 + --k2 * u`); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 0 = 1`] THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `k2 * (u + v) - k1 + k1 + --k2 * u = k2 * v`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[VECTOR_ARITH `a / x % u0 + b / x % u1 + d / x % u2 = + (&1 / x) % (a % u0 + b % u1 + d % u2)`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH + `&1 / (k2 * v) % ((k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2) = m:real^3 <=> + ((k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2) = (k2 * v) % m`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.CHANGE_SIDE); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2 = (k2 * v) % m <=> + k1 % (u1 - u0) = k2 % ((u % v2 + v % m) - u0)`]); + + (NEW_GOAL `~(u = &0)`); + (UP_ASM_TAC THEN UNDISCH_TAC `u + v = &(SUC 0):real` THEN + REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + (REAL_ARITH_TAC); + + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN + EXISTS_TAC `m:real^3`); + (MATCH_MP_TAC (SET_RULE `{a,b,c} SUBSET X /\ d IN X ==> {a,b,d,c} SUBSET X`)); + (STRIP_TAC); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + + (EXISTS_TAC `(k2 - k1:real) / (k2 * u)`); + (EXISTS_TAC `k1 / (k2 * u)`); + (EXISTS_TAC `(--k2 * v) / (k2 * u)`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]); + (REWRITE_WITH `k2 - k1 + k1 + --k2 * v = k2 * (u + v) - k1 + k1 + --k2 * v`); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 0 = 1`] THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `k2 * (u + v) - k1 + k1 + --k2 * v = k2 * u`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[VECTOR_ARITH `a / x % u0 + b / x % u1 + d / x % u2 = + (&1 / x) % (a % u0 + b % u1 + d % u2)`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH + `&1 / (k2 * u) % ((k2 - k1) % u0 + k1 % u1 + (--k2 * v) % m) = v2:real^3 <=> + ((k2 - k1) % u0 + k1 % u1 + (--k2 * v) % m) = (k2 * u) % v2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.CHANGE_SIDE); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(k2 - k1) % u0 + k1 % u1 + (--k2 * v) % m = (k2 * u) % v2 <=> + k1 % (u1 - u0) = k2 % ((u % v2 + v % m) - u0)`]); + + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + +(* ========================================================================== *) + + (ABBREV_TAC `f4 = + (\ul. (((smallest_angle_line (EL 2 ul) (EL 3 ul) u0 u1) - u0) + dot (u1 - u0)) / + (norm ((smallest_angle_line (EL 2 ul) (EL 3 ul) u0 u1) - u0) + * norm (u1 - u0)))`); + + (ABBREV_TAC `P4 = {(f4:(real^3)list->real) ul |ul | barV V 3 ul /\ + ~NULLSET (mcell 4 V ul INTER C) /\ + truncate_simplex 1 ul = [u0; u1]}`); + + (NEW_GOAL `~(P4 = {}) ==> (?b:real. b IN P4 /\ (!x. x IN P4 ==> x <= b))`); + (STRIP_TAC); + (MATCH_MP_TAC SUP_FINITE_LEMMA); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "P4"); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x | P x} = {f x | x IN {y | P y}}`]); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x IN s} = {y | ?x. x IN s /\ y = f x}`]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y | ?v0:real^3 v1 u2 u3. + v0 IN (V INTER ball (u0:real^3, &4)) /\ + v1 IN (V INTER ball (u0, &4)) /\ + u2 IN (V INTER ball (u0, &4)) /\ + u3 IN (V INTER ball (u0, &4)) /\ + y = [v0; v1; u2; u3]}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SET_LIST_LEMMA); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?v0 v1 u2 u3. x = [v0; v1; u2; u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v0:real^3` THEN EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (x:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (x:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (NEW_GOAL `set_of_list x SUBSET ball (u0:real^3,&4)`); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + (NEW_GOAL `set_of_list x SUBSET V:real^3->bool`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + + (ABBREV_TAC `d2 = (if (P4 = {}:real->bool) then c + else (@b. b IN P4 /\ (!x. x IN P4 ==> x <= b)))`); + (NEW_GOAL `d2 < &1`); + (EXPAND_TAC "d2"); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?b:real. b IN P4 /\ (!x. x IN P4 ==> x <= b)`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `P = (\b:real. b IN P4 /\ (!x. x IN P4 ==> x <= b))`); + (ABBREV_TAC `zz = (@) (P:real->bool)`); + (NEW_GOAL `(P:real->bool) zz`); + (EXPAND_TAC "zz"); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b':real`); + (EXPAND_TAC "P" THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "P" THEN REWRITE_TAC[]); + (EXPAND_TAC "P4" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "f4"); + + (ABBREV_TAC `xx = smallest_angle_line (EL 2 ul) (EL 3 ul) u0 u1`); + (MATCH_MP_TAC REAL_DIV_LT_1_TACTICS); + (STRIP_TAC); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a /\ ~(a = &0) ==> &0 < a`)); + (STRIP_TAC); + (SIMP_TAC[REAL_LE_MUL; NORM_POS_LE]); + (REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "xx"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN + REWRITE_TAC[smallest_angle_line; smallest_angle_set]); + (STRIP_TAC); + (ABBREV_TAC `Q = (\x:real^3. x IN convex hull {EL 2 ul, EL 3 ul} /\ + (!y. y IN convex hull {EL 2 ul, EL 3 ul} + ==> ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0))))`); + (NEW_GOAL `(Q:real^3->bool) u0`); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXPAND_TAC "Q"); + + (MATCH_MP_TAC SMALLEST_ANGLE_LINE_EXISTS); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?v1 v2 v3. ul = [u0; v1; v2; v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (ul:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[ASSUME `v0 = u0:real^3`]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `EL 2 ul = v2:real^3 /\ EL 3 ul = v3`); + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `3 = SUC 2 /\2 = SUC 1 /\ 1 = SUC 0`]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (mcell 4 V ul INTER C)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 4 V ul` THEN STRIP_TAC); + (SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list;ARITH_RULE `4 >= 4`; + ASSUME `ul = [u0; v1; v2; v3:real^3]`]); + (COND_CASES_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, v1, v2, v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (UNDISCH_TAC `u0 IN convex hull {v2, v3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN + EXISTS_TAC `v3:real^3`); + (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (STRIP_TAC); + (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (UP_ASM_TAC THEN EXPAND_TAC "Q"); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (mcell 4 V ul INTER C)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 4 V ul`); + (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]); + (SIMP_TAC[MCELL_EXPLICIT; mcell4; ARITH_RULE `4 >= 4`]); + (COND_CASES_TAC); + (NEW_GOAL `?v2 v3. ul = [u0;u1;v2;v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_TAC[GSYM (ASSUME `u0 = (@) (Q:real^3->bool)`)]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, v2, v3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_WITH `affine hull {u0, u1, v2, v3} = + affine hull {u1, v2, v3:real^3}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + + (NEW_GOAL `convex hull {EL 2 ul, (EL 3 ul):real^3} SUBSET + affine hull {EL 2 ul, EL 3 ul}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (NEW_GOAL `affine hull {EL 2 ul, (EL 3 ul):real^3} SUBSET + affine hull {u1, v2, v3}`); + (MATCH_MP_TAC AFFINE_SUBSET_KY_LEMMA); + (ASM_REWRITE_TAC[EL; HD; TL; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (SET_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN + UNDISCH_TAC `u0 IN convex hull {EL 2 ul, (EL 3 ul):real^3}` THEN SET_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (MATCH_MP_TAC (REAL_ARITH `(a <= b) /\ ~(a = b) ==> a < b`)); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ; NORM_CAUCHY_SCHWARZ_EQ]); + (NEW_GOAL `xx IN convex hull {(EL 2 ul) ,(EL 3 ul):real^3}`); + (MATCH_MP_TAC SMALLEST_ANGLE_IN_CONVEX_HULL); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?v1 v2 v3. ul = [u0; v1; v2; v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (ul:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[ASSUME `v0 = u0:real^3`]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `EL 2 ul = v2:real^3 /\ EL 3 ul = v3`); + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `3 = SUC 2 /\2 = SUC 1 /\ 1 = SUC 0`]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (mcell 4 V ul INTER C)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 4 V ul` THEN STRIP_TAC); + (SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list;ARITH_RULE `4 >= 4`; + ASSUME `ul = [u0; v1; v2; v3:real^3]`]); + (COND_CASES_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, v1, v2, v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (UNDISCH_TAC `u0 IN convex hull {v2, v3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN + EXISTS_TAC `v3:real^3`); + (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (STRIP_TAC); + (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (mcell 4 V ul INTER C)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 4 V ul`); + (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]); + (SIMP_TAC[MCELL_EXPLICIT; mcell4; ARITH_RULE `4 >= 4`]); + (COND_CASES_TAC); + (NEW_GOAL `?v2 v3. ul = [u0;u1;v2;v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, v2, v3:real^3}`); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (ABBREV_TAC `k1 = norm (xx - u0:real^3)`); + (ABBREV_TAC `k2 = norm (u1 - u0:real^3)`); + (UNDISCH_TAC `xx IN convex hull {EL 2 ul,(EL 3 ul):real^3}`); + (ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1/\ 1 = SUC 0`; + CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (UNDISCH_TAC `k1 % (u1 - u0) = k2 % (xx - u0:real^3)`); + (ASM_REWRITE_TAC[]); + + (STRIP_TAC); + + (REWRITE_TAC[coplanar]); + (NEW_GOAL `~(k2 = &0)`); + (EXPAND_TAC "k2"); + (REWRITE_TAC[NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> b = a`]); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `~(v = &0)`); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN + EXISTS_TAC `v2:real^3`); + (MATCH_MP_TAC (SET_RULE `{a,b,c} SUBSET X /\ d IN X ==> {a,b,c,d} SUBSET X`)); + (STRIP_TAC); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `(k2 - k1:real) / (k2 * v)`); + (EXISTS_TAC `k1 / (k2 * v)`); + (EXISTS_TAC `(--k2 * u) / (k2 * v)`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]); + (REWRITE_WITH `k2 - k1 + k1 + --k2 * u = k2 * (u + v) - k1 + k1 + --k2 * u`); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 0 = 1`] THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `k2 * (u + v) - k1 + k1 + --k2 * u = k2 * v`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[VECTOR_ARITH `a / x % u0 + b / x % u1 + d / x % u2 = + (&1 / x) % (a % u0 + b % u1 + d % u2)`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH + `&1 / (k2 * v) % ((k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2) = v3:real^3 <=> + ((k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2) = (k2 * v) % v3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.CHANGE_SIDE); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2 = (k2 * v) % v3 <=> + k1 % (u1 - u0) = k2 % ((u % v2 + v % v3) - u0)`]); + + (NEW_GOAL `~(u = &0)`); + (UP_ASM_TAC THEN UNDISCH_TAC `u + v = &(SUC 0):real` THEN + REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + (REAL_ARITH_TAC); + + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN + EXISTS_TAC `v3:real^3`); + (MATCH_MP_TAC (SET_RULE `{a,b,c} SUBSET X /\ d IN X ==> {a,b,d,c} SUBSET X`)); + (STRIP_TAC); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + + (EXISTS_TAC `(k2 - k1:real) / (k2 * u)`); + (EXISTS_TAC `k1 / (k2 * u)`); + (EXISTS_TAC `(--k2 * v) / (k2 * u)`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]); + (REWRITE_WITH `k2 - k1 + k1 + --k2 * v = k2 * (u + v) - k1 + k1 + --k2 * v`); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 0 = 1`] THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `k2 * (u + v) - k1 + k1 + --k2 * v = k2 * u`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[VECTOR_ARITH `a / x % u0 + b / x % u1 + d / x % u2 = + (&1 / x) % (a % u0 + b % u1 + d % u2)`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH + `&1 / (k2 * u) % ((k2 - k1) % u0 + k1 % u1 + (--k2 * v) % v3) = v2:real^3 <=> + ((k2 - k1) % u0 + k1 % u1 + (--k2 * v) % v3) = (k2 * u) % v2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.CHANGE_SIDE); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(k2 - k1) % u0 + k1 % u1 + (--k2 * v) % m = (k2 * u) % v2 <=> + k1 % (u1 - u0) = k2 % ((u % v2 + v % m) - u0)`]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + +(* ========================================================================== *) + + (ABBREV_TAC `d = max c (max d1 d2)`); + (NEW_GOAL `d < &1`); + (UNDISCH_TAC `d2 < &1` THEN UNDISCH_TAC `d1 < &1` THEN + UNDISCH_TAC `&0 < c /\ c < &1`); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + +(* ========================================================================== *) + + (ABBREV_TAC `D = ball (u0:real^3,r) INTER rcone_gt u0 u1 d`); + (NEW_GOAL `D SUBSET C:real^3->bool`); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + + (NEW_GOAL `!X. mcell_set V X /\ ~NULLSET (X INTER D) + ==> (?k vl. + 2 <= k /\ + barV V 3 vl /\ + X = mcell k V vl /\ + truncate_simplex 1 vl = [u0; u1])`); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[] THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER C:real^3->bool`); + (ASM_REWRITE_TAC[] THEN UNDISCH_TAC `D SUBSET C:real^3->bool`); + (SET_TAC[]); + +(* ========================================================================= *) + + (NEW_GOAL `D = conic_cap (u0:real^3) u1 r d`); + (EXPAND_TAC "D" THEN REWRITE_TAC[conic_cap; NORMBALL_BALL]); + + (NEW_GOAL `!X. mcell_set V X /\ ~NULLSET (X INTER D) ==> + vol (X INTER D) = vol (D) * (dihX V X (u0,u1)) / (&2 * pi)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `?k vl. + 2 <= k /\ + barV V 3 vl /\ + X = mcell k V vl /\ + truncate_simplex 1 vl = [u0; u1]`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + +(* ========================================================================= *) +(* Case k = 2 *) +(* ========================================================================= *) + + (ASM_CASES_TAC `k = 2`); + (ABBREV_TAC `m = mxi V vl`); + (ABBREV_TAC `s3 = omega_list_n V vl 3`); + (ABBREV_TAC `L = aff_ge{u0, u1} {m, s3:real^3}`); + + (REWRITE_WITH `vol (X INTER D) = vol (L INTER D)`); + (AP_TERM_TAC); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2]); + (LET_TAC); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (REWRITE_WITH `HD vl = u0 /\ HD (TL vl) = u1:real^3`); + (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = v1:real^3`); + (REWRITE_TAC[ASSUME `vl = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + + (EXPAND_TAC "L"); + (REWRITE_TAC [SET_RULE `(A INTER B INTER C) INTER D = C INTER D + <=> (!x. x IN C INTER D ==> x IN A /\ x IN B)`]); + + (REPEAT GEN_TAC THEN STRIP_TAC); + (NEW_GOAL `x:real^3 IN D`); + (UP_ASM_TAC THEN UNDISCH_TAC `D = conic_cap (u0:real^3) u1 r d`); + (SET_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "D" THEN STRIP_TAC); + (NEW_GOAL `x:real^3 IN rcone_gt u0 u1 a'`); + (NEW_GOAL `rcone_gt (u0:real^3) u1 d SUBSET rcone_gt u0 u1 c`); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC + `rcone_gt (u0:real^3) u1 c SUBSET W INTER rcone_gt u0 u1 a'`); + (SET_TAC[]); + (STRIP_TAC); + (UP_ASM_TAC THEN SET_TAC[RCONE_GT_SUBSET_RCONE_GE]); + +(* ========================================================================== *) + (UP_ASM_TAC THEN REWRITE_TAC[rcone_ge; rconesgn; rcone_gt; IN; IN_ELIM_THM]); + (STRIP_TAC); + + (ABBREV_TAC `y = u0 + proj_point (u1 - u0:real^3) (x - u0)`); + (NEW_GOAL `orthogonal (x - y) (u1 - u0:real^3)`); + (REWRITE_WITH `x - y = (x - u0) - proj_point (u1 - u0) (x - u0:real^3)`); + (EXPAND_TAC "y" THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[GSYM Marchal_cells_2_new.projection_proj_point]); + (REWRITE_TAC[orthogonal; Packing3.PROJECTION_ORTHOGONAL]); + + (NEW_GOAL `norm (x - u0) pow 2 = norm (y - u0) pow 2 + norm (x - y:real^3) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (ONCE_REWRITE_TAC[VECTOR_ARITH `(a - b) dot c = --(c dot (b - a))`]); + (REWRITE_WITH `y - u0 = proj_point (u1 - u0) (x - u0:real^3)`); + (EXPAND_TAC "y" THEN REWRITE_TAC[VECTOR_ARITH `(a + b) - a:real^3 = b`]); + (REWRITE_TAC[PRO_EXP; DOT_RMUL]); + (UP_ASM_TAC THEN REWRITE_TAC[orthogonal] THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + + (NEW_GOAL `norm (x - u1) pow 2 = norm (y - u1) pow 2 + norm (x - y:real^3) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (ONCE_REWRITE_TAC[VECTOR_ARITH `(a - b) dot c = c dot (a - b)`]); + (REWRITE_WITH `u1 - y = (u1 - u0) - proj_point (u1 - u0) (x - u0:real^3)`); + (EXPAND_TAC "y" THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[PRO_EXP; VECTOR_ARITH `x - a % x = (&1 - a) % x`]); + (REWRITE_TAC[DOT_RMUL] THEN DEL_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[orthogonal] THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + + (MP_TAC (ASSUME `(x - u0:real^3) dot (u1 - u0) > + dist (x,u0) * dist (u1,u0) * a'`)); + (REWRITE_WITH `(x - u0) dot (u1 - u0) = + (x - y) dot (u1 - u0) + (y - u0) dot (u1 - u0:real^3)`); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `(x - u1) dot (u0 - u1) = + (x - y) dot (u0 - u1) + (y - u1) dot (u0 - u1:real^3)`); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `(x - y) dot (u1 - u0:real^3) = &0`); + (ASM_REWRITE_TAC[GSYM orthogonal]); + (REWRITE_WITH `(x - y) dot (u0 - u1:real^3) = &0`); + (ONCE_REWRITE_TAC[VECTOR_ARITH `a dot (u0 - u1) = --(a dot (u1 - u0))`]); + (REWRITE_TAC[REAL_ARITH `--a = &0 <=> a = &0`]); + (ASM_REWRITE_TAC[GSYM orthogonal]); + (REWRITE_TAC[REAL_ARITH `&0 + a = a`]); + + (STRIP_TAC); + (NEW_GOAL `(y - u0) dot (u1 - u0) = norm (y - u0) * norm (u1 - u0:real^3)`); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ_EQ]); + (REWRITE_WITH `y - u0 = proj_point (u1 - u0) (x - u0:real^3)`); + (EXPAND_TAC "y" THEN REWRITE_TAC[VECTOR_ARITH `(a + b) - a:real^3 = b`]); + (REWRITE_TAC[PRO_EXP; NORM_MUL; VECTOR_MUL_ASSOC]); + (MATCH_MP_TAC (MESON[] `a = b ==> a % x = b % x`)); + (REWRITE_TAC[REAL_ARITH `a * norm b = norm b * a`]); + (MATCH_MP_TAC (MESON[] `a = b ==> x * a = x * b`)); + (REWRITE_TAC[REAL_ABS_REFL]); + (MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[DOT_POS_LE]); + + (REWRITE_WITH `(x - u0) dot (u1 - u0) = + (x - y) dot (u1 - u0) + (y - u0) dot (u1 - u0:real^3)`); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `(x - y) dot (u1 - u0:real^3) = &0`); + (ASM_REWRITE_TAC[GSYM orthogonal]); + (REWRITE_TAC[REAL_ARITH `&0 + a = a`]); + + (NEW_GOAL `y IN convex hull {u0, u1:real^3}`); + (NEW_GOAL `y IN affine hull {u0, u1:real^3}`); + (REWRITE_TAC[AFFINE_HULL_2; IN; IN_ELIM_THM]); + (EXPAND_TAC "y" THEN REWRITE_TAC[PRO_EXP]); + (ABBREV_TAC `rtemp = ((x - u0) dot (u1 - u0)) / ((u1 - u0) dot (u1 - + u0:real^3))`); + (EXISTS_TAC `&1 - rtemp` THEN EXISTS_TAC `rtemp:real`); + (STRIP_TAC); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[IN; AFFINE_HULL_2; CONVEX_HULL_2; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `y - u0 = v % (u1 - u0:real^3)`); + (NEW_GOAL `y - u0 = y - (u + v) % u0:real^3`); + (REWRITE_TAC[ASSUME `u + v = &1`; VECTOR_MUL_LID]); + (UP_ASM_TAC THEN REWRITE_WITH `y - (u + v) % u0 = v % (u1 - u0:real^3)`); + (REWRITE_TAC[ASSUME `y = u % u0 + v % u1:real^3`] THEN VECTOR_ARITH_TAC); + + (ASM_CASES_TAC `u < &0`); + (NEW_GOAL `F`); + (NEW_GOAL `norm (y - u0) <= norm (x - u0:real^3)`); + (MATCH_MP_TAC Tactics_jordan.REAL_POW_2_LE); + (REWRITE_TAC[NORM_POS_LE; ASSUME + `norm (x - u0:real^3) pow 2 = norm (y - u0) pow 2 + norm (x - y) pow 2`; + REAL_ARITH `a <= a + b <=> &0 <= b`; REAL_LE_POW_2]); + (NEW_GOAL `norm (x - u0:real^3) < &1`); + (REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN + REWRITE_TAC[GSYM IN_BALL]); + (NEW_GOAL `ball (u0:real^3, r) SUBSET ball (u0, &1)`); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC + `x IN ball (u0:real^3,r) INTER rcone_gt u0 u1 d` THEN SET_TAC[]); + + (NEW_GOAL `norm (y - u0) = v * norm (u1:real^3 - u0)`); + (ASM_REWRITE_TAC[NORM_MUL]); + + (REWRITE_WITH `abs v = v`); + (REWRITE_TAC[REAL_ABS_REFL]); + (UNDISCH_TAC `u + v = &1` THEN UNDISCH_TAC `u < &0` THEN REAL_ARITH_TAC); + (NEW_GOAL `&2 <= norm (u1 - u0:real^3)`); + (REWRITE_TAC[GSYM dist]); + (UNDISCH_TAC `packing (V:real^3->bool)` THEN REWRITE_TAC[packing]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[MESON[IN] `V x <=> x IN (V:real^3->bool)`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `v * &2 <= v * norm (u1 - u0:real^3)`); + (REWRITE_TAC[REAL_ARITH `a * b <= a * c <=> &0 <= a * (c - b)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (UNDISCH_TAC `u + v = &1` THEN UNDISCH_TAC `u < &0` THEN UP_ASM_TAC); + (REAL_ARITH_TAC); + + (NEW_GOAL `&1 < v`); + (UNDISCH_TAC `u + v = &1` THEN UNDISCH_TAC `u < &0` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN + UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `v < &0`); + (NEW_GOAL `F`); + (NEW_GOAL `(y - u0) dot (u1 - u0:real^3) <= &0`); + (ASM_REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DOT_POS_LE]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `&0 <= dist (x,u0) * dist (u1,u0:real^3) * a'`); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (EXPAND_TAC "a'" THEN MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (REWRITE_TAC[HL_2]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE] THEN REAL_ARITH_TAC); + (MATCH_MP_TAC SQRT_POS_LE THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC + `(y - u0:real^3) dot (u1 - u0) > dist (x,u0) * dist (u1,u0) * a'`); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `&0 <= dist (x,u0) * dist (u1,u0:real^3) * a'`); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (EXPAND_TAC "a'" THEN MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (REWRITE_TAC[HL_2]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE] THEN REAL_ARITH_TAC); + (MATCH_MP_TAC SQRT_POS_LE THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `(y - u1) dot (u0 - u1) = norm (y - u1) * norm (u0 - u1:real^3)`); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ_EQ]); + (REWRITE_WITH `y - u1 = proj_point (u1 - u0) (x - u0:real^3) - (u1 - u0)`); + (EXPAND_TAC "y" THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[PRO_EXP; VECTOR_ARITH `x % a - a = (x - &1) % a`; NORM_MUL; + VECTOR_MUL_ASSOC]); + (REWRITE_WITH ` + (norm (u0 - u1) * + (((x - u0) dot (u1 - u0)) / ((u1 - u0) dot (u1 - u0)) - &1)) % (u1 - u0) = + (norm (u0 - u1:real^3) * + (&1 - ((x - u0) dot (u1 - u0)) / ((u1 - u0) dot (u1 - u0)))) % (u0 - u1)`); + (VECTOR_ARITH_TAC); + (MATCH_MP_TAC (MESON[] `a = b ==> a % x = b % x`)); + (REWRITE_TAC[REAL_ARITH `a * norm b = norm b * a`]); + (REWRITE_TAC[NORM_ARITH `norm (a - b) = norm (b - a)`]); + (MATCH_MP_TAC (MESON[] `a = b ==> x * a = x * b`)); + (REWRITE_TAC[REAL_ARITH `abs (x - &1) = abs (&1 - x)`]); + (REWRITE_TAC[REAL_ABS_REFL; REAL_ARITH `&0 <= a - b <=> b <= a`]); + (REWRITE_WITH `((x - u0) dot (u1 - u0)) / ((u1 - u0) dot (u1 - u0)) <= &1 + <=> ((x - u0) dot (u1 - u0)) <= &1 * ((u1 - u0) dot (u1 - u0:real^3))`); + (MATCH_MP_TAC REAL_LE_LDIV_EQ); + (REWRITE_TAC[DOT_POS_LT; VECTOR_ARITH `a - b = vec 0 <=> b = a`]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(x - u0) dot (u1 - u0) <= norm (x - u0) * norm (u1 - u0:real^3)`); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ]); + + (NEW_GOAL `norm (x - u0) * norm (u1 - u0) <= &1 * norm (u1 - u0:real^3)`); + (REWRITE_TAC[REAL_ARITH `a * x <= b * x <=> &0 <= (b - a) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `&0 <= a - b <=> b <= a`; GSYM dist]); + (MATCH_MP_TAC (REAL_ARITH `a < x ==> a <= x`)); + (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[GSYM IN_BALL]); + (NEW_GOAL `ball (u0:real^3, r) SUBSET ball (u0, &1)`); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC + `x IN ball (u0:real^3,r) INTER rcone_gt u0 u1 d` THEN SET_TAC[]); + (REWRITE_TAC[GSYM NORM_POW_2; REAL_ARITH `&1 * a pow 2 = a * a`]); + (NEW_GOAL `&1 * norm (u1 - u0) <= norm (u1 - u0) * norm (u1 - u0:real^3)`); + (REWRITE_TAC[REAL_ARITH `a * x <= b * x <=> &0 <= (b - a) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `&0 <= a - b <=> b <= a`; GSYM dist]); + (MATCH_MP_TAC (REAL_ARITH `&2 <= x ==> &1 <= x`)); + (UNDISCH_TAC `packing (V:real^3->bool)` THEN REWRITE_TAC[packing]); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[MESON[IN] `V x <=> x IN (V:real^3->bool)`]); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `(x - u0:real^3) dot (u1 - u0) <= + norm (x - u0) * norm (u1 - u0)` THEN + UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[dist]); + (REWRITE_TAC[REAL_ARITH `a * b >= x * b * c <=> &0 <= b * (a - x * c)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `&0 <= a - b <=> b <= a`]); + (MATCH_MP_TAC Tactics_jordan.REAL_POW_2_LE); + (STRIP_TAC); + + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (EXPAND_TAC "a'" THEN MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (REWRITE_TAC[HL_2]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE] THEN REAL_ARITH_TAC); + (MATCH_MP_TAC SQRT_POS_LE THEN REAL_ARITH_TAC); + (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `(a * b) pow 2 = a pow 2 * b pow 2`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `(a + b) * x <= a <=> b * x <= (&1 - x) * a`]); + + (UNDISCH_TAC `(y - u0) dot (u1 - u0) > dist (x,u0) * dist (u1,u0:real^3) * a'`); + (ASM_REWRITE_TAC[dist]); + (REWRITE_TAC[REAL_ARITH `a * b > x * b * c <=> &0 < b * (a - x * c)`]); + (REWRITE_TAC[REAL_MUL_POS_LT]); + (REWRITE_WITH `~(norm (u1 - u0:real^3) < &0 /\ + norm (y - u0) - norm (x - u0) * a' < &0)`); + (NEW_GOAL `&0 <= norm (u1 - u0:real^3)`); + (REWRITE_TAC[NORM_POS_LE]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&0 < a - b <=> b < a`]); + (REWRITE_WITH `norm (x - u0) * a' < norm (y - u0:real^3) <=> + (norm (x - u0) * a') pow 2 < norm (y - u0) pow 2`); + (MATCH_MP_TAC Pack1.bp_bdt); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (EXPAND_TAC "a'" THEN MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (REWRITE_TAC[HL_2]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE] THEN REAL_ARITH_TAC); + (MATCH_MP_TAC SQRT_POS_LE THEN REAL_ARITH_TAC); + (REWRITE_TAC[NORM_POS_LE]); + + (ASM_REWRITE_TAC[REAL_ARITH `(a * b) pow 2 = a pow 2 * b pow 2`]); + (REWRITE_TAC[REAL_ARITH `(a + b) * x < a <=> b * x < (&1 - x) * a`]); + (STRIP_TAC); + + (NEW_GOAL `(&1 - a' pow 2) * norm (y - u0) pow 2 <= + (&1 - a' pow 2) * norm (y - u1:real^3) pow 2`); + (REWRITE_TAC[REAL_ARITH `a * x <= a * y <=> &0 <= a * (y - x)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 <= &1 - b <=> b <= &1 pow 2`]); + (REWRITE_WITH `a' pow 2 <= &1 pow 2 <=> a' <= &1`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.POW2_COND); + (REWRITE_TAC[REAL_ARITH `&0 <= &1`]); + (EXPAND_TAC "a'" THEN MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (REWRITE_TAC[HL_2]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE] THEN REAL_ARITH_TAC); + (MATCH_MP_TAC SQRT_POS_LE THEN REAL_ARITH_TAC); + + (EXPAND_TAC "a'"); + (MATCH_MP_TAC REAL_DIV_LE_1_TACTICS); + (ASM_SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]); + (UNDISCH_TAC `hl [u0; u1:real^3] < sqrt (&2)` THEN REAL_ARITH_TAC); + (NEW_GOAL `norm (x - u0) pow 2 <= norm (x - u1:real^3) pow 2`); + (REWRITE_WITH `norm (x - u0) pow 2 <= norm (x - u1:real^3) pow 2 <=> + norm (x - u0) <= norm (x - u1:real^3)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.POW2_COND); + (REWRITE_TAC[NORM_POS_LE]); + (MATCH_MP_TAC (REAL_ARITH `&2 * x <= x + y ==> x <= y`)); + (REWRITE_TAC[GSYM dist]); + + (NEW_GOAL `dist (x, u0:real^3) < &1`); + (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[GSYM IN_BALL]); + (NEW_GOAL `ball (u0:real^3, r) SUBSET ball (u0, &1)`); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC + `x IN ball (u0:real^3,r) INTER rcone_gt u0 u1 d` THEN SET_TAC[]); + (NEW_GOAL `&2 * dist (x, u0:real^3) < &2`); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (NEW_GOAL `&2 <= dist (x, u0) + dist (x, u1:real^3)`); + (NEW_GOAL `&2 <= dist (u0, u1:real^3)`); + (UNDISCH_TAC `packing (V:real^3->bool)` THEN REWRITE_TAC[packing]); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[MESON[IN] `V a <=> a:real^3 IN V`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `dist (u0, u1:real^3) <= dist (u0, x) + dist (x, u1)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_SYM]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER C:real^3->bool`); + (ASM_SIMP_TAC [SET_RULE `A SUBSET B ==> X INTER A SUBSET X INTER B`]); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2; SET_RULE `{} INTER s = {}`]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `~coplanar {u0, u1:real^3, m, s3}`); + (ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, m, s3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (UP_ASM_TAC THEN MESON_TAC[]); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2]); + (COND_CASES_TAC); + (LET_TAC); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> M INTER N INTER A SUBSET B`)); + + (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `HD vl = u0 /\ HD (TL vl) = u1:real^3`); + (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = v1:real^3`); + (REWRITE_TAC[ASSUME `vl = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_WITH `{u0, u1, m, s3} = {u0, u1} UNION {m:real^3, s3}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[] THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + +(* ========================================================================= *) + (ASM_CASES_TAC `azim u0 u1 m (s3:real^3) < pi`); + (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 m s3)`); + (ASM_SIMP_TAC[WEDGE_LUNE]); + (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`); + (SET_TAC[]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {m, s3} DIFF conic_cap u0 u1 r d INTER L = {}`); + (EXPAND_TAC "L"); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`)); + (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]); + (REWRITE_TAC[SET_RULE `A UNION {} = A`]); + (EXPAND_TAC "L"); + + (REWRITE_WITH `aff_ge {u0, u1:real^3} {m, s3} = + aff_gt {u0, u1} {m, s3} UNION + UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}}`); + (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[DISJOINT]); + + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`); + (REWRITE_WITH `{u0, u1, m, s3} = {u0, u1, s3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `s3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`); + (REWRITE_WITH `{u0, u1, m, s3} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({m, s3} DELETE a) | a | a IN {m, s3}}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `aff_ge {u0, u1:real^3} {m} UNION aff_ge {u0, u1:real^3} {s3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, m}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,m:real^3} = {u0,u1} UNION {m}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, s3}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,s3:real^3} = {u0,u1} UNION {s3}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`)); + (STRIP_TAC); + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`); + (REWRITE_WITH `{u0, u1, m, s3} = {u0, u1, s3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `s3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`); + (REWRITE_WITH `{u0, u1, m, s3} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (SET_TAC[]); + + (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]); + (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 m s3) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 m s3 / &3 * (&1 - max d (-- &1)) * r pow 3)`); + (NEW_GOAL `~collinear {u0:real^3, u1, m} /\ ~collinear {u0, u1, s3}`); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s3:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `azim (u0:real^3) u1 m s3 = dihV u0 u1 m s3`); + (MATCH_MP_TAC AZIM_DIHV_SAME); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s3:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (LET_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(2, vl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN; ARITH_RULE `2 <= 4`] THEN ASM_REWRITE_TAC[]); + (REWRITE_WITH `initial_sublist [u0;u1:real^3] vl /\ LENGTH [u0;u1] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC); + + (NEW_GOAL `k' = 2 /\ mcell k' V ul = mcell 2 V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell k' V ul INTER mcell 2 V vl = X`); + (SET_TAC[ASSUME `X = mcell k' V ul`; + ASSUME `X = mcell k V vl`; ASSUME `k = 2`]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[]); + + (COND_CASES_TAC); + (REWRITE_TAC[dihu2]); + + (REWRITE_WITH `omega_list_n V ul 3 = s3`); + (EXPAND_TAC "s3"); + (NEW_GOAL `2 = 2 /\ + (!k. 2 - 1 <= k /\ k <= 3 + ==> omega_list_n V ul k = omega_list_n V vl k)`); + (MATCH_MP_TAC MCELL_ID_OMEGA_LIST_N); + (ASM_REWRITE_TAC[SET_RULE `2 IN {2,3,4}`]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k' V ul`); GSYM (ASSUME `k' = 2`)]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (FIRST_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + + (REWRITE_WITH `mxi V ul = m`); + (EXPAND_TAC "m"); + (MATCH_MP_TAC MCELL_ID_MXI); + (EXISTS_TAC `2` THEN EXISTS_TAC `2`); + (ASM_REWRITE_TAC[SET_RULE `2 IN {2,3}`]); + (STRIP_TAC); + + (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[HD]); + + (REWRITE_WITH `(HD ul):real^3 = HD (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[HD]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k' V ul`); GSYM (ASSUME `k' = 2`)]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `initial_sublist [u0; u1:real^3] ul /\ LENGTH [u0; u1] = 1 + 1`); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[EL; HD; ARITH_RULE `1 = SUC 0`; TL]); + (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]); + (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]); + (AP_THM_TAC THEN AP_TERM_TAC); + + (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`); + (MATCH_MP_TAC VOLUME_CONIC_CAP); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN MESON_TAC[]); + (UNDISCH_TAC `d < &1` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + + + (REWRITE_WITH `max d (--(&1)) = d`); + (MATCH_MP_TAC (REAL_ARITH `&0 < d /\ --(&1) < &0 ==> max d (--(&1)) = d`)); + (REWRITE_TAC[REAL_NEG_LT0]); + (STRIP_TAC); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) +(* OK here *) + + (ASM_CASES_TAC `azim u0 u1 s3 (m:real^3) < pi`); + (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (STRIP_TAC); + (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 s3 m)`); + (ASM_SIMP_TAC[WEDGE_LUNE]); + (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`); + (SET_TAC[]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + + (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {s3, m} DIFF conic_cap u0 u1 r d INTER L = {}`); + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`)); + (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]); + (REWRITE_TAC[SET_RULE `A UNION {} = A`]); + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]); + + (REWRITE_WITH `aff_ge {u0, u1:real^3} {m, s3} = + aff_gt {u0, u1} {m, s3} UNION + UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}}`); + (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[DISJOINT]); + + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, s3, m:real^3}`); + (REWRITE_WITH `{u0, u1, s3, m} = {u0, u1, s3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `s3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, s3, m:real^3}`); + (REWRITE_WITH `{u0, u1, s3, m} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({m, s3} DELETE a) | a | a IN {m, s3}}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `aff_ge {u0, u1:real^3} {m} UNION aff_ge {u0, u1:real^3} {s3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, m}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,m:real^3} = {u0,u1} UNION {m}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, s3}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,s3:real^3} = {u0,u1} UNION {s3}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`)); + (STRIP_TAC); + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, s3, m:real^3}`); + (REWRITE_WITH `{u0, u1, s3, m} = {u0, u1, s3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `s3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, s3, m:real^3}`); + (REWRITE_WITH `{u0, u1, s3, m} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (SET_TAC[]); + + (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]); + (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 s3 m) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 s3 m / &3 * (&1 - max d (-- &1)) * r pow 3)`); + (NEW_GOAL `~collinear {u0:real^3, u1, m} /\ ~collinear {u0, u1, s3}`); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s3:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ASM_REWRITE_TAC[]); + + (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + + (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `azim (u0:real^3) u1 s3 m = dihV u0 u1 s3 m`); + (MATCH_MP_TAC AZIM_DIHV_SAME); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s3:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (LET_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(2, vl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN; ARITH_RULE `2 <= 4`] THEN ASM_REWRITE_TAC[]); + (REWRITE_WITH `initial_sublist [u0;u1:real^3] vl /\ LENGTH [u0;u1] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC); + + (NEW_GOAL `k' = 2 /\ mcell k' V ul = mcell 2 V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell k' V ul INTER mcell 2 V vl = X`); + (REWRITE_TAC[ASSUME `X = mcell k V vl`; GSYM (ASSUME `X = mcell k' V ul`); + ASSUME `k = 2`]); + (SET_TAC[]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]); + (SET_TAC[]); + (UNDISCH_TAC `~NULLSET X` THEN UP_ASM_TAC THEN MESON_TAC[]); + + (COND_CASES_TAC); + (REWRITE_TAC[dihu2]); + (REWRITE_WITH `omega_list_n V ul 3 = s3`); + (EXPAND_TAC "s3"); + (NEW_GOAL `2 = 2 /\ + (!k. 2 - 1 <= k /\ k <= 3 + ==> omega_list_n V ul k = omega_list_n V vl k)`); + (MATCH_MP_TAC MCELL_ID_OMEGA_LIST_N); + (ASM_REWRITE_TAC[SET_RULE `2 IN {2,3,4}`]); + (STRIP_TAC); + (MESON_TAC[ASSUME `X = mcell k V vl`; ASSUME `X = mcell k' V ul`; + ASSUME `k = 2`; ASSUME `k' = 2`]); + (REWRITE_WITH `mcell 2 V ul = X`); + (MESON_TAC[ASSUME `X = mcell k' V ul`; ASSUME `k' = 2`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + + (REWRITE_WITH `mxi V ul = m`); + (EXPAND_TAC "m"); + (MATCH_MP_TAC MCELL_ID_MXI); + (EXISTS_TAC `2` THEN EXISTS_TAC `2`); + (ASM_REWRITE_TAC[SET_RULE `2 IN {2,3}`]); + (STRIP_TAC); + + (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[HD]); + + (REWRITE_WITH `(HD ul):real^3 = HD (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[HD]); + + (STRIP_TAC); + (MESON_TAC[ASSUME `X = mcell k V vl`; ASSUME `X = mcell k' V ul`; + ASSUME `k = 2`; ASSUME `k' = 2`]); + (REWRITE_WITH `mcell 2 V ul = X`); + (MESON_TAC[ASSUME `X = mcell k' V ul`; ASSUME `k' = 2`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `initial_sublist [u0; u1:real^3] ul /\ LENGTH [u0; u1] = 1 + 1`); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[EL; HD; ARITH_RULE `1 = SUC 0`; TL]); + (REWRITE_TAC[DIHV_SYM_2]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + + (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]); + (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]); + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`); + (MATCH_MP_TAC VOLUME_CONIC_CAP); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (UP_ASM_TAC THEN UNDISCH_TAC `d < &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `&0 < r` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `max d (--(&1)) = d`); + (MATCH_MP_TAC (REAL_ARITH `&0 < d ==> max d (--(&1)) = d`)); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================== *) + + (NEW_GOAL `F`); + (NEW_GOAL `azim (u0:real^3) u1 s3 m = + (if azim u0 u1 m s3 = &0 then &0 else &2 * pi - azim u0 u1 m s3)`); + (MATCH_MP_TAC AZIM_COMPL); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s3:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b, d, c}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN COND_CASES_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `(&0 < pi)`); + (REWRITE_TAC[PI_POS]); + (UNDISCH_TAC `~(azim (u0:real^3) u1 m s3 < pi)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (STRIP_TAC); + + (NEW_GOAL `azim (u0:real^3) u1 m s3 = pi`); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`); + (REWRITE_TAC[] THEN MATCH_MP_TAC AZIM_EQ_0_PI_IMP_COPLANAR); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + +(* ========================================================================= *) +(* Case k >= 4 *) +(* ========================================================================= *) + + (ASM_CASES_TAC `k >= 4`); + (NEW_GOAL `?u2 u3. vl = [u0; u1;u2;u3:real^3]`); + (NEW_GOAL `?v0 v1 u2 u3. vl = [v0; v1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + + (REWRITE_WITH `u0 = v0:real^3`); + (REWRITE_WITH `v0:real^3 = HD (truncate_simplex 1 vl)`); + (REWRITE_TAC[ASSUME `vl = [v0;v1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + + (REWRITE_WITH `u1 = v1:real^3`); + (REWRITE_WITH `v1:real^3 = HD (TL (truncate_simplex 1 vl))`); + (REWRITE_TAC[ASSUME `vl = [v0;v1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ABBREV_TAC `L = aff_ge{u0, u1} {u2, u3:real^3}`); + + (REWRITE_WITH `vol (X INTER D) = vol (L INTER D)`); + (AP_TERM_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4; ARITH_RULE `4 >= 4`;set_of_list]); + (COND_CASES_TAC); + + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `A = B <=> A SUBSET B /\ B SUBSET A`]); + (STRIP_TAC); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> A INTER X SUBSET B INTER X`)); + (REWRITE_TAC[Marchal_cells_2.CONVEX_HULL_4_SUBSET_AFF_GE_2_2]); + (MATCH_MP_TAC (SET_RULE `(!x. x IN A /\ x IN B ==> x IN C) ==> + A INTER B SUBSET C INTER B`)); + (NEW_GOAL `DISJOINT {u0,u1:real^3} {u2, u3}`); + (REWRITE_TAC[DISJOINT]); + (MATCH_MP_TAC (MESON[] `(~A:bool ==> F) ==> A`)); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN REWRITE_TAC[SET_RULE `A INTER X SUBSET A`]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (NEW_GOAL `u3 IN {u0, u1:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + + (SIMP_TAC[ASSUME `DISJOINT {u0, u1} {u2, u3:real^3}`; AFF_GE_2_2]); + (REWRITE_TAC[CONVEX_HULL_4; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN + EXISTS_TAC `t3:real` THEN EXISTS_TAC `t4:real`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= a <=> (a < &0 ==> F)`]); + (STRIP_TAC); + (UNDISCH_TAC `conic_cap (u0:real^3) u1 r d x`); + (REWRITE_TAC[MESON[IN] `conic_cap u0 u1 r d x <=> x IN conic_cap u0 u1 r d`; + GSYM (ASSUME `D = conic_cap (u0:real^3) u1 r d`)]); + (EXPAND_TAC "D"); + (REWRITE_TAC[IN_INTER; MESON[] `~(x:bool /\ y) <=> (~x \/ ~y)`]); + (DISJ1_TAC); + (REWRITE_TAC[IN_BALL] THEN STRIP_TAC); + + (NEW_GOAL `(?b1:real. b1 IN P2 /\ (!x. x IN P2 ==> b1 <= x))`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f2:(real^3)list -> real) vl`); + (EXPAND_TAC "P2" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `r2 = (@b. b IN P2 /\ (!x. x IN P2 ==> b <= x:real))`); + (EXPAND_TAC "r2"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f2:(real^3)list -> real) vl`); + (EXPAND_TAC "P2" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[]); + + (ABBREV_TAC `Q1 = (\b:real. b IN P2 /\ (!x. x IN P2 ==> b <= x))`); + (NEW_GOAL `(Q1:real->bool) r2`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b1:real` THEN EXPAND_TAC "Q1"); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "Q1" THEN REPEAT STRIP_TAC); + (NEW_GOAL `r2 <= f2 (vl:(real^3)list)`); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "P2" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + + (UP_ASM_TAC THEN EXPAND_TAC "f2" THEN REWRITE_TAC[EL; HD; TL; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `vl= [u0; u1; u2; u3:real^3]`] THEN STRIP_TAC); + (NEW_GOAL `!v. v IN affine hull {u1, u2, u3:real^3} ==> r2 <= dist (u0, v)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,closest_point (affine hull {u1, u2, u3}) u0) <= + dist (u0, v:real^3)`); + (MATCH_MP_TAC CLOSEST_POINT_LE); + (ASM_REWRITE_TAC[CLOSED_AFFINE_HULL]); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `r <= dist (u0:real^3, x)`); + (REWRITE_TAC[dist]); + (REWRITE_WITH `u0:real^3 - x = (t1 + t2 + t3 + t4) % u0 - x`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ADD_RDISTRIB]); + (ASM_REWRITE_TAC[VECTOR_ARITH `(t1 % u0 + t2 % u0 + t3 % u0 + t4 % u0) - + (t1 % u0 + t2 % u1 + t3 % u2 + t4 % u3) = + (t2 + t3 + t4) % u0 - (t2 % u1 + t3 % u2 + t4 % u3)`]); + (ABBREV_TAC `y:real^3 = t2 /(t2 + t3 + t4) % u1 + + t3 /(t2 + t3 + t4) % u2 + + t4 /(t2 + t3 + t4) % u3`); + (REWRITE_WITH `(t2 % u1 + t3 % u2 + t4 % u3) = (t2 + t3 + t4) % (y:real^3)`); + (EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_ARITH `x % (t2 / x % u1 + t3 / x % u2 + t4 / x % u3) = + (x / x) % (t2 % u1 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `(t2 + t3 + t4) / (t2 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t1 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1`); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `a % x - a % y = a % (x - y)`; NORM_MUL]); + + (NEW_GOAL `&1 < t2 + t3 + t4`); + (UNDISCH_TAC `t1 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1`); + (REAL_ARITH_TAC); + (REWRITE_WITH `abs (t2 + t3 + t4) = t2 + t3 + t4`); + (REWRITE_TAC[REAL_ABS_REFL] THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (REWRITE_TAC[GSYM dist]); + (NEW_GOAL `r2 <= dist (u0, y:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `t2 / (t2 + t3 + t4)` THEN EXISTS_TAC `t3 / (t2 + t3 + t4)` THEN + EXISTS_TAC `t4 / (t2 + t3 + t4)`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `r2 <= (t2 + t3 + t4) * dist (u0,y:real^3)`); + (NEW_GOAL `dist (u0,y) <= (t2 + t3 + t4) * dist (u0,y:real^3)`); + (REWRITE_TAC[REAL_ARITH `a <= b * a <=> &0 <= (b - &1) * a`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (DEL_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (EXPAND_TAC "r" THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `dist (u0, x:real^3) < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + +(* ========================================================================== *) + + + (REWRITE_TAC[REAL_ARITH `&0 <= a <=> (a < &0 ==> F)`]); + (STRIP_TAC); + (UNDISCH_TAC `conic_cap (u0:real^3) u1 r d x`); + (REWRITE_TAC[MESON[IN] `conic_cap u0 u1 r d x <=> x IN conic_cap u0 u1 r d`; + GSYM (ASSUME `D = conic_cap (u0:real^3) u1 r d`)]); + (EXPAND_TAC "D"); + (REWRITE_TAC[IN_INTER; MESON[] `~(x:bool /\ y) <=> (~x \/ ~y)`]); + (DISJ2_TAC); + (REWRITE_TAC[IN; IN_ELIM_THM; rcone_gt; rconesgn] THEN STRIP_TAC); + + (NEW_GOAL `(?b1:real. b1 IN P4 /\ (!x. x IN P4 ==> x <= b1))`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f4:(real^3)list -> real) vl`); + (EXPAND_TAC "P4" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `d2 = (@b. b IN P4 /\ (!x. x IN P4 ==> x <= b:real))`); + (EXPAND_TAC "d2"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f4:(real^3)list -> real) vl`); + (EXPAND_TAC "P4" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[]); + + (ABBREV_TAC `Q1 = (\b:real. b IN P4 /\ (!x. x IN P4 ==> x <= b))`); + (NEW_GOAL `(Q1:real->bool) d2`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b1:real` THEN EXPAND_TAC "Q1"); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "Q1" THEN REPEAT STRIP_TAC); + + (NEW_GOAL `f4 (vl:(real^3)list) <= d2`); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "P4" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + + (UP_ASM_TAC THEN EXPAND_TAC "f4"); + (REWRITE_TAC[EL; HD; TL; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `vl= [u0; u1; u2; u3:real^3]`] THEN STRIP_TAC); + (ABBREV_TAC `xx = smallest_angle_line u2 u3 u0 u1`); + + (MP_TAC (ASSUME `smallest_angle_line u2 u3 u0 u1 = xx`)); + (REWRITE_TAC[smallest_angle_line; smallest_angle_set]); + (ABBREV_TAC `Q2 = + (\x:real^3. x IN convex hull {u2, u3} /\ + (!y. y IN convex hull {u2, u3} + ==> ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0))))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN STRIP_TAC); + (NEW_GOAL `(Q2:real^3->bool) xx`); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXPAND_TAC "Q2"); + + (MATCH_MP_TAC SMALLEST_ANGLE_LINE_EXISTS); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list;ARITH_RULE `4 >= 4`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (UNDISCH_TAC `u0 IN convex hull {u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`); + (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (STRIP_TAC); + (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (UP_ASM_TAC THEN EXPAND_TAC "Q2"); + (STRIP_TAC); + (ABBREV_TAC `g = (\y:real^3. ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)))`); + + (NEW_GOAL `d < (g:real^3->real) x`); + (EXPAND_TAC "g"); + (REWRITE_WITH + `d < ((x - u0) dot (u1 - u0)) / (norm (x - u0) * norm (u1 - u0:real^3)) <=> + d * (norm (x - u0) * norm (u1 - u0)) < (x - u0) dot (u1 - u0)`); + (MATCH_MP_TAC REAL_LT_RDIV_EQ); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a /\ ~(a = &0) ==> &0 < a`)); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[NORM_POS_LE]); + (REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; VECTOR_ARITH `x - y = vec 0 <=> x = y`]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `t1 % u0 + t2 % u1 + t3 % u2 + t4 % u3 = u0:real^3 <=> + t1 % u0 + t2 % u1 + t3 % u2 + t4 % u3 = (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `t1 % u0 + u = (t1 + t2) % u0 <=> u = t2 % u0`]); + (STRIP_TAC); + + (MP_TAC (ASSUME `~NULLSET (X INTER D)`) THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4;set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (REWRITE_TAC[affine_dependent]); + (EXISTS_TAC `u1:real^3`); + (STRIP_TAC); + (SET_TAC[]); + + (NEW_GOAL `~(u1 IN {u0, u2, u3:real^3})`); + (STRIP_TAC); + (MP_TAC (ASSUME `~NULLSET (X INTER D)`) THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4;set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0:real^3,u2, u3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (SET_TAC[]); + (REWRITE_WITH `{u0, u1, u2, u3} DELETE u1 = {u0, u2, u3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `(t2 + t3 + t4) / t2`); + (EXISTS_TAC `(-- t3) / t2`); + (EXISTS_TAC `(-- t4) / t2`); + + (STRIP_TAC); + (REWRITE_WITH `(t2 + t3 + t4) / t2 + --t3 / t2 + --t4 / t2 = t2 / t2`); + (REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_WITH + `u1 = (t2 + t3 + t4) / t2 % u0 + --t3 / t2 % u2 + --t4 / t2 % u3:real^3 <=> + u1 = (&1 / t2) % ((t2 + t3 + t4) % u0 - t3 % u2 - t4 % u3)`); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[GSYM (ASSUME `t2 % u1 + t3 % u2 + t4 % u3 = + (t2 + t3 + t4) % u0:real^3`)]); + (REWRITE_TAC[VECTOR_ARITH + `(t2 % u1 + t3 % u2 + t4 % u3) - t3 % u2 - t4 % u3 = t2 % u1`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC]); + (REWRITE_WITH `&1 / t2 * t2 = &1`); + (REWRITE_TAC[REAL_ARITH `&1 / t2 * t2 = t2 / t2`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + (REWRITE_TAC[REAL_ARITH `a * b * c < d <=> d > b * c * a`; GSYM dist]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `g x <= (g:real^3->real) xx`); + (NEW_GOAL `!y. y IN convex hull {u2 , u3:real^3} ==> g y <= g xx`); + (EXPAND_TAC "g" THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `&0 < (t3 + t4)`); + (MATCH_MP_TAC (REAL_ARITH `(&0 <= x) /\ ~(x = &0) ==> &0 < x`)); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_ADD); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (NEW_GOAL `t3 = &0 /\ t4 = &0`); + (UNDISCH_TAC `&0 <= t3` THEN UNDISCH_TAC `&0 <= t4` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `F`); + (UNDISCH_TAC `(x - u0) dot (u1 - u0:real^3) > dist (x,u0) * dist (u1,u0) * d`); + (REWRITE_WITH `x = t1 % u0 + t2 % u1:real^3`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (MATCH_MP_TAC (REAL_ARITH `a <= &0 /\ &0 <= b ==> ~(a > b)`)); + (STRIP_TAC); + (REWRITE_WITH `(t1 % u0 + t2 % u1) - u0 = (t1 % u0 + t2 % u1) - + (t1 + t2 + t3 + t4) % u0:real^3`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[ASSUME `t3 = &0`; ASSUME `t4 = &0`; VECTOR_ARITH + `(t1 % u0 + t2 % u1) - (t1 + t2 + &0 + &0) % u0 = t2 % (u1 - u0)`; + DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DOT_POS_LE]); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c/\ c < &1`); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ABBREV_TAC `y = t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3:real^3`); + (NEW_GOAL `(g:real^3->real) y <= g xx`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM]); + (EXISTS_TAC `t3 / (t3 + t4)` THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_SIMP_TAC[REAL_LE_ADD]); + (ASM_SIMP_TAC[REAL_LE_ADD; REAL_LE_DIV]); + (REWRITE_TAC[REAL_ARITH `a / x + b / x = (a + b) / x`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (ABBREV_TAC `w = t1 / (t1 + t3 + t4) % u0 + t3 / (t1 + t3 + t4) % u2 + + t4 / (t1 + t3 + t4) % u3:real^3`); + (NEW_GOAL `(g:real^3->real) y = g w`); + (EXPAND_TAC "g"); + + (REWRITE_WITH `y:real^3 - u0 = + &1 / (t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0)`); + (EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_ARITH + `(t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3) - u0 = + &1 / (t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0) <=> + (t3 + t4) / (t3 + t4) % u0 = u0`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; DOT_LMUL]); + + (REWRITE_WITH `w:real^3 - u0 = + &1 / (t1 + t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0)`); + (EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `(t1 / (t1 + t3 + t4) % u0 + + t3 / (t1 + t3 + t4) % u2 + t4 / (t1 + t3 + t4) % u3) - u0 = + &1 / (t1 + t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0) <=> + (t1 + t3 + t4) / (t1 + t3 + t4) % u0 = u0`]); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` + THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; DOT_LMUL]); + (REWRITE_WITH `abs (&1 / (t3 + t4)) = &1 / (t3 + t4)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_SIMP_TAC[REAL_LE_DIV;REAL_LE_ADD; REAL_ARITH `&0 <= &1`]); + (REWRITE_WITH `abs (&1 / (t1 + t3 + t4)) = &1 / (t1 + t3 + t4)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (MATCH_MP_TAC REAL_LE_DIV THEN REWRITE_TAC[REAL_ARITH `&0 <= &1`]); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` + THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `(a * x) / ((a * y) * z) = + (a * x) / (a * (y * z))`]); + (ABBREV_TAC + `a1 = norm (t3 % u2 + t4 % u3 - (t3 + t4) % u0) * norm (u1 - u0:real^3)`); + (NEW_GOAL `~(a1 = &0)`); + (EXPAND_TAC "a1" THEN ASM_REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; + VECTOR_ARITH `(a - b = vec 0 <=> a = b)/\(a + b-c = vec 0 <=> a + b = c)`]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell4; MCELL_EXPLICIT; set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `t3 / (t3 + t4)` + THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 + t3 / (t3 + t4) + t4 / (t3 + t4) = + (t3 + t4) / (t3 + t4)`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `&0 % u1 + t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3 = + (&1 / (t3 + t4)) % (t3 % u2 + t4 % u3)`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + + (NEW_GOAL `~(&1 / (t3 + t4) = &0)`); + (NEW_GOAL `&0 < &1 / (t3 + t4)`); + (MATCH_MP_TAC REAL_LT_DIV); + (ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (REWRITE_WITH + `(&1 / (t3 + t4) * ((t3 % u2 + t4 % u3 - (t3 + t4) % u0) dot (u1 - u0))) / + (&1 / (t3 + t4) * a1) = + ((t3 % u2 + t4 % u3 - (t3 + t4) % u0) dot (u1 - u0:real^3)) / a1`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[Trigonometry1.REAL_DIV_MUL2]); + + (NEW_GOAL `~(&1 / (t1 + t3 + t4) = &0)`); + (NEW_GOAL `&0 < &1 / (t1 + t3 + t4)`); + (MATCH_MP_TAC REAL_LT_DIV); + (ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`]); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (REWRITE_WITH + `(&1 / (t1 + t3 + t4) * ((t3 % u2 + t4 % u3 - (t3 + t4) % u0) dot (u1 - u0))) / + (&1 / (t1 + t3 + t4) * a1) = + ((t3 % u2 + t4 % u3 - (t3 + t4) % u0) dot (u1 - u0:real^3)) / a1`); + (UP_ASM_TAC THEN UNDISCH_TAC `~(a1 = &0)` THEN + MESON_TAC[Trigonometry1.REAL_DIV_MUL2]); + + (NEW_GOAL `(g:real^3->real) x <= g w`); + (EXPAND_TAC "g"); + + (REWRITE_WITH + `((x - u0) dot (u1 - u0:real^3)) / (norm (x - u0) * norm (u1 - u0)) <= + ((w - u0) dot (u1 - u0)) / (norm (w - u0) * norm (u1 - u0)) <=> + ((x - u0) dot (u1 - u0)) * (norm (w - u0) * norm (u1 - u0)) <= + ((w - u0) dot (u1 - u0)) * (norm (x - u0) * norm (u1 - u0))`); + (MATCH_MP_TAC RAT_LEMMA4); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `x - b = vec 0 <=> x = b`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell4; MCELL_EXPLICIT; set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u0, u1, u2, u3} = {u1, u0, u2, u3}`]); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `(t2 + t3 + t4) / t2` THEN EXISTS_TAC `(--t3) / t2` + THEN EXISTS_TAC `(--t4) / t2`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH + `(t2 + t3 + t4) / t2 + --t3 / t2 + --t4 / t2 = t2 / t2`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_WITH `(t2 + t3 + t4) = &1 - t1`); + (UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (NEW_GOAL `u0 - t1 % u0 - t3 % u2 - t4 % u3:real^3 = t2 % u1`); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(&1 - t1) / t2 % u0 + --t3 / t2 % u2 + --t4 / t2 % u3 = + (&1 / t2) % (u0 - t1 % u0 - t3 % u2 - t4 % u3)`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `t2 / t2 = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `x - b = vec 0 <=> x = b`]); + (EXPAND_TAC "w" THEN STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell4; MCELL_EXPLICIT; set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + + (EXISTS_TAC `&0` THEN EXISTS_TAC `t3 / (t3 + t4)` + THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 + t3 / (t3 + t4) + t4 / (t3 + t4) = + (t3 + t4) / (t3 + t4)`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `&0 % u1 + t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3 = + (&1 / (t3 + t4)) % (t3 % u2 + t4 % u3)`]); + (UP_ASM_TAC THEN REWRITE_TAC[VECTOR_ARITH + `t1 / x % u0 + t3 / x % u2 + t4 / x % u3 = + (&1 / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `&1 / (t1 + t3 + t4) % (t1 % u0 + t3 % u2 + t4 % u3) = u0 <=> + t1 % u0 + t3 % u2 + t4 % u3 = (t1 + t3 + t4) % u0:real^3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.CHANGE_SIDE); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 +t3 + t4 = &1` THEN + REAL_ARITH_TAC); + + (REWRITE_TAC[VECTOR_ARITH `t1 % u0 + t3 % u2 + t4 % u3 = (t1 + t3 + t4) % u0 + <=> t3 % u2 + t4 % u3 = (t3 + t4) % u0`]); + (STRIP_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + + (REWRITE_WITH `x = t2 % u1 + (t1 + t3 + t4) % w:real^3`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `x % (t1 /x % u0 + t3 / x % u2 + t4 /x % u3) = + (x / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (ABBREV_TAC `t = t1 + t3 + t4`); + (REWRITE_WITH `(t2 % u1 + t % w) - u0:real^3 = + (t2 % u1 + t % w) - (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `t1 + t2 + t3 + t4 = t2 + t:real`); + (EXPAND_TAC "t" THEN REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH + `(t2 % u1 + t % w) - (t2 + t) % u0 = t2 % (u1 - u0) + t % (w - u0)`]); + (ABBREV_TAC `x1 = u1 - u0:real^3`); + (ABBREV_TAC `x2 = w - u0:real^3`); + + (REWRITE_WITH `(t2 % x1 + t % x2) dot x1 = + t2 * norm x1 pow 2 + t * x2 dot (x1:real^3)`); + (REWRITE_TAC[NORM_POW_2]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `t2 * norm x1 pow 2 * norm x2 * norm x1 <= + t2 * (x2 dot x1) * norm x1 * norm (x1:real^3)`); + (REWRITE_TAC[REAL_POW_2; REAL_ARITH `t2 * (x1 * x1) * x2 * x1 <= + t2 * x3 * x1 * x1 <=> &0 <= (x1 pow 2) * (--t2) * (x2 * x1 - x3)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[REAL_LE_MUL; NORM_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (STRIP_TAC); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ]); + + (NEW_GOAL + `t2 * (x2 dot x1) * norm x1 * norm x1 + t * (x2 dot x1) * norm x2 * norm x1 <= + (x2 dot x1) * norm (t2 % x1 + t % x2) * norm (x1:real^3)`); + + (REWRITE_TAC[REAL_ARITH `t2 * x3 * x1 * x1 + t * x3 * x2 * x1 <= + x3 * x4 * x1 <=> &0 <= (x1 * x3) * (x4 - t2 * x1 - t * x2)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_CASES_TAC `x2 dot (x1:real^3) < &0`); + (NEW_GOAL `F`); + (NEW_GOAL `(g:real^3->real) x <= &0`); + (EXPAND_TAC "g"); + (REWRITE_TAC[REAL_ARITH `a / b <= &0 <=> &0 <= (--a) / b`]); + (MATCH_MP_TAC REAL_LE_DIV); + (SIMP_TAC[NORM_POS_LE; REAL_LE_MUL]); + + (REWRITE_WITH `x = t2 % u1 + (t1 + t3 + t4) % w:real^3`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `x % (t1 /x % u0 + t3 / x % u2 + t4 /x % u3) = + (x / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (EXPAND_TAC "t"); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= --a <=> a <= &0`]); + (REWRITE_WITH `(t2 % u1 + (t1 + t3 + t4) % w) - u0:real^3 = + (t2 % u1 + (t1 + t3 + t4) % w) - (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `(t2 % u1 + (t1 + t3 + t4) % w) - (t1 + t2 + t3 + t4) % u0 = + t2 % x1 + t % x2:real^3`); + (EXPAND_TAC "x1" THEN EXPAND_TAC "x2" THEN EXPAND_TAC "t" + THEN VECTOR_ARITH_TAC); + (NEW_GOAL `t % x2 dot (x1:real^3) <= &0`); + (REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= a * (--b)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (NEW_GOAL `t2 % x1 dot (x1:real^3) <= &0`); + (REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (REWRITE_TAC[DOT_POS_LE]); + (REWRITE_TAC[DOT_LADD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `d < (g:real^3->real) x`); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1`); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (REWRITE_TAC [REAL_ARITH `&0 <= a - b * d - c <=> c <= a + (--b) * d`]); + (REWRITE_WITH `t * norm (x2:real^3) = abs t * norm x2`); + (AP_THM_TAC THEN AP_TERM_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[REAL_ABS_REFL]); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (REWRITE_WITH `(--t2) * norm (x1:real^3) = abs (--t2) * norm x1`); + (AP_THM_TAC THEN AP_TERM_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[REAL_ABS_REFL]); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_TAC[GSYM NORM_MUL]); + (REWRITE_WITH + `norm (t % x2:real^3) = norm ((t2 % x1 + t % x2) + (--t2 % x1))`); + (AP_TERM_TAC THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_TRIANGLE]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `(g:real^3->real) y <= g xx`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `(g:real^3->real) xx <= d2`); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "P4"); + (EXPAND_TAC "g" THEN EXPAND_TAC "f4"); + (REWRITE_TAC[IN_ELIM_THM; IN]); + (EXISTS_TAC `vl:(real^3)list`); + (REWRITE_TAC[ASSUME `barV V 3 vl`; ASSUME `vl = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1]); + (SIMP_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (EXPAND_TAC "xx"); + (SIMP_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `mcell 4 V vl = mcell k V vl`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k V vl`)]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN EXPAND_TAC "d"); + (REAL_ARITH_TAC); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell4; MCELL_EXPLICIT; set_of_list]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + +(* ========================================================================= *) + + (NEW_GOAL `~coplanar {u0, u1, u2, u3:real^3}`); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell4; MCELL_EXPLICIT; set_of_list]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (ASM_REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (ASM_CASES_TAC `azim u0 u1 u2 (u3:real^3) < pi`); + (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 u2 u3)`); + (ASM_SIMP_TAC[WEDGE_LUNE]); + (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`); + (SET_TAC[]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {u2, u3} DIFF conic_cap u0 u1 r d INTER L = {}`); + (EXPAND_TAC "L"); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`)); + (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]); + (REWRITE_TAC[SET_RULE `A UNION {} = A`]); + (EXPAND_TAC "L"); + + (REWRITE_WITH `aff_ge {u0, u1:real^3} {u2, u3} = + aff_gt {u0, u1} {u2, u3} UNION + UNIONS {aff_ge {u0, u1} ({u2, u3} DELETE a) | a | a IN {u2, u3}}`); + (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[DISJOINT]); + + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `u3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({u2, u3} DELETE a) | a | a IN {u2, u3}}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `aff_ge {u0, u1:real^3} {u2} UNION aff_ge {u0, u1:real^3} {u3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, u2}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,u2:real^3} = {u0,u1} UNION {u2}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, u3}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,u3:real^3} = {u0,u1} UNION {u3}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`)); + (STRIP_TAC); + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `u3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (SET_TAC[]); + +(* begin the computation *) + + (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]); + (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 u2 u3) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 u2 u3 / &3 * (&1 - max d (-- &1)) * r pow 3)`); + (NEW_GOAL `~collinear {u0:real^3, u1, u2} /\ ~collinear {u0, u1, u3}`); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `azim (u0:real^3) u1 u2 u3 = dihV u0 u1 u2 u3`); + (MATCH_MP_TAC AZIM_DIHV_SAME); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (LET_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(4, vl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN; ARITH_RULE `4 <= 4`] THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + + (REWRITE_WITH `initial_sublist [u0;u1:real^3] [u0; u1; u2; u3] /\ + LENGTH [u0;u1] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC); + + (NEW_GOAL `k' = 4 /\ mcell k' V ul = mcell 4 V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `mcell k' V ul INTER mcell 4 V vl = X`); + (REWRITE_WITH `mcell 4 V vl = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (SET_TAC[ASSUME `X = mcell k' V ul`]); + + (REPEAT STRIP_TAC); + (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + + (REWRITE_TAC[dihu4]); + + (REWRITE_WITH `dihV (EL 0 (ul:(real^3)list)) (EL 1 ul) (EL 2 ul) (EL 3 ul) = + dihV u0 u1 u2 (u3:real^3)`); + + (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `{EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = {u0, u1,u2,u3:real^3}`); + (REWRITE_WITH ` + {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = {u0, u1,u2,u3:real^3} <=> + convex hull {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = + convex hull {u0, u1,u2,u3:real^3}`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2, v3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (UNDISCH_TAC + `affine_dependent {EL 0 ul, EL 1 ul, EL 2 ul, (EL 3 ul):real^3}`); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (REWRITE_WITH `convex hull {u0, u1, u2, u3:real^3} = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]); + (COND_CASES_TAC); + (MESON_TAC[]); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[set_of_list; ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `1 = SUC 0`]); + (STRIP_TAC); + + (ASM_CASES_TAC `EL 2 ul = u2:real^3`); + (NEW_GOAL `EL 3 ul = u3:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,u2,u3:real^3}` THEN REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2:real^3}`; COPLANAR_3]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `EL 2 ul = u3:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0:real^3, u1, EL 2 ul, EL 3 ul} = {u0, u1, EL 3 ul}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,u2,u3:real^3}` THEN REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0,u1:real^3, EL 3 ul}`; COPLANAR_3]); + + (NEW_GOAL `EL 3 ul = u2:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u3:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,u2,u3:real^3}` THEN REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u3:real^3}`; COPLANAR_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[DIHV_SYM_2]); + + (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]); + (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]); + (AP_THM_TAC THEN AP_TERM_TAC); + + (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`); + (MATCH_MP_TAC VOLUME_CONIC_CAP); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN MESON_TAC[]); + (UNDISCH_TAC `d < &1` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + + (REWRITE_WITH `max d (--(&1)) = d`); + (MATCH_MP_TAC (REAL_ARITH `&0 < d /\ --(&1) < &0 ==> max d (--(&1)) = d`)); + (REWRITE_TAC[REAL_NEG_LT0]); + (STRIP_TAC); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UNDISCH_TAC `k' = 4 /\ mcell k' V ul = mcell 4 V vl` + THEN MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) +(* OK here *) + + (ASM_CASES_TAC `azim u0 u1 u3 (u2:real^3) < pi`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (STRIP_TAC); + (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 u3 u2)`); + (ASM_SIMP_TAC[WEDGE_LUNE]); + (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`); + (SET_TAC[]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + + (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {u3, u2} DIFF conic_cap u0 u1 r d INTER L = {}`); + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`)); + (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]); + (REWRITE_TAC[SET_RULE `A UNION {} = A`]); + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]); + + (REWRITE_WITH `aff_ge {u0, u1:real^3} {u2, u3} = + aff_gt {u0, u1} {u2, u3} UNION + UNIONS {aff_ge {u0, u1} ({u2, u3} DELETE a) | a | a IN {u2, u3}}`); + (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[DISJOINT]); + + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u3, u2:real^3}`); + (REWRITE_WITH `{u0, u1, u3, u2} = {u0, u1, u3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `u3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u3, u2:real^3}`); + (REWRITE_WITH `{u0, u1, u3, u2} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({u2, u3} DELETE a) | a | a IN {u2, u3}}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `aff_ge {u0, u1:real^3} {u2} UNION aff_ge {u0, u1:real^3} {u3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, u2}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,u2:real^3} = {u0,u1} UNION {u2}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, u3}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,u3:real^3} = {u0,u1} UNION {u3}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`)); + (STRIP_TAC); + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u3, u2:real^3}`); + (REWRITE_WITH `{u0, u1, u3, u2} = {u0, u1, u3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `u3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u3, u2:real^3}`); + (REWRITE_WITH `{u0, u1, u3, u2} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (SET_TAC[]); + + (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]); + (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 u3 u2) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 u3 u2 / &3 * (&1 - max d (-- &1)) * r pow 3)`); + (NEW_GOAL `~collinear {u0:real^3, u1, u2} /\ ~collinear {u0, u1, u3}`); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u3:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ASM_REWRITE_TAC[]); + + (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + + (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `azim (u0:real^3) u1 u3 u2 = dihV u0 u1 u3 u2`); + (MATCH_MP_TAC AZIM_DIHV_SAME); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u3:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (LET_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(4, vl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN; ARITH_RULE `4 <= 4`] THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + + (REWRITE_WITH `initial_sublist [u0;u1:real^3] [u0; u1; u2; u3] /\ + LENGTH [u0;u1] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC); + + (NEW_GOAL `k' = 4 /\ mcell k' V ul = mcell 4 V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `mcell k' V ul INTER mcell 4 V vl = X`); + (REWRITE_WITH `mcell 4 V vl = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (SET_TAC[ASSUME `X = mcell k' V ul`]); + + (REPEAT STRIP_TAC); + (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + + (REWRITE_TAC[dihu4]); + + (REWRITE_WITH `dihV (EL 0 (ul:(real^3)list)) (EL 1 ul) (EL 2 ul) (EL 3 ul) = + dihV u0 u1 u2 (u3:real^3)`); + + (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `{EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = {u0, u1,u2,u3:real^3}`); + (REWRITE_WITH ` + {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = {u0, u1,u2,u3:real^3} <=> + convex hull {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = + convex hull {u0, u1,u2,u3:real^3}`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2, v3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (UNDISCH_TAC + `affine_dependent {EL 0 ul, EL 1 ul, EL 2 ul, (EL 3 ul):real^3}`); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (REWRITE_WITH `convex hull {u0, u1, u2, u3:real^3} = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]); + (COND_CASES_TAC); + (MESON_TAC[]); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[set_of_list; ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `1 = SUC 0`]); + (STRIP_TAC); + + (ASM_CASES_TAC `EL 2 ul = u2:real^3`); + (NEW_GOAL `EL 3 ul = u3:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,u3,u2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2:real^3}`; COPLANAR_3]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `EL 2 ul = u3:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0:real^3, u1, EL 2 ul, EL 3 ul} = {u0, u1, EL 3 ul}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,u3,u2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + + + (REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0,u1:real^3, EL 3 ul}`; COPLANAR_3]); + (NEW_GOAL `EL 3 ul = u2:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u3:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,u3,u2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + + (REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u3:real^3}`; COPLANAR_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[DIHV_SYM_2]); + + (REWRITE_TAC[DIHV_SYM_2]); + (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]); + (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]); + (AP_THM_TAC THEN AP_TERM_TAC); + + (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`); + (MATCH_MP_TAC VOLUME_CONIC_CAP); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN MESON_TAC[]); + (UNDISCH_TAC `d < &1` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `max d (--(&1)) = d`); + (MATCH_MP_TAC (REAL_ARITH `&0 < d /\ --(&1) < &0 ==> max d (--(&1)) = d`)); + (REWRITE_TAC[REAL_NEG_LT0]); + (STRIP_TAC); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UNDISCH_TAC `k' = 4 /\ mcell k' V ul = mcell 4 V vl` + THEN MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================== *) + + (NEW_GOAL `F`); + (NEW_GOAL `azim (u0:real^3) u1 u3 u2 = + (if azim u0 u1 u2 u3 = &0 then &0 else &2 * pi - azim u0 u1 u2 u3)`); + (MATCH_MP_TAC AZIM_COMPL); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b, d, c}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN COND_CASES_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `(&0 < pi)`); + (REWRITE_TAC[PI_POS]); + (UNDISCH_TAC `~(azim (u0:real^3) u1 u2 u3 < pi)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (STRIP_TAC); + + (NEW_GOAL `azim (u0:real^3) u1 u2 u3 = pi`); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[] THEN MATCH_MP_TAC AZIM_EQ_0_PI_IMP_COPLANAR); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) +(* Case k = 3 *) +(* ========================================================================= *) + + (NEW_GOAL `k = 3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC `2 <= k` THEN ARITH_TAC); + (NEW_GOAL `?u2 u3. vl = [u0; u1;u2;u3:real^3]`); + (NEW_GOAL `?v0 v1 u2 u3. vl = [v0; v1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + + (REWRITE_WITH `u0 = v0:real^3`); + (REWRITE_WITH `v0:real^3 = HD (truncate_simplex 1 vl)`); + (REWRITE_TAC[ASSUME `vl = [v0;v1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + + (REWRITE_WITH `u1 = v1:real^3`); + (REWRITE_WITH `v1:real^3 = HD (TL (truncate_simplex 1 vl))`); + (REWRITE_TAC[ASSUME `vl = [v0;v1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ABBREV_TAC `L = aff_ge{u0, u1} {u2, mxi V vl}`); + + (REWRITE_WITH `vol (X INTER D) = vol (L INTER D)`); + (AP_TERM_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; + mcell3; set_of_list; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (COND_CASES_TAC); + (ABBREV_TAC `m = mxi V vl`); + (REWRITE_WITH `mxi V [u0; u1; u2; u3] = m`); + (EXPAND_TAC "m" THEN DEL_TAC THEN ASM_REWRITE_TAC[]); + + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `A = B <=> A SUBSET B /\ B SUBSET A`]); + (STRIP_TAC); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> A INTER X SUBSET B INTER X`)); + (REWRITE_TAC[Marchal_cells_2.CONVEX_HULL_4_SUBSET_AFF_GE_2_2]); + (MATCH_MP_TAC (SET_RULE `(!x. x IN A /\ x IN B ==> x IN C) ==> + A INTER B SUBSET C INTER B`)); + (NEW_GOAL `DISJOINT {u0,u1:real^3} {u2, m}`); + (REWRITE_TAC[DISJOINT]); + (MATCH_MP_TAC (MESON[] `(~A:bool ==> F) ==> A`)); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN REWRITE_TAC[SET_RULE `A INTER X SUBSET A`]); + + + (ASM_SIMP_TAC[MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; + mcell3; set_of_list; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0; u1; u2; u3] = m`); + (EXPAND_TAC "m" THEN REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (NEW_GOAL `m IN {u0, u1:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + + (SIMP_TAC[ASSUME `DISJOINT {u0, u1} {u2, m:real^3}`; AFF_GE_2_2]); + (REWRITE_TAC[CONVEX_HULL_4; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN + EXISTS_TAC `t3:real` THEN EXISTS_TAC `t4:real`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= a <=> (a < &0 ==> F)`]); + (STRIP_TAC); + (UNDISCH_TAC `conic_cap (u0:real^3) u1 r d x`); + (REWRITE_TAC[MESON[IN] `conic_cap u0 u1 r d x <=> x IN conic_cap u0 u1 r d`; + GSYM (ASSUME `D = conic_cap (u0:real^3) u1 r d`)]); + (EXPAND_TAC "D"); + (REWRITE_TAC[IN_INTER; MESON[] `~(x:bool /\ y) <=> (~x \/ ~y)`]); + (DISJ1_TAC); + (REWRITE_TAC[IN_BALL] THEN STRIP_TAC); + + (NEW_GOAL `(?b1:real. b1 IN P1 /\ (!x. x IN P1 ==> b1 <= x))`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f1:(real^3)list -> real) vl`); + (EXPAND_TAC "P1" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `r1 = (@b. b IN P1 /\ (!x. x IN P1 ==> b <= x:real))`); + (EXPAND_TAC "r1"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f1:(real^3)list -> real) vl`); + (EXPAND_TAC "P1" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[]); + + (ABBREV_TAC `Q1 = (\b:real. b IN P1 /\ (!x. x IN P1 ==> b <= x))`); + (NEW_GOAL `(Q1:real->bool) r1`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b1:real` THEN EXPAND_TAC "Q1"); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "Q1" THEN REPEAT STRIP_TAC); + (NEW_GOAL `r1 <= f1 (vl:(real^3)list)`); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "P1" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + + (UP_ASM_TAC THEN EXPAND_TAC "f1" THEN REWRITE_TAC[EL; HD; TL; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `vl= [u0; u1; u2; u3:real^3]`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0;u1;u2;u3:real^3]`]); + (STRIP_TAC); + + (NEW_GOAL `!v. v IN affine hull {u1, u2, m:real^3} ==> r1 <= dist (u0, v)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,closest_point (affine hull {u1, u2, m}) u0) <= + dist (u0, v:real^3)`); + (MATCH_MP_TAC CLOSEST_POINT_LE); + (ASM_REWRITE_TAC[CLOSED_AFFINE_HULL]); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `r <= dist (u0:real^3, x)`); + (REWRITE_TAC[dist]); + (REWRITE_WITH `u0:real^3 - x = (t1 + t2 + t3 + t4) % u0 - x`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ADD_RDISTRIB]); + (ASM_REWRITE_TAC[VECTOR_ARITH `(t1 % u0 + t2 % u0 + t3 % u0 + t4 % u0) - + (t1 % u0 + t2 % u1 + t3 % u2 + t4 % u3) = + (t2 + t3 + t4) % u0 - (t2 % u1 + t3 % u2 + t4 % u3)`]); + (ABBREV_TAC `y:real^3 = t2 /(t2 + t3 + t4) % u1 + + t3 /(t2 + t3 + t4) % u2 + + t4 /(t2 + t3 + t4) % m`); + (REWRITE_WITH `(t2 % u1 + t3 % u2 + t4 % m) = (t2 + t3 + t4) % (y:real^3)`); + (EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_ARITH `x % (t2 / x % u1 + t3 / x % u2 + t4 / x % u3) = + (x / x) % (t2 % u1 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `(t2 + t3 + t4) / (t2 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t1 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1`); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `a % x - a % y = a % (x - y)`; NORM_MUL]); + + (NEW_GOAL `&1 < t2 + t3 + t4`); + (UNDISCH_TAC `t1 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1`); + (REAL_ARITH_TAC); + (REWRITE_WITH `abs (t2 + t3 + t4) = t2 + t3 + t4`); + (REWRITE_TAC[REAL_ABS_REFL] THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (REWRITE_TAC[GSYM dist]); + (NEW_GOAL `r1 <= dist (u0, y:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `t2 / (t2 + t3 + t4)` THEN EXISTS_TAC `t3 / (t2 + t3 + t4)` THEN + EXISTS_TAC `t4 / (t2 + t3 + t4)`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `r1 <= (t2 + t3 + t4) * dist (u0,y:real^3)`); + (NEW_GOAL `dist (u0,y) <= (t2 + t3 + t4) * dist (u0,y:real^3)`); + (REWRITE_TAC[REAL_ARITH `a <= b * a <=> &0 <= (b - &1) * a`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (DEL_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (EXPAND_TAC "r" THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `dist (u0, x:real^3) < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + +(* ========================================================================== *) + + (REWRITE_TAC[REAL_ARITH `&0 <= a <=> (a < &0 ==> F)`]); + (STRIP_TAC); + (UNDISCH_TAC `conic_cap (u0:real^3) u1 r d x`); + (REWRITE_TAC[MESON[IN] `conic_cap u0 u1 r d x <=> x IN conic_cap u0 u1 r d`; + GSYM (ASSUME `D = conic_cap (u0:real^3) u1 r d`)]); + (EXPAND_TAC "D"); + (REWRITE_TAC[IN_INTER; MESON[] `~(x:bool /\ y) <=> (~x \/ ~y)`]); + (DISJ2_TAC); + (REWRITE_TAC[IN; IN_ELIM_THM; rcone_gt; rconesgn] THEN STRIP_TAC); + + (NEW_GOAL `(?b1:real. b1 IN P3 /\ (!x. x IN P3 ==> x <= b1))`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f3:(real^3)list -> real) vl`); + (EXPAND_TAC "P3" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `d1 = (@b. b IN P3 /\ (!x. x IN P3 ==> x <= b:real))`); + (EXPAND_TAC "d1"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f3:(real^3)list -> real) vl`); + (EXPAND_TAC "P3" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[]); + + (ABBREV_TAC `Q1 = (\b:real. b IN P3 /\ (!x. x IN P3 ==> x <= b))`); + (NEW_GOAL `(Q1:real->bool) d1`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b1:real` THEN EXPAND_TAC "Q1"); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "Q1" THEN REPEAT STRIP_TAC); + + (NEW_GOAL `f3 (vl:(real^3)list) <= d1`); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "P3" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + + (UP_ASM_TAC THEN EXPAND_TAC "f3"); + (REWRITE_TAC[EL; HD; TL; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; ASSUME `mxi V vl = m`; + ASSUME `vl= [u0; u1; u2; u3:real^3]`] THEN STRIP_TAC); + + (ABBREV_TAC `xx = smallest_angle_line u2 m u0 u1`); + + (MP_TAC (ASSUME `smallest_angle_line u2 m u0 u1 = xx`)); + (REWRITE_TAC[smallest_angle_line; smallest_angle_set]); + (ABBREV_TAC `Q2 = + (\x:real^3. x IN convex hull {u2, m} /\ + (!y. y IN convex hull {u2, m} + ==> ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0))))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN STRIP_TAC); + (NEW_GOAL `(Q2:real^3->bool) xx`); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXPAND_TAC "Q2"); + + (MATCH_MP_TAC SMALLEST_ANGLE_LINE_EXISTS); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell3; set_of_list;TRUNCATE_SIMPLEX_EXPLICIT_2; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (UNDISCH_TAC `u0 IN convex hull {u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `m:real^3`); + (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (STRIP_TAC); + (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (UP_ASM_TAC THEN EXPAND_TAC "Q2"); + (STRIP_TAC); + (ABBREV_TAC `g = (\y:real^3. ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)))`); + + (NEW_GOAL `d < (g:real^3->real) x`); + (EXPAND_TAC "g"); + (REWRITE_WITH + `d < ((x - u0) dot (u1 - u0)) / (norm (x - u0) * norm (u1 - u0:real^3)) <=> + d * (norm (x - u0) * norm (u1 - u0)) < (x - u0) dot (u1 - u0)`); + (MATCH_MP_TAC REAL_LT_RDIV_EQ); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a /\ ~(a = &0) ==> &0 < a`)); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[NORM_POS_LE]); + (REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; VECTOR_ARITH `x - y = vec 0 <=> x = y`]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `t1 % u0 + t2 % u1 + t3 % u2 + t4 % m = u0:real^3 <=> + t1 % u0 + t2 % u1 + t3 % u2 + t4 % m = (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `t1 % u0 + u = (t1 + t2) % u0 <=> u = t2 % u0`]); + (STRIP_TAC); + + (MP_TAC (ASSUME `~NULLSET (X INTER D)`) THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell3;set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (REWRITE_TAC[affine_dependent]); + (EXISTS_TAC `u1:real^3`); + (STRIP_TAC); + (SET_TAC[]); + + (NEW_GOAL `~(u1 IN {u0, u2, m:real^3})`); + (STRIP_TAC); + (MP_TAC (ASSUME `~NULLSET (X INTER D)`) THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell3;set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_WITH `{u0, u1, u2, m} = {u0:real^3,u2, m}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (SET_TAC[]); + (REWRITE_WITH `{u0, u1, u2, m} DELETE u1 = {u0, u2, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `(t2 + t3 + t4) / t2`); + (EXISTS_TAC `(-- t3) / t2`); + (EXISTS_TAC `(-- t4) / t2`); + + (STRIP_TAC); + (REWRITE_WITH `(t2 + t3 + t4) / t2 + --t3 / t2 + --t4 / t2 = t2 / t2`); + (REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_WITH + `u1 = (t2 + t3 + t4) / t2 % u0 + --t3 / t2 % u2 + --t4 / t2 % m:real^3 <=> + u1 = (&1 / t2) % ((t2 + t3 + t4) % u0 - t3 % u2 - t4 % m)`); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[GSYM (ASSUME `t2 % u1 + t3 % u2 + t4 % m = + (t2 + t3 + t4) % u0:real^3`)]); + (REWRITE_TAC[VECTOR_ARITH + `(t2 % u1 + t3 % u2 + t4 % u3) - t3 % u2 - t4 % u3 = t2 % u1`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC]); + (REWRITE_WITH `&1 / t2 * t2 = &1`); + (REWRITE_TAC[REAL_ARITH `&1 / t2 * t2 = t2 / t2`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + (REWRITE_TAC[REAL_ARITH `a * b * c < d <=> d > b * c * a`; GSYM dist]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `g x <= (g:real^3->real) xx`); + (NEW_GOAL `!y. y IN convex hull {u2 , m:real^3} ==> g y <= g xx`); + (EXPAND_TAC "g" THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `&0 < (t3 + t4)`); + (MATCH_MP_TAC (REAL_ARITH `(&0 <= x) /\ ~(x = &0) ==> &0 < x`)); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_ADD); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (NEW_GOAL `t3 = &0 /\ t4 = &0`); + (UNDISCH_TAC `&0 <= t3` THEN UNDISCH_TAC `&0 <= t4` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `F`); + (UNDISCH_TAC `(x - u0) dot (u1 - u0:real^3) > dist (x,u0) * dist (u1,u0) * d`); + (REWRITE_WITH `x = t1 % u0 + t2 % u1:real^3`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (MATCH_MP_TAC (REAL_ARITH `a <= &0 /\ &0 <= b ==> ~(a > b)`)); + (STRIP_TAC); + (REWRITE_WITH `(t1 % u0 + t2 % u1) - u0 = (t1 % u0 + t2 % u1) - + (t1 + t2 + t3 + t4) % u0:real^3`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[ASSUME `t3 = &0`; ASSUME `t4 = &0`; VECTOR_ARITH + `(t1 % u0 + t2 % u1) - (t1 + t2 + &0 + &0) % u0 = t2 % (u1 - u0)`; + DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DOT_POS_LE]); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c/\ c < &1`); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ABBREV_TAC `y = t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % m:real^3`); + (NEW_GOAL `(g:real^3->real) y <= g xx`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM]); + (EXISTS_TAC `t3 / (t3 + t4)` THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_SIMP_TAC[REAL_LE_ADD]); + (ASM_SIMP_TAC[REAL_LE_ADD; REAL_LE_DIV]); + (REWRITE_TAC[REAL_ARITH `a / x + b / x = (a + b) / x`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (ABBREV_TAC `w = t1 / (t1 + t3 + t4) % u0 + t3 / (t1 + t3 + t4) % u2 + + t4 / (t1 + t3 + t4) % m:real^3`); + (NEW_GOAL `(g:real^3->real) y = g w`); + (EXPAND_TAC "g"); + + (REWRITE_WITH `y:real^3 - u0 = + &1 / (t3 + t4) % (t3 % u2 + t4 % m - (t3 + t4) % u0)`); + (EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_ARITH + `(t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3) - u0 = + &1 / (t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0) <=> + (t3 + t4) / (t3 + t4) % u0 = u0`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; DOT_LMUL]); + + (REWRITE_WITH `w:real^3 - u0 = + &1 / (t1 + t3 + t4) % (t3 % u2 + t4 % m - (t3 + t4) % u0)`); + (EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `(t1 / (t1 + t3 + t4) % u0 + + t3 / (t1 + t3 + t4) % u2 + t4 / (t1 + t3 + t4) % u3) - u0 = + &1 / (t1 + t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0) <=> + (t1 + t3 + t4) / (t1 + t3 + t4) % u0 = u0`]); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` + THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; DOT_LMUL]); + (REWRITE_WITH `abs (&1 / (t3 + t4)) = &1 / (t3 + t4)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_SIMP_TAC[REAL_LE_DIV;REAL_LE_ADD; REAL_ARITH `&0 <= &1`]); + (REWRITE_WITH `abs (&1 / (t1 + t3 + t4)) = &1 / (t1 + t3 + t4)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (MATCH_MP_TAC REAL_LE_DIV THEN REWRITE_TAC[REAL_ARITH `&0 <= &1`]); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` + THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `(a * x) / ((a * y) * z) = + (a * x) / (a * (y * z))`]); + (ABBREV_TAC + `a1 = norm (t3 % u2 + t4 % m - (t3 + t4) % u0) * norm (u1 - u0:real^3)`); + (NEW_GOAL `~(a1 = &0)`); + (EXPAND_TAC "a1" THEN ASM_REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; + VECTOR_ARITH `(a - b = vec 0 <=> a = b)/\(a + b-c = vec 0 <=> a + b = c)`]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; + set_of_list; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `m:real^3`); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `t3 / (t3 + t4)` + THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 + t3 / (t3 + t4) + t4 / (t3 + t4) = + (t3 + t4) / (t3 + t4)`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `&0 % u1 + t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3 = + (&1 / (t3 + t4)) % (t3 % u2 + t4 % u3)`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + + (NEW_GOAL `~(&1 / (t3 + t4) = &0)`); + (NEW_GOAL `&0 < &1 / (t3 + t4)`); + (MATCH_MP_TAC REAL_LT_DIV); + (ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (REWRITE_WITH + `(&1 / (t3 + t4) * ((t3 % u2 + t4 % m - (t3 + t4) % u0) dot (u1 - u0))) / + (&1 / (t3 + t4) * a1) = + ((t3 % u2 + t4 % m - (t3 + t4) % u0) dot (u1 - u0:real^3)) / a1`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[Trigonometry1.REAL_DIV_MUL2]); + + (NEW_GOAL `~(&1 / (t1 + t3 + t4) = &0)`); + (NEW_GOAL `&0 < &1 / (t1 + t3 + t4)`); + (MATCH_MP_TAC REAL_LT_DIV); + (ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`]); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (REWRITE_WITH + `(&1 / (t1 + t3 + t4) * ((t3 % u2 + t4 % m - (t3 + t4) % u0) dot (u1 - u0))) / + (&1 / (t1 + t3 + t4) * a1) = + ((t3 % u2 + t4 % m - (t3 + t4) % u0) dot (u1 - u0:real^3)) / a1`); + (UP_ASM_TAC THEN UNDISCH_TAC `~(a1 = &0)` THEN + MESON_TAC[Trigonometry1.REAL_DIV_MUL2]); + + (NEW_GOAL `(g:real^3->real) x <= g w`); + (EXPAND_TAC "g"); + + (REWRITE_WITH + `((x - u0) dot (u1 - u0:real^3)) / (norm (x - u0) * norm (u1 - u0)) <= + ((w - u0) dot (u1 - u0)) / (norm (w - u0) * norm (u1 - u0)) <=> + ((x - u0) dot (u1 - u0)) * (norm (w - u0) * norm (u1 - u0)) <= + ((w - u0) dot (u1 - u0)) * (norm (x - u0) * norm (u1 - u0))`); + (MATCH_MP_TAC RAT_LEMMA4); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `x - b = vec 0 <=> x = b`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `m:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u0, u1, u2, u3} = {u1, u0, u2, u3}`]); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `(t2 + t3 + t4) / t2` THEN EXISTS_TAC `(--t3) / t2` + THEN EXISTS_TAC `(--t4) / t2`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH + `(t2 + t3 + t4) / t2 + --t3 / t2 + --t4 / t2 = t2 / t2`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_WITH `(t2 + t3 + t4) = &1 - t1`); + (UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (NEW_GOAL `u0 - t1 % u0 - t3 % u2 - t4 % m:real^3 = t2 % u1`); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(&1 - t1) / t2 % u0 + --t3 / t2 % u2 + --t4 / t2 % u3 = + (&1 / t2) % (u0 - t1 % u0 - t3 % u2 - t4 % u3)`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `t2 / t2 = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `x - b = vec 0 <=> x = b`]); + (EXPAND_TAC "w" THEN STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `m:real^3`); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + + (EXISTS_TAC `&0` THEN EXISTS_TAC `t3 / (t3 + t4)` + THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 + t3 / (t3 + t4) + t4 / (t3 + t4) = + (t3 + t4) / (t3 + t4)`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `&0 % u1 + t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3 = + (&1 / (t3 + t4)) % (t3 % u2 + t4 % u3)`]); + (UP_ASM_TAC THEN REWRITE_TAC[VECTOR_ARITH + `t1 / x % u0 + t3 / x % u2 + t4 / x % u3 = + (&1 / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `&1 / (t1 + t3 + t4) % (t1 % u0 + t3 % u2 + t4 % m) = u0 <=> + t1 % u0 + t3 % u2 + t4 % m = (t1 + t3 + t4) % u0:real^3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.CHANGE_SIDE); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 +t3 + t4 = &1` THEN + REAL_ARITH_TAC); + + (REWRITE_TAC[VECTOR_ARITH `t1 % u0 + t3 % u2 + t4 % u3 = (t1 + t3 + t4) % u0 + <=> t3 % u2 + t4 % u3 = (t3 + t4) % u0`]); + (STRIP_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + + (REWRITE_WITH `x = t2 % u1 + (t1 + t3 + t4) % w:real^3`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `x % (t1 /x % u0 + t3 / x % u2 + t4 /x % u3) = + (x / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (ABBREV_TAC `t = t1 + t3 + t4`); + (REWRITE_WITH `(t2 % u1 + t % w) - u0:real^3 = + (t2 % u1 + t % w) - (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `t1 + t2 + t3 + t4 = t2 + t:real`); + (EXPAND_TAC "t" THEN REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH + `(t2 % u1 + t % w) - (t2 + t) % u0 = t2 % (u1 - u0) + t % (w - u0)`]); + (ABBREV_TAC `x1 = u1 - u0:real^3`); + (ABBREV_TAC `x2 = w - u0:real^3`); + + (REWRITE_WITH `(t2 % x1 + t % x2) dot x1 = + t2 * norm x1 pow 2 + t * x2 dot (x1:real^3)`); + (REWRITE_TAC[NORM_POW_2]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `t2 * norm x1 pow 2 * norm x2 * norm x1 <= + t2 * (x2 dot x1) * norm x1 * norm (x1:real^3)`); + (REWRITE_TAC[REAL_POW_2; REAL_ARITH `t2 * (x1 * x1) * x2 * x1 <= + t2 * x3 * x1 * x1 <=> &0 <= (x1 pow 2) * (--t2) * (x2 * x1 - x3)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[REAL_LE_MUL; NORM_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (STRIP_TAC); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ]); + + (NEW_GOAL + `t2 * (x2 dot x1) * norm x1 * norm x1 + t * (x2 dot x1) * norm x2 * norm x1 <= (x2 dot x1) * norm (t2 % x1 + t % x2) * norm (x1:real^3)`); + + (REWRITE_TAC[REAL_ARITH `t2 * x3 * x1 * x1 + t * x3 * x2 * x1 <= + x3 * x4 * x1 <=> &0 <= (x1 * x3) * (x4 - t2 * x1 - t * x2)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_CASES_TAC `x2 dot (x1:real^3) < &0`); + (NEW_GOAL `F`); + (NEW_GOAL `(g:real^3->real) x <= &0`); + (EXPAND_TAC "g"); + (REWRITE_TAC[REAL_ARITH `a / b <= &0 <=> &0 <= (--a) / b`]); + (MATCH_MP_TAC REAL_LE_DIV); + (SIMP_TAC[NORM_POS_LE; REAL_LE_MUL]); + + (REWRITE_WITH `x = t2 % u1 + (t1 + t3 + t4) % w:real^3`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `x % (t1 /x % u0 + t3 / x % u2 + t4 /x % u3) = + (x / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (EXPAND_TAC "t"); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= --a <=> a <= &0`]); + (REWRITE_WITH `(t2 % u1 + (t1 + t3 + t4) % w) - u0:real^3 = + (t2 % u1 + (t1 + t3 + t4) % w) - (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `(t2 % u1 + (t1 + t3 + t4) % w) - (t1 + t2 + t3 + t4) % u0 = + t2 % x1 + t % x2:real^3`); + (EXPAND_TAC "x1" THEN EXPAND_TAC "x2" THEN EXPAND_TAC "t" + THEN VECTOR_ARITH_TAC); + (NEW_GOAL `t % x2 dot (x1:real^3) <= &0`); + (REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= a * (--b)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (NEW_GOAL `t2 % x1 dot (x1:real^3) <= &0`); + (REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (REWRITE_TAC[DOT_POS_LE]); + (REWRITE_TAC[DOT_LADD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `d < (g:real^3->real) x`); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1`); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (REWRITE_TAC [REAL_ARITH `&0 <= a - b * d - c <=> c <= a + (--b) * d`]); + (REWRITE_WITH `t * norm (x2:real^3) = abs t * norm x2`); + (AP_THM_TAC THEN AP_TERM_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[REAL_ABS_REFL]); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (REWRITE_WITH `(--t2) * norm (x1:real^3) = abs (--t2) * norm x1`); + (AP_THM_TAC THEN AP_TERM_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[REAL_ABS_REFL]); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_TAC[GSYM NORM_MUL]); + (REWRITE_WITH + `norm (t % x2:real^3) = norm ((t2 % x1 + t % x2) + (--t2 % x1))`); + (AP_TERM_TAC THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_TRIANGLE]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `(g:real^3->real) y <= g xx`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `(g:real^3->real) xx <= d1`); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "P3"); + (EXPAND_TAC "g" THEN EXPAND_TAC "f3"); + (REWRITE_TAC[IN_ELIM_THM; IN]); + (EXISTS_TAC `vl:(real^3)list`); + (REWRITE_TAC[ASSUME `barV V 3 vl`; ASSUME `vl = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1]); + (STRIP_TAC); + (SIMP_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `mcell 3 V vl = mcell k V vl`); + (ASM_SIMP_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k V vl`)]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + + + (EXPAND_TAC "xx"); + (SIMP_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN EXPAND_TAC "d"); + (REAL_ARITH_TAC); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; + set_of_list; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) + + (ABBREV_TAC `m = mxi V vl`); + (NEW_GOAL `~coplanar {u0, u1, u2, m:real^3}`); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; set_of_list]); + (COND_CASES_TAC); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (ASM_REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (ASM_CASES_TAC `azim u0 u1 u2 (m:real^3) < pi`); + (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 u2 m)`); + (ASM_SIMP_TAC[WEDGE_LUNE]); + (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`); + (SET_TAC[]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {u2, m} DIFF conic_cap u0 u1 r d INTER L = {}`); + (EXPAND_TAC "L"); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`)); + (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]); + (REWRITE_TAC[SET_RULE `A UNION {} = A`]); + (EXPAND_TAC "L"); + + (REWRITE_WITH `aff_ge {u0, u1:real^3} {u2, m} = + aff_gt {u0, u1} {u2, m} UNION + UNIONS {aff_ge {u0, u1} ({u2, m} DELETE a) | a | a IN {u2, m}}`); + (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[DISJOINT]); + + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`); + (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`); + (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({u2, m} DELETE a) | a | a IN {u2, m}}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `aff_ge {u0, u1:real^3} {u2} UNION aff_ge {u0, u1:real^3} {m}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, u2}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,u2:real^3} = {u0,u1} UNION {u2}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, m}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,m:real^3} = {u0,u1} UNION {m}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`)); + (STRIP_TAC); + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`); + (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`); + (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (SET_TAC[]); + +(* begin the computation *) + + (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]); + (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 u2 m) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 u2 m / &3 * (&1 - max d (-- &1)) * r pow 3)`); + (NEW_GOAL `~collinear {u0:real^3, u1, u2} /\ ~collinear {u0, u1, m}`); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `azim (u0:real^3) u1 u2 m = dihV u0 u1 u2 m`); + (MATCH_MP_TAC AZIM_DIHV_SAME); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (LET_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(3, vl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN; ARITH_RULE `3 <= 4`] THEN ASM_REWRITE_TAC[]); + (REWRITE_WITH `initial_sublist [u0;u1:real^3] [u0; u1; u2; u3] /\ + LENGTH [u0;u1] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC); + + (NEW_GOAL `k' = 3 /\ mcell k' V ul = mcell 3 V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `mcell k' V ul INTER mcell 3 V vl = X`); + (REWRITE_WITH `mcell 3 V vl = X`); + (ASM_SIMP_TAC[]); + (SET_TAC[ASSUME `X = mcell k' V ul`]); + + (REPEAT STRIP_TAC); + (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + + (REWRITE_TAC[dihu3]); + + (REWRITE_WITH `dihV (EL 0 ul) (EL 1 ul) (EL 2 ul) (mxi V ul) = + dihV u0 u1 u2 (m:real^3)`); + + (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `{EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = {u0, u1,u2,m:real^3}`); + (REWRITE_WITH ` + {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = {u0, u1,u2,m:real^3} <=> + convex hull {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = + convex hull {u0, u1,u2,m:real^3}`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_2; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2, mxi V [v0; v1; v2; v3]}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (UNDISCH_TAC `affine_dependent {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul}`); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, mxi V [u0; u1; u2; u3]}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (REWRITE_WITH `convex hull {u0, u1, u2, m:real^3} = X`); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; set_of_list]); + (COND_CASES_TAC); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; set_of_list]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[set_of_list; ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `1 = SUC 0`]); + + (NEW_GOAL `mxi V ul = m`); + (EXPAND_TAC "m"); + (MATCH_MP_TAC MCELL_ID_MXI); + (EXISTS_TAC `k':num` THEN EXISTS_TAC `k:num`); + (ASM_REWRITE_TAC[SET_RULE `3 IN {2, 3}`]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `HD (ul) = (HD (truncate_simplex 1 ul)):real^3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[HD]); + (ASM_REWRITE_TAC[]); + + (STRIP_TAC); + (NEW_GOAL `EL 2 ul = u2:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0, u1, EL 2 ul, m} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,u2,m:real^3}` THEN REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, m} = {u0, u1, u2, m:real^3}`); + ASSUME `{u0, u1, EL 2 ul, m} = {u0, u1, m:real^3}`; COPLANAR_3]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]); + (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]); + (AP_THM_TAC THEN AP_TERM_TAC); + + (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`); + (MATCH_MP_TAC VOLUME_CONIC_CAP); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN MESON_TAC[]); + (UNDISCH_TAC `d < &1` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + + (REWRITE_WITH `max d (--(&1)) = d`); + (MATCH_MP_TAC (REAL_ARITH `&0 < d /\ --(&1) < &0 ==> max d (--(&1)) = d`)); + (REWRITE_TAC[REAL_NEG_LT0]); + (STRIP_TAC); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UNDISCH_TAC `k' = 3 /\ mcell k' V ul = mcell 3 V vl` + THEN MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) + + (ASM_CASES_TAC `azim u0 u1 m (u2:real^3) < pi`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (STRIP_TAC); + (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 m u2)`); + (ASM_SIMP_TAC[WEDGE_LUNE]); + (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`); + (SET_TAC[]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + + (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {m, u2} DIFF conic_cap u0 u1 r d INTER L = {}`); + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`)); + (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]); + (REWRITE_TAC[SET_RULE `A UNION {} = A`]); + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]); + + (REWRITE_WITH `aff_ge {u0, u1:real^3} {m, u2} = + aff_gt {u0, u1} {m, u2} UNION + UNIONS {aff_ge {u0, u1} ({m, u2} DELETE a) | a | a IN {m, u2}}`); + (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[DISJOINT]); + + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, u2:real^3}`); + (REWRITE_WITH `{u0, u1, m, u2} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, u2:real^3}`); + (REWRITE_WITH `{u0, u1, m, u2} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({m, u2} DELETE a) | a | a IN {m, u2}}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `aff_ge {u0, u1:real^3} {u2} UNION aff_ge {u0, u1:real^3} {m}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, u2}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,u2:real^3} = {u0,u1} UNION {u2}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, m}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,m:real^3} = {u0,u1} UNION {m}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]); + (MATCH_MP_TAC (SET_RULE + `A SUBSET D /\ C SUBSET B ==> A UNION C SUBSET B UNION D`)); + (STRIP_TAC); + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, u2:real^3}`); + (REWRITE_WITH `{u0, u1, m, u2} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, u2:real^3}`); + (REWRITE_WITH `{u0, u1, m, u2} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (SET_TAC[]); + + (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]); + (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 m u2) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 m u2 / &3 * (&1 - max d (-- &1)) * r pow 3)`); + (NEW_GOAL `~collinear {u0:real^3, u1, u2} /\ ~collinear {u0, u1, m}`); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ASM_REWRITE_TAC[]); + + (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + + (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `azim (u0:real^3) u1 m u2 = dihV u0 u1 m u2`); + (MATCH_MP_TAC AZIM_DIHV_SAME); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (LET_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(3, vl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN; ARITH_RULE `3 <= 4`] THEN ASM_REWRITE_TAC[]); + + (REWRITE_WITH `initial_sublist [u0;u1:real^3] [u0; u1; u2; u3] /\ + LENGTH [u0;u1] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC); + + (NEW_GOAL `k' = 3 /\ mcell k' V ul = mcell 3 V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `mcell k' V ul INTER mcell 3 V vl = X`); + (REWRITE_WITH `mcell 3 V vl = X`); + (ASM_SIMP_TAC[]); + (SET_TAC[ASSUME `X = mcell k' V ul`]); + + (REPEAT STRIP_TAC); + (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + + (REWRITE_TAC[dihu3]); + + (REWRITE_WITH `dihV (EL 0 ul) (EL 1 ul) (EL 2 ul) (mxi V ul) = + dihV u0 u1 u2 (m:real^3)`); + + (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `{EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = {u0, u1,u2,m:real^3}`); + (REWRITE_WITH ` + {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = {u0, u1,u2,m:real^3} <=> + convex hull {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = + convex hull {u0, u1,u2,m:real^3}`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_2; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2, mxi V [v0; v1; v2; v3]}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (UNDISCH_TAC `affine_dependent {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul}`); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, mxi V [u0; u1; u2; u3]}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (REWRITE_WITH `convex hull {u0, u1, u2, m:real^3} = X`); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; set_of_list]); + (COND_CASES_TAC); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; set_of_list]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[set_of_list; ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `1 = SUC 0`]); + + (NEW_GOAL `mxi V ul = m`); + (EXPAND_TAC "m"); + (MATCH_MP_TAC MCELL_ID_MXI); + (EXISTS_TAC `k':num` THEN EXISTS_TAC `k:num`); + (ASM_REWRITE_TAC[SET_RULE `3 IN {2, 3}`]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `HD (ul) = (HD (truncate_simplex 1 ul)):real^3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[HD]); + (ASM_REWRITE_TAC[]); + + (STRIP_TAC); + (NEW_GOAL `EL 2 ul = u2:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0, u1, EL 2 ul, m} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,m,u2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (REWRITE_TAC[GSYM (ASSUME `{u0, u1, EL 2 ul, m} = {u0, u1, u2, m:real^3}`); + ASSUME `{u0, u1, EL 2 ul, m} = {u0, u1, m:real^3}`; COPLANAR_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[DIHV_SYM_2]); + + (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]); + (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]); + (AP_THM_TAC THEN AP_TERM_TAC); + + (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`); + (MATCH_MP_TAC VOLUME_CONIC_CAP); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN MESON_TAC[]); + (UNDISCH_TAC `d < &1` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + + (REWRITE_WITH `max d (--(&1)) = d`); + (MATCH_MP_TAC (REAL_ARITH `&0 < d /\ --(&1) < &0 ==> max d (--(&1)) = d`)); + (REWRITE_TAC[REAL_NEG_LT0]); + (STRIP_TAC); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UNDISCH_TAC `k' = 3 /\ mcell k' V ul = mcell 3 V vl` + THEN MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) + + (NEW_GOAL `F`); + (NEW_GOAL `azim (u0:real^3) u1 m u2 = + (if azim u0 u1 u2 m = &0 then &0 else &2 * pi - azim u0 u1 u2 m)`); + (MATCH_MP_TAC AZIM_COMPL); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b, d, c}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN COND_CASES_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `(&0 < pi)`); + (REWRITE_TAC[PI_POS]); + (UNDISCH_TAC `~(azim (u0:real^3) u1 u2 m < pi)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (STRIP_TAC); + + (NEW_GOAL `azim (u0:real^3) u1 u2 m = pi`); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[] THEN MATCH_MP_TAC AZIM_EQ_0_PI_IMP_COPLANAR); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) +(* ========================================================================= *) + (ABBREV_TAC `s = {X | mcell_set V X /\ edgeX V X e}`); + (NEW_GOAL `sum s (\t. vol (t INTER D)) = vol (D)`); + (ABBREV_TAC `f = (\t:real^3->bool. t INTER D)`); + (REWRITE_WITH `(\t. vol (t INTER D)) = (\x:real^3->bool. vol (f x))`); + (EXPAND_TAC "f"); + (REWRITE_TAC[]); + (REWRITE_WITH `sum s (\x:real^3->bool. vol (f x)) = vol (UNIONS (IMAGE f s))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_UNIONS_IMAGE); + (REPEAT STRIP_TAC); + + (EXPAND_TAC "s"); + (MATCH_MP_TAC FINITE_EDGE_X2); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (ASM_REWRITE_TAC[]); + + (EXPAND_TAC "f"); + (MATCH_MP_TAC MEASURABLE_INTER); + (STRIP_TAC); + (UP_ASM_TAC THEN EXPAND_TAC "s"); + (REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[MEASURABLE_MCELL]); + (ASM_REWRITE_TAC[MEASURABLE_CONIC_CAP]); + + (EXPAND_TAC "f"); + (UNDISCH_TAC `(x:real^3->bool) IN s` THEN + UNDISCH_TAC `(y:real^3->bool) IN s` THEN EXPAND_TAC "s"); + (REWRITE_TAC[mcell_set_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `x INTER (y:real^3->bool)`); + (ASM_REWRITE_TAC[SET_RULE `(x INTER D) INTER y INTER D SUBSET x INTER y`]); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + + (NEW_GOAL `i' = i /\ mcell i' V ul' = mcell i V ul`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[SET_RULE `i IN {0, 1, 2, 3, 4} <=> + i = 0 \/ i = 1 \/ i = 2 \/ i = 3 \/ i = 4`]); + (UNDISCH_TAC `i <= 4` THEN UNDISCH_TAC `i' <= 4` THEN ARITH_TAC); + (UNDISCH_TAC `~(x = y:real^3->bool)` THEN ASM_REWRITE_TAC[]); + + + (EXPAND_TAC "s"); + (EXPAND_TAC "f" THEN REWRITE_TAC[IMAGE]); + +(* OK here *) + + + + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + (REWRITE_WITH + `UNIONS {y | ?x. x IN {X | mcell_set V X /\ edgeX V X e} /\ y = x INTER D} + DIFF D = {}`); + (REWRITE_TAC[SET_RULE `A DIFF B = {} <=> A SUBSET B`]); + (REWRITE_TAC[UNIONS_SUBSET; IN; IN_ELIM_THM]); + (SET_TAC[]); + (REWRITE_TAC[SET_RULE `{} UNION A = A`]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `UNIONS {y | ?x. x IN {X | mcell_set V X /\ NULLSET (X INTER D) /\ + ~(X INTER D = {})} /\ y = x INTER D}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNIONS); + (STRIP_TAC); + (REWRITE_WITH + `{y | ?x. x IN {X | mcell_set V X /\ NULLSET (X INTER D) /\ + ~(X INTER D = {})} /\ + y = x INTER D} = + {y | ?x. x IN {X | mcell_set V X /\ NULLSET (X INTER D) /\ + ~(X INTER D = {})} /\ + y = f x }`); + (EXPAND_TAC "f" THEN REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + +(* ========================================================================= *) +(* ========================================================================= *) +(* ========================================================================= *) + + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (u0, &10) /\ mcell_set V X}`); + (STRIP_TAC); + (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA_2]); + (REWRITE_TAC[SUBSET; IN_BALL; IN; IN_ELIM_THM; mcell_set] THEN + REPEAT STRIP_TAC); + + (NEW_GOAL `?v1:real^3. v1 IN x /\ v1 IN D`); + (REWRITE_TAC[GSYM IN_INTER]); + (UNDISCH_TAC `~(x:real^3->bool INTER D = {})` THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `dist (u0, x') <= dist (u0, v1:real^3) + dist (v1, x')`); + (NORM_ARITH_TAC); + (NEW_GOAL `dist (u0, v1:real^3) < &1`); + (REWRITE_TAC[GSYM IN_BALL]); + (NEW_GOAL `D SUBSET ball (u0:real^3, &1)`); + (EXPAND_TAC "D"); + (NEW_GOAL `ball (u0, r) SUBSET ball (u0:real^3, &1)`); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `v1:real^3 IN D` THEN SET_TAC[]); + (NEW_GOAL `dist (v1,x':real^3) < &8`); + (REWRITE_TAC[GSYM IN_BALL]); + + (NEW_GOAL `x SUBSET ball (v1:real^3, &8)`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MCELL_SUBSET_BALL8); + (REWRITE_TAC[GSYM (ASSUME `x = mcell i V ul`)] THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `(x:real^3->bool) x'` THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `ul:(real^3)list`); + (ASM_REWRITE_TAC[]); + +(* ========================================================================= *) + + (REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[ASSUME `t:real^3->bool = x INTER D`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[SUBSET; IN_UNIONS]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `?v:real^3. v IN V /\ x IN voronoi_closed V v`); + (ASM_SIMP_TAC[TIWWFYQ]); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_WITH + `x IN voronoi_closed V v <=> (?vl. vl IN barV V 3 /\ x IN rogers V vl /\ + truncate_simplex 0 vl = [v])`); + (ASM_SIMP_TAC[GLTVHUM]); + (REWRITE_TAC[IN] THEN STRIP_TAC); + (NEW_GOAL `?i. i <= 4 /\ x IN mcell i V vl`); + (ASM_SIMP_TAC[IN;SLTSTLO1]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ABBREV_TAC `X = mcell i V vl`); + (NEW_GOAL `~NULLSET (X INTER D) ==> F`); + (STRIP_TAC); + + (NEW_GOAL `?k ul. + 2 <= k /\ + barV V 3 ul /\ + X = mcell k V ul /\ + truncate_simplex 1 ul = [u0; u1]`); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + (REWRITE_TAC[mcell_set; IN_ELIM_THM; IN]); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (MP_TAC (ASSUME `x IN + D DIFF + UNIONS + {y | ?x. x IN {X | mcell_set V X /\ edgeX V X e} /\ y = x INTER D}`)); + (REWRITE_TAC[IN_DIFF; MESON[] `~(A /\ ~B) <=> ~A \/ B`]); + (DISJ2_TAC); + (REWRITE_TAC[IN_UNIONS; IN; IN_ELIM_THM]); + (EXISTS_TAC `X INTER (D:real^3->bool)`); + (STRIP_TAC); + + (EXISTS_TAC `(X:real^3->bool)`); + (REWRITE_TAC[mcell_set; IN; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[edgeX; IN_ELIM_THM]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (STRIP_TAC); + + (NEW_GOAL `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `(if k < 4 then k else 4)`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (COND_CASES_TAC); + (MESON_TAC[]); + (NEW_GOAL `k >= 4`); + (UP_ASM_TAC THEN ARITH_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ]); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN ASM_REWRITE_TAC[]); + (MESON_TAC[NEGLIGIBLE_SUBSET; SET_RULE `A INTER B SUBSET A`]); + + (NEW_GOAL `(V:real^3->bool) INTER X = + set_of_list (truncate_simplex ((if k < 4 then k else 4) - 1) ul)`); + (REWRITE_WITH `X = mcell (if k < 4 then k else 4) V ul`); + (ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `k >= 4`); + (UP_ASM_TAC THEN ARITH_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ]); + + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `2 <= k` THEN ARITH_TAC); + (STRIP_TAC); + (UNDISCH_TAC `2 <= k` THEN ARITH_TAC); + (REWRITE_WITH `mcell (if k < 4 then k else 4) V ul = X`); + (ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `k >= 4`); + (UP_ASM_TAC THEN ARITH_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN + REWRITE_TAC[ASSUME `X = {}:real^3->bool`; SET_RULE `{} INTER x = {}`; + NEGLIGIBLE_EMPTY]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list (truncate_simplex 1 (ul:(real^3)list)) SUBSET + set_of_list (truncate_simplex ((if k < 4 then k else 4) - 1) ul)`); + (MATCH_MP_TAC Rogers.TRUNCATE_SIMPLEX_SUBSET); + (REWRITE_WITH `LENGTH ul = 3 + 1 /\ + CARD (set_of_list (ul:(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `2 <= k` THEN ARITH_TAC); + (REWRITE_TAC[MESON[IN] `(s:real^3->bool) u <=> u IN s`]); + + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `truncate_simplex 1 ul = [u0; u1:real^3]`; + set_of_list]); + (SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[MESON[IN] `(s:real^3->bool) u <=> u IN s`; IN_INTER]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `x IN + D DIFF + UNIONS + {y | ?x. x IN {X | mcell_set V X /\ edgeX V X e} /\ y = x INTER D}`); + (SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[] THEN STRIP_TAC); + (EXISTS_TAC `X INTER (D:real^3 ->bool)`); + (STRIP_TAC); + (REWRITE_TAC[IN_ELIM_THM]); + (EXISTS_TAC `(X:real^3 ->bool)`); + (STRIP_TAC); + (STRIP_TAC); + + (REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[SET_RULE `~(a = {}) <=> (?x. x IN a)`]); + (EXISTS_TAC `x:real^3`); + + (REWRITE_TAC[IN_INTER]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `x IN + D DIFF + UNIONS + {y | ?x. x IN {X | mcell_set V X /\ edgeX V X e} /\ y = x INTER D}`); + (SET_TAC[]); + (REWRITE_TAC[]); + + (REWRITE_TAC[MESON[IN] `(s:real^3->bool) u <=> u IN s`; IN_INTER]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `x IN + D DIFF + UNIONS + {y | ?x. x IN {X | mcell_set V X /\ edgeX V X e} /\ y = x INTER D}`); + (SET_TAC[]); + +(* ========================================================================= *) +(* ========================================================================= *) +(* ========================================================================= *) + + (UP_ASM_TAC); + (ABBREV_TAC `t ={X | mcell_set V X /\ edgeX V X e /\ ~NULLSET (X INTER D)}`); + + (REWRITE_WITH `sum s (\t. vol (t INTER D)) = + sum t (\t. vol (t INTER D))`); + (MATCH_MP_TAC SUM_SUPERSET); + (EXPAND_TAC "s" THEN EXPAND_TAC "t" THEN REPEAT STRIP_TAC); + (SET_TAC[]); + (MATCH_MP_TAC MEASURE_EQ_0); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[IN; IN_ELIM_THM] ); + (MESON_TAC[]); + + + (REWRITE_WITH `sum s (\t. dihX V t (u0,u1)) = + sum t (\t. dihX V t (u0,u1))`); + (MATCH_MP_TAC SUM_SUPERSET); + (EXPAND_TAC "s" THEN EXPAND_TAC "t" THEN REPEAT STRIP_TAC); + (SET_TAC[]); + + (NEW_GOAL `NULLSET (x INTER D)`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[IN; IN_ELIM_THM] ); + (MESON_TAC[]); + + (NEW_GOAL `mcell_set V x /\ edgeX V x e`); + (UNDISCH_TAC `x IN {X | mcell_set V X /\ edgeX V X e}`); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (UP_ASM_TAC THEN REWRITE_TAC[mcell_set_2; IN_ELIM_THM;IN] THEN STRIP_TAC); + + (NEW_GOAL `~NULLSET x`); + (UP_ASM_TAC THEN REWRITE_TAC[edgeX; VX; IN_ELIM_THM]); + (COND_CASES_TAC THEN REPEAT STRIP_TAC); + (UNDISCH_TAC `{} (u:real^3)` THEN REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`]); + (SET_TAC[]); + + (NEW_GOAL `VX V x = V INTER (x:real^3->bool)`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `V INTER (x:real^3->bool) = + set_of_list (truncate_simplex (i - 1) ul)`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_CASES_TAC `i = 0`); + (NEW_GOAL `V INTER (x:real^3->bool) = {}`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (UNDISCH_TAC `edgeX V x e` THEN REWRITE_TAC[edgeX; IN_ELIM_THM]); + (STRIP_TAC); + (UNDISCH_TAC `VX V x u` THEN ASM_REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`]); + (SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN ARITH_TAC); + (REWRITE_TAC[GSYM (ASSUME `x = mcell i V ul`)] THEN STRIP_TAC); + (UNDISCH_TAC `~NULLSET x` THEN REWRITE_TAC[ASSUME `x:real^3->bool = {}`; + NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `(u0:real^3) IN VX V x /\ u1 IN VX V x`); + (UNDISCH_TAC `edgeX V x e` THEN REWRITE_TAC[edgeX; IN_ELIM_THM; + ASSUME `e = {u0, u1:real^3}`]); + (STRIP_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + +(* ========================================================================== *) + (NEW_GOAL `F`); + + (ASM_CASES_TAC `i <= 1`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2 ;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `i - 1 = 0`); + (UNDISCH_TAC `i <= 1` THEN ARITH_TAC); + (UNDISCH_TAC `u0 IN VX V x /\ u1 IN VX V x`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_0; set_of_list]); + (UNDISCH_TAC `~(u0 = u1:real^3)` THEN SET_TAC[]); + + (ASM_CASES_TAC `i = 3`); + (NEW_GOAL `vol (x INTER D) > &0`); + (ONCE_REWRITE_TAC[SET_RULE `a INTER b = b INTER a`]); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2 ;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell3; TRUNCATE_SIMPLEX_EXPLICIT_2; + set_of_list; SET_RULE `{a,c,d} UNION {x} = {a,c,d,x}`]); + (COND_CASES_TAC); + (NEW_GOAL `i - 1 = 2`); + (UNDISCH_TAC `i = 3` THEN ARITH_TAC); + (UNDISCH_TAC `u0 IN VX V x /\ u1 IN VX V x`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (STRIP_TAC); + (NEW_GOAL `?v:real^3. {u0, u1, v} = {v0, v1, v2}`); + (NEW_GOAL `?v:real^3. v IN {v0, v1, v2} DIFF {u0, u1}`); + (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]); + (REWRITE_WITH `{v0, v1, v2} DIFF {u0, u1:real^3} = {} <=> + CARD ({v0, v1, v2} DIFF {u0, u1}) = 0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_EQ_0); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{v0, v1, v2:real^3}`); + (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]); + (REWRITE_TAC[ARITH_RULE `~(a = 0) <=> 1 <= a`]); + + (NEW_GOAL `CARD {v0, v1, v2} = CARD ({v0, v1, v2} DIFF {u0, u1:real^3}) + + CARD {u0, u1}`); + (MATCH_MP_TAC Hypermap.CARD_MINUS_DIFF_TWO_SET); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + (UP_ASM_TAC THEN REWRITE_WITH `CARD ({v0, v1, v2:real^3}) = 3`); + (REWRITE_WITH `{v0, v1, v2:real^3} = set_of_list (truncate_simplex 2 ul)`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (ABBREV_TAC `xl = truncate_simplex 2 (ul:(real^3)list)`); + (REWRITE_WITH `LENGTH (xl:(real^3)list) = 2 + 1 /\ + CARD (set_of_list xl) = 2 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "xl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ARITH_TAC); + + (NEW_GOAL `CARD {u0, u1:real^3} <= 2`); + (REWRITE_TAC[Geomdetail.CARD2]); + (UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN + UNDISCH_TAC `~(u0 = u1:real^3)` THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `{v0, v1, v2, mxi V [v0; v1; v2; v3]} = + {u0, u1, v, mxi V [v0; v1; v2; v3]}`); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC CONIC_CAP_INTER_CONVEX_HULL_4_GT_0); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (REWRITE_TAC[GSYM (ASSUME `{v0, v1, v2, mxi V [v0; v1; v2; v3]} = + {u0, u1, v, mxi V [v0; v1; v2; v3]}`)] THEN STRIP_TAC); + (UNDISCH_TAC `~NULLSET x`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_TAC[SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2, mxi V [v0; v1; v2; v3]}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET x`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `vol (x INTER D) = &0`); + (MATCH_MP_TAC MEASURE_EQ_0); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + +(* ========================================== *) + + (ASM_CASES_TAC `i = 4`); + (NEW_GOAL `vol (x INTER D) > &0`); + (ONCE_REWRITE_TAC[SET_RULE `a INTER b = b INTER a`]); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2 ;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4; ARITH_RULE `4 >= 4`; + set_of_list]); + (COND_CASES_TAC); + (NEW_GOAL `i - 1 = 3`); + (UNDISCH_TAC `i = 4` THEN ARITH_TAC); + (UNDISCH_TAC `u0 IN VX V x /\ u1 IN VX V x`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3; set_of_list]); + (STRIP_TAC); + + (NEW_GOAL `?v w:real^3. {u0, u1, v, w} = {v0, v1, v2, v3}`); + + (NEW_GOAL `?v:real^3. v IN {v0, v1, v2, v3} DIFF {u0, u1}`); + (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]); + (REWRITE_WITH `{v0, v1, v2, v3} DIFF {u0, u1:real^3} = {} <=> + CARD ({v0, v1, v2, v3} DIFF {u0, u1}) = 0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_EQ_0); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{v0, v1, v2, v3:real^3}`); + (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]); + (REWRITE_TAC[ARITH_RULE `~(a = 0) <=> 1 <= a`]); + + (NEW_GOAL `CARD {v0, v1, v2, v3} = + CARD ({v0, v1, v2, v3} DIFF {u0, u1:real^3}) + CARD {u0, u1}`); + (MATCH_MP_TAC Hypermap.CARD_MINUS_DIFF_TWO_SET); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + + (UP_ASM_TAC THEN REWRITE_WITH `CARD ({v0, v1, v2, v3:real^3}) = 3 + 1`); + (REWRITE_WITH `{v0, v1, v2, v3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD {u0, u1:real^3} <= 2`); + (REWRITE_TAC[Geomdetail.CARD2]); + (UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?w:real^3. w IN {v0, v1, v2, v3} DIFF {u0, u1, v}`); + (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]); + (REWRITE_WITH `{v0, v1, v2, v3} DIFF {u0, u1, v:real^3} = {} <=> + CARD ({v0, v1, v2, v3} DIFF {u0, u1, v}) = 0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_EQ_0); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{v0, v1, v2, v3:real^3}`); + (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]); + (REWRITE_TAC[ARITH_RULE `~(a = 0) <=> 1 <= a`]); + + (NEW_GOAL `CARD ({v0, v1, v2, v3} DIFF {u0, u1,v:real^3}) = + CARD {v0, v1, v2, v3} - CARD {u0,u1,v}`); + (MATCH_MP_TAC CARD_DIFF); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH `CARD ({v0, v1, v2, v3:real^3}) = 3 + 1`); + (REWRITE_WITH `{v0, v1, v2, v3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD {u0, u1, v:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (EXISTS_TAC `v:real^3` THEN EXISTS_TAC `w:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN + UNDISCH_TAC `~(u0 = u1:real^3)` THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[GSYM (ASSUME `{u0:real^3, u1, v, w} = {v0, v1, v2, v3}`)]); + (MATCH_MP_TAC CONIC_CAP_INTER_CONVEX_HULL_4_GT_0); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET x`); + (SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list; ARITH_RULE `4 >= 4`; + ASSUME `x = mcell i V ul`; ASSUME `i = 4`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2, v3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET x`); + (SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list; ARITH_RULE `4 >= 4`; + ASSUME `x = mcell i V ul`; ASSUME `i = 4`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `vol (x INTER D) = &0`); + (MATCH_MP_TAC MEASURE_EQ_0); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + +(* ========================================== *) + + (NEW_GOAL `i = 2`); + (UNDISCH_TAC `i <= 4` THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC + THEN ARITH_TAC); + + + (NEW_GOAL `vol (x INTER D) > &0`); + (ONCE_REWRITE_TAC[SET_RULE `a INTER b = b INTER a`]); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2 ;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2; TRUNCATE_SIMPLEX_EXPLICIT_1; + set_of_list; HD; TL]); + (LET_TAC); + (COND_CASES_TAC); + + (NEW_GOAL `i - 1 = 1`); + (UNDISCH_TAC `i = 2` THEN ARITH_TAC); + (UNDISCH_TAC `u0 IN VX V x /\ u1 IN VX V x`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list]); + (STRIP_TAC); + (NEW_GOAL `{u0, u1} = {v0, v1:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN + SET_TAC[]); + (REWRITE_TAC[SET_RULE `A INTER B INTER C INTER D = + (A INTER (B INTER C)) INTER D`]); + (REWRITE_WITH `rcone_ge v0 v1 a' INTER rcone_ge v1 v0 a' = + rcone_ge u0 u1 a' INTER rcone_ge u1 (u0:real^3) a'`); + (ASM_CASES_TAC `u0:real^3 = v0`); + (NEW_GOAL `u1 = v1:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `u0 = v1:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (NEW_GOAL `u1 = v0:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + + (REWRITE_WITH + `conic_cap u0 u1 r d INTER rcone_ge u0 u1 a' INTER rcone_ge u1 u0 a' = + conic_cap (u0:real^3) u1 r d`); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> A INTER B = A`)); + + (NEW_GOAL `conic_cap (u0:real^3) u1 r d SUBSET rcone_ge u0 u1 a'`); + (REWRITE_TAC[conic_cap]); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A SUBSET B`)); + (NEW_GOAL `rcone_gt u0 u1 d SUBSET rcone_gt (u0:real^3) u1 a'`); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN EXPAND_TAC "c"); + (MATCH_MP_TAC (REAL_ARITH `a = x ==> a <= max (max y x) (max z t)`)); + (EXPAND_TAC "a'" THEN REWRITE_TAC[HL; set_of_list] THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `rcone_gt u0 u1 a' SUBSET rcone_ge (u0:real^3) u1 a'`); + (REWRITE_TAC[RCONE_GT_SUBSET_RCONE_GE]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[SUBSET_INTER] THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[SUBSET]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC Marchal_cells_2_new.RCONEGE_INTER_VORONOI_CLOSED_IMP_RCONEGE); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + + (REWRITE_WITH `a' = hl [u0; u1:real^3] / sqrt (&2)`); + (EXPAND_TAC "a'"); + (REWRITE_TAC[HL; set_of_list] THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC REAL_LT_DIV); + (REWRITE_TAC[HL_2]); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LT_MUL); + (REWRITE_TAC[REAL_ARITH `&0 < inv (&2)`]); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SQRT_POS_LT); + (REAL_ARITH_TAC); + (EXPAND_TAC "a'"); + (MATCH_MP_TAC REAL_DIV_LE_1_TACTICS); + (STRIP_TAC); + (MATCH_MP_TAC SQRT_POS_LT); + (REAL_ARITH_TAC); + (MATCH_MP_TAC (REAL_ARITH `a < b ==> a <= b`)); + (ASM_REWRITE_TAC[]); + + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (NEW_GOAL `x':real^3 IN ball (u0, (&1))`); + (UP_ASM_TAC THEN REWRITE_TAC[conic_cap;NORMBALL_BALL] THEN STRIP_TAC); + (NEW_GOAL `ball (u0, r) SUBSET ball (u0:real^3, &1)`); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r"); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL] THEN ONCE_REWRITE_TAC[DIST_SYM] + THEN STRIP_TAC); + (REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `u0 = w:real^3`); + (ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + (NEW_GOAL `&2 <= dist (u0, w:real^3)`); + (UNDISCH_TAC `packing (V:real^3->bool)` THEN REWRITE_TAC[packing]); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `u0:real^3 IN V` THEN REWRITE_TAC[IN]); + (NEW_GOAL `dist (x', u0) >= dist (u0, w) - dist (x', w:real^3)`); + (NORM_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN DEL_TAC THEN DEL_TAC THEN UP_ASM_TAC + THEN REAL_ARITH_TAC); + (ABBREV_TAC `M = mxi V [v0; v1; v2; v3]`); + (ABBREV_TAC `R = omega_list_n V [v0; v1; v2; v3] 3`); + + (NEW_GOAL `vol (conic_cap u0 u1 r d INTER convex hull {v0:real^3,v1,M,R}) + <= vol (conic_cap u0 u1 r d INTER aff_ge {v0, v1} {M, R})`); + (MATCH_MP_TAC MEASURE_SUBSET); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[MEASURABLE_CONIC_CAP]); + (MATCH_MP_TAC MEASURABLE_CONVEX_HULL); + (MATCH_MP_TAC FINITE_IMP_BOUNDED); + (REWRITE_TAC[Geomdetail.FINITE6]); + + (REWRITE_TAC[conic_cap; NORMBALL_BALL]); + (ONCE_REWRITE_TAC[SET_RULE `(a INTER b) INTER c = + (a INTER b) INTER (a INTER c)`]); + (MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[MEASURABLE_BALL_AFF_GE]); + (REWRITE_TAC[GSYM conic_cap; GSYM NORMBALL_BALL; MEASURABLE_CONIC_CAP]); + + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A SUBSET C INTER B`)); + (REWRITE_TAC[Marchal_cells_2_new.CONVEX_HULL_4_SUBSET_AFF_GE_2_2]); + + + + (NEW_GOAL `vol (conic_cap u0 u1 r d INTER convex hull {v0, v1, M, R}) > &0`); + (REWRITE_WITH `{v0, v1, M, R} = {u0, u1, M, R:real^3}`); + (UNDISCH_TAC `{u0, u1} = {v0, v1:real^3}` THEN SET_TAC[]); + (MATCH_MP_TAC CONIC_CAP_INTER_CONVEX_HULL_4_GT_0); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + + (UNDISCH_TAC `~NULLSET x`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (LET_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `aff_ge {v0, v1} {M, R:real^3}`); + (REWRITE_TAC[SET_RULE `a INTER B INTER c SUBSET c`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull ({v0, v1} UNION {M, R:real^3})`); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL; SET_RULE + `{a, b} UNION {c, d} = {a,b,c,d}`]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_WITH `{v0, v1, M, R} = {u0, u1, M, R:real^3}`); + (UNDISCH_TAC `{u0, u1} = {v0, v1:real^3}` THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET x`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `vol (x INTER D) = &0`); + (MATCH_MP_TAC MEASURE_EQ_0); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================== *) + + (REWRITE_WITH `sum t (\t. vol (t INTER D)) = + sum t (\t. vol D * dihX V t (u0,u1) / (&2 * pi))`); + (MATCH_MP_TAC SUM_EQ); + (EXPAND_TAC "t" THEN REWRITE_TAC[IN_ELIM_THM; IN] THEN REPEAT STRIP_TAC); + (ASM_SIMP_TAC[]); + (REWRITE_TAC[REAL_ARITH `a * b / c = (a / c) * b`]); + (REWRITE_TAC[SUM_LMUL]); + (ABBREV_TAC `R = sum t (\t. dihX V t (u0,u1))`); + (REWRITE_TAC[REAL_ARITH `a / b * c = (a * c) / b`]); + (REWRITE_WITH `(vol D * R) / (&2 * pi) = vol D <=> + (vol D * R) = vol D * (&2 * pi)`); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (MATCH_MP_TAC REAL_LT_MUL); + (REWRITE_TAC[PI_POS]); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `a * b = a * c <=> a * (b - c) = &0`]); + (REWRITE_TAC[REAL_ENTIRE]); + (STRIP_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (NEW_GOAL `&0 < d`); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (ASM_SIMP_TAC[VOLUME_CONIC_CAP]); + (COND_CASES_TAC); + (REWRITE_TAC[]); + (UNDISCH_TAC `d < &1` THEN UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC + THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&2 / &3 * a = &0 <=> a = &0`]); + (REWRITE_TAC[REAL_ENTIRE]); + (NEW_GOAL `~(pi = &0)`); + (MP_TAC PI_POS THEN REAL_ARITH_TAC); + (NEW_GOAL `~(&1 - d = &0)`); + (UNDISCH_TAC `d < &1` THEN REAL_ARITH_TAC); + (NEW_GOAL `~(r pow 3 = &0)`); + (MATCH_MP_TAC REAL_POW_NZ); + (UNDISCH_TAC `&0 < r` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN REAL_ARITH_TAC)]);; + + + diff --git a/legacy/oldpacking/packing/development/Backup/KIZHLTL.hl b/legacy/oldpacking/packing/development/Backup/KIZHLTL.hl new file mode 100644 index 0000000..b7fe562 --- /dev/null +++ b/legacy/oldpacking/packing/development/Backup/KIZHLTL.hl @@ -0,0 +1,1090 @@ + + +g KIZHLTL1_concl;; +e (GEN_TAC);; +e (ASM_CASES_TAC `saturated V /\ packing (V:real^3->bool)`);; +e (UP_ASM_TAC THEN STRIP_TAC);; + + +e (NEW_GOAL `!r. &1 <= r + ==> sum {X | X SUBSET ball (vec 0,r) /\ mcell_set V X} vol <= + vol (ball (vec 0, r))`);; +e (REPEAT STRIP_TAC);; +e (ABBREV_TAC `S = {X | X SUBSET ball (vec 0,r) /\ mcell_set V X}`);; +e (REWRITE_WITH `sum S vol = vol (UNIONS S)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC MEASURE_NEGLIGIBLE_UNIONS);; +e (REPEAT STRIP_TAC);; +e (EXPAND_TAC "S");; +e (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA]);; +e (REWRITE_TAC[GSYM HAS_MEASURE_MEASURE]);; +e (UP_ASM_TAC THEN EXPAND_TAC "S" THEN REWRITE_TAC[IN;IN_ELIM_THM]);; +e (REWRITE_TAC[mcell_set; IN_ELIM_THM] THEN REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC MEASURABLE_MCELL);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[IN]);; + +e (ASM_CASES_TAC `~NULLSET (s INTER t)`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `s:real^3->bool IN S` THEN UNDISCH_TAC `t:real^3->bool IN S`);; +e (EXPAND_TAC "S" THEN REWRITE_TAC[IN;IN_ELIM_THM]);; +e (REWRITE_TAC[mcell_set; IN_ELIM_THM] THEN REPEAT STRIP_TAC);; +e (NEW_GOAL `s = t:real^3->bool`);; +e (REWRITE_TAC[ASSUME `t = mcell i V ul`; ASSUME `s = mcell i' V ul'`]);; +e (ABBREV_TAC `j = if i <= 4 then i else 4`);; +e (ABBREV_TAC `j' = if i' <= 4 then i' else 4`);; +e (REWRITE_WITH `mcell i V ul = mcell j V ul`);; +e (EXPAND_TAC "j" THEN COND_CASES_TAC);; +e (REFL_TAC);; +e (ASM_SIMP_TAC[ARITH_RULE `~(i <= 4) ==> i >= 4`; + ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]);; +e (REWRITE_WITH `mcell i' V ul' = mcell j' V ul'`);; +e (EXPAND_TAC "j'" THEN COND_CASES_TAC);; +e (REFL_TAC);; +e (ASM_SIMP_TAC[ARITH_RULE `~(i <= 4) ==> i >= 4`; + ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]);; +e (REWRITE_WITH `j' = j /\ mcell j' V ul' = mcell j V ul`);; +e (MATCH_MP_TAC Ajripqn.AJRIPQN);; + +e (REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (ASM_MESON_TAC[IN]);; +e (ASM_MESON_TAC[IN]);; +e (EXPAND_TAC "j'" THEN COND_CASES_TAC);; +e (UP_ASM_TAC THEN REWRITE_TAC[ARITH_RULE `i <= 4 <=> i=0\/i=1\/i=2\/i=3\/i=4`] + THEN SET_TAC[]);; +e (SET_TAC[]);; +e (EXPAND_TAC "j" THEN COND_CASES_TAC);; +e (UP_ASM_TAC THEN REWRITE_TAC[ARITH_RULE `i <= 4 <=> i=0\/i=1\/i=2\/i=3\/i=4`] + THEN SET_TAC[]);; +e (SET_TAC[]);; +e (UP_ASM_TAC);; +e (REWRITE_WITH `mcell j V ul = mcell i V ul`);; +e (EXPAND_TAC "j" THEN COND_CASES_TAC);; +e (REFL_TAC);; +e (ASM_SIMP_TAC[ARITH_RULE `~(i <= 4) ==> i >= 4`; + ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]);; +e (REWRITE_WITH `mcell j' V ul' = mcell i' V ul'`);; +e (EXPAND_TAC "j'" THEN COND_CASES_TAC);; +e (REFL_TAC);; +e (ASM_SIMP_TAC[ARITH_RULE `~(i <= 4) ==> i >= 4`; + ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; + +e (MATCH_MP_TAC MEASURE_SUBSET);; +e (REWRITE_TAC[MEASURABLE_BALL]);; +e (REPEAT STRIP_TAC);; +e (EXPAND_TAC "S" THEN MATCH_MP_TAC MEASURABLE_UNIONS);; +e (REPEAT STRIP_TAC);; +e (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA]);; +e (UP_ASM_TAC THEN REWRITE_TAC[IN;IN_ELIM_THM; mcell_set]);; +e (REPEAT STRIP_TAC);; +e (ASM_SIMP_TAC[MEASURABLE_MCELL]);; +e (EXPAND_TAC "S" THEN SET_TAC[]);; + +(* ----------------------------------------------------------------------- *) + +e (NEW_GOAL `?c. !r. &1 <= r + ==> vol (ball (vec 0, r)) + c * r pow 2 <= + sum (V INTER ball (vec 0,r)) (\u:real^3. vol (voronoi_open V u))`);; +e (EXISTS_TAC `-- (&24 / &3) * pi`);; +e (REPEAT STRIP_TAC);; + +e (ASM_CASES_TAC `r < &6`);; +e (NEW_GOAL `&0 <= sum (V INTER ball (vec 0,r)) (\u:real^3. vol (voronoi_open V u))`);; +e (MATCH_MP_TAC SUM_POS_LE);; +e (ASM_SIMP_TAC[Packing3.KIUMVTC]);; +e (REPEAT STRIP_TAC);; +e (MATCH_MP_TAC MEASURE_POS_LE);; +e (ASM_SIMP_TAC[Pack1.measurable_voronoi]);; + +e (NEW_GOAL `vol (ball ((vec 0):real^3,r)) + (--(&24 / &3) * pi) * r pow 2 <= &0`);; +e (REWRITE_TAC[REAL_ARITH `a + (--b * c) * d <= &0 <=> a <= b * c * d`]);; +e (ASM_SIMP_TAC [VOLUME_BALL; REAL_ARITH `&1 <= r ==> &0 <= r`]);; +e (REWRITE_TAC[REAL_ARITH `&4 / &3 * pi * r pow 3 <= &24 / &3 * pi * r pow 2 + <=> &0 <= &4 / &3 * pi * r pow 2 * (&6 - r)`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (STRIP_TAC);; +e (MATCH_MP_TAC REAL_LE_DIV THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[PI_POS_LE]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[REAL_LE_POW_2]);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; + + +e (NEW_GOAL `vol (ball (vec 0,r - &2)) <= + sum (V INTER ball (vec 0,r)) (\u:real^3. vol (voronoi_open V u))`);; +e (REWRITE_WITH + `sum (V INTER ball (vec 0,r)) (\u:real^3. vol (voronoi_open V u)) = + sum (V INTER ball (vec 0,r)) (\u:real^3. vol (voronoi_closed V u))`);; +e (MATCH_MP_TAC SUM_EQ);; +e (REPEAT STRIP_TAC);; +e (REWRITE_TAC[BETA_THM]);; +e (REWRITE_TAC[GSYM Pack2.MEASURE_VORONOI_CLOSED_OPEN]);; + +e (ABBREV_TAC `S:real^3->bool = V INTER ball (vec 0, r)`);; +e (ABBREV_TAC `g = (\t:real^3. voronoi_closed V t)`);; + +e (REWRITE_WITH `sum S (\u:real^3. vol (voronoi_closed V u)) = sum S (\t. vol (g t))`);; +e (EXPAND_TAC "g" THEN REWRITE_TAC[]);; +e (REWRITE_WITH `sum S (\t:real^3. vol (g t)) = measure (UNIONS (IMAGE g S))`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC MEASURE_NEGLIGIBLE_UNIONS_IMAGE);; +e (ASM_REWRITE_TAC[] THEN EXPAND_TAC "g");; +e (REPEAT STRIP_TAC);; +e (EXPAND_TAC "S");; +e (ASM_SIMP_TAC[Packing3.KIUMVTC]);; +e (MATCH_MP_TAC Pack2.MEASURABLE_VORONOI_CLOSED);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC Pack2.NEGLIGIBLE_INTER_VORONOI_CLOSED);; +e (ASM_SET_TAC[]);; +e (EXPAND_TAC "g" THEN REWRITE_TAC[IMAGE]);; +e (MATCH_MP_TAC MEASURE_SUBSET);; +e (REWRITE_TAC[MEASURABLE_BALL]);; +e (REPEAT STRIP_TAC);; +e (MATCH_MP_TAC MEASURABLE_UNIONS);; +e (STRIP_TAC);; +e (MATCH_MP_TAC FINITE_IMAGE_EXPAND);; +e (EXPAND_TAC "S");; +e (ASM_SIMP_TAC[Packing3.KIUMVTC]);; + +e (REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC Pack2.MEASURABLE_VORONOI_CLOSED);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[SUBSET; IN_BALL; IN_UNIONS]);; +e (REPEAT STRIP_TAC);; +e (MP_TAC (ASSUME `saturated (V:real^3->bool)`));; +e (REWRITE_TAC[saturated] THEN STRIP_TAC);; +e (NEW_GOAL `?y. y IN V /\ dist (x:real^3,y) < &2`);; +e (ASM_MESON_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (NEW_GOAL `?v:real^3. v IN V /\ x IN voronoi_closed V v`);; +e (MATCH_MP_TAC Packing3.TIWWFYQ);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; + +e (EXISTS_TAC `voronoi_closed V (v:real^3)`);; +e (ASM_REWRITE_TAC[]);; + +e (ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]);; +e (EXISTS_TAC `v:real^3`);; +e (STRIP_TAC);; +e (EXPAND_TAC "S" THEN REWRITE_TAC[IN_INTER]);; +e (ASM_REWRITE_TAC[IN_BALL]);; + +e (NEW_GOAL `dist (vec 0,v) <= dist (vec 0,x) + dist (x, v:real^3)`);; +e (REWRITE_TAC[DIST_TRIANGLE]);; +e (NEW_GOAL `dist (x, v:real^3) < &2`);; +e (NEW_GOAL `dist (x, v) <= dist (x, y:real^3)`);; +e (UNDISCH_TAC `x:real^3 IN voronoi_closed V v`);; +e (REWRITE_TAC[IN; voronoi_closed; IN_ELIM_THM]);; +e (STRIP_TAC);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_SET_TAC[]);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; +e (REFL_TAC);; + +e (NEW_GOAL `vol (ball (vec 0,r)) + (--(&24 / &3) * pi) * r pow 2 <= + vol (ball (vec 0,r - &2))`);; +e (ASM_SIMP_TAC[VOLUME_BALL; REAL_ARITH `~(r < &6) ==> &0 <= r`; + REAL_ARITH `~(r < &6) ==> &0 <= (r - &2)` ]);; +e (REWRITE_TAC[REAL_ARITH + `&4 / &3 * pi * r pow 3 + (--(&24 / &3) * pi) * r pow 2 <= + &4 / &3 * pi * (r - &2) pow 3 <=> + &0 <= &4 / &3 * pi * (&12 * r - &8)`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (STRIP_TAC);; +e (MATCH_MP_TAC REAL_LE_DIV THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (STRIP_TAC);; +e (REWRITE_TAC[PI_POS_LE]);; +e (NEW_GOAL `&12 * r >= &72`);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; + +e (ASM_REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN STRIP_TAC);; + +e (EXISTS_TAC `c:real`);; +e (REPEAT STRIP_TAC);; + +e (NEW_GOAL `sum {X | X SUBSET ball (vec 0,r) /\ mcell_set V X} vol <= + vol (ball (vec 0,r))`);; +e (ASM_SIMP_TAC[]);; +e (NEW_GOAL `vol (ball (vec 0,r)) + c * r pow 2 <= + sum (V INTER ball (vec 0,r)) (\u:real^3. vol (voronoi_open V u))`);; +e (ASM_SIMP_TAC[]);; +e (ABBREV_TAC `a1 = sum {X | X SUBSET ball (vec 0,r) /\ mcell_set V X} vol`);; +e (ABBREV_TAC `a2 = vol (ball ((vec 0):real^3,r))`);; +e (ABBREV_TAC `a3 = sum (V INTER ball (vec 0,r)) (\u:real^3. vol (voronoi_open V u))`);; +e (ASM_REAL_ARITH_TAC);; + +e (EXISTS_TAC `&0`);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `F`);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; + +let KIZHLTL1 = top_thm();; + +(* ------------------------------------------------------------------------ *) +(* ======================================================================== *) + +g KIZHLTL2_concl;; +e (REPEAT STRIP_TAC);; +e (ASM_CASES_TAC `saturated V /\ packing V`);; +e (NEW_GOAL + `?C. !r. &1 <= r ==> + &(CARD (V INTER ball ((vec 0):real^3,r) DIFF V INTER ball (vec 0,r - &8))) <= + C * r pow 2`);; +e (REWRITE_WITH `!r p. V INTER ball (p:real^3,r) DIFF V INTER ball (p,r - &8) + = V INTER ball (p:real^3,r + &0) DIFF V INTER ball (p,r - &8)`);; +e (ASM_REWRITE_TAC[REAL_ARITH `a + &0 = a`]);; +e (ASM_SIMP_TAC[PACKING_BALL_BOUNDARY]);; +e (TAKE_TAC);; +e (EXISTS_TAC `(&2 * mm1 / pi) * (&4 * pi) * (--C)`);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `&(CARD (V INTER ball ((vec 0):real^3,r) DIFF + V INTER ball (vec 0,r - &8))) <= C * r pow 2`);; +e (ASM_SIMP_TAC[]);; +e (NEW_GOAL `total_solid V = (\X. total_solid V X)`);; +e (REWRITE_TAC[GSYM ETA_AX]);; +e (ONCE_ASM_REWRITE_TAC[] THEN DEL_TAC);; +e (REWRITE_TAC[total_solid]);; +e (ABBREV_TAC `B = {X | X SUBSET ball (vec 0,r) /\ mcell_set V X}`);; +e (NEW_GOAL `FINITE (B:(real^3->bool) ->bool)`);; +e (EXPAND_TAC "B" THEN MATCH_MP_TAC FINITE_MCELL_SET_LEMMA);; +e (ASM_REWRITE_TAC[]);; +e (ABBREV_TAC `A1:real^3->bool = V INTER ball (vec 0,r)`);; +e (ABBREV_TAC `A2:real^3->bool = V INTER ball (vec 0,r - &8)`);; +e (NEW_GOAL `FINITE (A1:real^3->bool)`);; +e (EXPAND_TAC "A1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `FINITE (A2:real^3->bool)`);; +e (EXPAND_TAC "A2" THEN MATCH_MP_TAC FINITE_PACK_LEMMA);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `sum B (\X. sum {u | u IN A2 /\ VX V X u} (\u. sol u X)) + <= sum B (\X. sum (VX V X) (\x. sol x X))`);; +e (MATCH_MP_TAC SUM_LE);; +e (ASM_REWRITE_TAC[BETA_THM]);; +e (REPEAT STRIP_TAC);; +e (MATCH_MP_TAC SUM_SUBSET_SIMPLE);; +e (REPEAT STRIP_TAC);; +e (REWRITE_TAC[VX] THEN COND_CASES_TAC);; +e (REWRITE_TAC[FINITE_EMPTY]);; +e (LET_TAC);; +e (COND_CASES_TAC);; +e (REWRITE_TAC[FINITE_EMPTY]);; +e (REWRITE_TAC[FINITE_SET_OF_LIST]);; +e (SET_TAC[]);; +e (REWRITE_TAC[BETA_THM]);; + +e (UNDISCH_TAC `x:real^3->bool IN B`);; +e (EXPAND_TAC "B" THEN REWRITE_TAC[IN; IN_ELIM_THM; mcell_set_2]);; +e (REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `eventually_radial x' (mcell i V ul)`);; +e (MATCH_MP_TAC Urrphbz2.URRPHBZ2);; +e (ASM_REWRITE_TAC[]);; +e (SUBGOAL_THEN `x' IN (VX V x)` MP_TAC);; +e (ASM_SET_TAC[]);; +e (REWRITE_TAC[VX]);; +e (COND_CASES_TAC);; +e (SET_TAC[]);; +e (LET_TAC);; +e (COND_CASES_TAC);; +e (SET_TAC[]);; +e (STRIP_TAC);; + +e (UNDISCH_TAC `cell_params V x = k,ul'`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (REWRITE_TAC[cell_params]);; +e (ABBREV_TAC `P = (\(k,ul). k <= 4 /\ ul IN barV V 3 /\ x = mcell k V ul)`);; +e (DISCH_TAC);; +e (NEW_GOAL `(P:(num#(real^3)list->bool)) (k,ul')`);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC SELECT_AX);; +e (EXISTS_TAC `(i:num,ul:(real^3)list)`);; +e (EXPAND_TAC "P");; +e (REWRITE_TAC[BETA_THM]);; +e (REWRITE_TAC[IN] THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN EXPAND_TAC "P" THEN REWRITE_TAC[BETA_THM] THEN STRIP_TAC);; +e (NEW_GOAL `set_of_list (truncate_simplex (k - 1) ul') SUBSET V:real^3->bool`);; +e (MATCH_MP_TAC Packing3.BARV_SUBSET);; +e (EXISTS_TAC `k - 1`);; +e (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV);; +e (EXISTS_TAC `3`);; +e (STRIP_TAC);; +e (ASM_SET_TAC[]);; +e (ASM_ARITH_TAC);; +e (ASM_SET_TAC[]);; + + +e (UP_ASM_TAC THEN REWRITE_TAC[eventually_radial]);; +e (REPEAT STRIP_TAC);; +e (REWRITE_WITH `sol x' (mcell i V ul) = + &3 * vol ((mcell i V ul) INTER normball x' r') / r' pow 3`);; +e (MATCH_MP_TAC sol);; +e (ASM_REWRITE_TAC[GSYM Marchal_cells_2_new.RADIAL_VS_RADIAL_NORM; NORMBALL_BALL]);; +e (MATCH_MP_TAC MEASURABLE_INTER);; +e (ASM_SIMP_TAC[MEASURABLE_BALL; MEASURABLE_MCELL]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[REAL_ARITH `&0 <= &3`] THEN MATCH_MP_TAC REAL_LE_DIV);; +e (STRIP_TAC);; +e (MATCH_MP_TAC MEASURE_POS_LE);; +e (MATCH_MP_TAC MEASURABLE_INTER);; +e (ASM_SIMP_TAC[MEASURABLE_BALL; NORMBALL_BALL; MEASURABLE_MCELL]);; +e (MATCH_MP_TAC REAL_POW_LE THEN ASM_REAL_ARITH_TAC);; + +(* ------------------------------------------------------------------------- *) + +e (NEW_GOAL `sum B (\X. sum {u | u IN A2 /\ VX V X u} (\u. sol u X)) = + sum A2 (\u. sum {X | X IN B /\ VX V X u} (\X. sol u X))`);; +e (MATCH_MP_TAC SUM_SUM_RESTRICT);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `sum A2 (\u. sum {X | X IN B /\ VX V X u} (\X. sol u X)) = + sum A2 (\u. sum {X | mcell_set V X /\ u IN VX V X} + (\X. sol u X))`);; +e (MATCH_MP_TAC SUM_EQ);; +e (EXPAND_TAC "A2" THEN REWRITE_TAC[IN_INTER; IN_DIFF] THEN + REWRITE_TAC[IN_BALL; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC);; +e (REWRITE_WITH `{X | B X /\ VX V X x} = + {X | mcell_set V X /\ VX V X x}`);; +e (REWRITE_TAC[SET_RULE `a = b <=> a SUBSET b /\ b SUBSET a`]);; +e (STRIP_TAC);; +e (EXPAND_TAC "B");; +e (SET_TAC[]);; +e (REWRITE_WITH `!x:real^3->bool. B x <=> x IN B`);; +e (REWRITE_TAC[IN]);; +e (EXPAND_TAC "B" THEN REWRITE_TAC[SUBSET; IN_INTER; IN_DIFF] THEN + REWRITE_TAC[IN_BALL; IN; IN_ELIM_THM]);; +e (REWRITE_TAC[MESON[] `A /\ X /\ Y ==> (B /\ A) /\ X /\ Y <=> A /\ X /\ Y ==> B`]);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `x IN VX V x'`);; +e (ASM_REWRITE_TAC[IN]);; +e (NEW_GOAL `~NULLSET x'`);; +e (UNDISCH_TAC `x IN VX V x'` THEN REWRITE_TAC[VX] THEN COND_CASES_TAC);; +e (SET_TAC[]);; +e (MESON_TAC[]);; + +e (NEW_GOAL `dist (vec 0, x'':real^3) <= dist (vec 0, x) + dist (x, x'')`);; +e (REWRITE_TAC[DIST_TRIANGLE]);; +e (NEW_GOAL `?p. x' SUBSET ball (p:real^3,&4)`);; +e (MATCH_MP_TAC MCELL_SUBSET_BALL_4);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[SUBSET; IN_BALL] THEN STRIP_TAC);; +e (NEW_GOAL `dist (x, x'':real^3) <= dist (x, p) + dist (p, x'')`);; +e (REWRITE_TAC[DIST_TRIANGLE]);; +e (NEW_GOAL `dist (x, p:real^3) < &4`);; +e (ONCE_REWRITE_TAC[DIST_SYM]);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (NEW_GOAL `VX V x' = V INTER x'`);; +e (MATCH_MP_TAC Hdtfnfz.HDTFNFZ);; +e (UNDISCH_TAC `mcell_set V x'` THEN REWRITE_TAC[mcell_set; IN_ELIM_THM] THEN STRIP_TAC);; +e (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`);; +e (ASM_REWRITE_TAC[]);; +e (ASM_SET_TAC[]);; +e (ASM_SET_TAC[]);; +e (NEW_GOAL `dist (p:real^3,x'') < &4`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_REWRITE_TAC[IN]);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[]);; + +(* ------------------------------------------------------------------------ *) + +e (UP_ASM_TAC);; +e (REWRITE_WITH `sum A2 (\u. sum {X | mcell_set V X /\ u IN VX V X} (\X. sol u X)) = sum A2 (\u. &4 * pi)`);; +e (MATCH_MP_TAC SUM_EQ);; +e (REWRITE_TAC[BETA_THM] THEN REPEAT STRIP_TAC);; +e (MATCH_MP_TAC Qzyzmjc.QZYZMJC);; +e (ASM_REWRITE_TAC[]);; +e (ASM_SET_TAC[]);; +e (ASM_SIMP_TAC[SUM_CONST]);; +e (STRIP_TAC);; + +e (ABBREV_TAC `s1 = sum B (\X. sum (VX V X) (\x. sol x X))`);; +e (NEW_GOAL `&(CARD (A2:real^3->bool)) * &4 * pi <= s1`);; +e (ABBREV_TAC `s2 = sum B (\X. sum {u | u IN A2 /\ VX V X u} (\u. sol u X))`);; +e (ABBREV_TAC `s3 = sum A2 (\u. sum {X | X IN B /\ VX V X u} (\X. sol u X))`);; +e (ASM_REAL_ARITH_TAC);; +e (NEW_GOAL `(&2 * mm1 / pi) * &(CARD (A2:real^3->bool)) * &4 * pi <= (&2 * mm1 / pi) * s1`);; +e (REWRITE_TAC[REAL_ARITH `a * b <= a * c <=> &0 <= (c - b) * a`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (STRIP_TAC);; +e (ASM_REAL_ARITH_TAC);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (STRIP_TAC);; +e (REAL_ARITH_TAC);; +e (MATCH_MP_TAC REAL_LE_DIV);; +e (REWRITE_TAC[PI_POS_LE]);; +e (NEW_GOAL `#1.012080 < mm1`);; +e (REWRITE_TAC[Flyspeck_constants.bounds]);; +e (UP_ASM_TAC THEN REAL_ARITH_TAC);; + +e (NEW_GOAL `&(CARD (A1:real^3->bool)) * &8 * mm1 + + ((&2 * mm1 / pi) * (&4 * pi) * --C) * r pow 2 <= + (&2 * mm1 / pi) * &(CARD (A2:real^3->bool)) * &4 * pi`);; +e (REWRITE_TAC[REAL_ARITH `((&2 * mm1 / pi) * (&4 * pi) * --C) * r pow 2 = + (--C * r pow 2) * (&8 * mm1) * (pi / pi)`]);; +e (REWRITE_TAC[REAL_ARITH `(&2 * mm1 / pi) * &(CARD A2) * &4 * pi = + &(CARD A2) * (&8 * mm1) * (pi / pi)`]);; +e (REWRITE_WITH `pi / pi = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (MP_TAC PI_POS THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[REAL_MUL_RID; REAL_ARITH `a * b + c * b <= d * b <=> + &0 <= (d - a - c) * b `]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (STRIP_TAC);; +e (REWRITE_TAC[REAL_ARITH `&0 <= a - b - (--c * x) <=> b - a <= c * x`]);; + +e (NEW_GOAL `A2 SUBSET A1:real^3->bool`);; +e (EXPAND_TAC "A1" THEN EXPAND_TAC "A2");; +e (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> V INTER A SUBSET V INTER B`));; +e (MATCH_MP_TAC SUBSET_BALL);; +e (REAL_ARITH_TAC);; +e (REWRITE_WITH `&(CARD (A1:real^3->bool)) - &(CARD (A2:real^3->bool)) = + &(CARD A1 - CARD A2)`);; +e (MATCH_MP_TAC REAL_OF_NUM_SUB);; +e (MATCH_MP_TAC CARD_SUBSET);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_WITH `CARD (A1:real^3->bool) - CARD (A2:real^3->bool) = + CARD (A1 DIFF A2)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC CARD_DIFF);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[]);; + +e (MATCH_MP_TAC REAL_LE_MUL);; +e (NEW_GOAL `#1.012080 < mm1`);; +e (REWRITE_TAC[Flyspeck_constants.bounds]);; +e (UP_ASM_TAC THEN REAL_ARITH_TAC);; + + +e (ASM_REAL_ARITH_TAC);; +e (EXISTS_TAC `&0`);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `F`);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; + +let KIZHLTL2 = top_thm();; + +(* ========================================================================== *) +open Flyspeck_constants;; + +let SUM_PAIR_2_SET = prove +(`!f s:real^N->bool d. + FINITE s +==> sum {(m,n) | m IN s /\ n IN s /\ ~(m = n) /\ dist(m,n) <= d} + (\(m,n). f {m, n}) = &2 * + sum {{m, n} | m IN s /\ n IN s /\ ~(m = n) /\ dist(m,n) <= d} f`, +REPEAT STRIP_TAC THEN MP_TAC(ISPECL + [`\(m:real^N,n). {m,n}`;`(\(m,n). f {m,n}):real^N#real^N->real`; + `{(m,n) | m IN s /\ n IN s /\ ~(m:real^N = n) /\ dist(m,n) <= d}`; + `{{m,n} | m IN s /\ n IN s /\ ~(m:real^N = n) /\ dist(m,n) <= d}`] + SUM_GROUP) THEN + ANTS_TAC THENL + [CONJ_TAC THENL + [ONCE_REWRITE_TAC[SET_RULE + `m IN s /\ n IN s /\ P m n <=> + m IN s /\ n IN {n | n IN s /\ P m n}`] THEN + MATCH_MP_TAC FINITE_PRODUCT_DEPENDENT THEN + ASM_SIMP_TAC[FINITE_RESTRICT]; + REWRITE_TAC[SUBSET; FORALL_IN_IMAGE; FORALL_IN_GSPEC] THEN SET_TAC[]]; + DISCH_THEN(SUBST1_TAC o SYM) THEN REWRITE_TAC[GSYM SUM_LMUL] THEN + MATCH_MP_TAC SUM_EQ THEN REWRITE_TAC[FORALL_IN_GSPEC] THEN + MAP_EVERY X_GEN_TAC [`m:real^N`; `n:real^N`] THEN STRIP_TAC THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `sum {(m:real^N,n), (n,m)} (\(m,n). f {m,n})` THEN + CONJ_TAC THENL + [AP_THM_TAC THEN AP_TERM_TAC THEN GEN_REWRITE_TAC I [EXTENSION] THEN + REWRITE_TAC[FORALL_PAIR_THM] THEN + REWRITE_TAC[IN_ELIM_THM; PAIR_EQ; IN_INSERT; NOT_IN_EMPTY; + SET_RULE `{a,b} = {c,d} <=> a = c /\ b = d \/ a = d /\ b = c`] THEN + ASM_MESON_TAC[DIST_SYM]; + SIMP_TAC[SUM_CLAUSES; FINITE_INSERT; FINITE_EMPTY] THEN + ASM_REWRITE_TAC[IN_SING; NOT_IN_EMPTY; PAIR_EQ; REAL_ADD_RID] THEN + REWRITE_TAC[INSERT_AC] THEN REAL_ARITH_TAC]]);; + +(* ========================================================================== *) + +let H0_LT_SQRT2 = prove_by_refinement (`h0 < sqrt (&2)`, +[REWRITE_TAC[h0; GSYM sqrt2]; + NEW_GOAL `#1.414213 < sqrt2`; + REWRITE_TAC[bounds]; + ASM_REAL_ARITH_TAC]);; + +(* ========================================================================== *) + +let gamma_y_pos_le = prove_by_refinement ( + `!V X e. packing V /\ saturated V /\ mcell_set V X /\ edgeX V X e + ==> &0 <= gammaY V X lmfun e`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[gammaY]); + (NEW_GOAL `?u v. (VX V X u /\ VX V X v /\ ~(u = v)) /\ e = {u, v}`); + (UP_ASM_TAC THEN REWRITE_TAC[edgeX; IN_ELIM_THM]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ABBREV_TAC `f = (\u v. if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)`); + (REWRITE_WITH `(\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0) = (\({u, v}). f u v)`); + (EXPAND_TAC "f" THEN REWRITE_TAC[]); + (REWRITE_WITH `(\({u:real^3, v}). f u v) {u, v} = (f:real^3->real^3->real) u v`); + (MATCH_MP_TAC BETA_PAIR_THM); + (EXPAND_TAC "f" THEN REPEAT STRIP_TAC); + (REPEAT COND_CASES_TAC); + (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]); + (REWRITE_WITH `dihX V X (u',v') = dihX V X (v',u')`); + (MATCH_MP_TAC DIHX_SYM); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`] THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`] THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (REFL_TAC); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIHX_POS;lmfun_pos_le]); + (REAL_ARITH_TAC)]);; + +(* ========================================================================== *) + +let BETA_SET_2_THM = prove + (`!g:(A->bool)->B u0 v0. (\({u, v}). g {u, v}) {u0, v0} = g {u0, v0}`, + GEN_TAC THEN REWRITE_TAC[GABS_DEF;GEQ_DEF] THEN + CONV_TAC SELECT_CONV THEN EXISTS_TAC `g:(A->bool)->B` THEN + REWRITE_TAC[]);; + +(* ========================================================================== *) +(* Begin to prove KIZHLTL4 *) +(* ========================================================================== *) +(* *) +(* #use "/home/ky/flyspeck/working/marchal_cells_3.hl";; *) +(* #use "/home/ky/flyspeck/working/empty.hl";; *) +(* *) +(* ========================================================================== *) + + +(* ========================================================================== *) + +let KIZHLTL4_concl = + `!V. ?c. !r. saturated V /\ packing V /\ &1 <= r + ==> (&8 * mm2 / pi) * + sum {X | X SUBSET ball (vec 0,r) /\ mcell_set V X} + (\X. sum (edgeX V X) + (\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)) + + c * r pow 2 <= + &8 * + mm2 * + sum (V INTER ball (vec 0,r)) + (\u. sum {v | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v])))`;; + +(* ========================================================================== *) + +g KIZHLTL4_concl;; +e (REPEAT STRIP_TAC);; +e (ASM_CASES_TAC `saturated V /\ packing V`);; +e (ABBREV_TAC `c = &8 * mm2 * (&0)`);; +e (EXISTS_TAC `c:real`);; (* choose d later *) + +(* ------------------------------------------------------------------------- *) + +e (REPEAT STRIP_TAC);; +e (ABBREV_TAC `S1 = {X | X SUBSET ball (vec 0,r) /\ mcell_set V X}`);; +e (ABBREV_TAC `V1:real^3->bool = V INTER ball (vec 0, r)`);; +e (ABBREV_TAC `T1 = {{u,v:real^3} | u IN V1 /\ v IN V1}`);; + +e (NEW_GOAL `FINITE (S1:(real^3->bool)->bool)`);; +e (EXPAND_TAC "S1");; +e (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA]);; + +e (NEW_GOAL `FINITE (T1:(real^3->bool)->bool)`);; +e (EXPAND_TAC "T1");; +e (REWRITE_TAC[GSYM set_of_list]);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `IMAGE (set_of_list) {[u; v:real^3] | u IN V1 /\ v IN V1}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC FINITE_IMAGE);; +e (REWRITE_TAC[SET_RULE `{[u;v] | u IN s /\ v IN s} = + {y | ?u0 u1. u0 IN s /\ u1 IN s /\ y = [u0; u1]}`]);; +e (MATCH_MP_TAC FINITE_LIST_KY_LEMMA_2);; +e (EXPAND_TAC "V1" THEN MATCH_MP_TAC Packing3.KIUMVTC);; +e (ASM_REWRITE_TAC[]);; +e (SET_TAC[]);; + +e (ABBREV_TAC + `S2 = {X | X SUBSET ball (vec 0,r) /\ mcell_set V X /\ ~NULLSET X}`);; +e (NEW_GOAL `FINITE (S2:(real^3->bool)->bool)`);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `S1:(real^3->bool)->bool`);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "S1" THEN EXPAND_TAC "S2" THEN SET_TAC[]);; + +e (ABBREV_TAC `g = (\X. (\({u, v}). + if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0))`);; +e (REWRITE_WITH +`sum S1 (\X. sum (edgeX V X) + (\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)) = + sum S1 (\X. sum (edgeX V X) (\({u, v}). g X {u,v}))`);; +e (MATCH_MP_TAC SUM_EQ);; + +e (EXPAND_TAC "S1" THEN REWRITE_TAC[IN_ELIM_THM; IN; mcell_set_2]);; +e (REPEAT STRIP_TAC);; +e (MATCH_MP_TAC SUM_EQ);; +e (REWRITE_WITH `!x'. x' IN edgeX V x <=> + ?u v. VX V x u /\ VX V x v /\ ~(u = v) /\ x' = {u, v}`);; +e (REWRITE_TAC[IN; IN_ELIM_THM; edgeX]);; +e (MESON_TAC[]);; +e (REPEAT STRIP_TAC);; + +e (ABBREV_TAC `f_temp = (\u v. if edgeX V x {u, v} + then dihX V x (u,v) * lmfun (hl [u; v]) + else &0)`);; +e (NEW_GOAL `!u v. (f_temp:real^3->real^3->real) u v = f_temp v u`);; +e (EXPAND_TAC "f_temp" THEN REWRITE_TAC[BETA_THM]);; +e (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]);; +e (REPEAT GEN_TAC THEN COND_CASES_TAC);; +e (COND_CASES_TAC);; +e (REWRITE_WITH `dihX V x (u',v') = dihX V x (v',u')`);; +e (MATCH_MP_TAC DIHX_SYM);; +e (ASM_REWRITE_TAC[IN; mcell_set; IN_ELIM_THM]);; +e (EXISTS_TAC `i:num` THEN EXISTS_TAC `ul:(real^3)list` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (COND_CASES_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (REFL_TAC);; + +e (REWRITE_WITH `(\({u, v}). if edgeX V x {u, v} + then dihX V x (u,v) * lmfun (hl [u; v]) + else &0) = (\({u, v}). f_temp u v)`);; +e (EXPAND_TAC "f_temp");; +e (REWRITE_TAC[]);; + +e (REWRITE_TAC[BETA_SET_2_THM; ASSUME `x' = {u,v:real^3}`]);; +e (REWRITE_WITH `(\({u, v}). f_temp u v) {u, v} = + (f_temp:real^3->real^3->real) u v`);; +e (MATCH_MP_TAC BETA_PAIR_THM);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_WITH `(g:(real^3->bool)->(real^3->bool)->real) x = + (\({u, v}). f_temp u v)`);; +e (EXPAND_TAC "f_temp" THEN EXPAND_TAC "g" THEN REWRITE_TAC[IN]);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC BETA_PAIR_THM);; +e (ASM_REWRITE_TAC[]);; + +(* ----------------------------------------------------------------------- *) + +e (REWRITE_WITH `sum S1 (\X. sum (edgeX V X) (\({u, v}). g X {u, v})) = + sum S1 (\X. sum (edgeX V X) (g X))`);; +e (MATCH_MP_TAC SUM_EQ);; +e (REWRITE_TAC[] THEN REPEAT STRIP_TAC);; +e (MATCH_MP_TAC SUM_EQ);; +e (REWRITE_TAC[edgeX; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[BETA_SET_2_THM]);; + +e (REWRITE_WITH `sum S1 (\X. sum (edgeX V X) (g X)) = + sum S2 (\X. sum (edgeX V X) (g X))`);; +e (MATCH_MP_TAC SUM_SUPERSET);; +e (STRIP_TAC);; +e (EXPAND_TAC "S1" THEN EXPAND_TAC "S2" THEN SET_TAC[]);; +e (EXPAND_TAC "S1" THEN EXPAND_TAC "S2" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (MATCH_MP_TAC SUM_EQ_0);; +e (REPEAT STRIP_TAC);; + +e (ABBREV_TAC `f_temp = (\u v. if edgeX V x {u, v} + then dihX V x (u,v) * lmfun (hl [u; v]) + else &0)`);; +e (NEW_GOAL `!u v. (f_temp:real^3->real^3->real) u v = f_temp v u`);; +e (EXPAND_TAC "f_temp" THEN REWRITE_TAC[BETA_THM]);; +e (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]);; +e (REPEAT GEN_TAC THEN COND_CASES_TAC);; +e (COND_CASES_TAC);; +e (REWRITE_WITH `dihX V x (u,v) = dihX V x (v,u)`);; + +e (MATCH_MP_TAC DIHX_SYM);; +e (ASM_REWRITE_TAC[IN; mcell_set; IN_ELIM_THM]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (COND_CASES_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (REFL_TAC);; + +e (REWRITE_WITH `(g:(real^3->bool)->(real^3->bool)->real) x = + (\({u, v}). f_temp u v)`);; +e (EXPAND_TAC "f_temp" THEN EXPAND_TAC "g" THEN REWRITE_TAC[IN]);; +e (UNDISCH_TAC `x' IN edgeX V x` THEN REWRITE_TAC[IN;IN_ELIM_THM; edgeX]);; +e (STRIP_TAC);; +e (ASM_SIMP_TAC[BETA_PAIR_THM]);; +e (EXPAND_TAC "f_temp");; +e (COND_CASES_TAC);; +e (REWRITE_TAC[dihX]);; +e (COND_CASES_TAC);; +e (REAL_ARITH_TAC);; +e (NEW_GOAL `F`);; +e (ASM_MESON_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (REFL_TAC);; + +e (REWRITE_WITH + `sum S2 (\X. sum (edgeX V X) (g X)) = + sum S2 (\X. sum {e | e IN T1 /\ edgeX V X e} (g X))`);; +e (MATCH_MP_TAC SUM_EQ);; +e (EXPAND_TAC "S2" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (AP_THM_TAC THEN AP_TERM_TAC);; +e (REWRITE_TAC[SET_RULE `a = b <=> b SUBSET a /\ a SUBSET b`]);; +e (STRIP_TAC);; +e (SET_TAC[]);; +e (REWRITE_TAC[SET_RULE `A SUBSET {y | T2 y /\ A y} <=> A SUBSET T2`]);; +e (EXPAND_TAC "T1" THEN REWRITE_TAC[SUBSET; edgeX; IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (EXPAND_TAC "V1" THEN REWRITE_TAC[IN_ELIM_THM]);; +e (EXISTS_TAC `u:real^3` THEN EXISTS_TAC `v:real^3`);; +e (REWRITE_TAC[ASSUME `x' = {u, v:real^3}`; IN_INTER; + MESON[IN] `V (x:real^3) <=> x IN V`]);; +e (NEW_GOAL `VX V x = V INTER x`);; +e (MATCH_MP_TAC Hdtfnfz.HDTFNFZ);; +e (UNDISCH_TAC `mcell_set V x` THEN REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]);; +e (STRIP_TAC);; +e (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`);; +e (ASM_REWRITE_TAC[]);; +e (ASM_SET_TAC[]);; + +e (REWRITE_WITH + `sum S2 (\X. sum {e | e IN T1 /\ edgeX V X e} (g X)) = + sum T1 (\x. sum {X | X IN S2 /\ edgeX V X x} (\X. g X x))`);; +e (REWRITE_WITH + `sum S2 (\X. sum {e | e IN T1 /\ edgeX V X e} (g X)) = + sum S2 (\X. sum {e | e IN T1 /\ edgeX V X e} (\x.g X x))`);; +e (REWRITE_TAC[ETA_AX]);; +e (ASM_SIMP_TAC[SUM_SUM_RESTRICT]);; + +(* May 09 - OK here *) + +e (ABBREV_TAC + `T2 = {{u0:real^3, u1} | u0 IN V1 /\ u1 IN V1 /\ ~(u0 = u1) /\ + hl[u0;u1] <= h0}`);; +e (NEW_GOAL `sum T1 (\x. sum {X | X IN S2 /\ edgeX V X x} (\X. g X x)) = + sum T2 (\x. sum {X | X IN S2 /\ edgeX V X x} (\X. g X x))`);; +e (MATCH_MP_TAC SUM_SUPERSET);; +e (EXPAND_TAC "T1" THEN EXPAND_TAC "T2" THEN REWRITE_TAC[IN; IN_ELIM_THM] THEN + REPEAT STRIP_TAC);; +e (SET_TAC[]);; +e (MATCH_MP_TAC SUM_EQ_0);; +e (EXPAND_TAC "g" THEN REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; + +e (ABBREV_TAC `f_temp = (\u v. if {u, v} IN edgeX V x' + then dihX V x' (u,v) * lmfun (hl [u; v]) + else &0)`);; +e (REWRITE_WITH `(\({u, v}). if {u, v} IN edgeX V x' + then dihX V x' (u,v) * lmfun (hl [u; v]) + else &0) = (\({u, v}). f_temp u v)`);; +e (EXPAND_TAC "f_temp");; +e (REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_WITH `(\({u, v}). f_temp u v) {u, v} = + (f_temp:real^3->real^3->real) u v`);; +e (MATCH_MP_TAC BETA_PAIR_THM);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "f_temp");; +e (REPEAT GEN_TAC THEN REPEAT COND_CASES_TAC);; +e (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} ={b,a}`]);; +e (REWRITE_WITH `dihX V x' (u',v') = dihX V x' (v',u')`);; +e (MATCH_MP_TAC DIHX_SYM);; +e (ASM_REWRITE_TAC[]);; +e (UNDISCH_TAC `x' IN {X | S2 X /\ edgeX V X x}`);; +e (EXPAND_TAC "S2" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (MESON_TAC[]);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN REWRITE_TAC[]);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN REWRITE_TAC[]);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (REFL_TAC);; + +e (EXPAND_TAC "f_temp");; +e (COND_CASES_TAC);; + +e (ASM_CASES_TAC `hl [u; v:real^3] <= h0`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~(?u0 u1. + (V1 u0 /\ V1 u1 /\ ~(u0 = u1) /\ hl [u0; u1] <= h0) /\ + x = {u0, u1:real^3})` THEN REWRITE_TAC[]);; +e (EXISTS_TAC `u:real^3` THEN EXISTS_TAC `v:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (UNDISCH_TAC `{u, v} IN edgeX V x'` THEN REWRITE_TAC[IN; IN_ELIM_THM; edgeX]);; +e (REPEAT STRIP_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (REWRITE_WITH `lmfun (hl [u; v:real^3]) = &0`);; +e (ASM_REWRITE_TAC[lmfun]);; +e (REAL_ARITH_TAC);; +e (REFL_TAC);; + +e (ASM_REWRITE_TAC[]);; + +(* ==================================================================== *) + +e (MATCH_MP_TAC (REAL_ARITH `(?b. a <= b /\ b + d <= e) ==> a + d <= e`));; +e (EXISTS_TAC `(&8 * mm2 / pi) * + sum T2 (\x. sum {X | mcell_set V X /\ x IN edgeX V X} (\X. g X x))`);; +e (STRIP_TAC);; +e (REWRITE_TAC[REAL_ARITH `a * b <= a * c <=> &0 <= a * (c - b)`]);; +e (MATCH_MP_TAC REAL_LE_MUL THEN STRIP_TAC);; +e (MATCH_MP_TAC REAL_LE_MUL THEN STRIP_TAC);; +e (REAL_ARITH_TAC);; +e (MATCH_MP_TAC REAL_LE_DIV THEN SIMP_TAC[ZERO_LE_MM2_LEMMA; PI_POS_LE]);; +e (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]);; +e (MATCH_MP_TAC SUM_LE THEN REPEAT STRIP_TAC);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `T1:(real^3->bool)->bool`);; +e (ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]);; +e (REWRITE_TAC[BETA_THM]);; +e (MATCH_MP_TAC SUM_SUBSET_SIMPLE);; + +e (STRIP_TAC);; +e (REWRITE_TAC[IN] THEN MATCH_MP_TAC Marchal_cells_3.FINITE_EDGE_X2);; +e (UP_ASM_TAC THEN EXPAND_TAC "T2" THEN REWRITE_TAC[IN; IN_ELIM_THM] + THEN STRIP_TAC);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN ASM_REWRITE_TAC[]);; +e (REPEAT STRIP_TAC);; + +e (EXPAND_TAC "S2" THEN REWRITE_TAC[IN] THEN SET_TAC[]);; +e (REWRITE_TAC[BETA_THM]);; +e (REWRITE_WITH `g x' x = gammaY V x' lmfun x`);; +e (EXPAND_TAC "g" THEN REWRITE_TAC[gammaY]);; +e (MATCH_MP_TAC gamma_y_pos_le);; + +e (UP_ASM_TAC THEN ASM_REWRITE_TAC[IN_DIFF; IN; IN_ELIM_THM]);; +e (MESON_TAC[]);; +e (REWRITE_WITH + `sum T2 (\x. sum {X | mcell_set V X /\ x IN edgeX V X} (\X. g X x)) = + sum T2 (\x. &2 * pi * lmfun (radV x))`);; +e (MATCH_MP_TAC SUM_EQ);; +e (REPEAT STRIP_TAC);; +e (REWRITE_TAC[BETA_THM]);; +e (EXPAND_TAC "g");; + +e (REWRITE_TAC[HL; BETA_THM; set_of_list]);; +e (UP_ASM_TAC THEN EXPAND_TAC "T2" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (STRIP_TAC);; + +e (REWRITE_WITH `sum {X | mcell_set V X /\ edgeX V X x} + (\X. (\({u, v}). if edgeX V X {u, v} + then dihX V X (u,v) * lmfun (radV {u, v}) else &0) x) = + sum {X | mcell_set V X /\ edgeX V X x} + (\X. (if edgeX V X {u0, u1} + then dihX V X (u0,u1) * lmfun (radV {u0, u1}) else &0))`);; +e (MATCH_MP_TAC SUM_EQ);; +e (ASM_REWRITE_TAC[IN; IN_ELIM_THM; BETA_THM] THEN REPEAT STRIP_TAC);; +e (ABBREV_TAC + `f_temp = (\u v. if edgeX V x' {u, v} + then dihX V x' (u,v) * lmfun (radV {u, v}) else &0)`);; +e (NEW_GOAL `!u:real^3 v:real^3. + (f_temp:real^3->real^3->real) u v = f_temp v u`);; +e (EXPAND_TAC "f_temp" THEN REWRITE_TAC[BETA_THM]);; +e (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]);; +e (REPEAT GEN_TAC THEN COND_CASES_TAC);; +e (COND_CASES_TAC);; +e (REWRITE_WITH `dihX V x' (u,v) = dihX V x' (v,u)`);; + +e (MATCH_MP_TAC DIHX_SYM);; +e (ASM_REWRITE_TAC[IN; mcell_set; IN_ELIM_THM]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (COND_CASES_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (REFL_TAC);; + +e (REWRITE_WITH + `(\({u, v}). if edgeX V x' {u, v} + then dihX V x' (u,v) * lmfun (radV {u, v}) + else &0) + = (\({u, v}). f_temp u v)`);; +e (EXPAND_TAC "f_temp" THEN REWRITE_TAC[IN]);; +e (REWRITE_WITH + `(if edgeX V x' {u0, u1} + then dihX V x' (u0,u1) * lmfun (radV {u0, u1}) else &0) = + f_temp u0 u1`);; +e (EXPAND_TAC "f_temp" THEN REWRITE_TAC[IN]);; +e (MATCH_MP_TAC BETA_PAIR_THM);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `FINITE {X | mcell_set V X /\ edgeX V X x}`);; +e (MATCH_MP_TAC Marchal_cells_3.FINITE_EDGE_X2);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN ASM_REWRITE_TAC[]);; +e (ASM_SIMP_TAC [SUM_CASES]);; + +e (REWRITE_TAC[SET_RULE + `{X | X IN {X | mcell_set V X /\ edgeX V X {u0, u1}} /\ edgeX V X {u0, u1}} = + {X | mcell_set V X /\ edgeX V X {u0, u1}} /\ + {X | X IN {X | mcell_set V X /\ edgeX V X {u0, u1}} /\ + ~edgeX V X {u0, u1}} = {}`; SUM_CLAUSES; REAL_ARITH `a + &0 = a`]);; +e (REWRITE_TAC[SUM_RMUL]);; +e (REWRITE_WITH + `sum {X | mcell_set V X /\ edgeX V X {u0, u1}} (\X. dihX V X (u0,u1)) = + &2 * pi`);; +e (REWRITE_WITH + `{X | mcell_set V X /\ edgeX V X {u0, u1}} = + {X | mcell_set V X /\ {u0, u1} IN edgeX V X}`);; +e (REWRITE_TAC[IN]);; +e (MATCH_MP_TAC GRUTOTI);; +e (ASM_REWRITE_TAC[]);; +e (REPEAT STRIP_TAC);; +e (ASM_SET_TAC[]);; +e (ASM_SET_TAC[]);; +e (NEW_GOAL `h0 < sqrt (&2)`);; +e (REWRITE_TAC[H0_LT_SQRT2]);; +e (ASM_REAL_ARITH_TAC);; +e (REAL_ARITH_TAC);; +e (REWRITE_TAC[SUM_LMUL; REAL_ARITH `(&8 * mm2 / pi) * &2 * pi * a = + (&8 * mm2) * (pi / pi) * (&2 * a)`]);; +e (REWRITE_WITH `pi / pi = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (REWRITE_TAC[PI_NZ]);; +e (REWRITE_TAC[REAL_ARITH `&1 * a = a`]);; +e (EXPAND_TAC "c");; +e (REWRITE_TAC[REAL_ARITH + `(&8 * mm2) * a + (&8 * mm2 * d) * b <= &8 * mm2 * c <=> + &0 <= (&8 * mm2) * (c - a - d * b)`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (SIMP_TAC[REAL_LE_MUL; REAL_ARITH `&0 <= &8`; ZERO_LE_MM2_LEMMA]);; +e (REWRITE_TAC[REAL_ARITH `&0 <= a - b - c <=> b + c <= a`]);; + +e (EXPAND_TAC "T2");; +e (REWRITE_TAC[Marchal_cells_3.HL_2; + REAL_ARITH `inv (&2) * x <= y <=> x <= &2 * y`]);; +e (REWRITE_WITH `&2 * + sum + {{u0:real^3, u1} | u0 IN V1 /\ u1 IN V1 /\ + ~(u0 = u1) /\ dist (u0,u1) <= &2 * h0} + (\x. lmfun (radV x)) = + sum + {u0:real^3,u1 | u0 IN V1 /\ u1 IN V1 /\ + ~(u0 = u1) /\ dist (u0,u1) <= &2 * h0} + (\(u0,u1). (\x. lmfun (radV x)) {u0, u1})`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC SUM_PAIR_2_SET);; +e (EXPAND_TAC "V1");; +e (ASM_SIMP_TAC [Packing3.KIUMVTC]);; +e (REWRITE_TAC[GSYM Marchal_cells_3.HL_2; HL;set_of_list]);; + +e (ABBREV_TAC + `t = (\u:real^3. {v | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0})`);; +e (ABBREV_TAC `f_temp = (\u v. lmfun (radV {u:real^3, v}))`);; + +e (REWRITE_WITH +`sum V1 + (\u. sum {v | v IN V /\ ~(u = v) /\ dist (u,v:real^3) <= &2 * h0} + (\v. lmfun (radV {u, v}))) = + sum V1 + (\u:real^3. sum + ((t:real^3->real^3->bool) u) ((f_temp:real^3->real^3->real) u))`);; + +e (EXPAND_TAC "f_temp" THEN EXPAND_TAC "t");; +e (REWRITE_TAC[]);; + +e (REWRITE_WITH + `sum V1 (\i. sum (t i) (f_temp i)) = + sum {u0:real^3,u1:real^3 | u0 IN V1 /\ u1 IN t u0} (\(u0,u1). f_temp u0 u1)`);; +e (MATCH_MP_TAC SUM_SUM_PRODUCT);; +e (REPEAT STRIP_TAC);; +e (EXPAND_TAC "V1");; +e (ASM_SIMP_TAC [Packing3.KIUMVTC]);; +e (EXPAND_TAC "t");; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `(V:real^3->bool) INTER ball (vec 0, r + &2 * h0)`);; +e (STRIP_TAC);; +e (ASM_SIMP_TAC [Packing3.KIUMVTC]);; +e (REWRITE_TAC[SUBSET; IN; IN_INTER; IN_BALL; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `dist (vec 0, x) <= dist (vec 0, u0) + dist (u0, x:real^3)`);; +e (NORM_ARITH_TAC);; +e (NEW_GOAL `dist (vec 0, u0:real^3) < r`);; +e (REWRITE_TAC[GSYM IN_BALL]);; +e (UNDISCH_TAC `u0:real^3 IN V1` THEN EXPAND_TAC "V1" THEN SET_TAC[]);; +e (ASM_REAL_ARITH_TAC);; +e (EXPAND_TAC "t" THEN EXPAND_TAC "f_temp");; +e (REWRITE_TAC[IN; IN_ELIM_THM]);; +e (REWRITE_TAC[REAL_ARITH `a + &0 * r pow 2 = a`]);; +e (MATCH_MP_TAC SUM_SUBSET_SIMPLE);; +e (REPEAT STRIP_TAC);; + +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC + `{u0:real^3,u1:real^3 |u0 IN V1 /\u1 IN V INTER ball (vec 0, r + &2 * h0)}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC FINITE_PRODUCT);; +e (STRIP_TAC);; +e (EXPAND_TAC "V1");; +e (ASM_SIMP_TAC [Packing3.KIUMVTC]);; +e (ASM_SIMP_TAC [Packing3.KIUMVTC]);; +e (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[MESON[IN] `(A:real^3->bool) s <=> s IN A`]);; +e (REWRITE_TAC[IN_BALL; IN_INTER; IN]);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `dist (vec 0, u1) <= dist (vec 0, u0) + dist (u0, u1:real^3)`);; +e (NORM_ARITH_TAC);; +e (NEW_GOAL `dist (vec 0, u0:real^3) < r`);; +e (REWRITE_TAC[GSYM IN_BALL]);; +e (UNDISCH_TAC `(V1:real^3->bool) u0` THEN EXPAND_TAC "V1");; +e (REWRITE_TAC[MESON[IN] `(A:real^3->bool) s <=> s IN A`]);; +e (SET_TAC[]);; +e (ASM_REAL_ARITH_TAC);; +e (EXPAND_TAC "V1" THEN + REWRITE_TAC[MESON[IN] `(A:real^3->bool) s <=> s IN A`; IN_INTER] THEN + SET_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[IN_DIFF; IN_ELIM_THM; IN]);; +e (REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[lmfun_pos_le]);; + +e (EXISTS_TAC `&0`);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `F`);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; + +let KIZHLTL4 = top_thm();; diff --git a/legacy/oldpacking/packing/development/Backup/RDWKARC.hl b/legacy/oldpacking/packing/development/Backup/RDWKARC.hl new file mode 100644 index 0000000..e00b131 --- /dev/null +++ b/legacy/oldpacking/packing/development/Backup/RDWKARC.hl @@ -0,0 +1,273 @@ + +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: RDWKARC *) +(* Chaper : Packing (Clusters) *) +(* *) +(* ========================================================================= *) +(* FILES NEED TO BE LOADED *) +(* UPFZBZM.hl *) +(* ========================================================================= *) + +module Rdwkarc = struct + + open Sphere;; + open Pack_defs;; + open Pack_concl;; + open Vukhacky_tactics;; + open Pack1;; + +(*-------------------------------------------------------------------------- *) + +let RDWKARC_concl = +`~kepler_conjecture /\ (!V. cell_cluster_estimate V) /\ TSKAJXY_statement + ==> (?V. packing V /\ V SUBSET ball_annulus /\ ~lmfun_ineq_center V)`;; + + +(* ------------------------------------------------------------------------- *) +(* The following lemmas are necessary for the main theorem RDWKARC *) +(* ------------------------------------------------------------------------- *) + +(* Lemma 1 *) +let JGXZYGW_KY = prove_by_refinement ( + `!S. packing S /\ + saturated S /\ + (?A. fcc_compatible A S /\ negligible_fun_0 A S) + ==> (?c. !r. &1 <= r + ==> vol + (UNIONS {ball (v,&1) | v IN S} INTER ball (vec 0,r)) / + vol (ball (vec 0,r)) <= + pi / sqrt (&18) + c / r)`, +[(MP_TAC JGXZYGW THEN DISCH_THEN (LABEL_TAC "asm1")); + GEN_TAC; + (REWRITE_TAC[negligible_fun_0]); + (USE_THEN "asm1" (MP_TAC o SPEC `S:real^3->bool`)); + (DISCH_THEN (LABEL_TAC "asm2")); + (USE_THEN "asm2" (MP_TAC o SPEC `(vec 0):real^3`)); + (MESON_TAC[])]);; + +(* ------------------------------------------------------------------------- *) +(* Lemma 2 *) +let PACKING_SUBSET = prove_by_refinement ( + `!V S. packing V /\ S SUBSET V ==> packing S`, +[(REPEAT GEN_TAC THEN REWRITE_TAC[packing;SUBSET;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC(ASSUME + `!u:real^3 v. V u /\ V v /\ ~(u = v) ==> &2 <= dist (u,v)`) ); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `V (u:real^3) /\ V v <=> u IN V /\ v IN V`); + (REWRITE_TAC[IN]); + STRIP_TAC; + (* Break into smaller subgoals *) + + (MATCH_MP_TAC(ASSUME `!(x:real^3). x IN S ==> x IN V`) ); + (ASM_REWRITE_TAC[IN]); + (MATCH_MP_TAC(ASSUME `!(x:real^3). x IN S ==> x IN V`) ); + (ASM_REWRITE_TAC[IN])]);; + + +(* ------------------------------------------------------------------------ *) +(* Lemma 3 *) +let PACKING_TRANS = prove_by_refinement ( + `! V (x:real^3). packing V ==> packing {u | (u + x) IN V}`, + +[(REPEAT GEN_TAC THEN REWRITE_TAC[packing;IN_ELIM_THM]); +(REPEAT STRIP_TAC); +(ABBREV_TAC `u' = (u:real^3) + x`); +(ABBREV_TAC `v' = (v:real^3) + x`); + (NEW_GOAL `V (u':real^3) /\ V v' /\ ~(u' = v')`); + (* New subgoal 1 *) + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[GSYM IN]); + (ASM_REWRITE_TAC[GSYM IN]); + (NEW_GOAL `u = v:real^3`); + (REPLICATE_TAC 3 UP_ASM_TAC ); + VECTOR_ARITH_TAC; + (ASM_MESON_TAC[]); + (* End subgoal 1 *) + + (REWRITE_WITH `dist (u:real^3, v) = dist (u', v':real^3)`); + (* Subgoal 2 *) + (EXPAND_TAC "u'" THEN EXPAND_TAC "v'"); + (REWRITE_TAC[dist]); + (NORM_ARITH_TAC); + (* End subgoal 2 *) + +(UP_ASM_TAC THEN ASM_REWRITE_TAC[])]);; + + +(* ------------------------------------------------------------------------- *) +(* Lemma 4 *) + +let SATURATED_TRANS = prove_by_refinement ( +`!V (x:real^3). saturated V ==> saturated {u | u + x IN V}`, + +[(REPEAT GEN_TAC THEN REWRITE_TAC[saturated]); +(DISCH_THEN (LABEL_TAC "asm1")); +(GEN_TAC); +(USE_THEN "asm1" (MP_TAC o SPEC `(x':real^3) + x`)); +(DEL_TAC THEN DISCH_TAC); +(FIRST_X_ASSUM CHOOSE_TAC); +(EXISTS_TAC `y - (x:real^3)`); +(REWRITE_TAC[IN_ELIM_THM; VECTOR_ARITH `y - x + x = (y:real^3)`]); +(ASM_REWRITE_TAC[]); + + (NEW_GOAL `dist (x',y - x) = dist (x'+ x,y:real^3)`); + (* Subgoal 1 *) + (REWRITE_TAC[dist]); + (NORM_ARITH_TAC); + (* End subgoal 1 *) + +(ASM_MESON_TAC[])]);; + + +(* ------------------------------------------------------------------------- *) +(* Lemma 5 *) + +let RADV_TRANS_EQ = prove ( + `!u v:real^3 x. ~(u = v) ==> radV {u, v} = radV {u + x, v + x}`, + REWRITE_TAC[GSYM set_of_list; GSYM HL; HL_2] THEN NORM_ARITH_TAC);; + +(* ========================================================================= *) +(* MAIN THEOREM RDWKARC *) +(* ========================================================================= *) + +let RDWKARC = prove_by_refinement (RDWKARC_concl, +[ (REWRITE_TAC[kepler_conjecture]); + (REWRITE_WITH + `~(!V. packing V /\ saturated V + ==> (?c. !r. &1 <= r + ==> vol + (UNIONS {ball (v,&1) | v IN V} INTER ball (vec 0,r)) / + vol (ball (vec 0,r)) <= + pi / sqrt (&18) + c / r)) <=> + (?V. packing V /\ saturated V + /\ ~(?c. !r. &1 <= r + ==> vol + (UNIONS {ball (v,&1) | v IN V} INTER ball (vec 0,r)) / + vol (ball (vec 0,r)) <= + pi / sqrt (&18) + c / r))`); + + (MESON_TAC[]); + STRIP_TAC; + + (NEW_GOAL `~(lmfun_inequality (V:real^3->bool))`); + STRIP_TAC; + (NEW_GOAL `(?G. negligible_fun_0 G V /\ fcc_compatible G V)`); + (ASM_MESON_TAC[UPFZBZM]); + (NEW_GOAL `(?c. !r. &1 <= r + ==> vol (UNIONS {ball (v,&1) | v IN V} INTER ball (vec 0,r)) / + vol (ball (vec 0,r)) <= + pi / sqrt (&18) + c / r)`); + (MATCH_MP_TAC JGXZYGW_KY); + (ASM_REWRITE_TAC[]); + (CHOOSE_TAC (ASSUME `?G. negligible_fun_0 G V /\ fcc_compatible G V`)); + (EXISTS_TAC `G:real^3->real`); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + +(* ---------------------------------------------------------------------- *) + + (UP_ASM_TAC THEN REWRITE_TAC[lmfun_inequality]); + (REWRITE_WITH + `~(!u:real^3. u IN V + ==> sum {v | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v])) <= + &12) <=> + (?u. u IN V + /\ ~(sum {v | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v])) <= + &12))`); + (MESON_TAC[]); + (REWRITE_TAC[REAL_ARITH `~(a <= b) <=> b < a`]); + (DISCH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + + (ABBREV_TAC `V' = {v:real^3 | v + u IN V}`); + (EXISTS_TAC `V':real^3->bool INTER ball_annulus`); + (ASM_REWRITE_TAC[INTER_SUBSET]); + + (NEW_GOAL `packing (V':real^3->bool)`); + (EXPAND_TAC "V'" THEN ASM_MESON_TAC[PACKING_TRANS]); + STRIP_TAC; + (ASM_MESON_TAC[PACKING_SUBSET;INTER_SUBSET]); + +(* -------------------------------------------------------------------------- *) + + (REWRITE_TAC[lmfun_ineq_center]); + (REWRITE_TAC[REAL_ARITH `~(a <= b) <=> b < a`]); + (EXPAND_TAC "V'" THEN REWRITE_TAC[ball_annulus]); + + (REWRITE_WITH +`sum ({v | v + u IN V} INTER (cball (vec 0,&2 * h0) DIFF ball (vec 0,&2))) + (\v. lmfun (hl [vec 0; v])) = + sum {v:real^3 | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v]))`); + (MATCH_MP_TAC SUM_EQ_GENERAL_INVERSES); + (REWRITE_TAC[IN_ELIM_THM]); + (EXISTS_TAC `(\x:real^3. x + u)`); + (EXISTS_TAC `(\x:real^3. x - u)`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[IN_ELIM_THM;cball;INTER]); + (CONJ_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH `y:real^3 - u + u = y`]); + (REWRITE_TAC[DIFF;IN_ELIM_THM;ball]); + (UP_ASM_TAC THEN REWRITE_TAC[dist]); + (DISCH_TAC THEN CONJ_TAC); + (UP_ASM_TAC THEN NORM_ARITH_TAC); + (REWRITE_WITH `norm (vec 0 - (y:real^3 - u)) = dist (u,y)`); + (REWRITE_TAC[dist]); + (NORM_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `~(a < b) <=> b <= a`]); + (NEW_GOAL `V u /\ V y /\ ~(u = (y:real^3))`); + (ASM_REWRITE_TAC[]); + STRIP_TAC; + (ONCE_REWRITE_TAC[GSYM IN]); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[GSYM IN]); + (ASM_REWRITE_TAC[]); + UP_ASM_TAC; + (ASM_MESON_TAC[packing]); + (REWRITE_TAC[BETA_THM]); + VECTOR_ARITH_TAC; + (REWRITE_TAC[BETA_THM]); + (UP_ASM_TAC THEN REWRITE_TAC[INTER;IN_ELIM_THM]); + (MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_ELIM_THM]); + (REWRITE_TAC[VECTOR_ARITH `(u = x + u:real^3) <=> (x = vec 0)`]); + (UP_ASM_TAC THEN REWRITE_TAC[INTER; DIFF;IN_ELIM_THM;ball]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist(vec 0, x:real^3) = &0`); + (ASM_REWRITE_TAC[dist]); + NORM_ARITH_TAC; + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[BETA_THM;dist]); + (UP_ASM_TAC THEN REWRITE_TAC[INTER; DIFF;IN_ELIM_THM;ball]); + (REWRITE_TAC[IN_ELIM_THM;cball]); + NORM_ARITH_TAC; + (REWRITE_TAC[BETA_THM]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[BETA_THM]); + (AP_TERM_TAC); + (REWRITE_TAC[HL]); + (REWRITE_WITH `!u v:real^3. set_of_list [u; v] = {u , v}`); + (REWRITE_TAC[set_of_list]); + (UP_ASM_TAC THEN REWRITE_TAC[INTER; DIFF;IN_ELIM_THM;ball]); + (REPEAT STRIP_TAC); + (NEW_GOAL `~(x:real^3 = vec 0)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist(vec 0, x:real^3) = &0`); + (ASM_REWRITE_TAC[dist]); + NORM_ARITH_TAC; + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `radV {u:real^3, x + u} = radV {vec 0 + u, x + u}`); + (MESON_TAC[VECTOR_ARITH `!u. u = vec 0 + u`]); + (ASM_MESON_TAC[RADV_TRANS_EQ]); + (ASM_REWRITE_TAC[]) ]);; + + +(* Finish the Lemma *) +end;; diff --git a/legacy/oldpacking/packing/development/Backup/UPFZBZM.hl b/legacy/oldpacking/packing/development/Backup/UPFZBZM.hl new file mode 100644 index 0000000..bd2294e --- /dev/null +++ b/legacy/oldpacking/packing/development/Backup/UPFZBZM.hl @@ -0,0 +1,201 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: UPFZBZM *) +(* Chaper : Packing (Clusters) *) +(* *) +(* ========================================================================= *) + +(* ========================================================================= *) +(* FILES NEED TO BE LOADED *) +(* sum_beta_bump.hl *) +(* sum_gammaX_lmfun_estimate.hl *) +(* ========================================================================= *) + +let UPFZBZM_concl = + `!V. saturated V /\ packing V /\ cell_cluster_estimate V /\ + TSKAJXY_statement /\ + lmfun_inequality V ==> + (?G. negligible_fun_0 G V /\ fcc_compatible G V)`;; + +let FCC_COMPATABILITY_FUNC_concl = + `!V. saturated V /\ packing V /\ cell_cluster_estimate V /\ + TSKAJXY_statement /\ + lmfun_inequality V /\ G = (\u. --vol(voronoi_open V u) + + &8 * mm1 - &8 * mm2 * sum { v | v IN V /\ ~(u=v) /\ dist(u,v) <= &2*h0 } + (\v. lmfun (hl [u;v]))) + ==> fcc_compatible G V`;; + +let NEGLIGIBLE_FUNC_concl = + `!V. saturated V /\ + packing V /\ + cell_cluster_estimate V /\ + TSKAJXY_statement /\ + lmfun_inequality V /\ + G = + (\u. --vol (voronoi_open V u) + + &8 * mm1 - + &8 * + mm2 * + sum {v | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v]))) + ==> negligible_fun_0 G V`;; + +(* ========================================================================= *) +(* THE THEOREM *) +(* ========================================================================= *) + +(* PART 1 OF THE LEMMA *) + +let FCC_COMPATABILITY_FUNC = prove_by_refinement ( + FCC_COMPATABILITY_FUNC_concl, +[(REWRITE_TAC[lmfun_inequality;fcc_compatible]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[Pack2.MEASURE_VORONOI_CLOSED_OPEN]); + (ASM_REWRITE_TAC[REAL_ARITH `a + --a + b - c = b - c`]); + (MATCH_MP_TAC (REAL_ARITH + `x = &8 * mm1 - &8 * (&12 * mm2) /\ y <= &8 * (&12 * mm2) ==> + x <= &8 * mm1 - y`)); + (STRIP_TAC); + (REWRITE_TAC[SQRT_OF_32_lemma]); + (REWRITE_TAC[REAL_ARITH `a * b - a * c = a * (b - c)`]); + (REWRITE_TAC[m1_minus_12m2]); + (MATCH_MP_TAC REAL_LE_LMUL); + (REWRITE_TAC[REAL_ARITH `&0 <= &8`]); + (REWRITE_TAC[REAL_ARITH `&12 * mm2 = mm2 * &12`]); + (MATCH_MP_TAC REAL_LE_LMUL); + (REWRITE_TAC[ZERO_LE_MM2_LEMMA]); + (ASM_MESON_TAC[])]);; + + + +(* ========================================================================= *) +(* PART 2 OF THE LEMMA *) +(* ========================================================================= *) + +let NEGLIGIBLE_FUNC = prove_by_refinement ( + NEGLIGIBLE_FUNC_concl, +[(REWRITE_TAC[negligible_fun_0; negligible_fun_any_C]); + (REPEAT STRIP_TAC); + + (MP_TAC (SPEC `V:real^3->bool` KIZHLTL1)); + (STRIP_TAC); + (MP_TAC (SPEC `V:real^3->bool` KIZHLTL2)); + (STRIP_TAC); + (MP_TAC (SPEC `V:real^3->bool` KIZHLTL4)); + (STRIP_TAC); + + (MP_TAC (SPEC `V:real^3->bool` SUM_GAMMAX_LMFUN_ESTIMATE)); + (STRIP_TAC); + + (NEW_GOAL + `!r. saturated V /\ packing V /\ &1 <= r + ==> c''' * r pow 2 <= + sum {X | X SUBSET ball (vec 0,r) /\ mcell_set V X} + (\X. gammaX V X lmfun)`); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[gammaX] THEN STRIP_TAC); + + (EXISTS_TAC `--c''' - c - c' - c''`); + (REPEAT STRIP_TAC); + + (ABBREV_TAC `f1 = (\u:real^3. --vol (voronoi_open V u))`); + (ABBREV_TAC `f2 = (\u:real^3. &8 * mm1 - &8 * mm2 * + sum {v | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v])))`); + (REWRITE_WITH `sum ((V:real^3->bool) INTER ball (vec 0,r)) G = + sum (V INTER ball (vec 0,r)) f1 + + sum (V INTER ball (vec 0,r)) f2`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "f1" THEN EXPAND_TAC "f2"); + (MATCH_MP_TAC SUM_ADD); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (ABBREV_TAC `f3 = (\u:real^3. &8 * mm1)`); + (ABBREV_TAC `f4 = (\u:real^3. &8 * mm2 * + sum {v | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v])))`); + (REWRITE_WITH `sum ((V:real^3->bool) INTER ball (vec 0,r)) f2 = + sum (V INTER ball (vec 0,r)) f3 - + sum (V INTER ball (vec 0,r)) f4`); + (EXPAND_TAC "f2" THEN EXPAND_TAC "f3" THEN EXPAND_TAC "f4"); + (MATCH_MP_TAC SUM_SUB); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (EXPAND_TAC "f4" THEN DEL_TAC THEN + ASM_SIMP_TAC[SUM_NEG;SUM_CONST;SUM_LMUL;FINITE_PACK_LEMMA]); + (ABBREV_TAC `f5 = (\u:real^3. + sum {v | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v])))`); + (ABBREV_TAC `B = {X | X SUBSET ball (vec 0, r) /\ mcell_set V X}`); + (ABBREV_TAC `T1 = sum B vol`); + (ABBREV_TAC `T2 = --(&2 * mm1 / pi) * sum B (total_solid V)`); + (ABBREV_TAC `T3 = (&8 * mm2 / pi) * sum B (\X. sum (edgeX V X) + (\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0))`); + + (NEW_GOAL `sum (V:real^3->bool INTER ball (vec 0,r)) f1 <= --T1 - c * r pow 2`); + (EXPAND_TAC "T1" THEN EXPAND_TAC "B"); + (EXPAND_TAC "f1"); + (REWRITE_TAC[SUM_NEG; REAL_ARITH `-- a <= --b - c <=> b + c <= a`]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL + `sum (V:real^3->bool INTER ball (vec 0,r)) f3 <= --T2 - c' * r pow 2`); + (EXPAND_TAC "T2" THEN EXPAND_TAC "B"); + (EXPAND_TAC "f3"); + (REWRITE_TAC[SUM_NEG; REAL_ARITH `a <= --(-- b * d) - c<=> a + c <= b * d`]); + (REWRITE_WITH `sum (V INTER ball (vec 0,r)) (\u:real^3. &8 * mm1) = + &(CARD (V INTER ball (vec 0,r))) * (&8 * mm1)`); + (MATCH_MP_TAC SUM_CONST); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `T3 + c'' * r pow 2 <= + &8 * mm2 * sum (V:real^3->bool INTER ball (vec 0,r)) f5`); + (EXPAND_TAC "T3" THEN EXPAND_TAC "B"); + + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC (REAL_ARITH `(?s. A <= s /\ s <= b) ==> A <= b`)); + (EXISTS_TAC `--T1 + --T2 + --T3 - (c + c' + c'') * r pow 2`); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH + `--T1 + --T2 + --T3 - (c + c' + c'') * r pow 2 <= + (--c''' - c - c' - c'') * r pow 2 + <=> c''' * r pow 2 <= T1 + T2 + T3`]); + (REWRITE_WITH `T1 + T2 + T3 = + sum {X | X SUBSET ball (vec 0,r) /\ mcell_set V X} + (\X. gammaX V X lmfun)`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[gammaX]); + (NEW_GOAL `FINITE (B:(real^3->bool)->bool)`); + (EXPAND_TAC "B"); + (ASM_SIMP_TAC [FINITE_MCELL_SET_LEMMA]); + (ASM_SIMP_TAC[SUM_ADD; SUM_SUB; SUM_LMUL; ETA_AX]); + (EXPAND_TAC "T2"); + (REAL_ARITH_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[])]);; + + +(* ========================================================================= *) +(* Main theorm *) +(* ========================================================================= *) + +let UPFZBZM = prove (UPFZBZM_concl, + (REPEAT STRIP_TAC) THEN (ABBREV_TAC `G = (\u. --vol (voronoi_open V u) + + &8 * mm1 - + &8 * + mm2 * + sum {v:real^3 | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v])))`) THEN + (EXISTS_TAC `G:real^3->real`) THEN + (ASM_MESON_TAC[NEGLIGIBLE_FUNC;FCC_COMPATABILITY_FUNC]));; + + diff --git a/legacy/oldpacking/packing/development/Backup/load_sequence.hl b/legacy/oldpacking/packing/development/Backup/load_sequence.hl new file mode 100644 index 0000000..734a1d0 --- /dev/null +++ b/legacy/oldpacking/packing/development/Backup/load_sequence.hl @@ -0,0 +1,93 @@ + +(* ==== Loaded files from Vu Khac Ky - 22 Mar 2012 ========================= *) + +#use "/usr/programs/hollight/hollight-114/hol.ml";; +loads "Multivariate/flyspeck.ml";; +#use "/home/vu/flyspeck/working/boot.hl";; (* hol_version 2734 *) +flyspeck_needs "trigonometry/trig1.hl";; +flyspeck_needs "trigonometry/trig2.hl";; +flyspeck_needs "trigonometry/euler_main_theorem.hl";; +flyspeck_needs "leg/muR_def.hl";; +flyspeck_needs "leg/enclosed_def.hl";; +flyspeck_needs "trigonometry/trigonometry.hl";; +flyspeck_needs "leg/collect_geom.hl";; +flyspeck_needs "fan/fan_defs.hl";; +flyspeck_needs "fan/introduction.hl";; +flyspeck_needs "fan/topology.hl";; +flyspeck_needs "fan/fan_misc.hl";; +flyspeck_needs "fan/HypermapAndFan.hl";; +flyspeck_needs "packing/pack_defs.hl";; +flyspeck_needs "packing/pack_concl.hl";; +flyspeck_needs "packing/pack1.hl";; +flyspeck_needs "packing/pack2.hl";; +flyspeck_needs "packing/pack3.hl";; +flyspeck_needs "packing/Rogers.hl";; +flyspeck_needs "nonlinear/vukhacky_tactics.hl";; +flyspeck_needs "packing/marchal_cells.hl";; +flyspeck_needs "packing/EMNWUUS.hl";; +flyspeck_needs "packing/marchal_cells_2.hl";; +flyspeck_needs "packing/marchal_cells_2_new.hl";; +flyspeck_needs "packing/URRPHBZ1.hl";; +flyspeck_needs "packing/LEPJBDJ.hl";; +flyspeck_needs "packing/HDTFNFZ.hl";; +flyspeck_needs "packing/RVFXZBU.hl";; +flyspeck_needs "packing/SLTSTLO.hl";; +flyspeck_needs "packing/URRPHBZ2.hl";; +flyspeck_needs "packing/URRPHBZ3.hl";; +flyspeck_needs "packing/YNHYJIT.hl";; +flyspeck_needs "packing/NJIUTIU.hl";; +flyspeck_needs "packing/TEZFFSK.hl";; +flyspeck_needs "packing/QZKSYKG.hl";; +flyspeck_needs "packing/DDZUPHJ.hl";; +flyspeck_needs "packing/AJRIPQN.hl";; +flyspeck_needs "jordan/parse_ext_override_interface.hl";; +flyspeck_needs "jordan/real_ext.hl";; +flyspeck_needs "packing/QZYZMJC.hl";; +flyspeck_needs "packing/UPFZBZM_support_lemmas.hl";; +flyspeck_needs "packing/marchal_cells_3.hl";; +flyspeck_needs "packing/GRUTOTI.hl";; + +(* ================ Currently added - 14 May 2012 ================== *) + +flyspeck_needs "packing/sum_beta_bump.hl";; +flyspeck_needs "packing/KIZHLTL.hl.hl";; +flyspeck_needs "packing/sum_gammaX_lmfun_estimate.hl";; +flyspeck_needs "packing/UPFZBZM.hl";; +flyspeck_needs "packing/RDWKARC.hl";; + + +open Sphere;; +open Euler_main_theorem;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Pack2;; +open Packing3;; +open Rogers;; +open Vukhacky_tactics;; +open Marchal_cells;; +open Emnwuus;; +open Marchal_cells_2;; +open Marchal_cells_2_new;; +open Urrphbz1;; +open Lepjbdj;; +open Hdtfnfz;; +open Rvfxzbu;; +open Sltstlo;; +open Urrphbz2;; +open Urrphbz3;; +open Ynhyjit;; +open Njiutiu;; +open Tezffsk;; +open Qzksykg;; +open Ddzuphj;; +open Ajripqn;; +open Qzyzmjc;; +open Upfzbzm_support_lemmas;; +open Marchal_cells_3;; +open Grutoti;; +open Sum_beta_bump;; + +loads "/home/vu/flyspeck/working/KIZHLTL.hl";; + + diff --git a/legacy/oldpacking/packing/development/Backup/marchal_cells_3.hl b/legacy/oldpacking/packing/development/Backup/marchal_cells_3.hl new file mode 100644 index 0000000..800479d --- /dev/null +++ b/legacy/oldpacking/packing/development/Backup/marchal_cells_3.hl @@ -0,0 +1,7366 @@ + +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: *) +(* Chaper : Packing (Marchal Cells 3) *) +(* *) +(* ========================================================================= *) + +open Sphere;; +open Euler_main_theorem;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Pack2;; +open Packing3;; +open Rogers;; +open Vukhacky_tactics;; +open Marchal_cells;; +open Emnwuus;; +open Marchal_cells_2;; +open Marchal_cells_2_new;; +open Urrphbz1;; +open Lepjbdj;; +open Hdtfnfz;; +open Rvfxzbu;; +open Sltstlo;; +open Urrphbz2;; +open Urrphbz3;; +open Ynhyjit;; +open Njiutiu;; +open Tezffsk;; +open Qzksykg;; +open Ddzuphj;; +open Ajripqn;; +open Qzyzmjc;; +open Upfzbzm_support_lemmas;; + + +let TAKE_TAC = UP_ASM_TAC THEN REPEAT STRIP_TAC;; +(* ==================================================================== *) +(* Lemma 1 *) + +let HD_IN_ROGERS = prove ( + `!V ul. saturated V /\ packing V /\ barV V 3 ul ==> HD ul IN rogers V ul`, +REPEAT STRIP_TAC THEN +ASM_SIMP_TAC[ROGERS_EXPLICIT] THEN +MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET THEN SET_TAC[]);; + +(* ==================================================================== *) +(* Lemma 2 *) + +let ROGERS_SUBSET_VORONOI_CLOSED = prove_by_refinement ( + `!V ul. saturated V /\ packing V /\ barV V 3 ul ==> + rogers V ul SUBSET voronoi_closed V (HD ul)`, +[(REPEAT STRIP_TAC); + (ASM_SIMP_TAC[ROGERS_EXPLICIT]); + (NEW_GOAL `voronoi_closed V (HD ul) = + convex hull (voronoi_closed V ((HD ul):real^3))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[CONVEX_HULL_EQ]); + (REWRITE_TAC[Packing3.CONVEX_VORONOI_CLOSED]); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (REWRITE_TAC[GSYM OMEGA_LIST_N]); + (REWRITE_WITH `voronoi_closed V (omega_list_n V ul 0) = + voronoi_list V (truncate_simplex 0 ul)`); + (ASM_REWRITE_TAC[OMEGA_LIST_N; TRUNCATE_SIMPLEX_EXPLICIT_0; VORONOI_LIST; + VORONOI_SET; set_of_list; HD] THEN SET_TAC[]); + + (NEW_GOAL `omega_list_n V ul 0 IN + voronoi_list V (truncate_simplex 0 ul)`); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (NEW_GOAL `omega_list_n V ul 1 IN + voronoi_list V (truncate_simplex 0 ul)`); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (NEW_GOAL `omega_list_n V ul 2 IN + voronoi_list V (truncate_simplex 0 ul)`); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (NEW_GOAL `omega_list_n V ul 3 IN + voronoi_list V (truncate_simplex 0 ul)`); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (ASM_SET_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 3 *) + +let HD_IN_MCELL = prove_by_refinement ( + `!V ul i r X . + packing V /\ + saturated V /\ + barV V 3 ul /\ + X = mcell i V ul /\ + ~(X = {}) /\ ~(i = 0) + ==> (HD ul IN X)`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ASM_REWRITE_TAC[HD]); + (ASM_CASES_TAC `i = 1`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell1]); + (COND_CASES_TAC); + (ASM_SIMP_TAC[IN_DIFF;IN_INTER; HD; TL; IN_CBALL; DIST_REFL; + TRUNCATE_SIMPLEX_EXPLICIT_1; rcone_gt; rconesgn]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `u0 = HD ul /\ [u0; u1; u2; u3:real^3] = ul`); + (ASM_REWRITE_TAC[HD]); + (MATCH_MP_TAC HD_IN_ROGERS); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SQRT_POS_LE); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[IN; IN_ELIM_THM; VECTOR_ARITH + `(u0 - u0) dot (u1 - u0) = &0`; DIST_REFL]); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `X:real^3->bool = {}`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`; ASSUME `i = 1`; MCELL_EXPLICIT; mcell1]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REFL_TAC); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `i = 2`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2]); + (COND_CASES_TAC); + (LET_TAC); + (ASM_SIMP_TAC[IN_INTER; HD; TL; DIST_REFL; + TRUNCATE_SIMPLEX_EXPLICIT_1; rcone_ge; rconesgn; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[VECTOR_ARITH `(u0 - u0) dot (u1 - u0) = &0`]); + (REAL_ARITH_TAC); + (REWRITE_TAC[GSYM NORM_POW_2; GSYM dist; REAL_POW_2]); + (REWRITE_TAC[REAL_ARITH `a * a >= a * a * b <=> &0 <= a * a * (&1 - b)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (ABBREV_TAC `s = hl (truncate_simplex 1 [u0; u1; u2; u3:real^3])`); + (EXPAND_TAC "a"); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (REWRITE_WITH `s / sqrt (&2) <= &1 <=> s <= &1 * sqrt (&2)`); + (MATCH_MP_TAC REAL_LE_LDIV_EQ); + (MATCH_MP_TAC SQRT_POS_LT THEN REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (REWRITE_WITH `[u0; u1; u2; u3:real^3] = ul`); + (ASM_REWRITE_TAC[]); + (ABBREV_TAC `m = mxi V ul`); + (ABBREV_TAC `s3 = omega_list_n V ul 3`); + (REWRITE_WITH `aff_ge {u0, u1:real^3} {m, s3} u0 <=> + u0 IN aff_ge {u0, u1} {m, s3}`); + (REWRITE_TAC[IN]); + (NEW_GOAL `u0 IN convex hull {u0,u1,m,s3:real^3}`); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (SET_TAC[]); + (NEW_GOAL `convex hull {u0,u1,m,s3:real^3} SUBSET aff_ge {u0, u1} {m, s3}`); + (REWRITE_TAC[Marchal_cells_2_new.CONVEX_HULL_4_SUBSET_AFF_GE_2_2]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (NEW_GOAL `F`); + (NEW_GOAL `X:real^3->bool = {}`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`; ASSUME `i = 2`; MCELL_EXPLICIT; mcell2]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REFL_TAC); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `i = 3`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell3]); + (COND_CASES_TAC); + (REWRITE_TAC[set_of_list;TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (SET_TAC[]); + (NEW_GOAL `F`); + (NEW_GOAL `X:real^3->bool = {}`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`; ASSUME `i = 3`; MCELL_EXPLICIT; mcell3]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REFL_TAC); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `i >= 4`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4]); + (COND_CASES_TAC); + (REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (SET_TAC[]); + (NEW_GOAL `F`); + (NEW_GOAL `X:real^3->bool = {}`); + (SIMP_TAC[ASSUME `X = mcell i V ul`; ASSUME `i >= 4`; MCELL_EXPLICIT; mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REFL_TAC); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[])]);; + + +(* ==================================================================== *) +(* Lemma 4 *) + +let FINITE_MCELL_SET_lemma1 = prove_by_refinement ( + `!V ul i r X . + packing V /\ + saturated V /\ + barV V 3 ul /\ + X = mcell i V ul /\ + X SUBSET ball (vec 0, r) /\ + ~(X = {}) + ==> (!u. u IN set_of_list ul ==> u IN ball (vec 0, r + &6))`, +[(REPEAT STRIP_TAC); + +(* Case i = 0 *) + (ASM_CASES_TAC `i = 0`); + (UNDISCH_TAC `X = mcell i V ul`THEN ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell0]); + (STRIP_TAC); + (NEW_GOAL `!s. s IN rogers V ul ==> dist (HD ul, s) < &2`); + (REPEAT STRIP_TAC); + (NEW_GOAL `rogers V ul SUBSET voronoi_closed V (HD ul)`); + (ASM_SIMP_TAC[ROGERS_SUBSET_VORONOI_CLOSED]); + (NEW_GOAL `s:real^3 IN voronoi_closed V (HD ul)`); + (ASM_SET_TAC[]); + (UNDISCH_TAC `saturated (V:real^3->bool)`); + (REWRITE_TAC[saturated]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?y. y IN V /\ dist (s, y:real^3) < &2`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (UNDISCH_TAC `s:real^3 IN voronoi_closed V (HD ul)` THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (s,HD ul) <= dist (s,y:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REAL_ARITH_TAC); + (NEW_GOAL `?s. s:real^3 IN X`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `dist (HD ul, s:real^3) < &2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + + (NEW_GOAL `set_of_list (ul:(real^3)list) SUBSET ball (HD ul,&4)`); + (MATCH_MP_TAC BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.HD_IN_SET_OF_LIST); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (NEW_GOAL `u:real^3 IN ball (HD ul, &4)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL]); + (STRIP_TAC); + (NEW_GOAL `dist (vec 0,u) <= dist (vec 0, s) + dist (s, u:real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (s, u) <= dist (s, HD ul) + dist (HD ul, u:real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (vec 0,u) <= + dist (vec 0,s) + dist (s,HD ul) + dist (HD ul,u:real^3)`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `dist (s:real^3, HD ul) < &2`); + (ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `dist (vec 0,s:real^3) < r`); + (REWRITE_TAC[GSYM IN_BALL]); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC); + +(* Case i != 0 *) + + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `(HD ul):real^3 IN X`); + (MATCH_MP_TAC HD_IN_MCELL); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(HD ul):real^3 IN ball (vec 0, r)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL] THEN STRIP_TAC); + (NEW_GOAL `dist (vec 0,u) <= dist (vec 0,HD ul) + dist (HD ul, u:real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `set_of_list (ul:(real^3)list) SUBSET ball (HD ul,&4)`); + (MATCH_MP_TAC BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[HD; set_of_list]); + (SET_TAC[]); + (NEW_GOAL `u:real^3 IN ball (HD ul, &4)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL]); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC)]);; + + +(* ==================================================================== *) +(* Lemma 5 *) + +let FINITE_MCELL_SET_LEMMA_concl = + `!V r. packing V /\ saturated V ==> + FINITE {X | X SUBSET ball (vec 0,r) /\ mcell_set V X}`;; +let FINITE_MCELL_SET_LEMMA = prove_by_refinement ( + FINITE_MCELL_SET_LEMMA_concl, + +[(REPEAT STRIP_TAC); + (REWRITE_WITH `FINITE {X | X SUBSET ball (vec 0,r) /\ mcell_set V X} <=> + FINITE {X | X SUBSET ball (vec 0,r) /\ mcell_set V X /\ ~(X = {})}`); + (ASM_CASES_TAC `{} IN {X | X SUBSET ball (vec 0,r) /\ mcell_set V X}`); + (REWRITE_WITH `{X | X SUBSET ball (vec 0,r) /\ mcell_set V X} = + {} INSERT {X | X SUBSET ball (vec 0,r) /\ mcell_set V X /\ ~(X = {})}`); + (ONCE_REWRITE_TAC[SET_RULE `A = B <=> B SUBSET A /\ A SUBSET B`]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[INSERT_SUBSET]); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + (REWRITE_TAC[SUBSET_INSERT_DELETE]); + (ONCE_REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN_DELETE] THEN REWRITE_TAC[IN_ELIM_THM]); + (SET_TAC[]); + (REWRITE_TAC[FINITE_INSERT]); + (REWRITE_WITH `{X | X SUBSET ball (vec 0,r) /\ mcell_set V X} = + {X | X SUBSET ball (vec 0,r) /\ mcell_set V X /\ ~(X = {})}`); + (ONCE_REWRITE_TAC[SET_RULE `A = B <=> B SUBSET A /\ A SUBSET B`]); + (REPEAT STRIP_TAC); + (SET_TAC[]); + (ONCE_REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] + THEN REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `{} IN {X | X SUBSET ball (vec 0,r) /\ mcell_set V X}`); + (ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (ABBREV_TAC + `S = {X | X SUBSET ball (vec 0,r) /\ mcell_set V X /\ ~(X = {})}`); + (ABBREV_TAC `s1:(real^3->bool) = V INTER ball (vec 0, r + &6)`); + (ABBREV_TAC `s2 = {ul:(real^3)list | ?u0 u1 u2 u3. + u0 IN s1 /\ + u1 IN s1 /\ + u2 IN s1 /\ + u3 IN s1 /\ + ul = [u0; u1; u2; u3]}`); + (ABBREV_TAC `s3 = {(i:num, ul:(real^3)list) | i IN 0..4 /\ ul IN s2}`); + (NEW_GOAL`S SUBSET {X| ?t. t IN s3 /\ X = (\t. mcell (FST t) V (SND t)) t}`); + (EXPAND_TAC "S" THEN EXPAND_TAC "s3"); + (ONCE_REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN + REWRITE_TAC[IN_ELIM_THM; FST; SND; mcell_set]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `((if i <= 4 then i else 4), ul:(real^3)list)`); + (ASM_REWRITE_TAC[FST;SND]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `(if i <= 4 then i else 4)` THEN EXISTS_TAC `ul:(real^3)list`); + (REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[IN_NUMSEG_0]); + (ASM_REWRITE_TAC[IN_NUMSEG_0] THEN ARITH_TAC); + (EXPAND_TAC "s2"); + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC THEN ONCE_REWRITE_TAC[IN]); + (REWRITE_TAC[IN_ELIM_THM]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `!u:real^3. u IN set_of_list ul ==> u IN s1`); + (EXPAND_TAC "s1" THEN REPEAT STRIP_TAC); + (REWRITE_TAC[IN_INTER]); + (STRIP_TAC); + (NEW_GOAL `set_of_list ul SUBSET (V:real^3->bool)`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_MESON_TAC[IN]); + (ASM_SET_TAC[]); + (NEW_GOAL `!u:real^3. u IN set_of_list ul ==> u IN ball (vec 0,r + &6)`); + (MATCH_MP_TAC FINITE_MCELL_SET_lemma1); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `i:num` THEN + EXISTS_TAC `x:real^3->bool`); + (ASM_MESON_TAC[IN]); + (ASM_SIMP_TAC[]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `i >= 4`); + (ASM_ARITH_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (MATCH_MP_TAC FINITE_SUBSET); + + (EXISTS_TAC `{X | ?t. t IN s3 /\ X = (\t. mcell (FST t) V (SND t)) t}`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (EXPAND_TAC "s3"); + (MATCH_MP_TAC FINITE_PRODUCT); + (REWRITE_TAC[FINITE_NUMSEG]); + (EXPAND_TAC "s2"); + (MATCH_MP_TAC FINITE_SET_LIST_LEMMA); + (EXPAND_TAC "s1"); + (MATCH_MP_TAC Packing3.KIUMVTC); + (ASM_REWRITE_TAC[])]);; + + + +(* ==================================================================== *) +(* Lemma 6 *) + +let CARD_BOUNDARY_INT_BALL_BOUND_1 = prove_by_refinement ( + `!x k1 k2. &0 < k1 /\ &0 < k2 ==> + (?C. !r. &1 <= r ==> + &(CARD (int_ball x (r + k1) DIFF int_ball x (r - k2))) <= C * r pow 2)`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `?C. !r. k2 + sqrt (&3) <= r + ==> &(CARD + (int_ball x (r + k1) DIFF int_ball x (r - k2))) <= + C * r pow 2`); + (MATCH_MP_TAC Vol1.bdt5_finiteness); + (ASM_REWRITE_TAC[]); + (TAKE_TAC); + (ABBREV_TAC `D = &(CARD (int_ball x ((k2 + sqrt (&3)) + k1)))`); + (EXISTS_TAC `max C D`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `k2 + sqrt (&3) <= r`); + (NEW_GOAL + `&(CARD (int_ball x (r + k1) DIFF int_ball x (r - k2))) <= C * r pow 2`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `C * r pow 2 <= max C D * r pow 2`); + (REWRITE_TAC[REAL_ARITH `a * b <= c * b <=> &0 <= (c - a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_LE_POW_2]); + (REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `&(CARD (int_ball x (r + k1) DIFF int_ball x (r - k2))) <= + &(CARD (int_ball x (r + k1)))`); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[Vol1.finite_int_ball]); + + (NEW_GOAL `&(CARD (int_ball x (r + k1))) <= D * r pow 2`); + (NEW_GOAL `&(CARD (int_ball x (r + k1))) <= D`); + (EXPAND_TAC "D"); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (REWRITE_TAC[Vol1.finite_int_ball; int_ball; Pack1.hinhcau_ball; SUBSET; + IN_INTER; IN_BALL]); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[]); + (NEW_GOAL `r + k1 <= (k2 + sqrt (&3)) + k1`); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `D <= D * r pow 2`); + (REWRITE_TAC[REAL_ARITH `a <= a * b <=> &0 <= a * (b - &1)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (EXPAND_TAC "D" THEN REWRITE_TAC[REAL_OF_NUM_LE; LE_0]); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (ONCE_REWRITE_TAC[REAL_ARITH `&1 = (&1) pow 2`]); + (REWRITE_WITH `(&1) pow 2 <= r pow 2 <=> &1 <= r`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Collect_geom.POW2_COND_LT); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `D * r pow 2 <= max C D * r pow 2`); + (REWRITE_TAC[REAL_ARITH `a * b <= c * b <=> &0 <= (c - a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_LE_POW_2]); + (REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 7 *) +(* The following is a simplified version of Vol1.bdt5_finiteness, Vol1.bdt7_finiteness *) + +let CARD_BOUNDARY_INT_BALL_BOUND = prove_by_refinement ( + `!x k1 k2. + (?C. !r. &1 <= r ==> + &(CARD (int_ball x (r + k1) DIFF int_ball x (r - k2))) <= C * r pow 2)`, +[(REPEAT STRIP_TAC); + (ASM_CASES_TAC `&0 < k1 /\ &0 < k2`); + (ASM_MESON_TAC[CARD_BOUNDARY_INT_BALL_BOUND_1]); + (ASM_CASES_TAC `&0 < k2`); + (NEW_GOAL + `(?C. !r. &1 <= r ==> + &(CARD (int_ball x (r + &1) DIFF int_ball x (r - k2))) <= C * r pow 2)`); + (MATCH_MP_TAC CARD_BOUNDARY_INT_BALL_BOUND_1); + (ASM_REAL_ARITH_TAC); + (TAKE_TAC); + (EXISTS_TAC `C:real`); + (REPEAT STRIP_TAC); + (NEW_GOAL `&(CARD (int_ball x (r + k1) DIFF int_ball x (r - k2))) <= + &(CARD (int_ball x (r + &1) DIFF int_ball x (r - k2)))`); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (SIMP_TAC[FINITE_DIFF; Vol1.finite_int_ball]); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> A DIFF C SUBSET B DIFF C`)); + (REWRITE_TAC[int_ball; Pack1.hinhcau_ball; SUBSET; IN_INTER; IN_BALL]); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[]); + (NEW_GOAL `r + k1 <= r + &1`); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `&(CARD (int_ball x (r + &1) DIFF int_ball x (r - k2))) <= + C * r pow 2`); + (ASM_SIMP_TAC[]); + (ASM_REAL_ARITH_TAC); + + (ASM_CASES_TAC `&0 < k1`); + (NEW_GOAL + `(?C. !r. &1 <= r ==> + &(CARD (int_ball x (r + k1) DIFF int_ball x (r - &1))) <= C * r pow 2)`); + (MATCH_MP_TAC CARD_BOUNDARY_INT_BALL_BOUND_1); + (ASM_REAL_ARITH_TAC); + (TAKE_TAC); + (EXISTS_TAC `C:real`); + (REPEAT STRIP_TAC); + (NEW_GOAL `&(CARD (int_ball x (r + k1) DIFF int_ball x (r - k2))) <= + &(CARD (int_ball x (r + k1) DIFF int_ball x (r - &1)))`); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (SIMP_TAC[FINITE_DIFF; Vol1.finite_int_ball]); + (MATCH_MP_TAC (SET_RULE `B SUBSET A ==> C DIFF A SUBSET C DIFF B`)); + (REWRITE_TAC[int_ball; Pack1.hinhcau_ball; SUBSET; IN_INTER; IN_BALL]); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[]); + (NEW_GOAL `r - &1 <= r - k2`); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `&(CARD (int_ball x (r + k1) DIFF int_ball x (r - &1))) <= + C * r pow 2`); + (ASM_SIMP_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL + `(?C. !r. &1 <= r ==> + &(CARD (int_ball x (r + &1) DIFF int_ball x (r - &1))) <= C * r pow 2)`); + (MATCH_MP_TAC CARD_BOUNDARY_INT_BALL_BOUND_1); + (ASM_REAL_ARITH_TAC); + (TAKE_TAC); + (EXISTS_TAC `C:real`); + (REPEAT STRIP_TAC); + (NEW_GOAL `&(CARD (int_ball x (r + k1) DIFF int_ball x (r - k2))) <= + &(CARD (int_ball x (r + &1) DIFF int_ball x (r - &1)))`); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (SIMP_TAC[FINITE_DIFF; Vol1.finite_int_ball]); + (REWRITE_TAC[IN_DIFF; int_ball; Pack1.hinhcau_ball; SUBSET; IN_INTER; IN_BALL]); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `(!i. 1 <= i /\i <= 3 ==>integer (x'$i)) /\ + dist (x:real^3,x') < r - k2`); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + (NEW_GOAL `&(CARD (int_ball x (r + &1) DIFF int_ball x (r - &1))) <= + C * r pow 2`); + (ASM_SIMP_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 8 *) + +let CARD_INJ_LE = prove_by_refinement ( + `!s t f. FINITE s /\ FINITE t /\ INJ (f:A->B) s t ==> + CARD s <= CARD t`, +[(REWRITE_TAC[INJ] THEN REPEAT STRIP_TAC); + (REWRITE_WITH `CARD s = CARD (IMAGE (f:A->B) s)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC CARD_IMAGE_INJ); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC CARD_SUBSET); + (ASM_REWRITE_TAC[IMAGE; SUBSET]); + (UNDISCH_TAC `!x. x IN s ==> (f:A->B) x IN t`); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (SET_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 9 *) + +let BOUNDARY_VOLUME = prove_by_refinement ( + `!p:real^3 k1 k2. + ?C. (!r. &1 <= r ==> + vol (ball (p:real^3,r + k1) DIFF ball (p,r - k2)) <= C * r pow 2)`, +[(REPEAT STRIP_TAC); + + (ABBREV_TAC + `C = &4 / &3 * pi * (&3 * abs (k1 + k2) + &3 * k1 pow 2 + abs (k1 pow 3 + k2 pow 3))`); + (ABBREV_TAC `D = vol (ball (p:real^3, abs (k1 + k2)))`); + (ABBREV_TAC `E = max C (D:real)`); + (EXISTS_TAC `max (E:real) (&0)`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `r + k1 <= r - k2`); + (REWRITE_WITH `ball (p,r + k1) DIFF ball (p:real^3,r - k2) = {}`); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> A DIFF B = {}`)); + (REWRITE_TAC[SUBSET; IN_BALL] THEN REPEAT STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[MEASURE_EMPTY]); + (NEW_GOAL `&0 * r pow 2 <= max E (&0) * r pow 2`); + (REWRITE_TAC[REAL_ARITH `a * x <= b * x <=> &0 <= (b - a) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[REAL_LE_POW_2] THEN REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (REWRITE_WITH `vol (ball (p,r + k1) DIFF ball (p,r - k2)) = + vol (ball (p,r + k1)) - vol (ball (p,r - k2))`); + (MATCH_MP_TAC MEASURE_DIFF_SUBSET); + (REWRITE_TAC[MEASURABLE_BALL; SUBSET; IN_BALL] THEN ASM_REAL_ARITH_TAC); + (REWRITE_TAC[VOLUME_BALL]); + (ASM_CASES_TAC `&0 <= r - k2`); + (NEW_GOAL `&0 <= r + k1`); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `vol (ball (p,r + k1)) - vol (ball (p,r - k2)) <= C * r pow 2`); + (ASM_SIMP_TAC [VOLUME_BALL]); + (EXPAND_TAC "C"); + (REWRITE_TAC[REAL_ARITH + `x * pi * a - x * pi * b <= (x * pi * c) * d <=> + &0 <= (x * pi) * (c * d - (a - b))`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[REAL_LE_MUL; REAL_LE_DIV; PI_POS_LE; REAL_ARITH `&0 <= &3 /\ &0 <= &4`]); + (REWRITE_TAC[REAL_ARITH `(r + k1) pow 3 - (r - k2) pow 3 = &3 * (k1 + k2) * + r pow 2 + &3 * (k1 pow 2 - k2 pow 2) * r + (k1 pow 3 + k2 pow 3)`]); + (REWRITE_TAC[REAL_ADD_RDISTRIB]); + (NEW_GOAL `(&3 * abs (k1 + k2)) * r pow 2 >= + &3 * (k1 * r pow 2 + k2 * r pow 2)`); + (REWRITE_TAC[REAL_ARITH + `(&3 * abs (k1 + k2)) * r pow 2 >= &3 * (k1 * r pow 2 + k2 * r pow 2) <=> + &0 <= &3 * r pow 2 * (abs (k1 + k2) - (k1 + k2))`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_ARITH `&0 <= &3`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_LE_POW_2]); + (REAL_ARITH_TAC); + + (NEW_GOAL `(&3 * k1 pow 2) * r pow 2 >= &3 * (k1 pow 2 - k2 pow 2) * r`); + (NEW_GOAL `(&3 * k1 pow 2) * r pow 2 >= (&3 * k1 pow 2) * r`); + (REWRITE_TAC[REAL_ARITH `x * y pow 2 >= x * y <=> &0 <= x * y * (y - &1)`]); + (ASM_SIMP_TAC[REAL_LE_MUL; REAL_LE_POW_2; REAL_ARITH `&1 <= a ==> &0 <= a`; + REAL_ARITH `&1 <= a ==> &0 <= (a - &1)`; REAL_ARITH `&0 <= &3`]); + (NEW_GOAL `(&3 * k1 pow 2) * r >= &3 * (k1 pow 2 - k2 pow 2) * r`); + (REWRITE_TAC[REAL_ARITH `(&3 * x) * r >= &3 * (x - y) * r <=> &0 <= y * r`]); + (ASM_SIMP_TAC[REAL_LE_MUL; REAL_LE_POW_2; REAL_ARITH `&1 <= a ==> &0 <= a`]); + (ASM_REAL_ARITH_TAC); + + + (NEW_GOAL `abs (k1 pow 3 + k2 pow 3) * r pow 2 >= k1 pow 3 + k2 pow 3`); + (NEW_GOAL `abs (k1 pow 3 + k2 pow 3) * r pow 2 >= + abs (k1 pow 3 + k2 pow 3)`); + (REWRITE_TAC[REAL_ARITH `x * y pow 2 >= x <=> &0 <= x * (y pow 2 - &1)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_ABS_POS]); + (REWRITE_TAC[REAL_ARITH `&0 <= a - &1 <=> &1 pow 2 <= a`]); + (REWRITE_WITH `&1 pow 2 <= r pow 2 <=> &1 <= r`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.POW2_COND_LT); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + + (NEW_GOAL `C * r pow 2 <= max E (&0) * r pow 2`); + (REWRITE_TAC[REAL_ARITH `a * x <= b * x <=> &0 <= (b - a) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[REAL_LE_POW_2] THEN ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `r < k2`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `vol (ball (p,r + k1)) - vol (ball (p,r - k2)) <= D * r pow 2`); + (REWRITE_WITH `ball (p:real^3,r - k2) = {}`); + (REWRITE_TAC[SET_RULE `s = {} <=> (!x. x IN s ==> F)`]); + (REWRITE_TAC[IN_BALL] THEN GEN_TAC); + (MP_TAC (MESON[DIST_POS_LE] `&0 <= dist (p, x:real^3)`)); + (ASM_REAL_ARITH_TAC); + + (REWRITE_TAC[MEASURE_EMPTY; REAL_ARITH `a - &0 = a`]); + (NEW_GOAL `vol (ball (p,r + k1)) <= D`); + (EXPAND_TAC "D" THEN MATCH_MP_TAC MEASURE_SUBSET); + (REWRITE_TAC[MEASURABLE_BALL; SUBSET; IN_BALL]); + (REPEAT STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `D <= D * r pow 2`); + (REWRITE_TAC[REAL_ARITH `x <= x * y pow 2 <=> &0 <= x * (y pow 2 - &1)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (EXPAND_TAC "D"); + (STRIP_TAC); + (MATCH_MP_TAC MEASURE_POS_LE); + (REWRITE_TAC[MEASURABLE_BALL]); + (REWRITE_TAC[REAL_ARITH `&0 <= a - &1 <=> &1 pow 2 <= a`]); + (REWRITE_WITH `&1 pow 2 <= r pow 2 <=> &1 <= r`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.POW2_COND_LT); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `D * r pow 2 <= max E (&0) * r pow 2`); + (REWRITE_TAC[REAL_ARITH `a * x <= b * x <=> &0 <= (b - a) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[REAL_LE_POW_2] THEN ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 10 *) + +let PACKING_BALL_BOUNDARY = prove_by_refinement ( + `!V p:real^3 k1 k2. packing V ==> + ?C. !r. &1 <= r + ==> &(CARD (V INTER ball (p,r + k1) DIFF V INTER ball (p,r - k2))) + <= C * r pow 2`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `?C. (!r. &1 <= r ==> + vol (ball (p:real^3,r + k1 + &1) DIFF ball (p,r - (k2 + &1))) <= + C * r pow 2)`); + (REWRITE_TAC[BOUNDARY_VOLUME]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `C:real`); + (REPEAT STRIP_TAC); + (ABBREV_TAC + `B = V INTER ball (p,r + k1) DIFF V INTER ball (p:real^3,r - k2)`); + (ABBREV_TAC `f = (\u:real^3. ball (u, &1))`); + (NEW_GOAL `FINITE (B:real^3->bool)`); + (EXPAND_TAC "B"); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `V INTER ball (p:real^3,r + k1)`); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA] THEN ASM_SET_TAC[]); + + (NEW_GOAL `sum B (\u:real^3. vol (f u)) = &(CARD B) * &4 / &3 * pi`); + (EXPAND_TAC "f"); + (SIMP_TAC[VOLUME_BALL; REAL_ARITH `&0 <= &1`]); + (ASM_SIMP_TAC [SUM_CONST]); + (REAL_ARITH_TAC); + + (NEW_GOAL `sum B (\u:real^3. vol (f u)) = vol (UNIONS (IMAGE f B))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC MEASURE_DISJOINT_UNIONS_IMAGE); + (EXPAND_TAC "f" THEN REWRITE_TAC[MEASURABLE_BALL] THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `DISJOINT s t <=> !x. ~(x IN s /\ x IN t)`]); + (REWRITE_TAC[IN_BALL]); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN STRIP_TAC); + (NEW_GOAL `dist (u, y) <= dist (u, x) + dist (x, y:real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `&2 <= dist (u, y:real^3)`); + (UNDISCH_TAC `packing V` THEN REWRITE_TAC[packing] THEN STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `vol (UNIONS (IMAGE f (B:real^3->bool))) <= + vol (ball (p,r + k1 + &1) DIFF ball (p,r - (k2 + &1)))`); + (EXPAND_TAC "f" THEN REWRITE_TAC[IMAGE]); + (MATCH_MP_TAC MEASURE_SUBSET); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC MEASURABLE_UNIONS); + (STRIP_TAC); + + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[MEASURABLE_BALL]); + + (ASM_SIMP_TAC[MEASURABLE_DIFF; MEASURABLE_BALL]); + (EXPAND_TAC "B"); + (REWRITE_TAC[SUBSET; IN_UNIONS; IN_BALL; IN_DIFF; IN_INTER]); + (REWRITE_TAC[IN_ELIM_THM; IN]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (p, x) <= dist (p, x') + dist (x', x:real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (x',x:real^3) < &1`); + (UNDISCH_TAC `(t:real^3->bool) x`); + (ASM_REWRITE_TAC[ball; IN_ELIM_THM]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `dist (p, x':real^3) < r - k2`); + (NEW_GOAL `dist (p, x') <= dist (p, x) + dist (x, x':real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (x,x':real^3) < &1`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (UNDISCH_TAC `(t:real^3->bool) x`); + (ASM_REWRITE_TAC[ball; IN_ELIM_THM]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `&(CARD (B:real^3->bool)) <= &(CARD B) * &4 / &3 * pi`); + (REWRITE_TAC [REAL_ARITH `a <= a * b <=> &0 <= a * (b - &1)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_OF_NUM_LE; LE_0]); + (NEW_GOAL `#3.14159 < pi`); + (REWRITE_TAC[Flyspeck_constants.bounds]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `vol (ball (p:real^3,r + k1 + &1) DIFF ball (p,r - (k2 + &1))) <= + C * r pow 2`); + (ASM_SIMP_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 11 *) + +let MCELL_SUBSET_BALL_4 = prove_by_refinement ( + `!V X . + packing V /\ + saturated V /\ mcell_set V X + ==> (?p. X SUBSET ball (p, &4))`, +[(REWRITE_TAC[mcell_set_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `X:real^3->bool = {}`); + (EXISTS_TAC `(vec 0):real^3`); + (ASM_MESON_TAC[EMPTY_SUBSET]); + +(* Case i = 0 *) + (ASM_CASES_TAC `i = 0`); + (UNDISCH_TAC `X = mcell i V ul`THEN ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell0]); + (STRIP_TAC); + (NEW_GOAL `!s. s IN rogers V ul ==> dist (HD ul, s) < &2`); + (REPEAT STRIP_TAC); + (NEW_GOAL `rogers V ul SUBSET voronoi_closed V (HD ul)`); + (ASM_SIMP_TAC[ROGERS_SUBSET_VORONOI_CLOSED]); + (NEW_GOAL `s:real^3 IN voronoi_closed V (HD ul)`); + (ASM_SET_TAC[]); + (UNDISCH_TAC `saturated (V:real^3->bool)`); + (REWRITE_TAC[saturated]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?y. y IN V /\ dist (s, y:real^3) < &2`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (UNDISCH_TAC `s:real^3 IN voronoi_closed V (HD ul)` THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (s,HD ul) <= dist (s,y:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REAL_ARITH_TAC); + (EXISTS_TAC `HD (ul:(real^3)list)`); + (REWRITE_TAC[SUBSET; IN_BALL]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (HD ul, x:real^3) < &2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC); + +(* Case i = 4 *) + (ASM_CASES_TAC `i = 4`); + (UNDISCH_TAC `X = mcell i V ul` THEN + ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4; ARITH_RULE `4 >= 4`]); + (COND_CASES_TAC); + (STRIP_TAC); + (EXISTS_TAC `omega_list V ul`); + (NEW_GOAL `ball (omega_list V ul,&4) = convex hull (ball (omega_list V ul,&4))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN REWRITE_TAC[CONVEX_HULL_EQ; CONVEX_BALL]); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC CONVEX_HULL_SUBSET); + (REWRITE_TAC[SUBSET; IN_BALL] THEN REPEAT STRIP_TAC); + (REWRITE_WITH `omega_list V ul = circumcenter (set_of_list ul)`); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[IN]); + (REWRITE_WITH `dist (circumcenter (set_of_list ul),x:real^3) = hl ul`); + (NEW_GOAL `(!x:real^3. x IN set_of_list ul + ==> dist (circumcenter (set_of_list ul),x) = hl ul)`); + (MATCH_MP_TAC Rogers.HL_PROPERTIES); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `sqrt (&2) <= &2`); + (REWRITE_WITH `sqrt (&2) <= &2 <=> sqrt (&2) pow 2 <= &2 pow 2`); + (MATCH_MP_TAC Collect_geom.POW2_COND_LT); + (ASM_SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]); + (REWRITE_WITH `sqrt (&2) pow 2 = (&2)`); + (MATCH_MP_TAC SQRT_POW_2); + (REAL_ARITH_TAC); + (REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (STRIP_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + +(* Case i = 1 and i = 2 and i = 3 *) + + (ABBREV_TAC `s = omega_list_n V ul (i - 1)`); + (EXISTS_TAC `s:real^3`); + (MATCH_MP_TAC (SET_RULE `(?x. A SUBSET x /\ x SUBSET B) ==> A SUBSET B`)); + (EXISTS_TAC `UNIONS + {rogers V (left_action_list p ul) | p permutes 0..i - 1}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Qzksykg.QZKSYKG2); + (ASM_REWRITE_TAC[SET_RULE `i IN {0,1,2,3,4} <=> i=0\/i=1\/i=2\/i=3\/i=4`]); + (ASM_ARITH_TAC); + (REWRITE_TAC[SUBSET; IN_UNIONS; IN; IN_ELIM_THM; IN_BALL]); + (REPEAT STRIP_TAC); + (ABBREV_TAC `vl:(real^3)list = left_action_list p ul`); + (NEW_GOAL `rogers V vl SUBSET voronoi_closed V (HD vl)`); + (MATCH_MP_TAC ROGERS_SUBSET_VORONOI_CLOSED); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Qzksykg.QZKSYKG1); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_REWRITE_TAC[SET_RULE `i IN {0,1,2,3,4} <=> i=0\/i=1\/i=2\/i=3\/i=4`]); + (ASM_ARITH_TAC); + (ASM_SET_TAC[]); + +(* -------------------------------------------------------------------------- *) + + (NEW_GOAL `barV V 3 vl /\ + (!j. i - 1 <= j /\ j <= 3 + ==> omega_list_n V vl j = omega_list_n V ul j)`); + (ASM_CASES_TAC `i <= 1`); + (UNDISCH_TAC `p permutes 0..i - 1`); + (REWRITE_WITH `i - 1 = 0`); + (ASM_ARITH_TAC); + (REWRITE_TAC[Packing3.PERMUTES_TRIVIAL]); + (STRIP_TAC THEN EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `p = I:num->num`; + Packing3.LEFT_ACTION_LIST_I]); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC Ynhyjit.YNHYJIT); + (EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (REWRITE_TAC[SET_RULE `i IN {2,3,4} <=> i = 2 \/ i = 3 \/ i = 4`]); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~(X = {}:real^3->bool)` THEN ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `i = 2`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2; ARITH_RULE `2 - 1 = 1`]); + (COND_CASES_TAC); + (MESON_TAC[]); + (MESON_TAC[]); + (ASM_CASES_TAC `i = 3`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell3; ARITH_RULE `3 - 1 = 2`]); + (COND_CASES_TAC); + (MESON_TAC[]); + (MESON_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `s IN voronoi_list V (truncate_simplex (i - 1) vl)`); + (REWRITE_WITH `s = omega_list_n V vl (i - 1)`); + (EXPAND_TAC "s"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_ARITH_TAC); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_IN_VORONOI_LIST); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[] THEN ASM_ARITH_TAC); + + (NEW_GOAL `s:real^3 IN voronoi_closed V (HD vl)`); + (NEW_GOAL `voronoi_list V (truncate_simplex (i - 1) vl) SUBSET + voronoi_closed V (HD vl)`); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET]); + (NEW_GOAL `HD (vl:(real^3)list) IN + set_of_list (truncate_simplex (i - 1) vl)`); + (NEW_GOAL `LENGTH (vl:(real^3)list) = 3 + 1 /\ CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (REWRITE_WITH `HD (vl:(real^3)list) = HD (truncate_simplex (i - 1) vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_ARITH_TAC); + (MATCH_MP_TAC Packing3.HD_IN_SET_OF_LIST); + (NEW_GOAL `?u0 u1 u2 u3. vl = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ASM_CASES_TAC `i = 1`); + (ASM_REWRITE_TAC[ARITH_RULE `1 - 1 = 0`; + TRUNCATE_SIMPLEX_EXPLICIT_0; LENGTH] THEN ARITH_TAC); + (ASM_CASES_TAC `i = 2`); + (ASM_REWRITE_TAC[ARITH_RULE `2 - 1 = 1`; + TRUNCATE_SIMPLEX_EXPLICIT_1; LENGTH] THEN ARITH_TAC); + (ASM_CASES_TAC `i = 3`); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; + TRUNCATE_SIMPLEX_EXPLICIT_2; LENGTH] THEN ARITH_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_SET_TAC[]); + + (NEW_GOAL `dist (s, x:real^3) <= dist (s, HD vl) + dist (HD vl, x)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (s:real^3, HD vl) < &2`); + (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[GSYM IN_BALL]); + (NEW_GOAL `voronoi_closed V ((HD vl):real^3) SUBSET ball (HD vl,&2)`); + (ASM_SIMP_TAC[Packing3.VORONOI_BALL2]); + (ASM_SET_TAC[]); + + (NEW_GOAL `dist (HD vl, x:real^3) < &2`); + (REWRITE_TAC[GSYM IN_BALL]); + (NEW_GOAL `voronoi_closed V ((HD vl):real^3) SUBSET ball (HD vl,&2)`); + (ASM_SIMP_TAC[Packing3.VORONOI_BALL2]); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 12 *) + +let HL_2 = prove_by_refinement ( + `!u v:real^3. hl [u; v] = inv (&2) * dist (u, v)`, +[(REWRITE_TAC[HL; set_of_list; radV] THEN REPEAT GEN_TAC THEN + MATCH_MP_TAC SELECT_UNIQUE THEN REPEAT STRIP_TAC THEN + REWRITE_TAC[BETA_THM; CIRCUMCENTER_2; midpoint] THEN EQ_TAC); + (REPEAT STRIP_TAC); + (REWRITE_WITH `y = dist (inv (&2) % (u + v),v:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[MESON [IN] `{a, b} s <=> s IN {a, b}`] THEN SET_TAC[]); + (NORM_ARITH_TAC); + (REPEAT STRIP_TAC); + (NEW_GOAL `w = u \/ w = v:real^3`); + (UP_ASM_TAC THEN REWRITE_TAC[MESON [IN] `{a, b} s <=> s IN {a, b}`] THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[] THEN NORM_ARITH_TAC); + (ASM_REWRITE_TAC[] THEN NORM_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 13 *) + +let HL_LE_SQRT2_IMP_BARV_1 = prove_by_refinement ( + `!V u0 u1. + saturated V /\ + packing V /\ + u0 IN V /\ + u1 IN V /\ + ~(u0 = u1) /\ + hl [u0;u1] < sqrt (&2) ==> barV V 1 [u0;u1:real^3]`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[BARV; LENGTH; ARITH_RULE `SUC (SUC 0) = 1 + 1`]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `LENGTH (vl:(real^3)list) = 1`); + (NEW_GOAL `initial_sublist vl [u0; u1:real^3] /\ LENGTH vl = 0 + 1`); + (ASM_REWRITE_TAC[] THEN ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_WITH + `initial_sublist vl [u0; u1:real^3] /\ LENGTH vl = 0 + 1 <=> + truncate_simplex 0 [u0;u1] = vl /\ 0 + 1 <= LENGTH [u0;u1:real^3]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_0]); + (REWRITE_TAC[VORONOI_NONDG; VORONOI_LIST; VORONOI_SET; set_of_list; LENGTH; + SET_RULE `INTERS {voronoi_closed V v | v IN {u0}} = voronoi_closed V u0`]); + (ASM_SIMP_TAC[Packing3.AFF_DIM_VORONOI_CLOSED]); + (REPEAT STRIP_TAC); + (ARITH_TAC); + (ASM_SET_TAC[]); + (ARITH_TAC); + + (ASM_CASES_TAC `LENGTH (vl:(real^3)list) = 2`); + (NEW_GOAL `initial_sublist vl [u0; u1:real^3] /\ LENGTH vl = 1 + 1`); + (ASM_REWRITE_TAC[] THEN ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_WITH + `initial_sublist vl [u0; u1:real^3] /\ LENGTH vl = 1 + 1 <=> + truncate_simplex 1 [u0;u1] = vl /\ 1 + 1 <= LENGTH [u0;u1:real^3]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_TAC[VORONOI_NONDG]); + (REWRITE_TAC[set_of_list; LENGTH]); + (REPEAT STRIP_TAC); + (ARITH_TAC); + (ASM_SET_TAC[]); + + (REWRITE_WITH + `aff_dim (voronoi_list V [u0; u1:real^3]) = + aff_dim (INTERS {bis (HD [u0; u1]) v | v | v IN set_of_list [u0; u1]})`); + (MATCH_MP_TAC Rogers.YIFVQDV_lemma_aff_dim); + (ASM_REWRITE_TAC[set_of_list; AFFINE_INDEPENDENT_2] THEN ASM_SET_TAC[]); + (REWRITE_TAC[set_of_list; SET_RULE `a IN {b,c} <=> a =b \/ a = c`; HD]); + (REWRITE_TAC[SET_RULE `INTERS {bis u0 v | v | v = u0 \/ v = u1} = + bis u0 u0 INTER bis u0 u1`]); + (REWRITE_WITH `!a:real^3. bis a a = (:real^3)`); + (REWRITE_TAC[bis] THEN SET_TAC[]); + (REWRITE_TAC[SET_RULE `(:real^3) INTER s = s`]); + (MATCH_MP_TAC (ARITH_RULE `a = &2 ==> a + &(SUC(SUC 0)) = (&4):int`)); + (REWRITE_WITH `&2 = &(dimindex (:3)) - &1:int`); + (REWRITE_TAC[DIMINDEX_3]); + (ARITH_TAC); + (REWRITE_TAC[Packing3.BIS_EQ_HYPERPLANE]); + (MATCH_MP_TAC AFF_DIM_HYPERPLANE); + (ASM_NORM_ARITH_TAC); + + (NEW_GOAL `F`); + (NEW_GOAL `initial_sublist vl [u0; u1:real^3] /\ + LENGTH vl = (LENGTH vl - 1) + 1`); + (ASM_REWRITE_TAC[] THEN ASM_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_WITH + `initial_sublist vl [u0; u1:real^3] /\ LENGTH vl = (LENGTH vl - 1) + 1 <=> + truncate_simplex (LENGTH vl - 1) [u0;u1] = vl /\ + (LENGTH vl - 1) + 1 <= LENGTH [u0;u1:real^3]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[LENGTH]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 14 *) + +let RCONE_GE_SUBSET = prove_by_refinement ( + `!a b u0:real^N u1. a <= b ==> rcone_ge u0 u1 b SUBSET rcone_ge u0 u1 a`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[rcone_ge; rconesgn; SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL +`&0 <= dist (x,u0:real^N) * dist (u1,u0) * b - dist (x,u0) * dist (u1,u0) * a`); + (REWRITE_TAC[REAL_ARITH `x * y * b - x * y * a = x * y * (b - a)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 15 *) + +let RCONE_GT_SUBSET = prove_by_refinement ( + `!a b u0:real^N u1. a <= b ==> rcone_gt u0 u1 b SUBSET rcone_gt u0 u1 a`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[rcone_gt; rconesgn; SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL +`&0 <= dist (x,u0:real^N) * dist (u1,u0) * b - dist (x,u0) * dist (u1,u0) * a`); + (REWRITE_TAC[REAL_ARITH `x * y * b - x * y * a = x * y * (b - a)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC)]);; + +(* ===================================================================== *) +(* The following lemmas are in the svn 126 of HOL *) +(* To be done by John Harrison *) +(* ===================================================================== *) +(* ==================================================================== *) +(* Lemma 16 *) + +let BOUNDED_SING = prove + (`!a. bounded {a}`, + REWRITE_TAC[BOUNDED_INSERT; BOUNDED_EMPTY]);; + +let SUBSPACE_BOUNDED_EQ_TRIVIAL = prove + (`!s:real^N->bool. subspace s ==> (bounded s <=> s = {vec 0})`, + REPEAT STRIP_TAC THEN EQ_TAC THEN SIMP_TAC[BOUNDED_SING] THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + DISCH_THEN(MP_TAC o MATCH_MP (SET_RULE + `~(s = {a}) ==> a IN s ==> ?b. b IN s /\ ~(b = a)`)) THEN + ASM_SIMP_TAC[SUBSPACE_0] THEN + DISCH_THEN(X_CHOOSE_THEN `v:real^N` STRIP_ASSUME_TAC) THEN + REWRITE_TAC[bounded; NOT_EXISTS_THM] THEN X_GEN_TAC `B:real` THEN + DISCH_THEN(MP_TAC o SPEC `(B + &1) / norm v % v:real^N`) THEN + ASM_SIMP_TAC[SUBSPACE_MUL; NORM_MUL; REAL_ABS_DIV; REAL_ABS_NORM] THEN + ASM_SIMP_TAC[REAL_DIV_RMUL; NORM_EQ_0] THEN REAL_ARITH_TAC);; + + let AFFINE_BOUNDED_EQ_TRIVIAL = prove + (`!s:real^N->bool. + affine s ==> (bounded s <=> s = {} \/ ?a. s = {a})`, + GEN_TAC THEN ASM_CASES_TAC `s:real^N->bool = {}` THEN + ASM_REWRITE_TAC[BOUNDED_EMPTY] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [GSYM MEMBER_NOT_EMPTY]) THEN + DISCH_THEN(X_CHOOSE_THEN `b:real^N` MP_TAC) THEN + GEOM_ORIGIN_TAC `b:real^N` THEN SIMP_TAC[AFFINE_EQ_SUBSPACE] THEN + REPEAT STRIP_TAC THEN ASM_SIMP_TAC[SUBSPACE_BOUNDED_EQ_TRIVIAL] THEN + FIRST_ASSUM(MP_TAC o MATCH_MP SUBSPACE_0) THEN SET_TAC[]);; + + let AFFINE_BOUNDED_EQ_LOWDIM = prove + (`!s:real^N->bool. + affine s ==> (bounded s <=> aff_dim s <= &0)`, + SIMP_TAC[AFF_DIM_GE; INT_ARITH + `--(&1):int <= x ==> (x <= &0 <=> x = --(&1) \/ x = &0)`] THEN + SIMP_TAC[AFF_DIM_EQ_0; AFF_DIM_EQ_MINUS1; AFFINE_BOUNDED_EQ_TRIVIAL]);; + + let BOUNDED_HYPERPLANE_EQ_TRIVIAL = prove + (`!a b. bounded {x:real^N | a dot x = b} <=> + if a = vec 0 then ~(b = &0) else dimindex(:N) = 1`, + REPEAT GEN_TAC THEN ASM_CASES_TAC `a:real^N = vec 0` THEN + ASM_REWRITE_TAC[DOT_LZERO] THENL + [ASM_CASES_TAC `b = &0` THEN + ASM_REWRITE_TAC[EMPTY_GSPEC; BOUNDED_EMPTY] THEN + REWRITE_TAC[NOT_BOUNDED_UNIV; SET_RULE `{x | T} = UNIV`]; + ASM_SIMP_TAC[AFFINE_BOUNDED_EQ_LOWDIM; AFF_DIM_HYPERPLANE; + AFFINE_HYPERPLANE] THEN + REWRITE_TAC[INT_ARITH `a - &1:int <= &0 <=> a <= &1`; INT_OF_NUM_LE] THEN + MATCH_MP_TAC(ARITH_RULE `1 <= n ==> (n <= 1 <=> n = 1)`) THEN + REWRITE_TAC[DIMINDEX_GE_1]]);; + + let UNBOUNDED_HYPERPLANE = prove + (`!a b. ~(a = vec 0) ==> ~(bounded {x:real^3 | a dot x = b})`, + SIMP_TAC[BOUNDED_HYPERPLANE_EQ_TRIVIAL; DIMINDEX_3; ARITH]);; + +(* ==================================================================== *) +(* Lemma 17 *) + +let DIHV_SYM_2 = prove + (`!x y z t:real^3. dihV x y z t = dihV x y t z`, + REWRITE_TAC[dihV] THEN + REPEAT STRIP_TAC THEN REPEAT LET_TAC THEN + ASM_REWRITE_TAC[arcV; DOT_SYM; REAL_ARITH `a * b = b * a`]);; + +(* ==================================================================== *) +(* Lemma 18 *) + +let REAL_DIV_LE_1_TACTICS = prove_by_refinement ( + `!m n. &0 < n /\ m <= n ==> m / n <= &1`, +[(REPEAT STRIP_TAC); + (REWRITE_WITH `m / n <= &1 <=> m <= &1 * n`); + (MATCH_MP_TAC REAL_LE_LDIV_EQ); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 19 *) + +let REAL_DIV_GE_1_TACTICS = prove_by_refinement ( + `!m n. &0 < n /\ n <= m ==> &1 <= m / n`, +[(REPEAT STRIP_TAC); + (REWRITE_WITH `&1 <= m / n <=> &1 * n <= m`); + (MATCH_MP_TAC REAL_LE_RDIV_EQ); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 20 *) + +let REAL_DIV_LT_1_TACTICS = prove_by_refinement ( + `!m n. &0 < n /\ m < n ==> m / n < &1`, +[(REPEAT STRIP_TAC); + (REWRITE_WITH `m / n < &1 <=> m < &1 * n`); + (MATCH_MP_TAC REAL_LT_LDIV_EQ); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 21 *) + +let REAL_DIV_GT_1_TACTICS = prove_by_refinement ( + `!m n. &0 < n /\ n < m ==> &1 < m / n`, +[(REPEAT STRIP_TAC); + (REWRITE_WITH `&1 < m / n <=> &1 * n < m`); + (MATCH_MP_TAC REAL_LT_RDIV_EQ); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + + +(* ==================================================================== *) +(* The following lemmas help to prove that the *) +(* definition of dihX is well-defined *) +(* ==================================================================== *) +(* ==================================================================== *) +(* Lemma 22 *) + +let MCELL_ID_OMEGA_LIST_N = prove_by_refinement ( + `!V i j ul vl. packing V /\ saturated V /\ barV V 3 ul /\ barV V 3 vl /\ + (mcell i V ul = mcell j V vl) /\ + ~(negligible (mcell i V ul)) /\ + i IN {2, 3, 4} /\ + j IN {2, 3, 4} ==> + (i = j) /\ (!k. i - 1 <= k /\ k <= 3 + ==> omega_list_n V ul k = omega_list_n V vl k)`, +[(REPEAT GEN_TAC THEN STRIP_TAC); + (NEW_GOAL `i = j /\ mcell i V ul = mcell j V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[SET_RULE `a INTER a = a` ]); + (STRIP_TAC); + (ASM_SET_TAC[]); + (STRIP_TAC); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `i = 4`); + (REPEAT STRIP_TAC); + (NEW_GOAL `k = 3`); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `omega_list_n V ul 3 = omega_list V ul`); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `(3 + 1) - 1 = 3`]); + + (REWRITE_WITH `omega_list_n V vl 3 = omega_list V vl`); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `(3 + 1) - 1 = 3`]); + + (REWRITE_WITH `omega_list V ul = circumcenter (set_of_list ul)`); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[IN]); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (SIMP_TAC[ASSUME `i = 4`; MCELL_EXPLICIT; ARITH_RULE `4 >= 4`;mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (REWRITE_WITH `omega_list V vl = circumcenter (set_of_list vl)`); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[IN]); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `j = 4`); + (ASM_ARITH_TAC); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`;mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (AP_TERM_TAC); + + (REWRITE_WITH `set_of_list ul = set_of_list (vl:(real^3)list) <=> + convex hull (set_of_list ul) = convex hull (set_of_list vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ); + (STRIP_TAC); + + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list] THEN STRIP_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (REWRITE_TAC[ASSUME `i = 4`]); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`;mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (MATCH_MP_TAC COPLANAR_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `?u0 u1 u2 u3. vl = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list] THEN STRIP_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (REWRITE_TAC[ASSUME `mcell i V ul = mcell j V vl`]); + (REWRITE_WITH `j = 4`); + (ASM_ARITH_TAC); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`;mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (MATCH_MP_TAC COPLANAR_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (MP_TAC (ASSUME `mcell i V ul = mcell j V vl`)); + (REWRITE_WITH `j = 4 /\ i = 4`); + (ASM_ARITH_TAC); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`;mcell4]); + (COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_TAC[]); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `j = 4 /\ i = 4`); + (ASM_ARITH_TAC); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`;mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (REWRITE_WITH `j = 4 /\ i = 4`); + (ASM_ARITH_TAC); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`;mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (ASM_MESON_TAC[]); + +(* Finish the case i = 4 *) +(* ========================================================================= *) + (NEW_GOAL `mcell i V ul SUBSET + UNIONS {rogers V (left_action_list p ul) | p permutes 0..i - 1}`); + (MATCH_MP_TAC Qzksykg.QZKSYKG2); + (ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]); + + (ABBREV_TAC `X = mcell i V ul`); + (NEW_GOAL `X INTER + UNIONS {rogers V (left_action_list p ul) | p permutes 0..i - 1} = X`); + (ASM_SET_TAC[]); + (NEW_GOAL `~negligible (X INTER + UNIONS {rogers V (left_action_list p ul) | p permutes 0..i - 1})`); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[INTER_UNIONS]); + (NEW_GOAL `!s:(real^3->bool)->bool. + ~negligible (UNIONS s) /\ FINITE s ==> (?t. t IN s /\ ~negligible t)`); + (MESON_TAC[NEGLIGIBLE_UNIONS]); + (REWRITE_TAC[SET_RULE + `{X INTER x | x IN {rogers V (left_action_list p ul) | p permutes 0..i - 1}} = + {X INTER rogers V (left_action_list p ul) | p permutes 0..i - 1}`]); + (ABBREV_TAC + `S = {X INTER rogers V (left_action_list p ul) | p permutes 0..i - 1}`); + (STRIP_TAC); + + (NEW_GOAL `(?t. t IN (S:(real^3->bool)->bool) /\ ~negligible t)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "S"); + (ABBREV_TAC `f = (\p. X INTER rogers V (left_action_list p ul))`); + (REWRITE_WITH + `{X INTER rogers V (left_action_list p ul) | p permutes 0..i - 1} = + {f p | p permutes 0..i-1}`); + (EXPAND_TAC "f" THEN REFL_TAC); + (ONCE_REWRITE_TAC[SET_RULE `{f x | P x} = {f x | x IN {x | P x}}`]); + + (REWRITE_TAC[SET_RULE `{f p | p IN {x | x permutes 0..i - 1} } = + {y | ?p. p IN {x | x permutes 0..i - 1} /\ y = f p}`]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (MATCH_MP_TAC FINITE_PERMUTATIONS); + (REWRITE_TAC[FINITE_NUMSEG]); + (UP_ASM_TAC THEN EXPAND_TAC "S" THEN REWRITE_TAC[IN; IN_ELIM_THM] + THEN STRIP_TAC); + + + + (NEW_GOAL `mcell j V vl SUBSET + UNIONS {rogers V (left_action_list q vl) | q permutes 0..j - 1}`); + (MATCH_MP_TAC Qzksykg.QZKSYKG2); + (ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]); + (NEW_GOAL `t SUBSET + UNIONS {rogers V (left_action_list q vl) | q permutes 0..j - 1}`); + (ASM_SET_TAC[]); + (NEW_GOAL `t INTER + UNIONS {rogers V (left_action_list q vl) | q permutes 0..j - 1} = t`); + (ASM_SET_TAC[]); + (NEW_GOAL `~negligible (t INTER + UNIONS {rogers V (left_action_list q vl) | q permutes 0..j - 1})`); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[INTER_UNIONS]); + (REWRITE_TAC[SET_RULE + `{t INTER x | x IN {rogers V (left_action_list q vl) | q permutes 0..j - 1}} = + {t INTER rogers V (left_action_list q vl) | q permutes 0..j - 1}`]); + + (NEW_GOAL `!s:(real^3->bool)->bool. + ~negligible (UNIONS s) /\ FINITE s ==> (?t. t IN s /\ ~negligible t)`); + (MESON_TAC[NEGLIGIBLE_UNIONS]); + (ABBREV_TAC + `R = {t INTER rogers V (left_action_list q vl) | q permutes 0..j - 1}`); + (STRIP_TAC); + + (NEW_GOAL `(?r. r IN (R:(real^3->bool)->bool) /\ ~negligible r)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "R"); + (ABBREV_TAC `f = (\q. t INTER rogers V (left_action_list q vl))`); + (REWRITE_WITH + `{t INTER rogers V (left_action_list q vl) | q permutes 0..j - 1} = + {f q | q permutes 0..j - 1}`); + (EXPAND_TAC "f" THEN REFL_TAC); + (ONCE_REWRITE_TAC[SET_RULE `{f x | P x} = {f x | x IN {x | P x}}`]); + + (REWRITE_TAC[SET_RULE `{f q | q IN {x | x permutes 0..j - 1} } = + {y | ?q. q IN {x | x permutes 0..j - 1} /\ y = f q}`]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (MATCH_MP_TAC FINITE_PERMUTATIONS); + (REWRITE_TAC[FINITE_NUMSEG]); + (UP_ASM_TAC THEN EXPAND_TAC "R" THEN REWRITE_TAC[IN; IN_ELIM_THM] + THEN STRIP_TAC); + (NEW_GOAL + `rogers V (left_action_list p ul) = rogers V (left_action_list q vl)`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `coplanar (rogers V (left_action_list p ul) INTER + rogers V (left_action_list q vl))`); + (MATCH_MP_TAC Rogers.DUUNHOR); + (ASM_REWRITE_TAC[IN]); + (STRIP_TAC); + + (MATCH_MP_TAC Qzksykg.QZKSYKG1); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell j V vl`)]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[ASSUME `X:real^3->bool = {}`; NEGLIGIBLE_EMPTY]); + + (MATCH_MP_TAC Qzksykg.QZKSYKG1); + (EXISTS_TAC `vl:(real^3)list` THEN EXISTS_TAC `j:num`); + (EXISTS_TAC `q:num->num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell j V vl`)]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[ASSUME `X:real^3->bool = {}`; NEGLIGIBLE_EMPTY]); + (UNDISCH_TAC `~NULLSET r`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `rogers V (left_action_list p ul) INTER + rogers V (left_action_list q vl)`); + (STRIP_TAC); + (ASM_SIMP_TAC[COPLANAR_IMP_NEGLIGIBLE]); + (ASM_SET_TAC[]); + (ABBREV_TAC `xl:(real^3)list = (left_action_list p ul)`); + (ABBREV_TAC `yl:(real^3)list = (left_action_list q vl)`); + + + (NEW_GOAL `barV V 3 xl /\ + (!k. i - 1 <= k /\ k <= 3 + ==> omega_list_n V xl k = omega_list_n V ul k)`); + (MATCH_MP_TAC Ynhyjit.YNHYJIT); + (EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `j = 2`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[GSYM (ASSUME `mcell i V ul = X`); ASSUME `i = j:num`; + MCELL_EXPLICIT; mcell2; ASSUME `j = 2`]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `2 - 1 = 1`]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `j = 3`); + (ASM_SET_TAC[]); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[GSYM (ASSUME `mcell i V ul = X`); ASSUME `i = j:num`; + MCELL_EXPLICIT; mcell3; ASSUME `j = 3`]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + + (NEW_GOAL `barV V 3 yl /\ + (!k. j - 1 <= k /\ k <= 3 + ==> omega_list_n V yl k = omega_list_n V vl k)`); + (MATCH_MP_TAC Ynhyjit.YNHYJIT); + (EXISTS_TAC `q:num->num`); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `j = 2`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[ASSUME `X = mcell j V vl`; MCELL_EXPLICIT; mcell2; ASSUME `j = 2`]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `2 - 1 = 1`]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `j = 3`); + (ASM_SET_TAC[]); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[ASSUME `X = mcell j V vl`; MCELL_EXPLICIT; mcell3; ASSUME `j = 3`]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + + (NEW_GOAL `!k. 0 <= k /\ k <= 3 + ==> omega_list_n V xl k = omega_list_n V yl k`); + (MATCH_MP_TAC Njiutiu.NJIUTIU); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `aff_dim (rogers V yl) <= &(dimindex (:3))`); + (REWRITE_TAC[AFF_DIM_LE_UNIV]); + (UP_ASM_TAC THEN REWRITE_TAC[DIMINDEX_3]); + (STRIP_TAC); + (NEW_GOAL `~(aff_dim (rogers V yl) <= &2)`); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET r` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `rogers V yl`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (ASM_SIMP_TAC[Rogers.AFF_DIM_LE_2_IMP_COPLANAR]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (NEW_GOAL + `(!k. j - 1 <= k /\ k <= 3 ==> omega_list_n V xl k = omega_list_n V yl k)`); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `j = 2 \/ j = 3 \/ j = 4`); + (ASM_SET_TAC[]); + + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (ASM_MESON_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 23 *) + +let MCELL_ID_MXI = prove_by_refinement ( + `!V i j ul vl. + packing V /\ + saturated V /\ + barV V 3 ul /\ + barV V 3 vl /\ + HD ul = HD vl /\ + mcell i V ul = mcell j V vl /\ + ~NULLSET (mcell i V ul) /\ + i IN {2, 3} /\ + j IN {2, 3} + ==> mxi V ul = mxi V vl`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `i = j /\ + (!k. i - 1 <= k /\ k <= 3 + ==> omega_list_n V ul k = omega_list_n V vl k)`); + (MATCH_MP_TAC MCELL_ID_OMEGA_LIST_N); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ASM_CASES_TAC `hl (truncate_simplex 2 (ul:(real^3)list)) >= sqrt (&2)`); + (ASM_CASES_TAC `hl (truncate_simplex 2 (vl:(real^3)list)) >= sqrt (&2)`); + + (REWRITE_WITH `mxi V ul = omega_list_n V ul 2`); + (REWRITE_TAC[mxi] THEN COND_CASES_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `mxi V vl = omega_list_n V vl 2`); + (REWRITE_TAC[mxi] THEN COND_CASES_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ARITH `~(a >= b) <=> a < b`]); + (STRIP_TAC); + + (ABBREV_TAC `xl = truncate_simplex 2 (ul:(real^3)list)`); + (ABBREV_TAC `yl = truncate_simplex 2 (vl:(real^3)list)`); + + (NEW_GOAL `set_of_list (truncate_simplex (i - 1) (ul:(real^3)list)) = + set_of_list (truncate_simplex (i - 1) vl)`); + (NEW_GOAL `V INTER mcell i V ul = set_of_list (truncate_simplex (i - 1) ul)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (NEW_GOAL `V INTER mcell j V vl = set_of_list (truncate_simplex (j - 1) vl)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `F`); + (NEW_GOAL `hl (xl:(real^3)list) <= dist (omega_list V xl, HD xl)`); + (MATCH_MP_TAC Rogers.WAUFCHE1); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN] THEN EXPAND_TAC "xl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `hl yl = dist (omega_list V yl, HD yl)`); + (MATCH_MP_TAC Rogers.WAUFCHE2); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN]); + (EXPAND_TAC "yl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `omega_list V xl = omega_list V yl`); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH (xl:(real^3)list) = 3 /\ LENGTH (yl:(real^3)list) = 3`); + (EXPAND_TAC "xl" THEN EXPAND_TAC "yl"); + (REWRITE_TAC[ARITH_RULE `3 = 2 + 1`]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (REWRITE_TAC[ARITH_RULE `3 - 1 = 2`]); + (EXPAND_TAC "xl" THEN EXPAND_TAC "yl"); + (REWRITE_WITH + `truncate_simplex 2 ul = truncate_simplex (2 + 0) (ul:(real^3)list) /\ + truncate_simplex 2 vl = truncate_simplex (2 + 0) (vl:(real^3)list)`); + (REWRITE_TAC[ARITH_RULE `2 + 0 = 2`]); + (REWRITE_WITH + `omega_list_n V (truncate_simplex (2 + 0) ul) 2 = omega_list_n V ul 2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH + `omega_list_n V (truncate_simplex (2 + 0) vl) 2 = omega_list_n V vl 2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + (NEW_GOAL `HD (xl:(real^3)list) = HD yl`); + (EXPAND_TAC "xl" THEN EXPAND_TAC "yl"); + (REWRITE_WITH `HD (truncate_simplex 2 ul) = (HD ul):real^3`); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH `HD (truncate_simplex 2 vl) = (HD vl):real^3`); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `hl (yl:(real^3)list) = dist (omega_list V xl, HD xl)`); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + +(* ======================================================================= *) + + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ARITH `~(a >= b) <=> a < b`]); + (STRIP_TAC); + (ASM_CASES_TAC `hl (truncate_simplex 2 (vl:(real^3)list)) >= sqrt (&2)`); + + (ABBREV_TAC `xl = truncate_simplex 2 (ul:(real^3)list)`); + (ABBREV_TAC `yl = truncate_simplex 2 (vl:(real^3)list)`); + + (NEW_GOAL `set_of_list (truncate_simplex (i - 1) (ul:(real^3)list)) = + set_of_list (truncate_simplex (i - 1) vl)`); + (NEW_GOAL `V INTER mcell i V ul = set_of_list (truncate_simplex (i - 1) ul)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (NEW_GOAL `V INTER mcell j V vl = set_of_list (truncate_simplex (j - 1) vl)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `F`); + (NEW_GOAL `hl (yl:(real^3)list) <= dist (omega_list V yl, HD yl)`); + (MATCH_MP_TAC Rogers.WAUFCHE1); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN] THEN EXPAND_TAC "yl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `hl xl = dist (omega_list V xl, HD xl)`); + (MATCH_MP_TAC Rogers.WAUFCHE2); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN]); + (EXPAND_TAC "xl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `omega_list V xl = omega_list V yl`); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH (xl:(real^3)list) = 3 /\ LENGTH (yl:(real^3)list) = 3`); + (EXPAND_TAC "xl" THEN EXPAND_TAC "yl"); + (REWRITE_TAC[ARITH_RULE `3 = 2 + 1`]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (REWRITE_TAC[ARITH_RULE `3 - 1 = 2`]); + (EXPAND_TAC "xl" THEN EXPAND_TAC "yl"); + (REWRITE_WITH + `truncate_simplex 2 ul = truncate_simplex (2 + 0) (ul:(real^3)list) /\ + truncate_simplex 2 vl = truncate_simplex (2 + 0) (vl:(real^3)list)`); + (REWRITE_TAC[ARITH_RULE `2 + 0 = 2`]); + (REWRITE_WITH + `omega_list_n V (truncate_simplex (2 + 0) ul) 2 = omega_list_n V ul 2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH + `omega_list_n V (truncate_simplex (2 + 0) vl) 2 = omega_list_n V vl 2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `HD (xl:(real^3)list) = HD yl`); + (EXPAND_TAC "xl" THEN EXPAND_TAC "yl"); + (REWRITE_WITH `HD (truncate_simplex 2 ul) = (HD ul):real^3`); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH `HD (truncate_simplex 2 vl) = (HD vl):real^3`); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `hl (xl:(real^3)list) = dist (omega_list V yl, HD yl)`); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ARITH `~(a >= b) <=> a < b`]); + (STRIP_TAC); + +(* ======================================================================= *) + + (NEW_GOAL `sqrt (&2) <= hl (ul:(real^3)list)`); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_CASES_TAC `i = 2`); + (REWRITE_TAC[MCELL_EXPLICIT; ASSUME `i = 2`; mcell2]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (NEW_GOAL `i = 3`); + (ASM_SET_TAC[]); + (REWRITE_TAC[MCELL_EXPLICIT; ASSUME `i = 3`; mcell3]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `sqrt (&2) <= hl (vl:(real^3)list)`); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[]); + (ASM_CASES_TAC `j = 2`); + (REWRITE_TAC[MCELL_EXPLICIT; ASSUME `j = 2`; mcell2]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (NEW_GOAL `j = 3`); + (ASM_SET_TAC[]); + (REWRITE_TAC[MCELL_EXPLICIT; ASSUME `j = 3`; mcell3]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (ABBREV_TAC `s2 = omega_list_n V ul 2`); + (ABBREV_TAC `s3 = omega_list_n V ul 3`); + (NEW_GOAL `s2 = omega_list_n V vl 2`); + (EXPAND_TAC "s2" THEN FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + (NEW_GOAL `s3 = omega_list_n V vl 3`); + (EXPAND_TAC "s3" THEN FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + (ABBREV_TAC `u0:real^3 = HD ul`); + + (NEW_GOAL `?s. between s (s2,s3) /\ + dist (u0,s) = sqrt (&2) /\ + mxi V ul = s`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "s3"); + (MATCH_MP_TAC MXI_EXPLICIT); + (NEW_GOAL `?v0 u1 u2 u3. ul = [v0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `v0:real^3 = HD ul`); + (REWRITE_TAC[ASSUME `ul = [v0;u1;u2;u3:real^3]`; HD]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?t. between t (s2,s3) /\ + dist (u0,t) = sqrt (&2) /\ + mxi V vl = t`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MXI_EXPLICIT); + (NEW_GOAL `?v0 u1 u2 u3. vl = [v0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[HD]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `!n. between n (s2, s3:real^3) ==> + dist (u0, n) pow 2 = dist (s2, n) pow 2 + dist (u0, s2) pow 2`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[dist]); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (ABBREV_TAC `zl = truncate_simplex 2 (ul:(real^3)list)`); + (REWRITE_WITH `s2:real^3 = circumcenter (set_of_list zl)`); + (REWRITE_WITH `s2 = omega_list V zl`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "zl"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_LEMMA); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN]); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool`); + (EXISTS_TAC `2`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `s2 IN voronoi_list V zl`); + (REWRITE_WITH `s2 = omega_list V zl`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "zl"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_LEMMA); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `2`); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `s3 IN voronoi_list V zl`); + (EXPAND_TAC "s3" THEN EXPAND_TAC "zl"); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3 /\ 3 <= 3`]); + (NEW_GOAL `affine hull {s2, s3} SUBSET affine hull voronoi_list V zl`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA); + (ASM_SET_TAC[]); + (NEW_GOAL `n IN affine hull {s2, s3:real^3}`); + (NEW_GOAL `convex hull {s2,s3} SUBSET affine hull {s2,s3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (NEW_GOAL `n IN convex hull {s2, s3:real^3}`); + (REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL]); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + + (MATCH_MP_TAC Marchal_cells_2_new.IN_AFFINE_KY_LEMMA1); + (REWRITE_WITH `u0:real^3 = HD zl`); + (EXPAND_TAC "zl" THEN EXPAND_TAC "u0"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Packing3.HD_IN_SET_OF_LIST); + + (REWRITE_WITH `LENGTH (zl:(real^3)list) = 2 + 1 /\ + CARD (set_of_list zl) = 2 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ARITH_TAC); + + (NEW_GOAL `dist (u0,s) pow 2 = dist (s2,s:real^3) pow 2 + dist (u0,s2) pow 2`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `dist (u0,t) pow 2 = dist (s2,t:real^3) pow 2 + dist (u0,s2) pow 2`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `dist (s2, s:real^3) = dist (s2, t)`); + (REWRITE_TAC[DIST_EQ]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + + (UNDISCH_TAC `between s (s2, s3:real^3)` THEN + UNDISCH_TAC `between t (s2, s3:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `dist (s2,s) = dist (s2,t:real^3)`); + (REWRITE_TAC[dist;ASSUME `s = u' % s2 + v' % s3:real^3`; + ASSUME `t = u % s2 + v % s3:real^3` ]); + (REWRITE_WITH `s2 - (u' % s2 + v' % s3) = + (u' + v') % s2 - (u' % s2 + v' % s3:real^3)`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `s2 - (u % s2 + v % s3) = + (u + v) % s2 - (u % s2 + v % s3:real^3)`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `(u + v) % s - (u % s + v % t) = v % (s - t)`]); + (REWRITE_TAC[NORM_MUL]); + (REWRITE_WITH `abs v = v /\ abs v' = v'`); + (ASM_SIMP_TAC[REAL_ABS_REFL]); + (REWRITE_TAC[REAL_ARITH `a * b = c * b <=> (a - c) * b = &0`;REAL_ENTIRE]); + (STRIP_TAC); + (REWRITE_WITH `v = v':real /\ u = u':real`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[NORM_EQ_0]); + (REWRITE_TAC[VECTOR_ARITH `a - b = vec 0 <=> a = b`] THEN STRIP_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `hl (ul:(real^3)list) <= dist (s3,u0:real^3)`); + (REWRITE_WITH `s3 = omega_list V ul /\ u0 = HD ul`); + (STRIP_TAC); + (REWRITE_TAC[GSYM (ASSUME `omega_list_n V ul 3 = s3`); OMEGA_LIST]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `(3 + 1) - 1 = 3`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Rogers.WAUFCHE1); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[IN]); + (ABBREV_TAC `zl:(real^3)list = truncate_simplex 2 ul`); + (NEW_GOAL `hl (zl:(real^3)list) = dist (s3, u0:real^3)`); + + + (REWRITE_WITH `s3 = omega_list V zl /\ u0 = HD zl`); + (STRIP_TAC); + (REWRITE_TAC[GSYM (ASSUME `s2:real^3 = s3`); OMEGA_LIST]); + (EXPAND_TAC "s2"); + + (REWRITE_WITH `LENGTH (zl:(real^3)list) = 2 + 1 /\ + CARD (set_of_list zl) = 2 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (REWRITE_TAC[ARITH_RULE `(2 + 1) - 1 = 2`]); + (EXPAND_TAC "zl"); + + (REWRITE_WITH `truncate_simplex 2 (ul:(real^3)list) = + truncate_simplex (2 + 0) (ul:(real^3)list)`); + (REWRITE_TAC[ARITH_RULE `2 + 0 = 2`]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (EXPAND_TAC "zl" THEN EXPAND_TAC "u0"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Rogers.WAUFCHE2); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN]); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[])]);; + + +(* ==================================================================== *) +(* Lemma 24 *) + +let AFFINE_HULL_3_INSERT = prove_by_refinement ( +`!a:real^3 S. + a IN affine hull S ==> affine hull (a INSERT S) = affine hull S`, +[(REPEAT STRIP_TAC); + (MATCH_MP_TAC AFFINE_HULLS_EQ); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL; INSERT_SUBSET]); + (MATCH_MP_TAC (SET_RULE `a:real^3 INSERT s SUBSET t ==> s SUBSET t`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL])]);; + +(* ==================================================================== *) +(* Lemma 25 *) + +let FINITE_EDGE_X2 = prove_by_refinement ( + `!(V:real^3->bool) e:real^3->bool u0 u1. + packing V /\ saturated V /\ e = {u0, u1} ==> + FINITE {X | mcell_set V X /\ edgeX V X e}`, +[(REPEAT STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | mcell_set V X /\ edgeX V X e /\ ~(X = {})} UNION {{}}`); + + (ONCE_REWRITE_TAC[SET_RULE `A /\ B <=> B /\ A`]); + (STRIP_TAC); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM; IN_UNION]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[MESON[IN] `{{}} x <=> x IN {{}}`; + SET_RULE `x IN {a} <=> x = a`]); + (MESON_TAC[]); + (REWRITE_TAC [FINITE_UNION; FINITE_SING]); + + (MATCH_MP_TAC FINITE_SUBSET); + (ABBREV_TAC `f = (\(i, ul). mcell i V ul)`); + (ABBREV_TAC `s = V INTER ball (u0:real^3, &4)`); + (ABBREV_TAC `S = {y | ?v0 v1 v2 v3:real^3. + v0 IN s /\ + v1 IN s /\ + v2 IN s /\ + v3 IN s /\ + y = [v0; v1; v2; v3]}`); + (ABBREV_TAC `S1 = {i, (ul:(real^3)list) | i IN 0..4 /\ ul IN S}`); + (EXISTS_TAC `{(f:num#(real^3)list->real^3->bool) x | x IN S1}`); + (STRIP_TAC); + (REWRITE_TAC[SET_RULE `{f x |x IN s } = {y | ?x. x IN s /\ y = f x}`]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (EXPAND_TAC "S1"); + (MATCH_MP_TAC FINITE_PRODUCT); + (REWRITE_TAC[FINITE_NUMSEG]); + (EXPAND_TAC "S"); + (MATCH_MP_TAC Ajripqn.FINITE_SET_LIST_LEMMA); + (EXPAND_TAC "s"); + (MATCH_MP_TAC Pack2.KIUMVTC THEN ASM_SIMP_TAC[]); + + (EXPAND_TAC "f" THEN REWRITE_TAC[SUBSET; IN; IN_ELIM_THM; mcell_set_2]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `(i:num, ul:(real^3)list)`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "S1" THEN REWRITE_TAC[IN_ELIM_THM]); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `ul:(real^3)list`); + (ASM_REWRITE_TAC[IN_NUMSEG_0]); + (EXPAND_TAC "S" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + (EXISTS_TAC `v0:real^3` THEN EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list ul SUBSET (s:real^3->bool)`); + (EXPAND_TAC "s"); + (REWRITE_TAC[SUBSET_INTER]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + + (NEW_GOAL `~NULLSET x`); + (UNDISCH_TAC `edgeX V x e`); + (REWRITE_TAC[edgeX; IN_ELIM_THM; VX]); + (COND_CASES_TAC); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `{ } (u:real^3)`); + (REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`] THEN SET_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `VX V x = V INTER x`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `V INTER (x:real^3->bool) = + set_of_list (truncate_simplex (i - 1) ul)`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (REWRITE_TAC[GSYM (ASSUME `ul = [v0;v1;v2;v3:real^3]`); + GSYM (ASSUME `x = mcell i V ul`)]); + (ASM_REWRITE_TAC[]); + (ASM_CASES_TAC `i = 0`); + (NEW_GOAL `F`); + (UNDISCH_TAC `edgeX V x e`); + (REWRITE_TAC[edgeX; IN_ELIM_THM]); + (REWRITE_WITH `VX V x = {}`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `{ } (u:real^3)`); + (REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`] THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN ARITH_TAC); + + (NEW_GOAL `u0 IN VX V x`); + (UNDISCH_TAC `edgeX V x e`); + (REWRITE_TAC[edgeX; IN_ELIM_THM; ASSUME `e = {u0, u1:real^3}`; IN]); + (REPEAT STRIP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[GSYM (ASSUME `ul = [v0; v1; v2; v3:real^3]`)]); + (STRIP_TAC); + (NEW_GOAL `set_of_list (truncate_simplex (i - 1) ul) SUBSET + set_of_list (ul:(real^3)list)`); + (MATCH_MP_TAC Rogers.SET_OF_LIST_TRUNCATE_SIMPLEX_SUBSET); + (ASM_REWRITE_TAC[LENGTH] THEN ASM_ARITH_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[MESON[IN] `(s:real^3->bool) v <=> v IN s`]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[])]);; + + +(* ==================================================================== *) +(* Lemma 26 *) + +let CONTINUOUS_ON_LIFT_DOT2 = prove + (`!f:real^M->real^N g s. + f continuous_on s /\ g continuous_on s + ==> (\x. lift(f x dot g x)) continuous_on s`, + REPEAT GEN_TAC THEN + SUBGOAL_THEN `bilinear (\x y:real^N. lift(x dot y))` MP_TAC THENL + [REWRITE_TAC[bilinear; linear; DOT_LADD; DOT_RADD; DOT_LMUL; DOT_RMUL] THEN + REWRITE_TAC[LIFT_ADD; LIFT_CMUL]; + REWRITE_TAC[GSYM IMP_CONJ_ALT; GSYM CONJ_ASSOC] THEN + DISCH_THEN(MP_TAC o MATCH_MP BILINEAR_CONTINUOUS_ON_COMPOSE) THEN + REWRITE_TAC[]]);; + +let LIFT_MUL_CONTINUOUS_ON = prove + (`!f:real^N->real g s. + lift o f continuous_on s /\ lift o g continuous_on s ==> + lift o (\x. f x * g x) continuous_on s`, + REWRITE_TAC[o_DEF; LIFT_CMUL] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC CONTINUOUS_ON_MUL THEN + ASM_REWRITE_TAC[o_DEF]);; + +let LIFT_DIV_CONTINUOUS_ON = prove + (`!f:real^N->real g s. + lift o f continuous_on s /\ lift o g continuous_on s /\ + (!x. x IN s ==> ~(g x = &0))==> + lift o (\x. f x / g x) continuous_on s`, + REWRITE_TAC[o_DEF; LIFT_CMUL; real_div] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC CONTINUOUS_ON_MUL THEN + ASM_REWRITE_TAC[o_DEF] THEN + MATCH_MP_TAC(REWRITE_RULE[o_DEF] CONTINUOUS_ON_INV) THEN + ASM_REWRITE_TAC[]);; + +let LIFT_DOT_CONTINUOUS_ON = prove +(`!a:real^N b s. + (lift o ((\x. (x - a) dot b))) continuous_on s`, + REPEAT GEN_TAC THEN REWRITE_TAC[o_DEF] THEN + MATCH_MP_TAC CONTINUOUS_ON_LIFT_DOT2 THEN + ASM_SIMP_TAC[CONTINUOUS_ON_SUB; CONTINUOUS_ON_CONST; CONTINUOUS_ON_ID]);; + +let LIFT_NORM_CONTINUOUS_ON = prove + (`!a:real^N s. + (lift o ((\x. norm (x - a)))) continuous_on s`, + REPEAT GEN_TAC THEN REWRITE_TAC[o_DEF] THEN + MATCH_MP_TAC CONTINUOUS_ON_LIFT_NORM_COMPOSE THEN + ASM_SIMP_TAC[CONTINUOUS_ON_SUB; CONTINUOUS_ON_CONST; CONTINUOUS_ON_ID]);; + +(* ==================================================================== *) +(* Lemma 27 *) + +let aff_ge_alt = new_definition + `aff_ge_alt s t (v:real^3) <=> + (?f q. FINITE q /\ q SUBSET t /\ v = lin_combo (s UNION q) f /\ + (!w. q w ==> &0 <= f w) /\ + sum (s UNION q) f = &1)`;; + +let smallest_angle_set = new_definition + `!u0:real^3 u1 s. + smallest_angle_set s u0 u1 = + (@x. x IN s /\ (!y. y IN s ==> + ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0))))`;; + +let smallest_angle_line = new_definition + `!a b c d:real^3. + smallest_angle_line a b c d = smallest_angle_set (convex hull {a, b}) c d`;; + +let SMALLEST_ANGLE_LINE_EXISTS = prove_by_refinement ( + `!a b u0 u1. ~(u0 = u1) /\ ~(u0 IN convex hull {a, b}) ==> + (?x. (x IN convex hull {a, b:real^3} /\ + (!y. y IN convex hull {a, b} ==> + ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0)))))`, +[(REPEAT STRIP_TAC); + (ABBREV_TAC `f = (\x:real^3. ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0)))`); + + (REWRITE_WITH `!y:real^3. + ((y - u0) dot (u1 - u0)) / (norm (y - u0) * norm (u1 - u0)) = f y`); + (EXPAND_TAC "f" THEN REWRITE_TAC[]); + (MATCH_MP_TAC CONTINUOUS_ATTAINS_SUP); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMP_COMPACT_CONVEX_HULL); + (REWRITE_TAC[Geomdetail.FINITE6]); + (STRIP_TAC); + (REWRITE_TAC[CONVEX_HULL_EQ_EMPTY] THEN SET_TAC[]); + (ABBREV_TAC `f1 = (\x. (x - u0) dot (u1 - u0:real^3))`); + (ABBREV_TAC `f2 = (\x. norm (x - u0) * norm (u1 - u0:real^3))`); + (REWRITE_WITH `f = (\x:real^3. f1 x / f2 x)`); + (EXPAND_TAC "f" THEN EXPAND_TAC "f1" THEN EXPAND_TAC "f2"); + (REWRITE_TAC[]); + (MATCH_MP_TAC LIFT_DIV_CONTINUOUS_ON); + + (REPEAT STRIP_TAC); + (EXPAND_TAC "f1"); + (REWRITE_TAC[LIFT_DOT_CONTINUOUS_ON]); + (ABBREV_TAC `f3 = (\x:real^3. norm (u1 - u0:real^3))`); + (ABBREV_TAC `f4 = (\x:real^3. norm (x - u0:real^3))`); + (REWRITE_WITH `f2 = (\x:real^3. f4 x * f3 x)`); + (EXPAND_TAC "f2" THEN EXPAND_TAC "f3" THEN EXPAND_TAC "f4"); + (REWRITE_TAC[]); + (MATCH_MP_TAC LIFT_MUL_CONTINUOUS_ON); + (EXPAND_TAC "f3" THEN EXPAND_TAC "f4"); + (REWRITE_TAC[LIFT_NORM_CONTINUOUS_ON]); + (REWRITE_TAC[o_DEF; CONTINUOUS_ON_CONST]); + (UP_ASM_TAC THEN EXPAND_TAC "f2" THEN REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0]); + (ASM_REWRITE_TAC[VECTOR_ARITH `a - b = vec 0 <=> b = a`]); + (STRIP_TAC); + (ASM_MESON_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 28 *) + +let SMALLEST_ANGLE_IN_CONVEX_HULL = prove_by_refinement ( + `!m n p q x. + ~(p = q) /\ ~(p IN convex hull {m,n}) /\ x = smallest_angle_line m n p q + ==> x IN convex hull {m, n}`, +[(REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[smallest_angle_line; smallest_angle_set]); + (STRIP_TAC); + (ABBREV_TAC `X = (\x:real^3. x IN convex hull {m, n} /\ + (!y. y IN convex hull {m, n} + ==> ((y - p) dot (q - p)) / (norm (y - p) * norm (q - p)) <= + ((x - p) dot (q - p)) / (norm (x - p) * norm (q - p))))`); + (NEW_GOAL `(X:real^3->bool) x`); + (ASM_REWRITE_TAC[] THEN MATCH_MP_TAC SELECT_AX); + (EXPAND_TAC "X" THEN ASM_SIMP_TAC[SMALLEST_ANGLE_LINE_EXISTS]); + (UP_ASM_TAC THEN EXPAND_TAC "X" THEN MESON_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 29 *) + +let SMALLEST_ANGLE_LINE_PROPERTY = prove_by_refinement ( + `!m n u0 u1 x y. + ~(u0 = u1) /\ + ~(u0 IN convex hull {m,n}) /\ + x = smallest_angle_line m n u0 u1 /\ + y IN convex hull {m, n} + ==> ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0))`, +[(REPEAT STRIP_TAC); + (UNDISCH_TAC `x = smallest_angle_line m n u0 u1`); + (REWRITE_TAC[smallest_angle_line; smallest_angle_set]); + (STRIP_TAC); + (ABBREV_TAC `X = + (\x:real^3. x IN convex hull {m, n} /\ + (!y. y IN convex hull {m, n} + ==> ((y - u0) dot (u1 - u0)) / (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / (norm (x - u0) * norm (u1 - u0))))`); + (NEW_GOAL `(X:real^3->bool) x`); + (ASM_REWRITE_TAC[] THEN MATCH_MP_TAC SELECT_AX); + (EXPAND_TAC "X" THEN ASM_SIMP_TAC[SMALLEST_ANGLE_LINE_EXISTS]); + (UP_ASM_TAC THEN EXPAND_TAC "X" THEN ASM_MESON_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 30 *) + +let MCELL_SUBSET_BALL8_1 = prove_by_refinement ( + `!v:real^3 ul i V. + i<= 4 /\ packing V /\ saturated V /\ barV V 3 ul /\ v IN mcell i V ul ==> + mcell i V ul SUBSET ball (v, &8)`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `mcell i V ul SUBSET + UNIONS {rogers V (left_action_list p ul) | p permutes 0..i - 1}`); + (MATCH_MP_TAC Qzksykg.QZKSYKG2); + (ASM_REWRITE_TAC[SET_RULE `i IN {0,1,2,3,4}<=> i =0\/i=1\/i=2\/i=3\/i=4`]); + (ASM_ARITH_TAC); + (NEW_GOAL `UNIONS {rogers V (left_action_list p ul) | p permutes 0..i - 1} + SUBSET UNIONS {voronoi_closed V s | s IN set_of_list ul}`); + (REWRITE_TAC[SUBSET; IN_UNIONS; IN;IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `voronoi_closed V ((HD (left_action_list p ul)):real^3)`); + (STRIP_TAC); + (EXISTS_TAC `(HD (left_action_list p ul)):real^3`); + (REWRITE_TAC[MESON[IN] `(a:real^3->bool) s <=> s IN a`]); + (REWRITE_WITH + `set_of_list (ul:(real^3)list) = set_of_list (left_action_list p ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (ASM_CASES_TAC `i = 4`); + (MATCH_MP_TAC Packing3.SET_OF_LIST_LEFT_ACTION_LIST); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[ARITH_RULE `3 + 1 = 4`]); + + (ASM_CASES_TAC `i = 3`); + (MATCH_MP_TAC Marchal_cells_2_new.SET_OF_LIST_LEFT_ACTION_LIST_2); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[ARITH_RULE `(3 + 1) - 2 = 3 - 1 /\ 2 <= 3 + 1`]); + + (ASM_CASES_TAC `i = 2`); + (MATCH_MP_TAC Marchal_cells_2_new.SET_OF_LIST_LEFT_ACTION_LIST_3); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[ARITH_RULE `(3 + 1) - 3 = 2 - 1 /\ 3 <= 3 + 1`]); + + (NEW_GOAL `i <= 1`); + (ASM_ARITH_TAC); + (NEW_GOAL `p permutes 0..0`); + (ASM_MESON_TAC[ARITH_RULE `i <= 1 ==> i - 1 = 0`]); + (UP_ASM_TAC THEN REWRITE_TAC[Packing3.PERMUTES_TRIVIAL] THEN STRIP_TAC); + (ASM_REWRITE_TAC[Packing3.LEFT_ACTION_LIST_I]); + (MATCH_MP_TAC Packing3.HD_IN_SET_OF_LIST); + (REWRITE_TAC[Packing3.LENGTH_LEFT_ACTION_LIST]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[MESON[IN] `(a:real^3->bool) s <=> s IN a`]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `rogers V (left_action_list p ul) SUBSET + voronoi_closed V (HD (left_action_list p ul))`); + (MATCH_MP_TAC ROGERS_SUBSET_VORONOI_CLOSED); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Qzksykg.QZKSYKG1); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num` THEN + EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (REWRITE_TAC[SET_RULE `i IN {0,1,2,3,4} <=> i=0\/i=1\/i=2\/i=3\/i=4`]); + (ASM_ARITH_TAC); + (UNDISCH_TAC `v IN mcell i V ul` THEN SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `UNIONS {voronoi_closed V s | s IN set_of_list ul} SUBSET + UNIONS {ball (s:real^3, &2) | s IN set_of_list ul}`); + (NEW_GOAL `!s:real^3. voronoi_closed V s SUBSET ball (s, &2)`); + (ASM_SIMP_TAC[Packing3.VORONOI_BALL2]); + (UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `mcell i V ul SUBSET UNIONS {ball (s,&2) | s IN set_of_list ul}`); + (ABBREV_TAC `s1 = + UNIONS {rogers V (left_action_list p ul) | p permutes 0..i - 1}`); + (ABBREV_TAC `s2 = + UNIONS {voronoi_closed V (s:real^3) | s IN set_of_list ul}`); + (ABBREV_TAC `s3 = UNIONS {ball (s:real^3,&2) | s IN set_of_list ul}`); + (DEL_TAC THEN DEL_TAC THEN DEL_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[SUBSET; IN_UNIONS; IN; IN_ELIM_THM; IN_BALL]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?t. (?s. set_of_list ul s /\ t = ball (s:real^3,&2)) /\ t x`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `dist (s, x:real^3) < &2`); + (REWRITE_TAC[GSYM IN_BALL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `?t. (?s. set_of_list ul s /\ t = ball (s:real^3,&2)) /\ t v`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `dist (s', v:real^3) < &2`); + (REWRITE_TAC[GSYM IN_BALL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `dist (v, x:real^3) <= dist (s', v) + dist (s', s) + dist (s, x)`); + (NORM_ARITH_TAC); + (NEW_GOAL `dist (s', s:real^3) < &4`); + (REWRITE_TAC[GSYM IN_BALL]); + + (NEW_GOAL `set_of_list ul SUBSET ball (s':real^3,&4)`); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[IN]); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 31 *) + +let MCELL_SUBSET_BALL8 = prove_by_refinement ( + `!v:real^3 ul i V. + packing V /\ saturated V /\ barV V 3 ul /\ v IN mcell i V ul ==> + mcell i V ul SUBSET ball (v, &8)`, +[(REPEAT STRIP_TAC); + (ASM_CASES_TAC `i <= 4`); + (ASM_SIMP_TAC[MCELL_SUBSET_BALL8_1]); + (UNDISCH_TAC `v IN mcell i V ul`); + (REWRITE_WITH `mcell i V ul = mcell 4 V ul`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; + ARITH_RULE `~(i <= 4)==>i >= 4`]); + (STRIP_TAC); + (ASM_SIMP_TAC[MCELL_SUBSET_BALL8_1; ARITH_RULE `4 <= 4`])]);; + +(* ==================================================================== *) +(* Lemma 32 *) + +let FINITE_MCELL_SET_LEMMA_2 = prove_by_refinement ( + `!V r s:real^3. + packing V /\ saturated V + ==> FINITE {X | X SUBSET ball (s,r) /\ mcell_set V X}`, +[(REPEAT STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (vec 0,norm (s:real^3) + r) /\ + mcell_set V X}`); + (STRIP_TAC); + (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA]); + (REWRITE_TAC[IN; SUBSET; IN_BALL; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (NEW_GOAL `dist (vec 0, x') <= norm s + dist (s, x':real^3)`); + (NORM_ARITH_TAC); + (NEW_GOAL `dist (s, x':real^3) < r`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 33 *) + +let CONIC_CAP_WEDGE_EQ_0 =prove_by_refinement ( + `!v0 v1 a r w1 w2. a < &1 /\ &0 < r /\ + vol (conic_cap v0 v1 r a INTER wedge v0 v1 w1 w2) = &0 ==> + coplanar {v0,v1,w1, w2:real^3}`, +[(REPEAT STRIP_TAC); + (MATCH_MP_TAC (MESON[] `(~A==> F) ==> A`) THEN STRIP_TAC); + (NEW_GOAL `~collinear {v0, v1, w1:real^3}`); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `w2:real^3` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `~collinear {v0, v1, w2:real^3}`); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`] THEN + EXISTS_TAC `w1:real^3` THEN ASM_REWRITE_TAC[]); + + (NEW_GOAL `vol (conic_cap v0 v1 r a INTER wedge v0 v1 w1 (w2:real^3)) = + (if &1 < a \/ r < &0 + then &0 + else azim v0 v1 w1 w2 / &3 * (&1 - max a (-- &1)) * r pow 3)`); + (ASM_MESON_TAC[VOLUME_CONIC_CAP_WEDGE]); + (UP_ASM_TAC THEN COND_CASES_TAC); + (STRIP_TAC THEN ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_ARITH `&0 = a <=> a = &0`; + REAL_ENTIRE; REAL_ARITH `a / &3 = &0 <=> a = &0`]); + (REWRITE_TAC[REAL_ARITH `&1 - max a (-- &1) = &0 <=> a = &1`]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `~coplanar {v0, v1, w1, w2:real^3}`); + (ASM_SIMP_TAC[AZIM_EQ_0_PI_IMP_COPLANAR]); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[] THEN MATCH_MP_TAC REAL_POW_NZ); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 34 *) + +let CONIC_CAP_AFF_GT_EQ_0 =prove_by_refinement ( + `!v0 v1 a r w1 w2. a < &1 /\ &0 < r /\ + vol (conic_cap v0 v1 r a INTER aff_gt {v0, v1} {w1, w2}) = &0 ==> + coplanar {v0,v1,w1, w2:real^3}`, +[(REPEAT STRIP_TAC); + (MATCH_MP_TAC (MESON[] `(~A==> F) ==> A`) THEN STRIP_TAC); + (NEW_GOAL `~collinear {v0, v1, w1:real^3}`); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `w2:real^3` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `~collinear {v0, v1, w2:real^3}`); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`] THEN + EXISTS_TAC `w1:real^3` THEN ASM_REWRITE_TAC[]); + (ASM_CASES_TAC `azim v0 v1 w1 (w2:real^3) < pi`); + (NEW_GOAL `wedge v0 v1 w1 w2 = aff_gt {v0, v1} {w1, w2:real^3}`); + (ASM_MESON_TAC[WEDGE_LUNE]); + (ASM_MESON_TAC[ CONIC_CAP_WEDGE_EQ_0]); + + (ASM_CASES_TAC `azim v0 v1 w1 (w2:real^3) > pi`); + (NEW_GOAL `azim v0 v1 w2 (w1:real^3) = + (if azim v0 v1 w1 w2 = &0 then &0 else &2 * pi - azim v0 v1 w1 w2)`); + (MATCH_MP_TAC AZIM_COMPL); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN COND_CASES_TAC); + (UNDISCH_TAC `azim v0 v1 w1 (w2:real^3) > pi` THEN ASM_REWRITE_TAC[]); + (MESON_TAC[PI_POS_LE; REAL_ARITH `&0 > a <=> ~(&0 <= a)`]); + (STRIP_TAC); + (NEW_GOAL `azim v0 v1 w2 (w1:real^3) < pi`); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `wedge v0 v1 w2 w1 = aff_gt {v0, v1} {w1, w2:real^3}`); + (REWRITE_WITH `{w1, w2:real^3} = {w2, w1}`); + (SET_TAC[]); + + (UNDISCH_TAC `~coplanar {v0, v1, w1, w2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_MESON_TAC[WEDGE_LUNE]); + + (UNDISCH_TAC `~coplanar {v0, v1, w1, w2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_MESON_TAC[ CONIC_CAP_WEDGE_EQ_0]); + + (NEW_GOAL `azim v0 v1 w1 (w2:real^3) = pi`); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[AZIM_EQ_0_PI_IMP_COPLANAR])]);; + +(* ==================================================================== *) +(* Lemma 35 *) + +let CONIC_CAP_INTER_CONVEX_HULL_4_GT_0 = prove_by_refinement ( + `!u0:real^3 u1 w1 w2 r a. + &0 < r /\ a < &1 /\ &0 <= a /\ ~coplanar {u0, u1, w1, w2} ==> + vol (conic_cap u0 u1 r a INTER convex hull {u0, u1, w1, w2}) > &0`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `measurable + (conic_cap u0 u1 r a INTER convex hull {u0, u1, w1, w2:real^3})`); + (MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[MEASURABLE_CONIC_CAP; MEASURABLE_CONVEX_HULL]); + (SIMP_TAC[MEASURABLE_CONVEX_HULL;FINITE_IMP_BOUNDED;Geomdetail.FINITE6]); + (REWRITE_TAC[REAL_ARITH `a > &0 <=> &0 <= a /\ ~(a = &0)`]); + (ASM_SIMP_TAC[MEASURE_POS_LE]); + (REWRITE_WITH + `vol (conic_cap u0 u1 r a INTER convex hull {u0, u1, w1, w2}) = &0 <=> + NULLSET (conic_cap u0 u1 r a INTER convex hull {u0, u1, w1, w2})`); + (ASM_SIMP_TAC[MEASURABLE_MEASURE_EQ_0]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `~(u0 = u1:real^3)`); + (STRIP_TAC); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}` THEN REWRITE_TAC[]); + (REWRITE_WITH `{u0, u1, w1, w2} = {u1:real^3, w1, w2}`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[COPLANAR_3]); + + (NEW_GOAL `?r1 a1. &0 < r1 /\ a1 < &1 /\ + conic_cap u0 u1 r1 a1 INTER aff_ge {u0, u1} {w1, w2:real^3} = + conic_cap u0 u1 r1 a1 INTER convex hull {u0, u1,w1, w2} /\ + conic_cap u0 u1 r1 a1 SUBSET conic_cap u0 u1 r a`); + (ABBREV_TAC `s = closest_point (affine hull {u1, w1, w2:real^3}) u0`); + (ABBREV_TAC `r2 = dist (u0:real^3, s)`); + (ABBREV_TAC `r1 = min r2 r`); + (ABBREV_TAC `s2 = smallest_angle_line w1 (w2:real^3) u0 u1`); + (ABBREV_TAC + `a2 = ((s2 - u0:real^3) dot (u1 - u0)) /(norm (s2 - u0) * norm (u1 - u0))`); + (ABBREV_TAC `a1 = max a2 a`); + (EXISTS_TAC `r1:real` THEN EXISTS_TAC `a1:real`); + (NEW_GOAL `&0 < r1 /\ a1 < &1`); + (EXPAND_TAC "r1" THEN EXPAND_TAC "a1"); + (REWRITE_TAC[REAL_ARITH `&0 < min a b <=> &0 < a /\ &0 < b`; + REAL_ARITH `max a b < &1 <=> a < &1 /\ b < &1`;]); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (EXPAND_TAC "r2"); + (MATCH_MP_TAC DIST_POS_LT); + (STRIP_TAC); + + (NEW_GOAL `u0 IN affine hull {u1, w1, w2:real^3}`); + (ASM_REWRITE_TAC[]); + (DEL_TAC THEN EXPAND_TAC "s"); + (MATCH_MP_TAC CLOSEST_POINT_IN_SET); + (REWRITE_TAC[CLOSED_AFFINE_HULL; AFFINE_HULL_EQ_EMPTY] THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_WITH `affine hull {u0, u1, w1, w2} = + affine hull {u1:real^3, w1, w2}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR; COPLANAR_3]); + + (EXPAND_TAC "a2"); + (MATCH_MP_TAC REAL_DIV_LT_1_TACTICS); + + (NEW_GOAL `s2 IN convex hull {w1, w2:real^3}`); + (MATCH_MP_TAC SMALLEST_ANGLE_IN_CONVEX_HULL); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_WITH `affine hull {u0, u1, w1, w2} = + affine hull {u1:real^3, w1, w2}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + (NEW_GOAL `convex hull {w1, w2} SUBSET affine hull {u1, w1, w2:real^3}`); + (NEW_GOAL `convex hull {w1, w2} SUBSET affine hull {w1, w2:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (NEW_GOAL `affine hull {w1, w2} SUBSET affine hull {u1, w1, w2:real^3}`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA); + (SET_TAC[]); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + (REWRITE_TAC[COPLANAR_3; COPLANAR_AFFINE_HULL_COPLANAR]); + + (NEW_GOAL `~(s2 = u0:real^3)`); + (STRIP_TAC); + (UNDISCH_TAC `s2 IN convex hull {w1, w2:real^3}` THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_WITH `affine hull {u0, u1, w1, w2} = + affine hull {u1:real^3, w1, w2}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + (NEW_GOAL `convex hull {w1, w2} SUBSET affine hull {u1, w1, w2:real^3}`); + (NEW_GOAL `convex hull {w1, w2} SUBSET affine hull {w1, w2:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (NEW_GOAL `affine hull {w1, w2} SUBSET affine hull {u1, w1, w2:real^3}`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA); + (SET_TAC[]); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + (REWRITE_TAC[COPLANAR_3; COPLANAR_AFFINE_HULL_COPLANAR]); + + (STRIP_TAC); + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + + (REWRITE_TAC[REAL_ARITH `a < b <=> (a <= b) /\ ~(a = b)`]); + (STRIP_TAC); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ]); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ_EQ]); + (STRIP_TAC); + + + (ABBREV_TAC `t1 = norm (s2 - u0:real^3)`); + (ABBREV_TAC `t2 = norm (u1 - u0:real^3)`); + (NEW_GOAL `~(t2 = &0)`); + (EXPAND_TAC "t2" THEN REWRITE_TAC[NORM_EQ_0; + VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `s2 = t1 / t2 % u1 + (t2 - t1) / t2 % u0:real^3`); + (REWRITE_TAC[VECTOR_ARITH `t1 / t2 % u1 + (t2 - t1) / t2 % u0:real^3 = + &1 / t2 % (t1 % u1 + (t2 - t1) % u0)`]); + (REWRITE_WITH `t1 % u1 + (t2 - t1) % u0 = t2 % (s2:real^3)`); + (UNDISCH_TAC `t1 % (u1 - u0) = t2 % (s2 - u0:real^3)` THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `&1 / t2 % t2 % s2 = (t2 / t2) % s2`]); + (REWRITE_WITH `t2 / t2 = &1`); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + (VECTOR_ARITH_TAC); + (UNDISCH_TAC `s2 IN convex hull {w1, w2:real^3}`); + (ASM_REWRITE_TAC[IN; CONVEX_HULL_2; IN_ELIM_THM]); + (STRIP_TAC); + (ABBREV_TAC `t = t1 / t2`); + (ABBREV_TAC `t' = (t1 - t2) / t2`); + + (NEW_GOAL `u1 IN affine hull {u0, w1, w2:real^3}`); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `t'/ t` THEN EXISTS_TAC `u / t` THEN EXISTS_TAC `v / t`); + (STRIP_TAC); + (ASM_REWRITE_TAC[REAL_ARITH `a / t + b/ t + c / t = (a + b + c) / t `]); + (REWRITE_WITH `t' + &1 = t`); + (EXPAND_TAC "t'" THEN EXPAND_TAC "t"); + (NEW_GOAL `t2 / t2 = &1`); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_DIV_REFL); + (EXPAND_TAC "t"); + (ONCE_REWRITE_TAC[REAL_ARITH `a / b = a * (&1 / b)`]); + (REWRITE_TAC[REAL_ENTIRE]); + (REWRITE_WITH `~(t1 = &0)`); + (EXPAND_TAC "t1" THEN REWRITE_TAC[NORM_EQ_0; VECTOR_ARITH + `a - b = vec 0 <=> a = b`] THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Trigonometry2.NOT_EQ0_IMP_NEITHER_INVERT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_ARITH `t' / t % u0 + u / t % w1 + v / t % w2 = + &1 / t % (t' % u0 + u % w1 + v % w2)`]); + (REWRITE_WITH `t' % u0 + u % w1 + v % w2 = t % u1:real^3`); + (EXPAND_TAC "t'"); + (UNDISCH_TAC `t % u1 + (t2 - t1) / t2 % u0 = u % w1 + v % w2:real^3` + THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `&1 / t % t % u = t / t % u`]); + (REWRITE_WITH `t / t = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (EXPAND_TAC "t"); + (ONCE_REWRITE_TAC[REAL_ARITH `a / b = a * (&1 / b)`]); + (REWRITE_TAC[REAL_ENTIRE]); + (REWRITE_WITH `~(t1 = &0)`); + (EXPAND_TAC "t1" THEN REWRITE_TAC[NORM_EQ_0; VECTOR_ARITH + `a - b = vec 0 <=> a = b`] THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Trigonometry2.NOT_EQ0_IMP_NEITHER_INVERT); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {b,a,c,d}`]); + + (REWRITE_WITH `affine hull {u1, u0, w1, w2} = + affine hull {u0:real^3, w1, w2}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[COPLANAR_3; COPLANAR_AFFINE_HULL_COPLANAR]); + + (NEW_GOAL `conic_cap (u0:real^3) u1 r1 a1 SUBSET conic_cap u0 u1 r a`); + (REWRITE_TAC[conic_cap; NORMBALL_BALL] THEN MATCH_MP_TAC + (SET_RULE `a SUBSET b /\ c SUBSET d ==> a INTER c SUBSET b INTER d`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r1" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "a1" THEN REAL_ARITH_TAC); + + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[SET_RULE `b = a <=> a SUBSET b /\ b SUBSET a`]); + (STRIP_TAC); + (MATCH_MP_TAC (SET_RULE `a SUBSET b ==> x INTER a SUBSET x INTER b`)); + (REWRITE_TAC[Marchal_cells_2_new.CONVEX_HULL_4_SUBSET_AFF_GE_2_2]); + (REWRITE_TAC[SUBSET; IN_INTER]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (UP_ASM_TAC); + (NEW_GOAL `DISJOINT {u0, u1:real^3} {w1, w2}`); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `w1 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_WITH `{u0, u1, w1, w2:real^3} = {u0, u1, w2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_CASES_TAC `w2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_WITH `{u0, u1, w1, w2:real^3} = {u0, u1, w1:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_SET_TAC[]); + + (ASM_SIMP_TAC[Marchal_cells_2.AFF_GE_2_2; CONVEX_HULL_4; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN + EXISTS_TAC `t3:real` THEN EXISTS_TAC `t4:real`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= t <=> ~(t < &0)`] THEN STRIP_TAC); + (NEW_GOAL `!x. x IN affine hull {u1, w1, w2} ==> + dist (u0,s:real^3) <= dist (u0,x:real^3)`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "s"); + (MATCH_MP_TAC CLOSEST_POINT_LE); + (ASM_REWRITE_TAC[CLOSED_AFFINE_HULL]); + + (NEW_GOAL `&1 < t2 + t3+ t4`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `~(t2 + t3+ t4 = &0)`); + (ASM_REAL_ARITH_TAC); + + (ABBREV_TAC `y = t2 / (t2 + t3 + t4) % u1 + t3 / (t2 + t3 + t4) % w1 + + t4 / (t2 + t3 + t4) % w2:real^3`); + (NEW_GOAL `x = t1 % u0 + (t2 + t3 + t4) % (y:real^3)`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_ARITH + `t1 % u0 + t2 % u1 + t3 % w1 + t4 % w2 = + t1 % u0 + t % (t2 / t % u1 + t3 / t % w1 + t4 / t % w2) <=> + t2 % u1 + t3 % w1 + t4 % w2 = t / t % (t2 % u1 + t3 % w1 + t4 % w2)`]); + (REWRITE_WITH `(t2 + t3 + t4) / (t2 + t3 + t4) = &1`); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `y IN affine hull {u1, w1, w2:real^3}`); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `t2 / (t2 + t3 + t4)` THEN + EXISTS_TAC `t3 / (t2 + t3 + t4)` THEN EXISTS_TAC `t4 / (t2 + t3 + t4)`); + (ASM_REWRITE_TAC[REAL_ARITH `a/x + b/ x + c/ x = (a+b+c) / x`]); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + + (NEW_GOAL `dist (u0, s:real^3) <= dist (u0, y:real^3)`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `dist (u0, s) <= dist (u0, x:real^3)`); + (REWRITE_TAC[ASSUME `x = t1 % u0 + (t2 + t3 + t4) % y:real^3`; dist]); + (REWRITE_WITH `u0 - (t1 % u0 + (t2 + t3 + t4) % y) = + (t1 + t2 + t3 + t4) % u0 - (t1 % u0 + (t2 + t3 + t4) % y:real^3)`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH + `(t1 + t) % u0 - (t1 % u0 + t % y) = t % (u0 - y)`; NORM_MUL]); + (REWRITE_WITH `abs (t2 + t3 + t4) = t2 + t3 + t4`); + (REWRITE_TAC[REAL_ABS_REFL] THEN ASM_REAL_ARITH_TAC); + (REWRITE_TAC[GSYM dist]); + (NEW_GOAL `dist (u0, y:real^3) <= (t2 + t3 + t4) * dist (u0, y)`); + (REWRITE_TAC[REAL_ARITH `a <= b * a <=> &0 <= (b - &1) * a`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `x IN ball (u0:real^3, r1)`); + (UNDISCH_TAC `x IN conic_cap u0 (u1:real^3) r1 a1`); + (REWRITE_TAC[conic_cap; NORMBALL_BALL] THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL]); + (EXPAND_TAC "r1" THEN EXPAND_TAC "r2"); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + +(* ========================================================================= *) +(* OK here *) + + (REWRITE_TAC[REAL_ARITH `&0 <= t <=> ~(t < &0)`] THEN STRIP_TAC); + (NEW_GOAL `!y. y IN convex hull {w1, w2:real^3} + ==> ((y - u0) dot (u1 - u0)) / (norm (y - u0) * norm (u1 - u0)) <= + ((s2 - u0) dot (u1 - u0)) / (norm (s2 - u0) * norm (u1 - u0))`); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC SMALLEST_ANGLE_LINE_PROPERTY); + (EXISTS_TAC `w1:real^3` THEN EXISTS_TAC `w2:real^3`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_WITH `affine hull {u0, u1, w1, w2} = + affine hull {u1:real^3, w1, w2}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + (NEW_GOAL `convex hull {w1, w2:real^3} SUBSET affine hull {u1,w1, w2}`); + (NEW_GOAL `convex hull {w1, w2:real^3} SUBSET affine hull {w1, w2}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (NEW_GOAL `affine hull {w1, w2:real^3} SUBSET affine hull {u1,w1, w2}`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA THEN SET_TAC[]); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR; COPLANAR_3]); + + (NEW_GOAL `~(t3+ t4 = &0)`); + (STRIP_TAC); + (NEW_GOAL `t3 = &0 /\ t4 = &0`); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `x = t1 % u0 + t2 % u1:real^3`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (NEW_GOAL `x:real^3 IN rcone_gt u0 u1 a1`); + (UNDISCH_TAC `x:real^3 IN conic_cap u0 u1 r1 a1`); + (REWRITE_TAC[conic_cap] THEN SET_TAC[conic_cap]); + (UP_ASM_TAC THEN REWRITE_TAC[rcone_gt; rconesgn; IN; IN_ELIM_THM] THEN STRIP_TAC); + + (NEW_GOAL `(x - u0) dot (u1 - u0:real^3) <= &0`); + (REWRITE_TAC[ASSUME `x = t1 % u0 + t2 % u1:real^3`]); + (REWRITE_WITH `(t1 % u0 + t2 % u1) - u0 = + (t1 % u0 + t2 % u1) - (t1 + t2 + t3 + t4) % u0:real^3`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[ASSUME `t3 = &0 /\ t4 = &0`; VECTOR_ARITH + `(t1 % u0 + t2 % u1) - (t1 + t2 + &0 + &0) % u0 = t2 % (u1 - u0)`; DOT_LMUL; + REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DOT_POS_LE] THEN ASM_REAL_ARITH_TAC); + (NEW_GOAL `&0 <= dist (x,u0) * dist (u1,u0:real^3) * a1`); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (ABBREV_TAC `y = t3 / (t3 + t4) % w1 + t4 / (t3 + t4) % w2:real^3`); + (NEW_GOAL `x = t1 % u0 + t2 % u1 + (t3 + t4) % (y:real^3)`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_ARITH + `t1 % u0 + t2 % u1 + t3 % w1 + t4 % w2 = + t1 % u0 + t2 % u1 + t % (t3 / t % w1 + t4 / t % w2) <=> + t3 % w1 + t4 % w2 = t / t % (t3 % w1 + t4 % w2)`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `y IN convex hull {w1, w2:real^3}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM]); + (EXISTS_TAC `t3 / (t3 + t4)` THEN EXISTS_TAC `t4 / (t3 + t4)`); + (ASM_REWRITE_TAC[REAL_ARITH `a / x + b / x = (a + b) / x`]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + + (ABBREV_TAC `f = (\y:real^3. + ((y - u0) dot (u1 - u0)) / (norm (y - u0:real^3) * norm (u1 - u0)))`); + + (NEW_GOAL `a1 < (f:real^3->real) x`); + (NEW_GOAL `x:real^3 IN rcone_gt u0 u1 a1`); + (UNDISCH_TAC `x:real^3 IN conic_cap u0 u1 r1 a1` THEN + REWRITE_TAC[conic_cap] THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[rcone_gt; rconesgn; IN; IN_ELIM_THM; dist]); + (STRIP_TAC THEN EXPAND_TAC "f"); + (REWRITE_WITH + `a1 < ((x - u0) dot (u1 - u0)) / (norm (x - u0) * norm (u1 - u0)) <=> + a1 * (norm (x - u0) * norm (u1 - u0)) < ((x - u0:real^3) dot (u1 - u0))`); + (MATCH_MP_TAC REAL_LT_RDIV_EQ); + (MATCH_MP_TAC REAL_LT_MUL); + (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `a < b <=> (a <= b) /\ ~(b = a)`]); + (SIMP_TAC[NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (NEW_GOAL `u1 IN affine hull {u0, w1, w2:real^3}`); + (REWRITE_TAC[IN; IN_ELIM_THM; AFFINE_HULL_3]); + + (EXISTS_TAC `(t2 + t3 + t4) / t2` THEN EXISTS_TAC `(--t3) / t2` + THEN EXISTS_TAC `(--t4) / t2`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH + `(t2 + t3 + t4) / t2 + --t3 / t2 + --t4 / t2 = t2 / t2`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_WITH `(t2 + t3 + t4) = &1 - t1`); + (UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (NEW_GOAL `u0 - t1 % u0 - t3 % w1 - t4 % w2:real^3 = t2 % u1`); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(&1 - t1) / t2 % u0 + --t3 / t2 % u2 + --t4 / t2 % u3 = + (&1 / t2) % (u0 - t1 % u0 - t3 % u2 - t4 % u3)`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `t2 / t2 = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {b,a,c,d}`]); + (ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_WITH `affine hull {u1, u0, w1, w2} = + affine hull {u0:real^3, w1, w2}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[COPLANAR_3; COPLANAR_AFFINE_HULL_COPLANAR]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `(f:real^3->real) y <= f s2`); + (EXPAND_TAC "f"); + (ASM_SIMP_TAC[]); + + (NEW_GOAL `&1 < t1 + t3+ t4`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `~(t1 + t3+ t4 = &0)`); + (ASM_REAL_ARITH_TAC); + + (ABBREV_TAC `w = t1 / (t1 + t3 + t4) % u0 + t3 / (t1 + t3 + t4) % w1 + + t4 / (t1 + t3 + t4) % w2:real^3`); + + (NEW_GOAL `(f:real^3->real) y = f w`); + (EXPAND_TAC "f"); + + (REWRITE_WITH `y:real^3 - u0 = + &1 / (t3 + t4) % (t3 % w1 + t4 % w2 - (t3 + t4) % u0)`); + (EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_ARITH + `(t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3) - u0 = + &1 / (t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0) <=> + (t3 + t4) / (t3 + t4) % u0 = u0`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; DOT_LMUL]); + + (REWRITE_WITH `w:real^3 - u0 = + &1 / (t1 + t3 + t4) % (t3 % w1 + t4 % w2 - (t3 + t4) % u0)`); + (EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `(t1 / (t1 + t3 + t4) % u0 + + t3 / (t1 + t3 + t4) % u2 + t4 / (t1 + t3 + t4) % u3) - u0 = + &1 / (t1 + t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0) <=> + (t1 + t3 + t4) / (t1 + t3 + t4) % u0 = u0`]); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; DOT_LMUL]); + (REWRITE_WITH `abs (&1 / (t3 + t4)) = &1 / (t3 + t4)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_SIMP_TAC[REAL_LE_DIV;REAL_LE_ADD; REAL_ARITH `&0 <= &1`]); + (REWRITE_WITH `abs (&1 / (t1 + t3 + t4)) = &1 / (t1 + t3 + t4)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (MATCH_MP_TAC REAL_LE_DIV THEN REWRITE_TAC[REAL_ARITH `&0 <= &1`]); + (ASM_REAL_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH `(a * x) / ((a * y) * z) = + (a * x) / (a * (y * z))`]); + (ABBREV_TAC + `b1 = norm (t3 % w1 + t4 % w2 - (t3 + t4) % u0) * norm (u1 - u0:real^3)`); + (NEW_GOAL `~(b1 = &0)`); + (EXPAND_TAC "b1" THEN ASM_REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; + VECTOR_ARITH `(a - b = vec 0 <=> a = b)/\(a + b-c = vec 0 <=> a + b = c)`]); + (STRIP_TAC); + + (NEW_GOAL `u0 IN convex hull {w1, w2:real^3}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM]); + (EXISTS_TAC `t3 / (t3 + t4)` THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV THEN ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV THEN ASM_REAL_ARITH_TAC); + (ASM_SIMP_TAC[REAL_DIV_REFL; REAL_ARITH `a / x + b / x = (a + b) / x`]); + (SIMP_TAC[VECTOR_ARITH `a/ x % u + b/ x % v = &1/ x % (a % u + b % v)`]); + (REWRITE_TAC[ASSUME `t3 % w1 + t4 % w2 = (t3 + t4) % u0:real^3`; VECTOR_ARITH + `&1 / a % (a % b) = (a / a) % b`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + (VECTOR_ARITH_TAC); + + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_WITH `affine hull {u0, u1, w1, w2} = + affine hull {u1:real^3, w1, w2}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + (NEW_GOAL `convex hull {w1, w2:real^3} SUBSET affine hull {u1,w1, w2}`); + (NEW_GOAL `convex hull {w1, w2:real^3} SUBSET affine hull {w1, w2}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (NEW_GOAL `affine hull {w1, w2:real^3} SUBSET affine hull {u1,w1, w2}`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA THEN SET_TAC[]); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR; COPLANAR_3]); + + (NEW_GOAL `~(&1 / (t3 + t4) = &0)`); + (MATCH_MP_TAC Trigonometry2.NOT_EQ0_IMP_NEITHER_INVERT); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `(&1 / (t3 + t4) * ((t3 % w1 + t4 % w2 - (t3 + t4) % u0) dot (u1 - u0))) / + (&1 / (t3 + t4) * b1) = + ((t3 % w1 + t4 % w2 - (t3 + t4) % u0) dot (u1 - u0:real^3)) / b1`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[Trigonometry1.REAL_DIV_MUL2]); + + (NEW_GOAL `~(&1 / (t1 + t3 + t4) = &0)`); + (MATCH_MP_TAC Trigonometry2.NOT_EQ0_IMP_NEITHER_INVERT); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `(&1 / (t1 + t3 + t4) * ((t3 % w1 + t4 % w2 - (t3 + t4) % u0) dot (u1 - u0))) / + (&1 / (t1 + t3 + t4) * b1) = + ((t3 % w1 + t4 % w2 - (t3 + t4) % u0) dot (u1 - u0:real^3)) / b1`); + (UP_ASM_TAC THEN UNDISCH_TAC `~(b1 = &0)` THEN + MESON_TAC[Trigonometry1.REAL_DIV_MUL2]); + + (NEW_GOAL `(f:real^3->real) x <= f w`); + (EXPAND_TAC "f"); + + (REWRITE_WITH + `((x - u0) dot (u1 - u0:real^3)) / (norm (x - u0) * norm (u1 - u0)) <= + ((w - u0) dot (u1 - u0)) / (norm (w - u0) * norm (u1 - u0)) <=> + ((x - u0) dot (u1 - u0)) * (norm (w - u0) * norm (u1 - u0)) <= + ((w - u0) dot (u1 - u0)) * (norm (x - u0) * norm (u1 - u0))`); + (MATCH_MP_TAC RAT_LEMMA4); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `x - b = vec 0 <=> x = b`]); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}` THEN REWRITE_TAC[]); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `w1:real^3` THEN + EXISTS_TAC `w2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u0, u1, u2, u3} = {u1, u0, u2, u3}`]); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `(t2 + t3 + t4) / t2` THEN EXISTS_TAC `(--t3) / t2` + THEN EXISTS_TAC `(--t4) / t2`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH + `(t2 + t3 + t4) / t2 + --t3 / t2 + --t4 / t2 = t2 / t2`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_WITH `(t2 + t3 + t4) = &1 - t1`); + (UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (NEW_GOAL `u0 - t1 % u0 - t3 % w1 - t4 % w2:real^3 = t2 % u1`); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(&1 - t1) / t2 % u0 + --t3 / t2 % u2 + --t4 / t2 % u3 = + (&1 / t2) % (u0 - t1 % u0 - t3 % u2 - t4 % u3)`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `t2 / t2 = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (MATCH_MP_TAC REAL_LT_MUL); + (REWRITE_TAC[REAL_ARITH `&0 < a <=> (&0 <= a) /\ ~(a = &0)`]); + (REWRITE_TAC[NORM_POS_LE; NORM_EQ_0; VECTOR_ARITH `x - y= vec 0 <=>x = y`]); + (STRIP_TAC); + + (EXPAND_TAC "w" THEN STRIP_TAC); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `w1:real^3` THEN + EXISTS_TAC `w2:real^3`); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + + (EXISTS_TAC `&0` THEN EXISTS_TAC `t3 / (t3 + t4)` + THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 + t3 / (t3 + t4) + t4 / (t3 + t4) = + (t3 + t4) / (t3 + t4)`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[VECTOR_ARITH + `&0 % u1 + t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3 = + (&1 / (t3 + t4)) % (t3 % u2 + t4 % u3)`]); + (UP_ASM_TAC THEN REWRITE_TAC[VECTOR_ARITH + `t1 / x % u0 + t3 / x % u2 + t4 / x % u3 = + (&1 / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `&1 / (t1 + t3 + t4) % (t1 % u0 + t3 % w1 + t4 % w2) = u0 <=> + t1 % u0 + t3 % w1 + t4 % w2 = (t1 + t3 + t4) % u0:real^3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.CHANGE_SIDE); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[VECTOR_ARITH `t1 % u0 + t3 % u2 + t4 % u3 = (t1 + t3 + t4) % u0 + <=> t3 % u2 + t4 % u3 = (t3 + t4) % u0`]); + (STRIP_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `x = t2 % u1 + (t1 + t3 + t4) % w:real^3`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `x % (t1 /x % u0 + t3 / x % u2 + t4 /x % u3) = + (x / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + (VECTOR_ARITH_TAC); + (ABBREV_TAC `t = t1 + t3 + t4`); + (REWRITE_WITH `(t2 % u1 + t % w) - u0:real^3 = + (t2 % u1 + t % w) - (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `t1 + t2 + t3 + t4 = t2 + t:real`); + (EXPAND_TAC "t" THEN REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH + `(t2 % u1 + t % w) - (t2 + t) % u0 = t2 % (u1 - u0) + t % (w - u0)`]); + (ABBREV_TAC `x1 = u1 - u0:real^3`); + (ABBREV_TAC `x2 = w - u0:real^3`); + + (REWRITE_WITH `(t2 % x1 + t % x2) dot x1 = + t2 * norm x1 pow 2 + t * x2 dot (x1:real^3)`); + (REWRITE_TAC[NORM_POW_2]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `t2 * norm x1 pow 2 * norm x2 * norm x1 <= + t2 * (x2 dot x1) * norm x1 * norm (x1:real^3)`); + (REWRITE_TAC[REAL_POW_2; REAL_ARITH `t2 * (x1 * x1) * x2 * x1 <= + t2 * x3 * x1 * x1 <=> &0 <= (x1 pow 2) * (--t2) * (x2 * x1 - x3)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[REAL_LE_MUL; NORM_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (STRIP_TAC); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ]); + + (NEW_GOAL + `t2 * (x2 dot x1) * norm x1 * norm x1 + t * (x2 dot x1) * norm x2 * norm x1 <= (x2 dot x1) * norm (t2 % x1 + t % x2) * norm (x1:real^3)`); + + (REWRITE_TAC[REAL_ARITH `t2 * x3 * x1 * x1 + t * x3 * x2 * x1 <= + x3 * x4 * x1 <=> &0 <= (x1 * x3) * (x4 - t2 * x1 - t * x2)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_CASES_TAC `x2 dot (x1:real^3) < &0`); + (NEW_GOAL `F`); + (NEW_GOAL `(f:real^3->real) x <= &0`); + (EXPAND_TAC "f"); + (REWRITE_TAC[REAL_ARITH `a / b <= &0 <=> &0 <= (--a) / b`]); + (MATCH_MP_TAC REAL_LE_DIV); + (SIMP_TAC[NORM_POS_LE; REAL_LE_MUL]); + + (REWRITE_WITH `x = t2 % u1 + (t1 + t3 + t4) % w:real^3`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `x % (t1 /x % u0 + t3 / x % u2 + t4 /x % u3) = + (x / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (EXPAND_TAC "t"); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= --a <=> a <= &0`]); + (REWRITE_WITH `(t2 % u1 + (t1 + t3 + t4) % w) - u0:real^3 = + (t2 % u1 + (t1 + t3 + t4) % w) - (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `(t2 % u1 + (t1 + t3 + t4) % w) - (t1 + t2 + t3 + t4) % u0 = + t2 % x1 + t % x2:real^3`); + (EXPAND_TAC "x1" THEN EXPAND_TAC "x2" THEN EXPAND_TAC "t" + THEN VECTOR_ARITH_TAC); + (NEW_GOAL `t % x2 dot (x1:real^3) <= &0`); + (REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= a * (--b)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (NEW_GOAL `t2 % x1 dot (x1:real^3) <= &0`); + (REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (REWRITE_TAC[DOT_POS_LE]); + (REWRITE_TAC[DOT_LADD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (UP_ASM_TAC THEN UNDISCH_TAC `a1 < (f:real^3->real) x`); + (EXPAND_TAC "a1" THEN UNDISCH_TAC `&0 <= a` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (REWRITE_TAC [REAL_ARITH `&0 <= a - b * d - c <=> c <= a + (--b) * d`]); + (REWRITE_WITH `t * norm (x2:real^3) = abs t * norm x2`); + (AP_THM_TAC THEN AP_TERM_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[REAL_ABS_REFL]); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (REWRITE_WITH `(--t2) * norm (x1:real^3) = abs (--t2) * norm x1`); + (AP_THM_TAC THEN AP_TERM_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[REAL_ABS_REFL]); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_TAC[GSYM NORM_MUL]); + (REWRITE_WITH + `norm (t % x2:real^3) = norm ((t2 % x1 + t % x2) + (--t2 % x1))`); + (AP_TERM_TAC THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_TRIANGLE]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `(f:real^3->real) x <= f s2`); + (UNDISCH_TAC `(f:real^3->real) y <= f s2`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `(f:real^3->real) s2 <= a1`); + (EXPAND_TAC "f"); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "a1" THEN REAL_ARITH_TAC); + + (UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC `a1 < (f:real^3->real) x`); + (REAL_ARITH_TAC); + + (UP_ASM_TAC THEN STRIP_TAC); + +(* ========================================================================= *) + + (NEW_GOAL + `NULLSET (conic_cap u0 u1 r1 a1 INTER aff_ge {u0:real^3, u1} {w1, w2})`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `conic_cap u0 u1 r a INTER convex hull {u0:real^3, u1, w1, w2}`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (NEW_GOAL `vol (conic_cap u0 u1 r1 a1 INTER aff_ge {u0, u1} {w1, w2}) = &0`); + (ASM_SIMP_TAC[MEASURE_EQ_0]); + + (UP_ASM_TAC THEN REWRITE_WITH + `vol (conic_cap u0 u1 r1 a1 INTER aff_ge {u0, u1} {w1, w2}) = + vol (conic_cap u0 u1 r1 a1 INTER aff_gt {u0, u1} {w1, w2})`); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + (REWRITE_WITH `conic_cap u0 u1 r1 a1 INTER aff_gt {u0, u1} {w1, w2} DIFF + conic_cap u0 u1 r1 a1 INTER aff_ge {u0, u1:real^3} {w1, w2} = + {}`); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> (C INTER A) DIFF (C INTER B) = {}`)); + (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]); + (REWRITE_TAC[SET_RULE `a UNION {} = a`]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `aff_ge {u0, u1:real^3} {w1, w2} DIFF + aff_gt {u0, u1} {w1, w2}`); + (REWRITE_TAC[SET_RULE `A INTER B DIFF A INTER C SUBSET B DIFF C`]); + + (REWRITE_WITH `aff_ge {u0, u1:real^3} {w1, w2} = + aff_gt {u0, u1} {w1, w2} UNION + UNIONS {aff_ge {u0, u1} ({w1, w2} DELETE a) | a | a IN {w1, w2}}`); + (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[DISJOINT]); + + (ASM_CASES_TAC `w1 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_WITH `{u0, u1, w1, w2} = {u0, u1, w2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `w2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_WITH `{u0, u1, w1, w2} = {u0, u1, w1:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({w1, w2} DELETE a) | a | a IN {w1, w2}}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + + (EXISTS_TAC + `aff_ge {u0, u1:real^3} {w1} UNION aff_ge {u0, u1:real^3} {w2}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, w1}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,w1:real^3} = {u0,u1} UNION {w1}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, w2}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,w2:real^3} = {u0,u1} UNION {w2}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`)); + (STRIP_TAC); + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `w1 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_WITH `{u0, u1, w1, w2} = {u0, u1, w2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `w2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_WITH `{u0, u1, w1, w2} = {u0, u1, w1:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (SET_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}` THEN REWRITE_TAC[]); + (MATCH_MP_TAC CONIC_CAP_AFF_GT_EQ_0); + (EXISTS_TAC `a1:real` THEN EXISTS_TAC `r1:real`); + (ASM_REWRITE_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 36 *) + +let MEASURABLE_BALL_AFF_GE = prove + (`!z r s t. measurable(ball(z,r) INTER aff_ge s t)`, + MESON_TAC[MEASURABLE_CONVEX; CONVEX_INTER; CONVEX_AFF_GE; CONVEX_BALL; + BOUNDED_INTER; BOUNDED_BALL]);; + +(* ==================================================================== *) +(* Currently added lemmas *) +(* Lemma 37 *) + +let FINITE_LIST_KY_LEMMA_2 = prove + (`!s:A->bool. + FINITE s + ==> FINITE + {y | ?u0 u1. + u0 IN s /\ + u1 IN s /\ + y = [u0; u1]}`, + REWRITE_TAC[SET_RULE + `{y | ?u0 u1. u0 IN s /\ u1 IN s /\ y = [u0; u1]} = + {[u0;u1] | u0 IN s /\ u1 IN s}`] THEN + REPEAT + (GEN_TAC THEN DISCH_TAC THEN + MATCH_MP_TAC FINITE_PRODUCT_DEPENDENT THEN ASM_REWRITE_TAC[]));; + +let FINITE_SET_PRODUCT_KY_LEMMA = prove ( + `!s:A->bool. + FINITE s ==> FINITE {{u0, u1:A} | u0 IN s /\ u1 IN s}`, + REPEAT + (GEN_TAC THEN DISCH_TAC THEN + MATCH_MP_TAC FINITE_PRODUCT_DEPENDENT THEN ASM_REWRITE_TAC[]));; + + +(* ==================================================================== *) +(* Lemma 38: BETA_PAIR_THM - formal proof by TCHales *) + +let pre_beta = prove_by_refinement +(`!g u' v'. (?f. (!u v. f { u, v } = (g:A->A->B) u v)) ==> + ((\ { u, v}. g u v) {u',v'} = g u' v')`, +[REWRITE_TAC[GABS_DEF;GEQ_DEF]; + SELECT_ELIM_TAC; + MESON_TAC[]]);; + +let WELLDEFINED_FUNCTION_2 = prove_by_refinement( +`(?f:C->D. (!x:A y:B. f(s x y) = t x y)) <=> + (!x x' y y'. (s x y = s x' y') ==> t x y = t x' y')`, +[ MATCH_MP_TAC EQ_TRANS ; + EXISTS_TAC `?f:C->D. !z. !x:A y:B. (s x y = z) ==> f z = t x y`; + CONJ_TAC; + MESON_TAC[]; + REWRITE_TAC[GSYM SKOLEM_THM]; + MESON_TAC[]]);; + +let well_defined_unordered_pair = prove_by_refinement +(`(?f. (!u v. f { u, v} = (g:A->A->B) u v)) <=> + (! u v. g u v = g v u)`, +[REWRITE_TAC[WELLDEFINED_FUNCTION_2]; + NEW_GOAL `!u v x' y'. + {u,v} = {x',y'} <=> (u:A = x' /\ v = y')\/ (u = y' /\ v = x')`; + SET_TAC[]; + ASM_REWRITE_TAC[]; + MESON_TAC[]]);; + +let BETA_PAIR_THM = prove_by_refinement( +`!g u' v'. (!u v. (g:A->A->B) u v = g v u) ==> + ((\ { u, v}. g u v) {u',v'} = g u' v')`, +[REPEAT STRIP_TAC; + MATCH_MP_TAC pre_beta; + REWRITE_TAC[well_defined_unordered_pair]; + ASM_REWRITE_TAC[]]);; + +(* ==================================================================== *) +(* Lemma 39 *) + +let DIHX_RANGE = prove_by_refinement ( + `!V X u v. &0 <= dihX V X (u,v) /\ dihX V X (u,v) <= pi`, +[(REWRITE_TAC[dihX] THEN REPEAT GEN_TAC); + (COND_CASES_TAC); + (REWRITE_TAC[PI_POS_LE; REAL_ARITH `a <= a`]); + (REPEAT LET_TAC THEN COND_CASES_TAC); + (REWRITE_TAC[dihu2; DIHV_RANGE]); + (COND_CASES_TAC); + (REWRITE_TAC[dihu3; DIHV_RANGE]); + (COND_CASES_TAC); + (REWRITE_TAC[dihu4; DIHV_RANGE]); + (REWRITE_TAC[PI_POS_LE; REAL_ARITH `a <= a`])]);; + +let DIHX_LE_PI = prove (`!V X u v. dihX V X (u,v) <= pi`, + MESON_TAC[DIHX_RANGE]);; + +(* ==================================================================== *) +(* Lemma 40 *) + +let BOUNDED_VOLUME_MCELL = prove_by_refinement ( + `!V. ?c. !X. saturated V /\ packing V /\ mcell_set V X ==> vol X <= c`, +[(GEN_TAC); + (ASM_CASES_TAC `saturated V /\ packing V`); + (EXISTS_TAC `&4 / &3 * pi * &8 pow 3`); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[mcell_set_2; IN_ELIM_THM; IN]); + (STRIP_TAC); + (ASM_CASES_TAC `X:real^3->bool = {}`); + (REWRITE_TAC[MEASURE_EMPTY; ASSUME `X:real^3->bool = {}`]); + (REWRITE_TAC[REAL_ARITH `&0 <= &4 / &3 * pi * &8 pow 3 <=> &0 <= pi`]); + (REWRITE_TAC[PI_POS_LE]); + (UP_ASM_TAC THEN REWRITE_TAC[SET_RULE `~(x = {}) <=> (?v. v IN x)`]); + (STRIP_TAC); + (NEW_GOAL `vol X <= vol (ball (v, &8))`); + (MATCH_MP_TAC MEASURE_SUBSET); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[] THEN MATCH_MP_TAC MEASURABLE_MCELL); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[MEASURABLE_BALL]); + (ASM_REWRITE_TAC[] THEN MATCH_MP_TAC MCELL_SUBSET_BALL8); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN SIMP_TAC[VOLUME_BALL; REAL_ARITH `&0 <= &8`]); + (EXISTS_TAC `&0`); + (REPEAT STRIP_TAC THEN ASM_MESON_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 41 *) + +let LEFT_ACTION_LIST_2_EXISTS = prove_by_refinement ( + `!u0 u1 u2 x y z d:A. + CARD {u0, u1, u2, d} = 4 /\ {x, y, z} = {u0, u1, u2} + ==> (?p. p permutes 0..2 /\ + [x; y; z; d] = left_action_list p [u0; u1; u2; d])`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[left_action_list; LENGTH; TABLE_4; + ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`]); + (NEW_GOAL `{u0, u1, u2:A} = + {EL 0 [u0;u1;u2;d] , EL 1 [u0;u1;u2;d], EL 2 [u0;u1;u2;d]}`); + (REWRITE_TAC[EL; HD; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`; TL]); + (NEW_GOAL `{x, y, z:A} = + {EL 0 [u0;u1;u2;d] , EL 1 [u0;u1;u2;d], EL 2 [u0;u1;u2;d]}`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?i1. i1 IN {0,1,2} /\ EL i1 [u0;u1;u2;d] = x:A`); + (UP_ASM_TAC THEN SET_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC THEN SWITCH_TAC); + (NEW_GOAL `?i2. i2 IN {0,1,2} /\ EL i2 [u0;u1;u2;d] = y:A`); + (UP_ASM_TAC THEN SET_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC THEN SWITCH_TAC); + (NEW_GOAL `?i3. i3 IN {0,1,2} /\ EL i3 [u0;u1;u2;d] = z:A`); + (UP_ASM_TAC THEN SET_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC THEN SWITCH_TAC); + + (NEW_GOAL `~(i1 = i2) /\ ~(i1 = i3) /\ ~(i2 = i3:num)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `{u0,u1,u2,d:A} = {x, z,d}`); + (ASM_SET_TAC[]); + (UNDISCH_TAC `CARD {u0,u1,u2,d:A} = 4` THEN ASM_REWRITE_TAC[]); + (MESON_TAC[Geomdetail.CARD3; ARITH_RULE `a <= 3 ==> ~(a = 4)`]); + (NEW_GOAL `{u0,u1,u2,d:A} = {x, y,d}`); + (ASM_SET_TAC[]); + (UNDISCH_TAC `CARD {u0,u1,u2,d:A} = 4` THEN ASM_REWRITE_TAC[]); + (MESON_TAC[Geomdetail.CARD3; ARITH_RULE `a <= 3 ==> ~(a = 4)`]); + (NEW_GOAL `{u0,u1,u2,d:A} = {x, y,d}`); + (ASM_SET_TAC[]); + (UNDISCH_TAC `CARD {u0,u1,u2,d:A} = 4` THEN ASM_REWRITE_TAC[]); + (MESON_TAC[Geomdetail.CARD3; ARITH_RULE `a <= 3 ==> ~(a = 4)`]); + (SWITCH_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REPEAT STRIP_TAC); + + (NEW_GOAL `{i1, i2, i3} = {0,1,2}`); + (ASM_SET_TAC[]); + + (ABBREV_TAC `p = (\i:num. if i = i1 then 0 + else if i = i2 then 1 + else if i = i3 then 2 + else i)`); + (NEW_GOAL `p i1 = 0 /\ p i2 = 1 /\ p (i3:num) = 2`); + (ASM_MESON_TAC[]); + + (EXISTS_TAC `p:num->num`); + (NEW_GOAL `p permutes 0..2`); + + (REWRITE_TAC[permutes; EXISTS_UNIQUE; IN_NUMSEG_0; + ARITH_RULE `a <= 2 <=> a = 0 \/ a = 1 \/ a = 2`; + SET_RULE `x = 0 \/ x = 1 \/ x = 2 <=> x IN {0,1,2}`]); + (NEW_GOAL `(!x. ~(x IN {0, 1, 2}) ==> p x = x)`); + (REPEAT STRIP_TAC); + (EXPAND_TAC "p"); + (COND_CASES_TAC); + (ASM_SET_TAC[]); + (COND_CASES_TAC); + (ASM_SET_TAC[]); + (COND_CASES_TAC); + (ASM_SET_TAC[]); + (REFL_TAC); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + + (ASM_CASES_TAC `y' = 0`); + (EXISTS_TAC `i1:num`); + (ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (ASM_CASES_TAC `y'' = i2:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 0` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i3:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 0` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `~(y'' IN {0,1,2})`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 0` THEN ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (ASM_SET_TAC[]); + + (ASM_CASES_TAC `y' = 1`); + (EXISTS_TAC `i2:num`); + (ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (ASM_CASES_TAC `y'' = i1:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 1` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i3:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 1` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `~(y'' IN {0,1,2})`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 1` THEN ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (ASM_SET_TAC[]); + + (ASM_CASES_TAC `y' = 2`); + (EXISTS_TAC `i3:num`); + (ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (ASM_CASES_TAC `y'' = i2:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 2` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i1:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 2` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `~(y'' IN {0,1,2})`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 2` THEN ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (ASM_SET_TAC[]); + + (NEW_GOAL `~(y' IN {0,1,2})`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (EXISTS_TAC `y':num`); + (ASM_SIMP_TAC[] THEN REPEAT STRIP_TAC); + + (ASM_CASES_TAC `y'' = i1:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = y'` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i2:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = y'` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i3:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = y'` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `(p:num->num) y'' = y''`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `inverse (p:num->num) 0 = i1 /\ + inverse p 1 = i2 /\ inverse p 2 = i3`); + (UP_ASM_TAC THEN MESON_TAC[PERMUTES_INVERSE_EQ; + ASSUME `(p:num->num) i1 = 0 /\ p i2 = 1 /\ p i3 = 2`]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `inverse (p:num->num) 3 = 3`); + (NEW_GOAL `p 3 = 3`); + (MP_TAC (ASSUME `p permutes 0..2`) THEN REWRITE_TAC[permutes]); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN_NUMSEG_0] THEN ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[PERMUTES_INVERSE_EQ]); + (REWRITE_TAC[EL;HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`])]);; + +(* ==================================================================== *) +(* Lemma 42 *) +let LEFT_ACTION_LIST_3_EXISTS = prove_by_refinement ( + `!u0 u1 u2 u3 x y z t:A. + CARD {u0, u1, u2, u3} = 4 /\ {x, y, z, t} = {u0, u1, u2, u3} + ==> (?p. p permutes 0..3 /\ + [x; y; z; t] = left_action_list p [u0; u1; u2; u3])`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[left_action_list; LENGTH; TABLE_4; + ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`]); + (NEW_GOAL `{u0, u1, u2, u3:A} = {EL 0 [u0;u1;u2;u3], EL 1 [u0;u1;u2;u3], + EL 2 [u0;u1;u2;u3], EL 3 [u0;u1;u2;u3]}`); + (REWRITE_TAC[EL; HD; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; TL]); + (NEW_GOAL `{x, y, z, t:A} = {EL 0 [u0;u1;u2;u3], EL 1 [u0;u1;u2;u3], + EL 2 [u0;u1;u2;u3], EL 3 [u0;u1;u2;u3]}`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?i1. i1 IN {0,1,2,3} /\ EL i1 [u0;u1;u2;u3] = x:A`); + (UP_ASM_TAC THEN SET_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC THEN SWITCH_TAC); + (NEW_GOAL `?i2. i2 IN {0,1,2,3} /\ EL i2 [u0;u1;u2;u3] = y:A`); + (UP_ASM_TAC THEN SET_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC THEN SWITCH_TAC); + (NEW_GOAL `?i3. i3 IN {0,1,2,3} /\ EL i3 [u0;u1;u2;u3] = z:A`); + (UP_ASM_TAC THEN SET_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC THEN SWITCH_TAC); + (NEW_GOAL `?i4. i4 IN {0,1,2,3} /\ EL i4 [u0;u1;u2;u3] = t:A`); + (UP_ASM_TAC THEN SET_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC THEN SWITCH_TAC); + + (NEW_GOAL `~(i1 = i2) /\ ~(i1 = i3) /\ ~(i1 = i4:num) /\ ~(i2 = i3) /\ + ~(i2 = i4) /\ ~(i3 = i4)`); + (REPEAT STRIP_TAC); + + (NEW_GOAL `x = y:A`); + (ASM_MESON_TAC[]); + (NEW_GOAL `{u0,u1,u2,u3:A} = {x, z,t}`); + (UNDISCH_TAC `{x, y, z, t:A} = {u0, u1, u2, u3}` THEN UP_ASM_TAC + THEN SET_TAC[]); + (UNDISCH_TAC `CARD {u0,u1,u2,u3:A} = 4` THEN + REWRITE_TAC[ASSUME `{u0, u1, u2, u3} = {x, z, t:A}`]); + (MESON_TAC[Geomdetail.CARD3; ARITH_RULE `a <= 3 ==> ~(a = 4)`]); + + (NEW_GOAL `x = z:A`); + (ASM_MESON_TAC[]); + (NEW_GOAL `{u0,u1,u2,u3:A} = {x, y,t}`); + (UNDISCH_TAC `{x, y, z, t:A} = {u0, u1, u2, u3}` THEN UP_ASM_TAC + THEN SET_TAC[]); + (UNDISCH_TAC `CARD {u0,u1,u2,u3:A} = 4` THEN + REWRITE_TAC[ASSUME `{u0, u1, u2, u3} = {x, y, t:A}`]); + (MESON_TAC[Geomdetail.CARD3; ARITH_RULE `a <= 3 ==> ~(a = 4)`]); + + (NEW_GOAL `x = t:A`); + (ASM_MESON_TAC[]); + (NEW_GOAL `{u0,u1,u2,u3:A} = {x, y, z}`); + (UNDISCH_TAC `{x, y, z, t:A} = {u0, u1, u2, u3}` THEN UP_ASM_TAC + THEN SET_TAC[]); + (UNDISCH_TAC `CARD {u0,u1,u2,u3:A} = 4` THEN + REWRITE_TAC[ASSUME `{u0, u1, u2, u3} = {x, y, z:A}`]); + (MESON_TAC[Geomdetail.CARD3; ARITH_RULE `a <= 3 ==> ~(a = 4)`]); + + (NEW_GOAL `y = z:A`); + (ASM_MESON_TAC[]); + (NEW_GOAL `{u0,u1,u2,u3:A} = {x, z,t}`); + (UNDISCH_TAC `{x, y, z, t:A} = {u0, u1, u2, u3}` THEN UP_ASM_TAC + THEN SET_TAC[]); + (UNDISCH_TAC `CARD {u0,u1,u2,u3:A} = 4` THEN + REWRITE_TAC[ASSUME `{u0, u1, u2, u3} = {x, z, t:A}`]); + (MESON_TAC[Geomdetail.CARD3; ARITH_RULE `a <= 3 ==> ~(a = 4)`]); + + (NEW_GOAL `y = t:A`); + (ASM_MESON_TAC[]); + (NEW_GOAL `{u0,u1,u2,u3:A} = {x, z,t}`); + (UNDISCH_TAC `{x, y, z, t:A} = {u0, u1, u2, u3}` THEN UP_ASM_TAC + THEN SET_TAC[]); + (UNDISCH_TAC `CARD {u0,u1,u2,u3:A} = 4` THEN + REWRITE_TAC[ASSUME `{u0, u1, u2, u3} = {x, z, t:A}`]); + (MESON_TAC[Geomdetail.CARD3; ARITH_RULE `a <= 3 ==> ~(a = 4)`]); + + (NEW_GOAL `z = t:A`); + (ASM_MESON_TAC[]); + (NEW_GOAL `{u0,u1,u2,u3:A} = {x, y,t}`); + (UNDISCH_TAC `{x, y, z, t:A} = {u0, u1, u2, u3}` THEN UP_ASM_TAC + THEN SET_TAC[]); + (UNDISCH_TAC `CARD {u0,u1,u2,u3:A} = 4` THEN + REWRITE_TAC[ASSUME `{u0, u1, u2, u3} = {x, y, t:A}`]); + (MESON_TAC[Geomdetail.CARD3; ARITH_RULE `a <= 3 ==> ~(a = 4)`]); + + (SWITCH_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REPEAT STRIP_TAC); + + (NEW_GOAL `{i1, i2, i3,i4} = {0,1,2,3}`); + (REWRITE_TAC[SET_EQ_LEMMA]); + (REPEAT STRIP_TAC); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + + (ABBREV_TAC `p = (\i:num. if i = i1 then 0 + else if i = i2 then 1 + else if i = i3 then 2 + else if i = i4 then 3 + else i)`); + (NEW_GOAL `p i1 = 0 /\ p i2 = 1 /\ p (i3:num) = 2 /\ p i4 = 3`); + (REPEAT STRIP_TAC); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (EXPAND_TAC "p" THEN COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + + (EXISTS_TAC `p:num->num`); + (NEW_GOAL `p permutes 0..3`); + + (REWRITE_TAC[permutes; EXISTS_UNIQUE; IN_NUMSEG_0; + ARITH_RULE `a <= 3 <=> a = 0 \/ a = 1 \/ a = 2 \/ a = 3`; + SET_RULE `x = 0 \/ x = 1 \/ x = 2 \/ x = 3 <=> x IN {0,1,2,3}`]); + (NEW_GOAL `(!x. ~(x IN {0, 1, 2, 3}) ==> p x = x)`); + (REPEAT STRIP_TAC); + (EXPAND_TAC "p"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~(x' IN {0, 1, 2, 3})` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~(x' IN {0, 1, 2, 3})` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~(x' IN {0, 1, 2, 3})` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~(x' IN {0, 1, 2, 3})` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (REFL_TAC); + + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + + (ASM_CASES_TAC `y' = 0`); + (EXISTS_TAC `i1:num`); + (ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (ASM_CASES_TAC `y'' = i2:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 0` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i3:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 0` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `y'' = i4:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 0` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `~(y'' IN {0,1,2,3})`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 0` THEN ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (REPLICATE_TAC 4 UP_ASM_TAC THEN REWRITE_TAC[] THEN + UNDISCH_TAC `{i1,i2,i3,i4} = {0,1,2,3}` THEN SET_TAC[]); + + (ASM_CASES_TAC `y' = 1`); + (EXISTS_TAC `i2:num`); + (ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (ASM_CASES_TAC `y'' = i1:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 1` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i3:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 1` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i4:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 1` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `~(y'' IN {0,1,2,3})`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 1` THEN ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (REPLICATE_TAC 4 UP_ASM_TAC THEN REWRITE_TAC[] THEN + UNDISCH_TAC `{i1,i2,i3,i4} = {0,1,2,3}` THEN SET_TAC[]); + + + (ASM_CASES_TAC `y' = 2`); + (EXISTS_TAC `i3:num`); + (ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (ASM_CASES_TAC `y'' = i1:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 2` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i2:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 2` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i4:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 2` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `~(y'' IN {0,1,2,3})`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 2` THEN ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (REPLICATE_TAC 4 UP_ASM_TAC THEN REWRITE_TAC[] THEN + UNDISCH_TAC `{i1,i2,i3,i4} = {0,1,2,3}` THEN SET_TAC[]); + + (ASM_CASES_TAC `y' = 3`); + (EXISTS_TAC `i4:num`); + (ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (ASM_CASES_TAC `y'' = i1:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 3` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i2:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 3` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i3:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 3` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `~(y'' IN {0,1,2,3})`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 3` THEN ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (REPLICATE_TAC 4 UP_ASM_TAC THEN REWRITE_TAC[] THEN + UNDISCH_TAC `{i1,i2,i3,i4} = {0,1,2,3}` THEN SET_TAC[]); + + (NEW_GOAL `~(y' IN {0,1,2,3})`); + (REPLICATE_TAC 4 UP_ASM_TAC THEN SET_TAC[]); + (EXISTS_TAC `y':num`); + (ASM_SIMP_TAC[] THEN REPEAT STRIP_TAC); + + (ASM_CASES_TAC `y'' = i1:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = y'` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i2:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = y'` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i3:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = y'` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i4:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = y'` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `(p:num->num) y'' = y''`); + (FIRST_ASSUM MATCH_MP_TAC); + (REPLICATE_TAC 4 UP_ASM_TAC THEN REWRITE_TAC[] THEN + UNDISCH_TAC `{i1,i2,i3,i4} = {0,1,2,3}` THEN SET_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `inverse (p:num->num) 0 = i1 /\ inverse p 3 = i4 /\ + inverse p 1 = i2 /\ inverse p 2 = i3`); + (UP_ASM_TAC THEN MESON_TAC[PERMUTES_INVERSE_EQ; + ASSUME `(p:num->num) i1 = 0 /\ p i2 = 1 /\ p i3 = 2 /\ p i4 = 3`]); + (ASM_REWRITE_TAC[])]);; + + +(* ==================================================================== *) +(* Lemma 43 *) + +let lmfun_bounded = prove_by_refinement ( + `!h. &0 <= h ==> lmfun h <= h0 / (h0 - &1)`, +[(REPEAT STRIP_TAC THEN REWRITE_TAC[lmfun] THEN COND_CASES_TAC); + (REWRITE_TAC[REAL_ARITH `(h0 - h) / (h0 - &1) <= h0 / (h0 - &1) <=> + &0 <= h / (h0 - &1)`]); + (MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[h0] THEN ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[h0] THEN REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 44 *) + +let lmfun_pos_le = prove_by_refinement ( + `!h. &0 <= lmfun h`, +[(REPEAT STRIP_TAC THEN REWRITE_TAC[lmfun] THEN COND_CASES_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[h0] THEN REAL_ARITH_TAC); + (REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 45 *) +let BARV_CARD_LEMMA = prove ( + `!V ul k. + packing V /\ barV V k ul ==> CARD (set_of_list ul) = k + 1`, + MESON_TAC[Rogers.BARV_IMP_LENGTH_EQ_CARD]);; + +let BARV_LENGTH_LEMMA = prove ( + `!V ul k. + packing V /\ barV V k ul ==> LENGTH ul = k + 1`, + MESON_TAC[Rogers.BARV_IMP_LENGTH_EQ_CARD]);; + +(* ==================================================================== *) +(* Lemma 46 *) + +let MCELL_ID_MXI_2 = prove_by_refinement ( + `!V i j ul vl. + packing V /\ + saturated V /\ + barV V 3 ul /\ + barV V 3 vl /\ + mcell i V ul = mcell j V vl /\ + ~NULLSET (mcell i V ul) /\ + i IN {2, 3} /\ + j IN {2, 3} + ==> mxi V ul = mxi V vl`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `i = j /\ + (!k. i - 1 <= k /\ k <= 3 + ==> omega_list_n V ul k = omega_list_n V vl k)`); + (MATCH_MP_TAC MCELL_ID_OMEGA_LIST_N); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ASM_CASES_TAC `hl (truncate_simplex 2 (ul:(real^3)list)) >= sqrt (&2)`); + (ASM_CASES_TAC `hl (truncate_simplex 2 (vl:(real^3)list)) >= sqrt (&2)`); + + (REWRITE_WITH `mxi V ul = omega_list_n V ul 2`); + (REWRITE_TAC[mxi] THEN COND_CASES_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `mxi V vl = omega_list_n V vl 2`); + (REWRITE_TAC[mxi] THEN COND_CASES_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ARITH `~(a >= b) <=> a < b`]); + (STRIP_TAC); + + (ABBREV_TAC `xl = truncate_simplex 2 (ul:(real^3)list)`); + (ABBREV_TAC `yl = truncate_simplex 2 (vl:(real^3)list)`); + + (NEW_GOAL `set_of_list (truncate_simplex (i - 1) (ul:(real^3)list)) = + set_of_list (truncate_simplex (i - 1) vl)`); + (NEW_GOAL `V INTER mcell i V ul = set_of_list (truncate_simplex (i - 1) ul)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (NEW_GOAL `V INTER mcell j V vl = set_of_list (truncate_simplex (j - 1) vl)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `F`); + (NEW_GOAL `hl (xl:(real^3)list) <= dist (omega_list V xl, HD xl)`); + (MATCH_MP_TAC Rogers.WAUFCHE1); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN] THEN EXPAND_TAC "xl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `!w:real^3. w IN set_of_list yl + ==> dist (circumcenter (set_of_list yl),w) = hl yl`); + (MATCH_MP_TAC Rogers.HL_PROPERTIES); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "yl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_WITH `circumcenter (set_of_list yl) = + omega_list V (yl:(real^3)list)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN]); + (EXPAND_TAC "yl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (STRIP_TAC); + + (NEW_GOAL `hl yl = dist (omega_list V yl, HD xl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `HD (xl:(real^3)list) = HD (truncate_simplex (i - 1) ul)`); + (REWRITE_WITH `HD (xl:(real^3)list) = HD ul`); + (EXPAND_TAC "xl"); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `i IN {2,3}` THEN REWRITE_TAC[SET_RULE + `x IN {2,3} <=> x = 2 \/ x = 3`]); + (ARITH_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `HD (xl:(real^3)list) IN + set_of_list (truncate_simplex (i - 1) ul)`); + (REWRITE_TAC[ASSUME `HD (xl:(real^3)list) = + HD (truncate_simplex (i - 1) ul)`]); + (MATCH_MP_TAC Packing3.BARV_IMP_HD_IN_SET_OF_LIST); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `i - 1`); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `j IN {2,3}` THEN REWRITE_TAC[SET_RULE + `x IN {2,3} <=> x = 2 \/ x = 3`] THEN ARITH_TAC); + (UP_ASM_TAC); + (NEW_GOAL `set_of_list (truncate_simplex (j - 1) vl) SUBSET + set_of_list (yl:(real^3)list)`); + (EXPAND_TAC "yl"); + (MATCH_MP_TAC Rogers.TRUNCATE_SIMPLEX_SUBSET); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `j IN {2,3}` THEN REWRITE_TAC[SET_RULE + `x IN {2,3} <=> x = 2 \/ x = 3`]); + (ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (SET_TAC[]); + + (NEW_GOAL `omega_list V xl = omega_list V yl`); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH (xl:(real^3)list) = 3 /\ LENGTH (yl:(real^3)list) = 3`); + (EXPAND_TAC "xl" THEN EXPAND_TAC "yl"); + (REWRITE_TAC[ARITH_RULE `3 = 2 + 1`]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (REWRITE_TAC[ARITH_RULE `3 - 1 = 2`]); + (EXPAND_TAC "xl" THEN EXPAND_TAC "yl"); + (REWRITE_WITH + `truncate_simplex 2 ul = truncate_simplex (2 + 0) (ul:(real^3)list) /\ + truncate_simplex 2 vl = truncate_simplex (2 + 0) (vl:(real^3)list)`); + (REWRITE_TAC[ARITH_RULE `2 + 0 = 2`]); + (REWRITE_WITH + `omega_list_n V (truncate_simplex (2 + 0) ul) 2 = omega_list_n V ul 2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH + `omega_list_n V (truncate_simplex (2 + 0) vl) 2 = omega_list_n V vl 2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + + (ASM_REWRITE_TAC[]); + (NEW_GOAL `hl (yl:(real^3)list) = dist (omega_list V xl, HD xl)`); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + +(* ======================================================================= *) + + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ARITH `~(a >= b) <=> a < b`]); + (STRIP_TAC); + (ASM_CASES_TAC `hl (truncate_simplex 2 (vl:(real^3)list)) >= sqrt (&2)`); + + (ABBREV_TAC `xl = truncate_simplex 2 (ul:(real^3)list)`); + (ABBREV_TAC `yl = truncate_simplex 2 (vl:(real^3)list)`); + + (NEW_GOAL `set_of_list (truncate_simplex (i - 1) (ul:(real^3)list)) = + set_of_list (truncate_simplex (i - 1) vl)`); + (NEW_GOAL `V INTER mcell i V ul = set_of_list (truncate_simplex (i - 1) ul)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (NEW_GOAL `V INTER mcell j V vl = set_of_list (truncate_simplex (j - 1) vl)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `F`); + (NEW_GOAL `hl (yl:(real^3)list) <= dist (omega_list V yl, HD yl)`); + (MATCH_MP_TAC Rogers.WAUFCHE1); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN] THEN EXPAND_TAC "yl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `!w:real^3. w IN set_of_list xl + ==> dist (circumcenter (set_of_list xl),w) = hl xl`); + (MATCH_MP_TAC Rogers.HL_PROPERTIES); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "xl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_WITH `circumcenter (set_of_list xl) = + omega_list V (xl:(real^3)list)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN]); + (EXPAND_TAC "xl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (STRIP_TAC); + + (NEW_GOAL `hl xl = dist (omega_list V xl, HD yl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `HD (yl:(real^3)list) = HD (truncate_simplex (i - 1) vl)`); + (REWRITE_WITH `HD (yl:(real^3)list) = HD vl`); + (EXPAND_TAC "yl"); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `i IN {2,3}` THEN REWRITE_TAC[SET_RULE + `x IN {2,3} <=> x = 2 \/ x = 3`]); + (ARITH_TAC); + + (NEW_GOAL `HD (yl:(real^3)list) IN + set_of_list (truncate_simplex (i - 1) vl)`); + (REWRITE_TAC[ASSUME `HD (yl:(real^3)list) = + HD (truncate_simplex (i - 1) vl)`]); + (MATCH_MP_TAC Packing3.BARV_IMP_HD_IN_SET_OF_LIST); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `i - 1`); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `j IN {2,3}` THEN REWRITE_TAC[SET_RULE + `x IN {2,3} <=> x = 2 \/ x = 3`] THEN ARITH_TAC); + (UP_ASM_TAC); + (NEW_GOAL `set_of_list (truncate_simplex (i - 1) vl) SUBSET + set_of_list (xl:(real^3)list)`); + (EXPAND_TAC "xl"); + (REWRITE_TAC[GSYM (ASSUME + `set_of_list (truncate_simplex (i - 1) (ul:(real^3)list)) = + set_of_list (truncate_simplex (i - 1) vl)`)]); + (MATCH_MP_TAC Rogers.TRUNCATE_SIMPLEX_SUBSET); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `i IN {2,3}` THEN REWRITE_TAC[SET_RULE + `x IN {2,3} <=> x = 2 \/ x = 3`]); + (ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (SET_TAC[]); + + (NEW_GOAL `omega_list V xl = omega_list V yl`); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH (xl:(real^3)list) = 3 /\ LENGTH (yl:(real^3)list) = 3`); + (EXPAND_TAC "xl" THEN EXPAND_TAC "yl"); + (REWRITE_TAC[ARITH_RULE `3 = 2 + 1`]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (REWRITE_TAC[ARITH_RULE `3 - 1 = 2`]); + (EXPAND_TAC "xl" THEN EXPAND_TAC "yl"); + (REWRITE_WITH + `truncate_simplex 2 ul = truncate_simplex (2 + 0) (ul:(real^3)list) /\ + truncate_simplex 2 vl = truncate_simplex (2 + 0) (vl:(real^3)list)`); + (REWRITE_TAC[ARITH_RULE `2 + 0 = 2`]); + (REWRITE_WITH + `omega_list_n V (truncate_simplex (2 + 0) ul) 2 = omega_list_n V ul 2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH + `omega_list_n V (truncate_simplex (2 + 0) vl) 2 = omega_list_n V vl 2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `hl (xl:(real^3)list) = dist (omega_list V yl, HD yl)`); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ARITH `~(a >= b) <=> a < b`]); + (STRIP_TAC); + +(* ======================================================================= *) + + (NEW_GOAL `sqrt (&2) <= hl (ul:(real^3)list)`); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_CASES_TAC `i = 2`); + (REWRITE_TAC[MCELL_EXPLICIT; ASSUME `i = 2`; mcell2]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (NEW_GOAL `i = 3`); + (ASM_SET_TAC[]); + (REWRITE_TAC[MCELL_EXPLICIT; ASSUME `i = 3`; mcell3]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `sqrt (&2) <= hl (vl:(real^3)list)`); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[]); + (ASM_CASES_TAC `j = 2`); + (REWRITE_TAC[MCELL_EXPLICIT; ASSUME `j = 2`; mcell2]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (NEW_GOAL `j = 3`); + (ASM_SET_TAC[]); + (REWRITE_TAC[MCELL_EXPLICIT; ASSUME `j = 3`; mcell3]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (ABBREV_TAC `s2 = omega_list_n V ul 2`); + (ABBREV_TAC `s3 = omega_list_n V ul 3`); + (NEW_GOAL `s2 = omega_list_n V vl 2`); + (EXPAND_TAC "s2" THEN FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + (NEW_GOAL `s3 = omega_list_n V vl 3`); + (EXPAND_TAC "s3" THEN FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + (ABBREV_TAC `u0:real^3 = HD ul`); + + (NEW_GOAL `?s. between s (s2,s3) /\ + dist (u0,s) = sqrt (&2) /\ + mxi V ul = s`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "s3"); + (MATCH_MP_TAC MXI_EXPLICIT); + (NEW_GOAL `?v0 u1 u2 u3. ul = [v0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `v0:real^3 = HD ul`); + (REWRITE_TAC[ASSUME `ul = [v0;u1;u2;u3:real^3]`; HD]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `v0:real^3 = HD vl`); + + (NEW_GOAL `?t. between t (s2,s3) /\ + dist (v0,t) = sqrt (&2) /\ + mxi V vl = t`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "v0"); + (MATCH_MP_TAC MXI_EXPLICIT); + (NEW_GOAL `?w0 u1 u2 u3. vl = [w0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[HD]); + (EXPAND_TAC "v0"); + (REWRITE_TAC[ASSUME `vl = [w0;u1;u2;u3:real^3]`; HD]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `dist (u0:real^3, t) = sqrt (&2)`); + (NEW_GOAL `(t:real^3) IN voronoi_list V (truncate_simplex 2 vl)`); + (NEW_GOAL `s2 IN voronoi_list V (truncate_simplex 2 vl)`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (NEW_GOAL `s3 IN voronoi_list V (truncate_simplex 2 vl)`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (NEW_GOAL `convex hull {s2, s3:real^3} SUBSET + convex hull (voronoi_list V (truncate_simplex 2 vl))`); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET THEN ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH + `convex hull voronoi_list V (truncate_simplex 2 vl) = + voronoi_list V (truncate_simplex 2 vl)`); + (REWRITE_TAC[CONVEX_HULL_EQ; CONVEX_VORONOI_LIST]); + (STRIP_TAC); + (NEW_GOAL `t IN convex hull {s2, s3:real^3}`); + (REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `u0:real^3 IN set_of_list (truncate_simplex 2 vl)`); + (EXPAND_TAC "u0"); + + (NEW_GOAL `set_of_list (truncate_simplex (i - 1) (ul:(real^3)list)) = + set_of_list (truncate_simplex (i - 1) vl)`); + (NEW_GOAL `V INTER mcell i V ul = set_of_list (truncate_simplex (i - 1) ul)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (NEW_GOAL `V INTER mcell j V vl = set_of_list (truncate_simplex (j - 1) vl)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `HD (ul:(real^3)list) = HD (truncate_simplex (i - 1) ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `i IN {2,3}` THEN REWRITE_TAC[SET_RULE + `x IN {2,3} <=> x = 2 \/ x = 3`]); + (ARITH_TAC); + + (NEW_GOAL `HD (ul:(real^3)list) IN + set_of_list (truncate_simplex (i - 1) ul)`); + (REWRITE_TAC[ASSUME `HD (ul:(real^3)list) = + HD (truncate_simplex (i - 1) ul)`]); + (MATCH_MP_TAC Packing3.BARV_IMP_HD_IN_SET_OF_LIST); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `i - 1`); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `j IN {2,3}` THEN REWRITE_TAC[SET_RULE + `x IN {2,3} <=> x = 2 \/ x = 3`] THEN ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list (truncate_simplex (j - 1) vl) SUBSET + set_of_list (truncate_simplex 2 (vl:(real^3)list))`); + (MATCH_MP_TAC Rogers.TRUNCATE_SIMPLEX_SUBSET); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `j IN {2,3}` THEN REWRITE_TAC[SET_RULE + `x IN {2,3} <=> x = 2 \/ x = 3`]); + (ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (SET_TAC[]); + + + (NEW_GOAL `v0:real^3 IN set_of_list (truncate_simplex 2 vl)`); + (EXPAND_TAC "v0"); + (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 2 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `j IN {2,3}` THEN REWRITE_TAC[SET_RULE + `x IN {2,3} <=> x = 2 \/ x = 3`]); + (ARITH_TAC); + (MATCH_MP_TAC Packing3.BARV_IMP_HD_IN_SET_OF_LIST); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `t:real^3 IN voronoi_closed V u0`); + (UNDISCH_TAC `t:real^3 IN voronoi_list V (truncate_simplex 2 vl)`); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET;]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN; IN_ELIM_THM; voronoi_closed]); + (STRIP_TAC); + (NEW_GOAL `dist (u0:real^3, t) <= dist (v0:real^3, t)`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (FIRST_ASSUM MATCH_MP_TAC THEN EXPAND_TAC "v0"); + (REWRITE_TAC[MESON[IN] `(V:real^3->bool) s <=> s IN V`]); + (NEW_GOAL `HD (vl:(real^3)list) IN set_of_list vl`); + (MATCH_MP_TAC Packing3.BARV_IMP_HD_IN_SET_OF_LIST); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list (vl:(real^3)list) SUBSET V`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + + (NEW_GOAL `t:real^3 IN voronoi_closed V v0`); + (UNDISCH_TAC `t:real^3 IN voronoi_list V (truncate_simplex 2 vl)`); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET;]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN; IN_ELIM_THM; voronoi_closed]); + (STRIP_TAC); + (NEW_GOAL `dist (v0:real^3, t) <= dist (u0:real^3, t)`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (FIRST_ASSUM MATCH_MP_TAC THEN EXPAND_TAC "u0"); + (REWRITE_TAC[MESON[IN] `(V:real^3->bool) s <=> s IN V`]); + (NEW_GOAL `HD (ul:(real^3)list) IN set_of_list ul`); + (MATCH_MP_TAC Packing3.BARV_IMP_HD_IN_SET_OF_LIST); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list (ul:(real^3)list) SUBSET V`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC); + + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `!n. between n (s2, s3:real^3) ==> + dist (u0, n) pow 2 = dist (s2, n) pow 2 + dist (u0, s2) pow 2`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[dist]); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (ABBREV_TAC `zl = truncate_simplex 2 (ul:(real^3)list)`); + (REWRITE_WITH `s2:real^3 = circumcenter (set_of_list zl)`); + (REWRITE_WITH `s2 = omega_list V zl`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "zl"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_LEMMA); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN]); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool`); + (EXISTS_TAC `2`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `s2 IN voronoi_list V zl`); + (REWRITE_WITH `s2 = omega_list V zl`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "zl"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_LEMMA); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `2`); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `s3 IN voronoi_list V zl`); + (EXPAND_TAC "s3" THEN EXPAND_TAC "zl"); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3 /\ 3 <= 3`]); + (NEW_GOAL `affine hull {s2, s3} SUBSET affine hull voronoi_list V zl`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA); + (ASM_SET_TAC[]); + (NEW_GOAL `n IN affine hull {s2, s3:real^3}`); + (NEW_GOAL `convex hull {s2,s3} SUBSET affine hull {s2,s3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (NEW_GOAL `n IN convex hull {s2, s3:real^3}`); + (REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL]); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + + (MATCH_MP_TAC Marchal_cells_2_new.IN_AFFINE_KY_LEMMA1); + (REWRITE_WITH `u0:real^3 = HD zl`); + (EXPAND_TAC "zl" THEN EXPAND_TAC "u0"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Packing3.HD_IN_SET_OF_LIST); + + (REWRITE_WITH `LENGTH (zl:(real^3)list) = 2 + 1 /\ + CARD (set_of_list zl) = 2 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ARITH_TAC); + + (NEW_GOAL `dist (u0,s) pow 2 = dist (s2,s:real^3) pow 2 + dist (u0,s2) pow 2`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `dist (u0,t) pow 2 = dist (s2,t:real^3) pow 2 + dist (u0,s2) pow 2`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `dist (s2, s:real^3) = dist (s2, t)`); + (REWRITE_TAC[DIST_EQ]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + + (UNDISCH_TAC `between s (s2, s3:real^3)` THEN + UNDISCH_TAC `between t (s2, s3:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `dist (s2,s) = dist (s2,t:real^3)`); + (REWRITE_TAC[dist;ASSUME `s = u' % s2 + v' % s3:real^3`; + ASSUME `t = u % s2 + v % s3:real^3` ]); + (REWRITE_WITH `s2 - (u' % s2 + v' % s3) = + (u' + v') % s2 - (u' % s2 + v' % s3:real^3)`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `s2 - (u % s2 + v % s3) = + (u + v) % s2 - (u % s2 + v % s3:real^3)`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `(u + v) % s - (u % s + v % t) = v % (s - t)`]); + (REWRITE_TAC[NORM_MUL]); + (REWRITE_WITH `abs v = v /\ abs v' = v'`); + (ASM_SIMP_TAC[REAL_ABS_REFL]); + (REWRITE_TAC[REAL_ARITH `a * b = c * b <=> (a - c) * b = &0`;REAL_ENTIRE]); + (STRIP_TAC); + + (REWRITE_WITH `v = v':real /\ u = u':real`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[NORM_EQ_0]); + (REWRITE_TAC[VECTOR_ARITH `a - b = vec 0 <=> a = b`] THEN STRIP_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `hl (ul:(real^3)list) <= dist (s3,u0:real^3)`); + (REWRITE_WITH `s3 = omega_list V ul /\ u0 = HD ul`); + (STRIP_TAC); + (REWRITE_TAC[GSYM (ASSUME `omega_list_n V ul 3 = s3`); OMEGA_LIST]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `(3 + 1) - 1 = 3`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Rogers.WAUFCHE1); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[IN]); + (ABBREV_TAC `zl:(real^3)list = truncate_simplex 2 ul`); + (NEW_GOAL `hl (zl:(real^3)list) = dist (s3, u0:real^3)`); + + (REWRITE_WITH `s3 = omega_list V zl /\ u0 = HD zl`); + (STRIP_TAC); + (REWRITE_TAC[GSYM (ASSUME `s2:real^3 = s3`); OMEGA_LIST]); + (EXPAND_TAC "s2"); + + (REWRITE_WITH `LENGTH (zl:(real^3)list) = 2 + 1 /\ + CARD (set_of_list zl) = 2 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (REWRITE_TAC[ARITH_RULE `(2 + 1) - 1 = 2`]); + (EXPAND_TAC "zl"); + + (REWRITE_WITH `truncate_simplex 2 (ul:(real^3)list) = + truncate_simplex (2 + 0) (ul:(real^3)list)`); + (REWRITE_TAC[ARITH_RULE `2 + 0 = 2`]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (EXPAND_TAC "zl" THEN EXPAND_TAC "u0"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Rogers.WAUFCHE2); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN]); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 47 *) + +let DIHV_SYM_3 = prove_by_refinement ( + `!a b c d x y z t. + {a,b:real^3} = {c,d} /\ {x,y} = {z,t} ==> + dihV a b x y = dihV c d z t`, +[(REWRITE_TAC[SET_RULE `{a,b} = {c,d} <=> + (a = c /\ b = d) \/ (a = d /\ b = c)`]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[DIHV_SYM_2]); + (ASM_REWRITE_TAC[DIHV_SYM_2; DIHV_SYM]); + (ASM_REWRITE_TAC[DIHV_SYM_2; DIHV_SYM])]);; + +(* ==================================================================== *) +(* Lemma 48 *) + +let DIHX_SYM = prove_by_refinement ( + `!V X u v. + packing V /\ saturated V /\ mcell_set V X /\ {u, v} IN edgeX V X + ==> dihX V X (u,v) = dihX V X (v,u)`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (COND_CASES_TAC); + (REFL_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (DEL_TAC THEN REWRITE_TAC[cell_params_d] THEN REPEAT LET_TAC); + + (UNDISCH_TAC `{u, v} IN edgeX V X` THEN REWRITE_TAC[edgeX; IN;IN_ELIM_THM]); + (REWRITE_WITH `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `mcell_set V X` THEN REWRITE_TAC[mcell_set;IN_ELIM_THM;IN]); + (MESON_TAC[]); + (STRIP_TAC); + (MP_TAC (ASSUME `(V INTER X) (u':real^3)`) THEN + MP_TAC (ASSUME `(V INTER X) (v':real^3)`)); + (UNDISCH_TAC `mcell_set V X` THEN REWRITE_TAC[mcell_set_2;IN_ELIM_THM;IN]); + (STRIP_TAC); + (REWRITE_TAC[ASSUME `X = mcell i V ul''`]); + (REWRITE_WITH `(V INTER mcell i V ul'') = set_of_list (truncate_simplex (i-1) ul'')`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell i V ul''`)]); + (STRIP_TAC); + (REWRITE_TAC[ARITH_RULE `1 <= i <=> ~(i = 0)`]); + (STRIP_TAC); + (MP_TAC (ASSUME `(V INTER X) (u':real^3)`)); + (REWRITE_WITH `V INTER X:real^3->bool = {}`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`]); + (SET_TAC[]); + (UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[NEGLIGIBLE_EMPTY]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `i <= 1`); + (NEW_GOAL `?w0 w1 w2 w3. ul'' = [w0;w1;w2;w3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (v':real^3)` THEN + UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (u':real^3)`); + (NEW_GOAL `i - 1 = 0`); + (UNDISCH_TAC `i <= 1` THEN ARITH_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_0; set_of_list; + MESON[IN] `(A:real^3->bool) b <=> b IN A`]); + (REWRITE_TAC[SET_RULE `a IN {b} <=> a = b`]); + (UNDISCH_TAC `~(u' = v':real^3)`); + (SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[ARITH_RULE `~(i <= 1) <=> 2 <= i`] + THEN STRIP_TAC); + +(* ========================================================================== *) + + (NEW_GOAL `?p. p permutes 0..i - 1 /\ + initial_sublist [u:real^3; v] (left_action_list p ul'')`); + (NEW_GOAL `?w0 w1 w2 w3. ul'' = [w0;w1;w2;w3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ASM_CASES_TAC `i = 2`); + (UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (v':real^3)` THEN + UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (u':real^3)`); + (NEW_GOAL `i - 1 = 1`); + (UNDISCH_TAC `i = 2` THEN ARITH_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list; + MESON[IN] `(A:real^3->bool) b <=> b IN A`]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `u = w0:real^3`); + (NEW_GOAL `v = w1:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC + `~(u' = v':real^3)` THEN UNDISCH_TAC `{u,v} = {u',v':real^3}` + THEN SET_TAC[]); + (EXISTS_TAC `I:num->num`); + (ASM_REWRITE_TAC[PERMUTES_I; Packing3.LEFT_ACTION_LIST_I]); + (REWRITE_WITH `initial_sublist [w0; w1] [w0; w1; w2; w3] /\ + LENGTH [w0;w1:real^3] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; LENGTH] THEN ARITH_TAC); + (NEW_GOAL `v = w0:real^3 /\ u = w1:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC + `~(u' = v':real^3)` THEN UNDISCH_TAC `{u,v} = {u',v':real^3}` + THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?p. p permutes 0..1 /\ + [w1; w0; w2; w3:real^3] = left_action_list p ul''`); + (MATCH_MP_TAC Qzksykg.TWO_REARRANGEMENT_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC); + (EXISTS_TAC `p:num->num` THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[GSYM + (ASSUME `[w1; w0; w2; w3] = left_action_list p [w0; w1; w2; w3:real^3]`)]); + (REWRITE_WITH `initial_sublist [w1; w0] [w1; w0; w2; w3] /\ + LENGTH [w1;w0:real^3] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; LENGTH] THEN ARITH_TAC); + + (ASM_CASES_TAC `i = 3`); + (UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (v':real^3)` THEN + UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (u':real^3)`); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2; + set_of_list; MESON[IN] `(A:real^3->bool) b <=> b IN A`]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `u IN {w0, w1, w2} /\ v IN {w0, w1, w2:real^3} /\ ~(u = v)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?a. {u,v, a} = {w0, w1, w2:real^3}`); + (NEW_GOAL `?w:real^3. w IN {w0, w1, w2} DIFF {u, v}`); + (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]); + (REWRITE_WITH `{w0, w1, w2} DIFF {u, v:real^3} = {} <=> + CARD ({w0, w1, w2} DIFF {u, v}) = 0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_EQ_0); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{w0, w1, w2:real^3}`); + (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]); + + (NEW_GOAL `CARD {w0, w1, w2} = CARD ({w0, w1, w2} DIFF {u, v:real^3}) + + CARD {u, v}`); + (MATCH_MP_TAC Hypermap.CARD_MINUS_DIFF_TWO_SET); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + (UP_ASM_TAC THEN REWRITE_WITH `CARD ({w0, w1, w2:real^3}) = 3`); + (ASM_CASES_TAC `CARD {w0,w1,w2:real^3} <= 2`); + (NEW_GOAL `F`); + (NEW_GOAL `CARD {w0, w1, w2, w3:real^3} = 4`); + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list ul''`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul'':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul'') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_WITH `CARD {w0, w1, w2, w3} = + CARD {w3, w0,w1,w2:real^3}`); + (AP_TERM_TAC THEN SET_TAC[]); + (NEW_GOAL `CARD ({w3, w0, w1, w2}) <= SUC (CARD {w0, w1, w2:real^3})`); + (SIMP_TAC[Geomdetail.CARD_CLAUSES_IMP; Geomdetail.FINITE6]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (ASM_MESON_TAC[]); + (NEW_GOAL `CARD {w0, w1, w2:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + + (SUBGOAL_THEN `CARD {u,v:real^3} <= 2` MP_TAC); + (REWRITE_TAC[Geomdetail.CARD2]); + (ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `w:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?p. p permutes 0..2 /\ + [u; v; a; w3] = left_action_list p [w0; w1; w2; w3:real^3]`); + (MATCH_MP_TAC LEFT_ACTION_LIST_2_EXISTS); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list ul''`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul'':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul'') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `[u; v; a; w3:real^3] = + left_action_list p [w0; w1; w2; w3]`)]); + (REWRITE_WITH `initial_sublist [u; v] [u; v; a; w3] /\ + LENGTH [u; v:real^3] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST; LENGTH; + TRUNCATE_SIMPLEX_EXPLICIT_1] THEN ARITH_TAC); + + (NEW_GOAL `i = 4`); + (ASM_ARITH_TAC); + (UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (v':real^3)` THEN + UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (u':real^3)`); + (ASM_REWRITE_TAC[ARITH_RULE `4 - 1 = 3`; TRUNCATE_SIMPLEX_EXPLICIT_3; + set_of_list; MESON[IN] `(A:real^3->bool) b <=> b IN A`]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `u IN {w0, w1, w2, w3} /\ v IN {w0, w1, w2, w3:real^3} /\ + ~(u = v)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?a b. {u,v,a,b} = {w0, w1, w2, w3:real^3}`); + + (NEW_GOAL `?w:real^3. w IN {w0, w1, w2, w3} DIFF {u, v}`); + (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]); + (REWRITE_WITH `{w0, w1, w2, w3} DIFF {u, v:real^3} = {} <=> + CARD ({w0, w1, w2, w3} DIFF {u, v}) = 0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_EQ_0); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{w0, w1, w2, w3:real^3}`); + (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]); + + (NEW_GOAL `CARD {w0, w1, w2, w3} = + CARD ({w0, w1, w2, w3} DIFF {u, v:real^3}) + CARD {u, v}`); + (MATCH_MP_TAC Hypermap.CARD_MINUS_DIFF_TWO_SET); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + + (UP_ASM_TAC THEN REWRITE_WITH `CARD ({w0, w1, w2, w3:real^3}) = 3 + 1`); + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list ul''`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul'':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul'') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD {u, v:real^3} <= 2`); + (REWRITE_TAC[Geomdetail.CARD2]); + (UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?m:real^3. m IN {w0, w1, w2, w3} DIFF {u, v, w}`); + (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]); + (REWRITE_WITH `{w0, w1, w2, w3} DIFF {u, v, w:real^3} = {} <=> + CARD ({w0, w1, w2, w3} DIFF {u, v, w}) = 0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_EQ_0); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{w0, w1, w2, w3:real^3}`); + (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]); + + (NEW_GOAL `CARD ({w0, w1, w2, w3} DIFF {u,v,w:real^3}) = + CARD {w0, w1, w2, w3} - CARD {u,v,w}`); + (MATCH_MP_TAC CARD_DIFF); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH `CARD ({w0, w1, w2, w3:real^3}) = 3 + 1`); + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list ul''`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul'':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul'') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD {u, v, w:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (EXISTS_TAC `w:real^3` THEN EXISTS_TAC `m:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN + UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?p. p permutes 0..3 /\ + [u; v; a; b] = left_action_list p [w0; w1; w2; w3:real^3]`); + (MATCH_MP_TAC LEFT_ACTION_LIST_3_EXISTS); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list ul''`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul'':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul'') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `[u; v; a; b:real^3] = + left_action_list p [w0; w1; w2; w3]`)]); + (REWRITE_WITH `initial_sublist [u; v] [u; v; a; b] /\ + LENGTH [u; v:real^3] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST; LENGTH; + TRUNCATE_SIMPLEX_EXPLICIT_1] THEN ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + +(* ========================================================================== *) + + (NEW_GOAL `?q. q permutes 0..i - 1 /\ + initial_sublist [v:real^3; u] (left_action_list q ul'')`); + (NEW_GOAL `?w0 w1 w2 w3. ul'' = [w0;w1;w2;w3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ASM_CASES_TAC `i = 2`); + (UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (v':real^3)` THEN + UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (u':real^3)`); + (NEW_GOAL `i - 1 = 1`); + (UNDISCH_TAC `i = 2` THEN ARITH_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list; + MESON[IN] `(A:real^3->bool) b <=> b IN A`]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `v = w0:real^3`); + (NEW_GOAL `u = w1:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC + `~(u' = v':real^3)` THEN UNDISCH_TAC `{u,v} = {u',v':real^3}` + THEN SET_TAC[]); + (EXISTS_TAC `I:num->num`); + (ASM_REWRITE_TAC[PERMUTES_I; Packing3.LEFT_ACTION_LIST_I]); + (REWRITE_WITH `initial_sublist [w0; w1] [w0; w1; w2; w3] /\ + LENGTH [w0;w1:real^3] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; LENGTH] THEN ARITH_TAC); + (NEW_GOAL `u = w0:real^3 /\ v = w1:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC + `~(u' = v':real^3)` THEN UNDISCH_TAC `{u,v} = {u',v':real^3}` + THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?q. q permutes 0..1 /\ + [w1; w0; w2; w3:real^3] = left_action_list q ul''`); + (MATCH_MP_TAC Qzksykg.TWO_REARRANGEMENT_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC); + (EXISTS_TAC `q:num->num` THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[GSYM + (ASSUME `[w1; w0; w2; w3] = left_action_list q [w0; w1; w2; w3:real^3]`)]); + (REWRITE_WITH `initial_sublist [w1; w0] [w1; w0; w2; w3] /\ + LENGTH [w1;w0:real^3] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; LENGTH] THEN ARITH_TAC); + + (ASM_CASES_TAC `i = 3`); + (UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (v':real^3)` THEN + UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (u':real^3)`); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2; + set_of_list; MESON[IN] `(A:real^3->bool) b <=> b IN A`]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `u IN {w0, w1, w2} /\ v IN {w0, w1, w2:real^3} /\ ~(u = v)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?a. {u,v, a} = {w0, w1, w2:real^3}`); + (NEW_GOAL `?w:real^3. w IN {w0, w1, w2} DIFF {u, v}`); + (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]); + (REWRITE_WITH `{w0, w1, w2} DIFF {u, v:real^3} = {} <=> + CARD ({w0, w1, w2} DIFF {u, v}) = 0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_EQ_0); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{w0, w1, w2:real^3}`); + (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]); + + (NEW_GOAL `CARD {w0, w1, w2} = CARD ({w0, w1, w2} DIFF {u, v:real^3}) + + CARD {u, v}`); + (MATCH_MP_TAC Hypermap.CARD_MINUS_DIFF_TWO_SET); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + (UP_ASM_TAC THEN REWRITE_WITH `CARD ({w0, w1, w2:real^3}) = 3`); + (ASM_CASES_TAC `CARD {w0,w1,w2:real^3} <= 2`); + (NEW_GOAL `F`); + (NEW_GOAL `CARD {w0, w1, w2, w3:real^3} = 4`); + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list ul''`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul'':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul'') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_WITH `CARD {w0, w1, w2, w3} = + CARD {w3, w0,w1,w2:real^3}`); + (AP_TERM_TAC THEN SET_TAC[]); + (NEW_GOAL `CARD ({w3, w0, w1, w2}) <= SUC (CARD {w0, w1, w2:real^3})`); + (SIMP_TAC[Geomdetail.CARD_CLAUSES_IMP; Geomdetail.FINITE6]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (ASM_MESON_TAC[]); + (NEW_GOAL `CARD {w0, w1, w2:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + + (SUBGOAL_THEN `CARD {u,v:real^3} <= 2` MP_TAC); + (REWRITE_TAC[Geomdetail.CARD2]); + (ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `w:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_WITH `{u,v,a} = {v, u, a:real^3}`); + (SET_TAC[]); + (STRIP_TAC); + + (NEW_GOAL `?q. q permutes 0..2 /\ + [v; u; a; w3] = left_action_list q [w0; w1; w2; w3:real^3]`); + (MATCH_MP_TAC LEFT_ACTION_LIST_2_EXISTS); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list ul''`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul'':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul'') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (EXISTS_TAC `q:num->num`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `[v; u; a; w3:real^3] = + left_action_list q [w0; w1; w2; w3]`)]); + (REWRITE_WITH `initial_sublist [v; u] [v; u; a; w3] /\ + LENGTH [v; u:real^3] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST; LENGTH; + TRUNCATE_SIMPLEX_EXPLICIT_1] THEN ARITH_TAC); + + (NEW_GOAL `i = 4`); + (ASM_ARITH_TAC); + (UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (v':real^3)` THEN + UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (u':real^3)`); + (ASM_REWRITE_TAC[ARITH_RULE `4 - 1 = 3`; TRUNCATE_SIMPLEX_EXPLICIT_3; + set_of_list; MESON[IN] `(A:real^3->bool) b <=> b IN A`]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `u IN {w0, w1, w2, w3} /\ v IN {w0, w1, w2, w3:real^3} /\ + ~(u = v)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?a b. {u,v,a,b} = {w0, w1, w2, w3:real^3}`); + + (NEW_GOAL `?w:real^3. w IN {w0, w1, w2, w3} DIFF {u, v}`); + (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]); + (REWRITE_WITH `{w0, w1, w2, w3} DIFF {u, v:real^3} = {} <=> + CARD ({w0, w1, w2, w3} DIFF {u, v}) = 0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_EQ_0); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{w0, w1, w2, w3:real^3}`); + (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]); + + (NEW_GOAL `CARD {w0, w1, w2, w3} = + CARD ({w0, w1, w2, w3} DIFF {u, v:real^3}) + CARD {u, v}`); + (MATCH_MP_TAC Hypermap.CARD_MINUS_DIFF_TWO_SET); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + + (UP_ASM_TAC THEN REWRITE_WITH `CARD ({w0, w1, w2, w3:real^3}) = 3 + 1`); + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list ul''`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul'':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul'') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD {u, v:real^3} <= 2`); + (REWRITE_TAC[Geomdetail.CARD2]); + (UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?m:real^3. m IN {w0, w1, w2, w3} DIFF {u, v, w}`); + (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]); + (REWRITE_WITH `{w0, w1, w2, w3} DIFF {u, v, w:real^3} = {} <=> + CARD ({w0, w1, w2, w3} DIFF {u, v, w}) = 0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_EQ_0); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{w0, w1, w2, w3:real^3}`); + (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]); + + (NEW_GOAL `CARD ({w0, w1, w2, w3} DIFF {u,v,w:real^3}) = + CARD {w0, w1, w2, w3} - CARD {u,v,w}`); + (MATCH_MP_TAC CARD_DIFF); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH `CARD ({w0, w1, w2, w3:real^3}) = 3 + 1`); + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list ul''`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul'':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul'') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD {u, v, w:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (EXISTS_TAC `w:real^3` THEN EXISTS_TAC `m:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN + UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_WITH `{u,v,a,b} = {v, u, a, b:real^3}`); + (SET_TAC[]); + (STRIP_TAC); + + (NEW_GOAL `?q. q permutes 0..3 /\ + [v; u; a; b] = left_action_list q [w0; w1; w2; w3:real^3]`); + (MATCH_MP_TAC LEFT_ACTION_LIST_3_EXISTS); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list ul''`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul'':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul'') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (EXISTS_TAC `q:num->num`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `[v; u; a; b:real^3] = + left_action_list q [w0; w1; w2; w3]`)]); + (REWRITE_WITH `initial_sublist [v; u] [v; u; a; b] /\ + LENGTH [v; u:real^3] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST; LENGTH; + TRUNCATE_SIMPLEX_EXPLICIT_1] THEN ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + +(* ========================================================================= *) + + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [v; u] ul)`); + (NEW_GOAL `(P:num#(real^3)list->bool) (k, ul)`); + (REWRITE_TAC[GSYM (ASSUME `(@) (P:num#(real^3)list->bool) = k,ul`)]); + (MATCH_MP_TAC SELECT_AX); + + (EXISTS_TAC `(i:num, left_action_list q (ul'':(real^3)list))`); + (EXPAND_TAC "P" THEN REWRITE_TAC[BETA_THM]); + (ASM_REWRITE_TAC[IN]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC Qzksykg.QZKSYKG1); + (EXISTS_TAC `ul'':(real^3)list`); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `q:num->num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_REWRITE_TAC[GSYM Ajripqn.UP_TO_4_KY_LEMMA]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell i V ul''`)]); + (UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[NEGLIGIBLE_EMPTY]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Rvfxzbu.RVFXZBU); + (ASM_REWRITE_TAC[GSYM Ajripqn.UP_TO_4_KY_LEMMA]); + + + (ABBREV_TAC `Q = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u; v] ul)`); + (NEW_GOAL `(Q:num#(real^3)list->bool) (k', ul')`); + (REWRITE_TAC[GSYM (ASSUME `(@) (Q:num#(real^3)list->bool) = k',ul'`)]); + (MATCH_MP_TAC SELECT_AX); + + (EXISTS_TAC `(i:num, left_action_list p (ul'':(real^3)list))`); + (EXPAND_TAC "Q" THEN REWRITE_TAC[BETA_THM]); + (ASM_REWRITE_TAC[IN]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC Qzksykg.QZKSYKG1); + (EXISTS_TAC `ul'':(real^3)list`); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_REWRITE_TAC[GSYM Ajripqn.UP_TO_4_KY_LEMMA]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell i V ul''`)]); + (UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[NEGLIGIBLE_EMPTY]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Rvfxzbu.RVFXZBU); + (ASM_REWRITE_TAC[GSYM Ajripqn.UP_TO_4_KY_LEMMA]); + + (UP_ASM_TAC THEN EXPAND_TAC "Q" THEN REWRITE_TAC[] THEN DEL_TAC); + (UP_ASM_TAC THEN EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN DEL_TAC); + (REPEAT STRIP_TAC); + + (NEW_GOAL `i = k:num`); + (REWRITE_WITH `i = k /\ mcell i V ul'' = mcell k V ul`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[GSYM Ajripqn.UP_TO_4_KY_LEMMA]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell i V ul''`); + GSYM (ASSUME `X = mcell k V ul`); SET_RULE `a INTER a = a`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `i = k':num`); + (REWRITE_WITH `i = k' /\ mcell i V ul'' = mcell k' V ul'`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[GSYM Ajripqn.UP_TO_4_KY_LEMMA]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell i V ul''`); GSYM (ASSUME `i = k:num`); + GSYM (ASSUME `X = mcell k' V ul'`); SET_RULE `a INTER a = a`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `i = k /\ (!k. i - 1 <= k /\ k <= 3 + ==> omega_list_n V ul k = omega_list_n V ul' k)`); + (MATCH_MP_TAC MCELL_ID_OMEGA_LIST_N); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_MESON_TAC[]); + (STRIP_TAC); + (ASM_MESON_TAC[]); + (REWRITE_TAC[SET_RULE `a IN {m,n,p} <=> a = m \/ a = n \/ a = p`]); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (REWRITE_WITH `k' = k:num`); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `i < 4`); + (NEW_GOAL `mxi V ul' = mxi V ul`); + (MATCH_MP_TAC MCELL_ID_MXI_2); + (EXISTS_TAC `k':num` THEN EXISTS_TAC `k:num`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k' V ul'`)]); + (REWRITE_TAC[ASSUME `X = mcell k V ul`; ASSUME `~NULLSET X`]); + (REWRITE_TAC[SET_RULE `a IN {b,c} <=> a = b \/ a = c`]); + (ASM_ARITH_TAC); + + (NEW_GOAL `HD ul = HD [v; u:real^3]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_INITIAL_SUBLIST); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `HD ul' = HD [u; v:real^3]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_INITIAL_SUBLIST); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `EL 1 ul = EL 1 ([v; u:real^3])`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `[v; u:real^3] = truncate_simplex 1 ul`); + (REWRITE_WITH `truncate_simplex 1 ul = [v;u:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `EL 1 ul' = EL 1 ([u; v:real^3])`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `[u; v:real^3] = truncate_simplex 1 ul'`); + (REWRITE_WITH `truncate_simplex 1 ul' =[u;v:real^3] /\ 1 + 1 <= LENGTH ul'`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_TAC[dihu2]); + (REWRITE_WITH `omega_list_n V ul 3 = omega_list_n V ul' 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `1 = SUC 0`; DIHV_SYM]); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (COND_CASES_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (DEL_TAC THEN DEL_TAC); + (REWRITE_TAC[dihu3]); + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `1 = SUC 0`]); + + (REWRITE_WITH `EL 2 ul' = EL 2 (ul:(real^3)list)`); + (NEW_GOAL `set_of_list (truncate_simplex 2 (ul:(real^3)list)) = + set_of_list (truncate_simplex 2 ul')`); + (REWRITE_TAC[ARITH_RULE `2 = 3 - 1`]); + (REWRITE_WITH `set_of_list (truncate_simplex (3 - 1) ul) = + (V:real^3->bool) INTER X`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[ASSUME `X = mcell k V ul`; ASSUME `k = 3`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3 /\ 3 <= 4`]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k V ul`); GSYM (ASSUME `k = 3`)]); + (UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[NEGLIGIBLE_EMPTY]); + (REWRITE_TAC[ASSUME `X = mcell k' V ul'`]); + (REWRITE_WITH `k' = 3`); + (ASM_ARITH_TAC); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3 /\ 3 <= 4`]); + (REWRITE_WITH `3 = k'`); + (ASM_ARITH_TAC); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k' V ul'`)]); + (UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `?y0 y1 y2 y3. ul = [y0;y1;y2;y3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `?z0 z1 z2 z3. ul' = [z0;z1;z2;z3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (UNDISCH_TAC `EL 1 ul = EL 1 [v; u:real^3]` THEN + UNDISCH_TAC `HD ul = HD [v; u:real^3]` + THEN ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `EL 1 ul' = EL 1 [u; v:real^3]` THEN + UNDISCH_TAC `HD ul' = HD [u; v:real^3]` + THEN ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `set_of_list (truncate_simplex 2 (ul:(real^3)list)) = + set_of_list (truncate_simplex 2 ul')`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (NEW_GOAL `~(y2 IN {u, v:real^3})`); + (STRIP_TAC); + (NEW_GOAL `CARD (set_of_list (ul:(real^3)list)) <= 3`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH ` {v, u, y2, y3} = {v,u, y3:real^3}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN REWRITE_WITH`CARD (set_of_list (ul:(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (UP_ASM_TAC THEN SET_TAC[]); + + (REWRITE_TAC[DIHV_SYM]); + (UP_ASM_TAC THEN MESON_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `k = 4`); + (ASM_ARITH_TAC); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (COND_CASES_TAC); + (COND_CASES_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + + + (REWRITE_TAC[dihu4]); + +(* ========================================================================= *) + (MATCH_MP_TAC DIHV_SYM_3); + (REWRITE_TAC[EL]); + + (NEW_GOAL `HD ul = HD [v; u:real^3]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_INITIAL_SUBLIST); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `HD ul' = HD [u; v:real^3]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_INITIAL_SUBLIST); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `EL 1 ul = EL 1 ([v; u:real^3])`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `[v; u:real^3] = truncate_simplex 1 ul`); + (REWRITE_WITH `truncate_simplex 1 ul = [v;u:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `EL 1 ul' = EL 1 ([u; v:real^3])`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `[u; v:real^3] = truncate_simplex 1 ul'`); + (REWRITE_WITH `truncate_simplex 1 ul' =[u;v:real^3] /\ 1 + 1 <= LENGTH ul'`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `?y0 y1 y2 y3. ul = [y0;y1;y2;y3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `?z0 z1 z2 z3. ul' = [z0;z1;z2;z3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (UNDISCH_TAC `EL 1 ul = EL 1 [v; u:real^3]` THEN + UNDISCH_TAC `HD ul = HD [v; u:real^3]` THEN + UNDISCH_TAC `EL 1 ul' = EL 1 [u; v:real^3]` THEN + UNDISCH_TAC `HD ul' = HD [u; v:real^3]` THEN + ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `3 = SUC 2 /\2 = SUC 1 /\ 1 = SUC 0`]); + (REPEAT STRIP_TAC); + (ASM_SET_TAC[]); + + (NEW_GOAL `~(z2 IN {u,v:real^3})`); + (STRIP_TAC); + (NEW_GOAL `CARD (set_of_list (ul':(real^3)list)) <= 3`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `{u, v, z2, z3} = {v,u, z3:real^3}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN REWRITE_WITH`CARD (set_of_list (ul':(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `~(z3 IN {u,v:real^3})`); + (STRIP_TAC); + (NEW_GOAL `CARD (set_of_list (ul':(real^3)list)) <= 3`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `{u, v, z2, z3} = {v,u, z2:real^3}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN REWRITE_WITH`CARD (set_of_list (ul':(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + + (NEW_GOAL `~(y2 IN {u,v:real^3})`); + (STRIP_TAC); + (NEW_GOAL `CARD (set_of_list (ul:(real^3)list)) <= 3`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `{v, u, y2, y3} = {v,u, y3:real^3}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN REWRITE_WITH`CARD (set_of_list (ul:(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `~(y3 IN {u,v:real^3})`); + (STRIP_TAC); + (NEW_GOAL `CARD (set_of_list (ul:(real^3)list)) <= 3`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `{v, u, y2, y3} = {v,u, y2:real^3}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN REWRITE_WITH`CARD (set_of_list (ul:(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `set_of_list (truncate_simplex 3 (ul:(real^3)list)) = + set_of_list (truncate_simplex 3 ul')`); + (REWRITE_WITH `set_of_list (truncate_simplex 3 (ul:(real^3)list)) = + V INTER X`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[ASSUME `X = mcell k V ul`; ASSUME `k = 4`; ARITH_RULE `3 = 4 - 1`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (REWRITE_TAC[ARITH_RULE `1 <= 4 /\ 4 <= 4`]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k V ul`); GSYM (ASSUME `k = 4`)]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[NEGLIGIBLE_EMPTY]); + (REWRITE_TAC[ASSUME `X = mcell k' V ul'`]); + (REWRITE_WITH `k' = 4`); + (ASM_ARITH_TAC); + (REWRITE_TAC[ARITH_RULE `3 = 4 - 1`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (REWRITE_TAC[ARITH_RULE `1 <= 4 /\ 4 <= 4`]); + (REWRITE_WITH `4 = k'`); + (ASM_ARITH_TAC); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k' V ul'`)]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3; set_of_list]); + (ASM_SET_TAC[]); + + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REFL_TAC)]);; + +(* ==================================================================== *) +(* Lemma 49 *) + +let gammaY = new_definition + `!V X f. + gammaY V X f = + (\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * f (hl [u; v]) + else &0)`;; + +let gamma_y_lmfun_bound = prove_by_refinement ( + `!V. packing V /\ saturated V + ==> (?d. !X e. mcell_set V X /\ edgeX V X e ==> gammaY V X lmfun e <= d)`, +[(REPEAT STRIP_TAC); + (EXISTS_TAC `pi * h0 / (h0 - &1)`); + (REPEAT STRIP_TAC); + (ABBREV_TAC `f = (\u v. if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)`); + (REWRITE_WITH `gammaY V X lmfun = (\({u, v}). f u v)`); + (EXPAND_TAC "f" THEN REWRITE_TAC[gammaY]); + + (NEW_GOAL `!u v. (f:real^3->real^3->real) u v = f v u`); + (EXPAND_TAC "f" THEN REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]); + (REPEAT GEN_TAC THEN COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_WITH `dihX V X (u,v) = dihX V X (v,u)`); + (MATCH_MP_TAC DIHX_SYM); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REFL_TAC); + + (UNDISCH_TAC `edgeX V X e` THEN REWRITE_TAC[IN;IN_ELIM_THM; edgeX]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `(\({u, v}). f u v) {u, v} = + (f:real^3->real^3->real) u v`); + (MATCH_MP_TAC BETA_PAIR_THM); + (ASM_REWRITE_TAC[]); + + (EXPAND_TAC "f"); + (COND_CASES_TAC); + + (NEW_GOAL `dihX V X (u,v) * lmfun (hl [u;v]) <= pi * lmfun (hl [u;v])`); + (REWRITE_TAC[REAL_ARITH `a * x <= b * x <=> &0 <= (b - a) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[lmfun_pos_le; REAL_ARITH `&0 <= a - b <=> b <= a`; DIHX_LE_PI]); + + (NEW_GOAL `pi * lmfun (hl [u:real^3;v]) <= pi * h0 / (h0 - &1)`); + (REWRITE_TAC[REAL_ARITH `a * x <= a * y <=> &0 <= (y - x) * a`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[PI_POS_LE; REAL_ARITH `&0 <= a - b <=> b <= a`]); + (MATCH_MP_TAC lmfun_bounded); + (REWRITE_TAC[HL_2; REAL_ARITH `&0 <= inv (&2) * x <=> &0 <= x`; DIST_POS_LE]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[PI_POS_LE]); + (MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[h0] THEN REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 50 *) + +let BETA_SET_2_THM = prove + (`!g:(A->bool)->B u0 v0. (\({u, v}). g {u, v}) {u0, v0} = g {u0, v0}`, + GEN_TAC THEN REWRITE_TAC[GABS_DEF;GEQ_DEF] THEN + CONV_TAC SELECT_CONV THEN EXISTS_TAC `g:(A->bool)->B` THEN + REWRITE_TAC[]);; + +(* ==================================================================== *) +(* Lemma 51 *) +(* Formal proof by John Harrison *) + +let SUM_PAIR_2_SET = prove +(`!f s:real^N->bool d. + FINITE s +==> sum {(m,n) | m IN s /\ n IN s /\ ~(m = n) /\ dist(m,n) <= d} + (\(m,n). f {m, n}) = &2 * + sum {{m, n} | m IN s /\ n IN s /\ ~(m = n) /\ dist(m,n) <= d} f`, +REPEAT STRIP_TAC THEN MP_TAC(ISPECL + [`\(m:real^N,n). {m,n}`;`(\(m,n). f {m,n}):real^N#real^N->real`; + `{(m,n) | m IN s /\ n IN s /\ ~(m:real^N = n) /\ dist(m,n) <= d}`; + `{{m,n} | m IN s /\ n IN s /\ ~(m:real^N = n) /\ dist(m,n) <= d}`] + SUM_GROUP) THEN + ANTS_TAC THENL + [CONJ_TAC THENL + [ONCE_REWRITE_TAC[SET_RULE + `m IN s /\ n IN s /\ P m n <=> + m IN s /\ n IN {n | n IN s /\ P m n}`] THEN + MATCH_MP_TAC FINITE_PRODUCT_DEPENDENT THEN + ASM_SIMP_TAC[FINITE_RESTRICT]; + REWRITE_TAC[SUBSET; FORALL_IN_IMAGE; FORALL_IN_GSPEC] THEN SET_TAC[]]; + DISCH_THEN(SUBST1_TAC o SYM) THEN REWRITE_TAC[GSYM SUM_LMUL] THEN + MATCH_MP_TAC SUM_EQ THEN REWRITE_TAC[FORALL_IN_GSPEC] THEN + MAP_EVERY X_GEN_TAC [`m:real^N`; `n:real^N`] THEN STRIP_TAC THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `sum {(m:real^N,n), (n,m)} (\(m,n). f {m,n})` THEN + CONJ_TAC THENL + [AP_THM_TAC THEN AP_TERM_TAC THEN GEN_REWRITE_TAC I [EXTENSION] THEN + REWRITE_TAC[FORALL_PAIR_THM] THEN + REWRITE_TAC[IN_ELIM_THM; PAIR_EQ; IN_INSERT; NOT_IN_EMPTY; + SET_RULE `{a,b} = {c,d} <=> a = c /\ b = d \/ a = d /\ b = c`] THEN + ASM_MESON_TAC[DIST_SYM]; + SIMP_TAC[SUM_CLAUSES; FINITE_INSERT; FINITE_EMPTY] THEN + ASM_REWRITE_TAC[IN_SING; NOT_IN_EMPTY; PAIR_EQ; REAL_ADD_RID] THEN + REWRITE_TAC[INSERT_AC] THEN REAL_ARITH_TAC]]);; + +(* ==================================================================== *) +(* Lemma 52 *) + +open Flyspeck_constants;; + +let H0_LT_SQRT2 = prove_by_refinement (`h0 < sqrt (&2)`, +[REWRITE_TAC[h0; GSYM sqrt2]; + NEW_GOAL `#1.414213 < sqrt2`; + REWRITE_TAC[bounds]; + ASM_REAL_ARITH_TAC]);; + +(* ==================================================================== *) +(* Lemma 53 *) + +let gamma_y_pos_le = prove_by_refinement ( + `!V X e. packing V /\ saturated V /\ mcell_set V X /\ edgeX V X e + ==> &0 <= gammaY V X lmfun e`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[gammaY]); + (NEW_GOAL `?u v. (VX V X u /\ VX V X v /\ ~(u = v)) /\ e = {u, v}`); + (UP_ASM_TAC THEN REWRITE_TAC[edgeX; IN_ELIM_THM]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ABBREV_TAC `f = (\u v. if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)`); + (REWRITE_WITH `(\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0) = (\({u, v}). f u v)`); + (EXPAND_TAC "f" THEN REWRITE_TAC[]); + (REWRITE_WITH `(\({u:real^3, v}). f u v) {u, v} = (f:real^3->real^3->real) u v`); + (MATCH_MP_TAC BETA_PAIR_THM); + (EXPAND_TAC "f" THEN REPEAT STRIP_TAC); + (REPEAT COND_CASES_TAC); + (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]); + (REWRITE_WITH `dihX V X (u',v') = dihX V X (v',u')`); + (MATCH_MP_TAC DIHX_SYM); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`] THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`] THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (REFL_TAC); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIHX_POS;lmfun_pos_le]); + (REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 54 *) + +let CARD_LIST_klemma = prove_by_refinement ( + `!s t. FINITE (s:A->bool) /\ FINITE t ==> + CARD {CONS u0 y1 | u0 IN s /\ y1 IN t} = CARD s * CARD t`, +[(REPEAT STRIP_TAC); + (ABBREV_TAC `S = {u0:A, y1:(A)list| u0 IN s /\ y1 IN t}`); + (ABBREV_TAC `f = (\(u0:A, y1:(A)list). CONS u0 y1)`); + (REWRITE_WITH `{CONS u0 y1 | u0 IN s /\ y1 IN t} = + (IMAGE (f:A#(A)list->(A)list) S)`); + (EXPAND_TAC "f" THEN EXPAND_TAC "S" THEN REWRITE_TAC[IMAGE]); + (REWRITE_TAC[SET_RULE `A = B <=> A SUBSET B /\ B SUBSET A`]); + (STRIP_TAC); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `(u0:A,y1:(A)list)`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `u0:A` THEN EXISTS_TAC `y1:(A)list` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `x' = u0:A,y1:(A)list`] THEN STRIP_TAC); + (EXISTS_TAC `u0:A` THEN EXISTS_TAC `y1:(A)list` THEN ASM_REWRITE_TAC[]); + (REWRITE_WITH `CARD (IMAGE (f:A#(A)list->(A)list) S) = CARD S`); + (MATCH_MP_TAC CARD_IMAGE_INJ); + (STRIP_TAC); + (EXPAND_TAC "S" THEN EXPAND_TAC "f" THEN + REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `x = u0:A,y1:(A)list`; + ASSUME `y = u0':A,y1':(A)list`; CONS_11]); + (STRIP_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "S" THEN MATCH_MP_TAC FINITE_PRODUCT THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "S" THEN MATCH_MP_TAC CARD_PRODUCT THEN ASM_REWRITE_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 55 *) + +let CARD_LIST_klemma_2 = prove_by_refinement ( + `!s t. FINITE (s:A->bool) /\ FINITE t ==> + CARD {[u0;y1] | u0 IN s /\ y1 IN t} = CARD s * CARD t`, +[(REPEAT STRIP_TAC); + (ABBREV_TAC `S = {u0:A, y1:A| u0 IN s /\ y1 IN t}`); + (ABBREV_TAC `f = (\(u0:A, y1:A). [u0; y1])`); + (REWRITE_WITH `{[u0; y1] | u0 IN s /\ y1 IN t} = + (IMAGE (f:A#A->(A)list) S)`); + (EXPAND_TAC "f" THEN EXPAND_TAC "S" THEN REWRITE_TAC[IMAGE]); + (REWRITE_TAC[SET_RULE `A = B <=> A SUBSET B /\ B SUBSET A`]); + (STRIP_TAC); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `(u0:A,y1:A)`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `u0:A` THEN EXISTS_TAC `y1:A` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `x' = u0:A,y1:A`] THEN STRIP_TAC); + (EXISTS_TAC `u0:A` THEN EXISTS_TAC `y1:A` THEN ASM_REWRITE_TAC[]); + (REWRITE_WITH `CARD (IMAGE (f:A#A->(A)list) S) = CARD S`); + (MATCH_MP_TAC CARD_IMAGE_INJ); + (STRIP_TAC); + (EXPAND_TAC "S" THEN EXPAND_TAC "f" THEN + REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `x = u0:A,y1:A`; + ASSUME `y = u0':A,y1':A`]); + (REWRITE_TAC[PAIR_EQ]); + (STRIP_TAC); + (REWRITE_WITH `u0 = HD [u0':A; y1']`); + (UP_ASM_TAC THEN MESON_TAC[HD]); + (REWRITE_TAC[HD]); + (REWRITE_WITH `y1 = HD (TL [u0':A; y1'])`); + (UP_ASM_TAC THEN MESON_TAC[HD; TL]); + (REWRITE_TAC[HD; TL]); + (EXPAND_TAC "S" THEN MATCH_MP_TAC FINITE_PRODUCT THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "S" THEN MATCH_MP_TAC CARD_PRODUCT THEN ASM_REWRITE_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 56 *) + +let FINITE_LIST_klemma = prove ( + `!s t. FINITE (s:A->bool) /\ FINITE t ==> + FINITE {CONS u0 y1 | u0 IN s /\ y1 IN t}`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC FINITE_PRODUCT_DEPENDENT THEN ASM_REWRITE_TAC[]);; + +(* ==================================================================== *) +(* Lemma 57 *) + +let CARD_LIST_4_klemma = prove_by_refinement ( + `!s:A->bool. + FINITE s + ==> CARD + {y | ?u0 u1 u2 u3. + u0 IN s /\ + u1 IN s /\ + u2 IN s /\ + u3 IN s /\ + y = [u0; u1; u2; u3]} = CARD s * CARD s * CARD s * CARD s`, + +[(REPEAT STRIP_TAC); + (REWRITE_TAC[SET_RULE + `{y | ?u0 u1 u2 u3. u0 IN s /\ u1 IN s /\ u2 IN s /\ u3 IN s /\ + y = [u0; u1; u2; u3]} = + {CONS u0 y1 | u0 IN s /\ + y1 IN {CONS u1 y2 | u1 IN s /\ + y2 IN {[u2;u3] | u2 IN s /\ + u3 IN s}}}`]); + (NEW_GOAL `FINITE {[u2:A; u3] | u2 IN s /\ u3 IN s}`); + (MATCH_MP_TAC FINITE_PRODUCT_DEPENDENT THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `FINITE + {CONS u1 y2 | (u1:A) IN s /\ y2 IN {[u2; u3] | u2 IN s /\ u3 IN s}}`); + (MATCH_MP_TAC FINITE_PRODUCT_DEPENDENT THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `FINITE + {CONS u0 y1 | u0 IN s /\ + y1 IN {CONS u1 y2 | u1 IN s /\ + y2 IN {[u2:A; u3] | u2 IN s /\ u3 IN s}}}`); + (MATCH_MP_TAC FINITE_PRODUCT_DEPENDENT THEN ASM_REWRITE_TAC[]); + (REWRITE_WITH `CARD + {CONS u0 y1 | u0 IN s /\ + y1 IN + {CONS u1 y2 | u1 IN s /\ y2 IN {[u2:A; u3] | u2 IN s /\ u3 IN s}}} + = CARD s * + CARD {CONS u1 y2 | u1 IN s /\ y2 IN {[u2; u3] | u2 IN s /\ u3 IN s}}`); + (ASM_SIMP_TAC[CARD_LIST_klemma]); + (REWRITE_WITH + `CARD {CONS u1 y2 | u1 IN s /\ y2 IN {[u2:A; u3] | u2 IN s /\ u3 IN s}} + = CARD s * CARD {[u2; u3] | u2 IN s /\ u3 IN s}`); + (ASM_SIMP_TAC[CARD_LIST_klemma]); + + (REWRITE_WITH `CARD {[u2:A; u3] | u2 IN s /\ u3 IN s} = CARD s * CARD s`); + (ASM_SIMP_TAC[CARD_LIST_klemma_2])]);; + +(* ==================================================================== *) +(* Lemma 58 *) +let BOUNDS_VGEN_klemma = prove_by_refinement( + `!u0 V r. &0 <= r /\ packing V ==> + &(CARD (V INTER ball (u0,r))) <= (r + &1) pow 3`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `sum (V INTER ball (u0,r)) (\x. vol (ball (x:real^3, &1))) + = & (CARD (V INTER ball (u0,r))) * (&4 / &3 * pi)`); + (NEW_GOAL `&0 <= &1`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(\x. vol (ball (x,&1))) = (\x. &4 / &3 * pi)`); + (REWRITE_TAC[FUN_EQ_THM]); + (ASM_SIMP_TAC[VOLUME_BALL] THEN REAL_ARITH_TAC); + (MATCH_MP_TAC SUM_CONST); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (UP_ASM_TAC); + (ABBREV_TAC `f = (\x:real^3. ball (x, &1))`); + (REWRITE_WITH `(\x. vol (ball (x:real^3,&1))) = (\x. vol (f x))`); + (REWRITE_TAC[FUN_EQ_THM] THEN STRIP_TAC); + (EXPAND_TAC "f" THEN REWRITE_TAC[]); + (REWRITE_WITH `sum (V INTER ball (u0:real^3,r)) (\x. vol (f x)) = + vol (UNIONS (IMAGE f (V INTER ball (u0,r))))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC MEASURE_DISJOINT_UNIONS_IMAGE); + (EXPAND_TAC "f" THEN REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (REWRITE_TAC[MEASURABLE_BALL]); + (REWRITE_TAC[DISJOINT; SET_RULE `a = {} <=> ~(?s. s IN a)`]); + (REWRITE_TAC[IN_INTER; IN_BALL]); + (STRIP_TAC); + (UNDISCH_TAC `packing V` THEN REWRITE_TAC[packing]); + (REPEAT STRIP_TAC); + (NEW_GOAL `&2 <= dist (x,y:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (NEW_GOAL `dist (x,y) <= dist (x,s) + dist (y,s:real^3)`); + (NORM_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (STRIP_TAC); + (NEW_GOAL `vol (UNIONS (IMAGE f (V INTER ball (u0:real^3,r)))) + <= vol (ball (u0, r + &1))`); + (MATCH_MP_TAC MEASURE_SUBSET); + (EXPAND_TAC "f" THEN REWRITE_TAC[IMAGE; MEASURABLE_BALL]); + (STRIP_TAC); + (MATCH_MP_TAC MEASURABLE_UNIONS); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[MEASURABLE_BALL]); + (REWRITE_TAC[UNIONS_SUBSET; IN_INTER; IN_BALL; IN_ELIM_THM; SUBSET]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0, x') <= dist (u0,x:real^3) + dist (x, x')`); + (NORM_ARITH_TAC); + (NEW_GOAL `dist (x,x':real^3) < &1`); + (REWRITE_TAC[GSYM IN_BALL] THEN ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `&(CARD (V INTER ball (u0,r))) * &4 / &3 * pi <= + vol (ball (u0,r + &1))`); + (ASM_REAL_ARITH_TAC); + + (UP_ASM_TAC THEN REWRITE_WITH + `vol (ball (u0, r + &1)) = &4 / &3 * pi * (r + &1) pow 3`); + (NEW_GOAL `&0 <= r + &1`); + (ASM_REAL_ARITH_TAC); + (SIMP_TAC[VOLUME_BALL; ASSUME `&0 <= r + &1`]); + + (REWRITE_TAC[REAL_ARITH `a * &4 / &3 * pi <= &4 / &3 * pi * b <=> + &0 <= pi * (b - a)`]); + (STRIP_TAC); + (NEW_GOAL `&0 <= (r + &1) pow 3 - &(CARD (V INTER ball (u0:real^3,r)))`); + (MATCH_MP_TAC Real_ext.REAL_PROP_NN_LCANCEL); + (EXISTS_TAC `pi`); + (ASM_REWRITE_TAC[PI_POS]); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 59 *) + +let BOUNDS_V4_klemma = prove_by_refinement ( + `!u0 V. packing V ==> CARD (V INTER ball (u0, &4)) <= 125`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `sum (V INTER ball (u0,&4)) (\x. vol (ball (x:real^3, &1))) + = & (CARD (V INTER ball (u0,&4))) * (&4 / &3 * pi)`); + (NEW_GOAL `&0 <= &1`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(\x. vol (ball (x,&1))) = (\x. &4 / &3 * pi)`); + (REWRITE_TAC[FUN_EQ_THM]); + (ASM_SIMP_TAC[VOLUME_BALL] THEN REAL_ARITH_TAC); + (MATCH_MP_TAC SUM_CONST); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (UP_ASM_TAC); + (ABBREV_TAC `f = (\x:real^3. ball (x, &1))`); + (REWRITE_WITH `(\x. vol (ball (x:real^3,&1))) = (\x. vol (f x))`); + (REWRITE_TAC[FUN_EQ_THM] THEN STRIP_TAC); + (EXPAND_TAC "f" THEN REWRITE_TAC[]); + (REWRITE_WITH `sum (V INTER ball (u0:real^3,&4)) (\x. vol (f x)) = + vol (UNIONS (IMAGE f (V INTER ball (u0,&4))))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC MEASURE_DISJOINT_UNIONS_IMAGE); + (EXPAND_TAC "f" THEN REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (REWRITE_TAC[MEASURABLE_BALL]); + (REWRITE_TAC[DISJOINT; SET_RULE `a = {} <=> ~(?s. s IN a)`]); + (REWRITE_TAC[IN_INTER; IN_BALL]); + (STRIP_TAC); + (UNDISCH_TAC `packing V` THEN REWRITE_TAC[packing]); + (REPEAT STRIP_TAC); + (NEW_GOAL `&2 <= dist (x,y:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (NEW_GOAL `dist (x,y) <= dist (x,s) + dist (y,s:real^3)`); + (NORM_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (STRIP_TAC); + (NEW_GOAL `vol (UNIONS (IMAGE f (V INTER ball (u0:real^3,&4)))) + <= vol (ball (u0, &5))`); + (MATCH_MP_TAC MEASURE_SUBSET); + (EXPAND_TAC "f" THEN REWRITE_TAC[IMAGE; MEASURABLE_BALL]); + (STRIP_TAC); + (MATCH_MP_TAC MEASURABLE_UNIONS); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[MEASURABLE_BALL]); + (REWRITE_TAC[UNIONS_SUBSET; IN_INTER; IN_BALL; IN_ELIM_THM; SUBSET]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0, x') <= dist (u0,x:real^3) + dist (x, x')`); + (NORM_ARITH_TAC); + (NEW_GOAL `dist (x,x':real^3) < &1`); + (REWRITE_TAC[GSYM IN_BALL] THEN ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `&(CARD (V INTER ball (u0,&4))) * &4 / &3 * pi <= + vol (ball (u0,&5))`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_WITH + `vol (ball (u0,&5)) = &4 / &3 * pi * (&5) pow 3`); + (SIMP_TAC[VOLUME_BALL; REAL_ARITH `&0 <= &5`]); + + (REWRITE_TAC[REAL_ARITH `a * &4 / &3 * pi <= &4 / &3 * pi * b <=> + &0 <= pi * (b - a)`]); + (STRIP_TAC); + (NEW_GOAL `&0 <= &5 pow 3 - &(CARD (V INTER ball (u0:real^3,&4)))`); + (MATCH_MP_TAC Real_ext.REAL_PROP_NN_LCANCEL); + (EXISTS_TAC `pi`); + (ASM_REWRITE_TAC[PI_POS]); + (REWRITE_TAC[GSYM REAL_OF_NUM_LE]); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 60 *) + +let CARD_MCELL_CONTAINS_POINT_klemma = prove_by_refinement ( + `?c. (!V u0. saturated V /\ packing V /\ u0 IN V + ==> CARD {X | mcell_set V X /\ VX V X u0} <= c)`, +[(EXISTS_TAC `1220703125`); + (REPEAT STRIP_TAC); + (ABBREV_TAC `S = {ul,i | barV V 3 ul /\ i IN 0..4 /\ + u0 IN set_of_list ul}`); + (NEW_GOAL `FINITE (S:(real^3)list#num->bool)`); + (REWRITE_WITH `S = {ul,i | ul IN {ul | barV V 3 ul /\ + u0 IN set_of_list ul} /\ i IN 0..4}`); + (EXPAND_TAC "S"); + (SET_TAC[]); + (MATCH_MP_TAC FINITE_PRODUCT); + (REWRITE_TAC[FINITE_NUMSEG]); + (MATCH_MP_TAC FINITE_SUBSET); + + (ABBREV_TAC `T1 = V INTER ball (u0:real^3, &4)`); + (NEW_GOAL `FINITE (T1:real^3->bool)`); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `{ul | ?v0 v1 v2 v3. + v0 IN T1 /\ v1 IN T1 /\ v2 IN T1 /\ v3 IN T1 /\ + ul = [v0;v1;v2;v3:real^3]}`); + (STRIP_TAC); + (MATCH_MP_TAC Ajripqn.FINITE_SET_LIST_LEMMA THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?v0 v1 v2 v3. x = [v0:real^3; v1; v2; v3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC THEN EXISTS_TAC `v0:real^3` THEN EXISTS_TAC + `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list (x:(real^3)list) SUBSET T1`); + (EXPAND_TAC "T1" THEN REWRITE_TAC[SUBSET_INTER]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:(real^3->bool)`); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `set_of_list (x:(real^3)list) u0` THEN ASM_REWRITE_TAC[IN]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + + (ABBREV_TAC `f = (\(ul,i). mcell i V ul)`); + (NEW_GOAL `{X | mcell_set V X /\ VX V X u0} SUBSET + (IMAGE (f:(real^3)list#num->real^3->bool) S) `); + (EXPAND_TAC "S" THEN EXPAND_TAC "f" THEN REWRITE_TAC[IMAGE]); + (REWRITE_TAC[mcell_set_2; SUBSET; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `ul:(real^3)list,i:num`); + (REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (REWRITE_TAC[MESON[IN] `(0..4) i <=> i IN 0..4`]); + (ASM_REWRITE_TAC[IN_NUMSEG_0]); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) i <=> i IN A`]); + (ASM_REWRITE_TAC[IN_NUMSEG_0]); + (NEW_GOAL `(u0:real^3) IN V INTER x`); + (REWRITE_WITH `V INTER x = VX V x`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[VX]); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) i <=> i IN A`]); + (SET_TAC[]); + (ASM_REWRITE_TAC[IN]); + (UP_ASM_TAC THEN REWRITE_WITH + `V INTER (x:real^3->bool) = set_of_list (truncate_simplex (i - 1) ul)`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `VX V x = V INTER x`); + + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[VX]); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) i <=> i IN A`]); + (SET_TAC[]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `i = 0`); + (NEW_GOAL `F`); + (UNDISCH_TAC `VX V x u0` THEN ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC [Lepjbdj.LEPJBDJ_0]); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) i <=> i IN A`]); + (SET_TAC[]); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + (UNDISCH_TAC `VX V x u0` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) i <=> i IN A`]); + (SET_TAC[]); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) i <=> i IN A`]); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> (u0 IN A ==> u0 IN B)`)); + (MATCH_MP_TAC Rogers.SET_OF_LIST_TRUNCATE_SIMPLEX_SUBSET); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC); + (MATCH_MP_TAC (ARITH_RULE `(?b. a:num <= b /\ b <= c) ==> a <= c`)); + (EXISTS_TAC `CARD (IMAGE (f:(real^3)list#num->real^3->bool) S)`); + (STRIP_TAC); + (MATCH_MP_TAC CARD_SUBSET); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_IMAGE); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC (ARITH_RULE `(?b. a:num <= b /\ b <= c) ==> a <= c`)); + (EXISTS_TAC `CARD (S:(real^3)list#num->bool)`); + (STRIP_TAC); + (MATCH_MP_TAC CARD_IMAGE_LE); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `S = {ul,i |ul IN {ul | barV V 3 ul /\ u0 IN set_of_list ul}/\ i IN 0..4}`); + (EXPAND_TAC "S" THEN SET_TAC[]); + (REWRITE_WITH + `CARD {ul,i |ul IN {ul | barV V 3 ul /\ u0 IN set_of_list ul}/\ i IN 0..4} = + CARD {ul | barV V 3 ul /\ u0 IN set_of_list ul} * CARD (0..4)`); + (MATCH_MP_TAC CARD_PRODUCT); + (REWRITE_TAC[FINITE_NUMSEG]); + (MATCH_MP_TAC FINITE_SUBSET); + + (ABBREV_TAC `T1 = V INTER ball (u0:real^3, &4)`); + (NEW_GOAL `FINITE (T1:real^3->bool)`); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `{ul | ?v0 v1 v2 v3. + v0 IN T1 /\ v1 IN T1 /\ v2 IN T1 /\ v3 IN T1 /\ + ul = [v0;v1;v2;v3:real^3]}`); + (STRIP_TAC); + (MATCH_MP_TAC Ajripqn.FINITE_SET_LIST_LEMMA THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?v0 v1 v2 v3. x = [v0:real^3; v1; v2; v3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC THEN EXISTS_TAC `v0:real^3` THEN EXISTS_TAC + `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list (x:(real^3)list) SUBSET T1`); + (EXPAND_TAC "T1" THEN REWRITE_TAC[SUBSET_INTER]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:(real^3->bool)`); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `set_of_list (x:(real^3)list) u0` THEN ASM_REWRITE_TAC[IN]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + + (REWRITE_TAC[CARD_NUMSEG; ARITH_RULE `(4 + 1) - 0 = 5`]); + (REWRITE_TAC[ARITH_RULE `a * 5 <= 1220703125 <=> a <= 244140625`]); + + (ABBREV_TAC `T1 = V INTER ball (u0:real^3, &4)`); + (NEW_GOAL `FINITE (T1:real^3->bool)`); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `{ul | barV V 3 ul /\ u0 IN set_of_list ul} SUBSET + {ul | ?v0 v1 v2 v3. + v0 IN T1 /\ v1 IN T1 /\ v2 IN T1 /\ v3 IN T1 /\ + ul = [v0;v1;v2;v3]}`); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?v0 v1 v2 v3. x = [v0:real^3; v1; v2; v3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC THEN EXISTS_TAC `v0:real^3` THEN EXISTS_TAC + `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list (x:(real^3)list) SUBSET T1`); + (EXPAND_TAC "T1" THEN REWRITE_TAC[SUBSET_INTER]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:(real^3->bool)`); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `set_of_list (x:(real^3)list) u0` THEN ASM_REWRITE_TAC[IN]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + + (MATCH_MP_TAC (ARITH_RULE `(?x. a <= x /\ x <= b:num) ==> a <= b`)); + (EXISTS_TAC `CARD {ul | ?v0 v1 v2 v3. + v0 IN T1 /\ + v1 IN T1 /\ + v2 IN T1 /\ + v3 IN T1 /\ + ul = [v0:real^3; v1; v2; v3]}`); + (STRIP_TAC); + (MATCH_MP_TAC CARD_SUBSET); + (ASM_REWRITE_TAC[] THEN MATCH_MP_TAC FINITE_SET_LIST_LEMMA); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `CARD + {y | ?u0 u1 u2 u3. + u0 IN T1 /\ + u1 IN T1 /\ + u2 IN T1 /\ + u3 IN T1 /\ + y = [u0:real^3; u1; u2; u3:real^3]} = + CARD T1 * CARD T1 * CARD T1 * CARD T1`); + (ASM_SIMP_TAC [CARD_LIST_4_klemma]); + (NEW_GOAL `CARD (T1:real^3->bool) <= 125`); + (EXPAND_TAC "T1"); + (MATCH_MP_TAC BOUNDS_V4_klemma); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD (T1:real^3->bool) * CARD T1 <= 125 * 125`); + (MATCH_MP_TAC LE_MULT2); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD (T1:real^3->bool) * CARD T1 * CARD T1 <= 125 * 125 * 125`); + (MATCH_MP_TAC LE_MULT2); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD (T1:real^3->bool) * CARD T1 * CARD T1 * CARD T1 <= + 125 * 125 * 125 * 125`); + (MATCH_MP_TAC LE_MULT2); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 61 *) +let BOUND_BETA_BUMP = prove_by_refinement ( + `?c. !V X e. + saturated V /\ packing V /\ mcell_set V X /\ critical_edgeX V X e + ==> beta_bump V e X <= c`, +[(EXISTS_TAC `&614400`); + (REWRITE_TAC[mcell_set_2; IN_ELIM_THM; IN; beta_bump]); + (REPEAT STRIP_TAC THEN LET_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[cell_params]); + + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (STRIP_TAC); + (ABBREV_TAC `P = (\(k,ul'). k <= 4 /\ ul' IN barV V 3 /\ + mcell i V ul = mcell k V ul')`); + (NEW_GOAL `(P:(num#(real^3)list->bool)) (k,ul')`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(i:num,ul:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (ASM_REWRITE_TAC[IN]); + (UP_ASM_TAC THEN EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM; IN] THEN STRIP_TAC); + + (ABBREV_TAC `S = {e',e'',p,vl | 4 = k /\ + {e', e''} = critical_edgeX V X /\ + e' = e /\ + p permutes 0..3 /\ + left_action_list p ul' = vl /\ + {EL 0 vl, EL 1 vl} = e' /\ + {EL 2 vl, EL 3 vl} = e''}`); + + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `K1 = {us:real^3->bool | us SUBSET set_of_list ul}`); + (NEW_GOAL `FINITE (K1:(real^3->bool)->bool)`); + (EXPAND_TAC "K1" THEN MATCH_MP_TAC FINITE_POWERSET); + (ASM_REWRITE_TAC[set_of_list; Geomdetail.FINITE6]); + + (NEW_GOAL `critical_edgeX V X SUBSET K1`); + (EXPAND_TAC "K1" THEN + REWRITE_TAC[critical_edgeX; edgeX; SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `(x:real^3->bool) SUBSET set_of_list ul`); + (REWRITE_TAC[ASSUME `x = {u, v:real^3}`; ASSUME `{u, v} = {u', v':real^3}`]); + (NEW_GOAL `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (NEW_GOAL `VX V X = {}`); + (ASM_REWRITE_TAC[VX]); + (UNDISCH_TAC `VX V X u'` THEN + ASM_REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`] THEN SET_TAC[]); + (NEW_GOAL + `V INTER (X:real^3->bool) = set_of_list (truncate_simplex (i - 1) ul)`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_CASES_TAC `i = 0`); + (NEW_GOAL `F`); + (NEW_GOAL `VX V X = {}`); + (REWRITE_TAC[ASSUME `VX V X = V INTER X`; ASSUME `X = mcell i V ul`; + ASSUME `i = 0`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `VX V X u'` THEN REWRITE_TAC[ASSUME `VX V X = {}`; + MESON[IN] `{} x <=> x IN {}`] THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + (REWRITE_TAC[GSYM (ASSUME `mcell i V ul = mcell k V ul'`); + GSYM (ASSUME `X = mcell i V ul`)]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (REWRITE_TAC[NEGLIGIBLE_EMPTY; ASSUME `X = {}:real^3->bool`]); + (NEW_GOAL `VX V X = {}`); + (REWRITE_TAC[VX; ASSUME `NULLSET X`]); + (UNDISCH_TAC `VX V X u'` THEN REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`; + ASSUME `VX V X = {}`] THEN SET_TAC[]); + (NEW_GOAL `set_of_list (truncate_simplex (i - 1) ul) SUBSET + set_of_list (ul:(real^3)list)`); + (MATCH_MP_TAC Rogers.SET_OF_LIST_TRUNCATE_SIMPLEX_SUBSET); + (ASM_REWRITE_TAC[LENGTH] THEN ASM_ARITH_TAC); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + + (NEW_GOAL + `FINITE + (S:(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list->bool)`); + (EXPAND_TAC "S"); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{e',e'',p,vl | {e', e''} = critical_edgeX V X /\ + p permutes 0..3 /\ + left_action_list p ul' = vl:(real^3)list}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{e',e'',p,vl | (e':real^3->bool) IN K1 /\ e'' IN K1 /\ + p permutes 0..3 /\ + left_action_list p ul' = vl:(real^3)list}`); + (STRIP_TAC); + (ABBREV_TAC `S_temp = {e',e'',p | (e':real^3->bool) IN K1 /\ e'' IN K1 /\ + p permutes 0..3}`); + (ABBREV_TAC + `f_temp = (\(e':real^3->bool,e'':real^3->bool,p). + e',e'',p, (left_action_list p (ul':(real^3)list)))`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `IMAGE (f_temp:(real^3->bool)#(real^3->bool)#(num->num)->(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list) S_temp`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE); + + (REWRITE_WITH `S_temp = {e':real^3->bool,u | e' IN K1 /\ + u IN {e'', p | e'' IN K1 /\p permutes 0..3}}`); + (EXPAND_TAC "S_temp"); + (SET_TAC[]); + (ABBREV_TAC `K2 = {e'':real^3->bool, p | e'' IN K1 /\p permutes 0..3}`); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `K2 = {e'':real^3->bool,p | e'' IN K1 /\ p IN {p | p permutes 0..3}}`); + (EXPAND_TAC "K2" THEN SET_TAC[]); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM NUMSEG_LE; ARITH_RULE `a <= 3 <=> a < 4`; + Marchal_cells_2_new.SET_OF_0_TO_3; + Upfzbzm_support_lemmas.FINITE_PERMUTE_4]); + (EXPAND_TAC "f_temp" THEN EXPAND_TAC "S_temp" THEN REWRITE_TAC[IMAGE]); + (REWRITE_TAC[IN; SUBSET; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `e':real^3->bool,e'':real^3->bool,p:num->num`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `e':real^3->bool` THEN + EXISTS_TAC `e'':real^3->bool` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (SET_TAC[]); + + +(* ------------------------------------------------------------------------ *) +(* Finish proving S is FINITE *) +(* ------------------------------------------------------------------------ *) + + (MATCH_MP_TAC (REAL_ARITH `(?x. a <= x /\ x <= b) ==> a <= b`)); + (EXISTS_TAC + `sum (S:(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list->bool) + (\x. &100)`); + (STRIP_TAC); + (MATCH_MP_TAC SUM_LE); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "S" THEN REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `4 = k`); REAL_ARITH `a / &4 <= &100 <=> a <= &400`]); + (REWRITE_TAC[bump]); + (REWRITE_TAC[REAL_ARITH + `#0.005 * (&1 - a) - #0.005 * (&1 - b) <= &400 <=> + b - a <= &80000`]); + (MATCH_MP_TAC (REAL_ARITH `(&0 <= a /\ b <= c ==> b - a <= c)`)); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[Real_ext.REAL_LE_POW_2]); + (REWRITE_TAC[hplus; h0; REAL_ARITH + `a / (#1.3254 - #1.26) pow 2 <= &80000 <=> a <= #342.1728`]); + (NEW_GOAL `barV V 3 vl`); + (MATCH_MP_TAC Qzksykg.QZKSYKG1); + (EXISTS_TAC `ul':(real^3)list`); + (EXISTS_TAC `4` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[ARITH_RULE `4 - 1 = 3`]); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `mcell i V ul = mcell k V ul'`); + GSYM (ASSUME `X = mcell i V ul`)]); + (STRIP_TAC); + (NEW_GOAL `critical_edgeX V X = {}`); + (REWRITE_TAC[critical_edgeX ; edgeX; IN; IN_ELIM_THM; + SET_RULE `X = {} <=> ~(?s. s IN X)`]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (ASM_MESON_TAC[NEGLIGIBLE_EMPTY]); + (UNDISCH_TAC `VX V X v'` THEN REWRITE_TAC[VX; ASSUME `NULLSET X`]); + (REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`] THEN SET_TAC[]); + (UNDISCH_TAC `critical_edgeX V X e`); + (REWRITE_TAC[ASSUME `critical_edgeX V X = {}`; MESON[IN] `{} x <=> x IN {}`] + THEN SET_TAC[]); + + + (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[EL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; HD; TL]); + (REWRITE_TAC[ARITH_RULE `SUC (SUC 0) = 2`]); + (NEW_GOAL `(hl [v2; v3:real^3] - #1.26) pow 2 <= (&10) pow 2`); + (REWRITE_TAC[GSYM REAL_LE_SQUARE_ABS; REAL_ARITH `abs (&10) = &10`]); + (ASM_CASES_TAC `&0 <= hl [v2; v3:real^3] - #1.26`); + (REWRITE_WITH `abs (hl [v2; v3:real^3] - #1.26) = hl [v2; v3] - #1.26`); + (ASM_REAL_ARITH_TAC); + + (REWRITE_TAC[HL_2; + REAL_ARITH `inv (&2) * a - #1.26 <= &10 <=> a <= #22.52`]); + (NEW_GOAL `set_of_list vl SUBSET ball (v2:real^3,&4)`); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN STRIP_TAC); + (SUBGOAL_THEN `v3:real^3 IN ball (v2, &k)` MP_TAC); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[IN_BALL; GSYM (ASSUME `4 = k`)]); + (REAL_ARITH_TAC); + (REWRITE_WITH `abs (hl [v2; v3] - #1.26) = #1.26 - hl [v2; v3:real^3]`); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a ==> #1.26 - a <= &10`)); + (REWRITE_TAC[HL_2] THEN NORM_ARITH_TAC); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (ASM_SIMP_TAC[SUM_CONST]); + + + (EXPAND_TAC "S"); + (MATCH_MP_TAC (REAL_ARITH `(?s. x <= s /\ s <= b) ==> x <= b`)); + (EXISTS_TAC `& (CARD {e',e'',p,vl | {e', e''} = critical_edgeX V X /\ + p permutes 0..3 /\ + left_action_list p ul' = vl:(real^3)list}) * &100 `); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a * &100 <= b * &100 <=> a <= b`]); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (STRIP_TAC); + (SET_TAC[]); + (MATCH_MP_TAC FINITE_SUBSET); + +(*****) + (EXISTS_TAC `{e',e'',p,vl | (e':real^3->bool) IN K1 /\ e'' IN K1 /\ + p permutes 0..3 /\ + left_action_list p ul' = vl:(real^3)list}`); + (STRIP_TAC); + (ABBREV_TAC `S_temp = {e',e'',p | (e':real^3->bool) IN K1 /\ e'' IN K1 /\ + p permutes 0..3}`); + (ABBREV_TAC + `f_temp = (\(e':real^3->bool,e'':real^3->bool,p). + e',e'',p, (left_action_list p (ul':(real^3)list)))`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `IMAGE (f_temp:(real^3->bool)#(real^3->bool)#(num->num)->(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list) S_temp`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE); + + (REWRITE_WITH `S_temp = {e':real^3->bool,u | e' IN K1 /\ + u IN {e'', p | e'' IN K1 /\p permutes 0..3}}`); + (EXPAND_TAC "S_temp"); + (SET_TAC[]); + (ABBREV_TAC `K2 = {e'':real^3->bool, p | e'' IN K1 /\p permutes 0..3}`); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `K2 = {e'':real^3->bool,p | e'' IN K1 /\ p IN {p | p permutes 0..3}}`); + (EXPAND_TAC "K2" THEN SET_TAC[]); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM NUMSEG_LE; ARITH_RULE `a <= 3 <=> a < 4`; + Marchal_cells_2_new.SET_OF_0_TO_3; + Upfzbzm_support_lemmas.FINITE_PERMUTE_4]); + (EXPAND_TAC "f_temp" THEN EXPAND_TAC "S_temp" THEN REWRITE_TAC[IMAGE]); + (REWRITE_TAC[IN; SUBSET; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `e':real^3->bool,e'':real^3->bool,p:num->num`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `e':real^3->bool` THEN + EXISTS_TAC `e'':real^3->bool` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (SWITCH_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC (REAL_ARITH `(?s. x <= s /\ s <= b) ==> x <= b`)); + (EXISTS_TAC `& (CARD {e',e'',p,vl | (e':real^3->bool) IN K1 /\ e'' IN K1 /\ + p permutes 0..3 /\ + left_action_list p ul' = vl:(real^3)list}) * &100 `); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a * &100 <= b * &100 <=> a <= b`]); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (STRIP_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + +(* **** *) + (ABBREV_TAC `S_temp = {e',e'',p | (e':real^3->bool) IN K1 /\ e'' IN K1 /\ + p permutes 0..3}`); + (ABBREV_TAC + `f_temp = (\(e':real^3->bool,e'':real^3->bool,p). + e',e'',p, (left_action_list p (ul':(real^3)list)))`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `IMAGE (f_temp:(real^3->bool)#(real^3->bool)#(num->num)->(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list) S_temp`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE); + + (REWRITE_WITH `S_temp = {e':real^3->bool,u | e' IN K1 /\ + u IN {e'', p | e'' IN K1 /\p permutes 0..3}}`); + (EXPAND_TAC "S_temp"); + (SET_TAC[]); + (ABBREV_TAC `K2 = {e'':real^3->bool, p | e'' IN K1 /\p permutes 0..3}`); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `K2 = {e'':real^3->bool,p | e'' IN K1 /\ p IN {p | p permutes 0..3}}`); + (EXPAND_TAC "K2" THEN SET_TAC[]); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM NUMSEG_LE; ARITH_RULE `a <= 3 <=> a < 4`; + Marchal_cells_2_new.SET_OF_0_TO_3; + Upfzbzm_support_lemmas.FINITE_PERMUTE_4]); + (EXPAND_TAC "f_temp" THEN EXPAND_TAC "S_temp" THEN REWRITE_TAC[IMAGE]); + (REWRITE_TAC[IN; SUBSET; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `e':real^3->bool,e'':real^3->bool,p:num->num`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `e':real^3->bool` THEN + EXISTS_TAC `e'':real^3->bool` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + + + (MATCH_MP_TAC (REAL_ARITH `(?s. x <= s /\ s <= b) ==> x <= b`)); + (ABBREV_TAC `S_temp = {e',e'',p | (e':real^3->bool) IN K1 /\ e'' IN K1 /\ + p permutes 0..3}`); + (ABBREV_TAC + `f_temp = (\(e':real^3->bool,e'':real^3->bool,p). + e',e'',p, (left_action_list p (ul':(real^3)list)))`); + (EXISTS_TAC `& (CARD (IMAGE (f_temp:(real^3->bool)#(real^3->bool)#(num->num)->(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list) S_temp)) * &100`); + + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a * &100 <= b * &100 <=> a <= b`]); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (STRIP_TAC); + (EXPAND_TAC "f_temp" THEN EXPAND_TAC "S_temp" THEN REWRITE_TAC[IMAGE]); + (REWRITE_TAC[IN; SUBSET; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `e':real^3->bool,e'':real^3->bool,p:num->num`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `e':real^3->bool` THEN + EXISTS_TAC `e'':real^3->bool` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC FINITE_IMAGE); + (REWRITE_WITH `S_temp = {e':real^3->bool,u | e' IN K1 /\ + u IN {e'', p | e'' IN K1 /\p permutes 0..3}}`); + (EXPAND_TAC "S_temp"); + (SET_TAC[]); + (ABBREV_TAC `K2 = {e'':real^3->bool, p | e'' IN K1 /\p permutes 0..3}`); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `K2 = {e'':real^3->bool,p | e'' IN K1 /\ p IN {p | p permutes 0..3}}`); + (EXPAND_TAC "K2" THEN SET_TAC[]); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM NUMSEG_LE; ARITH_RULE `a <= 3 <=> a < 4`; + Marchal_cells_2_new.SET_OF_0_TO_3; + Upfzbzm_support_lemmas.FINITE_PERMUTE_4]); + + (MATCH_MP_TAC (REAL_ARITH `(?s. x <= s /\ s <= b) ==> x <= b`)); + (EXISTS_TAC + `& (CARD (S_temp:(real^3->bool)#(real^3->bool)#(num->num)->bool)) * &100`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a * &100 <= b * &100 <=> a <= b`]); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_IMAGE_LE); + (REWRITE_WITH `S_temp = {e':real^3->bool,u | e' IN K1 /\ + u IN {e'', p | e'' IN K1 /\p permutes 0..3}}`); + (EXPAND_TAC "S_temp"); + (SET_TAC[]); + (ABBREV_TAC `K2 = {e'':real^3->bool, p | e'' IN K1 /\p permutes 0..3}`); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `K2 = {e'':real^3->bool,p | e'' IN K1 /\ p IN {p | p permutes 0..3}}`); + (EXPAND_TAC "K2" THEN SET_TAC[]); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM NUMSEG_LE; ARITH_RULE `a <= 3 <=> a < 4`; + Marchal_cells_2_new.SET_OF_0_TO_3; + Upfzbzm_support_lemmas.FINITE_PERMUTE_4]); + + (REWRITE_WITH `S_temp = {e':real^3->bool,u | e' IN K1 /\ + u IN {e'', p | e'' IN K1 /\p permutes 0..3}}`); + (EXPAND_TAC "S_temp"); + (SET_TAC[]); + (ABBREV_TAC `K2 = {e'':real^3->bool, p | e'' IN K1 /\p permutes 0..3}`); + (REWRITE_WITH `CARD {e':real^3->bool,u:(real^3->bool)#(num->num) | + e' IN K1 /\ u IN K2} = CARD K1 * CARD K2`); + (MATCH_MP_TAC CARD_PRODUCT); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `K2 = {e'':real^3->bool,p | e'' IN K1 /\ p IN {p | p permutes 0..3}}`); + (EXPAND_TAC "K2" THEN SET_TAC[]); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM NUMSEG_LE; ARITH_RULE `a <= 3 <=> a < 4`; + Marchal_cells_2_new.SET_OF_0_TO_3; + Upfzbzm_support_lemmas.FINITE_PERMUTE_4]); + + (REWRITE_WITH `CARD (K2:(real^3->bool)#(num->num)->bool) = + CARD (K1:(real^3->bool)->bool) * CARD {p | p permutes 0..3}`); + (REWRITE_WITH + `K2 = {e'':real^3->bool,p | e'' IN K1 /\ p IN {p | p permutes 0..3}}`); + (EXPAND_TAC "K2" THEN SET_TAC[]); + (MATCH_MP_TAC CARD_PRODUCT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM NUMSEG_LE; ARITH_RULE `a <= 3 <=> a < 4`; + Marchal_cells_2_new.SET_OF_0_TO_3; + Upfzbzm_support_lemmas.FINITE_PERMUTE_4]); + (REWRITE_WITH `CARD (K1:(real^3->bool)->bool) = 16`); + + (REWRITE_WITH `16 = 2 EXP (CARD (set_of_list (ul:(real^3)list)))`); + (REWRITE_WITH `CARD (set_of_list (ul:(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (EXPAND_TAC "K1"); + (MATCH_MP_TAC CARD_POWERSET); + (ASM_REWRITE_TAC[set_of_list; Geomdetail.FINITE6]); + (REWRITE_WITH `CARD {p | p permutes 0..3} = FACT (CARD (0..3))`); + (MATCH_MP_TAC CARD_PERMUTATIONS); + (REWRITE_TAC[FINITE_NUMSEG]); + (REWRITE_TAC[CARD_NUMSEG; ARITH_RULE `16 * 16 * FACT ((3 + 1) - 0) = 6144`]); + + (REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 62 *) + +let MCELL_SUBSET_BALL8_2 = prove ( + `!V X v. packing V /\ saturated V /\ mcell_set V X /\ v IN X + ==> X SUBSET ball (v,&8)`, + REWRITE_TAC[mcell_set; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + MATCH_MP_TAC MCELL_SUBSET_BALL8 THEN ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]);; + +(* ==================================================================== *) +(* Lemma 63 *) +let critical_edge_subset_mcell = prove_by_refinement ( + `!V X x. packing V /\ saturated V /\ mcell_set V X /\ critical_edgeX V X x + ==> x SUBSET X`, +[(REWRITE_TAC[mcell_set_2; critical_edgeX; edgeX; IN_ELIM_THM; IN]); + (REPEAT STRIP_TAC); + (NEW_GOAL `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC THEN UNDISCH_TAC `VX V X u'` THEN + ASM_REWRITE_TAC[VX; MESON[IN] `{} u <=> u IN {}`] THEN SET_TAC[]); + (ASM_SET_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 64 *) + +let EDGEX_SUBSET_MCELL = prove_by_refinement ( + `!V X e. packing V /\ saturated V /\ mcell_set V X /\ edgeX V X e + ==> e SUBSET X`, +[(REWRITE_TAC[edgeX; IN; IN_ELIM_THM; mcell_set] THEN REPEAT STRIP_TAC); + (NEW_GOAL `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num` THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC THEN UNDISCH_TAC `VX V X u` THEN + ASM_REWRITE_TAC[VX; MESON[IN] `{} x <=> x IN {}`] THEN SET_TAC[]); + (ASM_SET_TAC[])]);; + +let CRITICAL_EDGEX_SUBSET_MCELL = prove ( + `!V X e. packing V /\ saturated V /\ mcell_set V X /\ critical_edgeX V X e + ==> e SUBSET X`, + (REPEAT STRIP_TAC) THEN + (MATCH_MP_TAC EDGEX_SUBSET_MCELL) THEN + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]) THEN + (UP_ASM_TAC THEN REWRITE_TAC[critical_edgeX] THEN SET_TAC[]));; + +(* ==================================================================== *) +(* Lemma 65 *) + +let FINITE_VX = prove_by_refinement ( + `!V X. packing V /\ saturated V /\ mcell_set V X ==> FINITE (VX V X)`, +[(REWRITE_TAC[mcell_set_2; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_CASES_TAC `VX V X = {}`); + (ASM_REWRITE_TAC[FINITE_EMPTY]); + (REWRITE_WITH `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num` THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC THEN UNDISCH_TAC `~(VX V X = {})` THEN + ASM_REWRITE_TAC[VX]); + (ASM_CASES_TAC `V INTER (X:real^3->bool) = {}`); + (ASM_REWRITE_TAC[FINITE_EMPTY]); + (REWRITE_WITH + `(V:real^3->bool) INTER X = set_of_list (truncate_simplex (i-1) ul)`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_CASES_TAC `i = 0`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~(V INTER (X:real^3->bool) = {})`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + (STRIP_TAC); + (UNDISCH_TAC `~(VX V X = {})` THEN ASM_REWRITE_TAC[VX; NEGLIGIBLE_EMPTY]); + (REWRITE_TAC[FINITE_SET_OF_LIST])]);; + +(* ==================================================================== *) +(* Lemma 66 *) + +let CARD_EDGEX_LE_16 = prove_by_refinement ( + `!V X. packing V /\ saturated V /\ mcell_set V X + ==> CARD (edgeX V X) <= 16`, +[(REWRITE_TAC[edgeX] THEN REPEAT STRIP_TAC); + (ABBREV_TAC `S = {u, v | VX V X u /\ VX V X v /\ ~(u = v)}`); + (ABBREV_TAC `f = (\(u,v:real^3). {u,v})`); + (MATCH_MP_TAC (ARITH_RULE `(?x:num. y <= x /\ x <= z) ==> y <= z`)); + (EXISTS_TAC `CARD (IMAGE (f:(real^3#real^3)->(real^3->bool)) S)`); + (STRIP_TAC); + (MATCH_MP_TAC CARD_SUBSET); + (STRIP_TAC); + (EXPAND_TAC "f" THEN EXPAND_TAC "S" THEN + REWRITE_TAC[IMAGE; SUBSET; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `u:real^3,v:real^3` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `u:real^3` THEN EXISTS_TAC `v:real^3` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_IMAGE); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{u,v | u IN VX V X /\ v IN VX V X}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_PRODUCT); + (REWRITE_TAC[] THEN MATCH_MP_TAC FINITE_VX); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + + (MATCH_MP_TAC (ARITH_RULE `(?x:num. y <= x /\ x <= z) ==> y <= z`)); + (EXISTS_TAC `CARD (S:(real^3#real^3)->bool)`); + (STRIP_TAC); + (MATCH_MP_TAC CARD_IMAGE_LE); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{u,v | u IN VX V X /\ v IN VX V X}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_PRODUCT); + (REWRITE_TAC[] THEN MATCH_MP_TAC FINITE_VX); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + + (MATCH_MP_TAC (ARITH_RULE `(?x:num. y <= x /\ x <= z) ==> y <= z`)); + (EXISTS_TAC `CARD {u,v | u IN VX V X /\ v IN VX V X}`); + (STRIP_TAC); + (MATCH_MP_TAC CARD_SUBSET); + (STRIP_TAC); + (ASM_SET_TAC[]); + (MATCH_MP_TAC FINITE_PRODUCT); + (REWRITE_TAC[] THEN MATCH_MP_TAC FINITE_VX); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH + `CARD {u,v | u IN VX V X /\ v IN VX V X} = CARD (VX V X) * CARD (VX V X)`); + (MATCH_MP_TAC CARD_PRODUCT THEN ASM_SIMP_TAC[FINITE_VX]); + + (UNDISCH_TAC `mcell_set V X` THEN REWRITE_TAC[mcell_set_2; IN; IN_ELIM_THM]); + (STRIP_TAC); + + (ASM_CASES_TAC `VX V X = {}`); + (ASM_REWRITE_TAC[CARD_CLAUSES] THEN ARITH_TAC); + (REWRITE_WITH `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num` THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC THEN UNDISCH_TAC `~(VX V X = {})` THEN + ASM_REWRITE_TAC[VX]); + (ASM_CASES_TAC `V INTER (X:real^3->bool) = {}`); + (ASM_REWRITE_TAC[CARD_CLAUSES] THEN ARITH_TAC); + (REWRITE_WITH + `(V:real^3->bool) INTER X = set_of_list (truncate_simplex (i-1) ul)`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_CASES_TAC `i = 0`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~(V INTER (X:real^3->bool) = {})`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + (STRIP_TAC); + (UNDISCH_TAC `~(VX V X = {})` THEN ASM_REWRITE_TAC[VX; NEGLIGIBLE_EMPTY]); + (NEW_GOAL `CARD (set_of_list (truncate_simplex (i - 1) ul)) <= + LENGTH (truncate_simplex (i - 1) (ul:(real^3)list))`); + (REWRITE_TAC[CARD_SET_OF_LIST_LE]); + (UP_ASM_TAC THEN REWRITE_WITH + `LENGTH (truncate_simplex (i - 1) (ul:(real^3)list)) = (i - 1 + 1)`); + (MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC); + (STRIP_TAC); + (ABBREV_TAC + `s = CARD (set_of_list (truncate_simplex (i - 1) (ul:(real^3)list)))`); + (NEW_GOAL `s <= 4`); + (ASM_ARITH_TAC); + (NEW_GOAL `s * s <= s * 4 /\ s * 4 <= 4 * 4`); + (ASM_REWRITE_TAC[LE_MULT_LCANCEL; LE_MULT_RCANCEL]); + (ASM_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 67 *) +let gamma_y_lmfun_bound2 = prove_by_refinement ( + `?d. (!V X e. packing V /\ saturated V /\ mcell_set V X /\ edgeX V X e ==> gammaY V X lmfun e <= d)`, +[ + (EXISTS_TAC `pi * h0 / (h0 - &1)`); + (REPEAT STRIP_TAC); + (ABBREV_TAC `f = (\u v. if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)`); + (REWRITE_WITH `gammaY V X lmfun = (\({u, v}). f u v)`); + (EXPAND_TAC "f" THEN REWRITE_TAC[gammaY]); + + (NEW_GOAL `!u v. (f:real^3->real^3->real) u v = f v u`); + (EXPAND_TAC "f" THEN REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]); + (REPEAT GEN_TAC THEN COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_WITH `dihX V X (u,v) = dihX V X (v,u)`); + (MATCH_MP_TAC DIHX_SYM); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REFL_TAC); + + (UNDISCH_TAC `edgeX V X e` THEN REWRITE_TAC[IN;IN_ELIM_THM; edgeX]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `(\({u, v}). f u v) {u, v} = + (f:real^3->real^3->real) u v`); + (MATCH_MP_TAC BETA_PAIR_THM); + (ASM_REWRITE_TAC[]); + + (EXPAND_TAC "f"); + (COND_CASES_TAC); + + (NEW_GOAL `dihX V X (u,v) * lmfun (hl [u;v]) <= pi * lmfun (hl [u;v])`); + (REWRITE_TAC[REAL_ARITH `a * x <= b * x <=> &0 <= (b - a) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[lmfun_pos_le; REAL_ARITH `&0 <= a - b <=> b <= a`; DIHX_LE_PI]); + + (NEW_GOAL `pi * lmfun (hl [u:real^3;v]) <= pi * h0 / (h0 - &1)`); + (REWRITE_TAC[REAL_ARITH `a * x <= a * y <=> &0 <= (y - x) * a`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[PI_POS_LE; REAL_ARITH `&0 <= a - b <=> b <= a`]); + (MATCH_MP_TAC lmfun_bounded); + (REWRITE_TAC[HL_2; REAL_ARITH `&0 <= inv (&2) * x <=> &0 <= x`; DIST_POS_LE]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[PI_POS_LE]); + (MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[h0] THEN REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 68 *) +let BOUND_GAMMA_X_lmfun = prove_by_refinement ( + `?c. + (!V X. packing V /\ saturated V /\ mcell_set V X ==> gammaX V X lmfun <= c)`, +[(MP_TAC gamma_y_lmfun_bound2 THEN STRIP_TAC); + (ABBREV_TAC `e = max d (&0)`); + (EXISTS_TAC `&4 / &3 * pi * (&8) pow 3 + (&8 * mm2 / pi) * &16 * e`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[gammaX]); + (MATCH_MP_TAC (REAL_ARITH + `a <= x /\ &0 <= b /\ c <= y ==> a - b + c <= x + y`)); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `X:real^3->bool = {}`); + (ASM_REWRITE_TAC[MEASURE_EMPTY; + REAL_ARITH `&0 <= &4 / &3 * pi * &8 pow 3 <=> &0 <= pi`]); + (REWRITE_TAC[PI_POS_LE]); + (NEW_GOAL `?p:real^3. p IN X`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `&4 / &3 * pi * &8 pow 3 = vol (ball (p, &8))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC VOLUME_BALL); + (REAL_ARITH_TAC); + (MATCH_MP_TAC MEASURE_SUBSET); + (REWRITE_TAC[MEASURABLE_BALL]); + (STRIP_TAC); + (UNDISCH_TAC `mcell_set V X` THEN REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_MCELL); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MCELL_SUBSET_BALL8_2); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 <= &2 * a <=> &0 <= a`]); + (MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (NEW_GOAL `#1.012080 < mm1`); + (REWRITE_TAC[Flyspeck_constants.bounds]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[PI_POS_LE]); + (REWRITE_TAC[total_solid]); + (MATCH_MP_TAC SUM_POS_LE); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC FINITE_VX); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[sol]); + + (NEW_GOAL `eventually_radial (x:real^3) X`); + (UNDISCH_TAC `mcell_set V X` THEN REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Urrphbz2.URRPHBZ2); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC THEN UNDISCH_TAC `x IN VX V X`); + (ASM_REWRITE_TAC[VX] THEN SET_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[eventually_radial]); + (STRIP_TAC); + + (REWRITE_WITH `sol x X = &3 * vol (X INTER normball x r) / r pow 3`); + (MATCH_MP_TAC sol); + (REWRITE_TAC[GSYM Marchal_cells_2_new.RADIAL_VS_RADIAL_NORM; NORMBALL_BALL]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[MEASURABLE_BALL]); + (UNDISCH_TAC `mcell_set V X` THEN REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_MCELL); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `&0 <= &3 * a <=> &0 <= a`]); + (MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (MATCH_MP_TAC MEASURE_POS_LE); + (REWRITE_TAC[NORMBALL_BALL]); + (MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[MEASURABLE_BALL]); + (UNDISCH_TAC `mcell_set V X` THEN REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_MCELL); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Real_ext.REAL_PROP_NN_POW); + (ASM_REAL_ARITH_TAC); + (ONCE_REWRITE_TAC[REAL_ARITH `a <= b <=> &0 <= b - a`]); + (REWRITE_TAC[REAL_ARITH `a * x - a * y = a * (x - y)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= &8 * a <=> &0 <= a`]); + (MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (NEW_GOAL `#0.02541 < mm2`); + (REWRITE_TAC[Flyspeck_constants.bounds]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[PI_POS_LE]); + (REWRITE_TAC[GSYM gammaY]); + (ONCE_REWRITE_TAC[REAL_ARITH `&0 <= b - a <=> a <= b`]); + (NEW_GOAL `sum (edgeX V X) (gammaY V X lmfun) <= + sum (edgeX V X) (\x. e)`); + (MATCH_MP_TAC SUM_LE); + (REWRITE_TAC[Upfzbzm_support_lemmas.FINITE_edgeX]); + (REPEAT STRIP_TAC); + (NEW_GOAL `gammaY V X lmfun x <= d`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `sum (edgeX V X) (\x. e) <= &16 * e`); + (REWRITE_WITH `sum (edgeX V X) (\x. e) = &(CARD (edgeX V X)) * e`); + (MATCH_MP_TAC SUM_CONST); + (REWRITE_TAC[Upfzbzm_support_lemmas.FINITE_edgeX]); + + (ONCE_REWRITE_TAC[REAL_ARITH `a <= b <=> &0 <= b - a`]); + (REWRITE_TAC[REAL_ARITH `a * x - b * x = x * (a - b)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ONCE_REWRITE_TAC[REAL_ARITH `&0 <= b - a <=> a <= b`]); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_EDGEX_LE_16); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 69 *) +(* ==================================================================== *) +(* Lemma 70 *) +(* ==================================================================== *) +(* Lemma 71 *) + + + diff --git a/legacy/oldpacking/packing/development/Backup/sum_gammaX_lmfun_estimate.hl b/legacy/oldpacking/packing/development/Backup/sum_gammaX_lmfun_estimate.hl new file mode 100644 index 0000000..65cc180 --- /dev/null +++ b/legacy/oldpacking/packing/development/Backup/sum_gammaX_lmfun_estimate.hl @@ -0,0 +1,1437 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: UPFZBZM *) +(* SUM_GAMMAX_LMFUN_ESTIMATE - a supported lemma. *) +(* Chaper : Packing (Clusters) *) +(* *) +(* ========================================================================= *) +open Sum_beta_bump;; + +let TSKAJXY_statement = new_definition + `TSKAJXY_statement <=> + (!V X. + saturated V /\ + packing V /\ + mcell_set V X /\ + critical_edgeX V X = {} + ==> gammaX V X lmfun >= &0)`;; + +let SUM_GAMMAX_LMFUN_ESTIMATE_concl = + `!V. ?c. !r. saturated V /\ packing V /\ &1 <= r /\ + cell_cluster_estimate V /\ TSKAJXY_statement ==> + c * r pow 2 <= sum {X | X SUBSET ball (vec 0, r) /\ mcell_set V X} + (\X. gammaX V X lmfun)`;; + +(* ========================================================================= *) +(* ========================================================================= *) + +let SUM_GAMMAX_LMFUN_ESTIMATE = prove_by_refinement ( + SUM_GAMMAX_LMFUN_ESTIMATE_concl, + +[(GEN_TAC); + +(* ================== Choose the constants ================================= *) + + (NEW_GOAL `?cc1. (&1 <= cc1) /\ (!V X. + packing V /\ saturated V /\ mcell_set V X + ==> gammaX V X lmfun <= cc1)`); + (MP_TAC BOUND_GAMMA_X_lmfun THEN STRIP_TAC); + (EXISTS_TAC `max (c:real) (&1)`); + (STRIP_TAC); + (REAL_ARITH_TAC); + (REPEAT STRIP_TAC); + (NEW_GOAL `gammaX V X lmfun <= c`); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?cc2. (&1 <= cc2) /\ + (!V u0. + saturated V /\ packing V /\ u0 IN V + ==> & (CARD {X | mcell_set V X /\ VX V X u0}) <= cc2)`); + + (MP_TAC CARD_MCELL_CONTAINS_POINT_klemma); + (STRIP_TAC); + (EXISTS_TAC `max (&c:real) (&1)`); + (STRIP_TAC); + (REAL_ARITH_TAC); + (REPEAT STRIP_TAC); + (NEW_GOAL `&(CARD {X | mcell_set V X /\ VX V X u0}) <= (&c:real)`); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (ASM_MESON_TAC[]); + (ABBREV_TAC `s = &(CARD {X | mcell_set V X /\ VX V X u0})`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL + `?cc3. &1 <= cc3 /\ + (!V X e. + saturated V /\ packing V /\ mcell_set V X /\ critical_edgeX V X e + ==> beta_bump V e X <= cc3)`); + (MP_TAC BOUND_BETA_BUMP THEN STRIP_TAC); + (EXISTS_TAC `max (c:real) (&1)`); + (STRIP_TAC); + (REAL_ARITH_TAC); + (REPEAT STRIP_TAC); + (NEW_GOAL `beta_bump V e X <= c`); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL + `?cc4. &1 <= cc4 /\ + (!V u0. + saturated V /\ packing V /\ u0 IN V + ==> &(CARD {X | mcell_set V X /\ VX V X u0}) <= cc4)`); + (MP_TAC CARD_MCELL_CONTAINS_POINT_klemma THEN STRIP_TAC); + (EXISTS_TAC `max (&c) (&1)`); + (STRIP_TAC); + (REAL_ARITH_TAC); + (REPEAT STRIP_TAC); + (NEW_GOAL `&(CARD {X | mcell_set V X /\ VX V X u0}) <= &c`); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (ASM_MESON_TAC[]); + (ABBREV_TAC `s = &(CARD {X | mcell_set V X /\ VX V X u0})`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (ASM_CASES_TAC `saturated V /\ packing V`); + + (NEW_GOAL + `?dd1. !r. &1 <= r ==> + &(CARD (V INTER ball ((vec 0):real^3,r) DIFF V INTER ball (vec 0,r - &8))) <= + dd1 * r pow 2`); + + (REWRITE_WITH `!r p. V INTER ball (p:real^3,r) DIFF V INTER ball (p,r - &8) + = V INTER ball (p:real^3,r + &0) DIFF V INTER ball (p,r - &8)`); + (ASM_REWRITE_TAC[REAL_ARITH `a + &0 = a`]); + (ASM_SIMP_TAC[PACKING_BALL_BOUNDARY]); + (TAKE_TAC); + + (ABBREV_TAC `dd2 = max dd1 (&1)`); + (ABBREV_TAC `dd = &1 / &2 * dd2 * (&4) pow 3 * cc2 * cc1`); + + (NEW_GOAL + `?dd3. !r. &1 <= r ==> + &(CARD (V INTER ball ((vec 0):real^3,r) DIFF V INTER ball (vec 0,r - &16))) <= + dd3 * r pow 2`); + + (REWRITE_WITH `!r p. V INTER ball (p:real^3,r) DIFF V INTER ball (p,r - &16) + = V INTER ball (p:real^3,r + &0) DIFF V INTER ball (p,r - &16)`); + (ASM_REWRITE_TAC[REAL_ARITH `a + &0 = a`]); + (ASM_SIMP_TAC[PACKING_BALL_BOUNDARY]); + (TAKE_TAC); + + (ABBREV_TAC `dd4 = max dd3 (&1)`); + (ABBREV_TAC `ss1 = (&4) pow 3 * cc4 * cc3`); + (ABBREV_TAC `ss = &1 / &2 * dd4 * ss1`); + + (ABBREV_TAC `c:real = -- (dd + ss)`); + (EXISTS_TAC `c:real`); + + +(* ============================================================================ *) + + (REPEAT STRIP_TAC); + (NEW_GOAL `!X. mcell_set V X /\ critical_edgeX V X = {} ==> + gammaX V X lmfun >= &0`); + (UP_ASM_TAC THEN REWRITE_TAC[TSKAJXY_statement]); + (STRIP_TAC); + (ASM_SIMP_TAC[]); + + (ABBREV_TAC `B = {X | X SUBSET ball (vec 0, r) /\ mcell_set V X}`); + (ABBREV_TAC `B0 = {X | X SUBSET ball (vec 0,r) /\ mcell_set V X /\ + critical_edgeX V X = {}}`); + (ABBREV_TAC `B1 = {X | X SUBSET ball (vec 0,r) /\ mcell_set V X /\ + ~(critical_edgeX V X = {})}`); + (NEW_GOAL `FINITE (B1:(real^3->bool)->bool)`); + (EXPAND_TAC "B1"); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (vec 0,r) /\ mcell_set V X}`); + (STRIP_TAC); + (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA]); + (SET_TAC[]); + + (REWRITE_WITH `B = B0 UNION B1:(real^3->bool)->bool`); + (EXPAND_TAC "B" THEN EXPAND_TAC "B1" THEN EXPAND_TAC "B0"); + (SET_TAC[]); + (REWRITE_WITH `sum (B0 UNION B1) (\X. gammaX V X lmfun) = + sum B0 (\X. gammaX V X lmfun) + sum B1 (\X. gammaX V X lmfun)`); + (MATCH_MP_TAC SUM_UNION); + (REPEAT STRIP_TAC); + (EXPAND_TAC "B0"); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (vec 0,r) /\ mcell_set V X}`); + (STRIP_TAC); + (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA]); + (SET_TAC[]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "B1" THEN EXPAND_TAC "B0"); + (SET_TAC[]); + (MATCH_MP_TAC (REAL_ARITH `&0 <= b /\ a <= c ==> a <= b + c`)); + (STRIP_TAC); + (MATCH_MP_TAC SUM_POS_LE); + (STRIP_TAC); + (EXPAND_TAC "B0"); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (vec 0,r) /\ mcell_set V X}`); + (STRIP_TAC); + (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA]); + (SET_TAC[]); + (REWRITE_TAC[BETA_THM; REAL_ARITH `&0 <= a <=> a >= &0`]); + (EXPAND_TAC "B0" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[]); + + (REWRITE_WITH + `sum B1 (\X. gammaX V X lmfun) = + sum B1 (\X. (gammaX V X lmfun) * + sum (critical_edgeX V X) (\e. critical_weight V X))`); + (MATCH_MP_TAC SUM_EQ); + (EXPAND_TAC "B1" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[critical_weight]); + (REWRITE_WITH + `sum (critical_edgeX V x) (\e. &1 / &(CARD (critical_edgeX V x))) = + &(CARD (critical_edgeX V x)) * (&1 / &(CARD (critical_edgeX V x)))`); + (MATCH_MP_TAC SUM_CONST); + (REWRITE_TAC[FINITE_critical_edgeX]); + (REWRITE_TAC[REAL_ARITH `a * &1 / a = a / a`]); + (REWRITE_WITH `&(CARD (critical_edgeX V x)) / &(CARD (critical_edgeX V x)) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_OF_NUM_EQ]); + (REWRITE_WITH `CARD (critical_edgeX V x) = 0 <=> critical_edgeX V x = {}`); + (MATCH_MP_TAC CARD_EQ_0); + (REWRITE_TAC[FINITE_critical_edgeX]); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + +(* ------------------------------------------------------------------------- *) +(* Hint: - See proofs of KIZHLTL1; KIZHLTL2 to adapt *) +(* ------------------------------------------------------------------------- *) + + (REWRITE_TAC[GSYM SUM_LMUL]); + + (ABBREV_TAC `T1:real^3->bool = V INTER ball (vec 0, r)`); + (ABBREV_TAC `T2 = {{u0, u1:real^3} | u0 IN T1 /\ u1 IN T1 /\ ~(u0 = u1) /\ + hl [u0; u1] <= hplus}`); + (NEW_GOAL `FINITE (T2:(real^3->bool)->bool)`); + (EXPAND_TAC "T2" THEN MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{{u0, u1:real^3} | u0 IN T1 /\ u1 IN T1}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SET_PRODUCT_KY_LEMMA); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC Pack2.KIUMVTC); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + + (REWRITE_WITH + `sum B1 (\X. sum (critical_edgeX V X) + (\x. gammaX V X lmfun * critical_weight V X)) = + sum B1 (\X. sum {y:real^3->bool| y IN T2 /\ critical_edgeX V X y} + (\x. gammaX V X lmfun * critical_weight V X))`); + (MATCH_MP_TAC SUM_EQ); + (EXPAND_TAC "B1" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_TAC[SET_RULE `a = b <=> b SUBSET a /\ a SUBSET b`]); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[SET_RULE `A SUBSET {y | T2 y /\ A y} <=> A SUBSET T2`]); + (EXPAND_TAC "T2" THEN REWRITE_TAC[SUBSET; critical_edgeX; IN; IN_ELIM_THM; edgeX]); + (REPEAT STRIP_TAC); + (EXPAND_TAC "T1" THEN REWRITE_TAC[IN_ELIM_THM]); + (EXISTS_TAC `u':real^3` THEN EXISTS_TAC `v':real^3`); + (REWRITE_TAC[ASSUME `~(u' = v':real^3)`]); + + (REWRITE_TAC[ASSUME `x' = {u, v:real^3}`; MESON[IN] `V (x:real^3) <=> x IN V`; + GSYM (ASSUME `{u, v} = {u', v':real^3}`); IN_INTER]); + + (NEW_GOAL `VX V x = V INTER x`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (UNDISCH_TAC `mcell_set V x` THEN REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (STRIP_TAC); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (NEW_GOAL `VX V x = {}`); + (REWRITE_TAC[VX]); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `VX V x u'` THEN ASM_REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`]); + (SET_TAC[]); + + (STRIP_TAC); + (ASM_SET_TAC[]); + (STRIP_TAC); + (ASM_SET_TAC[]); + (REWRITE_WITH `hl [u'; v':real^3] = hl [u; v:real^3]`); + (ASM_REWRITE_TAC[HL; set_of_list]); + (ASM_REWRITE_TAC[]); + + (ABBREV_TAC `f = (\X. (\x:real^3->bool. + gammaX V X lmfun * critical_weight V X))`); + (REWRITE_WITH + `sum B1 (\X. sum {y | y IN T2 /\ critical_edgeX V X y} + (\x:real^3->bool. gammaX V X lmfun * critical_weight V X)) = + sum B1 (\X. sum {y | y IN T2 /\ critical_edgeX V X y} + (\x:real^3->bool. f X x))`); + (EXPAND_TAC "f" THEN REFL_TAC); + (REWRITE_WITH + `sum B1 (\X. sum {y | y IN T2 /\ critical_edgeX V X y} (\x. f X x)) = + sum T2 (\x. sum {X | X IN B1 /\ critical_edgeX V X x} (\X. f X x))`); + (ASM_SIMP_TAC[SUM_SUM_RESTRICT]); + + (EXPAND_TAC "B1" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REWRITE_TAC[MESON[] `(A/\B/\C)/\D <=> A/\B/\C/\D`]); + (REWRITE_WITH +`sum T2 (\x. sum + {X | X SUBSET ball (vec 0,r) /\ mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ critical_edgeX V X x} + (\X. f X x)) = + sum T2 (\x. sum {X | mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ critical_edgeX V X x} + (\X. f X x)) - +sum T2 (\x. sum {X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ critical_edgeX V X x} + (\X. f X x))`); + (REWRITE_TAC[REAL_ARITH `a = b - c <=> b = a + c`]); + (REWRITE_WITH +` sum T2 + (\x. sum + {X | X SUBSET ball (vec 0,r) /\ mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ critical_edgeX V X x} + (\X. f X x)) + + sum T2 + (\x. sum + {X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ critical_edgeX V X x} + (\X. f X x)) = + sum T2 + (\x. (\x. sum + {X | X SUBSET ball (vec 0,r) /\ mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ critical_edgeX V X x} + (\X. f X x)) x + +(\x. sum + {X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ critical_edgeX V X x} + (\X. f X x)) x)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC SUM_ADD); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SUM_EQ); + (REWRITE_TAC[BETA_THM] THEN REPEAT STRIP_TAC); + + (REWRITE_WITH +`sum + {X | X SUBSET ball (vec 0,r) /\ + mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ + critical_edgeX V X x} + (\X. f X x) + + sum + {X | ~(X SUBSET ball (vec 0,r)) /\ + mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ + critical_edgeX V X x} + (\X. f X x) = + sum ({X | X SUBSET ball (vec 0,r) /\ + mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ + critical_edgeX V X x} UNION + {X | ~(X SUBSET ball (vec 0,r)) /\ + mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ + critical_edgeX V X x}) + (\X. f X x)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC SUM_UNION); + (REPEAT STRIP_TAC); + + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `B1:(real^3->bool)->bool`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "B1" THEN SET_TAC[]); + + (UP_ASM_TAC THEN EXPAND_TAC "T2"); + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (vec 0,r + &8) /\ mcell_set V X}`); + (STRIP_TAC); + (ASM_SIMP_TAC[Marchal_cells_3.FINITE_MCELL_SET_LEMMA]); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `x SUBSET VX V x'`); + (UNDISCH_TAC `critical_edgeX V x' x` THEN REWRITE_TAC[critical_edgeX;edgeX]); + (REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[ASSUME `x = {u, v:real^3}`; ASSUME `{u, v:real^3} = {u', v'}`]); + (SET_TAC[ASSUME `VX V x' u'`; ASSUME `VX V x' v'`]); + (NEW_GOAL `VX V x' = V INTER x'`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (UNDISCH_TAC `mcell_set V x'` THEN REWRITE_TAC[mcell_set; IN_ELIM_THM; IN]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (NEW_GOAL `VX V x' = {}`); + (ASM_REWRITE_TAC[VX]); + (UNDISCH_TAC `x SUBSET VX V x'` THEN REWRITE_TAC[ASSUME `VX V x' = {}`]); + (REWRITE_TAC[ASSUME `x = {u0, u1:real^3}`] THEN SET_TAC[]); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) x <=> x IN A`; IN_BALL]); + (NEW_GOAL `dist (vec 0, x'') <= dist (vec 0, u0:real^3) + dist (u0, x'')`); + (NORM_ARITH_TAC); + (NEW_GOAL `dist (vec 0, u0:real^3) < r`); + (REWRITE_TAC[GSYM IN_BALL]); + (UNDISCH_TAC `(T1:real^3->bool) u0` THEN EXPAND_TAC "T1"); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) x <=> x IN A`] THEN SET_TAC[]); + (NEW_GOAL `dist (u0, x'':real^3) < &8`); + (REWRITE_TAC[GSYM IN_BALL]); + (NEW_GOAL `x' SUBSET ball (u0:real^3,&8)`); + (UNDISCH_TAC `mcell_set V x'` THEN REWRITE_TAC[mcell_set; IN_ELIM_THM; IN]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MCELL_SUBSET_BALL8); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `x' = mcell i V ul`)]); + (UNDISCH_TAC `x SUBSET VX V x'` THEN UNDISCH_TAC `VX V x' = V INTER x'`); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + (SUBGOAL_THEN `(x'':real^3) IN x'` MP_TAC); + (UNDISCH_TAC `(x':real^3->bool) x''` THEN SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + + (REWRITE_WITH ` ({X | X SUBSET ball (vec 0,r) /\ + mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ + critical_edgeX V X x} UNION + {X | ~(X SUBSET ball (vec 0,r)) /\ + mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ + critical_edgeX V X x}) = + {X | mcell_set V X /\ ~(critical_edgeX V X = {}) /\ critical_edgeX V X x}`); + (SET_TAC[]); + (REWRITE_WITH + `(\x. sum + {X | mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ critical_edgeX V X x} (\X. f X x)) = + (\x. sum + {X | mcell_set V X /\ critical_edgeX V X x} (\X. f X x))`); + (REWRITE_TAC[FUN_EQ_THM]); + (STRIP_TAC); + (REWRITE_WITH +`{X | mcell_set V X /\ + ~(!x. critical_edgeX V X x <=> {} x) /\ critical_edgeX V X x} = + {X | mcell_set V X /\ critical_edgeX V X x}`); + (REWRITE_TAC[SET_RULE `A = B <=> A SUBSET B /\ B SUBSET A`]); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[MESON[IN] `(A:(real^3->bool)->bool) x <=> x IN A`]); + (SET_TAC[]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + ` (\x. sum + {X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ critical_edgeX V X x} (\X. f X x)) = + (\x. sum + {X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ + critical_edgeX V X x} (\X. f X x))`); + (REWRITE_TAC[FUN_EQ_THM]); + (STRIP_TAC); + (REWRITE_WITH +`{X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ + ~(!x. critical_edgeX V X x <=> {} x) /\ critical_edgeX V X x} = + {X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ critical_edgeX V X x}`); + (REWRITE_TAC[SET_RULE `A = B <=> A SUBSET B /\ B SUBSET A`]); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM]); + (GEN_TAC THEN DISCH_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[MESON[IN] `(A:(real^3->bool)->bool) x <=> x IN A`]); + (SET_TAC[]); + +(* OK here *) + + (MATCH_MP_TAC (REAL_ARITH `(?x. c <= x /\ a + x <= b) ==> a <= b - c`)); + (EXISTS_TAC `dd * r pow 2`); + (STRIP_TAC); + + (ABBREV_TAC + `T3:real^3->bool = V INTER ball (vec 0, r) DIFF ball (vec 0, r - &8)`); + (ABBREV_TAC `T4 = {{u0:real^3, u1} | u0 IN T3 /\ u1 IN T3 /\ + ~(u0 = u1) /\ hl [u0; u1] <= hplus}`); + (REWRITE_WITH `sum T2 + (\x. sum + {X | ~(X SUBSET ball (vec 0,r)) /\ + mcell_set V X /\ + critical_edgeX V X x} + (\X. f X x)) = sum T4 + (\x. sum + {X | ~(X SUBSET ball (vec 0,r)) /\ + mcell_set V X /\ + critical_edgeX V X x} + (\X. f X x))`); + + (EXPAND_TAC "T2"); + (MATCH_MP_TAC SUM_SUPERSET); + (STRIP_TAC); + (EXPAND_TAC "T4" THEN EXPAND_TAC "T1" THEN EXPAND_TAC "T3" THEN SET_TAC[]); + + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (REWRITE_WITH + `{X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ critical_edgeX V X x} = + {}`); + (REWRITE_TAC[SET_RULE `x = {} <=> ~(?s. s IN x)`]); + (REWRITE_TAC[IN; IN_ELIM_THM] THEN STRIP_TAC); + + (NEW_GOAL `(x:real^3->bool) SUBSET s`); + (MATCH_MP_TAC CRITICAL_EDGEX_SUBSET_MCELL); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + + (NEW_GOAL `?p:real^3. p IN s DIFF ball (vec 0,r)`); + (UNDISCH_TAC `~(s SUBSET ball ((vec 0):real^3,r))` THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[IN_DIFF; IN_BALL; REAL_ARITH + `~(a < r) <=> r <= a`] THEN STRIP_TAC); + (NEW_GOAL `s SUBSET ball (p:real^3,&8)`); + (MATCH_MP_TAC MCELL_SUBSET_BALL8_2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `u0:real^3 IN ball (p,&8) /\ u1 IN ball (p,&8)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL] THEN STRIP_TAC); + (UNDISCH_TAC `~(T4:(real^3->bool)->bool) x`); + (REWRITE_TAC[MESON[IN] `(T4:(real^3->bool)->bool) x <=> x IN T4`]); + (EXPAND_TAC "T4" THEN EXPAND_TAC "T3" THEN REWRITE_TAC[IN_INTER; IN_DIFF; IN_BALL]); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `(T1:(real^3->bool)) u0` THEN + UNDISCH_TAC `(T1:(real^3->bool)) u1`); + (REWRITE_WITH `!x. T1 x <=> x:real^3 IN T1`); + (ASM_REWRITE_TAC[IN]); + (EXPAND_TAC "T1" THEN REWRITE_TAC[IN_INTER; IN_BALL]); + (REWRITE_TAC[IN] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `dist (vec 0,p) <= dist (p, u0) + dist (vec 0, u0:real^3)`); + (NORM_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `dist (vec 0,p) <= dist (p, u1) + dist (vec 0, u1:real^3)`); + (NORM_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[SUM_CLAUSES]); + + (MATCH_MP_TAC (REAL_ARITH `(?x. a <= x /\ x <= b) ==> a <= b`)); + (EXISTS_TAC `sum T4 (\x:real^3->bool. cc2 * cc1)`); + (STRIP_TAC); + (MATCH_MP_TAC SUM_LE); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{{u0:real^3, u1} | u0 IN T3 /\ u1 IN T3}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (ABBREV_TAC `S_temp = {u0, u1:real^3 | u0 IN T3 /\ u1 IN T3}`); + (ABBREV_TAC `f_temp = (\(u0,u1:real^3). {u0, u1})`); + (EXISTS_TAC `IMAGE (f_temp:real^3#real^3->real^3->bool) S_temp`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE); + (EXPAND_TAC "S_temp" THEN MATCH_MP_TAC FINITE_PRODUCT THEN REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `T1:real^3->bool`); + (STRIP_TAC); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (EXPAND_TAC "f_temp" THEN EXPAND_TAC "S_temp" THEN + REWRITE_TAC[IMAGE; SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u0:real^3, u1:real^3` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (REWRITE_TAC[IN] THEN EXPAND_TAC "T4" THEN EXPAND_TAC "T3" THEN + REWRITE_TAC[ABS_SIMP; IN_DIFF; IN_INTER; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (MATCH_MP_TAC (REAL_ARITH `(?x. a <= x /\ x <= b) ==> a <= b`)); + (EXISTS_TAC + `sum {X| ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ critical_edgeX V X x} + (\x. cc1)`); + (STRIP_TAC); + (MATCH_MP_TAC SUM_LE); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | mcell_set V X /\ edgeX V X x}`); + (STRIP_TAC); + (MATCH_MP_TAC Marchal_cells_3.FINITE_EDGE_X2); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[critical_edgeX] THEN SET_TAC[]); + (REWRITE_TAC[BETA_THM; ABS_SIMP; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXPAND_TAC "f"); + (NEW_GOAL `critical_weight V x' <= &1`); + (REWRITE_TAC[critical_weight]); + (REWRITE_WITH `&1 / &(CARD (critical_edgeX V x')) <= &1 <=> + &1 <= &(CARD (critical_edgeX V x'))`); + (MATCH_MP_TAC Packing3.REAL_DIV_LE_1); + (REWRITE_TAC[REAL_OF_NUM_LT; ARITH_RULE `0 < a <=> ~(a = 0)`]); + (REWRITE_WITH `CARD (critical_edgeX V x') = 0 <=> critical_edgeX V x' = {}`); + (MATCH_MP_TAC CARD_EQ_0); + (REWRITE_TAC[critical_edgeX; edgeX] THEN MATCH_MP_TAC FINITE_SUBSET); + + (EXISTS_TAC `{{u0:real^3, u1} | u0 IN VX V x' /\ u1 IN VX V x'}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (ABBREV_TAC `S_temp = {u0, u1:real^3 | u0 IN VX V x' /\ u1 IN VX V x'}`); + (ABBREV_TAC `f_temp = (\(u0,u1:real^3). {u0, u1})`); + (EXISTS_TAC `IMAGE (f_temp:real^3#real^3->real^3->bool) S_temp`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE); + (EXPAND_TAC "S_temp" THEN MATCH_MP_TAC FINITE_PRODUCT THEN REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_VX); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "f_temp" THEN EXPAND_TAC "S_temp" THEN + REWRITE_TAC[IMAGE; SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u0':real^3, u1':real^3` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `u0':real^3` THEN EXISTS_TAC `u1':real^3` THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[REAL_OF_NUM_LE; ARITH_RULE `1 <= a <=> ~(a = 0)`]); + (REWRITE_WITH `CARD (critical_edgeX V x') = 0 <=> critical_edgeX V x' = {}`); + (MATCH_MP_TAC CARD_EQ_0); + (REWRITE_TAC[critical_edgeX; edgeX] THEN MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{{u0:real^3, u1} | u0 IN VX V x' /\ u1 IN VX V x'}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (ABBREV_TAC `S_temp = {u0, u1:real^3 | u0 IN VX V x' /\ u1 IN VX V x'}`); + (ABBREV_TAC `f_temp = (\(u0,u1:real^3). {u0, u1})`); + (EXISTS_TAC `IMAGE (f_temp:real^3#real^3->real^3->bool) S_temp`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE); + (EXPAND_TAC "S_temp" THEN MATCH_MP_TAC FINITE_PRODUCT THEN REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_VX); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "f_temp" THEN EXPAND_TAC "S_temp" THEN + REWRITE_TAC[IMAGE; SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u0':real^3, u1':real^3` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `u0':real^3` THEN EXISTS_TAC `u1':real^3` THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (NEW_GOAL `&0 <= critical_weight V x'`); + (REWRITE_TAC[critical_weight] THEN MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[REAL_ARITH `&0 <= &1`; REAL_OF_NUM_LE]); + (ARITH_TAC); + (NEW_GOAL `gammaX V x' lmfun <= cc1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `gammaX V x' lmfun * critical_weight V x' <= cc1 * critical_weight V x'`); + + (ONCE_REWRITE_TAC[REAL_ARITH `(a <= b <=> &0 <= b - a)`]); + (REWRITE_TAC[REAL_ARITH `a * x - b * x = (a - b) * x`]); + (MATCH_MP_TAC REAL_LE_MUL THEN ASM_REAL_ARITH_TAC); + + (NEW_GOAL `cc1 * critical_weight V x' <= cc1`); + (ONCE_REWRITE_TAC[REAL_ARITH `(a <= b <=> &0 <= b - a)`]); + (REWRITE_WITH `!x b. b - b * x = b * (&1 - x)`); + (REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL THEN STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH + `sum + {X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ critical_edgeX V X x} + (\x. cc1) = + &(CARD + {X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ critical_edgeX V X x}) + * cc1`); + (MATCH_MP_TAC SUM_CONST); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | mcell_set V X /\ edgeX V X x}`); + (STRIP_TAC); + (MATCH_MP_TAC Marchal_cells_3.FINITE_EDGE_X2); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[critical_edgeX] THEN SET_TAC[]); + + (ONCE_REWRITE_TAC[REAL_ARITH `(a <= b <=> &0 <= b - a)`]); + (REWRITE_TAC[REAL_ARITH `a * x - b * x = x * (a - b)`]); + (MATCH_MP_TAC REAL_LE_MUL THEN STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL + ` &(CARD + {X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ critical_edgeX V X x}) + <= &(CARD {X | mcell_set V X /\ VX V X u0})`); + (REWRITE_TAC[REAL_OF_NUM_LE] THEN MATCH_MP_TAC CARD_SUBSET); + (STRIP_TAC); + (ASM_REWRITE_TAC[critical_edgeX; edgeX; IN; IN_ELIM_THM]); + (SET_TAC[]); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (u0,&8) /\ mcell_set V X}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_MCELL_SET_LEMMA_2); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SUBSET]); + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (MATCH_MP_TAC MCELL_SUBSET_BALL8_2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `VX V x' = V INTER x'`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (UNDISCH_TAC `mcell_set V x'` THEN + REWRITE_TAC[mcell_set; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `VX V x' u0` THEN ASM_REWRITE_TAC[VX]); + (REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`]); + (SET_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `&(CARD {X | mcell_set V X /\ VX V X u0}) <= cc2`); + (ASM_MESON_TAC[]); + + (ABBREV_TAC `s1_temp = &(CARD + {X | ~(X SUBSET ball (vec 0,r)) /\ + mcell_set V X /\ + critical_edgeX V X x})`); + (ABBREV_TAC `s2_temp = &(CARD {X | mcell_set V X /\ VX V X u0})`); + (ASM_REAL_ARITH_TAC); + + (ABBREV_TAC `g = (\x:real^3->bool. cc2 * cc1)`); + + (REWRITE_WITH + `sum T4 (g:(real^3->bool)->real) = + &1 / &2 * + sum {m,n | m IN T3 /\ n IN T3 /\ ~(m = n) /\ dist (m,n) <= &2 * hplus} + (\(m:real^3,n). g {m, n})`); + (ONCE_REWRITE_TAC[REAL_ARITH `a = &1 / &2 * b <=> b = &2 * a`]); + (EXPAND_TAC "T4"); + (REWRITE_TAC[HL_2; REAL_ARITH `inv (&2) * a <= b <=> a <= &2 * b`]); + (MATCH_MP_TAC SUM_PAIR_2_SET); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `T1:real^3->bool`); + (STRIP_TAC); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (REWRITE_TAC[REAL_ARITH `&1 / &2 * s <= t <=> s <= &2 * t`]); + + (ABBREV_TAC + `h = (\m:real^3. {n | n IN T3 /\ ~(m = n) /\ dist (m,n) <= &2 * hplus})`); + (REWRITE_WITH + `{m,n | m IN T3 /\ n IN T3 /\ ~(m = n) /\ dist (m,n) <= &2 * hplus} = + {m:real^3,n | m IN T3 /\ n IN h m}`); + (EXPAND_TAC "h"); + (SET_TAC[PAIR_EQ]); + (ABBREV_TAC `k = (\m n. (g:(real^3->bool)->real) {m,n})`); + (REWRITE_WITH `(\(m,n). (g:(real^3->bool)->real) {m, n}) = (\(m,n). k m n)`); + (REWRITE_TAC[FUN_EQ_THM]); + (STRIP_TAC); + (NEW_GOAL `(x:real^3#real^3) = FST x, SND x`); + (REWRITE_TAC[PAIR]); + (ONCE_REWRITE_TAC[ASSUME `(x:real^3#real^3) = FST x, SND x`]); + (EXPAND_TAC "k" THEN REWRITE_TAC[]); + (REWRITE_WITH + `sum {m:real^3,n:real^3 | m IN T3 /\ n IN h m} (\(m,n). k m n) = + sum T3 (\m. sum (h m) (k m))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC SUM_SUM_PRODUCT); + (STRIP_TAC); + + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `T1:real^3->bool`); + (STRIP_TAC); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (REPEAT STRIP_TAC); + (EXPAND_TAC "h"); + + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `T3:real^3->bool`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `T1:real^3->bool`); + (STRIP_TAC); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (SET_TAC[]); + + (EXPAND_TAC "k" THEN EXPAND_TAC "g"); + (NEW_GOAL `sum T3 (\m. sum ((h:real^3->real^3->bool) m) (\n. cc2 * cc1)) <= + sum T3 (\m. (&4) pow 3 * cc2 * cc1)`); + (MATCH_MP_TAC SUM_LE); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `T1:real^3->bool`); + (STRIP_TAC); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (EXPAND_TAC "h" THEN REPEAT STRIP_TAC THEN REWRITE_TAC[]); + (REWRITE_WITH + `sum {n:real^3 | n IN T3 /\ ~(x = n) /\ + dist (x,n) <= &2 * hplus} (\n. cc2 * cc1) = + &(CARD {n | n IN T3 /\ ~(x = n) /\ dist (x,n) <= &2 * hplus}) * + (cc2 * cc1)`); + (MATCH_MP_TAC SUM_CONST); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `T3:real^3->bool`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `T1:real^3->bool`); + (STRIP_TAC); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (SET_TAC[]); + + (ONCE_REWRITE_TAC[REAL_ARITH `(a <= b <=> &0 <= b - a)`]); + (REWRITE_TAC[REAL_ARITH `a * x - b * x = (a - b) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ONCE_REWRITE_TAC[GSYM (REAL_ARITH `(a <= b <=> &0 <= b - a)`)]); + + + (NEW_GOAL + `&(CARD {n | n IN T3 /\ ~(x = n) /\ dist (x,n) <= &2 * hplus}) <= + &(CARD (V INTER ball (x:real^3, &3)))`); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (STRIP_TAC); + (EXPAND_TAC "T3" THEN REWRITE_TAC[IN_DIFF; IN_BALL]); + (REWRITE_TAC[IN_INTER; IN_BALL; IN_ELIM_THM; SUBSET; IN]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `&2 * hplus < &3`); + (REWRITE_TAC[hplus] THEN REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `&(CARD (V INTER ball (x:real^3,&3))) <= &4 pow 3`); + (REWRITE_TAC[REAL_ARITH `&4 = &3 + &1`]); + (MATCH_MP_TAC BOUNDS_VGEN_klemma); + (ASM_REWRITE_TAC[REAL_ARITH `&0 <= &3`]); + (ABBREV_TAC + `s1 = &(CARD {n:real^3 | n IN T3 /\ ~(x = n) /\ dist (x,n) <= &2 * hplus})`); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `sum T3 (\m:real^3. &4 pow 3 * cc2 * cc1) <= &2 * dd * r pow 2`); + (REWRITE_WITH + `sum T3 (\m:real^3. &4 pow 3 * cc2 * cc1) = + &(CARD T3) * &4 pow 3 * cc2 * cc1`); + (MATCH_MP_TAC SUM_CONST); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `T1:real^3->bool`); + (STRIP_TAC); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (EXPAND_TAC "dd"); + + (ONCE_REWRITE_TAC[REAL_ARITH `(a <= b <=> &0 <= b - a)`]); + (REWRITE_TAC[REAL_ARITH + `&2 * (&1 / &2 * dd2 * &4 pow 3 * cc2 * cc1) * r pow 2 - + &(CARD (T3:real^3->bool)) * &4 pow 3 * cc2 * cc1 = + (&4 pow 3 * cc2 * cc1) * (dd2 * r pow 2 - &(CARD T3))`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 <= &4 pow 3 * x <=> &0 <= x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (ONCE_REWRITE_TAC[GSYM (REAL_ARITH `(a <= b <=> &0 <= b - a)`)]); + (EXPAND_TAC "T3"); + + (ONCE_REWRITE_TAC[SET_RULE `A INTER B DIFF C = A INTER B DIFF A INTER C`]); + (MATCH_MP_TAC (REAL_ARITH `(?x. a <= x /\ x <= b) ==> a <= b`)); + (EXISTS_TAC `dd1 * r pow 2`); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[REAL_ARITH `(a <= b <=> &0 <= b - a)`]); + (REWRITE_TAC[REAL_ARITH `a * x - b * x = (a - b ) * x`]); + (MATCH_MP_TAC REAL_LE_MUL THEN STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_LE_POW_2]); + (ASM_REAL_ARITH_TAC); + +(* ======================================================================== *) +(* CHECK DEN DAY LA OK ROI - (._o) (0_o) *) +(* ==================================================================== *) + + (REWRITE_WITH + `sum T2 (\x. sum {X | mcell_set V X /\ critical_edgeX V X x} (\X. f X x)) = + sum T2 (\e. cluster_gammaX V e (cell_cluster V e)) - + sum T2 (\x. sum {X | mcell_set V X /\ critical_edgeX V X x} (beta_bump V x))`); + (REWRITE_TAC[REAL_ARITH `a = b - c <=> b = a + c`]); + (ABBREV_TAC + `f1 = (\x. sum {X | mcell_set V X /\ critical_edgeX V X x} (\X. f X x))`); + (ABBREV_TAC + `f2 = (\x. sum {X | mcell_set V X /\ critical_edgeX V X x} (beta_bump V x))`); + (REWRITE_WITH + `sum T2 (\e. cluster_gammaX V e (cell_cluster V e)) = + sum T2 (\e:real^3->bool. f1 e + f2 e)`); + (MATCH_MP_TAC SUM_EQ); + (EXPAND_TAC "T2" THEN REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXPAND_TAC "f1" THEN EXPAND_TAC "f2" THEN REWRITE_TAC[cluster_gammaX; cell_cluster]); + (REWRITE_TAC[FUN_EQ_THM] THEN REPEAT STRIP_TAC); + (EXPAND_TAC "f"); + (REWRITE_TAC[SET_RULE `{X | x IN critical_edgeX V X /\ mcell_set V X} = + {X | mcell_set V X /\ critical_edgeX V X x}`]); + (MATCH_MP_TAC SUM_ADD); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (u0,&8) /\ mcell_set V X}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_MCELL_SET_LEMMA_2); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SUBSET]); + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (MATCH_MP_TAC MCELL_SUBSET_BALL8_2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `VX V x' = V INTER x'`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (UNDISCH_TAC `mcell_set V x'` THEN + REWRITE_TAC[mcell_set; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `critical_edgeX V x' x` THEN + REWRITE_TAC[critical_edgeX; edgeX; IN; IN_ELIM_THM] THEN STRIP_TAC); + (NEW_GOAL `VX V x' u0`); + (NEW_GOAL `u0 = u' \/ u0 = v':real^3`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[ASSUME `u0 = u':real^3`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `u0 = v':real^3`]); + (ASM_REWRITE_TAC[]); + + (UNDISCH_TAC `VX V x' u0` THEN ASM_REWRITE_TAC[VX]); + (REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`]); + (SET_TAC[]); + + (NEW_GOAL `VX V x' u0`); + (UNDISCH_TAC `mcell_set V x'` THEN + REWRITE_TAC[mcell_set; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (UNDISCH_TAC `critical_edgeX V x' x` THEN + REWRITE_TAC[critical_edgeX; edgeX; IN; IN_ELIM_THM] THEN STRIP_TAC); + (NEW_GOAL `u0 = u' \/ u0 = v':real^3`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[ASSUME `u0 = u':real^3`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `u0 = v':real^3`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SUM_ADD); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC (REAL_ARITH `&0 <= a /\ b + x <= &0 ==> x <= a - b`)); + (STRIP_TAC); + (MATCH_MP_TAC SUM_POS_LE); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "T2" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `cell_cluster_estimate V`); + (REWRITE_TAC[cell_cluster_estimate]); + (REWRITE_TAC[REAL_ARITH `&0 <= a <=> a >= &0`] THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (ABBREV_TAC + `f1 = (\x. sum {X | X SUBSET ball (vec 0, r + &8) /\ + ~(X SUBSET ball (vec 0, r - &8)) /\ + mcell_set V X /\ + critical_edgeX V X x} (beta_bump V x))`); + (ABBREV_TAC + `f2 = (\x. sum {X | X SUBSET ball (vec 0, r - &8) /\ mcell_set V X /\ + critical_edgeX V X x} (beta_bump V x))`); + (REWRITE_WITH + `sum T2 (\x. sum {X | mcell_set V X /\ critical_edgeX V X x} (beta_bump V x)) + = sum (T2:(real^3->bool)->bool) f1 + sum T2 f2`); + (REWRITE_WITH + `sum (T2:(real^3->bool)->bool) f1 + sum T2 f2 = sum T2 (\x. f1 x + f2 x)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC SUM_ADD); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC SUM_EQ); + (EXPAND_TAC "T2" THEN REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXPAND_TAC "f1" THEN EXPAND_TAC "f2"); + (ABBREV_TAC + `s1 = {X | X SUBSET ball (vec 0,r + &8) /\ ~(X SUBSET ball (vec 0,r - &8)) /\ + mcell_set V X /\ critical_edgeX V X x}`); + (ABBREV_TAC `s2 = {X | X SUBSET ball (vec 0,r - &8) /\ mcell_set V X /\ + critical_edgeX V X x}`); + (REWRITE_WITH `{X | mcell_set V X /\ critical_edgeX V X x} = s1 UNION s2`); + (EXPAND_TAC "s1" THEN EXPAND_TAC "s2" THEN + REWRITE_TAC[SET_EQ_LEMMA; IN_UNION; IN_ELIM_THM; IN]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `x' SUBSET ball ((vec 0):real^3,r - &8)`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[SUBSET; IN_DIFF; IN_BALL]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `x' SUBSET ball (u0:real^3, &8)`); + (MATCH_MP_TAC MCELL_SUBSET_BALL8_2); + + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `x:real^3->bool SUBSET x'`); + (MATCH_MP_TAC CRITICAL_EDGEX_SUBSET_MCELL); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (SET_TAC[]); + (NEW_GOAL `dist (u0:real^3, x'') < &8`); + (REWRITE_TAC[GSYM IN_BALL] THEN ASM_SET_TAC[]); + (NEW_GOAL `dist (vec 0, x'') <= dist (u0, x'') + dist (vec 0, u0:real^3)`); + (NORM_ARITH_TAC); + (NEW_GOAL `dist (vec 0, u0:real^3) < r`); + (REWRITE_TAC[GSYM IN_BALL]); + (UNDISCH_TAC `(T1:real^3->bool) u0`); + (EXPAND_TAC "T1" THEN REWRITE_TAC[MESON[IN] `(A:real^3->bool) x <=> x IN A`]); + (SET_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SUM_UNION); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (vec 0,r + &8) /\ mcell_set V X}`); + (STRIP_TAC); + (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA_2]); + (ASM_SET_TAC[]); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (vec 0,r - &8) /\ mcell_set V X}`); + (STRIP_TAC); + (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA_2]); + (ASM_SET_TAC[]); + +(* ======================================================================== *) +(* ======================================================================== *) + + (EXPAND_TAC "s1" THEN EXPAND_TAC "s2" THEN SET_TAC[]); + + (REWRITE_WITH `sum (T2:(real^3->bool)->bool) f2 = &0`); + (EXPAND_TAC "f2"); + (REWRITE_TAC[SET_RULE + `!V r x. {X | X SUBSET ball (vec 0,r - &8) /\ mcell_set V X /\ + critical_edgeX V X x} = + {X | X IN {X| X SUBSET ball (vec 0,r - &8) /\ mcell_set V X} /\ + critical_edgeX V X x}`]); + (REWRITE_WITH + `sum T2 + (\x. sum + {X | X IN {X | X SUBSET ball (vec 0,r - &8) /\ mcell_set V X} /\ + critical_edgeX V X x} + (beta_bump V x)) = + sum T2 + (\x. sum + {X | X IN {X | X SUBSET ball (vec 0,r - &8) /\ mcell_set V X} /\ + critical_edgeX V X x} + (\X. beta_bump V x X))`); + (REWRITE_WITH `!x V. (\X. beta_bump V x X) = beta_bump V x`); + (REWRITE_TAC[FUN_EQ_THM] THEN ASM_REWRITE_TAC[]); + + (ABBREV_TAC `t = {X | X SUBSET ball (vec 0,r - &8) /\ mcell_set V X}`); + (ABBREV_TAC `g = beta_bump V`); + (ABBREV_TAC `s = T2:(real^3->bool)->bool`); + (REWRITE_WITH + `sum s (\x. sum {X | X IN t /\ critical_edgeX V X x} (\X. g x X)) = + sum t (\X. sum {x | x IN s /\ critical_edgeX V X x} (\x. g x X))`); + (MATCH_MP_TAC SUM_SUM_RESTRICT); + (STRIP_TAC); + (EXPAND_TAC "s" THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "t"); + (MATCH_MP_TAC FINITE_MCELL_SET_LEMMA); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "s" THEN EXPAND_TAC "t" THEN EXPAND_TAC "g"); + (MATCH_MP_TAC SUM_EQ_0); + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REWRITE_TAC[] THEN REPEAT STRIP_TAC); + + (REWRITE_WITH `{x' | T2 x' /\ critical_edgeX V x x'} = + {x' | x' IN critical_edgeX V x}`); + (MATCH_MP_TAC (SET_RULE `A SUBSET B /\ B SUBSET A ==> A = B`)); + (STRIP_TAC); + (SET_TAC[]); + (ASM_REWRITE_TAC[IN]); + (REWRITE_TAC[GSYM (ASSUME `{{u0:real^3, u1} | u0 IN T1 /\ u1 IN T1 /\ + ~(u0 = u1) /\ hl [u0; u1] <= hplus} = s`)]); + + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM; critical_edgeX; edgeX]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u':real^3` THEN EXISTS_TAC `v':real^3` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "T1"); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) x <=> x IN A`; IN_INTER; IN_BALL]); + (NEW_GOAL `VX V x = V INTER x`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (UNDISCH_TAC `mcell_set V x` THEN REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (STRIP_TAC); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[IN]); + (STRIP_TAC THEN UNDISCH_TAC `VX V x u'`); + (ASM_REWRITE_TAC[VX; MESON[IN] `{} x <=> x IN {}`] THEN SET_TAC[]); + (REWRITE_WITH `u':real^3 IN V /\ v' IN V`); + (ASM_SET_TAC[]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `u':real^3 IN ball (vec 0, r - &8)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL] THEN REAL_ARITH_TAC); + (NEW_GOAL `v':real^3 IN ball (vec 0, r - &8)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL] THEN REAL_ARITH_TAC); + (REWRITE_WITH `hl [u'; v':real^3] = hl [u; v:real^3]`); + (REWRITE_TAC[HL; set_of_list]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `u:real^3` THEN EXISTS_TAC `v:real^3`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `u':real^3` THEN EXISTS_TAC `v':real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SUM_BETA_BUMP_LEMMA); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[REAL_ARITH `a + &0 = a`]); + (EXPAND_TAC "T2"); + (REWRITE_TAC[HL_2; REAL_ARITH `inv (&2) * a <= b <=> a <= &2 * b`]); + (REWRITE_WITH + `sum {{u0:real^3, u1} | u0 IN T1 /\ u1 IN T1 /\ ~(u0 = u1) /\ + dist (u0,u1) <= &2 * hplus} f1 = + &1 / &2 * + sum {m,n | m IN T1 /\ n IN T1 /\ ~(m = n) /\ dist (m,n) <= &2 * hplus} + (\(m,n). f1 {m, n})`); + (REWRITE_TAC[REAL_ARITH `a = &1 / &2 * b <=> b = &2 * a`]); + (MATCH_MP_TAC SUM_PAIR_2_SET); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA); + (ASM_REWRITE_TAC[]); + + (ABBREV_TAC + `T3 = V INTER ball ((vec 0):real^3,r) DIFF ball (vec 0, r - &16)`); + (REWRITE_WITH + `sum {m:real^3,n | m IN T1 /\ n IN T1 /\ ~(m = n) /\ dist (m,n) <= &2 * hplus} + (\(m,n). f1 {m, n}) = + sum {m,n | m IN T3 /\ n IN T1 /\ ~(m = n) /\ dist (m,n) <= &2 * hplus} + (\(m,n). f1 {m, n})`); + (MATCH_MP_TAC SUM_SUPERSET); + (STRIP_TAC); + (EXPAND_TAC "T1" THEN EXPAND_TAC "T3" THEN + REWRITE_TAC[SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `m:real^3` THEN EXISTS_TAC `n:real^3` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "T1" THEN UNDISCH_TAC + `(V INTER ball ((vec 0):real^3,r) DIFF ball (vec 0,r - &16)) m` THEN + REWRITE_TAC[MESON[IN] `(A:real^3->bool) x <=> x IN A`]); + (SET_TAC[]); + (EXPAND_TAC "T1" THEN EXPAND_TAC "T3" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "f1"); + (REWRITE_WITH + `{X | X SUBSET ball (vec 0,r + &8) /\ + ~(X SUBSET ball (vec 0,r - &8)) /\ + mcell_set V X /\ + critical_edgeX V X {m, n}} = {}`); + (REWRITE_TAC[SET_RULE `y = {} <=> ~(?x. x IN y)`]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `~(?m n. + ((V INTER ball (vec 0,r) DIFF ball (vec 0,r - &16)) m /\ + (V INTER ball (vec 0,r)) n /\ + ~(m = n) /\ + dist (m:real^3,n) <= &2 * hplus) /\ + x = m,n) ` THEN REWRITE_TAC[]); + (EXISTS_TAC `m:real^3` THEN EXISTS_TAC `n:real^3`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) x <=> x IN A`]); + (EXPAND_TAC "T3" THEN REWRITE_TAC[IN_DIFF; IN; IN_BALL]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?p:real^3. p IN x' /\ ~(p IN ball (vec 0,r - &8))`); + (UNDISCH_TAC `~(x' SUBSET ball ((vec 0):real^3,r - &8))`); + (SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL]); + (NEW_GOAL `x' SUBSET ball (p:real^3, &8)`); + (MATCH_MP_TAC MCELL_SUBSET_BALL8_2); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `m:real^3 IN x'`); + (UNDISCH_TAC `critical_edgeX V x' {m, n}` THEN + REWRITE_TAC[critical_edgeX; edgeX; IN_ELIM_THM; IN]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `VX V x' = V INTER x'`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (UNDISCH_TAC `mcell_set V x'` THEN REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (STRIP_TAC); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[IN]); + (STRIP_TAC THEN UNDISCH_TAC `VX V x' u'`); + (ASM_REWRITE_TAC[VX; MESON[IN] `{} x <=> x IN {}`] THEN SET_TAC[]); + + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) x <=> x IN A`]); + (ASM_SET_TAC[]); + (NEW_GOAL `dist (p, m:real^3) < &8`); + (REWRITE_TAC[GSYM IN_BALL]); + (ASM_SET_TAC[]); + (NEW_GOAL `dist (vec 0, p) <= dist (vec 0, m:real^3) + dist (p, m)`); + (NORM_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[SUM_CLAUSES]); + + (ABBREV_TAC + `g = (\m:real^3. {n | n IN T1 /\ ~(m = n) /\ dist (m,n) <= &2 * hplus})`); + (REWRITE_WITH + `{m,n | m IN T3 /\ n IN T1 /\ ~(m = n) /\ dist (m,n) <= &2 * hplus} = + {m,n:real^3 | m IN T3 /\ n IN g m}`); + (EXPAND_TAC "g" THEN ASM_REWRITE_TAC[] THEN SET_TAC[]); + (ABBREV_TAC `h = (\m. (\n. (f1:(real^3->bool)->real) {m, n}))`); + (REWRITE_WITH `(\(m,n). (f1:(real^3->bool)->real) {m, n}) = + (\(m,n). h m n)`); + (REWRITE_TAC[FUN_EQ_THM]); + (STRIP_TAC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `x:real^3#real^3 = FST x, SND x`); + (REWRITE_TAC[PAIR]); + (ONCE_ASM_REWRITE_TAC[]); + (EXPAND_TAC "h" THEN REWRITE_TAC[]); + + (REWRITE_WITH `sum {m,n | m IN T3 /\ n IN g m} (\(m,n). h m n) = + sum T3 (\m. sum (g m) ((h:real^3->real^3->real) m))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC SUM_SUM_PRODUCT); + (STRIP_TAC); + + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `V:real^3->bool INTER ball (vec 0,r)`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "T3" THEN SET_TAC[]); + + (REPEAT STRIP_TAC); + (EXPAND_TAC "g" THEN REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `V:real^3->bool INTER ball (vec 0,r)`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "T1" THEN SET_TAC[]); + + (NEW_GOAL + `sum T3 (\m. sum ((g:real^3->real^3->bool) m) (h m)) <= + sum T3 (\n:real^3. ss1)`); + (MATCH_MP_TAC SUM_LE); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `V:real^3->bool INTER ball (vec 0,r)`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "T3" THEN SET_TAC[]); + (REPEAT STRIP_TAC THEN REWRITE_TAC[]); + + (NEW_GOAL `sum ((g:real^3->real^3->bool) x) (h x) <= sum (g x) (\x. cc4 * cc3)`); + (MATCH_MP_TAC SUM_LE); + (STRIP_TAC); + (EXPAND_TAC "g" THEN REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `V:real^3->bool INTER ball (vec 0,r)`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "T1" THEN SET_TAC[]); + + (REPEAT STRIP_TAC THEN EXPAND_TAC "h" THEN REWRITE_TAC[]); + (EXPAND_TAC "f1"); + (ABBREV_TAC `S1 = {X | X SUBSET ball (vec 0,r + &8) /\ + ~(X SUBSET ball (vec 0,r - &8)) /\ + mcell_set V X /\ + critical_edgeX V X {x, x'}}`); + (NEW_GOAL `sum (S1:(real^3->bool)->bool) (beta_bump V {x, x'}) <= + sum S1 (\x. cc3)`); + (MATCH_MP_TAC SUM_LE); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (vec 0,r + &8) /\ mcell_set V X}`); + (STRIP_TAC); + (REPEAT STRIP_TAC THEN REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_MCELL_SET_LEMMA); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "S1" THEN SET_TAC[]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (UP_ASM_TAC THEN EXPAND_TAC "S1" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (STRIP_TAC THEN ASM_REWRITE_TAC[]); + + (NEW_GOAL `sum S1 (\x:real^3->bool. cc3) = &(CARD S1) * cc3`); + (MATCH_MP_TAC SUM_CONST); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (vec 0,r + &8) /\ mcell_set V X}`); + (STRIP_TAC); + (REPEAT STRIP_TAC THEN REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_MCELL_SET_LEMMA); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "S1" THEN SET_TAC[]); + (NEW_GOAL `&(CARD (S1:(real^3->bool)->bool)) <= cc4`); + (NEW_GOAL `&(CARD (S1:(real^3->bool)->bool)) <= + &(CARD {X | mcell_set V X /\ VX V X x})`); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (STRIP_TAC); + (EXPAND_TAC "S1" THEN + REWRITE_TAC[SUBSET; IN; IN_ELIM_THM; critical_edgeX; edgeX] THEN + REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `x:real^3 = u' \/ x = v'`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (x:real^3, &8) /\ mcell_set V X}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_MCELL_SET_LEMMA_2); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) x <=> x IN A`]); + (NEW_GOAL `VX V x'' = V INTER x''`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (UNDISCH_TAC `mcell_set V x''` THEN REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (STRIP_TAC); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[IN]); + (STRIP_TAC THEN UNDISCH_TAC `VX V x'' x`); + (ASM_REWRITE_TAC[VX; MESON[IN] `{} x <=> x IN {}`] THEN SET_TAC[]); + (NEW_GOAL `x'' SUBSET ball (x:real^3, &8)`); + (MATCH_MP_TAC MCELL_SUBSET_BALL8_2); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `&(CARD {X | mcell_set V X /\ VX V X x}) <= cc4`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `x IN (T3:real^3->bool)` THEN EXPAND_TAC "T3"); + (SET_TAC[]); + (ABBREV_TAC `s_temp = &(CARD {X | mcell_set V X /\ VX V X x})`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `sum (S1:(real^3->bool)->bool) (\x. cc3) <= cc4 * cc3`); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[REAL_ARITH `a <= b <=> &0 <= b - a`]); + (ONCE_REWRITE_TAC[REAL_ARITH `a * x - b * x = (a - b) * x`]); + (MATCH_MP_TAC REAL_LE_MUL THEN STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ABBREV_TAC `s_temp = sum (S1:(real^3->bool)->bool) (\x. cc3)`); + (ASM_REAL_ARITH_TAC); + + + + (NEW_GOAL `sum ((g:real^3->real^3->bool) x) (\x. cc4 * cc3) <= ss1`); + (REWRITE_WITH + `sum ((g:real^3->real^3->bool) x) (\x. cc4 * cc3) = + &(CARD (g x)) * cc4 * cc3`); + (MATCH_MP_TAC SUM_CONST); + (EXPAND_TAC "g"); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `T1:real^3->bool`); + (STRIP_TAC); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + + (NEW_GOAL `&(CARD ((g:real^3->real^3->bool) x)) <= + &(CARD (V INTER ball (x:real^3, &3)))`); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (STRIP_TAC); + (EXPAND_TAC "g" THEN EXPAND_TAC "T1" THEN + REWRITE_TAC[SUBSET; IN; IN_ELIM_THM; IN_INTER; IN_BALL]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `&2 * hplus < &3`); + (REWRITE_TAC[hplus] THEN REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + + (EXPAND_TAC "ss1"); + (ONCE_REWRITE_TAC[REAL_ARITH `a <= b <=> &0 <= b - a`]); + (ONCE_REWRITE_TAC[REAL_ARITH `a * x - b * x = (a - b) * x`]); + (MATCH_MP_TAC REAL_LE_MUL THEN STRIP_TAC); + (ONCE_REWRITE_TAC[GSYM (REAL_ARITH `a <= b <=> &0 <= b - a`)]); + (NEW_GOAL `&(CARD (V INTER ball (x:real^3,&3))) <= &4 pow 3`); + (REWRITE_TAC[REAL_ARITH `&4 = &3 + &1`]); + (MATCH_MP_TAC BOUNDS_VGEN_klemma); + (ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + + (ASM_REAL_ARITH_TAC); + + (EXPAND_TAC "g"); + (REWRITE_TAC[REAL_ARITH `&1 / &2 * x + a <= &0 <=> x <= &2 * (-- a)`]); + (REWRITE_TAC[REAL_ARITH `c * r pow 2 + d * r pow 2 = (c + d) * r pow 2`]); + (REWRITE_WITH `(c:real) + dd = -- ss`); + (EXPAND_TAC "c"); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&2 * --(--ss * r pow 2) = &2 * ss * r pow 2`]); + (NEW_GOAL `sum T3 (\n:real^3. ss1) <= &2 * ss * r pow 2`); + (REWRITE_WITH `sum T3 (\n:real^3. ss1) = &(CARD (T3)) * ss1`); + (MATCH_MP_TAC SUM_CONST); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `(V:real^3->bool) INTER ball (vec 0,r)`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "T3" THEN SET_TAC[]); + (EXPAND_TAC "ss"); + (REWRITE_TAC[REAL_ARITH + `&2 * (&1 / &2 * dd4 * ss1) * r pow 2 = (dd4 * r pow 2) * ss1`]); + (ONCE_REWRITE_TAC[REAL_ARITH `a <= b <=> &0 <= b - a`]); + (ONCE_REWRITE_TAC[REAL_ARITH `a * x - b * x = (a - b) * x`]); + (MATCH_MP_TAC REAL_LE_MUL THEN STRIP_TAC); + (ONCE_REWRITE_TAC[GSYM (REAL_ARITH `a <= b <=> &0 <= b - a`)]); + (EXPAND_TAC "T3"); + (ONCE_REWRITE_TAC[SET_RULE `A INTER B DIFF C = A INTER B DIFF A INTER C`]); + + (MATCH_MP_TAC (REAL_ARITH `(?x. a <= x /\ x <= b) ==> a <= b`)); + (EXISTS_TAC `dd3 * r pow 2`); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[REAL_ARITH `(a <= b <=> &0 <= b - a)`]); + (REWRITE_TAC[REAL_ARITH `a * x - b * x = (a - b ) * x`]); + (MATCH_MP_TAC REAL_LE_MUL THEN STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_LE_POW_2]); + (EXPAND_TAC "ss1"); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + + (REWRITE_WITH + `sum T3 (\m:real^3. sum {n | n IN T1 /\ ~(m = n) /\ dist (m,n) <= &2 * hplus} + (h m)) = + sum T3 (\m. sum (g m) (h m))`); + (EXPAND_TAC "g" THEN REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (EXISTS_TAC `&0`); + (REPEAT STRIP_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~(saturated V /\ packing V)` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[])]);; + + diff --git a/legacy/oldpacking/packing/development/REUHADY.hl b/legacy/oldpacking/packing/development/REUHADY.hl new file mode 100644 index 0000000..a24191d --- /dev/null +++ b/legacy/oldpacking/packing/development/REUHADY.hl @@ -0,0 +1,8235 @@ +open Sphere;; +open Euler_main_theorem;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Pack2;; +open Packing3;; +open Rogers;; +open Vukhacky_tactics;; +open Marchal_cells;; +open Emnwuus;; +open Marchal_cells_2;; +open Marchal_cells_2_new;; +open Urrphbz1;; +open Lepjbdj;; +open Hdtfnfz;; +open Rvfxzbu;; +open Sltstlo;; +open Urrphbz2;; +open Urrphbz3;; +open Ynhyjit;; +open Njiutiu;; +open Tezffsk;; +open Qzksykg;; +open Ddzuphj;; +open Ajripqn;; +open Qzyzmjc;; +open Upfzbzm_support_lemmas;; +open Marchal_cells_3;; +open Grutoti;; +open Sum_beta_bump;; +open Kizhltl;; +open Sum_gammax_lmfun_estimate;; +open Upfzbzm;; +open Rdwkarc;; +open Ineq;; +open Merge_ineq;; +open Hales_tactic;; + + +let wedge_ge = new_definition `wedge_ge v0 v1 w1 w2 = { z | +&0 <= azim v0 v1 w1 z /\ azim v0 v1 w1 z <= azim v0 v1 w1 w2 }`;; + +let BARV_2_IMP_NOT_COLLINEAR_SET_OF_LIST = prove_by_refinement ( + `!V ul. packing V /\ barV V 2 ul ==> + ~collinear (set_of_list ul)`, +[(REWRITE_TAC[COLLINEAR_AFF_DIM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `aff_dim (set_of_list (ul:(real^3)list)) = &2`); + (MATCH_MP_TAC MHFTTZN1); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC)]);; + +(* ======================================================================== *) +(* Some axioms *) + +let KY_CHEAT_TAC = MP_TAC (mk_fthm([],`F`)) THEN MESON_TAC[];; + +let INTER_2_WEDGE_GE_SUBSET_UNION_2_AFF_GE_LEMMA = + prove (`!u0 u1 w1 w2. ~(azim u0 u1 v1 v2 = &0) ==> + wedge_ge u0 u1 v1 v2 INTER wedge_ge u0 u1 v2 v1 SUBSET + aff_ge {u0,u1} {v1} UNION aff_ge {u0,u1} {v2:real^3}`, + KY_CHEAT_TAC);; + +let MEASURABLE_CONIC_CAP_WEDGE_GE = prove + (`!v0 v1 w1 w2 r a. + measurable (conic_cap v0 v1 r a INTER wedge_ge v0 v1 w1 w2)`, + KY_CHEAT_TAC);; + +let VOLUME_CONIC_CAP_WEDGE_GE_VS_CONIC_CAP = prove ( + `!v0 v1 w1 w2 r a. + &0 < a /\ a < &1 /\ + &0 < r /\ r <= &1 /\ + ~collinear {v0, v1, w1} /\ + ~collinear {v0, v1, w2} + ==> vol (conic_cap v0 v1 r a INTER wedge_ge v0 v1 w1 w2) = + vol (conic_cap v0 v1 r a) * (azim v0 v1 w w2) / (&2 * pi)`, + KY_CHEAT_TAC);; + +let BARV_2_IMP_NOT_COLLINEAR_SET_OF_LIST = prove + (`!V ul. packing V /\ saturated V /\ barV V 2 ul ==> + ~collinear (set_of_list ul)`, + KY_CHEAT_TAC);; + +(* ======================================================================== *) + +let REUHADY_concl1 = + `!V u0 u1 vl1 vl2 v1 v2 e. + saturated V /\ + packing V /\ + u0 IN V /\ + u1 IN V /\ + ~(u0 = u1) /\ + hl [u0; u1] < sqrt (&2) /\ + e = {u0, u1} /\ + ~(azim u0 u1 n1 n2 = &0) /\ + ~(vl1 = vl2) /\ + hl vl1 < sqrt2 /\ + hl vl2 < sqrt2 /\ + vl1 IN barV V 2 /\ + vl2 IN barV V 2 /\ + set_of_list (truncate_simplex 1 vl1) = e /\ + set_of_list (truncate_simplex 1 vl2) = e /\ + n1 = EL 2 vl1 /\ + n2 = EL 2 vl2 /\ + (!X. X IN mcell_set V /\ e IN edgeX V X + ==> X SUBSET wedge_ge u0 u1 n1 n2 \/ + X SUBSET wedge_ge u0 u1 n2 n1) + ==> sum + {X | mcell_set V X /\ e IN edgeX V X /\ X SUBSET wedge_ge u0 u1 n1 n2} + (\t. dihX V t (u0,u1)) = + azim u0 u1 n1 n2`;; + + +g REUHADY_concl1;; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `barV V 1 [u0;u1:real^3]`);; +e (MATCH_MP_TAC HL_LE_SQRT2_IMP_BARV_1);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL + `{k | k IN 1..3 /\ + voronoi_list V [u0;u1:real^3] = + UNIONS + {convex hull + ({omega_list_n V vl i | i IN 1..k - 1} UNION + voronoi_list V vl) | vl | barV V k vl /\ + truncate_simplex 1 vl = [u0;u1]}} = + 1..3`);; +e (MATCH_MP_TAC Rogers.GLTVHUM_lemma1);; +e (ASM_REWRITE_TAC[] THEN ARITH_TAC);; +e (NEW_GOAL + `3 IN {k | k IN 1..3 /\ + voronoi_list V [u0; u1] = + UNIONS + {convex hull + ({omega_list_n V vl i | i IN 1..k - 1} UNION voronoi_list V vl) | vl | + barV V k vl /\ + truncate_simplex 1 vl = [u0; u1]}}`);; +e (ASM_REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC);; +e (UP_ASM_TAC THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]);; +e (REWRITE_WITH + `UNIONS + {convex hull ({omega_list_n V vl i | i IN 1..3 - 1} UNION voronoi_list V vl) | vl | barV V 3 vl /\ + truncate_simplex 1 vl = [u0; u1]} = + UNIONS {convex hull {omega_list_n V vl 1, omega_list_n V vl 2, + omega_list_n V vl 3} | vl | barV V 3 vl /\ + truncate_simplex 1 vl = [u0; u1]}`);; +e (ONCE_REWRITE_TAC[SET_EQ_LEMMA]);; +e (REWRITE_TAC[IN_UNIONS] THEN ONCE_REWRITE_TAC[IN] THEN + REWRITE_TAC[IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (EXISTS_TAC `t:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (EXISTS_TAC `vl:(real^3)list`);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `?a. voronoi_list V vl = {a} /\ + a = circumcenter (set_of_list vl) /\ + hl vl = dist (HD vl,a)`);; +e (MATCH_MP_TAC Marchal_cells_2_new.VORONOI_LIST_3_SINGLETON_EXPLICIT);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; + +e (NEW_GOAL `omega_list_n V vl 3 IN voronoi_list V vl`);; +e (REWRITE_WITH `omega_list_n V vl 3 = omega_list V vl`);; +e (REWRITE_TAC[OMEGA_LIST]);; +e (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[ARITH_RULE `(3 + 1) - 1 = 3`]);; +e (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST);; +e (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]);; +e (NEW_GOAL `omega_list_n V vl 3 = a`);; +e (ASM_SET_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; IN_NUMSEG; + ARITH_RULE `1 <= i /\ i <= 2 <=> i = 1 \/ i = 2`]);; +e (REWRITE_WITH `{omega_list_n V vl i | i = 1 \/ i = 2} = + {omega_list_n V vl 1,omega_list_n V vl 2}`);; +e (SET_TAC[]);; +e (REWRITE_WITH `{omega_list_n V vl 1, omega_list_n V vl 2} UNION + {circumcenter (set_of_list vl)} = {omega_list_n V vl 1, omega_list_n V vl 2, circumcenter (set_of_list vl)}`);; +e (SET_TAC[]);; + +e (EXISTS_TAC `t:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (EXISTS_TAC `vl:(real^3)list`);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `?a. voronoi_list V vl = {a} /\ + a = circumcenter (set_of_list vl) /\ + hl vl = dist (HD vl,a)`);; +e (MATCH_MP_TAC Marchal_cells_2_new.VORONOI_LIST_3_SINGLETON_EXPLICIT);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; + + +e (NEW_GOAL `omega_list_n V vl 3 IN voronoi_list V vl`);; +e (REWRITE_WITH `omega_list_n V vl 3 = omega_list V vl`);; +e (REWRITE_TAC[OMEGA_LIST]);; +e (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[ARITH_RULE `(3 + 1) - 1 = 3`]);; +e (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST);; +e (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]);; +e (NEW_GOAL `omega_list_n V vl 3 = a`);; +e (ASM_SET_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; IN_NUMSEG; + ARITH_RULE `1 <= i /\ i <= 2 <=> i = 1 \/ i = 2`]);; +e (REWRITE_WITH `{omega_list_n V vl i | i = 1 \/ i = 2} = + {omega_list_n V vl 1,omega_list_n V vl 2}`);; +e (SET_TAC[]);; +e (REWRITE_WITH `{omega_list_n V vl 1, omega_list_n V vl 2} UNION + {circumcenter (set_of_list vl)} = {omega_list_n V vl 1, omega_list_n V vl 2, + circumcenter (set_of_list vl)}`);; +e (SET_TAC[]);; +e (STRIP_TAC);; + +(* ======================================================================= *) + +e (ABBREV_TAC `p = circumcenter {u0, u1:real^3}`);; +e (NEW_GOAL `aff_dim (u0 INSERT voronoi_list V [u0;u1]) = &3`);; +e (REWRITE_TAC[AFF_DIM_INSERT]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; + +e (NEW_GOAL `affine hull voronoi_list V [u0; u1] SUBSET + affine hull {x | &2 % (u0 - u1) dot x = norm u0 pow 2 - norm u1 pow 2}`);; +e (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA);; +e (REWRITE_TAC[VORONOI_LIST; set_of_list; Packing3.VORONOI_SET_2]);; +e (ONCE_REWRITE_TAC[SET_RULE `a INTER b = b INTER a`]);; +e (ASM_SIMP_TAC[Pack2.INTER_VORONOI_SUBSET_BISECTOR]);; +e (NEW_GOAL + `affine hull {x | &2 % (u0 - u1) dot x = norm u0 pow 2 - norm u1 pow 2} = + {x:real^3 | &2 % (u0 - u1) dot x = norm u0 pow 2 - norm u1 pow 2}`);; +e (REWRITE_TAC[AFFINE_HULL_EQ]);; +e (REWRITE_TAC[AFFINE_HYPERPLANE]);; +e (NEW_GOAL + `~(u0 IN {x:real^3 | &2 % (u0 - u1) dot x = norm u0 pow 2 - norm u1 pow 2})`);; +e (REWRITE_TAC[IN; IN_ELIM_THM; NORM_POW_2]);; +e (ONCE_REWRITE_TAC [REAL_ARITH `a = b <=> a - b = &0`]);; +e (REWRITE_TAC[VECTOR_ARITH `&2 % (u0 - u1) dot u0 - (u0 dot u0 - u1 dot u1) = + (u0 - u1) dot (u0 - u1)`]);; +e (REWRITE_TAC[DOT_EQ_0] THEN ASM_NORM_ARITH_TAC);; +e (ASM_SET_TAC[]);; +e (ASM_MESON_TAC[]);; +e (REWRITE_TAC[ARITH_RULE `a + &1 = b:int <=> a = b - &1`]);; +e (MATCH_MP_TAC Packing3.AFF_DIM_VORONOI_LIST);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `aff_dim (u0 INSERT voronoi_list V [u0; u1]) = &(dimindex (:3))`);; +e (ASM_REWRITE_TAC[DIMINDEX_3]);; +e (UP_ASM_TAC THEN REWRITE_TAC[AFF_DIM_EQ_FULL]);; +e (STRIP_TAC);; + +e (ABBREV_TAC `S = voronoi_list V [u0;u1]`);; +e (NEW_GOAL `!x. x IN S ==> (x - u0) dot (u1 - u0) = + dist (p, u0) * dist (u1, u0:real^3)`);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `p = inv (&2) % (u0 + (u1:real^3))`);; +e (EXPAND_TAC "p" THEN REWRITE_TAC[Rogers.CIRCUMCENTER_2; midpoint]);; +e (REWRITE_TAC[dist]);; +e (REWRITE_WITH `u1 - u0 = &2 % (p - u0:real^3)`);; +e (ASM_REWRITE_TAC[]);; +e (VECTOR_ARITH_TAC);; +e (REWRITE_TAC[NORM_MUL; REAL_ARITH `abs (&2) = &2`; + REAL_ARITH `a * b * a = b * a pow 2`; NORM_POW_2; DOT_RMUL]);; +e (REWRITE_WITH `(x - u0) dot (p - u0:real^3) = + (p - u0) dot (p - u0) - (x - p) dot (u0 - p)`);; +e (VECTOR_ARITH_TAC);; +e (REWRITE_WITH `(x - p) dot (u0 - p:real^3) = &0`);; +e (EXPAND_TAC "p");; +e (REWRITE_WITH `{u0, u1} = set_of_list [u0; u1:real^3]`);; +e (REWRITE_TAC[set_of_list]);; +e (MATCH_MP_TAC Rogers.MHFTTZN4);; +e (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`);; +e (REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `S SUBSET affine hull voronoi_list V [u0; u1]`);; +e (EXPAND_TAC "S");; +e (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]);; +e (ASM_SET_TAC[]);; +e (REWRITE_TAC[set_of_list]);; +e (NEW_GOAL `{u0,u1} SUBSET affine hull {u0,u1:real^3}`);; +e (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]);; +e (ASM_SET_TAC[]);; +e (REAL_ARITH_TAC);; + +(* ========================================================================= *) + +e (ABBREV_TAC `S1 = {x:real^3 | &2 % (u0 - u1) dot x = + norm u0 pow 2 - norm u1 pow 2}`);; +e (ABBREV_TAC `S2:real^3->bool = (S1 DIFF (relative_interior S))`);; +e (NEW_GOAL `closed_in (subtopology euclidean (S1:real^3->bool)) S2`);; +e (EXPAND_TAC "S2");; +e (MATCH_MP_TAC CLOSED_IN_DIFF);; +e (STRIP_TAC);; +e (NEW_GOAL `closed (S1:real^3->bool)`);; +e (EXPAND_TAC "S1" THEN REWRITE_TAC[CLOSED_HYPERPLANE]);; +e (MATCH_MP_TAC CLOSED_SUBSET);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; + +e (REWRITE_WITH `S1 = affine hull (S:real^3->bool)`);; +e (EXPAND_TAC "S");; +e (NEW_GOAL `affine hull S1 = S1:real^3->bool`);; +e (REWRITE_TAC[AFFINE_HULL_EQ]);; +e (EXPAND_TAC "S1" THEN REWRITE_TAC[AFFINE_HYPERPLANE]);; +e (ONCE_REWRITE_TAC[GSYM (ASSUME `affine hull S1 = S1:real^3->bool`)]);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC AFF_DIM_EQ_AFFINE_HULL);; +e (STRIP_TAC);; +e (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `INTERS {f x | x IN {a, b}} = f a INTER f b`]);; +e (DEL_TAC THEN EXPAND_TAC "S1");; +e (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `aff_dim (S1:(real^3->bool)) = &(dimindex (:3)) - &1`);; +e (DEL_TAC THEN EXPAND_TAC "S1");; +e (MATCH_MP_TAC AFF_DIM_HYPERPLANE);; +e (REWRITE_TAC[VECTOR_ARITH `&2 % (s - t) = vec 0 <=> s = t`]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[DIMINDEX_3]);; +e (REWRITE_WITH `aff_dim (voronoi_list V [u0;u1:real^3]) = &3 - &1`);; +e (MATCH_MP_TAC Packing3.AFF_DIM_VORONOI_LIST);; +e (ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; + +e (REWRITE_TAC[OPEN_IN_RELATIVE_INTERIOR]);; + +e (NEW_GOAL `closed (S2:real^3->bool)`);; +e (MATCH_MP_TAC CLOSED_IN_CLOSED_TRANS);; +e (EXISTS_TAC `S1:real^3->bool`);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "S1");; +e (REWRITE_TAC[CLOSED_HYPERPLANE]);; + + +e (NEW_GOAL `~(S2:real^3->bool = {})`);; +e (EXPAND_TAC "S2");; +e (REWRITE_TAC [SET_RULE `A DIFF B = {} <=> A SUBSET B`]);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `S1 SUBSET S:real^3->bool`);; +e (NEW_GOAL `relative_interior S SUBSET S:real^3->bool`);; +e (REWRITE_TAC[RELATIVE_INTERIOR_SUBSET]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; + +e (NEW_GOAL `S1 = S:real^3->bool`);; +e (NEW_GOAL `S SUBSET S1:real^3->bool`);; +e (EXPAND_TAC "S");; +e (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `INTERS {f x | x IN {a, b}} = f a INTER f b`]);; +e (EXPAND_TAC "S1");; +e (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; + +e (NEW_GOAL `bounded (S1:real^3->bool)`);; +e (REWRITE_TAC[ASSUME `S1 = S:real^3->bool`]);; +e (DEL_TAC THEN EXPAND_TAC "S");; +e (MATCH_MP_TAC Packing3.BOUNDED_VORONOI_LIST);; +e (EXISTS_TAC `1`);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `~bounded (S1:real^3->bool)`);; +e (EXPAND_TAC "S1");; +e (MATCH_MP_TAC UNBOUNDED_HYPERPLANE);; +e (REWRITE_TAC[VECTOR_ARITH `&2 % (u0 - u1) = vec 0 <=> u0 = u1`]);; +e (ASM_REWRITE_TAC[]);; +e (ASM_MESON_TAC[]);; + +e (NEW_GOAL `?z:real^3. z IN S2 /\ + (!w. w IN S2 ==> dist (u0,z) <= dist (u0,w))`);; +e (MATCH_MP_TAC DISTANCE_ATTAINS_INF);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; + +(* ======================================================================== *) + +e (ABBREV_TAC `a = dist (p, u0:real^3) / dist (z, u0)`);; +e (NEW_GOAL `&0 < a /\ a < &1`);; +e (EXPAND_TAC "a");; +e (NEW_GOAL `~(u0:real^3 IN S1)`);; +e (EXPAND_TAC "S1" THEN REWRITE_TAC[IN; IN_ELIM_THM; NORM_POW_2]);; +e (REWRITE_TAC[REAL_ARITH `a = b - c <=> a + c - b = &0`]);; +e (REWRITE_TAC[VECTOR_ARITH `&2 % (u0 - u1) dot u0 + u1 dot u1 - u0 dot u0 = + (u0 - u1) dot (u0 - u1)`]);; +e (REWRITE_TAC[DOT_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `&0 < dist (p,u0:real^3)`);; +e (MATCH_MP_TAC DIST_POS_LT);; +e (EXPAND_TAC "p" THEN REWRITE_TAC[Rogers.CIRCUMCENTER_2; midpoint]);; +e (REWRITE_TAC[VECTOR_ARITH `inv (&2) % (u0 + u1) = u0 <=> u0 = u1`]);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `&0 < dist (z,u0:real^3)`);; +e (MATCH_MP_TAC DIST_POS_LT);; +e (STRIP_TAC);; +e (NEW_GOAL `z:real^3 IN S1`);; +e (ASM_SET_TAC[]);; +e (ASM_MESON_TAC[]);; +e (STRIP_TAC);; +e (MATCH_MP_TAC REAL_LT_DIV);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH + `dist (p,u0) / dist (z,u0:real^3) < &1 <=> dist (p,u0) < &1 * dist (z,u0)`);; +e (ASM_SIMP_TAC[REAL_LT_LDIV_EQ]);; +e (REWRITE_TAC[REAL_MUL_LID]);; +e (MATCH_MP_TAC Tactics_jordan.REAL_POW_2_LT);; +e (REPEAT STRIP_TAC);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; +e (REWRITE_TAC[dist]);; +e (REWRITE_WITH `norm (z - u0:real^3) pow 2 = + norm (p - u0) pow 2 + norm (z - p) pow 2`);; +e (MATCH_MP_TAC PYTHAGORAS);; +e (REWRITE_TAC[orthogonal]);; +e (REWRITE_WITH `p = circumcenter (set_of_list [u0;u1:real^3])`);; +e (ASM_REWRITE_TAC[set_of_list]);; +e (ONCE_REWRITE_TAC[DOT_SYM]);; +e (MATCH_MP_TAC Rogers.MHFTTZN4);; +e (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`);; +e (REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[ASSUME `voronoi_list V [u0; u1] = S`]);; +e (REWRITE_WITH `affine hull (S:real^3->bool) = S1`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (EXPAND_TAC "S");; +e (NEW_GOAL `affine hull S1 = S1:real^3->bool`);; +e (REWRITE_TAC[AFFINE_HULL_EQ]);; +e (EXPAND_TAC "S1" THEN REWRITE_TAC[AFFINE_HYPERPLANE]);; +e (ONCE_REWRITE_TAC[GSYM (ASSUME `affine hull S1 = S1:real^3->bool`)]);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC AFF_DIM_EQ_AFFINE_HULL);; +e (STRIP_TAC);; +e (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `INTERS {f x | x IN {a, b}} = f a INTER f b`]);; +e (DEL_TAC THEN EXPAND_TAC "S1");; +e (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `aff_dim (S1:(real^3->bool)) = &(dimindex (:3)) - &1`);; +e (DEL_TAC THEN EXPAND_TAC "S1");; +e (MATCH_MP_TAC AFF_DIM_HYPERPLANE);; +e (REWRITE_TAC[VECTOR_ARITH `&2 % (s - t) = vec 0 <=> s = t`]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[DIMINDEX_3]);; +e (REWRITE_WITH `aff_dim (voronoi_list V [u0;u1:real^3]) = &3 - &1`);; +e (MATCH_MP_TAC Packing3.AFF_DIM_VORONOI_LIST);; +e (ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; +e (ASM_SET_TAC[]);; +e (REWRITE_TAC[set_of_list]);; +e (NEW_GOAL `{u0, u1:real^3} SUBSET affine hull {u0, u1}`);; +e (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]);; +e (ASM_SET_TAC[]);; +e (REWRITE_TAC[REAL_ARITH `a < a + b <=> &0 < b`; NORM_POW_2; DOT_POS_LT]);; +e (REWRITE_TAC[VECTOR_ARITH `a - b = vec 0 <=> a = b`]);; +e (STRIP_TAC);; +e (NEW_GOAL `~(z:real^3 IN S2)`);; +e (REWRITE_TAC[ASSUME `z = p:real^3`]);; +e (EXPAND_TAC "S2");; +e (NEW_GOAL `p:real^3 IN relative_interior S`);; + + + +e (ABBREV_TAC `B = V INTER ball (p:real^3, &8)`);; +e (ABBREV_TAC `A = B DIFF {u0, u1:real^3}`);; +e (NEW_GOAL `FINITE (A:real^3->bool)`);; +e (EXPAND_TAC "A");; +e (MATCH_MP_TAC FINITE_DIFF);; +e (EXPAND_TAC "B");; +e (MATCH_MP_TAC Packing3.KIUMVTC THEN ASM_REWRITE_TAC[]);; +e (NEW_GOAL `?y. dist (p,y:real^3) = &4`);; +e (MATCH_MP_TAC VECTOR_CHOOSE_DIST);; +e (REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (UNDISCH_TAC `saturated (V:real^3->bool)`);; +e (REWRITE_TAC[saturated] THEN STRIP_TAC);; +e (NEW_GOAL `?z. z IN V /\ dist (y:real^3, z) < &2`);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; + +e (NEW_GOAL `z':real^3 IN A`);; +e (EXPAND_TAC "A" THEN EXPAND_TAC "B");; +e (REWRITE_TAC[IN_DIFF; IN_INTER; IN_BALL]);; +e (REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `dist (p,z') <= dist (p, y) + dist (y, z':real^3)`);; +e (REWRITE_TAC[DIST_TRIANGLE]);; +e (ASM_REAL_ARITH_TAC);; +e (NEW_GOAL `dist (p, y) <= dist (p, z') + dist (z', y:real^3)`);; +e (REWRITE_TAC[DIST_TRIANGLE]);; +e (UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[DIST_SYM]);; +e (STRIP_TAC);; +e (NEW_GOAL `&2 < dist (z', p:real^3)`);; +e (ASM_REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN REWRITE_TAC[] THEN ONCE_REWRITE_TAC[DIST_SYM]);; +e (REWRITE_WITH `p = circumcenter (set_of_list [u0;u1:real^3])`);; +e (ASM_MESON_TAC[set_of_list]);; +e (NEW_GOAL `(!w. w IN set_of_list [u0;u1:real^3] + ==> dist (circumcenter (set_of_list [u0;u1]),w) = hl [u0;u1])`);; +e (MATCH_MP_TAC Rogers.HL_PROPERTIES);; +e (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_WITH `dist (circumcenter (set_of_list [u0; u1:real^3]),z') = + hl [u0; u1]`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_REWRITE_TAC[set_of_list]);; +e (NEW_GOAL `sqrt (&2) <= &2`);; +e (MATCH_MP_TAC Tactics_jordan.REAL_POW_2_LE);; +e (SIMP_TAC[REAL_ARITH `&0 <= &2`; SQRT_POS_LE; SQRT_POW_2]);; +e (REAL_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; + +e (NEW_GOAL `?a:real^3. a IN A /\ (!x. x IN A ==> dist (p,a) <= dist (p,x))`);; +e (MATCH_MP_TAC Packing3.REAL_FINITE_ARGMIN);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; + +e (ABBREV_TAC `d = inv (&4) * (dist (p, a') - dist (p, u0:real^3))`);; +e (NEW_GOAL `&0 < d`);; +e (EXPAND_TAC "d");; +e (MATCH_MP_TAC REAL_LT_MUL);; +e (STRIP_TAC);; +e (REAL_ARITH_TAC);; +e (REWRITE_TAC[REAL_ARITH `&0 < a - b <=> a > b`]);; +e (ONCE_REWRITE_TAC[DIST_SYM]);; +e (NEW_GOAL `!u v. u IN {u0,u1} /\ v IN V DIFF {u0,u1} ==> + dist (v,p) > dist (u,p:real^3)`);; +e (MATCH_MP_TAC Rogers.XYOFCGX);; +e (REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ASM_SET_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[AFFINE_INDEPENDENT_2]);; +e (ASM_MESON_TAC[set_of_list]);; +e (REWRITE_WITH `radV {u0, u1:real^3} = hl [u0;u1]`);; +e (REWRITE_TAC[HL;set_of_list]);; +e (ASM_REWRITE_TAC[]);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_SET_TAC[]);; + +e (REWRITE_TAC[relative_interior; IN; IN_ELIM_THM]);; +e (ABBREV_TAC `St = S INTER ball (p:real^3, d)`);; +e (EXISTS_TAC `St:real^3->bool`);; +e (REPEAT STRIP_TAC);; + +e (REWRITE_TAC[open_in]);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `S SUBSET affine hull (S:real^3->bool)`);; +e (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (EXISTS_TAC `d - dist (p:real^3, x)`);; +e (REPEAT STRIP_TAC);; +e (REWRITE_TAC[REAL_ARITH `&0 < a - b <=> b < a`]);; +e (REWRITE_TAC[GSYM IN_BALL]);; +e (ASM_SET_TAC[]);; +e (EXPAND_TAC "St");; +e (REWRITE_TAC[IN_INTER]);; +e (STRIP_TAC);; + +e (NEW_GOAL `dist (x',x:real^3) < d`);; +e (NEW_GOAL `&0 <= dist (p,x:real^3)`);; +e (REWRITE_TAC[DIST_POS_LE]);; +e (ASM_REAL_ARITH_TAC);; + +e (NEW_GOAL `x' IN voronoi_closed V (u0:real^3)`);; +e (REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; + +e (ASM_CASES_TAC `w IN {u0, u1:real^3}`);; +e (ASM_CASES_TAC `w = u0:real^3`);; +e (REWRITE_TAC[ASSUME `w = u0:real^3`]);; +e (REAL_ARITH_TAC);; +e (NEW_GOAL `w = u1:real^3`);; +e (ASM_SET_TAC[]);; +e (REWRITE_TAC[ASSUME `w = u1:real^3`]);; +e (MATCH_MP_TAC (REAL_ARITH `a = b ==> a <= b`));; + +e (NEW_GOAL `x':real^3 IN S1`);; +e (NEW_GOAL `affine hull S SUBSET affine hull (S1:real^3->bool)`);; +e (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA);; +e (EXPAND_TAC "S1" THEN REWRITE_TAC[GSYM + (ASSUME `voronoi_list V [u0; u1] = S`); VORONOI_LIST; VORONOI_SET; + set_of_list; SET_RULE `INTERS {f v | v IN {a, b}} = f a INTER f b`]);; +e (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `x' IN S1 <=> x':real^3 IN affine hull S1`);; +e (REWRITE_WITH `affine hull S1 = S1:real^3->bool`);; +e (REWRITE_TAC[AFFINE_HULL_EQ]);; +e (EXPAND_TAC "S1" THEN REWRITE_TAC[AFFINE_HYPERPLANE]);; +e (ASM_SET_TAC[]);; + +e (UP_ASM_TAC THEN EXPAND_TAC "S1" THEN REWRITE_TAC[IN_ELIM_THM; NORM_POW_2]);; +e (ONCE_REWRITE_TAC[REAL_ARITH `a = b <=> a - b = &0`]);; +e (REWRITE_TAC[ + VECTOR_ARITH `&2 % (u0 - u1) dot x - (u0 dot u0 - u1 dot u1) = + (u1 - x) dot (u1 - x) - (u0 - x) dot (u0 - x)`]);; +e (REWRITE_TAC[REAL_ARITH `a - b = &0 <=> a = b`; GSYM NORM_POW_2; GSYM dist]);; +e (STRIP_TAC);; +e (REWRITE_TAC[DIST_EQ]);; +e (ONCE_REWRITE_TAC[DIST_SYM]);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `dist (x', u0:real^3) <= dist (x', x) + dist (x, u0)`);; +e (REWRITE_TAC[DIST_TRIANGLE]);; +e (NEW_GOAL `dist (x, u0:real^3) <= dist (x, p:real^3) + dist (p, u0)`);; +e (REWRITE_TAC[DIST_TRIANGLE]);; +e (NEW_GOAL `dist (x,p:real^3) < d`);; +e (NEW_GOAL `x IN ball (p:real^3, d)`);; +e (ASM_SET_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL]);; +e (REWRITE_TAC[DIST_SYM]);; +e (NEW_GOAL `dist (x',u0) < &2 * d + dist (p:real^3,u0)`);; +e (ASM_REAL_ARITH_TAC);; + +e (NEW_GOAL `dist (p, w:real^3)- &2 * d <= dist (x',w)`);; +e (NEW_GOAL `dist (x, w:real^3) <= dist (x, x') + dist (x', w)`);; +e (REWRITE_TAC[DIST_TRIANGLE]);; +e (NEW_GOAL `dist (p, w:real^3) <= dist (p, x) + dist (x, w)`);; +e (REWRITE_TAC[DIST_TRIANGLE]);; +e (NEW_GOAL `dist (x, x':real^3) < d /\ dist (p, x:real^3) < d`);; +e (ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]);; +e (ASM_REAL_ARITH_TAC);; +e (NEW_GOAL `dist (p, u0) + &4 * d <= dist (p, w:real^3)`);; +e (EXPAND_TAC "d");; +e (REWRITE_TAC[REAL_ARITH `&4 * inv (&4) * a = a`]);; +e (REWRITE_TAC[REAL_ARITH `a + b - a = b`]);; + +e (ASM_CASES_TAC `w:real^3 IN B`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_SET_TAC[]);; +e (NEW_GOAL `~(dist (p,w:real^3) < &8)`);; +e (REWRITE_TAC[GSYM IN_BALL]);; +e (ASM_SET_TAC[]);; +e (NEW_GOAL `dist (p,a':real^3) < &8`);; +e (REWRITE_TAC[GSYM IN_BALL]);; +e (ASM_SET_TAC[]);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; + +e (NEW_GOAL `x' IN voronoi_closed V (u1:real^3)`);; +e (NEW_GOAL `x':real^3 IN S1`);; +e (NEW_GOAL `affine hull S SUBSET affine hull (S1:real^3->bool)`);; +e (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA);; +e (EXPAND_TAC "S1" THEN REWRITE_TAC[GSYM + (ASSUME `voronoi_list V [u0; u1] = S`); VORONOI_LIST; VORONOI_SET; + set_of_list; SET_RULE `INTERS {f v | v IN {a, b}} = f a INTER f b`]);; +e (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `x' IN S1 <=> x':real^3 IN affine hull S1`);; +e (REWRITE_WITH `affine hull S1 = S1:real^3->bool`);; +e (REWRITE_TAC[AFFINE_HULL_EQ]);; +e (EXPAND_TAC "S1" THEN REWRITE_TAC[AFFINE_HYPERPLANE]);; +e (ASM_SET_TAC[]);; + +e (UP_ASM_TAC THEN EXPAND_TAC "S1" THEN REWRITE_TAC[IN_ELIM_THM; NORM_POW_2]);; +e (ONCE_REWRITE_TAC[REAL_ARITH `a = b <=> a - b = &0`]);; +e (REWRITE_TAC[ + VECTOR_ARITH `&2 % (u0 - u1) dot x - (u0 dot u0 - u1 dot u1) = + (u1 - x) dot (u1 - x) - (u0 - x) dot (u0 - x)`]);; +e (REWRITE_TAC[REAL_ARITH `a - b = &0 <=> a = b`; GSYM NORM_POW_2; GSYM dist]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `x' IN voronoi_closed V (u0:real^3)`);; +e (REWRITE_TAC[voronoi_closed; IN_ELIM_THM; IN]);; +e (REPEAT STRIP_TAC);; +e (REWRITE_WITH `dist (x', u1)= dist (x', u0:real^3)`);; +e (ONCE_REWRITE_TAC[DIST_SYM]);; +e (ASM_REWRITE_TAC[DIST_EQ]);; +e (ASM_SIMP_TAC[]);; + +e (REWRITE_TAC[GSYM + (ASSUME `voronoi_list V [u0; u1] = S`); VORONOI_LIST; VORONOI_SET; + set_of_list; SET_RULE `INTERS {f v | v IN {a, b}} = f a INTER f b`]);; +e (ASM_REWRITE_TAC[IN_INTER]);; + +e (REWRITE_TAC[IN_BALL]);; +e (NEW_GOAL `dist (p,x':real^3) <= dist (p,x) + dist (x, x':real^3)`);; +e (REWRITE_TAC[DIST_TRIANGLE]);; +e (NEW_GOAL `dist (x,x':real^3) = dist (x',x)`);; +e (REWRITE_TAC[DIST_SYM]);; +e (ASM_REAL_ARITH_TAC);; +e (REWRITE_WITH `St p <=> p:real^3 IN St`);; +e (REWRITE_TAC[IN]);; +e (EXPAND_TAC "St" THEN REWRITE_TAC[IN_INTER; IN_BALL; DIST_REFL]);; +e (STRIP_TAC);; +e (REWRITE_WITH `p = omega_list V [u0; u1]`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (REWRITE_WITH `p = circumcenter (set_of_list [u0;u1:real^3])`);; +e (ASM_MESON_TAC[set_of_list]);; +e (MATCH_MP_TAC Rogers.XNHPWAB1);; +e (EXISTS_TAC `1`);; +e (ASM_REWRITE_TAC[IN]);; +e (REWRITE_TAC[GSYM (ASSUME `voronoi_list V [u0;u1] = S`)]);; +e (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST);; +e (EXISTS_TAC `1` THEN ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (ASM_MESON_TAC[]);; + +(* ======================================================================== *) + +e (NEW_GOAL `?b. &0 < b /\ b < &1 /\ + rcone_gt u0 u1 b SUBSET aff_ge_alt {u0:real^3} S`);; + +e (EXISTS_TAC `a:real`);; +e (REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[SET_RULE `A SUBSET B <=> (!x. ~(x IN B) ==> ~(x IN A))`]);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `x:real^3 IN affine hull (u0 INSERT S)`);; +e (ASM_SET_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[AFFINE_HULL_EXPLICIT_ALT; IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; + +e (ABBREV_TAC `h = sum (s DELETE u0:real^3) u`);; +e (NEW_GOAL `(x - u0) dot (u1 - u0:real^3) = + h * dist (p, u0) * dist (u1, u0:real^3)`);; +e (EXPAND_TAC "x");; +e (NEW_GOAL `u0 = vsum s (\v:real^3. (u:real^3->real) v % (u0:real^3))`);; +e (ASM_SIMP_TAC[VSUM_RMUL]);; +e (VECTOR_ARITH_TAC);; +e (REWRITE_WITH `vsum (s:real^3->bool) (\v. u v % v) - u0:real^3 = + vsum s (\v. u v % v) - vsum s (\v:real^3. u v % u0)`);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (REWRITE_WITH `vsum s (\v. u v % v) - vsum s (\v:real^3. u v % u0:real^3) = + vsum s (\x. (\v. u v % v) x - (\v. u v % u0) x)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC VSUM_SUB);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[VECTOR_ARITH `a % x - a % y = a % (x - y)`]);; +e (REWRITE_WITH `vsum s (\x:real^3. u x % (x - u0)) dot (u1 - u0) = + sum s (\x. (\x. u x % (x - u0)) x dot (u1 - u0:real^3))`);; +e (ASM_SIMP_TAC[DOT_LSUM]);; +e (REWRITE_TAC[DOT_LMUL]);; +e (REWRITE_WITH `sum s (\x:real^3. u x * ((x - u0) dot (u1 - u0:real^3))) = + sum (s DELETE u0) (\x. u x * (dist (p,u0) * dist (u1,u0)))`);; +e (ASM_CASES_TAC `u0:real^3 IN s`);; +e (NEW_GOAL `s = u0 INSERT (s DELETE u0:real^3)`);; +e (ASM_SET_TAC[]);; +e (NEW_GOAL `FINITE (s DELETE u0:real^3)`);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `s:real^3->bool` THEN ASM_REWRITE_TAC[] THEN SET_TAC[]);; + +e (REWRITE_WITH `sum s (\x:real^3. u x * ((x - u0) dot (u1 - u0:real^3))) = + sum (u0 INSERT (s DELETE u0)) (\x. u x * ((x - u0) dot (u1 - u0)))`);; +e (ASM_MESON_TAC[]);; +e (ABBREV_TAC `f = (\x:real^3. u x * ((x - u0) dot (u1 - u0:real^3)))`);; +e (REWRITE_WITH `sum (u0:real^3 INSERT (s DELETE u0)) f = + (if u0 IN (s DELETE u0) then sum (s DELETE u0) f + else f u0 + sum (s DELETE u0) f)`);; +e (MATCH_MP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt);; +e (ASM_REWRITE_TAC[]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (ASM_SET_TAC[]);; +e (ASM_MESON_TAC[]);; +e (REWRITE_WITH `f (u0:real^3) = &0`);; +e (EXPAND_TAC "f");; +e (REWRITE_TAC[VECTOR_ARITH `(u0 - u0) dot (u1 - u0) = &0`]);; +e (REAL_ARITH_TAC);; +e (REWRITE_TAC[REAL_ARITH `&0 + a = a`]);; +e (MATCH_MP_TAC SUM_EQ);; +e (EXPAND_TAC "f");; +e (REPEAT STRIP_TAC);; +e (REWRITE_TAC[REAL_ARITH `a * x = a * y * z <=> a * (x - y * z) = &0`]);; +e (NEW_GOAL `(x' - u0) dot (u1 - u0) - dist (p,u0) * dist (u1,u0:real^3) = &0`);; +e (REWRITE_TAC[REAL_ARITH `a - b = &0 <=> a = b`]);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_SET_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (REAL_ARITH_TAC);; +e (REWRITE_WITH `s DELETE u0:real^3 = s`);; +e (ASM_SET_TAC[]);; +e (MATCH_MP_TAC SUM_EQ);; +e (REPEAT STRIP_TAC);; +e (REWRITE_TAC[]);; +e (REWRITE_TAC[REAL_ARITH `a * x = a * y * z <=> a * (x - y * z) = &0`]);; +e (NEW_GOAL `(x' - u0) dot (u1 - u0) - dist (p,u0) * dist (u1,u0:real^3) = &0`);; +e (REWRITE_TAC[REAL_ARITH `a - b = &0 <=> a = b`]);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_SET_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (REAL_ARITH_TAC);; +e (NEW_GOAL `FINITE (s DELETE u0:real^3)`);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `s:real^3->bool` THEN ASM_REWRITE_TAC[] THEN SET_TAC[]);; +e (ASM_SIMP_TAC[SUM_RMUL]);; + +e (ASM_CASES_TAC `h <= &0`);; +e (NEW_GOAL `~(x IN rcone_gt u0 (u1:real^3) a)`);; +e (REWRITE_TAC[rcone_gt; rconesgn; IN; IN_ELIM_THM]);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC (REAL_ARITH `&0 <= x /\ y <= &0 ==> ~(y > x)`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DIST_POS_LE]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DIST_POS_LE]);; +e (ASM_REAL_ARITH_TAC);; + +e (REWRITE_TAC[REAL_ARITH `a * b * c <= &0 <=> &0 <= b * c * (--a)`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DIST_POS_LE]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DIST_POS_LE]);; +e (ASM_REAL_ARITH_TAC);; +e (NEW_GOAL `F`);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; + +e (ABBREV_TAC `y = inv (h) % vsum (s DELETE u0) (\v:real^3. u v % v)`);; +e (NEW_GOAL `?t. t + h = &1 /\ x = t % u0 + h % (y:real^3)`);; +e (EXISTS_TAC `&1 - h`);; +e (STRIP_TAC);; +e (REAL_ARITH_TAC);; +e (ASM_CASES_TAC `u0:real^3 IN s`);; +e (REWRITE_TAC[GSYM (ASSUME `sum s (u:real^3->real) = &1`)]);; + +e (EXPAND_TAC "h");; +e (REWRITE_WITH `sum s u = sum (u0 INSERT (s DELETE u0)) (u:real^3->real)`);; +e (REWRITE_WITH `(u0 INSERT (s DELETE u0:real^3)) = s`);; +e (ASM_SET_TAC[]);; +e (NEW_GOAL `FINITE (s DELETE u0:real^3)`);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `s:real^3->bool` THEN ASM_REWRITE_TAC[] THEN SET_TAC[]);; + +e (SIMP_TAC[Marchal_cells_2_new.SUM_CLAUSES_alt; + ASSUME `FINITE (s DELETE u0:real^3)`]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (ASM_MESON_TAC[]);; +e (REWRITE_TAC[REAL_ARITH `(a + b:real) - b = a`]);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "y");; +e (REWRITE_TAC[VECTOR_MUL_ASSOC]);; +e (REWRITE_WITH `h * inv h = &1`);; +e (NEW_GOAL `~(h = &0)`);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_SIMP_TAC[Trigonometry2.REAL_MUL_LRINV]);; +e (REWRITE_TAC[VECTOR_MUL_LID]);; +e (EXPAND_TAC "x");; + +e (REWRITE_WITH `vsum s (\v. u v % v) = + vsum (u0 INSERT (s DELETE u0)) (\v:real^3. u v % v)`);; +e (REWRITE_WITH `(u0 INSERT (s DELETE u0:real^3)) = s`);; +e (ASM_SET_TAC[]);; +e (SIMP_TAC[Marchal_cells_2_new.VSUM_CLAUSES_alt; + ASSUME `FINITE (s DELETE u0:real^3)`]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (ASM_MESON_TAC[]);; +e (REFL_TAC);; + +e (NEW_GOAL `h = &1`);; +e (EXPAND_TAC "h" THEN REWRITE_WITH `s DELETE u0:real^3 = s`);; +e (ASM_SET_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "y" THEN REWRITE_TAC[ASSUME `h = &1`]);; +e (REWRITE_WITH `s DELETE u0:real^3 = s`);; +e (ASM_SET_TAC[]);; +e (ASM_REWRITE_TAC[REAL_ARITH `inv (&1) = &1 /\ &1 - &1 = &0`]);; +e (VECTOR_ARITH_TAC);; +e (UP_ASM_TAC THEN STRIP_TAC);; + +e (NEW_GOAL `~(y:real^3 IN S)`);; +e (STRIP_TAC);; +e (NEW_GOAL `x IN aff_ge_alt {u0:real^3} S`);; +e (REWRITE_TAC[IN; aff_ge_alt; lin_combo]);; + +e (ABBREV_TAC `f = (\v:real^3. if v = u0 then t + else if v = y then h else &0)`);; +e (EXISTS_TAC `f:real^3->real`);; +e (EXISTS_TAC `{y:real^3}`);; + +e (REPEAT STRIP_TAC);; +e (REWRITE_TAC[FINITE_SING]);; +e (ASM_SET_TAC[]);; + +e (REWRITE_TAC[SET_RULE `{a} UNION {b} = {a, b}`]);; +e (REWRITE_WITH `vsum {u0:real^3, y} (\v. f v % v) = + (\v. f v % v) u0 + (\v. f v % v) y`);; +e (MATCH_MP_TAC Geomdetail.VSUM_DIS2);; +e (STRIP_TAC);; +e (NEW_GOAL `~(u0:real^3 IN S)`);; +e (EXPAND_TAC "S");; +e (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `v IN {a,b} <=> v = a \/ v = b`]);; +e (STRIP_TAC);; +e (NEW_GOAL `u0 IN voronoi_closed V (u1:real^3)`);; +e (ASM_SET_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `dist (u0,u1) <= dist (u0,u0:real^3)`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_SET_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]);; +e (MATCH_MP_TAC DIST_POS_LT);; +e (ASM_REWRITE_TAC[]);; +e (ASM_MESON_TAC[]);; + +e (REWRITE_WITH `(f:real^3->real) u0 = t`);; +e (EXPAND_TAC "f");; +e (COND_CASES_TAC);; +e (REFL_TAC);; +e (NEW_GOAL `F`);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; + +e (REWRITE_WITH `(f:real^3->real) y = h`);; +e (EXPAND_TAC "f");; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (NEW_GOAL `~(u0:real^3 IN S)`);; +e (EXPAND_TAC "S");; +e (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `v IN {a,b} <=> v = a \/ v = b`]);; +e (STRIP_TAC);; +e (NEW_GOAL `u0 IN voronoi_closed V (u1:real^3)`);; +e (ASM_SET_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `dist (u0,u1) <= dist (u0,u0:real^3)`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_SET_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]);; +e (MATCH_MP_TAC DIST_POS_LT);; +e (ASM_REWRITE_TAC[]);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; +e (COND_CASES_TAC);; +e (REFL_TAC);; +e (NEW_GOAL `F`);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; +e (ASM_REWRITE_TAC[]);; + +e (EXPAND_TAC "f");; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (NEW_GOAL `~({y:real^3} u0)`);; +e (REWRITE_WITH `~({y} u0) <=> ~(u0:real^3 IN {y})`);; +e (MESON_TAC[IN]);; +e (REWRITE_TAC[IN_SING]);; +e (STRIP_TAC);; + +e (NEW_GOAL `~(u0:real^3 IN S)`);; +e (EXPAND_TAC "S");; +e (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `v IN {a,b} <=> v = a \/ v = b`]);; +e (STRIP_TAC);; + +e (NEW_GOAL `u0 IN voronoi_closed V (u1:real^3)`);; +e (ASM_SET_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `dist (u0,u1) <= dist (u0,u0:real^3)`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_SET_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]);; +e (MATCH_MP_TAC DIST_POS_LT);; +e (ASM_REWRITE_TAC[]);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; + +e (COND_CASES_TAC);; +e (ASM_REAL_ARITH_TAC);; +e (REAL_ARITH_TAC);; + +e (REWRITE_TAC[SET_RULE `{a} UNION {b} = {a,b}`]);; +e (REWRITE_WITH `sum {u0:real^3, y} f = f u0 + f y`);; +e (MATCH_MP_TAC Geomdetail.SUM_DIS2);; +e (STRIP_TAC);; +e (NEW_GOAL `~(u0:real^3 IN S)`);; +e (EXPAND_TAC "S");; +e (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `v IN {a,b} <=> v = a \/ v = b`]);; +e (STRIP_TAC);; +e (NEW_GOAL `u0 IN voronoi_closed V (u1:real^3)`);; +e (ASM_SET_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `dist (u0,u1) <= dist (u0,u0:real^3)`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_SET_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]);; +e (MATCH_MP_TAC DIST_POS_LT);; +e (ASM_REWRITE_TAC[]);; +e (ASM_MESON_TAC[]);; + +e (REWRITE_WITH `(f:real^3->real) u0 = t`);; +e (EXPAND_TAC "f");; +e (COND_CASES_TAC);; +e (REFL_TAC);; +e (NEW_GOAL `F`);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; + +e (REWRITE_WITH `(f:real^3->real) y = h`);; +e (EXPAND_TAC "f");; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (NEW_GOAL `~(u0:real^3 IN S)`);; +e (EXPAND_TAC "S");; +e (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `v IN {a,b} <=> v = a \/ v = b`]);; +e (STRIP_TAC);; +e (NEW_GOAL `u0 IN voronoi_closed V (u1:real^3)`);; +e (ASM_SET_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `dist (u0,u1) <= dist (u0,u0:real^3)`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_SET_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]);; +e (MATCH_MP_TAC DIST_POS_LT);; +e (ASM_REWRITE_TAC[]);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; + +e (COND_CASES_TAC);; +e (REFL_TAC);; +e (NEW_GOAL `F`);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (ASM_MESON_TAC[]);; + +e (NEW_GOAL `y:real^3 IN S2`);; +e (EXPAND_TAC "S2");; +e (NEW_GOAL `y:real^3 IN S1`);; +e (NEW_GOAL `y:real^3 IN affine hull S`);; +e (REWRITE_TAC[AFFINE_HULL_EXPLICIT_ALT]);; +e (REWRITE_TAC[IN; IN_ELIM_THM]);; +e (EXISTS_TAC `s DELETE u0:real^3`);; +e (EXISTS_TAC `(\v:real^3. inv h * u v)`);; +e (REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[FINITE_DELETE]);; +e (ASM_SET_TAC[]);; +e (REWRITE_TAC[SUM_LMUL]);; +e (ASM_REWRITE_TAC[]);; +e (ASM_SIMP_TAC[Trigonometry2.REAL_MUL_LRINV; + REAL_ARITH `~(h <= &0) ==> ~(h = &0)`]);; +e (REWRITE_TAC[GSYM VECTOR_MUL_ASSOC]);; +e (ASM_SIMP_TAC[VSUM_LMUL; FINITE_DELETE]);; +e (NEW_GOAL `affine hull S1 = S1:real^3->bool`);; +e (REWRITE_TAC[AFFINE_HULL_EQ]);; +e (EXPAND_TAC "S1" THEN REWRITE_TAC[AFFINE_HYPERPLANE]);; + +e (NEW_GOAL `affine hull S SUBSET affine hull (S1:real^3->bool)`);; +e (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA);; +e (EXPAND_TAC "S");; +e (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `INTERS {f x | x IN {a, b}} = f a INTER f b`]);; +e (DEL_TAC THEN EXPAND_TAC "S1");; +e (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR);; +e (ASM_REWRITE_TAC[]);; +e (ASM_SET_TAC[]);; + +e (NEW_GOAL `relative_interior S SUBSET S:real^3->bool`);; +e (REWRITE_TAC[RELATIVE_INTERIOR_SUBSET]);; +e (ASM_SET_TAC[]);; + +e (NEW_GOAL `dist (z,u0) <= dist (y,u0:real^3)`);; +e (ONCE_REWRITE_TAC[DIST_SYM]);; +e (ASM_SIMP_TAC[]);; +e (UNDISCH_TAC `x:real^3 IN rcone_gt u0 u1 a`);; +e (REWRITE_TAC[rcone_gt; rconesgn; IN; IN_ELIM_THM]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `dist (t % u0 + h % y,u0) = h * dist (y, u0:real^3)`);; +e (REWRITE_TAC[dist]);; +e (REWRITE_WITH `(t % u0 + h % y:real^3) - u0 = (t % u0 + h % y) - (t + h) % u0`);; +e (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC);; +e (REWRITE_TAC[VECTOR_ARITH `(t % u0 + h % y) - (t + h) % u0 = h % (y - u0)`]);; +e (REWRITE_TAC[NORM_MUL]);; +e (REWRITE_WITH `abs h = h`);; +e (REWRITE_TAC[REAL_ABS_REFL]);; +e (ASM_REAL_ARITH_TAC);; + +e (REWRITE_TAC[REAL_ARITH `~(a > b) <=> a <= b`]);; +e (REWRITE_WITH `h * dist (p,u0:real^3) * dist (u1,u0) = + (h * dist (z,u0)) * dist (u1,u0) * a`);; +e (EXPAND_TAC "a");; +e (REWRITE_TAC[REAL_ARITH `(a * b) * c * d / b = (a * d * c) * (b / b)`]);; +e (REWRITE_WITH `dist (z,u0) / dist (z,u0:real^3) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (REWRITE_TAC[DIST_EQ_0]);; +e (STRIP_TAC);; + +e (NEW_GOAL `~(u0:real^3 IN S1)`);; +e (EXPAND_TAC "S1" THEN REWRITE_TAC[IN; IN_ELIM_THM; NORM_POW_2]);; +e (REWRITE_TAC[REAL_ARITH `a = b - c <=> a + c - b = &0`]);; +e (REWRITE_TAC[VECTOR_ARITH `&2 % (u0 - u1) dot u0 + u1 dot u1 - u0 dot u0 = + (u0 - u1) dot (u0 - u1)`]);; +e (REWRITE_TAC[DOT_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `z:real^3 IN S1`);; +e (ASM_SET_TAC[]);; +e (ASM_MESON_TAC[]);; + +e (REAL_ARITH_TAC);; +e (REWRITE_TAC[REAL_ARITH + `(a * x) * b * c <= (a * y) * b * c <=> &0 <= a * b * c *(y - x)`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (STRIP_TAC);; +e (ASM_REAL_ARITH_TAC);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DIST_POS_LE]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (STRIP_TAC);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; + +e (UP_ASM_TAC THEN STRIP_TAC);; + +(* OK until here *) +(* ========================================================================= *) + +e (ABBREV_TAC `W = aff_ge_alt {u0:real^3} S`);; +e (ABBREV_TAC `c = max b (hl[u0;u1:real^3] / sqrt (&2))`);; +e (NEW_GOAL `&0 < c /\ c < &1`);; +e (EXPAND_TAC "c" THEN REWRITE_TAC[REAL_LT_MAX]);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "c" THEN REWRITE_TAC[REAL_MAX_LT]);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `hl [u0; u1:real^3] / sqrt (&2) < &1 <=> + hl [u0; u1] < &1 * sqrt (&2)`);; +e (MATCH_MP_TAC REAL_LT_LDIV_EQ);; +e (ASM_SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]);; +e (ASM_REAL_ARITH_TAC);; + +e (NEW_GOAL `rcone_gt u0 u1 c SUBSET + W INTER (rcone_gt u0 u1 (hl [u0; u1:real^3] / sqrt (&2)))`);; +e (REWRITE_TAC[SUBSET_INTER]);; +e (STRIP_TAC);; +e (NEW_GOAL `rcone_gt (u0:real^3) u1 c SUBSET rcone_gt u0 u1 b`);; +e (MATCH_MP_TAC RCONE_GT_SUBSET);; +e (EXPAND_TAC "c" THEN REAL_ARITH_TAC);; +e (ASM_SET_TAC[]);; +e (MATCH_MP_TAC RCONE_GT_SUBSET);; +e (EXPAND_TAC "c" THEN REAL_ARITH_TAC);; + +e (ABBREV_TAC `C = ball (u0:real^3,&1) INTER rcone_gt u0 u1 c`);; +e (NEW_GOAL `C SUBSET + UNIONS + {rogers V vl | vl | barV V 3 vl /\ truncate_simplex 1 vl = [u0; u1]}`);; +e (REWRITE_TAC[SUBSET]);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `x IN ball (u0:real^3,&1) /\ x IN aff_ge_alt {u0} S`);; +e (ASM_SET_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; + +e (NEW_GOAL `(x:real^3) IN convex hull (u0 INSERT S)`);; +e (REWRITE_TAC[CONVEX_HULL_EXPLICIT; IN; IN_ELIM_THM]);; + +e (UP_ASM_TAC THEN REWRITE_TAC[IN; aff_ge_alt; lin_combo]);; +e (REPEAT STRIP_TAC);; +e (EXISTS_TAC `{u0:real^3} UNION q`);; +e (EXISTS_TAC `f:real^3->real`);; +e (REPEAT STRIP_TAC);; +e (REWRITE_TAC[SET_RULE `{a} UNION b = a INSERT b`; FINITE_INSERT]);; +e (ASM_REWRITE_TAC[]);; +e (ASM_SET_TAC[]);; +e (ASM_CASES_TAC `x':real^3 IN q`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[IN]);; +e (REWRITE_WITH `x' = u0:real^3`);; +e (NEW_GOAL `x' IN ({u0:real^3} UNION q)`);; +e (ASM_REWRITE_TAC[IN]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[REAL_ARITH `&0 <= x <=> ~(x < &0)`]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `x IN ball (u0:real^3,&1)`);; +e (ASM_REWRITE_TAC[IN_BALL; SET_RULE `{u} UNION q = u INSERT (q DELETE u)`]);; +e (REWRITE_WITH `vsum (u0 INSERT (q DELETE u0:real^3)) (\v. f v % v) = + (if u0 IN (q DELETE u0) then vsum (q DELETE u0) (\v. f v % v) + else (\v. f v % v) u0 + vsum (q DELETE u0) (\v. f v % v))`);; +e (MATCH_MP_TAC Marchal_cells_2_new.VSUM_CLAUSES_alt);; +e (ASM_REWRITE_TAC[FINITE_DELETE]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (ASM_MESON_TAC[]);; +e (ONCE_REWRITE_TAC[DIST_SYM]);; +e (REWRITE_TAC[dist]);; +e (REWRITE_WITH `!a. a - u0 = a - (sum ({u0:real^3} UNION q) f) % u0`);; +e (ASM_REWRITE_TAC[]);; +e (VECTOR_ARITH_TAC);; + +e (NEW_GOAL `sum ({u0} UNION q) f = f u0 + sum (q DELETE u0:real^3) f`);; +e (REWRITE_TAC[SET_RULE `{u} UNION q = u INSERT (q DELETE u)`]);; +e (REWRITE_WITH `sum (u0 INSERT (q DELETE u0:real^3)) f = + (if u0 IN (q DELETE u0) then sum (q DELETE u0) f + else f u0 + sum (q DELETE u0) f)`);; +e (MATCH_MP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt);; +e (ASM_REWRITE_TAC[FINITE_DELETE]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (ASM_MESON_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[VECTOR_ADD_RDISTRIB; + VECTOR_ARITH `(a + b) - (a + c:real^3) = b - c`; + ASSUME `sum ({u0} UNION q) f = f u0 + sum (q DELETE u0:real^3) f`; ]);; +e (ABBREV_TAC `h = sum (q DELETE u0:real^3) f`);; +e (ABBREV_TAC `y = inv (h) % vsum (q DELETE u0) (\v:real^3. f v % v)`);; +e (NEW_GOAL `h > &1`);; +e (ASM_REAL_ARITH_TAC);; +e (REWRITE_WITH `vsum (q DELETE u0) (\v. f v % v) = h % y:real^3`);; +e (EXPAND_TAC "y");; +e (REWRITE_TAC[VECTOR_MUL_ASSOC]);; +e (REWRITE_WITH `h * inv h = &1`);; +e (ASM_SIMP_TAC [Trigonometry2.REAL_MUL_LRINV; REAL_ARITH `h > &1 ==> ~(h = &0)`]);; +e (VECTOR_ARITH_TAC);; +e (REWRITE_TAC[VECTOR_ARITH `h % a - h % b = h % (a - b)`; NORM_MUL]);; +e (REWRITE_TAC[REAL_ARITH `~(a < b) <=> b <= a`]);; + +e (NEW_GOAL `norm (p - u0) <= norm (y - u0:real^3)`);; +e (MATCH_MP_TAC Tactics_jordan.REAL_POW_2_LE);; +e (REWRITE_TAC[NORM_POS_LE]);; +e (REWRITE_WITH + `norm (y - u0) pow 2 = norm (p - u0) pow 2 + norm (y - p:real^3) pow 2`);; +e (MATCH_MP_TAC PYTHAGORAS);; +e (REWRITE_TAC[orthogonal]);; +e (REWRITE_WITH `p = circumcenter (set_of_list [u0;u1:real^3])`);; +e (ASM_REWRITE_TAC[set_of_list]);; +e (ONCE_REWRITE_TAC[DOT_SYM]);; +e (MATCH_MP_TAC Rogers.MHFTTZN4);; +e (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`);; +e (REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[ASSUME `voronoi_list V [u0; u1] = S`]);; +e (REWRITE_TAC[AFFINE_HULL_EXPLICIT_ALT; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `q DELETE u0:real^3`);; +e (EXISTS_TAC `(\v:real^3. inv h * f v)`);; +e (REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[FINITE_DELETE]);; +e (ASM_SET_TAC[]);; +e (ASM_REWRITE_TAC[SUM_LMUL]);; +e (ASM_SIMP_TAC [Trigonometry2.REAL_MUL_LRINV; REAL_ARITH `h > &1 ==> ~(h = &0)`]);; +e (REWRITE_TAC[GSYM VECTOR_MUL_ASSOC]);; +e (ASM_REWRITE_TAC[VSUM_LMUL]);; + +e (REWRITE_TAC[set_of_list]);; +e (NEW_GOAL `{u0, u1:real^3} SUBSET affine hull {u0, u1}`);; +e (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]);; +e (ASM_SET_TAC[]);; +e (REWRITE_TAC[REAL_ARITH `a <= a + b <=> &0 <= b`; NORM_POW_2; DOT_POS_LE]);; + +e (NEW_GOAL `&1 <= norm (p - u0:real^3)`);; +e (EXPAND_TAC "p");; +e (REWRITE_TAC[CIRCUMCENTER_2; midpoint; + VECTOR_ARITH `inv (&2) % (u0 + u1) - u0 = inv (&2) % (u1 - u0)`; + NORM_MUL; REAL_ARITH `abs (inv(&2)) = inv (&2)`]);; +e (REWRITE_TAC[GSYM dist]);; +e (REWRITE_WITH `&1 = inv (&2) * &2`);; +e (REAL_ARITH_TAC);; +e (REWRITE_TAC[REAL_ARITH `inv (&2) * &2 <= inv (&2) * a <=> &2 <= a`]);; +e (MP_TAC (ASSUME `packing (V:real^3->bool)`));; +e (REWRITE_TAC[packing] THEN STRIP_TAC);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]);; +e (REWRITE_WITH `abs h = h`);; +e (ASM_REAL_ARITH_TAC);; + +e (NEW_GOAL `h <= h * norm (y - u0:real^3)`);; +e (REWRITE_TAC[REAL_ARITH `h <= h * a <=> &0 <= h * (a - &1)`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; + +e (ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `~(S:real^3->bool = {})`);; +e (STRIP_TAC);; +e (NEW_GOAL `~(aff_dim (u0:real^3 INSERT S) = &3)`);; +e (REWRITE_TAC[ASSUME `S:real^3->bool = {}`; AFF_DIM_SING]);; +e (ARITH_TAC);; +e (ASM_MESON_TAC[]);; +e (SWITCH_TAC);; +e (UP_ASM_TAC THEN SIMP_TAC[CONVEX_HULL_INSERT; + ASSUME `~(S:real^3->bool = {})`]);; +e (REWRITE_WITH `convex hull S = S:real^3->bool`);; +e (REWRITE_TAC[CONVEX_HULL_EQ]);; +e (EXPAND_TAC "S" THEN REWRITE_TAC[Packing3.CONVEX_VORONOI_LIST]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[IN_UNIONS; IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; + +e (EXISTS_TAC `rogers V vl`);; +e (REPEAT STRIP_TAC);; +e (EXISTS_TAC `vl:(real^3)list`);; +e (ASM_REWRITE_TAC[]);; + +e (ASM_SIMP_TAC[Marchal_cells_2.ROGERS_EXPLICIT]);; +e (REWRITE_TAC[CONVEX_HULL_4; IN_ELIM_THM]);; + +e (UNDISCH_TAC `(t:real^3->bool) b'`);; +e (ASM_REWRITE_TAC[CONVEX_HULL_3; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; + +e (EXISTS_TAC `u:real`);; +e (EXISTS_TAC `v * u'`);; +e (EXISTS_TAC `v * v'`);; +e (EXISTS_TAC `v * w`);; +e (ASM_SIMP_TAC[REAL_LE_MUL]);; +e (STRIP_TAC);; + +e (REWRITE_TAC[REAL_ARITH `u + v * u' + v * v' + v * w = u + v * (u' + v' +w)`]);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REAL_ARITH_TAC);; + +e (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX);; +e (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ CARD (set_of_list vl) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool`);; +e (ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; + +e (ASM_REWRITE_TAC[HD]);; +e (VECTOR_ARITH_TAC);; + +(* ========================================================================== *) + +e (NEW_GOAL + `!X. mcell_set V X /\ ~NULLSET (X INTER C) + ==> (?k vl. + 2 <= k /\ + barV V 3 vl /\ + X = mcell k V vl /\ + truncate_simplex 1 vl = [u0; u1])`);; + +e (REWRITE_TAC[mcell_set_2; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; + +e (NEW_GOAL `~NULLSET (X INTER UNIONS + {rogers V vl | vl | barV V 3 vl /\ truncate_simplex 1 vl = [u0; u1]})`);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER C)`);; +e (REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X INTER + UNIONS + {rogers V vl | vl | barV V 3 vl /\ truncate_simplex 1 vl = [u0; u1]}`);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ASM_SET_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[INTER_UNIONS]);; +e (STRIP_TAC);; + +e (NEW_GOAL + `!s. ~NULLSET (UNIONS s) /\ FINITE s ==> (?t. t IN s /\ ~NULLSET t)`);; +e (MESON_TAC[NEGLIGIBLE_UNIONS]);; +e (ABBREV_TAC `St = {X INTER x | x IN + {rogers V vl | vl | barV V 3 vl /\ + truncate_simplex 1 vl = [u0; u1]}}`);; +e (NEW_GOAL `?t. t IN St /\ ~NULLSET t`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "St");; +e (ABBREV_TAC `Sr = {rogers V vl | vl | barV V 3 vl /\ + truncate_simplex 1 vl = [u0; u1]}`);; +e (ABBREV_TAC `f = (\x:real^3->bool. X INTER x)`);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `{y:real^3->bool | ?x:real^3->bool. x IN Sr /\ y = f x }`);; +e (STRIP_TAC);; + +e (MATCH_MP_TAC FINITE_IMAGE_EXPAND);; +e (ABBREV_TAC `Ss = {vl | barV V 3 vl /\ truncate_simplex 1 vl = [u0; u1]}`);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `{y | ?vl. vl IN Ss /\ y = rogers V vl}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC FINITE_IMAGE_EXPAND);; +e (ABBREV_TAC `Sx = V INTER ball (u0:real^3, &4)`);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `{y | ?u0 u1 u2 u3:real^3. + u0 IN Sx /\ + u1 IN Sx /\ + u2 IN Sx /\ + u3 IN Sx /\ + y = [u0; u1; u2; u3]}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC Ajripqn.FINITE_SET_LIST_LEMMA);; +e (EXPAND_TAC "Sx");; +e (MATCH_MP_TAC Pack2.KIUMVTC);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "Ss");; +e (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; + +e (NEW_GOAL `?v0 v1 v2 v3. x = [v0;v1;v2;v3:real^3]`);; +e (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (EXISTS_TAC `v0:real^3`);; +e (EXISTS_TAC `v1:real^3`);; +e (EXISTS_TAC `v2:real^3`);; +e (EXISTS_TAC `v3:real^3`);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `{v0, v1, v2, v3:real^3} SUBSET Sx`);; +e (EXPAND_TAC "Sx");; +e (REWRITE_TAC[SUBSET_INTER]);; +e (REWRITE_WITH `{v0, v1, v2, v3:real^3} = set_of_list x`);; +e (ASM_REWRITE_TAC[set_of_list]);; +e (STRIP_TAC);; +e (MATCH_MP_TAC Packing3.BARV_SUBSET);; +e (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2);; +e (EXISTS_TAC `V:real^3->bool`);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `HD (truncate_simplex 1 x) = u0:real^3`);; +e (ASM_REWRITE_TAC[HD]);; +e (NEW_GOAL `HD (truncate_simplex 1 x) = v0:real^3`);; +e (REWRITE_TAC[ASSUME `x = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]);; + +e (REWRITE_WITH `u0 = v0:real^3`);; +e (ASM_MESON_TAC[]);; +e (REWRITE_TAC[set_of_list] THEN SET_TAC[]);; +e (UP_ASM_TAC THEN SET_TAC[]);; + +e (EXPAND_TAC "Sr" THEN EXPAND_TAC "Ss");; +e (SET_TAC[]);; +e (REWRITE_WITH `{X INTER x:real^3->bool | x IN Sr} = {f x | x IN Sr}`);; +e (EXPAND_TAC "f");; +e (REFL_TAC);; +e (SET_TAC[]);; +e (UP_ASM_TAC THEN EXPAND_TAC "St" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; + +e (NEW_GOAL `x SUBSET UNIONS {mcell i V vl | i <= 4}`);; +e (ASM_REWRITE_TAC[SUBSET; IN_UNIONS; IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `?i. i <= 4 /\ x' IN mcell i V vl`);; +e (MATCH_MP_TAC Sltstlo.SLTSTLO1);; +e (ASM_REWRITE_TAC[IN]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (EXISTS_TAC `mcell i' V vl`);; +e (STRIP_TAC);; +e (EXISTS_TAC `i':num` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[IN]);; + +e (NEW_GOAL `~NULLSET (X INTER UNIONS {mcell i V vl | i <= 4})`);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (t)`);; +e (REWRITE_TAC[ASSUME `t:real^3->bool = X INTER x`]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X INTER UNIONS {mcell i V vl | i <= 4}`);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ASM_SET_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[INTER_UNIONS]);; +e (STRIP_TAC);; + +e (NEW_GOAL + `!s. ~NULLSET (UNIONS s) /\ FINITE s ==> (?t. t IN s /\ ~NULLSET t)`);; +e (MESON_TAC[NEGLIGIBLE_UNIONS]);; +e (ABBREV_TAC `Sx = {X INTER x | x IN {mcell i V vl | i <= 4}}`);; +e (NEW_GOAL `?t. t IN Sx /\ ~NULLSET t`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "Sx");; +e (ABBREV_TAC `Sy = {mcell i V vl | i <= 4}`);; +e (ABBREV_TAC `f = (\x:real^3->bool. X INTER x)`);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `{y:real^3->bool | ?x:real^3->bool. x IN Sy /\ y = f x }`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC FINITE_IMAGE_EXPAND);; +e (EXPAND_TAC "Sy");; +e (REWRITE_TAC[GSYM IN_NUMSEG_0]);; +e (ABBREV_TAC `g = (\i:num. mcell i V vl)`);; +e (REWRITE_WITH `{mcell i V vl | i IN 0..4} = {g i | i IN 0..4}`);; +e (EXPAND_TAC "g" THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `{y:real^3->bool | ?i. i IN 0..4 /\ y = g i}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC FINITE_IMAGE_EXPAND);; +e (REWRITE_TAC[FINITE_NUMSEG]);; +e (SET_TAC[]);; +e (REWRITE_WITH `{X INTER x:real^3->bool | x IN Sy} = {f x | x IN Sy}`);; +e (EXPAND_TAC "f" THEN REWRITE_TAC[]);; +e (SET_TAC[]);; +e (UP_ASM_TAC THEN EXPAND_TAC "Sx" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; + +(* ========================================================================= *) + +e (NEW_GOAL `i = i' /\ mcell i V ul = mcell i' V vl`);; +e (MATCH_MP_TAC Ajripqn.AJRIPQN);; +e (ASM_REWRITE_TAC[GSYM Ajripqn.UP_TO_4_KY_LEMMA]);; +e (REPEAT STRIP_TAC);; +e (UNDISCH_TAC `ul IN barV V 3` THEN REWRITE_TAC[IN]);; +e (UNDISCH_TAC `~NULLSET t'`);; +e (ASM_REWRITE_TAC[]);; +e (EXISTS_TAC `i:num` THEN EXISTS_TAC `vl:(real^3)list`);; +e (ASM_REWRITE_TAC[]);; + +(* ========================================================================= *) + +e (ASM_CASES_TAC `i' = 0`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET (X INTER C)`);; +e (REWRITE_TAC[]);; +e (REWRITE_WITH `X INTER C = {}:real^3->bool`);; +e (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell0]);; +e (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX);; +e (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ CARD (set_of_list vl) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool`);; +e (ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; +e (ASM_REWRITE_TAC[HD]);; +e (NEW_GOAL `C SUBSET ball (u0:real^3, sqrt (&2))`);; +e (NEW_GOAL `ball (u0:real^3, &1) SUBSET ball (u0, sqrt (&2))`);; +e (MATCH_MP_TAC SUBSET_BALL);; +e (MATCH_MP_TAC (REAL_ARITH `a < b ==> a <= b`));; +e (REWRITE_TAC[Marchal_cells_2_new.ZERO_LT_SQRT_2]);; +e (ASM_SET_TAC[]);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (ASM_MESON_TAC[]);; + +e (ASM_CASES_TAC `i' = 1`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET (X INTER C)`);; +e (REWRITE_TAC[]);; +e (REWRITE_WITH `X INTER C = {}:real^3->bool`);; +e (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell1]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`);; +e (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (ASM_REWRITE_TAC[HD; TL]);; + +e (REWRITE_WITH `v0 = u0:real^3`);; +e (NEW_GOAL `HD (truncate_simplex 1 vl) = u0:real^3`);; +e (ASM_REWRITE_TAC[HD]);; +e (NEW_GOAL `HD (truncate_simplex 1 vl) = v0:real^3`);; +e (REWRITE_TAC[ASSUME `vl = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]);; +e (ASM_MESON_TAC[]);; + +e (REWRITE_WITH `v1 = u1:real^3`);; +e (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = u1:real^3`);; +e (ASM_REWRITE_TAC[HD; TL]);; +e (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = v1:real^3`);; +e (REWRITE_TAC[ASSUME `vl = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]);; +e (ASM_MESON_TAC[]);; + +e (NEW_GOAL `C SUBSET (rcone_gt u0 u1 (hl [u0:real^3; u1] / sqrt (&2)))`);; +e (EXPAND_TAC "C");; +e (SET_TAC[ASSUME `rcone_gt u0 u1 c SUBSET + W INTER rcone_gt u0 u1 (hl [u0:real^3; u1] / sqrt (&2))`]);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (SET_TAC[]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (ASM_ARITH_TAC);; + +(* ========================================================================= *) + +e (ABBREV_TAC `f1 = + (\ul. dist (u0:real^3, + closest_point (affine hull {u1, EL 2 ul, mxi V ul}) u0))`);; + +e (ABBREV_TAC `P1 = { (f1:(real^3)list->real) ul |ul | barV V 3 ul /\ + ~NULLSET (mcell 3 V ul INTER C) /\ + truncate_simplex 1 ul = [u0; u1]}`);; + +e (NEW_GOAL `~(P1 = {}) ==> (?b:real. b IN P1 /\ (!x. x IN P1 ==> b <= x))`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC INF_FINITE_LEMMA);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "P1");; +e (ONCE_REWRITE_TAC [SET_RULE `{f x| x | P x} = {f x | x IN {y | P y}}`]);; +e (ONCE_REWRITE_TAC [SET_RULE `{f x| x IN s} = {y | ?x. x IN s /\ y = f x}`]);; +e (MATCH_MP_TAC FINITE_IMAGE_EXPAND);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `{y | ?v0:real^3 v1 u2 u3. + v0 IN (V INTER ball (u0:real^3, &4)) /\ + v1 IN (V INTER ball (u0, &4)) /\ + u2 IN (V INTER ball (u0, &4)) /\ + u3 IN (V INTER ball (u0, &4)) /\ + y = [v0; v1; u2; u3]}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC FINITE_SET_LIST_LEMMA);; +e (ASM_SIMP_TAC[FINITE_PACK_LEMMA]);; +e (REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `?v0 v1 u2 u3. x = [v0; v1; u2; u3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (EXISTS_TAC `v0:real^3` THEN EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `v0 = u0:real^3`);; +e (REWRITE_WITH `v0 = HD (x:(real^3)list)`);; +e (ASM_REWRITE_TAC[HD]);; +e (REWRITE_WITH `u0 = HD (truncate_simplex 1 (x:(real^3)list))`);; +e (ASM_REWRITE_TAC[HD]);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX);; +e (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (NEW_GOAL `set_of_list x SUBSET ball (u0:real^3,&4)`);; +e (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2);; +e (EXISTS_TAC `V:real^3->bool`);; +e (ASM_REWRITE_TAC[set_of_list]);; +e (SET_TAC[]);; +e (NEW_GOAL `set_of_list x SUBSET V:real^3->bool`);; +e (MATCH_MP_TAC Packing3.BARV_SUBSET);; +e (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]);; +e (SET_TAC[]);; + +e (ABBREV_TAC `r1 = (if (P1 = {}:real->bool) then &1 + else (@b. b IN P1 /\ (!x. x IN P1 ==> b <= x)))`);; +e (NEW_GOAL `&0 < r1`);; +e (EXPAND_TAC "r1");; +e (COND_CASES_TAC);; +e (REAL_ARITH_TAC);; +e (NEW_GOAL `?b:real. b IN P1 /\ (!x. x IN P1 ==> b <= x)`);; +e (ASM_SIMP_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (ABBREV_TAC `P = (\b:real. b IN P1 /\ (!x. x IN P1 ==> b <= x))`);; +e (ABBREV_TAC `zz = (@) (P:real->bool)`);; +e (NEW_GOAL `(P:real->bool) zz`);; +e (EXPAND_TAC "zz");; +e (MATCH_MP_TAC SELECT_AX);; +e (EXISTS_TAC `b':real`);; +e (EXPAND_TAC "P" THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN EXPAND_TAC "P" THEN REWRITE_TAC[]);; +e (EXPAND_TAC "P1" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "f1");; +e (MATCH_MP_TAC DIST_POS_LT);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (REWRITE_WITH `closest_point (affine hull {u1, EL 2 ul, mxi V ul}) u0 = u0 + <=> u0 IN (affine hull {u1:real^3, EL 2 ul, mxi V ul})`);; +e (MATCH_MP_TAC CLOSEST_POINT_REFL);; +e (REWRITE_TAC[CLOSED_AFFINE_HULL]);; +e (REWRITE_TAC[AFFINE_HULL_EQ_EMPTY] THEN SET_TAC[]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (mcell 3 V ul INTER C)`);; +e (REWRITE_TAC[] THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `mcell 3 V ul`);; +e (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]);; +e (REWRITE_TAC[MCELL_EXPLICIT; mcell3]);; +e (COND_CASES_TAC);; + +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`);; +e (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]);; + +e (REWRITE_WITH `v0 = u0:real^3`);; +e (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`);; +e (ASM_REWRITE_TAC[HD]);; +e (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`);; +e (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]);; +e (ASM_MESON_TAC[]);; + +e (REWRITE_WITH `v1 = u1:real^3`);; +e (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`);; +e (ASM_REWRITE_TAC[HD; TL]);; +e (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`);; +e (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]);; +e (REWRITE_TAC[SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, v2, mxi V [u0; u1; v2; v3]}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (REWRITE_WITH `affine hull {u0, u1, v2, mxi V [u0; u1; v2; v3]} = + affine hull {u1, v2, mxi V [u0; u1; v2; v3]}`);; +e (MATCH_MP_TAC AFFINE_HULL_3_INSERT);; +e (REWRITE_WITH `affine hull {u1, v2, mxi V [u0; u1; v2; v3]} = + affine hull {u1, EL 2 ul, mxi V ul}`);; +e (ASM_REWRITE_TAC[EL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`; HD; TL]);; + +e (REWRITE_WITH `v0 = u0:real^3`);; +e (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`);; +e (ASM_REWRITE_TAC[HD]);; +e (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`);; +e (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]);; +e (ASM_MESON_TAC[]);; + +e (REWRITE_WITH `v1 = u1:real^3`);; +e (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`);; +e (ASM_REWRITE_TAC[HD; TL]);; +e (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`);; +e (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; + +(* ========================================================================= *) + +e (ABBREV_TAC `f2 = + (\ul. dist (u0:real^3, + closest_point (affine hull {u1, EL 2 ul, EL 3 ul}) u0))`);; + +e (ABBREV_TAC `P2 = { (f2:(real^3)list->real) ul |ul | barV V 3 ul /\ + ~NULLSET (mcell 4 V ul INTER C) /\ + truncate_simplex 1 ul = [u0; u1]}`);; + +e (NEW_GOAL `~(P2 = {}) ==> (?b:real. b IN P2 /\ (!x. x IN P2 ==> b <= x))`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC INF_FINITE_LEMMA);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "P2");; +e (ONCE_REWRITE_TAC [SET_RULE `{f x| x | P x} = {f x | x IN {y | P y}}`]);; +e (ONCE_REWRITE_TAC [SET_RULE `{f x| x IN s} = {y | ?x. x IN s /\ y = f x}`]);; +e (MATCH_MP_TAC FINITE_IMAGE_EXPAND);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `{y | ?v0:real^3 v1 u2 u3. + v0 IN (V INTER ball (u0:real^3, &4)) /\ + v1 IN (V INTER ball (u0, &4)) /\ + u2 IN (V INTER ball (u0, &4)) /\ + u3 IN (V INTER ball (u0, &4)) /\ + y = [v0; v1; u2; u3]}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC FINITE_SET_LIST_LEMMA);; +e (ASM_SIMP_TAC[FINITE_PACK_LEMMA]);; +e (REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `?v0 v1 u2 u3. x = [v0; v1; u2; u3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (EXISTS_TAC `v0:real^3` THEN EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `v0 = u0:real^3`);; +e (REWRITE_WITH `v0 = HD (x:(real^3)list)`);; +e (ASM_REWRITE_TAC[HD]);; +e (REWRITE_WITH `u0 = HD (truncate_simplex 1 (x:(real^3)list))`);; +e (ASM_REWRITE_TAC[HD]);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX);; +e (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (NEW_GOAL `set_of_list x SUBSET ball (u0:real^3,&4)`);; +e (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2);; +e (EXISTS_TAC `V:real^3->bool`);; +e (ASM_REWRITE_TAC[set_of_list]);; +e (SET_TAC[]);; +e (NEW_GOAL `set_of_list x SUBSET V:real^3->bool`);; +e (MATCH_MP_TAC Packing3.BARV_SUBSET);; +e (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]);; +e (SET_TAC[]);; + +e (ABBREV_TAC `r2 = (if (P2 = {}:real->bool) then &1 + else (@b. b IN P2 /\ (!x. x IN P2 ==> b <= x)))`);; + +e (NEW_GOAL `&0 < r2`);; +e (EXPAND_TAC "r2");; +e (COND_CASES_TAC);; +e (REAL_ARITH_TAC);; +e (NEW_GOAL `?b:real. b IN P2 /\ (!x. x IN P2 ==> b <= x)`);; +e (ASM_SIMP_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (ABBREV_TAC `P = (\b:real. b IN P2 /\ (!x. x IN P2 ==> b <= x))`);; +e (ABBREV_TAC `zz = (@) (P:real->bool)`);; +e (NEW_GOAL `(P:real->bool) zz`);; +e (EXPAND_TAC "zz");; +e (MATCH_MP_TAC SELECT_AX);; +e (EXISTS_TAC `b':real`);; +e (EXPAND_TAC "P" THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN EXPAND_TAC "P" THEN REWRITE_TAC[]);; +e (EXPAND_TAC "P2" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "f2");; +e (MATCH_MP_TAC DIST_POS_LT);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (REWRITE_WITH `closest_point (affine hull {u1, EL 2 ul, EL 3 ul}) u0 = u0 + <=> u0 IN (affine hull {u1:real^3, EL 2 ul, EL 3 ul})`);; +e (MATCH_MP_TAC CLOSEST_POINT_REFL);; +e (REWRITE_TAC[CLOSED_AFFINE_HULL]);; +e (REWRITE_TAC[AFFINE_HULL_EQ_EMPTY] THEN SET_TAC[]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (mcell 4 V ul INTER C)`);; +e (REWRITE_TAC[] THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `mcell 4 V ul`);; +e (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]);; +e (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4]);; +e (COND_CASES_TAC);; + +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`);; +e (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (ASM_REWRITE_TAC[set_of_list]);; + +e (REWRITE_WITH `v0 = u0:real^3`);; +e (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`);; +e (ASM_REWRITE_TAC[HD]);; +e (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`);; +e (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]);; + +e (REWRITE_WITH `v1 = u1:real^3`);; +e (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`);; +e (ASM_REWRITE_TAC[HD; TL]);; +e (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`);; +e (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, v2, v3:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (REWRITE_WITH `affine hull {u0, u1, v2, v3:real^3} = + affine hull {u1, v2, v3}`);; +e (MATCH_MP_TAC AFFINE_HULL_3_INSERT);; +e (REWRITE_WITH `affine hull {u1, v2, v3:real^3} = + affine hull {u1, EL 2 ul, EL 3 ul}`);; +e (ASM_REWRITE_TAC[EL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; HD; TL]);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; + +(* ========================================================================= *) + +e (ABBREV_TAC `r = min (&1) (min r1 r2)`);; +e (NEW_GOAL `&0 < r`);; +e (EXPAND_TAC "r");; +e (UNDISCH_TAC `&0 < r1` THEN UNDISCH_TAC `&0 < r2` THEN REAL_ARITH_TAC);; + +(* ========================================================================= *) + +e (ABBREV_TAC `f3 = + (\ul. (((smallest_angle_line (EL 2 ul) (mxi V ul) u0 u1) - u0) + dot (u1 - u0)) / + (norm ((smallest_angle_line (EL 2 ul) (mxi V ul) u0 u1) - u0) + * norm (u1 - u0)))`);; + +e (ABBREV_TAC `P3 = {(f3:(real^3)list->real) ul |ul | barV V 3 ul /\ + ~NULLSET (mcell 3 V ul INTER C) /\ + truncate_simplex 1 ul = [u0; u1]}`);; + +e (NEW_GOAL `~(P3 = {}) ==> (?b:real. b IN P3 /\ (!x. x IN P3 ==> x <= b))`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC SUP_FINITE_LEMMA);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "P3");; +e (ONCE_REWRITE_TAC [SET_RULE `{f x| x | P x} = {f x | x IN {y | P y}}`]);; +e (ONCE_REWRITE_TAC [SET_RULE `{f x| x IN s} = {y | ?x. x IN s /\ y = f x}`]);; +e (MATCH_MP_TAC FINITE_IMAGE_EXPAND);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `{y | ?v0:real^3 v1 u2 u3. + v0 IN (V INTER ball (u0:real^3, &4)) /\ + v1 IN (V INTER ball (u0, &4)) /\ + u2 IN (V INTER ball (u0, &4)) /\ + u3 IN (V INTER ball (u0, &4)) /\ + y = [v0; v1; u2; u3]}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC FINITE_SET_LIST_LEMMA);; +e (ASM_SIMP_TAC[FINITE_PACK_LEMMA]);; +e (REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `?v0 v1 u2 u3. x = [v0; v1; u2; u3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (EXISTS_TAC `v0:real^3` THEN EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `v0 = u0:real^3`);; +e (REWRITE_WITH `v0 = HD (x:(real^3)list)`);; +e (ASM_REWRITE_TAC[HD]);; +e (REWRITE_WITH `u0 = HD (truncate_simplex 1 (x:(real^3)list))`);; +e (ASM_REWRITE_TAC[HD]);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX);; +e (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (NEW_GOAL `set_of_list x SUBSET ball (u0:real^3,&4)`);; +e (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2);; +e (EXISTS_TAC `V:real^3->bool`);; +e (ASM_REWRITE_TAC[set_of_list]);; +e (SET_TAC[]);; +e (NEW_GOAL `set_of_list x SUBSET V:real^3->bool`);; +e (MATCH_MP_TAC Packing3.BARV_SUBSET);; +e (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]);; +e (SET_TAC[]);; + +e (ABBREV_TAC `d1 = (if (P3 = {}:real->bool) then c + else (@b. b IN P3 /\ (!x. x IN P3 ==> x <= b)))`);; + +e (NEW_GOAL `d1 < &1`);; +e (EXPAND_TAC "d1");; +e (COND_CASES_TAC);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `?b:real. b IN P3 /\ (!x. x IN P3 ==> x <= b)`);; +e (ASM_SIMP_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (ABBREV_TAC `P = (\b:real. b IN P3 /\ (!x. x IN P3 ==> x <= b))`);; +e (ABBREV_TAC `zz = (@) (P:real->bool)`);; +e (NEW_GOAL `(P:real->bool) zz`);; +e (EXPAND_TAC "zz");; +e (MATCH_MP_TAC SELECT_AX);; +e (EXISTS_TAC `b':real`);; +e (EXPAND_TAC "P" THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN EXPAND_TAC "P" THEN REWRITE_TAC[]);; +e (EXPAND_TAC "P3" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "f3");; + +e (ABBREV_TAC `xx = smallest_angle_line (EL 2 ul) (mxi V ul) u0 u1`);; +e (MATCH_MP_TAC REAL_DIV_LT_1_TACTICS);; +e (STRIP_TAC);; +e (MATCH_MP_TAC (REAL_ARITH `&0 <= a /\ ~(a = &0) ==> &0 < a`));; +e (STRIP_TAC);; +e (SIMP_TAC[REAL_LE_MUL; NORM_POS_LE]);; +e (REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "xx");; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN + REWRITE_TAC[smallest_angle_line; smallest_angle_set]);; +e (STRIP_TAC);; +e (ABBREV_TAC `Q = (\x:real^3. x IN convex hull {EL 2 ul, mxi V ul} /\ + (!y. y IN convex hull {EL 2 ul, mxi V ul} + ==> ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0))))`);; +e (NEW_GOAL `(Q:real^3->bool) u0`);; +e (REWRITE_TAC[ASSUME `u0 = (@) (Q:real^3->bool)`]);; +e (MATCH_MP_TAC SELECT_AX);; +e (EXPAND_TAC "Q");; +e (MATCH_MP_TAC SMALLEST_ANGLE_LINE_EXISTS);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `?v1 v2 v3. ul = [u0; v1; v2; v3:real^3]`);; +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`);; +e (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`]);; + +e (NEW_GOAL `v0 = u0:real^3`);; +e (REWRITE_WITH `v0 = HD (ul:(real^3)list)`);; +e (ASM_REWRITE_TAC[HD]);; +e (REWRITE_WITH `u0 = HD (truncate_simplex 1 (ul:(real^3)list))`);; +e (ASM_REWRITE_TAC[HD]);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX);; +e (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (REWRITE_TAC[ASSUME `v0 = u0:real^3`]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (REWRITE_WITH `EL 2 ul = v2:real^3`);; +e (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]);; +e (STRIP_TAC);; + +e (UNDISCH_TAC `~NULLSET (mcell 3 V ul INTER C)`);; +e (REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `mcell 3 V ul` THEN STRIP_TAC);; +e (REWRITE_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; ASSUME `ul = [u0; v1; v2; v3:real^3]`; + SET_RULE `{a,b,c} UNION {d} = {a,b, c,d}`]);; +e (COND_CASES_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, v1, v2, mxi V ul}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (REWRITE_TAC[coplanar]);; +e (UNDISCH_TAC `u0 IN convex hull {v2, mxi V ul}`);; +e (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC);; +e (EXISTS_TAC `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN + EXISTS_TAC `mxi V ul`);; +e (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`));; +e (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`);; +e (STRIP_TAC);; +e (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN VECTOR_ARITH_TAC);; +e (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (SET_TAC[]);; + +e (UP_ASM_TAC THEN EXPAND_TAC "Q");; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (mcell 3 V ul INTER C)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `mcell 3 V ul`);; +e (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]);; +e (REWRITE_TAC[MCELL_EXPLICIT; mcell3]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `?v2 v3. ul = [u0;u1;v2;v3:real^3]`);; +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`);; +e (REWRITE_TAC[ASSUME `ul = [v0;v1;v2;v3:real^3]`]);; + +e (REWRITE_WITH `v0 = u0:real^3`);; +e (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`);; +e (ASM_REWRITE_TAC[HD]);; +e (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`);; +e (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]);; + +e (REWRITE_WITH `v1 = u1:real^3`);; +e (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`);; +e (ASM_REWRITE_TAC[HD; TL]);; +e (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`);; +e (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; +e (REWRITE_TAC[GSYM (ASSUME `u0 = (@) (Q:real^3->bool)`)]);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, v2, mxi V ul}`);; +e (REWRITE_TAC[ASSUME `ul = [u0; u1; v2; v3:real^3]`; + CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (REWRITE_WITH `affine hull {u0, u1, v2, mxi V [u0; u1; v2; v3]} = + affine hull {u1, v2, mxi V [u0; u1; v2; v3]}`);; +e (MATCH_MP_TAC AFFINE_HULL_3_INSERT);; + +e (NEW_GOAL `convex hull {EL 2 ul, mxi V ul} SUBSET + affine hull {EL 2 ul, mxi V ul}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (NEW_GOAL `affine hull {EL 2 ul, mxi V ul} SUBSET + affine hull {u1, v2, mxi V [u0; u1; v2; v3]}`);; +e (MATCH_MP_TAC AFFINE_SUBSET_KY_LEMMA);; +e (ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]);; +e (SET_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN + UNDISCH_TAC `u0 IN convex hull {EL 2 ul, mxi V ul}` THEN SET_TAC[]);; +e (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; + +e (MATCH_MP_TAC (REAL_ARITH `(a <= b) /\ ~(a = b) ==> a < b`));; +e (REWRITE_TAC[NORM_CAUCHY_SCHWARZ; NORM_CAUCHY_SCHWARZ_EQ]);; +e (NEW_GOAL `xx IN convex hull {(EL 2 ul) ,(mxi V ul)}`);; +e (MATCH_MP_TAC SMALLEST_ANGLE_IN_CONVEX_HULL);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `?v1 v2 v3. ul = [u0; v1; v2; v3:real^3]`);; +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`);; +e (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`]);; + +e (NEW_GOAL `v0 = u0:real^3`);; +e (REWRITE_WITH `v0 = HD (ul:(real^3)list)`);; +e (ASM_REWRITE_TAC[HD]);; +e (REWRITE_WITH `u0 = HD (truncate_simplex 1 (ul:(real^3)list))`);; +e (ASM_REWRITE_TAC[HD]);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX);; +e (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (REWRITE_TAC[ASSUME `v0 = u0:real^3`]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (REWRITE_WITH `EL 2 ul = v2:real^3`);; +e (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]);; +e (STRIP_TAC);; + +e (UNDISCH_TAC `~NULLSET (mcell 3 V ul INTER C)`);; +e (REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `mcell 3 V ul` THEN STRIP_TAC);; +e (REWRITE_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; ASSUME `ul = [u0; v1; v2; v3:real^3]`; + SET_RULE `{a,b,c} UNION {d} = {a,b, c,d}`]);; +e (COND_CASES_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, v1, v2, mxi V ul}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (REWRITE_TAC[coplanar]);; +e (UNDISCH_TAC `u0 IN convex hull {v2, mxi V ul}`);; +e (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC);; +e (EXISTS_TAC `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN + EXISTS_TAC `mxi V ul`);; +e (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`));; +e (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`);; +e (STRIP_TAC);; +e (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN VECTOR_ARITH_TAC);; +e (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (SET_TAC[]);; + +e (STRIP_TAC);; + +e (UNDISCH_TAC `~NULLSET (mcell 3 V ul INTER C)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `mcell 3 V ul`);; +e (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]);; +e (REWRITE_TAC[MCELL_EXPLICIT; mcell3]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `?v2 v3. ul = [u0;u1;v2;v3:real^3]`);; +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_WITH `v0 = u0:real^3`);; +e (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`);; +e (ASM_REWRITE_TAC[HD]);; +e (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`);; +e (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]);; + +e (REWRITE_WITH `v1 = u1:real^3`);; +e (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`);; +e (ASM_REWRITE_TAC[HD; TL]);; +e (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`);; +e (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, v2, mxi V ul}`);; +e (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (ABBREV_TAC `m = mxi V ul`);; +e (NEW_GOAL `mxi V [u0; u1;v2;v3] = m`);; +e (EXPAND_TAC "m" THEN AP_TERM_TAC THEN ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (ABBREV_TAC `k1 = norm (xx - u0:real^3)`);; +e (ABBREV_TAC `k2 = norm (u1 - u0:real^3)`);; +e (UNDISCH_TAC `xx IN convex hull {EL 2 ul, m:real^3}`);; +e (ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `2 = SUC 1/\ 1 = SUC 0`; + CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC);; +e (UNDISCH_TAC `k1 % (u1 - u0) = k2 % (xx - u0:real^3)`);; +e (ASM_REWRITE_TAC[]);; + +e (STRIP_TAC);; + +e (REWRITE_TAC[coplanar]);; +e (NEW_GOAL `~(k2 = &0)`);; +e (EXPAND_TAC "k2");; +e (REWRITE_TAC[NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> b = a`]);; +e (ASM_REWRITE_TAC[]);; + + +e (ASM_CASES_TAC `~(v = &0)`);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN + EXISTS_TAC `v2:real^3`);; + +e (MATCH_MP_TAC (SET_RULE `{a,b,c} SUBSET X /\ d IN X ==> {a,b,c,d} SUBSET X`));; +e (STRIP_TAC);; +e (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `(k2 - k1:real) / (k2 * v)`);; +e (EXISTS_TAC `k1 / (k2 * v)`);; +e (EXISTS_TAC `(--k2 * u) / (k2 * v)`);; +e (STRIP_TAC);; +e (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]);; +e (REWRITE_WITH `k2 - k1 + k1 + --k2 * u = k2 * (u + v) - k1 + k1 + --k2 * u`);; +e (ASM_REWRITE_TAC[ARITH_RULE `SUC 0 = 1`] THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[REAL_ARITH `k2 * (u + v) - k1 + k1 + --k2 * u = k2 * v`]);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[VECTOR_ARITH `a / x % u0 + b / x % u1 + d / x % u2 = + (&1 / x) % (a % u0 + b % u1 + d % u2)`]);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (REWRITE_WITH + `&1 / (k2 * v) % ((k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2) = m:real^3 <=> + ((k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2) = (k2 * v) % m`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Collect_geom.CHANGE_SIDE);; +e (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[VECTOR_ARITH + `(k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2 = (k2 * v) % m <=> + k1 % (u1 - u0) = k2 % ((u % v2 + v % m) - u0)`]);; + +e (NEW_GOAL `~(u = &0)`);; +e (UP_ASM_TAC THEN UNDISCH_TAC `u + v = &(SUC 0):real` THEN + REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]);; +e (REAL_ARITH_TAC);; + +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN + EXISTS_TAC `m:real^3`);; +e (MATCH_MP_TAC (SET_RULE `{a,b,c} SUBSET X /\ d IN X ==> {a,b,d,c} SUBSET X`));; +e (STRIP_TAC);; +e (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]);; + +e (EXISTS_TAC `(k2 - k1:real) / (k2 * u)`);; +e (EXISTS_TAC `k1 / (k2 * u)`);; +e (EXISTS_TAC `(--k2 * v) / (k2 * u)`);; +e (STRIP_TAC);; +e (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]);; +e (REWRITE_WITH `k2 - k1 + k1 + --k2 * v = k2 * (u + v) - k1 + k1 + --k2 * v`);; +e (ASM_REWRITE_TAC[ARITH_RULE `SUC 0 = 1`] THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[REAL_ARITH `k2 * (u + v) - k1 + k1 + --k2 * v = k2 * u`]);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[VECTOR_ARITH `a / x % u0 + b / x % u1 + d / x % u2 = + (&1 / x) % (a % u0 + b % u1 + d % u2)`]);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (REWRITE_WITH + `&1 / (k2 * u) % ((k2 - k1) % u0 + k1 % u1 + (--k2 * v) % m) = v2:real^3 <=> + ((k2 - k1) % u0 + k1 % u1 + (--k2 * v) % m) = (k2 * u) % v2`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Collect_geom.CHANGE_SIDE);; +e (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[VECTOR_ARITH + `(k2 - k1) % u0 + k1 % u1 + (--k2 * v) % m = (k2 * u) % v2 <=> + k1 % (u1 - u0) = k2 % ((u % v2 + v % m) - u0)`]);; + +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; + +(* ========================================================================== *) + +e (ABBREV_TAC `f4 = + (\ul. (((smallest_angle_line (EL 2 ul) (EL 3 ul) u0 u1) - u0) + dot (u1 - u0)) / + (norm ((smallest_angle_line (EL 2 ul) (EL 3 ul) u0 u1) - u0) + * norm (u1 - u0)))`);; + +e (ABBREV_TAC `P4 = {(f4:(real^3)list->real) ul |ul | barV V 3 ul /\ + ~NULLSET (mcell 4 V ul INTER C) /\ + truncate_simplex 1 ul = [u0; u1]}`);; + +e (NEW_GOAL `~(P4 = {}) ==> (?b:real. b IN P4 /\ (!x. x IN P4 ==> x <= b))`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC SUP_FINITE_LEMMA);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "P4");; +e (ONCE_REWRITE_TAC [SET_RULE `{f x| x | P x} = {f x | x IN {y | P y}}`]);; +e (ONCE_REWRITE_TAC [SET_RULE `{f x| x IN s} = {y | ?x. x IN s /\ y = f x}`]);; +e (MATCH_MP_TAC FINITE_IMAGE_EXPAND);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `{y | ?v0:real^3 v1 u2 u3. + v0 IN (V INTER ball (u0:real^3, &4)) /\ + v1 IN (V INTER ball (u0, &4)) /\ + u2 IN (V INTER ball (u0, &4)) /\ + u3 IN (V INTER ball (u0, &4)) /\ + y = [v0; v1; u2; u3]}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC FINITE_SET_LIST_LEMMA);; +e (ASM_SIMP_TAC[FINITE_PACK_LEMMA]);; +e (REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `?v0 v1 u2 u3. x = [v0; v1; u2; u3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (EXISTS_TAC `v0:real^3` THEN EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `v0 = u0:real^3`);; +e (REWRITE_WITH `v0 = HD (x:(real^3)list)`);; +e (ASM_REWRITE_TAC[HD]);; +e (REWRITE_WITH `u0 = HD (truncate_simplex 1 (x:(real^3)list))`);; +e (ASM_REWRITE_TAC[HD]);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX);; +e (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (NEW_GOAL `set_of_list x SUBSET ball (u0:real^3,&4)`);; +e (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2);; +e (EXISTS_TAC `V:real^3->bool`);; +e (ASM_REWRITE_TAC[set_of_list]);; +e (SET_TAC[]);; +e (NEW_GOAL `set_of_list x SUBSET V:real^3->bool`);; +e (MATCH_MP_TAC Packing3.BARV_SUBSET);; +e (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]);; +e (SET_TAC[]);; + +e (ABBREV_TAC `d2 = (if (P4 = {}:real->bool) then c + else (@b. b IN P4 /\ (!x. x IN P4 ==> x <= b)))`);; +e (NEW_GOAL `d2 < &1`);; +e (EXPAND_TAC "d2");; +e (COND_CASES_TAC);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `?b:real. b IN P4 /\ (!x. x IN P4 ==> x <= b)`);; +e (ASM_SIMP_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (ABBREV_TAC `P = (\b:real. b IN P4 /\ (!x. x IN P4 ==> x <= b))`);; +e (ABBREV_TAC `zz = (@) (P:real->bool)`);; +e (NEW_GOAL `(P:real->bool) zz`);; +e (EXPAND_TAC "zz");; +e (MATCH_MP_TAC SELECT_AX);; +e (EXISTS_TAC `b':real`);; +e (EXPAND_TAC "P" THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN EXPAND_TAC "P" THEN REWRITE_TAC[]);; +e (EXPAND_TAC "P4" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "f4");; + +e (ABBREV_TAC `xx = smallest_angle_line (EL 2 ul) (EL 3 ul) u0 u1`);; +e (MATCH_MP_TAC REAL_DIV_LT_1_TACTICS);; +e (STRIP_TAC);; +e (MATCH_MP_TAC (REAL_ARITH `&0 <= a /\ ~(a = &0) ==> &0 < a`));; +e (STRIP_TAC);; +e (SIMP_TAC[REAL_LE_MUL; NORM_POS_LE]);; +e (REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "xx");; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN + REWRITE_TAC[smallest_angle_line; smallest_angle_set]);; +e (STRIP_TAC);; +e (ABBREV_TAC `Q = (\x:real^3. x IN convex hull {EL 2 ul, EL 3 ul} /\ + (!y. y IN convex hull {EL 2 ul, EL 3 ul} + ==> ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0))))`);; +e (NEW_GOAL `(Q:real^3->bool) u0`);; +e (ONCE_ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC SELECT_AX);; +e (EXPAND_TAC "Q");; + +e (MATCH_MP_TAC SMALLEST_ANGLE_LINE_EXISTS);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `?v1 v2 v3. ul = [u0; v1; v2; v3:real^3]`);; +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`);; +e (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`]);; + +e (NEW_GOAL `v0 = u0:real^3`);; +e (REWRITE_WITH `v0 = HD (ul:(real^3)list)`);; +e (ASM_REWRITE_TAC[HD]);; +e (REWRITE_WITH `u0 = HD (truncate_simplex 1 (ul:(real^3)list))`);; +e (ASM_REWRITE_TAC[HD]);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX);; +e (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (REWRITE_TAC[ASSUME `v0 = u0:real^3`]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (REWRITE_WITH `EL 2 ul = v2:real^3 /\ EL 3 ul = v3`);; +e (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `3 = SUC 2 /\2 = SUC 1 /\ 1 = SUC 0`]);; +e (STRIP_TAC);; + +e (UNDISCH_TAC `~NULLSET (mcell 4 V ul INTER C)`);; +e (REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `mcell 4 V ul` THEN STRIP_TAC);; +e (SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list;ARITH_RULE `4 >= 4`; + ASSUME `ul = [u0; v1; v2; v3:real^3]`]);; +e (COND_CASES_TAC);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, v1, v2, v3:real^3}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (REWRITE_TAC[coplanar]);; +e (UNDISCH_TAC `u0 IN convex hull {v2, v3:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC);; +e (EXISTS_TAC `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN + EXISTS_TAC `v3:real^3`);; +e (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`));; +e (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`);; +e (STRIP_TAC);; +e (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN VECTOR_ARITH_TAC);; +e (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (SET_TAC[]);; + +e (UP_ASM_TAC THEN EXPAND_TAC "Q");; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (mcell 4 V ul INTER C)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `mcell 4 V ul`);; +e (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]);; +e (SIMP_TAC[MCELL_EXPLICIT; mcell4; ARITH_RULE `4 >= 4`]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `?v2 v3. ul = [u0;u1;v2;v3:real^3]`);; +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_WITH `v0 = u0:real^3`);; +e (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`);; +e (ASM_REWRITE_TAC[HD]);; +e (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`);; +e (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]);; + +e (REWRITE_WITH `v1 = u1:real^3`);; +e (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`);; +e (ASM_REWRITE_TAC[HD; TL]);; +e (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`);; +e (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; + +e (ASM_REWRITE_TAC[set_of_list]);; +e (REWRITE_TAC[GSYM (ASSUME `u0 = (@) (Q:real^3->bool)`)]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, v2, v3:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (REWRITE_WITH `affine hull {u0, u1, v2, v3} = + affine hull {u1, v2, v3:real^3}`);; +e (MATCH_MP_TAC AFFINE_HULL_3_INSERT);; + +e (NEW_GOAL `convex hull {EL 2 ul, (EL 3 ul):real^3} SUBSET + affine hull {EL 2 ul, EL 3 ul}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (NEW_GOAL `affine hull {EL 2 ul, (EL 3 ul):real^3} SUBSET + affine hull {u1, v2, v3}`);; +e (MATCH_MP_TAC AFFINE_SUBSET_KY_LEMMA);; +e (ASM_REWRITE_TAC[EL; HD; TL; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]);; +e (SET_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN + UNDISCH_TAC `u0 IN convex hull {EL 2 ul, (EL 3 ul):real^3}` THEN SET_TAC[]);; +e (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; + +e (MATCH_MP_TAC (REAL_ARITH `(a <= b) /\ ~(a = b) ==> a < b`));; +e (REWRITE_TAC[NORM_CAUCHY_SCHWARZ; NORM_CAUCHY_SCHWARZ_EQ]);; +e (NEW_GOAL `xx IN convex hull {(EL 2 ul) ,(EL 3 ul):real^3}`);; +e (MATCH_MP_TAC SMALLEST_ANGLE_IN_CONVEX_HULL);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `?v1 v2 v3. ul = [u0; v1; v2; v3:real^3]`);; +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`);; +e (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`]);; + +e (NEW_GOAL `v0 = u0:real^3`);; +e (REWRITE_WITH `v0 = HD (ul:(real^3)list)`);; +e (ASM_REWRITE_TAC[HD]);; +e (REWRITE_WITH `u0 = HD (truncate_simplex 1 (ul:(real^3)list))`);; +e (ASM_REWRITE_TAC[HD]);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX);; +e (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (REWRITE_TAC[ASSUME `v0 = u0:real^3`]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (REWRITE_WITH `EL 2 ul = v2:real^3 /\ EL 3 ul = v3`);; +e (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `3 = SUC 2 /\2 = SUC 1 /\ 1 = SUC 0`]);; +e (STRIP_TAC);; + +e (UNDISCH_TAC `~NULLSET (mcell 4 V ul INTER C)`);; +e (REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `mcell 4 V ul` THEN STRIP_TAC);; +e (SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list;ARITH_RULE `4 >= 4`; + ASSUME `ul = [u0; v1; v2; v3:real^3]`]);; +e (COND_CASES_TAC);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, v1, v2, v3:real^3}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (REWRITE_TAC[coplanar]);; +e (UNDISCH_TAC `u0 IN convex hull {v2, v3:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC);; +e (EXISTS_TAC `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN + EXISTS_TAC `v3:real^3`);; +e (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`));; +e (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`);; +e (STRIP_TAC);; +e (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN VECTOR_ARITH_TAC);; +e (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (SET_TAC[]);; + +e (STRIP_TAC);; + +e (UNDISCH_TAC `~NULLSET (mcell 4 V ul INTER C)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `mcell 4 V ul`);; +e (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]);; +e (SIMP_TAC[MCELL_EXPLICIT; mcell4; ARITH_RULE `4 >= 4`]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `?v2 v3. ul = [u0;u1;v2;v3:real^3]`);; +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_WITH `v0 = u0:real^3`);; +e (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`);; +e (ASM_REWRITE_TAC[HD]);; +e (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`);; +e (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]);; + +e (REWRITE_WITH `v1 = u1:real^3`);; +e (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`);; +e (ASM_REWRITE_TAC[HD; TL]);; +e (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`);; +e (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (ASM_REWRITE_TAC[set_of_list]);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, v2, v3:real^3}`);; +e (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (ABBREV_TAC `k1 = norm (xx - u0:real^3)`);; +e (ABBREV_TAC `k2 = norm (u1 - u0:real^3)`);; +e (UNDISCH_TAC `xx IN convex hull {EL 2 ul,(EL 3 ul):real^3}`);; +e (ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1/\ 1 = SUC 0`; + CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC);; +e (UNDISCH_TAC `k1 % (u1 - u0) = k2 % (xx - u0:real^3)`);; +e (ASM_REWRITE_TAC[]);; + +e (STRIP_TAC);; + +e (REWRITE_TAC[coplanar]);; +e (NEW_GOAL `~(k2 = &0)`);; +e (EXPAND_TAC "k2");; +e (REWRITE_TAC[NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> b = a`]);; +e (ASM_REWRITE_TAC[]);; + +e (ASM_CASES_TAC `~(v = &0)`);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN + EXISTS_TAC `v2:real^3`);; +e (MATCH_MP_TAC (SET_RULE `{a,b,c} SUBSET X /\ d IN X ==> {a,b,c,d} SUBSET X`));; +e (STRIP_TAC);; +e (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `(k2 - k1:real) / (k2 * v)`);; +e (EXISTS_TAC `k1 / (k2 * v)`);; +e (EXISTS_TAC `(--k2 * u) / (k2 * v)`);; +e (STRIP_TAC);; +e (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]);; +e (REWRITE_WITH `k2 - k1 + k1 + --k2 * u = k2 * (u + v) - k1 + k1 + --k2 * u`);; +e (ASM_REWRITE_TAC[ARITH_RULE `SUC 0 = 1`] THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[REAL_ARITH `k2 * (u + v) - k1 + k1 + --k2 * u = k2 * v`]);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[VECTOR_ARITH `a / x % u0 + b / x % u1 + d / x % u2 = + (&1 / x) % (a % u0 + b % u1 + d % u2)`]);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (REWRITE_WITH + `&1 / (k2 * v) % ((k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2) = v3:real^3 <=> + ((k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2) = (k2 * v) % v3`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Collect_geom.CHANGE_SIDE);; +e (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[VECTOR_ARITH + `(k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2 = (k2 * v) % v3 <=> + k1 % (u1 - u0) = k2 % ((u % v2 + v % v3) - u0)`]);; + +e (NEW_GOAL `~(u = &0)`);; +e (UP_ASM_TAC THEN UNDISCH_TAC `u + v = &(SUC 0):real` THEN + REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]);; +e (REAL_ARITH_TAC);; + +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN + EXISTS_TAC `v3:real^3`);; +e (MATCH_MP_TAC (SET_RULE `{a,b,c} SUBSET X /\ d IN X ==> {a,b,d,c} SUBSET X`));; +e (STRIP_TAC);; +e (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]);; + +e (EXISTS_TAC `(k2 - k1:real) / (k2 * u)`);; +e (EXISTS_TAC `k1 / (k2 * u)`);; +e (EXISTS_TAC `(--k2 * v) / (k2 * u)`);; +e (STRIP_TAC);; +e (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]);; +e (REWRITE_WITH `k2 - k1 + k1 + --k2 * v = k2 * (u + v) - k1 + k1 + --k2 * v`);; +e (ASM_REWRITE_TAC[ARITH_RULE `SUC 0 = 1`] THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[REAL_ARITH `k2 * (u + v) - k1 + k1 + --k2 * v = k2 * u`]);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[VECTOR_ARITH `a / x % u0 + b / x % u1 + d / x % u2 = + (&1 / x) % (a % u0 + b % u1 + d % u2)`]);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (REWRITE_WITH + `&1 / (k2 * u) % ((k2 - k1) % u0 + k1 % u1 + (--k2 * v) % v3) = v2:real^3 <=> + ((k2 - k1) % u0 + k1 % u1 + (--k2 * v) % v3) = (k2 * u) % v2`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Collect_geom.CHANGE_SIDE);; +e (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[VECTOR_ARITH + `(k2 - k1) % u0 + k1 % u1 + (--k2 * v) % m = (k2 * u) % v2 <=> + k1 % (u1 - u0) = k2 % ((u % v2 + v % m) - u0)`]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; + +(* ========================================================================== *) + +e (ABBREV_TAC `d = max c (max d1 d2)`);; +e (NEW_GOAL `d < &1`);; +e (UNDISCH_TAC `d2 < &1` THEN UNDISCH_TAC `d1 < &1` THEN + UNDISCH_TAC `&0 < c /\ c < &1`);; +e (EXPAND_TAC "d" THEN REAL_ARITH_TAC);; + +(* ========================================================================== *) +e (ABBREV_TAC `D = ball (u0:real^3,r) INTER rcone_gt u0 u1 d`);; +e (NEW_GOAL `D SUBSET C:real^3->bool`);; +e (EXPAND_TAC "D" THEN EXPAND_TAC "C");; +e (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC SUBSET_BALL);; +e (EXPAND_TAC "r" THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC RCONE_GT_SUBSET);; +e (EXPAND_TAC "d" THEN REAL_ARITH_TAC);; + +e (NEW_GOAL `!X. mcell_set V X /\ ~NULLSET (X INTER D) + ==> (?k vl. + 2 <= k /\ + barV V 3 vl /\ + X = mcell k V vl /\ + truncate_simplex 1 vl = [u0; u1])`);; +e (REPEAT STRIP_TAC);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER D)`);; +e (REWRITE_TAC[] THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X INTER C:real^3->bool`);; +e (ASM_REWRITE_TAC[] THEN UNDISCH_TAC `D SUBSET C:real^3->bool`);; +e (SET_TAC[]);; + +(* ========================================================================= *) + +e (NEW_GOAL `D = conic_cap (u0:real^3) u1 r d`);; +e (EXPAND_TAC "D" THEN REWRITE_TAC[conic_cap; NORMBALL_BALL]);; + +e (NEW_GOAL `!X. mcell_set V X /\ ~NULLSET (X INTER D) ==> + vol (X INTER D) = vol (D) * (dihX V X (u0,u1)) / (&2 * pi)`);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `?k vl. + 2 <= k /\ + barV V 3 vl /\ + X = mcell k V vl /\ + truncate_simplex 1 vl = [u0; u1]`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN REPEAT STRIP_TAC);; + +(* ========================================================================= *) +(* Case k = 2 *) +(* ========================================================================= *) + +e (ASM_CASES_TAC `k = 2`);; +e (ABBREV_TAC `m = mxi V vl`);; +e (ABBREV_TAC `s3 = omega_list_n V vl 3`);; +e (ABBREV_TAC `L = aff_ge{u0, u1} {m, s3:real^3}`);; + +e (REWRITE_WITH `vol (X INTER D) = vol (L INTER D)`);; +e (AP_TERM_TAC);; +e (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2]);; +e (LET_TAC);; +e (COND_CASES_TAC);; +e (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`);; +e (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; + +e (REWRITE_WITH `HD vl = u0 /\ HD (TL vl) = u1:real^3`);; +e (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX);; +e (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (ASM_REWRITE_TAC[HD; TL]);; +e (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = u1:real^3`);; +e (ASM_REWRITE_TAC[HD; TL]);; +e (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = v1:real^3`);; +e (REWRITE_TAC[ASSUME `vl = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]);; + +e (EXPAND_TAC "L");; +e (REWRITE_TAC [SET_RULE `(A INTER B INTER C) INTER D = C INTER D + <=> (!x. x IN C INTER D ==> x IN A /\ x IN B)`]);; + +e (REPEAT GEN_TAC THEN STRIP_TAC);; +e (NEW_GOAL `x:real^3 IN D`);; +e (UP_ASM_TAC THEN UNDISCH_TAC `D = conic_cap (u0:real^3) u1 r d`);; +e (SET_TAC[]);; +e (UP_ASM_TAC THEN EXPAND_TAC "D" THEN STRIP_TAC);; +e (NEW_GOAL `x:real^3 IN rcone_gt u0 u1 a'`);; +e (NEW_GOAL `rcone_gt (u0:real^3) u1 d SUBSET rcone_gt u0 u1 c`);; +e (MATCH_MP_TAC RCONE_GT_SUBSET);; +e (EXPAND_TAC "d" THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC + `rcone_gt (u0:real^3) u1 c SUBSET W INTER rcone_gt u0 u1 a'`);; +e (SET_TAC[]);; +e (STRIP_TAC);; +e (UP_ASM_TAC THEN SET_TAC[RCONE_GT_SUBSET_RCONE_GE]);; + +(* ========================================================================== *) +e (UP_ASM_TAC THEN REWRITE_TAC[rcone_ge; rconesgn; rcone_gt; IN; IN_ELIM_THM]);; +e (STRIP_TAC);; + +e (ABBREV_TAC `y = u0 + proj_point (u1 - u0:real^3) (x - u0)`);; +e (NEW_GOAL `orthogonal (x - y) (u1 - u0:real^3)`);; +e (REWRITE_WITH `x - y = (x - u0) - proj_point (u1 - u0) (x - u0:real^3)`);; +e (EXPAND_TAC "y" THEN VECTOR_ARITH_TAC);; +e (REWRITE_TAC[GSYM Marchal_cells_2_new.projection_proj_point]);; +e (REWRITE_TAC[orthogonal; Packing3.PROJECTION_ORTHOGONAL]);; + +e (NEW_GOAL `norm (x - u0) pow 2 = norm (y - u0) pow 2 + norm (x - y:real^3) pow 2`);; +e (MATCH_MP_TAC PYTHAGORAS);; +e (REWRITE_TAC[orthogonal]);; +e (ONCE_REWRITE_TAC[VECTOR_ARITH `(a - b) dot c = --(c dot (b - a))`]);; +e (REWRITE_WITH `y - u0 = proj_point (u1 - u0) (x - u0:real^3)`);; +e (EXPAND_TAC "y" THEN REWRITE_TAC[VECTOR_ARITH `(a + b) - a:real^3 = b`]);; +e (REWRITE_TAC[PRO_EXP; DOT_RMUL]);; +e (UP_ASM_TAC THEN REWRITE_TAC[orthogonal] THEN STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (REAL_ARITH_TAC);; + +e (NEW_GOAL `norm (x - u1) pow 2 = norm (y - u1) pow 2 + norm (x - y:real^3) pow 2`);; +e (MATCH_MP_TAC PYTHAGORAS);; +e (REWRITE_TAC[orthogonal]);; +e (ONCE_REWRITE_TAC[VECTOR_ARITH `(a - b) dot c = c dot (a - b)`]);; +e (REWRITE_WITH `u1 - y = (u1 - u0) - proj_point (u1 - u0) (x - u0:real^3)`);; +e (EXPAND_TAC "y" THEN VECTOR_ARITH_TAC);; +e (REWRITE_TAC[PRO_EXP; VECTOR_ARITH `x - a % x = (&1 - a) % x`]);; +e (REWRITE_TAC[DOT_RMUL] THEN DEL_TAC);; +e (UP_ASM_TAC THEN REWRITE_TAC[orthogonal] THEN STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (REAL_ARITH_TAC);; + +e (MP_TAC (ASSUME `(x - u0:real^3) dot (u1 - u0) > + dist (x,u0) * dist (u1,u0) * a'`));; +e (REWRITE_WITH `(x - u0) dot (u1 - u0) = + (x - y) dot (u1 - u0) + (y - u0) dot (u1 - u0:real^3)`);; +e (VECTOR_ARITH_TAC);; +e (REWRITE_WITH `(x - u1) dot (u0 - u1) = + (x - y) dot (u0 - u1) + (y - u1) dot (u0 - u1:real^3)`);; +e (VECTOR_ARITH_TAC);; +e (REWRITE_WITH `(x - y) dot (u1 - u0:real^3) = &0`);; +e (ASM_REWRITE_TAC[GSYM orthogonal]);; +e (REWRITE_WITH `(x - y) dot (u0 - u1:real^3) = &0`);; +e (ONCE_REWRITE_TAC[VECTOR_ARITH `a dot (u0 - u1) = --(a dot (u1 - u0))`]);; +e (REWRITE_TAC[REAL_ARITH `--a = &0 <=> a = &0`]);; +e (ASM_REWRITE_TAC[GSYM orthogonal]);; +e (REWRITE_TAC[REAL_ARITH `&0 + a = a`]);; + +e (STRIP_TAC);; +e (NEW_GOAL `(y - u0) dot (u1 - u0) = norm (y - u0) * norm (u1 - u0:real^3)`);; +e (REWRITE_TAC[NORM_CAUCHY_SCHWARZ_EQ]);; +e (REWRITE_WITH `y - u0 = proj_point (u1 - u0) (x - u0:real^3)`);; +e (EXPAND_TAC "y" THEN REWRITE_TAC[VECTOR_ARITH `(a + b) - a:real^3 = b`]);; +e (REWRITE_TAC[PRO_EXP; NORM_MUL; VECTOR_MUL_ASSOC]);; +e (MATCH_MP_TAC (MESON[] `a = b ==> a % x = b % x`));; +e (REWRITE_TAC[REAL_ARITH `a * norm b = norm b * a`]);; +e (MATCH_MP_TAC (MESON[] `a = b ==> x * a = x * b`));; +e (REWRITE_TAC[REAL_ABS_REFL]);; +e (MATCH_MP_TAC REAL_LE_DIV);; +e (REWRITE_TAC[DOT_POS_LE]);; + +e (REWRITE_WITH `(x - u0) dot (u1 - u0) = + (x - y) dot (u1 - u0) + (y - u0) dot (u1 - u0:real^3)`);; +e (VECTOR_ARITH_TAC);; +e (REWRITE_WITH `(x - y) dot (u1 - u0:real^3) = &0`);; +e (ASM_REWRITE_TAC[GSYM orthogonal]);; +e (REWRITE_TAC[REAL_ARITH `&0 + a = a`]);; + +e (NEW_GOAL `y IN convex hull {u0, u1:real^3}`);; +e (NEW_GOAL `y IN affine hull {u0, u1:real^3}`);; +e (REWRITE_TAC[AFFINE_HULL_2; IN; IN_ELIM_THM]);; +e (EXPAND_TAC "y" THEN REWRITE_TAC[PRO_EXP]);; +e (ABBREV_TAC `rtemp = ((x - u0) dot (u1 - u0)) / ((u1 - u0) dot (u1 - + u0:real^3))`);; +e (EXISTS_TAC `&1 - rtemp` THEN EXISTS_TAC `rtemp:real`);; +e (STRIP_TAC);; +e (REAL_ARITH_TAC);; +e (VECTOR_ARITH_TAC);; +e (UP_ASM_TAC THEN REWRITE_TAC[IN; AFFINE_HULL_2; CONVEX_HULL_2; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `y - u0 = v % (u1 - u0:real^3)`);; +e (NEW_GOAL `y - u0 = y - (u + v) % u0:real^3`);; +e (REWRITE_TAC[ASSUME `u + v = &1`; VECTOR_MUL_LID]);; +e (UP_ASM_TAC THEN REWRITE_WITH `y - (u + v) % u0 = v % (u1 - u0:real^3)`);; +e (REWRITE_TAC[ASSUME `y = u % u0 + v % u1:real^3`] THEN VECTOR_ARITH_TAC);; + +e (ASM_CASES_TAC `u < &0`);; +e (NEW_GOAL `F`);; +e (NEW_GOAL `norm (y - u0) <= norm (x - u0:real^3)`);; +e (MATCH_MP_TAC Tactics_jordan.REAL_POW_2_LE);; +e (REWRITE_TAC[NORM_POS_LE; ASSUME + `norm (x - u0:real^3) pow 2 = norm (y - u0) pow 2 + norm (x - y) pow 2`; + REAL_ARITH `a <= a + b <=> &0 <= b`; REAL_LE_POW_2]);; +e (NEW_GOAL `norm (x - u0:real^3) < &1`);; +e (REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN + REWRITE_TAC[GSYM IN_BALL]);; +e (NEW_GOAL `ball (u0:real^3, r) SUBSET ball (u0, &1)`);; +e (MATCH_MP_TAC SUBSET_BALL);; +e (EXPAND_TAC "r" THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN UNDISCH_TAC + `x IN ball (u0:real^3,r) INTER rcone_gt u0 u1 d` THEN SET_TAC[]);; + +e (NEW_GOAL `norm (y - u0) = v * norm (u1:real^3 - u0)`);; +e (ASM_REWRITE_TAC[NORM_MUL]);; + +e (REWRITE_WITH `abs v = v`);; +e (REWRITE_TAC[REAL_ABS_REFL]);; +e (UNDISCH_TAC `u + v = &1` THEN UNDISCH_TAC `u < &0` THEN REAL_ARITH_TAC);; +e (NEW_GOAL `&2 <= norm (u1 - u0:real^3)`);; +e (REWRITE_TAC[GSYM dist]);; +e (UNDISCH_TAC `packing (V:real^3->bool)` THEN REWRITE_TAC[packing]);; +e (REPEAT STRIP_TAC);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ONCE_REWRITE_TAC[MESON[IN] `V x <=> x IN (V:real^3->bool)`]);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `v * &2 <= v * norm (u1 - u0:real^3)`);; +e (REWRITE_TAC[REAL_ARITH `a * b <= a * c <=> &0 <= a * (c - b)`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (UNDISCH_TAC `u + v = &1` THEN UNDISCH_TAC `u < &0` THEN UP_ASM_TAC);; +e (REAL_ARITH_TAC);; + +e (NEW_GOAL `&1 < v`);; +e (UNDISCH_TAC `u + v = &1` THEN UNDISCH_TAC `u < &0` THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN + UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (ASM_CASES_TAC `v < &0`);; +e (NEW_GOAL `F`);; +e (NEW_GOAL `(y - u0) dot (u1 - u0:real^3) <= &0`);; +e (ASM_REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DOT_POS_LE]);; +e (UP_ASM_TAC THEN REAL_ARITH_TAC);; + +e (NEW_GOAL `&0 <= dist (x,u0) * dist (u1,u0:real^3) * a'`);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DIST_POS_LE]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DIST_POS_LE]);; +e (EXPAND_TAC "a'" THEN MATCH_MP_TAC REAL_LE_DIV);; +e (STRIP_TAC);; +e (REWRITE_TAC[HL_2]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DIST_POS_LE] THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC SQRT_POS_LE THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC + `(y - u0:real^3) dot (u1 - u0) > dist (x,u0) * dist (u1,u0) * a'`);; +e (REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; + +e (NEW_GOAL `&0 <= dist (x,u0) * dist (u1,u0:real^3) * a'`);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DIST_POS_LE]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DIST_POS_LE]);; +e (EXPAND_TAC "a'" THEN MATCH_MP_TAC REAL_LE_DIV);; +e (STRIP_TAC);; +e (REWRITE_TAC[HL_2]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DIST_POS_LE] THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC SQRT_POS_LE THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; + +e (NEW_GOAL `(y - u1) dot (u0 - u1) = norm (y - u1) * norm (u0 - u1:real^3)`);; +e (REWRITE_TAC[NORM_CAUCHY_SCHWARZ_EQ]);; +e (REWRITE_WITH `y - u1 = proj_point (u1 - u0) (x - u0:real^3) - (u1 - u0)`);; +e (EXPAND_TAC "y" THEN VECTOR_ARITH_TAC);; +e (REWRITE_TAC[PRO_EXP; VECTOR_ARITH `x % a - a = (x - &1) % a`; NORM_MUL; + VECTOR_MUL_ASSOC]);; +e (REWRITE_WITH ` + (norm (u0 - u1) * + (((x - u0) dot (u1 - u0)) / ((u1 - u0) dot (u1 - u0)) - &1)) % (u1 - u0) = + (norm (u0 - u1:real^3) * + (&1 - ((x - u0) dot (u1 - u0)) / ((u1 - u0) dot (u1 - u0)))) % (u0 - u1)`);; +e (VECTOR_ARITH_TAC);; +e (MATCH_MP_TAC (MESON[] `a = b ==> a % x = b % x`));; +e (REWRITE_TAC[REAL_ARITH `a * norm b = norm b * a`]);; +e (REWRITE_TAC[NORM_ARITH `norm (a - b) = norm (b - a)`]);; +e (MATCH_MP_TAC (MESON[] `a = b ==> x * a = x * b`));; +e (REWRITE_TAC[REAL_ARITH `abs (x - &1) = abs (&1 - x)`]);; +e (REWRITE_TAC[REAL_ABS_REFL; REAL_ARITH `&0 <= a - b <=> b <= a`]);; +e (REWRITE_WITH `((x - u0) dot (u1 - u0)) / ((u1 - u0) dot (u1 - u0)) <= &1 + <=> ((x - u0) dot (u1 - u0)) <= &1 * ((u1 - u0) dot (u1 - u0:real^3))`);; +e (MATCH_MP_TAC REAL_LE_LDIV_EQ);; +e (REWRITE_TAC[DOT_POS_LT; VECTOR_ARITH `a - b = vec 0 <=> b = a`]);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `(x - u0) dot (u1 - u0) <= norm (x - u0) * norm (u1 - u0:real^3)`);; +e (REWRITE_TAC[NORM_CAUCHY_SCHWARZ]);; + +e (NEW_GOAL `norm (x - u0) * norm (u1 - u0) <= &1 * norm (u1 - u0:real^3)`);; +e (REWRITE_TAC[REAL_ARITH `a * x <= b * x <=> &0 <= (b - a) * x`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `&0 <= a - b <=> b <= a`; GSYM dist]);; +e (MATCH_MP_TAC (REAL_ARITH `a < x ==> a <= x`));; +e (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[GSYM IN_BALL]);; +e (NEW_GOAL `ball (u0:real^3, r) SUBSET ball (u0, &1)`);; +e (MATCH_MP_TAC SUBSET_BALL);; +e (EXPAND_TAC "r" THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN UNDISCH_TAC + `x IN ball (u0:real^3,r) INTER rcone_gt u0 u1 d` THEN SET_TAC[]);; +e (REWRITE_TAC[GSYM NORM_POW_2; REAL_ARITH `&1 * a pow 2 = a * a`]);; +e (NEW_GOAL `&1 * norm (u1 - u0) <= norm (u1 - u0) * norm (u1 - u0:real^3)`);; +e (REWRITE_TAC[REAL_ARITH `a * x <= b * x <=> &0 <= (b - a) * x`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `&0 <= a - b <=> b <= a`; GSYM dist]);; +e (MATCH_MP_TAC (REAL_ARITH `&2 <= x ==> &1 <= x`));; +e (UNDISCH_TAC `packing (V:real^3->bool)` THEN REWRITE_TAC[packing]);; +e (STRIP_TAC);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ONCE_REWRITE_TAC[MESON[IN] `V x <=> x IN (V:real^3->bool)`]);; +e (ASM_REWRITE_TAC[]);; +e (UNDISCH_TAC `(x - u0:real^3) dot (u1 - u0) <= + norm (x - u0) * norm (u1 - u0)` THEN + UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (ASM_REWRITE_TAC[dist]);; +e (REWRITE_TAC[REAL_ARITH `a * b >= x * b * c <=> &0 <= b * (a - x * c)`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `&0 <= a - b <=> b <= a`]);; +e (MATCH_MP_TAC Tactics_jordan.REAL_POW_2_LE);; +e (STRIP_TAC);; + +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[NORM_POS_LE]);; +e (EXPAND_TAC "a'" THEN MATCH_MP_TAC REAL_LE_DIV);; +e (STRIP_TAC);; +e (REWRITE_TAC[HL_2]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DIST_POS_LE] THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC SQRT_POS_LE THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `(a * b) pow 2 = a pow 2 * b pow 2`]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[REAL_ARITH `(a + b) * x <= a <=> b * x <= (&1 - x) * a`]);; + +e (UNDISCH_TAC `(y - u0) dot (u1 - u0) > dist (x,u0) * dist (u1,u0:real^3) * a'`);; +e (ASM_REWRITE_TAC[dist]);; +e (REWRITE_TAC[REAL_ARITH `a * b > x * b * c <=> &0 < b * (a - x * c)`]);; +e (REWRITE_TAC[REAL_MUL_POS_LT]);; +e (REWRITE_WITH `~(norm (u1 - u0:real^3) < &0 /\ + norm (y - u0) - norm (x - u0) * a' < &0)`);; +e (NEW_GOAL `&0 <= norm (u1 - u0:real^3)`);; +e (REWRITE_TAC[NORM_POS_LE]);; +e (UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[REAL_ARITH `&0 < a - b <=> b < a`]);; +e (REWRITE_WITH `norm (x - u0) * a' < norm (y - u0:real^3) <=> + (norm (x - u0) * a') pow 2 < norm (y - u0) pow 2`);; +e (MATCH_MP_TAC Pack1.bp_bdt);; +e (STRIP_TAC);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[NORM_POS_LE]);; +e (EXPAND_TAC "a'" THEN MATCH_MP_TAC REAL_LE_DIV);; +e (STRIP_TAC);; +e (REWRITE_TAC[HL_2]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DIST_POS_LE] THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC SQRT_POS_LE THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[NORM_POS_LE]);; + +e (ASM_REWRITE_TAC[REAL_ARITH `(a * b) pow 2 = a pow 2 * b pow 2`]);; +e (REWRITE_TAC[REAL_ARITH `(a + b) * x < a <=> b * x < (&1 - x) * a`]);; +e (STRIP_TAC);; + +e (NEW_GOAL `(&1 - a' pow 2) * norm (y - u0) pow 2 <= + (&1 - a' pow 2) * norm (y - u1:real^3) pow 2`);; +e (REWRITE_TAC[REAL_ARITH `a * x <= a * y <=> &0 <= a * (y - x)`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (STRIP_TAC);; +e (REWRITE_TAC[REAL_ARITH `&0 <= &1 - b <=> b <= &1 pow 2`]);; +e (REWRITE_WITH `a' pow 2 <= &1 pow 2 <=> a' <= &1`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Collect_geom.POW2_COND);; +e (REWRITE_TAC[REAL_ARITH `&0 <= &1`]);; +e (EXPAND_TAC "a'" THEN MATCH_MP_TAC REAL_LE_DIV);; +e (STRIP_TAC);; +e (REWRITE_TAC[HL_2]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DIST_POS_LE] THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC SQRT_POS_LE THEN REAL_ARITH_TAC);; + +e (EXPAND_TAC "a'");; +e (MATCH_MP_TAC REAL_DIV_LE_1_TACTICS);; +e (ASM_SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]);; +e (UNDISCH_TAC `hl [u0; u1:real^3] < sqrt (&2)` THEN REAL_ARITH_TAC);; +e (NEW_GOAL `norm (x - u0) pow 2 <= norm (x - u1:real^3) pow 2`);; +e (REWRITE_WITH `norm (x - u0) pow 2 <= norm (x - u1:real^3) pow 2 <=> + norm (x - u0) <= norm (x - u1:real^3)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Collect_geom.POW2_COND);; +e (REWRITE_TAC[NORM_POS_LE]);; +e (MATCH_MP_TAC (REAL_ARITH `&2 * x <= x + y ==> x <= y`));; +e (REWRITE_TAC[GSYM dist]);; + +e (NEW_GOAL `dist (x, u0:real^3) < &1`);; +e (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[GSYM IN_BALL]);; +e (NEW_GOAL `ball (u0:real^3, r) SUBSET ball (u0, &1)`);; +e (MATCH_MP_TAC SUBSET_BALL);; +e (EXPAND_TAC "r" THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN UNDISCH_TAC + `x IN ball (u0:real^3,r) INTER rcone_gt u0 u1 d` THEN SET_TAC[]);; +e (NEW_GOAL `&2 * dist (x, u0:real^3) < &2`);; +e (UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (NEW_GOAL `&2 <= dist (x, u0) + dist (x, u1:real^3)`);; +e (NEW_GOAL `&2 <= dist (u0, u1:real^3)`);; +e (UNDISCH_TAC `packing (V:real^3->bool)` THEN REWRITE_TAC[packing]);; +e (STRIP_TAC);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ONCE_REWRITE_TAC[MESON[IN] `V a <=> a:real^3 IN V`]);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `dist (u0, u1:real^3) <= dist (u0, x) + dist (x, u1)`);; +e (REWRITE_TAC[DIST_TRIANGLE]);; +e (UP_ASM_TAC THEN REWRITE_TAC[DIST_SYM]);; +e (UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN ASM_REWRITE_TAC[]);; +e (REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; + +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET (X INTER D)`);; +e (REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X INTER C:real^3->bool`);; +e (ASM_SIMP_TAC [SET_RULE `A SUBSET B ==> X INTER A SUBSET X INTER B`]);; +e (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2; SET_RULE `{} INTER s = {}`]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (NEW_GOAL `~coplanar {u0, u1:real^3, m, s3}`);; +e (ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]);; +e (STRIP_TAC);; +e (NEW_GOAL `NULLSET X`);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, m, s3:real^3}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2]);; +e (COND_CASES_TAC);; +e (LET_TAC);; +e (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> M INTER N INTER A SUBSET B`));; + +e (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`);; +e (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (REWRITE_WITH `HD vl = u0 /\ HD (TL vl) = u1:real^3`);; +e (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX);; +e (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (ASM_REWRITE_TAC[HD; TL]);; +e (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = u1:real^3`);; +e (ASM_REWRITE_TAC[HD; TL]);; +e (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = v1:real^3`);; +e (REWRITE_TAC[ASSUME `vl = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]);; +e (REWRITE_WITH `{u0, u1, m, s3} = {u0, u1} UNION {m:real^3, s3}`);; +e (SET_TAC[]);; +e (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]);; +e (SET_TAC[]);; +e (UNDISCH_TAC `~NULLSET (X INTER D)`);; +e (REWRITE_TAC[] THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X:real^3->bool`);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; + +(* ========================================================================= *) +e (ASM_CASES_TAC `azim u0 u1 m (s3:real^3) < pi`);; +e (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 m s3)`);; +e (ASM_SIMP_TAC[WEDGE_LUNE]);; +e (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`);; +e (SET_TAC[]);; +e (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF);; +e (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {m, s3} DIFF conic_cap u0 u1 r d INTER L = {}`);; +e (EXPAND_TAC "L");; +e (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`));; +e (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]);; +e (REWRITE_TAC[SET_RULE `A UNION {} = A`]);; +e (EXPAND_TAC "L");; + +e (REWRITE_WITH `aff_ge {u0, u1:real^3} {m, s3} = + aff_gt {u0, u1} {m, s3} UNION + UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}}`);; +e (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP);; +e (REWRITE_TAC[Geomdetail.FINITE6]);; +e (REWRITE_TAC[DISJOINT]);; + +e (ASM_CASES_TAC `m IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`);; +e (REWRITE_WITH `{u0, u1, m, s3} = {u0, u1, s3:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (ASM_CASES_TAC `s3 IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`);; +e (REWRITE_WITH `{u0, u1, m, s3} = {u0, u1, m:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({m, s3} DELETE a) | a | a IN {m, s3}}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC + `aff_ge {u0, u1:real^3} {m} UNION aff_ge {u0, u1:real^3} {s3}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_UNION);; +e (STRIP_TAC);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1:real^3, m}`);; +e (STRIP_TAC);; +e (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]);; +e (REWRITE_WITH `{u0,u1,m:real^3} = {u0,u1} UNION {m}`);; +e (SET_TAC[]);; +e (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1:real^3, s3}`);; +e (STRIP_TAC);; +e (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]);; +e (REWRITE_WITH `{u0,u1,s3:real^3} = {u0,u1} UNION {s3}`);; +e (SET_TAC[]);; +e (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]);; +e (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC AFF_GE_MONO_RIGHT);; +e (STRIP_TAC);; +e (SET_TAC[]);; + +e (REWRITE_TAC[DISJOINT]);; +e (ASM_CASES_TAC `m IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`);; +e (REWRITE_WITH `{u0, u1, m, s3} = {u0, u1, s3:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN SET_TAC[]);; + +e (MATCH_MP_TAC AFF_GE_MONO_RIGHT);; +e (STRIP_TAC);; +e (SET_TAC[]);; +e (REWRITE_TAC[DISJOINT]);; +e (ASM_CASES_TAC `s3 IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`);; +e (REWRITE_WITH `{u0, u1, m, s3} = {u0, u1, m:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN SET_TAC[]);; + +e (SET_TAC[]);; + +e (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]);; +e (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 m s3) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 m s3 / &3 * (&1 - max d (-- &1)) * r pow 3)`);; +e (NEW_GOAL `~collinear {u0:real^3, u1, m} /\ ~collinear {u0, u1, s3}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `s3:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `m:real^3`);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]);; +e (ASM_REWRITE_TAC[]);; + +e (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (REWRITE_WITH `azim (u0:real^3) u1 m s3 = dihV u0 u1 m s3`);; +e (MATCH_MP_TAC AZIM_DIHV_SAME);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `s3:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `m:real^3`);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[dihX]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET (X INTER D)`);; +e (REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X:real^3->bool`);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (LET_TAC);; + +e (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]);; +e (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`);; +e (STRIP_TAC);; +e (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`);; +e (MATCH_MP_TAC SELECT_AX);; +e (EXISTS_TAC `(2, vl:(real^3)list)`);; +e (EXPAND_TAC "P");; +e (REWRITE_TAC[BETA_THM]);; +e (REWRITE_TAC[IN; ARITH_RULE `2 <= 4`] THEN ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `initial_sublist [u0;u1:real^3] vl /\ LENGTH [u0;u1] = 1 + 1`);; +e (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`);; +e (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (UP_ASM_TAC THEN ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC);; + +e (NEW_GOAL `k' = 2 /\ mcell k' V ul = mcell 2 V vl`);; +e (MATCH_MP_TAC Ajripqn.AJRIPQN);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `mcell k' V ul INTER mcell 2 V vl = X`);; +e (SET_TAC[ASSUME `X = mcell k' V ul`; + ASSUME `X = mcell k V vl`; ASSUME `k = 2`]);; +e (REPEAT STRIP_TAC);; +e (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]);; +e (SET_TAC[]);; +e (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[]);; + +e (COND_CASES_TAC);; +e (REWRITE_TAC[dihu2]);; + +e (REWRITE_WITH `omega_list_n V ul 3 = s3`);; +e (EXPAND_TAC "s3");; +e (NEW_GOAL `2 = 2 /\ + (!k. 2 - 1 <= k /\ k <= 3 + ==> omega_list_n V ul k = omega_list_n V vl k)`);; +e (MATCH_MP_TAC MCELL_ID_OMEGA_LIST_N);; +e (ASM_REWRITE_TAC[SET_RULE `2 IN {2,3,4}`]);; +e (REWRITE_TAC[GSYM (ASSUME `X = mcell k' V ul`); GSYM (ASSUME `k' = 2`)]);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; + +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ARITH_TAC);; + +e (REWRITE_WITH `mxi V ul = m`);; +e (EXPAND_TAC "m");; +e (MATCH_MP_TAC MCELL_ID_MXI);; +e (EXISTS_TAC `2` THEN EXISTS_TAC `2`);; +e (ASM_REWRITE_TAC[SET_RULE `2 IN {2,3}`]);; +e (STRIP_TAC);; + +e (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX);; +e (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; +e (ASM_REWRITE_TAC[HD]);; + +e (REWRITE_WITH `(HD ul):real^3 = HD (truncate_simplex 1 ul)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX);; +e (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; + +e (REWRITE_WITH `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`);; +e (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]);; +e (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (REWRITE_TAC[HD]);; +e (REWRITE_TAC[GSYM (ASSUME `X = mcell k' V ul`); GSYM (ASSUME `k' = 2`)]);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `initial_sublist [u0; u1:real^3] ul /\ LENGTH [u0; u1] = 1 + 1`);; +e (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`);; +e (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_WITH `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX);; +e (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; + +e (REWRITE_WITH `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX);; +e (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; +e (ASM_REWRITE_TAC[EL; HD; ARITH_RULE `1 = SUC 0`; TL]);; +e (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]);; +e (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]);; +e (AP_THM_TAC THEN AP_TERM_TAC);; + +e (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`);; +e (MATCH_MP_TAC VOLUME_CONIC_CAP);; +e (EXPAND_TAC "d");; +e (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN MESON_TAC[]);; +e (UNDISCH_TAC `d < &1` THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]);; + +e (REWRITE_WITH `max d (--(&1)) = d`);; +e (MATCH_MP_TAC (REAL_ARITH `&0 < d /\ --(&1) < &0 ==> max d (--(&1)) = d`));; +e (REWRITE_TAC[REAL_NEG_LT0]);; +e (STRIP_TAC);; +e (EXPAND_TAC "d");; +e (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC);; +e (REAL_ARITH_TAC);; + +e (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`);; +e (REAL_ARITH_TAC);; +e (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]);; +e (REAL_ARITH_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +(* ========================================================================= *) +(* OK here *) + +e (ASM_CASES_TAC `azim u0 u1 s3 (m:real^3) < pi`);; +e (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]);; +e (STRIP_TAC);; +e (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 s3 m)`);; +e (ASM_SIMP_TAC[WEDGE_LUNE]);; +e (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`);; +e (SET_TAC[]);; +e (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF);; + +e (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {s3, m} DIFF conic_cap u0 u1 r d INTER L = {}`);; +e (EXPAND_TAC "L");; +e (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]);; +e (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`));; +e (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]);; +e (REWRITE_TAC[SET_RULE `A UNION {} = A`]);; +e (EXPAND_TAC "L");; +e (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]);; + +e (REWRITE_WITH `aff_ge {u0, u1:real^3} {m, s3} = + aff_gt {u0, u1} {m, s3} UNION + UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}}`);; +e (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP);; +e (REWRITE_TAC[Geomdetail.FINITE6]);; +e (REWRITE_TAC[DISJOINT]);; + +e (ASM_CASES_TAC `m IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, s3, m:real^3}`);; +e (REWRITE_WITH `{u0, u1, s3, m} = {u0, u1, s3:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (ASM_CASES_TAC `s3 IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, s3, m:real^3}`);; +e (REWRITE_WITH `{u0, u1, s3, m} = {u0, u1, m:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({m, s3} DELETE a) | a | a IN {m, s3}}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC + `aff_ge {u0, u1:real^3} {m} UNION aff_ge {u0, u1:real^3} {s3}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_UNION);; +e (STRIP_TAC);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1:real^3, m}`);; +e (STRIP_TAC);; +e (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]);; +e (REWRITE_WITH `{u0,u1,m:real^3} = {u0,u1} UNION {m}`);; +e (SET_TAC[]);; +e (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1:real^3, s3}`);; +e (STRIP_TAC);; +e (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]);; +e (REWRITE_WITH `{u0,u1,s3:real^3} = {u0,u1} UNION {s3}`);; +e (SET_TAC[]);; +e (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]);; +e (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC AFF_GE_MONO_RIGHT);; +e (STRIP_TAC);; +e (SET_TAC[]);; + +e (REWRITE_TAC[DISJOINT]);; +e (ASM_CASES_TAC `m IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, s3, m:real^3}`);; +e (REWRITE_WITH `{u0, u1, s3, m} = {u0, u1, s3:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN SET_TAC[]);; + +e (MATCH_MP_TAC AFF_GE_MONO_RIGHT);; +e (STRIP_TAC);; +e (SET_TAC[]);; +e (REWRITE_TAC[DISJOINT]);; +e (ASM_CASES_TAC `s3 IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, s3, m:real^3}`);; +e (REWRITE_WITH `{u0, u1, s3, m} = {u0, u1, m:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN SET_TAC[]);; + +e (SET_TAC[]);; + +e (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]);; +e (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 s3 m) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 s3 m / &3 * (&1 - max d (-- &1)) * r pow 3)`);; +e (NEW_GOAL `~collinear {u0:real^3, u1, m} /\ ~collinear {u0, u1, s3}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `s3:real^3`);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `m:real^3`);; +e (ASM_REWRITE_TAC[]);; + +e (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; + +e (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (REWRITE_WITH `azim (u0:real^3) u1 s3 m = dihV u0 u1 s3 m`);; +e (MATCH_MP_TAC AZIM_DIHV_SAME);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; + +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `m:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `s3:real^3`);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[dihX]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET (X INTER D)`);; +e (REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X:real^3->bool`);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (LET_TAC);; + +e (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]);; +e (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`);; +e (STRIP_TAC);; +e (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`);; +e (MATCH_MP_TAC SELECT_AX);; +e (EXISTS_TAC `(2, vl:(real^3)list)`);; +e (EXPAND_TAC "P");; +e (REWRITE_TAC[BETA_THM]);; +e (REWRITE_TAC[IN; ARITH_RULE `2 <= 4`] THEN ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `initial_sublist [u0;u1:real^3] vl /\ LENGTH [u0;u1] = 1 + 1`);; +e (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`);; +e (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (UP_ASM_TAC THEN ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC);; + +e (NEW_GOAL `k' = 2 /\ mcell k' V ul = mcell 2 V vl`);; +e (MATCH_MP_TAC Ajripqn.AJRIPQN);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `mcell k' V ul INTER mcell 2 V vl = X`);; +e (REWRITE_TAC[ASSUME `X = mcell k V vl`; GSYM (ASSUME `X = mcell k' V ul`); + ASSUME `k = 2`]);; +e (SET_TAC[]);; +e (REPEAT STRIP_TAC);; +e (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]);; +e (SET_TAC[]);; +e (UNDISCH_TAC `~NULLSET X` THEN UP_ASM_TAC THEN MESON_TAC[]);; + +e (COND_CASES_TAC);; +e (REWRITE_TAC[dihu2]);; +e (REWRITE_WITH `omega_list_n V ul 3 = s3`);; +e (EXPAND_TAC "s3");; +e (NEW_GOAL `2 = 2 /\ + (!k. 2 - 1 <= k /\ k <= 3 + ==> omega_list_n V ul k = omega_list_n V vl k)`);; +e (MATCH_MP_TAC MCELL_ID_OMEGA_LIST_N);; +e (ASM_REWRITE_TAC[SET_RULE `2 IN {2,3,4}`]);; +e (STRIP_TAC);; +e (MESON_TAC[ASSUME `X = mcell k V vl`; ASSUME `X = mcell k' V ul`; + ASSUME `k = 2`; ASSUME `k' = 2`]);; +e (REWRITE_WITH `mcell 2 V ul = X`);; +e (MESON_TAC[ASSUME `X = mcell k' V ul`; ASSUME `k' = 2`]);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ARITH_TAC);; + +e (REWRITE_WITH `mxi V ul = m`);; +e (EXPAND_TAC "m");; +e (MATCH_MP_TAC MCELL_ID_MXI);; +e (EXISTS_TAC `2` THEN EXISTS_TAC `2`);; +e (ASM_REWRITE_TAC[SET_RULE `2 IN {2,3}`]);; +e (STRIP_TAC);; + +e (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX);; +e (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; +e (ASM_REWRITE_TAC[HD]);; + +e (REWRITE_WITH `(HD ul):real^3 = HD (truncate_simplex 1 ul)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX);; +e (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; + +e (REWRITE_WITH `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`);; +e (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]);; +e (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (REWRITE_TAC[HD]);; + +e (STRIP_TAC);; +e (MESON_TAC[ASSUME `X = mcell k V vl`; ASSUME `X = mcell k' V ul`; + ASSUME `k = 2`; ASSUME `k' = 2`]);; +e (REWRITE_WITH `mcell 2 V ul = X`);; +e (MESON_TAC[ASSUME `X = mcell k' V ul`; ASSUME `k' = 2`]);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `initial_sublist [u0; u1:real^3] ul /\ LENGTH [u0; u1] = 1 + 1`);; +e (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`);; +e (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_WITH `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX);; +e (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; + +e (REWRITE_WITH `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX);; +e (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; +e (ASM_REWRITE_TAC[EL; HD; ARITH_RULE `1 = SUC 0`; TL]);; +e (REWRITE_TAC[DIHV_SYM_2]);; +e (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]);; + +e (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]);; +e (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]);; +e (AP_THM_TAC THEN AP_TERM_TAC);; +e (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`);; +e (MATCH_MP_TAC VOLUME_CONIC_CAP);; +e (EXPAND_TAC "d");; +e (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (UP_ASM_TAC THEN ASM_REWRITE_TAC[]);; + +e (UP_ASM_TAC THEN UNDISCH_TAC `d < &1` THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN UNDISCH_TAC `&0 < r` THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (REWRITE_WITH `max d (--(&1)) = d`);; +e (MATCH_MP_TAC (REAL_ARITH `&0 < d ==> max d (--(&1)) = d`));; +e (EXPAND_TAC "d");; +e (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC);; +e (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`);; +e (REAL_ARITH_TAC);; +e (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]);; +e (REAL_ARITH_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +(* ========================================================================== *) + +e (NEW_GOAL `F`);; +e (NEW_GOAL `azim (u0:real^3) u1 s3 m = + (if azim u0 u1 m s3 = &0 then &0 else &2 * pi - azim u0 u1 m s3)`);; +e (MATCH_MP_TAC AZIM_COMPL);; +e (STRIP_TAC);; + +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `s3:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `m:real^3`);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b, d, c}`]);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (NEW_GOAL `(&0 < pi)`);; +e (REWRITE_TAC[PI_POS]);; +e (UNDISCH_TAC `~(azim (u0:real^3) u1 m s3 < pi)`);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (STRIP_TAC);; + +e (NEW_GOAL `azim (u0:real^3) u1 m s3 = pi`);; +e (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`);; +e (REWRITE_TAC[] THEN MATCH_MP_TAC AZIM_EQ_0_PI_IMP_COPLANAR);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + + +(* ========================================================================= *) +(* Case k >= 4 *) +(* ========================================================================= *) + +e (ASM_CASES_TAC `k >= 4`);; +e (NEW_GOAL `?u2 u3. vl = [u0; u1;u2;u3:real^3]`);; +e (NEW_GOAL `?v0 v1 u2 u3. vl = [v0; v1;u2;u3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`);; + +e (REWRITE_WITH `u0 = v0:real^3`);; +e (REWRITE_WITH `v0:real^3 = HD (truncate_simplex 1 vl)`);; +e (REWRITE_TAC[ASSUME `vl = [v0;v1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]);; +e (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; HD]);; + +e (REWRITE_WITH `u1 = v1:real^3`);; +e (REWRITE_WITH `v1:real^3 = HD (TL (truncate_simplex 1 vl))`);; +e (REWRITE_TAC[ASSUME `vl = [v0;v1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]);; +e (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; + +e (ABBREV_TAC `L = aff_ge{u0, u1} {u2, u3:real^3}`);; + +e (REWRITE_WITH `vol (X INTER D) = vol (L INTER D)`);; +e (AP_TERM_TAC);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4; ARITH_RULE `4 >= 4`;set_of_list]);; +e (COND_CASES_TAC);; + +e (EXPAND_TAC "L");; +e (REWRITE_TAC[SET_RULE `A = B <=> A SUBSET B /\ B SUBSET A`]);; +e (STRIP_TAC);; +e (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> A INTER X SUBSET B INTER X`));; +e (REWRITE_TAC[Marchal_cells_2.CONVEX_HULL_4_SUBSET_AFF_GE_2_2]);; +e (MATCH_MP_TAC (SET_RULE `(!x. x IN A /\ x IN B ==> x IN C) ==> + A INTER B SUBSET C INTER B`));; +e (NEW_GOAL `DISJOINT {u0,u1:real^3} {u2, u3}`);; +e (REWRITE_TAC[DISJOINT]);; +e (MATCH_MP_TAC (MESON[] `(~A:bool ==> F) ==> A`));; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X:real^3->bool` THEN REWRITE_TAC[SET_RULE `A INTER X SUBSET A`]);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`);; +e (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u3:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (NEW_GOAL `u3 IN {u0, u1:real^3}`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u2:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; + +e (SIMP_TAC[ASSUME `DISJOINT {u0, u1} {u2, u3:real^3}`; AFF_GE_2_2]);; +e (REWRITE_TAC[CONVEX_HULL_4; IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN + EXISTS_TAC `t3:real` THEN EXISTS_TAC `t4:real`);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; + +e (REWRITE_TAC[REAL_ARITH `&0 <= a <=> (a < &0 ==> F)`]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `conic_cap (u0:real^3) u1 r d x`);; +e (REWRITE_TAC[MESON[IN] `conic_cap u0 u1 r d x <=> x IN conic_cap u0 u1 r d`; + GSYM (ASSUME `D = conic_cap (u0:real^3) u1 r d`)]);; +e (EXPAND_TAC "D");; +e (REWRITE_TAC[IN_INTER; MESON[] `~(x:bool /\ y) <=> (~x \/ ~y)`]);; +e (DISJ1_TAC);; +e (REWRITE_TAC[IN_BALL] THEN STRIP_TAC);; + +e (NEW_GOAL `(?b1:real. b1 IN P2 /\ (!x. x IN P2 ==> b1 <= x))`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]);; +e (EXISTS_TAC `(f2:(real^3)list -> real) vl`);; +e (EXPAND_TAC "P2" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (EXISTS_TAC `vl:(real^3)list`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X INTER (C:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`));; +e (EXPAND_TAC "D" THEN EXPAND_TAC "C");; +e (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC SUBSET_BALL);; +e (EXPAND_TAC "r" THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC RCONE_GT_SUBSET);; +e (EXPAND_TAC "d" THEN REAL_ARITH_TAC);; +e (FIRST_X_ASSUM CHOOSE_TAC);; + +e (NEW_GOAL `r2 = (@b. b IN P2 /\ (!x. x IN P2 ==> b <= x:real))`);; +e (EXPAND_TAC "r2");; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN REWRITE_TAC[]);; +e (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]);; +e (EXISTS_TAC `(f2:(real^3)list -> real) vl`);; +e (EXPAND_TAC "P2" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (EXISTS_TAC `vl:(real^3)list`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X INTER (C:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`));; +e (EXPAND_TAC "D" THEN EXPAND_TAC "C");; +e (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC SUBSET_BALL);; +e (EXPAND_TAC "r" THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC RCONE_GT_SUBSET);; +e (EXPAND_TAC "d" THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (REWRITE_TAC[]);; + +e (ABBREV_TAC `Q1 = (\b:real. b IN P2 /\ (!x. x IN P2 ==> b <= x))`);; +e (NEW_GOAL `(Q1:real->bool) r2`);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC SELECT_AX);; +e (EXISTS_TAC `b1:real` THEN EXPAND_TAC "Q1");; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN EXPAND_TAC "Q1" THEN REPEAT STRIP_TAC);; +e (NEW_GOAL `r2 <= f2 (vl:(real^3)list)`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (EXPAND_TAC "P2" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (EXISTS_TAC `vl:(real^3)list`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X INTER (C:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`));; +e (EXPAND_TAC "D" THEN EXPAND_TAC "C");; +e (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC SUBSET_BALL);; +e (EXPAND_TAC "r" THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC RCONE_GT_SUBSET);; +e (EXPAND_TAC "d" THEN REAL_ARITH_TAC);; + +e (UP_ASM_TAC THEN EXPAND_TAC "f2" THEN REWRITE_TAC[EL; HD; TL; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `vl= [u0; u1; u2; u3:real^3]`] THEN STRIP_TAC);; +e (NEW_GOAL `!v. v IN affine hull {u1, u2, u3:real^3} ==> r2 <= dist (u0, v)`);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `dist (u0,closest_point (affine hull {u1, u2, u3}) u0) <= + dist (u0, v:real^3)`);; +e (MATCH_MP_TAC CLOSEST_POINT_LE);; +e (ASM_REWRITE_TAC[CLOSED_AFFINE_HULL]);; +e (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; + +e (NEW_GOAL `r <= dist (u0:real^3, x)`);; +e (REWRITE_TAC[dist]);; +e (REWRITE_WITH `u0:real^3 - x = (t1 + t2 + t3 + t4) % u0 - x`);; +e (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC);; +e (REWRITE_TAC[VECTOR_ADD_RDISTRIB]);; +e (ASM_REWRITE_TAC[VECTOR_ARITH `(t1 % u0 + t2 % u0 + t3 % u0 + t4 % u0) - + (t1 % u0 + t2 % u1 + t3 % u2 + t4 % u3) = + (t2 + t3 + t4) % u0 - (t2 % u1 + t3 % u2 + t4 % u3)`]);; +e (ABBREV_TAC `y:real^3 = t2 /(t2 + t3 + t4) % u1 + + t3 /(t2 + t3 + t4) % u2 + + t4 /(t2 + t3 + t4) % u3`);; +e (REWRITE_WITH `(t2 % u1 + t3 % u2 + t4 % u3) = (t2 + t3 + t4) % (y:real^3)`);; +e (EXPAND_TAC "y");; +e (REWRITE_TAC[VECTOR_ARITH `x % (t2 / x % u1 + t3 / x % u2 + t4 / x % u3) = + (x / x) % (t2 % u1 + t3 % u2 + t4 % u3)`]);; +e (REWRITE_WITH `(t2 + t3 + t4) / (t2 + t3 + t4) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `t1 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1`);; +e (REAL_ARITH_TAC);; +e (VECTOR_ARITH_TAC);; +e (REWRITE_TAC[VECTOR_ARITH `a % x - a % y = a % (x - y)`; NORM_MUL]);; + +e (NEW_GOAL `&1 < t2 + t3 + t4`);; +e (UNDISCH_TAC `t1 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1`);; +e (REAL_ARITH_TAC);; +e (REWRITE_WITH `abs (t2 + t3 + t4) = t2 + t3 + t4`);; +e (REWRITE_TAC[REAL_ABS_REFL] THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[GSYM dist]);; +e (NEW_GOAL `r2 <= dist (u0, y:real^3)`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `t2 / (t2 + t3 + t4)` THEN EXISTS_TAC `t3 / (t2 + t3 + t4)` THEN + EXISTS_TAC `t4 / (t2 + t3 + t4)`);; +e (STRIP_TAC);; +e (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `r2 <= (t2 + t3 + t4) * dist (u0,y:real^3)`);; +e (NEW_GOAL `dist (u0,y) <= (t2 + t3 + t4) * dist (u0,y:real^3)`);; +e (REWRITE_TAC[REAL_ARITH `a <= b * a <=> &0 <= (b - &1) * a`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DIST_POS_LE]);; +e (DEL_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (EXPAND_TAC "r" THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UNDISCH_TAC `dist (u0, x:real^3) < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; + +(* ========================================================================== *) + +e (REWRITE_TAC[REAL_ARITH `&0 <= a <=> (a < &0 ==> F)`]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `conic_cap (u0:real^3) u1 r d x`);; +e (REWRITE_TAC[MESON[IN] `conic_cap u0 u1 r d x <=> x IN conic_cap u0 u1 r d`; + GSYM (ASSUME `D = conic_cap (u0:real^3) u1 r d`)]);; +e (EXPAND_TAC "D");; +e (REWRITE_TAC[IN_INTER; MESON[] `~(x:bool /\ y) <=> (~x \/ ~y)`]);; +e (DISJ2_TAC);; +e (REWRITE_TAC[IN; IN_ELIM_THM; rcone_gt; rconesgn] THEN STRIP_TAC);; + +e (NEW_GOAL `(?b1:real. b1 IN P4 /\ (!x. x IN P4 ==> x <= b1))`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]);; +e (EXISTS_TAC `(f4:(real^3)list -> real) vl`);; +e (EXPAND_TAC "P4" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (EXISTS_TAC `vl:(real^3)list`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X INTER (C:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`));; +e (EXPAND_TAC "D" THEN EXPAND_TAC "C");; +e (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC SUBSET_BALL);; +e (EXPAND_TAC "r" THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC RCONE_GT_SUBSET);; +e (EXPAND_TAC "d" THEN REAL_ARITH_TAC);; +e (FIRST_X_ASSUM CHOOSE_TAC);; + +e (NEW_GOAL `d2 = (@b. b IN P4 /\ (!x. x IN P4 ==> x <= b:real))`);; +e (EXPAND_TAC "d2");; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN REWRITE_TAC[]);; +e (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]);; +e (EXISTS_TAC `(f4:(real^3)list -> real) vl`);; +e (EXPAND_TAC "P4" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (EXISTS_TAC `vl:(real^3)list`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X INTER (C:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`));; +e (EXPAND_TAC "D" THEN EXPAND_TAC "C");; +e (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC SUBSET_BALL);; +e (EXPAND_TAC "r" THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC RCONE_GT_SUBSET);; +e (EXPAND_TAC "d" THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (REWRITE_TAC[]);; + +e (ABBREV_TAC `Q1 = (\b:real. b IN P4 /\ (!x. x IN P4 ==> x <= b))`);; +e (NEW_GOAL `(Q1:real->bool) d2`);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC SELECT_AX);; +e (EXISTS_TAC `b1:real` THEN EXPAND_TAC "Q1");; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN EXPAND_TAC "Q1" THEN REPEAT STRIP_TAC);; + +e (NEW_GOAL `f4 (vl:(real^3)list) <= d2`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (EXPAND_TAC "P4" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (EXISTS_TAC `vl:(real^3)list`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X INTER (C:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`));; +e (EXPAND_TAC "D" THEN EXPAND_TAC "C");; +e (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC SUBSET_BALL);; +e (EXPAND_TAC "r" THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC RCONE_GT_SUBSET);; +e (EXPAND_TAC "d" THEN REAL_ARITH_TAC);; + +e (UP_ASM_TAC THEN EXPAND_TAC "f4");; +e (REWRITE_TAC[EL; HD; TL; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `vl= [u0; u1; u2; u3:real^3]`] THEN STRIP_TAC);; +e (ABBREV_TAC `xx = smallest_angle_line u2 u3 u0 u1`);; + +e (MP_TAC (ASSUME `smallest_angle_line u2 u3 u0 u1 = xx`));; +e (REWRITE_TAC[smallest_angle_line; smallest_angle_set]);; +e (ABBREV_TAC `Q2 = + (\x:real^3. x IN convex hull {u2, u3} /\ + (!y. y IN convex hull {u2, u3} + ==> ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0))))`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN STRIP_TAC);; +e (NEW_GOAL `(Q2:real^3->bool) xx`);; +e (ONCE_ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC SELECT_AX);; +e (EXPAND_TAC "Q2");; + +e (MATCH_MP_TAC SMALLEST_ANGLE_LINE_EXISTS);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; + +e (UNDISCH_TAC `~NULLSET (X INTER D)`);; +e (REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list;ARITH_RULE `4 >= 4`]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; + +e (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (REWRITE_TAC[coplanar]);; +e (UNDISCH_TAC `u0 IN convex hull {u2, u3:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC);; +e (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`);; +e (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`));; +e (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`);; +e (STRIP_TAC);; +e (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN VECTOR_ARITH_TAC);; +e (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (SET_TAC[]);; + +e (UP_ASM_TAC THEN EXPAND_TAC "Q2");; +e (STRIP_TAC);; +e (ABBREV_TAC `g = (\y:real^3. ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)))`);; + +e (NEW_GOAL `d < (g:real^3->real) x`);; +e (EXPAND_TAC "g");; +e (REWRITE_WITH + `d < ((x - u0) dot (u1 - u0)) / (norm (x - u0) * norm (u1 - u0:real^3)) <=> + d * (norm (x - u0) * norm (u1 - u0)) < (x - u0) dot (u1 - u0)`);; +e (MATCH_MP_TAC REAL_LT_RDIV_EQ);; +e (MATCH_MP_TAC (REAL_ARITH `&0 <= a /\ ~(a = &0) ==> &0 < a`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (ASM_REWRITE_TAC[NORM_POS_LE]);; +e (REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; VECTOR_ARITH `x - y = vec 0 <=> x = y`]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `t1 % u0 + t2 % u1 + t3 % u2 + t4 % u3 = u0:real^3 <=> + t1 % u0 + t2 % u1 + t3 % u2 + t4 % u3 = (t1 + t2 + t3 + t4) % u0`);; +e (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC);; +e (REWRITE_TAC[VECTOR_ARITH `t1 % u0 + u = (t1 + t2) % u0 <=> u = t2 % u0`]);; +e (STRIP_TAC);; + +e (MP_TAC (ASSUME `~NULLSET (X INTER D)`) THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4;set_of_list]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR);; +e (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4);; +e (REWRITE_TAC[affine_dependent]);; +e (EXISTS_TAC `u1:real^3`);; +e (STRIP_TAC);; +e (SET_TAC[]);; + +e (NEW_GOAL `~(u1 IN {u0, u2, u3:real^3})`);; +e (STRIP_TAC);; +e (MP_TAC (ASSUME `~NULLSET (X INTER D)`) THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4;set_of_list]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (REWRITE_WITH `{u0, u1, u2, u3} = {u0:real^3,u2, u3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (SET_TAC[]);; +e (REWRITE_WITH `{u0, u1, u2, u3} DELETE u1 = {u0, u2, u3:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `(t2 + t3 + t4) / t2`);; +e (EXISTS_TAC `(-- t3) / t2`);; +e (EXISTS_TAC `(-- t4) / t2`);; + +e (STRIP_TAC);; +e (REWRITE_WITH `(t2 + t3 + t4) / t2 + --t3 / t2 + --t4 / t2 = t2 / t2`);; +e (REAL_ARITH_TAC);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC);; +e (REWRITE_WITH + `u1 = (t2 + t3 + t4) / t2 % u0 + --t3 / t2 % u2 + --t4 / t2 % u3:real^3 <=> + u1 = (&1 / t2) % ((t2 + t3 + t4) % u0 - t3 % u2 - t4 % u3)`);; +e (VECTOR_ARITH_TAC);; +e (REWRITE_TAC[GSYM (ASSUME `t2 % u1 + t3 % u2 + t4 % u3 = + (t2 + t3 + t4) % u0:real^3`)]);; +e (REWRITE_TAC[VECTOR_ARITH + `(t2 % u1 + t3 % u2 + t4 % u3) - t3 % u2 - t4 % u3 = t2 % u1`]);; +e (REWRITE_TAC[VECTOR_MUL_ASSOC]);; +e (REWRITE_WITH `&1 / t2 * t2 = &1`);; +e (REWRITE_TAC[REAL_ARITH `&1 / t2 * t2 = t2 / t2`]);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC);; +e (VECTOR_ARITH_TAC);; +e (SET_TAC[]);; +e (REWRITE_TAC[REAL_ARITH `a * b * c < d <=> d > b * c * a`; GSYM dist]);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `g x <= (g:real^3->real) xx`);; +e (NEW_GOAL `!y. y IN convex hull {u2 , u3:real^3} ==> g y <= g xx`);; +e (EXPAND_TAC "g" THEN ASM_REWRITE_TAC[]);; +e (NEW_GOAL `&0 < (t3 + t4)`);; +e (MATCH_MP_TAC (REAL_ARITH `(&0 <= x) /\ ~(x = &0) ==> &0 < x`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC REAL_LE_ADD);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (NEW_GOAL `t3 = &0 /\ t4 = &0`);; +e (UNDISCH_TAC `&0 <= t3` THEN UNDISCH_TAC `&0 <= t4` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN STRIP_TAC);; + +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `(x - u0) dot (u1 - u0:real^3) > dist (x,u0) * dist (u1,u0) * d`);; +e (REWRITE_WITH `x = t1 % u0 + t2 % u1:real^3`);; +e (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC);; +e (MATCH_MP_TAC (REAL_ARITH `a <= &0 /\ &0 <= b ==> ~(a > b)`));; +e (STRIP_TAC);; +e (REWRITE_WITH `(t1 % u0 + t2 % u1) - u0 = (t1 % u0 + t2 % u1) - + (t1 + t2 + t3 + t4) % u0:real^3`);; +e (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC);; +e (REWRITE_TAC[ASSUME `t3 = &0`; ASSUME `t4 = &0`; VECTOR_ARITH + `(t1 % u0 + t2 % u1) - (t1 + t2 + &0 + &0) % u0 = t2 % (u1 - u0)`; + DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DOT_POS_LE]);; +e (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DIST_POS_LE]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DIST_POS_LE]);; +e (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c/\ c < &1`);; +e (REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (ABBREV_TAC `y = t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3:real^3`);; +e (NEW_GOAL `(g:real^3->real) y <= g xx`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `t3 / (t3 + t4)` THEN EXISTS_TAC `t4 / (t3 + t4)`);; +e (REPEAT STRIP_TAC);; +e (MATCH_MP_TAC REAL_LE_DIV);; +e (ASM_SIMP_TAC[REAL_LE_ADD]);; +e (ASM_SIMP_TAC[REAL_LE_ADD; REAL_LE_DIV]);; +e (REWRITE_TAC[REAL_ARITH `a / x + b / x = (a + b) / x`]);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC);; +e (ASM_REWRITE_TAC[]);; + +e (ABBREV_TAC `w = t1 / (t1 + t3 + t4) % u0 + t3 / (t1 + t3 + t4) % u2 + + t4 / (t1 + t3 + t4) % u3:real^3`);; +e (NEW_GOAL `(g:real^3->real) y = g w`);; +e (EXPAND_TAC "g");; + +e (REWRITE_WITH `y:real^3 - u0 = + &1 / (t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0)`);; +e (EXPAND_TAC "y");; +e (REWRITE_TAC[VECTOR_ARITH + `(t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3) - u0 = + &1 / (t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0) <=> + (t3 + t4) / (t3 + t4) % u0 = u0`]);; +e (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC);; +e (VECTOR_ARITH_TAC);; +e (REWRITE_TAC[NORM_MUL; DOT_LMUL]);; + +e (REWRITE_WITH `w:real^3 - u0 = + &1 / (t1 + t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0)`);; +e (EXPAND_TAC "w");; +e (REWRITE_TAC[VECTOR_ARITH + `(t1 / (t1 + t3 + t4) % u0 + + t3 / (t1 + t3 + t4) % u2 + t4 / (t1 + t3 + t4) % u3) - u0 = + &1 / (t1 + t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0) <=> + (t1 + t3 + t4) / (t1 + t3 + t4) % u0 = u0`]);; +e (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` + THEN REAL_ARITH_TAC);; +e (VECTOR_ARITH_TAC);; +e (REWRITE_TAC[NORM_MUL; DOT_LMUL]);; +e (REWRITE_WITH `abs (&1 / (t3 + t4)) = &1 / (t3 + t4)`);; +e (REWRITE_TAC[REAL_ABS_REFL]);; +e (ASM_SIMP_TAC[REAL_LE_DIV;REAL_LE_ADD; REAL_ARITH `&0 <= &1`]);; +e (REWRITE_WITH `abs (&1 / (t1 + t3 + t4)) = &1 / (t1 + t3 + t4)`);; +e (REWRITE_TAC[REAL_ABS_REFL]);; +e (MATCH_MP_TAC REAL_LE_DIV THEN REWRITE_TAC[REAL_ARITH `&0 <= &1`]);; +e (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` + THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[REAL_ARITH `(a * x) / ((a * y) * z) = + (a * x) / (a * (y * z))`]);; +e (ABBREV_TAC + `a1 = norm (t3 % u2 + t4 % u3 - (t3 + t4) % u0) * norm (u1 - u0:real^3)`);; +e (NEW_GOAL `~(a1 = &0)`);; +e (EXPAND_TAC "a1" THEN ASM_REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; + VECTOR_ARITH `(a - b = vec 0 <=> a = b)/\(a + b-c = vec 0 <=> a + b = c)`]);; +e (STRIP_TAC);; + +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `(X:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_SIMP_TAC[mcell4; MCELL_EXPLICIT; set_of_list]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (REWRITE_TAC[coplanar]);; +e (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`);; +e (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`));; +e (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `&0` THEN EXISTS_TAC `t3 / (t3 + t4)` + THEN EXISTS_TAC `t4 / (t3 + t4)`);; +e (REPEAT STRIP_TAC);; +e (REWRITE_TAC[REAL_ARITH `&0 + t3 / (t3 + t4) + t4 / (t3 + t4) = + (t3 + t4) / (t3 + t4)`]);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC);; +e (ASM_REWRITE_TAC[VECTOR_ARITH + `&0 % u1 + t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3 = + (&1 / (t3 + t4)) % (t3 % u2 + t4 % u3)`]);; +e (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]);; +e (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC);; +e (VECTOR_ARITH_TAC);; +e (SET_TAC[]);; + +e (NEW_GOAL `~(&1 / (t3 + t4) = &0)`);; +e (NEW_GOAL `&0 < &1 / (t3 + t4)`);; +e (MATCH_MP_TAC REAL_LT_DIV);; +e (ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`]);; +e (UP_ASM_TAC THEN REAL_ARITH_TAC);; + +e (REWRITE_WITH + `(&1 / (t3 + t4) * ((t3 % u2 + t4 % u3 - (t3 + t4) % u0) dot (u1 - u0))) / + (&1 / (t3 + t4) * a1) = + ((t3 % u2 + t4 % u3 - (t3 + t4) % u0) dot (u1 - u0:real^3)) / a1`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[Trigonometry1.REAL_DIV_MUL2]);; + +e (NEW_GOAL `~(&1 / (t1 + t3 + t4) = &0)`);; +e (NEW_GOAL `&0 < &1 / (t1 + t3 + t4)`);; +e (MATCH_MP_TAC REAL_LT_DIV);; +e (ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`]);; +e (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN REAL_ARITH_TAC);; + +e (REWRITE_WITH + `(&1 / (t1 + t3 + t4) * ((t3 % u2 + t4 % u3 - (t3 + t4) % u0) dot (u1 - u0))) / + (&1 / (t1 + t3 + t4) * a1) = + ((t3 % u2 + t4 % u3 - (t3 + t4) % u0) dot (u1 - u0:real^3)) / a1`);; +e (UP_ASM_TAC THEN UNDISCH_TAC `~(a1 = &0)` THEN + MESON_TAC[Trigonometry1.REAL_DIV_MUL2]);; + +e (NEW_GOAL `(g:real^3->real) x <= g w`);; +e (EXPAND_TAC "g");; + +e (REWRITE_WITH + `((x - u0) dot (u1 - u0:real^3)) / (norm (x - u0) * norm (u1 - u0)) <= + ((w - u0) dot (u1 - u0)) / (norm (w - u0) * norm (u1 - u0)) <=> + ((x - u0) dot (u1 - u0)) * (norm (w - u0) * norm (u1 - u0)) <= + ((w - u0) dot (u1 - u0)) * (norm (x - u0) * norm (u1 - u0))`);; +e (MATCH_MP_TAC RAT_LEMMA4);; +e (STRIP_TAC);; +e (MATCH_MP_TAC REAL_LT_MUL);; +e (ASM_REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `x - b = vec 0 <=> x = b`]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER D)`);; +e (REWRITE_TAC[]);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `(X:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_SIMP_TAC[mcell4; MCELL_EXPLICIT; set_of_list]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (REWRITE_TAC[coplanar]);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`);; +e (ONCE_REWRITE_TAC[SET_RULE `{u0, u1, u2, u3} = {u1, u0, u2, u3}`]);; +e (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`));; +e (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `(t2 + t3 + t4) / t2` THEN EXISTS_TAC `(--t3) / t2` + THEN EXISTS_TAC `(--t4) / t2`);; +e (REPEAT STRIP_TAC);; +e (REWRITE_TAC[REAL_ARITH + `(t2 + t3 + t4) / t2 + --t3 / t2 + --t4 / t2 = t2 / t2`]);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC);; +e (REWRITE_WITH `(t2 + t3 + t4) = &1 - t1`);; +e (UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC);; +e (NEW_GOAL `u0 - t1 % u0 - t3 % u2 - t4 % u3:real^3 = t2 % u1`);; +e (UP_ASM_TAC THEN VECTOR_ARITH_TAC);; +e (ASM_REWRITE_TAC[VECTOR_ARITH + `(&1 - t1) / t2 % u0 + --t3 / t2 % u2 + --t4 / t2 % u3 = + (&1 / t2) % (u0 - t1 % u0 - t3 % u2 - t4 % u3)`]);; +e (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]);; +e (REWRITE_WITH `t2 / t2 = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC);; +e (VECTOR_ARITH_TAC);; +e (SET_TAC[]);; + +e (MATCH_MP_TAC REAL_LT_MUL);; +e (ASM_REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `x - b = vec 0 <=> x = b`]);; +e (EXPAND_TAC "w" THEN STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER D)`);; +e (REWRITE_TAC[]);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `(X:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_SIMP_TAC[mcell4; MCELL_EXPLICIT; set_of_list]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (REWRITE_TAC[coplanar]);; +e (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`);; +e (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`));; +e (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]);; + +e (EXISTS_TAC `&0` THEN EXISTS_TAC `t3 / (t3 + t4)` + THEN EXISTS_TAC `t4 / (t3 + t4)`);; +e (REPEAT STRIP_TAC);; +e (REWRITE_TAC[REAL_ARITH `&0 + t3 / (t3 + t4) + t4 / (t3 + t4) = + (t3 + t4) / (t3 + t4)`]);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC);; +e (ASM_REWRITE_TAC[VECTOR_ARITH + `&0 % u1 + t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3 = + (&1 / (t3 + t4)) % (t3 % u2 + t4 % u3)`]);; +e (UP_ASM_TAC THEN REWRITE_TAC[VECTOR_ARITH + `t1 / x % u0 + t3 / x % u2 + t4 / x % u3 = + (&1 / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]);; +e (REWRITE_WITH `&1 / (t1 + t3 + t4) % (t1 % u0 + t3 % u2 + t4 % u3) = u0 <=> + t1 % u0 + t3 % u2 + t4 % u3 = (t1 + t3 + t4) % u0:real^3`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Collect_geom.CHANGE_SIDE);; +e (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 +t3 + t4 = &1` THEN + REAL_ARITH_TAC);; + +e (REWRITE_TAC[VECTOR_ARITH `t1 % u0 + t3 % u2 + t4 % u3 = (t1 + t3 + t4) % u0 + <=> t3 % u2 + t4 % u3 = (t3 + t4) % u0`]);; +e (STRIP_TAC THEN ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]);; +e (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC);; +e (VECTOR_ARITH_TAC);; +e (SET_TAC[]);; + +e (REWRITE_WITH `x = t2 % u1 + (t1 + t3 + t4) % w:real^3`);; +e (ASM_REWRITE_TAC[] THEN EXPAND_TAC "w");; +e (REWRITE_TAC[VECTOR_ARITH + `x % (t1 /x % u0 + t3 / x % u2 + t4 /x % u3) = + (x / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]);; +e (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC);; +e (VECTOR_ARITH_TAC);; +e (ABBREV_TAC `t = t1 + t3 + t4`);; +e (REWRITE_WITH `(t2 % u1 + t % w) - u0:real^3 = + (t2 % u1 + t % w) - (t1 + t2 + t3 + t4) % u0`);; +e (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC);; +e (REWRITE_WITH `t1 + t2 + t3 + t4 = t2 + t:real`);; +e (EXPAND_TAC "t" THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[VECTOR_ARITH + `(t2 % u1 + t % w) - (t2 + t) % u0 = t2 % (u1 - u0) + t % (w - u0)`]);; +e (ABBREV_TAC `x1 = u1 - u0:real^3`);; +e (ABBREV_TAC `x2 = w - u0:real^3`);; + +e (REWRITE_WITH `(t2 % x1 + t % x2) dot x1 = + t2 * norm x1 pow 2 + t * x2 dot (x1:real^3)`);; +e (REWRITE_TAC[NORM_POW_2]);; +e (VECTOR_ARITH_TAC);; + +e (NEW_GOAL `t2 * norm x1 pow 2 * norm x2 * norm x1 <= + t2 * (x2 dot x1) * norm x1 * norm (x1:real^3)`);; +e (REWRITE_TAC[REAL_POW_2; REAL_ARITH `t2 * (x1 * x1) * x2 * x1 <= + t2 * x3 * x1 * x1 <=> &0 <= (x1 pow 2) * (--t2) * (x2 * x1 - x3)`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (ASM_SIMP_TAC[REAL_LE_MUL; NORM_POS_LE]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[NORM_CAUCHY_SCHWARZ]);; + +e (NEW_GOAL + `t2 * (x2 dot x1) * norm x1 * norm x1 + t * (x2 dot x1) * norm x2 * norm x1 <= + (x2 dot x1) * norm (t2 % x1 + t % x2) * norm (x1:real^3)`);; + +e (REWRITE_TAC[REAL_ARITH `t2 * x3 * x1 * x1 + t * x3 * x2 * x1 <= + x3 * x4 * x1 <=> &0 <= (x1 * x3) * (x4 - t2 * x1 - t * x2)`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (STRIP_TAC);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[NORM_POS_LE]);; +e (ASM_CASES_TAC `x2 dot (x1:real^3) < &0`);; +e (NEW_GOAL `F`);; +e (NEW_GOAL `(g:real^3->real) x <= &0`);; +e (EXPAND_TAC "g");; +e (REWRITE_TAC[REAL_ARITH `a / b <= &0 <=> &0 <= (--a) / b`]);; +e (MATCH_MP_TAC REAL_LE_DIV);; +e (SIMP_TAC[NORM_POS_LE; REAL_LE_MUL]);; + +e (REWRITE_WITH `x = t2 % u1 + (t1 + t3 + t4) % w:real^3`);; +e (ASM_REWRITE_TAC[] THEN EXPAND_TAC "w");; +e (REWRITE_TAC[VECTOR_ARITH + `x % (t1 /x % u0 + t3 / x % u2 + t4 /x % u3) = + (x / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]);; +e (EXPAND_TAC "t");; +e (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC);; +e (VECTOR_ARITH_TAC);; + +e (REWRITE_TAC[REAL_ARITH `&0 <= --a <=> a <= &0`]);; +e (REWRITE_WITH `(t2 % u1 + (t1 + t3 + t4) % w) - u0:real^3 = + (t2 % u1 + (t1 + t3 + t4) % w) - (t1 + t2 + t3 + t4) % u0`);; +e (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC);; +e (REWRITE_WITH `(t2 % u1 + (t1 + t3 + t4) % w) - (t1 + t2 + t3 + t4) % u0 = + t2 % x1 + t % x2:real^3`);; +e (EXPAND_TAC "x1" THEN EXPAND_TAC "x2" THEN EXPAND_TAC "t" + THEN VECTOR_ARITH_TAC);; +e (NEW_GOAL `t % x2 dot (x1:real^3) <= &0`);; +e (REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= a * (--b)`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (STRIP_TAC);; +e (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (NEW_GOAL `t2 % x1 dot (x1:real^3) <= &0`);; +e (REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (STRIP_TAC);; +e (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[DOT_POS_LE]);; +e (REWRITE_TAC[DOT_LADD]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN UNDISCH_TAC `d < (g:real^3->real) x`);; +e (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1`);; +e (REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN REAL_ARITH_TAC);; + +e (REWRITE_TAC [REAL_ARITH `&0 <= a - b * d - c <=> c <= a + (--b) * d`]);; +e (REWRITE_WITH `t * norm (x2:real^3) = abs t * norm x2`);; +e (AP_THM_TAC THEN AP_TERM_TAC);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (REWRITE_TAC[REAL_ABS_REFL]);; +e (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC);; +e (REWRITE_WITH `(--t2) * norm (x1:real^3) = abs (--t2) * norm x1`);; +e (AP_THM_TAC THEN AP_TERM_TAC);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (REWRITE_TAC[REAL_ABS_REFL]);; +e (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[GSYM NORM_MUL]);; +e (REWRITE_WITH + `norm (t % x2:real^3) = norm ((t2 % x1 + t % x2) + (--t2 % x1))`);; +e (AP_TERM_TAC THEN VECTOR_ARITH_TAC);; +e (REWRITE_TAC[NORM_TRIANGLE]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UNDISCH_TAC `(g:real^3->real) y <= g xx`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; + +e (NEW_GOAL `(g:real^3->real) xx <= d2`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (EXPAND_TAC "P4");; +e (EXPAND_TAC "g" THEN EXPAND_TAC "f4");; +e (REWRITE_TAC[IN_ELIM_THM; IN]);; +e (EXISTS_TAC `vl:(real^3)list`);; +e (REWRITE_TAC[ASSUME `barV V 3 vl`; ASSUME `vl = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1]);; +e (SIMP_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]);; +e (EXPAND_TAC "xx");; +e (SIMP_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]);; +e (REWRITE_WITH `mcell 4 V vl = mcell k V vl`);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]);; +e (REWRITE_TAC[GSYM (ASSUME `X = mcell k V vl`)]);; +e (STRIP_TAC);; + +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X INTER (C:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`));; +e (EXPAND_TAC "D" THEN EXPAND_TAC "C");; +e (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC SUBSET_BALL);; +e (EXPAND_TAC "r" THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC RCONE_GT_SUBSET);; +e (EXPAND_TAC "d" THEN REAL_ARITH_TAC);; + +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN EXPAND_TAC "d");; +e (REAL_ARITH_TAC);; + +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `(X:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_SIMP_TAC[mcell4; MCELL_EXPLICIT; set_of_list]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (SET_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +(* ========================================================================= *) + +e (NEW_GOAL `~coplanar {u0, u1, u2, u3:real^3}`);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X:real^3->bool`);; +e (STRIP_TAC);; +e (ASM_SIMP_TAC[mcell4; MCELL_EXPLICIT; set_of_list]);; +e (COND_CASES_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (ASM_REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (SET_TAC[]);; + +e (ASM_CASES_TAC `azim u0 u1 u2 (u3:real^3) < pi`);; +e (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 u2 u3)`);; +e (ASM_SIMP_TAC[WEDGE_LUNE]);; +e (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`);; +e (SET_TAC[]);; +e (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF);; +e (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {u2, u3} DIFF conic_cap u0 u1 r d INTER L = {}`);; +e (EXPAND_TAC "L");; +e (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`));; +e (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]);; +e (REWRITE_TAC[SET_RULE `A UNION {} = A`]);; +e (EXPAND_TAC "L");; + +e (REWRITE_WITH `aff_ge {u0, u1:real^3} {u2, u3} = + aff_gt {u0, u1} {u2, u3} UNION + UNIONS {aff_ge {u0, u1} ({u2, u3} DELETE a) | a | a IN {u2, u3}}`);; +e (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP);; +e (REWRITE_TAC[Geomdetail.FINITE6]);; +e (REWRITE_TAC[DISJOINT]);; + +e (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`);; +e (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u3:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (ASM_CASES_TAC `u3 IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`);; +e (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u2:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({u2, u3} DELETE a) | a | a IN {u2, u3}}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC + `aff_ge {u0, u1:real^3} {u2} UNION aff_ge {u0, u1:real^3} {u3}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_UNION);; +e (STRIP_TAC);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1:real^3, u2}`);; +e (STRIP_TAC);; +e (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]);; +e (REWRITE_WITH `{u0,u1,u2:real^3} = {u0,u1} UNION {u2}`);; +e (SET_TAC[]);; +e (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1:real^3, u3}`);; +e (STRIP_TAC);; +e (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]);; +e (REWRITE_WITH `{u0,u1,u3:real^3} = {u0,u1} UNION {u3}`);; +e (SET_TAC[]);; +e (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]);; +e (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC AFF_GE_MONO_RIGHT);; +e (STRIP_TAC);; +e (SET_TAC[]);; + +e (REWRITE_TAC[DISJOINT]);; +e (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`);; +e (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u3:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN SET_TAC[]);; + +e (MATCH_MP_TAC AFF_GE_MONO_RIGHT);; +e (STRIP_TAC);; +e (SET_TAC[]);; +e (REWRITE_TAC[DISJOINT]);; +e (ASM_CASES_TAC `u3 IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`);; +e (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u2:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN SET_TAC[]);; + +e (SET_TAC[]);; + +(* begin the computation *) + +e (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]);; +e (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 u2 u3) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 u2 u3 / &3 * (&1 - max d (-- &1)) * r pow 3)`);; +e (NEW_GOAL `~collinear {u0:real^3, u1, u2} /\ ~collinear {u0, u1, u3}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `u3:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `u2:real^3`);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]);; +e (ASM_REWRITE_TAC[]);; + +e (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (REWRITE_WITH `azim (u0:real^3) u1 u2 u3 = dihV u0 u1 u2 u3`);; +e (MATCH_MP_TAC AZIM_DIHV_SAME);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `u3:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `u2:real^3`);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[dihX]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET (X INTER D)`);; +e (REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X:real^3->bool`);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (LET_TAC);; + +e (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]);; +e (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`);; +e (STRIP_TAC);; +e (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`);; +e (MATCH_MP_TAC SELECT_AX);; +e (EXISTS_TAC `(4, vl:(real^3)list)`);; +e (EXPAND_TAC "P");; +e (REWRITE_TAC[BETA_THM]);; +e (REWRITE_TAC[IN; ARITH_RULE `4 <= 4`] THEN ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]);; + +e (REWRITE_WITH `initial_sublist [u0;u1:real^3] [u0; u1; u2; u3] /\ + LENGTH [u0;u1] = 1 + 1`);; +e (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]);; +e (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (UP_ASM_TAC THEN ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC);; + +e (NEW_GOAL `k' = 4 /\ mcell k' V ul = mcell 4 V vl`);; +e (MATCH_MP_TAC Ajripqn.AJRIPQN);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]);; +e (REWRITE_WITH `mcell k' V ul INTER mcell 4 V vl = X`);; +e (REWRITE_WITH `mcell 4 V vl = X`);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]);; +e (SET_TAC[ASSUME `X = mcell k' V ul`]);; + +e (REPEAT STRIP_TAC);; +e (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]);; +e (SET_TAC[]);; +e (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[]);; + +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (COND_CASES_TAC);; + +e (REWRITE_TAC[dihu4]);; + +e (REWRITE_WITH `dihV (EL 0 (ul:(real^3)list)) (EL 1 ul) (EL 2 ul) (EL 3 ul) = + dihV u0 u1 u2 (u3:real^3)`);; + +e (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`);; +e (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]);; +e (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC);; + +e (NEW_GOAL `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX);; +e (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; + +e (NEW_GOAL `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX);; +e (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; + +e (NEW_GOAL `{EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = {u0, u1,u2,u3:real^3}`);; +e (REWRITE_WITH ` + {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = {u0, u1,u2,u3:real^3} <=> + convex hull {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = + convex hull {u0, u1,u2,u3:real^3}`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ);; +e (REPEAT STRIP_TAC);; + +e (UNDISCH_TAC `~NULLSET X`);; +e (REWRITE_TAC[]);; +e (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (ASM_REWRITE_TAC[set_of_list]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {v0, v1, v2, v3:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR);; +e (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4);; +e (UNDISCH_TAC + `affine_dependent {EL 0 ul, EL 1 ul, EL 2 ul, (EL 3 ul):real^3}`);; +e (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]);; + +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; + +e (UNDISCH_TAC `~NULLSET X`);; +e (REWRITE_TAC[]);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]);; +e (COND_CASES_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR);; +e (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; + +e (REWRITE_WITH `convex hull {u0, u1, u2, u3:real^3} = X`);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]);; +e (COND_CASES_TAC);; +e (MESON_TAC[]);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET X`);; +e (REWRITE_TAC[]);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (REWRITE_TAC[set_of_list; ASSUME `ul = [v0; v1; v2; v3:real^3]`]);; +e (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET X`);; +e (REWRITE_TAC[]);; +e (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (UP_ASM_TAC THEN ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `1 = SUC 0`]);; +e (STRIP_TAC);; + +e (ASM_CASES_TAC `EL 2 ul = u2:real^3`);; +e (NEW_GOAL `EL 3 ul = u3:real^3`);; +e (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`));; +e (STRIP_TAC);; +e (NEW_GOAL `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2:real^3}`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (UNDISCH_TAC `~coplanar {u0,u1,u2,u3:real^3}` THEN REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2:real^3}`; COPLANAR_3]);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `EL 2 ul = u3:real^3`);; +e (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`));; +e (STRIP_TAC);; +e (NEW_GOAL `{u0:real^3, u1, EL 2 ul, EL 3 ul} = {u0, u1, EL 3 ul}`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (UNDISCH_TAC `~coplanar {u0,u1,u2,u3:real^3}` THEN REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0,u1:real^3, EL 3 ul}`; COPLANAR_3]);; + +e (NEW_GOAL `EL 3 ul = u2:real^3`);; +e (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`));; +e (STRIP_TAC);; +e (NEW_GOAL `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u3:real^3}`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (UNDISCH_TAC `~coplanar {u0,u1,u2,u3:real^3}` THEN REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u3:real^3}`; COPLANAR_3]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[DIHV_SYM_2]);; + +e (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]);; +e (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]);; +e (AP_THM_TAC THEN AP_TERM_TAC);; + +e (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`);; +e (MATCH_MP_TAC VOLUME_CONIC_CAP);; +e (EXPAND_TAC "d");; +e (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN MESON_TAC[]);; +e (UNDISCH_TAC `d < &1` THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]);; + +e (REWRITE_WITH `max d (--(&1)) = d`);; +e (MATCH_MP_TAC (REAL_ARITH `&0 < d /\ --(&1) < &0 ==> max d (--(&1)) = d`));; +e (REWRITE_TAC[REAL_NEG_LT0]);; +e (STRIP_TAC);; +e (EXPAND_TAC "d");; +e (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC);; +e (REAL_ARITH_TAC);; + +e (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`);; +e (REAL_ARITH_TAC);; +e (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]);; +e (REAL_ARITH_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN UNDISCH_TAC `k' = 4 /\ mcell k' V ul = mcell 4 V vl` + THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +(* ========================================================================= *) +(* OK here *) + +e (ASM_CASES_TAC `azim u0 u1 u3 (u2:real^3) < pi`);; +e (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]);; +e (STRIP_TAC);; +e (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 u3 u2)`);; +e (ASM_SIMP_TAC[WEDGE_LUNE]);; +e (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`);; +e (SET_TAC[]);; +e (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF);; + +e (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {u3, u2} DIFF conic_cap u0 u1 r d INTER L = {}`);; +e (EXPAND_TAC "L");; +e (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]);; +e (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`));; +e (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]);; +e (REWRITE_TAC[SET_RULE `A UNION {} = A`]);; +e (EXPAND_TAC "L");; +e (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]);; + +e (REWRITE_WITH `aff_ge {u0, u1:real^3} {u2, u3} = + aff_gt {u0, u1} {u2, u3} UNION + UNIONS {aff_ge {u0, u1} ({u2, u3} DELETE a) | a | a IN {u2, u3}}`);; +e (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP);; +e (REWRITE_TAC[Geomdetail.FINITE6]);; +e (REWRITE_TAC[DISJOINT]);; + +e (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, u3, u2:real^3}`);; +e (REWRITE_WITH `{u0, u1, u3, u2} = {u0, u1, u3:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (ASM_CASES_TAC `u3 IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, u3, u2:real^3}`);; +e (REWRITE_WITH `{u0, u1, u3, u2} = {u0, u1, u2:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({u2, u3} DELETE a) | a | a IN {u2, u3}}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC + `aff_ge {u0, u1:real^3} {u2} UNION aff_ge {u0, u1:real^3} {u3}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_UNION);; +e (STRIP_TAC);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1:real^3, u2}`);; +e (STRIP_TAC);; +e (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]);; +e (REWRITE_WITH `{u0,u1,u2:real^3} = {u0,u1} UNION {u2}`);; +e (SET_TAC[]);; +e (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1:real^3, u3}`);; +e (STRIP_TAC);; +e (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]);; +e (REWRITE_WITH `{u0,u1,u3:real^3} = {u0,u1} UNION {u3}`);; +e (SET_TAC[]);; +e (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]);; +e (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC AFF_GE_MONO_RIGHT);; +e (STRIP_TAC);; +e (SET_TAC[]);; + +e (REWRITE_TAC[DISJOINT]);; +e (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, u3, u2:real^3}`);; +e (REWRITE_WITH `{u0, u1, u3, u2} = {u0, u1, u3:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN SET_TAC[]);; + +e (MATCH_MP_TAC AFF_GE_MONO_RIGHT);; +e (STRIP_TAC);; +e (SET_TAC[]);; +e (REWRITE_TAC[DISJOINT]);; +e (ASM_CASES_TAC `u3 IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, u3, u2:real^3}`);; +e (REWRITE_WITH `{u0, u1, u3, u2} = {u0, u1, u2:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN SET_TAC[]);; + +e (SET_TAC[]);; + +e (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]);; +e (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 u3 u2) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 u3 u2 / &3 * (&1 - max d (-- &1)) * r pow 3)`);; +e (NEW_GOAL `~collinear {u0:real^3, u1, u2} /\ ~collinear {u0, u1, u3}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `u3:real^3`);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `u2:real^3`);; +e (ASM_REWRITE_TAC[]);; + +e (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; + +e (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (REWRITE_WITH `azim (u0:real^3) u1 u3 u2 = dihV u0 u1 u3 u2`);; +e (MATCH_MP_TAC AZIM_DIHV_SAME);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; + +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `u2:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `u3:real^3`);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[dihX]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET (X INTER D)`);; +e (REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X:real^3->bool`);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (LET_TAC);; + +e (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]);; +e (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`);; +e (STRIP_TAC);; +e (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`);; +e (MATCH_MP_TAC SELECT_AX);; +e (EXISTS_TAC `(4, vl:(real^3)list)`);; +e (EXPAND_TAC "P");; +e (REWRITE_TAC[BETA_THM]);; +e (REWRITE_TAC[IN; ARITH_RULE `4 <= 4`] THEN ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]);; + +e (REWRITE_WITH `initial_sublist [u0;u1:real^3] [u0; u1; u2; u3] /\ + LENGTH [u0;u1] = 1 + 1`);; +e (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]);; +e (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (UP_ASM_TAC THEN ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC);; + +e (NEW_GOAL `k' = 4 /\ mcell k' V ul = mcell 4 V vl`);; +e (MATCH_MP_TAC Ajripqn.AJRIPQN);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]);; +e (REWRITE_WITH `mcell k' V ul INTER mcell 4 V vl = X`);; +e (REWRITE_WITH `mcell 4 V vl = X`);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]);; +e (SET_TAC[ASSUME `X = mcell k' V ul`]);; + +e (REPEAT STRIP_TAC);; +e (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]);; +e (SET_TAC[]);; +e (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[]);; + +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (COND_CASES_TAC);; + +e (REWRITE_TAC[dihu4]);; + +e (REWRITE_WITH `dihV (EL 0 (ul:(real^3)list)) (EL 1 ul) (EL 2 ul) (EL 3 ul) = + dihV u0 u1 u2 (u3:real^3)`);; + +e (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`);; +e (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]);; +e (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC);; + +e (NEW_GOAL `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX);; +e (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; + +e (NEW_GOAL `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX);; +e (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; + +e (NEW_GOAL `{EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = {u0, u1,u2,u3:real^3}`);; +e (REWRITE_WITH ` + {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = {u0, u1,u2,u3:real^3} <=> + convex hull {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = + convex hull {u0, u1,u2,u3:real^3}`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ);; +e (REPEAT STRIP_TAC);; + +e (UNDISCH_TAC `~NULLSET X`);; +e (REWRITE_TAC[]);; +e (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (ASM_REWRITE_TAC[set_of_list]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {v0, v1, v2, v3:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR);; +e (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4);; +e (UNDISCH_TAC + `affine_dependent {EL 0 ul, EL 1 ul, EL 2 ul, (EL 3 ul):real^3}`);; +e (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]);; + +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; + +e (UNDISCH_TAC `~NULLSET X`);; +e (REWRITE_TAC[]);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]);; +e (COND_CASES_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR);; +e (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; + +e (REWRITE_WITH `convex hull {u0, u1, u2, u3:real^3} = X`);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]);; +e (COND_CASES_TAC);; +e (MESON_TAC[]);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET X`);; +e (REWRITE_TAC[]);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (REWRITE_TAC[set_of_list; ASSUME `ul = [v0; v1; v2; v3:real^3]`]);; +e (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET X`);; +e (REWRITE_TAC[]);; +e (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (UP_ASM_TAC THEN ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `1 = SUC 0`]);; +e (STRIP_TAC);; + +e (ASM_CASES_TAC `EL 2 ul = u2:real^3`);; +e (NEW_GOAL `EL 3 ul = u3:real^3`);; +e (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`));; +e (STRIP_TAC);; +e (NEW_GOAL `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2:real^3}`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (UNDISCH_TAC `~coplanar {u0,u1,u3,u2:real^3}`);; +e (REWRITE_TAC[]);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]);; +e (REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2:real^3}`; COPLANAR_3]);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `EL 2 ul = u3:real^3`);; +e (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`));; +e (STRIP_TAC);; +e (NEW_GOAL `{u0:real^3, u1, EL 2 ul, EL 3 ul} = {u0, u1, EL 3 ul}`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (UNDISCH_TAC `~coplanar {u0,u1,u3,u2:real^3}`);; +e (REWRITE_TAC[]);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]);; + +e (REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0,u1:real^3, EL 3 ul}`; COPLANAR_3]);; +e (NEW_GOAL `EL 3 ul = u2:real^3`);; +e (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`));; +e (STRIP_TAC);; +e (NEW_GOAL `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u3:real^3}`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (UNDISCH_TAC `~coplanar {u0,u1,u3,u2:real^3}`);; +e (REWRITE_TAC[]);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]);; + +e (REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u3:real^3}`; COPLANAR_3]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[DIHV_SYM_2]);; + +e (REWRITE_TAC[DIHV_SYM_2]);; +e (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]);; +e (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]);; +e (AP_THM_TAC THEN AP_TERM_TAC);; + +e (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`);; +e (MATCH_MP_TAC VOLUME_CONIC_CAP);; +e (EXPAND_TAC "d");; +e (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN MESON_TAC[]);; +e (UNDISCH_TAC `d < &1` THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (REWRITE_WITH `max d (--(&1)) = d`);; +e (MATCH_MP_TAC (REAL_ARITH `&0 < d /\ --(&1) < &0 ==> max d (--(&1)) = d`));; +e (REWRITE_TAC[REAL_NEG_LT0]);; +e (STRIP_TAC);; +e (EXPAND_TAC "d");; +e (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC);; +e (REAL_ARITH_TAC);; + +e (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`);; +e (REAL_ARITH_TAC);; +e (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]);; +e (REAL_ARITH_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN UNDISCH_TAC `k' = 4 /\ mcell k' V ul = mcell 4 V vl` + THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +(* ========================================================================== *) + +e (NEW_GOAL `F`);; +e (NEW_GOAL `azim (u0:real^3) u1 u3 u2 = + (if azim u0 u1 u2 u3 = &0 then &0 else &2 * pi - azim u0 u1 u2 u3)`);; +e (MATCH_MP_TAC AZIM_COMPL);; +e (STRIP_TAC);; + +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `u3:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `u2:real^3`);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b, d, c}`]);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (NEW_GOAL `(&0 < pi)`);; +e (REWRITE_TAC[PI_POS]);; +e (UNDISCH_TAC `~(azim (u0:real^3) u1 u2 u3 < pi)`);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (STRIP_TAC);; + +e (NEW_GOAL `azim (u0:real^3) u1 u2 u3 = pi`);; +e (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`);; +e (REWRITE_TAC[] THEN MATCH_MP_TAC AZIM_EQ_0_PI_IMP_COPLANAR);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +(* ========================================================================= *) +(* Case k = 3 *) +(* ========================================================================= *) + +e (NEW_GOAL `k = 3`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC `2 <= k` THEN ARITH_TAC);; +e (NEW_GOAL `?u2 u3. vl = [u0; u1;u2;u3:real^3]`);; +e (NEW_GOAL `?v0 v1 u2 u3. vl = [v0; v1;u2;u3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`);; + +e (REWRITE_WITH `u0 = v0:real^3`);; +e (REWRITE_WITH `v0:real^3 = HD (truncate_simplex 1 vl)`);; +e (REWRITE_TAC[ASSUME `vl = [v0;v1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]);; +e (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; HD]);; + +e (REWRITE_WITH `u1 = v1:real^3`);; +e (REWRITE_WITH `v1:real^3 = HD (TL (truncate_simplex 1 vl))`);; +e (REWRITE_TAC[ASSUME `vl = [v0;v1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]);; +e (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; + +e (ABBREV_TAC `L = aff_ge{u0, u1} {u2, mxi V vl}`);; + +e (REWRITE_WITH `vol (X INTER D) = vol (L INTER D)`);; +e (AP_TERM_TAC);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; + mcell3; set_of_list; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; +e (COND_CASES_TAC);; +e (ABBREV_TAC `m = mxi V vl`);; +e (REWRITE_WITH `mxi V [u0; u1; u2; u3] = m`);; +e (EXPAND_TAC "m" THEN DEL_TAC THEN ASM_REWRITE_TAC[]);; + +e (EXPAND_TAC "L");; +e (REWRITE_TAC[SET_RULE `A = B <=> A SUBSET B /\ B SUBSET A`]);; +e (STRIP_TAC);; +e (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> A INTER X SUBSET B INTER X`));; +e (REWRITE_TAC[Marchal_cells_2.CONVEX_HULL_4_SUBSET_AFF_GE_2_2]);; +e (MATCH_MP_TAC (SET_RULE `(!x. x IN A /\ x IN B ==> x IN C) ==> + A INTER B SUBSET C INTER B`));; +e (NEW_GOAL `DISJOINT {u0,u1:real^3} {u2, m}`);; +e (REWRITE_TAC[DISJOINT]);; +e (MATCH_MP_TAC (MESON[] `(~A:bool ==> F) ==> A`));; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X:real^3->bool` THEN REWRITE_TAC[SET_RULE `A INTER X SUBSET A`]);; + +e (ASM_SIMP_TAC[MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; + mcell3; set_of_list; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; +e (REWRITE_WITH `mxi V [u0; u1; u2; u3] = m`);; +e (EXPAND_TAC "m" THEN REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; + +e (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`);; +e (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, m:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (NEW_GOAL `m IN {u0, u1:real^3}`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, u2:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; + +e (SIMP_TAC[ASSUME `DISJOINT {u0, u1} {u2, m:real^3}`; AFF_GE_2_2]);; +e (REWRITE_TAC[CONVEX_HULL_4; IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN + EXISTS_TAC `t3:real` THEN EXISTS_TAC `t4:real`);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; + +e (REWRITE_TAC[REAL_ARITH `&0 <= a <=> (a < &0 ==> F)`]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `conic_cap (u0:real^3) u1 r d x`);; +e (REWRITE_TAC[MESON[IN] `conic_cap u0 u1 r d x <=> x IN conic_cap u0 u1 r d`; + GSYM (ASSUME `D = conic_cap (u0:real^3) u1 r d`)]);; +e (EXPAND_TAC "D");; +e (REWRITE_TAC[IN_INTER; MESON[] `~(x:bool /\ y) <=> (~x \/ ~y)`]);; +e (DISJ1_TAC);; +e (REWRITE_TAC[IN_BALL] THEN STRIP_TAC);; + +e (NEW_GOAL `(?b1:real. b1 IN P1 /\ (!x. x IN P1 ==> b1 <= x))`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]);; +e (EXISTS_TAC `(f1:(real^3)list -> real) vl`);; +e (EXPAND_TAC "P1" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (EXISTS_TAC `vl:(real^3)list`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X INTER (C:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`));; +e (EXPAND_TAC "D" THEN EXPAND_TAC "C");; +e (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC SUBSET_BALL);; +e (EXPAND_TAC "r" THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC RCONE_GT_SUBSET);; +e (EXPAND_TAC "d" THEN REAL_ARITH_TAC);; +e (FIRST_X_ASSUM CHOOSE_TAC);; + +e (NEW_GOAL `r1 = (@b. b IN P1 /\ (!x. x IN P1 ==> b <= x:real))`);; +e (EXPAND_TAC "r1");; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN REWRITE_TAC[]);; +e (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]);; +e (EXISTS_TAC `(f1:(real^3)list -> real) vl`);; +e (EXPAND_TAC "P1" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (EXISTS_TAC `vl:(real^3)list`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`);; +e (ASM_SIMP_TAC[]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X INTER (C:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`));; +e (EXPAND_TAC "D" THEN EXPAND_TAC "C");; +e (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC SUBSET_BALL);; +e (EXPAND_TAC "r" THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC RCONE_GT_SUBSET);; +e (EXPAND_TAC "d" THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (REWRITE_TAC[]);; + +e (ABBREV_TAC `Q1 = (\b:real. b IN P1 /\ (!x. x IN P1 ==> b <= x))`);; +e (NEW_GOAL `(Q1:real->bool) r1`);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC SELECT_AX);; +e (EXISTS_TAC `b1:real` THEN EXPAND_TAC "Q1");; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN EXPAND_TAC "Q1" THEN REPEAT STRIP_TAC);; +e (NEW_GOAL `r1 <= f1 (vl:(real^3)list)`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (EXPAND_TAC "P1" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (EXISTS_TAC `vl:(real^3)list`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X INTER (C:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`));; +e (EXPAND_TAC "D" THEN EXPAND_TAC "C");; +e (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC SUBSET_BALL);; +e (EXPAND_TAC "r" THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC RCONE_GT_SUBSET);; +e (EXPAND_TAC "d" THEN REAL_ARITH_TAC);; + +e (UP_ASM_TAC THEN EXPAND_TAC "f1" THEN REWRITE_TAC[EL; HD; TL; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `vl= [u0; u1; u2; u3:real^3]`]);; +e (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`);; +e (EXPAND_TAC "m");; +e (REWRITE_TAC[ASSUME `vl = [u0;u1;u2;u3:real^3]`]);; +e (STRIP_TAC);; + +e (NEW_GOAL `!v. v IN affine hull {u1, u2, m:real^3} ==> r1 <= dist (u0, v)`);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `dist (u0,closest_point (affine hull {u1, u2, m}) u0) <= + dist (u0, v:real^3)`);; +e (MATCH_MP_TAC CLOSEST_POINT_LE);; +e (ASM_REWRITE_TAC[CLOSED_AFFINE_HULL]);; +e (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; + +e (NEW_GOAL `r <= dist (u0:real^3, x)`);; +e (REWRITE_TAC[dist]);; +e (REWRITE_WITH `u0:real^3 - x = (t1 + t2 + t3 + t4) % u0 - x`);; +e (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC);; +e (REWRITE_TAC[VECTOR_ADD_RDISTRIB]);; +e (ASM_REWRITE_TAC[VECTOR_ARITH `(t1 % u0 + t2 % u0 + t3 % u0 + t4 % u0) - + (t1 % u0 + t2 % u1 + t3 % u2 + t4 % u3) = + (t2 + t3 + t4) % u0 - (t2 % u1 + t3 % u2 + t4 % u3)`]);; +e (ABBREV_TAC `y:real^3 = t2 /(t2 + t3 + t4) % u1 + + t3 /(t2 + t3 + t4) % u2 + + t4 /(t2 + t3 + t4) % m`);; +e (REWRITE_WITH `(t2 % u1 + t3 % u2 + t4 % m) = (t2 + t3 + t4) % (y:real^3)`);; +e (EXPAND_TAC "y");; +e (REWRITE_TAC[VECTOR_ARITH `x % (t2 / x % u1 + t3 / x % u2 + t4 / x % u3) = + (x / x) % (t2 % u1 + t3 % u2 + t4 % u3)`]);; +e (REWRITE_WITH `(t2 + t3 + t4) / (t2 + t3 + t4) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `t1 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1`);; +e (REAL_ARITH_TAC);; +e (VECTOR_ARITH_TAC);; +e (REWRITE_TAC[VECTOR_ARITH `a % x - a % y = a % (x - y)`; NORM_MUL]);; + +e (NEW_GOAL `&1 < t2 + t3 + t4`);; +e (UNDISCH_TAC `t1 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1`);; +e (REAL_ARITH_TAC);; +e (REWRITE_WITH `abs (t2 + t3 + t4) = t2 + t3 + t4`);; +e (REWRITE_TAC[REAL_ABS_REFL] THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[GSYM dist]);; +e (NEW_GOAL `r1 <= dist (u0, y:real^3)`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `t2 / (t2 + t3 + t4)` THEN EXISTS_TAC `t3 / (t2 + t3 + t4)` THEN + EXISTS_TAC `t4 / (t2 + t3 + t4)`);; +e (STRIP_TAC);; +e (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `r1 <= (t2 + t3 + t4) * dist (u0,y:real^3)`);; +e (NEW_GOAL `dist (u0,y) <= (t2 + t3 + t4) * dist (u0,y:real^3)`);; +e (REWRITE_TAC[REAL_ARITH `a <= b * a <=> &0 <= (b - &1) * a`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DIST_POS_LE]);; +e (DEL_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (EXPAND_TAC "r" THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UNDISCH_TAC `dist (u0, x:real^3) < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; + +(* ========================================================================== *) + +e (REWRITE_TAC[REAL_ARITH `&0 <= a <=> (a < &0 ==> F)`]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `conic_cap (u0:real^3) u1 r d x`);; +e (REWRITE_TAC[MESON[IN] `conic_cap u0 u1 r d x <=> x IN conic_cap u0 u1 r d`; + GSYM (ASSUME `D = conic_cap (u0:real^3) u1 r d`)]);; +e (EXPAND_TAC "D");; +e (REWRITE_TAC[IN_INTER; MESON[] `~(x:bool /\ y) <=> (~x \/ ~y)`]);; +e (DISJ2_TAC);; +e (REWRITE_TAC[IN; IN_ELIM_THM; rcone_gt; rconesgn] THEN STRIP_TAC);; + +e (NEW_GOAL `(?b1:real. b1 IN P3 /\ (!x. x IN P3 ==> x <= b1))`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]);; +e (EXISTS_TAC `(f3:(real^3)list -> real) vl`);; +e (EXPAND_TAC "P3" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (EXISTS_TAC `vl:(real^3)list`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X INTER (C:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`));; +e (EXPAND_TAC "D" THEN EXPAND_TAC "C");; +e (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC SUBSET_BALL);; +e (EXPAND_TAC "r" THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC RCONE_GT_SUBSET);; +e (EXPAND_TAC "d" THEN REAL_ARITH_TAC);; +e (FIRST_X_ASSUM CHOOSE_TAC);; + +e (NEW_GOAL `d1 = (@b. b IN P3 /\ (!x. x IN P3 ==> x <= b:real))`);; +e (EXPAND_TAC "d1");; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN REWRITE_TAC[]);; +e (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]);; +e (EXISTS_TAC `(f3:(real^3)list -> real) vl`);; +e (EXPAND_TAC "P3" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (EXISTS_TAC `vl:(real^3)list`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X INTER (C:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`));; +e (EXPAND_TAC "D" THEN EXPAND_TAC "C");; +e (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC SUBSET_BALL);; +e (EXPAND_TAC "r" THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC RCONE_GT_SUBSET);; +e (EXPAND_TAC "d" THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (REWRITE_TAC[]);; + +e (ABBREV_TAC `Q1 = (\b:real. b IN P3 /\ (!x. x IN P3 ==> x <= b))`);; +e (NEW_GOAL `(Q1:real->bool) d1`);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC SELECT_AX);; +e (EXISTS_TAC `b1:real` THEN EXPAND_TAC "Q1");; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN EXPAND_TAC "Q1" THEN REPEAT STRIP_TAC);; + +e (NEW_GOAL `f3 (vl:(real^3)list) <= d1`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (EXPAND_TAC "P3" THEN REWRITE_TAC[IN; IN_ELIM_THM]);; +e (EXISTS_TAC `vl:(real^3)list`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X INTER (C:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`));; +e (EXPAND_TAC "D" THEN EXPAND_TAC "C");; +e (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC SUBSET_BALL);; +e (EXPAND_TAC "r" THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC RCONE_GT_SUBSET);; +e (EXPAND_TAC "d" THEN REAL_ARITH_TAC);; + +e (UP_ASM_TAC THEN EXPAND_TAC "f3");; +e (REWRITE_TAC[EL; HD; TL; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; ASSUME `mxi V vl = m`; + ASSUME `vl= [u0; u1; u2; u3:real^3]`] THEN STRIP_TAC);; + +e (ABBREV_TAC `xx = smallest_angle_line u2 m u0 u1`);; + +e (MP_TAC (ASSUME `smallest_angle_line u2 m u0 u1 = xx`));; +e (REWRITE_TAC[smallest_angle_line; smallest_angle_set]);; +e (ABBREV_TAC `Q2 = + (\x:real^3. x IN convex hull {u2, m} /\ + (!y. y IN convex hull {u2, m} + ==> ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0))))`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN STRIP_TAC);; +e (NEW_GOAL `(Q2:real^3->bool) xx`);; +e (ONCE_ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC SELECT_AX);; +e (EXPAND_TAC "Q2");; + +e (MATCH_MP_TAC SMALLEST_ANGLE_LINE_EXISTS);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; + +e (UNDISCH_TAC `~NULLSET (X INTER D)`);; +e (REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell3; set_of_list;TRUNCATE_SIMPLEX_EXPLICIT_2; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; +e (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`);; +e (EXPAND_TAC "m");; +e (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; + +e (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (REWRITE_TAC[coplanar]);; +e (UNDISCH_TAC `u0 IN convex hull {u2, m:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC);; +e (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `m:real^3`);; +e (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`));; +e (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`);; +e (STRIP_TAC);; +e (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN VECTOR_ARITH_TAC);; +e (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (SET_TAC[]);; + +e (UP_ASM_TAC THEN EXPAND_TAC "Q2");; +e (STRIP_TAC);; +e (ABBREV_TAC `g = (\y:real^3. ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)))`);; + +e (NEW_GOAL `d < (g:real^3->real) x`);; +e (EXPAND_TAC "g");; +e (REWRITE_WITH + `d < ((x - u0) dot (u1 - u0)) / (norm (x - u0) * norm (u1 - u0:real^3)) <=> + d * (norm (x - u0) * norm (u1 - u0)) < (x - u0) dot (u1 - u0)`);; +e (MATCH_MP_TAC REAL_LT_RDIV_EQ);; +e (MATCH_MP_TAC (REAL_ARITH `&0 <= a /\ ~(a = &0) ==> &0 < a`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (ASM_REWRITE_TAC[NORM_POS_LE]);; +e (REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; VECTOR_ARITH `x - y = vec 0 <=> x = y`]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `t1 % u0 + t2 % u1 + t3 % u2 + t4 % m = u0:real^3 <=> + t1 % u0 + t2 % u1 + t3 % u2 + t4 % m = (t1 + t2 + t3 + t4) % u0`);; +e (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC);; +e (REWRITE_TAC[VECTOR_ARITH `t1 % u0 + u = (t1 + t2) % u0 <=> u = t2 % u0`]);; +e (STRIP_TAC);; + +e (MP_TAC (ASSUME `~NULLSET (X INTER D)`) THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell3;set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; +e (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`);; +e (EXPAND_TAC "m");; +e (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; + +e (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR);; +e (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4);; +e (REWRITE_TAC[affine_dependent]);; +e (EXISTS_TAC `u1:real^3`);; +e (STRIP_TAC);; +e (SET_TAC[]);; + +e (NEW_GOAL `~(u1 IN {u0, u2, m:real^3})`);; +e (STRIP_TAC);; +e (MP_TAC (ASSUME `~NULLSET (X INTER D)`) THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell3;set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; +e (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`);; +e (EXPAND_TAC "m");; +e (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (REWRITE_WITH `{u0, u1, u2, m} = {u0:real^3,u2, m}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (SET_TAC[]);; +e (REWRITE_WITH `{u0, u1, u2, m} DELETE u1 = {u0, u2, m:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `(t2 + t3 + t4) / t2`);; +e (EXISTS_TAC `(-- t3) / t2`);; +e (EXISTS_TAC `(-- t4) / t2`);; + +e (STRIP_TAC);; +e (REWRITE_WITH `(t2 + t3 + t4) / t2 + --t3 / t2 + --t4 / t2 = t2 / t2`);; +e (REAL_ARITH_TAC);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC);; +e (REWRITE_WITH + `u1 = (t2 + t3 + t4) / t2 % u0 + --t3 / t2 % u2 + --t4 / t2 % m:real^3 <=> + u1 = (&1 / t2) % ((t2 + t3 + t4) % u0 - t3 % u2 - t4 % m)`);; +e (VECTOR_ARITH_TAC);; +e (REWRITE_TAC[GSYM (ASSUME `t2 % u1 + t3 % u2 + t4 % m = + (t2 + t3 + t4) % u0:real^3`)]);; +e (REWRITE_TAC[VECTOR_ARITH + `(t2 % u1 + t3 % u2 + t4 % u3) - t3 % u2 - t4 % u3 = t2 % u1`]);; +e (REWRITE_TAC[VECTOR_MUL_ASSOC]);; +e (REWRITE_WITH `&1 / t2 * t2 = &1`);; +e (REWRITE_TAC[REAL_ARITH `&1 / t2 * t2 = t2 / t2`]);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC);; +e (VECTOR_ARITH_TAC);; +e (SET_TAC[]);; +e (REWRITE_TAC[REAL_ARITH `a * b * c < d <=> d > b * c * a`; GSYM dist]);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `g x <= (g:real^3->real) xx`);; +e (NEW_GOAL `!y. y IN convex hull {u2 , m:real^3} ==> g y <= g xx`);; +e (EXPAND_TAC "g" THEN ASM_REWRITE_TAC[]);; +e (NEW_GOAL `&0 < (t3 + t4)`);; +e (MATCH_MP_TAC (REAL_ARITH `(&0 <= x) /\ ~(x = &0) ==> &0 < x`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC REAL_LE_ADD);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (NEW_GOAL `t3 = &0 /\ t4 = &0`);; +e (UNDISCH_TAC `&0 <= t3` THEN UNDISCH_TAC `&0 <= t4` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN STRIP_TAC);; + +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `(x - u0) dot (u1 - u0:real^3) > dist (x,u0) * dist (u1,u0) * d`);; +e (REWRITE_WITH `x = t1 % u0 + t2 % u1:real^3`);; +e (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC);; +e (MATCH_MP_TAC (REAL_ARITH `a <= &0 /\ &0 <= b ==> ~(a > b)`));; +e (STRIP_TAC);; +e (REWRITE_WITH `(t1 % u0 + t2 % u1) - u0 = (t1 % u0 + t2 % u1) - + (t1 + t2 + t3 + t4) % u0:real^3`);; +e (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC);; +e (REWRITE_TAC[ASSUME `t3 = &0`; ASSUME `t4 = &0`; VECTOR_ARITH + `(t1 % u0 + t2 % u1) - (t1 + t2 + &0 + &0) % u0 = t2 % (u1 - u0)`; + DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DOT_POS_LE]);; +e (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DIST_POS_LE]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[DIST_POS_LE]);; +e (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c/\ c < &1`);; +e (REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (ABBREV_TAC `y = t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % m:real^3`);; +e (NEW_GOAL `(g:real^3->real) y <= g xx`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `t3 / (t3 + t4)` THEN EXISTS_TAC `t4 / (t3 + t4)`);; +e (REPEAT STRIP_TAC);; +e (MATCH_MP_TAC REAL_LE_DIV);; +e (ASM_SIMP_TAC[REAL_LE_ADD]);; +e (ASM_SIMP_TAC[REAL_LE_ADD; REAL_LE_DIV]);; +e (REWRITE_TAC[REAL_ARITH `a / x + b / x = (a + b) / x`]);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC);; +e (ASM_REWRITE_TAC[]);; + +e (ABBREV_TAC `w = t1 / (t1 + t3 + t4) % u0 + t3 / (t1 + t3 + t4) % u2 + + t4 / (t1 + t3 + t4) % m:real^3`);; +e (NEW_GOAL `(g:real^3->real) y = g w`);; +e (EXPAND_TAC "g");; + +e (REWRITE_WITH `y:real^3 - u0 = + &1 / (t3 + t4) % (t3 % u2 + t4 % m - (t3 + t4) % u0)`);; +e (EXPAND_TAC "y");; +e (REWRITE_TAC[VECTOR_ARITH + `(t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3) - u0 = + &1 / (t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0) <=> + (t3 + t4) / (t3 + t4) % u0 = u0`]);; +e (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC);; +e (VECTOR_ARITH_TAC);; +e (REWRITE_TAC[NORM_MUL; DOT_LMUL]);; + +e (REWRITE_WITH `w:real^3 - u0 = + &1 / (t1 + t3 + t4) % (t3 % u2 + t4 % m - (t3 + t4) % u0)`);; +e (EXPAND_TAC "w");; +e (REWRITE_TAC[VECTOR_ARITH + `(t1 / (t1 + t3 + t4) % u0 + + t3 / (t1 + t3 + t4) % u2 + t4 / (t1 + t3 + t4) % u3) - u0 = + &1 / (t1 + t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0) <=> + (t1 + t3 + t4) / (t1 + t3 + t4) % u0 = u0`]);; +e (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` + THEN REAL_ARITH_TAC);; +e (VECTOR_ARITH_TAC);; +e (REWRITE_TAC[NORM_MUL; DOT_LMUL]);; +e (REWRITE_WITH `abs (&1 / (t3 + t4)) = &1 / (t3 + t4)`);; +e (REWRITE_TAC[REAL_ABS_REFL]);; +e (ASM_SIMP_TAC[REAL_LE_DIV;REAL_LE_ADD; REAL_ARITH `&0 <= &1`]);; +e (REWRITE_WITH `abs (&1 / (t1 + t3 + t4)) = &1 / (t1 + t3 + t4)`);; +e (REWRITE_TAC[REAL_ABS_REFL]);; +e (MATCH_MP_TAC REAL_LE_DIV THEN REWRITE_TAC[REAL_ARITH `&0 <= &1`]);; +e (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` + THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[REAL_ARITH `(a * x) / ((a * y) * z) = + (a * x) / (a * (y * z))`]);; +e (ABBREV_TAC + `a1 = norm (t3 % u2 + t4 % m - (t3 + t4) % u0) * norm (u1 - u0:real^3)`);; +e (NEW_GOAL `~(a1 = &0)`);; +e (EXPAND_TAC "a1" THEN ASM_REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; + VECTOR_ARITH `(a - b = vec 0 <=> a = b)/\(a + b-c = vec 0 <=> a + b = c)`]);; +e (STRIP_TAC);; + +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `(X:real^3->bool)`);; +e (STRIP_TAC);; + +e (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; + set_of_list; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; +e (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`);; +e (EXPAND_TAC "m");; +e (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (REWRITE_TAC[coplanar]);; +e (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `m:real^3`);; +e (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`));; +e (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `&0` THEN EXISTS_TAC `t3 / (t3 + t4)` + THEN EXISTS_TAC `t4 / (t3 + t4)`);; +e (REPEAT STRIP_TAC);; +e (REWRITE_TAC[REAL_ARITH `&0 + t3 / (t3 + t4) + t4 / (t3 + t4) = + (t3 + t4) / (t3 + t4)`]);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC);; +e (ASM_REWRITE_TAC[VECTOR_ARITH + `&0 % u1 + t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3 = + (&1 / (t3 + t4)) % (t3 % u2 + t4 % u3)`]);; +e (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]);; +e (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC);; +e (VECTOR_ARITH_TAC);; +e (SET_TAC[]);; + +e (NEW_GOAL `~(&1 / (t3 + t4) = &0)`);; +e (NEW_GOAL `&0 < &1 / (t3 + t4)`);; +e (MATCH_MP_TAC REAL_LT_DIV);; +e (ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`]);; +e (UP_ASM_TAC THEN REAL_ARITH_TAC);; + +e (REWRITE_WITH + `(&1 / (t3 + t4) * ((t3 % u2 + t4 % m - (t3 + t4) % u0) dot (u1 - u0))) / + (&1 / (t3 + t4) * a1) = + ((t3 % u2 + t4 % m - (t3 + t4) % u0) dot (u1 - u0:real^3)) / a1`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[Trigonometry1.REAL_DIV_MUL2]);; + +e (NEW_GOAL `~(&1 / (t1 + t3 + t4) = &0)`);; +e (NEW_GOAL `&0 < &1 / (t1 + t3 + t4)`);; +e (MATCH_MP_TAC REAL_LT_DIV);; +e (ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`]);; +e (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN REAL_ARITH_TAC);; + +e (REWRITE_WITH + `(&1 / (t1 + t3 + t4) * ((t3 % u2 + t4 % m - (t3 + t4) % u0) dot (u1 - u0))) / + (&1 / (t1 + t3 + t4) * a1) = + ((t3 % u2 + t4 % m - (t3 + t4) % u0) dot (u1 - u0:real^3)) / a1`);; +e (UP_ASM_TAC THEN UNDISCH_TAC `~(a1 = &0)` THEN + MESON_TAC[Trigonometry1.REAL_DIV_MUL2]);; + +e (NEW_GOAL `(g:real^3->real) x <= g w`);; +e (EXPAND_TAC "g");; + +e (REWRITE_WITH + `((x - u0) dot (u1 - u0:real^3)) / (norm (x - u0) * norm (u1 - u0)) <= + ((w - u0) dot (u1 - u0)) / (norm (w - u0) * norm (u1 - u0)) <=> + ((x - u0) dot (u1 - u0)) * (norm (w - u0) * norm (u1 - u0)) <= + ((w - u0) dot (u1 - u0)) * (norm (x - u0) * norm (u1 - u0))`);; +e (MATCH_MP_TAC RAT_LEMMA4);; +e (STRIP_TAC);; +e (MATCH_MP_TAC REAL_LT_MUL);; +e (ASM_REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `x - b = vec 0 <=> x = b`]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER D)`);; +e (REWRITE_TAC[]);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `(X:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; +e (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`);; +e (EXPAND_TAC "m");; +e (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (REWRITE_TAC[coplanar]);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `m:real^3`);; +e (ONCE_REWRITE_TAC[SET_RULE `{u0, u1, u2, u3} = {u1, u0, u2, u3}`]);; +e (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`));; +e (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `(t2 + t3 + t4) / t2` THEN EXISTS_TAC `(--t3) / t2` + THEN EXISTS_TAC `(--t4) / t2`);; +e (REPEAT STRIP_TAC);; +e (REWRITE_TAC[REAL_ARITH + `(t2 + t3 + t4) / t2 + --t3 / t2 + --t4 / t2 = t2 / t2`]);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC);; +e (REWRITE_WITH `(t2 + t3 + t4) = &1 - t1`);; +e (UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC);; +e (NEW_GOAL `u0 - t1 % u0 - t3 % u2 - t4 % m:real^3 = t2 % u1`);; +e (UP_ASM_TAC THEN VECTOR_ARITH_TAC);; +e (ASM_REWRITE_TAC[VECTOR_ARITH + `(&1 - t1) / t2 % u0 + --t3 / t2 % u2 + --t4 / t2 % u3 = + (&1 / t2) % (u0 - t1 % u0 - t3 % u2 - t4 % u3)`]);; +e (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]);; +e (REWRITE_WITH `t2 / t2 = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC);; +e (VECTOR_ARITH_TAC);; +e (SET_TAC[]);; + +e (MATCH_MP_TAC REAL_LT_MUL);; +e (ASM_REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `x - b = vec 0 <=> x = b`]);; +e (EXPAND_TAC "w" THEN STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER D)`);; +e (REWRITE_TAC[]);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `(X:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; +e (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`);; +e (EXPAND_TAC "m");; +e (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (REWRITE_TAC[coplanar]);; +e (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `m:real^3`);; +e (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`));; +e (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]);; + +e (EXISTS_TAC `&0` THEN EXISTS_TAC `t3 / (t3 + t4)` + THEN EXISTS_TAC `t4 / (t3 + t4)`);; +e (REPEAT STRIP_TAC);; +e (REWRITE_TAC[REAL_ARITH `&0 + t3 / (t3 + t4) + t4 / (t3 + t4) = + (t3 + t4) / (t3 + t4)`]);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC);; +e (ASM_REWRITE_TAC[VECTOR_ARITH + `&0 % u1 + t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3 = + (&1 / (t3 + t4)) % (t3 % u2 + t4 % u3)`]);; +e (UP_ASM_TAC THEN REWRITE_TAC[VECTOR_ARITH + `t1 / x % u0 + t3 / x % u2 + t4 / x % u3 = + (&1 / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]);; +e (REWRITE_WITH `&1 / (t1 + t3 + t4) % (t1 % u0 + t3 % u2 + t4 % m) = u0 <=> + t1 % u0 + t3 % u2 + t4 % m = (t1 + t3 + t4) % u0:real^3`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Collect_geom.CHANGE_SIDE);; +e (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 +t3 + t4 = &1` THEN + REAL_ARITH_TAC);; + +e (REWRITE_TAC[VECTOR_ARITH `t1 % u0 + t3 % u2 + t4 % u3 = (t1 + t3 + t4) % u0 + <=> t3 % u2 + t4 % u3 = (t3 + t4) % u0`]);; +e (STRIP_TAC THEN ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]);; +e (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC);; +e (VECTOR_ARITH_TAC);; +e (SET_TAC[]);; + +e (REWRITE_WITH `x = t2 % u1 + (t1 + t3 + t4) % w:real^3`);; +e (ASM_REWRITE_TAC[] THEN EXPAND_TAC "w");; +e (REWRITE_TAC[VECTOR_ARITH + `x % (t1 /x % u0 + t3 / x % u2 + t4 /x % u3) = + (x / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]);; +e (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC);; +e (VECTOR_ARITH_TAC);; +e (ABBREV_TAC `t = t1 + t3 + t4`);; +e (REWRITE_WITH `(t2 % u1 + t % w) - u0:real^3 = + (t2 % u1 + t % w) - (t1 + t2 + t3 + t4) % u0`);; +e (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC);; +e (REWRITE_WITH `t1 + t2 + t3 + t4 = t2 + t:real`);; +e (EXPAND_TAC "t" THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[VECTOR_ARITH + `(t2 % u1 + t % w) - (t2 + t) % u0 = t2 % (u1 - u0) + t % (w - u0)`]);; +e (ABBREV_TAC `x1 = u1 - u0:real^3`);; +e (ABBREV_TAC `x2 = w - u0:real^3`);; + +e (REWRITE_WITH `(t2 % x1 + t % x2) dot x1 = + t2 * norm x1 pow 2 + t * x2 dot (x1:real^3)`);; +e (REWRITE_TAC[NORM_POW_2]);; +e (VECTOR_ARITH_TAC);; + +e (NEW_GOAL `t2 * norm x1 pow 2 * norm x2 * norm x1 <= + t2 * (x2 dot x1) * norm x1 * norm (x1:real^3)`);; +e (REWRITE_TAC[REAL_POW_2; REAL_ARITH `t2 * (x1 * x1) * x2 * x1 <= + t2 * x3 * x1 * x1 <=> &0 <= (x1 pow 2) * (--t2) * (x2 * x1 - x3)`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (ASM_SIMP_TAC[REAL_LE_MUL; NORM_POS_LE]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[NORM_CAUCHY_SCHWARZ]);; + +e (NEW_GOAL + `t2 * (x2 dot x1) * norm x1 * norm x1 + t * (x2 dot x1) * norm x2 * norm x1 <= (x2 dot x1) * norm (t2 % x1 + t % x2) * norm (x1:real^3)`);; + +e (REWRITE_TAC[REAL_ARITH `t2 * x3 * x1 * x1 + t * x3 * x2 * x1 <= + x3 * x4 * x1 <=> &0 <= (x1 * x3) * (x4 - t2 * x1 - t * x2)`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (STRIP_TAC);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (REWRITE_TAC[NORM_POS_LE]);; +e (ASM_CASES_TAC `x2 dot (x1:real^3) < &0`);; +e (NEW_GOAL `F`);; +e (NEW_GOAL `(g:real^3->real) x <= &0`);; +e (EXPAND_TAC "g");; +e (REWRITE_TAC[REAL_ARITH `a / b <= &0 <=> &0 <= (--a) / b`]);; +e (MATCH_MP_TAC REAL_LE_DIV);; +e (SIMP_TAC[NORM_POS_LE; REAL_LE_MUL]);; + +e (REWRITE_WITH `x = t2 % u1 + (t1 + t3 + t4) % w:real^3`);; +e (ASM_REWRITE_TAC[] THEN EXPAND_TAC "w");; +e (REWRITE_TAC[VECTOR_ARITH + `x % (t1 /x % u0 + t3 / x % u2 + t4 /x % u3) = + (x / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]);; +e (EXPAND_TAC "t");; +e (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC);; +e (VECTOR_ARITH_TAC);; + +e (REWRITE_TAC[REAL_ARITH `&0 <= --a <=> a <= &0`]);; +e (REWRITE_WITH `(t2 % u1 + (t1 + t3 + t4) % w) - u0:real^3 = + (t2 % u1 + (t1 + t3 + t4) % w) - (t1 + t2 + t3 + t4) % u0`);; +e (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC);; +e (REWRITE_WITH `(t2 % u1 + (t1 + t3 + t4) % w) - (t1 + t2 + t3 + t4) % u0 = + t2 % x1 + t % x2:real^3`);; +e (EXPAND_TAC "x1" THEN EXPAND_TAC "x2" THEN EXPAND_TAC "t" + THEN VECTOR_ARITH_TAC);; +e (NEW_GOAL `t % x2 dot (x1:real^3) <= &0`);; +e (REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= a * (--b)`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (STRIP_TAC);; +e (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (NEW_GOAL `t2 % x1 dot (x1:real^3) <= &0`);; +e (REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]);; +e (MATCH_MP_TAC REAL_LE_MUL);; +e (STRIP_TAC);; +e (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[DOT_POS_LE]);; +e (REWRITE_TAC[DOT_LADD]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN UNDISCH_TAC `d < (g:real^3->real) x`);; +e (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1`);; +e (REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN REAL_ARITH_TAC);; + +e (REWRITE_TAC [REAL_ARITH `&0 <= a - b * d - c <=> c <= a + (--b) * d`]);; +e (REWRITE_WITH `t * norm (x2:real^3) = abs t * norm x2`);; +e (AP_THM_TAC THEN AP_TERM_TAC);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (REWRITE_TAC[REAL_ABS_REFL]);; +e (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC);; +e (REWRITE_WITH `(--t2) * norm (x1:real^3) = abs (--t2) * norm x1`);; +e (AP_THM_TAC THEN AP_TERM_TAC);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (REWRITE_TAC[REAL_ABS_REFL]);; +e (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[GSYM NORM_MUL]);; +e (REWRITE_WITH + `norm (t % x2:real^3) = norm ((t2 % x1 + t % x2) + (--t2 % x1))`);; +e (AP_TERM_TAC THEN VECTOR_ARITH_TAC);; +e (REWRITE_TAC[NORM_TRIANGLE]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UNDISCH_TAC `(g:real^3->real) y <= g xx`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; + +e (NEW_GOAL `(g:real^3->real) xx <= d1`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (EXPAND_TAC "P3");; +e (EXPAND_TAC "g" THEN EXPAND_TAC "f3");; +e (REWRITE_TAC[IN_ELIM_THM; IN]);; +e (EXISTS_TAC `vl:(real^3)list`);; +e (REWRITE_TAC[ASSUME `barV V 3 vl`; ASSUME `vl = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1]);; +e (STRIP_TAC);; +e (SIMP_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]);; +e (REWRITE_WITH `mcell 3 V vl = mcell k V vl`);; +e (ASM_SIMP_TAC[]);; +e (REWRITE_TAC[GSYM (ASSUME `X = mcell k V vl`)]);; +e (STRIP_TAC);; + +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X INTER (C:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`));; +e (EXPAND_TAC "D" THEN EXPAND_TAC "C");; +e (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC SUBSET_BALL);; +e (EXPAND_TAC "r" THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC RCONE_GT_SUBSET);; +e (EXPAND_TAC "d" THEN REAL_ARITH_TAC);; + +e (EXPAND_TAC "xx");; +e (SIMP_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]);; +e (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`);; +e (EXPAND_TAC "m");; +e (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]);; + +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN EXPAND_TAC "d");; +e (REAL_ARITH_TAC);; + +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `(X:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; + set_of_list; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (SET_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +(* ========================================================================= *) + +e (ABBREV_TAC `m = mxi V vl`);; +e (NEW_GOAL `~coplanar {u0, u1, u2, m:real^3}`);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X:real^3->bool`);; +e (STRIP_TAC);; +e (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; set_of_list]);; +e (COND_CASES_TAC);; +e (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; +e (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`);; +e (EXPAND_TAC "m");; +e (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (ASM_REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (SET_TAC[]);; + +e (ASM_CASES_TAC `azim u0 u1 u2 (m:real^3) < pi`);; +e (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 u2 m)`);; +e (ASM_SIMP_TAC[WEDGE_LUNE]);; +e (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`);; +e (SET_TAC[]);; +e (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF);; +e (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {u2, m} DIFF conic_cap u0 u1 r d INTER L = {}`);; +e (EXPAND_TAC "L");; +e (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`));; +e (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]);; +e (REWRITE_TAC[SET_RULE `A UNION {} = A`]);; +e (EXPAND_TAC "L");; + +e (REWRITE_WITH `aff_ge {u0, u1:real^3} {u2, m} = + aff_gt {u0, u1} {u2, m} UNION + UNIONS {aff_ge {u0, u1} ({u2, m} DELETE a) | a | a IN {u2, m}}`);; +e (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP);; +e (REWRITE_TAC[Geomdetail.FINITE6]);; +e (REWRITE_TAC[DISJOINT]);; + +e (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`);; +e (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, m:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (ASM_CASES_TAC `m IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`);; +e (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, u2:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({u2, m} DELETE a) | a | a IN {u2, m}}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC + `aff_ge {u0, u1:real^3} {u2} UNION aff_ge {u0, u1:real^3} {m}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_UNION);; +e (STRIP_TAC);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1:real^3, u2}`);; +e (STRIP_TAC);; +e (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]);; +e (REWRITE_WITH `{u0,u1,u2:real^3} = {u0,u1} UNION {u2}`);; +e (SET_TAC[]);; +e (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1:real^3, m}`);; +e (STRIP_TAC);; +e (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]);; +e (REWRITE_WITH `{u0,u1,m:real^3} = {u0,u1} UNION {m}`);; +e (SET_TAC[]);; +e (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]);; +e (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC AFF_GE_MONO_RIGHT);; +e (STRIP_TAC);; +e (SET_TAC[]);; + +e (REWRITE_TAC[DISJOINT]);; +e (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`);; +e (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, m:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN SET_TAC[]);; + +e (MATCH_MP_TAC AFF_GE_MONO_RIGHT);; +e (STRIP_TAC);; +e (SET_TAC[]);; +e (REWRITE_TAC[DISJOINT]);; +e (ASM_CASES_TAC `m IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`);; +e (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, u2:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN SET_TAC[]);; + +e (SET_TAC[]);; + +(* begin the computation *) + +e (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]);; +e (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 u2 m) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 u2 m / &3 * (&1 - max d (-- &1)) * r pow 3)`);; +e (NEW_GOAL `~collinear {u0:real^3, u1, u2} /\ ~collinear {u0, u1, m}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `m:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `u2:real^3`);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]);; +e (ASM_REWRITE_TAC[]);; +e (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]);; + +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (REWRITE_WITH `azim (u0:real^3) u1 u2 m = dihV u0 u1 u2 m`);; +e (MATCH_MP_TAC AZIM_DIHV_SAME);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `m:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `u2:real^3`);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[dihX]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET (X INTER D)`);; +e (REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X:real^3->bool`);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (LET_TAC);; + +e (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]);; +e (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`);; +e (STRIP_TAC);; +e (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`);; +e (MATCH_MP_TAC SELECT_AX);; +e (EXISTS_TAC `(3, vl:(real^3)list)`);; +e (EXPAND_TAC "P");; +e (REWRITE_TAC[BETA_THM]);; +e (REWRITE_TAC[IN; ARITH_RULE `3 <= 4`] THEN ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `initial_sublist [u0;u1:real^3] [u0; u1; u2; u3] /\ + LENGTH [u0;u1] = 1 + 1`);; +e (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]);; +e (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (UP_ASM_TAC THEN ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC);; + +e (NEW_GOAL `k' = 3 /\ mcell k' V ul = mcell 3 V vl`);; +e (MATCH_MP_TAC Ajripqn.AJRIPQN);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]);; +e (REWRITE_WITH `mcell k' V ul INTER mcell 3 V vl = X`);; +e (REWRITE_WITH `mcell 3 V vl = X`);; +e (ASM_SIMP_TAC[]);; +e (SET_TAC[ASSUME `X = mcell k' V ul`]);; + +e (REPEAT STRIP_TAC);; +e (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]);; +e (SET_TAC[]);; +e (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[]);; + +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (COND_CASES_TAC);; + +e (REWRITE_TAC[dihu3]);; + +e (REWRITE_WITH `dihV (EL 0 ul) (EL 1 ul) (EL 2 ul) (mxi V ul) = + dihV u0 u1 u2 (m:real^3)`);; + +e (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`);; +e (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]);; +e (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC);; + +e (NEW_GOAL `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX);; +e (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; + +e (NEW_GOAL `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX);; +e (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; + +e (NEW_GOAL `{EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = {u0, u1,u2,m:real^3}`);; +e (REWRITE_WITH ` + {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = {u0, u1,u2,m:real^3} <=> + convex hull {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = + convex hull {u0, u1,u2,m:real^3}`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ);; +e (REPEAT STRIP_TAC);; + +e (UNDISCH_TAC `~NULLSET X`);; +e (REWRITE_TAC[]);; +e (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (ASM_REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_2; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {v0, v1, v2, mxi V [v0; v1; v2; v3]}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR);; +e (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4);; +e (UNDISCH_TAC `affine_dependent {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul}`);; +e (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]);; + +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; + +e (UNDISCH_TAC `~NULLSET X`);; +e (REWRITE_TAC[]);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; +e (COND_CASES_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, u2, mxi V [u0; u1; u2; u3]}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR);; +e (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4);; +e (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`);; +e (EXPAND_TAC "m");; +e (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; + +e (REWRITE_WITH `convex hull {u0, u1, u2, m:real^3} = X`);; +e (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; set_of_list]);; +e (COND_CASES_TAC);; +e (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; +e (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`);; +e (EXPAND_TAC "m");; +e (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]);; + +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET X`);; +e (REWRITE_TAC[]);; +e (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; set_of_list]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (REWRITE_TAC[set_of_list; ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; +e (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET X`);; +e (REWRITE_TAC[]);; +e (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (UP_ASM_TAC THEN ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `1 = SUC 0`]);; + +e (NEW_GOAL `mxi V ul = m`);; +e (EXPAND_TAC "m");; +e (MATCH_MP_TAC MCELL_ID_MXI);; +e (EXISTS_TAC `k':num` THEN EXISTS_TAC `k:num`);; +e (ASM_REWRITE_TAC[SET_RULE `3 IN {2, 3}`]);; +e (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[HD]);; +e (REWRITE_WITH `HD (ul) = (HD (truncate_simplex 1 ul)):real^3`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX);; +e (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; +e (ASM_REWRITE_TAC[HD]);; +e (ASM_REWRITE_TAC[]);; + +e (STRIP_TAC);; +e (NEW_GOAL `EL 2 ul = u2:real^3`);; +e (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`));; +e (STRIP_TAC);; +e (NEW_GOAL `{u0, u1, EL 2 ul, m} = {u0, u1, m:real^3}`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (UNDISCH_TAC `~coplanar {u0,u1,u2,m:real^3}` THEN REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, m} = {u0, u1, u2, m:real^3}`); + ASSUME `{u0, u1, EL 2 ul, m} = {u0, u1, m:real^3}`; COPLANAR_3]);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]);; +e (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]);; +e (AP_THM_TAC THEN AP_TERM_TAC);; + +e (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`);; +e (MATCH_MP_TAC VOLUME_CONIC_CAP);; +e (EXPAND_TAC "d");; +e (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN MESON_TAC[]);; +e (UNDISCH_TAC `d < &1` THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]);; + +e (REWRITE_WITH `max d (--(&1)) = d`);; +e (MATCH_MP_TAC (REAL_ARITH `&0 < d /\ --(&1) < &0 ==> max d (--(&1)) = d`));; +e (REWRITE_TAC[REAL_NEG_LT0]);; +e (STRIP_TAC);; +e (EXPAND_TAC "d");; +e (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC);; +e (REAL_ARITH_TAC);; + +e (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`);; +e (REAL_ARITH_TAC);; +e (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]);; +e (REAL_ARITH_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN UNDISCH_TAC `k' = 3 /\ mcell k' V ul = mcell 3 V vl` + THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +(* ========================================================================= *) + +e (ASM_CASES_TAC `azim u0 u1 m (u2:real^3) < pi`);; +e (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]);; +e (STRIP_TAC);; +e (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 m u2)`);; +e (ASM_SIMP_TAC[WEDGE_LUNE]);; +e (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`);; +e (SET_TAC[]);; +e (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF);; + +e (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {m, u2} DIFF conic_cap u0 u1 r d INTER L = {}`);; +e (EXPAND_TAC "L");; +e (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]);; +e (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`));; +e (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]);; +e (REWRITE_TAC[SET_RULE `A UNION {} = A`]);; +e (EXPAND_TAC "L");; +e (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]);; + +e (REWRITE_WITH `aff_ge {u0, u1:real^3} {m, u2} = + aff_gt {u0, u1} {m, u2} UNION + UNIONS {aff_ge {u0, u1} ({m, u2} DELETE a) | a | a IN {m, u2}}`);; +e (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP);; +e (REWRITE_TAC[Geomdetail.FINITE6]);; +e (REWRITE_TAC[DISJOINT]);; + +e (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, m, u2:real^3}`);; +e (REWRITE_WITH `{u0, u1, m, u2} = {u0, u1, m:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (ASM_CASES_TAC `m IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, m, u2:real^3}`);; +e (REWRITE_WITH `{u0, u1, m, u2} = {u0, u1, u2:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({m, u2} DELETE a) | a | a IN {m, u2}}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC + `aff_ge {u0, u1:real^3} {u2} UNION aff_ge {u0, u1:real^3} {m}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_UNION);; +e (STRIP_TAC);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1:real^3, u2}`);; +e (STRIP_TAC);; +e (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]);; +e (REWRITE_WITH `{u0,u1,u2:real^3} = {u0,u1} UNION {u2}`);; +e (SET_TAC[]);; +e (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1:real^3, m}`);; +e (STRIP_TAC);; +e (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]);; +e (REWRITE_WITH `{u0,u1,m:real^3} = {u0,u1} UNION {m}`);; +e (SET_TAC[]);; +e (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]);; +e (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]);; +e (MATCH_MP_TAC (SET_RULE + `A SUBSET D /\ C SUBSET B ==> A UNION C SUBSET B UNION D`));; +e (STRIP_TAC);; +e (MATCH_MP_TAC AFF_GE_MONO_RIGHT);; +e (STRIP_TAC);; +e (SET_TAC[]);; + +e (REWRITE_TAC[DISJOINT]);; +e (ASM_CASES_TAC `m IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, m, u2:real^3}`);; +e (REWRITE_WITH `{u0, u1, m, u2} = {u0, u1, u2:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN SET_TAC[]);; + +e (MATCH_MP_TAC AFF_GE_MONO_RIGHT);; +e (STRIP_TAC);; +e (SET_TAC[]);; +e (REWRITE_TAC[DISJOINT]);; +e (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, m, u2:real^3}`);; +e (REWRITE_WITH `{u0, u1, m, u2} = {u0, u1, m:real^3}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[COPLANAR_3]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN SET_TAC[]);; + +e (SET_TAC[]);; + +e (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]);; +e (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 m u2) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 m u2 / &3 * (&1 - max d (-- &1)) * r pow 3)`);; +e (NEW_GOAL `~collinear {u0:real^3, u1, u2} /\ ~collinear {u0, u1, m}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `m:real^3`);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `u2:real^3`);; +e (ASM_REWRITE_TAC[]);; + +e (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; + +e (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (REWRITE_WITH `azim (u0:real^3) u1 m u2 = dihV u0 u1 m u2`);; +e (MATCH_MP_TAC AZIM_DIHV_SAME);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; + +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `u2:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `m:real^3`);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[dihX]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET (X INTER D)`);; +e (REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X:real^3->bool`);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (LET_TAC);; + +e (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]);; +e (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`);; +e (STRIP_TAC);; +e (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`);; +e (MATCH_MP_TAC SELECT_AX);; +e (EXISTS_TAC `(3, vl:(real^3)list)`);; +e (EXPAND_TAC "P");; +e (REWRITE_TAC[BETA_THM]);; +e (REWRITE_TAC[IN; ARITH_RULE `3 <= 4`] THEN ASM_REWRITE_TAC[]);; + +e (REWRITE_WITH `initial_sublist [u0;u1:real^3] [u0; u1; u2; u3] /\ + LENGTH [u0;u1] = 1 + 1`);; +e (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]);; +e (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[LENGTH] THEN ARITH_TAC);; +e (UP_ASM_TAC THEN ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC);; + +e (NEW_GOAL `k' = 3 /\ mcell k' V ul = mcell 3 V vl`);; +e (MATCH_MP_TAC Ajripqn.AJRIPQN);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]);; +e (REWRITE_WITH `mcell k' V ul INTER mcell 3 V vl = X`);; +e (REWRITE_WITH `mcell 3 V vl = X`);; +e (ASM_SIMP_TAC[]);; +e (SET_TAC[ASSUME `X = mcell k' V ul`]);; + +e (REPEAT STRIP_TAC);; +e (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]);; +e (SET_TAC[]);; +e (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[]);; + +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (COND_CASES_TAC);; + +e (REWRITE_TAC[dihu3]);; + +e (REWRITE_WITH `dihV (EL 0 ul) (EL 1 ul) (EL 2 ul) (mxi V ul) = + dihV u0 u1 u2 (m:real^3)`);; + +e (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`);; +e (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]);; +e (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC);; + +e (NEW_GOAL `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX);; +e (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; + +e (NEW_GOAL `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX);; +e (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; + +e (NEW_GOAL `{EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = {u0, u1,u2,m:real^3}`);; +e (REWRITE_WITH ` + {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = {u0, u1,u2,m:real^3} <=> + convex hull {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = + convex hull {u0, u1,u2,m:real^3}`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ);; +e (REPEAT STRIP_TAC);; + +e (UNDISCH_TAC `~NULLSET X`);; +e (REWRITE_TAC[]);; +e (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (ASM_REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_2; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {v0, v1, v2, mxi V [v0; v1; v2; v3]}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR);; +e (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4);; +e (UNDISCH_TAC `affine_dependent {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul}`);; +e (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]);; + +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; + +e (UNDISCH_TAC `~NULLSET X`);; +e (REWRITE_TAC[]);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; +e (COND_CASES_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, u2, mxi V [u0; u1; u2; u3]}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR);; +e (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4);; +e (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`);; +e (EXPAND_TAC "m");; +e (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; + +e (REWRITE_WITH `convex hull {u0, u1, u2, m:real^3} = X`);; +e (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; set_of_list]);; +e (COND_CASES_TAC);; +e (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; +e (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`);; +e (EXPAND_TAC "m");; +e (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]);; + +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET X`);; +e (REWRITE_TAC[]);; +e (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; set_of_list]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (REWRITE_TAC[set_of_list; ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; +e (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET X`);; +e (REWRITE_TAC[]);; +e (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (UP_ASM_TAC THEN ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `1 = SUC 0`]);; + +e (NEW_GOAL `mxi V ul = m`);; +e (EXPAND_TAC "m");; +e (MATCH_MP_TAC MCELL_ID_MXI);; +e (EXISTS_TAC `k':num` THEN EXISTS_TAC `k:num`);; +e (ASM_REWRITE_TAC[SET_RULE `3 IN {2, 3}`]);; +e (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[HD]);; +e (REWRITE_WITH `HD (ul) = (HD (truncate_simplex 1 ul)):real^3`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX);; +e (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; +e (ASM_REWRITE_TAC[HD]);; +e (ASM_REWRITE_TAC[]);; + +e (STRIP_TAC);; +e (NEW_GOAL `EL 2 ul = u2:real^3`);; +e (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`));; +e (STRIP_TAC);; +e (NEW_GOAL `{u0, u1, EL 2 ul, m} = {u0, u1, m:real^3}`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (UNDISCH_TAC `~coplanar {u0,u1,m,u2:real^3}`);; +e (REWRITE_TAC[]);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]);; +e (REWRITE_TAC[GSYM (ASSUME `{u0, u1, EL 2 ul, m} = {u0, u1, u2, m:real^3}`); + ASSUME `{u0, u1, EL 2 ul, m} = {u0, u1, m:real^3}`; COPLANAR_3]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[DIHV_SYM_2]);; + +e (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]);; +e (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]);; +e (AP_THM_TAC THEN AP_TERM_TAC);; + +e (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`);; +e (MATCH_MP_TAC VOLUME_CONIC_CAP);; +e (EXPAND_TAC "d");; +e (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN MESON_TAC[]);; +e (UNDISCH_TAC `d < &1` THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]);; + +e (REWRITE_WITH `max d (--(&1)) = d`);; +e (MATCH_MP_TAC (REAL_ARITH `&0 < d /\ --(&1) < &0 ==> max d (--(&1)) = d`));; +e (REWRITE_TAC[REAL_NEG_LT0]);; +e (STRIP_TAC);; +e (EXPAND_TAC "d");; +e (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC);; +e (REAL_ARITH_TAC);; + +e (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`);; +e (REAL_ARITH_TAC);; +e (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]);; +e (REAL_ARITH_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN UNDISCH_TAC `k' = 3 /\ mcell k' V ul = mcell 3 V vl` + THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +(* ========================================================================= *) + +e (NEW_GOAL `F`);; +e (NEW_GOAL `azim (u0:real^3) u1 m u2 = + (if azim u0 u1 u2 m = &0 then &0 else &2 * pi - azim u0 u1 u2 m)`);; +e (MATCH_MP_TAC AZIM_COMPL);; +e (STRIP_TAC);; + +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `m:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `u2:real^3`);; +e (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b, d, c}`]);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (NEW_GOAL `(&0 < pi)`);; +e (REWRITE_TAC[PI_POS]);; +e (UNDISCH_TAC `~(azim (u0:real^3) u1 u2 m < pi)`);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (STRIP_TAC);; + +e (NEW_GOAL `azim (u0:real^3) u1 u2 m = pi`);; +e (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`);; +e (REWRITE_TAC[] THEN MATCH_MP_TAC AZIM_EQ_0_PI_IMP_COPLANAR);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +(* ========================================================================= *) +(* ========================================================================= *) + +(* ========================================================================= *) +(* ========================================================================= *) + +e (ABBREV_TAC `E = D INTER wedge_ge u0 u1 n1 n2`);; +e (ABBREV_TAC + `s = {X | mcell_set V X /\ edgeX V X e /\ X SUBSET wedge_ge u0 u1 n1 n2}`);; +e (NEW_GOAL `sum s (\t. vol (t INTER E)) = vol (E)`);; +e (ABBREV_TAC `f = (\t:real^3->bool. t INTER E)`);; +e (REWRITE_WITH `(\t. vol (t INTER E)) = (\x:real^3->bool. vol (f x))`);; +e (EXPAND_TAC "f");; +e (REWRITE_TAC[]);; +e (REWRITE_WITH `sum s (\x:real^3->bool. vol (f x)) = vol (UNIONS (IMAGE f s))`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC MEASURE_NEGLIGIBLE_UNIONS_IMAGE);; +e (REPEAT STRIP_TAC);; + +e (EXPAND_TAC "s");; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `{X | mcell_set V X /\ edgeX V X e}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC FINITE_EDGE_X2);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (SET_TAC[]);; + +e (EXPAND_TAC "f");; +e (MATCH_MP_TAC MEASURABLE_INTER);; +e (STRIP_TAC);; +e (UP_ASM_TAC THEN EXPAND_TAC "s");; +e (REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (ASM_SIMP_TAC[MEASURABLE_MCELL]);; +e (EXPAND_TAC "E");; +e (REWRITE_TAC[ASSUME `D:real^3->bool = conic_cap u0 u1 r d`]);; +e (REWRITE_TAC[MEASURABLE_CONIC_CAP_WEDGE_GE]);; + + +e (EXPAND_TAC "f");; +e (UNDISCH_TAC `(x:real^3->bool) IN s` THEN + UNDISCH_TAC `(y:real^3->bool) IN s` THEN EXPAND_TAC "s");; +e (REWRITE_TAC[mcell_set_2; IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `x INTER (y:real^3->bool)`);; +e (ASM_REWRITE_TAC[SET_RULE `(x INTER D) INTER y INTER D SUBSET x INTER y`]);; +e (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`));; +e (STRIP_TAC);; + +e (NEW_GOAL `i' = i /\ mcell i' V ul' = mcell i V ul`);; +e (MATCH_MP_TAC Ajripqn.AJRIPQN);; +e (ASM_REWRITE_TAC[SET_RULE `i IN {0, 1, 2, 3, 4} <=> + i = 0 \/ i = 1 \/ i = 2 \/ i = 3 \/ i = 4`]);; +e (UNDISCH_TAC `i <= 4` THEN UNDISCH_TAC `i' <= 4` THEN ARITH_TAC);; +e (UNDISCH_TAC `~(x = y:real^3->bool)` THEN ASM_REWRITE_TAC[]);; + +e (EXPAND_TAC "s");; +e (EXPAND_TAC "f" THEN REWRITE_TAC[IMAGE]);; + + +e (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF);; +e (REWRITE_WITH + `UNIONS + {y | ?x. x IN + {X | mcell_set V X /\ edgeX V X e /\ X SUBSET wedge_ge u0 u1 n1 n2} /\ + y = x INTER E} DIFF E = {}`);; +e (REWRITE_TAC[SET_RULE `A DIFF B = {} <=> A SUBSET B`]);; +e (REWRITE_TAC[UNIONS_SUBSET; IN; IN_ELIM_THM]);; +e (SET_TAC[]);; +e (REWRITE_TAC[SET_RULE `{} UNION A = A`]);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `UNIONS {y | ?x. x IN {X | mcell_set V X /\ NULLSET (X INTER E) /\ + ~(X INTER E = {})} /\ y = x INTER E}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_UNIONS);; +e (STRIP_TAC);; +e (REWRITE_WITH + `{y | ?x. x IN + {X | mcell_set V X /\ NULLSET (X INTER E) /\ ~(X INTER E = {})} /\ + y = x INTER E} = + {y | ?x. x IN + {X | mcell_set V X /\ NULLSET (X INTER E) /\ ~(X INTER E = {})} /\ + y = f x}`);; +e (EXPAND_TAC "f" THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC FINITE_IMAGE_EXPAND);; + +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `{X | X SUBSET ball (u0, &10) /\ mcell_set V X}`);; +e (STRIP_TAC);; +e (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA_2]);; +e (REWRITE_TAC[SUBSET; IN_BALL; IN; IN_ELIM_THM; mcell_set] THEN + REPEAT STRIP_TAC);; + +e (NEW_GOAL `?v1:real^3. v1 IN x /\ v1 IN D`);; +e (REWRITE_TAC[GSYM IN_INTER]);; +e (UNDISCH_TAC `~(x:real^3->bool INTER E = {})` THEN EXPAND_TAC "E" THEN SET_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (NEW_GOAL `dist (u0, x') <= dist (u0, v1:real^3) + dist (v1, x')`);; +e (NORM_ARITH_TAC);; +e (NEW_GOAL `dist (u0, v1:real^3) < &1`);; +e (REWRITE_TAC[GSYM IN_BALL]);; +e (NEW_GOAL `D SUBSET ball (u0:real^3, &1)`);; +e (EXPAND_TAC "D");; +e (NEW_GOAL `ball (u0, r) SUBSET ball (u0:real^3, &1)`);; +e (MATCH_MP_TAC SUBSET_BALL);; +e (EXPAND_TAC "r" THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (UP_ASM_TAC THEN UNDISCH_TAC `v1:real^3 IN D` THEN SET_TAC[]);; +e (NEW_GOAL `dist (v1,x':real^3) < &8`);; +e (REWRITE_TAC[GSYM IN_BALL]);; + +e (NEW_GOAL `x SUBSET ball (v1:real^3, &8)`);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC MCELL_SUBSET_BALL8);; +e (REWRITE_TAC[GSYM (ASSUME `x = mcell i V ul`)] THEN ASM_REWRITE_TAC[]);; +e (UNDISCH_TAC `(x:real^3->bool) x'` THEN UP_ASM_TAC THEN SET_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (EXISTS_TAC `i:num` THEN EXISTS_TAC `ul:(real^3)list`);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (REWRITE_TAC[ASSUME `t:real^3->bool = x INTER E`]);; +e (ASM_REWRITE_TAC[]);; + +(* ========================================================================= *) + +e (REWRITE_TAC[SUBSET; IN_UNIONS]);; +e (REPEAT STRIP_TAC);; + +e (NEW_GOAL `?v:real^3. v IN V /\ x IN voronoi_closed V v`);; +e (ASM_SIMP_TAC[TIWWFYQ]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (UP_ASM_TAC THEN REWRITE_WITH + `x IN voronoi_closed V v <=> (?vl. vl IN barV V 3 /\ x IN rogers V vl /\ + truncate_simplex 0 vl = [v])`);; +e (ASM_SIMP_TAC[GLTVHUM]);; +e (REWRITE_TAC[IN] THEN STRIP_TAC);; +e (NEW_GOAL `?i. i <= 4 /\ x IN mcell i V vl`);; +e (ASM_SIMP_TAC[IN;SLTSTLO1]);; +e (UP_ASM_TAC THEN STRIP_TAC);; + +e (ABBREV_TAC `X = mcell i V vl`);; +e (NEW_GOAL `~NULLSET (X INTER E) ==> F`);; +e (STRIP_TAC);; + +e (NEW_GOAL `?k ul. + 2 <= k /\ + barV V 3 ul /\ + X = mcell k V ul /\ + truncate_simplex 1 ul = [u0; u1]`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (STRIP_TAC);; +e (REWRITE_TAC[mcell_set; IN_ELIM_THM; IN]);; +e (EXISTS_TAC `i:num` THEN EXISTS_TAC `vl:(real^3)list`);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER E)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `X INTER (D:real^3->bool)`);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "E" THEN SET_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; + +e (MP_TAC (ASSUME `x IN + E DIFF + UNIONS + {y | ?x. x IN + {X | mcell_set V X /\ + edgeX V X e /\ + (!x. x IN X ==> x IN wedge_ge u0 u1 n1 n2)} /\ + y = x INTER E}`));; +e (REWRITE_TAC[IN_DIFF; MESON[] `~(A /\ ~B) <=> ~A \/ B`]);; +e (DISJ2_TAC);; +e (REWRITE_TAC[IN_UNIONS; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `X INTER (E:real^3->bool)`);; +e (STRIP_TAC);; + +e (EXISTS_TAC `(X:real^3->bool)`);; +e (REWRITE_TAC[mcell_set; IN; IN_ELIM_THM] THEN STRIP_TAC);; +e (EXISTS_TAC `i:num` THEN EXISTS_TAC `vl:(real^3)list`);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[edgeX; IN_ELIM_THM]);; +e (STRIP_TAC);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`);; +e (STRIP_TAC);; + +e (NEW_GOAL `VX V X = V INTER X`);; +e (MATCH_MP_TAC Hdtfnfz.HDTFNFZ);; +e (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `(if k < 4 then k else 4)`);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (COND_CASES_TAC);; +e (MESON_TAC[]);; +e (NEW_GOAL `k >= 4`);; +e (UP_ASM_TAC THEN ARITH_TAC);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ]);; +e (UNDISCH_TAC `~NULLSET (X INTER E)` THEN ASM_REWRITE_TAC[]);; +e (MESON_TAC[NEGLIGIBLE_SUBSET; SET_RULE `A INTER B SUBSET A`]);; + +e (NEW_GOAL `(V:real^3->bool) INTER X = + set_of_list (truncate_simplex ((if k < 4 then k else 4) - 1) ul)`);; +e (REWRITE_WITH `X = mcell (if k < 4 then k else 4) V ul`);; +e (ASM_REWRITE_TAC[]);; +e (COND_CASES_TAC);; +e (REFL_TAC);; +e (NEW_GOAL `k >= 4`);; +e (UP_ASM_TAC THEN ARITH_TAC);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ]);; + +e (MATCH_MP_TAC Lepjbdj.LEPJBDJ);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `2 <= k` THEN ARITH_TAC);; +e (STRIP_TAC);; +e (UNDISCH_TAC `2 <= k` THEN ARITH_TAC);; +e (REWRITE_WITH `mcell (if k < 4 then k else 4) V ul = X`);; +e (ASM_REWRITE_TAC[]);; +e (COND_CASES_TAC);; +e (REFL_TAC);; +e (NEW_GOAL `k >= 4`);; +e (UP_ASM_TAC THEN ARITH_TAC);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER E)` THEN + REWRITE_TAC[ASSUME `X = {}:real^3->bool`; SET_RULE `{} INTER x = {}`; + NEGLIGIBLE_EMPTY]);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `set_of_list (truncate_simplex 1 (ul:(real^3)list)) SUBSET + set_of_list (truncate_simplex ((if k < 4 then k else 4) - 1) ul)`);; +e (MATCH_MP_TAC Rogers.TRUNCATE_SIMPLEX_SUBSET);; +e (REWRITE_WITH `LENGTH ul = 3 + 1 /\ + CARD (set_of_list (ul:(real^3)list)) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UNDISCH_TAC `2 <= k` THEN ARITH_TAC);; +e (REWRITE_TAC[MESON[IN] `(s:real^3->bool) u <=> u IN s`]);; + +e (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `truncate_simplex 1 ul = [u0; u1:real^3]`; + set_of_list]);; +e (SET_TAC[]);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[MESON[IN] `(X:real^3->bool) a <=> a IN X`]);; +e (REWRITE_TAC[GSYM SUBSET]);; + +e (NEW_GOAL `X SUBSET wedge_ge u0 u1 n1 n2 \/ X SUBSET wedge_ge u0 u1 n2 n1`);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (STRIP_TAC);; +e (REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `k:num` THEN EXISTS_TAC `ul:(real^3)list` THEN ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[edgeX; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`);; + +e (NEW_GOAL `VX V X = V INTER X`);; +e (MATCH_MP_TAC Hdtfnfz.HDTFNFZ);; +e (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `(if k < 4 then k else 4)`);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (COND_CASES_TAC);; +e (MESON_TAC[]);; +e (NEW_GOAL `k >= 4`);; +e (UP_ASM_TAC THEN ARITH_TAC);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ]);; +e (UNDISCH_TAC `~NULLSET (X INTER E)` THEN ASM_REWRITE_TAC[]);; +e (MESON_TAC[NEGLIGIBLE_SUBSET; SET_RULE `A INTER B SUBSET A`]);; + +e (NEW_GOAL `(V:real^3->bool) INTER X = + set_of_list (truncate_simplex ((if k < 4 then k else 4) - 1) ul)`);; +e (REWRITE_WITH `X = mcell (if k < 4 then k else 4) V ul`);; +e (ASM_REWRITE_TAC[]);; +e (COND_CASES_TAC);; +e (REFL_TAC);; +e (NEW_GOAL `k >= 4`);; +e (UP_ASM_TAC THEN ARITH_TAC);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ]);; + +e (MATCH_MP_TAC Lepjbdj.LEPJBDJ);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `2 <= k` THEN ARITH_TAC);; +e (STRIP_TAC);; +e (UNDISCH_TAC `2 <= k` THEN ARITH_TAC);; +e (REWRITE_WITH `mcell (if k < 4 then k else 4) V ul = X`);; +e (ASM_REWRITE_TAC[]);; +e (COND_CASES_TAC);; +e (REFL_TAC);; +e (NEW_GOAL `k >= 4`);; +e (UP_ASM_TAC THEN ARITH_TAC);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET (X INTER E)` THEN + REWRITE_TAC[ASSUME `X = {}:real^3->bool`; SET_RULE `{} INTER x = {}`; + NEGLIGIBLE_EMPTY]);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `set_of_list (truncate_simplex 1 (ul:(real^3)list)) SUBSET + set_of_list (truncate_simplex ((if k < 4 then k else 4) - 1) ul)`);; +e (MATCH_MP_TAC Rogers.TRUNCATE_SIMPLEX_SUBSET);; +e (REWRITE_WITH `LENGTH ul = 3 + 1 /\ + CARD (set_of_list (ul:(real^3)list)) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UNDISCH_TAC `2 <= k` THEN ARITH_TAC);; +e (REWRITE_TAC[MESON[IN] `(s:real^3->bool) u <=> u IN s`]);; + +e (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `truncate_simplex 1 ul = [u0; u1:real^3]`; + set_of_list]);; +e (SET_TAC[]);; + +e (UP_ASM_TAC THEN STRIP_TAC);; +e (NEW_GOAL `F`);; +e (NEW_GOAL + `X INTER E SUBSET (wedge_ge u0 u1 n1 n2 INTER wedge_ge u0 u1 n2 n1)`);; +e (REWRITE_TAC[SUBSET_INTER]);; +e (STRIP_TAC);; +e (EXPAND_TAC "E" THEN SET_TAC[]);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (UNDISCH_TAC `~NULLSET (X INTER E)` THEN REWRITE_TAC[]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `wedge_ge u0 u1 n1 n2 INTER wedge_ge u0 u1 n2 n1`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `aff_ge {u0,u1} {n1} UNION aff_ge {u0,u1} {n2:real^3}`);; +e (STRIP_TAC);; + +e (MATCH_MP_TAC NEGLIGIBLE_UNION);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0,u1,n1:real^3}`);; +e (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]);; +e (REWRITE_TAC[SET_RULE `{a,b,c} = {a,b} UNION {c}`; + AFF_GE_SUBSET_AFFINE_HULL]);; + +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0,u1,n2:real^3}`);; +e (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]);; +e (REWRITE_TAC[SET_RULE `{a,b,c} = {a,b} UNION {c}`; + AFF_GE_SUBSET_AFFINE_HULL]);; + +e (MATCH_MP_TAC INTER_2_WEDGE_GE_SUBSET_UNION_2_AFF_GE_LEMMA);; +e (ASM_REWRITE_TAC[]);; + +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (NEW_GOAL `(x:real^3) IN E`);; +e (UNDISCH_TAC `x IN + E DIFF + UNIONS + {y | ?x. x IN + {X | mcell_set V X /\ + edgeX V X e /\ + (!x. x IN X ==> x IN wedge_ge u0 u1 n1 n2)} /\ + y = x INTER E}` THEN SET_TAC[]);; + +e (REWRITE_TAC[MESON[IN] `(X INTER Y) a <=> a IN (X INTER Y)`]);; +e (REWRITE_TAC[IN_INTER]);; +e (ASM_REWRITE_TAC[]);; + +e (EXISTS_TAC `X INTER (E:real^3 ->bool)`);; +e (STRIP_TAC);; +e (REWRITE_TAC[IN_ELIM_THM]);; +e (EXISTS_TAC `X:real^3->bool`);; +e (ASM_REWRITE_TAC[mcell_set; IN_ELIM_THM]);; +e (UP_ASM_TAC THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC);; +e (EXISTS_TAC `i:num` THEN EXISTS_TAC `vl:(real^3)list`);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `(x:real^3) IN X INTER E`);; +e (REWRITE_TAC[IN_INTER]);; +e (ASM_REWRITE_TAC[]);; +e (UNDISCH_TAC `x IN + E DIFF + UNIONS + {y | ?x. x IN + {X | mcell_set V X /\ + edgeX V X e /\ + (!x. x IN X ==> x IN wedge_ge u0 u1 n1 n2)} /\ + y = x INTER E}` THEN SET_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; + +e (REWRITE_TAC[MESON[IN] `(X INTER Y) a <=> a IN (X INTER Y)`]);; +e (REWRITE_TAC[IN_INTER]);; +e (ASM_REWRITE_TAC[]);; +e (UNDISCH_TAC `x IN + E DIFF + UNIONS + {y | ?x. x IN + {X | mcell_set V X /\ + edgeX V X e /\ + (!x. x IN X ==> x IN wedge_ge u0 u1 n1 n2)} /\ + y = x INTER E}` THEN SET_TAC[]);; + +e (UP_ASM_TAC THEN + REWRITE_WITH `sum s (\t. vol (t INTER E)) = sum s (\t. vol (t INTER D))`);; +e (MATCH_MP_TAC SUM_EQ);; +e (EXPAND_TAC "s" THEN REWRITE_TAC[IN; IN_ELIM_THM; BETA_THM] THEN + REPEAT STRIP_TAC);; +e (AP_TERM_TAC);; +e (EXPAND_TAC "E" THEN UP_ASM_TAC THEN SET_TAC[]);; + + +(* ========================================================================= *) + +e (ABBREV_TAC + `t = {X | mcell_set V X /\ edgeX V X e /\ X SUBSET wedge_ge u0 u1 n1 n2 /\ + ~NULLSET (X INTER D)}`);; + +e (REWRITE_WITH `sum s (\t. dihX V t (u0,u1)) = + sum t (\t. dihX V t (u0,u1))`);; +e (MATCH_MP_TAC SUM_SUPERSET);; +e (EXPAND_TAC "s" THEN EXPAND_TAC "t" THEN REPEAT STRIP_TAC);; +e (SET_TAC[]);; + +e (NEW_GOAL `NULLSET (x INTER D)`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[IN; IN_ELIM_THM] );; +e (MESON_TAC[]);; + +e (NEW_GOAL `mcell_set V x /\ edgeX V x e`);; +e (UNDISCH_TAC + `x IN {X | mcell_set V X /\ edgeX V X e /\ X SUBSET wedge_ge u0 u1 n1 n2}`);; +e (REWRITE_TAC[IN; IN_ELIM_THM]);; +e (MESON_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[mcell_set_2; IN_ELIM_THM;IN] THEN STRIP_TAC);; + +e (NEW_GOAL `~NULLSET x`);; +e (UP_ASM_TAC THEN REWRITE_TAC[edgeX; VX; IN_ELIM_THM]);; +e (COND_CASES_TAC THEN REPEAT STRIP_TAC);; +e (UNDISCH_TAC `{} (u:real^3)` THEN REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`]);; +e (SET_TAC[]);; + +e (NEW_GOAL `VX V x = V INTER (x:real^3->bool)`);; +e (MATCH_MP_TAC Hdtfnfz.HDTFNFZ);; +e (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `V INTER (x:real^3->bool) = + set_of_list (truncate_simplex (i - 1) ul)`);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC Lepjbdj.LEPJBDJ);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (ASM_CASES_TAC `i = 0`);; +e (NEW_GOAL `V INTER (x:real^3->bool) = {}`);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `edgeX V x e` THEN REWRITE_TAC[edgeX; IN_ELIM_THM]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `VX V x u` THEN ASM_REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`]);; +e (SET_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN ARITH_TAC);; +e (REWRITE_TAC[GSYM (ASSUME `x = mcell i V ul`)] THEN STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET x` THEN REWRITE_TAC[ASSUME `x:real^3->bool = {}`; + NEGLIGIBLE_EMPTY]);; + +e (NEW_GOAL `(u0:real^3) IN VX V x /\ u1 IN VX V x`);; +e (UNDISCH_TAC `edgeX V x e` THEN REWRITE_TAC[edgeX; IN_ELIM_THM; + ASSUME `e = {u0, u1:real^3}`]);; +e (STRIP_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; + +(* ========================================================================== *) +e (NEW_GOAL `F`);; + +e (ASM_CASES_TAC `i <= 1`);; +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2 ;v3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (NEW_GOAL `i - 1 = 0`);; +e (UNDISCH_TAC `i <= 1` THEN ARITH_TAC);; +e (UNDISCH_TAC `u0 IN VX V x /\ u1 IN VX V x`);; +e (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_0; set_of_list]);; +e (UNDISCH_TAC `~(u0 = u1:real^3)` THEN SET_TAC[]);; + +e (ASM_CASES_TAC `i = 3`);; +e (NEW_GOAL `vol (x INTER D) > &0`);; +e (ONCE_REWRITE_TAC[SET_RULE `a INTER b = b INTER a`]);; +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2 ;v3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell3; TRUNCATE_SIMPLEX_EXPLICIT_2; + set_of_list; SET_RULE `{a,c,d} UNION {x} = {a,c,d,x}`]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `i - 1 = 2`);; +e (UNDISCH_TAC `i = 3` THEN ARITH_TAC);; +e (UNDISCH_TAC `u0 IN VX V x /\ u1 IN VX V x`);; +e (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]);; +e (STRIP_TAC);; +e (NEW_GOAL `?v:real^3. {u0, u1, v} = {v0, v1, v2}`);; +e (NEW_GOAL `?v:real^3. v IN {v0, v1, v2} DIFF {u0, u1}`);; +e (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]);; +e (REWRITE_WITH `{v0, v1, v2} DIFF {u0, u1:real^3} = {} <=> + CARD ({v0, v1, v2} DIFF {u0, u1}) = 0`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC CARD_EQ_0);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `{v0, v1, v2:real^3}`);; +e (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]);; +e (REWRITE_TAC[ARITH_RULE `~(a = 0) <=> 1 <= a`]);; + +e (NEW_GOAL `CARD {v0, v1, v2} = CARD ({v0, v1, v2} DIFF {u0, u1:real^3}) + + CARD {u0, u1}`);; +e (MATCH_MP_TAC Hypermap.CARD_MINUS_DIFF_TWO_SET);; +e (ASM_REWRITE_TAC[Geomdetail.FINITE6]);; +e (UP_ASM_TAC THEN REWRITE_WITH `CARD ({v0, v1, v2:real^3}) = 3`);; +e (REWRITE_WITH `{v0, v1, v2:real^3} = set_of_list (truncate_simplex 2 ul)`);; +e (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]);; +e (ABBREV_TAC `xl = truncate_simplex 2 (ul:(real^3)list)`);; +e (REWRITE_WITH `LENGTH (xl:(real^3)list) = 2 + 1 /\ + CARD (set_of_list xl) = 2 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "xl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV);; +e (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]);; +e (ARITH_TAC);; + +e (NEW_GOAL `CARD {u0, u1:real^3} <= 2`);; +e (REWRITE_TAC[Geomdetail.CARD2]);; +e (UP_ASM_TAC THEN ARITH_TAC);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (EXISTS_TAC `v:real^3`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN + UNDISCH_TAC `~(u0 = u1:real^3)` THEN SET_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (NEW_GOAL `{v0, v1, v2, mxi V [v0; v1; v2; v3]} = + {u0, u1, v, mxi V [v0; v1; v2; v3]}`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC CONIC_CAP_INTER_CONVEX_HULL_4_GT_0);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[GSYM (ASSUME `{v0, v1, v2, mxi V [v0; v1; v2; v3]} = + {u0, u1, v, mxi V [v0; v1; v2; v3]}`)] THEN STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET x`);; +e (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2]);; +e (REWRITE_TAC[SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {v0, v1, v2, mxi V [v0; v1; v2; v3]}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET x`);; +e (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (NEW_GOAL `vol (x INTER D) = &0`);; +e (MATCH_MP_TAC MEASURE_EQ_0);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; + + +(* ========================================== *) + +e (ASM_CASES_TAC `i = 4`);; +e (NEW_GOAL `vol (x INTER D) > &0`);; +e (ONCE_REWRITE_TAC[SET_RULE `a INTER b = b INTER a`]);; +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2 ;v3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4; ARITH_RULE `4 >= 4`; + set_of_list]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `i - 1 = 3`);; +e (UNDISCH_TAC `i = 4` THEN ARITH_TAC);; +e (UNDISCH_TAC `u0 IN VX V x /\ u1 IN VX V x`);; +e (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3; set_of_list]);; +e (STRIP_TAC);; + +e (NEW_GOAL `?v w:real^3. {u0, u1, v, w} = {v0, v1, v2, v3}`);; + +e (NEW_GOAL `?v:real^3. v IN {v0, v1, v2, v3} DIFF {u0, u1}`);; +e (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]);; +e (REWRITE_WITH `{v0, v1, v2, v3} DIFF {u0, u1:real^3} = {} <=> + CARD ({v0, v1, v2, v3} DIFF {u0, u1}) = 0`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC CARD_EQ_0);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `{v0, v1, v2, v3:real^3}`);; +e (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]);; +e (REWRITE_TAC[ARITH_RULE `~(a = 0) <=> 1 <= a`]);; + +e (NEW_GOAL `CARD {v0, v1, v2, v3} = + CARD ({v0, v1, v2, v3} DIFF {u0, u1:real^3}) + CARD {u0, u1}`);; +e (MATCH_MP_TAC Hypermap.CARD_MINUS_DIFF_TWO_SET);; +e (ASM_REWRITE_TAC[Geomdetail.FINITE6]);; + +e (UP_ASM_TAC THEN REWRITE_WITH `CARD ({v0, v1, v2, v3:real^3}) = 3 + 1`);; +e (REWRITE_WITH `{v0, v1, v2, v3:real^3} = set_of_list ul`);; +e (ASM_REWRITE_TAC[set_of_list]);; +e (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (NEW_GOAL `CARD {u0, u1:real^3} <= 2`);; +e (REWRITE_TAC[Geomdetail.CARD2]);; +e (UP_ASM_TAC THEN ARITH_TAC);; +e (UP_ASM_TAC THEN STRIP_TAC);; + +e (NEW_GOAL `?w:real^3. w IN {v0, v1, v2, v3} DIFF {u0, u1, v}`);; +e (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]);; +e (REWRITE_WITH `{v0, v1, v2, v3} DIFF {u0, u1, v:real^3} = {} <=> + CARD ({v0, v1, v2, v3} DIFF {u0, u1, v}) = 0`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC CARD_EQ_0);; +e (MATCH_MP_TAC FINITE_SUBSET);; +e (EXISTS_TAC `{v0, v1, v2, v3:real^3}`);; +e (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]);; +e (REWRITE_TAC[ARITH_RULE `~(a = 0) <=> 1 <= a`]);; + +e (NEW_GOAL `CARD ({v0, v1, v2, v3} DIFF {u0, u1,v:real^3}) = + CARD {v0, v1, v2, v3} - CARD {u0,u1,v}`);; +e (MATCH_MP_TAC CARD_DIFF);; +e (ASM_REWRITE_TAC[Geomdetail.FINITE6]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_WITH `CARD ({v0, v1, v2, v3:real^3}) = 3 + 1`);; +e (REWRITE_WITH `{v0, v1, v2, v3:real^3} = set_of_list ul`);; +e (ASM_REWRITE_TAC[set_of_list]);; +e (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`);; +e (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (NEW_GOAL `CARD {u0, u1, v:real^3} <= 3`);; +e (REWRITE_TAC[Geomdetail.CARD3]);; +e (UP_ASM_TAC THEN ARITH_TAC);; +e (UP_ASM_TAC THEN STRIP_TAC);; + +e (EXISTS_TAC `v:real^3` THEN EXISTS_TAC `w:real^3`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN + UNDISCH_TAC `~(u0 = u1:real^3)` THEN SET_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (REWRITE_TAC[GSYM (ASSUME `{u0:real^3, u1, v, w} = {v0, v1, v2, v3}`)]);; +e (MATCH_MP_TAC CONIC_CAP_INTER_CONVEX_HULL_4_GT_0);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~NULLSET x`);; +e (SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list; ARITH_RULE `4 >= 4`; + ASSUME `x = mcell i V ul`; ASSUME `i = 4`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]);; +e (COND_CASES_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {v0, v1, v2, v3:real^3}`);; +e (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; + +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET x`);; +e (SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list; ARITH_RULE `4 >= 4`; + ASSUME `x = mcell i V ul`; ASSUME `i = 4`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (NEW_GOAL `vol (x INTER D) = &0`);; +e (MATCH_MP_TAC MEASURE_EQ_0);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; + +(* ========================================== *) + +e (NEW_GOAL `i = 2`);; +e (UNDISCH_TAC `i <= 4` THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC + THEN ARITH_TAC);; + +e (NEW_GOAL `vol (x INTER D) > &0`);; +e (ONCE_REWRITE_TAC[SET_RULE `a INTER b = b INTER a`]);; +e (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2 ;v3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2; TRUNCATE_SIMPLEX_EXPLICIT_1; + set_of_list; HD; TL]);; +e (LET_TAC);; +e (COND_CASES_TAC);; + +e (NEW_GOAL `i - 1 = 1`);; +e (UNDISCH_TAC `i = 2` THEN ARITH_TAC);; +e (UNDISCH_TAC `u0 IN VX V x /\ u1 IN VX V x`);; +e (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list]);; +e (STRIP_TAC);; +e (NEW_GOAL `{u0, u1} = {v0, v1:real^3}`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN + SET_TAC[]);; +e (REWRITE_TAC[SET_RULE `A INTER B INTER C INTER D = + (A INTER (B INTER C)) INTER D`]);; +e (REWRITE_WITH `rcone_ge v0 v1 a' INTER rcone_ge v1 v0 a' = + rcone_ge u0 u1 a' INTER rcone_ge u1 (u0:real^3) a'`);; +e (ASM_CASES_TAC `u0:real^3 = v0`);; +e (NEW_GOAL `u1 = v1:real^3`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `u0 = v1:real^3`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (NEW_GOAL `u1 = v0:real^3`);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (SET_TAC[]);; + +e (REWRITE_WITH + `conic_cap u0 u1 r d INTER rcone_ge u0 u1 a' INTER rcone_ge u1 u0 a' = + conic_cap (u0:real^3) u1 r d`);; +e (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> A INTER B = A`));; + +e (NEW_GOAL `conic_cap (u0:real^3) u1 r d SUBSET rcone_ge u0 u1 a'`);; +e (REWRITE_TAC[conic_cap]);; +e (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A SUBSET B`));; +e (NEW_GOAL `rcone_gt u0 u1 d SUBSET rcone_gt (u0:real^3) u1 a'`);; +e (MATCH_MP_TAC RCONE_GT_SUBSET);; +e (EXPAND_TAC "d" THEN EXPAND_TAC "c");; +e (MATCH_MP_TAC (REAL_ARITH `a = x ==> a <= max (max y x) (max z t)`));; +e (EXPAND_TAC "a'" THEN REWRITE_TAC[HL; set_of_list] THEN ASM_REWRITE_TAC[]);; +e (NEW_GOAL `rcone_gt u0 u1 a' SUBSET rcone_ge (u0:real^3) u1 a'`);; +e (REWRITE_TAC[RCONE_GT_SUBSET_RCONE_GE]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (REWRITE_TAC[SUBSET_INTER] THEN STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[SUBSET]);; +e (REPEAT STRIP_TAC);; +e (MATCH_MP_TAC Marchal_cells_2_new.RCONEGE_INTER_VORONOI_CLOSED_IMP_RCONEGE);; +e (EXISTS_TAC `V:real^3->bool`);; +e (ASM_REWRITE_TAC[]);; +e (REPEAT STRIP_TAC);; + +e (REWRITE_WITH `a' = hl [u0; u1:real^3] / sqrt (&2)`);; +e (EXPAND_TAC "a'");; +e (REWRITE_TAC[HL; set_of_list] THEN ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC REAL_LT_DIV);; +e (REWRITE_TAC[HL_2]);; +e (STRIP_TAC);; +e (MATCH_MP_TAC REAL_LT_MUL);; +e (REWRITE_TAC[REAL_ARITH `&0 < inv (&2)`]);; +e (MATCH_MP_TAC DIST_POS_LT);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC SQRT_POS_LT);; +e (REAL_ARITH_TAC);; +e (EXPAND_TAC "a'");; +e (MATCH_MP_TAC REAL_DIV_LE_1_TACTICS);; +e (STRIP_TAC);; +e (MATCH_MP_TAC SQRT_POS_LT);; +e (REAL_ARITH_TAC);; +e (MATCH_MP_TAC (REAL_ARITH `a < b ==> a <= b`));; +e (ASM_REWRITE_TAC[]);; + +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (NEW_GOAL `x':real^3 IN ball (u0, (&1))`);; +e (UP_ASM_TAC THEN REWRITE_TAC[conic_cap;NORMBALL_BALL] THEN STRIP_TAC);; +e (NEW_GOAL `ball (u0, r) SUBSET ball (u0:real^3, &1)`);; +e (MATCH_MP_TAC SUBSET_BALL);; +e (EXPAND_TAC "r");; +e (REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL] THEN ONCE_REWRITE_TAC[DIST_SYM] + THEN STRIP_TAC);; +e (REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (ASM_CASES_TAC `u0 = w:real^3`);; +e (ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC);; +e (NEW_GOAL `&2 <= dist (u0, w:real^3)`);; +e (UNDISCH_TAC `packing (V:real^3->bool)` THEN REWRITE_TAC[packing]);; +e (STRIP_TAC);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (UNDISCH_TAC `u0:real^3 IN V` THEN REWRITE_TAC[IN]);; +e (NEW_GOAL `dist (x', u0) >= dist (u0, w) - dist (x', w:real^3)`);; +e (NORM_ARITH_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN DEL_TAC THEN DEL_TAC THEN UP_ASM_TAC + THEN REAL_ARITH_TAC);; +e (ABBREV_TAC `M = mxi V [v0; v1; v2; v3]`);; +e (ABBREV_TAC `R = omega_list_n V [v0; v1; v2; v3] 3`);; + +e (NEW_GOAL `vol (conic_cap u0 u1 r d INTER convex hull {v0:real^3,v1,M,R}) + <= vol (conic_cap u0 u1 r d INTER aff_ge {v0, v1} {M, R})`);; +e (MATCH_MP_TAC MEASURE_SUBSET);; +e (REPEAT STRIP_TAC);; +e (MATCH_MP_TAC MEASURABLE_INTER);; +e (REWRITE_TAC[MEASURABLE_CONIC_CAP]);; +e (MATCH_MP_TAC MEASURABLE_CONVEX_HULL);; +e (MATCH_MP_TAC FINITE_IMP_BOUNDED);; +e (REWRITE_TAC[Geomdetail.FINITE6]);; + +e (REWRITE_TAC[conic_cap; NORMBALL_BALL]);; +e (ONCE_REWRITE_TAC[SET_RULE `(a INTER b) INTER c = + (a INTER b) INTER (a INTER c)`]);; +e (MATCH_MP_TAC MEASURABLE_INTER);; +e (REWRITE_TAC[MEASURABLE_BALL_AFF_GE]);; +e (REWRITE_TAC[GSYM conic_cap; GSYM NORMBALL_BALL; MEASURABLE_CONIC_CAP]);; + +e (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A SUBSET C INTER B`));; +e (REWRITE_TAC[Marchal_cells_2_new.CONVEX_HULL_4_SUBSET_AFF_GE_2_2]);; + + + +e (NEW_GOAL `vol (conic_cap u0 u1 r d INTER convex hull {v0, v1, M, R}) > &0`);; +e (REWRITE_WITH `{v0, v1, M, R} = {u0, u1, M, R:real^3}`);; +e (UNDISCH_TAC `{u0, u1} = {v0, v1:real^3}` THEN SET_TAC[]);; +e (MATCH_MP_TAC CONIC_CAP_INTER_CONVEX_HULL_4_GT_0);; +e (ASM_REWRITE_TAC[]);; +e (REPEAT STRIP_TAC);; +e (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC);; + +e (UNDISCH_TAC `~NULLSET x`);; +e (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]);; +e (LET_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `aff_ge {v0, v1} {M, R:real^3}`);; +e (REWRITE_TAC[SET_RULE `a INTER B INTER c SUBSET c`]);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull ({v0, v1} UNION {M, R:real^3})`);; +e (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL; SET_RULE + `{a, b} UNION {c, d} = {a,b,c,d}`]);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]);; +e (REWRITE_WITH `{v0, v1, M, R} = {u0, u1, M, R:real^3}`);; +e (UNDISCH_TAC `{u0, u1} = {v0, v1:real^3}` THEN SET_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; + +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~NULLSET x`);; +e (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]);; +e (REWRITE_TAC[NEGLIGIBLE_EMPTY]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +e (NEW_GOAL `vol (x INTER D) = &0`);; +e (MATCH_MP_TAC MEASURE_EQ_0);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC);; +e (UP_ASM_TAC THEN MESON_TAC[]);; + +(* ========================================== *) + +e (REWRITE_WITH `sum s (\t. vol (t INTER D)) = + sum t (\t. vol (t INTER D))`);; +e (MATCH_MP_TAC SUM_SUPERSET);; +e (EXPAND_TAC "s" THEN EXPAND_TAC "t" THEN REPEAT STRIP_TAC);; +e (SET_TAC[]);; +e (MATCH_MP_TAC MEASURE_EQ_0);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[IN; IN_ELIM_THM] );; +e (MESON_TAC[]);; + +e (REWRITE_WITH `sum t (\t. vol (t INTER D)) = + sum t (\t. vol D * dihX V t (u0,u1) / (&2 * pi))`);; +e (MATCH_MP_TAC SUM_EQ);; +e (EXPAND_TAC "t" THEN REWRITE_TAC[IN_ELIM_THM; IN] THEN REPEAT STRIP_TAC);; +e (ASM_SIMP_TAC[]);; + +e (REWRITE_TAC[REAL_ARITH `a * b / c = (a / c) * b`]);; +e (REWRITE_TAC[SUM_LMUL]);; +e (ABBREV_TAC `R = sum t (\t. dihX V t (u0,u1))`);; + +e (REWRITE_WITH `vol E = vol D * azim u0 u1 n1 n2 / (&2 * pi)`);; +e (EXPAND_TAC "E" THEN + REWRITE_TAC[ASSUME `D:real^3->bool = conic_cap u0 u1 r d`]);; +e (MATCH_MP_TAC VOLUME_CONIC_CAP_WEDGE_GE_VS_CONIC_CAP);; +e (REPEAT STRIP_TAC);; +e (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "r" THEN REAL_ARITH_TAC);; + +e (UP_ASM_TAC THEN REWRITE_TAC[]);; +e (NEW_GOAL `?a0 a1 a2. vl1 = [a0;a1;a2:real^3]`);; +e (MATCH_MP_TAC Qzksykg.BARV_2_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN + ASM_REWRITE_TAC[MESON[IN] `barV V 2 vl1 <=> vl1 IN barV V 2`]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (REWRITE_WITH `{u0,u1,n1:real^3} = set_of_list vl1`);; +e (ASM_REWRITE_TAC[set_of_list; EL; HD; TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]);; +e (NEW_GOAL `{a0, a1:real^3} = {u0,u1}`);; +e (REWRITE_TAC[GSYM (ASSUME `e = {u0,u1:real^3}`); + GSYM (ASSUME `set_of_list (truncate_simplex 1 vl1) = e:real^3->bool`)]);; +e (REWRITE_TAC[ASSUME `vl1 = [a0; a1; a2:real^3]`; TRUNCATE_SIMPLEX_EXPLICIT_1; + set_of_list]);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (MATCH_MP_TAC BARV_2_IMP_NOT_COLLINEAR_SET_OF_LIST);; +e (EXISTS_TAC `V:real^3->bool` THEN + ASM_REWRITE_TAC[MESON[IN] `barV V 2 vl1 <=> vl1 IN barV V 2`]);; + + +e (UP_ASM_TAC THEN REWRITE_TAC[]);; +e (NEW_GOAL `?a0 a1 a2. vl2 = [a0;a1;a2:real^3]`);; +e (MATCH_MP_TAC Qzksykg.BARV_2_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN + ASM_REWRITE_TAC[MESON[IN] `barV V 2 vl2 <=> vl2 IN barV V 2`]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (REWRITE_WITH `{u0,u1,n2:real^3} = set_of_list vl2`);; +e (ASM_REWRITE_TAC[set_of_list; EL; HD; TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]);; +e (NEW_GOAL `{a0, a1:real^3} = {u0,u1}`);; +e (REWRITE_TAC[GSYM (ASSUME `e = {u0,u1:real^3}`); + GSYM (ASSUME `set_of_list (truncate_simplex 1 vl2) = e:real^3->bool`)]);; +e (REWRITE_TAC[ASSUME `vl2 = [a0; a1; a2:real^3]`; TRUNCATE_SIMPLEX_EXPLICIT_1; + set_of_list]);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (MATCH_MP_TAC BARV_2_IMP_NOT_COLLINEAR_SET_OF_LIST);; +e (EXISTS_TAC `V:real^3->bool` THEN + ASM_REWRITE_TAC[MESON[IN] `barV V 2 vl2 <=> vl2 IN barV V 2`]);; + +e (REWRITE_TAC[REAL_ARITH `a / b * c = (a * c) / b`]);; +e (REWRITE_WITH + `(vol D * R) / (&2 * pi) = vol D * azim u0 u1 n1 n2 / (&2 * pi) <=> + (vol D * R) = (vol D * azim u0 u1 n1 n2 / (&2 * pi)) * (&2 * pi)`);; +e (MATCH_MP_TAC REAL_EQ_LDIV_EQ);; +e (MATCH_MP_TAC REAL_LT_MUL);; +e (REWRITE_TAC[PI_POS]);; +e (REAL_ARITH_TAC);; +e (REWRITE_TAC[REAL_ARITH `(a * b / c) * c = (a * b) * c/c`]);; +e (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`);; +e (MATCH_MP_TAC REAL_DIV_REFL);; +e (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`));; +e (MATCH_MP_TAC REAL_LT_MUL);; +e (REWRITE_TAC[PI_POS]);; +e (REAL_ARITH_TAC);; +e (REWRITE_TAC[REAL_ARITH `a * x = (a * t) * &1 <=> a * (x - t) = &0`]);; +e (REWRITE_TAC[REAL_ENTIRE]);; +e (STRIP_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `&0 < d`);; +e (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC);; +e (ASM_SIMP_TAC[VOLUME_CONIC_CAP]);; +e (COND_CASES_TAC);; +e (REWRITE_TAC[]);; +e (UNDISCH_TAC `d < &1` THEN UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC + THEN REAL_ARITH_TAC);; +e (REWRITE_TAC[REAL_ARITH `&2 / &3 * a = &0 <=> a = &0`]);; +e (REWRITE_TAC[REAL_ENTIRE]);; +e (NEW_GOAL `~(pi = &0)`);; +e (MP_TAC PI_POS THEN REAL_ARITH_TAC);; +e (NEW_GOAL `~(&1 - d = &0)`);; +e (UNDISCH_TAC `d < &1` THEN REAL_ARITH_TAC);; +e (NEW_GOAL `~(r pow 3 = &0)`);; +e (MATCH_MP_TAC REAL_POW_NZ);; +e (UNDISCH_TAC `&0 < r` THEN REAL_ARITH_TAC);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (UP_ASM_TAC THEN REAL_ARITH_TAC);; + +let REUHADY = top_thm();; + diff --git a/legacy/oldpacking/packing/development/TSKAJXY.hl b/legacy/oldpacking/packing/development/TSKAJXY.hl new file mode 100644 index 0000000..d6a98f3 --- /dev/null +++ b/legacy/oldpacking/packing/development/TSKAJXY.hl @@ -0,0 +1,807 @@ + +(* ======================================================================== *) + +g (mk_imp(tsk_hyp_new,`TSKAJXY_statement`));; +e (STRIP_TAC);; +e (REWRITE_TAC[TSKAJXY_statement; mcell_set; IN_ELIM_THM]);; +e (REWRITE_TAC[IN]);; +e (REPEAT STRIP_TAC);; +e (ASM_CASES_TAC `NULLSET X`);; +e (REWRITE_TAC[gammaX]);; +e (MATCH_MP_TAC (REAL_ARITH `x = &0 /\ y = &0 /\ z = &0 ==> x - y + z >= &0`));; +e (REWRITE_TAC[total_solid; REAL_ENTIRE]);; +e (REPEAT STRIP_TAC);; +e (MATCH_MP_TAC MEASURE_EQ_0);; +e (ASM_REWRITE_TAC[]);; +e (DISJ2_TAC);; +e (REWRITE_WITH `VX V X = {}`);; +e (REWRITE_TAC[VX]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[SUM_CLAUSES]);; +e (DISJ2_TAC);; +e (REWRITE_WITH `edgeX V X = {}`);; +e (REWRITE_TAC[edgeX]);; +e (REWRITE_WITH `VX V X = {}`);; +e (REWRITE_TAC[VX]);; +e (ASM_REWRITE_TAC[]);; +e (ONCE_REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`]);; +e (SET_TAC[]);; +e (REWRITE_TAC[SUM_CLAUSES]);; + + +e (NEW_GOAL `~(X:real^3->bool = {})`);; +e (STRIP_TAC THEN SWITCH_TAC THEN UP_ASM_TAC THEN + REWRITE_TAC[ASSUME `X:real^3->bool = {}`; NEGLIGIBLE_EMPTY]);; + +(* ========================================================================= *) + +e (ASM_CASES_TAC `i >= 4`);; +e (NEW_GOAL `X = mcell4 V ul`);; +e (ASM_REWRITE_TAC[]);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT]);; +e (UP_ASM_TAC THEN REWRITE_TAC[mcell4]);; +e (COND_CASES_TAC);; +e (NEW_GOAL `?u0 u1 u2 u3. ul = [u0; u1; u2; u3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (REWRITE_TAC[ASSUME `ul = [u0; u1; u2; u3:real^3]`; set_of_list]);; +e (STRIP_TAC);; +e (ABBREV_TAC `y1 = dist (u0:real^3, u1)`);; +e (ABBREV_TAC `y2 = dist (u0:real^3, u2)`);; +e (ABBREV_TAC `y3 = dist (u0:real^3, u3)`);; +e (ABBREV_TAC `y4 = dist (u2:real^3, u3)`);; +e (ABBREV_TAC `y5 = dist (u1:real^3, u3)`);; +e (ABBREV_TAC `y6 = dist (u1:real^3, u2)`);; + +e (NEW_GOAL `VX V X = {u0,u1,u2,u3}`);; +e (REWRITE_WITH `VX V X = V INTER X`);; +e (MATCH_MP_TAC Hdtfnfz.HDTFNFZ);; +e (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_WITH `X = mcell 4 V ul`);; +e (ASM_REWRITE_TAC[]);; +e (MESON_TAC[ARITH_RULE `4 >= 4`; ASSUME `i >= 4`; MCELL_EXPLICIT]);; + +e (REWRITE_WITH + `V INTER mcell 4 V ul = set_of_list (truncate_simplex (4 - 1) ul)`);; +e (MATCH_MP_TAC Lepjbdj.LEPJBDJ);; +e (ASM_REWRITE_TAC[ARITH_RULE `1 <= 4 /\ 4 <= 4`]);; +e (REWRITE_WITH ` mcell 4 V [u0; u1; u2; u3] = X`);; +e (ASM_REWRITE_TAC[]);; +e (MESON_TAC[ARITH_RULE `4 >= 4`; ASSUME `i >= 4`; MCELL_EXPLICIT]);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[ARITH_RULE `4 - 1 = 3`; TRUNCATE_SIMPLEX_EXPLICIT_3; + set_of_list]);; + +e (REWRITE_WITH `vol X = vol_y y1 y2 y3 y4 y5 y6 /\ + gammaX V X lmfun = gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun`);; +e (MATCH_MP_TAC gammaX_gamm4fgcy);; +e (EXISTS_TAC `ul:(real^3)list`);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`);; +e (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`);; +e (EXISTS_TAC `i:num`);; +e (ASM_REWRITE_TAC[]);; + +(* ========================================================================= *) + +e (NEW_GOAL +`!y1 y2 y3 y4 y5 y6. + ineq + [#2.0,y1,sqrt8; #2.0,y2,sqrt8; #2.0,y3,sqrt8; #2.0,y4,sqrt8; + #2.0, + y5, + sqrt8; #2.0,y6,sqrt8] + (~critical_edge_y y1 /\ + ~critical_edge_y y2 /\ + ~critical_edge_y y3 /\ + ~critical_edge_y y4 /\ + ~critical_edge_y y5 /\ + ~critical_edge_y y6 /\ + &0 < delta_y y1 y2 y3 y4 y5 y6 /\ + rad2_y y1 y2 y3 y4 y5 y6 < &2 + ==> gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun >= &0)`);; +e (MATCH_MP_TAC TSKAJXY_DERIVED4);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[ineq; MESON[] `a ==> b ==> c <=> (a /\ b) ==> c`] + THEN STRIP_TAC);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `~(critical_edge_y y1) /\ + ~(critical_edge_y y2) /\ + ~(critical_edge_y y3) /\ + ~(critical_edge_y y4) /\ + ~(critical_edge_y y5) /\ + ~(critical_edge_y y6) /\ + &0 < delta_y y1 y2 y3 y4 y5 y6`);; +e (REWRITE_TAC[critical_edge_y]);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `{u0:real^3, u1} IN critical_edgeX V X`);; +e (REWRITE_TAC[critical_edgeX; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`);; +e (REWRITE_TAC[HL_2; edgeX; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[]);; +e (STRIP_TAC);; +e (ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[]);; +e (STRIP_TAC THEN UNDISCH_TAC `&2 * hminus <= y1`);; +e (EXPAND_TAC "y1" THEN REWRITE_TAC[dist; ASSUME `u0:real^3 = u1`; + NORM_ARITH `norm (u1 - u1) = &0`; REAL_ARITH `~(&2 * s <= &0) <=> &0 < s`]);; +e (MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC);; + +e (ASM_REAL_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_SET_TAC[]);; + +e (NEW_GOAL `{u0:real^3, u2} IN critical_edgeX V X`);; +e (REWRITE_TAC[critical_edgeX; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u2:real^3`);; +e (REWRITE_TAC[HL_2; edgeX; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u2:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[]);; +e (STRIP_TAC);; +e (ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[]);; +e (STRIP_TAC THEN UNDISCH_TAC `&2 * hminus <= y2`);; +e (EXPAND_TAC "y2" THEN REWRITE_TAC[dist; ASSUME `u0:real^3 = u2`; + NORM_ARITH `norm (u2 - u2) = &0`; REAL_ARITH `~(&2 * s <= &0) <=> &0 < s`]);; +e (MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_SET_TAC[]);; + +e (NEW_GOAL `{u0:real^3, u3} IN critical_edgeX V X`);; +e (REWRITE_TAC[critical_edgeX; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u3:real^3`);; +e (REWRITE_TAC[HL_2; edgeX; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u3:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[]);; +e (STRIP_TAC);; +e (ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[]);; +e (STRIP_TAC THEN UNDISCH_TAC `&2 * hminus <= y3`);; +e (EXPAND_TAC "y3" THEN REWRITE_TAC[dist; ASSUME `u0:real^3 = u3`; + NORM_ARITH `norm (u3 - u3) = &0`; REAL_ARITH `~(&2 * s <= &0) <=> &0 < s`]);; +e (MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_SET_TAC[]);; + +e (NEW_GOAL `{u2:real^3, u3} IN critical_edgeX V X`);; +e (REWRITE_TAC[critical_edgeX; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`);; +e (REWRITE_TAC[HL_2; edgeX; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[]);; +e (STRIP_TAC);; +e (ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[]);; +e (STRIP_TAC THEN UNDISCH_TAC `&2 * hminus <= y4`);; +e (EXPAND_TAC "y4" THEN REWRITE_TAC[dist; ASSUME `u2:real^3 = u3`; + NORM_ARITH `norm (u3 - u3) = &0`; REAL_ARITH `~(&2 * s <= &0) <=> &0 < s`]);; +e (MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_SET_TAC[]);; + +e (NEW_GOAL `{u1:real^3, u3} IN critical_edgeX V X`);; +e (REWRITE_TAC[critical_edgeX; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u3:real^3`);; +e (REWRITE_TAC[HL_2; edgeX; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u3:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[]);; +e (STRIP_TAC);; +e (ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[]);; +e (STRIP_TAC THEN UNDISCH_TAC `&2 * hminus <= y5`);; +e (EXPAND_TAC "y5" THEN REWRITE_TAC[dist; ASSUME `u1:real^3 = u3`; + NORM_ARITH `norm (u3 - u3) = &0`; REAL_ARITH `~(&2 * s <= &0) <=> &0 < s`]);; +e (MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_SET_TAC[]);; + +e (NEW_GOAL `{u1:real^3, u2} IN critical_edgeX V X`);; +e (REWRITE_TAC[critical_edgeX; IN; IN_ELIM_THM]);; +e (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3`);; +e (REWRITE_TAC[HL_2; edgeX; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[]);; +e (STRIP_TAC);; +e (ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[]);; +e (STRIP_TAC THEN UNDISCH_TAC `&2 * hminus <= y6`);; +e (EXPAND_TAC "y6" THEN REWRITE_TAC[dist; ASSUME `u1:real^3 = u2`; + NORM_ARITH `norm (u2 - u2) = &0`; REAL_ARITH `~(&2 * s <= &0) <=> &0 < s`]);; +e (MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_SET_TAC[]);; + +e (REWRITE_WITH `&0 < delta_y y1 y2 y3 y4 y5 y6 <=> + &0 < sqrt (delta_y y1 y2 y3 y4 y5 y6)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC SQRT_LT_0);; +e (REWRITE_TAC[delta_y]);; +e (ABBREV_TAC `x1 = y1 * y1` THEN ABBREV_TAC `x2 = y2 * y2`);; +e (ABBREV_TAC `x3 = y3 * y3` THEN ABBREV_TAC `x4 = y4 * y4`);; +e (ABBREV_TAC `x5 = y5 * y5` THEN ABBREV_TAC `x6 = y6 * y6`);; +e (REWRITE_WITH `delta_x x1 x2 x3 x4 x5 x6 = + (let a = u1:real^3 - u0 in + let b = u2 - u0 in + let c = u3 - u0 in + &4 * + (a$1 * b$2 * c$3 - a$1 * b$3 * c$2 - a$2 * b$1 * c$3 + + a$2 * b$3 * c$1 + + a$3 * b$1 * c$2 - a$3 * b$2 * c$1) pow + 2)`);; +e (MATCH_MP_TAC Delta_x.COMPUTE_DELTA_X);; +e (REWRITE_TAC[xlist; ylist]);; +e (REPEAT LET_TAC);; +e (EXPAND_TAC "x1" THEN EXPAND_TAC "x2" THEN EXPAND_TAC "x3");; +e (EXPAND_TAC "x4" THEN EXPAND_TAC "x5" THEN EXPAND_TAC "x6");; +e (UP_ASM_TAC THEN REWRITE_TAC[PAIR_EQ; GSYM REAL_POW_2]);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (REPEAT LET_TAC);; +e (REWRITE_TAC[REAL_ARITH `&0 <= &4 * a <=> &0 <= a`]);; +e (REWRITE_TAC[Real_ext.REAL_LE_POW_2]);; +e (ONCE_REWRITE_TAC[REAL_ARITH `&0 < a <=> &0 < a / &12`]);; +e (REWRITE_WITH `sqrt (delta_y y1 y2 y3 y4 y5 y6) / &12 = + vol (convex hull {u0,u1,u2,u3})`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (REWRITE_TAC[delta_y; GSYM REAL_POW_2]);; +e (EXPAND_TAC "y1" THEN EXPAND_TAC "y2" THEN EXPAND_TAC "y3");; +e (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6");; +e (REWRITE_TAC[VOLUME_OF_CLOSED_TETRAHEDRON]);; +e (REWRITE_TAC[GSYM (ASSUME `X = convex hull {u0, u1, u2, u3:real^3}`)]);; +e (REWRITE_WITH `&0 < vol X <=> ~NULLSET X`);; +e (MATCH_MP_TAC MEASURABLE_MEASURE_POS_LT);; +e (REWRITE_TAC[ASSUME `X = convex hull {u0, u1, u2, u3:real^3}`]);; + +e (MATCH_MP_TAC MEASURABLE_CONVEX_HULL);; +e (MATCH_MP_TAC FINITE_IMP_BOUNDED);; +e (REWRITE_TAC[Geomdetail.FINITE6]);; +e (ASM_REWRITE_TAC[]);; + +e (ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `!u v. {u,v} IN edgeX V X ==> + (#2.0 <= dist (u,v) /\ dist(u,v) <= sqrt8)`);; + +e (REPEAT GEN_TAC);; +e (REWRITE_TAC[edgeX; IN]);; +e (REWRITE_TAC[MESON[IN] `VX V X x <=> x IN VX V X`]);; +e (ASM_REWRITE_TAC[IN_ELIM_THM]);; +e (STRIP_TAC);; +e (MP_TAC (ASSUME `packing V`));; +e (REWRITE_TAC[packing; REAL_ARITH `#2.0 = &2`] THEN STRIP_TAC);; +e (STRIP_TAC);; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (NEW_GOAL `u:real^3 IN {u0,u1,u2,u3} /\ v IN {u0,u1,u2,u3}`);; +e (DEL_TAC THEN UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC);; +e (SET_TAC[]);; +e (NEW_GOAL `{u0,u1,u2,u3:real^3} SUBSET V`);; +e (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]);; +e (MATCH_MP_TAC BARV_SUBSET);; +e (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (REWRITE_TAC[MESON[IN] `(V:real^3->bool) x <=> x IN V`]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (STRIP_TAC);; +e (REWRITE_TAC[MESON[IN] `(V:real^3->bool) x <=> x IN V`]);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]);; +e (DEL_TAC THEN DEL_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC);; +e (SET_TAC[]);; + +(* ------------------------------------------------------------------------ *) + +e (ABBREV_TAC `s = circumcenter {u0,u1,u2,u3:real^3}`);; +e (NEW_GOAL `dist (u,v:real^3) <= dist (s,u) + dist (s, v)`);; +e (NORM_ARITH_TAC);; +e (NEW_GOAL `!w. w IN {u0,u1,u2,u3:real^3} ==> + radV {u0,u1,u2,u3:real^3} = dist (circumcenter {u0,u1,u2,u3:real^3},w)`);; +e (MATCH_MP_TAC Rogers.OAPVION2);; +e (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]);; +e (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT);; +e (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `dist (s,u) + dist (s,v:real^3) <= sqrt8`);; +e (REWRITE_TAC[Nonlinear_lemma.sqrt8_sqrt2; sqrt2]);; +e (MATCH_MP_TAC (REAL_ARITH `a < x /\ b < x ==> a + b <= &2 * x`));; +e (STRIP_TAC);; + +e (REWRITE_WITH `dist (s,u:real^3) = radV {u0,u1,u2,u3:real^3}`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (EXPAND_TAC "s");; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (DEL_TAC THEN DEL_TAC THEN DEL_TAC THEN DEL_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC);; +e (SET_TAC[]);; + +e (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]);; +e (REWRITE_TAC[GSYM HL]);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_WITH `dist (s,v:real^3) = radV {u0,u1,u2,u3:real^3}`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (EXPAND_TAC "s");; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (DEL_TAC THEN DEL_TAC THEN DEL_TAC THEN DEL_TAC);; +e (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC);; +e (SET_TAC[]);; + +e (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]);; +e (REWRITE_TAC[GSYM HL]);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REAL_ARITH_TAC);; + +e (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} = 4`);; +e (REWRITE_TAC[ARITH_RULE `4 = 3 + 1`; GSYM set_of_list; + GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]);; +e (MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (NEW_GOAL `~(u0 = u1:real^3) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ + ~(u1 = u2) /\ ~(u1 = u3) /\ ~(u2 = u3)`);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`);; +e (REWRITE_TAC[ASSUME `u0 = u1:real^3`; + SET_RULE `{u1, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ]);; +e (ASM_ARITH_TAC);; +e (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`);; +e (REWRITE_TAC[ASSUME `u0 = u2:real^3`; + SET_RULE `{u2, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ]);; +e (ASM_ARITH_TAC);; +e (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`);; +e (REWRITE_TAC[ASSUME `u0 = u3:real^3`; + SET_RULE `{u3, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ]);; +e (ASM_ARITH_TAC);; +e (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`);; +e (REWRITE_TAC[ASSUME `u1 = u2:real^3`; + SET_RULE `{u0, u2, u2, u3} = {u0,u2,u3}`;Geomdetail.CARD3 ]);; +e (ASM_ARITH_TAC);; +e (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`);; +e (REWRITE_TAC[ASSUME `u1 = u3:real^3`; + SET_RULE `{u0, u3, u2, u3} = {u0,u2,u3}`;Geomdetail.CARD3 ]);; +e (ASM_ARITH_TAC);; +e (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`);; +e (REWRITE_TAC[ASSUME `u2 = u3:real^3`; + SET_RULE `{u0, u1, u3, u3} = {u0,u1,u3}`;Geomdetail.CARD3 ]);; +e (ASM_ARITH_TAC);; + +e (NEW_GOAL `edgeX V X = {{u0,u1:real^3}, {u0,u2}, {u0,u3}, + {u1,u2}, {u1,u3}, {u2,u3}}`);; +e (REWRITE_TAC[edgeX]);; +e (ONCE_REWRITE_TAC[SET_EQ_LEMMA]);; +e (REWRITE_TAC[IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; + +e (UNDISCH_TAC `VX V X u` THEN UNDISCH_TAC `VX V X v`);; +e (REWRITE_TAC[MESON[IN] `VX V X s <=> s IN VX V X`]);; +e (ASM_REWRITE_TAC[SET_RULE `v IN {u0, u1, u2, u3} <=> + v = u0 \/ v = u1 \/ v = u2 \/ v = u3`]);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `F`);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; +e (REWRITE_WITH `{u,v} = {v,u:real^3}`);; +e (SET_TAC[]);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; +e (REWRITE_WITH `{u,v} = {v,u:real^3}`);; +e (SET_TAC[]);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; +e (REWRITE_WITH `{u,v} = {v,u:real^3}`);; +e (SET_TAC[]);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; +e (NEW_GOAL `F`);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; +e (REWRITE_WITH `{u,v} = {v,u:real^3}`);; +e (SET_TAC[]);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; +e (REWRITE_WITH `{u,v} = {v,u:real^3}`);; +e (SET_TAC[]);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; +e (NEW_GOAL `F`);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; +e (REWRITE_WITH `{u,v} = {v,u:real^3}`);; +e (SET_TAC[]);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; +e (NEW_GOAL `F`);; +e (ASM_MESON_TAC[]);; +e (ASM_MESON_TAC[]);; + +e (UP_ASM_TAC THEN REWRITE_TAC[SET_RULE `x IN {a,b,c,d,e,f} <=> + x = a \/ x = b \/ x = c \/ x = d \/ x = e \/ x = f`]);; +e (REWRITE_TAC[MESON[IN] `VX V X s <=> s IN VX V X`]);; +e (ASM_REWRITE_TAC[SET_RULE `v IN {u0, u1, u2, u3} <=> + v = u0 \/ v = u1 \/ v = u2 \/ v = u3`]);; +e (REPEAT STRIP_TAC);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN ASM_REWRITE_TAC[]);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u2:real^3` THEN ASM_REWRITE_TAC[]);; +e (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u3:real^3` THEN ASM_REWRITE_TAC[]);; +e (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN ASM_REWRITE_TAC[]);; +e (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u3:real^3` THEN ASM_REWRITE_TAC[]);; +e (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3` THEN ASM_REWRITE_TAC[]);; + +e (STRIP_TAC);; +e (EXPAND_TAC "y1");; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; + +e (STRIP_TAC);; +e (EXPAND_TAC "y2");; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; + +e (STRIP_TAC);; +e (EXPAND_TAC "y3");; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; + +e (STRIP_TAC);; +e (EXPAND_TAC "y4");; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; + +e (STRIP_TAC);; +e (EXPAND_TAC "y5");; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; + +e (STRIP_TAC);; +e (EXPAND_TAC "y6");; +e (FIRST_ASSUM MATCH_MP_TAC);; +e (ASM_REWRITE_TAC[] THEN SET_TAC[]);; + +e (REWRITE_WITH `rad2_y y1 y2 y3 y4 y5 y6 = radV {u0,u1,u2,u3:real^3} pow 2`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (REWRITE_TAC[rad2_y; y_of_x]);; +e (GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] Merge_ineq.GDRQXLGv2));; +e (STRIP_TAC);; +e (STRIP_TAC);; +e (REWRITE_TAC[ARITH_RULE `4 = 3 + 1`; GSYM set_of_list; + GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]);; +e (MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[coplanar_alt]);; +e (REWRITE_TAC[GSYM Trigonometry2.coplanar1]);; +e (REWRITE_TAC[coplanar] THEN STRIP_TAC);; +e (NEW_GOAL `affine hull {u0, u1, u2, u3:real^3} SUBSET + affine hull (affine hull {u, v, w})`);; +e (ASM_SIMP_TAC[Marchal_cells_2.AFFINE_SUBSET_KY_LEMMA]);; +e (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`);; +e (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]);; +e (STRIP_TAC);; +e (NEW_GOAL `NULLSET X`);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`);; +e (STRIP_TAC);; +e (MATCH_MP_TAC NEGLIGIBLE_SUBSET);; +e (EXISTS_TAC `affine hull {u,v,w:real^3}`);; +e (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[ASSUME `X = mcell i V ul`]);; +e (REWRITE_WITH `mcell i V ul = mcell4 V ul`);; +e (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT; ASSUME `i >= 4`]);; +e (REWRITE_TAC[mcell4]);; +e (COND_CASES_TAC);; +e (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (SET_TAC[]);; +e (UP_ASM_TAC THEN ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[GSYM REAL_POW_2]);; +e (EXPAND_TAC "y1" THEN EXPAND_TAC "y2" THEN EXPAND_TAC "y3");; +e (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6");; +e (REWRITE_TAC[]);; +e (REWRITE_WITH `radV {u0, u1, u2, u3:real^3} = hl (ul:(real^3)list)`);; +e (ASM_REWRITE_TAC[HL;set_of_list]);; +e (REWRITE_WITH `hl (ul:(real^3)list) pow 2 < &2 <=> + sqrt (hl ul pow 2) < sqrt (&2)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Real_ext.REAL_PROP_LT_SQRT);; +e (REWRITE_TAC[REAL_LE_POW_2] THEN REAL_ARITH_TAC);; +e (REWRITE_WITH `sqrt (hl (ul:(real^3)list) pow 2) = hl ul`);; +e (MATCH_MP_TAC POW_2_SQRT);; +e (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`));; +e (NEW_GOAL `hl (truncate_simplex 1 ul) <= hl (ul:(real^3)list)`);; +e (MATCH_MP_TAC Rogers.HL_DECREASE);; +e (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3`);; +e (ASM_REWRITE_TAC[IN; ARITH_RULE `1 <= 3`]);; +e (NEW_GOAL `&0 < hl (truncate_simplex 1 (ul:(real^3)list))`);; +e (MATCH_MP_TAC Marchal_cells_2.BARV_IMP_HL_1_POS_LT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (ASM_REAL_ARITH_TAC);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN ASM_REWRITE_TAC[]);; + +(* --- Finish the case 4-cell, the remains are 0-3 cells ------------------ *) +(* ======================================================================== *) + +e (ASM_CASES_TAC `i = 0`);; +e (NEW_GOAL `VX V X = {}`);; +e (REWRITE_WITH `VX V X = V INTER X`);; +e (MATCH_MP_TAC Hdtfnfz.HDTFNFZ);; +e (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0);; +e (ASM_REWRITE_TAC[]);; +e (NEW_GOAL `edgeX V X = {}`);; +e (REWRITE_TAC[edgeX]);; +e (ASM_REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`; SET_RULE `x IN {} <=> F`]);; +e (SET_TAC[]);; +e (REWRITE_TAC[gammaX]);; +e (MATCH_MP_TAC (REAL_ARITH `b = &0 /\ c = &0 /\ &0 <= a ==> a - b + c >= &0`));; +e (REPEAT STRIP_TAC);; +e (ASM_REWRITE_TAC[total_solid; SUM_CLAUSES] THEN REAL_ARITH_TAC);; +e (ASM_REWRITE_TAC[SUM_CLAUSES] THEN REAL_ARITH_TAC);; +e (MATCH_MP_TAC MEASURE_POS_LE);; +e (ASM_REWRITE_TAC[] THEN MATCH_MP_TAC Urrphbz1.MEASURABLE_MCELL);; +e (ASM_REWRITE_TAC[]);; + +(* --- Finish the case 0-cell, the remains are 1-3 cells ------------------ *) +(* ======================================================================== *) +(* The 3-cell case *) + +e (ASM_CASES_TAC `i = 3`);; +e (NEW_GOAL `X = mcell3 V ul`);; +e (ASM_REWRITE_TAC[]);; +e (ASM_SIMP_TAC[MCELL_EXPLICIT]);; +e (UP_ASM_TAC THEN REWRITE_TAC[mcell3]);; +e (COND_CASES_TAC);; +e (STRIP_TAC);; + +e (NEW_GOAL `?u0 u1 u2 u3. ul = [u0; u1; u2; u3:real^3]`);; +e (MATCH_MP_TAC BARV_3_EXPLICIT);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; + + +e (NEW_GOAL `(?s. between s (omega_list_n V ul 2,omega_list_n V ul 3) /\ + dist (u0,s) = sqrt (&2) /\ + mxi V ul = s)`);; +e (MATCH_MP_TAC MXI_EXPLICIT);; +e (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN STRIP_TAC);; +e (ABBREV_TAC `s2 = omega_list_n V ul 2`);; +e (ABBREV_TAC `s3 = omega_list_n V ul 3`);; +e (ABBREV_TAC `vl = truncate_simplex 2 (ul:(real^3)list)`);; +e (NEW_GOAL `s2 IN voronoi_list V vl`);; +e (EXPAND_TAC "s2" THEN EXPAND_TAC "vl");; +e (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN);; +e (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; + +e (NEW_GOAL `s3 IN voronoi_list V vl`);; +e (EXPAND_TAC "s3" THEN EXPAND_TAC "vl");; +e (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN);; +e (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; + +e (NEW_GOAL `s IN voronoi_list V vl`);; +e (MATCH_MP_TAC (SET_RULE `(?x. s IN x /\ x SUBSET t)==> s IN t`));; +e (EXISTS_TAC `convex hull {s2,s3:real^3}`);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL]);; +e (NEW_GOAL `voronoi_list V vl = convex hull (voronoi_list V vl)`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (REWRITE_TAC[CONVEX_HULL_EQ; Packing3.CONVEX_VORONOI_LIST]);; +e (ONCE_REWRITE_TAC[ASSUME `voronoi_list V vl = convex hull voronoi_list V vl`]);; +e (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET);; +e (ASM_SET_TAC[]);; + +e (MP_TAC (ASSUME `s IN voronoi_list V vl`));; +e (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_2; VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `x IN {a,b,c} <=> x=a\/x=b\/x=c`; IN_INTERS]);; +e (STRIP_TAC);; +e (NEW_GOAL `s IN voronoi_closed V u0 /\ s IN voronoi_closed V u1 /\ + s IN voronoi_closed V (u2:real^3)`);; +e (UP_ASM_TAC THEN SET_TAC[]);; +e (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM] THEN + STRIP_TAC);; + +e (NEW_GOAL `u0 IN V /\ u1 IN V /\ u2 IN V /\ (u3:real^3) IN V`);; +e (REWRITE_TAC[SET_RULE `u0 IN V /\ u1 IN V /\ u2 IN V /\ (u3:real^3) IN V <=> + {u0,u1,u2,u3} SUBSET V`; GSYM set_of_list; GSYM + (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]);; +e (MATCH_MP_TAC BARV_SUBSET);; +e (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]);; +e (FIRST_ASSUM MP_TAC THEN REWRITE_TAC[IN] THEN STRIP_TAC);; + +e (NEW_GOAL `dist (s,u1:real^3) = sqrt(&2)`);; +e (REWRITE_TAC[GSYM (ASSUME `dist (u0:real^3, s) = sqrt (&2)`)]);; +e (REWRITE_WITH `dist (u0,s:real^3) = dist (s,u0)`);; +e (NORM_ARITH_TAC);; +e (REWRITE_TAC[REAL_ARITH `a = b <=> a <= b /\ b <= a`]);; +e (ASM_SIMP_TAC[]);; +e (NEW_GOAL `dist (s,u2:real^3) = sqrt(&2)`);; +e (REWRITE_TAC[GSYM (ASSUME `dist (u0:real^3, s) = sqrt (&2)`)]);; +e (REWRITE_WITH `dist (u0,s:real^3) = dist (s,u0)`);; +e (NORM_ARITH_TAC);; +e (REWRITE_TAC[REAL_ARITH `a = b <=> a <= b /\ b <= a`]);; +e (ASM_SIMP_TAC[]);; + +e (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} = 4`);; +e (REWRITE_TAC[ARITH_RULE `4 = 3 + 1`; GSYM set_of_list; + GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]);; +e (MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA);; +e (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]);; +e (NEW_GOAL `~(u0 = u1:real^3) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ + ~(u1 = u2) /\ ~(u1 = u3) /\ ~(u2 = u3)`);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`);; +e (REWRITE_TAC[ASSUME `u0 = u1:real^3`; + SET_RULE `{u1, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ]);; +e (ASM_ARITH_TAC);; +e (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`);; +e (REWRITE_TAC[ASSUME `u0 = u2:real^3`; + SET_RULE `{u2, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ]);; +e (ASM_ARITH_TAC);; +e (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`);; +e (REWRITE_TAC[ASSUME `u0 = u3:real^3`; + SET_RULE `{u3, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ]);; +e (ASM_ARITH_TAC);; +e (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`);; +e (REWRITE_TAC[ASSUME `u1 = u2:real^3`; + SET_RULE `{u0, u2, u2, u3} = {u0,u2,u3}`;Geomdetail.CARD3 ]);; +e (ASM_ARITH_TAC);; +e (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`);; +e (REWRITE_TAC[ASSUME `u1 = u3:real^3`; + SET_RULE `{u0, u3, u2, u3} = {u0,u2,u3}`;Geomdetail.CARD3 ]);; +e (ASM_ARITH_TAC);; +e (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`);; +e (REWRITE_TAC[ASSUME `u2 = u3:real^3`; + SET_RULE `{u0, u1, u3, u3} = {u0,u1,u3}`;Geomdetail.CARD3 ]);; +e (ASM_ARITH_TAC);; + + +e (NEW_GOAL `VX V X = {u0,u1,u2}`);; +e (REWRITE_WITH `VX V X = V INTER X`);; +e (MATCH_MP_TAC Hdtfnfz.HDTFNFZ);; +e (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `3`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `X = mcell 3 V ul`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH + `V INTER mcell 3 V ul = set_of_list (truncate_simplex (3 - 1) ul)`);; +e (MATCH_MP_TAC Lepjbdj.LEPJBDJ);; +e (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3 /\ 3 <= 4`]);; +e (REWRITE_WITH ` mcell 3 V [u0; u1; u2; u3] = X`);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2; + set_of_list]);; + +e (UNDISCH_TAC `X = convex hull (set_of_list vl UNION {mxi V ul})`);; +e (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_2; + ASSUME `ul = [u0;u1;u2;u3:real^3]`; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]);; +e (REWRITE_WITH `mxi V [u0; u1; u2; u3] = s`);; +e (EXPAND_TAC "s" THEN AP_TERM_TAC THEN ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; + +e (NEW_GOAL `~coplanar {u0,u1,u2,s:real^3}`);; +e (ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]);; +e (STRIP_TAC);; +e (NEW_GOAL `NULLSET X`);; +e (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE);; +e (REWRITE_TAC[ASSUME `X = convex hull {u0, u1, u2, s:real^3}`]);; +e (MATCH_MP_TAC COPLANAR_SUBSET);; +e (EXISTS_TAC `affine hull {u0, u1, u2, s:real^3}`);; +e (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]);; +e (UP_ASM_TAC THEN ASM_REWRITE_TAC[]);; + +e (NEW_GOAL `CARD {u0, u1, u2, s:real^3} = 4`);; +e (NEW_GOAL `CARD {u0, u1, u2, s:real^3} <= 4`);; +e (REWRITE_TAC[Geomdetail.CARD4]);; +e (ASM_CASES_TAC `CARD {u0, u1, u2, s:real^3} <= 3`);; +e (NEW_GOAL `F`);; +e (UNDISCH_TAC `~coplanar {u0, u1, u2, s:real^3}`);; +e (REWRITE_TAC[] THEN MATCH_MP_TAC COPLANAR_SMALL);; +e (ASM_REWRITE_TAC[Geomdetail.FINITE6]);; +e (UP_ASM_TAC THEN MESON_TAC[]);; +e (ASM_ARITH_TAC);; + +e (NEW_GOAL `~(u0 = s:real^3) /\ ~(u1 = s) /\ ~(u2 = s)`);; +e (REPEAT STRIP_TAC);; +e (NEW_GOAL `CARD {u0, u1, u2,s:real^3} <= 3`);; +e (REWRITE_TAC[ASSUME `u0 = s:real^3`; + SET_RULE `{s, u1, u2, s} = {s,u1,u2}`;Geomdetail.CARD3 ]);; +e (ASM_ARITH_TAC);; +e (NEW_GOAL `CARD {u0, u1, u2, s:real^3} <= 3`);; +e (REWRITE_TAC[ASSUME `u1 = s:real^3`; + SET_RULE `{u0, s, u2, s} = {u0,u2,s}`;Geomdetail.CARD3 ]);; +e (ASM_ARITH_TAC);; +e (NEW_GOAL `CARD {u0, u1, u2, s:real^3} <= 3`);; +e (REWRITE_TAC[ASSUME `u2 = s:real^3`; + SET_RULE `{u0, u1, s, s} = {u0,u1,s}`;Geomdetail.CARD3 ]);; +e (ASM_ARITH_TAC);; + +(* ========================================================================= *) + +e (ABBREV_TAC `y4 = dist (u1:real^3, u2)`);; +e (ABBREV_TAC `y5 = dist (u0:real^3, u2)`);; +e (ABBREV_TAC `y6 = dist (u0:real^3, u1)`);; + + +e (REWRITE_WITH + `vol X = vol_y sqrt2 sqrt2 sqrt2 y4 y5 y6 /\ + sol u0 X = sol_y y5 y6 sqrt2 sqrt2 sqrt2 y4 /\ + sol u1 X = sol_y y6 y4 sqrt2 sqrt2 sqrt2 y5 /\ + sol u2 X = sol_y y4 y5 sqrt2 sqrt2 sqrt2 y6 /\ + dihX V X (u0,u1) = dih_y y6 y4 sqrt2 sqrt2 sqrt2 y5 /\ + dihX V X (u0,u2) = dih_y y5 y6 sqrt2 sqrt2 sqrt2 y4 /\ + dihX V X (u1,u2) = dih_y y4 y5 sqrt2 sqrt2 sqrt2 y6 /\ + gammaX V X lmfun = gamma3f y4 y5 y6 sqrt2 lmfun`);; + +e (FIRST_ASSUM MATCH_MP_TAC);; +e (MP_TAC (ASSUME `packing V`));; +e (REWRITE_TAC[packing] THEN STRIP_TAC);; +e (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6");; +e (REPEAT STRIP_TAC);; +e (ASM_SIMP_TAC[]);; +e (ASM_SIMP_TAC[]);; +e (ASM_SIMP_TAC[]);; +e (NEW_GOAL `dist (u1,u2) <= dist (s,u1) + dist (s,u2:real^3)`);; +e (NORM_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; +e (NEW_GOAL `dist (u0,u2) <= dist (s,u2) + dist (u0,s:real^3)`);; +e (NORM_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; +e (NEW_GOAL `dist (u0,u1) <= dist (s,u1) + dist (u0,s:real^3)`);; +e (NORM_ARITH_TAC);; +e (ASM_REAL_ARITH_TAC);; + +e (REWRITE_TAC[GSYM d3]);; +e (REWRITE_WITH `eta_y (d3 u1 u2) (d3 u0 u2) (d3 u0 u1) = radV {u0,u1,u2}`);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (MATCH_MP_TAC Collect_geom.RADV_FORMULAR);; + +e (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR);; +e (EXISTS_TAC `s:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_WITH `radV {u0:real^3,u1,u2} = hl (truncate_simplex 2 (ul:(real^3)list))`);; +e (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; HL; + ASSUME `ul = [u0;u1;u2;u3:real^3]`]);; +e (ASM_REWRITE_TAC[]);; + +e (STRIP_TAC);; +e (NEW_GOAL `F`);; +e (UP_ASM_TAC THEN ASM_REWRITE_TAC[]);; +e (UP_ASM_TAC THEN ASM_REWRITE_TAC[]);; + +(* --- Finish the case 3-cell, the remains are 1-cell and 2-cell ---------- *) +(* ======================================================================== *) + + + diff --git a/legacy/oldpacking/packing/development/marchal_cells_2.hl b/legacy/oldpacking/packing/development/marchal_cells_2.hl new file mode 100755 index 0000000..cec4dee --- /dev/null +++ b/legacy/oldpacking/packing/development/marchal_cells_2.hl @@ -0,0 +1,4100 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: *) +(* Chaper : Packing (Marchal Cells 2) *) +(* Date : October 3, 2010 *) +(* *) +(* ========================================================================= *) +(* +#use "/usr/programs/hollight/hollight-svn75/hol.ml";; +loads "Multivariate/flyspeck.ml";; +#use "/home/ky/flyspeck/working/boot.hl";; +flyspeck_needs "trigonometry/trig1.hl";; +flyspeck_needs "trigonometry/trig2.hl";; +flyspeck_needs "trigonometry/trigonometry.hl";; + +(* ================= Loaded files ======================================== *) + +flyspeck_needs "leg/collect_geom.hl";; +flyspeck_needs "fan/fan_defs.hl";; +flyspeck_needs "fan/introduction.hl";; +flyspeck_needs "fan/topology.hl";; +flyspeck_needs "fan/fan_misc.hl";; +flyspeck_needs "fan/HypermapAndFan.hl";; +flyspeck_needs "packing/pack_defs.hl";; +flyspeck_needs "packing/pack_concl.hl";; +flyspeck_needs "packing/pack1.hl";; +flyspeck_needs "packing/pack2.hl";; +flyspeck_needs "packing/pack3.hl";; +flyspeck_needs "packing/Rogers.hl";; +flyspeck_needs "nonlinear/vukhacky_tactics.hl";; +*) + +(* ====================== Open appropriate files ======================= *) + +module Marchal_cells_2 = struct + + +open Rogers;; +open Prove_by_refinement;; +open Vukhacky_tactics;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Sphere;; +flyspeck_needs "packing/marchal_cells.hl";; +open Marchal_cells;; +flyspeck_needs "packing/EMNWUUS.hl";; +open Emnwuus;; + +let seans_fn () = +let (tms,tm) = top_goal () in +let vss = map frees (tm::tms) in +let vs = setify (flat vss) in +map dest_var vs;; + + +(* ======================================================================= *) +(* Lemma 1 *) +let AFF_GE_2_2 = prove + (`!x v w. + DISJOINT {x,v} {w,z} + ==> aff_ge {x,v} {w, z} = + {y | ?t1 t2 t3 t4. + &0 <= t3 /\ &0 <= t4 /\ + t1 + t2 + t3 + t4 = &1 /\ + y = t1 % x + t2 % v + t3 % w + t4 % z}`, + AFF_TAC);; +(* ======================================================================= *) +(* Lemma 2 *) +let MEASURABLE_ROGERS = prove_by_refinement ( + `!V (ul:(real^3)list) k. + saturated V /\ packing V /\ barV V 3 ul ==> measurable (rogers V ul)`, +[ (REPEAT STRIP_TAC); + (REWRITE_TAC[ROGERS]); + (MATCH_MP_TAC MEASURABLE_CONVEX_HULL); + (MATCH_MP_TAC FINITE_IMP_BOUNDED); + (MATCH_MP_TAC FINITE_IMAGE); + (SUBGOAL_THEN `? u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]` CHOOSE_TAC); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (NEW_GOAL `LENGTH (ul:(real^3)list) = 4`); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[FINITE_NUMSEG_LT])]);; + +(* ======================================================================= *) +(* Lemma 3 *) +let CONVEX_RCONE_GE = prove_by_refinement ( + `!a:real^N b r. &0 <= r ==> convex (rcone_ge a b r)`, +[ (REPEAT STRIP_TAC); + (REWRITE_TAC[rcone_ge;convex;rconesgn;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `(u % x + v % y) - a = u % (x - a) + v % (y - a:real^N)`); + (ASM_REWRITE_TAC[VECTOR_SUB_LDISTRIB; VECTOR_MUL_LID; + VECTOR_ARITH `a - x % b + c - y % b = (a + c) - (x + y) % b`]); + (REWRITE_TAC[DOT_LADD;DOT_LMUL]); + (ASM_CASES_TAC `&0 < u`); + + (* 2 Subgoals *) + + (NEW_GOAL + `u * ((x:real^N - a) dot (b - a)) + v * ((y - a) dot (b - a)) >= + u * dist (x,a) * dist (b,a) * r + v * dist (y,a) * dist (b,a) * r`); + (* Subgoal 1.1 *) + + (NEW_GOAL + `u * ((x:real^N - a) dot (b - a)) >= u * dist (x,a) * dist (b,a) * r`); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a - b ==> a >= b`)); + (REWRITE_TAC[REAL_ARITH `a * b * c * d = a * (b * c * d)`; + REAL_ARITH `a * b - a * c = a * (b - c)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL + `v * ((y:real^N - a) dot (b - a)) >= v * dist (y,a) * dist (b,a) * r`); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a - b ==> a >= b`)); + (REWRITE_TAC[REAL_ARITH `a * b * c * d = a * (b * c * d)`; + REAL_ARITH `a * b - a * c = a * (b - c)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL +`dist (u % x + v % y,a) * dist (b,a:real^N) * r <= + u * dist (x,a) * dist (b,a) * r + v * dist (y,a) * dist (b,a) * r`); + (* Subgoal 1.2 *) + + (MATCH_MP_TAC (REAL_ARITH `&0 <= a - b ==> b <= a`)); + (REWRITE_TAC[REAL_ARITH `(a * b * x + c * d * x) - e * x = + (a * b + c * d - e) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + STRIP_TAC; + (REWRITE_TAC[dist]); + (REWRITE_WITH `(u % x + v % y) - a = u % (x - a) + v % (y - a:real^N)`); + (ASM_REWRITE_TAC[VECTOR_SUB_LDISTRIB; VECTOR_MUL_LID; + VECTOR_ARITH `a - x % b + c - y % b = (a + c) - (x + y) % b`]); + (REWRITE_TAC[REAL_ARITH `&0 <= a + b - c <=> c <= a + b`]); + (MATCH_MP_TAC (REAL_ARITH + `m <= norm (u % (x - a:real^N)) + norm (v % (y - a)) /\ + norm (u % (x - a)) = b /\ + norm (v % (y - a)) = c ==> m <= b + c`)); + (REWRITE_TAC[NORM_TRIANGLE;NORM_MUL]); + (REWRITE_WITH `abs u = u /\ abs v = v`); + (ASM_SIMP_TAC[REAL_ABS_REFL]); + + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + +(* Subgoal 2 *) + + (NEW_GOAL `u = &0`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `v = &1`); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_MUL_LZERO;REAL_ADD_LID;REAL_MUL_LID]); + (ASM_REWRITE_TAC[VECTOR_MUL_LZERO;VECTOR_ADD_LID;VECTOR_MUL_LID])]);; + +(* ======================================================================= *) +(* Lemma 4 *) +let FINITE_PERMUTE_3 = prove_by_refinement + (`FINITE {p | p permutes {0, 1, 2}}`, + [MATCH_MP_TAC FINITE_PERMUTATIONS THEN MESON_TAC[FINITE_RULES]]);; +let FINITE_PERMUTE_4 = prove_by_refinement + (`FINITE {p | p permutes {0, 1, 2, 3}}`, + [MATCH_MP_TAC FINITE_PERMUTATIONS THEN MESON_TAC[FINITE_RULES]]);; + +(* ======================================================================= *) +(* Lemma 5 *) +let TRUONG_SET_TAC = let basicthms = +[NOT_IN_EMPTY; IN_UNIV; IN_UNION; IN_INTER; IN_DIFF; IN_INSERT; +IN_DELETE; IN_REST; IN_INTERS; IN_UNIONS; IN_IMAGE] in +let allthms = basicthms @ map (REWRITE_RULE[IN]) basicthms @ +[IN_ELIM_THM; IN] in +let PRESET_TAC = +TRY(POP_ASSUM_LIST(MP_TAC o end_itlist CONJ)) THEN +REPEAT COND_CASES_TAC THEN +REWRITE_TAC[EXTENSION; SUBSET; PSUBSET; DISJOINT; SING] THEN +REWRITE_TAC allthms in +fun ths -> +PRESET_TAC THEN +(if ths = [] then ALL_TAC else MP_TAC(end_itlist CONJ ths)) THEN +MESON_TAC ths ;; + +(* ======================================================================= *) +(* Lemma 6 *) +let DISJOINT_KY_LEMMA = prove_by_refinement ( + `~(x = y) /\ ~(x = z) ==> DISJOINT {x} {y, z:real^3}`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[DISJOINT; INTER ; IN; IN_ELIM_THM;Geomdetail.IN_ACT_SING]); + (MATCH_MP_TAC (MESON [] `(~a ==> F) ==> a`)); + (DISCH_TAC); + (SUBGOAL_THEN `?t. t IN {x' | x' = x /\ {y, z:real^3} x'}` ASSUME_TAC); + (UP_ASM_TAC THEN SET_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (NEW_GOAL `{y, z:real^3} t <=> (t = y) \/ (t = z)`); + (TRUONG_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 7 *) + + +let DIHV_SYM = prove_by_refinement ( + `!(x:real^N) y z t. dihV x y z t = dihV y x z t`, +[ (REPEAT GEN_TAC); + (REWRITE_TAC[dihV] THEN REPEAT LET_TAC); + (MATCH_MP_TAC (MESON[] + `!a b c d x. (a = b) /\ (c = d) ==> arcV x a c = arcV x b d`)); + (REPEAT STRIP_TAC); + (* Break into 2 subgoals with similar proofs *) + + (* Subgoal 1 *) + (EXPAND_TAC "vap'" THEN EXPAND_TAC "vap"); + + (REWRITE_WITH `(va':real^N) = va - vc`); + (EXPAND_TAC "va'" THEN EXPAND_TAC "va" THEN EXPAND_TAC "vc"); + (VECTOR_ARITH_TAC); + + (REWRITE_WITH `(vc':real^N) = --vc`); + (EXPAND_TAC "vc'" THEN EXPAND_TAC "vc"); + (VECTOR_ARITH_TAC); + + (REWRITE_WITH + `(--vc dot --vc) % (va:real^N - vc) = (vc dot vc) % va - (vc dot vc) % vc`); + (REWRITE_TAC[DOT_RNEG;DOT_LNEG;REAL_ARITH `-- --x = x `]); + (VECTOR_ARITH_TAC); + + (MATCH_MP_TAC (VECTOR_ARITH `a = b + c ==> x:real^N - b - c = x - a `)); + (REWRITE_WITH `((va:real^N - vc) dot --vc) % --vc = + (va dot vc) % vc - (vc dot vc) % vc`); + (REWRITE_TAC[DOT_RNEG;DOT_LNEG;VECTOR_MUL_LNEG; VECTOR_MUL_RNEG]); + (REWRITE_TAC[VECTOR_NEG_MINUS1;VECTOR_MUL_ASSOC]); + (REWRITE_TAC[REAL_ARITH `-- &1 * -- &1 * x = x`; + DOT_LSUB;VECTOR_SUB_RDISTRIB]); + (VECTOR_ARITH_TAC); + + (* Subgoal 2 *) + (EXPAND_TAC "vbp'" THEN EXPAND_TAC "vbp"); + (REWRITE_WITH `(vb':real^N) = vb - vc`); + (EXPAND_TAC "vb'" THEN EXPAND_TAC "vb" THEN EXPAND_TAC "vc"); + (VECTOR_ARITH_TAC); + + (REWRITE_WITH `(vc':real^N) = --vc`); + (EXPAND_TAC "vc'" THEN EXPAND_TAC "vc"); + (VECTOR_ARITH_TAC); + + (REWRITE_WITH + `(--vc dot --vc) % (vb:real^N - vc) = (vc dot vc) % vb - (vc dot vc) % vc`); + (REWRITE_TAC[DOT_RNEG;DOT_LNEG;REAL_ARITH `-- --x = x `]); + (VECTOR_ARITH_TAC); + + (MATCH_MP_TAC (VECTOR_ARITH `a = b + c ==> x:real^N - b - c = x - a `)); + (REWRITE_WITH `((vb:real^N - vc) dot --vc) % --vc = + (vb dot vc) % vc - (vc dot vc) % vc`); + (REWRITE_TAC[DOT_RNEG;DOT_LNEG;VECTOR_MUL_LNEG; VECTOR_MUL_RNEG]); + (REWRITE_TAC[VECTOR_NEG_MINUS1;VECTOR_MUL_ASSOC]); + (REWRITE_TAC[REAL_ARITH `-- &1 * -- &1 * x = x`; + DOT_LSUB;VECTOR_SUB_RDISTRIB]); + (VECTOR_ARITH_TAC)]);; + + +(* ======================================================================= *) +(* Lemma 8 *) +let RCONE_GT_SUBSET_RCONE_GE = prove_by_refinement ( + `! z:real^3 w h. rcone_gt z w h SUBSET rcone_ge z w h`, +[ (REPEAT GEN_TAC THEN REWRITE_TAC[RCONE_GT_GE]); + (SET_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 9 *) +let MCELL_EXPLICIT = prove_by_refinement ( + `!k ul V. + mcell 0 V ul = mcell0 V ul /\ + mcell 1 V ul = mcell1 V ul /\ + mcell 2 V ul = mcell2 V ul /\ + mcell 3 V ul = mcell3 V ul /\ + (k >= 4 ==> mcell k V ul = mcell4 V ul)`, +[ (NEW_GOAL `((1 = 0) ==> F) /\ ((2 = 0) ==> F) /\ ((3 = 0) ==> F) /\ +((2 = 1) ==> F) /\ ((3 = 1) ==> F) /\ ((3 = 2) ==> F)`); + (ARITH_TAC); + (REPEAT STRIP_TAC); (REWRITE_TAC[mcell]); + (REWRITE_TAC[mcell]); (COND_CASES_TAC); + (ASM_MESON_TAC[]); (MESON_TAC[]); + (REWRITE_TAC[mcell]); (COND_CASES_TAC); + (ASM_MESON_TAC[]); (COND_CASES_TAC); + (ASM_MESON_TAC[]); (MESON_TAC[]); + (REWRITE_TAC[mcell]); (COND_CASES_TAC); + (ASM_MESON_TAC[]); (COND_CASES_TAC); + (ASM_MESON_TAC[]); (COND_CASES_TAC); + (ASM_MESON_TAC[]); (MESON_TAC[]); + (REWRITE_TAC[mcell]); (COND_CASES_TAC); + (ASM_MESON_TAC[ARITH_RULE `~(0 >= 4)`]); + (COND_CASES_TAC); (ASM_MESON_TAC[ARITH_RULE `~(1 >= 4)`]); + (COND_CASES_TAC); (ASM_MESON_TAC[ARITH_RULE `~(2 >= 4)`]); + (COND_CASES_TAC); (ASM_MESON_TAC[ARITH_RULE `~(3 >= 4)`]); + (MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 10 *) +let EVENTUALLY_RADIAL_EMPTY = prove_by_refinement ( + `!v:real^3. eventually_radial v {} `, +[(STRIP_TAC); + (REWRITE_TAC[eventually_radial;radial]); + (EXISTS_TAC `&1`); + (REWRITE_TAC[REAL_ARITH `&1 > &0`;INTER_SUBSET]); + (REPEAT STRIP_TAC); + (NEW_GOAL `F`); + (DEL_TAC THEN DEL_TAC THEN UP_ASM_TAC); + (REWRITE_TAC[INTER_EMPTY]); + (SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 11 *) +let EVENTUALLY_RADIAL_NOT_IN_CLOSED_SET = prove_by_refinement ( + `!v:real^3 S. ~(S v) /\ (closed S)==> eventually_radial v S`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `?r. r > &0 /\ ball(v:real^3, r) INTER S = {}`); + (UP_ASM_TAC THEN REWRITE_TAC[closed; open_def]); + (DISCH_TAC); + (MP_TAC (SPEC `v:real^3` (ASSUME `!x. x IN (:real^3) DIFF S + ==> (?e. &0 < e /\ + (!x'. dist (x',x) < e ==> x' IN (:real^3) DIFF S))`))); + (DISCH_TAC); + (NEW_GOAL `(?e. &0 < e /\ (!x'. dist (x',v:real^3) < e ==> x' IN (:real^3) DIFF S))`); + (FIRST_X_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN_DIFF]); + (ASM_REWRITE_TAC[IN]); + (MESON_TAC[IN_UNIV;IN]); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `e:real`); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[ball]); + (MATCH_MP_TAC (SET_RULE `(!a:real^3. (a IN A) ==> ~(a IN B)) ==> (A INTER B = {})`)); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (GEN_TAC THEN DISCH_TAC); + (NEW_GOAL `a IN (:real^3) DIFF S ==> ~S a `); + (REWRITE_TAC[IN_DIFF;IN; IN_ELIM_THM]); + (MESON_TAC[]); + (FIRST_X_ASSUM MATCH_MP_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[eventually_radial;radial]); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `r:real`); + (ASM_REWRITE_TAC[INTER_SUBSET]); + (REPEAT STRIP_TAC); + (NEW_GOAL `F`); + (DEL_TAC THEN DEL_TAC); + (UP_ASM_TAC THEN REWRITE_WITH `S INTER ball (v,r) = ball (v:real^3,r) INTER S`); + (SET_TAC[]); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 12 *) +let CLOSED_CONVEX_HULL_FINITE = prove + (`!s. FINITE s ==> closed(convex hull s)`, + MESON_TAC[COMPACT_IMP_CLOSED; COMPACT_CONVEX_HULL; FINITE_IMP_COMPACT]);; + +(* ======================================================================= *) +(* Lemma 13 *) +let CLOSED_ROGERS = prove_by_refinement ( + `! V ul:(real^3)list. + saturated V /\ packing V /\ barV V 3 ul ==> closed (rogers V ul)`, +[(REPEAT STRIP_TAC THEN REWRITE_TAC[ROGERS]); + (MATCH_MP_TAC CLOSED_CONVEX_HULL_FINITE); + (MATCH_MP_TAC FINITE_IMAGE); + (REWRITE_WITH `{j | j < LENGTH (ul:(real^3)list)} ={j| j < 4}`); + (MATCH_MP_TAC (MESON[] `(a = b) ==> ({j:num| j < a} = {j | j < b})`)); + (NEW_GOAL `?u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]`); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (REWRITE_TAC[FINITE_NUMSEG_LT])]);; + +(* ======================================================================= *) +(* Lemma 14 *) +let CLOSED_SET_OF_LIST_KY_LEMMA_1 = prove_by_refinement ( + `!V ul. + saturated V /\ packing V /\ barV V 3 (ul:(real^3)list) + ==> closed + (convex hull (set_of_list (truncate_simplex 2 ul) UNION {mxi V ul}))`, +[(REPEAT STRIP_TAC THEN MATCH_MP_TAC CLOSED_CONVEX_HULL_FINITE); + (NEW_GOAL `?u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]`); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (REWRITE_WITH `truncate_simplex 2 ul = [u0;u1;u2:real^3]`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_TAC[set_of_list]); + (REWRITE_TAC[ SET_RULE `!a b c d. {a,b,c} UNION {d:real^3} = {a,b,c,d}`]); + (REWRITE_TAC[Geomdetail.FINITE6])]);; +(* ======================================================================= *) +(* Lemma 15 *) +let CLOSED_SET_OF_LIST_KY_LEMMA_2 = prove_by_refinement ( + `!V (ul:(real^3)list). + saturated V /\ packing V /\ barV V 3 ul ==> + closed (convex hull set_of_list ul)`, +[(REPEAT STRIP_TAC THEN MATCH_MP_TAC CLOSED_CONVEX_HULL_FINITE); + (NEW_GOAL `?u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]`); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_TAC[Geomdetail.FINITE6])]);; + +(* ======================================================================= *) +(* Lemma 16 *) +let CLOSED_RCONE_GE = prove_by_refinement ( + `!v0 v1:real^3 a. &0 < a ==> closed (rcone_ge v0 v1 a)`, +[(REPEAT STRIP_TAC THEN REWRITE_TAC[rcone_ge;rconesgn]); + (REWRITE_TAC[closed]); + (REWRITE_WITH `(:real^3) DIFF + {x | (x - v0) dot (v1 - v0) >= dist (x,v0) * dist (v1,v0) * a} = + {x | (x - v0) dot (v1 - v0) < dist (x,v0) * dist (v1,v0) * a}`); + (REWRITE_TAC[Vol1.SET_EQ]); + (REWRITE_TAC[IN_DIFF;IN;IN_ELIM_THM;IN_UNIV]); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[open_def;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `~(v0 = v1:real^3)`); + STRIP_TAC; + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_SUB_REFL; DOT_RZERO; DIST_REFL; REAL_MUL_LZERO;REAL_MUL_RZERO]); + (REAL_ARITH_TAC); + + (ABBREV_TAC `s = dist (x,v0:real^3) * dist (v1,v0) * a`); + (ABBREV_TAC `t = (x - v0) dot (v1 - v0:real^3)`); + (EXISTS_TAC `(s - t) / (dist (v1,v0) * a + dist (v1, v0:real^3))`); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LT_DIV); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LT_ADD); + (ASM_SIMP_TAC [DIST_POS_LT]); + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_SIMP_TAC [DIST_POS_LT]); + + (REPEAT STRIP_TAC); + (NEW_GOAL `(x' - v0) dot (v1 - v0) <= + (x - v0:real^3) dot (v1 - v0) + dist (x',x) * dist (v1,v0) `); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a - b ==> b <= a`)); + (REWRITE_TAC[REAL_ARITH `(x + y) - z = (x - z) + y`]); + (REWRITE_TAC[VECTOR_ARITH `x dot y - z dot y = (x - z) dot y`]); + (REWRITE_TAC[VECTOR_ARITH `(x:real^3) - y - (z - y) = (x - z)`;dist]); + (REWRITE_WITH ` (x - x':real^3) dot (v1 - v0:real^3) = -- ((x' - x) dot (v1 - v0))`); + (VECTOR_ARITH_TAC); + + (MATCH_MP_TAC (REAL_ARITH `b <= a ==> &0 <= --b + a`)); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ]); + (NEW_GOAL `dist (x',v0) * dist (v1,v0:real^3) * a >= + dist (x,v0) * dist (v1,v0) * a - dist (x',x) * dist (v1,v0) * a `); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a - b ==> a >= b`)); + (REWRITE_TAC[REAL_ARITH `x * a * b - (y * a * b - z * a * b) = (x - y + z) * (a * b) `]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (MATCH_MP_TAC (REAL_ARITH `b <= a + c ==> &0 <= a - b + c`)); + (REWRITE_TAC[DIST_SYM]); + (REWRITE_WITH `dist (x, x':real^3) = dist (x', x)`); + (REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[DIST_TRIANGLE]); + (MATCH_MP_TAC REAL_LE_MUL); + + (ASM_SIMP_TAC[REAL_ARITH `&0 < a ==> &0 <= a`; DIST_POS_LE ]); + (MATCH_MP_TAC (REAL_ARITH `(?n q. m <= n /\ p >= q /\ n < q) ==> m < p`)); + (EXISTS_TAC `(x - v0) dot (v1 - v0) + dist (x',x) * dist (v1,v0:real^3)`); + (EXISTS_TAC `dist (x,v0:real^3) * dist (v1,v0) * a - dist (x',x) * dist (v1,v0) * a`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `t + c * b < s - c * b * a <=> c * (b * a + b) < s - t +`]); + (NEW_GOAL `dist (x',x) * (dist (v1,v0:real^3) * a + dist (v1,v0)) < s - t <=> + dist (x':real^3,x) < (s - t) / (dist (v1,v0) * a + dist (v1,v0))`); + (ONCE_REWRITE_TAC[MESON[] `!a b. (a <=> b) <=> (b <=> a)`]); + (MATCH_MP_TAC REAL_LT_RDIV_EQ); + (MATCH_MP_TAC REAL_LT_ADD); + (ASM_SIMP_TAC[REAL_LT_MUL; REAL_ARITH `&0 < a ==> &0 <= a`; DIST_POS_LT]); + (ASM_REWRITE_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 17 *) +let BARV_IMP_HL_1_POS_LT = prove_by_refinement ( + `!V ul:(real^3)list. + saturated V /\ packing V /\ barV V 3 ul + ==> &0 < hl (truncate_simplex 1 ul)`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `?u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]`); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (REPEAT (FIRST_X_ASSUM CHOOSE_TAC)); + (ABBREV_TAC `vl = truncate_simplex 1 (ul:(real^3)list)`); + (NEW_GOAL `hl (vl:(real^3)list) = dist (circumcenter (set_of_list vl),HD vl)`); + (MATCH_MP_TAC HL_EQ_DIST0); + (EXISTS_TAC `V:real^3->bool`); + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + + (NEW_GOAL `&0 <= hl (vl:(real^3)list)`); + (ASM_REWRITE_TAC[DIST_POS_LE]); + (ASM_CASES_TAC `&0 < hl (vl:(real^3)list)`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `hl (vl:(real^3)list) = &0`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[DIST_EQ_0]); + (REWRITE_WITH `vl = [u0;u1:real^3]`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_TAC[set_of_list;HD;CIRCUMCENTER_2;midpoint]); + STRIP_TAC; + (NEW_GOAL `(u0:real^3) = u1`); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (NEW_GOAL `barV V 1 (vl:(real^3)list)`); + (EXPAND_TAC "vl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + (NEW_GOAL `CARD (set_of_list (vl:(real^3)list)) = 1 + 1`); + (ASM_MESON_TAC[BARV_IMP_LENGTH_EQ_CARD]); + (UP_ASM_TAC THEN REWRITE_WITH `vl = [u0;u1:real^3]`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_TAC[ SET_RULE `{u1, u1:real^3} = {u1}`]); + (REWRITE_TAC[Hypermap.CARD_SINGLETON]); + (ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 18 *) +let CLOSED_MCELL = prove_by_refinement ( + `!V ul k v:real^3. + saturated V /\ packing V /\ barV V 3 ul + ==> closed (mcell k V ul)`, +[(REPEAT STRIP_TAC); + (ASM_CASES_TAC `k = 0`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT;mcell0]); + (MATCH_MP_TAC CLOSED_DIFF); + (ASM_MESON_TAC[CLOSED_ROGERS; OPEN_BALL]); + + (ASM_CASES_TAC `k = 1`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT;mcell1]); + (COND_CASES_TAC); + (MATCH_MP_TAC CLOSED_DIFF); + (STRIP_TAC); + (MATCH_MP_TAC CLOSED_INTER); + (ASM_MESON_TAC[CLOSED_ROGERS; CLOSED_CBALL]); + (REWRITE_TAC[OPEN_RCONE_GT]); + (REWRITE_TAC[CLOSED_EMPTY]); + + (SUBGOAL_THEN `? u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]` CHOOSE_TAC); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (ASM_CASES_TAC `k = 2`); + + (ASM_REWRITE_TAC[MCELL_EXPLICIT;mcell2]); + (COND_CASES_TAC); + LET_TAC; + (MATCH_MP_TAC CLOSED_INTER); + (STRIP_TAC); + + (MATCH_MP_TAC CLOSED_RCONE_GE); + (EXPAND_TAC "a"); + (MATCH_MP_TAC REAL_LT_DIV); + (SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]); + (ASM_MESON_TAC[BARV_IMP_HL_1_POS_LT]); + + (MATCH_MP_TAC CLOSED_INTER); + (STRIP_TAC); + (MATCH_MP_TAC CLOSED_RCONE_GE); + (EXPAND_TAC "a"); + (MATCH_MP_TAC REAL_LT_DIV); + (SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]); + (ASM_MESON_TAC[BARV_IMP_HL_1_POS_LT]); + + (MATCH_MP_TAC CLOSED_AFF_GE); + (MESON_TAC[Geomdetail.FINITE6]); + (MESON_TAC[CLOSED_EMPTY]); + + (ASM_CASES_TAC `k = 3`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT;mcell3]); + (COND_CASES_TAC); + (ASM_MESON_TAC[CLOSED_SET_OF_LIST_KY_LEMMA_1]); + (MESON_TAC[CLOSED_EMPTY]); + + (NEW_GOAL `k >= 4`); + (ASM_ARITH_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT;mcell4]); + (COND_CASES_TAC); + (ASM_MESON_TAC[CLOSED_SET_OF_LIST_KY_LEMMA_2]); + (MESON_TAC[CLOSED_EMPTY]) +]);; + +(* ======================================================================= *) +(* Lemma 19 *) +let BARV_IMP_u0_IN_V = prove_by_refinement ( + `!V ul u0 u1 u2 u3. + saturated V /\ packing V /\ barV V 3 ul /\ ul = [u0;u1;u2;u3:real^3] + ==> u0 IN V`, +[(REWRITE_TAC[BARV; VORONOI_NONDG]); + (REPEAT STRIP_TAC); + (NEW_GOAL `initial_sublist [u0:real^3] ul /\ 0 < LENGTH [u0]`); + (REWRITE_TAC[INITIAL_SUBLIST;LENGTH; APPEND; ARITH_RULE `0 < SUC 0`]); + (EXISTS_TAC `[u1;u2;u3:real^3]`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list [u0:real^3] SUBSET V`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[set_of_list]); + (SET_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 20 *) +let ROGERS_INTER_V_LEMMA = prove_by_refinement ( + `!V ul v:real^3. + saturated V /\ packing V /\ barV V 3 ul /\ v IN V /\ (rogers V ul v) + ==> v = HD ul`, +[(REPEAT STRIP_TAC); + (SUBGOAL_THEN `? u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]` CHOOSE_TAC); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (ASM_REWRITE_TAC[HD]); + + (NEW_GOAL `(rogers V ul) SUBSET (voronoi_closed V (u0:real^3))`); + (REWRITE_TAC[SUBSET]); + (REPEAT STRIP_TAC); + (NEW_GOAL `!p. p IN voronoi_closed V u0 <=> + (?vl. vl IN barV V 3 /\ + p IN rogers V vl /\ + truncate_simplex 0 vl = [u0:real^3])`); + (GEN_TAC THEN MATCH_MP_TAC GLTVHUM); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[BARV_IMP_u0_IN_V]); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `ul:(real^3)list`); + (ASM_REWRITE_TAC[IN; TRUNCATE_SIMPLEX_EXPLICIT_0]); + (NEW_GOAL `(v:real^3) IN (voronoi_closed V u0)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed;IN;IN_ELIM_THM]); + (DISCH_TAC); + (NEW_GOAL `dist (v,u0) <= dist (v,v:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[GSYM IN]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL]); + (DISCH_TAC); + (NEW_GOAL `dist (v, u0:real^3) = &0`); + (NEW_GOAL `&0 <= dist (v, u0:real^3)`); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[DIST_EQ_0])]);; + +(* ======================================================================= *) +(* Lemma 21 *) +let CONVEX_HULL_4 = prove + (`convex hull {a,b,c,d} = + { u % a + v % b + w % c + z %d| + &0 <= u /\ &0 <= v /\ &0 <= w /\ &0 <= z /\ u + v + w + z = &1}`, + SIMP_TAC[CONVEX_HULL_FINITE; FINITE_INSERT; FINITE_RULES] THEN + SIMP_TAC[CONVEX_HULL_FINITE_STEP; FINITE_INSERT; FINITE_RULES] THEN + REWRITE_TAC[REAL_ARITH `x - y = z:real <=> x = y + z`; + VECTOR_ARITH `x - y = z:real^N <=> x = y + z`] THEN + REWRITE_TAC[VECTOR_ADD_RID; REAL_ADD_RID] THEN SET_TAC[]);; + +(* ======================================================================= *) +(* Lemma 22 *) +let REAL_LE_DIV_SIMPLIFY_KY_LEMMA = prove_by_refinement ( + `!a b c. &0 < a /\ b <= c / a ==> a * b <= c`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `a * b <= a * (c / a)`); + (REWRITE_TAC[REAL_ARITH `x * y <= x * z <=> &0 <= x * (z - y)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `a * c / a = c`); + (REWRITE_TAC[REAL_ARITH `a * c / a = c / a * a`]); + (MATCH_MP_TAC REAL_DIV_RMUL); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 23 *) + +let EVENTUALLY_RADIAL_CONVEX_HULL_4_sub1 = prove_by_refinement ( + `!a b c d:real^3. + ~( a IN convex hull {b , c, d}) + ==> eventually_radial a (convex hull {a, b , c, d})`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[eventually_radial]); + (ABBREV_TAC `s = convex hull {b , c, d:real^3}`); + + (NEW_GOAL `(?(x:real^3). x IN s /\ + (!y:real^3. y IN s ==> dist (a,x) <= dist (a,y)))`); + (MATCH_MP_TAC DISTANCE_ATTAINS_INF); + (EXPAND_TAC "s"); + (STRIP_TAC); + (MATCH_MP_TAC CLOSED_CONVEX_HULL_FINITE); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[CONVEX_HULL_EQ_EMPTY]); + (SET_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `dist (a, x:real^3)`); + + (NEW_GOAL `dist (a, x) <= dist (a, b:real^3) /\ + dist (a, x) <= dist (a, c:real^3) /\ + dist (a, x) <= dist (a, d:real^3)`); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "s"); + (MATCH_MP_TAC (SET_RULE `b IN {b} /\ {b} SUBSET s ==> b IN s `)); + (STRIP_TAC); + (SET_TAC[]); + (NEW_GOAL `{b:real^3} = convex hull {b}`); + (ONCE_REWRITE_TAC[MESON[] `a = b <=> b = a` ]); + (REWRITE_TAC[CONVEX_HULL_EQ]); + (REWRITE_TAC[CONVEX_SING]); + (ONCE_ASM_REWRITE_TAC[]); + (EXPAND_TAC "s"); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (SET_TAC[]); + + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "s"); + (MATCH_MP_TAC (SET_RULE `c IN {c} /\ {c} SUBSET s ==> c IN s `)); + (STRIP_TAC); + (SET_TAC[]); + (NEW_GOAL `{c:real^3} = convex hull {c}`); + (ONCE_REWRITE_TAC[MESON[] `a = b <=> b = a` ]); + (REWRITE_TAC[CONVEX_HULL_EQ]); + (REWRITE_TAC[CONVEX_SING]); + (ONCE_ASM_REWRITE_TAC[]); + (EXPAND_TAC "s"); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (SET_TAC[]); + + + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "s"); + (MATCH_MP_TAC (SET_RULE `c IN {c} /\ {c} SUBSET s ==> c IN s `)); + (STRIP_TAC); + (SET_TAC[]); + (NEW_GOAL `{d:real^3} = convex hull {d}`); + (ONCE_REWRITE_TAC[MESON[] `a = b <=> b = a` ]); + (REWRITE_TAC[CONVEX_HULL_EQ]); + (REWRITE_TAC[CONVEX_SING]); + (ONCE_ASM_REWRITE_TAC[]); + (EXPAND_TAC "s"); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (SET_TAC[]); + +(* ======== break main lemma into 2 smaller ones =============== *) +(* subgoal 1 *) + + (STRIP_TAC); + (ASM_CASES_TAC `dist (a:real^3, x) = &0`); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_EQ_0]); + (DISCH_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (NEW_GOAL `&0 <= dist (a, x:real^3)`); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + +(* subgoal 2 *) + + (REWRITE_TAC[radial; INTER_SUBSET]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[IN_INTER]); + (STRIP_TAC); + (ASM_CASES_TAC `u:real^3 = vec 0`); + (ASM_REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_RID]); + (REWRITE_TAC[CONVEX_HULL_4;IN;IN_ELIM_THM]); + (EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0`); + (REWRITE_TAC[REAL_ARITH `&0 <= &1 /\ &0 <= &0 /\ &1 + &0 + &0 + &0 = &1`]); + (VECTOR_ARITH_TAC); + (NEW_GOAL `?y. y IN convex hull {b, c, d:real^3} /\ + (a + t % u) IN convex hull {a, y}`); + (UNDISCH_TAC `a + u IN convex hull {a, b, c, d:real^3} INTER ball (a,dist (a,x))`); + (REWRITE_TAC[CONVEX_HULL_4;IN_INTER;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `(&1 / (&1 - u')) % (v % b + w % c + z % (d:real^3))`); + (STRIP_TAC); + (REWRITE_TAC[CONVEX_HULL_3;IN_ELIM_THM]); + (EXISTS_TAC ` v / (&1 - u')`); + (EXISTS_TAC ` w / (&1 - u')`); + (EXISTS_TAC ` z / (&1 - u')`); + (REPEAT STRIP_TAC); + + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a + b + c) / x`]); + (MATCH_MP_TAC (MESON [REAL_DIV_REFL] `~(y = &0) /\ (x = y) ==> x / y = &1`)); + (ASM_REWRITE_TAC[REAL_ARITH `!a b c d e. + (&1 - a = &0 <=> a = &1) /\ ( b + c + d = &1 - e <=> e + b + c + d = &1)`]); + (STRIP_TAC); + (NEW_GOAL `v = &0 /\ w = &0 /\ z = &0`); + (ASM_REAL_ARITH_TAC); + (UNDISCH_TAC `(a:real^3) + u = u' % a + v % b + w % c + z % d`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO]); + (REWRITE_TAC[VECTOR_ARITH `a + (u:real^3) = a + vec 0 + vec 0 + vec 0 <=> u = vec 0`]); + (ASM_MESON_TAC[]); + + (REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC]); + (REWRITE_TAC[REAL_ARITH `!x y. &1 / x * y = y / x`]); + + (REWRITE_WITH `v % (b:real^3) + w % c + z % d = a + u - u' % a`); + (SWITCH_TAC THEN UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `!a t u. a + u - t % a = (&1 - t) % a + u`]); + (REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC]); + (REWRITE_WITH `&1 / (&1 - u') * (&1 - u') = &1`); + (REWRITE_TAC[REAL_ARITH `!x y. &1 / x * y = y / x`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ARITH `!a. &1 - a = &0 <=> a = &1`]); + (STRIP_TAC); + (NEW_GOAL `v = &0 /\ w = &0 /\ z = &0`); + (ASM_REAL_ARITH_TAC); + (UNDISCH_TAC `(a:real^3) + u = u' % a + v % b + w % c + z % d`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO]); + (REWRITE_TAC[VECTOR_ARITH `a + (u:real^3) = a + vec 0 + vec 0 + vec 0 <=> u = vec 0`]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[VECTOR_MUL_LID; CONVEX_HULL_2;IN_ELIM_THM]); + (EXISTS_TAC `&1 - t * (&1 - u') `); + (EXISTS_TAC `t * (&1 - u')`); + (REPEAT STRIP_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= &1 - a <=> a <= &1`]); + (NEW_GOAL `dist (a:real^3, a + u) / (&1 - u') = dist (a, a + (&1 / (&1 - u')) % u)`); + (REWRITE_TAC[dist; VECTOR_ARITH `a - (a + s:real^3) = -- s`; NORM_NEG; NORM_MUL; REAL_ABS_DIV; REAL_ABS_1]); + (ONCE_REWRITE_TAC[REAL_ARITH `&1 / x * y = y / x`]); + (AP_TERM_TAC); + (ONCE_REWRITE_TAC[MESON[] `x = y <=> y = x`]); + (REWRITE_TAC[REAL_ABS_REFL]); + (REWRITE_TAC[REAL_ARITH `!a. &0 <= &1 - a <=> a <= &1`]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `(&1 - u') * dist (a, x:real^3) <= norm (u:real^3) `); + (REWRITE_WITH `norm (u:real^3) = dist (a, a +u)`); + (REWRITE_TAC[dist]); + (NORM_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV_SIMPLIFY_KY_LEMMA); + (ASM_REWRITE_TAC[]); + + (STRIP_TAC); + (ASM_CASES_TAC `(&0 < &1 - u')`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `u' = &1`); + (NEW_GOAL `u' <= &1`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `&1 <= u'`); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `v = &0 /\ w = &0 /\ z = &0`); + (ASM_REAL_ARITH_TAC); + (UNDISCH_TAC `(a:real^3) + u = u' % a + v % b + w % c + z % d`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO]); + (REWRITE_TAC[VECTOR_ARITH `a + (u:real^3) = a + vec 0 + vec 0 + vec 0 <=> u = vec 0`]); + (ASM_MESON_TAC[]); + + (UNDISCH_TAC `x IN s /\ (!y. y IN s ==> dist (a:real^3,x) <= dist (a,y))`); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "s" THEN REWRITE_TAC[CONVEX_HULL_3; IN; IN_ELIM_THM]); + + (EXISTS_TAC ` v / (&1 - u')`); + (EXISTS_TAC ` w / (&1 - u')`); + (EXISTS_TAC ` z / (&1 - u')`); + (REPEAT STRIP_TAC); + + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a + b + c) / x`]); + (MATCH_MP_TAC (MESON [REAL_DIV_REFL] `~(y = &0) /\ (x = y) ==> x / y = &1`)); + (ASM_REWRITE_TAC[REAL_ARITH `!a b c d e. + (&1 - a = &0 <=> a = &1) /\ ( b + c + d = &1 - e <=> e + b + c + d = &1)`]); + (STRIP_TAC); + (NEW_GOAL `v = &0 /\ w = &0 /\ z = &0`); + (ASM_REAL_ARITH_TAC); + (UNDISCH_TAC `(a:real^3) + u = u' % a + v % b + w % c + z % d`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO]); + (REWRITE_TAC[VECTOR_ARITH `a + (u:real^3) = a + vec 0 + vec 0 + vec 0 <=> u = vec 0`]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `v / (&1 - u') % b + w / (&1 - u') % c + z / (&1 - u') % d = + &1 / (&1 - u') % (a + u:real^3) - u'/ (&1 - u') % a `); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC]); + (REWRITE_TAC[REAL_ARITH `&1 / x * y = y / x`]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ADD_LDISTRIB]); + + + (REWRITE_TAC[VECTOR_ARITH `a + b = (t % a + b) - s % a <=> a = (t - s) % a`]); + (REWRITE_WITH `&1 / (&1 - u') - u' / (&1 - u') = &1`); + (REWRITE_TAC[REAL_ARITH `a / b - c / b = (a - c) / b`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ARITH `!a. &1 - a = &0 <=> a = &1`]); + (STRIP_TAC); + (NEW_GOAL `v = &0 /\ w = &0 /\ z = &0`); + (ASM_REAL_ARITH_TAC); + (UNDISCH_TAC `(a:real^3) + u = u' % a + v % b + w % c + z % d`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO]); + (REWRITE_TAC[VECTOR_ARITH `a + (u:real^3) = a + vec 0 + vec 0 + vec 0 <=> u = vec 0`]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[VECTOR_MUL_LID]); + + + + (NEW_GOAL `t * ((&1 - u') * dist (a,x:real^3)) <= t * norm (u:real^3)`); + (REWRITE_TAC[REAL_ARITH `t * s <= t * k <=> &0 <= t * (k - s)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `t * ((&1 - u') * dist (a,x:real^3)) <= dist (a, x)`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL ` t * (&1 - u') <= &1 <=> + (t * (&1 - u')) * dist (a,x:real^3) <= &1 * dist (a,x)`); + (ONCE_REWRITE_TAC[MESON[] `(a <=> b) <=> (b <=> a)`]); + (MATCH_MP_TAC REAL_LE_RMUL_EQ); + (ASM_CASES_TAC `dist (a:real^3, x) = &0`); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_EQ_0]); + (DISCH_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (NEW_GOAL `&0 <= dist (a, x:real^3)`); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + + + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + + (REWRITE_TAC[VECTOR_SUB_RDISTRIB; VECTOR_ADD_LDISTRIB; VECTOR_MUL_LID; VECTOR_MUL_ASSOC]); + + (REWRITE_TAC [VECTOR_ARITH `a + m % u = a - t + t + n % u <=> (m - n) % u = vec 0`; VECTOR_MUL_EQ_0]); + (DISJ1_TAC); + (REWRITE_TAC[REAL_ARITH `(a * b) * &1 / b = a * (b / b)`]); + + +(* ======================================================================== *) + + (REWRITE_TAC[REAL_ARITH `t - t * s = t * (&1 - s)`]); + (MATCH_MP_TAC (MESON[REAL_MUL_RZERO] ` x = &0 ==> t * x = &0`)); + (REWRITE_TAC[REAL_ARITH `&1 - t = &0 <=> t = &1`]); + (MATCH_MP_TAC REAL_DIV_REFL); + + (REWRITE_TAC[REAL_ARITH `!a. &1 - a = &0 <=> a = &1`]); + (STRIP_TAC); + (NEW_GOAL `v = &0 /\ w = &0 /\ z = &0`); + (ASM_REAL_ARITH_TAC); + (UNDISCH_TAC `(a:real^3) + u = u' % a + v % b + w % c + z % d`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO]); + (REWRITE_TAC[VECTOR_ARITH `a + (u:real^3) = a + vec 0 + vec 0 + vec 0 <=> u = vec 0`]); + (ASM_MESON_TAC[]); + + (FIRST_X_ASSUM CHOOSE_TAC); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + (UP_ASM_TAC THEN MATCH_MP_TAC (SET_RULE `A SUBSET B ==> (a IN A ==> a IN B)`)); + (NEW_GOAL `convex hull {a, b , c, d:real^3} = convex hull (convex hull {a, b, c, d})`); + (ONCE_REWRITE_TAC[MESON [] `!a b. a = b <=> b = a`]); + (REWRITE_TAC[CONVEX_HULL_EQ; CONVEX_CONVEX_HULL]); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC CONVEX_HULL_SUBSET); + (MATCH_MP_TAC (SET_RULE `!m a S. m IN S /\ a IN S ==> {a, m} SUBSET S`)); + (STRIP_TAC); + (MATCH_MP_TAC (SET_RULE `m IN convex hull {b, c, d:real^3} /\ + convex hull {b, c, d} SUBSET n ==> m IN n`)); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "s" THEN MATCH_MP_TAC CONVEX_HULL_SUBSET); + (SET_TAC[]); + (REWRITE_TAC[CONVEX_HULL_4;IN;IN_ELIM_THM]); + (EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0`); + (REWRITE_TAC[REAL_ARITH `&0 <= &1 /\ &0 <= &0 /\ &1 + &0 + &0 + &0 = &1`]); + (VECTOR_ARITH_TAC); + + (REWRITE_TAC[ball;IN;IN_ELIM_THM]); + (REWRITE_WITH `dist (a:real^3,a + t % u) = t * norm u`); + (REWRITE_TAC[dist; VECTOR_ARITH `a - (a + b:real^3) = -- b`; NORM_NEG; +NORM_MUL]); + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 24 *) +let U0_NOT_IN_CONVEX_HULL_FROM_ROGERS = prove_by_refinement ( + `!V (ul:(real^3)list). + saturated V /\ packing V /\ barV V 3 ul + ==> ~(HD ul IN + convex hull + {omega_list_n V ul 1, omega_list_n V ul 2, omega_list_n V ul 3})`, +[(REWRITE_TAC[ARITH_RULE `1 = SUC 0 /\ 2 = SUC 1 /\ 3 = SUC 2`; OMEGA_LIST_N]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1 /\ SUC 1 = 2 /\ SUC 2 = 3`]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]`); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (ABBREV_TAC `a = closest_point (voronoi_list V + (truncate_simplex 1 (ul:(real^3)list)))`); + (ABBREV_TAC `b = closest_point (voronoi_list V + (truncate_simplex 2 (ul:(real^3)list)))`); + (ABBREV_TAC `c = closest_point (voronoi_list V + (truncate_simplex 3 (ul:(real^3)list)))`); +(* First estimation *) + + (NEW_GOAL `(a (HD ul)) IN voronoi_list V (truncate_simplex 1 (ul:(real^3)list))`); + (EXPAND_TAC "a"); + (MATCH_MP_TAC CLOSEST_POINT_IN_SET); + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); + (MATCH_MP_TAC Packing3.BARV_IMP_VORONOI_LIST_NOT_EMPTY); + (EXISTS_TAC `1`); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + +(* Second estimation *) + + (NEW_GOAL `((b:real^3->real^3) (a (HD ul))) IN voronoi_list V (truncate_simplex 2 (ul:(real^3)list))`); + (EXPAND_TAC "b"); + + (MATCH_MP_TAC CLOSEST_POINT_IN_SET); + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); + (MATCH_MP_TAC Packing3.BARV_IMP_VORONOI_LIST_NOT_EMPTY); + (EXISTS_TAC `2`); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + +(* Third estimation *) + + (NEW_GOAL `((c:(real^3->real^3))((b:real^3->real^3) (a (HD ul)))) IN voronoi_list V (truncate_simplex 3 (ul:(real^3)list))`); + (EXPAND_TAC "c"); + (MATCH_MP_TAC CLOSEST_POINT_IN_SET); + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); + (MATCH_MP_TAC Packing3.BARV_IMP_VORONOI_LIST_NOT_EMPTY); + (EXISTS_TAC `3`); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (ABBREV_TAC `x:real^3 = (a (HD (ul:(real^3)list)))`); + (ABBREV_TAC `y:real^3 = b (x:real^3)`); + (ABBREV_TAC `z:real^3 = c (y:real^3)`); + + + (NEW_GOAL `(y:real^3) IN voronoi_list V (truncate_simplex 1 ul)`); + (MATCH_MP_TAC (SET_RULE `(?A. a IN A /\ A SUBSET B) ==> a IN B`)); + (EXISTS_TAC `voronoi_list V (truncate_simplex 2 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[VORONOI_LIST;VORONOI_SET]); + (MATCH_MP_TAC (SET_RULE `b SUBSET s ==> (INTERS s) SUBSET (INTERS b)`)); + (REWRITE_TAC[SIMPLE_IMAGE]); + (MATCH_MP_TAC IMAGE_SUBSET); + (ASM_REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1; TRUNCATE_SIMPLEX_EXPLICIT_2]); + (SET_TAC[]); + + (NEW_GOAL `(z:real^3) IN voronoi_list V (truncate_simplex 1 ul)`); + (MATCH_MP_TAC (SET_RULE `(?A. a IN A /\ A SUBSET B) ==> a IN B`)); + (EXISTS_TAC `voronoi_list V (truncate_simplex 3 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[VORONOI_LIST;VORONOI_SET]); + (MATCH_MP_TAC (SET_RULE `b SUBSET s ==> (INTERS s) SUBSET (INTERS b)`)); + (REWRITE_TAC[SIMPLE_IMAGE]); + (MATCH_MP_TAC IMAGE_SUBSET); + (ASM_REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1; TRUNCATE_SIMPLEX_EXPLICIT_3]); + (SET_TAC[]); + + (NEW_GOAL `convex hull {x, y, z:real^3} SUBSET (convex hull voronoi_list V (truncate_simplex 1 ul))`); + (MATCH_MP_TAC CONVEX_HULL_SUBSET); + (ASM_SET_TAC[]); + + (NEW_GOAL `convex hull voronoi_list V (truncate_simplex 1 (ul:(real^3)list)) + = voronoi_list V (truncate_simplex 1 ul)`); + (REWRITE_TAC [CONVEX_HULL_EQ; Packing3.CONVEX_VORONOI_LIST]); + (NEW_GOAL `u0:real^3 IN voronoi_list V (truncate_simplex 1 ul)`); + (REWRITE_WITH `u0:real^3 = HD ul`); + (ASM_MESON_TAC[HD]); + (ASM_SET_TAC[]); + (UP_ASM_TAC); + (ASM_REWRITE_TAC[ TRUNCATE_SIMPLEX_EXPLICIT_1; VORONOI_LIST; VORONOI_SET;set_of_list]); + (REWRITE_WITH `INTERS {voronoi_closed V v | v IN {u0, u1:real^3}} = + voronoi_closed V u0 INTER voronoi_closed V u1`); + (SET_TAC[]); + + + (REWRITE_TAC[IN_INTER; voronoi_closed; IN; IN_ELIM_THM; INTERS; DIST_REFL]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0, u1:real^3) <= dist (u0, u0)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[BARV_IMP_u0_IN_V]); + (NEW_GOAL `u0 = u1:real^3`); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL] THEN DISCH_TAC); + (NEW_GOAL `dist (u0,u1:real^3) = &0`); + (NEW_GOAL `&0 <= dist (u0,u1:real^3) `); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[DIST_EQ_0]); + (NEW_GOAL `aff_dim (set_of_list [u0;u1:real^3]) = &0`); + (ASM_REWRITE_TAC[set_of_list; SET_RULE `{x, x} = {x}`; AFF_DIM_SING]); + (NEW_GOAL `aff_dim (set_of_list [u0;u1:real^3]) = &1`); + (MATCH_MP_TAC MHFTTZN1); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `[u1; u1:real^3] = truncate_simplex 1 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `&0 = &1`); + (ASM_MESON_TAC[INT_OF_NUM_EQ;REAL_OF_NUM_EQ]); + (UP_ASM_TAC THEN REAL_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 25 *) +let RADIAL_VS_RADIAL_NORM = prove_by_refinement ( + `!(x:real^3) r C. radial r x C <=> radial_norm r x C`, +[ (REPEAT GEN_TAC); + (REWRITE_TAC[radial; Vol1.radial_norm]); + (REWRITE_WITH `!(x:real^3) r. ball (x, r) = normball x r`); + (REWRITE_TAC[ball; normball; DIST_SYM])]);; + +(* ======================================================================= *) +(* Lemma 26 *) + +let EVENTUALLY_RADIAL_INTER = prove_by_refinement ( + `!(x:real^3) C C'. + eventually_radial x C /\ eventually_radial x C' ==> + eventually_radial x (C INTER C')`, +[ (REWRITE_TAC[eventually_radial; RADIAL_VS_RADIAL_NORM]); + (REWRITE_WITH `!(x:real^3) r. ball (x, r) = normball x r`); + (REWRITE_TAC[ball; normball; DIST_SYM]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `r >= r'`); + (EXISTS_TAC `r':real`); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `(C INTER C') INTER normball (x:real^3) r' = + (C INTER normball x r') INTER (C' INTER normball x r')`); + (SET_TAC[]); + (MATCH_MP_TAC Vol1.inter_radial); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `radial_norm r (x:real^3) (C INTER normball x r)`); + (REWRITE_TAC[Vol1.radial_norm; normball]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[INTER_SUBSET]); + + (NEW_GOAL `x + u IN C INTER {y | dist (y,x:real^3) < r}`); + (MATCH_MP_TAC (SET_RULE `(?s. a IN s /\ s SUBSET t) ==> a IN t `)); + (EXISTS_TAC `C INTER {y | dist (y,x:real^3) < r'}`); + (ASM_REWRITE_TAC[SUBSET;IN_INTER;IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `(!t. t > &0 /\ t * norm u < r + ==> x + t % u IN C INTER {y | dist (y,x:real^3) < r})`); + (ASM_MESON_TAC[]); + (NEW_GOAL `x + t % u IN C INTER {y | dist (y,x:real^3) < r}`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[IN_INTER;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[dist; VECTOR_ARITH `((a:real^3) + b) - a = b`; NORM_MUL]); + (REWRITE_WITH `abs t = t`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `r:real`); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `(C INTER C') INTER normball (x:real^3) r = + (C INTER normball x r) INTER (C' INTER normball x r)`); + (SET_TAC[]); + (MATCH_MP_TAC Vol1.inter_radial); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `radial_norm r' (x:real^3) (C' INTER normball x r')`); + (REWRITE_TAC[Vol1.radial_norm; normball]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[INTER_SUBSET]); + + (NEW_GOAL `x + u IN C' INTER {y | dist (y,x:real^3) < r'}`); + (MATCH_MP_TAC (SET_RULE `(?s. a IN s /\ s SUBSET t) ==> a IN t `)); + (EXISTS_TAC `C' INTER {y | dist (y,x:real^3) < r}`); + (ASM_REWRITE_TAC[SUBSET;IN_INTER;IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `(!t. t > &0 /\ t * norm u < r' + ==> x + t % u IN C' INTER {y | dist (y,x:real^3) < r'})`); + (ASM_MESON_TAC[]); + (NEW_GOAL `x + t % u IN C' INTER {y | dist (y,x:real^3) < r'}`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[IN_INTER;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[dist; VECTOR_ARITH `((a:real^3) + b) - a = b`; NORM_MUL]); + (REWRITE_WITH `abs t = t`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 27 *) +let SET_EQ_LEMMA = SET_RULE + `A = B <=> (!x. (x IN A ==> x IN B) /\ (x IN B ==> x IN A))`;; + +let SET_OF_0_TO_3 = prove_by_refinement ( + `{j | j < 4} = {0,1,2,3}`, +[(REWRITE_TAC[SET_EQ_LEMMA;IN;IN_ELIM_THM] THEN GEN_TAC); + (ASM_CASES_TAC `x = 0`); (ASM_REWRITE_TAC[]); + (TRUONG_SET_TAC[ARITH_RULE `0 < 4`]); + (ASM_CASES_TAC `x = 1`);(ASM_REWRITE_TAC[]); + (TRUONG_SET_TAC[ARITH_RULE `1 < 4`]); + (ASM_CASES_TAC `x = 2`); (ASM_REWRITE_TAC[]); + (TRUONG_SET_TAC[ARITH_RULE `2 < 4`]); + (ASM_CASES_TAC `x = 3`); (ASM_REWRITE_TAC[]); + (TRUONG_SET_TAC[ARITH_RULE `3 < 4`]); + (NEW_GOAL `x >= 4`); (ASM_ARITH_TAC); (REPEAT STRIP_TAC); + (NEW_GOAL `F`); (ASM_ARITH_TAC); (ASM_MESON_TAC[]); (NEW_GOAL `F`); + (UP_ASM_TAC THEN TRUONG_SET_TAC[]); (ASM_MESON_TAC[])]);; + +let SET_OF_0_TO_2 = prove_by_refinement ( + `{j | j <= 2 } = {0,1,2}`, +[(REWRITE_TAC[SET_EQ_LEMMA;IN;IN_ELIM_THM] THEN GEN_TAC); + (ASM_CASES_TAC `x = 0`); (ASM_REWRITE_TAC[]); + (TRUONG_SET_TAC[ARITH_RULE `0 <= 2`]); + (ASM_CASES_TAC `x = 1`);(ASM_REWRITE_TAC[]); + (TRUONG_SET_TAC[ARITH_RULE `1 <= 2`]); + (ASM_CASES_TAC `x = 2`); (ASM_REWRITE_TAC[]); + (TRUONG_SET_TAC[ARITH_RULE `2 <= 2`]); + (NEW_GOAL `x >= 3`); (ASM_ARITH_TAC); (REPEAT STRIP_TAC); + (NEW_GOAL `F`); (ASM_ARITH_TAC); (ASM_MESON_TAC[]); (NEW_GOAL `F`); + (UP_ASM_TAC THEN TRUONG_SET_TAC[]); (ASM_MESON_TAC[])]);; + +let ZERO_LT_SQRT_2 = prove_by_refinement(`&1 < sqrt (&2)`, +[(NEW_GOAL `&0 < sqrt (&2)`); (MATCH_MP_TAC SQRT_POS_LT THEN REAL_ARITH_TAC); + (NEW_GOAL `&1 = abs (&1) /\ sqrt (&2) = abs (sqrt (&2))`); + ONCE_REWRITE_TAC[EQ_SYM_EQ]; REWRITE_TAC[REAL_ABS_REFL]; ASM_REAL_ARITH_TAC; + ONCE_ASM_REWRITE_TAC[]; + REWRITE_TAC[REAL_LT_SQUARE_ABS; REAL_ARITH `&1 pow 2 = &1`]; + REWRITE_WITH `sqrt (&2) pow 2 = &2`; MATCH_MP_TAC SQRT_POW_2;REAL_ARITH_TAC; + REAL_ARITH_TAC]);; + +(* ======================================================================= *) +(* Lemma 28 *) +let RCONE_GE_TRANS = prove_by_refinement ( + `!(a:real^3) b r x t. + &0 <= t /\ (a + x) IN rcone_ge a b r ==> a + t % x IN rcone_ge a b r`, +[(REWRITE_TAC[rcone_ge; rconesgn; IN; IN_ELIM_THM; dist]); + (REWRITE_TAC[VECTOR_ARITH `((a:real^3) + x) - a = x`; DOT_LMUL; NORM_MUL]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `abs t = t`); + (ASM_REWRITE_TAC[REAL_ABS_REFL]); + (REWRITE_TAC[REAL_ARITH `t * x >= ( t * m) * n <=> &0 <= t * (x - m * n)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC)]);; +(* ======================================================================= *) +(* Lemma 29 *) + +let RCONE_GE_INTERS_PROJECTION_KY_LEMMA = prove_by_refinement ( + `!(a:real^3) b r x:real^3. + &0 < r /\ r < &1 /\ ~(a = b) /\ + x IN (rcone_ge a b r) INTER (rcone_ge b a r) + ==> (?s. s IN convex hull {a, b} /\ (x - s) dot (a - b)= &0 )`, +[(REWRITE_TAC[rcone_ge; rconesgn; IN_INTER;IN; IN_ELIM_THM; dist]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?s. s IN aff {a, b:real^3} /\ (x - s) dot (a - b) = &0`); + (MESON_TAC[Trigonometry2.EXISTS_PROJECTING_POINT2]); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `s:real^3`); + (UP_ASM_TAC THEN + ASM_REWRITE_TAC[Topology.affine_hull_2_fan; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_2; IN_ELIM_THM]); + (EXISTS_TAC `t1:real`); + (EXISTS_TAC `t2:real`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + +(* Case 1 *) + + (ASM_CASES_TAC `t1 < &0`); + (NEW_GOAL `(x - b:real^3) dot (a - b) < &0`); + (REWRITE_WITH `(x - b:real^3) dot (a - b) = + (x - s) dot (a - b) + (s - b) dot (a - b)`); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_ADD_RID; REAL_ADD_LID]); + (REWRITE_WITH `((t1 % a + t2 % b) - b) = t1 % (a - b:real^3)`); + (REWRITE_WITH `((t1 % a + t2 % b) - b:real^3) = (t1 % a + t2 % b) - (t1 + t2) % b`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_LMUL]); + (ONCE_REWRITE_TAC[GSYM REAL_LT_NEG]); + (REWRITE_TAC[REAL_ARITH `-- (a * b) = (-- a) * b`; REAL_NEG_0]); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[GSYM NORM_POW_2]); + (MATCH_MP_TAC REAL_POW_LT); + (REWRITE_TAC[NORM_POS_LT]); + (ASM_REWRITE_TAC[VECTOR_ARITH `(a:real^3 - b = vec 0 <=> a = b)`]); + (NEW_GOAL `norm (x - b) * norm (a - b:real^3) * r < &0`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `&0 <= norm (x - b) * norm (a - b:real^3) * r`); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + +(* Case 2 *) + + (ASM_CASES_TAC `t2 < &0`); + (NEW_GOAL `(x - a:real^3) dot (b - a) < &0`); + (REWRITE_WITH `(x - a:real^3) dot (b - a) = + (a - s) dot (a - b) - (x - s) dot (a - b)`); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_ARITH `a - &0 = a`]); + (REWRITE_WITH `a - (t1 % a + t2 % b) = t2 % (a - b:real^3)`); + (REWRITE_WITH `(a:real^3) - (t1 % a + t2 % b) = (t1 + t2) % a - (t1 % a + t2 % b)`); + + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_LMUL]); + (ONCE_REWRITE_TAC[GSYM REAL_LT_NEG]); + (REWRITE_TAC[REAL_ARITH `-- (a * b) = (-- a) * b`; REAL_NEG_0]); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[GSYM NORM_POW_2]); + (MATCH_MP_TAC REAL_POW_LT); + (REWRITE_TAC[NORM_POS_LT]); + (ASM_REWRITE_TAC[VECTOR_ARITH `(a:real^3 - b = vec 0 <=> a = b)`]); + (NEW_GOAL `norm (x - a) * norm (b - a:real^3) * r < &0`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `&0 <= norm (x - a) * norm (b - a:real^3) * r`); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (ASM_REWRITE_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 30 *) +let RCONE_GE_INTER_VORONOI_CLOSED_PROJECTION_KY_LEMMA = prove_by_refinement( + `!(a:real^3) b r x:real^3 V. + &0 < r /\ ~(a = b) /\ a IN V /\ b IN V /\ + x IN (rcone_ge a b r) INTER (voronoi_closed V a) + ==> (?s. s IN convex hull {a, b} /\ (x - s) dot (a - b)= &0 )`, +[(REWRITE_TAC[voronoi_closed; rcone_ge; rconesgn; IN_INTER;IN; IN_ELIM_THM; dist]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?s. s IN aff {a, b:real^3} /\ (x - s) dot (a - b) = &0`); + (MESON_TAC[Trigonometry2.EXISTS_PROJECTING_POINT2]); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `s:real^3`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN + ASM_REWRITE_TAC[Topology.affine_hull_2_fan; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_2; IN_ELIM_THM]); + (EXISTS_TAC `t1:real`); + (EXISTS_TAC `t2:real`); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[MESON[] `a /\ b <=> b /\ a`]); + (STRIP_TAC); + +(* Case 1 : &0 <= t2 *) + + (ASM_CASES_TAC `t2 < &0`); + (NEW_GOAL `(x - a:real^3) dot (b - a) < &0`); + (REWRITE_WITH `(x - a:real^3) dot (b - a) = + (a - s) dot (a - b) - (x - s) dot (a - b)`); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_ARITH `a - &0 = a`]); + (REWRITE_WITH `a - (t1 % a + t2 % b) = t2 % (a - b:real^3)`); + (REWRITE_WITH `(a:real^3) - (t1 % a + t2 % b) = (t1 + t2) % a - (t1 % a + t2 % b)`); + + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_LMUL]); + (ONCE_REWRITE_TAC[GSYM REAL_LT_NEG]); + (REWRITE_TAC[REAL_ARITH `-- (a * b) = (-- a) * b`; REAL_NEG_0]); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[GSYM NORM_POW_2]); + (MATCH_MP_TAC REAL_POW_LT); + (REWRITE_TAC[NORM_POS_LT]); + (ASM_REWRITE_TAC[VECTOR_ARITH `(a:real^3 - b = vec 0 <=> a = b)`]); + (NEW_GOAL `norm (x - a) * norm (b - a:real^3) * r < &0`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `&0 <= norm (x - a) * norm (b - a:real^3) * r`); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + +(* Case 2 : &0 <= t1 *) + + (ASM_CASES_TAC `t1 < &0`); + (NEW_GOAL `norm (x - a) <= norm (x - b:real^3)`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `norm (x - b) < norm (x - a:real^3)`); + (NEW_GOAL `norm (x - b) < norm (x - a:real^3) <=> + norm (x - b) pow 2 < norm (x - a) pow 2`); + (MATCH_MP_TAC Pack1.bp_bdt); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_REWRITE_TAC[]); + + + (REWRITE_WITH `norm (x - b) pow 2 = norm (s - b) pow 2 + norm (x - s:real^3) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (REWRITE_WITH `b:real^3 - s = t1 % (b - a)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `b:real^3 - (t1 % a + t2 % b) = (t1 + t2) % b - (t1 % a + t2 % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_LMUL]); + (REWRITE_WITH `(b - a:real^3) dot (x - s) = -- ((x - s) dot (a - b))`); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + + + (REWRITE_WITH `norm (x - a) pow 2 = norm (s - a) pow 2 + norm (x - s:real^3) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (REWRITE_WITH `a:real^3 - s = t2 % (a - b)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `a:real^3 - (t1 % a + t2 % b) = (t1 + t2) % a - (t1 % a + t2 % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_LMUL]); + (REWRITE_WITH `(a - b:real^3) dot (x - s) = ((x - s) dot (a - b))`); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + + + (MATCH_MP_TAC (REAL_ARITH `x < y ==> x + z < y + z`)); + (REWRITE_TAC[GSYM REAL_LT_SQUARE_ABS]); + (REWRITE_WITH `abs (norm (s - b:real^3)) = norm (s - b)`); + (REWRITE_TAC[REAL_ABS_REFL; NORM_POS_LE]); + (REWRITE_WITH `abs (norm (s - a:real^3)) = norm (s - a)`); + (REWRITE_TAC[REAL_ABS_REFL; NORM_POS_LE]); + + (REWRITE_WITH `s:real^3 - a = t2 % (b - a)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `(t1 % a + t2 % b) - a:real^3 = (t1 % a + t2 % b) - (t1 + t2) % a`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `s:real^3 - b = t1 % (a - b)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `(t1 % a + t2 % b) - b:real^3 = (t1 % a + t2 % b) - (t1 + t2) % b`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; GSYM dist; DIST_SYM]); + (MATCH_MP_TAC (REAL_ARITH `&0 < x * (a - b) ==> b * x < a * x`)); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `t2 = &1 - t1`); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `abs (t1) = abs (-- t1)`); + (REWRITE_TAC[REAL_ABS_NEG]); + (REWRITE_WITH `abs (&1 - t1) = &1 - t1`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `abs (-- t1) = (-- t1)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 31 *) +let RCONEGE_INTER_VORONOI_CLOSED_IMP_RCONEGE = prove_by_refinement( + `!V a:real^3 b r x. + packing V /\ + saturated V /\ + a IN V /\ + b IN V /\ + ~(a = b) /\ + &0 < r /\ + r <= &1 /\ + x IN rcone_ge a b r /\ + x IN voronoi_closed V a ==> x IN rcone_ge b a r`, + +[(REPEAT STRIP_TAC); + (NEW_GOAL `?s. s IN convex hull {a, b:real^3} /\ (x - s) dot (a - b) = &0`); + (MATCH_MP_TAC RCONE_GE_INTER_VORONOI_CLOSED_PROJECTION_KY_LEMMA); + (EXISTS_TAC `r:real`); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[IN_INTER]); + (FIRST_X_ASSUM CHOOSE_TAC); + (UNDISCH_TAC `x IN rcone_ge (a:real^3) b r`); + (REWRITE_TAC[rcone_ge; rconesgn; IN; IN_ELIM_THM; dist]); + (DISCH_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[CONVEX_HULL_2;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + + + (NEW_GOAL `((x - (b:real^3)) dot (a - b)) * norm (x - a) >= + ((x - a) dot (b - a)) * norm (x - b)`); + (REWRITE_WITH `(x - b) dot (a - b:real^3) = + (x - s) dot (a - b) + (s - b) dot (a - b)`); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `(x - a) dot (b - a:real^3) = + (a - s) dot (a - b) - (x - s) dot (a - b)`); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_ADD_LID; REAL_ARITH `a - &0 = a`]); + (REWRITE_WITH `(u % a + v % b) - b = u % (a - b:real^3)`); + (REWRITE_WITH `(u % a + v % b:real^3) - b = (u % a + v % b) - (u + v) % b`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + + (REWRITE_WITH `a - (u % a + v % b) = v % (a - b:real^3)`); + (REWRITE_WITH `a - (u % a + v % b:real^3) = (u + v) % a - (u % a + v % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_LMUL; GSYM NORM_POW_2; GSYM dist]); + (REWRITE_TAC[REAL_ARITH `(a * x) * y >= (b * x) * z <=> &0 <= x * (a * y - b * z)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_LE_POW_2]); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (NEW_GOAL `v * dist (x,b) <= u * dist (x,a:real^3) <=> + (v * dist (x,b)) pow 2 <= (u * dist (x,a)) pow 2`); + (MATCH_MP_TAC Trigonometry2.POW2_COND); + (ASM_SIMP_TAC[REAL_LE_MUL; DIST_POS_LE]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `(x * y) pow 2 = (x pow 2) * (y pow 2)`; dist]); + + (REWRITE_WITH `norm (x:real^3 - b) pow 2 = norm (s - b) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (REWRITE_WITH `b - s:real^3 = -- u % (a - b)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `b:real^3 - (u % a + v % b) = (u + v) % b - (u % a + v % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (ASM_MESON_TAC[DOT_LMUL; REAL_MUL_RZERO;DOT_SYM]); + (REWRITE_WITH `norm (s - b:real^3) = norm (b - s)`); + (NORM_ARITH_TAC); + (REWRITE_WITH `b - s:real^3 = -- u % (a - b)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `b:real^3 - (u % a + v % b) = (u + v) % b - (u % a + v % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; REAL_ABS_NEG]); + + (REWRITE_WITH `norm (x:real^3 - a) pow 2 = norm (s - a) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (REWRITE_WITH `a - s:real^3 = v % (a - b)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `a:real^3 - (u % a + v % b) = (u + v) % a - (u % a + v % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (ASM_MESON_TAC[DOT_LMUL; REAL_MUL_RZERO;DOT_SYM]); + (REWRITE_WITH `norm (s - a:real^3) = norm (a - s)`); + (NORM_ARITH_TAC); + (REWRITE_WITH `a - s:real^3 = v % (a - b)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `a:real^3 - (u % a + v % b) = (u + v) % a - (u % a + v % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL]); + + (REWRITE_TAC[REAL_POW_MUL; REAL_POW2_ABS]); + (REWRITE_TAC[REAL_ARITH `x * (y * z + t) <= y * (x * z + t) <=> + &0 <= t * (y - x)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_LE_POW_2]); + (REWRITE_TAC[REAL_ARITH `&0 <= x - y <=> y <= x`]); + (NEW_GOAL `v pow 2 <= u pow 2 <=> v <= u`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Trigonometry2.POW2_COND THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `(x:real^3) IN voronoi_closed V a`); + (REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (x,a) <= dist (x,b:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (NEW_GOAL `dist (x,a:real^3) <= dist (x,b) <=> + dist (x,a) pow 2 <= dist (x,b) pow 2`); + (MATCH_MP_TAC Trigonometry2.POW2_COND THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[DIST_POS_LE]); + (NEW_GOAL `dist (x,a) pow 2 <= dist (x,b:real^3) pow 2`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[dist]); + + (REWRITE_WITH `norm (x:real^3 - a) pow 2 = norm (s - a) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (REWRITE_WITH `a - s:real^3 = v % (a - b)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `a:real^3 - (u % a + v % b) = (u + v) % a - (u % a + v % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (ASM_MESON_TAC[DOT_LMUL; REAL_MUL_RZERO;DOT_SYM]); + + (REWRITE_WITH `norm (s - a:real^3) = norm (a - s)`); + (NORM_ARITH_TAC); + (REWRITE_WITH `a - s:real^3 = v % (a - b)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `a:real^3 - (u % a + v % b) = (u + v) % a - (u % a + v % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL]); + (REWRITE_TAC[REAL_POW_MUL; REAL_POW2_ABS]); + + (REWRITE_WITH `norm (x:real^3 - b) pow 2 = norm (s - b) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (REWRITE_WITH `b - s:real^3 = -- u % (a - b)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `b:real^3 - (u % a + v % b) = (u + v) % b - (u % a + v % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (ASM_MESON_TAC[DOT_LMUL; REAL_MUL_RZERO;DOT_SYM]); + (REWRITE_WITH `norm (s - b:real^3) = norm (b - s)`); + (NORM_ARITH_TAC); + (REWRITE_WITH `b - s:real^3 = -- u % (a - b)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `b:real^3 - (u % a + v % b) = (u + v) % b - (u % a + v % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; REAL_ABS_NEG; REAL_POW2_ABS; REAL_POW_MUL]); + + (REWRITE_TAC[REAL_ARITH `a * x + b <= c * x + b <=> &0 <= x * (c - a)`]); + (STRIP_TAC); + (REWRITE_WITH `v <= u <=> v pow 2 <= u pow 2`); + (MATCH_MP_TAC Trigonometry2.POW2_COND); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[REAL_ARITH `a <= b <=> &0 <= b - a`]); + (REWRITE_WITH `&0 <= u pow 2 - v pow 2 <=> + &0 <= norm (a:real^3 - b) pow 2 * (u pow 2 - v pow 2)`); + (NEW_GOAL `(!x y. &0 < x ==> (&0 <= x * y <=> &0 <= y))`); + (MESON_TAC[REAL_LE_MUL_EQ]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (FIRST_X_ASSUM MATCH_MP_TAC); + (MATCH_MP_TAC REAL_POW_LT); + (REWRITE_TAC[NORM_POS_LT]); + (REWRITE_TAC[VECTOR_ARITH `(a - b:real^3) = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + +(* ======================================================================== *) + + (ASM_CASES_TAC `&0 < norm (x:real^3 - b)`); + (ASM_CASES_TAC `&0 < norm (x:real^3 - a)`); + + (REWRITE_TAC[REAL_ARITH `a >= b * c <=> c * b <= a`]); + (REWRITE_WITH `(norm (a - b) * r) * norm (x - b) <= (x - b) dot (a - b) <=> + (norm (a - b) * r) <= ((x - b) dot (a - b)) / norm (x - b:real^3)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC REAL_LE_RDIV_EQ); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC (REAL_ARITH `(?x. a <= x /\ x <= b) ==> a <= b`)); + + (EXISTS_TAC `((x - a) dot (b - a)) / norm (x - a:real^3)`); + (STRIP_TAC); + + (REWRITE_WITH `norm (a - b) * r <= + ((x - a) dot (b - a)) / norm (x - a) <=> + (norm (a - b) * r) * norm (x - a) <= + ((x - a) dot (b - a:real^3))`); + (MATCH_MP_TAC REAL_LE_RDIV_EQ); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH + `(norm (a - b:real^3) * r) * norm (x - a) = norm (x - a) * norm (b - a) * r`); + (REWRITE_WITH `norm (a - b) = norm (b - a:real^3)`); + (NORM_ARITH_TAC); + (REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `((x - a) dot (b - a)) / norm (x - a:real^3) <= + ((x - b) dot (a - b)) / norm (x - b) <=> + ((x - a) dot (b - a)) * norm (x - b) <= + ((x - b) dot (a - b)) * norm (x - a)`); + (MATCH_MP_TAC RAT_LEMMA4); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `x = a:real^3`); + (ONCE_REWRITE_TAC[VECTOR_ARITH `a = b <=> a - b:real^3 = vec 0`]); + (REWRITE_TAC [GSYM NORM_EQ_0]); + (NEW_GOAL `&0 <= norm (x - a:real^3)`); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[GSYM NORM_POW_2]); + (ONCE_REWRITE_TAC[REAL_ARITH `a * a * b = (a pow 2) * b`]); + (REWRITE_TAC[REAL_ARITH `a >= a * b <=> &0 <= (&1 - b) * a`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_LE_POW_2]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `F`); + (NEW_GOAL `x = b:real^3`); + (ONCE_REWRITE_TAC[VECTOR_ARITH `a = b <=> a - b:real^3 = vec 0`]); + (REWRITE_TAC [GSYM NORM_EQ_0]); + (NEW_GOAL `&0 <= norm (x - b:real^3)`); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + + (UNDISCH_TAC `x IN voronoi_closed V (a:real^3)`); + (REWRITE_TAC[voronoi_closed;IN;IN_ELIM_THM]); + (STRIP_TAC); + (NEW_GOAL `dist (x,a) <= dist (x,b:real^3)`); + (FIRST_X_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[DIST_REFL]); + (STRIP_TAC); + (NEW_GOAL `a = b:real^3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[GSYM DIST_EQ_0]); + (NEW_GOAL `&0 <= dist (b, a:real^3)`); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 32 *) +let OMEGA_LIST_1_EXPLICIT_NEW = prove_by_refinement ( + `!a:real^3 b c d V ul. + saturated V /\ + packing V /\ + ul IN barV V 3 /\ + ul = [a; b; c; d] /\ + hl [a;b] < sqrt (&2) + ==> omega_list_n V ul 1 = circumcenter {a, b}`, +[ (REPEAT STRIP_TAC); + (REWRITE_WITH `{a,b} = set_of_list [a;(b:real^3)]`); + (MESON_TAC[set_of_list]); + (REWRITE_WITH `circumcenter (set_of_list [a; b:real^3]) = omega_list V [a:real^3; b]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC XNHPWAB1); + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + (MP_TAC (ASSUME `ul IN barV V 3`) THEN REWRITE_TAC[IN;BARV]); + + (REPEAT STRIP_TAC); + (REWRITE_TAC[LENGTH;ARITH_RULE `SUC (SUC 0) = 1 + 1`]); + (NEW_GOAL `initial_sublist vl (ul:(real^3)list)`); + (UNDISCH_TAC `initial_sublist vl [a:real^3; b]`); + (REWRITE_TAC[INITIAL_SUBLIST] THEN STRIP_TAC); + (EXISTS_TAC `APPEND yl [c;d:real^3]`); + (REWRITE_TAC[APPEND_ASSOC; GSYM (ASSUME `[a:real^3; b] = APPEND vl yl`)]); + (ASM_REWRITE_TAC[APPEND]); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[OMEGA_LIST_TRUNCATE_1])]);; + +(* ======================================================================= *) +(* Lemma 33 *) +let IN_SET_IMP_IN_CONVEX_HULL_SET = prove_by_refinement ( + `!a S:real^3->bool. a IN S ==> a IN convex hull S`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[SET_RULE `a IN s <=> {a} SUBSET s`]); + (NEW_GOAL `{a} = convex hull ({a:real^3})`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (SIMP_TAC[CONVEX_HULL_EQ;CONVEX_SING]); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC CONVEX_HULL_SUBSET); + (ASM_SET_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 34 *) +let CONVEX_HULL_BREAK_KY_LEMMA = prove_by_refinement ( + `!a:real^3 b c d x. between x (a,b) ==> +(convex hull {a,b,c,d} = convex hull {a,x, c,d} UNION convex hull {x,b,c,d})`, + +[(REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2;IN; IN_ELIM_THM]); + (REWRITE_TAC[SET_EQ_LEMMA]); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[CONVEX_HULL_4; IN_UNION;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `u = &0`); + (DISJ1_TAC); + (EXISTS_TAC `u':real`); + (EXISTS_TAC `v':real`); + (EXISTS_TAC `w:real`); + (EXISTS_TAC `z:real`); + (ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID]); + (REWRITE_WITH `v = &1`); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (NEW_GOAL `&0 < u `); + (ASM_REAL_ARITH_TAC); + (SWITCH_TAC THEN DEL_TAC); + (ASM_CASES_TAC `v = &0`); + (DISJ2_TAC); + (EXISTS_TAC `u':real`); + (EXISTS_TAC `v':real`); + (EXISTS_TAC `w:real`); + (EXISTS_TAC `z:real`); + (ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID]); + (REWRITE_WITH `u = &1`); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (NEW_GOAL `&0 < v `); + (ASM_REAL_ARITH_TAC); + (SWITCH_TAC THEN DEL_TAC); + + + (ASM_CASES_TAC `&0 < u' + v'`); + (ASM_CASES_TAC `u' / (u' + v') <= u`); + +(*CASE 1*) + (DISJ2_TAC); + (EXISTS_TAC `u' / u`); + (EXISTS_TAC `v' - v * (u'/ u)`); + (EXISTS_TAC `w:real`); + (EXISTS_TAC `z:real`); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[REAL_LE_DIV]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `v' - v * u' / u = (v' * u - v * u' )/ u`); + (REWRITE_TAC[REAL_ARITH `(a - b * d) / c = a / c - b * d / c`]); + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_WITH `v' = (v' * u) / u <=> v' * u = (v' * u)`); + (MATCH_MP_TAC REAL_EQ_RDIV_EQ); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `v * u' = u' - u * u'`); + (REWRITE_TAC[REAL_ARITH `a * b = b - c * b <=> ((c + a) - &1) * b = &0`]); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `v' * u - (u' - u * u') = u * (u' + v') - u'`]); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (NEW_GOAL `u' <= u * (u' + v') <=> u' / (u' + v') <= u`); + (ASM_MESON_TAC[REAL_LE_LDIV_EQ]); + (ONCE_ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_TAC[REAL_ARITH `a + b - e + c + d = (a + b - e) + c + d`]); + (REWRITE_WITH `u' / u + v' - v * u' / u = u' + v'`); + (ONCE_REWRITE_TAC[REAL_ARITH `a/x + b - m*e/x = c + b <=> (a - m*e)/x = c`]); + (NEW_GOAL `(u' - v * u') / u = u' <=> (u' - v * u') = u' * u`); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (ASM_REWRITE_TAC[]); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_WITH `u' - v * u' = u' * (u + v) - v * u'`); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_ADD_LDISTRIB;VECTOR_MUL_ASSOC]); + (REWRITE_TAC[VECTOR_ARITH `a + b + c + d = (x + m % y) + n % y + c + d <=> + (a - x) + (b - (m + n) % y) = vec 0 `]); + + (MATCH_MP_TAC (VECTOR_ARITH `a = vec 0 /\ b = vec 0 ==> a + b = vec 0`)); + (STRIP_TAC); + (REWRITE_TAC[VECTOR_ARITH + `(x % a - y % a = vec 0) <=> (x - y) % a = vec 0`; VECTOR_MUL_EQ_0]); + (DISJ1_TAC); + (REWRITE_TAC[REAL_ARITH `x - y / z * t = &0 <=> (y * t) / z = x`]); + (NEW_GOAL `(u' * u) / u = u' <=> (u' * u) = u' * u`); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (ASM_REWRITE_TAC[]); + (ONCE_ASM_REWRITE_TAC[]); + (REFL_TAC); + + (REWRITE_TAC[VECTOR_ARITH + `(x % a - y % a = vec 0) <=> (x - y) % a = vec 0`; VECTOR_MUL_EQ_0]); + (DISJ1_TAC); + (REAL_ARITH_TAC); + +(*CASE 2*) + + + (NEW_GOAL `v' / (u' + v') <= v`); + (REWRITE_WITH `v' / (u' + v') = &1 - u' /(u' + v')`); + (REWRITE_TAC[REAL_ARITH `a / x = &1 - b / x <=> (b + a) / x = &1`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (DISJ1_TAC); + (EXISTS_TAC `u' - u * (v'/ v)`); + (EXISTS_TAC `v' / v`); + (EXISTS_TAC `w:real`); + (EXISTS_TAC `z:real`); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[REAL_LE_DIV]); + (REPEAT STRIP_TAC); + + (REWRITE_WITH `u' - u * v' / v = (u' * v - u * v' )/ v`); + (REWRITE_TAC[REAL_ARITH `(a - b * d) / c = a / c - b * d / c`]); + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_WITH `u' = (u' * v) / v <=> u' * v = (u' * v)`); + (MATCH_MP_TAC REAL_EQ_RDIV_EQ); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `u * v' = v' - v * v'`); + (REWRITE_TAC[REAL_ARITH `a * b = b - c * b <=> ((c + a) - &1) * b = &0`]); + (ASM_REWRITE_TAC[REAL_ARITH `v + u = u + v`]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `v' * u - (u' - u * u') = u * (u' + v') - u'`]); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + + (NEW_GOAL `v' <= v * (v' + u') <=> v' / (v' + u') <= v`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC REAL_LE_LDIV_EQ); + (ASM_REAL_ARITH_TAC); + (ONCE_ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[REAL_ADD_SYM]); + + (REWRITE_TAC[REAL_ARITH `a - e + b + c + d = (a + b - e) + c + d`]); + (REWRITE_WITH `u' + v' / v - u * v' / v = u' + v'`); + + (ONCE_REWRITE_TAC[REAL_ARITH `b + a/x - m*e/x = b + c <=> (a - m*e)/x = c`]); + (NEW_GOAL `(v' - u * v') / v = v' <=> (v' - u * v') = v' * v`); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (ASM_REWRITE_TAC[]); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_WITH `v' - u * v' = v' * (u + v) - u * v'`); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_ADD_LDISTRIB;VECTOR_MUL_ASSOC]); + (REWRITE_TAC[VECTOR_ARITH `a + b + c + d = (m % y) + (n % y + z) + c + d <=> (b - z) + (a - (m + n) % y) = vec 0 `]); + + (MATCH_MP_TAC (VECTOR_ARITH `a = vec 0 /\ b = vec 0 ==> b + a = vec 0`)); + (STRIP_TAC); + + (REWRITE_TAC[VECTOR_ARITH + `(x % a - y % a = vec 0) <=> (x - y) % a = vec 0`; VECTOR_MUL_EQ_0]); + (DISJ1_TAC); + (REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH + `(x % a - y % a = vec 0) <=> (x - y) % a = vec 0`; VECTOR_MUL_EQ_0]); + (DISJ1_TAC); + + (REWRITE_TAC[REAL_ARITH `x - y / z * t = &0 <=> (y * t) / z = x`]); + (NEW_GOAL `(v' * v) / v = v' <=> (v' * v) = v' * v`); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (ASM_REWRITE_TAC[]); + (ONCE_ASM_REWRITE_TAC[]); + (REFL_TAC); + +(* CASE 3 *) + + (NEW_GOAL `u' + v' = &0`); + (ASM_REAL_ARITH_TAC); + (DISJ1_TAC); + (EXISTS_TAC `&0` THEN EXISTS_TAC `&0`); + (EXISTS_TAC `w:real` THEN EXISTS_TAC `z:real`); + (NEW_GOAL `u'= &0 /\ v' = &0`); + (ASM_REAL_ARITH_TAC); + (UNDISCH_TAC `x' = u' % a + v' % b + w % c + z % (d:real^3)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LZERO; REAL_ARITH `&0 <= &0`]); + (REPEAT STRIP_TAC); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + +(* ================================ *) + + (UP_ASM_TAC THEN REWRITE_TAC[IN_UNION]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `convex hull {a, x, c, d} SUBSET convex hull {a, b, c, d:real^3}`); + (NEW_GOAL `convex hull {a, b, c, d:real^3} = + convex hull (convex hull {a, b, c, d:real^3})`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[CONVEX_HULL_EQ; CONVEX_CONVEX_HULL]); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC CONVEX_HULL_SUBSET); + (ONCE_REWRITE_TAC[SUBSET; IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `x'' = a:real^3`); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (ASM_SET_TAC[]); + (ASM_CASES_TAC `x'' = d:real^3`); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (ASM_SET_TAC[]); + (ASM_CASES_TAC `x'' = c:real^3`); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (ASM_SET_TAC[]); + (NEW_GOAL `x'' = u % a + v % (b:real^3)`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `(?s. p IN s /\ s SUBSET r) ==> p IN r`)); + (EXISTS_TAC `convex hull {a, b:real^3}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM]); + (EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC CONVEX_HULL_SUBSET); + (SET_TAC[]); + (ASM_SET_TAC[]); + +(* == *) + + (NEW_GOAL `convex hull {x, b, c, d} SUBSET convex hull {a, b, c, d:real^3}`); + (NEW_GOAL `convex hull {a, b, c, d:real^3} = + convex hull (convex hull {a, b, c, d:real^3})`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[CONVEX_HULL_EQ; CONVEX_CONVEX_HULL]); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC CONVEX_HULL_SUBSET); + (ONCE_REWRITE_TAC[SUBSET; IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `x'' = b:real^3`); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (ASM_SET_TAC[]); + (ASM_CASES_TAC `x'' = d:real^3`); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (ASM_SET_TAC[]); + (ASM_CASES_TAC `x'' = c:real^3`); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (ASM_SET_TAC[]); + (NEW_GOAL `x'' = u % a + v % (b:real^3)`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `(?s. p IN s /\ s SUBSET r) ==> p IN r`)); + (EXISTS_TAC `convex hull {a, b:real^3}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM]); + (EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC CONVEX_HULL_SUBSET); + (SET_TAC[]); + (ASM_SET_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 35 *) +let AFF_GE_BREAK_KY_LEMMA = prove_by_refinement ( + `!a b c d (x:real^3). + between x (c, d) /\ + DISJOINT {a, b} {c, d} /\ + DISJOINT {a, b} {c, x} /\ + DISJOINT {a, b} {x, d} ==> + aff_ge {a, b} {c, d} = aff_ge {a, b} {c, x} UNION aff_ge {a, b} {x, d}`, +[(REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (ASM_SIMP_TAC[AFF_GE_2_2]); + (REWRITE_TAC[SET_EQ_LEMMA; IN_UNION; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (* Break to 3 subgoal *) + + (ASM_CASES_TAC `u = &0`); + (REWRITE_WITH `v = &1`); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID; VECTOR_MUL_LID]); + (DISJ1_TAC); + + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real`); + (EXISTS_TAC `t3:real` THEN EXISTS_TAC `t4:real`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `&0 = t4`); + (DISJ1_TAC); + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real`); + (EXISTS_TAC `t3 - u * t4 / v` THEN EXISTS_TAC `t4 / v`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b * c / d <=> (b * c) / d <= a `]); + (REWRITE_WITH `(u * t4) / v <= t3 <=> (u * t4) <= t3 * v`); + (MATCH_MP_TAC REAL_LE_LDIV_EQ); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `u * t4 <= t3 * v <=> v * (t3 + t4) >= t4`); + (REWRITE_WITH `v * (t3 + t4) >= t4 <=> v * (t3 + t4) >= t4 * (u + v)`); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `t1 + t2 + t3 - u * t4 / v + t4 / v = t1 + t2 + t3 + t4`); + (REPEAT AP_TERM_TAC); + (REWRITE_TAC[REAL_ARITH + `t3 - u * t4 / v + t4 / v = t3 + t4 <=> (t4 - t4 * u) / v = t4`]); + + (REWRITE_WITH `(t4 - t4 * u) / v = t4 <=> (t4 - t4 * u) = t4 * v`); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `(t4 - t4 * u) = t4 * (u + v) - t4 * u`); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `t1 % a + t2 % b + (t3 - u * t4 / v) % c + t4 / v % (u % c + v % d) = + t1 % a + t2 % b + t3 % c + t4 % (d:real^3)`); + (REPEAT AP_TERM_TAC); + + (REWRITE_TAC[VECTOR_SUB_RDISTRIB; VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC]); + (REWRITE_TAC[VECTOR_ARITH + `(x % c - y % c + t % c + z % d = x % c + n % d) <=> + (t - y) % c + (z - n) %d = vec 0`]); + (REWRITE_WITH `t4 / v * u - u * t4 / v = &0`); + (REAL_ARITH_TAC); + (REWRITE_WITH `t4 / v * v - t4 = &0`); + (REWRITE_TAC[REAL_ARITH `a / b * c - d = &0 <=> (a * c) / b = d`]); + (REWRITE_WITH `(t4 * v) / v = t4 <=> (t4 * v) = t4 * v`); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `(u * (t3 + t4) >= t3)`); + (DISJ2_TAC); + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real`); + (EXISTS_TAC `t3 / u` THEN EXISTS_TAC `t4 - v * t3 / u`); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= a - b * c / d <=> (b * c) / d <= a `]); + (REWRITE_WITH `(v * t3) / u <= t4 <=> (v * t3) <= t4 * u`); + (MATCH_MP_TAC REAL_LE_LDIV_EQ); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `v * t3 <= t4 * u <=> u * (t3 + t4) >= t3`); + (REWRITE_WITH `u * (t3 + t4) >= t3 <=> u * (t3 + t4) >= t3 * (u + v)`); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `t1 + t2 + t3 / u + t4 - v * t3 / u = t1 + t2 + t3 + t4`); + (REPEAT AP_TERM_TAC); + (REWRITE_TAC[REAL_ARITH + `t3 / u + t4 - v * t3 / u = t3 + t4 <=> (t3 - t3 * v) / u = t3`]); + + (REWRITE_WITH `(t3 - t3 * v) / u = t3 <=> (t3 - t3 * v) = t3 * u`); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `(t3 - t3 * v) = t3 * (u + v) - t3 * v`); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `t1 % a + t2 % b + t3 / u % (u % c + v % d) + (t4 - v * t3 / u) % d = + t1 % a + t2 % b + t3 % c + t4 % (d:real^3)`); + (REPEAT AP_TERM_TAC); + + (REWRITE_TAC[VECTOR_SUB_RDISTRIB; VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC]); + (REWRITE_TAC[VECTOR_ARITH + `(x % c + y % d) + a - z % d = t % c + a <=> + (x - t) % c + (y - z) %d = vec 0`]); + (REWRITE_WITH `t3 / u * v - v * t3 / u = &0`); + (REAL_ARITH_TAC); + (REWRITE_WITH `t3 / u * u - t3 = &0`); + (REWRITE_TAC[REAL_ARITH `a / b * c - d = &0 <=> (a * c) / b = d`]); + (REWRITE_WITH `(t3 * u) / u = t3 <=> (t3 * u) = t3 * u`); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (NEW_GOAL `v * (t3 + t4) < t4 /\ u * (t3 + t4) < t3`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `(u + v) * (t3 + t4) < (t3 + t4)`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[REAL_MUL_LID]); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (NEW_GOAL `t3 = &0 /\ t4 = &0`); + (ASM_REAL_ARITH_TAC); + (DISJ1_TAC); + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real`); + (EXISTS_TAC `t3:real` THEN EXISTS_TAC `t4:real`); + (ASM_REWRITE_TAC[VECTOR_MUL_LZERO]); +(* finish the first subgoal *) + + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real`); + (EXISTS_TAC `t3 + t4 * u` THEN EXISTS_TAC `t4 * v`); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_ADD); + (ASM_SIMP_TAC[REAL_LE_MUL]); + (ASM_SIMP_TAC[REAL_LE_MUL]); + (REWRITE_WITH `t1 + t2 + (t3 + t4 * u) + t4 * v = + t1 + t2 + t3 + t4 * (u + v)`); + (REAL_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (REWRITE_WITH `t1 % a + t2 % b + (t3 + t4 * u) % c + (t4 * v) % d = + t1 % a + t2 % b + t3 % c + t4 % (u % c + v % (d:real^3))`); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real`); + (EXISTS_TAC `t3 * u` THEN EXISTS_TAC `t4 + t3 * v`); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[REAL_LE_MUL]); + (MATCH_MP_TAC REAL_LE_ADD); + (ASM_SIMP_TAC[REAL_LE_MUL]); + (REWRITE_WITH `t1 + t2 + t3 * u + t4 + t3 * v = + t1 + t2 + t3 * (u + v) + t4`); + (REAL_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (REWRITE_WITH `t1 % a + t2 % b + (t3 * u) % c + (t4 + t3 * v) % d = + t1 % a + t2 % b + t3 % (u % c + v % d) + t4 % (d:real^3)`); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 36 *) +let CONVEX_HULL_4_SUBSET_AFF_GE_2_2 = prove_by_refinement ( + `!a b c d:real^3. + convex hull ({a, b, c, d}) SUBSET aff_ge {a, b} {c, d}`, +[(REPEAT STRIP_TAC); + (ASM_CASES_TAC `DISJOINT {a, b} {c, d:real^3}`); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM; CONVEX_HULL_4]); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[AFF_GE_2_2]); + (REWRITE_TAC[IN_ELIM_THM]); + (EXISTS_TAC `u:real`); + (EXISTS_TAC `v:real`); + (EXISTS_TAC `w:real`); + (EXISTS_TAC `z:real`); + (ASM_REWRITE_TAC[]); + +(* asm cases 1 *) + (ASM_CASES_TAC `c = a:real^3`); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[AFF_GE_DISJOINT_DIFF]); + (ASM_CASES_TAC `b = a:real^3 \/ b = d`); + (REWRITE_WITH `{a, b:real^3} DIFF {a, d:real^3} = {}`); + (ASM_SET_TAC[]); + (ONCE_REWRITE_TAC[CONVEX_HULL_AFF_GE]); + (REWRITE_WITH `{a, b, a , d:real^3} = {a, d}`); + (TRUONG_SET_TAC[]); + (TRUONG_SET_TAC[]); + (REWRITE_WITH `{a, b:real^3} DIFF {a, d:real^3} = {b}`); + (TRUONG_SET_TAC[]); + (NEW_GOAL `DISJOINT {b:real^3} {a, d}`); + (TRUONG_SET_TAC[]); + (ASM_SIMP_TAC[Fan.AFF_GE_1_2]); + (REWRITE_WITH `{a, b, a , d:real^3} = {a, b, d}`); + (TRUONG_SET_TAC[]); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM; CONVEX_HULL_3]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `v:real` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `w:real`); + (ASM_REWRITE_TAC[REAL_ARITH `a + b + c = b + a + c`]); + (VECTOR_ARITH_TAC); + +(* asm cases 2 *) + (ASM_CASES_TAC `c = b:real^3`); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[AFF_GE_DISJOINT_DIFF]); + (ASM_CASES_TAC `a = b:real^3 \/ a = d`); + (REWRITE_WITH `{a, b:real^3} DIFF {b, d:real^3} = {}`); + (ASM_SET_TAC[]); + (ONCE_REWRITE_TAC[CONVEX_HULL_AFF_GE]); + (REWRITE_WITH `{a, b, b , d:real^3} = {b, d}`); + (TRUONG_SET_TAC[]); + (TRUONG_SET_TAC[]); + (REWRITE_WITH `{a, b:real^3} DIFF {b, d:real^3} = {a}`); + (TRUONG_SET_TAC[]); + (NEW_GOAL `DISJOINT {a:real^3} {b, d}`); + (TRUONG_SET_TAC[]); + (ASM_SIMP_TAC[Fan.AFF_GE_1_2]); + (REWRITE_WITH `{a, b, b , d:real^3} = {a, b, d}`); + (TRUONG_SET_TAC[]); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM; CONVEX_HULL_3]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real` THEN EXISTS_TAC `w:real`); + (ASM_REWRITE_TAC[]); + +(* asm case 3 *) + (ASM_CASES_TAC `d = a:real^3`); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[AFF_GE_DISJOINT_DIFF]); + (ASM_CASES_TAC `b = a:real^3 \/ b = c`); + (REWRITE_WITH `{a, b:real^3} DIFF {c, a:real^3} = {}`); + (ASM_SET_TAC[]); + (ONCE_REWRITE_TAC[CONVEX_HULL_AFF_GE]); + (REWRITE_WITH `{a, b, c , a:real^3} = {a, c}`); + (TRUONG_SET_TAC[]); + (REWRITE_TAC[SET_RULE `{x, y} = {y, x}`]); + (TRUONG_SET_TAC[]); + + (REWRITE_WITH `{a, b:real^3} DIFF {c, a:real^3} = {b}`); + (TRUONG_SET_TAC[]); + (NEW_GOAL `DISJOINT {b:real^3} {c, a}`); + (TRUONG_SET_TAC[]); + (ASM_SIMP_TAC[Fan.AFF_GE_1_2]); + (REWRITE_WITH `{a, b, c, a:real^3} = {a, b, c}`); + (TRUONG_SET_TAC[]); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM; CONVEX_HULL_3]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `v:real` THEN EXISTS_TAC `w:real` THEN EXISTS_TAC `u:real`); + (ASM_REWRITE_TAC[REAL_ARITH `v + w + u = u + v + w`]); + (VECTOR_ARITH_TAC); + +(* last case *) + (NEW_GOAL `d = b:real^3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[AFF_GE_DISJOINT_DIFF]); + (ASM_CASES_TAC `a = b:real^3 \/ a = c`); + (REWRITE_WITH `{a, b:real^3} DIFF {c, b:real^3} = {}`); + (ASM_SET_TAC[]); + (ONCE_REWRITE_TAC[CONVEX_HULL_AFF_GE]); + (REWRITE_WITH `{a, b, c , b:real^3} = {c, b}`); + (TRUONG_SET_TAC[]); + (TRUONG_SET_TAC[]); + (REWRITE_WITH `{a, b:real^3} DIFF {c, b:real^3} = {a}`); + (TRUONG_SET_TAC[]); + (NEW_GOAL `DISJOINT {a:real^3} {c, b}`); + (TRUONG_SET_TAC[]); + (ASM_SIMP_TAC[Fan.AFF_GE_1_2]); + (REWRITE_WITH `{a, b, c , b:real^3} = {a, b, c}`); + (TRUONG_SET_TAC[]); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM; CONVEX_HULL_3]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u:real` THEN EXISTS_TAC `w:real` THEN EXISTS_TAC `v:real`); + (ASM_REWRITE_TAC[REAL_ARITH `a + b + c = a + c + b`]); + (VECTOR_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 37 *) +let AFF_INDEPENDENT_SET_OF_LIST_BARV = prove_by_refinement ( + `!V ul:(real^3)list.packing V /\ saturated V /\ barV V 3 ul + ==> ~ affine_dependent (set_of_list ul)`, +[(REPEAT STRIP_TAC); + (SUBGOAL_THEN `? u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]` CHOOSE_TAC); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `barV V 3 (ul:(real^3)list)`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `~affine_dependent {u0,u1,u2,u3:real^3}`); + (REWRITE_TAC[AFFINE_INDEPENDENT_IFF_CARD]); + (STRIP_TAC); + (REWRITE_TAC[Geomdetail.FINITE6]); + (NEW_GOAL `aff_dim {u0, u1, u2, u3:real^3} = &3`); + (REWRITE_WITH `{u0, u1, u2, u3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.MHFTTZN1); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[ARITH_RULE + `&3 = &(CARD {u0, u1, u2, u3:real^3}) - (&1):int + <=> &(CARD {u0, u1, u2, u3:real^3}) = (&4):int`]); + (ONCE_REWRITE_TAC[INT_OF_NUM_EQ]); + (REWRITE_TAC[Geomdetail.CARD4]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u1, u2, u3:real^3}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (NEW_GOAL `aff_dim {u0, u1, u2, u3} <= &(CARD {u0, u1, u2, u3:real^3}) - (&1):int`); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_TAC[Geomdetail.FINITE6]); + (NEW_GOAL `(&4):int <= &(CARD {u0, u1, u2, u3:real^3})`); + (ONCE_REWRITE_TAC[ARITH_RULE + `(&4):int <= &(CARD {u0, u1, u2, u3:real^3}) <=> + &3 <= &(CARD {u0, u1, u2, u3:real^3}) - (&1):int`]); + (ASM_MESON_TAC[]); + (NEW_GOAL `&(CARD {u0, u1, u2, u3:real^3}) <= (&4):int`); + (ONCE_REWRITE_TAC[INT_OF_NUM_LE]); + (REWRITE_TAC[Geomdetail.CARD4]); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} = 4`); + (ONCE_REWRITE_TAC[GSYM INT_OF_NUM_EQ]); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u2, u3:real^3}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (NEW_GOAL `aff_dim {u0, u1, u2, u3} <= &(CARD {u0, u1, u2, u3:real^3}) - (&1):int`); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_TAC[Geomdetail.FINITE6]); + (NEW_GOAL `(&4):int <= &(CARD {u0, u1, u2, u3:real^3})`); + (ONCE_REWRITE_TAC[ARITH_RULE + `(&4):int <= &(CARD {u0, u1, u2, u3:real^3}) <=> + &3 <= &(CARD {u0, u1, u2, u3:real^3}) - (&1):int`]); + (ASM_MESON_TAC[]); + (NEW_GOAL `&(CARD {u0, u1, u2, u3:real^3}) <= (&4):int`); + (ONCE_REWRITE_TAC[INT_OF_NUM_LE]); + (REWRITE_TAC[Geomdetail.CARD4]); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} = 4`); + (ONCE_REWRITE_TAC[GSYM INT_OF_NUM_EQ]); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u1, u0, u3:real^3}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (NEW_GOAL `aff_dim {u0, u1, u2, u3} <= &(CARD {u0, u1, u2, u3:real^3}) - (&1):int`); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_TAC[Geomdetail.FINITE6]); + (NEW_GOAL `(&4):int <= &(CARD {u0, u1, u2, u3:real^3})`); + (ONCE_REWRITE_TAC[ARITH_RULE + `(&4):int <= &(CARD {u0, u1, u2, u3:real^3}) <=> + &3 <= &(CARD {u0, u1, u2, u3:real^3}) - (&1):int`]); + (ASM_MESON_TAC[]); + (NEW_GOAL `&(CARD {u0, u1, u2, u3:real^3}) <= (&4):int`); + (ONCE_REWRITE_TAC[INT_OF_NUM_LE]); + (REWRITE_TAC[Geomdetail.CARD4]); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} = 4`); + (ONCE_REWRITE_TAC[GSYM INT_OF_NUM_EQ]); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u2, u3:real^3}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (NEW_GOAL `aff_dim {u0, u1, u2, u3} <= &(CARD {u0, u1, u2, u3:real^3}) - (&1):int`); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_TAC[Geomdetail.FINITE6]); + (NEW_GOAL `(&4):int <= &(CARD {u0, u1, u2, u3:real^3})`); + (ONCE_REWRITE_TAC[ARITH_RULE + `(&4):int <= &(CARD {u0, u1, u2, u3:real^3}) <=> + &3 <= &(CARD {u0, u1, u2, u3:real^3}) - (&1):int`]); + (ASM_MESON_TAC[]); + (NEW_GOAL `&(CARD {u0, u1, u2, u3:real^3}) <= (&4):int`); + (ONCE_REWRITE_TAC[INT_OF_NUM_LE]); + (REWRITE_TAC[Geomdetail.CARD4]); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} = 4`); + (ONCE_REWRITE_TAC[GSYM INT_OF_NUM_EQ]); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[set_of_list])]);; + +(* ======================================================================= *) +(* Lemma 38 *) +let VORONOI_LIST_3_SINGLETON_EXPLICIT = prove_by_refinement ( + `!V ul. + packing V /\ saturated V /\ barV V 3 ul + ==> (?a. voronoi_list V ul = {a} /\ + a = circumcenter (set_of_list ul) /\ + hl ul = dist (HD ul, a))`, +[(REPEAT STRIP_TAC); + (SUBGOAL_THEN `? u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]` CHOOSE_TAC); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `~affine_dependent {u0,u1,u2,u3:real^3}`); + (ASM_MESON_TAC[set_of_list; AFF_INDEPENDENT_SET_OF_LIST_BARV]); + + (NEW_GOAL `barV V 3 ul`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[BARV; VORONOI_NONDG]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `initial_sublist ul (ul:(real^3)list) /\ 0 < LENGTH ul`); + (ASM_REWRITE_TAC[INITIAL_SUBLIST; LENGTH; + ARITH_RULE `0 < 3 + 1 /\ 0 < SUC (SUC (SUC (SUC 0)))`]); + (EXISTS_TAC `[]:(real^3)list`); + (REWRITE_TAC[APPEND]); + (NEW_GOAL `aff_dim (voronoi_list V (ul:(real^3)list)) + &(LENGTH ul) = &4`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[LENGTH; ARITH_RULE `3 + 1 = 4`]); + (DISCH_TAC); + (NEW_GOAL `aff_dim (voronoi_list V [u0; u1; u2; u3:real^3]) = &0`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[AFF_DIM_EQ_0]); + (REPEAT STRIP_TAC); + + (EXISTS_TAC `a:real^3`); + + (NEW_GOAL `a = circumcenter (set_of_list [u0; u1; u2; u3:real^3])`); + (REWRITE_TAC[set_of_list]); + (NEW_GOAL `!p. p IN affine hull {u0, u1, u2, u3:real^3} /\ + (?c. !w. w IN {u0, u1, u2, u3} ==> dist (p,w) = c) + ==> p = circumcenter {u0, u1, u2, u3}`); + (MATCH_MP_TAC Rogers.OAPVION3); + (ASM_REWRITE_TAC[]); + + (FIRST_X_ASSUM MATCH_MP_TAC); + (NEW_GOAL `a IN voronoi_list V [u0; u1; u2; u3:real^3]`); + (UP_ASM_TAC THEN TRUONG_SET_TAC[]); + (NEW_GOAL `affine hull {u0, u1, u2, u3:real^3} = (:real^3)`); + (ONCE_ASM_REWRITE_TAC[GSYM AFF_DIM_EQ_FULL]); + (REWRITE_TAC[DIMINDEX_3]); + (REWRITE_WITH `{u0, u1, u2, u3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.MHFTTZN1); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[IN_UNIV]); + (EXISTS_TAC `dist (a,u0:real^3)`); + (UNDISCH_TAC `a IN voronoi_list V [u0; u1; u2; u3:real^3]`); + (REWRITE_TAC[VORONOI_LIST;VORONOI_SET; set_of_list; + IN_INTERS; voronoi_closed]); + (REPEAT STRIP_TAC); + (SWITCH_TAC); + + (NEW_GOAL `a IN {x | !w. V w ==> dist (x,u0) <= dist (x,w:real^3)}`); + (FIRST_X_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `u0:real^3` THEN REWRITE_TAC[]); + (TRUONG_SET_TAC[]); + + (NEW_GOAL `a IN {x | !w. V w ==> dist (x,u1) <= dist (x,w:real^3)}`); + (FIRST_X_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `u1:real^3` THEN REWRITE_TAC[]); + (TRUONG_SET_TAC[]); + + (NEW_GOAL `a IN {x | !w. V w ==> dist (x,u2) <= dist (x,w:real^3)}`); + (FIRST_X_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `u2:real^3` THEN REWRITE_TAC[]); + (TRUONG_SET_TAC[]); + + (NEW_GOAL `a IN {x | !w. V w ==> dist (x,u3) <= dist (x,w:real^3)}`); + (FIRST_X_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `u3:real^3` THEN REWRITE_TAC[]); + (TRUONG_SET_TAC[]); + + (REPLICATE_TAC 4 UP_ASM_TAC THEN REWRITE_TAC[IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `u0 IN V /\ u1 IN V /\ u2 IN V /\ (u3:real^3) IN V`); + (UNDISCH_TAC `barV V 3 (ul:(real^3)list)`); + (REWRITE_TAC[BARV]); + (DISCH_TAC); + (NEW_GOAL `initial_sublist [u0;u1;u2;u3] ul /\ + 0 < LENGTH [u0;u1;u2;u3:real^3]`); + (REWRITE_TAC[LENGTH; INITIAL_SUBLIST]); + (STRIP_TAC); + (EXISTS_TAC `[]:(real^3)list`); + (ASM_REWRITE_TAC[APPEND]); + (ARITH_TAC); + + (NEW_GOAL `voronoi_nondg V [u0;u1;u2;u3:real^3]`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[VORONOI_NONDG; set_of_list]); + (SET_TAC[]); + + (UNDISCH_TAC `w IN {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[Geomdetail.IN_SET4] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (NEW_GOAL `dist (a,u0) <= dist (a,u1:real^3)`); + (MATCH_MP_TAC (ASSUME `!w. V w ==> dist (a,u0) <= dist (a,w:real^3)`)); + (ASM_REWRITE_TAC[GSYM IN]); + (NEW_GOAL `dist (a,u1) <= dist (a,u0:real^3)`); + (MATCH_MP_TAC (ASSUME `!w. V w ==> dist (a,u1) <= dist (a,w:real^3)`)); + (ASM_REWRITE_TAC[GSYM IN]); + (ASM_REAL_ARITH_TAC); + + (ASM_REWRITE_TAC[]); + (NEW_GOAL `dist (a,u0) <= dist (a,u2:real^3)`); + (MATCH_MP_TAC (ASSUME `!w. V w ==> dist (a,u0) <= dist (a,w:real^3)`)); + (ASM_REWRITE_TAC[GSYM IN]); + (NEW_GOAL `dist (a,u2) <= dist (a,u0:real^3)`); + (MATCH_MP_TAC (ASSUME `!w. V w ==> dist (a,u2) <= dist (a,w:real^3)`)); + (ASM_REWRITE_TAC[GSYM IN]); + (ASM_REAL_ARITH_TAC); + + (ASM_REWRITE_TAC[]); + (NEW_GOAL `dist (a,u0) <= dist (a,u3:real^3)`); + (MATCH_MP_TAC (ASSUME `!w. V w ==> dist (a,u0) <= dist (a,w:real^3)`)); + (ASM_REWRITE_TAC[GSYM IN]); + (NEW_GOAL `dist (a,u3) <= dist (a,u0:real^3)`); + (MATCH_MP_TAC (ASSUME `!w. V w ==> dist (a,u3) <= dist (a,w:real^3)`)); + (ASM_REWRITE_TAC[GSYM IN]); + (ASM_REAL_ARITH_TAC); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[HL;HD]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ABBREV_TAC `S = set_of_list [u0; u1; u2; u3:real^3]`); + (NEW_GOAL `(!w. w IN S ==> radV S = dist (circumcenter S,w:real^3))`); + (MATCH_MP_TAC Rogers.OAPVION2); + (EXPAND_TAC "S" THEN DEL_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "S" THEN REWRITE_TAC[set_of_list]); + (TRUONG_SET_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 39 *) +let ORTHOGONAL_AFF_HULL_2_KY_LEMMA = prove_by_refinement ( + `!n a b s p:real^3. + orthogonal (a - b) n /\ s IN aff {a, b} /\ p IN aff {a, b} + ==> orthogonal (s - p) n`, +[(REWRITE_TAC[Trigonometry2.AFF2; IN; IN_ELIM_THM; orthogonal]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH `(t % a + (&1 - t) % b) - (t' % a + (&1 - t') % b) + = (t - t') % (a - b)`;DOT_LMUL;REAL_MUL_RZERO])]);; +(* ======================================================================= *) +(* Lemma 40 *) + +let DIST_PROJECTION_LT_LEMMA = prove_by_refinement ( + `!x a b:real^3. ?s. s IN aff {a, b} /\ + (!m n. m IN aff {a, b} /\ n IN aff {a, b} ==> +(dist (x, m) < dist (x, n) <=> dist (s,m) < dist (s,n)) /\ +(dist (x, m) <= dist (x, n) <=> dist (s,m) <= dist (s,n)))`, +[ (REPEAT STRIP_TAC); + (SUBGOAL_THEN `?s:real^3. s IN aff {a, b} /\ (x - s) dot (a - b) = &0` CHOOSE_TAC); + (REWRITE_TAC[Trigonometry2.EXISTS_PROJECTING_POINT2]) ; + (EXISTS_TAC `s:real^3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC); + (REPEAT STRIP_TAC); + (NEW_GOAL `orthogonal (a - b) (x - s:real^3)`); + (REWRITE_TAC[orthogonal]); + (ONCE_REWRITE_TAC[DOT_SYM] THEN ASM_REWRITE_TAC[]); + + (EQ_TAC); + (REPEAT STRIP_TAC); + (REWRITE_TAC[dist]); + (NEW_GOAL `norm (s - m:real^3) = abs (norm (s - m)) /\ + norm (s - n) = abs (norm (s - n))`); + (MESON_TAC[REAL_ABS_REFL;NORM_POS_LE]); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_LT_SQUARE_ABS]); + (NEW_GOAL `norm (x:real^3 - m) pow 2 < norm (x - n) pow 2`); + (ONCE_REWRITE_TAC[GSYM REAL_LT_SQUARE_ABS]); + + (NEW_GOAL `abs (norm (x - m:real^3)) = (norm (x - m)) /\ + abs (norm (x - n)) = (norm (x - n))`); + (MESON_TAC[REAL_ABS_REFL;NORM_POS_LE]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM dist]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `norm (x - m:real^3) pow 2 = norm (s - m) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (MATCH_MP_TAC ORTHOGONAL_AFF_HULL_2_KY_LEMMA); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `b:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `norm (x - n:real^3) pow 2 = norm (s - n) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (MATCH_MP_TAC ORTHOGONAL_AFF_HULL_2_KY_LEMMA); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `b:real^3`); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (STRIP_TAC); + (REWRITE_TAC[dist]); + (NEW_GOAL `norm (x - m:real^3) = abs (norm (x - m)) /\ + norm (x - n) = abs (norm (x - n))`); + (MESON_TAC[REAL_ABS_REFL;NORM_POS_LE]); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_LT_SQUARE_ABS]); + (NEW_GOAL `norm (s:real^3 - m) pow 2 < norm (s - n) pow 2`); + (ONCE_REWRITE_TAC[GSYM REAL_LT_SQUARE_ABS]); + + (NEW_GOAL `abs (norm (s - m:real^3)) = (norm (s - m)) /\ + abs (norm (s - n)) = (norm (s - n))`); + (MESON_TAC[REAL_ABS_REFL;NORM_POS_LE]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM dist]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `norm (x - m:real^3) pow 2 = norm (s - m) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (MATCH_MP_TAC ORTHOGONAL_AFF_HULL_2_KY_LEMMA); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `b:real^3`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `norm (x - n:real^3) pow 2 = norm (s - n) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (MATCH_MP_TAC ORTHOGONAL_AFF_HULL_2_KY_LEMMA); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `b:real^3`); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `orthogonal (a - b) (x - s:real^3)`); + (REWRITE_TAC[orthogonal]); + (ONCE_REWRITE_TAC[DOT_SYM] THEN ASM_REWRITE_TAC[]); + + (EQ_TAC); + (REPEAT STRIP_TAC); + (REWRITE_TAC[dist]); + (NEW_GOAL `norm (s - m:real^3) = abs (norm (s - m)) /\ + norm (s - n) = abs (norm (s - n))`); + (MESON_TAC[REAL_ABS_REFL;NORM_POS_LE]); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_LE_SQUARE_ABS]); + (NEW_GOAL `norm (x:real^3 - m) pow 2 <= norm (x - n) pow 2`); + (ONCE_REWRITE_TAC[GSYM REAL_LE_SQUARE_ABS]); + + (NEW_GOAL `abs (norm (x - m:real^3)) = (norm (x - m)) /\ + abs (norm (x - n)) = (norm (x - n))`); + (MESON_TAC[REAL_ABS_REFL;NORM_POS_LE]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM dist]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `norm (x - m:real^3) pow 2 = norm (s - m) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (MATCH_MP_TAC ORTHOGONAL_AFF_HULL_2_KY_LEMMA); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `b:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `norm (x - n:real^3) pow 2 = norm (s - n) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (MATCH_MP_TAC ORTHOGONAL_AFF_HULL_2_KY_LEMMA); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `b:real^3`); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (STRIP_TAC); + (REWRITE_TAC[dist]); + (NEW_GOAL `norm (x - m:real^3) = abs (norm (x - m)) /\ + norm (x - n) = abs (norm (x - n))`); + (MESON_TAC[REAL_ABS_REFL;NORM_POS_LE]); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_LE_SQUARE_ABS]); + (NEW_GOAL `norm (s:real^3 - m) pow 2 <= norm (s - n) pow 2`); + (ONCE_REWRITE_TAC[GSYM REAL_LE_SQUARE_ABS]); + + (NEW_GOAL `abs (norm (s - m:real^3)) = (norm (s - m)) /\ + abs (norm (s - n)) = (norm (s - n))`); + (MESON_TAC[REAL_ABS_REFL;NORM_POS_LE]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM dist]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `norm (x - m:real^3) pow 2 = norm (s - m) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (MATCH_MP_TAC ORTHOGONAL_AFF_HULL_2_KY_LEMMA); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `b:real^3`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `norm (x - n:real^3) pow 2 = norm (s - n) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (MATCH_MP_TAC ORTHOGONAL_AFF_HULL_2_KY_LEMMA); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `b:real^3`); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC) +]);; + +(* ======================================================================= *) +(* Lemma 41 *) + +let SIMPLEX_FURTHEST_LT_2 = prove_by_refinement ( + `!a (s:real^N->bool). + FINITE s + ==> (!x. x IN convex hull s /\ ~(x IN s) + ==> (?y. y IN s /\ norm (x - a) < norm (y - a)))`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `(?y:real^N. y IN convex hull s /\ norm (x - a) < norm (y - a))`); + (ASM_SIMP_TAC[SIMPLEX_FURTHEST_LT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (ASM_CASES_TAC `y:real^N IN s`); + (EXISTS_TAC `y:real^N`); + (ASM_REWRITE_TAC[]); + (SUBGOAL_THEN `(?y. y:real^N IN s /\ + (!x. x IN convex hull s ==> norm (x - a) <= norm (y - a)))` + CHOOSE_TAC); + (MATCH_MP_TAC SIMPLEX_FURTHEST_LE); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `x:real^N IN convex hull s`); + (ASM_REWRITE_TAC[CONVEX_HULL_EMPTY]); + (SET_TAC[]); + (EXISTS_TAC `y':real^N`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (REAL_ARITH `m < norm (y-a:real^N) /\ norm (y-a) <= n ==> m < n`)); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC THEN FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 42 *) + +let DIST_BETWEEN_FURTHEST_LT = prove_by_refinement ( + `!x a b s:real^3. + between s (a, b) /\ ~(s = a) /\ ~(s = b) /\ ~(a = b) /\ + dist (x, b) <= dist (x, a) + ==> dist (x,s) < dist (x,a)`, +[(REPEAT GEN_TAC THEN REWRITE_TAC[BETWEEN_IN_CONVEX_HULL] THEN REPEAT STRIP_TAC + THEN NEW_GOAL `(?y:real^3. y IN {a,b} /\ norm (s - x) < norm (y - x))`); + (NEW_GOAL`(!h. h IN convex hull {a,b} /\ ~(h IN {a,b:real^3}) + ==> (?y. y IN {a,b} /\ norm (h - x) < norm (y - x)))`); + (MATCH_MP_TAC SIMPLEX_FURTHEST_LT_2 THEN REWRITE_TAC[Geomdetail.FINITE6]); + (FIRST_X_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC THEN UP_ASM_TAC); + (REWRITE_TAC[SET_RULE `a IN {m,n} <=> a = m \/ a = n`]); + (REWRITE_TAC[GSYM dist] THEN REPEAT STRIP_TAC); + (ASM_MESON_TAC[DIST_SYM]); + (ASM_MESON_TAC[DIST_SYM; REAL_ARITH `x < y /\ y <= z ==> x < z`])]);; + +(* ======================================================================= *) +(* Lemma 43 *) + +let ROGERS_EXPLICIT = prove_by_refinement ( + `!V ul. + saturated V /\ packing V /\ barV V 3 ul ==> + rogers V ul = convex hull + {HD ul, omega_list_n V ul 1, omega_list_n V ul 2, omega_list_n V ul 3}`, +[(REPEAT STRIP_TAC THEN REWRITE_TAC[ROGERS]); + (NEW_GOAL `?u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]`); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (REWRITE_WITH `{j | j < LENGTH (ul:(real^3)list)} = {0, 1,2,3}`); + (ASM_REWRITE_TAC[LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`]); + (MESON_TAC[SET_OF_0_TO_3]); + (REWRITE_TAC[IMAGE]); + (AP_TERM_TAC); + (REWRITE_WITH `!x. x IN {0,1,2,3} <=> (x = 0 \/x = 1 \/x = 2 \/x = 3)`); + (SET_TAC[]); + (REWRITE_WITH + `!y. (?x. (x = 0 \/ x = 1 \/ x = 2 \/ x = 3) /\ y = omega_list_n V ul x) + <=> (y = omega_list_n V ul 0) \/ (y = omega_list_n V ul 1) \/ + (y = omega_list_n V ul 2) \/(y = omega_list_n V ul 3)`); + (SET_TAC[BETA_THM]); + (REWRITE_WITH + `{y | y = omega_list_n V ul 0 \/ y = omega_list_n V ul 1 \/ + y = omega_list_n V ul 2 \/ y = omega_list_n V ul 3} + = {omega_list_n V ul 0, omega_list_n V ul 1, + omega_list_n V ul 2, omega_list_n V ul 3}`); + (SET_TAC[]); + (REWRITE_WITH `omega_list_n V ul 0 = HD ul`); + (REWRITE_TAC[OMEGA_LIST_N])]);; + +(* ======================================================================= *) +(* Lemma 44 *) +let SEGMENT_INTER_CBALL_LEMMA = prove + (`!x r a (b:real^3). + dist (x, a) <= r /\ r <= dist (x, b) + ==> (?c. between c (a, b) /\ dist (x, c) = r)`, + REPEAT STRIP_TAC THEN ASM_CASES_TAC `dist(x:real^3,b) = r` THENL + [EXISTS_TAC `b:real^3` THEN ASM_REWRITE_TAC[BETWEEN_REFL]; + MP_TAC(ISPECL [`segment[a:real^3,b]`; `cball(x:real^3,r)`] + CONNECTED_INTER_FRONTIER) THEN + ANTS_TAC THENL + [REWRITE_TAC[CONNECTED_SEGMENT; GSYM MEMBER_NOT_EMPTY] THEN CONJ_TAC THENL + [EXISTS_TAC `a:real^3` THEN + ASM_REWRITE_TAC[IN_INTER; ENDS_IN_SEGMENT; IN_CBALL]; + EXISTS_TAC `b:real^3` THEN + ASM_REWRITE_TAC[IN_DIFF; ENDS_IN_SEGMENT; IN_CBALL] THEN + ASM_REAL_ARITH_TAC]; + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN MATCH_MP_TAC MONO_EXISTS THEN + REWRITE_TAC[FRONTIER_CBALL; IN_ELIM_THM; IN_INTER; + BETWEEN_IN_SEGMENT]]]);; + +(* ======================================================================= *) +(* Lemma 45 *) +let CLOSEST_POINT_SING = prove_by_refinement ( + `!a (b:real^3). closest_point {a} b = a`, +[(REPEAT GEN_TAC THEN REWRITE_TAC + [closest_point;SET_RULE `a IN {x} <=> a = x`]); + (MATCH_MP_TAC SELECT_UNIQUE); + (REWRITE_TAC[BETA_THM] THEN GEN_TAC THEN EQ_TAC); + (REPEAT STRIP_TAC); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 46 *) + +let MXI_EXPLICIT = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ barV V 3 ul /\ ul = [u0;u1;u2;u3] /\ + hl (truncate_simplex 2 ul) < sqrt (&2) /\ sqrt (&2) <= hl ul + ==> (?s. between s (omega_list_n V ul 2, omega_list_n V ul 3) /\ + dist (u0, s) = sqrt (&2) /\ + mxi V ul = s)`, +[(REPEAT STRIP_TAC); + (NEW_GOAL + `?(s:real^3). between s (omega_list_n V ul 2, omega_list_n V ul 3) /\ + dist (u0, s) = sqrt (&2)`); + (MATCH_MP_TAC SEGMENT_INTER_CBALL_LEMMA); + STRIP_TAC; + + (REWRITE_WITH `dist (u0:real^3,omega_list_n V ul 2) = + hl (truncate_simplex 2 ul)`); + (ABBREV_TAC `vl = truncate_simplex 2 (ul:(real^3)list)`); + (REWRITE_WITH `hl (vl:(real^3)list) = + dist (circumcenter (set_of_list vl),HD vl)`); + (MATCH_MP_TAC Rogers.HL_EQ_DIST0); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (REWRITE_TAC[DIST_SYM]); + (AP_TERM_TAC); + (REWRITE_TAC[PAIR_EQ]); + (STRIP_TAC); + (EXPAND_TAC "vl"); + (DEL_TAC THEN ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; HD]); + (ASM_REWRITE_TAC[Marchal_cells.OMEGA_LIST_TRUNCATE_2]); + (REWRITE_WITH `omega_list V [u0; u1; u2] = omega_list V (vl:(real^3)list)`); + (EXPAND_TAC "vl"); + (DEL_TAC THEN ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC XNHPWAB1); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[IN] THEN EXPAND_TAC "vl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ASM_REAL_ARITH_TAC); + +(* ======================================================================== *) + + (NEW_GOAL `~affine_dependent {u0,u1,u2,u3:real^3}`); + (ASM_MESON_TAC[set_of_list; AFF_INDEPENDENT_SET_OF_LIST_BARV]); + + (REWRITE_WITH `dist (u0:real^3,omega_list_n V ul 3) = + hl (truncate_simplex 3 ul)`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3]); + (REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `3 = SUC 2`]); + (ONCE_REWRITE_TAC[ARITH_RULE `SUC 2 = 3`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3]); + + (NEW_GOAL `barV V 3 ul`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[BARV; VORONOI_NONDG]); + (REPEAT STRIP_TAC); + (NEW_GOAL `(?a. voronoi_list V ul = {a:real^3} /\ + a = circumcenter (set_of_list ul) /\ + hl ul = dist (HD ul,a))`); + (ASM_SIMP_TAC[VORONOI_LIST_3_SINGLETON_EXPLICIT]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[HD] THEN REPEAT STRIP_TAC); + (REWRITE_TAC[ASSUME `voronoi_list V [u0; u1; u2; u3] = {a:real^3}`]); + (REWRITE_TAC[CLOSEST_POINT_SING]); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + + (EXISTS_TAC `s:real^3`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[mxi]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `hl (truncate_simplex 2 (ul:(real^3)list)) < sqrt (&2)`); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (UP_ASM_TAC THEN MESON_TAC[]); + (MATCH_MP_TAC SELECT_UNIQUE); + (REPEAT STRIP_TAC); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL;HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (EQ_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[DIST_SYM]); + + (DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN + REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; + CONVEX_HULL_2; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ABBREV_TAC `a = omega_list_n V [u0; u1; u2; u3:real^3] 2`); + (ABBREV_TAC `b = omega_list_n V [u0; u1; u2; u3:real^3] 3`); + (NEW_GOAL `s = u % a + v % (b:real^3)`); + (ASM_MESON_TAC[]); + (NEW_GOAL `?c. c IN aff {a, b} /\ (u0 - c) dot (a - b:real^3) = &0`); + (REWRITE_TAC[Trigonometry2.EXISTS_PROJECTING_POINT2]); + (FIRST_X_ASSUM CHOOSE_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[Trigonometry2.AFF2;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + + (NEW_GOAL `dist (u0, a:real^3) < sqrt (&2)`); + (REWRITE_WITH `dist (u0, a:real^3) = hl (truncate_simplex 2 (ul:(real^3)list))`); + (ABBREV_TAC `vl = truncate_simplex 2 (ul:(real^3)list)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_WITH `a:real^3 = omega_list V vl`); + (EXPAND_TAC "vl" THEN DEL_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; LENGTH; ARITH_RULE `SUC (SUC (SUC 0)) - 1 = 2`]); + (EXPAND_TAC "a"); + (REWRITE_TAC[Marchal_cells.OMEGA_LIST_TRUNCATE_2]); + (REWRITE_WITH `u0:real^3 = HD vl`); + (EXPAND_TAC "vl" THEN DEL_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; HD]); + (MATCH_MP_TAC Rogers.WAUFCHE2); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl" THEN DEL_TAC); + (ASM_REWRITE_TAC[IN]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_MESON_TAC [ARITH_RULE `2 <= 3 `]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `dist (u0, b:real^3) >= sqrt (&2)`); + (REWRITE_WITH `dist (u0, b:real^3) = hl (ul:(real^3)list)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (SUBGOAL_THEN `?m. voronoi_list V ul = {m:real^3} /\ + m = circumcenter (set_of_list ul) /\ + hl ul = dist (HD ul,m)` CHOOSE_TAC); + (ASM_SIMP_TAC [VORONOI_LIST_3_SINGLETON_EXPLICIT]); + (NEW_GOAL `(b:real^3) IN voronoi_list V ul`); + (EXPAND_TAC "b"); + (REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `3 = SUC 2`]); + (REWRITE_TAC[ARITH_RULE `SUC 2 = 3`; TRUNCATE_SIMPLEX_EXPLICIT_3]); + (REWRITE_TAC[ASSUME `ul = [u0; u1; u2; u3:real^3]`]); + (MATCH_MP_TAC CLOSEST_POINT_IN_SET); + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + (ASM_SET_TAC[]); + + (UP_ASM_TAC THEN UP_ASM_TAC THEN REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `voronoi_list V ul = {m:real^3}`]); + (REWRITE_TAC[IN_SING] THEN STRIP_TAC); + (REWRITE_WITH `u0:real^3 = HD ul`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_TAC[ASSUME `b = m:real^3`]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)] + THEN ASM_REAL_ARITH_TAC); + +(* ======================================================================== *) + + (ASM_CASES_TAC `y = s:real^3`); + (ASM_MESON_TAC[]); + (NEW_GOAL `between y (a, b:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2;IN;IN_ELIM_THM]); + (EXISTS_TAC `u':real` THEN EXISTS_TAC `v':real` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `between s (a, b:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2;IN;IN_ELIM_THM]); + (EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real` THEN ASM_REWRITE_TAC[]); + (ASM_CASES_TAC `between y (s, a:real^3)`); + + (NEW_GOAL `dist (u0,y) < dist (u0,s:real^3)`); + (MATCH_MP_TAC DIST_BETWEEN_FURTHEST_LT); + (EXISTS_TAC `a:real^3`); + (REPEAT STRIP_TAC); + + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (NEW_GOAL `dist (y:real^3,u0) < sqrt (&2)`); + (REWRITE_TAC[ASSUME `y = a:real^3`]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `dist (u0:real^3,s) < sqrt (&2)`); + (REWRITE_TAC[ASSUME `s = a:real^3`]); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_WITH `dist (u0,y) = dist (y,u0:real^3)`); + (MESON_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + + (ASM_CASES_TAC `between s (y, a:real^3)`); + + (NEW_GOAL `dist (u0,s) < dist (u0,y:real^3)`); + (MATCH_MP_TAC DIST_BETWEEN_FURTHEST_LT); + (EXISTS_TAC `a:real^3`); + (REPEAT STRIP_TAC); + + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (NEW_GOAL `dist (u0,s:real^3) < sqrt (&2)`); + (REWRITE_TAC[ASSUME `s = a:real^3`]); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `dist (y, u0:real^3) < sqrt (&2)`); + (REWRITE_TAC[ASSUME `y = a:real^3`]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + + (REWRITE_WITH `dist (u0,y:real^3) = dist (y, u0)`); + (MESON_TAC[DIST_SYM]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_WITH `dist (u0,y) = dist (y,u0:real^3)`); + (MESON_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `collinear {y, s, a:real^3}`); + (MATCH_MP_TAC AFFINE_HULL_3_IMP_COLLINEAR); + (REWRITE_TAC[AFFINE_HULL_2;IN;IN_ELIM_THM]); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `v / (v - v')`); + (EXISTS_TAC `&1 - v / (v - v')`); + (REWRITE_TAC[REAL_ARITH `a + &1 - a = &1`]); + (REWRITE_TAC[VECTOR_ARITH `a = x1 % (u' % a + v' % b) + x2 % (u % a + v % b) + <=> (&1 - x1 * u' - x2 * u) % a - (x1 * v' + x2 * v) % b = vec 0`]); + (REWRITE_WITH `&1 - v / (v - v') * u' - (&1 - v / (v - v')) * u = &0`); + (REWRITE_TAC[REAL_ARITH `&1 - v / (v - v') * u' - (&1 - v / (v - v')) * u = + (&1 - u) + v * (u - u') / (v - v') `]); + (REWRITE_WITH `u - u' = v' - v:real`); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&1 - u + v * (v' - v) / (v - v') = &1 - u - v * (v - v') / (v - v')`]); + (REWRITE_WITH `(v - v') / (v - v') = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ARITH `b - a = &0 <=> a = b`]); + + (STRIP_TAC); + (NEW_GOAL `s = y:real^3`); + (REWRITE_TAC[ASSUME `y = u' % a + v' % (b:real^3)`; + ASSUME `s = u % a + v % (b:real^3)`]); + (NEW_GOAL `u = u':real`); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[ASSUME `v' = v:real`; ASSUME `u = u':real`]); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + + (REWRITE_WITH `v / (v - v') * v' + (&1 - v / (v - v')) * v = &0`); + (REWRITE_TAC[REAL_ARITH `v / (v - v') * v' + (&1 - v / (v - v')) * v = + v - v * (v - v') / (v - v') `]); + (REWRITE_WITH `(v - v') / (v - v') = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ARITH `b - a = &0 <=> a = b`]); + (STRIP_TAC); + (NEW_GOAL `s = y:real^3`); + (REWRITE_TAC[ASSUME `y = u' % a + v' % (b:real^3)`; + ASSUME `s = u % a + v % (b:real^3)`]); + (NEW_GOAL `u = u':real`); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[ASSUME `v' = v:real`; ASSUME `u = u':real`]); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `between a (s, y:real^3)`); + (UP_ASM_TAC THEN REWRITE_TAC[COLLINEAR_BETWEEN_CASES]); + (ASM_MESON_TAC[BETWEEN_SYM]); + (UP_ASM_TAC THEN REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN; + IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (NEW_GOAL `a = u'' % s + v'' % (y:real^3)`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `y = u' % a + v' % (b:real^3)`; + ASSUME `s = u % a + v % (b:real^3)`]); + + (REWRITE_TAC[VECTOR_ARITH + `a = u'' % (u % a + v % b) + v'' % (u' % a + v' % b) + <=> (u''* u + v'' * u' - &1) % a + (u'' * v + v'' * v') % b = vec 0`]); + (REWRITE_WITH `(u'' * v + v'' * v') = -- (u'' * u + v'' * u' - &1)`); + (REWRITE_TAC[REAL_ARITH `u'' * v + v'' * v' = --(u'' * u + v'' * u' - &1) <=> + u'' * (u + v) + v'' * (u' + v') = &1`]); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (REWRITE_TAC[VECTOR_ARITH `a % x + -- a % y = a % (x - y)`;VECTOR_MUL_EQ_0]); + (REPEAT STRIP_TAC); + (NEW_GOAL `u'' * u <= u'' * (u + v)`); + (REWRITE_TAC[REAL_ARITH `a * b <= a * (b + c) <=> &0 <= a * c`]); + (ASM_SIMP_TAC[REAL_LE_MUL]); + (NEW_GOAL `v'' * u' <= v'' * (u' + v')`); + (REWRITE_TAC[REAL_ARITH `a * b <= a * (b + c) <=> &0 <= a * c`]); + (ASM_SIMP_TAC[REAL_LE_MUL]); + (NEW_GOAL `u'' * (u + v) + v'' * (u' + v') = &1`); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (NEW_GOAL `v'' * u' = v'' * (u' + v')`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ARITH `a * b = a * (b + c) <=> &0 = a * c`]); + (DISCH_TAC); + (NEW_GOAL `u'' * u = u'' * (u + v)`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ARITH `a * b = a * (b + c) <=> &0 = a * c`]); + (DISCH_TAC); + + (NEW_GOAL `~(u'' = &0)`); + (STRIP_TAC); + (NEW_GOAL `a = y:real^3`); + (REWRITE_TAC[ASSUME `a = u'' % s + v'' % (y:real^3)`]); + (REWRITE_WITH `u'' = &0 /\ v'' = &1`); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (NEW_GOAL `dist (y, u0:real^3) < sqrt (&2)`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[GSYM (ASSUME `a = y:real^3`)]); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `v = &0`); + (MP_TAC (GSYM (ASSUME `&0 = u'' * v`))); + (REWRITE_TAC[REAL_ENTIRE]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `a = s:real^3`); + (REWRITE_TAC[ASSUME `s = u % a + v % (b:real^3)`]); + (REWRITE_WITH `u = &1 /\ v = &0`); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (NEW_GOAL `dist (u0:real^3, s) < sqrt (&2)`); + (REWRITE_TAC[GSYM (ASSUME `a = s:real^3`)]); + (ASM_MESON_TAC[]); + (NEW_GOAL `F`); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (DISCH_TAC); + (NEW_GOAL `dist (u0,a:real^3) >= sqrt (&2)`); + (REWRITE_TAC[(ASSUME `a = b:real^3`)]); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 47 *) +let CONVEX_HULL_4_IMP_2_2 = prove_by_refinement ( + `!a b c d p:real^3. + p IN convex hull {a,b,c,d} + ==> (?m n. between p (m,n) /\ between m (a,b) /\ between n (c,d))`, +[(REWRITE_TAC[CONVEX_HULL_4;IN;IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_CASES_TAC `u + v = &0`); + (NEW_GOAL `u = &0 /\ v = &0`); + (ASM_REAL_ARITH_TAC); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `p:real^3`); + (REWRITE_TAC[BETWEEN_REFL]); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM]); + (EXISTS_TAC `w:real` THEN EXISTS_TAC `z:real`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (ASM_CASES_TAC `w + z = &0`); + (NEW_GOAL `w = &0 /\ z = &0`); + (ASM_REAL_ARITH_TAC); + (EXISTS_TAC `p:real^3` THEN EXISTS_TAC `c:real^3`); + (REWRITE_TAC[BETWEEN_REFL]); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM]); + (EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (EXISTS_TAC `u/(u+v) % (a:real^3) + v /(u+v) % b`); + (EXISTS_TAC `w/(w+z) % (c:real^3) + z/(w+z) % d`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u + v` THEN EXISTS_TAC `w + z`); + (REPEAT STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH `x % (y/x % a + z/x % b) = (x/x) % (y %a + z % b)`]); + (REWRITE_WITH `(u+v)/(u+v) = &1 /\ (w+z)/(w+z) = &1`); + (STRIP_TAC); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (EXISTS_TAC `u / (u + v)` THEN EXISTS_TAC `v / (u + v)`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `u /(u + v) + v / (u + v) = (u+v)/(u+v)`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `w / (w + z)` THEN EXISTS_TAC `z / (w + z)`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `u /(u + v) + v / (u + v) = (u+v)/(u+v)`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 48 *) +let proj_point = new_definition +`!e x. proj_point e x = x - projection e x`;; + +let projection_proj_point = prove_by_refinement ( + `!e x. projection e x = x - proj_point e x`, +[ REWRITE_TAC[proj_point] THEN VECTOR_ARITH_TAC]);; + +let PRO_EXP = prove_by_refinement( + `!e x. proj_point e x = (x dot e) / (e dot e) % e`, +[REWRITE_TAC[projection;proj_point] THEN VECTOR_ARITH_TAC]);; + +(* ======================================================================= *) +(* Lemma 49 *) +let BETWEEN_PROJ_POINT = prove_by_refinement ( + `!a b x e. between x (a,b) ==> + between (proj_point e x) (proj_point e a, proj_point e b)`, +[(REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2;IN;IN_ELIM_THM; PRO_EXP]); + (REPEAT STRIP_TAC THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; + VECTOR_ARITH `x % a = m % a + n % a <=> (x -m - n) % a = vec 0`; + REAL_ARITH `a / x - u * b / x - v * c / x = (a - u*b - v*c) / x`]); + (REWRITE_TAC[VECTOR_ARITH + `(u % a + v % b) dot e - u * (a dot e) - v * (b dot e) = &0`]); + (REWRITE_TAC[REAL_ARITH `&0/a = &0`]); + (VECTOR_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 50 *) +let PARALLEL_PROJECTION = prove_by_refinement ( + `!x y a:real^N b. between x (a, y) /\ ~(a = b) + ==> (?k. k <= &1 /\ &0 <= k /\ + projection (b - a) (x - a) = k % projection (b - a) (y - a))`, +[(REWRITE_TAC[projection; BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM] + THEN REPEAT STRIP_TAC); + (NEW_GOAL `(x - a) = v % (y - a:real^N)`); + (REWRITE_WITH `x - a:real^N = (u % a + v % y) - (u + v) % a`); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (VECTOR_ARITH_TAC); + (ASM_CASES_TAC `((y - a:real^N) dot (b - a) = &0)`); + (EXISTS_TAC `v:real`); + (REPEAT STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[DOT_LMUL;REAL_MUL_RZERO;Collect_geom.REAL_DIV_LZERO; + VECTOR_MUL_LZERO; VECTOR_SUB_RZERO]); + (EXISTS_TAC `((x - a) dot (b - a)) / ((y - a) dot (b - a:real^N))`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[DOT_LMUL; REAL_ARITH `(a * b) / c = a * (b / c)`]); + (REWRITE_WITH `((y - a) dot (b - a)) / ((y - a) dot (b - a:real^N)) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[DOT_LMUL; REAL_ARITH `(a * b) / c = a * (b / c)`]); + (REWRITE_WITH `((y - a) dot (b - a)) / ((y - a) dot (b - a:real^N)) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `((x - a) dot (b - a)) / ((y - a) dot (b - a:real^N)) % + ((y - a):real^N - ((y - a) dot (b - a)) / ((b - a) dot (b - a)) % + (b - a:real^N)) = + &1 / ((y - a) dot (b - a)) % + ((x - a) dot (b - a)) % (((y - a) - ((y - a) dot (b - a)) / ((b - a) dot + (b - a)) % (b - a)))`); + (VECTOR_ARITH_TAC); + (MATCH_MP_TAC Trigonometry2.VECTOR_MUL_R_TO_L); + (REPEAT STRIP_TAC); + (ASM_MESON_TAC[]); + (ABBREV_TAC `m = (y - a) dot (b - a:real^N)`); + (ABBREV_TAC `n = (x - a) dot (b - a:real^N)`); + (ABBREV_TAC `p = (b - a) dot (b - a:real^N)`); + (REWRITE_TAC[VECTOR_ARITH + `m % (x - n / p % (b - a)) = n % (y - m / p % (b - a)) <=> m % x = n % y`]); + (EXPAND_TAC "m" THEN EXPAND_TAC "n"); + (REWRITE_TAC[ASSUME `x - a = v % (y - a:real^N)`; VECTOR_MUL_ASSOC]); + (AP_THM_TAC THEN AP_TERM_TAC); + (VECTOR_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 51 *) +let NORM_PROJECTION_LE = prove_by_refinement( + `!x y a:real^N b. between x (a, y) /\ ~(a = b) + ==> norm (projection (b - a) (x - a)) <= norm (projection (b - a) (y - a))`, +[(REPEAT GEN_TAC THEN DISCH_TAC); + (SUBGOAL_THEN + `(?k. k <= &1 /\ &0 <= k /\ + projection (b - a) (x - a:real^N) = k % projection (b - a) (y - a))` + CHOOSE_TAC); + (ASM_SIMP_TAC[PARALLEL_PROJECTION]); + (ASM_REWRITE_TAC[NORM_MUL]); + (REWRITE_WITH `abs k = k`); + (ASM_SIMP_TAC[REAL_ABS_REFL]); + (REWRITE_TAC[REAL_ARITH `a * b <= b <=> &0 <= (&1 - a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[NORM_POS_LE])]);; + +(* ======================================================================= *) +(* Lemma 52 *) +let OMEGA_LIST_TRUNCATE_1_NEW1 = prove_by_refinement ( + `!V u0:real^3 u1 u2 u3. + omega_list_n V [u0;u1;u2] 1 = omega_list V [u0;u1] `, +[ (REPEAT GEN_TAC); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH [u0:real^3;u1] - 1 = 1`); + (REWRITE_TAC[LENGTH; ARITH_RULE `SUC (SUC 0) - 1 = 1`]); + (REWRITE_TAC[ARITH_RULE `1 = SUC 0`; OMEGA_LIST_N]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`;TRUNCATE_SIMPLEX_EXPLICIT_1;HD])]);; + +let OMEGA_LIST_TRUNCATE_1_NEW2 = prove_by_refinement ( + `!V u0:real^3 u1 u2 u3. + omega_list_n V [u0;u1] 1 = omega_list V [u0;u1] `, +[ (REPEAT GEN_TAC); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH [u0:real^3;u1] - 1 = 1`); + (REWRITE_TAC[LENGTH; ARITH_RULE `SUC (SUC 0) - 1 = 1`])]);; + +let OMEGA_LIST_TRUNCATE_2_NEW1 = prove_by_refinement ( + `!V u0:real^3 u1 u2 u3. + omega_list_n V [u0;u1;u2:real^3] 2 = omega_list V [u0;u1;u2]`, +[(REPEAT GEN_TAC); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH [u0:real^3;u1;u2] - 1 = 2`); + (REWRITE_TAC[LENGTH; ARITH_RULE `SUC (SUC (SUC 0)) - 1 = 2`])]);; + +(* ======================================================================= *) +(* Lemma 53 *) +let IN_AFFINE_KY_LEMMA1 = prove_by_refinement ( + `!x s. x IN s ==> x IN affine hull s`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[affine;hull;IN_INTERS]); + (REWRITE_TAC[IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN SWITCH_TAC THEN UP_ASM_TAC THEN SET_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 54 *) +let AFFINE_SUBSET_KY_LEMMA = prove_by_refinement ( +`!S B:real^N ->bool. S SUBSET B ==> affine hull S SUBSET affine hull B`, +[(REWRITE_TAC[SUBSET;AFFINE_HULL_EXPLICIT; IN;IN_ELIM_THM] THEN + REPEAT STRIP_TAC); + (EXISTS_TAC `s:real^N->bool`); + (EXISTS_TAC `u:real^N->real`); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 55 *) +let TRANSLATE_AFFINE_KY_LEMMA1 = prove_by_refinement( + `!a:real^3 b c x y z k. + a IN affine hull {x,y,z} /\ + b IN affine hull {x,y,z} /\ + c IN affine hull {x,y,z} + ==> a + k % (b - c) IN affine hull {x,y,z}`, +[(REWRITE_TAC[AFFINE_HULL_3;IN;IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `u + k * (u' - u'')`); + (EXISTS_TAC `v + k * (v' - v'')`); + (EXISTS_TAC `w + k * (w' - w'')`); + (STRIP_TAC); + (REWRITE_WITH + `(u + k * (u' - u'')) + (v + k * (v' - v'')) + w + k * (w' - w'') = + (u + v + w) + k * (u' + v' + w') - k * (u'' + v'' + w'')`); + (REAL_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_SUB_REFL;REAL_ADD_RID]); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 56 *) +let IN_AFFINE_HULL_KY_LEMMA3 = prove_by_refinement ( + `!x:real^3 y z p a r. + p + a IN affine hull {x,y,z} /\ + p + r % a IN affine hull {x,y,z} /\ + ~(r = &1) + ==> p IN affine hull {x,y,z}`, +[(REWRITE_TAC[AFFINE_HULL_3;IN;IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `u + (u' - u) / (&1 - r)`); + (EXISTS_TAC `v + (v' - v) / (&1 - r)`); + (EXISTS_TAC `w + (w' - w) / (&1 - r)`); + (STRIP_TAC); + (REWRITE_TAC [REAL_ARITH + `(u + (u' - u) / (&1 - r)) + (v + (v' - v) / (&1 - r)) + + w + (w' - w) / (&1 - r) + = (u + v + w) + ((u' + v' + w') - (u + v + w))/ (&1 - r)`]); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (REWRITE_WITH +`(u + (u' - u) / (&1 - r)) % (x:real^3) + + (v + (v' - v) / (&1 - r)) % y + + (w + (w' - w) / (&1 - r)) % z = + (p + a) - (&1/(&1 - r)) % ((p + a) - (p + r % a))`); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH + `p = (p + a) - &1 / (&1 - r) % ((p + a) - (p + r % a)) + <=> ((&1 - r) / (&1 - r) - &1) % a = vec 0`]); + (REWRITE_WITH `(&1 - r) / (&1 - r) = &1`); + + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_SUB_REFL;VECTOR_MUL_LZERO])]);; + +let IN_AFFINE_HULL_KY_LEMMA3_alt = prove_by_refinement ( + `!x:real^3 y z p a r. + p - a IN affine hull {x, y, z} /\ + p - r % a IN affine hull {x, y, z} /\ + ~(r = &1) + ==> p IN affine hull {x, y, z}`, +[(REWRITE_TAC[VECTOR_ARITH `p - a:real^3 = p + (-- a)`; + VECTOR_ARITH `--(r % a) = r % (-- a)`]); + (REWRITE_TAC[IN_AFFINE_HULL_KY_LEMMA3])]);; + +(* ======================================================================= *) +(* Lemma 57 *) +let IN_AFFINE_HULL_3_KY_LEMMA2 = prove_by_refinement ( + `!X Y Z a b c. X IN affine hull {a,b,c} /\ + Y IN affine hull {a,b,c} /\ + between Z (X,Y) + ==> Z IN affine hull {a,b,c:real^3}`, +[(REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2; + AFFINE_HULL_3;IN;IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `u'' * u + v'' * u'`); + (EXISTS_TAC `u'' * v + v'' * v'`); + (EXISTS_TAC `u'' * w + v'' * w'`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH + `(a * x + b * x') + (a * y + b * y') + (a * z + b * z') = + a * (x + y + z) + b * (x' + y' + z')`]); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 58 *) +let SUM_CLAUSES_alt = prove (`(!x f s. + FINITE s + ==> sum (x INSERT s) f = + (if x IN s then sum s f else f x + sum s f))`, REWRITE_TAC[SUM_CLAUSES]);; + +let SUM_DIS4 = prove_by_refinement ( + `!x:A y z t f. CARD {x,y, z, t} = 4 + ==> sum {x,y,z,t} f = f x + f y + f z + f t`, +[(REPEAT STRIP_TAC); + (REWRITE_WITH `sum {x,y, z, t} f = + (if x IN {y, z, t:A} then sum {y, z, t} f + else f x + sum {y, z, t} f)`); + (MATCH_MP_TAC SUM_CLAUSES_alt); + (REWRITE_TAC[Geomdetail.FINITE6]);(COND_CASES_TAC);(NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC + [SET_RULE `x IN {a,b,c} <=> x = a \/ x = b \/ x = c`]); + (REPEAT STRIP_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC + [SET_RULE `{y,y,z,t} = {y,z,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {y, z, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC + [SET_RULE `{z,y,z,t} = {y,z,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {y, z, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC + [SET_RULE `{t,y,z,t} = {y,z,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {y, z, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (REWRITE_WITH `sum {y, z, t} f = + (if y IN {z, t:A} then sum {z, t} f + else f y + sum {z, t} f)`); + (MATCH_MP_TAC SUM_CLAUSES_alt); + (REWRITE_TAC[Geomdetail.FINITE6]); + SWITCH_TAC; + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[SET_RULE `x IN {a,b} <=> x = a \/ x = b`]); + (REPEAT STRIP_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[SET_RULE `{x,z,z,t} = {x,z,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {x, z, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[SET_RULE `{x,t,z,t} = {x,z,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {x, z, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + SWITCH_TAC; + (REWRITE_WITH `sum {z, t:A} f = f z + f t`); + (MATCH_MP_TAC Collect_geom.SUM_DIS2 THEN STRIP_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[SET_RULE `{x,y,t,t} = {x,y,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {x, y, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 59 *) +let CARD4_IMP_DISTINCT = prove ( + `!a b c d. CARD {a, b, c, d} = 4 ==> ~(a = b)`, + (REPEAT STRIP_TAC THEN SWITCH_TAC THEN UP_ASM_TAC THEN + ASM_REWRITE_TAC[SET_RULE `{a,a,c,d} = {a,c,d}`] THEN STRIP_TAC) THEN + (ASM_MESON_TAC[Geomdetail.CARD3; ARITH_RULE `~(4 <= 3)`]));; + +(* ======================================================================= *) +(* Lemma 60 *) +let VSUM_CLAUSES_alt = prove (`(!x f s. + FINITE s + ==> vsum (x INSERT s) f = + (if x IN s then vsum s f else f x + vsum s f))`, REWRITE_TAC[VSUM_CLAUSES]);; +let VSUM_DIS4 = prove_by_refinement ( + `!x:A y z t (f:A->real^N). CARD {x,y, z, t} = 4 + ==> vsum {x,y,z,t} f = f x + f y + f z + f t`, +[(REPEAT STRIP_TAC); + (REWRITE_WITH `vsum {x,y, z, t} (f:A->real^N) = + (if x IN {y, z, t:A} then vsum {y, z, t} f + else f x + vsum {y, z, t} f)`); + (MATCH_MP_TAC VSUM_CLAUSES_alt); + (REWRITE_TAC[Geomdetail.FINITE6]);(COND_CASES_TAC);(NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC + [SET_RULE `x IN {a,b,c} <=> x = a \/ x = b \/ x = c`]); + (REPEAT STRIP_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC + [SET_RULE `{y,y,z,t} = {y,z,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {y, z, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC + [SET_RULE `{z,y,z,t} = {y,z,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {y, z, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC + [SET_RULE `{t,y,z,t} = {y,z,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {y, z, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (REWRITE_WITH `vsum {y, z, t} (f:A->real^N) = + (if y IN {z, t:A} then vsum {z, t} f + else f y + vsum {z, t} f)`); + (MATCH_MP_TAC VSUM_CLAUSES_alt); + (REWRITE_TAC[Geomdetail.FINITE6]); + SWITCH_TAC; + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[SET_RULE `x IN {a,b} <=> x = a \/ x = b`]); + (REPEAT STRIP_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[SET_RULE `{x,z,z,t} = {x,z,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {x, z, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[SET_RULE `{x,t,z,t} = {x,z,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {x, z, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + SWITCH_TAC; + (REWRITE_WITH `vsum {z, t:A} (f:A->real^N) = f z + f t`); + (MATCH_MP_TAC Collect_geom.VSUM_DIS2 THEN STRIP_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[SET_RULE `{x,y,t,t} = {x,y,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {x, y, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 61 *) +let AFFINE_DEPENDENT_KY_LEMMA1 = prove_by_refinement ( + `!a:real^3 b c d p:real^3 k1 k2 k3 k4. + ~(affine_dependent {a,b,c,d}) /\ + CARD {a,b,c,d} = 4 /\ + p IN convex hull {a,b,c,d} /\ + k1 + k2 + k3 + k4 = &1 /\ + p = k1 % a + k2 % b + k3 % c + k4 % d /\ + k1 <= &0 ==> k1 = &0`, +[(REPEAT GEN_TAC); + (REWRITE_TAC[CONVEX_HULL_4; IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `k1 = &0`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (NEW_GOAL `affine_dependent {a,b,c,d:real^3}`); + (REWRITE_TAC[AFFINE_DEPENDENT_EXPLICIT]); + (EXISTS_TAC `{a,b,c,d:real^3}`); + (ABBREV_TAC `f = (\x:real^3. if x = a then u - k1 else + if x = b then v - k2 else + if x = c then w - k3 else + if x = d then z - k4 else &0)`); + (EXISTS_TAC `f:real^3->real`); + + (NEW_GOAL `f (a:real^3) = u - k1`); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `f (b:real^3) = v - k2`); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (NEW_GOAL `F` THEN UP_ASM_TAC THEN REWRITE_TAC[]); + (MATCH_MP_TAC CARD4_IMP_DISTINCT); + (EXISTS_TAC `c:real^3` THEN EXISTS_TAC `d:real^3`); + (ASM_REWRITE_TAC[SET_RULE `{a,b,c,d} = {b,a,c,d}`]); + (COND_CASES_TAC); + (REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `f (c:real^3) = w - k3`); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (NEW_GOAL `F` THEN UP_ASM_TAC THEN REWRITE_TAC[]); + (MATCH_MP_TAC CARD4_IMP_DISTINCT); + (EXISTS_TAC `b:real^3` THEN EXISTS_TAC `d:real^3`); + (ASM_REWRITE_TAC[SET_RULE `{c,a,b,d} = {a,b,c,d}`]); + (COND_CASES_TAC); + (NEW_GOAL `F` THEN UP_ASM_TAC THEN REWRITE_TAC[]); + (MATCH_MP_TAC CARD4_IMP_DISTINCT); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `d:real^3`); + (ASM_REWRITE_TAC[SET_RULE `{c,b,a,d} = {a,b,c,d}`]); + (COND_CASES_TAC); + (REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `f (d:real^3) = z - k4`); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (NEW_GOAL `F` THEN UP_ASM_TAC THEN REWRITE_TAC[]); + (MATCH_MP_TAC CARD4_IMP_DISTINCT); + (EXISTS_TAC `c:real^3` THEN EXISTS_TAC `b:real^3`); + (ASM_REWRITE_TAC[SET_RULE `{d,a,c, b} = {a,b,c,d}`]); + (COND_CASES_TAC); + (NEW_GOAL `F` THEN UP_ASM_TAC THEN REWRITE_TAC[]); + (MATCH_MP_TAC CARD4_IMP_DISTINCT); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `c:real^3`); + (ASM_REWRITE_TAC[SET_RULE `{d,b,a,c} = {a,b,c,d}`]); + (COND_CASES_TAC); + (NEW_GOAL `F` THEN UP_ASM_TAC THEN REWRITE_TAC[]); + (MATCH_MP_TAC CARD4_IMP_DISTINCT); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `b:real^3`); + (ASM_REWRITE_TAC[SET_RULE `{d,c,a,b} = {a,b,c,d}`]); + (COND_CASES_TAC); + (REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (REPEAT STRIP_TAC); + (REWRITE_TAC[Geomdetail.FINITE6]); + (SET_TAC[]); + + (REWRITE_WITH `sum {a, b, c, d:real^3} f = f a + f b + f c + f d`); + (MATCH_MP_TAC SUM_DIS4); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH + `a - x + b - y + c - z + d - t = (a + b + c + d) - (x + y + z + t)`]); + (ASM_REWRITE_TAC[REAL_SUB_REFL]); + (EXISTS_TAC `a:real^3`); + (STRIP_TAC); + (SET_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (REWRITE_WITH `vsum {a, b, c, d:real^3} (\v. f v % v) = + (\v. f v % v) a + (\v. f v % v) b + (\v. f v % v) c + (\v. f v % v) d`); + (MATCH_MP_TAC VSUM_DIS4); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_ARITH ` + (u - k1) % a + (v - k2) % b + (w - k3) % c + (z - k4) % d = + (u % a + v % b + w % c + z % d) - (k1 % a + k2 % b + k3 % c + k4 % d)`]); + (ASM_MESON_TAC[VECTOR_ARITH `a:real^N - a = vec 0`]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 62 *) +let IN_2_2_IMP_CONVEX_HULL_4 = prove ( + `!a:real^N b x y m n p. + between p (m,n) /\ between m (a,b) /\ between n (x,y) + ==> p IN convex hull {a, b, x, y}`, + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;CONVEX_HULL_4; + IN;IN_ELIM_THM] THEN REPEAT STRIP_TAC) THEN + (ASM_REWRITE_TAC[]) THEN + (EXISTS_TAC `u * u'` THEN EXISTS_TAC `u * v'`) THEN + (EXISTS_TAC `v * u''` THEN EXISTS_TAC `v * v''`) THEN + (ASM_SIMP_TAC[REAL_LE_MUL; REAL_ARITH `a * x + a * y + b * z + b * t = + a * (x + y) + b * (z + t)`; REAL_MUL_RID]) THEN + (VECTOR_ARITH_TAC));; + +(* ======================================================================= *) +(* Lemma 63 *) +let BETWEEN_TRANS_3_CASES = prove_by_refinement ( + `!a b x y:real^3. between x (a,b) /\ between y (a,b) ==> + between x (a, y) \/ between x (y, b) `, +[(REPEAT STRIP_TAC); + (ASM_CASES_TAC `(a = b:real^3)`); + (UNDISCH_TAC `between x (a,b:real^3)`); + (UNDISCH_TAC `between y (a,b:real^3)`); + (ASM_REWRITE_TAC[BETWEEN_REFL_EQ]); + (REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[BETWEEN_REFL_EQ]); + + (ASM_CASES_TAC `between x (a,y:real^3)`); + (ASM_MESON_TAC[]); + (DISJ2_TAC); + (ONCE_REWRITE_TAC[BETWEEN_SYM]); + (MATCH_MP_TAC BETWEEN_TRANS_2); + (EXISTS_TAC `a:real^3` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `collinear {a,y,x:real^3}`); + (ONCE_REWRITE_TAC[SET_RULE `{a,y,x} = {x, a ,y}`]); + (MATCH_MP_TAC COLLINEAR_3_TRANS); + (EXISTS_TAC `b:real^3`); + (REPEAT STRIP_TAC); + (ONCE_REWRITE_TAC[SET_RULE `{x,a, b} = {a, x, b}`]); + (MATCH_MP_TAC BETWEEN_IMP_COLLINEAR); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a, b,y} = {a, y, b}`]); + (MATCH_MP_TAC BETWEEN_IMP_COLLINEAR); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[COLLINEAR_BETWEEN_CASES]); + + (ASM_CASES_TAC `between y (x,a:real^3)`); + (STRIP_TAC THEN ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[MESON[] `(A\/B\/C ==> B) <=> (C\/A ==> B)`]); + (REPEAT STRIP_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `x = y:real^3`); + (REWRITE_TAC[ASSUME `x = y:real^3`; BETWEEN_REFL]); + + (NEW_GOAL `F`); + (UNDISCH_TAC `between x (a,b:real^3)` THEN + UNDISCH_TAC `between y (a,b:real^3)` THEN + UNDISCH_TAC `between a (y,x:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (MP_TAC (ASSUME `a = u % y + v % x:real^3`)); + (REWRITE_TAC[ASSUME `y = u' % a + v' % b:real^3`; + ASSUME `x = u'' % a + v'' % b:real^3`]); + + (REWRITE_WITH `v' = &1 - u' /\ v = &1 - u /\ v'' = &1 - u''`); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC [VECTOR_ARITH ` + a = u % (u' % a + (&1 - u') % b) + (&1 - u) % (u'' % a + (&1 - u'') % b) + <=> (&1 - u * u' - (&1 - u) * u'') % (a - b) = vec 0`]); + (REWRITE_TAC[VECTOR_MUL_EQ_0]); + (ASM_REWRITE_TAC[VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (REWRITE_TAC[REAL_ARITH + `&1 - u * u' - (&1 - u) * u'' = u * (&1 - u') + (&1 - u) * (&1 - u'')`]); + (NEW_GOAL `&0 <= u * (&1 - u')`); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `&0 <= (&1 - u) * (&1 - u'')`); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (STRIP_TAC); + (NEW_GOAL `u * (&1 - u') = &0 /\ (&1 - u) * (&1 - u'') = &0`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ENTIRE]); + (REPEAT STRIP_TAC); + (ASM_REAL_ARITH_TAC); + + (UNDISCH_TAC `~between x (a,y:real^3)`); + (REWRITE_TAC[ASSUME `x = u'' % a + v'' % b:real^3`]); + (REWRITE_WITH `u'' = &1 /\ v'' = &0`); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO;VECTOR_ADD_RID; BETWEEN_REFL]); + + (UNDISCH_TAC `~between y (x,a:real^3)`); + (REWRITE_TAC[ASSUME `y = u' % a + v' % b:real^3`]); + (REWRITE_WITH `u' = &1 /\ v' = &0`); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO;VECTOR_ADD_RID; BETWEEN_REFL]); + + (UNDISCH_TAC `~between y (x,a:real^3)`); + (REWRITE_TAC[ASSUME `y = u' % a + v' % b:real^3`]); + (REWRITE_WITH `u' = &1 /\ v' = &0`); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO;VECTOR_ADD_RID; BETWEEN_REFL]); + (ASM_MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 64 *) + +let OMEGA_LIST_UP_TO_2 = prove_by_refinement ( + `! V ul. {omega_list_n V ul i | i <= 2} = + {omega_list_n V ul 0, omega_list_n V ul 1, omega_list_n V ul 2}`, +[(REPEAT GEN_TAC); + (REWRITE_WITH `{omega_list_n V ul i | i <= 2} = + IMAGE (omega_list_n V ul) {i| i <= 2}`); + (REWRITE_TAC[IMAGE] THEN SET_TAC[]); + (REWRITE_WITH ` + {omega_list_n V ul 0, omega_list_n V ul 1, omega_list_n V ul 2} + = IMAGE (omega_list_n V ul) {0,1,2}`); + (REWRITE_TAC[IMAGE] THEN SET_TAC[]); + (AP_TERM_TAC); + (REWRITE_TAC[SET_OF_0_TO_2])]);; + +(* ======================================================================= *) +(* Lemma 65 *) +let CONVEX_HULL_KY_LEMMA_5 = prove_by_refinement ( + `!a:real^3 b c d x y d p. + ~(affine_dependent {a,b,c,d}) /\ CARD {a,b,c,d} = 4 /\ ~(d = x) /\ + x IN convex hull {a,b,c} /\ between d (x,y) /\ + ~( p IN affine hull {a,b,d}) /\ + p IN convex hull {a,b,c,d} INTER convex hull {a,b,x,y} ==> + p IN convex hull {a,b,x,d}`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `p IN convex hull {a, b, x, y:real^3}`); + (ASM_SET_TAC[IN_INTER]); + (SUBGOAL_THEN `?m n:real^3. + between p (m,n) /\ between m (a,b) /\ between n (x,y)` CHOOSE_TAC); + (ASM_SIMP_TAC[CONVEX_HULL_4_IMP_2_2]); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + + (ASM_CASES_TAC `between n (x, d:real^3)`); + (MATCH_MP_TAC IN_2_2_IMP_CONVEX_HULL_4); + (EXISTS_TAC `m:real^3` THEN EXISTS_TAC `n:real^3`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `between n (x,d) \/ between n (d, y:real^3)`); + (MATCH_MP_TAC BETWEEN_TRANS_3_CASES); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `between n (d,y:real^3)`); + (ASM_MESON_TAC[]); + + (NEW_GOAL `?k1 k2. n = k1 % d + k2 % x:real^3 /\ k1 + k2 = &1 /\ k2 <= &0`); + (UP_ASM_TAC THEN UNDISCH_TAC `between d (x,y:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;IN;IN_ELIM_THM;CONVEX_HULL_2]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `u' + (v'/ v)`); + (EXISTS_TAC `-- ((u * v')/ v)`); + (REPEAT STRIP_TAC); + + (REWRITE_TAC[VECTOR_ARITH + `u' % (u % x + v % y) + v' % y = + (u' + v' / v) % (u % x + v % y) + --((u * v') / v) % x + <=> ((v /v - &1) * v') % y = vec 0`]); + (REWRITE_WITH `v / v = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (STRIP_TAC); + (NEW_GOAL `d = x:real^3`); + (REWRITE_TAC[ASSUME `d = u % x + v % y:real^3`]); + (REWRITE_WITH `v = &0 /\ u = &1`); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (ASM_MESON_TAC[]); + (VECTOR_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH `(u' + v' / v) + --((u * v') / v) = + u' + v' * ((&1 - u) / v)`]); + (REWRITE_WITH `(&1 - u) / v = &1`); + (REWRITE_WITH `&1 - u = v`); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_DIV_REFL); + (STRIP_TAC); + (NEW_GOAL `d = x:real^3`); + (REWRITE_TAC[ASSUME `d = u % x + v % y:real^3`]); + (REWRITE_WITH `v = &0 /\ u = &1`); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `-- a <= &0 <=> &0 <= a`]); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_SIMP_TAC[REAL_LE_MUL]); + (FIRST_X_ASSUM CHOOSE_TAC THEN FIRST_X_ASSUM CHOOSE_TAC); + + (UNDISCH_TAC `between p (m,n:real^3)`); + (UNDISCH_TAC `between m (a,b:real^3)`); + (UNDISCH_TAC `x IN convex hull {a,b,c:real^3}`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2; + CONVEX_HULL_3;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[VECTOR_ADD_LDISTRIB;VECTOR_MUL_ASSOC]); + (REWRITE_TAC[VECTOR_ARITH + `(x % a + y % b) + z % d + x' % a + y' % b + z' % c = + z' % c + (x + x') % a + (y + y') % b + z % d`]); + + (REPEAT STRIP_TAC); + + (NEW_GOAL `v'' * k2 * w = &0`); + (MATCH_MP_TAC AFFINE_DEPENDENT_KY_LEMMA1); + (EXISTS_TAC `c:real^3` THEN EXISTS_TAC `a:real^3`); + (EXISTS_TAC `b:real^3` THEN EXISTS_TAC `d:real^3`); + (EXISTS_TAC `p:real^3`); + (EXISTS_TAC `u'' * u' + v'' * k2 * u` THEN + EXISTS_TAC `u'' * v' + v'' * k2 * v` THEN + EXISTS_TAC `v'' * k1`); + (STRIP_TAC); + (ONCE_REWRITE_TAC[SET_RULE `{c,a,b,d} = {a,b,c,d}`]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ONCE_REWRITE_TAC[SET_RULE `{c,a,b,d} = {a,b,c,d}`]); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{c,a,b,d} = {a,b,c,d}`]); + (ASM_SET_TAC[IN_INTER]); + (REWRITE_TAC[REAL_ARITH + `v'' * k2 * w + (u'' * u' + v'' * k2 * u) + + (u'' * v' + v'' * k2 * v) + v'' * k1 + = u'' * (u' + v') + v'' * (k1 + k2 * (u + v + w))`]); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `a * b * c <= &0 <=> &0 <= a * (-- b) * c`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `p IN affine hull {a,b,d:real^3}`); + (REWRITE_TAC[AFFINE_HULL_3;IN;IN_ELIM_THM]); + (EXISTS_TAC `u'' * u' + v'' * k2 * u` THEN + EXISTS_TAC `u'' * v' + v'' * k2 * v` THEN + EXISTS_TAC `v'' * k1`); + (STRIP_TAC); + (REWRITE_WITH `(u'' * u' + v'' * k2 * u) + (u'' * v' + v'' * k2 * v) + + v'' * k1 = u'' * (u' + v') + v'' * (k1 + k2 * (u + v + w)) - (v'' * k2 * w)`); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 66 *) +(* ======================================================================= *) + + +end;; + diff --git a/legacy/oldpacking/packing/development/sum_beta_bump.hl b/legacy/oldpacking/packing/development/sum_beta_bump.hl new file mode 100755 index 0000000..3e5a229 --- /dev/null +++ b/legacy/oldpacking/packing/development/sum_beta_bump.hl @@ -0,0 +1,2857 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: *) +(* Chaper : Packing (Cells cluster) *) +(* *) +(* ------------------ The lemma about sum of beta_bump --------------------- *) +(* ========================================================================= *) + +(* ========================================================================= *) +(* Checkpointed files *) +(* ========================================================================= *) +(* + +loads "/home/vu/flyspeck/working/marchal_cells_3.hl";; +flyspeck_needs "packing/UPFZBZM_support_lemmas.hl";; +open Upfzbzm_support_lemmas;; +flyspeck_needs "packing/LEPJBDJ.hl";; +open Lepjbdj;; + +*) + +(* ========================================================================== *) +(* Begin the proof *) +(* ========================================================================== *) + +module Sum_beta_bump = struct + +open Rogers;; +open Vukhacky_tactics;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Sphere;; +open Marchal_cells;; +open Emnwuus;; +open Marchal_cells_2_new;; +open Lepjbdj;; +open Upfzbzm_support_lemmas;; + +let SUM_BETA_BUMP_LEMMA = prove_by_refinement ( + `!V X. saturated V /\ packing V /\ mcell_set V X ==> + sum {e | e IN critical_edgeX V X } (\e. beta_bump V e X) = &0`, + +[(REPEAT STRIP_TAC THEN UP_ASM_TAC); + (ASM_CASES_TAC `~(X:real^3->bool = {})`); + (REWRITE_TAC[mcell_set; IN_ELIM_THM]); + (STRIP_TAC); + (NEW_GOAL `barV V 3 ul`); + (ASM_SET_TAC[IN]); + + (ASM_CASES_TAC `i < 4`); (* consider case i < 4 va i >= 4 *) + (NEW_GOAL `~(i = 4)`); + (ASM_ARITH_TAC); + (NEW_GOAL `i <= 4`); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[beta_bump]); + (REPEAT LET_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[cell_params]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (STRIP_TAC); + (ABBREV_TAC `P = (\(k,ul'). k <= 4 /\ ul' IN barV V 3 /\ + mcell i V ul = mcell k V ul')`); + (NEW_GOAL `(P:(num#(real^3)list->bool)) (k,ul')`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(i:num,ul:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (ASM_REWRITE_TAC[IN]); + (UP_ASM_TAC THEN EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM] THEN STRIP_TAC); + (NEW_GOAL `barV V 3 ul'`); + (ASM_SET_TAC[]); + + (NEW_GOAL `i = k:num`); + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `?v0 v1 v2 v3. ul' = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REPEAT STRIP_TAC); + + (ASM_CASES_TAC `i = 0`); + (NEW_GOAL `V INTER mcell i V ul = {} `); + (REWRITE_TAC[ASSUME `i = 0`]); + (MATCH_MP_TAC LEPJBDJ_0); + (ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]); + (ASM_CASES_TAC `k = 0`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `V INTER mcell k V ul' + = set_of_list (truncate_simplex (k - 1) ul')`); + (MATCH_MP_TAC LEPJBDJ); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `k = 1`); + (ASM_REWRITE_TAC[ARITH_RULE `1 - 1 = 0`; TRUNCATE_SIMPLEX_EXPLICIT_0; set_of_list]); + (ASM_SET_TAC[]); + (ASM_CASES_TAC `k = 2`); + (ASM_REWRITE_TAC[ARITH_RULE `2 - 1 = 1`; TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list]); + (ASM_SET_TAC[]); + (ASM_CASES_TAC `k = 3`); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (ASM_SET_TAC[]); + (ASM_CASES_TAC `k = 4`); + (ASM_REWRITE_TAC[ARITH_RULE `4 - 1 = 3`; TRUNCATE_SIMPLEX_EXPLICIT_3; set_of_list]); + (ASM_SET_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); (* Finish the case i = 0 *) + + (NEW_GOAL `V INTER mcell i V ul + = set_of_list (truncate_simplex (i - 1) ul)`); + (MATCH_MP_TAC LEPJBDJ); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `k = 0`); + (NEW_GOAL `V INTER mcell k V ul' = {}`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC LEPJBDJ_0); + (ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]); + (NEW_GOAL `F`); + (NEW_GOAL + `~(set_of_list (truncate_simplex (i - 1) (ul:(real^3)list)) = {})`); + (ASM_CASES_TAC `i = 1`); + (ASM_REWRITE_TAC[ARITH_RULE `1 - 1 = 0`; TRUNCATE_SIMPLEX_EXPLICIT_0; set_of_list]); + (SET_TAC[]); + (ASM_CASES_TAC `i = 2`); + (ASM_REWRITE_TAC[ARITH_RULE `2 - 1 = 1`; TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list]); + (SET_TAC[]); + (ASM_CASES_TAC `i = 3`); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (SET_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `V INTER mcell k V ul' + = set_of_list (truncate_simplex (k - 1) ul')`); + (MATCH_MP_TAC LEPJBDJ); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `CARD (set_of_list (truncate_simplex (i - 1) (ul:(real^3)list))) + = i:num`); + (REWRITE_WITH + `LENGTH (truncate_simplex (i - 1) (ul:(real^3)list)) = (i - 1) + 1 /\ + CARD (set_of_list (truncate_simplex (i - 1) ul)) = (i - 1) + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + + (NEW_GOAL `CARD (set_of_list (truncate_simplex (k - 1) (ul':(real^3)list))) + = k:num`); + (REWRITE_WITH + `LENGTH (truncate_simplex (k - 1) (ul':(real^3)list)) = (k - 1) + 1 /\ + CARD (set_of_list (truncate_simplex (k - 1) ul')) = (k - 1) + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (REWRITE_TAC[REAL_ARITH `&0 = a <=> a = &0`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `!e. sum + {e',e'',p,vl | k = 4 /\ critical_edgeX V (mcell k V ul') = {e', e''} /\ + e = e' /\ p permutes 0..3 /\ vl = left_action_list p ul' /\ + e' = {EL 0 vl, EL 1 vl} /\ e'' = {EL 2 vl, EL 3 vl}} + (\(e',e'',p,vl). + (bump (hl [EL 0 vl; EL 1 vl]) - bump (hl [EL 2 vl; EL 3 vl])) / &4) + = &0`); + GEN_TAC; + (ABBREV_TAC `SET1 = {e',e'',p,vl | k = 4 /\ + critical_edgeX V (mcell k V ul') = {e', e''} /\ + e = e' /\ p permutes 0..3 /\ + vl = left_action_list p ul' /\ + e' = {EL 0 vl, EL 1 vl} /\ + e'' = {EL 2 vl, EL 3 vl}}`); + (NEW_GOAL + `SET1:(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list->bool = {}`); + (EXPAND_TAC "SET1"); + (NEW_GOAL `~(k = 4)`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC); + (SET_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[SUM_CLAUSES]); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[SUM_0]); + +(* Finish the case where i < 4 *) +(* ========================================================================= *) +(* begin with the case i >= 4 *) + + (ASM_REWRITE_TAC[beta_bump]); + (REPEAT LET_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[cell_params]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (STRIP_TAC); + (ABBREV_TAC `P = (\(k,ul'). k <= 4 /\ ul' IN barV V 3 /\ + mcell i V ul = mcell k V ul')`); + (NEW_GOAL `(P:(num#(real^3)list->bool)) (k,ul')`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(4,ul:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (ASM_REWRITE_TAC[IN; ARITH_RULE `4 <= 4`]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `~(i < 4) ==> i >= 4`; + ARITH_RULE `4 >= 4`; mcell4]); + (UP_ASM_TAC THEN EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM] THEN STRIP_TAC); + (NEW_GOAL `barV V 3 ul'`); + (ASM_SET_TAC[]); + (REWRITE_TAC[REAL_ARITH `&0 = a <=> a = &0`]); + + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `?v0 v1 v2 v3. ul' = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REPEAT STRIP_TAC); + (NEW_GOAL `mcell i V ul = mcell 4 V ul`); + (UNDISCH_TAC `mcell i V ul = mcell k V ul'` THEN DISCH_TAC THEN DEL_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `~(i < 4) ==> i >= 4`; + ARITH_RULE `4 >= 4`; mcell4]); + + (NEW_GOAL `k = 4:num`); + + (NEW_GOAL `V INTER mcell 4 V ul = + set_of_list (truncate_simplex 3 ul)`); + (REWRITE_TAC[ARITH_RULE `3 = 4 - 1`]); + (MATCH_MP_TAC LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 4 /\ 4 <= 4`]); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `k = 0`); + (NEW_GOAL `V INTER mcell k V ul' = {}`); + (REWRITE_TAC[ASSUME `k = 0`]); + (MATCH_MP_TAC LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (UNDISCH_TAC `V INTER mcell 4 V ul = set_of_list (truncate_simplex 3 ul)`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3; set_of_list]); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + +(* ============================= *) + + (NEW_GOAL `V INTER mcell k V ul' = + set_of_list (truncate_simplex (k - 1) ul')`); + (MATCH_MP_TAC LEPJBDJ); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_SET_TAC[]); + + (NEW_GOAL `set_of_list (truncate_simplex 3 (ul:(real^3)list)) = + set_of_list (truncate_simplex (k - 1) ul')`); + (ASM_SET_TAC[]); + (NEW_GOAL `CARD {u0,u1,u2,u3:real^3} = 4`); + (REWRITE_WITH `{u0,u1,u2,u3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (ASM_CASES_TAC `k = 1`); + (NEW_GOAL `F`); + (UNDISCH_TAC `set_of_list (truncate_simplex 3 (ul:(real^3)list)) = + set_of_list (truncate_simplex (k - 1) ul')`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3; ARITH_RULE `1 - 1 = 0`; + TRUNCATE_SIMPLEX_EXPLICIT_0; set_of_list]); + (STRIP_TAC); + (NEW_GOAL `CARD {v0:real^3} = 4`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[Geomdetail.CARD_SING]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `k = 2`); + (NEW_GOAL `F`); + (UNDISCH_TAC `set_of_list (truncate_simplex 3 (ul:(real^3)list)) = + set_of_list (truncate_simplex (k - 1) ul')`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3; ARITH_RULE `2 - 1 = 1`; + TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list]); + (STRIP_TAC); + (NEW_GOAL `CARD {v0, v1:real^3} = 4`); + (ASM_MESON_TAC[]); + (NEW_GOAL `CARD {v0, v1:real^3} <= 2`); + (MESON_TAC[Geomdetail.CARD2]); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `k = 3`); + (NEW_GOAL `F`); + (UNDISCH_TAC `set_of_list (truncate_simplex 3 (ul:(real^3)list)) = + set_of_list (truncate_simplex (k - 1) ul')`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3; ARITH_RULE `3 - 1 = 2`; + TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (STRIP_TAC); + (NEW_GOAL `CARD {v0, v1, v2:real^3} = 4`); + (ASM_MESON_TAC[]); + (NEW_GOAL `CARD {v0, v1, v2:real^3} <= 3`); + (MESON_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (ASM_ARITH_TAC); (* concluded that k = 4 now *) + +(* ======================================================================== *) + + + (REWRITE_TAC[ASSUME `mcell i V ul = mcell k V ul'`; ASSUME `k = 4`]); + (ASM_CASES_TAC `~(CARD (critical_edgeX V (mcell 4 V ul')) = 2)`); + (MATCH_MP_TAC SUM_EQ_0); + (REPEAT STRIP_TAC); + (ABBREV_TAC `y = {v0,v1,v2,v3:real^3} DIFF x`); + (ASM_CASES_TAC `~(critical_edgeX V (mcell 4 V ul') = {x, y})`); + (REWRITE_WITH + `{e',e'',p,vl | critical_edgeX V (mcell 4 V ul') = {e', e''} /\ + x = e' /\ + p permutes 0..3 /\ + vl = left_action_list p ul' /\ + e' = {EL 0 vl, EL 1 vl} /\ + e'' = {EL 2 vl, EL 3 vl}} = {}`); + (REWRITE_TAC[SET_RULE `a = {} <=> (!t. t IN a ==> F)`]); + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (NEW_GOAL `y = e'':real^3->bool`); + (ONCE_ASM_REWRITE_TAC[] THEN EXPAND_TAC "y"); + (REWRITE_TAC[ASSUME `x = e':real^3->bool`; + ASSUME `e':real^3->bool = {EL 0 vl, EL 1 vl}`]); + (REWRITE_WITH `{v0, v1, v2, v3:real^3} = set_of_list (ul')`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `set_of_list (ul':(real^3)list) = set_of_list vl`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN REWRITE_TAC[ASSUME + `vl:(real^3)list = left_action_list p ul'`]); + (MATCH_MP_TAC Packing3.SET_OF_LIST_LEFT_ACTION_LIST); + (ASM_REWRITE_TAC[LENGTH;ARITH_RULE `SUC (SUC (SUC (SUC 0))) - 1 = 3`]); + + (NEW_GOAL `vl:(real^3)list = [EL 0 vl; EL 1 vl; EL 2 vl; EL 3 vl]`); + (ASM_REWRITE_TAC[TABLE_4; left_action_list; LENGTH; EL; HD; TL; + ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4 /\ 1 = SUC 0 /\ 2 = SUC 1/\ 3 = SUC 2`]); + (ABBREV_TAC `w0:real^3 = EL 0 vl`); + (ABBREV_TAC `w1:real^3 = EL 1 vl`); + (ABBREV_TAC `w2:real^3 = EL 2 vl`); + (ABBREV_TAC `w3:real^3 = EL 3 vl`); + (REWRITE_TAC[ASSUME `vl = [w0;w1;w2;w3:real^3]`; set_of_list]); + (REWRITE_WITH `{w0,w1,w2,w3} = {w0,w1} UNION {w2,w3:real^3}`); + (SET_TAC[]); + (MATCH_MP_TAC (SET_RULE `DISJOINT a b ==> ((a UNION b) DIFF a = b)`)); + + (REWRITE_TAC[DISJOINT; INTER]); + (NEW_GOAL `CARD {w0, w1, w2 , w3:real^3} = 4`); + (REWRITE_WITH `{w0, w1, w2 , w3:real^3} = set_of_list vl`); + (REWRITE_TAC[ASSUME `vl = [w0; w1; w2; w3:real^3]`; set_of_list]); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_WITH `set_of_list (left_action_list p ul') + = set_of_list (ul':(real^3)list)`); + (MATCH_MP_TAC Packing3.SET_OF_LIST_LEFT_ACTION_LIST); + (ASM_REWRITE_TAC[LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) - 1 = 3`]); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (REWRITE_TAC[SET_RULE `x IN {a,b} <=> x = a \/ x = b`]); + (REWRITE_TAC[SET_RULE `x = {} <=> (!z. z IN x ==> F)`]); + (REWRITE_TAC[IN;IN_ELIM_THM] THEN STRIP_TAC); + (REPEAT STRIP_TAC); + + (NEW_GOAL `CARD {w0, w1, w2, w3:real^3} <= 3`); + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = {w1, w2, w3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {w0, w1, w2, w3:real^3} <= 3`); + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = {w1, w2, w3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {w0, w1, w2, w3:real^3} <= 3`); + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = {w0, w2, w3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {w0, w1, w2, w3:real^3} <= 3`); + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = {w0, w2, w3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + + (UNDISCH_TAC `~(critical_edgeX V (mcell 4 V ul') = {x, y})`); + (REWRITE_TAC[ASSUME `x = e':real^3->bool`; ASSUME `y = e'':real^3->bool`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[SUM_CLAUSES]); + (UP_ASM_TAC THEN REWRITE_TAC[MESON[] `~ ~ a <=> a`] THEN STRIP_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~(CARD (critical_edgeX V (mcell 4 V ul')) = 2)`); + (REWRITE_TAC[ASSUME `critical_edgeX V (mcell 4 V ul') = {x, y}`]); + (REWRITE_TAC[Geomdetail.CARD_SET2]); + (EXPAND_TAC "y"); + (STRIP_TAC); + (NEW_GOAL `{v0, v1,v2,v3:real^3} = {}`); + (MATCH_MP_TAC (SET_RULE `!s:real^3->bool. x = s DIFF x ==> s = {}`)); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + + (UP_ASM_TAC THEN REWRITE_TAC[MESON[] `~ ~ a <=> a`] THEN STRIP_TAC); + (NEW_GOAL `?x y. critical_edgeX V (mcell 4 V ul') = {x, y} /\ ~(x = y)`); + (MATCH_MP_TAC Rogers.CARD_2_IMP_DOUBLE); + (ASM_REWRITE_TAC[FINITE_critical_edgeX]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[SET_RULE `{x | x IN s} = s`; + ASSUME `critical_edgeX V (mcell 4 V ul') = {x, y}`]); + (ASM_SIMP_TAC[Collect_geom.SUM_DIS2]); + + + (REWRITE_WITH + `{e',e'',p,vl | {x, y} = {e', e''} /\ + x = e' /\ + p permutes 0..3 /\ + vl = left_action_list p [v0; v1; v2; v3:real^3] /\ + e' = {EL 0 vl, EL 1 vl} /\ + e'' = {EL 2 vl, EL 3 vl}} = + {e',e'',p,vl | e' = x /\ e'' = y /\ + p permutes 0..3 /\ + vl = left_action_list p [v0; v1; v2; v3] /\ + x = {EL 0 vl, EL 1 vl} /\ + y = {EL 2 vl, EL 3 vl}}`); + (ONCE_REWRITE_TAC[SET_RULE `a = b <=> b SUBSET a /\ a SUBSET b`]); + (STRIP_TAC); + + (REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `e':real^3->bool` THEN EXISTS_TAC `e'':real^3->bool`); + (EXISTS_TAC `p:num->num` THEN EXISTS_TAC `vl:(real^3)list`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `e':real^3->bool = x`; + ASSUME `x:real^3->bool = {EL 0 vl, EL 1 vl}`]); + (REWRITE_TAC[ASSUME `e'':real^3->bool = y`; + ASSUME `y:real^3->bool = {EL 2 vl, EL 3 vl}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `e':real^3->bool` THEN EXISTS_TAC `e'':real^3->bool`); + (EXISTS_TAC `p:num->num` THEN EXISTS_TAC `vl:(real^3)list`); + (NEW_GOAL `y = e'':(real^3->bool)`); + (ASM_SET_TAC[]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `x:real^3->bool = e'`; + ASSUME `e':real^3->bool = {EL 0 vl, EL 1 vl}`]); + (REWRITE_TAC[ASSUME `y:real^3->bool = e''`; + ASSUME `e'':real^3->bool = {EL 2 vl, EL 3 vl}`]); + (ASM_REWRITE_TAC[]); + + + (REWRITE_WITH + `{e',e'',p,vl | {x, y} = {e', e''} /\ + y = e' /\ + p permutes 0..3 /\ + vl = left_action_list p [v0; v1; v2; v3:real^3] /\ + e' = {EL 0 vl, EL 1 vl} /\ + e'' = {EL 2 vl, EL 3 vl}} = + {e',e'',p,vl | e' = y /\ e'' = x /\ + p permutes 0..3 /\ + vl = left_action_list p [v0; v1; v2; v3] /\ + y = {EL 0 vl, EL 1 vl} /\ + x = {EL 2 vl, EL 3 vl}}`); + (ONCE_REWRITE_TAC[SET_RULE `a = b <=> b SUBSET a /\ a SUBSET b`]); + (STRIP_TAC); + + (REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `e':real^3->bool` THEN EXISTS_TAC `e'':real^3->bool`); + (EXISTS_TAC `p:num->num` THEN EXISTS_TAC `vl:(real^3)list`); + (REPEAT STRIP_TAC); + + (REWRITE_TAC[ASSUME `e' = y:real^3->bool`; ASSUME `e'' = x:real^3->bool`]); + (SET_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `e':real^3->bool = y`; + ASSUME `y:real^3->bool = {EL 0 vl, EL 1 vl}`]); + (REWRITE_TAC[ASSUME `e'':real^3->bool = x`; + ASSUME `x:real^3->bool = {EL 2 vl, EL 3 vl}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `e':real^3->bool` THEN EXISTS_TAC `e'':real^3->bool`); + (EXISTS_TAC `p:num->num` THEN EXISTS_TAC `vl:(real^3)list`); + (NEW_GOAL `x = e'':(real^3->bool)`); + (ASM_SET_TAC[]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `y:real^3->bool = e'`; + ASSUME `e':real^3->bool = {EL 0 vl, EL 1 vl}`]); + (REWRITE_TAC[ASSUME `x:real^3->bool = e''`; + ASSUME `e'':real^3->bool = {EL 2 vl, EL 3 vl}`]); + (ASM_REWRITE_TAC[]); + + (ABBREV_TAC `S1 = {e',e'',p,vl | e' = x /\ + e'' = y /\ + p permutes 0..3 /\ + vl = left_action_list p [v0; v1; v2; v3:real^3] /\ + x = {EL 0 vl, EL 1 vl} /\ + y = {EL 2 vl, EL 3 vl}}`); + (ABBREV_TAC `S2 = {e',e'',p,vl | e' = y /\ + e'' = x /\ + p permutes 0..3 /\ + vl = left_action_list p [v0; v1; v2; v3:real^3] /\ + y = {EL 0 vl, EL 1 vl} /\ + x = {EL 2 vl, EL 3 vl}}`); + (REWRITE_WITH + `sum (S2:(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list->bool) + (\(e',e'',p,vl). (bump (hl [EL 0 vl; EL 1 vl]) - + bump (hl [EL 2 vl; EL 3 vl])) / &4) = + sum S2 (\(e',e'',p,vl). -- ((bump (hl [EL 2 vl; EL 3 vl]) - + bump (hl [EL 0 vl; EL 1 vl])) / &4))`); + (ONCE_REWRITE_TAC[REAL_ARITH `(bump (hl [EL 0 vl; EL 1 vl]) - + bump (hl [EL 2 vl; EL 3 vl])) / + &4 = -- ((bump (hl [EL 2 vl; EL 3 vl]) - + bump (hl [EL 0 vl; EL 1 vl])) / + &4)`]); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SUM_NEG]); + (ABBREV_TAC `f = (\(e':real^3->bool,e'':real^3->bool,p:num->num,vl:(real^3)list). + ((bump (hl [EL 2 vl; EL 3 vl]) - bump (hl [EL 0 vl; EL 1 vl])) / &4))`); + (REWRITE_WITH +`(\(e',e'',p,vl). + --((bump (hl [EL 2 vl; EL 3 vl]) -bump (hl [EL 0 vl; EL 1 vl])) / &4)) + = (\(e':real^3->bool,e'':real^3->bool,p:num->num,vl:(real^3)list). + -- f (e',e'',p,vl))`); + (EXPAND_TAC "f"); + (REWRITE_TAC[BETA_THM]); + + (REWRITE_WITH +`sum (S2:(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list->bool) (\(e':real^3->bool,e'':real^3->bool,p:num->num,vl:(real^3)list). + -- f (e',e'',p,vl)) = +sum S2 (\x. -- f x)`); + (AP_TERM_TAC); + (REWRITE_TAC[FUN_EQ_THM]); + (EXPAND_TAC "f"); + (REWRITE_TAC[BETA_THM]); + (REPEAT STRIP_TAC); + + (ABBREV_TAC `e' = FST (x': (real^3->bool)#(real^3->bool)#(num->num)#(real^3)list)`); + (ABBREV_TAC `e'' = FST (SND (x': (real^3->bool)#(real^3->bool)#(num->num)#(real^3)list))`); + (ABBREV_TAC `p = FST (SND (SND (x': (real^3->bool)#(real^3->bool)#(num->num)#(real^3)list)))`); + (ABBREV_TAC `vl = SND (SND (SND (x': (real^3->bool)#(real^3->bool)#(num->num)#(real^3)list)))`); + + (REWRITE_WITH `x':(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list = + (e',e'',p, vl)`); + (EXPAND_TAC "e'" THEN EXPAND_TAC "e''" THEN EXPAND_TAC "p" THEN EXPAND_TAC "vl"); + (REWRITE_TAC[PAIR]); + (REWRITE_TAC[SUM_NEG]); + (REWRITE_TAC[REAL_ARITH `a + -- b = &0 <=> a = b`]); + +(* --------------------------------------------------------------------------- *) +(* Begin new part *) + + (EXPAND_TAC "f"); + (ABBREV_TAC +`g = (\x. let (e':real^3->bool,e'':real^3->bool,p:num->num,vl:(real^3)list) = x + in + (e'', e', (\i. + if p i = 0 then 2 else + if p i = 1 then 3 else + if p i = 2 then 0 else + if p i = 3 then 1 else i), + [EL 2 vl;EL 3 vl;EL 0 vl;EL 1 vl]))`); + (REWRITE_WITH +`S1 = IMAGE + (g:(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list->(real^3->bool)# + (real^3->bool)#(num->num)#(real^3)list) S2 /\ + (\(e',e'',p,vl). (bump (hl [EL 2 vl; EL 3 vl]) - + bump (hl [EL 0 vl; EL 1 vl])) / &4) = + (\(e',e'',p,vl). (bump (hl [EL 0 vl; EL 1 vl]) - + bump (hl [EL 2 vl; EL 3 vl])) / &4) o g `); + +(* ======================================================================= *) + + (REPEAT STRIP_TAC); + (* New goal 1: to prove S1 = IMAGE g S2 *) + + (EXPAND_TAC "S1" THEN EXPAND_TAC "S2"); + (REWRITE_TAC[IMAGE]); + (ONCE_REWRITE_TAC[SET_EQ_LEMMA] THEN ONCE_REWRITE_TAC[IN] THEN + REWRITE_TAC[IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC + `(e'':real^3->bool, + e':real^3->bool, + (\i. if p i = 0 + then 2 + else if p i = 1 + then 3 + else if p i = 2 then 0 else if p i = 3 then 1 else i), + [EL 2 (vl:(real^3)list); EL 3 vl; EL 0 vl; EL 1 vl])`); + (REPEAT STRIP_TAC); + (EXISTS_TAC `e'':real^3->bool` THEN EXISTS_TAC `e':real^3->bool`); + (ABBREV_TAC `p' = (\i. if p i = 0 + then 2 + else if p i = 1 + then 3 + else if p i = 2 then 0 else if p i = 3 then 1 else i)`); + (EXISTS_TAC `p':num->num`); + (EXISTS_TAC `[EL 2 (vl:(real^3)list); EL 3 vl; EL 0 vl; EL 1 vl]`); + (REWRITE_WITH +`EL 0 [EL 2 vl; EL 3 vl; EL 0 vl; EL 1 vl] = EL 2 (vl:(real^3)list) /\ + EL 1 [EL 2 vl; EL 3 vl; EL 0 vl; EL 1 vl] = EL 3 vl /\ + EL 2 [EL 2 vl; EL 3 vl; EL 0 vl; EL 1 vl] = EL 0 vl /\ + EL 3 [EL 2 vl; EL 3 vl; EL 0 vl; EL 1 vl] = EL 1 vl`); + (REWRITE_TAC[EL; HD;TL;ARITH_RULE `1=SUC 0/\2=SUC 1/\3=SUC 2`]); + (REWRITE_TAC[ASSUME `e'' = y:real^3->bool`; ASSUME `e' = x:real^3->bool`; + ASSUME `y:real^3->bool = {EL 2 vl, EL 3 vl}`; + ASSUME `x:real^3->bool = {EL 0 vl, EL 1 vl}`;left_action_list; + LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`; TABLE_4]); + + (NEW_GOAL `!u:num. p u = 0 ==> p' u = 2`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "p'"); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `!u:num. p u = 1 ==> p' u = 3`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "p'"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `!u:num. p u = 2 ==> p' u = 0`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "p'"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `!u:num. p u = 3 ==> p' u = 1`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "p'"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `!u:num. p u > 3 ==> p' u = u`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "p'"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (REFL_TAC); + + (NEW_GOAL `!u:num. p u > 3 ==> p u = u`); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes; EXISTS_UNIQUE]); + (REPEAT STRIP_TAC); + (ABBREV_TAC `s = (p:num->num) u`); + (NEW_GOAL `(p:num->num) s = s`); + (FIRST_ASSUM MATCH_MP_TAC); + (UNDISCH_TAC `s > 3` THEN REWRITE_TAC[IN_NUMSEG_0] THEN ARITH_TAC); + (NEW_GOAL `?x. (p:num->num) x = s /\ (!y'. p y' = s ==> y' = x)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `s = x'':num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `u = x'':num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + + + (NEW_GOAL `!u:num. p' u = 0 ==> p u = 2`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p:num->num) u = 0`); + (NEW_GOAL `(p':num->num) u = 2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 1`); + (NEW_GOAL `(p':num->num) u = 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 3`); + (NEW_GOAL `(p':num->num) u = 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u > 3`); + (NEW_GOAL `(p':num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `!u:num. p' u = 1 ==> p u = 3`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p:num->num) u = 0`); + (NEW_GOAL `(p':num->num) u = 2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 1`); + (NEW_GOAL `(p':num->num) u = 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 2`); + (NEW_GOAL `(p':num->num) u = 0`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u > 3`); + (NEW_GOAL `(p':num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `!u:num. p' u = 2 ==> p u = 0`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p:num->num) u = 1`); + (NEW_GOAL `(p':num->num) u = 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 2`); + (NEW_GOAL `(p':num->num) u = 0`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 3`); + (NEW_GOAL `(p':num->num) u = 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u > 3`); + (NEW_GOAL `(p':num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `!u:num. p' u = 3 ==> p u = 1`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p:num->num) u = 0`); + (NEW_GOAL `(p':num->num) u = 2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 2`); + (NEW_GOAL `(p':num->num) u = 0`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 3`); + (NEW_GOAL `(p':num->num) u = 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u > 3`); + (NEW_GOAL `(p':num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `!u:num. p' u > 3 ==> p u > 3`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p:num->num) u = 0`); + (NEW_GOAL `(p':num->num) u = 2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 1`); + (NEW_GOAL `(p':num->num) u = 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 2`); + (NEW_GOAL `(p':num->num) u = 0`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 3`); + (NEW_GOAL `(p':num->num) u = 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + +(* ------------------------------------------------------------------------- *) +(* begin to prove that p' permutes 0..3 *) + + + (NEW_GOAL `p' permutes 0..3`); + (REWRITE_TAC[permutes]); + (REPEAT STRIP_TAC); + (NEW_GOAL `x'' > 3`); + (UP_ASM_TAC THEN REWRITE_TAC[IN_NUMSEG_0] THEN ARITH_TAC); + (EXPAND_TAC "p'"); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes] THEN REPEAT STRIP_TAC); + (NEW_GOAL `(p:num->num) x'' = x''`); + (ASM_SIMP_TAC[]); + (COND_CASES_TAC); + (ASM_ARITH_TAC); + (COND_CASES_TAC); + (ASM_ARITH_TAC); + (COND_CASES_TAC); + (ASM_ARITH_TAC); + (COND_CASES_TAC); + (ASM_ARITH_TAC); + (REFL_TAC); + + (REWRITE_TAC[EXISTS_UNIQUE] THEN REPEAT STRIP_TAC); + + (ASM_CASES_TAC `y' = 0`); + (NEW_GOAL `?z. (p:num->num) z = 2`); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes] THEN MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `z:num`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `(p:num->num) y'' = 2`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes; EXISTS_UNIQUE]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?s:num. p s = 2 /\ (!y'. p y' = 2 ==> y' = s)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `y'' = s:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `z = s:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `y' = 1`); + (NEW_GOAL `?z. (p:num->num) z = 3`); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes] THEN MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `z:num`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `(p:num->num) y'' = 3`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes; EXISTS_UNIQUE]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?s:num. p s = 3 /\ (!y'. p y' = 3 ==> y' = s)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `y'' = s:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `z = s:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `y' = 2`); + (NEW_GOAL `?z. (p:num->num) z = 0`); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes] THEN MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `z:num`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `(p:num->num) y'' = 0`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes; EXISTS_UNIQUE]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?s:num. p s = 0 /\ (!y'. p y' = 0 ==> y' = s)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `y'' = s:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `z = s:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `y' = 3`); + (NEW_GOAL `?z. (p:num->num) z = 1`); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes] THEN MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `z:num`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `(p:num->num) y'' = 1`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes; EXISTS_UNIQUE]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?s:num. p s = 1 /\ (!y'. p y' = 1 ==> y' = s)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `y'' = s:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `z = s:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + + + (NEW_GOAL `y' > 3`); + (ASM_ARITH_TAC); + (NEW_GOAL `?z. (p:num->num) z = y'`); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes] THEN MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `z:num`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (NEW_GOAL `(p:num->num) z = z`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_ARITH_TAC); + (NEW_GOAL `(p':num->num) z = z`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + + (NEW_GOAL `(p:num->num) z = z`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_ARITH_TAC); + (NEW_GOAL `(p':num->num) z = z`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes; EXISTS_UNIQUE]); + (REPEAT STRIP_TAC); + (NEW_GOAL `(p:num->num) y'' > 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `(p:num->num) y'' = y''`); + (MATCH_MP_TAC (ASSUME `!u:num. p u > 3 ==> p u = u`)); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p':num->num) y'' = y''`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?s:num. p s = (y':num) /\ (!z'. p z' = y' ==> z' = s)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `y'' = s:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_MESON_TAC[]); + (REWRITE_WITH `z = s:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_MESON_TAC[]); + + +(* finish proving that p' permutes 0..3 *) + + (REWRITE_TAC[ASSUME `p' permutes 0..3`]); + +(* --------------------------------------------------------------------- *) + + (REWRITE_WITH `EL (inverse p' 0) [v0; v1; v2; v3:real^3] = EL 2 vl`); + (ASM_REWRITE_TAC[left_action_list; + LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`; TABLE_4]); + (REWRITE_WITH `EL 2 + [EL (inverse p 0) [v0; v1; v2; v3]; EL (inverse p 1) [v0; v1; v2; v3]; + EL (inverse p 2) [v0; v1; v2; v3]; EL (inverse p 3) [v0; v1; v2; v3]] + = EL (inverse p 2) [v0; v1; v2; v3:real^3]`); + (REWRITE_TAC[EL; HD;TL;ARITH_RULE `1=SUC 0/\2=SUC 1/\3=SUC 2`]); + (REWRITE_WITH `inverse p' 0 = inverse (p:num->num) 2`); + (ABBREV_TAC `j = inverse (p:num->num) 2`); + (NEW_GOAL `(p:num->num) j = 2`); + (REWRITE_WITH `(p j = 2) <=> inverse (p:num->num) 2 = j`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (UNDISCH_TAC `p permutes 0..3` THEN MESON_TAC[PERMUTES_INVERSE_EQ]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `inverse (p':num->num) 0 = j <=> p' j = 0`); + (UNDISCH_TAC `p' permutes 0..3` THEN MESON_TAC[PERMUTES_INVERSE_EQ]); + (EXPAND_TAC "p'"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + + + (REWRITE_WITH `EL (inverse p' 1) [v0; v1; v2; v3:real^3] = EL 3 vl`); + (ASM_REWRITE_TAC[left_action_list; + LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`; TABLE_4]); + (REWRITE_WITH `EL 3 + [EL (inverse p 0) [v0; v1; v2; v3]; EL (inverse p 1) [v0; v1; v2; v3]; + EL (inverse p 2) [v0; v1; v2; v3]; EL (inverse p 3) [v0; v1; v2; v3]] + = EL (inverse p 3) [v0; v1; v2; v3:real^3]`); + (REWRITE_TAC[EL; HD;TL;ARITH_RULE `1=SUC 0/\2=SUC 1/\3=SUC 2`]); + (REWRITE_WITH `inverse p' 1 = inverse (p:num->num) 3`); + (ABBREV_TAC `j = inverse (p:num->num) 3`); + (NEW_GOAL `(p:num->num) j = 3`); + (REWRITE_WITH `(p j = 3) <=> inverse (p:num->num) 3 = j`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (UNDISCH_TAC `p permutes 0..3` THEN MESON_TAC[PERMUTES_INVERSE_EQ]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `inverse (p':num->num) 1 = j <=> p' j = 1`); + (UNDISCH_TAC `p' permutes 0..3` THEN MESON_TAC[PERMUTES_INVERSE_EQ]); + (EXPAND_TAC "p'"); + + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `EL (inverse p' 2) [v0; v1; v2; v3:real^3] = EL 0 vl`); + (ASM_REWRITE_TAC[left_action_list; + LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`; TABLE_4]); + (REWRITE_WITH `EL 0 + [EL (inverse p 0) [v0; v1; v2; v3]; EL (inverse p 1) [v0; v1; v2; v3]; + EL (inverse p 2) [v0; v1; v2; v3]; EL (inverse p 3) [v0; v1; v2; v3]] + = EL (inverse p 0) [v0; v1; v2; v3:real^3]`); + (REWRITE_TAC[EL; HD;TL;ARITH_RULE `1=SUC 0/\2=SUC 1/\3=SUC 2`]); + (REWRITE_WITH `inverse p' 2 = inverse (p:num->num) 0`); + (ABBREV_TAC `j = inverse (p:num->num) 0`); + (NEW_GOAL `(p:num->num) j = 0`); + (REWRITE_WITH `(p j = 0) <=> inverse (p:num->num) 0 = j`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (UNDISCH_TAC `p permutes 0..3` THEN MESON_TAC[PERMUTES_INVERSE_EQ]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `inverse (p':num->num) 2 = j <=> p' j = 2`); + (UNDISCH_TAC `p' permutes 0..3` THEN MESON_TAC[PERMUTES_INVERSE_EQ]); + (EXPAND_TAC "p'"); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `EL (inverse p' 3) [v0; v1; v2; v3:real^3] = EL 1 vl`); + (ASM_REWRITE_TAC[left_action_list; + LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`; TABLE_4]); + (REWRITE_WITH `EL 1 + [EL (inverse p 0) [v0; v1; v2; v3]; EL (inverse p 1) [v0; v1; v2; v3]; + EL (inverse p 2) [v0; v1; v2; v3]; EL (inverse p 3) [v0; v1; v2; v3]] + = EL (inverse p 1) [v0; v1; v2; v3:real^3]`); + (REWRITE_TAC[EL; HD;TL;ARITH_RULE `1=SUC 0/\2=SUC 1/\3=SUC 2`]); + (REWRITE_WITH `inverse p' 3 = inverse (p:num->num) 1`); + (ABBREV_TAC `j = inverse (p:num->num) 1`); + (NEW_GOAL `(p:num->num) j = 1`); + (REWRITE_WITH `(p j = 1) <=> inverse (p:num->num) 1 = j`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (UNDISCH_TAC `p permutes 0..3` THEN MESON_TAC[PERMUTES_INVERSE_EQ]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `inverse (p':num->num) 3 = j <=> p' j = 3`); + (UNDISCH_TAC `p' permutes 0..3` THEN MESON_TAC[PERMUTES_INVERSE_EQ]); + (EXPAND_TAC "p'"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + +(* ======================================================================= *) + + (EXPAND_TAC "g"); + (LET_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[PAIR_EQ; + ASSUME `x': (real^3->bool)#(real^3->bool)#(num->num)#(real^3)list = + e',e'',p,vl`]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[ASSUME `e':real^3->bool = e''''`]); + (REWRITE_TAC[ASSUME `e'':real^3->bool = e'''`]); + (REWRITE_TAC[FUN_EQ_THM]); + + (NEW_GOAL `!u:num. p u = 0 ==> p' u = 2`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "p'"); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `!u:num. p u = 1 ==> p' u = 3`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "p'"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `!u:num. p u = 2 ==> p' u = 0`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "p'"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `!u:num. p u = 3 ==> p' u = 1`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "p'"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `!u:num. p u > 3 ==> p' u = u`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "p'"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (REFL_TAC); + + (NEW_GOAL `!u:num. p u > 3 ==> p u = u`); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes; EXISTS_UNIQUE]); + (REPEAT STRIP_TAC); + (ABBREV_TAC `s = (p:num->num) u`); + (NEW_GOAL `(p:num->num) s = s`); + (FIRST_ASSUM MATCH_MP_TAC); + (UNDISCH_TAC `s > 3` THEN REWRITE_TAC[IN_NUMSEG_0] THEN ARITH_TAC); + (NEW_GOAL `?x. (p:num->num) x = s /\ (!y'. p y' = s ==> y' = x)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `s = x'':num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `u = x'':num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `!u:num. p' u = 0 ==> p u = 2`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p:num->num) u = 0`); + (NEW_GOAL `(p':num->num) u = 2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 1`); + (NEW_GOAL `(p':num->num) u = 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 3`); + (NEW_GOAL `(p':num->num) u = 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u > 3`); + (NEW_GOAL `(p':num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `!u:num. p' u = 1 ==> p u = 3`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p:num->num) u = 0`); + (NEW_GOAL `(p':num->num) u = 2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 1`); + (NEW_GOAL `(p':num->num) u = 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 2`); + (NEW_GOAL `(p':num->num) u = 0`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u > 3`); + (NEW_GOAL `(p':num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `!u:num. p' u = 2 ==> p u = 0`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p:num->num) u = 1`); + (NEW_GOAL `(p':num->num) u = 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 2`); + (NEW_GOAL `(p':num->num) u = 0`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 3`); + (NEW_GOAL `(p':num->num) u = 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u > 3`); + (NEW_GOAL `(p':num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `!u:num. p' u = 3 ==> p u = 1`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p:num->num) u = 0`); + (NEW_GOAL `(p':num->num) u = 2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 2`); + (NEW_GOAL `(p':num->num) u = 0`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 3`); + (NEW_GOAL `(p':num->num) u = 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u > 3`); + (NEW_GOAL `(p':num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `!u:num. p' u > 3 ==> p u > 3`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p:num->num) u = 0`); + (NEW_GOAL `(p':num->num) u = 2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 1`); + (NEW_GOAL `(p':num->num) u = 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 2`); + (NEW_GOAL `(p':num->num) u = 0`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 3`); + (NEW_GOAL `(p':num->num) u = 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (GEN_TAC); + (COND_CASES_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `(p:num->num) x'' > 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + +(* ------------------------------------------------------------------------- *) + + (EXPAND_TAC "vl'"); + (REWRITE_TAC[EL; HD;TL;ARITH_RULE `1=SUC 0/\2=SUC 1/\3=SUC 2`]); + (REWRITE_TAC[ASSUME `vl = left_action_list p [v0; v1; v2; v3:real^3]`; left_action_list; TABLE_4; LENGTH;EL; HD;TL; + ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`]); +(* ======================================================================= *) + + (EXISTS_TAC `e'':real^3->bool` THEN EXISTS_TAC `e':real^3->bool`); + (ABBREV_TAC `p' = (\i. if p i = 0 + then 2 + else if p i = 1 + then 3 + else if p i = 2 then 0 else if p i = 3 then 1 else i)`); + (EXISTS_TAC `p':num->num`); + (EXISTS_TAC `[EL 2 (vl:(real^3)list); EL 3 vl; EL 0 vl; EL 1 vl]`); + (REWRITE_WITH + `{EL 2 [EL 2 vl; EL 3 vl; EL 0 vl; EL 1 vl], + EL 3 [EL 2 vl; EL 3 vl; EL 0 vl; EL 1 vl]} + = {EL 0 vl, EL 1 (vl:(real^3)list)}`); + (REWRITE_TAC[EL; HD;TL;ARITH_RULE `1=SUC 0/\2=SUC 1/\3=SUC 2`]); + (REWRITE_WITH + `{EL 0 [EL 2 vl; EL 3 vl; EL 0 vl; EL 1 vl], + EL 1 [EL 2 vl; EL 3 vl; EL 0 vl; EL 1 vl]} + = {EL 2 vl, EL 3 (vl:(real^3)list)}`); + (REWRITE_TAC[EL; HD;TL;ARITH_RULE `1=SUC 0/\2=SUC 1/\3=SUC 2`]); + (REWRITE_TAC[ASSUME `e'' = x:real^3->bool`; ASSUME `e' = y:real^3->bool`; + ASSUME `y:real^3->bool = {EL 0 vl, EL 1 vl}`; + ASSUME `x:real^3->bool = {EL 2 vl, EL 3 vl}`;left_action_list; + LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`; TABLE_4]); + + (NEW_GOAL `!u:num. p u = 0 ==> p' u = 2`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "p'"); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `!u:num. p u = 1 ==> p' u = 3`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "p'"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `!u:num. p u = 2 ==> p' u = 0`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "p'"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `!u:num. p u = 3 ==> p' u = 1`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "p'"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `!u:num. p u > 3 ==> p' u = u`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "p'"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (REFL_TAC); + + (NEW_GOAL `!u:num. p u > 3 ==> p u = u`); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes; EXISTS_UNIQUE]); + (REPEAT STRIP_TAC); + (ABBREV_TAC `s = (p:num->num) u`); + (NEW_GOAL `(p:num->num) s = s`); + (FIRST_ASSUM MATCH_MP_TAC); + (UNDISCH_TAC `s > 3` THEN REWRITE_TAC[IN_NUMSEG_0] THEN ARITH_TAC); + (NEW_GOAL `?x. (p:num->num) x = s /\ (!y'. p y' = s ==> y' = x)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `s = x''':num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `u = x''':num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `!u:num. p' u = 0 ==> p u = 2`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p:num->num) u = 0`); + (NEW_GOAL `(p':num->num) u = 2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 1`); + (NEW_GOAL `(p':num->num) u = 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 3`); + (NEW_GOAL `(p':num->num) u = 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u > 3`); + (NEW_GOAL `(p':num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `!u:num. p' u = 1 ==> p u = 3`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p:num->num) u = 0`); + (NEW_GOAL `(p':num->num) u = 2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 1`); + (NEW_GOAL `(p':num->num) u = 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 2`); + (NEW_GOAL `(p':num->num) u = 0`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u > 3`); + (NEW_GOAL `(p':num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `!u:num. p' u = 2 ==> p u = 0`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p:num->num) u = 1`); + (NEW_GOAL `(p':num->num) u = 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 2`); + (NEW_GOAL `(p':num->num) u = 0`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 3`); + (NEW_GOAL `(p':num->num) u = 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u > 3`); + (NEW_GOAL `(p':num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `!u:num. p' u = 3 ==> p u = 1`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p:num->num) u = 0`); + (NEW_GOAL `(p':num->num) u = 2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 2`); + (NEW_GOAL `(p':num->num) u = 0`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 3`); + (NEW_GOAL `(p':num->num) u = 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u > 3`); + (NEW_GOAL `(p':num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `!u:num. p' u > 3 ==> p u > 3`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p:num->num) u = 0`); + (NEW_GOAL `(p':num->num) u = 2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 1`); + (NEW_GOAL `(p':num->num) u = 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 2`); + (NEW_GOAL `(p':num->num) u = 0`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p:num->num) u = 3`); + (NEW_GOAL `(p':num->num) u = 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + +(* ------------------------------------------------------------------------- *) +(* begin to prove that p' permutes 0..3 *) + + (NEW_GOAL `p' permutes 0..3`); + (REWRITE_TAC[permutes]); + (REPEAT STRIP_TAC); + (NEW_GOAL `x''' > 3`); + (UP_ASM_TAC THEN REWRITE_TAC[IN_NUMSEG_0] THEN ARITH_TAC); + (EXPAND_TAC "p'"); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes] THEN REPEAT STRIP_TAC); + + (NEW_GOAL `(p:num->num) x''' = x'''`); + (ASM_SIMP_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (REFL_TAC); + + (REWRITE_TAC[EXISTS_UNIQUE] THEN REPEAT STRIP_TAC); + + (ASM_CASES_TAC `y' = 0`); + (NEW_GOAL `?z. (p:num->num) z = 2`); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes] THEN MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `z:num`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `(p:num->num) y'' = 2`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes; EXISTS_UNIQUE]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?s:num. p s = 2 /\ (!y'. p y' = 2 ==> y' = s)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `y'' = s:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `z = s:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `y' = 1`); + (NEW_GOAL `?z. (p:num->num) z = 3`); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes] THEN MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `z:num`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `(p:num->num) y'' = 3`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes; EXISTS_UNIQUE]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?s:num. p s = 3 /\ (!y'. p y' = 3 ==> y' = s)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `y'' = s:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `z = s:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `y' = 2`); + (NEW_GOAL `?z. (p:num->num) z = 0`); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes] THEN MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `z:num`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `(p:num->num) y'' = 0`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes; EXISTS_UNIQUE]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?s:num. p s = 0 /\ (!y'. p y' = 0 ==> y' = s)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `y'' = s:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `z = s:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `y' = 3`); + (NEW_GOAL `?z. (p:num->num) z = 1`); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes] THEN MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `z:num`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `(p:num->num) y'' = 1`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes; EXISTS_UNIQUE]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?s:num. p s = 1 /\ (!y'. p y' = 1 ==> y' = s)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `y'' = s:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `z = s:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `y' > 3`); + (ASM_ARITH_TAC); + (NEW_GOAL `?z. (p:num->num) z = y'`); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes] THEN MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `z:num`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (NEW_GOAL `(p:num->num) z = z`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_ARITH_TAC); + (NEW_GOAL `(p':num->num) z = z`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + + (NEW_GOAL `(p:num->num) z = z`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_ARITH_TAC); + (NEW_GOAL `(p':num->num) z = z`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `p permutes 0..3` THEN REWRITE_TAC[permutes; EXISTS_UNIQUE]); + (REPEAT STRIP_TAC); + (NEW_GOAL `(p:num->num) y'' > 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `(p:num->num) y'' = y''`); + (MATCH_MP_TAC (ASSUME `!u:num. p u > 3 ==> p u = u`)); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p':num->num) y'' = y''`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?s:num. p s = (y':num) /\ (!z'. p z' = y' ==> z' = s)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `y'' = s:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_MESON_TAC[]); + (REWRITE_WITH `z = s:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_MESON_TAC[]); + + +(* finish proving that p' permutes 0..3 *) + + (REWRITE_TAC[ASSUME `p' permutes 0..3`]); + +(* --------------------------------------------------------------------- *) + + (REWRITE_WITH `EL (inverse p' 0) [v0; v1; v2; v3:real^3] = EL 2 vl`); + (ASM_REWRITE_TAC[left_action_list; + LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`; TABLE_4]); + (REWRITE_WITH `EL 2 + [EL (inverse p 0) [v0; v1; v2; v3]; EL (inverse p 1) [v0; v1; v2; v3]; + EL (inverse p 2) [v0; v1; v2; v3]; EL (inverse p 3) [v0; v1; v2; v3]] + = EL (inverse p 2) [v0; v1; v2; v3:real^3]`); + (REWRITE_TAC[EL; HD;TL;ARITH_RULE `1=SUC 0/\2=SUC 1/\3=SUC 2`]); + (REWRITE_WITH `inverse p' 0 = inverse (p:num->num) 2`); + (ABBREV_TAC `j = inverse (p:num->num) 2`); + (NEW_GOAL `(p:num->num) j = 2`); + (REWRITE_WITH `(p j = 2) <=> inverse (p:num->num) 2 = j`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (UNDISCH_TAC `p permutes 0..3` THEN MESON_TAC[PERMUTES_INVERSE_EQ]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `inverse (p':num->num) 0 = j <=> p' j = 0`); + (UNDISCH_TAC `p' permutes 0..3` THEN MESON_TAC[PERMUTES_INVERSE_EQ]); + (EXPAND_TAC "p'"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + + (REWRITE_WITH `EL (inverse p' 1) [v0; v1; v2; v3:real^3] = EL 3 vl`); + (ASM_REWRITE_TAC[left_action_list; + LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`; TABLE_4]); + (REWRITE_WITH `EL 3 + [EL (inverse p 0) [v0; v1; v2; v3]; EL (inverse p 1) [v0; v1; v2; v3]; + EL (inverse p 2) [v0; v1; v2; v3]; EL (inverse p 3) [v0; v1; v2; v3]] + = EL (inverse p 3) [v0; v1; v2; v3:real^3]`); + (REWRITE_TAC[EL; HD;TL;ARITH_RULE `1=SUC 0/\2=SUC 1/\3=SUC 2`]); + (REWRITE_WITH `inverse p' 1 = inverse (p:num->num) 3`); + (ABBREV_TAC `j = inverse (p:num->num) 3`); + (NEW_GOAL `(p:num->num) j = 3`); + (REWRITE_WITH `(p j = 3) <=> inverse (p:num->num) 3 = j`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (UNDISCH_TAC `p permutes 0..3` THEN MESON_TAC[PERMUTES_INVERSE_EQ]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `inverse (p':num->num) 1 = j <=> p' j = 1`); + (UNDISCH_TAC `p' permutes 0..3` THEN MESON_TAC[PERMUTES_INVERSE_EQ]); + (EXPAND_TAC "p'"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `EL (inverse p' 2) [v0; v1; v2; v3:real^3] = EL 0 vl`); + (ASM_REWRITE_TAC[left_action_list; + LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`; TABLE_4]); + (REWRITE_WITH `EL 0 + [EL (inverse p 0) [v0; v1; v2; v3]; EL (inverse p 1) [v0; v1; v2; v3]; + EL (inverse p 2) [v0; v1; v2; v3]; EL (inverse p 3) [v0; v1; v2; v3]] + = EL (inverse p 0) [v0; v1; v2; v3:real^3]`); + (REWRITE_TAC[EL; HD;TL;ARITH_RULE `1=SUC 0/\2=SUC 1/\3=SUC 2`]); + (REWRITE_WITH `inverse p' 2 = inverse (p:num->num) 0`); + (ABBREV_TAC `j = inverse (p:num->num) 0`); + (NEW_GOAL `(p:num->num) j = 0`); + (REWRITE_WITH `(p j = 0) <=> inverse (p:num->num) 0 = j`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (UNDISCH_TAC `p permutes 0..3` THEN MESON_TAC[PERMUTES_INVERSE_EQ]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `inverse (p':num->num) 2 = j <=> p' j = 2`); + (UNDISCH_TAC `p' permutes 0..3` THEN MESON_TAC[PERMUTES_INVERSE_EQ]); + (EXPAND_TAC "p'"); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + + (REWRITE_WITH `EL (inverse p' 3) [v0; v1; v2; v3:real^3] = EL 1 vl`); + (ASM_REWRITE_TAC[left_action_list; + LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`; TABLE_4]); + (REWRITE_WITH `EL 1 + [EL (inverse p 0) [v0; v1; v2; v3]; EL (inverse p 1) [v0; v1; v2; v3]; + EL (inverse p 2) [v0; v1; v2; v3]; EL (inverse p 3) [v0; v1; v2; v3]] + = EL (inverse p 1) [v0; v1; v2; v3:real^3]`); + (REWRITE_TAC[EL; HD;TL;ARITH_RULE `1=SUC 0/\2=SUC 1/\3=SUC 2`]); + (REWRITE_WITH `inverse p' 3 = inverse (p:num->num) 1`); + (ABBREV_TAC `j = inverse (p:num->num) 1`); + (NEW_GOAL `(p:num->num) j = 1`); + (REWRITE_WITH `(p j = 1) <=> inverse (p:num->num) 1 = j`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (UNDISCH_TAC `p permutes 0..3` THEN MESON_TAC[PERMUTES_INVERSE_EQ]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `inverse (p':num->num) 3 = j <=> p' j = 3`); + (UNDISCH_TAC `p' permutes 0..3` THEN MESON_TAC[PERMUTES_INVERSE_EQ]); + (EXPAND_TAC "p'"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + +(* ======================================================================= *) + + (ONCE_REWRITE_TAC[ASSUME + `x':(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list + = g (x'':(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list)`]); + (REWRITE_TAC[ASSUME + `x'':(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list = e',e'',p,vl`] + THEN EXPAND_TAC "g"); + (LET_TAC); + (REWRITE_TAC[PAIR_EQ]); + (EXPAND_TAC "p'" THEN REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + +(* --------------------------------------------------- *) +(* It is left to prove only 3 subgoals *) + + (EXPAND_TAC "g"); + (DEL_TAC THEN DEL_TAC THEN DEL_TAC THEN DEL_TAC); + (REWRITE_TAC[FUN_EQ_THM]); + (GEN_TAC); + (NEW_GOAL `?e1 e2 p1 vl1. + x' = (e1:real^3->bool,e2:real^3->bool,p1:num->num, vl1:(real^3)list)`); + (EXISTS_TAC `FST + (x':(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list)`); + (EXISTS_TAC `FST (SND + (x':(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list))`); + (EXISTS_TAC `FST (SND (SND + (x':(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list)))`); + (EXISTS_TAC `SND (SND (SND + (x':(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list)))`); + (REWRITE_TAC[PAIR]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH + `(\x. let e',e'',p,vl = x in + e'', e', (\i. if p i = 0 then 2 + else if p i = 1 then 3 + else if p i = 2 then 0 + else if p i = 3 then 1 else i), + [EL 2 vl; EL 3 vl; EL 0 vl; EL 1 vl]) + = (\(e':real^3->bool,e'':real^3->bool,p:num->num,vl:(real^3)list). + e'', e', (\i. if p i = 0 then 2 + else if p i = 1 then 3 + else if p i = 2 then 0 + else if p i = 3 then 1 else i), + [EL 2 vl; EL 3 vl; EL 0 vl; EL 1 vl])`); + (REWRITE_TAC[FUN_EQ_THM]); + (GEN_TAC); + (LET_TAC); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[o_THM]); + (REWRITE_WITH + `EL 0 [EL 2 vl1; EL 3 vl1; EL 0 vl1; EL 1 vl1] = EL 2 (vl1:(real^3)list) /\ + EL 1 [EL 2 vl1; EL 3 vl1; EL 0 vl1; EL 1 vl1] = EL 3 (vl1:(real^3)list) /\ + EL 2 [EL 2 vl1; EL 3 vl1; EL 0 vl1; EL 1 vl1] = EL 0 (vl1:(real^3)list) /\ + EL 3 [EL 2 vl1; EL 3 vl1; EL 0 vl1; EL 1 vl1] = EL 1 (vl1:(real^3)list)`); + (REWRITE_TAC[EL;HD;TL; LENGTH; ARITH_RULE `1=SUC 0/\2=SUC 1/\3=SUC 2`]); + + (MATCH_MP_TAC SUM_IMAGE); + (EXPAND_TAC "S1" THEN EXPAND_TAC "S2"); + (ONCE_REWRITE_TAC[IN]); + (REWRITE_TAC[IN_ELIM_THM]); + (EXPAND_TAC "g"); + (REPEAT STRIP_TAC); + + (NEW_GOAL `(let e1:real^3->bool,e2:real^3->bool,p1:num->num,vl1 = x' in + e2, + e1, + (\i. if p1 i = 0 + then 2 + else if p1 i = 1 + then 3 + else if p1 i = 2 then 0 else if p1 i = 3 then 1 else i), + [EL 2 vl1; EL 3 vl1; EL 0 vl1; EL 1 vl1]) = + (let f1,f2,p2,vl2 = y' in + f2, + f1, + (\i. if p2 i = 0 + then 2 + else if p2 i = 1 + then 3 + else if p2 i = 2 then 0 else if p2 i = 3 then 1 else i), + [EL 2 vl2; EL 3 vl2; EL 0 vl2; EL 1 (vl2:(real^3)list)])`); + (ASM_REWRITE_TAC[ETA_AX]); + (UP_ASM_TAC THEN DEL_TAC THEN REPEAT LET_TAC THEN REWRITE_TAC[PAIR_EQ] THEN + REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[FUN_EQ_THM] THEN GEN_TAC); + (ABBREV_TAC + `q = (\i. if p1 i = 0 + then 2 + else if p1 i = 1 + then 3 + else if p1 i = 2 then 0 else if p1 i = 3 then 1 else i)`); + + (NEW_GOAL `!u:num. p1 u = 0 ==> q u = 2`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "q"); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `!u:num. p1 u = 1 ==> q u = 3`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "q"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `!u:num. p1 u = 2 ==> q u = 0`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "q"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `!u:num. p1 u = 3 ==> q u = 1`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "q"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `!u:num. p1 u > 3 ==> q u = u`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "q"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (REFL_TAC); + + (NEW_GOAL `!u:num. p1 u > 3 ==> p1 u = u`); + (NEW_GOAL `p1 permutes 0..3`); + (REWRITE_WITH `p1:num->num = p`); + (UNDISCH_TAC `e1:real^3->bool,e2:real^3->bool,p1:num->num,vl1:(real^3)list = e',e'',p,vl` THEN REWRITE_TAC[PAIR_EQ]); + (MESON_TAC[]); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `p1 permutes 0..3` THEN REWRITE_TAC[permutes; EXISTS_UNIQUE]); + (REPEAT STRIP_TAC); + (ABBREV_TAC `s = (p1:num->num) u`); + (NEW_GOAL `(p1:num->num) s = s`); + (FIRST_ASSUM MATCH_MP_TAC); + (UNDISCH_TAC `s > 3` THEN REWRITE_TAC[IN_NUMSEG_0] THEN ARITH_TAC); + (NEW_GOAL `?z. (p1:num->num) z = s /\ (!y'. p1 y' = s ==> y' = z)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `s = z:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `u = z:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `!u:num. q u = 0 ==> p1 u = 2`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p1:num->num) u = 0`); + (NEW_GOAL `(q:num->num) u = 2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p1:num->num) u = 1`); + (NEW_GOAL `(q:num->num) u = 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p1:num->num) u = 3`); + (NEW_GOAL `(q:num->num) u = 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p1:num->num) u > 3`); + (NEW_GOAL `(q:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p1:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `!u:num. q u = 1 ==> p1 u = 3`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p1:num->num) u = 0`); + (NEW_GOAL `(q:num->num) u = 2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p1:num->num) u = 1`); + (NEW_GOAL `(q:num->num) u = 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p1:num->num) u = 2`); + (NEW_GOAL `(q:num->num) u = 0`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p1:num->num) u > 3`); + (NEW_GOAL `(q:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p1:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `!u:num. q u = 2 ==> p1 u = 0`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p1:num->num) u = 1`); + (NEW_GOAL `(q:num->num) u = 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p1:num->num) u = 2`); + (NEW_GOAL `(q:num->num) u = 0`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p1:num->num) u = 3`); + (NEW_GOAL `(q:num->num) u = 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p1:num->num) u > 3`); + (NEW_GOAL `(q:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p1:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `!u:num. q u = 3 ==> p1 u = 1`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p1:num->num) u = 0`); + (NEW_GOAL `(q:num->num) u = 2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p1:num->num) u = 2`); + (NEW_GOAL `(q:num->num) u = 0`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p1:num->num) u = 3`); + (NEW_GOAL `(q:num->num) u = 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p1:num->num) u > 3`); + (NEW_GOAL `(q:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p1:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `!u:num. q u > 3 ==> p1 u > 3`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p1:num->num) u = 0`); + (NEW_GOAL `(q:num->num) u = 2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p1:num->num) u = 1`); + (NEW_GOAL `(q:num->num) u = 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p1:num->num) u = 2`); + (NEW_GOAL `(q:num->num) u = 0`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p1:num->num) u = 3`); + (NEW_GOAL `(q:num->num) u = 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + + (NEW_GOAL `!u:num. p2 u = 0 ==> q u = 2`); + (REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `!u:num. p2 u = 1 ==> q u = 3`); + (REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (REFL_TAC); + + (NEW_GOAL `!u:num. p2 u = 2 ==> q u = 0`); + (REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (REFL_TAC); + + (NEW_GOAL `!u:num. p2 u = 3 ==> q u = 1`); + (REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (REFL_TAC); + + (NEW_GOAL `!u:num. p2 u > 3 ==> q u = u`); + (REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (REFL_TAC); + + (NEW_GOAL `!u:num. p2 u > 3 ==> p2 u = u`); + (NEW_GOAL `p2 permutes 0..3`); + (REWRITE_WITH `p2:num->num = p'`); + (UNDISCH_TAC `f1:real^3->bool,f2:real^3->bool,p2:num->num,vl2:(real^3)list = e''',e'''',p',vl'` THEN REWRITE_TAC[PAIR_EQ]); + (MESON_TAC[]); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `p2 permutes 0..3` THEN REWRITE_TAC[permutes; EXISTS_UNIQUE]); + (REPEAT STRIP_TAC); + (ABBREV_TAC `s = (p2:num->num) u`); + (NEW_GOAL `(p2:num->num) s = s`); + (FIRST_ASSUM MATCH_MP_TAC); + (UNDISCH_TAC `s > 3` THEN REWRITE_TAC[IN_NUMSEG_0] THEN ARITH_TAC); + (NEW_GOAL `?z. (p2:num->num) z = s /\ (!y'. p2 y' = s ==> y' = z)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `s = z:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `u = z:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `!u:num. q u = 0 ==> p2 u = 2`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p2:num->num) u = 0`); + (NEW_GOAL `(q:num->num) u = 2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p2:num->num) u = 1`); + (NEW_GOAL `(q:num->num) u = 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p2:num->num) u = 3`); + (NEW_GOAL `(q:num->num) u = 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p2:num->num) u > 3`); + (NEW_GOAL `(q:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p2:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `!u:num. q u = 1 ==> p2 u = 3`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p2:num->num) u = 0`); + (NEW_GOAL `(q:num->num) u = 2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p2:num->num) u = 1`); + (NEW_GOAL `(q:num->num) u = 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p2:num->num) u = 2`); + (NEW_GOAL `(q:num->num) u = 0`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p2:num->num) u > 3`); + (NEW_GOAL `(q:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p2:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `!u:num. q u = 2 ==> p2 u = 0`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p2:num->num) u = 1`); + (NEW_GOAL `(q:num->num) u = 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p2:num->num) u = 2`); + (NEW_GOAL `(q:num->num) u = 0`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p2:num->num) u = 3`); + (NEW_GOAL `(q:num->num) u = 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p2:num->num) u > 3`); + (NEW_GOAL `(q:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p2:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `!u:num. q u = 3 ==> p2 u = 1`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p2:num->num) u = 0`); + (NEW_GOAL `(q:num->num) u = 2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p2:num->num) u = 2`); + (NEW_GOAL `(q:num->num) u = 0`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p2:num->num) u = 3`); + (NEW_GOAL `(q:num->num) u = 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p2:num->num) u > 3`); + (NEW_GOAL `(q:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(p2:num->num) u = u`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `!u:num. q u > 3 ==> p2 u > 3`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `(p2:num->num) u = 0`); + (NEW_GOAL `(q:num->num) u = 2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p2:num->num) u = 1`); + (NEW_GOAL `(q:num->num) u = 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p2:num->num) u = 2`); + (NEW_GOAL `(q:num->num) u = 0`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `(p2:num->num) u = 3`); + (NEW_GOAL `(q:num->num) u = 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (ASM_CASES_TAC `(q:num->num) x'' = 0`); + (NEW_GOAL `(p1:num->num) x'' = 2`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `(p2:num->num) x'' = 2`); + (ASM_SIMP_TAC[]); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `(q:num->num) x'' = 1`); + (NEW_GOAL `(p1:num->num) x'' = 3`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `(p2:num->num) x'' = 3`); + (ASM_SIMP_TAC[]); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `(q:num->num) x'' = 2`); + (NEW_GOAL `(p1:num->num) x'' = 0`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `(p2:num->num) x'' = 0`); + (ASM_SIMP_TAC[]); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `(q:num->num) x'' = 3`); + (NEW_GOAL `(p1:num->num) x'' = 1`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `(p2:num->num) x'' = 1`); + (ASM_SIMP_TAC[]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `(q:num->num) x'' > 3`); + (ASM_ARITH_TAC); + (NEW_GOAL `(p1:num->num) x'' > 3`); + (ASM_SIMP_TAC[]); + (ASM_SIMP_TAC[]); + + (REWRITE_TAC[Packing3.LIST_EL_EQ]); + +(* ------------------------------------------------------------------------- *) + + (REWRITE_WITH `LENGTH (vl1:(real^3)list) = 4`); + (REWRITE_WITH `(vl1:(real^3)list) = vl`); + (UNDISCH_TAC `e1:real^3->bool,e2:real^3->bool,p1:num->num,vl1:(real^3)list + = e',e'',p,vl` THEN REWRITE_TAC[PAIR_EQ]); + (MESON_TAC[]); + (ASM_REWRITE_TAC[left_action_list; TABLE_4; LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`]); + (REWRITE_WITH `LENGTH (vl2:(real^3)list) = 4`); + (REWRITE_WITH `(vl2:(real^3)list) = vl'`); + (UNDISCH_TAC `f1:real^3->bool,f2:real^3->bool,p2:num->num,vl2:(real^3)list + = e''',e'''',p',vl'` THEN REWRITE_TAC[PAIR_EQ]); + (MESON_TAC[]); + (ASM_REWRITE_TAC[left_action_list; TABLE_4; LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`]); + (REPEAT STRIP_TAC); + + (ASM_CASES_TAC `j = 0`); + (NEW_GOAL `EL 2 [EL 2 vl1; EL 3 vl1; EL 0 vl1; EL 1 (vl1:(real^3)list)] = + EL 2 [EL 2 vl2; EL 3 vl2; EL 0 vl2; EL 1 vl2]`); + (AP_TERM_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH + `EL 2 [EL 2 vl1; EL 3 vl1; EL 0 vl1; EL 1 (vl1:(real^3)list)] = EL 0 vl1 /\ + EL 2 [EL 2 vl2; EL 3 vl2; EL 0 vl2; EL 1 (vl2:(real^3)list)] = EL 0 vl2`); + (REWRITE_TAC[EL;HD;TL;ARITH_RULE`1=SUC 0/\2=SUC 1/\3=SUC 2`]); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `j = 1`); + (NEW_GOAL `EL 3 [EL 2 vl1; EL 3 vl1; EL 0 vl1; EL 1 (vl1:(real^3)list)] = + EL 3 [EL 2 vl2; EL 3 vl2; EL 0 vl2; EL 1 vl2]`); + (AP_TERM_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH + `EL 3 [EL 2 vl1; EL 3 vl1; EL 0 vl1; EL 1 (vl1:(real^3)list)] = EL 1 vl1 /\ + EL 3 [EL 2 vl2; EL 3 vl2; EL 0 vl2; EL 1 (vl2:(real^3)list)] = EL 1 vl2`); + (REWRITE_TAC[EL;HD;TL;ARITH_RULE`1=SUC 0/\2=SUC 1/\3=SUC 2`]); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `j = 2`); + (NEW_GOAL `EL 0 [EL 2 vl1; EL 3 vl1; EL 0 vl1; EL 1 (vl1:(real^3)list)] = + EL 0 [EL 2 vl2; EL 3 vl2; EL 0 vl2; EL 1 vl2]`); + (AP_TERM_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH + `EL 0 [EL 2 vl1; EL 3 vl1; EL 0 vl1; EL 1 (vl1:(real^3)list)] = EL 2 vl1 /\ + EL 0 [EL 2 vl2; EL 3 vl2; EL 0 vl2; EL 1 (vl2:(real^3)list)] = EL 2 vl2`); + (REWRITE_TAC[EL;HD;TL;ARITH_RULE`1=SUC 0/\2=SUC 1/\3=SUC 2`]); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `j = 3`); + (NEW_GOAL `EL 1 [EL 2 vl1; EL 3 vl1; EL 0 vl1; EL 1 (vl1:(real^3)list)] = + EL 1 [EL 2 vl2; EL 3 vl2; EL 0 vl2; EL 1 vl2]`); + (AP_TERM_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH + `EL 1 [EL 2 vl1; EL 3 vl1; EL 0 vl1; EL 1 (vl1:(real^3)list)] = EL 3 vl1 /\ + EL 1 [EL 2 vl2; EL 3 vl2; EL 0 vl2; EL 1 (vl2:(real^3)list)] = EL 3 vl2`); + (REWRITE_TAC[EL;HD;TL;ARITH_RULE`1=SUC 0/\2=SUC 1/\3=SUC 2`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `X:real^3->bool = {}`); + (ASM_MESON_TAC[]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `{e | e IN critical_edgeX V X} = {}`); + (REWRITE_TAC[SET_RULE `{x| x IN s} = s`]); + (ASM_REWRITE_TAC[critical_edgeX; edgeX]); + (REWRITE_WITH `VX V {} = {}`); + (REWRITE_TAC [VX]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (ASM_MESON_TAC[]); + (REWRITE_WITH `{{u:real^3, v:real^3} | {} u /\ {} v /\ ~(u = v)} = + {{u, v} | u IN {} /\ v IN {} /\ ~(u = v)}`); + (REWRITE_TAC[IN]); + (REWRITE_TAC[MESON[NOT_IN_EMPTY] `x IN {} <=> F`]); + (REWRITE_WITH `{{u:real^3, v:real^3} | F} = {}`); + (REWRITE_TAC[SET_EQ_LEMMA; IN; IN_ELIM_THM]); + (GEN_TAC); + (REWRITE_WITH `{} (x:real^3->bool) <=> x IN {}`); + (REWRITE_TAC[IN]); + (SET_TAC[]); + (REWRITE_TAC[MESON[NOT_IN_EMPTY] `x IN {} <=> F`]); + (REWRITE_TAC[SET_EQ_LEMMA; IN; IN_ELIM_THM]); + (GEN_TAC); + (REWRITE_WITH `{} (x:real^3->bool) <=> x IN {}`); + (REWRITE_TAC[IN]); + (SET_TAC[]); + (REWRITE_TAC[SUM_CLAUSES])]);; + + + + +end;; + diff --git a/legacy/oldpacking/packing/development/working.hl b/legacy/oldpacking/packing/development/working.hl new file mode 100644 index 0000000..a6f651e --- /dev/null +++ b/legacy/oldpacking/packing/development/working.hl @@ -0,0 +1,24 @@ +loads "/home/ky/flyspeck/working/REUHADY.hl";; +loads "/home/ky/flyspeck/working/TSKAJXY_lemmas.hl";; + +let h0cut = new_definition `h0cut y = if (y <= &2 * h0) then &1 else &0`;; + + +let cell3_from_ineq = + `!y4 y5 y6. + &2 <= y4 /\ + &2 <= y5 /\ + &2 <= y6 /\ + y4 <= &2 * sqrt (&2) /\ + y5 <= &2 * sqrt (&2) /\ + y6 <= &2 * sqrt (&2) /\ + eta_y y4 y5 y6 < sqrt (&2) + ==> &0 <= gamma3f y4 y5 y6 sqrt2 lmfun`;; + +let GRKIBMP_concl = + `!y. &2 <= y /\ y <= sqrt8 ==> + &0 <= gamma2_x_div_azim (h0cut y) (y*y)`;; + +let tsk_hyp_new = mk_conj(GRKIBMP_concl, + mk_conj(cell3_from_ineq,tsk_hyp));; + diff --git a/legacy/oldtame/UBHDEUU.hl b/legacy/oldtame/UBHDEUU.hl new file mode 100644 index 0000000..c3627d2 --- /dev/null +++ b/legacy/oldtame/UBHDEUU.hl @@ -0,0 +1,336 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Lemma: UBHDEUU *) +(* Chapter: Tame Hypermap *) +(* Author: DANG TAT DAT *) +(* Date: 2010-02-26 *) +(* ========================================================================== *) + +(* + +(V,E_{std}) is a fan + +*) + +(* +This file is in desperate need of revision. + +Uses CHEAT_TAC throughout the file. + Doesn't load with the current build. + V is used first as a variable (as in the definition of fan11), then as a defined constant + let V = new_definition `V = ....`. + This prevents it from being loaded again after the first attempt, and makes it incompatible + with most other files. + It defines other single character constants r,p,q,... that are liable to cause problems. + Incompatible with flyspeck-svn-1581 hol_light-svn-14 as of Feb 26, 2010. + +The definitions do not appear to be the standard ones. + +-THales + +*) + + +module Ubhdeuu = struct + + + +(* # use "hol.ml";; *) +(* needs "Multivariate/flyspeck.ml";; *) +(* needs "update_database_310.ml";; *) +(* needs "hypermap.ml";; *) + +flyspeck_needs "general/sphere.hl";; +flyspeck_needs "fan/fan_defs.hl";; + +prioritize_real();; + +(* Fan definition*) +let graph = Fan.graph;; + + +(* new_definition `graph (E:(real^3 ->bool)->bool) <=> (!e. E e ==> (e HAS_SIZE 2))`;; *) + +let fan11 = new_definition `fan11 (V:real^3 -> bool) <=> FINITE V`;; + +let fan21 = new_definition `fan21 (x:real^3,V:real^3 -> bool) <=> ~(x IN V)`;; + +let fan31 = new_definition `fan31 (V:real^3 -> bool,E:(real^3 ->bool)->bool) = E UNION {{v}| v IN V}`;; + +let fan41 = new_definition `fan41 (x:real^3,E:(real^3 ->bool)->bool) <=>(!e. (e IN E) ==> ~(collinear({x} UNION e)))`;; + +let fan51 = new_definition `fan51 (x:real^3,V:real^3 -> bool,E:(real^3 ->bool)->bool) <=> (!e1 e2. (e1 IN fan31(V,E)) /\(e2 IN fan31(V,E))==> ((aff_ge {x} e1) INTER (aff_ge {x} e2) = aff_ge {x} (e1 INTER e2)))`;; + +let new_fan = new_definition `new_fan(x:real^3,V,E) <=> ((UNIONS E) SUBSET V) /\ graph(E) /\ fan11(V) /\ fan21(x,V) /\ fan41(x,E) /\ fan51(x,V,E)`;; + + +(*Contravening Hypermap*) + +(* Changed packing to a thm rather than a definition to make it compatible + with definition in Sphere.packing -Feb 2010, thales *) + +let packing = prove( `packing (S:real^3 -> bool) = (!u v. (u IN S) /\ (v IN S) /\ ~(u = v) ==> (&2 <= dist( u, v)))`,REWRITE_TAC[IN;Sphere.packing]);; + + +let h0 = new_definition `h0 = #1.26`;; (*Definition Const real number*) + +let V = new_definition `V (x:real^3) (S:real^3 -> bool) = {v:real^3|(v IN S) /\ (x IN S) /\ ~(v = x) /\ (dist(v,x) <= (&2)*h0)}`;; + +let ESTD = new_definition `ESTD (V (x:real^3) (S:real^3 -> bool)) = {{v,w}|(v IN (V x S)) /\ (w IN (V x S))/\ ~(v = w) /\ dist(v,w) <= (&2)*h0}`;; + +let ECNT = new_definition `ECNT (V (x:real^3) (S:real^3 -> bool)) = {{v,w}|(v IN (V x S)) /\ (w IN (V x S))/\ ~(v = w) /\ dist(v,w) = &2}`;; + +(* UBHDEUU*) + +(* Let Proof (x,V,ESTD) is a fan*) +let them1 = prove(`!x (y:real^3)(S:real^3 -> bool).(packing S) /\ (x IN S) /\ (y IN S)/\ ~(x = y) ==> (&2 <= dist(x,y))`,REWRITE_TAC [packing] THEN REPEAT STRIP_TAC THEN ASM_MESON_TAC [packing]);; + +let cautruc1 = prove (`!(x:real^3)(S:real^3->bool).(packing S) /\ (x IN S) ==> (V x S) SUBSET (S INTER (ball(x,(&2*h0 + &1))))`,REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC [ball;V;SUBSET;INTER] THEN STRIP_TAC THEN REWRITE_TAC [IN_ELIM_THM] THEN STRIP_TAC THEN ASM_REWRITE_TAC [] THEN SUBGOAL_THEN `&2 * h0 < &2 * h0 + &1` ASSUME_TAC THENL [ARITH_TAC;SUBGOAL_THEN `dist(x':real^3,x:real^3) < &2 * h0 + &1` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `dist(x':real^3,x:real^3) = dist(x,x')` ASSUME_TAC THENL [MESON_TAC [DIST_SYM];ASM_ARITH_TAC]]]);; + +(* USE the lemma5.1( KIUMVTC) *) +let KIUMVTC = prove (`!(x:real^3) (b:real) (S:real^3 -> bool). &0 <= b /\ packing S ==> FINITE (S INTER ball (x,b))`, CHEAT_TAC);; + +let cautruc2 = prove(`!(x:real^3)(S:real^3 -> bool). (x IN S)/\ (packing S) ==> FINITE (S INTER (ball(x,(&2*h0 + &1))))`,REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `&0 <= &2*h0 + &1` ASSUME_TAC THENL [REWRITE_TAC [h0] THEN ARITH_TAC;ASM_MESON_TAC [KIUMVTC]]);; + +let them2 = prove(`!(x:real^3) (y:real^3)(S:real^3 -> bool). (x IN S)/\(packing S) ==> (FINITE(V x S))`,REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `!x b S. &0 <= b /\ packing S ==> FINITE (S INTER ball (x,b))` ASSUME_TAC THENL [MESON_TAC [KIUMVTC];SUBGOAL_THEN `FINITE ((S:real^3->bool) INTER (ball(x:real^3,(&2*h0 + &1))))` ASSUME_TAC THENL [ASM_MESON_TAC [cautruc2];SUBGOAL_THEN `(V (x:real^3) (S:real^3->bool)) SUBSET (S INTER (ball(x,(&2*h0 + &1))))` ASSUME_TAC THENL [ASM_MESON_TAC [cautruc1];ASM_MESON_TAC [FINITE_SUBSET]]]]);; + +let them3 = prove(`!(x:real^3)(S:real^3 -> bool). (packing S) /\ (x IN S) ==> ~(x IN (V x S))`,REWRITE_TAC [packing] THEN REWRITE_TAC [V] THEN REWRITE_TAC [IN_ELIM_THM]);; + +let cautruc3 = prove(`!(a:real^3)(b:real^3)(c:real^3).(~(a = b))/\ (~(b = c)) /\ (~(c = a))/\ (dist(a,b) <= &2*h0) /\ (&2 <= dist(a,b))/\ (dist(b,c) <= &2*h0) /\ (&2 <= dist(b,c))/\ (dist(c,a) <= &2*h0) /\ (&2 <= dist(c,a))==> (~(angle(a,b,c)= &0))`,REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC [ANGLE_EQ_0_DIST_ABS] THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN SUBGOAL_THEN `dist(c:real^3,b:real^3) = dist(b,c)` ASSUME_TAC THENL [ASM_MESON_TAC [DIST_SYM];SUBGOAL_THEN `&2 <= dist(c:real^3,b:real^3)` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN ` --dist (c:real^3,b:real^3) <= -- &2` ASSUME_TAC THENL [ASM_MESON_TAC [REAL_LE_NEG];SUBGOAL_THEN `dist (a:real^3,b:real^3) - dist (c:real^3,b) <= &2*h0 - &2` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `dist (c:real^3,b:real^3) <= &2 * h0` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `-- (&2*h0) <= --dist (c:real^3,b:real^3)` ASSUME_TAC THENL [ASM_MESON_TAC [REAL_LE_NEG];SUBGOAL_THEN `&2 - &2*h0 <= dist (a:real^3,b:real^3) - dist (c:real^3,b)` ASSUME_TAC THENL[ASM_ARITH_TAC;SUBGOAL_THEN `-- (&2*h0 - &2) = -- &2*h0 + -- (-- &2) ` ASSUME_TAC THENL [REAL_ARITH_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_NEG_NEG] THEN STRIP_TAC;SUBGOAL_THEN `-- (&2*h0 - &2) <= dist (a:real^3,b:real^3) - dist (c:real^3,b)` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `abs (dist (a:real^3,b:real^3) - dist (c:real^3,b)) <= &2*h0 - &2` ASSUME_TAC THENL [ASM_MESON_TAC [REAL_BOUNDS_LE];SUBGOAL_THEN `dist(a:real^3,c:real^3) = dist (c:real^3,a:real^3)` ASSUME_TAC THENL [MESON_TAC [DIST_SYM];SUBGOAL_THEN `&2 <= dist(a:real^3,c:real^3)` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `&2*h0 - &2 < &2` ASSUME_TAC THENL[REWRITE_TAC [h0] THEN ARITH_TAC;SUBGOAL_THEN ` &2*h0 - &2 < dist (a:real^3,c:real^3)` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `abs (dist (a:real^3,b:real^3) - dist (c:real^3,b)) < dist(a,c)` ASSUME_TAC THENL [ASM_ARITH_TAC;ASM_ARITH_TAC]]]]]]]]]]]]]]]);; +(*Proff~(angle (a,b,c) = pi)*) +let cautruc4 = prove(`!(a:real^3)(b:real^3)(c:real^3).(~(a = b))/\ (~(b = c)) /\ (~(c = a))/\ (dist(a,b) <= &2*h0) /\ (&2 <= dist(a,b))/\ (dist(b,c) <= &2*h0) /\ (&2 <= dist(b,c))/\ (dist(c,a) <= &2*h0) /\ (&2 <= dist(c,a))==> (~(angle(a,b,c)= pi))`,REPEAT GEN_TAC THEN STRIP_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `between (b:real^3) (a:real^3,c:real^3)` ASSUME_TAC THENL [ASM_MESON_TAC [BETWEEN_ANGLE];SUBGOAL_THEN `dist (a:real^3,c:real^3) = dist (a,b) + dist (b,c:real^3)` ASSUME_TAC THENL [ASM_MESON_TAC [between];SUBGOAL_THEN `&2 + &2 <= dist (a:real^3,b:real^3) + dist (b,c:real^3)` ASSUME_TAC THENL[ASM_ARITH_TAC;SUBGOAL_THEN `&2 + &2 <= dist(a:real^ 3,c:real^3)` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `dist(c:real^3,a:real^3) = dist(a:real^3,c)` ASSUME_TAC THENL[MESON_TAC [DIST_SYM];SUBGOAL_THEN `&2 + &2 <= dist(c:real^3,a:real^3)` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `&2*h0 < &2 + &2` ASSUME_TAC THENL [REWRITE_TAC [h0] THEN ARITH_TAC;SUBGOAL_THEN `&2*h0 < dist(c:real^3,a:real^3)` ASSUME_TAC THENL [ASM_ARITH_TAC;ASM_ARITH_TAC]]]]]]]]);; + +let cautruc5 = prove(`!(a:real^3)(b:real^3)(c:real^3).(~(a = b))/\ (~(b = c)) /\ (~(c = a))/\ (dist(a,b) <= &2*h0) /\ (&2 <= dist(a,b))/\ (dist(b,c) <= &2*h0) /\ (&2 <= dist(b,c))/\ (dist(c,a) <= &2*h0) /\ (&2 <= dist(c,a))==>(~(angle(a,b,c)= &0))/\ (~(angle(a,b,c)= pi))`,REPEAT GEN_TAC THEN STRIP_TAC THEN STRIP_TAC THENL [ASM_MESON_TAC [cautruc3];ASM_MESON_TAC [cautruc4]]);; + + +let cautruc6 = prove(`!(a:real^3)(b:real^3)(c:real^3).(~(a=b)) /\ (~(b=c)) /\ (~(angle (a,b,c) = &0))/\ (~(angle (a,b,c) = pi)) ==> ~(collinear{a,b,c})`,REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `~(a:real^3 = b:real^3) /\ ~(b = c:real^3)==> (collinear {a, b, c} <=> angle (a,b,c) = &0 \/ angle (a,b,c) = pi)` ASSUME_TAC THENL [STRIP_TAC THEN ASM_MESON_TAC[COLLINEAR_ANGLE];POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]]);; + +let cautruc7 = prove(`!(a:real^3)(b:real^3)(c:real^3).(~(a = b))/\ (~(b = c)) /\ (~(c = a))/\ (dist(a,b) <= &2*h0 /\ (&2 <= dist(a,b)) /\ (&2 <= dist(b,c)))/\ (dist(c,a) <= &2*h0) /\ (&2 <= dist(c,a))==> (~(angle(a,b,c)= pi))`,REPEAT GEN_TAC THEN STRIP_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `between (b:real^3) (a:real^3,c:real^3)` ASSUME_TAC THENL [ASM_MESON_TAC [BETWEEN_ANGLE];SUBGOAL_THEN `dist (a:real^3,c:real^3) = dist (a,b) + dist (b,c:real^3)` ASSUME_TAC THENL [ASM_MESON_TAC [between];SUBGOAL_THEN `&2 + &2 <= dist (a:real^3,b:real^3) + dist (b,c:real^3)` ASSUME_TAC THENL[ASM_ARITH_TAC;SUBGOAL_THEN `&2 + &2 <= dist(a:real^ 3,c:real^3)` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `dist(c:real^3,a:real^3) = dist(a:real^3,c)` ASSUME_TAC THENL[MESON_TAC [DIST_SYM];SUBGOAL_THEN `&2 + &2 <= dist(c:real^3,a:real^3)` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `&2*h0 < &2 + &2` ASSUME_TAC THENL [REWRITE_TAC [h0] THEN ARITH_TAC;SUBGOAL_THEN `&2*h0 < dist(c:real^3,a:real^3)` ASSUME_TAC THENL [ASM_ARITH_TAC;ASM_ARITH_TAC]]]]]]]]);; + +let IN1 = prove(`!(x:A)(a:A)(b:A). x IN {a,b} <=> (x = a) \/ (x = b) `,REPEAT GEN_TAC THEN REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY]);; + +let IN2 = prove(`!(x:A)(a:A)(b:A)(c:A). x IN {a,b,c} <=> (x = a) \/ (x = b) \/ (x = c) `,REPEAT GEN_TAC THEN REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY]);; + +let SUBSET1 = prove(`!(a:real^3)(b:real^3)(x:real^3).{a,b,x} SUBSET ({x} UNION {a,b})`,REPEAT GEN_TAC THEN REWRITE_TAC [SUBSET;UNION] THEN GEN_TAC THEN REWRITE_TAC [IN2;IN1;IN_ELIM_THM] THEN STRIP_TAC THENL [ASM_MESON_TAC[];ASM_MESON_TAC[];REWRITE_TAC [IN_SING] THEN ASM_MESON_TAC []]);; + +let them4 = prove( `!(a:real^3)(b:real^3)(x:real^3)(S:real^3 -> bool). (packing S) /\ (x IN S) /\ ({a,b} IN (ESTD(V x S))) ==> ~(collinear ({x} UNION {a,b}))`,REWRITE_TAC [ESTD;V;IN_ELIM_PAIR_THM;IN_ELIM_THM] THEN REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC [] THEN STRIP_TAC THEN SUBGOAL_THEN `&2 <= dist(v:real^3,x:real^3)` ASSUME_TAC THENL [ASM_MESON_TAC [them1];SUBGOAL_THEN `&2 <= dist(w:real^3,x:real^3)` ASSUME_TAC THENL [ASM_MESON_TAC [them1];SUBGOAL_THEN `&2 <= dist(v:real^3,w:real^3)` ASSUME_TAC THENL [ASM_MESON_TAC [them1];SUBGOAL_THEN `dist(v:real^3,x:real^3) = dist(x,v)` ASSUME_TAC THENL [MESON_TAC [DIST_SYM];SUBGOAL_THEN `dist(x:real^3,v:real^3) <= &2*h0` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `&2 <= dist(x:real^3,v:real^3)` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `v:real^3 = x:real^3 <=> x = v` ASSUME_TAC THENL [MESON_TAC [EQ_SYM_EQ];SUBGOAL_THEN `(~(x:real^3 = v:real^3))` ASSUME_TAC THENL [ASM_MESON_TAC[];SUBGOAL_THEN `(~(angle(v:real^3,w:real^3,x:real^3) = &0)) /\ (~(angle(v,w,x) = pi))` ASSUME_TAC THENL [ASM_MESON_TAC [cautruc5];SUBGOAL_THEN `{v:real^3,w:real^3,x:real^3} SUBSET ({x} UNION {v,w})` ASSUME_TAC THENL [MESON_TAC [SUBSET1]; +SUBGOAL_THEN `collinear ({v:real^3,w:real^3,x:real^3})` ASSUME_TAC THENL [ASM_MESON_TAC [COLLINEAR_SUBSET];SUBGOAL_THEN `~collinear ({v:real^3,w:real^3,x:real^3})` ASSUME_TAC THENL [ASM_MESON_TAC [cautruc6];ASM_ARITH_TAC]]]]]]]]]]]]);; + +let eunion = new_definition `Eunion (x:real^3) (S:real^3->bool) = UNIONS ( ESTD (V x S))`;; + +let them5 = prove(`!(x:real^3)(S:real^3 -> bool).(Eunion x S) SUBSET (V x S)`,REPEAT GEN_TAC THEN REWRITE_TAC [eunion;ESTD;UNIONS;SUBSET;IN_ELIM_THM] THEN GEN_TAC THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC [IN1] THEN STRIP_TAC THENL [ASM_REWRITE_TAC[];ASM_REWRITE_TAC[]]);; + +let them6 = prove(`!(x:real^3)(S:real^3 -> bool) e. e IN (ESTD(V x S)) ==> (e HAS_SIZE 2)`,REPEAT GEN_TAC THEN REWRITE_TAC [HAS_SIZE_2_EXISTS;ESTD;IN_ELIM_THM] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN EXISTS_TAC `v:real^3` THEN EXISTS_TAC `w:real^3` THEN STRIP_TAC THENL [ASM_MESON_TAC[];STRIP_TAC THEN REWRITE_TAC [IN1]]);; + +let them7 = prove(`!(x:real^3) (S:real^3 -> bool). (packing S) /\ (x IN S) ==> !e. e IN ESTD (V x S) ==> ~collinear ({x} UNION e)`,REPEAT GEN_TAC THEN STRIP_TAC THEN GEN_TAC THEN REWRITE_TAC [ESTD;V;IN_ELIM_THM] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN SUBGOAL_THEN `{v:real^3,w:real^3} IN (ESTD (V x S))` ASSUME_TAC THENL [REWRITE_TAC [ESTD;V;IN_ELIM_THM] THEN EXISTS_TAC `v:real^3` THEN EXISTS_TAC `w:real^3` THEN REPEAT STRIP_TAC THENL [ASM_REWRITE_TAC[];ASM_REWRITE_TAC[];POP_ASSUM MP_TAC THEN REWRITE_TAC[] THEN ASM_REWRITE_TAC[];ASM_REWRITE_TAC[];ASM_REWRITE_TAC[];ASM_REWRITE_TAC[];POP_ASSUM MP_TAC THEN REWRITE_TAC[] THEN ASM_REWRITE_TAC[];ASM_REWRITE_TAC[];POP_ASSUM MP_TAC THEN REWRITE_TAC[] THEN ASM_REWRITE_TAC[];ASM_ARITH_TAC;ARITH_TAC];ASM_MESON_TAC [them4]]);; + +(*My definition--------------------------------------- To proof this lemma! i'll proof it later *) + + +let sigma_set1 = new_definition `sigma_set1 (x:real^3) (S:real^3->bool) = (ESTD(V x S)) UNION {{v}|v IN (V x S)}`;; + +let dn1 = prove(`!(v:real^3)(v':real^3). (~(v = v')) ==> {v} INTER {v'} = {}`,CHEAT_TAC);; +let dn111 = prove(`!(v:real^3)(v':real^3) (w:real^3). (~(v = v')) /\ (~(v = w)) ==> {v} INTER {v',w} = {}`,CHEAT_TAC);; +let dn112 = prove(`!(v:real^3)(v':real^3)(w:real^3) (w':real^3).(~({v, w} = {v', w'}))/\ (~(v = v')) /\ (~(v = w')) /\ (~(w = v')) /\ (~(w = w')) ==> {v,w} INTER {v',w'} = {}`,CHEAT_TAC);; + +let dn2 = prove (`!x:real^3. aff_ge {x} {}={x}`, CHEAT_TAC );; + +let dn3 = prove (`!x:real^3 v:real^3. aff_ge {x} {v}={y:real^3 | ?t1:real t2:real. (t2 >= &0)/\ (t1 + t2= &1) /\ (y = t1 % x + t2 % v)}`,CHEAT_TAC);; + +let dn4 = prove (`!x:real^3 v:real^3 w:real^3. aff_ge {x} {v,w} = {y:real^3 | ?t1:real (t2:real) t3:real. (t2 >= &0) /\ (t3 >= &0) /\ (t1 + t2 + t3 = &1) /\ (y = t1 % x + t2 % v + t3 % w)}`, CHEAT_TAC);; + +let dn5 = prove (`!(v:real^3)(v':real^3)(w:real^3).(~(v=v')) /\ (~(v=w)) ==> {v} INTER {v',w} = {}`,CHEAT_TAC);; +let dn51 =prove (`!(v:real^3)(v':real^3)(w:real^3).(~(v' = v)) /\ (~(v' = w)) ==> {v,w} INTER {v'} = {}`,CHEAT_TAC);; + +let dn6 = prove (`!(v':real^3)(w:real^3). {v'} INTER {v',w} = {v'}`,CHEAT_TAC);; +let dn61 = prove (`!(v':real^3)(w:real^3). {w} INTER {v',w} = {w}`,CHEAT_TAC);; +let dn62 = prove (`!(v':real^3)(w:real^3). {v,w} INTER {v} = {v}`,CHEAT_TAC);; +let dn63 = prove (`!(v':real^3)(w:real^3). {v,w} INTER {w} = {w}`,CHEAT_TAC);; + +let dn7 = prove (`!(v:real^3)(v':real^3)(w:real^3).(v = w) ==> {v} INTER {v',w} = {v}`,CHEAT_TAC);; + +let dn8 = prove (`!(v:real^3)(v':real^3)(w:real^3)(w':real^3).{v',w'} INTER {v',w'} = {v',w'}`,CHEAT_TAC);; + +let dn9 = prove (`!(v:real^3)(v':real^3)(w:real^3)(w':real^3). ~({v,w} = {v',w'}) ==> {v',w} INTER {v',w'} = {v'}`,CHEAT_TAC);; +let dn91 = prove (`!(v:real^3)(v':real^3)(w:real^3)(w':real^3). ~({v,w} = {v',w'}) ==> {w',w} INTER {v',w'} = {w'}`,CHEAT_TAC);; +let dn92 = prove (`!(v:real^3)(v':real^3)(w':real^3). ~({v,w} = {v',w'}) ==> ({v, v'} INTER {v', w'}) = {v'}`,CHEAT_TAC);; +let dn93 = prove (`!(v:real^3)(v':real^3)(w':real^3). ~({v,w} = {v',w'}) ==> ({v, w'} INTER {v', w'}) = {w'}`,CHEAT_TAC);; + +let dn10 = prove (`!(v:real^3)(v':real^3)(x:real^3).( (a:real) % v + (b:real) % v' + (c:real) % x = vec 0) ==> a = &0 /\ b = &0 /\ c = &0`,CHEAT_TAC);; + +let dn11 = prove (`!(v:real^3)(v':real^3)(x:real^3)(w:real^3).( (a:real) % v + (b:real) % v' + (c:real) % x + (d:real) % w = vec 0) ==> a = &0 /\ b = &0 /\ c = &0 /\ d = &0`,CHEAT_TAC);; + +let dn12 = prove (`!(v:real^3)(v':real^3)(x:real^3)(w:real^3)(w':real^3).( (a:real) % v + (b:real) % v' + (c:real) % x + (d:real) % w + (e:real)%w' = vec 0) ==> a = &0 /\ b = &0 /\ c = &0 /\ d = &0 /\ e = &0`,CHEAT_TAC);; + +let logic1 = prove(`!p q r. p /\ (p \/ r) = p`,CHEAT_TAC);; +(*-------------------------------------------------------------------------*) + +(*4 SUBGOAL*) +(*SUB1*) +(*Case v = v' *) +let SUBCASE1 = prove (`!(v:real^3) (v':real^3) (x:real^3)(S:real^3->bool).(v IN S) /\ (x IN S ) /\ (v' IN S) /\ (~(v = x)) /\ (~(v' = x)) /\ (dist (v,x) <= &2 * h0) /\ (dist (v',x) <= &2 * h0) /\ (e1 = {v}) /\ (e2 = {v'}) /\ (v = v') ==> (!x'.x' IN {y | ?t1 t2. t2 >= &0 /\ t1 + t2 = &1 /\ y = t1 % x + t2 % v} INTER {y | ?t1 t2. t2 >= &0 /\ t1 + t2 = &1 /\ y = t1 % x + t2 % v'} ==> x' IN aff_ge {x} ({v} INTER {v'}))`, REPEAT GEN_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN REWRITE_TAC [IN_SING;SING_GSPEC;INTER;IN_ELIM_THM] THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC [IN_SING;SING_GSPEC;dn3;IN_ELIM_THM]);; + +let SUBCASE2 = prove(`!(v:real^3) (v':real^3) (x:real^3)(S:real^3->bool).(v IN S) /\ (x IN S ) /\ (v' IN S) /\ (~(v = x)) /\ (~(v' = x)) /\ (dist (v,x) <= &2 * h0) /\ (dist (v',x) <= &2 * h0) /\ (e1 = {v}) /\ (e2 = {v'}) /\ (~(v = v')) ==> (!x'.x' IN {y | ?t1 t2. t2 >= &0 /\ t1 + t2 = &1 /\ y = t1 % x + t2 % v} INTER {y | ?t1 t2. t2 >= &0 /\ t1 + t2 = &1 /\ y = t1 % x + t2 % v'} ==> x' IN aff_ge {x} ({v} INTER {v'}))`,REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `{v:real^3} INTER {v':real^3} = {}` ASSUME_TAC THENL [ASM_MESON_TAC[dn1];ASM_REWRITE_TAC[]] THEN REWRITE_TAC [INTER;dn2;IN_SING;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN SUBGOAL_THEN `(x':real^3) - ((t1':real) % (x:real^3) + (t2':real) % (v':real^3)) = vec 0` ASSUME_TAC THENL [POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC;POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]] THEN REWRITE_TAC[VECTOR_ARITH `(t1 % x + t2 % v) - (t1' % x + t2' % v')= ((t1:real)- (t1':real)) % (x:real^3) + (t2:real) % (v:real^3) + (--(t2':real) % (v':real^3))`] THEN STRIP_TAC THEN SUBGOAL_THEN `(t1:real - t1':real) = &0 /\ t2:real = &0 /\ --t2':real = &0` ASSUME_TAC THENL [ASM_MESON_TAC [dn10];SUBGOAL_THEN `((t1:real) = (t1':real))` ASSUME_TAC THENL [ASM_MESON_TAC[REAL_SUB_0];SUBGOAL_THEN `(t1':real) + &0 = &1` ASSUME_TAC THENL [ASM_MESON_TAC[];SUBGOAL_THEN `(t1':real) = &1` ASSUME_TAC THENL [ASM_ARITH_TAC;ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC]]]]);; + +let cautruc8 = prove(`!(v:real^3) (v':real^3) (x:real^3)(S:real^3->bool).(v IN S) /\ (x IN S) /\ (v' IN S) /\ (~(v=x)) /\ (~(v'=x)) /\ (dist (v,x) <= &2 * h0) /\ (dist (v',x) <= &2 * h0) /\ e1 = {v} /\ e2 = {v'} ==> aff_ge {x} e1 INTER aff_ge {x} e2 = aff_ge {x} (e1 INTER e2)`,REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC [EXTENSION;GSYM SUBSET_ANTISYM_EQ;SUBSET] THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC [IN_ELIM_THM] THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL [REWRITE_TAC [dn3] THEN GEN_TAC THEN REWRITE_TAC [IN_ELIM_THM] THEN ASM_CASES_TAC `v:real^3 = v':real^3` THENL[ASM_MESON_TAC [SUBCASE1];ASM_MESON_TAC [SUBCASE2]];ASM_CASES_TAC `v:real^3 = v':real^3` THENL [ASM_REWRITE_TAC[] THEN REWRITE_TAC [IN_SING;SING_GSPEC;INTER;IN_ELIM_THM];GEN_TAC THEN SUBGOAL_THEN `{v:real^3} INTER {v':real^3} = {}` ASSUME_TAC] THENL [ASM_MESON_TAC[dn1];ASM_REWRITE_TAC[]] THEN REWRITE_TAC [dn2;IN_SING;dn3;INTER;IN_ELIM_THM] THEN REPEAT STRIP_TAC THENL [EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL [ARITH_TAC;STRIP_TAC THENL [ARITH_TAC;VECTOR_ARITH_TAC]];EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN STRIP_TAC THENL [ARITH_TAC;STRIP_TAC THENL [ARITH_TAC;ASM_REWRITE_TAC[]THEN VECTOR_ARITH_TAC]]]]);; + +(*--------------------------------------------------------------------------------------*) +(*SUB2*) +let SUBCASE3 = prove(`!(v:real^3) (v':real^3) (x:real^3)(S:real^3->bool). (v IN S) /\ (x IN S) /\ (~(v = x)) /\ (dist (v,x) <= &2 * h0) /\ ( e1 = {v})/\ ( v' IN S) /\ ( ~(v' = x)) /\ ( dist (v',x) <= &2 * h0) /\ ( w IN S) /\ ( ~(w = x)) /\ (dist (w,x) <= &2 * h0) /\ (~(v' = w)) /\ (dist (v',w) <= &2 * h0) /\ (e2 = {v', w}) /\ (v = v') ==>(?t1 t2. t2 >= &0 /\ t1 + t2 = &1 /\ x' = t1 % x + t2 % v) /\(?t1 t2 t3. t2 >= &0 /\ t3 >= &0 /\ t1 + t2 + t3 = &1 /\ x' = t1 % x + t2 % v' + t3 % w) ==> x' IN aff_ge {x} {x | x IN {v} /\ x IN {v', w}}`,REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC [] THEN STRIP_TAC THEN REWRITE_TAC [GSYM INTER;dn6;dn3;IN_ELIM_THM] THEN EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN STRIP_TAC THENL [ASM_MESON_TAC[];STRIP_TAC THENL [ASM_MESON_TAC[];ASM_MESON_TAC[]]]);; + +let SUBCASE4 = prove(`!(v:real^3) (v':real^3) (x:real^3)(w:real^3)(S:real^3->bool). (v IN S) /\ (x IN S) /\ (~(v = x)) /\ (dist (v,x) <= &2 * h0) /\ ( e1 = {v})/\ ( v' IN S) /\ ( ~(v' = x)) /\ ( dist (v',x) <= &2 * h0) /\ ( w IN S) /\ ( ~(w = x)) /\ (dist (w,x) <= &2 * h0) /\ (~(v' = w)) /\ (dist (v',w) <= &2 * h0) /\ (e2 = {v', w}) /\ ~(v = v') /\ (v = w) ==>(?t1 t2. t2 >= &0 /\ t1 + t2 = &1 /\ x' = t1 % x + t2 % v) /\(?t1 t2 t3. t2 >= &0 /\ t3 >= &0 /\ t1 + t2 + t3 = &1 /\ x' = t1 % x + t2 % v' + t3 % w) ==> x' IN aff_ge {x} {x | x IN {v} /\ x IN {v', w}}`,REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC [] THEN STRIP_TAC THEN REWRITE_TAC [GSYM INTER;dn61;dn3;IN_ELIM_THM] THEN EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN STRIP_TAC THENL [ASM_MESON_TAC[];STRIP_TAC THENL [ASM_MESON_TAC[];ASM_MESON_TAC[]]]);; + +let SUBCASE5 = prove( `!(v:real^3) (v':real^3) (x:real^3)(w:real^3)(S:real^3->bool). (v IN S) /\ (x IN S) /\ (~(v = x)) /\ (dist (v,x) <= &2 * h0) /\ ( e1 = {v})/\ ( v' IN S) /\ ( ~(v' = x)) /\ ( dist (v',x) <= &2 * h0) /\ ( w IN S) /\ ( ~(w = x)) /\ (dist (w,x) <= &2 * h0) /\ (~(v' = w)) /\ (dist (v',w) <= &2 * h0) /\ (e2 = {v', w}) /\ ~(v = v') /\ ~(v = w) ==>(?t1 t2. t2 >= &0 /\ t1 + t2 = &1 /\ x' = t1 % x + t2 % v) /\(?t1 t2 t3. t2 >= &0 /\ t3 >= &0 /\ t1 + t2 + t3 = &1 /\ x' = t1 % x + t2 % v' + t3 % w) ==> x' IN aff_ge {x} {x | x IN {v} /\ x IN {v', w}}`,REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC [GSYM INTER] THEN SUBGOAL_THEN `({v:real^3} INTER {v':real^3, w:real^3}) = {}` ASSUME_TAC THENL [ASM_MESON_TAC [dn111];ASM_REWRITE_TAC[]] THEN STRIP_TAC THEN REWRITE_TAC [dn2;IN_SING] THEN SUBGOAL_THEN `(x':real^3) - ((t1':real) % (x:real^3) + (t2':real) % (v':real^3) + (t3:real) % (w:real^3)) = vec 0` ASSUME_TAC THENL [POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC;POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[VECTOR_ARITH `(t1 % x + t2 % v) - (t1' % x + t2' % v' + t3 % w) = ((t1:real)- (t1':real)) % (x:real^3) +((t2:real)%(v:real^3)) + (--(t2':real)%(v':real^3)) + (--(t3:real)%(w:real^3))`] THEN STRIP_TAC THEN SUBGOAL_THEN `((t1:real)- (t1':real)) = &0 /\ (t2:real) = &0 /\ (--(t2':real)) = &0 /\ (--(t3:real)) = &0` ASSUME_TAC THENL [ASM_MESON_TAC [dn11];SUBGOAL_THEN `t1:real = t1':real` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `(t1:real) + &0 = &1` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `t1:real = &1` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `t1':real = &1` ASSUME_TAC THENL [ASM_ARITH_TAC;ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC]]]]]]);; + +let SUBCASE6 = prove( `!(v:real^3) (v':real^3) (x:real^3)(w:real^3)(S:real^3->bool). (v IN S) /\ (x IN S) /\ (~(v = x)) /\ (dist (v,x) <= &2 * h0) /\ ( e1 = {v})/\ ( v' IN S) /\ ( ~(v' = x)) /\ ( dist (v',x) <= &2 * h0) /\ ( w IN S) /\ ( ~(w = x)) /\ (dist (w,x) <= &2 * h0) /\ (~(v' = w)) /\ (dist (v',w) <= &2 * h0) /\ (e2 = {v', w})/\ (v = v')==> !x'. x' IN aff_ge {x} {x | x IN {v} /\ x IN {v', w}} ==> x' IN aff_ge {x} {v} /\ x' IN aff_ge {x} {v', w}`,REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC [] THEN STRIP_TAC THEN REWRITE_TAC [GSYM INTER;dn6;dn3;dn4;IN_ELIM_THM] THEN REPEAT STRIP_TAC THENL [EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]];EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN EXISTS_TAC `&0` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]]]);; + +let SUBCASE7 = prove(`!(v:real^3) (v':real^3) (x:real^3)(w:real^3)(S:real^3->bool). (v IN S) /\ (x IN S) /\ (~(v = x)) /\ (dist (v,x) <= &2 * h0) /\ ( e1 = {v})/\ ( v' IN S) /\ ( ~(v' = x)) /\ ( dist (v',x) <= &2 * h0) /\ ( w IN S) /\ ( ~(w = x)) /\ (dist (w,x) <= &2 * h0) /\ (~(v' = w)) /\ (dist (v',w) <= &2 * h0) /\ (e2 = {v', w})/\ ~(v = v') /\ (v = w)==> !x'. x' IN aff_ge {x} {x | x IN {v} /\ x IN {v', w}} ==> x' IN aff_ge {x} {v} /\ x' IN aff_ge {x} {v', w}`,REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC [] THEN STRIP_TAC THEN REWRITE_TAC [GSYM INTER;dn61;dn3;dn4;IN_ELIM_THM] THEN REPEAT STRIP_TAC THENL [EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN STRIP_TAC THENL[ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]];EXISTS_TAC `t1:real` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `t2:real`THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]]]);; + +let SUBCASE8 = prove(`!(v:real^3) (v':real^3) (x:real^3)(w:real^3)(S:real^3->bool). (v IN S) /\ (x IN S) /\ (~(v = x)) /\ (dist (v,x) <= &2 * h0) /\ ( e1 = {v})/\ ( v' IN S) /\ ( ~(v' = x)) /\ ( dist (v',x) <= &2 * h0) /\ ( w IN S) /\ ( ~(w = x)) /\ (dist (w,x) <= &2 * h0) /\ (~(v' = w)) /\ (dist (v',w) <= &2 * h0) /\ (e2 = {v', w})/\ ~(v = v') /\ ~(v = w)==> !x'. x' IN aff_ge {x} {x | x IN {v} /\ x IN {v', w}} ==> x' IN aff_ge {x} {v} /\ x' IN aff_ge {x} {v', w}`,REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC [GSYM INTER] THEN SUBGOAL_THEN `({v:real^3} INTER {v':real^3, w:real^3}) = {}` ASSUME_TAC THENL [ASM_MESON_TAC [dn111];ASM_REWRITE_TAC[]] THEN STRIP_TAC THEN REWRITE_TAC [dn2;IN_SING;dn3;dn4;IN_ELIM_THM] THEN REPEAT STRIP_TAC THENL [EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN STRIP_TAC THENL[ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]];EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL[ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]]]);; + +let cautruc9 = prove(`!(v:real^3) (v':real^3)(w:real^3) (x:real^3)(S:real^3->bool).(v IN S) /\ (x IN S) /\ (~(v = x)) /\ (dist (v,x) <= &2 * h0) /\ (e1 = {v}) /\ (v' IN S)/\ (~(v' = x)) /\ (dist (v',x) <= &2 * h0) /\ (w IN S) /\ (~(w = x)) /\ (dist (w,x) <= &2 * h0) /\ (~(v' = w)) /\ (dist (v',w) <= &2 * h0) /\ (e2 = {v', w}) ==> {x' | x' IN aff_ge {x} e1 /\ x' IN aff_ge {x} e2} = aff_ge {x} {x | x IN e1 /\ x IN e2}`,REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC [EXTENSION;GSYM SUBSET_ANTISYM_EQ] THEN REWRITE_TAC [SUBSET] THEN REWRITE_TAC [IN_ELIM_THM] THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL (*----*) [REWRITE_TAC [dn3;dn4] THEN GEN_TAC THEN REWRITE_TAC [IN_ELIM_THM] (*v = v'*) THEN ASM_CASES_TAC `(v:real^3 = v':real^3)` THENL [ASM_MESON_TAC [SUBCASE3];(*v = w*) ASM_CASES_TAC `(v:real^3 = w:real^3)` THENL[ASM_MESON_TAC [SUBCASE4]; (* ~(v = v') /\ ~(v = w) *) ASM_MESON_TAC [SUBCASE5]]];(*Small Cases*)(*v = v'*) ASM_CASES_TAC `(v:real^3 = v':real^3)` THENL[ASM_MESON_TAC [SUBCASE6]; (*v = w*) ASM_CASES_TAC `(v:real^3 = w:real^3)` THENL[ASM_MESON_TAC [SUBCASE7];(* ~(v = v') /\ ~(v = w) *) ASM_MESON_TAC [SUBCASE8]]]]);; + +(*SUB3 like SUB2*) + +let SUBCASE31 = prove( `!(v:real^3) (v':real^3)(w:real^3) (x:real^3)(S:real^3->bool).( v IN S) /\ (x IN S) /\ (~(v = x)) /\ (dist (v,x) <= &2 * h0) /\ (w IN S) /\ (~(w = x)) /\ (dist (w,x) <= &2 * h0) /\ (~(v = w)) /\ (dist (v,w) <= &2 * h0) /\ (e1 = {v, w}) /\ (v' IN S) /\ (~(v' = x)) /\ (dist (v',x) <= &2 * h0) /\ (e2 = {v'})/\ (v' = v)==> x' IN {y | ?t1 t2 t3. t2 >= &0 /\ t3 >= &0 /\ t1 + t2 + t3 = &1 /\ y = t1 % x + t2 % v + t3 % w} INTER{y | ?t1 t2. t2 >= &0 /\ t1 + t2 = &1 /\ y = t1 % x + t2 % v'} ==> x' IN aff_ge {x} ({v, w} INTER {v'})`,REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC [] THEN REWRITE_TAC [dn62;dn3;INTER;IN_ELIM_THM] THEN STRIP_TAC THEN EXISTS_TAC `t1':real` THEN EXISTS_TAC `t2':real` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]);; + +let SUBCASE32 = prove(`!(v:real^3) (v':real^3)(w:real^3) (x:real^3)(S:real^3->bool).( v IN S) /\ (x IN S) /\ (~(v = x)) /\ (dist (v,x) <= &2 * h0) /\ (w IN S) /\ (~(w = x)) /\ (dist (w,x) <= &2 * h0) /\ (~(v = w)) /\ (dist (v,w) <= &2 * h0) /\ (e1 = {v, w}) /\ (v' IN S) /\ (~(v' = x)) /\ (dist (v',x) <= &2 * h0) /\ (e2 = {v'})/\ (~(v' = v)) /\ (v' = w)==> x' IN {y | ?t1 t2 t3. t2 >= &0 /\ t3 >= &0 /\ t1 + t2 + t3 = &1 /\ y = t1 % x + t2 % v + t3 % w} INTER{y | ?t1 t2. t2 >= &0 /\ t1 + t2 = &1 /\ y = t1 % x + t2 % v'} ==> x' IN aff_ge {x} ({v, w} INTER {v'})`,REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC [] THEN REWRITE_TAC [dn63;dn3;INTER;IN_ELIM_THM] THEN STRIP_TAC THEN EXISTS_TAC `t1':real` THEN EXISTS_TAC `t2':real` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]);; + +let SUBCASE33 = prove(`!(v:real^3) (v':real^3)(w:real^3) (x:real^3)(S:real^3->bool).( v IN S) /\ (x IN S) /\ (~(v = x)) /\ (dist (v,x) <= &2 * h0) /\ (w IN S) /\ (~(w = x)) /\ (dist (w,x) <= &2 * h0) /\ (~(v = w)) /\ (dist (v,w) <= &2 * h0) /\ (e1 = {v, w}) /\ (v' IN S) /\ (~(v' = x)) /\ (dist (v',x) <= &2 * h0) /\ (e2 = {v'})/\ (~(v' = v)) /\ (~(v' = w)) ==> x' IN {y | ?t1 t2 t3. t2 >= &0 /\ t3 >= &0 /\ t1 + t2 + t3 = &1 /\ y = t1 % x + t2 % v + t3 % w} INTER{y | ?t1 t2. t2 >= &0 /\ t1 + t2 = &1 /\ y = t1 % x + t2 % v'} ==> x' IN aff_ge {x} ({v, w} INTER {v'})`,REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC [GSYM INTER] THEN SUBGOAL_THEN `({v:real^3,w:real^3} INTER {v':real^3}) = {}` ASSUME_TAC THENL [ASM_MESON_TAC [dn51];ASM_REWRITE_TAC[]] THEN REWRITE_TAC [dn2;IN_SING;INTER;IN_ELIM_THM] THEN STRIP_TAC THEN SUBGOAL_THEN `(x':real^3) - ((t1':real) % (x:real^3) + (t2':real) % (v':real^3)) = vec 0` ASSUME_TAC THENL [POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC;POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]] THEN REWRITE_TAC[VECTOR_ARITH `(t1 % x + t2 % v + t3 % w) - (t1' % x + t2' % v') = ((t1:real)- (t1':real)) % (x:real^3) +((t2:real)%(v:real^3)) + (--(t2':real)%(v':real^3)) + (t3:real)%(w:real^3)`] THEN STRIP_TAC THEN SUBGOAL_THEN `((t1:real)- (t1':real)) = &0 /\ (t2:real) = &0 /\ (--(t2':real)) = &0 /\ ((t3:real)) = &0` ASSUME_TAC THENL [ASM_MESON_TAC [dn11];SUBGOAL_THEN `t1:real = t1':real` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `(t1:real) + &0 + &0 = &1` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `t1:real = &1` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `t1':real = &1` ASSUME_TAC THENL [ASM_ARITH_TAC;ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC]]]]]);; + +let SUBCASE34 = prove( `!(v:real^3) (v':real^3)(w:real^3) (x:real^3)(S:real^3->bool).( v IN S) /\ (x IN S) /\ (~(v = x)) /\ (dist (v,x) <= &2 * h0) /\ (w IN S) /\ (~(w = x)) /\ (dist (w,x) <= &2 * h0) /\ (~(v = w)) /\ (dist (v,w) <= &2 * h0) /\ (e1 = {v, w}) /\ (v' IN S) /\ (~(v' = x)) /\ (dist (v',x) <= &2 * h0) /\ (e2 = {v'})/\ ((v' = v))==> !x'. x' IN aff_ge {x} ({v, w} INTER {v'}) ==> x' IN aff_ge {x} {v, w} INTER aff_ge {x} {v'}`,REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC [] THEN STRIP_TAC THEN REWRITE_TAC [dn62;dn3;dn4;INTER;IN_ELIM_THM] THEN REPEAT STRIP_TAC THENL [EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN EXISTS_TAC `&0` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]];EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]]);; + +let SUBCASE35 = prove(`!(v:real^3) (v':real^3)(w:real^3) (x:real^3)(S:real^3->bool).( v IN S) /\ (x IN S) /\ (~(v = x)) /\ (dist (v,x) <= &2 * h0) /\ (w IN S) /\ (~(w = x)) /\ (dist (w,x) <= &2 * h0) /\ (~(v = w)) /\ (dist (v,w) <= &2 * h0) /\ (e1 = {v, w}) /\ (v' IN S) /\ (~(v' = x)) /\ (dist (v',x) <= &2 * h0) /\ (e2 = {v'})/\ (~(v' = v)) /\ (v' = w) ==> !x'. x' IN aff_ge {x} ({v, w} INTER {v'}) ==> x' IN aff_ge {x} {v, w} INTER aff_ge {x} {v'}`,REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC [] THEN STRIP_TAC THEN REWRITE_TAC [dn63;dn3;dn4;INTER;IN_ELIM_THM] THEN REPEAT STRIP_TAC THENL [EXISTS_TAC `t1:real` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `t2:real` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]];EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]]);; + +let SUBCASE36 = prove( `!(v:real^3) (v':real^3)(w:real^3) (x:real^3)(S:real^3->bool).( v IN S) /\ (x IN S) /\ (~(v = x)) /\ (dist (v,x) <= &2 * h0) /\ (w IN S) /\ (~(w = x)) /\ (dist (w,x) <= &2 * h0) /\ (~(v = w)) /\ (dist (v,w) <= &2 * h0) /\ (e1 = {v, w}) /\ (v' IN S) /\ (~(v' = x)) /\ (dist (v',x) <= &2 * h0) /\ (e2 = {v'})/\ (~(v' = v)) /\ (~(v' = w)) ==> !x'. x' IN aff_ge {x} ({v, w} INTER {v'}) ==> x' IN aff_ge {x} {v, w} INTER aff_ge {x} {v'}`,REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `({v:real^3,w:real^3} INTER {v':real^3}) = {}` ASSUME_TAC THENL [ASM_MESON_TAC [dn51];ASM_REWRITE_TAC[]] THEN STRIP_TAC THEN REWRITE_TAC [dn2;IN_SING] THEN STRIP_TAC THEN REWRITE_TAC [dn3;dn4;INTER;IN_ELIM_THM] THEN STRIP_TAC THENL [EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]];EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]]);; + + + +let cautruc10 = prove(`!(v:real^3) (v':real^3)(w:real^3) (x:real^3)(S:real^3->bool).( v IN S) /\ (x IN S) /\ (~(v = x)) /\ (dist (v,x) <= &2 * h0) /\ (w IN S) /\ (~(w = x)) /\ (dist (w,x) <= &2 * h0) /\ (~(v = w)) /\ (dist (v,w) <= &2 * h0) /\ (e1 = {v, w}) /\ (v' IN S) /\ (~(v' = x)) /\ (dist (v',x) <= &2 * h0) /\ (e2 = {v'}) ==> aff_ge {x} e1 INTER aff_ge {x} e2 = aff_ge {x} (e1 INTER e2)`,REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC [EXTENSION;GSYM SUBSET_ANTISYM_EQ;SUBSET;IN_ELIM_THM] THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*----*)[REWRITE_TAC [dn3;dn4] THEN GEN_TAC THEN REWRITE_TAC [IN_ELIM_THM] THEN (*v' = v*)ASM_CASES_TAC `(v':real^3 = v:real^3)` THENL [ASM_MESON_TAC [SUBCASE31];(*v' = w*)ASM_CASES_TAC `(v':real^3 = w:real^3)` THENL [ASM_MESON_TAC [SUBCASE32];(*~(v' = v) /\ ~(v' = w)*)ASM_MESON_TAC [SUBCASE33]]];(*Small Case*)(*v = v'*)ASM_CASES_TAC `(v':real^3 = v:real^3)` THENL [ASM_MESON_TAC [SUBCASE34];(*v' = w*)ASM_CASES_TAC `(v':real^3 = w:real^3)` THENL [ASM_MESON_TAC [SUBCASE35];(* ~(v = v') /\ ~(v = w) *)ASM_MESON_TAC [SUBCASE36]]]]);; + + +(*SUB4*) +let SUBCASE41 = prove( `!(v:real^3)(v':real^3)(w:real^3)(w':real^3)(x:real^3)(S:real^3->bool).( v IN S) /\ ( x IN S) /\ ( ~(v = x)) /\ ( dist (v,x) <= &2 * h0) /\ (w IN S) /\ (~(w = x)) /\ ( dist (w,x) <= &2 * h0) /\ ( ~(v = w)) /\ ( dist (v,w) <= &2 * h0) /\ ( e1 = {v, w}) /\ ( v' IN S) /\ ( ~(v' = x)) /\ ( dist (v',x) <= &2 * h0) /\ ( w' IN S) /\ ( ~(w' = x)) /\ ( dist (w',x) <= &2 * h0) /\ ( ~(v' = w')) /\(dist(v',w') <= &2 * h0) /\ (e2 = {v', w'}) /\({v, w} = {v', w'}) ==> x' IN {y | ?t1 t2 t3.t2 >= &0 /\ t3 >= &0 /\ t1 + t2 + t3 = &1 /\ y = t1 % x + t2 % v + t3 % w} INTER {y | ?t1 t2 t3. t2 >= &0 /\ t3 >= &0 /\ t1 + t2 + t3 = &1 /\ y = t1 % x + t2 % v' + t3 % w'} ==> x' IN aff_ge {x} ({v, w} INTER {v', w'})`,REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC [dn8;INTER;IN_ELIM_THM;dn4] THEN STRIP_TAC THEN REWRITE_TAC [IN_ELIM_THM] THEN EXISTS_TAC `t1':real` THEN EXISTS_TAC `t2':real` THEN EXISTS_TAC `t3':real` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]]);; + +let SUBCASE42 = prove(`!(v:real^3)(v':real^3)(w:real^3)(w':real^3)(x:real^3)(S:real^3->bool).( v IN S) /\ ( x IN S) /\ ( ~(v = x)) /\ ( dist (v,x) <= &2 * h0) /\ (w IN S) /\ (~(w = x)) /\ ( dist (w,x) <= &2 * h0) /\ ( ~(v = w)) /\ ( dist (v,w) <= &2 * h0) /\ ( e1 = {v, w}) /\ ( v' IN S) /\ ( ~(v' = x)) /\ ( dist (v',x) <= &2 * h0) /\ ( w' IN S) /\ ( ~(w' = x)) /\ ( dist (w',x) <= &2 * h0) /\ ( ~(v' = w')) /\(dist(v',w') <= &2 * h0) /\ (e2 = {v', w'}) /\(~({v, w} = {v', w'})) /\ (v = v') ==> x' IN {y | ?t1 t2 t3.t2 >= &0 /\ t3 >= &0 /\ t1 + t2 + t3 = &1 /\ y = t1 % x + t2 % v + t3 % w} INTER {y | ?t1 t2 t3. t2 >= &0 /\ t3 >= &0 /\ t1 + t2 + t3 = &1 /\ y = t1 % x + t2 % v' + t3 % w'} ==> x' IN aff_ge {x} ({v, w} INTER {v', w'})`,REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC [] THEN SUBGOAL_THEN `({v':real^3,w:real^3} INTER {v':real^3, w':real^3}) = {v'}` ASSUME_TAC THENL [ASM_MESON_TAC [dn9];ASM_REWRITE_TAC[]] THEN REWRITE_TAC [INTER;dn3;IN_ELIM_THM] THEN STRIP_TAC THEN SUBGOAL_THEN `(x':real^3) - ((t1':real) % (x:real^3) + (t2':real) % (v':real^3) + (t3':real) % (w':real^3)) = vec 0` ASSUME_TAC THENL [POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC;POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]] THEN REWRITE_TAC[VECTOR_ARITH `(t1 % x + t2 % v' + t3 % w) - (t1' % x + t2' % v' + t3' % w') = ((t1:real)- (t1':real)) % (x:real^3) + ((t2:real) - (t2':real)) % (v':real^3) + ((t3:real) % (w:real^3)) + (--(t3':real) % (w':real^3))`] THEN STRIP_TAC THEN SUBGOAL_THEN `((t1:real)- (t1':real)) = &0 /\ ((t2:real) - (t2':real)) = &0 /\ (t3:real) = &0 /\ (--(t3':real)) = &0` ASSUME_TAC THENL [ASM_MESON_TAC [dn11];SUBGOAL_THEN `(t1:real) + (t2:real) + &0 = &1` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `(t1:real) + (t2:real) = &1` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `(x':real^3) = (t1:real) % (x:real^3) + (t2:real) % (v':real^3) + &0 % (w:real^3)` ASSUME_TAC THENL [ASM_MESON_TAC[];EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC]]]]]]);; + +let SUBCASE43 = prove(`!(v:real^3)(v':real^3)(w:real^3)(w':real^3)(x:real^3)(S:real^3->bool).( v IN S) /\ ( x IN S) /\ ( ~(v = x)) /\ ( dist (v,x) <= &2 * h0) /\ (w IN S) /\ (~(w = x)) /\ ( dist (w,x) <= &2 * h0) /\ ( ~(v = w)) /\ ( dist (v,w) <= &2 * h0) /\ ( e1 = {v, w}) /\ ( v' IN S) /\ ( ~(v' = x)) /\ ( dist (v',x) <= &2 * h0) /\ ( w' IN S) /\ ( ~(w' = x)) /\ ( dist (w',x) <= &2 * h0) /\ ( ~(v' = w')) /\(dist(v',w') <= &2 * h0) /\ (e2 = {v', w'}) /\(~({v, w} = {v', w'})) /\ (~(v = v')) /\ (v = w') ==> x' IN {y | ?t1 t2 t3.t2 >= &0 /\ t3 >= &0 /\ t1 + t2 + t3 = &1 /\ y = t1 % x + t2 % v + t3 % w} INTER {y | ?t1 t2 t3. t2 >= &0 /\ t3 >= &0 /\ t1 + t2 + t3 = &1 /\ y = t1 % x + t2 % v' + t3 % w'} ==> x' IN aff_ge {x} ({v, w} INTER {v', w'})`,REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC [] THEN SUBGOAL_THEN `({w':real^3,w:real^3} INTER {v':real^3, w':real^3}) = {w'}` ASSUME_TAC THENL [ASM_MESON_TAC [dn91];ASM_REWRITE_TAC[]] THEN REWRITE_TAC [INTER;dn3;IN_ELIM_THM] THEN STRIP_TAC THEN SUBGOAL_THEN `(x':real^3) - ((t1':real) % (x:real^3) + (t2':real) % (v':real^3) + (t3':real) % (w':real^3)) = vec 0` ASSUME_TAC THENL [POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC;POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]] THEN REWRITE_TAC[VECTOR_ARITH `(t1 % x + t2 % w' + t3 % w) - (t1' % x + t2' % v' + t3' % w') = ((t1:real)- (t1':real)) % (x:real^3) + ((t2:real) - (t3':real)) % (w':real^3) + ((t3:real) % (w:real^3)) + (--(t2':real) % (v':real^3))`] THEN STRIP_TAC THEN SUBGOAL_THEN `((t1:real)- (t1':real)) = &0 /\ ((t2:real) - (t3':real)) = &0 /\ (t3:real) = &0 /\ (--(t2':real)) = &0` ASSUME_TAC THENL [ASM_MESON_TAC [dn11];SUBGOAL_THEN `(t1:real) + (t2:real) + &0 = &1` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `(t1:real) + (t2:real) = &1` ASSUME_TAC THENL [ASM_ARITH_TAC;EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC]]]]]);; + +let SUBCASE44 = prove(`!(v:real^3)(v':real^3)(w:real^3)(w':real^3)(x:real^3)(S:real^3->bool).( v IN S) /\ ( x IN S) /\ ( ~(v = x)) /\ ( dist (v,x) <= &2 * h0) /\ (w IN S) /\ (~(w = x)) /\ ( dist (w,x) <= &2 * h0) /\ ( ~(v = w)) /\ ( dist (v,w) <= &2 * h0) /\ ( e1 = {v, w}) /\ ( v' IN S) /\ ( ~(v' = x)) /\ ( dist (v',x) <= &2 * h0) /\ ( w' IN S) /\ ( ~(w' = x)) /\ ( dist (w',x) <= &2 * h0) /\ ( ~(v' = w')) /\(dist(v',w') <= &2 * h0) /\ (e2 = {v', w'}) /\(~({v, w} = {v', w'})) /\ (~(v = v')) /\ (~(v = w')) /\ (w = v') ==> x' IN {y | ?t1 t2 t3.t2 >= &0 /\ t3 >= &0 /\ t1 + t2 + t3 = &1 /\ y = t1 % x + t2 % v + t3 % w} INTER {y | ?t1 t2 t3. t2 >= &0 /\ t3 >= &0 /\ t1 + t2 + t3 = &1 /\ y = t1 % x + t2 % v' + t3 % w'} ==> x' IN aff_ge {x} ({v, w} INTER {v', w'})`,REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC [] THEN SUBGOAL_THEN `({v:real^3,v':real^3} INTER {v':real^3, w':real^3}) = {v'}` ASSUME_TAC THENL [ASM_MESON_TAC [dn92];ASM_REWRITE_TAC[]] THEN REWRITE_TAC [INTER;dn3;IN_ELIM_THM] THEN STRIP_TAC THEN SUBGOAL_THEN `(x':real^3) - ((t1':real) % (x:real^3) + (t2':real) % (v':real^3) + (t3':real) % (w':real^3)) = vec 0` ASSUME_TAC THENL [POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC;POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]] THEN REWRITE_TAC[VECTOR_ARITH `(t1 % x + t2 % v + t3 % v') - (t1' % x + t2' % v' + t3' % w') = ((t1:real)- (t1':real)) % (x:real^3) + ((t2:real)) % (v:real^3) + ((t3:real)- (t2':real)) % (v':real^3) + (--(t3':real) % (w':real^3))`] THEN STRIP_TAC THEN SUBGOAL_THEN `((t1:real)- (t1':real)) = &0 /\ ((t2:real)) = &0 /\ ((t3:real)- (t2':real)) = &0 /\ (--(t3':real)) = &0` ASSUME_TAC THENL [ASM_MESON_TAC [dn11];SUBGOAL_THEN `(t1:real) + (t3:real) + &0 = &1` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `(t1:real) + (t3:real) = &1` ASSUME_TAC THENL [ASM_ARITH_TAC;EXISTS_TAC `t1:real` THEN EXISTS_TAC `t3:real` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC]]]]]);; + +let SUBCASE45 = prove(`!(v:real^3)(v':real^3)(w:real^3)(w':real^3)(x:real^3)(S:real^3->bool).( v IN S) /\ ( x IN S) /\ ( ~(v = x)) /\ ( dist (v,x) <= &2 * h0) /\ (w IN S) /\ (~(w = x)) /\ ( dist (w,x) <= &2 * h0) /\ ( ~(v = w)) /\ ( dist (v,w) <= &2 * h0) /\ ( e1 = {v, w}) /\ ( v' IN S) /\ ( ~(v' = x)) /\ ( dist (v',x) <= &2 * h0) /\ ( w' IN S) /\ ( ~(w' = x)) /\ ( dist (w',x) <= &2 * h0) /\ ( ~(v' = w')) /\(dist(v',w') <= &2 * h0) /\ (e2 = {v', w'}) /\(~({v, w} = {v', w'})) /\ (~(v = v')) /\ (~(v = w')) /\ (~(w = v')) /\ (w = w') ==> x' IN {y | ?t1 t2 t3.t2 >= &0 /\ t3 >= &0 /\ t1 + t2 + t3 = &1 /\ y = t1 % x + t2 % v + t3 % w} INTER {y | ?t1 t2 t3. t2 >= &0 /\ t3 >= &0 /\ t1 + t2 + t3 = &1 /\ y = t1 % x + t2 % v' + t3 % w'} ==> x' IN aff_ge {x} ({v, w} INTER {v', w'})`,REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC [] THEN SUBGOAL_THEN `({v:real^3,w':real^3} INTER {v':real^3, w':real^3}) = {w'}` ASSUME_TAC THENL [ASM_MESON_TAC [dn93];ASM_REWRITE_TAC[]] THEN REWRITE_TAC [INTER;dn3;IN_ELIM_THM] THEN STRIP_TAC THEN SUBGOAL_THEN `(x':real^3) - ((t1':real) % (x:real^3) + (t2':real) % (v':real^3) + (t3':real) % (w':real^3)) = vec 0` ASSUME_TAC THENL [POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC;POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]] THEN REWRITE_TAC[VECTOR_ARITH `(t1 % x + t2 % v + t3 % w') - (t1' % x + t2' % v' + t3' % w') = ((t1:real)- (t1':real)) % (x:real^3) + ((t2:real)) % (v:real^3) + ((t3:real)- (t3':real)) % (w':real^3) + (--(t2':real) % (v':real^3))`] THEN STRIP_TAC THEN SUBGOAL_THEN `((t1:real)- (t1':real)) = &0 /\ ((t2:real)) = &0 /\ ((t3:real)- (t3':real)) = &0 /\ (--(t2':real)) = &0` ASSUME_TAC THENL [ASM_MESON_TAC [dn11];SUBGOAL_THEN `(t1:real) + (t3:real) + &0 = &1` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `(t1:real) + (t3:real) = &1` ASSUME_TAC THENL [ASM_ARITH_TAC;EXISTS_TAC `t1:real` THEN EXISTS_TAC `t3:real` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC]]]]]);; + +let SUBCASE46 = prove(`!(v:real^3)(v':real^3)(w:real^3)(w':real^3)(x:real^3)(S:real^3->bool).( v IN S) /\ ( x IN S) /\ ( ~(v = x)) /\ ( dist (v,x) <= &2 * h0) /\ (w IN S) /\ (~(w = x)) /\ ( dist (w,x) <= &2 * h0) /\ ( ~(v = w)) /\ ( dist (v,w) <= &2 * h0) /\ ( e1 = {v, w}) /\ ( v' IN S) /\ ( ~(v' = x)) /\ ( dist (v',x) <= &2 * h0) /\ ( w' IN S) /\ ( ~(w' = x)) /\ ( dist (w',x) <= &2 * h0) /\ ( ~(v' = w')) /\(dist(v',w') <= &2 * h0) /\ (e2 = {v', w'}) /\(~({v, w} = {v', w'})) /\ (~(v = v')) /\ (~(v = w')) /\ (~(w = v')) /\ (~(w = w')) ==> x' IN {y | ?t1 t2 t3.t2 >= &0 /\ t3 >= &0 /\ t1 + t2 + t3 = &1 /\ y = t1 % x + t2 % v + t3 % w} INTER {y | ?t1 t2 t3. t2 >= &0 /\ t3 >= &0 /\ t1 + t2 + t3 = &1 /\ y = t1 % x + t2 % v' + t3 % w'} ==> x' IN aff_ge {x} ({v, w} INTER {v', w'})`,REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC [GSYM INTER] THEN SUBGOAL_THEN `({v:real^3,w:real^3} INTER {v':real^3, w':real^3}) = {}` ASSUME_TAC THENL [ASM_MESON_TAC [dn112];ASM_REWRITE_TAC[]] THEN REWRITE_TAC [dn2;IN_SING;INTER;IN_ELIM_THM] THEN STRIP_TAC THEN SUBGOAL_THEN `(x':real^3) - ((t1':real) % (x:real^3) + (t2':real) % (v':real^3) + (t3':real) % (w':real^3)) = vec 0` ASSUME_TAC THENL [POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC;POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]] THEN REWRITE_TAC[VECTOR_ARITH `(t1 % x + t2 % v + t3 % w) - (t1' % x + t2' % v' + t3' % w') = ((t1:real)- (t1':real)) % (x:real^3) + (t2:real) % (v:real^3) + (t3:real) % (w:real^3) + (--(t2':real) % (v':real^3)) + (--(t3':real) % (w':real^3))`] THEN STRIP_TAC THEN SUBGOAL_THEN `((t1:real)- (t1':real)) = &0 /\ ((t2:real)) = &0 /\ ((t3:real)) = &0 /\ (--(t2':real)) = &0 /\ (--(t3':real)) = &0` ASSUME_TAC THENL [ASM_MESON_TAC [dn12];SUBGOAL_THEN `(t1:real) + &0 + &0 = &1` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `(t1:real) = &1` ASSUME_TAC THENL [ASM_ARITH_TAC;ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC]]]);; + +let SUBCASE47 = prove( `!(v:real^3)(v':real^3)(w:real^3)(w':real^3)(x:real^3)(S:real^3->bool).( v IN S) /\ ( x IN S) /\ ( ~(v = x)) /\ ( dist (v,x) <= &2 * h0) /\ (w IN S) /\ (~(w = x)) /\ ( dist (w,x) <= &2 * h0) /\ ( ~(v = w)) /\ ( dist (v,w) <= &2 * h0) /\ ( e1 = {v, w}) /\ ( v' IN S) /\ ( ~(v' = x)) /\ ( dist (v',x) <= &2 * h0) /\ ( w' IN S) /\ ( ~(w' = x)) /\ ( dist (w',x) <= &2 * h0) /\ ( ~(v' = w')) /\(dist(v',w') <= &2 * h0) /\ (e2 = {v', w'}) /\ ({v, w} = {v', w'}) ==> !x'. x' IN aff_ge {x} ({v, w} INTER {v', w'}) ==> x' IN aff_ge {x} {v, w} INTER aff_ge {x} {v', w'}`,REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC [dn8;INTER;IN_ELIM_THM]);; + +let SUBCASE48 = prove( `!(v:real^3)(v':real^3)(w:real^3)(w':real^3)(x:real^3)(S:real^3->bool).( v IN S) /\ ( x IN S) /\ ( ~(v = x)) /\ ( dist (v,x) <= &2 * h0) /\ (w IN S) /\ (~(w = x)) /\ ( dist (w,x) <= &2 * h0) /\ ( ~(v = w)) /\ ( dist (v,w) <= &2 * h0) /\ ( e1 = {v, w}) /\ ( v' IN S) /\ ( ~(v' = x)) /\ ( dist (v',x) <= &2 * h0) /\ ( w' IN S) /\ ( ~(w' = x)) /\ ( dist (w',x) <= &2 * h0) /\ ( ~(v' = w')) /\(dist(v',w') <= &2 * h0) /\ (e2 = {v', w'}) /\ (~({v, w} = {v', w'})) /\ (v = v') ==> !x'. x' IN aff_ge {x} ({v, w} INTER {v', w'}) ==> x' IN aff_ge {x} {v, w} INTER aff_ge {x} {v', w'}`,REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC [] THEN SUBGOAL_THEN `({v':real^3,w:real^3} INTER {v':real^3, w':real^3}) = {v'}` ASSUME_TAC THENL [ASM_MESON_TAC [dn9];ASM_REWRITE_TAC[]] THEN REWRITE_TAC [INTER;dn3;IN_ELIM_THM] THEN STRIP_TAC THEN REWRITE_TAC [dn4] THEN STRIP_TAC THEN REWRITE_TAC [IN_ELIM_THM] THEN STRIP_TAC THENL [EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN EXISTS_TAC `&0` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]];EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN EXISTS_TAC `&0` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]]]);; + +let SUBCASE49 = prove(`!(v:real^3)(v':real^3)(w:real^3)(w':real^3)(x:real^3)(S:real^3->bool).( v IN S) /\ ( x IN S) /\ ( ~(v = x)) /\ ( dist (v,x) <= &2 * h0) /\ (w IN S) /\ (~(w = x)) /\ ( dist (w,x) <= &2 * h0) /\ ( ~(v = w)) /\ ( dist (v,w) <= &2 * h0) /\ ( e1 = {v, w}) /\ ( v' IN S) /\ ( ~(v' = x)) /\ ( dist (v',x) <= &2 * h0) /\ ( w' IN S) /\ ( ~(w' = x)) /\ ( dist (w',x) <= &2 * h0) /\ ( ~(v' = w')) /\(dist(v',w') <= &2 * h0) /\ (e2 = {v', w'}) /\ (~({v, w} = {v', w'})) /\ (~(v = v')) /\ (v = w') ==> !x'. x' IN aff_ge {x} ({v, w} INTER {v', w'}) ==> x' IN aff_ge {x} {v, w} INTER aff_ge {x} {v', w'}`,REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC [] THEN SUBGOAL_THEN `({w':real^3,w:real^3} INTER {v':real^3, w':real^3}) = {w'}` ASSUME_TAC THENL [ASM_MESON_TAC [dn91];ASM_REWRITE_TAC[]] THEN REWRITE_TAC [INTER;dn3;IN_ELIM_THM] THEN STRIP_TAC THEN REWRITE_TAC [dn4] THEN STRIP_TAC THEN REWRITE_TAC [IN_ELIM_THM] THEN STRIP_TAC THENL [EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN EXISTS_TAC `&0` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]];EXISTS_TAC `t1:real` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `t2:real` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]]]);; + +let SUBCASE50 = prove(`!(v:real^3)(v':real^3)(w:real^3)(w':real^3)(x:real^3)(S:real^3->bool).( v IN S) /\ ( x IN S) /\ ( ~(v = x)) /\ ( dist (v,x) <= &2 * h0) /\ (w IN S) /\ (~(w = x)) /\ ( dist (w,x) <= &2 * h0) /\ ( ~(v = w)) /\ ( dist (v,w) <= &2 * h0) /\ ( e1 = {v, w}) /\ ( v' IN S) /\ ( ~(v' = x)) /\ ( dist (v',x) <= &2 * h0) /\ ( w' IN S) /\ ( ~(w' = x)) /\ ( dist (w',x) <= &2 * h0) /\ ( ~(v' = w')) /\(dist(v',w') <= &2 * h0) /\ (e2 = {v', w'}) /\ (~({v, w} = {v', w'})) /\ (~(v = v')) /\ (~(v = w')) /\ (w = v') ==> !x'. x' IN aff_ge {x} ({v, w} INTER {v', w'}) ==> x' IN aff_ge {x} {v, w} INTER aff_ge {x} {v', w'}`,REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC [] THEN SUBGOAL_THEN `({v:real^3,v':real^3} INTER {v':real^3, w':real^3}) = {v'}` ASSUME_TAC THENL [ASM_MESON_TAC [dn92];ASM_REWRITE_TAC[]] THEN REWRITE_TAC [INTER] THEN STRIP_TAC THEN REWRITE_TAC [dn4;dn3;IN_ELIM_THM] THEN REPEAT STRIP_TAC THENL [EXISTS_TAC `t1:real` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `t2:real` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]];EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN EXISTS_TAC `&0` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]]]);; + +let SUBCASE51 = prove(`!(v:real^3)(v':real^3)(w:real^3)(w':real^3)(x:real^3)(S:real^3->bool).( v IN S) /\ ( x IN S) /\ ( ~(v = x)) /\ ( dist (v,x) <= &2 * h0) /\ (w IN S) /\ (~(w = x)) /\ ( dist (w,x) <= &2 * h0) /\ ( ~(v = w)) /\ ( dist (v,w) <= &2 * h0) /\ ( e1 = {v, w}) /\ ( v' IN S) /\ ( ~(v' = x)) /\ ( dist (v',x) <= &2 * h0) /\ ( w' IN S) /\ ( ~(w' = x)) /\ ( dist (w',x) <= &2 * h0) /\ ( ~(v' = w')) /\(dist(v',w') <= &2 * h0) /\ (e2 = {v', w'}) /\ (~({v, w} = {v', w'})) /\ (~(v = v')) /\ (~(v = w')) /\ (~(w = v')) /\ (w = w') ==> !x'. x' IN aff_ge {x} ({v, w} INTER {v', w'}) ==> x' IN aff_ge {x} {v, w} INTER aff_ge {x} {v', w'}`,REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC [] THEN SUBGOAL_THEN `({v:real^3,w':real^3} INTER {v':real^3, w':real^3}) = {w'}` ASSUME_TAC THENL [ASM_MESON_TAC [dn93];ASM_REWRITE_TAC[]] THEN REWRITE_TAC [INTER;dn3;IN_ELIM_THM] THEN STRIP_TAC THEN REWRITE_TAC [dn4;IN_ELIM_THM] THEN REPEAT STRIP_TAC THENL [EXISTS_TAC `t1:real` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `t2:real` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]];EXISTS_TAC `t1:real` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `t2:real` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]]]);; + +let SUBCASE52 = prove( `!(v:real^3)(v':real^3)(w:real^3)(w':real^3)(x:real^3)(S:real^3->bool).( v IN S) /\ ( x IN S) /\ ( ~(v = x)) /\ ( dist (v,x) <= &2 * h0) /\ (w IN S) /\ (~(w = x)) /\ ( dist (w,x) <= &2 * h0) /\ ( ~(v = w)) /\ ( dist (v,w) <= &2 * h0) /\ ( e1 = {v, w}) /\ ( v' IN S) /\ ( ~(v' = x)) /\ ( dist (v',x) <= &2 * h0) /\ ( w' IN S) /\ ( ~(w' = x)) /\ ( dist (w',x) <= &2 * h0) /\ ( ~(v' = w')) /\(dist(v',w') <= &2 * h0) /\ (e2 = {v', w'}) /\ (~({v, w} = {v', w'})) /\ (~(v = v')) /\ (~(v = w')) /\ (~(w = v')) /\ (~(w = w')) ==> !x'. x' IN aff_ge {x} ({v, w} INTER {v', w'}) ==> x' IN aff_ge {x} {v, w} INTER aff_ge {x} {v', w'}`,REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC [GSYM INTER] THEN SUBGOAL_THEN `({v:real^3,w:real^3} INTER {v':real^3, w':real^3}) = {}` ASSUME_TAC THENL [ASM_MESON_TAC [dn112];ASM_REWRITE_TAC[]] THEN REWRITE_TAC [dn2;IN_SING;INTER;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN REWRITE_TAC [dn4;IN_ELIM_THM] THENL [EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]];EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0` THEN STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;STRIP_TAC THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]]]);; + +let cautruc11 = prove(`!(v:real^3)(v':real^3)(w:real^3)(w':real^3)(x:real^3)(S:real^3->bool).( v IN S) /\ ( x IN S) /\ ( ~(v = x)) /\ ( dist (v,x) <= &2 * h0) /\ (w IN S) /\ (~(w = x)) /\ ( dist (w,x) <= &2 * h0) /\ ( ~(v = w)) /\ ( dist (v,w) <= &2 * h0) /\ ( e1 = {v, w}) /\ ( v' IN S) /\ ( ~(v' = x)) /\ ( dist (v',x) <= &2 * h0) /\ ( w' IN S) /\ ( ~(w' = x)) /\ ( dist (w',x) <= &2 * h0) /\ ( ~(v' = w')) /\(dist(v',w') <= &2 * h0) /\ (e2 = {v', w'}) ==> aff_ge {x} e1 INTER aff_ge {x} e2 = aff_ge {x} (e1 INTER e2)`,REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC [EXTENSION;GSYM SUBSET_ANTISYM_EQ;SUBSET;IN_ELIM_THM] THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THENL(*-------*)[REWRITE_TAC [dn4] THEN GEN_TAC THEN REWRITE_TAC [IN_ELIM_THM] THEN (*{v,w} = {v',w'}*)ASM_CASES_TAC `{v:real^3,w:real^3} = {v':real^3,w':real^3}` THENL [ASM_MESON_TAC [SUBCASE41];(*v = v'*)ASM_CASES_TAC `(v:real^3 = v':real^3)` THENL [ASM_MESON_TAC [SUBCASE42];(*v = w*)ASM_CASES_TAC `(v:real^3 = w':real^3)` THENL [ASM_MESON_TAC [SUBCASE43];(* w = v'*)ASM_CASES_TAC `(w:real^3 = v':real^3)` THENL [ASM_MESON_TAC [SUBCASE44];(*(w = w')*)ASM_CASES_TAC `(w:real^3 = w':real^3)` THENL [ASM_MESON_TAC [SUBCASE45];(*(~({v, w} = {v', w'}))/\ (~(v = v')) /\ (~(v = w')) /\ (~(w = v')) /\ (~(w = w')) *)ASM_MESON_TAC [SUBCASE46]]]]]];(*Small Cases*)(*{v,w} = {v',w'}*)ASM_CASES_TAC `{v:real^3,w:real^3} = {v':real^3,w':real^3}` THENL [ASM_MESON_TAC [SUBCASE47];(*v = v'*)ASM_CASES_TAC `(v:real^3 = v':real^3)` THENL [ASM_MESON_TAC [SUBCASE48];(*v = w*)ASM_CASES_TAC `(v:real^3 = w':real^3)` THENL [ASM_MESON_TAC [SUBCASE49];(* w = v'*)ASM_CASES_TAC `(w:real^3 = v':real^3)` THENL [ASM_MESON_TAC [SUBCASE50];(*(w = w')*)ASM_CASES_TAC `(w:real^3 = w':real^3)` THENL [ASM_MESON_TAC [SUBCASE51];(*(~({v, w} = {v', w'}))/\ (~(v = v')) /\ (~(v = w')) /\ (~(w = v')) /\ (~(w = w')) *)ASM_MESON_TAC [SUBCASE52]]]]]]]);; + + +let them8 = prove(`!(x:real^3)(S:real^3 -> bool) e1 e2.(e1 IN (sigma_set1 x S)) /\ (e2 IN (sigma_set1 x S)) ==> ((aff_ge {x} e1) INTER (aff_ge {x} e2)) = aff_ge {x} (e1 INTER e2)`,REPEAT GEN_TAC THEN REWRITE_TAC [sigma_set1;ESTD;V;UNION;IN_ELIM_THM] THEN STRIP_TAC THENL [ASM_MESON_TAC [cautruc11];ASM_MESON_TAC [cautruc10];REWRITE_TAC [INTER] THEN ASM_MESON_TAC [cautruc9];ASM_MESON_TAC [cautruc8]]);; + +(*-------------------------------------------------*) +(*Cause ECNT SUBSET ESTD then ESTD is general*) +let UBHDEUU =prove(`!(x:real^3) (S:real^3 -> bool).(packing S) /\ (x IN S) ==> new_fan (x, V x S, ESTD(V x S))`,REPEAT GEN_TAC THEN REWRITE_TAC [new_fan;fan11;fan21;fan41;fan51] THEN REPEAT STRIP_TAC THENL [REWRITE_TAC [GSYM eunion] THEN ASM_MESON_TAC [them5];REWRITE_TAC [graph] THEN GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `e IN ESTD (V x S)` ASSUME_TAC THENL[ ASM_MESON_TAC [IN];POP_ASSUM MP_TAC THEN ASM_MESON_TAC[them6]];ASM_MESON_TAC [them2];POP_ASSUM MP_TAC THEN REWRITE_TAC[] THEN ASM_MESON_TAC [them3];POP_ASSUM MP_TAC THEN REWRITE_TAC[] THEN ASM_MESON_TAC [them7];POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC [fan31] THEN REWRITE_TAC [GSYM sigma_set1] THEN ASM_MESON_TAC [them8]]);; + +(*=-=================================================================================================*) + + +(* triangle, quadrilateral, exceptional *) +let triangles = new_definition `triangles (H:(A)hypermap) (x:A) + <=> (CARD (face H x)) = 3`;; + +let quadilaterals = new_definition `quadilaterals (H:(A)hypermap) (x:A) + <=> (CARD (face H x)) = 4`;; + +let exceptional_faces = new_definition `exceptional_faces (H:(A)hypermap)(x:A) + <=> (CARD (face H x)) = 5`;; + +(*Type of a node*) + +let triangles_set = new_definition `triangles_set (H:(A)hypermap) (x:A) = +{triangles H y | y IN node H x}`;; + +let quadilaterals_set = new_definition ` quadilaterals_set (H:(A)hypermap) (x:A) = +{quadilaterals H y | y IN node H x}`;; + +let exceptional_faces_set = new_definition `exceptional_faces_set (H:(A)hypermap) (x:A) = +{exceptional_faces H y | y IN node H x}`;; + +let set_of_triangles_meeting_node = new_definition `set_of_triangles_meeting_node (H:(A)hypermap) (x:A) = {face H (y:A) | y IN dart H /\ CARD (face H y) = 3 /\ y IN node H x}`;; + +let set_of_quadrilaterals_meeting_node = new_definition `set_of_quadrilaterals_meeting_node (H:(A)hypermap) (x:A) = {face H (y:A) | y IN dart H /\ CARD (face H y) = 4 /\ y IN node H x}`;; + +let set_of_exceptional_meeting_node = new_definition `set_of_exceptional_meeting_node (H:(A)hypermap) (x:A) = {face H (y:A) | y IN dart H /\ CARD (face H y) >= 5 /\ y IN node H x}`;; + +let p = new_definition `p (H:(A)hypermap) (x:A) + = CARD (set_of_triangles_meeting_node H x)`;; + + +let q = new_definition `q (H:(A)hypermap)(x:A) + = CARD (set_of_quadrilaterals_meeting_node H x)`;; + +let r = new_definition `r (H:(A)hypermap) (x:A) + = CARD (set_of_exceptional_meeting_node H x )`;; + +let type_of_node = new_definition `type_of_node (H:(A)hypermap) (x:A) = (p H x,q H x,r H x )`;; +(*let type_of_node = new_definition `type_of_node (H:(A)hypermap) (x:A) = (CARD (set_of_triangles_meeting_node H x), CARD (set_of_quadrilaterals_meeting_node H x), CARD (set_of_exceptional_meeting_node H x ))`;;*) + +let tgt = new_definition `tgt = #1.541`;; + +(* Definition L --> the linear interpolation*) + +let atn2 = new_definition `atn2(x,y) = + if ( abs y < x ) then atn(y / x) else + (if (&0 < y) then ((pi / &2) - atn(x / y)) else + (if (y < &0) then (-- (pi/ &2) - atn (x / y)) else ( pi )))`;; + +let ups_x = new_definition `ups_x x1 x2 x6 = + --x1*x1 - x2*x2 - x6*x6 + + &2 *x1*x6 + &2 *x1*x2 + &2 *x2*x6`;; + +let arclength = new_definition `arclength a b c = +pi/(&2) + (atn2( (sqrt (ups_x (a*a) (b*b) (c*c))),(c*c - a*a -b*b)))`;; + +(*Definition faces of hypermap of cardinality at least 7*) + +let FF = new_definition `FF (H:(A)hypermap) (x:A) + <=> (CARD (face H x))>= 7`;; + + +let h1 = new_definition `h1 = {x|(&1 <= x) /\ (x <= h0)}`;; + +let L = new_definition `L x = + if x = &1 then &1 else + (if x = h0 then &0 else + (if (x < h0) then ((h0 - x)/ (h0 - (&1))) + else + &0))`;; + +let thm_arc = `!u w. (u IN (V x S)) /\ (w IN (edge H u)) ==> + let dux = dist (u,x) in + let dwx = dist (w,x) in + let duw = dist (u,w) in + arclength dux dwx duw >= arclength dux dwx (&2)`;; + +let thm_arc1 = `!u w.(u IN (V x S)) /\ (w IN (edge H u)) ==> + let dux = dist (u,x) in + let dwx = dist (w,x) in + arclength dux dwx (&2) >= (&1) - ((#0.6076)*((dux/(&2)) - (&1))) - ((#0.6076)*((dwx/(&2)) - (&1)))`;; + + + + + +end;; diff --git a/legacy/oldtame/dangtatdatusb/DLWCHEM.hl b/legacy/oldtame/dangtatdatusb/DLWCHEM.hl new file mode 100644 index 0000000..624a3d8 --- /dev/null +++ b/legacy/oldtame/dangtatdatusb/DLWCHEM.hl @@ -0,0 +1,2628 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALISATION *) +(* *) +(* Proof: DLWCHEM *) +(* Chapter: Packing *) +(* Author: Dang Tat Dat *) +(* Date: In progress *) +(* ========================================================================== *) + +needs "/home/nyx/flyspeck/working/flyspeck_needs.hl";; + +(* ** Load parent files ** *) +flyspeck_needs "nonlinear/ineq.hl";; +flyspeck_needs "packing/pack_defs.hl";; +flyspeck_needs "tame/tame_defs.hl";; +flyspeck_needs "trigonometry/trigonometry.hl";; +flyspeck_needs "fan/Conforming.hl";; +flyspeck_needs "packing/pack_defs.hl";; +flyspeck_needs "fan/HypermapAndFan.hl";; +flyspeck_needs "fan/polyhedron.hl";; + +(* ** Proof module type ** *) + + +(* ** Proof module ** *) + +open Sphere;; +open Trigonometry1;; +open Trigonometry2;; +open Vol1;; +open Pack_defs;; +open Tame_defs;; +open Ineq;; +open Fan_defs;; +open Hypermap;; +open Hypermap_and_fan;; +open Fan;; +open Polyhedron;; +(*open Polyhedron_def;;*) +(*--------------Definition---------------------------------------------------*) +let weakly_saturated = + new_definition + `weakly_saturated (V:real^3 ->bool) (r:real) (r':real) <=> + (!(v:real^3).(&2 <= dist(vec 0,v) ) /\ (dist(vec 0, v) <= r') ==> + (?(u:real^3). (u IN V) /\ (~((vec 0) = u)) /\ (dist(u,v) < r)))`;; + +let half_spaces = + new_definition + `half_spaces (a:real^3) (b:real) = + {x:real^3| (a dot x) <= b}`;; + +let r = + new_definition + `r = &2` ;; + +let r' = + new_definition + `r' = &2 * h0` ;; + +let g_fun = + new_definition + `(g_fun) (x:real^3) = (acs(dist(vec 0, x)/(&4))) - (pi/(&6))` ;; + +let dart2_of_fan = new_definition + `dart2_of_fan ((V:A->bool),(E:(A->bool)->bool)) = {(v,v) | v IN V /\ set_of_edge (v:A) V E = {} }`;; + +(*-------------------------Fan Definiton-----------------------------------*) + +let CASE_FAN_FINITE = new_definition `CASE_FAN_FINITE (V:real^3 -> bool,E:(real^3 ->bool)->bool) <=> FINITE V /\ ~(V SUBSET {})`;; + +let CASE_FAN_ORIGIN = new_definition `CASE_FAN_ORIGIN (V:real^3 -> bool,E:(real^3 ->bool)->bool) <=> ~((vec 0) IN (V))`;; + +let CASE_FAN_INDEPENDENCE = + new_definition `CASE_FAN_INDEPENDENCE (V:real^3 -> bool,E:(real^3 ->bool)->bool) <=> + (!e. e IN E ==> ~collinear ({vec 0} UNION e))`;; + +let CASE_FAN_INTERSECTION = + new_definition`CASE_FAN_INTERSECTION(V:real^3 -> bool,E:(real^3 ->bool)->bool)<=> + (!e1 e2. (e1 IN E UNION {{v}| v IN V}) /\ (e2 IN E UNION {{v}| v IN V}) + ==> ((aff_ge {vec 0 } e1) INTER (aff_ge {vec 0} e2) = aff_ge {vec 0} (e1 INTER e2)))`;; + +let FANO = + new_definition `FANO(V:real^3 -> bool,E:(real^3 ->bool)->bool) <=> + ((UNIONS E) SUBSET V) /\ graph(E) /\ CASE_FAN_FINITE(V,E) /\ CASE_FAN_ORIGIN(V,E)/\ + CASE_FAN_INDEPENDENCE(V,E)/\ CASE_FAN_INTERSECTION(V,E)`;; + +let FANO_OF_FAN = prove( `!(V:real^3 -> bool)(E:(real^3 ->bool)->bool). (FAN(vec 0 , V , E) <=> FANO(V,E))`, + REWRITE_TAC[FAN;FANO;CASE_FAN_FINITE;CASE_FAN_ORIGIN;CASE_FAN_INDEPENDENCE;CASE_FAN_INTERSECTION;fan1;fan2;fan6;fan7]);; + +(*-------------------------------------------------------------------------*) + +let interior_point = + new_definition + `interior_point (p:real^3) (P:real^3->bool) + <=> ?(r:real). (&0 < r) /\ (ball(p,r) SUBSET P)` ;; +let reg = + new_definition + `reg (a:real) (k:real) = (&2)*pi - (&2)*k*(asn(cos(a)*sin(pi/k)))` ;; + +let arc_1 = + new_definition + `arc_1 (a:real) (b:real) (c:real) = + pi/(&2) - (atn2( (sqrt (ups_x (a*a) (b*b) (c*c))),(a*a + b*b - c*c)))`;; + +let IN_DOUBLE = prove(`!x y z:real^N. x IN {y,z} <=> x = y \/ x = z`,SET_TAC[]);; + +let INTERIOR_EQUIVALENT = prove (`!(V:real^3->bool) x:real^3. interior_point x V <=> x IN interior V`,REPEAT GEN_TAC THEN PURE_REWRITE_TAC [interior_point;IN_INTERIOR] THEN MESON_TAC[]);; + +let DART_EQ_UNIONS_FACE_SET_NODE_SET_EDGE_SET=prove(`!(H:(A)hypermap). dart H = UNIONS (face_set H)/\ dart H = UNIONS (node_set H)/\ dart H = UNIONS (edge_set H)`, + GEN_TAC THEN REWRITE_TAC[face_set;node_set;edge_set] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC lemma_partition +THEN REWRITE_TAC[hypermap_lemma]);; + + +(*-----------------Some new axiom--------------------------------------------*) +let TARJJUW_concl = `!(V:real^3 -> bool)(P:real^3->bool) (g:real^3->real) r r':real u:real^3. (&2 <= r) /\ (r <= r') /\ (V SUBSET (:real^3) DIFF ball (vec 0,&2)) /\ (FINITE V) /\ packing V/\ ~(V = {}) /\ (weakly_saturated V r r') /\ + P = INTERS {half_spaces u (g u)| u IN V} /\ polyhedron P /\ u IN V ==> +(bounded P)`;; + +let TARJJUW = new_axiom TARJJUW_concl;; + +(*----------------------------------------------------------------------------*) +g `!(V: real^3 -> bool). (polyhedron V) /\ (bounded V) /\ (interior_point (vec 0) V) ==> edges V = {{v, w} | ~(v = w) /\ convex hull {v, w} face_of V}`;; + +e (GEN_TAC);; +e (STRIP_TAC);; +e (REWRITE_TAC [edges;EXTENSION]);; +e (GEN_TAC THEN EQ_TAC);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (STRIP_TAC);; +e (MP_TAC (ISPECL [`V:real^3 -> bool`;`v:real^3`;`w:real^3`]SEGMENT_EDGE_OF));; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (EXISTS_TAC `v:real^3`);; +e (EXISTS_TAC `w:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (UNDISCH_TAC `segment [v,w] edge_of (V:real^3->bool)`);; +e (REWRITE_TAC [edge_of;face_of;segment;CONVEX_HULL_2_ALT;IN_ELIM_THM]);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `!v:real^3 w:real^3 u:real . v + u % (w - v) = (&1 - u) % v + u % w` ASSUME_TAC);; +e (REPEAT GEN_TAC);; +e (REWRITE_TAC [VECTOR_SUB_LDISTRIB;VECTOR_SUB_RDISTRIB;VECTOR_MUL_LID]);; +e (VECTOR_ARITH_TAC);; +e (SUBGOAL_THEN `{(v:real^3) + (u:real) % ((w:real^3) - v)| &0 <= u /\ u <= &1} ={(&1 - u) % v + u % w | &0 <= u /\ u <= &1}` ASSUME_TAC);; +e (REWRITE_TAC [EXTENSION]);; +e (GEN_TAC);; +e (EQ_TAC);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (STRIP_TAC);; +e (EXISTS_TAC `u:real`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (STRIP_TAC);; +e (EXISTS_TAC `u:real`);; +e (ASM_REWRITE_TAC[]);; +e (POP_ASSUM (fun th -> REWRITE_TAC[th]));; +e (ASM_REWRITE_TAC[]);; +e (SUBGOAL_THEN `!v:real^3 w:real^3 u:real . v + u % (w - v) = (&1 - u) % v + u % w` ASSUME_TAC);; +e (REPEAT GEN_TAC);; +e (REWRITE_TAC [VECTOR_SUB_LDISTRIB;VECTOR_SUB_RDISTRIB;VECTOR_MUL_LID]);; +e (VECTOR_ARITH_TAC);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (STRIP_TAC);; +e (EXISTS_TAC `v:real^3`);; +e (EXISTS_TAC `w:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (UNDISCH_TAC `convex hull {v, w} face_of (V:real^3->bool)`);; +e (REWRITE_TAC [edge_of;face_of;segment;CONVEX_HULL_2_ALT]);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `{(v:real^3) + (u:real) % ((w:real^3) - v)| &0 <= u /\ u <= &1} ={(&1 - u) % v + u % w | &0 <= u /\ u <= &1}` ASSUME_TAC);; +e (REWRITE_TAC [EXTENSION]);; +e (GEN_TAC);; +e (EQ_TAC);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (STRIP_TAC);; +e (EXISTS_TAC `u:real`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (STRIP_TAC);; +e (EXISTS_TAC `u:real`);; +e (ASM_REWRITE_TAC[]);; +e (POP_ASSUM (fun th -> REWRITE_TAC[GSYM th]));; +e (ASM_REWRITE_TAC[]);; +e (SUBGOAL_THEN `{(v:real^3) + (u:real) % ((w:real^3) - v)| &0 <= u /\ u <= &1} ={(&1 - u) % v + u % w | &0 <= u /\ u <= &1}` ASSUME_TAC);; +e (REWRITE_TAC [EXTENSION]);; +e (GEN_TAC);; +e (EQ_TAC);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (STRIP_TAC);; +e (EXISTS_TAC `u:real`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (STRIP_TAC);; +e (EXISTS_TAC `u:real`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC [GSYM segment]);; +e (MP_TAC (ISPECL [`v:real^3`;`w:real^3`]SEGMENT_SUBSET_HALFLINE));; +e (STRIP_TAC);; +e (MP_TAC (ISPECL [`v:real^3`;`w:real^3`]HALFLINE_SUBSET_AFFINE_HULL));; +e (STRIP_TAC);; +e (MP_TAC (ISPECL [`{v:real^3,w:real^3}`]AFF_DIM_AFFINE_HULL));; +e (STRIP_TAC);; +e (MP_TAC (ISPECL [`segment [v:real^3,w:real^3]`;`aff_ge {v:real^3} {w:real^3}`;`affine hull {v:real^3, w:real^3}`]SUBSET_TRANS));; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (MP_TAC (ISPECL [`segment [v:real^3,w:real^3]`;`affine hull {v:real^3, w:real^3}`]AFF_DIM_SUBSET));; +e (ASM_REWRITE_TAC[]);; +e (MP_TAC (ISPECL [`v:real^3`;`w:real^3`]AFF_DIM_2));; +e (ASM_REWRITE_TAC[]);; +e (REPEAT STRIP_TAC);; +e (SUBGOAL_THEN `{v:real^3,w:real^3} SUBSET segment [v,w]` ASSUME_TAC);; +e (REWRITE_TAC [segment;SUBSET]);; +e (GEN_TAC);; +e (REWRITE_TAC[IN_DOUBLE;IN_ELIM_THM]);; +e (STRIP_TAC);; +e (EXISTS_TAC `&0`);; +e (REWRITE_TAC[ARITH_RULE `&0 <= &0 /\ &0 <= &1`]);; +e (REWRITE_TAC[ARITH_RULE `&1 - &0 = &1`;VECTOR_MUL_LZERO;VECTOR_ADD_RID;VECTOR_MUL_LID]);; +e (ASM_REWRITE_TAC[]);; +e (EXISTS_TAC `&1`);; +e (REWRITE_TAC [ARITH_RULE `&0 <= &1 /\ &1 <= &1`]);; +e (REWRITE_TAC [ARITH_RULE `&1 - &1 = &0`;VECTOR_MUL_LZERO;VECTOR_MUL_LID;VECTOR_ADD_LID]);; +e (ASM_REWRITE_TAC[]);; +e (MP_TAC (ISPECL [`{v:real^3, w:real^3}`;`segment [v:real^3,w:real^3]`]AFF_DIM_SUBSET));; +e (POP_ASSUM (fun th-> REWRITE_TAC[th]));; +e (STRIP_TAC);; +e (MP_TAC (ISPECL [`aff_dim (segment [v:real^3,w:real^3])`;`aff_dim {(v:real^3), (w:real^3)}`]INT_LE_ANTISYM));; +e (POP_ASSUM (fun th-> REWRITE_TAC[th]));; +e (POP_ASSUM (fun th-> REWRITE_TAC[th]));; +e (POP_ASSUM (fun th-> REWRITE_TAC[th]));; + +let EDGE_CONVEX_HULL = top_thm();; + +g `!(V:real^3 -> bool). (polyhedron V) /\ (bounded V) /\ (interior_point (vec 0) V) ==> FANO (fan_of_polyhedron V)`;; +e (GEN_TAC);; +e (STRIP_TAC);; +e (MP_TAC (ISPECL [`V:real^3->bool`;`(vec 0):real^3`]POLYHEDRON_FAN));; +e (MP_TAC (ISPECL [`V:real^3->bool`;`(vec 0):real^3`]INTERIOR_EQUIVALENT));; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[vertices;edges;fan_of_polyhedron]);; +e (REWRITE_TAC [edge_of]);; +e (MP_TAC (ISPECL [`V:real^3->bool`]EDGE_CONVEX_HULL));; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (POP_ASSUM (fun th -> REWRITE_TAC [GSYM th]));; +e (MP_TAC (ISPECL [`V:real^3 ->bool`;`(vec 0):real^3`]POLYHEDRON_FAN));; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (STRIP_TAC);; +e (MP_TAC (ISPECL [`vertices (V:real^3->bool)`;`edges (V:real^3->bool)`]FANO_OF_FAN));; +e (ASM_REWRITE_TAC[GSYM vertices]);; + +let JLIGZGS = top_thm();; + +(*---------------------------------------------------------------------------*) +let WGVWSKE_concl = `!(V:real^3->bool) (E:(real^3->bool)->bool). + FANO (V,E) /\ conforming (V,E) + ==> connected_hypermap (hypermap_of_fan (V,E))`;; + +let WGVWSKE = new_axiom WGVWSKE_concl;; + + +let GGRLKHP_concl = `!(V:real^3->bool) (E:(real^3->bool)->bool). + FANO (V,E) /\ conforming (V,E) + ==> planar_hypermap (hypermap_of_fan (V,E))`;; + +let GGRLKHP = new_axiom GGRLKHP_concl;; + +let PLAIN_HYPERMAP =prove(`!(V:real^3->bool) (E:(real^3->bool)->bool). + FANO (V,E) ==> plain_hypermap (hypermap_of_fan (V,E))`,REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `FAN (vec 0,(V:real^3->bool),(E:(real^3->bool)->bool))` ASSUME_TAC THEN ASM_REWRITE_TAC [FANO_OF_FAN] THEN ASM_MESON_TAC [PLAIN_HYPERMAP_OF_FAN]);; + +(*---------------------------------------------------------------------------*) + +(*FACET_OF_POLYHEDRON_EXPLICIT*) +(*Chung minh rang o day ton tai mot song anh*) +(*!s f a b. + FINITE f /\ + s = affine hull s INTER INTERS f /\ + (!h. h IN f ==> ~(a h = vec 0) /\ h = {x | a h dot x <= b h}) /\ + (!f'. f' PSUBSET f ==> s PSUBSET affine hull s INTER INTERS f') + ==> (!c. c facet_of s <=> + (?h. h IN f /\ c = s INTER {x | a h dot x = b h})) *) +let CZZHBLI_concl_1 = + `!(V:real^3 -> bool) P (u:real^3) b:real F .(FINITE V) /\ packing V + /\(weakly_saturated V r r') /\ (V SUBSET ball_annulus) /\ + P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ + (polyhedron P) /\ (bounded P) /\ + F = {f|f facet_of P} + ==> (?(h:(real^3) -> (real^3->bool)) (g:((real^3->bool))->(real^3)). h o g = I /\ g o h = I /\ IMAGE h V = F)`;; + +let CZZHBLI_1 = new_axiom CZZHBLI_concl_1;; +(* +g `!(V:real^3 -> bool) P (u:real^3) b:real F .(FINITE V) /\ packing V + /\(weakly_saturated V r r') /\ (V SUBSET ball_annulus) /\ + P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ + (polyhedron P) /\ (bounded P) /\ + F = {f|f facet_of P} + ==> (?(h:(real^3) -> (real^3->bool)) (g:((real^3->bool))->(real^3)). h o g = I /\ g o h = I /\ IMAGE h V = F)`;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (MP_TAC (ISPECL [`P:real^3->bool`;`f:real^3->bool`]FACET_OF_POLYHEDRON));; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; + +FACET_OF_POLYHEDRON_EXPLICIT;; +FACET_OF_POLYHEDRON;; +FINITE_POLYHEDRON_FACES;; +FINITE_POLYHEDRON_EXTREME_POINT;; +search [`norm v`];; +*) +(*----------------------------------------------------------------------------*) + +let RDWKARC_concl = `~kepler_conjecture /\ (!V. cell_cluster_estimate V) /\ + marchal_inequality + ==> (?V. packing V /\ V SUBSET ball_annulus /\ ~(lmfun_ineq_center V))`;; + +let RDWKARC = new_axiom RDWKARC_concl;; + + +(*---------------------------------------------------------------------------*) + +let AMHFNXP_concl = + `!(P:real^3 -> bool) F WF. + (polyhedron P) /\ (bounded P) /\ (interior_point (vec 0) P) /\ + (F = {f|f facet_of P}) /\ (WF = topological_component_yfan (vec 0,fan_of_polyhedron P)) + ==> (?(h:(real^3->bool) -> (real^3->bool)) (g: (real^3->bool) -> (real^3->bool)). h o g = I /\ g o h = I /\ IMAGE h F = WF)`;; + +let AMHFNXP = new_axiom AMHFNXP_concl;; + +(*---------------------------------------------------------------------------*) + +let BSXAQBQ_concl = `!(P:real^3 -> bool)(x:real^3#real^3).(polyhedron P) /\ (bounded P) /\(interior_point (vec 0) P) /\ (x IN (dart_of_fan (fan_of_polyhedron P))) ==> azim_dart (fan_of_polyhedron P) x < pi`;; + +let BSXAQBQ = new_axiom BSXAQBQ_concl;; +(*---------------------------------------------------------------------------*) + +let PIIJBJK_concl =`!(V:real^3 -> bool)(E:(real^3->bool)->bool). + fully_surrounded (V,E) ==> + conforming (V,E)`;; + + +let PIIJBJK = new_axiom PIIJBJK_concl;; +(*---------------------------------------------------------------------------*) + +let UVPFEEP_concl1 =`!(V:real^3 -> bool) (E:(real^3->bool)->bool) F WF. + FANO (V,E) /\ (conforming (V,E)) /\ + (WF = topological_component_yfan (vec 0,V,E)) /\ + (F = face_set_of_fan (V,E)) + ==> (?(f: (real^3->bool) -> (real^3#real^3->bool)) (g: (real^3#real^3->bool) -> (real^3->bool)). f o g = I /\ g o f = I /\ IMAGE f WF = F)`;; + + +let UVPFEEP_1= new_axiom UVPFEEP_concl1;; + +(*---------------------------------------------------------------------------*) +let GOTCJAH_concl = `!s f (v:real^3) b WF h k. + polyhedron s /\ bounded s /\ (?r. r> &0 /\ ball(vec 0,r) SUBSET s) /\ + f facet_of s /\ + f = { p | p dot v = b } INTER s /\ + topological_component_yfan (vec 0,fan_of_polyhedron s) WF /\ + ~(f INTER WF = {}) /\ + rcone_gt (vec 0) v h SUBSET WF /\ + (k = CARD {u | u extreme_point_of f }) + ==> &2 * pi - &2* &k * asn (h* sin(pi/ &k)) <= sol (vec 0) WF`;; + +let GOTCJAH = new_axiom GOTCJAH_concl;; + +(*---------------------------------proof--------------------------------------*) + +g `!(V:real^3 -> bool) (x:real). (&1 <=x ) ==> (lmfun x <= &1)`;; +e (REWRITE_TAC [lmfun;h0]);; +e (REPEAT STRIP_TAC);; +e (ASM_CASES_TAC `(x:real) <= #1.26`);; +e (ASM_REWRITE_TAC[]);; +e (PURE_REWRITE_TAC [ARITH_RULE `#1.26 - &1 = #0.26`]);; +e (SUBGOAL_THEN `&0 < #0.26` ASSUME_TAC);; +e (ARITH_TAC);; +e (SUBGOAL_THEN `(--x:real <= --(&1) )` ASSUME_TAC);; +e (ASM_REWRITE_TAC [REAL_LE_NEG]);; +e (SUBGOAL_THEN `#1.26 + --(x:real) <= #1.26 + --(&1)` ASSUME_TAC);; +e (ASM_REWRITE_TAC [REAL_LE_LADD]);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [GSYM real_sub]);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `(#1.26 - (x:real)) / #0.26 <= (#1.26 - &1) / #0.26` ASSUME_TAC);; +e (ASM_MESON_TAC [GSYM REAL_LE_DIV2_EQ]);; +e (SUBGOAL_THEN `(#1.26 - &1) / #0.26 = &1` ASSUME_TAC);; +e (ARITH_TAC);; +e (ASM_MESON_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; + +let thm1 = top_thm();; + +(*----------------------------------------------------------------------------*) + + +g `!(V:real^3->bool) (u:real^3). (packing V) /\ (V SUBSET ball_annulus) /\ + (u IN V) ==> ((&1) <= dist(vec 0,u)/(&2)) `;; +e (REWRITE_TAC [ball_annulus]);; +e (REWRITE_TAC [cball;ball]);; +e (REWRITE_TAC [DIFF]);; +e (REWRITE_TAC [SUBSET]);; +e (REPEAT STRIP_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (DISCH_THEN (LABEL_TAC "F1"));; +e (STRIP_TAC);; +e (USE_THEN "F1" (MP_TAC o SPEC `u:real^3`));; +e (STRIP_TAC);; +e (SUBGOAL_THEN `(u:real^3) IN + {x:real^3 | x IN {y:real^3 | dist (vec 0,y) <= &2 * h0} /\ + ~(x IN {y | dist (vec 0,y) < &2})} ` ASSUME_TAC);; +e (ASM_MESON_TAC []);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (STRIP_TAC);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [REAL_NOT_LT]);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `(&0) < (&2)` ASSUME_TAC);; +e (ARITH_TAC);; +e (SUBGOAL_THEN `(&2)/(&2) <= dist (vec 0,u:real^3)/(&2)` ASSUME_TAC);; +e (ASM_MESON_TAC [REAL_LE_DIV2_EQ]);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [ARITH_RULE `(&2)/(&2) = (&1)`]);; + +let thm2 = top_thm();; + +g `!(V:real^3->bool) (u:real^3). (packing V) /\ (V SUBSET ball_annulus) /\ + (u IN V) ==> (dist(vec 0,u) <= &2 * h0) `;; +e (REWRITE_TAC [ball_annulus]);; +e (REWRITE_TAC [cball;ball]);; +e (REWRITE_TAC [DIFF]);; +e (REWRITE_TAC [SUBSET]);; +e (REPEAT STRIP_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (DISCH_THEN (LABEL_TAC "F1"));; +e (STRIP_TAC);; +e (USE_THEN "F1" (MP_TAC o SPEC `u:real^3`));; +e (STRIP_TAC);; +e (SUBGOAL_THEN `(u:real^3) IN + {x:real^3 | x IN {y:real^3 | dist (vec 0,y) <= &2 * h0} /\ + ~(x IN {y | dist (vec 0,y) < &2})} ` ASSUME_TAC);; +e (ASM_MESON_TAC []);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (STRIP_TAC);; + +let thm21 = top_thm();; +(*----------------------------------------------------------------------------*) + +g `!(V:real^3->bool).(FINITE V) /\ (packing V) /\ (V SUBSET ball_annulus) /\ + (&(CARD V) <= (&12)) ==> + sum V (\v. lmfun (dist (vec 0,v) / &2)) <= (&12)`;; +e (REPEAT STRIP_TAC);; +e (SUBGOAL_THEN `!(v:real^3). (v IN (V:real^3->bool)) ==> (&1) <= dist(vec 0,v)/(&2)` ASSUME_TAC);; +e (REPEAT STRIP_TAC);; +e (ASM_MESON_TAC [thm2]);; +e (POP_ASSUM (LABEL_TAC "F1"));; +e (USE_THEN "F1" (MP_TAC o SPEC `v:real^3`));; +e (STRIP_TAC);; +e (SUBGOAL_THEN `!(v:real^3). (&1) <= dist(vec 0,v)/(&2) ==> lmfun (dist (vec 0,v) / &2) <= (&1)` ASSUME_TAC);; +e (STRIP_TAC);; +e (MESON_TAC [thm1]);; +e (POP_ASSUM (LABEL_TAC "F2"));; +e (USE_THEN "F2" (MP_TAC o SPEC `v:real^3`));; +e (STRIP_TAC);; +e (SUBGOAL_THEN `!(v:real^3). (v IN (V:real^3->bool)) ==> lmfun (dist (vec 0,v) / &2) <= (&1)` ASSUME_TAC);; +e (STRIP_TAC);; +e (ASM_MESON_TAC[]);; +e (SUBGOAL_THEN `sum (V:real^3->bool) (\v. lmfun (dist (vec 0,v) / &2)) <= (&(CARD V)) * (&1)` ASSUME_TAC);; +e (ASM_MESON_TAC [SUM_BOUND]);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [ARITH_RULE `&(CARD (V:real^3->bool)) * &1 = &(CARD V)`]);; +e (STRIP_TAC);; +e (ASM_MESON_TAC[REAL_LE_TRANS]);; + +let thm3 = top_thm();; + +(*----------------------------------------------------------------------------*) + +g `!(V:real^3->bool) (u:real^3).(packing V) /\ (V SUBSET ball_annulus) /\ (weakly_saturated V r r') /\ (u IN V) ==> (dist (vec 0,u) / &2 <= h0)`;; +e (REPEAT GEN_TAC);; +e (REWRITE_TAC [packing;ball_annulus]);; +e (STRIP_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [cball;ball]);; +e (REWRITE_TAC [SUBSET]);; +e (REWRITE_TAC [DIFF]);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (DISCH_THEN (LABEL_TAC "F1"));; +e (REPEAT STRIP_TAC);; +e (USE_THEN "F1" (MP_TAC o SPEC `u:real^3`));; +e (STRIP_TAC);; +e (SUBGOAL_THEN `&0 < &2` ASSUME_TAC);; +e (ARITH_TAC);; +e (SUBGOAL_THEN `dist (vec 0,u:real^3) <= (&2) * h0` ASSUME_TAC);; +e (ASM_MESON_TAC[]);; +e (POP_ASSUM MP_TAC);;I +e (FIRST_X_ASSUM MP_TAC);; +e (ABBREV_TAC `uu = dist (vec 0, (u:real^3)) `);; +e (MESON_TAC[REAL_LE_LDIV_EQ; REAL_MUL_SYM]);; + +let thm4 = top_thm();; + +g `! (x:real^N) y. ?d. (affine hull {x,y}) d /\ (?c. ! w. {x,y} w ==> c = dist (d,w))`;; +e (REPEAT GEN_TAC);; +e (EXISTS_TAC ` inv (&2) % ( x + (y:real^N) ) `);; +e (REWRITE_TAC[AFFINE_HULL_2; IN_ELIM_THM]);; +e (STRIP_TAC);; +e (EXISTS_TAC `inv (&2)`);; +e (EXISTS_TAC `inv (&2)`);; +e (PURE_REWRITE_TAC[ARITH_RULE `inv (&2) + inv (&2) = &1 `]);; +e (PURE_REWRITE_TAC [VECTOR_ADD_LDISTRIB]);; +e (STRIP_TAC);; +e (ARITH_TAC);; +e (ARITH_TAC);; +e (EXISTS_TAC `dist (x:real^N,y) /(&2)`);; +e (GEN_TAC);; +e (SUBGOAL_THEN `{x:real^N, y} w <=> w IN {x:real^N, y}` ASSUME_TAC);; +e (REWRITE_TAC [IN]);; +e (SUBGOAL_THEN `(w:real^N) IN {x, y} <=> w = x \/ w = y` ASSUME_TAC);; +e (MESON_TAC [IN_DOUBLE]);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; + +e (PURE_REWRITE_TAC [GSYM midpoint]);; +e (REWRITE_TAC [DIST_MIDPOINT]);; +e (ASM_REWRITE_TAC [GSYM midpoint]);; +e (REWRITE_TAC [DIST_MIDPOINT]);; + +let thm5 = top_thm();; + + +let dat_th1 = prove(` segment [v,w:real^3] SUBSET affine hull {v,w} `, + +REWRITE_TAC[AFFINE_HULL_2; segment; SUBSET; IN_ELIM_THM] THEN + +MESON_TAC[REAL_ARITH` (&1 - x ) + x = &1 `]);; + +g `(! (x:real^3) y. ?d. (affine hull {x,y}) d /\ (?c. ! w. {x,y} w ==> c = dist (d,w))) +==> +( !v w:real^3. ~(v = w) ==> circumcenter{v,w} = midpoint(v,w))`;; +e (REPEAT STRIP_TAC);; +e (MP_TAC (MESON[MIDPOINT_IN_SEGMENT]` midpoint (v,w:real^3) IN segment [v,w]`));; +e (SUBGOAL_THEN ` ( affine hull {v,w:real^3} ) (circumcenter {v, w}) /\ +(?c. ! x. {v,w} x ==> c = dist ((circumcenter {v, w}),x)) ` ASSUME_TAC);; +e (REWRITE_TAC[Collect_geom.circumcenter]);; +e (CONV_TAC SELECT_CONV);; +e (ASM_REWRITE_TAC[]);; +e (MP_TAC dat_th1);; +e (REWRITE_TAC[SUBSET]);; +e (REPEAT STRIP_TAC);; +e (SUBGOAL_THEN ` midpoint (v,w:real^3) IN affine hull {v,w} ` ASSUME_TAC);; +e (FIRST_X_ASSUM MATCH_MP_TAC);; +e (FIRST_X_ASSUM ACCEPT_TAC);; +e (REPEAT (FIRST_X_ASSUM MP_TAC));; +e (REWRITE_TAC[AFFINE_HULL_2; IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (UNDISCH_TAC ` !x. {v, w} x ==> c = dist (circumcenter {v, w},x:real^3)`);; +e (ASM_REWRITE_TAC[REWRITE_RULE[IN] (SET_RULE `x IN {a,b} <=> x = a \/ x = b`); MESON[] `(! a. a = x \/ a = y ==> P a) <=> P x /\ P y `; dist]);; +e (UNDISCH_TAC ` u + v' = &1 `);; +e (SIMP_TAC[REAL_ARITH` a + b = &1 <=> a = &1 - b `; VECTOR_ARITH` ((&1 - v') % v + v' % w) - v = v' % (w - v )`; VECTOR_ARITH` ((&1 - v') % v + v' % w) - w = ( v' - &1 ) % ( w - v )`; NORM_MUL]);; +e (REPEAT STRIP_TAC);; +e (FIRST_X_ASSUM MP_TAC);; +e (ASM_REWRITE_TAC[REAL_ARITH` a * b = c * b <=> (a - c ) * b = &0`; REAL_ENTIRE]);; +e (STRIP_TAC);; +e (FIRST_X_ASSUM MP_TAC);; +e (REWRITE_TAC[REAL_ARITH ` abs a - abs ( a - &1 ) = &0 <=> a = &1 / &2 `]);; +e (SIMP_TAC[REAL_ARITH` &1 - &1 / &2 = &1 / &2 `]);; +e (UNDISCH_TAC` midpoint (v,w) = u' % v + v'' % (w:real^3) `);; +e (DISCH_THEN (SUBST1_TAC o SYM));; +e (REWRITE_TAC[midpoint; REAL_ARITH` inv (&2) = &1 / &2 `]);; +e (DISCH_TAC THEN VECTOR_ARITH_TAC);; +e (FIRST_X_ASSUM MP_TAC);; +e (REWRITE_TAC[NORM_EQ_0; VECTOR_SUB_EQ]);; +e (ASM_MESON_TAC[]);; + +let thm6 = top_thm();; + + +g `!v w:real^3. ~(v = w) ==> circumcenter{v,w} = midpoint(v,w)`;; +e (SUBGOAL_THEN `! (x:real^3) y. ?d. (affine hull {x,y}) d /\ (?c. ! w. {x,y} w ==> c = dist (d,w))` ASSUME_TAC);; +e (REWRITE_TAC [thm5]);; +e (POP_ASSUM MP_TAC);; +e (PURE_REWRITE_TAC [thm6]);; + +let thm7 = top_thm();; + +g `!(V:real^3->bool) (u:real^3). (packing V) /\ (V SUBSET ball_annulus) /\ + (u IN V) ==> ~(vec 0 = u)`;; +e (REPEAT GEN_TAC);; +e (PURE_REWRITE_TAC [ball_annulus;SUBSET;DIFF;IN_ELIM_THM;cball;ball]);; +e (STRIP_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (DISCH_THEN (LABEL_TAC "F1"));; +e (STRIP_TAC);; +e (USE_THEN "F1" (MP_TAC o SPEC `u:real^3`));; +e (STRIP_TAC);; +e (SUBGOAL_THEN `dist (vec 0,u:real^3) <= &2 * h0 /\ ~(dist (vec 0,u) < &2)` ASSUME_TAC);; +e (ASM_MESON_TAC[]);; +e (ASM_CASES_TAC `(vec 0 = u:real^3)`);; +e (SUBGOAL_THEN `dist(vec 0, u:real^3) = &0` ASSUME_TAC);; +e (ASM_REWRITE_TAC[]);; +e (MESON_TAC[DIST_REFL]);; +e (SUBGOAL_THEN `~(dist (vec 0,u:real^3) < &2)` ASSUME_TAC);; +e (ASM_MESON_TAC[]);; +e (SUBGOAL_THEN `&2 <= dist (vec 0,u:real^3)` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC [REAL_NOT_LT]);; +e (ASM_REWRITE_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; +e (ASM_REWRITE_TAC[]);; + +let thm8= top_thm();; + + +g `!u:real^3 . ?d.(!w. {vec 0, u} w ==> d = dist (midpoint (vec 0,u),w))`;; +e (GEN_TAC);; +e (EXISTS_TAC `dist(vec 0,u:real^3)/(&2)`);; +e (GEN_TAC);; +e (SUBGOAL_THEN `{vec 0, u:real^3} w <=> w IN {vec 0, u}` ASSUME_TAC);; +e (REWRITE_TAC [IN]);; +e (SUBGOAL_THEN `(w:real^3) IN {vec 0, u:real^3} <=> w = vec 0 \/ w = u` ASSUME_TAC);; +e (MESON_TAC [IN_DOUBLE]);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (PURE_REWRITE_TAC [DIST_MIDPOINT]);; +e (REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (PURE_REWRITE_TAC [DIST_MIDPOINT]);; +e (REWRITE_TAC[]);; + +let thm9 = top_thm();; + +g `!w:real^3 u. ~(vec 0 = u) /\ {vec 0, u} w ==> dist (vec 0,u)/(&2) = dist (circumcenter {vec 0, u},w)`;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (POP_ASSUM MP_TAC);; +e (SUBGOAL_THEN `{vec 0, u:real^3} w <=> w IN {vec 0, u}` ASSUME_TAC);; +e (REWRITE_TAC [IN]);; +e (SUBGOAL_THEN `(w:real^3) IN {vec 0, u:real^3} <=> w = vec 0 \/ w = u` ASSUME_TAC);; +e (MESON_TAC [IN_DOUBLE]);; +e (ASM_REWRITE_TAC[]);; +e (SUBGOAL_THEN `circumcenter {vec 0, u:real^3} = midpoint (vec 0,u)` ASSUME_TAC);; +e (ASM_MESON_TAC [thm7]);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (PURE_REWRITE_TAC [DIST_MIDPOINT]);; +e (ARITH_TAC);; +e (ASM_REWRITE_TAC[]);; +e (PURE_REWRITE_TAC [DIST_MIDPOINT]);; +e (ARITH_TAC);; + +let thm10 = top_thm();; + + + +g `(!u:real^3 . ?d. (!w. {vec 0, u} w ==> d = dist (midpoint (vec 0,u),w))) +==> (!v:real^3. ~(vec 0 = v) ==> hl [vec 0;v] = dist (vec 0,v)/(&2))`;; +e (STRIP_TAC);; +e (GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `circumcenter {vec 0, v:real^3} = midpoint (vec 0,v)` ASSUME_TAC);; +e (ASM_MESON_TAC [thm7]);; +e (SUBGOAL_THEN `!w:real^3. {vec 0, v} w ==> (dist (vec 0,v) / (&2)) = dist (circumcenter {vec 0, v},w)` ASSUME_TAC);; +e (ASM_MESON_TAC [thm10]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC [HL;set_of_list;radV]);; +e (POP_ASSUM MP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (SET_TAC[]);; + +let thm11 = top_thm();; + + +g `!v:real^3. ~(vec 0 = v) ==> hl [vec 0; v] = dist (vec 0,v) / &2`;; +e (SUBGOAL_THEN `!u:real^3. ?d. !w. {vec 0, u} w ==> d = dist (midpoint (vec 0,u),w)` ASSUME_TAC);; +e (REWRITE_TAC [thm9]);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [thm11]);; + +let thm12 = top_thm();; + +g `!(V:real^3->bool) (u:real^3). (packing V) /\ (V SUBSET ball_annulus) /\ + (u IN V) ==> hl [vec 0;u] = dist (vec 0,u)/(&2) `;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `~(vec 0 = u:real^3)` ASSUME_TAC);; +e (ASM_MESON_TAC [thm8]);; +e (ASM_MESON_TAC [thm12]);; + +let thm13 = top_thm();; + +g `!(V:real^3->bool) (u:real^3). (packing V) /\ (V SUBSET ball_annulus) /\ + (u IN V) ==> &1 <= hl [vec 0;u] `;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `hl [vec 0; u:real^3] = dist (vec 0,u) / (&2)` ASSUME_TAC);; +e (ASM_MESON_TAC [thm13]);; +e (ASM_REWRITE_TAC[]);; +e (ASM_MESON_TAC [thm2]);; + +let thm14 = top_thm();; + +g `!(V:real^3->bool). FINITE V /\ packing V /\ V SUBSET ball_annulus /\ &(CARD V) <= &12 + ==> sum V (\v. lmfun (hl [vec 0;v])) <= &12`;; +e (REPEAT STRIP_TAC);; +e (SUBGOAL_THEN `!(v:real^3). (v IN (V:real^3->bool)) ==> (&1) <= hl [vec 0;v]` ASSUME_TAC);; +e (REPEAT STRIP_TAC);; +e (ASM_MESON_TAC [thm14]);; +e (POP_ASSUM (LABEL_TAC "F1"));; +e (USE_THEN "F1" (MP_TAC o SPEC `v:real^3`));; +e (STRIP_TAC);; +e (SUBGOAL_THEN `!(v:real^3). (&1) <= hl [vec 0;v] ==> lmfun (hl [vec 0;v]) <= (&1)` ASSUME_TAC);; +e (STRIP_TAC);; +e (MESON_TAC [thm1]);; +e (POP_ASSUM (LABEL_TAC "F2"));; +e (USE_THEN "F2" (MP_TAC o SPEC `v:real^3`));; +e (STRIP_TAC);; +e (SUBGOAL_THEN `!(v:real^3). (v IN (V:real^3->bool)) ==> lmfun (hl [vec 0;v]) <= (&1)` ASSUME_TAC);; +e (STRIP_TAC);; +e (ASM_MESON_TAC[]);; +e (SUBGOAL_THEN `sum (V:real^3->bool) (\v. lmfun (hl [vec 0;v])) <= (&(CARD V)) * (&1)` ASSUME_TAC);; +e (ASM_MESON_TAC [SUM_BOUND]);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [ARITH_RULE `&(CARD (V:real^3->bool)) * &1 = &(CARD V)`]);; +e (STRIP_TAC);; +e (ASM_MESON_TAC[REAL_LE_TRANS]);; + +let thm15 = top_thm();; + + +g `!(V:real^3->bool). FINITE V /\ packing V /\ + V SUBSET ball_annulus /\ ~(lmfun_ineq_center V) + ==> &12 < &(CARD V)`;; +e (GEN_TAC);; +e (PURE_REWRITE_TAC [lmfun_ineq_center]);; +e (STRIP_TAC);; +e (ASM_CASES_TAC `&12 < &(CARD (V:real^3->bool))`);; +e (ASM_REWRITE_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (PURE_REWRITE_TAC[REAL_NOT_LT]);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `sum (V:real^3->bool) (\v. lmfun (hl [vec 0; v])) <= &12` ASSUME_TAC);; +e (ASM_MESON_TAC [thm15]);; +e (UNDISCH_TAC `~(sum (V:real^3->bool) (\v. lmfun (hl [vec 0; v])) <= &12)`);; +e (POP_ASSUM MP_TAC);; +e (ABBREV_TAC `a = sum (V:real^3->bool) (\v. lmfun (hl [vec 0; v]))`);; +e (STRIP_TAC);; +e (ASM_MESON_TAC[]);; + +let condition_1 = top_thm();; + +(*-------------------------------------------------------------------------*) + +g `!(V:real^3->bool) p. (!u:real^3. ~(u IN V1) \/ &2 <= dist (u,p)) ==> (!u:real^3. u IN V1 ==> &2 <= dist (u,p))`;; +e (REPEAT GEN_TAC);; +e (DISCH_THEN (LABEL_TAC "F1"));; +e (GEN_TAC);; +e (STRIP_TAC);; +e (USE_THEN "F1"(MP_TAC o SPEC `u:real^3`));; +e (POP_ASSUM MP_TAC);; +e (SET_TAC[]);; + +let thm16 = top_thm();; + +g `!(V:real^3->bool) V1. FINITE V /\ packing V /\ + V SUBSET ball_annulus /\ V SUBSET V1 /\ V1 SUBSET ball_annulus /\ (packing V1) /\ (!y:real^3. (!x:real^3. (x IN V1) ==> &2 <= dist(x,y)) ==> y IN V1) ==> weakly_saturated V1 r r'`;; +e (REPEAT GEN_TAC);; +e (PURE_REWRITE_TAC [packing]);; +e (STRIP_TAC);; +e (PURE_REWRITE_TAC [weakly_saturated]);; +e (PURE_REWRITE_TAC [r;r']);; +e (GEN_TAC);; +e (STRIP_TAC);; +e (ASM_CASES_TAC `p:real^3 IN (V1:real^3->bool)`);; +e (EXISTS_TAC `p:real^3`);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (PURE_REWRITE_TAC [DIST_REFL]);; +e (ARITH_TAC);; +e (ASM_CASES_TAC `?u:real^3. u IN V1 /\ dist(u,p) < (&2)` );; +e (ASM_REWRITE_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (PURE_REWRITE_TAC [NOT_EXISTS_THM]);; +e (PURE_REWRITE_TAC [DE_MORGAN_THM]);; +e (PURE_REWRITE_TAC [REAL_NOT_LT]);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `!u:real^3. u IN (V1:real^3->bool) ==> &2 <= dist (u,p:real^3)` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [thm16]);; +e (UNDISCH_TAC `!y:real^3. (!x:real^3. x IN (V1:real^3->bool) ==> &2 <= dist (x,y)) ==> y IN V1`);; +e (DISCH_THEN (LABEL_TAC "F1"));; +e (USE_THEN "F1" (MP_TAC o SPEC `p:real^3`));; +e (STRIP_TAC);; +e (SUBGOAL_THEN `p:real^3 IN (V1:real^3->bool)` ASSUME_TAC);; +e (UNDISCH_TAC `!u:real^3. u IN (V1:real^3->bool) ==> &2 <= dist (u,p)`);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC[]);; +e (UNDISCH_TAC `~(p:real^3 IN (V1:real^3->bool))`);; +e (POP_ASSUM MP_TAC);; +e (SET_TAC[]);; + +let thm17 = top_thm();; + +(*---------------------------------------------------------------------------*) +g `!h1 h2 g1 g2. (h1 o h2) o (g1 o g2) = h1 o (h2 o g1) o g2`;; +e (REPEAT GEN_TAC);; +e (PURE_REWRITE_TAC [o_ASSOC]);; +e (ARITH_TAC);; + + +let MUL_o_ASSOC = top_thm();; + +(* +g `!(V:real^3 -> bool) (P:real^3->bool) (u:real^3) f b:real F X.(FINITE V) /\ packing V + /\(weakly_saturated V r r') /\ (V SUBSET ball_annulus) /\ + P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ + (polyhedron P) /\ (bounded P) /\ (f = {p | u dot p = g_fun u } INTER P) /\ + f facet_of P /\ + F = {f|f facet_of P} + /\ (X = topological_component_yfan (vec 0,fan_of_polyhedron P)) + /\ (interior_point (vec 0) P) + ==> (?(h: V -> X) (g: X -> V). (h o g = I /\ g o h = I))`;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `(?(h1: V -> F) (g1: F-> V). h1 o g1 = I /\ g1 o h1 = I)` ASSUME_TAC);; +e (ASM_MESON_TAC [CZZHBLI_1]);; +e (SUBGOAL_THEN `(?(h2: F -> WF) (g2: WF -> F). h2 o g2 = I /\ g2 o h2 = I)` ASSUME_TAC);; +e (ASM_MESON_TAC [AMHFNXP]);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (REPEAT STRIP_TAC);; +e (EXISTS_TAC `(h2:F->WF) o (h1:V->F)`);; +e (EXISTS_TAC `(g1: F-> V) o (g2: WF -> F)`);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `((h2:F->WF) o (h1:V->F)) o ((g1: F-> V) o (g2: WF -> F)) = + (h2 o (h1 o g1) o g2)` ASSUME_TAC);; +e (REWRITE_TAC [MUL_o_ASSOC]);; +e (POP_ASSUM(fun th ->REWRITE_TAC[th]));; +e (UNDISCH_TAC `(h1:V->F) o (g1:F->V) = I`);; +e (STRIP_TAC);; +e (POP_ASSUM(fun th ->REWRITE_TAC[th]));; +e (PURE_REWRITE_TAC [o_ASSOC]);; +e (PURE_REWRITE_TAC [I_O_ID]);; +e (UNDISCH_TAC `(h2: F -> WF)o(g2: WF -> F)= I`);; +e (REWRITE_TAC[]);; +e (SUBGOAL_THEN `((g1: F-> V) o (g2: WF -> F)) o ((h2:F->WF) o (h1:V->F)) = + (g1 o (g2 o h2) o h1)` ASSUME_TAC);; +e (REWRITE_TAC [MUL_o_ASSOC]);; +e (POP_ASSUM(fun th ->REWRITE_TAC[th]));; +e (UNDISCH_TAC `(g2: WF -> F) o (h2: F -> WF) = I`);; +e (STRIP_TAC);; +e (POP_ASSUM(fun th ->REWRITE_TAC[th]));; +e (PURE_REWRITE_TAC [o_ASSOC]);; +e (PURE_REWRITE_TAC [I_O_ID]);; +e (UNDISCH_TAC `(g1: F-> V)o(h1:V->F)= I`);; +e (REWRITE_TAC[]);; + +let V_TOPO_BIJ = top_thm();; + + +g `!(V:real^3 -> bool) (P:real^3->bool) (u:real^3) f b:real F WF F_T.(FINITE V) /\ packing V + /\(weakly_saturated V r r') /\ (V SUBSET ball_annulus) /\ + P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ + (polyhedron P) /\ (bounded P) /\ (f = {p | u dot p = g_fun u } INTER P) /\ + f facet_of P /\ + FANO (fan_of_polyhedron P) /\ + F = {f|f facet_of P} + /\ (WF = topological_component_yfan (vec 0,fan_of_polyhedron P)) + /\ (conforming (fan_of_polyhedron P)) + /\ (interior_point (vec 0) P) /\ + F_T = face_set_of_fan (fan_of_polyhedron P ) + ==> (?(h: V -> F_T) (g: F_T -> V). (h o g = I /\ g o h = I))`;; + +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `(?(h1: V -> WF) (g1: WF -> V). h1 o g1 = I /\ g1 o h1 = I)` ASSUME_TAC);; +e (ASM_MESON_TAC[V_TOPO_BIJ]);; +e (SUBGOAL_THEN `(?(h2: WF -> F_T) (g2: F_T -> WF). h2 o g2 = I /\ g2 o h2 = I)` +ASSUME_TAC);; +e (UNDISCH_TAC `F_T = face_set_of_fan (fan_of_polyhedron (P:real^3->bool))`);; +e (UNDISCH_TAC `(WF' = topological_component_yfan (vec 0,fan_of_polyhedron (P:real^3->bool)))`);; +e (UNDISCH_TAC `(conforming (fan_of_polyhedron (P:real^3->bool)))`);; +e (UNDISCH_TAC `FANO (fan_of_polyhedron P)`);; +e (PURE_REWRITE_TAC [fan_of_polyhedron]);; +e (ABBREV_TAC `V1 ={v | v extreme_point_of (P:real^3->bool)}`);; +e (ABBREV_TAC `E1 ={{v, w} | ~(v = w) /\ convex hull {v, w} face_of (P:real^3->bool)}`);; +e (MESON_TAC [UVPFEEP_1]);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (REPEAT STRIP_TAC);; +e (EXISTS_TAC `(h2:WF->F_T) o (h1:V->WF)`);; +e (EXISTS_TAC `(g1: WF-> V) o (g2: F_T -> WF)`);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `((h2:WF->F_T) o (h1:V->WF)) o ((g1: WF-> V) o (g2: F_T -> WF)) = + (h2 o (h1 o g1) o g2)` ASSUME_TAC);; +e (REWRITE_TAC [MUL_o_ASSOC]);; +e (POP_ASSUM(fun th ->REWRITE_TAC[th]));; +e (UNDISCH_TAC `(h1:V->WF) o (g1:WF->V) = I`);; +e (STRIP_TAC);; +e (POP_ASSUM(fun th ->REWRITE_TAC[th]));; +e (PURE_REWRITE_TAC [o_ASSOC]);; +e (PURE_REWRITE_TAC [I_O_ID]);; +e (UNDISCH_TAC `(h2: WF -> F_T)o(g2: F_T -> WF)= I`);; +e (REWRITE_TAC[]);; +e (SUBGOAL_THEN `((g1: WF-> V) o (g2: F_T -> WF)) o ((h2:WF->F_T) o (h1:V->WF)) = + (g1 o (g2 o h2) o h1)` ASSUME_TAC);; +e (REWRITE_TAC [MUL_o_ASSOC]);; +e (POP_ASSUM(fun th ->REWRITE_TAC[th]));; +e (UNDISCH_TAC `(g2: F_T -> WF) o (h2: WF -> F_T) = I`);; +e (STRIP_TAC);; +e (POP_ASSUM(fun th ->REWRITE_TAC[th]));; +e (PURE_REWRITE_TAC [o_ASSOC]);; +e (PURE_REWRITE_TAC [I_O_ID]);; +e (UNDISCH_TAC `(g1: WF-> V)o(h1:V->WF)= I`);; +e (REWRITE_TAC[]);; + +let V_FHYPER_BIJ = top_thm();; +*) +(*----------------------------------------------------------------------------*) + +g `!(V:real^3 -> bool) (P:real^3->bool) X (f1:(real^3) -> (real^3->bool)) (f2:((real^3->bool))->(real^3)). + (FINITE V) /\ packing V /\ + (weakly_saturated V r r') /\ (V SUBSET ball_annulus) /\ + P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ + (polyhedron P) /\ (bounded P) /\ + (X = topological_component_yfan (vec 0,fan_of_polyhedron P)) /\ + f1 o f2 = I /\ f2 o f1 = I /\ + IMAGE f1 V = X + ==> (sum (V) (\v:real^3. sol (vec 0) (f1(v))) = sum (X) (\v. sol (vec 0) v ))`;; + +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `(!x:real^3 y. x IN (V:real^3->bool) /\ y IN V /\ (f1:(real^3) -> (real^3->bool)) x = f1 y ==> x = y)` ASSUME_TAC);; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `((f2:(real^3->bool)->(real^3)) o (f1:(real^3) -> (real^3->bool))) (x:real^3)= I x` ASSUME_TAC);; +e (UNDISCH_TAC `((f2:(real^3->bool)->(real^3)) o (f1:(real^3) -> (real^3->bool))) = I `);; +e (MESON_TAC[]);; +e (SUBGOAL_THEN `((f2:(real^3->bool)->(real^3)) o (f1:(real^3) -> +(real^3->bool))) (y:real^3)= I y` ASSUME_TAC);; +e (UNDISCH_TAC `((f2:(real^3->bool)->(real^3)) o (f1:(real^3) -> (real^3->bool))) = I `);; +e (MESON_TAC[]);; +e (UNDISCH_TAC `((f2:(real^3->bool)->(real^3)) o (f1:(real^3) -> (real^3->bool))) (x:real^3)= I x`);; +e (PURE_REWRITE_TAC [o_THM]);; +e (ASM_REWRITE_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (PURE_REWRITE_TAC [o_THM]);; +e (REPEAT STRIP_TAC);; +e (SUBGOAL_THEN `I (y:real^3) = I x` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (SIMP_TAC[I_THM]);; +e (MP_TAC(ISPECL [`f1:(real^3)->(real^3->bool)`;`(\v:(real^3->bool). sol (vec 0) v)`;`(V:real^3->bool)`] SUM_IMAGE));; +e (STRIP_TAC);; +e (SUBGOAL_THEN `sum (IMAGE (f1:(real^3)->(real^3->bool)) V) (\v:(real^3->bool). sol (vec 0) v) = + sum (V:real^3->bool) ((\v. sol (vec 0) v) o f1)` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (UNDISCH_TAC `IMAGE (f1:(real^3)->(real^3->bool)) (V:real^3->bool) = (X:(real^3->bool)->bool)`);; +e (STRIP_TAC);; +e (POP_ASSUM(fun th ->REWRITE_TAC[th]));; +e (STRIP_TAC);; +e (POP_ASSUM(fun th ->REWRITE_TAC[th]));; +e (SUBGOAL_THEN `(\v:real^3. sol (vec 0) (f1 v)) = ((\t. sol (vec 0) t) o f1)` ASSUME_TAC);; +e (REWRITE_TAC[FUN_EQ_THM]);; +e (GEN_TAC);; +e (PURE_REWRITE_TAC [o_THM]);; +e (REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[]);; + +let thm18 = top_thm();; + +(* +g `!(V:real^3 -> bool) (P:real^3->bool) (u:real^3) X F WF1 (f1:(real^3) -> (real^3->bool)) (f2:((real^3->bool))->(real^3)) (f3:(real^3) -> (real^3->bool)) (f4:((real^3->bool))->(real^3)). + (FINITE V) /\ packing V + /\(weakly_saturated V r r') /\ (V SUBSET ball_annulus) /\ + P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ + (polyhedron P) /\ (bounded P) /\ + (X = topological_component_yfan (vec 0,fan_of_polyhedron P)) /\ + (interior_point (vec 0) P) /\ + F = {f|f facet_of P} /\ + f1 o f2 = I /\ f2 o f1 = I /\ + f3 o f4 = I /\ f4 o f3 = I /\ + IMAGE f1 V = X /\ + IMAGE f3 V = F + ==> sum V (\v. &2 * pi - &2* &(CARD {u| u extreme_point_of (f3(v))}) * asn (cos (g_gun v))* sin(pi/ (&(CARD {u| u extreme_point_of f3(v)})))) <= sum (V) (\v:real^3. sol (vec 0) (f1(v)))`;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `!v:real^3. v IN V ==> (&2 * pi - &2* &(CARD {u| u extreme_point_of (f3(v))}) * asn (cos (g_gun v))* sin(pi/ (&(CARD {u| u extreme_point_of f3(v)})))) <= (sol (vec 0) (f1(v)))` ASSUME_TAC);; +e (GEN_TAC);; +e (STRIP_TAC);; + + + +type_of `!v:real^3. &2 * pi - &2* &(CARD {u| u extreme_point_of ((f3:(real^3) -> (real^3->bool))(v))}) * asn (cos (g_gun v))* sin(pi/ (&(CARD {u| u extreme_point_of f3(v)})))) <= +(sol (vec 0) ((f1:(real^3) -> (real^3->bool))(v)))`;; + + +search [`sum s f <= sum s g`];; + +type_of `!(V:real^3 -> bool) (P:real^3->bool) (u:real^3) X F WF1 (f1:(real^3) -> (real^3->bool)) (f2:((real^3->bool))->(real^3)) (f3:(real^3) -> (real^3->bool)) (f4:((real^3->bool))->(real^3)). + (FINITE V) /\ packing V + /\(weakly_saturated V r r') /\ (V SUBSET ball_annulus) /\ + P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ + (polyhedron P) /\ (bounded P) /\ + (X = topological_component_yfan (vec 0,fan_of_polyhedron P)) /\ + (interior_point (vec 0) P) /\ + F = {f|f facet_of P} /\ + f1 o f2 = I /\ f2 o f1 = I /\ + f3 o f4 = I /\ f4 o f3 = I /\ + IMAGE f1 V = X /\ + IMAGE f3 V = F`;; +type_of `sum (V) (\v:real^3. sol (vec 0) (f1(v)))`;; +search [`IMAGE`];; + +g `!(V:real^3 -> bool) (P:real^3->bool) (u:real^3) X WF1 (f1:(real^3) -> (real^3->bool)) (f2:((real^3->bool))->(real^3)) (f3:(real^3) -> (real^3->bool)) (f4:((real^3->bool))->(real^3)). + (FINITE V) /\ packing V + /\(weakly_saturated V r r') /\ (V SUBSET ball_annulus) /\ + P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ + (polyhedron P) /\ (bounded P) /\ + (X = topological_component_yfan (vec 0,fan_of_polyhedron P)) /\ + (interior_point (vec 0) P) + F_T = face_set_of_fan (fan_of_polyhedron P ) + /\ f1 o f2 = I /\ f2 o f1 = I + /\ f3 o f4 = I /\ f4 o f3 = I + /\ IMAGE f1 V = X + /\ IMAGE f3 V = F_T +==> (!(v:real^3) f WF1 k. f facet_of s /\ f = { p | p dot v = g_fun v } INTER P /\ WF1 IN X /\ rcone_gt (vec 0) v (cos(g_fun v)) SUBSET WF1 /\ (k = CARD {u | u extreme_point_of f }) + +g `!(V:real^3 -> bool) (P:real^3->bool) (u:real^3) f b:real X F_T (f1:(real^3) -> (real^3#real^3->bool)) (f2:((real^3#real^3->bool))->(real^3)). + (FINITE V) /\ packing V + /\(weakly_saturated V r r') /\ (V SUBSET ball_annulus) /\ + P = INTERS {half_spaces g_fun u| (u IN V) /\ + (polyhedron P) /\ (bounded P) /\ (f = {p | u dot p = g_fun u } INTER P) /\ + (?r. r> &0 /\ ball(vec 0,r) SUBSET P) /\ + (X = topological_component_yfan (vec 0,fan_of_polyhedron P)) /\ + F_T = face_set_of_fan (fan_of_polyhedron P ) /\ + F = {l | l facet_of P} /\ + /\ f1 o f2 = I /\ f2 o f1 = I + /\ IMAGE f1 V = F_T + + (~(vec 0 = u))} /\ + /\ (interior_point (vec 0) P) + + ==> +type_of `face_set_of_fan (fan_of_polyhedron P )`;; +type_of `facet_of`;; + +type_of `extreme_point_of`;; +type_of `facet_of`;; +inverse;; +EXTREME_POINT_OF_LINEAR_IMAGE;; + +search [`leaner f`];; + +search [`extreme_point_of`];; + + +type_of `f facet_of P`;; +type_of `(?(g1:F -> V). h1 o g1 = I /\ g1 o h1 = I)/\ + (?(g2:F_T -> V). h2 o g2 = I /\ g2 o h2 = I) `;; +*) + + +(*---------------------------------------------------------------------------*) +(*Dart Bound*) + +g `!(V:real^3 -> bool).(V SUBSET ball_annulus) ==> (!x:real^3. x IN V ==> ~(vec 0 = x))`;; +e (GEN_TAC);; +e (PURE_REWRITE_TAC [ball_annulus;cball;ball;DIFF]);; +e (STRIP_TAC);; +e (GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `x:real^3 IN {x | x IN {y | dist (vec 0,y) <= &2 * h0} /\ + ~(x IN {y | dist (vec 0,y) < &2})}` ASSUME_TAC);; +e (ASM_MESON_TAC [SUBSET]);; +e (ASM_CASES_TAC `vec 0 = x:real^3`);; +e (SUBGOAL_THEN `(vec 0):real^3 IN {x | x IN {y | dist (vec 0,y) <= &2 * h0} /\ + ~(x IN {y | dist (vec 0,y) < &2})}` ASSUME_TAC);; +e (ASM_MESON_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (REWRITE_TAC [DIST_REFL]);; +e (STRIP_TAC);; +e (ASM_MESON_TAC [ARITH_RULE `&0 < &2`]);; +e (ASM_REWRITE_TAC[]);; + +let th54 = top_thm();; + + +g `!(V:real^3 -> bool) (P:real^3 -> bool).(FINITE V) /\ packing V /\ (weakly_saturated V r r') /\ (V SUBSET ball_annulus) /\ ~(lmfun_ineq_center V) /\ P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ (polyhedron P) /\ (bounded P) ==> (interior_point (vec 0) P)`;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `INTERS {{p | u dot p < g_fun u}|(u IN (V:real^3->bool)) /\ (~(vec 0 = u))} SUBSET (P:real^3->bool)` ASSUME_TAC);; +e (ASM_REWRITE_TAC[half_spaces]);; +e (SUBGOAL_THEN `!u:real^3. u IN (V:real^3->bool) /\ ~(vec 0 = u) ==> {p | u dot p < g_fun u} SUBSET {p | u dot p <= g_fun u}` ASSUME_TAC);; +e (GEN_TAC);; +e (STRIP_TAC);; +e (REWRITE_TAC [SUBSET]);; +e (GEN_TAC);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (REWRITE_TAC [REAL_LT_IMP_LE]);; +e (POP_ASSUM (LABEL_TAC "F1"));; +e (SUBGOAL_THEN ` !u:real^3. u IN (V:real^3->bool) /\ ~(vec 0 = u) + ==> INTERS {{p | u dot p < g_fun u} | u IN V /\ ~(vec 0 = u)} SUBSET {p | u dot p <= g_fun u}` ASSUME_TAC);; +e (GEN_TAC);; +e (STRIP_TAC);; +e (REWRITE_TAC [INTERS;SUBSET;IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (REMOVE_THEN "F1" (MP_TAC o SPEC `u:real^3`));; +e (ASM_REWRITE_TAC[SUBSET;IN_ELIM_THM]);; +e (POP_ASSUM (fun th -> (MP_TAC (SPEC `{p:real^3 | u dot p < g_fun u}` th))));; +e (REWRITE_TAC[]);; +e (SUBGOAL_THEN `?u':real^3. (u' IN V /\ ~(vec 0 = u')) /\ + {p | u dot p < g_fun u} = {p | u' dot p < g_fun u'}` ASSUME_TAC);; +e (EXISTS_TAC `u:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (POP_ASSUM (LABEL_TAC "F2"));; +e (USE_THEN "F2" (MP_TAC o SPEC `x:real^3`));; +e (UNDISCH_TAC `u:real^3 dot x < g_fun u`);; +e (MESON_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (ABBREV_TAC `(s:real^3->bool) = INTERS {{p:real^3 | u dot p < g_fun u} | u IN V /\ ~(vec 0 = u)}`);; +e (DISCH_THEN (LABEL_TAC "F3"));; +e (REWRITE_TAC [INTERS;SUBSET;IN_ELIM_THM]);; +e (REPEAT STRIP_TAC);; +e (REMOVE_THEN "F3" (MP_TAC o SPEC `u':real^3`));; +e (ASM_REWRITE_TAC[SUBSET]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `x IN (s:real^3->bool)`);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC[]);; +e (SUBGOAL_THEN `!u:real^3. u IN V /\ ~(vec 0 = u) ==> vec 0 IN ({p:real^3 | u dot p < g_fun u})` ASSUME_TAC);; +e (GEN_TAC);; +e (REPEAT STRIP_TAC);; +e (PURE_REWRITE_TAC [IN_ELIM_THM]);; +e (PURE_REWRITE_TAC [DOT_RZERO;g_fun]);; +e (SUBGOAL_THEN `&1 <= dist (vec 0,(u:real^3)) / &2` ASSUME_TAC);; +e (ASM_MESON_TAC[thm2]);; +e (SUBGOAL_THEN `&0 < &2` ASSUME_TAC);; +e (ARITH_TAC);; +e (SUBGOAL_THEN `&1 / &2 <= (dist (vec 0,(u:real^3)) / &2) / &2` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC [REAL_LE_DIV2_EQ]);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [ARITH_RULE `(dist (vec 0,(u:real^3)) / &2) / &2 = dist (vec 0,u) / &4`]);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `dist (vec 0,u:real^3) <= &2 * h0` ASSUME_TAC);; +e (ASM_MESON_TAC [thm21]);; +e (SUBGOAL_THEN `&0 < &4` ASSUME_TAC);; +e (ARITH_TAC);; +e (SUBGOAL_THEN `dist (vec 0,u:real^3) / &4 <= (&2 * h0) / &4` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC [REAL_LE_DIV2_EQ]);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [ARITH_RULE `(&2 * h0) / &4 = h0 / &2`]);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `(&0 <= (pi / &6)) /\ ((pi / &6) <= pi)` ASSUME_TAC);; +e (MP_TAC PI_POS_LE);; +e (ARITH_TAC);; +e (SUBGOAL_THEN `acs (cos (pi/ &6)) = (pi / &6)` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [ACS_COS]);; +e (POP_ASSUM MP_TAC);; +e (PURE_REWRITE_TAC [COS_PI6]);; +e (REPEAT STRIP_TAC);; +e (SUBGOAL_THEN `-- &1 <= (dist (vec 0,u:real^3) / &4) /\ (dist (vec 0,u:real^3) / &4) < (sqrt (&3) / &2) /\ (sqrt (&3) / &2) <= &1` ASSUME_TAC);; +e (STRIP_TAC);; +e (UNDISCH_TAC `&1 / &2 <= dist (vec 0,u:real^3) / &4`);; +e (MP_TAC (ARITH_RULE `-- &1 <= &1 / &2`));; +e (ARITH_TAC);; +e (STRIP_TAC);; +e (UNDISCH_TAC `dist (vec 0,u:real^3) / &4 <= h0 / &2`);; +e (PURE_REWRITE_TAC [h0]);; +e (SUBGOAL_THEN `#1.26 / &2 < sqrt (&3) / &2` ASSUME_TAC);; +e (MP_TAC (ARITH_RULE `&0 < &2`));; +e (SUBGOAL_THEN `#1.26 < sqrt (&3)` ASSUME_TAC);; +e (SUBGOAL_THEN `#1.26 pow 2 < &3` ASSUME_TAC);; +e (ARITH_TAC);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [REAL_LT_RSQRT]);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC [REAL_LT_DIV2_EQ]);; +e (POP_ASSUM MP_TAC);; +e (ARITH_TAC);; +e (SUBGOAL_THEN `(&3) <= &2 pow 2` ASSUME_TAC);; +e (ARITH_TAC);; +e (SUBGOAL_THEN `sqrt (&3) <= &2` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (MP_TAC (ARITH_RULE `&0 <= &3 /\ &0 <= &2`));; +e (MESON_TAC [REAL_LE_LSQRT]);; +e (SUBGOAL_THEN `sqrt (&3) <= &1 * &2` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC [ARITH_RULE `&2 = &1 * &2`]);; +e (POP_ASSUM MP_TAC);; +e (MP_TAC (ARITH_RULE `&0 < &2`));; +e (MESON_TAC [REAL_LE_LDIV_EQ]);; +e (SUBGOAL_THEN `acs (sqrt (&3) / &2) < acs (dist (vec 0,u:real^3) / &4)` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [ACS_MONO_LT]);; +e (POP_ASSUM MP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC [REAL_SUB_LT]);; +e (SUBGOAL_THEN `vec 0 IN (INTERS {{p:real^3 | u dot p < g_fun u} | u IN (V:real^3->bool) /\ ~(vec 0 = u)})` ASSUME_TAC);; +e (PURE_REWRITE_TAC [IN_INTERS]);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (POP_ASSUM (LABEL_TAC "F1"));; +e (STRIP_TAC);; +e (USE_THEN "F1" (MP_TAC o SPEC `u:real^3`));; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC []);; +e (ASM_MESON_TAC[]);; +e (SUBGOAL_THEN `!u:real^3. u IN (V:real^3->bool) /\ ~(vec 0 = u) ==> open {p:real^3 | u dot p < g_fun u}` ASSUME_TAC);; +e (GEN_TAC);; +e (STRIP_TAC);; +e (REWRITE_TAC [OPEN_HALFSPACE_LT]);; +e (SUBGOAL_THEN `!u:real^3. u IN (V:real^3->bool) /\ ~(vec 0 = u) ==> interior ({p:real^3 | u dot p < g_fun u}) = ({p:real^3 | u dot p < g_fun u}) ` ASSUME_TAC);; +e (POP_ASSUM (LABEL_TAC "F1"));; +e (GEN_TAC);; +e (STRIP_TAC);; +e (REMOVE_THEN "F1" (MP_TAC o SPEC `u:real^3`));; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [INTERIOR_OPEN]);; +e (SUBGOAL_THEN `!u:real^3. u IN (V:real^3->bool) /\ ~(vec 0 = u) ==> + interior_point (vec 0) ({p:real^3 | u dot p < g_fun u}) ` ASSUME_TAC);; +e (GEN_TAC);; +e (POP_ASSUM (LABEL_TAC "F1"));; +e (STRIP_TAC);; +e (REMOVE_THEN "F1" (MP_TAC o SPEC `u:real^3`));; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `!u:real^3. u IN (V:real^3->bool) /\ ~(vec 0 = u) ==> vec 0 IN {p | u dot p < g_fun u}`);; +e (DISCH_THEN (LABEL_TAC "F1"));; +e (REMOVE_THEN "F1" (MP_TAC o SPEC `u:real^3`));; +e (STRIP_TAC);; +e (SUBGOAL_THEN `vec 0 IN (interior ({p:real^3 | u dot p < g_fun u}))` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (MESON_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [IN_INTERIOR_CBALL]);; +e (REWRITE_TAC [interior_point]);; +e (STRIP_TAC);; +e (EXISTS_TAC `e:real`);; +e (ASM_REWRITE_TAC[]);; +e (MP_TAC (ISPECL [`(vec 0):real^3`;`e:real`] BALL_SUBSET_CBALL));; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC [SUBSET_TRANS]);; + +e (MP_TAC (ISPECL [`{{p:real^3 | u dot p < g_fun u} | u IN (V:real^3->bool) /\ ~(vec 0 = u)}`] OPEN_INTERS));; +e (STRIP_TAC);; +e (SUBGOAL_THEN `FINITE {{p:real^3 | u dot p < g_fun u} | u IN (V:real^3->bool) /\ ~(vec 0 = u)}` ASSUME_TAC);; +e (UNDISCH_TAC `FINITE (V:real^3->bool)`);; +e (STRIP_TAC);; +e (MP_TAC (ISPECL [`(\u:real^3. {p:real^3 | u dot p < g_fun u})`;`V:real^3->bool`] FINITE_IMAGE));; +e (ASM_REWRITE_TAC [IMAGE]);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `{{p:real^3 | u dot p < g_fun u} | (u:real^3) IN (V:real^3->bool) /\ ~(vec 0 = u)} = ({y:real^3->bool | ?x:real^3. x IN V /\ y = {p | x dot p < g_fun x}})` ASSUME_TAC);; +e (REWRITE_TAC[EXTENSION]);; +e (GEN_TAC);; +e (EQ_TAC);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (STRIP_TAC);; +e (EXISTS_TAC `u:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (STRIP_TAC);; +e (EXISTS_TAC `x':real^3`);; +e (SUBGOAL_THEN `~(vec 0 = x':real^3)` ASSUME_TAC);; +e (ASM_MESON_TAC [th54]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC [EXTENSION]);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (ASM_MESON_TAC[]);; +e (ASM_REWRITE_TAC[]);; + +e (SUBGOAL_THEN `(!t:real^3->bool. t IN {{p | u dot p < g_fun u} | u IN (V:real^3->bool) /\ ~(vec 0 = u)} ==> open t)` ASSUME_TAC);; +e (STRIP_TAC);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ASM_MESON_TAC[]);; +e (SUBGOAL_THEN `open (INTERS {{p:real^3 | u dot p < g_fun u} | u IN (V:real^3->bool) /\ ~(vec 0 = u)})` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC[]);; +e (SUBGOAL_THEN `(INTERS {{p:real^3 | u dot p < g_fun u} | u IN (V:real^3->bool) /\ ~(vec 0 = u)}) SUBSET interior (P:real^3->bool)` ASSUME_TAC);; +e (ASM_MESON_TAC [INTERIOR_MAXIMAL]);; +e (SUBGOAL_THEN `(vec 0):real^3 IN (interior P)` ASSUME_TAC);; +e (UNDISCH_TAC `(vec 0):real^3 IN (INTERS {{p:real^3 | u dot p < g_fun u} | u IN (V:real^3->bool) /\ ~(vec 0 = u)})`);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [SUBSET]);; +e (MESON_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [IN_INTERIOR;interior_point]);; + +let th51= top_thm();; + + +g `!(V:real^3 -> bool) (P:real^3 -> bool).(FINITE V) /\ packing V /\ (weakly_saturated V r r') /\ (V SUBSET ball_annulus) /\ ~(lmfun_ineq_center V) /\ P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ (polyhedron P) /\ (bounded P) ==> fully_surrounded (fan_of_polyhedron P)`;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (REWRITE_TAC [fan_of_polyhedron;fully_surrounded]);; +e (STRIP_TAC);; +e (REWRITE_TAC [GSYM fan_of_polyhedron]);; +e (SUBGOAL_THEN `(interior_point (vec 0) (P:real^3 -> bool))` ASSUME_TAC);; +e (ASM_MESON_TAC[th51]);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC [BSXAQBQ]);; + +let th52 = top_thm();; + +g `!(V:real^3 -> bool) (P:real^3 -> bool).(FINITE V) /\ packing V /\ (weakly_saturated V r r') /\ (V SUBSET ball_annulus) /\ ~(lmfun_ineq_center V) /\ P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ (polyhedron P) /\ (bounded P) ==> conforming (fan_of_polyhedron P)`;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `fully_surrounded (fan_of_polyhedron (P:real^3 -> bool))` ASSUME_TAC);; +e (ASM_MESON_TAC[th52]);; +e (POP_ASSUM MP_TAC);; +e (PURE_REWRITE_TAC [fan_of_polyhedron]);; +e (REWRITE_TAC [PIIJBJK]);; + +let th53 = top_thm();; + +g `!(V:real^3 -> bool) (P:real^3 -> bool).(FINITE V) /\ packing V /\ (weakly_saturated V r r') /\ (V SUBSET ball_annulus) /\ +~(lmfun_ineq_center V) /\ P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ (polyhedron P) /\ (bounded P) ==> + (dart (hypermap_of_fan (fan_of_polyhedron P))) = dart_of_fan (fan_of_polyhedron P)`;; + +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `(interior_point (vec 0) (P:real^3 -> bool))` ASSUME_TAC);; +e (ASM_MESON_TAC [th51]);; +e (SUBGOAL_THEN `FANO (fan_of_polyhedron (P:real^3 -> bool))` ASSUME_TAC);; +e (ASM_MESON_TAC [JLIGZGS]);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [fan_of_polyhedron]);; +e (REWRITE_TAC [GSYM FANO_OF_FAN]);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (MP_TAC (ISPECL [`FST (fan_of_polyhedron (P:real^3 -> bool))`;`SND (fan_of_polyhedron (P:real^3 -> bool))`] COMPONENTS_HYPERMAP_OF_FAN));; +e (ASM_REWRITE_TAC[fan_of_polyhedron]);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; + +let DART_OF_HYPERMAP_FAN = top_thm();; + + +let FULLY_SURROUND_IS_NON_ISOLATED_FAN2 = prove(`!(V:real^3->bool) (E:(real^3->bool)->bool). +FANO(V,E) /\ (!v. v IN V ==> CARD (set_of_edge v V E) >1) +==> dart2_of_fan (V,E) = {}`,REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") +THEN REWRITE_TAC[SET_RULE`A={}<=> ~(?y. y IN A)`]THEN REWRITE_TAC[dart2_of_fan;IN_ELIM_THM] THEN STRIP_TAC THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th`v:real^3`[IN;CARD_CLAUSES]) THEN POP_ASSUM MP_TAC THEN ARITH_TAC);; + +g `!(V:real^3->bool) (E:(real^3->bool)->bool). +FANO(V,E) /\ (!x:real^3#real^3. x IN dart_of_fan (V,E) ==> CARD (set_of_edge (FST x) V (E:(real^3->bool)->bool)) > 1) +==> dart_of_fan (V,E) = dart1_of_fan (V,E)`;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (REWRITE_TAC [EXTENSION]);; +e (GEN_TAC);; +e (EQ_TAC);; +e (POP_ASSUM (LABEL_TAC "F1"));; +e (STRIP_TAC);; +e (REMOVE_THEN "F1" (MP_TAC o SPEC `x:real^3#real^3`));; +e (ASM_REWRITE_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [dart_of_fan;UNION;IN_ELIM_THM]);; +e (STRIP_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `CARD (set_of_edge (FST (x:real^3#real^3)) (V:real^3->bool) (E:(real^3->bool)->bool)) = 0` ASSUME_TAC);; +e (ASM_REWRITE_TAC[CARD_CLAUSES]);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (ARITH_TAC);; +e (STRIP_TAC);; +e (REWRITE_TAC [dart1_of_fan]);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (EXISTS_TAC `v:real^3`);; +e (EXISTS_TAC `w:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC[dart1_of_fan;dart_of_fan;IN_UNION]);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; + +let FULLY_SURROUND_IS_NON_ISOLATED_FAN3 = top_thm();; + +let DARTSET_FULLY_SURROUNDED_IS_NON_ISOLATED_FAN2 = prove (`!(V:real^3->bool) (E:(real^3->bool)->bool). +FANO(V,E) /\ (!v. v IN V ==>CARD (set_of_edge v V E) >1) +==> dart_of_fan (V,E) = dart1_of_fan (V,E)`,REPEAT STRIP_TAC THEN MRESA_TAC FULLY_SURROUND_IS_NON_ISOLATED_FAN2[`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC [dart2_of_fan] THEN STRIP_TAC THEN ASM_REWRITE_TAC[dart_of_fan;dart1_of_fan] THEN SET_TAC[]);; + + +let AZIM_PI = prove(`!(V:real^3 -> bool) (E:(real^3->bool)->bool) v:real^3 w . v IN V /\ (~(CARD (set_of_edge v V E) > 1)) ==> azim_dart (V,E) (v,w) = &2 * pi`,REPEAT GEN_TAC THEN REPEAT STRIP_TAC THEN REWRITE_TAC [azim_dart;azim_fan] THEN ASM_CASES_TAC `v:real^3 = w` THEN ASM_REWRITE_TAC[] THEN ASM_REWRITE_TAC[]);; + +let AZIM_PI1 = prove(`!(V:real^3 -> bool) (E:(real^3->bool)->bool) (x:real^3#real^3) . (FST x) IN V /\ (~(CARD (set_of_edge (FST x) V E) > 1)) ==> azim_dart (V,E) ((FST x),(SND x)) = &2 * pi`,REPEAT GEN_TAC THEN REPEAT STRIP_TAC THEN REWRITE_TAC [azim_dart;azim_fan] THEN ASM_CASES_TAC `(FST (x:real^3#real^3)) = (SND x)` THEN ASM_REWRITE_TAC[] THEN ASM_REWRITE_TAC[]);; + +g `!(V:real^3 -> bool) (E:(real^3->bool)->bool) (x:real^3#real^3).fully_surrounded (V,E) /\ FANO (V,E) /\ x IN dart_of_fan (V,E) ==> CARD (set_of_edge (FST x) V (E:(real^3->bool)->bool)) > 1`;; +e (REPEAT GEN_TAC);; +e (REWRITE_TAC [fully_surrounded]);; +e (STRIP_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM(LABEL_TAC "F1"));; +e (REPEAT STRIP_TAC);; +e (ASM_CASES_TAC `CARD (set_of_edge (FST (x:real^3#real^3)) (V:real^3->bool) (E:(real^3->bool)->bool)) > 1`);; +e (ASM_REWRITE_TAC[]);; +e (REMOVE_THEN "F1" (MP_TAC o SPEC `x:real^3#real^3`));; +e (STRIP_TAC);; +e (MP_TAC (ISPECL [`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`FST(x:real^3#real^3)`;`SND (x:real^3#real^3)`]AZIM_PI ));; +e (ASM_REWRITE_TAC[]);; +e (SUBGOAL_THEN `FST (x:real^3#real^3) IN (V:real^3->bool)` ASSUME_TAC);; +e (UNDISCH_TAC `(x:real^3#real^3) IN dart_of_fan ((V:real^3->bool),(E:(real^3->bool)->bool))`);; +e (ONCE_REWRITE_TAC [ARITH_RULE `(x:real^3#real^3) = (FST x, SND x)`]);; +e (PURE_REWRITE_TAC [dart_of_fan]);; +e (REWRITE_TAC [UNION]);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (SUBGOAL_THEN `UNIONS (E:(real^3->bool) -> bool) SUBSET (V:real^3->bool)` ASSUME_TAC);; +e (UNDISCH_TAC `FANO (V:real^3->bool,E:(real^3->bool) -> bool)`);; +e (REWRITE_TAC [FANO]);; +e (MESON_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [UNIONS;SUBSET]);; +e (DISCH_THEN (LABEL_TAC "F1"));; +e (REMOVE_THEN "F1" (MP_TAC o SPEC `v:real^3`));; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `v:real^3 IN {v:real^3,w:real^3}` ASSUME_TAC);; +e (SET_TAC[]);; +e (ASM_MESON_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `azim_dart (V:real^3->bool,E:(real^3->bool) -> bool) (x:real^3#real^3) < pi` ASSUME_TAC);; +e (ASM_MESON_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM SUBST1_TAC);; +e (MP_TAC PI_POS);; +e (ARITH_TAC);; + +let FULLY_EDGE = top_thm();; + +g `!(V:real^3 -> bool) (E:(real^3->bool)->bool).fully_surrounded (V,E) /\ FANO(V,E) ==> (!x. x IN dart_of_fan (V,E) ==> CARD (set_of_edge (FST x) V E) > 1)`;; +e (REPEAT GEN_TAC);; +e (REPEAT STRIP_TAC);; +e (ASM_MESON_TAC [FULLY_EDGE]);; + +let FULLY_EDGE1 = top_thm();; + +g `!(V:real^3 -> bool) (E:(real^3->bool)->bool).fully_surrounded (V,E) /\ FANO(V,E) ==> dart_of_fan (V,E) = dart1_of_fan (V,E)`;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `(!x. x IN dart_of_fan ((V:real^3 -> bool),(E:(real^3->bool)->bool)) ==> CARD (set_of_edge (FST x) V E) > 1)` ASSUME_TAC);; +e (ASM_MESON_TAC [FULLY_EDGE1]);; +e (ASM_MESON_TAC [FULLY_SURROUND_IS_NON_ISOLATED_FAN3]);; + +let FULLY_SURROUNDED_IMP_DART = top_thm();; + + +g `!(V:real^3 -> bool) (P:real^3 -> bool).(FINITE V) /\ packing V /\ (weakly_saturated V r r') /\ (V SUBSET ball_annulus) /\ ~(lmfun_ineq_center V) /\ P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ (polyhedron P) /\ (bounded P) ==> CARD (dart (hypermap_of_fan (fan_of_polyhedron P))) <= + (6*(CARD (face_set_of_fan (fan_of_polyhedron P)))-12)`;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `conforming (fan_of_polyhedron (P:real^3 -> bool))` ASSUME_TAC);; +e (ASM_MESON_TAC [th53]);; +e (SUBGOAL_THEN `(interior_point (vec 0) (P:real^3 -> bool))` ASSUME_TAC);; +e (ASM_MESON_TAC [th51]);; +e (SUBGOAL_THEN `FANO (fan_of_polyhedron (P:real^3 -> bool))` ASSUME_TAC);; +e (ASM_MESON_TAC [JLIGZGS]);; +e (SUBGOAL_THEN `connected_hypermap (hypermap_of_fan (fan_of_polyhedron (P:real^3 -> bool)))` ASSUME_TAC);; +e (UNDISCH_TAC `conforming (fan_of_polyhedron (P:real^3 -> bool))`);; +e (UNDISCH_TAC `FANO (fan_of_polyhedron (P:real^3 -> bool))`);; +e (REWRITE_TAC [fan_of_polyhedron]);; +e (ASM_MESON_TAC [WGVWSKE]);; +e (SUBGOAL_THEN `planar_hypermap (hypermap_of_fan (fan_of_polyhedron (P:real^3 -> bool)))` ASSUME_TAC);; +e (UNDISCH_TAC `conforming (fan_of_polyhedron (P:real^3 -> bool))`);; +e (UNDISCH_TAC `FANO (fan_of_polyhedron (P:real^3 -> bool))`);; +e (REWRITE_TAC [fan_of_polyhedron]);; +e (ASM_MESON_TAC [GGRLKHP]);; +e (SUBGOAL_THEN `plain_hypermap (hypermap_of_fan (fan_of_polyhedron (P:real^3 -> bool)))` ASSUME_TAC);; +e (UNDISCH_TAC `conforming (fan_of_polyhedron (P:real^3 -> bool))`);; +e (UNDISCH_TAC `FANO (fan_of_polyhedron (P:real^3 -> bool))`);; +e (REWRITE_TAC [fan_of_polyhedron]);; +e (ASM_MESON_TAC [PLAIN_HYPERMAP]);; +e (SUBGOAL_THEN `dart (hypermap_of_fan (fan_of_polyhedron (P:real^3->bool))) = + dart_of_fan (fan_of_polyhedron P)` ASSUME_TAC);; +e (ASM_MESON_TAC [DART_OF_HYPERMAP_FAN]);; +e (SUBGOAL_THEN `fully_surrounded (fan_of_polyhedron (P:real^3->bool))` ASSUME_TAC);; +e (UNDISCH_TAC `conforming (fan_of_polyhedron (P:real^3->bool))`);; +e (REWRITE_TAC [fan_of_polyhedron;conforming]);; +e (MESON_TAC[]);; +e (SUBGOAL_THEN `!x:real^3#real^3. x IN dart (hypermap_of_fan (fan_of_polyhedron P)) ==> ~(edge_map (hypermap_of_fan (fan_of_polyhedron P)) x = x) /\ 3 <= CARD (node (hypermap_of_fan (fan_of_polyhedron P)) x)` ASSUME_TAC);; +e (GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `x IN dart_of_fan (fan_of_polyhedron (P:real^3->bool))` ASSUME_TAC);; +e (ASM_MESON_TAC[]);; +e (MP_TAC (ISPECL [`{v | v extreme_point_of (P:real^3->bool)}`;`{{v, w} | ~(v = w) /\ convex hull {v, w} face_of (P:real^3->bool)}`] FULLY_SURROUNDED_IMP_DART));; +e (REWRITE_TAC [GSYM fan_of_polyhedron]);; +e (FIND_ASSUM (fun th -> REWRITE_TAC[th])`FANO (fan_of_polyhedron (P:real^3->bool))`);; +e (FIND_ASSUM (fun th -> REWRITE_TAC[th])`fully_surrounded (fan_of_polyhedron (P:real^3->bool))`);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `x IN dart1_of_fan (fan_of_polyhedron (P:real^3->bool))` ASSUME_TAC);; +e (ASM_MESON_TAC[]);; +e (SUBGOAL_THEN `FAN (vec 0,fan_of_polyhedron (P:real^3->bool))` ASSUME_TAC);; +e (UNDISCH_TAC `FANO (fan_of_polyhedron (P:real^3->bool))`);; +e (REWRITE_TAC [fan_of_polyhedron]);; +e (ABBREV_TAC `V_P = {v | v extreme_point_of (P:real^3->bool)}`);; +e (ABBREV_TAC `E_P = {{v, w} | ~(v = w) /\ convex hull {v, w} face_of (P:real^3->bool)}`);; +e (MESON_TAC [FANO_OF_FAN]);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `edge_map (hypermap_of_fan (fan_of_polyhedron (P:real^3->bool))) = e_fan_pair_ext (fan_of_polyhedron (P:real^3->bool))` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [fan_of_polyhedron]);; +e (ABBREV_TAC `V_P = {v | v extreme_point_of (P:real^3->bool)}`);; +e (ABBREV_TAC `E_P = {{v, w} | ~(v = w) /\ convex hull {v, w} face_of (P:real^3->bool)}`);; +e (MESON_TAC [COMPONENTS_HYPERMAP_OF_FAN]);; +e (POP_ASSUM(fun th ->REWRITE_TAC[th]));; +e (SUBGOAL_THEN `e_fan_pair_ext (fan_of_polyhedron (P:real^3->bool)) x = e_fan_pair (fan_of_polyhedron P) x` ASSUME_TAC);; +e (UNDISCH_TAC `x IN dart1_of_fan (fan_of_polyhedron (P:real^3->bool))`);; +e (REWRITE_TAC [fan_of_polyhedron]);; +e (ABBREV_TAC `V_P = {v | v extreme_point_of (P:real^3->bool)}`);; +e (ABBREV_TAC `E_P = {{v, w} | ~(v = w) /\ convex hull {v, w} face_of (P:real^3->bool)}`);; +e (REWRITE_TAC [e_fan_pair_ext]);; +e (ARITH_TAC);; +e (POP_ASSUM(fun th ->REWRITE_TAC[th]));; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [fan_of_polyhedron]);; +e (ABBREV_TAC `V_P = {v | v extreme_point_of (P:real^3->bool)}`);; +e (ABBREV_TAC `E_P = {{v, w} | ~(v = w) /\ convex hull {v, w} face_of (P:real^3->bool)}`);; +e (MESON_TAC [E_HAS_NO_FIXED_POINTS_IN_D1]);; +e (SUBGOAL_THEN `surrounded_node (fan_of_polyhedron (P:real^3->bool)) (FST (x:real^3#real^3))` ASSUME_TAC);; +e (REWRITE_TAC [fan_of_polyhedron;surrounded_node]);; +e (GEN_TAC);; +e (REWRITE_TAC [GSYM fan_of_polyhedron]);; +e (SUBGOAL_THEN `(!x. x IN dart_of_fan (fan_of_polyhedron (P:real^3->bool)) ==> azim_dart (fan_of_polyhedron (P:real^3->bool)) x < pi)` ASSUME_TAC);; +e (UNDISCH_TAC `fully_surrounded (fan_of_polyhedron (P:real^3->bool))`);; +e (REWRITE_TAC [fan_of_polyhedron;fully_surrounded]);; +e (POP_ASSUM (LABEL_TAC "F1"));; +e (REMOVE_THEN "F1" (MP_TAC o SPEC `x':real^3#real^3`));; +e (MESON_TAC[]);; +e (MP_TAC (ISPECL [`{v | v extreme_point_of (P:real^3->bool)}`;`{{v, w} | ~(v = w) /\ convex hull {v, w} face_of (P:real^3->bool)}`;`FST (x:real^3#real^3)`;`SND (x:real^3#real^3)`]SURROUNDED_IMP_CARD_NODE_GE_3));; +e (REWRITE_TAC [GSYM fan_of_polyhedron]);; +e (FIND_ASSUM (fun th -> REWRITE_TAC[th])`FAN (vec 0,fan_of_polyhedron (P:real^3->bool))`);; +e (FIND_ASSUM (fun th -> REWRITE_TAC[th])`x IN dart1_of_fan (fan_of_polyhedron (P:real^3->bool))`);; +e (FIND_ASSUM (fun th -> REWRITE_TAC[th])`surrounded_node (fan_of_polyhedron (P:real^3->bool)) (FST (x:real^3#real^3))`);; +e (REWRITE_TAC [GE]);; + +e (REWRITE_TAC [fan_of_polyhedron;face_set_of_fan]);; +e (REWRITE_TAC [GSYM fan_of_polyhedron]);; + +e (MP_TAC (ISPECL [`hypermap_of_fan (fan_of_polyhedron (P:real^3->bool))`]lemmaTGJISOK));; +e (REWRITE_TAC [number_of_faces]);; +e (ASM_REWRITE_TAC[]);; + + +let th5 = top_thm();; + +(*----------------------------------------------------------------------------*) +(* proof CARD V = CARD {f|f facet_of V}*) + +g `!(V:real^3 -> bool) (P:real^3 -> bool) F.(FINITE V) /\ packing V /\ (V SUBSET ball_annulus) /\ +(weakly_saturated V r r') /\ P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ (polyhedron P) /\ (bounded P) /\ F = {f|f facet_of P} ==> (CARD V) = (CARD F)`;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `(?(h:(real^3) -> (real^3->bool)) (g:((real^3->bool))->(real^3)). h o g = I /\ g o h = I /\ IMAGE h V = F')` ASSUME_TAC);; +e (ASM_MESON_TAC [CZZHBLI_1]);; +e (POP_ASSUM MP_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `(!(x:real^3) y. x IN (V:real^3->bool) /\ y IN V /\ (h:(real^3) -> (real^3->bool)) x = h y ==> x = y)` ASSUME_TAC);; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `((g:((real^3->bool))->(real^3))o(h:(real^3) -> (real^3->bool))) x:real^3 = I x` ASSUME_TAC);; +e (UNDISCH_TAC `((g:((real^3->bool))->(real^3))o(h:(real^3) -> (real^3->bool))) = I`);; +e (MESON_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (PURE_REWRITE_TAC [o_THM]);; +e (POP_ASSUM(fun th ->REWRITE_TAC[th]));; +e (SUBGOAL_THEN `((g:((real^3->bool))->(real^3))o(h:(real^3) -> (real^3->bool))) y:real^3 = I y` ASSUME_TAC);; +e (UNDISCH_TAC `((g:((real^3->bool))->(real^3))o(h:(real^3) -> (real^3->bool))) = I`);; +e (MESON_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (PURE_REWRITE_TAC [o_THM]);; +e (REPEAT STRIP_TAC);; +e (SUBGOAL_THEN `I (y:real^3) = I x` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (SIMP_TAC[I_THM]);; +e (SUBGOAL_THEN `CARD (IMAGE (h:(real^3) -> (real^3->bool)) (V:real^3->bool)) = CARD V ` ASSUME_TAC);; +e (UNDISCH_TAC `FINITE (V:real^3->bool)`);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC [CARD_IMAGE_INJ]);; +e (POP_ASSUM MP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; + +let CARD_1 = top_thm();; + +(*---------------------------------------------------------------------------*) + +(*Proof CARD {f|f facet_of V} = CARD (topological_component_yfan (vec 0,fan_of_polyhedron V)) *) + +g `!(V:real^3 -> bool) (P:real^3 -> bool) F WF.(FINITE V) /\ packing V /\ (V SUBSET ball_annulus)/\ (~(lmfun_ineq_center V)) /\ F = {f|f facet_of P} /\ +(weakly_saturated V r r') /\ P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ (polyhedron P) /\ (bounded P) /\ WF = (topological_component_yfan (vec 0,fan_of_polyhedron P)) ==> FINITE F`;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `(?(h:(real^3) -> (real^3->bool)) (g:((real^3->bool))->(real^3)). h o g = I /\ g o h = I /\ IMAGE h V = F')` ASSUME_TAC);; +e (ASM_MESON_TAC [CZZHBLI_1]);; +e (POP_ASSUM MP_TAC);; +e (STRIP_TAC);; +e (MP_TAC (ISPECL [`(h:(real^3) -> (real^3->bool))`;`V:real^3->bool`]FINITE_IMAGE));; +e (ASM_REWRITE_TAC[]);; + +let FINITE_FACE_SET = top_thm();; + +g `!(V:real^3 -> bool) (P:real^3 -> bool) F WF.(FINITE V) /\ packing V /\ (V SUBSET ball_annulus)/\ (~(lmfun_ineq_center V)) /\ F = {f|f facet_of P} /\ +(weakly_saturated V r r') /\ P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ (polyhedron P) /\ (bounded P) /\ WF = (topological_component_yfan (vec 0,fan_of_polyhedron P)) ==> CARD F = CARD WF `;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `interior_point (vec 0) (P:real^3 -> bool)` ASSUME_TAC);; +e (ASM_MESON_TAC [th51]);; +e (SUBGOAL_THEN `(?(h:(real^3->bool) -> (real^3->bool)) (g: (real^3->bool) -> (real^3->bool)). h o g = I /\ g o h = I /\ IMAGE h F' = WF')` ASSUME_TAC);; +e (ASM_MESON_TAC [AMHFNXP]);; +e (POP_ASSUM MP_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `(!(x:real^3->bool) y. x IN (F':(real^3->bool)->bool) /\ y IN F' /\ (h:(real^3->bool) -> (real^3->bool)) x = h y ==> x = y)` ASSUME_TAC);; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; + +e (SUBGOAL_THEN `((g:(real^3->bool) -> (real^3->bool))o(h:(real^3->bool) -> (real^3->bool))) x:real^3->bool = I x` ASSUME_TAC);; +e (UNDISCH_TAC `((g:(real^3->bool) -> (real^3->bool))o(h:(real^3->bool) -> (real^3->bool))) = I`);; +e (MESON_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (PURE_REWRITE_TAC [o_THM]);; +e (POP_ASSUM(fun th ->REWRITE_TAC[th]));; +e (SUBGOAL_THEN `((g:(real^3->bool) -> (real^3->bool))o(h:(real^3->bool) -> (real^3->bool))) y:real^3->bool = I y` ASSUME_TAC);; +e (UNDISCH_TAC `((g:(real^3->bool) -> (real^3->bool))o(h:(real^3->bool) -> (real^3->bool))) = I`);; +e (MESON_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (PURE_REWRITE_TAC [o_THM]);; +e (REPEAT STRIP_TAC);; +e (SUBGOAL_THEN `I (y:real^3->bool) = I x` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (SIMP_TAC[I_THM]);; +e (SUBGOAL_THEN `CARD (IMAGE (h:(real^3->bool) -> (real^3->bool)) (F':(real^3->bool)->bool)) = CARD F' ` ASSUME_TAC);; +e (SUBGOAL_THEN `FINITE (F':(real^3->bool) -> bool)` ASSUME_TAC);; +e (ASM_MESON_TAC [FINITE_FACE_SET]);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC [CARD_IMAGE_INJ]);; +e (POP_ASSUM MP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; + +let CARD_2 = top_thm();; + + +(*----------------------------------------------------------------------------*) + +(*Proof CARD (topological_component_yfan (vec 0,fan_of_polyhedron V)) = + CARD (face_set_of_fan (fan_of_polyhedron V)) *) + +g `!(V:real^3 -> bool) (P:real^3 -> bool) F WF.(FINITE V) /\ packing V /\ (V SUBSET ball_annulus)/\ (~(lmfun_ineq_center V)) /\ F = {f|f facet_of P} /\ +(weakly_saturated V r r') /\ P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ (polyhedron P) /\ (bounded P) /\ WF = (topological_component_yfan (vec 0,fan_of_polyhedron P)) /\ (F_T = face_set_of_fan (fan_of_polyhedron P)) +==> FINITE WF`;; + +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `FINITE (F':(real^3->bool)->bool)` ASSUME_TAC);; +e (ASM_MESON_TAC [FINITE_FACE_SET]);; +e (SUBGOAL_THEN `interior_point (vec 0) (P:real^3 -> bool)` ASSUME_TAC);; +e (ASM_MESON_TAC [th51]);; + +e (SUBGOAL_THEN `(?(h:(real^3->bool) -> (real^3->bool)) (g: (real^3->bool) -> (real^3->bool)). h o g = I /\ g o h = I /\ IMAGE h F' = WF')` ASSUME_TAC);; +e (ASM_MESON_TAC [AMHFNXP]);; +e (POP_ASSUM MP_TAC);; +e (STRIP_TAC);; +e (MP_TAC (ISPECL [`(h:(real^3->bool) -> (real^3->bool))`;`F':(real^3->bool)->bool`]FINITE_IMAGE));; +e (ASM_REWRITE_TAC[]);; + +let FINITE_TOPO_SET = top_thm();; + + +g `!(V:real^3 -> bool) (P:real^3 -> bool) F WF.(FINITE V) /\ packing V /\ (V SUBSET ball_annulus)/\ (~(lmfun_ineq_center V)) /\ F = {f|f facet_of P} /\ +(weakly_saturated V r r') /\ P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ (polyhedron P) /\ (bounded P) /\ WF = (topological_component_yfan (vec 0,fan_of_polyhedron P)) /\ (F_T = face_set_of_fan (fan_of_polyhedron P)) ==> CARD WF = CARD F_T`;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `(interior_point (vec 0) (P:real^3 -> bool))` ASSUME_TAC);; +e (ASM_MESON_TAC [th51]);; +e (SUBGOAL_THEN ` FANO (fan_of_polyhedron (P:real^3 -> bool))` ASSUME_TAC);; +e (ASM_MESON_TAC [JLIGZGS]);; +e (SUBGOAL_THEN `(conforming (fan_of_polyhedron (P:real^3 -> bool)))` ASSUME_TAC);; +e (ASM_MESON_TAC [th53]);; +e (SUBGOAL_THEN `(?(h: (real^3->bool) -> (real^3#real^3->bool)) (g: (real^3#real^3->bool) -> (real^3->bool)). h o g = I /\ g o h = I /\ IMAGE h (WF':(real^3->bool)->bool) = (F_T:(real^3#real^3->bool)->bool))` ASSUME_TAC);; +e (REPEAT (POP_ASSUM MP_TAC));; +e (PURE_REWRITE_TAC [fan_of_polyhedron]);; +e (REPEAT STRIP_TAC);; +e (ASM_MESON_TAC [UVPFEEP_1]);; + +e (POP_ASSUM MP_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `(!(x:real^3->bool) y. x IN (WF':(real^3->bool)->bool) /\ y IN WF' /\ (h:(real^3->bool) -> (real^3#real^3->bool)) x = h y ==> x = y)` ASSUME_TAC);; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; + +e (SUBGOAL_THEN `((g:(real^3#real^3->bool) -> (real^3->bool))o(h:(real^3->bool) -> (real^3#real^3->bool))) x:real^3->bool = I x` ASSUME_TAC);; +e (UNDISCH_TAC `((g:(real^3#real^3->bool) -> (real^3->bool))o(h:(real^3->bool) -> (real^3#real^3->bool))) = I`);; +e (MESON_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (PURE_REWRITE_TAC [o_THM]);; +e (POP_ASSUM(fun th ->REWRITE_TAC[th]));; +e (SUBGOAL_THEN `((g:(real^3#real^3->bool) -> (real^3->bool))o(h:(real^3->bool) -> (real^3#real^3->bool))) y:real^3->bool = I y` ASSUME_TAC);; +e (UNDISCH_TAC `((g:(real^3#real^3->bool) -> (real^3->bool))o(h:(real^3->bool) -> (real^3#real^3->bool))) = I`);; +e (MESON_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (PURE_REWRITE_TAC [o_THM]);; +e (REPEAT STRIP_TAC);; +e (SUBGOAL_THEN `I (y:real^3->bool) = I x` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (SIMP_TAC[I_THM]);; +e (SUBGOAL_THEN `CARD (IMAGE (h:(real^3->bool) -> (real^3#real^3->bool)) (WF':(real^3->bool)->bool)) = CARD WF' ` ASSUME_TAC);; +e (SUBGOAL_THEN `FINITE (WF':(real^3->bool) -> bool)` ASSUME_TAC);; +e (ASM_MESON_TAC [FINITE_TOPO_SET]);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC [CARD_IMAGE_INJ]);; +e (POP_ASSUM MP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ARITH_TAC);; + +let CARD_3 = top_thm();; + + +(*----------------------------------------------------------------------------*) + +g `!(V:real^3 -> bool) (P:real^3 -> bool) F WF.(FINITE V) /\ packing V /\ (V SUBSET ball_annulus)/\ (~(lmfun_ineq_center V)) /\ F = {f|f facet_of P} /\ +(weakly_saturated V r r') /\ P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ (polyhedron P) /\ (bounded P) /\ WF = (topological_component_yfan (vec 0,fan_of_polyhedron P)) /\ (F_T = face_set_of_fan (fan_of_polyhedron P)) ==> CARD V = CARD F_T`;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `(CARD (V:real^3 -> bool)) = (CARD (F':(real^3->bool)->bool))` ASSUME_TAC);; +e (ASM_MESON_TAC [CARD_1]);; +e (SUBGOAL_THEN `(CARD (F':(real^3->bool)->bool)) = CARD (WF':(real^3->bool)->bool)` ASSUME_TAC);; +e (ASM_MESON_TAC [CARD_2]);; +e (SUBGOAL_THEN `CARD (WF':(real^3->bool)->bool) = CARD (F_T:(real^3#real^3->bool)->bool) ` ASSUME_TAC);; +e (ASM_MESON_TAC [CARD_3]);; +e (ASM_MESON_TAC[]);; + +let CARD_4 = top_thm();; + + +(*---------------------------------------------------------------------------*) +g `!(V:real^3 -> bool) (P:real^3 -> bool).(FINITE V) /\ packing V /\ (weakly_saturated V r r') /\ (V SUBSET ball_annulus) /\ +~(lmfun_ineq_center V) /\ P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ (polyhedron P) /\ (bounded P) ==> +nsum (face_set_of_fan (fan_of_polyhedron P)) (\u:real^3#real^3->bool. (CARD u)) + = CARD (dart (hypermap_of_fan (fan_of_polyhedron P)))`;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (MP_TAC (ISPECL [`(dart (hypermap_of_fan (fan_of_polyhedron (P:real^3->bool))))`]card_partition_formula));; +e (DISCH_THEN (LABEL_TAC "F1"));; +e (REMOVE_THEN "F1" (MP_TAC o SPEC `face_map (hypermap_of_fan (fan_of_polyhedron (P:real^3->bool)))`));; +e (REWRITE_TAC [face_map_and_darts]);; +e (STRIP_TAC);; +e (REWRITE_TAC [fan_of_polyhedron;face_set_of_fan]);; +e (REWRITE_TAC [GSYM fan_of_polyhedron]);; +e (REWRITE_TAC [face_set]);; +e (POP_ASSUM (fun th -> REWRITE_TAC[th]));; + +let CARD_5 = top_thm();; + +(*--------------------------------------------------------------------------*) + +g `!(V:real^3 -> bool) (P:real^3 -> bool) F WF.(FINITE V) /\ packing V /\ (V SUBSET ball_annulus)/\ (~(lmfun_ineq_center V)) /\ F = {f|f facet_of P} /\ +(weakly_saturated V r r') /\ P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ (polyhedron P) /\ (bounded P) /\ WF = (topological_component_yfan (vec 0,fan_of_polyhedron P)) /\ (F_T = face_set_of_fan (fan_of_polyhedron P)) ==> +nsum (face_set_of_fan (fan_of_polyhedron P)) (\u:real^3#real^3->bool. (CARD u)) + <= (6*(CARD V)-12)`;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; + +(*SUBGOAL 1*) +e (SUBGOAL_THEN `nsum (face_set_of_fan (fan_of_polyhedron (P:real^3 -> bool))) (\u:real^3#real^3->bool. (CARD u)) + = CARD (dart (hypermap_of_fan (fan_of_polyhedron P)))` ASSUME_TAC);; +e (ASM_MESON_TAC[CARD_5]);; + +(*SUBGOAL 2*) +e (SUBGOAL_THEN `CARD (V:real^3 -> bool) = CARD (F_T:(real^3#real^3->bool)->bool)` ASSUME_TAC);; +e (ASM_MESON_TAC [CARD_4]);; +(*SUBGOAL 3*) +e (SUBGOAL_THEN `conforming (fan_of_polyhedron (P:real^3->bool))` ASSUME_TAC);; +e (ASM_MESON_TAC [th53]);; +e (SUBGOAL_THEN `CARD (dart (hypermap_of_fan (fan_of_polyhedron (P:real^3 -> bool)))) <= + (6*(CARD (face_set_of_fan (fan_of_polyhedron P)))-12)` ASSUME_TAC);; +e (ASM_MESON_TAC[th5]);; +e (UNDISCH_TAC `CARD (V:real^3->bool) = CARD (F_T:(real^3#real^3->bool)->bool)`);; +e (STRIP_TAC);; +e (POP_ASSUM(fun th ->REWRITE_TAC[th]));; +e (UNDISCH_TAC `F_T = face_set_of_fan (fan_of_polyhedron (P:real^3->bool))`);; +e (STRIP_TAC);; +e (POP_ASSUM(fun th ->REWRITE_TAC[th]));; +e (UNDISCH_TAC `nsum (face_set_of_fan (fan_of_polyhedron (P:real^3->bool))) (\u. CARD u) = + CARD (dart (hypermap_of_fan (fan_of_polyhedron P)))`);; +e (STRIP_TAC);; +e (POP_ASSUM(fun th ->REWRITE_TAC[th]));; +e (ASM_REWRITE_TAC[]);; + +let th6 = top_thm();; + +(*--------------------------------------------------------------------------*) +let th7_concl = `!V X.FINITE V /\ packing V /\ + V SUBSET ball_annulus /\ + P = INTERS {half_spaces g_fun u | u IN V /\ ~(vec 0 = u)} /\ + (polyhedron P) /\ (bounded P) /\ + X = topological_component_yfan (vec 0,fan_of_polyhedron P) + +==> &4 * pi = sum X (\v. sol (vec 0) (v))`;; + +let th7 = new_axiom th7_concl;; + + +(*----------------------------------------------------------------------------*) +let th8_concl = `!(V:real^3->bool) X P F F_T (f1:(real^3) -> (real^3->bool)) (f2:((real^3->bool))->(real^3)) (f3:(real^3) -> (real^3->bool)) (f4:((real^3->bool))->(real^3)). + FINITE V /\ packing V /\ V SUBSET ball_annulus /\ + P = INTERS {half_spaces g_fun u | u IN V /\ ~(vec 0 = u)} /\ + (polyhedron P) /\ (bounded P) /\ (?r. r> &0 /\ ball(vec 0,r) SUBSET P) /\ + X = topological_component_yfan (vec 0,fan_of_polyhedron P) /\ + F = {l | l facet_of P} /\ + F_T = face_set_of_fan (fan_of_polyhedron P ) /\ + f1 o f2 = I /\ f2 o f1 = I /\ + IMAGE f1 V = X /\ + f3 o f4 = I /\ f3 o f4 = I /\ + IMAGE f3 V = F + ==> + sum V (\v. reg (g_fun v) (&(CARD {u | u extreme_point_of f3(v)}))) <= (sum (V) (\v:real^3. sol (vec 0) (f1(v))))`;; + +let th8 = new_axiom th8_concl;; + +g `!(V:real^3 -> bool) (P:real^3 -> bool).(FINITE V) /\ packing V /\ (weakly_saturated V r r') /\ (V SUBSET ball_annulus) /\ ~(lmfun_ineq_center V) /\ P = INTERS {half_spaces g_fun u| (u IN V) /\ (~(vec 0 = u))} /\ (polyhedron P) /\ (bounded P) ==> FINITE {half_spaces g_fun u | u IN (V:real^3->bool) /\ ~(vec 0 = u)}`;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (REWRITE_TAC [half_spaces]);; +e (UNDISCH_TAC `FINITE (V:real^3->bool)`);; +e (STRIP_TAC);; +e (MP_TAC (ISPECL [`(\u:real^3. {p:real^3 | u dot p <= g_fun u})`;`V:real^3->bool`] FINITE_IMAGE));; +e (ASM_REWRITE_TAC [IMAGE]);; +e (SUBGOAL_THEN `{{p:real^3 | u dot p <= g_fun u} | (u:real^3) IN (V:real^3->bool) /\ ~(vec 0 = u)} = ({y:real^3->bool | ?x:real^3. x IN V /\ y = {p | x dot p <= g_fun x}})` ASSUME_TAC);; +e (REWRITE_TAC[EXTENSION]);; +e (GEN_TAC);; +e (EQ_TAC);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (STRIP_TAC);; +e (EXISTS_TAC `u:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (GEN_TAC);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (STRIP_TAC);; +e (EXISTS_TAC `x':real^3`);; +e (SUBGOAL_THEN `~(vec 0 = x':real^3)` ASSUME_TAC);; +e (ASM_MESON_TAC [th54]);; +e (ASM_REWRITE_TAC[]);; +e (REWRITE_TAC [EXTENSION]);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (ASM_MESON_TAC[]);; +e (ASM_REWRITE_TAC[]);; + +let FINITE_HALF_SPACES = top_thm();; + +g `!(V:real^3->bool) X P F F_T (f1:(real^3) -> (real^3->bool)) (f2:((real^3->bool))->(real^3)) (f3:(real^3) -> (real^3->bool)) (f4:((real^3->bool))->(real^3)). + FINITE V /\ packing V /\ V SUBSET ball_annulus /\ + ~(lmfun_ineq_center V) /\ (weakly_saturated V r r') /\ + P = INTERS {half_spaces g_fun u | u IN V /\ ~(vec 0 = u)} /\ + (polyhedron P) /\ (bounded P) /\ (?r. r> &0 /\ ball(vec 0,r) SUBSET P) /\ + X = topological_component_yfan (vec 0,fan_of_polyhedron P) /\ + F = {l | l facet_of P} /\ + F_T = face_set_of_fan (fan_of_polyhedron P ) /\ + f1 o f2 = I /\ f2 o f1 = I /\ + IMAGE f1 V = X /\ + f3 o f4 = I /\ f3 o f4 = I /\ + IMAGE f3 V = F +==> (!u. u IN V ==> f3 u = {p | p dot u = g_fun u} INTER P)`;; + + +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (MP_TAC (ISPECL [`P:real^3->bool`] POLYHEDRON_INTER_AFFINE_MINIMAL));; +e (UNDISCH_TAC `polyhedron (P:real^3->bool)`);; +e (STRIP_TAC);; +e (FIRST_ASSUM (fun th -> REWRITE_TAC [th]));; +e (STRIP_TAC);; +e (MP_TAC (ISPECL [`P:real^3->bool`;`{half_spaces g_fun u | (u:real^3) IN (V:real^3->bool) /\ ~(vec 0 = u)}`;`(f4:((real^3->bool))->(real^3))`;`g_fun o (f4:((real^3->bool))->(real^3))`]FACET_OF_POLYHEDRON_EXPLICIT));; + +e (DISCH_THEN (LABEL_TAC "F1"));; + + +e (REMOVE_THEN "F1" (MP_TAC o SPECL `{half_spaces g_fun u | (u:real^3) IN (V:real^3->bool) /\ ~(vec 0 = u)}`));; + + +e (SUBGOAL_THEN `FINITE {half_spaces g_fun u | u IN (V:real^3->bool) /\ ~(vec 0 = u)}` ASSUME_TAC);; +e (ASM_MESON_TAC [FINITE_HALF_SPACES]);; + +e (FIRST_ASSUM (fun th -> REWRITE_TAC [th]));; +e (UNDISCH_TAC `P = INTERS {half_spaces g_fun u | u IN (V:real^3->bool) /\ ~(vec 0 = u)}`);; +e (STRIP_TAC);; +e (FIRST_ASSUM (fun th -> REWRITE_TAC [GSYM th]));; +search [`affine hull P INTER P`];; +ARITH_RULE `affine hull P INTER P`;; +e (ASM_REWRITE_TAC[INTER]);; + +search [`FINITE P`];; + + +type_of `{half_spaces g_fun u | u IN (V:real^3->bool) /\ ~(vec 0 = u)}`;; +type_of `g_fun(f4:((real^3->bool))->(real^3))`;; +type_of `g_fun`;; + +g `!(V:real^3->bool) X P F F_T (f1:(real^3) -> (real^3->bool)) (f2:((real^3->bool))->(real^3)) (f3:(real^3) -> (real^3->bool)) (f4:((real^3->bool))->(real^3)). + FINITE V /\ packing V /\ V SUBSET ball_annulus /\ + P = INTERS {half_spaces g_fun u | u IN V /\ ~(vec 0 = u)} /\ + (polyhedron P) /\ (bounded P) /\ (?r. r> &0 /\ ball(vec 0,r) SUBSET P) /\ + X = topological_component_yfan (vec 0,fan_of_polyhedron P) /\ + F = {l | l facet_of P} /\ + F_T = face_set_of_fan (fan_of_polyhedron P ) /\ + f1 o f2 = I /\ f2 o f1 = I /\ + IMAGE f1 V = X /\ + f3 o f4 = I /\ f3 o f4 = I /\ + IMAGE f3 V = F + ==> + (!v:real^3. v IN V ==> reg (g_fun v) (&(CARD {u | u extreme_point_of f3(v)})) <= sol (vec 0) (f1(v)))`;; + + +OPEN_RCONE_GT;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `(?r:real. r > &0 /\ ball (vec 0,r) SUBSET (P:real^3->bool))` ASSUME_TAC);; +e (EXISTS_TAC `r'':real`);; +e (ASM_REWRITE_TAC[]);; +e (MP_TAC (ISPECL [`(f3:(real^3) -> (real^3->bool))`;`V:real^3->bool`;`v:real^3`] FUN_IN_IMAGE));; +e (ASM_REWRITE_TAC[IN_ELIM_THM]);; +e (STRIP_TAC);; +e (MP_TAC (ISPECL [`(f1:(real^3) -> (real^3->bool))`;`V:real^3->bool`;`v:real^3`] FUN_IN_IMAGE));; +e (ONCE_ASM_REWRITE_TAC[IN]);; +e (ONCE_ASM_REWRITE_TAC[IN]);; +e (ONCE_ASM_REWRITE_TAC[IN]);; +e (ONCE_ASM_REWRITE_TAC[IN]);; +e (STRIP_TAC);; + + +FACET_OF_POLYHEDRON_EXPLICIT;; + +e (MP_TAC (ISPECL [`P:real^3->bool`;`(f3:(real^3) -> (real^3->bool))(v:real^3)`] +FACET_OF_POLYHEDRON));; +e (ASM_REWRITE_TAC[]);; +e (MP_TAC (ISPECL [`P:real^3->bool`;`(f3:(real^3) -> (real^3->bool))(v:real^3)`; +`v:real^3`;`g_fun (v:real^3)`;`(f1:(real^3) -> (real^3->bool)) (v:real^3)`;`cos (g_fun (v:real^3))`;`(CARD {u | u extreme_point_of (f3:(real^3) -> (real^3->bool))(v:real^3)})`] GOTCJAH));; +e (ASM_REWRITE_TAC []);; +e (UNDISCH_TAC `P = INTERS {half_spaces g_fun u | u IN (V:real^3->bool) /\ ~(vec 0 = u)}`);; +e (STRIP_TAC);; +e (POP_ASSUM(fun th ->REWRITE_TAC[GSYM th]));; +e (STRIP_TAC);; +e (REWRITE_TAC [reg]);; + + + +FACET_OF_POLYHEDRON_EXPLICIT;; +e (DISCH_THEN (CHOOSE_TAC [`v:real^3`]));; +e (POP_ASSUM (X_CHOOSE_TAC `g_fun (u:real^3)`));; +help "X_CHOOSE_TAC";; + +search [`rcone`];; + +e (SUBGOAL_THEN `(f3:(real^3) -> (real^3->bool))(v:real^3) IN F'` ASSUME_TAC);; + +search [`f (v) IN V`];; + +FUN_IN_IMAGE;; +e (GEN_TAC);; + + +search [`x IN V /\ f x`];; +type_of `extreme_point_of`;; +search [`f o g = I`];; + + +g `!(V:real^3->bool) X P F F_T (f1:(real^3) -> (real^3->bool)) (f2:((real^3->bool))->(real^3)) (f3:(real^3) -> (real^3->bool)) (f4:((real^3->bool))->(real^3)). + FINITE V /\ packing V /\ V SUBSET ball_annulus /\ + P = INTERS {half_spaces g_fun u | u IN V /\ ~(vec 0 = u)} /\ + (polyhedron P) /\ (bounded P) /\ (?r. r> &0 /\ ball(vec 0,r) SUBSET P) /\ + X = topological_component_yfan (vec 0,fan_of_polyhedron P) /\ + F = {l | l facet_of P} /\ + F_T = face_set_of_fan (fan_of_polyhedron P ) /\ + f1 o f2 = I /\ f2 o f1 = I /\ + IMAGE f1 V = X /\ + f3 o f4 = I /\ f4 o f3 = I /\ + IMAGE f3 V = F + ==> + sum V (\v. reg (g_fun v) (&(CARD {u | u extreme_point_of f3(v)}))) <= (sum (V) (\v:real^3. sol (vec 0) (f1(v))))`;; + +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; + +GOTCJAH;; +facet_of;; + +(*----------------------------------------------------------------------------*) + +g `!a b c e f:real. a = b + c /\ b = e - f ==> a = e - f + c`;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; + +let th91 = top_thm();; + +let th92_T = `!(V:real^3->bool) X P F F_T (f1:(real^3) -> (real^3->bool)) (f2:((real^3->bool))->(real^3)) (f3:(real^3) -> (real^3->bool)) (f4:((real^3->bool))->(real^3)). + FINITE V /\ packing V /\ V SUBSET ball_annulus /\ + P = INTERS {half_spaces g_fun u | u IN V /\ ~(vec 0 = u)} /\ + (polyhedron P) /\ (bounded P) /\ (?r. r> &0 /\ ball(vec 0,r) SUBSET P) /\ + X = topological_component_yfan (vec 0,fan_of_polyhedron P) /\ + F = {l | l facet_of P} /\ + F_T = face_set_of_fan (fan_of_polyhedron P ) /\ + f1 o f2 = I /\ f2 o f1 = I /\ + IMAGE f1 V = X /\ + f3 o f4 = I /\ f3 o f4 = I /\ + IMAGE f3 V = F + ==> sum V (\v.(&(CARD {u | u extreme_point_of f3(v)}))) = (&(nsum (face_set_of_fan (fan_of_polyhedron P)) (\u:real^3#real^3->bool. (CARD u))))`;; + +let th92 =new_axiom th92_T;; + +g `!(P:real^3->bool) v b. (polyhedron P) /\ (bounded P) ==> (!f.(f facet_of P) /\ f = { p | p dot v = b } INTER P ==> + (CARD {u | u extreme_point_of f}) = (CARD (edges f)))`;; +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (GEN_TAC);; +e (STRIP_TAC);; +e (REWRITE_TAC [edges]);; +dart1_of_fan;; +e (REWRITE_TAC [ + + + +g `!(V:real^3->bool) X P F F_T. + FINITE V /\ packing V /\ V SUBSET ball_annulus /\ + P = INTERS {half_spaces g_fun u | u IN V /\ ~(vec 0 = u)} /\ + (polyhedron P) /\ (bounded P) /\ (?r. r> &0 /\ ball(vec 0,r) SUBSET P) /\ + X = topological_component_yfan (vec 0,fan_of_polyhedron P) /\ + F = {l | l facet_of P} /\ + F_T = face_set_of_fan (fan_of_polyhedron P ) /\ + ~(lmfun_ineq_center V) /\ + (weakly_saturated V r r') + ==> nsum F (\v.((CARD {u | u extreme_point_of v}))) = (nsum (face_set_of_fan (fan_of_polyhedron P)) (\u:real^3#real^3->bool. (CARD u)))`;; + + +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `fully_surrounded (fan_of_polyhedron (P:real^3->bool))` ASSUME_TAC);; +e (ASM_MESON_TAC [th52]);; +e (SUBGOAL_THEN `(interior_point (vec 0) (P:real^3->bool))` ASSUME_TAC);; +e (ASM_MESON_TAC [th51]);; +e (SUBGOAL_THEN `FANO (fan_of_polyhedron (P:real^3->bool))` ASSUME_TAC);; +e (ASM_MESON_TAC [JLIGZGS]);; +e (SUBGOAL_THEN `dart_of_fan (fan_of_polyhedron (P:real^3->bool)) = dart1_of_fan (fan_of_polyhedron (P:real^3->bool))` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [fan_of_polyhedron]);; +e (MESON_TAC [FULLY_SURROUNDED_IMP_DART]);; +e (SUBGOAL_THEN `(dart (hypermap_of_fan (fan_of_polyhedron (P:real^3->bool)))) = dart_of_fan (fan_of_polyhedron (P:real^3->bool))` ASSUME_TAC);; +e (ASM_MESON_TAC[DART_OF_HYPERMAP_FAN]);; +e (POP_ASSUM (fun th -> REWRITE_TAC [th]));; +e (POP_ASSUM (fun th -> REWRITE_TAC [th]));; + + +e (REWRITE_TAC [fan_of_polyhedron;dart1_of_fan]);; +e (SUBGOAL_THEN `nsum (face_set_of_fan (fan_of_polyhedron (P:real^3->bool))) (\u. CARD u) = + CARD (dart (hypermap_of_fan (fan_of_polyhedron (P:real^3->bool))))` ASSUME_TAC);; +e (ASM_MESON_TAC [CARD_5]);; + + + +CARD_5;; +e (REWRITE_TAC [IN_ELIM_THM]);; + +e (REWRITE_TAC [dart]);; +KREIN_MILMAN_POLYTOPE;; +verticesface_of;; +EXTREME_POINT_OF_FACE;; +DART_EQ_UNIONS_FACE_SET_NODE_SET_EDGE_SET;; +search [`vertices`];; + +card_partition_formula;; +CARD_5;; +th8;; +edge_map_and_darts;; + +let lemma_edge_from_dart = prove( `!H:(A)hypermap x:A u:A->bool. u IN edge_set H /\ x IN u ==> u = edge H x`, + REPEAT GEN_TAC THEN + DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) THEN + USE_THEN "F1" (MP_TAC o MATCH_MP lemma_edge_representation) THEN + DISCH_THEN (X_CHOOSE_THEN `y:A` (SUBST_ALL_TAC o CONJUNCT2)) THEN + USE_THEN "F2" (fun th -> REWRITE_TAC [MATCH_MP lemma_edge_identity th]));; + +let lemma_face_from_dart = prove( `!H:(A)hypermap x:A u:A->bool. u IN face_set H /\ x IN u ==> u = face H x`, + REPEAT GEN_TAC THEN + DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) THEN + USE_THEN "F1" (MP_TAC o MATCH_MP lemma_face_representation) THEN + DISCH_THEN (X_CHOOSE_THEN `y:A` (SUBST_ALL_TAC o CONJUNCT2)) THEN + USE_THEN "F2" (fun th -> REWRITE_TAC [MATCH_MP lemma_face_identity th]));; + +g `!(V:real^3->bool) X P F F_T. + FINITE V /\ packing V /\ weakly_saturated V r r' /\ V SUBSET ball_annulus /\ + P = INTERS {half_spaces g_fun u | u IN V /\ ~(vec 0 = u)} /\ + ~(lmfun_ineq_center V) /\ + (polyhedron P) /\ (bounded P) /\ (?r. r> &0 /\ ball(vec 0,r) SUBSET P) /\ + X = topological_component_yfan (vec 0,fan_of_polyhedron P) /\ + F = {l | l facet_of P} /\ + F_T = face_set_of_fan (fan_of_polyhedron P ) +==> nsum F (\v.((CARD (edges v)))) = (CARD (dart (hypermap_of_fan(fan_of_polyhedron P))))`;; + +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (MP_TAC (ISPECL [`hypermap_of_fan(fan_of_polyhedron (P:real^3->bool))`]DART_EQ_UNIONS_FACE_SET_NODE_SET_EDGE_SET));; +e (STRIP_TAC);; +e (SUBGOAL_THEN `CARD (dart (hypermap_of_fan (fan_of_polyhedron (P:real^3->bool)))) = + CARD (UNIONS (face_set (hypermap_of_fan (fan_of_polyhedron P))))` ASSUME_TAC);; +e (ASM_MESON_TAC[]);; +e (SUBGOAL_THEN `FINITE (face_set (hypermap_of_fan (fan_of_polyhedron (P:real^3->bool))))` ASSUME_TAC);; +e (MP_TAC (ISPECL [`hypermap_of_fan(fan_of_polyhedron (P:real^3->bool))`]FINITE_HYPERMAP_ORBITS));; +e (SIMP_TAC[]);; +e (SUBGOAL_THEN `(!t:real^3#real^3->bool. t IN (face_set (hypermap_of_fan (fan_of_polyhedron (P:real^3->bool)))) ==> FINITE t)` ASSUME_TAC);; +e (REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[GSYM face;FACE_FINITE]);; +e (SUBGOAL_THEN `(!t u. t IN (face_set (hypermap_of_fan (fan_of_polyhedron (P:real^3->bool)))) /\ u IN (face_set (hypermap_of_fan (fan_of_polyhedron (P)))) /\ ~(t = u) ==> t INTER u = {})` ASSUME_TAC);; +e (REPEAT GEN_TAC);; +e (DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G1") (CONJUNCTS_THEN2 (LABEL_TAC "G2") (MP_TAC))));; +e (ONCE_REWRITE_TAC [GSYM CONTRAPOS_THM]);; +e (REWRITE_TAC[]);; +e (REWRITE_TAC [GSYM MEMBER_NOT_EMPTY;IN_INTER]);; +e (STRIP_TAC);; +e (POP_ASSUM (fun th -> USE_THEN "G2" (fun th1 -> REWRITE_TAC [MATCH_MP lemma_face_from_dart (CONJ th1 th)])));; +e (POP_ASSUM (fun th -> USE_THEN "G1" (fun th1 -> REWRITE_TAC [MATCH_MP lemma_face_from_dart (CONJ th1 th)])));; +e (MP_TAC (MATCH_MP card_partition_formula (ISPEC `( (hypermap_of_fan (fan_of_polyhedron (P:real^3->bool))))` face_map_and_darts)));; +e (REWRITE_TAC [GSYM face_set]);; +CARD_5;; +e (STRIP_TAC);; + +e (POP_ASSUM MP_TAC);; +e (ASM_REWRITE_TAC[]);; + +g `!(V:real^3->bool) X P F F_T. + FINITE V /\ packing V /\ weakly_saturated V r r' /\ V SUBSET ball_annulus /\ + P = INTERS {half_spaces g_fun u | u IN V /\ ~(vec 0 = u)} /\ + ~(lmfun_ineq_center V) /\ + (polyhedron P) /\ (bounded P) /\ (?r. r> &0 /\ ball(vec 0,r) SUBSET P) /\ + X = topological_component_yfan (vec 0,fan_of_polyhedron P) /\ + F = {l | l facet_of P} /\ + F_T = face_set_of_fan (fan_of_polyhedron P ) +==> nsum F (\v.((CARD (edges v)))) = (CARD (dart (hypermap_of_fan(fan_of_polyhedron P))))`;; + +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (REWRITE_TAC [edges]);; +e (SUBGOAL_THEN `fully_surrounded (fan_of_polyhedron (P:real^3->bool))` ASSUME_TAC);; +e (ASM_MESON_TAC [th52]);; +e (SUBGOAL_THEN `(interior_point (vec 0) (P:real^3->bool))` ASSUME_TAC);; +e (ASM_MESON_TAC [th51]);; +e (SUBGOAL_THEN `FANO (fan_of_polyhedron (P:real^3->bool))` ASSUME_TAC);; +e (ASM_MESON_TAC [JLIGZGS]);; +e (SUBGOAL_THEN `dart_of_fan (fan_of_polyhedron (P:real^3->bool)) = dart1_of_fan (fan_of_polyhedron (P:real^3->bool))` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [fan_of_polyhedron]);; +e (MESON_TAC [FULLY_SURROUNDED_IMP_DART]);; +e (SUBGOAL_THEN `(dart (hypermap_of_fan (fan_of_polyhedron (P:real^3->bool)))) = dart_of_fan (fan_of_polyhedron (P:real^3->bool))` ASSUME_TAC);; +e (ASM_MESON_TAC[DART_OF_HYPERMAP_FAN]);; +e (POP_ASSUM (fun th -> REWRITE_TAC [th]));; +e (FIRST_ASSUM (fun th -> REWRITE_TAC [th]));; +e (UNDISCH_TAC `F' = {l | l facet_of (P:real^3->bool)}`);; +e (DISCH_TAC);; +e (POP_ASSUM (fun th -> REWRITE_TAC[th]));; +e (MP_TAC (ISPECL [`(dart1_of_fan ((fan_of_polyhedron (P:real^3->bool))))`]card_partition_formula));; +e (DISCH_THEN (LABEL_TAC "F1"));; +e (REMOVE_THEN "F1" (MP_TAC o SPEC `e_fan_pair_ext (fan_of_polyhedron (P:real^3->bool))`));; +e (SUBGOAL_THEN `FAN(vec 0,fan_of_polyhedron (P:real^3->bool))` ASSUME_TAC);; +e (UNDISCH_TAC `FANO (fan_of_polyhedron (P:real^3->bool))`);; +e (REWRITE_TAC [fan_of_polyhedron]);; +e (MESON_TAC [FANO_OF_FAN]);; +e (SUBGOAL_THEN `FINITE (dart_of_fan (fan_of_polyhedron (P:real^3->bool)))` ASSUME_TAC);; +e (POP_ASSUM MP_TAC THEN REWRITE_TAC [fan_of_polyhedron]);; +e (REWRITE_TAC [FINITE_DART_OF_FAN]);; +e (SUBGOAL_THEN `FINITE (dart1_of_fan (fan_of_polyhedron (P:real^3->bool)))` ASSUME_TAC);; +e (ASM_MESON_TAC[]);; +e (POP_ASSUM (fun th -> REWRITE_TAC[th]));; +e (SUBGOAL_THEN `e_fan_pair_ext (fan_of_polyhedron (P:real^3->bool)) permutes dart1_of_fan (fan_of_polyhedron P)` ASSUME_TAC);; +e (REWRITE_TAC [fan_of_polyhedron;E_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN]);; +e (POP_ASSUM (fun th -> REWRITE_TAC[th]));; +e (REWRITE_TAC [set_of_orbits;fan_of_polyhedron;e_fan_pair_ext]);; + +e (STRIP_TAC);; +e (POP_ASSUM (fun th -> REWRITE_TAC[th]));; +e (UNDISCH_TAC `dart_of_fan (fan_of_polyhedron (P:real^3->bool)) = dart1_of_fan (fan_of_polyhedron (P:real^3->bool))`);; +E_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN;; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (REWRITE_TAC [fan_of_polyhedron;dart1_of_fan]);; +e (REWRITE_TAC [edge_of]);; + +search [`convex hull {v', w'} face_of P`];; +e (REWRITE_TAC [IN_ELIM_THM]);; + +e (REWRITE_TAC weakly_saturated V r r' +e (REWRITE_TAC [dart]);; + + +search [`CARD (UNIONS s)`];; + + +g `!(V:real^3->bool) X P F F_T (f1:(real^3) -> (real^3->bool)) (f2:((real^3->bool))->(real^3)) (f3:(real^3) -> (real^3->bool)) (f4:((real^3->bool))->(real^3)). + FINITE V /\ packing V /\ V SUBSET ball_annulus /\ + P = INTERS {half_spaces g_fun u | u IN V /\ ~(vec 0 = u)} /\ + (polyhedron P) /\ (bounded P) /\ (?r. r> &0 /\ ball(vec 0,r) SUBSET P) /\ + X = topological_component_yfan (vec 0,fan_of_polyhedron P) /\ + F = {l | l facet_of P} /\ + F_T = face_set_of_fan (fan_of_polyhedron P ) /\ + f1 o f2 = I /\ f2 o f1 = I /\ + IMAGE f1 V = X /\ + f3 o f4 = I /\ f3 o f4 = I /\ + IMAGE f3 V = F + /\ (!v. v IN V ==> #0.591 - #0.0331 * (&(CARD {u | u extreme_point_of f3(v)})) + #0.506 * lmfun (hl [vec 0; v]) + <= reg (g_fun v) (&(CARD {u | u extreme_point_of f3(v)}))) +==> + +#0.591* (&(CARD V)) - #0.0331 * (&(nsum (face_set_of_fan (fan_of_polyhedron P)) (\u:real^3#real^3->bool. (CARD u)))) + #0.506 * (sum V (\v. lmfun (hl [vec 0; v]))) <= sum V (\v. reg (g_fun v) (&(CARD {u | u extreme_point_of f3(v)})))`;; + +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (POP_ASSUM (LABEL_TAC "F1"));; +e (SUBGOAL_THEN `!v:real^3. v IN (V:real^3->bool) + ==> (\v:real^3. #0.591 - #0.0331 * &(CARD {u | u extreme_point_of (f3:(real^3) -> (real^3->bool))(v)}) + #0.506 * lmfun (hl [vec 0; v])) v <= (\v:real^3. reg (g_fun v) (&(CARD {u | u extreme_point_of f3(v)}))) v` ASSUME_TAC);; +e (GEN_TAC);; +e (STRIP_TAC);; +e (REMOVE_THEN "F1" (MP_TAC o SPEC `v:real^3`));; +e (ASM_MESON_TAC[]);; +e (SUBGOAL_THEN `sum (V:real^3->bool) (\v. #0.591 - #0.0331 * (&(CARD {u | u extreme_point_of (f3:(real^3) -> (real^3->bool))(v)})) + #0.506 * lmfun (hl [vec 0; v])) <= sum V (\v. reg (g_fun v) (&(CARD {u | u extreme_point_of f3(v)}))) ` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (UNDISCH_TAC `FINITE (V:real^3->bool)`);; +e (MESON_TAC [SUM_LE]);; +e (SUBGOAL_THEN `sum (V:real^3->bool) (\v. #0.591 - #0.0331 * (&(CARD {u | u extreme_point_of (f3:(real^3) -> (real^3->bool))(v)})) + #0.506 * lmfun (hl [vec 0; v])) = sum V (\v. #0.591 - #0.0331 * (&(CARD {u | u extreme_point_of f3(v)}))) + sum V (\v. #0.506 * lmfun (hl [vec 0; v]))` ASSUME_TAC);; +e (UNDISCH_TAC `FINITE (V:real^3->bool)`);; +e (REWRITE_TAC [SUM_ADD]);; +e (SUBGOAL_THEN `sum (V:real^3->bool) (\v. #0.591 - #0.0331 * (&(CARD {u | u extreme_point_of (f3:(real^3) -> (real^3->bool))(v)}))) = +sum (V:real^3->bool) (\v. #0.591) - sum V (\v. #0.0331 * (&(CARD {u | u extreme_point_of (f3:(real^3) -> (real^3->bool))(v)})))` ASSUME_TAC);; +e (UNDISCH_TAC `FINITE (V:real^3->bool)`);; +e (REWRITE_TAC [SUM_SUB]);; +e (SUBGOAL_THEN `sum (V:real^3->bool) (\v. #0.591 - #0.0331 * (&(CARD {u | u extreme_point_of (f3:(real^3) -> (real^3->bool))(v)})) + + #0.506 * lmfun (hl [vec 0; v])) = sum (V) (\v. #0.591) - sum V (\v. #0.0331 * (&(CARD {u | u extreme_point_of (f3:(real^3) -> (real^3->bool))(v)}))) + + sum V (\v. #0.506 * lmfun (hl [vec 0; v]))` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC[th91]);; +e (SUBGOAL_THEN `sum (V:real^3->bool) (\v. #0.591) = #0.591 * &(CARD V) ` ASSUME_TAC);; +e (ONCE_REWRITE_TAC [ARITH_RULE `#0.591 = #0.591 * &1`]);; +e (SUBGOAL_THEN `sum (V:real^3->bool) (\v. #0.591 * &1) = #0.591 * (sum V (\v. &1))` ASSUME_TAC);; +e (REWRITE_TAC[SUM_LMUL]);; +e (ASM_REWRITE_TAC[]);; +e (UNDISCH_TAC `FINITE (V:real^3->bool)`);; +e (SIMP_TAC[GSYM CARD_EQ_SUM]);; +e (STRIP_TAC);; +e (REAL_ARITH_TAC);; +e (SUBGOAL_THEN `sum (V:real^3->bool) (\v. #0.506 * lmfun (hl [vec 0; v])) = +#0.506 * sum V (\v. lmfun (hl [vec 0; v]))` ASSUME_TAC);; +e (SIMP_TAC [SUM_LMUL]);; +e (SUBGOAL_THEN `sum (V:real^3->bool) + (\v. #0.0331 * + &(CARD {u | u extreme_point_of (f3:(real^3) -> (real^3->bool))(v)})) = #0.0331 * sum (V) + (\v. + &(CARD {u | u extreme_point_of (f3:(real^3) -> (real^3->bool))(v)})) ` ASSUME_TAC);; + +e (SIMP_TAC [SUM_LMUL]);; +e (SUBGOAL_THEN `sum (V:real^3->bool) (\v. + &(CARD {u | u extreme_point_of (f3:(real^3) -> (real^3->bool))(v)})) = (&(nsum (face_set_of_fan (fan_of_polyhedron P)) (\u:real^3#real^3->bool. (CARD u))))` ASSUME_TAC);; +e (ASM_MESON_TAC [th92]);; +e (UNDISCH_TAC `sum (V:real^3->bool) + (\v. #0.0331 * + &(CARD {u | u extreme_point_of (f3:(real^3) -> (real^3->bool))(v)})) = + #0.0331 * + sum V + (\v. &(CARD {u | u extreme_point_of (f3:(real^3) -> (real^3->bool))(v)}))`);; +e (POP_ASSUM(fun th ->REWRITE_TAC[th] ));; +e (STRIP_TAC);; +e (POP_ASSUM(fun th ->REWRITE_TAC[GSYM th] ));; +e (POP_ASSUM(fun th ->REWRITE_TAC[GSYM th] ));; +e (POP_ASSUM(fun th ->REWRITE_TAC[GSYM th] ));; +e (POP_ASSUM(fun th ->REWRITE_TAC[GSYM th] ));; +e (ASM_REWRITE_TAC[]);; + +let th9 = top_thm();; + + +g `!(V:real^3->bool) (P:real^3->bool). +FINITE V /\ packing V /\ V SUBSET ball_annulus /\ + weakly_saturated V r r' /\ + ~lmfun_ineq_center V /\ + P = INTERS {half_spaces g_fun u | u IN V /\ ~(vec 0 = u)} /\ + (polyhedron P) /\ (bounded P) + ==> #0.591 * (&(CARD V)) - #0.0331 * &(6*(CARD V) - 12) + #0.506 * (&12) < #0.591* (&(CARD V)) - #0.0331 * (&(nsum (face_set_of_fan (fan_of_polyhedron P)) (\u:real^3#real^3->bool. (CARD u)))) + #0.506 * (sum V (\v. lmfun (hl [vec 0; v])))`;; + +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `(nsum (face_set_of_fan (fan_of_polyhedron (P:real^3->bool))) (\u. CARD u)) <= (6 * CARD (V:real^3->bool) - 12)` ASSUME_TAC);; +e (ASM_MESON_TAC [th6]);; +e (SUBGOAL_THEN `&(nsum (face_set_of_fan (fan_of_polyhedron (P:real^3->bool))) (\u. CARD u)) <= &(6 * CARD (V:real^3->bool) - 12)` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [REAL_OF_NUM_LE]);; +e (SUBGOAL_THEN `#0.0331 * &(nsum (face_set_of_fan (fan_of_polyhedron (P:real^3->bool))) (\u. CARD u)) <= #0.0331 * &(6 * CARD (V:real^3->bool) - 12)` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (MP_TAC (ARITH_RULE `&0 <= #0.0331`));; +e (MESON_TAC [REAL_LE_LMUL]);; +e (SUBGOAL_THEN `-- (#0.0331 * &(6 * CARD (V:real^3->bool) - 12)) <= -- (#0.0331 * &(nsum (face_set_of_fan (fan_of_polyhedron (P:real^3->bool))) (\u. CARD u)))` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [REAL_LE_NEG]);; +e (SUBGOAL_THEN `#0.591 * &(CARD V) + -- (#0.0331 * &(6 * CARD (V:real^3->bool) - 12)) <= #0.591 * &(CARD V) + -- (#0.0331 * &(nsum (face_set_of_fan (fan_of_polyhedron (P:real^3->bool))) (\u. CARD u)))` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [REAL_LE_LADD_IMP]);; +e (POP_ASSUM MP_TAC);; +e (PURE_REWRITE_TAC [GSYM real_sub]);; +e (STRIP_TAC);; +e (UNDISCH_TAC `~lmfun_ineq_center (V:real^3->bool)`);; +e (PURE_REWRITE_TAC [lmfun_ineq_center]);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `&12 < sum (V:real^3 -> bool) (\v. lmfun (hl [vec 0; v]))` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (REWRITE_TAC [REAL_NOT_LE]);; +e (SUBGOAL_THEN `#0.506 * &12 < #0.506 * sum (V:real^3->bool) (\v. lmfun (hl [vec 0; v]))` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (MP_TAC (ARITH_RULE `&0 < #0.506`));; +e (MESON_TAC [REAL_LT_LMUL]);; +e (POP_ASSUM MP_TAC);; +e (UNDISCH_TAC `#0.591 * &(CARD (V:real^3->bool)) - #0.0331 * &(6 * CARD V - 12) <= + #0.591 * &(CARD V) - + #0.0331 * &(nsum (face_set_of_fan (fan_of_polyhedron (P:real^3->bool))) (\u. CARD u))`);; +e (ABBREV_TAC `a:real = #0.591 * &(CARD (V:real^3->bool)) - #0.0331 * &(6 * CARD V - 12)`);; +e (ABBREV_TAC `b:real = #0.591 * &(CARD (V:real^3->bool)) - + #0.0331 * &(nsum (face_set_of_fan (fan_of_polyhedron (P:real^3->bool))) (\u. CARD u))`);; +e (MESON_TAC [REAL_LET_ADD2]);; + +let th10 = top_thm();; + +(*--------------------------------------------------------------------------*) +let REAL_SUB2_SUB2 = prove(`!x y z:real. x - (y - z) = x - y + z`,REPEAT GEN_TAC THEN SUBGOAL_THEN `--(y:real - z) = z - y` ASSUME_TAC THENL [REWRITE_TAC [REAL_NEG_SUB];POP_ASSUM MP_TAC THEN PURE_REWRITE_TAC [real_sub] THEN STRIP_TAC THEN PURE_REWRITE_TAC [REAL_NEG_ADD;REAL_NEGNEG] THEN REWRITE_TAC[REAL_ADD_ASSOC]]);; + +let REAL_ADD2_ADD2 = prove (`!x y z:real. x + (y + z) = x + y + z`,SET_TAC[]);; + +g `(pi < #3.15) ==> (&4 * pi - #6.4692) / #0.3924 < &16`;; +e (STRIP_TAC);; +e (SUBGOAL_THEN `&0 < &4` ASSUME_TAC);; +e (ARITH_TAC);; +e (SUBGOAL_THEN `&4*pi < &4 * #3.15` ASSUME_TAC);; +e (ASM_MESON_TAC[REAL_LT_LMUL_EQ]);; +e (POP_ASSUM MP_TAC);; +e (PURE_REWRITE_TAC [ARITH_RULE `&4 * #3.15= #12.6`]);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `&4*pi + (--(#6.4692)) < #12.6 + (--(#6.4692))` ASSUME_TAC);; +e (ASM_REWRITE_TAC[REAL_LT_RADD]);; +e (POP_ASSUM MP_TAC);; +e (PURE_REWRITE_TAC [GSYM real_sub]);; +e (PURE_REWRITE_TAC [ARITH_RULE `#12.6 - #6.4692 = #6.1308`]);; +e (SUBGOAL_THEN `&0 < #0.3924` ASSUME_TAC);; +e (ARITH_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `(&4 * pi - #6.4692)/( #0.3924) < #6.1308 / #0.3924` ASSUME_TAC);; +e (ASM_MESON_TAC[GSYM REAL_LT_DIV2_EQ]);; +e (SUBGOAL_THEN `#6.1308 / #0.3924 < &16` ASSUME_TAC);; +e (ARITH_TAC);; +e (ASM_MESON_TAC[REAL_LT_TRANS]);; + +let th11 = top_thm();; + +g `!(V:real^3->bool).(pi < #3.15) /\ ( &12 < &(CARD V)) /\ #0.591 * (&(CARD V)) - #0.0331 * &(6*(CARD V)-12) + #0.506 * (&12) < &4 * pi ==> &(CARD V) < &16`;; +e (GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `12 < CARD (V:real^3->bool)` ASSUME_TAC);; +e (ASM_MESON_TAC [REAL_OF_NUM_LT]);; +e (SUBGOAL_THEN ` 12 < 6 * (CARD (V:real^3->bool))` ASSUME_TAC);; +e (SUBGOAL_THEN `6 * 12 < 6 * (CARD (V:real^3->bool))` ASSUME_TAC);; +e (SUBGOAL_THEN `~(6 = 0)` ASSUME_TAC);; +e (ARITH_TAC);; +e (ASM_MESON_TAC[LT_LMULT]);; +e (POP_ASSUM MP_TAC);; +e (PURE_REWRITE_TAC [ARITH_RULE `6 * 12 = 72`]);; +e (STRIP_TAC);; +e (SUBGOAL_THEN ` 12 < 72 ` ASSUME_TAC);; +e (ARITH_TAC);; +e (ASM_MESON_TAC[LT_TRANS]);; +e (SUBGOAL_THEN ` 12 <= 6 * (CARD (V:real^3->bool))` ASSUME_TAC);; +e (ASM_MESON_TAC[LT_IMP_LE]);; +e (SUBGOAL_THEN `&(6*(CARD (V:real^3->bool))-12) = &(6 *(CARD V)) - &12` ASSUME_TAC);; +e (ASM_MESON_TAC[REAL_OF_NUM_SUB]);; +e (SUBGOAL_THEN `&(6*(CARD (V:real^3->bool))) = &(6) * &(CARD V)` ASSUME_TAC);; +e (MESON_TAC[REAL_OF_NUM_MUL]);; +e (SUBGOAL_THEN `&(6*(CARD (V:real^3->bool))-12) = &(6) * &(CARD V) - &12` ASSUME_TAC);; +e (ASM_MESON_TAC[]);; +e (SUBGOAL_THEN `#0.591 * (&(CARD (V:real^3 -> bool))) - #0.0331 * (&(6) * &(CARD V) - &12) + #0.506 * (&12)< &4 * pi` ASSUME_TAC);; +e (ASM_MESON_TAC[]);; +e (SUBGOAL_THEN `#0.0331 * (&(6) * &(CARD (V:real^3->bool)) - &12) = #0.0331 * &(6) * &(CARD (V)) - #0.0331 * &12` ASSUME_TAC);; +e (MESON_TAC[REAL_SUB_LDISTRIB]);; +e (POP_ASSUM MP_TAC);; +e (PURE_REWRITE_TAC [ARITH_RULE `#0.0331 * &12 = #0.3972`]);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `#0.591 * (&(CARD (V:real^3 -> bool))) - (#0.0331 * &6 * &(CARD V) - #0.3972) + #0.506 * (&12)< &4 * pi` ASSUME_TAC);; +e (ASM_MESON_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (PURE_REWRITE_TAC [ARITH_RULE `#0.506 * &12 = #6.072`]);; +e (PURE_REWRITE_TAC [REAL_SUB2_SUB2 ]);; +e (SUBGOAL_THEN `#0.0331 * &6 * &(CARD (V:real^3->bool)) = (#0.0331 * &6) * &(CARD V) ` ASSUME_TAC);; +e (REWRITE_TAC[REAL_MUL_ASSOC]);; +e (POP_ASSUM MP_TAC);; +e (PURE_REWRITE_TAC [ARITH_RULE `#0.0331 * &6 = #0.1986`]);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (SUBGOAL_THEN `#0.591 * &(CARD (V:real^3->bool)) - #0.1986 * &(CARD V) += (#0.591 - #0.1986) * &(CARD V)` ASSUME_TAC);; +e (MESON_TAC[REAL_SUB_RDISTRIB]);; +e (POP_ASSUM MP_TAC);; +e (PURE_REWRITE_TAC [ARITH_RULE `(#0.591 - #0.1986) = #0.3924`]);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `#0.591 * &(CARD (V:real^3->bool)) - #0.1986 * &(CARD V) + #0.3972 = #0.3924 * &(CARD V) + #0.3972` ASSUME_TAC);; +e (ASM_MESON_TAC[]);; +e (ASM_REWRITE_TAC[]);; +e (SUBGOAL_THEN `(#0.3924 * &(CARD (V:real^3->bool)) + #0.3972) + #6.072 = +#0.3924 * &(CARD (V:real^3->bool)) + (#0.3972 + #6.072)` ASSUME_TAC);; +e (MESON_TAC[REAL_ADD_AC]);; +e (ASM_REWRITE_TAC[]);; +e (SUBGOAL_THEN `#0.3972 + #6.072 = #6.4692` ASSUME_TAC);; +e (ARITH_TAC);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `(#0.3924 * &(CARD (V:real^3->bool)) + #6.4692) + (--(#6.4692)) < &4 * pi + (--(#6.4692))` ASSUME_TAC);; +e (ASM_REWRITE_TAC [REAL_LT_RADD]);; +e (POP_ASSUM MP_TAC);; +e (ONCE_REWRITE_TAC [REAL_ADD_AC]);; +e (PURE_REWRITE_TAC [GSYM real_sub]);; +e (PURE_REWRITE_TAC [ARITH_RULE `#6.4692 - #6.4692 = &0`]);; +e (PURE_REWRITE_TAC [REAL_ADD_RID]);; +e (ONCE_REWRITE_TAC [REAL_ADD_AC]);; +e (PURE_REWRITE_TAC [GSYM real_sub]);; +e (SUBGOAL_THEN `&0 < (#0.3924)` ASSUME_TAC);; +e (ARITH_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `&(CARD (V:real^3->bool)) < (&4 * pi - #6.4692)/(#0.3924)` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (PURE_REWRITE_TAC [ARITH_RULE `#0.3924 * &(CARD (V:real^3->bool)) = &(CARD V)*(#0.3924)`]);; +e (ASM_MESON_TAC [GSYM REAL_LT_RDIV_EQ]);; +e (SUBGOAL_THEN `(&4 * pi - #6.4692) / #0.3924 < &16` ASSUME_TAC);; +e (ASM_MESON_TAC[th11]);; +e (ASM_MESON_TAC[REAL_LT_TRANS]);; + + +let th12 = top_thm();; + +(*---------------------------------------------------------------------------*) +g `!(V:real^3->bool). &(CARD V) < &16 /\ &12 < &(CARD V) ==> CARD V = 13 \/ +CARD V = 14 \/ CARD V = 15`;; +e (GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `CARD (V:real^3->bool) < 16` ASSUME_TAC);; +e (ASM_MESON_TAC [REAL_OF_NUM_LT]);; +e (SUBGOAL_THEN `12 < CARD (V:real^3->bool)` ASSUME_TAC);; +e (ASM_MESON_TAC [REAL_OF_NUM_LT]);; +e (ASM_MESON_TAC [ARITH_RULE `!a:num.a = 13 \/ a = 14 \/ a = 15 <=> a < 16 /\ 12 < a` ]);; + +let NUM_REAL = top_thm();; + +g `!(V:real^3->bool) (V1:real^3->bool) X P F F_T (f1:(real^3) -> (real^3->bool)) (f2:((real^3->bool))->(real^3)) (f3:(real^3) -> (real^3->bool)) (f4:((real^3->bool))->(real^3)). + FINITE V /\ FINITE V1 /\ + packing V /\ + V SUBSET ball_annulus /\ V SUBSET V1 /\ + V1 SUBSET ball_annulus /\ + packing V1 /\ + (!y. (!x. x IN V1 ==> &2 <= dist (x,y)) ==> y IN V1) /\ + P = INTERS {half_spaces g_fun u|(u IN V1) /\ (~(vec 0 = u))} /\ + polyhedron P /\ + pi < #3.15 /\ + ~(lmfun_ineq_center V) /\ + ~(lmfun_ineq_center V1) /\ + (?r. r> &0 /\ ball(vec 0,r) SUBSET P) /\ + X = topological_component_yfan (vec 0,fan_of_polyhedron P) /\ + F = {l | l facet_of P} /\ + F_T = face_set_of_fan (fan_of_polyhedron P ) /\ + f1 o f2 = I /\ f2 o f1 = I /\ + IMAGE f1 V1 = X /\ + f3 o f4 = I /\ f3 o f4 = I /\ + IMAGE f3 V1 = F /\ + (!v. v IN V1 ==> #0.591 - #0.0331 * (&(CARD {u | u extreme_point_of f3(v)})) + #0.506 * lmfun (hl [vec 0; v]) + <= reg (g_fun v) (&(CARD {u | u extreme_point_of f3(v)}))) + ==> + (CARD V = 13 \/ CARD V = 14 \/ CARD V = 15)`;; + +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `&12 < &(CARD (V:real^3->bool))` ASSUME_TAC);; +e (ASM_MESON_TAC [condition_1]);; +e (SUBGOAL_THEN `weakly_saturated (V1:real^3->bool) r r'` ASSUME_TAC);; +e (ASM_MESON_TAC [thm17]);; +e (SUBGOAL_THEN `&2 <= r:real` ASSUME_TAC);; +e (PURE_REWRITE_TAC[r]);; +e (ARITH_TAC);; +e (SUBGOAL_THEN `r:real <= r'` ASSUME_TAC);; +e (PURE_REWRITE_TAC [r;r';h0]);; +e (ARITH_TAC);; +e (SUBGOAL_THEN `bounded (P:real^3->bool)` ASSUME_TAC);; +e (UNDISCH_TAC `polyhedron (P:real^3->bool)`);; +e (UNDISCH_TAC `P = INTERS {half_spaces g_fun u|(u IN V1:real^3->bool) /\ (~(vec 0 = u))} `);; +e (UNDISCH_TAC `weakly_saturated (V1:real^3->bool) r r'`);; +e (UNDISCH_TAC `packing (V1:real^3->bool)`);; +e (UNDISCH_TAC `FINITE (V1:real^3->bool)`);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (SUBGOAL_THEN `!(V:real^3 -> bool) (g:real^3->real) (r:real) (r':real) P.(&2 <= r) /\ (r <= r') /\ (FINITE V) /\ packing V /\ +(weakly_saturated V r r') /\ + P = INTERS {half_spaces g u|(u IN V) /\ (~(vec 0 = u))} /\ polyhedron P ==> +(bounded P)` ASSUME_TAC);; +e (REWRITE_TAC [TARJJUW]);; +e (POP_ASSUM (LABEL_TAC "F1"));; +e (USE_THEN "F1" (MP_TAC o SPECL [`V1:real^3->bool`;`g_fun`;`r`;`r'`;`P:real^3->bool`]));; +e (SET_TAC[]);; +e (SUBGOAL_THEN `(?r:real. r> &0 /\ ball(vec 0,r) SUBSET (P:real^3->bool))` ASSUME_TAC);; +e (EXISTS_TAC `r'':real`);; +e (ASM_MESON_TAC[]);; +e (SUBGOAL_THEN `sum (V1:real^3->bool) + (\v:real^3. reg (g_fun v) + (&(CARD {u | u extreme_point_of (f3:(real^3) -> (real^3->bool))(v)}))) <= + (sum (V1:real^3->bool) (\v:real^3. sol (vec 0) ((f1:(real^3) -> (real^3->bool))(v))))` ASSUME_TAC);; +e (MP_TAC (ISPECL [`(V1:real^3->bool)`;`X:(real^3->bool)->bool`;`P:real^3->bool`;`F':(real^3->bool)->bool`;`F_T:(real^3#real^3->bool)->bool`;`(f1:(real^3) -> (real^3->bool))`;`(f2:((real^3->bool))->(real^3))`;`(f3:(real^3) -> (real^3->bool))`;`(f4:((real^3->bool))->(real^3))`]th8));; +e (ASM_REWRITE_TAC[]);; +e (SUBGOAL_THEN `#0.591* (&(CARD (V1:real^3->bool))) - #0.0331 * (&(nsum (face_set_of_fan (fan_of_polyhedron P)) (\u:real^3#real^3->bool. (CARD u)))) + #0.506 * (sum V1 (\v. lmfun (hl [vec 0; v]))) <= sum V1 (\v. reg (g_fun v) (&(CARD {u | u extreme_point_of (f3:(real^3) -> (real^3->bool))(v)})))` ASSUME_TAC);; +e (MP_TAC (ISPECL [`(V1:real^3->bool)`;`X:(real^3->bool)->bool`;`P:real^3->bool`;`F':(real^3->bool)->bool`;`F_T:(real^3#real^3->bool)->bool`;`(f1:(real^3) -> (real^3->bool))`;`(f2:((real^3->bool))->(real^3))`;`(f3:(real^3) -> (real^3->bool))`;`(f4:((real^3->bool))->(real^3))`]th9));; +e (ASM_REWRITE_TAC[]);; +e (SUBGOAL_THEN `#0.591 * (&(CARD (V1:real^3->bool))) - #0.0331 * &(6*(CARD V1) - 12) + #0.506 * (&12) < #0.591* (&(CARD V1)) - #0.0331 * (&(nsum (face_set_of_fan (fan_of_polyhedron P)) (\u:real^3#real^3->bool. (CARD u)))) + #0.506 * (sum V1 (\v. lmfun (hl [vec 0; v])))` ASSUME_TAC);; +e (ASM_MESON_TAC [th10]);; +e (SUBGOAL_THEN `#0.591 * (&(CARD (V1:real^3->bool))) - #0.0331 * &(6*(CARD V1) - 12) + #0.506 * (&12) < sum V1 + (\v. reg (g_fun v) + (&(CARD {u | u extreme_point_of (f3:(real^3) -> (real^3->bool))(v)})))` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC[REAL_LTE_TRANS]);; +e (SUBGOAL_THEN `#0.591 * (&(CARD (V1:real^3->bool))) - #0.0331 * &(6*(CARD V1) - 12) + #0.506 * (&12) < (sum (V1:real^3->bool) (\v:real^3. sol (vec 0) ((f1:(real^3) -> (real^3->bool))(v))))` ASSUME_TAC);; +e (UNDISCH_TAC `sum (V1:real^3->bool) + (\v. reg (g_fun v) + (&(CARD {u | u extreme_point_of (f3:(real^3) -> (real^3->bool))(v)}))) <= + (sum (V1:real^3->bool) (\v:real^3. sol (vec 0) ((f1:(real^3) -> (real^3->bool))(v))))`);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC[REAL_LTE_TRANS]);; +e (POP_ASSUM MP_TAC);; +e (SUBGOAL_THEN `&4 * pi = (sum (X:(real^3->bool)->bool) (\v:real^3->bool. sol (vec 0) (v)))` ASSUME_TAC);; +e (ASM_MESON_TAC [th7]);; +e (SUBGOAL_THEN `(sum (V1:real^3->bool) (\v:real^3. sol (vec 0) ((f1:(real^3) -> (real^3->bool))(v)))) = (sum (X:(real^3->bool)->bool) (\v:real^3->bool. sol (vec 0) (v)))` ASSUME_TAC);; +e (ASM_MESON_TAC [thm18]);; +e (SUBGOAL_THEN `&4 * pi = (sum (V1:real^3->bool) (\v:real^3. sol (vec 0) ((f1:(real^3) -> (real^3->bool))(v))))` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (POP_ASSUM MP_TAC);; +e (ARITH_TAC);; +e (POP_ASSUM(fun th ->REWRITE_TAC[GSYM th]));; +e (SUBGOAL_THEN `CARD (V:real^3->bool) <= CARD (V1:real^3->bool)` ASSUME_TAC);; +e (UNDISCH_TAC `FINITE (V1:real^3->bool)`);; +e (UNDISCH_TAC `(V:real^3->bool) SUBSET V1`);; +e (REPEAT STRIP_TAC);; +e (SUBGOAL_THEN `(V:real^3->bool) SUBSET V1 /\ FINITE (V1:real^3->bool)` ASSUME_TAC);; +e (ASM_MESON_TAC[]);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC[CARD_SUBSET]);; +e (SUBGOAL_THEN `&(CARD (V:real^3->bool)) <= &(CARD (V1:real^3->bool))` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC [REAL_OF_NUM_LE]);; +e (SUBGOAL_THEN `&12 < &(CARD (V1:real^3->bool))` ASSUME_TAC);; +e (UNDISCH_TAC `&12 < &(CARD (V:real^3->bool))`);; +e (POP_ASSUM MP_TAC);; +e (REAL_ARITH_TAC);; +e (STRIP_TAC);; +e (SUBGOAL_THEN `&(CARD (V1:real^3->bool)) < &16` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (UNDISCH_TAC `pi < #3.15`);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC [th12]);; +e (SUBGOAL_THEN `&(CARD (V:real^3->bool)) < &16` ASSUME_TAC);; +e (POP_ASSUM MP_TAC);; +e (UNDISCH_TAC `&(CARD (V:real^3->bool)) <= &(CARD (V1:real^3->bool))`);; +e (MESON_TAC [REAL_LET_TRANS]);; +e (UNDISCH_TAC `&12 < &(CARD (V:real^3->bool))`);; +e (POP_ASSUM MP_TAC);; +e (MESON_TAC [NUM_REAL]);; + + +let DLWCHEM = top_thm();; \ No newline at end of file diff --git a/legacy/oldtame/dangtatdatusb/UBHDEUU.hl b/legacy/oldtame/dangtatdatusb/UBHDEUU.hl new file mode 100644 index 0000000..31a9720 --- /dev/null +++ b/legacy/oldtame/dangtatdatusb/UBHDEUU.hl @@ -0,0 +1,67 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Lemma: UBHDEUU *) +(* Chapter: Tame Hypermap *) +(* Author: DANG TAT DAT *) +(* Date: 2010-04-7 *) +(* ========================================================================== *) + +needs "/home/nyx/flyspeck/working/flyspeck_needs.hl";; +flyspeck_needs "fan/fan.hl";; + +open Fan;; +open Sphere;; + +(*Contravening Hypermap*) + +let h0 = new_definition `h0 = #1.26`;; (*Definition Const real number*) + +let ESTD = new_definition `ESTD (V:real^3->bool) = {{v,w}|(v IN V) /\ (w IN V)/\ (&0) < dist(v,w) /\ dist(v,w) <= (&2)*h0}`;; + +let ECTC = new_definition `ECTC (V:real^3->bool) = {{v,w}|(v IN V) /\ (w IN V)/\dist(v,w) = &2}`;; + +let ball_annulus = new_definition + `ball_annulus = cball((vec 0:real^3) , &2 * h0) DIFF ball(vec 0, &2)`;; + + +(*-----------Thang Lemma------------------------------------------------------*) +let CKQOWSA_concl = `!(V:real^3 -> bool).(packing V) /\ (V SUBSET ball_annulus) ==> (FAN (vec 0,V,(ESTD V)))`;; + +let CKQOWSA = new_axiom CKQOWSA_concl;; + +(*---------------------------------------------------------------------------*) + +(*UBHDEUU*) + +g `!(V:real^3 -> bool).(packing V) /\ (V SUBSET ball_annulus) ==> (ECTC V) SUBSET (ESTD V)`;; +e (PURE_REWRITE_TAC [ECTC;ESTD]);; +e (REPEAT STRIP_TAC);; +e (PURE_REWRITE_TAC [SUBSET]);; +e (GEN_TAC);; +e (REWRITE_TAC [IN_ELIM_THM]);; +e (STRIP_TAC);; +e (EXISTS_TAC `v:real^3`);; +e (EXISTS_TAC `w:real^3`);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (ARITH_TAC);; +e (REWRITE_TAC [h0]);; +e (ARITH_TAC);; + +let ECTC_SUBSET_ESTD = top_thm();; + +g `!(V:real^3 -> bool) (E:(real^3 ->bool)->bool). (packing V) /\ (V SUBSET ball_annulus) /\ ((E = ESTD V) \/ (E = ECTC V)) ==> FAN (vec 0,V,E) `;; + +e (REPEAT GEN_TAC);; +e (STRIP_TAC);; +e (ASM_REWRITE_TAC[]);; +e (ASM_MESON_TAC[CKQOWSA]);; +e (ASM_REWRITE_TAC[]);; +e (SUBGOAL_THEN `ECTC (V:real^3 -> bool) SUBSET ESTD V` ASSUME_TAC);; +e (ASM_MESON_TAC [ECTC_SUBSET_ESTD]);; +e (SUBGOAL_THEN `(FAN (vec 0,(V:real^3->bool),(ESTD V)))` ASSUME_TAC);; +e (ASM_MESON_TAC[CKQOWSA]);; +e (ASM_MESON_TAC [CTVTAQA]);; + +let UBHDEUU = top_thm();; \ No newline at end of file diff --git a/legacy/oldtame/pishort.hl b/legacy/oldtame/pishort.hl new file mode 100644 index 0000000..914ec9f --- /dev/null +++ b/legacy/oldtame/pishort.hl @@ -0,0 +1,127 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* A bound for the number pi *) +(* Chapter: Tame *) +(* Author: Vu Quang Thanh *) +(* Date: 2010-02-13 *) +(* ========================================================================== *) + + + +(* ========================================================================= *) +(* Quick derivation of a pi approximation (could do this more nicely). *) +(* ========================================================================= *) + + +module Pishort = struct + + +let TAYLOR_SIN = prove + (`!n x. abs(sin x - + sum(0..n) (\i. (if i MOD 4 = 0 then &0 + else if i MOD 4 = 1 then &1 + else if i MOD 4 = 2 then &0 + else -- &1) * x pow i / &(FACT i))) + <= abs x pow (n + 1) / &(FACT (n + 1))`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPECL [`\n. if n MOD 4 = 0 then sin + else if n MOD 4 = 1 then cos + else if n MOD 4 = 2 then \x. --(sin x) + else \x. --(cos x)`; + `n:num`; + `real_interval[--(abs x),abs x]`; `&1`] + REAL_TAYLOR) THEN + REWRITE_TAC[] THEN ANTS_TAC THENL + [REPEAT CONJ_TAC THENL + [REWRITE_TAC[is_realinterval; IN_REAL_INTERVAL] THEN REAL_ARITH_TAC; + ALL_TAC; + MESON_TAC[REAL_ABS_NEG; SIN_BOUND; COS_BOUND]] THEN + ONCE_REWRITE_TAC[GSYM(MATCH_MP MOD_ADD_MOD (ARITH_RULE `~(4 = 0)`))] THEN + REPEAT STRIP_TAC THEN REPEAT_TCL DISJ_CASES_THEN SUBST1_TAC (ARITH_RULE + `i MOD 4 = 0 \/ i MOD 4 = 1 \/ i MOD 4 = 2 \/ i MOD 4 = 3`) THEN + CONV_TAC NUM_REDUCE_CONV THEN + GEN_REWRITE_TAC (RATOR_CONV o LAND_CONV) [GSYM ETA_AX] THEN + REWRITE_TAC[] THEN REAL_DIFF_TAC THEN REAL_ARITH_TAC; + CONV_TAC NUM_REDUCE_CONV THEN REWRITE_TAC[COND_RATOR] THEN + DISCH_THEN(MP_TAC o SPECL [`&0:real`; `x:real`]) THEN + REWRITE_TAC[IN_REAL_INTERVAL] THEN ANTS_TAC THENL + [REAL_ARITH_TAC; ALL_TAC] THEN + REWRITE_TAC[REAL_SUB_RZERO; COS_0; SIN_0; REAL_NEG_0; REAL_MUL_LID]]);; + +let PI_LOWERBOUND_WEAK = prove + (`&627 / &256 <= pi`, + SUBGOAL_THEN + `!x. &0 < x /\ x < &627 / &256 ==> &0 < sin x` (MP_TAC o SPEC `pi`) + THENL [ALL_TAC; SIMP_TAC[SIN_PI; REAL_LT_REFL; PI_POS; REAL_NOT_LT]] THEN + REPEAT STRIP_TAC THEN MP_TAC(ISPECL [`2`; `x:real`] TAYLOR_SIN) THEN + REWRITE_TAC[num_CONV `2`; num_CONV `1`; SUM_CLAUSES_NUMSEG] THEN + CONV_TAC NUM_REDUCE_CONV THEN + REWRITE_TAC[REAL_MUL_LZERO; REAL_ADD_LID; REAL_ADD_RID; REAL_MUL_LID] THEN + ASM_SIMP_TAC[REAL_ARITH `&0 < x ==> abs x = x`] THEN MATCH_MP_TAC(REAL_ARITH + `e + d < a ==> abs(s - a) <= d ==> e < s`) THEN + REWRITE_TAC[REAL_ARITH + `&0 + x pow 3 / &6 < x pow 1 / &1 <=> x * x pow 2 < x * &6`] THEN + ASM_SIMP_TAC[REAL_LT_LMUL_EQ] THEN + MATCH_MP_TAC REAL_LT_TRANS THEN EXISTS_TAC `(&627 / &256) pow 2` THEN + ASM_SIMP_TAC[REAL_POW_LT2; ARITH_EQ; REAL_LT_IMP_LE] THEN + CONV_TAC REAL_RAT_REDUCE_CONV);; + +let COS_TREBLE_COS = prove + (`!x. cos(&3 * x) = &4 * cos(x) pow 3 - &3 * cos x`, + GEN_TAC THEN REWRITE_TAC[COS_ADD; REAL_ARITH `&3 * x = &2 * x + x`] THEN + REWRITE_TAC[SIN_DOUBLE; COS_DOUBLE_COS] THEN + MP_TAC(SPEC `x:real` SIN_CIRCLE) THEN CONV_TAC REAL_RING);; + +let COS_PI6 = prove + (`cos(pi / &6) = sqrt(&3) / &2`, + MP_TAC(ISPEC `pi / &6` COS_TREBLE_COS) THEN + REWRITE_TAC[REAL_ARITH `&3 * x / &6 = x / &2`; COS_PI2] THEN + REWRITE_TAC[REAL_RING `&0 = &4 * c pow 3 - &3 * c <=> + c = &0 \/ (&2 * c) pow 2 = &3`] THEN + SUBGOAL_THEN `&0 < cos(pi / &6)` ASSUME_TAC THENL + [MATCH_MP_TAC COS_POS_PI THEN MP_TAC PI_POS THEN REAL_ARITH_TAC; + DISCH_THEN(DISJ_CASES_THEN MP_TAC) THENL + [ASM_MESON_TAC[REAL_LT_REFL]; ALL_TAC] THEN + DISCH_THEN(MP_TAC o AP_TERM `sqrt`) THEN + ASM_SIMP_TAC[POW_2_SQRT; REAL_LE_MUL; REAL_LT_IMP_LE; REAL_POS] THEN + REAL_ARITH_TAC]);; + +let SIN_PI6 = prove + (`sin(pi / &6) = &1 / &2`, + MP_TAC(SPEC `pi / &6` SIN_CIRCLE) THEN REWRITE_TAC[COS_PI6] THEN + SIMP_TAC[REAL_POW_DIV; SQRT_POW_2; REAL_POS] THEN MATCH_MP_TAC(REAL_FIELD + `~(s + &1 / &2 = &0) ==> s pow 2 + &3 / &2 pow 2 = &1 ==> s = &1 / &2`) THEN + MATCH_MP_TAC(REAL_ARITH `&0 < x ==> ~(x + &1 / &2 = &0)`) THEN + MATCH_MP_TAC SIN_POS_PI THEN MP_TAC PI_POS THEN REAL_ARITH_TAC);; + +let SIN_PI6_STRADDLE = prove + (`!a b. &0 <= a /\ a <= b /\ b <= &7 /\ + sin(a / &6) <= &1 / &2 /\ &1 / &2 <= sin(b / &6) + ==> a <= pi /\ pi <= b`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + MP_TAC(SPECL [`pi / &6`; `b / &6`] SIN_MONO_LE_EQ) THEN + MP_TAC(SPECL [`a / &6`; `pi / &6`] SIN_MONO_LE_EQ) THEN + ASM_REWRITE_TAC[SIN_PI6] THEN + MP_TAC PI_LOWERBOUND_WEAK THEN ASM_REAL_ARITH_TAC);; + +let PI_APPROX = prove + (`abs(pi - &13493037705 / &4294967296) <= inv(&2 pow 32)`, + REWRITE_TAC[REAL_ARITH `abs(x - a) <= e <=> a - e <= x /\ x <= a + e`] THEN + MATCH_MP_TAC SIN_PI6_STRADDLE THEN CONV_TAC REAL_RAT_REDUCE_CONV THEN + CONJ_TAC THENL + [W(MP_TAC o PART_MATCH (lhand o rand o lhand) (SPEC `12` TAYLOR_SIN) o + lhand o snd); + W(MP_TAC o PART_MATCH (lhand o rand o lhand) (SPEC `12` TAYLOR_SIN) o + rand o snd)] THEN + REWRITE_TAC[TOP_DEPTH_CONV num_CONV `12`] THEN + REPLICATE_TAC 13 + (ONCE_REWRITE_TAC[SUM_CLAUSES_NUMSEG] THEN REWRITE_TAC[LE_0]) THEN + CONV_TAC NUM_REDUCE_CONV THEN CONV_TAC REAL_RAT_REDUCE_CONV THEN + REAL_ARITH_TAC);; + +let bound_for_pi = prove (`!n. &n * (&852 / &1000) <= &2 * pi ==> n <= 7`, REPEAT STRIP_TAC THEN ASSUME_TAC (PI_APPROX) THEN SUBGOAL_THEN `abs (pi - &13493037705 / &4294967296) < &1 / &128` ASSUME_TAC THENL[ASM_REAL_ARITH_TAC; MP_TAC (SPECL [`pi`; `&13493037705 / &4294967296`; `&1 / &128`] REAL_ABS_BOUND) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN SUBGOAL_THEN `&n < &8` ASSUME_TAC THENL[ASM_REAL_ARITH_TAC ; MP_TAC (SPECL [`n:num`; `8`] REAL_OF_NUM_LT) THEN ASM_REWRITE_TAC[] THEN ARITH_TAC]]);; + + + +end;; diff --git a/legacy/oldtame/quarantine/SZIPOAS.hl b/legacy/oldtame/quarantine/SZIPOAS.hl new file mode 100644 index 0000000..df7184a --- /dev/null +++ b/legacy/oldtame/quarantine/SZIPOAS.hl @@ -0,0 +1,404 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Lemma: SZIPOAS *) +(* Chapter: Tame *) +(* Author: Vu Quang Thanh *) +(* Date: 2010-02-13 *) +(* ========================================================================== *) + + + +module type Szipoas_type = sig + +end;; + +flyspeck_needs "hypermap/hypermap.hl";; +flyspeck_needs "tame/pishort.hl";; + + +module Szipoas= struct + + +prioritize_num();; + +let LEFT_MULT_MAP = Hypermap.LEFT_MULT_MAP;; + + +(* Definition of the tameness, actually I do not need this formally in my proof *) + +let triangle = new_definition `triangle (face (H:(A)hypermap) (x:A)) <=> CARD (face H x) = 3`;; + +let quadrilateral = new_definition `quadrilateral (face (H:(A)hypermap) (x:A)) <=> CARD (face H x) = 4`;; + +let exceptional = new_definition `exceptional (face (H:(A)hypermap) (x:A)) <=> CARD (face H x) >= 5`;; + +let tr_set = prove (`!(H:(A)hypermap) (x:A). (?tr:A->bool. (!y:A. (node H x) y ==> tr y = triangle (face H y)))`, REPEAT STRIP_TAC THEN REWRITE_TAC[GSYM SKOLEM_THM] THEN GEN_TAC THEN EXISTS_TAC `triangle (face (H:(A)hypermap) (y:A))` THEN REWRITE_TAC[]);; + +let tr_fun = new_specification ["tr_check"] (REWRITE_RULE [SKOLEM_THM] tr_set);; + +let set_of_triangle = new_definition `set_of_triangle (H:(A)hypermap) (x:A) = {face H y |y IN node H x /\ tr_check H x y}`;; + +let number_of_triangle = new_definition `number_of_triangle (H:(A)hypermap) (x:A) = CARD (set_of_triangle H x)`;; + +let quad_set = prove (`!(H:(A)hypermap) (x:A). (?qd:A->bool. (!y:A. (node H x) y ==> qd y = quadrilateral (face H y)))`, REPEAT STRIP_TAC THEN REWRITE_TAC[GSYM SKOLEM_THM] THEN GEN_TAC THEN EXISTS_TAC `quadrilateral (face (H:(A)hypermap) (y:A))` THEN REWRITE_TAC[]);; + +let quad_fun = new_specification ["quad_check"] (REWRITE_RULE [SKOLEM_THM] quad_set);; + +let set_of_quadrilateral = new_definition `set_of_quadrilateral (H:(A)hypermap) (x:A) = {face H y |y IN node H x /\ quad_check H x y}`;; + +let number_of_quadrilateral = new_definition `number_of_quadrilateral (H:(A)hypermap) (x:A) = CARD (set_of_quadrilateral H x)`;; + +let ex_set = prove (`!(H:(A)hypermap) (x:A). (?ex:A->bool. (!y:A. (node H x) y ==> ex y = exceptional (face H y)))`, REPEAT STRIP_TAC THEN REWRITE_TAC[GSYM SKOLEM_THM] THEN GEN_TAC THEN EXISTS_TAC `exceptional (face (H:(A)hypermap) (y:A))` THEN REWRITE_TAC[]);; + +let ex_fun = new_specification ["ex_check"] (REWRITE_RULE [SKOLEM_THM] ex_set);; + +let set_of_exceptional = new_definition `set_of_exceptional (H:(A)hypermap) (x:A) = {face H y |y IN node H x /\ ex_check H x y}`;; + +let number_of_exceptional = new_definition `number_of_exceptional (H:(A)hypermap) (x:A) = CARD (set_of_exceptional H x)`;; + +let type_of_node = new_definition `type_of_node (H:(A)hypermap) (x:A) = (number_of_triangle H x, number_of_quadrilateral H x, number_of_exceptional H x)`;; + +let tgt = new_definition `tgt = &1541 / &1000`;; + +let b_tame = new_definition `b_tame p q = if p,q = 0,3 then &618 / &1000 else + if p,q = 0,4 then &1 / &1 else + if p,q = 1,2 then &66 / &100 else + if p,q = 1,3 then &618 / &1000 else + if p,q = 2,1 then &8 / &10 else + if p,q = 2,2 then &412 / &1000 else + if p,q = 2,3 then &12851 / &10000 else + if p,q = 3,1 then &315 / &1000 else + if p,q = 3,2 then &83 / &100 else + if p,q = 4,0 then &35 / &100 else + if p,q = 4,1 then &374 / &1000 else + if p,q = 5,0 then &4 / &100 else + if p,q = 5,1 then &1144 / &1000 else + if p,q = 6,0 then &689 / &1000 else + if p,q = 7,0 then &145 / &100 else tgt`;; + +let d_tame = new_definition `d n = if n = 3 then &0 else + if n = 4 then &206 / &1000 else + if n = 5 then &483 / &1000 else + if n = 6 then &760 / &1000 else tgt`;; + +let a_tame = new_definition `a_tame = &63 / &100`;; + +let weight = + REWRITE_RULE[] + (new_type_definition "weight" ("weight","we") + (prove(`?f:(A->bool)->real. !x. f x >= &0`,EXISTS_TAC `(\x:(A->bool). &0)` THEN REAL_ARITH_TAC)));; + +let total_weight = new_definition `total_weight (H:(A)hypermap) (w:(A->bool)->real) = sum (face_set H) w`;; + +let adm_1 = new_definition `adm_1 (H:(A)hypermap) (w:(A->bool)->real) <=> (!x:A. w (face H x) >= d (CARD (face H x)))`;; + +let face_of_node = prove (`!(H:(A)hypermap) (x:A). (?fn:A->bool. (!y:A. fn y = ~(node H x INTER face H y = {})))`, REPEAT STRIP_TAC THEN REWRITE_TAC[GSYM SKOLEM_THM] THEN GEN_TAC THEN EXISTS_TAC `~((node (H:(A)hypermap) (x:A)) INTER (face (H:(A)hypermap) (y:A))= {})` THEN REWRITE_TAC[]);; + +let fn_fun = new_specification ["fn_check"] (REWRITE_RULE [SKOLEM_THM] face_of_node);; + +let face_set_of_node = new_definition `face_set_of_node (H:(A)hypermap) (x:A) = {face H y |fn_check H x y}`;; + +let adm_2 = new_definition `adm_2 (H:(A)hypermap) (w:(A->bool)->real) <=> (!x:A. (number_of_exceptional (H:(A)hypermap) (x:A) = 0) ==> ((sum (face_set_of_node H x) w) >= (b (number_of_triangle H x) (number_of_quadrilateral H x))))`;; + +let triangle_of_node = prove (`!(H:(A)hypermap) (x:A). (?trn:A->bool. (!y:A. trn y = (triangle (face H y) /\ ~(node H x INTER face H y = {}))))`, REPEAT STRIP_TAC THEN REWRITE_TAC[GSYM SKOLEM_THM] THEN GEN_TAC THEN EXISTS_TAC `(triangle (face (H:(A)hypermap) (y:A)) /\ ~((node (H:(A)hypermap) (x:A)) INTER (face (H:(A)hypermap) (y:A))= {}))` THEN REWRITE_TAC[]);; + +let trn_fun = new_specification ["trn_check"] (REWRITE_RULE [SKOLEM_THM] triangle_of_node);; + +let triangle_set_of_node = new_definition `triangle_set_of_node (H:(A)hypermap) (x:A) = {face H y |trn_check H x y}`;; + +let adm_3 = new_definition `adm_3 (H:(A)hypermap) (w:(A->bool)->real) <=> (!x:A. type_of_node H x = 5, 0, 1 ==> (sum (triangle_set_of_node H x) w) >= a_tame)`;; + +let admissible_weight = new_definition `admissible_weight (H:(A)hypermap) (w:(A->bool)->real) <=> adm_1 H w /\ adm_2 H w /\ adm_3 H w`;; + +let tame_1 = new_definition `tame_1 (H:(A)hypermap) <=> plain_hypermap (H:(A)hypermap) /\ planar_hypermap (H:(A)hypermap)`;; + +let tame_2 = new_definition `tame_2 (H:(A)hypermap) <=> connected_hypermap H /\ simple_hypermap H`;; + +let edge_nondegenerate = new_definition `edge_nondegenerate (H:(A)hypermap) (x:A) <=> ~(edge_map H x = x)`;; + +let tame_3 = new_definition `tame_3 (H:(A)hypermap) <=> (!x:A. edge_nondegenerate H x)`;; + +let tame_4 = new_definition `tame_4 (H:(A)hypermap) <=> (!x:A. (!y:A. y IN edge H x /\ ~(y = x) ==> (node H x INTER node H y = {})))`;; + +let tame_5 = new_definition `tame_5 (H:(A)hypermap) <=> (!x:A y:A. ~(y IN node H x) ==> CARD {z:A | ~(edge H z INTER node H x = {}) /\ ~(edge H z INTER node H y = {})} <= 1)`;; + + +let face_step_contour = new_definition `face_step_contour (H:(A)hypermap) (x:A) (y:A) <=> y = face_map H x`;; + +let is_face_contour = new_recursive_definition num_RECURSION `(is_face_contour (H:(A)hypermap) (p:num->A) 0 <=> T) /\ (is_face_contour (H:(A)hypermap) (p:num->A) (SUC n) <=> ((is_face_contour H p n) /\ face_step_contour H (p n) (p (SUC n))))`;; + +let inj_path = new_recursive_definition num_RECURSION + `(inj_path (p:num->A) 0 <=> T) /\ (inj_path (p:num->A) (SUC n) <=> (inj_path p n /\ (!j:num. j <= n ==> ~(p (SUC n) = p j))))`;; + + +let is_contour_loop = new_definition `is_contour_loop (H:(A)hypermap) (p:num->A) (n:num) <=> is_contour H p n /\ inj_path p (n - 1) /\ p n = p 0`;; + +let is_face_loop = new_definition `is_face_loop (H:(A)hypermap) (p:num->A) (n:num) <=> is_face_contour H p n /\ inj_path p (n - 1) /\ p n = p 0`;; + +let one_step = new_definition `one_step (H:(A)hypermap) (x:A) (y:A) <=> go_one_step H x y \/ go_one_step H y x`;; + +let interior_contour = new_definition `interior_contour (H:(A)hypermap) (p:num->A) (n:num) (y:A) <=> is_contour_loop H p n /\ (?(m:num) (q:num->A). q m = y /\ q 0 = p 0 /\ is_contour H q m)`;; + +let set_of_interior_contour = new_definition `set_of_interior_contour (H:(A)hypermap) (p:num->A) (n:num) = {y:A | interior_contour H p n y}`;; + +let node_interior_contour = new_definition `node_interior_contour (H:(A)hypermap) (p:num->A) (n:num) (y:A) <=> !z:A. z IN node H y ==> interior_contour H p n z`;; + +let exterior_contour = new_definition `exterior_contour (H:(A)hypermap) (p:num->A) (n:num) (y:A) <=> (is_contour_loop H p n /\ ~(interior_contour H p n y))`;; + +let set_of_exterior_contour = new_definition `set_of_exterior_contour (H:(A)hypermap) (p:num->A) (n:num) = {y:A | exterior_contour H p n y}`;; + +let node_exterior_contour = new_definition `node_exterior_contour (H:(A)hypermap) (p:num->A) (n:num) (y:A) <=> !z:A. z IN node H y ==> exterior_contour H p n z`;; + +let tame_6 = new_definition `tame_6 (H:(A)hypermap) <=> (!p:num->A. (is_face_loop H p 3 /\ (?y:A. node_exterior_contour H p 3 y)) ==> (?x:A. face H x = {p 0, p 1, p 2}))`;; + +let tame_7 = new_definition `tame_7 (H:(A)hypermap) <=> (!p:num->A. (is_contour_loop H p 4 /\ (?y:A z:A. node_exterior_contour H p 4 y /\ node_exterior_contour H p 4 z)) ==> (set_of_interior_contour H p 4 = {p 0, p 1, p 2, p 3} /\ (one_step H (p 0) (p 2) \/ one_step H (p 1) (p 3) \/ (one_step H (p 0) (p 2) /\ one_step H (p 1) (p 3)))))`;; + +let tame_8 = new_definition `tame_8 (H:(A)hypermap) <=> number_of_faces H >= 3`;; + +let tame_9 = new_definition `tame_9 (H:(A)hypermap) <=> (!(x:A). CARD (face H x) >= 3 /\ CARD (face H x) <= 6)`;; + +let tame_10 = new_definition `tame_10 (H:(A)hypermap) <=> number_of_nodes H = 13 \/ number_of_nodes H = 14`;; + +let tame_11 = new_definition `tame_11 (H:(A)hypermap) <=> (!(x:A). CARD (node H x) >= 3 /\ CARD (node H x) <= 7)`;; + +let tame_12 = new_definition `tame_12 (H:(A)hypermap) <=> (!(x:A) (y:A). (~((node H x) INTER (face H y) = {}) /\ exceptional (face H y)) ==> (CARD (node H x) <= 6 /\ CARD (node H x) = 6 ==> type_of_node H x = 5,0,1))`;; + +let tame_13 = new_definition `tame_13 (H:(A)hypermap) <=> (?(w:(A->bool)->real). admissible_weight H w /\ total_weight H w <= tgt)`;; + +let tame_hypermap = define `tame_hypermap (H:(A)hypermap) <=> tame_1 H /\ tame_2 H /\ tame_3 H /\ tame_4 H /\ tame_5 H /\ tame_6 H /\ tame_7 H /\ tame_8 H /\ tame_9 H /\ tame_10 H /\ tame_11 H /\ tame_12 H /\ tame_13 H` ;; + + +(* Definition of the opposite hypermap and some lemmas concerned. *) + +let opposite = new_definition `opposite (H:(A)hypermap) = hypermap (FST (tuple_hypermap H), SND (SND (SND (tuple_hypermap H))) o FST (SND (SND (tuple_hypermap H))), inverse (FST (SND (SND (tuple_hypermap H)))), inverse (SND (SND (SND (tuple_hypermap H)))))`;; + + + +let permutes_ID_ab = prove (`!D:A->bool e:A->A n:A->A. FINITE D /\ e permutes D /\ n permutes D ==> (e o n = I <=> n o e = I)`, let lm1 = prove (`!D:A->bool e:A->A n:A->A. FINITE D /\ e permutes D /\ n permutes D ==> e o n = I ==> n o e = I`, REPEAT STRIP_TAC THEN MP_TAC (ISPECL[`e:A->A`;`D:A->bool`] PERMUTES_INVERSES_o) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL[`inverse (e:A->A)`; `(e:A->A) o (n:A->A)`; `I:A->A`] LEFT_MULT_MAP) THEN ASM_REWRITE_TAC[o_ASSOC] THEN REWRITE_TAC[I_O_ID] THEN DISCH_TAC THEN ASM_REWRITE_TAC[]) in MESON_TAC[lm1]);; + +let plain_op_lm = prove (`!D:A->bool e:A->A n:A->A f:A->A. FINITE D /\ e permutes D /\ n permutes D /\ f permutes D /\ e o n o f = I /\ e o e = I ==> f o n o f o n = I`, REPEAT STRIP_TAC THEN MP_TAC (ISPECL[`e:A->A`;`D:A->bool`] PERMUTES_INVERSES_o) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL[`inverse (e:A->A)`; `(e:A->A) o (n:A->A) o (f:A->A)`; `(e:A->A) o (e:A->A)`] LEFT_MULT_MAP) THEN ASM_REWRITE_TAC[o_ASSOC;I_O_ID] THEN DISCH_TAC THEN MP_TAC(MESON [GSYM o_ASSOC] `(n:A->A) o (f:A->A) = e ==> (f o n) o f = f o e`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL[`D:A->bool`; `e:A->A`; `n:A->A`; `f:A->A`] cyclic_maps) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_SIMP_TAC[GSYM o_ASSOC]);; + + +prioritize_real();; + +(* Definition of fan, and the construction of the hypermap of fan. I follow the things on the sphere.hl and fan.ml, actually, I modify to fit the part on hypermap *) + +let atn2 = new_definition (`atn2 (x,y) = + if ( abs y < x ) then atn(y / x) else + (if (&0 < y) then ((pi / &2) - atn(x / y)) else + (if (y < &0) then (-- (pi/ &2) - atn (x / y)) else ( pi )))`);; + +let aff = new_definition `aff = ( hull ) affine`;; +let radius = new_definition `radius (x,y) = sqrt((x pow 2) + (y pow 2))`;; +let polar_angle = new_definition `polar_angle x y = + let theta = atn2(x,y) in + if (theta < &0) then (theta + (&2 * pi)) else theta`;; +let polar_c = new_definition `polar_c x y = (radius (x,y),polar_angle x y)`;; + +let directed_angle = new_definition `directed_angle (x,y) (x',y') = + polar_angle (x'*x+y'*y) (y'*x - x'*y)`;; +let polar_cycle = new_definition `polar_cycle V v = (@ u. V u /\ + (!w. V w /\ ~(w = v) ==> directed_angle v u <= directed_angle v w))`;; + +let orthonormal = new_definition `orthonormal e1 e2 e3 = + (( e1 dot e1 = &1) /\ (e2 dot e2 = &1) /\ ( e3 dot e3 = &1) /\ + ( e1 dot e2 = &0) /\ ( e1 dot e3 = &0) /\ ( e2 dot e3 = &0) /\ + (&0 < (e1 cross e2) dot e3))`;; + +let cyclic_set = new_definition `cyclic_set W v w = + (~(v=w) /\ (FINITE W) /\ (!p q h. W p /\ W q /\ (p = q + h % (v - w)) ==> (p=q)) /\ + (W INTER (affine hull {v,w}) = EMPTY))`;; + +let azim_cycle_hyp_def = new_definition `azim_cycle_hyp = + (?sigma. !W proj v w e1 e2 e3 p. + (W p) /\ + (cyclic_set W v w) /\ ((dist( v ,w)) % e3 = (w-v)) /\ + (orthonormal e1 e2 e3) /\ + (!u x y. (proj u = (x,y)) <=> (?h. (u = v + x % e1 + y % e2 + h % e3))) ==> + (proj (sigma W v w p) = polar_cycle (IMAGE proj W) (proj p)))`;; + +let azim_cycle_spec = prove(`?sigma. !W proj v w e1 e2 e3 p. + (azim_cycle_hyp) ==> ( (W p) /\ + (cyclic_set W v w) /\ ((dist( v ,w)) % e3 = (w-v)) /\ + (orthonormal e1 e2 e3) /\ + (!u x y. (proj u = (x,y)) <=> (?h. (u = v + x % e1 + y % e2 + h % e3)))) ==> (proj (sigma W v w p) = polar_cycle (IMAGE proj W) (proj p))`, + (REWRITE_TAC[GSYM RIGHT_IMP_EXISTS_THM;GSYM RIGHT_IMP_FORALL_THM]) THEN + (REWRITE_TAC[azim_cycle_hyp_def]) + );; + +let azim_cycle_def = new_specification ["azim_cycle"] azim_cycle_spec;; + +let graph = new_definition `graph (E:(A->bool)->bool) <=> (!e. E e ==> e HAS_SIZE 2)`;; + +let fan1 = new_definition `fan1 (V:A->bool) <=> FINITE V /\ ~(V = {})`;; + +let fan2 = new_definition `fan2 (x:A, V) <=> ~(x IN V)`;; + +let fan3 = new_definition `fan3 (x:real^3,V,E) <=> (!v. v IN V ==> cyclic_set {w | {v,w} IN E } x v)`;; + +let fan4 = new_definition `fan4 (x:real^3,V,E) <=> (!e. (e IN E) ==> (aff_gt {x} e INTER V={}))`;; + +let fan5 = new_definition `fan5 (x:real^3,E) <=> (!e f. (e IN E)/\ (f IN E) /\ ~(e = f) ==> (aff_gt {x} e INTER aff_gt {x} f ={}))`;; + +let fan = new_definition `fan (x:real^3, V, E) <=> ((UNIONS E) SUBSET V) /\ graph E/\ fan1 V /\ fan2 (x,V)/\ fan3 (x,V,E)/\ fan4 (x,V,E) /\ fan5 (x,E)`;; + +let base_point_fan = new_definition `base_point_fan (x:A,V:A->bool,E:(A->bool)->bool) = x`;; + +let incident_edges = new_definition `incident_edges (v:A) E = {w | {v,w} IN E}`;; + +let azim_cycle_fan = new_definition `azim_cycle_fan = +(!x:real^3 V E. ?sigma. !proj e1 e2 e3 v w. +(fan(x, V, E) /\ (V v) /\ ({v,w} IN E) /\ ((dist(v,x)) % e3 = (x-v)) /\ +(orthonormal e1 e2 e3) /\ (!u a b. (proj u = (a,b)) <=> (?h. (u = v + a % e1 + b % e2 + h % e3)))) ==> ( (proj (sigma v w) = polar_cycle (IMAGE proj {y|{v,y} IN E}) (proj w))))`;; + +let azim_cycle_fan1 = REWRITE_RULE[SKOLEM_THM] azim_cycle_fan;; + +let azim_cycle_fan2 = prove(`?sigma. !x:real^3 V E proj e1 e2 e3 v w. +(azim_cycle_fan)==> (fan(x, V, E) /\ (V v) /\ ({v,w} IN E) /\ ((dist(v,x)) % e3 = (x-v)) /\ (orthonormal e1 e2 e3) /\ (!u a b. (proj u = (a,b)) <=> (?h. (u = v + a % e1 + b % e2 + h % e3)))) ==> ( (proj (sigma x V E v w) = polar_cycle (IMAGE proj {y|{v,y} IN E}) (proj w)))`, REWRITE_TAC[GSYM RIGHT_IMP_FORALL_THM; GSYM RIGHT_IMP_EXISTS_THM] THEN REWRITE_TAC[azim_cycle_fan1]);; + + +let sigma_fan = new_specification ["sigma_fan"] azim_cycle_fan2;; + +let D1 = new_definition `D1 (x:real^3,V:real^3->bool,E:(real^3->bool)->bool) = {(x:real^3,v:real^3,w:real^3,w1:real^3)|(V v)/\(w IN incident_edges v E) /\ (w1 = sigma_fan x V E v w)}`;; + +let D2 = new_definition `D2 (x:real^3,V:real^3->bool,E:(real^3->bool)->bool) = {(x,v,v,v)| (V v) /\ (incident_edges v E = {})}`;; + +let dart_fan = new_definition `dart_fan (x, V, E) = D1 (x, V, E) UNION D2 (x, V, E)`;; + +let inverse_sigma_fan_alt = new_definition `inverse_sigma_fan_alt x V E v w = @a. sigma_fan x V E v a=w`;; + +let e_fan = new_definition `e_fan (x:real^3) V E = (\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). (x,w,v,(sigma_fan x V E w v)))`;; + +let f_fan = new_definition `f_fan (x:real^3) V E = (\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). (x,w,(inverse_sigma_fan_alt x V E w v),v) )`;; + +let n_fan = new_definition `n_fan (x:real^3) V E = (\(x:real^3,v:real^3,w:real^3,w1:real^3). (x, v, w1, sigma_fan x V E v w1))`;; + +let azim_dart = new_definition `azim_dart (x, v, w, w1) = azim x v w w1`;; + +let hypermap_of_fan = new_definition `hypermap_of_fan (x:real^3, V, E) = hypermap (dart_fan (x, V, E), e_fan x V E, n_fan x V E, f_fan x V E)`;; + +(* I made the following as my assumption, this should have been done in the fan part, by that I means, actually when you need a hypermap out of a fan *) + +let hyp_fan1 = prove (`!x:real^3 V E. fan (x, V, E) ==> FINITE (dart_fan (x, V, E))`, CHEAT_TAC);; + +let hyp_fan2 = prove (`!x:real^3 V E. fan (x, V, E) ==> (e_fan x V E) permutes dart_fan (x, V, E)`, CHEAT_TAC);; + +let hyp_fan3 = prove (`!x:real^3 V E. fan (x, V, E) ==> (n_fan x V E) permutes dart_fan (x, V, E)`, CHEAT_TAC);; + +let hyp_fan4 = prove (`!x:real^3 V E. fan (x, V, E) ==> (f_fan x V E) permutes dart_fan (x, V, E)`, CHEAT_TAC);; + +let hyp_fan5 = prove (`!x:real^3 V E. fan (x, V, E) ==> (e_fan x V E) o (n_fan x V E) o (f_fan x V E) = I`, CHEAT_TAC);; + +(* If the above assumption, the followings are the properties of the hypermap associated with the fan *) + +let hyp_fan_tup = prove (`!x:real^3 V E. fan (x, V, E) ==> tuple_hypermap (hypermap (dart_fan (x,V,E), e_fan x V E, n_fan x V E, f_fan x V E)) = (dart_fan (x,V,E), e_fan x V E, n_fan x V E, f_fan x V E)`, SIMP_TAC[GSYM (CONJUNCT2 hypermap_tybij); hyp_fan1;hyp_fan2;hyp_fan3;hyp_fan4;hyp_fan5;SND;FST]);; + +let n_hyp_of_fan = prove (`!x:real^3 V E. fan (x, V, E) ==> node_map (hypermap_of_fan (x, V, E)) = n_fan x V E`, SIMP_TAC[hyp_fan_tup;node_map;FST;SND;hypermap_of_fan]);; + +let e_hyp_of_fan = prove (`!x:real^3 V E. fan (x, V, E) ==> edge_map (hypermap_of_fan (x, V, E)) = e_fan x V E`, SIMP_TAC[hyp_fan_tup;edge_map;FST;SND;hypermap_of_fan]);; + +let f_hyp_of_fan = prove (`!x:real^3 V E. fan (x, V, E) ==> face_map (hypermap_of_fan (x, V, E)) = f_fan x V E`, SIMP_TAC[hyp_fan_tup;face_map;FST;SND;hypermap_of_fan]);; + +(* A lemma on the bound of the sum related to the cardinality *) + +let card_node = new_definition `card_node x V E n = CARD (node (hypermap_of_fan (x, V, E)) n)`;; + +let SUM_LOWER_BOUND = prove (`!s f a. FINITE s /\ (!x:A. x IN s ==> a <= f (x)) ==> &(CARD s) * a <= sum s f`, SIMP_TAC[GSYM SUM_CONST; SUM_LE]);; + +let node_lbound_lm = prove (`!a (x:real^3) V E n. fan (x, V, E) /\ (!d. a <= azim_dart d) /\ FINITE (node (hypermap_of_fan (x, V, E)) n) ==> &(card_node x V E n) * a <= sum (node (hypermap_of_fan (x, V, E)) n) azim_dart`, SIMP_TAC [SUM_LOWER_BOUND;card_node]);; + +(* Characterization of the node in hypermap associated with a fan *) + +let pow_sigma_fan = new_recursive_definition num_RECURSION `(pow_sigma_fan (x:real^3) V E v w 0 = w) /\ (pow_sigma_fan (x:real^3) V E v w (SUC n) = (sigma_fan x V E v (pow_sigma_fan x V E v w n)))`;; + +let pow_sigma_0 = prove (`!x V E v w. pow_sigma_fan x V E v w 0 = w`, SIMP_TAC[pow_sigma_fan]);; + +let pow_sigma_1 = prove (`!x V E v w. pow_sigma_fan x V E v w 1 = sigma_fan x V E v w`, SIMP_TAC[pow_sigma_fan;pow_sigma_0;ARITH_RULE `1 = SUC 0`]);; + + +let node_fan_map = prove (`!x V E v w i. fan (x, V, E) ==> node_map (hypermap_of_fan (x, V, E)) (x, v, pow_sigma_fan x V E v w i, pow_sigma_fan x V E v w (SUC i)) = (x, v, pow_sigma_fan x V E v w (SUC i), pow_sigma_fan x V E v w (SUC (SUC i)))`, REPEAT STRIP_TAC THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`] n_hyp_of_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[n_fan;pow_sigma_fan]);; + +let in_d1 = prove (`!x V E v w w1. (x, v, w, w1) IN D1 (x, V, E) ==> w1 = sigma_fan x V E v w`, REWRITE_TAC[D1;IN_ELIM_THM;PAIR_EQ] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]);; + +(* The following is also not necessary in my task, I put it for the coherent, and following the note, actually, we need to redefine the node edge, face map in the hypermap associated with a fan, and it should be modified in the fan part *) + +let dart_fan_character = prove (`!x V E v w w1. (x, v, w, w1) IN dart_fan (x, V, E) <=> w1 = sigma_fan x V E v w`, CHEAT_TAC);; + + +let MULT_INVERSE_POWER = prove (`!D:A->bool e:A->A. FINITE D /\ e permutes D ==> (!n. (e POWER n) o ((inverse e) POWER n) = I)`, REPEAT GEN_TAC THEN DISCH_TAC THEN MP_TAC (ISPECL[`e:A->A`;`D:A->bool`] PERMUTES_INVERSES_o) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN INDUCT_TAC THENL[ASM_REWRITE_TAC[POWER;I_O_ID]; MP_TAC (ISPECL[`e:A->A`; `D:A->bool`] PERMUTES_INVERSE) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ABBREV_TAC `f = inverse (e:A->A)` THEN MP_TAC (ISPECL [`n:num`; `f:A->A`] COM_POWER) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[o_ASSOC] THEN ASM_REWRITE_TAC[POWER;I_O_ID] THEN ASSUME_TAC (ISPECL [`(e:A->A) POWER n`; `e:A->A`; `f:A->A`] (GSYM o_ASSOC)) THEN ASM_SIMP_TAC[I_O_ID]]);; + +let pow_node_fan = prove (`!x V E v w. fan (x, V, E) ==> (!i. (node_map (hypermap_of_fan (x, V, E)) POWER i) (x, v, w, sigma_fan x V E v w) = (x, v, pow_sigma_fan x V E v w i, pow_sigma_fan x V E v w (SUC i)))`, REPEAT GEN_TAC THEN DISCH_TAC THEN INDUCT_TAC THENL[REWRITE_TAC[POWER;I_THM;pow_sigma_0;pow_sigma_1; ARITH_RULE `SUC 0 = 1`]; ASM_REWRITE_TAC[COM_POWER;o_THM] THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`;`w:real^3`; `i:num`] node_fan_map) THEN ASM_REWRITE_TAC[]]);; + + +let in_orb = prove (`!f:A->A x:A y:A. y IN orbit_map f x <=> (?n. y = (f POWER n) x)`, let lm1 = prove (`!f:A->A x:A y:A. y IN orbit_map f x ==> (?n. y = (f POWER n) x)`, REWRITE_TAC[orbit_map; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN EXISTS_TAC `n:num` THEN ASM_REWRITE_TAC[]) in let lm2 = prove (`!f:A->A x:A y:A. (?n. y = (f POWER n) x) ==> y IN orbit_map f x`, REPEAT STRIP_TAC THEN MP_TAC (SPECL [`f:A->A`;`n:num`;`x:A`;`y:A`] in_orbit_lemma) THEN ASM_REWRITE_TAC[]) in MESON_TAC[lm1;lm2]);; + + + +let INV_MULT_POW = prove (`!D:A->bool e:A->A. FINITE D /\ e permutes D ==> (!n. ((inverse e) POWER n) o (e POWER n) = I)`, let INV_INVERSE = prove (`!s:A->bool p. p permutes s ==> inverse(inverse p) = p`, SIMP_TAC[FUN_EQ_THM] THEN MESON_TAC[PERMUTES_INVERSE_EQ; PERMUTES_INVERSE]) in REPEAT GEN_TAC THEN DISCH_TAC THEN MP_TAC (ISPECL[`D:A->bool`; `e:A->A`] INV_INVERSE) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL [`e:A->A`;`D:A->bool`] PERMUTES_INVERSE) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL [`D:A->bool`; `inverse (e:A->A)`] MULT_INVERSE_POWER) THEN ASM_SIMP_TAC[]);; + +let triv_ch = prove (`!a:num->A n. {a i | i >= 0 /\ i < n} = {a i | i < n}`, REPEAT STRIP_TAC THEN REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN STRIP_TAC THEN EQ_TAC THENL[REPEAT STRIP_TAC THEN EXISTS_TAC `i:num` THEN ASM_SIMP_TAC[]; REPEAT STRIP_TAC THEN EXISTS_TAC `i:num` THEN ASM_SIMP_TAC[] THEN ARITH_TAC]);; + +let lm1 = prove (`!s:A->bool p:A->A m n. FINITE s /\ p permutes s ==> (inverse p POWER n) o (p POWER (n + m)) = p POWER m`, REPEAT STRIP_TAC THEN MP_TAC (ISPECL [`s:A->bool`; `p:A->A`] INV_MULT_POW) THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (ASSUME_TAC o SPEC `n:num`) THEN ASSUME_TAC (MESON [addition_exponents] `(p:A->A) POWER (n + m) = (p POWER n) o (p POWER m)`) THEN ASM_REWRITE_TAC[o_ASSOC; I_O_ID]);; + +let lm2 = prove (`!s:A->bool p:A->A (n:num) x:A. FINITE s /\ p permutes s ==> ((!m:num. ~(m = 0) /\ (m < n) ==> ~((p POWER m) x = x)) ==> (!i:num j:num. (i < n) /\ (j < i) ==> ~((p POWER i) x = (p POWER j) x)))`, REPEAT GEN_TAC THEN DISCH_TAC THEN DISCH_THEN (LABEL_TAC "c3") THEN REPLICATE_TAC 3 STRIP_TAC THEN DISCH_THEN (LABEL_TAC "c4") THEN FIRST_X_ASSUM(MP_TAC o MATCH_MP LM_AUX) THEN REPEAT STRIP_TAC THEN REMOVE_THEN "c3" MP_TAC THEN MP_TAC (ARITH_RULE `(i:num < n:num) /\ (i = (j:num) + (k:num)) ==> k < n`) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN DISCH_THEN (MP_TAC o SPEC `k:num`) THEN ASM_REWRITE_TAC[] THEN MP_TAC (ISPECL [`s:A->bool`; `p:A->A`; `k:num`; `j:num`] lm1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL [`s:A->bool`; `p:A->A`] INV_MULT_POW) THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (ASSUME_TAC o SPEC `j:num`) THEN MP_TAC (MESON [o_THM] `((p:A->A) POWER i) x = (p POWER j) x ==> ((inverse p POWER j) o (p POWER i)) x = ((inverse p POWER j) o (p POWER j)) x`) THEN ASM_REWRITE_TAC[I_O_ID; I_THM]);; + +let lm3 = prove (`!s:A->bool p:A->A x:A. FINITE s /\ p permutes s ==> (!m:num. ~(m = 0) /\ (m < CARD (orbit_map p x)) ==> ~((p POWER m) x = x))`, REPEAT STRIP_TAC THEN MP_TAC (ISPECL[`p:A->A`; `m:num`; `x:A`] card_orbit_le) THEN ASM_REWRITE_TAC[] THEN ASM_ARITH_TAC);; + +let lm4 = prove (`!s:A->bool p:A->A x:A m n. FINITE s /\ p permutes s ==> ((p POWER (m +n)) x = (p POWER m) x ==> (p POWER n) x = x)`, REPEAT STRIP_TAC THEN MP_TAC (ISPECL [`s:A->bool`; `p:A->A`; `n:num`; `m:num`] lm1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL [`s:A->bool`; `p:A->A`] INV_MULT_POW) THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (ASSUME_TAC o SPEC `m:num`) THEN MP_TAC (MESON [o_THM] `((p:A->A) POWER (m + n)) x = (p POWER m) x ==> ((inverse p POWER m) o (p POWER (m + n))) x = ((inverse p POWER m) o (p POWER m)) x`) THEN ASM_REWRITE_TAC[I_O_ID; I_THM]);; + +let lm5 = prove (`!s:A->bool p:A->A x:A. FINITE s /\ p permutes s ==> (!i:num j:num. (i < CARD (orbit_map (p:A->A) x)) /\ (j < i) ==> ~((p POWER i) x = (p POWER j) x))`, REPLICATE_TAC 7 STRIP_TAC THEN MP_TAC (ISPECL [`s:A->bool`; `p:A->A`; `x:A`] lm3) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL [`s:A->bool`; `p:A->A`; `CARD (orbit_map (p:A->A) x)`; `x:A`] lm2) THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (MP_TAC o SPEC `i:num`) THEN DISCH_THEN (MP_TAC o SPEC `j:num`) THEN ASM_REWRITE_TAC[]);; + +let fin_lem = prove (`!s:A->bool p:A->A x. FINITE s /\ p permutes s ==> FINITE (orbit_map p x)`, REPEAT STRIP_TAC THEN MP_TAC (ISPECL [`s:A->bool`; `p:A->A`] finite_order) THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (X_CHOOSE_TAC `n:num`) THEN SUBGOAL_THEN `((p:A->A) POWER n) x = x` ASSUME_TAC THENL[ASM_SIMP_TAC[I_THM]; MP_TAC (ISPECL [`p:A->A`; `n:num`; `x:A`] orbit_cyclic) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL[`n:num`; `(\i. ((p:A->A) POWER i) x)`] FINITE_SERIES) THEN REWRITE_TAC[BETA_CONV `(\i. ((p:A->A) POWER i) x) i`] THEN ASM_SIMP_TAC[]]);; + +let abcd = prove (`!s:A->bool p:A->A x n. {(p POWER i) x | i >= 0 /\ i < n} SUBSET orbit_map p x`, REPEAT STRIP_TAC THEN REWRITE_TAC[orbit_map] THEN SET_TAC[]);; + +let lm_sub_inc = prove (`!s:A->bool p:A->A x n. {(p POWER i) x | i >= 0 /\ i < n} SUBSET {(p POWER i) x | i >= 0 /\ i < SUC n}`, REPEAT STRIP_TAC THEN REWRITE_TAC[orbit_map; SUBSET] THEN GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN EXISTS_TAC `i:num` THEN ASM_REWRITE_TAC [] THEN ASM_ARITH_TAC);; + +let lm6 = prove (`!p:A->A x n. FINITE {(p POWER i) x | i >= 0 /\ i < n}`, REPEAT STRIP_TAC THEN MP_TAC (ISPECL [`n:num`; `(\i. ((p:A->A) POWER i) x)`] FINITE_SERIES) THEN BETA_TAC THEN MP_TAC (ISPECL [`\i. ((p:A->A) POWER i) x`; `n:num`] triv_ch) THEN BETA_TAC THEN SIMP_TAC[]);; + +let lm7 = prove (`!s:A->bool p:A->A x n. FINITE s /\ p permutes s ==> CARD {(p POWER i) x | i >= 0 /\ i < n} <= CARD (orbit_map p x) /\ CARD {(p POWER i) x | i >= 0 /\ i < n} <= CARD {(p POWER i) x | i >= 0 /\ i < SUC n}`, REPEAT STRIP_TAC THENL [MP_TAC (ISPECL [`s:A->bool`; `p:A->A`; `x:A`] fin_lem) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL [`s:A->bool`; `p:A->A`; `x:A`; `n:num`] abcd) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL [`{((p:A->A) POWER i) x | i >= 0 /\ i < n}`; `orbit_map (p:A->A) x`] NEW_CARD_SUBSET) THEN ASM_REWRITE_TAC[]; MP_TAC (ISPECL [`p:A->A`; `x:A`; `SUC n`] lm6) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL [`s:A->bool`; `p:A->A`; `x:A`; `n:num`] lm_sub_inc) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL [`{((p:A->A) POWER i) x | i >= 0 /\ i < n}`; `{((p:A->A) POWER i) x | i >= 0 /\ i < SUC n}`] NEW_CARD_SUBSET) THEN ASM_REWRITE_TAC[]]);; + +let lm9 = prove (`!s:A->bool p:A->A x. FINITE s /\ p permutes s ==> (!n. CARD (orbit_map (p:A->A) x) <= n ==> CARD {(p POWER i) x |i >= 0 /\ i < n} = CARD (orbit_map (p:A->A) x))`, let NULL_SERIES_1 = prove(`!f:num->A. {f(i) | i >= 0 /\ i < 0} = {}`, GEN_TAC THEN REWRITE_TAC[EXTENSION; EMPTY; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN FIRST_ASSUM (MP_TAC o MATCH_MP (ARITH_RULE `i < 0 ==> F`)) THEN SIMP_TAC[]) in REPLICATE_TAC 4 STRIP_TAC THEN INDUCT_TAC THENL [REWRITE_TAC[ARITH_RULE `i <= 0 <=> i = 0`] THEN DISCH_TAC THEN MP_TAC (ISPEC `\i. ((p:A->A) POWER i) x` NULL_SERIES_1) THEN BETA_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[CARD_CLAUSES]; DISCH_TAC THEN ASM_CASES_TAC `CARD (orbit_map (p:A->A) x) <= n` THENL [SUBGOAL_THEN `CARD {((p:A->A) POWER i) x | i >= 0 /\ i < n} = CARD (orbit_map (p:A->A) x)` ASSUME_TAC THENL [ASM_MESON_TAC[]; MP_TAC (ISPECL [`s:A->bool`; `p:A->A`; `x:A`; `n:num`] lm7) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL [`s:A->bool`; `p:A->A`; `x:A`; `SUC n`] lm7) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_ARITH_TAC]; MP_TAC (ARITH_RULE `CARD (orbit_map (p:A->A) x) <= SUC n /\ ~(CARD (orbit_map (p:A->A) x) <= n) ==> CARD (orbit_map (p:A->A) x) = SUC n`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL [`SUC n`; `\i:num. ((p:A->A) POWER i) x`] CARD_FINITE_SERIES_EQ) THEN BETA_TAC THEN MP_TAC (ISPECL [`s:A->bool`; `p:A->A`; `x:A`] lm5) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN SUBGOAL_THEN `{((p:A->A) POWER i) x | i < SUC n} = {((p:A->A) POWER i) x | i >= 0 /\ i < SUC n}` ASSUME_TAC THENL[REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN SIMP_TAC [ARITH_RULE `i >= 0`]; ASM_MESON_TAC[]]]]);; + +let orbit_character = prove (`!s:A->bool p:A->A x. FINITE s /\ p permutes s ==> (!n. CARD (orbit_map (p:A->A) x) <= n ==> {(p POWER i) x |i >= 0 /\ i < n} = orbit_map (p:A->A) x)`, REPEAT STRIP_TAC THEN MP_TAC (ISPECL [`s:A->bool`; `p:A->A`; `x:A`] fin_lem) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL [`s:A->bool`; `p:A->A`; `x:A`; `n:num`] abcd) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL [`s:A->bool`; `p:A->A`; `x:A`] lm9) THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (MP_TAC o SPEC `n:num`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL [`{((p:A->A) POWER i) x | i >= 0 /\ i < n}`; `orbit_map (p:A->A) x`] CARD_SUBSET_EQ) THEN ASM_REWRITE_TAC[]);; + + +let node_fan_character = prove (`!x V E v w w1. fan (x, V, E) /\ (x, v, w, w1) IN D1 (x, V, E) ==> (!n. card_node x V E (x, v, w, w1) <= n ==> node (hypermap_of_fan (x, V, E)) (x, v, w, w1) = {(x, v, pow_sigma_fan x V E v w i, pow_sigma_fan x V E v w (SUC i)) | i >= 0 /\ i < n})`, REPEAT STRIP_TAC THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`; `w1:real^3`] in_d1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[node] THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`] hyp_fan1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`] hyp_fan3) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`] n_hyp_of_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL [`dart_fan (x:real^3, V, E)`; `n_fan (x:real^3) V E`; `((x:real^3), (v:real^3), (w:real^3), sigma_fan (x:real^3) V E (v:real^3) (w:real^3))`] orbit_character) THEN ASM_REWRITE_TAC[] THEN ABBREV_TAC `m = CARD (orbit_map (n_fan (x:real^3) V E) (x:real^3,v:real^3,w:real^3,sigma_fan (x:real^3) V E v w))` THEN SUBGOAL_THEN `(m:num) <= (n:num)` ASSUME_TAC THENL[ASM_MESON_TAC[card_node;node]; DISCH_THEN (MP_TAC o SPEC `n:num`) THEN ASM_REWRITE_TAC[] THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`] pow_node_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_SIMP_TAC[]]);; + + +let card_orb_neq0 = prove (`!s:A->bool p:A->A x:A. FINITE s /\ p permutes s ==> ~(CARD (orbit_map p x) = 0)`, REPEAT GEN_TAC THEN DISCH_TAC THEN MP_TAC (ISPECL[`s:A->bool`; `p:A->A`; `x:A`] fin_lem) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASSUME_TAC (ISPECL [`p:A->A`; `x:A`] orbit_reflect) THEN MP_TAC (ISPECL [`orbit_map (p:A->A) x`; `x:A`] CARD_ATLEAST_1) THEN ASM_REWRITE_TAC[] THEN ARITH_TAC);; + + +let card_nfan_neq0 = prove (`!x V E v w w1. fan (x, V, E) /\ (x, v, w, w1) IN D1 (x, V, E) ==> ~(CARD (orbit_map (n_fan x V E) (x, v, w, w1)) = 0)`, REPEAT GEN_TAC THEN STRIP_TAC THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`; `w1:real^3`] in_d1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`] hyp_fan1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`] hyp_fan3) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL [`dart_fan (x:real^3, V:real^3->bool, E:(real^3->bool)->bool)`; `n_fan (x:real^3) V E`; `(x:real^3, v:real^3, w:real^3, w1:real^3)`] card_orb_neq0) THEN ASM_REWRITE_TAC[]);; + + +(* Characterization of the sum in a node, related to the sum in a segment, that is a communication with the things on part 1, related to azim *) + +let sum_in_seg = prove (`!f:A->real s:A->bool n a:num->A. ~(n = 0) /\ s = {a i | i >= 0 /\ i < n} /\ (!i j. i < j /\ j < n ==> ~(a i = a j)) ==> sum s f = sum (0..(n - 1)) (f o a)`, REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (ASSUME_TAC) (CONJUNCTS_THEN2 (ASSUME_TAC) (LABEL_TAC "h1"))) THEN SUBGOAL_THEN `!i j. i IN 0..n - 1 /\ j IN 0..n - 1 /\ (a:num->A) i = a j ==> i = j` ASSUME_TAC THENL[REWRITE_TAC[IN_NUMSEG] THEN REPEAT STRIP_TAC THEN MP_TAC (ARITH_RULE `i <= n - 1 /\ j <= n - 1 /\ ~(n = 0) ==> i < n /\ j < n`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_CASES_TAC `(i:num) < j` THENL[USE_THEN "h1" (fun th -> MP_TAC (SPECL [`i:num`; `j:num`] th)) THEN ASM_MESON_TAC[]; ASM_CASES_TAC `(j:num) < i` THENL[USE_THEN "h1" (fun th -> MP_TAC (SPECL [`j:num`; `i:num`] th)) THEN ASM_MESON_TAC[]; ASM_ARITH_TAC]]; MP_TAC (ISPECL [`n:num`; `a:num->A`] IMAGE_SEG) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASSUME_TAC (ISPECL [`a:num->A`; `n:num`] triv_ch) THEN MP_TAC (ISPECL [`a:num->A`; `f:A->real`; `0..n - 1`] SUM_IMAGE) THEN ASM_REWRITE_TAC[]]);; + +let alt_azim_fan_sum = prove (`!x V E v w w1. fan (x, V, E) /\ (x, v, w, w1) IN D1 (x, V, E) ==> sum (node (hypermap_of_fan (x, V, E)) (x, v, w, w1)) azim_dart = sum (0..((card_node x V E (x, v, w, w1)) - 1)) (\i. azim x v (pow_sigma_fan x V E v w i) (pow_sigma_fan x V E v w (SUC i)))`, REPEAT STRIP_TAC THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`; `w1:real^3`] in_d1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`; `w1:real^3`] node_fan_character) THEN ASM_REWRITE_TAC[] THEN ABBREV_TAC `m = CARD (orbit_map (n_fan (x:real^3) V E) (x:real^3,v:real^3,w:real^3,sigma_fan (x:real^3) V E v w))` THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`] n_hyp_of_fan) THEN ASM_REWRITE_TAC[card_node;node] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (MP_TAC o SPEC `m:num`) THEN ASM_REWRITE_TAC[LE_REFL] THEN DISCH_TAC THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`; `w1:real^3`] card_nfan_neq0) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`] hyp_fan1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`] hyp_fan3) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL [`dart_fan (x:real^3, V:real^3->bool, E:(real^3->bool)->bool)`; `n_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)`; `(x:real^3, v:real^3, w:real^3, w1:real^3)`] lm5) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`] pow_node_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL [`azim_dart`; `{(x , v , pow_sigma_fan x V E v w i, pow_sigma_fan x V E v w (SUC i)) | i >= 0 /\ i < m}`; `m:num`; `\i. (x , v , pow_sigma_fan x V E v w i, pow_sigma_fan x V E v w (SUC i))`] sum_in_seg) THEN ASM_SIMP_TAC[] THEN SUBGOAL_THEN `(~(m = 0) /\ (!i j. i < j /\ j < m ==> ~(x:real^3,v:real^3,pow_sigma_fan (x:real^3) V E v w i,pow_sigma_fan (x:real^3) V E v w (SUC i) = x,v,pow_sigma_fan (x:real^3) V E v w j,pow_sigma_fan (x:real^3) V E v w (SUC j))))` ASSUME_TAC THENL[ASM_MESON_TAC[]; ASM_REWRITE_TAC[] THEN SUBGOAL_THEN `(azim_dart o (\i. x:real^3,v:real^3,pow_sigma_fan (x:real^3) (V:real^3->bool) E v w i,pow_sigma_fan (x:real^3) V E v w (SUC i))) = (\i. azim (x:real^3) (v:real^3) (pow_sigma_fan (x:real^3) V E v w i) (pow_sigma_fan (x:real^3) V E v w (SUC i)))` ASSUME_TAC THENL[REWRITE_TAC[o_DEF;azim_dart]; ASM_SIMP_TAC[]]]);; + +(* I will modify this, when this lemma is finised *) + +let lemmaULEKUUB = prove (`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (w1:real^3). fan (x,V,E) /\ (x,v,w,w1) IN D1 (x,V,E) ==> sum (0..card_node x V E (x,v,w,w1) - 1) (\i. azim x v (pow_sigma_fan x V E v w i) (pow_sigma_fan x V E v w (SUC i))) = &2 * pi`, CHEAT_TAC);; + +(* I use a non precise statement as in the note, since I have not define the contravening hypermap, if you can convince other to change his task, I would like to work on this lemma, for the completion of my lemma, this lemma is essential to my lemma *) + +let lemmaCDTETAT = prove (`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). fan (x,V,E) ==> (!d. d IN D1 (x,V,E) ==> &852 / &1000 <= azim_dart d /\ azim_dart d <= &19 / &10)`, CHEAT_TAC);; + + +let finite_nfan = prove (`!x V E v w w1. fan (x, V, E) /\ (x, v, w, w1) IN D1 (x, V, E) ==> FINITE (node (hypermap_of_fan (x, V, E)) (x, v, w, w1))`, REPEAT STRIP_TAC THEN REWRITE_TAC[node] THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`] n_hyp_of_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`] hyp_fan1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`] hyp_fan3) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (ISPECL [`dart_fan (x:real^3, V:real^3->bool, E:(real^3->bool)->bool)` ; `n_fan x V E`; `(x:real^3, v:real^3, w:real^3, w1:real^3)`] fin_lem) THEN ASM_REWRITE_TAC[]);; + +(* This one is for the completeness, actually, when you look at the fan part, you will see the hole in that *) + +let azim_dart_nin_d1 = prove (`!x V E d. fan (x, V, E) /\ ~(d IN D1 (x, V, E)) ==> &1 <= azim_dart d`, CHEAT_TAC);; + +(* In this lemma, I state in a not precise way, as I have said, since I have not define the contravening. Also, I use a lemma, in the pishort.ml *) + +let lemmaSZIPOAS = prove (`!x V E v w w1. fan (x, V, E) /\ (x, v, w, w1) IN D1 (x, V, E) ==> card_node x V E (x, v, w, w1) <= 7`, REPEAT STRIP_TAC THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3` ;`w:real^3`; `w1:real^3`] lemmaULEKUUB) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3` ;`w:real^3`; `w1:real^3`] alt_azim_fan_sum) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3` ;`w:real^3`; `w1:real^3`] finite_nfan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`] lemmaCDTETAT) THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (LABEL_TAC "fh1") THEN MP_TAC (SPECL [`&852 / &1000`; `x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `(x:real^3, v:real^3, w:real^3, w1:real^3)`] node_lbound_lm) THEN ASM_REWRITE_TAC[] THEN SUBGOAL_THEN `!d:real^3#real^3#real^3#real^3. &852 / &1000 <= azim_dart d` ASSUME_TAC THENL[STRIP_TAC THEN ASM_CASES_TAC `(d:real^3#real^3#real^3#real^3) IN D1 (x:real^3, V:real^3->bool, E:(real^3->bool)->bool)` THENL[USE_THEN "fh1" (MP_TAC o SPEC `d:real^3#real^3#real^3#real^3`) THEN ASM_SIMP_TAC[]; MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `(d:real^3#real^3#real^3#real^3)`] azim_dart_nin_d1) THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC]; ASM_REWRITE_TAC[] THEN MP_TAC (SPEC `card_node (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (x, v, w, w1)` bound_for_pi) THEN ASM_SIMP_TAC[]]);; + + + + +end;; diff --git a/legacy/oldtrig/run_file_euler.ml b/legacy/oldtrig/run_file_euler.ml new file mode 100755 index 0000000..bbe0e7c --- /dev/null +++ b/legacy/oldtrig/run_file_euler.ml @@ -0,0 +1,22 @@ +needs "flyspeck_needs.hl";; (* snapshot 1631 *) + +flyspeck_needs "general/sphere.hl";; + +flyspeck_needs "general/prove_by_refinement.hl";; + +flyspeck_needs "trigonometry/trig1.hl";; +flyspeck_needs "trigonometry/trig2.hl";; + + +open Sphere;; +open Trigonometry1;; +open Trigonometry2;; +open Prove_by_refinement;; + +#use "delta_x.ml";; +#use "euler_complement.ml";; +#use "euler_multivariate.ml";; +#use "euler_main_theorem.ml";; + + + diff --git a/legacy/oldtrig/trig_old.ml b/legacy/oldtrig/trig_old.ml new file mode 100644 index 0000000..721ab7b --- /dev/null +++ b/legacy/oldtrig/trig_old.ml @@ -0,0 +1,243 @@ +(* cut from trig.ml. + Material by J. Rute and T. Hales *) + + +(*** work in progress + + prove + (`!u v w. arcV u v w = arcV (vec 0) (v - u) (w - u)`, + REWRITE_TAC [CONV_RULE KEP_REAL3_CONV arcV; VECTOR_SUB_RZERO]);; + + let ARCV_BILINEAR_L = prove + (`!(u:real^N) v s. ~(u = vec 0) /\ ~(v = vec 0) /\ &0 < s ==> + arcV (vec 0) (s % u) v = arcV (vec 0) u v`, + REWRITE_TAC [REAL_ARITH `!x. &0 < x <=> ~(&0 = x) /\ &0 <= x`] THEN + REWRITE_TAC [GSYM NORM_POS_LT] THEN REPEAT STRIP_TAC THEN + REWRITE +_TAC [CONV_RULE KEP_REAL3_CONV arcV; VECTOR_SUB_RZERO; DOT_LMUL; + NORM_MUL; GSYM REAL_MUL_ASSOC] THEN + SUBGOAL_TAC "norm_pos" `&0 < norm (u:real^N) * norm (v:real^N)` + [MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC []] THEN + SUBGOAL_TAC "norm_nonzero" `~(&0 = norm (u:real^N) * norm (v:real^N))` + [POP_ASSUM MP_TAC THEN REAL_ARITH_TAC] THEN + SUBGOAL_TAC "stuff" `abs s = s` + [ASM_REWRITE_TAC [REAL_ABS_REFL]] THEN + ASM_SIMP_TAC [GSYM REAL_DIV_MUL2]);; + + let ARCV_SYM = prove + (`!(u:real^N) v w. arcV u v w = arcV u w v`, + REWRITE_TAC [CONV_RULE KEP_REAL3_CONV arcV; DOT_SYM; REAL_MUL_SYM]);; + + let ARCV_BILINEAR_R = prove + (`!(u:real^N) v s. ~(u = vec 0) /\ ~(v = vec 0) /\ &0 < s ==> + arcV (vec 0) u (s % v) = arcV (vec 0) u v`, + REPEAT STRIP_TAC THEN + SUBGOAL_TAC "switch" `arcV (vec 0) (u:real^N) (s % v) = arcV (vec 0) (s % v) u` + [REWRITE_TAC [ARCV_SYM]] THEN + POP_ASSUM SUBST1_TAC THEN ASM_SIMP_TAC [ARCV_BILINEAR_L; ARCV_SYM]);; + + + prove + (`!u v. ~(u = vec 0) /\ ~(v = vec 0) ==> + arcV (vec 0) u v = + arcV (vec 0) ((inv (norm u)) % u) ((inv (norm v)) % v)`, + REPEAT STRIP_TAC THEN + SUBGOAL_TAC "u" `&0 < inv (norm (u:real^3))` + [ REPEAT (POP_ASSUM MP_TAC) THEN + SIMP_TAC [GSYM NORM_POS_LT; REAL_LT_INV] ] THEN + SUBGOAL_TAC "v" `&0 < inv (norm (v:real^3))` + [ REPEAT (POP_ASSUM MP_TAC) THEN + SIMP_TAC [GSYM NORM_POS_LT; REAL_LT_INV] ] THEN + SUBGOAL_TAC "vv" `~(inv (norm v) % (v:real^3) = vec 0)` + [ ASM_REWRITE_TAC [VECTOR_MUL_EQ_0] THEN POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC ] THEN + ASM_SIMP_TAC [ARCV_BILINEAR_L; ARCV_BILINEAR_R]);; + + prove + (`!v:real^N. ~(v = vec 0) ==> norm((inv (norm v)) % v) = &1`, + REWRITE_TAC [NORM_MUL; REAL_ABS_INV; REAL_ABS_NORM; GSYM NORM_POS_LT] THEN + CONV_TAC REAL_FIELD);; + + prove + (`!v0 va vb vc. + dihV v0 va vb vc = + dihV (vec 0) (va - v0) (vb - v0) (vc - v0)`, + REWRITE_TAC [CONV_RULE KEP_REAL3_CONV dihV; VECTOR_SUB_RZERO]);; + + prove + (`!va vb vc s. ~(va = vec 0) /\ ~(vb = vec 0) /\ ~(vb = vec 0) /\ &0 < s ==> + dihV (vec 0) (s % va) vb vc = dihV (vec 0) va vb vc`, + REWRITE_TAC [REAL_ARITH `!x. &0 < x <=> ~(&0 = x) /\ &0 <= x`] THEN + REWRITE_TAC [GSYM NORM_POS_LT] THEN REPEAT STRIP_TAC THEN + REWRITE_TAC [CONV_RULE KEP_REAL3_CONV dihV; VECTOR_SUB_RZERO; DOT_LMUL; + DOT_RMUL; NORM_MUL; GSYM REAL_MUL_ASSOC; VECTOR_MUL_ASSOC] THEN + let thm1 = + VECTOR_ARITH `!x v. (s * s * x) % (v:real^3) = (s pow 2) % (x % v)` in + let thm2 = + VECTOR_ARITH `!x v. (s * x * s) % (v:real^3) = (s pow 2) % (x % v)` in + REWRITE_TAC [thm1; thm2; GSYM VECTOR_SUB_LDISTRIB] + );; + + let COLLINEAR_TRANSLATE = prove + (`collinear (s:real^N->bool) <=> collinear {v - v0 | v IN s}`, + REWRITE_TAC [collinear; IN_ELIM_THM] THEN EQ_TAC THEN STRIP_TAC THEN + EXISTS_TAC `u :real^N` THEN REPEAT STRIP_TAC THENL + [ ASM_SIMP_TAC [VECTOR_ARITH `!u:real^N v w. u - w - (v - w) = u - v`] ; + ONCE_REWRITE_TAC [VECTOR_ARITH `x:real^N - y = (x - v0) - (y - v0)`] THEN + SUBGOAL_THEN + `(?v:real^N. v IN s /\ x - v0 = v - v0) /\ + (?v. v IN s /\ y - v0 = v - v0)` + (fun th -> ASM_SIMP_TAC [th]) THEN + STRIP_TAC THENL [EXISTS_TAC `x:real^N`; EXISTS_TAC `y:real^N`] THEN + ASM_REWRITE_TAC [] ]);; + + let SET_MAP_3 = prove + (`{f x | x IN {a, b, c}} = {f a, f b, f c}`, + REWRITE_TAC [EXTENSION; IN_ELIM_THM; + SET_RULE `x IN {a, b, c} <=> (x = a \/ x = b \/ x = c)`] THEN + MESON_TAC []);; + + let COLLINEAR_TRANSLATE_3 = prove + (`collinear {u:real^N, v, w} <=> collinear {u - v0, v - v0, w - v0}`, + SUBGOAL_TAC "step1" + `collinear {u:real^N, v, w} <=> collinear {x - v0 | x IN {u, v, w}}` + [ REWRITE_TAC [GSYM COLLINEAR_TRANSLATE] ] THEN + SUBGOAL_TAC "step2" + `{x - v0 | x:real^N IN {u, v, w}} = {u - v0, v - v0, w - v0}` + [ REWRITE_TAC [SET_MAP_3] ] THEN + ASM_REWRITE_TAC [] );; + + let COLLINEAR_ZERO = prove + (`collinear {u:real^N, v, w} <=> collinear {vec 0, v - u, w - u}`, + SUBGOAL_TAC "zero" + `vec 0 :real^N = u - u` + [ REWRITE_TAC [VECTOR_SUB_REFL] ] THEN + ASM_REWRITE_TAC [GSYM COLLINEAR_TRANSLATE_3]);; + + let COLLINEAR_SYM = prove + (`collinear {vec 0: real^N, x, y} <=> collinear {vec 0: real^N, y, x}`, + AP_TERM_TAC THEN SET_TAC [] );; + + let COLLINEAR_FACT = prove + (`collinear {vec 0: real^N, x, y} <=> + ((y dot y) % x = (x dot y) % y)`, + ONCE_REWRITE_TAC [COLLINEAR_SYM] THEN EQ_TAC THENL + [ REWRITE_TAC [COLLINEAR_LEMMA] THEN STRIP_TAC THEN + ASM_REWRITE_TAC [DOT_LZERO; DOT_RZERO; VECTOR_MUL_LZERO; + VECTOR_MUL_RZERO; VECTOR_MUL_ASSOC; + DOT_LMUL; REAL_MUL_SYM]; + REWRITE_TAC [COLLINEAR_LEMMA; + TAUT `A \/ B \/ C <=> ((~A /\ ~B) ==> C)`] THEN + REPEAT STRIP_TAC THEN EXISTS_TAC `(x:real^N dot y) / (y dot y)` THEN + MATCH_MP_TAC + (ISPECL [`y:real^N dot y`;`x:real^N`] VECTOR_MUL_LCANCEL_IMP) THEN + SUBGOAL_TAC "zero" + `~((y:real^N) dot y = &0)` [ ASM_REWRITE_TAC [DOT_EQ_0] ] THEN + ASM_SIMP_TAC [VECTOR_MUL_ASSOC; REAL_DIV_LMUL] ] );; + + + let COLLINEAR_NOT_ZERO = prove + (`~collinear {u:real^N, v, w} ==> ~(vec 0 = v - u) /\ ~(vec 0 = w - u)`, + ONCE_REWRITE_TAC [COLLINEAR_ZERO] THEN REWRITE_TAC [COLLINEAR_LEMMA] THEN + MESON_TAC [] );; + + let COS_ARCV = prove + (`~(vec 0 = u:real^3) /\ ~(vec 0 = v) ==> + cos (arcV (vec 0) u v) = (u dot v) / (norm u * norm v)`, + REWRITE_TAC [DOT_COS; + MESON [NORM_EQ_0] `!v. vec 0 = v <=> norm v = &0`] THEN + CONV_TAC REAL_FIELD);; + + + prove + (`~(collinear {v0:real^3,va,vc}) /\ ~(collinear {v0,vb,vc}) ==> + (let gamma = dihV v0 vc va vb in + let a = arcV v0 vb vc in + let b = arcV v0 va vc in + let c = arcV v0 va vb in + cos(gamma) pow 2 = ((cos(c) - cos(a)*cos(b))/(sin(a)*sin(b))) pow 2)`, + +module Trig : Trigsig = struct + + let trigAxiomProofA a_t = prove(a_t, + (MP_TAC trig_term) THEN (REWRITE_TAC[trig_term_list]) THEN + (DISCH_THEN (fun t-> ASM_REWRITE_TAC[t])) + ) + let trigAxiomProofB a_t = prove(a_t, + (MP_TAC trig_term) THEN (REWRITE_TAC[trig_term_list]) THEN + (REPEAT STRIP_TAC) + ) + + sin (arcV v0 vb vc) = + norm (((vc - v0) dot (vc - v0)) % (va - v0) - + ((va - v0) dot (vc - v0)) % (vc - v0)) + + cos (arcV v0 va vb) = + + + prove + (spherical_loc_t, + REWRITE_TAC [COLLINEAR_ZERO ;COLLINEAR_FACT] THEN + ONCE_REWRITE_TAC [VECTOR_ARITH `a = b <=> vec 0 = a - b`] THEN + REPEAT STRIP_TAC THEN + REPEAT (CONV_TAC let_CONV) THEN + REWRITE_TAC [CONV_RULE KEP_REAL3_CONV dihV] THEN + ASM_SIMP_TAC [COS_ARCV ; COLLINEAR_NOT_ZERO] + +***) + + + (* yet unproven theorems: + +module Trig : Trigsig = struct + + let trigAxiomProofA a_t = prove(a_t, + (MP_TAC trig_term) THEN (REWRITE_TAC[trig_term_list]) THEN + (DISCH_THEN (fun t-> ASM_REWRITE_TAC[t])) + ) + let trigAxiomProofB a_t = prove(a_t, + (MP_TAC trig_term) THEN (REWRITE_TAC[trig_term_list]) THEN + (REPEAT STRIP_TAC) + ) + + let spherical_loc = trigAxiomProofB spherical_loc_t + let spherical_loc2 = trigAxiomProofB spherical_loc2_t + let dih_formula = trigAxiomProofB dih_formula_t + let dih_x_acs = trigAxiomProofB dih_x_acs_t + let beta_cone = trigAxiomProofB beta_cone_t + let euler_triangle = trigAxiomProofB euler_triangle_t + let polar_cycle_rotate = trigAxiomProofB polar_cycle_rotate_t + let thetaij = trigAxiomProofB thetaij_t + let thetapq_wind = trigAxiomProofB thetapq_wind_t + let zenith = trigAxiomProofB zenith_t + let polar_coord_zenith = trigAxiomProofB polar_coord_zenith_t + let azim_pair = trigAxiomProofB azim_pair_t + let azim_cycle_sum = trigAxiomProofB azim_cycle_sum_t + let dih_azim = trigAxiomProofB dih_azim_t + let sph_triangle_ineq = trigAxiomProofB sph_triangle_ineq_t + let sph_triangle_ineq_sum = trigAxiomProofB sph_triangle_ineq_sum_t + let azim = trigAxiomProofB azim_t + *) + +(* let polar_coords = trigAxiomProofB polar_coords_t *) +(* let spherical_coord = trigAxiomProofB spherical_coord_t *) +(* [deprecated] + let aff_insert_sym = trigAxiomProofB aff_insert_sym_t + let aff_sgn_insert_sym_gt = trigAxiomProofB aff_sgn_insert_sym_gt_t + let aff_sgn_insert_sym_ge = trigAxiomProofB aff_sgn_insert_sym_ge_t + let aff_sgn_insert_sym_lt = trigAxiomProofB aff_sgn_insert_sym_lt_t + let aff_sgn_insert_sym_le = trigAxiomProofB aff_sgn_insert_sym_le_t + let azim_hyp = trigAxiomProofB azim_hyp_t + let azim_cycle_hyp = trigAxiomProofB azim_cycle_hyp_t + let aff = trigAxiomProofA aff_t + let aff_gt = trigAxiomProofB aff_gt_t + let aff_ge = trigAxiomProofB aff_ge_t + let aff_lt = trigAxiomProofB aff_lt_t + let aff_le = trigAxiomProofB aff_le_t + let azim_cycle = trigAxiomProofB azim_cycle_t +*) + +end;; + + + diff --git a/legacy/oldvolume/ch_volume/vol2.hl b/legacy/oldvolume/ch_volume/vol2.hl new file mode 100644 index 0000000..ddc9d8f --- /dev/null +++ b/legacy/oldvolume/ch_volume/vol2.hl @@ -0,0 +1,75 @@ +(* + +Volume files + +Author: Thomas Hales + +Date: 2010-02-08 + +*) + +let RADIAL_NORM_RADIAL = prove(`radial_norm = radial`, + REWRITE_TAC[FUN_EQ_THM;NORMBALL_BALL;radial_norm;radial] + );; + +let EVENTUALLY_RADIAL_UNNORM = prove(`eventually_radial_norm = eventually_radial`, + REWRITE_TAC[FUN_EQ_THM;NORMBALL_BALL;RADIAL_NORM_RADIAL;eventually_radial_norm;eventually_radial] );; + + + +(* LBWOPAH *) + +let RADIAL_EVENTUALLY_RADIAL = prove(`!C x:real^N. (?r. (r> &0) /\ radial r x C) ==> eventually_radial x C`, + REWRITE_TAC[radial;eventually_radial] THEN + REPEAT STRIP_TAC THEN + REWRITE_TAC[SET_RULE`x IN a INTER b <=> x IN a /\ x IN b`] THEN + EXISTS_TAC `r:real` THEN ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + (*1*) ASM_MESON_TAC[SET_RULE `a SUBSET b ==> a INTER b SUBSET b`]; + (*2*) ALL_TAC + ] THEN + REPEAT STRIP_TAC THENL + [ + (*1*)ASM_MESON_TAC[]; + (*2*)ALL_TAC + ] THEN + REWRITE_TAC[IN_BALL;dist;VECTOR_ARITH `x:real^N -(x+y) = -- y`;NORM_MUL;NORM_NEG] THEN + ASM_SIMP_TAC[REAL_ARITH `t > &0 ==> (abs t = t)`] + );; + +let LBWOPAH = RADIAL_EVENTUALLY_RADIAL;; + + +(* -- to here -- +let VQFENMT1 = prove(`!r x C. volume_prop vol /\ measurable C /\ radial_norm r x C ==> + (vol C = sol C x * (r pow 3)/(&3))`, + + );; +*) + +(* -- work in progres -- +let VQFENMT2 = prove(`!x C. + volume_prop vol /\ measurable C /\ (?r. (r > &0) /\ (!y. y IN C ==> dist(x,y) >= r)) ==> + eventually_radial_norm x C /\ (sol C (x:real^3) = &0)`, + REWRITE_TAC[TAUT `(a ==> b /\ c) = ((a ==> b) /\ (a /\ b ==> c))`] THEN + STRIP_TAC THEN STRIP_TAC THEN + CONJ_TAC THEN + REWRITE_TAC[eventually_radial_norm;radial_norm] THEN + REPEAT STRIP_TAC THEN + REWRITE_TAC[NORMBALL_BALL] THEN + EXISTS_TAC `r:real` THEN + ASM_REWRITE_TAC[INTER_SUBSET] THEN + GEN_TAC THEN + SUBGOAL_THEN `C INTER ball((x:real^3),r) = EMPTY` ASSUME_TAC THEN + (* branch 1 *) + REWRITE_TAC[ball] THEN + ONCE_REWRITE_TAC[FUN_EQ_THM] THEN + REWRITE_TAC[elimin NOT_IN_EMPTY;elimin IN_INTER;elimin IN_ELIM_THM] THEN + ASM_MESON_TAC[IN;REAL_ARITH `!a b. a >= b ==> ~(a < b)`] THEN + (* branch 2 *) + ASM_REWRITE_TAC[NOT_IN_EMPTY] THEN + (* branch 3 *) + REPEAT STRIP_TAC THEN + +*) diff --git a/legacy/oldvolume/ch_volume/volume.hl b/legacy/oldvolume/ch_volume/volume.hl new file mode 100644 index 0000000..0760db1 --- /dev/null +++ b/legacy/oldvolume/ch_volume/volume.hl @@ -0,0 +1,201 @@ +(* summary of the volume chapter *) + +(* +Known issues: + +-- TXIWYHI has quantifiers in the wrong order. It should be ?C. !r. + +-- JJFHOIW_t not formalized. + +-- ATOAPUN missing the additivity of volumes + +-- PUACSHX (Project Issue 5), mismatch between volume_prop vol and volume_props. + This affects all theorems with assumption `volume_prop vol` + +-- NULLSET and vol are pretty printed versions of negligible and measure, specialized to R^3, + so searches don't show all the general theorems +*) + + + +let OWCZKJR = NULLSET_RULES;; + +(* more NULLSET props *) +let NULLSET_INTER = prove(`!s t. NULLSET s /\ NULLSET t ==> + NULLSET (s INTER t)`, + SIMP_TAC[NEGLIGIBLE_INTER]);; + +let NULLSET_SUBSET = prove(`!s t. NULLSET s /\ t SUBSET s ==> NULLSET t`, + MESON_TAC[NEGLIGIBLE_SUBSET]);; + +let NULLSET_DIFF = prove(`!s t. NULLSET s ==> NULLSET(s DIFF t)`, + SIMP_TAC[NEGLIGIBLE_DIFF]);; + +let NUKRQDI = MEASURABLE_RULES;; + +(* Background in Measure *) + + +let ATOAPUN = volume_props;; + +(* volume_props doesn't give additivity of measure. Here it is. *) + +let VOL_DISJOINT_UNION = prove(` !s t. + measurable s /\ measurable t /\ DISJOINT s t + ==> vol (s UNION t) = vol s + vol t`, + SIMP_TAC[MEASURE_DISJOINT_UNION] );; + +let VOL_NULLSET_UNION= prove(` !s t. + measurable s /\ measurable t /\ NULLSET (s INTER t) + ==> vol (s UNION t) = vol s + vol t`, + SIMP_TAC[MEASURE_NEGLIGIBLE_UNION] );; + +let VOL_UNION_LE=prove(` !s t. + measurable s /\ measurable t + ==> vol (s UNION t) <= vol s + vol t`, + SIMP_TAC[MEASURE_UNION_LE] );; + +(* unwedged versions *) + +let ATOAPUN1 = VOLUME_CONIC_CAP;; +let ATOAPUN2 = VOLUME_CONIC_CAP_STRONG;; +let ATOAPUN3 = VOLUME_BALL;; +let ATOAPUN4 = VOLUME_FRUSTT;; +let ATOAPUN5 = VOLUME_FRUSTT_STRONG;; + +(* Primitive Volume *) + +(* radial set *) + +let VSPMVNR1 = ball;; +let VSPMVNR2 = cball;; +let VSPMVNR = [VSPMVNR1;VSPMVNR2];; + +(* duplicate definition : normball = ball *) + +let QPHVSMZ1 = radial;; +let QPHVSMZ2 = eventually_radial;; +let QPHVSMZ3 = radial_norm;; +let QPHVSMZ4 = eventually_radial_norm;; +let QPHVSMZ5 = NORMBALL_BALL;; +let QPHVSMZ = [ QPHVSMZ1; QPHVSMZ2; QPHVSMZ3;QPHVSMZ4;QPHVSMZ5];; + + let KODOBRF = inter_radial;; + + let LBWOPAH = "not found";; + +let PUACSHX = lemma_r_r'_fix;; + +let MASYUQQ = sol;; + + +(* to here *) +(* 2.2.1 wedge *) +let wedge = wedge;; + +(* Lemma 2.4 [VICUATE] need to check - found in Multivariate/flyspeck.ml *) +let VICUATE = WEDGE_LUNE;; + +(* Definition 2.4 Solid Triangle *) +let solid_triangle = solid_triangle;; + +(* Definition 2.5 Conic Cap *) +let conic_cap = conic_cap;; + +(* Definition 2.6 rcone label{def:p:rcone} + - a collection of different rcones label{def:p:rcone} *) +let rcone_gt = rcone_gt;; +let rcone_ge = rcone_ge;; +(* < version from the definition wasn't found in flyspeck.ml *) +let rcone_eq = rcone_eq;; + +(* Definition 2.7 frustum *) +let frustum = frustum;; + +(* Definition 2.8 tetrahedron *) +let tetrahedron = conv0;; + +(* Definition 2.9 Primitive label{def:primitive} *) +let primitive = primitive;; + +(* volume calculations *) + +(* Lemma 2.5 [PAZNHPZ] label{lemma:prim-volume} - found in Multivariate/flyspeck.ml*) +(* + +VOLUME_SOLID_TRIANGLE, VOLUME_CONIC_CAP, VOLUME_FRUSTT, VOLUME_OF_TETRAHEDRON, vol_rect, VOLUME_BALL_WEDGE combine to + form the lemma *) + +(* Lemma 2.6 [DFNVMFM] label{lemma:wedge-vol} need to check - found in Multivariate/flyspeck.ml *) +let DFNVMFM = VOLUME_BALL_WEDGE;; + +(* Lemma 2.7 [FMSWMVO] label{lemma:wedge-sol}*) +(* not found *) + +(* Lemma 2.8 [FUPXNLC] label{lemma:prim-sol} *) +(* not found *) + +(* Lemma 2.9 [WFFVGVF] *) +(* not found *) + +(* Lemma 2.10 [CZOQFNL] label{lemma:wedge:sol} not sure if this one is correct...found in Multivariate/flyspeck.ml *) +let CZOQFNL = WEDGE_LUNE_GT;; + +(* Lemma 2.11 [OXQZBJG] *) +(* not formalized *) + +(* Definition 2.10 (orthosimplex, orth) label{def:ortho} *) +(*found in sphere.hl *) + let ortho0 = ortho0;; + +(* Definition 2.11 (Rogers simplex, rog) label{def:rog} *) +(*both found in sphere.hl *) +(* + let rogers0 = rogers0;; + let rogers = rogers;; +*) + +(* Lemma 2.12 [XQBOVQF] *) +(* not formalized *) + +(* Definition 2.12 (circumradius) label{def:etaV} *) +(* found in sphere.hl*) + let radV = radV;; + +(* Definition 2.13 (abc parameter) label{def:abc} *) +(*found in sphere.hl *) + let abc_parameter = abc_param;; + + +(* Lemma 2.13 [JJFHOIW] label{lemma:rog:abc} *) +(* didn't find an actual lemma for this, but I found the equations from the lemma in sphere.hl *) + let JJFHOIW1 = volR;; + let JJFHOIW2 = solR;; + let JJFHOIW3 = dihR;; + let JJFHOIW = "not found";; + + let orthosimplex = define `orthosimplex (v0:real^N) e1 e2 e3 a b c = + let v1 = v0 + a % e1 in + let v2 = v1 + sqrt(b pow 2 - a pow 2) % e2 in + let v3 = v2 + sqrt(c pow 2 - b pow 2) % e3 in + conv0 {v0, v1, v2, v3}`;; + + let JJFHOIW_t = `!v0 e1 e2 e3 a b c. + (orthonormal e1 e2 e3 /\ &0 < a /\ a <= b /\ b <= c) ==> + + (vol(orthosimplex v0 e1 e2 e3 a b c) = volR a b c)/\ + (sol (orthosimplex v0 e1 e2 e3 a b c) v0 = solR a b c) /\ + (dih(orthosimplex v0 e1 e2 e3 a b c) = dihR a b c)`;; + +(* Finiteness and Volume *) + type_of `orthosimplex`;; + type_of `orthonormal`;; + type_of `sol`;; + +let WQZISRI = WQZISRI;; + +let PWVIIOL = PWVIIOL;; + +(* lattice shell *) +let TXIWYHI = TXIWYHI;; + diff --git a/legacy/oldvolume/ch_volume/volume_temp.hl b/legacy/oldvolume/ch_volume/volume_temp.hl new file mode 100644 index 0000000..7a3b57c --- /dev/null +++ b/legacy/oldvolume/ch_volume/volume_temp.hl @@ -0,0 +1,13 @@ +let TXIWYHI=prove( `!(x:real^3)(k1:real)(k2:real). + (&0< k1 /\ &0< k2 ) ==> ?(C:real). !r. ( k2 <= r) ==> + &(CARD (integer_point (ball(x,r+ k1) DIFF ball(x,r- k2))))<= C* r pow 2`, + REPEAT GEN_TAC THEN + SIMP_TAC[eq_def_intball] THEN + STRIP_TAC THEN + DISJ_CASES_TAC(REAL_ARITH `(r:real)< k2+ sqrt(&3) \/ (k2+ sqrt(&3)<= r)`) + + + THENL [ASM_MESON_TAC[bdt7_finiteness];ASM_MESON_TAC[bdt5_finiteness]]);; + +bdt7_finiteness;; +bdt5_finiteness;; diff --git a/legacy/toplevel.ml b/legacy/toplevel.ml new file mode 100644 index 0000000..ab27ba5 --- /dev/null +++ b/legacy/toplevel.ml @@ -0,0 +1,63 @@ +(* The first change for toplevel.ml *) +needs "Multivariate/vectors.ml";; +needs "Examples/floor.ml";; + +prioritize_real();; + +(* B( x, r) *) +let open_ball = new_definition `open_ball (x:real^3) (r:real)= { y | norm(y-x)< r }`;; + +(* Packing Lambda *) +(* packing already defined in sphere.hl +let packing = new_definition `packing (Lambda:real^3 -> bool) = (!x y. ( x IN Lambda) /\ ( y IN Lambda) /\ ~(x = y) ==> norm(x - y) >= &2 )`;; +*) + +(* B( x , r , Lambda) *) +let ball3_lambda = new_definition ` ball3_lambda (x:real^3) (r:real) (Lambda:real^3 -> bool) = ((open_ball x r ) INTER ( UNIONS ( IMAGE (\v. open_ball v (&1) +) Lambda ) ))`;; +(* Delta ( Lambda x r) This definition is not good because I don't know where to load the definition of Vol 3 *) +(* +let delta_finite = new_definition `delta_finite (x:real^3) (r:real) (Lambda:real^3 -> bool) = (( vol 3 ( ball3_lambda x r Lambda) ) / ( vol 3 (open_ball x r )))`;; +*) +(* Lambda x r *) +let truncated_packing = new_definition ` truncated_packing x r Lambda = Lambda INTER (ball3_lambda x r Lambda) `;; + + +(* Beginning of Proving Lemma 7.1 (lemmaseo) that needs Examples/floor.ml; FLOOR_EQ , VECTOR_SUB_COMPONENT_3 theorem and lemmaseoo proved in following *) +(* + g ` packing Lambda ==> FINITE (truncated_packing x r Lambda )`;; +*) + + +let FLOOR_EQ = prove + (`!(x:real) y. floor x = floor y ==> abs(x - y) < &1`, + REPEAT GEN_TAC THEN STRIP_TAC THEN SIMP_TAC[ GSYM REAL_BOUNDS_LT] + THEN MP_TAC(SPEC `x:real` FLOOR_FRAC) THEN STRIP_TAC THEN FIRST_X_ASSUM(SUBST1_TAC) + THEN MP_TAC(SPEC `y:real` FLOOR_FRAC) THEN STRIP_TAC THEN FIRST_X_ASSUM(SUBST1_TAC) + THEN FIRST_X_ASSUM(SUBST1_TAC) THEN REWRITE_TAC[REAL_ARITH `(floor y + frac x) - (floor y + frac y) = frac x - frac y`] + THEN UNDISCH_TAC `&0 <= frac x` THEN UNDISCH_TAC `&0 <= frac y` THEN UNDISCH_TAC `frac x < &1` THEN UNDISCH_TAC `frac y < &1` + THEN REAL_ARITH_TAC );; + +let VECTOR_SUB_COMPONENT_3 = prove + (`!(x:real^3) (y:real^3). x$1 - y$1 = (x - y)$1 /\ x$2 - y$2 = (x - y)$2 /\ x$3 - y$3 = (x - y)$3`, + REPEAT GEN_TAC THEN MP_TAC (ISPECL [`x:real^3`; `y:real^3`; `1`] VECTOR_SUB_COMPONENT) THEN + MP_TAC (ISPECL [`x:real^3`; `y:real^3`; `2`] VECTOR_SUB_COMPONENT) THEN + MP_TAC (ISPECL [`x:real^3`; `y:real^3`; `3`] VECTOR_SUB_COMPONENT) THEN REWRITE_TAC[DIMINDEX_3] THEN ARITH_TAC);; +let lemmaseoo = prove + (`!(p:real^3) x y. (!(v:real^3). f v = ( floor (&2 * (v$1 - p$1)),floor (&2 * (v$2 - p$2)),floor (&2 * (v$3 - p$3)))) /\ norm (x - y) >= &2 ==> ~(f x = f y) `, + REPEAT GEN_TAC THEN ASM_SIMP_TAC[] THEN REWRITE_TAC[PAIR_EQ] THEN REPEAT STRIP_TAC + THEN REPEAT (FIRST_X_ASSUM(MP_TAC o (MATCH_MP FLOOR_EQ))) + THEN REWRITE_TAC[REAL_ARITH `(abs (&2 * (x$1 - p$1) - &2 * (y$1 - p$1)) < &1) <=> abs(x$1 - y$1) < &1/ &2` ] + THEN REWRITE_TAC[REAL_ARITH `(abs (&2 * (x$2 - p$2) - &2 * (y$2 - p$2)) < &1) <=> abs(x$2 - y$2) < &1/ &2` ] + THEN REWRITE_TAC[REAL_ARITH `(abs (&2 * (x$3 - p$3) - &2 * (y$3 - p$3)) < &1) <=> abs(x$3 - y$3) < &1/ &2` ] + THEN REWRITE_TAC[VECTOR_SUB_COMPONENT_3] THEN REPEAT STRIP_TAC THEN MP_TAC (ISPEC `x:real^3 - y` NORM_LE_L1) + THEN REWRITE_TAC[SUM_3;DIMINDEX_3] + THEN UNDISCH_TAC`norm (x:real^3 - y) >= &2` + THEN UNDISCH_TAC`abs ((x:real^3 - y)$1) < &1 / &2` + THEN UNDISCH_TAC`abs ((x:real^3 - y)$2) < &1 / &2` + THEN UNDISCH_TAC`abs ((x:real^3 - y)$3) < &1 / &2` + THEN REAL_ARITH_TAC );; +(* Lemmaseotw + g ` !p. (!v. f v = (floor(&2 * ( v$1 - p$1)), floor(&2 * (v$2 - p$2)), floor(&2 * (v$3 - p$3)))) /\ packing Lambda + ==> INJ f Lambda (int^3) `;; +*) diff --git a/make.ml b/make.ml new file mode 100644 index 0000000..9ba496f --- /dev/null +++ b/make.ml @@ -0,0 +1,4 @@ +load_path := (Unix.getcwd () ^ "/jHOLLight") :: !load_path;; +load_path := (Unix.getcwd () ^ "/text_formalization") :: !load_path;; +loadt "text_formalization/strictbuild.hl";; +build_silent ();; diff --git a/port_interval/compose.hl b/port_interval/compose.hl new file mode 100644 index 0000000..0f41d2f --- /dev/null +++ b/port_interval/compose.hl @@ -0,0 +1,324 @@ +(* definitions by functional composition. + + This file doesn't contain working code yet. + It is a stub to be used later for the automatic generation of + code. + + *) + +(* primitive functions: + unit, x1, x2, x3, x4, x5, x6, etc. + + The point of this file is to set up constants so that they + can be automatically generated from the definitions into + a form that the ocaml interval arithmetic verifier can use. + +*) + +let deriv_data6 = new_definition + `deriv_data6 p f (df1,df2,df3,df4,df5,df6) (x1,x2,x3,x4,x5,x6) <=> + (derived_form p (\x1. f x1 x2 x3 x4 x5 x6) df1 x1 (:real) ) /\ + (derived_form p (\x2. f x1 x2 x3 x4 x5 x6) df2 x2 (:real) ) /\ + (derived_form p (\x3. f x1 x2 x3 x4 x5 x6) df3 x3 (:real) ) /\ + (derived_form p (\x4. f x1 x2 x3 x4 x5 x6) df4 x4 (:real) ) /\ + (derived_form p (\x5. f x1 x2 x3 x4 x5 x6) df5 x5 (:real) ) /\ + (derived_form p (\x6. f x1 x2 x3 x4 x5 x6) df6 x6 (:real) )`;; + +let tf_primitive = +[ +"tf_x1";"tf_x2";"tf_x3";"tf_x4";"tf_x5";"tf_x6";"tf_unit"; +"tf_delta_x";"tf_delta_x4";"tf_sol_x";"tf_dih_x";"tf_rad2_x"; +] + +let tf_compose = new_definition `tf_compose = ( o ):(B->C)->(A->B)->(A->C)`;; + +let tf_plus = new_definition `tf_plus (f) + (g:real->real->real->real->real->real->real) x1 x2 x3 x4 x5 x6 + = f x1 x2 x3 x4 x5 x6 + g x1 x2 x3 x4 x5 x6`;; + +let tf_scale = new_definition `tf_scale + (g:real->real->real->real->real->real->real) t x1 x2 x3 x4 x5 x6 = + (g x1 x2 x3 x4 x5 x6) * t`;; + +let tf_product = new_definition `tf_product f + (g:real->real->real->real->real->real->real) x1 x2 x3 x4 x5 x6 + = f x1 x2 x3 x4 x5 x6 * g x1 x2 x3 x4 x5 x6`;; + +let tf_uni = new_definition `tf_uni + (f:real->real) + (g:real->real->real->real->real->real->real) x1 x2 x3 x4 x5 x6 = + f(g x1 x2 x3 x4 x5 x6)`;; + +let tf_unit = new_definition `(tf_unit: real->real->real->real->real->real->real) + x1 x2 x3 x4 x5 x6 = &1`;; + +let tf_x1 = new_definition `(tf_x1: real->real->real->real->real->real->real) + x1 x2 x3 x4 x5 x6 = x1`;; + +let tf_x2 = new_definition `(tf_x2: real->real->real->real->real->real->real) + x1 x2 x3 x4 x5 x6 = x2`;; + +let tf_x3 = new_definition `(tf_x3: real->real->real->real->real->real->real) + x1 x2 x3 x4 x5 x6 = x3`;; + +let tf_x4 = new_definition `(tf_x4: real->real->real->real->real->real->real) + x1 x2 x3 x4 x5 x6 = x4`;; + +let tf_x5 = new_definition `(tf_x5: real->real->real->real->real->real->real) + x1 x2 x3 x4 x5 x6 = x5`;; + +let tf_x6 = new_definition `(tf_x6: real->real->real->real->real->real->real) + x1 x2 x3 x4 x5 x6 = x6`;; + +let tf_y1 = new_definition `tf_y1 = tf_uni sqrt tf_x1`;; + +let tf_y2 = new_definition `tf_y2 = tf_uni sqrt tf_x2`;; + +let tf_y3 = new_definition `tf_y3 = tf_uni sqrt tf_x3`;; + +let tf_y4 = new_definition `tf_y4 = tf_uni sqrt tf_x4`;; + +let tf_y5 = new_definition `tf_y5 = tf_uni sqrt tf_x5`;; + +let tf_y6 = new_definition `tf_y6 = tf_uni sqrt tf_x6`;; + +let tf_delta_x = new_definition `tf_delta_x = delta_x`;; + +let tf_delta_x4 = new_definition `tf_delta_x4 = delta_x4`;; + +let tf_delta4_squared_x = new_definition `tf_delta4_squared_x = + tf_product tf_delta_x4 tf_delta_x4`;; + +let i_one_twelfth = new_definition `i_one_twelfth = &1 / &12`;; +let i_half = new_definition `i_half = &1 / &2`;; +let i_mone = new_definition `i_mone = -- &1`;; +let i_mhalf = new_definition `i_mhalf = -- &1 / &2`;; +let i_c1 = new_definition `i_c1 = &1 / (h0 - &1)`;; + +let tf_vol_x = new_definition `tf_vol_x = + tf_scale (tf_uni sqrt tf_delta_x) i_one_twelfth`;; + +let tf_sol_x = new_definition `tf_sol_x = sol_x`;; + +let tf_rad2_x = new_definition `tf_rad2_x = rad2_x`;; + +let tf_dih_x = new_definition `tf_dih_x = dih_x`;; + +let tf_dih2_x = new_definition `tf_dih2_x = rotate2 tf_dih_x`;; + +let tf_dih3_x = new_definition `tf_dih3_x = rotate3 tf_dih_x`;; + +let tf_dih4_x = new_definition `tf_dih4_x = rotate4 tf_dih_x`;; + +let tf_dih5_x = new_definition `tf_dih5_x = rotate5 tf_dih_x`;; + +let tf_dih6_x = new_definition `tf_dih6_x = rotate6 tf_dih_x`;; + +let tf_lfun_sqrtx1_div2 = new_definition `tf_lfun_sqrtx1_div2 = + tf_scale ( tf_plus (tf_scale tf_unit h0) (tf_scale tf_y1 i_mhalf)) i_c1`;; + +let tf_ldih_x = new_definition `tf_ldih_x = tf_product + tf_lfun_sqrtx1_div2 tf_dih_x`;; + +let tf_ldih2_x = new_definition `tf_ldih2_x = rotate2 tf_ldih_x`;; + +let tf_ldih3_x = new_definition `tf_ldih3_x = rotate3 tf_ldih_x`;; + +let tf_ldih5_x = new_definition `tf_ldih5_x = rotate5 tf_ldih_x`;; + +let tf_ldih6_x = new_definition `tf_ldih6_x = rotate6 tf_ldih_x`;; + + + +(* + + FINISH: + All of these need to be implemented in the compositional argument-free style. + + Some might no longer be used: num2?, rat1?, rat2?, den2?, monomials? + + Then treat the univariates in the same way.... + + upper_dih, + eulerA_x, + + rhazim,rhazim2,rhazim3, + gchi1_x,gchi2_x,gchi3_x,gchi4_x,gchi5_x,gchi6_x, + x1cube,x1square, + num1,num2,num_combo1, + rat1,rat2,den2, + edge_flat2_x, + edge_flat_x, + flat_term_x, + taum_x, + halfbump_x1, halfbump_x4; + + ////////// + // functions on an upright,flat,or quasiregular: + // circumradius squared of the four faces of a simplex: + // The circumradius squared of the face (ijk) of a simplex is eta2_ijk; + // Miscellaneous functions. + // + static const taylorFunction eta2_126,eta2_135,eta2_234,eta2_456, + vol3_x_sqrt, + vol3f_x_lfun, + vol3f_x_sqrt2_lmplus, + arclength_x_123, + arclength_x_234, + arclength_x_126, + arclength_x_345, + norm2hhx, + asn797k,asnFnhk,lfun_y1, + acs_sqrt_x1_d4, acs_sqrt_x2_d4; + + static const taylorFunction + sol_euler_x_div_sqrtdelta, + sol_euler345_x_div_sqrtdelta, + sol_euler156_x_div_sqrtdelta, + sol_euler246_x_div_sqrtdelta, + dih_x_div_sqrtdelta_posbranch, + dih2_x_div_sqrtdelta_posbranch, + dih3_x_div_sqrtdelta_posbranch, + dih4_x_div_sqrtdelta_posbranch, + dih5_x_div_sqrtdelta_posbranch, + dih6_x_div_sqrtdelta_posbranch, + ldih_x_div_sqrtdelta_posbranch, + ldih2_x_div_sqrtdelta_posbranch, + ldih3_x_div_sqrtdelta_posbranch, + ldih4_x_div_sqrtdelta_posbranch, + ldih5_x_div_sqrtdelta_posbranch, + ldih6_x_div_sqrtdelta_posbranch, + surf_x, + vol3r_126_x, + + dih_x_126_s2, + dih2_x_126_s2, + dih3_x_126_s2, + dih4_x_126_s2, + dih5_x_126_s2, + dih6_x_126_s2, + ldih_x_126_s2, + ldih2_x_126_s2, + ldih6_x_126_s2, + dih_x_135_s2, + dih2_x_135_s2, + dih3_x_135_s2, + dih4_x_135_s2, + dih5_x_135_s2, + dih6_x_135_s2, + ldih_x_135_s2, + ldih3_x_135_s2, + ldih5_x_135_s2, + + delta_x_135_s2, + delta_x_126_s2, + + vol3_x_135_s2, + + gamma3f_x_vLR_lfun, + gamma3f_x_vLR0, + gamma3f_x_vL_lfun, gamma3f_x_vL0, + gamma3f_x_v_lfun, gamma3f_x_v0, + + + // dec 29 , 2010: + + ldih_x_126_n, + ldih2_x_126_n, + ldih6_x_126_n, + ldih_x_135_n, + ldih3_x_135_n, + ldih5_x_135_n, + + gamma3f_126_x_s_n, + gamma3f_135_x_s_n, + gamma3f_vLR_x_nlfun, + gamma3f_vLR_x_n0, + gamma3f_vL_x_nlfun, + gamma3f_vL_x_n0, + + // may 2011: + tau_lowform_x, + tau_residual_x, + delta_y_LC, + euler_3flat_x, + euler_2flat_x, + euler_1flat_x, + taum_3flat_x, + taum_2flat_x, + taum_1flat_x, + delta_pent_x, + + ; + + // construct x1^n1 .. x6^n6; + static const taylorFunction monomial(int,int,int,int,int,int); + + static const taylorFunction taum_x1(const interval&,const interval&); + static const taylorFunction taum_x2(const interval&,const interval&); + static const taylorFunction taum_x1_x2(const interval&); + + static const taylorFunction arclength_x1(const interval&,const interval&); + static const taylorFunction arclength_x2(const interval&,const interval&); + + static const taylorFunction surfR126d(const interval&); + + static const taylorFunction dih_template_B_x(const interval& x15,const interval& x45, + const interval& x34,const interval& x12, + const interval& x25); + + static const taylorFunction delta_template_B_x(const interval& x15,const interval& x45, + const interval& x34,const interval& x12); + + + static const taylorFunction /* taylorSimplex:: */ taum_template_B_x(const interval& x15, + const interval& x45,const interval& x34,const interval& x12 ); + + static const taylorFunction /* taylorSimplex:: */ dih_hexall_x(const interval& x14, const interval& x12, + const interval & x23); + + static const taylorFunction /* taylorSimplex:: */ dih1_hexall_x(const interval& x14, const interval& x12, + const interval & x23); + + + static const taylorFunction /* taylorSimplex:: */ upper_dih_hexall_x(const interval& x14, const interval& x12, + const interval & x23); + + static const taylorFunction /* taylorSimplex:: */ delta_hexall_x(const interval& x14, const interval& x12, + const interval & x23); + + static const taylorFunction /* taylorSimplex:: */ delta4_hexall_x(const interval& x14, const interval& x12, + const interval & x23); + + + static const taylorFunction /* taylorSimplex:: */ taum_hexall_x(const interval& x14, const interval& x12, + const interval & x23); + + static const taylorFunction /* taylorSimplex:: */ eulerA_hexall_x(const interval& x14, const interval& x12, + const interval & x23); + + static const taylorFunction /* taylorSimplex:: */ factor345_hexall_x(const interval& costheta); + + static const taylorFunction /* taylorSimplex:: */ law_cosines_234_x(const interval& costheta); + + static const taylorFunction /* taylorSimplex:: */ law_cosines_126_x(const interval& costheta); + + static const taylorFunction /* taylorSimplex:: */ lindih(const interval& theta); + + static const taylorFunction /* taylorSimplex:: */ delta_126_x(const interval& x3s, const interval& x4s, const interval& x5s); + + static const taylorFunction /* taylorSimplex:: */ delta_234_x(const interval& x1s, const interval& x5s, const interval& x6s); + + static const taylorFunction /* taylorSimplex:: */ delta_135_x(const interval& x2s, const interval& x4s, const interval& x6s); + + static const taylorFunction /* taylorSimplex:: */ taum_sub1_x(const interval& x1s); + + static const taylorFunction /* taylorSimplex:: */ delta_sub1_x(const interval& x1s); + + static const taylorFunction /* taylorSimplex:: */ taum_sub246_x(const interval& x2s,const interval& x4s,const interval& x6s); + + static const taylorFunction /* taylorSimplex:: */ taum_sub345_x(const interval& x3s,const interval& x4s,const interval& x5s); + + +}; +*) diff --git a/port_interval/function_data.hl b/port_interval/function_data.hl new file mode 100644 index 0000000..164cd4d --- /dev/null +++ b/port_interval/function_data.hl @@ -0,0 +1,100 @@ +(* file combining all the function data *) + +(* + +This gives the verification of a sample inequality drawn from ineq.hl. + +*) + + +flyspeck_needs "../port_interval/types.hl";; +flyspeck_needs "../port_interval/report.hl";; +flyspeck_needs "../port_interval/interval.hl";; +flyspeck_needs "../port_interval/univariate.hl";; +flyspeck_needs "../port_interval/line_interval.hl";; +flyspeck_needs "../port_interval/taylor.hl";; +flyspeck_needs "../port_interval/recurse.hl";; + +module Function_data = struct + +open Interval;; +open Univariate;; +open Line_interval;; +open Taylor;; +open Recurse;; + + +(* This was found in recurse.cc, but doesn't belong there. *) + +let deltainf = + let ( * ) = downmul in + let ( + ) = downadd in + let ( - ) = downsub in + let ( ~- ) = ( ~-. ) in + fun x1 x2 x3 x4 x5 x6 -> + (down(); + ((~- x2)*x3)*x4 +((~- x1)*x3)*x5 +((~- x1)*x2)*x6 +((~- x4)*x5)*x6 + + x3*(x1 + x2 + x4 + x5)*x6 + (x3*(~- x3- x6))*x6 + + x2*x5*(x1 + x3 + x4 + x6) + x2*(x5*(~- x2-x5)) + + x1*x4*(x2 + x3 + x5 + x6)+ x1*(x4*(~- x1-x4)));; + + +let tupl x = let n = List.nth x in (n 0,n 1,n 2,n 3,n 4,n 5);; + +let delta_x4L = + fun x -> + let (x1,x2,x3,x4,x5,x6) = tupl x in + let ( + ),( * ) = up(); (upadd,upmul) in + let fhi,tdhi= + ( (~-. x2)*x3 +(~-. x1)*x4 + x2*x5 + x3*x6 +(~-. x5)*x6 + + x1*(~-. x1) + x1*(~-. x4) + x1*(x2 + x3 + x5 + x6), + [ (~-. 2.0)* x1 + x2 + x3 + (~-. 2.0)* x4 + x5 + x6; + x1 + (~-. 1.0) * x3 + x5; + x1 + (~-. 1.0) * x2 + x6; + (~-. 2.0) * x1; + x1 + x2 + (~-. 1.0) * x6; + x1 + x3 + (~-. 1.0)* x5;]) in + let ( + ),( * ) = down(); (downadd,downmul) in + let flo,tdlo = + (~-. x2)*x3 +(~-. x1)*x4 + x2*x5 + x3*x6 +(~-. x5)*x6 + + x1*(~-. x1) + x1*(~-. x4) + x1*(x2 + x3 + x5 + x6), + [ (~-. 2.0)* x1 + x2 + x3 + (~-. 2.0)* x4 + x5 + x6; + x1 + (~-. 1.0) * x3 + x5; + x1 + (~-. 1.0) * x2 + x6; + (~-. 2.0) * x1; + x1 + x2 + (~-. 1.0) * x6; + x1 + x3 + (~-. 1.0)* x5;] in + mk_line (mk_interval(flo,fhi),map (fun (x,y)->mk_interval(x,y)) (zip tdlo tdhi));; + +let delta_x4DD = + let m i = let r = float_of_int i in mk_interval(r,r) in + let intdata = [[-2; 1; 1; -2; 1; 1]; [1; 0; -1; 0; 1; 0]; [1; -1; 0; 0; 0; 1]; + [-2; 0; 0; 0; 0; 0]; [1; 1; 0; 0; 0; -1]; [1; 0; 1; 0; -1; 0]] in + table2 (fun i j -> m (mth2 intdata i j));; + +let delta_x4 = Prim_a (make_primitiveA ( delta_x4L, (fun x z -> delta_x4DD)));; + +(* sample based on ineq.hl "JNTEFVP 1"; *) + +let sample = + let xx = [4.0;4.0;4.0;4.0;4.0;8.0] in + let zz = let h02 = 6.3504 in [h02;h02;h02;h02;h02;25.4016] in + let mone = mk_interval(-1.0,-1.0) in + let mdelta_x4 = Scale(delta_x4,mone) in + let testmaxat = 6.02525 in + let ff = Plus(mdelta_x4,Scale(unit,mk_interval(testmaxat,testmaxat))) in + let truemaxat = 6.02525951999999165 in + let opt = { + only_check_deriv1_negative = false; + is_using_dihmax =false; + is_using_bigface126 =false; + width_cutoff =0.05; + allow_sharp =false; + allow_derivatives =true; + iteration_count =0; + iteration_limit =0; + recursion_depth =200; + } in + recursive_verifier(0,xx,zz,xx,zz,[ff],opt);; + +end;; diff --git a/port_interval/interval.hl b/port_interval/interval.hl new file mode 100644 index 0000000..31a63ee --- /dev/null +++ b/port_interval/interval.hl @@ -0,0 +1,161 @@ + +(* port of interval.hl, + +This file gives a simple implementation of interval arithmetic, +together with the basic arithmetic operations on intervals. + +It has been incompletely implemented. + +For now, I am not implementing directed roundings. +However, McLaughlin implemented directed rounding several years ago: +See http://perso.ens-lyon.fr/nathalie.revol/mpfi.html + ~/Library/McLaughlinOCAML/ocaml/src/extensions/ocaml-mpfi/ + + *) + +module Interval =struct + + +let mk_interval (a,b) = { lo = a; hi = b; };; + +let string_of_interval x = Printf.sprintf "[%f;%f]" x.lo x.hi;; + +(* let izero = mk_interval(0.0,0.0);; *) +let zero = mk_interval(0.0,0.0);; +let one = mk_interval(1.0,1.0);; +let two = mk_interval(2.0,2.0);; +let four = mk_interval(4.0,4.0);; + +let is_zero x =(x.lo=0.0)&&(x.hi=0.0);; + +let pos x = if (x.lo >= 0.0) then x else + mk_interval(0.0, if (x.hi < 0.0) then 0.0 else x.hi );; + +let imax (x,y) = let t=max x.hi y.hi in mk_interval(t,t);; + +let imin (x,y) = let t = min x.lo y.lo in mk_interval(t,t);; + +let imin3(x,y,z) = imin(x,imin(y,z));; + +let imax3(x,y,z) = imax(x,imax(y,z));; + +let imax4(w,x,y,z) = imax(imax(w,x),imax(y,z));; + +let sup x = x.hi;; + +let inf x = x.lo;; + +let iabs x = max x.hi (~-. (x.lo));; + +let ilt x y = (x.hi < y.lo);; + +let igt x y = (x.lo > y.hi);; + +let ieq x y = (x.lo = y.lo && x.hi = y.hi);; + +(* need rounding modes -- BUG *) + + +(* start of bug section *) + +let up() = ( (* bug *) );; +let down() = ( (* bug *) );; +let nearest() = ( (* bug *) );; +let upadd x y = ( x +. y);; (* bug *) +let upmul x y = (x *. y);; +let updiv x y = (x /. y);; +let upsub x y = (x -. y);; +let downadd x y = (x +. y);; +let downmul x y = (x *. y);; +let downdiv x y = (x /. y);; +let downsub x y = (x -. y);; + +(* end of bug section *) + +let interval_of_string = + let dbl_min =1.0e-300 in + fun (s1,s2) -> + let ( - ) = (down(); downsub) in + let lo = float_of_string s1 - dbl_min in + let ( + ) = (up(); upadd) in + let hi = float_of_string s2 + dbl_min in + mk_interval(lo,hi);; + +let interval_of_single s = interval_of_string (s,s);; + +let ineg x = mk_interval(~-. (x.hi), ~-. (x.lo));; + +let iadd x y = mk_interval((down(); downadd x.lo y.lo), (up(); upadd x.hi y.hi));; + +let slowcases x y = + if (x.lo >= 0.0) then + (if (y.lo >= 0.0) then (x.lo,y.lo,x.hi,y.hi) + else if (y.hi <= 0.0) then (x.hi,y.lo,x.lo,y.hi ) else (x.hi,y.lo,x.hi,y.hi)) + else if (x.hi <= 0.0) then + (if (y.hi <= 0.0) then (x.hi,y.hi,x.lo,y.lo) + else if (y.lo >= 0.0) then (x.lo,y.hi,x.hi,y.lo) else (x.lo,y.hi,x.lo,y.lo)) + else + (if (y.lo >=0.0) then (x.lo,y.hi,x.hi,y.hi) + else if (y.hi <=0.0) then (x.hi,y.lo,x.lo,y.lo) + else (let lo = (down(); min (downmul x.hi y.lo) (downmul x.lo y.hi)) in + let hi = (up(); max (upmul x.hi y.hi) (upmul x.lo y.lo)) in (lo,1.0,hi,1.0)));; + +let slowmul x y = + let (xlo,ylo,xhi,yhi) = slowcases x y in + mk_interval((down(); downmul xlo ylo),(up(); upmul xhi yhi));; + +let _ = + let test_slowmul x y = + let all = [x.lo *. y.lo; x.hi *. y.lo; x.lo *. y.hi; x.hi *. y.hi] in + let m = end_itlist min all in + let M = end_itlist max all in + ( mk_interval(m,M) = slowmul x y) in + let xs = map mk_interval [(~-. 7.0, ~-. 5.0);(~-. 3.0,9.0);(11.0,13.0)] in + let ys = map mk_interval [(~-. 16.0, ~-. 14.0);(~-. 10.0,12.0); (18.0,22.0)] in + let test i j = test_slowmul (List.nth xs i) (List.nth ys j) or + failwith (Printf.sprintf "%d %d" i j) in + for i=0 to 2 do + for j= 0 to 2 do + let _ = test i j in (); + done; done;; + +let imul x y = if (x.lo > 0.0 && y.lo > 0.0) then + mk_interval((down(); downmul x.lo y.lo, (up(); upmul x.hi y.hi))) else slowmul x y;; + +let isub x y = mk_interval((down();downsub x.lo y.hi),(up(); upsub x.hi y.lo));; + +let isqrt = + let sqrt = Pervasives.sqrt in + fun x -> mk_interval( + (if (x.lo <= 0.0) then 0.0 else (down(); sqrt(x.lo))), + (if (x.hi <= 0.0) then 0.0 else (up(); sqrt(x.hi))));; + +let iatan x = + let _ = nearest() in + mk_interval((down(); atan x.lo),(up(); atan x.hi));; + +let combine x y = mk_interval(inf(imin(x,y)),sup(imax(x,y)));; + +let rand01 = + let random_int_seed = 81757 in + let _ = Random.init(random_int_seed) in + fun _ -> Random.float(1.0);; + +let bounded_from_zero = + let dbl_epsilon = 1.0e-8 in + fun x-> (x.hi < ~-. dbl_epsilon or x.lo > dbl_epsilon);; + +let idiv x y = if (bounded_from_zero y) then + imul x (mk_interval((down(); downdiv 1.0 y.hi),(up(); updiv 1.0 y.lo))) + else raise Unstable;; + +(* overload arithmetic ops *) + +(* +let (+) = iadd;; +let (-) = isub;; +let (/) = idiv;; +let (~-) = ineg;; +*) + +end;; diff --git a/port_interval/line_interval.hl b/port_interval/line_interval.hl new file mode 100644 index 0000000..d18b87b --- /dev/null +++ b/port_interval/line_interval.hl @@ -0,0 +1,107 @@ +(* port of lineInterval.cc. + Only the top section has been translated. The rest should be + automatically generated from HOL Light specs. + + This impements basic operations on the type line, + such as addition and scalar multiplication. + + *) + +flyspeck_needs "../port_interval/interval.hl";; + +module Line_interval = struct + + open List;; + open Interval;; + + +(* general utilities *) + let iter6 = 0--5;; + + let table f = map f iter6;; + + let table2 f = map (fun i -> map (fun j-> f i j) iter6) iter6;; + + let rth m x i = if (i >=0) && (i < m) then List.nth x i else + failwith (Printf.sprintf "index %d not in 0..%d" i (m-1));; + + let mth x i = if (i >=0) && (i < 6) then List.nth x i else + failwith (Printf.sprintf "index %d not in 0..6" i );; + + let mth2 a i j = mth (mth a i) j;; + + let maxl xs = end_itlist max xs;; + + let minl xs = end_itlist min xs;; + +(* line interval proper *) + +let partial line i = mth line.df i ;; + +let mk_line(f1,df1) = { f = f1; df =df1};; + +let line_zero = + let z = zero in + mk_line(z,replicate z 6);; + +let line_unit = + mk_line(one,replicate zero 6);; + +let lmul = + let ( * ) = imul in + let ( + ) = iadd in + fun a b -> mk_line ( a.f * b.f, map (fun i -> a.f * mth b.df i + b.f * mth a.df i) iter6);; + +let smul = + let ( * ) = imul in + fun a b -> mk_line ( a.f * b, map (fun x -> x * b) a.df);; + +let ldiv = + let one = mk_interval(1.0,1.0) in + let ( * ) = imul in + let ( - ) = isub in + let ( / ) = idiv in + fun b a -> + let r = one/a.f in + let f = b.f * r in + let r2 = r * r in + mk_line ( f, map (fun i -> ((mth b.df i) * a.f - (mth a.df i) * b.f)* r2) iter6);; + +let ladd = + let ( + ) = iadd in + fun b a -> + mk_line(b.f + a.f, map (fun i -> mth b.df i + mth a.df i) iter6);; + +let lsub = + let ( - ) = isub in + fun b a -> + mk_line(b.f - a.f, map (fun i -> mth b.df i - mth a.df i) iter6);; + +let lneg = + let ineg = ineg in + fun a -> + mk_line(ineg a.f, map ineg a.df);; + +let lsqrt = + let one = mk_interval(1.0,1.0) in + let two = mk_interval(2.0,2.0) in + let ( * ) = imul in + let ( / ) = idiv in + fun a -> + let f = isqrt a.f in + let rs = one / (two * f) in + mk_line(f, map (fun i -> mth a.df i * rs) iter6);; + +let latan = (* arctan (a/b) *) + let one = mk_interval(1.0,1.0) in + let ( * ) = imul in + let ( + ) = iadd in + let ( - ) = isub in + let ( / ) = idiv in + fun a b -> + let f = iatan (a.f/b.f) in + let rden = one/ (a.f * a.f + b.f * b.f) in + mk_line(f, map (fun i -> rden * (mth a.df i * b.f - mth b.df i * a.f)) iter6);; + + + end;; diff --git a/port_interval/recurse.hl b/port_interval/recurse.hl new file mode 100644 index 0000000..29715e2 --- /dev/null +++ b/port_interval/recurse.hl @@ -0,0 +1,274 @@ +(* port of recurse.cc *) + +(* +This is the code that verifies a disjunct of nonlinear inequalities. +The are given as a list (tf:tfunction list). If tf = [f1;....;fk], then +the list represents the inequality (f1 < 0 \/ f2 < 0 .... fk < 0). + +The end user should only need to define a cell option, +and then call recursive_verifier, which recursively bisects the domain +until a partition of the domain is found on which verifier_cell gives +a pass on each piece of the partition. + +*) + +flyspeck_needs "../port_interval/types.hl";; +flyspeck_needs "../port_interval/report.hl";; +flyspeck_needs "../port_interval/interval.hl";; +flyspeck_needs "../port_interval/univariate.hl";; +flyspeck_needs "../port_interval/line_interval.hl";; +flyspeck_needs "../port_interval/taylor.hl";; + +module Recurse = struct + +open Interval;; +open Univariate;; +open Line_interval;; +open Taylor;; + +type cellOption = { + only_check_deriv1_negative : bool; + is_using_dihmax : bool; + is_using_bigface126 : bool; + width_cutoff : float; + allow_sharp : bool; + allow_derivatives : bool; + mutable iteration_count : int; + iteration_limit : int; + recursion_depth : int; +};; + +(* cell verification is complex, and we use exceptions to + exit as soon as the status has been determined. *) + +type cell_status = + | Cell_pass + | Cell_counterexample + | Cell_inconclusive of (float list * float list * float list * float list * tfunction list);; + +exception Return of cell_status;; + +let return c = raise (Return c);; + + +(* error checking and reporting functions *) + +let string_of_domain x = + let n = mth in + Printf.sprintf "{%f, %f, %f, %f, %f, %f}" (n x 0) (n x 1) (n x 2) (n x 3) (n x 4) (n x 5);; + +let string3 (x,z,s) = (string_of_domain x ^"\n"^ string_of_domain z ^ "\n" ^ s);; + +let boolify _ = true;; + +let report_current = boolify o Report.report_timed o string3;; + +let report_error = boolify o Report.report_error o string3;; + +let report_fatal = boolify o Report.report_fatal o string3;; + +(* let t = [0.1;0.2;0.3;0.4;0.5;0.6] in report_error (t,t,"ok");; *) + +let periodic_count = + let end_count = ref 0 in + fun () -> + let _ = end_count := !end_count + 1 in + (0 = ( !end_count mod 80000));; + +let check_limit opt depth = + let _ = opt.iteration_count <- opt.iteration_count + 1 in + ( opt.iteration_count < opt.iteration_limit or opt.iteration_limit = 0 ) && + (depth < opt.recursion_depth);; + +let sgn x = if (x.lo > 0.0) then 1 else if (x.hi < 0.0) then -1 else 0;; + +let rec same_sgn x y = (x = []) or (sgn (hd x) = sgn (hd y) && same_sgn (tl x) (tl y));; + + +(* a bit tricky because unstable exceptions are common early on, + and evaluations are very expensive. + We don't want a single unstable disjunct to ruin everything. + + When boxes are small, then we throw away unstable disjuncts and continue w/o them. + When the boxes are still big, we return inconclusive to force a bisection. + + Starting with this procedure, we can throw an exception to return early, + as soon as we are able to determine the cell_status. All these exceptions + get caught at the last line of verify_cell. +*) + +let rec set_targets (x,z,x0,z0,tf,tis,opt,maxwidth,has_unstable) = + try ( + if (tf = []) then + let _ = not(has_unstable) or return (Cell_inconclusive (x,z,x0,z0,map snd tis)) in + List.rev tis + else ( + let target = evalf (hd tf) x z in + + let _ = not( opt.only_check_deriv1_negative) or return + (if upper_partial target 0 < 0.0 then Cell_pass + else if lower_partial target 0 > 0.0 then Cell_counterexample + else Cell_inconclusive(x,z,x0,z0,tf)) in + + let _ = upper_bound target >= 0.0 or return Cell_pass in + + set_targets(x,z,x0,z0,tl tf,(target,hd tf)::tis,opt,maxwidth,has_unstable)); + ) + with Unstable -> ( + if (2.0 *. maxwidth > opt.width_cutoff) + then set_targets(x,z,x0,z0,tl tf,tis,opt,maxwidth,true) (* proclaim unstable *) + else set_targets(x,z,x0,z0,tl tf,tis,opt,maxwidth,has_unstable) (* drop silently *); + ); +;; + +let rec delete_false acc tis = + if (tis=[]) then List.rev acc + else if (lower_bound (fst (hd tis)) > 0.0) then delete_false acc (tl tis) + else delete_false (hd tis::acc) (tl tis);; + +(* If the function is monotone, then we can push the calculation to the boundary. + There is a theorem that justifies the return Cell_pass steps. Here's a sketch. + We are doing a verification on a large box x0 z0 and + x z represents on of many cells in the box. + Suppose that there is a counterexample in the large box x0 z0. + The set of c/e is a compact set. + Write the inequalities as f1 < 0 \/ ... \/ fk < 0. + So at a c/e all f1 >= 0 && ... && fk >=0. + Pick out a particular counterexample by maximizing f1+...+fk over the + set of c/e's, then among this set pick a c/e with largest y1 coordinate, + then lexicographically continuing until the largest y6 coordinate. + This fixes a particular point y in the domain x0 z0. + + I claim that has_monotone will detect y, so that if the inequality is false, + we find out about it. + + In the partition of x0 z0 (of which x z is one rectangle), pick the rectangle + containing y + whose lower endpoint x1 is as large as possible, then continue lexicographically + through to x6. + + I claim that has_monotone will detect y, when it comes to this box x z. + This is clear by construction. If we have monotonic increasing, then y is at the + right edge of the box. By construction the box x z is the rightmost containing y + so the box x z meets the right edge of the large containing box x0 z0. + Thus, it is enough to recursively search over the right edge of the box. Etc. + + *) + +let rec has_monotone tis x z x0 z0 is found = match is with + | [] -> (x,z,x0,z0,found) + | j::js when (mth x j >= mth z j) -> + has_monotone tis x z x0 z0 js found + | j::js -> + let allpos = List.fold_left (fun a ti -> a && lower_partial (fst ti) j >= 0.0) true tis in + let allneg = List.fold_left (fun a ti -> a && upper_partial (fst ti) j < 0.0) true tis in + if (allpos) then + let _ = (mth z j >= mth z0 j) or return Cell_pass in + let setj u = table (fun i -> (if i=j then mth z j else mth u i)) in + has_monotone tis (setj x) (setj z) (setj x0) (setj z0) js true + else if (allneg) then + let _ = (mth x j <= mth x0 j) or return Cell_pass in + let setj u = table (fun i -> (if i=j then mth x j else mth u i)) in + has_monotone tis (setj x) (setj z) (setj x0) (setj z0) js true + else has_monotone tis x z x0 z0 js found;; + +(* loop as long as monotonicity keeps making progress. *) + +let rec going_strong(x,z,x0,z0,tf,opt) = + let (y,w) = center_form (x,z) in + let maxwidth = maxl w in + let tis = set_targets(x,z,x0,z0,tf,[],opt,maxwidth,false) in + let epsilon_width = 1.0e-8 in + let _ = (maxwidth >= epsilon_width) or return + (if (opt.allow_sharp) then (Report.inc_corner_count(); Cell_pass) + else Cell_counterexample) in + let tis = delete_false [] tis in + let _ = (List.length tis > 0) or return Cell_counterexample in + let (x0,z0) = if (List.length tis < List.length tf) then (x,z) else (x0,z0) in + let (x,z,x0,z0,strong) = + if (opt.allow_derivatives) then has_monotone tis x z x0 z0 iter6 false + else (x,z,x0,z0,false) in + if (strong) then going_strong(x,z,x0,z0,map snd tis,opt) else (x,z,x0,z0,maxwidth,tis);; + +let guess_optimal_corners (x,z,ti,tf) = + let mixedsign = List.fold_left (fun a i -> a or (sgn(mth ti.l.df i)=0)) false iter6 in + let yyn = table (fun i-> mth (if sgn (mth ti.l.df i) >0 then x else z) i) in + let yyu = table (fun i-> mth (if sgn (mth ti.l.df i) >0 then z else x) i) in + let cn = line_estimate tf yyn in + let cu = line_estimate tf yyu in + (mixedsign,yyn,yyu,cn,cu);; + +let rec drop_numerically_false acc (x,z,x0,z0,tis) = + match tis with + | [] -> (x0,z0,List.rev tis) + | (ti,tf) :: tiss -> + if (ti.l.f.lo <= 0.0) then drop_numerically_false ((ti,tf)::acc) (x,z,x0,z0,tiss) + else + let (mixedsign,yyn,yyu,cn,cu)= guess_optimal_corners(x,z,ti,tf) in + if (mixedsign) then drop_numerically_false ((ti,tf)::acc) (x,z,x0,z0,tiss) + else if (min cn.f.lo cu.f.lo > 0.0 && + same_sgn ti.l.df cn.df && same_sgn ti.l.df cu.df) + then drop_numerically_false acc (x,z,x,z,tiss) + else drop_numerically_false ((ti,tf)::acc) (x,z,x0,z0,tiss);; + +let rec keep_numerically_true best (x,z,x0,z0,tis,evalue) = match tis with + | [] -> + if (evalue < 0.0 && List.length best >0) then (x,z,best) + else (x0,z0,tis) + | (ti,tf)::tiss -> + if (ti.l.f.hi > 0.0) then keep_numerically_true best (x,z,x0,z0,tiss,evalue) + else + let (mixedsign,yyn,yyu,cn,cu) = guess_optimal_corners(x,z,ti,tf) in + let evalue' = max cn.f.hi cu.f.hi in + if ((evalue' < evalue) && + same_sgn ti.l.df cn.df && same_sgn ti.l.df cu.df && not(mixedsign)) then + keep_numerically_true [(ti,tf)] (x,z,x0,z0,tiss,evalue') + else keep_numerically_true best (x,z,x0,z0,tiss,evalue);; + +(* +This procedure is mostly guided by heuristics that don't require formal +verification. In particular, no justification is required for tossing out inequalities +(since they appear as disjuncts, we can choose which one to prove). + +Formal verification is required whenever a Cell_passes is issued, +and whenever the domain (x,z) is restricted. + +The record (x0,z0) of the current outer boundary must be restricted to (x,z) +whenever an inequality is tossed out. +*) + +let rec verify_cell (x,z,x0,z0,tf,opt) = + try ( + let _ = not(periodic_count ()) or report_current (x,z,"periodic report") in + let _ = not(opt.only_check_deriv1_negative) or (List.length tf <= 1) or + failwith "verify_cell: incompatible options" in + (* XX skip the implementation of rad2, delta126, delta135, for now. *) + let (x,z,x0,z0,maxwidth,tis) = going_strong(x,z,x0,z0,tf,opt) in + let (x0,z0,tis) = if (maxwidth < opt.width_cutoff && opt.allow_derivatives) + then drop_numerically_false [] (x,z,x0,z0,tis) else (x0,z0,tis) in + let _ = (List.length tis >0) or return Cell_counterexample in + let (x0,z0,tis) = + if ((maxwidth1) && opt.allow_derivatives) + then keep_numerically_true [] (x,z,x0,z0,tis,0.0) else (x0,z0,tis) in + Cell_inconclusive (x,z,x0,z0,map snd tis); + ) + with Return c -> c;; + +let rec recursive_verifier (depth,x,z,x0,z0,tf,opt) = + let _ = check_limit opt depth or report_fatal(x,z,Printf.sprintf "depth %d" depth) in + match verify_cell(x,z,x0,z0,tf,opt) with + | Cell_counterexample -> false + | Cell_pass -> true + | Cell_inconclusive(x,z,x0,z0,tf) -> + (let ( ++ ), ( / ) = up(); upadd, updiv in + let w2 = List.map2 upsub z x in + let maxwidth2 = maxl w2 in + let j_wide = try( find (fun i -> mth w2 i = maxwidth2) iter6) with + | _ -> failwith "recursive_verifier find" in + let yj = (mth x j_wide ++ mth z j_wide) / 2.0 in + let delta b v =table (fun i-> if (i=j_wide && b) then yj else mth v i) in + recursive_verifier(depth+1, delta false x ,delta true z ,x0,z0,tf,opt) && + recursive_verifier(depth+1, delta true x ,delta false z ,x0,z0,tf,opt));; + + + end;; diff --git a/port_interval/report.hl b/port_interval/report.hl new file mode 100644 index 0000000..a4776bc --- /dev/null +++ b/port_interval/report.hl @@ -0,0 +1,40 @@ +(* port of error.cc + basic procedures to print messages to the standard output + and to count errors. + +*) + +module Report = struct + +let time_string () = Printf.sprintf "time(%.0f)" (Sys.time());; + +let (get_error_count,reset_error_count,inc_error_count) = + let error_count = ref 0 in + ((fun _ -> !error_count),(fun _ -> error_count := 0), + (fun _ -> error_count:= !error_count + 1));; + +let (get_corner_count,reset_corner_count,inc_corner_count) = + let corner_count = ref 0 in + ((fun _ -> !corner_count),(fun _ -> corner_count := 0), + (fun _ -> corner_count:= !corner_count + 1));; + +let diagnostic_string () = + let d = get_error_count() in + if (d>0) then Printf.sprintf "(errors %d)" (get_error_count()) else "(no errors)";; + +let report s = + Format.print_string s; Format.print_newline(); Format.print_flush();; + +let report_timed s = report (s^" "^(time_string()));; + +let report_error = + let error_max = 25 in (* was 200, recurse.cc had a separate counter limit at 25 *) + fun s -> + let ec = get_error_count() in + (inc_error_count(); report_timed (Printf.sprintf "error(%d) --\n%s" ec s); + Pervasives.ignore(get_error_count() < error_max or raise Fatal));; + +let report_fatal s = + ( inc_error_count(); report_timed ("error --\n"^s); raise Fatal);; + +end;; diff --git a/port_interval/taylor.hl b/port_interval/taylor.hl new file mode 100644 index 0000000..4b6193b --- /dev/null +++ b/port_interval/taylor.hl @@ -0,0 +1,286 @@ +(* port of taylor functions, taylor interval *) + +(* +The first part of the file implements basic operations on type taylor_interval. + +Then a type tfunction is defined that represents a twice continuously +differentiable function of six variables. It can be evaluated, which +is the taylor_interval data associated with it. + +Sometimes a tfunction f is used to represent an inequality f < 0. +(See recurse.hl. +*) + + +module Taylor = struct + +open Interval;; +open Univariate;; +open Line_interval;; + + +(* general utilities *) + + +let m6_sum = + let ( + ) = iadd in + fun dd1 dd2 -> + let r6_sum (x,y) = table (fun i -> mth x i + mth y i) in + map r6_sum (zip dd1 dd2);; + +let center_form(x,z) = + let ( + ) , ( - ), ( / ) = up(); upadd,upsub,updiv in + let y = table (fun i -> if (mth x i=mth z i) then mth x i else (mth x i + mth z i)/ 2.0) in + let w = table (fun i -> max (mth z i - mth y i) (mth y i - mth x i)) in + let _ = (minl w >= 0.0) or failwith "centerform" in + (y,w);; + +(* start with taylor interval operations *) + +let make_taylor_interval (l1,w1,dd1) = {l = l1; w = w1; dd=dd1;};; + +let ti_add (ti1,ti2) = + let _ = (ti1.w = ti2.w) or failwith ("width mismatch in ti") in + make_taylor_interval( ladd ti1.l ti2.l,ti1.w, m6_sum ti1.dd ti2.dd);; + +let ti_scale (ti,t) = + make_taylor_interval( smul ti.l t,ti.w, table2 (fun i j -> imul (mth2 ti.dd i j) t));; + +let taylor_error ti = + let ( + ), ( * ) , ( / )= up(); upadd, upmul, updiv in + let dot_abs_row r = List.fold_left2 (fun a b c -> a + b * iabs c) 0.0 ti.w r in + let dots = map dot_abs_row (ti.dd) in + (List.fold_left2 (fun a b c -> a + b * c) 0.0 ti.w dots) / 2.0;; +(* (end_itlist ( + ) p) / 2.0 ;; *) + +let upper_bound ti = + let e = taylor_error ti in + let ( + ), ( * ) = up(); upadd, upmul in + let t = ti.l.f.hi + e in + t + List.fold_left2 (fun a b c -> a + b * iabs c) 0.0 ti.w ti.l.df;; + +let lower_bound ti = + let e = taylor_error ti in + let ( + ), ( * ),(- ) = down(); downadd,downmul,downsub in + let t = ti.l.f.lo - e in + t + List.fold_left2 (fun a b c -> a + ( ~-. b) * iabs c) 0.0 ti.w ti.l.df;; + +let upper_partial ti i = + let ( + ), ( * ) = up(); upadd,upmul in + let err = List.fold_left2 (fun a b c -> a + b*(max c.hi (~-. (c.lo)))) + 0.0 ti.w (mth ti.dd i) in + err + Interval.sup ( mth ti.l.df i);; + +let lower_partial ti i = + let ( + ), ( * ), ( - ) = down();downadd,downmul,downsub in + let err = List.fold_left2 (fun a b c -> a + b * min c.lo (~-. (c.hi))) + 0.0 ti.w (mth ti.dd i) in + Interval.inf ( mth ti.l.df i) + err;; + + +(* primitive A *) + +type primitiveA = { + hfn : float list -> line; + second : float list -> float list -> interval list list; +};; + +let make_primitiveA (h1,s1) = {hfn = h1; second = s1; };; + +let unitA = + let zero2 = table2 (fun i j -> zero) in + make_primitiveA ( + (fun y -> line_unit), + (fun x z -> zero2) +);; + +let evalf4A pA w x y z = + make_taylor_interval( + pA.hfn y, + w, + pA.second x z + );; + +let line_estimateA pA y = pA.hfn y;; + +(* primitive U *) + +type primitiveU = { + slot: int; + uv: univariate; +};; + +let mk_primitiveU s1 uv1 = + let _ = (s1 < 6) or failwith (Printf.sprintf "slot %d" s1) in + { slot = s1; uv = uv1; };; + +let line_estimateU p y = + let y0 = mth y p.slot in + let t = mk_interval(y0,y0) in + let d = table (fun i -> if (i=p.slot) then eval p.uv t 1 else zero) in + mk_line ( eval p.uv t 0, d );; + +let evalf4U = + let row0 = table (fun i -> zero) in + fun p w x y z -> + let t = mk_interval(mth x p.slot,mth z p.slot) in + let row_slot = table (fun i -> if (i=p.slot) then eval p.uv t 2 else zero) in + let dd = table (fun i -> if (i=p.slot) then row_slot else row0) in + make_taylor_interval( + line_estimateU p y, + w, + dd + );; + +type tfunction = + | Prim_a of primitiveA + | Uni of primitiveU + | Plus of tfunction * tfunction + | Scale of tfunction * interval + | Uni_compose of univariate * tfunction + | Composite of tfunction * (* F(g1,g2,g3,g4,g5,g6) *) + tfunction *tfunction *tfunction * + tfunction *tfunction *tfunction ;; + +let unit = Prim_a unitA;; + +let x1 = Uni (mk_primitiveU 0 ux1);; +let x2 = Uni (mk_primitiveU 1 ux1);; +let x3 = Uni (mk_primitiveU 2 ux1);; +let x4 = Uni (mk_primitiveU 3 ux1);; +let x5 = Uni (mk_primitiveU 4 ux1);; +let x6 = Uni (mk_primitiveU 5 ux1);; + +let x1x2 = + let tab2 = table2 (fun i j -> if (i+j=1) then one else zero) in + Prim_a (make_primitiveA( + (fun y -> + let u1 = mth y 0 in + let u2 = mth y 1 in + let x1 = mk_interval(u1,u1) in + let x2 = mk_interval(u2,u2) in + mk_line( + imul x1 x2, + table (fun i -> if i=0 then x2 else if i=1 then x1 else zero) + )), + (fun x z -> tab2)));; + +let rotate2 f = Composite(f,x2,x3,x1,x5,x6,x4);; +let rotate3 f = Composite(f,x3,x1,x2,x6,x4,x5);; +let rotate4 f = Composite(f,x4,x2,x6,x1,x5,x3);; +let rotate5 f = Composite(f,x5,x3,x4,x2,x6,x1);; +let rotate6 f = Composite(f,x6,x1,x5,x3,x4,x2);; + +let tf_product tf1 tf2 = Composite(x1x2,tf1,tf2,unit,unit,unit,unit);; + + +(* This is one of the most difficult functions in the interval code. + It uses the chain rule to compute the second partial derivatives with + respect to x(i) x(j), of a function composition + + F(x1,...,x6) = f(g1(x1,...x6),g2(x1,...x6),...,g6(x1,...x6)). + + (F i j) = sum {k m} (f k m) (gk i) (gm j) + sum {r} (f r) (gr i j). + + Fast performance of this function is very important, especially + when many of the functions g* are constant. + There is a bit of imperative programming here, in computing the sums. + + Note that ( + ) and ( * ) have different types in various subsections. +*) + +let eval_composite = + let rest = () in + let sparse_table h f = filter h (List.flatten (table2 f)) in + fun hdr p1 p2 p3 p4 p5 p6 w -> + let p = [p1;p2;p3;p4;p5;p6] in + (* wide and narrow ranges of p *) + let (aw,bw) = map (lower_bound) p, map (upper_bound) p in + let (a,b) = map (fun p -> p.l.f.lo) p, map (fun p -> p.l.f.hi) p in + (* wide and narrow widths from a to b *) + let (u,wu,wf) = + let ( + ),( - ),( / ) = up();upadd,upsub,updiv in + let u = table (fun i -> (mth a i + mth b i) / 2.0) in + let wu = table (fun i -> max (mth bw i - mth u i) (mth u i - mth aw i)) in + let wf = table (fun i -> max (mth b i - mth u i) (mth u i - mth a i)) in + (u,wu,wf) in + let (fu:taylor_interval) = hdr wu aw u bw in + let fpy = + let t = make_taylor_interval(fu.l,wf,fu.dd) in + mk_line ( + mk_interval(lower_bound t, upper_bound t), + table (fun i -> mk_interval(lower_partial t i,upper_partial t i)) ) in + (* use chain rule imperatively to compute narrow first derivative *) + let df_tmp = Array.create 6 zero in + let ( + ) = iadd in + let ( * ) = imul in + let _ = for j=0 to 5 do + let dfj = mth fpy.df j in + if is_zero dfj then rest + else for i=0 to 5 do + let r = mth (mth p j).l.df i in + if (is_zero r) then rest else df_tmp.(i) <- df_tmp.(i) + dfj * r; + done; + done in + let lin = mk_line ( fpy.f, Array.to_list df_tmp ) in + (* second derivative init *) + let fW_partial = table (fun i -> mk_interval(lower_partial fu i,upper_partial fu i)) in + let pW_partial = sparse_table (fun (_,_,z) ->not (is_zero z)) + (fun k i -> (k,i,(mk_interval(lower_partial (mth p k) i,upper_partial (mth p k) i)))) in + (* chain rule 4-nested loop!, but flattened with sparse table *) + let dcw = Array.make_matrix 6 6 zero in + let _ = for i=0 to 5 do for j=0 to 5 do for k=0 to 5 do + if (is_zero (mth2 (mth p k).dd i j)) then rest + else dcw.(i).(j) <- dcw.(i).(j) + mth fW_partial k * mth2 ((mth p k).dd) i j ; + done; done; done in + let len = List.length pW_partial in + let _ = for ki = 0 to len-1 do + let (k,i,rki) = List.nth pW_partial ki in + for mj=0 to len-1 do + let (m,j,rmj) = List.nth pW_partial mj in + Report.report (Printf.sprintf "k i m j rki rmj fuddkm = %d %d %d %d %f %f %f" k i m j rki.lo rmj.lo (mth2 fu.dd k m).lo); + dcw.(i).(j) <- dcw.(i).(j) + mth2 fu.dd k m * rki * rmj; (* innermost loop *) + done; done in + let dcw_list = map Array.to_list (Array.to_list dcw) in + make_taylor_interval(lin,w,dcw_list);; + +let rec evalf4 tf w x y z = match tf with + | Prim_a p -> evalf4A p w x y z + | Uni p -> evalf4U p w x y z + | Plus (tf1,tf2) -> ti_add(evalf4 tf1 w x y z, evalf4 tf2 w x y z) + | Composite(h,g1,g2,g3,g4,g5,g6) -> + let [p1;p2;p3;p4;p5;p6] = map (fun t-> evalf4 t w x y z) [g1;g2;g3;g4;g5;g6] in + eval_composite (evalf4 h) p1 p2 p3 p4 p5 p6 w + | Scale (tf,t) -> ti_scale ((evalf4 tf w x y z),t) + | Uni_compose (uf,tf) -> + evalf4 (Composite(Uni (mk_primitiveU 0 uf),tf,unit,unit,unit,unit,unit)) w x y z;; + +let evalf tf x z = + let (y,w) = center_form (x,z) in + evalf4 tf w x y z;; + +let line_estimate_composite = + let ( + ) = iadd in + let ( * ) = imul in + fun h p1 p2 p3 p4 p5 p6 -> + let p = [p1;p2;p3;p4;p5;p6] in + let (a,b) = map (fun p -> p.f.lo) p, map (fun p -> p.f.hi) p in + let fN = evalf h a b in + let fN_partial = table (fun i -> mk_interval(lower_partial fN i,upper_partial fN i)) in + let pN_partial =table2(fun i j-> (mth (mth p i).df j)) in + let cN_partial2 = table2 (fun i j -> mth fN_partial j * mth2 pN_partial j i) in + let cN_partial = map (end_itlist ( + )) cN_partial2 in + mk_line ( fN.l.f, cN_partial );; + +let rec line_estimate tf y = match tf with + | Prim_a p -> line_estimateA p y + | Uni p -> line_estimateU p y + | Plus (p,q) -> ladd (line_estimate p y) (line_estimate q y) + | Scale (p,t) -> smul (line_estimate p y) t + | Uni_compose (uf,tf) -> + line_estimate (Composite(Uni { slot=0; uv=uf; },tf,unit,unit,unit,unit,unit)) y + | Composite(h,g1,g2,g3,g4,g5,g6) -> + let [p1;p2;p3;p4;p5;p6] = map (fun t-> line_estimate t y) [g1;g2;g3;g4;g5;g6] in + line_estimate_composite h p1 p2 p3 p4 p5 p6;; + +end;; diff --git a/port_interval/types.hl b/port_interval/types.hl new file mode 100644 index 0000000..713cf8d --- /dev/null +++ b/port_interval/types.hl @@ -0,0 +1,46 @@ + + +exception Unstable;; (* generally thrown when there is a divide by zero *) + +exception Fatal;; (* generally indicates an uncorrected bug *) + +(* represents a closed interval [lo,hi] of the real line *) + +type interval = { + lo : float; + hi : float; +};; + +(* represents a function u:real->real, its derivative du, and 2nd derivative *) + +type univariate = { + u : interval -> interval; + du : interval -> interval; + ddu : interval -> interval; +};; + +(* represents the value f of function of six variables at some point y. + and the value df of its six partial derivatives, evaluated at the same point y. + The length of the list df should always be 6. +*) + +type line = { + f : interval; + df : (interval) list; +};; + +(* + represents approximation data for a function f on a rectangular domain [x,z]. + l gives the value and partial derivatives of f at some point y in the domain. + dd gives interval bounds on the second derivatives over the entire domain. + w i is an upper bound on widths (z i - y i) and (y i - x i). +*) + +type taylor_interval = { + l : line; + w : float list; + dd : interval list list; +};; + + + diff --git a/port_interval/univariate.hl b/port_interval/univariate.hl new file mode 100644 index 0000000..f48ff7b --- /dev/null +++ b/port_interval/univariate.hl @@ -0,0 +1,84 @@ +(* port of univariate.cc + a univariate represents a function u:real->real. + its first derivative du:real->real + and its second derivative ddu;real->real. + + For example, if the function is x |-> x, + its derivative is x |-> 1, + and second derivative is x |-> 0, + which is implemented as ux1. + + We give a few other examples, sqrt, 1/x, atan. + + *) + +module Univariate = struct + +open Interval;; + +let eval uni x = function + | 0 -> uni.u x + | 1 -> uni.du x + | _ -> uni.ddu x;; + +let mk_univariate (u1,du1,ddu1) = { u = u1; du = du1; ddu = ddu1; };; + +let raise_zero x = bounded_from_zero x or raise Unstable ;; + +(* here are a couple of examples *) + +let ux1 = + mk_univariate( + (fun x -> x), + (fun x -> one), + (fun x-> zero) + );; + +let usqrt = + let ( / ) = idiv in + let ( * ) = imul in + mk_univariate( + isqrt, + + (fun x -> + let _ = raise_zero x in + one / (two * isqrt x)), + + (fun x -> + let _ = raise_zero x in + ineg (one / (four * x * isqrt x))) +);; + +let uinv = + let ( / ) = idiv in + let ( * ) = imul in + mk_univariate( + (fun x -> + let _ = raise_zero x in + one / x), + + (fun x -> + let _ = raise_zero x in + ineg (one / ( x * x))), + + (fun x -> + let _ = raise_zero x in + two / ( x * x * x)) + );; + +let uatan = + let ( / ) = idiv in + let ( * ) = imul in + let ( + ) = iadd in + mk_univariate( + iatan, + + (fun x -> + one / (one + x * x)), + + (fun x -> + let t = one + x * x in + ineg (two * x/ (t * t))) + );; + +end;; diff --git a/projects_discrete_geom/bcc_lattice.hl b/projects_discrete_geom/bcc_lattice.hl new file mode 100644 index 0000000..4689ebf --- /dev/null +++ b/projects_discrete_geom/bcc_lattice.hl @@ -0,0 +1,743 @@ +(* ========================================================================== *) +(* BCC LATTICE *) +(* *) +(* Nonlinear Inequalities for BCC lattice optimality *) +(* Author: Thomas C. Hales *) +(* Date: 2012-03-20 *) +(* ========================================================================== *) + +(* +The inequalities in this file are not part of the Flyspeck project. + +Nonlinear inequalities for the optimality of the BCC with respect +to surface areas when volumes of Voronoi cells are normalized to be 1. + +Nonlinear inequalities for the optimality of the FCC with respect +to surface areas of Voronoi cells when the lattice packs a unit ball. + +Reference: "Voronoi polyhedra of unit ball packings with small surface area" +Bezdek, KIss, Liu, Periodica Mathematica Hungarica, Vol 39 (1-3), 1999, pp. 107--118. + +The bottom of the file contains the Mathematica code used to prove +the local optimality of BCC and FCC, respectively. + +To verify in C++, load the Flyspeck project, then this file, +then run the scripts in scripts.hl. + +*) + +module Bcc_lattice = struct + +open Ineq;; + +let bcc_value = new_definition `bcc_value = + (&3 / &2 + &3 * sqrt(&3))/ root 3 (&2)`;; + +let selling_volume2 = new_definition `selling_volume2 p01 p02 p03 p12 p13 p23 = + p01*p02*p03 + p01*p03*p12 + p02*p03*p12 + + p01*p02*p13 + p02*p03*p13 + + p01*p12*p13 + p02*p12*p13 + p03*p12*p13 + + p01*p02*p23 + p01*p03*p23 + + p01*p12*p23 + p02*p12*p23 + p03*p12*p23 + + p01*p13*p23 + p02*p13*p23 + p03*p13*p23`;; + +let selling_surface_num = new_definition + ` selling_surface_num p01 p02 p03 p12 p13 p23 = + let p0_123 = p01 + p02 + p03 in + let p1_023 = p01 + p12 + p13 in + let p2_013 = p02 + p12 + p23 in + let p3_012 = p03 + p13 + p23 in + let p01_23 = p02 + p03 + p12 + p13 in + let p02_13 = p01 + p03 + p12 + p23 in + let p03_12 = p01 + p02 + p13 + p23 in + let F01_23 = p01 * p23 * sqrt(p01_23) in + let F02_13 = p02 * p13 * sqrt(p02_13) in + let F03_12 = p03 * p12 * sqrt(p03_12) in + let F0_123 = (p12*p13+p12*p23+p13*p23)*sqrt(p0_123) in + let F1_023 = (p02*p03+p02*p23+p03*p23)*sqrt(p1_023) in + let F2_013 = (p01*p03+p01*p13+p03*p13)*sqrt(p2_013) in + let F3_012 = (p01*p02+p01*p12+p02*p12)*sqrt(p3_012) in + &2*(F01_23+F02_13+F03_12+F0_123+F1_023+F2_013+F3_012)`;; + +let selling_surface_nn = new_definition + `selling_surface_nn p01 p02 p03 p12 p13 p23 = + selling_surface_num p01 p02 p03 p12 p13 p23 - bcc_value`;; + +let sqrt01 = new_definition + `sqrt01 t = t* sqrt(#0.1) / (#0.1)`;; +(* lower approx to sqrt on [0,0.1]. *) + +(* replace sqrt with analytic sqrt01, near sqrt(0), to maintain analyticity *) + +let selling_surface_num2_013_approx = new_definition + ` selling_surface_num2_013_approx p01 p02 p03 p12 p13 p23 = + let p0_123 = p01 + p02 + p03 in + let p1_023 = p01 + p12 + p13 in + let p2_013 = p02 + p12 + p23 in + let p3_012 = p03 + p13 + p23 in + let p01_23 = p02 + p03 + p12 + p13 in + let p02_13 = p01 + p03 + p12 + p23 in + let p03_12 = p01 + p02 + p13 + p23 in + let F01_23 = p01 * p23 * sqrt(p01_23) in + let F02_13 = p02 * p13 * sqrt(p02_13) in + let F03_12 = p03 * p12 * sqrt(p03_12) in + let F0_123 = (p12*p13+p12*p23+p13*p23)*sqrt(p0_123) in + let F1_023 = (p02*p03+p02*p23+p03*p23)*sqrt(p1_023) in + let F2_013 = (p01*p03+p01*p13+p03*p13)*sqrt01(p2_013) in + let F3_012 = (p01*p02+p01*p12+p02*p12)*sqrt(p3_012) in + &2*(F01_23+F02_13+F03_12+F0_123+F1_023+F2_013+F3_012)`;; + +let selling_surface_nn2_013 = new_definition + `selling_surface_nn2_013 p01 p02 p03 p12 p13 p23 = + selling_surface_num2_013_approx p01 p02 p03 p12 p13 p23 - bcc_value`;; + + +let selling_surface_num01_23_approx = new_definition + ` selling_surface_num01_23_approx p01 p02 p03 p12 p13 p23 = + let p0_123 = p01 + p02 + p03 in + let p1_023 = p01 + p12 + p13 in + let p2_013 = p02 + p12 + p23 in + let p3_012 = p03 + p13 + p23 in + let p01_23 = p02 + p03 + p12 + p13 in + let p02_13 = p01 + p03 + p12 + p23 in + let p03_12 = p01 + p02 + p13 + p23 in + let F01_23 = p01 * p23 * sqrt01(p01_23) in + let F02_13 = p02 * p13 * sqrt(p02_13) in + let F03_12 = p03 * p12 * sqrt(p03_12) in + let F0_123 = (p12*p13+p12*p23+p13*p23)*sqrt(p0_123) in + let F1_023 = (p02*p03+p02*p23+p03*p23)*sqrt(p1_023) in + let F2_013 = (p01*p03+p01*p13+p03*p13)*sqrt(p2_013) in + let F3_012 = (p01*p02+p01*p12+p02*p12)*sqrt(p3_012) in + &2*(F01_23+F02_13+F03_12+F0_123+F1_023+F2_013+F3_012)`;; + +let selling_surface_nn01_23 = new_definition + `selling_surface_nn01_23 p01 p02 p03 p12 p13 p23 = + selling_surface_num01_23_approx p01 p02 p03 p12 p13 p23 - bcc_value`;; + +let selling_homog = new_definition + `selling_homog y1 y2 y3 y4 y5 y6 = + (selling_surface_num y1 y2 y3 y4 y5 y6) - + (bcc_value)*(root 6 (selling_volume2 y1 y2 y3 y4 y5 y6 pow 5))`;; + +let fcc_ineq = new_definition + `fcc_ineq y1 y2 y3 y4 y5 y6 = + selling_surface_num y1 y2 y3 y4 y5 y6 - + #12.0 * sqrt(&2) * sqrt(selling_volume2 y1 y2 y3 y4 y5 y6)`;; + +let _ = + let v = map Parse_ineq.prep_autogen + [ + selling_volume2; + bcc_value; + selling_surface_num; + selling_surface_nn; + sqrt01; + selling_surface_num2_013_approx; + selling_surface_nn2_013; + selling_surface_num01_23_approx; + selling_surface_nn01_23; + selling_homog; + fcc_ineq;] in + if (Lib.mem (hd v) !Parse_ineq.autogen) then () else + (Parse_ineq.autogen := !Parse_ineq.autogen @ v);; + + +let all_forall = Sphere.all_forall;; + +Ineq.skip { + idv="EIFIOKD"; + ineq = all_forall `ineq + [ + (&0,y1,&81); + (&0,y2,&81); + (&0,y3,&81); + (&0,y4,&81); + (&0,y5,&81); + (&0,y6,&81) + ] + ((selling_volume2 y1 y2 y3 y4 y5 y6 < &1) \/ + (selling_surface_num y1 y2 y3 y4 y5 y6 >= bcc_value) )`; + doc = "BCC cell main inequality. + This is the reference inequality, which is partitioned below into pieces. + We must give special treatment at non-analytic points sqrt(0). + BCC cell occurs when all variables are (16)^(-1/3) approx 0.39685. + y1 = p01, y2 = p02, y3 = p03, y4 = p12, y5 = p13, y6 = p23"; + tags = [Cfsqp;Strongdodec]; +};; + +Ineq.add { + idv="EIFIOKD-a"; + ineq = all_forall `ineq + [ + (&5,y1,&81); + (&0,y2,&81); + (&0,y3,&81); + (&0,y4,&81); + (&0,y5,&81); + (&0,y6,&81) + ] + ( (selling_surface_nn y1 y2 y3 y4 y5 y6 > &0) \/ + ( y2 + y3 + y4 + y5 < #0.1) \/ + ( y2 + y4 + y6 < #0.1) \/ + ( y3 + y5 + y6 < #0.1) \/ + (selling_volume2 y1 y2 y3 y4 y5 y6 < &1) + )`; + doc = "BCC cell main inequality. + Region: some variable at least 5, moved to the first slot. + p01_23, p2_013, p3_012 >= 0.1. + We are bounded away from sqrt(0) on this domain. + BCC cell occurs when all variables are (16)^(-1/3) approx 0.39685. + y1 = p01, y2 = p02, y3 = p03, y4 = p12, y5 = p13, y6 = p23"; + tags = [Cfsqp;Strongdodec;Widthcutoff 0.05]; +};; + + + + + +Ineq.add { + idv="EIFIOKD-b"; + ineq = all_forall `ineq + [ + (&5,y1,&81); + (&0,y2,#0.1); + (&0,y3,#0.1); + (&0,y4,#0.1); + (&0,y5,#0.1); + (&0,y6,&81) + ] + ( (selling_surface_nn01_23 y1 y2 y3 y4 y5 y6 > &0) \/ + ( y2 + y3 + y4 + y5 > #0.1) \/ + (selling_volume2 y1 y2 y3 y4 y5 y6 < &1) + )`; + doc = "BCC cell main inequality. + Region: some variable at least 5, moved to the first slot. + p01_23 <= 0.1. + We are bounded away from sqrt(0) on this domain, except for sqrt(p01_23). + BCC cell occurs when all variables are (16)^(-1/3) approx 0.39685. + y1 = p01, y2 = p02, y3 = p03, y4 = p12, y5 = p13, y6 = p23"; + tags = [Cfsqp;Strongdodec]; +};; + + +Ineq.add { + idv="EIFIOKD-c"; + ineq = all_forall `ineq + [ + (&5,y1,&81); + (&0,y2,#0.1); + (&0,y3,&81); + (&0,y4,#0.1); + (&0,y5,&81); + (&0,y6,#0.1) + ] + ( (selling_surface_nn2_013 y1 y2 y3 y4 y5 y6 > &0) \/ ( y2 + y4 + y6 > #0.1) \/ + (selling_volume2 y1 y2 y3 y4 y5 y6 < &1) + )`; + doc = "BCC cell main inequality. + Region: some variable at least 5, moved to the first slot. + p2_013 <= 0.1 or p3_012 < 0.1, by symmetry assume p2_013 < 0.1. + We are bounded away from sqrt(0) on this domain, except for sqrt(p01_23). + BCC cell occurs when all variables are (16)^(-1/3) approx 0.39685. + y1 = p01, y2 = p02, y3 = p03, y4 = p12, y5 = p13, y6 = p23"; + tags = [Cfsqp;Strongdodec]; +};; + +Ineq.add { + idv="EIFIOKD1"; + ineq = all_forall `ineq + [ + (#0.4,y1,&5); + (&0,y2,&5); + (&0,y3,&5); + (&0,y4,&5); + (&0,y5,&5); + (&0,y6,&5) + ] + ( (selling_surface_nn y1 y2 y3 y4 y5 y6 > &0) \/ + ((selling_volume2 y1 y2 y3 y4 y5 y6 < &1) ))`; + doc = "BCC cell main inequality. + Region: all 0-5, some variable at least 0.4 + We are bounded away from sqrt(0) on this domain. + BCC cell occurs when all variables are (16)^(-1/3) approx 0.39685. + y1 = p01, y2 = p02, y3 = p03, y4 = p12, y5 = p13, y6 = p23"; + tags = [Cfsqp;Strongdodec]; +};; + +Ineq.add { + idv="EIFIOKD2"; + ineq = all_forall `ineq + [ + (&0,y1,#0.39); + (&0,y2,#0.4); + (&0,y3,#0.4); + (&0,y4,#0.4); + (&0,y5,#0.4); + (&0,y6,#0.4) + ] + ((selling_volume2 y1 y2 y3 y4 y5 y6 < &1) \/ + (selling_surface_nn y1 y2 y3 y4 y5 y6 > &0) )`; + doc = "BCC cell main inequality. + Region: all 0-0.4, some variable at most 0.39, + We are bounded away from sqrt(0) on this domain. + BCC cell occurs when all variables are (16)^(-1/3) approx 0.39685. + y1 = p01, y2 = p02, y3 = p03, y4 = p12, y5 = p13, y6 = p23"; + tags = [Cfsqp;Strongdodec]; +};; + +Ineq.add { + idv="EIFIOKD3"; + ineq = all_forall `ineq + [ + (&1,y1,&1); + (#0.975,y2,#0.999991); + (#0.975,y3,&1); + (#0.975,y4,&1); + (#0.975,y5,&1); + (#0.975,y6,&1) + ] + (selling_homog y1 y2 y3 y4 y5 y6 >= &0)`; + doc = "BCC cell main inequality. + Local analysis near a critical point. + Remove constraint by forming homogeneous (deg 15 expression in p) + 0.975 = 39/40 40/39 < 1.026. + Homogeneity used to make the largest variable 1. Symmetry shifted into first position. + This is the case that an adjacent variable is at most 0.999991. + We are bounded away from sqrt(0) on this domain. + BCC cell occurs when all variables are (16)^(-1/3) approx 0.39685. + y1 = p01, y2 = p02, y3 = p03, y4 = p12, y5 = p13, y6 = p23"; + tags = [Cfsqp;Strongdodec]; +};; + +Ineq.add { + idv="EIFIOKD4"; + ineq = all_forall `ineq + [ + (&1,y1,&1); + (#0.975,y2,&1); + (#0.975,y3,&1); + (#0.975,y4,&1); + (#0.975,y5,&1); + (#0.975,y6,#0.999991) + ] + (selling_homog y1 y2 y3 y4 y5 y6 >= &0)`; + doc = "BCC cell main inequality. + Local analysis near a critical point. + Remove constraint by forming homogeneous (deg 15 expression in p) + 0.975 = 39/40 40/39 < 1.026. + Homogeneity used to make the largest variable 1. Symmetry shifted into first position. + This is the case that an adjacent variable is at most 0.999991. + We are bounded away from sqrt(0) on this domain. + BCC cell occurs when all variables are (16)^(-1/3) approx 0.39685. + y1 = p01, y2 = p02, y3 = p03, y4 = p12, y5 = p13, y6 = p23"; + tags = [Cfsqp;Strongdodec]; +};; + +Ineq.skip { + idv="EIFIOKD5"; + ineq = all_forall `ineq + [ + (&1,y1,&1); + (#0.99999,y2,&1); + (#0.99999,y3,&1); + (#0.99999,y4,&1); + (#0.99999,y5,&1); + (#0.99999,y6,&1) + ] + (selling_homog y1 y2 y3 y4 y5 y6 >= &0)`; + doc = "BCC cell main inequality. + Local analysis near a critical point. + Remove constraint by forming homogeneous (deg 15 expression in p) + Homogeneity used to make the largest variable 1. Symmetry shifted into first position. + This is that all variables are at least 0.99999. + This has been done with interval arithmetic in Mathematica, by checking + local optimality conditions in a nbd of (1,1,1,1,1,1). (See code below.) + Thus, we can skip this case in the C++ interval arithmetic verifications. + We are bounded away from sqrt(0) on this domain. + BCC cell occurs when all variables are (16)^(-1/3) approx 0.39685. + y1 = p01, y2 = p02, y3 = p03, y4 = p12, y5 = p13, y6 = p23"; + tags = [Cfsqp;Strongdodec]; +};; + + + +Ineq.skip { + idv="FXZXPNS"; + ineq = all_forall `ineq + [ + (#1.3,y1,&30); + (&1,y2,&30); + (&0,y3,&30); + (&0,y4,&30); + (&0,y5,&30); + (&0,y6,&30) + ] + ( (fcc_ineq y1 y2 y3 y4 y5 y6 >= &0) \/ + ( y1 + y2 + y3 < &4) \/ + ( y1 + y4 + y5 < &4) \/ + ( y2 + y4 + y6 < &4) \/ + ( y3 + y5 + y6 < &4) \/ + ( y2 + y3 + y4 + y5 < &4) \/ + ( y1 + y3 + y4 + y6 < &4) \/ + ( y1 + y2 + y5 + y6 < &4) + )`; + doc = "FCC main inequality + Region: assume p01 largest wlog, then p0X123 >= 4 ==> p01 >= 4/3. + Assume wlog p02 >= p03, p12, p13, ==> p01X23 >=4 ==> p02 >= 1. + We are bounded away from sqrt(0) on this domain. + FCC cell occurs when {y1,..,y6} = {2,2,0,0,2,2}; + Local analysis at FCC is done in mathematica below. + This allows us to assume that some constraint (1)..(6) goes out to 4.04. + y1 = p01, y2 = p02, y3 = p03, y4 = p12, y5 = p13, y6 = p23"; + tags = [Cfsqp;Strongdodec]; +};; + +Ineq.add { + idv="FXZXPNS-1a"; + ineq = all_forall `ineq + [ + (#1.3,y1,&30); + (&1,y2,&30); + (&1,y3,&30); + (&0,y4,&30); + (&0,y5,&30); + (&0,y6,&30) + ] + ( + ( y1 + y2 + y3 < #4.04) \/ + ( y1 + y4 + y5 < &4) \/ + ( y2 + y4 + y6 < &4) \/ + ( y3 + y5 + y6 < &4) \/ + ( y2 + y3 + y4 + y5 < &4) \/ + ( y1 + y3 + y4 + y6 < &4) \/ + ( y1 + y2 + y5 + y6 < &4) \/ (fcc_ineq y1 y2 y3 y4 y5 y6 > &0) + )`; + doc = "FCC main inequality, case 1a. a: 1<=y3 + Region: assume p01 largest wlog, then p0X123 >= 4 ==> p01 >= 4/3. + Assume wlog p02 >= p03, p12, p13, ==> p01X23 >=4 ==> p02 >= 1. + We are bounded away from sqrt(0) on this domain. + FCC cell occurs when {y1,..,y6} = {2,2,0,0,2,2}; + Local analysis at FCC is done in mathematica below. + This allows us to assume that some constraint (1)..(6) goes out to 4.04. + y1 = p01, y2 = p02, y3 = p03, y4 = p12, y5 = p13, y6 = p23"; + tags = [Cfsqp;Strongdodec;Cfsqp_branch 7]; +};; + + +Ineq.add { + idv="FXZXPNS-1b"; + ineq = all_forall `ineq + [ + (#1.3,y1,&30); + (&1,y2,&30); + (&0,y3,&1); + (&0,y4,&30); + (&1,y5,&30); + (&0,y6,&30) + ] + ( + ( y1 + y2 + y3 < #4.04) \/ + ( y1 + y4 + y5 < &4) \/ + ( y2 + y4 + y6 < &4) \/ + ( y3 + y5 + y6 < &4) \/ + ( y2 + y3 + y4 + y5 < &4) \/ + ( y1 + y3 + y4 + y6 < &4) \/ + ( y1 + y2 + y5 + y6 < &4) \/ (fcc_ineq y1 y2 y3 y4 y5 y6 > &0) + )`; + doc = "FCC main inequality, case 1b. b: 1<=y5 + Region: assume p01 largest wlog, then p0X123 >= 4 ==> p01 >= 4/3. + Assume wlog p02 >= p03, p12, p13, ==> p01X23 >=4 ==> p02 >= 1. + We are bounded away from sqrt(0) on this domain. + FCC cell occurs when {y1,..,y6} = {2,2,0,0,2,2}; + Local analysis at FCC is done in mathematica below. + This allows us to assume that some constraint (1)..(6) goes out to 4.04. + y1 = p01, y2 = p02, y3 = p03, y4 = p12, y5 = p13, y6 = p23"; + tags = [Cfsqp;Strongdodec]; +};; + + +Ineq.add { + idv="FXZXPNS-1c"; + ineq = all_forall `ineq + [ + (#1.3,y1,&30); + (&1,y2,&30); + (&0,y3,&1); + (&0,y4,&30); + (&0,y5,&1); + (&1,y6,&30) + ] + ( + ( y1 + y2 + y3 < #4.04) \/ + ( y1 + y4 + y5 < &4) \/ + ( y2 + y4 + y6 < &4) \/ + ( y3 + y5 + y6 < &4) \/ + ( y2 + y3 + y4 + y5 < &4) \/ + ( y1 + y3 + y4 + y6 < &4) \/ + ( y1 + y2 + y5 + y6 < &4) \/ (fcc_ineq y1 y2 y3 y4 y5 y6 > &0) + )`; + doc = "FCC main inequality, case 1c. c: 1<=y6. + (Note: if y3,y5,y6<1, then y3+y5+y6<4 and we are done.) + Region: assume p01 largest wlog, then p0X123 >= 4 ==> p01 >= 4/3. + Assume wlog p02 >= p03, p12, p13, ==> p01X23 >=4 ==> p02 >= 1. + We are bounded away from sqrt(0) on this domain. + FCC cell occurs when {y1,..,y6} = {2,2,0,0,2,2}; + Local analysis at FCC is done in mathematica below. + This allows us to assume that some constraint (1)..(6) goes out to 4.04. + y1 = p01, y2 = p02, y3 = p03, y4 = p12, y5 = p13, y6 = p23"; + tags = [Cfsqp;Cfsqp_branch 7;Strongdodec]; +};; + + + + +Ineq.add { + idv="FXZXPNS-2"; + ineq = all_forall `ineq + [ + (#1.3,y1,#4.04); + (&1,y2,#4.04); + (&0,y3,#4.04); + (&0,y4,#4.04); + (&0,y5,#4.04); + (&0,y6,#4.04) + ] + ( + ( y1 + y2 + y3 < &4) \/ + ( y1 + y2 + y3 > #4.04) \/ + ( y1 + y4 + y5 < #4.04) \/ + ( y2 + y4 + y6 < &4) \/ + ( y3 + y5 + y6 < &4) \/ + ( y2 + y3 + y4 + y5 < &4) \/ + ( y1 + y3 + y4 + y6 < &4) \/ + ( y1 + y2 + y5 + y6 < &4) \/ (fcc_ineq y1 y2 y3 y4 y5 y6 > &0) + )`; + doc = "FCC main inequality, case 2. second constraint. + Region: assume p01 largest wlog, then p0X123 >= 4 ==> p01 >= 4/3. + Assume wlog p02 >= p03, p12, p13, ==> p01X23 >=4 ==> p02 >= 1. + We are bounded away from sqrt(0) on this domain. + FCC cell occurs when {y1,..,y6} = {2,2,0,0,2,2}; + Local analysis at FCC is done in mathematica below. + This allows us to assume that some constraint (1)..(6) goes out to 4.04. + y1 = p01, y2 = p02, y3 = p03, y4 = p12, y5 = p13, y6 = p23"; + tags = [Cfsqp;Strongdodec]; +};; + + +Ineq.add { + idv="FXZXPNS-3"; + ineq = all_forall `ineq + [ + (#1.3,y1,#4.04); + (&1,y2,#4.04); + (&0,y3,#4.04); + (&0,y4,#4.04); + (&0,y5,#4.04); + (&0,y6,#4.04) + ] + ( + ( y1 + y2 + y3 < &4) \/ + ( y1 + y2 + y3 > #4.04) \/ + ( y1 + y4 + y5 < &4) \/ + ( y1 + y4 + y5 > #4.04) \/ + ( y2 + y4 + y6 < #4.04) \/ + ( y3 + y5 + y6 < &4) \/ + ( y2 + y3 + y4 + y5 < &4) \/ + ( y1 + y3 + y4 + y6 < &4) \/ + ( y1 + y2 + y5 + y6 < &4) \/ (fcc_ineq y1 y2 y3 y4 y5 y6 > &0) + )`; + doc = "FCC main inequality, case 3. third constraint. + Region: assume p01 largest wlog, then p0X123 >= 4 ==> p01 >= 4/3. + Assume wlog p02 >= p03, p12, p13, ==> p01X23 >=4 ==> p02 >= 1. + We are bounded away from sqrt(0) on this domain. + FCC cell occurs when {y1,..,y6} = {2,2,0,0,2,2}; + Local analysis at FCC is done in mathematica below. + This allows us to assume that some constraint (1)..(6) goes out to 4.04. + y1 = p01, y2 = p02, y3 = p03, y4 = p12, y5 = p13, y6 = p23"; + tags = [Cfsqp;Strongdodec]; +};; + + +Ineq.add { + idv="FXZXPNS-4"; + ineq = all_forall `ineq + [ + (#1.3,y1,#4.04); + (&1,y2,#4.04); + (&0,y3,#4.04); + (&0,y4,#4.04); + (&0,y5,#4.04); + (&0,y6,#4.04) + ] + ( + ( y1 + y2 + y3 < &4) \/ + ( y1 + y2 + y3 > #4.04) \/ + ( y1 + y4 + y5 < &4) \/ + ( y1 + y4 + y5 > #4.04) \/ + ( y2 + y4 + y6 < &4) \/ + ( y2 + y4 + y6 > #4.04) \/ + ( y3 + y5 + y6 < #4.04) \/ + ( y2 + y3 + y4 + y5 < &4) \/ + ( y1 + y3 + y4 + y6 < &4) \/ + ( y1 + y2 + y5 + y6 < &4) \/ (fcc_ineq y1 y2 y3 y4 y5 y6 > &0) + )`; + doc = "FCC main inequality, case 4. fourth constraint. + Region: assume p01 largest wlog, then p0X123 >= 4 ==> p01 >= 4/3. + Assume wlog p02 >= p03, p12, p13, ==> p01X23 >=4 ==> p02 >= 1. + We are bounded away from sqrt(0) on this domain. + FCC cell occurs when {y1,..,y6} = {2,2,0,0,2,2}; + Local analysis at FCC is done in mathematica below. + This allows us to assume that some constraint (1)..(6) goes out to 4.04. + y1 = p01, y2 = p02, y3 = p03, y4 = p12, y5 = p13, y6 = p23"; + tags = [Cfsqp;Strongdodec]; +};; + + +Ineq.add { + idv="FXZXPNS-5"; + ineq = all_forall `ineq + [ + (#1.3,y1,#4.04); + (&1,y2,#4.04); + (&0,y3,#4.04); + (&0,y4,#4.04); + (&0,y5,#4.04); + (&0,y6,#4.04) + ] + ( + ( y1 + y2 + y3 < &4) \/ + ( y1 + y2 + y3 > #4.04) \/ + ( y1 + y4 + y5 < &4) \/ + ( y1 + y4 + y5 > #4.04) \/ + ( y2 + y4 + y6 < &4) \/ + ( y2 + y4 + y6 > #4.04) \/ + ( y3 + y5 + y6 < &4) \/ + ( y3 + y5 + y6 > #4.04) \/ + ( y2 + y3 + y4 + y5 < #4.04) \/ + ( y1 + y3 + y4 + y6 < &4) \/ + ( y1 + y2 + y5 + y6 < &4) \/ (fcc_ineq y1 y2 y3 y4 y5 y6 > &0) + )`; + doc = "FCC main inequality, case 5. + Region: assume p01 largest wlog, then p0X123 >= 4 ==> p01 >= 4/3. + Assume wlog p02 >= p03, p12, p13, ==> p01X23 >=4 ==> p02 >= 1. + We are bounded away from sqrt(0) on this domain. + FCC cell occurs when {y1,..,y6} = {2,2,0,0,2,2}; + Local analysis at FCC is done in mathematica below. + This allows us to assume that some constraint (1)..(6) goes out to 4.04. + y1 = p01, y2 = p02, y3 = p03, y4 = p12, y5 = p13, y6 = p23"; + tags = [Cfsqp;Strongdodec]; +};; + + +Ineq.add { + idv="FXZXPNS-6"; + ineq = all_forall `ineq + [ + (#1.3,y1,#4.04); + (&1,y2,#4.04); + (&0,y3,#4.04); + (&0,y4,#4.04); + (&0,y5,#4.04); + (&0,y6,#4.04) + ] + ( + ( y1 + y2 + y3 < &4) \/ + ( y1 + y2 + y3 > #4.04) \/ + ( y1 + y4 + y5 < &4) \/ + ( y1 + y4 + y5 > #4.04) \/ + ( y2 + y4 + y6 < &4) \/ + ( y2 + y4 + y6 > #4.04) \/ + ( y3 + y5 + y6 < &4) \/ + ( y3 + y5 + y6 > #4.04) \/ + ( y2 + y3 + y4 + y5 < &4) \/ + ( y2 + y3 + y4 + y5 > #4.04) \/ + ( y1 + y3 + y4 + y6 < #4.04) \/ + ( y1 + y2 + y5 + y6 < &4) \/ (fcc_ineq y1 y2 y3 y4 y5 y6 > &0) + )`; + doc = "FCC main inequality, case 6. Final case. + Region: assume p01 largest wlog, then p0X123 >= 4 ==> p01 >= 4/3. + Assume wlog p02 >= p03, p12, p13, ==> p01X23 >=4 ==> p02 >= 1. + We are bounded away from sqrt(0) on this domain. + FCC cell occurs when {y1,..,y6} = {2,2,0,0,2,2}; + Local analysis at FCC is done in mathematica below. + This allows us to assume that some constraint (1)..(6) goes out to 4.04. + y1 = p01, y2 = p02, y3 = p03, y4 = p12, y5 = p13, y6 = p23"; + tags = [Cfsqp;Strongdodec]; +};; + + + +(* + +"Mathematica code used to prove local optimality in an explicit epsilon neighborhood + of BCC"; + +"definition of objective function mu:"; + +SellingVolume2 = p01*p02*p03 + p01*p03*p12 + p02*p03*p12 + + p01*p02*p13 + p02*p03*p13 + p01*p12*p13 + p02*p12*p13 + + p03*p12*p13 + p01*p02*p23 + p01*p03*p23 + p01*p12*p23 + + p02*p12*p23 + p03*p12*p23 + p01*p13*p23 + p02*p13*p23 + p03*p13*p23; + +p0X123 = p01 + p02 + p03; +p1X023 = p01 + p12 + p13; +p2X013 = p02 + p12 + p23; +p3X012 = p03 + p13 + p23; +p01X23 = p02 + p03 + p12 + p13; +p02X13 = p01 + p03 + p12 + p23; +p03X12 = p01 + p02 + p13 + p23; +F01X23 = p01*p23*Sqrt[p01X23]; +F02X13 = p02*p13*Sqrt[p02X13]; +F03X12 = p03*p12*Sqrt[p03X12]; +F0X123 = (p12*p13 + p12*p23 + p13*p23)*Sqrt[p0X123]; +F1X023 = (p02*p03 + p02*p23 + p03*p23)*Sqrt[p1X023]; +F2X013 = (p01*p03 + p01*p13 + p03*p13)*Sqrt[p2X013]; +F3X012 = (p01*p02 + p01*p12 + p02*p12)*Sqrt[p3X012]; + +SellingSurfaceNum = 2*( + F01X23 + F02X13 + F03X12 + F0X123 + F1X023 + F2X013 + F3X012); + +muSelling = ((SellingSurfaceNum/2)^3/(SellingVolume2)^(5/2)); + +"Interval Arithmetic Evaluation"; +eval[r_, ii_] := (r /. {p01 -> 1, p02 -> ii, p03 -> ii, p12 -> + ii, p13 -> ii, p23 -> ii}); +ii = Interval[{0.99999, 1}]; + +"Gradient"; +dd1[i_] := D[muSelling1, {pv[[i]]}]; +dds = Table[dd1[i], {i, 1, 5}]; +{"Gradient", tab1i = Table[eval[dds[[i]], 1], {i, 1, 5}] // Simplify} + +"Principal Minors"; +pv = {p02, p03, p12, p13, p23}; +dd[i_, j_] := D[muSelling1, {pv[[i]]}, {pv[[j]]}]; +ddij = Table[eval[dd[i, j], ii], {i, 1, 5}, {j, 1, 5}]; +minor[k_] := Det[Table[ddij[[i]][[j]], {i, 1, k}, {j, 1, k}]]; +{"Table of Principal Minors", Table[minor[k], {k, 1, 5}] } + +*) + +(* +(* Local Optimality of fcc lattice with respect to surface area of Voronoi +cell among those lattices containing a unit ball packing. *) +(* Corollary : Gauss on fcc lattice optimality. *) + +surfcc = SellingSurfaceNum/(SellingVolume2)^(1/2); + (* at fcc, we get value 12 Sqrt[2], or about 16.9705627484771405856202646905 *) + +epssub = {p01 -> 2 + eps01, p02 -> 2 + eps02, p03 -> 0 + + eps03, p12 -> 0 + eps12, p13 -> 2 + eps13, p23 -> 2 + eps23}; +systemFcc = {t1 == p0X123 - 4, t2 == p1X023 - 4, t3 == p2X013 - + 4, t4 == p3X012 - 4, + t5 == p01X23 - 4, t6 == p02X13 - 4} /. epssub; +tsub = Solve[systemFcc, {eps01, eps02, eps03, eps12, eps13, eps23}]; +surt = (surfcc /. epssub) /. tsub; +tvar = {t1, t2, t3, t4, t5, t6}; (* positive coordinates on constrained domain *) +grad = Table[D[surt, tvar[[i]]], {i, 1, 6}]; +evalt[f_, a_] := f /. {t1 -> a, t2 -> a, t3 -> a, t4 -> a, t5 -> a, t6 -> a}; +{"gradient is pos", evalt[grad, Interval[{0, 0.04}]]} +*) + + +end;; diff --git a/projects_discrete_geom/bezdek_reid/bezdek_reid.hl b/projects_discrete_geom/bezdek_reid/bezdek_reid.hl new file mode 100644 index 0000000..ab7f9b2 --- /dev/null +++ b/projects_discrete_geom/bezdek_reid/bezdek_reid.hl @@ -0,0 +1,283 @@ +(* + +Thomas C. Hales +January 12, 2013. + +Notes on the paper "Contact Graphs of Unit Sphere Packings Revisited" +by Bezdek and Reid. +preprint date October 17, 2012. + + +We show the following results: + +There are no kissing arrangements of 12 spheres with at least 25 contact edges. +There are no kissing arrangements of 12 spheres with at least 11 contact triples. + +**** +This is not a stand-alone piece of code. +For the graph generation, it requires the installation of java. + +It also requires parts of the Flyspeck project, especially + Graph_control for graph generation, and Glpk_link to process the raw data, + +We also use some functions such as (--) and chop_list from HOL-Light's lib.ml. + +As the code is currently written, it assumes that the entire Flyspeck project +has been loaded, but with a bit of work, it could be made to depend on just +the indicated modules. + +**** + +The relevant output is coord_edge and coord_triple, which exhibit inconsistent +coordinate assignments for the nodes of the graphs. + +*) + +flyspeck_needs ("../graph_generator/graph_control.hl");; +flyspeck_needs "../glpk/glpk_link.ml";; + + +module Bezdek_reid = struct + + open Graph_control;; + open Glpk_link;; + open List;; + + (* The file names need to be adjusted for different users *) + let modelfile = "/Users/thomashales/Desktop/googlecode/flyspeck/projects_discrete_geom/bezdek_reid/br_model.mod";; + + (* This is the default output location for the graph generation, as set in the java code. *) + let tmpfile = "/tmp/graph_out.txt";; + +let bezdek_reid_properties_edge = + { + properties_id = + "K. Bezdek and S. Reid: Contact Graphs of Unit Sphere Packings Revisited (2012)"; + ignore_archive=true; + exclude_degree2=false; + exclude_pent_qrtet=true; + exclude_2_in_quad=true; + exclude_1_in_tri=true; + + (* require exactly 12 spheres *) + vertex_count_min=12; + vertex_count_max=12; + + (* degree at most 5 at every node *) + node_card_max=5; + node_card_max_at_exceptional_vertex=5; + + (* if the are more than 5.5 edges removed, then ignore *) + squander_target=55; + score_target= -1; + + (* a quad face = 1 edge removed, pent = 2 edges removed, etc. *) + table_weight_d = [0;0;0;0;10;20;30;40;50]; + table_weight_a = [(0,0);(1,0);(2,0);(3,0);(4,0)]; + table_weight_b = [(0,3,30);(0,4,40);(0,5,50); + (1,3,30);(1,4,40); + (2,2,20);(2,3,30); + (3,2,20); + (4,1,10)]; + };; + +let bezdek_reid_properties_triplet = + { + properties_id = + "K. Bezdek and S. Reid: Contact Graphs of Unit Sphere Packings Revisited (2012)"; + ignore_archive=true; + exclude_degree2=false; + exclude_pent_qrtet=true; + exclude_2_in_quad=true; + exclude_1_in_tri=true; + + (* require exactly 12 spheres *) + vertex_count_min=12; + vertex_count_max=12; + + (* degree at most 5 at every node *) + node_card_max=5; + node_card_max_at_exceptional_vertex=5; + + (* if the are more than 9.5 non-contact edges, then ignore *) + squander_target=95; + score_target= -1; + + (* a quad face = 1 edge removed, pent = 2 edges removed, etc. *) + (* allow up to an 11-gon. 11-gon, 10-gon, 9-gon ruled out + by extra n-gons at remaining vertices. *) + table_weight_d = [0;0;0;0;20;30;40;50;60]; + table_weight_a = [(0,0);(1,0);(2,0);(3,0);(4,0)]; + table_weight_b = [(0,3,60);(0,4,80);(0,5,100); + (1,3,60);(1,4,80); + (2,2,40);(2,3,60); + (3,2,40); + (4,1,20)]; + };; + + +let max_degree hypl = + let fl = List.flatten (map (fun h-> ((mk_bb h).std_faces)) hypl) in + let ll = map List.length fl in + end_itlist max ll;; + +(* initial triangle *) +let sqrt = Pervasives.sqrt;; +let p1 = (2.0,0.0,0.0);; +let p2 = (1.0,sqrt(3.0),0.0);; +let p3 = (1.0,1.0/. sqrt(3.0), sqrt(8.0) /. sqrt(3.0));; + + +(* We include a few vector functions from tikz.ml *) + +let (+...) (x1,x2,x3) (y1,y2,y3) = (x1 +. y1, x2 +. y2, x3+. y3);; + +let (-...) (x1,x2,x3) (y1,y2,y3) = (x1 -. y1, x2 -. y2, x3-. y3);; + +let ( %... ) s (x1,x2,x3) = (s *. x1, s *. x2, s*. x3);; + +let ( *... ) (x1,x2,x3) (y1,y2,y3) = (x1 *. y1 +. x2 *. y2 +. x3 *. y3);; + +let cross (x1,x2,x3) (y1,y2,y3) = + (x2 *. y3 -. x3 *. y2, x3 *. y1 -. x1 *. y3, x1 *. y2 -. x2 *. y1);; + +let normalize3 x = (1.0 /. sqrt(x *... x)) %... x;; + +let dist3 x y = + let z = x -... y in sqrt (z *... z);; + +let reflect a b c = + let u = normalize3 (cross b c) in + a -... ((2.0 *. (u *... a)) %... u);; + +let list_of (a,b,c) = [a;b;c];; + +let tuple_of [a;b;c] = (a,b,c);; + +let common a b = intersect (list_of a) (list_of b);; + +let adj3 a b = (length (list_of a) = 3) && (length (list_of b) = 3) && + length (common a b) = 2;; + +let rec outer x y = + match x with + | [] -> [] + | a::r -> (map (fun i -> (a,i)) y) @ (outer r y);; + +let rec find p l = + match l with + [] -> failwith "find" + | (h::t) -> if p(h) then h else find p t;; + +let find_adj_pair al bl = + let (s,t) = find (fun (s,t) -> adj3 s t) (outer al bl) in + let c = common s t in + let (c1,c2) = (List.nth c 0,List.nth c 1) in + let (sl,tl) = (list_of s, list_of t) in + let a = hd (subtract sl c) in + let b = hd (subtract tl c) in + (a,c1,c2,b,s,t);; + +let update_coord (cl,br1 ,br2) = + let (a,b,c,a',s,t) = find_adj_pair br1 br2 in + let pa = assoc a cl in + let pb = assoc b cl in + let pc = assoc c cl in + let pa' = reflect pa pb pc in + ((a',pa')::cl , t::br1 , subtract br2 [t]);; + +let rec mk_coords (cl,br1,br2) = + if (br2 = [] or not( can (update_coord) (cl,br1,br2))) + then (cl,br1,br2) else mk_coords (update_coord (cl,br1,br2));; + +let triangles_in_archive_string ll i = + let case1 = List.nth ll i in + let br = (mk_bb (case1)).std_faces in + let br_tri = filter (fun t -> List.length t = 3) br in + map tuple_of br_tri;; + +let do_one_case brt = + let (br1,br2) = chop_list 1 (brt) in + let [(a1,a2,a3)] = br1 in + let coordlist = [(a1,p1);(a2,p2);(a3,p3)] in + mk_coords (coordlist,br1,br2);; + +let rec mk_all_coords (cll,br2) = + if br2 = [] then (cll,[]) + else + let (cl,_,br2') = do_one_case br2 in + mk_all_coords (cl::cll, br2');; + +(* consistency checks on coordinates *) + +let is_packing dc = + let vl = setify (map fst dc) in + let dis_ok = map (fun (i,j) -> if (j<=i) then true + else (1.99 < dist3 (assoc i dc) (assoc j dc))) + (outer vl vl) in + (setify dis_ok = [true]);; + +let self_consis_one dc i = + let eps = 0.001 in + let dci = filter (fun (j,_) -> (j =i)) dc in + let dr = map snd dci in + let dis_ok = map (fun (a,b) -> dist3 a b < eps) (outer dr dr) in + setify dis_ok = [true];; + +let self_consis dc = + let vl = setify (map fst dc) in + forall (self_consis_one dc) vl;; + +let inter_consis_one dc1 dc2 = + let vl = intersect (map fst dc1) (map fst dc2) in + let a1 i = assoc i dc1 in + let a2 i = assoc i dc2 in + let abs = Pervasives.abs_float in + let eps = 0.01 in + forall (fun (i,j) -> abs(dist3 (a1 i) (a1 j) -. dist3 (a2 i) (a2 j)) < eps) + (outer vl vl);; + +let inter_consis cll = + forall (fun (a,b) -> inter_consis_one a b) (outer cll cll);; + +let mk_c ll n = + let br = triangles_in_archive_string ll n in + let (cll,_) = mk_all_coords ([],br) in + cll;; + +let test_coords ll n = + let cll = mk_c ll n in + (forall (is_packing) cll) && + (forall (self_consis) cll) && + (inter_consis cll);; + +(* we see by inspection from the explicit coordinates that they are + overdetermined. test_edge and test_triplet should both evaluate to [false] *) + +(* edge case processing *) + +let hypermap_edge = + let archiveraw_edge = tmpfile in + let _ = Graph_control.run bezdek_reid_properties_edge in + Glpk_link.strip_archive archiveraw_edge;; + +let count_edge = List.length hypermap_edge;; (* 18 cases *) +let max_degree_edge = max_degree hypermap_edge;; +let range_edge = (0--(List.length hypermap_edge - 1));; +let test_edge = setify (map (test_coords hypermap_edge) range_edge);; + + +(* triplet case *) + +let hypermap_triplet = + let archiveraw_triplet = tmpfile in + let _ = Graph_control.run bezdek_reid_properties_triplet in + Glpk_link.strip_archive archiveraw_triplet;; +let count_triplet = List.length hypermap_triplet;; (* 1335 cases *) +let max_degree_edge = max_degree hypermap_triplet;; (* 8 *) +let range_triplet = (0--(List.length hypermap_triplet - 1));; +let test_triplet = setify (map (test_coords hypermap_triplet) range_triplet);; + + + +end;; diff --git a/projects_discrete_geom/fejestoth12/defs.hl b/projects_discrete_geom/fejestoth12/defs.hl new file mode 100644 index 0000000..53b4d0e --- /dev/null +++ b/projects_discrete_geom/fejestoth12/defs.hl @@ -0,0 +1,11 @@ +(* for 2D hexagon perimeter theorem *) + +let ell_uvx = new_definition `ell_uvx (x1:real) (x2:real) (x3:real) + (x4:real) (x5:real) (x6:real) = + (let et2 = eta_x x1 x2 x3 pow 2 in + sqrt(et2 - (x1/ &4)) + sqrt(et2 - (x2/ &4)))`;; + +let ell_vx2 = new_definition `ell_vx2 (x1:real) (x2:real) (x3:real) + (x4:real) (x5:real) (x6:real) = + (let et2 = eta_x x1 x2 x3 pow 2 in + sqrt(et2 - (x2/ &4)))`;; diff --git a/projects_discrete_geom/fejestoth12/lipstick_ft.ml b/projects_discrete_geom/fejestoth12/lipstick_ft.ml new file mode 100644 index 0000000..11e2dc6 --- /dev/null +++ b/projects_discrete_geom/fejestoth12/lipstick_ft.ml @@ -0,0 +1,134 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Linear Programs for Fejes Toth's Full Contact Conjecture *) +(* Chapter: Further Results *) +(* Author: Thomas C. Hales *) +(* Date: 2010-05-19 *) +(* Guid: JKJNYAA (flypaper reference) *) +(* ========================================================================== *) + +(* +needs new mktop on platforms that do not support dynamic loading of Str. + +ocamlmktop unix.cma nums.cma str.cma -o ocampl +./ocampl + +glpk needs to be installed, and glpsol needs to be found in the path. + +*) + +(* +#directory "/Users/thomashales/Desktop/googlecode/flyspeck/glpk/";; +#use "glpk_link.ml";; +*) + +module Lipstick_ft = struct + +open Glpk_link;; + +(* external files. Edit for local system. *) +(* let datapath = "/Users/thomashales/Desktop/googlecode/flyspeck/graph_generator/output/";; *) +let datapath = "/tmp/";; +let glpkpath = "/Users/thomashales/Desktop/googlecode/flyspeck/glpk/";; + +(* let archiveraw = datapath ^ "fejesToth.txt";; (*read only *) *) +let archiveraw = datapath ^ "graph_out.txt";; (*read only *) +let model = ref (glpkpath^ "../projects_discrete_geom/fejestoth12/contact.mod");; (* read only *) +let tmpfile = "/tmp/graph.dat";; (* temporary output *) +let dumpfile = "/tmp/graph.out";; (* temp output *) + +(* type for holding the parameters for a linear program *) + +type branchnbound = + { + hypermapid : string; + mutable lpvalue : float option; + std_faces : int list list; + string_rep : string; + };; + +let mk_bb s = + let (h,face1) = convert_to_list s in + {hypermapid= h; + lpvalue = None; + string_rep=s; + std_faces = face1; + };; + +let std_faces bb = bb.std_faces;; + +let rec rangeA a i j = if (i >= j) then a + else rangeA ((j-1)::a) i (j-1);; + +let upt = rangeA [] 0;; + +let triples w = + let lw = List.length w in + let r j = List.nth w (j mod lw) in + let triple i = + [r i; r (i+1); r(i+2)] in + map triple (upt lw);; + +let cvertex bb = + 1+ maxlist0 (List.flatten (std_faces bb));; + +let cface bb = List.length(std_faces bb);; + +let std_face_of_size bb r= + let f = std_faces bb in + let z = enumerate f in + fst(List.split (filter (function _,y -> List.length y=r) z));; + +let ampl_of_bb outs bb = + let fs = std_faces bb in + let where3 = wheremod fs in + let list_of = unsplit " " string_of_int in + let edart_raw = + map triples fs in + let edart = + let edata_row (i,x) = (sprintf "(*,*,*,%d) " i)^(unsplit ", " list_of x) in + unsplit "\n" edata_row (enumerate edart_raw) in + let mk_dart xs = sprintf "%d %d" (hd xs) (where3 xs) in + let mk_darts xs = (unsplit ", " mk_dart xs) in + let p = sprintf in + let j = join_lines [ + p"param hypermapID := %s;" bb.hypermapid ; + p"param CFACE := %d;\n" (cface bb); + p"set ITRIANGLE := %s;" (list_of (std_face_of_size bb 3)) ; + p"set IQUAD := %s;" (list_of (std_face_of_size bb 4) ); + p"set IPENT := %s;" (list_of (std_face_of_size bb 5)) ; + p"set IHEX := %s;\n" (list_of (std_face_of_size bb 6)); + p"set IHEPT := %s;\n" (list_of (std_face_of_size bb 7)); + p"set IOCT := %s;\n" (list_of (std_face_of_size bb 8)); + p"set EDART := \n%s;\n" (edart);] in + Printf.fprintf outs "%s" j;; + +(* read in the hypermap archive as java style strings *) + +(* +let archive(raw) = strip_archive raw;; +*) + +(* 2013-01, added arch as an explicit argument *) + +let bbn arch i = mk_bb (List.nth arch i);; +let exec(arch) = + map (fun i -> solve_branch_f (!model) dumpfile "optival" ampl_of_bb (bbn arch i)) (0-- (List.length arch - 1));; + +(* - : string list list = + [([], ["opt.val = 0"]); (["PROBLEM HAS NO FEASIBLE SOLUTION"], []); + ([], ["opt.val = 0"]); (["PROBLEM HAS NO FEASIBLE SOLUTION"], []); + (["PROBLEM HAS NO FEASIBLE SOLUTION"], []); + (["PROBLEM HAS NO FEASIBLE SOLUTION"], []); + (["PROBLEM HAS NO FEASIBLE SOLUTION"], []); ([], ["opt.val = 0"])] + +First two HCP, FCC. Next five infeasible. + +Last is ruled out by hexagons perimeter argument in text. + We are done! + +rerun on Sept 25, 2012. +*) + +end;; diff --git a/projects_discrete_geom/strong_dodec_conj/strongdodec_ineq.hl b/projects_discrete_geom/strong_dodec_conj/strongdodec_ineq.hl new file mode 100644 index 0000000..0a60eb3 --- /dev/null +++ b/projects_discrete_geom/strong_dodec_conj/strongdodec_ineq.hl @@ -0,0 +1,342 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Nonlinear Inequalities *) +(* Chapter: Further Results *) +(* Section: Strong Dodecahedral Conjecture *) +(* Author: Thomas C. Hales *) +(* Date: 2010-05-18 *) +(* ========================================================================== *) + +(* + +Nonlinear inequalities for the Strong Dodecahedral Conjecture, + +The inequalities in this file are not part of the Flyspeck project. +But they are in the book "Dense Sphere Packings" + +*) + + + +module Strongdodec_ineq = struct + +(* strong dodecahedral conjecture *) + +let ydodec = new_definition (* $y_D$ *) + `ydodec = @y. sol_y (#2.0) (#2.0) (#2.0) y y y = pi/ (#5.0)`;; + +(* +let rad_y = new_definition + `rad2_y y1 y2 y3 y4 y5 y6 = rad2_x (y1*y1) (y2*y2) (y3*y3) (y4*y4) (y5*y5) (y6*y6)`;; +*) + +let fdodec = new_definition (* $f$ *) + `fdodec y a b = + #6.0 * volR #1.0 (eta_y #2.0 #2.0 y) (sqrt (rad2_y #2.0 #2.0 #2.0 y y y)) + + a* sol_y #2.0 #2.0 #2.0 y y y + #3.0 * b * dih_y #2.0 #2.0 #2.0 y y y`;; + +let dfdodec = new_definition `dfdodec a b = @d. + ((\t. fdodec t a b) has_real_derivative d) (atreal ydodec)`;; + +let abdodec = new_definition `abdodec = @ab. + (fdodec ydodec (FST ab) (SND ab) = &0) /\ + (dfdodec (FST ab) (SND ab) = &0)`;; + +let adodec = new_definition (* $a_D$ *) `adodec = FST abdodec`;; + +let bdodec = new_definition (* $b_D$ *) `bdodec = SND abdodec`;; + +let surfR = new_definition `surfR a b c = #3.0 * volR a b c / a`;; + +let surfRy = new_definition `surfRy y1 y2 y6 c = + surfR (y1/ &2) (eta_y y1 y2 y6) c`;; + +(* +let surfRyc2 = new_definition `surfRyc2 y1 y2 y6 c = + surfR (y1/ &2) (eta_y y1 y2 y6) (sqrt c)`;; +*) + +let surfRdyc2 = new_definition `surfRdyc2 y1 y2 y6 c2 = + surfRy y1 y2 y6 (sqrt c2) + surfRy y2 y1 y6 (sqrt c2)`;; + + +(* S.P.I. sec. 8.6.3: *) + +(* +let surfRx = new_definition `surfRx c x1 x2 x3 x4 x5 x6 = + sqrt(x1) * (x2 + x6 - x1) * sqrt(c*c - eta_x x1 x2 x6)/ + (&2 * sqrt(ups_x x1 x2 x6) )`;; +*) + +(* +let surfRx_div_sqrt_delta = new_definition `surfRx_div_sqrt_delta x1 x2 x3 x4 x5 x6 = +*) + +(* surfRy y1 y2 y6 c = surfRx c (y1 * y1) (y2 * y2) . . . (y6 * y6) *) + +let surfy = new_definition `surfy y1 y2 y3 y4 y5 y6 = + (let c = sqrt(rad2_y y1 y2 y3 y4 y5 y6) in + surfRy y1 y2 y6 c + surfRy y2 y1 y6 c + + surfRy y2 y3 y4 c + surfRy y3 y2 y4 c + + surfRy y3 y1 y5 c + surfRy y1 y3 y5 c)`;; + +let surf_x = new_definition `surf_x x1 x2 x3 x4 x5 x6 = + surfy (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +(* +let surfR126_x = new_definition `surfR126_x c2 x1 (x2:real) (x3:real) (x4:real) (x5:real) x6 = + surfRyc2 (sqrt x1) (sqrt x2) (sqrt x6) c2`;; +*) + +let surfR126d = new_definition `surfR126d c2 x1 (x2:real) (x3:real) (x4:real) (x5:real) x6 = + surfRdyc2 (sqrt x1) (sqrt x2) (sqrt x6) c2`;; + + +open Ineq;; + +(* +let pyth_x1 = new_definition `pyth_x1 (x1:real) (x2:real) (x3:real) + (x4:real) (x5:real) (x6:real) = sqrt (&2 - x1 / (&4))`;; +*) + +let all_forall = Sphere.all_forall;; + + +add { + idv="5079741806 a1"; + ineq = all_forall `ineq + [ + (#2.01,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,sqrt8); + (&1,y4,&1); + (&1,y5,&1); + (&1,y6,&1) + ] + ( + let chex = &1 / sqrt(&3) - &2 * pi / &9 in + (y_of_x ell_uvx y1 y2 y3 y4 y5 y6 + > + (&4 / &3) * y_of_x arclength_x_123 y1 y2 y3 y4 y5 y6 + + chex * lfun(y1/ &2) + chex * lfun(y2 / &2) + ))`; + doc = "Two dimensional analogue of strong dodecahedral conjecture (hexagon perimeter). + 3D case"; + tags = [Tex;Cfsqp;Xconvert;Strongdodec]; +};; + +add { + idv="5079741806 a2"; + ineq = all_forall `ineq + [ + (&2 * h0,y1,sqrt8); + (#2.0,y2,&2 * h0); + (#2.0,y3,sqrt8); + (&1,y4,&1); + (&1,y5,&1); + (&1,y6,&1) + ] + ( + let chex = &1 / sqrt(&3) - &2 * pi / &9 in + ((y_of_x ell_uvx y1 y2 y3 y4 y5 y6 + > + (&4 / &3) * y_of_x arclength_x_123 y1 y2 y3 y4 y5 y6 + + chex * lfun(y2 / &2) + ) \/ (y_of_x ell_vx2 y1 y2 y3 y4 y5 y6 + > + (&4 / &3) * y_of_x arclength_x_123 y1 y2 y3 y4 y5 y6 + + chex * lfun(y2 / &2))))`; + doc = "Two dimensional analogue of strong dodecahedral conjecture (hexagon perimeter). + 3D case"; + tags = [Tex;Cfsqp;Xconvert;Strongdodec]; +};; + + +add { + idv="5079741806 a3"; + ineq = all_forall `ineq + [ + (&2 * h0,y1,sqrt8); + (&2 * h0,y2,sqrt8); + (#2.0,y3,sqrt8); + (&1,y4,&1); + (&1,y5,&1); + (&1,y6,&1) + ] + ( + let chex = &1 / sqrt(&3) - &2 * pi / &9 in + (y_of_x ell_uvx y1 y2 y3 y4 y5 y6 + > + (&4 / &3) * y_of_x arclength_x_123 y1 y2 y3 y4 y5 y6 + ) )`; + doc = "Two dimensional analogue of strong dodecahedral conjecture (hexagon perimeter). + 3D case"; + tags = [Tex;Cfsqp;Xconvert;Strongdodec]; +};; + + +add { + idv="5079741806 a4"; + ineq = all_forall `ineq + [ + (#2.0,y1,#2.01); + (#2.0,y2,#2.01); + (#2.005,y3,sqrt8); + (&1,y4,&1); + (&1,y5,&1); + (&1,y6,&1) + ] + ( + let chex = &1 / sqrt(&3) - &2 * pi / &9 in + (y_of_x ell_uvx y1 y2 y3 y4 y5 y6 + > + (&4 / &3) * y_of_x arclength_x_123 y1 y2 y3 y4 y5 y6 + + chex * lfun(y1/ &2) + chex * lfun(y2 / &2) + ))`; + doc = "Two dimensional analogue of strong dodecahedral conjecture (hexagon perimeter). + 3D case"; + tags = [Tex;Eps 1.0e-8;Cfsqp;Xconvert;Strongdodec;]; +};; + +add { + idv="5079741806 a5"; + ineq = all_forall `ineq + [ + (#2.0,y1,#2.01); + (#2.0,y2,#2.01); + (&2,y3,#2.005); + (&1,y4,&1); + (&1,y5,&1); + (&1,y6,&1) + ] + ( + let chex = &1 / sqrt(&3) - &2 * pi / &9 in + (y_of_x ell_uvx y1 y2 y3 y4 y5 y6 + > + (&4 / &3) * y_of_x arclength_x_123 y1 y2 y3 y4 y5 y6 + + chex * lfun(y1/ &2) + chex * lfun(y2 / &2) + ))`; + doc = "Two dimensional analogue of strong dodecahedral conjecture (hexagon perimeter). + 3D case"; + tags = [Tex;Eps 1.0e-8;Cfsqp;Xconvert;Strongdodec;Onlycheckderiv1negative]; +};; + + +(* D4-inequality, sharp at (2,2,2,ydodec,ydodec,ydodec) + The domain has been simiplified by arguments in software_guide.tex *) + +add { + idv= "9627800748 a"; + ineq = all_forall `ineq + [(#2.01,y1,#2.75); +(#2.0,y2,#2.75); +(#2.0,y3,#2.75); +(#2.0,y4,#2.75); +(#2.0,y5,#2.75); +(#2.0,y6,#2.75) + ] + ((surfy y1 y2 y3 y4 y5 y6 + #3.0*adodec*sol_y y1 y2 y3 y4 y5 y6 + + &3 * bdodec*(lmfun(y1/ &2)*dih_y y1 y2 y3 y4 y5 y6 + + lmfun(y2/ &2)*dih2_y y1 y2 y3 y4 y5 y6 + + lmfun(y3/ &2)*dih3_y y1 y2 y3 y4 y5 y6 + ) > &0) \/ (rad2_y y1 y2 y3 y4 y5 y6 > #1.375 * #1.375))`; + doc = "Strong dodecahedral conjecture D4 case."; + tags = [Flypaper["TNVWUGK"];Tex;Cfsqp;Xconvert;Strongdodec;Branching;Split[0;1;2]]; +};; + +add { + idv= "9627800748 b"; + ineq = all_forall `ineq + [(#2.0,y1,#2.01); +(#2.0,y2,#2.01); +(#2.0,y3,#2.01); +(#2.2,y4,#2.75); +(#2.0,y5,#2.75); +(#2.0,y6,#2.75) + ] + ((surfy y1 y2 y3 y4 y5 y6 + #3.0*adodec*sol_y y1 y2 y3 y4 y5 y6 + + &3 * bdodec*(lfun(y1/ &2)*dih_y y1 y2 y3 y4 y5 y6 + + lfun(y2/ &2)*dih2_y y1 y2 y3 y4 y5 y6 + + lfun(y3/ &2)*dih3_y y1 y2 y3 y4 y5 y6 + ) > &0) \/ (rad2_y y1 y2 y3 y4 y5 y6 > #1.375 * #1.375))`; + doc = "Strong dodecahedral conjecture D4 case."; + tags = [Flypaper["TNVWUGK"];Tex;Cfsqp;Xconvert;Strongdodec;]; +};; + +add { + idv= "9627800748 c"; + ineq = all_forall `ineq + [(#2.0,y1,#2.01); +(#2.0,y2,#2.01); +(#2.0,y3,#2.01); +(#2.0,y4,#2.05); +(#2.0,y5,#2.2); +(#2.0,y6,#2.2) + ] + ((surfy y1 y2 y3 y4 y5 y6 + #3.0*adodec*sol_y y1 y2 y3 y4 y5 y6 + + &3 * bdodec*(lfun(y1/ &2)*dih_y y1 y2 y3 y4 y5 y6 + + lfun(y2/ &2)*dih2_y y1 y2 y3 y4 y5 y6 + + lfun(y3/ &2)*dih3_y y1 y2 y3 y4 y5 y6 + ) > &0))`; + doc = "Strong dodecahedral conjecture D4 case."; + tags = [Flypaper["TNVWUGK"];Tex;Cfsqp;Xconvert;Strongdodec;]; +};; + +add { + idv= "9627800748 d"; + ineq = all_forall `ineq + [(#2.0,y1,#2.01); +(#2.0,y2,#2.01); +(#2.0,y3,#2.01); +(#2.05,y4,#2.2); +(#2.05,y5,#2.2); +(#2.05,y6,#2.2) + ] + ((surfy y1 y2 y3 y4 y5 y6 + #3.0*adodec*sol_y y1 y2 y3 y4 y5 y6 + + &3 * bdodec*(lfun(y1/ &2)*dih_y y1 y2 y3 y4 y5 y6 + + lfun(y2/ &2)*dih2_y y1 y2 y3 y4 y5 y6 + + lfun(y3/ &2)*dih3_y y1 y2 y3 y4 y5 y6 + ) >= &0) )`; + doc = "Strong dodecahedral conjecture D4 case. I have used a Mathematica + calculation to reduce this inequality to showing that dimension reduction + holds in the variables $y_1,y_2,y_3$. In other words, + along the 3 dimensional subspace $(2,2,2,y_4,y_5,y_6)$, + Mathematica gives exact analysis showing that the only minimum is at + $(2,2,2,y_D,y_D,y_D)$. This exact analysis goes along the lines of + the analytic Voronoi cases in Ferguson's thesis. + For dimension reduction in $y_1$, the only relevant + terms are $\\op{surfy}$ and $\\op{lfun}(y_1/2)\\op{dih}$."; + tags = [Flypaper["TNVWUGK"];Tex;Cfsqp;Xconvert;Eps 1.0e-13;Strongdodec;Onlycheckderiv1negative]; +};; + + +(* D3-local inequality for strong dodecahedral conjecture + The domain has been simplified by arguments in nonlinear_list.tex +*) + +add { + idv= "6938212390"; + ineq = all_forall `ineq + [(#2.0,y1,#2.7); +(#2.0,y2,#2.7); +(#1.375,y3,#1.375); +(#1.375,y4,#1.375); +(#1.375,y5,#1.375); +(#2.0,y6,#2.7)] +(let c2 = (#1.375 pow 2) in + (surfRdyc2 y1 y2 y6 c2 + + #3.0 * adodec * (sol_y y1 y2 y3 y4 y5 y6) + + #3.0 * bdodec * (lmfun (y1/ &2)* dih_y y1 y2 y3 y4 y5 y6 + + lmfun (y2/ &2)*dih2_y y1 y2 y3 y4 y5 y6) >= &0) + \/ ((eta_y y1 y2 y6) pow 2 > #1.35 * #1.35))`; + doc = "Strong dodecahedral conjecture D3 case."; +(* was (solRy y1 y2 y6 c + solRy y2 y1 y6 c) *) + tags = [Flypaper["TNVWUGK"];Tex;Cfsqp;Xconvert;Strongdodec;Branching;Split[0;1]]; +};; + + + + + +end;; diff --git a/tame_archive/tame_archive.hl b/tame_archive/tame_archive.hl new file mode 100644 index 0000000..7de2f56 --- /dev/null +++ b/tame_archive/tame_archive.hl @@ -0,0 +1,168 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: hypermap *) +(* Author: Thomas Hales *) +(* Date: 2011-04-29 *) +(* ========================================================================== *) + +(* The tame archive from the Bauer-Nipkow classification. + The ML files in this directory are identical to those in Isabelle-HOL, Flyspeck-I. *) + + +(* WARNING!!!! + HOL Light printer does not use ellipses in list printing. + Extremely slow processing and printing. Had to kill process . + Fix before executing outside module. + +*) + + +(* Usage: +You have to open module for reflection to work. +But then printing of lists makes it impossible to look at tmrefK. + +See development/thales/printer.ml for a fix to the term printer that +prints ellipses in long lists. +*) + +(* + +June 6, 2011: +flyspeck_needs "../tame_archive/tame_archive.hl";; +open Tame_archive;; (* must open because of reflected references *) +time Tame_archive.arc3 ();; (* 0.18 secs *) +List.length !Tame_archive.ref3;; (* 9 *) +!Tame_archive.tmref3;; +time Tame_archive.arc4 ();; (* 22 secs *) +List.length !Tame_archive.ref4;; (* 1105 *) + +time Tame_archive.arc5 ();; (* 676.555191 secs *) +List.length !Tame_archive.ref5;; (* 15991 *) + +time Tame_archive.arc6 ();; (* 28 secs *) +List.length !Tame_archive.ref6;; (* 1657 *) + +*) + + +module Tame_archive = struct + +let flyspeck_dir = + (try Sys.getenv "FLYSPECK_DIR" with Not_found -> Sys.getcwd());; + +let archive_dir = + Filename.concat (Filename.concat (flyspeck_dir) Filename.parent_dir_name) + "tame_archive";; + +(* from glpk.ml *) +let load_and_close_channel do_close ic = + let rec lf ichan a = + try + lf ic (Pervasives.input_line ic::a) + with End_of_file -> a in + let rs = lf ic [] in + if do_close then Pervasives.close_in ic else (); + rev rs;; + +let save_stringarray filename xs = + let oc = open_out filename in + for i=0 to List.length xs -1 + do + Pervasives.output_string oc (List.nth xs i ^ "\n"); + done; + close_out oc;; + +let convert_archive filename ext = (* strip // comments, blank lines, quotation marks etc. *) + let (ic,oc) = Unix.open_process(sprintf "cat %s | sed 's/,/;/g' | sed 's/val [a-zA-Z]*/ref%d/g' | sed 's/]]];/]]];;/g' | sed 's/=/:=/g' | tr 'A-Z' 'a-z' " filename ext) in + let s = load_and_close_channel false ic in + let _ = Unix.close_process (ic,oc) in + s;; + +let ocaml_of_ml (output_f,input_f,ext) = +save_stringarray output_f (convert_archive (Filename.concat archive_dir input_f) ext);; + + +let hol_of_smalllist = + let ty = `:num` in + fun ls -> + let xs = map mk_small_numeral ls in + mk_list (xs,ty);; + +let hol_of_list2 = + let ty = `:num list` in + fun ls -> let x = map hol_of_smalllist ls in mk_list (x,ty);; + +let hol_of_list3 = + let ty = `:(num list) list` in + fun ls -> let x = map hol_of_list2 ls in mk_list (x,ty);; + + + +let tmp3 = Filename.temp_file "tmp3_" ".hl";; +let tmp4 = Filename.temp_file "tmp4_" ".hl";; +let tmp5 = Filename.temp_file "tmp5_" ".hl";; +let tmp6 = Filename.temp_file "tmp6_" ".hl";; + +map ocaml_of_ml [(tmp3,"Tri.ML",3);(tmp4,"Quad.ML",4); + (tmp5,"Pent.ML",5);(tmp6,"Hex.ML",6)];; + + + +(* WARNING!!!! + HOL Light printer does not use ellipses in list printing. + Extremely slow processing and printing. Had to kill process . + Fix before executing outside module. + +*) + + +let ref3 = ref [];; +let ref4 = ref [];; +let ref5 = ref [];; +let ref6 = ref [];; + +let tmref3 = ref `0`;; +let tmref4 = ref `0`;; +let tmref5 = ref `0`;; +let tmref6 = ref `0`;; + +(* loading these files changes the references! *) + +let arc3 _ = + let _ = loadt tmp3 in + let _ = (tmref3 := hol_of_list3 (!ref3)) in ();; + +let arc4 _ = + let _ = loadt tmp4 in + let _ = (tmref4 := hol_of_list3 (!ref4)) in ();; + +let arc5 _ = + let _ = loadt tmp5 in + let _ = (tmref5 := hol_of_list3 (!ref5)) in ();; + +let arc6 _ = + let _ = loadt tmp6 in + let _ = (tmref6 := hol_of_list3 (!ref6)) in ();; + + +(* +let archive3 = mk_eq (`archive3:((num list)list)list`, hol_of_list3 !ref3);; + +let arc4 = mk_eq (`archive4:((num list)list)list`, hol_of_list3 !ref4);; + +let arc5 = mk_eq (`archive5:((num list)list)list`, hol_of_list3 !ref5);; + +let arc6 = mk_eq (`archive6:((num list)list)list`, hol_of_list3 !ref6);; + + +let archive3 = new_definition arc3;; +let archive4 = new_definition arc4;; +let archive5 = new_definition arc5;; +let archive6 = new_definition arc6;; + +let bn_tame_archive = new_definition `bn_tame_archive = + APPEND arc3 (APPEND arc4 (APPEND arc5 arc6))`;; +*) + +end;; diff --git a/text_formalization/boot.hl b/text_formalization/boot.hl new file mode 100644 index 0000000..0ea38a6 --- /dev/null +++ b/text_formalization/boot.hl @@ -0,0 +1,21 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALISATION *) +(* *) +(* Boot file - process this file before processing lemma files *) +(* ========================================================================== *) + + +(* Parameters *) + +let user = "user1";; +let snapshot = "1931";; + + +(* Load basic system *) + +let flyspeck_dir = "/home/" ^ user ^ "/flyspeck/snapshots/" ^ snapshot;; + +#load "unix.cma";; +Unix.putenv "FLYSPECK_DIR" flyspeck_dir;; + +loads (flyspeck_dir ^ "/" ^ "strictbuild.hl");; diff --git a/text_formalization/boot.ml b/text_formalization/boot.ml new file mode 100644 index 0000000..6b49613 --- /dev/null +++ b/text_formalization/boot.ml @@ -0,0 +1,49 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALISATION *) +(* *) +(* File to kickstart checkpointed flyspeck using BLCR *) +(* *) +(* Author: Joe Pleso *) +(* Date: 2011-04-20 *) +(* ========================================================================= *) + + +let backup_stdout=Unix.dup Unix.stdout;; +let backup_stderr=Unix.dup Unix.stderr;; + +let default_flag_list=[Unix.O_TRUNC;Unix.O_WRONLY;Unix.O_CREAT];; + + +let hollight_name = "hol_light";; +let hollight_stdout_name= hollight_name ^ ".out";; +let hollight_stdout=Unix.openfile hollight_stdout_name default_flag_list 420;; +let hollight_stderr_name= hollight_name ^ ".err";; +let hollight_stderr=Unix.openfile hollight_stderr_name default_flag_list 420;; +Unix.dup2 hollight_stdout Unix.stdout;; +Unix.dup2 hollight_stderr Unix.stderr;; + +#use "hol.ml";; + +let flyspeck_name = "flyspeck";; +let flyspeck_stdout_name= flyspeck_name ^ ".out";; +let flyspeck_stdout=Unix.openfile flyspeck_stdout_name default_flag_list 420;; +let flyspeck_stderr_name= flyspeck_name ^ ".err";; +let flyspeck_stderr=Unix.openfile flyspeck_stderr_name default_flag_list 420;; + +Unix.dup2 flyspeck_stdout Unix.stdout;; +Unix.dup2 flyspeck_stderr Unix.stderr;; +Unix.close hollight_stdout;; +Unix.close hollight_stderr;; +#use "strictbuild.hl";; +build_silent();; +Unix.dup2 backup_stdout Unix.stdout;; +Unix.dup2 backup_stderr Unix.stderr;; +Unix.close backup_stdout;; +Unix.close backup_stderr;; +Unix.close flyspeck_stdout;; +Unix.close flyspeck_stderr;; + +let ocampl_pid()=process_to_string "echo -n $PPID";; +let blcr()=(build_silent o ignore o Sys.command) + ("cr_checkpoint -f context.ocampl --backup --term " ^ (ocampl_pid()) ^ " &");; +blcr();; diff --git a/text_formalization/build.hl b/text_formalization/build.hl new file mode 100644 index 0000000..abdb205 --- /dev/null +++ b/text_formalization/build.hl @@ -0,0 +1,258 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: All Chapters *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-14 *) +(* ========================================================================== *) + + +(* + Build file for Flyspeck project. + + hol-light should already be loaded + #use "hol.ml";; + + Make sure the reference load_path points to the + flyspeck/text_formalization dir If the "FLYSPECK_DIR" environment + variable is set to this directory then this can be done with + + load_path:= + let dir = (Sys.getenv "FLYSPECK_DIR") in + let jdir = Filename.concat dir "../jHOLLight" in + jdir::dir::(!load_path);; + + It should also point to the hol-light source + load_path := (Sys.getenv "HOLLIGHT_DIR")::(!load_path);; + + let flyspeck_needs = needs;; + + Multivariate/flyspeck.ml is needed everywhere. + + *) + +module Build = struct + +let build_sequence = + ["general/hol_pervasives.hl"; + "general/lib.hl"; + "general/flyspeck_lib.hl"; + "general/sphere.hl"; + "usr/thales/hales_tactic.hl"; + + "leg/basics.hl"; + "leg/geomdetail.hl"; + "leg/AFF_SGN_TAC.hl"; + "leg/affprops.hl"; + "leg/cayleyR_def.hl"; + "leg/enclosed_def.hl"; + "leg/collect_geom.hl"; + "leg/collect_geom2.hl"; + + "jordan/refinement.hl"; + "jordan/lib_ext.hl"; + "jordan/hash_term.hl"; + "jordan/parse_ext_override_interface.hl"; + "jordan/goal_printer.hl"; + "jordan/real_ext.hl"; + "jordan/tactics_jordan.hl"; + "jordan/num_ext_nabs.hl"; + "jordan/taylor_atn.hl"; + "jordan/float.hl"; + "jordan/flyspeck_constants.hl"; + "jordan/misc_defs_and_lemmas.hl"; + "general/tactics.hl"; + + "trigonometry/trig1.hl"; + "trigonometry/trig2.hl"; + + "nonlinear/vukhacky_tactics.hl" ; + "nonlinear/compute_2158872499.hl"; (* needs trig1.hl trig2.hl *) + + "trigonometry/delta_x.hl"; + "trigonometry/euler_complement.hl"; + "trigonometry/euler_multivariate.hl"; + "trigonometry/euler_main_theorem.hl"; + "trigonometry/trigonometry.hl"; + "trigonometry/HVIHVEC.hl"; + + "nonlinear/calc_derivative.hl"; + "nonlinear/ineqdata3q1h.hl"; + "nonlinear/types.hl"; + "nonlinear/nonlin_def.hl"; + "nonlinear/ineq.hl"; + "nonlinear/main_estimate_ineq.hl"; + "nonlinear/lemma.hl"; (* needs trig1, trig2 *) + "nonlinear/functional_equation.hl"; + "nonlinear/parse_ineq.hl"; + "nonlinear/optimize.hl"; + "nonlinear/auto_lib.hl"; + "nonlinear/merge_ineq.hl"; + + "volume/vol1.hl"; + + "hypermap/hypermap.hl"; +(* "hypermap/bauer_nipkow.hl"; *) + + "fan/fan_defs.hl"; + "fan/introduction.hl"; + "fan/GMLWKPK.hl"; + "fan/topology.hl"; + "fan/fan_misc.hl"; + "fan/planarity.hl"; + "fan/HypermapAndFan.hl"; + "fan/Conforming.hl"; + "fan/polyhedron.hl"; + + "packing/pack1.hl"; + "packing/pack2.hl"; + "packing/pack_defs.hl"; + "packing/pack_concl.hl"; + "packing/pack3.hl"; (* needs pack_defs.hl *) + "packing/Rogers.hl"; + "packing/TARJJUW.hl"; + "packing/marchal_cells.hl"; + "packing/UPFZBZM_support_lemmas.hl"; + "packing/EMNWUUS.hl"; + "packing/marchal_cells_2_new.hl"; + "packing/SLTSTLO.hl"; + "packing/LEPJBDJ.hl"; + "packing/URRPHBZ1.hl"; + "packing/URRPHBZ2.hl"; + "packing/HDTFNFZ.hl"; + "packing/URRPHBZ3.hl"; + "packing/RVFXZBU.hl"; + + "local/WRGCVDR_CIZMRRH.hl"; (* These 4 were moved up on Jan 1, 2013 *) + "local/LVDUCXU.hl"; + "local/LDURDPN.hl"; + "local/LOCAL_LEMMAS.hl"; + "tame/Inequalities.hl"; (* moved Feb 6, 2013 *) + + "packing/YNHYJIT.hl"; + "packing/NJIUTIU.hl"; + "packing/TEZFFSK.hl"; + "packing/QZKSYKG.hl"; + "packing/DDZUPHJ.hl"; + "packing/AJRIPQN.hl"; + "packing/QZYZMJC.hl"; + "packing/marchal_cells_3.hl"; + "packing/GRUTOTI.hl"; + "packing/KIZHLTL.hl"; + "packing/bump.hl"; + "packing/sum_gammaX_lmfun_estimate.hl"; + "packing/UPFZBZM.hl"; + "packing/RDWKARC.hl"; + + "local/local_lemmas1.hl"; + "local/NKEZBFC.hl"; + "tame/ArcProperties.hl"; + "fan/CFYXFTY.hl"; (* needs Nkezbfc_local and Local_lemmas *) + + "packing/YSSKQOY.hl"; (* needs ArcProperties.hl *) + "packing/counting_spheres.hl"; + "packing/REUHADY.hl"; + "packing/TSKAJXY_lemmas.hl"; + "packing/TSKAJXY_034.hl"; + "packing/OXL_def.hl"; + "packing/oxl_2012.hl"; + "packing/leaf_cell.hl"; + "packing/TSKAJXY.hl"; + "packing/OXLZLEZ.hl"; + + "local/dih2k.hl"; + "local/WJSCPRO.hl"; + "local/TECOXBM.hl"; + "local/VPWSHTO.hl"; + "local/LFJCIXP.hl"; + "local/localization.hl"; + "local/polar_fan.hl"; (* needs Tecoxbm *) + "local/HDPLYGY.hl"; + "local/GBYCPXS.hl"; + "local/MTUWLUN.hl"; + "local/PCRTTID.hl"; + "local/XIVPHKS.hl"; (* added 2013-06-11 *) + + "tame/tame_defs.hl"; + "tame/tame_concl.hl"; + "../jHOLLight/caml/ssreflect.hl"; + "../jHOLLight/caml/sections.hl"; + "fan/hypermap_iso-compiled.hl"; + + "tame/TameGeneral.hl"; + "tame/JGTDEBU.hl"; + + "tame/tame_opposite.hl"; + "tame/FATUGPD.hl"; + "tame/CRTTXAT.hl"; + "tame/HRXEFDM.hl"; + "tame/CKQOWSA_3.hl"; + "tame/CKQOWSA_4.hl"; + "tame/CKQOWSA.hl"; +(* "tame/pishort.hl"; not used. *) + "tame/ssreflect/FNJLBXS-compiled.hl"; + "../formal_lp/hypermap/ssreflect/add_triangle-compiled.hl"; + "tame/ssreflect/tame_lemmas-compiled.hl"; + + (* Local Fan Appendix *) + "local/appendix_main_estimate.hl"; + "local/terminal.hl"; + "local/pent_hex.hl"; (* added 2013-06-13 *) + "local/lp_details.hl"; (* added 2013-06-19 *) + "local/ZITHLQN.hl"; + "local/XWITCCN.hl"; + "local/AYQJTMD.hl"; + "local/JKQEWGV.hl"; + "local/UXCKFPE.hl"; + "local/SGTRNAF.hl"; + "local/QKNVMLB.hl"; + "local/YXIONXL.hl"; + "local/HXHYTIJ.hl"; + "local/UAGHHBM.hl"; + "local/LKGRQUI.hl"; (* added 2013-06-13 *) + "local/deformation.hl"; + "local/ODXLSTCv2.hl"; (* added 2013-06-13 *) + "local/lunar_deform.hl"; (* updated 2013-06-11 *) + "local/OCBICBY.hl"; (* added 2013-06-27 *) + "local/YXIONXL2.hl"; (* 2013-06-26,. *) +(* "local/XBJRPHC.hl"; (* 2013-07-02 *) moved to flyspeck.ml *) + "local/EYYPQDW.hl"; (* 2013-07-08 *) + "local/IMJXPHR.hl"; + "local/ZLZTHIC.hl"; (* 2013-07-10 *) + "local/PQCSXWG.hl"; (* 2013-07-12 *) + "local/NUXCOEA.hl"; (* 2013-07-14 *) + "local/FEKTYIY.hl"; (* 2013-07-21 *) + "local/AURSIPD.hl"; (* 2013-07-21 *) + "local/PPBTYDQ.hl"; (* 2013-07-21 *) + "local/AXJRPNC.hl"; (* 2013-07-21 *) + "local/CUXVZOZ.hl"; (* 2013-07-22 *) + "local/RRCWNSJ.hl"; (* 2013-07-27 *) + "local/JCYFMRP.hl";(* 2013-07-27 *) + "local/TFITSKC.hl";(* 2013-07-27 *) + "local/CQAOQLR.hl";(* 2013-07-27 *) + "local/JLXFDMJ.hl";(* 2013-07-27 *) + "local/YRTAFYH.hl"; (* 2013-07-31 *) + "local/WKEIDFT.hl"; (* 2013-07-31 *) + "local/hexagons.hl"; (* 2013-07-31 *) + "local/IUNBUIG.hl"; (* 2013-07-31 *) + "local/OTMTOTJ.hl"; (* 2013-08-06 *) + "local/HIJQAHA.hl"; (* 2013-08-06 *) + "local/CNICGSF.hl"; (* 2013-08-06 *) + "local/BKOSSGE.hl"; (* 2013-08-07 *) + "local/JOTSWIX.hl"; (* 2013-08-11 *) + "local/ARDBZYE.hl"; (* 2013-08-15 *) + "local/AUEAHEH.hl"; (* 2013-08-15 *) + "local/VASYYAU.hl"; (* 2013-08-15 *) + "local/MIQMCSN.hl"; (* 2013-08-15 *) + "local/JEJTVGB.hl"; (* 2013-08-15 *) + + (* integration and compatibility checks *) + "../graph_generator/graph_control.hl"; +(* "tame/dont_repeat_yourself.hl"; *) + ];; + +let build_all() = + (needs "Multivariate/flyspeck.ml"; + map (fun t -> State_manager.neutralize_state(); needs t) build_sequence);; + +end;; diff --git a/text_formalization/computational_build.hl b/text_formalization/computational_build.hl new file mode 100644 index 0000000..492a1ac --- /dev/null +++ b/text_formalization/computational_build.hl @@ -0,0 +1,116 @@ +(* ========================================================================== *) +(* FLYSPECK - CODE BUILD *) +(* *) +(* Chapter: All Chapters *) +(* Author: Thomas C. Hales *) +(* Date: 2012-04-12 *) +(* ========================================================================== *) + + +(* Build of the computational parts of the Flyspeck Project *) + +flyspeck_needs "strictbuild.hl";; +flyspeck_needs "general/flyspeck_lib.hl";; + +(* Tikz *) +flyspeck_needs "../kepler_tex/tikz/tikz.ml";; + +(* graph generator *) +flyspeck_needs ("/../graph_generator/graph_control.hl");; + +(* glpk *) +flyspeck_needs "nonlinear/parse_ineq.hl";; +flyspeck_needs "../glpk/glpk_link.ml";; +flyspeck_needs "../glpk/minorlp/tame_table.ml";; +flyspeck_needs "../glpk/minorlp/OXLZLEZ.ml";; +flyspeck_needs "../glpk/tame_archive/lpproc.ml";; +flyspeck_needs "../glpk/sphere.ml";; +flyspeck_needs "../glpk/tame_archive/hard_lp.ml";; +flyspeck_needs "../glpk/tame_archive/scaffolding.hl";; + +flyspeck_needs "../glpk/tame_archive/build_lp.hl";; + +(* formal lp see formal_lp/README.txt for installation instructions. *) +(* +needs "../formal_lp/hypermap/verify_all.hl";; +let result = Verify_all.verify_all();; +*) + +(* nonlinear inequalities needs *) +flyspeck_needs "nonlinear/ineq.hl";; +flyspeck_needs "nonlinear/lemma.hl";; (* indep of Ineq *) +flyspeck_needs "nonlinear/functional_equation.hl";; (* indep of Ineq *) +flyspeck_needs "nonlinear/parse_ineq.hl";; +flyspeck_needs "nonlinear/optimize.hl";; +flyspeck_needs "nonlinear/auto_lib.hl";; +flyspeck_needs "../glpk/sphere.ml";; +flyspeck_needs "nonlinear/check_completeness.hl";; +flyspeck_needs "nonlinear/scripts.hl";; + + + + +module Computational_build = struct + + open Flyspeck_lib;; + +(* tex generation Tikz figures. /tmp/x.txt *) + + let tikz_out = Tikz.execute();; + +(* graph generator (informal java) *) + + let java_found = exists_pgm "java";; + + + let graph_control_out = Graph_control.execute();; + +(* run on April 13, 2012. Output saved to string_archive.txt *) + +(* glpk (informal) *) + + let glpsol_found = exists_pgm "glpsol";; + +(* tests consistency of lp computed b table with values in graph_control.flyspeck_properties *) + let tame_table_out = Tame_table.execute();; + let oxlzlez_informal_out = Oxlzlez_informal.execute();; + let build_lp_out = Build_lp.execute();; + +(* cfsqp (informal) *) + +(* returns list that fail to compile or that are negative *) + let cfsqp_out = Scripts.execute_cfsqp();; + + +(* nonlinear (informal) *) + + let interval_out = Scripts.execute_interval_allbutdodec true;; + + let check_completeness_out = Check_completeness.execute();; + + +(* nonlinear informal prep.hl form *) + + let mk_prep_hl = Preprocess.exec();; (* generate /tmp/prep.hl *) + + let preplist = ref [];; + let add_inequality t = (preplist:= t::!preplist);; + let getprep idv = filter (fun t -> (t.idv = idv)) (!preplist);; + + flyspeck_needs "nonlinear/prep.hl";; (* load after add_inequality has been defined *) + List.length !preplist;; + + let testprep_idq ex idq = + let (s,tags,ineq) = Optimize.idq_fields idq in + Auto_lib.execute_interval ex tags s ineq;; + + let testprep ex s = testprep_idq ex (hd (getprep s));; + + let runprep cases = + map (fun t -> try (testprep true t) with Failure _ -> ()) cases;; + +(* runprep (map fst Scripts.fast_cases);; *) + + + end;; + diff --git a/text_formalization/fan/CFYXFTY.hl b/text_formalization/fan/CFYXFTY.hl new file mode 100644 index 0000000..7ed5d1e --- /dev/null +++ b/text_formalization/fan/CFYXFTY.hl @@ -0,0 +1,1455 @@ + +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================= *) + + + + +module Cfyxfty = struct + + + + + + + + + +open Sphere;; +open Fan_defs;; +open Hypermap;; +open Vol1;; +open Fan;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Sphere;; +open Hypermap;; +open Fan;; +open Topology;; +open Polyhedron;; +open Prove_by_refinement;; +open Nkezbfc_local;; + + + +let EDGES0_FAN=new_definition`EDGES0_FAN (p:real^3->bool) f1={e | e IN (edges p) /\ ~(aff_gt {vec 0} e INTER closure(fchanged f1)={})}`;; + + + + +let CONVEX_CLOSURE_DARTSET_LEADS_INTO_FAN=prove(` +!p:real^3->bool f1:real^3#real^3#real^3#real^3->bool U:real^3->bool. + bounded p /\ polyhedron p /\ vec 0 IN interior p +/\ f1 IN face_set (hypermap1_of_fanx (vec 0,vertices p,edges p)) +/\ +dartset_leads_into_fan (vec 0) (vertices p) (edges p) f1 =U +==> convex(closure U)`, + +REPEAT STRIP_TAC +THEN MRESA_TAC POLYHEDRON_FAN[`p:real^3->bool`;`vec 0:real^3`] +THEN MRESA1_TAC CARD_SET_OF_EDGE_INEQ_1_POLYHEDRON`p:real^3->bool` +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN MRESA1_TAC POLYTOPE_FAN80`p:real^3->bool` +THEN MRESAL_TAC PIIJBJK[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;][conforming_fan;conforming_half_space_fan] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`f1:real^3#real^3#real^3#real^3->bool`) +THEN MATCH_MP_TAC CONVEX_CLOSURE +THEN MATCH_MP_TAC CONVEX_INTERS +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MESON_TAC[CONVEX_AFF_GT]);; + + +let WBLARHH_BIJ = prove_by_refinement( + `!p:real^3->bool. bounded p /\ polyhedron p /\ vec 0 IN interior p ==> + (BIJ + (dartset_leads_into_fan (vec 0) (vertices p) (edges p)) + (face_set (hypermap1_of_fanx(vec 0,vertices p,edges p))) + (topological_component_yfan (vec 0,vertices p, edges p)))`, + (* {{{ proof *) + [ +REWRITE_TAC [BIJ;INJ;SURJ;IN;IN_ELIM_THM]; +GEN_TAC ; +STRIP_TAC ; +MRESA_TAC (REWRITE_RULE[IN] POLYHEDRON_FAN) [`p:real^3->bool`;`vec 0:real^3`]; +MRESA1_TAC (REWRITE_RULE[IN] CARD_SET_OF_EDGE_INEQ_1_POLYHEDRON)`p:real^3->bool`; + MRESA1_TAC (REWRITE_RULE[IN] POLYTOPE_FAN80) `p:real^3->bool`; +MRESA_TAC (REWRITE_RULE[IN] dartset_leads_into_is_topological_component_yfan) [`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`]; + MRESAL_TAC (REWRITE_RULE[IN] Conforming.PIIJBJK)[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;][REWRITE_RULE[IN] Conforming.conforming_fan;REWRITE_RULE[IN] Conforming.conforming_bijection_fan]; +ASM_MESON_TAC [] + ]);; + (* }}} *) + + + + + + +let CONVEX_CLOSURE_FCHANGED=prove(`!p:real^3->bool f U. + bounded (p:real^3->bool) /\ polyhedron p /\ vec 0 IN interior p +/\ f facet_of p /\ + fchanged f= U +==> convex(closure U)`, +REPEAT STRIP_TAC +THEN MRESA_TAC Polyhedron.FCHANGED_IN_COMPONENT[`f:real^3->bool`;`p:real^3->bool`] +THEN MRESAL1_TAC WBLARHH_BIJ`p:real^3->bool`[BIJ;SURJ] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`U:real^3->bool`) +THEN MRESAL1_TAC WBLARHH`p:real^3->bool`[] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3->bool`) +THEN MRESA_TAC CONVEX_CLOSURE_DARTSET_LEADS_INTO_FAN[`p:real^3->bool`; `y:real^3#real^3#real^3#real^3->bool`;` U:real^3->bool`] );; + + +let GINGUAP=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ conforming_fan (x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> convex(dartset_leads_into_fan x V E ds)`, + +REWRITE_TAC[conforming_fan;conforming_half_space_fan] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th`ds:real^3#real^3#real^3#real^3->bool`) +THEN MATCH_MP_TAC CONVEX_INTERS +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[CONVEX_AFF_GT]);; + + + + + + +let AFF_GT_SUBSET_DARTSET_LEADS_INTO= prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y z. +FAN(x,V,E) +/\ conforming_fan (x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set (hypermap1_of_fanx (x,V,E)) +/\ y IN dartset_leads_into_fan x V E ds +/\ z IN dartset_leads_into_fan x V E ds +==> aff_gt {x} {y,z} SUBSET dartset_leads_into_fan x V E ds`, +REPEAT STRIP_TAC +THEN MRESA_TAC Planarity.dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:(real^3#real^3#real^3#real^3->bool)`] +THEN MRESA_TAC nonsetedge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`dartset_leads_into_fan x V E ds`;` z:real^3`] +THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`dartset_leads_into_fan x V E ds`;` y:real^3`] +THEN MRESAL_TAC GINGUAP[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:(real^3#real^3#real^3#real^3->bool)`][CONVEX_CONTAINS_SEGMENT] +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`y:real^3`;`z:real^3`][segment;SUBSET;IN_ELIM_THM]) +THEN SUBGOAL_THEN`(!t. &0 < t /\ t < &1 ==> (&1 - t) % y + t % z IN yfan (x:real^3,V:real^3->bool,E))` ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "LINH" (fun th-> MRESA1_TAC th`(&1 - t) % y + t % z:real^3`) +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`(?u. (&0 <= u /\ u <= &1) /\ + (&1 - t) % y + t % z = (&1 - u) % y + u % z:real^3)` ASSUME_TAC +THENL[ +EXISTS_TAC`t:real` +THEN REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC Planarity.dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:(real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]; +MRESAL_TAC Planarity.aff_gt_subset_component_y_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`dartset_leads_into_fan x V E ds`;`y:real^3`;`z:real^3`][SET_RULE`DISJOINT {x} {y, z}<=> ~(x=y) /\ ~(x=z)`;SUBSET]]);; + + +let FACET_SUBSET_CLOSURE_FCHANGED=prove(`!p:real^3->bool f. + bounded (p:real^3->bool) /\ polyhedron p /\ vec 0 IN interior p +/\ f facet_of p +==> f SUBSET closure(fchanged f)`, + +REPEAT STRIP_TAC +THEN MRESA_TAC Polyhedron.RELATIVE_SUBSET_FCHANGE[`p:real^3->bool`;`vec 0:real^3`;`f:real^3->bool`] +THEN MRESA_TAC FACET_OF_IMP_FACE_OF[`f:real^3->bool`;`p:real^3->bool`] +THEN MRESA_TAC FACE_OF_POLYHEDRON_POLYHEDRON[`p:real^3->bool`;`f:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[POLYHEDRON_EQ_FINITE_FACES] +THEN STRIP_TAC +THEN MRESA1_TAC CONVEX_CLOSURE_RELATIVE_INTERIOR`f:real^3->bool` +THEN MRESA_TAC SUBSET_CLOSURE[`relative_interior f:real^3->bool`;`fchanged f:real^3->bool`] +THEN MRESA1_TAC CLOSURE_SUBSET`f:real^3->bool` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + + + + +let MAP_EDGES_FACET_INTO_E1_FAN=prove_by_refinement(`!p:real^3->bool f e. + bounded (p:real^3->bool) /\ polyhedron p /\ vec 0 IN interior p +/\ f facet_of p +/\ e IN edges f +==> e IN EDGES0_FAN p f `, + +[ REWRITE_TAC[EDGES0_FAN;IN_ELIM_THM;edges] +THEN REPEAT STRIP_TAC; +ASM_TAC +THEN REWRITE_TAC[edge_of;facet_of] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[] +THEN ASM_MESON_TAC[FACE_OF_TRANS]; +POP_ASSUM MP_TAC +THEN MRESA_TAC FACET_SUBSET_CLOSURE_FCHANGED[`p:real^3->bool`;`f:real^3->bool`] +THEN MRESA_TAC EDGE_OF_IMP_SUBSET[`segment [v,w:real^3]`;`f:real^3->bool`] +THEN MRESA_TAC SEGMENT_OPEN_SUBSET_CLOSED[`v:real^3`;`w:real^3`] +THEN MRESA_TAC SEGMENT_EDGE_OF[`f:real^3->bool`;`v:real^3`;`w:real^3`] +THEN ABBREV_TAC`t= &1/ &2 % v+ &1/ &2 % w:real^3` +THEN SUBGOAL_THEN`?u1. &0 < u1 /\ u1 < &1 /\ t = (&1 - u1) % v + u1 % w:real^3` +ASSUME_TAC; +EXISTS_TAC`&1/ &2` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - &1/ &2= &1/ &2`] +THEN REAL_ARITH_TAC; +MRESA_TAC IN_SEGMENT[`v:real^3`;`w:real^3`;`t:real^3`] +THEN SUBGOAL_THEN`t IN closure(fchanged f:real^3->bool)`ASSUME_TAC; +ASM_TAC +THEN SET_TAC[]; +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;INTER;IN_ELIM_THM] +THEN EXISTS_TAC`t:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC facet_of[`f:real^3->bool`;`p:real^3->bool`] +THEN MRESA_TAC EXTREME_POINT_OF_FACE[`f:real^3->bool`;`p:real^3->bool`;`v:real^3`] +THEN MRESA_TAC EXTREME_POINT_OF_FACE[`f:real^3->bool`;`p:real^3->bool`;`w:real^3`] +THEN MRESA_TAC EXTREME_POINT_NOT_IN_INTERIOR[`p:real^3->bool`;`v:real^3`] +THEN MRESA_TAC EXTREME_POINT_NOT_IN_INTERIOR[`p:real^3->bool`;`w:real^3`] +THEN MP_TAC(SET_RULE`~(v IN interior p) /\ ~(w IN interior p) /\ (vec 0 IN interior p)==> DISJOINT{vec 0} {v,w:real^3}`) +THEN RESA_TAC +THEN MRESAL_TAC AFF_GT_1_2[`vec 0:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1/ &2` +THEN EXISTS_TAC`&1/ &2` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a % vec 0+ A+B=A+B`] +THEN REAL_ARITH_TAC]);; + +let LIM_NULL_CMUL_BOUNDED_FAN = prove + (`!f g:A->real^N B net. + eventually (\a. abs(f a) < B) net /\ + (g --> vec 0) net + ==> ((\n. f n % g n) --> vec 0) net`, + REPEAT GEN_TAC THEN REWRITE_TAC[tendsto] THEN STRIP_TAC THEN + X_GEN_TAC `e:real` THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `e / (abs B + &1)`) THEN + ASM_SIMP_TAC[REAL_LT_DIV; REAL_ARITH `&0 < abs x + &1`] THEN + UNDISCH_TAC `eventually (\a. abs(f a) < B) (net:(A net))` THEN + REWRITE_TAC[IMP_IMP; GSYM EVENTUALLY_AND] THEN + MATCH_MP_TAC(REWRITE_RULE[IMP_CONJ] EVENTUALLY_MP) THEN + REWRITE_TAC[dist; VECTOR_SUB_RZERO; o_THM; NORM_LIFT; NORM_MUL] THEN + MATCH_MP_TAC ALWAYS_EVENTUALLY THEN X_GEN_TAC `x:A` THEN REWRITE_TAC[] THEN + STRIP_TAC THEN MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `B * e / (abs B + &1)` THEN + ASM_SIMP_TAC[REAL_LE_MUL2; REAL_ABS_POS; NORM_POS_LE; REAL_LT_IMP_LE] THEN + REWRITE_TAC[REAL_ARITH `c * (a / b) = (c * a) / b`] THEN + SIMP_TAC[REAL_LT_LDIV_EQ; REAL_ARITH `&0 < abs x + &1`] THEN + MATCH_MP_TAC(REAL_ARITH + `e * B <= e * abs B /\ &0 < e ==> B * e < e * (abs B + &1)`) THEN + ASM_SIMP_TAC[REAL_LE_LMUL_EQ] THEN REAL_ARITH_TAC);; + + + + + +let MAP_EDGES_FACET_INTO_E1_FAN_INJ=prove_by_refinement(`!p:real^3->bool f e. + bounded (p:real^3->bool) /\ polyhedron p /\ vec 0 IN interior p +/\ f facet_of p +/\ e IN EDGES0_FAN p f +==> e IN edges f`, +[REWRITE_TAC[EDGES0_FAN;IN_ELIM_THM;SET_RULE`~(A={})<=> ?a. a IN A`;INTER] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`e IN edges (p:real^3->bool)` +THEN REWRITE_TAC[edges;IN_ELIM_THM;edge_of] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CLOSURE_SEQUENTIAL;fchanged;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SKOLEM_THM;] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC CONVERGENT_IMP_CAUCHY[`x:num->real^3`;`a:real^3`][cauchy] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC FACET_OF_POLYHEDRON[`p:real^3->bool`;`f:real^3->bool`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC(SYM th)) +THEN SUBGOAL_THEN`!n. a' dot (v1:num->real^3) n=b:real ` ASSUME_TAC; +MRESA1_TAC RELATIVE_INTERIOR`f:real^3->bool` +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;IN_ELIM_THM] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[SYM th;IN_ELIM_THM;INTER] THEN REPEAT STRIP_TAC) +THEN ASM_TAC +THEN SET_TAC[]; +FIND_ASSUM(fun th -> MP_TAC th THEN REWRITE_TAC[facet_of] THEN STRIP_TAC)`f facet_of (p:real^3->bool)` +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`f=p \/ ~(f=p:real^3->bool)`); +ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; +MRESA_TAC FACE_OF_DISJOINT_INTERIOR[`f:real^3->bool`;`p:real^3->bool`] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(b= &0) \/ ~(b= &0)`); +SUBGOAL_THEN`vec 0 IN (f:real^3->bool)`ASSUME_TAC; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;INTER;IN_ELIM_THM;DOT_RZERO]) +THEN STRIP_TAC +THEN RESA_TAC +THEN MRESA1_TAC INTERIOR_SUBSET`p:real^3->bool` +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN SET_TAC[]; + ASM_TAC +THEN SET_TAC[]; +SUBGOAL_THEN`(lift o (t:num->real) --> lift(inv b *(a' dot a:real^3))) sequentially`ASSUME_TAC; +MRESAL_TAC CONTINUOUS_ON_LIFT_DOT[`(:real^3)`;`a':real^3`;][GSYM CONVERGENT_EQ_CAUCHY] +THEN MRESA_TAC CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN[`lift o (\y. (a':real^3) dot y)`;`(:real^3)`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`a:real^3`[SET_RULE`(a:real^3) IN (:real^3)`]) +THEN MRESA_TAC (GEN_ALL CONTINUOUS_WITHIN_SEQUENTIALLY)[`(:real^3)`;`lift o (\y. (a':real^3) dot y)`;`(a:real^3)`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x:num->real^3`[SET_RULE`(a:real^3) IN (:real^3)`;o_DEF;DOT_RMUL]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[LIM_SEQUENTIALLY;dist;GSYM LIFT_SUB;NORM_LIFT] +THEN DISCH_THEN(LABEL_TAC"HA") +THEN REPEAT STRIP_TAC +THEN MRESA1_TAC REAL_ABS_CASES`b:real` +THEN MRESA1_TAC REAL_LT_INV`abs (b:real)` +THEN MRESA_TAC REAL_LT_MUL[`(abs b)`;`e':real`] +THEN REMOVE_THEN "HA" (fun th-> MRESA1_TAC th`abs b * e'`) +THEN EXISTS_TAC`N:num` +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"THY"(fun th-> MRESA1_TAC th `n:num`) +THEN MP_TAC(REAL_ARITH`&0< abs b==> ~(abs b= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`abs b` +THEN MRESA1_TAC REAL_MUL_LINV`b:real` +THEN MRESAL_TAC REAL_LT_LMUL[`inv(abs b)`;`abs (((t:num->real) n) * b - a' dot (a:real^3))`;`(abs b) * e'`][REAL_ARITH`A*B*C=(A*B)*C/\ &1 *A=A`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[GSYM REAL_ABS_INV;GSYM REAL_ABS_MUL;REAL_ARITH`A*(b*c- D)= (A*c)* b- A*D/\ &1 * A=A`]; +SUBGOAL_THEN`!n:num. (v1 n) IN (f:real^3->bool)`ASSUME_TAC; +MRESA1_TAC RELATIVE_INTERIOR`f:real^3->bool` +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;IN_ELIM_THM] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`n:num`) +THEN ASM_REWRITE_TAC[]; +MRESA_TAC FACET_OF_IMP_SUBSET[`f:real^3->bool`;`p:real^3->bool`] +THEN SUBGOAL_THEN `!n. norm ((v1:num->real^3) n) <= diameter (p:real^3->bool)` ASSUME_TAC; +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`n:num`) +THEN STRIP_TAC +THEN MRESA1_TAC INTERIOR_SUBSET`p:real^3->bool` +THEN MP_TAC(SET_RULE`vec 0 IN interior p /\ interior p SUBSET p==> vec 0 IN p:real^3->bool`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`(v1:num->real^3) n IN f /\ f SUBSET p:real^3->bool==> v1 n IN p`) +THEN RESA_TAC +THEN MRESA1_TAC DIAMETER_BOUNDED`p:real^3->bool` +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`(v1:num->real^3) n`;`(vec 0):real^3`][VECTOR_ARITH`A- vec 0=A`]); +DISJ_CASES_TAC(SET_RULE`a' dot (a:real^3)= &0 \/ ~(a' dot (a:real^3)= &0)`); + SUBGOAL_THEN(`(x --> (vec 0:real^3)) sequentially`) ASSUME_TAC; +ASM_REWRITE_TAC[LIM_SEQUENTIALLY;dist;NORM_LIFT;VECTOR_ARITH`A- vec 0=A`;NORM_MUL] +THEN REPEAT STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`(lift o t --> lift (inv b * (a' dot (a:real^3)))) sequentially` +THEN REWRITE_TAC[LIM_SEQUENTIALLY;dist;GSYM LIFT_SUB;o_DEF;NORM_LIFT] +THEN ASM_REWRITE_TAC[REAL_ARITH`A- B * &0=A`] +THEN SUBGOAL_THEN`&0< diameter (p:real^3->bool)` ASSUME_TAC; +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`a1:num`) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`a1:num`) +THEN MP_TAC(SET_RULE`(v1:num->real^3) a1 IN f /\ f INTER interior p = {} /\ vec 0 IN interior p==> ~(v1 a1 = vec 0)`) +THEN RESA_TAC +THEN MRESA1_TAC NORM_POS_LT`(v1:num->real^3) a1` +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +MRESA1_TAC REAL_LT_INV`diameter (p:real^3->bool)` +THEN MRESA_TAC REAL_LT_MUL[`inv (diameter (p:real^3->bool))`;`e':real`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`inv (diameter (p:real^3->bool)) * e'`) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"HA") +THEN EXISTS_TAC`N:num` +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"HA"(fun th-> MRESA1_TAC th`n:num`) +THEN MP_TAC(REAL_ARITH`&0 < diameter (p:real^3->bool)==> ~(diameter p= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`(diameter (p:real^3->bool))` +THEN MRESAL_TAC REAL_LT_LMUL[`(diameter (p:real^3->bool))`;`abs ((t:num->real) n)`;`inv (diameter (p:real^3->bool)) * e'`][REAL_ARITH`A*B*C=(B*A)*C/\ &1 *A=A`] +THEN MRESAL_TAC REAL_LE_LMUL[`abs ((t:num->real) n)`;`norm ((v1:num->real^3) n)`;`(diameter (p:real^3->bool))`][REAL_ARITH`A*B*C=(B*A)*C/\ &1 *A=A`;REAL_ABS_POS] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +MRESAL_TAC LIM_UNIQUE[`sequentially`;`x:num-> real^3`;`a:real^3`;`vec 0:real^3`][TRIVIAL_LIMIT_SEQUENTIALLY] +THEN MRESA_TAC SEGMENT_FACE_OF[`p:real^3->bool`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC EXTREME_POINT_NOT_IN_INTERIOR[`p:real^3->bool`;`v:real^3`] +THEN MRESA_TAC EXTREME_POINT_NOT_IN_INTERIOR[`p:real^3->bool`;`w:real^3`] +THEN MP_TAC(SET_RULE`~(v IN interior p) /\ ~(w IN interior p) /\ (vec 0 IN interior p)==> DISJOINT{vec 0} {v,w:real^3}`) +THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`(vec 0 IN aff_gt {vec 0} {v, w:real^3}) \/ ~(vec 0 IN aff_gt {vec 0} {v, w})`); +POP_ASSUM MP_TAC + THEN MRESAL_TAC AFF_GT_1_2[`vec 0:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM;VECTOR_ARITH`vec 0= t % vec 0 +A+B<=> A+B=vec 0`] +THEN REPEAT STRIP_TAC; +SUBGOAL_THEN`vec 0 IN segment[v,w:real^3]`ASSUME_TAC; +REMOVE_ASSUM_TAC +THEN ASM_REWRITE_TAC[IN_SEGMENT] +THEN EXISTS_TAC`inv (&1- t1) * t3` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A+B+C= &1<=> B+C= &1- A`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0< t2 /\ &0< t3 ==> ~(t2+ t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`&1 - t1` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`t2 % v + t3 % w = vec 0:real^3 ==> (inv (t2+t3))%(t2 % v+ t3 % w) = (inv (t2+t3))%(vec 0)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a % vec 0= vec 0/\ A %(B+C)=A % B+A %C/\ A % D %C=(A*D)%C`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`t2+ t3= &1- t1 ==> (inv (&1 - t1))*(t2 +t3) = (inv (&1-t1))*( &1- t1)`) +THEN POP_ASSUM (fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN REWRITE_TAC[] +THEN DISCH_THEN(LABEL_TAC"HA") +THEN STRIP_TAC +THEN STRIP_TAC +THEN REMOVE_THEN "HA" MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1 <=> A*B= &1 - A*C`] +THEN RESA_TAC +THEN ASSUME_TAC th) +THEN MP_TAC(REAL_ARITH`&0< t2 /\ &0< t3 ==> &0 < t2+ t3`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`&1 - t1` +THEN MRESA_TAC REAL_LT_MUL[`inv(&1 -t1)`;`t3:real`] +THEN MRESA_TAC REAL_LT_MUL[`inv(&1 -t1)`;`t2:real`] +THEN MP_TAC(REAL_ARITH`&0 < inv (&1 - t1) * t3==> &0 <= inv (&1 - t1) * t3`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +DISJ_CASES_TAC(SET_RULE`(segment [v,w] = p) \/ ~(segment [v,w:real^3] = p)`); +POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC Polyhedron.AFF_DIM_INTERIOR_EQ_3[`vec 0:real^3`;`p:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MRESA_TAC FACE_OF_DISJOINT_INTERIOR[`segment[v,w:real^3]`;`p:real^3->bool`] +THEN ASM_TAC +THEN SET_TAC[]; +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN FIND_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)`e={v,w:real^3}` +THEN ASM_TAC +THEN SET_TAC[]; +MRESA1_TAC REAL_INV_EQ_0`b:real` +THEN MRESA_TAC Trigonometry2.NOT_MUL_EQ0_EQ[`inv b`;`a' dot (a:real^3)`] +THEN MRESA_TAC LIM_INV[`sequentially`;`t:num->real`;`inv b * (a' dot a:real^3)`] +THEN MRESA_TAC CONVERGENT_IMP_BOUNDED[`lift o inv o (t:num->real)`; `lift (inv(inv b * (a' dot (a:real^3))))`] +THEN MRESAL_TAC tendsto[`lift o inv o (t:num->real)`; `lift (inv(inv b * (a' dot (a:real^3))))`;`sequentially`][o_DEF;dist;GSYM LIFT_SUB;NORM_LIFT] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`&1`[REAL_ARITH`&0< &1`]) +THEN MRESAL_TAC LIM_NULL_CMUL_BOUNDED_FAN[`(\n. inv ((t:num->real) n) - inv (inv b * (a' dot a:real^3)))`;`(\n. (x:num->real^3) n -a)`;`&1`;`sequentially`][GSYM LIM_NULL;VECTOR_ARITH`A%(B-C)=A%B-A%C /\ A% D%B=(A*D)%B`] +THEN MRESA_TAC (GEN_ALL LIM_CMUL)[`sequentially`;`x:num->real^3`;`a:real^3`;`inv (inv b * (a' dot (a:real^3)))`] +THEN MRESA_TAC LIM_NULL[`sequentially`;`(\x. inv (inv b * (a' dot a:real^3)) % t x % (v1:num->real^3) x)`;`inv (inv b * (a' dot a)) % a:real^3`] +THEN MRESAL_TAC LIM_ADD[`sequentially`;`(\x. inv (inv b * (a' dot a:real^3)) % t x % (v1:num->real^3) x -inv (inv b * (a' dot a)) % a:real^3)`;`(\n:num. ((inv (t n) - inv (inv b * (a' dot a))) * t n) % v1 n - + (inv (t n) - inv (inv b * (a' dot a))) % a:real^3)`;`vec 0:real^3`;`vec 0:real^3`][VECTOR_ARITH`inv (inv b * (a' dot a)) % t x % v1 x - + inv (inv b * (a' dot a)) % a + + ((inv (t x) - inv (inv b * (a' dot a))) * t x) % v1 x - + (inv (t x) - inv (inv b * (a' dot a))) % a +=(inv (t x) * t x) % v1 x - + (inv (t x) ) % a/\ vec 0+ vec 0= vec 0`] +THEN SUBGOAL_THEN`((\n:num. inv (t n) % a:real^3) --> inv (inv b * (a' dot a)) % a:real^3) sequentially` ASSUME_TAC; +REWRITE_TAC[LIM_SEQUENTIALLY;dist;GSYM VECTOR_SUB_RDISTRIB;NORM_MUL] +THEN DISJ_CASES_TAC(SET_RULE`norm (a:real^3)= &0 \/ ~(norm a= &0)`); +ASM_REWRITE_TAC[REAL_ARITH`A * &0= &0`] +THEN REAL_ARITH_TAC; +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC`(lift o inv o t --> lift (inv (inv b * (a' dot a:real^3)))) sequentially` +THEN REWRITE_TAC[LIM_SEQUENTIALLY;NORM_LIFT;dist;o_DEF;GSYM LIFT_SUB] +THEN MP_TAC(REAL_ARITH`&0<= norm a /\ ~(norm a= &0)==> &0< norm (a:real^3) `) +THEN ASM_REWRITE_TAC[NORM_POS_LE] +THEN STRIP_TAC +THEN MRESA1_TAC REAL_LT_INV`norm (a:real^3)` +THEN MRESA1_TAC REAL_MUL_LINV`norm (a:real^3)` +THEN MRESA_TAC REAL_LT_MUL[`e':real`;`inv(norm (a:real^3))`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th` e' * inv(norm (a:real^3)) :real`) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN EXISTS_TAC`N:num` +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THY"(fun th-> MRESA1_TAC th`n:num`) +THEN MRESAL_TAC REAL_LT_RMUL[`abs (inv (t (n:num)) - inv (inv b * (a' dot (a:real^3))))`;`e' * inv (norm (a:real^3))`;`norm (a:real^3)`][REAL_ARITH`(a*b)*c=a*(b*c)/\ a * &1=a`]; +MRESA_TAC LIM_NULL[`sequentially`;`(\n:num. inv (t n) % (a:real^3))`;`inv (inv b * (a' dot a)) % (a:real^3)`] +THEN MRESAL_TAC LIM_ADD[`sequentially`;`(\x:num. (inv (t x) * t x) % v1 x - inv (t x) % a:real^3)`;`(\x:num. inv (t x) % a - inv (inv b * (a' dot a)) % a:real^3)`;`vec 0:real^3`;`vec 0:real^3`][VECTOR_ARITH` A-B+B-C=A-C:real^3 /\ vec 0+ vec 0= vec 0`] +THEN MRESA_TAC LIM_NULL[`sequentially`;`(\x:num. (inv (t x) * t x) % (v1:num->real^3) x)`;`inv (inv b * (a' dot a)) % (a:real^3)`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`!n:num. inv( t n) * t n= &1 ` ASSUME_TAC; +REPEAT STRIP_TAC +THEN MATCH_MP_TAC REAL_MUL_LINV +THEN MATCH_MP_TAC(REAL_ARITH`A > &0==> ~(A= &0)`) +THEN ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[VECTOR_ARITH`&1 % A=A`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(!n:num. v1 n IN f:real^3->bool) /\ ((\n. v1 n) --> inv (inv b * (a' dot (a:real^3))) % (a:real^3)) sequentially ==> (?v1:num->real^3. (!n:num. v1 n IN f:real^3->bool) /\ (v1 --> inv (inv b * (a' dot (a:real^3))) % (a:real^3)) sequentially)`) +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MRESA_TAC CLOSURE_SEQUENTIAL[`f:real^3->bool`;`inv (inv b * (a' dot (a:real^3))) % (a:real^3)`] +THEN POP_ASSUM MP_TAC +THEN MRESA1_TAC POLYTOPE_EQ_BOUNDED_POLYHEDRON`p:real^3->bool` +THEN MRESA_TAC FACE_OF_POLYTOPE_POLYTOPE[`f:real^3->bool`;`p:real^3->bool`] +THEN MRESA1_TAC POLYTOPE_IMP_CLOSED`f:real^3->bool` +THEN MRESA1_TAC CLOSURE_CLOSED`f:real^3->bool` +THEN REPEAT STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN MP_TAC(SET_RULE`vec 0 IN interior p /\ interior p SUBSET (p:real^3->bool) +/\ p SUBSET {x | a' dot x <= b} ==> a' dot vec 0<= b`) +THEN ASM_REWRITE_TAC[INTERIOR_SUBSET;DOT_RZERO] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0<= b /\ ~(b= &0) ==> &0< b`) +THEN RESA_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`&0< -- (a' dot (a:real^3)) \/ &0<= a' dot (a:real^3)`); +MRESAL_TAC CONTINUOUS_ON_LIFT_DOT[`(:real^3)`;`a':real^3`;][GSYM CONVERGENT_EQ_CAUCHY] +THEN MRESA_TAC CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN[`lift o (\y. (a':real^3) dot y)`;`(:real^3)`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`a:real^3`[SET_RULE`(a:real^3) IN (:real^3)`]) +THEN MRESA_TAC (GEN_ALL CONTINUOUS_WITHIN_SEQUENTIALLY)[`(:real^3)`;`lift o (\y. (a':real^3) dot y)`;`(a:real^3)`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x:num->real^3`[SET_RULE`(a:real^3) IN (:real^3)`;o_DEF;DOT_RMUL]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[LIM_SEQUENTIALLY;dist;GSYM LIFT_SUB;NORM_LIFT] +THEN MP_TAC(REAL_ARITH`&0< --(a' dot (a:real^3))==> &0< --(a' dot (a:real^3))/ &2`) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`--(a' dot (a:real^3))/ &2`) +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`N:num`[ARITH_RULE`N<=N:num`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`(t:num->real) N > &0 ==> &0< t N`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`(t:num->real) N`;`b:real`] +THEN MP_TAC(REAL_ARITH`&0< (t:num->real) N * b /\ &0< --(a' dot (a:real^3)) ==> &0< t N * b- a' dot a`) +THEN RESA_TAC +THEN MRESAL1_TAC (GEN_ALL Trigonometry2.LT_IMP_ABS_REFL)`(t:num->real) N * b- a' dot (a:real^3)`[REAL_ARITH`A - B < -- B/ &2<=> A< B/ &2`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`(t:num->real) N * b < (a' dot (a:real^3))/ &2 /\ &0< --(a' dot (a:real^3)) ==> ~(&0< t N * b)`) +THEN RESA_TAC; +MP_TAC(REAL_ARITH`&0 <= (a' dot (a:real^3)) /\ ~(a' dot (a:real^3)= &0) ==> &0< a' dot a`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`b:real` +THEN MRESA_TAC REAL_LT_MUL[`inv b:real`;`(a' dot (a:real^3)):real`] +THEN MRESA1_TAC REAL_LT_INV`inv b *(a' dot (a:real^3)):real` +THEN MRESA_TAC SEGMENT_FACE_OF[`p:real^3->bool`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC EXTREME_POINT_NOT_IN_INTERIOR[`p:real^3->bool`;`v:real^3`] +THEN MRESA_TAC EXTREME_POINT_NOT_IN_INTERIOR[`p:real^3->bool`;`w:real^3`] +THEN MP_TAC(SET_RULE`~(v IN interior p) /\ ~(w IN interior p) /\ (vec 0 IN interior p)==> DISJOINT{vec 0} {v,w:real^3}`) +THEN RESA_TAC +THEN SUBGOAL_THEN`a IN aff_gt {vec 0} {v,w:real^3}` ASSUME_TAC; +ASM_MESON_TAC[]; +MRESA_TAC Planarity.scale_aff_gt_fan[`vec 0:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`a:real^3`;`inv (inv b * (a' dot (a:real^3)))`][VECTOR_ARITH`a- vec 0= a /\ a+ vec 0=a`]) +THEN DISJ_CASES_TAC(SET_RULE`inv (inv b * (a' dot a)) % a IN relative_interior f \/ ~(inv (inv b * (a' dot a)) % a IN relative_interior (f:real^3->bool) )`); +SUBGOAL_THEN `inv (inv b * (a' dot a)) % a IN fchanged (f:real^3->bool)`ASSUME_TAC; +REWRITE_TAC[fchanged;IN_ELIM_THM] +THEN EXISTS_TAC`inv (inv b * (a' dot a)) % a:real^3` +THEN EXISTS_TAC `&1` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1> &0`;] +THEN VECTOR_ARITH_TAC; +MRESA1_TAC Polyhedron.FCHANGED_EQ_YFAN`p:real^3->bool` +THEN SUBGOAL_THEN` fchanged f SUBSET yfan (vec 0,vertices p,edges (p:real^3->bool))`ASSUME_TAC; +POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;UNIONS;IN_ELIM_THM;SUBSET]) +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`fchanged f:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`f:real^3->bool` +THEN ASM_REWRITE_TAC[]; +SUBGOAL_THEN `{v, w:real^3} IN edges p` ASSUME_TAC; +ASM_REWRITE_TAC[IN_ELIM_THM;edges] +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[edge_of]; +MRESA_TAC Planarity.AFF_GE_SUBSET_XFAN[`vec 0:real^3`;`vertices p:real^3->bool`;`edges (p:real^3->bool)`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{vec 0:real^3}`;`{v,w:real^3}`] +THEN MP_TAC(SET_RULE`aff_ge {vec 0} {v, w} SUBSET xfan (vec 0,vertices p,edges p)/\ aff_gt {vec 0} {v, w} SUBSET aff_ge {vec 0} {v, w} +/\ inv (inv b * (a' dot a)) % a IN aff_gt {vec 0} {v, w} +==> inv (inv b * (a' dot a)) % a IN xfan (vec 0,vertices p,edges (p:real^3->bool))`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`inv (inv b * (a' dot a)) % a IN fchanged f +/\ fchanged f SUBSET yfan (vec 0,vertices p,edges p) +==> inv (inv b * (a' dot a)) % a IN yfan (vec 0,vertices p,edges (p:real^3->bool))`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[yfan;IN_ELIM_THM; DIFF]; +POP_ASSUM MP_TAC +THEN MRESA_TAC FACE_OF_POLYHEDRON_POLYHEDRON[`p:real^3->bool`;`f:real^3->bool`] +THEN MRESA1_TAC RELATIVE_INTERIOR_OF_POLYHEDRON`f:real^3->bool` +THEN ASM_REWRITE_TAC[DIFF;IN_ELIM_THM;DE_MORGAN_THM;UNIONS;] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`?v w. {v,w} IN edges (p:real^3->bool) /\ u = segment[v,w]`ASSUME_TAC; + FIND_ASSUM MP_TAC`u facet_of (f:real^3->bool)` +THEN FIND_ASSUM MP_TAC`f facet_of (p:real^3->bool)` +THEN REWRITE_TAC[facet_of] +THEN ASM_REWRITE_TAC[edges;IN_ELIM_THM;edge_of] +THEN MRESA_TAC Polyhedron.AFF_DIM_INTERIOR_EQ_3[`vec 0:real^3`;`p:real^3->bool`] +THEN RESA_TAC +THEN REWRITE_TAC[ARITH_RULE`&3 - &1- &1= &1:int`] +THEN RESA_TAC +THEN MRESA_TAC FACE_OF_TRANS[`u:real^3->bool`;`f:real^3->bool`;`p:real^3->bool`] +THEN MRESA_TAC Polyhedron.EXPAND_EDGE_POLYTOPE[`u:real^3->bool`;`p:real^3->bool`] +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`a'':real^3` +THEN EXISTS_TAC`b':real^3` +THEN REWRITE_TAC[] +THEN EXISTS_TAC`a'':real^3` +THEN EXISTS_TAC`b':real^3` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC FACET_OF_IMP_FACE_OF[`u:real^3->bool`;`f:real^3->bool`] +THEN MRESA_TAC FACE_OF_TRANS[`u:real^3->bool`;`f:real^3->bool`;`p:real^3->bool`] +THEN SUBGOAL_THEN`segment [v',w'] SUBSET aff_ge {vec 0} {v',w':real^3}` ASSUME_TAC; +MRESA_TAC SEGMENT_FACE_OF[`p:real^3->bool`;`v':real^3`;`w':real^3`] +THEN MRESA_TAC EXTREME_POINT_NOT_IN_INTERIOR[`p:real^3->bool`;`v':real^3`] +THEN MRESA_TAC EXTREME_POINT_NOT_IN_INTERIOR[`p:real^3->bool`;`w':real^3`] +THEN MP_TAC(SET_RULE`~(v' IN interior p) /\ ~(w' IN interior p) /\ (vec 0 IN interior p)==> DISJOINT{vec 0} {v',w':real^3}`) +THEN RESA_TAC +THEN MRESAL_TAC Polyhedron.in_aff_ge_fan[`vec 0:real^3`;`v':real^3`;`w':real^3`] +[segment;SUBSET;IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THY"(fun th-> MRESA1_TAC th `u':real`); + MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{vec 0:real^3}`;`{v,w:real^3}`] +THEN MP_TAC(SET_RULE` aff_gt {vec 0} {v, w} SUBSET aff_ge {vec 0} {v, w} +/\ inv (inv b * (a' dot a)) % a IN aff_gt {vec 0} {v, w} +==> inv (inv b * (a' dot a)) % a IN aff_ge {vec 0} {v, w:real^3}`) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` inv (inv b * (a' dot a)) % a IN segment[v',w'] +/\ segment[v',w'] SUBSET aff_ge {vec 0} {v', w'} +/\ inv (inv b * (a' dot a)) % a IN aff_ge {vec 0} {v, w:real^3} +==> inv (inv b * (a' dot a)) % a IN aff_ge {vec 0} {v', w':real^3} INTER aff_ge {vec 0} {v,w}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC POLYHEDRON_FAN[`p:real^3->bool`;`vec 0:real^3`][FAN;fan7;UNION;IN_ELIM_THM] +THEN POP_ASSUM(fun th-> MRESA_TAC th [`{v',w':real^3}`;`e:(real^3->bool)`]) +THEN MRESA1_TAC Polyhedron.POLYTOPE_FAN80`p:real^3->bool` +THEN MRESA1_TAC Polyhedron.CARD_SET_OF_EDGE_INEQ_1_POLYHEDRON`p:real^3->bool` +THEN DISJ_CASES_TAC(SET_RULE`{v', w'} INTER {v, w:real^3} = {} \/ ~({v', w'} INTER {v, w} = {})`); +MP_TAC(REAL_ARITH`&0 < inv (inv b * (a' dot (a:real^3)))==> ~(inv (inv b * (a' dot a))= &0)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING;IN_SING;VECTOR_MUL_EQ_0] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;DOT_RZERO]); +POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={}) <=> ?v1. v1 IN A`] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ INTER;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`v1' IN {v',w':real^3} ==> v1'= v' \/ v1'= w'`) +THEN RESA_TAC; +STRIP_TAC +THEN MP_TAC(SET_RULE`v' IN {v,w:real^3} ==> v'= v \/ v'= w`) +THEN RESA_TAC; +DISJ_CASES_TAC(SET_RULE`~(w'=w) \/ w'=w:real^3`); +MP_TAC(SET_RULE`~(w'=w:real^3) ==>{x | x IN {v, w'} /\ x IN {v, w}}= {v}`) +THEN RESA_TAC +THEN MRESA_TAC POLYHEDRON_FAN[`p:real^3->bool`;`vec 0:real^3`] +THEN MRESA_TAC Conforming.properties12_fan7[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`] +THEN MRESA_TAC properties_of_graph[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;`w':real^3`;`v':real^3`] +THEN MP_TAC(SET_RULE` e IN edges p /\ v IN vertices p +/\ UNIONS {aff_gt {vec 0:real^3} e' | e' IN edges (p:real^3->bool)} INTER UNIONS {aff_ge {vec 0} {v} | v IN vertices p}= {} ==> aff_gt {vec 0:real^3} e INTER aff_ge {vec 0:real^3} {v}= {}`) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`inv (inv b * (a' dot a)) % a IN aff_gt {vec 0} {v, w} +/\ inv (inv b * (a' dot a)) % a IN aff_ge {vec 0} {v} +==> ~(aff_gt {vec 0:real^3} {v,w} INTER aff_ge {vec 0:real^3} {v}= {})`) +THEN RESA_TAC; +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN ASM_REWRITE_TAC[]; +DISJ_CASES_TAC(SET_RULE`~(w'=v) \/ w'=v:real^3`); +MP_TAC(SET_RULE`~(w'=v:real^3) ==>{x | x IN {w, w'} /\ x IN {v, w}}= {w}`) +THEN RESA_TAC +THEN MRESA_TAC POLYHEDRON_FAN[`p:real^3->bool`;`vec 0:real^3`] +THEN MRESA_TAC Conforming.properties12_fan7[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`] +THEN MRESA_TAC properties_of_graph[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;`w':real^3`;`v':real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE` e IN edges p /\ w IN vertices p +/\ UNIONS {aff_gt {vec 0:real^3} e' | e' IN edges (p:real^3->bool)} INTER UNIONS {aff_ge {vec 0} {v} | v IN vertices p}= {} ==> aff_gt {vec 0:real^3} e INTER aff_ge {vec 0:real^3} {w}= {}`) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`inv (inv b * (a' dot a)) % a IN aff_gt {vec 0} {v, w} +/\ inv (inv b * (a' dot a)) % a IN aff_ge {vec 0} {w} +==> ~(aff_gt {vec 0:real^3} {v,w} INTER aff_ge {vec 0:real^3} {w}= {})`) +THEN RESA_TAC; +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN ONCE_REWRITE_TAC[SEGMENT_SYM] +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THEN MP_TAC(SET_RULE`w' IN {v,w:real^3} ==> w'= v \/ w'= w`) +THEN RESA_TAC; +DISJ_CASES_TAC(SET_RULE`~(v'=w) \/ v'=w:real^3`); +MP_TAC(SET_RULE`~(v'=w:real^3) ==>{x | x IN {v', v} /\ x IN {v, w}}= {v}`) +THEN RESA_TAC +THEN MRESA_TAC Conforming.properties12_fan7[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC POLYHEDRON_FAN[`p:real^3->bool`;`vec 0:real^3`] +THEN MRESA_TAC properties_of_graph[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THY" MP_TAC +THEN RESA_TAC +THEN MP_TAC(SET_RULE` e IN edges p /\ v IN vertices p +/\ UNIONS {aff_gt {vec 0:real^3} e' | e' IN edges (p:real^3->bool)} INTER UNIONS {aff_ge {vec 0} {v} | v IN vertices p}= {} ==> aff_gt {vec 0:real^3} e INTER aff_ge {vec 0:real^3} {v}= {}`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`inv (inv b * (a' dot a)) % a IN aff_gt {vec 0} {v, w} +/\ inv (inv b * (a' dot a)) % a IN aff_ge {vec 0} {v} +==> ~(aff_gt {vec 0:real^3} {v,w} INTER aff_ge {vec 0:real^3} {v}= {})`) +THEN RESA_TAC; +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN ONCE_REWRITE_TAC[SEGMENT_SYM] +THEN ASM_REWRITE_TAC[]; +DISJ_CASES_TAC(SET_RULE`~(v'=v) \/ v'=v:real^3`); +MP_TAC(SET_RULE`~(v'=v:real^3) ==>{x | x IN {v', w} /\ x IN {v, w}}= {w}`) +THEN RESA_TAC +THEN MRESA_TAC Conforming.properties12_fan7[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC POLYHEDRON_FAN[`p:real^3->bool`;`vec 0:real^3`] +THEN MRESA_TAC properties_of_graph[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THY" MP_TAC +THEN RESA_TAC +THEN MP_TAC(SET_RULE` e IN edges p /\ w IN vertices p +/\ UNIONS {aff_gt {vec 0:real^3} e' | e' IN edges (p:real^3->bool)} INTER UNIONS {aff_ge {vec 0} {v} | v IN vertices p}= {} ==> aff_gt {vec 0:real^3} e INTER aff_ge {vec 0:real^3} {w}= {}`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`inv (inv b * (a' dot a)) % a IN aff_gt {vec 0} {v, w} +/\ inv (inv b * (a' dot a)) % a IN aff_ge {vec 0} {w} +==> ~(aff_gt {vec 0:real^3} {v,w} INTER aff_ge {vec 0:real^3} {w}= {})`) +THEN RESA_TAC; +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN ASM_REWRITE_TAC[]]);; + + + + + + +let CONVEX_OPEN_AFF_GT_FACE=prove(`FAN(x,V,E) +/\ (!v. v IN V ==> CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ f IN face_set (hypermap1_of_fanx (x,V,E)) +==> (!s. s IN {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y)} | y IN (f:real^3#real^3#real^3#real^3->bool)} ==> convex s /\ open s)`, + +REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THENL[ +ASM_REWRITE_TAC[CONVEX_AFF_GT]; +MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_dart_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`] +THEN MATCH_MP_TAC OPEN_AFF_GT_3_1 +THEN MRESA_TAC properties_of_elements_in_face_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`(pr2 y):real^3`;`(pr3 y):real^3`] ) +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`(pr2 y):real^3`;`(pr3 y):real^3`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`(pr2 y):real^3`;`(pr3 y):real^3`] +THEN DISCH_TAC +THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`(pr2 y):real^3`;`(sigma_fan x V E (pr2 y) (pr3 y)):real^3`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E (pr2 y) (pr3 y)):real^3`;`(pr2 y):real^3`;`(pr3 y):real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN ASM_REWRITE_TAC[]]);; + + +let AFF_GE_3_1 = prove + (`!x v u w. + DISJOINT {x,v,u} {w} + ==> aff_ge {x,v,u} {w} = + {y | ?t1 t2 t3 t4. + &0 <= t4 /\ + t1 + t2 +t3 +t4 = &1 /\ + y = t1 % x + t2 % v + t3 % u +t4 % w }`, + AFF_TAC);; + + +let inter_aff_ge_3_1_is_aff_ge_1_3=prove(`!x v u w:real^3. +~coplanar {x,v,u,w} +==> +aff_ge {x,v,u} {w} INTER aff_ge {x,u,w} {v} INTER aff_ge {x,w,v} {u}=aff_ge {x} {v,u,w}`, +GEOM_ORIGIN_TAC `x:real^3` +THEN REPEAT STRIP_TAC +THEN MRESA_TAC notcoplanar_disjoints[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_disjoint[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC AFF_GE_3_1[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC AFF_GE_3_1[`(vec 0):real^3`;`u:real^3`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC AFF_GE_3_1[`(vec 0):real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC AFF_GE_1_3[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC NOT_COPLANAR_0_4_IMP_INDEPENDENT[`v:real^3`;`u:real^3`;`w:real^3`] +THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM;INTER] +THEN REDUCE_VECTOR_TAC +THEN GEN_TAC +THEN EQ_TAC +THENL[ +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t2 % v + t3 % u + t4 % w = t2'' % w + t3'' % v + t4'' % u <=> (t2-t3'') % v + (t3-t4'') % u + (t4-t2'') % w= vec 0`] +THEN STRIP_TAC +THEN MRESAL_TAC INDEPENDENT_3[`v:real^3`;`u:real^3`;`w:real^3`;`t2-t3'':real`; `t3-t4'':real`; `t4 -t2'':real`][REAL_ARITH`A-B= &0<=> A=B`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t2 % v + t3 % u + t4 % w = t2' % u + t3' % w + t4' % v <=> (t2-t4') % v + (t3-t2') % u + (t4-t3') % w= vec 0`] +THEN STRIP_TAC +THEN MRESAL_TAC INDEPENDENT_3[`v:real^3`;`u:real^3`;`w:real^3`;`t2-t4':real`; `t3-t2':real`; `t4 -t3':real`][REAL_ARITH`A-B= &0<=> A=B`] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`t1'':real` +THEN EXISTS_TAC`t3'':real` +THEN EXISTS_TAC`t4'':real` +THEN EXISTS_TAC`t2'':real` +THEN ASM_REWRITE_TAC[REAL_ARITH`t1+t2+t3+t4=t1+t4+t2+t3:real`] +THEN ASM_TAC +THEN REAL_ARITH_TAC; + +STRIP_TAC +THEN STRIP_TAC +THENL[EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t3:real` +THEN EXISTS_TAC`t4:real` +THEN ASM_REWRITE_TAC[]; + +STRIP_TAC +THENL[ +EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t3:real` +THEN EXISTS_TAC`t4:real` +THEN EXISTS_TAC`t2:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`t1 + t3 + t4+ t2:real=t1 + t2 + t3 + t4`] +THEN VECTOR_ARITH_TAC; +EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t4:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t3:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`t1 + t4+ t2+ t3:real=t1 + t2 + t3 + t4`] +THEN VECTOR_ARITH_TAC]]]);; + + +let CLOSURE_AFF_GT_3_1_EQ_AFF_GE_3_1=prove_by_refinement(`!x v u w:real^3. ~coplanar {x, v, u, w} ==> +closure (aff_gt {x,v, u} {w}) = aff_ge {x, v, u} {w}`, +[GEOM_ORIGIN_TAC `x:real^3` +THEN REPEAT STRIP_TAC +THEN MRESA_TAC notcoplanar_disjoints[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESAL_TAC Planarity.coplanar_cross_dot[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN MP_TAC(REAL_ARITH`~((v cross u) dot w = &0) ==> &0 < (v cross u) dot w \/ &0 < --((v cross u) dot (w:real^3))`) +THEN RESA_TAC; +MRESAL_TAC Planarity.aff_gt_3_1_rep_cross_dot[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN MRESAL_TAC Nkezbfc_local.aff_ge_3_1_rep_cross_dot[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN DISJ_CASES_TAC (SET_RULE` v cross u = vec 0 \/ ~(v cross (u:real^3) = vec 0)`); +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th; DOT_LZERO]); +REWRITE_TAC[REAL_ARITH`&0 < A <=> (-- A) < &0`;REAL_ARITH`&0 <= A <=> (-- A) <= &0`;GSYM DOT_LNEG] +THEN MATCH_MP_TAC CLOSURE_HALFSPACE_LT +THEN ASM_REWRITE_TAC[VECTOR_ARITH`-- A= vec 0<=> A= vec 0:real^3`]; +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN REWRITE_TAC[DOT_LNEG; REAL_ARITH`-- (-- A)=A`] +THEN STRIP_TAC +THEN MRESAL_TAC Planarity.aff_gt_3_1_rep_cross_dot[`(vec 0):real^3`;`u:real^3`;`v:real^3`;`w:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{X, u, v, w}= {X, v, u, w}`] +THEN RESA_TAC +THEN MRESAL_TAC Nkezbfc_local.aff_ge_3_1_rep_cross_dot[`(vec 0):real^3`;`u:real^3`;`v:real^3`;`w:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{X, u, v, w}= {X, v, u, w}`] +THEN RESA_TAC +THEN DISJ_CASES_TAC (SET_RULE` u cross v = vec 0 \/ ~(u cross (v:real^3) = vec 0)`); +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th; DOT_LZERO]) +THEN REAL_ARITH_TAC; +ONCE_REWRITE_TAC[SET_RULE`{X, u, v}= {X, v, u}`] +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[REAL_ARITH`&0 < A <=> (-- A) < &0`;REAL_ARITH`&0 <= A <=> (-- A) <= &0`;GSYM DOT_LNEG] +THEN MATCH_MP_TAC CLOSURE_HALFSPACE_LT +THEN ASM_REWRITE_TAC[VECTOR_ARITH`-- A= vec 0<=> A= vec 0:real^3`]]);; + +let CLOSURE_AFF_GT_1_3_EQ_AFF_GE_1_3= prove(`!x v u w:real^3. ~coplanar {x, v, u, w} ==> +closure (aff_gt {x} {v, u, w}) = aff_ge {x} {v, u, w}`, +REPEAT STRIP_TAC +THEN MRESA_TAC inter_aff_ge_3_1_is_aff_ge_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC OPEN_AFF_GT_3_1[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC OPEN_AFF_GT_3_1[`x:real^3`;`u:real^3`;`w:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{x, u, w, v}={x, v,u, w}`] +THEN RESA_TAC +THEN MRESA_TAC OPEN_AFF_GT_3_1[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{x, w, v, u}={x, v,u, w}`] +THEN RESA_TAC +THEN MRESA_TAC CONVEX_AFF_GT[`{x,v,u:real^3}`;`{w:real^3}`] +THEN MRESA_TAC CONVEX_AFF_GT[`{x,u:real^3,w}`;`{v:real^3}`] +THEN MRESA_TAC CONVEX_AFF_GT[`{x,w,v:real^3}`;`{u:real^3}`] +THEN MRESA_TAC Planarity.notcoplanar_4point_aff_gt_1_3_not_empty[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC Planarity.inter_aff_gt_3_1_is_aff_gt_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`~(aff_gt {x, v, u} {w} INTER aff_gt {x, u, w} {v} INTER aff_gt {x, w, v} {u} = + {}) +==> ~(aff_gt {x, v, u} {w} INTER aff_gt {x, u, w} {v:real^3} = + {})`) +THEN RESA_TAC +THEN MRESA_TAC CLOSURE_INTER_CONVEX_OPEN[`aff_gt {x, v, u} {w:real^3}`;`aff_gt {x, u, w} {v:real^3}`] +THEN MRESA_TAC OPEN_INTER[`aff_gt {x, v, u} {w:real^3}`;`aff_gt {x, u, w} {v:real^3}`] +THEN MRESA_TAC CONVEX_INTER[`aff_gt {x, v, u} {w:real^3}`;`aff_gt {x, u, w} {v:real^3}`] +THEN MRESAL_TAC CLOSURE_INTER_CONVEX_OPEN[`aff_gt {x, v, u} {w:real^3} INTER aff_gt {x, u, w} {v:real^3}`;`aff_gt {x, w, v} {u:real^3}`][SET_RULE`(A INTER B) INTER C= A INTER B INTER C`] +THEN MRESA_TAC CLOSURE_AFF_GT_3_1_EQ_AFF_GE_3_1[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC CLOSURE_AFF_GT_3_1_EQ_AFF_GE_3_1[`x:real^3`;`u:real^3`;`w:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{x, u, w, v}={x, v,u, w}`] +THEN RESA_TAC +THEN MRESA_TAC CLOSURE_AFF_GT_3_1_EQ_AFF_GE_3_1[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{x, w, v,u}={x, v,u, w}`] +THEN RESA_TAC);; + + +let AFF_GT_SUBSET_CLOSURE_DARTSET_LEADS_INTO_FAN=prove(`FAN(x,V,E) +/\ (!v. v IN V ==> CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ f IN face_set (hypermap1_of_fanx (x,V,E)) +/\ e IN f +==> aff_gt {x} {(pr2 e), pr3 e } SUBSET closure(dartset_leads_into_fan x V E f)`, + +REPEAT STRIP_TAC +THEN MRESAL_TAC properties_of_elements_in_face_fully_surroundedfan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`f:real^3#real^3#real^3#real^3->bool`;`e:real^3#real^3#real^3#real^3`][edges;IN_ELIM_THM] +THEN ABBREV_TAC`v=pr2 (e:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`w=pr3 (e:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`u=sigma_fan x V E v (w:real^3)` +THEN MRESA_TAC remark1_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC Fan.sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u:real^3`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC SUBSET_CLOSURE[`aff_gt {x} {u, v, w:real^3}`;`dart_leads_into x V E v (w:real^3)`] +THEN MRESA_TAC Planarity.DARTSET_LEADS_INTO_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`f:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(e:real^3#real^3#real^3#real^3)`) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v:real^3`;`w:real^3`]) +THEN MRESA_TAC Planarity.properties_fully_surrounded[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC CLOSURE_AFF_GT_1_3_EQ_AFF_GE_1_3[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC Planarity.aff_ge_1_3_eq_unions_aff_ge_1_2_and_aff_gt_1_3[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{x:real^3}`;`{v,w:real^3}`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + + + +let IN_EDGES0_FAN=prove(`!p:real^3->bool f f1. + bounded (p:real^3->bool) /\ polyhedron p /\ vec 0 IN interior p +/\ f IN face_set (hypermap1_of_fanx (vec 0,vertices p,edges p)) +/\ f1 facet_of p /\ dartset_leads_into_fan (vec 0) (vertices p) (edges p) f = fchanged f1 +/\ e IN f +==> {pr2 e, pr3 e} IN EDGES0_FAN p f1`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[EDGES0_FAN;IN_ELIM_THM;edges] +THEN MRESA_TAC POLYHEDRON_FAN[`p:real^3->bool`;`vec 0:real^3`] +THEN MRESA1_TAC Polyhedron.POLYTOPE_FAN80`p:real^3->bool` +THEN MRESA1_TAC Polyhedron.CARD_SET_OF_EDGE_INEQ_1_POLYHEDRON`p:real^3->bool` +THEN MRESA_TAC properties_of_elements_in_face_fully_surroundedfan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;`f:real^3#real^3#real^3#real^3->bool`;`e:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[edges;IN_ELIM_THM] +THEN STRIP_TAC THEN MP_TAC th THEN ASM_REWRITE_TAC[] THEN STRIP_TAC) +THEN STRIP_TAC +THENL[ +EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[]; +MRESA_TAC (GEN_ALL AFF_GT_SUBSET_CLOSURE_DARTSET_LEADS_INTO_FAN)[`e:real^3#real^3#real^3#real^3`;`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC Planarity.exists_in_aff_gt_disjoint[`vec 0:real^3`;`v:real^3`;`w:real^3`] +THEN REWRITE_TAC[SET_RULE`~(A= {})<=> ?a. a IN A`] +THEN EXISTS_TAC`y:real^3` +THEN ASM_TAC +THEN SET_TAC[]]);; + + +let SUBSET_EDGES0_FAN=prove(`!p:real^3->bool f f1. + bounded (p:real^3->bool) /\ polyhedron p /\ vec 0 IN interior p +/\ f IN face_set (hypermap1_of_fanx (vec 0,vertices p,edges p)) +/\ f1 facet_of p /\ dartset_leads_into_fan (vec 0) (vertices p) (edges p) f = fchanged f1 +==> {{pr2 e, pr3 e}| e IN f} SUBSET EDGES0_FAN p f1`, + REWRITE_TAC[SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_MESON_TAC[IN_EDGES0_FAN]);; + + + + +let EDGES0_SUBSET_FAN=prove_by_refinement(`!p:real^3->bool f f1. + bounded (p:real^3->bool) /\ polyhedron p /\ vec 0 IN interior p +/\ f IN face_set (hypermap1_of_fanx (vec 0,vertices p,edges p)) +/\ f1 facet_of p /\ + fchanged f1 =dartset_leads_into_fan (vec 0) (vertices p) (edges p) f +==> EDGES0_FAN p f1 SUBSET {{pr2 e, pr3 e}| e IN f} `, +[REPEAT STRIP_TAC +THEN REWRITE_TAC[SUBSET;EDGES0_FAN;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN REWRITE_TAC[edges;IN_ELIM_THM] THEN STRIP_TAC THEN MP_TAC th THEN RESA_TAC) +THEN ASM_REWRITE_TAC[SET_RULE`~(A={}) <=> ?a. a IN A`;INTER;IN_ELIM_THM] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "THYGIANG1") +THEN ABBREV_TAC`x1= (vec 0:real^3)` +THEN ABBREV_TAC`V=(vertices (p:real^3->bool)) ` +THEN ABBREV_TAC`E=(edges (p:real^3->bool))` +THEN ABBREV_TAC`u=inverse1_sigma_fan (x1:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)` +THEN ABBREV_TAC`U= dartset_leads_into_fan x1 V E f` +THEN MRESA_TAC POLYHEDRON_FAN[`p:real^3->bool`;`vec 0:real^3`] +THEN MRESA1_TAC Polyhedron.POLYTOPE_FAN80`p:real^3->bool` +THEN MRESA1_TAC Polyhedron.CARD_SET_OF_EDGE_INEQ_1_POLYHEDRON`p:real^3->bool` +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x1:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`) THEN MRESA1_TAC th `w:real^3`) +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;`u:real^3`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x1:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC exists_point_in_component_yfan[`x1:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)` ;`U:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "THYGIANG") +THEN SUBGOAL_THEN`a IN xfan (x1:real^3,(V:real^3->bool),E)`ASSUME_TAC; +REWRITE_TAC[xfan;IN_ELIM_THM] +THEN EXISTS_TAC`{v,w:real^3}` +THEN MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{x1:real^3}`;`{v,w:real^3}`] +THEN ASM_TAC +THEN SET_TAC[IN]; +MRESA_TAC Planarity.origin_is_not_aff_gt_fan[`x1:real^3`;`v:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE`~(x1 IN aff_gt {x1} {v, w}) /\ (a IN aff_gt {x1} {v, w}) ==> ~(a= x1:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC Planarity.topological_component_subset_yfan[`x1:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:(real^3->bool)`] +THEN SUBGOAL_THEN`~(a IN U:real^3->bool)` ASSUME_TAC; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan] +THEN ASM_TAC +THEN SET_TAC[]; +DISJ_CASES_TAC(SET_RULE`~(!t. &0 < t /\ t < &1 ==> (&1 - t) % a + t % z IN (U:real^3->bool)) \/ (!t. &0 < t /\ t < &1 ==> (&1 - t) % a + t % z IN (U:real^3->bool))`); +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN MRESA_TAC PIIJBJK[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;] +THEN MRESA_TAC GINGUAP[`x1:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:(real^3#real^3#real^3#real^3->bool)`] +THEN MRESA1_TAC CLOSURE_SUBSET`U:real^3->bool` +THEN MP_TAC(SET_RULE`z IN U/\ U SUBSET closure U ==> z IN closure (U:real^3->bool)`) +THEN RESA_TAC +THEN MRESAL1_TAC CONVEX_CLOSURE`U:real^3->bool`[CONVEX_CONTAINS_SEGMENT] +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`a:real^3`;`z:real^3`][segment;SUBSET;IN_ELIM_THM]) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(&1 - t) % a + t % z:real^3`) +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`(?u. (&0 <= u /\ u <= &1) /\ + (&1 - t) % a + t % z = (&1 - u) % a + u % z:real^3)` ASSUME_TAC; +EXISTS_TAC`t:real` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[] +THEN DISCH_THEN(LABEL_TAC"THY1") +THEN FIND_ASSUM MP_TAC`conforming_fan (x1:real^3,V,E)` +THEN REWRITE_TAC[conforming_fan;conforming_half_space_fan] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`f:(real^3#real^3#real^3#real^3->bool)`) +THEN MP_TAC( ISPECL [`x1:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:(real^3#real^3#real^3#real^3->bool)`] +Conforming.exists_point_in_dartset_leads_into_fan) +THEN ONCE_REWRITE_TAC[SET_RULE`(?a. a IN A) <=> ~(A={})`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL CONVEX_OPEN_AFF_GT_FACE)[`f:(real^3#real^3#real^3#real^3->bool)`;`x1:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA1_TAC CLOSURE_INTERS_CONVEX_OPEN`{aff_gt {x1, pr2 y, pr3 y} {pr3 (f1_fan x1 V E y)} | y IN (f:(real^3#real^3#real^3#real^3->bool))}` +THEN REMOVE_THEN "THY" MP_TAC +THEN ASM_REWRITE_TAC[INTERS;IN_ELIM_THM;NOT_FORALL_THM;NOT_IMP] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_THEN "THY1" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[INTERS;IN_ELIM_THM;NOT_FORALL_THM;NOT_IMP;] +THEN SUBGOAL_THEN`closure (aff_gt {x1, pr2 y, pr3 y} {pr3 (f1_fan x1 V E y)}) IN + IMAGE closure + {aff_gt {x1, pr2 y, pr3 y} {pr3 (f1_fan x1 V E y)} | y IN (f:(real^3#real^3#real^3#real^3->bool))}`ASSUME_TAC; +REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`aff_gt {x1:real^3, pr2 y, pr3 y} {pr3 (f1_fan x1 V E y)}` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`closure (aff_gt {x1, pr2 y, pr3 y} {pr3 (f1_fan x1 V E y)})`) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC Conforming.fully_surrounded_imp_aff_gt_3_1_of_dart_eq_fan +[`x1:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:(real^3#real^3#real^3#real^3->bool)`;`y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC properties_of_elements_in_face_fully_surroundedfan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;`f:real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`] +THEN REMOVE_THEN"THYGIANG" MP_TAC +THEN ASM_REWRITE_TAC[INTERS;IN_ELIM_THM] +THEN SUBGOAL_THEN`(?y'. y' IN f /\ + aff_gt {x1:real^3, pr2 y, pr3 y} {sigma_fan x1 V E (pr2 y) (pr3 y)} = + aff_gt {x1, pr2 y', pr3 y'} {pr3 (f1_fan x1 V E y')}) +` ASSUME_TAC; +EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `aff_gt {x1:real^3, pr2 y, pr3 y} {pr3 (f1_fan x1 V E y)}`) +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN"THYGIANG1" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[INTERS;IN_ELIM_THM;NOT_FORALL_THM;NOT_IMP;] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`closure (aff_gt {x1, pr2 y, pr3 y} {pr3 (f1_fan x1 V E y)})`) +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC`v1=pr2 (y:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`w1=pr3 (y:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`u1=sigma_fan x1 V E v1 (w1:real^3)` +THEN MRESA_TAC remark1_fan[`x1:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w1:real^3`;`v1:real^3`] +THEN MRESA_TAC Fan.sigma_fan_in_set_of_edge[`x1:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v1:real^3`;`w1:real^3`] +THEN MRESA_TAC remark1_fan[`x1:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u1:real^3`;`v1:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`fan80(x1:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v1:real^3`;`w1:real^3`]) +THEN MRESA_TAC Planarity.properties_fully_surrounded[`x1:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u1:real^3`;`v1:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{x1, u1, v1, w1}={x1, w1, v1, u1}`] +THEN STRIP_TAC +THEN MRESA_TAC CLOSURE_AFF_GT_3_1_EQ_AFF_GE_3_1[`x1:real^3`;`w1:real^3`;`v1:real^3`;`u1:real^3`] +THEN MRESA_TAC Planarity.coplanar_cross_dot[`x1:real^3`;`w1:real^3`;`v1:real^3`;`u1:real^3`] +THEN MP_TAC(REAL_ARITH`~(((w1 - x1) cross (v1 - x1)) dot (u1 - x1) = &0) +==> &0 < ((w1 - x1) cross (v1 - x1)) dot (u1 - x1) +\/ &0 < --( ((w1 - x1) cross (v1 - x1)) dot (u1 - x1:real^3) )`) +THEN RESA_TAC; +MRESA_TAC Nkezbfc_local.aff_ge_3_1_rep_cross_dot[`x1:real^3`;`w1:real^3`;`v1:real^3`;`u1:real^3`] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x1:real^3`;`w1:real^3`;`v1:real^3`;`u1:real^3`] +THEN EXPAND_TAC"x1" +THEN REWRITE_TAC[IN_ELIM_THM;VECTOR_ARITH`A- vec 0=A`;DOT_RADD;DOT_RMUL] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC REAL_LT_MUL[`t:real`;`(w1 cross v1) dot (z:real^3)`] +THEN MP_TAC(REAL_ARITH`t< &1==> &0<= &1- t`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`&1-t:real`;`(w1 cross v1) dot (a:real^3)`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`A - vec 0=A`;GSYM DOT_LNEG] +THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN MRESA_TAC Nkezbfc_local.aff_ge_3_1_rep_cross_dot[`x1:real^3`;`v1:real^3`;`w1:real^3`;`u1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{x1, v1, w1, u1}={x1, w1, v1, u1}`] +THEN RESA_TAC +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x1:real^3`;`v1:real^3`;`w1:real^3`;`u1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{x1, v1, w1, u1}={x1, w1, v1, u1}`] +THEN RESA_TAC +THEN EXPAND_TAC"x1" +THEN REWRITE_TAC[IN_ELIM_THM;VECTOR_ARITH`A- vec 0=A`;DOT_RADD;DOT_RMUL] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC REAL_LT_MUL[`t:real`;`(v1 cross w1) dot (z:real^3)`] +THEN MP_TAC(REAL_ARITH`t< &1==> &0<= &1- t`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`&1-t:real`;`(v1 cross w1) dot (a:real^3)`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +SUBGOAL_THEN `(!t. &0 < t /\ t < &1 ==> (&1 - t) % a + t % z IN yfan (x1,V:real^3->bool,E))` ASSUME_TAC; +ASM_TAC +THEN SET_TAC[]; +MRESA_TAC not_azim_points1_in_yfan[`x1:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`a:real^3`;`z:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC not_azim_points1_in_yfan[`x1:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`a:real^3`;`z:real^3`;`w:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`~(azim x1 a z v = &0) /\ &0<= azim x1 a z v==> &0< azim x1 a z (v:real^3) `) +THEN ASM_REWRITE_TAC[azim] +THEN STRIP_TAC +THEN MRESA_TAC properties_of_collinear4_points_fan[`x1:real^3`;`v:real^3`;`w:real^3`;`a:real^3`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x1:real^3`;`w:real^3`;`v:real^3`;`a:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC point_in_yfan_and_point_in_xfan_indepent_fan[`x1:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`U:real^3->bool`;`a:real^3`;` z:real^3`] +THEN DISJ_CASES_TAC(REAL_ARITH`azim x1 a z (v:real^3)< pi \/ pi<= azim x1 a z (v:real^3)`); +MRESA_TAC cross_dot_fully_surrounded_fan[`x1:real^3`;`a:real^3`; `v:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"x1" +THEN REWRITE_TAC[VECTOR_ARITH`A- vec 0 =A`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN ABBREV_TAC`u1=inverse1_sigma_fan (x1:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (w:real^3) (v:real^3)` +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;`v:real^3`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x1:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3` +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +) THEN MRESA1_TAC th `v:real^3`THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +) +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;`u1:real^3`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC exists_dart_leads_into_edge_eq_topological1_component_fan[`x1:real^3`;`(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`a:real^3`;`z:real^3`;`v:real^3`;`w:real^3`;` (u1:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"x1" +THEN REWRITE_TAC[VECTOR_ARITH`A- vec 0 =A`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN EXISTS_TAC`(x1,v,w,sigma_fan x1 V E v w):real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[pr2;pr3] +THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x1,V,E)) ((x1,v,w,sigma_fan x1 V E v w):real^3#real^3#real^3#real^3)` +THEN MRESA_TAC hypermap_of_fan_rep[`x1:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x1 V E) (d1_fan (x1,V,E)))`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN SUBGOAL_THEN`ds2 IN face_set(hypermap1_of_fanx (x1:real^3,V,E))` ASSUME_TAC; +ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`(x1,v,w,sigma_fan x1 V E v w):real^3#real^3#real^3#real^3` +THEN EXPAND_TAC"ds2" +THEN REWRITE_TAC[face] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x1:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x1:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`sigma_fan x1 V E v w:real^3` +THEN ASM_REWRITE_TAC[]; +SUBGOAL_THEN` (x1,v,w,sigma_fan x1 V E v w):real^3#real^3#real^3#real^3 IN ds2` ASSUME_TAC; +EXPAND_TAC"ds2" +THEN REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[ARITH_RULE`0>= 0`;POWER;I_DEF]; +MRESA_TAC DARTSET_LEADS_INTO_FAN[`x1:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th `(x1,v,w,sigma_fan x1 V E v w):real^3#real^3#real^3#real^3`[pr2;pr3]) +THEN MRESA_TAC PIIJBJK[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`U:real^3->bool`) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`ds2:real^3#real^3#real^3#real^3->bool` +THEN MRESA1_TAC th`f:real^3#real^3#real^3#real^3->bool`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); +MRESA_TAC aff_gt2_subset_aff_ge[`x1:real^3`;`w:real^3`; `v:real^3`;`a:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC sum5_azim_fan[`x1:real^3`;`a:real^3`;`z:real^3`;`w:real^3`;`v:real^3`] +THEN MP_TAC(REAL_ARITH`azim x1 a z v = azim x1 a z w + pi/\ +azim x1 a z v < &2 * pi/\ ~(azim x1 a z w = &0) /\ &0 <= azim x1 a z w +==> &0< azim x1 a z w /\ azim x1 a z w < pi +`) +THEN ASM_REWRITE_TAC[azim] +THEN STRIP_TAC; +MRESA_TAC cross_dot_fully_surrounded_fan[`x1:real^3`;`a:real^3`; `w:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"x1" +THEN REWRITE_TAC[VECTOR_ARITH`A- vec 0 =A`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN MRESA_TAC exists_dart_leads_into_edge_eq_topological1_component_fan[`x1:real^3`;`(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`a:real^3`;`z:real^3`;`w:real^3`;`v:real^3`;` (u:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"x1" +THEN REWRITE_TAC[VECTOR_ARITH`A- vec 0 =A`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN EXISTS_TAC`(x1,w,v,sigma_fan x1 V E w v):real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[pr2;pr3] +THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x1,V,E)) ((x1,w,v,sigma_fan x1 V E w v):real^3#real^3#real^3#real^3)` +THEN MRESA_TAC hypermap_of_fan_rep[`x1:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x1 V E) (d1_fan (x1,V,E)))`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN SUBGOAL_THEN`ds2 IN face_set(hypermap1_of_fanx (x1:real^3,V,E))` ASSUME_TAC; +ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`(x1,w,v,sigma_fan x1 V E w v):real^3#real^3#real^3#real^3` +THEN EXPAND_TAC"ds2" +THEN REWRITE_TAC[face] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x1:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x1:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x1 V E w v:real^3` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN SUBGOAL_THEN` (x1,w,v,sigma_fan x1 V E w v):real^3#real^3#real^3#real^3 IN ds2` ASSUME_TAC; +EXPAND_TAC"ds2" +THEN REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[ARITH_RULE`0>= 0`;POWER;I_DEF]; +MRESA_TAC DARTSET_LEADS_INTO_FAN[`x1:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th `(x1,w,v,sigma_fan x1 V E w v):real^3#real^3#real^3#real^3`[pr2;pr3]) +THEN MRESA_TAC PIIJBJK[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`U:real^3->bool`) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`ds2:real^3#real^3#real^3#real^3->bool` +THEN MRESA1_TAC th`f:real^3#real^3#real^3#real^3->bool`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +]);; + +let CFYXFTY0=prove(`!p:real^3->bool f. + bounded (p:real^3->bool) /\ polyhedron p /\ vec 0 IN interior p +/\ f facet_of p +==> EDGES0_FAN p f = edges f`, +SET_TAC[MAP_EDGES_FACET_INTO_E1_FAN; MAP_EDGES_FACET_INTO_E1_FAN_INJ]);; + + +let CFYXFTY1=prove(`!p:real^3->bool f f1. + bounded (p:real^3->bool) /\ polyhedron p /\ vec 0 IN interior p +/\ f IN face_set (hypermap1_of_fanx (vec 0,vertices p,edges p)) +/\ f1 facet_of p /\ + fchanged f1 =dartset_leads_into_fan (vec 0) (vertices p) (edges p) f +==> EDGES0_FAN p f1 = {{pr2 e, pr3 e}| e IN f} `, +REPEAT STRIP_TAC +THEN REWRITE_TAC[EXTENSION] +THEN GEN_TAC +THEN EQ_TAC +THENL[ MRESA_TAC EDGES0_SUBSET_FAN[`p:real^3->bool`;`f:real^3#real^3#real^3#real^3->bool`;`f1:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + MRESA_TAC SUBSET_EDGES0_FAN [`p:real^3->bool`;`f:real^3#real^3#real^3#real^3->bool`;`f1:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]);; + + +end;; + + diff --git a/text_formalization/fan/Conforming.hl b/text_formalization/fan/Conforming.hl new file mode 100755 index 0000000..404a680 --- /dev/null +++ b/text_formalization/fan/Conforming.hl @@ -0,0 +1,17809 @@ + +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================= *) + + + + +module Conforming = struct + + + + + + + + + +open Sphere;; +open Fan_defs;; +open Hypermap;; +open Vol1;; +open Fan;; +open Topology;; +open Fan_misc;; +open Planarity;; + + + + + + + +let conforming_bijection_fan = new_definition `conforming_bijection_fan (x,V,E) <=> + !s. s IN topological_component_yfan (x,V,E) ==> (?!f. f IN face_set (hypermap1_of_fanx (x,V,E)) /\ + s = dartset_leads_into_fan x V E f)`;; + + +let conforming_half_space_fan = new_definition `conforming_half_space_fan (x,V,E) <=> + !f. f IN face_set (hypermap1_of_fanx (x,V,E)) ==> + dartset_leads_into_fan x V E f = + INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN f}`;; + + +let conforming_solid_angle_fan = new_definition `conforming_solid_angle_fan (x,V,E) <=> + !f. f IN face_set (hypermap1_of_fanx (x,V,E)) ==> + (let U = dartset_leads_into_fan x V E f in + (!r. measurable (ball (x,r) INTER U)) /\ + eventually_radial x U /\ + sol x U = &2 * pi + sum (f) (\y. (azim_fan x V E (pr2 y) (pr3 y)) - pi))`;; + + +let conforming_diagonal_fan = new_definition `conforming_diagonal_fan (x,V,E) <=> + (!f y z. f IN face_set (hypermap1_of_fanx (x,V,E)) /\ y IN f /\ z IN f /\ ~(y = z) ==> + ~collinear {x, pr2 y, pr2 z} /\ + ((y = f1_fan x V E z) \/ (z = f1_fan x V E y) \/ + aff_gt {x} {pr2 y, pr2 z} SUBSET (dartset_leads_into_fan x V E f)))`;; + + + + + +let conforming_fan = new_definition `conforming_fan (x,V,E) <=> + (!v. v IN V==>CARD (set_of_edge v V E) >1)/\ + fan80(x,V,E) /\ + conforming_bijection_fan (x,V,E) /\ + conforming_half_space_fan (x,V,E) /\ + conforming_solid_angle_fan (x,V,E) /\ + conforming_diagonal_fan (x,V,E)`;; + + + + +let N_FAN = new_definition `N_FAN (x,V,E) = nsum (face_set (hypermap1_of_fanx (x,V,E))) (\f. CARD f -3)`;; + + + +let minimally_nonconforming_fan=new_definition`minimally_nonconforming_fan(x,V,E)<=> +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ~(conforming_fan (x,V,E)) +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))`;; + + + + +let GINGUAP=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E) +/\ conforming_fan (x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> convex(dartset_leads_into_fan x V E ds)`, + +REWRITE_TAC[conforming_fan;conforming_half_space_fan] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th`ds:real^3#real^3#real^3#real^3->bool`) +THEN MATCH_MP_TAC CONVEX_INTERS +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[CONVEX_AFF_GT]);; + + + + + +let fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v w. +FAN(x,V,E) /\ {v,w} IN E +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +==> aff_gt {x, v,w} {sigma_fan x V E v w} = + aff_gt {x, v, w} {inverse1_sigma_fan x V E w v}`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`w:real^3`] THEN MRESA_TAC th [`w:real^3`;`inverse1_sigma_fan x V E w v:real^3`] ) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`] +THEN REMOVE_THEN "EM" MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN DISCH_TAC THEN MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`] THEN DISCH_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` sigma_fan x V E v w:real^3`;`(v:real^3)`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`sigma_fan x V E v w:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN DISCH_TAC THEN MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN DISCH_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`;`sigma_fan x V E v w:real^3`; `w:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`(w:real^3)`;`inverse1_sigma_fan x V E w v:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`;`v:real^3`;`inverse1_sigma_fan x V E w v:real^3`; ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`w:real^3`;`sigma_fan x V E v w:real^3`;] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w v:real^3`]);; + + + + + + + + + + + +let IMAGE_F1_IN_FACE_IMP_IN_FACE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y y1. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ ds IN face_set (hypermap1_of_fanx (x,V,E)) +/\ y IN ds +/\ y1 IN d_fan(x,V,E) +/\ f1_fan x V E y1= y +==> y1 IN ds`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM;orbit_map] +THEN RESA_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x':real^3#real^3#real^3#real^3`) +THEN STRIP_TAC +THEN SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E)) y1 IN + face_set (hypermap1_of_fanx (x,V,E))`ASSUME_TAC +THENL[ +REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;face] +THEN EXISTS_TAC`y1:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[]; +MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) y1):real^3#real^3#real^3#real^3->bool`] +THEN SUBGOAL_THEN`?N:num. CARD (face (hypermap1_of_fanx (x,V,E)) y1)= SUC N /\ N>0`ASSUME_TAC +THENL[ +EXISTS_TAC`CARD (face (hypermap1_of_fanx (x:real^3,V,E)) y1)-1` +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`CARD (face (hypermap1_of_fanx (x,V,E)) y1):num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y1:real^3#real^3#real^3#real^3`) +THEN STRIP_TAC +THEN MRESA_TAC lemma_face_cycle[`hypermap1_of_fanx (x:real^3,V,E)`;`y1:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[POWER;o_DEF;GSYM lemma_add_exponent_function] +THEN STRIP_TAC +THEN EXISTS_TAC`N+n:num` +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`N+n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x':real^3#real^3#real^3#real^3`) +THEN MP_TAC(ARITH_RULE`n>=0/\ N>0==> N+n>=0`) +THEN ASM_REWRITE_TAC[]]]);; + + + + + + +let IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE=prove(`!m x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y y1. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ ds IN face_set (hypermap1_of_fanx (x,V,E)) +/\ y IN ds +/\ y1 IN d_fan(x,V,E) +/\ (f1_fan x V E POWER m) y1= y +==> y1 IN ds`, + +INDUCT_TAC +THENL[ +ASM_REWRITE_TAC[POWER;I_DEF] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN ASM_REWRITE_TAC[POWER;o_DEF] +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESA_TAC th[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`;` (f1_fan x V E y1):real^3#real^3#real^3#real^3`;]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN STRIP_TAC +THEN MRESAL_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`1:num`][POWER_1] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y1:real^3#real^3#real^3#real^3`) +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`(f1_fan x V E y1):real^3#real^3#real^3#real^3`;`y1:real^3#real^3#real^3#real^3`;]]);; + + + + + + + +let REP_OF_INVERSE1_SIGMA_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ ds IN face_set (hypermap1_of_fanx (x,V,E)) +/\ y IN ds +==> f1_fan x V E (x,sigma_fan x V E (pr2 y) (pr3 y),(pr2 y),sigma_fan x V E (sigma_fan x V E (pr2 y) (pr3 y)) (pr2 y))=y `, + +REPEAT STRIP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`ds SUBSET d1_fan (x,V,E) /\ y IN ds ==> y IN d1_fan (x,V,E)`) +THEN ASM_REWRITE_TAC[f1_fan;d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr2;pr3] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`w:real^3`));; + + + + +let REP_OF_INVERSE1_SIGMA_FAN_IN_D_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ ds IN face_set (hypermap1_of_fanx (x,V,E)) +/\ y IN ds +==> (x,sigma_fan x V E (pr2 y) (pr3 y),(pr2 y),sigma_fan x V E (sigma_fan x V E (pr2 y) (pr3 y)) (pr2 y)) IN + d_fan (x:real^3,V:real^3->bool,E)`, + +REPEAT STRIP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`ds SUBSET d1_fan (x,V,E) /\ y IN ds ==> y IN d1_fan (x,V,E)`) +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr2;pr3] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`(sigma_fan x V E v w):real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`(sigma_fan x V E (sigma_fan x V E v w) v):real^3` +THEN ASM_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v:real^3`;`w:real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E v w):real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC);; + + + + + +let DARTSET_LEADS_INTO_SUBSET_WDART_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y. +FAN(x,V,E) +/\ ds IN face_set (hypermap1_of_fanx (x,V,E)) +/\ y IN ds +/\ conforming_fan (x,V,E) +==> (dartset_leads_into_fan x V E ds) SUBSET (w_dart_fan x V E y)`, +REWRITE_TAC[conforming_fan;conforming_half_space_fan] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th`ds:real^3#real^3#real^3#real^3->bool`) +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y IN ds /\ ds SUBSET d1_fan (x,V,E)==> y IN d1_fan (x,V,E)`) THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN FIND_ASSUM MP_TAC`(!v:real^3. v IN V==>CARD (set_of_edge v V E) >1)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC `v:real^3` th) THEN FIND_ASSUM MP_TAC `(v:real^3) IN V` THEN DISCH_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN STRIP_TAC) +THEN ASM_REWRITE_TAC[w_dart_fan;] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM1")) +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v:real^3`;`w:real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E v w):real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC WEDGE_LUNE_GT[`x:real^3`;`v:real^3`;`w:real^3`;`(sigma_fan x V E v w):real^3`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E v w):real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN DISCH_TAC THEN MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] THEN DISCH_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_2_2[`x:real^3`;`w:real^3`;`v:real^3`;`(sigma_fan x V E v w):real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) +THEN SUBGOAL_THEN`x,sigma_fan x V E v w,v,sigma_fan x V E (sigma_fan x V E v w) v IN + d1_fan (x:real^3,V:real^3->bool,E)` ASSUME_TAC +THENL[ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`(sigma_fan x V E v w):real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`(sigma_fan x V E (sigma_fan x V E v w) v):real^3` +THEN ASM_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]; +MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E (x,sigma_fan x V E v w, v, sigma_fan x V E (sigma_fan x V E v w) v)):real^3#real^3#real^3#real^3)` ;`((x,sigma_fan x V E v w,v,sigma_fan x V E (sigma_fan x V E v w) v):real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[pr2;pr3;f1_fan] +THEN REWRITE_TAC[] +THEN STRIP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[pr2;pr3;f1_fan] +THEN REWRITE_TAC[INTERS;INTER;IN_ELIM_THM; SUBSET] +THEN REPEAT STRIP_TAC +THENL[POP_ASSUM(fun th-> MRESA1_TAC th `aff_gt {x, w, v} {sigma_fan x V E v w:real^3}` THEN POP_ASSUM MATCH_MP_TAC) +THEN EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[pr2;pr3;f1_fan] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B,C}={A,C,B}`] +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`]; +POP_ASSUM(fun th-> MRESA1_TAC th `aff_gt {x, v, sigma_fan x V E v w} {w}` THEN POP_ASSUM MATCH_MP_TAC) +THEN EXISTS_TAC`(x,sigma_fan x V E v w,v,sigma_fan x V E (sigma_fan x V E v w:real^3) v):real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[pr2;pr3;f1_fan] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`w:real^3`) +THEN MRESAL_TAC REP_OF_INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`][pr2;pr3] +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`;`(x,sigma_fan x V E v w,v,sigma_fan x V E (sigma_fan x V E v w:real^3) v):real^3#real^3#real^3#real^3`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B,C}={A,C,B}`] +THEN REWRITE_TAC[]]]);; + + + + + + + + +let power_map_points_edge_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 w:real^3 n:num. +FAN(x,V,E) +/\ {v,w} IN E +==> {v,power_map_points sigma_fan x V E v w n} IN E`, +REPEAT STRIP_TAC +THEN MRESA_TAC i_IN_ORBITS_FAN[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`n:num`] +THEN MRESA_TAC ORBITS_SUBSET_EDGE_FAN[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;` (w:real^3)`] +THEN MP_TAC (SET_RULE`power_map_points sigma_fan x V E v w n IN + set_of_orbits_points_fan x V E v w /\ +set_of_orbits_points_fan x V E v w SUBSET set_of_edge v V E +==> power_map_points sigma_fan x V E v w n IN set_of_edge v V E`) +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC properties_of_set_of_edge_fan[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;` ((power_map_points sigma_fan x V E v w n):real^3)`]);; + + + + +let SRPRNPL=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +/\ conforming_fan (x,V,E) +==> simple_hypermap(hypermap1_of_fanx (x,V,E))`, + +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN REWRITE_TAC[conforming_fan] THEN ASSUME_TAC th) +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN ASM_REWRITE_TAC[simple_hypermap;node;EXTENSION;INTER;IN_ELIM_THM;orbit_map] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THEN STRIP_TAC +THENL[POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC "EM") +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`x' IN face (hypermap1_of_fanx (x:real^3,V,E)) x'`ASSUME_TAC +THENL[ +REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[POWER;I_DEF;ARITH_RULE`0>=0`]; + SUBGOAL_THEN `face (hypermap1_of_fanx (x,V,E)) x' IN + face_set (hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;orbit_map;face] +THEN EXISTS_TAC`x':real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[]; +MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN REMOVE_THEN"EM"MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x':real^3#real^3#real^3#real^3`) +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN"EM"MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[d1_fan;] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC power_n_fan[`n:num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN MRESAL_TAC DARTSET_LEADS_INTO_SUBSET_WDART_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) x'):real^3#real^3#real^3#real^3->bool`;`x'':real^3#real^3#real^3#real^3`][pr2;pr3;] +THEN MRESAL_TAC DARTSET_LEADS_INTO_SUBSET_WDART_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) x'):real^3#real^3#real^3#real^3->bool`;`x':real^3#real^3#real^3#real^3`][pr2;pr3] +THEN MRESA_TAC power_map_points_edge_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`; `w:real^3`; `n:num`] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) x'):real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC exists_point_in_component_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)` ;`(dartset_leads_into_fan x V E + (face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w))):real^3->bool`] + +THEN MP_TAC(SET_RULE`dartset_leads_into_fan x V E + (face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)) SUBSET + w_dart_fan x V E + (x, + v, + power_map_points sigma_fan x V E v w n, + power_map_points sigma_fan x V E v w (SUC n))/\ + dartset_leads_into_fan x V E + (face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)) SUBSET + w_dart_fan x V E (x,v,w,sigma_fan x V E v w) +/\ z IN + dartset_leads_into_fan x V E + (face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)) +==> ~(w_dart_fan x V E (x,v,w,sigma_fan x V E v w) INTER w_dart_fan x V E + (x, + v, + power_map_points sigma_fan x V E v w n, + power_map_points sigma_fan x V E v w (SUC n)) + ={})`) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[power_map_points] +THEN STRIP_TAC +THEN MRESA_TAC disjoint_fan2[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`; `w:real^3`;`(power_map_points sigma_fan x V E v w n):real^3`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;IN_SING])]]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN_SING] +THEN RESA_TAC +THEN STRIP_TAC +THENL[ +EXISTS_TAC `0` +THEN REWRITE_TAC[ARITH_RULE`0>=0`; POWER;I_DEF]; + +REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC `0` +THEN REWRITE_TAC[ARITH_RULE`0>=0`; POWER;I_DEF]]]);; + + +let N_FAN_GE_0=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> 0<= N_FAN(x,V,E) `, + +REPEAT STRIP_TAC +THEN MRESA_TAC NSUM_EQ_0[`(\f:real^3#real^3#real^3#real^3->bool. 0)`;`face_set (hypermap1_of_fanx (x:real^3,V,E))`] +THEN MRESA_TAC NSUM_LE[`(\f:real^3#real^3#real^3#real^3->bool. 0)`;`(\f:real^3#real^3#real^3#real^3->bool. CARD f - 3)`;`face_set (hypermap1_of_fanx (x:real^3,V,E))`] +THEN REWRITE_TAC[N_FAN] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[FINITE_HYPERMAP_ORBITS] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`x':real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC);; + +let NSUM_EQ_0_IFF = prove + (`!s f. FINITE s ==> (nsum s f = 0 <=> !x. x IN s ==> f x = 0)`, + REPEAT STRIP_TAC THEN EQ_TAC THEN ASM_SIMP_TAC[NSUM_EQ_0] THEN + ASM_MESON_TAC[ARITH_RULE `n = 0 <=> n <= 0`; NSUM_POS_BOUND]);; + + + +let N_FAN_EQ_0_IMP_CARD_FACE_EQ_3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ N_FAN(x,V,E)=0 +/\ ds IN face_set (hypermap1_of_fanx (x,V,E)) +==> CARD ds=3`, + +REWRITE_TAC[N_FAN] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC NSUM_EQ_0_IFF[`face_set (hypermap1_of_fanx (x:real^3,V,E))`;`(\f:real^3#real^3#real^3#real^3->bool. CARD f -3)`][FINITE_HYPERMAP_ORBITS] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`ds:real^3#real^3#real^3#real^3->bool`) +THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC);; + + + + +let version_JUTSTKG=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +==> ?f. f IN face_set (hypermap1_of_fanx (x,V,E)) /\ dartset_leads_into_fan x V E f = U`, + +REPEAT STRIP_TAC +THEN MRESA_TAC JUTSTKG[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN ABBREV_TAC`y=(x,v,u:real^3,sigma_fan x V E v u)` +THEN ABBREV_TAC`ds=face (hypermap1_of_fanx (x:real^3,V,E)) y` +THEN EXISTS_TAC`ds:real^3#real^3#real^3#real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`y IN dart (hypermap1_of_fanx (x:real^3,V,E))`ASSUME_TAC +THENL[ +REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESAL_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`][d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`(sigma_fan x (V:real^3->bool) E v u):real^3` +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN `ds IN face_set (hypermap1_of_fanx (x:real^3,V,E))`ASSUME_TAC +THENL[ + POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;face_set; IN_ELIM_THM;set_of_orbits;face]) +THEN STRIP_TAC +THEN EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`y IN ds:real^3#real^3#real^3#real^3->bool`ASSUME_TAC +THENL[ +EXPAND_TAC"ds" +THEN REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF]; +MRESA_TAC DARTSET_LEADS_INTO_FAN [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN EXPAND_TAC"y" +THEN REWRITE_TAC[pr2;pr3]]]]);; + + +let measurable_dartset_leads_into30_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds e. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ CARD ds=3 +==> measurable((dartset_leads_into_fan x V E ds) INTER ball (x,e))`, +REPEAT STRIP_TAC +THEN MRESA_TAC KVQWYDL_lemma10[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) +THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B=B INTER A`] +THEN MESON_TAC[MEASURABLE_BALL_AFF_GT]);; + + + + + + + +let DWFBRQY=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ N_FAN(x,V,E)=0 +==> conforming_fan (x,V,E)`, + + +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[conforming_fan] +THEN MRESA_TAC N_FAN_EQ_0_IMP_CARD_FACE_EQ_3[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN STRIP_TAC +THENL[ +REWRITE_TAC[conforming_bijection_fan;EXISTS_UNIQUE] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC version_JUTSTKG[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`s:real^3->bool`] +THEN EXISTS_TAC`f:real^3#real^3#real^3#real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC exists_point_dart_leads_into_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`y:real^3#real^3#real^3#real^3->bool`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MA") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `f:real^3#real^3#real^3#real^3->bool`) +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`y:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y' IN y /\ y SUBSET d_fan(x,V,E)==> y' IN d_fan(x,V,E)`) +THEN RESA_TAC +THEN MRESA_TAC KVQWYDL_lemma30[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y':real^3#real^3#real^3#real^3`) +THEN REMOVE_THEN "MA" MP_TAC +THEN ASM_TAC +THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`;`y':real^3#real^3#real^3#real^3`][face] +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x'':real^3#real^3#real^3#real^3`;`y':real^3#real^3#real^3#real^3`][face]; + +STRIP_TAC +THENL[ +REWRITE_TAC[conforming_half_space_fan] +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `f:real^3#real^3#real^3#real^3->bool`) +THEN MRESA_TAC KVQWYDL_lemma10[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th);]) +THEN MRESA_TAC CARD_FACE_SET_EQ_3_FULLY_SURROUNDED_FAN1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN ASM_REWRITE_TAC[SET_RULE`INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y)} | y IN {f1, f2, f3}} += aff_gt {x, pr2 f1, pr3 f1} {pr3 (f1_fan x V E f1)} INTER aff_gt {x, pr2 f2, pr3 f2} {pr3 (f1_fan x V E f2)} INTER aff_gt {x, pr2 f3, pr3 f3} {pr3 (f1_fan x V E f3)}`;SET_RULE`{pr2 y | y IN {f1, f2, f3}}={pr2 f1, pr2 f2, pr2 f3}`] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`pr2 f2:real^3`;`pr2 f3:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(pr2 f1):real^3`;`(pr2 f2):real^3`;`(pr2 f3):real^3`] +THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_1_3[`x:real^3`;`(pr3 f3):real^3`;`(pr3 f1):real^3`;`(pr3 f2):real^3`]; + +STRIP_TAC +THENL[ +REWRITE_TAC[conforming_solid_angle_fan] +THEN REPEAT STRIP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B= B INTER A`] +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `f:real^3#real^3#real^3#real^3->bool`) +THEN MRESA_TAC measurable_dartset_leads_into30_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`;] +THEN MRESA_TAC dartset_leads_into_fan_eventually_radial_norm[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[eventually_radial_norm;eventually_radial;radial_norm; radial;ball_eq_normball] +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC solid_of_dartset_leads_into_fan_triangle_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`;]; + +REWRITE_TAC[conforming_diagonal_fan] +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `f:real^3#real^3#real^3#real^3->bool`) +THEN MRESA_TAC CARD_FACE_SET_EQ_3_FULLY_SURROUNDED_FAN1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr2 f2):real^3`;`(pr2 f1):real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr2 f3):real^3`;`(pr2 f2):real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr2 f1):real^3`;`(pr2 f3):real^3`] +THEN REPEAT DISCH_TAC +THEN MP_TAC(SET_RULE`y IN {f1, f2, f3:real^3#real^3#real^3#real^3} /\ z IN {f1, f2, f3}/\ ~(y = z) +==> (y=f1 /\ z= f2) \/ (y=f1 /\ z= f3) \/ (y=f2 /\ z= f1) \/ (y=f2 /\ z= f3)\/ (y=f3 /\ z= f1) \/ (y=f3 /\ z= f2)` ) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[]]]]);; + + + + +let NEGLIGIBLE_AFF_3=prove(`!x:real^3 v:real^3 u:real^3. + negligible (aff {x,v,u})`, + +MESON_TAC[NEGLIGIBLE_AFFINE_HULL_3;aff]);; + + + + +let NEGLIGIBLE_AFF_GE_2_1=prove(`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u} +==> negligible (aff_ge {x,v} {u})`, + +REPEAT GEN_TAC THEN GEOM_ORIGIN_TAC `x:real^3` THEN +REPEAT STRIP_TAC +THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET +THEN EXISTS_TAC`{w:real^3| (w) dot (e2_fan (vec 0) v u)= &0}` +THEN MRESAL_TAC exp_aff_ge_by_dot[`(vec 0):real^3`;`v:real^3`;`u:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN REWRITE_TAC[SET_RULE`{w | w dot e2_fan (vec 0) v u = &0 /\ &0 <= w dot e1_fan (vec 0) v u} SUBSET + {w | w dot e2_fan (vec 0) v u = &0}`] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN MATCH_MP_TAC NEGLIGIBLE_HYPERPLANE +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESAL_TAC properties_coordinate[`((vec 0):real^3)`;` (v:real^3)`;` (u:real^3)`][orthonormal;DOT_LZERO] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + + +let NEGLIGIBLE_AFF_GE_1_2=prove(`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u} +==> negligible (aff_ge {x} {v,u})`, + +REPEAT STRIP_TAC +THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET +THEN EXISTS_TAC `aff_ge {x,v} {u:real^3}` +THEN MRESA_TAC aff_ge_inter_aff_ge[`x:real^3`;`v:real^3`;`u:real^3`] +THEN ASM_SIMP_TAC[SET_RULE`A INTER B SUBSET A`;NEGLIGIBLE_AFF_GE_2_1]);; + +let NEGLIGIBLE_AFF_GT_1_2=prove(`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u} +==> negligible (aff_gt {x} {v,u})`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET +THEN EXISTS_TAC `aff_ge {x} {v,u:real^3}` +THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]th3) THEN RESA_TAC +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`u:real^3`] +THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_GE_1_2]);; + + + + + + + + + + +let MEASURE_AFF_3=prove(`!x:real^3 v:real^3 u:real^3. + measure (aff {x,v,u})= &0`, + +REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0 +THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_3]);; + + + +let MEASURE_AFF_GT_2_1=prove(`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u}==> measure (aff_gt {x} {v,u})= &0`, + +REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0 +THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_GT_1_2]);; + + +let NEGLIGIBLE_AFF_3_INTER_BALL=prove(`!x:real^3 v:real^3 u:real^3 r:real. +negligible (aff {x,v,u} INTER normball x r)`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET +THEN EXISTS_TAC `aff {x,v,u:real^3}` +THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_3; SET_RULE`A INTER B SUBSET A`]);; + + + + +let NEGLIGIBLE_AFF_GT_1_2_INTER_BALL=prove(`!x:real^3 v:real^3 u:real^3 r:real. +~collinear {x,v,u} +==> negligible (aff_gt {x} {v,u} INTER normball x r)`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET +THEN EXISTS_TAC `aff_gt {x} {v,u:real^3}` +THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_GT_1_2; SET_RULE`A INTER B SUBSET A`]);; + + +let MEASURE_AFF_3_INTER_BALL=prove(`!x:real^3 v:real^3 u:real^3 r:real. + measure (aff {x,v,u} INTER normball x r)= &0`, + +REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0 +THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_3_INTER_BALL]);; + + + +let MEASURE_AFF_GT_2_1_INTER_BALL=prove(`!x:real^3 v:real^3 u:real^3 r:real. +~collinear {x,v,u}==> measure (aff_gt {x} {v,u} INTER normball x r)= &0`, + +REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0 +THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_GT_1_2_INTER_BALL]);; + + +let HAS_MEASURE_AFF_3_INTER_BALL=prove(`!x:real^3 v:real^3 u:real^3 r:real. +(aff {x,v,u} INTER normball x r) has_measure &0`, + +REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_3_INTER_BALL;HAS_MEASURE_0]);; + + +let HAS_MEASURE_AFF_GT_1_2_INTER_BALL=prove(`!x:real^3 v:real^3 u:real^3 r:real. +~collinear {x,v,u}==> (aff_gt {x} {v,u} INTER normball x r) has_measure &0`, + +REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_GT_1_2_INTER_BALL;HAS_MEASURE_0]);; + + +let MEASURABLE_AFF_GT_2_1_INTER_BALL=prove(`!x:real^3 v:real^3 u:real^3 r:real. +~collinear {x,v,u}==> measurable (aff_gt {x} {v,u} INTER normball x r)`, +REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[measurable;] +THEN EXISTS_TAC`&0` +THEN MRESA_TAC HAS_MEASURE_AFF_GT_1_2_INTER_BALL[`x:real^3`;`v:real^3`;`u:real^3`;`r:real`]);; + + +let XFAN_EQ_UNIONS_AFF_GE_1_2=prove(`!x V E. +xfan(x,V,E) =UNIONS {y | ?e. e IN E /\ y = aff_ge {x} e}`, +REWRITE_TAC[xfan;UNIONS;IN_ELIM_THM] +THEN SET_TAC[]);; + + + + +let NEGLIGIBLE_XFAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool). +FAN (x,V,E) ==> negligible (xfan (x,V,E))`, +REPEAT STRIP_TAC THEN REWRITE_TAC[XFAN_EQ_UNIONS_AFF_GE_1_2] THEN MATCH_MP_TAC NEGLIGIBLE_UNIONS +THEN MRESAL_TAC set_edges_is_finite_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`][IN_ELIM_THM] +THEN MRESAL_TAC FINITE_IMAGE[`(\e:real^3->bool. aff_ge {x:real^3} e)`;`E:(real^3->bool)->bool`][IMAGE;] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "EM") +THEN STRIP_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] +THEN ASM_MESON_TAC[NEGLIGIBLE_AFF_GE_1_2]);; + + +let NEGLIGIBLE_XFAN_INTER_BALL=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool) r:real. +FAN (x,V,E) ==> negligible (xfan (x,V,E) INTER normball x r)`, +REPEAT STRIP_TAC THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET +THEN EXISTS_TAC`xfan ((x:real^3),(V:real^3->bool),(E:(real^3->bool)->bool))` +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[NEGLIGIBLE_XFAN;SET_RULE`xfan (x,V,E) INTER normball x r SUBSET xfan (x,V,E)`]);; + + + +let MEASURE_XFAN=prove(`!x:real^3 V E. +FAN (x,V,E) ==> measure (xfan (x,V,E))= &0`, + +REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0 +THEN ASM_SIMP_TAC[NEGLIGIBLE_XFAN]);; + + +let HAS_MEASURE_XFAN=prove(`!x:real^3 V E. +FAN (x,V,E) ==> (xfan (x,V,E)) has_measure &0`, + +REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[NEGLIGIBLE_XFAN;HAS_MEASURE_0]);; + + + +let MEASURE_XFAN_INTER_BALL=prove(`!x:real^3 V E r. +FAN (x,V,E) ==> measure (xfan (x,V,E) INTER normball x r)= &0`, + +REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0 +THEN ASM_SIMP_TAC[NEGLIGIBLE_XFAN_INTER_BALL]);; + + +let HAS_MEASURE_XFAN_INTER_BALL=prove(`!x:real^3 V E r. +FAN (x,V,E) ==> (xfan (x,V,E) INTER normball x r) has_measure &0`, + +REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[NEGLIGIBLE_XFAN_INTER_BALL;HAS_MEASURE_0]);; + + + +let MEASURABLE_BALL_INTER_UNIV=prove(`!x r. measurable ((:real^3) INTER normball x r)`, +REWRITE_TAC[SET_RULE`(:real^3) INTER (A:real^3->bool)=A`;GSYM ball_eq_normball;MEASURABLE_BALL]);; + + + + + + + + +let MEASURE_YFAN_INTER_BALL=prove(`!x:real^3 V E r. +FAN(x,V,E)/\ &0<= r +==> measure ( (yfan (x,V,E)) INTER normball x r)= &4/ &3 *pi *r pow 3`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[yfan;SET_RULE`((:real^3) DIFF xfan (x,V,E)) INTER normball x r= normball x r DIFF (xfan (x,V,E) INTER normball x r)`] +THEN MRESAL_TAC HAS_MEASURE_XFAN_INTER_BALL[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` r:real`][HAS_MEASURE_MEASURABLE_MEASURE;GSYM ball_eq_normball] +THEN MRESAL_TAC MEASURE_DIFF_SUBSET[`normball (x:real^3) (r:real)`;`(xfan ((x:real^3),V:real^3->bool,E) INTER normball x r)`][GSYM ball_eq_normball;MEASURABLE_BALL;SET_RULE`xfan (x,V,E) INTER ball (x,r) SUBSET ball (x,r)`;] +THEN ASM_SIMP_TAC[VOLUME_BALL] +THEN REAL_ARITH_TAC);; + + + + +let MESURABLE_YFAN_INTER_BALL=prove(`!x:real^3 V E r. +FAN(x,V,E)/\ &0<= r +==> measurable ( (yfan (x,V,E)) INTER normball x r)`, + + +REPEAT STRIP_TAC +THEN REWRITE_TAC[yfan;SET_RULE`((:real^3) DIFF xfan (x,V,E)) INTER normball x r= normball x r DIFF (xfan (x,V,E) INTER normball x r)`] +THEN MRESAL_TAC HAS_MEASURE_XFAN_INTER_BALL[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` r:real`][HAS_MEASURE_MEASURABLE_MEASURE;GSYM ball_eq_normball] +THEN MRESAL_TAC MEASURABLE_DIFF[`normball (x:real^3) (r:real)`;`(xfan ((x:real^3),V:real^3->bool,E) INTER normball x r)`][GSYM ball_eq_normball;MEASURABLE_BALL;SET_RULE`xfan (x,V,E) INTER ball (x,r) SUBSET ball (x,r)`;]);; + + + + + + +let RADIAL_DIFF=prove(`!r v0 A B:real^N->bool. radial_norm r v0 A /\ radial_norm r v0 B /\ A SUBSET B ==> radial_norm r v0 (B DIFF A)`, + +REWRITE_TAC[radial_norm] +THEN REPEAT STRIP_TAC +THENL[ +ASM_TAC THEN SET_TAC[]; + +MP_TAC(SET_RULE`v0 + u:real^N IN B DIFF A==> v0 + u IN B /\ ~(v0 + u IN A)`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC `!u:real^N. v0 + u IN B ==> (!t. t > &0 /\ t * norm u < r ==> v0 + t % u IN B)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC `u:real^N` th)) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `t:real`) +THEN FIND_ASSUM MP_TAC `!u:real^N. v0 + u IN A ==> (!t. t > &0 /\ t * norm u < r ==> v0 + t % u IN A)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC `t% u:real^N` th)) +THEN DISJ_CASES_TAC(SET_RULE`v0 + t % u IN A \/ ~(v0 + t % u:real^N IN A)`) +THENL[POP_ASSUM (fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `inv t:real`) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`t> &0==> ~(t= &0) /\ &0<= t`) THEN RESA_TAC +THEN MRESA1_TAC REAL_ABS_REFL`t:real` +THEN MRESA1_TAC REAL_MUL_LINV`t:real` +THEN MRESAL1_TAC REAL_LT_INV `t:real`[REAL_ARITH`&0 A> &0`;NORM_MUL; REAL_ARITH`A*B*C=(A*B)*C`;REAL_ARITH`&1 *A=A`;VECTOR_ARITH`A % B%C=(A*B)%C`;VECTOR_ARITH`&1 %A=A`] +THEN MP_TAC(SET_RULE`B SUBSET normball v0 r /\ v0 + u:real^N IN B==> v0 + u IN normball v0 r`) +THEN ASM_REWRITE_TAC[normball;IN_ELIM_THM;dist;VECTOR_ARITH`(A+B)-A=B:real^N`] +THEN SET_TAC[]; + +ASM_TAC THEN SET_TAC[]]]);; + + + + +let RADIAL_UNION=prove(`!r v0 A B:real^N->bool. radial_norm r v0 A /\ radial_norm r v0 B ==> radial_norm r v0 (A UNION B)`, + +REWRITE_TAC[radial_norm;IN_UNION] +THEN REPEAT STRIP_TAC +THEN ASM_TAC THEN SET_TAC[]);; + + +let RADIAL_EMPTY=prove(`!r v0:real^N. radial_norm r v0 {}`, +REWRITE_TAC[radial_norm;] +THEN SET_TAC[]);; + + +let RADIAL_UNIONS=prove(`!r v0 f:(real^N->bool)->bool. + FINITE f /\ (!s. s IN f ==> radial_norm r v0 s) + ==> (radial_norm r v0 (UNIONS f))`, + GEN_TAC THEN GEN_TAC THEN REWRITE_TAC[IMP_CONJ] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + SIMP_TAC[UNIONS_0; UNIONS_INSERT; RADIAL_EMPTY] THEN + REWRITE_TAC[IN_INSERT] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC RADIAL_UNION THEN ASM_SIMP_TAC[]);; + + + +let RADIAL_UNIV=prove(`!r x. r> &0 ==> radial_norm r x ((:real^N) INTER normball x r)`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[radial_norm] +THEN REPEAT STRIP_TAC +THENL +[ SET_TAC[]; +UNDISCH_TAC `(x:real^N) + u IN (:real^N) INTER normball x r` THEN +ASM_SIMP_TAC[aff_normball;SET_RULE`(:real^N) INTER (A:real^N->bool)=A`]]);; + + + + +let RADIAL_AFF_GE_1_2 = prove(`!x u v r. + (DISJOINT {(x:real^B)} {u,v} /\ (r > &0) ) ==> + radial_norm r x (aff_ge {x} {u,v} INTER normball x r)`, + +REWRITE_TAC[radial_norm] +THEN REPEAT STRIP_TAC +THENL[SET_TAC[]; + +UNDISCH_TAC `(x:real^B) + u' IN aff_ge {x} {u, v} INTER normball x r` +THEN ASM_SIMP_TAC[AFF_GE_1_2] +THEN REWRITE_TAC[IN_ELIM_THM;IN_INTER] +THEN REPEAT STRIP_TAC +THENL[EXISTS_TAC `&1 + (t:real) * t1 - t` +THEN EXISTS_TAC `(t:real) * t2` +THEN EXISTS_TAC `(t:real) * t3` +THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 + t * t1 - t) + t * t2 + t * t3 = &1 + t * (t1 + t2 +t3)-t `; REAL_ARITH`&1 + t * &1 - t = &1`;VECTOR_ARITH`(&1 + t * t1 - t) % x + (t * t2) % u + (t * t3) % v=x + t % (t1 % x + t2 % u + t3 % v) - t %x`;] +THEN MP_TAC(REAL_ARITH`t> &0 ==> &0<= t`) THEN RESA_TAC +THEN SUBGOAL_THEN `&0 <= t * t2 /\ &0 <= t * t3` (fun t -> REWRITE_TAC[t]) +THENL[ ASM_MESON_TAC[REAL_LE_MUL]; +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN VECTOR_ARITH_TAC]; + +MATCH_MP_TAC aff_normball +THEN ASM_REWRITE_TAC[]]]);; + +let RADIAL_AFF_GT_3_1 = prove_by_refinement(`!x u v w r. + (DISJOINT {(x:real^B),u,v} {w} /\ (r > &0) ) ==> + radial_norm r x (aff_gt {x,u,v} {w} INTER normball x r)`, +[ +REWRITE_TAC[radial_norm]; +REPEAT STRIP_TAC; +SET_TAC[]; +UNDISCH_TAC `(x:real^B) + u' IN aff_gt {x,u,v} {w} INTER normball x r`; +ASM_SIMP_TAC[AFF_GT_3_1]; +REWRITE_TAC[IN_ELIM_THM;IN_INTER]; +REPEAT STRIP_TAC; +EXISTS_TAC `&1 + (t:real) * t1 - t`; +EXISTS_TAC `(t:real) * t2`; +EXISTS_TAC `(t:real) * t3`; +EXISTS_TAC `(t:real) * t4`; +SUBGOAL_THEN `&0 < t * t4` (fun t -> REWRITE_TAC[t]); +ASM_MESON_TAC[REAL_MUL_POS_LT;REAL_ARITH `r > &0 <=> &0 < r`]; +CONJ_TAC; +SUBGOAL_THEN `(&1 + t * t1 - t) + t * t2 + t * t3 + t * t4 = &1 - t + t * (t1 + t2 + t3 + t4)` (fun t-> ASM_REWRITE_TAC[t]); +REAL_ARITH_TAC; +REAL_ARITH_TAC; +ONCE_REWRITE_TAC[ VECTOR_ARITH `( &1 + t * t1 - t) % (x:real^B) + (t * t2) % u + (t * t3) % v + (t * t4) % w = x - t % x + t % (t1 % x + t2 % u + t3 % v + t4 % w)`]; +UNDISCH_TAC `(x:real^B) + u' = t1 % x + t2 % u + t3 % v + t4 % w`; +DISCH_THEN(fun thm -> ONCE_REWRITE_TAC[GSYM thm]); +VECTOR_ARITH_TAC; +MATCH_MP_TAC aff_normball; +ASM_REWRITE_TAC[]; +]);; + + +let RADIAL_INTERS=prove(`!r v0 f:(real^N->bool)->bool. + FINITE f /\ (!s. s IN f ==> radial_norm r v0 (s INTER normball v0 r))/\ r> &0 + ==> (radial_norm r v0 (INTERS f INTER normball v0 r))`, + + GEN_TAC THEN GEN_TAC THEN REWRITE_TAC[IMP_CONJ] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + SIMP_TAC[ INTERS_0; INTERS_INSERT;RADIAL_UNIV;FORALL_IN_CLAUSES] THEN + REWRITE_TAC[IN_INSERT;SET_RULE`(x INTER INTERS f) INTER normball v0 r=(x INTER normball v0 r) INTER (INTERS f INTER normball v0 r)`] THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC inter_radial THEN ASM_SIMP_TAC[]);; + + + + + +let XFAN_INTER_BALL_UNIONS=prove(`!x:real^N V E. +xfan(x,V,E) INTER normball x r= UNIONS {y | ?e. e IN E /\ y = (aff_ge {x} e) INTER normball x r}`, +REPEAT GEN_TAC +THEN REWRITE_TAC[XFAN_EQ_UNIONS_AFF_GE_1_2] +THEN ONCE_REWRITE_TAC[ EXTENSION] +THEN REWRITE_TAC[UNIONS; INTER;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC `{x' | x' IN aff_ge {x} e /\ x' IN normball (x:real^N) (r:real)}` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC THEN RESA_TAC +THEN EXISTS_TAC`e:real^N->bool` +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC +THEN EXISTS_TAC `aff_ge {x:real^N} e ` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC `e:real^N->bool` +THEN ASM_REWRITE_TAC[]]);; + + +let RADIAL_XFAN_INTER_BALL=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) r. +FAN (x,V,E) /\ r> &0 ==> radial_norm r x (xfan (x,V,E) INTER normball x r)`, +REPEAT STRIP_TAC THEN REWRITE_TAC[XFAN_INTER_BALL_UNIONS] + THEN MATCH_MP_TAC RADIAL_UNIONS +THEN MRESAL_TAC set_edges_is_finite_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`][IN_ELIM_THM] +THEN MRESAL_TAC FINITE_IMAGE[`(\e:real^3->bool. aff_ge {x:real^3} e INTER normball x r)`;`E:(real^3->bool)->bool`][IMAGE;] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "EM") +THEN STRIP_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] +THEN ASM_MESON_TAC[RADIAL_AFF_GE_1_2]);; + + + + + +let RADIAL_NORM_YFAN_INTER_BALL=prove(`!x:real^3 V E r. +FAN(x,V,E) /\ r> &0 +==> radial_norm r x ( (yfan (x,V,E)) INTER normball x r)`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[yfan;SET_RULE`((:real^3) DIFF xfan (x,V,E)) INTER normball x r= ((:real^3) INTER normball x r) DIFF (xfan (x,V,E) INTER normball x r)`] +THEN MRESA_TAC RADIAL_UNIV[`r:real`;`x:real^3`] +THEN MRESA_TAC RADIAL_XFAN_INTER_BALL[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` r:real`] +THEN MRESAL_TAC RADIAL_DIFF[`r:real`;`x:real^3`;`(xfan ((x:real^3),V:real^3->bool,E) INTER normball x r)`;`(:real^3) INTER normball (x:real^3) (r:real)`;][SET_RULE`xfan (x,V,E) INTER normball x r SUBSET (:real^3) INTER normball x r`;]);; + + + + + + + +let SOLID_ANGLE_YFAN=prove(`!x:real^3 V E. +FAN (x,V,E) ==> sol x (yfan (x,V,E))= &4 * pi`, +REPEAT STRIP_TAC +THEN MRESAL_TAC RADIAL_NORM_YFAN_INTER_BALL[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` &1:real`][REAL_ARITH`&1> &0`] +THEN MRESAL_TAC MESURABLE_YFAN_INTER_BALL +[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` &1:real`][REAL_ARITH`&0<= &1`] +THEN MRESAL_TAC MEASURE_YFAN_INTER_BALL +[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` &1:real`][REAL_ARITH`&0<= &1`] +THEN MRESAL_TAC sol[`x:real^3`;`yfan(x:real^3,V:real^3->bool,E)`;`&1`][REAL_ARITH`&1> &0`] +THEN REAL_ARITH_TAC);; + + + +let SUM_SOL_IN_TOPOLOGICAL_COMPONENET_EQ_IN_FACE_SET=prove(`!x:real^3 V E. +FAN(x,V,E) /\ conforming_fan (x,V,E) +==> sum (topological_component_yfan (x,V,E)) (\f. sol x f) = sum (face_set (hypermap1_of_fanx (x,V,E))) (\f. sol x (dartset_leads_into_fan x V E f))`, +REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC SUM_IMAGE[`(\f. (dartset_leads_into_fan x V E f))`;`(\f. sol x f)`;`(face_set (hypermap1_of_fanx (x:real^3,V,E)))`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`(!x' y. + x' IN face_set (hypermap1_of_fanx (x,V,E)) /\ + y IN face_set (hypermap1_of_fanx (x,V,E)) /\ + dartset_leads_into_fan x V E x' = dartset_leads_into_fan x V E y + ==> x' = y)`ASSUME_TAC +THENL[ +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "A") +THEN REPEAT STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`x':real^3#real^3#real^3#real^3->bool`] +THEN REMOVE_THEN "A" (fun th-> MRESA1_TAC th`dartset_leads_into_fan (x:real^3) V E x'` ) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3->bool` THEN MRESA1_TAC th`x':real^3#real^3#real^3#real^3->bool`); +POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[FUN_EQ_THM;o_DEF;] +THEN SUBGOAL_THEN`(IMAGE (\f. dartset_leads_into_fan x V E f) + (face_set (hypermap1_of_fanx (x,V,E))))=topological_component_yfan (x,V,E)` ASSUME_TAC +THENL[ + ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL[STRIP_TAC +THEN ASM_SIMP_TAC[dartset_leads_into_is_topological_component_yfan]; + +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "A") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "A" (fun th-> MRESA1_TAC th`x':real^3->bool` ) +THEN EXISTS_TAC`f:real^3#real^3#real^3#real^3->bool` +THEN ASM_REWRITE_TAC[]]; +ASM_REWRITE_TAC[]]]);; + + + + +let SOL_EMPTY=prove(`!x:real^3. + sol x {} = &0`, +GEN_TAC +THEN MRESAL_TAC sol[`x:real^3`;`{}:real^3->bool`;`&1`][REAL_ARITH`&1> &0`;SET_RULE`{} INTER normball x (&1)={}`;MEASURABLE_EMPTY;RADIAL_EMPTY;MEASURE_EMPTY] +THEN REAL_ARITH_TAC);; + + + +let SOL_DISJOINT_UNION =prove(`!x:real^3 s t r. r > &0 /\ measurable (s INTER normball x r) /\ measurable (t INTER normball x r) /\ DISJOINT s t /\ radial_norm r x (s INTER normball x r) /\ radial_norm r x (t INTER normball x r) + ==> sol x (s UNION t) = sol x s + sol x t`, + +REPEAT STRIP_TAC +THEN MRESAL_TAC MEASURABLE_UNION[`(s INTER normball x r):real^3->bool`;`(t INTER normball x r):real^3->bool`][SET_RULE`(s INTER normball x r) UNION (t INTER normball x r):real^3->bool=((s UNION t) INTER normball x r):real^3->bool`] +THEN MP_TAC(SET_RULE`DISJOINT (s:real^3->bool) t +==>DISJOINT (s INTER normball x r) (t INTER normball x r)`) +THEN RESA_TAC +THEN MRESAL_TAC MEASURE_DISJOINT_UNION[`(s INTER normball x r):real^3->bool`;`(t INTER normball x r):real^3->bool`][SET_RULE`(s INTER normball x r) UNION (t INTER normball x r):real^3->bool=((s UNION t) INTER normball x r):real^3->bool`] +THEN MRESAL_TAC RADIAL_UNION[`r:real`;`x:real^3`;`(s INTER normball x r):real^3->bool`;`(t INTER normball x r):real^3->bool`][SET_RULE`(s INTER normball x r) UNION (t INTER normball x r):real^3->bool=((s UNION t) INTER normball x r):real^3->bool`] +THEN MRESA_TAC sol[`x:real^3`;`s:real^3->bool`;`r:real`] +THEN MRESA_TAC sol[`x:real^3`;`t:real^3->bool`;`r:real`] +THEN MRESA_TAC sol[`x:real^3`;`s UNION t:real^3->bool`;`r:real`] +THEN REAL_ARITH_TAC);; + + +let UNIONS_INTER=prove(`!f t:A->bool. UNIONS f INTER t= UNIONS {s INTER t| s IN f}`, + +ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[UNIONS;INTER;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`{x | x IN u /\ x IN t}:A->bool` +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`u :A->bool` +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC +THEN EXISTS_TAC`s :A->bool` +THEN ASM_REWRITE_TAC[]]);; + + + + + + +let UNIONS_INTER1=prove(`!f t:A->bool. UNIONS f INTER t= UNIONS {y | ?s. s IN f /\ y = s INTER t}`, + +ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[UNIONS;INTER;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`{x | x IN u /\ x IN t}:A->bool` +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`u :A->bool` +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC +THEN EXISTS_TAC`s :A->bool` +THEN ASM_REWRITE_TAC[]]);; + + + +let MEASURABLE_UNIONS = prove + (`!f:(real^N->bool)->bool. + FINITE f /\ (!s. s IN f ==> measurable s) + ==> measurable (UNIONS f)`, + REWRITE_TAC[IMP_CONJ] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + SIMP_TAC[UNIONS_0; UNIONS_INSERT; MEASURABLE_EMPTY] THEN + REWRITE_TAC[IN_INSERT] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC MEASURABLE_UNION THEN ASM_SIMP_TAC[]);; + + + +let SOL_UNIONS=prove(`!r x f:(real^3->bool)->bool. + FINITE f /\ r> &0 /\ + (!s. s IN f ==> measurable (s INTER normball x r) /\ radial_norm r x (s INTER normball x r)) /\ + (!s t. s IN f /\ t IN f /\ ~(s = t) ==> DISJOINT s t) + ==> sol x (UNIONS f) = sum f (\s. sol x s)`, +GEN_TAC THEN GEN_TAC THEN REWRITE_TAC[IMP_CONJ] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + SIMP_TAC[UNIONS_0; UNIONS_INSERT; SOL_EMPTY;SUM_CLAUSES] +THEN REWRITE_TAC[IN_INSERT] THEN REPEAT STRIP_TAC +THEN ASM_TAC THEN DISCH_THEN(LABEL_TAC"EM") +THEN ASM_REWRITE_TAC[SET_RULE`(!s. P s \/ Q s==> C s)<=> (!s. P s ==> C s) /\ (!s. Q s ==> C s)`;SET_RULE`(!s. P s /\ Q s) <=> (!s. P s) /\ (!s. Q s)`; +SET_RULE`(!s. E s ==> P s \/ Q s==> C s)<=> (!s. E s==> P s ==> C s) /\ (!s. E s ==> Q s ==> C s)`] +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MATCH_MP_TAC SOL_DISJOINT_UNION +THEN EXISTS_TAC`r:real` +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM (fun th-> MP_TAC (SPEC `x':real^3->bool` th))`!s:real^3->bool. s = x' + ==> measurable (s INTER normball x r) /\ + radial_norm r x (s INTER normball x r)` +THEN REWRITE_TAC[] +THEN DISCH_TAC +THEN ASM_SIMP_TAC[UNIONS_INTER1] +THEN MRESAL_TAC FINITE_IMAGE[`(\s:real^3->bool. s INTER normball x r)`;`f:(real^3->bool)->bool`][IMAGE;] +THEN FIND_ASSUM MP_TAC`!s:real^3->bool. s IN f + ==> measurable (s INTER normball x r) /\ + radial_norm r x (s INTER normball x r)` + +THEN REWRITE_TAC[SET_RULE`(!s. P s==> Q s /\ Q1 s)<=>(!s. P s==> Q s )/\ (!s. P s==> Q1 s)`] +THEN STRIP_TAC + +THEN MRESAL_TAC RADIAL_UNIONS[`r:real`;`x:real^3`;`{y | ?s. s IN f /\ y = s INTER normball x r}:(real^3->bool)->bool`;][IN_ELIM_THM;SET_RULE`(!s. (?s'. s' IN f /\ s = P s') ==> Q s) <=> (!s. s IN f ==> Q (P s))` +] +THEN MRESAL_TAC MEASURABLE_UNIONS[`{y | ?s. s IN f /\ y = s INTER normball x r}:(real^3->bool)->bool`;][IN_ELIM_THM;SET_RULE`(!s. (?s'. s' IN f /\ s = P s') ==> Q s) <=> (!s. s IN f ==> Q (P s))`;DISJOINT] +THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B= B INTER A`] +THEN REWRITE_TAC[UNIONS_INTER1] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th `x':real^3->bool`[SET_RULE` (!t. t IN f ==> ~(x' = t) ==> DISJOINT x' t) +<=> (!t. t IN f /\ ~(x' = t) ==> DISJOINT x' t)`]) +THEN FIND_ASSUM MP_TAC`~((x':real^3->bool) IN f)` +THEN REWRITE_TAC[SET_RULE`~(x' IN f)<=> (!t. t IN f ==> ~(x' = t))`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` (!t. t IN f /\ ~(x' = t:real^3->bool) ==> DISJOINT x' t) /\ +(!t. t IN f ==> ~(x' = t:real^3->bool))==> (!t. t IN f ==> DISJOINT x' t)`) +THEN ASM_REWRITE_TAC[DISJOINT] +THEN SET_TAC[]);; + +let BOUNDED_INTER_BALL=prove(`!x:real^3 V E. +FAN(x,V,E) /\ conforming_fan (x,V,E) +==>(!f. f IN topological_component_yfan (x,V,E) + ==> bounded (f INTER normball x r)) `, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC BOUNDED_SUBSET +THEN EXISTS_TAC`(normball x r):real^3->bool` +THEN SIMP_TAC[GSYM ball_eq_normball;BOUNDED_BALL] +THEN SET_TAC[]);; + + +let OPEN_AFF_GT_3_1=prove(`!x v u w:real^3. + (~coplanar {x,v,u,w}) ==> open (aff_gt {x,v,u} {w})`, + + GEOM_ORIGIN_TAC `x:real^3` THEN + REPEAT STRIP_TAC THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN DISCH_TAC THEN +MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] THEN DISCH_TAC THEN ASSUME_TAC th) +THEN MRESAL_TAC coplanar_cross_dot[`vec 0:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN MP_TAC (REAL_ARITH`~((v cross u) dot w = &0)==> &0< (v cross u) dot w \/ &0< --((v cross u) dot w)`) +THEN RESA_TAC +THENL[POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN DISCH_TAC THEN ASSUME_TAC th) THEN ASSUME_TAC th) +THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`][VECTOR_ARITH`A- vec 0=A`;] +THEN REWRITE_TAC[REAL_ARITH`&0 A> &0`; OPEN_HALFSPACE_GT]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM DOT_LNEG] +THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] +THEN ASM_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`(vec 0):real^3`;`u:real^3`;`v:real^3`;`w:real^3`][VECTOR_ARITH`A- vec 0=A`;] +THEN REWRITE_TAC[ REAL_ARITH`&0 A> &0`;OPEN_HALFSPACE_GT;] ]);; + + + + +let EQ_SET_THM=prove(`!f' f.{(f:A->B) y| y IN f'}= {t|(?y. y IN f' /\ t = f y)}`, +ONCE_REWRITE_TAC[EXTENSION] THEN REWRITE_TAC[IN_ELIM_THM]);; + + +let fully_surrounded_imp_aff_gt_3_1_of_dart_eq_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set (hypermap1_of_fanx (x,V,E)) +/\ y IN ds +==> aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y)} = + aff_gt {x, pr2 y, pr3 y} {sigma_fan x V E (pr2 y) (pr3 y)}`, + +REPEAT STRIP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y IN ds /\ ds SUBSET d1_fan(x,V,E)==> y IN d1_fan (x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr2;pr3;f1_fan] +THEN ASM_SIMP_TAC[fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan]);; + + + + + +let OPEN_TOPOLOGICAL_COMPONENT_YFAN=prove(`!x:real^3 V E f. +FAN(x,V,E) /\ conforming_fan (x,V,E)/\ f IN topological_component_yfan (x,V,E) + ==> open f`, +REWRITE_TAC[conforming_fan;conforming_bijection_fan;conforming_half_space_fan] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "EM" (fun th-> MRESAL1_TAC th`f:real^3->bool`[EXISTS_UNIQUE]) +THEN REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th`f':real^3#real^3#real^3#real^3->bool`) +THEN MATCH_MP_TAC OPEN_INTERS +THEN ASM_REWRITE_TAC[IN_ELIM_THM;] +THEN MRESA_TAC FINITE_FACE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f':real^3#real^3#real^3#real^3->bool`] +THEN MRESAL_TAC FINITE_IMAGE[`(\y:real^3#real^3#real^3#real^3. aff_gt {x:real^3, pr2 y, pr3 y} {pr3 (f1_fan x V E y)})`;`f':real^3#real^3#real^3#real^3->bool`][IMAGE;EQ_SET_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_dart_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f':real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`] +THEN MATCH_MP_TAC OPEN_AFF_GT_3_1 +THEN MRESA_TAC properties_of_elements_in_face_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f':real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`(pr2 y):real^3`;`(pr3 y):real^3`] ) +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`(pr2 y):real^3`;`(pr3 y):real^3`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`(pr2 y):real^3`;`(pr3 y):real^3`] +THEN DISCH_TAC +THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`(pr2 y):real^3`;`(sigma_fan x V E (pr2 y) (pr3 y)):real^3`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E (pr2 y) (pr3 y)):real^3`;`(pr2 y):real^3`;`(pr3 y):real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN ASM_REWRITE_TAC[]);; + + +let OPEN_TOPOLOGICAL_COMPONENT_YFAN_INTER_BALL=prove(`!x:real^3 V E f. +FAN(x,V,E) /\ conforming_fan (x,V,E)/\ f IN topological_component_yfan (x,V,E) + ==> open (f INTER normball x r)`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC OPEN_INTER +THEN ASM_SIMP_TAC[GSYM ball_eq_normball;OPEN_BALL;] +THEN ASM_MESON_TAC[OPEN_TOPOLOGICAL_COMPONENT_YFAN]);; + + +let MEASURABLE_TOPOLOGICAL_COMPONENT_YFAN_INTER_BALL=prove(`!x:real^3 V E r f. +FAN(x,V,E) /\ conforming_fan (x,V,E) /\ f IN topological_component_yfan (x,V,E) + ==> measurable (f INTER normball x r) `, + +REPEAT STRIP_TAC +THEN MATCH_MP_TAC MEASURABLE_OPEN +THEN ASM_MESON_TAC[OPEN_TOPOLOGICAL_COMPONENT_YFAN_INTER_BALL;BOUNDED_INTER_BALL]);; + + + +let RADIAL_TOPOLOGICAL_COMPONENT_YFAN=prove(`!x:real^3 V E r f. +FAN(x,V,E) /\ r> &0 /\ conforming_fan (x,V,E) /\ f IN topological_component_yfan (x,V,E) + ==> radial_norm r x (f INTER normball x r) `, + +REWRITE_TAC[conforming_fan;conforming_bijection_fan;conforming_half_space_fan] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "EM" (fun th-> MRESAL1_TAC th`f:real^3->bool`[EXISTS_UNIQUE]) +THEN REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th`f':real^3#real^3#real^3#real^3->bool`) +THEN MATCH_MP_TAC RADIAL_INTERS +THEN ASM_REWRITE_TAC[IN_ELIM_THM;] +THEN MRESA_TAC FINITE_FACE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f':real^3#real^3#real^3#real^3->bool`] +THEN MRESAL_TAC FINITE_IMAGE[`(\y:real^3#real^3#real^3#real^3. aff_gt {x:real^3, pr2 y, pr3 y} {pr3 (f1_fan x V E y)})`;`f':real^3#real^3#real^3#real^3->bool`][IMAGE;EQ_SET_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_dart_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f':real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`] +THEN MATCH_MP_TAC RADIAL_AFF_GT_3_1 +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC properties_of_elements_in_face_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f':real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`(pr2 y):real^3`;`(pr3 y):real^3`] ) +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`(pr2 y):real^3`;`(pr3 y):real^3`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`(pr2 y):real^3`;`(pr3 y):real^3`] +THEN DISCH_TAC +THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`(pr2 y):real^3`;`(sigma_fan x V E (pr2 y) (pr3 y)):real^3`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E (pr2 y) (pr3 y)):real^3`;`(pr2 y):real^3`;`(pr3 y):real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN ASM_REWRITE_TAC[] +THEN ASM_MESON_TAC[notcoplanar_disjoints]);; + + +let FINITE_TOPOLOGICAL_COMPONENT_YFAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +==> FINITE (topological_component_yfan (x,V,E))`, +REPEAT STRIP_TAC +THEN MRESA1_TAC FINITE_HYPERMAP_ORBITS`hypermap1_of_fanx (x:real^3,V,E)` +THEN MRESAL_TAC FINITE_IMAGE[`(\f:real^3#real^3#real^3#real^3->bool. dartset_leads_into_fan x V E f)`;`face_set (hypermap1_of_fanx (x:real^3,V,E))`][IMAGE;] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`{y | ?f. f IN face_set (hypermap1_of_fanx (x,V,E)) /\ + y = dartset_leads_into_fan x V E f} =topological_component_yfan (x:real^3,V,E)` (fun th-> REWRITE_TAC[th]) +THEN ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC THEN EQ_TAC +THENL[ +REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[dartset_leads_into_is_topological_component_yfan]; + +REPEAT STRIP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A=B<=> B=A`] +THEN ASM_SIMP_TAC[version_JUTSTKG]]);; + + +let SUM_SOL_TOPOLOGICAL_COMPONENT_YFAN_EQ_SOL_UNIONS=prove(`!x:real^3 V E. +FAN(x,V,E) /\ conforming_fan (x,V,E) +==> sol x (UNIONS (topological_component_yfan (x,V,E)))=sum (topological_component_yfan (x,V,E)) (\f. sol x f)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[conforming_fan]; THEN ASSUME_TAC th THEN STRIP_TAC) +THEN MATCH_MP_TAC SOL_UNIONS +THEN MRESAL_TAC FINITE_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;][SET_RULE`(!s. P s==> Q s /\ R s)<=>(!s. P s==> Q s) /\(!s. P s==> R s)`] +THEN EXISTS_TAC`&1` +THEN MRESAL_TAC RADIAL_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`&1:real`][REAL_ARITH`&1> &0`] +THEN MRESA_TAC MEASURABLE_TOPOLOGICAL_COMPONENT_YFAN_INTER_BALL[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`&1:real`] +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DISJOINT;CONNECTED_COMPONENT_NONOVERLAP]);; + +let UNIONS_TOPOLOGICAL_COMPONENT_EQ_YFAN=prove(`!x:real^3 V E. + UNIONS (topological_component_yfan (x,V,E))= yfan(x,V,E)`, + ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[UNIONS;topological_component_yfan;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MATCH_MP_TAC(SET_RULE`!x B A. x IN B /\ B SUBSET A==> x IN A`) +THEN EXISTS_TAC`connected_component (yfan (x:real^3,V:real^3->bool,E)) (y:real^3)` +THEN ASM_REWRITE_TAC[CONNECTED_COMPONENT_SUBSET]; +STRIP_TAC +THEN EXISTS_TAC`connected_component (yfan (x,V:real^3->bool,E)) x'` +THEN STRIP_TAC +THENL[EXISTS_TAC`x':real^3` +THEN ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[IN;CONNECTED_COMPONENT_REFL_EQ]]]);; + + +let SUM_SOL_IN_FACE_SET_EQ_4PI=prove(`!x:real^3 V E. +FAN(x,V,E) /\ conforming_fan (x,V,E) +==> sum (face_set (hypermap1_of_fanx (x,V,E))) (\f. sol x (dartset_leads_into_fan x V E f))= &4 * pi`, + +REPEAT STRIP_TAC +THEN MRESA_TAC SUM_SOL_IN_TOPOLOGICAL_COMPONENET_EQ_IN_FACE_SET[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC SUM_SOL_TOPOLOGICAL_COMPONENT_YFAN_EQ_SOL_UNIONS[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;UNIONS_TOPOLOGICAL_COMPONENT_EQ_YFAN]) +THEN ASM_SIMP_TAC[SOLID_ANGLE_YFAN]);; + + + + +let DART_EQ_UNIONS_FACE_SET_NODE_SET_EDGE_SET=prove(`!(H:(A)hypermap). dart H = UNIONS (face_set H)/\ dart H = UNIONS (node_set H)/\ dart H = UNIONS (edge_set H)`, + GEN_TAC THEN REWRITE_TAC[face_set;node_set;edge_set] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC lemma_partition +THEN REWRITE_TAC[hypermap_lemma]);; + + + +let FINITE_NODE_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +ds IN node_set(hypermap1_of_fanx (x,V,E)) +==> FINITE ds `, +REWRITE_TAC[node_set;set_of_orbits;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[GSYM node;NODE_FINITE]);; + + +let lemma_properties_of_node_set_fan=prove(`!x V E f y y1. FAN (x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1)/\ + f IN (node_set (hypermap1_of_fanx (x,V,E)) ) +/\ y IN f /\ y1 IN f +==> pr2 y = pr2 y1 `, + +REWRITE_TAC[node_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN ASM_REWRITE_TAC[orbit_map;IN_ELIM_THM;] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`;] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x':real^3#real^3#real^3#real^3`) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n':num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`;] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x':real^3#real^3#real^3#real^3`) +THEN FIND_ASSUM MP_TAC `x' IN d1_fan (x:real^3,V,E)` +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN MRESA_TAC power_n_fan[`n:num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC power_n_fan[`n':num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[pr2]);; + + + + +let lemma_node_identity_fan=prove(`!x V E f y. f IN (node_set (hypermap1_of_fanx (x,V,E)) ) + /\ y IN f +==> f= node (hypermap1_of_fanx (x,V,E)) y`, +REWRITE_TAC[node_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[node] +THEN MESON_TAC[lemma_orbit_identity; hypermap_lemma]);; + + +let node_subset_dart_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ ds IN node_set(hypermap1_of_fanx (x,V,E)) +==> ds SUBSET d_fan (x,V,E)`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA_TAC lemma_node_representation[`hypermap1_of_fanx(x:real^3,V,E)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC lemma_node_subset[`hypermap1_of_fanx(x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`]);; + + + + + + +let rep_node_set_fan=prove(`!x V E f y. FAN (x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ f IN (node_set (hypermap1_of_fanx (x,V,E)) ) + /\ y IN f +==> f = {z| ?i. i >= 0 /\ z=(x, pr2 y,power_map_points (sigma_fan) x V E (pr2 y) (pr3 y) i, power_map_points (sigma_fan) x V E (pr2 y) (pr3 y) (SUC i))}`, + + REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[lemma_node_identity_fan;] +THEN REWRITE_TAC[node;orbit_map;EXTENSION;IN_ELIM_THM] +THEN MRESA_TAC node_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MP_TAC(SET_RULE`y IN (f:real^3#real^3#real^3#real^3->bool) /\ f SUBSET d_fan(x,V,E)==> y IN d_fan(x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr2;pr3] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`;] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3`) +THEN MRESA_TAC power_n_fan[`n:num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN RESA_TAC +THEN EXISTS_TAC`n:num` +THEN ASM_SIMP_TAC[]; + +REPEAT STRIP_TAC +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`i:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`;] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3`) +THEN MRESA_TAC power_n_fan[`i:num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN RESA_TAC]);; + + +let properties_of_elements_in_node_fully_surroundedfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ ds IN node_set(hypermap1_of_fanx (x,V,E)) +/\ y IN ds +==> {pr2 y, pr3 y} IN E`, + +REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA_TAC node_subset_dart_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y IN ds /\ ds SUBSET d_fan (x,V,E)==> y IN d_fan (x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr2;pr3]);; + + +let lemma_card_node_eq_set_of_orbits=prove(`!x V E f y. FAN (x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ f IN (node_set (hypermap1_of_fanx (x,V,E)) ) + /\ y IN f +==> CARD {z| ?i. i >= 0 /\ z=(x, pr2 y,power_map_points (sigma_fan) x V E (pr2 y) (pr3 y) i, power_map_points (sigma_fan) x V E (pr2 y) (pr3 y) (SUC i))}= CARD( set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) ((pr2 y):real^3) ((pr3 y):real^3) +)`, + + REPEAT STRIP_TAC +THEN MATCH_MP_TAC BIJECTIONS_CARD_EQ +THEN EXISTS_TAC`pr3:real^3#real^3#real^3#real^3->real^3` +THEN EXISTS_TAC`(\z:real^3. x,pr2 y, z, sigma_fan x V E (pr2 y) z)` +THEN MRESA_TAC properties_of_elements_in_node_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(pr2 y):real^3`;` ((pr3 y):real^3)`]FINITE_ORBITS_SIGMA_FAN) +THEN RESA_TAC +THEN REWRITE_TAC[set_of_orbits_points_fan;IN_ELIM_THM; pr3] +THEN REWRITE_TAC[GSYM pr3] +THEN STRIP_TAC +THENL[ +STRIP_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[ARITH_RULE`0<= i <=> i>=0`;pr3;power_map_points] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; + +STRIP_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[ARITH_RULE`i>=0 <=> 0<=i`;power_map_points] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]]);; + + +let lemma_card_node_eq_set_of_edge=prove(`!x V E f y. FAN (x,V,E) /\ f IN (node_set (hypermap1_of_fanx (x,V,E)) ) +/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) /\ y IN f +==> CARD (set_of_edge (pr2 y) V E)=CARD f `, + +REPEAT STRIP_TAC +THEN MRESA_TAC rep_node_set_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC lemma_card_node_eq_set_of_orbits[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC properties_of_elements_in_node_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC CARD_SET_OF_ORBITS_POINTS_FAN[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(pr2 y):real^3`;` ((pr3 y):real^3)`]);; + + + +let mono_cyclic_power_sigma_fan=prove(`!x V E v u i j. FAN(x,V,E)/\ {v,u} IN E /\ + i IN 0..CARD (set_of_edge (v) V E) - 1 /\ + j IN 0..CARD (set_of_edge (v) V E) - 1 /\ + power_map_points sigma_fan x V E (v) (u) i = + power_map_points sigma_fan x V E (v) (u) j + ==> i = j`, + +REWRITE_TAC[IN_NUMSEG_0] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`i=j \/ i< j\/ j< i:num`) +THENL[ +ASM_REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL[ +MP_TAC(SPECL[`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;`j:num`;`i:num`]cyclic_power_sigma_fan) +THEN RESA_TAC +THEN ASM_TAC +THEN ARITH_TAC; + +MP_TAC(SPECL[`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;`i:num`;`j:num`]cyclic_power_sigma_fan) +THEN RESA_TAC +THEN ASM_TAC +THEN ARITH_TAC]]);; + + +let SUM_AZIM_FAN_OF_NODE_EQ_SUM_AZIM_I_FAN=prove(`!x V E f y. FAN (x,V,E) /\ f IN node_set (hypermap1_of_fanx (x,V,E)) /\ y IN f /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) + ==> sum (0..CARD (set_of_edge (pr2 y) V E) - 1) (\i. azim_i_fan x V E (pr2 y) (pr3 y) i) = + sum f (\y1. azim_fan x V E (pr2 y1) (pr3 y1))`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "EM") +THEN MRESA_TAC rep_node_set_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN SUBGOAL_THEN`(!x' y1. + x' IN set_of_orbits_points_fan x V E (pr2 y) (pr3 y) /\ + y1 IN set_of_orbits_points_fan x V E (pr2 y) (pr3 y) /\ + x,pr2 y,x',sigma_fan x V E (pr2 y) x' = + x,pr2 y,y1,sigma_fan x V E (pr2 y) y1 + ==> x' = y1)`ASSUME_TAC +THENL[MESON_TAC[EQ_PAIR_4]; + + MRESAL_TAC SUM_IMAGE[`(\z:real^3. x,pr2 y, z, sigma_fan x V E (pr2 y) z)`;`(\y. azim_fan x V E (pr2 y) (pr3 y))`;`set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) ((pr2 y):real^3) ((pr3 y):real^3)`][IMAGE] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[set_of_orbits_points_fan] +THEN REWRITE_TAC[IN_ELIM_THM;SET_RULE`{y' | ?x'. (?i. 0 <= i /\ + x' = power_map_points sigma_fan x V E (pr2 y) (pr3 y) i) /\ + y' = x,pr2 y,x',sigma_fan x V E (pr2 y) x'} = {y' | ?i. 0 <= i /\ + y' = x,pr2 y,power_map_points sigma_fan x V E (pr2 y) (pr3 y) i,sigma_fan x V E (pr2 y) (power_map_points sigma_fan x V E (pr2 y) (pr3 y) i)}`;power_map_points;ARITH_RULE`i>= 0<=> 0<= i`] +THEN RESA_TAC +THEN REWRITE_TAC[o_DEF;pr2;pr3] +THEN ASM_REWRITE_TAC[GSYM pr2; GSYM pr3;azim_fan;azim_i_fan] +THEN MRESA_TAC properties_of_elements_in_node_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` ((pr3 y):real^3)`;` ((pr2 y):real^3)`] +THEN REMOVE_ASSUM_TAC +THEN USE_THEN "EM"(fun th-> MP_TAC(ISPEC `(pr2 y):real^3` th) THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN RESA_TAC) + +THEN MRESA_TAC SIMP_ORBITS_POINTS_FAN[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` ((pr2 y):real^3)`;` ((pr3 y):real^3)`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC(SPECL[`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` ((pr2 y):real^3)`;` ((pr3 y):real^3)`]mono_cyclic_power_sigma_fan +) +THEN RESA_TAC +THEN MRESAL_TAC SUM_IMAGE[`(\i:num. power_map_points sigma_fan x V E (pr2 y) (pr3 y) i)`;`(\x'. azim x (pr2 y) x' (sigma_fan x V E (pr2 y) x'))`;`0..CARD (set_of_edge (pr2 y) (V:real^3->bool) E) - 1`][IMAGE;o_DEF;power_map_points] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;IN_NUMSEG_0]) +THEN MP_TAC(ARITH_RULE`CARD (set_of_edge (pr2 y) V E) > 1==> (!i. i <= CARD (set_of_edge (pr2 y) V E) - 1<=> i < CARD (set_of_edge (pr2 y) V E)) `) +THEN RESA_TAC +THEN SUBGOAL_THEN`{y1 | ?i. i < CARD (set_of_edge (pr2 y) V E) /\ + y1 = power_map_points sigma_fan x V E (pr2 y) (pr3 y) i} + = + {power_map_points sigma_fan x V E (pr2 y) (pr3 y) i | i | i < + CARD + (set_of_edge + (pr2 y) + V + E)} +`(fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM]]);; + +let exists_point_in_node=prove(`!x V E f. f IN node_set (hypermap1_of_fanx (x,V,E)) +==> ?y. y IN f`, +REWRITE_TAC[node_set;set_of_orbits;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`x':real^3#real^3#real^3#real^3` +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[POWER;ARITH_RULE`0>=0`;I_DEF]);; + + +let SUM_AZIM_FAN_OF_NODE_EQ_2PI_I_FAN=prove(`!x V E f. FAN (x,V,E) /\ f IN node_set (hypermap1_of_fanx (x,V,E)) /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) + ==> + sum f (\y. azim_fan x V E (pr2 y) (pr3 y))= &2 * pi`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC exists_point_in_node[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`;] +THEN MRESA_TAC SUM_AZIM_FAN_OF_NODE_EQ_SUM_AZIM_I_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) +THEN SUBGOAL_THEN`(\i. azim_i_fan x V E (pr2 y) (pr3 y) i)= azim_i_fan x V E (pr2 y) (pr3 y) `(fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[FUN_EQ_THM] +THEN MATCH_MP_TAC SUM_AZIMS_EQ_2PI_FAN +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC properties_of_elements_in_node_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` ((pr3 y):real^3)`;` ((pr2 y):real^3)`] +THEN REMOVE_ASSUM_TAC +THEN USE_THEN "EM"(fun th-> MP_TAC(ISPEC `(pr2 y):real^3` th) THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN RESA_TAC) +THEN ASM_REWRITE_TAC[ARITH_RULE`1 A>1`] +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge (pr2 y) V E = {(pr3 y):real^3})\/ ~(set_of_edge (pr2 y) V E = {pr3 y})`) +THENL[ +MRESA_TAC CARD_SING[`(pr3 y):real^3`; `(set_of_edge (pr2 y) V E):real^3->bool`] +THEN FIND_ASSUM MP_TAC `CARD ((set_of_edge (pr2 y) V E):real^3->bool) >1` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun TH-> REWRITE_TAC[TH]) +THEN ARITH_TAC; +ASM_REWRITE_TAC[]]);; + + + + +let SUM_CARD_FACE_NODE_DART_FAN=prove(`!x V E. + FAN (x,V,E) /\ conforming_fan (x,V,E) + ==> &2 * &(CARD (face_set (hypermap1_of_fanx (x,V,E)))) + + &2 * &(CARD (node_set (hypermap1_of_fanx (x,V,E)))) - + &(CARD (dart (hypermap1_of_fanx (x,V,E)))) = &4 `, + +REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[conforming_fan;conforming_solid_angle_fan] THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN REWRITE_TAC[SET_RULE`(!s. P s ==> Q s /\ Q1 s/\ Q2 s) <=> (!s. P s ==> Q s ) /\ (!s. P s ==> Q1 s) /\ (!s. P s ==> Q2 s)`] + THEN ASSUME_TAC th THEN STRIP_TAC) +THEN MRESA_TAC SUM_SOL_IN_FACE_SET_EQ_4PI[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC SUM_EQ[`(\f. sol x (dartset_leads_into_fan (x:real^3) V E f))`;`(\f. (&2 * pi + sum f (\y. azim_fan x V E (pr2 y) (pr3 (y:real^3#real^3#real^3#real^3)) - pi)))`;`face_set (hypermap1_of_fanx (x:real^3,V,E))`] +THEN MRESA1_TAC FINITE_HYPERMAP_ORBITS`hypermap1_of_fanx (x:real^3,V,E)` +THEN MRESA_TAC SUM_ADD[`(\f:real^3#real^3#real^3#real^3->bool. &2 * pi)`;`(\f. sum f (\y. azim_fan x V E (pr2 y) (pr3 (y:real^3#real^3#real^3#real^3)) - pi))`;`face_set (hypermap1_of_fanx (x:real^3,V,E))`] +THEN MRESA_TAC SUM_CONST[`&2 * pi`;`face_set (hypermap1_of_fanx (x:real^3,V,E))`] +THEN MRESA_TAC FINITE_FACE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN SUBGOAL_THEN`(!t1 t2 y. + t1 IN face_set (hypermap1_of_fanx (x,V,E)) /\ + t2 IN face_set (hypermap1_of_fanx (x,V,E)) /\ + ~(t1 = t2) /\ + y IN t1 /\ + y IN t2 + ==> azim_fan x V E (pr2 y) (pr3 y) - pi = &0)` ASSUME_TAC +THENL[ + REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_THEN (LABEL_TAC "EM") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face] +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x'':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face]; + + +MRESA_TAC SUM_UNIONS_NONZERO[` (\y. azim_fan x (V:real^3->bool) E (pr2 y) (pr3 (y:real^3#real^3#real^3#real^3)) - pi)`;`face_set (hypermap1_of_fanx (x:real^3,V:real^3->bool,E))`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC SUM_SUB[`(\y. azim_fan x V E (pr2 y) (pr3 (y:real^3#real^3#real^3#real^3)))`;`(\f:real^3#real^3#real^3#real^3. pi)`;`(UNIONS (node_set (hypermap1_of_fanx (x:real^3,V,E))))`] +THEN POP_ASSUM MP_TAC +THEN MRESA1_TAC DART_EQ_UNIONS_FACE_SET_NODE_SET_EDGE_SET`(hypermap1_of_fanx (x:real^3,V:real^3->bool,E))` +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC SUM_CONST[`pi`;`(UNIONS (node_set (hypermap1_of_fanx (x:real^3,V,E))))`] +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SYM th;hypermap_lemma] THEN STRIP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN REWRITE_TAC[th] THEN MP_TAC th THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN ASSUME_TAC th THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "MA")) +THEN RESA_TAC +THEN SUBGOAL_THEN`(!t1 t2 y. + t1 IN node_set (hypermap1_of_fanx (x,V,E)) /\ + t2 IN node_set (hypermap1_of_fanx (x,V,E)) /\ + ~(t1 = t2) /\ + y IN t1 /\ + y IN t2 + ==> azim_fan x V E (pr2 y) (pr3 y) = &0)` ASSUME_TAC +THENL[ + REWRITE_TAC[node_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_THEN (LABEL_TAC "EM") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN MRESAL_TAC lemma_node_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][node] +THEN MRESAL_TAC lemma_node_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x'':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][node]; + +MRESAL_TAC SUM_UNIONS_NONZERO[` (\y. azim_fan x (V:real^3->bool) E (pr2 y) (pr3 (y:real^3#real^3#real^3#real^3)))`;`node_set (hypermap1_of_fanx (x:real^3,V:real^3->bool,E))`][FINITE_NODE_FAN] +THEN MRESA_TAC SUM_AZIM_FAN_OF_NODE_EQ_2PI_I_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;] +THEN MRESA_TAC SUM_EQ[`(\t:real^3#real^3#real^3#real^3->bool. sum t (\y. azim_fan x V E (pr2 y) (pr3 y)))`;`(\t:real^3#real^3#real^3#real^3->bool. &2 * pi)`;`(node_set (hypermap1_of_fanx (x:real^3,V,E)))`] +THEN MRESA_TAC SUM_CONST[`&2 * pi`;`node_set (hypermap1_of_fanx (x:real^3,V,E))`] +THEN REMOVE_THEN "MA"(fun th-> REWRITE_TAC[SYM th]) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[REAL_ARITH`A= A * &1`] +THEN MP_TAC(REAL_ARITH`&0< pi==> ~(pi= &0)`) +THEN ASM_REWRITE_TAC[PI_WORKS] +THEN STRIP_TAC +THEN MRESA1_TAC REAL_MUL_RINV`pi:real` +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;REAL_ARITH`(A+B-C)*D*E=(A*D+B*D-C*D)*E/\ (A*B)*C=B*A*C`;]) +THEN REAL_ARITH_TAC]]);; + + + + + + + + +let nonconformin_fan_imp_n_fan_ge0=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ~(conforming_fan (x,V,E)) +==> N_FAN(x,V,E)> 0`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] +THEN ASM_SIMP_TAC[ARITH_RULE`~(A>0)<=> A=0`;DWFBRQY]);; + + +let nonconformin_fan_imp_exist_face_gt_3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ~(conforming_fan (x,V,E)) +==> ?ds. ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3`, + +REPEAT STRIP_TAC +THEN MRESA_TAC nonconformin_fan_imp_n_fan_ge0[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[N_FAN] +THEN DISJ_CASES_TAC(SET_RULE`(!f. f IN face_set (hypermap1_of_fanx (x,V,E))==> CARD f -3=0)\/ ~(!f. f IN face_set (hypermap1_of_fanx (x:real^3,V,E))==> CARD f -3=0)`) +THENL[ +ASM_SIMP_TAC[NSUM_EQ_0] THEN ARITH_TAC; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;ARITH_RULE`~(A=0)<=> A>0`] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN EXISTS_TAC`f:real^3#real^3#real^3#real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN ARITH_TAC]);; + + +let exists_face_in_face_set=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. + ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> ?f1. f1 IN ds `, + +REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`x':real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[orbit_map;IN_ELIM_THM;] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[POWER;I_DEF;ARITH_RULE`0>=0`]);; + + +let exists_node_in_face_set=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. + ds IN node_set(hypermap1_of_fanx (x,V,E)) +==> ?f1. f1 IN ds `, + +REWRITE_TAC[node_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`x':real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[orbit_map;IN_ELIM_THM;] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[POWER;I_DEF;ARITH_RULE`0>=0`]);; + + + +let identity_face_in_face_set=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds f1. + ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ f1 IN ds +==> ds= face (hypermap1_of_fanx (x,V,E)) f1 `, +REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[GSYM face;] +THEN MESON_TAC[lemma_face_identity]);; + + +let identity_node_in_face_set=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds f1. + ds IN node_set(hypermap1_of_fanx (x,V,E)) +/\ f1 IN ds +==> ds= node (hypermap1_of_fanx (x,V,E)) f1 `, +REWRITE_TAC[node_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[GSYM node;] +THEN MESON_TAC[lemma_node_identity]);; + + + + +let condition_f1_eq_fan=prove(`!x V E v u w. +FAN(x,V,E) +/\ {u,w} IN E /\ {v,u} IN E +/\ sigma_fan x V E u w = v +==> f1_fan x V E (x,v,u,sigma_fan x V E v u)=(x,u,w,v)`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[f1_fan;EQ_PAIR_4] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[INVERSE1_SIGMA_FAN]);; + + +let nonconformin_fan_imp_exist_3point_in_face=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +==> ?f1 f2 f3. {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ {pr2 f2, pr2 f3} IN E +/\ ~({pr2 f3, pr2 f1 } IN E) +/\ {pr2 f1, pr2 f2 } IN E +/\ sigma_fan x V E (pr2 f2) (pr2 f3)=pr2 f1 +/\ pr2 f3= pr3 f2 +/\ pr2 f2= pr3 f1`, + +REPEAT STRIP_TAC +THEN MRESA_TAC exists_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN ABBREV_TAC`f2=f1_fan x V E (f1:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f3=f1_fan x V E (f2:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f4=f1_fan x V E (f3:real^3#real^3#real^3#real^3)` +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"VUT") +THEN MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f2:real^3#real^3#real^3#real^3)` ;`(f1:real^3#real^3#real^3#real^3)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f3:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f4:real^3#real^3#real^3#real^3)` ;`(f3:real^3#real^3#real^3#real^3)`;`ds:real^3#real^3#real^3#real^3->bool`] + +THEN MP_TAC(SET_RULE`f1 IN ds /\ f2 IN ds /\ f3 IN ds /\ ds SUBSET d1_fan (x,V,E)==> {f1,f2,f3} SUBSET (ds:real^3#real^3#real^3#real^3->bool)/\ f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)`) +THEN RESA_TAC +THEN MRESA_TAC f_fan_no_fix_point[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f1:real^3#real^3#real^3#real^3)` THEN MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)` THEN MRESA1_TAC th`(f3:real^3#real^3#real^3#real^3)`) +THEN DISJ_CASES_TAC(SET_RULE`f3=f1 \/ ~(f3=f1:real^3#real^3#real^3#real^3)`) +THENL(*1*)[ +MP_TAC(SET_RULE`f1=f3:real^3#real^3#real^3#real^3==> pr2 f1= pr2 f3`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f3:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f2:real^3#real^3#real^3#real^3)` ;`(f1:real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` pr2 (f3:real^3#real^3#real^3#real^3)`; +` pr2 (f2:real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge (pr2 (f2:real^3#real^3#real^3#real^3)) V E = {pr2 f3} \/ ~(set_of_edge (pr2 (f2:real^3#real^3#real^3#real^3)) V E = {pr2 f3})`) +THENL[ + MRESA_TAC CARD_SING[`(pr2 f3):real^3`; `(set_of_edge (pr2 (f2:real^3#real^3#real^3#real^3)) V E):real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) +THEN FIND_ASSUM (fun th -> MP_TAC(ISPEC `(pr2 (f2:real^3#real^3#real^3#real^3))` th))`(!v:real^3. v IN V==>CARD (set_of_edge v V E) >1)` +THEN FIND_ASSUM (fun th-> REWRITE_TAC[th])`(pr2 (f2:real^3#real^3#real^3#real^3)) IN V` +THEN ARITH_TAC; + +MRESA_TAC SIGMA_FAN [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` pr2 (f2:real^3#real^3#real^3#real^3)`; +` pr2 (f3:real^3#real^3#real^3#real^3)`] +THEN ASM_TAC THEN SET_TAC[]];(*1*) + + + + +DISJ_CASES_TAC(SET_RULE`f4=f1 \/ ~(f4=f1:real^3#real^3#real^3#real^3)`) +THENL(*2*)[ +SUBGOAL_THEN(`((f1_fan (x:real^3) V E) POWER 3) f1=f1`) ASSUME_TAC +THENL(*3*)[ +ASM_SIMP_TAC[ARITH_RULE`3= SUC(2)/\ 2= SUC(1) /\ 1= SUC(0)`;POWER;I_DEF;o_DEF];(*3*) + + SUBGOAL_THEN`face (hypermap1_of_fanx (x:real^3,V:real^3->bool,E)) f1=orbit_map (f1_fan x V E) f1`ASSUME_TAC +THENL(*4*)[ +ASM_REWRITE_TAC[face;orbit_map;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THEN STRIP_TAC +THEN MRESAL_TAC into_domain_power_efn_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`n:num`;`( \ t. res (t x V E ) (d1_fan (x:real^3,V,E))) `][POWER_1;I_DEF] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `f1:real^3#real^3#real^3#real^3`) +THEN EXISTS_TAC`n:num` +THEN ASM_REWRITE_TAC[];(*4*) + +MRESAL_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f1:real^3#real^3#real^3#real^3`][] +THEN MRESAL_TAC card_orbit_le[`f1_fan (x:real^3) V E`;`3`;`f1:real^3#real^3#real^3#real^3`][ARITH_RULE`~(3=0)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th -> REWRITE_TAC[SYM th]) +THEN ASM_TAC THEN ARITH_TAC]]; +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EMYEU") +THEN EXISTS_TAC`f1:real^3#real^3#real^3#real^3` +THEN EXISTS_TAC`f2:real^3#real^3#real^3#real^3` +THEN EXISTS_TAC`f3:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f2:real^3#real^3#real^3#real^3)` ;`(f1:real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f3:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)] +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)] THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)] THEN MP_TAC th) THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[th] THEN MP_TAC th) +THEN REPEAT STRIP_TAC THEN ASSUME_TAC (SYM th)) +THEN MRESA_TAC PROPERTIES_TRIANGLE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(pr2 f1):real^3`;`(pr3 f1):real^3`;` (pr2 f3):real^3`] +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC condition_f1_eq_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` (pr2 f3):real^3`;`(pr2 f1):real^3`;`(pr3 f1):real^3`;] +THEN REMOVE_THEN "EMYEU" MP_TAC +THEN REMOVE_THEN"VUT"(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN REPEAT (ASM_REWRITE_TAC[pr2;pr3] THEN STRIP_TAC THEN ASM_REWRITE_TAC[]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC MONO_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v'':real^3`;`v:real^3`;`w'':real^3`;]]]);; + + + + + + +let condition_aff_gt_subset_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w. +FAN(x,V,E) /\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ~({w,v} IN E) +==> aff_gt {x} {v,w} SUBSET yfan (x,V,E)`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[yfan;SET_RULE`A SUBSET (:real^3) DIFF B<=> A INTER B= {}`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] +THEN REWRITE_TAC[xfan;IN;SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GT_CUT_XFAN_IMP_EDGE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v:real^3`; `u:real^3`; `w:real^3`][IN]);; + + + + + + + +let segment_subset_aff_gt_union=prove(`!x:real^3 y z v u w. +~coplanar{x,v,u,w} +/\ y IN aff_gt {x} {v, u, w} +/\ z IN aff_gt {x} {w, v} +==> segment[y,z] SUBSET aff_gt {x} {w, v} UNION aff_gt {x} {v, u, w}`, + REWRITE_TAC[segment;UNION;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`u'<= &1==> u'= &1 \/ u'< &1`) +THEN RESA_TAC +THENL[ +REWRITE_TAC[REAL_ARITH`&1- &1= &0`] +THEN REDUCE_VECTOR_TAC +THEN RESA_TAC; + +STRIP_TAC +THEN MATCH_MP_TAC(SET_RULE`B==> A\/ B`) +THEN ASM_TAC +THEN DISCH_TAC +THEN MRESA_TAC notcoplanar_disjoints[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC AFF_GT_1_2[`x:real^3`;`w:real^3`;`v:real^3`;] +THEN MRESA_TAC AFF_GT_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - u') % (t1 % x + t2 % v + t3 % u + t4 % w) + + u' % (t1' % x + t2' % w + t3' % v) +=((&1 - u') *t1 + u' *t1') % x + ((&1 - u')*t2+ u' * t3') % v + ((&1 - u')*t3) % u + ((&1 - u')*t4+ u' * t2') % w`] +THEN EXISTS_TAC`(&1 - u') * t1 + u' * t1':real` +THEN EXISTS_TAC`(&1 - u') * t2 + u' * t3':real` +THEN EXISTS_TAC`(&1 - u') * t3:real` +THEN EXISTS_TAC`(&1 - u') * t4 + u' * t2':real` +THEN ASM_REWRITE_TAC[REAL_ARITH` ((&1 - u') * t1 + u' * t1') + + ((&1 - u') * t2 + u' * t3') + + (&1 - u') * t3 + + (&1 - u') * t4 + + u' * t2' += (&1 - u') * (t1 + t2+ t3 + t4)+ u'*(t1' +t2'+t3') +`;REAL_ARITH`(&1 - u') * &1 + u' * &1 = &1`] +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC (REAL_ARITH`&0< A/\ &0<=B ==> &0< A+B`) +THEN STRIP_TAC +THENL[MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1- u'<=> u'< &1`]; + +MATCH_MP_TAC REAL_LE_MUL +THEN ASM_TAC +THEN REAL_ARITH_TAC]; +STRIP_TAC +THENL[ +MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1- u'<=> u'< &1`]; + +MATCH_MP_TAC (REAL_ARITH`&0< A/\ &0<=B ==> &0< A+B`) +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1- u'<=> u'< &1`]; +MATCH_MP_TAC REAL_LE_MUL +THEN ASM_TAC +THEN REAL_ARITH_TAC]]]]);; + + +let SEGMENT_CONNECTED=prove(`!a b. connected(segment [a,b])`, + +REPEAT GEN_TAC THEN +MATCH_MP_TAC CONVEX_CONNECTED THEN +REWRITE_TAC[SEGMENT_CONVEX_HULL;CONVEX_CONVEX_HULL]);; + + +let AFF_GT_SUBSET_DART_LEADS_INTO_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w. +FAN(x,V,E) /\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +==> aff_gt {x} {w,v} SUBSET dart_leads_into x V E u w`, +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_disjoints[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v:real^3`;`u:real^3`;`w:real^3`;] +THEN MRESA_TAC dart_leads_into_fan_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`u:real^3`; `w:real^3`] +THEN MRESA_TAC in_topological_component_yfan_is_connected[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(dart_leads_into x V E u w):real^3->bool`] +THEN MRESAL_TAC notcoplanar_4point_aff_gt_1_3_not_empty[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][SET_RULE`~(A={})<=> ?y. y IN A`] +THEN MP_TAC(SET_RULE`y IN aff_gt {x} {v, u, w}/\ aff_gt {x} {v, u, w} SUBSET dart_leads_into x V E u w +==> y IN dart_leads_into x V E u w`) +THEN RESA_TAC +THEN MRESA_TAC topological_component_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(dart_leads_into x V E u w):real^3->bool`] +THEN MP_TAC(SET_RULE`dart_leads_into x V E u w SUBSET yfan (x,V,E) +/\ aff_gt {x} {v, u, w} SUBSET dart_leads_into x V E u w +==> aff_gt {x} {v, u, w} SUBSET yfan (x,V,E)`) +THEN RESA_TAC +THEN MRESA_TAC expand_element_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(dart_leads_into x V E u w):real^3->bool`;`y:real^3`] +THEN MRESA_TAC exists_in_aff_gt_disjoint[`x:real^3`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC condition_aff_gt_subset_yfan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v:real^3`;`u:real^3`;`w:real^3`;] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC segment_subset_aff_gt_union[`x:real^3`;`y:real^3`;`y':real^3`;` v:real^3`;`u:real^3`;`w:real^3`;] +THEN MP_TAC(SET_RULE` +segment [y,y'] SUBSET aff_gt {x} {w, v} UNION aff_gt {x} {v, u, w} +/\ aff_gt {x} {w, v} SUBSET yfan (x,V:real^3->bool,E) +/\ aff_gt {x} {v, u, w} SUBSET yfan (x,V,E) +==> segment [y,y':real^3] SUBSET yfan(x,V,E) +`) +THEN RESA_TAC +THEN MRESA_TAC CONVEX_AFF_GT[`{x:real^3}`;`{ w,v:real^3}`] +THEN MRESA_TAC CONVEX_CONNECTED[`aff_gt {x} {w,v}:real^3->bool`] +THEN MRESA_TAC SEGMENT_CONNECTED[`y:real^3`;`y':real^3`] +THEN MRESA_TAC ENDS_IN_SEGMENT[`y:real^3`;`y':real^3`] +THEN MRESA1_TAC CONNECTED_IFF_CONNECTED_COMPONENT`segment[y,y':real^3]` +THEN POP_ASSUM (fun th-> MRESA_TAC th [`y:real^3`;`y':real^3`]) +THEN MRESA_TAC CONNECTED_COMPONENT_OF_SUBSET[`segment [y,y':real^3]`;`yfan(x:real^3,V:real^3->bool,E)`;`y:real^3`;`y':real^3`] +THEN MRESAL_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3,V:real^3->bool,E)`;`y:real^3`;`y':real^3`][IN] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC CONNECTED_COMPONENT_MAXIMAL[`yfan(x:real^3,V:real^3->bool,E)`;`aff_gt {x} {w,v}:real^3->bool`;`y':real^3`]);; + + + + +let STEP2_REDUCE_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds f1 f2 f3 v u w. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +==> aff_gt {x} {v,w} SUBSET dartset_leads_into_fan x V E ds`, + +REPEAT STRIP_TAC +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds /\ ds SUBSET d1_fan(x,V,E)==> f1 IN d1_fan(x,V,E)/\ f2 IN d1_fan(x,V,E) /\ f3 IN d1_fan(x,V,E) /\ f1 IN ds /\ f2 IN ds/\ f3 IN ds`) +THEN RESA_TAC +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f3:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC AFF_GT_SUBSET_DART_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`] +THEN MRESA_TAC UNIQUE_DARTSET_LEADS_INTO1_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`dart_leads_into (x:real^3) V E (pr2 f2) (pr3 f2)`;`f2:real^3#real^3#real^3#real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]);; + + +let STEP3_REDUCE_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ E UNION {{v,w}}= E1 +==> FAN (x,V,E1)`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP2_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`]) +THEN MRESAL_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1:real`][REAL_ARITH`&0<= &1 /\ &1<= &1`;VECTOR_ARITH`(&1 - &1) % u + &1 % w=w`] +THEN MRESA_TAC DWWUTKW[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`; +`ds:real^3#real^3#real^3#real^3->bool`;]);; + + + + + + +let SET_OF_EDGE_UNION_GRAPH=prove(`!v V E1 E2. set_of_edge v V (E1 UNION E2)= (set_of_edge v V E1) UNION (set_of_edge v V E2)`, +ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[set_of_edge;UNION;IN_ELIM_THM;SET_RULE`(A\/B)/\C<=>(A/\C)\/ (B/\C)`;] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THEN SET_TAC[]);; + + + + + +let add_edge_imp_card_set_edge_ge1_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ E1=E UNION {{v,w}} +==> +(!v. v IN V==>CARD (set_of_edge v V E1) > 1)`, +REWRITE_TAC[FAN;fan1] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC remark_finite_fan1[`v':real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[SET_OF_EDGE_UNION_GRAPH;] +THEN STRIP_TAC +THEN MRESAL_TAC CARD_SUBSET[`(set_of_edge v' (V:real^3->bool) E):real^3->bool`;`(set_of_edge v' (V:real^3->bool) E UNION set_of_edge v' V {{v, w}}):real^3->bool`][SET_RULE`A SUBSET A UNION B`] +THEN POP_ASSUM MP_TAC +THEN FIRST_ASSUM (MP_TAC o SPEC `v':real^3`) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN ARITH_TAC);; + + + + +let pr23=new_definition`pr23=(\(x,y,z,t). (y,z))` +;; + + +let PR23_OF_D1_FAN=prove(`!x:real^3 V:real^3->bool E:(real^3->bool)->bool. +IMAGE pr23 (d1_fan(x,V,E))={ (v,w) | {v,w} IN E}`, +REWRITE_TAC[IMAGE;d1_fan;IN_ELIM_THM;EXTENSION;] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[pr23;] +THEN RESA_TAC +THEN EXISTS_TAC `v:real^3` +THEN EXISTS_TAC `w:real^3` +THEN ASM_REWRITE_TAC[]; + +REPEAT STRIP_TAC +THEN EXISTS_TAC`x,v,w,sigma_fan x V E v w:real^3` +THEN ASM_REWRITE_TAC[pr23] +THEN EXISTS_TAC `x:real^3` +THEN EXISTS_TAC `v:real^3` +THEN EXISTS_TAC `w:real^3` +THEN EXISTS_TAC `sigma_fan x V E v w:real^3` +THEN ASM_REWRITE_TAC[]]);; + + + + +let PR23_OF_D20_FAN=prove(`!x:real^3 V:real^3->bool E:(real^3->bool)->bool. +IMAGE pr23 (d20_fan(x,V,E))={ (v,v) | v IN V/\ set_of_edge v V E={}}`, + +REWRITE_TAC[IMAGE;d20_fan;IN_ELIM_THM;EXTENSION;] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[pr23;] +THEN RESA_TAC +THEN EXISTS_TAC `v:real^3` +THEN ASM_REWRITE_TAC[IN]; + +REPEAT STRIP_TAC +THEN EXISTS_TAC`(x:real^3),v,v,(v:real^3)` +THEN ASM_REWRITE_TAC[pr23] +THEN EXISTS_TAC `x:real^3` +THEN EXISTS_TAC `v:real^3` +THEN ASM_REWRITE_TAC[IN] +THEN ASM_TAC +THEN SIMP_TAC[IN]]);; + + + +let add_edge_graph=prove(`!v w E. {v',w' | {v', w'} IN E UNION {{v, w}}}= {v',w' | {v', w'} IN E} UNION {(v',w')| {v',w'}={v,w}}`, + +ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[UNION;IN_ELIM_THM;IN_SING;SET_RULE`(A\/B)/\C<=>(A/\C)\/ (B/\C)`;] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THEN SET_TAC[]);; + +let expand_set_edge_fan=prove(`!v w.{(v',w')| {v',w'}={v,w}}={(v,w), (w,v)}`, + +REWRITE_TAC[SET_RULE`{v',w'}={v,w}<=> (v=v' /\ w= w') \/ v= w' /\ w=v'`] +THEN SET_TAC[]);; + + + + + + + +let DART_FANADD_EQ_DART_FAN_ADD_2DART=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ~(v=w) +/\ E UNION {{v,w}}=E1 +==> +IMAGE pr23 (dart (hypermap1_of_fanx (x,V,E1))) + += (IMAGE pr23 (dart (hypermap1_of_fanx (x,V,E)))) UNION {(v,w),(w,v)}`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] + +THEN ASM_REWRITE_TAC[d_fan;IMAGE_UNION;PR23_OF_D20_FAN;PR23_OF_D1_FAN] +THEN REMOVE_THEN"YEU"(fun th-> REWRITE_TAC[SYM th;add_edge_graph;expand_set_edge_fan;SET_OF_EDGE_UNION_GRAPH]));; + + + +let pr23_inj_in_dfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> (!y y1. + y IN d_fan(x,V,E) +/\ y1 IN d_fan(x,V,E) +/\ pr23 y= pr23 y1 +==> y=y1)`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN REWRITE_TAC[PAIR_EQ;IN_ELIM_THM;d1_fan] +THEN STRIP_TAC +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr23;PAIR_EQ] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[]);; + + + + + +let condition_set_of_edge_eq_empty=prove(`!v:A V E1 E2. +~(v IN UNIONS E2) +==> set_of_edge v V E2= {}`, +REWRITE_TAC[set_of_edge;SET_RULE`A={}<=> !s. ~(s IN A)`;IN_ELIM_THM;DE_MORGAN_THM;] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC(SET_RULE`A==> A\/B`) +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN STRIP_TAC +THEN REWRITE_TAC[UNIONS;IN_ELIM_THM] +THEN EXISTS_TAC`{v:A,s}` +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]);; + + + + +let SET_OF_EDGE_INVARIANT=prove(`!v V E1 E2. +~(v IN UNIONS E2) +==> set_of_edge v V (E1 UNION E2)= (set_of_edge v V E1)`, + +SIMP_TAC[SET_OF_EDGE_UNION_GRAPH;condition_set_of_edge_eq_empty;SET_RULE`A UNION {}=A`]);; + + +let expand_unions=prove(`!v w:A. UNIONS {{v,w}}= {v,w}`, +SIMP_TAC[UNIONS;IN_SING;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN SIMP_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[SET_TAC[]; + +STRIP_TAC +THEN EXISTS_TAC`{v,w:A}` +THEN ASM_REWRITE_TAC[]]);; + + +let SIGMA_FAN_OF_FANADD1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 v w. +FAN(x,V,E)/\ FAN(x,V,E1) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) + /\ ~({v,w} IN E) +/\ E UNION {{v,w}}=E1 +==> (!v1 w1. {v1,w1} IN E /\ ~(v1 IN {v,w})==> sigma_fan x V E1 v1 w1 = sigma_fan x V E v1 w1) +`, + +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +`(v1:real^3)`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v1:real^3`) +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v1 V E1 = {w1:real^3})\/ ~(set_of_edge v1 V E1 = {w1})`) +THENL[ +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; + + +POP_ASSUM MP_TAC +THEN MRESAL_TAC SET_OF_EDGE_INVARIANT[`v1:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` ({{v,w}}:(real^3->bool)->bool)`;][expand_unions] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC UNIQUE_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v1:real^3`;`w1:real^3`;`sigma_fan x V E v1 w1:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESA_TAC SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v1:real^3`;`w1:real^3`] +]);; + + + + + + + +let add_edge_graph=prove(`!v w E E1. +E UNION {{v,w}}=E1 +==> {w,v} IN E1/\ {v,w}IN E1`, + +REPEAT STRIP_TAC +THENL +[ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SET_TAC[]; +POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SET_TAC[]]);; + +let not_in_set_of_edge=prove(` +!v w V E. ~({w,v} IN E) +==> ~(w IN set_of_edge v V E)`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN SIMP_TAC[set_of_edge;IN_ELIM_THM;SET_RULE`{A,B}={B,A}`]);; + + + +let set_of_only_edge=prove(`!v w V. w IN V ==> set_of_edge v V {{v, w}}={w}`, + +REWRITE_TAC[set_of_edge;IN_SING;SET_RULE`{v',w'}={v,w}<=> (v=v' /\ w= w') \/ v= w' /\ w=v'`;EXTENSION;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[]);; + + +let set_of_only_edge1=prove(`!v w V. v IN V ==> set_of_edge w V {{v, w}}={v}`, + +REWRITE_TAC[set_of_edge;IN_SING;SET_RULE`{v',w'}={v,w}<=> (v=v' /\ w= w') \/ v= w' /\ w=v'`;EXTENSION;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[]);; + + + + + + +let SIGMA_FAN_OF_FANADD_AT_POINT1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 v u w. +FAN(x,V,E)/\ FAN(x,V,E1) +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ fan80(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ E UNION {{v,w}}=E1 +==> sigma_fan x V E1 v w = sigma_fan x V E v u`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E1 = {w:real^3})\/ ~(set_of_edge v V E1 = {w})`) +THENL[ +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; + +STRIP_TAC +THEN MRESA_TAC add_edge_graph[`v:real^3`;`w:real^3`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC UNIQUE_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`sigma_fan x V E v u:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN REMOVE_THEN "EM"(fun th -> REWRITE_TAC[SYM th;SET_OF_EDGE_UNION_GRAPH]) +THEN REMOVE_THEN "YEU"(fun th -> MRESA1_TAC th`v:real^3` THEN POP_ASSUM MP_TAC THEN ASSUME_TAC th) +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E = {u:real^3})\/ ~(set_of_edge v V E = {u})`) +THENL[ +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; +STRIP_TAC +THEN MRESA_TAC SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"QUY") +THEN ASM_SIMP_TAC[SET_RULE`x IN A==> x IN A UNION B`] +THEN MRESA_TAC not_in_set_of_edge[`v:real^3`;`w:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC (SET_RULE`!x y A. x IN A /\ ~(y IN A)==> ~(x=y)`) +THEN EXISTS_TAC`set_of_edge (v:real^3) V E` +THEN ASM_REWRITE_TAC[]; + +MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ASM_SIMP_TAC[UNION;IN_ELIM_THM;set_of_only_edge;IN_SING;SET_RULE`((A \/ B)/\ (~ B)) <=>A /\ ~ B`] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC angle_is_small_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w:real^3`] +THEN ABBREV_TAC`u1=sigma_fan x V E v u` +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u1:real^3)`; +`(v:real^3)`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`u1:real^3`] +THEN MATCH_MP_TAC(REAL_ARITH`!A B C D. A=B+C /\ A<= B+D ==> C<= D`) +THEN EXISTS_TAC`azim x v u (u1:real^3)` +THEN EXISTS_TAC`azim x v u (w:real^3)` +THEN ASM_REWRITE_TAC[] +THEN FIRST_X_ASSUM (fun th-> REWRITE_TAC[SYM th] THEN MP_TAC(SYM th) THEN DISCH_THEN(LABEL_TAC"NHO")) +THEN DISJ_CASES_TAC(SET_RULE`(w1=u:real^3)\/ ~(w1=u)`) +THENL[ +ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESAL_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][DE_MORGAN_THM;] +THEN MRESAL_TAC AZIM_COMPL[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][REAL_ARITH`A+B-A=B`;] +THEN MATCH_MP_TAC (REAL_ARITH`A A<=B`) +THEN SIMP_TAC[azim]; +REMOVE_THEN"QUY" (fun th-> MRESA1_TAC th`w1:real^3`) +THEN MP_TAC(REAL_ARITH`azim x v u w + azim x v w u1 = azim x v u u1 /\ azim x v u u1 <= azim x v u w1 +/\ &0<= azim x v w u1==> azim x v u w <= azim x v u w1`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[azim] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +`(v:real^3)`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])]]]]);; + + + + +let SIGMA_FAN_OF_FANADD_AT_POINT2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 v u w. +FAN(x,V,E)/\ FAN(x,V,E1) +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ fan80(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ E UNION {{v,w}}=E1 +==> sigma_fan x V E1 v u = w`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC add_edge_graph[`v:real^3`;`w:real^3`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E1 = {u:real^3})\/ ~(set_of_edge v V E1 = {u})`) +THENL[ + +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; +STRIP_TAC +THEN MRESA_TAC UNIQUE_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN REMOVE_THEN "EM"(fun th -> REWRITE_TAC[SYM th;SET_OF_EDGE_UNION_GRAPH]) +THEN ASM_SIMP_TAC[SET_RULE`x IN A==> x IN A UNION B`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`; +`(w:real^3)`] +THEN ASM_SIMP_TAC[UNION;IN_ELIM_THM;set_of_only_edge;IN_SING;SET_RULE`((A \/ B)/\ (~ B)) <=>A /\ ~ B`] +THEN REPEAT STRIP_TAC +THENL[ +REMOVE_THEN "YEU"(fun th -> MRESA1_TAC th`v:real^3` THEN POP_ASSUM MP_TAC THEN ASSUME_TAC th) +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E = {u:real^3})\/ ~(set_of_edge v V E = {u})`) +THENL[ +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; +STRIP_TAC +THEN MRESA_TAC SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w1:real^3`) +THEN MRESA_TAC angle_is_small_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]; +ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC]]);; + + + + +let XFAN_INTER_SET=prove(`!x:real^N V E s:real^N->bool. +xfan(x,V,E) INTER s = UNIONS {y | ?e. e IN E /\ y = (aff_ge {x} e) INTER s}`, +REPEAT GEN_TAC +THEN REWRITE_TAC[XFAN_EQ_UNIONS_AFF_GE_1_2] +THEN ONCE_REWRITE_TAC[ EXTENSION] +THEN REWRITE_TAC[UNIONS; INTER;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC `{x' | x' IN aff_ge {x:real^N} e /\ x' IN s}` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC THEN RESA_TAC +THEN EXISTS_TAC`e:real^N->bool` +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC +THEN EXISTS_TAC `aff_ge {x:real^N} e ` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC `e:real^N->bool` +THEN ASM_REWRITE_TAC[]]);; + + + + +let condition_azim_imp_edge_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w w1. +FAN(x,V,E) +/\ {v,u} IN E /\ {u,w} IN E /\ {w,w1} IN E +/\ sigma_fan x V E u w = v +/\ sigma_fan x V E w w1 = u +/\ fan80(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ azim x w v u = azim x w w1 u +==> {v,w} IN E`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`w:real^3`;`w1:real^3`] THEN MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`w:real^3`;`u:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN ASM_REWRITE_TAC[DE_MORGAN_THM;] +THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`w:real^3`;`u:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN ASM_REWRITE_TAC[DE_MORGAN_THM;] +THEN RESA_TAC +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`w:real^3`;`u:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`w:real^3`;`u:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ARITH`A-B=A-C<=> B=C`] +THEN STRIP_TAC +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`w:real^3`;`u:real^3`;`v:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MATCH_MP_TAC AFF_GT_CUT_XFAN_IMP_EDGE_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`u:real^3` +THEN ASM_SIMP_TAC[SET_RULE`A INTER B= B INTER A`] +THEN MRESAL_TAC XFAN_INTER_SET[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`aff_gt {x:real^3} {v, w}`][IN;xfan] +THEN ASM_REWRITE_TAC[UNIONS;IN_ELIM_THM;SET_RULE`~(A={})<=> ?y. y IN A`] +THEN SUBGOAL_THEN`?y. y IN aff_gt {x:real^3} {v,w} INTER aff_ge {x} {w,w1}`ASSUME_TAC +THENL[ +MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{x:real^3,w:real^3}`;`{w1:real^3}`] +THEN MP_TAC(SET_RULE`v IN aff_gt {x, w} {w1} /\ aff_gt {x, w} {w1} SUBSET aff_ge {x, w} {w1} +==> v IN aff_ge {x, w} {w1:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC decomposition_planar_by_angle_fan[`x:real^3`;`w:real^3`;`w1:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THENL[ +POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{B,C}={C,B}`] +THEN STRIP_TAC +THEN MRESAL_TAC point_in_aff_ge[`x:real^3`;`w:real^3`;`w1:real^3`][INTER;IN_ELIM_THM] +THEN EXISTS_TAC`w1:real^3` +THEN ASM_REWRITE_TAC[]; + +MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +`(w:real^3)`] +THEN MRESA_TAC aff_gt12_subset_aff_ge[`x:real^3`;`w:real^3`;`w1:real^3`;`v:real^3`] +THEN ASM_SIMP_TAC[SET_RULE`A SUBSET B==> A INTER B= A`] +THEN MATCH_MP_TAC exists_in_aff_gt +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`; +`(w:real^3)`]]; + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN EXISTS_TAC `y:real^3` +THEN EXISTS_TAC `aff_gt {x} {v, w} INTER aff_ge {x} {w, w1:real^3}` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`{w,w1:real^3}` +THEN ASM_SIMP_TAC[SET_RULE`A INTER B= B INTER A`;] +THEN ASM_TAC +THEN SIMP_TAC[IN]]);; + +let condition_azim_le_pi=prove( +`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w. +FAN(x,V,E) +/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ fan80(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +==> &0< azim x w v u/\ azim x w v u < pi`, + + +REPEAT GEN_TAC +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`w:real^3`;`w1:real^3`] THEN MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`w:real^3`;`u:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN ASM_REWRITE_TAC[DE_MORGAN_THM;] +THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN ASM_REWRITE_TAC[DE_MORGAN_THM;] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`~(azim x w v u = &0) /\ &0<= azim x w v u==> &0< azim x w v u `) +THEN ASM_SIMP_TAC[azim] +THEN RESA_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`pi<= azim x w v u \/ azim x w v u < pi`) +THENL[ +MRESA_TAC AZIM_COMPL[`x:real^3`;`w:real^3`;`u:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`~(azim x w v u = pi)/\ pi<= azim x w v u /\ azim x w v u < &2 * pi /\ azim x w v u = &2 * pi - azim x w u v +==> &0 < azim x w u v /\ azim x w u v< pi`) +THEN ASM_SIMP_TAC[azim] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `w:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN REWRITE_TAC[DOT_LNEG] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[]]);; + + + + +let azim_trangle_le_azim_face_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w w1. +FAN(x,V,E) +/\ {v,u} IN E /\ {u,w} IN E /\ {w,w1} IN E /\ ~({v,w} IN E) +/\ sigma_fan x V E u w = v +/\ sigma_fan x V E w w1 = u +/\ fan80(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +==> azim x w v u < azim x w w1 u`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[REAL_ARITH`A ~(B<=A) `] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`w:real^3`;`w1:real^3`] THEN MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN DISCH_TAC THEN +MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] THEN DISCH_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +`(w:real^3)`] +THEN MRESA_TAC condition_azim_imp_edge_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`v:real^3`;`w1:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x w v u = azim x w v w1 + azim x w w1 u +/\ azim x w w1 u <= azim x w v u /\ &0< azim x w w1 u /\ ~(azim x w v u = azim x w w1 u) ==> &0 < azim x w v w1 /\ azim x w v w1 < azim x w v u`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC (SYM th)) +THEN RESA_TAC +THEN MRESA_TAC condition_azim_le_pi[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC WEDGE_LUNE_GT[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN SUBGOAL_THEN`w1 IN wedge x w v (u:real^3)` ASSUME_TAC +THENL[ +REWRITE_TAC[wedge;IN_ELIM_THM] +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_2_2[`x:real^3`;`v:real^3`;`w:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`] +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN DISCH_TAC THEN ASSUME_TAC th) THEN ASSUME_TAC th) +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`u:real^3`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC invariant_crossr_dot_esilon_3piont[`x:real^3`;`u:real^3`;`w:real^3`;`v:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC`h=t/ &2:real` +THEN MP_TAC(REAL_ARITH`&0< t/\ t< &1/\ h= t/ &2 ==> &0 <= h/\ &0< h/\ &0<= &1 -h /\ h< t`) +THEN RESA_TAC +THEN DISCH_THEN(fun th-> MRESA1_TAC th `h:real`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN REWRITE_TAC[INTER;IN_ELIM_THM] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN SUBGOAL_THEN`&0 < ((w - x) cross (v - x)) dot ((&1 - h) % w + h % w1 - x:real^3)/\ &0 < ((u - x) cross (w - x)) dot ((&1 - h) % w + h % w1 - x:real^3)` ASSUME_TAC +THENL[ + +REWRITE_TAC[VECTOR_ARITH`(&1 - h) % w + h % w1-x=(&1 - h) % (w-x) + h % (w1-x)`] +THEN REWRITE_TAC[DOT_RADD;DOT_RMUL;DOT_CROSS_SELF] +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`(&1 - h) % w + h % w1 IN aff_gt {x} {v,u,w:real^3}`ASSUME_TAC +THENL[ +MRESA_TAC inter_aff_gt_3_1_is_aff_gt_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;IN_ELIM_THM;INTER;VECTOR_ARITH`(A+B)-C=A+B-C:real^3`]); +SUBGOAL_THEN`(&1 - h:real) % w + h % (w1:real^3) IN aff_ge {x} {w,w1:real^3}`ASSUME_TAC +THENL[ + MRESAL_TAC AFF_GE_1_2[`x:real^3`;`w:real^3`;` w1:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1-h:real` +THEN EXISTS_TAC`h:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0 + &1 - h + h = &1`] +THEN REDUCE_VECTOR_TAC; +MRESA_TAC AFF_GE_SUBSET_XFAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`w1:real^3`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v:real^3`;`u:real^3`;`w:real^3`;] +THEN MRESA_TAC dart_leads_into_fan_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`u:real^3`; `w:real^3`] +THEN MRESA_TAC topological_component_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(dart_leads_into x V E u w):real^3->bool`] +THEN MP_TAC(SET_RULE`dart_leads_into x V E u w SUBSET yfan (x,V,E) +/\ aff_gt {x} {v, u, w} SUBSET dart_leads_into x V E u w +==> aff_gt {x} {v, u, w} SUBSET yfan (x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan] +THEN SET_TAC[]]]]]);; + + + +let SIGMA_FAN_OF_FANADD_AT_POINT3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 v u w. +FAN(x,V,E)/\ FAN(x,V,E1) +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ fan80(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ E UNION {{v,w}}=E1 +==> sigma_fan x V E1 w v = u`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC add_edge_graph[`v:real^3`;`w:real^3`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MP_TAC(SET_RULE`{u,w:real^3} IN E /\ E UNION {{v,w}}=E1==> {u,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (u:real^3)`; +`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`; +`(w:real^3)`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`) +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge w V E1 = {v:real^3})\/ ~(set_of_edge w V E1 = {v})`) +THENL[ +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; + +STRIP_TAC +THEN MRESA_TAC UNIQUE_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN REMOVE_THEN "EM"(fun th -> REWRITE_TAC[SYM th;SET_OF_EDGE_UNION_GRAPH]) +THEN ASM_SIMP_TAC[UNION;IN_ELIM_THM;set_of_only_edge1;IN_SING;SET_RULE`((A \/ B)/\ (~ B)) <=>A /\ ~ B`] +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`w2=inverse1_sigma_fan x V E w u:real^3` +THEN REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th`w:real^3` THEN POP_ASSUM MP_TAC THEN ASSUME_TAC(th)) +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge w V E = {w2:real^3})\/ ~(set_of_edge w V E = {w2})`) +THENL[ +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; + +STRIP_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w2:real^3)`; +`(w:real^3)`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`w2:real^3`] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w1:real^3`) +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(w1 = w2:real^3)\/ (w1 = w2)`) +THENL[ +RESA_TAC +THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` w2:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w w2 u==> azim x w v u <= azim x w w2 u`) +THEN RESA_TAC +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`w2:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN DISCH_THEN(LABEL_TAC "ME1") +THEN MP_TAC(REAL_ARITH`azim x w w2 (u:real^3) = azim x w w2 v + azim x w v u +/\ azim x w w2 u <= azim x w w2 w1 +/\ &0 <= azim x w v u +==> azim x w w2 v <= azim x w w2 w1 `) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[azim] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`w:real^3`;`w2:real^3`;`v:real^3`;`w1:real^3`] +THEN MATCH_MP_TAC(REAL_ARITH`!B A C. A+C<=A+B==>C<=B`) +THEN EXISTS_TAC`azim x w w2 (v:real^3)` +THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th;]) +THEN REMOVE_THEN "ME1"(fun th -> ASM_REWRITE_TAC[SYM th;]); +STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` w2:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w w2 u==> azim x w v u <= azim x w w2 u`) +THEN RESA_TAC +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`w2:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MATCH_MP_TAC(REAL_ARITH`!B A C. A+C<=A+B==>C<=B`) +THEN EXISTS_TAC`azim x w w2 (v:real^3)` +THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th;] +THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w w2 u /\ +azim x w w2 u = azim x w w2 v + azim x w v u +==> ~(azim x w w2 v = &0)`) +THEN ASM_REWRITE_TAC[SYM th] +THEN STRIP_TAC) +THEN MRESAL_TAC AZIM_COMPL[`x:real^3`;`w:real^3`;`w2:real^3`;`v:real^3`][REAL_ARITH`A+ B-A=B`] +THEN MATCH_MP_TAC(REAL_ARITH`!a b. a< b==> a<= b`) +THEN SIMP_TAC[azim]]]]);; + + +let elements_in_ds2_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ f10=(x,w,v,u) +/\ E UNION {{v,w}}= E1 +==> f10 IN ds2`, +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN REWRITE_TAC[face;orbit_map; IN_ELIM_THM] +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[POWER;ARITH_RULE`0>=0`;I_DEF;EQ_PAIR_4] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ]);; + + + + + + + + +let SIGMA_FAN_OF_FANADD_AT_POINT4=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w w1. + +FAN(x,V,E)/\ FAN(x,V,E1) +/\ fan80(x,V,E) +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) /\ ~(u=w1) +/\ {v,w1} IN E +/\ sigma_fan x V E u w = v + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ E UNION {{v,w}}=E1 +==> sigma_fan x V E1 v w1 = sigma_fan x V E v w1`, + + + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC add_edge_graph[`v:real^3`;`w:real^3`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E1 = {w1:real^3})\/ ~(set_of_edge v V E1 = {w1})`) +THENL(*1*)[ + +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC;(*1*) + + +STRIP_TAC +THEN MP_TAC(SET_RULE`{v,w1:real^3} IN E /\ E UNION {{v,w}}=E1==> {v,w1} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w1:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC UNIQUE_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`w1:real^3`;`sigma_fan x V E v w1:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN REMOVE_THEN "YEU"(fun th -> MRESA1_TAC th`v:real^3` THEN POP_ASSUM MP_TAC THEN ASSUME_TAC th) +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E = {w1:real^3})\/ ~(set_of_edge v V E = {w1})`) +THENL(*2*)[ + +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC;(*2*) + +STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`; +`(w:real^3)`] +THEN REMOVE_THEN "EM"(fun th -> REWRITE_TAC[SYM th;SET_OF_EDGE_UNION_GRAPH]) +THEN ASM_SIMP_TAC[SET_RULE`x IN A==> x IN A UNION B`] +THEN ASM_SIMP_TAC[UNION;IN_ELIM_THM;set_of_only_edge;IN_SING;SET_RULE`((A \/ B)/\ (~ B)) <=>A /\ ~ B`] +THEN MRESA_TAC SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MA") +THEN REPEAT STRIP_TAC +THENL(*3*)[ +REMOVE_THEN "MA"(fun th-> MRESA1_TAC th`w1':real^3`);(*3*) + +ASM_REWRITE_TAC[] +THEN REMOVE_THEN "MA"(fun th-> MRESA1_TAC th`u:real^3`) +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN DISJ_CASES_TAC(SET_RULE`~(sigma_fan x V E v u = w1)\/ (sigma_fan x V E v u = w1)`) +THENL(*4*)[ +ASM_REWRITE_TAC[] +THEN MRESA_TAC +MONO_AZIM_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w1:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E v u):real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`w1:real^3`;`u:real^3`;`(sigma_fan x V E v u):real^3`] +THEN MRESA_TAC angle_is_small_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w:real^3`] +THEN MP_TAC(REAL_ARITH`azim x v w1 (sigma_fan x V E v u) = + azim x v w1 u + azim x v u (sigma_fan x V E v u) +/\ azim x v u w <= azim x v u (sigma_fan x V E v u) +==> azim x v w1 u+ azim x v u w<= azim x v w1 (sigma_fan x V E v u) +`) +THEN POP_ASSUM(fun th -> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th -> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH` azim x v w1 (sigma_fan x V E v u)< &2 * pi +/\ azim x v w1 u+ azim x v u w<= azim x v w1 (sigma_fan x V E v u) +==> +azim x v w1 u+ azim x v u w< &2 * pi +`) +THEN ASM_SIMP_TAC[azim] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`E UNION {{v,w}}=E1==> {v,w} IN E1`) THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E1:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC sum3_azim_fan[`x:real^3`;`v:real^3`;`w1:real^3`;`u:real^3`;`w:real^3`] +THEN MATCH_MP_TAC(REAL_ARITH`!A B C.A<=B /\ &0<= C ==>A<= B+C`) +THEN ASM_SIMP_TAC[azim];(*4*) + +MRESA_TAC angle_is_small_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w:real^3`] +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`v:real^3`;` u:real^3`;`w1:real^3`] +THEN MP_TAC(REAL_ARITH` + azim x v w1 u + azim x v u (sigma_fan x V E v u) = &2 * pi +/\ azim x v u w <= azim x v u (sigma_fan x V E v u) +==> azim x v w1 u+ azim x v u w<= &2 * pi +`) +THEN POP_ASSUM(fun th -> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(SET_RULE`azim x v u w1 = &0\/ ~(azim x v u w1 = &0)`) +THENL(*5*)[ + +MRESA_TAC UNIQUE_AZIM_0_POINT_FAN[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w1:real^3`];(*5*) + +ASM_REWRITE_TAC[REAL_ARITH`A-B+B=A`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`E UNION {{v,w}}=E1==> {v,w} IN E1`) THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E1:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`] +THEN MP_TAC(REAL_ARITH`azim x v w1 u + azim x v u w <= &2 * pi +==> azim x v w1 u + azim x v u w < &2 * pi\/ azim x v w1 u + azim x v u w = &2 * pi`) +THEN RESA_TAC THENL(*6*)[ + +MRESA_TAC sum3_azim_fan[`x:real^3`;`v:real^3`;`w1:real^3`;`u:real^3`;`w:real^3`] +THEN MATCH_MP_TAC(REAL_ARITH`!A B C.A<=B /\ &0<= C ==>A<= B+C`) +THEN ASM_SIMP_TAC[azim];(*6*) + +POP_ASSUM MP_TAC +THEN MRESAL_TAC AZIM_COMPL[`x:real^3`;`v:real^3`;` u:real^3`;`w1:real^3`][REAL_ARITH`A-C+D=A<=> C=D`] +THEN STRIP_TAC +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`;`w:real^3`] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v:real^3`;`w:real^3`;`w1:real^3`] +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`v:real^3`;`w:real^3`;`w1:real^3`] +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w1:real^3`;`w:real^3`] decomposition_planar_by_angle_fan) +THEN RESA_TAC +THENL(*7*)[ +MRESA_TAC aff_gt3_subset_aff_gt[`x:real^3`;`v:real^3`;`w:real^3`;`w1:real^3`] +THEN MRESA_TAC exists_in_aff_gt_disjoint[`x:real^3`;`v:real^3`;`w1:real^3`] +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`w1:real^3`;] +THEN SUBGOAL_THEN`aff_gt {x} {v, w1:real^3} SUBSET xfan(x,V:real^3->bool,E)` ASSUME_TAC +THENL(*8*)[ + +REWRITE_TAC[xfan;SUBSET;IN_ELIM_THM] +THEN GEN_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`{v,w1}:real^3->bool` +THEN MP_TAC(SET_RULE`x' IN aff_gt {x}{v,w1}/\ aff_gt {x} { v,w1} SUBSET aff_ge {x} {v, w1} +==> x' IN aff_ge {x:real^3} {v, w1}`) +THEN RESA_TAC +THEN ASM_TAC +THEN SIMP_TAC[IN];(*8*) + +MP_TAC(SET_RULE`aff_gt {x} {v, w1} SUBSET aff_gt {x} {v, w}/\y IN aff_gt {x} {v, w1} +/\ aff_gt {x} {v, w1} SUBSET xfan (x,V,E) +==> ~(aff_gt {x:real^3} {v, w} INTER xfan (x,V:real^3->bool,E) ={})`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[xfan;IN ] +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GT_CUT_XFAN_IMP_EDGE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v:real^3`; `u:real^3`; `w:real^3`][IN] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_TAC +THEN SIMP_TAC[IN] ];(*7*) + + + + + +MRESA_TAC aff_gt12_subset_aff_ge[`x:real^3`;`v:real^3`;`w1:real^3`;`w:real^3`] +THEN SUBGOAL_THEN`aff_gt {x} {w, v:real^3} SUBSET xfan(x,V:real^3->bool,E)` ASSUME_TAC +THENL(*8*)[ +REWRITE_TAC[xfan;SUBSET;IN_ELIM_THM] +THEN GEN_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`{v,w1}:real^3->bool` +THEN MP_TAC(SET_RULE`x' IN aff_gt {x}{w,v}/\ aff_gt {x} {w, v} SUBSET aff_ge {x} {v, w1} +==> x' IN aff_ge {x:real^3} {v, w1}`) +THEN RESA_TAC +THEN ASM_TAC +THEN SIMP_TAC[IN]; + + +MRESA_TAC condition_aff_gt_subset_yfan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v:real^3`;`u:real^3`;`w:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REWRITE_TAC[yfan] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC exists_in_aff_gt_disjoint[`x:real^3`;`w:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]]]]]]]]);; + + + + + + + + + + + + +let SIGMA_FAN_OF_FANADD_AT_POINT5=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w w1. + +FAN(x,V,E)/\ FAN(x,V,E1) +/\ fan80(x,V,E) +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) /\ ~(w1=inverse1_sigma_fan x V E w u ) +/\ {w,w1} IN E +/\ sigma_fan x V E u w = v + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ E UNION {{v,w}}=E1 +==> sigma_fan x V E1 w w1 = sigma_fan x V E w w1`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC add_edge_graph[`v:real^3`;`w:real^3`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`{w:real^3, w1} IN E /\ E UNION {{v,w}}=E1 ==>{w, w1} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w1:real^3)`; +`(w:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +`(w:real^3)`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`) +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge w V E1 = {w1:real^3})\/ ~(set_of_edge w V E1 = {w1})`) +THENL(*1*)[ + +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC;(*1*) + +STRIP_TAC +THEN REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th`w:real^3` THEN POP_ASSUM MP_TAC THEN ASSUME_TAC(th)) +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge w V E = {w1:real^3})\/ ~(set_of_edge w V E = {w1})`) +THENL(*2*)[ +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC;(*2*) + +STRIP_TAC +THEN MRESA_TAC SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "MA") +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` ((sigma_fan x V E w w1):real^3)`;`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{w:real^3, sigma_fan x V E w w1} IN E /\ E UNION {{v,w}}=E1 ==>{w, sigma_fan x V E w w1} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` ((sigma_fan x V E w w1):real^3)`;`(w:real^3)`] +THEN MRESA_TAC UNIQUE_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`;`w1:real^3`;`sigma_fan x V E w w1:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN REMOVE_THEN "EM"(fun th -> REWRITE_TAC[SYM th;SET_OF_EDGE_UNION_GRAPH]) +THEN ASM_SIMP_TAC[SET_RULE`x IN A==> x IN A UNION B`] +THEN ASM_SIMP_TAC[UNION;IN_ELIM_THM;set_of_only_edge;IN_SING;SET_RULE`((A \/ B)/\ (~ B)) <=>A /\ ~ B`] +THEN REPEAT STRIP_TAC +THENL(*3*)[ +REMOVE_THEN "MA"(fun th-> MRESA1_TAC th`w1':real^3`);(*3*) + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;`(v:real^3)`] +THEN ASM_SIMP_TAC[set_of_only_edge;IN_SING] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`u:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` ((inverse1_sigma_fan x V E w u):real^3)`;`(w:real^3)`] +THEN REMOVE_THEN "MA"(fun th-> MRESA1_TAC th`inverse1_sigma_fan x V E w (u:real^3)`) +THEN MRESA_TAC MONO_AZIM_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`w1:real^3`;`(inverse1_sigma_fan x V E w u):real^3`] +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(u=w1:real^3)\/ u=w1`) +THENL(*4*)[ +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`w:real^3`;`w1:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w (inverse1_sigma_fan x V E w u) u +==> +azim x w v u <= azim x w (inverse1_sigma_fan x V E w u) (u:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`;`(w:real^3)`] +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u) u = + azim x w (inverse1_sigma_fan x V E w u) v + azim x w v u +/\ &0<= azim x w v u +==> azim x w (inverse1_sigma_fan x V E w u) v<=azim x w (inverse1_sigma_fan x V E w u) u +`) +THEN ASM_SIMP_TAC[azim] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u) v <= + azim x w (inverse1_sigma_fan x V E w u) u +/\ azim x w w1 u = + azim x w w1 (inverse1_sigma_fan x V E w u) + + azim x w (inverse1_sigma_fan x V E w u) u +/\ azim x w w1 u< &2 *pi +==> azim x w w1 (inverse1_sigma_fan x V E w u) + + azim x w (inverse1_sigma_fan x V E w u) v < &2 *pi + +`) +THEN SIMP_TAC[azim] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC sum3_azim_fan[`x:real^3`;`w:real^3`;`w1:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`v:real^3`] +THEN MATCH_MP_TAC (REAL_ARITH`!A B C. A<= B/\ &0<= C==> A<= B +C`) +THEN ASM_SIMP_TAC[azim];(*4*) + +POP_ASSUM(fun th -> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w (inverse1_sigma_fan x V E w u) u +==> +azim x w v u <= azim x w (inverse1_sigma_fan x V E w u) (u:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`;`(w:real^3)`] +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u) u = + azim x w (inverse1_sigma_fan x V E w u) v + azim x w v u +/\ &0<= azim x w v u +==> azim x w (inverse1_sigma_fan x V E w u) v<=azim x w (inverse1_sigma_fan x V E w u) u +`) +THEN ASM_SIMP_TAC[azim] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u) v <= + azim x w (inverse1_sigma_fan x V E w u) u +==> azim x w u (inverse1_sigma_fan x V E w u) + + azim x w (inverse1_sigma_fan x V E w u) v <= +azim x w u (inverse1_sigma_fan x V E w u) + + azim x w (inverse1_sigma_fan x V E w u) u +`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`azim x w (inverse1_sigma_fan x V E w u) u = &0\/ ~(azim x w (inverse1_sigma_fan x V E w u) (u:real^3) = &0)`) +THENL(*5*)[ +MRESA_TAC UNIQUE_AZIM_0_POINT_FAN[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`;`u:real^3`]; + +MRESAL_TAC AZIM_COMPL[`x:real^3`;`w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`;`u:real^3`][REAL_ARITH`A-B+B=A`] +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[SYM th;REAL_ARITH`A<=B<=> A A<= B +C`) +THEN ASM_SIMP_TAC[azim]; +POP_ASSUM MP_TAC +THEN MRESAL_TAC AZIM_COMPL[`x:real^3`;`w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`;`u:real^3`][REAL_ARITH`A-B+C=A<=> B=C`] +THEN STRIP_TAC +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`u:real^3`;`v:real^3`] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM1")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN ASM_REWRITE_TAC[]]]]]]]);; + + + + +let SIGMA_FAN_OF_FANADD_AT_POINT6=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w w1. +FAN(x,V,E)/\ FAN(x,V,E1) +/\ fan80(x,V,E) +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) /\ w1=inverse1_sigma_fan x V E w u +/\ {w,w1} IN E +/\ sigma_fan x V E u w = v + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ E UNION {{v,w}}=E1 +==> sigma_fan x V E1 w w1 = v`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC add_edge_graph[`v:real^3`;`w:real^3`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`{w:real^3, w1} IN E /\ E UNION {{v,w}}=E1 ==>{w, w1} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w1:real^3)`; +`(w:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +`(w:real^3)`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`) +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge w V E1 = {w1:real^3})\/ ~(set_of_edge w V E1 = {w1})`) +THENL[ +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; + +STRIP_TAC +THEN REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th`w:real^3` THEN POP_ASSUM MP_TAC THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"YEU")) +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge w V E = {w1:real^3})\/ ~(set_of_edge w V E = {w1})`) +THENL[ +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; +DISCH_THEN(LABEL_TAC"LINHYEU") +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` v:real^3`;`(w:real^3)`] +THEN MRESA_TAC UNIQUE_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`;`w1:real^3`;`v:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`) +THEN STRIP_TAC +THENL[ +STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "EM"(fun th -> REWRITE_TAC[SYM th;SET_OF_EDGE_UNION_GRAPH]) +THEN REWRITE_TAC[UNION;IN_ELIM_THM;IN_SING] +THEN REPEAT STRIP_TAC +THENL[(*4*) +REMOVE_THEN "LINHYEU" MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge w V E = {w1':real^3})\/ ~(set_of_edge w V E = {w1'})`) +THENL[ + +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; +STRIP_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`w1:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w1':real^3`) +THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w (inverse1_sigma_fan x V E w u) u +==> +azim x w v u <= azim x w (inverse1_sigma_fan x V E w u) (u:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u) u = + azim x w (inverse1_sigma_fan x V E w u) v + azim x w v u +/\ &0<= azim x w v u +==> azim x w (inverse1_sigma_fan x V E w u) v<=azim x w (inverse1_sigma_fan x V E w u) u +`) +THEN ASM_SIMP_TAC[azim] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` u:real^3`;`(v:real^3)`] +THEN MRESAL_TAC set_of_only_edge1[`v:real^3`;`w:real^3`;`V:real^3->bool`][IN_SING] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN REAL_ARITH_TAC]]]]);; + + + + +let f1_fan_of_f10_eq_f20=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ f10=(x,w,v,u) +/\ f20=(x,v,u,w) +/\ E UNION {{v,w}}= E1 +==> f20=f1_fan x V E1 f10`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN REWRITE_TAC[f1_fan;EQ_PAIR_4] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`{v,u:real^3} IN E /\ E UNION {{v,w}}= E1 +==> {v,u} IN E1`) THEN RESA_TAC THEN RESA_TAC);; + + + + + + +let f1_fan_of_f20_eq_f30=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ f20=(x,v,u,w) +/\ f30=(x,u,w,v) +/\ E UNION {{v,w}}= E1 +==> f30=f1_fan x V E1 f20`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN REWRITE_TAC[f1_fan;EQ_PAIR_4] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`) +THEN RESA_TAC +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`{u:real^3,w} IN E /\ E UNION {{v,w}}= E1 +==> {u,w} IN E1`) THEN RESA_TAC THEN RESA_TAC);; + + +let f1_fan_of_f30_eq_f10=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ f10=(x,w,v,u) +/\ f30=(x,u,w,v) +/\ E UNION {{v,w}}= E1 +==> f10=f1_fan x V E1 f30`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN REWRITE_TAC[f1_fan;EQ_PAIR_4] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `u:real^3`;`w:real^3` ] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MP_TAC(SET_RULE` E UNION {{v,w:real^3}}= E1 +==> {v,w} IN E1`) +THEN RESA_TAC THEN RESA_TAC);; + + + + + + +let f10_in_d1_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ f10=(x,w,v,u) +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> f10 IN d1_fan (x,V,E1)`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC f1_fan_of_f10_eq_f20[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)` ] +THEN MRESA_TAC f1_fan_of_f20_eq_f30[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC f1_fan_of_f30_eq_f10[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f30:real^3#real^3#real^3#real^3)`; ] +THEN MRESAL_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `u:real^3`;`w:real^3` ][d1_fan; IN_ELIM_THM] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 w v:real^3` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REMOVE_THEN "EM"(fun th-> REWRITE_TAC[SYM th]) +THEN SET_TAC[]);; + + + +let pair_disjoint_f10_f20_f30=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ f10=(x,w,v,u) +/\ f20=(x,v,u,w) +/\ f30=(x,u,w,v) +/\ E UNION {{v,w}}= E1 +==> ~(f10= f20)/\ ~(f20= f30)/\ ~(f30=f10)`, + +REPEAT GEN_TAC THEN STRIP_TAC +THEN ASM_REWRITE_TAC[EQ_PAIR_4;SET_RULE`~(A/\B)<=> ~ A\/ ~ B`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`;` (u:real^3)`]);; + + +let n_fan_permutes_prime=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool) p. +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) +==> (p n_fan) permutes (d_fan (x,V,E))`, + +REPEAT STRIP_TAC +THEN MRESA_TAC finite_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC PERMUTES_FINITE_SURJECTIVE[`d_fan (x:real^3,V,E)`;`res (n_fan x V E) (d1_fan (x:real^3,V,E))`] +THEN STRIP_TAC +THENL[ +REWRITE_TAC[res;d_fan;UNION;IN_ELIM_THM;DE_MORGAN_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[]; +MRESA_TAC into_domain_n_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(y IN d1_fan (x,V,E) )\/ (y IN d1_fan (x:real^3,V,E))`) +THENL[ +EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[res]; +MRESA_TAC permuters_of_enf_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN REWRITE_TAC[res] +THEN EXISTS_TAC`b:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC subset_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN ASM_TAC THEN SET_TAC[]]]);; + + +let f1_fan_permutes_prime=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool) p. +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) +==> (p f1_fan) permutes (d_fan (x,V,E))`, + +REPEAT STRIP_TAC +THEN MRESA_TAC finite_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC PERMUTES_FINITE_SURJECTIVE[`d_fan (x:real^3,V,E)`;`res (f1_fan x V E) (d1_fan (x:real^3,V,E))`] +THEN STRIP_TAC +THENL[ +REWRITE_TAC[res;d_fan;UNION;IN_ELIM_THM;DE_MORGAN_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[]; +MRESA_TAC into_domain_f1_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(y IN d1_fan (x,V,E) )\/ (y IN d1_fan (x:real^3,V,E))`) +THENL[ +EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[res]; +MRESA_TAC permuters_of_enf_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN REWRITE_TAC[res] +THEN EXISTS_TAC`b:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC subset_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN ASM_TAC THEN SET_TAC[]]]);; + + + + + + +let card_ds2_fanadd_eq3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> CARD ds2=3`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC f1_fan_of_f10_eq_f20[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)` ] +THEN MRESA_TAC f1_fan_of_f20_eq_f30[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC f1_fan_of_f30_eq_f10[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f30:real^3#real^3#real^3#real^3)`; ] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM YEU") +THEN MRESAL_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `u:real^3`;`w:real^3` ][face;orbit_map] +THEN MRESA_TAC f10_in_d1_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`3:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`f10:real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`2:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`f10:real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`1:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`f10:real^3#real^3#real^3#real^3` ) +THEN MRESAL_TAC card_orbit_le[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`3:num`;`(f10:real^3#real^3#real^3#real^3)`][ARITH_RULE`~(3=0)`;ARITH_RULE`3=SUC 2`;POWER_2;POWER;o_DEF] +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "EM YEU"(fun th -> REWRITE_TAC[SYM th;ARITH_RULE`SUC 2=3`;]) +THEN MRESAL_TAC in_orbit_lemma[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`0:num`;`(f10:real^3#real^3#real^3#real^3)`;`(f10:real^3#real^3#real^3#real^3)`] +[POWER;I_DEF] +THEN MRESAL_TAC in_orbit_lemma[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`1:num`;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`] +[POWER_1] +THEN MRESAL_TAC in_orbit_lemma[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`2:num`;`(f10:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`] +[POWER_2;o_DEF] +THEN MP_TAC(SET_RULE`f10 IN orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10 +/\ f1_fan x V E1 f10 IN + orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10 +/\ f1_fan x V E1 (f1_fan x V E1 f10) IN + orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10 +==> +{f10, f1_fan x V E1 f10,f1_fan x V E1 (f1_fan x V E1 f10)} SUBSET + orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10`) +THEN RESA_TAC +THEN MRESA_TAC pair_disjoint_f10_f20_f30[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ] +THEN SUBGOAL_THEN(`CARD {f10,f20,f30:real^3#real^3#real^3#real^3}=3`)ASSUME_TAC +THENL[ +SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] + +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; +POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC f1_fan_permutes_prime[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC finite_d_fan[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`] +THEN MRESA_TAC lemma_orbit_finite[`d1_fan(x:real^3,V,E1)`;`(res (f1_fan x V E1) (d1_fan (x:real^3,V,E1)))`;`(f10:real^3#real^3#real^3#real^3)`] +THEN MRESAL_TAC CARD_SUBSET_LE[`{f10, f1_fan x V E1 f10, f1_fan (x:real^3) V E1 (f1_fan x V E1 f10)}`;`orbit_map (res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))) f10`;][orbit_map] +]);; + + + + + +let reperentation_of_ds2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> ds2={f10,f20,f30}`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC f1_fan_of_f10_eq_f20[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)` ] +THEN MRESA_TAC f1_fan_of_f20_eq_f30[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC f1_fan_of_f30_eq_f10[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f30:real^3#real^3#real^3#real^3)`; ] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM YEU") +THEN MRESAL_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `u:real^3`;`w:real^3` ][face;orbit_map] +THEN MRESA_TAC f10_in_d1_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`3:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`f10:real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`2:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`f10:real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`1:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`f10:real^3#real^3#real^3#real^3` ) +THEN MRESAL_TAC card_orbit_le[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`3:num`;`(f10:real^3#real^3#real^3#real^3)`][ARITH_RULE`~(3=0)`;ARITH_RULE`3=SUC 2`;POWER_2;POWER;o_DEF] +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "EM YEU"(fun th -> REWRITE_TAC[SYM th;ARITH_RULE`SUC 2=3`;]) +THEN MRESAL_TAC in_orbit_lemma[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`0:num`;`(f10:real^3#real^3#real^3#real^3)`;`(f10:real^3#real^3#real^3#real^3)`] +[POWER;I_DEF] +THEN MRESAL_TAC in_orbit_lemma[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`1:num`;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`] +[POWER_1] +THEN MRESAL_TAC in_orbit_lemma[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`2:num`;`(f10:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`] +[POWER_2;o_DEF] +THEN MP_TAC(SET_RULE`f10 IN orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10 +/\ f1_fan x V E1 f10 IN + orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10 +/\ f1_fan x V E1 (f1_fan x V E1 f10) IN + orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10 +==> +{f10, f1_fan x V E1 f10,f1_fan x V E1 (f1_fan x V E1 f10)} SUBSET + orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10`) +THEN RESA_TAC +THEN MRESA_TAC pair_disjoint_f10_f20_f30[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ] +THEN SUBGOAL_THEN(`CARD {f10,f20,f30:real^3#real^3#real^3#real^3}=3`)ASSUME_TAC +THENL[ +SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] + +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; +POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC f1_fan_permutes_prime[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC finite_d_fan[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`] +THEN MRESA_TAC lemma_orbit_finite[`d1_fan(x:real^3,V,E1)`;`(res (f1_fan x V E1) (d1_fan (x:real^3,V,E1)))`;`(f10:real^3#real^3#real^3#real^3)`] +THEN MRESAL_TAC CARD_SUBSET_LE[`{f10, f1_fan x V E1 f10, f1_fan (x:real^3) V E1 (f1_fan x V E1 f10)}`;`orbit_map (res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))) f10`;][orbit_map]]);; + + +let edge_not_in_ds2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ f10=(x,w,v,u) +/\ f20=(x,v,u,w) +/\ f30=(x,u,w,v) +/\ E UNION {{v,w}}=E1 +==> ~((x,v,w,sigma_fan x V E1 v w) IN ds2)`, + +REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESAL_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ][SET_RULE`~(a IN {b,c,d})<=> ~(a=b)/\ ~(a=c)/\ ~(a=d) `;EQ_PAIR_4;SET_RULE`~(A/\B)<=> ~ A\/ ~ B`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`;` (u:real^3)`] +THEN ASM_TAC +THEN DISJ_CASES_TAC(SET_RULE`v=w \/ ~(v=w:real^3)`) +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC SIGMA_FAN [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`; +` w:real^3`] +THEN FIND_ASSUM (MP_TAC)`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)` +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> MP_TAC (ISPEC `u:real^3` th) ) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC);; + + + +let disjoint_ds1_and_ds2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> ~(ds1=ds2)`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA_TAC edge_not_in_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ] +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;face;orbit_map;IN_ELIM_THM]) +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF]);; + + + + +let card_eq_image_in_d_fan=prove(`!x V E ds. +FAN(x,V,E) /\ +(!v. v IN V==>CARD (set_of_edge v V E) >1)/\ +ds SUBSET d_fan(x,V,E) +==> +CARD(IMAGE pr23 ds)= CARD ds`, + +REPEAT STRIP_TAC +THEN MATCH_MP_TAC CARD_IMAGE_INJ +THEN MRESA_TAC finite_d_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC FINITE_SUBSET[`ds:real^3#real^3#real^3#real^3->bool`; `d_fan(x:real^3,V,E):real^3#real^3#real^3#real^3->bool`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`x' IN ds /\ y IN ds /\ ds SUBSET d_fan(x,V,E)==> x' IN d_fan(x:real^3,V,E)/\ y IN d_fan(x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN REWRITE_TAC[d_fan;UNION;d1_fan;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[pr23;PAIR_EQ] +THEN RESA_TAC);; + + + + + + +let trans=new_definition`trans (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) E1=(\(x,y:real^3,z,sigma_fan x V E y z). (x,y,z,sigma_fan x V E1 y z))` +;; + +let tran=new_definition`tran x V E1=(\(x,y:real^3,z,w). (x,y,z,sigma_fan x V E1 y z))` +;; + + +let tranf=new_definition`tranf x V E E1 ds=(@f. ?y. f = face (hypermap1_of_fanx (x,V,E1)) (tran x V E1 y)/\ y IN ds)` +;; + + + +let exists_tranf_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds +==> ?f. ?y. f = face (hypermap1_of_fanx (x,V,E1)) (tran x V E1 y)/\ y IN ds0`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MP_TAC(SET_RULE` ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds +==> ds0 IN face_set (hypermap1_of_fanx (x,V,E)) `) +THEN ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM;] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN REMOVE_THEN "YEU" MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`face (hypermap1_of_fanx (x:real^3,V,E1)) (tran x V E1 (x':real^3#real^3#real^3#real^3))` +THEN EXISTS_TAC`x':real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[tran;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF]);; + + + + + + +let TRANF=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds +==> +?y. tranf x V E E1 ds0 = face (hypermap1_of_fanx (x,V,E1)) (tran x V E1 y)/\ y IN ds0`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN ONCE_REWRITE_TAC[tranf] + THEN MRESA_TAC exists_tranf_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0:real^3#real^3#real^3#real^3->bool` ] +THEN SELECT_ELIM_TAC +THEN EXISTS_TAC`f:real^3#real^3#real^3#real^3->bool` +THEN EXISTS_TAC`y:real^3#real^3#real^3#real^3` THEN ASM_REWRITE_TAC[]);; + + + + + + +let exists_edge_not_edge_in_face=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y n:num. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ y IN d_fan(x,V,E) +==> +?y1. y1 IN d_fan(x,V,E)/\ ~(pr2 y1 IN {v,w})/\ +face (hypermap1_of_fanx (x,V,E)) y1= face (hypermap1_of_fanx (x,V,E)) y +`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(pr2 y IN {v,w})\/ pr2 y IN {v,w}`) +THENL[ +EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`A IN {B,C}<=> A=B\/ A=C`] +THEN STRIP_TAC +THENL[ EXISTS_TAC`f1_fan x V E (y:real^3#real^3#real^3#real^3)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain1_f1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN SUBGOAL_THEN`f1_fan x V E y IN face (hypermap1_of_fanx (x:real^3,V,E)) y` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[face;IN_ELIM_THM;orbit_map;] +THEN EXISTS_TAC`1:num` +THEN REWRITE_TAC[ARITH_RULE`1>=0`;] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`1:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` ) +THEN REWRITE_TAC[POWER_1]; + +MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`y:real^3#real^3#real^3#real^3`;`(f1_fan x V E y):real^3#real^3#real^3#real^3`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[d1_fan; IN_ELIM_THM;] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[f1_fan;pr2] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w':real^3)`; +`(v':real^3)`] +THEN REMOVE_THEN"YEU EM" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]]; + +EXISTS_TAC`f1_fan x V E (y:real^3#real^3#real^3#real^3)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain1_f1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN SUBGOAL_THEN`f1_fan x V E y IN face (hypermap1_of_fanx (x:real^3,V,E)) y` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[face;IN_ELIM_THM;orbit_map;] +THEN EXISTS_TAC`1:num` +THEN REWRITE_TAC[ARITH_RULE`1>=0`;] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`1:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` ) +THEN REWRITE_TAC[POWER_1]; + +MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`y:real^3#real^3#real^3#real^3`;`(f1_fan x V E y):real^3#real^3#real^3#real^3`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[d1_fan; IN_ELIM_THM;] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[f1_fan;pr2] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"YEU EM" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w':real^3)`; +`(v':real^3)`]]]]);; + + + + +let TRAN_COMMUTATIVE_F1_FAN1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ~(pr3 y IN {v,w}) +/\ y IN d_fan(x,V,E) +==> +tran x V E1 ((f1_fan x V E ) y)=(f1_fan x V E1 ) (tran x V E1 y)`, + + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EMYEU") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[f1_fan;tran;PAIR_EQ] +THEN REMOVE_THEN"EMYEU" MP_TAC +THEN ASM_REWRITE_TAC[pr3] +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`w':real^3`;`(inverse1_sigma_fan (x:real^3) V E w' v')`]) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w':real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REPEAT RESA_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(RAND_CONV o ONCE_DEPTH_CONV)[SYM th]) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w':real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`inverse1_sigma_fan x V E w' (v':real^3)`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MP_TAC(SET_RULE`{inverse1_sigma_fan x V E w' v', w'} IN E +/\ E1= E UNION {{v,w}}==> {inverse1_sigma_fan x V E w' v', w'} IN E1`) +THEN REPEAT RESA_TAC);; + + + + +let TRAN_COMMUTATIVE_F1_FAN2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ~(pr2 y= u) +/\ pr3 y = w +/\ y IN d_fan(x,V,E) +==> +tran x V E1 ((f1_fan x V E ) y)=(f1_fan x V E1 ) (tran x V E1 y)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN DISCH_THEN(LABEL_TAC"EMYEU") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[f1_fan;tran;PAIR_EQ] +THEN REMOVE_THEN"EMYEU" MP_TAC +THEN ASM_REWRITE_TAC[pr3] +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN REMOVE_THEN"YEU EM" MP_TAC +THEN ASM_REWRITE_TAC[pr2] +THEN RESA_TAC +THEN SUBGOAL_THEN(`~(inverse1_sigma_fan (x:real^3) V E w v'=inverse1_sigma_fan x V E w u)`) ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN STRIP_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`u:real^3` +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REMOVE_THEN "LINH"(fun th-> ASM_REWRITE_TAC[SYM th] THEN ASSUME_TAC th +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"LINH")) +THEN RESA_TAC +THEN MRESA1_TAC th`v':real^3` +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "LINH"(fun th-> ASM_REWRITE_TAC[SYM th] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN RESA_TAC)); + +MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`) +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "LINH"(fun th-> ASM_REWRITE_TAC[SYM th] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[] +THEN ASSUME_TAC th) +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT5[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w v'):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`inverse1_sigma_fan x V E w (v':real^3)`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MP_TAC(SET_RULE`{inverse1_sigma_fan x V E w v', w} IN E +/\ E1= E UNION {{v,w}}==> {inverse1_sigma_fan x V E w v', w} IN E1`) +THEN REPEAT RESA_TAC]);; + + + + + +let TRAN_COMMUTATIVE_F1_FAN3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ~(pr2 y= sigma_fan x V E v u) +/\ pr3 y = v +/\ y IN d_fan(x,V,E) +==> +tran x V E1 ((f1_fan x V E ) y)=(f1_fan x V E1 ) (tran x V E1 y)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN DISCH_THEN(LABEL_TAC"EMYEU") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[f1_fan;tran;PAIR_EQ] +THEN REMOVE_THEN"EMYEU" MP_TAC +THEN ASM_REWRITE_TAC[pr3] +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN REMOVE_THEN"YEU EM" MP_TAC +THEN ASM_REWRITE_TAC[pr2] +THEN RESA_TAC +THEN SUBGOAL_THEN(`~(u=inverse1_sigma_fan (x:real^3) V E v v')`) ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3` +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REMOVE_THEN "LINH"(fun th-> ASM_REWRITE_TAC[SYM th] THEN ASSUME_TAC th +THEN RESA_TAC)); +MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3` +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REMOVE_THEN "LINH"(fun th-> ASM_REWRITE_TAC[SYM th] THEN ASSUME_TAC th +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[SYM th] THEN ASSUME_TAC th +THEN RESA_TAC )) +THEN STRIP_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT4[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E v v'):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`inverse1_sigma_fan x V E v (v':real^3)`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MP_TAC(SET_RULE`{inverse1_sigma_fan x V E v v', v} IN E +/\ E1= E UNION {{v,w}}==> {inverse1_sigma_fan x V E v v', v} IN E1`) +THEN REPEAT RESA_TAC]);; + + + + + + +let TRAN_COMMUTATIVE_F1_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ~(y IN ds) +/\ y IN d_fan(x,V,E) +==> +tran x V E1 ((f1_fan x V E ) y)=(f1_fan x V E1 ) (tran x V E1 y)`, + + +REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE` +((pr2 y= sigma_fan x V E v u)/\ pr3 y = v)\/ +((pr2 y= u)/\ pr3 y = w)\/ +(~(pr2 y= sigma_fan x V E v u)/\ pr3 y = v)\/ +(~(pr2 y= u)/\ pr3 y = w)\/ + ~(pr3 y IN {v,w})`) +THENL[ +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN DISCH_THEN(LABEL_TAC"EMYEU") +THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN REMOVE_THEN "LINH" ( fun th->MP_TAC th +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN MP_TAC th THEN RESA_TAC) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[f1_fan;tran;PAIR_EQ] +THEN REMOVE_THEN"EMYEU" MP_TAC +THEN ASM_REWRITE_TAC[pr2] +THEN RESA_TAC +THEN REMOVE_THEN"YEU EM" MP_TAC +THEN ASM_REWRITE_TAC[pr3] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EMYEU") +THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN STRIP_TAC +THEN STRIP_TAC +THEN REMOVE_THEN"YEU EM" MP_TAC +THEN REMOVE_THEN"EMYEU" MP_TAC +THEN RESA_TAC THEN STRIP_TAC +THEN SUBGOAL_THEN`f1= f1_fan x V E (y:real^3#real^3#real^3#real^3)`ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[f1_fan] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`u:real^3` ) +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds /\ ds SUBSET d1_fan (x,V,E)==> {f1,f2,f3} SUBSET (ds:real^3#real^3#real^3#real^3->bool)/\ f1 IN d1_fan (x,V,E) `) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`pr2 f1 =v:real^3` +THEN FIND_ASSUM(MP_TAC)`pr3 f1= u :real^3` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;pr2;pr3]) +THEN RESA_TAC +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN DISCH_THEN(fun th-> ASSUME_TAC(SYM th)) +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds /\ ds SUBSET d1_fan (x,V,E)==> {f1,f2,f3} SUBSET (ds:real^3#real^3#real^3#real^3->bool)/\ f1 IN ds `) +THEN RESA_TAC +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f1:real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`]]; + + + + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL[ + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN DISCH_THEN(LABEL_TAC"EMYEU") +THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN REMOVE_THEN "LINH" ( fun th->MP_TAC th +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN MP_TAC th THEN RESA_TAC) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[f1_fan;tran;PAIR_EQ] +THEN REMOVE_THEN"EMYEU" MP_TAC +THEN ASM_REWRITE_TAC[pr2] +THEN RESA_TAC +THEN REMOVE_THEN"YEU EM" MP_TAC +THEN ASM_REWRITE_TAC[pr3] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EMYEU") +THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN STRIP_TAC +THEN STRIP_TAC +THEN REMOVE_THEN"YEU EM" MP_TAC +THEN REMOVE_THEN"EMYEU" MP_TAC +THEN RESA_TAC THEN STRIP_TAC +THEN SUBGOAL_THEN`f2= (y:real^3#real^3#real^3#real^3)`ASSUME_TAC +THENL[ +MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds /\ ds SUBSET d1_fan (x,V,E)==> {f1,f2,f3} SUBSET (ds:real^3#real^3#real^3#real^3->bool)/\ f2 IN d1_fan (x,V,E) `) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`pr2 f2 =u:real^3` +THEN FIND_ASSUM(MP_TAC)`pr3 f2= w :real^3` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;pr2;pr3]) +THEN RESA_TAC +THEN RESA_TAC; +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN DISCH_TAC +THEN MP_TAC(SET_RULE`{f1,f2,f3:real^3#real^3#real^3#real^3} SUBSET ds ==> f2 IN ds `) +THEN RESA_TAC]; +MRESA_TAC TRAN_COMMUTATIVE_F1_FAN3 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`]; + +MRESA_TAC TRAN_COMMUTATIVE_F1_FAN2 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`]; + +MRESA_TAC TRAN_COMMUTATIVE_F1_FAN1 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`]]]);; + + + +let f1_fan_power_in_face=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y n. +FAN(x,V,E)/\ +(!v. v IN V ==> CARD (set_of_edge v V E) > 1) /\ + ds IN face_set (hypermap1_of_fanx (x,V,E))/\ +y IN d1_fan (x,V,E) +/\ ~(y IN ds) +==> ~((f1_fan x V E POWER n) y IN ds)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN MATCH_MP_TAC MONO_NOT +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC +THENL[ +ASM_REWRITE_TAC[POWER;I_DEF]; + + +REWRITE_TAC[COM_POWER;o_DEF] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3`) +THEN MP_TAC(SET_RULE`(f1_fan x V E POWER n) y IN d1_fan (x,V,E)/\ +d_fan (x,V,E)=d1_fan (x,V,E) UNION d20_fan (x,V,E) +==> (f1_fan x V E POWER n) y IN d_fan (x,V,E)`) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[d_fan] +THEN RESA_TAC +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`(f1_fan x V E ((f1_fan x V E POWER n) y)):real^3#real^3#real^3#real^3`;`((f1_fan x V E POWER n) y):real^3#real^3#real^3#real^3`]]);; + + +let f1_fan_power_in_face_imp_in_face=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y n. +FAN(x,V,E)/\ +(!v. v IN V ==> CARD (set_of_edge v V E) > 1) /\ + ds IN face_set (hypermap1_of_fanx (x,V,E))/\ +y IN d1_fan (x,V,E) +/\ ((f1_fan x V E POWER n) y IN ds) +==> +(y IN ds)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC +THENL[ +ASM_REWRITE_TAC[POWER;I_DEF]; + + +REWRITE_TAC[COM_POWER;o_DEF] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3`) +THEN MP_TAC(SET_RULE`(f1_fan x V E POWER n) y IN d1_fan (x,V,E)/\ +d_fan (x,V,E)=d1_fan (x,V,E) UNION d20_fan (x,V,E) +==> (f1_fan x V E POWER n) y IN d_fan (x,V,E)`) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[d_fan] +THEN RESA_TAC +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`(f1_fan x V E ((f1_fan x V E POWER n) y)):real^3#real^3#real^3#real^3`;`((f1_fan x V E POWER n) y):real^3#real^3#real^3#real^3`]]);; + + + +let TRAN_COMMUTATIVE_F1_FAN0=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 + /\ ((~(pr2 y= sigma_fan x V E v u)/\ pr3 y = v)\/ +(~(pr2 y= u)/\ pr3 y = w) \/ ~(pr3 y IN {v,w})) +/\ y IN d_fan(x,V,E) +==> +tran x V E1 ((f1_fan x V E ) y)=(f1_fan x V E1 ) (tran x V E1 y)`, + + +REPEAT STRIP_TAC +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN1 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN2 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN3 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`]);; + + + +let TRAN_COMMUTATIVE_F1_FAN_POWER=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y n. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ~(y IN ds) +/\ y IN d_fan(x,V,E) +==> +tran x V E1 ((f1_fan x V E POWER n) y)=(f1_fan x V E1 POWER n) (tran x V E1 y)`, + +REPEAT STRIP_TAC +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC +THENL[ + +REWRITE_TAC[POWER;I_DEF]; +REWRITE_TAC[COM_POWER;o_DEF] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(((f1_fan x V E POWER n) y):real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3`) +THEN ASM_SIMP_TAC[f1_fan_power_in_face]]);; + + + + + + +let TRAN_COMMUTATIVE_F1_FAN_POWER1=prove( +`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y n. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ y IN d_fan(x,V,E) +/\ (!m. m < n ==> ~(pr3 ((f1_fan x V E POWER m) y) IN {v,w})) +==> +tran x V E1 ((f1_fan x V E POWER n) y)=(f1_fan x V E1 POWER n) (tran x V E1 y)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC +THENL[ + +REWRITE_TAC[POWER;I_DEF]; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINK") +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN DISCH_TAC +THEN SUBGOAL_THEN`(!m. m < n ==> ~(pr3 ((f1_fan x V E POWER m) y) IN {v, w:real^3}))` ASSUME_TAC +THENL[ REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (ARITH_RULE`!m n. m m< SUC n`)[`m:num`;`n:num`]; +REMOVE_THEN "LINH" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN REWRITE_TAC[COM_POWER;o_DEF] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`n:num`[ARITH_RULE`n< SUC n`]) +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN1 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(((f1_fan x V E POWER n) y):real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN STRIP_TAC +THEN REMOVE_THEN "LINK" MP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3`) +THEN ASM_SIMP_TAC[f1_fan_power_in_face]]]);; + + + + + + + + + + +let TRAN_COMMUTATIVE_F1_FAN_POWER2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y n. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ y IN d_fan(x,V,E) +/\ (!m. m < n ==> ((~(pr2 ((f1_fan x V E POWER m) y)= sigma_fan x V E v u)/\ pr3 ((f1_fan x V E POWER m) y) = v)\/ +(~(pr2 ((f1_fan x V E POWER m) y)= u)/\ pr3 ((f1_fan x V E POWER m) y) = w)) +) +==> +tran x V E1 ((f1_fan x V E POWER n) y)=(f1_fan x V E1 POWER n) (tran x V E1 y)`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC + +THENL[ + +REWRITE_TAC[POWER;I_DEF]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINK") +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN DISCH_TAC +THEN SUBGOAL_THEN`(!m. m < n ==> ((~(pr2 ((f1_fan x V E POWER m) y)= sigma_fan x V E v u)/\ pr3 ((f1_fan x V E POWER m) y) = v)\/ +(~(pr2 ((f1_fan x V E POWER m) y)= u)/\ pr3 ((f1_fan x V E POWER m) y) = w:real^3)) +)` ASSUME_TAC +THENL[ +REPEAT STRIP_TAC +THEN MRESA_TAC (ARITH_RULE`!m n. m m< SUC n`)[`m:num`;`n:num`]; +REMOVE_THEN "LINH" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN REWRITE_TAC[COM_POWER;o_DEF] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`n:num`[ARITH_RULE`n< SUC n`]) +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN0 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(((f1_fan x V E POWER n) y):real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN STRIP_TAC +THEN REMOVE_THEN "LINK" MP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3`) +THEN ASM_SIMP_TAC[f1_fan_power_in_face]]]);; + + + +let TRAN_COMMUTATIVE_F1_FAN_POWER3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y n. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ y IN d_fan(x,V,E) +/\ (!m. m < n ==> (~(pr2 ((f1_fan x V E POWER m) y) = sigma_fan x V E v u) /\ + pr3 ((f1_fan x V E POWER m) y) = v) \/ + (~(pr2 ((f1_fan x V E POWER m) y) = u) /\ + pr3 ((f1_fan x V E POWER m) y) = w) \/ + ~(pr3 ((f1_fan x V E POWER m) y) IN {v, w})) +==> +tran x V E1 ((f1_fan x V E POWER n) y)=(f1_fan x V E1 POWER n) (tran x V E1 y)`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC + +THENL[ + +REWRITE_TAC[POWER;I_DEF]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINK") +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN DISCH_TAC +THEN SUBGOAL_THEN`(!m. m < n ==> (~(pr2 ((f1_fan x V E POWER m) y) = sigma_fan x V E v u) /\ + pr3 ((f1_fan x V E POWER m) y) = v) \/ + (~(pr2 ((f1_fan x V E POWER m) y) = u) /\ + pr3 ((f1_fan x V E POWER m) y) = w) \/ + ~(pr3 ((f1_fan x V E POWER m) y) IN {v, w}) +)` ASSUME_TAC +THENL[ +REPEAT STRIP_TAC +THEN MRESA_TAC (ARITH_RULE`!m n. m m< SUC n`)[`m:num`;`n:num`]; +REMOVE_THEN "LINH" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN REWRITE_TAC[COM_POWER;o_DEF] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`n:num`[ARITH_RULE`n< SUC n`]) +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN0 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(((f1_fan x V E POWER n) y):real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN STRIP_TAC +THEN REMOVE_THEN "LINK" MP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3`) +THEN ASM_SIMP_TAC[f1_fan_power_in_face]]]);; + + + +let unique_tranf_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0 f y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ f= face (hypermap1_of_fanx (x,V,E1)) (tran x V E1 y)/\ y IN ds0 +/\ ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds +==> tranf x V E E1 ds0 = f`, + +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC TRANF[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0:real^3#real^3#real^3#real^3->bool` ] +THEN FIND_ASSUM(MP_TAC) `ds0 IN face_set (hypermap1_of_fanx (x:real^3,V,E))` +THEN REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN SUBGOAL_THEN`orbit_map (res (f1_fan x V E) (d1_fan (x,V,E))) x'=face (hypermap1_of_fanx (x:real^3,V,E)) x'`(fun th-> REWRITE_TAC[th]) +THENL[ + ASM_REWRITE_TAC[face]; + +STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC lemma_face_subset[`hypermap1_of_fanx (x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`] +THEN MP_TAC(SET_RULE`face (hypermap1_of_fanx (x,V,E)) x' SUBSET d1_fan (x,V,E) +/\ y IN face (hypermap1_of_fanx (x,V,E)) x' ==> y IN d1_fan(x,V,E)`) +THEN RESA_TAC +THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN DISCH_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[face;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM;orbit_map] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` ) +THEN RESA_TAC +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN_POWER +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`;`n:num`] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x:real^3,V,E1)) ((f1_fan x V E1 POWER n) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3)))):real^3#real^3#real^3#real^3->bool`;`(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E1)) ((f1_fan x V E1 POWER n) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))) IN + face_set (hypermap1_of_fanx (x:real^3,V,E1))`ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;face] +THEN EXISTS_TAC`(f1_fan (x:real^3) V E1 POWER n) (tran x V E1 (y:real^3#real^3#real^3#real^3))` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`n:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`) +THEN POP_ASSUM MATCH_MP_TAC + +THEN FIND_ASSUM(MP_TAC)`y IN d1_fan (x:real^3,V,E)` +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[tran] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v':real^3` +THEN EXISTS_TAC`w':real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v' (w':real^3)` +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM] THEN ASM_REWRITE_TAC[])` E UNION {{v:real^3,w}}= E1`; + +MRESA_TAC f1_fan_power_in_face_imp_in_face[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`; +`(face (hypermap1_of_fanx (x,V,E1)) ((f1_fan x V E1 POWER n) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3)))):real^3#real^3#real^3#real^3->bool`;`tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3)` ;`n:num`] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN STRIP_TAC +THENL[ + +FIND_ASSUM(MP_TAC)`y IN d1_fan (x:real^3,V,E)` +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[tran] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v':real^3` +THEN EXISTS_TAC`w':real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v' (w':real^3)` +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM] THEN ASM_REWRITE_TAC[])` E UNION {{v:real^3,w}}= E1`; + +EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF]]]]);; + + + + + + +let tran_in_dart_newfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 y . +FAN(x,V,E)/\ FAN(x,V,E1) +/\ E SUBSET E1 +/\ y IN d1_fan(x,V,E) +==> tran x V E1 y IN d1_fan(x,V,E1)`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN REWRITE_TAC[tran] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v (w:real^3)` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN SET_TAC[]);; + + + + +let INJ_TRAN_D1_FAN=prove(` !x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 y y1. +FAN(x,V,E)/\ FAN(x,V,E1) +/\ E SUBSET E1 +/\ y IN d1_fan(x,V,E) +/\ y1 IN d1_fan(x,V,E) +/\ +tran x V E1 y = tran x V E1 y1 +==> y =y1`, +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[tran;PAIR_EQ] +THEN RESA_TAC);; + + + + + + +let INJ_TRANF_FACE_DELETE_DS= prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0 ds0'. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds +/\ ds0' IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds +/\ tranf x V E E1 ds0=tranf x V E E1 ds0' +==> + ds0 = ds0'`, + + + +REPEAT STRIP_TAC +THEN MRESA_TAC TRANF[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0:real^3#real^3#real^3#real^3->bool` ] +THEN SUBGOAL_THEN`(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3)) IN face (hypermap1_of_fanx (x,V,E1)) (tran x V E1 y)`ASSUME_TAC +THENL[ + +REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF]; + +POP_ASSUM MP_TAC +THEN MRESA_TAC TRANF[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0':real^3#real^3#real^3#real^3->bool` ] +THEN REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM(MP_TAC)`ds0' IN face_set (hypermap1_of_fanx (x:real^3,V,E)) DELETE ds` +THEN REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN RESA_TAC +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0':real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y' IN ds0'/\ ds0' SUBSET d1_fan (x:real^3,V,E)==> y' IN d1_fan (x,V,E)`) +THEN RESA_TAC +THEN FIND_ASSUM(MP_TAC)`ds0 IN face_set (hypermap1_of_fanx (x:real^3,V,E)) DELETE ds` +THEN REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN RESA_TAC +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y IN ds0/\ ds0 SUBSET d1_fan (x:real^3,V,E)==> y IN d1_fan (x,V,E)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`E UNION {{v:real^3,w}}= E1==> E SUBSET E1`) +THEN RESA_TAC +THEN MRESA_TAC tran_in_dart_newfan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(E1:(real^3->bool)->bool)`; +`y':real^3#real^3#real^3#real^3`] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`tran (x:real^3) V E1 (y':real^3#real^3#real^3#real^3)`) +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0':real^3#real^3#real^3#real^3->bool`;`y':real^3#real^3#real^3#real^3`] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y':real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN_POWER +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y':real^3#real^3#real^3#real^3)`;`n:num`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y':real^3#real^3#real^3#real^3)`) +THEN MRESA_TAC INJ_TRAN_D1_FAN +[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(E1:(real^3->bool)->bool)`; +`y:real^3#real^3#real^3#real^3`;`(f1_fan x V E POWER n) (y':real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0':real^3#real^3#real^3#real^3->bool`;`y':real^3#real^3#real^3#real^3`] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`] + +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x:real^3,V,E)) ((f1_fan x V E POWER n) (y':real^3#real^3#real^3#real^3))):real^3#real^3#real^3#real^3->bool`;` (y':real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MATCH_MP_TAC +THEN SUBGOAL_THEN`face (hypermap1_of_fanx (x:real^3,V,E)) ((f1_fan x V E POWER n) y') IN + face_set (hypermap1_of_fanx (x,V,E))`ASSUME_TAC +THENL[ + +REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`(f1_fan x V E POWER n) (y':real^3#real^3#real^3#real^3)` +THEN ASM_REWRITE_TAC[face]; + +MRESA_TAC f1_fan_power_in_face_imp_in_face[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`(face (hypermap1_of_fanx (x,V,E)) ((f1_fan x V E POWER n) (y':real^3#real^3#real^3#real^3))):real^3#real^3#real^3#real^3->bool`;`(y':real^3#real^3#real^3#real^3)` ;`n:num`] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF]]]);; + + + + + + +let ds1_in_face_set_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1=face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2=face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> ds1 IN face_set (hypermap1_of_fanx (x,V,E1))`, + + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN ASM_REWRITE_TAC[face_set;face;set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`(x,v:real^3,w,sigma_fan x V E1 v w)` +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v w:real^3` +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM;IN_SING] THEN ASM_REWRITE_TAC[])` E UNION {{v:real^3,w}}= E1`);; + + + +let ds2_in_face_set_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ ds2=face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> ds2 IN face_set (hypermap1_of_fanx (x,V,E1))`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN ASM_REWRITE_TAC[face_set;face;set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`(x,w:real^3,v,sigma_fan x V E1 w v)` +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 w v:real^3` +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM;IN_SING] THEN ASM_REWRITE_TAC[])` E UNION {{v:real^3,w}}= E1` +THEN SET_TAC[]);; + + + + + +let condition_f1_fan_power_in_face_set=prove(`!n:num x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) y y1 ds. +FAN(x,V,E) +/\ y = (f1_fan x V E POWER n) y1 +/\ ds IN face_set (hypermap1_of_fanx (x,V,E)) +/\ d_fan (x,V,E) =d1_fan (x,V,E) +/\ y1 IN ds +==> y IN ds`, +INDUCT_TAC +THENL[MESON_TAC[POWER;I_DEF]; +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESAL_TAC th[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f1_fan x V E POWER n) y1:real^3#real^3#real^3#real^3`;`y1:real^3#real^3#real^3#real^3`;`ds:real^3#real^3#real^3#real^3->bool`;][COM_POWER;o_DEF]) +THEN MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f1_fan x V E ((f1_fan x V E POWER n) y1):real^3#real^3#real^3#real^3)` ;`((f1_fan x V E POWER n) y1:real^3#real^3#real^3#real^3)`;`ds:real^3#real^3#real^3#real^3->bool`]]);; + + + + + + + + + + + +let SUR_TRANF_FACE_DELETE_DS =prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 f. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ f IN (face_set (hypermap1_of_fanx (x,V,E1)) DELETE ds1 ) DELETE ds2 +==> ?ds0. ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds +/\ tranf x V E E1 ds0=f`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM;face_set;set_of_orbits;] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC) `x' IN d1_fan (x:real^3,V,E1)` +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[d1_fan;] +THEN REWRITE_TAC[IN_ELIM_THM;] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"NHO") +THEN SUBGOAL_THEN`{v', w':real^3} IN E`ASSUME_TAC +THENL(*1*)[ +FIND_ASSUM(MP_TAC) `{v', w':real^3} IN E1` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM;IN_SING;SET_RULE`{v', w'} = {v, w}<=> (v'=v/\ w'=w)\/ (v'=w/\ w'=v)`]) `E UNION {{v:real^3, w}} = E1` +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM (fun th -> ASM_TAC THEN ASM_REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM (fun th -> ASM_TAC THEN ASM_REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM (fun th -> ASM_TAC THEN ASM_REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM (fun th -> ASM_TAC THEN ASM_REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM (fun th -> ASM_TAC THEN ASM_REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM (fun th -> ASM_TAC THEN ASM_REWRITE_TAC[th;face] THEN REPEAT STRIP_TAC) +THEN FIND_ASSUM(fun th -> ASM_TAC THEN ASM_REWRITE_TAC[th;face] THEN REPEAT STRIP_TAC)`face_map (hypermap1_of_fanx (x:real^3,V,E1)) = + res (f1_fan x V E1) (d1_fan (x,V,E1))` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[];(*1*) + + + +ABBREV_TAC`y=(x,(v':real^3),w',sigma_fan x V E v' w')` +THEN SUBGOAL_THEN`y IN d1_fan(x:real^3,V,E)`ASSUME_TAC +THENL(*2*)[ +ASM_REWRITE_TAC[face;d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v':real^3` +THEN EXISTS_TAC`w':real^3` +THEN EXISTS_TAC`sigma_fan x V E v' (w':real^3)` +THEN EXPAND_TAC"y" +THEN ASM_REWRITE_TAC[];(*2*) + + +EXISTS_TAC`face (hypermap1_of_fanx (x:real^3,V,E)) (y:real^3#real^3#real^3#real^3)` +THEN SUBGOAL_THEN `((?x'. x' IN d1_fan (x,V,E) /\ + face (hypermap1_of_fanx (x,V,E)) y = + orbit_map (res (f1_fan x V E) (d1_fan (x,V,E))) x') /\ + ~(face (hypermap1_of_fanx (x,V,E)) y = ds)) ` ASSUME_TAC + +THENL(*3*)[ + +STRIP_TAC +THENL(*4*)[ + +EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[face];(*4*) + +STRIP_TAC +THEN MP_TAC(SET_RULE`{f1, f2, (f3:real^3#real^3#real^3#real^3)} SUBSET ds ==> f2 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"ME") +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`(CARD (ds:real^3#real^3#real^3#real^3->bool)):num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`) +THEN MRESA_TAC lemma_face_cycle[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`y:real^3#real^3#real^3#real^3`] + +THEN MP_TAC(ARITH_RULE`(CARD (ds:real^3#real^3#real^3#real^3->bool)):num>3 +==> ~((CARD (ds:real^3#real^3#real^3#real^3->bool)):num =0)`) +THEN RESA_TAC +THEN MRESA_TAC orbit_cyclic[`(res (f1_fan x V E) (d1_fan (x:real^3,V,E)))`;`(CARD (ds:real^3#real^3#real^3#real^3->bool)):num`;`y:real^3#real^3#real^3#real^3`] +THEN REMOVE_THEN "ME"(fun th-> REWRITE_TAC[SYM th;face;]) +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`k=0 \/ k=1\/ k>=2`) +THENL(*5*)[ + +ASM_REWRITE_TAC[POWER;I_DEF] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`pr2 f2 = u:real^3` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] +THEN EXPAND_TAC"y" +THEN REWRITE_TAC[pr2] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`pr3 f2 = w` +THEN REWRITE_TAC[th] +THEN EXPAND_TAC"y" +THEN REWRITE_TAC[pr3] +THEN STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) + THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`) +THEN RESA_TAC +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MP_TAC(SET_RULE`ds2 = {(f10:real^3#real^3#real^3#real^3), f20, f30}==> f30 IN ds2`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`;` (f30:real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;face] THEN REPEAT STRIP_TAC) +THEN ASM_MESON_TAC[];(*5*) + + + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL(*6*)[ + +ASM_REWRITE_TAC[POWER_1] +THEN MRESAL_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`1:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`][POWER_1] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`) +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`ds SUBSET d1_fan (x,V,E) /\ {f1, f2, f3} SUBSET ds +==> f1 IN d1_fan(x,V,E)`) +THEN RESA_TAC +THEN MRESA_TAC MONO_F1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[` (f1:real^3#real^3#real^3#real^3)`;` (y:real^3#real^3#real^3#real^3)`]) +THEN FIND_ASSUM(MP_TAC)`pr2 f1 = v:real^3` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] +THEN EXPAND_TAC"y" +THEN REWRITE_TAC[pr2] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`pr3 f1 = u` +THEN REWRITE_TAC[th] +THEN EXPAND_TAC"y" +THEN REWRITE_TAC[pr3] +THEN STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MP_TAC(SET_RULE`ds2 = {(f10:real^3#real^3#real^3#real^3), f20, f30}==> f20 IN ds2`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`;` (f20:real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;face] THEN REPEAT STRIP_TAC) +THEN ASM_MESON_TAC[];(*6*) + + +SUBGOAL_THEN`?m. k=SUC (SUC m)/\ m>=0`ASSUME_TAC +THENL(*7*)[ +EXISTS_TAC`k-2:num` +THEN REWRITE_TAC[ARITH_RULE`SUC n= n+1`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC;(*7*) + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC (SUC m):num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`][POWER_1] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`) +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REWRITE_TAC[COM_POWER;o_DEF] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CHUYEN") +THEN DISCH_TAC +THEN REMOVE_THEN "CHUYEN" MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC n= n+1`] +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`(m + 1) + 1 < CARD (ds:real^3# real^3#real^3#real^3->bool)==> m< CARD ds -2`) +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN ASM_TAC +THEN SPEC_TAC (`m:num`,`m:num`) +THEN INDUCT_TAC + +THENL(*8*)[ + +ASM_REWRITE_TAC[POWER;I_DEF] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`ds SUBSET d1_fan (x,V,E) /\ {f1, f2, f3} SUBSET ds +==> f1 IN d1_fan(x,V,E)`) +THEN RESA_TAC +THEN MRESA_TAC into_domain1_f1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th` y:real^3#real^3#real^3#real^3`) + +THEN MRESA_TAC MONO_F1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[` (f1:real^3#real^3#real^3#real^3)`;` (f1_fan x V E y:real^3#real^3#real^3#real^3)`]) +THEN FIND_ASSUM(MP_TAC)`pr2 f1 = v:real^3` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] +THEN EXPAND_TAC"y" +THEN REWRITE_TAC[pr2;f1_fan] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`pr3 f1 = u` +THEN REWRITE_TAC[th] +THEN EXPAND_TAC"y" +THEN REWRITE_TAC[pr3;f1_fan] +THEN STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;] THEN REPEAT STRIP_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w':real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN SUBGOAL_THEN`((x,v:real^3,w,sigma_fan x V E1 v w)=f1_fan x V E1 x')`ASSUME_TAC +THENL(*9*)[ +ASM_REWRITE_TAC[f1_fan;PAIR_EQ] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`w:real^3`) +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[SYM th;UNION;IN_ELIM_THM;] THEN ASM_REWRITE_TAC[IN_SING])` E UNION {{v:real^3,w}}= E1` +THEN RESA_TAC;(*9*) +SUBGOAL_THEN`(x,v,w,sigma_fan x V E1 v w) IN face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)`ASSUME_TAC +THENL(*10*)[ + +REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF];(*10*) + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN FIND_ASSUM(MP_TAC)`x' IN d1_fan (x:real^3,V,E1)` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`x' = (x'',v',v,(w1:real^3)):real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`f1_fan x V E1 x':real^3#real^3#real^3#real^3`;`x':real^3#real^3#real^3#real^3`] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`x':real^3#real^3#real^3#real^3`] +THEN FIND_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC THEN ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC THEN MP_TAC th THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;face] THEN REPEAT STRIP_TAC) +)`x' = (x'',v',v,(w1:real^3)):real^3#real^3#real^3#real^3` +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;] THEN REPEAT STRIP_TAC) +THEN ASM_MESON_TAC[]](*10*)](*9*);(*8*) + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"NHO") +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN MP_TAC(ARITH_RULE`SUC m < CARD (ds:real^3# real^3#real^3#real^3->bool) - 2==> m < CARD ds - 2`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`m>=0`] +THEN STRIP_TAC +THEN ABBREV_TAC`y1=(f1_fan (x:real^3) V E POWER SUC(m)) y` +THEN STRIP_TAC +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`ds SUBSET d1_fan (x,V,E) /\ {f1, f2, f3} SUBSET ds +==> f1 IN d1_fan(x,V,E)`) +THEN RESA_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC m:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`) +THEN MRESA_TAC into_domain1_f1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th` y1:real^3#real^3#real^3#real^3`) +THEN MRESA_TAC MONO_F1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[` (f1:real^3#real^3#real^3#real^3)`;` (f1_fan x V E y1:real^3#real^3#real^3#real^3)`]) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN ASSUME_TAC th THEN STRIP_TAC) +THEN ASM_REWRITE_TAC[f1_fan] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`pr2 f1 = v:real^3` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] +THEN REWRITE_TAC[pr2;] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`pr3 f1 = u` +THEN REWRITE_TAC[pr3;th] +THEN STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "NHO" MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"AN") THEN DISCH_THEN(LABEL_TAC"NHO") THEN STRIP_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v'':real^3`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN SUBGOAL_THEN`((x,v:real^3,w,sigma_fan x V E1 v w)=f1_fan x V E1 (x,sigma_fan x V E1 v w,v,sigma_fan x V E1 v'' v))`ASSUME_TAC +THENL(*9*)[ + +ASM_REWRITE_TAC[f1_fan;PAIR_EQ] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`w:real^3`) +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[SYM th;UNION;IN_ELIM_THM;] THEN ASM_REWRITE_TAC[IN_SING])` E UNION {{v:real^3,w}}= E1` +THEN RESA_TAC;(*9*) + +SUBGOAL_THEN`(x,v,w,sigma_fan x V E1 v w) IN face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)`ASSUME_TAC +THENL(*10*)[ + +REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF];(*10*) + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN SUBGOAL_THEN`x,v'',v,sigma_fan x V E1 v'' v IN d1_fan (x:real^3,V,E1)`ASSUME_TAC +THENL(*11*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v'':real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v'' v:real^3` +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM;] THEN ASM_REWRITE_TAC[IN_SING])` E UNION {{v:real^3,w}}= E1`;(*11*) + +MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`f1_fan x V E1 (x,v'',v,sigma_fan x V E1 v'' v):real^3#real^3#real^3#real^3`;`(x,v'',v,sigma_fan x V E1 v'' v):real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`(x,v'',v,sigma_fan x V E1 v'' v)=tran x V E1 (y1:real^3#real^3#real^3#real^3)`ASSUME_TAC +THENL(*12*)[ +ASM_REWRITE_TAC[tran];(*12*) + +ASM_REWRITE_TAC[] +THEN REMOVE_THEN "NHO" MP_TAC +THEN FIND_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC +THEN ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC THEN MP_TAC th THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"NHO") +THEN ASSUME_TAC (SYM th) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"AN") +)`y1 = (x''',v'',v,(w1':real^3)):real^3#real^3#real^3#real^3` +THEN MRESAL_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`1:num`;][POWER_1] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` THEN MRESA1_TAC th`y1:real^3#real^3#real^3#real^3`) +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN_POWER3 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`;`SUC m:num`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC finite_d1_fan[`x:real^3`;` V:real^3->bool`;` (E:(real^3->bool)->bool)`] +THEN MRESA_TAC AAUHTVE[`x:real^3`;` V:real^3->bool`;` (E:(real^3->bool)->bool)`;`( \ t. res (t x V E ) (d1_fan (x:real^3,V,E)) )`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN MP_TAC (SET_RULE`{f1, f2:real^3#real^3#real^3#real^3, f3} SUBSET ds==> f2 IN ds`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`(f1_fan x V E (f1_fan x V E y1)):real^3#real^3#real^3#real^3`;`f1_fan x V E y1:real^3#real^3#real^3#real^3`;] +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`(f1_fan x V E y1):real^3#real^3#real^3#real^3`;` y1:real^3#real^3#real^3#real^3`;] +THEN MRESA_TAC lemma_face_representation[`hypermap1_of_fanx(x:real^3,V,E)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`SUC m`; `x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y1:real^3#real^3#real^3#real^3`;` y:real^3#real^3#real^3#real^3`;] +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x'''':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face] +THEN MRESA_TAC lemma_segment_orbit[`d1_fan (x:real^3,V,E)`;`res (f1_fan x V E) (d1_fan ((x:real^3),V,E))`;`(y:real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[face] THEN STRIP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;lemma_def_inj_orbit]) +THEN REMOVE_ASSUM_TAC +THEN MP_TAC(ARITH_RULE `SUC (m:num) < CARD (ds:real^3#real^3#real^3#real^3->bool) - 2 ==> CARD ds -1 < CARD ds /\ SUC (m:num) <= CARD (ds:real^3#real^3#real^3#real^3->bool) - 1 /\ SUC( SUC(SUC (m:num))) <= CARD (ds:real^3#real^3#real^3#real^3->bool) - 1`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `CARD (ds:real^3#real^3#real^3#real^3->bool) -1 :num`) +THEN SUBGOAL_THEN`!m'. m' < SUC m==> ~((f1_fan (x:real^3) V E POWER m') y=y1) /\ ~((f1_fan (x:real^3) V E POWER m') y=f2)` ASSUME_TAC +THENL(*13*)[ +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN REPEAT STRIP_TAC +THENL(*14*)[ + +POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`m':num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC m:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` ) +THEN REMOVE_THEN "LINH"(fun th-> MRESA_TAC th [`SUC (m:num)`;`m':num`;]);(*14*) + + +POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`m':num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC (SUC(SUC m:num))`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` ) +THEN MP_TAC (ARITH_RULE`m'< SUC m ==> m'< SUC(SUC(SUC m)) `) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESA_TAC th [`SUC (SUC (SUC (m:num)))`;`m':num`;]) +THEN REMOVE_THEN "AN" MP_TAC +THEN DISCH_TAC THEN REMOVE_ASSUM_TAC +THEN EXPAND_TAC"y1" +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[COM_POWER;o_DEF;SET_RULE`~(A=B)<=> ~(B=A)`]](*14*);(*13*) + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN SUBGOAL_THEN`!m'. m' < SUC m + ==> (~(pr2 ((f1_fan x V E POWER m') y) = v'') /\ + pr3 ((f1_fan x V E POWER m') y) = v) \/ + (~(pr2 ((f1_fan x V E POWER m') y) = u) /\ + pr3 ((f1_fan x V E POWER m') y) = w) \/ +~(pr3 ((f1_fan x V E POWER m') y) IN {v, w})` ASSUME_TAC +THENL(*14*)[ + +REPEAT STRIP_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th`m':num`) +THEN MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`SUC m`; `x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y1:real^3#real^3#real^3#real^3`;` y:real^3#real^3#real^3#real^3`;] +THEN MRESA_TAC condition_f1_fan_power_in_face_set[`m':num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3` ;` y:real^3#real^3#real^3#real^3`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`f1_fan x V E (f1_fan x V E y1) IN ds /\ (f1_fan x V E POWER m') y IN ds/\ ds SUBSET d1_fan (x,V,E)==> (f1_fan x V E POWER m') y IN d1_fan (x:real^3,V,E) /\ f1_fan x V E (f1_fan x V E y1) IN d1_fan (x:real^3,V,E)`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`y1:real^3#real^3#real^3#real^3`][PAIR_EQ] +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "AN"(fun th-> REWRITE_TAC[SYM th;pr2;pr3]) +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`][PAIR_EQ;pr2;pr3] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*14*) + +ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN ASM_REWRITE_TAC[POWER] THEN STRIP_TAC +THEN MRESAL_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`SUC m`; `x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;` ((f1_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) POWER SUC m) (tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y:real^3#real^3#real^3#real^3)))`;`tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y:real^3#real^3#real^3#real^3)`;][POWER] +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM (fun th-> REWRITE_TAC[SYM th;tran])`x,(v':real^3),w',sigma_fan x V E v' w' = y` +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "NHO" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`x':real^3#real^3#real^3#real^3`] +THEN ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC THEN ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC THEN MP_TAC th THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;face] THEN REPEAT STRIP_TAC) +) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;] THEN REPEAT STRIP_TAC) +THEN ASM_MESON_TAC[]](*14*)](*13*)](*12*)](*11*)](*10*)](*9*)] + +(*8*)](*7*)](*6*)](*5*)](*4*);(*3*) + +ASM_REWRITE_TAC[] +THEN MRESAL_TAC unique_tranf_fan +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +; `(face (hypermap1_of_fanx (x:real^3,V:real^3->bool,E)) (y:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3->bool` +;`(f:real^3#real^3#real^3#real^3->bool)` +;`(y:real^3#real^3#real^3#real^3)`;][face] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;tran;face]) +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THENL(*4*)[ +REWRITE_TAC[orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[POWER;I_DEF;ARITH_RULE`0>=0`];(*4*) + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM;face_set;set_of_orbits] +THEN EXISTS_TAC`x''':real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] + +]]]]);; + + +let DOMAIN_TRANF_FACE_DELETE_DS=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds + ==> tranf x V E E1 ds0 IN + face_set (hypermap1_of_fanx (x,V,E1)) DELETE ds1 DELETE ds2`, + + +REWRITE_TAC[DELETE;IN_ELIM_THM;] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN DISCH_THEN(LABEL_TAC"LINK") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESAL_TAC TRANF[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0:real^3#real^3#real^3#real^3->bool` ][DELETE;IN_ELIM_THM] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`y IN ds0/\ ds0 SUBSET d1_fan (x:real^3,V,E)==> y IN d1_fan (x,V,E)`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC (SYM th) THEN DISCH_THEN(LABEL_TAC"NHO")) +THEN ASSUME_TAC th) +THEN MP_TAC(SET_RULE`{v', w'} IN E /\ E UNION {{v, w}} = E1==> {v', w':real^3} IN E1 /\ {v, w:real^3} IN E1`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THENL(*1*)[ + +REWRITE_TAC[face_set;face;IN_ELIM_THM;set_of_orbits] +THEN EXISTS_TAC`(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))` +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "NHO"(fun th-> REWRITE_TAC[SYM th;tran;d1_fan;IN_ELIM_THM]) +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v':real^3` +THEN EXISTS_TAC`w':real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v' (w':real^3)` +THEN ASM_REWRITE_TAC[];(*1*) + +REMOVE_THEN "LINH" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`(x,v,w,sigma_fan x V E1 v w) IN face (hypermap1_of_fanx (x,V,E1)) (tran x V E1 (y:real^3#real^3#real^3#real^3))` ASSUME_TAC +THENL(*2*)[ +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`ds1 = face (hypermap1_of_fanx (x,V,E1)) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`face (hypermap1_of_fanx (x,V,E1)) ((x:real^3),v,w,sigma_fan x V E1 v w) = ds1` +THEN REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF];(*2*) + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`tran x V E1 (y:real^3#real^3#real^3#real^3) IN d1_fan (x:real^3,V,E1)` ASSUME_TAC +THENL(*3*)[ + +REMOVE_THEN "NHO" (fun th-> REWRITE_TAC[SYM th;tran;d1_fan;IN_ELIM_THM]) +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v':real^3` +THEN EXISTS_TAC`w':real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v' w':real^3` +THEN ASM_REWRITE_TAC[];(*3*) + +MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`n:num`;`( \ t. res (t (x:real^3) V E1 ) (d1_fan (x:real^3, V:real^3->bool, (E1:(real^3->bool)->bool))))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`) +THEN DISJ_CASES_TAC(ARITH_RULE`n=0\/ n=1\/ n:num>1`) +THENL(*4*)[ + +REMOVE_THEN"NHO"(fun th-> ASM_REWRITE_TAC[SYM th;tran;POWER;I_DEF;EQ_PAIR_4]) +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN FIND_ASSUM MP_TAC`{v':real^3, w'} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*4*) + +POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`x,v,w,sigma_fan x V E1 v w= f1_fan x V E1 (x,sigma_fan x V E1 v w,v, sigma_fan x V E1 (sigma_fan x V E1 v w) v )` ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[f1_fan;EQ_PAIR_4] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`);(*5*) + +SUBGOAL_THEN`x,sigma_fan x V E1 v w,v,sigma_fan x V E1 (sigma_fan x V E1 v w) v IN + d1_fan (x,V,E1)` ASSUME_TAC +THENL(*6*)[ +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 (sigma_fan x V E1 v w ) v :real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` sigma_fan x V E1 v (w:real^3)`; +`v:real^3`];(*6*) + + +SUBGOAL_THEN `f1= f1_fan x V E (x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v)` ASSUME_TAC +THENL(*7*)[ + +REWRITE_TAC[f1_fan;EQ_PAIR_4] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`) +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f1:real^3#real^3#real^3#real^3`;`(x,v,u,sigma_fan x V E v u):real^3#real^3#real^3#real^3`;][pr2;pr3] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u :real^3` +THEN ASM_REWRITE_TAC[];(*7*) + +SUBGOAL_THEN`x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v IN + d1_fan (x,V,E)` ASSUME_TAC +THENL(*8*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E (sigma_fan x V E v u ) v :real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` sigma_fan x V E v (u:real^3)`;`v:real^3`];(*8*) + + +MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f1:real^3#real^3#real^3#real^3`;`(x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v):real^3#real^3#real^3#real^3`;] +THEN STRIP_TAC +THENL(*9*)[ + +ASM_REWRITE_TAC[POWER_1] +THEN STRIP_TAC +THEN MRESA_TAC MONO_F1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(x:real^3,sigma_fan x V E1 v w,v,sigma_fan x V E1 (sigma_fan x V E1 v w) v)`;`(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`]) +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "NHO"(fun th-> ASM_REWRITE_TAC[SYM th;tran;EQ_PAIR_4] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"NHO" )) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_THEN"NHO" MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;` (y:real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`;` (y:real^3#real^3#real^3#real^3)`];(*9*) + +SUBGOAL_THEN`?m. n=SUC (SUC m)/\ m>=0`ASSUME_TAC +THENL(*10*)[ +EXISTS_TAC`n-2:num` +THEN REWRITE_TAC[ARITH_RULE`SUC n= n+1`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC;(*10*) + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[COM_POWER] +THEN REWRITE_TAC[o_DEF] +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`SUC m:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`) +THEN MRESA_TAC MONO_F1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(x:real^3,sigma_fan x V E1 v w,v,sigma_fan x V E1 (sigma_fan x V E1 v w) v)`;`(f1_fan x V E1 POWER SUC m) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`]) +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC`y1=(x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v)` +THEN DISJ_CASES_TAC(SET_RULE`~((y:real^3#real^3#real^3#real^3) IN ds)\/ y IN ds`) +THENL(*11*)[ + +SUBGOAL_THEN`!m'. m' < SUC m==> ~((f1_fan (x:real^3) V E POWER m') y=y1) /\ ~((f1_fan (x:real^3) V E POWER m') y=f2)` ASSUME_TAC + +THENL(*12*)[ +REPEAT STRIP_TAC +THENL(*13*)[ + +MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`m':num`; `x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y1:real^3#real^3#real^3#real^3`;` y:real^3#real^3#real^3#real^3`;];(*13*) + +MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`m':num`; `x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f2:real^3#real^3#real^3#real^3`;` y:real^3#real^3#real^3#real^3`;](*13*)];(*12*) + + + + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN SUBGOAL_THEN`!m'. m' < SUC m + ==> (~(pr2 ((f1_fan x V E POWER m') y) = sigma_fan x V E v u) /\ + pr3 ((f1_fan x V E POWER m') y) = v) \/ + (~(pr2 ((f1_fan x V E POWER m') y) = u) /\ + pr3 ((f1_fan x V E POWER m') y) = w) \/ +~(pr3 ((f1_fan x V E POWER m') y) IN {v, w})` ASSUME_TAC +THENL(*13*)[ +REPEAT STRIP_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th`m':num`) +THEN MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`SUC m`; `x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y1:real^3#real^3#real^3#real^3`;` y:real^3#real^3#real^3#real^3`;] +THEN MP_TAC(SET_RULE`f1_fan x V E (f1_fan x V E y1) IN ds /\ (f1_fan x V E POWER m') y IN ds0/\ ds SUBSET d1_fan (x,V,E) /\ ds0 SUBSET d1_fan (x,V,E)==> (f1_fan x V E POWER m') y IN d1_fan (x:real^3,V,E) /\ f1_fan x V E (f1_fan x V E y1) IN d1_fan (x:real^3,V,E)`) +THEN FIND_ASSUM (fun th->REWRITE_TAC[SYM th])`f1 = f1_fan x V E (y1:real^3#real^3#real^3#real^3)` +THEN MRESA_TAC condition_f1_fan_power_in_face_set[`m':num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3` ;` y:real^3#real^3#real^3#real^3`;`ds0:real^3#real^3#real^3#real^3->bool`] +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`y1:real^3#real^3#real^3#real^3`][PAIR_EQ] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[pr2;pr3] +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`][PAIR_EQ;pr2;pr3] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*13*) + +MRESA_TAC TRAN_COMMUTATIVE_F1_FAN_POWER3 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`;`SUC m:num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`(x,sigma_fan x V E1 v w,v,sigma_fan x V E1 (sigma_fan x V E1 v w) v)=tran x V E1 (y1:real^3#real^3#real^3#real^3)`ASSUME_TAC +THENL(*14*)[ + +EXPAND_TAC"y1" +THEN REWRITE_TAC[tran] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ];(*14*) + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC condition_f1_fan_power_in_face_set[`SUC m:num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER (SUC m)) y):real^3#real^3#real^3#real^3` ;` y:real^3#real^3#real^3#real^3`;`ds0:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE` (f1_fan x V E POWER (SUC m)) y IN ds0 /\ ds0 SUBSET d1_fan (x,V,E)/\ E UNION {{v, w}} = E1 ==> (f1_fan x V E POWER (SUC m)) y IN d1_fan (x:real^3,V,E) /\ E SUBSET E1`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC INJ_TRAN_D1_FAN +[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(E1:(real^3->bool)->bool)`; +`y1:real^3#real^3#real^3#real^3`;`(f1_fan x V E POWER (SUC m)) (y:real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`SUC m`; `x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y1:real^3#real^3#real^3#real^3`;` y:real^3#real^3#real^3#real^3`;]](*14*)](*13*)](*12*);(*11*) + + +MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;` (y:real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`;` (y:real^3#real^3#real^3#real^3)`]](*11*)](*10*)](*9*)](*8*)](*7*)](*6*)](*5*)](*4*)](*3*)](*2*);(*1*) + +REMOVE_THEN "LINH" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3) IN ds2` ASSUME_TAC +THENL(*2*)[ + +ASM_REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0 >=0 `;POWER;I_DEF];(*2*) +POP_ASSUM MP_TAC +THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3) IN {f10, (f20:real^3#real^3#real^3#real^3), f30}==> tran x V E1 y =f10 \/ tran x V E1 y =f20 \/ tran x V E1 y = f30`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*3*)[ +POP_ASSUM MP_TAC +THEN REMOVE_THEN"NHO"(fun th-> REWRITE_TAC[SYM th;tran]) +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;EQ_PAIR_4])`x,w,v,u = f10:real^3#real^3#real^3#real^3` +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN FIND_ASSUM MP_TAC`{w, v:real^3} IN E` +THEN FIND_ASSUM MP_TAC`~({w, v:real^3} IN E)` +THEN SET_TAC[];(*3*) + +POP_ASSUM MP_TAC +THEN REMOVE_THEN"NHO"(fun th-> REWRITE_TAC[SYM th;tran]THEN ASSUME_TAC (SYM(th))) +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;EQ_PAIR_4])`x,v,u,w = f20:real^3#real^3#real^3#real^3` +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN SUBGOAL_THEN `f1=y:real^3#real^3#real^3#real^3`ASSUME_TAC +THENL(*4*)[ +ASM_REWRITE_TAC[] +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f1:real^3#real^3#real^3#real^3`;`(x,v,u,sigma_fan x V E v u):real^3#real^3#real^3#real^3`;][pr2;pr3] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u :real^3` +THEN ASM_REWRITE_TAC[];(*4*) + + +MP_TAC(SET_RULE`f1=y /\ f1 IN ds ==> (y:real^3#real^3#real^3#real^3) IN ds`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;` (y:real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`;` (y:real^3#real^3#real^3#real^3)`]](*4*);(*3*) + +POP_ASSUM MP_TAC +THEN REMOVE_THEN"NHO"(fun th-> REWRITE_TAC[SYM th;tran]THEN ASSUME_TAC (SYM(th))) +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;EQ_PAIR_4])`x,u,w,v = f30:real^3#real^3#real^3#real^3` +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN SUBGOAL_THEN `f2=y:real^3#real^3#real^3#real^3`ASSUME_TAC +THENL(*4*)[ +ASM_REWRITE_TAC[] +THEN MRESA_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f2:real^3#real^3#real^3#real^3`;`(x,u,w,w1):real^3#real^3#real^3#real^3`;] +THEN POP_ASSUM MATCH_MP_TAC +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3])`x,u,w,v = f30:real^3#real^3#real^3#real^3` +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v :real^3` +THEN ASM_REWRITE_TAC[];(*4*) + +MP_TAC(SET_RULE`f2=y /\ f2 IN ds ==> (y:real^3#real^3#real^3#real^3) IN ds`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;` (y:real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`;` (y:real^3#real^3#real^3#real^3)`]]]]]);; + + + +let EQ_CARD_FACE_FAN_AND_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> CARD ((face_set (hypermap1_of_fanx (x,V,E1)) DELETE ds1 ) DELETE ds2 )= CARD (face_set (hypermap1_of_fanx (x,V,E)) DELETE ds) `, + +REPEAT STRIP_TAC +THEN MATCH_MP_TAC CARD_IMAGE_INJ_EQ +THEN EXISTS_TAC`tranf (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (E1:(real^3->bool)->bool):(real^3#real^3#real^3#real^3->bool)->real^3#real^3#real^3#real^3->bool` +THEN MRESAL1_TAC FINITE_HYPERMAP_ORBITS`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`[FINITE_DELETE;EXISTS_UNIQUE] +THEN STRIP_TAC +THENL[ +REPEAT STRIP_TAC +THEN MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(x':real^3#real^3#real^3#real^3->bool)`;]; + +REPEAT STRIP_TAC +THEN MRESA_TAC SUR_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3->bool)`;] +THEN EXISTS_TAC`ds0:real^3#real^3#real^3#real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC INJ_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y':real^3#real^3#real^3#real^3->bool)`;`(ds0:real^3#real^3#real^3#real^3->bool)`]]);; + + + + + +let CARD_DART_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ~(v=w) +/\ E UNION {{v,w}}=E1 +==> +CARD (dart (hypermap1_of_fanx (x,V,E1))) += CARD (dart (hypermap1_of_fanx (x,V,E))) +2`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESAL_TAC card_eq_image_in_d_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`; +`d1_fan (x,V,E1):real^3#real^3#real^3#real^3->bool`][SET_RULE`d1_fan (x,V,E1) SUBSET d1_fan (x,V,E1)`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC card_eq_image_in_d_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`; +`d1_fan (x,V,E):real^3#real^3#real^3#real^3->bool`][SET_RULE`d1_fan (x,V,E) SUBSET d1_fan (x,V,E)`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC DART_FANADD_EQ_DART_FAN_ADD_2DART[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC finite_d1_fan[`x:real^3`;` V:real^3->bool`;` (E:(real^3->bool)->bool)`] +THEN MRESA_TAC FINITE_IMAGE[`pr23:real^3#real^3#real^3#real^3->real^3#real^3`;`(d1_fan ((x:real^3),V,E))`] +THEN MRESA_TAC CARD_UNION[`IMAGE pr23 (d1_fan ((x:real^3),V,E))`;`{(v,w), (w,(v:real^3))}`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY;PAIR_EQ;SET_RULE`v = w /\ w = v <=> v=w`;ARITH_RULE`SUC(SUC 0)=2`] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[EXTENSION;INTER;IN_ELIM_THM;NOT_IN_EMPTY;PR23_OF_D1_FAN;SET_RULE`x' IN {(v,w), (w,v)} +<=> x'=(v,w) \/ x'=(w,v)`] +THEN GEN_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PAIR_EQ] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]);; + + +let ZSZIUQE_LEMMA=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> N_FAN (x,V,E1)< N_FAN(x,V,E)`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REWRITE_TAC[N_FAN] +THEN MRESA1_TAC FINITE_HYPERMAP_ORBITS`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)` +THEN MRESA1_TAC FINITE_HYPERMAP_ORBITS`hypermap1_of_fanx (x:real^3,V:real^3->bool,E1)` +THEN MRESA_TAC NSUM_CONST[`3:num`;`(face_set (hypermap1_of_fanx ((x:real^3),V,E1)))`] +THEN MRESA_TAC NSUM_CONST[`3:num`;`(face_set (hypermap1_of_fanx ((x:real^3),V,E)))`] +THEN SUBGOAL_THEN`!y. y IN (face_set (hypermap1_of_fanx ((x:real^3),V,E1)))==> (\x. CARD x - 3 + 3) y=(\x. CARD x ) y` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`y:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +SUBGOAL_THEN`!y. y IN (face_set (hypermap1_of_fanx ((x:real^3),V,E)))==> (\x. CARD x - 3 + 3) y=(\x. CARD x ) y` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`y:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MP_TAC(SET_RULE` E UNION {{v,w:real^3}}= E1 +==> {v,w} IN E1`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC NSUM_EQ[`(\(f:real^3#real^3#real^3#real^3->bool). CARD f - 3+3)`;`(\(f:real^3#real^3#real^3#real^3->bool). CARD f)`;`(face_set (hypermap1_of_fanx ((x:real^3),V,E1)))`] +THEN MRESA_TAC NSUM_EQ[`(\(f:real^3#real^3#real^3#real^3->bool). CARD f - 3+3)`;`(\(f:real^3#real^3#real^3#real^3->bool). CARD f)`;`(face_set (hypermap1_of_fanx ((x:real^3),V,E)))`] +THEN MRESA_TAC finite_d1_fan[`x:real^3`;` V:real^3->bool`;` (E1:(real^3->bool)->bool)`] +THEN MRESA_TAC finite_d1_fan[`x:real^3`;` V:real^3->bool`;` (E:(real^3->bool)->bool)`] +THEN MRESA_TAC AAUHTVE[`x:real^3`;` V:real^3->bool`;` (E:(real^3->bool)->bool)`;`( \ t. res (t x V E ) (d1_fan (x:real^3,V,E)) )`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC AAUHTVE[`x:real^3`;` V:real^3->bool`;` (E1:(real^3->bool)->bool)`;`( \ t. res (t x V E1 ) (d1_fan (x:real^3,V,E1)) )`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC card_partition_formula[`dart (hypermap1_of_fanx (x:real^3,V,E1))`;`face_map (hypermap1_of_fanx (x:real^3,V,E1))`] +THEN MRESA_TAC NSUM_ADD[`(\(f:real^3#real^3#real^3#real^3->bool). CARD f - 3)`;`(\(f:real^3#real^3#real^3#real^3->bool). 3)`;`(face_set (hypermap1_of_fanx ((x:real^3),V,E1)))`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[face_set] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC card_partition_formula[`dart (hypermap1_of_fanx (x:real^3,V,E))`;`face_map (hypermap1_of_fanx (x:real^3,V,E))`] +THEN MRESA_TAC NSUM_ADD[`(\(f:real^3#real^3#real^3#real^3->bool). CARD f - 3)`;`(\(f:real^3#real^3#real^3#real^3->bool). 3)`;`(face_set (hypermap1_of_fanx ((x:real^3),V,E)))`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[face_set] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC CARD_DART_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC EQ_CARD_FACE_FAN_AND_FANADD +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC CARD_MINUS_ONE[`(face_set (hypermap1_of_fanx ((x:real^3),V,E)))`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC CARD_MINUS_ONE[`(face_set (hypermap1_of_fanx ((x:real^3),V,E1)))`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN SUBGOAL_THEN `ds2 IN (face_set (hypermap1_of_fanx ((x:real^3),V,E1))) DELETE (ds1:real^3#real^3#real^3#real^3->bool)`ASSUME_TAC +THENL[ +REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC disjoint_ds1_and_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]; +MRESAL_TAC CARD_MINUS_ONE[`(face_set (hypermap1_of_fanx ((x:real^3),V,E1))) DELETE (ds1:real^3#real^3#real^3#real^3->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`][FINITE_DELETE] +THEN ARITH_TAC]]]);; + + +let ZSZIUQE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> ~(ds1= ds2)/\ CARD ds2=3 /\ ds2={f10,f20,f30} /\ N_FAN (x,V,E1)< N_FAN(x,V,E)`, +REPEAT STRIP_TAC +THENL[ +POP_ASSUM MP_TAC +THEN MRESA_TAC disjoint_ds1_and_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]; +MRESA_TAC card_ds2_fanadd_eq3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]; +MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]; +MRESA_TAC ZSZIUQE_LEMMA[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]]);; + + +let FAN80_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> fan80(x,V,E1)`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN REPEAT GEN_TAC +THEN FIND_ASSUM (fun th-> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM th] THEN REWRITE_TAC[IN_ELIM_THM;UNION;IN_SING])`E UNION {{v, w:real^3}} = E1` +THEN STRIP_TAC +THENL(*1*)[ +FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v':real^3`;`u':real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"NHOLINH")) +THEN DISJ_CASES_TAC(SET_RULE` +~(v' IN {v, w:real^3})\/ (v'=v/\ u'=u)\/ (v'=v/\ ~(u'=u))\/ (v'=w/\ u'= inverse1_sigma_fan x V E w u)\/ (v'=w/\ ~(u'=inverse1_sigma_fan x V E w u))`) +THENL(*2*)[ + MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v':real^3`;`u':real^3`] );(*2*) + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL(*3*)(*4GOAL*)[ + +ASM_REWRITE_TAC[] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MATCH_MP_TAC properties_of_fully_surrounded1_fan +THEN REMOVE_THEN "NHOLINH"(fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`];(*3*) + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT4[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ;`u':real^3`];(*3*) + + +ASM_REWRITE_TAC[] +THEN REMOVE_THEN "NHOLINH"(fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"NHOLINH")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT6[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ;`u':real^3`] +THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w (inverse1_sigma_fan x V E w u) u +==> +azim x w v u <= azim x w (inverse1_sigma_fan x V E w u) (u:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (inverse1_sigma_fan x V E w u:real^3)`; +`(w:real^3)`] +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u) u = + azim x w (inverse1_sigma_fan x V E w u) v + azim x w v u +/\ &0<= azim x w v u +==> azim x w (inverse1_sigma_fan x V E w u) v<=azim x w (inverse1_sigma_fan x V E w u) u +`) +THEN ASM_SIMP_TAC[azim] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN MP_TAC (SYM th) THEN DISCH_THEN(LABEL_TAC"YEUEMLINH")) +THEN REMOVE_THEN "NHOLINH"(fun th-> MRESA_TAC th[`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`] ) +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH` +azim x w (inverse1_sigma_fan x V E w u) v <= + azim x w (inverse1_sigma_fan x V E w u) u +/\ azim x w (inverse1_sigma_fan x V E w u) u < pi +==> azim x w (inverse1_sigma_fan x V E w u) (v:real^3) < pi`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u) u = + azim x w (inverse1_sigma_fan x V E w u) v + azim x w v u +/\ azim x w v u < azim x w (inverse1_sigma_fan x V E w u) u +==> &0 < azim x w (inverse1_sigma_fan x V E w u) v +`) +THEN ASM_REWRITE_TAC[];(*3*) +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT5[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ;`u':real^3`]](*3*)](*2*);(*1*) + + + +MP_TAC(SET_RULE`{v', u':real^3} = {v, w}==> (v'=v /\ u'=w) \/ (v'=w /\ u'=v)`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL[ +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ;] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"NHOLINH")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESAL_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][DE_MORGAN_THM;] +THEN MRESA_TAC angle_is_small_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w:real^3`] +THEN ABBREV_TAC`u1=sigma_fan x V E v u` +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u1:real^3)`; +`(v:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`u1:real^3`] +THEN REMOVE_THEN "NHOLINH"(fun th-> MRESA_TAC th[`v:real^3`;`u:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"NHOLINH")) +THEN MP_TAC(REAL_ARITH` azim x v u w + azim x v w u1< pi/\ &0 <= azim x v u w /\ &0 <= azim x v w u1 +==> azim x v w (u1:real^3) azim x v w u1 = &0\/ &0{v, w} IN E1 /\ {v, u1} IN E1`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC UNIQUE_AZIM_0_POINT_FAN[`(x:real^3)`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`(v:real^3)`;`(w:real^3)`;`u1:real^3`] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC) +THEN FIND_ASSUM MP_TAC`{v,w:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]; +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ;] +THEN MRESA_TAC condition_azim_le_pi[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`]]]);; + + + + + + +let FANADD_CONFORMING=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> +conforming_fan (x,V,E1)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(E1:(real^3->bool)->bool)`) +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC ZSZIUQE_LEMMA[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]);; + + + + +let dartset_leads_in_fanadd_topological_component_yfan =prove( `!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds +==> dartset_leads_into_fan x V E1 (tranf x V E E1 ds0) IN topological_component_yfan (x,V,E1)`, +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(ds0:real^3#real^3#real^3#real^3->bool)`;] +THEN MP_TAC(SET_RULE`tranf (x:real^3) V (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool) IN face_set (hypermap1_of_fanx (x,V,E1)) DELETE ds1 DELETE ds2 +==> tranf (x:real^3) V E E1 (ds0:real^3#real^3#real^3#real^3->bool) IN face_set (hypermap1_of_fanx ((x:real^3),V,E1))`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`tranf (x:real^3) V (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool)`]);; + + + + + +let INVARANT_SIGMA_FAN_ADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ~(y IN ds) +/\ y IN d_fan(x,V,E) +==> +sigma_fan x V E1 (pr2(y)) (pr3(y))= sigma_fan x V E (pr2(y)) (pr3(y))`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC THEN MP_TAC th THEN ASM_REWRITE_TAC[] THEN STRIP_TAC) +THEN ASM_REWRITE_TAC[pr2;pr3] +THEN DISJ_CASES_TAC(SET_RULE` +~(v' IN {v, w:real^3})\/ (v'=v/\ w'=u)\/ (v'=v/\ ~(w'=u))\/ (v'=w/\ w'= inverse1_sigma_fan x V E w u)\/ (v'=w/\ ~(w'=inverse1_sigma_fan x V E w u))`) +THENL[ + MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v':real^3`;`w':real^3`] );(*1*) + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL[ +SUBGOAL_THEN`y= f1:real^3#real^3#real^3#real^3`ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[pr3;pr2] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); +MP_TAC(SET_RULE`y=(f1:real^3#real^3#real^3#real^3) /\ f1 IN ds ==> y IN ds`) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT4[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ;`w':real^3`]; + + +SUBGOAL_THEN`y=f3:real^3#real^3#real^3#real^3`ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]; +MP_TAC(SET_RULE`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3 +==> f1_fan x V E f2= f1_fan x V E (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN REWRITE_TAC[pr2;pr3]) + THEN STRIP_TAC +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;])`f1_fan x V E (f2:real^3#real^3#real^3#real^3) = (f3:real^3#real^3#real^3#real^3)` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;f1_fan]) +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[]]; + +MP_TAC(SET_RULE`y=(f3:real^3#real^3#real^3#real^3) /\ f3 IN ds ==> y IN ds`) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT5[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ;`w':real^3`]]]);; + + + + +let lemma_yfanadd_aff_ge=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> yfan(x,V,E) SUBSET yfan(x,V,E1) UNION aff_ge {x} {v, w}`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[yfan;XFAN_EQ_UNIONS_AFF_GE_1_2;] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIFF;UNION;UNIONS;IN_ELIM_THM;GSYM FORALL_NOT_THM;IN_SING;DE_MORGAN_THM;SUBSET]) +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[SET_RULE`x' IN (:real^3)`] +THEN DISJ_CASES_TAC(SET_RULE`~(x' IN aff_ge {x} {v, w:real^3})\/ (x' IN aff_ge {x} {v, w:real^3})`) +THENL[ +ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC `u':real^3->bool`th)) +THEN DISJ_CASES_TAC(SET_RULE`~(x' IN (u':real^3->bool))\/ (x' IN (u':real^3->bool))`) +THENL[ +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(e = {v, w})\/ (e = {v, w:real^3})`) +THENL[ + +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CONTRAPOS_THM] +THEN STRIP_TAC THEN +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN ASM_REWRITE_TAC[]]]; + +ASM_REWRITE_TAC[]]);; + + + +let lemma_yfanadd_aff_gt= prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> yfan(x,V,E) SUBSET yfan(x,V,E1) UNION aff_gt {x} {v, w}`, + + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`; +` (w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC lemma_yfanadd_aff_ge[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN SUBGOAL_THEN`aff_ge {x} {w} SUBSET xfan(x:real^3,V:real^3->bool,E)` ASSUME_TAC +THENL[ +REWRITE_TAC[xfan;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC exists_edge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` w:real^3`] +THEN EXISTS_TAC `{w,v'}:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v':real^3)`; +` (w:real^3)`] +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(w:real^3)`;` (v':real^3)`] +THEN ASM_TAC THEN SET_TAC[IN]; +SUBGOAL_THEN`aff_ge {x} {v} SUBSET xfan(x:real^3,V:real^3->bool,E)` ASSUME_TAC +THENL[ +REWRITE_TAC[xfan;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC exists_edge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`] +THEN EXISTS_TAC `{v,v'}:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v':real^3)`; +` (v:real^3)`] +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;` (v':real^3)`] +THEN ASM_TAC THEN SET_TAC[IN]; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan;SUBSET;UNION;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `x':real^3` th)) +THEN REWRITE_TAC[th] +THEN ASSUME_TAC th) +THEN STRIP_TAC +THENL[ + +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[]; + +REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `x':real^3` th)) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + + +STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `x':real^3` th)) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]]]);; + + + + + +let lemma_yfanadd_aff_gt1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> yfan(x,V,E1) SUBSET yfan(x,V,E)`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[yfan;XFAN_EQ_UNIONS_AFF_GE_1_2] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;IN_ELIM_THM;IN_SING;UNION]) +THEN SET_TAC[]);; + + + + +let YFANADD_AFF_GT=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> yfan(x,V,E) = yfan(x,V,E1) UNION aff_gt {x} {v, w}`, + +REPEAT STRIP_TAC +THEN MRESA_TAC lemma_yfanadd_aff_gt[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC lemma_yfanadd_aff_gt1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC condition_aff_gt_subset_yfan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v:real^3`;`u:real^3`;`w:real^3`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + + + + +let dartset_leads_into_fanadd1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> dartset_leads_into_fan x V E1 ds1 SUBSET dartset_leads_into_fan x V E ds`, + + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN ABBREV_TAC`y=(x,sigma_fan x V E v u,v:real^3,sigma_fan x V E (sigma_fan x V E v u) v )` +THEN SUBGOAL_THEN `f1=f1_fan x V E (y:real^3#real^3#real^3#real^3)` ASSUME_TAC +THENL(*1*)[ +POP_ASSUM(fun th-> REWRITE_TAC[SYM th;f1_fan;EQ_PAIR_4]) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`) +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f1:real^3#real^3#real^3#real^3`;`(x,v,u,sigma_fan x V E v u):real^3#real^3#real^3#real^3`;][pr2;pr3] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u :real^3` +THEN ASM_REWRITE_TAC[];(*1*) + +SUBGOAL_THEN`x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v IN + d1_fan (x:real^3,V,E)` ASSUME_TAC +THENL(*2*)[ +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E (sigma_fan x V E v u ) v :real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` sigma_fan x V E v (u:real^3)`;`v:real^3`];(*2*) +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f1:real^3#real^3#real^3#real^3`;`(x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v):real^3#real^3#real^3#real^3`;] +THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN SUBGOAL_THEN `(x,v,w,sigma_fan x V E1 v w)=f1_fan x V E1 (y:real^3#real^3#real^3#real^3)` ASSUME_TAC +THENL(*3*)[ +EXPAND_TAC"y" +THEN REWRITE_TAC[f1_fan;EQ_PAIR_4] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC(SET_RULE`E UNION {{v, w:real^3}} = E1==>{v, w}IN E1`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`v:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`);(*3*) + +SUBGOAL_THEN`x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v IN + d1_fan (x:real^3,V,E1)` ASSUME_TAC +THENL(*4*)[ +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E (sigma_fan x V E v u ) v :real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` sigma_fan x V E v (u:real^3)`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MP_TAC(SET_RULE`E UNION {{v, w:real^3}} = E1 /\ {v, sigma_fan x V E v u} IN E ==> {v, sigma_fan x V E v u} IN E1`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`sigma_fan x V E v u:real^3`;`v:real^3`][SET_RULE`~(A IN {B,C}) <=> ~(A=B)/\ ~(C=A)`]) +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(sigma_fan x V E v u = w:real^3) \/ ~(sigma_fan x V E v u = w)`) +THENL(*5*)[ +POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN FIND_ASSUM MP_TAC`{v, w:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*5*) + +ASM_REWRITE_TAC[] +THEN RESA_TAC](*5*);(*4*) + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN SUBGOAL_THEN`x,v,w,sigma_fan x V E1 v w IN ds1:real^3#real^3#real^3#real^3->bool`ASSUME_TAC +THENL(*5*)[ +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;face;orbit_map;IN_ELIM_THM])`face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) = ds1:real^3#real^3#real^3#real^3->bool` +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF];(*5*) + + MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`;`(x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v):real^3#real^3#real^3#real^3`;] +THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`; +`ds1:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN FIND_ASSUM MP_TAC `(y:real^3#real^3#real^3#real^3) IN d1_fan (x,V,E)` +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr2;pr3] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC DART_LEADS_INTO [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN MP_TAC(SET_RULE`{v', w'} IN E /\ E UNION {{v, w}} = E1 ==> {v':real^3, w'} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC DART_LEADS_INTO [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN MP_TAC(REAL_ARITH`&0 &0< (min (min (h:real) (h':real)) (pi/ &2))/ &2 /\ (min (min (h:real) (h':real)) (pi/ &2))/ &2 < (pi/ &2) /\ (min (min (h:real) (h':real)) (pi/ &2))/ &2< h /\ (min (min (h:real) (h':real)) (pi/ &2))/ &2< h'`) +THEN ASM_REWRITE_TAC[PI_WORKS;] +THEN STRIP_TAC +THEN MRESA_TAC not_empty_rw_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(min (min (h:real) (h':real)) (pi/ &2))/ &2`[SET_RULE`~(A={})<=> ?y. y IN A`]) +THEN SUBGOAL_THEN`y' IN + rw_dart_fan x V E1 (x,v',w',sigma_fan x V E1 v' w') + (cos (min (min h h') (pi / &2) / &2))` +ASSUME_TAC +THENL(*6*)[ +POP_ASSUM MP_TAC +THEN + MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w':real^3)`; +`(v':real^3)`] +THEN FIND_ASSUM MP_TAC`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E1) > 1)` +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `v':real^3`th) +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN STRIP_TAC THEN ASSUME_TAC th)) +THEN FIND_ASSUM MP_TAC`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)` +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `v':real^3`th) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN STRIP_TAC THEN ASSUME_TAC th)) +THEN ASM_REWRITE_TAC[rw_dart_fan;w_dart_fan] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`v':real^3`;`w':real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[SET_RULE`~(v' IN {v, w}) <=> ~(v =v') /\ ~(v' = w)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (sigma_fan x V E v u:real^3)`;`(v:real^3)`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN REMOVE_THEN "EM" (fun th-> MP_TAC th THEN ASSUME_TAC(th)) +THEN EXPAND_TAC"y" +THEN REWRITE_TAC[EQ_PAIR_4] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`~(v:real^3 = sigma_fan x V E v u)` +THEN DISJ_CASES_TAC(SET_RULE`(sigma_fan x V E v u = w:real^3) \/ ~(sigma_fan x V E v u = w)`) +THENL(*7*)[ +POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN FIND_ASSUM MP_TAC`{v, w:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`~({w, v:real^3} IN E)`;(*7*) +POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[]](*7*);(*6*) + +REMOVE_THEN"LINH"(fun th-> MRESA_TAC th[`(min (min (h:real) (h':real)) (pi/ &2))/ &2`;`y':real^3`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_THEN"LINH1"(fun th-> MRESA_TAC th[`(min (min (h:real) (h':real)) (pi/ &2))/ &2`;`y':real^3`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC CONNECTED_COMPONENT_MONO[`yfan (x:real^3,(V:real^3->bool),E1)`;`(yfan (x:real^3,(V:real^3->bool),E1) UNION aff_gt {x} {v:real^3, w})`;`y':real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN SET_TAC[]]]]]]]);; + + + + + +let dartset_leads_into_fanadd2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> dartset_leads_into_fan x V E1 ds2 SUBSET dartset_leads_into_fan x V E ds`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `f2:real^3#real^3#real^3#real^3`) +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MP_TAC(SET_RULE`ds2 = {(f10:real^3#real^3#real^3#real^3), f20, f30}==> f30 IN ds2`) +THEN RESA_TAC +THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`; +`ds2:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `f30:real^3#real^3#real^3#real^3`) +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3])`x,u,w,v = f30:real^3#real^3#real^3#real^3` +THEN MRESA_TAC DART_LEADS_INTO [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN MP_TAC(SET_RULE`{u, w} IN E /\ E UNION {{v, w}} = E1 ==> {u:real^3, w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC DART_LEADS_INTO [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN MP_TAC(REAL_ARITH`&0 &0< (min (min (h:real) (h':real)) (pi/ &2))/ &2 /\ (min (min (h:real) (h':real)) (pi/ &2))/ &2 < (pi/ &2) /\ (min (min (h:real) (h':real)) (pi/ &2))/ &2< h /\ (min (min (h:real) (h':real)) (pi/ &2))/ &2< h'`) +THEN ASM_REWRITE_TAC[PI_WORKS;] +THEN STRIP_TAC +THEN MRESA_TAC not_empty_rw_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(min (min (h:real) (h':real)) (pi/ &2))/ &2`[SET_RULE`~(A={})<=> ?y. y IN A`]) +THEN SUBGOAL_THEN`y IN + rw_dart_fan x V E1 (x,u,w,sigma_fan x V E1 u w) + (cos (min (min h h') (pi / &2) / &2))` +ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC +THEN + MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] + +THEN FIND_ASSUM MP_TAC`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E1) > 1)` +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `u:real^3`th) +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN STRIP_TAC THEN ASSUME_TAC th)) +THEN FIND_ASSUM MP_TAC`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)` +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `u:real^3`th) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN STRIP_TAC THEN ASSUME_TAC th)) +THEN ASM_REWRITE_TAC[rw_dart_fan;w_dart_fan] +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;rw_dart_fan;w_dart_fan])`x,u,w,v = f30:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN + MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN ASM_REWRITE_TAC[SET_RULE`~(v' IN {v, w}) <=> ~(v =v') /\ ~(v' = w)`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[]; +REMOVE_THEN"LINH"(fun th-> MRESA_TAC th[`(min (min (h:real) (h':real)) (pi/ &2))/ &2`;`y:real^3`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_THEN"LINH1"(fun th-> MRESA_TAC th[`(min (min (h:real) (h':real)) (pi/ &2))/ &2`;`y:real^3`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC CONNECTED_COMPONENT_MONO[`yfan (x:real^3,(V:real^3->bool),E1)`;`(yfan (x:real^3,(V:real^3->bool),E1) UNION aff_gt {x} {v:real^3, w})`;`y:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN SET_TAC[]]);; + + + + + +let INTERS_HALF_SPACE_DS_FANADD1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U1. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN ds} =U1 +==> U1 INTER aff_gt {x, v, w} {u} SUBSET dartset_leads_into_fan x V E1 ds2`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[conforming_fan;conforming_half_space_fan] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`ds2:real^3#real^3#real^3#real^3->bool`) +THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN REWRITE_TAC[INTERS;IN_ELIM_THM;SUBSET] +THEN REMOVE_THEN "EM"(fun th-> REWRITE_TAC[SYM th;INTERS;IN_ELIM_THM;INTER]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] THEN ASSUME_TAC th THEN STRIP_TAC) +THEN MP_TAC(SET_RULE`y IN {f10, f20, f30:real^3#real^3#real^3#real^3}==> y =f10\/ y =f20\/ y =f30`) +THEN RESA_TAC + +THENL[ + +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3;f1_fan])`x,w,v,u = f10:real^3#real^3#real^3#real^3` +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]; + +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3;f1_fan])`x,v,u,w = f20:real^3#real^3#real^3#real^3` +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 /\ {v, u} IN E==> {v, u} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th `aff_gt {x:real^3, v, u} {w}`) +THEN POP_ASSUM MATCH_MP_TAC +THEN SUBGOAL_THEN `x,v,u,sigma_fan x V E v u IN d1_fan (x,V,E)` ASSUME_TAC +THENL[ +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN ASM_REWRITE_TAC[]; +MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f1:real^3#real^3#real^3#real^3`;`(x,v,u,sigma_fan x V E v u):real^3#real^3#real^3#real^3`;][pr2;pr3] +THEN EXISTS_TAC`(x,v,u:real^3, sigma_fan x (V:real^3->bool) E v u)` +THEN ASM_REWRITE_TAC[f1_fan] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`u:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`)]; + +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3;f1_fan])`x,u,w,v = f30:real^3#real^3#real^3#real^3` +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 /\ {u,w} IN E==> {u,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`) +THEN RESA_TAC +THEN RESA_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th `aff_gt {x:real^3, u,w} {v}`) +THEN POP_ASSUM MATCH_MP_TAC +THEN EXISTS_TAC`f2:real^3#real^3#real^3#real^3` +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]; + +MP_TAC(SET_RULE`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3 +==> f1_fan x V E f2= f1_fan x V E (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN REWRITE_TAC[pr2;pr3]) + THEN STRIP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[th;f1_fan]) +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`]]]);; + + + + + + +let inverse1_sigma_fan_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> inverse1_sigma_fan x V E1 w v = inverse1_sigma_fan x V E w u`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MATCH_MP_TAC MONO_SIGMA_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E1:(real^3->bool)->bool` +THEN EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{inverse1_sigma_fan x V E w u, w:real^3} IN E /\ E UNION {{v,w}}= E1 +==> {inverse1_sigma_fan x V E w u, w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT6[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ;`inverse1_sigma_fan x V E w u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC);; + + + +let aff_gt_eq_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> aff_gt {x, w, inverse1_sigma_fan x V E1 w v} {v} = aff_gt {x, w, inverse1_sigma_fan x V E w u} {u}`, + + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{w:real^3,inverse1_sigma_fan x V E w u } IN E /\ E UNION {{v,w}}= E1 +==> {w:real^3,inverse1_sigma_fan x V E w u} IN E1`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN RESA_TAC +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`;`v:real^3`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;`(v:real^3)`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`;`v:real^3`;`inverse1_sigma_fan x V E w u:real^3`; ] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`;`v :real^3`;] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x,V:real^3->bool,E)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`(u:real^3)`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC + +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`;`u:real^3`;`inverse1_sigma_fan x V E w u:real^3`; ] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`;`u :real^3`;]);; + + + +let f2_EQ_F30_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ f30=(x,u,w,v) +/\ E UNION {{v,w}}= E1 +==> f30= f2`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E)`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;pr2;pr3] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]));; + + + + + +let CONDITION_DART_IN_NODE=prove(`!x V E f y y1. FAN (x,V,E) +/\(!v. v IN V ==> CARD (set_of_edge v V E) > 1) +/\ f IN (node_set (hypermap1_of_fanx (x,V,E)) ) +/\ y IN f +/\ y1 IN d1_fan(x,V,E) +/\ pr2 y1= pr2 y +==> y1 IN f`, + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC node_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`;] +THEN MP_TAC(SET_RULE`y IN f /\ f SUBSET d1_fan (x,V,E)==> y IN d1_fan (x,V,E)`) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESAL_TAC rep_node_set_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`][pr2;pr3] +THEN RESA_TAC +THEN MRESA_TAC ORBITS_EQ_SET_EDGE_FAN[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w':real^3)`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[set_of_orbits_points_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[power_map_points ] +THEN ARITH_TAC);; + + + + + + + + + +let INTERS_HALF_SPACE_DS_FANADD2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN ds} =U1 +==> U1 INTER aff_gt {x, v, w} {sigma_fan x V E v u} SUBSET dartset_leads_into_fan x V E1 ds1`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[conforming_fan;conforming_half_space_fan] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`ds1:real^3#real^3#real^3#real^3->bool`) +THEN REWRITE_TAC[INTERS;IN_ELIM_THM;SUBSET] +THEN REMOVE_THEN "EM"(fun th-> REWRITE_TAC[SYM th;INTERS;IN_ELIM_THM;INTER]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN STRIP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] THEN ASSUME_TAC th THEN STRIP_TAC) +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y IN ds1/\ ds1 SUBSET d1_fan (x,V,E1)==> y IN d1_fan (x,V:real^3->bool,E1)`) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM;pr2;pr3;f1_fan] +THEN RESA_TAC +THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(ARITH_RULE`3 <= ( CARD (ds1:real^3#real^3#real^3#real^3->bool)):num +==> ~((CARD (ds1:real^3#real^3#real^3#real^3->bool)):num =0)`) +THEN RESA_TAC +THEN MRESA_TAC lemma_face_cycle[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E1)`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`] +THEN MRESA_TAC orbit_cyclic[`(res (f1_fan x V E1) (d1_fan (x:real^3,V,E1)))`;`(CARD (ds1:real^3#real^3#real^3#real^3->bool)):num`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`] +THEN USE_THEN "LINH1" MP_TAC +THEN FIND_ASSUM (fun th-> REWRITE_TAC[SYM th;face;] THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC)`face (hypermap1_of_fanx (x,V:real^3->bool,E1)) (x,v,w,sigma_fan x V E1 v w) = ds1` +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`(x,v,w,sigma_fan x V E1 v w) IN d1_fan(x:real^3,V,E1)`ASSUME_TAC +THENL(*1*)[ +ASM_REWRITE_TAC[face;d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v (w:real^3)` +THEN ASM_REWRITE_TAC[];(*1*) + + +MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`) +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN DISJ_CASES_TAC(SET_RULE`(v' IN {v,w:real^3}) \/ ~(v' IN {v,w})`) +THENL(*2*)[ + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`A IN {B,C}<=> A=B\/ A=C`] +THEN STRIP_TAC +THENL(*3*)[ + +MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESAL_TAC SRPRNPL[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;][simple_hypermap] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `(x,v,w,sigma_fan x V E1 v w:real^3)`) +THEN MP_TAC(SET_RULE`y IN ds1/\ ds1 SUBSET d1_fan (x,V,E1)==> y IN d1_fan (x,V:real^3->bool,E1)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`node (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) IN + node_set (hypermap1_of_fanx (x,V:real^3->bool,E1))` ASSUME_TAC +THENL(*4*)[ +ASM_REWRITE_TAC[node_set;IN_ELIM_THM;set_of_orbits] +THEN EXISTS_TAC`(x,v,w,sigma_fan x V E1 v w:real^3)` +THEN ASM_REWRITE_TAC[node];(*4*) + + +SUBGOAL_THEN`x,v,w,sigma_fan x V E1 v w IN + node (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w:real^3)`ASSUME_TAC +THENL(*5*)[ +ASM_REWRITE_TAC[node;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC;(*5*) + + + MRESAL_TAC CONDITION_DART_IN_NODE[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`node (hypermap1_of_fanx (x,V:real^3->bool,E1)) (x,v,w,sigma_fan x V E1 v w)`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][pr2] +THEN MP_TAC(SET_RULE`y IN + node (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)/\ +node (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) INTER + ds1 = + {(x,v,w,sigma_fan x V E1 v w)} +/\ y IN ds1==> y IN {(x,v,w,sigma_fan x V E1 v w)} +`) +THEN ASM_REWRITE_TAC[IN_SING;EQ_PAIR_4] +THEN STRIP_TAC +THEN REMOVE_THEN "YEU" MP_TAC +THEN ASM_REWRITE_TAC[POWER;I_DEF;EQ_PAIR_4] +THEN RESA_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ]](*5*)](*4*);(*3*) + + + +MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`) +THEN STRIP_TAC +THEN SUBGOAL_THEN`x,w,inverse1_sigma_fan x V E1 w v,v IN d1_fan (x,V,E1)`ASSUME_TAC +THENL(*4*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`inverse1_sigma_fan x V E1 w v:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*4*) + +MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESAL_TAC SRPRNPL[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;][simple_hypermap] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `x,w,inverse1_sigma_fan x V E1 w v,v:real^3`) +THEN SUBGOAL_THEN`(x,w,inverse1_sigma_fan x V E1 w v,v:real^3) =f1_fan x V E1 (x,v,w,sigma_fan x V E1 v w)` ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[f1_fan];(*5*) + +SUBGOAL_THEN`x:real^3,v,w,sigma_fan x V E1 v w IN ds1`ASSUME_TAC +THENL(*6*)[ + +FIND_ASSUM (fun th-> REWRITE_TAC[SYM th;face;IN_ELIM_THM;orbit_map])`face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w:real^3) = ds1` +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC;(*6*) + +MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`((x,w,inverse1_sigma_fan x V E1 w v,v):real^3#real^3#real^3#real^3)` ;`((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E1)`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`;`(x,w,inverse1_sigma_fan x V E1 w v,v):real^3#real^3#real^3#real^3`;] +THEN MP_TAC(SET_RULE`y IN ds1/\ ds1 SUBSET d1_fan (x,V,E1)==> y IN d1_fan (x,V:real^3->bool,E1)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`node (hypermap1_of_fanx (x,V,E1)) (x,w,inverse1_sigma_fan x V E1 w v,v) IN + node_set (hypermap1_of_fanx (x,V:real^3->bool,E1))` ASSUME_TAC +THENL(*7*)[ + + +ASM_REWRITE_TAC[node_set;IN_ELIM_THM;set_of_orbits] +THEN EXISTS_TAC`(x,w,inverse1_sigma_fan x V E1 w v,v:real^3)` +THEN ASM_REWRITE_TAC[node];(*7*) + +SUBGOAL_THEN`(x,w,inverse1_sigma_fan x V E1 w v,v)IN + node (hypermap1_of_fanx (x,V,E1)) (x,w,inverse1_sigma_fan x V E1 w v,v:real^3)`ASSUME_TAC +THENL(*8*)[ + +ASM_REWRITE_TAC[node;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC;(*8*) + + MRESAL_TAC CONDITION_DART_IN_NODE[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`node (hypermap1_of_fanx (x,V:real^3->bool,E1)) (x,w,inverse1_sigma_fan x V E1 w v,v)`;`(x,w,inverse1_sigma_fan x V E1 w v,v):real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][pr2] +THEN MP_TAC(SET_RULE`y IN + node (hypermap1_of_fanx (x,V,E1)) (x,w,inverse1_sigma_fan x V E1 w v,v)/\ +node (hypermap1_of_fanx (x,V,E1)) (x,w,inverse1_sigma_fan x V E1 w v,v) INTER + ds1 = + {(x,w,inverse1_sigma_fan x V E1 w v,v)} +/\ y IN ds1==> y IN {(x,w,inverse1_sigma_fan x V E1 w v,v:real^3)} +`) +THEN ASM_REWRITE_TAC[IN_SING;EQ_PAIR_4] +THEN STRIP_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`;`inverse1_sigma_fan x V E1 w v:real^3`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESA_TAC aff_gt_eq_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th `aff_gt {x:real^3, w, inverse1_sigma_fan x V E w u} {u}`) +THEN POP_ASSUM MATCH_MP_TAC +THEN EXISTS_TAC`(x, w, inverse1_sigma_fan x V E w u,u:real^3)` +THEN REWRITE_TAC[pr2;pr3;f1_fan] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN SUBGOAL_THEN`x,w,inverse1_sigma_fan x V E w u,u= f1_fan x V E ((x,u,w,sigma_fan x V E u w):real^3#real^3#real^3#real^3)` +ASSUME_TAC +THENL(*9*)[REWRITE_TAC[f1_fan;EQ_PAIR_4];(*9*) + + +POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN MATCH_MP_TAC condition_f1_fan_in_face_set +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN EXISTS_TAC`(x,u,w,sigma_fan x V E u w:real^3)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC f2_EQ_F30_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +](*9*)](*8*)](*7*)](*6*)](*5*)](*4*)](*3*);(*2*) + + +MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN FIND_ASSUM MP_TAC`{v', w':real^3} IN E1` +THEN FIND_ASSUM( fun th-> GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[SYM th;UNION;IN_ELIM_THM])`E UNION {{v, w:real^3}}=E1` +THEN STRIP_TAC +THENL(*3*)[ + + +MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`v':real^3`;`w':real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th `aff_gt {x, v', w'} {sigma_fan x V E1 v' w':real^3}`) +THEN POP_ASSUM MATCH_MP_TAC +THEN EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[pr2;pr3;f1_fan] +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;`w':real^3`] +THEN DISJ_CASES_TAC(SET_RULE`~(x,v',w',sigma_fan x V E v' w' IN ds)\/ x,v',w',sigma_fan x V E v' w' IN (ds:real^3#real^3#real^3#real^3->bool)`) +THENL(*4*)[ + +SUBGOAL_THEN`~(ds = face (hypermap1_of_fanx (x,V,E)) (x,v',w',sigma_fan x V E v' w':real^3))`ASSUME_TAC +THENL(*5*)[ + +POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN RESA_TAC +THEN REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC;(*5*) + +ABBREV_TAC`ds0=face (hypermap1_of_fanx (x,V,E)) (x,v',w',sigma_fan x V E v' (w':real^3))` +THEN SUBGOAL_THEN`ds0 IN face_set (hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL(*6*)[ + +REWRITE_TAC[face_set; set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`(x,v',w':real^3,sigma_fan x V E v' w')` +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC "ds0" +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v':real^3` +THEN EXISTS_TAC`w':real^3` +THEN EXISTS_TAC`sigma_fan x V E v' w':real^3` +THEN ASM_REWRITE_TAC[];(*6*) + +MRESAL_TAC DOMAIN_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(ds0:real^3#real^3#real^3#real^3->bool)`;][DELETE;IN_ELIM_THM] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC unique_tranf_fan +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +; `(face (hypermap1_of_fanx (x:real^3,V:real^3->bool,E)) (y:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3->bool` +;`(ds1:real^3#real^3#real^3#real^3->bool)` +;`((x,v',w':real^3,sigma_fan x V E v' w'):real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM;tran] +THEN REMOVE_THEN "YEU" MP_TAC +THEN RESA_TAC +THEN REMOVE_THEN "LINH1" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESAL_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`(f1_fan x V E1 POWER k) (x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`][] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN EXPAND_TAC "ds0" +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;face;IN_ELIM_THM;orbit_map]) +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC](*6*)](*5*);(*4*) + +ASM_REWRITE_TAC[]](*4*);(*3*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN_SING] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]]]);; + + + + + + +let lemmaINTERS_HALF_SPACE_DS_FANADD1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U1. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v}=U1 +==> U1 INTER aff_gt {x, v, w} {u} SUBSET dartset_leads_into_fan x V E1 ds2`, + + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[conforming_fan;conforming_half_space_fan] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`ds2:real^3#real^3#real^3#real^3->bool`) +THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN REWRITE_TAC[INTERS;IN_ELIM_THM;SUBSET] +THEN REMOVE_THEN "EM"(fun th-> REWRITE_TAC[SYM th;INTERS;IN_ELIM_THM;INTER]) +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] THEN ASSUME_TAC th THEN STRIP_TAC) +THEN MP_TAC(SET_RULE`y IN {f10, f20, f30:real^3#real^3#real^3#real^3}==> y =f10\/ y =f20\/ y =f30`) +THEN RESA_TAC +THENL[ + +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3;f1_fan])`x,w,v,u = f10:real^3#real^3#real^3#real^3` +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]; + +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3;f1_fan])`x,v,u,w = f20:real^3#real^3#real^3#real^3` +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 /\ {v, u} IN E==> {v, u} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`u:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`) +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); + + + +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3;f1_fan])`x,u,w,v = f30:real^3#real^3#real^3#real^3` +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 /\ {u,w} IN E==> {u,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`) +THEN RESA_TAC +THEN RESA_TAC]);; + + + + + + + + +let lemmaINTERS_HALF_SPACE_DS_FANADD2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U1. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v}=U1 +==> U1 INTER aff_gt {x, v, w} {sigma_fan x V E v u} SUBSET dartset_leads_into_fan x V E1 ds1`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] + +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "EM"(fun th-> REWRITE_TAC[SYM th;INTERS;IN_ELIM_THM;INTER;SUBSET]) +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 ==> {v,w:real^3} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`sigma_fan x V E v (u:real^3)`; +`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {sigma_fan x V E v u,v} IN E ==> { sigma_fan x V E v u,v} IN E1`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`w:real^3`]) + +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`sigma_fan x V E v u:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_1_3[`x:real^3`;`sigma_fan x V E v u:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`sigma_fan x V E v u:real^3`;` v:real^3`;` w:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` x' IN aff_gt {x, sigma_fan x V E v u,v} {w} /\ +x' IN aff_gt {x, w, sigma_fan x V E v u} {v} +/\ x' IN aff_gt {x, v, w} {sigma_fan x V E v u} + +/\ aff_gt {x, sigma_fan x V E v u, v} {w} INTER + aff_gt {x, v, w} {sigma_fan x V E v u} INTER + aff_gt {x, w, sigma_fan x V E v u} {v} SUBSET + dart_leads_into x V E1 v w +==> (x':real^3) IN dart_leads_into x V E1 v w`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN SUBGOAL_THEN`(x,v,w:real^3,sigma_fan x V E v u:real^3) IN ds1` ASSUME_TAC +THENL[ +FIND_ASSUM (fun th-> REWRITE_TAC[SYM th;face;IN_ELIM_THM;orbit_map])`face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w:real^3) = ds1` +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC; +MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`; +`ds1:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th `(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`[pr2;pr3])]);; + + + +let aff_gt_3_1_INTER_aff_SUBSET_aff_gt_2_1=prove(`!a x y z w:real^3. +azim a x y z < pi +/\ &0< azim a x y z +/\ azim a x y w < pi +/\ &0< azim a x y w +/\ DISJOINT {a, x} {w} +/\ ~collinear {a, x, w} +/\ ~coplanar {a, x, y, z} +==> aff_gt {a,x,y}{z} INTER aff{a,x,w} SUBSET aff_gt {a,x} {w}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`] +THEN RESA_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`a:real^3`;`x:real^3`;`z:real^3`;`y:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`a:real^3`; `x:real^3`;`z:real^3`;`y:real^3`] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`a:real^3`;`x:real^3`;`y:real^3`;`z:real^3`] +THEN REWRITE_TAC[AFFINE_HULL_3;aff;INTER;SUBSET;IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_2_1[`a:real^3`;`x:real^3`;`w:real^3`][IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`u:real` +THEN EXISTS_TAC`v:real` +THEN EXISTS_TAC`w':real` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[th]) +THEN REWRITE_TAC[VECTOR_ARITH`(u % a + v % x + w' % w) - a= v % (x-a) + w' % (w-a) +((u+v +w')- &1)% a`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th;VECTOR_ARITH`v % (x - a) + w' % (w - a) + (&1 - &1) % a=v % (x - a) + w' % (w - a)`;]) +THEN REWRITE_TAC[DOT_RADD;DOT_RMUL;DOT_CROSS_SELF;REAL_ARITH`v * &0 +A=A`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`a:real^3`; `x:real^3`;`w:real^3`;`y:real^3`] +THEN STRIP_TAC +THEN MRESA_TAC REAL_LT_LCANCEL_IMP[`((x - a) cross (y - a)) dot (w - a:real^3)`;`&0`;`w':real`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC);; + + + + + +let aff_gt_3_1_INTER_aff_SUBSET_aff_gt_2_14=prove(`!a x y z:real^3. +~coplanar {a, x, y, z} +==> aff_gt {a,x,y}{z} INTER aff{a,x,z} SUBSET aff_gt {a,x} {z}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`] +THEN RESA_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`a:real^3`;`x:real^3`;`z:real^3`;`y:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`a:real^3`; `x:real^3`;`z:real^3`;`y:real^3`] +THEN REWRITE_TAC[AFFINE_HULL_3;aff;INTER;SUBSET;IN_ELIM_THM] +THEN MRESA_TAC notcoplanar_disjoint[`a:real^3`;`x:real^3`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC notcoplanar_disjoints[`a:real^3`;`x:real^3`;`y:real^3`;`z:real^3`] +THEN MP_TAC(SET_RULE`~(a=z) /\ ~(x=z:real^3)==>DISJOINT {a, x} {z}`) +THEN RESA_TAC +THEN MRESAL_TAC AFF_GT_2_1[`a:real^3`;`x:real^3`;`z:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_3_1[`a:real^3`;`x:real^3`;`y:real^3`;`z:real^3`][IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`u:real` +THEN EXISTS_TAC`v:real` +THEN EXISTS_TAC`w:real` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th] THEN MP_TAC th) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % a + t2 % x + t3 % y + t4 % z = u % a + v % x + w % z +<=> ((u+v+w)-(t1+t2+t3+t4))%a+(w-t4)%(z-a)= t3%(y-a)+(t2-v)%(x-a)`;VECTOR_ARITH`(&1 - &1) % a +A=A`] +THEN DISJ_CASES_TAC(REAL_ARITH`~(w-t4= &0)\/ w=t4:real`) +THENL[ +STRIP_TAC +THEN MP_TAC(SET_RULE`(w - t4) % (z - a:real^3) = t3 % (y - a) + (t2 - v) % (x - a) +==> (inv (w-t4))%((w - t4) % (z - a)) =(inv (w-t4))%( t3 % (y - a) + (t2 - v) % (x - a))`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN MRESA1_TAC REAL_MUL_LINV `w-t4:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`~(coplanar{a, x, y, z:real^3})` +THEN REWRITE_TAC[COPLANAR_DET_EQ_0] +THEN ASM_REWRITE_TAC[DET_3;VECTOR_3;VECTOR_ADD_COMPONENT;VECTOR_MUL_COMPONENT] +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[]]);; + + + + +let lemmaINTERS_HALF_SPACE_DS_FANADD3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U1. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ U1= aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v} + +==> U1 INTER aff {x,v,w} SUBSET aff_gt {x} {v, w} `, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {v,u} IN E ==> { v,u} IN E1`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 ==> {v,w:real^3} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`sigma_fan x V E v (u:real^3)`; +`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`sigma_fan x V E v u:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN STRIP_TAC +THEN MRESA_TAC aff_gt_3_1_INTER_aff_SUBSET_aff_gt_2_1[`x:real^3`;`v:real^3`;`u:real^3`;`sigma_fan x V E v u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC aff_gt_3_1_INTER_aff_SUBSET_aff_gt_2_14[`x:real^3`;`w:real^3`;`u:real^3`;`v:real^3`;] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(v:real^3)`;`(w:real^3)`] +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B,C}={A,C,B}`] +THEN SET_TAC[]);; + + + + + + +let aff_3_rep_cross_dot=prove(`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u} + +==> aff {x,v,u} ={y:real^3| (((v-x) cross (u-x)) dot (y-x)) = &0}`, + REWRITE_TAC[AFFINE_HULL_3;aff;IN_ELIM_THM;EXTENSION] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(u' % x + v' % v + w % u) - x= ((u'+v'+w)- &1)%x + v'%(v-x)+ w%(u-x)` +;VECTOR_ARITH`(&1- &1)%X+A=A`;DOT_RADD;DOT_RMUL;DOT_CROSS_SELF] +THEN REAL_ARITH_TAC; +DISCH_THEN(LABEL_TAC"ME") +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]properties_coordinate) THEN RESA_TAC +THEN MRESA_TAC ORTHONORMAL_IMP_SPANNING[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3)( v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[SPAN_3;EXTENSION] + THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(x':real^3)-(x:real^3)`th) THEN ASSUME_TAC(th)) +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(u:real^3)-(x:real^3)`th)THEN ASSUME_TAC(th)) +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(v:real^3)-(x:real^3)`th)) +THEN REWRITE_TAC[SET_RULE`(x:real^3) IN (:real^3)`;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`e1=e1_fan x v u:real^3` +THEN ABBREV_TAC`e2=e2_fan x v u:real^3` +THEN ABBREV_TAC`e3=e3_fan x v u:real^3` +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`x' = u' % x + v' % v + w % u <=> x'-x = ((u'+v'+w)- &1)%x+ v'%(v-x)+ w%(u-x)`] +THEN MRESA_TAC ORTHONORMAL_CROSS[`e1:real^3`;`e2:real^3`;`e3:real^3`;] +THEN REMOVE_THEN "ME" MP_TAC +THEN ASM_REWRITE_TAC[CROSS_LMUL;CROSS_RMUL;CROSS_LADD;CROSS_RADD;CROSS_REFL;] +THEN REDUCE_VECTOR_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;DOT_LNEG] +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC`orthonormal e1 e2 (e3:real^3)` +THEN REWRITE_TAC[orthonormal] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN FIND_ASSUM MP_TAC`(v - x) dot (e2:real^3) = &0:real` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`v - x = u' % e1 + v' % e2 + w % e3:real^3` +THEN REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;DOT_LNEG] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`(u - x) dot (e2:real^3) = &0:real` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`u - x = u'' % e1 + v'' % e2 + w' % e3:real^3` +THEN REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;DOT_LNEG] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN RESA_TAC +THEN REDUCE_ARITH_TAC +THEN FIND_ASSUM MP_TAC`(v - x) dot (e1:real^3) = &0:real` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`v - x = u' % e1 + v' % e2 + w % e3:real^3` +THEN REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;DOT_LNEG] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ARITH`u' * w' * --v''' + w * u'' * v''' = (w * u''-u' * w') * v''':real `] +THEN REDUCE_ARITH_TAC +THEN FIND_ASSUM MP_TAC`&0 < (u - x) dot (e1:real^3)` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`u - x = u'' % e1 + v'' % e2 + w' % e3:real^3` +THEN REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;DOT_LNEG] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN RESA_TAC +THEN REDUCE_ARITH_TAC +THEN FIND_ASSUM MP_TAC`dist (v,x) % e3 = v - x :real^3` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`v - x = u' % e1 + v' % e2 + w % e3:real^3` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN STRIP_TAC +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`dist (v,x:real^3) % e3 = w % (e3:real^3) ==> dist (v,x) % e3 dot e3 = w % e3 dot e3`) +THEN POP_ASSUM( fun th-> GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[DOT_LMUL] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;dist]) +THEN MRESA_TAC collinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;] +THEN MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_not_zero_fan) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 < u''==> ~(u''= &0)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[REAL_ENTIRE] +THEN RESA_TAC +THEN MP_TAC(ISPEC`(norm(v-x:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`u'':real`REAL_MUL_LINV) +THEN RESA_TAC +THEN REDUCE_VECTOR_TAC +THEN EXISTS_TAC`&1- (w''-u''' * inv(u'':real) * w') * inv(norm(v-x:real^3))- u''' * inv(u'':real)` +THEN EXISTS_TAC`(w''-u''' * inv(u'':real) * w') * inv(norm(v-x:real^3))` +THEN EXISTS_TAC`u''' * inv(u'':real)` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - (w'' - u''' * inv u'' * w') * inv (norm (v - x)) - u''' * inv u'' + + (w'' - u''' * inv u'' * w') * inv (norm (v - x)) + + u''' * inv u'' = + &1`;VECTOR_ARITH`(&1- &1) %A+B+C=B+C`;VECTOR_ARITH`A%(B+C)=A %B+ A%C`;VECTOR_ARITH`A %B %C=(A*B)%C` +;REAL_ARITH`(A*B)*C=A*(B*C)`] +THEN VECTOR_ARITH_TAC]);; + + + + + + + +let SPACE3_EQ_UNION_3SET=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> aff {x,v,w} UNION aff_gt {x, v, w} {sigma_fan x V E v u} UNION aff_gt {x, v, w} {u}= (:real^3) `, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 ==> { v,w} IN E1`) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MP_TAC th +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC THEN ASSUME_TAC th) +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`w:real^3`;`v:real^3`]) +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{a,b,c,d}={a,d,b,c}`] +THEN STRIP_TAC +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `w:real^3`;`u:real^3`;`v:real^3`] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`w:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`sigma_fan x V E v (u:real^3)`; +`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {sigma_fan x V E v u, v} IN E ==> {sigma_fan x V E v u, v} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`sigma_fan x V E v u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{a,b,c,d}={a,c,b,d}`] +THEN STRIP_TAC +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`sigma_fan x V E v u`;`w:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `v:real^3`;`sigma_fan x V E v u:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`w:real^3`;`sigma_fan x V E v u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{a,b,c,d}={a,b,d,c}`] +THEN RESA_TAC +THEN MRESA_TAC aff_3_rep_cross_dot[`x:real^3`;`v:real^3`;`w:real^3`] +THEN REWRITE_TAC[UNION;IN_ELIM_THM;EXTENSION;DOT_LNEG] +THEN GEN_TAC +THEN EQ_TAC +THENL[SET_TAC[]; +REAL_ARITH_TAC]);; + + + +let lemmaU1_subset_U=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U U1. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ U1= aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v} +/\ U= dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w} +==> U1 SUBSET U `, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] + +THEN MRESA_TAC lemmaINTERS_HALF_SPACE_DS_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U1:real^3->bool`] +THEN MRESA_TAC lemmaINTERS_HALF_SPACE_DS_FANADD2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U1:real^3->bool`] +THEN MRESA_TAC lemmaINTERS_HALF_SPACE_DS_FANADD3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U1:real^3->bool`] +THEN MRESA_TAC SPACE3_EQ_UNION_3SET +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN ASM_TAC +THEN SET_TAC[]);; + + + + + + + + + + +let open_subsetU=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ U=aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v} +==> open U`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MATCH_MP_TAC OPEN_INTER +THEN STRIP_TAC +THENL[ + MATCH_MP_TAC OPEN_AFF_GT_3_1 +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)` ;`v:real^3`;`u:real^3`;`w:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN ASM_REWRITE_TAC[]; + +MATCH_MP_TAC OPEN_INTER +THEN STRIP_TAC +THENL[ + MATCH_MP_TAC OPEN_AFF_GT_3_1 +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`sigma_fan x V E v (u:real^3)`; +`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)` ;`sigma_fan x V E v u:real^3`;`v:real^3`;`u:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASM_REWRITE_TAC[]; + + +MATCH_MP_TAC OPEN_INTER +THEN STRIP_TAC +THENL[ MATCH_MP_TAC OPEN_AFF_GT_3_1 +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 ==> { v,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`w:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`sigma_fan x V E v (u:real^3)`; +`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {sigma_fan x V E v u, v} IN E ==> {sigma_fan x V E v u, v} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)` ;`sigma_fan x V E v u:real^3`;`v:real^3`;`w:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC OPEN_AFF_GT_3_1 +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 ==> { v,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`w:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`sigma_fan x V E v (u:real^3)`; +`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {sigma_fan x V E v u, v} IN E ==> {sigma_fan x V E v u, v} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)` ;`sigma_fan x V E v u:real^3`;`v:real^3`;`w:real^3`]]]]);; + + + +let eq_aff_gt_3_fanadd_edge=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> aff_gt {x, v, u} {sigma_fan x V E v u}= aff_gt {x, v, u} {w}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`sigma_fan x V E v (u:real^3)`; +`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)` ;`sigma_fan x V E v u:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`sigma_fan x V E v u`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `v:real^3`;`sigma_fan x V E v u:real^3`;`u:real^3`] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`u:real^3`;`sigma_fan x V E v u:real^3`;] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {v,u} IN E ==> { v,u} IN E1`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v:real^3`;`u:real^3`]) +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {v,u} IN E ==> { v,w} IN E1`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)` ;`sigma_fan x V E1 v u:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`sigma_fan x V E1 v u`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `v:real^3`;`sigma_fan x V E1 v u:real^3`;`u:real^3`] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[]);; + + + + + +let aff_gt_add_subset_U1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U1. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ U1= aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v} +==> aff_gt {x} {v,w} SUBSET U1 `, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> { v,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(v:real^3)`;`(w:real^3)`] +THEN MRESA_TAC eq_aff_gt_3_fanadd_edge[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESAL_TAC AFF_GT_MONO_LEFT[`{x,w:real^3}`;`{x,u,w:real^3}`;`{v:real^3}`][SET_RULE`{x, w} SUBSET {x, u, w:real^3}`] +THEN MRESAL_TAC AFF_GT_MONO_LEFT[`{x,v:real^3}`;`{x,v,u:real^3}`;`{w:real^3}`][SET_RULE`{x, v} SUBSET {x, v, u:real^3}`] +THEN MRESAL_TAC AFF_GT_MONO_LEFT[`{x,v:real^3}`;`{x,v,sigma_fan x V E v u:real^3}`;`{w:real^3}`][SET_RULE`{x, v} SUBSET {x, v, sigma_fan x V E v u:real^3}`] +THEN MRESAL_TAC AFF_GT_MONO_LEFT[`{x,w:real^3}`;`{x,sigma_fan x V E v u,w:real^3}`;`{v:real^3}`][SET_RULE`{x, w} SUBSET {x, sigma_fan x V E v u, w:real^3}`] +THEN ASM_TAC +THEN SET_TAC[]);; + + + +let lemma_rep_U_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U U1. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ U= dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w} +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ U1= aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v} +==> U= U1 UNION dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC aff_gt_add_subset_U1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U1:real^3->bool`] +THEN MRESA_TAC lemmaU1_subset_U[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U:real^3->bool`;`U1:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + +let dartset_leads_into_ds_open_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}=U +==> open U `, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC lemma_rep_U_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U:real^3->bool`;`aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v:real^3}`] +THEN MATCH_MP_TAC OPEN_UNION +THEN MRESA_TAC open_subsetU[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v:real^3}`] +THEN MATCH_MP_TAC OPEN_UNION +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`dartset_leads_into_fan x V E1 ds1`] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`dartset_leads_into_fan x V E1 ds2`]);; + + +let U_INTER_U2_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ U= dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w} +==> +U INTER + UNIONS + (topological_component_yfan (x,V,E1) DELETE + dartset_leads_into_fan x V E1 ds1 DELETE + dartset_leads_into_fan x V E1 ds2) = {}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN REWRITE_TAC[UNIONS;INTER;IN_ELIM_THM;UNION;DELETE] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +REPEAT STRIP_TAC +THENL[ + MRESA_TAC version_JUTSTKG[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u':real^3->bool`] +THEN FIND_ASSUM MP_TAC`u' IN topological_component_yfan (x:real^3,V,E1)` +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y:real^3`;`x':real^3`] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y':real^3`;`x':real^3`]; + + MRESA_TAC version_JUTSTKG[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u':real^3->bool`] +THEN FIND_ASSUM MP_TAC`u' IN topological_component_yfan (x:real^3,V,E1)` +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y:real^3`;`x':real^3`] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y':real^3`;`x':real^3`]; + MRESA_TAC version_JUTSTKG[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u':real^3->bool`] +THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;` f:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC AFF_GE_SUBSET_XFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE` aff_ge {x} {v, w} SUBSET xfan (x,V,E1) /\ aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w} +==> aff_gt {x:real^3} {v, w} SUBSET xfan (x,V:real^3->bool,E1)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE` x' IN aff_gt {x} {v, w}/\ u' SUBSET yfan (x,V,E1) /\ x' IN u'==> ~(aff_gt {x} {v, w} INTER yfan(x,V:real^3->bool,E1)={})`) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan] +THEN SET_TAC[]]; +SET_TAC[]]);; + + +let dartset_leads_into_fan_SUBSET_U=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}=U +==> dartset_leads_into_fan x V E ds SUBSET U +`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN REWRITE_TAC[GSYM UNIONS_TOPOLOGICAL_COMPONENT_EQ_YFAN] +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[UNIONS_TOPOLOGICAL_COMPONENT_EQ_YFAN] +THEN DISCH_THEN(LABEL_TAC"MA") +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN SUBGOAL_THEN`yfan (x,V,E) = + UNIONS ((topological_component_yfan (x,V,E1) DELETE (dartset_leads_into_fan x V E1 ds1))DELETE (dartset_leads_into_fan x V E1 ds2)) UNION (dartset_leads_into_fan x V E1 ds2) UNION (dartset_leads_into_fan x V E1 ds1) UNION aff_gt {x} {v, w}` +ASSUME_TAC +THENL(*1*)[ +ASM_REWRITE_TAC[UNIONS;DELETE;UNION;IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*1*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`A UNION B UNION C UNION D=A UNION (C UNION B UNION D)`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC(SYM th) THEN DISCH_THEN(LABEL_TAC"LINH")) +THEN REMOVE_THEN"MA"(fun th-> MP_TAC(SYM th) THEN DISCH_THEN(LABEL_TAC"MA")) +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC exists_in_aff_gt_disjoint[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC STEP2_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN REWRITE_TAC[SUBSET] +THEN GEN_TAC +THEN MRESA_TAC dartset_leads_into_fanadd2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MP_TAC(SET_RULE`y' IN aff_gt {x} {v, w:real^3} /\ aff_gt {x} {v, w} SUBSET connected_component (yfan (x,V:real^3->bool,E)) y==> y' IN connected_component (yfan (x,V,E)) y`) +THEN RESA_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan (x,V:real^3->bool,E)`;`y:real^3`;`y':real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_SUBSET[`yfan (x,V:real^3->bool,E)`;`y':real^3`] +THEN MP_TAC(SET_RULE`connected_component (yfan (x,V,E)) y' SUBSET yfan (x,V,E)/\ x' IN connected_component (yfan (x,V,E)) y' +==> x' IN yfan (x,V:real^3->bool,E)`) +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "MA"(fun th-> REWRITE_TAC[SYM th] +THEN REMOVE_THEN "LINH"(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM])) +THEN STRIP_TAC +THEN SUBGOAL_THEN`?e1 e2. + open e1 /\ + open e2 /\ + (connected_component (yfan (x,V,E)) y') SUBSET e1 UNION e2 /\ + e1 INTER e2 INTER (connected_component (yfan (x,V:real^3->bool,E)) y') = {} /\ + ~(e1 INTER (connected_component (yfan (x,V,E)) y') = {}) /\ + ~(e2 INTER (connected_component (yfan (x,V,E)) y') = {})` ASSUME_TAC +THENL(*2*)[ + + MRESA_TAC dartset_leads_into_ds_open_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U:real^3->bool`] + +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN EXISTS_TAC`U:real^3->bool` +THEN EXISTS_TAC`UNIONS + (topological_component_yfan (x,V:real^3->bool,E1) DELETE + dartset_leads_into_fan x V E1 ds1 DELETE + dartset_leads_into_fan x V E1 ds2)` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*3*)[ +MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`; +`dartset_leads_into_fan x V E1 ds1:real^3->bool`] +THEN MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`; +`dartset_leads_into_fan x V E1 ds2:real^3->bool`] +THEN MATCH_MP_TAC OPEN_UNIONS +THEN REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`; +`s:real^3->bool`]; + +STRIP_TAC +THENL(*4*)[ + + MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC UNIONS_TOPOLOGICAL_COMPONENT_EQ_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM( fun th-> REMOVE_THEN "EM" (fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[th]) +THEN SET_TAC[]; + +STRIP_TAC +THENL(*5*)[ + +MRESA_TAC U_INTER_U2_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*5*) + +MP_TAC(SET_RULE`y' IN aff_gt {x} {v, w} /\ dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w:real^3}=U +==> y' IN U +`) +THEN RESA_TAC +THEN SUBGOAL_THEN`y' IN connected_component (yfan (x,V:real^3->bool,E)) y'`ASSUME_TAC +THENL(*6*)[ + +REWRITE_TAC[IN] +THEN MATCH_MP_TAC CONNECTED_COMPONENT_REFL +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC condition_aff_gt_subset_yfan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v:real^3`;`u:real^3`;`w:real^3`;] +THEN ASM_TAC +THEN SET_TAC[];(*6*) + +MP_TAC(SET_RULE`y' IN U /\ y' IN connected_component (yfan (x,V:real^3->bool,E)) y'==> ~(U INTER connected_component (yfan (x,V,E)) y' = {})`) +THEN RESA_TAC +THEN ASM_TAC +THEN SET_TAC[]]]]];(*2*) +MRESA_TAC CONNECTED_CONNECTED_COMPONENT[`yfan(x,V:real^3->bool,E)`;`y':real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[connected]]]);; + + + + + + + + + + + +let rep_dartset_leads_into_fan_ds=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}=U +==> dartset_leads_into_fan x V E ds =U +`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC dartset_leads_into_fan_SUBSET_U[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U:real^3->bool`] +THEN MRESA_TAC dartset_leads_into_fanadd2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC dartset_leads_into_fanadd1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC STEP2_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN ASM_TAC +THEN SET_TAC[]);; + + + + + +let u_in_topological_component_yfanadd1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN (x,V,E1) /\ + (!v. v IN V ==> CARD (set_of_edge v V E1) > 1) /\ + fan80 (x,V,E1) /\ + N_FAN (x,V,E1) < N_FAN (x,V,E) + ==> conforming_fan (x,V,E1)) +/\ dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}=U +==> U IN topological_component_yfan (x,V,E)`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U:real^3->bool`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`]);; + + + + + + + + + + + + +let dartset_leads_into_fan_eq_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) + +==> dartset_leads_into_fan x V E1 (tranf x V E E1 ds0) = dartset_leads_into_fan x V E ds0`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MP_TAC(SET_RULE`ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds ==> ds0 IN face_set (hypermap1_of_fanx (x:real^3,V,E))`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC TRANF[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0:real^3#real^3#real^3#real^3->bool` ] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MAT") +THEN STRIP_TAC +THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds0:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN MP_TAC(SET_RULE`ds0 SUBSET d1_fan (x,V,E) /\ y IN ds0==> y IN d1_fan ((x:real^3),V,E)`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM (fun th-> MP_TAC (SYM th)) +THEN DISCH_THEN(LABEL_TAC"NHO") THEN ASSUME_TAC th) +THEN SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E1)) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3)) IN face_set (hypermap1_of_fanx (x:real^3,V,E1))` ASSUME_TAC +THENL(*1*)[ +REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;face] +THEN EXISTS_TAC`(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))` +THEN REMOVE_THEN "NHO"(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[tran;d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v':real^3` +THEN EXISTS_TAC`w':real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v' w':real^3` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`{v', w'} IN E/\ E UNION {{v, w:real^3}} = E1==> {v', w'} IN E1`) +THEN ASM_REWRITE_TAC[];(*1*) + +SUBGOAL_THEN`tran x V E1 y IN face (hypermap1_of_fanx (x,V,E1)) (tran x V E1 (y:real^3#real^3#real^3#real^3))` +ASSUME_TAC +THENL(*2*)[ +REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC;(*2*) + +MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`; +`face (hypermap1_of_fanx (x,V,E1)) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"NHOEM") +THEN REMOVE_THEN "NHO"(fun th-> REWRITE_TAC[SYM th;tran;pr2;pr3] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"LINH")) +THEN MP_TAC(SET_RULE`{v', w'} IN E/\ E UNION {{v, w:real^3}} = E1==> {v', w'} IN E1`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC DART_LEADS_INTO [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"NHO") +THEN MRESA_TAC DART_LEADS_INTO [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"NHO1") +THEN MATCH_MP_TAC unique_dart_leads_into +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0 &0< min (h:real) (h':real)`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN EXISTS_TAC`min (h:real) (h':real)` +THEN ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(SET_RULE`((y:real^3#real^3#real^3#real^3) IN ds)\/ ~(y IN ds)`) +THENL(*3*)[ +MRESA_TAC lemma_face_representation[`hypermap1_of_fanx(x:real^3,V,E)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x'':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESA_TAC lemma_face_representation[`hypermap1_of_fanx(x:real^3,V,E)`;`ds0:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x''':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th; DELETE;IN_ELIM_THM] );(*3*) + + REPEAT GEN_TAC THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`s < min h h'==> s < h' /\ s < h `) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w':real^3)`; +`(v':real^3)`] +THEN FIND_ASSUM MP_TAC`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E1) > 1)` +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `v':real^3`th) +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN STRIP_TAC THEN ASSUME_TAC th)) +THEN FIND_ASSUM MP_TAC`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)` +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `v':real^3`th) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN STRIP_TAC THEN ASSUME_TAC th)) +THEN ASM_REWRITE_TAC[rw_dart_fan;w_dart_fan] +THEN MRESA_TAC INVARANT_SIGMA_FAN_ADD +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN"NHOEM" MP_TAC +THEN REMOVE_THEN "LINH"(fun th-> REWRITE_TAC[SYM th;pr2;pr3;tran] THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"LINH")) +THEN DISCH_THEN(LABEL_TAC"NHOEM") +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REMOVE_THEN "NHO"(fun th-> MRESAL_TAC th[`s:real`;`y':real^3`][rw_dart_fan;w_dart_fan]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN MP_TAC(SYM th) THEN DISCH_THEN(LABEL_TAC"BELINH")) +THEN MRESA_TAC STEP2_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"NHOLINH") +THEN ASSUME_TAC(SET_RULE`yfan (x:real^3,(V:real^3->bool),E1) SUBSET yfan (x,V,E1) UNION aff_gt {x} {v, w}`) +THEN MRESA_TAC CONNECTED_COMPONENT_MONO[`yfan (x:real^3,(V:real^3->bool),E1)`;`(yfan (x:real^3,(V:real^3->bool),E1) UNION aff_gt {x} {v:real^3, w})`;`y':real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEULINH") +THEN REWRITE_TAC[EXTENSION] +THEN GEN_TAC +THEN EQ_TAC +THENL(*4*)[ +POP_ASSUM MP_TAC +THEN SET_TAC[];(*4*) + + + GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[IN;connected_component ] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE(`(t INTER aff_gt {x} {v:real^3, w}={}) \/ ~(t INTER aff_gt {x} {v, w}={})`)) +THENL(*5*)[ +MP_TAC(SET_RULE`t SUBSET yfan (x,V,E1) UNION aff_gt {x} {v, w}/\ t INTER aff_gt {x} {v, w} = {} +==> t SUBSET yfan (x,V:real^3->bool,E1)`) +THEN ASM_REWRITE_TAC[IN;connected_component ] +THEN STRIP_TAC +THEN EXISTS_TAC`t:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN SET_TAC[IN];(*5*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?z. z IN A`;INTER;IN_ELIM_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN`z IN connected_component (yfan (x,V:real^3->bool,E1) UNION aff_gt {x} {v, w}) y'` +ASSUME_TAC +THENL(*6*)[ +ASM_REWRITE_TAC[IN;connected_component ] +THEN EXISTS_TAC`t:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN SET_TAC[IN];(*6*) +MP_TAC(SET_RULE`aff_gt {x} {v, w} SUBSET dartset_leads_into_fan x V E ds /\ z IN aff_gt {x} {v, w} +==> z IN dartset_leads_into_fan x (V:real^3->bool) E ds`) +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`z IN connected_component (yfan (x,V,E1) UNION aff_gt {x} {v, w}) y'' +/\ z IN connected_component (yfan (x,V,E1) UNION aff_gt {x} {v, w}) y' +==> ~(connected_component (yfan (x,V,E1) UNION aff_gt {x} {v, w}) y' INTER connected_component (yfan (x,V:real^3->bool,E1) UNION aff_gt {x} {v, w}) y''={})`) +THEN ASM_REWRITE_TAC[CONNECTED_COMPONENT_OVERLAP] +THEN STRIP_TAC +THEN REMOVE_THEN"YEULINH" MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN"NHOLINH" (fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_THEN"EM" (fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_THEN"BELINH" (fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "NHO1"(fun th-> MRESAL_TAC th[`s:real`;`y':real^3`][rw_dart_fan;w_dart_fan]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN MP_TAC(th) THEN DISCH_THEN(LABEL_TAC"BELINH")) +THEN REMOVE_THEN "NHOEM"(fun th-> REWRITE_TAC[SYM th] THEN MP_TAC(SYM th) THEN DISCH_THEN(LABEL_TAC"BELINH12")) +THEN REMOVE_THEN "MAT" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "LINH"(fun th-> ASM_REWRITE_TAC[SYM th;tran]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN MP_TAC(SYM th) THEN DISCH_THEN(LABEL_TAC"BELINH123")) +THEN MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION + dartset_leads_into_fan x (V:real^3->bool) E1 ds2 UNION + aff_gt {x} {v, w}:real^3->bool`] +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC AFF_GE_SUBSET_XFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE` aff_ge {x} {v, w} SUBSET xfan (x,V,E1) /\ aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w} +==> aff_gt {x:real^3} {v, w} SUBSET xfan (x,V:real^3->bool,E1)`) +THEN RESA_TAC +THEN MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(ds0:real^3#real^3#real^3#real^3->bool)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;` tranf x (V:real^3->bool)( E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`aff_gt {x} {v, w} SUBSET xfan (x,V,E1) +/\ dartset_leads_into_fan x V E1 (tranf x V E E1 ds0) SUBSET (:real^3) DIFF xfan (x,V,E1) /\ dartset_leads_into_fan x V E1 (tranf x V E E1 ds0) SUBSET + dartset_leads_into_fan x V E1 ds1 UNION + dartset_leads_into_fan x V E1 ds2 UNION + aff_gt {x} {v, w} +==> dartset_leads_into_fan x V E1 (tranf x (V:real^3->bool)( E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool)) SUBSET + dartset_leads_into_fan x V E1 ds1 UNION + dartset_leads_into_fan x V E1 ds2`) +THEN RESA_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN STRIP_TAC +THEN SUBGOAL_THEN`y''' IN dartset_leads_into_fan x V (E1:(real^3->bool)->bool) (tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool))` +ASSUME_TAC +THENL(*7*)[ +ASM_REWRITE_TAC[IN] +THEN MATCH_MP_TAC CONNECTED_COMPONENT_REFL +THEN ASM_REWRITE_TAC[];(*7*) +MP_TAC(SET_RULE`y''' IN dartset_leads_into_fan x V (E1:(real^3->bool)->bool) (tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool)) +/\ dartset_leads_into_fan x V E1 (tranf x V E E1 ds0) SUBSET + dartset_leads_into_fan x V E1 ds1 UNION + dartset_leads_into_fan x V E1 ds2 +==> y''' IN dartset_leads_into_fan x V E1 ds1\/ y''' IN dartset_leads_into_fan x V E1 ds2`) +THEN RESA_TAC +THENL(*8*)[ + + +POP_ASSUM MP_TAC +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`(ds1:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y'''':real^3`;`y''':real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool)`] +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`dartset_leads_into_fan x V (E1:(real^3->bool)->bool) (tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool))`) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(ds1:real^3#real^3#real^3#real^3->bool)` +THEN MRESA1_TAC th`(tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool))`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[];(*8*) + +POP_ASSUM MP_TAC +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`(ds2:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y'''':real^3`;`y''':real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool)`] +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`dartset_leads_into_fan x V (E1:(real^3->bool)->bool) (tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool))`) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(ds2:real^3#real^3#real^3#real^3->bool)` +THEN MRESA1_TAC th`(tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool))`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[]]]]]]]]]);; + + + + + +let conforming_bijection_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> + +!s. s IN topological_component_yfan (x,V,E) ==> (?!f. f IN face_set (hypermap1_of_fanx (x,V,E)) /\ + s = dartset_leads_into_fan x V E f)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REWRITE_TAC[EXISTS_UNIQUE] +THEN MRESA_TAC version_JUTSTKG[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`s:real^3->bool`] +THEN EXISTS_TAC`f:real^3#real^3#real^3#real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE] +THEN REPEAT STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN DISJ_CASES_TAC(SET_RULE`~(ds=y)\/ (y=ds:real^3#real^3#real^3#real^3->bool)`) +THENL[ +MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3->bool)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (y:real^3#real^3#real^3#real^3->bool)`] +THEN MRESA_TAC dartset_leads_into_fan_eq_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(y:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(ds=f)\/ (f=ds:real^3#real^3#real^3#real^3->bool)`) +THENL[ + +MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(f:real^3#real^3#real^3#real^3->bool)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool)`] +THEN MRESA_TAC dartset_leads_into_fan_eq_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(f:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th`dartset_leads_into_fan x V E1 (tranf x V (E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool))`) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(tranf x V (E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool))` THEN MRESA1_TAC th`(tranf x V (E:(real^3->bool)->bool) E1 (y:real^3#real^3#real^3#real^3->bool))`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESAL_TAC INJ_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3->bool)`;`(f:real^3#real^3#real^3#real^3->bool)`][DELETE;IN_ELIM_THM]; + +REMOVE_THEN "LINH1" MP_TAC +THEN MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC AFF_GE_SUBSET_XFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE` aff_ge {x} {v, w} SUBSET xfan (x,V,E1) /\ aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w} +==> aff_gt {x:real^3} {v, w} SUBSET xfan (x,V:real^3->bool,E1)`) +THEN RESA_TAC +THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;` tranf x (V:real^3->bool)( E:(real^3->bool)->bool) E1 (y:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC exists_in_aff_gt_disjoint[`x:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]; + + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN DISJ_CASES_TAC(SET_RULE`~(ds=f)\/ (f=ds:real^3#real^3#real^3#real^3->bool)`) +THENL[ +MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(f:real^3#real^3#real^3#real^3->bool)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool)`] +THEN MRESA_TAC dartset_leads_into_fan_eq_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(f:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}:real^3->bool`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC AFF_GE_SUBSET_XFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE` aff_ge {x} {v, w} SUBSET xfan (x,V,E1) /\ aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w} +==> aff_gt {x:real^3} {v, w} SUBSET xfan (x,V:real^3->bool,E1)`) +THEN RESA_TAC +THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;` tranf x (V:real^3->bool)( E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC exists_in_aff_gt_disjoint[`x:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; +ASM_REWRITE_TAC[]]]);; + + + + +let RADIAL_AFF_GT_1_2 = prove(`!x u v r. + (DISJOINT {(x:real^B)} {u,v} /\ (r > &0) ) ==> + radial_norm r x (aff_gt {x} {u,v} INTER normball x r)`, +REWRITE_TAC[radial_norm] +THEN REPEAT STRIP_TAC +THENL[SET_TAC[]; +UNDISCH_TAC `(x:real^B) + u' IN aff_gt {x} {u, v} INTER normball x r` +THEN ASM_SIMP_TAC[AFF_GT_1_2] +THEN REWRITE_TAC[IN_ELIM_THM;IN_INTER] +THEN REPEAT STRIP_TAC +THENL[ +EXISTS_TAC `&1 + (t:real) * t1 - t` +THEN EXISTS_TAC `(t:real) * t2` +THEN EXISTS_TAC `(t:real) * t3` +THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 + t * t1 - t) + t * t2 + t * t3 = &1 + t * (t1 + t2 +t3)-t `; REAL_ARITH`&1 + t * &1 - t = &1`;VECTOR_ARITH`(&1 + t * t1 - t) % x + (t * t2) % u + (t * t3) % v=x + t % (t1 % x + t2 % u + t3 % v) - t %x`;] +THEN MP_TAC(REAL_ARITH`t> &0 ==> &0< t`) THEN RESA_TAC +THEN SUBGOAL_THEN `&0 < t * t2 /\ &0 < t * t3` (fun t -> REWRITE_TAC[t]) +THENL[ ASM_MESON_TAC[REAL_LT_MUL];REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN VECTOR_ARITH_TAC]; + + +MATCH_MP_TAC aff_normball +THEN ASM_REWRITE_TAC[]]]);; + + +let NORMBALL_SUBSET=prove(`!x r r'. r<= r' ==> normball x r SUBSET normball x r'`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;normball] +THEN GEN_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC);; + + +let RADIAL_NORM_CO=prove(`!r r' (x:real^3) C. r' <= r /\ &0< r' ==> (radial_norm r x (C INTER (normball x r))) ==> (radial_norm r' x (C INTER (normball x r')))`, +REWRITE_TAC[radial_norm] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC NORMBALL_SUBSET[`x:real^3`;`r':real`;`r:real`] +THENL[ +ASM_TAC +THEN SET_TAC[]; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`x + u IN C INTER normball x r' +/\ normball x r' SUBSET normball x r +==> (x:real^3) + u IN C INTER normball x r`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t * norm u < r' /\ r'<=r /\ t> &0 /\ &0< r' ==> &0< r /\ &0<=t /\ &0 t * r * inv r' > &0 /\ &0 <= t * r * inv r'/\ (t * r * inv r') * norm u < r* (inv r' * r')`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A * &1=A`] +THEN STRIP_TAC +THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th`u:real^3`) +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`t:real`[INTER;IN_ELIM_THM] THEN MRESAL1_TAC th`t * r * inv (r'):real`[INTER;IN_ELIM_THM]) +THEN POP_ASSUM MP_TAC +THEN MRESA1_TAC REAL_ABS_REFL `t:real` +THEN MRESA1_TAC REAL_ABS_REFL `t * r * inv r':real` +THEN ASM_REWRITE_TAC[normball;IN_ELIM_THM;dist;VECTOR_ARITH`(A+B)-A=B:real^3`;NORM_MUL]]);; + + +let tranf_eq_image_of_tran=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ds0 IN face_set(hypermap1_of_fanx (x,V,E)) DELETE ds +==> tranf x V E E1 ds0= IMAGE (tran x V E1) ds0`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MP_TAC(SET_RULE`ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds ==> ds0 IN face_set (hypermap1_of_fanx (x:real^3,V,E))`) +THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"LINH") +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC TRANF[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0:real^3#real^3#real^3#real^3->bool` ] +THEN MP_TAC(SET_RULE`y IN ds0 /\ ds0 SUBSET d1_fan (x,V,E)==> y IN d1_fan (x,V:real^3->bool,E)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`tran x (V:real^3->bool) E1 (y:real^3#real^3#real^3#real^3) IN d1_fan (x,V:real^3->bool,E1)` +ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN REWRITE_TAC[tran] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v':real^3` +THEN EXISTS_TAC`w':real^3` +THEN EXISTS_TAC`sigma_fan x V E1 v' w':real^3` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN SET_TAC[]; +SUBGOAL_THEN`~(y IN ds:real^3#real^3#real^3#real^3->bool)` ASSUME_TAC +THENL[ +FIND_ASSUM MP_TAC`ds IN face_set(hypermap1_of_fanx (x,V:real^3->bool,E))` +THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face] +THEN REWRITE_TAC[orbit_map;IN_ELIM_THM] +THEN USE_THEN"EM"MP_TAC +THEN REWRITE_TAC[DELETE;face_set;IN_ELIM_THM;set_of_orbits] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x'':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN FIND_ASSUM MP_TAC`ds0 IN face_set (hypermap1_of_fanx (x,V:real^3->bool,E)) DELETE ds` +THEN REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN SET_TAC[]; + +ASM_REWRITE_TAC[IMAGE;face;orbit_map;EXTENSION;IN_ELIM_THM] +THEN USE_THEN"LINH"MP_TAC +THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face] +THEN REWRITE_TAC[orbit_map;IN_ELIM_THM] +THEN EQ_TAC +THEN REPEAT STRIP_TAC +THENL[ + + +EXISTS_TAC`(res (f1_fan x V E) (d1_fan (x,V,E)) POWER n) (y:real^3#real^3#real^3#real^3)` +THEN STRIP_TAC +THENL[ +EXISTS_TAC`n:num` +THEN ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`tran (x:real^3) (V:real^3->bool) E1 (y:real^3#real^3#real^3#real^3)` ) +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN_POWER +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`;`n:num`]]; + + +EXISTS_TAC`n:num` +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`tran (x:real^3) (V:real^3->bool) E1 (y:real^3#real^3#real^3#real^3)` ) +THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN_POWER +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`;`n:num`] +]]]) +;; + + +let azim_fanadd_eq=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0 y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ds0 IN face_set(hypermap1_of_fanx (x,V,E)) DELETE ds +/\ y IN ds0 +==> azim_fan x V E1 (pr2 (tran x V E1 y)) (pr3 (tran x V E1 y)) += azim_fan x V E (pr2 y) (pr3 y)`, + + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MP_TAC(SET_RULE`ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds ==> ds0 IN face_set (hypermap1_of_fanx (x:real^3,V,E))`) +THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"LINH") +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC TRANF[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0:real^3#real^3#real^3#real^3->bool` ] +THEN MP_TAC(SET_RULE`y IN ds0 /\ ds0 SUBSET d1_fan (x,V,E)==> y IN d1_fan (x,V:real^3->bool,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[tran;pr2;pr3;azim_fan] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w':real^3)`; +`(v':real^3)`] +THEN REMOVE_ASSUM_TAC +THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `v':real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E1) > 1` +THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `v':real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E) > 1` +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN RESA_TAC +THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(v' IN {v, w})\/ (v' = v /\ ~(u=w')) \/ (v' = v /\ (u=w')) \/ (v' = w /\ ~(w'=inverse1_sigma_fan x (V:real^3->bool) E w u )) \/ (v' = w /\ (w'=inverse1_sigma_fan x V E w u ))`) +THENL[ + +MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v':real^3`;`w':real^3`]); +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL[ + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT4[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`w':real^3`]; + +SUBGOAL_THEN`f1=y:real^3#real^3#real^3#real^3` +ASSUME_TAC +THENL[ + MP_TAC(SET_RULE`y IN ds0 /\ ds0 SUBSET d1_fan (x,V,E)==> y IN d1_fan (x,V:real^3->bool,E)`) +THEN RESA_TAC +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f1:real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`;][pr2;pr3]; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN REMOVE_THEN "LINH" MP_TAC +THEN REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN RESA_TAC +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x'':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN FIND_ASSUM MP_TAC`ds IN face_set (hypermap1_of_fanx (x:real^3,V,E))` +THEN REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x'':real^3#real^3#real^3#real^3`;`f1:real^3#real^3#real^3#real^3`][face] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC`ds0 IN face_set (hypermap1_of_fanx (x,V:real^3->bool,E)) DELETE ds` +THEN REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN SET_TAC[]]; + + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT5[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`w':real^3`]; + + +SUBGOAL_THEN`f3=y:real^3#real^3#real^3#real^3` +ASSUME_TAC +THENL[ + MP_TAC(SET_RULE`y IN ds0 /\ ds0 SUBSET d1_fan (x,V,E)==> y IN d1_fan (x,V:real^3->bool,E)`) +THEN RESA_TAC +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f3:real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`;][pr2;pr3] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]; + +MP_TAC(SET_RULE`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3 +==> f1_fan x V E f2= f1_fan x V E (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN REWRITE_TAC[]) +THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[th;f1_fan]) +THEN FIND_ASSUM (fun th-> REWRITE_TAC[SYM th])`(x,u,w,(v:real^3)) = f30:real^3#real^3#real^3#real^3` +THEN REWRITE_TAC[]]; + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN REMOVE_THEN "LINH" MP_TAC +THEN REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN RESA_TAC +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x'':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN FIND_ASSUM MP_TAC`ds IN face_set (hypermap1_of_fanx (x:real^3,V,E))` +THEN REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x'':real^3#real^3#real^3#real^3`;`f3:real^3#real^3#real^3#real^3`][face] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC`ds0 IN face_set (hypermap1_of_fanx (x,V:real^3->bool,E)) DELETE ds` +THEN REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN SET_TAC[]]]]);; + + + + +let eventally_measurable_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 f. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ f IN face_set (hypermap1_of_fanx (x,V,E)) + ==> let U = dartset_leads_into_fan x V E f in + ((!r. measurable (ball (x,r) INTER U)) /\ + eventually_radial x U) `, + + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[conforming_fan;conforming_solid_angle_fan;] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN STRIP_TAC +THENL(*1*)[ +DISJ_CASES_TAC(SET_RULE`~(ds=f)\/ (f=ds:real^3#real^3#real^3#real^3->bool)`) +THENL(*2*)[ +MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(f:real^3#real^3#real^3#real^3->bool)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_fan_eq_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(f:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN"LINH"(fun th-> MRESA1_TAC th` tranf x (V:real^3->bool)( E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool)`);(*2*) + +MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}:real^3->bool`] +THEN REWRITE_TAC[SET_RULE`A INTER (B UNION C UNION D)=(A INTER B) UNION (A INTER C) UNION (A INTER D)`] +THEN MATCH_MP_TAC MEASURABLE_UNION +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN REMOVE_THEN"LINH"(fun th-> MRESA1_TAC th` (ds1:real^3#real^3#real^3#real^3->bool)` THEN MRESA1_TAC th` (ds2:real^3#real^3#real^3#real^3->bool)`) +THEN MATCH_MP_TAC MEASURABLE_UNION +THEN ASM_REWRITE_TAC[MEASURABLE_BALL_AFF_GT]];(*1*) + + +DISJ_CASES_TAC(SET_RULE`~(ds=f)\/ (f=ds:real^3#real^3#real^3#real^3->bool)`) +THENL(*2*)[ +MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(f:real^3#real^3#real^3#real^3->bool)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_fan_eq_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(f:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN"LINH"(fun th-> MRESA1_TAC th` tranf x (V:real^3->bool)( E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool)`);(*2*) + +MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}:real^3->bool`] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN REMOVE_THEN"LINH"(fun th-> MRESA1_TAC th` (ds1:real^3#real^3#real^3#real^3->bool)` THEN MRESA1_TAC th` (ds2:real^3#real^3#real^3#real^3->bool)`) +THEN ASM_TAC +THEN REWRITE_TAC[SET_RULE`A INTER (B UNION C UNION D)=(A INTER B) UNION (A INTER C) UNION (A INTER D)`;eventually_radial;radial;ball_eq_normball;] +THEN REPEAT STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN STRIP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH2") +THEN EXISTS_TAC`min r (r':real)` +THEN MP_TAC(REAL_ARITH`r> &0 /\ r' > &0==> min r (r':real)> &0 /\ &0< min r (r':real)/\ min r r' <= r /\ min r r' <= r'`) +THEN RESA_TAC +THEN MRESA_TAC NORMBALL_SUBSET[`x:real^3`;`min r r':real`;`r:real`] +THEN MRESA_TAC NORMBALL_SUBSET[`x:real^3`;`min r r':real`;`r':real`] +THEN REWRITE_TAC[SET_RULE`A INTER B SUBSET B`;SET_RULE`(B UNION C UNION D) INTER A=(B INTER A) UNION (C INTER A) UNION (D INTER A)`] +THEN REWRITE_TAC[UNION;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`t * norm u' < min r r'==> t * norm u' < r' /\ t * norm (u':real^3) < r`) +THEN RESA_TAC +THENL[ + +MRESAL_TAC RADIAL_NORM_CO[`r:real`;`min r r':real`;`x:real^3`;`dartset_leads_into_fan x V E1 (ds1:real^3#real^3#real^3#real^3->bool)`][radial_norm] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u':real^3`) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`t:real`);(**) + +MRESAL_TAC RADIAL_NORM_CO[`r':real`;`min r r':real`;`x:real^3`;`dartset_leads_into_fan x V E1 (ds2:real^3#real^3#real^3#real^3->bool)`][radial_norm;SET_RULE`A INTER B SUBSET B`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u':real^3`) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`t:real`); + + +MP_TAC(SET_RULE`E UNION {{v,w}}=E1==> {v,w:real^3} IN E1`) THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E1:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`] +THEN MRESAL_TAC RADIAL_AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`;`min r r':real`;][radial_norm] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u':real^3`) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`t:real`)]]]);; + + + +let SOL_AFF_GT_2_1=prove(`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u}==> sol x (aff_gt {x} {v,u})= &0`, +REPEAT STRIP_TAC +THEN MRESA_TAC MEASURABLE_AFF_GT_2_1_INTER_BALL[`x:real^3`;`v:real^3`;`u:real^3`;`&1:real`] +THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]th3) THEN RESA_TAC +THEN MRESAL_TAC RADIAL_AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`;`&1:real`;][REAL_ARITH`&1> &0`] +THEN MRESAL_TAC sol[`x:real^3`;`aff_gt {x} {v,u}:real^3->bool`;`&1`][REAL_ARITH`&1> &0`;SET_RULE`{} INTER normball x (&1)={}`; MEASURABLE_AFF_GT_2_1_INTER_BALL] +THEN MRESA_TAC MEASURE_AFF_GT_2_1_INTER_BALL[`x:real^3`;`v:real^3`;`u:real^3`;`&1:real`] +THEN REAL_ARITH_TAC);; + + + +let inverse1_sigma_fan_FANADD1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> inverse1_sigma_fan x V E1 v (sigma_fan x V E v u) = w`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MATCH_MP_TAC MONO_SIGMA_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E1:(real^3->bool)->bool` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (sigma_fan x V E v u:real^3)`; +`v:real^3`] +THEN MP_TAC(SET_RULE`{v, sigma_fan x V E v u:real^3} IN E /\ E UNION {{v,w}}= E1 +==> {v, sigma_fan x V E v u} IN E1/\ {v,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `sigma_fan x V E v u:real^3`) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `sigma_fan x V E v u:real^3`) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (E1:(real^3->bool)->bool)` +;`v:real^3`;`u:real^3`; `w:real^3`]);; + + + +let inverse1_sigma_fan_FANADD2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> inverse1_sigma_fan x V E1 v w=u`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MATCH_MP_TAC MONO_SIGMA_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E1:(real^3->bool)->bool` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`{v, u:real^3} IN E /\ E UNION {{v,w}}= E1 +==> {v, u} IN E1/\ {v,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (E1:(real^3->bool)->bool)` +;`v:real^3`;`u:real^3`; `w:real^3`]);; + + + +let inverse1_sigma_fan_FANADD3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> inverse1_sigma_fan x V E1 u v=w`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MATCH_MP_TAC MONO_SIGMA_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E1:(real^3->bool)->bool` +THEN EXISTS_TAC`u:real^3` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`{v, u:real^3} IN E /\ { u:real^3,w} IN E /\ E UNION {{v,w}}= E1 +==> {u,w} IN E1/\ {v,w} IN E1/\ {v,u} IN E1 `) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`) +THEN RESA_TAC +THEN RESA_TAC);; + + + + + +let DS1_DS2_EQ_DS_FANADD1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ed1 ed2. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1=face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2=face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ed1=(x,v,w,sigma_fan x V E1 v w) +/\ ed2=(x,w,v,sigma_fan x V E1 w v) +==> (ds1 UNION ds2) DELETE ed1 DELETE ed2 SUBSET IMAGE (tran x V E1) ds`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] + +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN REWRITE_TAC[face;IN_ELIM_THM] +THEN SUBGOAL_THEN`x,v,w,sigma_fan x V E1 v w IN ds1:real^3#real^3#real^3#real^3->bool`ASSUME_TAC +THENL(*1*)[ + +ASM_REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF];(*1*) + +MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(ARITH_RULE`3<= CARD (ds1:real^3#real^3#real^3#real^3->bool) ==> ~(CARD ds1=0)`) +THEN RESA_TAC +THEN MRESA_TAC lemma_face_cycle[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E1)`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`] +THEN MRESA_TAC orbit_cyclic[`(res (f1_fan x V E1) (d1_fan (x:real^3,V,E1)))`;`(CARD (ds1:real^3#real^3#real^3#real^3->bool)):num`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`] +THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(ARITH_RULE`3<= CARD (ds2:real^3#real^3#real^3#real^3->bool) ==> ~(CARD ds2=0)`) +THEN RESA_TAC +THEN MRESA_TAC lemma_face_cycle[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E1)`;`(x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3`] +THEN MRESA_TAC orbit_cyclic[`(res (f1_fan x V E1) (d1_fan (x:real^3,V,E1)))`;`(CARD (ds2:real^3#real^3#real^3#real^3->bool)):num`;`(x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3`] +THEN MP_TAC(SET_RULE`x,v,w,sigma_fan x V E1 v w IN ds1 /\ ds1 SUBSET d1_fan (x:real^3,V,E1)==> x,v,w,sigma_fan x V E1 v w IN d1_fan (x,V,E1)`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`ds IN face_set(hypermap1_of_fanx (x,V:real^3->bool,E))` +THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] +THEN RESA_TAC +THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x':real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) +THEN RESA_TAC +THEN REWRITE_TAC[orbit_map;IMAGE;IN_ELIM_THM;UNION;DELETE;SUBSET] +THEN GEN_TAC +THEN REPEAT STRIP_TAC +THENL(*1*)[ + +EXISTS_TAC`(res (f1_fan x V E) (d1_fan (x,V,E)) POWER k) + f2:real^3#real^3#real^3#real^3` +THEN STRIP_TAC +THENL(*2*)[ + +EXISTS_TAC`k:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`k:num>=0`];(*2*) + +MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`f2:real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3` ) +THEN DISJ_CASES_TAC(ARITH_RULE`k=0 \/ k>0`) +THENL(*3*)[ + +POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th;POWER;I_DEF]) +THEN SET_TAC[];(*3*) + + SUBGOAL_THEN`?m. k= SUC m`ASSUME_TAC +THENL(*4*)[ +EXISTS_TAC`k-1:num` +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC;(*4*) + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN REWRITE_TAC[POWER;o_DEF;] +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL(*5*)[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*5*) + +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[f1_fan] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN SUBGOAL_THEN`(x,w,inverse1_sigma_fan x V E w u,v) = + tran x (V:real^3->bool) E1 + (x,w,inverse1_sigma_fan x V E w u,u:real^3)` +ASSUME_TAC +THENL(*6*)[ +REWRITE_TAC[tran] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC;(*6*) + +POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN ONCE_REWRITE_TAC[SET_RULE`x=y <=> y=x`] +THEN ABBREV_TAC`y=(x,w,inverse1_sigma_fan x V E w u,u:real^3)` +THEN SUBGOAL_THEN`y IN d1_fan (x,V:real^3->bool,E)` ASSUME_TAC +THENL(*7*)[ + +POP_ASSUM(fun th-> REWRITE_TAC[SYM th; d1_fan;IN_ELIM_THM]) +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`inverse1_sigma_fan x V E w u:real^3` +THEN EXISTS_TAC`u:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC;(*7*) + + +MRESAL_TAC TRAN_COMMUTATIVE_F1_FAN_POWER3 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`;`m:num`][f1_fan;] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[GSYM f1_fan] +THEN ABBREV_TAC`y1=(x,sigma_fan x V E v u,v:real^3,sigma_fan x V E (sigma_fan x V E v u) v)` +THEN SUBGOAL_THEN`!m'. m' < m ==> (!k. k <= m'==> ~((f1_fan (x:real^3) V E POWER k) y=y1) /\ ~((f1_fan (x:real^3) V E POWER k) y=f2))` ASSUME_TAC +THENL(*8*)[ + + +INDUCT_TAC +THENL(*9*)[ + +STRIP_TAC +THEN GEN_TAC +THEN REWRITE_TAC[ARITH_RULE`k<=0 <=> k=0`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[POWER;I_DEF] +THEN EXPAND_TAC"y" +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[EQ_PAIR_4] +THEN REPEAT STRIP_TAC +THENL(*10*)[ + +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> ASSUME_TAC (SYM th)) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*10*) + +FIND_ASSUM MP_TAC`pr2 f2=u:real^3` +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`u:real^3`]](*10*);(*9*) + + + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN STRIP_TAC +THEN GEN_TAC +THEN MP_TAC(ARITH_RULE`SUC m' < m ==> m' < m:num`) +THEN RESA_TAC +THEN REWRITE_TAC[ARITH_RULE`k <= SUC m'<=> k <= m' \/ k = SUC m'`] +THEN STRIP_TAC +THENL(*10*)[ + +REMOVE_THEN "A" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`k':num`);(*10*) + +REMOVE_THEN "A" MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`k<= m' <=> k < SUC m'`] +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN SUBGOAL_THEN `y1 IN d1_fan(x,V:real^3->bool,E)`ASSUME_TAC +THENL(*11*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E (sigma_fan x V E v u) v:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (sigma_fan x V E v u:real^3)`; +`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*11*) + + +SUBGOAL_THEN`!k. k < SUC m' + ==> (~(pr2 ((f1_fan x V E POWER k) y) = sigma_fan x V E v u) /\ + pr3 ((f1_fan x V E POWER k) y) = v) \/ + (~(pr2 ((f1_fan x V E POWER k) y) = u) /\ + pr3 ((f1_fan x V E POWER k) y) = w) \/ +~(pr3 ((f1_fan x V E POWER k) y) IN {v, w})` ASSUME_TAC +THENL(*12*)[ + + +REPEAT STRIP_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th`k'':num`) +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k'':num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`((y:real^3#real^3#real^3#real^3))`) +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER k'') y):real^3#real^3#real^3#real^3`;`y1:real^3#real^3#real^3#real^3`][PAIR_EQ] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[pr2;pr3] +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER k'') y):real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`][PAIR_EQ;pr2;pr3] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*12*) + +MRESA_TAC TRAN_COMMUTATIVE_F1_FAN_POWER3 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`;`SUC m':num`] +THEN SUBGOAL_THEN`~(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) ((f1_fan x V E POWER SUC m') y) = tran x V E1 (y1:real^3#real^3#real^3#real^3)) /\ + ~(tran x V E1((f1_fan x V E POWER SUC m') y) = tran x V E1 (f2:real^3#real^3#real^3#real^3))`ASSUME_TAC +THENL(*13*)[ + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`tran x (V:real^3->bool) (E1:(real^3->bool)->bool) (y:real^3#real^3#real^3#real^3)= f1_fan x V E1(f1_fan x V E1 (tran x (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3))) ` +ASSUME_TAC +THENL(*14*)[ + +EXPAND_TAC"y" +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[tran;f1_fan] +THEN MRESA_TAC inverse1_sigma_fan_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT6[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ;`inverse1_sigma_fan x V E w u:real^3`];(*14*) + + + +ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THENL(*15*)[ +POP_ASSUM MP_TAC +THEN REWRITE_TAC[POWER;o_DEF] +THEN STRIP_TAC +THEN MRESAL_TAC card_orbit_le[`f1_fan (x:real^3) V (E1:(real^3->bool)->bool)`;`SUC(SUC(SUC m'))`;`(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3))`][ARITH_RULE`~(SUC (SUC (SUC m')) = 0)`;POWER;o_DEF] +THEN MP_TAC(ARITH_RULE`SUC m':num < m /\ SUC m=k /\ k< CARD (ds1:real^3#real^3#real^3#real^3->bool) +==> SUC(SUC (SUC m'))< CARD ds1`) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`k= SUC m:num` +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`(x,v,w,sigma_fan x V E1 v w)= (f1_fan x V E1 (tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3))) ` +ASSUME_TAC +THENL(*16*)[ +EXPAND_TAC"y1" +THEN REWRITE_TAC[tran;f1_fan] +THEN MRESA_TAC inverse1_sigma_fan_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ];(*16*) + +SUBGOAL_THEN`tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3) IN d1_fan (x:real^3,V,E1)` +ASSUME_TAC +THENL(*17*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM;tran] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 (sigma_fan x V E v u) v:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (sigma_fan x V E v u:real^3)`; +`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN EXPAND_TAC"y1" +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`{v:real^3, sigma_fan x V E v u} IN E /\ E UNION {{v, w}} = E1 ==> {v, sigma_fan x V E v u} IN E1`) +THEN ASM_REWRITE_TAC[];(*17*) + + +MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`;`tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3):real^3#real^3#real^3#real^3`;] + +THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E1)`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`;`(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[face] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC(SYM th)) +THEN STRIP_TAC THEN STRIP_TAC THEN STRIP_TAC +THEN ASM_REWRITE_TAC[orbit_map] +THEN STRIP_TAC +THEN SUBGOAL_THEN`{(f1_fan x V E1 POWER n) (tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3)) | n >= 0}=ds1` +ASSUME_TAC +THENL(*18*)[ + +ASM_REWRITE_TAC[] +THEN REWRITE_TAC[face;orbit_map] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL(*19*)[ + +REPEAT STRIP_TAC +THEN EXISTS_TAC`(n:num)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3`);(*19*) +REPEAT STRIP_TAC +THEN EXISTS_TAC`(n:num)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3`)](*19*);(*18*) + + + +POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[face;orbit_map] +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC](*18*)](*17*)](*16*);(*15*) + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN SUBGOAL_THEN`tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y:real^3#real^3#real^3#real^3) IN d1_fan (x:real^3,V,E1)` +ASSUME_TAC +THENL(*16*)[ +EXPAND_TAC "y" +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM;tran] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`inverse1_sigma_fan x V E w u:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 w (inverse1_sigma_fan x V E w u):real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{inverse1_sigma_fan x V E w u, w:real^3} IN E /\ E UNION {{v,w}}= E1 +==> {inverse1_sigma_fan x V E w u, w} IN E1`) +THEN RESA_TAC;(*16*) + +MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] + +THEN MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`SUC m'`; `x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`;`(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (f2:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3`;` (tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3`;] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL(*17*)[ + +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*17*) +REWRITE_TAC[tran] +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"y" +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`) +THEN RESA_TAC +THEN RESA_TAC +THEN REWRITE_TAC[SET_RULE`f30 IN {f10, f20, f30}`] +THEN REWRITE_TAC[SET_RULE`y IN {f10, f20, f30:real^3#real^3#real^3#real^3}<=> y =f10\/ y =f20\/ y =f30`] +THEN RESA_TAC +THENL(*18*)[ + +POP_ASSUM MP_TAC +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;EQ_PAIR_4])`x,w,v,u = f10:real^3#real^3#real^3#real^3` +THEN STRIP_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th -> MP_TAC(ISPEC `u:real^3` th)) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*18*) + +POP_ASSUM MP_TAC +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;EQ_PAIR_4])`x,v,u,w = f20:real^3#real^3#real^3#real^3` +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`];(*18*) + +POP_ASSUM MP_TAC +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;EQ_PAIR_4])`x,u,w,v = f30:real^3#real^3#real^3#real^3` +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[]](*18*)](*17*)](*16*)](*15*)](*14*);(*13*) + + +POP_ASSUM MP_TAC +THEN SET_TAC[]](*13*)](*12*)](*11*)](*10*)](*9*);(*8*) + + +SUBGOAL_THEN`!k. k < m==> ~((f1_fan (x:real^3) V E POWER k) y=y1) /\ ~((f1_fan (x:real^3) V E POWER k) y=f2)` ASSUME_TAC +THENL(*9*)[ + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN GEN_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`m=0 \/ m>0`) +THENL(*10*)[ +ASM_REWRITE_TAC[] +THEN ARITH_TAC;(*10*) +MP_TAC(ARITH_RULE`m>0==> m-1< m`) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`k' k'<= m-1`) +THEN RESA_TAC +THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th`m-1:num`) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`k':num`)](*10*);(*9*) + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th`m':num`) +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`m':num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`((y:real^3#real^3#real^3#real^3))`) +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`y1:real^3#real^3#real^3#real^3`][PAIR_EQ] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[pr2;pr3] + +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`][PAIR_EQ;pr2;pr3] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN `y1 IN d1_fan(x,V:real^3->bool,E)`ASSUME_TAC +THENL(*10*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E (sigma_fan x V E v u) v:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (sigma_fan x V E v u:real^3)`; +`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*10*) + +ASM_REWRITE_TAC[] +THEN SET_TAC[]](*10*)](*9*)](*8*)]]]]]];(*1*) + + + +ASM_REWRITE_TAC[] +THEN MRESA_TAC card_ds2_fanadd_eq3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[face;] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL(*2*)[ + +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*2*) + +SUBGOAL_THEN`x,w,v,sigma_fan x V E1 w v IN d1_fan (x,V:real^3->bool,E1):real^3#real^3#real^3#real^3->bool`ASSUME_TAC +THENL(*3*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 w v:real^3` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_TAC +THEN SET_TAC[];(*3*) + +MP_TAC(ARITH_RULE`k<3==> k=0 \/ k= SUC 0\/ k = SUC(SUC 0)`) +THEN RESA_TAC +THENL(*4*)[ +POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th;POWER;I_DEF]) +THEN SET_TAC[];(*4*) + + +ASM_REWRITE_TAC[POWER;I_DEF;o_DEF] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`[POWER;I_DEF;o_DEF;f1_fan]) +THEN MRESA_TAC inverse1_sigma_fan_FANADD2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN EXISTS_TAC`(x,v,u,sigma_fan x V E v u:real^3)` +THEN ASM_REWRITE_TAC[tran] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (E1:(real^3->bool)->bool)` +;`v:real^3`;`u:real^3`; `w:real^3`] +THEN SUBGOAL_THEN`f1=(x,v,u,sigma_fan x V E v u:real^3)`ASSUME_TAC +THENL(*5*)[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[PAIR_EQ] +THEN ASM_REWRITE_TAC[pr2;pr3] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN ASM_REWRITE_TAC[];(*5*) + +FIND_ASSUM(MP_TAC)`f1 IN ds:real^3#real^3#real^3#real^3->bool` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[orbit_map;IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`n:num` +THEN ASM_REWRITE_TAC[f1_fan]](*5*);(*4*) + + + MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`[POWER;I_DEF;o_DEF;f1_fan]) +THEN MRESA_TAC inverse1_sigma_fan_FANADD2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC inverse1_sigma_fan_FANADD3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN EXISTS_TAC`(x:real^3,u:real^3,w:real^3,v:real^3)` +THEN REWRITE_TAC[tran] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`) +THEN RESA_TAC +THEN RESA_TAC +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF] +THEN MRESA_TAC f2_EQ_F30_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +]]]]]);; + + + + + +let DS1_DS2_EQ_DS_FANADD2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ed1 ed2. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1=face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2=face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ed1=(x,v,w,sigma_fan x V E1 v w) +/\ ed2=(x,w,v,sigma_fan x V E1 w v) +==> IMAGE (tran x V E1) ds SUBSET (ds1 UNION ds2) DELETE ed1 DELETE ed2 `, + + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] + +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN REWRITE_TAC[face;IN_ELIM_THM] +THEN SUBGOAL_THEN`x,v,w,sigma_fan x V E1 v w IN ds1:real^3#real^3#real^3#real^3->bool`ASSUME_TAC +THENL(*1*)[ +ASM_REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF];(*1*) + +SUBGOAL_THEN`x,w,v,sigma_fan x V E1 w v IN d1_fan (x,V:real^3->bool,E1):real^3#real^3#real^3#real^3->bool`ASSUME_TAC +THENL(*2*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E1 w v:real^3` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_TAC +THEN SET_TAC[];(*2*) + +MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(ARITH_RULE`3<= CARD (ds:real^3#real^3#real^3#real^3->bool) ==> ~(CARD ds=0)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`x,v,w,sigma_fan x V E1 v w IN ds1 /\ ds1 SUBSET d1_fan (x:real^3,V,E1)==> x,v,w,sigma_fan x V E1 v w IN d1_fan (x,V,E1)`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`ds IN face_set(hypermap1_of_fanx (x,V:real^3->bool,E))` +THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] +THEN RESA_TAC +THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x':real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) +THEN RESA_TAC +THEN MRESAL_TAC lemma_face_cycle[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`f2:real^3#real^3#real^3#real^3`][face] +THEN MRESA_TAC orbit_cyclic[`(res (f1_fan x V E) (d1_fan (x:real^3,V,E)))`;`(CARD (ds:real^3#real^3#real^3#real^3->bool)):num`;`f2:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[orbit_map;IMAGE;IN_ELIM_THM;UNION;DELETE;SUBSET] +THEN GEN_TAC +THEN REPEAT STRIP_TAC +THENL(*32GOAL*)[ + +DISJ_CASES_TAC(ARITH_RULE`k=0\/ k>0`) +THENL(*4*)[ +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;POWER;I_DEF] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN SUBGOAL_THEN(`(?n. n >= 0 /\ + tran x V E1 (f2:real^3#real^3#real^3#real^3) = + (res (f1_fan x V E1) (d1_fan (x,V,E1)) POWER n) + (x,w,v,sigma_fan x V E1 w v:real^3))`) +ASSUME_TAC +THENL(*5*)[ + +EXISTS_TAC`SUC(SUC 0:num)` +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(SUC 0)>=0`] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`SUC(SUC 0):num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`[POWER;I_DEF;o_DEF;f1_fan]) +THEN MRESA_TAC inverse1_sigma_fan_FANADD2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC inverse1_sigma_fan_FANADD3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL(*6*)[ + +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*6*) + +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[tran] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`(v:real^3)`] +THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`) +THEN RESA_TAC +THEN RESA_TAC](*6*);(*5*) + +ASM_REWRITE_TAC[]](*5*);(*4*) + + +MP_TAC(ARITH_RULE`k< CARD ds /\ 3<= CARD (ds:real^3#real^3#real^3#real^3->bool) ==> SUC k = CARD ds \/ SUC k < CARD ds`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[orbit_map] +THEN RESA_TAC +THENL(*5*)[ + + + MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`CARD (ds:real^3#real^3#real^3#real^3->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)`) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)`) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REWRITE_TAC[orbit_map] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;COM_POWER;o_DEF]) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC (SYM th)) +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)`) +THEN MRESA_TAC MONO_F1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[` (f1:real^3#real^3#real^3#real^3)`;` (x''':real^3#real^3#real^3#real^3)`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`(?n. n >= 0 /\ + tran x V E1 (f1:real^3#real^3#real^3#real^3) = + (res (f1_fan x V E1) (d1_fan (x,V,E1)) POWER n) + (x,w,v:real^3,sigma_fan x V E1 w v))` +ASSUME_TAC +THENL(*6*)[ +EXISTS_TAC`SUC(0:num)` +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(0)>=0`] +THEN ASM_REWRITE_TAC[POWER;I_DEF;o_DEF] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`SUC 0:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`[POWER;I_DEF;o_DEF;f1_fan]) +THEN MRESA_TAC inverse1_sigma_fan_FANADD2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN ASM_REWRITE_TAC[tran] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (E1:(real^3->bool)->bool)` +;`v:real^3`;`u:real^3`; `w:real^3`] +THEN SUBGOAL_THEN`f1=(x,v,u,sigma_fan x V E v u:real^3)`ASSUME_TAC +THENL(*7*)[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[PAIR_EQ] +THEN ASM_REWRITE_TAC[pr2;pr3] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN ASM_REWRITE_TAC[];(*7*) + +FIND_ASSUM(MP_TAC)`f1 IN ds:real^3#real^3#real^3#real^3->bool` +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[th])](*7*);(*6*) + + +ASM_REWRITE_TAC[]](*6*);(*5*) + + +MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`f2:real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3` ) +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`?m. k= SUC m`ASSUME_TAC +THENL(*6*)[ + +EXISTS_TAC`k-1:num` +THEN FIND_ASSUM MP_TAC`k:num>0` +THEN ARITH_TAC;(*6*) + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN RESA_TAC +THEN ASM_REWRITE_TAC[POWER;o_DEF;] +THEN SUBGOAL_THEN`(?n. n >= 0 /\ + tran x V E1 ((f1_fan x V E POWER m) f3) = + (res (f1_fan x V E1) (d1_fan (x,V,E1)) POWER n) + (x,v,w,sigma_fan x V E1 v w:real^3))`ASSUME_TAC +THENL(*7*)[ + +EXISTS_TAC`SUC m:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC m>=0`;POWER;o_DEF;f1_fan] +THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN SUBGOAL_THEN`(x,w,inverse1_sigma_fan x V E w u,v) = + tran x (V:real^3->bool) E1 + (x,w,inverse1_sigma_fan x V E w u,u:real^3)` +ASSUME_TAC +THENL(*8*)[ + +REWRITE_TAC[tran] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC;(*8*) +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN SUBGOAL_THEN`(x,w,inverse1_sigma_fan x V E w u,u:real^3)= f1_fan x V E f2` +ASSUME_TAC +THENL(*9*)[ + + SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL(*10*)[ + +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*10*) +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[f1_fan] +THEN ASM_REWRITE_TAC[]](*10*);(*9*) + + +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`f1_fan (x:real^3) V E f2 = f3` +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[] +THEN ABBREV_TAC`y=(x,w,inverse1_sigma_fan x V E w u,u:real^3)` +THEN SUBGOAL_THEN`y IN d1_fan (x,V:real^3->bool,E)` ASSUME_TAC +THENL(*10*)[ + +POP_ASSUM(fun th-> REWRITE_TAC[SYM th; d1_fan;IN_ELIM_THM]) +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`inverse1_sigma_fan x V E w u:real^3` +THEN EXISTS_TAC`u:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC;(*10*) + +MRESAL_TAC TRAN_COMMUTATIVE_F1_FAN_POWER3 +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(y:real^3#real^3#real^3#real^3)`;`m:num`][f1_fan;] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[GSYM f1_fan] +THEN ABBREV_TAC`y1=(x,sigma_fan x V E v u,v:real^3,sigma_fan x V E (sigma_fan x V E v u) v)` +THEN SUBGOAL_THEN`!m'. m' < m ==> ~((f1_fan (x:real^3) V E POWER m') y=y1) /\ ~((f1_fan (x:real^3) V E POWER m') y=f2)` ASSUME_TAC + +THENL(*11*)[ + +STRIP_TAC +THEN SUBGOAL_THEN`y= f1_fan x V E(f1_fan x V E(f1_fan (x:real^3) V E y1))` ASSUME_TAC +THENL(*12*)[ + +EXPAND_TAC "y" +THEN EXPAND_TAC "y1" +THEN REWRITE_TAC[f1_fan] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`);(*12*) + +SUBGOAL_THEN`(f1_fan (x:real^3) V E POWER SUC (SUC 0)) y1 = f2`ASSUME_TAC +THENL(*13*)[ + +EXPAND_TAC "y1" +THEN REWRITE_TAC[f1_fan;POWER;I_DEF;o_DEF] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`) +THEN MRESA_TAC f2_EQ_F30_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;];(*13*) + +ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THENL(*14*)[ + +MRESAL_TAC card_orbit_le[`f1_fan (x:real^3) V (E:(real^3->bool)->bool)`;`SUC(SUC(SUC m'))`;` (y1:real^3#real^3#real^3#real^3)`][ARITH_RULE`~(SUC (SUC (SUC m')) = 0)`;POWER;o_DEF] +THEN MP_TAC(ARITH_RULE`m':num < m /\ SUC m=k /\ SUC k< CARD (ds:real^3#real^3#real^3#real^3->bool) +==> SUC(SUC (SUC m'))< CARD ds`) +THEN ASM_REWRITE_TAC[orbit_map] +THEN FIND_ASSUM (fun th -> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)`k= SUC m:num` +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN `y1 IN d1_fan(x,V:real^3->bool,E)`ASSUME_TAC +THENL(*15*)[ +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E (sigma_fan x V E v u) v:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (sigma_fan x V E v u:real^3)`; +`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*15*) + +MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`SUC (SUC 0)`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f2:real^3#real^3#real^3#real^3`;`(y1:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`f2:real^3#real^3#real^3#real^3`;` (y1:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[orbit_map] +THEN RESA_TAC +THEN SUBGOAL_THEN`{(f1_fan x V E POWER n) ((y1:real^3#real^3#real^3#real^3)) | n >= 0}={(res (f1_fan x V E) (d1_fan (x,V,E)) POWER n) y1 | n >= 0}` +ASSUME_TAC +THENL(*16*)[ + REWRITE_TAC[EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL(*17*)[ +REPEAT STRIP_TAC +THEN EXISTS_TAC`(n:num)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y1:real^3#real^3#real^3#real^3)`);(*17*) + +REPEAT STRIP_TAC +THEN EXISTS_TAC`(n:num)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y1:real^3#real^3#real^3#real^3)`)](*17*);(*16*) + +ASM_REWRITE_TAC[] +THEN ARITH_TAC](*16*)](*15*);(*14*) + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[POWER;o_DEF;I_DEF] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC card_orbit_le[`f1_fan (x:real^3) V (E:(real^3->bool)->bool)`;`(SUC m')`;` (f2:real^3#real^3#real^3#real^3)`][ARITH_RULE`~( (SUC m')= 0)`;POWER;o_DEF] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[orbit_map] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`m':num < m /\ SUC m=k /\ SUC k< CARD (ds:real^3#real^3#real^3#real^3->bool) +==> (SUC m')< CARD ds`) +THEN ASM_REWRITE_TAC[orbit_map] +THEN FIND_ASSUM (fun th -> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)`k= SUC m:num` +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`{(f1_fan x V E POWER n) ((f2:real^3#real^3#real^3#real^3)) | n >= 0}={(res (f1_fan x V E) (d1_fan (x,V,E)) POWER n) f2 | n >= 0}` +ASSUME_TAC +THENL(*15*)[ + + REWRITE_TAC[EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL(*16*)[ +REPEAT STRIP_TAC +THEN EXISTS_TAC`(n:num)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)`);(*16*) + +REPEAT STRIP_TAC +THEN EXISTS_TAC`(n:num)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)`)](*16*);(*15*) + +ASM_REWRITE_TAC[] +THEN ARITH_TAC](*15*)](*14*)](*13*)](*12*);(*11*) + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th`m':num`) +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`m':num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`((y:real^3#real^3#real^3#real^3))`) +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`y1:real^3#real^3#real^3#real^3`][PAIR_EQ] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[pr2;pr3] +THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`][PAIR_EQ;pr2;pr3] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN `y1 IN d1_fan(x,V:real^3->bool,E)`ASSUME_TAC +THENL(*12*)[ +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E (sigma_fan x V E v u) v:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (sigma_fan x V E v u:real^3)`; +`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*12*) + +ASM_REWRITE_TAC[] +THEN SET_TAC[]](*12*)](*11*)](*10*)](*9*)](*8*);(*7*) + +ASM_REWRITE_TAC[]](*7*)](*6*)](*5*)](*4*);(*3*) + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)`) +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`f2:real^3#real^3#real^3#real^3`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[tran] +THEN RESA_TAC +THEN REWRITE_TAC[EQ_PAIR_4] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*3*) + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)`) +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`f2:real^3#real^3#real^3#real^3`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[tran] +THEN RESA_TAC +THEN REWRITE_TAC[EQ_PAIR_4] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[]]]]);; + + + + +let DS1_DS2_EQ_DS_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ed1 ed2. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ ds1=face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2=face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ ed1=(x,v,w,sigma_fan x V E1 v w) +/\ ed2=(x,w,v,sigma_fan x V E1 w v) +==> IMAGE (tran x V E1) ds = (ds1 UNION ds2) DELETE ed1 DELETE ed2 `, +REPEAT STRIP_TAC +THEN MRESA_TAC DS1_DS2_EQ_DS_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(ed1:real^3#real^3#real^3#real^3)`;`(ed2:real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC DS1_DS2_EQ_DS_FANADD2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(ed1:real^3#real^3#real^3#real^3)`;`(ed2:real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + +let azim_fanadd_eq_ds=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ y IN ds +/\ ~(y=f1) +/\ ~(y=f3) +==> azim_fan x V E1 (pr2 (tran x V E1 y)) (pr3 (tran x V E1 y)) += azim_fan x V E (pr2 y) (pr3 y)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E) /\ y IN ds==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds /\ y IN d1_fan (x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> ASSUME_TAC(th) THEN MP_TAC th +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[tran;pr2;pr3;azim_fan] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w':real^3)`; +`(v':real^3)`] +THEN REMOVE_ASSUM_TAC +THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `v':real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E1) > 1` +THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `v':real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E) > 1` +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN RESA_TAC +THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(v' IN {v, w})\/ (v' = v /\ ~(u=w')) \/ (v' = v /\ (u=w')) \/ (v' = w /\ ~(w'=inverse1_sigma_fan x (V:real^3->bool) E w u )) \/ (v' = w /\ (w'=inverse1_sigma_fan x V E w u ))`) + +THENL[ + +MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v':real^3`;`w':real^3`]); + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL[ + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT4[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`w':real^3`]; + +SUBGOAL_THEN`(x',v',w',w1)=f1:real^3#real^3#real^3#real^3` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[pr2;pr3] +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN ASM_REWRITE_TAC[]; + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] ) +THEN SET_TAC[]]; + + + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT5[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`w':real^3`]; + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN SUBGOAL_THEN`x, + w, + inverse1_sigma_fan x V E w u, + sigma_fan x V E w (inverse1_sigma_fan x V E w u)=f1_fan x V E f2:real^3#real^3#real^3#real^3` ASSUME_TAC +THENL[ +SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL[ + +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]; +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[f1_fan] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC]; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] ) +THEN SET_TAC[]]]]);; + + + + + + + + +let TXFBALB=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> conforming_solid_angle_fan(x,V,E)`, + + + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[conforming_fan;conforming_solid_angle_fan;] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN STRIP_TAC +THEN MRESA_TAC eventally_measurable_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(f:real^3#real^3#real^3#real^3->bool)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[conforming_fan;conforming_solid_angle_fan;] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THENL(*1*)[ +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`r:real`);(*1*) + + +DISJ_CASES_TAC(SET_RULE`~(ds=f)\/ (f=ds:real^3#real^3#real^3#real^3->bool)`) +THENL(*2*)[ + +MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +;`(f:real^3#real^3#real^3#real^3->bool)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_fan_eq_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(f:real^3#real^3#real^3#real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN"LINH"(fun th-> MRESA1_TAC th` tranf x (V:real^3->bool)( E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool)`) +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN MRESAL_TAC tranf_eq_image_of_tran[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`f:real^3#real^3#real^3#real^3->bool` ][DELETE;IN_ELIM_THM] +THEN SUBGOAL_THEN` (!x' y. x' IN f /\ y IN (f:real^3#real^3#real^3#real^3->bool) /\ tran x V E1 x' = tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) y ==> x' = y)` +ASSUME_TAC +THENL(*3*)[ + +REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`x' IN f /\ y IN (f:real^3#real^3#real^3#real^3->bool) +/\ f SUBSET d1_fan (x,V,E)/\ E UNION {{v, w:real^3}} = E1 ==> E SUBSET E1/\ x' IN d1_fan (x,V,E) /\ y IN d1_fan (x,V,E) `) +THEN RESA_TAC +THEN MRESA_TAC INJ_TRAN_D1_FAN +[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(E1:(real^3->bool)->bool)`; +`x':real^3#real^3#real^3#real^3`;`(y:real^3#real^3#real^3#real^3)`];(*3*) + + +MRESA_TAC SUM_IMAGE[`(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool)):real^3#real^3#real^3#real^3 -> real^3#real^3#real^3#real^3`;`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN REWRITE_TAC[o_DEF; ] +THEN SUBGOAL_THEN `(!y. y IN f + ==> azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 (tran x V E1 y)) (pr3 (tran x V E1 y)) - + pi = + azim_fan x V E (pr2 y) (pr3 y) - pi)` +ASSUME_TAC +THENL(*4*)[ + +REPEAT STRIP_TAC +THEN MRESAL_TAC azim_fanadd_eq[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`f:real^3#real^3#real^3#real^3->bool`;`(y:real^3#real^3#real^3#real^3)` ][DELETE;IN_ELIM_THM];(*4*) + +MRESA_TAC SUM_EQ[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 (tran x V E1 y)) (pr3 (tran x V E1 y)) - pi)`;`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`f:real^3#real^3#real^3#real^3->bool`]](*4*)](*3*);(*2*) + + + + + + + + + +MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}:real^3->bool`] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN REMOVE_THEN"LINH"(fun th-> MRESAL1_TAC th` (ds1:real^3#real^3#real^3#real^3->bool)`[eventually_radial;radial;ball_eq_normball] THEN MRESAL1_TAC th` (ds2:real^3#real^3#real^3#real^3->bool)`[eventually_radial;radial;ball_eq_normball]) +THEN MP_TAC(REAL_ARITH`r> &0 /\ r' > &0==> min r (r':real)> &0 /\ &0< min r (r':real)/\ min r r' <= r /\ min r r' <= r'`) +THEN RESA_TAC +THEN MRESAL_TAC RADIAL_NORM_CO[`r:real`;`min r r':real`;`x:real^3`;`dartset_leads_into_fan x V E1 (ds1:real^3#real^3#real^3#real^3->bool)`][radial_norm] +THEN MRESAL_TAC RADIAL_NORM_CO[`r':real`;`min r r':real`;`x:real^3`;`dartset_leads_into_fan x V E1 (ds2:real^3#real^3#real^3#real^3->bool)`][radial_norm] +THEN FIND_ASSUM(fun th-> MP_TAC(ISPEC `min r r':real` th) THEN REWRITE_TAC[SET_RULE`A INTER B=B INTER A`] THEN STRIP_TAC)`!r. measurable (normball x r INTER dartset_leads_into_fan (x:real^3) V E1 ds1)` +THEN FIND_ASSUM(fun th-> MP_TAC(ISPEC `min r r':real` th) THEN REWRITE_TAC[SET_RULE`A INTER B=B INTER A`] THEN STRIP_TAC)`!r. measurable (normball x r INTER dartset_leads_into_fan (x:real^3) V E1 ds2)` +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN FIND_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[conforming_bijection_fan;EXISTS_UNIQUE] THEN STRIP_TAC )`conforming_bijection_fan (x:real^3,V,E1)` +THEN POP_ASSUM(fun th-> MRESA1_TAC th`dartset_leads_into_fan x V E1 (ds1:real^3#real^3#real^3#real^3->bool)`) + +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(ds1:real^3#real^3#real^3#real^3->bool)` +THEN MRESA1_TAC th`(ds2:real^3#real^3#real^3#real^3->bool)`) +THEN SUBGOAL_THEN`dartset_leads_into_fan x V E1 f' INTER + dartset_leads_into_fan x V E1 (ds2:real^3#real^3#real^3#real^3->bool) = + {}` +ASSUME_TAC +THENL(*4*)[ + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN REWRITE_TAC[SET_RULE`A INTER B ={} <=> ~(?z. z IN A /\ z IN B)`] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`f':real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(SYM th) THEN STRIP_TAC) +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(SYM th) THEN STRIP_TAC) +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y':real^3`;`z:real^3`] +THEN REMOVE_THEN "LINH1" MP_TAC +THEN RESA_TAC +THEN MRESA_TAC disjoint_ds1_and_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;];(*4*) + + +MRESAL_TAC SOL_DISJOINT_UNION[`x:real^3`;`dartset_leads_into_fan (x:real^3) V E1 ds1`; `dartset_leads_into_fan (x:real^3) V E1 ds2`;`min (r:real) r'`][radial_norm;DISJOINT] +THEN MRESAL_TAC MEASURABLE_UNION[`(dartset_leads_into_fan (x:real^3) V E1 ds1 INTER normball x (min r r'))`;`(dartset_leads_into_fan (x:real^3) V E1 ds2 INTER normball x (min r r'))`][SET_RULE`(A INTER C) UNION (B INTER C)=(A UNION B) INTER C`] +THEN MP_TAC(SET_RULE`E UNION {{v,w}}=E1==> {v,w:real^3} IN E1`) THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC MEASURABLE_AFF_GT_2_1_INTER_BALL[`x:real^3`;`v:real^3`;`w:real^3`;`(min r r'):real`] +THEN MRESAL_TAC RADIAL_UNION[`min r r':real`;`x:real^3`;`dartset_leads_into_fan (x:real^3) V E1 ds1 INTER normball x (min r r')`; `dartset_leads_into_fan (x:real^3) V E1 ds2 INTER normball x (min r r')`][radial_norm;SET_RULE`(A INTER C) UNION (B INTER C)=(A UNION B) INTER C`] +THEN MRESAL_TAC RADIAL_AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`;`(min r r'):real`;][REAL_ARITH`&1> &0`] +THEN MRESA_TAC AFF_GE_SUBSET_XFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE` aff_ge {x} {v, w} SUBSET xfan (x,V,E1) /\ aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w} +==> aff_gt {x:real^3} {v, w} SUBSET xfan (x,V:real^3->bool,E1)`) +THEN RESA_TAC +THEN MRESAL_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;` (f':real^3#real^3#real^3#real^3->bool)`][yfan] +THEN MRESAL_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;` (ds2:real^3#real^3#real^3#real^3->bool)`][yfan] +THEN MP_TAC(SET_RULE`aff_gt {x} {v, w} SUBSET xfan (x,V,E1)/\ +dartset_leads_into_fan x V E1 f' SUBSET (:real^3) DIFF xfan (x,V,E1)/\ +dartset_leads_into_fan x V E1 ds2 SUBSET (:real^3) DIFF xfan (x,V,E1) +==> (dartset_leads_into_fan x V E1 f' UNION + dartset_leads_into_fan x V E1 ds2) INTER + aff_gt {x} {v, w:real^3} = + {}`) +THEN RESA_TAC +THEN MRESAL_TAC SOL_DISJOINT_UNION[`x:real^3`;`dartset_leads_into_fan (x:real^3) V E1 ds1 UNION dartset_leads_into_fan (x:real^3) V E1 ds2`;`aff_gt {x} {v, w:real^3}`; `min (r:real) r'`;][radial_norm;DISJOINT; SET_RULE`(A UNION B) UNION C= A UNION B UNION C`] +THEN MRESA_TAC SOL_AFF_GT_2_1 [`x:real^3`;`v:real^3`;`w:real^3`] +THEN REWRITE_TAC[REAL_ARITH`((&2 * pi + sum f' (\y. azim_fan x V E1 (pr2 y) (pr3 y) - pi)) + + &2 * pi + + sum ds2 (\y. azim_fan x V E1 (pr2 y) (pr3 y) - pi)) + + &0= &4 * pi + (sum f' (\y. azim_fan x V E1 (pr2 y) (pr3 y) - pi) + + sum ds2 (\y. azim_fan x V E1 (pr2 y) (pr3 y) - pi)) `] +THEN MRESA_TAC FINITE_FACE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC FINITE_FACE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC disjoint_ds1_and_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN SUBGOAL_THEN`(f':real^3#real^3#real^3#real^3->bool) INTER ds2 ={}` +ASSUME_TAC +THENL(*5*)[ +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN REWRITE_TAC[SET_RULE`A INTER B ={} <=> ~(?z. z IN A /\ z IN B)`] +THEN STRIP_TAC +THEN FIND_ASSUM(fun th -> MP_TAC th THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] THEN STRIP_TAC)`f' IN face_set (hypermap1_of_fanx (x:real^3,V,E1))` +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E1)`;`x':real^3#real^3#real^3#real^3`;`z:real^3#real^3#real^3#real^3`][face] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN FIND_ASSUM(fun th -> MP_TAC th THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] THEN STRIP_TAC)`ds2 IN face_set (hypermap1_of_fanx (x:real^3,V,E1))` +THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E1)`;`x'':real^3#real^3#real^3#real^3`;`z:real^3#real^3#real^3#real^3`][face] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]);(*5*) + + + + + +MRESAL_TAC SUM_UNION[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`(f':real^3#real^3#real^3#real^3->bool)`;`(ds2:real^3#real^3#real^3#real^3->bool)`;][DISJOINT] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`f' SUBSET d1_fan (x,V,E1)/\ ds2 SUBSET d1_fan (x,V,E1) +==> f' UNION ds2 SUBSET d1_fan(x:real^3,V,E1) +`) +THEN RESA_TAC +THEN MRESA_TAC finite_d1_fan[`x:real^3`;` V:real^3->bool`;` (E1:(real^3->bool)->bool)`] +THEN MRESA_TAC FINITE_SUBSET[`((f' UNION ds2 ):real^3#real^3#real^3#real^3->bool)`;`d1_fan(x:real^3,V,E1)`] +THEN SUBGOAL_THEN`x,v,w,sigma_fan x V E1 v w IN ds1` ASSUME_TAC +THENL(*6*)[ +FIND_ASSUM (fun th-> REWRITE_TAC[SYM th;face;orbit_map;IN_ELIM_THM])`face (hypermap1_of_fanx (x,V,E1)) (x,v,w:real^3,sigma_fan x V E1 v w) = ds1` +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[POWER;I_DEF;ARITH_RULE`0>=0`];(*6*) + +MP_TAC(SET_RULE`x,v,w,sigma_fan x V E1 v w IN ds1 ==> x,v,w,sigma_fan x V E1 v w IN ds1 UNION ds2`) +THEN RESA_TAC +THEN MRESAL_TAC SUM_DELETE[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`((f' UNION ds2 ):real^3#real^3#real^3#real^3->bool)`;`( (x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`;][REAL_ARITH`A=B-C<=> B=A+C`] +THEN MRESA_TAC FINITE_DELETE[`(f' UNION ds2 ):real^3#real^3#real^3#real^3->bool`;`(x,v,w,sigma_fan x V E1 v w:real^3)`] +THEN SUBGOAL_THEN`(x,w,v,sigma_fan x V E1 w v) IN + (f' UNION ds2) DELETE (x,v,w,sigma_fan x V E1 v w:real^3)`ASSUME_TAC +THENL(*7*)[ +ASM_REWRITE_TAC[DELETE;IN_ELIM_THM;EQ_PAIR_4] +THEN MATCH_MP_TAC(SET_RULE`A IN C ==> A IN B UNION C`) +THEN FIND_ASSUM (fun th-> REWRITE_TAC[SYM th;face;orbit_map;IN_ELIM_THM])`face (hypermap1_of_fanx (x,V,E1)) (x,w,v:real^3,sigma_fan x V E1 w v) = ds2` +THEN EXISTS_TAC`0:num` +THEN REWRITE_TAC[POWER;I_DEF;ARITH_RULE`0>=0`];(*7*) + + + + + +MRESAL_TAC SUM_DELETE[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`((f' UNION ds2 ):real^3#real^3#real^3#real^3->bool) DELETE (x,v,w:real^3,sigma_fan x V E1 v w)`;`( (x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`;][REAL_ARITH`A=B-C<=> B=A+C`] +THEN MRESA_TAC DS1_DS2_EQ_DS_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`;`((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN` (!x' y. x' IN ds /\ y IN (ds:real^3#real^3#real^3#real^3->bool) /\ tran x V E1 x' = tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) y ==> x' = y)` +ASSUME_TAC +THENL(*8*)[ + +REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`x' IN ds /\ y IN (ds:real^3#real^3#real^3#real^3->bool) +/\ ds SUBSET d1_fan (x,V,E)/\ E UNION {{v, w:real^3}} = E1 ==> E SUBSET E1/\ x' IN d1_fan (x,V,E) /\ y IN d1_fan (x,V,E) `) +THEN RESA_TAC +THEN MRESA_TAC INJ_TRAN_D1_FAN +[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(E1:(real^3->bool)->bool)`; +`x':real^3#real^3#real^3#real^3`;`(y:real^3#real^3#real^3#real^3)`];(*8*) + + +MRESA_TAC SUM_IMAGE[`(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool)):real^3#real^3#real^3#real^3 -> real^3#real^3#real^3#real^3`;`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN REWRITE_TAC[o_DEF; ] +THEN MRESA_TAC finite_d1_fan[`x:real^3`;` V:real^3->bool`;` (E:(real^3->bool)->bool)`] +THEN MRESA_TAC FINITE_SUBSET[`(ds:real^3#real^3#real^3#real^3->bool)`;`d1_fan(x:real^3,V,E)`] +THEN MRESAL_TAC SUM_DELETE[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`(ds:real^3#real^3#real^3#real^3->bool)`;`(f1:real^3#real^3#real^3#real^3)`;][REAL_ARITH`A=B-C<=> B=A+C`] +THEN MRESA_TAC FINITE_DELETE[`(ds ):real^3#real^3#real^3#real^3->bool`;`f1:real^3#real^3#real^3#real^3`] +THEN SUBGOAL_THEN`f3 IN ds DELETE f1:real^3#real^3#real^3#real^3` ASSUME_TAC +THENL(*9*)[ +ASM_REWRITE_TAC[IN_ELIM_THM;DELETE;] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC) +THEN FIND_ASSUM MP_TAC`pr2 f3=w:real^3` +THEN FIND_ASSUM (fun th-> REWRITE_TAC[th])`pr2 f3=v:real^3` +THEN ASM_REWRITE_TAC[];(*9*) + + MRESAL_TAC SUM_DELETE[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`(ds:real^3#real^3#real^3#real^3->bool) DELETE f1`;`(f3:real^3#real^3#real^3#real^3)`;][REAL_ARITH`A=B-C<=> B=A+C`] +THEN MRESAL_TAC SUM_DELETE[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 (tran (x:real^3) V E1 y)) (pr3 (tran x V E1 y)) - pi)`;`(ds:real^3#real^3#real^3#real^3->bool)`;`(f1:real^3#real^3#real^3#real^3)`;][REAL_ARITH`A=B-C<=> B=A+C`] +THEN MRESAL_TAC SUM_DELETE[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 (tran (x:real^3) V E1 y)) (pr3 (tran x V E1 y)) - pi)`;`(ds:real^3#real^3#real^3#real^3->bool) DELETE f1`;`(f3:real^3#real^3#real^3#real^3)`;][REAL_ARITH`A=B-C<=> B=A+C`] +THEN SUBGOAL_THEN `(!y. y IN ds DELETE f1 DELETE f3 + ==> azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 (tran x V E1 y)) (pr3 (tran x V E1 y)) - + pi = + azim_fan x V E (pr2 y) (pr3 y) - pi)` +ASSUME_TAC +THENL(*10*)[ + +REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC azim_fanadd_eq_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(y:real^3#real^3#real^3#real^3)` ][DELETE;IN_ELIM_THM];(*10*) + +MRESA_TAC SUM_EQ[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 (tran x V E1 y)) (pr3 (tran x V E1 y)) - pi)`;`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`(ds:real^3#real^3#real^3#real^3->bool) DELETE f1 DELETE f3`] +THEN REWRITE_TAC[REAL_ARITH`&4 * pi + + (((sum (ds DELETE f1 DELETE f3) (\y. azim_fan x V E (pr2 y) (pr3 y) - pi) + + azim_fan x V E1 (pr2 (tran x V E1 f3)) (pr3 (tran x V E1 f3)) - pi) + + azim_fan x V E1 (pr2 (tran x V E1 f1)) (pr3 (tran x V E1 f1)) - pi) + + azim_fan x V E1 (pr2 (x,w,v,sigma_fan x V E1 w v)) + (pr3 (x,w,v,sigma_fan x V E1 w v)) - + pi) + + azim_fan x V E1 (pr2 (x,v,w,sigma_fan x V E1 v w)) + (pr3 (x,v,w,sigma_fan x V E1 v w)) - + pi = + &2 * pi + + (sum (ds DELETE f1 DELETE f3) (\y. azim_fan x V E (pr2 y) (pr3 y) - pi) + + azim_fan x V E w (pr3 f3) - pi) + + azim_fan x V E v u - pi +<=> azim_fan x V E1 (pr2 (tran x V E1 f3)) (pr3 (tran x V E1 f3)) + + azim_fan x V E1 (pr2 (tran x V E1 f1)) (pr3 (tran x V E1 f1))+ + azim_fan x V E1 (pr2 (x,w,v,sigma_fan x V E1 w v)) + (pr3 (x,w,v,sigma_fan x V E1 w v)) + + azim_fan x V E1 (pr2 (x,v,w,sigma_fan x V E1 v w)) + (pr3 (x,v,w,sigma_fan x V E1 v w)) = + azim_fan x V E w (pr3 f3) + + azim_fan x V E v u`;pr2;pr3] +THEN SUBGOAL_THEN`(x,v,u,sigma_fan x V E v u)=f1:real^3#real^3#real^3#real^3` ASSUME_TAC +THENL(*11*)[ +ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[pr2;pr3] +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN ASM_REWRITE_TAC[];(*11*) + +POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`x, + w, + inverse1_sigma_fan x V E w u, + sigma_fan x V E w (inverse1_sigma_fan x V E w u)=f1_fan x V E f2:real^3#real^3#real^3#real^3` ASSUME_TAC +THENL(*12*)[ +SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL(*13*)[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*13*) +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[f1_fan] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC](*13*);(*12*) + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;tran;azim_fan]) +THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `v:real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E1) > 1` +THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `v:real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E) > 1` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`(v:real^3) IN V` +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`; +`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `w:real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E1) > 1` +THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `w:real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E) > 1` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`(w:real^3) IN V` +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC angle_is_small_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w:real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`u:real^3`;`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E v u):real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`(sigma_fan x V E v u):real^3`] +THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w (inverse1_sigma_fan x V E w u) u +==> +azim x w v u <= azim x w (inverse1_sigma_fan x V E w u) (u:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`;`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV)[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV)[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (inverse1_sigma_fan x V E w u:real^3)`;`(w:real^3)`] +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`v:real^3`;`u:real^3`] +THEN REAL_ARITH_TAC +]]]]]]]]]]]);; + + +let TRAN_IN_TRANF=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 f y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w /\ pr3 f1 = u +/\ pr3 f2 = w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v +/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) +/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v) +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 + +/\ f IN face_set(hypermap1_of_fanx (x,V,E)) DELETE ds +/\ y IN f +==> tran x V E1 y IN tranf x V E E1 f`, + +REPEAT STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC unique_tranf_fan +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` +;`ds1:real^3#real^3#real^3#real^3->bool` +;`ds2:real^3#real^3#real^3#real^3->bool` +;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` +; `f:real^3#real^3#real^3#real^3->bool` +;`(face (hypermap1_of_fanx (x,V,E1)) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3->bool)` +;`(y:real^3#real^3#real^3#real^3)`;] +THEN REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[POWER;I_DEF;ARITH_RULE`0>=0`]);; + + + + +let TXFBALB_VERSION=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ~(conforming_fan (x,V,E)) +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> conforming_solid_angle_fan(x,V,E)`, +REPEAT STRIP_TAC +THEN MRESA_TAC nonconformin_fan_imp_exist_face_gt_3[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC nonconformin_fan_imp_exist_3point_in_face[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN ABBREV_TAC`v= pr2 (f1:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`u= pr2 (f2:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`w= pr2 (f3:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`E1= E UNION {{v:real^3, w:real^3}}` +THEN ABBREV_TAC`ds1= face (hypermap1_of_fanx (x,V,E1)) ((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x,V,E1)) ((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f10= ((x,w,v,u):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f20= ((x,v,u,w):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f30= ((x,u,w,v):real^3#real^3#real^3#real^3)` +THEN MRESA_TAC TXFBALB[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]);; + + + +let conforming_bijection_fanadd_verrion=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ~(conforming_fan (x,V,E)) +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> +!s. s IN topological_component_yfan (x,V,E) ==> (?!f. f IN face_set (hypermap1_of_fanx (x,V,E)) /\ + s = dartset_leads_into_fan x V E f)`, + +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MRESA_TAC nonconformin_fan_imp_exist_face_gt_3[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC nonconformin_fan_imp_exist_3point_in_face[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN ABBREV_TAC`v= pr2 (f1:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`u= pr2 (f2:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`w= pr2 (f3:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`E1= E UNION {{v:real^3, w:real^3}}` +THEN ABBREV_TAC`ds1= face (hypermap1_of_fanx (x,V,E1)) ((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x,V,E1)) ((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f10= ((x,w,v,u):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f20= ((x,v,u,w):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f30= ((x,u,w,v):real^3#real^3#real^3#real^3)` +THEN MRESA_TAC conforming_bijection_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]);; + +let OBHTHCD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ~(conforming_fan (x,V,E)) +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> +!s. s IN topological_component_yfan (x,V,E) ==> (?!f. f IN face_set (hypermap1_of_fanx (x,V,E)) /\ + s = dartset_leads_into_fan x V E f)`, + +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MRESA_TAC nonconformin_fan_imp_exist_face_gt_3[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC nonconformin_fan_imp_exist_3point_in_face[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN ABBREV_TAC`v= pr2 (f1:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`u= pr2 (f2:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`w= pr2 (f3:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`E1= E UNION {{v:real^3, w:real^3}}` +THEN ABBREV_TAC`ds1= face (hypermap1_of_fanx (x,V,E1)) ((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x,V,E1)) ((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f10= ((x,w,v,u):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f20= ((x,v,u,w):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f30= ((x,u,w,v):real^3#real^3#real^3#real^3)` +THEN MRESA_TAC conforming_bijection_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]);; + + + +let inverse1_sigma_fan_FANADD4=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +==> inverse1_sigma_fan x V E1 (inverse1_sigma_fan x V E w u) w = inverse1_sigma_fan x V E (inverse1_sigma_fan x V E w u) w`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MATCH_MP_TAC MONO_SIGMA_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E1:(real^3->bool)->bool` +THEN EXISTS_TAC`inverse1_sigma_fan x V E w u:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{inverse1_sigma_fan x V E w u,w:real^3} IN E /\ E UNION {{v,w}}= E1 +==> {inverse1_sigma_fan x V E w u,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`inverse1_sigma_fan x V E w u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`inverse1_sigma_fan x V E w u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`{inverse1_sigma_fan x V E w u, inverse1_sigma_fan x V E + (inverse1_sigma_fan x V E w u) + w:real^3} IN E /\ E UNION {{v,w}}= E1 +==> {inverse1_sigma_fan x V E w u, inverse1_sigma_fan x V E + (inverse1_sigma_fan x V E w u) + w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`inverse1_sigma_fan x V E w u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`; `w:real^3` ] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`inverse1_sigma_fan x V E w u:real^3`;`inverse1_sigma_fan x V E (inverse1_sigma_fan x V E w u) w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(SET_RULE`~(inverse1_sigma_fan x V E w u IN {v, w}) \/ inverse1_sigma_fan x V E w u =v \/ inverse1_sigma_fan x V E w u =w`) +THENL[ +RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`inverse1_sigma_fan x V E w u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`); + + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL[ +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (inverse1_sigma_fan x V E w u:real^3)`; +`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC]]);; + + +let conforming_diagonal_fanadd1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 z. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ z IN ds +/\ ~(f3=z) +==> ~collinear {x, pr2 f3, pr2 z} /\ + (f3 = f1_fan x V E z \/ + z = f1_fan x V E f3 \/ + aff_gt {x} {pr2 f3, pr2 z} SUBSET + dartset_leads_into_fan x V E ds)`, + +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E) /\ z IN ds ==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds/\ z IN d1_fan(x,V,E)`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[conforming_fan;conforming_diagonal_fan;] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(z=f1:real^3#real^3#real^3#real^3)\/ z=f2 \/ (~(z=f1)/\ ~(z=f2))`) +THENL(*1*)[ +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THENL(*2*)[ +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`E UNION {{v,w:real^3}}=E1==> {v,w:real^3} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[];(*2*) + +ASM_REWRITE_TAC[] +THEN MRESA_TAC STEP2_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]](*2*);(*1*) + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL(*2*)[ + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THENL(*3*)[ + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[];(*3*) + +ASM_REWRITE_TAC[]](*3*);(*2*) + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 ==> E SUBSET E1/\ {v,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC INJ_TRAN_D1_FAN +[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(E1:(real^3->bool)->bool)`; +`f3:real^3#real^3#real^3#real^3`;`(z:real^3#real^3#real^3#real^3)`] +THEN SUBGOAL_THEN`tran (x:real^3) V E1 (z:real^3#real^3#real^3#real^3) IN IMAGE (tran (x:real^3) (V:real^3->bool) E1) (ds:real^3#real^3#real^3#real^3->bool)` ASSUME_TAC +THENL(*3*)[ + +REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`z:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[];(*3*) + +POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`tran (x:real^3) V E1 (f3:real^3#real^3#real^3#real^3)=(x,w,inverse1_sigma_fan x V E1 w v,v)` ASSUME_TAC +THENL(*4*)[ + +SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL(*5*)[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*5*) +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`f1_fan x V E f2 = f3:real^3#real^3#real^3#real^3` +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th;f1_fan;tran] ) +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC](*5*);(*4*) + +SUBGOAL_THEN`(x,w,inverse1_sigma_fan x V E1 w v,v:real^3) =f1_fan x V E1 (x,v,w,sigma_fan x V E1 v w)` ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[f1_fan];(*5*) + +SUBGOAL_THEN`x:real^3,v,w,sigma_fan x V E1 v w IN ds1`ASSUME_TAC +THENL(*6*)[ +FIND_ASSUM (fun th-> REWRITE_TAC[SYM th;face;IN_ELIM_THM;orbit_map])`face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w:real^3) = ds1` +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC;(*6*) + +MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`((x,w,inverse1_sigma_fan x V E1 w v,v):real^3#real^3#real^3#real^3)` ;`((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC DS1_DS2_EQ_DS_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`;`((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN REWRITE_TAC[DELETE;IN_ELIM_THM;UNION] +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN STRIP_TAC +THENL(*7*)[ + +FIND_ASSUM MP_TAC`z IN d1_fan (x:real^3,V,E)` +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESAL_TAC th[`ds1:real^3#real^3#real^3#real^3->bool`;`tran (x:real^3) V E1 (f3:real^3#real^3#real^3#real^3)`;`tran (x:real^3) V E1 (z:real^3#real^3#real^3#real^3)`][pr2;pr3;tran]) +THENL(*8*)(*3GOAL*)[ + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[f1_fan;EQ_PAIR_4] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*8*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[f1_fan;EQ_PAIR_4] +THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC inverse1_sigma_fan_FANADD4[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN RESA_TAC +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL(*9*)[ + +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*9*) +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`f1_fan x V E f2 = f3:real^3#real^3#real^3#real^3` +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th;f1_fan;tran] ) +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`inverse1_sigma_fan x V E w u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`)](*9*);(*8*) + +MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION + dartset_leads_into_fan x (V:real^3->bool) E1 ds2 UNION + aff_gt {x} {v, w}:real^3->bool`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]](*8*);(*7*) + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`A IN {B,C,D}<=> A=B \/ A=C \/ A=D`] +THEN STRIP_TAC +THENL(*8*)(*3 GOAL*)[ + +ASM_REWRITE_TAC[];(*8*) + +POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`z IN d1_fan (x:real^3,V,E)` +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[tran] +THEN EXPAND_TAC"f20" +THEN REWRITE_TAC[EQ_PAIR_4] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REWRITE_TAC[pr2] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`f1=(x,v,u,sigma_fan x V E v u:real^3)` ASSUME_TAC +THENL(*9*)[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[pr2;pr3;] +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN ASM_REWRITE_TAC[];(*9*) + +POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[]](*9*);(*8*) +POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`z IN d1_fan (x:real^3,V,E)` +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[tran] +THEN EXPAND_TAC"f30" +THEN REWRITE_TAC[EQ_PAIR_4] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REWRITE_TAC[pr2] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC f2_EQ_F30_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]]]]]]]]]);; + + + + + + +let INDUCTION_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ y IN ds +==> ?f1 f2 f3. {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ {pr2 f2, pr2 f3} IN E +/\ ~({pr2 f3, pr2 f1 } IN E) +/\ {pr2 f1, pr2 f2 } IN E +/\ sigma_fan x V E (pr2 f2) (pr2 f3)=pr2 f1 +/\ pr2 f3= pr3 f2 +/\ pr2 f2= pr3 f1 +/\ y=f3`, + +REPEAT STRIP_TAC +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN ABBREV_TAC`f2'=(f1_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) POWER (CARD (ds:real^3#real^3#real^3#real^3->bool) -1)) (y:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f1'=(f1_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) POWER (CARD (ds:real^3#real^3#real^3#real^3->bool) -2)) (y:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f4=f1_fan x V E (y:real^3#real^3#real^3#real^3)` +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"VUT") +THEN FIND_ASSUM MP_TAC`ds IN face_set(hypermap1_of_fanx (x,V:real^3->bool,E))` +THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] +THEN RESA_TAC +THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) +THEN RESA_TAC +THEN MRESA_TAC lemma_face_cycle[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`y:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) +THEN MP_TAC(SET_RULE`y IN ds /\ ds SUBSET d1_fan(x,V,E)==> y IN d1_fan(x:real^3,V,E)`) +THEN RESA_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`CARD( ds:real^3#real^3#real^3#real^3->bool):num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`CARD( ds:real^3#real^3#real^3#real^3->bool)>3 ==> CARD ds= SUC(CARD(ds)-1)`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC THEN POP_ASSUM(fun th1-> MP_TAC th1 THEN +ONCE_REWRITE_TAC[th] +THEN ASM_REWRITE_TAC[COM_POWER;o_DEF] +THEN STRIP_TAC THEN MP_TAC th1)) +THEN MP_TAC(ARITH_RULE`CARD( ds:real^3#real^3#real^3#real^3->bool)>3 ==> CARD ds= SUC( SUC(CARD(ds)-2))`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[COM_POWER;o_DEF] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`CARD( ds:real^3#real^3#real^3#real^3->bool)-1:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`CARD( ds:real^3#real^3#real^3#real^3->bool)-2:num`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC(0):num`;] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(f1':real^3#real^3#real^3#real^3)`[POWER;I_DEF;o_DEF]) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN MRESA_TAC MONO_F1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[` (f1_fan x V E f1':real^3#real^3#real^3#real^3)`;` (f2':real^3#real^3#real^3#real^3)`]) +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`(y:real^3#real^3#real^3#real^3)` ;`(f2':real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`(f2':real^3#real^3#real^3#real^3)` ;`(f1':real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f4:real^3#real^3#real^3#real^3)` ;`(y:real^3#real^3#real^3#real^3)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`f1' IN ds /\ f2' IN ds /\ y IN ds /\ ds SUBSET d1_fan (x,V,E)==> {f1',f2',y} SUBSET (ds:real^3#real^3#real^3#real^3->bool)`) +THEN RESA_TAC +THEN MRESA_TAC f_fan_no_fix_point[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f1':real^3#real^3#real^3#real^3)` THEN MRESA1_TAC th`(f2':real^3#real^3#real^3#real^3)` THEN MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`) +THEN DISJ_CASES_TAC(SET_RULE`y=f1' \/ ~(y=f1':real^3#real^3#real^3#real^3)`) +THENL(*1*)[ +MP_TAC(SET_RULE`f1'=y:real^3#real^3#real^3#real^3==> pr2 f1'= pr2 y`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(y:real^3#real^3#real^3#real^3)` ;`(f2':real^3#real^3#real^3#real^3)`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f2':real^3#real^3#real^3#real^3)` ;`(f1':real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` pr2 (y:real^3#real^3#real^3#real^3)`; +` pr2 (f2':real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge (pr2 (f2':real^3#real^3#real^3#real^3)) V E = {pr2 y} \/ ~(set_of_edge (pr2 (f2':real^3#real^3#real^3#real^3)) V E = {pr2 y})`) +THENL(*2*)[ + MRESA_TAC CARD_SING[`(pr2 y):real^3`; `(set_of_edge (pr2 (f2':real^3#real^3#real^3#real^3)) V E):real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) +THEN FIND_ASSUM (fun th -> MP_TAC(ISPEC `(pr2 (f2':real^3#real^3#real^3#real^3))` th))`(!v:real^3. v IN V==>CARD (set_of_edge v V E) >1)` +THEN FIND_ASSUM (fun th-> REWRITE_TAC[th])`(pr2 (f2':real^3#real^3#real^3#real^3)) IN V` +THEN ARITH_TAC;(*2*) + +MRESA_TAC SIGMA_FAN [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` pr2 (f2':real^3#real^3#real^3#real^3)`; +` pr2 (y:real^3#real^3#real^3#real^3)`] +THEN ASM_TAC THEN SET_TAC[]];(*1*) + + + +DISJ_CASES_TAC(SET_RULE`f4=f1' \/ ~(f4=f1':real^3#real^3#real^3#real^3)`) +THENL(*2*)[ +SUBGOAL_THEN(`((f1_fan (x:real^3) V E) POWER 3) f1'=f1'`) ASSUME_TAC + +THENL(*3*)[ +ASM_SIMP_TAC[ARITH_RULE`3= SUC(2)/\ 2= SUC(1) /\ 1= SUC(0)`;POWER;I_DEF;o_DEF];(*3*) + + SUBGOAL_THEN`face (hypermap1_of_fanx (x:real^3,V:real^3->bool,E)) f1'=orbit_map (f1_fan x V E) f1'`ASSUME_TAC +THENL(*4*)[ +ASM_REWRITE_TAC[face;orbit_map;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THEN STRIP_TAC +THEN MRESAL_TAC into_domain_power_efn_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`n:num`;`( \ t. res (t x V E ) (d1_fan (x:real^3,V,E))) `][POWER_1;I_DEF] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `f1':real^3#real^3#real^3#real^3`) +THEN EXISTS_TAC`n:num` +THEN ASM_REWRITE_TAC[];(*4*) + +MRESAL_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f1':real^3#real^3#real^3#real^3`][] +THEN MRESAL_TAC card_orbit_le[`f1_fan (x:real^3) V E`;`3`;`f1':real^3#real^3#real^3#real^3`][ARITH_RULE`~(3=0)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th -> REWRITE_TAC[SYM th]) +THEN FIND_ASSUM MP_TAC`CARD( ds:real^3#real^3#real^3#real^3->bool)>3` +THEN ARITH_TAC](*4*)](*3*);(*2*) + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EMYEU") +THEN EXISTS_TAC`f1':real^3#real^3#real^3#real^3` +THEN EXISTS_TAC`f2':real^3#real^3#real^3#real^3` +THEN EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f2':real^3#real^3#real^3#real^3)` ;`(f1':real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(y:real^3#real^3#real^3#real^3)` ;`(f2':real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)] +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)] THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)] THEN MP_TAC th) THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[th] THEN MP_TAC th) +THEN REPEAT STRIP_TAC THEN ASSUME_TAC (SYM th)) +THEN MRESA_TAC PROPERTIES_TRIANGLE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(pr2 f1'):real^3`;`(pr3 f1'):real^3`;` (pr2 y):real^3`] +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC condition_f1_eq_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` (pr2 y):real^3`;`(pr2 f1'):real^3`;`(pr3 f1'):real^3`;] +THEN REMOVE_THEN "EMYEU" MP_TAC +THEN REMOVE_THEN"VUT"(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN REPEAT (ASM_REWRITE_TAC[pr2;pr3] THEN STRIP_TAC THEN ASM_REWRITE_TAC[]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC MONO_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v'':real^3`;`v'''':real^3`;`w'':real^3`]]]);; + +let conforming_diagonal_fan_ds_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y z. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ y IN ds +/\ z IN ds +/\ ~(y=z) +==> ~collinear {x, pr2 y, pr2 z} /\ + (y = f1_fan x V E z \/ + z = f1_fan x V E y \/ + aff_gt {x} {pr2 y, pr2 z} SUBSET + dartset_leads_into_fan x V E ds)`, + +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MRESA_TAC INDUCTION_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`y:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC`v'= pr2 (f1':real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`u'= pr2 (f2':real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`w'= pr2 (f3':real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`E1'= E UNION {{v':real^3, w':real^3}}` +THEN ABBREV_TAC`ds1'= face (hypermap1_of_fanx (x,V,E1')) ((x,v',w',sigma_fan x V E1' v' w'):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`ds2'= face (hypermap1_of_fanx (x,V,E1')) ((x,w',v',sigma_fan x V E1' w' v'):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f10'= ((x,w',v',u'):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f20'= ((x,v',u',w'):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f30'= ((x,u',w',v'):real^3#real^3#real^3#real^3)` +THEN STRIP_TAC +THEN MRESA_TAC conforming_diagonal_fanadd1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1':(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1':real^3#real^3#real^3#real^3)` ;`(f2':real^3#real^3#real^3#real^3)`;`(f3':real^3#real^3#real^3#real^3)`;`v':real^3`;`u':real^3`; `w':real^3`;`ds1':real^3#real^3#real^3#real^3->bool`;`ds2':real^3#real^3#real^3#real^3->bool` ;`(f10':real^3#real^3#real^3#real^3)`;`(f20':real^3#real^3#real^3#real^3)`;`(f30':real^3#real^3#real^3#real^3)`;`(z:real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[]);; + +let GGZWYRM=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> conforming_diagonal_fan(x,V,E)`, +REWRITE_TAC[conforming_diagonal_fan] +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`(f):real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(ARITH_RULE`3<= CARD (f:real^3#real^3#real^3#real^3->bool)==> CARD f=3 \/ CARD f>3`) +THEN RESA_TAC +THENL[ +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM1") +THEN DISCH_THEN(LABEL_TAC"EM2") +THEN STRIP_TAC +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC CARD_FACE_SET_EQ_3_FULLY_SURROUNDED_FAN1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr2 f2):real^3`;`(pr2 f1):real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr2 f3):real^3`;`(pr2 f2):real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr2 f1):real^3`;`(pr2 f3):real^3`] +THEN REPEAT DISCH_TAC +THEN REMOVE_THEN"EM1" MP_TAC +THEN REMOVE_THEN"EM2" MP_TAC +THEN RESA_TAC +THEN RESA_TAC +THEN MP_TAC(SET_RULE`y IN {f1, f2, f3:real^3#real^3#real^3#real^3} /\ z IN {f1, f2, f3}/\ ~(y = z) +==> (y=f1 /\ z= f2) \/ (y=f1 /\ z= f3) \/ (y=f2 /\ z= f1) \/ (y=f2 /\ z= f3)\/ (y=f3 /\ z= f1) \/ (y=f3 /\ z= f2)` ) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[]; +MRESA_TAC nonconformin_fan_imp_exist_3point_in_face[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`f:real^3#real^3#real^3#real^3->bool`] +THEN ABBREV_TAC`v= pr2 (f1:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`u= pr2 (f2:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`w= pr2 (f3:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`E1= E UNION {{v:real^3, w:real^3}}` +THEN ABBREV_TAC`ds1= face (hypermap1_of_fanx (x,V,E1)) ((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x,V,E1)) ((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f10= ((x,w,v,u):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f20= ((x,v,u,w):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f30= ((x,u,w,v):real^3#real^3#real^3#real^3)` +THEN MRESA_TAC conforming_diagonal_fan_ds_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`f:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(y:real^3#real^3#real^3#real^3)`;`(z:real^3#real^3#real^3#real^3)`] +]);; + +let INTERS_HALF_SPACE_DS_FANADD3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U1. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ U1=INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN ds} +==> U1 INTER aff {x, v, w} SUBSET aff_gt {x} {v, w}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {v,u} IN E ==> { v,u} IN E1`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 ==> {v,w:real^3} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +`v:real^3`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`sigma_fan x V E v (u:real^3)`; +`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`sigma_fan x V E v u:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN STRIP_TAC +THEN MRESA_TAC aff_gt_3_1_INTER_aff_SUBSET_aff_gt_2_1[`x:real^3`;`v:real^3`;`u:real^3`;`sigma_fan x V E v u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC aff_gt_3_1_INTER_aff_SUBSET_aff_gt_2_14[`x:real^3`;`w:real^3`;`u:real^3`;`v:real^3`;] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(v:real^3)`;`(w:real^3)`] +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B,C}={A,C,B}`] +THEN REWRITE_TAC[INTERS;INTER;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THENL[ +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN SUBGOAL_THEN`(?y. y IN ds /\ + aff_gt {x, v, u} {sigma_fan x V E v u} = + aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y):real^3})` +ASSUME_TAC +THENL[ +EXISTS_TAC`f1:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`); +STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`aff_gt {x, v, u} {sigma_fan x V E v u:real^3}`) +THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th`x':real^3`)]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN STRIP_TAC +THEN SUBGOAL_THEN `(?y. y IN ds /\ + aff_gt {x, u, w} {v} = + aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y):real^3})` +ASSUME_TAC +THENL[ +EXISTS_TAC`f2:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]; +FIND_ASSUM (fun th-> REWRITE_TAC[SYM th])`f1_fan (x:real^3) V E f2 = f3` +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[f1_fan] +THEN ASM_REWRITE_TAC[pr3]]; +STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`aff_gt {x, u, w} {v:real^3}`) +THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th`x':real^3`)]]);; + + +let lemma_HYUAZSE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U U1. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +/\ INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN ds} = U1 +/\ U= dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w} +==> U1 SUBSET U`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] + +THEN MRESA_TAC INTERS_HALF_SPACE_DS_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U1:real^3->bool`] +THEN MRESA_TAC INTERS_HALF_SPACE_DS_FANADD2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U1:real^3->bool`] +THEN MRESA_TAC INTERS_HALF_SPACE_DS_FANADD3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U1:real^3->bool`] +THEN MRESA_TAC SPACE3_EQ_UNION_3SET +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + + +let DART_FANADD_SUBSET_HALFSPACE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> dartset_leads_into_fan x V E1 ds1 SUBSET aff_gt {x, pr2 f3, pr3 f3} {pr3 (f1_fan x V E f3) }`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]; + +FIND_ASSUM (fun th-> REWRITE_TAC[SYM th])`f1_fan (x:real^3) V E f2 = f3` +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[f1_fan] +THEN ASM_REWRITE_TAC[pr3] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[conforming_fan;conforming_half_space_fan] +THEN REPEAT STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`ds1:real^3#real^3#real^3#real^3->bool`) +THEN MP_TAC(SET_RULE`dartset_leads_into_fan x V E1 ds1 = + INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E1 y)} | y IN ds1} +==> (!y. y IN ds1 ==> dartset_leads_into_fan x V E1 ds1 SUBSET aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E1 y):real^3})`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[SYM th]) +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN SUBGOAL_THEN`(x,v,w,sigma_fan x V E1 v w:real^3) IN ds1`ASSUME_TAC +THENL[ + +FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;face;orbit_map;IN_ELIM_THM])`face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) = ds1:real^3#real^3#real^3#real^3->bool` +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF]; +MRESAL_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`((x,w,inverse1_sigma_fan x V E1 w v,v):real^3#real^3#real^3#real^3)` ;`((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`;`ds1:real^3#real^3#real^3#real^3->bool`][f1_fan] +THEN REMOVE_THEN "LINH"(fun th-> MRESAL1_TAC th `(x,w,inverse1_sigma_fan x V E1 w v,v:real^3)`[f1_fan;pr3;pr2] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`;`inverse1_sigma_fan x V E1 w v:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESAL1_TAC th `(x,v,w,sigma_fan x V E1 v w:real^3)`[f1_fan;pr3;pr2]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`w:real^3`;`inverse1_sigma_fan x V E1 w v:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`inverse1_sigma_fan x V E1 w v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN RESA_TAC +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E1 w v:real^3`;`v:real^3`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;`(v:real^3)`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`;`v:real^3`;`inverse1_sigma_fan x V E1 w v:real^3`; ] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E1 w v:real^3`;`v :real^3`;] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CHANGE") +THEN STRIP_TAC +THEN REMOVE_THEN "CHANGE" MP_TAC +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN RESA_TAC +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`;`u:real^3`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`(u:real^3)`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`;`u:real^3`;`inverse1_sigma_fan x V E w u:real^3`; ] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`;`u :real^3`;]]]);; + + + +let DART_FANADD_SUBSET_HALFSPACE1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> dartset_leads_into_fan x V E1 ds2 SUBSET aff_gt {x, pr2 f3, pr3 f3} {pr3 (f1_fan x V E f3) }`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]; + +FIND_ASSUM (fun th-> REWRITE_TAC[SYM th])`f1_fan (x:real^3) V E f2 = f3` +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[f1_fan] +THEN ASM_REWRITE_TAC[pr3] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC card_ds2_fanadd_eq3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC KVQWYDL_lemma10[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN REWRITE_TAC[SET_RULE`{pr2 y | y IN {f10, f20, f30}}={pr2 f10, pr2 f20, pr2 f30}`] +THEN EXPAND_TAC"f10" +THEN EXPAND_TAC"f20" +THEN EXPAND_TAC"f30" +THEN REWRITE_TAC[pr2] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u:real^3`] THEN MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,C,A}`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC(SET_RULE`{u,w} IN E/\ E UNION {{v, w:real^3}} = E1==>{v, w} IN E1 /\ {u,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`; `w:real^3` ] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`w:real^3`;`v:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`; +`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC WEDGE_LUNE_GT[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_2_2[`x:real^3`;`v:real^3`;`w:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[SET_RULE`A INTER B INTER C= A INTER C INTER B`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) +THEN SUBGOAL_THEN`wedge x w v u SUBSET wedge x w (inverse1_sigma_fan x V E w u:real^3) u` ASSUME_TAC +THENL[ +REWRITE_TAC[wedge;IN_ELIM_THM;SUBSET] +THEN STRIP_TAC THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`azim x w v x' < azim x w v (u:real^3)==> azim x w v x' <= azim x w v u`) +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`w:real^3`;`v:real^3`;`x':real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x w v x' < azim x w v (u:real^3)/\ azim x w v u = azim x w v x' + azim x w x' (u:real^3) /\ &0 < azim x w v x' ==> &0< azim x w x' u /\ azim x w x' u < azim x w v u`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w (inverse1_sigma_fan x V E w u) u +/\ azim x w x' u < azim x w v u +==> +azim x w x' u < azim x w (inverse1_sigma_fan x V E w u) u +/\ +azim x w x' u <= azim x w (inverse1_sigma_fan x V E w u) (u:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`(inverse1_sigma_fan x V E w u):real^3`; +`(w:real^3)`] +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`x':real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u:real^3) u = + azim x w (inverse1_sigma_fan x V E w u) x' + azim x w x' u +/\ azim x w x' u < azim x w (inverse1_sigma_fan x V E w u) u +/\ &0< azim x w x' u +==> +&0 < azim x w (inverse1_sigma_fan x V E w u) x' /\ + azim x w (inverse1_sigma_fan x V E w u) x' < + azim x w (inverse1_sigma_fan x V E w u) x' + azim x w x' u +`) +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`(inverse1_sigma_fan x V E w u):real^3`; +`(w:real^3)`] +THEN REMOVE_THEN "YEU EM"(fun th-> MRESA_TAC th [`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`]) +THEN MRESA_TAC WEDGE_LUNE_GT[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`] +THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_2_2[`x:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`w:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,C,A}`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SET_TAC[]]]);; + +let DART_FANADD_SUBSET_HALFSPACE2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> aff_gt {x} {v,w} SUBSET aff_gt {x, pr2 f3, pr3 f3} {pr3 (f1_fan x V E f3) }`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC +THENL[ +MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN REWRITE_TAC[pr3;pr2;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[pr2;pr3] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]; + +FIND_ASSUM (fun th-> REWRITE_TAC[SYM th])`f1_fan (x:real^3) V E f2 = f3` +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[f1_fan] +THEN ASM_REWRITE_TAC[pr3] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> { v,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(v:real^3)`;`(w:real^3)`] +THEN MATCH_MP_TAC(SET_RULE`A SUBSET B ==> C INTER A SUBSET B`) +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`w:real^3`;`v:real^3`][IN_ELIM_THM] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`(inverse1_sigma_fan x V E w u):real^3`; +`(w:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`;`u:real^3`;`inverse1_sigma_fan x V E w u:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`] +THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`;`u:real^3`][IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(t1 % x + t2 % w + t3 % v) - x= ((t1+t2+t3)- &1) % x+ t2 % (w-x) +t3 % (v-x)`; VECTOR_ARITH`(&1 - &1) % x + t2 % (w - x) + t3 % (v - x)= t2 % (w - x) + t3 % (v - x)`;DOT_RMUL;DOT_RADD;DOT_CROSS_SELF;REAL_ARITH`A * &0 +B=B`] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`;`v:real^3`;`inverse1_sigma_fan x V E w u:real^3`;] +THEN POP_ASSUM MATCH_MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`{w, inverse1_sigma_fan x V E w u} IN E /\ {u,w} IN E/\ E UNION {{v, w:real^3}} = E1==>{w, inverse1_sigma_fan x V E w u} IN E1 /\ {u,w} IN E1`) +THEN RESA_TAC +THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`])]);; + + + +let DART_FANADD_SUBSET_HALFSPACE3= prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> dartset_leads_into_fan x V E ds SUBSET aff_gt {x, pr2 f3, pr3 f3} {pr3 (f1_fan x V E f3) }`, + + + + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION + dartset_leads_into_fan x (V:real^3->bool) E1 ds2 UNION + aff_gt {x} {v, w}:real^3->bool`] +THEN MRESA_TAC DART_FANADD_SUBSET_HALFSPACE[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC DART_FANADD_SUBSET_HALFSPACE1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC DART_FANADD_SUBSET_HALFSPACE2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + +let DART_FANADD_SUBSET_HALFSPACE4=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> dartset_leads_into_fan x V E ds SUBSET INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN ds}`, + + +REPEAT GEN_TAC +THEN STRIP_TAC +THEN REWRITE_TAC[SET_RULE`dartset_leads_into_fan x V E ds SUBSET INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN ds} <=> (!y. y IN ds ==> dartset_leads_into_fan x V E ds SUBSET aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) })`] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC INDUCTION_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`y:real^3#real^3#real^3#real^3`] +THEN ABBREV_TAC`v'= pr2 (f1':real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`u'= pr2 (f2':real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`w'= pr2 (f3':real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`E1'= E UNION {{v':real^3, w':real^3}}` +THEN ABBREV_TAC`ds1'= face (hypermap1_of_fanx (x,V,E1')) ((x,v',w',sigma_fan x V E1' v' w'):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`ds2'= face (hypermap1_of_fanx (x,V,E1')) ((x,w',v',sigma_fan x V E1' w' v'):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f10'= ((x,w',v',u'):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f20'= ((x,v',u',w'):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f30'= ((x,u',w',v'):real^3#real^3#real^3#real^3)` +THEN MRESA_TAC DART_FANADD_SUBSET_HALFSPACE3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1':(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1':real^3#real^3#real^3#real^3)` ;`(f2':real^3#real^3#real^3#real^3)`;`(f3':real^3#real^3#real^3#real^3)`;`v':real^3`;`u':real^3`; `w':real^3`;`ds1':real^3#real^3#real^3#real^3->bool`;`ds2':real^3#real^3#real^3#real^3->bool` ;`(f10':real^3#real^3#real^3#real^3)`;`(f20':real^3#real^3#real^3#real^3)`;`(f30':real^3#real^3#real^3#real^3)`]);; + +let DART_FANADD_EQ_HALFSPACE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3 +/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1) +/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w +/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) +/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w +/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1 +/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2 +/\ (x,w,v,u)=f10 +/\ (x,v,u,w)=f20 +/\ (x,u,w,v)=f30 +/\ E UNION {{v,w}}= E1 +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> dartset_leads_into_fan x V E ds = INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN ds}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`] +THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION + dartset_leads_into_fan x (V:real^3->bool) E1 ds2 UNION + aff_gt {x} {v, w}:real^3->bool`] +THEN MRESA_TAC DART_FANADD_SUBSET_HALFSPACE4[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;] +THEN MRESA_TAC lemma_HYUAZSE +[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w:real^3}`;`INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN (ds:real^3#real^3#real^3#real^3->bool)}`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + +let HYUAZSE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ (!E1. FAN(x,V,E1) /\ + (!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\ + fan80(x,V,E1)/\ + N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1)) +==> conforming_half_space_fan(x,V,E)`, +REWRITE_TAC[conforming_half_space_fan] +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`(f):real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(ARITH_RULE`3<= CARD (f:real^3#real^3#real^3#real^3->bool)==> CARD f=3 \/ CARD f>3`) +THEN RESA_TAC +THENL[ +MRESA_TAC KVQWYDL_lemma10[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th);]) +THEN MRESA_TAC CARD_FACE_SET_EQ_3_FULLY_SURROUNDED_FAN1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN ASM_REWRITE_TAC[SET_RULE`INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y)} | y IN {f1, f2, f3}} += aff_gt {x, pr2 f1, pr3 f1} {pr3 (f1_fan x V E f1)} INTER aff_gt {x, pr2 f2, pr3 f2} {pr3 (f1_fan x V E f2)} INTER aff_gt {x, pr2 f3, pr3 f3} {pr3 (f1_fan x V E f3)}`;SET_RULE`{pr2 y | y IN {f1, f2, f3}}={pr2 f1, pr2 f2, pr2 f3}`] + +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`pr2 f2:real^3`;`pr2 f3:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(pr2 f1):real^3`;`(pr2 f2):real^3`;`(pr2 f3):real^3`] +THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_1_3[`x:real^3`;`(pr3 f3):real^3`;`(pr3 f1):real^3`;`(pr3 f2):real^3`]; + + + +MRESA_TAC nonconformin_fan_imp_exist_3point_in_face[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`f:real^3#real^3#real^3#real^3->bool`] +THEN ABBREV_TAC`v= pr2 (f1:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`u= pr2 (f2:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`w= pr2 (f3:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`E1= E UNION {{v:real^3, w:real^3}}` +THEN ABBREV_TAC`ds1= face (hypermap1_of_fanx (x,V,E1)) ((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x,V,E1)) ((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f10= ((x,w,v,u):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f20= ((x,v,u,w):real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`f30= ((x,u,w,v):real^3#real^3#real^3#real^3)` +THEN MRESA_TAC DART_FANADD_EQ_HALFSPACE[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`; +`f:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`]]);; + + + + + +let PIIJBJK=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +==> conforming_fan(x,V,E)`, + +REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(conforming_fan (x,V,E))\/ (conforming_fan (x:real^3,V,E))`) +THENL[ +ABBREV_TAC`S= {(N_FAN(x':real^3,V',E1))| x'= x /\ V'= V /\ FAN(x,V,E1)/\ (!v. v IN V'==>CARD (set_of_edge v V' E1) > 1) +/\ fan80(x',V',E1) /\ ~(conforming_fan (x',V',E1))}` +THEN ABBREV_TAC`n= (minimal) (S:num->bool)` +THEN SUBGOAL_THEN`?y. y IN (S:num->bool)`ASSUME_TAC +THENL[ +EXPAND_TAC"S" +THEN REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`(N_FAN(x:real^3,V,E))` +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN] +THEN DISCH_TAC +THEN MRESA1_TAC MINIMAL`S:num->bool` +THEN SUBGOAL_THEN`n IN (S:num->bool)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[IN]; + +POP_ASSUM MP_TAC +THEN EXPAND_TAC"S" +THEN REWRITE_TAC[IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINHYEU") +THEN STRIP_TAC +THEN SUBGOAL_THEN`(!E2. FAN(x:real^3,V,E2) /\ + (!v. v IN V==>CARD (set_of_edge v V E2) > 1) /\ + fan80(x,V,E2)/\ + N_FAN(x,V,E2)< N_FAN(x,V,E1) ==> conforming_fan (x,V,E2)) +`ASSUME_TAC +THENL[ +REPEAT STRIP_TAC +THEN REMOVE_THEN "LINHYEU"(fun th-> MRESA1_TAC th`N_FAN (x:real^3,V,E2)` ) +THEN MP_TAC(SET_RULE`~ (S (N_FAN (x:real^3,V,E2))) ==> ~(N_FAN (x,V,E2) IN S) `) +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"S" +THEN REWRITE_TAC[IN_ELIM_THM;GSYM FORALL_NOT_THM;DE_MORGAN_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th -> MRESA_TAC th[`x:real^3`;`V:real^3->bool`;`E2:(real^3->bool)->bool`]); +MRESA_TAC nonconformin_fan_imp_n_fan_ge0[`x':real^3`;`(V':real^3->bool)`;`(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC HYUAZSE[`x':real^3`;`(V':real^3->bool)`;`(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC TXFBALB_VERSION +[`x':real^3`;`(V':real^3->bool)`;`(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC GGZWYRM +[`x':real^3`;`(V':real^3->bool)`;`(E1:(real^3->bool)->bool)`] +THEN MRESA_TAC conforming_bijection_fanadd_verrion +[`x':real^3`;`(V':real^3->bool)`;`(E1:(real^3->bool)->bool)`] +THEN FIND_ASSUM MP_TAC`~conforming_fan (x':real^3,V',E1)` +THEN REWRITE_TAC[conforming_fan] +THEN ASM_REWRITE_TAC[conforming_bijection_fan]]]]; +ASM_REWRITE_TAC[]]);; + + +let expand_xfan_eq_aff_gt_aff_ge=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +==> UNIONS {y | ?e. e IN E /\ y = aff_ge {x} e}= (UNIONS {aff_gt {x} e | e IN E}) UNION (UNIONS {aff_ge {x} {v}| v IN V})`, +REWRITE_TAC[UNIONS;UNION;] +THEN ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[IN_ELIM_THM;] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th] THEN STRIP_TAC) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;` (w:real^3)`] +THEN REWRITE_TAC[UNION] +THEN RESA_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THENL[ + + +SUBGOAL_THEN`(?u1. (?e. e IN E /\ u1 = aff_gt {x:real^3} e) /\ x' IN u1)`ASSUME_TAC +THENL[ +EXISTS_TAC`aff_gt {x} {v, w:real^3}` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`{v,w:real^3}` +THEN ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[]]; + +SUBGOAL_THEN`(?u1. (?v. v IN V /\ u1 = aff_ge {x} {v:real^3}) /\ x' IN u1)` ASSUME_TAC +THENL[ +EXISTS_TAC`aff_ge {x} {v:real^3}` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[]]; + +SUBGOAL_THEN`(?u1. (?v. v IN V /\ u1 = aff_ge {x} {v:real^3}) /\ x' IN u1)` ASSUME_TAC +THENL[ +EXISTS_TAC`aff_ge {x} {w:real^3}` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`; +`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC; +ASM_REWRITE_TAC[]]]; + + +REPEAT STRIP_TAC +THENL[ +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th] THEN STRIP_TAC) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE`x' IN aff_gt {x} {v, w} /\ aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w} +==> x' IN aff_ge {x:real^3} {v, w}`) +THEN RESA_TAC +THEN EXISTS_TAC`aff_ge {x:real^3} {v, w}` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`{v,w:real^3}` +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN FIND_ASSUM(fun th-> MP_TAC(ISPEC `v:real^3` th))`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`(v:real^3) IN V` +THEN STRIP_TAC +THEN MRESA_TAC exists_inf_element_fix_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u1:real^3`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;` (u':real^3)`] +THEN MP_TAC(SET_RULE`aff_ge {x} {v, u'} = + aff_gt {x} {v, u'} UNION aff_ge {x} {v} UNION aff_ge {x} {u'} +/\ x' IN aff_ge {x} {v} +==> x' IN aff_ge {x} {v, u':real^3} `) +THEN RESA_TAC +THEN EXISTS_TAC`aff_ge {x} {v, u':real^3}` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`{v,u':real^3}` +THEN ASM_REWRITE_TAC[]]]);; + + + +let properties12_fan7=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +==> (UNIONS {aff_gt {x} e | e IN E}) INTER (UNIONS {aff_ge {x} {v}| v IN V})={}`, + +REWRITE_TAC[SET_RULE`A={} <=> ~(?y. y IN A)`;IN_ELIM_THM;UNIONS;INTER] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th] THEN STRIP_TAC) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(v':real^3)`] +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v':real^3)`;` (w:real^3)`] +THEN POP_ASSUM (fun th-> MP_TAC(SYM th) THEN STRIP_TAC) +THEN RESA_TAC +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM(fun th-> MP_TAC(ISPEC `v:real^3` th))`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`(v:real^3) IN V` +THEN STRIP_TAC +THEN MRESA_TAC exists_inf_element_fix_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u1:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u'':real^3)`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC AFF_GE_1_1[`x:real^3`;`v:real^3`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN `v IN aff_gt {x} {v',w:real^3}` ASSUME_TAC +THENL(*1*)[ +MRESA_TAC AFF_GT_1_2[`x:real^3`;`v':real^3`;`w:real^3`] +THEN FIND_ASSUM MP_TAC`y IN aff_gt {x} {v', w:real^3}` +THEN POP_ASSUM (fun th-> REWRITE_TAC[th;IN_ELIM_THM]) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 <= t2==> t2= &0 \/ &0 < t2`) +THEN RESA_TAC +THENL(*2*)[ +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th; REAL_ARITH`A+ &0=A`] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`&1 % x + &0 % v = t1' % x + t2' % v' + t3 % w <=> t2' %(v'-x) + t3 %(w-x)= (&1-(t1'+t2'+t3))%x`;VECTOR_ARITH`t2' % (v' - x) + t3 % (w - x) = (&1 - &1) % x<=> t3 % w= (t3 +t2') % x + (-- t2') % v' `] +THEN FIND_ASSUM MP_TAC`~(w IN aff {x, v':real^3})` +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN MP_TAC(REAL_ARITH`&0< t3==> ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t3:real` +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`t3 % w = (t3 + t2') % x + --t2' % v' ==> (inv (t3)) %(t3%w) = inv (t3)%((t3 + t2') % x + --t2' % v':real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C `;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`?u1 v1. u1 + v1 = &1 /\ w = u1 % x + v1 % v':real^3` ASSUME_TAC +THENL(*3*)[ +EXISTS_TAC`inv t3 * (t3 + t2'):real` +THEN EXISTS_TAC`(inv t3 * --t2'):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t3 * (t3 + t2') + inv t3 * --t2'= inv t3 * t3 `];(*3*) + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[]](*2*); + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN STRIP_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v = t1' % x + t2' % v' + t3 % w +<=> t2 % v = (t1'- t1) % x + t2' % v' + t3 % w`] +THEN MP_TAC(REAL_ARITH`&0< t2 ==> ~(t2= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`t2 % v = (t1' - t1) % x + t2' % v' + t3 % w ==> (inv (t2)) %(t2 % v) = inv (t2)%((t1' - t1) % x + t2' % v' + t3 % w:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C `;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`] +THEN STRIP_TAC +THEN MP_TAC(ISPEC`(t2:real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv (t2:real)`;`(t2':real)`]REAL_LT_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv (t2:real)`;`(t3:real)`]REAL_LT_MUL) +THEN RESA_TAC +THEN EXISTS_TAC`(inv t2 * (t1' - t1)):real` +THEN EXISTS_TAC`(inv t2 * t2'):real` +THEN EXISTS_TAC`(inv t2 * t3):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t2 * (t1' - t1) + inv t2 * t2' + inv t2 * t3 += inv t2 * (t2+(t1'+t2'+t3)- (t1+t2))`;REAL_ARITH`A+ &1 - &1=A`]];(*1*) + +MP_TAC(SET_RULE`v IN aff_gt {x} {v', w} /\ aff_ge {x} {v', w} = + aff_gt {x} {v', w} UNION aff_ge {x} {v'} UNION aff_ge {x} {w} +==> v IN aff_ge {x} {v', w:real^3}`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v:real^3`; `u'':real^3`; `v':real^3`;`w:real^3`]properties_of_fan7) +THEN RESA_TAC +THENL[ + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`v = t1' % x + t2' % v + t3 % w +<=> t3 % w = (--t1') % x +(&1 - t2') % v`] +THEN MP_TAC(REAL_ARITH`&0< t3==> ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t3:real` +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`t3 % w = (--t1') % x + (&1 -t2') % v ==> (inv (t3)) %(t3%w) = inv (t3)%((--t1') % x + (&1 -t2') % v:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C `;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`~(w IN aff {x, v:real^3})` +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`(inv t3 * --t1'):real` +THEN EXISTS_TAC`(inv t3 * (&1 - t2')):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t3 * --t1' + inv t3 * (&1 - t2')= inv t3 *( t3+ &1 -(t1'+t2' +t3))`;REAL_ARITH`A+ &1- &1=A`]; +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v':real^3`;`w:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`w = t1' % x + t2' % v + t3 % w +<=> (t2') % v = (--t1') % x +(&1 - t3) % w`] +THEN MP_TAC(REAL_ARITH`&0< t2' ==> ~(t2'= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2':real` +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`t2' % v' = (--t1') % x + (&1 -t3) % w ==> (inv (t2')) %(t2' %v') = inv (t2')%((--t1') % x + (&1 -t3) % w:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C `;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v':real^3)`; +`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`~(v' IN aff {w,x:real^3})` +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`(inv t2' * (&1 - t3)):real` +THEN EXISTS_TAC`(inv t2' * --t1'):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t2' * (&1 - t3) + inv t2' * --t1' = inv t2' *( t2'+ &1 -(t1'+t2' +t3))`;REAL_ARITH`A+ &1- &1=A`;VECTOR_ARITH`A+B=B+A:real^3`]]]);; + + +let yfan_union_aff_gt_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +==> yfan(x,V,E) UNION (UNIONS {aff_gt {x} e | e IN E}) = (:real^3) DIFF (UNIONS {aff_ge {x} {v}| v IN V})`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[yfan;XFAN_EQ_UNIONS_AFF_GE_1_2;] +THEN MRESA_TAC expand_xfan_eq_aff_gt_aff_ge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC properties12_fan7[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + +let exists_point_in_dartset_leads_into_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> ?y. y IN dartset_leads_into_fan x V E ds`, +REPEAT STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN EXISTS_TAC`y:real^3` +THEN MRESA_TAC CONNECTED_COMPONENT_REFL[`yfan(x:real^3,V:real^3->bool,E)`;`y:real^3`] +THEN ASM_REWRITE_TAC[IN]);; + + + + +let NEGLIGIBLE_AFF_3_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) z:real^3. +FAN (x,V,E) ==> negligible (UNIONS {aff {x, z, v} | v IN V} )`, + +REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[FAN;fan1] THEN STRIP_TAC THEN ASSUME_TAC th) +THEN MATCH_MP_TAC NEGLIGIBLE_UNIONS +THEN MRESAL_TAC FINITE_IMAGE[`(\e:real^3. aff {x:real^3,z:real^3,e})`;`V:(real^3->bool)`][IMAGE] +THEN SUBGOAL_THEN`{aff {x, z, v} | v IN V} = {y | ?x'. x' IN V /\ y = aff {x, z, x':real^3}} `(fun th-> ASM_REWRITE_TAC[th]) +THENL[ +REWRITE_TAC[EXTENSION;IN_ELIM_THM]; +REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[NEGLIGIBLE_AFF_3]]);; + + + + +let MEASURE_AFF_3_FAN=prove(`!x:real^3 V:real^3->bool E:(real^3->bool)->bool z:real^3. +FAN (x,V,E) ==> measure (UNIONS {aff {x, z, v} | v IN V})= &0`, +REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0 +THEN POP_ASSUM MP_TAC +THEN MESON_TAC[NEGLIGIBLE_AFF_3_FAN]);; + + +let NEGLIGIBLE_AFF_3_UNION_INTER_BALL=prove(`!x:real^3 V:real^3->bool E:(real^3->bool)->bool z:real^3 y:real^3 r:real. +FAN (x,V,E) ==> +negligible ((UNIONS {aff {x, z, v} | v IN V} ) INTER normball y r)`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET +THEN EXISTS_TAC `(UNIONS {aff {x, z, v:real^3} | v IN V} )` +THEN ASM_SIMP_TAC[ SET_RULE`A INTER B SUBSET A`] +THEN ASM_MESON_TAC[NEGLIGIBLE_AFF_3_FAN;]);; + + +let MEASURE_AFF_3_UNION_FAN=prove(`!x:real^3 V:real^3->bool E:(real^3->bool)->bool z:real^3 y:real^3 r:real. +FAN (x,V,E) ==> measure (UNIONS {aff {x, z, v} | v IN V} INTER normball y r)= &0`, +REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0 +THEN POP_ASSUM MP_TAC +THEN MESON_TAC[NEGLIGIBLE_AFF_3_UNION_INTER_BALL]);; + + +let HAS_MEASURE_AFF_3_UNION_INTER_BALL=prove(`!x:real^3 V:real^3->bool E:(real^3->bool)->bool z:real^3 y:real^3 r:real. +FAN (x,V,E) ==> (UNIONS {aff {x, z, v} | v IN V} INTER normball y r) has_measure &0`, +REPEAT STRIP_TAC +THEN ASM_MESON_TAC[NEGLIGIBLE_AFF_3_UNION_INTER_BALL;HAS_MEASURE_0]);; + + + +let MEASURABLE_AFF_3_UNION_INTER_BALL=prove(`!x:real^3 V:real^3->bool E:(real^3->bool)->bool z:real^3 y:real^3 r:real. +FAN (x,V,E) ==> measurable (UNIONS {aff {x, z, v} | v IN V} INTER normball y r)`, +REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[measurable;] +THEN EXISTS_TAC`&0` +THEN MRESA_TAC HAS_MEASURE_AFF_3_UNION_INTER_BALL[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`z:real^3 `;`y:real^3`;`r:real`] +);; + + +let measure_ball_diff_set_negligible=prove(`!x:real^3 V E z y r. +FAN(x,V,E)/\ &0<= r +==> measure ( (normball y r) DIFF (UNIONS {aff {x,z,v}| v IN V}))= &4/ &3 *pi *r pow 3`, +REPEAT STRIP_TAC +THEN MRESA_TAC MEASURE_AFF_3_UNION_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`z:real^3 `;`y:real^3`;`r:real`] +THEN MRESA_TAC MEASURABLE_AFF_3_UNION_INTER_BALL[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`z:real^3 `;`y:real^3`;`r:real`] + +THEN MRESA_TAC VOLUME_BALL[`y:real^3`;`r:real`] +THEN MRESAL_TAC MEASURE_DIFF_SUBSET[`normball (y:real^3) (r:real)`;`(UNIONS {aff {x,z,v:real^3}| v IN V}) INTER (normball y r)`][GSYM ball_eq_normball;MEASURABLE_BALL;SET_RULE`(UNIONS {aff {x,z,v:real^3}| v IN V}) INTER ball (y,r) SUBSET ball (y,r)`;SET_RULE`A DIFF(B INTER A)= A DIFF B`] +THEN ASM_SIMP_TAC[VOLUME_BALL;] +THEN REAL_ARITH_TAC);; + + + +let exists_measure_ball_diff_set_negligible=prove(`!x:real^3 V E y z r. +FAN(x,V,E)/\ &0< r +==> ?a. a IN (normball y r) DIFF (UNIONS {aff {x,z,v}| v IN V})`, +REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(normball y r) DIFF (UNIONS {aff {x,z,v:real^3}| v IN V}) ={} \/ ?a. a IN (normball y r) DIFF (UNIONS {aff {x,z,v}| v IN V})`) +THENL[ +MP_TAC(REAL_ARITH`&0 &0<= r`) +THEN RESA_TAC +THEN +MRESAL_TAC measure_ball_diff_set_negligible[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`z:real^3 `;`y:real^3`;`r:real`][MEASURE_EMPTY; ] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`A=B <=> B=A`;REAL_ENTIRE;REAL_ARITH`~(&4/ &3 = &0)`;] +THEN MP_TAC(REAL_ARITH`&0< pi ==> ~(pi= &0)`) +THEN ASM_REWRITE_TAC[PI_WORKS;] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0< r ==> ~(r= &0)`) +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC REAL_POW_EQ_0[`r:real`;`3`]; +ASM_REWRITE_TAC[]]);; + + + +let connected_in_dartset_leads_into_fan_union_aff_gt=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds ds1 Z. +FAN(x,V,E) +/\ conforming_fan (x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ ds1 IN face_set(hypermap1_of_fanx (x,V,E)) +/\ Z=(:real^3) DIFF (UNIONS {aff_ge {x} {v}| v IN V}) +==> ?y z. y IN dartset_leads_into_fan x V E ds +/\ z IN dartset_leads_into_fan x V E ds1 +/\ segment[y,z] SUBSET Z `, +REPEAT STRIP_TAC +THEN MRESA_TAC exists_point_in_dartset_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC exists_point_in_dartset_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`dartset_leads_into_fan x V E ds`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[open_def] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3`) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC exists_measure_ball_diff_set_negligible[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`y:real^3 `;`y':real^3`;`e:real`][normball;DIFF;IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`a:real^3`) +THEN EXISTS_TAC`a:real^3` +THEN EXISTS_TAC`y':real^3` +THEN ASM_REWRITE_TAC[segment;SUBSET;IN_ELIM_THM;SET_RULE`(x:real^3) IN (:real^3)`] +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "LINH" MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[UNIONS;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`aff{x,y',v:real^3}` +THEN STRIP_TAC +THENL(*1*)[ +EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*1*) +POP_ASSUM MP_TAC +THEN FIND_ASSUM(fun th-> MP_TAC(ISPEC `v:real^3` th))`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`(v:real^3) IN V` +THEN STRIP_TAC +THEN MRESA_TAC exists_inf_element_fix_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u1:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u'':real^3)`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC AFF_GE_1_1[`x:real^3`;`v:real^3`] +THEN ASM_REWRITE_TAC[aff;AFFINE_HULL_3;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`u <= &1 ==> u= &1 \/ &0< (&1 -u)`) +THEN RESA_TAC +THENL(*2*)[ + +REWRITE_TAC[VECTOR_ARITH`(&1 - &1) % a + &1 % y'=y'`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`y' IN xfan(x:real^3,V:real^3->bool,E)` ASSUME_TAC +THENL(*3*)[ +REWRITE_TAC[XFAN_EQ_UNIONS_AFF_GE_1_2;UNIONS;IN_ELIM_THM] +THEN EXISTS_TAC`aff_ge {x} {v,u'':real^3}` +THEN STRIP_TAC +THENL(*4*)[ + +EXISTS_TAC`{v,u'':real^3}` +THEN ASM_REWRITE_TAC[];(*4*) +MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u'':real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`&0:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &0`;REAL_ARITH`A+B+ &0=A+B`;VECTOR_ARITH`A+B+ &0 % C=A+B`]](*4*);(*3*) + +POP_ASSUM MP_TAC +THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` ds1:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`dartset_leads_into_fan x V E ds1 SUBSET yfan (x,V,E) /\ y' IN dartset_leads_into_fan x V E ds1 ==> y' IN yfan (x:real^3,V:real^3->bool,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan;IN_ELIM_THM;DIFF] +THEN SET_TAC[]](*3*);(*2*) + +MP_TAC(REAL_ARITH`&0< &1- u ==> ~((&1- u)= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`&1- u:real` +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - u) % a + u % y' = t1 % x + t2 % v <=> +(&1 - u) % a = t1 % x + (--u) % y' + t2 % v`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`(&1 - u) % a = t1 % x + --u % y' + t2 % v ==> (inv (&1 - u)) %((&1 - u) % a ) = inv (&1 - u)%(t1 % x + --u % y' + t2 % v:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C `;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`] +THEN STRIP_TAC +THEN EXISTS_TAC`inv (&1 - u) * t1:real` +THEN EXISTS_TAC`inv (&1 - u) * --u:real` +THEN EXISTS_TAC`inv (&1 - u) * t2:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1 - u) * t1 + inv (&1 - u) * --u + inv (&1 - u) * t2= +inv (&1 - u) * ((t1+t2)- u)`]]]);; + + + +let AFF_GT_1_1_SUBSET_DARTSET_LEADS_INTO_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y. +FAN(x,V,E) + +/\ conforming_fan (x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ~(E={}) +/\ ds IN face_set (hypermap1_of_fanx (x,V,E)) +/\ y IN dartset_leads_into_fan x V E ds +==> aff_gt {x} {y} SUBSET dartset_leads_into_fan x V E ds`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(dartset_leads_into_fan x V E ds):real^3->bool`;` y:real^3`] +THEN MRESAL_TAC AFF_GT_1_1[`x:real^3`;`y:real^3`][SET_RULE`DISJOINT {x} {y} <=> ~(x=y)`] +THEN REMOVE_THEN"YEU" MP_TAC +THEN FIND_ASSUM MP_TAC`conforming_fan (x:real^3,V,E)` +THEN REWRITE_TAC[conforming_fan;conforming_half_space_fan] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `ds:real^3#real^3#real^3#real^3->bool`) +THEN REWRITE_TAC[INTERS;IN_ELIM_THM;SUBSET] +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`(?y. y IN ds /\ + aff_gt {x:real^3, pr2 y', pr3 y'} {pr3 (f1_fan x V E y')} = + aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y)})` ASSUME_TAC +THENL[ +EXISTS_TAC`y':real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[]; +REMOVE_THEN"LINH"(fun th-> MRESA1_TAC th`u:real^3->bool`) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y' IN ds /\ ds SUBSET d1_fan (x:real^3,V,E)==> y' IN d1_fan(x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN REWRITE_TAC[pr2;pr3;f1_fan] +THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`v:real^3`;`w:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` sigma_fan x V E v w:real^3`;`(v:real^3)`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E v w):real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`;`sigma_fan x V E v w:real^3`;`w:real^3`] +THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`w:real^3`;`sigma_fan x V E v w:real^3`;][IN_ELIM_THM;VECTOR_ARITH`(t1 % x + t2 % y) - x=((t1+t2)- &1)%x+ t2 % (y-x)`;VECTOR_ARITH`((&1 - &1) % x + t2 % (y - x))= t2 % (y - x)`;DOT_RMUL] +THEN STRIP_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]]);; + + +let aff_gt_subset_dartset_leads_into_fan_union_aff_gt=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds ds1 Z y z . +FAN(x,V,E) +/\ conforming_fan (x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ ds1 IN face_set(hypermap1_of_fanx (x,V,E)) +/\ Z=(:real^3) DIFF (UNIONS {aff_ge {x} {v}| v IN V}) +/\ y IN dartset_leads_into_fan x V E ds +/\ z IN dartset_leads_into_fan x V E ds1 +/\ ~(x=y) /\ ~(x=z) +/\ segment[y,z] SUBSET Z +==> aff_gt {x} {y,z} SUBSET Z`, +REWRITE_TAC[segment;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN FIND_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[FAN;fan2] THEN STRIP_TAC)`FAN(x:real^3,V,E)` +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`y:real^3`;`z:real^3`][SET_RULE`DISJOINT{x} {y,z}<=> ~(x=y) /\ ~(x=z)`;IN_ELIM_THM;DIFF;SET_RULE`(x:real^3) IN (:real^3)`;UNIONS] +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`~(x IN V) /\ v IN V==> ~(x=v:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC AFF_GE_1_1[`x:real^3`;`v:real^3`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % y + t3 % z = t1' % x + t2' % v +<=> t2 % y + t3 % z = (t1' - t1) % x + t2' % v`] +THEN MP_TAC(REAL_ARITH`&0< t2 /\ &0 < t3 ==> &0 < t2+ t3 /\ &0 <= t2+ t3 /\ ~(t2 +t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2+t3:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`t2 % y + t3 % z = (t1' - t1) % x + t2' % v ==> (inv (t2+ t3)) %(t2 % y + t3 % z) = inv (t2 +t3)%((t1' - t1) % x + t2' % v:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C `;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`] +THEN STRIP_TAC +THEN ABBREV_TAC`v123= (inv (t2 + t3) * (t1' - t1)) % x + (inv (t2 + t3) * t2') % v:real^3` +THEN SUBGOAL_THEN`v123 IN aff_ge {x} {v:real^3}` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`(inv (t2 + t3) * (t1' - t1)):real` +THEN EXISTS_TAC`(inv (t2 + t3) * t2'):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (t2 + t3) * (t1' - t1) + inv (t2 + t3) * t2' += inv (t2 + t3) * ((t2+ t3)+ (t1'+ t2') - (t1+ t2+t3))`; REAL_ARITH`A + &1 - &1= A`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN MRESA1_TAC REAL_LE_INV`t2+ t3`; + +SUBGOAL_THEN`(?u. (&0 <= u /\ u <= &1) /\ v123 = (&1 - u) % y + u % z:real^3)` ASSUME_TAC +THENL[ +EXISTS_TAC`(inv (t2 + t3) * t3)` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - inv (t2 + t3) * t3= &1 - inv (t2 +t3) *(t2+ t3)+ inv(t2 +t3) * t2`; REAL_ARITH`&1 - &1 +A=A`; REAL_ARITH`A<= &1 <=> &0<= &1- A`] +THEN MRESA1_TAC REAL_LT_INV`t2+t3` +THEN MP_TAC(REAL_ARITH`&0 < inv (t2 + t3) /\ &0< t2 /\ &0< t3 ==> &0 <= inv (t2 + t3) /\ &0<= t2 /\ &0<= t3`) +THEN RESA_TAC +THEN STRIP_TAC +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[]; +REMOVE_THEN "LINH"(fun th-> MRESAL1_TAC th`v123:real^3`[DIFF;IN_ELIM_THM;UNIONS]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN EXISTS_TAC`aff_ge {x} {v:real^3}` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]]]);; + +let aff_gt_1_2_subset_aff_1_3111=prove(`!x y z v u w:real^3. +~coplanar {x,v,u,w} +/\ y IN aff_gt {x} {v,u} +/\ z IN aff_gt {x} {v,w} +==> aff_gt {x} {y,z} SUBSET aff_gt {x} {v,u,w}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`w:real^3`;`z:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`y:real^3`;`v:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`z:real^3`;`v:real^3`] +THEN REMOVE_THEN "LINH" MP_TAC +THEN REMOVE_THEN "LINH1" MP_TAC +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT {x} {v,u,w} <=> ~(x=v) /\ ~(x=u) /\ ~(x=w)`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`y:real^3`;`z:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT {x} {v,u} <=> ~(x=v) /\ ~(x=u)`;SUBSET] +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[VECTOR_ARITH` t1'' % x + + t2'' % (t1' % x + t2' % v + t3' % u) + + t3'' % (t1 % x + t2 % v + t3 % w) += (t1''+ t2''* t1'+ t3'' *t1) % x + + (t2'' * t2'+ t3'' *t2) % v + (t2''* t3') % u + + (t3''* t3) % w`] +THEN EXISTS_TAC`t1'' + t2'' * t1' + t3'' * t1:real` +THEN EXISTS_TAC`t2'' * t2' + t3'' * t2:real` +THEN EXISTS_TAC`t2'' * t3':real` +THEN EXISTS_TAC`t3'' * t3:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`(t1'' + t2'' * t1' + t3'' * t1) + + (t2'' * t2' + t3'' * t2) + + t2'' * t3' + + t3'' * t3 = t1'' + + t2'' * (t1' + t2'+ t3') + + t3'' * (t1 + t2 + t3 )`;REAL_ARITH`A * &1=A`] +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC (REAL_ARITH`&0< A/\ &0< B==> &0< A+B`) +THEN STRIP_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]; + +STRIP_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]]);; + + +let AFF_GT_1_3_SUBSET_AFF_GT_1_3=prove(`!x v u w:real^3 t:real. +~coplanar {x,v,u,w}/\ &0< t/\ t< &1 +==> aff_gt {x} {v,u,(&1-t) %u+ t %w} SUBSET aff_gt {x} {v,u,w}`, +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0< t==> ~(t= &0)`) +THEN RESA_TAC +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `t:real`) +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`(&1-t) %u+ t %w:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`(&1-t) %u+ t %w:real^3`] +THEN MRESAL_TAC AFF_GT_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT {x} {v,u,w} <=> ~(x=v) /\ ~(x=u) /\ ~(x=w)`] +THEN MRESAL_TAC AFF_GT_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`(&1-t) %u+ t %w:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT {x} {v,u,w} <=> ~(x=v) /\ ~(x=u) /\ ~(x=w)`;SUBSET] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t3 + t4 *( &1- t):real` +THEN EXISTS_TAC`t4 *t:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % u + t4 % ((&1 - t) % u + t % w) = + t1 % x + t2 % v + (t3 + t4 * (&1 - t)) % u + (t4 * t) % w:real^3`;REAL_ARITH`t1 + t2 + (t3 + t4 * (&1 - t)) + t4 * t=t1 +t2+t3+t4` +] +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC (REAL_ARITH`&0< A /\ &0< B==> &0< A+B`) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1- A<=> A< &1`]; +MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1- A<=> A< &1`]]);; + + + + + + + + +let lemma_connect_hypermap=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) f1 f2. +FAN(x,V,E) +/\ conforming_fan (x,V,E) + /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) +/\ fan80(x,V,E) +/\ f1 IN d_fan(x,V,E) /\ f2 IN d_fan(x,V,E) +==> ?D. D IN set_of_components(hypermap1_of_fanx (x,V,E)) +/\ f1 IN D /\ f2 IN D`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN ABBREV_TAC`ds= face (hypermap1_of_fanx (x,V,E)) (f1:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`ds1= face (hypermap1_of_fanx (x,V,E)) (f2:real^3#real^3#real^3#real^3)` +THEN ABBREV_TAC`Z=(:real^3) DIFF (UNIONS {aff_ge {x} {v:real^3}| v IN V})` +THEN SUBGOAL_THEN`ds IN face_set(hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL(*1*)[ + +ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`f1:real^3#real^3#real^3#real^3` +THEN EXPAND_TAC"ds" +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[];(*1*) + +SUBGOAL_THEN`ds1 IN face_set(hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL(*2*)[ + +ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`f2:real^3#real^3#real^3#real^3` +THEN EXPAND_TAC"ds1" +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[];(*2*) + +SUBGOAL_THEN`f2 IN ds1:real^3#real^3#real^3#real^3->bool` ASSUME_TAC +THENL(*3*)[ +EXPAND_TAC"ds1" +THEN REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC;(*3*) + +SUBGOAL_THEN`f1 IN ds:real^3#real^3#real^3#real^3->bool` ASSUME_TAC +THENL(*4*)[ +EXPAND_TAC"ds" +THEN REWRITE_TAC[face;orbit_map;IN_ELIM_THM] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC;(*4*) + +ABBREV_TAC`D= comb_component (hypermap1_of_fanx (x,V,E)) (f1:real^3#real^3#real^3#real^3)` +THEN MRESA_TAC lemma_component_subset[`hypermap1_of_fanx (x:real^3,V,E)`;`f1:real^3#real^3#real^3#real^3`] +THEN SUBGOAL_THEN`D IN set_of_components(hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL(*5*)[ + +ASM_REWRITE_TAC[set_of_components;set_part_components;IN_ELIM_THM] +THEN EXISTS_TAC`f1:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[];(*5*) + + +SUBGOAL_THEN`(f1:real^3#real^3#real^3#real^3) IN D`ASSUME_TAC +THENL(*6*)[ +EXPAND_TAC"D" +THEN REWRITE_TAC[comb_component;IN_ELIM_THM;is_in_component] +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`(\m. (f1_fan (x:real^3) V E POWER m) f1)` +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[POWER;I_DEF;is_path];(*6*) + +MRESAL_TAC connected_in_dartset_leads_into_fan_union_aff_gt[`x:real^3`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`ds1:real^3#real^3#real^3#real^3->bool`;`Z:real^3->bool`][segment;IN_ELIM_THM] +THEN +ABBREV_TAC`TA={t| &0 <= t /\ t <= &1 /\ (?f. f IN D /\ (&1 - t) % (y:real^3) + t % z IN dartset_leads_into_fan x V E (face (hypermap1_of_fanx (x:real^3,V,E)) f))}` +THEN ABBREV_TAC`t1= sup (TA:real->bool)` +THEN SUBGOAL_THEN`&0 IN TA:real->bool `ASSUME_TAC +THENL(*7*)[ + EXPAND_TAC"TA" +THEN REWRITE_TAC[IN_ELIM_THM;REAL_ARITH`&0<= &0 /\ &0<= &1`;VECTOR_ARITH`(&1 - &0) % y + &0 % z=y`] +THEN EXISTS_TAC`f1:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[];(*7*) + + +MP_TAC(SET_RULE`&0 IN TA ==> ~(TA ={})`) +THEN RESA_TAC +THEN EXISTS_TAC`D:real^3#real^3#real^3#real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(SET_RULE`(y=z:real^3) \/ ~(z=y)`) +THENL(*8*)[ + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`z IN dartset_leads_into_fan (x:real^3) V E ds1` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`z IN dartset_leads_into_fan (x:real^3) V E ds` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN FIND_ASSUM MP_TAC`conforming_fan (x:real^3,V,E)` +THEN REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `dartset_leads_into_fan x V E (ds:real^3#real^3#real^3#real^3->bool)`) +THEN POP_ASSUM(fun th-> MRESA1_TAC th ` (ds1:real^3#real^3#real^3#real^3->bool)` THEN MRESA1_TAC th ` (ds:real^3#real^3#real^3#real^3->bool)`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC lemma_face_subset_component[`hypermap1_of_fanx (x:real^3,V,E)`;`f1:real^3#real^3#real^3#real^3`] +THEN ASM_TAC +THEN SET_TAC[];(*8*) + +SUBGOAL_THEN`(?b. !a. a IN TA ==> a <= b)` ASSUME_TAC +THENL(*9*)[ + +EXISTS_TAC`&1` +THEN EXPAND_TAC"TA" +THEN REWRITE_TAC[IN_ELIM_THM;REAL_ARITH`&0<= &0 /\ &0<= &1`;VECTOR_ARITH`(&1 - &0) % y + &0 % z=y`] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[];(*9*) + +SUBGOAL_THEN`(!a. a IN TA ==> a <= &1)` ASSUME_TAC +THENL(*10*)[ + +EXPAND_TAC"TA" +THEN REWRITE_TAC[IN_ELIM_THM;REAL_ARITH`&0<= &0 /\ &0<= &1`;VECTOR_ARITH`(&1 - &0) % y + &0 % z=y`] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[];(*10*) + +MRESA1_TAC SUP`TA:real->bool` +THEN POP_ASSUM(fun th-> MRESA1_TAC th `&1` THEN POP_ASSUM MP_TAC THEN ASSUME_TAC th THEN STRIP_TAC) +THEN DISJ_CASES_TAC(SET_RULE` (t1:real) IN TA\/ ~(t1 IN TA)`) +THENL(*11*)[ + +POP_ASSUM MP_TAC +THEN EXPAND_TAC "TA" +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x,V,E)) (f:real^3#real^3#real^3#real^3)` +THEN MP_TAC(SET_RULE`D SUBSET d1_fan (x:real^3,V,E) /\ f IN D==> f IN d1_fan (x,V,E)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`ds2 IN face_set(hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL(*12*)[ +ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`f:real^3#real^3#real^3#real^3` +THEN EXPAND_TAC"ds2" +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[];(*12*) + +MP_TAC(REAL_ARITH`(t1:real) <= &1 ==> t1= &1 \/ t1< &1`) +THEN RESA_TAC +THENL(*13*)[ + +ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - &1) % y + &1 % z=z`] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`z IN dartset_leads_into_fan (x:real^3) V E ds1` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y'':real^3`;`z:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN FIND_ASSUM MP_TAC`conforming_fan (x:real^3,V,E)` +THEN REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `dartset_leads_into_fan x V E (ds2:real^3#real^3#real^3#real^3->bool)`) +THEN POP_ASSUM(fun th-> MRESA1_TAC th ` (ds1:real^3#real^3#real^3#real^3->bool)` THEN MRESA1_TAC th ` (ds2:real^3#real^3#real^3#real^3->bool)`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC lemma_component_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`f1:real^3#real^3#real^3#real^3`;`f:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC lemma_face_subset_component[`hypermap1_of_fanx (x:real^3,V,E)`;`f:real^3#real^3#real^3#real^3`] +THEN ASM_TAC +THEN SET_TAC[];(*13*) + +STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`dartset_leads_into_fan x V E ds2`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[open_def] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(&1 - t1) % y + t1 % z:real^3`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[dist] +THEN ABBREV_TAC`t2=min (inv(norm(z-y:real^3)) *e) (&1- t1)/ &2 + t1 ` +THEN MRESAL_TAC imp_norm_gl_zero_fan[`z:real^3`;`y:real^3`][REAL_ARITH`A>B <=> B t1< min (inv (norm (z - y)) * e) (&1 - t1) / &2 + t1/\ min (inv (norm (z - y)) * e) (&1 - t1) / &2 + t1 <= &1 /\ &0 <= min (inv (norm (z - y)) * e) (&1 - t1) / &2 + t1/\ &0 <= min (inv (norm (z - y)) * e) (&1 - t1) / &2 +/\ min (inv (norm (z - y)) * e) (&1 - t1) / &2 < e * inv (norm (z - y)) `) +THEN RESA_TAC +THEN MP_TAC(ISPEC`min (inv (norm (z - y:real^3)) * e) (&1 - t1) / &2:real`REAL_ABS_REFL) +THEN RESA_TAC +THEN SUBGOAL_THEN`norm (((&1 - t2) % y + t2 % z:real^3) - ((&1 - t1) % y + t1 % z)) < e` +ASSUME_TAC +THENL(*14*)[ +EXPAND_TAC"t2" +THEN REWRITE_TAC[VECTOR_ARITH`(((&1 - (min (inv (norm (z - y)) * e) (&1 - t1) / &2 + t1)) % y + + (min (inv (norm (z - y)) * e) (&1 - t1) / &2 + t1) % z) - + ((&1 - t1) % y + t1 % z)) += (min (inv (norm (z - y)) * e) (&1 - t1) / &2) % (z-y)`;NORM_MUL] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC imp_norm_not_zero_fan[`z:real^3`;`y:real^3`] +THEN MRESA1_TAC NORM_POS_LE`z-y:real^3` +THEN MP_TAC(REAL_ARITH`&0 <= norm (z - y) /\ ~(norm (z - y) = &0) ==> &0 < norm (z - y:real^3)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`norm(z-y:real^3)` +THEN MRESAL_TAC REAL_LT_RMUL[`min (inv (norm (z - y:real^3)) * e) (&1 - t1) / &2`;`e * inv (norm (z - y:real^3))`;`norm (z - y:real^3)`][REAL_ARITH`(A * B) *C= A *(B*C)`;REAL_ARITH`A * &1=A`];(*14*) + +STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`((&1 - t2) % y + t2 % z:real^3)`) +THEN SUBGOAL_THEN`(t2:real) IN TA` ASSUME_TAC +THENL(*15*)[ + +EXPAND_TAC "TA" +THEN REWRITE_TAC[IN_ELIM_THM] +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`f:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[];(*15*) + +FIND_ASSUM (fun th-> MP_TAC(ISPEC `t2:real` th))`!x:real. x IN TA ==> x <= t1` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;REAL_ARITH`A<=B <=> ~(B< A)`]) +THEN ASM_REWRITE_TAC[]](*15*)](*14*)](*13*)](*12*);(*11*) + + +POP_ASSUM (fun th-> MP_TAC th THEN ASSUME_TAC th) +THEN EXPAND_TAC "TA" +THEN REWRITE_TAC[IN_ELIM_THM;DE_MORGAN_THM] +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC`&0` th))`!x. x IN TA ==> x <= t1:real` +THEN FIND_ASSUM (fun th-> REWRITE_TAC[th])`&0 IN TA` +THEN RESA_TAC +THEN REWRITE_TAC[NOT_EXISTS_THM;DE_MORGAN_THM] +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN DISJ_CASES_TAC(SET_RULE`~(!e. +&0< e ==> +?e1 f3. &0 < e1 /\ e1< e /\ f3 IN D +/\ ((&1 -(t1-e1)) % y + (t1-e1) % z:real^3) IN +dartset_leads_into_fan x V E (face (hypermap1_of_fanx (x:real^3,V,E)) f3))\/ (!e. +&0< e ==> +?e1 f3. &0 < e1 /\ e1< e /\ f3 IN D +/\ ((&1 -(t1-e1)) % y + (t1-e1) % z) IN +dartset_leads_into_fan x V E (face (hypermap1_of_fanx (x:real^3,V,E)) f3)) `) +THENL(*12*)[ + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_EXISTS_THM;NOT_IMP;NOT_FORALL_THM] +THEN REWRITE_TAC[DE_MORGAN_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN SUBGOAL_THEN`(!a. a IN TA ==> a <= t1- e/ &2)`ASSUME_TAC +THENL(*13*)[ + +GEN_TAC THEN +STRIP_TAC +THEN POP_ASSUM( fun th-> MP_TAC th THEN ASSUME_TAC th) +THEN EXPAND_TAC "TA" +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0< e ==> &0< e/ &2 /\ e/ &2 < e`) +THEN RESA_TAC +THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `a:real` th))`!x. x IN TA ==> x <= t1:real` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`a:real IN TA` +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`a<= t1==> a=t1 \/ a< t1`) +THEN RESA_TAC +THENL(*14*)[ + +FIND_ASSUM MP_TAC`a:real IN TA` +THEN POP_ASSUM (fun th-> REWRITE_TAC[th;] ) +THEN EXPAND_TAC"TA" +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN"LINH"(fun th-> MRESA1_TAC th`f':real^3#real^3#real^3#real^3`);(*14*) + + +MP_TAC(REAL_ARITH`a &0< t1 -a`) +THEN RESA_TAC +THEN REMOVE_THEN "LINH1"(fun th-> MRESAL_TAC th[`t1-a:real`;`f:real^3#real^3#real^3#real^3`][REAL_ARITH`(t1 - (t1 - a))=a`]) +THEN MP_TAC(REAL_ARITH`~(t1 - a < e) /\ &0< e==> a<= t1 - e/ &2`) +THEN RESA_TAC](*14*);(*13*) + +FIND_ASSUM (fun th-> MP_TAC(ISPEC `t1- e / &2` th))`!b. (!x. x IN TA ==> x <= b) ==> t1 <= b:real` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC](*13*);(*12*) + + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN SUBGOAL_THEN`(&1 - t1) % y + t1 % z IN {(&1 - u) % y + u % z:real^3 | &0 <= u /\ u <= &1}` ASSUME_TAC +THENL(*13*)[ + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[];(*13*) + + +MP_TAC(SET_RULE`(&1 - t1) % y + t1 % z IN {(&1 - u) % y + u % z:real^3 | &0 <= u /\ u <= &1} /\ {(&1 - u) % y + u % z | &0 <= u /\ u <= &1} SUBSET Z ==> (&1 - t1) % y + t1 % z IN Z`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC yfan_union_aff_gt_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th; UNION;IN_ELIM_THM;GSYM UNIONS_TOPOLOGICAL_COMPONENT_EQ_YFAN;UNIONS]) +THEN STRIP_TAC +THENL(*14*)[ + +POP_ASSUM MP_TAC +THEN MRESA_TAC version_JUTSTKG[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3->bool`] +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`dartset_leads_into_fan x V E f`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[open_def] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(&1 - t1) % y + t1 % z:real^3`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[dist] +THEN DISCH_THEN(LABEL_TAC"LINH2") +THEN MRESAL_TAC imp_norm_gl_zero_fan[`z:real^3`;`y:real^3`][REAL_ARITH`A>B <=> B MRESA1_TAC th ` inv(norm(z-y:real^3)) * e:real`) +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`norm (((&1 - (t1- e1)) % y + (t1- e1) % z:real^3) - ((&1 - t1) % y + t1 % z)) < e` +ASSUME_TAC +THENL(*15*)[ + +REWRITE_TAC[VECTOR_ARITH`(((&1 - (t1 - e1)) % y + (t1 - e1) % z) - ((&1 - t1) % y + t1 % z)) += --(e1 %(z-y))`;NORM_NEG;NORM_MUL] +THEN MRESA_TAC imp_norm_not_zero_fan[`z:real^3`;`y:real^3`] +THEN MRESA1_TAC NORM_POS_LE`z-y:real^3` +THEN MP_TAC(REAL_ARITH`&0 <= norm (z - y) /\ ~(norm (z - y) = &0) /\ &0< e1 ==> &0 < norm (z - y:real^3)/\ &0<= e1`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`norm(z-y:real^3)` +THEN MP_TAC(ISPEC`e1:real`REAL_ABS_REFL) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LT_RMUL[`e1:real`;`inv (norm (z - y:real^3)) * (e:real)`;`(norm (z - y:real^3))`][REAL_ARITH`(A * B) *C= B*(A*C)`;REAL_ARITH`A * &1=A`];(*15*) + + +REMOVE_THEN"LINH2"(fun th-> MRESA1_TAC th`((&1 - (t1 - e1)) % y + (t1 - e1) % z):real^3`) +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC`y12=((&1 - (t1 - e1)) % y + (t1 - e1) % z):real^3` +THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x,V,E)) (f3:real^3#real^3#real^3#real^3)` +THEN MP_TAC(SET_RULE`D SUBSET d1_fan (x:real^3,V,E) /\ f3 IN D==> f3 IN d1_fan (x,V,E)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`ds2 IN face_set(hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL(*16*)[ + +ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`f3:real^3#real^3#real^3#real^3` +THEN EXPAND_TAC"ds2" +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[];(*16*) + +STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`y12:real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`dartset_leads_into_fan x V E f IN topological_component_yfan (x:real^3,V,E)` +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`y12:real^3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th`f3:real^3#real^3#real^3#real^3`) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[SYM th])](*16*)](*15*);(*14*) + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th] THEN STRIP_TAC) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] +THEN MP_TAC(REAL_ARITH`(t1:real) <= &1 ==> t1= &1 \/ t1< &1`) +THEN RESA_TAC +THENL(*15*)[ + +REWRITE_TAC[VECTOR_ARITH`(&1 - &1) % y + &1 % z=z`] +THEN STRIP_TAC +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;` (w:real^3)`] +THEN MP_TAC(SET_RULE`z IN aff_gt {x} {v, w} /\ aff_ge {x} {v, w} = + aff_gt {x} {v, w} UNION aff_ge {x} {v} UNION aff_ge {x} {w} +==> z IN aff_ge {x} {v, w:real^3} `) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN SUBGOAL_THEN`z IN xfan(x:real^3,V:real^3->bool,E)`ASSUME_TAC +THENL(*16*)[ +REWRITE_TAC[xfan;IN_ELIM_THM] +THEN EXISTS_TAC`{v,w:real^3}` +THEN ASM_REWRITE_TAC[IN] +THEN ASM_MESON_TAC[IN];(*16*) + +MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` ds1:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`z IN dartset_leads_into_fan x V E ds1 /\ dartset_leads_into_fan x V E ds1 SUBSET yfan(x:real^3,V,E) ==> z IN yfan(x:real^3,V,E)`) +THEN ASM_REWRITE_TAC[yfan;IN_ELIM_THM;DIFF]](*16*);(*15*) + +STRIP_TAC +THEN ABBREV_TAC`v1=(&1 - t1) % y + t1 % z:real^3` +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`w:real^3`;`v1:real^3`] +THEN MP_TAC(SET_RULE`{v,w:real^3} IN E==> ~(E={})`) +THEN RESA_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(dartset_leads_into_fan x V E ds):real^3->bool`;` y:real^3`] +THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(dartset_leads_into_fan x V E ds1):real^3->bool`;` z:real^3`] +THEN SUBGOAL_THEN`~(collinear{x,y,z:real^3})` ASSUME_TAC +THENL(*16*)[ + +MRESAL_TAC collinear1_fan[`(x:real^3)` ;` (z:real^3)`;`(y:real^3)`;][aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`v'= &0\/ &0< -- v' \/ &0 < v'`) +THENL(*17*)[ + +ASM_REWRITE_TAC[REAL_ARITH`A + &0=A`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`&1 % x + &0 % z= x`];(*17*) + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL(*18*)[ + +REWRITE_TAC[VECTOR_ARITH`y = u' % x + v' % z <=> u' % x =y +(--v') % z `] +THEN DISJ_CASES_TAC(SET_RULE`u'= &0 \/ ~(u'= &0)`) +THENL(*19*)[ + +ASM_REWRITE_TAC[REAL_ARITH`&0+A=A`;] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`&0 % x = y + -- &1 % z <=> y=z`];(*19*) +STRIP_TAC +THEN MRESA1_TAC REAL_MUL_LINV`u':real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`u' % x = y + --v' % z ==> (inv (u')) %(u' % x ) = inv (u')%(y + --v' % z:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C `;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`x IN {(&1 - u) % y + u % z:real^3 | &0 <= u /\ u <= &1}` ASSUME_TAC +THENL(*20*)[ +MP_TAC(REAL_ARITH`~(u'= &0) ==> &0< u'\/ &0 < -- u'`) +THEN RESA_TAC +THENL(*21*)[ + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`(inv u' * --v')` +THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 - inv u' * --v')=( &1 - inv u' * u')+ inv u' *(u'+v') `;REAL_ARITH`&1 - &1 + inv u' * &1 = inv u'`;REAL_ARITH`A<= &1<=> &0<= &1 -A `] +THEN MP_TAC(REAL_ARITH`&0< -- v' /\ &0 < u' ==> &0<= -- v' /\ &0 <= u'`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LE_INV`u':real` +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[];(*21*) + +MP_TAC(REAL_ARITH`&0< --v' /\ &0 < -- u' ==> &0 < --(u'+v')`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC](*21*);(*20*) + +MP_TAC(SET_RULE`x IN {(&1 - u) % y + u % z | &0 <= u /\ u <= &1} +/\ {(&1 - u) % y + u % z:real^3 | &0 <= u /\ u <= &1} SUBSET Z +==> x IN Z`) +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN EXPAND_TAC"Z" +THEN REWRITE_TAC[DIFF;IN_ELIM_THM;SET_RULE`x IN (:real^3)`;UNIONS;IN_ELIM_THM] +THEN EXISTS_TAC`aff_ge {x} {v:real^3}` +THEN MRESA_TAC point_in_aff_ge_1_1[`(x:real^3)`;`(v:real^3) `] +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[]](*20*)](*19*);(*18*) + + + +REPEAT STRIP_TAC +THEN SUBGOAL_THEN`y IN aff_gt {x} {z:real^3}` ASSUME_TAC +THENL(*19*)[ + +MRESAL_TAC AFF_GT_1_1[`x:real^3`;`z:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT {x} {y}<=> ~(x=y)`] +THEN EXISTS_TAC`u':real` +THEN EXISTS_TAC`v':real` +THEN ASM_REWRITE_TAC[];(*19*) + +MRESA_TAC AFF_GT_1_1_SUBSET_DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`z:real^3`] +THEN MP_TAC(SET_RULE`y IN aff_gt {x} {z:real^3}/\ aff_gt {x} {z} SUBSET dartset_leads_into_fan x V E ds1 +==> y IN dartset_leads_into_fan x V E ds1`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y'':real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN FIND_ASSUM MP_TAC`y IN dartset_leads_into_fan (x:real^3) V E ds` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`&1 IN TA:real->bool` ASSUME_TAC +THENL(*20*)[ + +EXPAND_TAC "TA" +THEN REWRITE_TAC[IN_ELIM_THM; REAL_ARITH`&0<= &1 /\ &1<= &1`;VECTOR_ARITH`(&1 - &1) % y + &1 % z=z`] +THEN EXISTS_TAC`f1:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[];(*20*) + + +FIND_ASSUM (fun th-> MP_TAC(ISPEC `&1` th))`!x. x IN TA ==> x <= t1:real` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC](*20*)](*19*)](*18*)](*17*);(*16*) + + +POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`v1 IN {(&1 - u) % y + u % z:real^3 | &0 <= u /\ u <= &1}` ASSUME_TAC +THENL(*17*)[ + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[];(*17*) + +SUBGOAL_THEN`~(x= v1:real^3)` ASSUME_TAC +THENL(*18*)[ + STRIP_TAC +THEN MP_TAC(SET_RULE`v1 IN {(&1 - u) % y + u % z | &0 <= u /\ u <= &1} +/\ {(&1 - u) % y + u % z:real^3 | &0 <= u /\ u <= &1} SUBSET Z +==> v1 IN Z`) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN EXPAND_TAC"Z" +THEN REWRITE_TAC[DIFF;IN_ELIM_THM;SET_RULE`x IN (:real^3)`;UNIONS;IN_ELIM_THM] +THEN EXISTS_TAC`aff_ge {x} {v:real^3}` +THEN MRESA_TAC point_in_aff_ge_1_1[`(x:real^3)`;`(v:real^3) `] +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[];(*18*) + + MP_TAC(SET_RULE`&0 IN TA /\ ~(t1 IN TA)==> ~(t1= &0)`) +THEN RESA_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`~collinear{x,y,v1:real^3}` ASSUME_TAC +THENL(*19*)[ + +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN MRESAL_TAC collinear1_fan[`(x:real^3)` ;` (y:real^3)`;`(z:real^3)`;][aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN MRESAL_TAC collinear1_fan[`(x:real^3)` ;` (y:real^3)`;`(v1:real^3)`;][aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN REWRITE_TAC[CONTRAPOS_THM] +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - t1) % y + t1 % z = u' % x + v' % y +<=> t1 % z= u' % x + (v'- &1 +t1) %y`] +THEN MRESA1_TAC REAL_MUL_LINV`t1:real` +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`t1 % z = u' % x + (v' - &1 + t1) % y ==> (inv (t1)) %(t1 % z ) = inv (t1)%(u' % x + (v' - &1 + t1) % y:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C `;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`] +THEN RESA_TAC +THEN EXISTS_TAC`inv t1 * u':real` +THEN EXISTS_TAC`(inv t1 * (v' - &1 + t1)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t1 * u' +(inv t1 * (v' - &1 + t1))= inv t1 * ((u'+ v')- &1 +t1)`;REAL_ARITH`&1- &1+A=A`];(*19*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`v1 IN aff_gt {x} {y,z:real^3}` ASSUME_TAC +THENL(*20*)[ + +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`y:real^3`;`z:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1- t1` +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A= &0 % X +A`;REAL_ARITH`&0< &1- t1 <=> t1< &1`;] +THEN MP_TAC(REAL_ARITH`&0<= t1 /\ ~(t1= &0)==> &0< t1`) +THEN RESA_TAC +THEN REAL_ARITH_TAC;(*20*) + +MRESAL_TAC aff_gt3_subset_aff_gt[`x:real^3`;`y:real^3`;`z:real^3`;`v1:real^3`][SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`coplanar{x,v1,v,y}\/ ~coplanar{x,v1,v,y:real^3}`) +THENL(*21*)[ + +MRESAL_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v1:real^3`;`v:real^3`;`y:real^3`][DE_MORGAN_THM;] +THENL(*22*)[ + + +MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v1:real^3`;`v:real^3`;`y:real^3`] +THEN MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{x,v1:real^3}`;`{v:real^3}`] +THEN MP_TAC(SET_RULE`y IN aff_gt {x, v1} {v}/\ aff_gt {x, v1} {v} SUBSET aff_ge {x, v1} {v} +==> y IN aff_ge {x, v1} {v:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC decomposition_planar_by_angle_fan[`x:real^3`;`v1:real^3`;`v:real^3`;`y:real^3`] +THENL(*23*)[ + +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESAL_TAC aff_gt_subset_dartset_leads_into_fan_union_aff_gt[`x:real^3`;`(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`ds1:real^3#real^3#real^3#real^3->bool`;`Z:real^3->bool`;`y:real^3`;`z:real^3`][segment] +THEN MP_TAC(SET_RULE`v IN aff_gt {x} {y,v1:real^3}/\ aff_gt {x} {y, v1} SUBSET aff_gt {x} {y, z} +/\ aff_gt {x} {y, z} SUBSET Z==> v IN Z`) +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"Z" +THEN REWRITE_TAC[DIFF;IN_ELIM_THM;UNIONS;NOT_EXISTS_THM;DE_MORGAN_THM] +THEN MRESAL_TAC point_in_aff_ge_1_1[`(x:real^3)`;`(v:real^3) `][IN_SING] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `aff_ge {x} {v:real^3}`) +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`);(*23*) + + +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{x:real^3}`;`{v:real^3,w}`] +THEN MP_TAC(SET_RULE`aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w:real^3} +/\ v1 IN aff_gt {x} {v, w} ==> v1 IN aff_ge {x} {v, w}`) +THEN RESA_TAC +THEN MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`w:real^3`; `v:real^3`;`v1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`aff_ge {x} {v, v1} SUBSET aff_ge {x} {v, w} /\ y IN aff_ge {x} {v, v1} ==> y IN aff_ge {x} {v, w:real^3}`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y IN dartset_leads_into_fan x V E ds +/\ dartset_leads_into_fan x V E ds SUBSET yfan(x,V,E)==> y IN yfan(x:real^3,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan;DIFF;IN_ELIM_THM;xfan;NOT_EXISTS_THM;DE_MORGAN_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`{v,w:real^3}`) +THEN ASM_TAC +THEN REWRITE_TAC[IN] +THEN REPEAT RESA_TAC](*23*);(*22*) + + + + +MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`w:real^3`;`v:real^3`;`v1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3 `;`v1:real^3`] +THEN MRESAL_TAC sum4_azim_fan[`x:real^3`;`v1:real^3`;`v:real^3`;`w:real^3`;`y:real^3`][REAL_ARITH`pi<=pi`;REAL_ARITH`pi = pi + azim x v1 w y <=> azim x v1 w y= &0`] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v1:real^3`;`w:real^3`;`y:real^3`] +THEN MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{x,v1:real^3}`;`{w:real^3}`] +THEN MP_TAC(SET_RULE`y IN aff_gt {x, v1} {w}/\ aff_gt {x, v1} {w} SUBSET aff_ge {x, v1} {w} +==> y IN aff_ge {x, v1} {w:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC decomposition_planar_by_angle_fan[`x:real^3`;`v1:real^3`;`w:real^3`;`y:real^3`] +THENL(*23*)[ + +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESAL_TAC aff_gt_subset_dartset_leads_into_fan_union_aff_gt[`x:real^3`;`(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`ds1:real^3#real^3#real^3#real^3->bool`;`Z:real^3->bool`;`y:real^3`;`z:real^3`][segment] +THEN MP_TAC(SET_RULE`w IN aff_gt {x} {y,v1:real^3}/\ aff_gt {x} {y, v1} SUBSET aff_gt {x} {y, z} +/\ aff_gt {x} {y, z} SUBSET Z==> w IN Z`) +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"Z" +THEN REWRITE_TAC[DIFF;IN_ELIM_THM;UNIONS;NOT_EXISTS_THM;DE_MORGAN_THM] +THEN MRESAL_TAC point_in_aff_ge_1_1[`(x:real^3)`;`(w:real^3) `][IN_SING] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `aff_ge {x} {w:real^3}`) +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`; +` (w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*23*) + + + +MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{x:real^3}`;`{v:real^3,w}`] +THEN MP_TAC(SET_RULE`aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w:real^3} +/\ v1 IN aff_gt {x} {v, w} ==> v1 IN aff_ge {x} {v, w}`) +THEN RESA_TAC +THEN MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`v:real^3`; `w:real^3`;`v1:real^3`] +THEN MP_TAC(SET_RULE`aff_ge {x} {v1,w} SUBSET aff_ge {x} {v, w} /\ y IN aff_ge {x} {v1,w} ==> y IN aff_ge {x} {v, w:real^3}`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y IN dartset_leads_into_fan x V E ds +/\ dartset_leads_into_fan x V E ds SUBSET yfan(x,V,E)==> y IN yfan(x:real^3,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan;DIFF;IN_ELIM_THM;xfan;NOT_EXISTS_THM;DE_MORGAN_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`{v,w:real^3}`) +THEN ASM_TAC +THEN REWRITE_TAC[IN] +THEN REPEAT RESA_TAC](*23*)](*22*);(*21*) + + +MRESAL_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v1:real^3`;`v:real^3`;`y:real^3`][DE_MORGAN_THM;] +THEN MP_TAC(REAL_ARITH`&0<= azim x v1 v y /\ azim x v1 v y < &2 * pi /\ ~(azim x v1 v y = &0)/\ ~(azim x v1 v y= pi)==> (&0< azim x v1 v y/\ azim x v1 v y < pi)\/ (pi< azim x v1 v y/\ azim x v1 v y < &2 * pi)`) +THEN ASM_REWRITE_TAC[azim] +THEN STRIP_TAC +THENL(*22*)[ + +MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`; `y:real^3`;`v:real^3`] +THEN ABBREV_TAC`u123=inverse1_sigma_fan x V E v w:real^3` +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`) +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u123:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u123:real^3)`; +` (v:real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`; `w:real^3`;`u123:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN MRESA_TAC aff_gt_1_2_cross_dotr_4point_neg[`x:real^3`;`v1:real^3`;`y:real^3`;`v:real^3`;`w:real^3`;] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REWRITE_TAC[GSYM DOT_LNEG;GSYM CROSS_SKEW] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN MRESA_TAC exists_open_not_collinear[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (w:real^3)`;`(v:real^3)`;`(u123:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN SUBGOAL_THEN`(!h. &0 < h /\ h < t1' / &2 ==> ~collinear {x, (&1 - h) % v + h % u123, w:real^3})`ASSUME_TAC +THENL(*23*)[ + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CHANGE") +THEN GEN_TAC THEN STRIP_TAC +THEN REMOVE_THEN "CHANGE"(fun th-> MRESA1_TAC th`h:real`) +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*23*) + +MP_TAC(REAL_ARITH`&0< t1' /\ t1'<= &1==> &0< t1'/ &2 /\ t1'/ &2 < &1`) +THEN RESA_TAC +THEN MRESAL_TAC condition_4point_aff_gt_1_2inter_aff_gt_1_2[`x:real^3`;`v1:real^3`;`y:real^3`;`w:real^3`;` v:real^3`;`u123:real^3`;`t1'/ &2:real`][REAL_ARITH`&1/ &2 < &1 /\ &0 < &1/ &2`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN SUBGOAL_THEN`(x,v,w,sigma_fan x V E v w) IN d1_fan(x:real^3,V,E)` +ASSUME_TAC +THENL(*24*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`sigma_fan x V E v w:real^3` +THEN ASM_REWRITE_TAC[];(*24*) + +SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w) IN + face_set (hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL(*25*)[ + +REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;] +THEN EXISTS_TAC`(x,v,w,sigma_fan x V E v w:real^3)` +THEN ASM_REWRITE_TAC[face];(*25*) + +SUBGOAL_THEN`(x,w,v,sigma_fan x V E w v) IN d1_fan(x:real^3,V,E)` +ASSUME_TAC +THENL(*26*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E w v:real^3` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*26*) + + +SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v) IN + face_set (hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL(*27*)[ + +REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;] +THEN EXISTS_TAC`(x,w,v,sigma_fan x V E w v:real^3)` +THEN ASM_REWRITE_TAC[face];(*27*) + +SUBGOAL_THEN`(x,v,u123,w:real^3) IN face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v)`ASSUME_TAC +THENL(*28*)[ + +REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`SUC 0:num` +THEN ASM_REWRITE_TAC[POWER; ARITH_RULE`SUC 0 >= 0`;I_DEF;o_DEF] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC 0:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(x,w,v,sigma_fan x V E w v):real^3#real^3#real^3#real^3`[POWER;I_DEF;o_DEF;]) +THEN REWRITE_TAC[f1_fan] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`];(*28*) + +MP_TAC(REAL_ARITH`&0< t /\ t< &1==> &0< t/ &2 /\ t/ &2< t/\ t/ &2< &1/\ t/ &2<= &1 /\ &0<= t/ &2/\ ~(t/ &2 = &0)`) +THEN RESA_TAC +THEN REMOVE_THEN "YEU" (fun th-> MRESAL1_TAC th`t/ &2:real`[SET_RULE`~(A={}) <=> ?a. a IN A`;INTER;IN_ELIM_THM]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`;`u123:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESAL_TAC aff_gt_1_3_eq_unions_aff_gt_1_2[`x:real^3`;`w:real^3`;`v:real^3`;`u123:real^3`][UNIONS;IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` w:real^3`;` v:real^3`;` u123:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{x' | ?u. (?a. (&0 < a /\ a < &1) /\ + u = aff_gt {x} {(&1 - a) % v + a % u123, w}) /\ + x' IN u} SUBSET + dart_leads_into x V E v u123 +/\ a IN aff_gt {x} {(&1 - t / &2) % v + t / &2 % u123, w:real^3} +/\ &0 < t / &2 /\ t / &2 < &1 +==> a IN dart_leads_into x V E v u123`) +THEN RESA_TAC +THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`(face (hypermap1_of_fanx (x,V:real^3->bool,E)) (x,w,v,sigma_fan x V E w v)) :real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th `(x:real^3,v:real^3,u123:real^3,w:real^3)`[pr2;pr3]) +THEN MRESAL_TAC scale_in_edges_fan[`(x:real^3)`;`(y:real^3)`;`(v1:real^3)`;`(a:real^3)`][SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`;VECTOR_ARITH`a' % (a - x) = (&1 - t') % y + t' % v1 - x <=> (&1- a')% x + a' % a= (&1 - t') % y + t' % v1`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`y:real^3`;`v1:real^3`;`a:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;` (a:real^3)`;`(y:real^3)`;] +THEN SUBGOAL_THEN`(&1 - t') % y + t' % v1 IN aff_gt {x} {a:real^3}`ASSUME_TAC +THENL(*29*)[ + +MRESAL_TAC AFF_GT_1_1[`x:real^3`;`a:real^3`][SET_RULE`DISJOINT{x} {y} <=> ~(x= y)`;IN_ELIM_THM] +THEN EXISTS_TAC`&1-a':real` +THEN EXISTS_TAC` a':real` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*29*) + + +MRESA_TAC AFF_GT_1_1_SUBSET_DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v)):real^3#real^3#real^3#real^3->bool`;`a:real^3`] +THEN SUBGOAL_THEN`(&1 - t') % y + t' % v1 IN aff_gt {x} {(&1 - t / &2) % v + t / &2 % u123, w:real^3}` +ASSUME_TAC +THENL(*30*)[ + +MRESA_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`;`u123:real^3`;`t/ &2:real`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC th3[`x:real^3`;`(&1 - t / &2) % v + t / &2 % u123:real^3`;`w:real^3`] +THEN MRESA_TAC scale_aff_gt_fan[`x:real^3`;`(&1 - t / &2) % v + t / &2 % u123:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`a:real^3`;`a':real`][VECTOR_ARITH`a' % (a - x) + x=(&1 - a') % x + a' % a`]) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC;(*30*) + +MRESA_TAC continuous_coplanar_fan[`x:real^3 `;`w:real^3`;`v:real^3`;`u123:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `t/ &2:real`) +THEN MRESA_TAC aff_gt_1_2_subset_aff_1_3111[`x:real^3`;`(&1 - t') % y + t' % v1:real^3`;`v1:real^3`;`w:real^3`;`(&1 - t / &2) % v + t / &2 % u123:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC AFF_GT_1_3_SUBSET_AFF_GT_1_3[`x:real^3 `;`w:real^3`;`v:real^3`;`u123:real^3`;`t/ &2 :real`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`aff_gt {x} {w, (&1 - t / &2) % v + t / &2 % u123, v} SUBSET + {x' | ?u. (?a. (&0 < a /\ a < &1) /\ + u = aff_gt {x} {(&1 - a) % v + a % u123, w}) /\ + x' IN u} +/\ {x' | ?u. (?a. (&0 < a /\ a < &1) /\ + u = aff_gt {x} {(&1 - a) % v + a % u123, w}) /\ + x' IN u} SUBSET + dart_leads_into x V E v u123 +==> +aff_gt {x} {w, (&1 - t / &2) % v + t / &2 % u123, v:real^3} SUBSET +dart_leads_into x V E v u123 +`) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`aff_gt {x} {v1, (&1 - t') % y + t' % v1} SUBSET + aff_gt {x} {w, v, (&1 - t / &2) % v + t / &2 % u123} + +/\ aff_gt {x} {w, v, (&1 - t / &2) % v + t / &2 % u123} SUBSET + dart_leads_into x V E v u123 + +==> +aff_gt {x} {v1, (&1 - t') % y + t' % v1} SUBSET +dart_leads_into x V E v u123 +`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`&0 IN TA /\ ~(t1 IN TA)==> ~(t1= &0)`) +THEN MP_TAC(REAL_ARITH`t'< &1/\ &0<= t1 /\ ~(t1= &0)==> &0< &1- t' /\ ~(&1- t' = &0) /\ &0< t1`) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LT_MUL[`t1:real`;`&1- t':real`][REAL_ARITH`t1*(&1- t')= t1- t' * t1`] +THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th `t1 - t' * t1:real`) +THEN SUBGOAL_THEN`(&1 - (t1 - e1)) % y + (t1 - e1) % z IN aff_gt {x} {v1, (&1 - t') % y + t' % v1:real^3}` +ASSUME_TAC +THENL(*31*)[ + +MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v)):real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`(&1 - t') % y + t' % v1 IN aff_gt {x} {a:real^3} +/\ aff_gt {x} {a} SUBSET dart_leads_into x V E v u123 +/\ dart_leads_into x V E v u123 SUBSET yfan (x,V,E) +==> (&1 - t') % y + t' % v1 IN yfan(x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan;IN_ELIM_THM;DIFF] +THEN STRIP_TAC +THEN MRESA_TAC x_in_xfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MP_TAC(SET_RULE`~((&1 - t') % y + t' % v1 IN xfan (x,V:real^3->bool,E)) /\ x IN xfan (x,V,E) +==> ~(x= (&1 - t') % y + t' % v1:real^3)`) +THEN RESA_TAC +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v1:real^3`;`(&1 - t') % y + t' % v1:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`; +VECTOR_ARITH`t1' % x + t2 % v1 + t3 % ((&1 - t') % y + t' % v1) += t1' % x + (t3 *(&1 - t')) % y + (t2+ t3*t') % v1`] +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + + (t3 * (&1 - t')) % y + + (t2 + t3 * t') % ((&1 - t1) % y + t1 % z) += t1' % x + + (t3 * (&1 - t') + (t2 + t3 * t') * (&1 - t1)) % y + + ((t2 + t3 * t') * t1) % z`] +THEN MRESA1_TAC REAL_MUL_LINV`&1- t':real` +THEN MRESA1_TAC REAL_MUL_LINV`t1:real` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC `inv t1 * (t1- e1)- ((&1 - (t1 - e1)) - inv t1 * (t1- e1) *(&1- t1)) * inv(&1- t')* t' :real` +THEN EXISTS_TAC`((&1 - (t1 - e1)) - inv t1 * (t1- e1) *(&1- t1)) * inv(&1- t'):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t1 * (t1 - e1) - a1 * t' + a1 * t'= (t1- e1)* inv t1`; REAL_ARITH`(A*B)*C=A*(B*C)`;REAL_ARITH`&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)+ + (t1 - e1) * inv t1 * (&1 - t1)= &1 - (t1 - e1)`; REAL_ARITH`A * &1=A` +;VECTOR_ARITH` &0 % x + A +B= A+B`; +REAL_ARITH`&0 + + inv t1 * (t1 - e1) - + (&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)) * inv (&1 - t') * t' + + (&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)) * inv (&1 - t') += inv t1 * (t1 - e1) + + (&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)) * inv (&1 - t') *(&1- t')`; +REAL_ARITH`inv t1 * (t1 - e1) + &1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1) += (t1 - e1)*(inv t1 * t1 ) + &1 - (t1 - e1)` +; REAL_ARITH`A+ &1-A= &1`] +THEN ASM_REWRITE_TAC[REAL_ARITH`&1-(t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)= +&1- (&1+ inv t1 - inv t1* t1) *(t1 - e1) `; REAL_ARITH`A +B-A=B` +;REAL_ARITH`inv t1 * (t1 - e1) = inv t1 * t1 - inv t1 * e1` +;REAL_ARITH`A-(A-B)=B`; +REAL_ARITH`&1 - inv t1 * e1 - (inv t1 * e1) * inv (&1 - t') * t' += &1 - inv t1 * e1 - (inv t1 * e1) * inv (&1 - t') + (inv t1 * e1) * inv (&1 - t') * (&1-t')`; +REAL_ARITH`&1 - inv t1 * e1 - (inv t1 * e1) * inv (&1 - t') + (inv t1 * e1) * &1= +&1- (inv t1 * e1) * inv (&1 - t')` ] +THEN STRIP_TAC +THENL(*32*)[ + +REWRITE_TAC[ REAL_ARITH`&0< &1 - (inv t1 * e1) * inv (&1 - t') +<=> ((inv t1) * inv (&1 -t')) * e1 < &1`;GSYM REAL_INV_MUL; REAL_ARITH`A*( &1- B)=A- B*A`] +THEN MP_TAC(REAL_ARITH` &0< t1 - t' * t1==> ~(t1 - t' * t1= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`t1- t' * t1:real` +THEN MRESA1_TAC REAL_MUL_LINV`t1- t' * t1:real` +THEN MRESA_TAC REAL_LT_LMUL[`inv (t1- t' * t1):real`;`e1:real`;`t1- t' * t1:real`];(*32*) + +REWRITE_TAC[ REAL_ARITH`&0< (inv t1 * e1) * inv (&1 - t') +<=> &0< ((inv t1) * inv (&1 -t')) * e1 `;GSYM REAL_INV_MUL; REAL_ARITH`A*( &1- B)=A- B*A`] +THEN MRESA1_TAC REAL_LT_INV`t1- t' * t1:real` +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]](*32*);(*31*) + +MP_TAC(SET_RULE`(&1 - (t1 - e1)) % y + (t1 - e1) % z IN + aff_gt {x} {v1, (&1 - t') % y + t' % v1} +/\ aff_gt {x} {v1, (&1 - t') % y + t' % v1:real^3} SUBSET + dart_leads_into x V E v u123 +==> (&1 - (t1 - e1)) % y + (t1 - e1) % z IN + dart_leads_into x V E v u123`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`D SUBSET d1_fan (x:real^3,V,E) /\ f3 IN D==> f3 IN d1_fan (x,V,E)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E)) f3 IN + face_set (hypermap1_of_fanx (x:real^3,V,E))` +ASSUME_TAC +THENL(*32*)[ + +ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`f3:real^3#real^3#real^3#real^3` +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[];(*32*) + +ABBREV_TAC`y123=(&1 - (t1 - e1)) % y + (t1 - e1) % z:real^3` +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`y123:real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v):real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y'':real^3`;`y123:real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool`] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`conforming_fan (x:real^3,V,E)` +THEN REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `dartset_leads_into_fan x V E ((face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool)`) +THEN POP_ASSUM(fun th-> MRESA1_TAC th ` ((face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool)` THEN MRESA1_TAC th ` ((face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v)):real^3#real^3#real^3#real^3->bool)`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC lemma_component_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`f1:real^3#real^3#real^3#real^3`;`f3:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC lemma_face_subset_component[`hypermap1_of_fanx (x:real^3,V,E)`;`f3:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN` (x,w,v,sigma_fan x V E w v)IN face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v)` ASSUME_TAC +THENL(*33*)[ +REWRITE_TAC[face;IN_ELIM_THM; orbit_map] +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>= 0`;POWER;I_DEF];(*33*) + +STRIP_TAC +THEN MP_TAC(SET_RULE`x,w,v,sigma_fan x V E w v IN + face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v:real^3) +/\ face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v) SUBSET D +==> x,w,v,sigma_fan x V E w v IN D`) +THEN RESA_TAC +THEN ABBREV_TAC`u12=inverse1_sigma_fan x V E w v:real^3` +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`w:real^3`;`u12:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u12:real^3)`; +` (w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`; `v:real^3`;`u12:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN SUBGOAL_THEN`(!h. &0 < h /\ h < &1 / &2 ==> ~collinear {x, v, (&1 - h) % w + h % u12:real^3})` +ASSUME_TAC +THENL(*34*)[ +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`u12:real^3`;`h:real`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*34*) + +MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`z:real^3`;`y:real^3`;`v1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`z:real^3`;`y:real^3 `;`v1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REWRITE_TAC[SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y) /\ ~(x=z)`;] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x v1 v y < pi ==> azim x v1 v y <= pi`) +THEN RESA_TAC +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`v1:real^3`;`z:real^3`;`v:real^3`;`y:real^3`] +THEN MP_TAC(REAL_ARITH`pi = azim x v1 z v + azim x v1 v y /\ +&0< azim x v1 v y /\ azim x v1 v y< pi ==> &0< azim x v1 z v /\ azim x v1 z v < pi`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`; `v:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN MRESAL_TAC condition_4point_aff_gt_1_2inter_aff_gt_1_2[`x:real^3`;`v1:real^3`;`z:real^3`;`v:real^3`;` w:real^3`;`u12:real^3`;`&1/ &2:real`][REAL_ARITH`&1/ &2 < &1 /\ &0 < &1/ &2`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`t''/ &2:real`[SET_RULE`~(A={}) <=> ?a. a IN A`;INTER;IN_ELIM_THM]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0 < t''/\ t'' < &1 ==> &0 < t'' / &2 /\ t'' / &2 < t''/\ t'' / &2< &1`) +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`u12:real^3`] +THEN MRESAL_TAC aff_gt_1_3_eq_unions_aff_gt_1_2[`x:real^3`;`v:real^3`;`w:real^3`;`u12:real^3`][UNIONS;IN_ELIM_THM] +THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` w:real^3`;` u12:real^3`] +THEN MP_TAC(SET_RULE`{x' | ?u. (?a. (&0 < a /\ a < &1) /\ + u = aff_gt {x} {v, (&1 - a) % w + a % u12}) /\ + x' IN u} SUBSET + dart_leads_into x V E w u12 +/\ a'' IN aff_gt {x} {v, (&1 - t'' / &2) % w + t'' / &2 % u12:real^3} +/\ &0< t''/ &2 /\ t''/ &2< &1 +==> a'' IN dart_leads_into x V E w u12`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`x,w,u12,v IN + face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w:real^3)`ASSUME_TAC +THENL(*35*)[ + +REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`SUC 0:num` +THEN ASM_REWRITE_TAC[POWER; ARITH_RULE`SUC 0 >= 0`;I_DEF;o_DEF] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC 0:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(x,v,w,sigma_fan x V E v w):real^3#real^3#real^3#real^3`[POWER;I_DEF;o_DEF;]) +THEN REWRITE_TAC[f1_fan] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`];(*35*) + +MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`(face (hypermap1_of_fanx (x,V:real^3->bool,E)) (x,v,w,sigma_fan x V E v w)) :real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th `(x:real^3,w:real^3,u12:real^3,v:real^3)`[pr2;pr3]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESAL_TAC scale_in_edges_fan[`(x:real^3)`;`(v1:real^3)`;`(z:real^3)`;`(a'':real^3)`][SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`;VECTOR_ARITH`a' % (a - x) = (&1 - t') % y + t' % v1 - x <=> (&1- a')% x + a' % a= (&1 - t') % y + t' % v1`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v1:real^3`;`z:real^3`;`a'':real^3`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (a'':real^3)`;`(v1:real^3)`;] +THEN SUBGOAL_THEN`(&1 - t''') % v1 + t''' % z IN aff_gt {x} {a'':real^3}`ASSUME_TAC +THENL(*36*)[ + +MRESAL_TAC AFF_GT_1_1[`x:real^3`;`a'':real^3`][SET_RULE`DISJOINT{x} {y} <=> ~(x= y)`;IN_ELIM_THM] +THEN EXISTS_TAC`&1-a''':real` +THEN EXISTS_TAC` a''':real` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*36*) + +MRESA_TAC AFF_GT_1_1_SUBSET_DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)):real^3#real^3#real^3#real^3->bool`;`a'':real^3`] +THEN MP_TAC(SET_RULE`(&1 - t''') % v1 + t''' % z IN aff_gt {x} {a''} +/\ aff_gt {x} {a''} SUBSET + dartset_leads_into_fan x V E + (face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w:real^3)) +==> (&1 - t''') % v1 + t''' % z IN + dartset_leads_into_fan x V E + (face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w))`) +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - t''') % ((&1 - t1) % y + t1 % z) + t''' % z +=(&1 - (t1+ (&1 - t1)*t''')) % y + (t1+ (&1 - t1)*t''') % z`] +THEN SUBGOAL_THEN`(x,v,w,sigma_fan x V E v w:real^3) IN D`ASSUME_TAC +THENL(*37*)[ + +MRESA_TAC lemma_component_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`f1:real^3#real^3#real^3#real^3`;`(x,w,v,sigma_fan x V E w v:real^3):real^3#real^3#real^3#real^3`] +THEN MRESA_TAC lemma_powers_in_component[`hypermap1_of_fanx (x:real^3,V,E)`;`(x,w,v,sigma_fan x V E w v :real^3)`;`SUC 0:num`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC 0:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(x,w,v,sigma_fan x V E w v:real^3):real^3#real^3#real^3#real^3`) +THEN REWRITE_TAC[e_fan;POWER;I_DEF;o_DEF];(*37*) + + +STRIP_TAC +THEN SUBGOAL_THEN `t1 + (&1 - t1) * t''' IN TA:real->bool`ASSUME_TAC +THENL(*38*)[ + +EXPAND_TAC"TA" +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THENL(*39*)[ + +MATCH_MP_TAC(REAL_ARITH`&0<= A /\ &0<=B ==> &0<=A+B`) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &1- A<=> A<= &1`] +THEN MATCH_MP_TAC(REAL_ARITH`&0 &0<=A `) +THEN ASM_REWRITE_TAC[];(*39*) +STRIP_TAC +THENL(*40*)[ + +REWRITE_TAC[REAL_ARITH`t1 + (&1 - t1) * t''' <= &1<=> &0 <= (&1 - t1)* (&1- t''')`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &1- A<=> A<= &1`] +THEN MATCH_MP_TAC(REAL_ARITH`A< &1 ==> A<= &1 `) +THEN ASM_REWRITE_TAC[];(*40*) + +EXISTS_TAC`(x,v,w,sigma_fan x V E v w:real^3)` +THEN ASM_REWRITE_TAC[]](*40*)](*39*);(*38*) + +FIND_ASSUM (fun th-> MP_TAC(ISPEC `t1 + (&1 - t1) * t''':real` th))`!x. x IN TA ==> x <= t1` +THEN MP_TAC(SET_RULE`t1 + (&1 - t1) * t''' IN TA /\ ~(t1 IN TA)==> ~(t1=t1 + (&1 - t1) * t''')`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`t1 + (&1 - t1) * t''' <= t1 /\ ~(t1= t1 + (&1 - t1) * t''') /\ t1<= &1 /\ &0< t''' +==> (&1 - t1) * t'''< &0:real /\ &0<= (&1 -t1)/\ &0<= t'''`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`(&1- t1):real`;`t''':real`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC](*38*)](*37*)](*36*)](*35*)](*34*)](*33*)](*32*)](*31*)](*30*)](*29*)](*28*)](*27*)](*26*)](*25*)](*24*)](*23*);(*22*) + + +POP_ASSUM MP_TAC +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`w:real^3`;`v:real^3`;`v1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3 `;`v1:real^3`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`pi < azim x v1 v y==> pi <= azim x v1 v y`) +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v1:real^3`;`v:real^3`;`w:real^3`;`y:real^3`] +THEN MP_TAC(REAL_ARITH`pi < azim x v1 v y +/\ azim x v1 v y = pi + azim x v1 w y /\ azim x v1 v y< &2 * pi +==> &0< azim x v1 w y /\ azim x v1 w y< pi`) +THEN ASM_REWRITE_TAC[azim] +THEN STRIP_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`; `y:real^3`;`w:real^3`] +THEN ABBREV_TAC`u123=inverse1_sigma_fan x V E w v:real^3` +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`w:real^3`;`u123:real^3`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u123:real^3)`; +` (w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`; `v:real^3`;`u123:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN MRESA_TAC aff_gt_1_2_cross_dotr_4point_neg[`x:real^3`;`v1:real^3`;`y:real^3`;`w:real^3`;`v:real^3`;] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REWRITE_TAC[GSYM DOT_LNEG;GSYM CROSS_SKEW] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN MRESA_TAC exists_open_not_collinear[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(w:real^3)`;`(u123:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN SUBGOAL_THEN`(!h. &0 < h /\ h < t1' / &2 ==> ~collinear {x, (&1 - h) % w + h % u123, v:real^3})`ASSUME_TAC +THENL(*23*)[ + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CHANGE") +THEN GEN_TAC THEN STRIP_TAC +THEN REMOVE_THEN "CHANGE"(fun th-> MRESA1_TAC th`h:real`) +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*23*) + +MP_TAC(REAL_ARITH`&0< t1' /\ t1'<= &1==> &0< t1'/ &2 /\ t1'/ &2 < &1`) +THEN RESA_TAC +THEN MRESAL_TAC condition_4point_aff_gt_1_2inter_aff_gt_1_2[`x:real^3`;`v1:real^3`;`y:real^3`;`v:real^3`;` w:real^3`;`u123:real^3`;`t1'/ &2:real`][REAL_ARITH`&1/ &2 < &1 /\ &0 < &1/ &2`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN SUBGOAL_THEN`(x,w,v,sigma_fan x V E w v) IN d1_fan(x:real^3,V,E)` +ASSUME_TAC +THENL(*24*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E w v:real^3` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*24*) + +SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v) IN + face_set (hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL(*25*)[ + +REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;] +THEN EXISTS_TAC`(x,w,v,sigma_fan x V E w v:real^3)` +THEN ASM_REWRITE_TAC[face];(*25*) + +SUBGOAL_THEN`(x,v,w,sigma_fan x V E v w) IN d1_fan(x:real^3,V,E)` +ASSUME_TAC +THENL(*26*)[ + +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`sigma_fan x V E v w:real^3` +THEN ASM_REWRITE_TAC[];(*26*) + + +SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w) IN + face_set (hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL(*27*)[ + +REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;] +THEN EXISTS_TAC`(x,v,w,sigma_fan x V E v w:real^3)` +THEN ASM_REWRITE_TAC[face];(*27*) + +SUBGOAL_THEN`(x,w,u123,v:real^3) IN face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)`ASSUME_TAC +THENL(*28*)[ + +REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`SUC 0:num` +THEN ASM_REWRITE_TAC[POWER; ARITH_RULE`SUC 0 >= 0`;I_DEF;o_DEF] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC 0:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(x,v,w,sigma_fan x V E v w):real^3#real^3#real^3#real^3`[POWER;I_DEF;o_DEF;]) +THEN REWRITE_TAC[f1_fan] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`];(*28*) + +MP_TAC(REAL_ARITH`&0< t /\ t< &1==> &0< t/ &2 /\ t/ &2< t/\ t/ &2< &1/\ t/ &2<= &1 /\ &0<= t/ &2/\ ~(t/ &2 = &0)`) +THEN RESA_TAC +THEN REMOVE_THEN "YEU" (fun th-> MRESAL1_TAC th`t/ &2:real`[SET_RULE`~(A={}) <=> ?a. a IN A`;INTER;IN_ELIM_THM]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`u123:real^3`] +THEN MRESAL_TAC aff_gt_1_3_eq_unions_aff_gt_1_2[`x:real^3`;`v:real^3`;`w:real^3`;`u123:real^3`][UNIONS;IN_ELIM_THM] +THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` w:real^3`;` u123:real^3`] +THEN MP_TAC(SET_RULE`{x' | ?u. (?a. (&0 < a /\ a < &1) /\ + u = aff_gt {x} {(&1 - a) % w + a % u123, v}) /\ + x' IN u} SUBSET + dart_leads_into x V E w u123 +/\ a IN aff_gt {x} {(&1 - t / &2) % w + t / &2 % u123, v:real^3} +/\ &0 < t / &2 /\ t / &2 < &1 +==> a IN dart_leads_into x V E w u123`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`(face (hypermap1_of_fanx (x,V:real^3->bool,E)) (x,v,w,sigma_fan x V E v w)) :real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th `(x:real^3,w:real^3,u123:real^3,v:real^3)`[pr2;pr3]) +THEN MRESAL_TAC scale_in_edges_fan[`(x:real^3)`;`(y:real^3)`;`(v1:real^3)`;`(a:real^3)`][SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`;VECTOR_ARITH`a' % (a - x) = (&1 - t') % y + t' % v1 - x <=> (&1- a')% x + a' % a= (&1 - t') % y + t' % v1`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`y:real^3`;`v1:real^3`;`a:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;` (a:real^3)`;`(y:real^3)`;] +THEN SUBGOAL_THEN`(&1 - t') % y + t' % v1 IN aff_gt {x} {a:real^3}`ASSUME_TAC +THENL(*29*)[ + +MRESAL_TAC AFF_GT_1_1[`x:real^3`;`a:real^3`][SET_RULE`DISJOINT{x} {y} <=> ~(x= y)`;IN_ELIM_THM] +THEN EXISTS_TAC`&1-a':real` +THEN EXISTS_TAC` a':real` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*29*) + + +MRESA_TAC AFF_GT_1_1_SUBSET_DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)):real^3#real^3#real^3#real^3->bool`;`a:real^3`] +THEN SUBGOAL_THEN`(&1 - t') % y + t' % v1 IN aff_gt {x} {(&1 - t / &2) % w + t / &2 % u123, v:real^3}` +ASSUME_TAC +THENL(*30*)[ + +MRESA_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`u123:real^3`;`t/ &2:real`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC th3[`x:real^3`;`(&1 - t / &2) % w + t / &2 % u123:real^3`;`v:real^3`] +THEN MRESA_TAC scale_aff_gt_fan[`x:real^3`;`(&1 - t / &2) % w + t / &2 % u123:real^3`;`v:real^3`] +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`a:real^3`;`a':real`][VECTOR_ARITH`a' % (a - x) + x=(&1 - a') % x + a' % a`]) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC;(*30*) + +MRESA_TAC continuous_coplanar_fan[`x:real^3 `;`v:real^3`;`w:real^3`;`u123:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `t/ &2:real`) +THEN MRESA_TAC aff_gt_1_2_subset_aff_1_3111[`x:real^3`;`(&1 - t') % y + t' % v1:real^3`;`v1:real^3`;`v:real^3`;`(&1 - t / &2) % w + t / &2 % u123:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC AFF_GT_1_3_SUBSET_AFF_GT_1_3[`x:real^3 `;`v:real^3`;`w:real^3`;`u123:real^3`;`t/ &2 :real`] +THEN MP_TAC(SET_RULE`aff_gt {x} {v, w, (&1 - t / &2) % w + t / &2 % u123} SUBSET + {x' | ?u. (?a. (&0 < a /\ a < &1) /\ + u = aff_gt {x} {v, (&1 - a) % w + a % u123}) /\ + x' IN u} +/\ +{x' | ?u. (?a. (&0 < a /\ a < &1) /\ + u = aff_gt {x} {v, (&1 - a) % w + a % u123}) /\ + x' IN u} SUBSET + dart_leads_into x V E w u123 +==> +aff_gt {x} {v, w, (&1 - t / &2) % w + t / &2 % u123} SUBSET +dart_leads_into x V E w u123 `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`aff_gt {x} {v1, (&1 - t') % y + t' % v1} SUBSET + aff_gt {x} {v, w, (&1 - t / &2) % w + t / &2 % u123} +/\ +aff_gt {x} {v, w, (&1 - t / &2) % w + t / &2 % u123} SUBSET +dart_leads_into x V E w u123 + +==> aff_gt {x} {v1, (&1 - t') % y + t' % v1} SUBSET +dart_leads_into x V E w u123`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`&0 IN TA /\ ~(t1 IN TA)==> ~(t1= &0)`) +THEN MP_TAC(REAL_ARITH`t'< &1/\ &0<= t1 /\ ~(t1= &0)==> &0< &1- t' /\ ~(&1- t' = &0) /\ &0< t1`) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LT_MUL[`t1:real`;`&1- t':real`][REAL_ARITH`t1*(&1- t')= t1- t' * t1`] +THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th `t1 - t' * t1:real`) +THEN SUBGOAL_THEN`(&1 - (t1 - e1)) % y + (t1 - e1) % z IN aff_gt {x} {v1, (&1 - t') % y + t' % v1:real^3}` +ASSUME_TAC +THENL(*31*)[ + +MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)):real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`(&1 - t') % y + t' % v1 IN aff_gt {x} {a:real^3} +/\ aff_gt {x} {a} SUBSET dart_leads_into x V E w u123 +/\ dart_leads_into x V E w u123 SUBSET yfan (x,V,E) +==> (&1 - t') % y + t' % v1 IN yfan(x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan;IN_ELIM_THM;DIFF] +THEN STRIP_TAC +THEN MRESA_TAC x_in_xfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MP_TAC(SET_RULE`~((&1 - t') % y + t' % v1 IN xfan (x,V:real^3->bool,E)) /\ x IN xfan (x,V,E) +==> ~(x= (&1 - t') % y + t' % v1:real^3)`) +THEN RESA_TAC +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v1:real^3`;`(&1 - t') % y + t' % v1:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`; +VECTOR_ARITH`t1' % x + t2 % v1 + t3 % ((&1 - t') % y + t' % v1) += t1' % x + (t3 *(&1 - t')) % y + (t2+ t3*t') % v1`] +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + + (t3 * (&1 - t')) % y + + (t2 + t3 * t') % ((&1 - t1) % y + t1 % z) += t1' % x + + (t3 * (&1 - t') + (t2 + t3 * t') * (&1 - t1)) % y + + ((t2 + t3 * t') * t1) % z`] +THEN MRESA1_TAC REAL_MUL_LINV`&1- t':real` +THEN MRESA1_TAC REAL_MUL_LINV`t1:real` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC `inv t1 * (t1- e1)- ((&1 - (t1 - e1)) - inv t1 * (t1- e1) *(&1- t1)) * inv(&1- t')* t' :real` +THEN EXISTS_TAC`((&1 - (t1 - e1)) - inv t1 * (t1- e1) *(&1- t1)) * inv(&1- t'):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t1 * (t1 - e1) - a1 * t' + a1 * t'= (t1- e1)* inv t1`; REAL_ARITH`(A*B)*C=A*(B*C)`;REAL_ARITH`&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)+ + (t1 - e1) * inv t1 * (&1 - t1)= &1 - (t1 - e1)`; REAL_ARITH`A * &1=A` +;VECTOR_ARITH` &0 % x + A +B= A+B`; +REAL_ARITH`&0 + + inv t1 * (t1 - e1) - + (&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)) * inv (&1 - t') * t' + + (&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)) * inv (&1 - t') += inv t1 * (t1 - e1) + + (&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)) * inv (&1 - t') *(&1- t')`; +REAL_ARITH`inv t1 * (t1 - e1) + &1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1) += (t1 - e1)*(inv t1 * t1 ) + &1 - (t1 - e1)` +; REAL_ARITH`A+ &1-A= &1`] +THEN ASM_REWRITE_TAC[REAL_ARITH`&1-(t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)= +&1- (&1+ inv t1 - inv t1* t1) *(t1 - e1) `; REAL_ARITH`A +B-A=B` +;REAL_ARITH`inv t1 * (t1 - e1) = inv t1 * t1 - inv t1 * e1` +;REAL_ARITH`A-(A-B)=B`; +REAL_ARITH`&1 - inv t1 * e1 - (inv t1 * e1) * inv (&1 - t') * t' += &1 - inv t1 * e1 - (inv t1 * e1) * inv (&1 - t') + (inv t1 * e1) * inv (&1 - t') * (&1-t')`; +REAL_ARITH`&1 - inv t1 * e1 - (inv t1 * e1) * inv (&1 - t') + (inv t1 * e1) * &1= +&1- (inv t1 * e1) * inv (&1 - t')` ] +THEN STRIP_TAC +THENL(*32*)[ + +REWRITE_TAC[ REAL_ARITH`&0< &1 - (inv t1 * e1) * inv (&1 - t') +<=> ((inv t1) * inv (&1 -t')) * e1 < &1`;GSYM REAL_INV_MUL; REAL_ARITH`A*( &1- B)=A- B*A`] +THEN MP_TAC(REAL_ARITH` &0< t1 - t' * t1==> ~(t1 - t' * t1= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`t1- t' * t1:real` +THEN MRESA1_TAC REAL_MUL_LINV`t1- t' * t1:real` +THEN MRESA_TAC REAL_LT_LMUL[`inv (t1- t' * t1):real`;`e1:real`;`t1- t' * t1:real`];(*32*) + + +REWRITE_TAC[ REAL_ARITH`&0< (inv t1 * e1) * inv (&1 - t') +<=> &0< ((inv t1) * inv (&1 -t')) * e1 `;GSYM REAL_INV_MUL; REAL_ARITH`A*( &1- B)=A- B*A`] +THEN MRESA1_TAC REAL_LT_INV`t1- t' * t1:real` +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]](*32*);(*31*) + + +MP_TAC(SET_RULE`(&1 - (t1 - e1)) % y + (t1 - e1) % z IN + aff_gt {x} {v1, (&1 - t') % y + t' % v1} +/\ aff_gt {x} {v1, (&1 - t') % y + t' % v1:real^3} SUBSET + dart_leads_into x V E w u123 +==> (&1 - (t1 - e1)) % y + (t1 - e1) % z IN + dart_leads_into x V E w u123`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`D SUBSET d1_fan (x:real^3,V,E) /\ f3 IN D==> f3 IN d1_fan (x,V,E)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E)) f3 IN + face_set (hypermap1_of_fanx (x:real^3,V,E))` +ASSUME_TAC +THENL(*32*)[ + +ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN EXISTS_TAC`f3:real^3#real^3#real^3#real^3` +THEN REWRITE_TAC[face] +THEN ASM_REWRITE_TAC[];(*32*) + +ABBREV_TAC`y123=(&1 - (t1 - e1)) % y + (t1 - e1) % z:real^3` +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`y123:real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w):real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y'':real^3`;`y123:real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool`] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`conforming_fan (x:real^3,V,E)` +THEN REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `dartset_leads_into_fan x V E ((face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool)`) +THEN POP_ASSUM(fun th-> MRESA1_TAC th ` ((face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool)` THEN MRESA1_TAC th ` ((face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)):real^3#real^3#real^3#real^3->bool)`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC lemma_component_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`f1:real^3#real^3#real^3#real^3`;`f3:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC lemma_face_subset_component[`hypermap1_of_fanx (x:real^3,V,E)`;`f3:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN` (x,v,w,sigma_fan x V E v w)IN face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)` ASSUME_TAC +THENL(*33*)[ +REWRITE_TAC[face;IN_ELIM_THM; orbit_map] +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`0>= 0`;POWER;I_DEF];(*33*) + +STRIP_TAC +THEN MP_TAC(SET_RULE`x,v,w,sigma_fan x V E v w IN + face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w:real^3) +/\ face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w) SUBSET D +==> x,v,w,sigma_fan x V E v w IN D`) +THEN RESA_TAC +THEN ABBREV_TAC`u12=inverse1_sigma_fan x V E v w:real^3` +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`) +THEN REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u12:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u12:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`; `w:real^3`;`u12:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN SUBGOAL_THEN`(!h. &0 < h /\ h < &1 / &2 ==> ~collinear {x, w, (&1 - h) % v + h % u12:real^3})` +ASSUME_TAC +THENL(*34*)[ + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`;`u12:real^3`;`h:real`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*34*) + +MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`z:real^3`;`y:real^3`;`v1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`z:real^3`;`y:real^3 `;`v1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REWRITE_TAC[SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y) /\ ~(x=z)`;] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x v1 w y < pi ==> azim x v1 w y <= pi`) +THEN RESA_TAC +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`v1:real^3`;`z:real^3`;`w:real^3`;`y:real^3`] +THEN MP_TAC(REAL_ARITH`pi = azim x v1 z w + azim x v1 w y /\ +&0< azim x v1 w y /\ azim x v1 w y< pi ==> &0< azim x v1 z w /\ azim x v1 z w < pi`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`; `w:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN MRESAL_TAC condition_4point_aff_gt_1_2inter_aff_gt_1_2[`x:real^3`;`v1:real^3`;`z:real^3`;`w:real^3`;` v:real^3`;`u12:real^3`;`&1/ &2:real`][REAL_ARITH`&1/ &2 < &1 /\ &0 < &1/ &2`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`t''/ &2:real`[SET_RULE`~(A={}) <=> ?a. a IN A`;INTER;IN_ELIM_THM]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0 < t''/\ t'' < &1 ==> &0 < t'' / &2 /\ t'' / &2 < t''/\ t'' / &2< &1`) +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`;`u12:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESAL_TAC aff_gt_1_3_eq_unions_aff_gt_1_2[`x:real^3`;`w:real^3`;`v:real^3`;`u12:real^3`][UNIONS;IN_ELIM_THM] +THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` w:real^3`;` v:real^3`;` u12:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{x' | ?u. (?a. (&0 < a /\ a < &1) /\ + u = aff_gt {x} {(&1 - a) % v + a % u12,w}) /\ + x' IN u} SUBSET + dart_leads_into x V E v u12 +/\ a'' IN aff_gt {x} {(&1 - t'' / &2) % v + t'' / &2 % u12:real^3,w} +/\ &0< t''/ &2 /\ t''/ &2< &1 +==> a'' IN dart_leads_into x V E v u12`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`x,v,u12,w IN + face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v:real^3)`ASSUME_TAC +THENL(*35*)[ +REWRITE_TAC[face;IN_ELIM_THM;orbit_map] +THEN EXISTS_TAC`SUC 0:num` +THEN ASM_REWRITE_TAC[POWER; ARITH_RULE`SUC 0 >= 0`;I_DEF;o_DEF] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC 0:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(x,w,v,sigma_fan x V E w v):real^3#real^3#real^3#real^3`[POWER;I_DEF;o_DEF;]) +THEN REWRITE_TAC[f1_fan] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`];(*35*) + +MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`(face (hypermap1_of_fanx (x,V:real^3->bool,E)) (x,w,v,sigma_fan x V E w v)) :real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th `(x:real^3,v:real^3,u12:real^3,w:real^3)`[pr2;pr3]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESAL_TAC scale_in_edges_fan[`(x:real^3)`;`(v1:real^3)`;`(z:real^3)`;`(a'':real^3)`][SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`;VECTOR_ARITH`a' % (a - x) = (&1 - t') % y + t' % v1 - x <=> (&1- a')% x + a' % a= (&1 - t') % y + t' % v1`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v1:real^3`;`z:real^3`;`a'':real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;` (a'':real^3)`;`(v1:real^3)`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN SUBGOAL_THEN`(&1 - t''') % v1 + t''' % z IN aff_gt {x} {a'':real^3}`ASSUME_TAC +THENL(*36*)[ + +MRESAL_TAC AFF_GT_1_1[`x:real^3`;`a'':real^3`][SET_RULE`DISJOINT{x} {y} <=> ~(x= y)`;IN_ELIM_THM] +THEN EXISTS_TAC`&1-a''':real` +THEN EXISTS_TAC` a''':real` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*36*) + +MRESA_TAC AFF_GT_1_1_SUBSET_DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v)):real^3#real^3#real^3#real^3->bool`;`a'':real^3`] +THEN MP_TAC(SET_RULE`(&1 - t''') % v1 + t''' % z IN aff_gt {x} {a''} +/\ aff_gt {x} {a''} SUBSET + dartset_leads_into_fan x V E + (face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v:real^3)) +==> (&1 - t''') % v1 + t''' % z IN + dartset_leads_into_fan x V E + (face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v))`) +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - t''') % ((&1 - t1) % y + t1 % z) + t''' % z +=(&1 - (t1+ (&1 - t1)*t''')) % y + (t1+ (&1 - t1)*t''') % z`] +THEN SUBGOAL_THEN`(x,w,v,sigma_fan x V E w v:real^3) IN D`ASSUME_TAC +THENL(*37*)[ + +MRESA_TAC lemma_component_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`f1:real^3#real^3#real^3#real^3`;`(x,v,w,sigma_fan x V E v w:real^3):real^3#real^3#real^3#real^3`] +THEN MRESA_TAC lemma_powers_in_component[`hypermap1_of_fanx (x:real^3,V,E)`;`(x,v,w,sigma_fan x V E v w :real^3)`;`SUC 0:num`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC 0:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(x,v,w,sigma_fan x V E v w:real^3):real^3#real^3#real^3#real^3`) +THEN REWRITE_TAC[e_fan;POWER;I_DEF;o_DEF];(*37*) + + +STRIP_TAC +THEN SUBGOAL_THEN `t1 + (&1 - t1) * t''' IN TA:real->bool`ASSUME_TAC +THENL(*38*)[ +EXPAND_TAC"TA" +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THENL(*39*)[ + +MATCH_MP_TAC(REAL_ARITH`&0<= A /\ &0<=B ==> &0<=A+B`) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &1- A<=> A<= &1`] +THEN MATCH_MP_TAC(REAL_ARITH`&0 &0<=A `) +THEN ASM_REWRITE_TAC[];(*39*) +STRIP_TAC +THENL(*40*)[ + +REWRITE_TAC[REAL_ARITH`t1 + (&1 - t1) * t''' <= &1<=> &0 <= (&1 - t1)* (&1- t''')`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &1- A<=> A<= &1`] +THEN MATCH_MP_TAC(REAL_ARITH`A< &1 ==> A<= &1 `) +THEN ASM_REWRITE_TAC[];(*40*) + +EXISTS_TAC`(x,w,v,sigma_fan x V E w v:real^3)` +THEN ASM_REWRITE_TAC[]](*40*)](*39*);(*38*) + +FIND_ASSUM (fun th-> MP_TAC(ISPEC `t1 + (&1 - t1) * t''':real` th))`!x. x IN TA ==> x <= t1` +THEN MP_TAC(SET_RULE`t1 + (&1 - t1) * t''' IN TA /\ ~(t1 IN TA)==> ~(t1=t1 + (&1 - t1) * t''')`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`t1 + (&1 - t1) * t''' <= t1 /\ ~(t1= t1 + (&1 - t1) * t''') /\ t1<= &1 /\ &0< t''' +==> (&1 - t1) * t'''< &0:real /\ &0<= (&1 -t1)/\ &0<= t'''`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`(&1- t1):real`;`t''':real`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]);; + + + + + +let WGVWSKE=prove(`!x V E. + FAN (x,V,E) /\ + conforming_fan (x,V,E) +==> connected_hypermap(hypermap1_of_fanx (x,V,E))`, +REWRITE_TAC[connected_hypermap;number_of_components] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN REWRITE_TAC[conforming_fan] THEN STRIP_TAC THEN ASSUME_TAC th) +THEN FIND_ASSUM MP_TAC`FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan1;SET_RULE`~(V SUBSET {}) <=> ?v. v IN V`] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN FIND_ASSUM(fun th-> MP_TAC(ISPEC `v:real^3` th))`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`(v:real^3) IN V` +THEN STRIP_TAC +THEN MRESA_TAC exists_inf_element_fix_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u1:real^3`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN ABBREV_TAC`f1=(x,v,u,sigma_fan x V E v u:real^3)` +THEN SUBGOAL_THEN`f1 IN d1_fan(x:real^3,V,E)`ASSUME_TAC +THENL[ +REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`sigma_fan x V E v u:real^3` +THEN ASM_REWRITE_TAC[]; + +MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN ABBREV_TAC`D= comb_component (hypermap1_of_fanx (x,V,E)) (f1:real^3#real^3#real^3#real^3)` +THEN SUBGOAL_THEN`D IN set_of_components(hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[set_of_components;set_part_components;IN_ELIM_THM] +THEN EXISTS_TAC`f1:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`set_of_components (hypermap1_of_fanx (x:real^3,V,E))={D}` +ASSUME_TAC +THENL[ +REWRITE_TAC[EXTENSION;IN_ELIM_THM;] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +ASM_REWRITE_TAC[IN_SING;set_of_components;set_part_components;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESAL_TAC lemma_connect_hypermap[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`f1:real^3#real^3#real^3#real^3`;`x'':real^3#real^3#real^3#real^3`][set_of_components;set_part_components;IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC lemma_component_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x''':real^3#real^3#real^3#real^3`;`f1:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC lemma_component_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x''':real^3#real^3#real^3#real^3`;`x'':real^3#real^3#real^3#real^3`]; + +REWRITE_TAC[IN_SING] +THEN RESA_TAC]; + +ASM_REWRITE_TAC[CARD_SINGLETON]]]]);; + + +let CARD_EDGE_SET_FAN=prove(`!x V E e. + FAN (x,V,E) +/\ e IN edge_set (hypermap1_of_fanx (x,V,E)) +/\ conforming_fan (x,V,E) + ==> CARD e= 2`, +REWRITE_TAC[edge_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN REWRITE_TAC[conforming_fan] THEN STRIP_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN REMOVE_THEN"LINH" MP_TAC +THEN RESA_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC(SUC 0):num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(x':real^3#real^3#real^3#real^3)`) +THEN MRESA_TAC plain_hypermap_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(x':real^3#real^3#real^3#real^3)`) +THEN MRESAL_TAC orbit_cyclic[`(res (e_fan x V E) (d1_fan (x:real^3,V,E)))`;`SUC (SUC 0):num`;`x':real^3#real^3#real^3#real^3`][POWER;I_DEF;o_DEF;ARITH_RULE`~(SUC (SUC 0) = 0)`] +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`(SUC 0):num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(x':real^3#real^3#real^3#real^3)`) +THEN ASM_REWRITE_TAC[ARITH_RULE`k:num < SUC(SUC 0) <=> k = 0 \/ k= SUC 0`; +SET_RULE`{(res (e_fan x V E) (d1_fan (x,V,E)) POWER k) x' | k = 0 \/ k= SUC 0} += {(res (e_fan x V E) (d1_fan (x,V,E)) POWER 0) x' , (res (e_fan x V E) (d1_fan (x,V,E)) POWER SUC(0)) x' }`;POWER;I_DEF;o_DEF] +THEN MRESA_TAC e_fan_no_fix_point[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(x':real^3#real^3#real^3#real^3)`) +THEN POP_ASSUM MP_TAC +THEN MESON_TAC[CARD_2_FAN]);; + + + +let REP_CARD_EDGE_SET_FAN=prove(`!x V E. + FAN (x,V,E) +/\ conforming_fan (x,V,E) + ==> &(CARD (edge_set (hypermap1_of_fanx (x,V,E)))) * &2= &(CARD (dart (hypermap1_of_fanx (x,V,E))))`, +REPEAT STRIP_TAC +THEN MRESA1_TAC DART_EQ_UNIONS_FACE_SET_NODE_SET_EDGE_SET`(hypermap1_of_fanx (x:real^3,V:real^3->bool,E))` +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN RESA_TAC +THEN SUBGOAL_THEN`(!t. t IN edge_set (hypermap1_of_fanx (x:real^3,V,E)) ==> FINITE t)`ASSUME_TAC +THENL[ +REWRITE_TAC[edge_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC EDGE_FINITE[`(hypermap1_of_fanx (x:real^3,V,E))`;`x':real^3#real^3#real^3#real^3`][edge]; +SUBGOAL_THEN`(!t u. + t IN edge_set (hypermap1_of_fanx (x,V,E)) /\ + u IN edge_set (hypermap1_of_fanx (x:real^3,V,E)) /\ + ~(t = u) + ==> t INTER u = {})`ASSUME_TAC +THENL[ +REWRITE_TAC[edge_set;IN_ELIM_THM;set_of_orbits] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`(?a:real^3#real^3#real^3#real^3. a IN t INTER u) \/ (t INTER u = {}) `) +THENL[ +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESAL_TAC lemma_edge_identity[`(hypermap1_of_fanx (x:real^3,V,E))`;`x':real^3#real^3#real^3#real^3`;`a:real^3#real^3#real^3#real^3`][edge] +THEN MRESAL_TAC lemma_edge_identity[`(hypermap1_of_fanx (x:real^3,V,E))`;`x'':real^3#real^3#real^3#real^3`;`a:real^3#real^3#real^3#real^3`][edge] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[]]; + + MRESA_TAC CARD_EDGE_SET_FAN[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESAL_TAC HAS_SIZE_UNIONS[`(edge_set (hypermap1_of_fanx (x:real^3,V,E)))`;`(\x:real^3#real^3#real^3#real^3->bool. x)`;`CARD (edge_set (hypermap1_of_fanx (x:real^3,V,E)))`;`2:num`][HAS_SIZE;FINITE_HYPERMAP_ORBITS;SET_RULE`DISJOINT x y <=> x INTER y={}` +;SET_RULE`(!x'. x' IN edge_set (hypermap1_of_fanx (x,V,E)) + ==> FINITE x' /\ CARD x' = 2) +<=> (!x'. x' IN edge_set (hypermap1_of_fanx (x,V,E)) + ==> FINITE x' ) /\ (!x'. x' IN edge_set (hypermap1_of_fanx (x,V,E)) + ==> CARD x' = 2)`; SET_RULE`UNIONS {x' | x' IN edge_set (hypermap1_of_fanx (x,V,E))} +=UNIONS (edge_set (hypermap1_of_fanx (x,V,E)))`;REAL_OF_NUM_MUL]]]);; + + +let GGRLKHP=prove(`!x V E. + FAN (x,V,E) /\ conforming_fan (x,V,E) + ==> planar_hypermap (hypermap1_of_fanx (x,V,E))`, +REPEAT STRIP_TAC +THEN MRESA_TAC SUM_CARD_FACE_NODE_DART_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC REP_CARD_EDGE_SET_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`] +THEN REWRITE_TAC[REAL_ARITH`A+B-C=D<=> A+B+C=D + &2 *C`] +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SYM th]) +THEN MRESAL_TAC WGVWSKE[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`][connected_hypermap] +THEN ASM_REWRITE_TAC[planar_hypermap;number_of_nodes;number_of_edges;number_of_faces;REAL_ARITH`&2 * &(CARD (face_set (hypermap1_of_fanx (x,V,E)))) + + &2 * &(CARD (node_set (hypermap1_of_fanx (x,V,E)))) + + &(CARD (edge_set (hypermap1_of_fanx (x,V,E)))) * &2 = + &4 + &2 * &(CARD (dart (hypermap1_of_fanx (x,V,E)))) +<=> + &(CARD (node_set (hypermap1_of_fanx (x,V,E)))) + + &(CARD (edge_set (hypermap1_of_fanx (x,V,E)))) ++ &(CARD (face_set (hypermap1_of_fanx (x,V,E)))) += + &(CARD (dart (hypermap1_of_fanx (x,V,E)))) + &2 +`;REAL_OF_NUM_ADD;ARITH_RULE`2*1=2`;REAL_OF_NUM_EQ]);; + + + +end;; + + diff --git a/text_formalization/fan/GMLWKPK.hl b/text_formalization/fan/GMLWKPK.hl new file mode 100644 index 0000000..cb3e48d --- /dev/null +++ b/text_formalization/fan/GMLWKPK.hl @@ -0,0 +1,297 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Tame Hypermap *) +(* Author: Alexey Solovyev *) +(* Date: 2010-07-07 *) +(* (V,ESTD V) is a fan (4-point case) *) +(* ========================================================================== *) + +module Gmlwkpk = struct + + open Fan;; + +let AFF_GE_1_2_0 = prove + (`!v w. + ~(v = vec 0) /\ ~(w = vec 0) + ==> aff_ge {vec 0} {v,w} = {a % v + b % w | &0 <= a /\ &0 <= b}`, + SIMP_TAC[Fan.AFF_GE_1_2; + SET_RULE `DISJOINT {a} {b,c} <=> ~(b = a) /\ ~(c = a)`] THEN + REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + ONCE_REWRITE_TAC[MESON[] + `(?a b c. P b c /\ Q b c /\ R a b c /\ S b c) <=> + (?b c. P b c /\ Q b c /\ S b c /\ ?a. R a b c)`] THEN + REWRITE_TAC[REAL_ARITH `t + s:real = &1 <=> t = &1 - s`; EXISTS_REFL] THEN + SET_TAC[]);; + +let AFF_GE_1_1_0 = prove + (`!v. ~(v = vec 0) ==> aff_ge {vec 0} {v} = {a % v | &0 <= a}`, + REPEAT STRIP_TAC THEN + GEN_REWRITE_TAC (LAND_CONV o RAND_CONV) [SET_RULE `{a} = {a,a}`] THEN + ASM_SIMP_TAC[AFF_GE_1_2_0; GSYM VECTOR_ADD_RDISTRIB] THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN + MESON_TAC[REAL_LE_ADD; REAL_ARITH + `&0 <= a ==> &0 <= a / &2 /\ a / &2 + a / &2 = a`]);; + +let GMLWKPK = prove + (`!x:real^N V E. + graph E + ==> (fan7(x,V,E) <=> + !e1 e2. e1 IN E UNION {{v} | v IN V} /\ + e2 IN E UNION {{v} | v IN V} + ==> (e1 INTER e2 = {} + ==> aff_ge {x} e1 INTER aff_ge {x} e2 = {x}) /\ + (!v. e1 INTER e2 = {v} + ==> aff_ge {x} e1 INTER aff_ge {x} e2 = + aff_ge {x} {v}))`, + REPEAT STRIP_TAC THEN REWRITE_TAC[Fan.fan7] THEN EQ_TAC THENL + [SIMP_TAC[AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING]; ALL_TAC] THEN + MATCH_MP_TAC MONO_FORALL THEN X_GEN_TAC `e1:real^N->bool` THEN + MATCH_MP_TAC MONO_FORALL THEN X_GEN_TAC `e2:real^N->bool` THEN + MATCH_MP_TAC(TAUT `(p ==> q ==> r) ==> (q ==> p) ==> q ==> r`) THEN + STRIP_TAC THEN DISCH_TAC THEN + SUBGOAL_THEN `e1 = e2 \/ e1 INTER e2 = {} \/ (?v:real^N. e1 INTER e2 = {v})` + MP_TAC THENL + [ALL_TAC; + STRIP_TAC THEN ASM_REWRITE_TAC[INTER_IDEMPOT] THEN + ASM_MESON_TAC[AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING]] THEN + SUBGOAL_THEN `?a b:real^N c d:real^N. e1 = {a,b} /\ e2 = {c,d}` MP_TAC THENL + [ALL_TAC; + DISCH_THEN(REPEAT_TCL CHOOSE_THEN (CONJUNCTS_THEN SUBST_ALL_TAC)) THEN + SET_TAC[]] THEN + FIRST_ASSUM(CONJUNCTS_THEN MP_TAC) THEN + REWRITE_TAC[IN_UNION; IN_ELIM_THM] THEN + SUBGOAL_THEN `!e:real^N->bool. e IN E ==> ?v w. ~(v = w) /\ e = {v,w}` + (LABEL_TAC "*") THENL + [FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [graph]) THEN + MATCH_MP_TAC MONO_FORALL THEN GEN_TAC THEN + MATCH_MP_TAC MONO_IMP THEN REWRITE_TAC[IN] THEN + CONV_TAC(LAND_CONV HAS_SIZE_CONV) THEN REWRITE_TAC[]; + ASM_MESON_TAC[SET_RULE `{v,v} = {v}`]]);; + +let GMLWKPK_ALT = prove + (`!x:real^N V E. + graph E /\ (!e. e IN E ==> ~(x IN e)) + ==> (fan7(x,V,E) <=> + (!e1 e2. e1 IN E UNION {{v} | v IN V} /\ + e2 IN E UNION {{v} | v IN V} /\ + e1 INTER e2 = {} + ==> aff_ge {x} e1 INTER aff_ge {x} e2 = {x}) /\ + (!e1 e2 v. e1 IN E /\ e2 IN E /\ e1 INTER e2 = {v} + ==> aff_ge {x} e1 INTER aff_ge {x} e2 = + aff_ge {x} {v}))`, + REPEAT STRIP_TAC THEN ASM_SIMP_TAC[GMLWKPK] THEN + EQ_TAC THEN SIMP_TAC[IN_UNION] THEN STRIP_TAC THEN + MATCH_MP_TAC(MESON[] + `(!x y. R x y ==> R y x) /\ + (!x y. P x /\ P y ==> R x y) /\ + (!x y. Q x /\ Q y ==> R x y) /\ + (!x y. P x /\ Q y ==> R x y) + ==> !x y. (P x \/ Q x) /\ (P y \/ Q y) ==> R x y`) THEN + CONJ_TAC THENL [REWRITE_TAC[INTER_ACI]; ASM_SIMP_TAC[]] THEN CONJ_TAC THEN + REWRITE_TAC[IMP_CONJ; RIGHT_FORALL_IMP_THM; FORALL_IN_GSPEC] THENL + [SIMP_TAC[SET_RULE `{a} INTER {b} = {c} <=> a = c /\ b = c`] THEN SET_TAC[]; + X_GEN_TAC `e1:real^N->bool` THEN DISCH_TAC THEN X_GEN_TAC `v:real^N`] THEN + SUBGOAL_THEN `(e1:real^N->bool) HAS_SIZE 2` MP_TAC THENL + [ASM_MESON_TAC[graph; IN]; CONV_TAC(LAND_CONV HAS_SIZE_CONV)] THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`u:real^N`; `w:real^N`] THEN + STRIP_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + SIMP_TAC[SET_RULE `{a,b} INTER {c} = {d} <=> d = c /\ (a = c \/ b = c)`] THEN + REWRITE_TAC[SET_RULE `s INTER t = t <=> t SUBSET s`] THEN + GEN_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC AFF_GE_MONO_RIGHT THEN ASM SET_TAC[]);; + +let GMLWKPK_SIMPLE = prove + (`!E V x:real^N. + UNIONS E SUBSET V /\ graph E /\ fan6(x,V,E) /\ + (!e. e IN E ==> ~(x IN e)) + ==> (fan7 (x,V,E) <=> + !e1 e2. + e1 IN E UNION {{v} | v IN V} /\ e2 IN E UNION {{v} | v IN V} /\ + e1 INTER e2 = {} + ==> aff_ge {x} e1 INTER aff_ge {x} e2 = {x})`, + let lemma = prove + (`!x u v w:real^N. + ~collinear{x,u,v} /\ ~collinear{x,v,w} + ==> (~(aff_ge {x} {u,v} INTER aff_ge {x} {v,w} = + aff_ge {x} {v}) <=> + u IN aff_ge {x} {v,w} \/ w IN aff_ge {x} {u,v})`, + REPEAT GEN_TAC THEN GEOM_ORIGIN_TAC `x:real^N` THEN + REPEAT GEN_TAC THEN + MAP_EVERY (fun t -> + ASM_CASES_TAC t THENL + [ASM_REWRITE_TAC[COLLINEAR_2; INSERT_AC]; ALL_TAC]) + [`u:real^N = v`; `w:real^N = v`; + `u:real^N = vec 0`; `v:real^N = vec 0`; `w:real^N = vec 0`] THEN + STRIP_TAC THEN EQ_TAC THENL + [DISCH_THEN(MP_TAC o MATCH_MP (SET_RULE + `~(s INTER s' = t) + ==> t SUBSET s /\ t SUBSET s' ==> t PSUBSET s INTER s'`)) THEN + ANTS_TAC THENL + [CONJ_TAC THEN MATCH_MP_TAC AFF_GE_MONO_RIGHT THEN ASM SET_TAC[]; + REWRITE_TAC[PSUBSET_ALT]] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + ASM_SIMP_TAC[AFF_GE_1_2_0; AFF_GE_1_1_0; LEFT_IMP_EXISTS_THM] THEN + REWRITE_TAC[IN_INTER; IMP_CONJ; FORALL_IN_GSPEC] THEN + MAP_EVERY X_GEN_TAC [`a:real`; `b:real`] THEN + DISCH_TAC THEN DISCH_TAC THEN + REWRITE_TAC[IN_ELIM_THM; LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`c:real`; `d:real`] THEN STRIP_TAC THEN + ASM_CASES_TAC `a = &0` THENL + [ASM_MESON_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID]; ALL_TAC] THEN + ASM_CASES_TAC `d = &0` THENL + [ASM_MESON_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID]; ALL_TAC] THEN + DISCH_THEN(K ALL_TAC) THEN DISJ_CASES_TAC + (REAL_ARITH `b <= c \/ c <= b`) + THENL + [FIRST_X_ASSUM(MP_TAC o MATCH_MP (VECTOR_ARITH + `a % u + b % v:real^N = c % v + d % w + ==> a % u = (c - b) % v + d % w`)) THEN + DISCH_THEN(MP_TAC o AP_TERM `(%) (inv a):real^N->real^N`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; VECTOR_MUL_LID] THEN + DISCH_THEN(K ALL_TAC) THEN DISJ1_TAC THEN + REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC] THEN + MAP_EVERY EXISTS_TAC [`inv a * (c - b):real`; `inv a * d:real`] THEN + ASM_SIMP_TAC[REAL_LE_MUL; REAL_LE_INV_EQ; REAL_SUB_LE]; + FIRST_X_ASSUM(MP_TAC o MATCH_MP (VECTOR_ARITH + `a % u + b % v:real^N = c % v + d % w + ==> d % w = (b - c) % v + a % u`)) THEN + DISCH_THEN(MP_TAC o AP_TERM `(%) (inv d):real^N->real^N`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; VECTOR_MUL_LID] THEN + DISCH_THEN(K ALL_TAC) THEN DISJ2_TAC THEN + REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC] THEN + MAP_EVERY EXISTS_TAC [`inv d * a:real`; `inv d * (b - c):real`] THEN + ASM_SIMP_TAC[REAL_LE_MUL; REAL_LE_INV_EQ; REAL_SUB_LE] THEN + REWRITE_TAC[VECTOR_ADD_SYM]]; + STRIP_TAC THEN MATCH_MP_TAC(SET_RULE + `(?x. x IN s /\ x IN t /\ ~(x IN u)) ==> ~(s INTER t = u)`) + THENL + [EXISTS_TAC `u:real^N` THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[AFF_GE_1_2_0; AFF_GE_1_1_0; IN_ELIM_THM] THEN + CONJ_TAC THENL + [MAP_EVERY EXISTS_TAC [`&1`; `&0`] THEN + REWRITE_TAC[REAL_POS] THEN VECTOR_ARITH_TAC; + DISCH_THEN(X_CHOOSE_THEN `a:real` + (CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC)) THEN + UNDISCH_TAC `~collinear{vec 0:real^N,a % v,v}` THEN + REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`] THEN + REWRITE_TAC[COLLINEAR_LEMMA] THEN MESON_TAC[]]; + EXISTS_TAC `w:real^N` THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[AFF_GE_1_2_0; AFF_GE_1_1_0; IN_ELIM_THM] THEN + CONJ_TAC THENL + [MAP_EVERY EXISTS_TAC [`&0`; `&1`] THEN + REWRITE_TAC[REAL_POS] THEN VECTOR_ARITH_TAC; + DISCH_THEN(X_CHOOSE_THEN `a:real` + (CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC)) THEN + UNDISCH_TAC `~collinear{vec 0:real^N,v,a % v}` THEN + REWRITE_TAC[COLLINEAR_LEMMA] THEN MESON_TAC[]]]]) in + REPEAT STRIP_TAC THEN ASM_SIMP_TAC[GMLWKPK] THEN + EQ_TAC THEN SIMP_TAC[] THEN DISCH_TAC THEN + REWRITE_TAC[IN_UNION] THEN MATCH_MP_TAC(MESON[] + `(!x y. R x y ==> R y x) /\ + (!x. Q x ==> !y. Q y ==> R x y) /\ + (!x. P x ==> (!y. Q y ==> R x y) /\ (!y. P y ==> R x y)) + ==> (!x y. (P x \/ Q x) /\ (P y \/ Q y) ==> R x y)`) THEN + CONJ_TAC THENL [SIMP_TAC[INTER_ACI]; ALL_TAC] THEN + REWRITE_TAC[FORALL_IN_GSPEC] THEN CONJ_TAC THENL + [SIMP_TAC[SET_RULE `{a} INTER {b} = {c} <=> c = a /\ b = a`] THEN + REWRITE_TAC[INTER_IDEMPOT]; + ALL_TAC] THEN + X_GEN_TAC `ee1:real^N->bool` THEN DISCH_TAC THEN CONJ_TAC THENL + [X_GEN_TAC `v:real^N` THEN DISCH_TAC THEN + REWRITE_TAC[SET_RULE `s INTER {a} = {b} <=> b = a /\ a IN s`] THEN + SIMP_TAC[IMP_CONJ; FORALL_UNWIND_THM2] THEN DISCH_TAC THEN + REWRITE_TAC[SET_RULE `s INTER t = t <=> t SUBSET s`] THEN + MATCH_MP_TAC AFF_GE_MONO_RIGHT THEN ASM SET_TAC[]; + ALL_TAC] THEN + X_GEN_TAC `ee2:real^N->bool` THEN DISCH_TAC THEN + SUBGOAL_THEN `(ee1:real^N->bool) HAS_SIZE 2` MP_TAC THENL + [ASM_MESON_TAC[graph; IN]; CONV_TAC(LAND_CONV HAS_SIZE_CONV)] THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`v1:real^N`; `w1:real^N`] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC) THEN + SUBGOAL_THEN `(ee2:real^N->bool) HAS_SIZE 2` MP_TAC THENL + [ASM_MESON_TAC[graph; IN]; CONV_TAC(LAND_CONV HAS_SIZE_CONV)] THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`v2:real^N`; `w2:real^N`] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC) THEN + ONCE_REWRITE_TAC[SET_RULE + `{a,b} INTER {c,d} = {v} <=> + v = a /\ {a,b} INTER {c,d} = {v} \/ + v = b /\ {a,b} INTER {c,d} = {v}`] THEN + REWRITE_TAC[TAUT + `p /\ q \/ r /\ q ==> t <=> (p ==> q ==> t) /\ (r ==> q ==> t)`] THEN + REWRITE_TAC[FORALL_AND_THM; FORALL_UNWIND_THM2] THEN + MAP_EVERY UNDISCH_TAC [`{v1:real^N,w1} IN E`; `~(v1:real^N = w1)`] THEN + MAP_EVERY (fun s -> SPEC_TAC(s,s)) + [`w1:real^N`; `v1:real^N`] THEN + REWRITE_TAC[IMP_IMP] THEN MATCH_MP_TAC(MESON[] + `(!v w. P v w ==> P w v) /\ + (!v w. R v w ==> Q w v) /\ + (!v w. P v w ==> R v w) + ==> (!v w. P v w ==> Q v w /\ R v w)`) THEN + REPEAT(CONJ_TAC THENL [SIMP_TAC[INSERT_AC]; ALL_TAC]) THEN + MAP_EVERY X_GEN_TAC [`u:real^N`; `v:real^N`] THEN STRIP_TAC THEN + ONCE_REWRITE_TAC[SET_RULE + `{a,b} INTER {c,d} = {v} <=> + v = c /\ {a,b} INTER {c,d} = {v} \/ + v = d /\ {a,b} INTER {c,d} = {v}`] THEN + REWRITE_TAC[TAUT + `p /\ q \/ r /\ q ==> t <=> (p ==> q ==> t) /\ (r ==> q ==> t)`] THEN + MAP_EVERY UNDISCH_TAC [`{v2:real^N,w2} IN E`; `~(v2:real^N = w2)`] THEN + MAP_EVERY (fun s -> SPEC_TAC(s,s)) [`w2:real^N`; `v2:real^N`] THEN + REWRITE_TAC[IMP_IMP] THEN MATCH_MP_TAC(MESON[] + `(!v w. P v w ==> P w v) /\ + (!v w. Q v w ==> R w v) /\ + (!v w. P v w ==> Q v w) + ==> (!v w. P v w ==> Q v w /\ R v w)`) THEN + REPEAT(CONJ_TAC THENL [SIMP_TAC[INSERT_AC]; ALL_TAC]) THEN + MAP_EVERY X_GEN_TAC [`v':real^N`; `w:real^N`] THEN STRIP_TAC THEN + ONCE_REWRITE_TAC[IMP_CONJ] THEN DISCH_THEN(SUBST_ALL_TAC o SYM) THEN + ASM_CASES_TAC `u:real^N = w` THENL [ASM SET_TAC[]; ALL_TAC] THEN + DISCH_TAC THEN W(MP_TAC o PART_MATCH (rand o lhand o rand) lemma o goal_concl) THEN + ANTS_TAC THENL + [REWRITE_TAC[SET_RULE `{x,v,w} = {x} UNION {v,w}`] THEN + ASM_MESON_TAC[fan6; INSERT_AC]; + ALL_TAC] THEN + MATCH_MP_TAC(TAUT `~q ==> (~p <=> q) ==> p`) THEN + REWRITE_TAC[DE_MORGAN_THM] THEN CONJ_TAC THEN MATCH_MP_TAC(SET_RULE + `aff_ge {x} {v} INTER aff_ge {x} s = {x} /\ + v IN aff_ge {x} {v} /\ ~(v = x) + ==> ~(v IN aff_ge {x} s)`) THEN + REPEAT CONJ_TAC THENL + [FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[IN_UNION] THEN + CONJ_TAC THENL [DISJ2_TAC; ASM SET_TAC[]] THEN + REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC `u:real^N` THEN + REWRITE_TAC[] THEN RULE_ASSUM_TAC(REWRITE_RULE[SUBSET]) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[IN_UNIONS] THEN EXISTS_TAC `{u:real^N,v}` THEN + ASM SET_TAC[]; + SUBGOAL_THEN `DISJOINT {x:real^N} {u:real^N}` ASSUME_TAC THENL + [REWRITE_TAC[SET_RULE `DISJOINT {a} {b} <=> ~(a = b)`] THEN + ASM_MESON_TAC[IN_INSERT]; + ASM_SIMP_TAC[Fan.AFF_GE_1_1; IN_ELIM_THM] THEN + MAP_EVERY EXISTS_TAC [`&0`; `&1`] THEN + REPEAT(CONJ_TAC THENL [REAL_ARITH_TAC; ALL_TAC]) THEN VECTOR_ARITH_TAC]; + ASM_MESON_TAC[IN_INSERT]; + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[IN_UNION] THEN + CONJ_TAC THENL [DISJ2_TAC; ASM SET_TAC[]] THEN + REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC `w:real^N` THEN + REWRITE_TAC[] THEN RULE_ASSUM_TAC(REWRITE_RULE[SUBSET]) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[IN_UNIONS] THEN EXISTS_TAC `{v:real^N,w}` THEN + ASM SET_TAC[]; + SUBGOAL_THEN `DISJOINT {x:real^N} {w:real^N}` ASSUME_TAC THENL + [REWRITE_TAC[SET_RULE `DISJOINT {a} {b} <=> ~(a = b)`] THEN + ASM_MESON_TAC[IN_INSERT]; + ASM_SIMP_TAC[Fan.AFF_GE_1_1; IN_ELIM_THM] THEN + MAP_EVERY EXISTS_TAC [`&0`; `&1`] THEN + REPEAT(CONJ_TAC THENL [REAL_ARITH_TAC; ALL_TAC]) THEN VECTOR_ARITH_TAC]; + ASM_MESON_TAC[IN_INSERT]]);; + + +end;; diff --git a/text_formalization/fan/HypermapAndFan.hl b/text_formalization/fan/HypermapAndFan.hl new file mode 100644 index 0000000..b3b3064 --- /dev/null +++ b/text_formalization/fan/HypermapAndFan.hl @@ -0,0 +1,2767 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Fan *) +(* Author: Alexey Solovyev *) +(* Date: 2010-06-16 *) +(* ========================================================================== *) + + + +flyspeck_needs "fan/fan_defs.hl";; +flyspeck_needs "fan/introduction.hl";; +flyspeck_needs "fan/topology.hl";; +flyspeck_needs "fan/fan_misc.hl";; + + + +module Hypermap_and_fan (* : Hypermap_and_fan_type *) = struct + + +(* Several tactics and simple lemmas *) + +let REMOVE_ASSUM = POP_ASSUM(fun th -> ALL_TAC);; + +let let_RULE = fun th -> REWRITE_RULE[DEPTH_CONV let_CONV (concl th)] th;; + +let IMAGE_LEMMA = prove(`!f s. {f x | x IN s} = IMAGE f s`, SET_TAC[IMAGE]);; + +let CHOICE_LEMMA = MESON[] `!y (P:A->bool). ((?x. P x) /\ (!x. P x ==> (x = y))) ==> (@x. P x) = y`;; + +let INVERSE_LEMMA = prove(`!f y. (?!x. f x = y) ==> f((inverse f) y) = y`, MESON_TAC[inverse]);; + +let PERMUTES_IMP_INSIDE = prove(`!f s. f permutes s ==> (!x. x IN s ==> f x IN s)`, + REPEAT GEN_TAC THEN + DISCH_THEN (MP_TAC o (fun th -> MATCH_MP PERMUTES_IMAGE th)) THEN + SET_TAC[]);; + + +(* Open relevant modules *) + +open Fan_defs;; +open Fan_misc;; + + +(* Properties of restricted functions *) + +let RES_RES = prove(`!f s. res (res f s) s = res f s`, + SIMP_TAC[FUN_EQ_THM; Sphere.res]);; + + +let RES_RES2 = prove(`!f s t. res (res f s) t = res f (s INTER t)`, + REWRITE_TAC[FUN_EQ_THM; Sphere.res; IN_INTER] THEN MESON_TAC[]);; + + +let RES_DECOMPOSITION = prove(`!(f:A->A) s. (!x. x IN s ==> f x IN s) ==> f = (res f (UNIV DIFF s)) o res f s`, + REWRITE_TAC[FUN_EQ_THM; o_THM; Sphere.res] THEN REPEAT STRIP_TAC THEN + DISJ_CASES_TAC (TAUT `x:A IN s \/ ~(x IN s)`) THENL + [ + SUBGOAL_THEN `~(x IN (:A) DIFF s)` ASSUME_TAC THENL [ ASM SET_TAC[]; ALL_TAC ] THEN + ASM_SIMP_TAC[] THEN + SUBGOAL_TAC "A" `~((f:(A->A)) x IN (:A) DIFF s)` [ ASM SET_TAC[]; ALL_TAC ] THEN + ASM_SIMP_TAC[]; + + SUBGOAL_TAC "A" `x IN (:A) DIFF s` [ ASM SET_TAC[] ] THEN + ASM_SIMP_TAC[] + ]);; + + +let RES_EMPTY = prove(`!f. res f {} = I`, + REWRITE_TAC[FUN_EQ_THM; I_THM; Sphere.res; NOT_IN_EMPTY]);; + + +let PERMUTES_IMP_RES_EQ_FUN = prove(`!f s. f permutes s ==> res f s = f`, + REWRITE_TAC[permutes; Sphere.res; FUN_EQ_THM] THEN SET_TAC[]);; + + +let RES_PERMUTES_UNION = prove(`!f A B. f permutes A ==> + (res f A) permutes (A UNION B)`, + REWRITE_TAC[permutes; Sphere.res] THEN + SET_TAC[]);; + + +let RES_PERMUTES_DISJOINT_UNIONS = prove(`!(f:A->A) c. (!t. t IN c ==> res f t permutes t) + /\ (!a b. a IN c /\ b IN c /\ ~(a = b) ==> DISJOINT a b) + ==> res f (UNIONS c) permutes (UNIONS c)`, + REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "A") ASSUME_TAC) THEN + SUBGOAL_THEN `!t. t IN c ==> (!y:A. y IN t ==> f y IN t)` (LABEL_TAC "B") THENL + [ + GEN_TAC THEN DISCH_TAC THEN + REMOVE_THEN "A" (MP_TAC o SPEC `t:A->bool`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o (fun th -> MATCH_MP PERMUTES_IMP_INSIDE th)) THEN + REWRITE_TAC[Sphere.res] THEN + MESON_TAC[]; + ALL_TAC + ] THEN + REMOVE_THEN "A" MP_TAC THEN + REWRITE_TAC[permutes] THEN SIMP_TAC[Sphere.res] THEN + ASM SET_TAC[]);; + + +let RES_PERMUTES = prove(`!(f:A->A) s. (!x. x IN s ==> f x IN s) + /\ (!y. y IN s ==> (?x. x IN s /\ y = f x)) + /\ (!x1 x2. x1 IN s /\ x2 IN s /\ f x1 = f x2 ==> x1 = x2) + ==> res f s permutes s`, + REWRITE_TAC[permutes; Sphere.res] THEN + ASM_MESON_TAC[]);; + + +(* Hypermap properties *) + +(* e_fan_pair_ext permutes dart1_of_fan *) + +let E_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN = prove(`!V:(A->bool) E. e_fan_pair_ext (V,E) permutes dart1_of_fan (V,E)`, + REPEAT GEN_TAC THEN + REWRITE_TAC[E_FAN_PAIR_EXT] THEN + MATCH_MP_TAC RES_PERMUTES THEN + REWRITE_TAC[dart1_of_fan; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[e_fan_pair] THENL + [ + EXISTS_TAC `w:A` THEN EXISTS_TAC `v:A` THEN + REWRITE_TAC[PAIR_EQ] THEN + ASM_REWRITE_TAC[SET_RULE `{w,v} = {v,w}`]; + EXISTS_TAC `(w:A,v:A)` THEN + REWRITE_TAC[e_fan_pair; PAIR_EQ] THEN + EXISTS_TAC `w:A` THEN EXISTS_TAC `v:A` THEN + ASM_REWRITE_TAC[SET_RULE `{w,v} = {v,w}`]; + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[e_fan_pair; PAIR_EQ] THEN + SIMP_TAC[] + ]);; + + + +let DART1_OF_FAN_EQ_DISJOINT_UNIONS = prove(`!(V:A->bool) E. UNIONS E SUBSET V ==> ?c. dart1_of_fan (V,E) = UNIONS c + /\ (!a b. a IN c /\ b IN c /\ ~(a = b) ==> DISJOINT a b) + /\ (!a. a IN c ==> (?v. v IN V /\ a = {(v,w) | w | w IN set_of_edge v V E}))`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + SUBGOAL_THEN `!v w:A. {v,w} IN E ==> v IN V /\ w IN V` ASSUME_TAC THENL + [ + REPEAT GEN_TAC THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[SUBSET; IN_UNIONS] THEN + REWRITE_TAC[IMP_IMP] THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "A") ASSUME_TAC) THEN + USE_THEN "A" (MP_TAC o SPEC `v:A`) THEN + REMOVE_THEN "A" (MP_TAC o SPEC `w:A`) THEN + ANTS_TAC THENL [ EXISTS_TAC `{v:A,w}` THEN ASM SET_TAC[]; ALL_TAC ] THEN + DISCH_TAC THEN + ANTS_TAC THENL [ EXISTS_TAC `{v:A,w}` THEN ASM SET_TAC[]; ALL_TAC ] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[Fan.set_of_edge; IN_ELIM_THM] THEN + ABBREV_TAC `B v = {v:A,w | w | {v,w} IN E /\ w IN V}` THEN + EXISTS_TAC `{(B:A->(A#A->bool)) v | v | (v:A) IN V}` THEN + REPEAT STRIP_TAC THENL + [ + REWRITE_TAC[dart1_of_fan] THEN + ASM SET_TAC[]; + + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN + REWRITE_TAC[IN_ELIM_THM] THEN + STRIP_TAC THEN STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + SUBGOAL_TAC "A" `~(v:A = v')` [ ASM_MESON_TAC[] ] THEN + REWRITE_TAC[DISJOINT; EXTENSION; NOT_IN_EMPTY; IN_INTER] THEN + GEN_TAC THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[TAUT `~A ==> ~B <=> B ==> A`] THEN + REPLICATE_TAC 5 REMOVE_ASSUM THEN + POP_ASSUM (fun th -> REWRITE_TAC[GSYM th]) THEN + REWRITE_TAC[IN_ELIM_THM] THEN + MESON_TAC[PAIR_EQ]; + + ASM SET_TAC[] + ]);; + + + +(* n_fan_pair_ext permutes dart1_of_fan *) + +let N_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN = prove(`!V E. FAN (vec 0,V,E) ==> n_fan_pair_ext (V,E) permutes dart1_of_fan (V,E)`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`] DART1_OF_FAN_EQ_DISJOINT_UNIONS) THEN + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[Fan.FAN] THEN + SIMP_TAC[] THEN DISCH_THEN (fun th -> ALL_TAC) THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[N_FAN_PAIR_EXT] THEN + MATCH_MP_TAC RES_PERMUTES_DISJOINT_UNIONS THEN + ASM_REWRITE_TAC[] THEN + GEN_TAC THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `t:real^3#real^3->bool`) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + + DISJ_CASES_TAC (TAUT `t:real^3#real^3->bool = {} \/ ~(t = {})`) THENL + [ + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[PERMUTES_EMPTY; RES_EMPTY]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `extension_sigma_fan (vec 0) V E v permutes set_of_edge v V E ==> res (n_fan_pair (V:real^3->bool,E)) t permutes t` (fun th -> MATCH_MP_TAC th) THENL + [ + REMOVE_ASSUM THEN + REWRITE_TAC[Fan.extension_sigma_fan; permutes; Sphere.res] THEN + SIMP_TAC[] THEN DISCH_TAC THEN + GEN_TAC THEN + MP_TAC (ISPEC `y:real^3#real^3` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `p:real^3` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `q:real^3` ASSUME_TAC) THEN + DISJ_CASES_TAC (TAUT `~(p:real^3 = v) \/ p = v`) THENL + [ + SUBGOAL_THEN `~(y:real^3#real^3 IN t)` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[IN_ELIM_THM; PAIR_EQ]; + ALL_TAC + ] THEN + + REWRITE_TAC[EXISTS_UNIQUE] THEN + EXISTS_TAC `y:real^3#real^3` THEN + ASM_REWRITE_TAC[] THEN + GEN_TAC THEN + DISJ_CASES_TAC (TAUT `y' IN {v:real^3,w:real^3 | w | w IN set_of_edge v V E} \/ ~(y' IN {v,w | w | w IN set_of_edge v V E})`) THENL + [ + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[IN_ELIM_THM] THEN + ASM SET_TAC[n_fan_pair]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[PAIR_EQ]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `q:real^3`) THEN + ASM_REWRITE_TAC[IN_ELIM_THM] THEN + REWRITE_TAC[EXISTS_UNIQUE] THEN + STRIP_TAC THEN + EXISTS_TAC `(v:real^3,x:real^3)` THEN + REWRITE_TAC[n_fan_pair] THEN + CONJ_TAC THENL + [ + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + DISJ_CASES_TAC (TAUT `~(x:real^3 IN set_of_edge v V E) \/ (x IN set_of_edge v V E)`) THENL + [ + ASM_SIMP_TAC[] THEN DISCH_TAC THEN + REWRITE_TAC[PAIR_EQ] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_MESON_TAC[]; + ALL_TAC + ] THEN + + ASM_MESON_TAC[]; + ALL_TAC + ] THEN + + GEN_TAC THEN + MP_TAC (ISPEC `y':real^3#real^3` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `pp:real^3` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `qq:real^3` ASSUME_TAC) THEN + POP_ASSUM (fun th -> REWRITE_TAC[th; PAIR_EQ; n_fan_pair]) THEN + + DISJ_CASES_TAC (MESON[] `(?w:real^3. w IN set_of_edge v V E /\ pp = v /\ qq = w) \/ ~(?w:real^3. w IN set_of_edge v V E /\ pp = v /\ qq = w)`) THENL + [ + ASM_REWRITE_TAC[PAIR_EQ] THEN + SIMP_TAC[] THEN + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `w:real^3`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[PAIR_EQ] THEN + SIMP_TAC[] THEN + ASM_MESON_TAC[]; + + ALL_TAC + ] THEN + + MATCH_MP_TAC Fan.permutes_sigma_fan THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `?x:real^3#real^3. x IN t` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN + SET_TAC[]; + ALL_TAC + ] THEN + POP_ASSUM (CHOOSE_THEN MP_TAC) THEN + ASM_REWRITE_TAC[IN_ELIM_THM; Fan.set_of_edge] THEN + MESON_TAC[]);; + + + +(* e o n o f = I for e_fan_pair_ext, n_fan_pair_ext, f_fan_pair_ext *) + +let E_N_F_EQ_I = prove(`!V E. FAN(vec 0,V,E) ==> (e_fan_pair_ext (V,E) o n_fan_pair_ext (V,E) o f_fan_pair_ext (V,E) = I)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[FUN_EQ_THM] THEN REPEAT GEN_TAC THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `v:real^3` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `w:real^3` ASSUME_TAC) THEN + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[I_THM; o_THM] THEN + REWRITE_TAC[f_fan_pair_ext; f_fan_pair; n_fan_pair_ext; n_fan_pair] THEN + DISJ_CASES_TAC (TAUT `~((v:real^3,w:real^3) IN dart1_of_fan (V,E)) \/ (v,w) IN dart1_of_fan (V,E)`) THEN ASM_REWRITE_TAC[] THENL + [ + ASM_REWRITE_TAC[e_fan_pair_ext]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[dart1_of_fan; IN_ELIM_THM; PAIR_EQ] THEN + STRIP_TAC THEN + SUBGOAL_THEN `inverse_sigma_fan (vec 0) V E w (v:real^3) = inverse1_sigma_fan (vec 0) V E w v` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC (GSYM INVERSE_SIGMA_FAN_EQ_INVERSE1_SIGMA_FAN) THEN + ASM_MESON_TAC[SET_RULE `{w,v} = {v,w}`]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `?v' w':real^3. {v',w'} IN E /\ w = v' /\ inverse1_sigma_fan (vec 0) V E w v = w'` (fun th -> REWRITE_TAC[th]) THENL + [ + MP_TAC (SPECL [`(vec 0):real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `w:real^3`] Fan.INVERSE1_SIGMA_FAN) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (CONJUNCTS_THEN2 (MP_TAC o SPEC `v':real^3`) (fun th -> ALL_TAC)) THEN + ASM_MESON_TAC[SET_RULE `{w,v} = {v,w}`]; + ALL_TAC + ] THEN + + REWRITE_TAC[n_fan_pair] THEN + MP_TAC (SPECL [`(vec 0):real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `w:real^3`] Fan.INVERSE1_SIGMA_FAN) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (CONJUNCTS_THEN2 (fun th -> ALL_TAC) MP_TAC) THEN + DISCH_THEN (CONJUNCTS_THEN2 (MP_TAC o SPEC `v':real^3`) (fun th -> ALL_TAC)) THEN + ASM_REWRITE_TAC[SET_RULE `{w',v'} = {v',w'}`] THEN + SIMP_TAC[e_fan_pair_ext; e_fan_pair] THEN + SUBGOAL_THEN `w':real^3,v':real^3 IN dart1_of_fan (V,E)` (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[dart1_of_fan; IN_ELIM_THM; PAIR_EQ] THEN + ASM_MESON_TAC[SET_RULE `{v',w'} = {w',v'}`]);; + + + +(* f_fan_pair_ext permutes dart1_of_fan *) + +let INVERSE_PERMUTES = prove(`!(f:A->A) g s. f permutes s /\ f o g = I ==> g permutes s`, + REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN + FIRST_ASSUM (ASSUME_TAC o (fun th -> CONJUNCT2 (MATCH_MP PERMUTES_INVERSES_o th))) THEN + DISCH_THEN (MP_TAC o (fun th -> AP_TERM `(\h:A->A. inverse (f:A->A) o h)` th)) THEN + BETA_TAC THEN + ASM_REWRITE_TAC[o_ASSOC; I_O_ID] THEN + ASM_MESON_TAC[PERMUTES_INVERSE]);; + +let F_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN = prove(`!V E. FAN (vec 0,V,E) ==> f_fan_pair_ext (V,E) permutes dart1_of_fan (V,E)`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM (ASSUME_TAC o (fun th -> MATCH_MP E_N_F_EQ_I th)) THEN + MATCH_MP_TAC INVERSE_PERMUTES THEN + EXISTS_TAC `e_fan_pair_ext (V:real^3->bool,E) o n_fan_pair_ext (V,E)` THEN + ASM_REWRITE_TAC[GSYM o_ASSOC] THEN + MATCH_MP_TAC PERMUTES_COMPOSE THEN + REWRITE_TAC[E_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN] THEN + ASM_SIMP_TAC[N_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN]);; + + + +(* e_fan_pair, n_fan_pair, f_fan_pair map dart1_of_fan into dart1_of_fan *) + +let E_N_F_IN_DART1_OF_FAN = prove(`!V E x. FAN(vec 0,V,E) /\ x IN dart1_of_fan (V,E) ==> + e_fan_pair (V,E) x IN dart1_of_fan (V,E) /\ + n_fan_pair (V,E) x IN dart1_of_fan (V,E) /\ + f_fan_pair (V,E) x IN dart1_of_fan (V,E)`, + REPEAT STRIP_TAC THENL + [ + MP_TAC (ISPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`] E_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN) THEN + DISCH_THEN (MP_TAC o (fun th -> MATCH_MP PERMUTES_IMP_INSIDE th)) THEN + DISCH_THEN (MP_TAC o SPEC `x:real^3#real^3`) THEN + ASM_REWRITE_TAC[e_fan_pair_ext]; + FIRST_X_ASSUM (MP_TAC o (fun th -> MATCH_MP N_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN th)) THEN + DISCH_THEN (MP_TAC o (fun th -> MATCH_MP PERMUTES_IMP_INSIDE th)) THEN + DISCH_THEN (MP_TAC o SPEC `x:real^3#real^3`) THEN + ASM_REWRITE_TAC[n_fan_pair_ext]; + FIRST_X_ASSUM (MP_TAC o (fun th -> MATCH_MP F_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN th)) THEN + DISCH_THEN (MP_TAC o (fun th -> MATCH_MP PERMUTES_IMP_INSIDE th)) THEN + DISCH_THEN (MP_TAC o SPEC `x:real^3#real^3`) THEN + ASM_REWRITE_TAC[f_fan_pair_ext]; + ]);; + + +(* inverse (f_fan_pair_ext) maps dart1_of_fan into dart1_of_fan *) + +let INVERSE_F_IN_DART1_OF_FAN = prove(`!V E x. FAN(vec 0,V,E) /\ x IN dart1_of_fan (V,E) + ==> inverse (f_fan_pair_ext (V,E)) x IN dart1_of_fan (V,E)`, + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o (fun th -> MATCH_MP F_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN th)) THEN + DISCH_THEN (MP_TAC o (fun th -> MATCH_MP PERMUTES_INVERSE th)) THEN + DISCH_THEN (MP_TAC o (fun th -> MATCH_MP PERMUTES_IMP_INSIDE th)) THEN + ASM_SIMP_TAC[]);; + + + + +(* dart_of_fan is finite *) + +let FINITE_DART_OF_FAN = prove(`!x V E. FAN (x,V,E) ==> FINITE (dart_of_fan (V,E))`, + REWRITE_TAC[Fan.FAN; Fan.fan1; dart_of_fan] THEN + REPEAT GEN_TAC THEN + DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + DISCH_THEN (CONJUNCTS_THEN2 (fun th -> ALL_TAC) (ASSUME_TAC o CONJUNCT1 o CONJUNCT1)) THEN + REWRITE_TAC[FINITE_UNION] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC FINITE_SUBSET THEN + EXISTS_TAC `{v,v | v IN (V:real^3->bool)}` THEN + CONJ_TAC THENL + [ + REWRITE_TAC[IMAGE_LEMMA] THEN + MATCH_MP_TAC FINITE_IMAGE THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + SET_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC FINITE_SUBSET THEN + EXISTS_TAC `{(v:real^3,w) | v, w| v IN V /\ w IN V}` THEN + ASM_SIMP_TAC[FINITE_PRODUCT] THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[UNIONS; SUBSET; IN_ELIM_THM] THEN + DISCH_TAC THEN + GEN_TAC THEN STRIP_TAC THEN + EXISTS_TAC `v:real^3` THEN EXISTS_TAC `w:real^3` THEN + FIRST_ASSUM (MP_TAC o SPEC `v:real^3`) THEN + FIRST_ASSUM (MP_TAC o SPEC `w:real^3`) THEN + ANTS_TAC THENL [ EXISTS_TAC `{v:real^3,w}` THEN ASM SET_TAC[]; ALL_TAC] THEN + DISCH_TAC THEN + ANTS_TAC THENL [ EXISTS_TAC `{v:real^3,w}` THEN ASM SET_TAC[]; ALL_TAC] THEN + ASM_SIMP_TAC[]);; + + + +(* e_fan_pair_ext permutes dart_of_fan *) + +let E_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN = prove(`!(V:real^3->bool) E. e_fan_pair_ext (V,E) permutes dart_of_fan (V,E)`, + REPEAT GEN_TAC THEN + SUBGOAL_TAC "A" `e_fan_pair_ext (V:real^3->bool,E) = res (e_fan_pair_ext (V,E)) (dart1_of_fan (V,E))` [ REWRITE_TAC[E_FAN_PAIR_EXT; RES_RES] ] THEN + POP_ASSUM (fun th -> ONCE_REWRITE_TAC[th]) THEN + REWRITE_TAC[dart_of_fan; GSYM dart1_of_fan] THEN + ONCE_REWRITE_TAC[UNION_ACI] THEN + MATCH_MP_TAC RES_PERMUTES_UNION THEN + REWRITE_TAC[E_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN]);; + + +(* f_fan_pair_ext permutes dart_of_fan *) + +let F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN = prove(`!(V:real^3->bool) E. FAN (vec 0,V,E) ==> f_fan_pair_ext (V,E) permutes dart_of_fan (V,E)`, + REPEAT STRIP_TAC THEN + SUBGOAL_TAC "A" `f_fan_pair_ext (V:real^3->bool,E) = res (f_fan_pair_ext (V,E)) (dart1_of_fan (V,E))` [ REWRITE_TAC[F_FAN_PAIR_EXT; RES_RES] ] THEN + POP_ASSUM (fun th -> ONCE_REWRITE_TAC[th]) THEN + REWRITE_TAC[dart_of_fan; GSYM dart1_of_fan] THEN + ONCE_REWRITE_TAC[UNION_ACI] THEN + MATCH_MP_TAC RES_PERMUTES_UNION THEN + ASM_SIMP_TAC[F_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN]);; + + +(* n_fan_pair_ext permutes dart_of_fan *) + +let N_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN = prove(`!(V:real^3->bool) E. FAN (vec 0,V,E) ==> n_fan_pair_ext (V,E) permutes dart_of_fan (V,E)`, + REPEAT STRIP_TAC THEN + SUBGOAL_TAC "A" `n_fan_pair_ext (V:real^3->bool,E) = res (n_fan_pair_ext (V,E)) (dart1_of_fan (V,E))` [ REWRITE_TAC[N_FAN_PAIR_EXT; RES_RES] ] THEN + POP_ASSUM (fun th -> ONCE_REWRITE_TAC[th]) THEN + REWRITE_TAC[dart_of_fan; GSYM dart1_of_fan] THEN + ONCE_REWRITE_TAC[UNION_ACI] THEN + MATCH_MP_TAC RES_PERMUTES_UNION THEN + ASM_SIMP_TAC[N_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN]);; + + +(* Main result: hypermap_of_fan is a hypermap *) + +let HYPERMAP_OF_FAN = prove(`!V E. FAN (vec 0,V,E) ==> tuple_hypermap (hypermap_of_fan (V,E)) = + (dart_of_fan (V,E), e_fan_pair_ext (V,E), + n_fan_pair_ext (V,E), f_fan_pair_ext (V,E))`, + REWRITE_TAC[hypermap_of_fan] THEN + CONV_TAC (DEPTH_CONV let_CONV) THEN + BETA_TAC THEN + REWRITE_TAC[GSYM E_FAN_PAIR_EXT; GSYM N_FAN_PAIR_EXT; GSYM F_FAN_PAIR_EXT] THEN + REWRITE_TAC[GSYM Hypermap.hypermap_tybij] THEN + GEN_TAC THEN GEN_TAC THEN DISCH_TAC THEN + FIRST_ASSUM (fun th -> REWRITE_TAC[MATCH_MP FINITE_DART_OF_FAN th]) THEN + ASM_SIMP_TAC[N_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN] THEN + ASM_SIMP_TAC[E_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN] THEN + ASM_SIMP_TAC[F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN] THEN + ASM_SIMP_TAC[E_N_F_EQ_I] );; + + + +let COMPONENTS_HYPERMAP_OF_FAN = prove(`!V E. FAN (vec 0,V,E) ==> + dart (hypermap_of_fan (V,E)) = dart_of_fan (V,E) /\ + edge_map (hypermap_of_fan (V,E)) = e_fan_pair_ext (V,E) /\ + node_map (hypermap_of_fan (V,E)) = n_fan_pair_ext (V,E) /\ + face_map (hypermap_of_fan (V,E)) = f_fan_pair_ext (V,E)`, + SIMP_TAC[Hypermap.dart; Hypermap.edge_map; Hypermap.node_map; Hypermap.face_map; HYPERMAP_OF_FAN]);; + + + +(* Additional properties of the face map *) + +let INVERSE_F_FAN_PAIR_EXT = prove(`!V E. FAN(vec 0,V,E) ==> + inverse (f_fan_pair_ext (V,E)) = e_fan_pair_ext (V,E) o n_fan_pair_ext (V,E)`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM (ASSUME_TAC o (fun th -> MATCH_MP E_N_F_EQ_I th)) THEN + MATCH_MP_TAC INVERSE_UNIQUE_o THEN + ASM_REWRITE_TAC[GSYM o_ASSOC] THEN + MP_TAC (ISPECL [`dart_of_fan ((V:real^3->bool),E)`; `e_fan_pair_ext (V:real^3->bool,E)`; `n_fan_pair_ext (V:real^3->bool,E)`; `f_fan_pair_ext (V:real^3->bool,E)`] Hypermap.cyclic_maps) THEN + ASM_SIMP_TAC[E_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN; N_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN; F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN] THEN + ASM_MESON_TAC[FINITE_DART_OF_FAN]);; + + +(* Explicit formula for inverse (f_fan_pair_ext) *) + +let INVERSE_F_FAN_PAIR_EXT_EXPLICIT = prove(`!V E. FAN(vec 0,V,E) ==> + inverse (f_fan_pair_ext (V,E)) = res (\(v,w). sigma_fan (vec 0) V E v w, v) (dart1_of_fan (V,E))`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM ((fun th -> REWRITE_TAC[th]) o (fun th -> MATCH_MP INVERSE_F_FAN_PAIR_EXT th)) THEN + REWRITE_TAC[FUN_EQ_THM; o_THM] THEN + GEN_TAC THEN + REWRITE_TAC[Sphere.res; n_fan_pair_ext] THEN + DISJ_CASES_TAC (TAUT `~(x IN dart1_of_fan (V:real^3->bool,E)) \/ x IN dart1_of_fan (V,E)`) THENL + [ + ASM_REWRITE_TAC[e_fan_pair_ext]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[e_fan_pair_ext] THEN + ASM_SIMP_TAC[E_N_F_IN_DART1_OF_FAN] THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `v:real^3` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `w:real^3` ASSUME_TAC) THEN + ASM_REWRITE_TAC[n_fan_pair; e_fan_pair]);; + + + +(* Further results *) + +let DART_EXISTS = prove(`!V E (v:real^3). v IN V ==> ?w. (v,w) IN dart_of_fan (V,E)`, + REPEAT STRIP_TAC THEN + DISJ_CASES_TAC (SET_RULE `set_of_edge (v:real^3) V E = {} \/ (?w. w IN set_of_edge v V E)`) THENL + [ + EXISTS_TAC `v:real^3` THEN + REWRITE_TAC[dart_of_fan; IN_UNION] THEN + DISJ1_TAC THEN + ASM SET_TAC[]; + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + EXISTS_TAC `w:real^3` THEN + REWRITE_TAC[dart_of_fan; IN_UNION] THEN + DISJ2_TAC THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[Fan.set_of_edge] THEN + ASM SET_TAC[] + ]);; + + + +let E_N_F_DEGENERATE_CASE = prove(`!V E x. FAN (vec 0,V,E) /\ ~(x IN dart1_of_fan (V,E)) + ==> edge (hypermap_of_fan (V,E)) x = {x} /\ + node (hypermap_of_fan (V,E)) x = {x} /\ + face (hypermap_of_fan (V,E)) x = {x}`, + REPEAT GEN_TAC THEN + REWRITE_TAC[Hypermap.edge; Hypermap.node; Hypermap.face] THEN + SIMP_TAC[Hypermap.edge_map; Hypermap.node_map; Hypermap.face_map; HYPERMAP_OF_FAN] THEN + ONCE_REWRITE_TAC[GSYM Hypermap.orbit_one_point] THEN + SIMP_TAC[e_fan_pair_ext; n_fan_pair_ext; f_fan_pair_ext]);; + + + + + +let DART1_OF_FAN_SUBSET_DART_OF_FAN = prove(`!V E. dart1_of_fan (V,E) SUBSET dart_of_fan (V,E)`, + REWRITE_TAC[dart1_of_fan; dart_of_fan; SUBSET] THEN + SET_TAC[]);; + + + +let NODE_SUBSET_DART1_OF_FAN = prove(`!V E x. FAN (vec 0,V,E) /\ x IN dart1_of_fan (V,E) + ==> node (hypermap_of_fan (V,E)) x SUBSET dart1_of_fan (V,E)`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[Hypermap.node; Hypermap.node_map; HYPERMAP_OF_FAN] THEN + MP_TAC (ISPECL [`dart1_of_fan (V:real^3->bool,E)`; `n_fan_pair_ext (V:real^3->bool,E)`] Hypermap.orbit_subset) THEN + ASM_SIMP_TAC[N_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN]);; + + + +let NODE_SUBSET_DART_OF_FAN = prove(`!V E x. FAN (vec 0,V,E) /\ x IN dart_of_fan (V,E) + ==> node (hypermap_of_fan (V,E)) x SUBSET dart_of_fan (V,E)`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[Hypermap.node; Hypermap.node_map; HYPERMAP_OF_FAN] THEN + MP_TAC (ISPECL [`dart_of_fan (V:real^3->bool,E)`; `n_fan_pair_ext (V:real^3->bool,E)`] Hypermap.orbit_subset) THEN + ASM_SIMP_TAC[N_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN]);; + + + + + +let FACE_SUBSET_DART1_OF_FAN = prove(`!V E x. FAN (vec 0,V,E) /\ x IN dart1_of_fan (V,E) + ==> face (hypermap_of_fan (V,E)) x SUBSET dart1_of_fan (V,E)`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[Hypermap.face; Hypermap.face_map; HYPERMAP_OF_FAN] THEN + MP_TAC (ISPECL [`dart1_of_fan (V:real^3->bool,E)`; `f_fan_pair_ext (V:real^3->bool,E)`] Hypermap.orbit_subset) THEN + ASM_SIMP_TAC[F_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN]);; + + + +let FACE_SUBSET_DART_OF_FAN = prove(`!V E x. FAN (vec 0,V,E) /\ x IN dart_of_fan (V,E) + ==> face (hypermap_of_fan (V,E)) x SUBSET dart_of_fan (V,E)`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[Hypermap.face; Hypermap.face_map; HYPERMAP_OF_FAN] THEN + MP_TAC (ISPECL [`dart_of_fan (V:real^3->bool,E)`; `f_fan_pair_ext (V:real^3->bool,E)`] Hypermap.orbit_subset) THEN + ASM_SIMP_TAC[F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN]);; + + + + +let EDGE_SUBSET_DART1_OF_FAN = prove(`!V E x. FAN (vec 0,V,E) /\ x IN dart1_of_fan (V,E) + ==> edge (hypermap_of_fan (V,E)) x SUBSET dart1_of_fan (V,E)`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[Hypermap.edge; Hypermap.edge_map; HYPERMAP_OF_FAN] THEN + MP_TAC (ISPECL [`dart1_of_fan (V:real^3->bool,E)`; `e_fan_pair_ext (V:real^3->bool,E)`] Hypermap.orbit_subset) THEN + ASM_SIMP_TAC[E_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN]);; + + +let PAIR_IN_DART_OF_FAN = prove(`!V E (v:real^3) w. FAN (vec 0,V,E) /\ (v,w) IN dart_of_fan (V,E) + ==> v IN V /\ w IN V`, + REWRITE_TAC[dart_of_fan; IN_UNION; IN_ELIM_THM; PAIR_EQ] THEN + REPEAT GEN_TAC THEN STRIP_TAC THENL + [ + ASM_MESON_TAC[]; + ASM_MESON_TAC[Fan_misc.FAN_IN_SET_OF_EDGE] + ]);; + + + +let PAIR_IN_DART1_OF_FAN = prove(`!V E (v:real^3) w. FAN (vec 0,V,E) /\ (v,w) IN dart1_of_fan (V,E) + ==> v IN V /\ w IN V /\ w IN set_of_edge v V E /\ v IN set_of_edge w V E`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + SUBGOAL_THEN `{v:real^3,w} IN E` ASSUME_TAC THENL + [ + POP_ASSUM (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + REWRITE_TAC[dart1_of_fan; IN_ELIM_THM; PAIR_EQ] THEN + SET_TAC[]; + ALL_TAC + ] THEN + ASM_MESON_TAC[Fan_misc.FAN_IN_SET_OF_EDGE]);; + + + +let PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ = prove(`!V E v w. FAN (vec 0:real^N,V,E) /\ (v,w) IN dart1_of_fan (V,E) ==> ~(v = w)`, + REPEAT GEN_TAC THEN + REWRITE_TAC[Fan.FAN; dart1_of_fan; Fan.graph] THEN + DISCH_THEN (CONJUNCTS_THEN2 (ASSUME_TAC o CONJUNCT1 o CONJUNCT2) MP_TAC) THEN + REWRITE_TAC[IN_ELIM_THM] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `{v':real^N,w'}`) THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[IN; PAIR_EQ] THEN + DISCH_TAC THEN DISCH_TAC THEN + MATCH_MP_TAC (TAUT `(B ==> ~A) ==> (A ==> ~B)`) THEN + DISCH_TAC THEN + ASM_REWRITE_TAC[HAS_SIZE; SET_RULE `{w',w'} = {w'}`] THEN + SIMP_TAC[Hypermap.CARD_SINGLETON; ARITH_RULE `~(1 = 2)`]);; + + + +let NOT_IN_DART1_OF_FAN = prove(`!V E (v:real^3). FAN (vec 0,V,E) ==> ~(v,v IN dart1_of_fan (V,E))`, + REPEAT STRIP_TAC THEN + MP_TAC (REFL `v:real^3`) THEN + PURE_REWRITE_TAC[TAUT `A ==> F <=> ~A`] THEN + MATCH_MP_TAC (SPEC_ALL PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ) THEN + ASM_REWRITE_TAC[]);; + + + + + +let IN_DART_OF_FAN = prove(`!(V:real^3->bool) E x. FAN (vec 0,V,E) /\ x IN dart_of_fan (V,E) + ==> ?v w. x = (v,w) /\ (v,w) IN dart_of_fan (V,E) /\ v IN V /\ w IN V`, + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + EXISTS_TAC `x':real^3` THEN EXISTS_TAC `y:real^3` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC PAIR_IN_DART_OF_FAN THEN + EXISTS_TAC `E:(real^3->bool)->bool` THEN + ASM_REWRITE_TAC[]);; + + + +let IN_DART1_OF_FAN = prove(`!(V:real^3->bool) E x. FAN (vec 0,V,E) /\ x IN dart1_of_fan (V,E) + ==> (?v w. x = v,w /\ (v,w) IN dart1_of_fan (V,E) /\ + v IN V /\ w IN V /\ {v,w} IN E /\ + w IN set_of_edge v V E /\ v IN set_of_edge w V E)`, + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + EXISTS_TAC `x':real^3` THEN EXISTS_TAC `y:real^3` THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `x':real^3`; `y:real^3`] PAIR_IN_DART1_OF_FAN) THEN + ASM_SIMP_TAC[] THEN DISCH_THEN (fun th -> ALL_TAC) THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[dart1_of_fan; IN_ELIM_THM; PAIR_EQ] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[]);; + + + + + +(* A dart set of a hypermap is a union of components *) +let DART_EQ_UNIONS = prove(`!H:(A)hypermap. dart H = UNIONS (face_set H) /\ + dart H = UNIONS (node_set H) /\ + dart H = UNIONS (edge_set H)`, + GEN_TAC THEN REWRITE_TAC[Hypermap.face_set; Hypermap.node_set; Hypermap.edge_set] THEN + REPEAT CONJ_TAC THEN MATCH_MP_TAC Hypermap.lemma_partition THEN + REWRITE_TAC[Hypermap.hypermap_lemma]);; + + +(* A double sum over the set of orbits is a sum over a set itself *) +let SUM_SET_OF_ORBITS = prove(`!s (f:A->A) g. FINITE s /\ f permutes s + ==> sum (set_of_orbits s f) (\y. sum y g) = sum s g`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + FIRST_ASSUM (MP_TAC o (fun th -> MATCH_MP Hypermap.lemma_partition th)) THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [th]) THEN + MATCH_MP_TAC (GSYM SUM_UNIONS_NONZERO) THEN + ASM_SIMP_TAC[Hypermap.finite_orbits_lemma] THEN + CONJ_TAC THENL + [ + GEN_TAC THEN + REWRITE_TAC[Hypermap.set_of_orbits; IN_ELIM_THM] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC Hypermap.lemma_orbit_finite THEN + EXISTS_TAC `s:A->bool` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[Hypermap.set_of_orbits; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o (MATCH_MP Hypermap.partition_orbit)) THEN + DISCH_THEN (MP_TAC o SPECL [`x':A`; `x'':A`]) THEN + ASM_REWRITE_TAC[EXTENSION; NOT_IN_EMPTY; IN_INTER; DE_MORGAN_THM] THEN + DISCH_THEN (MP_TAC o SPEC `x:A`) THEN + ASM_REWRITE_TAC[]);; + + + +(* Specialization of the previos lemma for the components of a hypermap *) +let DART_SUM_lemma = prove(`!(H:(A)hypermap) (g:A->real). + sum (face_set H) (\f. sum f g) = sum (dart H) g /\ + sum (node_set H) (\n. sum n g) = sum (dart H) g`, + REPEAT GEN_TAC THEN REWRITE_TAC[Hypermap.face_set; Hypermap.node_set] THEN + CONJ_TAC THEN MATCH_MP_TAC SUM_SET_OF_ORBITS THEN REWRITE_TAC[Hypermap.hypermap_lemma]);; + + + + +(*************************************) +(* Several simple theorem-generators *) +(*************************************) + +let rec range a b = + if (a > b) then [] + else a :: range (a+1) b +;; + + + +(* a1 = b1, a2 = b2, ..., an = bn ==> {a1,...,an} = {b1,...,bn} *) +let gen_ELEMENTS_EQ_IMP_SET_EQ n = + let indices = range 1 n in + let labels ch = map (fun i -> String.concat "" [ch; string_of_int i]) indices in + let a_terms = map (fun name -> mk_var (name, `:A`)) (labels "a") in + let b_terms = map (fun name -> mk_var (name, `:A`)) (labels "b") in + let lhs = list_mk_conj (map2 (fun a b -> mk_eq (a,b)) a_terms b_terms) in + let rhs = mk_eq (mk_fset a_terms, mk_fset b_terms) in + let imp = mk_imp (lhs, rhs) in + GEN_ALL (prove(imp, SIMP_TAC[]));; + + +(* n < k <=> n = 0 \/ n = 1 \/ ... \/ n = k - 1 *) +let gen_NUM_CASES k = + let var = mk_var("k", `:num`) in + let lhs = mk_binary "<" (var, mk_numeral (Int k)) in + let rhs = list_mk_disj (map (fun i -> mk_eq (var, mk_numeral (Int i))) (range 0 (k-1))) in + let suc = SYM ((DEPTH_CONV NUM_SUC_CONV) (funpow k (fun term -> mk_comb(`SUC`, term)) `0`)) in + GEN_ALL (prove(mk_iff(lhs, rhs), + REWRITE_TAC[suc; LT] THEN + CONV_TAC (DEPTH_CONV NUM_SUC_CONV) THEN + REWRITE_TAC[DISJ_ACI]));; + + +(* {f k | k < n} = {f 0, f 1, ..., f (n - 1)} *) +let gen_FINITE_SET n = + let f = mk_var ("f", `:num->A`) in + let k = mk_var ("k", `:num`) in + let x = mk_var ("x", `:A`) in + let rhs = mk_fset (map (fun i -> mk_comb (f, mk_small_numeral i)) (range 0 (n - 1))) in + let lhs = + let body = list_mk_icomb "SETSPEC" [x; mk_binary "<" (k, mk_small_numeral n); mk_comb (f, k)] in + mk_comb (`GSPEC:(A->bool)->(A->bool)`, mk_abs (x, mk_exists (k, body))) in + GEN_ALL(prove(mk_eq(lhs,rhs), + REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN + REWRITE_TAC[gen_NUM_CASES n] THEN + SET_TAC[]));; + + +(*************************************) + +(* Some auxiliary results about orbits *) + +let FINITE_ORBIT_MAP = prove(`!s f (x:A) n. FINITE s /\ f permutes s + /\ CARD (orbit_map f x) = n + ==> orbit_map f x = {(f POWER k) x | k < n}`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC Hypermap.orbit_cyclic THEN + MP_TAC (SPECL [`s:A->bool`; `f:A->A`; `x:A`] Hypermap.lemma_cycle_orbit) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MP_TAC (SPECL [`orbit_map (f:A->A) x`; `x:A`] Hypermap.CARD_ATLEAST_1) THEN + MP_TAC (SPECL [`s:A->bool`; `f:A->A`; `x:A`] Hypermap.lemma_orbit_finite) THEN + ASM_SIMP_TAC[Hypermap.orbit_reflect; ARITH_RULE `1 <= n ==> ~(n = 0)`]);; + + + +let ORBIT_MAP_CARD_POS = prove(`!s f (x:A). FINITE s /\ f permutes s ==> 0 < CARD (orbit_map f x)`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`s:A->bool`; `f:A->A`; `x:A`; `x:A`] Hypermap.lemma_index_on_orbit) THEN + ASM_REWRITE_TAC[Hypermap.orbit_reflect] THEN + STRIP_TAC THEN + MATCH_MP_TAC LET_TRANS THEN + EXISTS_TAC `n:num` THEN + ASM_REWRITE_TAC[LE_0]);; + + + +let ORBIT_MAP_INJ = prove(`!s f (x:A) i j k. FINITE s /\ f permutes s /\ CARD (orbit_map f x) = k /\ + i < k /\ j < k /\ (f POWER i) x = (f POWER j) x + ==> i = j`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `inj_orbit f (x:A) (k - 1)` MP_TAC THENL + [ + MP_TAC (SPECL [`s:A->bool`; `f:A->A`; `x:A`] Hypermap.lemma_segment_orbit) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN MATCH_MP_TAC THEN + MP_TAC (SPEC_ALL ORBIT_MAP_CARD_POS) THEN + ASM_REWRITE_TAC[] THEN + ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[Hypermap.lemma_inj_orbit] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_SIMP_TAC[ARITH_RULE `i < k ==> i <= k - 1`]);; + + + +let INVERSE_ADD_EXPONENTS = prove(`!a b (f:A->A) s. f permutes s /\ b <= a + ==> (f POWER a) o ((inverse f) POWER b) = f POWER (a - b) + /\ ((inverse f) POWER b) o (f POWER a) = f POWER (a - b)`, + REPEAT STRIP_TAC THENL + [ + MP_TAC (ARITH_RULE `b:num <= a ==> a = (a - b) + b`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [th]) THEN + REWRITE_TAC[Hypermap.addition_exponents; GSYM o_ASSOC] THEN + MP_TAC (SPECL [`s:A->bool`; `f:A->A`; `b:num`] Hypermap.lemma_power_inverse_map) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; I_O_ID]); + + MP_TAC (ARITH_RULE `b:num <= a ==> a = b + (a - b)`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [th]) THEN + REWRITE_TAC[Hypermap.addition_exponents; o_ASSOC] THEN + MP_TAC (SPECL [`s:A->bool`; `f:A->A`; `b:num`] Hypermap.lemma_power_inverse_map) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; I_O_ID]) + ]);; + + + +let FINITE_ORBIT_MAP_INVERSE = prove(`!f s (x:A) n k. FINITE s /\ f permutes s + /\ CARD (orbit_map f x) = n /\ k <= n + ==> (inverse f POWER k) x = (f POWER (n - k)) x`, + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[CONJUNCT2 (ISPEC `inverse (f:A->A) POWER k` (GSYM I_O_ID))] THEN + SUBGOAL_THEN `I (x:A) = (f POWER n) x` ASSUME_TAC THENL + [ + MP_TAC (SPECL [`s:A->bool`; `f:A->A`; `x:A`] Hypermap.lemma_cycle_orbit) THEN + ASM_REWRITE_TAC[I_THM] THEN SIMP_TAC[]; + ALL_TAC + ] THEN + SUBGOAL_THEN `((inverse f POWER k) o I) (x:A) = ((inverse f POWER k) o (f POWER n)) x` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[o_THM]; + ALL_TAC + ] THEN + ASM_MESON_TAC[INVERSE_ADD_EXPONENTS]);; + + + + + + + +let ORBIT_MAP_TRANSLATION = prove(`!s f (x:A) k n. FINITE s /\ f permutes s /\ CARD (orbit_map f x) = k + ==> orbit_map f x = IMAGE (\i. (f POWER i) x) (n..n + k - 1)`, + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + MP_TAC (SPECL [`s:A->bool`; `f:A->A`; `x:A`; `n:num`] Hypermap.lemma_orbit_power) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_TAC THEN + MP_TAC (SPECL [`s:A->bool`; `f:A->A`; `((f:A->A) POWER n) x:A`; `k:num`] FINITE_ORBIT_MAP) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (DEPTH_CONV o LAND_CONV) [th]) THEN + + MP_TAC (SPECL [`s:A->bool`; `f:A->A`; `(f POWER n) x:A`] ORBIT_MAP_CARD_POS) THEN + ASM_REWRITE_TAC[] THEN + + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN DISCH_TAC THEN + REWRITE_TAC[GSYM IMAGE_LEMMA] THEN + SUBGOAL_THEN `!k. ((f:A->A) POWER k) ((f POWER n) x) = (f POWER (k + n)) x` (fun th -> REWRITE_TAC[th]) THENL + [ + GEN_TAC THEN REWRITE_TAC[Hypermap.addition_exponents; o_THM]; + ALL_TAC + ] THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN + GEN_TAC THEN EQ_TAC THEN STRIP_TAC THENL + [ + EXISTS_TAC `(k':num) + n` THEN + REWRITE_TAC[IN_NUMSEG] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + POP_ASSUM MP_TAC THEN + ARITH_TAC; + EXISTS_TAC `(x'':num) - n` THEN + FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl)) THEN + REWRITE_TAC[IN_NUMSEG] THEN + STRIP_TAC THEN + MP_TAC (ARITH_RULE `n:num <= x'' ==> x'' - n + n = x''`) THEN + ASM_SIMP_TAC[] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + ARITH_TAC + ]);; + + + +let SUM_ORBIT = prove(`!P s f (x:A) k n. FINITE s /\ f permutes s /\ CARD (orbit_map f x) = k + ==> sum (orbit_map f x) P = sum (n..n + k - 1) (\i. P ((f POWER i) x))`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL ORBIT_MAP_TRANSLATION) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + SUBGOAL_THEN `(\i. (P:A->real) ((f POWER i) (x:A))) = P o (\i. (f POWER i) x)` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[FUN_EQ_THM; o_THM]; + ALL_TAC + ] THEN + MATCH_MP_TAC SUM_IMAGE THEN + X_GEN_TAC `i:num` THEN + X_GEN_TAC `j:num` THEN + REWRITE_TAC[IN_NUMSEG] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC (ARITH_RULE `n <= i /\ n <= j /\ i - n = j - n ==> (i = j:num)`) THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM (MP_TAC o AP_TERM `(inverse (f:A->A)) POWER n`) THEN + MP_TAC (SPECL [`i:num`; `n:num`; `f:A->A`; `s:A->bool`] INVERSE_ADD_EXPONENTS) THEN + ASM_REWRITE_TAC[FUN_EQ_THM; o_THM] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MP_TAC (SPECL [`j:num`; `n:num`; `f:A->A`; `s:A->bool`] INVERSE_ADD_EXPONENTS) THEN + ASM_REWRITE_TAC[FUN_EQ_THM; o_THM] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_TAC THEN + MATCH_MP_TAC (SPEC_ALL ORBIT_MAP_INJ) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPEC_ALL ORBIT_MAP_CARD_POS) THEN + ASM_REWRITE_TAC[] THEN + REMOVE_ASSUM THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) THEN + ARITH_TAC);; + + +(* Additional results for orbit maps of sizes 2, 3 *) + + +let ORBIT_MAP_3 = prove(`!s f (x:A). FINITE s /\ f permutes s /\ CARD (orbit_map f x) = 3 + ==> orbit_map f x = {x, f x, f(f x)} /\ f (f (f x)) = x`, + REPEAT GEN_TAC THEN + DISCH_TAC THEN + FIRST_ASSUM (MP_TAC o (fun th -> MATCH_MP FINITE_ORBIT_MAP th)) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[gen_FINITE_SET 3] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC (gen_ELEMENTS_EQ_IMP_SET_EQ 3) THEN + ASM_REWRITE_TAC[Hypermap.POWER; Hypermap.POWER_2; Hypermap.POWER_1] THEN + REWRITE_TAC[I_THM; o_THM]; + SUBGOAL_THEN `f (f (f x)) = (f POWER 3) (x:A)` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[ARITH_RULE `3 = SUC 2`; Hypermap.POWER; Hypermap.POWER_2; o_THM]; + ALL_TAC + ] THEN + FIRST_ASSUM (fun th -> REWRITE_TAC[GSYM th]) THEN + MATCH_MP_TAC Hypermap.lemma_cycle_orbit THEN + EXISTS_TAC `s:A->bool` THEN + ASM_REWRITE_TAC[] + ]);; + + + + +let ORBIT_MAP_2 = prove(`!s f (x:A). FINITE s /\ f permutes s /\ CARD (orbit_map f x) = 2 + ==> orbit_map f x = {x, f x} /\ f (f x) = x`, + REPEAT GEN_TAC THEN + DISCH_TAC THEN + FIRST_ASSUM (MP_TAC o (fun th -> MATCH_MP FINITE_ORBIT_MAP th)) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[gen_FINITE_SET 2] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC (gen_ELEMENTS_EQ_IMP_SET_EQ 2) THEN + ASM_REWRITE_TAC[Hypermap.POWER; Hypermap.POWER_1; I_THM]; + SUBGOAL_THEN `f (f x) = (f POWER 2) (x:A)` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[Hypermap.POWER_2; o_THM]; + ALL_TAC + ] THEN + FIRST_ASSUM (fun th -> REWRITE_TAC[GSYM th]) THEN + MATCH_MP_TAC Hypermap.lemma_cycle_orbit THEN + EXISTS_TAC `s:A->bool` THEN + ASM_REWRITE_TAC[] + ]);; + + + +let ORBIT_MAP_INV_3 = prove(`!s f (x:A). FINITE s /\ f permutes s /\ CARD (orbit_map f x) = 3 + ==> f x = inverse f (inverse f x) /\ + f (f x) = inverse f x /\ + inverse f (inverse f (inverse f x)) = x`, + REPEAT STRIP_TAC THENL + [ + SUBGOAL_THEN `inverse f (inverse f x) = (inverse f POWER 2) (x:A)` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[Hypermap.POWER_2; o_THM]; + ALL_TAC + ] THEN + SUBGOAL_THEN `f (x:A) = (f POWER (3 - 2)) x` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[ARITH_RULE `3 - 2 = 1`; Hypermap.POWER_1]; + ALL_TAC + ] THEN + MATCH_MP_TAC (GSYM FINITE_ORBIT_MAP_INVERSE) THEN + EXISTS_TAC `s:A->bool` THEN + ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]; + SUBGOAL_THEN `f (f x) = (f POWER (3 - 1)) (x:A) /\ inverse f x = (inverse f POWER 1) x` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; Hypermap.POWER_2; Hypermap.POWER_1; o_THM]; + ALL_TAC + ] THEN + MATCH_MP_TAC (GSYM FINITE_ORBIT_MAP_INVERSE) THEN + EXISTS_TAC `s:A->bool` THEN + ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]; + POP_ASSUM MP_TAC THEN + MP_TAC (SPECL [`s:A->bool`; `f:A->A`; `x:A`] Hypermap.lemma_orbit_inverse_map_eq) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + DISCH_TAC THEN + SUBGOAL_THEN `inverse f (inverse f (inverse f x)) = (inverse f POWER 3) (x:A)` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[ARITH_RULE `3 = SUC 2`; Hypermap.POWER; Hypermap.POWER_2; o_THM]; + ALL_TAC + ] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC Hypermap.lemma_cycle_orbit THEN + EXISTS_TAC `s:A->bool` THEN ASM_SIMP_TAC[PERMUTES_INVERSE] + ]);; + + +let ORBIT_MAP_INV_3_SET = prove(`!s f (x:A). FINITE s /\ f permutes s /\ CARD (orbit_map f x) = 3 + ==> orbit_map f x = {x, inverse f (inverse f x), inverse f x}`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + FIRST_ASSUM (MP_TAC o MATCH_MP ORBIT_MAP_3) THEN + FIRST_ASSUM (MP_TAC o MATCH_MP ORBIT_MAP_INV_3) THEN + SIMP_TAC[]);; + + + +let ORBIT_MAP_INV_2 = prove(`!s f (x:A). FINITE s /\ f permutes s /\ CARD (orbit_map f x) = 2 + ==> f x = inverse f x /\ + inverse f (inverse f x) = x`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + SUBGOAL_THEN `(f:A->A) x = inverse f x` ASSUME_TAC THENL + [ + SUBGOAL_THEN `(f:A->A) x = (f POWER (2 - 1)) x /\ inverse f x = (inverse f POWER 1) x` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[ARITH_RULE `2 - 1 = 1`; Hypermap.POWER_1]; + ALL_TAC + ] THEN + FIRST_ASSUM (fun th -> REWRITE_TAC[GSYM th]) THEN + MATCH_MP_TAC (GSYM FINITE_ORBIT_MAP_INVERSE) THEN + EXISTS_TAC `s:A->bool` THEN ASM_REWRITE_TAC[ARITH_RULE `1 <= 2`]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + MP_TAC (ISPECL [`f:A->A`; `s:A->bool`] PERMUTES_INVERSES) THEN + ASM_SIMP_TAC[]);; + + +let ORBIT_MAP_INV_2_SET = prove(`!s f (x:A). FINITE s /\ f permutes s /\ CARD (orbit_map f x) = 2 + ==> orbit_map f x = {x, inverse f x}`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + FIRST_ASSUM (MP_TAC o MATCH_MP ORBIT_MAP_2) THEN + FIRST_ASSUM (MP_TAC o MATCH_MP ORBIT_MAP_INV_2) THEN + SIMP_TAC[]);; + + + + +(* Properties of faces *) + +let FAN_PAIR_FIXED_POINT = prove(`!V x. x IN {v,v | v IN V /\ set_of_edge v V E = {}} ==> n_fan_pair_ext (V,E) x = x /\ f_fan_pair (V,E) x = x`, + REPEAT GEN_TAC THEN + REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN + ASM_REWRITE_TAC[n_fan_pair_ext; f_fan_pair; PAIR_EQ; inverse_sigma_fan; Fan_misc.EXTENSION_SIGMA_FAN_EQ_RES] THEN + REWRITE_TAC[RES_EMPTY; INVERSE_I; I_THM] THEN + COND_CASES_TAC THEN REWRITE_TAC[PAIR_EQ] THEN + SUBGOAL_THEN `v:real^3 IN set_of_edge v V E` (fun th -> ASM SET_TAC[th]) THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[dart1_of_fan; Fan.set_of_edge; IN_ELIM_THM; PAIR_EQ] THEN + STRIP_TAC THEN + ASM_MESON_TAC[]);; + + + + + +let CARD_FACE_GT_1 = prove(`!V E x. FAN (vec 0,V,E) /\ CARD (face (hypermap_of_fan (V,E)) x) > 1 + ==> x IN dart1_of_fan (V, E)`, + REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + REWRITE_TAC[Hypermap.face; Hypermap.face_map] THEN + ASM_SIMP_TAC[HYPERMAP_OF_FAN] THEN + DISJ_CASES_TAC (TAUT `x IN dart1_of_fan (V:real^3->bool,E) \/ ~(x IN dart1_of_fan (V,E))`) THENL + [ + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `orbit_map (f_fan_pair_ext (V:real^3->bool,E)) x = {x}` MP_TAC THENL + [ + ONCE_REWRITE_TAC[GSYM Hypermap.orbit_one_point] THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `v:real^3` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `w:real^3` ASSUME_TAC) THEN + ASM_REWRITE_TAC[f_fan_pair_ext]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[Hypermap.CARD_SINGLETON; ARITH_RULE `~(1 > 1)`]);; + + + + + +let LINEAR_FACE = prove(`!V E v w. FAN (vec 0,V,E) /\ CARD (face (hypermap_of_fan (V,E)) (v,w)) = 2 + ==> face (hypermap_of_fan (V,E)) (v,w) = {(v,w), (w,v)}`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `(v:real^3,w:real^3)`] CARD_FACE_GT_1) THEN + ASM_REWRITE_TAC[ARITH_RULE `2 > 1`] THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[Hypermap.face; Hypermap.face_map] THEN + ASM_SIMP_TAC[HYPERMAP_OF_FAN] THEN + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`dart_of_fan (V:real^3->bool,E)`; `f_fan_pair_ext (V:real^3->bool,E)`; `(v:real^3,w:real^3)`] ORBIT_MAP_INV_2_SET) THEN + ASM_SIMP_TAC[ISPEC `vec 0:real^3` FINITE_DART_OF_FAN; F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN] THEN + ASM_SIMP_TAC[INVERSE_F_FAN_PAIR_EXT_EXPLICIT; Sphere.res] THEN + MP_TAC (ISPECL [`dart_of_fan (V:real^3->bool,E)`; `f_fan_pair_ext (V:real^3->bool,E)`; `v:real^3,w:real^3`] ORBIT_MAP_2) THEN + ASM_SIMP_TAC[ISPEC `vec 0:real^3` FINITE_DART_OF_FAN; F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN] THEN + ASM_SIMP_TAC[f_fan_pair_ext; Sphere.res; f_fan_pair] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + DISCH_THEN (MP_TAC o (fun th -> MATCH_MP (SET_RULE `{a,b} = {a,c} ==> c = a \/ c = b`) th)) THEN + STRIP_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REWRITE_TAC[PAIR_EQ] THEN + DISCH_THEN (CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN ASM_REWRITE_TAC[] THEN + SIMP_TAC[]; + POP_ASSUM MP_TAC THEN + REWRITE_TAC[PAIR_EQ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) + ]);; + + + +let LINEAR_FACE_2 = prove(`!V E v w. FAN (vec 0,V,E) /\ CARD (face (hypermap_of_fan (V,E)) (v,w)) = 2 + ==> f_fan_pair_ext (V,E) (v,w) = (w,v)`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + FIRST_ASSUM (MP_TAC o (fun th -> MATCH_MP LINEAR_FACE th)) THEN + POP_ASSUM (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + ASM_SIMP_TAC[Hypermap.face; Hypermap.face_map; HYPERMAP_OF_FAN] THEN + ABBREV_TAC `f = f_fan_pair_ext (V:real^3->bool,E)` THEN + MP_TAC (ISPECL [`f:real^3#real^3->real^3#real^3`; `v:real^3,w:real^3`] Hypermap.in_orbit_map1) THEN + REPEAT DISCH_TAC THEN + SUBGOAL_THEN `f (v:real^3,w:real^3) = w,v \/ f (v,w) = v,w` MP_TAC THENL + [ + ASM SET_TAC[]; + ALL_TAC + ] THEN + STRIP_TAC THEN + POP_ASSUM (MP_TAC o (fun th -> ONCE_REWRITE_RULE[Hypermap.orbit_one_point] th)) THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[IMP_IMP] THEN DISCH_THEN (CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN + ASM_REWRITE_TAC[Hypermap.CARD_SINGLETON; ARITH_RULE `~(1 = 2)`]);; + + + + +let TRIANGULAR_FACE = prove(`!V E v w. FAN (vec 0,V,E) /\ (v,w) IN dart1_of_fan (V,E) /\ + CARD (face (hypermap_of_fan (V,E)) (v,w)) = 3 + ==> let w' = sigma_fan (vec 0) V E v w in + face (hypermap_of_fan (V,E)) (v,w) = {(v,w), (w,w'), (w',v)} /\ + sigma_fan (vec 0) V E w w' = v /\ + sigma_fan (vec 0) V E w' v = w`, + REPEAT GEN_TAC THEN + REPLICATE_TAC 2 (DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3,w:real^3`] FACE_SUBSET_DART1_OF_FAN) THEN + ASM_SIMP_TAC[Hypermap.face; Hypermap.face_map; HYPERMAP_OF_FAN] THEN + ASM_REWRITE_TAC[SUBSET] THEN REPEAT STRIP_TAC THEN + CONV_TAC let_CONV THEN + ABBREV_TAC `w' = sigma_fan (vec 0) V E v w` THEN + ABBREV_TAC `f = f_fan_pair_ext (V,E)` THEN + MP_TAC (ISPECL [`dart_of_fan (V:real^3->bool,E)`; `f_fan_pair_ext (V,E)`; `v:real^3,w:real^3`] ORBIT_MAP_3) THEN + ASM_SIMP_TAC[F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN; SPEC `vec 0:real^3` FINITE_DART_OF_FAN] THEN + DISCH_TAC THEN + SUBGOAL_THEN `f (v:real^3,w:real^3) IN dart1_of_fan (V:real^3->bool,E) /\ f (f (v,w)) IN dart1_of_fan (V,E)` ASSUME_TAC THENL + [ + CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[IN_INSERT]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`dart_of_fan (V:real^3->bool,E)`; `f_fan_pair_ext (V,E)`; `v:real^3,w:real^3`] ORBIT_MAP_INV_3) THEN + FIRST_X_ASSUM (MP_TAC o check (fun th -> rand (concl th) = `3`)) THEN + ASM_SIMP_TAC[F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN; SPEC `vec 0:real^3` FINITE_DART_OF_FAN] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN STRIP_TAC THEN REMOVE_ASSUM THEN + SUBGOAL_THEN `inverse f (v:real^3,w:real^3) = (w':real^3,v:real^3)` ASSUME_TAC THENL + [ + EXPAND_TAC "f" THEN + ASM_SIMP_TAC[INVERSE_F_FAN_PAIR_EXT_EXPLICIT] THEN + ASM_REWRITE_TAC[Sphere.res]; + ALL_TAC + ] THEN + SUBGOAL_THEN `w',v IN dart1_of_fan (V:real^3->bool,E)` MP_TAC THENL + [ + REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o CONJUNCT1 o check (is_conj o concl)) THEN + FIRST_X_ASSUM (MP_TAC o check (fun th -> concl th = `f (v:real^3,w:real^3) = inverse f (inverse f (v,w))`)) THEN + FIRST_ASSUM (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[IMP_IMP] THEN DISCH_THEN (CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN + EXPAND_TAC "f" THEN + ASM_SIMP_TAC[f_fan_pair_ext; INVERSE_F_FAN_PAIR_EXT_EXPLICIT; Sphere.res] THEN + REWRITE_TAC[f_fan_pair; PAIR_EQ] THEN + DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + FIRST_X_ASSUM (CONJUNCTS_THEN2 (ASSUME_TAC o SYM) ASSUME_TAC) THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o AP_TERM `extension_sigma_fan (vec 0) V E w`) THEN + MP_TAC (SPECL [`vec 0:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `w:real^3`] INVERSE_SIGMA_FAN) THEN + ASM_REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[extension_sigma_fan; IMP_IMP] THEN + DISCH_THEN (CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `w:real^3`; `w':real^3`] PAIR_IN_DART1_OF_FAN) THEN + ASM_SIMP_TAC[]);; + + + + + + +let IN_FACE_IMP_IN_DART1_OF_FAN = prove(`!V E x y. FAN (vec 0,V,E) /\ x IN dart1_of_fan (V,E) + /\ y IN face (hypermap_of_fan (V,E)) x + ==> y IN dart1_of_fan (V,E)`, + REPEAT GEN_TAC THEN + DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + REWRITE_TAC[Hypermap.face; Hypermap.face_map] THEN + ASM_SIMP_TAC[HYPERMAP_OF_FAN] THEN + STRIP_TAC THEN + MP_TAC (ISPECL [`dart1_of_fan (V:real^3->bool,E)`; `f_fan_pair_ext ((V:real^3->bool),E)`] Hypermap.orbit_subset) THEN + ASM_SIMP_TAC[F_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN] THEN + ASM_MESON_TAC[SUBSET]);; + + + + + +let FACE_LAST_POINT = prove(`!V E v w. FAN (vec 0,V,E) /\ (v,w) IN dart1_of_fan (V,E) + ==> (let w' = sigma_fan (vec 0) V E v w in + (w',v) IN face (hypermap_of_fan (V,E)) (v,w))`, + REPEAT STRIP_TAC THEN + CONV_TAC let_CONV THEN ABBREV_TAC `w' = sigma_fan (vec 0:real^3) V E v w` THEN + REWRITE_TAC[Hypermap.face; Hypermap.face_map] THEN + ASM_SIMP_TAC[HYPERMAP_OF_FAN] THEN + SUBGOAL_THEN `w',v = inverse (f_fan_pair_ext (V:real^3->bool,E)) (v,w)` ASSUME_TAC THENL + [ + ASM_SIMP_TAC[INVERSE_F_FAN_PAIR_EXT_EXPLICIT] THEN + ASM_REWRITE_TAC[Sphere.res]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC Hypermap.lemma_inverse_in_orbit THEN + EXISTS_TAC `dart_of_fan (V:real^3->bool,E)` THEN + ASM_SIMP_TAC[SPEC `vec 0:real^3` FINITE_DART_OF_FAN; F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN]);; + + + + + +let IN_DART1_OF_FAN_IMP_CARD_FACE_GT_1 = prove(`!V E x. FAN (vec 0,V,E) /\ x IN dart1_of_fan (V,E) + ==> CARD (face (hypermap_of_fan (V,E)) x) > 1`, + REPEAT GEN_TAC THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `v:real^3` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `w:real^3` ASSUME_TAC) THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + MP_TAC (ISPECL [`hypermap_of_fan (V:real^3->bool,E)`; `v:real^3,w:real^3`] Hypermap.FACE_FINITE) THEN + FIRST_ASSUM (MP_TAC o (fun th -> MATCH_MP (let_RULE FACE_LAST_POINT) th)) THEN + ABBREV_TAC `w':real^3 = sigma_fan (vec 0) V E v w` THEN + MP_TAC (ISPECL [`hypermap_of_fan (V:real^3->bool,E)`; `v:real^3,w:real^3`] Hypermap.face_refl) THEN + ABBREV_TAC `s = face (hypermap_of_fan (V:real^3->bool,E)) (v,w)` THEN + ASM_REWRITE_TAC[] THEN REPEAT DISCH_TAC THEN + MATCH_MP_TAC (ARITH_RULE `~(a = 0 \/ a = 1) ==> a > 1`) THEN + STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM HAS_SIZE] THENL + [ + ASM_MESON_TAC[HAS_SIZE_0; NOT_IN_EMPTY]; + ALL_TAC + ] THEN + REWRITE_TAC[HAS_SIZE_1_EXISTS] THEN + REWRITE_TAC[EXISTS_UNIQUE; NOT_EXISTS_THM; DE_MORGAN_THM] THEN + GEN_TAC THEN DISJ2_TAC THEN + DISJ_CASES_TAC (TAUT `(x' = v:real^3,w:real^3) \/ ~(x' = v,w)`) THENL + [ + REWRITE_TAC[NOT_FORALL_THM] THEN + EXISTS_TAC `w':real^3,v:real^3` THEN + ASM_REWRITE_TAC[PAIR_EQ] THEN + ASM_MESON_TAC[PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ]; + ASM_MESON_TAC[] + ]);; + + + + +(* AAUHTVE lemmas for new definitions *) +let PLAIN_HYPERMAP_OF_FAN = prove(`!V E. FAN (vec 0,V,E) ==> plain_hypermap (hypermap_of_fan (V,E))`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[Hypermap.plain_hypermap; Hypermap.edge_map] THEN + ASM_SIMP_TAC[HYPERMAP_OF_FAN] THEN + REWRITE_TAC[FUN_EQ_THM; I_THM; o_THM; e_fan_pair_ext] THEN + GEN_TAC THEN + DISJ_CASES_TAC (TAUT `~(x IN dart1_of_fan (V:real^3->bool,E)) \/ x IN dart1_of_fan (V,E)`) THENL + [ + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[E_N_F_IN_DART1_OF_FAN] THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[e_fan_pair]);; + + +let E_HAS_NO_FIXED_POINTS_IN_D1 = prove(`!(V:real^3->bool) E x. FAN (vec 0,V,E) /\ x IN dart1_of_fan (V,E) + ==> ~(e_fan_pair (V,E) x = x)`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + REWRITE_TAC[e_fan_pair; PAIR_EQ] THEN + MP_TAC (ISPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`;`x':real^3`;`y:real^3`] PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ) THEN + ASM_SIMP_TAC[]);; + + +let F_HAS_NO_FIXED_POINTS_IN_D1 = prove(`!(V:real^3->bool) E x. FAN (vec 0,V,E) /\ x IN dart1_of_fan (V,E) + ==> ~(f_fan_pair (V,E) x = x)`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[f_fan_pair; PAIR_EQ] THEN + DISCH_TAC THEN + ASM_MESON_TAC[PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ]);; + + + +let UNIQUE_ORBIT = prove(`!s f (x:A). FINITE s /\ f permutes s /\ x IN s ==> ?!c. c IN set_of_orbits s f /\ x IN c`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[EXISTS_UNIQUE; Hypermap.set_of_orbits; IN_ELIM_THM] THEN + EXISTS_TAC `orbit_map (f:A->A) x` THEN + CONJ_TAC THENL + [ + REWRITE_TAC[Hypermap.orbit_reflect] THEN + EXISTS_TAC `x:A` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + GEN_TAC THEN STRIP_TAC THEN + MP_TAC (SPECL [`s:A->bool`; `f:A->A`] Hypermap.partition_orbit) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPECL [`x:A`; `x':A`]) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + DISCH_TAC THEN + SUBGOAL_THEN `x IN orbit_map (f:A->A) x INTER y` MP_TAC THENL + [ + ASM_REWRITE_TAC[IN_INTER; Hypermap.orbit_reflect]; + SET_TAC[] + ]);; + + + + +let DART_IN_UNIQUE_NODE = prove(`!V E x. FAN (vec 0,V,E) /\ x IN dart_of_fan (V,E) + ==> ?!n. n IN node_set (hypermap_of_fan (V,E)) /\ x IN n`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[Hypermap.node_set; Hypermap.node_map; Hypermap.dart] THEN + ASM_SIMP_TAC[HYPERMAP_OF_FAN] THEN + MATCH_MP_TAC UNIQUE_ORBIT THEN + ASM_SIMP_TAC[SPEC `vec 0:real^3` FINITE_DART_OF_FAN; N_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN]);; + + + +let DART_IN_UNIQUE_FACE = prove(`!V E x. FAN (vec 0,V,E) /\ x IN dart_of_fan (V,E) + ==> ?!f. f IN face_set (hypermap_of_fan (V,E)) /\ x IN f`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[Hypermap.face_set; Hypermap.face_map; Hypermap.dart] THEN + ASM_SIMP_TAC[HYPERMAP_OF_FAN] THEN + MATCH_MP_TAC UNIQUE_ORBIT THEN + ASM_SIMP_TAC[SPEC `vec 0:real^3` FINITE_DART_OF_FAN; F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN]);; + + + + +let DART_IN_UNIQUE_EDGE = prove(`!V E x. FAN (vec 0,V,E) /\ x IN dart_of_fan (V,E) + ==> ?!e. e IN edge_set (hypermap_of_fan (V,E)) /\ x IN e`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[Hypermap.edge_set; Hypermap.edge_map; Hypermap.dart] THEN + ASM_SIMP_TAC[HYPERMAP_OF_FAN] THEN + MATCH_MP_TAC UNIQUE_ORBIT THEN + ASM_SIMP_TAC[SPEC `vec 0:real^3` FINITE_DART_OF_FAN; E_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN]);; + + + +let EDGE_HYPERMAP_OF_FAN = prove(`!V E v w. FAN (vec 0,V,E) /\ (v,w) IN dart1_of_fan (V,E) + ==> edge (hypermap_of_fan (V,E)) (v,w) = {(v,w), (w,v)}`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`] PLAIN_HYPERMAP_OF_FAN) THEN + ASM_REWRITE_TAC[Hypermap.edge; Hypermap.edge_map; Hypermap.plain_hypermap] THEN + ASM_SIMP_TAC[HYPERMAP_OF_FAN] THEN + DISCH_TAC THEN + MP_TAC (ISPECL [`e_fan_pair_ext (V:real^3->bool,E)`] Hypermap.lemma_orbit_convolution_map) THEN + ASM_SIMP_TAC[e_fan_pair_ext; e_fan_pair]);; + + + +let N_FAN_PAIR_EXT_IN_DART1_OF_FAN = prove(`!V E v w. FAN (vec 0,V,E) /\ (v,w) IN dart1_of_fan (V,E) + ==> orbit_map (n_fan_pair_ext (V,E)) (v,w) SUBSET dart1_of_fan (V,E)`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`] N_FAN_PAIR_EXT_PERMUTES_DART1_OF_FAN) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o (fun th -> MATCH_MP Hypermap.orbit_subset th)) THEN + DISCH_THEN (MP_TAC o SPEC `v:real^3,w:real^3`) THEN + ASM_REWRITE_TAC[]);; + + + +let N_FAN_PAIR_EXT_POWER = prove(`!V E v w n. FAN (vec 0,V,E) /\ (v,w) IN dart1_of_fan (V,E) + ==> (n_fan_pair_ext (V,E) POWER n) (v,w) = + (v, ((sigma_fan (vec 0) V E v) POWER n) w)`, + REPEAT STRIP_TAC THEN + SPEC_TAC (`n:num`,`n:num`) THEN + INDUCT_TAC THEN REWRITE_TAC[Hypermap.POWER; I_THM] THEN + REWRITE_TAC[GSYM Hypermap.POWER; ARITH_RULE `SUC n = 1 + n`] THEN + REWRITE_TAC[Hypermap.addition_exponents] THEN + ASM_REWRITE_TAC[o_THM; Hypermap.POWER_1] THEN + REWRITE_TAC[n_fan_pair_ext] THEN + SUBGOAL_THEN `v,(sigma_fan (vec 0) V E v POWER n) w IN dart1_of_fan (V:real^3->bool,E)` ASSUME_TAC THENL + [ + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`] N_FAN_PAIR_EXT_IN_DART1_OF_FAN) THEN + ASM_REWRITE_TAC[SUBSET] THEN + DISCH_THEN (MP_TAC o SPEC `(n_fan_pair_ext (V:real^3->bool,E) POWER n) (v,w)`) THEN + ANTS_TAC THEN SIMP_TAC[] THEN + REWRITE_TAC[Hypermap.orbit_map; IN_ELIM_THM] THEN + EXISTS_TAC `n:num` THEN + REWRITE_TAC[ARITH_RULE `n >= 0`]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[n_fan_pair]);; + + + + +let NODE_HYPERMAP_OF_FAN = prove(`!V E v w. FAN (vec 0,V,E) /\ (v,w) IN dart1_of_fan (V,E) ==> + node (hypermap_of_fan (V,E)) (v,w) = + {(v, (sigma_fan (vec 0) V E v POWER k) w) | k >= 0}`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[Hypermap.node; Hypermap.node_map] THEN + ASM_SIMP_TAC[HYPERMAP_OF_FAN; Hypermap.orbit_map; N_FAN_PAIR_EXT_POWER]);; + + + +(* Alternative form of the node (hypermap_of_fan (V,E)) (v,w) *) + +let SIGMA_FAN_POWER = prove(`!V E v u i. power_map_points sigma_fan (vec 0) V E v u i = + (sigma_fan (vec 0) V E v POWER i) u`, + REPLICATE_TAC 4 GEN_TAC THEN + INDUCT_TAC THENL + [ + REWRITE_TAC[Hypermap.POWER; Fan.power_map_points; I_THM]; + ALL_TAC + ] THEN + REWRITE_TAC[Fan.power_map_points] THEN + REWRITE_TAC[ARITH_RULE `SUC i = 1 + i`; Hypermap.addition_exponents] THEN + ASM_REWRITE_TAC[Hypermap.POWER_1; o_THM]);; + + +let NODE_HYPERMAP_OF_FAN_lemma = prove(`!V E v u. FAN (vec 0,V,E) /\ (v,u) IN dart1_of_fan (V,E) + ==> node (hypermap_of_fan (V,E)) (v,u) = + {(v, power_map_points sigma_fan (vec 0) V E v u i) | 0 <= i }`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[Hypermap.node; Hypermap.node_map] THEN + ASM_SIMP_TAC[HYPERMAP_OF_FAN] THEN + REWRITE_TAC[Hypermap.orbit_map] THEN + ASM_SIMP_TAC[N_FAN_PAIR_EXT_POWER; SIGMA_FAN_POWER] THEN + SET_TAC[ARITH_RULE `!n. n >= 0 <=> 0 <= n`]);; + + + +let NODE_HYPERMAP_OF_FAN_ALT = prove(`!V E v w. FAN (vec 0,V,E) /\ (v,w) IN dart1_of_fan (V,E) + ==> node (hypermap_of_fan (V,E)) (v,w) = {(v,u) | u | u IN set_of_edge v V E}`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[NODE_HYPERMAP_OF_FAN_lemma] THEN + SUBGOAL_THEN `{v:real^3,w} IN E` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[dart1_of_fan] THEN + REWRITE_TAC[IN_ELIM_THM; PAIR_EQ] THEN + SET_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`vec 0:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`] Topology.ORBITS_EQ_SET_EDGE_FAN) THEN + ASM_REWRITE_TAC[Topology.set_of_orbits_points_fan] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + SET_TAC[]);; + + +(* CARD (node (v,w)) = CARD(set_of_edge v) *) +let CARD_NODE_HYPERMAP_OF_FAN = prove(`!V E v w. FAN (vec 0,V,E) /\ (v,w) IN dart1_of_fan (V,E) + ==> CARD (node (hypermap_of_fan (V,E)) (v,w)) = CARD (set_of_edge v V E)`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL NODE_HYPERMAP_OF_FAN_ALT) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[IMAGE_LEMMA] THEN + MATCH_MP_TAC CARD_IMAGE_INJ THEN + ASM_SIMP_TAC[SPEC `vec 0:real^3` Fan.remark1_fan; PAIR_EQ]);; + + +(* FST x is a bijection between V and node_set *) + +let HYPERMAP_OF_FAN_NODE_EQ = prove(`!V E x y. FAN (vec 0,V,E) /\ + x IN dart_of_fan (V,E) /\ y IN dart_of_fan (V,E) /\ FST x = FST y + ==> node (hypermap_of_fan (V,E)) x = node (hypermap_of_fan (V,E)) y`, + REPEAT GEN_TAC THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + MP_TAC (ISPEC `y:real^3#real^3` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `v':real^3` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `u:real^3` ASSUME_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `v:real^3` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `w:real^3` ASSUME_TAC) THEN + ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN + POP_ASSUM (ASSUME_TAC o (fun th -> ONCE_REWRITE_RULE[EQ_SYM_EQ] th)) THEN + FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl)) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + + DISJ_CASES_TAC (TAUT `(v:real^3,w:real^3) IN dart1_of_fan (V,E) \/ ~(v,w IN dart1_of_fan (V,E))`) THENL + [ + MP_TAC (SPEC_ALL PAIR_IN_DART1_OF_FAN) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + SUBGOAL_THEN `v:real^3,u:real^3 IN dart1_of_fan (V,E)` ASSUME_TAC THENL + [ + REPLICATE_TAC 2 (FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl))) THEN + REWRITE_TAC[dart_of_fan; GSYM dart1_of_fan; IN_UNION] THEN + STRIP_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REWRITE_TAC[IN_ELIM_THM; PAIR_EQ] THEN STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o check (is_conj o concl)) THEN + ASM_REWRITE_TAC[NOT_IN_EMPTY]; + ASM_SIMP_TAC[] + ]; + ALL_TAC + ] THEN + + MP_TAC (SPEC_ALL NODE_HYPERMAP_OF_FAN_ALT) THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `u:real^3`] NODE_HYPERMAP_OF_FAN_ALT) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + REPLICATE_TAC 2 (FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl))) THEN + ASM_REWRITE_TAC[dart_of_fan; GSYM dart1_of_fan; IN_UNION] THEN + REWRITE_TAC[IN_ELIM_THM; PAIR_EQ] THEN + REPEAT STRIP_TAC THENL + [ + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `u:real^3`] PAIR_IN_DART1_OF_FAN) THEN + ASM_REWRITE_TAC[NOT_IN_EMPTY]);; + + + +let FST_NODE_lemma = prove(`!V E n. FAN (vec 0,V,E) /\ n IN node_set (hypermap_of_fan (V,E)) + ==> !x y. x IN n /\ y IN n ==> FST x = FST y`, + REWRITE_TAC[Hypermap.node_set; Hypermap.set_of_orbits; GSYM Hypermap.node; IN_ELIM_THM] THEN + REPEAT GEN_TAC THEN STRIP_TAC THEN + ASM_CASES_TAC `x IN dart1_of_fan (V:real^3->bool,E)` THENL + [ + POP_ASSUM MP_TAC THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `v:real^3` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `w:real^3` ASSUME_TAC) THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + MP_TAC (SPEC_ALL NODE_HYPERMAP_OF_FAN) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[]; + MP_TAC (SPEC_ALL E_N_F_DEGENERATE_CASE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + SIMP_TAC[IN_SING] + ]);; + + + +let FAN_NODE_EQ_lemma = prove(`!V E x y. FAN (vec 0,V,E) /\ + node (hypermap_of_fan (V,E)) x = node (hypermap_of_fan (V,E)) y + ==> FST x = FST y`, + REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN + ASM_CASES_TAC `x IN dart1_of_fan (V:real^3->bool,E)` THENL + [ + POP_ASSUM MP_TAC THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `v:real^3` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `w:real^3` ASSUME_TAC) THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + MP_TAC (SPEC_ALL NODE_HYPERMAP_OF_FAN) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_TAC THEN + MP_TAC (ISPECL [`hypermap_of_fan (V,E)`; `y:real^3#real^3`] Hypermap.node_refl) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[IN_ELIM_THM] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `x:real^3#real^3`] E_N_F_DEGENERATE_CASE) THEN + ASM_SIMP_TAC[] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + DISCH_TAC THEN + SUBGOAL_THEN `y IN {x:real^3#real^3}` MP_TAC THENL + [ + ASM_REWRITE_TAC[Hypermap.node_refl]; + ALL_TAC + ] THEN + SIMP_TAC[IN_SING]);; + + + +(* node_set = IMAGE f V *) +let NODE_SET_AS_IMAGE = prove(`!V E. FAN (vec 0,V,E) ==> + ?f. (!v w. f v = f w ==> v = w) /\ + (!v x. x IN f v ==> FST x = v) /\ + (!v. FST (CHOICE (f v)) = v) /\ + node_set (hypermap_of_fan (V,E)) = IMAGE f V`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[Hypermap.node_set; Hypermap.set_of_orbits; GSYM Hypermap.node] THEN + EXISTS_TAC `(\v. node (hypermap_of_fan (V,E)) (if set_of_edge v V E = {} then (v,v) else (v, CHOICE (set_of_edge v V E))))` THEN + CONJ_TAC THENL + [ + BETA_TAC THEN + REPEAT GEN_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`] FAN_NODE_EQ_lemma) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> DISCH_THEN (fun th2 -> MP_TAC (MATCH_MP th th2))) THEN + ASM_CASES_TAC `set_of_edge (v:real^3) V E = {}` THEN ASM_REWRITE_TAC[] THENL + [ + ASM_CASES_TAC `set_of_edge (w:real^3) V E = {}` THEN ASM_REWRITE_TAC[]; + ASM_CASES_TAC `set_of_edge (w:real^3) V E = {}` THEN ASM_REWRITE_TAC[] + ]; + ALL_TAC + ] THEN + + BETA_TAC THEN + SUBGOAL_THEN `!v x. x IN node (hypermap_of_fan (V,E)) (if set_of_edge v V E = {} then v,v else v,CHOICE (set_of_edge v V E)) ==> FST x = v` ASSUME_TAC THENL + [ + REPEAT GEN_TAC THEN + DISCH_THEN (MP_TAC o (MATCH_MP Hypermap.lemma_node_identity)) THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`] FAN_NODE_EQ_lemma) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> DISCH_THEN (MP_TAC o (MATCH_MP th))) THEN + ASM_CASES_TAC `set_of_edge (v:real^3) V E = {}` THEN ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + GEN_TAC THEN + POP_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC CHOICE_DEF THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + EXISTS_TAC `if set_of_edge v V E = {} then v,v else v,CHOICE (set_of_edge (v:real^3) V E)` THEN + REWRITE_TAC[Hypermap.node_refl]; + ALL_TAC + ] THEN + REMOVE_ASSUM THEN + + ONCE_REWRITE_TAC[EXTENSION] THEN + X_GEN_TAC `n:real^3#real^3->bool` THEN + REWRITE_TAC[IN_ELIM_THM; IN_IMAGE] THEN + EQ_TAC THENL + [ + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN] THEN + DISCH_THEN (CHOOSE_THEN MP_TAC) THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `v:real^3` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `w:real^3` ASSUME_TAC) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + EXISTS_TAC `v:real^3` THEN + MP_TAC (SPEC_ALL PAIR_IN_DART_OF_FAN) THEN + ASM_SIMP_TAC[] THEN DISCH_TAC THEN + + MATCH_MP_TAC HYPERMAP_OF_FAN_NODE_EQ THEN + ASM_REWRITE_TAC[] THEN + ASM_CASES_TAC `set_of_edge (v:real^3) V E = {}` THEN ASM_REWRITE_TAC[] THENL + [ + SUBGOAL_THEN `~(v:real^3,w IN dart1_of_fan (V,E))` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN + MATCH_MP_TAC (TAUT `(A ==> ~B) ==> (B ==> ~A)`) THEN + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL PAIR_IN_DART1_OF_FAN) THEN + ASM_REWRITE_TAC[NOT_IN_EMPTY]; + ALL_TAC + ] THEN + + FIRST_ASSUM (MP_TAC o check (is_binary "IN" o concl)) THEN + GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [dart_of_fan] THEN + ASM_REWRITE_TAC[GSYM dart1_of_fan; IN_UNION] THEN + REWRITE_TAC[IN_ELIM_THM; PAIR_EQ] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + REPLICATE_TAC 2 (FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl))) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[dart_of_fan; IN_UNION; IN_ELIM_THM] THEN + DISJ2_TAC THEN + MAP_EVERY EXISTS_TAC [`v:real^3`; `CHOICE (set_of_edge (v:real^3) V E)`] THEN + REWRITE_TAC[] THEN + POP_ASSUM (MP_TAC o (MATCH_MP CHOICE_DEF)) THEN + SIMP_TAC[set_of_edge; IN_ELIM_THM]; + ALL_TAC + ] THEN + + DISCH_THEN (X_CHOOSE_THEN `v:real^3` MP_TAC) THEN + ASM_CASES_TAC `set_of_edge (v:real^3) V E = {}` THEN ASM_REWRITE_TAC[] THENL + [ + DISCH_TAC THEN + EXISTS_TAC `v:real^3,v` THEN + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN] THEN + REWRITE_TAC[dart_of_fan; IN_UNION] THEN + DISJ1_TAC THEN + REWRITE_TAC[IN_ELIM_THM] THEN + EXISTS_TAC `v:real^3` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_TAC THEN + EXISTS_TAC `v:real^3,CHOICE (set_of_edge v V E)` THEN + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN] THEN + REWRITE_TAC[dart_of_fan; IN_UNION] THEN + DISJ2_TAC THEN + REWRITE_TAC[IN_ELIM_THM] THEN + MAP_EVERY EXISTS_TAC [`v:real^3`; `CHOICE (set_of_edge (v:real^3) V E)`] THEN + REWRITE_TAC[] THEN + REMOVE_ASSUM THEN POP_ASSUM (MP_TAC o (MATCH_MP CHOICE_DEF)) THEN + SIMP_TAC[set_of_edge; IN_ELIM_THM]);; + + + +(* Results for simple hypermaps *) +let SIMPLE_HYPERMAP_IMP_FACE_INJ = prove(`!H (x:A) u v. simple_hypermap H /\ x IN dart H /\ + u IN node H x /\ v IN node H x /\ face H u = face H v + ==> u = v`, + REWRITE_TAC[Hypermap.simple_hypermap] THEN + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `!y. y IN node H (x:A) ==> y IN dart H` ASSUME_TAC THENL + [ + ASM_SIMP_TAC[GSYM SUBSET; Hypermap.lemma_node_subset]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `node H (u:A) = node H (x:A) /\ node H (v:A) = node H (x:A)` ASSUME_TAC THENL + [ + CONJ_TAC THEN MATCH_MP_TAC EQ_SYM THEN MATCH_MP_TAC Hypermap.lemma_node_identity THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + FIRST_ASSUM (MP_TAC o SPEC `v:A`) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `u:A`) THEN + ASM_REWRITE_TAC[] THEN + REPEAT DISCH_TAC THEN + FIRST_ASSUM (MP_TAC o SPEC `v:A`) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `u:A`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[Hypermap.SING_EQ]);; + + + +let SIMPLE_HYPERMAP_lemma = prove(`!H (x:A) P. simple_hypermap H /\ x IN dart H + ==> CARD {face H y | y | y IN dart H /\ P y /\ y IN node H x} + = CARD {y | y IN node H x /\ P y}`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `!y. y IN node H (x:A) ==> y IN dart H` ASSUME_TAC THENL + [ + ASM_SIMP_TAC[GSYM SUBSET; Hypermap.lemma_node_subset]; + ALL_TAC + ] THEN + + MATCH_MP_TAC CARD_IMAGE_INJ_EQ THEN + EXISTS_TAC `face (H:(A)hypermap)` THEN + REPEAT STRIP_TAC THENL + [ + MATCH_MP_TAC FINITE_SUBSET THEN + EXISTS_TAC `node (H:(A)hypermap) x` THEN + REWRITE_TAC[Hypermap.NODE_FINITE] THEN + SIMP_TAC[SUBSET; IN_ELIM_THM]; + + POP_ASSUM MP_TAC THEN + REWRITE_TAC[IN_ELIM_THM] THEN + DISCH_TAC THEN + EXISTS_TAC `x':A` THEN + ASM_SIMP_TAC[]; + + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN + REWRITE_TAC[IN_ELIM_THM] THEN + DISCH_THEN (X_CHOOSE_THEN `v:A` ASSUME_TAC) THEN + REWRITE_TAC[EXISTS_UNIQUE] THEN + EXISTS_TAC `v:A` THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM (CONJUNCTS_THEN2 ASSUME_TAC (fun th -> ALL_TAC)) THEN + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`H:(A)hypermap`; `x:A`; `y:A`; `v:A`] SIMPLE_HYPERMAP_IMP_FACE_INJ) THEN + ASM_SIMP_TAC[]);; + + + + +let HYPERMAP_OF_FAN_FACE_NODE_INJ = prove(`!V E f x y. FAN (vec 0,V,E) /\ simple_hypermap (hypermap_of_fan (V,E)) /\ + f IN face_set (hypermap_of_fan (V,E)) + /\ x IN f /\ y IN f /\ FST x = FST y ==> x = y`, + REPEAT GEN_TAC THEN + REWRITE_TAC[Hypermap.face_set; Hypermap.set_of_orbits; GSYM Hypermap.face; IN_ELIM_THM] THEN + DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN] THEN + REPEAT STRIP_TAC THEN REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC SIMPLE_HYPERMAP_IMP_FACE_INJ THEN + MAP_EVERY EXISTS_TAC [`hypermap_of_fan (V,E)`; `x:real^3#real^3`] THEN + ASM_REWRITE_TAC[Hypermap.node_refl] THEN + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN] THEN + + SUBGOAL_THEN `x IN dart_of_fan (V:real^3->bool,E) /\ y IN dart_of_fan (V,E)` ASSUME_TAC THENL + [ + CONJ_TAC THEN MATCH_MP_TAC Hypermap.lemma_in_subset THEN + EXISTS_TAC `face (hypermap_of_fan (V,E)) x'` THEN + ASM_SIMP_TAC[FACE_SUBSET_DART_OF_FAN]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `node (hypermap_of_fan (V,E)) x = node (hypermap_of_fan (V,E)) y` (fun th -> ASM_REWRITE_TAC[th; Hypermap.node_refl]) THENL + [ + MATCH_MP_TAC HYPERMAP_OF_FAN_NODE_EQ THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC Hypermap.lemma_face_identity THEN + SUBGOAL_THEN `face (hypermap_of_fan (V,E)) x = face (hypermap_of_fan (V,E)) x'` (fun th -> ASM_REWRITE_TAC[th]) THEN + MATCH_MP_TAC (GSYM Hypermap.lemma_face_identity) THEN + ASM_REWRITE_TAC[]);; + + + + +(* ULEKUUB for hypermap_of_fan: preliminaries *) + +let NODE_HYPERMAP_OF_FAN_POWER_MAP_POINTS = prove(`!V E v u. FAN (vec 0,V,E) /\ (v,u) IN dart1_of_fan (V,E) + ==> node (hypermap_of_fan (V,E)) (v,u) = + {(v, power_map_points sigma_fan (vec 0) V E v u i) | i | i < CARD (set_of_edge v V E) }`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `u:real^3`] CARD_NODE_HYPERMAP_OF_FAN) THEN + ASM_SIMP_TAC[NODE_HYPERMAP_OF_FAN_lemma; SIGMA_FAN_POWER; GSYM N_FAN_PAIR_EXT_POWER] THEN + REWRITE_TAC[ARITH_RULE `0 <= i <=> i >= 0`; GSYM Hypermap.orbit_map] THEN + ABBREV_TAC `n = CARD (set_of_edge (v:real^3) V E)` THEN + DISCH_TAC THEN + MATCH_MP_TAC FINITE_ORBIT_MAP THEN + EXISTS_TAC `dart_of_fan (V:real^3->bool,E)` THEN + ASM_SIMP_TAC[ISPEC `vec 0:real^3` FINITE_DART_OF_FAN; N_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN]);; + + +let AZIM_I_FAN_EQ_AZIM_DART = prove(`!V E v u i. FAN (vec 0,V,E) /\ (v,u) IN dart1_of_fan (V,E) + /\ CARD (set_of_edge v V E) > 1 + ==> azim_i_fan (vec 0) V E v u i = + azim_dart (V,E) (v, power_map_points sigma_fan (vec 0) V E v u i)`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `u:real^3`] PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + REWRITE_TAC[azim_dart] THEN + DISJ_CASES_TAC (ARITH_RULE `i = 0 \/ 0 < i`) THENL + [ + ASM_REWRITE_TAC[Topology.azim_i_fan; Fan.power_map_points; Topology.azim_fan]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `~(v:real^3 = power_map_points sigma_fan (vec 0) V E v u i)` ASSUME_TAC THENL + [ + SUBGOAL_THEN `(v:real^3,power_map_points sigma_fan (vec 0) V E v u i) IN dart1_of_fan (V,E)` MP_TAC THENL + [ + REWRITE_TAC[SIGMA_FAN_POWER] THEN + + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `u:real^3`] N_FAN_PAIR_EXT_IN_DART1_OF_FAN) THEN + ASM_REWRITE_TAC[SUBSET] THEN + DISCH_THEN (MP_TAC o SPEC `(n_fan_pair_ext (V:real^3->bool,E) POWER i) (v,u)`) THEN + ANTS_TAC THENL + [ + REWRITE_TAC[Hypermap.orbit_map; IN_ELIM_THM] THEN + EXISTS_TAC `i:num` THEN + ASM_SIMP_TAC[ARITH_RULE `0 < i ==> i >= 0`]; + ASM_SIMP_TAC[N_FAN_PAIR_EXT_POWER] + ]; + ALL_TAC + ] THEN + + ABBREV_TAC `w:real^3 = power_map_points sigma_fan (vec 0) V E v u i` THEN + DISCH_TAC THEN + MP_TAC (ISPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`] PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[Topology.azim_i_fan; Topology.azim_fan; Fan.power_map_points]);; + + + + +(* ULEKUUB for hypermap_of_fan *) +let SUM_lemma = prove(`!V E v u. FAN (vec 0,V,E) /\ (v,u) IN dart1_of_fan (V,E) /\ CARD (set_of_edge v V E) > 1 + ==> sum (0..CARD (set_of_edge v V E) - 1) (azim_i_fan (vec 0) V E v u) = + sum (node (hypermap_of_fan (V,E)) (v,u)) (azim_dart (V,E))`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `n = CARD (set_of_edge (v:real^3) V E)` THEN + SUBGOAL_THEN `node(hypermap_of_fan (V:real^3->bool,E)) (v,u) = IMAGE (\i:num. v,power_map_points sigma_fan (vec 0) V E v u i) (0..n-1)` MP_TAC THENL + [ + ASM_SIMP_TAC[NODE_HYPERMAP_OF_FAN_POWER_MAP_POINTS] THEN + REWRITE_TAC[EXTENSION; IN_IMAGE; IN_NUMSEG_0] THEN + ASM_SIMP_TAC[ARITH_RULE `n > 1 ==> (x <= n - 1 <=> x < n)`] THEN + SET_TAC[]; + ALL_TAC + ] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + ABBREV_TAC `f = (\i. v:real^3,power_map_points sigma_fan (vec 0) V E v u i)` THEN + + SUBGOAL_THEN `sum (IMAGE f (0..n-1)) (azim_dart (V:real^3->bool,E)) = sum(0..n-1) ((azim_dart (V,E)) o f)` MP_TAC THENL + [ + MATCH_MP_TAC SUM_IMAGE THEN + MATCH_MP_TAC IMAGE_IMP_INJECTIVE_GEN THEN + EXISTS_TAC `node (hypermap_of_fan (V:real^3->bool,E)) (v,u)` THEN + REWRITE_TAC[FINITE_NUMSEG; CARD_NUMSEG] THEN + ASM_SIMP_TAC[CARD_NODE_HYPERMAP_OF_FAN; ARITH_RULE `n > 1 ==> (n - 1 + 1) - 0 = n`]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + + SUBGOAL_THEN `azim_dart (V:real^3->bool,E) o f = azim_i_fan (vec 0) V E v u` (fun th -> REWRITE_TAC[th]) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[FUN_EQ_THM; o_THM] THEN + ASM_SIMP_TAC[AZIM_I_FAN_EQ_AZIM_DART]);; + + + +let SUM_AZIM_DART = prove(`!V E x. FAN (vec 0,V,E) /\ x IN dart_of_fan (V,E) + ==> sum (node (hypermap_of_fan (V,E)) x) (azim_dart (V,E)) = &2 * pi`, + REPEAT GEN_TAC THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `v:real^3` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `u:real^3` MP_TAC) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REPEAT STRIP_TAC THEN + + ASM_CASES_TAC `~(v:real^3,u IN dart1_of_fan (V,E))` THENL + [ + ASM_SIMP_TAC[E_N_F_DEGENERATE_CASE] THEN + REWRITE_TAC[SUM_SING] THEN + FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl)) THEN + REWRITE_TAC[dart_of_fan; GSYM dart1_of_fan] THEN + ASM_REWRITE_TAC[IN_UNION; IN_ELIM_THM; PAIR_EQ] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[azim_dart]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN REMOVE_ASSUM THEN + REWRITE_TAC[NOT_CLAUSES] THEN DISCH_TAC THEN + + SUBGOAL_THEN `{v:real^3,u} IN E` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REWRITE_TAC[dart1_of_fan; IN_ELIM_THM; PAIR_EQ] THEN + SET_TAC[]; + ALL_TAC + ] THEN + + ABBREV_TAC `n = CARD (set_of_edge (v:real^3) V E)` THEN + DISJ_CASES_TAC (ARITH_RULE `n = 0 \/ n = 1 \/ n > 1`) THENL + [ + SUBGOAL_THEN `set_of_edge (v:real^3) V E = {}` MP_TAC THENL + [ + ASM_REWRITE_TAC[GSYM HAS_SIZE_0; HAS_SIZE] THEN + MATCH_MP_TAC Fan.remark_finite_fan1 THEN + ASM_MESON_TAC[Fan.FAN; Fan.fan1]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `u:real^3 IN set_of_edge v V E` MP_TAC THENL + [ + ASM_MESON_TAC[Fan_misc.FAN_IN_SET_OF_EDGE]; + ALL_TAC + ] THEN + MESON_TAC[NOT_IN_EMPTY]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN STRIP_TAC THENL + [ + SUBGOAL_THEN `node (hypermap_of_fan (V:real^3->bool,E)) (v,u) = {(v,u)}` MP_TAC THENL + [ + ASM_SIMP_TAC[NODE_HYPERMAP_OF_FAN_POWER_MAP_POINTS] THEN + REWRITE_TAC[ARITH_RULE `i < 1 <=> i = 0`] THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_SING] THEN + GEN_TAC THEN + MESON_TAC[Fan.power_map_points]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[SUM_SING] THEN + ASM_REWRITE_TAC[azim_dart; Topology.azim_fan; ARITH_RULE `~(1 > 1)`] THEN + MESON_TAC[]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN EXPAND_TAC "n" THEN + REMOVE_ASSUM THEN DISCH_TAC THEN + + ASM_SIMP_TAC[GSYM SUM_lemma] THEN + MATCH_MP_TAC Topology.SUM_AZIMS_EQ_2PI_FAN THEN + ASM_SIMP_TAC[ARITH_RULE `a > 1 ==> 1 < a`] THEN + POP_ASSUM MP_TAC THEN + MATCH_MP_TAC (TAUT `(A ==> ~B) ==> (B ==> ~A)`) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[Hypermap.CARD_SINGLETON; ARITH_RULE `~(1 > 1)`]);; + + + +(* Properties of surrounded nodes and fully surrounded fans *) + +(* LEMMA: aux *) +let SUM_BOUND_LT_ALT = prove(`!s (f:A->real) b n. FINITE s /\ CARD s <= n /\ + (!x. x IN s ==> f x <= b) /\ (?x. x IN s /\ f x < b) /\ &0 <= b + ==> sum s f < &n * b`, + REPEAT GEN_TAC THEN + DISCH_TAC THEN + MP_TAC (ISPECL [`s:A->bool`; `f:A->real`; `b:real`] SUM_BOUND_LT) THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `&(CARD (s:A->bool)) * b <= &n * b` MP_TAC THENL + [ + MATCH_MP_TAC REAL_LE_RMUL THEN + ASM_REWRITE_TAC[REAL_OF_NUM_LE]; + ALL_TAC + ] THEN + REAL_ARITH_TAC);; + + + + + +(* Alternative definition *) +let FULLY_SURROUNDED = prove(`!V E. FAN (vec 0,V,E) ==> + (fully_surrounded (V,E) <=> !v. v IN V ==> surrounded_node (V,E) v)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[Fan_defs.fully_surrounded; surrounded_node] THEN + EQ_TAC THENL + [ + SIMP_TAC[]; + ALL_TAC + ] THEN + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL IN_DART_OF_FAN) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `v:real^3`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `x:real^3#real^3`) THEN + ASM_REWRITE_TAC[]);; + + + + +(* LEMMA: general *) +let SURROUNDED_IMP_CARD_SET_OF_EDGE_GE_3 = prove(`!V E v. FAN (vec 0,V,E) /\ v IN V /\ surrounded_node (V,E) v + ==> CARD (set_of_edge v V E) >= 3`, + REWRITE_TAC[surrounded_node] THEN + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`] DART_EXISTS) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + + SUBGOAL_THEN `(v:real^3,w:real^3) IN dart1_of_fan (V,E)` MP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `v:real^3,w:real^3`) THEN + ASM_REWRITE_TAC[azim_dart] THEN + DISJ_CASES_TAC (TAUT `v:real^3 = w \/ ~(v = w)`) THEN ASM_REWRITE_TAC[] THENL + [ + REWRITE_TAC[(MATCH_MP (REAL_ARITH `&0 < a ==> ~(&2 * a < a)`) PI_POS)]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl)) THEN + REWRITE_TAC[dart_of_fan; dart1_of_fan; IN_UNION] THEN + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + ASM_REWRITE_TAC[IN_ELIM_THM; PAIR_EQ] THEN + ASM_MESON_TAC[]; + ALL_TAC + ] THEN + + DISCH_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`] CARD_NODE_HYPERMAP_OF_FAN) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3,w:real^3`] SUM_AZIM_DART) THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC (TAUT `(~B ==> ~A) ==> (A ==> B)`) THEN + REWRITE_TAC[ARITH_RULE `~(a >= 3) <=> a <= 2`] THEN + + SUBGOAL_THEN `!x. x IN node(hypermap_of_fan (V:real^3->bool,E)) (v,w) ==> azim_dart (V,E) x < pi` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (fun th -> MATCH_MP_TAC th) THEN + + CONJ_TAC THENL + [ + ASM SET_TAC[DART1_OF_FAN_SUBSET_DART_OF_FAN; NODE_SUBSET_DART1_OF_FAN]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN + ASM_SIMP_TAC[NODE_HYPERMAP_OF_FAN; IN_ELIM_THM; PAIR_EQ] THEN + STRIP_TAC THEN ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + ABBREV_TAC `s = node (hypermap_of_fan (V,E)) (v:real^3,w)` THEN + DISCH_TAC THEN + MATCH_MP_TAC (REAL_ARITH `a < &2 * pi ==> ~(a = &2 * pi)`) THEN + MATCH_MP_TAC SUM_BOUND_LT_ALT THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE; PI_POS] THEN + MP_TAC (ISPECL [`hypermap_of_fan (V:real^3->bool,E)`; `v:real^3,w:real^3`] Hypermap.NODE_FINITE) THEN + ASM_SIMP_TAC[] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + EXISTS_TAC `v:real^3,w:real^3` THEN + CONJ_TAC THENL + [ + REMOVE_ASSUM THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[Hypermap.node; Hypermap.node_map; Hypermap.orbit_reflect]; + ALL_TAC + ] THEN + + REPLICATE_TAC 3 REMOVE_ASSUM THEN + FIRST_X_ASSUM (MP_TAC o SPEC `v:real^3,w:real^3`) THEN + ASM SET_TAC[DART1_OF_FAN_SUBSET_DART_OF_FAN]);; + + + +(* LEMMA: general *) +let SURROUNDED_IMP_IN_DART1_OF_FAN = prove(`!V E v w. FAN (vec 0,V,E) /\ (v,w) IN dart_of_fan (V,E) + /\ surrounded_node (V,E) v + ==> (v,w) IN dart1_of_fan (V,E)`, + REWRITE_TAC[dart_of_fan; dart1_of_fan; IN_UNION] THEN + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`] SURROUNDED_IMP_CARD_SET_OF_EDGE_GE_3) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL + [ + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[IN_ELIM_THM; PAIR_EQ] THEN + STRIP_TAC THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[IN_ELIM_THM; PAIR_EQ] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[CARD_CLAUSES; ARITH_RULE `~(0 >= 3)`]);; + + + +(* LEMMA: general *) +let SURROUNDED_IMP_CARD_NODE_GE_3 = prove(`!V E v w. FAN (vec 0,V,E) /\ (v,w) IN dart1_of_fan (V,E) + /\ surrounded_node (V,E) v + ==> CARD (node (hypermap_of_fan (V,E)) (v,w)) >= 3`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[CARD_NODE_HYPERMAP_OF_FAN] THEN + MATCH_MP_TAC SURROUNDED_IMP_CARD_SET_OF_EDGE_GE_3 THEN + ASM_SIMP_TAC[dart1_of_fan] THEN + REMOVE_ASSUM THEN + SUBGOAL_THEN `{v:real^3,w} IN E` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REWRITE_TAC[dart1_of_fan; IN_ELIM_THM; PAIR_EQ] THEN + MESON_TAC[]; + ALL_TAC + ] THEN + ASM_MESON_TAC[ISPEC `vec 0:real^3` Fan_misc.FAN_IN_SET_OF_EDGE]);; + + + +(* LEMMA: general *) +let CARD_SET_OF_EDGE_GT_1_IMP_CARD_FACE_GE_3 = prove(`!V E. FAN (vec 0,V,E) /\ + (!v. v IN V ==> CARD(set_of_edge v V E) > 1) + ==> (!x. x IN dart_of_fan (V,E) ==> CARD (face (hypermap_of_fan (V,E)) x) >= 3)`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `x IN dart1_of_fan (V:real^3->bool,E)` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REWRITE_TAC[dart_of_fan; dart1_of_fan; IN_UNION] THEN + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `v:real^3`) THEN + ASM_REWRITE_TAC[CARD_CLAUSES; ARITH_RULE `~(0 > 1)`]; + ALL_TAC + ] THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `x:real^3#real^3`] IN_DART1_OF_FAN_IMP_CARD_FACE_GT_1) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + + MATCH_MP_TAC (ARITH_RULE `~(a = 0 \/ a = 1 \/ a = 2) ==> a >= 3`) THEN + STRIP_TAC THEN POP_ASSUM MP_TAC THENL + [ + ASM_SIMP_TAC[ARITH_RULE `a > 1 ==> ~(a = 0)`]; + ASM_SIMP_TAC[ARITH_RULE `a > 1 ==> ~(a = 1)`]; + ALL_TAC + ] THEN + + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `v:real^3` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `w:real^3` ASSUME_TAC) THEN + ASM_REWRITE_TAC[] THEN REPEAT DISCH_TAC THEN + + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`] LINEAR_FACE_2) THEN + ASM_REWRITE_TAC[f_fan_pair_ext; f_fan_pair; PAIR_EQ] THEN + DISCH_THEN (MP_TAC o (fun th -> AP_TERM `extension_sigma_fan (vec 0) V E (w:real^3)` th)) THEN + MP_TAC (ISPECL [`vec 0:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `w:real^3`] Fan_misc.INVERSE_SIGMA_FAN) THEN + ASM_REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[Fan.extension_sigma_fan] THEN + SUBGOAL_THEN `v:real^3 IN set_of_edge w V E /\ w IN V` ASSUME_TAC THENL + [ + SUBGOAL_THEN `{v:real^3,w} IN E` ASSUME_TAC THENL + [ + REMOVE_ASSUM THEN REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[dart1_of_fan; IN_ELIM_THM; PAIR_EQ] THEN + SET_TAC[]; + ALL_TAC + ] THEN + ASM_MESON_TAC[Fan_misc.FAN_IN_SET_OF_EDGE]; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `w:real^3`) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + SUBGOAL_THEN `~(set_of_edge (w:real^3) V E = {v})` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN + MATCH_MP_TAC (TAUT `(A ==> ~B) ==> (B ==> ~A)`) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[Hypermap.CARD_SINGLETON; ARITH_RULE `~(1 > 1)`]; + ALL_TAC + ] THEN + + ASM_MESON_TAC[Fan.SIGMA_FAN]);; + + + +(* LEMMA: general *) +let FULLY_SURROUNDED_IMP_CARD_FACE_GE_3 = prove(`!V E. FAN (vec 0,V,E) /\ fully_surrounded (V,E) + ==> (!x. x IN dart_of_fan (V,E) ==> CARD (face (hypermap_of_fan (V,E)) x) >= 3)`, + REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + ASM_SIMP_TAC[FULLY_SURROUNDED] THEN DISCH_TAC THEN + MATCH_MP_TAC CARD_SET_OF_EDGE_GT_1_IMP_CARD_FACE_GE_3 THEN + ASM_REWRITE_TAC[] THEN GEN_TAC THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `v:real^3`) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MATCH_MP_TAC (ARITH_RULE `a >= 3 ==> a > 1`) THEN + MATCH_MP_TAC SURROUNDED_IMP_CARD_SET_OF_EDGE_GE_3 THEN + ASM_REWRITE_TAC[]);; + + + +(* ULEKUUB for surrounded fans *) + +let FULLY_SURROUNDED_NODE_DECOMPOSITION = prove(`!V E x. FAN (vec 0,V,E) /\ + fully_surrounded (V,E) /\ + x IN dart_of_fan (V,E) + ==> (let H = hypermap_of_fan (V,E) in + let A = {y | y IN node H x /\ CARD (face H y) = 3} in + let B = {y | y IN node H x /\ CARD (face H y) = 4} in + let C = {y | y IN node H x /\ CARD (face H y) >= 5} in + let D = {y | y IN node H x /\ CARD (face H y) >= 4} in + node H x = A UNION D /\ DISJOINT A D /\ + D = B UNION C /\ DISJOINT B C /\ + FINITE D /\ FINITE A)`, + REPEAT STRIP_TAC THEN + REPEAT (CONV_TAC let_CONV) THEN + ABBREV_TAC `H = hypermap_of_fan (V,E)` THEN + ABBREV_TAC `A = {y:real^3#real^3 | y IN node H x /\ CARD (face H y) = 3}` THEN + ABBREV_TAC `B = {y:real^3#real^3 | y IN node H x /\ CARD (face H y) = 4}` THEN + ABBREV_TAC `C = {y:real^3#real^3 | y IN node H x /\ CARD (face H y) >= 5}` THEN + ABBREV_TAC `D = {y:real^3#real^3 | y IN node H x /\ CARD (face H y) >= 4}` THEN + + SUBGOAL_THEN `A:real^3#real^3->bool SUBSET node H x /\ D SUBSET node H x` ASSUME_TAC THENL + [ + EXPAND_TAC "A" THEN EXPAND_TAC "D" THEN + SIMP_TAC[SUBSET; IN_ELIM_THM]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `DISJOINT (A:real^3#real^3->bool) D` ASSUME_TAC THENL + [ + EXPAND_TAC "A" THEN EXPAND_TAC "D" THEN + REWRITE_TAC[DISJOINT; EXTENSION; IN_INTER; NOT_IN_EMPTY; IN_ELIM_THM] THEN + GEN_TAC THEN MATCH_MP_TAC (TAUT `~(A /\ B) ==> ~((X /\ A) /\ X /\ B)`) THEN + ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `(A:real^3#real^3->bool) UNION D = node H x` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC SUBSET_ANTISYM THEN + CONJ_TAC THENL + [ + ASM_REWRITE_TAC[UNION_SUBSET]; + ALL_TAC + ] THEN + + REWRITE_TAC[SUBSET; IN_UNION] THEN GEN_TAC THEN + REPLICATE_TAC 2 REMOVE_ASSUM THEN + REPLICATE_TAC 4 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + DISCH_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`] FULLY_SURROUNDED_IMP_CARD_FACE_GE_3) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `x':real^3#real^3`) THEN + SUBGOAL_THEN `x' IN dart_of_fan (V:real^3->bool,E)` (fun th -> REWRITE_TAC[th]) THENL + [ + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `x:real^3#real^3`] NODE_SUBSET_DART_OF_FAN) THEN + ASM_SIMP_TAC[SUBSET]; + ALL_TAC + ] THEN + + REWRITE_TAC[ARITH_RULE `a >= 3 <=> a = 3 \/ a >= 4`; IN_ELIM_THM] THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + + REPEAT CONJ_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["B"; "C"; "D"] THEN + REWRITE_TAC[EXTENSION; IN_UNION; IN_ELIM_THM] THEN + REWRITE_TAC[ARITH_RULE `a >= 4 <=> a = 4 \/ a >= 5`] THEN + REWRITE_TAC[TAUT `A /\ (B \/ C) <=> A /\ B \/ A /\ C`]; + + EXPAND_TAC "B" THEN EXPAND_TAC "C" THEN + REWRITE_TAC[DISJOINT; EXTENSION; IN_INTER; NOT_IN_EMPTY; IN_ELIM_THM] THEN + GEN_TAC THEN MATCH_MP_TAC (TAUT `~(A /\ B) ==> ~((X /\ A) /\ X /\ B)`) THEN + ARITH_TAC; + + MATCH_MP_TAC FINITE_SUBSET THEN + EXISTS_TAC `node H (x:real^3#real^3)` THEN + ASM_REWRITE_TAC[Hypermap.NODE_FINITE]; + + MATCH_MP_TAC FINITE_SUBSET THEN + EXISTS_TAC `node H (x:real^3#real^3)` THEN + ASM_REWRITE_TAC[Hypermap.NODE_FINITE] + ]);; + + + + +let SUM_AZIM_DART_FULLY_SURROUNDED = prove(`!V E x. FAN (vec 0,V,E) /\ fully_surrounded (V,E) + /\ x IN dart_of_fan (V,E) + ==> (let H = hypermap_of_fan (V,E) in + let A = {y | y IN node H x /\ CARD (face H y) = 3} in + let B = {y | y IN node H x /\ CARD (face H y) >= 4} in + sum A (azim_dart (V,E)) + sum B (azim_dart(V,E)) = &2 * pi)`, + REPEAT STRIP_TAC THEN REPEAT (CONV_TAC let_CONV) THEN + ABBREV_TAC `H = hypermap_of_fan (V:real^3->bool,E)` THEN + ABBREV_TAC `A = {y:real^3#real^3 | y IN node H x /\ CARD (face H y) = 3}` THEN + ABBREV_TAC `B = {y:real^3#real^3 | y IN node H x /\ CARD (face H y) >= 4}` THEN + ABBREV_TAC `f = azim_dart (V:real^3->bool,E)` THEN + MP_TAC (SPEC_ALL FULLY_SURROUNDED_NODE_DECOMPOSITION) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o let_RULE) THEN + ASM_REWRITE_TAC[] THEN + REPLICATE_TAC 2 (DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + REPLICATE_TAC 2 (DISCH_THEN (CONJUNCTS_THEN2 (fun th -> ALL_TAC) MP_TAC)) THEN + DISCH_TAC THEN + + SUBGOAL_THEN `sum (A:real^3#real^3->bool) f + sum B f = sum (A UNION B) f` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC (GSYM SUM_UNION) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REMOVE_ASSUM THEN REMOVE_ASSUM THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + + EXPAND_TAC "H" THEN + EXPAND_TAC "f" THEN + + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN FIRST_ASSUM (fun th -> REWRITE_TAC[th]) THEN + MATCH_MP_TAC SUM_AZIM_DART THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[]);; + + +(* TODO: move this definitions to hypermap.hl? *) + +let no_loops = new_definition `no_loops (H:(A) hypermap) <=> ! (x:A) (y:A). x IN edge H y /\ x IN node H y ==> x = y`;; + +let is_no_double_joints = new_definition `is_no_double_joints (H:(A)hypermap) + <=> (!x y. x IN dart H /\ y IN node H x /\ edge_map H y IN node H (edge_map H x) ==> x = y)`;; + + +(* Surrounded ==> is_edge_nondegenerate (hypermap_of_fan (V,E)) *) +let HYPERMAP_OF_FAN_EDGE_NONDEGENERATE = prove(`!V E. FAN (vec 0,V,E) /\ fully_surrounded (V,E) + ==> is_edge_nondegenerate (hypermap_of_fan (V,E))`, + REWRITE_TAC[Hypermap.is_edge_nondegenerate] THEN + REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + ASM_SIMP_TAC[FULLY_SURROUNDED] THEN DISCH_TAC THEN + REPEAT STRIP_TAC THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `v:real^3` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `w:real^3` MP_TAC) THEN + DISCH_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`] SURROUNDED_IMP_IN_DART1_OF_FAN) THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`] PAIR_IN_DART_OF_FAN) THEN + ASM_SIMP_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl)) THEN + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN] THEN + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3,w:real^3`] E_HAS_NO_FIXED_POINTS_IN_D1) THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o check (fun th -> rand (concl th) = `x:real^3#real^3`)) THEN + ASM_SIMP_TAC[Hypermap.edge_map; HYPERMAP_OF_FAN] THEN + ASM_REWRITE_TAC[e_fan_pair_ext]);; + + + +(* no_loops (hypermap_of_fan (V,E)) *) +let HYPERMAP_OF_FAN_NO_LOOPS = prove(`!V E. FAN (vec 0,V,E) ==> + no_loops (hypermap_of_fan (V,E))`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[no_loops] THEN + REPEAT GEN_TAC THEN + MP_TAC (ISPEC `y:real^3#real^3` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `v:real^3` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `w:real^3` ASSUME_TAC) THEN + ASM_REWRITE_TAC[] THEN + ASM_CASES_TAC `v,w IN dart1_of_fan (V:real^3->bool,E)` THENL + [ + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`] EDGE_HYPERMAP_OF_FAN) THEN + ASM_SIMP_TAC[] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`] NODE_HYPERMAP_OF_FAN) THEN + ASM_SIMP_TAC[] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + ASM_REWRITE_TAC[SET_RULE `x IN {a, b} <=> x = a \/ x = b`] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[IN_ELIM_THM] THEN + STRIP_TAC THEN + SUBGOAL_THEN `v:real^3 = w` MP_TAC THENL + [ + POP_ASSUM MP_TAC THEN ASM_SIMP_TAC[PAIR_EQ; EQ_SYM_EQ]; + ALL_TAC + ] THEN + MP_TAC (ISPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`] PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[Hypermap.edge; Hypermap.node; Hypermap.edge_map; Hypermap.node_map; HYPERMAP_OF_FAN] THEN + SUBGOAL_THEN `orbit_map (e_fan_pair_ext (V:real^3->bool,E)) (v,w) = {(v,w)}` MP_TAC THENL + [ + REWRITE_TAC[GSYM Hypermap.orbit_one_point] THEN + ASM_SIMP_TAC[e_fan_pair_ext]; + ALL_TAC + ] THEN + SUBGOAL_THEN `orbit_map (n_fan_pair_ext (V:real^3->bool,E)) (v,w) = {(v,w)}` MP_TAC THENL + [ + REWRITE_TAC[GSYM Hypermap.orbit_one_point] THEN + ASM_REWRITE_TAC[n_fan_pair_ext]; + ALL_TAC + ] THEN + REPLICATE_TAC 2 (DISCH_THEN (fun th -> REWRITE_TAC[th])) THEN + REWRITE_TAC[IN_SING]);; + + + +(* is_no_double_joints (hypermap_of_fan (V,E)) *) +let HYPERMAP_OF_FAN_NO_DOUBLE_JOINTS = prove(`!V E. FAN (vec 0,V,E) ==> + is_no_double_joints (hypermap_of_fan (V,E))`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[is_no_double_joints] THEN + REPEAT GEN_TAC THEN + ASM_SIMP_TAC[Hypermap.edge_map; HYPERMAP_OF_FAN] THEN + DISCH_THEN (CONJUNCTS_THEN2 (fun th -> ALL_TAC) MP_TAC) THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `v:real^3` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `w:real^3` ASSUME_TAC) THEN + ASM_REWRITE_TAC[e_fan_pair_ext] THEN + ASM_CASES_TAC `v,w IN dart1_of_fan (V:real^3->bool,E)` THENL + [ + DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + SUBGOAL_THEN `y IN dart1_of_fan (V:real^3->bool,E)` ASSUME_TAC THENL + [ + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3,w:real^3`] NODE_SUBSET_DART1_OF_FAN) THEN + ASM_SIMP_TAC[SUBSET]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[e_fan_pair] THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`] NODE_HYPERMAP_OF_FAN) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[IN_ELIM_THM] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[e_fan_pair; PAIR_EQ] THEN + SUBGOAL_THEN `w,v IN dart1_of_fan (V:real^3->bool,E)` ASSUME_TAC THENL + [ + REPLICATE_TAC 2 REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[dart1_of_fan; IN_ELIM_THM; PAIR_EQ] THEN + STRIP_TAC THEN + EXISTS_TAC `w:real^3` THEN EXISTS_TAC `v:real^3` THEN + ASM_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]; + ALL_TAC + ] THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `w:real^3`; `v:real^3`] NODE_HYPERMAP_OF_FAN) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[IN_ELIM_THM; PAIR_EQ] THEN + STRIP_TAC THEN ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[Hypermap.node; Hypermap.node_map; HYPERMAP_OF_FAN] THEN + SUBGOAL_THEN `orbit_map (n_fan_pair_ext (V:real^3->bool,E)) (v,w) = {(v,w)}` ASSUME_TAC THENL + [ + ONCE_REWRITE_TAC[GSYM Hypermap.orbit_one_point] THEN + ASM_REWRITE_TAC[n_fan_pair_ext]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[IN_SING] THEN + ASM_SIMP_TAC[]);; + + + +(* azim_dart x is always positive *) +let AZIM_DART_POS = prove(`!V E x. FAN (vec 0,V,E) /\ x IN dart_of_fan (V,E) + ==> &0 < azim_dart (V,E) x`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL IN_DART_OF_FAN) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + ASM_CASES_TAC `v,w IN dart1_of_fan (V:real^3->bool,E)` THENL + [ + MP_TAC (SPEC_ALL (ISPEC `V:real^3->bool` PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ)) THEN + ASM_SIMP_TAC[azim_dart; azim_fan] THEN DISCH_TAC THEN + ASM_CASES_TAC `CARD (set_of_edge (v:real^3) V E) > 1` THEN ASM_REWRITE_TAC[] THENL + [ + MATCH_MP_TAC (REAL_ARITH `&0 <= a /\ ~(a = &0) ==> &0 < a`) THEN + REWRITE_TAC[azim] THEN + ABBREV_TAC `w' = sigma_fan (vec 0) V E v w` THEN + MP_TAC (SPEC_ALL PAIR_IN_DART1_OF_FAN) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + SUBGOAL_THEN `w' IN (set_of_edge v V E) /\ ~(w' = w:real^3)` STRIP_ASSUME_TAC THENL + [ + MP_TAC (SPECL [`vec 0:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`] Fan.SIGMA_FAN) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THEN SIMP_TAC[] THEN + FIRST_ASSUM (MP_TAC o check (is_binary ">" o concl)) THEN + MATCH_MP_TAC (TAUT `(A ==> ~B) ==> (B ==> ~A)`) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[Hypermap.CARD_SINGLETON] THEN + REWRITE_TAC[GT; LT_REFL]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[CONTRAPOS_THM] THEN + DISCH_TAC THEN + MATCH_MP_TAC (GSYM Fan.UNIQUE_AZIM_0_POINT_FAN) THEN + MAP_EVERY EXISTS_TAC [`vec 0:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`] THEN + ASM_REWRITE_TAC[] THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[set_of_edge; IN_ELIM_THM]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LT_MUL THEN + REWRITE_TAC[PI_POS] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o check (fun th -> rand (concl th) = `dart_of_fan (V:real^3->bool,E)`)) THEN + ASM_REWRITE_TAC[dart_of_fan; GSYM dart1_of_fan; IN_UNION] THEN + REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN REWRITE_TAC[azim_dart] THEN + MATCH_MP_TAC REAL_LT_MUL THEN + REWRITE_TAC[PI_POS] THEN REAL_ARITH_TAC);; + + + +(* 0,v,w are not collinear *) +let DART1_NOT_COLLINEAR = prove(`!V E v (w:real^3). FAN (vec 0,V,E) /\ (v,w) IN dart1_of_fan (V,E) + ==> ~collinear {vec 0,v,w}`, + REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN DISCH_TAC THEN + FIRST_ASSUM MP_TAC THEN + REWRITE_TAC[FAN; fan6] THEN STRIP_TAC THEN + MP_TAC (SPEC_ALL (SPEC `V:real^3->bool` PAIR_IN_DART1_OF_FAN)) THEN + ASM_REWRITE_TAC[set_of_edge; IN_ELIM_THM] THEN + STRIP_TAC THEN + FIRST_ASSUM (MP_TAC o SPEC `{v:real^3,w}`) THEN + REWRITE_TAC[SET_RULE `{a:real^3} UNION {v,w} = {a,v,w}`] THEN + ASM_SIMP_TAC[]);; + + +(* {0,v,w} and {0,v,sigma(v)(w)} are not collinear *) +let DART1_NOT_COLLINEAR_2 = prove(`!V E v (w:real^3). FAN (vec 0,V,E) /\ (v,w) IN dart1_of_fan (V,E) + ==> ~collinear {vec 0,v,w} /\ ~collinear {vec 0,v,sigma_fan (vec 0) V E v w}`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + MP_TAC (SPEC_ALL DART1_NOT_COLLINEAR) THEN + ASM_SIMP_TAC[] THEN DISCH_TAC THEN + SUBGOAL_THEN `(v,sigma_fan (vec 0) V E v w) IN dart1_of_fan (V:real^3->bool,E)` ASSUME_TAC THENL + [ + MATCH_MP_TAC Hypermap.lemma_in_subset THEN + EXISTS_TAC `node (hypermap_of_fan (V,E)) (v,w)` THEN CONJ_TAC THENL + [ + ASM_SIMP_TAC[NODE_SUBSET_DART1_OF_FAN]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[NODE_HYPERMAP_OF_FAN; IN_ELIM_THM] THEN + EXISTS_TAC `1` THEN + REWRITE_TAC[ARITH_RULE `1 >= 0`; Hypermap.POWER_1]; + ALL_TAC + ] THEN + MATCH_MP_TAC DART1_NOT_COLLINEAR THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `E:(real^3->bool)->bool`] THEN + ASM_REWRITE_TAC[]);; + + +open Hypermap;; + +let ORBIT_MAP_RES_LEMMA = prove(`!f (x:A) s. orbit_map f x SUBSET s ==> + orbit_map (res f s) x = orbit_map f x`, + REWRITE_TAC[SUBSET; orbit_map; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN + SUBGOAL_THEN `!n. (res f s POWER n) x = (f POWER n) (x:A)` ASSUME_TAC THENL + [ + INDUCT_TAC THEN REWRITE_TAC[POWER_0] THEN + ASM_REWRITE_TAC[COM_POWER; o_THM] THEN + REWRITE_TAC[res] THEN + SUBGOAL_THEN `(f POWER n) (x:A) IN s` (fun th -> REWRITE_TAC[th]) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + EXISTS_TAC `n:num` THEN + REWRITE_TAC[GE; LE_0]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]);; + + +let ORBIT_SUBSET_LEMMA = prove(`!f s (x:A). x IN s /\ (!y. y IN s ==> f y IN s) + ==> orbit_map f x SUBSET s`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[orbit_map; SUBSET; IN_ELIM_THM] THEN + GEN_TAC THEN DISCH_THEN CHOOSE_TAC THEN POP_ASSUM MP_TAC THEN + SPEC_TAC (`x':A`, `y:A`) THEN + SPEC_TAC (`n:num`, `n:num`) THEN + INDUCT_TAC THEN ASM_SIMP_TAC[GE; LE_0; POWER_0; I_THM] THEN + GEN_TAC THEN REWRITE_TAC[COM_POWER; o_THM] THEN + DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `(f POWER n) (x:A)`) THEN + ASM_REWRITE_TAC[GE; LE_0]);; + + +let ORBIT_MAP_RES = prove(`!f (x:A) s. x IN s /\ (res f s) permutes s + ==> orbit_map (res f s) x = orbit_map f x`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC ORBIT_MAP_RES_LEMMA THEN + MATCH_MP_TAC ORBIT_SUBSET_LEMMA THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `(f:A->A) y = (res f s) y` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[res]; + ALL_TAC + ] THEN + MP_TAC (ISPECL [`res (f:A->A) s`; `s:A->bool`] PERMUTES_IMP_INSIDE) THEN + ASM_SIMP_TAC[]);; + + + +end;; diff --git a/text_formalization/fan/fan_defs.hl b/text_formalization/fan/fan_defs.hl new file mode 100644 index 0000000..92be5d9 --- /dev/null +++ b/text_formalization/fan/fan_defs.hl @@ -0,0 +1,304 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Definitions *) +(* Chapter: Fan *) +(* Authors: Thomas C. Hales, Hoang Le Truong, Alexey Solovyev *) +(* Date: 2010-05-11 *) +(* ========================================================================== *) + +(* +Definitions file for Fan +*) + +flyspeck_needs "general/sphere.hl";; +flyspeck_needs "volume/vol1.hl";; +flyspeck_needs "hypermap/hypermap.hl";; + +module Fan_defs = struct + + + +(* General definitions *) + +let graph = new_definition `graph E <=> (!e. E e ==> (e HAS_SIZE 2))`;; + +(* AS: + Maybe it is better to change names to something like fan_card, fan_origin, fan_non_parallel, fan_intersection, + because names like fan1, fan2, fan6, fan7 are not descriptive at all. + + If the names are changed, then it will be required to modify fan/*.hl as well. I think, + it is quite easy and fast: search for all occurrences of fan1 and change it to fan_card, etc. + This procedure should take at most 10-20 minutes. +*) + +(* Cardinality *) +let fan1 = new_definition `fan1(x,V,E):bool <=> FINITE V /\ ~(V SUBSET {})`;; +(* Origin *) +let fan2 = new_definition `fan2(x,V,E):bool <=> ~(x IN V)`;; +(* Non-parallel *) +let fan6 = new_definition `fan6(x,V,E):bool<=>(!e. (e IN E) ==> ~(collinear ({x} UNION e)))`;; +(* Intersection *) +let fan7 = new_definition `fan7(x,V,E):bool<=> (!e1 e2. (e1 IN E UNION {{v}| v IN V}) /\ (e2 IN E UNION {{v}| v IN V}) +==> ((aff_ge {x} e1) INTER (aff_ge {x} e2) = aff_ge {x} (e1 INTER e2)))`;; + +(* Fan *) + +(* AS: + In my opinion, the name `fan` is better because it follows the general convention of naming objects + in HOL Light. + + The file fan/introduction.hl already contains the definition of the constant `fan`. Probably, it is an earlier definition + of fan. Now, it should be deprecated. Again, I think it will be not difficult to make corresponding + changes in fan/*.hl +*) +let FAN = new_definition `FAN(x,V,E) <=> ((UNIONS E) SUBSET V) /\ graph(E) /\ fan1(x,V,E) /\ fan2(x,V,E)/\ +fan6(x,V,E)/\ fan7(x,V,E)`;; + +(* E(v) *) +let set_of_edge = new_definition `set_of_edge v V E = {w | {v,w} IN E /\ w IN V}`;; + +(* sigma *) +let sigma_fan = new_definition `sigma_fan x (V:real^3->bool) E v u = + if (set_of_edge v V E = {u}) then u + else (@(w:real^3). w IN (set_of_edge v V E) /\ ~(w = u) /\ + (!(w1:real^3). w1 IN (set_of_edge v V E) /\ ~(w1=u) ==> azim x v u w <= azim x v u w1))`;; + +(* AS: + This definition is not very important (there is only one result involving this definition + which proves that extension_sigma_fan permutes set_of_edge). But I decided that it is simpler + to have this definition rather than modify the definition of sigma_fan +*) + +(* THALES: + It appears that there are three definitions of inverse_sigma_fan from the files introduction.hl, fan_misc.hl, and fan_defs.hl + I am renaming the one in fan/introduction.hl inverse_sigma_fan_alt and the one in fan_misc.hl as inverse_sigma_fan_bis. + I take the one in fan_defs.hl to be the primary definition. +*) + +let extension_sigma_fan = new_definition `extension_sigma_fan x (V:real^3->bool) E v u = + if ~(u IN set_of_edge v V E ) then u + else (sigma_fan x V E v u)`;; + +let inverse_sigma_fan = new_definition `inverse_sigma_fan x V E v = inverse (extension_sigma_fan x V E v)`;; + + +(* Hypermap of Fan *) + +let dart1_of_fan = new_definition + `dart1_of_fan ((V:A->bool),(E:(A->bool)->bool)) = { (v,w) | {v,w} IN E }`;; + + +let dart_of_fan = new_definition + `dart_of_fan (V,E) = + { (v,v) | v IN V /\ set_of_edge (v:real^3) V E = {} } UNION { (v,w) | {v,w} IN E }`;; + + +(* in fan/introduction.hl a dart is a 4-tuple. Here it is a pair. Here is the correspondence *) +(* AS: + Do we need this correspondence? + Right now, there are no results involving `extended_dart` or `contracted_dart`. + Ultimately, it is better to use new definition of darts as pairs everywhere. +*) +let i_fan=new_definition`i_fan (x:real^3) V E=(\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). (x,v,w,(sigma_fan x V E v w)))`;; + +let extended_dart = new_definition + `extended_dart (V,E) (v,w) = i_fan (vec 0) V E (vec 0, v, w, w)`;; + +let contracted_dart = new_definition + `contracted_dart (x:A,v:B,w:C,w1:D) = (v,w)`;; + +(* e_fan, n_fan, f_fan of fan/introduction.hl, restricted to pairs *) + +(* AS: + In my opinion, it is better to change the names e_fan_pair, n_fan_pair, f_fan_pair + to e_fan, n_fan, f_fan. + It will require some modifications in fan/introduction.hl, but it is not a problem +*) + +let e_fan_pair = new_definition `e_fan_pair (V,E) (v,w) = (w,v)`;; + +let n_fan_pair = new_definition + `n_fan_pair (V,E) (v,w) = v,sigma_fan (vec 0) V E v w`;; + +let f_fan_pair = new_definition + `f_fan_pair (V,E) (v,w) = w,(inverse_sigma_fan (vec 0) V E w v)`;; + + +let hypermap_of_fan = new_definition + `hypermap_of_fan (V,E) = + (let p = ( \ t. res (t (V,E) ) (dart1_of_fan (V,E)) ) in + hypermap( dart_of_fan (V,E) , p e_fan_pair, p n_fan_pair, p f_fan_pair))`;; + +(* Restricted versions of e_fan_pair, n_fan_pair, f_fan_pair (for convenience) *) +let e_fan_pair_ext = new_definition `e_fan_pair_ext (V,E) x = if x IN dart1_of_fan (V,E) then e_fan_pair (V,E) x else x`;; + +let n_fan_pair_ext = new_definition `n_fan_pair_ext (V,E) x = if x IN dart1_of_fan (V,E) then n_fan_pair (V,E) x else x`;; + +let f_fan_pair_ext = new_definition `f_fan_pair_ext (V,E) x = if x IN dart1_of_fan (V,E) then f_fan_pair (V,E) x else x`;; + + +let E_FAN_PAIR_EXT = prove(`!V E. e_fan_pair_ext (V,E) = res (e_fan_pair (V,E)) (dart1_of_fan (V,E))`, + REWRITE_TAC[FUN_EQ_THM; e_fan_pair_ext; Sphere.res]);; + +let F_FAN_PAIR_EXT = prove(`!V E. f_fan_pair_ext (V,E) = res (f_fan_pair (V,E)) (dart1_of_fan (V,E))`, + REWRITE_TAC[FUN_EQ_THM; f_fan_pair_ext; Sphere.res]);; + +let N_FAN_PAIR_EXT = prove(`!V E. n_fan_pair_ext (V,E) = res (n_fan_pair (V,E)) (dart1_of_fan (V,E))`, + REWRITE_TAC[FUN_EQ_THM; n_fan_pair_ext; Sphere.res]);; + +let HYPERMAP_OF_FAN_ALT = prove(`!V E. hypermap_of_fan (V,E) = + hypermap (dart_of_fan (V,E), e_fan_pair_ext (V,E), n_fan_pair_ext (V,E), f_fan_pair_ext (V,E))`, + REPEAT GEN_TAC THEN + REWRITE_TAC[CONV_RULE (DEPTH_CONV let_CONV) hypermap_of_fan] THEN + REWRITE_TAC[E_FAN_PAIR_EXT; F_FAN_PAIR_EXT; N_FAN_PAIR_EXT]);; + + +(* Topological component and dart *) + +(* X(V,E) *) +let xfan = new_definition `xfan (x,V,E) = {v | ?e. (E e) /\ (v IN aff_ge {x} e)}`;; + +(* Y(V,E) *) +let yfan = new_definition `yfan (x,V,E) = (:real^3) DIFF xfan (x,V,E)`;; + +(* AS: + The original definition of yfan (renamed yfan_deprecated in fan/introduction.hl) is the following: +let yfan_deprecated = new_definition `yfan_deprecated (x,V,E) = {v:real^3 | ?e. (E e) /\ (~(v IN aff_ge {x} e))}`;; + It seems to be wrong since the negation of (?e. (E e) /\ (v IN aff_ge {x} e)) is + (!e. (E e) /\ ~(v IN aff_ge {x} e)). +*) + + +(* W^0_{dart}(x) *) + +(* AS: + It is better to have + w_dart_fan x V E (v,w), + or even + w_dart_fan V E (v,w) +*) +let w_dart_fan = new_definition `w_dart_fan x (V:real^3->bool) E (y:real^3,v,w,w1:real^3)= + if (CARD (set_of_edge v V E) > 1) then wedge x v w (sigma_fan x V E v w) + else + (if set_of_edge v V E = {w} then (UNIV:real^3->bool) DIFF aff_ge {x,v} {w} + else (if set_of_edge v V E ={} then (UNIV:real^3->bool) DIFF aff {x,v} else {}))`;; + + +(* DEPRECATED, 2011-08-01, --> wedge_ge +let cwedge = new_definition `cwedge v0 v1 w1 w2 = + {y | &0 <= azim v0 v1 w1 y /\ + azim v0 v1 w1 y <= azim v0 v1 w1 w2}`;; +*) + +(* W_{dart}(x) *) + +(* DEPRECATED, 2011-08-01 +let cw_dart_fan=new_definition `cw_dart_fan (V:real^3->bool) E (v,w)= + if (CARD (set_of_edge v V E) > 1) + then cwedge (vec 0) v w (sigma_fan (vec 0) V E v w) + else (:real^3)`;; +*) + +let azim_fan = new_definition `azim_fan x (V:real^3->bool) E v w = + if (CARD (set_of_edge v V E) > 1) + then azim x v w (sigma_fan x V E v w) + else &2 * pi`;; + +(* azim(x) *) +let azim_dart = new_definition + `azim_dart (V,E) (v,w) = + if (v=w) then &2 * pi else azim_fan (vec 0) V E v w`;; + +(* rcone^0(x,v,h) *) +let rcone_fan = new_definition `rcone_fan (x:real^3) (v:real^3) (h:real) = + {y:real^3 | (y-x) dot (v-x) > (dist(y,x)*dist(v,x)*h)}`;; + +(* W^0_{dart}(x,epsilon) *) +(* AS: + It is better to have rw_dart_fan V E (v,w) + + In the book, it is defined as ... INTER rcone_fan x v (cos h), + in fan/introduction.hl, it is used as rw_dart_fan x V E (...) (cos s) instead (not always but only when necessary). + This can lead to confusions. In my opinion, it is simpler to follow the book definition. In this case, + some changes in fan/introduction.hl are required. +*) +let rw_dart_fan = new_definition + `rw_dart_fan x (V:real^3->bool) E (y:real^3,v,w,w1:real^3) h = + w_dart_fan x V E (y,v,w,w1) INTER rcone_fan x v h`;; + +let topological_component_yfan = new_definition + `topological_component_yfan ((x:real^3),(V:real^3->bool),E) = + { connected_component (yfan (x,V,E)) y | y | y IN yfan (x,V,E) }`;; + +(* there is a function dart_leads_into in fan/introduction.hl. This is a bit simpler. *) + +(* AS: + It is better to change name to `dart_leads_into`. + + For the current definition of rw_dart_fan, should be: rw_dart_fan ... (cos eps), + but I prefer to change the definition of rw_dart_fan instead. +*) +let dart_leads_into1 = new_definition + `dart_leads_into1 (x,V,E) (v,u) = @s. s IN topological_component_yfan (x,V,E) /\ + (?eps. (eps < &1) /\ + rw_dart_fan x V E (x,v,u,sigma_fan x V E v u) eps SUBSET s)`;; + +let dartset_leads_into = new_definition + `dartset_leads_into (x,V,E) ds = + @s. (!y. (y IN ds) ==> (s = dart_leads_into1 (x,V,E) y))`;; + +(* node(x) not needed, use FST x *) + + +(* compare fan80 and fan81, which define fully_surrounded *) +let surrounded_node = new_definition + `surrounded_node (V,E) v = + !x. (x IN dart_of_fan (V,E)) /\ (FST x = v) ==> azim_dart (V,E) x < pi`;; + + +let fully_surrounded = new_definition + `fully_surrounded (V,E) = (!x. x IN dart_of_fan (V,E) ==> azim_dart (V,E) x < pi)`;; + +(* AS: the definitions from fan/introduction.hl are below: +let fan81=new_definition`fan81 (x:real^3,(V:real^3->bool),(E:(real^3->bool)->bool)):bool<=>(!v:real^3 u:real^3. {v,u} IN E ==> azim_fan x V E v u bool),(E:(real^3->bool)->bool)):bool<=>(!v:real^3 u:real^3. {v,u} IN E ==> &0< azim x v u (sigma_fan x V E v u) /\ azim x v u (sigma_fan x V E v u) + !s. s IN topological_component_yfan (vec 0,V,E) ==> (?!f. f IN face_set (hypermap_of_fan (V,E)) /\ + s = dartset_leads_into (vec 0,V,E) f)`;; + + +let conforming_half_space = new_definition `conforming_half_space (V,E) <=> + !f. f IN face_set (hypermap_of_fan (V,E)) ==> + dartset_leads_into (vec 0,V,E) f = + INTERS {aff_gt {vec 0, FST x, FST (f_fan_pair (V,E) x)} {FST (inverse (f_fan_pair (V,E)) x)} | x IN f}`;; + + +let conforming_solid_angle = new_definition `conforming_solid_angle (V,E) <=> + !f. f IN face_set (hypermap_of_fan (V,E)) ==> + (let U = dartset_leads_into (vec 0,V,E) f in + (!r. measurable (ball (vec 0,r) INTER U)) /\ + eventually_radial (vec 0) U /\ + sol (vec 0) U = &2 * pi + sum (f) (\x. azim_dart (V,E) x - pi))`;; + + +let conforming_diagonal = new_definition `conforming_diagonal (V,E) <=> + (!f x y. f IN face_set (hypermap_of_fan (V,E)) /\ x IN f /\ y IN f /\ ~(x = y) ==> + ~collinear {vec 0, FST x, FST y} /\ + (y = f_fan_pair (V,E) x \/ x = f_fan_pair (V,E) y \/ + aff_gt {vec 0} {FST x, FST y} SUBSET dartset_leads_into (vec 0,V,E) f))`;; + + +let conforming = new_definition `conforming (V,E) <=> + fully_surrounded (V,E) /\ + conforming_bijection (V,E) /\ + conforming_half_space (V,E) /\ + conforming_solid_angle (V,E) /\ + conforming_diagonal (V,E)`;; + +end;; + diff --git a/text_formalization/fan/fan_misc.hl b/text_formalization/fan/fan_misc.hl new file mode 100644 index 0000000..c77234f --- /dev/null +++ b/text_formalization/fan/fan_misc.hl @@ -0,0 +1,155 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Fan *) +(* Author: Alexey Solovyev *) +(* Date: 2010-04-06 *) +(* *) +(* Equivalence of inverse_sigma_fan and inverse1_sigma_fan *) +(* ========================================================================== *) + +(* TODO: results from this file should be added into introduction.hl *) + +(* flyspeck_needs "fan/fan_defs.hl";;*) + +module Fan_misc = struct + + +let inverse_sigma_fan = new_definition `inverse_sigma_fan x V E v = inverse(extension_sigma_fan x V E v)`;; + +let inverse1_sigma_fan=new_definition`inverse1_sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3)= @g. (!w:real^3. {v,w} IN E==> {v, g w} IN E) +/\ (!w:real^3. {v,w} IN E==> (sigma_fan x V E v)( g w) =w) +/\ (!w:real^3. {v,w} IN E==> g (sigma_fan x V E v w) =w)`;; + +(* We are using this definition from tame_defs.hl *) +let dart1_of_fan = new_definition + `dart1_of_fan ((V:A->bool),(E:(A->bool)->bool)) = { (v,w) | {v,w} IN E }`;; + + + +let REMOVE_ASSUM = POP_ASSUM (fun th -> ALL_TAC);; + + +let EXTENSION_SIGMA_FAN_EQ_RES = prove(`!x V E v. extension_sigma_fan x V E v = res (sigma_fan x V E v) (set_of_edge v V E)`, + REPEAT GEN_TAC THEN REWRITE_TAC[FUN_EQ_THM; Fan.extension_sigma_fan; Sphere.res] THEN + MESON_TAC[]);; + + +(* ------------------------------------------------------------------------- *) +(* inverse_sigma_fan_bis is the inverse of extension_sigma_fan *) +(* ------------------------------------------------------------------------- *) + +let INVERSE_SIGMA_FAN = prove(`!x V E v. FAN (x,V,E) + ==> (extension_sigma_fan x V E v) o (inverse_sigma_fan x V E v) = I + /\ (inverse_sigma_fan x V E v) o (extension_sigma_fan x V E v) = I`, + REPEAT GEN_TAC THEN REWRITE_TAC[inverse_sigma_fan] THEN + DISCH_TAC THEN + MATCH_MP_TAC PERMUTES_INVERSES_o THEN + DISJ_CASES_TAC (MESON[] `(?u:real^3. {v, u} IN E) \/ (!u. ~({v,u} IN E))`) THENL + [ + ASM_MESON_TAC[Fan.permutes_sigma_fan]; + ALL_TAC + ] THEN + + EXISTS_TAC `{}:real^3->bool` THEN + REWRITE_TAC[PERMUTES_EMPTY; FUN_EQ_THM] THEN + X_GEN_TAC `w:real^3` THEN + REWRITE_TAC[I_THM; Fan.extension_sigma_fan] THEN + REWRITE_TAC[Fan.set_of_edge; IN_ELIM_THM] THEN + ASM_MESON_TAC[]);; + + + +let EXTENSION_SIGMA_FAN_INJECTIVE = prove(`!x V E v. FAN (x,V,E) ==> (!u w. extension_sigma_fan x V E v u = extension_sigma_fan x V E v w ==> u = w)`, + REPEAT GEN_TAC THEN + DISCH_THEN (MP_TAC o (fun th -> CONJUNCT2 (SPEC `v:real^3` (MATCH_MP INVERSE_SIGMA_FAN th)))) THEN + ABBREV_TAC `f = extension_sigma_fan (x:real^3) V E v` THEN + ABBREV_TAC `g = inverse_sigma_fan (x:real^3) V E v` THEN + REPEAT STRIP_TAC THEN + POP_ASSUM (MP_TAC o (fun th -> AP_TERM `g:real^3->real^3` th)) THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM] THEN + MESON_TAC[]);; + + + +(* ------------------------------------------------------------------------- *) +(* Connection between dart1_of_fan and set_of_edge *) +(* ------------------------------------------------------------------------- *) + +let IN_SET_OF_EDGE = prove(`!V E (v:A) w. UNIONS E SUBSET V /\ (v, w) IN dart1_of_fan (V,E) ==> v IN V /\ w IN V /\ w IN set_of_edge v V E /\ v IN set_of_edge w V E`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + SUBGOAL_THEN `v:A IN V /\ w IN V` STRIP_ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[SUBSET; IN_UNIONS; dart1_of_fan; IN_ELIM_THM; PAIR_EQ] THEN + STRIP_TAC THEN STRIP_TAC THEN + FIRST_ASSUM (MP_TAC o SPEC `v:A`) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `w:A`) THEN + ANTS_TAC THENL [EXISTS_TAC `{v':A,w'}` THEN ASM SET_TAC[]; ALL_TAC] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ANTS_TAC THENL [EXISTS_TAC `{v':A,w'}` THEN ASM SET_TAC[]; ALL_TAC] THEN + REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[dart1_of_fan; Fan.set_of_edge; IN_ELIM_THM; PAIR_EQ] THEN + MESON_TAC[SET_RULE `{w, v} = {v, w}`]);; + + +let FAN_IN_SET_OF_EDGE = prove(`!x V E v w. FAN (x,V,E) /\ {v,w} IN E ==> v IN V /\ w IN V /\ w IN set_of_edge v V E /\ v IN set_of_edge w V E`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + MATCH_MP_TAC IN_SET_OF_EDGE THEN + REWRITE_TAC[dart1_of_fan; IN_ELIM_THM; PAIR_EQ] THEN + CONJ_TAC THENL + [ + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[Fan.FAN]; + ASM_MESON_TAC[] + ] );; + + +(* ------------------------------------------------------------------------- *) +(* For fans, inverse1_sigma_fan and inverse_sigma_fan_bis are equivalent *) +(* ------------------------------------------------------------------------- *) + +let INVERSE_SIGMA_FAN_EQ_INVERSE1_SIGMA_FAN = prove(`!x V E v w. FAN (x,V,E) /\ {v, w} IN E ==> + inverse1_sigma_fan x V E v w = inverse_sigma_fan x V E v w`, + REPEAT GEN_TAC THEN + DISCH_TAC THEN + FIRST_ASSUM (STRIP_ASSUME_TAC o fun th -> (MATCH_MP FAN_IN_SET_OF_EDGE th)) THEN + MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`] EXTENSION_SIGMA_FAN_INJECTIVE) THEN + ASM_REWRITE_TAC[] THEN + ABBREV_TAC `f = extension_sigma_fan (x:real^3) V E v` THEN + ABBREV_TAC `g = inverse1_sigma_fan (x:real^3) V E v` THEN + ABBREV_TAC `h = inverse_sigma_fan (x:real^3) V E v` THEN + DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`(g:real^3->real^3) w`; `(h:real^3->real^3) w`]) THEN + ANTS_TAC THEN REWRITE_TAC[] THEN + + SUBGOAL_THEN `(f:real^3->real^3) ((g:real^3->real^3) w) = w` ASSUME_TAC THENL + [ + REMOVE_ASSUM THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[Fan.extension_sigma_fan] THEN + MP_TAC (SPECL [`x:real^3`; `V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`] Fan.INVERSE1_SIGMA_FAN) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + REMOVE_ASSUM THEN + REPLICATE_TAC 2 (FIRST_X_ASSUM (MP_TAC o SPEC `w:real^3`)) THEN + ASM_REWRITE_TAC[Fan.set_of_edge; IN_ELIM_THM] THEN + SIMP_TAC[] THEN + ABBREV_TAC `u:real^3 = inverse1_sigma_fan x V E v w` THEN + DISCH_TAC THEN + SUBGOAL_THEN `u:real^3 IN V` (fun th -> SIMP_TAC[th]) THEN + ASM_MESON_TAC[FAN_IN_SET_OF_EDGE]; + ALL_TAC + ] THEN + + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + REPLICATE_TAC 3 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + ASM_MESON_TAC[INVERSE_SIGMA_FAN; FUN_EQ_THM; I_THM; o_THM]);; + + +end;; diff --git a/text_formalization/fan/hypermap_iso-compiled.hl b/text_formalization/fan/hypermap_iso-compiled.hl new file mode 100644 index 0000000..835773d --- /dev/null +++ b/text_formalization/fan/hypermap_iso-compiled.hl @@ -0,0 +1,1174 @@ +needs "Examples/ssrnat-compiled.hl";; + +(* Module Hypermap_iso*) +module Hypermap_iso = struct + +let hyp_iso = new_definition `hyp_iso f (H, G) <=> + BIJ f (dart H) (dart G) /\ + (!x. x IN dart H ==> + edge_map G (f x) = f (edge_map H x) /\ + node_map G (f x) = f (node_map H x) /\ + face_map G (f x) = f (face_map H x))`;; +let res_inv = new_definition `res_inv f s = (\y. @x. f x = y /\ x IN s)`;; +open Ssrfun;; +open Ssrbool;; +open Ssrnat;; +open Fan;; +open Hypermap;; +open Fan_defs;; +open Hypermap_and_fan;; +parse_as_infix("iso",(24,"right"));; +let inE = CONJUNCT2 IN_ELIM_THM;; +let IN_TRANS = prove(`!(x:A) s t. t SUBSET s /\ x IN t ==> x IN s`, SET_TAC[]);; + +(* Lemma bij_disjoint_union *) +let bij_disjoint_union = Sections.section_proof ["f";"g";"s";"t";"s'";"t'"] +`DISJOINT s t /\ DISJOINT s' t' /\ BIJ (f:A->B) s s' /\ BIJ (g:A->B) t t' + ==> BIJ (\x. if x IN s then f x else g x) (s UNION t) (s' UNION t')` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("DISJOINT", [DISJOINT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] [])))))); + (BETA_TAC THEN (case THEN (move ["d_st"])) THEN (case THEN (move ["d_s't'"])) THEN (case THEN ALL_TAC) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["fx"]) THEN (move ["f_inj"]))) THEN (case THEN ((move ["_"]) THEN (move ["f_surj"]))) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["gx"]) THEN (move ["g_inj"]))) THEN (case THEN ((move ["_"]) THEN (move ["g_surj"])))); + ((fun arg_tac -> arg_tac (Arg_term (`x IN t ==> ~(x IN s)`))) (term_tac (have_gen_tac ["x"](move ["x_in_t"])))); + ((BETA_TAC THEN (move ["xt"])) THEN (((use_arg_then2 ("d_st", [])) (disch_tac [])) THEN (clear_assumption "d_st") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (move ["xs"]))); + (((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 ((split_tac)))); + ((THENL_FIRST) (BETA_TAC THEN (move ["x"]) THEN (case THEN (move ["x_in"]))) (((((use_arg_then2 ("x_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("fx", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("x_in_t", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("gx", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["x_in"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["y_in"]))) THEN (((repeat_tactic 0 10 (((use_arg_then2 ("x_in", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("y_in", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("x_in_t", []))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))) THEN (move ["eq"]))); + ((((fun arg_tac -> (use_arg_then2 ("f_inj", [])) (fun fst_arg -> (use_arg_then2 ("eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("d_s't'", [])) (disch_tac [])) THEN (clear_assumption "d_s't'") THEN ((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac) THEN (move ["_"])) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> arg_tac (Arg_term (`f x`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fx", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("gx", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("d_s't'", [])) (disch_tac [])) THEN (clear_assumption "d_s't'") THEN ((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac) THEN (move ["_"])) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> arg_tac (Arg_term (`g x`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("gx", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fx", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("g_inj", [])) (fun fst_arg -> (use_arg_then2 ("eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((THENL_FIRST) (BETA_TAC THEN (move ["x"]) THEN (case THEN (move ["x_in"]))) (((((use_arg_then2 ("x_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("fx", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("x_in_t", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("gx", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (move ["x"]) THEN (case THEN (move ["x_in"]))); + (((fun arg_tac -> (use_arg_then2 ("f_surj", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["y"])) THEN (case THEN ((move ["ys"]) THEN (move ["fy_eq"])))); + (((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("ys", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((fun arg_tac -> (use_arg_then2 ("g_surj", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["y"])) THEN (case THEN ((move ["yt"]) THEN (move ["gy_eq"])))); + (((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("yt", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("x_in_t", [])) (fun fst_arg -> (use_arg_then2 ("yt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma disjoint_diff *) +let disjoint_diff = Sections.section_proof ["s";"t"] +`DISJOINT s (t DIFF s)` +[ + (((((use_arg_then2 ("DISJOINT", [DISJOINT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])); + ((((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("andbA", [andbA]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbAC", [andbAC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbN", [andbN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andFb", [andFb]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma image_lemma *) +let image_lemma = Sections.section_proof ["f";"P"] +`IMAGE f {x | P x} = {f x | P x}` +[ + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("andbC", [andbC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section PowerOrbit *) +Sections.begin_section "PowerOrbit";; +(Sections.add_section_var (mk_var ("f", (`:A -> B`))));; +(Sections.add_section_var (mk_var ("g1", (`:A -> A`))));; +(Sections.add_section_var (mk_var ("g2", (`:B -> B`))));; +(Sections.add_section_var (mk_var ("s", (`:A -> bool`))));; +(Sections.add_section_hyp "g1s" (`!x. x IN s ==> g1 x IN s`));; + +(* Lemma power_in *) +let power_in = Sections.section_proof ["x";"n"] +`x IN s ==> (g1 POWER n) x IN s` +[ + ((THENL_FIRST) ((BETA_TAC THEN (move ["xs"])) THEN ((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["Ih"]))])) (((((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("COM_POWER", [COM_POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("g1s", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(Sections.add_section_hyp "fg" (`!x. x IN s ==> f (g1 x) = g2 (f x)`));; + +(* Lemma power_comm *) +let power_comm = Sections.section_proof ["x";"n"] +`x IN s ==> f ((g1 POWER n) x) = (g2 POWER n) (f x)` +[ + ((THENL_FIRST) ((BETA_TAC THEN (move ["xs"])) THEN ((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["Ih"]))])) (((repeat_tactic 1 9 (((use_arg_then2 ("POWER_0", [POWER_0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("COM_POWER", [COM_POWER]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fg", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("power_in", [power_in]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma orbit_comm *) +let orbit_comm = Sections.section_proof ["x"] +`x IN s ==> orbit_map g2 (f x) = IMAGE f (orbit_map g1 x)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("orbit_map", [orbit_map]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["xs"]) THEN (move ["x"])); + ((THENL) (split_tac) [((case THEN (move ["n"])) THEN (move ["h"])); ((case THEN (move ["y"])) THEN (case THEN (move ["x_eq"])) THEN (case THEN (move ["n"])) THEN (move ["h"]))]); + ((fun arg_tac -> arg_tac (Arg_term (`(g1 POWER n) x`))) (term_tac exists_tac)); + (((((use_arg_then2 ("power_comm", [power_comm]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("n", [])) (term_tac exists_tac)) THEN (done_tac)); + (((use_arg_then2 ("n", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("power_comm", [power_comm]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section PowerOrbit *) +let power_in = Sections.finalize_theorem power_in;; +let power_comm = Sections.finalize_theorem power_comm;; +let orbit_comm = Sections.finalize_theorem orbit_comm;; +Sections.end_section "PowerOrbit";; + +(* Lemma image_ext_eq *) +let image_ext_eq = Sections.section_proof ["f";"g";"s"] +`(!x. x IN s ==> f x = g x) ==> IMAGE f s = IMAGE g s` +[ + ((BETA_TAC THEN (move ["eq"])) THEN (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]))); + (((split_tac) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN (move ["y_eq"])) THEN (move ["xs"])) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma image_res *) +let image_res = Sections.section_proof ["f";"s";"u"] +`s SUBSET u ==> IMAGE f s = IMAGE (res f u) s` +[ + (((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["su"])) THEN (((use_arg_then2 ("image_ext_eq", [image_ext_eq])) (thm_tac apply_tac)) THEN (move ["x"]) THEN (move ["xs"]))); + (((((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("su", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma im_in_image *) +let im_in_image = Sections.section_proof ["f";"s";"x"] +`f x IN IMAGE f s <=> x IN s \/ ?y. y IN s /\ ~(x = y) /\ f x = f y` +[ + ((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN ((THENL) (split_tac) [((case THEN (move ["y"])) THEN (move ["h"])); ALL_TAC])); + (((fun arg_tac -> arg_tac (Arg_term (`x IN s`))) (disch_eq_tac "x_in" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + ((((use_arg_then2 ("x_in", [])) (disch_tac [])) THEN (clear_assumption "x_in") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((THENL) (BETA_TAC THEN ((THENL) case [(move ["x_in"]); ((case THEN (move ["y"])) THEN (move ["h"]))])) [((use_arg_then2 ("x", [])) (term_tac exists_tac)); ((use_arg_then2 ("y", [])) (term_tac exists_tac))]) THEN (done_tac)); +];; + +(* Section InjProps *) +Sections.begin_section "InjProps";; +(Sections.add_section_var (mk_var ("u", (`:A -> bool`))));; +(Sections.add_section_var (mk_var ("f", (`:A -> B`))));; +(Sections.add_section_hyp "inj" (`!x y. x IN u /\ y IN u /\ f x = f y ==> x = y`));; + +(* Lemma image_inter_inj_gen *) +let image_inter_inj_gen = Sections.section_proof ["s";"t"] +`s SUBSET u /\ t SUBSET u + ==> IMAGE f (s INTER t) = IMAGE f s INTER IMAGE f t` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["su"]) THEN (move ["tu"])))); + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"])); + ((THENL) (split_tac) [((case THEN (move ["x"])) THEN (case THEN (move ["y_eq"])) THEN (case THEN ((move ["xs"]) THEN (move ["xt"])))); ((case THEN ALL_TAC) THEN (case THEN (move ["x"])) THEN (case THEN ((move ["y_eq"]) THEN (move ["xs"]))) THEN (case THEN (move ["x'"])) THEN (case THEN ((move ["y_eq'"]) THEN (move ["x't"]))))]); + ((split_tac) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (repeat_tactic 1 9 (((split_tac) THEN ((TRY done_tac)))))); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("inj", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("su", [])) (fun fst_arg -> (use_arg_then2 ("xs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("tu", [])) (fun fst_arg -> (use_arg_then2 ("x't", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y_eq'", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma image_inj_gen *) +let image_inj_gen = Sections.section_proof ["s";"t"] +`s SUBSET u /\ t SUBSET u /\ IMAGE f s = IMAGE f t + ==> s = t` +[ + ((((repeat_tactic 1 9 (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["su"])) THEN (case THEN (move ["tu"])) THEN (move ["eq"]) THEN (move ["y"])) THEN ((split_tac) THEN (move ["y_in"]))); + ((THENL_FIRST) ((((fun arg_tac -> (use_arg_then2 ("iffLR", [iffLR])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("eq", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)) (((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (done_tac))); + (BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN (move ["f_eq"])) THEN (move ["xt"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("inj", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("su", [])) (fun fst_arg -> (use_arg_then2 ("y_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("tu", [])) (fun fst_arg -> (use_arg_then2 ("xt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((THENL_FIRST) ((((fun arg_tac -> (use_arg_then2 ("iffRL", [iffRL])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("eq", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)) (((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (done_tac))); + (BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN (move ["f_eq"])) THEN (move ["xs"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("inj", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("tu", [])) (fun fst_arg -> (use_arg_then2 ("y_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("su", [])) (fun fst_arg -> (use_arg_then2 ("xs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma image_set_inj_gen *) +let image_set_inj_gen = Sections.section_proof ["s";"t"] +`s SUBSET u /\ t SUBSET u /\ IMAGE f s = IMAGE f t ==> s = t` +[ + ((((repeat_tactic 1 9 (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["su"])) THEN (case THEN (move ["tu"])) THEN (move ["i_eq"]) THEN (move ["x"])) THEN ((split_tac) THEN (move ["x_in"]))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`f x IN IMAGE f s`))) (term_tac (have_gen_tac []ALL_TAC))) ((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac))); + (((((use_arg_then2 ("i_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("im_in_image", [im_in_image]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN ((TRY done_tac)) THEN (case THEN (move ["y"])) THEN (case THEN (move ["y_in"])) THEN (case THEN (move ["neq"])) THEN (move ["f_eq"])); + ((((use_arg_then2 ("neq", [])) (disch_tac [])) THEN (clear_assumption "neq") THEN ((use_arg_then2 ("contraR", [contraR])) (disch_tac [])) THEN (clear_assumption "contraR") THEN (DISCH_THEN apply_tac) THEN (move ["_"])) THEN (((use_arg_then2 ("inj", [])) (disch_tac [])) THEN (clear_assumption "inj") THEN (DISCH_THEN apply_tac))); + (((((fun arg_tac -> (use_arg_then2 ("su", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("tu", [])) (fun fst_arg -> (use_arg_then2 ("y_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`f x IN IMAGE f t`))) (term_tac (have_gen_tac []ALL_TAC))) ((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac))); + (((((use_arg_then2 ("i_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("im_in_image", [im_in_image]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN ((TRY done_tac)) THEN (case THEN (move ["y"])) THEN (case THEN (move ["y_in"])) THEN (case THEN (move ["neq"])) THEN (move ["f_eq"])); + ((((use_arg_then2 ("neq", [])) (disch_tac [])) THEN (clear_assumption "neq") THEN ((use_arg_then2 ("contraR", [contraR])) (disch_tac [])) THEN (clear_assumption "contraR") THEN (DISCH_THEN apply_tac) THEN (move ["_"])) THEN (((use_arg_then2 ("inj", [])) (disch_tac [])) THEN (clear_assumption "inj") THEN (DISCH_THEN apply_tac))); + (((((fun arg_tac -> (use_arg_then2 ("su", [])) (fun fst_arg -> (use_arg_then2 ("y_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("tu", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section InjProps *) +let image_inter_inj_gen = Sections.finalize_theorem image_inter_inj_gen;; +let image_inj_gen = Sections.finalize_theorem image_inj_gen;; +let image_set_inj_gen = Sections.finalize_theorem image_set_inj_gen;; +Sections.end_section "InjProps";; + +(* Section FiniteBijections *) +Sections.begin_section "FiniteBijections";; +(Sections.add_section_var (mk_var ("s", (`:A->bool`))));; +(Sections.add_section_var (mk_var ("t", (`:B->bool`))));; + +(* Lemma permutes_imp_bij *) +let permutes_imp_bij = Sections.section_proof ["p"] +`p permutes s ==> BIJ p s s` +[ + ((BETA_TAC THEN (move ["perm"])) THEN ((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("PERMUTES_IN_IMAGE", [PERMUTES_IN_IMAGE])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((THENL_FIRST) ((THENL) (split_tac) [((move ["x"]) THEN (move ["y"]) THEN (case THEN (move ["xs"])) THEN (case THEN (move ["ys"])) THEN (move ["p_eq"])); ((move ["x"]) THEN (move ["xs"]))]) ((((fun arg_tac -> (use_arg_then2 ("PERMUTES_INJECTIVE", [PERMUTES_INJECTIVE])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PERMUTES_SURJECTIVE", [PERMUTES_SURJECTIVE])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["y"])) THEN (move ["p_eq"])) THEN ((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN ((split_tac) THEN ((TRY done_tac)))); + (((((fun arg_tac -> (use_arg_then2 ("PERMUTES_IN_IMAGE", [PERMUTES_IN_IMAGE])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("p_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma surj_image *) +let surj_image = Sections.section_proof ["f"] +`SURJ f s t ==> IMAGE f s = t` +[ + (((((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["f_in"]) THEN (move ["surj"]))) THEN (move ["y"])); + (((THENL) ((THENL) (split_tac) [((case THEN (move ["x"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["xs"])); ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("surj", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["x"])) THEN (case THEN ((move ["xs"]) THEN (move ["eq"]))))]) [(((use_arg_then2 ("f_in", [])) (disch_tac [])) THEN (clear_assumption "f_in") THEN (exact_tac)); ((use_arg_then2 ("x", [])) (term_tac exists_tac))]) THEN (done_tac)); +];; + +(* Lemma surj_imp_finite *) +let surj_imp_finite = Sections.section_proof ["f"] +`FINITE s /\ SURJ f s t ==> FINITE t` +[ + ((BETA_TAC THEN (case THEN (move ["fin_s"])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("surj_image", [surj_image])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE])) (thm_tac apply_tac)) THEN (done_tac)); +];; + +(* Lemma inj_imp_finite *) +let inj_imp_finite = Sections.section_proof ["f"] +`FINITE t /\ INJ f s t ==> FINITE s` +[ + ((((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fin_t"])) THEN (case THEN (move ["f_in"])) THEN (move ["inj"])); + ((((fun arg_tac -> (use_arg_then2 ("FINITE_IMAGE_INJ_EQ", [FINITE_IMAGE_INJ_EQ])) (fun fst_arg -> (use_arg_then2 ("inj", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (fun fst_arg -> (use_arg_then2 ("fin_t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))); + ((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["x"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["xs"])) THEN (((use_arg_then2 ("f_in", [])) (disch_tac [])) THEN (clear_assumption "f_in") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma bij_finite_eq *) +let bij_finite_eq = Sections.section_proof ["f"] +`BIJ f s t ==> (FINITE s <=> FINITE t)` +[ + (((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (move ["bij"])) THEN ((THENL) (split_tac) [(move ["fin_s"]); (move ["fin_t"])])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("surj_imp_finite", [surj_imp_finite])) (fun fst_arg -> (use_arg_then2 ("fin_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("inj_imp_finite", [inj_imp_finite])) (fun fst_arg -> (use_arg_then2 ("fin_t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma surj_imp_card_le *) +let surj_imp_card_le = Sections.section_proof ["f"] +`FINITE s /\ SURJ f s t ==> CARD t <= CARD s` +[ + ((BETA_TAC THEN (case THEN (move ["fin_s"])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("surj_image", [surj_image])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((use_arg_then2 ("CARD_IMAGE_LE", [CARD_IMAGE_LE])) (thm_tac apply_tac)) THEN (done_tac)); +];; + +(* Lemma inj_imp_card_le *) +let inj_imp_card_le = Sections.section_proof ["f"] +`FINITE t /\ INJ f s t ==> CARD s <= CARD t` +[ + ((BETA_TAC THEN (case THEN (move ["fin_t"])) THEN (move ["inj"])) THEN (((use_arg_then2 ("inj", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["f_in"])) THEN (move ["inj2"]))); + ((((fun arg_tac -> (use_arg_then2 ("CARD_IMAGE_INJ", [CARD_IMAGE_INJ])) (fun fst_arg -> (use_arg_then2 ("inj2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("inj_imp_finite", [inj_imp_finite])) (fun fst_arg -> (use_arg_then2 ("inj", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((((use_arg_then2 ("CARD_SUBSET", [CARD_SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fin_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (case THEN (move ["x"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["xs"])) THEN (((use_arg_then2 ("f_in", [])) (disch_tac [])) THEN (clear_assumption "f_in") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma bij_card_eq *) +let bij_card_eq = Sections.section_proof ["f"] +`BIJ f s t /\ FINITE s ==> CARD t = CARD s` +[ + (((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN ((move ["inj"]) THEN (move ["surj"]))) THEN (move ["fin_s"])) THEN (((use_arg_then2 ("anti_leq", [anti_leq])) (disch_tac [])) THEN (clear_assumption "anti_leq") THEN (DISCH_THEN apply_tac))); + (((((fun arg_tac -> (use_arg_then2 ("surj_imp_card_le", [surj_imp_card_le])) (fun fst_arg -> (use_arg_then2 ("surj", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("inj_imp_card_le", [inj_imp_card_le])) (fun fst_arg -> (use_arg_then2 ("inj", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("surj_imp_finite", [surj_imp_finite])) (fun fst_arg -> (use_arg_then2 ("surj", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(Sections.add_section_hyp "fin_s" (`FINITE s`));; +(Sections.add_section_hyp "fin_t" (`FINITE t`));; +(Sections.add_section_hyp "card_eq" (`CARD s = CARD t`));; + +(* Lemma finite_inj_eq_surj *) +let finite_inj_eq_surj = Sections.section_proof ["f"] +`INJ f s t <=> SURJ f s t` +[ + (((((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andb_id2l", [andb_id2l])) (disch_tac [])) THEN (clear_assumption "andb_id2l") THEN (DISCH_THEN apply_tac) THEN (move ["f_in"]))); + ((((use_arg_then2 ("SURJECTIVE_IFF_INJECTIVE_GEN", [SURJECTIVE_IFF_INJECTIVE_GEN]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fin_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fin_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (case THEN (move ["x"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["xs"])) THEN (((use_arg_then2 ("f_in", [])) (disch_tac [])) THEN (clear_assumption "f_in") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma finite_inj_eq_bij *) +let finite_inj_eq_bij = Sections.section_proof ["f"] +`INJ f s t <=> BIJ f s t` +[ + (((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("finite_inj_eq_surj", [finite_inj_eq_surj]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbb", [andbb]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma finite_surj_eq_bij *) +let finite_surj_eq_bij = Sections.section_proof ["f"] +`SURJ f s t <=> BIJ f s t` +[ + (((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("finite_inj_eq_surj", [finite_inj_eq_surj]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbb", [andbb]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section FiniteBijections *) +let permutes_imp_bij = Sections.finalize_theorem permutes_imp_bij;; +let surj_image = Sections.finalize_theorem surj_image;; +let surj_imp_finite = Sections.finalize_theorem surj_imp_finite;; +let inj_imp_finite = Sections.finalize_theorem inj_imp_finite;; +let bij_finite_eq = Sections.finalize_theorem bij_finite_eq;; +let surj_imp_card_le = Sections.finalize_theorem surj_imp_card_le;; +let inj_imp_card_le = Sections.finalize_theorem inj_imp_card_le;; +let bij_card_eq = Sections.finalize_theorem bij_card_eq;; +let finite_inj_eq_surj = Sections.finalize_theorem finite_inj_eq_surj;; +let finite_inj_eq_bij = Sections.finalize_theorem finite_inj_eq_bij;; +let finite_surj_eq_bij = Sections.finalize_theorem finite_surj_eq_bij;; +Sections.end_section "FiniteBijections";; + +(* Section ResInverse *) +Sections.begin_section "ResInverse";; + +(* Lemma bij_alt *) +let bij_alt = Sections.section_proof ["f";"s";"t"] +`BIJ f s t <=> + (!x. x IN s ==> f x IN t) /\ + (!x y. x IN s /\ y IN s /\ f x = f y ==> x = y) /\ + (!y. y IN t ==> ?x. x IN s /\ f x = y)` +[ + (((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbAC", [andbAC]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbA", [andbA]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andbb", [andbb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbAC", [andbAC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Ext *) +Sections.begin_section "Ext";; +(Sections.add_section_var (mk_var ("f", (`:A->B`))); Sections.add_section_var (mk_var ("g", (`:A->B`))));; +(Sections.add_section_var (mk_var ("s", (`:A->bool`))));; +(Sections.add_section_var (mk_var ("t", (`:B->bool`))));; +(Sections.add_section_hyp "ext" (`!x. x IN s ==> f x = g x`));; + +(* Lemma inj_ext *) +let inj_ext = Sections.section_proof [] +`INJ f s t ==> INJ g s t` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["f_in"]) THEN (move ["f_inj"])))) THEN ((THENL) (split_tac) [((move ["x"]) THEN (move ["xs"])); ((move ["x"]) THEN (move ["y"]) THEN (move ["h"]))])); + (((((use_arg_then2 ("ext", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("f_inj", [])) (disch_tac [])) THEN (clear_assumption "f_inj") THEN (DISCH_THEN apply_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ext", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma surj_ext *) +let surj_ext = Sections.section_proof [] +`SURJ f s t ==> SURJ g s t` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["f_in"]) THEN (move ["f_surj"])))) THEN ((THENL) (split_tac) [((move ["x"]) THEN (move ["xs"])); ((move ["x"]) THEN (move ["xt"]))])); + (((((use_arg_then2 ("ext", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> (use_arg_then2 ("f_surj", [])) (fun fst_arg -> (use_arg_then2 ("xt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["y"])) THEN (case THEN ((move ["ys"]) THEN (move ["eq"])))); + (((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("ext", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma bij_ext *) +let bij_ext = Sections.section_proof [] +`BIJ f s t ==> BIJ g s t` +[ + (((THENL) (((repeat_tactic 1 9 (((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] []))))) THEN (move ["h"])) THEN (split_tac)) [(((use_arg_then2 ("inj_ext", [inj_ext])) (disch_tac [])) THEN (clear_assumption "inj_ext") THEN (exact_tac)); (((use_arg_then2 ("surj_ext", [surj_ext])) (disch_tac [])) THEN (clear_assumption "surj_ext") THEN (exact_tac))]) THEN (done_tac)); +];; + +(* Finalization of the section Ext *) +let inj_ext = Sections.finalize_theorem inj_ext;; +let surj_ext = Sections.finalize_theorem surj_ext;; +let bij_ext = Sections.finalize_theorem bij_ext;; +Sections.end_section "Ext";; + +(* Lemma res_inv_left *) +let res_inv_left = Sections.section_proof ["f";"s";"x"] +`(!x y. x IN s /\ y IN s /\ f x = f y ==> x = y) /\ x IN s + ==> res_inv f s (f x) = x` +[ + (((((use_arg_then2 ("res_inv", [res_inv]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN ((move ["inj"]) THEN (move ["xs"])))); + ((((use_arg_then2 ("SELECT_UNIQUE", [SELECT_UNIQUE])) (thm_tac apply_tac)) THEN (simp_tac) THEN (move ["y"])) THEN ((THENL) (split_tac) [(case THEN ((move ["f_eq"]) THEN (move ["ys"]))); ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))])); + ((((fun arg_tac -> (use_arg_then2 ("inj", [])) (fun fst_arg -> (use_arg_then2 ("f_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma res_inv_right *) +let res_inv_right = Sections.section_proof ["f";"s";"t";"y"] +`(!y. y IN t ==> ?x. x IN s /\ f x = y) /\ y IN t + ==> f (res_inv f s y) = y /\ res_inv f s y IN s` +[ + (((((use_arg_then2 ("res_inv", [res_inv]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["surj"])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("surj", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["x"])) THEN (move ["h"])); + ((fun arg_tac -> (use_arg_then2 ("SELECT_AX", [SELECT_AX])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`\x. f x = y /\ x IN s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (simp_tac))); + ((DISCH_THEN apply_tac) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma res_inv_bij *) +let res_inv_bij = Sections.section_proof ["f";"s";"t"] +`BIJ f s t ==> + (!x. x IN s ==> res_inv f s (f x) = x) /\ + (!y. y IN t ==> f (res_inv f s y) = y) /\ + (!y. y IN t ==> res_inv f s y IN s)` +[ + (((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] []))))) THEN (move ["h"])); + (((THENL_FIRST) ((repeat_tactic 1 9 ((split_tac))) THEN (BETA_TAC THEN (move ["a"]) THEN (move ["a_in"]))) ((use_arg_then2 ("res_inv_left", [res_inv_left])) (thm_tac apply_tac))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("res_inv_right", [res_inv_right])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma bij_res_inv *) +let bij_res_inv = Sections.section_proof ["f";"s";"t"] +`BIJ f s t ==> BIJ (res_inv f s) t s` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("bij_alt", [bij_alt]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["f_in"])) THEN (case THEN ((move ["inj"]) THEN (move ["surj"])))); + ((THENL_FIRST) ((THENL) (split_tac) [((move ["x"]) THEN (move ["xt"])); ALL_TAC]) ((((fun arg_tac -> (use_arg_then2 ("res_inv_right", [res_inv_right])) (fun fst_arg -> (use_arg_then2 ("surj", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((THENL_ROT (-1)) ((THENL) (split_tac) [((move ["x"]) THEN (move ["y"]) THEN (case THEN (move ["xt"])) THEN (case THEN (move ["yt"])) THEN (move ["inv_eq"])); ((move ["x"]) THEN (move ["xs"]))])); + (((fun arg_tac -> arg_tac (Arg_term (`f x`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("f_in", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("res_inv_left", [res_inv_left]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("congr1", [congr1])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("inv_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("res_inv_right", [res_inv_right])) (fun fst_arg -> (use_arg_then2 ("surj", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma inj_res_inv_left *) +let inj_res_inv_left = Sections.section_proof ["f";"s";"t";"x"] +`INJ f s t /\ x IN s ==> res_inv f s (f x) = x` +[ + (((((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (move ["h"])) THEN ((((use_arg_then2 ("res_inv_left", [res_inv_left]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (done_tac)); +];; + +(* Lemma surj_res_inv_right *) +let surj_res_inv_right = Sections.section_proof ["f";"s";"t";"y"] +`SURJ f s t /\ y IN t ==> + f (res_inv f s y) = y /\ res_inv f s y IN s` +[ + (((((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] [])))) THEN (move ["h"])) THEN ((repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("res_inv_right", [res_inv_right])) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (done_tac)); +];; + +(* Finalization of the section ResInverse *) +let bij_alt = Sections.finalize_theorem bij_alt;; +let inj_ext = Sections.finalize_theorem inj_ext;; +let surj_ext = Sections.finalize_theorem surj_ext;; +let bij_ext = Sections.finalize_theorem bij_ext;; +let res_inv_left = Sections.finalize_theorem res_inv_left;; +let res_inv_right = Sections.finalize_theorem res_inv_right;; +let res_inv_bij = Sections.finalize_theorem res_inv_bij;; +let bij_res_inv = Sections.finalize_theorem bij_res_inv;; +let inj_res_inv_left = Sections.finalize_theorem inj_res_inv_left;; +let surj_res_inv_right = Sections.finalize_theorem surj_res_inv_right;; +Sections.end_section "ResInverse";; + +(* Section Iso *) +Sections.begin_section "Iso";; + +(* Lemma hyp_iso_imp_iso *) +let hyp_iso_imp_iso = Sections.section_proof ["H";"G";"f"] +`hyp_iso f (H, G) ==> H iso G` +[ + ((((((use_arg_then2 ("hyp_iso", [hyp_iso]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iso", [iso]))(thm_tac (new_rewrite [] []))))) THEN (move ["h"])) THEN ((use_arg_then2 ("f", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma iso_imp_hyp_iso *) +let iso_imp_hyp_iso = Sections.section_proof ["H";"G"] +`H iso G ==> ?f. hyp_iso f (H, G)` +[ + (((((use_arg_then2 ("iso", [iso]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hyp_iso", [hyp_iso]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma h_map_outside *) +let h_map_outside = Sections.section_proof ["H";"x"] +`~(x:A IN dart H) ==> + edge_map H x = x /\ + node_map H x = x /\ + face_map H x = x` +[ + (BETA_TAC THEN (move ["x_n_dart"])); + ((fun arg_tac -> (use_arg_then2 ("hypermap_lemma", [hypermap_lemma])) (fun fst_arg -> (use_arg_then2 ("H", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["h"]))); + ((in_tac ["h"] false (repeat_tactic 1 9 (((use_arg_then2 ("permutes", [permutes]))(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (done_tac)); +];; + +(* Lemma hyp_path_subset *) +let hyp_path_subset = Sections.section_proof ["H";"p";"n"] +`p 0 IN dart H /\ is_path H p n + ==> (!i. i <= n ==> p i IN dart H)` +[ + (((((use_arg_then2 ("lemma_def_path", [lemma_def_path]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("go_one_step", [go_one_step]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["p0_in"])) THEN (move ["h"])); + ((((THENL) elim [ALL_TAC; ((move ["i"]) THEN (move ["Ih"]))]) THEN ((TRY done_tac)) THEN (move ["i_le"])) THEN (in_tac ["i_le"] false (((use_arg_then2 ("LE_SUC_LT", [LE_SUC_LT]))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("i_le", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (repeat_tactic 1 9 (case)) THEN (BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LT_IMP_LE", [LT_IMP_LE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Iso1 *) +Sections.begin_section "Iso1";; +(Sections.add_section_var (mk_var ("H", (`:(A)hypermap`))));; +(Sections.add_section_var (mk_var ("G", (`:(B)hypermap`))));; +(Sections.add_section_var (mk_var ("f", (`:A->B`))));; + +(* Lemma hyp_iso_edge_face *) +let hyp_iso_edge_face = Sections.section_proof [] +`hyp_iso f (H,G) <=> BIJ f (dart H) (dart G) /\ + (!x. x IN dart H ==> edge_map G (f x) = f (edge_map H x) + /\ face_map G (f x) = f (face_map H x))` +[ + ((((use_arg_then2 ("hyp_iso", [hyp_iso]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andb_id2l", [andb_id2l])) (disch_tac [])) THEN (clear_assumption "andb_id2l") THEN (DISCH_THEN apply_tac) THEN (move ["_"])) THEN ((split_tac) THEN (move ["eq"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)))); + ((((use_arg_then2 ("Hypermap.inverse2_hypermap_maps", [Hypermap.inverse2_hypermap_maps]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (use_arg_then2 ("Hypermap.hypermap_lemma", [Hypermap.hypermap_lemma])) (fun fst_arg -> (use_arg_then2 ("G", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["hypG"]))); + ((((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSE_EQ", [PERMUTES_INVERSE_EQ])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dart G`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("Hypermap.lemma_dart_invariant", [Hypermap.lemma_dart_invariant]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSE_EQ", [PERMUTES_INVERSE_EQ])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dart G`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("Hypermap.lemma_dart_invariant", [Hypermap.lemma_dart_invariant]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`edge_map H`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`face_map H`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Hypermap.hypermap_cyclic", [Hypermap.hypermap_cyclic]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma hyp_iso_edge_node *) +let hyp_iso_edge_node = Sections.section_proof [] +`hyp_iso f (H,G) <=> BIJ f (dart H) (dart G) /\ + (!x. x IN dart H ==> edge_map G (f x) = f (edge_map H x) + /\ node_map G (f x) = f (node_map H x))` +[ + ((((use_arg_then2 ("hyp_iso", [hyp_iso]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andb_id2l", [andb_id2l])) (disch_tac [])) THEN (clear_assumption "andb_id2l") THEN (DISCH_THEN apply_tac) THEN (move ["_"])) THEN ((split_tac) THEN (move ["eq"]) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)))); + ((((use_arg_then2 ("Hypermap.inverse2_hypermap_maps", [Hypermap.inverse2_hypermap_maps]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (use_arg_then2 ("Hypermap.hypermap_lemma", [Hypermap.hypermap_lemma])) (fun fst_arg -> (use_arg_then2 ("G", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["hypG"]))); + ((((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSE_EQ", [PERMUTES_INVERSE_EQ])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dart G`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("Hypermap.lemma_dart_invariant", [Hypermap.lemma_dart_invariant]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSE_EQ", [PERMUTES_INVERSE_EQ])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dart G`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("Hypermap.lemma_dart_invariant", [Hypermap.lemma_dart_invariant]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`node_map H`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("o_THM", [o_THM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`edge_map H`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Hypermap.hypermap_lemma", [Hypermap.hypermap_lemma]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(Sections.add_section_hyp "isoHG" (`hyp_iso f (H, G)`));; + +(* Lemma hyp_iso_bij *) +let hyp_iso_bij = Sections.section_proof [] +`BIJ f (dart H) (dart G)` +[ + ((in_tac ["isoHG"] false (((use_arg_then2 ("hyp_iso", [hyp_iso]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma hyp_iso_inj *) +let hyp_iso_inj = Sections.section_proof ["x";"y"] +`x IN dart H /\ y IN dart H /\ f x = f y ==> x = y` +[ + ((((use_arg_then2 ("isoHG", [])) (disch_tac [])) THEN (clear_assumption "isoHG") THEN BETA_TAC) THEN (((((use_arg_then2 ("hyp_iso", [hyp_iso]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bij_alt", [bij_alt]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["_"])) THEN (case THEN (move ["inj"])) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["h"])) THEN (((use_arg_then2 ("inj", [])) (disch_tac [])) THEN (clear_assumption "inj") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma hyp_iso_surj *) +let hyp_iso_surj = Sections.section_proof ["y"] +`y IN dart G ==> ?x. x IN dart H /\ f x = y` +[ + ((((use_arg_then2 ("isoHG", [])) (disch_tac [])) THEN (clear_assumption "isoHG") THEN BETA_TAC) THEN (((((use_arg_then2 ("hyp_iso", [hyp_iso]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bij_alt", [bij_alt]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["surj"]) THEN (move ["_"]) THEN (move ["y"])) THEN (((use_arg_then2 ("surj", [])) (disch_tac [])) THEN (clear_assumption "surj") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma hyp_iso_dart *) +let hyp_iso_dart = Sections.section_proof ["x"] +`x IN dart H ==> f x IN dart G` +[ + ((((use_arg_then2 ("isoHG", [])) (disch_tac [])) THEN (clear_assumption "isoHG") THEN BETA_TAC) THEN (((((use_arg_then2 ("hyp_iso", [hyp_iso]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bij_alt", [bij_alt]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["h"])) THEN (move ["_"]) THEN (move ["_"])) THEN (((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma hyp_iso_SURJ *) +let hyp_iso_SURJ = Sections.section_proof [] +`SURJ f (dart H) (dart G)` +[ + ((((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] [])))) THEN ((split_tac) THEN (move ["x"]) THEN (move ["x_in"])) THEN (((fun arg_tac ->(use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart]))(fun tmp_arg1 -> (use_arg_then2 ("hyp_iso_surj", [hyp_iso_surj]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma hyp_iso_INJ *) +let hyp_iso_INJ = Sections.section_proof [] +`INJ f (dart H) (dart G)` +[ + ((THENL_FIRST) ((((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] [])))) THEN ((THENL) (split_tac) [((move ["x"]) THEN (move ["x_in"])); ((move ["x"]) THEN (move ["y"]))])) ((((use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (disch_tac [])) THEN (clear_assumption "hyp_iso_inj") THEN (exact_tac)); +];; + +(* Lemma hyp_iso_comm *) +let hyp_iso_comm = Sections.section_proof ["x"] +`x IN dart H ==> + edge_map G (f x) = f (edge_map H x) /\ + node_map G (f x) = f (node_map H x) /\ + face_map G (f x) = f (face_map H x)` +[ + ((((use_arg_then2 ("isoHG", [])) (disch_tac [])) THEN (clear_assumption "isoHG") THEN BETA_TAC) THEN ((((use_arg_then2 ("hyp_iso", [hyp_iso]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (move ["_"]) THEN (move ["h"]) THEN (move ["x_in"])) THEN (repeat_tactic 1 9 (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma hyp_iso_inverse_comm *) +let hyp_iso_inverse_comm = Sections.section_proof ["x"] +`x IN dart H + ==> inverse (edge_map G) (f x) = f (inverse (edge_map H) x) + /\ inverse (node_map G) (f x) = f (inverse (node_map H) x) + /\ inverse (face_map G) (f x) = f (inverse (face_map H) x)` +[ + (BETA_TAC THEN (move ["x_in"])); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSE_EQ", [PERMUTES_INVERSE_EQ])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dart G`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("Hypermap.hypermap_lemma", [Hypermap.hypermap_lemma]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("hyp_iso_comm", [hyp_iso_comm]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("Hypermap.lemma_dart_inveriant_under_inverse_maps", [Hypermap.lemma_dart_inveriant_under_inverse_maps]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSES", [PERMUTES_INVERSES])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dart H`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("Hypermap.hypermap_lemma", [Hypermap.hypermap_lemma]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma hyp_iso_inv *) +let hyp_iso_inv = Sections.section_proof [] +`hyp_iso (res_inv f (dart H)) (G, H)` +[ + (((((use_arg_then2 ("hyp_iso", [hyp_iso]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("bij_res_inv", [bij_res_inv])) (fun fst_arg -> (use_arg_then2 ("hyp_iso_bij", [hyp_iso_bij])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["d"]) THEN (move ["d_in"])); + ((fun arg_tac -> (use_arg_then2 ("hyp_iso_surj", [hyp_iso_surj])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["t"]) THEN (case THEN ((move ["t_in"]) THEN (move ["d_eq"]))))))); + (((((use_arg_then2 ("d_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("hyp_iso_comm", [hyp_iso_comm]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("res_inv_bij", [res_inv_bij])) (fun fst_arg -> (use_arg_then2 ("hyp_iso_bij", [hyp_iso_bij])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma hyp_iso_ext *) +let hyp_iso_ext = Sections.section_proof ["g"] +`(!d. d IN (dart H) ==> f d = g d) + ==> hyp_iso g (H, G)` +[ + ((BETA_TAC THEN (move ["ext"])) THEN (((((use_arg_then2 ("hyp_iso", [hyp_iso]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("bij_ext", [bij_ext])) (fun fst_arg -> (use_arg_then2 ("hyp_iso_bij", [hyp_iso_bij])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["d"]) THEN (move ["d_in"]))); + (((repeat_tactic 1 9 (((use_arg_then2 ("ext", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("hyp_iso_comm", [hyp_iso_comm]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("Hypermap.lemma_dart_invariant", [Hypermap.lemma_dart_invariant]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma iso_components *) +let iso_components = Sections.section_proof ["d"] +`d IN dart H ==> + node G (f d) = IMAGE f (node H d) /\ + face G (f d) = IMAGE f (face H d) /\ + edge G (f d) = IMAGE f (edge H d)` +[ + ((((use_arg_then2 ("isoHG", [])) (disch_tac [])) THEN (clear_assumption "isoHG") THEN BETA_TAC) THEN ((((use_arg_then2 ("hyp_iso", [hyp_iso]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["bij"])) THEN (move ["f_eq"]) THEN (move ["d_in"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("node", [node]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("face", [face]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("edge", [edge]))(thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 ((split_tac))) THEN (((fun arg_tac -> (use_arg_then2 ("orbit_comm", [orbit_comm])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN ((split_tac) THEN (move ["x"]) THEN (move ["x_in"])) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma hyp_iso_card_components *) +let hyp_iso_card_components = Sections.section_proof ["x"] +`x IN dart H ==> + CARD (face H x) = CARD (face G (f x)) /\ + CARD (node H x) = CARD (node G (f x)) /\ + CARD (edge H x) = CARD (edge G (f x))` +[ + ((BETA_TAC THEN (move ["x_in"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("iso_components", [iso_components]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((repeat_tactic 1 9 (((use_arg_then2 ("CARD_IMAGE_INJ", [CARD_IMAGE_INJ]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac ->(use_arg_then2 ("EDGE_FINITE", [EDGE_FINITE]))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("FACE_FINITE", [FACE_FINITE]))(fun tmp_arg1 -> (use_arg_then2 ("NODE_FINITE", [NODE_FINITE]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (BETA_TAC THEN (move ["a"]) THEN (move ["b"]) THEN (case THEN (move ["a_in"])) THEN (case THEN (move ["b_in"])) THEN (move ["eq"])) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (fun fst_arg -> (use_arg_then2 ("eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + ((split_tac) THEN ((use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`face H x`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("lemma_face_subset", [lemma_face_subset]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((split_tac) THEN ((use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`node H x`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("lemma_node_subset", [lemma_node_subset]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((split_tac) THEN ((use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`edge H x`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("lemma_edge_subset", [lemma_edge_subset]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma iso_node_set *) +let iso_node_set = Sections.section_proof [] +`node_set G = IMAGE (IMAGE f) (node_set H)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("node_set", [node_set]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_of_orbits", [set_of_orbits]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("node", [node]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["y"])); + ((THENL_ROT (-1)) ((THENL) (split_tac) [((case THEN (move ["d"])) THEN (case THEN (move ["d_in"])) THEN (move ["y_eq"])); ((case THEN (move ["n"])) THEN (case THEN (move ["y_eq"])) THEN (case THEN (move ["d"])) THEN (case THEN (move ["d_in"])) THEN (move ["n_eq"]))])); + ((fun arg_tac -> arg_tac (Arg_term (`f d`))) (term_tac exists_tac)); + (((((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iso_components", [iso_components]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (use_arg_then2 ("hyp_iso_surj", [hyp_iso_surj])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["t"]) THEN (case THEN ((move ["t_in"]) THEN (move ["f_eq"]))))))); + (((fun arg_tac -> arg_tac (Arg_term (`node H t`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("iso_components", [iso_components]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)))); + (((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma iso_edge_set *) +let iso_edge_set = Sections.section_proof [] +`edge_set G = IMAGE (IMAGE f) (edge_set H)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("edge_set", [edge_set]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_of_orbits", [set_of_orbits]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("edge", [edge]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["y"])); + ((THENL_ROT (-1)) ((THENL) (split_tac) [((case THEN (move ["d"])) THEN (case THEN (move ["d_in"])) THEN (move ["y_eq"])); ((case THEN (move ["n"])) THEN (case THEN (move ["y_eq"])) THEN (case THEN (move ["d"])) THEN (case THEN (move ["d_in"])) THEN (move ["n_eq"]))])); + ((fun arg_tac -> arg_tac (Arg_term (`f d`))) (term_tac exists_tac)); + (((((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iso_components", [iso_components]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (use_arg_then2 ("hyp_iso_surj", [hyp_iso_surj])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["t"]) THEN (case THEN ((move ["t_in"]) THEN (move ["f_eq"]))))))); + (((fun arg_tac -> arg_tac (Arg_term (`edge H t`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("iso_components", [iso_components]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)))); + (((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma iso_face_set *) +let iso_face_set = Sections.section_proof [] +`face_set G = IMAGE (IMAGE f) (face_set H)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("face_set", [face_set]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_of_orbits", [set_of_orbits]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("face", [face]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["y"])); + ((THENL_ROT (-1)) ((THENL) (split_tac) [((case THEN (move ["d"])) THEN (case THEN (move ["d_in"])) THEN (move ["y_eq"])); ((case THEN (move ["n"])) THEN (case THEN (move ["y_eq"])) THEN (case THEN (move ["d"])) THEN (case THEN (move ["d_in"])) THEN (move ["n_eq"]))])); + ((fun arg_tac -> arg_tac (Arg_term (`f d`))) (term_tac exists_tac)); + (((((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iso_components", [iso_components]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (use_arg_then2 ("hyp_iso_surj", [hyp_iso_surj])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["t"]) THEN (case THEN ((move ["t_in"]) THEN (move ["f_eq"]))))))); + (((fun arg_tac -> arg_tac (Arg_term (`face H t`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("iso_components", [iso_components]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)))); + (((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma iso_number_of_nodes *) +let iso_number_of_nodes = Sections.section_proof [] +`number_of_nodes G = number_of_nodes H` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("number_of_nodes", [number_of_nodes]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("iso_node_set", [iso_node_set]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CARD_IMAGE_INJ", [CARD_IMAGE_INJ]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("FINITE_HYPERMAP_ORBITS", [FINITE_HYPERMAP_ORBITS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (move ["n1"]) THEN (move ["n2"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("node_set", [node_set]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_of_orbits", [set_of_orbits]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("node", [node]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN ((case THEN ALL_TAC) THEN (move ["d1"]) THEN (move ["n1_eq"]))) THEN (case THEN ((case THEN ALL_TAC) THEN (move ["d2"]) THEN (move ["n2_eq"]))) THEN (move ["i_eq"])); + (((fun arg_tac -> (use_arg_then2 ("image_set_inj_gen", [image_set_inj_gen])) (fun fst_arg -> (use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((((use_arg_then2 ("n1_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("n2_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("lemma_node_subset", [lemma_node_subset]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma iso_number_of_edges *) +let iso_number_of_edges = Sections.section_proof [] +`number_of_edges G = number_of_edges H` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("number_of_edges", [number_of_edges]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("iso_edge_set", [iso_edge_set]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CARD_IMAGE_INJ", [CARD_IMAGE_INJ]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("FINITE_HYPERMAP_ORBITS", [FINITE_HYPERMAP_ORBITS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (move ["n1"]) THEN (move ["n2"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("edge_set", [edge_set]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_of_orbits", [set_of_orbits]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("edge", [edge]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN ((case THEN ALL_TAC) THEN (move ["d1"]) THEN (move ["n1_eq"]))) THEN (case THEN ((case THEN ALL_TAC) THEN (move ["d2"]) THEN (move ["n2_eq"]))) THEN (move ["i_eq"])); + (((fun arg_tac -> (use_arg_then2 ("image_set_inj_gen", [image_set_inj_gen])) (fun fst_arg -> (use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((((use_arg_then2 ("n1_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("n2_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("lemma_edge_subset", [lemma_edge_subset]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma iso_number_of_faces *) +let iso_number_of_faces = Sections.section_proof [] +`number_of_faces G = number_of_faces H` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("number_of_faces", [number_of_faces]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("iso_face_set", [iso_face_set]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CARD_IMAGE_INJ", [CARD_IMAGE_INJ]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("FINITE_HYPERMAP_ORBITS", [FINITE_HYPERMAP_ORBITS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (move ["n1"]) THEN (move ["n2"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("face_set", [face_set]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_of_orbits", [set_of_orbits]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("face", [face]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN ((case THEN ALL_TAC) THEN (move ["d1"]) THEN (move ["n1_eq"]))) THEN (case THEN ((case THEN ALL_TAC) THEN (move ["d2"]) THEN (move ["n2_eq"]))) THEN (move ["i_eq"])); + (((fun arg_tac -> (use_arg_then2 ("image_set_inj_gen", [image_set_inj_gen])) (fun fst_arg -> (use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((((use_arg_then2 ("n1_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("n2_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("lemma_face_subset", [lemma_face_subset]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma iso_plain_imp *) +let iso_plain_imp = Sections.section_proof [] +`plain_hypermap G ==> plain_hypermap H` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("plain_hypermap", [plain_hypermap]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN (move ["g_eq"]) THEN (move ["x"])); + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`x IN dart H`))) (disch_eq_tac "x_in" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((repeat_tactic 1 9 (((use_arg_then2 ("h_map_outside", [h_map_outside]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (disch_tac [])) THEN (clear_assumption "hyp_iso_inj") THEN (DISCH_THEN apply_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("hyp_iso_comm", [hyp_iso_comm]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma iso_edge_nondegenerate_imp *) +let iso_edge_nondegenerate_imp = Sections.section_proof [] +`is_edge_nondegenerate G ==> is_edge_nondegenerate H` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("is_edge_nondegenerate", [is_edge_nondegenerate]))(thm_tac (new_rewrite [] []))))) THEN (move ["g_eq"]) THEN (move ["d"]) THEN (move ["d_in"])); + (((fun arg_tac -> (use_arg_then2 ("g_eq", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac)); + ((((((use_arg_then2 ("hyp_iso_comm", [hyp_iso_comm]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma iso_simple_imp *) +let iso_simple_imp = Sections.section_proof [] +`simple_hypermap G ==> simple_hypermap H` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("simple_hypermap", [simple_hypermap]))(thm_tac (new_rewrite [] []))))) THEN (move ["h"]) THEN (move ["d"]) THEN (move ["d_in"])); + (((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((repeat_tactic 1 9 (((use_arg_then2 ("iso_components", [iso_components]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("image_inter_inj_gen", [image_inter_inj_gen])) (fun fst_arg -> (use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_node_subset", [lemma_node_subset]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_face_subset", [lemma_face_subset]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`{f d} = IMAGE f {d}`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"])); + ((((THENL) (split_tac) [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); ((case THEN (move ["x"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))]) THEN ((TRY done_tac))) THEN ((use_arg_then2 ("d", [])) (term_tac exists_tac)) THEN (done_tac)); + ((BETA_TAC THEN (move ["eq"])) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("image_inj_gen", [image_inj_gen])) (fun fst_arg -> (use_arg_then2 ("eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac))); + (((((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN (move ["_"]))); + ((((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN BETA_TAC) THEN ((((use_arg_then2 ("SUBSET", [SUBSET]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_face_subset", [lemma_face_subset]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma iso_path_imp *) +let iso_path_imp = Sections.section_proof ["p";"n"] +`p 0 IN dart H /\ is_path H p n ==> is_path G (f o p) n` +[ + (BETA_TAC THEN (case THEN ((move ["p0_in"]) THEN (move ["p_path"])))); + ((((use_arg_then2 ("p_path", [])) (disch_tac [])) THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("lemma_def_path", [lemma_def_path]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("go_one_step", [go_one_step]))(thm_tac (new_rewrite [] [])))))) THEN (move ["h"]) THEN (move ["i"]) THEN (move ["i_lt"]))); + ((((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("i_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (repeat_tactic 1 9 (case)) THEN (BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("hyp_iso_comm", [hyp_iso_comm]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_path_subset", [hyp_path_subset])) (fun fst_arg -> (use_arg_then2 ("p_path", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("p0_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LT_IMP_LE", [LT_IMP_LE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma iso_path_inv *) +let iso_path_inv = Sections.section_proof ["q";"n"] +`q 0 IN dart G /\ is_path G q n ==> + ?p. (!i. i <= n ==> q i = f (p i)) /\ p 0 IN dart H /\ is_path H p n` +[ + ((BETA_TAC THEN (case THEN ((move ["q0"]) THEN (move ["q_path"])))) THEN (((use_arg_then2 ("q_path", [])) (disch_tac [])) THEN BETA_TAC)); + ((repeat_tactic 1 9 (((use_arg_then2 ("lemma_def_path", [lemma_def_path]))(thm_tac (new_rewrite [] []))))) THEN (move ["q_path2"])); + (((fun arg_tac -> arg_tac (Arg_term (`res_inv f (dart H) o q`))) (term_tac exists_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))); + ((THENL) (split_tac) [((move ["i"]) THEN (move ["i_le"])); ALL_TAC]); + (((((fun arg_tac -> (use_arg_then2 ("res_inv_right", [res_inv_right])) (fun fst_arg -> (use_arg_then2 ("hyp_iso_surj", [hyp_iso_surj])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_path_subset", [hyp_path_subset])) (fun fst_arg -> (use_arg_then2 ("q_path", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((fun arg_tac -> (use_arg_then2 ("res_inv_right", [res_inv_right])) (fun fst_arg -> (use_arg_then2 ("hyp_iso_surj", [hyp_iso_surj])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_lt"])); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("hyp_path_subset", [hyp_path_subset])) (fun fst_arg -> (use_arg_then2 ("q_path", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("q0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("LT_IMP_LE", [LT_IMP_LE])) (fun fst_arg -> (use_arg_then2 ("i_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("hyp_iso_surj", [hyp_iso_surj])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN ((move ["t"]) THEN (case THEN (move ["t_in"])) THEN (move ["qi_eq"])))))); + ((((use_arg_then2 ("qi_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("res_inv_left", [res_inv_left])) (fun fst_arg -> (use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("q_path2", [])) (fun fst_arg -> (use_arg_then2 ("i_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("go_one_step", [go_one_step]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (case)) THEN (BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("qi_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("hyp_iso_comm", [hyp_iso_comm]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("res_inv_bij", [res_inv_bij])) (fun fst_arg -> (use_arg_then2 ("hyp_iso_bij", [hyp_iso_bij])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("lemma_dart_invariant", [lemma_dart_invariant]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma iso_comb_component *) +let iso_comb_component = Sections.section_proof ["d"] +`d IN dart H ==> + comb_component G (f d) = IMAGE f (comb_component H d)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("comb_component", [comb_component]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("image_lemma", [image_lemma]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("is_in_component", [is_in_component]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((THENL_ROT (-1)) ((BETA_TAC THEN (move ["d_in"]) THEN (move ["z"])) THEN ((THENL) (split_tac) [((case THEN (move ["p"])) THEN (case THEN (move ["n"])) THEN (case THEN (move ["p0_eq"])) THEN (case THEN (move ["pn_eq"])) THEN (move ["pathG"])); ALL_TAC]))); + (BETA_TAC THEN (case THEN (move ["t"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["p"])) THEN (case THEN (move ["n"])) THEN (case THEN (move ["p0_eq"])) THEN (case THEN (move ["pn_eq"])) THEN (move ["path_p"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> arg_tac (Arg_term (`f o p`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("n", [])) (term_tac exists_tac))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("iso_path_imp", [iso_path_imp]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("p0_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) (((fun arg_tac -> (use_arg_then2 ("iso_path_inv", [iso_path_inv])) (fun fst_arg -> (use_arg_then2 ("pathG", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)) (((((use_arg_then2 ("p0_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (BETA_TAC THEN (case THEN (move ["q"])) THEN (case THEN (move ["p_eq"])) THEN (case THEN (move ["q0"])) THEN (move ["path_q"])); + (((fun arg_tac -> arg_tac (Arg_term (`q n`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("p_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("LE_REFL", [LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("pn_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((((use_arg_then2 ("q", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("n", [])) (term_tac exists_tac))) THEN (repeat_tactic 1 9 (((split_tac) THEN ((TRY done_tac)))))); + ((((use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (disch_tac [])) THEN (clear_assumption "hyp_iso_inj") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("p_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("LE_0", [LE_0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma iso_set_part_components *) +let iso_set_part_components = Sections.section_proof [] +`set_of_components G = IMAGE (IMAGE f) (set_of_components H)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("set_of_components", [set_of_components]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_part_components", [set_part_components]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["c"])); + ((THENL) (split_tac) [((case THEN (move ["d"])) THEN (case THEN (move ["d_in"])) THEN (move ["c_eq"])); ((case THEN (move ["c2"])) THEN (case THEN (move ["c_eq"])) THEN (case THEN (move ["t"])) THEN (case THEN (move ["t_in"])) THEN (move ["c2_eq"]))]); + ((fun arg_tac -> (use_arg_then2 ("hyp_iso_surj", [hyp_iso_surj])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["t"]) THEN (case THEN ((move ["t_in"]) THEN (move ["d_eq"]))))))); + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`comb_component H t`))) (term_tac exists_tac)) THEN (split_tac)) (((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN (done_tac))); + (((((use_arg_then2 ("iso_comb_component", [iso_comb_component]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("d_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("c_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`f t`))) (term_tac exists_tac)); + (((((use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("c_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("c2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iso_comb_component", [iso_comb_component]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma iso_number_of_components *) +let iso_number_of_components = Sections.section_proof [] +`number_of_components G = number_of_components H` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("number_of_components", [number_of_components]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("iso_set_part_components", [iso_set_part_components]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CARD_IMAGE_INJ", [CARD_IMAGE_INJ]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("FINITE_HYPERMAP_COMPONENTS", [FINITE_HYPERMAP_COMPONENTS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (move ["n1"]) THEN (move ["n2"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("set_of_components", [set_of_components]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_part_components", [set_part_components]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + (BETA_TAC THEN (case THEN ((case THEN (move ["d1"])) THEN (move ["n1_eq"]))) THEN (case THEN ((case THEN (move ["d2"])) THEN (move ["n2_eq"]))) THEN (move ["i_eq"])); + (((fun arg_tac -> (use_arg_then2 ("image_set_inj_gen", [image_set_inj_gen])) (fun fst_arg -> (use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((((use_arg_then2 ("i_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("n1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("lemma_component_subset", [lemma_component_subset]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma iso_dart *) +let iso_dart = Sections.section_proof [] +`dart G = IMAGE f (dart H)` +[ + ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (move ["d"])) THEN ((THENL) (split_tac) [(move ["d_in"]); ((case THEN (move ["t"])) THEN (case THEN ((move ["d_eq"]) THEN (move ["t_in"]))))])); + ((fun arg_tac -> (use_arg_then2 ("hyp_iso_surj", [hyp_iso_surj])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["t"]) THEN (move ["h"]))))); + (((use_arg_then2 ("t", [])) (term_tac exists_tac)) THEN (done_tac)); + (((((use_arg_then2 ("d_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma iso_card_dart *) +let iso_card_dart = Sections.section_proof [] +`CARD (dart G) = CARD (dart H)` +[ + (((((use_arg_then2 ("iso_dart", [iso_dart]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CARD_IMAGE_INJ", [CARD_IMAGE_INJ]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("hypermap_lemma", [hypermap_lemma]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (disch_tac [])) THEN (clear_assumption "hyp_iso_inj") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma iso_planar_imp *) +let iso_planar_imp = Sections.section_proof [] +`planar_hypermap G ==> planar_hypermap H` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("planar_hypermap", [planar_hypermap]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("iso_card_dart", [iso_card_dart]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("iso_number_of_edges", [iso_number_of_edges]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iso_number_of_nodes", [iso_number_of_nodes]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iso_number_of_faces", [iso_number_of_faces]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iso_number_of_components", [iso_number_of_components]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma iso_connected_imp *) +let iso_connected_imp = Sections.section_proof [] +`connected_hypermap G ==> connected_hypermap H` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("connected_hypermap", [connected_hypermap]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("iso_number_of_components", [iso_number_of_components]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Iso1 *) +let hyp_iso_edge_face = Sections.finalize_theorem hyp_iso_edge_face;; +let hyp_iso_edge_node = Sections.finalize_theorem hyp_iso_edge_node;; +let hyp_iso_bij = Sections.finalize_theorem hyp_iso_bij;; +let hyp_iso_inj = Sections.finalize_theorem hyp_iso_inj;; +let hyp_iso_surj = Sections.finalize_theorem hyp_iso_surj;; +let hyp_iso_dart = Sections.finalize_theorem hyp_iso_dart;; +let hyp_iso_SURJ = Sections.finalize_theorem hyp_iso_SURJ;; +let hyp_iso_INJ = Sections.finalize_theorem hyp_iso_INJ;; +let hyp_iso_comm = Sections.finalize_theorem hyp_iso_comm;; +let hyp_iso_inverse_comm = Sections.finalize_theorem hyp_iso_inverse_comm;; +let hyp_iso_inv = Sections.finalize_theorem hyp_iso_inv;; +let hyp_iso_ext = Sections.finalize_theorem hyp_iso_ext;; +let iso_components = Sections.finalize_theorem iso_components;; +let hyp_iso_card_components = Sections.finalize_theorem hyp_iso_card_components;; +let iso_node_set = Sections.finalize_theorem iso_node_set;; +let iso_edge_set = Sections.finalize_theorem iso_edge_set;; +let iso_face_set = Sections.finalize_theorem iso_face_set;; +let iso_number_of_nodes = Sections.finalize_theorem iso_number_of_nodes;; +let iso_number_of_edges = Sections.finalize_theorem iso_number_of_edges;; +let iso_number_of_faces = Sections.finalize_theorem iso_number_of_faces;; +let iso_plain_imp = Sections.finalize_theorem iso_plain_imp;; +let iso_edge_nondegenerate_imp = Sections.finalize_theorem iso_edge_nondegenerate_imp;; +let iso_simple_imp = Sections.finalize_theorem iso_simple_imp;; +let iso_path_imp = Sections.finalize_theorem iso_path_imp;; +let iso_path_inv = Sections.finalize_theorem iso_path_inv;; +let iso_comb_component = Sections.finalize_theorem iso_comb_component;; +let iso_set_part_components = Sections.finalize_theorem iso_set_part_components;; +let iso_number_of_components = Sections.finalize_theorem iso_number_of_components;; +let iso_dart = Sections.finalize_theorem iso_dart;; +let iso_card_dart = Sections.finalize_theorem iso_card_dart;; +let iso_planar_imp = Sections.finalize_theorem iso_planar_imp;; +let iso_connected_imp = Sections.finalize_theorem iso_connected_imp;; +Sections.end_section "Iso1";; +(Sections.add_section_type (mk_var ("H", (`:(C)hypermap`))));; +(Sections.add_section_type (mk_var ("G", (`:(D)hypermap`))));; + +(* Lemma iso_plain *) +let iso_plain = Sections.section_proof ["H";"G"] +`H iso G ==> (plain_hypermap H <=> plain_hypermap G)` +[ + ((BETA_TAC THEN (move ["iso"])) THEN ((split_tac) THEN (move ["h"])) THEN ((fun arg_tac -> (use_arg_then2 ("iso_plain_imp", [iso_plain_imp])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("iso_imp_hyp_iso", [iso_imp_hyp_iso]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("iso_sym", [iso_sym]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma iso_edge_nondegenerate *) +let iso_edge_nondegenerate = Sections.section_proof ["H";"G"] +`H iso G ==> (is_edge_nondegenerate H <=> is_edge_nondegenerate G)` +[ + ((BETA_TAC THEN (move ["iso"])) THEN ((split_tac) THEN (move ["h"])) THEN ((fun arg_tac -> (use_arg_then2 ("iso_edge_nondegenerate_imp", [iso_edge_nondegenerate_imp])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("iso_imp_hyp_iso", [iso_imp_hyp_iso]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("iso_sym", [iso_sym]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma iso_simple *) +let iso_simple = Sections.section_proof ["H";"G"] +`H iso G ==> (simple_hypermap H <=> simple_hypermap G)` +[ + ((BETA_TAC THEN (move ["iso"])) THEN ((split_tac) THEN (move ["h"])) THEN ((fun arg_tac -> (use_arg_then2 ("iso_simple_imp", [iso_simple_imp])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("iso_imp_hyp_iso", [iso_imp_hyp_iso]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("iso_sym", [iso_sym]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma iso_planar *) +let iso_planar = Sections.section_proof ["H";"G"] +`H iso G ==> (planar_hypermap H <=> planar_hypermap G)` +[ + ((BETA_TAC THEN (move ["iso"])) THEN ((split_tac) THEN (move ["h"])) THEN ((fun arg_tac -> (use_arg_then2 ("iso_planar_imp", [iso_planar_imp])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("iso_imp_hyp_iso", [iso_imp_hyp_iso]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("iso_sym", [iso_sym]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma iso_connected *) +let iso_connected = Sections.section_proof ["H";"G"] +`H iso G ==> (connected_hypermap H <=> connected_hypermap G)` +[ + ((BETA_TAC THEN (move ["iso"])) THEN ((split_tac) THEN (move ["h"])) THEN ((fun arg_tac -> (use_arg_then2 ("iso_connected_imp", [iso_connected_imp])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("iso_imp_hyp_iso", [iso_imp_hyp_iso]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("iso_sym", [iso_sym]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Iso *) +let hyp_iso_imp_iso = Sections.finalize_theorem hyp_iso_imp_iso;; +let iso_imp_hyp_iso = Sections.finalize_theorem iso_imp_hyp_iso;; +let h_map_outside = Sections.finalize_theorem h_map_outside;; +let hyp_path_subset = Sections.finalize_theorem hyp_path_subset;; +let hyp_iso_edge_face = Sections.finalize_theorem hyp_iso_edge_face;; +let hyp_iso_edge_node = Sections.finalize_theorem hyp_iso_edge_node;; +let hyp_iso_bij = Sections.finalize_theorem hyp_iso_bij;; +let hyp_iso_inj = Sections.finalize_theorem hyp_iso_inj;; +let hyp_iso_surj = Sections.finalize_theorem hyp_iso_surj;; +let hyp_iso_dart = Sections.finalize_theorem hyp_iso_dart;; +let hyp_iso_SURJ = Sections.finalize_theorem hyp_iso_SURJ;; +let hyp_iso_INJ = Sections.finalize_theorem hyp_iso_INJ;; +let hyp_iso_comm = Sections.finalize_theorem hyp_iso_comm;; +let hyp_iso_inverse_comm = Sections.finalize_theorem hyp_iso_inverse_comm;; +let hyp_iso_inv = Sections.finalize_theorem hyp_iso_inv;; +let hyp_iso_ext = Sections.finalize_theorem hyp_iso_ext;; +let iso_components = Sections.finalize_theorem iso_components;; +let hyp_iso_card_components = Sections.finalize_theorem hyp_iso_card_components;; +let iso_node_set = Sections.finalize_theorem iso_node_set;; +let iso_edge_set = Sections.finalize_theorem iso_edge_set;; +let iso_face_set = Sections.finalize_theorem iso_face_set;; +let iso_number_of_nodes = Sections.finalize_theorem iso_number_of_nodes;; +let iso_number_of_edges = Sections.finalize_theorem iso_number_of_edges;; +let iso_number_of_faces = Sections.finalize_theorem iso_number_of_faces;; +let iso_plain_imp = Sections.finalize_theorem iso_plain_imp;; +let iso_edge_nondegenerate_imp = Sections.finalize_theorem iso_edge_nondegenerate_imp;; +let iso_simple_imp = Sections.finalize_theorem iso_simple_imp;; +let iso_path_imp = Sections.finalize_theorem iso_path_imp;; +let iso_path_inv = Sections.finalize_theorem iso_path_inv;; +let iso_comb_component = Sections.finalize_theorem iso_comb_component;; +let iso_set_part_components = Sections.finalize_theorem iso_set_part_components;; +let iso_number_of_components = Sections.finalize_theorem iso_number_of_components;; +let iso_dart = Sections.finalize_theorem iso_dart;; +let iso_card_dart = Sections.finalize_theorem iso_card_dart;; +let iso_planar_imp = Sections.finalize_theorem iso_planar_imp;; +let iso_connected_imp = Sections.finalize_theorem iso_connected_imp;; +let iso_plain = Sections.finalize_theorem iso_plain;; +let iso_edge_nondegenerate = Sections.finalize_theorem iso_edge_nondegenerate;; +let iso_simple = Sections.finalize_theorem iso_simple;; +let iso_planar = Sections.finalize_theorem iso_planar;; +let iso_connected = Sections.finalize_theorem iso_connected;; +Sections.end_section "Iso";; + +(* Section FanHypermapsIso *) +Sections.begin_section "FanHypermapsIso";; + +(* Lemma fan_in_e_imp_neq *) +let fan_in_e_imp_neq = Sections.section_proof ["V";"E";"v";"w"] +`FAN (vec 0,V,E) /\ {v, w} IN E ==> ~(v = w)` +[ + (((((use_arg_then2 ("FAN", [FAN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("graph", [graph]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN", [IN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["_"])) THEN (case THEN (move ["size2"])) THEN (move ["_"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("size2", [])) (thm_tac (match_mp_then snd_th MP_TAC))))); + (((((use_arg_then2 ("Geomdetail.CARD2", [Geomdetail.CARD2]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma in_set_of_edge_neq *) +let in_set_of_edge_neq = Sections.section_proof ["V";"E";"v";"w"] +`FAN (vec 0,V,E) /\ w IN set_of_edge v V E ==> ~(v = w)` +[ + (((((use_arg_then2 ("set_of_edge", [set_of_edge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["fan"])) THEN (case THEN (move ["vwE"])) THEN (move ["_"])); + (((fun arg_tac -> (use_arg_then2 ("fan_in_e_imp_neq", [fan_in_e_imp_neq])) (fun fst_arg -> (use_arg_then2 ("fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +];; + +(* Lemma dart_of_fan_eq *) +let dart_of_fan_eq = Sections.section_proof ["V";"E"] +`dart_of_fan (V,E) = dart1_of_fan (V,E) UNION {(v,v) | v IN V /\ set_of_edge v V E = {}}` +[ + (((((use_arg_then2 ("dart_of_fan", [dart_of_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_of_fan", [dart1_of_fan]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL UNION_ACI)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma darts_of_fan_disj *) +let darts_of_fan_disj = Sections.section_proof ["V";"E"] +`FAN (vec 0,V,E) ==> + DISJOINT (dart1_of_fan (V,E)) {(v,v) | v IN V /\ set_of_edge v V E = {}}` +[ + (((((use_arg_then2 ("DISJOINT", [DISJOINT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (move ["fan"]) THEN (move ["x"])); + (((fun arg_tac -> arg_tac (Arg_term (`x IN _`))) (disch_eq_tac "x_in" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((use_arg_then2 ("x_in", [])) (disch_tac [])) THEN (clear_assumption "x_in") THEN BETA_TAC) THEN (((((use_arg_then2 ("dart1_of_fan", [dart1_of_fan]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["v"])) THEN (case THEN (move ["w"])) THEN (case THEN (move ["vw_in"])) THEN (move ["x_eq"]))); + (((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN (clear_assumption "vw_in") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN ALL_TAC THEN (case THEN (move ["u"])) THEN (case THEN (move ["_"])) THEN (move ["x_eq2"])); + (((fun arg_tac -> (use_arg_then2 ("fan_in_e_imp_neq", [fan_in_e_imp_neq])) (fun fst_arg -> (use_arg_then2 ("fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (move ["in_e"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("NOT_FORALL_THM", [NOT_FORALL_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("negb_imply", [negb_imply]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("w", [])) (term_tac exists_tac)))); + (((((use_arg_then2 ("in_e", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("x_eq2", [])) (disch_tac [])) THEN (clear_assumption "x_eq2") THEN BETA_TAC) THEN (((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac)); +];; + +(* Lemma dart1_of_fan_eq_image *) +let dart1_of_fan_eq_image = Sections.section_proof ["V";"E"] +`dart1_of_fan (V,E) = IMAGE contracted_dart (d1_fan (vec 0,V,E))` +[ + (((((use_arg_then2 ("dart1_of_fan", [dart1_of_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d1_fan", [d1_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["d"])); + ((THENL) (split_tac) [((case THEN (move ["v"])) THEN (case THEN (move ["w"])) THEN (case THEN (move ["in_e"])) THEN (move ["d_eq"])); ((case THEN (move ["x"])) THEN (case THEN (move ["d_eq"])) THEN (case THEN (move ["x'"])) THEN (case THEN (move ["v"])) THEN (case THEN (move ["w"])) THEN (case THEN (move ["w1"])) THEN (case THEN ALL_TAC) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (case THEN (move ["in_e"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["x_eq"]))]); + ((fun arg_tac -> arg_tac (Arg_term (`vec 0, v, w, sigma_fan (vec 0) V E v w`))) (term_tac exists_tac)); + ((((use_arg_then2 ("contracted_dart", [contracted_dart]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("w", [])) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E v w`))) (term_tac exists_tac))) THEN (done_tac)); + ((((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("w", [])) (term_tac exists_tac))) THEN ((((use_arg_then2 ("in_e", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("contracted_dart", [contracted_dart]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dart2_of_fan_eq_image *) +let dart2_of_fan_eq_image = Sections.section_proof ["V";"E"] +`{(v,v) | v IN V /\ set_of_edge v V E = {}} = IMAGE contracted_dart (d20_fan (vec 0,V,E))` +[ + (((((use_arg_then2 ("d20_fan", [d20_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN", [IN]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["d"])); + ((THENL) (split_tac) [((case THEN (move ["v"])) THEN (case THEN (move ["h"])) THEN (move ["d_eq"])); ((case THEN (move ["x"])) THEN (case THEN (move ["d_eq"])) THEN (case THEN (move ["x'"])) THEN (case THEN (move ["v"])) THEN (case THEN (move ["h"])) THEN (move ["x_eq"]))]); + ((fun arg_tac -> arg_tac (Arg_term (`vec 0, v, v, v`))) (term_tac exists_tac)); + ((((use_arg_then2 ("contracted_dart", [contracted_dart]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("v", [])) (term_tac exists_tac))) THEN (done_tac)); + (((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("d_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("contracted_dart", [contracted_dart]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma disjoint_preimage *) +let disjoint_preimage = Sections.section_proof ["f";"s";"t"] +`DISJOINT (IMAGE f s) (IMAGE f t) ==> DISJOINT s t` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("DISJOINT", [DISJOINT]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("CONTRAPOS_THM", [CONTRAPOS_THM]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))))); + (BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN ((move ["xs"]) THEN (move ["xt"])))); + (((fun arg_tac -> arg_tac (Arg_term (`f x`))) (term_tac exists_tac)) THEN (split_tac) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma darts_of_fan_disj1 *) +let darts_of_fan_disj1 = Sections.section_proof ["V";"E"] +`FAN (vec 0,V,E) ==> + DISJOINT (d1_fan (vec 0,V,E)) (d20_fan (vec 0,V,E))` +[ + ((BETA_TAC THEN (move ["fan"])) THEN (((fun arg_tac -> (use_arg_then2 ("disjoint_preimage", [disjoint_preimage])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`contracted_dart`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("dart1_of_fan_eq_image", [dart1_of_fan_eq_image]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart2_of_fan_eq_image", [dart2_of_fan_eq_image]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("darts_of_fan_disj", [darts_of_fan_disj]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma bij_contracted_dart1 *) +let bij_contracted_dart1 = Sections.section_proof ["V";"E"] +`BIJ contracted_dart (d1_fan (vec 0,V,E)) (dart1_of_fan (V,E))` +[ + ((((use_arg_then2 ("bij_alt", [bij_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d1_fan", [d1_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_of_fan", [dart1_of_fan]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + (repeat_tactic 1 9 ((split_tac))); + (BETA_TAC THEN (move ["x"]) THEN (case THEN (move ["x'"])) THEN (case THEN (move ["v"])) THEN (case THEN (move ["w"])) THEN (case THEN (move ["w1"])) THEN (case THEN ALL_TAC) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (case THEN (move ["in_e"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["x_eq"])); + ((((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("w", [])) (term_tac exists_tac))) THEN ((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("contracted_dart", [contracted_dart]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["x'"])) THEN (case THEN (move ["v"])) THEN (case THEN (move ["w"])) THEN (case THEN (move ["w1"])) THEN (case THEN (move ["h"])) THEN (move ["x_eq"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["y'"])) THEN (case THEN (move ["v'"])) THEN (case THEN (move ["w'"])) THEN (case THEN (move ["w1'"])) THEN (case THEN (move ["h'"])) THEN (move ["y_eq"])); + (((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("contracted_dart", [contracted_dart]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["v_eq"]) THEN (move ["w_eq"])))); + (((repeat_tactic 1 9 (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("h'", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["v"])) THEN (case THEN (move ["w"])) THEN (case THEN (move ["in_e"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`vec 0, v, w, sigma_fan (vec 0) V E v w`))) (term_tac exists_tac)); + ((((use_arg_then2 ("contracted_dart", [contracted_dart]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("w", [])) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E v w`))) (term_tac exists_tac))) THEN (done_tac)); +];; + +(* Lemma bij_contracted_dart2 *) +let bij_contracted_dart2 = Sections.section_proof ["V";"E"] +`BIJ contracted_dart (d20_fan (vec 0,V,E)) {(v,v) | v IN V /\ set_of_edge v V E = {}}` +[ + ((((use_arg_then2 ("bij_alt", [bij_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d20_fan", [d20_fan]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN", [IN]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (repeat_tactic 1 9 ((split_tac))); + (BETA_TAC THEN (move ["x"]) THEN (case THEN (move ["x'"])) THEN (case THEN (move ["v"])) THEN (case THEN (move ["h"])) THEN (move ["x_eq"])); + (((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("contracted_dart", [contracted_dart]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["x'"])) THEN (case THEN (move ["v"])) THEN (case THEN (move ["h"])) THEN (move ["x_eq"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["y'"])) THEN (case THEN (move ["v'"])) THEN (case THEN (move ["h'"])) THEN (move ["y_eq"])); + ((((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("contracted_dart", [contracted_dart]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h'", []))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["y"]) THEN (case THEN (move ["v"])) THEN (case THEN (move ["h"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`vec 0, v, v, v`))) (term_tac exists_tac))); + ((((use_arg_then2 ("contracted_dart", [contracted_dart]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("v", [])) (term_tac exists_tac))) THEN (done_tac)); +];; + +(* Section Iso *) +Sections.begin_section "Iso";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_hyp "fan" (`FAN (vec 0,V,E)`));; + +(* Lemma bij_contracted_dart *) +let bij_contracted_dart = Sections.section_proof [] +`BIJ contracted_dart (d_fan (vec 0,V,E)) (dart_of_fan (V,E))` +[ + ((fun arg_tac -> arg_tac (Arg_term (`contracted_dart = \t. if t IN d1_fan (vec 0,V,E) then contracted_dart t else contracted_dart t`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("if_same", [if_same]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("d_fan", [d_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart_of_fan_eq", [dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bij_disjoint_union", [bij_disjoint_union]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("darts_of_fan_disj", [darts_of_fan_disj]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("darts_of_fan_disj1", [darts_of_fan_disj1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("bij_contracted_dart1", [bij_contracted_dart1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bij_contracted_dart2", [bij_contracted_dart2]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma hypermap_of_fan_rep_alt *) +let hypermap_of_fan_rep_alt = Sections.section_proof [] +`dart (hypermap1_of_fanx (vec 0,V,E)) = d_fan (vec 0,V,E) + /\ edge_map (hypermap1_of_fanx (vec 0,V,E)) = res (e_fan (vec 0) V E) (d1_fan (vec 0,V,E)) + /\ node_map (hypermap1_of_fanx (vec 0,V,E)) = res (n_fan (vec 0) V E) (d1_fan (vec 0,V,E)) + /\ face_map (hypermap1_of_fanx (vec 0,V,E)) = res (f1_fan (vec 0) V E) (d1_fan (vec 0,V,E))` +[ + ((fun arg_tac -> (use_arg_then2 ("hypermap_of_fan_rep", [hypermap_of_fan_rep])) (fun fst_arg -> (use_arg_then2 ("fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((fun arg_tac -> arg_tac (Arg_term (`\t. _ t`))) (term_tac (set_tac "p"))) THEN (((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("p", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC) THEN ((ANTS_TAC) THEN ((TRY done_tac)) THEN (move ["eq"]))); + (((repeat_tactic 1 9 (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("p_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma fan_hypermaps_iso_explicit *) +let fan_hypermaps_iso_explicit = Sections.section_proof [] +`hyp_iso contracted_dart (hypermap1_of_fanx (vec 0,V,E), hypermap_of_fan (V,E))` +[ + ((((use_arg_then2 ("hyp_iso", [hyp_iso]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("hypermap_of_fan_rep_alt", [hypermap_of_fan_rep_alt]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("bij_contracted_dart", [bij_contracted_dart]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("d_fan", [d_fan]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`x IN d20_fan (vec 0,V,E) ==> ~(x IN d1_fan (vec 0,V,E))`))) (term_tac (have_gen_tac ["x"](move ["x_in_d2"])))); + ((BETA_TAC THEN (move ["x2"])) THEN (((fun arg_tac -> (use_arg_then2 ("darts_of_fan_disj1", [darts_of_fan_disj1])) (fun fst_arg -> (use_arg_then2 ("fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (move ["x1"]))); + (((((use_arg_then2 ("DISJOINT", [DISJOINT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); + ((THENL_ROT (-1)) (((((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (move ["x"]) THEN (case THEN (move ["x_in"]))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("res", [res]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("x_in", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("x_in_d2", []))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))))); + ((((use_arg_then2 ("x_in", [])) (disch_tac [])) THEN (clear_assumption "x_in") THEN BETA_TAC) THEN (((((use_arg_then2 ("d20_fan", [d20_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["x'"])) THEN (case THEN (move ["v"])) THEN (case THEN (move ["h"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("contracted_dart", [contracted_dart]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_fan_pair_ext", [e_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_fan_pair_ext", [n_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("NOT_IN_DART1_OF_FAN", [NOT_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("x_in", [])) (disch_tac [])) THEN (clear_assumption "x_in") THEN BETA_TAC) THEN (((((use_arg_then2 ("d1_fan", [d1_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["x'"])) THEN (case THEN (move ["v"])) THEN (case THEN (move ["w"])) THEN (case THEN (move ["w1"])) THEN (case THEN (move ["h"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("e_fan", [e_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_fan", [n_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f1_fan", [f1_fan]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("contracted_dart", [contracted_dart]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("e_fan_pair_ext", [e_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_fan_pair_ext", [n_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))))); + (((((use_arg_then2 ("dart1_of_fan", [dart1_of_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("w", [])) (term_tac exists_tac))) THEN (done_tac)); + ((((use_arg_then2 ("e_fan_pair", [e_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_fan_pair", [n_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((((use_arg_then2 ("Fan_misc.INVERSE_SIGMA_FAN_EQ_INVERSE1_SIGMA_FAN", [Fan_misc.INVERSE_SIGMA_FAN_EQ_INVERSE1_SIGMA_FAN]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Collect_geom.PER_SET2)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fan_hypermaps_iso *) +let fan_hypermaps_iso = Sections.section_proof [] +`(hypermap1_of_fanx (vec 0,V,E)) iso (hypermap_of_fan (V,E))` +[ + (((fun arg_tac -> (use_arg_then2 ("hyp_iso_imp_iso", [hyp_iso_imp_iso])) (fun fst_arg -> (use_arg_then2 ("fan_hypermaps_iso_explicit", [fan_hypermaps_iso_explicit])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +];; +let ext_dart = new_definition + `ext_dart (V,E) (v,w) = (vec 0,v,w,extension_sigma_fan (vec 0) V E v w)`;; + +(* Lemma ext_dart_eq_inv_contracted_dart *) +let ext_dart_eq_inv_contracted_dart = Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) + ==> ext_dart (V,E) d = res_inv contracted_dart (d_fan (vec 0,V,E)) d` +[ + ((((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"])) THEN ((((use_arg_then2 ("ext_dart", [ext_dart]))(thm_tac (new_rewrite [] [])))) THEN (move ["vw_in"]))); + ((fun arg_tac -> arg_tac (Arg_term (`extension_sigma_fan _ V E v w`))) (term_tac (set_tac "w1"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`(v,w) = contracted_dart (vec 0:real^3,v,w,w1:real^3)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("contracted_dart", [contracted_dart]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((((use_arg_then2 ("res_inv_left", [res_inv_left]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((THENL) (split_tac) [((move ["x"]) THEN (move ["y"]) THEN (move ["h"])); ALL_TAC])); + ((use_arg_then2 ("bij_contracted_dart", [bij_contracted_dart])) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["_"])) THEN (move ["h2"]) THEN (move ["_"])) THEN (((use_arg_then2 ("h2", [])) (disch_tac [])) THEN (clear_assumption "h2") THEN (DISCH_THEN apply_tac)) THEN (done_tac)); + ((((use_arg_then2 ("w1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("extension_sigma_fan", [extension_sigma_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_fan", [d_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`w IN set_of_edge v V E`))) (disch_eq_tac "w_in" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((((use_arg_then2 ("d1_fan", [d1_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (DISJ1_TAC)); + ((((fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("w", [])) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E v w`))) (term_tac exists_tac))) THEN (simp_tac)); + ((((fun arg_tac -> (use_arg_then2 ("properties_of_set_of_edge_fan", [properties_of_set_of_edge_fan])) (fun fst_arg -> (use_arg_then2 ("fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((use_arg_then2 ("d20_fan", [d20_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (DISJ2_TAC)); + ((((fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("v", [])) (term_tac exists_tac))) THEN (simp_tac)); + ((((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN (clear_assumption "vw_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("dart_of_fan", [dart_of_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN case); + ((BETA_TAC THEN (case THEN (move ["v'"]))) THEN (((((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN", [IN]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["h"])) THEN (move ["eq"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["v'"])) THEN (case THEN (move ["w'"]))); + (((((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("properties_of_set_of_edge_fan", [properties_of_set_of_edge_fan])) (fun fst_arg -> (use_arg_then2 ("fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["h"])) THEN (move ["eq"])); + ((((use_arg_then2 ("w_in", [])) (disch_tac [])) THEN (clear_assumption "w_in") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fan_hypermaps_iso_explicit2 *) +let fan_hypermaps_iso_explicit2 = Sections.section_proof [] +`hyp_iso (ext_dart (V,E)) (hypermap_of_fan (V,E),hypermap1_of_fanx (vec 0,V,E))` +[ + ((fun arg_tac -> (use_arg_then2 ("hyp_iso_inv", [hyp_iso_inv])) (fun fst_arg -> (use_arg_then2 ("fan_hypermaps_iso_explicit", [fan_hypermaps_iso_explicit])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["iso"]))); + (((fun arg_tac -> (use_arg_then2 ("hyp_iso_ext", [hyp_iso_ext])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((((use_arg_then2 ("hypermap_of_fan_rep_alt", [hypermap_of_fan_rep_alt]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (move ["d"]) THEN (move ["d_in"])); + ((((use_arg_then2 ("ext_dart_eq_inv_contracted_dart", [ext_dart_eq_inv_contracted_dart]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma fan_hypermaps_iso2 *) +let fan_hypermaps_iso2 = Sections.section_proof [] +`(hypermap_of_fan (V,E)) iso (hypermap1_of_fanx (vec 0,V,E))` +[ + (((fun arg_tac -> (use_arg_then2 ("hyp_iso_imp_iso", [hyp_iso_imp_iso])) (fun fst_arg -> (use_arg_then2 ("fan_hypermaps_iso_explicit2", [fan_hypermaps_iso_explicit2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +];; + +(* Finalization of the section Iso *) +let bij_contracted_dart = Sections.finalize_theorem bij_contracted_dart;; +let hypermap_of_fan_rep_alt = Sections.finalize_theorem hypermap_of_fan_rep_alt;; +let fan_hypermaps_iso_explicit = Sections.finalize_theorem fan_hypermaps_iso_explicit;; +let fan_hypermaps_iso = Sections.finalize_theorem fan_hypermaps_iso;; +let ext_dart_eq_inv_contracted_dart = Sections.finalize_theorem ext_dart_eq_inv_contracted_dart;; +let fan_hypermaps_iso_explicit2 = Sections.finalize_theorem fan_hypermaps_iso_explicit2;; +let fan_hypermaps_iso2 = Sections.finalize_theorem fan_hypermaps_iso2;; +Sections.end_section "Iso";; + +(* Finalization of the section FanHypermapsIso *) +let fan_in_e_imp_neq = Sections.finalize_theorem fan_in_e_imp_neq;; +let in_set_of_edge_neq = Sections.finalize_theorem in_set_of_edge_neq;; +let dart_of_fan_eq = Sections.finalize_theorem dart_of_fan_eq;; +let darts_of_fan_disj = Sections.finalize_theorem darts_of_fan_disj;; +let dart1_of_fan_eq_image = Sections.finalize_theorem dart1_of_fan_eq_image;; +let dart2_of_fan_eq_image = Sections.finalize_theorem dart2_of_fan_eq_image;; +let disjoint_preimage = Sections.finalize_theorem disjoint_preimage;; +let darts_of_fan_disj1 = Sections.finalize_theorem darts_of_fan_disj1;; +let bij_contracted_dart1 = Sections.finalize_theorem bij_contracted_dart1;; +let bij_contracted_dart2 = Sections.finalize_theorem bij_contracted_dart2;; +let bij_contracted_dart = Sections.finalize_theorem bij_contracted_dart;; +let hypermap_of_fan_rep_alt = Sections.finalize_theorem hypermap_of_fan_rep_alt;; +let fan_hypermaps_iso_explicit = Sections.finalize_theorem fan_hypermaps_iso_explicit;; +let fan_hypermaps_iso = Sections.finalize_theorem fan_hypermaps_iso;; +let ext_dart_eq_inv_contracted_dart = Sections.finalize_theorem ext_dart_eq_inv_contracted_dart;; +let fan_hypermaps_iso_explicit2 = Sections.finalize_theorem fan_hypermaps_iso_explicit2;; +let fan_hypermaps_iso2 = Sections.finalize_theorem fan_hypermaps_iso2;; +Sections.end_section "FanHypermapsIso";; + +(* Close the module *) +end;; diff --git a/text_formalization/fan/introduction.hl b/text_formalization/fan/introduction.hl new file mode 100755 index 0000000..dabdf25 --- /dev/null +++ b/text_formalization/fan/introduction.hl @@ -0,0 +1,3020 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + +flyspeck_needs "general/sphere.hl";; + + +module Fan = struct + + +(* +# use "/home/truong/Desktop/googlecode/hol_light/hol.ml";; +needs "/home/truong/Desktop/googlecode/hol_light/Multivariate/flyspeck.ml";; +needs "/home/truong/Desktop/googlecode/flyspeck/text_formalization/general/sphere.hl";; +*) + + + +open Sphere;; +open Fan_defs;; +open Hypermap;; + + +let ASM_TAC=REPEAT(POP_ASSUM MP_TAC);; +let RED_TAC=ASM_REWRITE_TAC[] THEN DISCH_TAC;; +let RES_TAC=ASM_REWRITE_TAC[] THEN STRIP_TAC;; +let REDA_TAC=ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[];; +let RESA_TAC=ASM_REWRITE_TAC[] THEN STRIP_TAC THEN ASM_REWRITE_TAC[];; +let REDAL_TAC (th: thm list) =ASM_REWRITE_TAC th THEN DISCH_TAC THEN ASM_REWRITE_TAC th;; +let RESAL_TAC (th: thm list) = ASM_REWRITE_TAC th THEN STRIP_TAC THEN ASM_REWRITE_TAC th;; +let REMOVE_ASSUM_TAC=POP_ASSUM(fun th-> REWRITE_TAC[]);; +let SYM_ASSUM_TAC=POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]);; +let SYM_ASSUM1_TAC=POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]THEN ASSUME_TAC(th));; +let RESP_TAC=ASM_REWRITE_TAC[] THEN STRIP_TAC THEN POP_ASSUM(fun th->REWRITE_TAC[th]);; +let RESPL_TAC (th: thm list) =ASM_REWRITE_TAC th THEN STRIP_TAC THEN POP_ASSUM(fun th->REWRITE_TAC [th]);; +let REDUCE_ARITH_TAC=REWRITE_TAC[REAL_ARITH`&0 * a= &0`; REAL_ARITH`a * &0 = &0`; REAL_ARITH`a + &0 = a`; +REAL_ARITH`a- &0 =a`;REAL_ARITH`&0 +a =a`;REAL_ARITH`&1 * a =a`;REAL_ARITH`a * &1 =a`;REAL_ARITH`(A+B)-B=A`];; +let REDUCE_VECTOR_TAC=REWRITE_TAC[VECTOR_ARITH`&0 % a= vec 0`; VECTOR_ARITH`a % vec 0= vec 0`;VECTOR_ARITH`a + vec 0 = a`; +VECTOR_ARITH`vec 0 +a =a`; VECTOR_ARITH`a- vec 0 =a`;VECTOR_ARITH`&1 % a =a`;VECTOR_ARITH`a- b =vec 0<=> a=b`];; + +let MRESA_TAC th1 (th: term list) = MP_TAC(ISPECL th th1) THEN RESA_TAC;; +let MRESA1_TAC th1 th = MP_TAC(ISPEC th th1) THEN RESA_TAC;; + +let MRESAL_TAC th1 (th: term list) (th2: thm list) =MP_TAC(ISPECL th th1) THEN ASM_REWRITE_TAC th2 THEN STRIP_TAC THEN ASM_REWRITE_TAC th2;; + +let MRESAL1_TAC th1 th (th2: thm list) =MP_TAC(ISPEC th th1) THEN ASM_REWRITE_TAC th2 THEN STRIP_TAC THEN ASM_REWRITE_TAC th2;; + +let ASM_SET_TAC l = + (TRY(POP_ASSUM_LIST(MP_TAC o end_itlist CONJ))) THEN SET_TAC l;; + + + +let graph = new_definition `graph E <=> (!e. E e ==> (e HAS_SIZE 2))`;; + +let fan1 = new_definition`fan1(x,V,E):bool <=> FINITE V /\ ~(V SUBSET {}) `;; + +let fan2 = new_definition`fan2(x,V,E):bool <=> ~(x IN V)`;; + +let fan3=new_definition`fan3(x,V,E):bool <=> (!v. (v IN V) ==> cyclic_set {w | {v,w} IN E } x v)`;; + +let fan4 = new_definition`fan4(x,V,E):bool<=> (!e. (e IN E) ==> (aff_gt {x} e INTER V={}))`;; + +let fan5 = new_definition`fan5(x,V,E):bool<=> (!e f. (e IN E)/\ (f IN E) /\ ~(e=f) ==> (aff_gt {x} e INTER aff_gt {x} f ={}))`;; + +(* Deprecated, 2011-08-01, thales +let fan = new_definition`fan(x,V,E)<=> ((UNIONS E) SUBSET V) /\ graph(E)/\ fan1(x,V,E)/\ fan2(x,V,E)/\ fan3(x,V,E)/\ fan4 (x,V,E) /\ fan5(x,V,E)`;; +*) + +let base_point_fan=new_definition`base_point_fan (x,V,E)=x`;; + +let set_of_edge=new_definition`set_of_edge v V E={w|{v,w} IN E /\ w IN V}`;; + + +let fan6= new_definition`fan6(x,V,E):bool<=>(!e. (e IN E) ==> ~(collinear ({x} UNION e)))`;; + +let fan7= new_definition`fan7(x,V,E):bool<=> (!e1 e2. (e1 IN E UNION {{v}| v IN V}) /\ (e2 IN E UNION {{v}| v IN V}) +==> ((aff_ge {x} e1) INTER (aff_ge {x} e2) = aff_ge {x} (e1 INTER e2)))`;; + + + +let FAN=new_definition`FAN(x,V,E) <=> ((UNIONS E) SUBSET V) /\ graph(E) /\ fan1(x,V,E) /\ fan2(x,V,E)/\ +fan6(x,V,E)/\ fan7(x,V,E)`;; + + +(* ************************************************* *) +(* Invariance theorems *) + +let GRAPH = prove + (`!E. graph E <=> !e. e IN E ==> e HAS_SIZE 2`, + REWRITE_TAC[graph; IN]);; + +let CYCLIC_SET = prove + (`cyclic_set W v w <=> + ~(v = w) /\ + FINITE W /\ + (!p q h. p IN W /\ q IN W /\ p - q = h % (v - w) ==> p = q) /\ + W INTER affine hull {v, w} = {}`, + REWRITE_TAC[cyclic_set; IN; VECTOR_ARITH `p - q:real^N = r <=> p = q + r`]);; + +let CYCLIC_SET_TRANSLATION_EQ = prove + (`!a:real^N s x y. + cyclic_set (IMAGE (\x. a + x) s) (a + x) (a + y) <=> cyclic_set s x y`, + REWRITE_TAC[CYCLIC_SET] THEN GEOM_TRANSLATE_TAC[]);; + +let CYCLIC_SET_LINEAR_IMAGE = prove + (`!f:real^M->real^N s x y. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (cyclic_set (IMAGE f s) (f x) (f y) <=> cyclic_set s x y)`, + GEN_REWRITE_TAC (funpow 4 BINDER_CONV o RAND_CONV o TOP_DEPTH_CONV) + [CYCLIC_SET; RIGHT_FORALL_IMP_THM; IMP_CONJ; FORALL_IN_IMAGE] THEN + GEOM_TRANSFORM_TAC[]);; + +add_translation_invariants [CYCLIC_SET_TRANSLATION_EQ];; + +add_linear_invariants [CYCLIC_SET_LINEAR_IMAGE];; + +let GRAPH_TRANSLATION_EQ = prove + (`!a:real^N E. graph (IMAGE (IMAGE (\x. a + x)) E) <=> graph E`, + REWRITE_TAC[GRAPH] THEN GEOM_TRANSLATE_TAC[]);; + +let GRAPH_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (graph(IMAGE (IMAGE f) E) <=> graph E)`, + REWRITE_TAC[GRAPH] THEN GEOM_TRANSFORM_TAC[]);; + +let FAN1_TRANSLATION_EQ = prove + (`!a:real^N x V E. + fan1(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + fan1(x,V,E)`, + REWRITE_TAC[fan1] THEN GEOM_TRANSLATE_TAC[]);; + +let FAN1_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (fan1(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> fan1(x,V,E))`, + REWRITE_TAC[fan1] THEN GEOM_TRANSFORM_TAC[]);; + +let FAN2_TRANSLATION_EQ = prove + (`!a:real^N x V E. + fan2(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + fan2(x,V,E)`, + REWRITE_TAC[fan2] THEN GEOM_TRANSLATE_TAC[]);; + +let FAN2_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (fan2(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> fan2(x,V,E))`, + REWRITE_TAC[fan2] THEN GEOM_TRANSFORM_TAC[]);; + +let FAN3_TRANSLATION_EQ = prove + (`!a:real^N x V E. + fan3(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + fan3(x,V,E)`, + REWRITE_TAC[fan3] THEN GEOM_TRANSLATE_TAC[]);; + +let FAN3_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (fan3(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> fan3(x,V,E))`, + let lemma = prove + (`{w | {a,w} IN IMAGE (IMAGE f) s} = + IMAGE f {w |w| {a,f w} IN IMAGE (IMAGE f) s}`, + MATCH_MP_TAC(SET_RULE + `(!y. P y ==> ?x. y = f x) ==> {w | P w} = IMAGE f {w | P(f w)}`) THEN + REWRITE_TAC[IN_IMAGE; EXTENSION; IN_IMAGE; IN_INSERT; NOT_IN_EMPTY] THEN + MESON_TAC[]) in + REWRITE_TAC[fan3; FORALL_IN_IMAGE; lemma] THEN GEOM_TRANSFORM_TAC[]);; + +let FAN4_TRANSLATION_EQ = prove + (`!a:real^N x V E. + fan4(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + fan4(x,V,E)`, + REWRITE_TAC[fan4] THEN GEOM_TRANSLATE_TAC[]);; + +let FAN4_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (fan4(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> fan4(x,V,E))`, + REWRITE_TAC[fan4] THEN GEOM_TRANSFORM_TAC[]);; + +let FAN5_TRANSLATION_EQ = prove + (`!a:real^N x V E. + fan5(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + fan5(x,V,E)`, + REWRITE_TAC[fan5] THEN GEOM_TRANSLATE_TAC[]);; + +let FAN5_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (fan5(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> fan5(x,V,E))`, + GEN_REWRITE_TAC (funpow 4 BINDER_CONV o RAND_CONV o TOP_DEPTH_CONV) + [fan5; IMP_CONJ; RIGHT_FORALL_IMP_THM; FORALL_IN_IMAGE] THEN + GEOM_TRANSFORM_TAC[]);; + +let FAN6_TRANSLATION_EQ = prove + (`!a:real^N x V E. + fan6(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + fan6(x,V,E)`, + REWRITE_TAC[fan6] THEN GEOM_TRANSLATE_TAC[]);; + +let FAN6_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (fan6(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> fan6(x,V,E))`, + REWRITE_TAC[fan6] THEN GEOM_TRANSFORM_TAC[]);; + +let FAN7_TRANSLATION_EQ = prove + (`!a:real^N x V E. + fan7(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + fan7(x,V,E)`, + REWRITE_TAC[fan7] THEN + REWRITE_TAC[SET_RULE + `e IN s UNION {f x | t x} <=> e IN s \/ ?x. t x /\ e = f x`] THEN + GEOM_TRANSLATE_TAC[]);; + +let FAN7_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (fan7(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> fan7(x,V,E))`, + REWRITE_TAC[fan7; IN_UNION] THEN + REWRITE_TAC[LEFT_OR_DISTRIB; RIGHT_OR_DISTRIB; + TAUT `a \/ b ==> c <=> (a ==> c) /\ (b ==> c)`] THEN + GEN_REWRITE_TAC (funpow 4 BINDER_CONV o RAND_CONV o TOP_DEPTH_CONV) + [FORALL_AND_THM; IMP_CONJ; RIGHT_FORALL_IMP_THM] THEN + REWRITE_TAC[FORALL_IN_GSPEC] THEN REWRITE_TAC[IMP_IMP] THEN + GEOM_TRANSFORM_TAC[]);; + +add_translation_invariants + [GRAPH_TRANSLATION_EQ; + FAN1_TRANSLATION_EQ; + FAN2_TRANSLATION_EQ; + FAN3_TRANSLATION_EQ; + FAN4_TRANSLATION_EQ; + FAN5_TRANSLATION_EQ; + FAN6_TRANSLATION_EQ; + FAN7_TRANSLATION_EQ];; + +add_linear_invariants + [GRAPH_LINEAR_IMAGE_EQ; + FAN1_LINEAR_IMAGE_EQ; + FAN2_LINEAR_IMAGE_EQ; + FAN3_LINEAR_IMAGE_EQ; + FAN4_LINEAR_IMAGE_EQ; + FAN5_LINEAR_IMAGE_EQ; + FAN6_LINEAR_IMAGE_EQ; + FAN7_LINEAR_IMAGE_EQ];; + +let FAN_TRANSLATION_EQ = prove + (`!a:real^N x V E. + FAN(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + FAN(x,V,E)`, + REWRITE_TAC[FAN] THEN GEOM_TRANSLATE_TAC[]);; + +let FAN_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (FAN(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> FAN(x,V,E))`, + REWRITE_TAC[FAN] THEN GEOM_TRANSFORM_TAC[]);; + +add_translation_invariants [FAN_TRANSLATION_EQ];; +add_linear_invariants [FAN_LINEAR_IMAGE_EQ];; + +let BASE_POINT_FAN_TRANSLATION_EQ = prove + (`!a x V E. + base_point_fan(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) = + a + base_point_fan(x,V,E)`, + REWRITE_TAC[base_point_fan]);; + +let BASE_POINT_FAN_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f + ==> base_point_fan(f x,IMAGE f V,IMAGE (IMAGE f) E) = + f(base_point_fan(x,V,E))`, + REWRITE_TAC[base_point_fan]);; + +let SET_OF_EDGE_TRANSLATION_EQ = prove + (`!a:real^N x V E. + set_of_edge (a + x) (IMAGE (\x. a + x) V) + (IMAGE (IMAGE (\x. a + x)) E) = + IMAGE (\x. a + x) (set_of_edge x V E)`, + REWRITE_TAC[set_of_edge] THEN GEOM_TRANSLATE_TAC[]);; + +let SET_OF_EDGE_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> set_of_edge (f x) (IMAGE f V) (IMAGE (IMAGE f) E) = + IMAGE f (set_of_edge x V E)`, + let lemma = prove + (`{w | {a,w} IN IMAGE (IMAGE f) s /\ P w} = + {f w |w| {a,f w} IN IMAGE (IMAGE f) s /\ P(f w)}`, + MATCH_MP_TAC(SET_RULE + `(!y. P y ==> ?x. y = f x) ==> {w | P w} = {f w |w| P(f w)}`) THEN + REWRITE_TAC[IN_IMAGE; EXTENSION; IN_IMAGE; IN_INSERT; NOT_IN_EMPTY] THEN + MESON_TAC[]) in + REWRITE_TAC[set_of_edge; lemma] THEN + GEOM_TRANSFORM_TAC[] THEN SET_TAC[]);; + +add_translation_invariants + [BASE_POINT_FAN_TRANSLATION_EQ; SET_OF_EDGE_TRANSLATION_EQ];; + +add_linear_invariants + [BASE_POINT_FAN_LINEAR_IMAGE_EQ; SET_OF_EDGE_LINEAR_IMAGE_EQ];; + + + + +(*H2k hypermap*) +(*let hk=new_definition`hk((D:A->bool),(f:A->A),(n:A->A),(e:A->A),(k:num)) <=> + +CARD D = 2 * k /\ (f permutes D) /\ (n permutes D) /\ (e permutes D ) +/\ (e o n o f= I) +/\ (?x:A y:A. (x IN D) /\ (y IN D) /\ (orbit_map (f:A->A) (x) INTER orbit_map (f) (y)={}) + /\ (D = orbit_map (f:A->A) (x) UNION orbit_map (f) (y)) +/\ (IMAGE n (orbit_map (f:A->A) (x)))= orbit_map (f) (y))`;; +*) + + + + + +(* ************************************************* *) +(* Proof remark rem:fan *) + +let set_edges_is_finite_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E)==> FINITE E`, +REPEAT GEN_TAC +THEN REWRITE_TAC[FAN;fan1;graph] +THEN STRIP_TAC +THEN MP_TAC(ISPEC `V:real^3->bool`FINITE_POWERSET) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`UNIONS (E:(real^3->bool)->bool) SUBSET (V:real^3->bool)==> E SUBSET {t| t SUBSET V}`) +THEN RESA_TAC + THEN MP_TAC(ISPECL [`(E:(real^3->bool)->bool)`;`{t| t SUBSET (V:real^3->bool)}`] FINITE_SUBSET) +THEN ASM_SET_TAC[]);; + + +let remark_fan1=prove(`!v w V E. (v IN V) /\ (w IN V) ==>((w IN set_of_edge v V E)<=>(v IN set_of_edge w V E))`, +(let lemma=prove(`{w,v}={v,w}`, SET_TAC[]) in +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[set_of_edge;IN_ELIM_THM] THEN ASM_REWRITE_TAC[] THEN MESON_TAC[lemma]));; + +let remark_finite_fan1=prove(`!v:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). FINITE V ==> FINITE (set_of_edge v V E)`, +REPEAT GEN_TAC THEN DISCH_TAC + THEN MP_TAC(ISPECL [`(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))`; `V:real^3->bool`] FINITE_SUBSET) + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[set_of_edge] THEN SET_TAC[] );; + +let properties_of_set_of_edge=prove(`!v:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) u:real^3. UNIONS E SUBSET V +==> +({v,u} IN E <=> u IN set_of_edge v V E)`, +REPEAT GEN_TAC THEN REWRITE_TAC[UNIONS; SUBSET; set_of_edge ; IN_ELIM_THM] +THEN STRIP_TAC + THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `u:real^3`th)) THEN REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN DISCH_TAC + THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `{(v:real^3),(u:real^3)}`th)) THEN SET_TAC[]);; +let properties_of_set_of_edge_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3. FAN(x,V,E) +==> +({v,u} IN E <=> u IN set_of_edge v V E)`, +REWRITE_TAC[FAN] THEN REPEAT GEN_TAC THEN REWRITE_TAC[UNIONS; SUBSET; set_of_edge ; IN_ELIM_THM] +THEN STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"a") THEN STRIP_TAC + THEN REMOVE_THEN "a"(fun th-> MP_TAC(ISPEC `u:real^3`th)) THEN REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN DISCH_TAC + THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `{(v:real^3),(u:real^3)}`th)) THEN SET_TAC[]);; + + + +let properties_of_graph=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (v:real^3). +FAN(x,V,E) /\{v,u} IN E==> v IN V`, + +REPEAT GEN_TAC THEN REWRITE_TAC[FAN] THEN STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_THEN(LABEL_TAC "a") THEN REPEAT STRIP_TAC THEN +REMOVE_THEN "a" MP_TAC THEN REWRITE_TAC[UNIONS; SUBSET; IN_ELIM_THM] THEN DISCH_TAC + THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`v:real^3` th)) THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC THEN EXISTS_TAC `{(v:real^3),(u:real^3)}` THEN ASM_TAC THEN SET_TAC[]);; + + + +let th3a12=prove(`!x v u.(~ collinear {x,v,u} ==> DISJOINT {x,u} {v})`, + (let th=prove(`{x,v,u}={x,v,u}`, SET_TAC[]) in +REPEAT GEN_TAC THEN REWRITE_TAC[th;IN_DISJOINT] THEN MATCH_MP_TAC MONO_NOT THEN +REWRITE_TAC[COLLINEAR_3;COLLINEAR_LEMMA; VECTOR_ARITH` a-b= vec 0 <=> a = b`; IN_SING] THEN STRIP_TAC + THEN REPEAT(POP_ASSUM MP_TAC) THEN DISCH_THEN(LABEL_TAC "a") THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC +THEN ASM_REWRITE_TAC[] THEN SET_TAC[]));; + + +let th3a=prove(`!x v u.(~ collinear {x,v,u} ==> DISJOINT {x,v} {u})`, + (let th=prove(`{x,v,u}={x,u,v}`, SET_TAC[]) in +REPEAT GEN_TAC THEN REWRITE_TAC[th;IN_DISJOINT] THEN MATCH_MP_TAC MONO_NOT THEN +REWRITE_TAC[COLLINEAR_3;COLLINEAR_LEMMA; VECTOR_ARITH` a-b= vec 0 <=> a = b`; IN_SING] THEN STRIP_TAC + THEN REPEAT(POP_ASSUM MP_TAC) THEN DISCH_THEN(LABEL_TAC "a") THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC +THEN ASM_REWRITE_TAC[] THEN SET_TAC[]));; + let th3b=prove(`!x v u. ~ collinear {x,v,u} ==> ~(x=v) `, +REPEAT GEN_TAC THEN REWRITE_TAC[COLLINEAR_3;COLLINEAR_LEMMA; VECTOR_ARITH` a-b= vec 0 <=> a = b`; DE_MORGAN_THM] THEN SET_TAC[]);; +let th3b1=prove(`!x v u. ~ collinear {x,v,u} ==> ~(x=u) `, +(let th=prove(`{x,v,u}={x,u,v}`, SET_TAC[]) in +REWRITE_TAC[th;th3b]));; + + let th3c= prove(`!x v u. ~ collinear {x,v,u} ==> ~(u IN aff {x,v})`, +REPEAT GEN_TAC THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff; AFFINE_HULL_2; IN_ELIM_THM;COLLINEAR_3;COLLINEAR_LEMMA; VECTOR_ARITH` a-b= vec 0 <=> a = b`; DE_MORGAN_THM] +THEN STRIP_TAC THEN REPEAT(POP_ASSUM MP_TAC) THEN REWRITE_TAC[REAL_ARITH `u'+v'= &1 <=> v'= &1 -u'`] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[VECTOR_ARITH`(u = u' % x + (&1 - u') % v) <=> (u - v = u' % (x-v))`] THEN SET_TAC[]);; + + +let th3d=prove(`!x v u. ~(x=v)/\ ~(x=u) ==> DISJOINT {x} {v,u}`, +SET_TAC[]);; + +let th3=prove(`!x v u. ~ collinear {x,v,u} ==> ~ (x=v) /\ ~(x=u) /\ DISJOINT {x,v} {u}/\ DISJOINT {x,u} {v} /\DISJOINT {x} {v,u} /\ ~(u IN aff {x,v})`, +MESON_TAC[th3a;th3b;th3b1;th3c;th3d;th3a12]);; + + +let collinear1_fan=prove(`!x v u. ~ collinear {x,u,v} <=> ~(u IN aff {x,v})/\ ~ (x=v)`, +(let lem=prove(`!x v u. {x,v,u}= {x,u,v}`,SET_TAC[]) in +REPEAT GEN_TAC THEN EQ_TAC +THENL[ +MESON_TAC[th3;lem]; +REWRITE_TAC[SET_RULE`~(t1) /\ ~ t2<=> ~(t2\/ t1)`;COLLINEAR_3_EXPAND;aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN MATCH_MP_TAC MONO_NOT THEN MATCH_MP_TAC MONO_OR THEN STRIP_TAC +THENL[ +REWRITE_TAC[]; + +STRIP_TAC THEN EXISTS_TAC`u':real` THEN EXISTS_TAC`&1- (u':real)` THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC]]));; + + +let collinear_fan=prove(`!x v u. ~ collinear {x,v,u} <=> ~(u IN aff {x,v})/\ ~ (x=v)`, +(let lem=prove(`!x v u. {x,v,u}= {x,u,v}`,SET_TAC[]) in +MESON_TAC[collinear1_fan;lem]));; + + let th4=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (v:real^3). +FAN(x,V,E) /\{v,u} IN E==> ~(x=v)`, +REPEAT GEN_TAC THEN STRIP_TAC THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (u:real^3)`; `(v:real^3)`]properties_of_graph) THEN ASM_REWRITE_TAC[] THEN REPEAT(POP_ASSUM MP_TAC) THEN REWRITE_TAC[FAN;fan2] THEN SET_TAC[]);; + +let remark4_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (v:real^3). +FAN(x,V,E) /\ {v,u} IN E==> ~ (x=v) /\ ~(x=u) /\ DISJOINT {x,v} {u}/\ DISJOINT {x,u} {v} /\ DISJOINT {x} {v,u} /\ ~(u IN aff {x,v})`, + +REPEAT GEN_TAC THEN REWRITE_TAC[FAN;fan6] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") THEN REPEAT DISCH_TAC THEN REMOVE_THEN"a"(fun th->MP_TAC(ISPEC`{(v:real^3),(u:real^3)}`th)) THEN ASM_REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] THEN REWRITE_TAC[th3]);; + + +let collinears_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (v:real^3). +FAN(x,V,E) /\{v,u} IN E==>( ~ collinear {x,v,u} <=> ~(u IN aff {x,v}))`, +MESON_TAC[remark4_fan;collinear_fan]);; + +let remark1_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (v:real^3). +FAN(x,V,E) ==> +FINITE (set_of_edge v V E) +/\({v,u} IN E <=> u IN set_of_edge v V E)/\ +({v,u} IN E==> +~ collinear {x,v,u}/\ +~ (x=v) /\ ~(x=u)/\ ~(v=u) /\ DISJOINT {x,v} {u}/\ DISJOINT {x,u} {v} /\DISJOINT {x} {v,u} /\ ~(u IN aff {x,v}) /\ v IN V/\ ( ~ collinear {x,v,u} <=> ~(u IN aff {x,v})))`, +MESON_TAC[FAN;fan1;remark_finite_fan1;remark4_fan; properties_of_graph; SET_RULE`DISJOINT {x,v} {u} ==> ~(v=u)`;collinears_fan;properties_of_set_of_edge_fan]);; + + + +(***************SIGMA_FAN*****************) + + + +let sigma_fan=new_definition`sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)= +(if (set_of_edge v V E = {u} ) then u + else (@(w:real^3). (w IN (set_of_edge v V E)) /\ ~(w=u) /\ +(!(w1:real^3). (w1 IN (set_of_edge v V E))/\ ~(w1=u) ==> azim x v u w <= azim x v u w1)))`;; + + +(* This extends sigma to have a larger domain + of R^3 rather than just V. It is the + identity outside V (compare the definition + of `permutes` ). *) + + + + +let extension_sigma_fan=new_definition`extension_sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)= +(if ~(u IN set_of_edge v V E ) then u + else (sigma_fan x V E v u))`;; + + + + + +let exists_sigma_fan=prove(` +(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +~ (set_of_edge v V E= {u} ) +/\ FAN(x,V,E) /\ (u IN (set_of_edge v V E)) +==> +(?(w:real^3). (w IN (set_of_edge v V E)) /\ ~(w=u) /\ +(!(w1:real^3). (w1 IN (set_of_edge v V E))/\ ~(w1=u) ==> azim x v u w <= azim x v u w1))) +`, + +(let lemma = prove + (`!X:real->bool. + FINITE X /\ ~(X = {}) + ==> ?a. a IN X /\ !x. x IN X ==> a <= x`, + MESON_TAC[INF_FINITE]) in + + +MP_TAC(lemma) THEN DISCH_THEN(LABEL_TAC "a") THEN REPEAT GEN_TAC THEN REWRITE_TAC[FAN;fan1] THEN STRIP_TAC THEN MP_TAC (ISPECL[`(v:real^3)` ;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]remark_finite_fan1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + +SUBGOAL_THEN `FINITE ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3))` ASSUME_TAC +THENL[(*2*) +ASM_MESON_TAC[FINITE_DELETE_IMP];(*2*) + +DISJ_CASES_TAC(SET_RULE`((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3)={})\/ + ~((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3)={})`) +THENL[(*3*) +POP_ASSUM MP_TAC THEN REWRITE_TAC[DELETE;EXTENSION;IN_ELIM_THM] THEN DISCH_TAC + THEN SUBGOAL_THEN `set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={u:real^3}` ASSUME_TAC +THENL[(*4*) +ASM_TAC THEN SET_TAC[];(*4*) +ASM_TAC THEN SET_TAC[]](*4*);(*3*) +SUBGOAL_THEN`~(IMAGE (azim x v u) ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3))={})` ASSUME_TAC +THENL[(*4*) +REWRITE_TAC[IMAGE_EQ_EMPTY] THEN ASM_MESON_TAC[];(*4*) + +SUBGOAL_THEN` FINITE (IMAGE (azim x v u) ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3)))` ASSUME_TAC +THENL[(*5*) +ASM_MESON_TAC[FINITE_IMAGE];(*5*) +REMOVE_THEN "a" (fun th ->MP_TAC(ISPEC `(IMAGE (azim x v u) ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3)))` th)) + THEN ASM_REWRITE_TAC[IMAGE;DELETE;IN_ELIM_THM] THEN STRIP_TAC THEN EXISTS_TAC`x':real^3` + THEN ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[] +](*5*)](*4*)](*3*)](*2*)(*1*)));; + + +let azim1=new_definition`azim1 (x:real^3) (v:real^3) (u:real^3) (w:real^3)= &2 * pi- azim x v u w`;; + + +let exists_inverse_sigma_fan_alt=prove(` +(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +~ (set_of_edge v V E= {u} ) +/\ FAN(x,V,E) /\ (u IN (set_of_edge v V E)) +==> +(?(w:real^3). (w IN (set_of_edge v V E)) /\ ~(w=u) /\ +(!(w1:real^3). (w1 IN (set_of_edge v V E))/\ ~(w1=u) ==> azim1 x v u w <= azim1 x v u w1))) +`, +(let lemma = prove + (`!X:real->bool. + FINITE X /\ ~(X = {}) + ==> ?a. a IN X /\ !x. x IN X ==> a <= x`, + MESON_TAC[INF_FINITE]) in +MP_TAC(lemma) THEN DISCH_THEN(LABEL_TAC "a") THEN REPEAT GEN_TAC THEN REWRITE_TAC[FAN;fan1] THEN STRIP_TAC THEN MP_TAC (ISPECL[`(v:real^3)` ;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]remark_finite_fan1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +SUBGOAL_THEN `FINITE ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3))` ASSUME_TAC +THENL[(*2*) + +ASM_MESON_TAC[FINITE_DELETE_IMP];(*2*) +DISJ_CASES_TAC(SET_RULE`((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3)={})\/ + ~((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3)={})`) +THENL[(*3*) +POP_ASSUM MP_TAC THEN REWRITE_TAC[DELETE;EXTENSION;IN_ELIM_THM] THEN DISCH_TAC + THEN SUBGOAL_THEN `set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={u:real^3}` ASSUME_TAC +THENL[(*4*) +ASM_TAC THEN SET_TAC[];(*4*) +ASM_TAC THEN SET_TAC[](*4*)]; + +SUBGOAL_THEN`~(IMAGE ( azim1 x v u) ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3))={})` ASSUME_TAC +THENL[(*4*) +REWRITE_TAC[IMAGE_EQ_EMPTY] THEN ASM_MESON_TAC[];(*4*) +SUBGOAL_THEN` FINITE (IMAGE (azim1 x v u) ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3)))` ASSUME_TAC +THENL[(*5*) +ASM_MESON_TAC[FINITE_IMAGE];(*5*) +REMOVE_THEN "a" (fun th ->MP_TAC(ISPEC `(IMAGE (azim1 x v u) ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) DELETE (u:real^3)))` th)) + THEN ASM_REWRITE_TAC[IMAGE;DELETE;IN_ELIM_THM]THEN STRIP_TAC +THEN EXISTS_TAC`x':real^3` + THEN ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[] +](*5*)](*4*)](*3*)](*2*)(*1*)));; + + + + + + + + +let SIGMA_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +~ (set_of_edge v V E= {u} ) +/\ FAN(x,V,E) /\ (u IN (set_of_edge v V E)) +==> +((sigma_fan x V E v u) IN (set_of_edge v V E)) /\ ~((sigma_fan x V E v u)=u) /\ +(!(w1:real^3). (w1 IN (set_of_edge v V E))/\ ~(w1=u) ==> azim x v u (sigma_fan x V E v u) <= azim x v u w1)`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN ONCE_REWRITE_TAC[sigma_fan] + THEN MP_TAC(ISPECL[`(x:real^3)`; `(V:real^3->bool)`; `(E:(real^3->bool)->bool)`; `(v:real^3)`; `(u:real^3)`]exists_sigma_fan) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN SELECT_ELIM_TAC THEN EXISTS_TAC`w:real^3` THEN ASM_REWRITE_TAC[]);; + + + + +let sigma_fan_in_set_of_edge=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ (u IN (set_of_edge v V E)) +==> +((sigma_fan x V E v u) IN (set_of_edge v V E))`, + +REPEAT STRIP_TAC THEN DISJ_CASES_TAC(SET_RULE`~ (set_of_edge v V E= {u:real^3} )\/ (set_of_edge v V E= {u} )`) +THENL[ + MP_TAC(ISPECL[`(x:real^3)`; `(V:real^3->bool)`; `(E:(real^3->bool)->bool)`; `(v:real^3)`; `(u:real^3)`]SIGMA_FAN) +THEN ASM_TAC +THEN SET_TAC[]; +ASM_REWRITE_TAC[sigma_fan;IN_SING]]);; + + + + +let AFF_GE_2_1 = prove + (`!x v w. + DISJOINT {x,v} {w} + ==> aff_ge {x,v} {w} = + {y | ?t1 t2 t3. + &0 <= t3 /\ + t1 + t2 + t3 = &1 /\ + y = t1 % x + t2 % v + t3 % w}`, + AFF_TAC);; + +let AFF_GE_1_2 = prove + (`!x v w. + DISJOINT {x} {v,w} + ==> aff_ge {x} {v,w} = + {y | ?t1 t2 t3. + &0 <= t2 /\ &0 <= t3 /\ + t1 + t2 + t3 = &1 /\ + y = t1 % x + t2 % v + t3 % w}`, + AFF_TAC);; +let AFF_GE_1_1 = prove + (`!x v w. + DISJOINT {x} {v} + ==> aff_ge {x} {v} = + {y | ?t1 t2. + &0 <= t2 /\ + t1 + t2 = &1 /\ + y = t1 % x + t2 % v }`, + AFF_TAC);; + + + + +let UNIQUE_FOINT_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) w:real^3. +FAN(x,V,E) /\ ({v,u} IN E) /\ ({v,w} IN E)/\ + ~(aff_ge {x} {v,u} INTER aff_ge {x} {v,w}=aff_ge {x} {v}) +==> u=w`, +REPEAT GEN_TAC THEN REWRITE_TAC[FAN;fan7;fan6] THEN STRIP_TAC + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN DISCH_THEN (LABEL_TAC "a") THEN REPEAT STRIP_TAC + THEN REMOVE_THEN "a" (fun th-> MP_TAC(ISPECL[`{(v:real^3),(u:real^3)}`;`{(v:real^3),(w:real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] + THEN DISJ_CASES_TAC(SET_RULE`~((u:real^3)=(w:real^3))\/ ((u:real^3)=(w:real^3))`) +THENL +[ MP_TAC(SET_RULE`~((u:real^3)=(w:real^3))==> {(v:real^3),(u:real^3)} INTER {(v:real^3),(w:real^3)}={v}`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[]; +ASM_TAC THEN SET_TAC[]]);; + + + + + + + + + +let UNIQUE1_POINT_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) w:real^3. +FAN(x,V,E) /\ ({v,u} IN E) /\ ({v,w} IN E)/\ w IN aff_gt {x,v} {u} +==> u=w`, +REPEAT GEN_TAC THEN STRIP_TAC THEN MATCH_MP_TAC UNIQUE_FOINT_FAN THEN +EXISTS_TAC `x:real^3` THEN EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `E:(real^3->bool)->bool` THEN EXISTS_TAC `v:real^3` + THEN ASM_REWRITE_TAC[] THEN REPEAT(POP_ASSUM MP_TAC) + THEN REWRITE_TAC[FAN;fan1;fan2;fan6;fan7] THEN REPEAT STRIP_TAC THEN REPEAT(POP_ASSUM MP_TAC) + THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC + THEN DISCH_THEN (LABEL_TAC "a") + THEN DISCH_THEN (LABEL_TAC "b") THEN REPEAT DISCH_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "a" (fun th-> MP_TAC(ISPEC `{(v:real^3),(w:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th-> MP_TAC(ISPEC `{(v:real^3),(u:real^3)}`th)) + THEN ASM_REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] + THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "c") + THEN DISCH_TAC THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (w:real^3)`]th3) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]th3) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]AFF_GT_2_1) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN REMOVE_THEN "c" MP_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC + THEN SUBGOAL_THEN` aff_ge {(x:real^3)} {(v:real^3)} SUBSET aff {x,v}` ASSUME_TAC +THENL (*1*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]AFF_GE_1_1) +THEN MP_TAC(SET_RULE`~((x:real^3) = (v:real^3))==> DISJOINT {x} {v}`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[aff;AFFINE_HULL_2] THEN ASM_TAC THEN SET_TAC[];(*1*) + +SUBGOAL_THEN `~((w:real^3) IN aff_ge {x} {v})` ASSUME_TAC +THENL (*2*)[ +ASM_TAC THEN SET_TAC[];(*2*) + +POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "d") THEN DISJ_CASES_TAC(REAL_ARITH `(&0 <= (t2:real))\/ (&0 <= (-- (t2:real)))`) +THENL (*3*)[ + SUBGOAL_THEN `(w:real^3) IN aff_ge {(x:real^3)} {(v:real^3),(u:real^3)}` ASSUME_TAC +THENL (*4*)[ + MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]AFF_GE_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC `t1:real` + THEN EXISTS_TAC `t2:real` THEN EXISTS_TAC `t3:real` THEN ASM_REWRITE_TAC[] + THEN REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC;(*4*) + + SUBGOAL_THEN `(w:real^3) IN aff_ge {(x:real^3)} {(v:real^3),(w:real^3)}` ASSUME_TAC +THENL (*5*)[ + MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (w:real^3)`]AFF_GE_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC `&0:real` + THEN EXISTS_TAC `&0:real` THEN EXISTS_TAC `&1:real` THEN REWRITE_TAC[VECTOR_ARITH`w= &0 % x+ &0 % v + &1 % w `] THEN REAL_ARITH_TAC;(*5*) + +ASM_TAC THEN SET_TAC[]](*5*)](*4*);(*3*) + + SUBGOAL_THEN `(u:real^3) IN aff_ge {(x:real^3)} {(v:real^3),(w:real^3)}` ASSUME_TAC +THENL (*4*)[ + MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (w:real^3)`]AFF_GE_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC `inv(t3:real) *(--(t1:real))` + THEN EXISTS_TAC `inv(t3:real)*(--(t2:real))` THEN EXISTS_TAC `inv(t3:real)` +THEN MP_TAC(ISPEC `t3:real` REAL_LT_INV) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(REAL_ARITH`&0< inv(t3:real)==> (&0 <= inv(t3:real))`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL [`inv (t3:real)`;`(--(t2:real))`] REAL_LE_MUL) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`inv(t3:real) * -- (t1:real)+ inv(t3) * --(t2:real) +inv (t3)=inv (t3)*(&1-t1-t2)`] THEN +MP_TAC(REAL_ARITH`(t1:real)+(t2:real)+(t3:real)= &1 ==> &1 - t1- t2=t3`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN +MP_TAC(REAL_ARITH`&0<(t3:real)==> ~(t3= &0)`) THEN ASM_REWRITE_TAC[VECTOR_ARITH` + (inv t3 * --t1) % x + + (inv t3 * --t2) % v + + inv t3 % (t1 % x + t2 % v + t3 % u)= (inv t3 * t3) % u ` +] THEN DISCH_TAC +THEN MP_TAC(ISPEC `t3:real` REAL_MUL_LINV) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH ` v= &1 % v`];(*4*) + + SUBGOAL_THEN `(u:real^3) IN aff_ge {(x:real^3)} {(v:real^3),(u:real^3)}` ASSUME_TAC +THENL (*5*)[ + MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]AFF_GE_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC `&0:real` + THEN EXISTS_TAC `&0:real` THEN EXISTS_TAC `&1:real` THEN REWRITE_TAC[VECTOR_ARITH`u= &0 % x+ &0 % v + &1 % u `] THEN REAL_ARITH_TAC;(*5*) +ASM_TAC THEN SET_TAC[]](*5*)](*4*)](*3*)](*2*)](*1*));; + + +let UNIQUE_AZIM_POINT_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) w:real^3 w1:real^3. +FAN(x,V,E) /\ ({v,u} IN E) /\ ({v,w} IN E) /\ { v, w1} IN E /\ (azim x v u w =azim x v u w1) +==> w=w1`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(th) THEN ASSUME_TAC(th)) THEN REWRITE_TAC[FAN;fan6] THEN REPEAT STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_TAC + THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_THEN (LABEL_TAC "a") THEN REPEAT DISCH_TAC + THEN REMOVE_THEN "a"(fun th ->MP_TAC(ISPEC`{(v:real^3),(u:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM(fun th ->MP_TAC(ISPEC `{(v:real^3),(w:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM(fun th ->MP_TAC(ISPEC `{(v:real^3),(w1:real^3)}`th)) THEN ASM_REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] + THEN REPEAT STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;`(v:real^3) `;`(u:real^3) `;`w:real^3`;` w1:real^3`] AZIM_EQ) THEN +ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;` w1:real^3`]UNIQUE1_POINT_FAN) THEN ASM_REWRITE_TAC[] );; + + +let UNIQUE_AZIM_0_POINT_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) w:real^3. +FAN(x,V,E) /\ ({v,u} IN E) /\ ({v,w} IN E) /\ (azim x v u w = &0) +==> u=w`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(th) THEN ASSUME_TAC(th)) THEN REWRITE_TAC[FAN;fan6] THEN REPEAT STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_TAC + THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_THEN (LABEL_TAC "a") THEN REPEAT DISCH_TAC + THEN REMOVE_THEN "a"(fun th ->MP_TAC(ISPEC`{(v:real^3),(u:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM(fun th ->MP_TAC(ISPEC `{(v:real^3),(w:real^3)}`th)) THEN ASM_REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] + THEN REPEAT STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;`(v:real^3) `;`(u:real^3) `;`w:real^3`] AZIM_EQ_0_ALT) THEN +ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;` w:real^3`]UNIQUE1_POINT_FAN) THEN ASM_REWRITE_TAC[] );; + + + + +let UNIQUE_SIGMA_FAN=prove(` +(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3). +~ (set_of_edge v V E= {u} ) +/\ FAN(x,V,E) /\ (u IN (set_of_edge v V E)) +/\ (w IN (set_of_edge v V E)) /\ ~(w=u) /\ +(!(w1:real^3). (w1 IN (set_of_edge v V E))/\ ~(w1=u) ==> azim x v u w <= azim x v u w1) +==> sigma_fan x V E v u=w)`, + + ( let th=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) w:real^3. +FAN(x,V,E) /\ ({v,u} IN E) /\ ({v,w} IN E) +==> (w IN aff_gt {x,v} {u} ==> u=w)`, MESON_TAC[UNIQUE1_POINT_FAN] +) in + +ASSUME_TAC(th) THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT(POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"123") THEN +DISCH_TAC THEN DISCH_THEN(LABEL_TAC "1") + THEN DISCH_THEN(LABEL_TAC "2") THEN DISCH_THEN(LABEL_TAC "3") THEN DISCH_THEN(LABEL_TAC "4") + THEN DISCH_THEN(LABEL_TAC"a") + THEN MP_TAC(ISPECL[`(x:real^3)`; `(V:real^3->bool)`; `(E:(real^3->bool)->bool)` ;`(v:real^3)`; `(u:real^3)`]SIGMA_FAN) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN REMOVE_THEN "a" (fun th->MP_TAC(ISPEC `sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)` th)) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM (fun th-> MP_TAC(ISPEC `w:real^3` th)) THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"b") + THEN REPEAT DISCH_TAC + THEN SUBGOAL_THEN `azim x v u (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) = azim x v u (w:real^3)` ASSUME_TAC +THENL[ +REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; +REMOVE_THEN "123" (fun th->MP_TAC (ISPECL[`(x:real^3)`; `(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`; `(v:real^3)` ; `(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))`;`(w:real^3)`]th)) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +REMOVE_THEN"1" MP_TAC +THEN REWRITE_TAC[FAN;fan6;fan7] THEN STRIP_TAC THEN +POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "c") THEN DISCH_THEN (LABEL_TAC "d") + THEN REMOVE_THEN"2" MP_TAC THEN REMOVE_THEN"3" MP_TAC THEN REMOVE_THEN"b" MP_TAC + THEN REWRITE_TAC[set_of_edge;IN_ELIM_THM] THEN REPEAT STRIP_TAC + THEN REMOVE_THEN "c" MP_TAC THEN DISCH_TAC + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(w:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(u:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))}`th) THEN ASSUME_TAC(th)) + THEN REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] THEN REPEAT STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`; `(v:real^3)`; `(u:real^3)` ;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))`; `(w:real^3)`]AZIM_EQ ) + THEN ASM_REWRITE_TAC[] + THEN ASM_MESON_TAC[]]));; + + +let CYCLIC_SET_EDGE_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3). +FAN(x,V,E) /\ v IN V +==> cyclic_set (set_of_edge v V E) x v`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN REPEAT (POP_ASSUM MP_TAC) +THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(th) +THEN ASSUME_TAC(th)) THEN REWRITE_TAC[FAN; cyclic_set;fan1;fan2;fan6;fan7] THEN STRIP_TAC THEN STRIP_TAC THEN STRIP_TAC + THENL(*1*)[ASM_TAC THEN SET_TAC[];(*1*) +STRIP_TAC + THENL (*2*)[ASM_TAC THEN SET_TAC[remark_finite_fan1];(*2*) + STRIP_TAC THENL(*3*)[ + +ASM_REWRITE_TAC[set_of_edge;IN_ELIM_THM] THEN +REPEAT GEN_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + DISCH_THEN(LABEL_TAC "a") THEN DISCH_THEN(LABEL_TAC "b") +THEN STRIP_TAC THEN STRIP_TAC THEN +REMOVE_THEN "a" (fun th-> MP_TAC(ISPEC `{(v:real^3), (p:real^3)}` th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th-> MP_TAC(ISPEC `{(v:real^3), (q:real^3)}` th)) + THEN ASM_REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] THEN REPEAT STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (p:real^3)`]th3) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (q:real^3)`]th3) THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM (fun th-> REWRITE_TAC[]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) + THEN REPEAT STRIP_TAC THEN SUBGOAL_THEN `(q:real^3) IN aff_gt {(x:real^3),(v:real^3)} {(p:real^3)}` ASSUME_TAC + +THENL (*4*)[ + MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (p:real^3)`]AFF_GT_2_1) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] + THEN EXISTS_TAC `--(h:real)` THEN EXISTS_TAC `(h:real)` THEN EXISTS_TAC `&1` THEN REWRITE_TAC[VECTOR_ARITH`q= (-- (h:real)) % x + (h:real) % v + &1 % (q+ h% (x-v))`] THEN REAL_ARITH_TAC;(*4*) + +ASM_MESON_TAC[UNIQUE1_POINT_FAN]](*4*);(*3*) + +REWRITE_TAC[INTER;EXTENSION;IN_ELIM_THM] THEN GEN_TAC +THEN SUBGOAL_THEN`(x':real^3) IN set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) ==> ~(x' IN aff {x,v})` +ASSUME_TAC +THENL(*4*)[ +ASM_REWRITE_TAC[set_of_edge;IN_ELIM_THM] THEN +REPEAT GEN_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + DISCH_THEN(LABEL_TAC "a") THEN DISCH_THEN(LABEL_TAC "b") +THEN STRIP_TAC THEN STRIP_TAC THEN +REMOVE_THEN "a" (fun th-> MP_TAC(ISPEC `{(v:real^3), (x':real^3)}` th) ) + THEN ASM_REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] THEN STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (x':real^3)`]th3) THEN ASM_MESON_TAC[]; (*4*) + +EQ_TAC THENL(*5*)[ + +POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "a") THEN STRIP_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[aff];(*5*) + +ASM_TAC THEN SET_TAC[]](*5*)](*4*)] (*3*)]]);; + + +let subset_cyclic_set_fan=prove(`!x:real^3 v:real^3 V:real^3->bool W:real^3->bool. +V SUBSET W /\ cyclic_set W x v ==> cyclic_set V x v`, + +REPEAT GEN_TAC THEN REWRITE_TAC[cyclic_set] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`V:real^3->bool`;`W:real^3->bool`]FINITE_SUBSET) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN SET_TAC[]);; + + + +let property_of_cyclic_set=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. + cyclic_set {u, w1, w2} x v +==> ~(v=x) /\ ~(u=x)/\ ~collinear {vec 0, v-x, u-x}`, + +(let th= prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. +x IN {x,w1,w2}`, SET_TAC[]) in + +(let th1=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. +x IN affine hull {x,v} +`,REPEAT GEN_TAC THEN REWRITE_TAC[AFFINE_HULL_2;INTER; IN_ELIM_THM] THEN EXISTS_TAC`&1` THEN EXISTS_TAC `&0` THEN + MESON_TAC[REAL_ARITH`&1+ &0= &1`; VECTOR_ARITH`x= &1 % x + &0 % v`]) +in + +(let th2=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. +x IN {x,w1,w2} INTER affine hull {x,v} +`, REWRITE_TAC[INTER;IN_ELIM_THM] THEN REWRITE_TAC[th;th1]) in + + +REPEAT GEN_TAC THEN +REWRITE_TAC[COLLINEAR_LEMMA;DE_MORGAN_THM;VECTOR_ARITH`a-b=vec 0 <=> a=b`;cyclic_set;] THEN STRIP_TAC + THEN ASM_REWRITE_TAC[VECTOR_ARITH`(v:real^3)=(x:real^3) <=> x=v`] THEN STRIP_TAC +THENL[ STRIP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") THEN DISCH_TAC +THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3`; `w1:real^3`; `w2:real^3`] th2) THEN ASM_TAC THEN SET_TAC[]; + +STRIP_TAC THENL[ + +STRIP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") THEN DISCH_TAC +THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3`; `w1:real^3`; `w2:real^3`] th2) THEN ASM_TAC THEN SET_TAC[]; + +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"a") +THEN DISCH_TAC +THEN REMOVE_THEN "a" MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`(c:real) % ((v:real^3)-(x:real^3))=(u:real^3)-x <=> u = (&1 - c) % x+c % v`] +THEN DISCH_TAC +THEN SUBGOAL_THEN `(u:real^3) IN affine hull {(x:real^3),(v:real^3)}` ASSUME_TAC +THENL[ +REWRITE_TAC[AFFINE_HULL_2; IN_ELIM_THM] +THEN EXISTS_TAC `&1 - (c:real)` +THEN EXISTS_TAC`c:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - (c:real) +c= &1`;]; + +MP_TAC(ISPECL[`u:real^3`; `v:real^3`; `u:real^3`; `w1:real^3`; `w2:real^3`]th) +THEN DISCH_TAC +THEN ASM_TAC +THEN SET_TAC[INTER] +]]]))));; + + +let property_of_cyclic_set1=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. + cyclic_set {u, w1, w2} x v ==> ~collinear {x, v, w1}`, + +(let th=prove(`{u,w1,w2}={w1,u,w2}`,SET_TAC[]) in + +REPEAT GEN_TAC THEN DISCH_TAC +THEN MP_TAC (SPECL [`x:real^3`; `v:real^3`; `w1:real^3`;`u:real^3`; `w2:real^3`] property_of_cyclic_set) THEN ASM_REWRITE_TAC[th] THEN STRIP_TAC THEN ASM_REWRITE_TAC[COLLINEAR_3]));; + +let property_of_cyclic_set2=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. + cyclic_set {u, w1, w2} x v +==> ~collinear {x, v, w2}`, +( let th=prove(`{u,w1,w2}={w2,w1,u}`,SET_TAC[]) in +( let th1=prove(`{u,w1,w2}={w1,w2,u}`,SET_TAC[]) in + +REPEAT GEN_TAC THEN DISCH_TAC +THEN MP_TAC (SPECL [`x:real^3`; `v:real^3`; `w2:real^3`;`w1:real^3`; `u:real^3`] property_of_cyclic_set) +THEN ASM_REWRITE_TAC[th] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN MESON_TAC[th1;COLLINEAR_3])));; + +let property_of_cyclic_set3=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. + cyclic_set {u, w1, w2} x v +==> ~ collinear {x, v, u}`, +( let th=prove(`{u,w1,w2}={w1,u,w2}`,SET_TAC[]) in + +REPEAT GEN_TAC THEN DISCH_TAC +THEN MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`;`w1:real^3`; `w2:real^3`] property_of_cyclic_set) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_MESON_TAC[COLLINEAR_3;th]));; + + + +let properties_of_cyclic_set=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. + cyclic_set {u, w1, w2} x v +==> ~(v=x) /\ ~(u=x)/\ ~collinear {vec 0, v-x, u-x} +/\ ~collinear {x, v, u} +/\ ~collinear {x, v, w1} +/\ ~collinear {x, v, w2}`, + +MESON_TAC[property_of_cyclic_set;property_of_cyclic_set2;property_of_cyclic_set1;property_of_cyclic_set3]);; + + + +let XOHLED=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3). +FAN(x,V,E) /\ v IN V +==> cyclic_set (set_of_edge v V E) x v`, +MESON_TAC[CYCLIC_SET_EDGE_FAN]);; + + + + +let d1_fan =new_definition` +d1_fan (x,V,E) ={(x':real^3,v:real^3,w:real^3,w1:real^3)| (x'=x) /\ ({v,w} IN E)/\ (w1 = sigma_fan x V E v w)}`;; + +(* d2_fan not yet used *) + +let d2_fan=new_definition`d2_fan (x,V,E)={ (x',v)| (x'=x) /\ (V v) /\ ((set_of_edge v V E) ={})}`;; + + +let inverse_sigma_fan_alt=new_definition`inverse_sigma_fan_alt x V E v w = @a. sigma_fan x V E v a=w`;; + +let e_fan=new_definition` e_fan (x:real^3) V E = (\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). (x,w,v,(sigma_fan x V E w v)))`;; + + +let f_fan=new_definition`f_fan (x:real^3) V E = (\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). (x,w,(inverse_sigma_fan_alt x V E w v),v) )`;; + + + +let n_fan=new_definition`n_fan (x:real^3) V E =(\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). (x,v,(sigma_fan x V E v w),(sigma_fan x V E v (sigma_fan x V E v w))))`;; + +(* i_fan corrects the 4th coordinate to be + the dart *) + +let i_fan=new_definition`i_fan (x:real^3) V E=(\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). (x,v,w,(sigma_fan x V E v w)))`;; + +let pr1=new_definition`pr1=(\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). x)`;; + +let pr2=new_definition`pr2=(\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). v)`;; + +let pr3=new_definition`pr3=(\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). w)`;; + +let pr4=new_definition`pr4=(\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). w1)`;; + +(* if f = sigma, the power_map_points gives + iterates of sigma (for fixed x v) *) + + +let power_map_points= new_recursive_definition num_RECURSION `(power_map_points f x V E v w 0 = w)/\(power_map_points f x V E v w (SUC n)= f x V E v (power_map_points f x V E v w n))`;; + +(* This is the composition operator (o), + specialized to functions on 4-tuples *) + +let o_funs=new_definition`!(f:real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3) (g:real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3). o_funs f g =(\(x:real^3,y:real^3,z:real^3,t:real^3). f (pr1 (g(x,y,z,t)),pr2(g(x,y,z,t)),pr3(g(x,y,z,t)),pr4(g(x,y,z,t))))`;; + +(* powers of permutations *) + +let power_maps= new_recursive_definition num_RECURSION `(power_maps (f:real^3->(real^3->bool)->((real^3->bool)->bool)->real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) 0 = i_fan (x:real^3) V E) /\ (power_maps f x V E (SUC n)= o_funs (f x V E) (power_maps f x V E n))`;; + + +(* powers of node map *) + + + + +let power_n_fan= new_definition`power_n_fan x V E n=( \(x,v,w,w1). (x,v,(power_map_points sigma_fan x V E v w n),(power_map_points sigma_fan x V E v w (SUC n))))`;; + + +(* the node of a dart, in a special form + for fans *) + + +let a_node_fan=new_definition`a_node_fan x V E (x,v,w,w1)={a | ?n. a=(power_maps n_fan x V E n) (x,v,w,sigma_fan x V E v w)}`;; + + +(* The set X(V,E) *) + +let xfan= new_definition`xfan (x,V,E)={v | ?e. (E e)/\(v IN aff_ge {x} e)}`;; + +(* See comment by AS in fan_defs.hl. The correct definition is there. *) +let yfan_deprecated= new_definition`yfan_deprecated (x,V,E)={v:real^3 | ?e. ( E e )/\(~(v IN aff_ge {x} e))}`;; + + +(* +W^0_{dart}(x,v,w...) +*) + +let w_dart_fan=new_definition`w_dart_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) ((y:real^3),(v:real^3),(w:real^3),(w1:real^3))= +if (CARD (set_of_edge v V E) > 1) then wedge x v w (sigma_fan x V E v w) +else +(if set_of_edge v V E ={w} then (UNIV:real^3->bool) DIFF aff_ge {x,v} {w} +else (if set_of_edge v V E ={} then (UNIV:real^3->bool) DIFF aff {x,v} else {}))`;; + + + + + + + + + +let image_power_map_points=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ (u IN set_of_edge v V E) +==> power_map_points (sigma_fan) x V E v u i IN set_of_edge v V E`, +INDUCT_TAC THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[power_map_points] +THENL[ +ASM_MESON_TAC[]; +REPEAT (POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC "a") THEN REPEAT DISCH_TAC +THEN REMOVE_THEN "a" (fun th -> MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3)`] th)) THEN +ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN DISJ_CASES_TAC(SET_RULE `set_of_edge v V E ={power_map_points (sigma_fan) x V E v u i}\/ ~(set_of_edge v V E ={power_map_points (sigma_fan) x V E v u i})`) +THENL[ASM_MESON_TAC[sigma_fan]; +ASM_MESON_TAC[SIGMA_FAN]]]);; + + +let IN2_ORBITS_FAN=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ ({v,u} IN E) +==> {v,power_map_points (sigma_fan) x V E v u i} IN E`, +MESON_TAC[image_power_map_points;properties_of_set_of_edge_fan]);; + +let IN1_ORBITS_FAN=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ (u IN set_of_edge v V E) +==> {v,power_map_points (sigma_fan) x V E v u i} IN E`, +MESON_TAC[image_power_map_points;properties_of_set_of_edge_fan]);; + + +let remark_power_map_points=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ ({v,u} IN E) +==> +power_map_points (sigma_fan) x V E v u i IN set_of_edge v V E +/\ {v,power_map_points sigma_fan x V E v u i} IN E +/\ + ~(collinear {x,v,power_map_points sigma_fan x V E v u i}) +/\ ~(x = power_map_points (sigma_fan) x V E v u i) /\ + ~(v = power_map_points (sigma_fan) x V E v u i) /\ + DISJOINT {x, v} {power_map_points (sigma_fan) x V E v u i} /\ + ~((power_map_points (sigma_fan) x V E v u i) IN aff {x, v}) /\ + DISJOINT {x} {v, (power_map_points (sigma_fan) x V E v u i)} `, +MESON_TAC[IN2_ORBITS_FAN;remark1_fan;image_power_map_points;properties_of_set_of_edge_fan]);; + + + + + + + +(*-------------------------------------------------------------------------------------------*) +(* the properties in normal vector *) +(*-------------------------------------------------------------------------------------------*) + +let imp_norm_not_zero_fan=prove(`!v:real^3 x:real^3. ~(v = x) ==> ~(norm ( v - x) = &0)`, +REPEAT GEN_TAC THEN REPEAT STRIP_TAC THEN SUBGOAL_THEN `(v:real^3)-(x:real^3)= vec 0` ASSUME_TAC THENL + [POP_ASSUM MP_TAC THEN MESON_TAC[NORM_EQ_0]; + SUBGOAL_THEN `(v:real^3) = (x:real^3)` ASSUME_TAC THENL + [POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC; + ASM_TAC THEN SET_TAC[]]]);; + + +let imp_norm_gl_zero_fan=prove(`!v:real^3 x:real^3. ~(v = x) ==> inv(norm ( v - x)) > &0`, +REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `~(norm ( (v:real^3) - (x:real^3)) = &0)` ASSUME_TAC THENL + [ASM_MESON_TAC[imp_norm_not_zero_fan]; + MP_TAC (ISPEC `(v:real^3)-(x:real^3)` NORM_POS_LE) THEN DISCH_TAC THEN + SUBGOAL_THEN `norm((v:real^3)-(x:real^3))> &0` ASSUME_TAC THENL + [POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + MP_TAC (ISPEC `norm((v:real^3)-(x:real^3))` REAL_LT_INV_EQ) THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]);; + + +let imp_inv_norm_not_zero_fan=prove(`!v:real^3 x:real^3. ~(v = x) ==> ~(inv(norm ( v - x)) = &0)`, +REPEAT GEN_TAC THEN DISCH_TAC THEN SUBGOAL_THEN `inv(norm ((v:real^3) - (x:real^3))) > &0` ASSUME_TAC +THENL + [ASM_MESON_TAC[imp_norm_gl_zero_fan]; + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]);; + + +let imp_norm_ge_zero_fan=prove(`!v:real^3 x:real^3. ~(v = x) ==> inv(norm ( v - x)) >= &0`, +REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `~(norm ( (v:real^3) - (x:real^3)) = &0)` ASSUME_TAC THENL + [ASM_MESON_TAC[imp_norm_not_zero_fan]; + MP_TAC (ISPEC `(v:real^3)-(x:real^3)` NORM_POS_LE) THEN DISCH_TAC THEN + SUBGOAL_THEN `norm((v:real^3)-(x:real^3))> &0` ASSUME_TAC THENL + [POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + MP_TAC (ISPEC `norm((v:real^3)-(x:real^3))` REAL_LT_INV_EQ) THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]]);; + +let norm_of_normal_vector_is_unit_fan=prove(`!v:real^3 x:real^3. ~(v = x) ==> norm(inv(norm ( v - x))% (v-x))= &1`, +REPEAT GEN_TAC THEN DISCH_TAC THEN REWRITE_TAC[NORM_MUL] THEN SUBGOAL_THEN ` inv(norm ( (v:real^3) - (x:real^3))) >= &0` ASSUME_TAC THENL[ ASM_MESON_TAC[imp_norm_ge_zero_fan]; + SUBGOAL_THEN ` ~(norm ( (v:real^3) - (x:real^3))= &0)` ASSUME_TAC THENL + [ASM_MESON_TAC[imp_norm_not_zero_fan]; + SUBGOAL_THEN ` abs(inv(norm ( (v:real^3) - (x:real^3))))= inv(norm ( (v:real^3) - (x:real^3)))` ASSUME_TAC THENL + [ASM_MESON_TAC[REAL_ABS_REFL;REAL_ARITH `(a:real)>= &0 <=> &0 <= a`; ]; + MP_TAC(ISPEC `norm ( (v:real^3) - (x:real^3))` REAL_MUL_LINV)THEN ASM_REWRITE_TAC[]]]]);; + + + +(*---------------------------------------------------------------------------------------*) +(* the normal coordinate is the definiton of frame in flyspeck(above JBDNJJB) *) +(*---------------------------------------------------------------------------------------*) + + +let e3_fan=new_definition`e3_fan (x:real^3) (v:real^3) (u:real^3) = inv(norm((v:real^3)-(x:real^3))) % ((v:real^3)-(x:real^3))`;; + + + + + let e2_fan=new_definition`e2_fan (x:real^3) (v:real^3) (u:real^3) = inv(norm((e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3)))) % ((e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3))) `;; + +let e1_fan=new_definition`e1_fan (x:real^3) (v:real^3) (u:real^3)=(e2_fan (x:real^3) (v:real^3) (u:real^3)) cross (e3_fan (x:real^3) (v:real^3) (u:real^3))`;; + + + + let e3_mul_dist_fan=prove(`!x:real^3 v:real^3 u:real^3. ~(v=x) ==> dist (v,x) % e3_fan x v u = v - x`, +REPEAT GEN_TAC THEN REWRITE_TAC[e3_fan; dist; VECTOR_ARITH `(a:real) % (b:real)% (v:real^3)=(a*b)%v`] THEN +MESON_TAC[imp_norm_not_zero_fan; REAL_MUL_RINV; VECTOR_ARITH `&1 %(v:real^3)=v`]);; + +let norm_dot_fan=prove(`!x:real^3. norm x = &1 ==> x dot x = &1`, + ASM_MESON_TAC[NORM_POW_2; REAL_ARITH `&1 pow 2= &1`]);; + + + let e3_is_normal_fan=prove(`!x:real^3 v:real^3 u:real^3. ~(v=x) ==> e3_fan x v u dot e3_fan x v u = &1`, +REPEAT GEN_TAC THEN REWRITE_TAC[e3_fan]THEN DISCH_TAC +THEN SUBGOAL_THEN `norm(inv(norm((v:real^3)-(x:real^3))) %(v-x)) pow 2= &1 pow 2` ASSUME_TAC THENL + [ASM_MESON_TAC[norm_of_normal_vector_is_unit_fan] ; +ASM_MESON_TAC[NORM_POW_2; REAL_ARITH `&1 pow 2= &1`]]);; + + let e2_is_normal_fan= prove(`!x:real^3 v:real^3 u:real^3. ~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) ==> e2_fan x v u dot e2_fan x v u = &1`, +REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `~((e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3))= vec 0)` ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[e3_fan;CROSS_LMUL] +THEN DISCH_TAC THEN MP_TAC(ISPECL [`v:real^3`; `x:real^3`] imp_inv_norm_not_zero_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL [`inv(norm((v:real^3)-(x:real^3)))`; `((v:real^3) -(x:real^3)) cross ((u:real^3)-(x:real^3))`; `(vec 0):real^3`] VECTOR_MUL_LCANCEL_IMP) +THEN ASM_REWRITE_TAC[VECTOR_MUL_RZERO;CROSS_EQ_0 ]; + +MP_TAC(ISPECL [`(e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3))`; `((vec 0):real^3)`] norm_of_normal_vector_is_unit_fan) THEN +ASM_REWRITE_TAC[] THEN REWRITE_TAC[e2_fan; VECTOR_ARITH`(v:real^3)- vec 0 = v`] THEN MESON_TAC[norm_dot_fan]]);; + + let e2_orthogonal_e3_fan=prove(`!x:real^3 v:real^3 u:real^3. +~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) ==> (e2_fan x v u) dot (e3_fan x v u)= &0`, +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[e2_fan;e3_fan;CROSS_LMUL;DOT_RMUL;] THEN VEC3_TAC);; + + + + let e1_is_normal_fan=prove(`!x:real^3 v:real^3 u:real^3. +~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) ==> e1_fan x v u dot e1_fan x v u = &1`, +REPEAT GEN_TAC THEN STRIP_TAC THEN +REWRITE_TAC[e1_fan;DOT_CROSS] THEN +MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3` ] e2_orthogonal_e3_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3` ] e2_is_normal_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3` ] e3_is_normal_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC);; + + let e1_orthogonal_e3_fan=prove(`!x:real^3 v:real^3 u:real^3. ~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) +==> (e1_fan x v u) dot (e3_fan x v u)= &0`, +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[e1_fan;DOT_CROSS_SELF] );; + + + let e1_orthogonal_e2_fan=prove(`!x:real^3 v:real^3 u:real^3. ~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) +==> (e1_fan x v u) dot (e2_fan x v u)= &0`, +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[e1_fan;DOT_CROSS_SELF] );; + + + let e1_cross_e2_dot_e3_fan=prove(`!x:real^3 v:real^3 u:real^3. ~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) ==> +&0 < (e1_fan x v u cross e2_fan x v u) dot e3_fan x v u`, +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[e1_fan;CROSS_TRIPLE] +THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3` ] e1_is_normal_fan) +THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[e1_fan] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC);; + + + + let orthonormal_e1_e2_e3_fan=prove(`!x:real^3 v:real^3 u:real^3. ~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) ==> +(orthonormal (e1_fan x v u) (e2_fan x v u) (e3_fan x v u))`, +REPEAT GEN_TAC THEN REWRITE_TAC[orthonormal] THEN DISCH_TAC THEN +ASM_MESON_TAC[e1_is_normal_fan;e2_is_normal_fan;e3_is_normal_fan;e1_orthogonal_e2_fan; +e1_orthogonal_e3_fan;e2_orthogonal_e3_fan;e1_cross_e2_dot_e3_fan]);; + + + + let dot_e2_fan=prove(`!x:real^3 v:real^3 u:real^3. ~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) +==> (u-x) dot e2_fan x v u = &0`, +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[e2_fan;DOT_RMUL;DOT_CROSS_SELF] THEN REAL_ARITH_TAC);; + +let vdot_e2_fan=prove(`!x:real^3 v:real^3 u:real^3. ~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) +==> (v-x) dot e2_fan x v u = &0`, +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[e2_fan;e3_fan;CROSS_LMUL;DOT_RMUL;DOT_CROSS_SELF] THEN REAL_ARITH_TAC);; + +let vcross_e3_fan=prove(`!x:real^3 v:real^3 u:real^3. ~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) +==> +(v - x) cross (e3_fan x v u) = vec 0`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[e3_fan;CROSS_RMUL;CROSS_REFL] THEN VECTOR_ARITH_TAC);; + +let udot_e1_fan=prove(`!x:real^3 v:real^3 u:real^3. +~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) +==> &0 < (u - x) dot e1_fan x v u `, +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[e1_fan; e2_fan;CROSS_LMUL;DOT_RMUL;DOT_SYM;DOT_LMUL;CROSS_TRIPLE] +THEN SUBGOAL_THEN `~((e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3))= vec 0)` ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC THEN MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[e3_fan;CROSS_LMUL] +THEN DISCH_TAC THEN MP_TAC(ISPECL [`v:real^3`; `x:real^3`] imp_inv_norm_not_zero_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL [`inv(norm((v:real^3)-(x:real^3)))`; `((v:real^3) -(x:real^3)) cross ((u:real^3)-(x:real^3))`; `(vec 0):real^3`] VECTOR_MUL_LCANCEL_IMP) +THEN ASM_REWRITE_TAC[VECTOR_MUL_RZERO;CROSS_EQ_0 ]; +MP_TAC(ISPECL [`(e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3))`; `((vec 0):real^3)`]imp_norm_gl_zero_fan) THEN +ASM_REWRITE_TAC[REAL_ARITH`(a:real)> &0 <=> &0 < (a:real)`;VECTOR_ARITH `(a:real^3)- vec 0=a`] THEN DISCH_TAC + THEN MP_TAC(ISPEC `e3_fan (x:real^3) (v:real^3) (u:real^3) cross (u-x)`DOT_POS_LT) THEN ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[REAL_LT_MUL]]);; + +let udot_e1_fan1=prove(`!x:real^3 v:real^3 u:real^3. +~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) +==> &0 <= (u - x) dot e1_fan x v u `, +REPEAT GEN_TAC THEN STRIP_TAC THEN +MP_TAC(ISPECL[`x:real^3` ;`v:real^3` ;`u:real^3`]udot_e1_fan) THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC);; + +let vdot_e1_fan=prove(`!x:real^3 v:real^3 u:real^3. +~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) +==> (v - x) dot e1_fan x v u = &0`, +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]e3_mul_dist_fan) THEN RES_TAC THEN SYM_ASSUM_TAC THEN +REWRITE_TAC[DOT_SYM;DOT_LMUL] THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]e1_orthogonal_e3_fan) THEN RESA_TAC THEN +REAL_ARITH_TAC);; + + + + + + +let properties_coordinate=prove(`!x:real^3 v:real^3 u:real^3. +~(collinear {x, v, u}) +==> (orthonormal (e1_fan x v u) (e2_fan x v u) (e3_fan x v u)) +/\ dist (v,x) % e3_fan x v u = v - x +/\ ((v - x) cross (e3_fan x v u) = vec 0) +/\ (v-x) dot e2_fan x v u = &0 +/\ ((u-x) dot e2_fan x v u = &0) +/\ &0 <= (u - x) dot e1_fan x v u +/\ &0 < (u - x) dot e1_fan x v u +/\ (v - x) dot e1_fan x v u = &0`, +( let lem=prove(`!a b c. {a,b,c}={b,a,c}`,SET_TAC[]) in +REPEAT GEN_TAC THEN DISCH_THEN(LABEL_TAC "a") THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]th3) + THEN RED_TAC THEN REMOVE_THEN "a" MP_TAC THEN REWRITE_TAC[lem;] THEN GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[COLLINEAR_3] +THEN +ASM_MESON_TAC[orthonormal_e1_e2_e3_fan;e3_mul_dist_fan; dot_e2_fan;vdot_e2_fan;vcross_e3_fan;udot_e1_fan;udot_e1_fan1;vdot_e1_fan]));; + + +let module_of_vector =prove(`!x:real^3 v:real^3 u:real^3 w:real^3 r:real psi:real h:real. + ~(v=x) /\ ~(u=x) /\ ~(collinear {vec 0, v-x, u-x}) +/\ (&0 < r) /\ (w=(r * cos psi) % e1_fan x v u + (r * sin psi) % e2_fan x v u + h % (v-x)) +==> +sqrt(((w cross (e3_fan x v u)) dot e1_fan x v u) pow 2 + ((w cross (e3_fan x v u)) dot e2_fan x v u) pow 2) = r`, +REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[CROSS_LADD;CROSS_LMUL;] THEN +MP_TAC(ISPECL [`x:real^3`; `v:real^3`; `u:real^3` ] orthonormal_e1_e2_e3_fan) THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "a") THEN +MP_TAC (ISPECL [`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`; +`e3_fan (x:real^3) (v:real^3) (u:real^3)`]ORTHONORMAL_CROSS) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ISPECL [`x:real^3`; `v:real^3`; `u:real^3` ]vcross_e3_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]CROSS_SKEW) + THEN DISCH_TAC THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[DOT_LADD;DOT_LMUL;DOT_LZERO;DOT_LNEG] + THEN REMOVE_THEN "a" MP_TAC THEN REWRITE_TAC[orthonormal] THEN DISCH_TAC THEN ASM_REWRITE_TAC[DOT_SYM] + THEN REWRITE_TAC[REAL_ARITH `-- &0 = &0`; REAL_ARITH`(a:real)* &0 = &0`; REAL_ARITH `(a:real) * &1 = a`; +REAL_ARITH `(a:real) + &0 = a`;REAL_ARITH `&0 + (a:real) = a`;REAL_POW_MUL; REAL_ARITH `-- &1 pow 2 = &1`; +REAL_ARITH `(d:real) * (b:real) + d * (c:real) = d * ( b + c)`;SIN_CIRCLE; sqrt] THEN MATCH_MP_TAC SELECT_UNIQUE +THEN REWRITE_TAC[BETA_THM] THEN GEN_TAC THEN EQ_TAC + + THENL[ + STRIP_TAC THEN SUBGOAL_THEN `((y:real) - (r:real))* (y + r) = &0` ASSUME_TAC + THENL[ + REWRITE_TAC[REAL_ADD_LDISTRIB; REAL_ARITH `((a:real)- (b:real)) * (c:real)= a *c - b * c`; +REAL_ARITH`(y:real) * (r:real)= r * y`; REAL_ARITH `((a:real) +(b:real)) - ((b:real) + (c:real))= a - c`; +REAL_ARITH `(a:real)- (c:real)= &0 <=> a = c`] + THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + MP_TAC (ISPECL [`(y:real)- (r:real)`; `(y:real)+(r:real)` ]REAL_ENTIRE) THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC + THENL + [POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC]]; + + DISCH_TAC THEN ASM_REWRITE_TAC[] + THEN REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC]);; + + + +(****************************************************************************) +(* some properties of azim in the orthonormal frame *) +(****************************************************************************) + +let collinear_imp_azim_is_rezo_fan=prove( +`!x:real^3 v:real^3 u:real^3 y:real h1:real h2:real. +~(v = x) /\ ~(u = x) /\ ~collinear {x, v, u} +/\ &0 <= y /\ + y < &2 * pi /\ + ( !e1:real^3 e2:real^3 e3:real^3. + orthonormal e1 e2 e3 /\ dist (v,x) % e3 = v - x + ==> (?psi:real r1:real r2:real. + u - x = + (r1 * cos psi) % e1 + (r1 * sin psi) % e2 + h1 % (v - x) /\ + u - x = + (r2 * cos (psi + y)) % e1 + + (r2 * sin (psi + y)) % e2 + + h2 % (v - x) /\ + &0 < r1 /\ + &0 < r2)) + ==> y = &0`, +REPEAT GEN_TAC THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `~collinear {vec 0, (v:real^3)-(x:real^3), (u:real^3)-x}` ASSUME_TAC + THENL (*1*)[ + POP_ASSUM MP_TAC + THEN MATCH_MP_TAC MONO_NOT + THEN MP_TAC(ISPECL [`v:real^3`; `x:real^3`; `u:real^3`] COLLINEAR_3) + THEN SUBGOAL_THEN `{(v:real^3),(x:real^3),(u:real^3)}={x,v,u}` ASSUME_TAC + THENL[SET_TAC[]; ASM_REWRITE_TAC[] THEN SET_TAC[]]; (*1*) + REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN DISCH_THEN (LABEL_TAC "1") THEN DISCH_THEN (LABEL_TAC "2") THEN REWRITE_TAC[LEFT_IMP_FORALL_THM] + THEN EXISTS_TAC `e1_fan (x:real^3) (v:real^3) (u:real^3)` + THEN EXISTS_TAC `e2_fan (x:real^3) (v:real^3) (u:real^3)` + THEN EXISTS_TAC `e3_fan (x:real^3) (v:real^3) (u:real^3)` + THEN MP_TAC(ISPECL [`(x:real^3)` ;`(v:real^3)`; `(u:real^3)`] orthonormal_e1_e2_e3_fan) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL [`(x:real^3)` ;`(v:real^3)`;`u:real^3`] e3_mul_dist_fan)THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN(LABEL_TAC "AB") THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`; `(u:real^3)- (x:real^3)`; `r1:real`; `psi:real`; `h1:real`] module_of_vector) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`; `(u:real^3)- (x:real^3)`; `r2:real`; `(psi:real)+(y:real)`; `h2:real`] module_of_vector) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC + THEN ASM_REWRITE_TAC[] THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC th) + THEN REPEAT STRIP_TAC THEN SUBGOAL_THEN `sin (psi:real)= &0` ASSUME_TAC + THENL (*2*)[ + MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] dot_e2_fan) + THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[DOT_LADD;DOT_LMUL] + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] vdot_e2_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] e2_is_normal_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] e1_orthogonal_e2_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[REAL_ARITH`(a:real)* &0 = &0`; REAL_ARITH`(a:real)+ &0= a`; REAL_ARITH`&0 + (a:real)= a`; + REAL_ARITH`(a:real) * &1= a`] + THEN DISCH_TAC + THEN MATCH_MP_TAC(ISPECL [`sin (psi:real)`;`&0`; `r1:real`] REAL_EQ_LCANCEL_IMP) THEN ASM_REWRITE_TAC[] + THEN REPEAT(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; (*2*) + + + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN DISCH_THEN (LABEL_TAC "a") THEN DISCH_THEN (LABEL_TAC "b") + THEN REPEAT (DISCH_TAC) THEN REMOVE_THEN "a" MP_TAC THEN REMOVE_THEN "b" MP_TAC + THEN REWRITE_TAC[COS_ADD;SIN_ADD] THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] dot_e2_fan) + THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[DOT_LADD;DOT_LMUL] + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] vdot_e2_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] e2_is_normal_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] e1_orthogonal_e2_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[REAL_ARITH`(a:real)* &0 = &0`; REAL_ARITH`&0 * (a:real) = &0`; + REAL_ARITH`(a:real)+ &0= a`; REAL_ARITH`&0 + (a:real)= a`; REAL_ARITH`(a:real) * &1= a`;REAL_ENTIRE] + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN(LABEL_TAC "a") THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC + THEN STRIP_TAC + THENL(*3*)[ + REPEAT(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC;(*3*) + MP_TAC(ISPEC `psi:real` SIN_CIRCLE) THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC;(*3*) + MP_TAC(ISPEC `y:real` SIN_EQ_0) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN POP_ASSUM MP_TAC + THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "3") THEN DISCH_TAC THEN REMOVE_THEN "1" MP_TAC + THEN REMOVE_THEN "2" MP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(PI_WORKS) THEN REPEAT STRIP_TAC + THEN MP_TAC(ISPECL [ `n:real`;`&2`;`pi:real`]REAL_LT_RCANCEL_IMP) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (LABEL_TAC "4") + THEN MP_TAC(ISPECL [ `&0`;`n:real`;`pi:real`]REAL_LE_RCANCEL_IMP) + THEN REWRITE_TAC[REAL_ARITH`&0 * (a:real) = &0`] + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC "5") + THEN MP_TAC(ISPECL [`n:real`; `pi:real`]REAL_ENTIRE) THEN DISCH_TAC THEN ASM_REWRITE_TAC[] + THEN REMOVE_THEN "3" MP_TAC THEN REWRITE_TAC[integer] + THEN MP_TAC(ISPEC `n:real` REAL_ABS_REFL) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC THEN REMOVE_THEN "4" MP_TAC THEN REMOVE_THEN "5" MP_TAC + THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC + THEN MP_TAC(ISPECL [`0`; `n':num`]REAL_OF_NUM_LE) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL [`n':num`; `2`]REAL_OF_NUM_LT) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN SUBGOAL_THEN `(n':num)= 0 \/ n' = 1` ASSUME_TAC + THENL (*4*)[ + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC;(*4*) + POP_ASSUM MP_TAC THEN STRIP_TAC + THENL(*5*)[ + ASM_MESON_TAC[REAL_OF_NUM_EQ];(*5*) + POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "A") THEN REPEAT DISCH_TAC + THEN REMOVE_THEN "A" MP_TAC + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + + THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "A") THEN REPEAT DISCH_TAC + THEN REMOVE_THEN "A" MP_TAC + THEN POP_ASSUM MP_TAC + THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "A") THEN REPEAT DISCH_TAC + THEN REMOVE_THEN "A" MP_TAC THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[REAL_ARITH `&1 * (a:real)=a`] + THEN POP_ASSUM MP_TAC + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "A") THEN REPEAT DISCH_TAC + THEN REMOVE_THEN "A" MP_TAC THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[SIN_PI;COS_PI; REAL_ARITH `(a:real)- &0 = a`; REAL_ARITH `(a:real) * &0= &0`; + REAL_ARITH `(a:real) * -- &1= -- a`; + VECTOR_ARITH `&0 % (v:real^3)= vec 0`; VECTOR_ARITH `(v:real^3)+ vec 0 + (w:real^3)= v+w`] + THEN REMOVE_THEN "AB" MP_TAC THEN DISCH_TAC + THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM(th)]) THEN DISCH_TAC + THEN SUBGOAL_THEN `(((r2:real) * --cos (psi:real)) % e1_fan (x:real^3) (v:real^3) (u:real^3) + (h2:real) % dist (v,x) % e3_fan x v u) dot e1_fan x v u =(((r2:real) * cos psi) % e1_fan x v u + (h1:real) % dist (v,x) % e3_fan x v u) dot e1_fan x v u` ASSUME_TAC + THENL (*6*)[ + ASM_REWRITE_TAC[]; (*6*) + POP_ASSUM MP_TAC THEN REWRITE_TAC[DOT_LADD;DOT_LMUL;DOT_SYM;] + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] e1_is_normal_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] e1_orthogonal_e3_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[REAL_ARITH `(a:real) * &0 = &0`; REAL_ARITH `(a:real)+ &0=a`; + REAL_ARITH `(a:real) * &1 =a`; + REAL_ARITH `(a:real) *(-- b)= a * b <=> &2 * a * b = &0`] + THEN DISCH_TAC + THEN MP_TAC(ISPECL [`&2 * (r2:real)`; `cos (psi:real)`]REAL_ENTIRE) + THEN REWRITE_TAC[REAL_ARITH `((a:real)*(b:real))*(c:real)=a * b * c`] + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THENL(*7*)[ + REPEAT(POP_ASSUM MP_TAC ) THEN REAL_ARITH_TAC;(*7*) + MP_TAC( ISPEC `psi:real` SIN_CIRCLE) + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[REAL_ARITH `&0 pow 2= &0`; REAL_ARITH `&0 + &0 = &0`] + THEN SET_TAC[](*7*)](*6*)](*5*)]]]]]);; + + + + +let azim_is_zero_fan=prove(`!x:real^3 v:real^3 u:real^3. +~(v=x) /\ ~(u=x) /\ (~(collinear {x, v, u})) +==> +azim (x:real^3) (v:real^3) (u:real^3) (u:real^3) = &0`, +REPEAT GEN_TAC THEN STRIP_TAC THEN +REWRITE_TAC[azim_def] THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC SELECT_UNIQUE +THEN REWRITE_TAC[BETA_THM] THEN GEN_TAC THEN EQ_TAC +THENL[ + REPEAT STRIP_TAC + THEN MP_TAC (ISPECL[`x:real^3`; `v:real^3`; `u:real^3`; `y:real`; `h1:real`; `h2:real`]collinear_imp_azim_is_rezo_fan) + THEN ASM_REWRITE_TAC[]; + DISCH_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THENL[ + REAL_ARITH_TAC; + STRIP_TAC + THENL[ + ASSUME_TAC(PI_WORKS) THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + MP_TAC(ISPECL [`x:real^3`; `v:real^3`; `u:real^3`; `u:real^3`] AZIM_EXISTS) + THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC + THEN EXISTS_TAC `h1:real` + THEN EXISTS_TAC `h2:real` + THEN MP_TAC (ISPECL[`x:real^3`; `v:real^3`; `u:real^3`; `theta:real`; `h1:real`; `h2:real`]collinear_imp_azim_is_rezo_fan) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM MP_TAC + THEN DISCH_THEN(LABEL_TAC "a") THEN DISCH_THEN (LABEL_TAC "b") + THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[]]]]);; + + +let SINCOS_PRINCIPAL_VALUE_FAN = prove( +`!x:real. ?y:real. (&0<= y /\ y < &2* pi) /\ (sin(y) = sin(x) /\ cos(y) = cos(x))`, + GEN_TAC THEN MP_TAC(SPECL [`x:real`] SINCOS_PRINCIPAL_VALUE) THEN STRIP_TAC THEN +DISJ_CASES_TAC(REAL_ARITH`((y:real) < &0)\/ (&0 <= y)`) THENL +[ EXISTS_TAC `(y:real)+ &2 * pi` THEN ASSUME_TAC(PI_POS) +THEN ASM_REWRITE_TAC[SIN_PERIODIC;COS_PERIODIC] THEN REPEAT(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; + EXISTS_TAC `(y:real)` THEN ASSUME_TAC(PI_POS) +THEN ASM_REWRITE_TAC[] THEN REPEAT(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC]);; + +let sin_of_u_fan=prove(`!x:real^3 v:real^3 u:real^3 r1:real psi:real h1:real. + ~collinear {u,x,v} /\ ~(v=x) /\ ~(u=x)/\ ~collinear {vec 0, v-x, u-x} /\ &0 < r1 +/\ u - x = (r1 * cos psi) % (e1_fan x v u) + (r1 * sin psi) % (e2_fan x v u) + h1 % (v-x) +==> sin psi = &0`, +REPEAT GEN_TAC THEN STRIP_TAC THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] dot_e2_fan) + THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[DOT_LADD;DOT_LMUL] + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] vdot_e2_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] e2_is_normal_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] e1_orthogonal_e2_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[REAL_ARITH`(a:real)* &0 = &0`; REAL_ARITH`(a:real)+ &0= a`; REAL_ARITH`&0 + (a:real)= a`; + REAL_ARITH`(a:real) * &1= a`] + THEN DISCH_TAC + THEN MATCH_MP_TAC(ISPECL [`sin (psi:real)`;`&0`; `r1:real`] REAL_EQ_LCANCEL_IMP) THEN ASM_REWRITE_TAC[] + THEN REPEAT(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC);; + +let cos_of_u_fan=prove(`!x:real^3 v:real^3 u:real^3 r1:real psi:real h1:real. + ~collinear {u,x,v} /\ ~(v=x) /\ ~(u=x)/\ ~collinear {vec 0, v-x, u-x} /\ &0 < r1 +/\ u - x = (r1 * cos psi) % (e1_fan x v u) + (r1 * sin psi) % (e2_fan x v u) + h1 % (v-x) +==> cos psi = &1`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3`; `(u:real^3)-(x:real^3)`; `r1:real`; `psi:real`; `h1:real`]module_of_vector) THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) +THEN POP_ASSUM MP_TAC + THEN MP_TAC(ISPECL[`(u:real^3)-(x:real^3)`; `e3_fan (x:real^3) (v:real^3)(u:real^3)`;`e1_fan (x:real^3) (v:real^3)(u:real^3)`]CROSS_TRIPLE) THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN MP_TAC(ISPECL[`(u:real^3)-(x:real^3)`; `e3_fan (x:real^3) (v:real^3)(u:real^3)`;`e2_fan (x:real^3) (v:real^3)(u:real^3)`]CROSS_TRIPLE) THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] orthonormal_e1_e2_e3_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN +MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3)(u:real^3)`; `e2_fan (x:real^3) (v:real^3)(u:real^3)`;`e3_fan (x:real^3) (v:real^3)(u:real^3)`]ORTHONORMAL_CROSS )THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN STRIP_TAC THEN +POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN +POP_ASSUM (fun th-> REWRITE_TAC[CROSS_SKEW;th]) + THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3`] dot_e2_fan)THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC THEN MP_TAC(ISPECL[ `e2_fan (x:real^3) (v:real^3)(u:real^3)`;`(u:real^3)-(x:real^3)`]DOT_SYM) THEN DISCH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`&0 pow 2 +(a:real)=a`] THEN +MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`] udot_e1_fan1) THEN ASM_REWRITE_TAC[DOT_LNEG;] THEN DISCH_TAC + THEN MP_TAC(ISPECL[ `e1_fan (x:real^3) (v:real^3)(u:real^3)`;`(u:real^3)-(x:real^3)`]DOT_SYM) THEN DISCH_TAC THEN +POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN REWRITE_TAC[POW_2_SQRT_ABS;REAL_ABS_NEG] THEN + MP_TAC(ISPECL[ `((u:real^3)-(x:real^3)) dot e1_fan (x:real^3) (v:real^3)(u:real^3)`] + REAL_ABS_REFL) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "a") THEN DISCH_TAC +THEN + MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3`; `r1:real`; `psi:real`; `h1:real`] sin_of_u_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH` + (r1 * cos psi) % e1_fan x v u + (r1 * &0) % e2_fan x v u + h1 % (v - x)= + (r1 * cos psi) % e1_fan x v u + h1 % (v - x)`] THEN DISCH_TAC THEN + SUBGOAL_THEN`((u:real^3) - (x:real^3)) dot e1_fan x (v:real^3) u = (((r1:real) * cos (psi:real)) % e1_fan x v u + (h1:real) % (v - x)) dot e1_fan x v u` ASSUME_TAC + +THENL[ASM_MESON_TAC[]; + +POP_ASSUM MP_TAC THEN REWRITE_TAC[DOT_LADD;DOT_LMUL] THEN POP_ASSUM MP_TAC THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]e3_mul_dist_fan) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`] +e1_orthogonal_e3_fan) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[DOT_LMUL;DOT_SYM] +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`] +e1_is_normal_fan) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`(a:real)* &1+ (b:real)*(c:real)* &0= a`] THEN REPEAT DISCH_TAC + THEN MP_TAC(ISPECL[`&1`;`cos (psi:real)`; `r1:real`]REAL_EQ_LCANCEL_IMP) THEN REWRITE_TAC[REAL_ARITH`(a:real)* &1=a`; REAL_ARITH`&1 = (a:real) <=> a= &1`] THEN DISCH_TAC THEN POP_ASSUM MATCH_MP_TAC THEN REPEAT(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC]);; + + + + +let sincos_of_u_fan=prove(`!x:real^3 v:real^3 u:real^3 r1:real psi:real h1:real. + ~collinear {u,x,v} /\ ~(v=x) /\ ~(u=x)/\ ~collinear {vec 0, v-x, u-x} /\ &0 < r1 +/\ u - x = (r1 * cos psi) % (e1_fan x v u) + (r1 * sin psi) % (e2_fan x v u) + h1 % (v-x) +==> sin psi = &0 /\ cos psi = &1`, +MESON_TAC[cos_of_u_fan;sin_of_u_fan]);; + + + + +let sincos1_of_u_fan=prove(`!x:real^3 v:real^3 u:real^3 r1:real psi:real h1:real. + ~collinear {x,v,u} /\ &0 < r1 +/\ u - x = (r1 * cos psi) % (e1_fan x v u) + (r1 * sin psi) % (e2_fan x v u) + h1 % (v-x) +==> sin psi = &0 /\ cos psi = &1`, + +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC`~collinear {x,v,u:real^3}` +THEN ONCE_REWRITE_TAC[SET_RULE`{X,V,U}={U,X,V}`] +THEN DISCH_TAC +THEN FIND_ASSUM MP_TAC`~collinear {x,v,u:real^3}` +THEN ONCE_REWRITE_TAC[SET_RULE`{X,V,U}={V,X,U}`] +THEN ONCE_REWRITE_TAC[COLLINEAR_3] +THEN DISCH_TAC +THEN MRESA_TAC th3[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`] +THEN MRESA_TAC sincos_of_u_fan[`(x:real^3)`;`(v:real^3)`;` (u:real^3)`;`r1:real`; `psi:real`; `h1:real`]) +;; + + + + + +(****************************************************************************) +(* the conditions to add azim *) +(****************************************************************************) + + + + + +let sum1_azim_fan=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. + cyclic_set {u, w1, w2} x v /\ (azim x v u w1 + azim x v w1 w2) < &2 * pi +==> +azim x v u w2 = azim x v u w1+ azim x v w1 w2 +`, +( let th=prove(`!x v u. {v,x,u}={x,v,u}/\{v,x,u}={u,x,v}`,SET_TAC[]) in + + +REPEAT GEN_TAC THEN STRIP_TAC +THEN MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`;`w1:real^3`; `w2:real^3`] property_of_cyclic_set) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`;`w1:real^3`; `w2:real^3`] property_of_cyclic_set1) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`;`w1:real^3`; `w2:real^3`] property_of_cyclic_set2) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`v:real^3`; `x:real^3`; `u:real^3`]COLLINEAR_3) THEN ASM_REWRITE_TAC[] THEN +DISCH_TAC THEN SUBGOAL_THEN `~collinear {(x:real^3),(v:real^3),(u:real^3)}/\ ~collinear {(u:real^3),(x:real^3),(v:real^3)}` ASSUME_TAC +THENL[ASM_MESON_TAC[th]; + +MP_TAC (SPECL [`x:real^3`; `v:real^3`; `w1:real^3`; `w2:real^3`] azim) + THEN STRIP_TAC +THEN POP_ASSUM(MP_TAC o SPECL [`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]) + THEN MP_TAC(ISPECL[`(x:real^3)`; `(v:real^3)`; `(u:real^3)`] orthonormal_e1_e2_e3_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`; `(v:real^3)`; `(u:real^3)`] e3_mul_dist_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN MP_TAC(SPEC `psi:real` SINCOS_PRINCIPAL_VALUE_FAN ) THEN STRIP_TAC THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`u:real^3`]AZIM_EXISTS) THEN STRIP_TAC +THEN +POP_ASSUM (fun th-> MP_TAC (ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]th)) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3` ;`r1':real`; `psi':real`; `h1':real`]sincos_of_u_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + +THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`; `w1:real^3`; `h1':real`; `h1:real`; `r1':real`; `r1:real`; +`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`; `psi':real`; `y:real` ] AZIM_UNIQUE) + THEN ASM_REWRITE_TAC[COS_ADD;SIN_ADD;REAL_ARITH` &1 * (a:real) - &0 * (b:real)=a`;REAL_ARITH`&0 * (a:real) + &1 * (b:real)=b`] +THEN DISCH_TAC THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`; `w2:real^3`; `h1':real`; `h2:real`; `r1':real`; `r2:real`; +`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`; `psi':real`; `azim (x:real^3) (v:real^3) (u:real^3) (w1:real^3) + azim x v w1 (w2:real^3)` ] AZIM_UNIQUE) +THEN DISCH_TAC THEN POP_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THENL[ ASM_MESON_TAC[REAL_LE_ADD]; + + +ASM_REWRITE_TAC[COS_ADD;SIN_ADD;REAL_ARITH` &1 * (a:real) - &0 * (b:real)=a`;REAL_ARITH`&0 * (a:real) + &1 * (b:real)=b`] + ]]));; + + + + + + + +let sum3_azim_fan=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. +((azim x v u w1 + azim x v w1 w2) < &2 * pi) +/\ +(~collinear {(x:real^3),(v:real^3),(w1:real^3)}) +/\(~collinear {(x:real^3),(v:real^3),(w2:real^3)}) +/\ (~collinear {(x:real^3),(v:real^3),(u:real^3)}) +==> +azim x v u w2 = azim x v u w1+ azim x v w1 w2 +`, (let th=prove(`!x v u. {x,v,u}={v,x,u}`,SET_TAC[]) in + (let th1=prove(`!x v u. {x,v,u}={u,x,v}`,SET_TAC[]) in + +REPEAT GEN_TAC THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "a") + +THEN USE_THEN "a" MP_TAC THEN GEN_REWRITE_TAC ( LAND_CONV o ONCE_DEPTH_CONV)[th] THEN DISCH_THEN(LABEL_TAC "b") + +THEN USE_THEN "a" MP_TAC THEN GEN_REWRITE_TAC ( LAND_CONV o ONCE_DEPTH_CONV)[th1] THEN DISCH_TAC + +THEN USE_THEN "b" MP_TAC THEN +GEN_REWRITE_TAC ( LAND_CONV o ONCE_DEPTH_CONV)[COLLINEAR_3] THEN STRIP_TAC +THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]th3) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC (SPECL [`x:real^3`; `v:real^3`; `w1:real^3`; `w2:real^3`] azim) + THEN STRIP_TAC +THEN POP_ASSUM(MP_TAC o SPECL [`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]) + THEN MP_TAC(ISPECL[`(x:real^3)`; `(v:real^3)`; `(u:real^3)`] orthonormal_e1_e2_e3_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`; `(v:real^3)`; `(u:real^3)`] e3_mul_dist_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN MP_TAC(SPEC `psi:real` SINCOS_PRINCIPAL_VALUE_FAN ) THEN STRIP_TAC THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`u:real^3`]AZIM_EXISTS) THEN STRIP_TAC +THEN +POP_ASSUM (fun th-> MP_TAC (ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]th)) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3` ;`r1':real`; `psi':real`; `h1':real`]sincos_of_u_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + +THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`; `w1:real^3`; `h1':real`; `h1:real`; `r1':real`; `r1:real`; +`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`; `psi':real`; `y:real` ] AZIM_UNIQUE) + THEN ASM_REWRITE_TAC[COS_ADD;SIN_ADD;REAL_ARITH` &1 * (a:real) - &0 * (b:real)=a`;REAL_ARITH`&0 * (a:real) + &1 * (b:real)=b`] +THEN DISCH_TAC THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `u:real^3`; `w2:real^3`; `h1':real`; `h2:real`; `r1':real`; `r2:real`; +`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`; `psi':real`; `azim (x:real^3) (v:real^3) (u:real^3) (w1:real^3) + azim x v w1 (w2:real^3)` ] AZIM_UNIQUE) +THEN DISCH_TAC THEN POP_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THENL[ + ASM_MESON_TAC[REAL_LE_ADD]; + +ASM_REWRITE_TAC[COS_ADD;SIN_ADD;REAL_ARITH` &1 * (a:real) - &0 * (b:real)=a`;REAL_ARITH`&0 * (a:real) + &1 * (b:real)=b`]])));; + + + +let sum2_azim_fan=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. + cyclic_set {u, w1, w2} x v /\ azim x v u w1 <= azim x v u w2 +==> +azim x v u w2 = azim x v u w1 + azim x v w1 w2 +`, + +(let th=prove(`!x v u. {v,x,u}={x,v,u}/\{v,x,u}={u,x,v}`,SET_TAC[]) in + +REWRITE_TAC[REAL_ARITH`(a:real)=(b:real)+(c:real) <=> c=a-b`] THEN +REPEAT GEN_TAC THEN STRIP_TAC +THEN MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`;`w1:real^3`; `w2:real^3`] property_of_cyclic_set) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`;`w1:real^3`; `w2:real^3`] property_of_cyclic_set1) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`;`w1:real^3`; `w2:real^3`] property_of_cyclic_set2) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`v:real^3`; `x:real^3`; `u:real^3`]COLLINEAR_3) THEN ASM_REWRITE_TAC[] THEN +DISCH_TAC THEN SUBGOAL_THEN `~collinear {(x:real^3),(v:real^3),(u:real^3)}/\ ~collinear {(u:real^3),(x:real^3),(v:real^3)}` ASSUME_TAC +THENL[ASM_MESON_TAC[th]; +MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`; `w1:real^3`] azim) + THEN STRIP_TAC +THEN POP_ASSUM(MP_TAC o SPECL [`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]) +THEN MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`; `w2:real^3`] azim) THEN STRIP_TAC +THEN POP_ASSUM(MP_TAC o SPECL [`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]) +THEN MP_TAC(ISPECL[`(x:real^3)`; `(v:real^3)`; `(u:real^3)`] orthonormal_e1_e2_e3_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`; `(v:real^3)`; `(u:real^3)`] e3_mul_dist_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN DISCH_THEN (LABEL_TAC"a") THEN DISCH_THEN (LABEL_TAC"b") +THEN REPEAT STRIP_TAC + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN DISCH_THEN (LABEL_TAC"c") THEN REPEAT STRIP_TAC + THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3` ;`r1:real`; `psi:real`; `h1':real`]sincos_of_u_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3` ;`r1':real`; `psi':real`; `h1:real`]sincos_of_u_fan) + THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN DISCH_TAC + THEN REMOVE_THEN "b" MP_TAC THEN REMOVE_THEN "c" MP_TAC + THEN ASM_REWRITE_TAC[COS_ADD;SIN_ADD;REAL_ARITH` &1 * (a:real) - &0 * (b:real)=a`;REAL_ARITH`&0 * (a:real) + &1 * (b:real)=b`] + THEN REPEAT STRIP_TAC + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `w1:real^3`; `w2:real^3`; `h2:real`; `h2':real`; `r2':real`; `r2:real`; +`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`; `azim (x:real^3) (v:real^3) (u:real^3) (w1:real^3)`; `azim (x:real^3) (v:real^3) (u:real^3) (w2:real^3) - azim x v u (w1:real^3)` ] AZIM_UNIQUE) +THEN DISCH_TAC THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`(a:real)+(b:real)-a=b`; REAL_ARITH`(&0 <= (a:real)-(b:real))<=> b<= a`] THEN MP_TAC(ISPEC `azim (x:real^3) (v:real^3) (u:real^3) (w1:real^3)` REAL_NEG_LE0) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`azim (x:real^3) (v:real^3) (u:real^3) (w2:real^3)`;`&2 * pi`;`--azim (x:real^3) (v:real^3) (u:real^3) (w1:real^3)`;`&0`]REAL_LTE_ADD2 ) +THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC]));; + + + + +let sum4_azim_fan=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. + azim x v u w1 <= azim x v u w2 +/\ (~collinear {(x:real^3),(v:real^3),(w1:real^3)}) +/\(~collinear {(x:real^3),(v:real^3),(w2:real^3)}) +/\ (~collinear {(x:real^3),(v:real^3),(u:real^3)}) + +==> +azim x v u w2 = azim x v u w1 + azim x v w1 w2 +`,(let th=prove(`!x v u. {x,v,u}={v,x,u}`,SET_TAC[]) in +(let th1=prove(`!x v u. {x,v,u}={u,x,v}`,SET_TAC[]) in + +REWRITE_TAC[REAL_ARITH`(a:real)=(b:real)+(c:real) <=> c=a-b`] THEN + +REPEAT GEN_TAC THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "a1") + +THEN USE_THEN "a1" MP_TAC THEN GEN_REWRITE_TAC ( LAND_CONV o ONCE_DEPTH_CONV)[th] THEN DISCH_THEN(LABEL_TAC "b1") + +THEN USE_THEN "a1" MP_TAC THEN GEN_REWRITE_TAC ( LAND_CONV o ONCE_DEPTH_CONV)[th1] THEN DISCH_TAC + +THEN USE_THEN "b1" MP_TAC THEN +GEN_REWRITE_TAC ( LAND_CONV o ONCE_DEPTH_CONV)[COLLINEAR_3] THEN STRIP_TAC +THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]th3) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`; `w1:real^3`] azim) + THEN STRIP_TAC +THEN POP_ASSUM(MP_TAC o SPECL [`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]) +THEN MP_TAC (SPECL [`x:real^3`; `v:real^3`; `u:real^3`; `w2:real^3`] azim) THEN STRIP_TAC +THEN POP_ASSUM(MP_TAC o SPECL [`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]) +THEN MP_TAC(ISPECL[`(x:real^3)`; `(v:real^3)`; `(u:real^3)`] orthonormal_e1_e2_e3_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`; `(v:real^3)`; `(u:real^3)`] e3_mul_dist_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN DISCH_THEN (LABEL_TAC"a") THEN DISCH_THEN (LABEL_TAC"b") +THEN REPEAT STRIP_TAC + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN DISCH_THEN (LABEL_TAC"c") THEN REPEAT STRIP_TAC + THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3` ;`r1:real`; `psi:real`; `h1':real`]sincos_of_u_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3` ;`r1':real`; `psi':real`; `h1:real`]sincos_of_u_fan) + THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN DISCH_TAC + THEN REMOVE_THEN "b" MP_TAC THEN REMOVE_THEN "c" MP_TAC + THEN ASM_REWRITE_TAC[COS_ADD;SIN_ADD;REAL_ARITH` &1 * (a:real) - &0 * (b:real)=a`;REAL_ARITH`&0 * (a:real) + &1 * (b:real)=b`] + THEN REPEAT STRIP_TAC + THEN MP_TAC (ISPECL [`x:real^3`; `v:real^3`; `w1:real^3`; `w2:real^3`; `h2:real`; `h2':real`; `r2':real`; `r2:real`; +`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`; `azim (x:real^3) (v:real^3) (u:real^3) (w1:real^3)`; `azim (x:real^3) (v:real^3) (u:real^3) (w2:real^3) - azim x v u (w1:real^3)` ] AZIM_UNIQUE) +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`(a:real)+(b:real)-a=b`; REAL_ARITH`(&0 <= (a:real)-(b:real))<=> b<= a`] THEN MP_TAC(ISPEC `azim (x:real^3) (v:real^3) (u:real^3) (w1:real^3)` REAL_NEG_LE0) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`azim (x:real^3) (v:real^3) (u:real^3) (w2:real^3)`;`&2 * pi`;`--azim (x:real^3) (v:real^3) (u:real^3) (w1:real^3)`;`&0`]REAL_LTE_ADD2 ) +THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC +)));; + + + + +let sum5_azim_fan=prove(`!x:real^3 v:real^3 u:real^3 w1:real^3 w2:real^3. + azim x v w1 w2 <= azim x v u w2 +/\ (~collinear {(x:real^3),(v:real^3),(w1:real^3)}) +/\(~collinear {(x:real^3),(v:real^3),(w2:real^3)}) +/\ (~collinear {(x:real^3),(v:real^3),(u:real^3)}) + +==> +azim x v u w2 = azim x v u w1 + azim x v w1 w2 +`, +REPEAT STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_THEN(LABEL_TAC"1") THEN REPEAT STRIP_TAC + THEN DISJ_CASES_TAC(REAL_ARITH`(azim x v u w2)= &0 \/ ~(azim x v u w2 = &0)`) +THENL(*1*)[ +SUBGOAL_THEN`azim x v w1 w2 = &0` ASSUME_TAC +THENL(*2*)[ +REPEAT(POP_ASSUM MP_TAC) THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w1:real^3`;`w2:real^3`]azim) THEN REAL_ARITH_TAC; +(*2*) +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w1:real^3`;`w2:real^3`]AZIM_EQ_0_SYM) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`w2:real^3`]AZIM_EQ_0_SYM) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +SUBGOAL_THEN`azim x v w2 w1 = azim x v w2 u` ASSUME_TAC +THENL(*3*)[ASM_MESON_TAC[];(*3*) +REWRITE_TAC[REAL_ARITH`&0 = a + &0 <=> a= &0`] THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w2:real^3`;`u:real^3`;`w1:real^3`]AZIM_EQ_ALT) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`]AZIM_EQ_0) THEN ASM_REWRITE_TAC[]]]; + DISJ_CASES_TAC(REAL_ARITH`(azim x v w1 w2)= &0 \/ ~(azim x v w1 w2 = &0)`) +THENL(*4*)[ +ASM_REWRITE_TAC[REAL_ARITH`b = a + &0 <=> b= a`] THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w1:real^3`;`w2:real^3`]AZIM_EQ_0_ALT) THEN ASM_REWRITE_TAC[]THEN ASM_MESON_TAC[AZIM_EQ_ALT] ;(*4*) +REMOVE_THEN"1" MP_TAC THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w1:real^3`;`w2:real^3`]AZIM_COMPL +) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`w2:real^3`]AZIM_COMPL +) THEN ASM_REWRITE_TAC[REAL_ARITH`a=b-c <=> c= b-a`] THEN DISCH_TAC THEN DISCH_TAC + THEN ASM_REWRITE_TAC[REAL_ARITH`a-b=c+a-d<=> d=b+c`;REAL_ARITH`a-b<=a-d<=> d<=b`] THEN ASM_MESON_TAC[sum4_azim_fan]] +]);; + + + + + + +(****************************************************************************) +(* sigma_fan is permutes *) +(****************************************************************************) + + +let SUR_SIGMA_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ ({v,u} IN E) +==> ?w. {v,w} IN E /\sigma_fan x V E v w= u +`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE `(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={(u:real^3)})\/ ~(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={(u:real^3)})`) +THENL(*1*)[ +EXISTS_TAC`u:real^3` THEN ASM_REWRITE_TAC[sigma_fan];(*1*) + +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]properties_of_set_of_edge_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]exists_inverse_sigma_fan_alt) THEN ASM_REWRITE_TAC[azim1;] THEN STRIP_TAC THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`]properties_of_set_of_edge_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN EXISTS_TAC `w:real^3` THEN ASM_REWRITE_TAC[] + THEN MATCH_MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;` (u:real^3)`] UNIQUE_SIGMA_FAN) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "be") THEN DISCH_TAC +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={w} \/ ~(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={w})`) +THENL(*2*)[ +FIND_ASSUM(MP_TAC)`u:real^3 IN set_of_edge v V E` THEN POP_ASSUM(fun th->REWRITE_TAC[th;IN_SING]) THEN ASM_TAC THEN SET_TAC[] ;(*2*) + +ASM_REWRITE_TAC[] THEN GEN_TAC THEN STRIP_TAC THEN +DISJ_CASES_TAC(SET_RULE`~(azim (x:real^3) v w u <= azim x v w w1)\/ (azim (x:real^3) v w u <= azim x v w w1)`) +THENL(*3*)[ +ASM_REWRITE_TAC[] THEN SUBGOAL_THEN`azim (x:real^3) v w w1 <= azim x v w u` ASSUME_TAC +THENL(*4*)[ +POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*4*) + SUBGOAL_THEN `{(w:real^3),(w1:real^3),(u:real^3)} SUBSET set_of_edge v V E` ASSUME_TAC +THENL(*5*)[ +ASM_TAC THEN SET_TAC[];(*5*) +FIND_ASSUM(MP_TAC)`FAN((x:real^3),V,E)` THEN REWRITE_TAC[FAN;fan6] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "b") THEN STRIP_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (u:real^3)`;` (v:real^3)`]properties_of_graph) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`]CYCLIC_SET_EDGE_FAN) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;`{(w:real^3), (w1:real^3),(u:real^3)}`;`set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)` ]subset_cyclic_set_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`;`w1:real^3`;`u:real^3`]sum2_azim_fan) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`;`w1:real^3`]azim) THEN STRIP_TAC THEN STRIP_TAC + THEN SUBGOAL_THEN`azim (x:real^3) v w1 u <= azim x v w u` ASSUME_TAC +THENL(*6*)[ REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC;(*6*) +POP_ASSUM MP_TAC THEN POP_ASSUM(fun th->REWRITE_TAC[]) THEN ASM_REWRITE_TAC[] THEN +MP_TAC (ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(w1:real^3)`]properties_of_set_of_edge) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN REMOVE_THEN "b" (fun th->MP_TAC (ISPEC`{(v:real^3),(w:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(u:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),w1}`th) THEN ASSUME_TAC(th)) + THEN REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC +THEN + DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (u:real^3) (w1:real^3)= &0) \/ ~(azim (x:real^3) (v:real^3) (u:real^3) (w1:real^3) = &0)`) +THENL(*7*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;`w1:real^3`]UNIQUE_AZIM_0_POINT_FAN) +THEN ASM_TAC THEN SET_TAC[];(*7*) + + DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (u:real^3) (w:real^3)= &0) \/ ~(azim (x:real^3) (v:real^3) (u:real^3) (w:real^3) = &0)`) +THENL(*8*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;`w:real^3`]UNIQUE_AZIM_0_POINT_FAN) +THEN ASM_TAC THEN SET_TAC[];(*8*) + MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`;` (w1:real^3)`]AZIM_COMPL) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`;` (w:real^3)`]AZIM_COMPL) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[] + THEN FIND_ASSUM(MP_TAC o (SPEC`w1:real^3`))`!w1:real^3. w1 IN set_of_edge v V E /\ ~(w1 = u) + ==> &2 * pi - azim x v u w <= &2 * pi - azim x v u w1` + THEN REMOVE_THEN "be" MP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] THEN DISJ_CASES_TAC(SET_RULE`~(w1:real^3=u)\/ (w1=u)`) +THENL(*9*)[ +ASM_REWRITE_TAC[REAL_ARITH`&2 * pi -(a:real)<= &2 *pi - b <=> b <= a`] THEN DISJ_CASES_TAC(SET_RULE `(azim(x:real^3) v u w =azim x v u w1)\/ ~(azim(x:real^3) v u w =azim x v u w1)`) +THENL(*10*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;` (w:real^3)`;`(w1:real^3)`]UNIQUE_AZIM_POINT_FAN) THEN ASM_REWRITE_TAC[];(*10*) +POP_ASSUM MP_TAC THEN REAL_ARITH_TAC](*10*);(*9*) +SUBGOAL_THEN `azim (x:real^3) v w u= azim x v w w1` ASSUME_TAC +THENL(*10*)[POP_ASSUM(fun th->REWRITE_TAC[th]);(*10*) +REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC](*10*)(*9*)](*8*)](*7*)](*6*)](*5*)](*4*)](*3*); +ASM_TAC THEN SET_TAC[]]]]);; + + + + + + +let MONO_SIGMA_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3). +FAN(x,V,E) /\ ({v,u} IN E) +/\ ({v,w} IN E)/\ + (sigma_fan x V E v u= sigma_fan x V E v w) +==> u=w +`, +REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT(POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"1") +THEN USE_THEN "1" MP_TAC THEN REWRITE_TAC[FAN;fan6] +THEN REPEAT STRIP_TAC THEN REPEAT(POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"1") THEN +DISCH_THEN (LABEL_TAC"a") THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_THEN(LABEL_TAC "b") THEN +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (u:real^3)`;` (v:real^3)`]properties_of_graph) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={(u:real^3)})\/ ~((set_of_edge v V E={u}))`) +THENL(*1*)[ +POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[set_of_edge; EXTENSION;IN_ELIM_THM] +THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`w:real^3`th)) THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "a" MP_TAC THEN REWRITE_TAC[UNIONS;SUBSET; IN_ELIM_THM] +THEN DISCH_TAC THEN POP_ASSUM (fun th->MP_TAC(ISPEC`w:real^3`th)) +THEN ASM_REWRITE_TAC[IN_SING;LEFT_IMP_EXISTS_THM] +THEN STRIP_TAC THEN POP_ASSUM (fun th->MP_TAC(ISPEC`{(v:real^3),(w:real^3)}`th)) + THEN ASM_TAC THEN SET_TAC[];(*1*) + +DISJ_CASES_TAC(SET_RULE`(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={(w:real^3)})\/ ~((set_of_edge v V E={w}))`) +THENL(*2*)[ + +POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[set_of_edge; EXTENSION;IN_ELIM_THM] +THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`u:real^3`th)) THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "a" MP_TAC THEN REWRITE_TAC[UNIONS;SUBSET; IN_ELIM_THM] +THEN DISCH_TAC THEN POP_ASSUM (fun th->MP_TAC(ISPEC`u:real^3`th)) +THEN ASM_REWRITE_TAC[IN_SING;LEFT_IMP_EXISTS_THM] +THEN STRIP_TAC THEN POP_ASSUM (fun th->MP_TAC(ISPEC`{(v:real^3),(u:real^3)}`th)) + THEN ASM_TAC THEN SET_TAC[];(*2*) + + +MP_TAC(ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (u:real^3)`]properties_of_set_of_edge) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN +MP_TAC(ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (w:real^3)`]properties_of_set_of_edge) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]SIGMA_FAN) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(w:real^3)`th)) +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`]SIGMA_FAN) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(u:real^3)`th)) + THEN ASM_REWRITE_TAC[] +THEN MP_TAC (ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`]properties_of_set_of_edge) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN REMOVE_THEN "b" (fun th->MP_TAC (ISPEC`{(v:real^3),(w:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(u:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))}`th) THEN ASSUME_TAC(th)) + THEN REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN +DISJ_CASES_TAC(SET_RULE`~((u:real^3)=(w:real^3))\/ u=w`) + +THENL(*3*)[ +ASM_REWRITE_TAC[] THEN SUBGOAL_THEN `{(w:real^3),(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)),(u:real^3)}SUBSET set_of_edge v V E` ASSUME_TAC +THENL(*4*)[ ASM_TAC THEN SET_TAC[];(*4*) + +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`]CYCLIC_SET_EDGE_FAN) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;`{(w:real^3), (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)),(u:real^3)}`;`set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)` ]subset_cyclic_set_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (w:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`;` (u:real^3)`]sum2_azim_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (LABEL_TAC "c") THEN + DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (w:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))= &0) \/ ~(azim (x:real^3) (v:real^3) (w:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) = &0)`) + +THENL(*5*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`]UNIQUE_AZIM_0_POINT_FAN) +THEN ASM_TAC THEN SET_TAC[];(*5*) + +DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (w:real^3) (u:real^3)= &0) \/ ~(azim (x:real^3) (v:real^3) (w:real^3) (u:real^3) = &0)`) + +THENL(*6*)[ + +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;`(u:real^3)`]UNIQUE_AZIM_0_POINT_FAN) +THEN ASM_TAC THEN SET_TAC[];(*6*) + + DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) (u:real^3)= &0) \/ ~(azim (x:real^3) (v:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) (u:real^3) = &0)`) + +THENL(*7*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`;` (u:real^3)`]UNIQUE_AZIM_0_POINT_FAN) +THEN ASM_TAC THEN SET_TAC[];(*7*) + +MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`;` (u:real^3)`]AZIM_COMPL) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (w:real^3)`;` (u:real^3)`]AZIM_COMPL) THEN +ASM_REWRITE_TAC[REAL_ARITH`&2 * pi - ((a:real)+(b:real))= --(a:real)+ (&2 * pi - b)`] THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_ARITH`b <= (a:real)+(b:real)<=> &0 <= a`] + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;`(w:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`] azim)THEN REPEAT(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC +(*7*)](*6*)](*5*)](*4*)];(*3*) + +ASM_REWRITE_TAC[](*3*)]]]);; + + + + +let permutes_sigma_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ ({v,u} IN E) +==> +(extension_sigma_fan x V E v) permutes (set_of_edge v V E)`, +REPEAT GEN_TAC THEN STRIP_TAC THEN FIND_ASSUM(MP_TAC)`FAN((x:real^3), V, E)` THEN REWRITE_TAC[FAN;fan1] THEN STRIP_TAC +THEN MP_TAC(ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`]remark_finite_fan1) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)`;`extension_sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3)`]PERMUTES_FINITE_INJECTIVE) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THENL[ +GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[extension_sigma_fan]; +STRIP_TAC +THENL[ +GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[extension_sigma_fan] THEN DISJ_CASES_TAC(SET_RULE`set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={(x':real^3)}\/ ~(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={(x':real^3)})`) +THENL[ASM_REWRITE_TAC[sigma_fan;IN_SING]; +ASM_MESON_TAC[SIGMA_FAN]]; +REPEAT GEN_TAC THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[extension_sigma_fan] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (x':real^3)`]properties_of_set_of_edge) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN +MP_TAC(ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (y:real^3)`]properties_of_set_of_edge) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN +ASM_MESON_TAC[MONO_SIGMA_FAN]]]);; + + + + + + +(****************************************************************************) +(* inverse of sigma_fan *) +(****************************************************************************) + + + + + + + + + + + + + + +let exists_function_inverse_sigma_fan_alt=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3). +FAN(x,V,E) ==> +(?g. (!w:real^3. {v,w} IN E==> {v, g w} IN E) +/\ (!w:real^3. {v,w} IN E==> (sigma_fan x V E v)( g w) =w) +/\ (!w:real^3. {v,w} IN E==> g (sigma_fan x V E v w) =w)) +`, +REPEAT STRIP_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`] sigma_fan_in_set_of_edge) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3)`;`set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)`; `set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)`]BIJECTIVE_ON_LEFT_RIGHT_INVERSE) + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`] properties_of_set_of_edge_fan) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] + +THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`] MONO_SIGMA_FAN) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`] SUR_SIGMA_FAN) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[]);; + +(* +This is the same as inverse_sigma_fan_alt, +but easier to use. +*) + + + +let inverse1_sigma_fan=new_definition`inverse1_sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3)= @g. (!w:real^3. {v,w} IN E==> {v, g w} IN E) +/\ (!w:real^3. {v,w} IN E==> (sigma_fan x V E v)( g w) =w) +/\ (!w:real^3. {v,w} IN E==> g (sigma_fan x V E v w) =w)`;; + + + +let INVERSE1_SIGMA_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3). +FAN(x,V,E) ==> +( (!w:real^3. {v,w} IN E==> {v, inverse1_sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) w} IN E) +/\ (!w:real^3. {v,w} IN E==> (sigma_fan x V E v)( inverse1_sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) w) =w) +/\ (!w:real^3. {v,w} IN E==> inverse1_sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (sigma_fan x V E v w) =w))`, +REPEAT GEN_TAC THEN STRIP_TAC THEN ONCE_REWRITE_TAC[inverse1_sigma_fan] THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3) `]exists_function_inverse_sigma_fan_alt) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN SELECT_ELIM_TAC THEN EXISTS_TAC`g:real^3->real^3` THEN ASM_REWRITE_TAC[]);; + +(* This is the same as f_fan, + but easier to use *) + +let f1_fan=new_definition`f1_fan (x:real^3) V E = (\((x:real^3),(v:real^3),(w:real^3),(w1:real^3)). (x,w,(inverse1_sigma_fan x V E w v),v) )`;; + + +(* Proof Lemma 6.1 [AAUHTVE] *) + +let node_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) n:num. power_maps n_fan x V E n=power_n_fan x V E n`, +GEN_TAC THEN GEN_TAC THEN GEN_TAC THEN REWRITE_TAC[power_maps; n_fan; power_n_fan; power_map_points] THEN INDUCT_TAC THEN REWRITE_TAC[power_maps; power_map_points;i_fan;] THEN REWRITE_TAC[power_map_points; power_maps] THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[n_fan;o_funs; pr1; pr2; pr3; pr4]);; + + + + + +let EQ_PAIR_4=prove(`!a:real^3 b:real^3 c:real^3 d:real^3 a1:real^3 b1:real^3 c1:real^3 d:real^3. +(a,b,c,d)=(a1,b1,c1,d1) <=> a=a1 /\ b=b1 /\ c=c1 /\ d=d1`, +REPEAT GEN_TAC THEN EQ_TAC +THENL[ +DISCH_TAC THEN MP_TAC(SET_RULE`(a,b,c,d)=(a1,b1,c1,d1)==>pr1(a,b,c,d)=pr1(a1,b1,c1,d1)`) THEN REWRITE_TAC[pr1] + THEN MP_TAC(SET_RULE`(a,b,c,d)=(a1,b1,c1,d1)==>pr2(a,b,c,d)=pr2(a1,b1,c1,d1)`) THEN REWRITE_TAC[pr2] THEN +MP_TAC(SET_RULE`(a,b,c,d)=(a1,b1,c1,d1)==>pr3(a,b,c,d)=pr3(a1,b1,c1,d1)`) THEN REWRITE_TAC[pr3] THEN +MP_TAC(SET_RULE`(a,b,c,d)=(a1,b1,c1,d1)==>pr4(a,b,c,d)=pr4(a1,b1,c1,d1)`) THEN REWRITE_TAC[pr4] THEN ASM_REWRITE_TAC[] + THEN SET_TAC[]; +SET_TAC[]]);; + + + +let MONO_N_FAN=prove(` !x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +==> (!a b. a IN d1_fan(x,V,E) /\ b IN d1_fan (x,V,E)/\ n_fan x V E a =n_fan x V E b ==> a=b)`, + +REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[n_fan;EQ_PAIR_4] + THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN POP_ASSUM (fun th -> REWRITE_TAC[]) + THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`x:real^3`; `(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`;`w:real^3`;`v:real^3` ]remark1_fan) + THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`x:real^3`; `(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`;`w':real^3`;`v:real^3` ]remark1_fan) + THEN ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[MONO_SIGMA_FAN;]);; + + +let SUR_N_FAN=prove(` !x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +==> (!a. a IN d1_fan(x,V,E) ==>(?b. b IN d1_fan(x,V,E) /\ n_fan x V E b = a))`, + +REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN REPEAT STRIP_TAC + THEN MP_TAC(ISPECL[`x:real^3`;` (V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`] SUR_SIGMA_FAN) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN EXISTS_TAC`(x:real^3,v:real^3,w':real^3,w:real^3)` + THEN ASM_REWRITE_TAC[n_fan] THEN EXISTS_TAC`x:real^3` THEN EXISTS_TAC`v:real^3` + THEN EXISTS_TAC`w':real^3` THEN EXISTS_TAC`w:real^3` THEN ASM_REWRITE_TAC[]);; + + + +let simp_inverse_sigma_fan_alt=prove(`!x V E v w. +inverse_sigma_fan_alt x V E v w= inverse (sigma_fan x V E v) w`, +REWRITE_TAC[inverse] THEN MESON_TAC[inverse_sigma_fan_alt]);; + + + +let SUR_F1_FAN=prove(` !x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +==> (!a. a IN d1_fan(x,V,E) ==>(?b. b IN d1_fan(x,V,E) /\ f1_fan x V E b = a))`, +REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN REPEAT STRIP_TAC + THEN EXISTS_TAC`(x:real^3,sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) v w, v:real^3,sigma_fan x V E (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) v w) v)` + THEN ASM_REWRITE_TAC[f_fan;EQ_PAIR_4;] + THEN STRIP_TAC +THENL[ +EXISTS_TAC`x:real^3` THEN EXISTS_TAC`sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) v w` + THEN EXISTS_TAC`v:real^3` THEN EXISTS_TAC`sigma_fan x V E (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) v w) v` +THEN ASM_REWRITE_TAC[] THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) ={w:real^3}) \/ ~(set_of_edge v V E ={w})`) +THENL[ +REWRITE_TAC[sigma_fan;SET_RULE`{a,b}={b,a}`] THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[]) THEN POP_ASSUM (fun th-> REWRITE_TAC[]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); + +MP_TAC(ISPECL[`x:real^3`;` (V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`]remark1_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`x:real^3`;` (V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`]SIGMA_FAN) + THEN ASM_REWRITE_TAC[remark1_fan] THEN STRIP_TAC + THEN MP_TAC(ISPECL[`x:real^3`;` (V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`sigma_fan x V E v w:real^3`;`v:real^3`]remark1_fan) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN POP_ASSUM (fun th-> REWRITE_TAC[]) THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={b,a}`]]; + +REWRITE_TAC[f1_fan] THEN MP_TAC(ISPECL[`x:real^3`;` (V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`]INVERSE1_SIGMA_FAN) + THEN ASM_REWRITE_TAC[EQ_PAIR_4] THEN STRIP_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`w:real^3`th)) + THEN ASM_REWRITE_TAC[]]);; + + + + + +let MONO_F1_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +==> (!a b. a IN d1_fan(x,V,E) /\ b IN d1_fan (x,V,E)/\ f1_fan x V E a =f1_fan x V E b ==> a=b)`, +REWRITE_TAC[d1_fan;IN_ELIM_THM]THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[f1_fan;EQ_PAIR_4] + THEN STRIP_TAC THEN ASM_REWRITE_TAC[]);; + + +let MONO_E_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +==> (!a b. a IN d1_fan(x,V,E) /\ b IN d1_fan (x,V,E)/\ e_fan x V E a =e_fan x V E b ==> a=b)`, +REWRITE_TAC[d1_fan;IN_ELIM_THM]THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[e_fan;EQ_PAIR_4] + THEN STRIP_TAC THEN ASM_REWRITE_TAC[]);; + + +let SUR_E_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +==> (!a. a IN d1_fan(x,V,E) ==>(?b. b IN d1_fan(x,V,E) /\ e_fan x V E b = a))`, + +REWRITE_TAC[d1_fan; IN_ELIM_THM] THEN REPEAT STRIP_TAC + THEN EXISTS_TAC`(x:real^3,w:real^3,v:real^3, sigma_fan x (V:real^3->bool) (E:(real^3->bool)->bool) w v)` +THEN ASM_REWRITE_TAC[e_fan] THEN EXISTS_TAC`x:real^3` THEN EXISTS_TAC`w:real^3` + THEN EXISTS_TAC`v:real^3` THEN EXISTS_TAC`sigma_fan x (V:real^3->bool) (E:(real^3->bool)->bool) w v` +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={b,a}`]);; + + + + + + +let permuters_of_enf_fan=prove(` !x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +==> (!a b. a IN d1_fan(x,V,E) /\ b IN d1_fan (x,V,E)/\ n_fan x V E a =n_fan x V E b ==> a=b) +/\ (!a. a IN d1_fan(x,V,E) ==>(?b. b IN d1_fan(x,V,E) /\ n_fan x V E b = a)) +/\ (!a b. a IN d1_fan(x,V,E) /\ b IN d1_fan (x,V,E)/\ f1_fan x V E a =f1_fan x V E b ==> a=b) +/\ (!a. a IN d1_fan(x,V,E) ==>(?b. b IN d1_fan(x,V,E) /\ f1_fan x V E b = a)) +/\ (!a b. a IN d1_fan(x,V,E) /\ b IN d1_fan (x,V,E)/\ e_fan x V E a =e_fan x V E b ==> a=b) +/\ (!a. a IN d1_fan(x,V,E) ==>(?b. b IN d1_fan(x,V,E) /\ e_fan x V E b = a)) +`,MESON_TAC[MONO_N_FAN;SUR_N_FAN;MONO_F1_FAN;SUR_F1_FAN;MONO_E_FAN;SUR_E_FAN]);; + + + + + + + + + +let condition_hypermap_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E)==> (!a. a IN d1_fan(x,V,E)==> e_fan x V E((n_fan x V E) (f1_fan x V E a))=a)`, +REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[f1_fan;n_fan; e_fan; EQ_PAIR_4] + THEN MP_TAC(ISPECL[`x:real^3`;` (V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`w:real^3`]INVERSE1_SIGMA_FAN) + THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC THEN POP_ASSUM (fun th->REWRITE_TAC[]) + THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`v:real^3`th)) + THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={b,a}`] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[]);; + + + +let plain_hypermap_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E)==> (!a. a IN d1_fan(x,V,E)==> +(e_fan x V E) (e_fan x V E a) =a)`, +REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[e_fan; EQ_PAIR_4]);; + + +let e_fan_no_fix_point=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E)==> (!a. a IN d1_fan(x,V,E) ==> ~(e_fan x V E a=a ))`, +REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[e_fan; EQ_PAIR_4] + THEN STRIP_TAC THEN MP_TAC(ISPECL[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`]remark1_fan) + THEN ASM_MESON_TAC[]);; + +let f_fan_no_fix_point=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E)==> (!a. a IN d1_fan(x,V,E) ==> ~(f1_fan x V E a=a ))`, +REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[f1_fan; EQ_PAIR_4] +THEN STRIP_TAC THEN MP_TAC(ISPECL[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`]remark1_fan) + THEN ASM_MESON_TAC[]);; + + + +(* from hypermap.hl *) + +(******************************) +parse_as_infix("POWER",(24,"right"));; + +let POWER = new_recursive_definition num_RECURSION + `(!(f:A->A). f POWER 0 = I) /\ + (!(f:A->A) (n:num). f POWER (SUC n) = (f POWER n) o f)`;; + +let POWER_0 = prove(`!f:A->A. f POWER 0 = I`, + REWRITE_TAC[POWER]);; + +let POWER_1 = prove(`!f:A->A. f POWER 1 = f`, + REWRITE_TAC[POWER; ONE; I_O_ID]);; + +let POWER_2 = prove(`!f:A->A. f POWER 2 = f o f`, + REWRITE_TAC[POWER; TWO; POWER_1]);; + +let orbit_map = new_definition `orbit_map (f:A->A) (x:A) = {(f POWER n) x | n >= 0}`;; +(**************************************************) + +let POWER_RIGHT=prove(`!k:num f:A->A. f POWER SUC(k) = f o (f POWER k)`, +INDUCT_TAC +THENL[REWRITE_TAC[POWER;o_DEF; I_DEF]; +REWRITE_TAC[POWER;o_ASSOC] THEN GEN_TAC THEN POP_ASSUM(fun th -> MP_TAC(SPEC`f:A->A`th)) THEN DISCH_TAC + THEN +POP_ASSUM(fun th-> REWRITE_TAC[SYM(th);POWER])]) ;; + + + +let power_n_fan=prove(`!l:num x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 w:real^3. +FAN(x,V,E)/\ ({v,w} IN E)==> +(n_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) POWER l) (x,v,w,sigma_fan x V E v w)= (x,v, power_map_points sigma_fan x V E v w l, power_map_points sigma_fan x V E v w (SUC l) )`, +INDUCT_TAC +THENL[REWRITE_TAC[POWER; power_map_points;I_DEF]; +POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") THEN REPEAT STRIP_TAC THEN + REMOVE_THEN "a" (fun th -> MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;`(w:real^3)`]th)) +THEN ASM_REWRITE_TAC[POWER_RIGHT; o_DEF;] +THEN DISCH_TAC THEN ASM_REWRITE_TAC[n_fan;power_map_points] ]);; + + + +let distinct_nodes=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) . +FAN(x,V,E)==> (!k:num l:num a. a IN d1_fan(x,V,E) ==> +(((n_fan x V E) POWER k) o (e_fan x V E)) a= ((e_fan x V E)o((n_fan x V E) POWER l)) a==> (n_fan x V E POWER l) a=a)`, +REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN +ASM_REWRITE_TAC[o_DEF;e_fan] THEN +MP_TAC(ISPECL[`l:num`;` x:real^3 `;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` w:real^3`]power_n_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`k:num`;` x:real^3 `;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` w:real^3`;` v:real^3`]power_n_fan) + THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={b,a}`] THEN DISCH_TAC THEN ASM_REWRITE_TAC[EQ_PAIR_4] THEN STRIP_TAC + THEN POP_ASSUM(fun th-> REWRITE_TAC[]) THEN POP_ASSUM(fun th-> REWRITE_TAC[]) + THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]THEN ASSUME_TAC(th)) + THEN ASM_REWRITE_TAC[power_map_points] THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]));; + + + + +let edge_lie_different_nodes=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E)==> (!n:num a. a IN d1_fan(x,V,E) ==> ~(e_fan x V E a =(n_fan x V E POWER n) a)) `, + +REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN +ASM_REWRITE_TAC[e_fan] THEN +MP_TAC(ISPECL[`n:num`;` x:real^3 `;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` w:real^3`]power_n_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[EQ_PAIR_4] + THEN STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`]remark1_fan) + THEN ASM_MESON_TAC[]);; + + + + +(**********************) + + +let d20_fan=new_definition`d20_fan (x,V,E)={ (x',v,v,v)| (x'=x) /\ (V v) /\ ((set_of_edge v V E) ={})}`;; + +let d_fan=new_definition`d_fan (x,V,E)= d1_fan (x,V,E) UNION d20_fan (x,V,E)`;; + +let hypermap_of_fanx = new_definition + `hypermap_of_fanx (x:real^3,V:real^3->bool,E:(real^3->bool)->bool) = + (let p = ( \ t. res (t x V E ) (d1_fan (x,V,E)) ) in + hypermap( d_fan (x,V,E) , p e_fan, p n_fan, p f_fan))`;; + + +let hypermap1_of_fanx = new_definition + `hypermap1_of_fanx (x:real^3,V:real^3->bool,E:(real^3->bool)->bool) = + (let p = ( \ t. res (t x V E ) (d1_fan (x,V,E)) ) in + hypermap( d_fan (x,V,E) , p e_fan, p n_fan, p f1_fan))`;; + + + + +let finite_d1_fan=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) ==> FINITE (d1_fan (x,V,E))`, +REPEAT GEN_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "EM" MP_TAC +THEN REWRITE_TAC[FAN;fan1] +THEN STRIP_TAC +THEN MRESA_TAC set_edges_is_finite_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC FINITE_PRODUCT[`V:real^3->bool`;`V:real^3->bool`] +THEN MRESA_TAC FINITE_IMAGE[`(\(a,b:real^3). (x,a,b,sigma_fan x V E a b))`;`{x,y | x IN (V:real^3->bool) /\ y IN V}`] +THEN MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`(IMAGE (\(a,b). x,a,b,sigma_fan x V E a b) {x,y | x IN V /\ y IN (V:real^3->bool)})` +THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM;d1_fan;SUBSET] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`(v:real^3,w:real^3)` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC THEN ASM_REWRITE_TAC[]);; + + + +let finite_d20_fan=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) ==> FINITE (d20_fan (x,V,E))`, + +REPEAT GEN_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "EM" MP_TAC +THEN REWRITE_TAC[FAN;fan1] +THEN STRIP_TAC +THEN MRESA_TAC FINITE_IMAGE[`(\b:real^3. (x:real^3,b,b,b))`;`V:real^3->bool`] +THEN MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`(IMAGE (\b:real^3. (x:real^3,b,b,b)) (V:real^3->bool))` +THEN ASM_REWRITE_TAC[d20_fan;SUBSET;IMAGE;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[IN]);; + + + +let finite_d_fan=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) +==> FINITE (d_fan (x,V,E))`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[d_fan;FINITE_UNION] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[finite_d1_fan;finite_d20_fan]);; + +let subset_d_fan=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +d1_fan (x,V,E) SUBSET d_fan (x,V,E) /\ d20_fan (x,V,E) SUBSET d_fan(x,V,E)`, +REWRITE_TAC[d_fan] THEN SET_TAC[]);; + + +let FACE_FAN_NOT_EMPTY=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds s. +FAN(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> ~(ds={})`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC lemma_face_representation[`hypermap1_of_fanx(x:real^3,V,E)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC FACE_FINITE[`hypermap1_of_fanx(x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`] +THEN STRIP_TAC +THEN MRESA1_TAC CARD_EQ_0`face (hypermap1_of_fanx (x:real^3,V,E)) x'` +THEN MRESA_TAC FACE_NOT_EMPTY[`hypermap1_of_fanx(x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC);; + + + + + + + +let into_domain_e_fan=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) +==> (!y. y IN d_fan (x,V,E)==> ((p e_fan ) y) IN (d_fan (x,V,E)))`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[res;] +THEN DISJ_CASES_TAC(SET_RULE`~(y IN d1_fan (x,V,E) )\/ (y IN d1_fan (x:real^3,V,E))`) +THENL[ +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[e_fan;d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC subset_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MATCH_MP_TAC(SET_RULE`x,w,v,sigma_fan x V E w v IN d1_fan (x,V,E) /\ d1_fan (x,V,E) SUBSET d_fan (x,V,E) +==>x,w,v,sigma_fan x V E w v IN d_fan (x:real^3,V,E)`) +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E w (v:real^3)` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]]);; + + + + +let into_domain1_e_fan=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) ==> (!y. y IN d1_fan (x,V,E)==> (e_fan x V E y IN d1_fan (x,V,E)))`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[e_fan;d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E w (v:real^3)` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]);; + + + + + +let e_fan_permutes=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) +==> (p e_fan) permutes (d_fan (x,V,E))`, +REPEAT STRIP_TAC +THEN MRESA_TAC finite_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC PERMUTES_FINITE_SURJECTIVE[`d_fan (x:real^3,V,E)`;`res (e_fan x V E) (d1_fan (x:real^3,V,E))`] +THEN STRIP_TAC +THENL[ +REWRITE_TAC[res;d_fan;UNION;IN_ELIM_THM;DE_MORGAN_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[]; + +MRESA_TAC into_domain_e_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(y IN d1_fan (x,V,E) )\/ (y IN d1_fan (x:real^3,V,E))`) +THENL[EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[res]; +MRESA_TAC permuters_of_enf_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN REWRITE_TAC[res] +THEN EXISTS_TAC`b:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC subset_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN ASM_TAC THEN SET_TAC[]]]);; + +let into_domain_f1_fan= prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) +==> (!y. y IN d_fan (x,V,E)==> ((p f1_fan ) y) IN (d_fan (x,V,E)))`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[res;] +THEN DISJ_CASES_TAC(SET_RULE`~(y IN d1_fan (x,V,E) )\/ (y IN d1_fan (x:real^3,V,E))`) +THENL[ +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[f1_fan;d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC subset_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MATCH_MP_TAC(SET_RULE`x,w,inverse1_sigma_fan x V E w v,v IN d1_fan (x,V,E) /\ d1_fan (x,V,E) SUBSET d_fan (x,V,E) +==>x,w,inverse1_sigma_fan x V E w v,v IN d_fan (x:real^3,V,E)`) +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`inverse1_sigma_fan x V E w v:real^3` +THEN EXISTS_TAC`(v:real^3)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]]);; + + + + +let into_domain1_f1_fan= prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E)==> (!y. y IN d1_fan (x,V,E)==> (f1_fan x V E y IN d1_fan (x,V,E)))`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[f1_fan;d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`inverse1_sigma_fan x V E w v:real^3` +THEN EXISTS_TAC`(v:real^3)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]);; + + + + + +let f1_fan_permutes=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) +==> (p f1_fan) permutes (d_fan (x,V,E))`, + +REPEAT STRIP_TAC +THEN MRESA_TAC finite_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC PERMUTES_FINITE_SURJECTIVE[`d_fan (x:real^3,V,E)`;`res (f1_fan x V E) (d1_fan (x:real^3,V,E))`] +THEN STRIP_TAC +THENL[ +REWRITE_TAC[res;d_fan;UNION;IN_ELIM_THM;DE_MORGAN_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[]; +MRESA_TAC into_domain_f1_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(y IN d1_fan (x,V,E) )\/ (y IN d1_fan (x:real^3,V,E))`) +THENL[ +EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[res]; +MRESA_TAC permuters_of_enf_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN REWRITE_TAC[res] +THEN EXISTS_TAC`b:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC subset_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN ASM_TAC THEN SET_TAC[]]]);; + + + + + +let into_domain_n_fan= prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) +==> (!y. y IN d_fan (x,V,E)==> ((p n_fan ) y) IN (d_fan (x,V,E)))`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[res;] +THEN DISJ_CASES_TAC(SET_RULE`~(y IN d1_fan (x,V,E) )\/ (y IN d1_fan (x:real^3,V,E))`) +THENL[ +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[n_fan;d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC subset_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MATCH_MP_TAC(SET_RULE`x,v,sigma_fan x V E v w,sigma_fan x V E v (sigma_fan x V E v w) IN d1_fan (x,V,E) /\ d1_fan (x,V,E) SUBSET d_fan (x,V,E) +==>x,v,sigma_fan x V E v w,sigma_fan x V E v (sigma_fan x V E v w) IN d_fan (x:real^3,V,E)`) +THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E v w:real^3` +THEN EXISTS_TAC`sigma_fan x V E v (sigma_fan x V E v (w:real^3))` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`(sigma_fan x V E v (w:real^3)):real^3`]]);; + + + +let into_domain1_n_fan= prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) ==> (!y. y IN d1_fan (x,V,E)==> (n_fan x V E y IN d1_fan (x,V,E)))`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[n_fan;d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`sigma_fan x V E v w:real^3` +THEN EXISTS_TAC`sigma_fan x V E v (sigma_fan x V E v (w:real^3))` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`(sigma_fan x V E v (w:real^3)):real^3`]);; + + + +let n_fan_permutes=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) +==> (p n_fan) permutes (d_fan (x,V,E))`, + +REPEAT STRIP_TAC +THEN MRESA_TAC finite_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC PERMUTES_FINITE_SURJECTIVE[`d_fan (x:real^3,V,E)`;`res (n_fan x V E) (d1_fan (x:real^3,V,E))`] +THEN STRIP_TAC +THENL[ +REWRITE_TAC[res;d_fan;UNION;IN_ELIM_THM;DE_MORGAN_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[]; +MRESA_TAC into_domain_n_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(y IN d1_fan (x,V,E) )\/ (y IN d1_fan (x:real^3,V,E))`) +THENL[ +EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[res]; +MRESA_TAC permuters_of_enf_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN REWRITE_TAC[res] +THEN EXISTS_TAC`b:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC subset_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN ASM_TAC THEN SET_TAC[]]]);; + + +let id_enf_fan=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool) y:real^3#real^3#real^3#real^3. +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) /\ ~(y IN d1_fan (x,V,E)) +==> (p e_fan) y=y /\ (p n_fan) y=y/\ (p f1_fan) y=y`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[res;d_fan;UNION;IN_ELIM_THM;DE_MORGAN_THM]);; + +let id_power_enf_fan=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool) y:real^3#real^3#real^3#real^3 n:num p. +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) /\ ~(y IN d1_fan (x,V,E)) +==> ((p e_fan) POWER n) y=y /\ ((p n_fan) POWER n)y=y/\ ((p f1_fan) POWER n) y=y`, +(let lem=prove(`!f:A->A x:A. f x = x ==> !m. (f POWER m) x = x`, +MRESA_TAC power_map_fix_point[`1:num`] +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[POWER_1;ARITH_RULE`m*1=m:num`]) in +REPEAT STRIP_TAC +THEN MRESA_TAC id_enf_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC lem[`(p e_fan):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC lem[`(p n_fan):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC lem[`(p f1_fan):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`]));; + + + + +let into_domain_efn_fan=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) +==> (!y. y IN d1_fan (x,V,E)==> (p e_fan ) y = e_fan x V E y) +/\ (!y. y IN d1_fan (x,V,E)==> (p n_fan ) y = n_fan x V E y) +/\(!y. y IN d1_fan (x,V,E)==> (p f1_fan ) y = f1_fan x V E y) +`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[res;]);; + + + + +let power_map_fix_set = prove(`!n f:A->A g:A->A s:A->bool. (!x:A. x IN s ==> f x= g x) /\ (!x:A. x IN s ==> g x IN s) ==> (!x. x IN s==>(f POWER n) x = (g POWER n) x)`, + INDUCT_TAC THENL[REWRITE_TAC[MULT; POWER; I_THM]; + REWRITE_TAC[POWER; o_DEF] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") +THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN +POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"EM") THEN DISCH_THEN(LABEL_TAC"NHO") THEN DISCH_TAC +THEN REMOVE_THEN "YEU" (fun th -> MRESA_TAC th[`f:A->A`;`g:A->A`;`s:A->bool`]) +THEN POP_ASSUM (fun th-> MRESA1_TAC th `g (x:A):A`) +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "EM" (fun th -> MRESA1_TAC th `x:A`) +THEN REMOVE_THEN "NHO" (fun th -> MRESA1_TAC th `x:A`)]);; + + + + + + +let into_domain_power_efn_fan=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool) n:num p. +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E))) +==> (!y. y IN d1_fan (x,V,E)==> ((p e_fan ) POWER n)y = ((e_fan x V E) POWER n) y) +/\ (!y. y IN d1_fan (x,V,E)==> ((p n_fan ) POWER n) y = ((n_fan x V E) POWER n) y) +/\(!y. y IN d1_fan (x,V,E)==> ((p f1_fan ) POWER n) y = ((f1_fan x V E) POWER n) y)`, +REPEAT GEN_TAC THEN REPEAT DISCH_TAC +THEN MRESA_TAC into_domain_efn_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC into_domain1_n_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC into_domain1_f1_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC into_domain1_e_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC power_map_fix_set[`n:num`; +`(p e_fan):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`; +`(e_fan x V E):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`;`d1_fan (x:real^3,V,E)`;] +THEN MRESA_TAC power_map_fix_set[`n:num`; +`(p n_fan):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`; +`(n_fan x V E):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`;`d1_fan (x:real^3,V,E)`;] +THEN MRESA_TAC power_map_fix_set[`n:num`; +`(p f1_fan):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`; +`(f1_fan x V E):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`;`d1_fan (x:real^3,V,E)`;]);; + + + + +let power_fun_in_domain=prove(`!n f:A->A s:A->bool.(!y. y IN s==> f y IN s)==> (!y. y IN s==> (f POWER n) y IN s)`, + INDUCT_TAC THENL[REWRITE_TAC[POWER_0; I_THM]; +POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"YEU") +THEN REPEAT STRIP_TAC THEN REMOVE_THEN "YEU" (fun th-> MRESA_TAC th[`f:A->A`;`s:A->bool`]) +THEN REWRITE_TAC[COM_POWER;o_DEF] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:A`)]);; + + + +let into_domain1_power_efn_fan= prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool) n:num. +FAN(x,V,E) ==> (!y. y IN d1_fan (x,V,E)==> (((e_fan x V E) POWER n) y IN d1_fan (x,V,E))) +/\ (!y. y IN d1_fan (x,V,E)==> (((n_fan x V E) POWER n) y IN d1_fan (x,V,E))) +/\(!y. y IN d1_fan (x,V,E)==> (((f1_fan x V E) POWER n) y IN d1_fan (x,V,E)))`, +REPEAT GEN_TAC THEN DISCH_TAC +THEN MRESA_TAC into_domain1_e_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;] +THEN MRESA_TAC into_domain1_f1_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;] +THEN MRESA_TAC into_domain1_n_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;] +THEN MRESA_TAC power_fun_in_domain[`n:num`;`e_fan x V (E:(real^3->bool)->bool)`;`d1_fan (x:real^3,V,E)`;] +THEN MRESA_TAC power_fun_in_domain[`n:num`;`f1_fan x V (E:(real^3->bool)->bool)`;`d1_fan (x:real^3,V,E)`;] +THEN MRESA_TAC power_fun_in_domain[`n:num`;`n_fan x V (E:(real^3->bool)->bool)`;`d1_fan (x:real^3,V,E)`;]);; + + + + + + +let lemma_hypermap1_of_fanx=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool). +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E)) ) ==> +(p e_fan) o (p n_fan) o (p f1_fan)= I`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC EQ_EXT +THEN ASM_REWRITE_TAC[I_THM;o_DEF] +THEN GEN_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(x' IN d1_fan (x,V,E) )\/ (x' IN d1_fan (x:real^3,V,E))`) +THENL[ +MRESA_TAC id_enf_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`x':real^3#real^3#real^3#real^3`]; +MRESA_TAC into_domain_efn_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `x':real^3#real^3#real^3#real^3` ) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `f1_fan x V E x':real^3#real^3#real^3#real^3` ) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"YEU") +THEN MRESA_TAC into_domain1_f1_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `x':real^3#real^3#real^3#real^3` ) +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th `(n_fan x V E (f1_fan x V E x')):real^3#real^3#real^3#real^3` ) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain1_n_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `f1_fan x V E x':real^3#real^3#real^3#real^3` ) +THEN RESA_TAC +THEN MRESA_TAC condition_hypermap_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `x':real^3#real^3#real^3#real^3` )]);; + + + + + + + + + +let hypermap_of_fan_rep=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool) p. +FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E)) ) ==> +dart ( hypermap1_of_fanx (x,V,E)) =d_fan (x,V,E) /\ edge_map (hypermap1_of_fanx (x,V,E)) = p e_fan /\ node_map (hypermap1_of_fanx (x,V,E)) = p n_fan /\ face_map (hypermap1_of_fanx (x,V,E)) = p f1_fan `, +REPEAT GEN_TAC THEN DISCH_TAC +THEN REWRITE_TAC[hypermap1_of_fanx] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC finite_d_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC e_fan_permutes[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC n_fan_permutes[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC f1_fan_permutes[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC lemma_hypermap1_of_fanx[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC lemma_hypermap_rep[`d_fan (x:real^3,V,E):real^3#real^3#real^3#real^3->bool`; +`(p e_fan):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`; +`(p n_fan):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`; +`(p f1_fan):real^3#real^3#real^3#real^3->real^3#real^3#real^3#real^3`]);; + +let properties_of_f1_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) y y1. +FAN(x,V,E) /\ y = f1_fan x V E y1 /\ y1 IN d1_fan (x,V,E) +==> pr3 y1 =pr2 y /\ {pr2 y1, pr3 y1} IN E /\ {pr2 y, pr3 y} IN E /\ +pr2 y1= sigma_fan x V E (pr2 y) (pr3 y)`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[d1_fan; IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr2;pr3;f1_fan] +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]);; + + + +let face_subset_dart_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> ds SUBSET d_fan (x,V,E)`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA_TAC lemma_face_representation[`hypermap1_of_fanx(x:real^3,V,E)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC lemma_face_subset[`hypermap1_of_fanx(x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`]);; + + + + +let properties_of_elements_in_face_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y. +FAN(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ y IN ds +==> {pr2 y, pr3 y} IN E\/ pr2 y= pr3 y`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y IN ds /\ ds SUBSET d_fan (x,V,E)==> y IN d_fan (x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[d_fan;d1_fan;d20_fan;UNION;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr2;pr3]);; + +let fully_surrounded_is_non_isolated_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> d20_fan(x,V,E)={}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") +THEN REWRITE_TAC[SET_RULE`A={}<=> ~(?y. y IN A)`] +THEN REWRITE_TAC[d20_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th`v:real^3`[IN;CARD_CLAUSES]) +THEN POP_ASSUM MP_TAC THEN ARITH_TAC);; + + + + +let dartset_fully_surrounded_is_non_isolated_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> d_fan(x,V,E)=d1_fan(x,V,E)`, +REPEAT STRIP_TAC +THEN MRESA_TAC fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN ASM_REWRITE_TAC[d_fan;] +THEN SET_TAC[]);; + + +let properties_of_elements_in_face_fully_surroundedfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ y IN ds +==> {pr2 y, pr3 y} IN E`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`y IN ds /\ ds SUBSET d_fan (x,V,E)==> y IN d_fan (x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr2;pr3]);; + + + +let AAUHTVE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) p. +FAN(x,V,E)/\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E)) ) ==> +FINITE (d_fan (x,V,E)) +/\ (p e_fan) permutes (d_fan (x,V,E)) +/\ (p n_fan) permutes (d_fan (x,V,E)) +/\ (p f1_fan) permutes (d_fan (x,V,E)) +/\(p e_fan) o (p n_fan) o (p f1_fan)= I +/\ (!a. a IN d1_fan(x,V,E)==> (e_fan x V E) (e_fan x V E a) =a) +/\ (!a. a IN d1_fan(x,V,E) ==> ~(e_fan x V E a=a )) +/\ (!a. a IN d1_fan(x,V,E) ==> ~(f1_fan x V E a=a )) +/\ (!k:num l:num a. a IN d1_fan(x,V,E) ==> +(((n_fan x V E) POWER k) o (e_fan x V E)) a= ((e_fan x V E)o((n_fan x V E) POWER l)) a==> (n_fan x V E POWER l) a=a) + +/\ (!n:num a. a IN d1_fan(x,V,E) ==> ~(e_fan x V E a =(n_fan x V E POWER n) a))`, + +MESON_TAC[lemma_hypermap1_of_fanx;e_fan_permutes;n_fan_permutes;finite_d_fan;f1_fan_permutes;plain_hypermap_fan;e_fan_no_fix_point;f_fan_no_fix_point;distinct_nodes;edge_lie_different_nodes]);; + +(********************************) + + +end;; diff --git a/text_formalization/fan/planarity.hl b/text_formalization/fan/planarity.hl new file mode 100755 index 0000000..cb4c9fe --- /dev/null +++ b/text_formalization/fan/planarity.hl @@ -0,0 +1,16206 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + +flyspeck_needs "general/sphere.hl";; +flyspeck_needs "fan/introduction.hl";; +flyspeck_needs "fan/topology.hl";; +flyspeck_needs "fan/fan_misc.hl";; + + +module Planarity = struct + + +open Sphere;; +open Fan_defs;; +open Hypermap;; +open Vol1;; +open Fan;; +open Topology;; +open Fan_misc;; + +(***************************************************************************) +(**********************DHVFGBC ************************) +(***************************************************************************) + + + +let collinear_continuous_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 c:real. +(\(t:real^1). (&1- drop(t))%u + drop(t) %w - (&1 -c)%x - c% v) continuous_on (:real^1)`, + SIMP_TAC[CONTINUOUS_ON_EQ_CONTINUOUS_AT;OPEN_UNIV;DIMINDEX_1] +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[drop] +THEN MATCH_MP_TAC CONTINUOUS_ADD +THEN STRIP_TAC +THENL[ + MATCH_MP_TAC CONTINUOUS_VMUL +THEN REWRITE_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS1] +THEN MATCH_MP_TAC REAL_CONTINUOUS_SUB +THEN SIMP_TAC[REAL_CONTINUOUS_CONST;REAL_CONTINUOUS_AT_COMPONENT; DIMINDEX_1; ARITH]; +REPEAT(MATCH_MP_TAC CONTINUOUS_SUB +THEN SIMP_TAC[CONTINUOUS_CONST]) +THEN MATCH_MP_TAC CONTINUOUS_VMUL +THEN REWRITE_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS1] +THEN SIMP_TAC[REAL_CONTINUOUS_AT_COMPONENT; DIMINDEX_1; ARITH]]);; + + +let collinear1_continuous_fan=prove(`!u:real^3 w:real^3 t:real^1. +(\(t:real^1). (&1- drop(t))%u + drop(t) %w) continuous at t`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[drop] +THEN MATCH_MP_TAC CONTINUOUS_ADD +THEN STRIP_TAC +THENL[ + MATCH_MP_TAC CONTINUOUS_VMUL +THEN REWRITE_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS1] +THEN MATCH_MP_TAC REAL_CONTINUOUS_SUB +THEN SIMP_TAC[REAL_CONTINUOUS_CONST;REAL_CONTINUOUS_AT_COMPONENT; DIMINDEX_1; ARITH]; + MATCH_MP_TAC CONTINUOUS_VMUL +THEN REWRITE_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS1] +THEN SIMP_TAC[REAL_CONTINUOUS_CONST;REAL_CONTINUOUS_AT_COMPONENT; DIMINDEX_1; ARITH]]);; + + + +let CONTINUOUS_CLOSED_PREIMAGE_CONSTANT = prove + (`!f:real^M->real^N s a. + f continuous_on s /\ closed s ==> closed {x | x IN s /\ f(x) = a}`, + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `{x | x IN s /\ (f:real^M->real^N)(x) = a} = {}` THEN + ASM_REWRITE_TAC[CLOSED_EMPTY] THEN ONCE_REWRITE_TAC[SET_RULE + `{x | x IN s /\ f(x) = a} = {x | x IN s /\ f(x) IN {a}}`] THEN + MATCH_MP_TAC CONTINUOUS_CLOSED_PREIMAGE THEN + ASM_REWRITE_TAC[CLOSED_SING] THEN SET_TAC[]);; + +let open_collinear_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 c:real. +open{t| ~((\(t:real^1). (&1- drop(t))%u + drop(t) %w - (&1 -c)%x - c% v)(t)= vec 0)}`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[OPEN_CLOSED;DIFF; IN_ELIM_THM;] +THEN MP_TAC(ISPECL[`(\(t:real^1). (&1- drop(t))%u + drop(t) %w - (&1 -c)%x - c% v:real^3)`;`(:real^1)`; +`((vec 0):real^3)`]CONTINUOUS_CLOSED_PREIMAGE_CONSTANT) +THEN SIMP_TAC[CLOSED_UNIV; DIMINDEX_1; collinear_continuous_fan]);; + + +let open_vector_angle_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 c:real a:real. +(!t. ~((&1 - t) % u + t % w = x)) +==> +open{t| ~((\(t:real^1). vector_angle (v - x) (((&1 - drop(t)) % u + drop(t) % w) - x))(t) = a)}`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[OPEN_CLOSED;DIFF; IN_ELIM_THM;] +THEN MP_TAC(ISPECL[`lift o (\(t:real^1). vector_angle (v - x:real^3) (((&1 - drop(t)) % u + drop(t) % w) - x))`;`(:real^1)`; +`lift (a:real)`]CONTINUOUS_CLOSED_PREIMAGE_CONSTANT) +THEN REWRITE_TAC[o_DEF;LIFT_EQ] +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN SIMP_TAC[CLOSED_UNIV; DIMINDEX_1;] +THEN REWRITE_TAC[GSYM o_DEF] +THEN REWRITE_TAC[GSYM FORALL_LIFT_FUN] +THEN MP_TAC(ISPECL[`x:real^3 `;`v:real^3 `;`u:real^3`;` w:real^3`;` &0`]collinear_continuous_fan) +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN SIMP_TAC[CONTINUOUS_ON_EQ_CONTINUOUS_AT;OPEN_UNIV;DIMINDEX_1] +THEN MATCH_MP_TAC MONO_FORALL +THEN GEN_TAC +THEN DISCH_THEN (LABEL_TAC"MA") +THEN STRIP_TAC +THEN REMOVE_THEN "MA" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(\(t:real^1). ((&1- drop(t))%(u:real^3) + drop(t) %(w:real^3)) - (x:real^3) )`;`(\(t:real^3). lift (vector_angle ((v:real^3)-(x:real^3)) t))`;`x':real^1`] CONTINUOUS_AT_COMPOSE) +THEN ASM_REWRITE_TAC[GSYM o_ASSOC] +THEN REWRITE_TAC[o_DEF] +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`;GSYM(o_DEF)] +THEN REWRITE_TAC[GSYM(REAL_CONTINUOUS_CONTINUOUS1);GSYM(I_DEF);I_O_ID] +THEN MATCH_MP_TAC(ISPECL[`(v:real^3)-(x:real^3)`;`(&1 - drop x') % u + drop x' % w - x:real^3 +`]REAL_CONTINUOUS_AT_VECTOR_ANGLE) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A+B-C= vec 0<=> A+B=C:real^3`]);; + + + + +let exists_open_not_collinear=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +==> +?t1:real. &0 < t1 /\ t1 <= &1 +/\ (!t:real. &0<= t /\ t<= t1==> ~(collinear{x,v,(&1-t)%u+ t % w}))`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ONCE_REWRITE_TAC[COLLINEAR_3;] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `; +`(E:(real^3->bool)->bool)`;` w:real^3`;` u:real^3`] +THEN FIND_ASSUM MP_TAC`~collinear {(x:real^3),(u:real^3),(w:real^3)}` +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B,C}={B,C,A}`;] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[collinear_fan] +THEN ASM_REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN DISCH_THEN(LABEL_TAC"MA") +THEN FIND_ASSUM MP_TAC`~((u:real^3) IN aff {(x:real^3), (v:real^3)})` +THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN DISCH_THEN(LABEL_TAC"A") +THEN SUBGOAL_THEN`!(t:real). ~((&1 - t) % u + t % w = x:real^3)`ASSUME_TAC +THENL(*1*)[ +GEN_TAC +THEN REMOVE_THEN "MA" MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN DISCH_TAC +THEN EXISTS_TAC`&1-(t:real)` +THEN EXISTS_TAC`(t:real)` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - t + t = &1`];(*1*) + + +SUBGOAL_THEN`!(t:real). (collinear {vec 0, v - x, ((&1 - t) % u + t % w) - x} <=> + vector_angle (v - x:real^3) (((&1 - t) % u + t % w) - x) = &0 \/ + vector_angle (v - x) (((&1 - t) % u + t % w) - x) = pi)`ASSUME_TAC +THENL(*2*)[ + +GEN_TAC +THEN MP_TAC(ISPECL[`(v:real^3)-(x:real^3)`;`((&1 - t) % (u:real^3) + (t:real) % (w:real^3)) - (x:real^3)`] +COLLINEAR_VECTOR_ANGLE) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-B=vec 0<=> A=B`];(*2*) + +ASM_REWRITE_TAC[] +THEN MRESA_TAC open_vector_angle_fan[ `x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`c:real`;`&0`] +THEN MRESA_TAC open_vector_angle_fan[ `x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`c:real`;`pi`] +THEN REWRITE_TAC[DE_MORGAN_THM;] +THEN MP_TAC(ISPECL[`{(t:real^1) | ~( +vector_angle ((v:real^3) - x) (((&1 - drop(t)) % (u:real^3) + drop(t) % (w:real^3)) - x) = &0)}` +;`{(t:real^1) | ~(vector_angle (v - x) (((&1 - drop (t)) % u + drop (t) % w) - (x:real^3)) = pi)}`]OPEN_INTER) +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM] +THEN DISCH_TAC +THEN SUBGOAL_THEN` +((vec 0):real^1) IN {(t:real^1) | ~( +vector_angle ((v:real^3) - x) (((&1 - drop(t)) % (u:real^3) + drop(t) % (w:real^3)) - x) = &0 )/\ +~(vector_angle (v - x) (((&1 - drop (t)) % u + drop (t) % w) - (x:real^3)) = pi)}` ASSUME_TAC +THENL(*3*)[ + +SIMP_TAC[IN_ELIM_THM;drop;VEC_COMPONENT;GSYM(DE_MORGAN_THM)] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(ISPECL[`((v:real^3)-(x:real^3))`;`((u:real^3)-(x:real^3))`]COLLINEAR_VECTOR_ANGLE) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-B=vec 0<=> A=B:real^3`] +THEN ONCE_REWRITE_TAC[GSYM(COLLINEAR_3);] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[];(*3*) + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"G") +THEN DISCH_TAC +THEN REMOVE_THEN "G" MP_TAC +THEN REWRITE_TAC[open_def] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`(vec 0):real^1`th)) +THEN ASM_REWRITE_TAC[IN_ELIM_THM;dist; VECTOR_ARITH`A-vec 0=A`] +THEN STRIP_TAC +THEN EXISTS_TAC`min ((e:real)/ &2) (&1)` +THEN STRIP_TAC +THENL(*4*)[ +POP_ASSUM (fun th->REWRITE_TAC[]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*4*) + +STRIP_TAC +THENL(*5*)[ +REAL_ARITH_TAC; +GEN_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`lift(t:real)`th)) +THEN REWRITE_TAC[LIFT_DROP;NORM_LIFT] +THEN DISCH_THEN(LABEL_TAC"G") +THEN STRIP_TAC +THEN REMOVE_THEN "G" MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]]]]);; + + + + + +let exist_close_fan=prove(`(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (v1:real^3) (w1:real^3). + +FAN(x,V,E) /\ {v,w} INTER {v1,w1}={} /\ {v1,w1} IN E /\ {v,w} IN E +==> +?h:real. +(&0 < h) +/\ +(!y1:real^3 y2:real^3. y1 IN (aff_ge {x} {v, w} INTER ballnorm_fan x) /\ y2 IN (aff_ge {x} {v1, w1} INTER ballnorm_fan x) +==> h <= dist(y1,y2) ))`, + +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (v1:real^3)`] +THEN MATCH_MP_TAC( ISPECL [`aff_ge {(x:real^3)} {(v:real^3), (w:real^3)} INTER ballnorm_fan x`; + `aff_ge {(x:real^3)} {(v1:real^3), (w1:real^3)} INTER ballnorm_fan x`] SEPARATE_CLOSED_COMPACT) +THEN MP_TAC(ISPECL[`(x:real^3) `;` (v:real^3)`;` (w:real^3)`]closed_aff_ge_ballnorm_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3) `;` (v1:real^3)`;` (w1:real^3)`]compact_aff_ge_ballnorm_fan) THEN RESA_TAC +THEN FIND_ASSUM(MP_TAC)`FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPECL[`{(v:real^3),(w:real^3)}`;`{(v1:real^3),(w1:real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION; IN_ELIM_THM;] +THEN ASM_REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL; SET_RULE`(A INTER C) INTER (B INTER C)= (A INTER B) INTER C`;] +THEN ASSUME_TAC(AFFINE_SING) +THEN MP_TAC(ISPEC`{ (x:real^3) }` AFFINE_HULL_EQ ) +THEN RESA_TAC +THEN RESA_TAC +THEN REWRITE_TAC[ballnorm_fan;INTER; IN_SING; EXTENSION;EMPTY;IN_ELIM_THM;] +THEN GEN_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DIST_REFL ] +THEN REAL_ARITH_TAC);; + +let AFF_GT_1_2=prove(`!x v w. + DISJOINT {x} {v, w} + ==> aff_gt {x} {v, w} = + {y | ?t1 t2 t3. + &0 < t2 /\ + &0 < t3 /\ + t1 + t2 + t3 = &1 /\ + y = t1 % x + t2 % v + t3 % w}`, +AFF_TAC);; + + + + +let linear_aff_fan=prove(`!x:real^3 v:real^3 u:real^3. +linear (\(t:real^2). t$1 %(v-x)+t$2 %(u-x))`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC LINEAR_COMPOSE_ADD +THEN STRIP_TAC +THEN MATCH_MP_TAC LINEAR_VMUL_COMPONENT +THEN SIMP_TAC[LINEAR_ID; DIMINDEX_2; ARITH]);; + +let linear1_aff_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3. +linear (\(t:real^3). t$1 %(v-x)+t$2 %(u-x)+t$3 %(w-u))`, +REPEAT STRIP_TAC +THEN REPEAT(MATCH_MP_TAC LINEAR_COMPOSE_ADD THEN STRIP_TAC) +THEN MATCH_MP_TAC LINEAR_VMUL_COMPONENT +THEN SIMP_TAC[LINEAR_ID; DIMINDEX_3; ARITH]);; + + + + + +let linear_inj_fan=prove(`!x:real^3 v:real^3 u:real^3. +~collinear{x,v,u} +==>(!(a:real^2) (b:real^2). (\(t:real^2). t$1 %(v-x)+t$2 %(u-x))(a)=(\(t:real^2). t$1 %(v-x)+t$2 %(u-x))(b) ==>a=b)`, + +REPEAT GEN_TAC +THEN DISCH_TAC +THEN ASSUME_TAC(ISPECL[`x:real^3`;` v:real^3`;`u:real^3`]linear_aff_fan) +THEN MP_TAC(ISPEC`(\(t:real^2). t$1 %(v-x)+t$2 %(u-x):real^3)`LINEAR_INJECTIVE_0) +THEN RESP_TAC +THEN REMOVE_ASSUM_TAC +THEN GEN_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(a:real^2)$2= &0 \/ ~(a$2= &0)`) +THENL[ +ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[VECTOR_MUL_EQ_0;VECTOR_ARITH`A-B=vec 0<=> B=A`] +THEN MP_TAC(ISPECL[`x:real^3`;` v:real^3`;`u:real^3`]th3) +THEN RESA_TAC +THEN ASM_TAC +THEN SIMP_TAC[ LAMBDA_BETA;CART_EQ; DIMINDEX_2; FORALL_2; VEC_COMPONENT; ARITH]; + +REWRITE_TAC[VECTOR_ARITH`A+B=vec 0<=>B= --A`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`a$2 % (u - x) = --((a:real^2)$1 % (v - x:real^3)) ==> (inv (a$2)) % a$2 % (u - x) = (inv (a$2)) % (--(a$1 % (v - x)))`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C:real^3)`]) +THEN MP_TAC(ISPEC`(a:real^2)$2`REAL_MUL_LINV) +THEN RESA_TAC +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[VECTOR_ARITH`A-B=C%(--(D%(U-B)))<=> A= (&1+C*D)%B+(--C*D)%U:real^3`] +THEN MP_TAC(ISPECL[`x:real^3`;` v:real^3`;`u:real^3`]th3) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN DISCH_THEN(LABEL_TAC"A") +THEN DISCH_TAC +THEN SUBGOAL_THEN `F`ASSUME_TAC +THENL[ +REMOVE_THEN "A" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`(&1 + inv ((a:real^2)$2) * a$1)` +THEN EXISTS_TAC`(--inv ((a:real^2)$2) * a$1)` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; +ASM_MESON_TAC[]]]);; + + + + + +let origin_point_not_in_convex_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3). +FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) +==> +~(x IN convex hull{v,u,w})`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[CONVEX_HULL_3; IN_ELIM_THM; coplanar] +THEN STRIP_TAC +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN SUBGOAL_THEN`(x:real^3)IN affine hull {v,u,w:real^3}` ASSUME_TAC +THENL(*3*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`u':real` +THEN EXISTS_TAC`v':real` +THEN EXISTS_TAC`w':real` +THEN ASM_MESON_TAC[]; + +SUBGOAL_THEN`(v:real^3)IN affine hull {v,u,w:real^3}` ASSUME_TAC +THENL(*4*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; + +SUBGOAL_THEN`(u:real^3)IN affine hull {v,u,w:real^3}` ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; +SUBGOAL_THEN`(w:real^3)IN affine hull {v,u,w:real^3}` ASSUME_TAC +THENL(*6*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; +ASM_TAC +THEN SET_TAC[]]]]]);; + + + +let separate_point_convex_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3). +FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) +==> +?(h:real). &0< h /\ (!(y:real^3). y IN convex hull{v,u,w} ==> h < norm(y-x))`, + +REPEAT STRIP_TAC +THEN SUBGOAL_THEN `FINITE {(v:real^3),(u:real^3),(w:real^3)}` ASSUME_TAC +THENL(*1*)[ +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] remark1_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(u:real^3)`] remark1_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (w:real^3)`] remark1_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(v:real^3) IN (V:real^3->bool) /\ (u:real^3) IN (V:real^3->bool) /\ (w:real^3) IN (V:real^3->bool)==> {v,u,w} SUBSET V`) +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MATCH_MP_TAC(ISPECL[`{(v:real^3),(u:real^3),(w:real^3)}`;`V:real^3->bool`]FINITE_SUBSET) +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[FAN;fan1] +THEN SET_TAC[]; + +MP_TAC(ISPEC`{(v:real^3),(u:real^3),(w:real^3)}`FINITE_IMP_COMPACT_CONVEX_HULL) +THEN POP_ASSUM (fun th-> REWRITE_TAC[th;COMPACT_EQ_BOUNDED_CLOSED]) +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3) `;`(w:real^3)`]origin_point_not_in_convex_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`convex hull {(v:real^3),(u:real^3),(w:real^3)}`;`x:real^3`]SEPARATE_POINT_CLOSED) +THEN RESA_TAC +THEN EXISTS_TAC`d:real/ &2` +THEN STRIP_TAC +THENL[ +ASM_TAC THEN REAL_ARITH_TAC; + +ONCE_REWRITE_TAC[NORM_SUB] +THEN GEN_TAC +THEN POP_ASSUM (fun th ->MP_TAC(ISPEC`y:real^3`th)) +THEN REWRITE_TAC[dist;] +THEN DISCH_THEN(LABEL_TAC"A") +THEN DISCH_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN POP_ASSUM (fun th ->REWRITE_TAC[th]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]);; + + + + +let expansion_convex_fan=prove(`!(v:real^3) (u:real^3) (w:real^3) (t:real) s:real. +&0 <= t /\ t<= &1 +/\ &0 <=s /\ s <= &1 +==> (&1-s)%v+s%((&1-t)%u+ t%w) IN convex hull{v,u,w}`, + +REWRITE_TAC[REAL_ARITH`A<= &1 <=> &0<= &1 -A`] +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[CONVEX_HULL_3; IN_ELIM_THM;] +THEN EXISTS_TAC`&1 - (s:real)` +THEN EXISTS_TAC`(s:real)*(&1 - (t:real))` +THEN EXISTS_TAC`(s:real)*(t:real)` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`s%((&1-t)%u+ t%w)= (s*(&1-t))%u+ (s*t)%w:real^3`] +THEN STRIP_TAC +THENL[MATCH_MP_TAC REAL_LE_MUL +THEN ASM_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[MATCH_MP_TAC REAL_LE_MUL +THEN ASM_TAC +THEN REAL_ARITH_TAC; +REAL_ARITH_TAC]]);; + + +let expansion1_convex_fan=prove(`!(v:real^3) (u:real^3) s:real. +&0 <=s /\ s <= &1 +==> (&1-s)%v+s%u IN convex hull{v,u}`, +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3)`;` (u:real^3)`;` &0`;`s:real`]expansion_convex_fan) +THEN ASM_REWRITE_TAC[SET_RULE`{A,B,B}={A,B}`] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN REAL_ARITH_TAC);; + +let norm_origin_fan=prove(`!x:real^3. + (\(y:real^3). lift(norm(y-x))) continuous_on (:real^3) `, +GEN_TAC +THEN MP_TAC(ISPECL[`(\(y:real^3). y-(x:real^3))`;`(\(y:real^3). lift(norm(y)))`;`(:real^3)`]CONTINUOUS_ON_COMPOSE) +THEN REWRITE_TAC[o_DEF] +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[CONTINUOUS_ON_LIFT_NORM;GSYM(o_DEF)] +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN SIMP_TAC[CONTINUOUS_ON_CONST;CONTINUOUS_ON_ID]);; + + + +let origin_point_not1_in_convex_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ {v,u} IN E +==> +~(x IN convex hull{v,u})`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] remark1_fan) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`~(u IN aff {x,v:real^3})` +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[CONVEX_HULL_2; IN_ELIM_THM;] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(v':real= &0) \/ ~(v':real= &0)`) +THENL[ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN ASM_MESON_TAC[]; + +POP_ASSUM MP_TAC +THEN REPEAT REMOVE_ASSUM_TAC +THEN REWRITE_TAC[VECTOR_ARITH`A=B+C<=>C= A-B:real^3`;REAL_ARITH`a+b= &1<=> a= &1 -b:real`] +THEN REPEAT DISCH_TAC +THEN MP_TAC(SET_RULE`v'% u =x- u' % v ==> (inv (v')) % v' % u = (inv (v')) % (x-u' % v:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;VECTOR_ARITH`(A%(B-(&1-U)%C)=(A%B)+(A*U-A)%C:real^3)`]) +THEN MP_TAC(ISPEC`(v':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`inv(v':real)` +THEN EXISTS_TAC`&1-inv(v':real)` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC]);; + + + + + + +let inequality1_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) d:real. +FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) /\ &0 < d +==> +?(h:real). &0 (!(s:real). &0 <= s /\ s <= &1 +==> s * inv(norm((&1-s)%v+s%((&1-t)%u+ t%w)-x))* norm(u-((&1-t)%u+ t%w))< d ))`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`u-((&1-t)%u+ t%w)=t%(u-w):real^3`;NORM_MUL] +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;` (w:real^3)`]separate_point_convex_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN EXISTS_TAC`min ((h:real)*(d:real) *inv(norm(u-w:real^3))) (&1)` +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] remark1_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`u:real^3`;`w:real^3`]imp_norm_gl_zero_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(h:real)*(d:real)`;`inv(norm(u-w:real^3))`] REAL_LT_MUL) +THEN RESA_TAC +THEN STRIP_TAC +THENL[ +MP_TAC(ISPECL[`h:real`;`d:real`] REAL_LT_MUL) +THEN RESA_TAC +THEN ASM_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ + +REAL_ARITH_TAC; +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 <(h:real)==> ~(h= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(h:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`(t:real)< min ((h:real) * (d:real) * inv (norm (u - w:real^3))) (&1)/\ min (h * d * inv (norm (u - w))) (&1)<= &1 ==>t<= &1/\ (t:real)< (h * d * inv (norm (u - w:real^3)))`) +THEN ASM_REWRITE_TAC[REAL_ARITH`min (h * d * inv (norm (u - w))) (&1)<= &1`] +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3) `;`(w:real^3) `;`(t:real) `;`s:real`]expansion_convex_fan) +THEN RESA_TAC +THEN REMOVE_THEN "A"(fun th -> MP_TAC(ISPEC`(&1-s)%v+s%((&1-t)%u+ t%w):real^3`th)) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`h:real`;`norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)`]REAL_LT_INV2) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 &0 <= norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)`REAL_LE_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`t:real`REAL_ABS_REFL) +THEN RESP_TAC +THEN MP_TAC(ISPECL[`inv(norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3))`; +`inv(h:real)`;`t:real`;`(h * d * inv (norm (u - w:real^3)))`; +]REAL_LT_MUL2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`u:real^3`;`w:real^3`]imp_norm_not_zero_fan) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(norm(u-w:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`u-w:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(&0 =norm(u-w:real^3)) /\ &0 <= norm(u-w:real^3)==> &0 GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REDUCE_ARITH_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A*B*C=(A*B)*C:real`;VECTOR_ARITH`(&1 - s) % v + s % ((&1 - t) % u + t % w) - x=((&1 - s) % v + s % ((&1 - t) % u + t % w))- x :real^3`]; +MP_TAC(REAL_ARITH`~(s= &1) /\ s<= &1==> (s:real)< &1`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`s:real`;`&1`;`(inv (norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3))*(t:real)) * norm(u-w:real^3)`; +`d:real`]REAL_LT_MUL2) +THEN REDUCE_ARITH_TAC +THEN RESA_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A*d*B*C=A*(d*B)*C:real`;VECTOR_ARITH`(&1 - s) % v + s % ((&1 - t) % u + t % w) - x=((&1 - s) % v + s % ((&1 - t) % u + t % w))- x :real^3`]]]]);; + + + + +let bounded_convex_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ {v,u} IN E +==> ?(h:real). &0< h /\ (!(y:real^3). y IN convex hull{v,u} ==> norm(y-x) REWRITE_TAC[th;]) +THEN DISCH_TAC +THEN ASSUME_TAC(ISPEC`x:real^3` norm_origin_fan ) +THEN ASSUME_TAC(SET_RULE`convex hull {(v:real^3), u} SUBSET (:real^3)`) +THEN MP_TAC(ISPECL[`(\(y:real^3). lift(norm(y-x:real^3)))`;`(:real^3)`;`convex hull {(v:real^3),(u:real^3)}`]CONTINUOUS_ON_SUBSET) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(\(y:real^3). lift(norm(y-x:real^3)))`;`convex hull {(v:real^3),(u:real^3)}`]COMPACT_CONTINUOUS_IMAGE) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[COMPACT_EQ_BOUNDED_CLOSED;bounded;IMAGE;IN_ELIM_THM] +THEN ONCE_REWRITE_TAC[TAUT`A/\B<=>B/\A`;] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN SUBGOAL_THEN `(?x':real^3. x' IN convex hull {v, u} /\ + lift (norm (v - x:real^3)) = lift (norm (x' - x)))`ASSUME_TAC +THENL[ +EXISTS_TAC`v:real^3` +THEN SIMP_TAC[CONVEX_HULL_2; IN_ELIM_THM;] +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC; + +SUBGOAL_THEN `&0< (a:real)` ASSUME_TAC +THENL[ +REMOVE_THEN "A" (fun th-> MP_TAC(ISPEC`lift (norm (v - (x:real^3)))`th)) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NORM_LIFT;REAL_ABS_NORM ] +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] remark1_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_not_zero_fan) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`v-x:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(&0 =norm(v-x:real^3)) /\ &0 <= norm(v-x:real^3)==> &0 MP_TAC(ISPEC`lift (norm (y - x:real^3))`th)) +THEN ASM_REWRITE_TAC[NORM_LIFT;REAL_ABS_NORM ] +THEN ASM_TAC +THEN REAL_ARITH_TAC]; + +ASM_TAC +THEN REAL_ARITH_TAC]]]]);; + + + +let REAL_ABS_SUB_NORM = prove + (`!x y. abs(norm(x) - norm(y)) <= norm(x - y)`, + REWRITE_TAC[REAL_ARITH `abs(x - y) <= a <=> x <= y + a /\ y <= x + a`] THEN + MESON_TAC[NORM_TRIANGLE_SUB; NORM_SUB]);; + + + +let inequaility2_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) d:real. +FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) /\ &0 < d +==> +?(h:real). &0 (!(s:real). &0 <= s /\ s <= &1 +==> (norm(inv(norm((&1-s)%v+s%u-x))%((&1-s)%v+s%u-x) - inv(norm((&1-s)%v+s%((&1-t)%u+ t%w)-x))% ((&1-s)%v+s%u-x)))< d ))`, + +REWRITE_TAC[VECTOR_ARITH`A%B-C%B=(A-C)%B`;NORM_MUL] +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`u-((&1-t)%u+ t%w)=t%(u-w):real^3`;NORM_MUL] +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;` (w:real^3)`]separate_point_convex_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3) `;`(w:real^3)`]origin_point_not_in_convex_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"B") +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`]bounded_convex_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"C") +THEN EXISTS_TAC`min (h*h*(inv (h'))* inv(norm(u-w:real^3))*d:real) (&1)` +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] remark1_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`u:real^3`;`w:real^3`]imp_norm_not_zero_fan) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`u-w:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(&0 =norm(u-w:real^3)) /\ &0 <= norm(u-w:real^3)==> &0 ~(h= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(h:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 <(h':real)==> ~(h'= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(h':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`norm (u-w:real^3)`REAL_LE_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`norm (u-w:real^3)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(h:real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 &0 <= inv(h)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(h':real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 &0 <= inv(h')`) +THEN RESA_TAC +THEN STRIP_TAC +THENL(*1*)[ +MP_TAC(ISPECL[`(h:real)`;`inv (h':real) `]REAL_LT_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(h:real)`;`(h:real)*inv (h':real) `]REAL_LT_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(h:real)*(h:real)*inv (h':real)`;`inv(norm(u-w:real^3))`]REAL_LT_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(h:real)*(h:real)*inv (h':real) *inv(norm(u-w:real^3))`;`d:real`]REAL_LT_MUL) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*1*) + + +STRIP_TAC +THENL(*2*)[ + +REAL_ARITH_TAC;(*2*) + +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3)`;` s:real`]expansion1_convex_fan) +THEN RESA_TAC +THEN REMOVE_THEN "C"(fun th->MP_TAC(ISPEC`(&1 - s) % v + s % u:real^3`th)) +THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`] +origin_point_not1_in_convex_fan) +THEN RESA_TAC +THEN SUBGOAL_THEN`~(x=(&1-s)%v+s%u:real^3)` ASSUME_TAC +THENL(*3*)[ +POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN RESA_TAC;(*3*) + +MP_TAC(ISPECL[`(&1-s)%v+s%u:real^3`;`x:real^3`]imp_norm_not_zero_fan) +THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`(&1-s)%v+s%u-x:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(norm((&1-s)%v+s%u-x:real^3)= &0) /\ &0 <= norm((&1-s)%v+s%u-x:real^3)==> &0 t<= &1/\ (t:real)< (h * h * inv h' * inv (norm (u - w:real^3)) * d) `) +THEN ASM_REWRITE_TAC[REAL_ARITH`min (h * h * inv h' * inv (norm (u - w:real^3)) * d) (&1)<= &1`] +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`norm ((&1 - s) % v + s % u - x:real^3) `; +`(h':real)`;`t:real`;`(h * h * inv h' * inv (norm (u - w:real^3)) * d)`;]REAL_LT_MUL2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3) `;`(w:real^3) `;`(&0:real) `;`s:real`]expansion_convex_fan) +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &0/\ &0<= &1`] +THEN DISCH_TAC +THEN USE_THEN "A" (fun th-> MP_TAC(ISPEC`((&1 - s) % v + s % u:real^3)`th)) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th; VECTOR_ARITH`(A+B)-C=A+B-C:real^3`]) +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`h:real`;`norm ((&1 - s) % v + s % u-x:real^3)`]REAL_LT_INV2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`norm((&1-s)%v+s%u-x:real^3)`;`t:real`]REAL_LE_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv(norm ((&1 - s) % v + s % u - x:real^3))`;`inv(h:real)`;`norm ((&1 - s) % v + s % u - x:real^3)*(t:real)`;`(h':real)*(h * h * inv h' * inv (norm (u - w:real^3)) * d)`;]REAL_LT_MUL2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3) `;`(w:real^3) `;`(t:real) `;`s:real`]expansion_convex_fan) +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN USE_THEN "A" (fun th-> MP_TAC(ISPEC`(&1 - s) % v + s % ((&1 - t) % u + t % w):real^3`th)) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th; VECTOR_ARITH`(A+B)-C=A+B-C:real^3`]) +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`h:real`;`norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`]REAL_LT_INV2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv(norm((&1-s)%v+s%u-x:real^3))`;`norm((&1-s)%v+s%u-x:real^3)*(t:real)`]REAL_LE_MUL) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`NORM_POS_LE) +THEN MP_TAC(ISPEC`norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`REAL_LE_INV) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv(norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3))`;`inv(h:real)`;`inv(norm ((&1 - s) % v + s % u - x:real^3)) * norm ((&1 - s) % v + s % u - x:real^3)*(t:real)`;`inv(h:real)*(h':real)*(h * h * inv h' * inv (norm (u - w:real^3)) * d)`;]REAL_LT_MUL2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`norm (u - w:real^3)`; +`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3)) * + inv (norm ((&1 - s) % v + s % u - x)) * + norm ((&1 - s) % v + s % u - x) * + t`;`inv h * inv h * h' * h * h * inv h' * inv (norm (u - w:real^3)) * d`;]REAL_LT_LMUL) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(B*C)*E*A*D`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(A*B)*E*(C*D)`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(A*B)*E*(C*D)`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D=(A*B)*C*D`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(A*B)*(C*D)*E`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`(A*B*C)*D*E=A*B*(C*D)*E`] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B*C)*D=A*B*(C*D)`] +THEN REDUCE_ARITH_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`((A*B)*C*D)*E=(A*C)*(B*D)*E`] +THEN REDUCE_ARITH_TAC +THEN REWRITE_TAC[REAL_ARITH`((A*B)*C)*D*E=(A*B)*(C*D)*E`] +THEN ASSUME_TAC(ISPECL[`u:real^3`;`w:real^3`]NORM_SUB) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN MP_TAC(ISPECL[`t:real`;`w-u:real^3`]NORM_MUL) +THEN MP_TAC(ISPEC`t:real`REAL_ABS_REFL) +THEN RESP_TAC +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN ASM_REWRITE_TAC[REAL_ARITH`(A*B)*C*D=C*A*(B*D)`] +THEN REDUCE_ARITH_TAC +THEN DISCH_THEN(LABEL_TAC"BA") +THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3) `;`(w:real^3) `;`(t:real) `;`s:real`]expansion_convex_fan) +THEN RESA_TAC +THEN SUBGOAL_THEN`~(x=(&1 - s) % v + s % ((&1 - t) % u + t % w):real^3)` ASSUME_TAC +THENL(*4*)[ +POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"MA") +THEN STRIP_TAC +THEN REMOVE_THEN"MA" MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN ASM_REWRITE_TAC[];(*4*) + +MP_TAC(ISPECL[`(&1 - s) % v + s % ((&1 - t) % u + t % w):real^3`;`x:real^3`]imp_norm_not_zero_fan) +THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] +THEN RESA_TAC +THEN MP_TAC(ISPECL[`norm((&1 - s) % v + s % u-x:real^3)`;`norm((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`]REAL_SUB_INV) +THEN RESP_TAC +THEN ASM_REWRITE_TAC[REAL_ABS_ABS;REAL_ABS_DIV;REAL_ABS_MUL;REAL_ABS_NORM;real_div;REAL_INV_MUL; +REAL_ARITH`(A*B*C)*D=A*C*(B*D)`] +THEN REDUCE_ARITH_TAC +THEN MP_TAC(ISPECL[`((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`;`((&1 - s) % v + s % u-x:real^3)`]REAL_ABS_SUB_NORM) +THEN REWRITE_TAC[VECTOR_ARITH` +((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)-((&1 - s) % v + s % u - x)=s%(t)%(w-u) :real^3`] +THEN ONCE_REWRITE_TAC[NORM_MUL] +THEN MP_TAC(ISPEC`s:real`REAL_ABS_REFL) +THEN RESP_TAC +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`abs + (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3) - + norm ((&1 - s) % v + s % u - x))`;`s * norm (t % (w - u):real^3)`;`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3))`]REAL_LE_RMUL) +THEN RESA_TAC +THEN REMOVE_THEN "BA" MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(s= &1)\/ ~((s:real) = &1)`) +THENL(*5*)[ +ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*5*) + +MP_TAC(REAL_ARITH`~(s= &1) /\ s<= &1==> (s:real)< &1`) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`(t % (w - u):real^3)`NORM_POS_LE) +THEN MP_TAC(ISPECL[`norm (t % (w - u):real^3)`;`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3))`]REAL_LE_MUL) +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`s:real`;`&1`;`norm (t % (w - u)) * + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3))`; +`d:real`]REAL_LT_MUL2) +THEN REDUCE_ARITH_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]]]]);; + + + + + +let exists_point_small_edges_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) d:real. +FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) /\ &0 < d +==> +?(h:real). &0 (!(s:real). &0 <= s /\ s <= &1 +==> norm(inv(norm((&1-s)%v+s%u-x))%((&1-s)%v+s%u-x) - inv(norm((&1-s)%v+s%((&1-t)%u+ t%w)-x))% ((&1-s)%v+s%((&1-t)%u+ t%w)-x))< d ))`, + +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0< (d:real)==> &0< d/ &2`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3) `;`(w:real^3)`]origin_point_not_in_convex_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3) `;`(w:real^3)`;` (d:real)/ &2`]inequaility2_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool) `;`(v:real^3)`;` (u:real^3)`;` (w:real^3)`;` (d:real)/ &2`]inequality1_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"B") +THEN EXISTS_TAC`min (h:real) (h':real)` +THEN STRIP_TAC +THENL[ASM_TAC +THEN REAL_ARITH_TAC; + +STRIP_TAC +THENL[ +ASM_TAC +THEN REAL_ARITH_TAC; + +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`t< min (h:real) (h':real)==> t< (h:real) /\ t< (h':real)`) +THEN RESA_TAC +THEN REMOVE_THEN"B" (fun th-> MP_TAC(ISPEC`t:real`th)) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`s:real`th)) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"B") +THEN REMOVE_THEN"A" (fun th-> MP_TAC(ISPEC`t:real`th)) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`s:real`th)) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN ASSUME_TAC(ISPEC`((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`NORM_POS_LE) +THEN MP_TAC(ISPEC`norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`REAL_LE_INV) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`s * + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3)):real`;`(u - ((&1 - t) % u + t % w)):real^3`]NORM_MUL) +THEN REWRITE_TAC[REAL_ABS_MUL] +THEN MP_TAC(ISPEC`s:real`REAL_ABS_REFL) +THEN RESP_TAC +THEN MP_TAC(ISPEC`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3)):real`REAL_ABS_REFL) +THEN RESP_TAC +THEN REWRITE_TAC[REAL_ARITH`(A*B)*C=A*B*C`] +THEN DISCH_TAC +THEN REMOVE_THEN"B"MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN REWRITE_TAC[VECTOR_ARITH`(s * inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x))) % + (u - ((&1 - t) % u + t % w))= inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % u - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3`] + +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`norm(inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % u - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3)`;`(d:real)/ &2`; +`norm + (inv (norm ((&1 - s) % v + s % u - x)) % ((&1 - s) % v + s % u - x) - + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % u - x):real^3)`;`(d:real)/ &2`; +]REAL_LT_ADD2) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`d / &2 + d/ &2 = d`] +THEN MP_TAC(ISPECL[`(inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % u - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3)`; +`(inv (norm ((&1 - s) % v + s % u - x)) % ((&1 - s) % v + s % u - x) - + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % u - x):real^3)`]NORM_TRIANGLE) +THEN REWRITE_TAC[VECTOR_ARITH`(inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % u - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3)+ +(inv (norm ((&1 - s) % v + s % u - x)) % ((&1 - s) % v + s % u - x) - + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % u - x):real^3)=(inv (norm ((&1 - s) % v + s % u - x)) % ((&1 - s) % v + s % u - x) - + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) `] +THEN REAL_ARITH_TAC]]);; + + + + + +let same_projective_sphere_ge_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) (t:real) (y1:real^3). +FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~collinear {x, v, (&1 - t) % u + t % w} +/\ ~(y1=x) +/\ (y1 IN aff_ge {x} {v, (&1-t)%u+(t:real)% (w:real^3)} INTER ballnorm_fan x) + +==> ?s:real. &0 <= s/\ s<= &1 +/\ y1=inv(norm((&1 - s) % v + s % ((&1 - t) % u + t % w)-x))%((&1 - s) % v + s % ((&1 - t) % u + t % w)-x)+x`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN MP_TAC(ISPECL[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;]th3) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;]AFF_GE_1_2) +THEN RESA_TAC +THEN REMOVE_THEN"A" MP_TAC +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;dist;ballnorm_fan] +THEN STRIP_TAC +THEN SUBGOAL_THEN`~(&1 - t1:real= &0)/\ &0 <= &1-t1` ASSUME_TAC +THENL[ +STRIP_TAC +THENL[ + +FIND_ASSUM MP_TAC`t1+t2+t3= &1:real` +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN REWRITE_TAC[REAL_ARITH`(A+B)-A=B`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`(&0 <= t2) /\ (&0 <= t3) /\(t2+t3= &0)==> t2= &0 /\ t3= &0`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`y1 = t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w) +:real^3` +THEN FIND_ASSUM MP_TAC`t1+t2+t3= &1:real` +THEN POP_ASSUM (fun th-> REWRITE_TAC[(th)]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[(th)]) +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[(th)]) +THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[]; +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPECL[`t2:real`;`t3:real`]REAL_LT_ADD) +THEN REAL_ARITH_TAC]; + +MP_TAC(REAL_ARITH`~(&1 - t1= &0)/\ &0 <= &1-t1==> &0< (&1 -t1:real)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(&1 -t1:real)`REAL_LE_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(&1-t1:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv ((&1 - t1:real))`;`(t2:real)`]REAL_LE_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv ((&1 - t1:real))`;`(t3:real)`]REAL_LE_MUL) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC `t1+t2+t3= &1:real` +THEN REWRITE_TAC[REAL_ARITH`A+B+C=D<=>B+C=D-A`] +THEN DISCH_TAC +THEN MP_TAC(SET_RULE`t2+t3 = &1-t1 ==> (inv (&1-t1))*(t2+t3) = (inv (&1-t1))* (&1-t1:real)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)=D<=>D- A*C=A*B`] +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`inv ((&1 - t1:real))*(t3:real)` +THEN STRIP_TAC +THENL[ +ASM_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ +ASM_TAC +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[VECTOR_ARITH`(inv (&1 - t1) * t2) % v + + (inv (&1 - t1) * t3) % ((&1 - t) % u + t % w)-x= inv (&1 - t1) %( t2 % v + t3 % ((&1 - t) % u + t % w))-x:real^3`] +THEN FIND_ASSUM MP_TAC `norm(x-y1:real^3)= &1` +THEN FIND_ASSUM MP_TAC `y1 = t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w):real^3` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[NORM_SUB] +THEN REWRITE_TAC[VECTOR_ARITH`(B%A+C+D)-A=C+D-(&1-B)%A`] +THEN DISCH_TAC +THEN MP_TAC(SET_RULE`norm (t2 % v + t3 % ((&1 - t) % u + t % w) - (&1 - t1) % x:real^3) = &1 ==> (inv (&1-t1))*(norm (t2 % v + t3 % ((&1 - t) % u + t % w) - (&1 - t1) % x) ) = (inv (&1-t1))* (&1):real`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN MP_TAC(ISPECL[`inv(&1-t1:real)`;`t2 % v + t3 % ((&1 - t) % u + t % w) - (&1 - t1) % x:real^3`]NORM_MUL) +THEN MP_TAC(ISPEC`inv(&1-t1:real)`REAL_ABS_REFL) +THEN RESP_TAC +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B+C-E%D)=A%(B+C)-(A*E)%D`] +THEN REDUCE_VECTOR_TAC +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[(th)]) +THEN ASM_REWRITE_TAC[REAL_INV_INV;VECTOR_ARITH`(&1-A)%(B%C-D)+D= A%D+(B*(&1-A))%C:real^3`] +THEN REDUCE_VECTOR_TAC]]]);; + + + + + +let same_projective_sphere_gt_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) (t:real) (y1:real^3). +FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~collinear {x, v, (&1 - t) % u + t % w} +/\ (y1 IN aff_gt {x} {v, (&1-t)%u+(t:real)% (w:real^3)} INTER ballnorm_fan x) + +==> ?s:real. &0 <= s/\ s<= &1 +/\ y1=inv(norm((&1 - s) % v + s % ((&1 - t) % u + t % w)-x))%((&1 - s) % v + s % ((&1 - t) % u + t % w)-x)+x`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN MP_TAC(ISPECL[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;]th3) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;]AFF_GT_1_2) +THEN RESA_TAC +THEN REMOVE_THEN"A" MP_TAC +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;dist;ballnorm_fan] +THEN STRIP_TAC +THEN SUBGOAL_THEN`~(&1 - t1= &0)/\ &0 < &1-t1` ASSUME_TAC +THENL[ +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPECL[`t2:real`;`t3:real`]REAL_LT_ADD) +THEN REAL_ARITH_TAC; + +MP_TAC(ISPEC`(&1 -t1:real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(&1-t1:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv ((&1 - t1:real))`;`(t2:real)`]REAL_LT_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv ((&1 - t1:real))`;`(t3:real)`]REAL_LT_MUL) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC `t1+t2+t3= &1:real` +THEN REWRITE_TAC[REAL_ARITH`A+B+C=D<=>B+C=D-A`] +THEN DISCH_TAC +THEN MP_TAC(SET_RULE`t2+t3 = &1-t1 ==> (inv (&1-t1))*(t2+t3) = (inv (&1-t1))* (&1-t1:real)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)=D<=>D- A*C=A*B`] +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`inv ((&1 - t1:real))*(t3:real)` +THEN STRIP_TAC +THENL[ +ASM_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ +ASM_TAC +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[VECTOR_ARITH`(inv (&1 - t1) * t2) % v + + (inv (&1 - t1) * t3) % ((&1 - t) % u + t % w)-x= inv (&1 - t1) %( t2 % v + t3 % ((&1 - t) % u + t % w))-x:real^3`] +THEN FIND_ASSUM MP_TAC `norm(x-y1:real^3)= &1` +THEN FIND_ASSUM MP_TAC `y1 = t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w):real^3` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[NORM_SUB] +THEN REWRITE_TAC[VECTOR_ARITH`(B%A+C+D)-A=C+D-(&1-B)%A`] +THEN DISCH_TAC +THEN MP_TAC(SET_RULE`norm (t2 % v + t3 % ((&1 - t) % u + t % w) - (&1 - t1) % x:real^3) = &1 ==> (inv (&1-t1))*(norm (t2 % v + t3 % ((&1 - t) % u + t % w) - (&1 - t1) % x) ) = (inv (&1-t1))* (&1):real`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN MP_TAC(REAL_ARITH`&0 &0<= inv(&1-t1:real)`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv(&1-t1:real)`;`t2 % v + t3 % ((&1 - t) % u + t % w) - (&1 - t1) % x:real^3`]NORM_MUL) +THEN MP_TAC(ISPEC`inv(&1-t1:real)`REAL_ABS_REFL) +THEN RESP_TAC +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B+C-E%D)=A%(B+C)-(A*E)%D`] +THEN REDUCE_VECTOR_TAC +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[(th)]) +THEN ASM_REWRITE_TAC[REAL_INV_INV;VECTOR_ARITH`(&1-A)%(B%C-D)+D= A%D+(B*(&1-A))%C:real^3`] +THEN REDUCE_VECTOR_TAC]]]);; + + + +let separate1_sphere_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) (v1:real^3) (u1:real^3). + +FAN(x,V,E) /\ {v,u} INTER {v1,u1}={} /\ {v,u} IN E/\ {u,w} IN E /\ {v1,u1} IN E +/\ ~(coplanar{x,v,u,w}) +==> +?h:real. +(&0 < h) /\ (h<= &1) +/\ +(!t:real. &0 aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge {x} {v1, u1} INTER ballnorm_fan x={})`, + +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC exist_close_fan[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`; +`(v1:real^3)`;` (u1:real^3)`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THA") +THEN MRESA_TAC exists_open_not_collinear[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A" ) +THEN MRESA_TAC exists_point_small_edges_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(v:real^3)`;`(u:real^3) `;`(w:real^3)`;`h:real`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"B" ) +THEN EXISTS_TAC`min ((h':real)/ &2) (t1:real)` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*1*)[ +ASM_TAC +THEN REAL_ARITH_TAC;(*1*) + +STRIP_TAC +THENL(*2*)[ + +ASM_TAC +THEN REAL_ARITH_TAC;(*2*) + +REPEAT STRIP_TAC +THEN REWRITE_TAC[EXTENSION] +THEN GEN_TAC +THEN EQ_TAC +THENL(*3*)[ + +STRIP_TAC +THEN REWRITE_TAC[EMPTY;IN_ELIM_THM] +THEN SUBGOAL_THEN `!y1:real^3. + y1 IN aff_gt {x} {v, (&1-t)%u+(t:real)% (w:real^3)} INTER ballnorm_fan x +==> ?y2:real^3. y2 IN aff_ge {x:real^3} {(v:real^3), (u:real^3)} INTER ballnorm_fan x /\ + dist (y1,y2)<(h:real)` ASSUME_TAC +THENL(*4*)[ +MP_TAC(REAL_ARITH`&0 <(t:real)/\ &0< h' /\ t < min ((h':real)/ &2) (t1:real)==> &0 <= t /\ t<=t1 /\ t< h'`) +THEN RESA_TAC +THEN REMOVE_THEN"A" (fun th-> MP_TAC(ISPEC`t:real`th)) +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MRESA_TAC same_projective_sphere_gt_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(v:real^3)`;`(u:real^3) `;`(w:real^3)`;` (t:real) `;`(y1:real^3)`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] +THEN MRESA_TAC AFF_GE_1_2[`(x:real^3)` ;` (v:real^3)`;`(u:real^3) `;] +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;dist] +THEN MRESA_TAC expansion1_convex_fan[`(v:real^3)`;` (u:real^3)`;` s:real`] +THEN MRESA_TAC origin_point_not1_in_convex_fan[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`] +THEN SUBGOAL_THEN`~(x=(&1-s)%v+s%u:real^3)` ASSUME_TAC +THENL(*5*)[ +POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN RESA_TAC;(*5*) + +MP_TAC(ISPECL[`x:real^3`;`(&1 - s) % v + s % u:real^3`]imp_norm_not_zero_fan) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[NORM_SUB] +THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`(&1 - s) % v + s % u-x:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(&0 =norm((&1 - s) % v + s % u-x:real^3)) /\ &0 <= norm((&1 - s) % v + s % u-x:real^3)==> &0 MP_TAC(ISPEC`t:real`th)) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`s:real`th)) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[NORM_SUB]](*6*)](*5*);(*4*) +POP_ASSUM (fun th->MP_TAC(ISPEC`x':real^3`th)) +THEN MP_TAC(SET_RULE` x' IN aff_gt {x} {v, (&1 - t) % u + t % w} INTER aff_ge {x} {v1, u1} INTER + ballnorm_fan x ==> x' IN aff_ge {x} {v1, u1:real^3} INTER ballnorm_fan x +/\ x' IN aff_gt {x} {v, (&1 - t) % u + t % w:real^3} INTER ballnorm_fan x`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN SIMP_TAC[] +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THA" (fun th-> MP_TAC(ISPECL[`y2:real^3`;`x':real^3`]th)) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN SIMP_TAC[dist;NORM_SUB] +THEN REAL_ARITH_TAC](*4*);(*3*) + +SET_TAC[]]]]);; + + + + + + + + + + +let SCALE_AFF_TAC th=REPEAT GEN_TAC +THEN DISCH_TAC +THEN REPEAT GEN_TAC +THEN MRESAL_TAC th[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`&1 - a* t2- a* t3:real` +THEN EXISTS_TAC`a* t2:real` +THEN EXISTS_TAC`a* t3:real` +THEN ONCE_REWRITE_TAC[TAUT`A/\B/\C/\D<=>D/\ A/\B/\C`] +THEN STRIP_TAC +THENL[ +ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC `t1+t2+t3= &1:real` +THEN REWRITE_TAC[REAL_ARITH`A+B+C= &1<=>A= &1- B -C:real`] +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] +THEN VECTOR_ARITH_TAC; + +MP_TAC(ISPECL[`a:real`;`(t2:real)`]REAL_LT_MUL) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`a:real`;`(t3:real)`] +THEN MRESA_TAC REAL_LE_MUL[`a:real`;`(t2:real)`] +THEN MRESA_TAC REAL_LE_MUL[`a:real`;`(t3:real)`] +THEN ASM_TAC +THEN REAL_ARITH_TAC];; + + +let scale_aff_ge_fan=prove(`!x:real^3 v:real^3 u:real^3. + DISJOINT {x} {v,u} +==> +(!y:real^3 a:real. y IN aff_ge {x} {v,u} /\ &0 <= a==> a%(y-x)+x IN aff_ge{x} {v,u})`, +SCALE_AFF_TAC AFF_GE_1_2);; + +let scale_aff_gt_fan=prove(`!x:real^3 v:real^3 u:real^3. + DISJOINT {x} {v,u} +==> +(!y:real^3 a:real. y IN aff_gt {x} {v,u} /\ &0 < a==> a%(y-x)+x IN aff_gt{x} {v,u})`, +SCALE_AFF_TAC AFF_GT_1_2);; + + + +let origin_is_not_aff_gt_fan=prove(`!x:real^3 v:real^3 u:real^3. + ~(u IN aff {x,v}) /\ DISJOINT {x} {v,u}==> ~(x IN aff_gt {x} {v,u})`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN REWRITE_TAC[GSYM FORALL_NOT_THM;DE_MORGAN_THM] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`~( &0< (t2:real))\/ ( &0< (t2:real))`) +THENL[ASM_MESON_TAC[]; +DISJ_CASES_TAC(REAL_ARITH`~( &0< (t3:real))\/ ( &0< (t3:real))`) +THENL[ASM_MESON_TAC[]; +DISJ_CASES_TAC(REAL_ARITH`~( t1+t2+(t3:real)= &1)\/ ( t1+t2+(t3:real)= &1)`) +THENL[ASM_MESON_TAC[]; +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A+B+C= &1<=>A= &1- B -C:real`] +THEN DISCH_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(t3:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[VECTOR_ARITH`A=( &1-B-C) %A+B%E+C%D <=> C%(D-A)= (--B)%(E-A)`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`t3 % (u - x) = (--t2) % (v - x):real^3 ==> (inv (t3))%(t3 % (u - x)) = (inv (t3))%((--t2) % (v - x))`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[VECTOR_ARITH`A-B=C%(V-B)<=>A=( &1-C)%B+C%V`] +THEN FIND_ASSUM MP_TAC `~(u IN aff {x,v}:real^3->bool)` +THEN MATCH_MP_TAC MONO_NOT +THEN STRIP_TAC +THEN REWRITE_TAC[aff; AFFINE_HULL_2; IN_ELIM_THM] +THEN EXISTS_TAC`&1 - inv t3 * --t2:real` +THEN EXISTS_TAC`inv t3 * --t2:real` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC]]]);; + +let fan_run_in_small1_is_fan=prove( +`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 v1:real^3 u1:real^3. +FAN(x,V,E) /\ {v,u} INTER {v1,u1}={} /\ {v,u} IN E/\ {u,w} IN E /\ {v1,u1} IN E +/\ ~(coplanar{x,v,u,w}) +==> +?t1:real. &0 < t1 /\ t1 <= &1 +/\ (!t:real. &0< t /\ t< t1 ==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v1,u1}={})`, + +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u1:real^3)`; +` (v1:real^3)`] +THEN MRESA_TAC exists_open_not_collinear[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"BA") +THEN MRESA_TAC separate1_sphere_fan[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3)`;` (w:real^3)`;` (v1:real^3)`;`(u1:real^3)`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH` &0 < t1/\ &0 < h ==> &0 < min (h:real) (t1:real)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH` t1 <= &1 /\ h <= &1==> min (h:real) (t1:real)<= &1`) +THEN RESA_TAC +THEN EXISTS_TAC`min (h:real) (t1:real)` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH` &0 < t /\ t< min (h:real) (t1:real)==> t< h /\ t<= t1 /\ &0 <= t`) +THEN RESA_TAC +THEN REMOVE_THEN "A"(fun th-> MRESA1_TAC th `(t:real)`) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN REMOVE_THEN "BA"(fun th-> MRESA1_TAC th `(t:real)`) +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] +THEN MRESA_TAC origin_is_not_aff_gt_fan[`x:real^3`;`v:real^3`;`(&1-t)%u+t%w:real^3`] +THEN REWRITE_TAC[EXTENSION;INTER;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL[ REPEAT STRIP_TAC +THEN SUBGOAL_THEN`~(x=x':real^3)`ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; +MRESA_TAC imp_norm_not_zero_fan[`x':real^3`;`x:real^3`] +THEN ASSUME_TAC(ISPEC`x'-x:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(norm(x'-x:real^3)= &0) /\ &0 <= norm(x'-x:real^3)==> &0 MRESA_TAC th [`x':real^3`;`inv(norm(x'-x:real^3))`]) +THEN MRESA_TAC scale_aff_gt_fan[`x:real^3`;`v:real^3`;`(&1-t)%u+t%w:real^3`] +THEN POP_ASSUM(fun th -> MRESA_TAC th [`x':real^3`;`inv(norm(x'-x:real^3))`]) +THEN SUBGOAL_THEN`inv (norm (x' - x)) % (x' - x) + x IN ballnorm_fan x:real^3->bool` ASSUME_TAC +THENL[ +MRESA1_TAC REAL_ABS_REFL `inv(norm(x'-x:real^3))` +THEN ASM_REWRITE_TAC[ballnorm_fan;IN_ELIM_THM;dist;VECTOR_ARITH`B-(A+B)= --A:real^3`;NORM_NEG;NORM_MUL]; + +ASM_TAC +THEN SET_TAC[]]]; + +SET_TAC[]]);; + + + + + + + + +let azim_line_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 t:real^1. +~coplanar {x,v,u,(&1-drop(t))%u+drop(t)%w} +==> (\(t:real^1). azim x v u ((&1 - drop(t)) % u + drop(t) % w)) real_continuous at t`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1; o_DEF; CONTINUOUS_AT_LIFT_COMPONENT] +THEN MP_TAC(ISPECL[`(\(t:real^1). ((&1 - drop(t)) % (u:real^3) + drop(t) %(w:real^3)))`;`(\(w:real^3). lift(azim (x:real^3) (v:real^3) (u:real^3) w))`;`t:real^1`] CONTINUOUS_AT_COMPOSE) +THEN REWRITE_TAC[o_DEF] +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[ISPECL[`u:real^3`;`w:real^3`;`t:real^1`]collinear1_continuous_fan] +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`((&1 - drop(t)) % (u:real^3) + drop(t) %(w:real^3))`]REAL_CONTINUOUS_AT_AZIM) +THEN REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1; o_DEF; CONTINUOUS_AT_LIFT_COMPONENT] +THEN ASM_MESON_TAC[]);; + + + + +(******fully surrounded*******) + +let fan81=new_definition`fan81 (x:real^3,(V:real^3->bool),(E:(real^3->bool)->bool)):bool<=>(!v:real^3 u:real^3. {v,u} IN E ==> azim_fan x V E v u bool),(E:(real^3->bool)->bool)):bool<=>(!v:real^3 u:real^3. {v,u} IN E ==> &0< azim x v u (sigma_fan x V E v u) /\ azim x v u (sigma_fan x V E v u) (!t:real. ~(t= &0) ==> ~coplanar {x,v,u,(&1-t)%u+t%w} )`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC`~(coplanar{x,v,u,w:real^3})` +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[COPLANAR_DET_EQ_0;VECTOR_ARITH`((&1 - t) % u + t % w) - x=(&1 - t) % (u-x) + t % (w - x):real^3`;DET_3;VECTOR_3;VECTOR_ADD_COMPONENT;VECTOR_MUL_COMPONENT +;REAL_ARITH`(v - x)$1 * (u - x)$2 * ((&1 - t) * (u - x)$3 + t * (w - x)$3) + + (v - x)$2 * (u - x)$3 * ((&1 - t) * (u - x)$1 + t * (w - x)$1) + + (v - x)$3 * (u - x)$1 * ((&1 - t) * (u - x)$2 + t * (w - x)$2) - + (v - x)$1 * (u - x)$3 * ((&1 - t) * (u - x)$2 + t * (w - x)$2) - + (v - x)$2 * (u - x)$1 * ((&1 - t) * (u - x)$3 + t * (w - x)$3) - + (v - x)$3 * (u - x)$2 * ((&1 - t) * (u - x)$1 + t * (w - x)$1)= +t*((v - x)$1 * (u - x)$2 * ((w - x)$3) + + (v - x)$2 * (u - x)$3 * ( (w - x)$1) + + (v - x)$3 * (u - x)$1 * ((w - x)$2) - + (v - x)$1 * (u - x)$3 * ((w - x)$2) - + (v - x)$2 * (u - x)$1 * ( (w - x)$3) - + (v - x)$3 * (u - x)$2 * ( (w - x)$1)):real`;REAL_ENTIRE] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + + + + +let open_is_not_zero_fan=prove(`open{y:real^1 | ?x. ~(x = &0) /\ y = lift x}`, +(let equality_real_fan=prove(`{y:real^1 | ?x. ~(x = &0) /\ y = lift x}={y:real^1 | ~(drop y = &0)}`, +REWRITE_TAC[EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +STRIP_TAC +THEN ASM_REWRITE_TAC[LIFT_DROP]; +STRIP_TAC +THEN EXISTS_TAC`drop (x:real^1)` +THEN ASM_REWRITE_TAC[LIFT_DROP]])in +(let ngu=prove(`{x | x IN (:real^1) /\ x = vec 0}={x | x IN (:real^1) /\ x$1 = &0}`, +REWRITE_TAC[EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL[STRIP_TAC +THEN ASM_REWRITE_TAC[VEC_COMPONENT]; +SIMP_TAC[IN_UNIV;CART_EQ;LAMBDA_BETA;VEC_COMPONENT;DIMINDEX_1;ARITH_RULE`1<=i /\ i<=1<=>i=1`]]) +in +REWRITE_TAC[equality_real_fan] +THEN REWRITE_TAC[OPEN_CLOSED;DIFF; IN_ELIM_THM;] +THEN MP_TAC(ISPECL[`(\(t:real^1). t)`;`(:real^1)`;`(vec 0):real^1`]CONTINUOUS_CLOSED_PREIMAGE_CONSTANT) +THEN MP_TAC(ISPECL[`0`;`1`]VEC_COMPONENT) +THEN SIMP_TAC[CONTINUOUS_ON_ID;CLOSED_UNIV; DIMINDEX_1;drop;ngu])));; + + + + + + + + + + + +let azim_continuous_when_not_coplanar=prove(`!x:real^3 v:real^3 u:real^3 w:real^3. +~coplanar {x,v,u,w} +==> (\(t:real). azim x v u ((&1 - t) % u + t % w)) real_continuous_on {t:real| ~(t= &0)}`, +REWRITE_TAC[REAL_CONTINUOUS_ON;o_DEF;IMAGE;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASSUME_TAC(open_is_not_zero_fan) +THEN MRESA_TAC CONTINUOUS_ON_EQ_CONTINUOUS_AT[`(\t:real^1. lift (azim x v u ((&1 - drop t) % u + drop t % w))):real^1->real^1`;`{y:real^1| ?x. ~(x = &0) /\ y = lift x}`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[LIFT_DROP] +THEN MRESAL_TAC azim_line_fan[`x:real^3`;` v:real^3`;` u:real^3`;` w:real^3`;` (lift x''):real^1`][REAL_CONTINUOUS_CONTINUOUS1; o_DEF;LIFT_DROP] +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `x'':real`));; + + +let injective_azim_coplanar=prove(`!x:real^3 v:real^3 u:real^3 w:real^3. +~coplanar {x,v,u,w} +==> +!a:real b:real. ~(a= &0) /\ ~(b= &0)/\ (\(t:real). azim x v u ((&1 - t) % u + t % w))a=(\(t:real). azim x v u ((&1 - t) % u + t % w))b==>a=b`, +REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th -> MP_TAC(ISPEC`a:real`th)THEN ASSUME_TAC(th)) +THEN POP_ASSUM(fun th -> MP_TAC(ISPEC`b:real`th)) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`] +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR[`x:real^3`;`v:real^3`;`(&1 - a) % u + a % w:real^3`;`u:real^3`] +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR[`x:real^3`;`v:real^3`;`(&1 - b) % u + b % w:real^3`;`u:real^3`] +THEN MRESA_TAC AZIM_EQ [`x:real^3`;`v:real^3`;`u:real^3`;`(&1 - b) % u + b % w:real^3`;`(&1 - a) % u + a % w:real^3`;] +THEN MRESA_TAC AZIM_EQ_0 [`x:real^3`;`v:real^3`;`(&1 - a) % u + a % w:real^3`;`(&1 - b) % u + b % w:real^3`;] +THEN MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR [`x:real^3`;`v:real^3`;`(&1 - a) % u + a % w:real^3`;`(&1 - b) % u + b % w:real^3`;] +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`~coplanar {x,v,u,w:real^3}` +THEN REWRITE_TAC[COPLANAR_DET_EQ_0;VECTOR_ARITH`((&1 - t) % u + t % w) - x=(&1 - t) % (u-x) + t % (w - x):real^3`;DET_3;VECTOR_3;VECTOR_ADD_COMPONENT;VECTOR_MUL_COMPONENT] +THEN STRIP_TAC +THEN REWRITE_TAC[REAL_ARITH`(v - x)$1 * + ((&1 - a) * (u - x)$2 + a * (w - x)$2) * + ((&1 - b) * (u - x)$3 + b * (w - x)$3) + + (v - x)$2 * + ((&1 - a) * (u - x)$3 + a * (w - x)$3) * + ((&1 - b) * (u - x)$1 + b * (w - x)$1) + + (v - x)$3 * + ((&1 - a) * (u - x)$1 + a * (w - x)$1) * + ((&1 - b) * (u - x)$2 + b * (w - x)$2) - + (v - x)$1 * + ((&1 - a) * (u - x)$3 + a * (w - x)$3) * + ((&1 - b) * (u - x)$2 + b * (w - x)$2) - + (v - x)$2 * + ((&1 - a) * (u - x)$1 + a * (w - x)$1) * + ((&1 - b) * (u - x)$3 + b * (w - x)$3) - + (v - x)$3 * + ((&1 - a) * (u - x)$2 + a * (w - x)$2) * + ((&1 - b) * (u - x)$1 + b * (w - x)$1)= +(b-a)*((v - x)$1 * (u - x)$2 * (w - x)$3 + + (v - x)$2 * (u - x)$3 * (w - x)$1 + + (v - x)$3 * (u - x)$1 * (w - x)$2 - + (v - x)$1 * (u - x)$3 * (w - x)$2 - + (v - x)$2 * (u - x)$1 * (w - x)$3 - + (v - x)$3 * (u - x)$2 * (w - x)$1)`;REAL_ENTIRE] +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC);; + + + + + + + + + + + + +let fan_run_in_small21_is_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {v,w1} IN E +/\ ~coplanar {x,v,u,w} +==> +?t1:real. &0 aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v,w1}={})`, + +REPEAT STRIP_TAC +THEN MRESA_TAC exists_open_not_collinear[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN DISJ_CASES_TAC(SET_RULE`(?h:real. &0 &0<=t`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`(t:real)<= min (t1:real) (h:real/ &2) ==> t <= t1`) +THEN RESA_TAC +THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `t:real`) +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (v:real^3)`] +THEN REWRITE_TAC[INTER;EXTENSION;IN_ELIM_THM;] +THEN GEN_TAC +THEN EQ_TAC +THENL(*4*)[ +DISCH_TAC +THEN SUBGOAL_THEN `(&1-t)%u+t%w IN aff_ge {x,v} {w1}:real^3->bool` ASSUME_TAC +THENL(*5*)[ +POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-t)%u +t%w:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2 % v + t3 % ((&1 - t) % u + t % w) = + t1'' % x + t2' % v + t3' % w1<=> t3 % ((&1 - t) % u + t % w) = + (t1''-t1') % x + (t2'-t2) % v + t3' % w1:real^3`] +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`(t3:real)` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3 % ((&1 - t) % u + t % w) = (t1''-t1') % x + (t2'-t2) % v + t3' % w1:real^3 +==> (inv (t3))%(t3 % ((&1 - t) % u + t % w)) = (inv (t3))%((t1''-t1') % x + (t2'-t2) % v + t3' % w1)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;VECTOR_ARITH`A%(B%X+C%Y+D%Z)=(A*B)%X+(A*C)%Y+(A*D)%Z`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`t1'' + t2' + t3' = &1:real` +THEN FIND_ASSUM MP_TAC`t1' + t2 + t3 = &1:real` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM(th)]) +THEN REWRITE_TAC[REAL_ARITH`t1'' + t2' + t3' = t1' + t2 + t3<=> (t1''-t1') + (t2'-t2) + t3' = t3:real`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +(t1''-t1') + (t2'-t2) + t3' = t3 +==> (inv (t3))*((t1''-t1') + (t2'-t2) + t3') = (inv (t3))*t3`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C+D)=A*B+A*C+A*D`] +THEN STRIP_TAC +THEN EXISTS_TAC`inv t3 * (t1'' - t1'):real` +THEN EXISTS_TAC`inv t3 * (t2' - t2):real` +THEN EXISTS_TAC`inv t3 * t3':real` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_INV +THEN ASM_TAC +THEN REAL_ARITH_TAC;(*5*) +MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`;`(&1 - t) % u + t % w:real^3`;] +THEN MRESA_TAC injective_azim_coplanar[`x:real^3`;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th->MRESA_TAC th [`h:real`;`t:real`]) +THEN ASM_TAC +THEN REAL_ARITH_TAC](*5*)(*4*); +SET_TAC[]]]];(*1*) +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NOT_EXISTS_THM] +THEN DISCH_THEN(LABEL_TAC"B") +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 &0<=t`) +THEN RESA_TAC +THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `t:real`) +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (v:real^3)`] +THEN REWRITE_TAC[INTER;EXTENSION;IN_ELIM_THM;] +THEN GEN_TAC +THEN EQ_TAC +THENL(*2*)[ +DISCH_TAC +THEN SUBGOAL_THEN `(&1-t)%u+t%w IN aff_ge {x,v} {w1}:real^3->bool` ASSUME_TAC +THENL(*3*)[ +POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-t)%u +t%w:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2 % v + t3 % ((&1 - t) % u + t % w) = + t1'' % x + t2' % v + t3' % w1<=> t3 % ((&1 - t) % u + t % w) = + (t1''-t1') % x + (t2'-t2) % v + t3' % w1:real^3`] +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`(t3:real)` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3 % ((&1 - t) % u + t % w) = (t1''-t1') % x + (t2'-t2) % v + t3' % w1:real^3 +==> (inv (t3))%(t3 % ((&1 - t) % u + t % w)) = (inv (t3))%((t1''-t1') % x + (t2'-t2) % v + t3' % w1)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;VECTOR_ARITH`A%(B%X+C%Y+D%Z)=(A*B)%X+(A*C)%Y+(A*D)%Z`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`t1'' + t2' + t3' = &1:real` +THEN FIND_ASSUM MP_TAC`t1' + t2 + t3 = &1:real` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM(th)]) +THEN REWRITE_TAC[REAL_ARITH`t1'' + t2' + t3' = t1' + t2 + t3<=> (t1''-t1') + (t2'-t2) + t3' = t3:real`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +(t1''-t1') + (t2'-t2) + t3' = t3 +==> (inv (t3))*((t1''-t1') + (t2'-t2) + t3') = (inv (t3))*t3`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C+D)=A*B+A*C+A*D`] +THEN STRIP_TAC +THEN EXISTS_TAC`inv t3 * (t1'' - t1'):real` +THEN EXISTS_TAC`inv t3 * (t2' - t2):real` +THEN EXISTS_TAC`inv t3 * t3':real` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_INV +THEN ASM_TAC +THEN REAL_ARITH_TAC;(*3*) +MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`;`(&1 - t) % u + t % w:real^3`;] +THEN REMOVE_THEN "B"(fun th -> MRESAL1_TAC th `t:real`[DE_MORGAN_THM]) +THEN ASM_TAC +THEN REAL_ARITH_TAC]; +SET_TAC[]]]);; + + + +let fan_run_in_small2_is_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 w1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {v,w1} IN E +/\ ~coplanar {x,v,u,w} +==> +?t1:real. &0 aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v,w1}={})`, +REPEAT STRIP_TAC +THEN MRESA_TAC fan_run_in_small21_is_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`tt<=t1`) +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `t:real`));; + + + +let AFF_GT_2_2=prove(`!x u v w. + DISJOINT {x, u} {v, w} + ==> aff_gt {x, u} {v, w} = + {y | ?t1 t2 t3 t4. + &0 < t3 /\ + &0 < t4 /\ + t1 + t2 + t3 +t4= &1 /\ + y = t1 % x + t2 %u + t3 % v + t4 % w}`, +AFF_TAC);; + + + +let extension_in_aff_2_2_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +==> +(!t:real. &0< t /\ t< &1 +==> (!t1:real t2:real t3:real. &0t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w) IN aff_gt {x,u} {w,v}))`, +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN SUBGOAL_THEN `DISJOINT {x,u:real^3} {w,v:real^3}` ASSUME_TAC +THENL[ +REWRITE_TAC[DISJOINT_SYM;SET_RULE`{v:real^3,w:real^3}= {v} UNION {w}`;DISJOINT_UNION] +THEN REWRITE_TAC[SET_RULE`{v} UNION {w}={v:real^3,w:real^3}`] +THEN ONCE_REWRITE_TAC[DISJOINT_SYM] +THEN ASM_REWRITE_TAC[]; +MRESAL_TAC AFF_GT_2_2[`x:real^3`;`u:real^3`;`w:real^3`;`v:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t3*(&1-t):real` +THEN EXISTS_TAC`t3*(t):real` +THEN EXISTS_TAC`t2:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`t1 + t3 * (&1 - t) + t3 * t +t2 = t1+t2+t3:real`;VECTOR_ARITH`t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w) = + t1 % x + (t3 * (&1 - t)) % u + (t3 * t) % w+ t2 % v:real^3`] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_TAC +THEN REAL_ARITH_TAC]);; + + + +let inequality3_aim_in_convex_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ +(&0< azim x u w v ) /\ (azim x u w v +(!t:real. &0< t /\ t< &1 +==> (!t1:real t2:real t3:real. &0 &0< azim x u w (t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w)) +/\ azim x u w (t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w))< azim x u w v))`, + +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC`{v,u} IN (E:(real^3->bool)->bool)` +THEN ONCE_REWRITE_TAC[SET_RULE`{v,u}={u,v}`] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC WEDGE_LUNE_GT[`x:real^3`;` u:real^3`;`w:real^3`;`v:real^3`] +THEN POP_ASSUM (fun th-> MP_TAC(SYM(th))) +THEN DISCH_TAC +THEN MRESA_TAC extension_in_aff_2_2_fan[`x:real^3`;` v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `t:real`) +THEN POP_ASSUM(fun th-> MRESAL_TAC th [`t1:real`;`t2:real`;`t3:real`][wedge;IN_ELIM_THM]));; + + + +let fan_run_in_small3_is_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 w1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {u,w1} IN E +/\ ~coplanar {x,v,u,w} /\ sigma_fan x V E u w=v +/\ (&0< azim x u w v ) /\ (azim x u w v +?t1:real. &0 aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {u,w1}={})`, +REPEAT STRIP_TAC +THEN MRESA_TAC exists_open_not_collinear[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 &0<=t /\ ~(t= &0)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`tt<=t1 /\ t< &1`) +THEN RESA_TAC +THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `t:real`) +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (u:real^3)`] +THEN REWRITE_TAC[EXTENSION;INTER;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL(*1*)[ +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-t)%u +t%w:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN `x' IN (aff_ge {x,u} {w1}:real^3->bool)`ASSUME_TAC +THENL(*2*)[ +POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`u:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`u:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`t1'':real` +THEN EXISTS_TAC`t2':real` +THEN EXISTS_TAC`t3':real` +THEN ASM_REWRITE_TAC[];(*2*) + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC inequality3_aim_in_convex_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;` w:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `t:real`) +THEN POP_ASSUM(fun th-> MRESA_TAC th [`t1':real`;`t2:real`;`t3:real`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"BE") +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN SUBGOAL_THEN`~collinear {x, u, x':real^3}`ASSUME_TAC +THENL(*3*)[ +MRESA_TAC continuous_coplanar_fan [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `t:real`) +THEN ASM_REWRITE_TAC[collinear_fan;] +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[coplanar;aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN SUBGOAL_THEN`(x:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL(*4*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC;(*4*) + +SUBGOAL_THEN`(v:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC;(*5*) + +SUBGOAL_THEN`(u:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL(*6*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC;(*6*) + +SUBGOAL_THEN`((&1 - t) % u + t % w:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL(*7*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(t3:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + t2 % v + t3 % ((&1 - t) % u + t % w) = u' % x + v' % u +<=>t3 % ((&1 - t) % u + t % w) = (u'-t1') % x -t2 % v+v' % u:real^3`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3 % ((&1 - t) % u + t % w) = (u'-t1') % x -t2 % v+v' % u +==> (inv (t3))%(t3 % ((&1 - t) % u + t % w) ) = (inv (t3))%((u'-t1') % x -t2 % v+v' % u):real^3`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B-C+D)=A%B-A%C+A%D`;VECTOR_ARITH`A%B%C=(A*B)%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`(inv t3 * (u' - t1')):real` +THEN EXISTS_TAC`-- (inv t3 * t2):real` +THEN EXISTS_TAC`(inv t3 * v'):real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A+(--b)%C+d=A-b%C+d`;REAL_ARITH`inv t3 * (u' - t1') + --(inv t3 * t2) + inv t3 * v'=inv t3 * (t3+(u'+v') - (t1'+ t2+t3))`;REAL_ARITH`A+ &1- &1=A`];(*7*) + +ASM_TAC +THEN SET_TAC[]](*7*)](*6*)](*5*)](*4*);(*3*) + +MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`u:real^3`;`x':real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`u:real^3`;`x':real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`;`x':real^3`;] +THEN REMOVE_THEN"BE" MP_TAC +THEN REMOVE_THEN"YEU" MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN FIND_ASSUM MP_TAC`(sigma_fan x V E u w = (v:real^3))` +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge u V E = {w:real^3}) \/ ~(set_of_edge u V E = {w})`) +THENL(*4*)[ +FIND_ASSUM MP_TAC`w1 IN set_of_edge (u:real^3) V E` +THEN POP_ASSUM (fun th-> REWRITE_TAC[(th);IN_SING]) +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC (ISPECL[`x:real^3`;`u:real^3`;`w:real^3`]AZIM_REFL) +THEN REAL_ARITH_TAC;(*4*) + +DISJ_CASES_TAC(SET_RULE`(w1:real^3)=w \/ ~((w1:real^3)=w)`) +THENL(*5*)[ +ASM_REWRITE_TAC[] +THEN MP_TAC (ISPECL[`x:real^3`;`u:real^3`;`w:real^3`]AZIM_REFL) +THEN REAL_ARITH_TAC;(*5*) + +MRESA_TAC SIGMA_FAN[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(u:real^3)`;`(w:real^3)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w1:real^3`) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]]]; + +SET_TAC[]]);; + + + + + +let properties_fully_surrounded=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ (&0< azim x u w v ) /\ (azim x u w v ~coplanar {x,v,u,w}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{x,v,u,w}={x,u,w,v}`] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`{v,u} IN (E:(real^3->bool)->bool)` +THEN REWRITE_TAC[SET_RULE`{v,u}={u,v}`] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`w:real^3`;`v:real^3`] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + + + + + + +let fan_run_in_small_is_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 v1:real^3 w1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {v1,w1} IN E +/\ (&0< azim x u w v ) /\ (azim x u w v +?t1:real. &0 aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v1,w1}={})`, +(let lem=prove(`!x v v1. aff_ge {x} {v1, v}=aff_ge {x} {v, v1}`, +REPEAT STRIP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{v,u}={u,v}`] +THEN SIMP_TAC[]) in + +REPEAT STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN DISJ_CASES_TAC(SET_RULE`(v1=v)\/ ~(v1=v:real^3)`) +THENL[ +MRESA_TAC fan_run_in_small2_is_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v1:real^3`;`u:real^3`;` w:real^3`;`w1:real^3`]; + +DISJ_CASES_TAC(SET_RULE`(v1=u)\/ ~(v1=u:real^3)`) +THENL[ +MRESA_TAC fan_run_in_small3_is_fan[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` v1:real^3`;` w:real^3`;`w1:real^3`]; + DISJ_CASES_TAC(SET_RULE`(w1=v)\/ ~(w1=v:real^3)`) +THENL[ +FIND_ASSUM MP_TAC`{v1,w1} IN (E:(real^3->bool)->bool)` +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{v,u}={u,v}`] +THEN STRIP_TAC +THEN MRESA_TAC fan_run_in_small2_is_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w1:real^3`;`u:real^3`;` w:real^3`;`v1:real^3`] +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[lem]; +DISJ_CASES_TAC(SET_RULE`(w1=u)\/ ~(w1=u:real^3)`) +THENL[ +FIND_ASSUM MP_TAC`{v1,w1} IN (E:(real^3->bool)->bool)` +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{v,u}={u,v}`] +THEN STRIP_TAC +THEN MRESA_TAC fan_run_in_small3_is_fan[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` w1:real^3`;` w:real^3`;`v1:real^3`] +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[lem]; +SUBGOAL_THEN`{v,u} INTER {v1,w1:real^3}={}` ASSUME_TAC +THENL[ +ASM_TAC +THEN SET_TAC[]; +MRESA_TAC fan_run_in_small1_is_fan[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;` w:real^3`;`v1:real^3`;`w1:real^3`]]]]]]));; + + + + + + + + + +let fan_run1_in_small_is_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) (E':(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ E' SUBSET E +/\ (&0< azim x u w v ) /\ (azim x u w v +?h:real. &0 aff_gt{x} {v,(&1-s)%u+ s % w} INTER {v | ?e. e IN E' /\ v IN aff_ge {x} e}={})`, + +REPEAT STRIP_TAC +THEN MRESA_TAC set_edges_is_finite_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC FINITE_SUBSET [`(E':(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`] +THEN ABBREV_TAC`n=CARD (E':(real^3->bool)->bool)` +THEN REPEAT(POP_ASSUM MP_TAC) +THEN SPEC_TAC (`(E':(real^3->bool)->bool)`,`(E':(real^3->bool)->bool)`) +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC +THENL(*1*)[ +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`E':(real^3->bool)->bool`]CARD_EQ_0) +THEN RESA_TAC +THEN EXISTS_TAC`&1 / &2` +THEN REWRITE_TAC[REAL_ARITH`&0< &1/ &2`;REAL_ARITH`&1 / &2 <= &1`] +THEN ASM_SET_TAC[];(*1*) + +REPEAT GEN_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC "A") +THEN REPEAT STRIP_TAC +THEN MP_TAC(ISPEC`(E':(real^3->bool)->bool)` CHOOSE_SUBSET) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`n:num `th)) +THEN REWRITE_TAC[ARITH_RULE `n:num <= SUC n`; HAS_SIZE] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` t SUBSET E' /\ E' SUBSET E ==> (t:(real^3->bool)->bool) SUBSET E`) +THEN RESA_TAC +THEN REMOVE_THEN "A" (fun th-> MP_TAC(ISPEC`(t:(real^3->bool)->bool)`th)) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN SUBGOAL_THEN `~((E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)= {})` ASSUME_TAC +THENL(*2*)[ +STRIP_TAC +THEN MP_TAC(SET_RULE`(E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)={} /\ t SUBSET E' ==> t= E'`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`CARD (t:(real^3->bool)->bool)=n` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC;(*2*) +SUBGOAL_THEN`?e. e IN (E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)` ASSUME_TAC +THENL(*3*)[ +ASM_SET_TAC[];(*3*) + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`e IN (E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)/\ +(E':(real^3->bool)->bool) SUBSET (E:(real^3->bool)->bool) /\ t SUBSET E' ==> e IN E'/\ e IN E/\ ~(e IN t) /\ {e} UNION t SUBSET E'`) +THEN RESA_TAC +THEN MP_TAC(ISPECL [`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;`(E':(real^3->bool)->bool)`] FINITE_SUBSET) +THEN RESA_TAC +THEN ASSUME_TAC(SET_RULE`e IN {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`) +THEN MP_TAC(ISPECL[`e:real^3->bool`;`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `e IN {e:(real^3->bool)} UNION (t:(real^3->bool)->bool) +==> ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e PSUBSET {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))DELETE e`;`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`]CARD_PSUBSET) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`FINITE ( {e:(real^3->bool)} UNION (t:(real^3->bool)->bool))` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN DISCH_TAC +THEN MP_TAC(ARITH_RULE`CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) < CARD ( {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) +/\ CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) = CARD ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))-1 +<=>CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) +1= CARD ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th;]) +THEN REWRITE_TAC[ARITH_RULE`A=A`; ] +THEN MP_TAC(SET_RULE`~(e IN t)==>({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e=t`) +THEN RESA_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`(CARD (E':(real^3->bool)->bool)=SUC n)` +THEN REWRITE_TAC[ARITH_RULE`SUC n=(n:num) +1`] +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;`E':(real^3->bool)->bool`]CARD_SUBSET_EQ) +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MA") +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`]expand_edge_graph_fan) +THEN RESA_TAC +THEN MRESA_TAC fan_run_in_small_is_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w:real^3`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"BE") +THEN EXISTS_TAC` min (h:real) (t1:real)` +THEN STRIP_TAC +THENL(*4*)[ +ASM_TAC +THEN REAL_ARITH_TAC;(*4*) + +STRIP_TAC +THENL(*5*)[ +ASM_TAC +THEN REAL_ARITH_TAC;(*5*) +REPEAT STRIP_TAC +THEN REMOVE_THEN "MA" MP_TAC +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) +THEN REWRITE_TAC[UNION;IN_ELIM_THM;EXTENSION; INTER;] +THEN GEN_TAC +THEN EQ_TAC +THENL(*6*)[ +ASM_REWRITE_TAC[IN_SING] +THEN MP_TAC(REAL_ARITH`s< min h t1==> s MRESA1_TAC th `s:real`) +THEN ASM_SET_TAC[]; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th `s:real`) +THEN ASM_SET_TAC[]]; +SET_TAC[]]]]]]]);; + + + + + + +let fan_run_in_small_is_not_meet_xfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ (&0< azim x u w v ) /\ (azim x u w v +?h:real. &0 aff_gt{x} {v,(&1-s)%u+ s % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={})`, + +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`u:real^3`;` (w:real^3)`]fan_run1_in_small_is_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`A SUBSET A`] +THEN RESA_TAC +THEN EXISTS_TAC`h:real` +THEN ASM_REWRITE_TAC[] +THEN ASM_SET_TAC[]);; + +let fan_run_in_small_is_subset_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ (&0< azim x u w v ) /\ (azim x u w v + ?h:real. &0 aff_gt{x} {v,(&1-s)%u+ s % w} SUBSET yfan(x,V,E))`, +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`u:real^3`;` (w:real^3)`]fan_run1_in_small_is_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`A SUBSET A`;yfan;xfan] +THEN RESA_TAC +THEN EXISTS_TAC`h:real` +THEN ASM_REWRITE_TAC[] +THEN ASM_SET_TAC[]);; + + + +let not_collinear_is_properties_fully_surrounded1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 t:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ (&0< azim x u w v ) /\ (azim x u w v ~ collinear {x,v,(&1-t)%u+ t % w}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0<=t /\ t<= &1 ==> t= &0 \/ t= &1 \/ (&0bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] ; + +REWRITE_TAC[REAL_ARITH`&1- &1= &0`] THEN REDUCE_VECTOR_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR[`x:real^3`;`v:real^3`;`w:real^3`;`u:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`] +THEN ASM_REWRITE_TAC[]; + +MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC collinear1_fan [`x:real^3`;`v:real^3`;`(&1-t)% u+t% w:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC properties_fully_surrounded[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;` w:real^3`] +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff; AFFINE_HULL_2; IN_ELIM_THM; coplanar] +THEN STRIP_TAC +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN SUBGOAL_THEN`(x:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; + +SUBGOAL_THEN`(v:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; + +SUBGOAL_THEN`(u:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; + +SUBGOAL_THEN`(w:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(t= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(t:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - t) % u + t % w = u' % x + v' % v +<=>t % w = u' % x + v' % v-(&1 - t) % u :real^3`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t % w = u' % x + v' % v-(&1 - t) % u +==> (inv (t))%(t % w ) = (inv (t))%(u' % x + v' % v-(&1 - t) % u ):real^3`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B+C-(&1-E)%D)=A%B+A%C+(A*E-A)%D`;VECTOR_ARITH`A%B%C=(A*B)%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`(inv t * u'):real` +THEN EXISTS_TAC`(inv t * v'):real` +THEN EXISTS_TAC`(&1-inv t):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`A*B+A*C+D-E=A*(B+C)+D-E`] +THEN ASM_TAC +THEN REAL_ARITH_TAC; + +ASM_TAC +THEN SET_TAC[]]]]]]);; + + + + +let not_collinear_is_properties_fully_surrounded=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 t:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ (&0< azim x u w v ) /\ (azim x u w v ~ collinear {x,v,(&1-t)%u+ t % w}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0 &0<= t /\ t <= &1`) +THEN RESA_TAC +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`t:real`] +);; + + +let exists_inf_element_fix_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u1:real^3 . +FAN(x,V,E)/\ v IN V /\ CARD (set_of_edge v V E) >1 +==> +(?(u:real^3). (u IN (set_of_edge v V E)) /\ +(!(w:real^3). (w IN (set_of_edge v V E)) ==> azim x v u1 u <= azim x v u1 w))`, +(let lemma = prove + (`!X:real->bool. + FINITE X /\ ~(X = {}) + ==> ?a. a IN X /\ !x. x IN X ==> a <= x`, + MESON_TAC[INF_FINITE]) in +MP_TAC(lemma) +THEN DISCH_THEN(LABEL_TAC "a") +THEN REPEAT GEN_TAC THEN REWRITE_TAC[FAN;fan1] +THEN STRIP_TAC +THEN MRESA_TAC remark_finite_fan1[`(v:real^3)` ;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN DISJ_CASES_TAC(SET_RULE`((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))={})\/ + ~((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) ={})`) +THENL[ +FIND_ASSUM MP_TAC `CARD ((set_of_edge v V E):real^3->bool) > 1` +THEN POP_ASSUM (fun th->REWRITE_TAC[th;CARD_CLAUSES]) +THEN ARITH_TAC; +SUBGOAL_THEN`~(IMAGE (azim x v u1) ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) )={})` ASSUME_TAC +THENL[ +REWRITE_TAC[IMAGE_EQ_EMPTY] THEN ASM_MESON_TAC[]; + +SUBGOAL_THEN` FINITE (IMAGE (azim x v u1) (set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))` ASSUME_TAC +THENL[ASM_MESON_TAC[FINITE_IMAGE]; + +REMOVE_THEN "a" (fun th ->MRESAL1_TAC th `(IMAGE (azim x v u1) ((set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) ))`[IMAGE;IN_ELIM_THM]) +THEN EXISTS_TAC`x':real^3` + THEN ASM_REWRITE_TAC[] +THEN ASM_MESON_TAC[]]]]));; + + + +let exists_element_in_half_sapace_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u1:real^3 w1:real^3. +FAN(x,V,E)/\ v IN V /\ ~coplanar{x,v,u1,w1} +/\ CARD (set_of_edge v V E) >1 +/\ fan80(x,V,E) +==> ?u:real^3. {v,u} IN E /\ &0< azim x v u1 (u:real^3)/\ azim x v u1 (u:real^3) bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u1:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "YEU") +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC SUR_SIGMA_FAN[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(v:real^3) `;`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] +THEN DISJ_CASES_TAC(REAL_ARITH`(pi<= azim (x:real^3) (v:real^3) (u1:real^3) u )\/ azim x v u1 (u:real^3) MRESA_TAC th [`v:real^3`;`w:real^3`]) +THEN MP_TAC(REAL_ARITH`pi <= azim (x:real^3) (v:real^3) (u1:real^3) (u:real^3) /\ azim x v w u < pi==> azim x v w u <= azim x v u1 u`) +THEN RESA_TAC +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`v:real^3`;`u1:real^3`;`w:real^3`;`u:real^3`] +THEN MP_TAC(REAL_ARITH`&0 < azim x v w u /\ azim (x:real^3) (v:real^3) (u1:real^3) (u:real^3) = azim x v u1 w + azim x v w u +==> azim x v u1 w < azim x v u1 u`) +THEN POP_ASSUM (fun th-> GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN RESA_TAC +THEN REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th `w:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +ASSUME_TAC(ISPECL[`(x:real^3)`;`(v:real^3)`;`(u1:real^3)`;`u:real^3`]azim) +THEN MP_TAC(REAL_ARITH`(&0<= azim (x:real^3) (v:real^3) (u1:real^3) u) ==>(azim (x:real^3) (v:real^3) (u1:real^3) u = &0 ) \/ &0< azim x v u1 (u:real^3) `) +THEN POP_ASSUM (fun th-> GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN REWRITE_TAC[]) +THEN STRIP_TAC +THENL[ +EXISTS_TAC`sigma_fan x V E v (u:real^3)` +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E = {u:real^3})\/ ~(set_of_edge v V E = {u})`) +THENL[ + +MRESA_TAC CARD_SING[`u:real^3`; `(set_of_edge v V E):real^3->bool`] +THEN FIND_ASSUM MP_TAC `CARD ((set_of_edge v V E):real^3->bool) >1` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun TH-> REWRITE_TAC[TH]) +THEN ARITH_TAC; + +MRESA_TAC SIGMA_FAN[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(v:real^3) `;`(u:real^3)`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`sigma_fan x V E v (u:real^3)`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th `sigma_fan x V E v (u:real^3)`) +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u1:real^3`;`u:real^3`;`sigma_fan x V E v (u:real^3)`] +THEN REDUCE_ARITH_TAC +THEN REMOVE_THEN "BE" (fun th-> MRESA_TAC th [`v:real^3`;`(u:real^3)`])]; + +EXISTS_TAC`(u:real^3)` +THEN ASM_REWRITE_TAC[]]]);; + + + + + + + +let JBDNJJB=prove(`!u:real^3 v:real^3 w:real^3. +~collinear {vec 0, u, v} /\ ~collinear {vec 0, u, w} +==> +?t:real. &0< t /\ sin(azim (vec 0) u v w)=t *(u cross v) dot w`, + +REPEAT STRIP_TAC +THEN MRESA_TAC th3[`((vec 0):real^3)`;` (u:real^3)`;` (v:real^3)`] +THEN MRESA_TAC properties_coordinate[`((vec 0):real^3)`;` (u:real^3)`;` (v:real^3)`] +THEN MRESA_TAC azim[`((vec 0):real^3)`;` (u:real^3)`;` (v:real^3)`;`(w:real^3)`] +THEN POP_ASSUM (fun th->MRESA_TAC th [`e1_fan ((vec 0):real^3) (u:real^3) (v:real^3)`;`e2_fan ((vec 0):real^3) (u:real^3) (v:real^3)`;`e3_fan ((vec 0):real^3) (u:real^3) (v:real^3)`]) +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"YEU EM") +THEN DISCH_TAC THEN DISCH_TAC +THEN MRESA_TAC sincos1_of_u_fan[`((vec 0):real^3)`;` (u:real^3)`;` (v:real^3)`;`r1:real`; `psi:real`; `h1:real`] +THEN REMOVE_THEN "YEU EM" MP_TAC +THEN ASM_REWRITE_TAC[COS_ADD;SIN_ADD;] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`w = + (r2 * cos (azim (vec 0) u v w)) % e1_fan (vec 0) u v + + (r2 * sin (azim (vec 0) u v w)) % e2_fan (vec 0) u v + + h2 % u ==> +(u cross v) dot w = +(u cross v) dot ((r2 * cos (azim (vec 0) u v w)) % e1_fan (vec 0) u v + + (r2 * sin (azim (vec 0) u v w)) % e2_fan (vec 0) u v + + h2 % u)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[DOT_LADD; DOT_RADD; DOT_LMUL; DOT_RMUL;DOT_CROSS_SELF; e2_fan;e1_fan;e3_fan; +VECTOR_ARITH`A- vec 0= A`;CROSS_LADD; CROSS_RADD; CROSS_LMUL; CROSS_RMUL;CROSS_REFL;CROSS_RNEG;CROSS_LNEG;] +THEN REDUCE_ARITH_TAC +THEN REWRITE_TAC[NORM_MUL;REAL_INV_MUL; REAL_ABS_INV;REAL_INV_INV;REAL_ABS_NORM;DOT_SQUARE_NORM +;REAL_ARITH`(r2 * sin (azim (vec 0) u v w)) * + (norm u * inv (norm (u cross v))) * + inv (norm u) * + norm (u cross v) pow 2 =(r2* norm(u cross v)) * sin (azim (vec 0) u v w) * + ( inv (norm u) * norm u)* +( inv (norm (u cross v))* norm (u cross (v:real^3)))` +] +THEN MP_TAC(ISPECL[`u:real^3`;`(vec 0) :real^3`]imp_norm_not_zero_fan) +THEN REDUCE_VECTOR_TAC +THEN RESA_TAC +THEN MP_TAC(ISPEC`(norm(u:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`u:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(&0 =norm(u:real^3)) /\ &0 <= norm(u:real^3)==> &0 &0 ~((r2:real)*norm(u cross v:real^3)= &0)`) +THEN REDUCE_VECTOR_TAC +THEN RESA_TAC +THEN MP_TAC(ISPEC`(r2 * norm(u cross v:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(r2 * norm(u cross v:real^3))`REAL_LT_INV) +THEN RESA_TAC +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(u cross v) dot w = (r2 * norm (u cross v)) * sin (azim (vec 0) u v w) ==> +inv (r2 * norm (u cross v))*(r2 * norm (u cross v)) * sin (azim (vec 0) u v w)= inv (r2 * norm (u cross v)) *((u cross v) dot w)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (r2 * norm (u cross v)) * (r2 * norm (u cross v)) * + sin (azim (vec 0) u v w)=(inv (r2 * norm (u cross v)) * (r2 * norm (u cross v)))* + sin (azim (vec 0) u v w)`] +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`inv (r2 * norm (u cross v)):real` +THEN ASM_REWRITE_TAC[]]);; + + +let independent_run_edges_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ fan80(x,V,E) +/\ sigma_fan x V E u w = v +/\ &0 independent {v - x, u - x, ((&1 - a) % u + a % w) - x}`, + + +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MP_TAC(REAL_ARITH`&0< a==> ~(a= &0)`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) +THEN POP_ASSUM MP_TAC +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, v, u, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3,v:real^3,u:real^3,(&1 - a) % u + a % w:real^3}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN REMOVE_ASSUM_TAC +THEN DISCH_TAC +THEN MRESA_TAC NOT_COPLANAR_0_4_IMP_INDEPENDENT[`v - x:real^3`; `u - x:real^3`; `((&1 - a) % u + a % w) - x:real^3`]);; + + +let span_run_edges_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ fan80(x,V,E) +/\ sigma_fan x V E u w = v +/\ &0 ?t1:real t2:real t3:real. +u1-x =t1 % (v-x)+t2 % ((&1 - a) % u + a % w - x)+t3 %(u-x)`, +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MP_TAC(REAL_ARITH`&0< a==> ~(a= &0)`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) +THEN POP_ASSUM MP_TAC +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, v, u, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3,v:real^3,u:real^3,(&1 - a) % u + a % w:real^3}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN REMOVE_ASSUM_TAC +THEN DISCH_TAC +THEN MRESA_TAC NOT_COPLANAR_0_4_IMP_INDEPENDENT[`v - x:real^3`; `u - x:real^3`; `((&1 - a) % u + a % w) - x:real^3`] +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR[`v - x:real^3`; `u - x:real^3`; `((&1 - a) % u + a % w) - x:real^3`;`(vec 0):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={D,A,B,C}`] +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MP_TAC(th) THEN ASSUME_TAC(th)) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,D}={D,A,B}`] +THEN DISCH_TAC +THEN MRESA_TAC th3[`v - x:real^3`; `u - x:real^3`; `((&1 - a) % u + a % w) - x:real^3`] +THEN MRESA_TAC th3[ `((&1 - a) % u + a % w) - x:real^3`;`v - x:real^3`; `u - x:real^3`;] +THEN MP_TAC(ISPECL [`(:real^3)`; `{v - x, u - x, ((&1 - a) % u + a % w) - x:real^3}`] CARD_EQ_DIM) THEN + ASM_SIMP_TAC[ORTHONORMAL_IMP_INDEPENDENT; SUBSET_UNIV] THEN + REWRITE_TAC[DIM_UNIV; DIMINDEX_3; HAS_SIZE; FINITE_INSERT; FINITE_EMPTY] THEN + SIMP_TAC[CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; IN_INSERT;] +THEN ASM_REWRITE_TAC[NOT_IN_EMPTY; ARITH;SUBSET] +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th `u1-x:real^3`[IN_UNIV;SPAN_3;IN_ELIM_THM]) +THEN EXISTS_TAC`u':real` +THEN EXISTS_TAC`w':real` +THEN EXISTS_TAC`v':real` +THEN VECTOR_ARITH_TAC);; + + + +let IMP_NORM_FAN=prove(`!va:real^3 vb:real^3. ~(va = vb) +==> ~(norm (va-vb) = &0) /\ &0 <= norm (va-vb) /\ &0 < norm (va-vb) /\ &0 <= inv (norm (va-vb)) +/\ &0 < inv (norm (va-vb)) /\ inv (norm (va-vb)) * norm (va-vb) = &1`, +REPEAT GEN_TAC +THEN DISCH_TAC +THEN MRESA_TAC imp_norm_not_zero_fan[`va:real^3`;`vb:real^3`] +THEN ASSUME_TAC(ISPEC`va-vb:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(norm(va-vb:real^3)= &0) /\ &0 <= norm(va-vb:real^3)==> &0 &0 < ((v1 - x) cross (v - x)) dot (u1 - x)`, + +REPEAT STRIP_TAC +THEN MRESA1_TAC SIN_POS_PI`azim x v1 v (u1:real^3)` +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AZIM_TRANSLATION[`-- x:real^3`;`x:real^3`;`v1:real^3`;` v:real^3`;`u1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`x-x= vec 0`;VECTOR_ARITH`(-- X)+A= A-X:real^3`] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN MRESA_TAC JBDNJJB[`(v1-x):real^3`;`v-x:real^3`;`u1-x:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM COLLINEAR_3;] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN MRESAL_TAC REAL_LT_LMUL_EQ [` &0:real `;`(((v1 - x) cross (v - x)) dot ((u1 - x):real^3)):real`;`t:real`][REAL_ARITH`a * &0 = &0`]);; + + +let cross_dot_fully_surrounded_ge_fan=prove(`!x:real^3 v1:real^3 u1:real^3 v:real^3. +~collinear{x,v1,u1} +/\ ~collinear{x,v1,v} +/\ &0<= azim x v1 v u1 +/\ azim x v1 v u1 <= pi +==> &0 <= ((v1 - x) cross (v - x)) dot (u1 - x)`, +REPEAT STRIP_TAC +THEN MRESA1_TAC SIN_POS_PI_LE`azim x v1 v (u1:real^3)` +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AZIM_TRANSLATION[`-- x:real^3`;`x:real^3`;`v1:real^3`;` v:real^3`;`u1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`x-x= vec 0`;VECTOR_ARITH`(-- X)+A= A-X:real^3`] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN MRESA_TAC JBDNJJB[`(v1-x):real^3`;`v-x:real^3`;`u1-x:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM COLLINEAR_3;] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_LMUL_EQ [` &0:real `;`(((v1 - x) cross (v - x)) dot ((u1 - x):real^3)):real`;`t:real`][REAL_ARITH`a * &0 = &0`]);; + + +let AFF_LT_2_1 = prove + (`!x v w. + DISJOINT {x,v} {w} + ==> aff_lt {x,v} {w} = + {y | ?t1 t2 t3. + t3 < &0 /\ + t1 + t2 + t3 = &1 /\ + y = t1 % x + t2 % v + t3 % w}`, + AFF_TAC);; + + + +let properties_of_collinear4_points_fan=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +~collinear{x,v,u} +/\ v1 IN aff_gt {x} {v,u} +==> ~collinear{x,v1,v}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(u:real^3) `;] +THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(u:real^3) `;] +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[collinear1_fan;] +THEN FIND_ASSUM MP_TAC`~(u IN aff {x, v:real^3})` +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % u = u' % x + v' % v <=> t3 % u = (u'-t1) % x + (v'-t2) % v`;] +THEN MP_TAC (REAL_ARITH`&0< t3==> ~(t3= &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV `(t3:real)` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`t3 % u = (u'-t1) % x + (v'-t2) % v ==> (inv (t3)) % (t3) % ( u) = (inv (t3)) % ( (u'-t1) % x + (v'-t2) % v:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C:real^3)`;VECTOR_ARITH`A%(B+C)=A%B+A%C`]) +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`inv t3 * ((u' - t1):real)` +THEN EXISTS_TAC`inv t3 * ((v' - t2):real)` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t3 * (u' - t1) + inv t3 * (v' - t2)=inv t3 *(t3+ (u'+v') -( t1+ t2+t3))`;REAL_ARITH`A+ &1- &1=A`]);; + + + + +let cross_dot_fully_surrounded1_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0 &0< ((v1 - x) cross (u1 - x)) dot + ((&1 - a) % u + a % w-x)`, + +REPEAT STRIP_TAC +THEN MRESAL_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`; `(&1 - a) % u + a % w:real^3`;`u1:real^3`][VECTOR_ARITH`((&1 - a) % u + a % w) - x=(&1 - a) % u + a % w - x`] +THEN POP_ASSUM MATCH_MP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_THEN(LABEL_TAC"yeu em") +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "yeu em" (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`(&1-a)%u+ a%w:real^3`;`v1:real^3`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] +THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3) `;] +THEN FIND_ASSUM MP_TAC `(v1:real^3) IN aff_gt {x} {v,(&1-a)%u+ a%(w:real^3)}` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) +THEN STRIP_TAC +THEN SUBGOAL_THEN`~collinear {x, v1, (&1 - a) % u + a % w:real^3}` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[collinear1_fan;] +THEN FIND_ASSUM MP_TAC`~((&1 - a) % u + a % w IN aff {x, v:real^3})` +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % ((&1 - a) % u + a % w) = + u' % x + v' % ((&1 - a) % u + a % w)<=> +(&1-(t1+t2+t3)) % x + (v'-t3) % ((&1 - a) % u + a % w-x) = + (&1-(u'+v') ) % x + t2 % (v-x)`;REAL_ARITH`a-a= &0`] +THEN REDUCE_VECTOR_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`v' - t3= &0 \/ ~(v' - (t3:real)= &0)`) +THENL[ +ASM_REWRITE_TAC[VECTOR_ARITH`&0 %A=B<=> B= vec 0`;VECTOR_MUL_EQ_0] +THEN MP_TAC(REAL_ARITH`&0< t2==> ~(t2 = &0)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-B= vec 0<=> A=B`]; + +MRESA1_TAC REAL_MUL_LINV `(v'-t3:real)` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(v' - t3) % ((&1 - a) % u + a % w - x) = t2 % (v - x:real^3) ==> (inv (v'-t3)) % (v' - t3) % ((&1 - a) % u + a % w - x) = (inv (v'-t3)) % ( t2 % (v - x))`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C:real^3)`]) +THEN REWRITE_TAC[VECTOR_ARITH`&1 % ((&1 - a) % u + a % w - x) = (inv (v' - t3) * t2) % (v - x)<=> +(&1 - a) % u + a % w = (&1-(inv (v' - t3) * t2))%x +(inv (v' - t3) * t2) % v:real^3`] +THEN STRIP_TAC +THEN EXISTS_TAC`&1-(inv (v' - t3) * (t2:real))` +THEN EXISTS_TAC`(inv (v' - t3) * (t2:real))` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN DISCH_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v1:real^3`;`v:real^3`;`u1:real^3`;`((&1 - a) % u + a % w):real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"B") +THEN DISCH_TAC +THEN SUBGOAL_THEN`azim x v1 v ((&1 - a) % u + a % w)= pi` ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;`v1:real^3`;` (v:real^3)`] +THEN MRESA_TAC AFF_LT_2_1[`x:real^3`;`v1:real^3`;`v:real^3`] +THEN MRESAL_TAC AZIM_EQ_PI_ALT[`x:real^3`;`v1:real^3`;`v:real^3`;`((&1 - a) % u + a % w):real^3`][IN_ELIM_THM] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[VECTOR_ARITH`A=B+C+D <=> D=A-B-C:real^3`] +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV `(t3:real)` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`t3 % ((&1 - a) % u + a % w) = v1 - t1 % x - t2 % v ==> (inv (t3)) % t3 % ((&1 - a) % u + a % w) = (inv (t3)) % ( v1 - t1 % x - t2 % v:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C:real^3)`]) +THEN REWRITE_TAC[VECTOR_ARITH`&1 % ((&1 - a) % u + a % w) = inv t3 % (v1 - t1 % x - t2 % v) +<=> (&1 - a) % u + a % w = (-- inv t3 * t1) % x + (inv t3) % v1 +(-- (inv t3* t2)) % v`] +THEN STRIP_TAC +THEN EXISTS_TAC`(-- inv t3 * t1):real` +THEN EXISTS_TAC`(inv t3):real` +THEN EXISTS_TAC`(-- (inv t3 * t2)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`--inv t3 * t1 + inv t3 + --(inv t3 * t2)= inv t3 *(t3+ &1-(t1+t2+t3))`;REAL_ARITH`(t3 + &1 - &1)=t3`;REAL_ARITH`--A< &0 <=> &0< A`] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_INV +THEN ASM_REWRITE_TAC[]; +REMOVE_THEN "B" MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REMOVE_ASSUM_TAC +THEN MP_TAC(REAL_ARITH`azim x v1 v u1 < pi==> azim x v1 v u1 <= pi`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC`azim x v1 v (u1:real^3) < pi` +THEN FIND_ASSUM MP_TAC`&0< azim x v1 v (u1:real^3) ` +THEN REAL_ARITH_TAC]]);; + + + + + + + + + + +let exists_cross_dot_fully_surrounded1_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0 ?t. &0< t/\ t < &1 +/\( !h:real. &0< h/\ h &0< ((v1 - x) cross (u1 - x)) dot (((&1 - h) % ((&1 - a) % u + a % w) + h % u) - x))`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`(((&1 - t) % ((&1 - a) % u + a % w) + t % u) - x)= + ((&1 - a) % u + a % w - x) + t % (--a) % ( w-u)`;] +THEN ABBREV_TAC`va=(&1 - a) % u + a % w-x:real^3` +THEN REWRITE_TAC[DOT_RADD;DOT_RMUL; REAL_ARITH`&0 (B*D)*Cbool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;`u1:real^3`] +THEN DISJ_CASES_TAC(REAL_ARITH`(((v1 - x) cross (u1 - x:real^3)) dot (w - u)<= &0 )\/ (&0<((v1 - x) cross (u1 - x)) dot (w - u))`) +THENL[ +EXISTS_TAC`&1/ &2` +THEN REWRITE_TAC[REAL_ARITH`&0 < &1 / &2 /\ &1 / &2 < &1`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 < a ==> &0<= (a:real)`) THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 < h ==> &0<= (h:real)`) THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_LMUL[`a:real`;`((v1 - x) cross (u1 - x)) dot ((w - u):real^3)`;`&0`][REAL_ARITH`(A:real)* &0= &0`] +THEN MRESAL_TAC REAL_LE_RMUL[`a*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)`;`&0`;`h:real`][REAL_ARITH`&0 * (A:real)= &0`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +MRESA_TAC REAL_LT_MUL[`a:real`;`((v1 - x) cross (u1 - x)) dot ((w - u):real^3)`] +THEN MP_TAC(REAL_ARITH`&0<(a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)==> ~( (a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_RINV`(a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)` +THEN MRESA1_TAC REAL_LT_INV`(a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)` +THEN MRESA_TAC REAL_LT_MUL[`inv((a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3))`;`((v1 - x) cross (u1 - x)) dot (va:real^3)`] +THEN EXISTS_TAC `min ((inv(a *(((v1 - x) cross (u1 - x)) dot (w - u)))*(((v1 - x) cross (u1 - x)) dot va)) / &2 ) (&1/ &2)` +THEN STRIP_TAC +THENL[POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ + REAL_ARITH_TAC; +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH` h< min ((inv (a * (((v1 - x) cross (u1 - x)) dot (w - u))) * (((v1 - x) cross (u1 - x)) dot va)) / &2) (&1 / &2) +==> +h< ((inv (a * (((v1 - x) cross (u1 - x)) dot (w - u))) * (((v1 - x) cross (u1 - x)) dot va)) / &2)`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_LMUL[`(a * (((v1 - x) cross (u1 - x)) dot (w - u:real^3)))`;`h:real`;`((inv (a * (((v1 - x) cross (u1 - x)) dot (w - u))) * (((v1 - x) cross (u1 - x:real^3)) dot va)) / &2)`] +THEN ASM_TAC +THEN ABBREV_TAC`vb=a * (((v1 - x) cross (u1 - x)) dot (w - u))` +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`vb * (inv vb * (((v1 - x) cross (u1 - x)) dot va)) / &2= +(vb * inv vb) * (((v1 - x) cross (u1 - x)) dot va)/ &2`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]]);; + + +let cross_dot_fully_surrounded2_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0 &0 < (((&1 - a) % u + a % w - x) cross (v - x)) dot (u1 - x)`, + +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_THEN(LABEL_TAC"yeu em") +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "yeu em" (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`(&1-a)%u+ a%w:real^3`;`v1:real^3`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] +THEN MRESA1_TAC SIN_POS_PI`azim x v1 v (u1:real^3)` +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AZIM_TRANSLATION[`-- x:real^3`;`x:real^3`;`v1:real^3`;` v:real^3`;`u1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`x-x= vec 0`;VECTOR_ARITH`(-- X)+A= A-X:real^3`] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN MRESA_TAC JBDNJJB[`(v1-x):real^3`;`v-x:real^3`;`u1-x:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM COLLINEAR_3;] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN MRESAL_TAC REAL_LT_LMUL_EQ [` &0:real `;`(((v1 - x) cross (v - x)) dot ((u1 - x):real^3)):real`;`t:real`][REAL_ARITH`a * &0 = &0`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3) `;] +THEN FIND_ASSUM MP_TAC `v1 IN aff_gt {x} {v,(&1-a)%u+ a%(w:real^3)}` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[th;VECTOR_ARITH`A- vec 0= A`;VECTOR_ARITH`(t1 % x + t2 % v + t3 % ((&1 - a) % u + a % w)) - x=(t1- &1) % x + t2 % v + t3 % ((&1 - a) % u + a % w)`]) +THEN FIND_ASSUM MP_TAC `t1 + t2 + t3 = &1:real` +THEN REWRITE_TAC[REAL_ARITH`t1 + t2 + t3 = &1<=> t1- &1= (-- t2)- t3 `] +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(--t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w)= t2 % (v-x) + t3 % ((&1 - a) % u + a % w-x)`] +THEN REWRITE_TAC[CROSS_LADD; CROSS_RADD; CROSS_LMUL; CROSS_RMUL;CROSS_REFL;CROSS_RNEG;CROSS_LNEG] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[GSYM CROSS_LMUL;GSYM CROSS_LADD;DOT_LMUL] +THEN MRESAL_TAC REAL_LT_LMUL_EQ [` &0:real `;`((((&1 - a) % u + a % w - x) cross (v - x)) dot (u1 - x)):real`;`t3:real`][REAL_ARITH`a * &0 = &0`]);; + + + +let exists_cross_dot_fully_surrounded2_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0 +?t:real. &0< t/\ t < &1 +/\ (!h:real. &0 &0 < +((((&1 - h) % ((&1 - a) % u + a % w) + h % u) - x) cross (v - x)) dot (u1 - x))`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`(((&1 - t) % ((&1 - a) % u + a % w) + t % u) - x)= + ((&1 - a) % u + a % w - x) + t % (--a) % ( w-u)`;] +THEN ABBREV_TAC`va=(&1 - a) % u + a % w-x:real^3` +THEN REWRITE_TAC[CROSS_LADD;CROSS_LMUL;DOT_LADD;DOT_LMUL; REAL_ARITH`&0 (B*D)*Cbool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;`u1:real^3`] +THEN DISJ_CASES_TAC(REAL_ARITH`(((w - u) cross (v - x:real^3)) dot (u1- x)<= &0 )\/ (&0<((w - u) cross (v - x:real^3)) dot (u1- x))`) +THENL[ +EXISTS_TAC`&1/ &2` +THEN REWRITE_TAC[REAL_ARITH`&0 < &1 / &2 /\ &1 / &2 < &1`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 < a ==> &0<= (a:real)`) THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 < h ==> &0<= (h:real)`) THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_LMUL[`a:real`;`((w - u) cross (v - x:real^3)) dot (u1- x:real^3)`;`&0`][REAL_ARITH`(A:real)* &0= &0`] +THEN MRESAL_TAC REAL_LE_RMUL[`a*(((w - u) cross (v - x:real^3)) dot (u1- x))`;`&0`;`h:real`][REAL_ARITH`&0 * (A:real)= &0`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +MRESA_TAC REAL_LT_MUL[`a:real`;`((w - u) cross (v - x:real^3)) dot (u1- x:real^3)`] +THEN MP_TAC(REAL_ARITH`&0<(a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x))==> ~( (a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x))= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_RINV`(a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x))` +THEN MRESA1_TAC REAL_LT_INV`(a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x))` +THEN MRESA_TAC REAL_LT_MUL[`inv((a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x)))`;`((va cross (v - x)) dot (u1 - x))`] +THEN EXISTS_TAC `min ((inv(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))*((va cross (v - x)) dot (u1 - x))) / &2 ) (&1/ &2)` +THEN STRIP_TAC +THENL[POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ + REAL_ARITH_TAC; +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH` h< min ((inv(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))*((va cross (v - x)) dot (u1 - x))) / &2 ) (&1/ &2) +==> +h< ((inv(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))*((va cross (v - x)) dot (u1 - x))) / &2 )`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_LMUL[`(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))`;`h:real`;`((inv(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))*((va cross (v - x)) dot (u1 - x))) / &2 )`] +THEN ASM_TAC +THEN ABBREV_TAC`vb=a * (((w - u) cross (v - x:real^3)) dot (u1- x))` +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`vb * (inv vb * ((va cross (v - x)) dot (u1 - x))) / &2= +(vb * inv vb) * ((va cross (v - x)) dot (u1 - x))/ &2`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]]);; + + + + + +let properties_of_coplanar=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +~collinear{x,v,u} +/\ v1 IN aff_gt {x} {v,u} +==> coplanar{x,v1,v,u}`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[coplanar] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(u:real^3) `;] +THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(u:real^3) `;] +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) +THEN STRIP_TAC +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN SUBGOAL_THEN`(x:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL[REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; +SUBGOAL_THEN`(v:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL[ REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; +SUBGOAL_THEN`(u:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; +SUBGOAL_THEN`(v1:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t3:real` +THEN ASM_REWRITE_TAC[]; +ASM_TAC +THEN SET_TAC[]]]]]);; + + +let coplanar_is_cross_fan=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +~collinear{x,v,u} +/\ v1 IN aff_gt {x} {v,u} +==> ((v-x) cross (u-x)) dot (v1-x)= &0`, +REPEAT STRIP_TAC +THEN MRESA_TAC properties_of_coplanar[`x:real^3`;`v:real^3`;`u:real^3`;`v1:real^3`] +THEN ONCE_REWRITE_TAC[DOT_SYM;] +THEN REWRITE_TAC[DOT_CROSS_DET] +THEN ONCE_REWRITE_TAC[GSYM COPLANAR_DET_EQ_0] +THEN ASM_REWRITE_TAC[]);; + + +let lie_in_half_space_and_azim=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0 &0 < ((v-x) cross (u - x)) dot (v1-x)`, + +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_THEN(LABEL_TAC"yeu em") +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "yeu em" (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] +THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3) `;] +THEN FIND_ASSUM MP_TAC `v1 IN aff_gt {x} {v,(&1-a)%u+ a%(w:real^3)}` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A- vec 0= A`;VECTOR_ARITH`(t1 % x + t2 % v + t3 % ((&1 - a) % u + a % w)) - x=(t1- &1) % x + t2 % v + t3 % ((&1 - a) % u + a % w)`] +THEN FIND_ASSUM MP_TAC `t1 + t2 + t3 = &1:real` +THEN REWRITE_TAC[REAL_ARITH`t1 + t2 + t3 = &1<=> t1- &1= (-- t2)- t3 `] +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(--t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w)= t2 % (v-x) + t3 % ((&1 - a) % (u-x) + a % (w-x))`] +THEN REWRITE_TAC[ DOT_RADD;DOT_RMUL;DOT_CROSS_SELF] +THEN REDUCE_ARITH_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[CROSS_TRIPLE]);; + + + + + + + +let exists_cut_small_edges_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0 +?t:real. &0< t/\ t < &1 +/\ ~(aff_gt {x} {v,(&1-t)%((&1-a)%u+ a%w)+t%u} INTER aff_gt {x} {v1,u1}={})`, + +REPEAT STRIP_TAC +THEN MRESA_TAC lie_in_half_space_and_azim[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;` u1:real^3`] +THEN MRESA_TAC exists_cross_dot_fully_surrounded1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;` u1:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"MA") +THEN MRESA_TAC exists_cross_dot_fully_surrounded2_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;` u1:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"BE NHO") +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_THEN(LABEL_TAC"yeu em") +THEN ABBREV_TAC`ta=min (t:real) (t':real)/ &2` +THEN EXISTS_TAC `(ta:real)` +THEN SUBGOAL_THEN `&0< ta:real /\ ta < &1 /\ ta< t /\ ta< t'` ASSUME_TAC +THENL(*1*)[ +POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN FIND_ASSUM MP_TAC`&0 &0< (&1-ta):real`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL [`(&1-ta):real`;`a:real`] +THEN MRESA_TAC REAL_LT_LMUL [`(&1-ta):real`;`a:real`;`&1`] +THEN MP_TAC(REAL_ARITH` &0< ta /\ (&1-ta)*a< (&1-ta)* &1 :real==> (&1-ta)*a< &1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "yeu em" (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESAL_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`((&1-ta)*a):real`][VECTOR_ARITH`(&1 - ((&1 - ta) * a)) % u + ((&1 - ta) * a ) % w= +(&1 - ta) % ((&1 - a) % u + a % w) + ta % u:real^3`] +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`(&1-a)%u+ a%w:real^3`;`v1:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`;`u1:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"CON") +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - ta) % ((&1 - a) % u + a % w) + ta % u:real^3`;] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v1:real^3)`;`u1:real^3`;] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] +THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v1:real^3)`;`(u1:real^3) `;] +THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(&1 - ta) % ((&1 - a) % u + a % w) + ta % u:real^3 `;] +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;EXTENSION;EMPTY;IN;NOT_FORALL_THM] +THEN ABBREV_TAC`a1=(v-x):real^3` +THEN ABBREV_TAC`a2=(((&1-ta)%((&1-a)%u+ a%w)+ta%u)-x):real^3` +THEN ABBREV_TAC`a3=(v1-x) :real^3` +THEN ABBREV_TAC`a4=u1-x:real^3` +THEN ABBREV_TAC`va=a1 cross a2:real^3` +THEN ABBREV_TAC`vb=a3 cross a4:real^3` +THEN EXISTS_TAC`(vb:real^3) cross (va:real^3)+(x:real^3)` +THEN STRIP_TAC +THENL(*2*)[ +EXISTS_TAC`&1-(vb:real^3) dot (a2:real^3)+ vb dot (a1:real^3)` +THEN EXISTS_TAC`(vb:real^3) dot (a2:real^3)` +THEN EXISTS_TAC`--((vb:real^3) dot (a1:real^3))` +THEN REMOVE_THEN "MA"(fun th-> MRESA1_TAC th `ta:real`) +THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 - vb dot a2 + vb dot a1) + vb dot a2 + --(vb dot a1) = &1`] +THEN SUBGOAL_THEN `&0< --((vb:real^3) dot (a1:real^3))` ASSUME_TAC +THENL(*3*)[EXPAND_TAC"vb" +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[DOT_LNEG] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN REMOVE_THEN "CON"MP_TAC +THEN REAL_ARITH_TAC;(*3*) + +ASM_REWRITE_TAC[] +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_MUL_LNEG] +THEN EXPAND_TAC"a1" +THEN EXPAND_TAC"a2" +THEN VECTOR_ARITH_TAC];(*2*) + +ONCE_REWRITE_TAC[CROSS_SKEW] +THEN EXPAND_TAC"vb" +THEN REWRITE_TAC[CROSS_LAGRANGE;] +THEN EXISTS_TAC`&1+(va:real^3) dot (a4:real^3)- va dot (a3:real^3)` +THEN EXISTS_TAC`--(va:real^3) dot (a4:real^3)` +THEN EXISTS_TAC`((va:real^3) dot (a3:real^3))` +THEN REMOVE_THEN "BE NHO"(fun th-> MRESA1_TAC th `ta:real`) +THEN ASM_REWRITE_TAC[DOT_LNEG;VECTOR_MUL_LNEG;REAL_ARITH`(&1 + va dot a4 - va dot a3) + --(va dot a4) + va dot a3 = &1`;] + +THEN STRIP_TAC +THENL(*3*)[ +EXPAND_TAC"va" +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[DOT_LNEG] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*3*) + +STRIP_TAC +THENL(*4*)[ +EXPAND_TAC"va" +THEN EXPAND_TAC"a2" +THEN REWRITE_TAC[VECTOR_ARITH`((&1 - ta) % ((&1 - a) % u + a % w) + ta % u) - x +=(&1 - ta) % ((&1 - a) % u + a % w-x) + ta % (u - x)`] +THEN ABBREV_TAC`vu=(&1 - a) % u + a % w - x:real^3` +THEN REWRITE_TAC[CROSS_RADD;CROSS_RMUL;DOT_LADD;DOT_LMUL;] +THEN MRESAL_TAC coplanar_is_cross_fan[`x:real^3`;`v:real^3`;`(&1 - a) % u + a % w:real^3`;`v1:real^3`] +[VECTOR_ARITH`((&1 - a) % u + a % w) - x=(&1 - a) % u + a % w - x`] +THEN REDUCE_ARITH_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[];(*4*) +EXPAND_TAC"a3" +THEN EXPAND_TAC"a4" +THEN REWRITE_TAC[VECTOR_ARITH`-- A+B= B-A:real^3`;VECTOR_ARITH`(&1+A-B)%X+B%U-A%V=X-A%(V-X)+B%(U-X)`] +THEN VECTOR_ARITH_TAC]]]]);; + + +let aff_gt_subset_aff_ge=prove(`!x:real^3 v:real^3 u:real^3. +DISJOINT {x} {v,u} +==> +aff_gt {x} {v,u} SUBSET aff_ge {x} {v,u}`, +REPEAT STRIP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t3:real` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + + +let aff_gt1_subset_aff_ge=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +DISJOINT {x} {v,u} /\ ~collinear {x,v1,u} +/\ v1 IN aff_ge {x} {v,u} +==> +aff_gt {x} {v1,u} SUBSET aff_ge {x} {v,u}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v1:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v1:real^3`;`u:real^3`][IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % (t1 % x + t2 % v + t3 % u) + t3' % u +=(t1'+ t2'*t1) % x + (t2'* t2) % v + (t2' * t3 + t3') % u:real^3`] +THEN STRIP_TAC +THEN EXISTS_TAC`t1' + t2' * t1:real` +THEN EXISTS_TAC`t2' * t2:real` +THEN EXISTS_TAC`t2' * t3 +t3':real` +THEN MP_TAC(REAL_ARITH`&0 &0<= t2'`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t2:real`] +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t3:real`] +THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t2' * t1) + t2' * t2 + t2' * t3 + t3'= +t1'+t2'*(t1+t2+t3)+t3'`; REAL_ARITH`A* &1=A`] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + +let aff_gt12_subset_aff_ge=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +DISJOINT {x} {v,u} /\ ~collinear {x,v1,v} +/\ v1 IN aff_ge {x} {v,u} +==> +aff_gt {x} {v1,v} SUBSET aff_ge {x} {v,u}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v1:real^3`;`v:real^3`] +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v1:real^3`;`v:real^3`][IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % (t1 % x + t2 % v + t3 % u) + t3' % v +=(t1'+ t2'*t1) % x + (t2'* t2+t3') % v + (t2' * t3 ) % u:real^3`] +THEN STRIP_TAC +THEN EXISTS_TAC`t1' + t2' * t1:real` +THEN EXISTS_TAC`t2' * t2 +t3':real` +THEN EXISTS_TAC`t2' * t3 :real` +THEN MP_TAC(REAL_ARITH`&0 &0<= t2'`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t2:real`] +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t3:real`] +THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t2' * t1) + (t2' * t2 +t3')+ t2' * t3 = +t1'+t2'*(t1+t2+t3)+t3'`; REAL_ARITH`A* &1=A`] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + +let aff_gt2_subset_aff_ge=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +DISJOINT {x} {v,u} /\ ~collinear {x,v1,u} /\ ~collinear {x,v1,v} +/\ v1 IN aff_gt {x} {v,u} +==> +azim x v1 v u= pi`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v1:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESA_TAC AZIM_EQ_PI[`x:real^3`;`v1:real^3`;`v:real^3`;`u:real^3`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`v1 = t1 % x + t2 % v + t3 % u +<=> t2 % v = (--t1) % x + v1 + (--t3) % u`] +THEN MP_TAC(REAL_ARITH`&0 ~( t2= &0)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 -- t3< &0`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2:real` +THEN MRESA1_TAC REAL_LT_INV`t2:real` +THEN MRESAL_TAC REAL_LT_LMUL[`inv t2:real`;`-- t3:real`;`&0`][REAL_ARITH`A * &0= &0`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`t2 % v = --t1 % x + v1 + --t3 % u:real^3 ==> (inv (t2))%(t2 % v ) = (inv (t2))%( --t1 % x + v1 + --t3 % u)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C+D)=A%B+A%C+A%D`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN MRESAL_TAC AFF_LT_2_1[`x:real^3`;`v1:real^3`;`u:real^3`][IN_ELIM_THM;SUBSET] +THEN EXISTS_TAC`(inv t2 * --t1):real` +THEN EXISTS_TAC`inv t2:real` +THEN EXISTS_TAC`(inv t2 * --t3):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t2 * (--t1) + inv t2 + inv t2 * (--t3)= +inv t2 * (t2+ &1 -(t1 +t2 +t3))`; REAL_ARITH`A+ &1- &1=A`]);; + + +let remove_variable_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 t1:real t2:real t3:real. + &0 < t3 +/\ w = t1 % x + t2 % v + t3 % u +==> u= inv(t3) % w - (inv(t3)*t1) % x- (inv(t3) * t2) % v`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[VECTOR_ARITH`w = t1'' % x + t2'' % v + t3'' % u <=> t3'' % u = w-t1'' % x - t2'' % (v:real^3)`] +THEN MP_TAC(REAL_ARITH `&0 < (t3:real) ==> ~(t3 = &0)`) +THEN MP_TAC(ISPEC`(t3:real)`REAL_LT_INV) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC(th)) +THEN STRIP_TAC THEN STRIP_TAC +THEN MP_TAC(ISPEC`(t3:real)`REAL_MUL_LINV) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC(th)) +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3 % u = w-t1 % x - t2 % v:real^3 +==> (inv (t3))%(t3 % u) = (inv (t3))%( w-t1 % x - t2 % v:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`&1 %A=A`;VECTOR_ARITH`A%(B-C-D)=A%B-A%C-A%D`] THEN ASSUME_TAC(th)));; + + + +let aff_gt_inter_aff_gt=prove(`!(x:real^3) (v:real^3) (w:real^3). +~collinear {x,v,w} +==> +aff_gt {x} {v , w} = aff_gt {x , v} {w} INTER aff_gt {x , w} {v}`, + + REPEAT STRIP_TAC THEN MRESA_TAC th3 [`x:real^3`;`v:real^3`;`w:real^3`] + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GT_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GT_2_1) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`w:real^3`;`v:real^3`]AFF_GT_2_1) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;EXTENSION]THEN GEN_TAC THEN EQ_TAC +THENL(*1*)[ +STRIP_TAC THEN STRIP_TAC +THENL(*2*)[ + EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN EXISTS_TAC `t3:real` THEN ASM_MESON_TAC[]; +EXISTS_TAC `(t1:real)` THEN + EXISTS_TAC `(t3:real)` THEN EXISTS_TAC `(t2:real)` +THEN + ASM_MESON_TAC[REAL_ARITH `(t1:real)+ (t3:real) +(t2:real)=t1 + t2 + t3`;VECTOR_ARITH ` t1 % x + t2 % v + t3 % w = (t1:real) % (x:real^3) + (t3:real) % (w:real^3) + (t2:real) % (v:real^3)`]](*2*); + + STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(PATH_CONV "rrlr" o ONCE_DEPTH_CONV )[th] THEN ASSUME_TAC(th)) THEN POP_ASSUM MP_TAC + THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(PATH_CONV "rrlr" o ONCE_DEPTH_CONV )[SYM(th)] THEN ASSUME_TAC(th)) +THEN DISJ_CASES_TAC(SET_RULE`t3 - t2' = &0 \/ ~((t3:real) - (t2':real) = &0) `) +THENL[POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A-B= &0 <=> A=B`] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`t1':real` +THEN EXISTS_TAC`t3':real` +THEN EXISTS_TAC`t2':real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % w + t3' % v = t1' % x + t3' % v + t2' % w`; +REAL_ARITH`t1' + t3' + t2'=t1' + t2' + t3'`] +THEN ASM_TAC THEN REAL_ARITH_TAC; + +REWRITE_TAC[VECTOR_ARITH + `a % x + b % y + c % z= a1 % x + b1 % z + c1 % y <=> (c-b1) % z = (a1-a) % x + (c1-b)% y`] + THEN REWRITE_TAC[REAL_ARITH`a+b+c=a1+b1+c1<=> c1-b=(a-a1)+(c-b1)`] +THEN MRESA1_TAC REAL_MUL_LINV`t3 - t2'` + THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC +THEN MP_TAC(SET_RULE` +(t3 - t2') % w = (t1' - t1) % x + (t3' - t2) % v:real^3 +==> (inv (t3 - t2'))%((t3 - t2') % w ) = (inv (t3 - t2'))%((t1' - t1) % x + (t3' - t2) % v:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`&1 %A=A`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN ASSUME_TAC(SYM(th))) +THEN STRIP_TAC +THEN SUBGOAL_THEN`w IN aff{(x:real^3),v}` ASSUME_TAC +THENL[REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM;] THEN EXISTS_TAC`inv(t3-t2') *(t1'-t1)` +THEN EXISTS_TAC`inv(t3-t2') *(t3'-t2)` THEN ASM_REWRITE_TAC[REAL_ARITH`A*B+A*C=A*(B+C)`]; + +ASM_SET_TAC[]]]]);; + + + +let aff_gt3_subset_aff_gt=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +DISJOINT {x} {v,u} /\ ~collinear{x,v,v1} +/\ v1 IN aff_gt {x} {v,u} +==> +aff_gt {x} {v,v1} SUBSET aff_gt {x} {v,u}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`v1:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`v1:real^3`][IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % v + t3' % (t1 % x + t2 % v + t3 % u) +=(t1'+ t3'*t1) % x + (t2'+ t3' * t2) % v + (t3' * t3) % u:real^3`] +THEN STRIP_TAC +THEN EXISTS_TAC`t1' + t3' * t1:real` +THEN EXISTS_TAC`t2' + t3' * t2:real` +THEN EXISTS_TAC`t3' * t3:real` +THEN MRESA_TAC REAL_LT_MUL[`t3':real`;`t2:real`] +THEN MRESA_TAC REAL_LT_MUL[`t3':real`;`t3:real`] +THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t3' * t1) + (t2' + t3' * t2) + t3' * t3= +t1'+ t2' + t3'*(t1+t2+t3)`; REAL_ARITH`A* &1=A`] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + + + +let aff_ge1_subset_aff_ge=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +DISJOINT {x} {v,u} /\ ~collinear{x,v1,u} +/\ v1 IN aff_ge {x} {v,u} +==> +aff_ge {x} {v1,u} SUBSET aff_ge {x} {v,u}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v1:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v1:real^3`;`u:real^3`][IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % (t1 % x + t2 % v + t3 % u) + t3' % u +=(t1'+ t2'*t1) % x + (t2'* t2) % v + (t2' * t3 + t3') % u:real^3`] +THEN STRIP_TAC +THEN EXISTS_TAC`t1' + t2' * t1:real` +THEN EXISTS_TAC`t2' * t2:real` +THEN EXISTS_TAC`t2' * t3 +t3':real` +THEN MP_TAC(REAL_ARITH`&0 &0<= t2'`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t2:real`] +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t3:real`] +THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t2' * t1) + t2' * t2 + t2' * t3 + t3'= +t1'+t2'*(t1+t2+t3)+t3'`; REAL_ARITH`A* &1=A`] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + +let aff_ge_1_1_subset_aff_ge_fan=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +DISJOINT {x} {v,u} /\ ~(x=v1) +/\ v1 IN aff_ge {x} {v,u} +==> +aff_ge {x} {v1} SUBSET aff_ge {x} {v,u}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`v1:real^3`][IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % (t1 % x + t2 % v + t3 % u) +=(t1'+ t2'*t1) % x + (t2'* t2) % v + (t2' * t3 ) % u:real^3`] +THEN STRIP_TAC +THEN EXISTS_TAC`t1' + t2' * t1:real` +THEN EXISTS_TAC`t2' * t2:real` +THEN EXISTS_TAC`t2' * t3 :real` +THEN MP_TAC(REAL_ARITH`&0 &0<= t2'`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t2:real`] +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t3:real`] +THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t2' * t1) + t2' * t2 + t2' * t3 = +t1'+t2'*(t1+t2+t3)`; REAL_ARITH`A* &1=A`]);; + + + +let decomposition_planar_by_angle_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3. +~ collinear {x,v,u} /\ ~collinear {x,v,w} +/\ w IN aff_ge {x,v} {u} +==> u IN aff_gt {x} {v,w} \/ w IN aff_ge {x} {v,u}`, +REPEAT STRIP_TAC +THEN MRESAL_TAC aff_ge_inter_aff_ge[`(x:real^3)`;`(v:real^3)`;`(u:real^3)`][INTER; IN_ELIM_THM] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`v:real^3`;`w:real^3`; `u:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v:real^3`;`w:real^3`; `u:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(&0 < t2) \/ &0 <= --(t2:real)`) +THENL[ +SUBGOAL_THEN `u IN aff_gt {x} {v,w:real^3}` ASSUME_TAC +THENL[ +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t3:real` +THEN MP_TAC(REAL_ARITH`&0< t3==> &0 <= t3:real`) +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC THEN SET_TAC[]]; +MRESA_TAC remove_variable_fan[`x:real^3`; `v:real^3`; `w:real^3`;`u:real^3`;`t1:real`;`t2:real`;`t3:real`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th);]) +THEN DISCH_TAC +THEN REWRITE_TAC[VECTOR_ARITH`inv t3 % u - (inv t3 * t1) % x - (inv t3 * t2) % v +=(--inv t3 * t1) % x + inv t3 % u + (inv t3 * (--t2)) % v`] +THEN MP_TAC(REAL_ARITH`&0 ~( t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t3:real` +THEN MRESA1_TAC REAL_LT_INV`t3:real` +THEN MP_TAC(REAL_ARITH`&0< inv t3==> &0 <= inv t3`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`inv t3:real`;`-- (t2:real)`] +THEN DISCH_TAC +THEN SUBGOAL_THEN `w IN aff_ge {x, u} {v:real^3}` ASSUME_TAC +THENL[ +MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`u:real^3`;`v:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`(--inv t3 * t1):real` +THEN EXISTS_TAC`inv t3:real` +THEN EXISTS_TAC`(inv t3 * --t2):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`--inv t3 * t1 + inv t3 + inv t3 * --t2= +inv t3 * (t3+ &1- (t1 +t2 + t3))`; REAL_ARITH`a + &1 - &1 =a`]; +POP_ASSUM MP_TAC THEN SET_TAC[]]]);; + + + + + + + +let properties_of_fan7=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {v1,u1} IN E /\ v IN aff_ge {x} {v1,u1} +==> v = v1 \/ v = u1`, + +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN; fan6; fan7] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`v:real^3`] +THEN STRIP_TAC + THEN POP_ASSUM (fun th-> MP_TAC(ISPECL[`{(v:real^3),(u:real^3)}`;`{(v1:real^3),(u1:real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] +THEN SUBGOAL_THEN `(v:real^3) IN aff_ge {(x:real^3)} {(v:real^3),(u:real^3)}` ASSUME_TAC +THENL(*1*)[ + MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]AFF_GE_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC `&0:real` + THEN EXISTS_TAC `&1:real` THEN EXISTS_TAC `&0:real` +THEN REWRITE_TAC[VECTOR_ARITH`w= &0 % x+ &1 % w + &0 % v `] THEN REAL_ARITH_TAC; + +DISCH_TAC +THEN MP_TAC(SET_RULE`v IN aff_ge {x} {v, u} /\ v IN aff_ge {x} {v1, u1} ==> v IN aff_ge {x} {v, u} INTER aff_ge {x:real^3} {v1, u1:real^3}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`{v, u} INTER {v1, u1:real^3}={} \/ ~({v, u} INTER {v1, u1}={})`) +THENL(*2*)[ +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`aff_ge {x:real^3} {}= {y| ?t1. t1= &1 /\ y= t1 %x}` ASSUME_TAC +THENL(*3*)[ +ASSUME_TAC(SET_RULE `DISJOINT {x:real^3} {}`) +THEN AFF_TAC; + +ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[]];(*2*) + +DISJ_CASES_TAC(SET_RULE`~(v IN {v, u} INTER {v1, u1:real^3}) \/ (v IN {v, u} INTER {v1, u1})`) +THENL(*3*)[ +SUBGOAL_THEN`({v:real^3, u} INTER {v1, u1}={u})` ASSUME_TAC +THENL(*4*)[ + ASM_TAC +THEN SET_TAC[];(*4*) + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN` aff_ge {(x:real^3)} {(u:real^3)} SUBSET aff {x,u}` ASSUME_TAC +THENL(*5*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (u:real^3)`;]AFF_GE_1_1) +THEN MP_TAC(SET_RULE`~((x:real^3) = (u:real^3))==> DISJOINT {x} {u}`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[aff;AFFINE_HULL_2] THEN ASM_TAC THEN SET_TAC[];(*5*) + +FIND_ASSUM MP_TAC`{v,u:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN DISCH_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v:real^3`;`u:real^3`] +THEN ASM_TAC +THEN SET_TAC[]]];(*3*) + +POP_ASSUM MP_TAC +THEN SET_TAC[]]]]) ;; + + + + + + +let properties1_of_fan7=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {v1,u1} IN E /\ v IN aff_ge {x} {v1} +==> v = v1`, + +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN; fan6; fan7] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u1:real^3`;`v1:real^3`] +THEN MP_TAC(SET_RULE`(v1:real^3) IN V==> (?v. v IN V /\ {v1} = {v})`) +THEN REDA_TAC +THEN STRIP_TAC + THEN POP_ASSUM (fun th-> MP_TAC(ISPECL[`{(v:real^3),(u:real^3)}`;`{(v1:real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] +THEN SUBGOAL_THEN `(v:real^3) IN aff_ge {(x:real^3)} {(v:real^3),(u:real^3)}` ASSUME_TAC +THENL(*1*)[ + MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]AFF_GE_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC `&0:real` + THEN EXISTS_TAC `&1:real` THEN EXISTS_TAC `&0:real` +THEN REWRITE_TAC[VECTOR_ARITH`w= &0 % x+ &1 % w + &0 % v `] THEN REAL_ARITH_TAC; +DISCH_TAC +THEN MP_TAC(SET_RULE`v IN aff_ge {x} {v, u:real^3} /\ v IN aff_ge {x} {v1} ==> v IN aff_ge {x} {v, u} INTER aff_ge {x:real^3} {v1}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`{v, u:real^3} INTER {v1}={} \/ ~({v, u} INTER {v1}={})`) +THENL(*2*)[ +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`aff_ge {x:real^3} {}= {y| ?t1. t1= &1 /\ y= t1 %x}` ASSUME_TAC +THENL(*3*)[ +ASSUME_TAC(SET_RULE `DISJOINT {x:real^3} {}`) +THEN AFF_TAC; +ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[]];(*2*) + +DISJ_CASES_TAC(SET_RULE`~(v IN {v, u} INTER {v1:real^3}) \/ (v IN {v, u} INTER {v1})`) +THENL(*3*)[ +SUBGOAL_THEN`({v:real^3, u} INTER {v1:real^3}={u})` ASSUME_TAC +THENL(*4*)[ + ASM_TAC +THEN SET_TAC[]; +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN` aff_ge {(x:real^3)} {(u:real^3)} SUBSET aff {x,u}` ASSUME_TAC +THENL(*5*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (u:real^3)`;]AFF_GE_1_1) +THEN MP_TAC(SET_RULE`~((x:real^3) = (u:real^3))==> DISJOINT {x} {u}`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[aff;AFFINE_HULL_2] THEN ASM_TAC THEN SET_TAC[]; +FIND_ASSUM MP_TAC`{v,u:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN DISCH_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN ASM_TAC +THEN SET_TAC[]]];(*3*) + +POP_ASSUM MP_TAC +THEN SET_TAC[]]]]) ;; + + + +let point_in_aff_ge=prove(`!(x:real^3) (v:real^3) (w:real^3). +~collinear {x,v,w} +==> +x IN aff_ge {x} {v,w} +/\ v IN aff_ge {x} {v,w} +/\ w IN aff_ge {x} {v,w}`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN MRESA_TAC th3 [`x:real^3`;`v:real^3`;`w:real^3`] + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GE_1_2) +THEN RESA_TAC + THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THENL[ EXISTS_TAC`&1:real` +THEN EXISTS_TAC`&0:real` +THEN EXISTS_TAC`&0:real` +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ EXISTS_TAC`&0:real` +THEN EXISTS_TAC`&1:real` +THEN EXISTS_TAC`&0:real` +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC; + +EXISTS_TAC`&0:real` +THEN EXISTS_TAC`&0:real` +THEN EXISTS_TAC`&1:real` +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC]]);; + + +let aff_ge_subset_aff_gt_union_aff_ge=prove(`!(x:real^3) (v:real^3) (w:real^3). +~collinear {x,v,w} +==> +aff_ge {x} {v , w} SUBSET (aff_gt {x , v} {w}) UNION (aff_ge {x} {v})`, +REPEAT STRIP_TAC THEN MRESA_TAC th3 [`x:real^3`;`v:real^3`;`w:real^3`] + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GE_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GT_2_1) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`]AFF_GE_1_1) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[SUBSET; UNION;IN_ELIM_THM] + THEN GEN_TAC THEN +REWRITE_TAC[REAL_ARITH `(&0 <= (t3:real)) <=> (&0 < t3) \/ ( t3 = &0)`; TAUT `(a \/ b) /\ (c \/ d) /\ e /\ f <=> ((a \/ b)/\ c /\ e /\ f) \/ ((a \/ b) /\ d /\ e /\ f)`; EXISTS_OR_THM] THEN +MATCH_MP_TAC MONO_OR THEN +SUBGOAL_THEN `((?t1:real t2:real t3:real. + (&0 < t2 \/ t2 = &0) /\ + &0< t3 /\ + t1 + t2 + t3 = &1 /\ + (x':real^3) = t1 % x + t2 % v + t3 % w) + ==> (?t1 t2 t3. + &0< t3 /\ t1 + t2 + t3 = &1 /\ x' = t1 % x + t2 % v + t3 % w))` ASSUME_TAC +THENL +[MESON_TAC[]; + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC MONO_EXISTS THEN GEN_TAC THEN MATCH_MP_TAC MONO_EXISTS THEN GEN_TAC THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN GEN_TAC THEN + REWRITE_TAC[REAL_ARITH `(&0< (t2:real) \/ (t2 = &0)) <=> ( &0<= t2)`] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC [REAL_ARITH `(a:real)+ &0 = a`; VECTOR_ARITH `&0 % (w:real^3) = vec 0`; + VECTOR_ARITH ` ((x':real^3) = (t1:real) % (x:real^3) + (t2:real) % (v:real^3) + vec 0)<=> ( x' = t1 % x + t2 % v )` ] + THEN MESON_TAC[]]);; + +let pos_in_aff_ge_fan=prove(`!x:real^3 v:real^3 u:real^3 a:real. +DISJOINT {x} {v,u} +/\ &0 +(&1-a)%v + a % u IN aff_ge {x} {v,u:real^3}`, + +REPEAT STRIP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1 -a:real` +THEN EXISTS_TAC`a:real` +THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 <= &1 - a /\ &0 <= a`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC);; + + + +let aff_gt1_subset_aff_gt=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +DISJOINT {x} {v,u} /\ ~collinear {x,v1,u} +/\ v1 IN aff_gt {x} {v,u} +==> +aff_gt {x} {v1,u} SUBSET aff_gt {x} {v,u}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v1:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v1:real^3`;`u:real^3`][IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % (t1 % x + t2 % v + t3 % u) + t3' % u +=(t1'+ t2'*t1) % x + (t2'* t2) % v + (t2' * t3 + t3') % u:real^3`] +THEN STRIP_TAC +THEN EXISTS_TAC`t1' + t2' * t1:real` +THEN EXISTS_TAC`t2' * t2:real` +THEN EXISTS_TAC`t2' * t3 +t3':real` +THEN MP_TAC(REAL_ARITH`&0 &0<= t2'`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`t2':real`;`t2:real`] +THEN MRESA_TAC REAL_LT_MUL[`t2':real`;`t3:real`] +THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t2' * t1) + t2' * t2 + t2' * t3 + t3'= +t1'+t2'*(t1+t2+t3)+t3'`; REAL_ARITH`A* &1=A`] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + + + + +let not_cut_inside_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) + +/\ (!h:real. &0 aff_gt{x} {v,(&1-h)%u+ h % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={}) +==> aff_gt{x} {v,(&1-a)%u+ a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MP_TAC (th) THEN ASSUME_TAC(th)) +THEN REWRITE_TAC[fan80] +THEN DISCH_THEN(LABEL_TAC"BE") +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN REWRITE_TAC[INTER;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL(*1*)[ +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN DISCH_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[(th)]) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN DISCH_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN REMOVE_THEN "BE" (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"BE") ) +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w':real^3)`; +` (v':real^3)`] +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v':real^3`;`w':real^3`][IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "VUT1") +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-a)%u +a%w:real^3`][IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "VUT") +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "VUT1") +THEN DISCH_TAC THEN DISCH_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(t3'= &0) \/ ~(t3':real= &0)`) +THENL(*2*)[ +ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(t2'= &0) \/ ~(t2':real= &0)`) +THENL(*3*)[ +ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(t3:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM (fun th-> REWRITE_TAC[SYM(th)])`t1 + t2 + t3 = &1:real` +THEN REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % (((t1 + t2 + t3) - a) % u + a % w) = + (t1 + t2 + t3) % x<=>(t3) % (((t1 + t2 + t3) - a) % u + a % w- x)=(-- t2) % (v-x) `] +THEN ASM_REWRITE_TAC[IN;EMPTY] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +(t3) % ((&1 - a) % u + a % w- x)=(-- t2) % (v-x) +==> (inv (t3))%((t3) % ((&1 - a) % u + a % w- x) ) = (inv (t3))%((-- t2) % (v-x)):real^3`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[VECTOR_ARITH`E+A-B=C%(D-B)<=>E+A=(&1-C)%B+C%D`;] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC `~((&1 - a) % u + a % w IN aff {x, v:real^3})` +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`&1-(inv t3 * (--t2)):real` +THEN EXISTS_TAC`(inv t3 * (--t2)):real` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*3*) + +FIND_ASSUM MP_TAC`t1 + t2 + t3 = &1:real` +THEN REWRITE_TAC[REAL_ARITH`t1 + t2 + t3 = &1<=> t1= &1 -t2 -t3`; REAL_ARITH`A+B= &1<=> A= &1-B`] +THEN DISCH_THEN(LABEL_TAC"MAI") +THEN DISCH_THEN (LABEL_TAC"YEU EM") +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w) = + (&1 - t2') % x + t2' % v'<=> t2' % v'=(t2' - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w):real^3 `] +THEN MP_TAC(ISPEC`(t2':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2' % v'=(t2' - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w):real^3 +==> (inv (t2'))%(t2' % v' ) = (inv (t2'))%((t2' - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w):real^3) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C+D)=(A%B+A%C+A%D)`;REAL_ARITH`a*(b-c-d)=a*b-a*c-a*d`] +THEN REDUCE_VECTOR_TAC +THEN DISCH_TAC +THEN SUBGOAL_THEN `~coplanar{x:real^3,v':real^3,v:real^3,u:real^3}` ASSUME_TAC +THENL(*4*)[ + +POP_ASSUM MP_TAC +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, v', v, u}= {(--x) +x, (--x) +v', (--x) +v, (--x) +u}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3,v':real^3,v:real^3,u:real^3}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`]) +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th;VECTOR_ARITH`((&1 - inv t2' * t2 - inv t2' * t3) % x + + (inv t2' * t2) % v + + (inv t2' * t3) % ((&1 - a) % u + a % w)) - + x=(inv t2' * t2) % (v-x) + + (inv t2' * t3) % ((&1 - a) % u + a % w-x)`]) +THEN MP_TAC(REAL_ARITH`&0< t2 /\ &0< t3 /\ t1+t2+t3= &1==> &0 < &1- t1 /\ ~(&1- t1 = &0)/\ t2+t3= &1- t1`) +THEN REMOVE_THEN"MAI" MP_TAC +THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`&1- (t1:real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`&1- (t1:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2 + t3 = &1 - t1:real +==> (inv ( &1 - t1))*(t2 + t3) = (inv ( &1 - t1))*( &1 - t1:real) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> A*B = &1 -A*C`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH` ~(t2' = &0) /\ &0 <= t2'==> &0 ~(a = &0) `) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`t2':real`;`inv (&1- t1):real`] +THEN MRESA_TAC REAL_LT_MUL[`inv (&1- t1):real`;`t3:real`;] +THEN MP_TAC(REAL_ARITH`&0< (inv (&1- t1)) * t3 ==> ~( (inv(&1- t1)) * t3= &0)`) +THEN MP_TAC(REAL_ARITH`&0< (t2') * inv (&1- t1) ==> ~((t2')* inv(&1- t1)= &0)`) +THEN RESA_TAC +THEN ASSUME_TAC(REAL_ARITH`~(&1 = &0)`) +THEN MRESA_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`(t2')* inv(&1- t1)`;`u - x:real^3`; `v - x:real^3`; `(inv t2' * t2) % (v - x) +(inv t2' * t3) % ((&1 - a) % u + a % w - x):real^3`] +THEN POP_ASSUM (fun th -> ONCE_REWRITE_TAC[SYM(th);]) +THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B+E%(C+D))=A%B+(A*E)%(C+D)`; +VECTOR_ARITH`A%B%C=(A*B)%C`; REAL_ARITH`(t2' * inv (&1 - t1)) * inv t2' * t2= (inv (t2')* t2' ) * inv (&1-t1) * t2`] +THEN REDUCE_ARITH_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN DISCH_TAC +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, (&1 - a) % u + a % w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] ) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN DISCH_TAC +THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` ((&1 - a) % u + a % w)-x:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(inv(&1- t1)) * t3:real`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH` +(&1 - inv (&1 - t1) * t3) % (v - x) + + (inv (&1 - t1) * t3) % (((&1 - a) % u + a % w) - x)= +(&1 - inv (&1 - t1) * t3) % (v - x) + + (inv (&1 - t1) * t3) % ((&1 - a) % u + a % w - x)`];(*4*) + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"DICH") +THEN DISCH_TAC +THEN ABBREV_TAC `va=((&1 - a) % u + a % w):real^3` +THEN MP_TAC(REAL_ARITH` ~(t2' = &0) /\ &0 <= t2'==> &0 ~(a = &0) `) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`t2':real` +THEN MRESA_TAC REAL_LT_MUL[`inv (t2'):real`;`t2:real`;] +THEN MRESA_TAC REAL_LT_MUL[`inv (t2'):real`;`t3:real`;] +THEN SUBGOAL_THEN `(v':real^3) IN aff_gt {x} {v,va:real^3}` ASSUME_TAC +THENL(*5*)[ + +ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`(&1 - inv t2' * t2 - inv t2' * t3:real)` +THEN EXISTS_TAC`inv t2' * t2:real` +THEN EXISTS_TAC`(inv t2' * t3:real)` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*5*) + +REMOVE_THEN "DICH" MP_TAC +THEN REMOVE_THEN "VUT" MP_TAC +THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `v':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN MRESA_TAC exists_element_in_half_sapace_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;` v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; +` (v':real^3)`] +THEN MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v':real^3`;`u':real^3`] +THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC +THEN REWRITE_TAC[EMPTY;IN] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0 &0< &1-t:real /\ &1-t< &1`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] +THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] +THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v':real^3`;`u':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`{v',u'} IN (E:(real^3->bool)->bool)` +THEN SET_TAC[]](*5*)](*4*)](*3*);(*2*) + + + +DISJ_CASES_TAC(REAL_ARITH`(t2'= &0) \/ ~(t2':real= &0)`) +THENL(*3*)[ + +FIND_ASSUM MP_TAC`t1 + t2 + t3 = &1:real` +THEN REWRITE_TAC[REAL_ARITH`t1 + t2 + t3 = &1<=> t1= &1 -t2 -t3`; REAL_ARITH`A+B= &1<=> A= &1-B`] +THEN DISCH_THEN(LABEL_TAC"MAI") +THEN DISCH_THEN (LABEL_TAC"YEU EM") +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w) = + (&1 - &0 - t3') % x + &0% v'+t3' % w'<=> t3' % w'=(t3' - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w):real^3 `] +THEN MP_TAC(ISPEC`(t3':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3' % w'=(t3' - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w):real^3 +==> (inv (t3'))%(t3' % w' ) = (inv (t3'))%((t3' - t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w):real^3) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C+D)=(A%B+A%C+A%D)`;REAL_ARITH`a*(b-c-d)=a*b-a*c-a*d`] +THEN REDUCE_VECTOR_TAC +THEN DISCH_TAC +THEN SUBGOAL_THEN `~coplanar{x:real^3,w':real^3,v:real^3,u:real^3}` ASSUME_TAC +THENL(*4*)[ + + POP_ASSUM MP_TAC +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, w', v, u}= {(--x) +x, (--x) +w', (--x) +v, (--x) +u}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3,w':real^3,v:real^3,u:real^3}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`]) +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th;VECTOR_ARITH`((&1 - inv t2' * t2 - inv t2' * t3) % x + + (inv t2' * t2) % v + + (inv t2' * t3) % ((&1 - a) % u + a % w)) - + x=(inv t2' * t2) % (v-x) + + (inv t2' * t3) % ((&1 - a) % u + a % w-x)`]) +THEN MP_TAC(REAL_ARITH`&0< t2 /\ &0< t3 /\ t1+t2+t3= &1==> &0 < &1- t1 /\ ~(&1- t1 = &0)/\ t2+t3= &1- t1`) +THEN REMOVE_THEN"MAI" MP_TAC +THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`&1- (t1:real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`&1- (t1:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2 + t3 = &1 - t1:real +==> (inv ( &1 - t1))*(t2 + t3) = (inv ( &1 - t1))*( &1 - t1:real) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> A*B = &1 -A*C`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH` ~(t3' = &0) /\ &0 <= t3'==> &0 ~(a = &0) `) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`t3':real`;`inv (&1- t1):real`] +THEN MRESA_TAC REAL_LT_MUL[`inv (&1- t1):real`;`t3:real`;] +THEN MP_TAC(REAL_ARITH`&0< (inv (&1- t1)) * t3 ==> ~( (inv(&1- t1)) * t3= &0)`) +THEN MP_TAC(REAL_ARITH`&0< (t3') * inv (&1- t1) ==> ~((t3')* inv(&1- t1)= &0)`) +THEN RESA_TAC +THEN ASSUME_TAC(REAL_ARITH`~(&1 = &0)`) +THEN MRESA_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`(t3')* inv(&1- t1)`;`u - x:real^3`; `v - x:real^3`; `(inv t3' * t2) % (v - x) +(inv t3' * t3) % ((&1 - a) % u + a % w - x):real^3`] +THEN POP_ASSUM (fun th -> ONCE_REWRITE_TAC[SYM(th);]) +THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B+E%(C+D))=A%B+(A*E)%(C+D)`; +VECTOR_ARITH`A%B%C=(A*B)%C`; REAL_ARITH`(t2' * inv (&1 - t1)) * inv t2' * t2= (inv (t2')* t2' ) * inv (&1-t1) * t2`] +THEN REDUCE_ARITH_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN DISCH_TAC +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, (&1 - a) % u + a % w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] ) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN DISCH_TAC +THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` ((&1 - a) % u + a % w)-x:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(inv(&1- t1)) * t3:real`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH` +(&1 - inv (&1 - t1) * t3) % (v - x) + + (inv (&1 - t1) * t3) % (((&1 - a) % u + a % w) - x)= +(&1 - inv (&1 - t1) * t3) % (v - x) + + (inv (&1 - t1) * t3) % ((&1 - a) % u + a % w - x)`];(*4*) + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"DICH") +THEN DISCH_TAC +THEN ABBREV_TAC `va=((&1 - a) % u + a % w):real^3` +THEN MP_TAC(REAL_ARITH` ~(t3' = &0) /\ &0 <= t3'==> &0 ~(a = &0) `) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`t3':real` +THEN MRESA_TAC REAL_LT_MUL[`inv (t3'):real`;`t2:real`;] +THEN MRESA_TAC REAL_LT_MUL[`inv (t3'):real`;`t3:real`;] +THEN SUBGOAL_THEN `(w':real^3) IN aff_gt {x} {v,va:real^3}` ASSUME_TAC +THENL[(*5*) + +ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`(&1 - inv t3' * t2 - inv t3' * t3:real)` +THEN EXISTS_TAC`inv t3' * t2:real` +THEN EXISTS_TAC`(inv t3' * t3:real)` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*5*) + +REMOVE_THEN "DICH" MP_TAC +THEN REMOVE_THEN "VUT" MP_TAC +THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC +THEN FIND_ASSUM MP_TAC`{v',w':real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN DISCH_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v':real^3)`; +` (w':real^3)`] +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `w':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN MRESA_TAC exists_element_in_half_sapace_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w':real^3`;` v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; +` (w':real^3)`] +THEN MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`w':real^3`;`u':real^3`] +THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC +THEN REWRITE_TAC[EMPTY;IN] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0 &0< &1-t:real /\ &1-t< &1`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] +THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] +THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`w':real^3`;`u':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`{w',u'} IN (E:(real^3->bool)->bool)` +THEN SET_TAC[]](*5*)](*4*);(*3*) + + +ASM_REWRITE_TAC[] +THEN DISCH_TAC THEN DISCH_THEN(LABEL_TAC"BO") +THEN ABBREV_TAC `va=((&1 - a) % u + a % w):real^3` +THEN MP_TAC(REAL_ARITH` ~(t3' = &0) /\ &0 <= t3'==> &0 &0 ~(a = &0) `) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`t2':real` +THEN MRESA1_TAC REAL_MUL_LINV`t2':real` +THEN MRESA_TAC REAL_LT_MUL[`inv (t2'):real`;`t2:real`;] +THEN MRESA_TAC REAL_LT_MUL[`inv (t2'):real`;`t3:real`;] +THEN MRESA1_TAC REAL_LT_INV`t3':real` +THEN MRESA1_TAC REAL_MUL_LINV`t3':real` +THEN MRESA_TAC REAL_LT_MUL[`inv (t3'):real`;`t2:real`;] +THEN MRESA_TAC REAL_LT_MUL[`inv (t3'):real`;`t3:real`;] +THEN SUBGOAL_THEN`(x':real^3) IN aff_gt {x} {v',w'}` ASSUME_TAC +THENL(*4*)[ + +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v':real^3`;`w':real^3`][IN_ELIM_THM] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`t1':real` +THEN EXISTS_TAC`t2':real` +THEN EXISTS_TAC`t3':real` +THEN ASM_REWRITE_TAC[];(*4*) + +SUBGOAL_THEN`(x':real^3) IN aff_ge {x} {v',w'}` ASSUME_TAC +THENL(*5*)[ + +ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`t1':real` +THEN EXISTS_TAC`t2':real` +THEN EXISTS_TAC`t3':real` +THEN ASM_REWRITE_TAC[];(*5*) + +SUBGOAL_THEN `(x':real^3) IN aff_gt {x} {v,va:real^3}` ASSUME_TAC +THENL(*6*)[ + +ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t3:real` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*6*) + +SUBGOAL_THEN `(x':real^3) IN aff_ge {x} {v,va:real^3}` ASSUME_TAC +THENL(*7*)[ + +MRESA_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`va:real^3`] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t3:real` +THEN MP_TAC(REAL_ARITH`&0< t2==> &0 <= t2`) THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0< t3==> &0 <= t3`) THEN RESA_TAC +THEN ASM_REWRITE_TAC[];(*7*) + +FIND_ASSUM MP_TAC`{v',w':real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN DISCH_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v':real^3)`; +` (w':real^3)`] +THEN SUBGOAL_THEN `~collinear {x, x', w':real^3}` ASSUME_TAC +THENL(*8*)[ + +ASM_REWRITE_TAC[collinear1_fan;] +THEN FIND_ASSUM MP_TAC `~((v':real^3) IN aff{x,w'})` +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % v' + t3' % w' = u' % x + v'' % w' +<=> t2' % v' = (u'-t1') % x + (v''-t3') % w'`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2' % v' = (u'-t1') % x + (v''-t3') % w':real^3 +==> (inv ( t2'))%(t2' % v') = (inv (t2'))%((u'-t1') % x + (v''-t3') % w') +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC `(inv t2' * (u' - t1':real))` +THEN EXISTS_TAC `(inv t2' * (v'' - t3':real))` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t2' * (u' - t1') + inv t2' * (v'' - t3')=inv t2'* (t2'+ (u'+v'') - (t1'+t2'+t3'))`;REAL_ARITH`t2'+ &1 - &1=t2'`];(*8*) + + + + +SUBGOAL_THEN `~collinear {x, x', v':real^3}` ASSUME_TAC +THENL(*9*)[ +ASM_REWRITE_TAC[collinear1_fan;] +THEN FIND_ASSUM MP_TAC `~((w':real^3) IN aff{x,v'})` +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % v' + t3' % w' = u' % x + v'' % v' +<=> t3' % w' = (u'-t1') % x + (v''-t2') % v'`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3' % w' = (u'-t1') % x + (v''-t2') % v':real^3 +==> (inv ( t3'))%(t3' % w') = (inv (t3'))%((u'-t1') % x + (v''-t2') % v') +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC `(inv t3' * (u' - t1':real))` +THEN EXISTS_TAC `(inv t3' * (v'' - t2':real))` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t3' * (u' - t1') + inv t3' * (v'' - t2')=inv t3'* (t3'+ (u'+v'') - (t1'+t2'+t3'))`;REAL_ARITH`t3'+ &1 - &1=t3'`];(*9*) + + + + +SUBGOAL_THEN`~collinear {x, x', va:real^3}` ASSUME_TAC +THENL(*10*)[ +REMOVE_THEN "BO" MP_TAC +THEN DISCH_TAC THEN REMOVE_ASSUM_TAC +THEN ASM_REWRITE_TAC[collinear1_fan;] +THEN FIND_ASSUM MP_TAC`~(va IN aff {x, v:real^3})` +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % (va) = + u' % x + v' % (va)<=> +(&1-(t1+t2+t3)) % x + (v'-t3) % (va-x) = + (&1-(u'+v') ) % x + t2 % (v-x)`;REAL_ARITH`a-a= &0`] +THEN REDUCE_VECTOR_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(v'' - t3 = &0) \/ ~(v'' - (t3:real)= &0)`) +THENL(*11*)[ + +ASM_REWRITE_TAC[VECTOR_ARITH`&0 %A=B<=> B= vec 0`;VECTOR_MUL_EQ_0] +THEN MP_TAC(REAL_ARITH`&0< t2==> ~(t2 = &0)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-B= vec 0<=> A=B`];(*11*) + +MRESA1_TAC REAL_MUL_LINV `(v''-t3:real)` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(v'' - t3) % (va- x) = t2 % (v - x:real^3) ==> (inv (v'' -t3)) % ((v'' - t3) % (va - x)) = (inv (v'' -t3)) % ( t2 % (v - x))`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C:real^3)`]) +THEN REWRITE_TAC[VECTOR_ARITH`&1 % (va - x) = (inv (v' - t3) * t2) % (v - x)<=> +va = (&1-(inv (v' - t3) * t2))%x +(inv (v' - t3) * t2) % v:real^3`] +THEN STRIP_TAC +THEN EXISTS_TAC`&1-(inv (v'' - t3) * (t2:real))` +THEN EXISTS_TAC`(inv (v'' - t3) * (t2:real))` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC](*11*);(*10*) + + +SUBGOAL_THEN `~collinear {x, x', v:real^3}` ASSUME_TAC +THENL(*11*)[ +REMOVE_THEN "BO" MP_TAC +THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC +THEN ASM_REWRITE_TAC[collinear1_fan] +THEN FIND_ASSUM MP_TAC `~(va IN aff {x, v:real^3})` +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % v' + t3' % w' = u' % x + v'' % v' +<=> t3' % w' = (u'-t1') % x + (v''-t2') % v'`] +THEN MP_TAC(REAL_ARITH`&0< t3 ==> ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t3:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3 % va = (u'-t1) % x + (v''-t2) % v:real^3 +==> (inv ( t3))%(t3 % va) = (inv (t3))%((u'-t1) % x + (v''-t2) % v) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC `(inv t3 * (u' - t1:real))` +THEN EXISTS_TAC `(inv t3 * (v'' - t2:real))` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t3' * (u' - t1') + inv t3' * (v'' - t2')=inv t3'* (t3'+ (u'+v'') - (t1'+t2'+t3'))`;REAL_ARITH`t3'+ &1 - &1=t3'`];(*11*) + +ABBREV_TAC`an=t1' % x + t2' % v' + t3' % w':real^3` +THEN REMOVE_THEN "VUT1" MP_TAC +THEN REMOVE_THEN "VUT1" MP_TAC +THEN REMOVE_THEN "BO" MP_TAC +THEN REMOVE_THEN "VUT" MP_TAC +THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN DISJ_CASES_TAC(SET_RULE`(&0 < azim x (x':real^3) v w' /\ + azim x (x') v w' < pi)\/ ~(&0 < azim x (x') v w' /\ + azim x (x') v w' < pi)`) + +THENL(*12*)[ + +MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`x':real^3`;`w':real^3`] +THEN REWRITE_TAC[EMPTY;IN] +THEN MP_TAC(REAL_ARITH`&0 &0< &1-t:real /\ &1-t< &1`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] +THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] +THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) +THEN MRESA_TAC aff_gt1_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`{v',w'} IN (E:(real^3->bool)->bool)` +THEN SET_TAC[];(*12*) + +ASSUME_TAC(ISPECL[`x:real^3`;`v':real^3`;`w':real^3`;`x':real^3`]azim) +THEN ASSUME_TAC(PI_WORKS) +THEN MP_TAC(REAL_ARITH`~(&0 < azim x x' v w' /\ azim x x' v w' < pi)/\ +&0 <= azim x x' v w' /\ &0< pi==> pi< azim x x' v w' \/(azim x x' v w'= &0 \/ azim x x' v w'=pi) `) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*13*)(*3SUBGOAL*)[ + +POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3 `;`x':real^3`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN DISCH_TAC +THEN MP_TAC(REAL_ARITH`azim x x' v' w' < azim x x' v w'==>azim x x' v' w' <= azim x x' v w'`) +THEN RESA_TAC +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3 `;`x':real^3`] +THEN DISCH_TAC THEN DISCH_TAC +THEN MP_TAC(REAL_ARITH`pi < azim x x' v w' /\ azim x x' v w' = azim x x' v v' + pi +/\ azim x x' v w' < &2 * pi==> &0 bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`x':real^3`;`v':real^3`] +THEN REWRITE_TAC[EMPTY;IN] +THEN MP_TAC(REAL_ARITH`&0 &0< &1-t:real /\ &1-t< &1`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] +THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] +THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) +THEN SUBGOAL_THEN ` aff_ge {x} {w', v':real^3}=aff_ge {x} {v', w'}` ASSUME_TAC +THENL(*14*)[ +REWRITE_TAC[SET_RULE`{A,B}={B,A}`];(*14*) + +MRESA_TAC aff_gt1_subset_aff_ge[`x:real^3`;`w':real^3`;`v':real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`{v',w'} IN (E:(real^3->bool)->bool)` +THEN SET_TAC[]](*14*);(*13*) + +MRESA_TAC AZIM_EQ_0[`x:real^3`;`x':real^3`;`v:real^3`;`w':real^3`] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`x':real^3`;`v:real^3`;`w':real^3`] +THEN MRESA_TAC AZIM_EQ_0[`x:real^3`;`x':real^3`;`w':real^3`;`v:real^3`] +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`w':real^3`;`v:real^3`] +THEN DISJ_CASES_TAC(SET_RULE`w' IN aff_gt {x} {v,va:real^3}\/ ~(w' IN aff_gt {x} {v,va:real^3})`) +THENL(*14*)[ +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-a)%u +a%w:real^3`][IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"DICH CHUYEN") +THEN DISCH_TAC +THEN REMOVE_THEN "DICH CHUYEN"(fun th->MP_TAC(th) THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN REMOVE_ASSUM_TAC + THEN ASSUME_TAC(th)) +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`w' = t1'' % x + t2'' % v + t3'' % va<=> + ((t1''+t2''+t3'')- &1) % x + t2'' % (v-x) + t3'' % (va-x)= w' -x:real^3`;REAL_ARITH`&1- &1 = &0`] +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(REAL_ARITH`&0< t2'' /\ &0< t3'' /\ t1''+t2''+t3''= &1==> &0 < &1- t1'' /\ ~(&1- t1'' = &0)/\ t2''+t3''= &1- t1''`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2'' + t3'' = &1 - t1'':real +==> (inv ( &1 - t1''))*(t2'' + t3'') = (inv ( &1 - t1''))*( &1 - t1'':real) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1- A*C = A*B`] +THEN STRIP_TAC +THEN MRESA_TAC REAL_LT_MUL[`inv(&1- t1'':real)`;`t3'':real`] +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)*(t3'':real)= &0)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)= &0)`) +THEN RESA_TAC +THEN ASSUME_TAC(REAL_ARITH`~(&1= &0)`) +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, (&1 - a) % u + a % w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] ) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN DISCH_TAC +THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` ((&1 - a) % u + a % w)-x:real^3`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(inv(&1- t1'')) * t3'':real`[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`inv(&1- t1'')`;`u - x:real^3`; `v - x:real^3`; `w'-x:real^3`] +[VECTOR_ARITH`&1 %A=A`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v,w'}= {(--x) +x, (--x) +u, (--x) +v, (--x) + w'}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w'}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN DISCH_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `w':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN MRESA_TAC exists_element_in_half_sapace_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w':real^3`;` v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; +` (w':real^3)`] +THEN MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`w':real^3`;`u':real^3`] +THEN REWRITE_TAC[EMPTY;IN] +THEN MP_TAC(REAL_ARITH`&0 &0< &1-t:real /\ &1-t< &1`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] +THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] +THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`w':real^3`;`u':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`{w',u'} IN (E:(real^3->bool)->bool)` +THEN SET_TAC[];(*14*) + +DISJ_CASES_TAC(SET_RULE`v' IN aff_gt {x} {v,va:real^3}\/ ~(v' IN aff_gt {x} {v,va:real^3})`) +THENL(*15*)[ + +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-a)%u +a%w:real^3`][IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"DICH CHUYEN") +THEN DISCH_TAC +THEN REMOVE_THEN "DICH CHUYEN"(fun th->MP_TAC(th) THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN REMOVE_ASSUM_TAC + THEN ASSUME_TAC(th)) +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`v' = t1'' % x + t2'' % v + t3'' % va<=> + ((t1''+t2''+t3'')- &1) % x + t2'' % (v-x) + t3'' % (va-x)= v' -x:real^3`;REAL_ARITH`&1- &1 = &0`] +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(REAL_ARITH`&0< t2'' /\ &0< t3'' /\ t1''+t2''+t3''= &1==> &0 < &1- t1'' /\ ~(&1- t1'' = &0)/\ t2''+t3''= &1- t1''`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2'' + t3'' = &1 - t1'':real +==> (inv ( &1 - t1''))*(t2'' + t3'') = (inv ( &1 - t1''))*( &1 - t1'':real) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1- A*C = A*B`] +THEN STRIP_TAC +THEN MRESA_TAC REAL_LT_MUL[`inv(&1- t1'':real)`;`t3'':real`] +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)*(t3'':real)= &0)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)= &0)`) +THEN RESA_TAC +THEN ASSUME_TAC(REAL_ARITH`~(&1= &0)`) +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, (&1 - a) % u + a % w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] ) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN DISCH_TAC +THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` ((&1 - a) % u + a % w)-x:real^3`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(inv(&1- t1'')) * t3'':real`[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`inv(&1- t1'')`;`u - x:real^3`; `v - x:real^3`; `v'-x:real^3`] +[VECTOR_ARITH`&1 %A=A`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v,v'}= {(--x) +x, (--x) +u, (--x) +v, (--x) + v'}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, v'}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN DISCH_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `v':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN MRESA_TAC exists_element_in_half_sapace_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;` v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; +` (v':real^3)`] +THEN MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v':real^3`;`u':real^3`] +THEN REWRITE_TAC[EMPTY;IN] +THEN MP_TAC(REAL_ARITH`&0 &0< &1-t:real /\ &1-t< &1`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] +THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] +THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v':real^3`;`u':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`{v',u'} IN (E:(real^3->bool)->bool)` +THEN SET_TAC[];(*15*) + +SUBGOAL_THEN`~(w' IN aff_gt {x} { x',v:real^3})` ASSUME_TAC +THENL(*16*)[ +REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC aff_gt3_subset_aff_gt[`x:real^3`;`v:real^3`;`va:real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*16*) + +MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`v:real^3`;`w':real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*17*)[ +MRESA_TAC aff_gt1_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3`;`x':real^3`] +THEN MP_TAC(SET_RULE`v IN aff_gt {x} {x', w':real^3} /\ aff_gt {x} {x', w'} SUBSET aff_ge {x} {v', w'} +==>v IN aff_ge {x} {v', w':real^3}`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v:real^3`; `u:real^3`; `v':real^3`;`w':real^3`]properties_of_fan7) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*18*)[ +MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`; `w':real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)]) +THEN MP_TAC(PI_WORKS) +THEN REAL_ARITH_TAC;(*18*) + +MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`; `w':real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)]) +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_PI_SYM [`x:real^3`;`x':real^3`; `v':real^3`;`v:real^3`] +THEN ASSUME_TAC(REAL_ARITH`pi <= pi`) +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`va:real^3`;`v':real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A=A+B <=> B= &0`] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`va:real^3`;`v':real^3`] +THEN MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`v':real^3`;`va:real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*19*)[ +MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] +THEN ASM_TAC THEN SET_TAC[];(*19*) + +MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`w':real^3`; `v':real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC THEN STRIP_TAC +THEN MP_TAC(SET_RULE`va IN aff_ge {x} {v', x':real^3} /\ aff_ge {x} {v', x'} SUBSET aff_ge {x} {v', w'} +==>va IN aff_ge {x} {v', w':real^3}`) +THEN RESA_TAC +THEN SUBGOAL_THEN `va IN aff_ge {x} {u,w:real^3}` ASSUME_TAC +THENL(*20*)[ + +MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1 -a:real` +THEN EXISTS_TAC`a:real` +THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 <= &1 - a /\ &0 <= a`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC;(*20*) + + +MP_TAC(SET_RULE`va IN aff_ge {x} {v', w':real^3} /\ va IN aff_ge {x} {u, w} +==>va IN aff_ge {x} {u, w} INTER aff_ge {x} {v', w':real^3} `) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPECL[`{(u:real^3),(w:real^3)}`;`{(v':real^3),(w':real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] +THEN DISCH_TAC THEN ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(SET_RULE`{u, w} INTER {v', w'}={u,w:real^3}\/ ~({u, w} INTER {v', w'}={u,w:real^3})`) +THENL(*21*)[ + +DISCH_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN MP_TAC(SET_RULE`{u, w} INTER {v', w'}={u,w:real^3}/\ ~(w=u) /\ ~(v'=w') ==> {v', w'}={u,w} `) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC `v IN aff_ge {x} {v', w':real^3}` +THEN POP_ASSUM(fun th->REWRITE_TAC[th]) +THEN MRESAL_TAC aff_ge_inter_aff_ge[`x:real^3`;`u:real^3`;`w:real^3`][INTER;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*21*) + + +MP_TAC(SET_RULE`~({u, w} INTER {v', w'} = {u, w:real^3}) ==> {u, w} INTER {v', w'} PSUBSET {u, w} `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{u, w} INTER {v', w'} PSUBSET {u, w:real^3} ==> {u, w} INTER {v', w'} SUBSET {u}\/ {u, w} INTER {v', w'} SUBSET {w} `) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*22*)[ + +MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v', w':real^3}`; `{u:real^3}`][DISJOINT;SET_RULE`{x} INTER {u} = {}<=> ~(x=u:real^3)`] +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{u:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] +THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v', w'}) SUBSET aff_ge {x} {u}/\ aff_ge {x} {u} SUBSET aff {x, u}/\ va IN aff_ge {x} ({u, w} INTER {v', w'})==> va IN aff {x,u}`) +THEN RESA_TAC +THEN REWRITE_TAC[IN;EMPTY] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % u +<=> a % w = u' % x + (v''+a- &1) % u`] +THEN MRESA1_TAC REAL_MUL_LINV`a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`a % w = u' % x + (v'' + a - &1) % u:real^3 ==> (inv (a))%(a % w ) = (inv (a))%( u' % x + (v'' + a - &1) % u)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`(inv a * u'):real` +THEN EXISTS_TAC`(inv a * (v'' + a - &1)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv a * u' + inv a * (v'' + a - &1) =inv a * ( a+ (u' + v'') - &1)`;REAL_ARITH`A+ &1- &1=A`];(*22*) + +STRIP_TAC +THEN FIND_ASSUM MP_TAC`{u,w:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`w:real^3`] +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v', w':real^3}`; `{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {w} = {}<=> ~(x=w:real^3)`] +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{w:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] +THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v', w'}) SUBSET aff_ge {x} {w}/\ aff_ge {x} {w} SUBSET aff {x, w}/\ va IN aff_ge {x} ({u, w} INTER {v', w'})==> va IN aff {x,w}`) +THEN RESA_TAC +THEN REWRITE_TAC[IN;EMPTY] +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `~(u IN aff {x, w:real^3})` +THEN REWRITE_TAC[] +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % w +<=> (&1-a )% u = u' % x + (v''-a) % w`] +THEN MP_TAC(REAL_ARITH`a< &1==> ~(&1-a= &0)` )THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`&1-a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(&1-a )% u = u' % x + (v''-a) % w:real^3 ==> (inv (&1-a))%((&1-a )% u ) = (inv (&1-a))%( u' % x + (v''-a) % w)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`(inv (&1-a) * u'):real` +THEN EXISTS_TAC`(inv (&1-a) * (v'' - a)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1 - a) * u' + inv (&1 - a) * (v'' - a)=inv (&1 - a) * ((u' + v'') - a)`]](*22*)](*21*)](*20*)](*19*)](*18*);(*17*) + + + + +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN DISCH_TAC +THEN MRESA_TAC aff_ge_subset_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;`(x':real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MP_TAC(SET_RULE`aff_ge {x} {v, x':real^3} SUBSET aff_gt {x, v} {x'} UNION aff_ge {x} {v} /\ w' IN aff_ge {x} {v, x'} ==> w' IN aff_gt {x, v} {x'} UNION aff_ge {x} {v}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(x':real^3)`;`(v:real^3)`] +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;UNION] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `w':real^3`; `v':real^3`; `v:real^3`;`u:real^3`]properties1_of_fan7) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(SYM(th))) +THEN DISCH_TAC +THEN MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v':real^3)`;`(w':real^3)`] +THEN SUBGOAL_THEN`v IN aff_ge {x} {v', w':real^3}`ASSUME_TAC +THENL(*18*)[ +POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[];(*18*) +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"NHAT") +THEN DISCH_TAC +THEN REMOVE_THEN "NHAT" MP_TAC +THEN DISCH_TAC +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`; `w':real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)]) +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_PI_SYM [`x:real^3`;`x':real^3`; `v':real^3`;`v:real^3`] +THEN ASSUME_TAC(REAL_ARITH`pi <= pi`) +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`va:real^3`;`v':real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A=A+B <=> B= &0`] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`va:real^3`;`v':real^3`] +THEN MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`v':real^3`;`va:real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*19*)[ + +MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] +THEN ASM_TAC THEN SET_TAC[];(*19*) + +MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`w':real^3`; `v':real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC THEN STRIP_TAC +THEN MP_TAC(SET_RULE`va IN aff_ge {x} {v', x':real^3} /\ aff_ge {x} {v', x'} SUBSET aff_ge {x} {v', w'} +==>va IN aff_ge {x} {v', w':real^3}`) +THEN RESA_TAC +THEN SUBGOAL_THEN `va IN aff_ge {x} {u,w:real^3}` ASSUME_TAC +THENL(*20*)[ + +MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1 -a:real` +THEN EXISTS_TAC`a:real` +THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 <= &1 - a /\ &0 <= a`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC;(*20*) + +MP_TAC(SET_RULE`va IN aff_ge {x} {v', w':real^3} /\ va IN aff_ge {x} {u, w} +==>va IN aff_ge {x} {u, w} INTER aff_ge {x} {v', w':real^3} `) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPECL[`{(u:real^3),(w:real^3)}`;`{(v':real^3),(w':real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] +THEN DISCH_TAC THEN ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(SET_RULE`{u, w} INTER {v', w'}={u,w:real^3}\/ ~({u, w} INTER {v', w'}={u,w:real^3})`) +THENL(*21*)[ + +DISCH_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN MP_TAC(SET_RULE`{u, w} INTER {v', w'}={u,w:real^3}/\ ~(w=u) /\ ~(v'=w') ==> {v', w'}={u,w} `) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC `v IN aff_ge {x} {v', w':real^3}` +THEN POP_ASSUM(fun th->REWRITE_TAC[th]) +THEN MRESAL_TAC aff_ge_inter_aff_ge[`x:real^3`;`u:real^3`;`w:real^3`][INTER;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*21*) + +MP_TAC(SET_RULE`~({u, w} INTER {v', w'} = {u, w:real^3}) ==> {u, w} INTER {v', w'} PSUBSET {u, w} `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{u, w} INTER {v', w'} PSUBSET {u, w:real^3} ==> {u, w} INTER {v', w'} SUBSET {u}\/ {u, w} INTER {v', w'} SUBSET {w} `) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*22*)[ + +MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v', w':real^3}`; `{u:real^3}`][DISJOINT;SET_RULE`{x} INTER {u} = {}<=> ~(x=u:real^3)`] +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{u:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] +THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v', w'}) SUBSET aff_ge {x} {u}/\ aff_ge {x} {u} SUBSET aff {x, u}/\ va IN aff_ge {x} ({u, w} INTER {v', w'})==> va IN aff {x,u}`) +THEN RESA_TAC +THEN REWRITE_TAC[IN;EMPTY] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % u +<=> a % w = u' % x + (v''+a- &1) % u`] +THEN MRESA1_TAC REAL_MUL_LINV`a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`a % w = u' % x + (v'' + a - &1) % u:real^3 ==> (inv (a))%(a % w ) = (inv (a))%( u' % x + (v'' + a - &1) % u)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`(inv a * u'):real` +THEN EXISTS_TAC`(inv a * (v'' + a - &1)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv a * u' + inv a * (v'' + a - &1) =inv a * ( a+ (u' + v'') - &1)`;REAL_ARITH`A+ &1- &1=A`];(*22*) + + +STRIP_TAC +THEN FIND_ASSUM MP_TAC`{u,w:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`w:real^3`] +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v', w':real^3}`; `{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {w} = {}<=> ~(x=w:real^3)`] +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{w:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] +THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v', w'}) SUBSET aff_ge {x} {w}/\ aff_ge {x} {w} SUBSET aff {x, w}/\ va IN aff_ge {x} ({u, w} INTER {v', w'})==> va IN aff {x,w}`) +THEN RESA_TAC +THEN REWRITE_TAC[IN;EMPTY] +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `~(u IN aff {x, w:real^3})` +THEN REWRITE_TAC[] +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % w +<=> (&1-a )% u = u' % x + (v''-a) % w`] +THEN MP_TAC(REAL_ARITH`a< &1==> ~(&1-a= &0)` )THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`&1-a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(&1-a )% u = u' % x + (v''-a) % w:real^3 ==> (inv (&1-a))%((&1-a )% u ) = (inv (&1-a))%( u' % x + (v''-a) % w)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`(inv (&1-a) * u'):real` +THEN EXISTS_TAC`(inv (&1-a) * (v'' - a)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1 - a) * u' + inv (&1 - a) * (v'' - a)=inv (&1 - a) * ((u' + v'') - a)`]](*22*)](*21*)](*20*)](*19*)](*18*)](*17*)](*16*)](*15*)](*14*);(*13*) + + + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CUOI") +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3 `;`x':real^3`] +THEN ASSUME_TAC(REAL_ARITH`pi<= pi`) +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A=B+A<=>B= &0`] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`] +THEN MRESA_TAC AZIM_EQ_0[`x:real^3`;`x':real^3`;`v':real^3`;`v:real^3`] +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`v':real^3`;`v:real^3`] +THEN DISJ_CASES_TAC(SET_RULE`w' IN aff_gt {x} {v,va:real^3}\/ ~(w' IN aff_gt {x} {v,va:real^3})`) +THENL(*14*)[ + +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-a)%u +a%w:real^3`][IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"DICH CHUYEN") +THEN DISCH_TAC +THEN REMOVE_THEN "DICH CHUYEN"(fun th->MP_TAC(th) THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN REMOVE_ASSUM_TAC + THEN ASSUME_TAC(th)) +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`w' = t1'' % x + t2'' % v + t3'' % va<=> + ((t1''+t2''+t3'')- &1) % x + t2'' % (v-x) + t3'' % (va-x)= w' -x:real^3`;REAL_ARITH`&1- &1 = &0`] +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(REAL_ARITH`&0< t2'' /\ &0< t3'' /\ t1''+t2''+t3''= &1==> &0 < &1- t1'' /\ ~(&1- t1'' = &0)/\ t2''+t3''= &1- t1''`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2'' + t3'' = &1 - t1'':real +==> (inv ( &1 - t1''))*(t2'' + t3'') = (inv ( &1 - t1''))*( &1 - t1'':real) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1- A*C = A*B`] +THEN STRIP_TAC +THEN MRESA_TAC REAL_LT_MUL[`inv(&1- t1'':real)`;`t3'':real`] +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)*(t3'':real)= &0)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)= &0)`) +THEN RESA_TAC +THEN ASSUME_TAC(REAL_ARITH`~(&1= &0)`) +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, (&1 - a) % u + a % w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] ) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN DISCH_TAC +THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` ((&1 - a) % u + a % w)-x:real^3`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(inv(&1- t1'')) * t3'':real`[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`inv(&1- t1'')`;`u - x:real^3`; `v - x:real^3`; `w'-x:real^3`] +[VECTOR_ARITH`&1 %A=A`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v,w'}= {(--x) +x, (--x) +u, (--x) +v, (--x) + w'}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w'}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN DISCH_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `w':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN MRESA_TAC exists_element_in_half_sapace_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w':real^3`;` v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; +` (w':real^3)`] +THEN MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`w':real^3`;`u':real^3`] +THEN REWRITE_TAC[EMPTY;IN] +THEN MP_TAC(REAL_ARITH`&0 &0< &1-t:real /\ &1-t< &1`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] +THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] +THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`w':real^3`;`u':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`{w',u'} IN (E:(real^3->bool)->bool)` +THEN SET_TAC[];(*14*) + +DISJ_CASES_TAC(SET_RULE`v' IN aff_gt {x} {v,va:real^3}\/ ~(v' IN aff_gt {x} {v,va:real^3})`) +THENL(*15*)[ + +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-a)%u +a%w:real^3`][IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"DICH CHUYEN") +THEN DISCH_TAC +THEN REMOVE_THEN "DICH CHUYEN"(fun th->MP_TAC(th) THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN REMOVE_ASSUM_TAC + THEN ASSUME_TAC(th)) +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`v' = t1'' % x + t2'' % v + t3'' % va<=> + ((t1''+t2''+t3'')- &1) % x + t2'' % (v-x) + t3'' % (va-x)= v' -x:real^3`;REAL_ARITH`&1- &1 = &0`] +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(REAL_ARITH`&0< t2'' /\ &0< t3'' /\ t1''+t2''+t3''= &1==> &0 < &1- t1'' /\ ~(&1- t1'' = &0)/\ t2''+t3''= &1- t1''`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2'' + t3'' = &1 - t1'':real +==> (inv ( &1 - t1''))*(t2'' + t3'') = (inv ( &1 - t1''))*( &1 - t1'':real) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1- A*C = A*B`] +THEN STRIP_TAC +THEN MRESA_TAC REAL_LT_MUL[`inv(&1- t1'':real)`;`t3'':real`] +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)*(t3'':real)= &0)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)= &0)`) +THEN RESA_TAC +THEN ASSUME_TAC(REAL_ARITH`~(&1= &0)`) +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3 `;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, (&1 - a) % u + a % w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +(&1 - a) % u + a % w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, (&1 - a) % u + a % w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] ) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN DISCH_TAC +THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` ((&1 - a) % u + a % w)-x:real^3`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(inv(&1- t1'')) * t3'':real`[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`inv(&1- t1'')`;`u - x:real^3`; `v - x:real^3`; `v'-x:real^3`] +[VECTOR_ARITH`&1 %A=A`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v,v'}= {(--x) +x, (--x) +u, (--x) +v, (--x) + v'}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, v'}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN DISCH_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `v':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN MRESA_TAC exists_element_in_half_sapace_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;` v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; +` (v':real^3)`] +THEN MRESA_TAC exists_cut_small_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v':real^3`;`u':real^3`] +THEN REWRITE_TAC[EMPTY;IN] +THEN MP_TAC(REAL_ARITH`&0 &0< &1-t:real /\ &1-t< &1`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`(&1-t:real)`;`a:real`] +THEN MRESAL_TAC REAL_LT_RMUL[`(&1-t:real)`;`&1`;`a:real`][REAL_ARITH`&1 *a=a`] +THEN REMOVE_THEN "YEU"(fun th-> MRESAL1_TAC th `(&1- t) *a`[VECTOR_ARITH`(&1 - (&1 - t) * a) % u + ((&1 - t) * a) % w=(&1 - t) % ((&1-a)%u+a % w)+t%u`;]) +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v':real^3`;`u':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`{v',u'} IN (E:(real^3->bool)->bool)` +THEN SET_TAC[];(*15*) + +SUBGOAL_THEN`~(v' IN aff_gt {x} { x',v:real^3})` ASSUME_TAC +THENL(*16*)[ +REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC aff_gt3_subset_aff_gt[`x:real^3`;`v:real^3`;`va:real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*16*) + +MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*17*)[ + +MRESA_TAC aff_gt12_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3`;`x':real^3`] +THEN MP_TAC(SET_RULE`v IN aff_gt {x} {x', v':real^3} /\ aff_gt {x} {x', v'} SUBSET aff_ge {x} {v', w'} +==>v IN aff_ge {x} {v', w':real^3}`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v:real^3`; `u:real^3`; `v':real^3`;`w':real^3`]properties_of_fan7) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*18*)[ + MRESA_TAC aff_gt2_subset_aff_ge [`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] +THEN ASSUME_TAC(REAL_ARITH`pi <= pi`) +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`va:real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A=A+B <=> B= &0`] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`va:real^3`;`w':real^3`] +THEN MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`w':real^3`;`va:real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*19*)[ + +MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] +THEN ASM_TAC THEN SET_TAC[];(*19*) + +MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] +THEN ASM_TAC THEN SET_TAC[]](*19*);(*18*) + + +REMOVE_THEN "CUOI" MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[AZIM_REFL] +THEN MP_TAC(PI_WORKS) +THEN REAL_ARITH_TAC](*18*);(*17*) + +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN DISCH_TAC +THEN MRESA_TAC aff_ge_subset_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;`(x':real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MP_TAC(SET_RULE`aff_ge {x} {v, x':real^3} SUBSET aff_gt {x, v} {x'} UNION aff_ge {x} {v} /\ v' IN aff_ge {x} {v, x'} ==> v' IN aff_gt {x, v} {x'} UNION aff_ge {x} {v}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(x':real^3)`;`(v:real^3)`] +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;UNION] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v':real^3`; `w':real^3`; `v:real^3`;`u:real^3`]properties1_of_fan7) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(SYM(th))) +THEN DISCH_TAC +THEN MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v':real^3)`;`(w':real^3)`] +THEN MRESA_TAC aff_gt2_subset_aff_ge [`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] +THEN ASSUME_TAC(REAL_ARITH`pi <= pi`) +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`va:real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A=A+B <=> B= &0`] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`va:real^3`;`w':real^3`] +THEN MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`w':real^3`;`va:real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*18*)[ +MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `va:real^3`;`x':real^3`] +THEN ASM_TAC THEN SET_TAC[];(*18*) + + +MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`v':real^3`; `w':real^3`;`x':real^3`] +THEN MP_TAC(SET_RULE`va IN aff_ge {x} { x',w':real^3} /\ aff_ge {x} { x',w'} SUBSET aff_ge {x} {v', w'} +==>va IN aff_ge {x} {v', w':real^3}`) +THEN RESA_TAC +THEN SUBGOAL_THEN `va IN aff_ge {x} {u,w:real^3}` ASSUME_TAC +THENL(*19*)[ + +MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1 -a:real` +THEN EXISTS_TAC`a:real` +THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 <= &1 - a /\ &0 <= a`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC;(*19*) + +MP_TAC(SET_RULE`va IN aff_ge {x} {v', w':real^3} /\ va IN aff_ge {x} {u, w} +==>va IN aff_ge {x} {u, w} INTER aff_ge {x} {v', w':real^3} `) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPECL[`{(u:real^3),(w:real^3)}`;`{(v':real^3),(w':real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] +THEN DISCH_TAC THEN ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(SET_RULE`{u, w} INTER {v', w'}={u,w:real^3}\/ ~({u, w} INTER {v', w'}={u,w:real^3})`) +THENL(*20*)[ +DISCH_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN MP_TAC(SET_RULE`{u, w} INTER {v', w'}={u,w:real^3}/\ ~(w=u) /\ ~(v'=w') ==> {v', w'}={u,w} `) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC `v' IN aff_ge {x} {v', w':real^3}` +THEN POP_ASSUM(fun th->REWRITE_TAC[th]) +THEN MRESAL_TAC aff_ge_inter_aff_ge[`x:real^3`;`u:real^3`;`w:real^3`][INTER;IN_ELIM_THM] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC `~collinear {x, v, u:real^3}` +THEN FIND_ASSUM MP_TAC `v=v':real^3` +THEN DISCH_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[th]) +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*20*) + +MP_TAC(SET_RULE`~({u, w} INTER {v', w'} = {u, w:real^3}) ==> {u, w} INTER {v', w'} PSUBSET {u, w} `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{u, w} INTER {v', w'} PSUBSET {u, w:real^3} ==> {u, w} INTER {v', w'} SUBSET {u}\/ {u, w} INTER {v', w'} SUBSET {w} `) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*21*)[ + +MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v', w':real^3}`; `{u:real^3}`][DISJOINT;SET_RULE`{x} INTER {u} = {}<=> ~(x=u:real^3)`] +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{u:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] +THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v', w'}) SUBSET aff_ge {x} {u}/\ aff_ge {x} {u} SUBSET aff {x, u}/\ va IN aff_ge {x} ({u, w} INTER {v', w'})==> va IN aff {x,u}`) +THEN RESA_TAC +THEN REWRITE_TAC[IN;EMPTY] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % u +<=> a % w = u' % x + (v''+a- &1) % u`] +THEN MRESA1_TAC REAL_MUL_LINV`a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`a % w = u' % x + (v'' + a - &1) % u:real^3 ==> (inv (a))%(a % w ) = (inv (a))%( u' % x + (v'' + a - &1) % u)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`(inv a * u'):real` +THEN EXISTS_TAC`(inv a * (v'' + a - &1)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv a * u' + inv a * (v'' + a - &1) =inv a * ( a+ (u' + v'') - &1)`;REAL_ARITH`A+ &1- &1=A`];(*21*) + + +STRIP_TAC +THEN FIND_ASSUM MP_TAC`{u,w:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`w:real^3`] +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v', w':real^3}`; `{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {w} = {}<=> ~(x=w:real^3)`] +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{w:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] +THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v', w'}) SUBSET aff_ge {x} {w}/\ aff_ge {x} {w} SUBSET aff {x, w}/\ va IN aff_ge {x} ({u, w} INTER {v', w'})==> va IN aff {x,w}`) +THEN RESA_TAC +THEN REWRITE_TAC[IN;EMPTY] +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `~(u IN aff {x, w:real^3})` +THEN REWRITE_TAC[] +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % w +<=> (&1-a )% u = u' % x + (v''-a) % w`] +THEN MP_TAC(REAL_ARITH`a< &1==> ~(&1-a= &0)` )THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`&1-a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(&1-a )% u = u' % x + (v''-a) % w:real^3 ==> (inv (&1-a))%((&1-a )% u ) = (inv (&1-a))%( u' % x + (v''-a) % w)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`(inv (&1-a) * u'):real` +THEN EXISTS_TAC`(inv (&1-a) * (v'' - a)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1 - a) * u' + inv (&1 - a) * (v'' - a)=inv (&1 - a) * ((u' + v'') - a)`]](*21*)](*20*)](*19*)](*18*)](*17*)](*16*)](*15*)](*14*)](*13*)](*12*)](*11*)](*10*)](*9*)] +(*8*)](*7*)](*6*)](*5*)](*4*)](*3*)](*2*);(*1*) + +SET_TAC[]]);; + + + + +let aff_ge_eq_aff_gt_union_aff_ge=prove(`!(x:real^3) (v:real^3) (w:real^3). +~collinear {x,v,w} +==> +aff_ge {x} {v , w} = (aff_gt {x} {v,w}) UNION (aff_ge {x} {v}) UNION (aff_ge {x} {w})`, + +REPEAT STRIP_TAC THEN MRESA_TAC th3 [`x:real^3`;`v:real^3`;`w:real^3`] + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GE_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GT_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`]AFF_GE_1_1) + THEN MP_TAC(ISPECL[`x:real^3`;`w:real^3`]AFF_GE_1_1) THEN RESA_TAC THEN RESA_TAC + THEN ASM_REWRITE_TAC[EXTENSION;UNION;IN_ELIM_THM] +THEN GEN_TAC THEN EQ_TAC +THENL[STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0<= t2/\ &0<=t3==> (t2= &0)\/ (t3= &0)\/ (&0 x = y + z`; + VECTOR_ARITH `x - y = z:real^N <=> x = y + z`] THEN + REWRITE_TAC[VECTOR_ADD_RID; REAL_ADD_RID] THEN SET_TAC[]);; + + +let aff_ge1_1_subset_aff_ge=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +DISJOINT {x} {v,u} /\ ~(x=v1) +/\ v1 IN aff_ge {x} {v,u} +==> +aff_ge {x} {v1} SUBSET aff_ge {x} {v,u}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`v1:real^3`;][IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % (t1 % x + t2 % v + t3 % u) +=(t1'+ t2'*t1) % x + (t2'* t2) % v + (t2' * t3 ) % u:real^3`] +THEN STRIP_TAC +THEN EXISTS_TAC`t1' + t2' * t1:real` +THEN EXISTS_TAC`t2' * t2:real` +THEN EXISTS_TAC`t2' * t3:real` +THEN MP_TAC(REAL_ARITH`&0 &0<= t2'`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t2:real`] +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`t3:real`] +THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t2' * t1) + t2' * t2 + t2' * t3 = +t1'+t2'*(t1+t2+t3)`; REAL_ARITH`A* &1=A`] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + + +let exist_close1_fan=prove(`(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) (v1:real^3) (w1:real^3) a:real. + +FAN(x,V,E) /\ {v,u} INTER {v1,w1}={} /\ {v1,w1} IN E /\ {v,u} IN E /\ {u,w} IN E +/\ (&0< azim x u w v ) /\ (azim x u w v +?h:real. +(&0 < h) +/\ +(!y1:real^3 y2:real^3. y1 IN (aff_ge {x} {v, (&1 - a) % u + a % w} INTER ballnorm_fan x) /\ y2 IN (aff_ge {x} {v1, w1} INTER ballnorm_fan x) +==> h <= dist(y1,y2) ))`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (v1:real^3)`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`;`a:real`] + +THEN MATCH_MP_TAC( ISPECL [`aff_ge {(x:real^3)} {(v:real^3), ((&1 - a) % u + a % w:real^3)} INTER ballnorm_fan x`; + `aff_ge {(x:real^3)} {(v1:real^3), (w1:real^3)} INTER ballnorm_fan x`] SEPARATE_CLOSED_COMPACT) +THEN MP_TAC(ISPECL[`(x:real^3) `;` (v:real^3)`;` ((&1 - a) % u + a % w:real^3)`]closed_aff_ge_ballnorm_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3) `;` (v1:real^3)`;` (w1:real^3)`]compact_aff_ge_ballnorm_fan) THEN RESA_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN FIND_ASSUM MP_TAC `{v1,w1:real^3} IN E` +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;` (v:real^3)`;`((&1 - a) % u + a % w:real^3)`] +THEN FIND_ASSUM(MP_TAC)`FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPECL[`{(v:real^3)}`;`{(v1:real^3),(w1:real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION; IN_ELIM_THM;] +THEN MP_TAC(SET_RULE`(v:real^3) IN V==>(?v'. v' IN V /\ {v} = {v'})`) +THEN REDA_TAC +THEN MP_TAC(SET_RULE`{(v:real^3),u} INTER {v1,w1}={} ==> {v} INTER {v1,w1}={}`) +THEN REDA_TAC +THEN REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_1;] +THEN STRIP_TAC THEN SUBGOAL_THEN`(aff_ge {x} {v} INTER aff_ge {x} {v1, w1:real^3}) INTER ballnorm_fan x={}` +ASSUME_TAC +THENL(*1*)[ +ASM_REWRITE_TAC[INTER;ballnorm_fan;EXTENSION;IN_ELIM_THM;SET_RULE`(?u. u = &1 /\ x' = u % x)<=> x'= &1 % x`;] +THEN REDUCE_VECTOR_TAC +THEN GEN_TAC THEN EQ_TAC +THENL(*2*)[ +STRIP_TAC THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DIST_REFL] +THEN REAL_ARITH_TAC; +SET_TAC[]]; + +ABBREV_TAC`va=(&1 - a) % u + a % w:real^3` + THEN SUBGOAL_THEN `va IN aff_ge {x} {u,w:real^3}` ASSUME_TAC +THENL(*2*)[ + MRESAL_TAC AFF_GE_1_2[`x:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1 -a:real` +THEN EXISTS_TAC`a:real` +THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 <= &1 - a /\ &0 <= a`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC;(*2*) + +SUBGOAL_THEN`(aff_ge {x} {va} INTER aff_ge {x} {v1, w1:real^3}) SUBSET {x}` +ASSUME_TAC +THENL(*3*)[ + MRESA_TAC th3[` (x:real^3)`;`(v:real^3)`;`(va:real^3)`] +THEN MRESA_TAC aff_ge1_1_subset_aff_ge[`x:real^3`;`u:real^3`;`w:real^3`;`va:real^3`] +THEN FIND_ASSUM(MP_TAC)`FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPECL[`{(u:real^3),(w:real^3)}`;`{(v1:real^3),(w1:real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION; IN_ELIM_THM;] +THEN MP_TAC(SET_RULE`{v,u} INTER {v1,w1}={}==> {u,w} INTER {v1,w1} SUBSET {w:real^3}`) +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v1, w1:real^3}`; `{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {u} = {}<=> ~(x=u:real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) +THEN REMOVE_ASSUM_TAC +THEN DISCH_TAC +THEN MP_TAC(SET_RULE`aff_ge {x} {va} SUBSET aff_ge {x} {u, w}/\ +aff_ge {x} {u, w} INTER aff_ge {x} {v1, w1} SUBSET aff_ge {x} {w} +==> aff_ge {x} {va:real^3} INTER aff_ge {x} {v1, w1} SUBSET aff_ge {x} {va} INTER aff_ge {x} {w}`) +THEN RESA_TAC +THEN MATCH_MP_TAC(SET_RULE` aff_ge {x} {va:real^3} INTER aff_ge {x} {v1, w1} SUBSET aff_ge {x} {va} INTER aff_ge {x} {w} /\ aff_ge {x} {va} INTER aff_ge {x} {w} SUBSET {x:real^3} ==>aff_ge {x} {va:real^3} INTER aff_ge {x} {v1, w1} SUBSET {x}`) +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`va:real^3`;][IN_ELIM_THM;SUBSET;INTER] +THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`w:real^3`;][IN_ELIM_THM;SUBSET;IN_SING] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % ((&1 - a) % u + a % w) = t1' % x + t2' % w +<=> (t2 *(&1 - a)) % u = (t1'-t1) % x + (t2'- t2*a) % w:real^3`] +THEN MP_TAC(REAL_ARITH`&0<= t2==> t2= &0 \/ &0 < t2:real`) +THEN RES_TAC +THENL(*4*)[ +FIND_ASSUM MP_TAC`t1+ t2:real= &1` +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN REDUCE_ARITH_TAC +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC;(*4*) + +MP_TAC(REAL_ARITH`a< &1==> &0< &1-a:real`) THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`t2:real`;`&1- a:real`] +THEN MP_TAC(REAL_ARITH` &0< t2*(&1-a)==> ~(t2*(&1-a):real= &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2*(&1-a):real` +THEN MRESA1_TAC REAL_LT_INV`t2*(&1-a):real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(t2 * (&1 - a)) % u = (t1' - t1) % x + (t2' - t2 * a) % w:real^3 ==> (inv (t2 * (&1 - a)))%((t2 * (&1 - a)) % u ) = (inv (t2 * (&1 - a)))%((t1' - t1) % x + (t2' - t2 * a) % w)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`u IN aff {x,w:real^3}`ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`(inv (t2 * (&1 - a)) * (t1' - t1)):real` +THEN EXISTS_TAC`(inv (t2 * (&1 - a)) * (t2' - t2 * a)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (t2 * (&1 - a)) * (t1' - t1) + inv (t2 * (&1 - a)) * (t2' - t2 * a) += inv (t2 * (&1 - a)) * ((t1' +t2')- (t1+t2)+ t2*(&1 - a)):real`; REAL_ARITH`&1- &1 + A= A`];(*5*) + +FIND_ASSUM MP_TAC `~collinear {x, u, w:real^3}` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC th3[`x:real^3`;`w:real^3`;`u:real^3`]]];(*3*) + + +SUBGOAL_THEN`(aff_ge {x} {va} INTER aff_ge {x} {v1, w1:real^3}) INTER ballnorm_fan x={}` +ASSUME_TAC +THENL(*4*)[ +ASM_REWRITE_TAC[INTER;ballnorm_fan;EXTENSION;IN_ELIM_THM;] +THEN REDUCE_VECTOR_TAC +THEN GEN_TAC THEN EQ_TAC +THENL(*5*)[ +STRIP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`x' IN aff_ge {x} {va} /\ x' IN aff_ge {x} {v1, w1} +/\ aff_ge {x} {va} INTER aff_ge {x} {v1, w1} SUBSET {x} +==> x' IN {x:real^3}`) +THEN REWRITE_TAC[IN_SING] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[DIST_REFL;] +THEN REAL_ARITH_TAC;(*5*) +SET_TAC[]]; +ASM_TAC THEN SET_TAC[]]]]]);; + + +let properties_inside_collinear0_fan=prove(`!(x:real^3) (u:real^3) (w:real^3) a:real. +&0 ~collinear{x,(&1 - a) % u + a % w,u}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[collinear1_fan] +THEN STRIP_TAC THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v % u +<=> a % w = u' % x + (v+a- &1) % u`] +THEN MP_TAC(REAL_ARITH`&0< a ==> ~(a= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +a % w = u' % x + (v+a- &1) % u:real^3 +==> (inv ( a))%(a % w) = (inv (a))%(u' % x + (v+a- &1) % u) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC `(inv a * (u':real))` +THEN EXISTS_TAC `(inv a * (v +a - &1 :real))` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv a * (u') + inv a * (v +a - &1)=inv a* (a+ (u'+v) - &1)`;REAL_ARITH`t3'+ &1 - &1=t3'`]);; + + +let properties_inside_collinear1_fan=prove(`!(x:real^3) (u:real^3) (w:real^3) a:real. +&0 ~collinear{x,(&1 - a) % u + a % w,w}`, +REPEAT STRIP_TAC THEN +MRESAL_TAC properties_inside_collinear0_fan[`(x:real^3)`;` (w:real^3)`;`(u:real^3)`;`&1-a:real`][VECTOR_ARITH`(&1 - (&1 - a)) % w + (&1 - a) % u=(&1 - a) % u + a % w`;] +THENL[ ASM_TAC THEN REAL_ARITH_TAC; +STRIP_TAC THENL[ASM_TAC THEN REAL_ARITH_TAC; +ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[]]]);; + +let properties1_inside_fan=prove(`!x:real^3 u:real^3 w:real^3. +DISJOINT {x} {u,w} +/\ &0 (&1-a)%u+ a%w IN aff_ge {x} {u,w:real^3}`, +REPEAT STRIP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1 -a:real` +THEN EXISTS_TAC`a:real` +THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 <= &1 - a /\ &0 <= a`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC);; + + + +let properties_inside_collinear_fan=prove(`!(x:real^3) (u:real^3) (w:real^3) a:real. +&0 ~collinear{x,(&1 - a) % u + a % w,u} +/\ ~collinear{x,(&1 - a) % u + a % w,w}`, + +MESON_TAC[SET_RULE`{A,B,C}={A,C,B}`;properties_inside_collinear0_fan;properties_inside_collinear1_fan] +);; + + + +let properties_inside_collinear1_fan=prove(`!x:real^3 u:real^3 w:real^3. +~collinear{x,u,w} +/\ &0 aff_ge {x} {u} INTER aff_ge {x} {(&1-a)%u+ a%w,w:real^3} SUBSET aff_ge {x} {}`, + +REPEAT STRIP_TAC +THEN MRESA_TAC properties_inside_collinear_fan[`(x:real^3)`;`(u:real^3)`;`(w:real^3)`;`a:real`] +THEN MRESA_TAC th3[`(x:real^3)`;`((&1-a)%u+ a%w:real^3)`;`(w:real^3)`] +THEN MRESA_TAC th3[`(x:real^3)`;`u:real^3`;`(w:real^3)`] +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`(&1-a)%u+ a%w:real^3`;`w:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`u:real^3`][IN_ELIM_THM;INTER;SUBSET;AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_1] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`&1` +THEN REDUCE_VECTOR_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0<= t2' /\ &0 <= t3==> (t2'= &0 /\ t3 = &0)\/ (&0< t2' \/ &0 (t2'* a + t3) % w = (t1-t1') % x +( t2-t2' * (&1-a))% u :real^3`] +THEN MRESA_TAC REAL_LT_MUL[`t2':real`;`a:real`] +THEN MP_TAC(REAL_ARITH` &0< t2'*(a) /\ &0<= t3 ==> &0 < t2'*(a)+t3 /\ ~(t2'*(a)+t3:real= &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2'*(a)+t3:real` +THEN MRESA1_TAC REAL_LT_INV`t2'*(a)+t3:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(t2'* a + t3) % w = (t1-t1') % x +( t2-t2' * (&1-a))% u:real^3 + ==> (inv (t2' * a+t3))%((t2'* a + t3) % w) = (inv (t2' * a+t3))%( (t1-t1') % x +( t2-t2' * (&1-a))% u)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`w IN aff {x,u:real^3}`ASSUME_TAC +THENL[REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`(inv (t2' * a+t3)) * (t1 - t1'):real` +THEN EXISTS_TAC`(inv (t2' * a+t3) * (t2 - t2' *(&1- a))):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (t2' * a + t3) * (t1 - t1') + inv (t2' * a + t3) * (t2 - t2' * (&1 - a)) += inv (t2' * a + t3) * ((t2'*a +t3)+(t1 + t2) -(t1'+ t2' +t3) ):real`; REAL_ARITH`A+ &1- &1= A`]; +ASM_MESON_TAC[]]; + +STRIP_TAC THEN +REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % u = t1' % x + t2' % ((&1 - a) % u + a % w) + t3 % w +<=> (t2'* a + t3) % w = (t1-t1') % x +( t2-t2' * (&1-a))% u :real^3`] +THEN MP_TAC(REAL_ARITH`&0 &0<=a`) THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`t2':real`;`a:real`] +THEN MP_TAC(REAL_ARITH` &0<= t2'*(a) /\ &0< t3 ==> &0 < t2'*(a)+t3 /\ ~(t2'*(a)+t3:real= &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2'*(a)+t3:real` +THEN MRESA1_TAC REAL_LT_INV`t2'*(a)+t3:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(t2'* a + t3) % w = (t1-t1') % x +( t2-t2' * (&1-a))% u:real^3 + ==> (inv (t2' * a+t3))%((t2'* a + t3) % w) = (inv (t2' * a+t3))%( (t1-t1') % x +( t2-t2' * (&1-a))% u)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`w IN aff {x,u:real^3}`ASSUME_TAC +THENL[ +REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`(inv (t2' * a+t3)) * (t1 - t1'):real` +THEN EXISTS_TAC`(inv (t2' * a+t3) * (t2 - t2' *(&1- a))):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (t2' * a + t3) * (t1 - t1') + inv (t2' * a + t3) * (t2 - t2' * (&1 - a)) += inv (t2' * a + t3) * ((t2'*a +t3)+(t1 + t2) -(t1'+ t2' +t3) ):real`; REAL_ARITH`A+ &1- &1= A`]; +ASM_MESON_TAC[]]]);; + + + +let lemma_proof0_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (w:real^3) (v1:real^3) (w1:real^3) a:real. + +FAN(x,V,E) /\ {v1,w1} IN E /\ {u,w} IN E /\ ~(u IN {v1,w1}) +/\ &0 (aff_ge {x} {(&1 - a) % u + a % w} INTER aff_ge {x} {v1, w1:real^3}) SUBSET {x}`, +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (v1:real^3)`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN FIND_ASSUM MP_TAC `{v1,w1:real^3} IN E` +THEN ABBREV_TAC`va=(&1 - a) % u + a % w:real^3` +THEN MRESA_TAC properties1_inside_fan[`(x:real^3)`;` (u:real^3)`;`(w:real^3)`;] +THEN MRESA_TAC properties_inside_collinear_fan[`(x:real^3)`;` (u:real^3)`;`(w:real^3)`;`a:real`] +THEN MRESA_TAC th3[` (x:real^3)`;`(va:real^3)`;`(u:real^3)`] +THEN MRESA_TAC aff_ge1_1_subset_aff_ge[`x:real^3`;`u:real^3`;`w:real^3`;`va:real^3`] +THEN FIND_ASSUM(MP_TAC)`FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPECL[`{(u:real^3),(w:real^3)}`;`{(v1:real^3),(w1:real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION; IN_ELIM_THM;] +THEN MP_TAC(SET_RULE`~(u IN {v1,w1})==> {u,w} INTER {v1,w1} SUBSET {w:real^3}`) +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v1, w1:real^3}`; `{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {u} = {}<=> ~(x=u:real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) +THEN REMOVE_ASSUM_TAC +THEN DISCH_TAC +THEN MP_TAC(SET_RULE`aff_ge {x} {va} SUBSET aff_ge {x} {u, w}/\ +aff_ge {x} {u, w} INTER aff_ge {x} {v1, w1} SUBSET aff_ge {x} {w} +==> aff_ge {x} {va:real^3} INTER aff_ge {x} {v1, w1} SUBSET aff_ge {x} {va} INTER aff_ge {x} {w}`) +THEN RESA_TAC +THEN MATCH_MP_TAC(SET_RULE` aff_ge {x} {va:real^3} INTER aff_ge {x} {v1, w1} SUBSET aff_ge {x} {va} INTER aff_ge {x} {w} /\ aff_ge {x} {va} INTER aff_ge {x} {w} SUBSET {x:real^3} ==>aff_ge {x} {va:real^3} INTER aff_ge {x} {v1, w1} SUBSET {x}`) +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`va:real^3`;][IN_ELIM_THM;SUBSET;INTER] +THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`w:real^3`;][IN_ELIM_THM;SUBSET;IN_SING] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % ((&1 - a) % u + a % w) = t1' % x + t2' % w +<=> (t2 *(&1 - a)) % u = (t1'-t1) % x + (t2'- t2*a) % w:real^3`] +THEN MP_TAC(REAL_ARITH`&0<= t2==> t2= &0 \/ &0 < t2:real`) +THEN RES_TAC +THENL(*4*)[ +FIND_ASSUM MP_TAC`t1+ t2:real= &1` +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN REDUCE_ARITH_TAC +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC; +MP_TAC(REAL_ARITH`a< &1==> &0< &1-a:real`) THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`t2:real`;`&1- a:real`] +THEN MP_TAC(REAL_ARITH` &0< t2*(&1-a)==> ~(t2*(&1-a):real= &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2*(&1-a):real` +THEN MRESA1_TAC REAL_LT_INV`t2*(&1-a):real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(t2 * (&1 - a)) % u = (t1' - t1) % x + (t2' - t2 * a) % w:real^3 ==> (inv (t2 * (&1 - a)))%((t2 * (&1 - a)) % u ) = (inv (t2 * (&1 - a)))%((t1' - t1) % x + (t2' - t2 * a) % w)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`u IN aff {x,w:real^3}`ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`(inv (t2 * (&1 - a)) * (t1' - t1)):real` +THEN EXISTS_TAC`(inv (t2 * (&1 - a)) * (t2' - t2 * a)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (t2 * (&1 - a)) * (t1' - t1) + inv (t2 * (&1 - a)) * (t2' - t2 * a) += inv (t2 * (&1 - a)) * ((t1' +t2')- (t1+t2)+ t2*(&1 - a)):real`; REAL_ARITH`&1- &1 + A= A`]; +FIND_ASSUM MP_TAC `~collinear {x, u, w:real^3}` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC th3[`x:real^3`;`w:real^3`;`u:real^3`]]]);; + + +let lemma_proof1_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (w:real^3) (v1:real^3) (w1:real^3) a:real. + +FAN(x,V,E) /\ {v1,w1} IN E /\ {u,w} IN E /\ ~(w IN {v1,w1}) +/\ &0 (aff_ge {x} {(&1 - a) % u + a % w} INTER aff_ge {x} {v1, w1:real^3}) SUBSET {x}`, + +REPEAT STRIP_TAC +THEN MRESAL_TAC lemma_proof0_fan[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(w:real^3)`;` (u:real^3)`;`(v1:real^3)`;`(w1:real^3)`;`&1 -a:real`][VECTOR_ARITH`(&1 - (&1 - a)) % w + (&1 - a) % u=(&1 - a) % u + a % w`;] +THEN POP_ASSUM MATCH_MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC);; + + + +let GRAPH = prove + (`!E. graph E <=> !e. e IN E ==> e HAS_SIZE 2`, + REWRITE_TAC[graph; IN]);; + + + +let CARD_2_FAN=prove(`!v:A w:A. ~(v=w) +==> CARD {v,w}=2`, +REPEAT STRIP_TAC +THEN SUBGOAL_THEN`FINITE {v,w:A}`ASSUME_TAC +THENL[ SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY]; + +ASSUME_TAC(SET_RULE `v:A IN {v:A,w:A} `) +THEN MP_TAC(ISPECL[`v:A`;`{v:A,w:A}`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `v IN {v,w}==>{v:A,w:A} DELETE v PSUBSET {v,w}`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`{v:A,w:A} DELETE v`;`{v:A,w:A}`]CARD_PSUBSET) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`FINITE {v:A,w:A}` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN DISCH_TAC +THEN MP_TAC(ARITH_RULE`CARD ({v, w} DELETE v) < CARD {v, w}/\ CARD ({v, w} DELETE v) = CARD {v, w}-1 +<=>CARD ({v, w} DELETE v) +1= CARD {v:A, w:A}`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th;]) +THEN REWRITE_TAC[ARITH_RULE`A=A`] +THEN DISCH_TAC +THEN SUBGOAL_THEN `w:A IN ({v:A,w:A} DELETE v)` ASSUME_TAC +THENL[ +ASM_SET_TAC[]; +MP_TAC(ISPECL[`{v:A,w:A}`;`v:A`] FINITE_DELETE) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`w:A`;`{v:A,w:A} DELETE v`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `w IN ({v,w} DELETE v)==>{v:A,w:A} DELETE v DELETE w PSUBSET {v,w} DELETE v`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`{v:A,w:A} DELETE v DELETE w`;`{v:A,w:A} DELETE v`]CARD_PSUBSET) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`FINITE ({v:A,w:A} DELETE v)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN DISCH_TAC +THEN MP_TAC(ARITH_RULE`CARD ({v, w} DELETE v DELETE w) < CARD ({v, w} DELETE v)/\ CARD ({v, w} DELETE v DELETE w) = CARD ({v, w} DELETE v)-1 +<=>CARD ({v, w} DELETE v DELETE w) +1= CARD ({v:A, w:A} DELETE v)`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th;]) +THEN REWRITE_TAC[ARITH_RULE`A=A`] +THEN DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[]) +THEN POP_ASSUM (fun th->REWRITE_TAC[]) +THEN ASSUME_TAC(SET_RULE `{v, w} DELETE v:A DELETE w:A={}`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th;CARD_CLAUSES; ARITH_RULE `0+1=1`]) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"B") +THEN DISCH_TAC +THEN REMOVE_THEN "B" MP_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th);ARITH_RULE` 1+1=2`]) +THEN SET_TAC[]]]);; + + + + +let lemma_proof_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (w:real^3) (v1:real^3) (w1:real^3) a:real. + +FAN(x,V,E) /\ {v1,w1} IN E /\ {u,w} IN E /\ ~({u,w} = {v1,w1}) +/\ &0 (aff_ge {x} {(&1 - a) % u + a % w} INTER aff_ge {x} {v1, w1:real^3}) SUBSET {x}`, + +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (v1:real^3)`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN MP_TAC(SET_RULE` ~(u=w) /\ ~(v1=w1:real^3)==> ({u,w} = {v1,w1}<=> {u,w} SUBSET {v1,w1})`) +THEN ASM_REWRITE_TAC[SET_RULE`~({u,w} SUBSET {v1,w1})<=> ~(w IN {v1,w1})\/ ~( u IN {v1,w1})`] +THEN ASM_TAC THEN SET_TAC[lemma_proof0_fan;lemma_proof1_fan]);; + + + + +let remark012_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (w:real^3) a:real. +FAN(x,V,E) /\ {u,w} IN E +/\ &0 ~((&1 - a) % u + a % w IN V)`, +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN ABBREV_TAC`v1=(&1 - a) % u + a % w:real^3` +THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan2] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`~(x IN V) /\ v1 IN V==> ~(x=(v1:real^3))`) +THEN RESA_TAC +THEN MRESA_TAC properties_inside_collinear_fan[`(x:real^3)`;`(u:real^3)`;`(w:real^3)`;`a:real`] +THEN MRESA_TAC th3[`(x:real^3)`;`((&1-a)%u+ a%w:real^3)`;`(w:real^3)`] +THEN MRESA_TAC th3[`(x:real^3)`;`((&1-a)%u+ a%w:real^3)`;`(u:real^3)`] +THEN MP_TAC(SET_RULE`DISJOINT {x, v1} {u}==> ~(v1=u:real^3)`) THEN RESA_TAC +THEN MP_TAC(SET_RULE`DISJOINT {x, v1} {w}==> ~(v1=w:real^3)`) THEN RESA_TAC +THEN MP_TAC(SET_RULE` ~(v1=w:real^3) /\ ~(v1=u:real^3) ==> {u,w} INTER {v1}={}`) THEN RESA_TAC +THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPECL[`{(u:real^3),w}`;`({v1:real^3})`]th)) + THEN ASM_REWRITE_TAC[UNION; IN_ELIM_THM;] +THEN MP_TAC(SET_RULE`(v1:real^3) IN V==>(?v'. v' IN V /\ {v1} = {v'})`) +THEN REDA_TAC +THEN MRESA_TAC properties1_inside_fan[`(x:real^3)`;` (u:real^3)`;`(w:real^3)`;] +THEN MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`u:real^3`; `w:real^3`;`v1:real^3`] +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`((&1 - a) % u + a % w:real^3)`;` (w:real^3)`] +THEN MP_TAC(SET_RULE`aff_ge {x} {v1, w} SUBSET aff_ge {x} {u, w}/\ aff_ge {x} {v1, w} = + aff_gt {x} {v1, w} UNION aff_ge {x} {v1} UNION aff_ge {x} {w} +==> aff_ge {x} {u, w} INTER aff_ge {x} {v1}=aff_ge {x} {v1:real^3}`) +THEN RESA_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`v1 IN aff_ge {x} {v1:real^3}` ASSUME_TAC +THENL[MRESAL_TAC AFF_GE_1_1[`x:real^3`;`v1:real^3`;][IN_ELIM_THM] +THEN EXISTS_TAC`&0` THEN EXISTS_TAC`&1` THEN REDUCE_VECTOR_TAC THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_1;SUBSET;IN_SING;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`&1 %A=A`]]);; + + +let remark01_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (u:real^3) (w:real^3) (v1:real^3) (w1:real^3) a:real. +FAN(x,V,E) /\ {v1,w1} IN E /\ {u,w} IN E /\ ~({u,w} = {v1,w1}) +/\ &0 ~((&1 - a) % u + a % w IN {v1, w1:real^3})`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w1:real^3`;`v1:real^3`] +THEN FIND_ASSUM MP_TAC `{v1,w1:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v1:real^3`;`w1:real^3`] +THEN MRESA_TAC remark012_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`w:real^3`;`a:real`] +THEN ASM_TAC THEN SET_TAC[]);; + + +let remark0_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) e:real^3->bool. +FAN(x,V,E)/\ e IN E +==> {x} INTER e={}`, +REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"A") THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`]expand_edge_graph_fan) +THEN RESA_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC THEN SET_TAC[]);; + + + +let case2_proof_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {v,w1} IN E +/\ &0 < azim x u w v /\ azim x u w v < pi +/\ &0 (!e. e IN (E DELETE {u,w}) ==> aff_ge {x} e INTER aff_ge {x} {ua,w} = aff_ge {x} (e INTER {ua,w}))`, +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC `~collinear {x,w,ua:real^3}` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN DISCH_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN FIND_ASSUM MP_TAC `e IN E DELETE {u,w:real^3}` +THEN REWRITE_TAC[DELETE;IN_ELIM_THM;SET_RULE`~(e={u,w:real^3})<=> ~({u,w:real^3}=e)`] +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`]expand_edge_graph_fan) +THEN RESA_TAC +THEN MRESA_TAC lemma_proof_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`(w:real^3)`;`(v':real^3)`;`(w':real^3)`;`a:real`] +THEN MRESA_TAC remark01_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`(w:real^3)`;`(v':real^3)`;`(w':real^3)`;`a:real`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM(th)]) +THEN RESA_TAC THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(ua IN e)==> e INTER {ua,w:real^3} SUBSET {w}`) +THEN RESA_TAC +THEN MRESA_TAC properties1_inside_fan[`(x:real^3)`;` (u:real^3)`;`(w:real^3)`;] +THEN MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`u:real^3`; `w:real^3`;`ua:real^3`] +THEN MRESA_TAC th3[` (x:real^3)`;`(ua:real^3)`;`(w:real^3)`] +THEN MRESA_TAC remark0_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`e:real^3->bool`] +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`e INTER { ua,w:real^3}`;`e:real^3->bool`][DISJOINT;SET_RULE` e INTER {ua,w} SUBSET e`;] +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`e INTER { ua,w:real^3}`;`{ua,w:real^3}`][DISJOINT;SET_RULE` e INTER {ua,w} SUBSET {ua,w:real^3}`;] +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{}:real^3->bool`;`{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {w}={} <=> ~(x=w)`;SET_RULE` {} SUBSET {w:real^3}`;] +THEN MATCH_MP_TAC(SET_RULE`C SUBSET A /\ C SUBSET B /\ A INTER B SUBSET C==>A INTER B= C`) +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPECL[`{(u:real^3),w}`;`(e:real^3->bool)`]th)) + THEN ASM_REWRITE_TAC[UNION; IN_ELIM_THM;] +THEN DISJ_CASES_TAC(SET_RULE`{u,w:real^3} INTER e= {u,w} \/ ~({u,w} INTER e= {u,w})`) +THENL[MP_TAC(SET_RULE`{u,w} INTER e= {u,w:real^3}==> {u,w} SUBSET e`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`]expand_edge_graph_fan) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` ~(u=w:real^3) ==> ({u,w} = {v',w'}<=> {u,w} SUBSET {v',w'})`) +THEN RESA_TAC +THEN ASM_TAC THEN SET_TAC[]; + +MP_TAC(SET_RULE` e INTER {ua,w:real^3} SUBSET {w}==> e INTER { ua,w:real^3} = {w} \/ e INTER { ua,w:real^3}= {}`) +THEN RESA_TAC + +THENL[ +MP_TAC(SET_RULE`e INTER {ua, w} = {w:real^3}==> w IN e`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~({u, w} INTER e = {u, w:real^3}) ==> {u, w} INTER e PSUBSET {u, w} `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{u, w} INTER e PSUBSET {u, w:real^3} /\ w IN e /\ ~(u=w) ==> {u, w} INTER e SUBSET {w} `) +THEN RESA_TAC +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER (e:real^3->bool)`;`{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {w}={} <=> ~(x=w)`;SET_RULE` {} SUBSET {w:real^3}`;] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC + THEN SET_TAC[]; + +MP_TAC(SET_RULE`e INTER {ua, w:real^3} = {}==> ~(w IN e)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~({u, w} INTER e = {u, w:real^3}) ==> {u, w} INTER e PSUBSET {u, w} `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{u, w} INTER e PSUBSET {u, w:real^3} /\ ~(w IN e) ==> {u, w} INTER e SUBSET {u} `) +THEN RESA_TAC +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER (e:real^3->bool)`;`{u:real^3}`][DISJOINT;SET_RULE`{x} INTER {u}={} <=> ~(x=u)`;SET_RULE` {} SUBSET {w:real^3}`;] +THEN STRIP_TAC +THEN SUBGOAL_THEN `aff_ge {x} e INTER aff_ge {x} {ua, w} SUBSET aff_ge {x} {u} INTER aff_ge {x} {ua, w:real^3}`ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]; +MRESA_TAC properties_inside_collinear1_fan[`x:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]]]);; + + + + + + + +let inequality1_not0_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) d:real a:real. +FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) /\ &0 < d +/\ &0 +?(h:real). a (!(s:real). &0 <= s /\ s <= &1 +==> s * inv(norm((&1-s)%v+s%((&1-t)%u+ t%w)-x))* norm( ((&1-a)%u + a %w)-((&1-t)%u+ t%w))< d ))`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`((&1-a)%u + a %w)-((&1-t)%u+ t%w)=(t-a)%(u-w):real^3`;NORM_MUL] +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;` (w:real^3)`]separate_point_convex_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN EXISTS_TAC`min (a+(h:real)*(d:real) *inv(norm(u-w:real^3))) (&1)` +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] remark1_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`u:real^3`;`w:real^3`]imp_norm_gl_zero_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(h:real)*(d:real)`;`inv(norm(u-w:real^3))`] REAL_LT_MUL) +THEN RESA_TAC +THEN STRIP_TAC +THENL[ +MP_TAC(ISPECL[`h:real`;`d:real`] REAL_LT_MUL) +THEN RESA_TAC +THEN ASM_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ +REAL_ARITH_TAC; +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 <(h:real)==> ~(h= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(h:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`(t:real)< min (a+(h:real) * (d:real) * inv (norm (u - w:real^3))) (&1)/\ min (a+h * d * inv (norm (u - w))) (&1)<= &1 /\ &0 &0 <= t /\ t <= &1 /\ &0 <= t-a /\ t - a<= &1/\ (t:real)-a < (h * d * inv (norm (u - w:real^3)))`) +THEN ASM_REWRITE_TAC[REAL_ARITH`min (a+h * d * inv (norm (u - w))) (&1)<= &1`] +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3) `;`(w:real^3) `;`(t:real) `;`s:real`]expansion_convex_fan) +THEN RESA_TAC +THEN REMOVE_THEN "A"(fun th -> MP_TAC(ISPEC`(&1-s)%v+s%((&1-t)%u+ t%w):real^3`th)) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`h:real`;`norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)`]REAL_LT_INV2) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 &0 <= norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3)`REAL_LE_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`t-a:real`REAL_ABS_REFL) +THEN RESP_TAC +THEN MP_TAC(ISPECL[`inv(norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3))`; +`inv(h:real)`;`t:real-a`;`(h * d * inv (norm (u - w:real^3)))`;]REAL_LT_MUL2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`u:real^3`;`w:real^3`]imp_norm_not_zero_fan) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(norm(u-w:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`u-w:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(&0 =norm(u-w:real^3)) /\ &0 <= norm(u-w:real^3)==> &0 GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REDUCE_ARITH_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A*B*C=(A*B)*C:real`;VECTOR_ARITH`(&1 - s) % v + s % ((&1 - t) % u + t % w) - x=((&1 - s) % v + s % ((&1 - t) % u + t % w))- x :real^3`]; +MP_TAC(REAL_ARITH`~(s= &1) /\ s<= &1==> (s:real)< &1`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`s:real`;`&1`;`(inv (norm (((&1 - s) % v + s % ((&1 - t) % u + t % w)) - x:real^3))*(t-a:real)) * norm(u-w:real^3)`; +`d:real`]REAL_LT_MUL2) +THEN REDUCE_ARITH_TAC +THEN RESA_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A*d*B*C=A*(d*B)*C:real`;VECTOR_ARITH`(&1 - s) % v + s % ((&1 - t) % u + t % w) - x=((&1 - s) % v + s % ((&1 - t) % u + t % w))- x :real^3`]]]]);; + + + +let bounded_convex1_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) w:real^3. +FAN(x,V,E) /\ {v,u} IN E /\ {u,w} IN E +==> ?(h:real). &0< h /\ (!(y:real^3). y IN convex hull{v,u,w} ==> norm(y-x) REWRITE_TAC[th;]) +THEN DISCH_TAC +THEN ASSUME_TAC(ISPEC`x:real^3` norm_origin_fan ) +THEN ASSUME_TAC(SET_RULE`convex hull {(v:real^3), u,w} SUBSET (:real^3)`) +THEN MP_TAC(ISPECL[`(\(y:real^3). lift(norm(y-x:real^3)))`;`(:real^3)`;`convex hull {(v:real^3),(u:real^3),w}`]CONTINUOUS_ON_SUBSET) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(\(y:real^3). lift(norm(y-x:real^3)))`;`convex hull {(v:real^3),(u:real^3),w}`]COMPACT_CONTINUOUS_IMAGE) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[COMPACT_EQ_BOUNDED_CLOSED;bounded;IMAGE;IN_ELIM_THM] +THEN ONCE_REWRITE_TAC[TAUT`A/\B<=>B/\A`;] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN SUBGOAL_THEN `(?x':real^3. x' IN convex hull {v, u,w} /\ + lift (norm (v - x:real^3)) = lift (norm (x' - x)))`ASSUME_TAC +THENL[ +EXISTS_TAC`v:real^3` +THEN SIMP_TAC[CONVEX_HULL_3; IN_ELIM_THM;] +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC; +SUBGOAL_THEN `&0< (a:real)` ASSUME_TAC +THENL[ +REMOVE_THEN "A" (fun th-> MP_TAC(ISPEC`lift (norm (v - (x:real^3)))`th)) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NORM_LIFT;REAL_ABS_NORM ] +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] remark1_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_not_zero_fan) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`v-x:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(&0 =norm(v-x:real^3)) /\ &0 <= norm(v-x:real^3)==> &0 MP_TAC(ISPEC`lift (norm (y - x:real^3))`th)) +THEN ASM_REWRITE_TAC[NORM_LIFT;REAL_ABS_NORM ] +THEN ASM_TAC +THEN REAL_ARITH_TAC]; + +ASM_TAC +THEN REAL_ARITH_TAC]]]]);; + + +let inequaility2_not0_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) d:real a:real. +FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) /\ &0 < d +/\ &0 +?(h:real). a (!(s:real). &0 <= s /\ s <= &1 +==> (norm(inv(norm((&1-s)%v+s%((&1-a)%u+ a%w)-x))%((&1-s)%v+s%((&1-a)%u+ a%w)-x) - inv(norm((&1-s)%v+s%((&1-t)%u+ t%w)-x))% ((&1-s)%v+s%((&1-a)%u+ a%w)-x)))< d ))`, + +REWRITE_TAC[VECTOR_ARITH`A%B-C%B=(A-C)%B`;NORM_MUL] +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`u-((&1-t)%u+ t%w)=t%(u-w):real^3`;NORM_MUL] +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;` (w:real^3)`]separate_point_convex_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3) `;`(w:real^3)`]origin_point_not_in_convex_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"B") +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`w:real^3`]bounded_convex1_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"C") +THEN EXISTS_TAC`min (a+h*h*(inv (h'))* inv(norm(u-w:real^3))*d:real) (&1)` +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] remark1_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`u:real^3`;`w:real^3`]imp_norm_not_zero_fan) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`u-w:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(&0 =norm(u-w:real^3)) /\ &0 <= norm(u-w:real^3)==> &0 ~(h= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(h:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 <(h':real)==> ~(h'= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(h':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`norm (u-w:real^3)`REAL_LE_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`norm (u-w:real^3)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(h:real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 &0 <= inv(h)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(h':real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 &0 <= inv(h')`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 &0 <= a/\ a <= &1`) +THEN RESA_TAC +THEN STRIP_TAC +THENL(*1*)[ +MP_TAC(ISPECL[`(h:real)`;`inv (h':real) `]REAL_LT_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(h:real)`;`(h:real)*inv (h':real) `]REAL_LT_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(h:real)*(h:real)*inv (h':real)`;`inv(norm(u-w:real^3))`]REAL_LT_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(h:real)*(h:real)*inv (h':real) *inv(norm(u-w:real^3))`;`d:real`]REAL_LT_MUL) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`a:real < &1 ` +THEN REAL_ARITH_TAC;(*1*) + +STRIP_TAC +THENL(*2*)[ +REAL_ARITH_TAC;(*2*) +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3)`;`w:real^3`;`a:real`;` s:real`]expansion_convex_fan) +THEN RESA_TAC +THEN REMOVE_THEN "C"(fun th->MP_TAC(ISPEC`(&1 - s) % v + s % ((&1 - a) % u + a % w):real^3`th)) +THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] +THEN RESA_TAC +THEN SUBGOAL_THEN`~(x=(&1 - s) % v + s % ((&1 - a) % u + a % w):real^3)` ASSUME_TAC +THENL(*3*)[ +ASM_TAC THEN SET_TAC[];(*3*) +MP_TAC(ISPECL[`(&1 - s) % v + s % ((&1 - a) % u + a % w):real^3`;`x:real^3`]imp_norm_not_zero_fan) +THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`(&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)= &0) /\ &0 <= norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)==> &0 &0<= t-a /\ &0<= t /\ t<= &1/\ (t:real)-a< (h * h * inv h' * inv (norm (u - w:real^3)) * d) `) +THEN ASM_REWRITE_TAC[REAL_ARITH`min (a+h * h * inv h' * inv (norm (u - w:real^3)) * d) (&1)<= &1`] +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x:real^3) `; +`(h':real)`;`t-a:real`;`(h * h * inv h' * inv (norm (u - w:real^3)) * d)`;]REAL_LT_MUL2) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &0/\ &0<= &1`] +THEN USE_THEN "A" (fun th-> MP_TAC(ISPEC`((&1 - s) % v + s % ((&1 - a) % u + a % w):real^3)`th)) +THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`h:real`;`norm ((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)`]REAL_LT_INV2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)`;`t-a:real`]REAL_LE_MUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv(norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x:real^3))`;`inv(h:real)`;`norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x:real^3)*(t:real-a)`;`(h':real)*(h * h * inv h' * inv (norm (u - w:real^3)) * d)`;]REAL_LT_MUL2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3) `;`(w:real^3) `;`(t:real) `;`s:real`]expansion_convex_fan) +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN USE_THEN "A" (fun th-> MP_TAC(ISPEC`(&1 - s) % v + s % ((&1 - t) % u + t % w):real^3`th)) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th; VECTOR_ARITH`(A+B)-C=A+B-C:real^3`]) +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`h:real`;`norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`]REAL_LT_INV2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv(norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3))`;`norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)*(t-a:real)`]REAL_LE_MUL) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`NORM_POS_LE) +THEN MP_TAC(ISPEC`norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`REAL_LE_INV) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`inv(norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3))`;`inv(h:real)`;`inv(norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x:real^3)) * norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x:real^3)*(t-a:real)`;`inv(h:real)*(h':real)*(h * h * inv h' * inv (norm (u - w:real^3)) * d)`;]REAL_LT_MUL2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`norm (u - w:real^3)`; +`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3)) * + inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)) * + norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x) * + (t-a)`;`inv h * inv h * h' * h * h * inv h' * inv (norm (u - w:real^3)) * d`;]REAL_LT_LMUL) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(B*C)*E*A*D`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(A*B)*E*(C*D)`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(A*B)*E*(C*D)`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D=(A*B)*C*D`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B*C*D*E=(A*B)*(C*D)*E`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`(A*B*C)*D*E=A*B*(C*D)*E`] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B*C)*D=A*B*(C*D)`] +THEN REDUCE_ARITH_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`((A*B)*C*D)*E=(A*C)*(B*D)*E`] +THEN REDUCE_ARITH_TAC +THEN REWRITE_TAC[REAL_ARITH`((A*B)*C)*D*E=(A*B)*(C*D)*E`] +THEN ASSUME_TAC(ISPECL[`u:real^3`;`w:real^3`]NORM_SUB) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN MP_TAC(ISPECL[`t-a:real`;`w-u:real^3`]NORM_MUL) +THEN MP_TAC(ISPEC`t-a:real`REAL_ABS_REFL) +THEN RESP_TAC +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN ASM_REWRITE_TAC[REAL_ARITH`(A*B)*C*D=C*A*(B*D)`] +THEN REDUCE_ARITH_TAC +THEN DISCH_THEN(LABEL_TAC"BA") +THEN MP_TAC(ISPECL[`(v:real^3)`;` (u:real^3) `;`(w:real^3) `;`(t:real) `;`s:real`]expansion_convex_fan) +THEN RESA_TAC +THEN SUBGOAL_THEN`~(x=(&1 - s) % v + s % ((&1 - t) % u + t % w):real^3)` ASSUME_TAC +THENL(*4*)[ +POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"MA") +THEN STRIP_TAC +THEN REMOVE_THEN"MA" MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN ASM_REWRITE_TAC[];(*4*) +MP_TAC(ISPECL[`(&1 - s) % v + s % ((&1 - t) % u + t % w):real^3`;`x:real^3`]imp_norm_not_zero_fan) +THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] +THEN RESA_TAC +THEN MP_TAC(ISPECL[`norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)`;`norm((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`]REAL_SUB_INV) +THEN RESP_TAC +THEN ASM_REWRITE_TAC[REAL_ABS_ABS;REAL_ABS_DIV;REAL_ABS_MUL;REAL_ABS_NORM;real_div;REAL_INV_MUL; +REAL_ARITH`(A*B*C)*D=A*C*(B*D)`] +THEN REDUCE_ARITH_TAC +THEN MP_TAC(ISPECL[`((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`;`((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)`]REAL_ABS_SUB_NORM) +THEN REWRITE_TAC[VECTOR_ARITH` +((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)-((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)=s%(t-a)%(w-u) :real^3`] +THEN ONCE_REWRITE_TAC[NORM_MUL] +THEN MP_TAC(ISPEC`s:real`REAL_ABS_REFL) +THEN RESP_TAC +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`abs + (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3) - + norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x))`;`s * norm ((t-a) % (w - u):real^3)`;`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3))`]REAL_LE_RMUL) +THEN RESA_TAC +THEN REMOVE_THEN "BA" MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(s= &1)\/ ~((s:real) = &1)`) +THENL(*5*)[ +ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*5*) + +MP_TAC(REAL_ARITH`~(s= &1) /\ s<= &1==> (s:real)< &1`) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`((t-a) % (w - u):real^3)`NORM_POS_LE) +THEN MP_TAC(ISPECL[`norm ((t-a) % (w - u):real^3)`;`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3))`]REAL_LE_MUL) +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`s:real`;`&1`;`norm ((t-a) % (w - u)) * + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3))`; +`d:real`]REAL_LT_MUL2) +THEN REDUCE_ARITH_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]]]]);; + + +let exists_point_small_edges_not0_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) d:real a:real. +FAN(x,V,E) /\ {v,u} IN E/\ {u,w} IN E /\ ~(coplanar{x,v,u,w}) /\ &0 < d +/\ &0 +?(h:real). a (!(s:real). &0 <= s /\ s <= &1 +==> norm(inv(norm((&1-s)%v+s%((&1-a)%u+ a%w)-x))%((&1-s)%v+s%((&1-a)%u+ a%w)-x) - inv(norm((&1-s)%v+s%((&1-t)%u+ t%w)-x))% ((&1-s)%v+s%((&1-t)%u+ t%w)-x))< d ))`, + +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0< (d:real)==> &0< d/ &2`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3) `;`(w:real^3)`]origin_point_not_in_convex_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3) `;`(w:real^3)`;` (d:real)/ &2`;`a:real`]inequaility2_not0_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool) `;`(v:real^3)`;` (u:real^3)`;` (w:real^3)`;` (d:real)/ &2`;`a:real`]inequality1_not0_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"B") +THEN EXISTS_TAC`min (h:real) (h':real)` +THEN STRIP_TAC +THENL[ASM_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ +ASM_TAC +THEN REAL_ARITH_TAC; +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`t< min (h:real) (h':real)==> t< (h:real) /\ t< (h':real)`) +THEN RESA_TAC +THEN REMOVE_THEN"B" (fun th-> MP_TAC(ISPEC`t:real`th)) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`s:real`th)) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"B") +THEN REMOVE_THEN"A" (fun th-> MP_TAC(ISPEC`t:real`th)) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`s:real`th)) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN ASSUME_TAC(ISPEC`((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`NORM_POS_LE) +THEN MP_TAC(ISPEC`norm ((&1 - s) % v + s % ((&1 - t) % u + t % w)-x:real^3)`REAL_LE_INV) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`s * + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3)):real`;`(((&1 - a) % u + a % w) - ((&1 - t) % u + t % w)):real^3`]NORM_MUL) +THEN REWRITE_TAC[REAL_ABS_MUL] +THEN MP_TAC(ISPEC`s:real`REAL_ABS_REFL) +THEN RESP_TAC +THEN MP_TAC(ISPEC`inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x:real^3)):real`REAL_ABS_REFL) +THEN RESP_TAC +THEN REWRITE_TAC[REAL_ARITH`(A*B)*C=A*B*C`] +THEN DISCH_TAC +THEN REMOVE_THEN"B"MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN REWRITE_TAC[VECTOR_ARITH`(s * inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x))) % + (((&1 - a) % u + a % w) - ((&1 - t) % u + t % w))= inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3`] + +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`norm(inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3)`;`(d:real)/ &2`; +`norm + (inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x) - + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x):real^3)`;`(d:real)/ &2`; +]REAL_LT_ADD2) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`d / &2 + d/ &2 = d`] +THEN MP_TAC(ISPECL[`(inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3)`; +`(inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x) - + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x):real^3)`]NORM_TRIANGLE) +THEN REWRITE_TAC[VECTOR_ARITH`(inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)- inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x):real^3)+ +(inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x) - + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x):real^3)=(inv (norm ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x)) % ((&1 - s) % v + s % ((&1 - a) % u + a % w) - x) - + inv (norm ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) % + ((&1 - s) % v + s % ((&1 - t) % u + t % w) - x)) `] +THEN REAL_ARITH_TAC]]);; + + + +(*********************************) + + +let separate1_sphere_not0_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3) (v1:real^3) (u1:real^3) a:real. + +FAN(x,V,E) /\ {v,u} INTER {v1,u1}={} /\ {v,u} IN E/\ {u,w} IN E /\ {v1,u1} IN E +/\ ~(coplanar{x,v,u,w}) +/\ (&0< azim x u w v ) /\ (azim x u w v +?h:real. +(a < h) /\ (h<= &1) +/\ +(!t:real. a aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge {x} {v1, u1} INTER ballnorm_fan x={})`, +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC exist_close1_fan[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`w:real^3`;`(v1:real^3)`;` (u1:real^3)`;`a:real`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THA") +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`;] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A" ) +THEN MRESA_TAC exists_point_small_edges_not0_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(v:real^3)`;`(u:real^3) `;`(w:real^3)`;`h:real`;`a:real`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"B" ) +THEN EXISTS_TAC`min (a+((h'-a:real)/ &2)) (&1:real)` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*1*)[ +MP_TAC(REAL_ARITH`a< h':real==> &0< (h'-a)/ &2`) +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC`a:real< &1` +THEN REAL_ARITH_TAC;(*1*) +STRIP_TAC +THENL(*2*)[ +ASM_TAC +THEN REAL_ARITH_TAC;(*2*) +REPEAT STRIP_TAC +THEN REWRITE_TAC[EXTENSION] +THEN GEN_TAC +THEN EQ_TAC +THENL(*3*)[ +STRIP_TAC +THEN REWRITE_TAC[EMPTY;IN_ELIM_THM] +THEN SUBGOAL_THEN `!y1:real^3. + y1 IN aff_gt {x} {v, (&1-t)%u+(t:real)% (w:real^3)} INTER ballnorm_fan x +==> ?y2:real^3. y2 IN aff_ge {x:real^3} {(v:real^3), ((&1 - a) % u + a % w:real^3)} INTER ballnorm_fan x /\ + dist (y1,y2)<(h:real)` ASSUME_TAC +THENL(*4*)[ +MP_TAC(REAL_ARITH`&0 &0 MP_TAC(ISPEC`a:real`th)) +THEN REMOVE_THEN"A" (fun th-> MP_TAC(ISPEC`t:real`th)) +THEN RESA_TAC +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MRESA_TAC same_projective_sphere_gt_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(v:real^3)`;`(u:real^3) `;`(w:real^3)`;` (t:real) `;`(y1:real^3)`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] +THEN MRESA_TAC AFF_GE_1_2[`(x:real^3)` ;` (v:real^3)`;`((&1 - a) % u + a % w:real^3) `;] +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;dist] +THEN MRESA_TAC expansion_convex_fan[`(v:real^3)`;` (u:real^3)`;`w:real^3`;`a:real`;` s:real`;] +THEN MRESA_TAC origin_point_not_in_convex_fan[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`w:real^3`] +THEN SUBGOAL_THEN`~(x=(&1-s)%v+s%((&1 - a) % u + a % w):real^3)` ASSUME_TAC +THENL(*5*)[ +POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN RESA_TAC;(*5*) +MP_TAC(ISPECL[`x:real^3`;`(&1 - s) % v + s % ((&1 - a) % u + a % w):real^3`]imp_norm_not_zero_fan) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[NORM_SUB] +THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-C=A+B-C:real^3`] +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`(&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(&0 =norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)) /\ &0 <= norm((&1 - s) % v + s % ((&1 - a) % u + a % w)-x:real^3)==> &0 MP_TAC(ISPEC`t:real`th)) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`s:real`th)) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[NORM_SUB]](*6*)](*5*);(*4*) +POP_ASSUM (fun th->MP_TAC(ISPEC`x':real^3`th)) +THEN MP_TAC(SET_RULE` x' IN aff_gt {x} {v, (&1 - t) % u + t % w} INTER aff_ge {x} {v1, u1} INTER + ballnorm_fan x ==> x' IN aff_ge {x} {v1, u1:real^3} INTER ballnorm_fan x +/\ x' IN aff_gt {x} {v, (&1 - t) % u + t % w:real^3} INTER ballnorm_fan x`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN SIMP_TAC[] +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THA" (fun th-> MP_TAC(ISPECL[`y2:real^3`;`x':real^3`]th)) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN SIMP_TAC[dist;NORM_SUB] +THEN REAL_ARITH_TAC](*4*);(*3*) + +SET_TAC[]]]]);; + + + +let fan_run_in_small11_not0_is_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 v1:real^3 u1:real^3 a:real. +FAN(x,V,E) /\ {v,u} INTER {v1,u1}={} /\ {v,u} IN E/\ {u,w} IN E /\ {v1,u1} IN E +/\ ~(coplanar{x,v,u,w}) +/\ (&0< azim x u w v ) /\ (azim x u w v +?t1:real. a < t1 /\ t1 <= &1 +/\ (!t:real. a< t /\ t< t1 ==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v1,u1}={})`, + +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u1:real^3)`; +` (v1:real^3)`] +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`;] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"BA") +THEN MRESA_TAC separate1_sphere_not0_fan[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3)`;` (w:real^3)`;` (v1:real^3)`;`(u1:real^3)`;`a:real`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH` a < &1 /\ a < h ==> a < min (h:real) (&1:real)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH` h <= &1==> min (h:real) (&1:real)<= &1`) +THEN RESA_TAC +THEN EXISTS_TAC`min (h:real) (&1:real)` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH` &0< a /\ a < t /\ t< min (h:real) (&1:real)==> t< h /\ t<= &1 /\ &0 <= t/\ &0 MRESA1_TAC th `(t:real)`) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN REMOVE_THEN "BA"(fun th-> MRESA1_TAC th `(t:real)`) +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] +THEN MRESA_TAC origin_is_not_aff_gt_fan[`x:real^3`;`v:real^3`;`(&1-t)%u+t%w:real^3`] +THEN REWRITE_TAC[EXTENSION;INTER;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +REPEAT STRIP_TAC +THEN SUBGOAL_THEN`~(x=x':real^3)`ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; +MRESA_TAC imp_norm_not_zero_fan[`x':real^3`;`x:real^3`] +THEN ASSUME_TAC(ISPEC`x'-x:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(norm(x'-x:real^3)= &0) /\ &0 <= norm(x'-x:real^3)==> &0 MRESA_TAC th [`x':real^3`;`inv(norm(x'-x:real^3))`]) +THEN MRESA_TAC scale_aff_gt_fan[`x:real^3`;`v:real^3`;`(&1-t)%u+t%w:real^3`] +THEN POP_ASSUM(fun th -> MRESA_TAC th [`x':real^3`;`inv(norm(x'-x:real^3))`]) +THEN SUBGOAL_THEN`inv (norm (x' - x)) % (x' - x) + x IN ballnorm_fan x:real^3->bool` ASSUME_TAC +THENL[ +MRESA1_TAC REAL_ABS_REFL `inv(norm(x'-x:real^3))` +THEN ASM_REWRITE_TAC[ballnorm_fan;IN_ELIM_THM;dist;VECTOR_ARITH`B-(A+B)= --A:real^3`;NORM_NEG;NORM_MUL]; +ASM_TAC +THEN SET_TAC[]]]; + +SET_TAC[]]);; + + +let fan_run_in_small1_not0_is_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 v1:real^3 u1:real^3 a:real. +FAN(x,V,E) /\ {v,u} INTER {v1,u1}={} /\ {v,u} IN E/\ {u,w} IN E /\ {v1,u1} IN E +/\ ~(coplanar{x,v,u,w}) +/\ (&0< azim x u w v ) /\ (azim x u w v aff_gt {x} {v, (&1 - s) % u + s % w} INTER + {v | ?e. e IN E /\ v IN aff_ge {x} e} = + {}) +==> +(?t1:real. a < t1 /\ t1 <= &1 +/\ (!t:real. &0< t /\ t< t1 ==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v1,u1}={}))`, +REPEAT STRIP_TAC +THEN MRESA_TAC fan_run_in_small11_not0_is_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;` w:real^3`;`v1:real^3`;`u1:real^3`;`a:real`] +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN MP_TAC(REAL_ARITH`&0((&0 (&0bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 w1:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {v,w1} IN E +/\ ~coplanar {x,v,u,w} +/\ (&0< azim x u w v ) /\ (azim x u w v aff_gt {x} {v, (&1 - s) % u + s % w} INTER + {v | ?e. e IN E /\ v IN aff_ge {x} e} = + {}) +==> ?t1. a < t1 /\ t1<= &1 +/\ (!t:real. &0< t /\ t< t1==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v,w1}={})`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MAI MAI") +THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`;] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN DISJ_CASES_TAC(SET_RULE`(?h:real. a &0<=t`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`(t:real)< (h:real) /\ h <= &1 ==> t < &1`) +THEN RESA_TAC +THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `t:real`) +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (v:real^3)`] +THEN REWRITE_TAC[INTER;EXTENSION;IN_ELIM_THM;] +THEN GEN_TAC +THEN EQ_TAC +THENL(*4*)[ + +DISCH_TAC +THEN SUBGOAL_THEN `(&1-t)%u+t%w IN aff_ge {x,v} {w1}:real^3->bool` ASSUME_TAC +THENL(*5*)[ +POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-t)%u +t%w:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2 % v + t3 % ((&1 - t) % u + t % w) = + t1'' % x + t2' % v + t3' % w1<=> t3 % ((&1 - t) % u + t % w) = + (t1''-t1') % x + (t2'-t2) % v + t3' % w1:real^3`] +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`(t3:real)` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3 % ((&1 - t) % u + t % w) = (t1'-t1) % x + (t2'-t2) % v + t3' % w1:real^3 +==> (inv (t3))%(t3 % ((&1 - t) % u + t % w)) = (inv (t3))%((t1'-t1) % x + (t2'-t2) % v + t3' % w1)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;VECTOR_ARITH`A%(B%X+C%Y+D%Z)=(A*B)%X+(A*C)%Y+(A*D)%Z`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`t1' + t2' + t3' = &1:real` +THEN FIND_ASSUM MP_TAC`t1 + t2 + t3 = &1:real` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM(th)]) +THEN REWRITE_TAC[REAL_ARITH`t1'' + t2' + t3' = t1' + t2 + t3<=> (t1''-t1') + (t2'-t2) + t3' = t3:real`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +(t1'-t1) + (t2'-t2) + t3' = t3 +==> (inv (t3))*((t1'-t1) + (t2'-t2) + t3') = (inv (t3))*t3`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C+D)=A*B+A*C+A*D`] +THEN STRIP_TAC +THEN EXISTS_TAC`inv t3 * (t1' - t1):real` +THEN EXISTS_TAC`inv t3 * (t2' - t2):real` +THEN EXISTS_TAC`inv t3 * t3':real` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_INV +THEN ASM_TAC +THEN REAL_ARITH_TAC;(*5*) + +MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`;`(&1 - t) % u + t % w:real^3`;] +THEN MRESA_TAC injective_azim_coplanar[`x:real^3`;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th->MRESA_TAC th [`h:real`;`t:real`]) +THEN ASM_TAC +THEN REAL_ARITH_TAC](*5*)(*4*); +SET_TAC[]]]];(*1*) +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NOT_EXISTS_THM] +THEN DISCH_THEN(LABEL_TAC"B") +THEN EXISTS_TAC`&1:real` +THEN ASM_REWRITE_TAC[REAL_ARITH `&1<= &1`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 &0<=t`) +THEN RESA_TAC +THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `t:real`) +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (v:real^3)`] +THEN REWRITE_TAC[INTER;EXTENSION;IN_ELIM_THM;] +THEN GEN_TAC +THEN EQ_TAC +THENL(*2*)[ +DISCH_TAC +THEN SUBGOAL_THEN `(&1-t)%u+t%w IN aff_ge {x,v} {w1}:real^3->bool` ASSUME_TAC +THENL(*3*)[ +POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-t)%u +t%w:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2 % v + t3 % ((&1 - t) % u + t % w) = + t1'' % x + t2' % v + t3' % w1<=> t3 % ((&1 - t) % u + t % w) = + (t1''-t1') % x + (t2'-t2) % v + t3' % w1:real^3`] +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`(t3:real)` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3 % ((&1 - t) % u + t % w) = (t1'-t1) % x + (t2'-t2) % v + t3' % w1:real^3 +==> (inv (t3))%(t3 % ((&1 - t) % u + t % w)) = (inv (t3))%((t1'-t1) % x + (t2'-t2) % v + t3' % w1)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;VECTOR_ARITH`A%(B%X+C%Y+D%Z)=(A*B)%X+(A*C)%Y+(A*D)%Z`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`t1' + t2' + t3' = &1:real` +THEN FIND_ASSUM MP_TAC`t1 + t2 + t3 = &1:real` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM(th)]) +THEN REWRITE_TAC[REAL_ARITH`t1'' + t2' + t3' = t1' + t2 + t3<=> (t1''-t1') + (t2'-t2) + t3' = t3:real`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +(t1'-t1) + (t2'-t2) + t3' = t3 +==> (inv (t3))*((t1'-t1) + (t2'-t2) + t3') = (inv (t3))*t3`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C+D)=A*B+A*C+A*D`] +THEN STRIP_TAC +THEN EXISTS_TAC`inv t3 * (t1' - t1):real` +THEN EXISTS_TAC`inv t3 * (t2' - t2):real` +THEN EXISTS_TAC`inv t3 * t3':real` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_INV +THEN ASM_TAC +THEN REAL_ARITH_TAC;(*3*) +MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v:real^3`;`(&1 - t) % u + t % w:real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`;`(&1 - t) % u + t % w:real^3`;] +THEN REMOVE_THEN "B"(fun th -> MRESAL1_TAC th `t:real`[DE_MORGAN_THM; REAL_ARITH`~(A B MRESA1_TAC th `t:real`) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `{v,w1:real^3} IN E` +THEN SET_TAC[]; +REMOVE_THEN"MAI MAI" MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `{v,w1:real^3} IN E` +THEN SET_TAC[]; +ASM_TAC +THEN REAL_ARITH_TAC](*4*)]; +SET_TAC[]]]);; + + + + + + + + + +let fan_run_in_small3_not0_is_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 w1:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {u,w1} IN E +/\ ~coplanar {x,v,u,w} /\ sigma_fan x V E u w=v +/\ (&0< azim x u w v ) /\ (azim x u w v aff_gt {x} {v, (&1 - s) % u + s % w} INTER + {v | ?e. e IN E /\ v IN aff_ge {x} e} = + {}) +==> ?t1. a < t1 /\ t1 <= &1 +/\ (!t:real. &0< t /\ t< t1==> aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {u,w1}={})`, +REPEAT STRIP_TAC +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`;] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN EXISTS_TAC`&1:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1<= &1`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 &0<=t /\ ~(t= &0)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< &1 ==>t<= &1`) +THEN RESA_TAC +THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th `t:real`) +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - t) % (u:real^3) + t % (w:real^3)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (u:real^3)`] +THEN REWRITE_TAC[EXTENSION;INTER;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL(*1*)[ +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1-t)%u +t%w:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN `x' IN (aff_ge {x,u} {w1}:real^3->bool)`ASSUME_TAC +THENL(*2*)[ +POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`u:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`u:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`t1':real` +THEN EXISTS_TAC`t2':real` +THEN EXISTS_TAC`t3':real` +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC inequality3_aim_in_convex_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;` w:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `t:real`) +THEN POP_ASSUM(fun th-> MRESA_TAC th [`t1:real`;`t2:real`;`t3:real`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"BE") +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN SUBGOAL_THEN`~collinear {x, u, x':real^3}`ASSUME_TAC +THENL(*3*)[ +MRESA_TAC continuous_coplanar_fan [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `t:real`) +THEN ASM_REWRITE_TAC[collinear_fan;] +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[coplanar;aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`u:real^3` +THEN SUBGOAL_THEN`(x:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL(*4*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; + +SUBGOAL_THEN`(v:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; +SUBGOAL_THEN`(u:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL(*6*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN REDUCE_ARITH_TAC +THEN VECTOR_ARITH_TAC; +SUBGOAL_THEN`((&1 - t) % u + t % w:real^3)IN affine hull {x,v,u:real^3}` ASSUME_TAC +THENL(*7*)[ +REWRITE_TAC[ AFFINE_HULL_3;IN_ELIM_THM] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(t3:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + t2 % v + t3 % ((&1 - t) % u + t % w) = u' % x + v' % u +<=>t3 % ((&1 - t) % u + t % w) = (u'-t1') % x -t2 % v+v' % u:real^3`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3 % ((&1 - t) % u + t % w) = (u'-t1) % x -t2 % v+v' % u +==> (inv (t3))%(t3 % ((&1 - t) % u + t % w) ) = (inv (t3))%((u'-t1) % x -t2 % v+v' % u):real^3`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B-C+D)=A%B-A%C+A%D`;VECTOR_ARITH`A%B%C=(A*B)%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`(inv t3 * (u' - t1)):real` +THEN EXISTS_TAC`-- (inv t3 * t2):real` +THEN EXISTS_TAC`(inv t3 * v'):real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A+(--b)%C+d=A-b%C+d`;REAL_ARITH`inv t3 * (u' - t1') + --(inv t3 * t2) + inv t3 * v'=inv t3 * (t3+(u'+v') - (t1'+ t2+t3))`;REAL_ARITH`A+ &1- &1=A`];(*7*) + +ASM_TAC +THEN SET_TAC[]](*7*)](*6*)](*5*)](*4*);(*3*) + +MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`u:real^3`;`x':real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`u:real^3`;`x':real^3`;`w1:real^3`;] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`;`x':real^3`;] +THEN REMOVE_THEN"BE" MP_TAC +THEN REMOVE_THEN"YEU" MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN FIND_ASSUM MP_TAC`(sigma_fan x V E u w = (v:real^3))` +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge u V E = {w:real^3}) \/ ~(set_of_edge u V E = {w})`) +THENL(*4*)[ +FIND_ASSUM MP_TAC`w1 IN set_of_edge (u:real^3) V E` +THEN POP_ASSUM (fun th-> REWRITE_TAC[(th);IN_SING]) +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC (ISPECL[`x:real^3`;`u:real^3`;`w:real^3`]AZIM_REFL) +THEN REAL_ARITH_TAC;(*4*) + +DISJ_CASES_TAC(SET_RULE`(w1:real^3)=w \/ ~((w1:real^3)=w)`) +THENL(*5*)[ +ASM_REWRITE_TAC[] +THEN MP_TAC (ISPECL[`x:real^3`;`u:real^3`;`w:real^3`]AZIM_REFL) +THEN REAL_ARITH_TAC; +MRESA_TAC SIGMA_FAN[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(u:real^3)`;`(w:real^3)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w1:real^3`) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]]]; + +SET_TAC[]]);; + + + + + +let fan_run_in_small_not0_is_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 v1:real^3 w1:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {v1,w1} IN E +/\ (&0< azim x u w v ) /\ (azim x u w v aff_gt {x} {v, (&1 - s) % u + s % w} INTER + {v | ?e. e IN E /\ v IN aff_ge {x} e} = + {}) + +==> +?t1:real. a aff_gt{x} {v,(&1-t)%u+ t % w} INTER aff_ge{x} {v1,w1}={})`, + + +(let lem=prove(`!x v v1. aff_ge {x} {v1, v}=aff_ge {x} {v, v1}`, +REPEAT STRIP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{v,u}={u,v}`] +THEN SIMP_TAC[]) in + +REPEAT STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN DISJ_CASES_TAC(SET_RULE`(v1=v)\/ ~(v1=v:real^3)`) +THENL[ +MRESA_TAC fan_run_in_small2_not0_is_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v1:real^3`;`u:real^3`;` w:real^3`;`w1:real^3`;`a:real`]; + +DISJ_CASES_TAC(SET_RULE`(v1=u)\/ ~(v1=u:real^3)`) +THENL[ +MRESA_TAC fan_run_in_small3_not0_is_fan[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` v1:real^3`;` w:real^3`;`w1:real^3`;`a:real`]; + DISJ_CASES_TAC(SET_RULE`(w1=v)\/ ~(w1=v:real^3)`) +THENL[ +FIND_ASSUM MP_TAC`{v1,w1} IN (E:(real^3->bool)->bool)` +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{v,u}={u,v}`] +THEN STRIP_TAC +THEN MRESA_TAC fan_run_in_small2_not0_is_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w1:real^3`;`u:real^3`;` w:real^3`;`v1:real^3`;`a:real`] +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[lem]; +DISJ_CASES_TAC(SET_RULE`(w1=u)\/ ~(w1=u:real^3)`) +THENL[ +FIND_ASSUM MP_TAC`{v1,w1} IN (E:(real^3->bool)->bool)` +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{v,u}={u,v}`] +THEN STRIP_TAC +THEN MRESA_TAC fan_run_in_small3_not0_is_fan[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` w1:real^3`;` w:real^3`;`v1:real^3`;`a:real`] +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[lem]; +SUBGOAL_THEN`{v,u} INTER {v1,w1:real^3}={}` ASSUME_TAC +THENL[ +ASM_TAC +THEN SET_TAC[]; +MRESA_TAC fan_run_in_small1_not0_is_fan[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;` w:real^3`;`v1:real^3`;`w1:real^3`;`a:real`]]]]]]));; + + +let fan_run1_in_small_not0_is_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) (E':(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ E' SUBSET E +/\ (&0< azim x u w v ) /\ (azim x u w v aff_gt {x} {v, (&1 - s) % u + s % w} INTER + {v | ?e. e IN E /\ v IN aff_ge {x} e} = + {}) +==> +?h:real. a aff_gt{x} {v,(&1-s)%u+ s % w} INTER {v | ?e. e IN E' /\ v IN aff_ge {x} e}={})`, + +REPEAT STRIP_TAC +THEN MRESA_TAC set_edges_is_finite_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC FINITE_SUBSET [`(E':(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`] +THEN ABBREV_TAC`n=CARD (E':(real^3->bool)->bool)` +THEN REPEAT(POP_ASSUM MP_TAC) +THEN SPEC_TAC (`(E':(real^3->bool)->bool)`,`(E':(real^3->bool)->bool)`) +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC +THENL(*1*)[ +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`E':(real^3->bool)->bool`]CARD_EQ_0) +THEN RESA_TAC +THEN EXISTS_TAC`a+ (&1-a:real) / &2` +THEN MP_TAC(REAL_ARITH`&0 a< a+ (&1-a:real) / &2/\ a+ (&1-a:real) / &2 <= &1`) +THEN RESA_TAC +THEN ASM_SET_TAC[];(*1*) + +REPEAT GEN_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC "A") +THEN REPEAT STRIP_TAC +THEN MP_TAC(ISPEC`(E':(real^3->bool)->bool)` CHOOSE_SUBSET) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`n:num `th)) +THEN REWRITE_TAC[ARITH_RULE `n:num <= SUC n`; HAS_SIZE] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` t SUBSET E' /\ E' SUBSET E ==> (t:(real^3->bool)->bool) SUBSET E`) +THEN RESA_TAC +THEN REMOVE_THEN "A" (fun th-> MP_TAC(ISPEC`(t:(real^3->bool)->bool)`th)) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN SUBGOAL_THEN `~((E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)= {})` ASSUME_TAC +THENL(*2*)[ +STRIP_TAC +THEN MP_TAC(SET_RULE`(E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)={} /\ t SUBSET E' ==> t= E'`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`CARD (t:(real^3->bool)->bool)=n` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC;(*2*) +SUBGOAL_THEN`?e. e IN (E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)` ASSUME_TAC +THENL(*3*)[ +ASM_SET_TAC[];(*3*) + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`e IN (E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)/\ +(E':(real^3->bool)->bool) SUBSET (E:(real^3->bool)->bool) /\ t SUBSET E' ==> e IN E'/\ e IN E/\ ~(e IN t) /\ {e} UNION t SUBSET E'`) +THEN RESA_TAC +THEN MP_TAC(ISPECL [`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;`(E':(real^3->bool)->bool)`] FINITE_SUBSET) +THEN RESA_TAC +THEN ASSUME_TAC(SET_RULE`e IN {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`) +THEN MP_TAC(ISPECL[`e:real^3->bool`;`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `e IN {e:(real^3->bool)} UNION (t:(real^3->bool)->bool) +==> ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e PSUBSET {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))DELETE e`;`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`]CARD_PSUBSET) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`FINITE ( {e:(real^3->bool)} UNION (t:(real^3->bool)->bool))` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN DISCH_TAC +THEN MP_TAC(ARITH_RULE`CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) < CARD ( {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) +/\ CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) = CARD ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))-1 +<=>CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) +1= CARD ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th;]) +THEN REWRITE_TAC[ARITH_RULE`A=A`; ] +THEN MP_TAC(SET_RULE`~(e IN t)==>({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e=t`) +THEN RESA_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`(CARD (E':(real^3->bool)->bool)=SUC n)` +THEN REWRITE_TAC[ARITH_RULE`SUC n=(n:num) +1`] +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;`E':(real^3->bool)->bool`]CARD_SUBSET_EQ) +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MA") +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`]expand_edge_graph_fan) +THEN RESA_TAC +THEN MRESA_TAC fan_run_in_small_not0_is_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w:real^3`;`v':real^3`;`w':real^3`;`a:real`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"BE") +THEN EXISTS_TAC` min (h:real) (t1:real)` +THEN STRIP_TAC +THENL(*4*)[ +ASM_TAC +THEN REAL_ARITH_TAC;(*4*) + +STRIP_TAC +THENL(*5*)[ +ASM_TAC +THEN REAL_ARITH_TAC;(*5*) +REPEAT STRIP_TAC +THEN REMOVE_THEN "MA" MP_TAC +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) +THEN REWRITE_TAC[UNION;IN_ELIM_THM;EXTENSION; INTER;] +THEN GEN_TAC +THEN EQ_TAC +THENL(*6*)[ +ASM_REWRITE_TAC[IN_SING] +THEN MP_TAC(REAL_ARITH`s< min h t1==> s MRESA1_TAC th `s:real`) +THEN ASM_SET_TAC[]; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th `s:real`) +THEN ASM_SET_TAC[]]; +SET_TAC[]]]]]]]);; + + + + + + + +let cut_in_edges_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ~(aff_gt{x} {v,(&1-a)%u+ a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={}) +==> a= &1 `, +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN ABBREV_TAC`s1={h:real| &0< h/\ h<= &1 /\ +~(aff_gt{x} {v,(&1-h)%u+ h % w:real^3} INTER {v | ?e. e IN E /\ v IN aff_ge {x:real^3} e}={})}` +THEN SUBGOAL_THEN`(a:real) IN (s1:real->bool)` ASSUME_TAC +THENL(*1*)[ +POP_ASSUM(fun th->ASM_REWRITE_TAC[SYM(th);IN_ELIM_THM]); + +MP_TAC(SET_RULE`(a:real) IN (s1:real->bool)==> ~(s1={})`) +THEN RESA_TAC +THEN SUBGOAL_THEN`(?b. !x:real. x IN s1 ==> b <= x)`ASSUME_TAC +THENL(*2*)[ +EXISTS_TAC`&0` +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th->ASM_REWRITE_TAC[SYM(th);IN_ELIM_THM]) +THEN REAL_ARITH_TAC; +MRESA1_TAC INF`s1:real->bool` +THEN ABBREV_TAC`b= inf (s1:real->bool)` +THEN SUBGOAL_THEN`b<= &1` ASSUME_TAC +THENL(*3*)[POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `a:real`) +THEN ASM_TAC +THEN REAL_ARITH_TAC;(*3*) + +SUBGOAL_THEN`~(?s. &0 < s /\ s < b + /\ ~( aff_gt {x} {v, (&1 - s) % u + s % w} INTER + {v | ?e. e IN E /\ v IN aff_ge {x:real^3} e} = + {}))` ASSUME_TAC +THENL(*4*)[STRIP_TAC +THEN SUBGOAL_THEN`s IN (s1:real->bool)` ASSUME_TAC +THENL(*5*)[ EXPAND_TAC"s1" +THEN REWRITE_TAC[IN_ELIM_THM] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN REAL_ARITH_TAC;(*5*) +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th->MP_TAC(ISPEC`s:real` th)) +THEN DISCH_THEN (LABEL_TAC"DICH") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"DICH" MP_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC];(*4*) +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM NOT_IMP; GSYM NOT_FORALL_THM;IMP_IMP] +THEN STRIP_TAC +THEN MRESA_TAC fan_run_in_small_is_not_meet_xfan [`x:real^3`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;`u:real^3`;`w:real^3`] +THEN SUBGOAL_THEN`~(?x:real. x IN s1 /\ ~(h <= x))`ASSUME_TAC +THENL(*5*)[ +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN EXPAND_TAC"s1" +THEN REWRITE_TAC[IN_ELIM_THM; REAL_ARITH`~(A<=B)<=> B MRESA1_TAC th `x':real`);(*5*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM NOT_IMP; GSYM NOT_FORALL_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN`&0MP_TAC(ISPEC`h:real` th)) +THEN DISCH_THEN (LABEL_TAC"DICH") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"DICH" MP_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*6*) +MRESA_TAC not_cut_inside_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3` ;`b:real`] +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(b:real)< &1\/ &1 <= b`) +THENL(*7*)[ +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESAL_TAC fan_run1_in_small_not0_is_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`b:real`][SET_RULE`A SUBSET A`] +THEN SUBGOAL_THEN`~(?x:real. x IN s1 /\ ~(h' <= x))`ASSUME_TAC +THENL(*8*)[ +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN EXPAND_TAC"s1" +THEN REWRITE_TAC[IN_ELIM_THM; REAL_ARITH`~(A<=B)<=> B MRESA1_TAC th `x':real`);(*8*) +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM NOT_IMP; GSYM NOT_FORALL_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN `h':real <= b`ASSUME_TAC +THENL(*9*)[POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th->MP_TAC(ISPEC`h':real` th)) +THEN REWRITE_TAC[];(*9*) +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC](*9*)](*8*);(*7*) + +STRIP_TAC +THEN MP_TAC(REAL_ARITH`&1<=b /\ b<= &1==> b= &1`) THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th->MP_TAC(ISPEC`a:real` th)) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]]]]]]]);; + + + + + + +let not_cut_in_edges_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +==> (aff_gt{x} {v,(&1-a)%u+ a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={})`, + +REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(?a. &0< a /\ a< &1 /\ ~(aff_gt{x} {v,(&1-a)%u+ a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={})) \/ (!a. &0< a /\ a< &1 ==> (aff_gt{x} {v,(&1-a)%u+ a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x:real^3} e}={})) `) +THENL[ +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM BE") +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN ABBREV_TAC`s1={h:real| &0< h/\ h< &1 /\ +~(aff_gt{x} {v,(&1-h)%u+ h % w:real^3} INTER {v | ?e. e IN E /\ v IN aff_ge {x:real^3} e}={})}` +THEN SUBGOAL_THEN`(a':real) IN (s1:real->bool)` ASSUME_TAC +THENL(*1*)[ +POP_ASSUM(fun th->ASM_REWRITE_TAC[SYM(th);IN_ELIM_THM]); +MP_TAC(SET_RULE`(a':real) IN (s1:real->bool)==> ~(s1={})`) +THEN RESA_TAC +THEN SUBGOAL_THEN`(?b. !x:real. x IN s1 ==> b <= x)`ASSUME_TAC +THENL(*2*)[EXISTS_TAC`&0` +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th->ASM_REWRITE_TAC[SYM(th);IN_ELIM_THM]) +THEN REAL_ARITH_TAC;(*2*) +MRESA1_TAC INF`s1:real->bool` +THEN ABBREV_TAC`b= inf (s1:real->bool)` +THEN SUBGOAL_THEN`b< &1` ASSUME_TAC +THENL(*3*)[ +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `a':real`) +THEN ASM_TAC +THEN REAL_ARITH_TAC;(*3*) + SUBGOAL_THEN`~(?s. &0 < s /\ s < b + /\ ~( aff_gt {x} {v, (&1 - s) % u + s % w} INTER + {v | ?e. e IN E /\ v IN aff_ge {x:real^3} e} = + {}))` ASSUME_TAC +THENL(*4*)[ +STRIP_TAC +THEN SUBGOAL_THEN`s IN (s1:real->bool)` ASSUME_TAC +THENL(*5*)[EXPAND_TAC"s1" +THEN REWRITE_TAC[IN_ELIM_THM] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN REAL_ARITH_TAC;(*5*) +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th->MP_TAC(ISPEC`s:real` th)) +THEN DISCH_THEN (LABEL_TAC"DICH") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"DICH" MP_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC];(*4*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM NOT_IMP; GSYM NOT_FORALL_THM;IMP_IMP] +THEN STRIP_TAC +THEN MRESA_TAC fan_run_in_small_is_not_meet_xfan [`x:real^3`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;`u:real^3`;`w:real^3`] +THEN SUBGOAL_THEN`~(?x:real. x IN s1 /\ ~(h <= x))`ASSUME_TAC +THENL(*5*)[POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN EXPAND_TAC"s1" +THEN REWRITE_TAC[IN_ELIM_THM; REAL_ARITH`~(A<=B)<=> B MRESA1_TAC th `x':real`);(*5*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM NOT_IMP; GSYM NOT_FORALL_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN`&0MP_TAC(ISPEC`h:real` th)) +THEN DISCH_THEN (LABEL_TAC"DICH") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"DICH" MP_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*6*) +MRESA_TAC not_cut_inside_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3` ;`b:real`] +THEN MRESAL_TAC fan_run1_in_small_not0_is_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`b:real`][SET_RULE`A SUBSET A`] +THEN SUBGOAL_THEN`~(?x:real. x IN s1 /\ ~(h' <= x))`ASSUME_TAC +THENL(*7*)[ +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN EXPAND_TAC"s1" +THEN REWRITE_TAC[IN_ELIM_THM; REAL_ARITH`~(A<=B)<=> B MRESA1_TAC th `x':real`);(*7*) +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM NOT_IMP; GSYM NOT_FORALL_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN `h':real <= b`ASSUME_TAC +THENL(*8*)[POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th->MP_TAC(ISPEC`h':real` th)) +THEN REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]]]]]]]]; + +POP_ASSUM (fun th-> MRESA1_TAC th`a:real`)]);; + + + + + +let lie_in_half_space_and_azim_le=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0 &0 < ((v-x) cross (u - x)) dot (v1-x)`, + + +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_THEN(LABEL_TAC"yeu em") +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "yeu em" (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MP_TAC(ARITH_RULE`&0 &0<= a`) THEN RESA_TAC +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] +THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3) `;] +THEN FIND_ASSUM MP_TAC `v1 IN aff_gt {x} {v,(&1-a)%u+ a%(w:real^3)}` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A- vec 0= A`;VECTOR_ARITH`(t1 % x + t2 % v + t3 % ((&1 - a) % u + a % w)) - x=(t1- &1) % x + t2 % v + t3 % ((&1 - a) % u + a % w)`] +THEN FIND_ASSUM MP_TAC `t1 + t2 + t3 = &1:real` +THEN REWRITE_TAC[REAL_ARITH`t1 + t2 + t3 = &1<=> t1- &1= (-- t2)- t3 `] +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(--t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w)= t2 % (v-x) + t3 % ((&1 - a) % (u-x) + a % (w-x))`] +THEN REWRITE_TAC[ DOT_RADD;DOT_RMUL;DOT_CROSS_SELF] +THEN REDUCE_ARITH_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[CROSS_TRIPLE]);; + + +let cross_dot_fully_surrounded1_fan_le=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0 &0< ((v1 - x) cross (u1 - x)) dot + ((&1 - a) % u + a % w-x)`, + +REPEAT STRIP_TAC +THEN MRESAL_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`; `(&1 - a) % u + a % w:real^3`;`u1:real^3`][VECTOR_ARITH`((&1 - a) % u + a % w) - x=(&1 - a) % u + a % w - x`] +THEN POP_ASSUM MATCH_MP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_THEN(LABEL_TAC"yeu em") +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "yeu em" (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MP_TAC(ARITH_RULE`&0 &0<= a`) THEN RESA_TAC +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`(&1-a)%u+ a%w:real^3`;`v1:real^3`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] +THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3) `;] +THEN FIND_ASSUM MP_TAC `(v1:real^3) IN aff_gt {x} {v,(&1-a)%u+ a%(w:real^3)}` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) +THEN STRIP_TAC +THEN SUBGOAL_THEN`~collinear {x, v1, (&1 - a) % u + a % w:real^3}` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[collinear1_fan;] +THEN FIND_ASSUM MP_TAC`~((&1 - a) % u + a % w IN aff {x, v:real^3})` +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % ((&1 - a) % u + a % w) = + u' % x + v' % ((&1 - a) % u + a % w)<=> +(&1-(t1+t2+t3)) % x + (v'-t3) % ((&1 - a) % u + a % w-x) = + (&1-(u'+v') ) % x + t2 % (v-x)`;REAL_ARITH`a-a= &0`] +THEN REDUCE_VECTOR_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`v' - t3= &0 \/ ~(v' - (t3:real)= &0)`) +THENL[ +ASM_REWRITE_TAC[VECTOR_ARITH`&0 %A=B<=> B= vec 0`;VECTOR_MUL_EQ_0] +THEN MP_TAC(REAL_ARITH`&0< t2==> ~(t2 = &0)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-B= vec 0<=> A=B`]; + +MRESA1_TAC REAL_MUL_LINV `(v'-t3:real)` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(v' - t3) % ((&1 - a) % u + a % w - x) = t2 % (v - x:real^3) ==> (inv (v'-t3)) % (v' - t3) % ((&1 - a) % u + a % w - x) = (inv (v'-t3)) % ( t2 % (v - x))`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C:real^3)`]) +THEN REWRITE_TAC[VECTOR_ARITH`&1 % ((&1 - a) % u + a % w - x) = (inv (v' - t3) * t2) % (v - x)<=> +(&1 - a) % u + a % w = (&1-(inv (v' - t3) * t2))%x +(inv (v' - t3) * t2) % v:real^3`] +THEN STRIP_TAC +THEN EXISTS_TAC`&1-(inv (v' - t3) * (t2:real))` +THEN EXISTS_TAC`(inv (v' - t3) * (t2:real))` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN DISCH_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v1:real^3`;`v:real^3`;`u1:real^3`;`((&1 - a) % u + a % w):real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"B") +THEN DISCH_TAC +THEN SUBGOAL_THEN`azim x v1 v ((&1 - a) % u + a % w)= pi` ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;`v1:real^3`;` (v:real^3)`] +THEN MRESA_TAC AFF_LT_2_1[`x:real^3`;`v1:real^3`;`v:real^3`] +THEN MRESAL_TAC AZIM_EQ_PI_ALT[`x:real^3`;`v1:real^3`;`v:real^3`;`((&1 - a) % u + a % w):real^3`][IN_ELIM_THM] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[VECTOR_ARITH`A=B+C+D <=> D=A-B-C:real^3`] +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV `(t3:real)` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`t3 % ((&1 - a) % u + a % w) = v1 - t1 % x - t2 % v ==> (inv (t3)) % t3 % ((&1 - a) % u + a % w) = (inv (t3)) % ( v1 - t1 % x - t2 % v:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C:real^3)`]) +THEN REWRITE_TAC[VECTOR_ARITH`&1 % ((&1 - a) % u + a % w) = inv t3 % (v1 - t1 % x - t2 % v) +<=> (&1 - a) % u + a % w = (-- inv t3 * t1) % x + (inv t3) % v1 +(-- (inv t3* t2)) % v`] +THEN STRIP_TAC +THEN EXISTS_TAC`(-- inv t3 * t1):real` +THEN EXISTS_TAC`(inv t3):real` +THEN EXISTS_TAC`(-- (inv t3 * t2)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`--inv t3 * t1 + inv t3 + --(inv t3 * t2)= inv t3 *(t3+ &1-(t1+t2+t3))`;REAL_ARITH`(t3 + &1 - &1)=t3`;REAL_ARITH`--A< &0 <=> &0< A`] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_INV +THEN ASM_REWRITE_TAC[]; +REMOVE_THEN "B" MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REMOVE_ASSUM_TAC +THEN MP_TAC(REAL_ARITH`azim x v1 v u1 < pi==> azim x v1 v u1 <= pi`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC`azim x v1 v (u1:real^3) < pi` +THEN FIND_ASSUM MP_TAC`&0< azim x v1 v (u1:real^3) ` +THEN REAL_ARITH_TAC]]);; + + + + + +let exists_cross_dot_fully_surrounded1_fan_le=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0 ?t. &0< t/\ t < &1 +/\( !h:real. &0< h/\ h &0< ((v1 - x) cross (u1 - x)) dot (((&1 - h) % ((&1 - a) % u + a % w) + h % u) - x))`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`(((&1 - t) % ((&1 - a) % u + a % w) + t % u) - x)= + ((&1 - a) % u + a % w - x) + t % (--a) % ( w-u)`;] +THEN ABBREV_TAC`va=(&1 - a) % u + a % w-x:real^3` +THEN REWRITE_TAC[DOT_RADD;DOT_RMUL; REAL_ARITH`&0 (B*D)*Cbool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;`u1:real^3`] +THEN DISJ_CASES_TAC(REAL_ARITH`(((v1 - x) cross (u1 - x:real^3)) dot (w - u)<= &0 )\/ (&0<((v1 - x) cross (u1 - x)) dot (w - u))`) +THENL[ +EXISTS_TAC`&1/ &2` +THEN REWRITE_TAC[REAL_ARITH`&0 < &1 / &2 /\ &1 / &2 < &1`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 < a ==> &0<= (a:real)`) THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 < h ==> &0<= (h:real)`) THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_LMUL[`a:real`;`((v1 - x) cross (u1 - x)) dot ((w - u):real^3)`;`&0`][REAL_ARITH`(A:real)* &0= &0`] +THEN MRESAL_TAC REAL_LE_RMUL[`a*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)`;`&0`;`h:real`][REAL_ARITH`&0 * (A:real)= &0`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +MRESA_TAC REAL_LT_MUL[`a:real`;`((v1 - x) cross (u1 - x)) dot ((w - u):real^3)`] +THEN MP_TAC(REAL_ARITH`&0<(a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)==> ~( (a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_RINV`(a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)` +THEN MRESA1_TAC REAL_LT_INV`(a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3)` +THEN MRESA_TAC REAL_LT_MUL[`inv((a:real)*((v1 - x) cross (u1 - x)) dot ((w - u):real^3))`;`((v1 - x) cross (u1 - x)) dot (va:real^3)`] +THEN EXISTS_TAC `min ((inv(a *(((v1 - x) cross (u1 - x)) dot (w - u)))*(((v1 - x) cross (u1 - x)) dot va)) / &2 ) (&1/ &2)` +THEN STRIP_TAC +THENL[POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ + REAL_ARITH_TAC; +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH` h< min ((inv (a * (((v1 - x) cross (u1 - x)) dot (w - u))) * (((v1 - x) cross (u1 - x)) dot va)) / &2) (&1 / &2) +==> +h< ((inv (a * (((v1 - x) cross (u1 - x)) dot (w - u))) * (((v1 - x) cross (u1 - x)) dot va)) / &2)`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_LMUL[`(a * (((v1 - x) cross (u1 - x)) dot (w - u:real^3)))`;`h:real`;`((inv (a * (((v1 - x) cross (u1 - x)) dot (w - u))) * (((v1 - x) cross (u1 - x:real^3)) dot va)) / &2)`] +THEN ASM_TAC +THEN ABBREV_TAC`vb=a * (((v1 - x) cross (u1 - x)) dot (w - u))` +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`vb * (inv vb * (((v1 - x) cross (u1 - x)) dot va)) / &2= +(vb * inv vb) * (((v1 - x) cross (u1 - x)) dot va)/ &2`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]]);; + + +let cross_dot_fully_surrounded2_fan_le=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0 &0 < (((&1 - a) % u + a % w - x) cross (v - x)) dot (u1 - x)`, + +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_THEN(LABEL_TAC"yeu em") +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "yeu em" (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MP_TAC(ARITH_RULE`&0 &0<= a`) THEN RESA_TAC +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`(&1-a)%u+ a%w:real^3`;`v1:real^3`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] +THEN MRESA1_TAC SIN_POS_PI`azim x v1 v (u1:real^3)` +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AZIM_TRANSLATION[`-- x:real^3`;`x:real^3`;`v1:real^3`;` v:real^3`;`u1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`x-x= vec 0`;VECTOR_ARITH`(-- X)+A= A-X:real^3`] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN MRESA_TAC JBDNJJB[`(v1-x):real^3`;`v-x:real^3`;`u1-x:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM COLLINEAR_3;] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN MRESAL_TAC REAL_LT_LMUL_EQ [` &0:real `;`(((v1 - x) cross (v - x)) dot ((u1 - x):real^3)):real`;`t:real`][REAL_ARITH`a * &0 = &0`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3) `;] +THEN FIND_ASSUM MP_TAC `v1 IN aff_gt {x} {v,(&1-a)%u+ a%(w:real^3)}` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[th;VECTOR_ARITH`A- vec 0= A`;VECTOR_ARITH`(t1 % x + t2 % v + t3 % ((&1 - a) % u + a % w)) - x=(t1- &1) % x + t2 % v + t3 % ((&1 - a) % u + a % w)`]) +THEN FIND_ASSUM MP_TAC `t1 + t2 + t3 = &1:real` +THEN REWRITE_TAC[REAL_ARITH`t1 + t2 + t3 = &1<=> t1- &1= (-- t2)- t3 `] +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(--t2 - t3) % x + t2 % v + t3 % ((&1 - a) % u + a % w)= t2 % (v-x) + t3 % ((&1 - a) % u + a % w-x)`] +THEN REWRITE_TAC[CROSS_LADD; CROSS_RADD; CROSS_LMUL; CROSS_RMUL;CROSS_REFL;CROSS_RNEG;CROSS_LNEG] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[GSYM CROSS_LMUL;GSYM CROSS_LADD;DOT_LMUL] +THEN MRESAL_TAC REAL_LT_LMUL_EQ [` &0:real `;`((((&1 - a) % u + a % w - x) cross (v - x)) dot (u1 - x)):real`;`t3:real`][REAL_ARITH`a * &0 = &0`]);; + + + +let exists_cross_dot_fully_surrounded2_fan_le=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0 +?t:real. &0< t/\ t < &1 +/\ (!h:real. &0 &0 < +((((&1 - h) % ((&1 - a) % u + a % w) + h % u) - x) cross (v - x)) dot (u1 - x))`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`(((&1 - t) % ((&1 - a) % u + a % w) + t % u) - x)= + ((&1 - a) % u + a % w - x) + t % (--a) % ( w-u)`;] +THEN ABBREV_TAC`va=(&1 - a) % u + a % w-x:real^3` +THEN REWRITE_TAC[CROSS_LADD;CROSS_LMUL;DOT_LADD;DOT_LMUL; REAL_ARITH`&0 (B*D)*Cbool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;`u1:real^3`] +THEN DISJ_CASES_TAC(REAL_ARITH`(((w - u) cross (v - x:real^3)) dot (u1- x)<= &0 )\/ (&0<((w - u) cross (v - x:real^3)) dot (u1- x))`) +THENL[ +EXISTS_TAC`&1/ &2` +THEN REWRITE_TAC[REAL_ARITH`&0 < &1 / &2 /\ &1 / &2 < &1`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 < a ==> &0<= (a:real)`) THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 < h ==> &0<= (h:real)`) THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_LMUL[`a:real`;`((w - u) cross (v - x:real^3)) dot (u1- x:real^3)`;`&0`][REAL_ARITH`(A:real)* &0= &0`] +THEN MRESAL_TAC REAL_LE_RMUL[`a*(((w - u) cross (v - x:real^3)) dot (u1- x))`;`&0`;`h:real`][REAL_ARITH`&0 * (A:real)= &0`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +MRESA_TAC REAL_LT_MUL[`a:real`;`((w - u) cross (v - x:real^3)) dot (u1- x:real^3)`] +THEN MP_TAC(REAL_ARITH`&0<(a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x))==> ~( (a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x))= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_RINV`(a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x))` +THEN MRESA1_TAC REAL_LT_INV`(a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x))` +THEN MRESA_TAC REAL_LT_MUL[`inv((a:real)*(((w - u) cross (v - x:real^3)) dot (u1- x)))`;`((va cross (v - x)) dot (u1 - x))`] +THEN EXISTS_TAC `min ((inv(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))*((va cross (v - x)) dot (u1 - x))) / &2 ) (&1/ &2)` +THEN STRIP_TAC +THENL[POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ + REAL_ARITH_TAC; +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH` h< min ((inv(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))*((va cross (v - x)) dot (u1 - x))) / &2 ) (&1/ &2) +==> +h< ((inv(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))*((va cross (v - x)) dot (u1 - x))) / &2 )`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_LMUL[`(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))`;`h:real`;`((inv(a *(((w - u) cross (v - x:real^3)) dot (u1- x)))*((va cross (v - x)) dot (u1 - x))) / &2 )`] +THEN ASM_TAC +THEN ABBREV_TAC`vb=a * (((w - u) cross (v - x:real^3)) dot (u1- x))` +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`vb * (inv vb * ((va cross (v - x)) dot (u1 - x))) / &2= +(vb * inv vb) * ((va cross (v - x)) dot (u1 - x))/ &2`] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]]);; + + + + + + + + +let exists_cut_small_edges_fan_le=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real v1:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0 +?t:real. &0< t/\ t < &1 +/\ ~(aff_gt {x} {v,(&1-t)%((&1-a)%u+ a%w)+t%u} INTER aff_gt {x} {v1,u1}={})`, + +REPEAT STRIP_TAC +THEN MRESA_TAC lie_in_half_space_and_azim_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;` u1:real^3`] +THEN MRESA_TAC exists_cross_dot_fully_surrounded1_fan_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;` u1:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"MA") +THEN MRESA_TAC exists_cross_dot_fully_surrounded2_fan_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`;`v1:real^3`;` u1:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"BE NHO") +THEN FIND_ASSUM MP_TAC `fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_THEN(LABEL_TAC"yeu em") +THEN ABBREV_TAC`ta=min (t:real) (t':real)/ &2` +THEN EXISTS_TAC `(ta:real)` +THEN SUBGOAL_THEN `&0< ta:real /\ ta < &1 /\ ta< t /\ ta< t'` ASSUME_TAC +THENL(*1*)[ +POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN FIND_ASSUM MP_TAC`&0 &0<= a`) THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`ta< &1 ==> &0<= (&1-ta):real`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL [`(&1-ta):real`;`a:real`] +THEN MRESA_TAC REAL_LE_LMUL [`(&1-ta):real`;`a:real`;`&1`] +THEN MP_TAC(REAL_ARITH` &0< ta /\ (&1-ta)*a<= (&1-ta)* &1 :real==> (&1-ta)*a<= &1`) +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (u:real^3)`;`v:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "yeu em" (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESAL_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`((&1-ta)*a):real`][VECTOR_ARITH`(&1 - ((&1 - ta) * a)) % u + ((&1 - ta) * a ) % w= +(&1 - ta) % ((&1 - a) % u + a % w) + ta % u:real^3`] +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`(&1-a)%u+ a%w:real^3`;`v1:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`;`u1:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"CON") +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - ta) % ((&1 - a) % u + a % w) + ta % u:real^3`;] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v1:real^3)`;`u1:real^3`;] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - a) % (u:real^3) + a % (w:real^3)`;] +THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v1:real^3)`;`(u1:real^3) `;] +THEN MRESA_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;`(&1 - ta) % ((&1 - a) % u + a % w) + ta % u:real^3 `;] +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;EXTENSION;EMPTY;IN;NOT_FORALL_THM] +THEN ABBREV_TAC`a1=(v-x):real^3` +THEN ABBREV_TAC`a2=(((&1-ta)%((&1-a)%u+ a%w)+ta%u)-x):real^3` +THEN ABBREV_TAC`a3=(v1-x) :real^3` +THEN ABBREV_TAC`a4=u1-x:real^3` +THEN ABBREV_TAC`va=a1 cross a2:real^3` +THEN ABBREV_TAC`vb=a3 cross a4:real^3` +THEN EXISTS_TAC`(vb:real^3) cross (va:real^3)+(x:real^3)` +THEN STRIP_TAC +THENL(*2*)[ +EXISTS_TAC`&1-(vb:real^3) dot (a2:real^3)+ vb dot (a1:real^3)` +THEN EXISTS_TAC`(vb:real^3) dot (a2:real^3)` +THEN EXISTS_TAC`--((vb:real^3) dot (a1:real^3))` +THEN REMOVE_THEN "MA"(fun th-> MRESA1_TAC th `ta:real`) +THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 - vb dot a2 + vb dot a1) + vb dot a2 + --(vb dot a1) = &1`] +THEN SUBGOAL_THEN `&0< --((vb:real^3) dot (a1:real^3))` ASSUME_TAC +THENL(*3*)[ +EXPAND_TAC"vb" +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[DOT_LNEG] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN REMOVE_THEN "CON"MP_TAC +THEN REAL_ARITH_TAC;(*3*) + +ASM_REWRITE_TAC[] +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_MUL_LNEG] +THEN EXPAND_TAC"a1" +THEN EXPAND_TAC"a2" +THEN VECTOR_ARITH_TAC];(*2*) + +ONCE_REWRITE_TAC[CROSS_SKEW] +THEN EXPAND_TAC"vb" +THEN REWRITE_TAC[CROSS_LAGRANGE;] +THEN EXISTS_TAC`&1+(va:real^3) dot (a4:real^3)- va dot (a3:real^3)` +THEN EXISTS_TAC`--(va:real^3) dot (a4:real^3)` +THEN EXISTS_TAC`((va:real^3) dot (a3:real^3))` +THEN REMOVE_THEN "BE NHO"(fun th-> MRESA1_TAC th `ta:real`) +THEN ASM_REWRITE_TAC[DOT_LNEG;VECTOR_MUL_LNEG;REAL_ARITH`(&1 + va dot a4 - va dot a3) + --(va dot a4) + va dot a3 = &1`;] +THEN STRIP_TAC +THENL(*3*)[ +EXPAND_TAC"va" +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[DOT_LNEG] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*3*) + +STRIP_TAC +THENL(*4*)[ +EXPAND_TAC"va" +THEN EXPAND_TAC"a2" +THEN REWRITE_TAC[VECTOR_ARITH`((&1 - ta) % ((&1 - a) % u + a % w) + ta % u) - x +=(&1 - ta) % ((&1 - a) % u + a % w-x) + ta % (u - x)`] +THEN ABBREV_TAC`vu=(&1 - a) % u + a % w - x:real^3` +THEN REWRITE_TAC[CROSS_RADD;CROSS_RMUL;DOT_LADD;DOT_LMUL;] +THEN MRESAL_TAC coplanar_is_cross_fan[`x:real^3`;`v:real^3`;`(&1 - a) % u + a % w:real^3`;`v1:real^3`] +[VECTOR_ARITH`((&1 - a) % u + a % w) - x=(&1 - a) % u + a % w - x`] +THEN REDUCE_ARITH_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[];(*4*) +EXPAND_TAC"a3" +THEN EXPAND_TAC"a4" +THEN REWRITE_TAC[VECTOR_ARITH`-- A+B= B-A:real^3`;VECTOR_ARITH`(&1+A-B)%X+B%U-A%V=X-A%(V-X)+B%(U-X)`] +THEN VECTOR_ARITH_TAC]]]]);; + + + + + + + + + + + + + + + +let AFF_GT_CUT_XFAN_IMP_EDGE_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ~(aff_gt{x} {v,w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={}) +==> {v,w} IN E`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MP_TAC (th) THEN ASSUME_TAC(th)) +THEN REWRITE_TAC[fan80] +THEN DISCH_THEN(LABEL_TAC"BE") +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?x'. x' IN A`;INTER;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN DISCH_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[(th)]) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN DISCH_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN REMOVE_THEN "BE" (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"BE") ) +THEN MRESAL_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1:real`][REAL_ARITH`&0<= &1/\ &1<= &1 `;VECTOR_ARITH`(&1 - &1) % u + &1 % w=w`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(w:real^3)`;] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w':real^3)`; +` (v':real^3)`] +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v':real^3`;`w':real^3`][IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "VUT1") +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "VUT") +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "VUT1") +THEN DISCH_TAC THEN DISCH_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(t3'= &0) \/ ~(t3':real= &0)`) +THENL(*1*)[ + +ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(t2'= &0) \/ ~(t2':real= &0)`) +THENL(*2*)[ +ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(t3:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM (fun th-> REWRITE_TAC[SYM(th)])`t1 + t2 + t3 = &1:real` +THEN REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % w = + (t1 + t2 + t3) % x<=>(t3) % (w- x)=(-- t2) % (v-x) `] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +(t3) % (w- x)=(-- t2) % (v-x) +==> (inv (t3))%((t3) % (w- x) ) = (inv (t3))%((-- t2) % (v-x)):real^3`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[VECTOR_ARITH`A-B=C%(D-B)<=>A=(&1-C)%B+C%D`;] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC `~(w IN aff {x, v:real^3})` +THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`&1-(inv t3 * (--t2)):real` +THEN EXISTS_TAC`(inv t3 * (--t2)):real` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC +;(*2*) + +FIND_ASSUM MP_TAC`t1 + t2 + t3 = &1:real` +THEN REWRITE_TAC[REAL_ARITH`t1 + t2 + t3 = &1<=> t1= &1 -t2 -t3`; REAL_ARITH`A+B= &1<=> A= &1-B`] +THEN DISCH_THEN(LABEL_TAC"MAI") +THEN DISCH_THEN (LABEL_TAC"YEU EM") +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - t2 - t3) % x + t2 % v + t3 % w = + (&1 - t2') % x + t2' % v'<=> t2' % v'=(t2' - t2 - t3) % x + t2 % v + t3 % w:real^3 `] +THEN MP_TAC(ISPEC`(t2':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2' % v'=(t2' - t2 - t3) % x + t2 % v + t3 % w:real^3 +==> (inv (t2'))%(t2' % v' ) = (inv (t2'))%((t2' - t2 - t3) % x + t2 % v + t3 % w:real^3) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C+D)=(A%B+A%C+A%D)`;REAL_ARITH`a*(b-c-d)=a*b-a*c-a*d`] +THEN REDUCE_VECTOR_TAC +THEN DISCH_TAC +THEN SUBGOAL_THEN `~coplanar{x:real^3,v':real^3,v:real^3,u:real^3}` ASSUME_TAC +THENL(*3*)[ + +POP_ASSUM MP_TAC +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, v', v, u}= {(--x) +x, (--x) +v', (--x) +v, (--x) +u}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3,v':real^3,v:real^3,u:real^3}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`]) +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th;VECTOR_ARITH`((&1 - inv t2' * t2 - inv t2' * t3) % x + + (inv t2' * t2) % v + + (inv t2' * t3) % w) - + x=(inv t2' * t2) % (v-x) + + (inv t2' * t3) % (w-x)`]) +THEN MP_TAC(REAL_ARITH`&0< t2 /\ &0< t3 /\ t1+t2+t3= &1==> &0 < &1- t1 /\ ~(&1- t1 = &0)/\ t2+t3= &1- t1`) +THEN REMOVE_THEN"MAI" MP_TAC +THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`&1- (t1:real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`&1- (t1:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2 + t3 = &1 - t1:real +==> (inv ( &1 - t1))*(t2 + t3) = (inv ( &1 - t1))*( &1 - t1:real) +`) + +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> A*B = &1 -A*C`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH` ~(t2' = &0) /\ &0 <= t2'==> &0 ~( (inv(&1- t1)) * t3= &0)`) +THEN MP_TAC(REAL_ARITH`&0< (t2') * inv (&1- t1) ==> ~((t2')* inv(&1- t1)= &0)`) +THEN RESA_TAC +THEN ASSUME_TAC(REAL_ARITH`~(&1 = &0)`) +THEN MRESA_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`(t2')* inv(&1- t1)`;`u - x:real^3`; `v - x:real^3`; `(inv t2' * t2) % (v - x) +(inv t2' * t3) % (w - x):real^3`] +THEN POP_ASSUM (fun th -> ONCE_REWRITE_TAC[SYM(th);]) +THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B+D)=A%B+A%D`; +VECTOR_ARITH`A%B%C=(A*B)%C`; REAL_ARITH`(t2' * inv (&1 - t1)) * inv t2' * t2= (inv (t2')* t2' ) * inv (&1-t1) * t2`] +THEN REDUCE_ARITH_TAC +THEN DISCH_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, w}= {(--x) +x, (--x) +v, (--x) +u, (--x) + w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] ) +THEN DISCH_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` w-x:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(inv(&1- t1)) * t3:real`) +;(*3*) + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"DICH") +THEN DISCH_TAC +THEN MP_TAC(REAL_ARITH` ~(t2' = &0) /\ &0 <= t2'==> &0 MRESA1_TAC th `v':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN MRESA_TAC exists_element_in_half_sapace_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;` v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; +` (v':real^3)`] +THEN MRESAL_TAC exists_cut_small_edges_fan_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1`;`v':real^3`;`u':real^3`][REAL_ARITH`&0< &1/\ &1<= &1`;VECTOR_ARITH`(&1 - &1) % u + &1 % w=w`] +THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC +THEN MRESAL_TAC not_cut_in_edges_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1 -t:real`] +[REAL_ARITH`(&0< &1- t<=> t< &1)/\ (&1- t< &1<=> &0< t)`;VECTOR_ARITH`(&1 - (&1 - t)) % u + (&1 - t) % w=(&1 - t) % w +t % u`;SET_RULE`aff_gt {x} {v, (&1 - t) % w + t % u} INTER + {v | ?e. e IN E /\ v IN aff_ge {x} e} = + {}<=> !e. e IN E ==> aff_gt {x} {v, (&1 - t) % w + t % u} INTER + aff_ge {x} e = + {}`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`{v',u':real^3}`) +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v':real^3`;`u':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[] + +](*4*)](*3*)](*2*);(*1*) + + +DISJ_CASES_TAC(REAL_ARITH`(t2'= &0) \/ ~(t2':real= &0)`) + +THENL(*2*)[ + +FIND_ASSUM MP_TAC`t1 + t2 + t3 = &1:real` +THEN REWRITE_TAC[REAL_ARITH`t1 + t2 + t3 = &1<=> t1= &1 -t2 -t3`; REAL_ARITH`A+B= &1<=> A= &1-B`] +THEN DISCH_THEN(LABEL_TAC"MAI") +THEN DISCH_THEN (LABEL_TAC"YEU EM") +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - t2 - t3) % x + t2 % v + t3 % w = + (&1 - &0 - t3') % x + &0% v'+t3' % w'<=> t3' % w'=(t3' - t2 - t3) % x + t2 % v + t3 % w:real^3 `] +THEN MP_TAC(ISPEC`(t3':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3' % w'=(t3' - t2 - t3) % x + t2 % v + t3 % w:real^3 +==> (inv (t3'))%(t3' % w' ) = (inv (t3'))%((t3' - t2 - t3) % x + t2 % v + t3 % w:real^3) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C+D)=(A%B+A%C+A%D)`;REAL_ARITH`a*(b-c-d)=a*b-a*c-a*d`] +THEN REDUCE_VECTOR_TAC +THEN DISCH_TAC +THEN SUBGOAL_THEN `~coplanar{x:real^3,w':real^3,v:real^3,u:real^3}` ASSUME_TAC +THENL(*3*)[ + + POP_ASSUM MP_TAC +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, w', v, u}= {(--x) +x, (--x) +w', (--x) +v, (--x) +u}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3,w':real^3,v:real^3,u:real^3}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)] THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`]) +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th;VECTOR_ARITH`((&1 - inv t2' * t2 - inv t2' * t3) % x + + (inv t2' * t2) % v + + (inv t2' * t3) % w) - + x=(inv t2' * t2) % (v-x) + + (inv t2' * t3) % (w-x)`]) +THEN MP_TAC(REAL_ARITH`&0< t2 /\ &0< t3 /\ t1+t2+t3= &1==> &0 < &1- t1 /\ ~(&1- t1 = &0)/\ t2+t3= &1- t1`) +THEN REMOVE_THEN"MAI" MP_TAC +THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`&1- (t1:real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`&1- (t1:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2 + t3 = &1 - t1:real +==> (inv ( &1 - t1))*(t2 + t3) = (inv ( &1 - t1))*( &1 - t1:real) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> A*B = &1 -A*C`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH` ~(t3' = &0) /\ &0 <= t3'==> &0 ~( (inv(&1- t1)) * t3= &0)`) +THEN MP_TAC(REAL_ARITH`&0< (t3') * inv (&1- t1) ==> ~((t3')* inv(&1- t1)= &0)`) +THEN RESA_TAC +THEN ASSUME_TAC(REAL_ARITH`~(&1 = &0)`) +THEN MRESA_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`(t3')* inv(&1- t1)`;`u - x:real^3`; `v - x:real^3`; `(inv t3' * t2) % (v - x) +(inv t3' * t3) % (w - x):real^3`] +THEN POP_ASSUM (fun th -> ONCE_REWRITE_TAC[SYM(th);]) +THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%(B+D)=A%B+A%D`; +VECTOR_ARITH`A%B%C=(A*B)%C`; REAL_ARITH`(t2' * inv (&1 - t1)) * inv t2' * t2= (inv (t2')* t2' ) * inv (&1-t1) * t2`] +THEN REDUCE_ARITH_TAC +THEN DISCH_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN RESA_TAC +THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` w-x:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(inv(&1- t1)) * t3:real`) + +;(*3*) + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"DICH") +THEN DISCH_TAC +THEN MP_TAC(REAL_ARITH` ~(t3' = &0) /\ &0 <= t3'==> &0 bool)`;` (E:(real^3->bool)->bool) `;` (v':real^3)`; +` (w':real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `w':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN MRESA_TAC exists_element_in_half_sapace_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w':real^3`;` v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; +` (w':real^3)`] +THEN MRESAL_TAC exists_cut_small_edges_fan_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1`;`w':real^3`;`u':real^3`][REAL_ARITH`&0< &1/\ &1<= &1`;VECTOR_ARITH`(&1 - &1) % u + &1 % w=w`] +THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC +THEN MRESAL_TAC not_cut_in_edges_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1 -t:real`] +[REAL_ARITH`(&0< &1- t<=> t< &1)/\ (&1- t< &1<=> &0< t)`;VECTOR_ARITH`(&1 - (&1 - t)) % u + (&1 - t) % w=(&1 - t) % w +t % u`;SET_RULE`aff_gt {x} {v, (&1 - t) % w + t % u} INTER + {v | ?e. e IN E /\ v IN aff_ge {x} e} = + {}<=> !e. e IN E ==> aff_gt {x} {v, (&1 - t) % w + t % u} INTER + aff_ge {x} e = + {}`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`{w',u':real^3}`) +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`w':real^3`;`u':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]](*4*)](*3*);(*2*) + + + + + + +ASM_REWRITE_TAC[] +THEN DISCH_TAC THEN DISCH_THEN(LABEL_TAC"BO") +THEN MP_TAC(REAL_ARITH` ~(t3' = &0) /\ &0 <= t3'==> &0 &0 &0 <= t2`) THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0< t3==> &0 <= t3`) THEN RESA_TAC +THEN ASM_REWRITE_TAC[];(*6*) + + +FIND_ASSUM MP_TAC`{v',w':real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN DISCH_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v':real^3)`; +` (w':real^3)`] +THEN SUBGOAL_THEN `~collinear {x, x', w':real^3}` ASSUME_TAC +THENL(*7*)[ + +ASM_REWRITE_TAC[collinear1_fan;] +THEN FIND_ASSUM MP_TAC `~((v':real^3) IN aff{x,w'})` +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % v' + t3' % w' = u' % x + v'' % w' +<=> t2' % v' = (u'-t1') % x + (v''-t3') % w'`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2' % v' = (u'-t1') % x + (v''-t3') % w':real^3 +==> (inv ( t2'))%(t2' % v') = (inv (t2'))%((u'-t1') % x + (v''-t3') % w') +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC `(inv t2' * (u' - t1':real))` +THEN EXISTS_TAC `(inv t2' * (v'' - t3':real))` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t2' * (u' - t1') + inv t2' * (v'' - t3')=inv t2'* (t2'+ (u'+v'') - (t1'+t2'+t3'))`;REAL_ARITH`t2'+ &1 - &1=t2'`] +;(*7*) + + + +SUBGOAL_THEN `~collinear {x, x', v':real^3}` ASSUME_TAC + +THENL(*8*)[ +ASM_REWRITE_TAC[collinear1_fan;] +THEN FIND_ASSUM MP_TAC `~((w':real^3) IN aff{x,v'})` +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % v' + t3' % w' = u' % x + v'' % v' +<=> t3' % w' = (u'-t1') % x + (v''-t2') % v'`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3' % w' = (u'-t1') % x + (v''-t2') % v':real^3 +==> (inv ( t3'))%(t3' % w') = (inv (t3'))%((u'-t1') % x + (v''-t2') % v') +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC `(inv t3' * (u' - t1':real))` +THEN EXISTS_TAC `(inv t3' * (v'' - t2':real))` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t3' * (u' - t1') + inv t3' * (v'' - t2')=inv t3'* (t3'+ (u'+v'') - (t1'+t2'+t3'))`;REAL_ARITH`t3'+ &1 - &1=t3'`] +;(*8*) + + + +SUBGOAL_THEN`~collinear {x, x', w:real^3}` ASSUME_TAC + +THENL(*9*)[ +REMOVE_THEN "BO" MP_TAC +THEN DISCH_TAC THEN REMOVE_ASSUM_TAC +THEN ASM_REWRITE_TAC[collinear1_fan;] +THEN FIND_ASSUM MP_TAC`~(w IN aff {x, v:real^3})` +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % (va) = + u' % x + v' % (va)<=> +(&1-(t1+t2+t3)) % x + (v'-t3) % (va-x) = + (&1-(u'+v') ) % x + t2 % (v-x)`;REAL_ARITH`a-a= &0`] +THEN REDUCE_VECTOR_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(v'' - t3 = &0) \/ ~(v'' - (t3:real)= &0)`) +THENL(*10*)[ +ASM_REWRITE_TAC[VECTOR_ARITH`&0 %A=B<=> B= vec 0`;VECTOR_MUL_EQ_0] +THEN MP_TAC(REAL_ARITH`&0< t2==> ~(t2 = &0)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-B= vec 0<=> A=B`];(*10*) + +MRESA1_TAC REAL_MUL_LINV `(v''-t3:real)` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(v'' - t3) % (w- x) = t2 % (v - x:real^3) ==> (inv (v'' -t3)) % ((v'' - t3) % (w - x)) = (inv (v'' -t3)) % ( t2 % (v - x))`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C:real^3)`]) +THEN REWRITE_TAC[VECTOR_ARITH`&1 % (va - x) = (inv (v' - t3) * t2) % (v - x)<=> +va = (&1-(inv (v' - t3) * t2))%x +(inv (v' - t3) * t2) % v:real^3`] +THEN STRIP_TAC +THEN EXISTS_TAC`&1-(inv (v'' - t3) * (t2:real))` +THEN EXISTS_TAC`(inv (v'' - t3) * (t2:real))` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC](*10*);(*9*) + +SUBGOAL_THEN `~collinear {x, x', v:real^3}` ASSUME_TAC +THENL(*10*)[ +REMOVE_THEN "BO" MP_TAC +THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC +THEN ASM_REWRITE_TAC[collinear1_fan] +THEN FIND_ASSUM MP_TAC `~(w IN aff {x, v:real^3})` +THEN MATCH_MP_TAC MONO_NOT +THEN REWRITE_TAC[aff; AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % v' + t3' % w' = u' % x + v'' % v' +<=> t3' % w' = (u'-t1') % x + (v''-t2') % v'`] +THEN MP_TAC(REAL_ARITH`&0< t3 ==> ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t3:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t3 % w = (u'-t1) % x + (v''-t2) % v:real^3 +==> (inv ( t3))%(t3 % w) = (inv (t3))%((u'-t1) % x + (v''-t2) % v) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC `(inv t3 * (u' - t1:real))` +THEN EXISTS_TAC `(inv t3 * (v'' - t2:real))` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv t3' * (u' - t1') + inv t3' * (v'' - t2')=inv t3'* (t3'+ (u'+v'') - (t1'+t2'+t3'))`;REAL_ARITH`t3'+ &1 - &1=t3'`] +;(*10*) + +REMOVE_THEN "VUT1" MP_TAC +THEN REMOVE_THEN "VUT1" MP_TAC +THEN REMOVE_THEN "BO" MP_TAC +THEN REMOVE_THEN "VUT" MP_TAC +THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN DISJ_CASES_TAC(SET_RULE`(&0 < azim x (x':real^3) v w' /\ + azim x (x') v w' < pi)\/ ~(&0 < azim x (x') v w' /\ + azim x (x') v w' < pi)`) +THENL(*11*)[ +MRESAL_TAC exists_cut_small_edges_fan_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1:real`;`x':real^3`;`w':real^3`][REAL_ARITH`&0< &1/\ &1<= &1`;VECTOR_ARITH`(&1 - &1) % u + &1 % w=w`] +THEN MRESAL_TAC not_cut_in_edges_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1 -t:real`] +[REAL_ARITH`(&0< &1- t<=> t< &1)/\ (&1- t< &1<=> &0< t)`;VECTOR_ARITH`(&1 - (&1 - t)) % u + (&1 - t) % w=(&1 - t) % w +t % u`;SET_RULE`aff_gt {x} {v, (&1 - t) % w + t % u} INTER + {v | ?e. e IN E /\ v IN aff_ge {x} e} = + {}<=> !e. e IN E ==> aff_gt {x} {v, (&1 - t) % w + t % u} INTER + aff_ge {x} e = + {}`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`{v',w':real^3}`) +THEN MRESA_TAC aff_gt1_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[] +;(*11*) + +ASSUME_TAC(ISPECL[`x:real^3`;`v':real^3`;`w':real^3`;`x':real^3`]azim) +THEN ASSUME_TAC(PI_WORKS) +THEN MP_TAC(REAL_ARITH`~(&0 < azim x x' v w' /\ azim x x' v w' < pi)/\ +&0 <= azim x x' v w' /\ &0< pi==> pi< azim x x' v w' \/(azim x x' v w'= &0 \/ azim x x' v w'=pi) `) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*12*)(*3GOAL*)[ + +POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3 `;`x':real^3`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN DISCH_TAC +THEN MP_TAC(REAL_ARITH`azim x x' v' w' < azim x x' v w'==>azim x x' v' w' <= azim x x' v w'`) +THEN RESA_TAC +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3 `;`x':real^3`] +THEN DISCH_TAC THEN DISCH_TAC +THEN MP_TAC(REAL_ARITH`pi < azim x x' v w' /\ azim x x' v w' = azim x x' v v' + pi +/\ azim x x' v w' < &2 * pi==> &0 bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1:real`;`x':real^3`;`v':real^3`][REAL_ARITH`&0< &1/\ &1<= &1`;VECTOR_ARITH`(&1 - &1) % u + &1 % w=w`] +THEN MRESAL_TAC not_cut_in_edges_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1 -t:real`] +[REAL_ARITH`(&0< &1- t<=> t< &1)/\ (&1- t< &1<=> &0< t)`;VECTOR_ARITH`(&1 - (&1 - t)) % u + (&1 - t) % w=(&1 - t) % w +t % u`;SET_RULE`aff_gt {x} {v, (&1 - t) % w + t % u} INTER + {v | ?e. e IN E /\ v IN aff_ge {x} e} = + {}<=> !e. e IN E ==> aff_gt {x} {v, (&1 - t) % w + t % u} INTER + aff_ge {x} e = + {}`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`{w',v':real^3}`) +THEN MRESA_TAC aff_gt1_subset_aff_ge[`x:real^3`;`w':real^3`;`v':real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*12*) + +MRESA_TAC AZIM_EQ_0[`x:real^3`;`x':real^3`;`v:real^3`;`w':real^3`] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`x':real^3`;`v:real^3`;`w':real^3`] +THEN MRESA_TAC AZIM_EQ_0[`x:real^3`;`x':real^3`;`w':real^3`;`v:real^3`] +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`w':real^3`;`v:real^3`] +THEN DISJ_CASES_TAC(SET_RULE`w' IN aff_gt {x} {v,w:real^3}\/ ~(w' IN aff_gt {x} {v,w:real^3})`) +THENL(*13*)[ + +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"DICH CHUYEN") +THEN DISCH_TAC +THEN REMOVE_THEN "DICH CHUYEN"(fun th->MP_TAC(th) THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN REMOVE_ASSUM_TAC + THEN ASSUME_TAC(th)) +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`w' = t1'' % x + t2'' % v + t3'' % va<=> + ((t1''+t2''+t3'')- &1) % x + t2'' % (v-x) + t3'' % (va-x)= w' -x:real^3`;REAL_ARITH`&1- &1 = &0`] +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(REAL_ARITH`&0< t2'' /\ &0< t3'' /\ t1''+t2''+t3''= &1==> &0 < &1- t1'' /\ ~(&1- t1'' = &0)/\ t2''+t3''= &1- t1''`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2'' + t3'' = &1 - t1'':real +==> (inv ( &1 - t1''))*(t2'' + t3'') = (inv ( &1 - t1''))*( &1 - t1'':real) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1- A*C = A*B`] +THEN STRIP_TAC +THEN MRESA_TAC REAL_LT_MUL[`inv(&1- t1'':real)`;`t3'':real`] +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)*(t3'':real)= &0)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)= &0)`) +THEN RESA_TAC +THEN ASSUME_TAC(REAL_ARITH`~(&1= &0)`) +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, w}= {(--x) +x, (--x) +v, (--x) +u, (--x) + w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` w-x:real^3`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(inv(&1- t1'')) * t3'':real`[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`]) +THEN MRESAL_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`inv(&1- t1'')`;`u - x:real^3`; `v - x:real^3`; `w'-x:real^3`] +[VECTOR_ARITH`&1 %A=A`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v,w'}= {(--x) +x, (--x) +u, (--x) +v, (--x) + w'}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w'}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN DISCH_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `w':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN MRESA_TAC exists_element_in_half_sapace_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w':real^3`;` v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; +` (w':real^3)`] +THEN MRESAL_TAC exists_cut_small_edges_fan_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1:real`;`w':real^3`;`u':real^3`][REAL_ARITH`&0< &1/\ &1<= &1`;VECTOR_ARITH`(&1 - &1) % u + &1 % w=w`] +THEN MRESAL_TAC not_cut_in_edges_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1 -t:real`] +[REAL_ARITH`(&0< &1- t<=> t< &1)/\ (&1- t< &1<=> &0< t)`;VECTOR_ARITH`(&1 - (&1 - t)) % u + (&1 - t) % w=(&1 - t) % w +t % u`;SET_RULE`aff_gt {x} {v, (&1 - t) % w + t % u} INTER + {v | ?e. e IN E /\ v IN aff_ge {x} e} = + {}<=> !e. e IN E ==> aff_gt {x} {v, (&1 - t) % w + t % u} INTER + aff_ge {x} e = + {}`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`{w',u':real^3}`) +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`w':real^3`;`u':real^3`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*13*) + + +DISJ_CASES_TAC(SET_RULE`v' IN aff_gt {x} {v,w:real^3}\/ ~(v' IN aff_gt {x} {v,w:real^3})`) +THENL(*14*)[ + +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"DICH CHUYEN") +THEN DISCH_TAC +THEN REMOVE_THEN "DICH CHUYEN"(fun th->MP_TAC(th) THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN REMOVE_ASSUM_TAC + THEN ASSUME_TAC(th)) +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`v' = t1'' % x + t2'' % v + t3'' % va<=> + ((t1''+t2''+t3'')- &1) % x + t2'' % (v-x) + t3'' % (va-x)= v' -x:real^3`;REAL_ARITH`&1- &1 = &0`] +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(REAL_ARITH`&0< t2'' /\ &0< t3'' /\ t1''+t2''+t3''= &1==> &0 < &1- t1'' /\ ~(&1- t1'' = &0)/\ t2''+t3''= &1- t1''`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2'' + t3'' = &1 - t1'':real +==> (inv ( &1 - t1''))*(t2'' + t3'') = (inv ( &1 - t1''))*( &1 - t1'':real) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1- A*C = A*B`] +THEN STRIP_TAC +THEN MRESA_TAC REAL_LT_MUL[`inv(&1- t1'':real)`;`t3'':real`] +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)*(t3'':real)= &0)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)= &0)`) +THEN RESA_TAC +THEN ASSUME_TAC(REAL_ARITH`~(&1= &0)`) +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN STRIP_TAC +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN STRIP_TAC +THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` w-x:real^3`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(inv(&1- t1'')) * t3'':real`[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`]) +THEN MRESAL_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`inv(&1- t1'')`;`u - x:real^3`; `v - x:real^3`; `v'-x:real^3`] +[VECTOR_ARITH`&1 %A=A`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v,v'}= {(--x) +x, (--x) +u, (--x) +v, (--x) + v'}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, v'}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN DISCH_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `v':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN MRESA_TAC exists_element_in_half_sapace_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;` v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; +` (v':real^3)`] +THEN MRESAL_TAC exists_cut_small_edges_fan_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1:real`;`v':real^3`;`u':real^3`][REAL_ARITH`&0< &1/\ &1<= &1`;VECTOR_ARITH`(&1 - &1) % u + &1 % w=w`] +THEN MRESAL_TAC not_cut_in_edges_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1 -t:real`] +[REAL_ARITH`(&0< &1- t<=> t< &1)/\ (&1- t< &1<=> &0< t)`;VECTOR_ARITH`(&1 - (&1 - t)) % u + (&1 - t) % w=(&1 - t) % w +t % u`;SET_RULE`aff_gt {x} {v, (&1 - t) % w + t % u} INTER + {v | ?e. e IN E /\ v IN aff_ge {x} e} = + {}<=> !e. e IN E ==> aff_gt {x} {v, (&1 - t) % w + t % u} INTER + aff_ge {x} e = + {}`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`{v',u':real^3}`) +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v':real^3`;`u':real^3`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*14*) + + +SUBGOAL_THEN`~(w' IN aff_gt {x} { x',v:real^3})` ASSUME_TAC + +THENL(*15*)[ +REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC aff_gt3_subset_aff_gt[`x:real^3`;`v:real^3`;`w:real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN SET_TAC[] +;(*15*) + +MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`v:real^3`;`w':real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*16*)[ +MRESA_TAC aff_gt1_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3`;`x':real^3`] +THEN MP_TAC(SET_RULE`v IN aff_gt {x} {x', w':real^3} /\ aff_gt {x} {x', w'} SUBSET aff_ge {x} {v', w'} +==>v IN aff_ge {x} {v', w':real^3}`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v:real^3`; `u:real^3`; `v':real^3`;`w':real^3`]properties_of_fan7) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*17*)[ + +MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`; `w':real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)]) +THEN MP_TAC(PI_WORKS) +THEN REAL_ARITH_TAC;(*17*) + +MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`; `w':real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)] +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v:real^3`; `w:real^3`;`x':real^3`] +THEN DISCH_TAC +THEN REWRITE_TAC[th]) +THEN MRESA_TAC AZIM_EQ_PI_SYM [`x:real^3`;`x':real^3`; `v':real^3`;`v:real^3`] +THEN ASSUME_TAC(REAL_ARITH`pi <= pi`) +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`w:real^3`;`v':real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A=A+B <=> B= &0`] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`w:real^3`;`v':real^3`] +THEN MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`v':real^3`;`w:real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*18*)[ + +MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `w:real^3`;`x':real^3`] +THEN ASM_TAC THEN SET_TAC[];(*18*) + +MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`w':real^3`; `v':real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC THEN STRIP_TAC +THEN MP_TAC(SET_RULE`w IN aff_ge {x} {v', x':real^3} /\ aff_ge {x} {v', x'} SUBSET aff_ge {x} {v', w'} +==>w IN aff_ge {x} {v', w':real^3}`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `w:real^3`; `u:real^3`; `v':real^3`;`w':real^3`]properties_of_fan7) +THEN ASM_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THENL(*19*)[ ASM_REWRITE_TAC[];(*19*) +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "XONG") +THEN DISCH_TAC +THEN REMOVE_THEN "XONG" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC PI_WORKS +THEN REAL_ARITH_TAC +](*19*)](*18*)](*17*);(*16*) + +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN DISCH_TAC +THEN MRESA_TAC aff_ge_subset_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;`(x':real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MP_TAC(SET_RULE`aff_ge {x} {v, x':real^3} SUBSET aff_gt {x, v} {x'} UNION aff_ge {x} {v} /\ w' IN aff_ge {x} {v, x'} ==> w' IN aff_gt {x, v} {x'} UNION aff_ge {x} {v}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(x':real^3)`;`(v:real^3)`] +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;UNION] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `w':real^3`; `v':real^3`; `v:real^3`;`u:real^3`]properties1_of_fan7) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(SYM(th))) +THEN DISCH_TAC +THEN MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v':real^3)`;`(w':real^3)`] +THEN SUBGOAL_THEN`v IN aff_ge {x} {v', w':real^3}`ASSUME_TAC +THENL(*17*)[ +POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[];(*17*) + +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"NHAT") +THEN DISCH_TAC +THEN REMOVE_THEN "NHAT" MP_TAC +THEN DISCH_TAC +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`; `w':real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)] +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v:real^3`; `w:real^3`;`x':real^3`] +THEN STRIP_TAC THEN REWRITE_TAC[th]) +THEN MRESA_TAC AZIM_EQ_PI_SYM [`x:real^3`;`x':real^3`; `v':real^3`;`v:real^3`] +THEN ASSUME_TAC(REAL_ARITH`pi <= pi`) +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`w:real^3`;`v':real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A=A+B <=> B= &0`] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`w:real^3`;`v':real^3`] +THEN MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`v':real^3`;`w:real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*18*)[ + +MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `w:real^3`;`x':real^3`] +THEN ASM_TAC THEN SET_TAC[];(*18*) + +MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`w':real^3`; `v':real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC THEN STRIP_TAC +THEN MP_TAC(SET_RULE`w IN aff_ge {x} {v', x':real^3} /\ aff_ge {x} {v', x'} SUBSET aff_ge {x} {v', w'} +==>w IN aff_ge {x} {v', w':real^3}`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `w:real^3`; `u:real^3`; `v':real^3`;`w':real^3`]properties_of_fan7) +THEN ASM_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THENL(*19*)[ +ASM_REWRITE_TAC[];(*19*) +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "XONG") +THEN DISCH_TAC +THEN REMOVE_THEN "XONG" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC PI_WORKS +THEN REAL_ARITH_TAC](*19*)](*18*)](*17*)]]]];(*12*) + + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CUOI") +THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3 `;`x':real^3`] +THEN ASSUME_TAC(REAL_ARITH`pi<= pi`) +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A=B+A<=>B= &0`] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`] +THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`] +THEN MRESA_TAC AZIM_EQ_0[`x:real^3`;`x':real^3`;`v':real^3`;`v:real^3`] +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`v':real^3`;`v:real^3`] +THEN DISJ_CASES_TAC(SET_RULE`w' IN aff_gt {x} {v,w:real^3}\/ ~(w' IN aff_gt {x} {v,w:real^3})`) +THENL(*13*)[ + +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"DICH CHUYEN") +THEN DISCH_TAC +THEN REMOVE_THEN "DICH CHUYEN"(fun th->MP_TAC(th) THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN REMOVE_ASSUM_TAC + THEN ASSUME_TAC(th)) +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`w' = t1'' % x + t2'' % v + t3'' % va<=> + ((t1''+t2''+t3'')- &1) % x + t2'' % (v-x) + t3'' % (va-x)= w' -x:real^3`;REAL_ARITH`&1- &1 = &0`] +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(REAL_ARITH`&0< t2'' /\ &0< t3'' /\ t1''+t2''+t3''= &1==> &0 < &1- t1'' /\ ~(&1- t1'' = &0)/\ t2''+t3''= &1- t1''`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2'' + t3'' = &1 - t1'':real +==> (inv ( &1 - t1''))*(t2'' + t3'') = (inv ( &1 - t1''))*( &1 - t1'':real) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1- A*C = A*B`] +THEN STRIP_TAC +THEN MRESA_TAC REAL_LT_MUL[`inv(&1- t1'':real)`;`t3'':real`] +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)*(t3'':real)= &0)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)= &0)`) +THEN RESA_TAC +THEN ASSUME_TAC(REAL_ARITH`~(&1= &0)`) +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN DISCH_TAC +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, w}= {(--x) +x, (--x) +v, (--x) +u, (--x) + w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN DISCH_TAC +THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;`w-x:real^3`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(inv(&1- t1'')) * t3'':real`[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`]) +THEN MRESAL_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`inv(&1- t1'')`;`u - x:real^3`; `v - x:real^3`; `w'-x:real^3`] +[VECTOR_ARITH`&1 %A=A`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v,w'}= {(--x) +x, (--x) +u, (--x) +v, (--x) + w'}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w'}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN DISCH_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `w':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN MRESA_TAC exists_element_in_half_sapace_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w':real^3`;` v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; +` (w':real^3)`] +THEN MRESAL_TAC exists_cut_small_edges_fan_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1:real`;`w':real^3`;`u':real^3`] +[REAL_ARITH`&0< &1/\ &1<= &1`;VECTOR_ARITH`(&1 - &1) % u + &1 % w=w`] +THEN MRESAL_TAC not_cut_in_edges_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1 -t:real`] +[REAL_ARITH`(&0< &1- t<=> t< &1)/\ (&1- t< &1<=> &0< t)`;VECTOR_ARITH`(&1 - (&1 - t)) % u + (&1 - t) % w=(&1 - t) % w +t % u`;SET_RULE`aff_gt {x} {v, (&1 - t) % w + t % u} INTER + {v | ?e. e IN E /\ v IN aff_ge {x} e} = + {}<=> !e. e IN E ==> aff_gt {x} {v, (&1 - t) % w + t % u} INTER + aff_ge {x} e = + {}`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`{w',u':real^3}`) +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`w':real^3`;`u':real^3`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*13*) + + +DISJ_CASES_TAC(SET_RULE`v' IN aff_gt {x} {v,w:real^3}\/ ~(v' IN aff_gt {x} {v,w:real^3})`) +THENL(*14*)[ + +MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"DICH CHUYEN") +THEN DISCH_TAC +THEN REMOVE_THEN "DICH CHUYEN"(fun th->MP_TAC(th) THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN REMOVE_ASSUM_TAC + THEN ASSUME_TAC(th)) +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`v' = t1'' % x + t2'' % v + t3'' % va<=> + ((t1''+t2''+t3'')- &1) % x + t2'' % (v-x) + t3'' % (va-x)= v' -x:real^3`;REAL_ARITH`&1- &1 = &0`] +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(REAL_ARITH`&0< t2'' /\ &0< t3'' /\ t1''+t2''+t3''= &1==> &0 < &1- t1'' /\ ~(&1- t1'' = &0)/\ t2''+t3''= &1- t1''`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`&1- (t1'':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2'' + t3'' = &1 - t1'':real +==> (inv ( &1 - t1''))*(t2'' + t3'') = (inv ( &1 - t1''))*( &1 - t1'':real) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1- A*C = A*B`] +THEN STRIP_TAC +THEN MRESA_TAC REAL_LT_MUL[`inv(&1- t1'':real)`;`t3'':real`] +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)*(t3'':real)= &0)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(inv(&1- t1'':real)= &0)`) +THEN RESA_TAC +THEN ASSUME_TAC(REAL_ARITH`~(&1= &0)`) +THEN STRIP_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN DISCH_TAC +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v, w}= {(--x) +x, (--x) +v, (--x) +u, (--x) +w}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, w}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN DISCH_TAC +THEN MRESA_TAC continuous_coplanar_fan[`(vec 0):real^3 `;` u-x:real^3`;` v-x:real^3`;` w-x:real^3`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(inv(&1- t1'')) * t3'':real`[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`]) +THEN MRESAL_TAC COPLANAR_SCALE_ALL [`&1`;`&1`;`inv(&1- t1'')`;`u - x:real^3`; `v - x:real^3`; `v'-x:real^3`] +[VECTOR_ARITH`&1 %A=A`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\x'. --x + x') {x:real^3, u, v,v'}= {(--x) +x, (--x) +u, (--x) +v, (--x) + v'}`) +THEN MRESAL_TAC COPLANAR_TRANSLATION_EQ[`--(x:real^3)`;`{x:real^3, u, v, v'}`][VECTOR_ARITH`(--A)+B=B-A:real^3`;VECTOR_ARITH`A-A=(vec 0):real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN DISCH_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th `v':real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN MRESA_TAC exists_element_in_half_sapace_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;` v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u':real^3)`; +` (v':real^3)`] +THEN MRESAL_TAC exists_cut_small_edges_fan_le[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1:real`;`v':real^3`;`u':real^3`] +[REAL_ARITH`&0< &1/\ &1<= &1`;VECTOR_ARITH`(&1 - &1) % u + &1 % w=w`] +THEN MRESAL_TAC not_cut_in_edges_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`&1 -t:real`] +[REAL_ARITH`(&0< &1- t<=> t< &1)/\ (&1- t< &1<=> &0< t)`;VECTOR_ARITH`(&1 - (&1 - t)) % u + (&1 - t) % w=(&1 - t) % w +t % u`;SET_RULE`aff_gt {x} {v, (&1 - t) % w + t % u} INTER + {v | ?e. e IN E /\ v IN aff_ge {x} e} = + {}<=> !e. e IN E ==> aff_gt {x} {v, (&1 - t) % w + t % u} INTER + aff_ge {x} e = + {}`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`{v',u':real^3}`) +THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v':real^3`;`u':real^3`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*14*) + + + +SUBGOAL_THEN`~(v' IN aff_gt {x} { x',v:real^3})` ASSUME_TAC +THENL(*15*)[ +REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC aff_gt3_subset_aff_gt[`x:real^3`;`v:real^3`;`w:real^3`;`x':real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];(*15*) + +MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`v:real^3`;`v':real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*16*)[ +MRESA_TAC aff_gt12_subset_aff_ge[`x:real^3`;`v':real^3`;`w':real^3`;`x':real^3`] +THEN MP_TAC(SET_RULE`v IN aff_gt {x} {x', v':real^3} /\ aff_gt {x} {x', v'} SUBSET aff_ge {x} {v', w'} +==>v IN aff_ge {x} {v', w':real^3}`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v:real^3`; `u:real^3`; `v':real^3`;`w':real^3`]properties_of_fan7) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*17*)[ + MRESA_TAC aff_gt2_subset_aff_ge [`x:real^3`;`v:real^3`; `w:real^3`;`x':real^3`] +THEN ASSUME_TAC(REAL_ARITH`pi <= pi`) +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`w:real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A=A+B <=> B= &0`] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`w:real^3`;`w':real^3`] +THEN MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`w':real^3`;`w:real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*18*)[ +MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `w:real^3`;`x':real^3`] +THEN ASM_TAC THEN SET_TAC[];(*18*) + +MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `w:real^3`;`x':real^3`] +THEN ASM_TAC THEN SET_TAC[]](*18*);(*17*) + +REMOVE_THEN "CUOI" MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[AZIM_REFL] +THEN MP_TAC(PI_WORKS) +THEN REAL_ARITH_TAC](*17*);(*16*) + +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN DISCH_TAC +THEN MRESA_TAC aff_ge_subset_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;`(x':real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MP_TAC(SET_RULE`aff_ge {x} {v, x':real^3} SUBSET aff_gt {x, v} {x'} UNION aff_ge {x} {v} /\ v' IN aff_ge {x} {v, x'} ==> v' IN aff_gt {x, v} {x'} UNION aff_ge {x} {v}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(x':real^3)`;`(v:real^3)`] +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;UNION] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v':real^3`; `w':real^3`; `v:real^3`;`u:real^3`]properties1_of_fan7) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(SYM(th))) +THEN DISCH_TAC +THEN MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v':real^3)`;`(w':real^3)`] +THEN MRESA_TAC aff_gt2_subset_aff_ge [`x:real^3`;`v:real^3`; `w:real^3`;`x':real^3`] +THEN ASSUME_TAC(REAL_ARITH`pi <= pi`) +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`x':real^3`;`v:real^3`;`w:real^3`;`w':real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A=A+B <=> B= &0`] +THEN DISCH_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`x':real^3`;`w:real^3`;`w':real^3`] +THEN MP_TAC(ISPECL[`x:real^3`;`x':real^3`;`w':real^3`;`w:real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*17*)[ +MRESA_TAC aff_gt1_subset_aff_gt[`x:real^3`;`v:real^3`; `w:real^3`;`x':real^3`] +THEN ASM_TAC THEN SET_TAC[];(*17*) + +MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`v':real^3`; `w':real^3`;`x':real^3`] +THEN MP_TAC(SET_RULE`w IN aff_ge {x} { x',w':real^3} /\ aff_ge {x} { x',w'} SUBSET aff_ge {x} {v', w'} +==>w IN aff_ge {x} {v', w':real^3}`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `w:real^3`; `u:real^3`; `v':real^3`;`w':real^3`]properties_of_fan7) +THEN ASM_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THENL(*18*)[ +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "XONG") +THEN DISCH_TAC +THEN REMOVE_THEN "XONG" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC PI_WORKS +THEN REAL_ARITH_TAC;(*18*) + +ASM_REWRITE_TAC[]](*18*)]]]]]]]]]]]]]]]]]);; + + + + + + + + + +let DHVFGBC=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 a:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ~(aff_gt{x} {v,(&1-a)%u+ a % w} INTER {v | ?e. e IN E /\ v IN aff_ge {x} e}={}) +==> a= &1 /\ independent {v - x, u - x, ((&1 - a) % u + a % w) - x}`, +MESON_TAC[independent_run_edges_fan;cut_in_edges_fan]);; + + + + + + + + + + + + + + + + + + + + +(**********************************************************) +(********************** RWXUYZZ *************************) +(**********************************************************) + +let exists_in_aff_gt=prove(`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u} ==> ?y:real^3. y IN aff_gt {x} {v, u}`, +REPEAT STRIP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0 % x+ &1 / &2 % v+ &1/ &2 %u:real^3 ` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1/ &2` +THEN EXISTS_TAC`&1/ &2` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC);; + + +let cut_inside_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 w1:real^3. +~collinear {x,v,w1} /\ ~collinear {x,u,w} /\ ~collinear {x,v,u} +/\ ~collinear {x,v,w} +/\ &0< azim x u w v /\ azim x u w v < pi +/\ &0< azim x v u w1 /\ azim x v u w1 < pi +/\ &0< azim x v w1 w /\ azim x v w1 w < pi +==> ~(aff_ge {x,v} {w1} INTER aff_gt {x} {u,w:real^3}={})`, +REWRITE_TAC[SET_RULE`~(A={})<=> ?x. x IN A`;IN_ELIM_THM; INTER] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w1:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`u:real^3`;`w:real^3`] +THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"CON") +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`;`w1:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"CON BE") +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`;`w:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"CON EM") +THEN ABBREV_TAC`a1=(v-x):real^3` +THEN ABBREV_TAC`a2=(w1-x):real^3` +THEN ABBREV_TAC`a3=(w-x) :real^3` +THEN ABBREV_TAC`a4=(u-x):real^3` +THEN ABBREV_TAC`va=a1 cross a2:real^3` +THEN ABBREV_TAC`vb=a3 cross a4:real^3` +THEN EXISTS_TAC`(vb:real^3) cross (va:real^3)+(x:real^3)` +THEN STRIP_TAC +THENL(*2*)[ +EXISTS_TAC`&1-(vb:real^3) dot (a2:real^3)+ vb dot (a1:real^3)` +THEN EXISTS_TAC`(vb:real^3) dot (a2:real^3)` +THEN EXISTS_TAC`--((vb:real^3) dot (a1:real^3))` +THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 - vb dot a2 + vb dot a1) + vb dot a2 + --(vb dot a1) = &1`] +THEN SUBGOAL_THEN `&0<= --((vb:real^3) dot (a1:real^3))` ASSUME_TAC +THENL(*3*)[ +EXPAND_TAC"vb" +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[DOT_LNEG] +THEN REMOVE_THEN "CON"MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[] +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_MUL_LNEG] +THEN EXPAND_TAC"a1" +THEN EXPAND_TAC"a2" +THEN VECTOR_ARITH_TAC];(*2*) +ONCE_REWRITE_TAC[CROSS_SKEW] +THEN EXPAND_TAC"vb" +THEN REWRITE_TAC[CROSS_LAGRANGE;] +THEN EXISTS_TAC`&1+(va:real^3) dot (a4:real^3)- va dot (a3:real^3)` +THEN EXISTS_TAC`((va:real^3) dot (a3:real^3))` +THEN EXISTS_TAC`--(va:real^3) dot (a4:real^3)` +THEN ASM_REWRITE_TAC[DOT_LNEG;VECTOR_MUL_LNEG;REAL_ARITH`(&1 + va dot a4 - va dot a3) + va dot a3 + --(va dot a4) = &1`;] +THEN STRIP_TAC +THENL(*3*)[ +EXPAND_TAC"va" +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[DOT_LNEG;CROSS_TRIPLE] +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +EXPAND_TAC"a3" +THEN EXPAND_TAC"a4" +THEN REWRITE_TAC[VECTOR_ARITH`(&1+A-B)%X+B%U+ --(A%V)=X-(A%(V-X)-B%(U-X))`] +THEN VECTOR_ARITH_TAC]]);; + + + + +let exists_cut_in_edge_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 w1:real^3. +~collinear {x,v,w1} /\ ~collinear {x,u,w} /\ ~collinear {x,v,u} +/\ ~collinear {x,v,w} +/\ &0< azim x u w v /\ azim x u w v < pi +/\ &0< azim x v u w1 /\ azim x v u w1 < pi +/\ &0< azim x v w1 w /\ azim x v w1 w < pi +==> ?a. &0< a /\ a< &1 +/\ (&1-a) %u + a % w IN aff_ge {x,v} {w1:real^3}`, + +REPEAT STRIP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w1:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`u:real^3`;`w:real^3`] +THEN MRESAL_TAC AFF_GE_2_1[`x:real^3`;`v:real^3`;`w1:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] +THEN MRESA_TAC cut_inside_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[SET_RULE`~(A={})<=> ?x. x IN A`;INTER;] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`inv(&1-t1')*t3'` +THEN MP_TAC(REAL_ARITH`&0< t2' /\ &0< t3' /\ t1'+t2'+t3'= &1==> &0 < &1- t1' /\ ~(&1- t1' = &0)/\ t2'+t3'= &1- t1'`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`&1- (t1':real)`REAL_LT_INV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`&1- (t1':real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +t2' + t3' = &1 - t1':real +==> (inv ( &1 - t1'))*(t2' + t3') = (inv ( &1 - t1'))*( &1 - t1':real) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> &1 -A*C=A*B`;REAL_ARITH`A< &1 <=> &0< &1-A`] +THEN STRIP_TAC +THEN MRESA_TAC REAL_LT_MUL[`inv (&1- t1'):real`;`t2':real`;] +THEN MRESA_TAC REAL_LT_MUL[`inv (&1- t1'):real`;`t3':real`;] +THEN REWRITE_TAC[VECTOR_ARITH`(A*B)%X+(A*C)%Y=A%(B%X+C%Y)`; VECTOR_ARITH`A%(t2' % u + t3' % w)= A%((t1'%x +t2' % u + t3' % w) - t1' %x) :real^3`] +THEN FIND_ASSUM MP_TAC`x' = t1' % x + t2' % u + t3' % w:real^3` +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(t1 % x + t2 % v + t3 % w1) - t1' % x=(t1-t1') % x + t2 % v + t3 % w1`; +VECTOR_ARITH`A%(B+C+D)=A%B+A%C+A%D`;VECTOR_ARITH`A%B%C=(A*B)%C`] +THEN EXISTS_TAC`(inv (&1 - t1') * (t1 - t1')):real` +THEN EXISTS_TAC`(inv (&1 - t1') * t2):real` +THEN EXISTS_TAC`(inv (&1 - t1') * t3):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1 - t1') * (t1 - t1') + inv (&1 - t1') * t2 + inv (&1 - t1') * t3 +=inv (&1 - t1') * ((t1 +t2 + t3)-t1')`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN REAL_ARITH_TAC);; + + + + +let notcoplanar_imp_notcollinear_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3. +~coplanar {x,v,u,w}==> ~collinear {x,u,w} /\ ~collinear {x,v,u} +/\ ~collinear {x,v,w}`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`x:real^3`;`u:real^3`;`w:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN RESA_TAC +THEN MRESAL_TAC NOT_COPLANAR_NOT_COLLINEAR [`x:real^3`;`v:real^3`;`w:real^3`;`u:real^3`][SET_RULE`{A,B,C,D}={A,B,D,C}`]);; + + +let properties_of_fully_surrounded1_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 w1:real^3. +~coplanar {x,v,u,w}/\ &0< azim x u w v /\ azim x u w v < pi +==> &0 < azim x v u w /\ azim x v u w < pi`, +REPEAT STRIP_TAC +THEN MRESA_TAC azim[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`;`(w:real^3)`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THENL[ + MP_TAC(REAL_ARITH` &0<= azim x v u (w:real^3) ==> azim x v u w = &0 \/ &0< azim x v u w`) +THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`]; + +MP_TAC(REAL_ARITH` (azim x v u w = pi) \/ (pi < azim x v u w) \/ azim x v u w< pi`) +THEN RESA_TAC +THENL[ +MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`]; + +MP_TAC(REAL_ARITH`pi< azim x v u w /\ azim x v u w < &2 * pi ==> &0< azim x v u w - pi /\ azim x v u w - pi< pi`) +THEN RESA_TAC +THEN MRESAL1_TAC SIN_POS_PI`azim x v u (w:real^3) -pi`[SIN_SUB; SIN_PI; COS_PI;REAL_ARITH`&0< A * -- &1 -B * &0 <=> A < &0`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AZIM_TRANSLATION[`-- x:real^3`;`x:real^3`;`v:real^3`;` u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`x-x= vec 0`;VECTOR_ARITH`(-- X)+A= A-X:real^3`] +THEN DISCH_TAC +THEN MRESA_TAC JBDNJJB[`(v-x):real^3`;`u-x:real^3`;`w-x:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM COLLINEAR_3;] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESAL_TAC REAL_LT_LMUL_EQ[`(((v - x) cross (u - x)) dot (w - x:real^3))`;`&0`;`t:real`][REAL_ARITH`A * &0= &0`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[DOT_LNEG;CROSS_TRIPLE] +THEN MRESA1_TAC SIN_POS_PI`azim x u (w:real^3) v` +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AZIM_TRANSLATION[`-- x:real^3`;`x:real^3`;`u:real^3`;` w:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`x-x= vec 0`;VECTOR_ARITH`(-- X)+A= A-X:real^3`] +THEN DISCH_TAC +THEN MRESA_TAC JBDNJJB[`(u-x):real^3`;`w-x:real^3`;`v-x:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM COLLINEAR_3;] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESAL_TAC REAL_LT_LMUL_EQ[`&0`;`(((u - x) cross (w - x)) dot (v - x:real^3))`;`t':real`][REAL_ARITH`A * &0= &0`] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]) +;; + + + + + + +let in_aff_2_2_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3. +~coplanar {x,v,u,w} +==> +(!t:real. &0< t /\ t< &1 +==> (!t1:real t2:real t3:real. &0t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w) IN aff_gt {x,v} {u,w}))`, + + +REPEAT STRIP_TAC +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`] +THEN SUBGOAL_THEN `DISJOINT {x,v:real^3} {u,w:real^3}` ASSUME_TAC +THENL[ +REWRITE_TAC[DISJOINT_SYM;SET_RULE`{v:real^3,w:real^3}= {v} UNION {w}`;DISJOINT_UNION] +THEN REWRITE_TAC[SET_RULE`{v} UNION {w}={v:real^3,w:real^3}`] +THEN ONCE_REWRITE_TAC[DISJOINT_SYM] +THEN ASM_REWRITE_TAC[]; +MRESAL_TAC AFF_GT_2_2[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t3*(&1-t):real` +THEN EXISTS_TAC`t3*(t):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`t1 +t2+ t3 * (&1 - t) + t3 * t = t1+t2+t3:real`;VECTOR_ARITH`t1 % x + t2 % v + t3 % ((&1 - t) % u + t % w) = + t1 % x + t2 % v + (t3 * (&1 - t)) % u + (t3 * t) % w:real^3`] +THEN STRIP_TAC THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_TAC +THEN REAL_ARITH_TAC]);; + + + +let inequality4_aim_in_convex_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 a:real. +~coplanar {x,v,u,w}/\ &0< azim x u w v /\ azim x u w v < pi +/\ &0< a /\ a < &1 +==> +&0< azim x v u ((&1 - a) % u + a % w) +/\ azim x v u ((&1 - a) % u + a % w)< azim x v u w `, + +REPEAT STRIP_TAC +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC properties_of_fully_surrounded1_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN MRESA_TAC WEDGE_LUNE_GT[`x:real^3`;` v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MP_TAC(SYM(th))) +THEN DISCH_TAC +THEN MRESA_TAC in_aff_2_2_fan[`x:real^3`;` v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `a:real`) +THEN POP_ASSUM(fun th-> MRESAL_TAC th [`&0:real`;`&0`;`&1`][REAL_ARITH`&0< &1/\ &0+ &0 + &1 = &1`;wedge;IN_ELIM_THM]) +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REDUCE_VECTOR_TAC +THEN DISCH_TAC THEN DISCH_TAC +THEN ASM_REWRITE_TAC[]);; + + +let condition_to_in_aff_gt_by_angle=prove(`!x:real^3 v:real^3 u:real^3 s1:real. +~collinear {x,v,u} /\ &0< (v - x) dot (u - x) /\ &0< s1 +/\ s1< atn ((norm ((v - x) cross (u - x))) * inv((v - x) dot (u - x))) +==> +sin s1 % e1_fan x v u + cos s1 % e3_fan x v u + x IN aff_gt {x} {v, u}`, +REPEAT STRIP_TAC +THEN ASSUME_TAC(ISPEC`(norm ((v - x) cross (u - x)) * inv ((v - x) dot (u - x))):real`ATN_BOUNDS) +THEN MP_TAC (REAL_ARITH`s1< atn ((norm ((v - x) cross (u - x))) * inv((v - x) dot (u - x))) +/\ atn ((norm ((v - x) cross (u - x))) * inv((v - x) dot (u - x))) < pi/ &2 +==> s1< pi / &2`) THEN RESA_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN REWRITE_TAC[VECTOR_ARITH`sin s1 % e1_fan x v u + cos s1 % e3_fan x v u + x = + t1 % x + t2 % v + t3 % u +<=> sin s1 % e1_fan x v u + cos s1 % e3_fan x v u = + (t1- &1) % x + t2 % v + t3 % u`;e1_fan;e2_fan;e3_fan;CROSS_LMUL;CROSS_RMUL] +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_ARITH`-- (A-B) = B-A:real^3`] +THEN SUBGOAL_THEN`~(norm((v:real^3)-(x:real^3))= &0)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[NORM_EQ_0;VECTOR_ARITH`v-x=vec 0<=> x=v`]; +MP_TAC(ISPEC`norm((v:real^3)-(x:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; REAL_ARITH`(((A*B)*D)*D)=A*B*(D pow 2)`;] +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`A%(B-C)=A%B-A%C`] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;DOT_SQUARE_NORM;REAL_ARITH`(A*B*C pow 2) * D pow 2=A*B*(C*D) pow 2`;REAL_ARITH`A* &1 pow 2=A`;NORM_MUL;REAL_ABS_INV;REAL_ABS_NORM;REAL_INV_MUL;REAL_INV_INV +; ] +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B*C) * D pow 2= A*C * D*(D*B)`;REAL_ARITH`A*B* &1= A*B`;VECTOR_ARITH`A-B+C%D-C%E=A-B+C%(D-E)`;VECTOR_ARITH`A-C%D+B%D=A+(B-C)%D`; +REAL_ARITH`A*B-(C*D*B)*E=B*(A-C*D*E)`] +THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] +THEN SUBGOAL_THEN`~(norm((v - x) cross (u - x:real^3))= &0)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[NORM_EQ_0] +THEN MP_TAC(ISPECL[`v-x:real^3`;`u-x:real^3`]CROSS_EQ_0) +THEN ONCE_REWRITE_TAC[GSYM COLLINEAR_3;] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[]; +MP_TAC(ISPEC`norm((v - x) cross (u - x:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`(v - x) cross (u - x:real^3)`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(norm ((v - x) cross (u - x:real^3)) = &0)/\ &0 <= norm ((v - x) cross (u - x:real^3))==> &0< norm ((v - x) cross (u - x:real^3)) `) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`norm((v - x) cross (u - x:real^3))` + +THEN ASSUME_TAC(ISPEC`(v - x:real^3)`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(norm ((v - x:real^3)) = &0)/\ &0 <= norm ((v - x:real^3))==> &0< norm ((v - x:real^3)) `) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`norm((v - x:real^3))` +THEN MRESA1_TAC COS_POS_PI2`s1:real` +THEN MRESA1_TAC SIN_POS_PI2`s1:real` +THEN EXISTS_TAC`&1-(sin s1 * norm (v - x) * inv (norm ((v - x) cross (u - x)))) +-(inv (norm (v - x)) * + (cos s1 - + sin s1 * inv (norm ((v - x) cross (u - x))) * ((v - x) dot (u - x:real^3))))` +THEN EXISTS_TAC `(inv (norm (v - x)) * + (cos s1 - + sin s1 * inv (norm ((v - x) cross (u - x))) * ((v - x) dot (u - x:real^3))))` +THEN EXISTS_TAC`(sin s1 * norm (v - x) * inv (norm ((v - x) cross (u - x:real^3))))` +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0 B --(pi / &2) < s1`) +THEN RESA_TAC +THEN MRESAL_TAC TAN_MONO_LT[`s1:real`;`atn (norm ((v - x) cross (u - x)) * inv ((v - x) dot (u - x))):real`][ATN_TAN] +THEN MRESAL_TAC REAL_LT_LMUL[`inv (norm ((v - x) cross (u - x:real^3)))`;`tan s1:real`;`norm ((v - x) cross (u - x)) * inv ((v - x) dot (u - x:real^3))`][REAL_ARITH`A*B*C=(A*B)*C`;REAL_ARITH`&1*A=A`] +THEN MP_TAC(REAL_ARITH`&0<(v - x) dot (u - x:real^3)==> ~((v - x) dot (u - x:real^3)= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(v - x) dot (u - x:real^3)`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(cos s1= &0)`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`cos s1`REAL_MUL_LINV) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LT_RMUL[`inv (norm ((v - x) cross (u - x:real^3)))* tan s1:real`;`inv ((v - x) dot (u - x:real^3))`;`(v - x) dot (u - x:real^3)`][REAL_ARITH`(A*B)*C=A*C*B`;tan] + +THEN MRESAL_TAC REAL_LT_RMUL[`inv (norm ((v - x) cross (u - x:real^3)))* ((v - x) dot (u - x:real^3))* sin s1 / cos s1`;`&1`;`cos s1`][REAL_ARITH`&1* A=A`;real_div;REAL_ARITH`(A*B*C*D)*E=(C*A*B)*(D*E)`;REAL_ARITH`A* &1=A`] +THEN ASM_TAC THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ +MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]; + +STRIP_TAC +THENL[ +REAL_ARITH_TAC; +VECTOR_ARITH_TAC]]]]]);; + + + + + + + + +let condition1_to_in_aff_gt_by_angle=prove(`!x:real^3 v:real^3 u:real^3 s1:real. +~collinear {x,v,u} /\ &0< s1 /\ s1< pi/ &2 +/\ (v - x) dot (u - x:real^3) <= &0 +==> +sin s1 % e1_fan x v u + cos s1 % e3_fan x v u + x IN aff_gt {x} {v, u}`, + +REPEAT STRIP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN REWRITE_TAC[VECTOR_ARITH`sin s1 % e1_fan x v u + cos s1 % e3_fan x v u + x = + t1 % x + t2 % v + t3 % u +<=> sin s1 % e1_fan x v u + cos s1 % e3_fan x v u = + (t1- &1) % x + t2 % v + t3 % u`;e1_fan;e2_fan;e3_fan;CROSS_LMUL;CROSS_RMUL] +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_ARITH`-- (A-B) = B-A:real^3`] +THEN SUBGOAL_THEN`~(norm((v:real^3)-(x:real^3))= &0)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[NORM_EQ_0;VECTOR_ARITH`v-x=vec 0<=> x=v`]; +MP_TAC(ISPEC`norm((v:real^3)-(x:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; REAL_ARITH`(((A*B)*D)*D)=A*B*(D pow 2)`;] +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`A%(B-C)=A%B-A%C`] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;DOT_SQUARE_NORM;REAL_ARITH`(A*B*C pow 2) * D pow 2=A*B*(C*D) pow 2`;REAL_ARITH`A* &1 pow 2=A`;NORM_MUL;REAL_ABS_INV;REAL_ABS_NORM;REAL_INV_MUL;REAL_INV_INV +; ] +THEN ASM_REWRITE_TAC[REAL_ARITH`A*(B*C) * D pow 2= A*C * D*(D*B)`;REAL_ARITH`A*B* &1= A*B`;VECTOR_ARITH`A-B+C%D-C%E=A-B+C%(D-E)`;VECTOR_ARITH`A-C%D+B%D=A+(B-C)%D`; +REAL_ARITH`A*B-(C*D*B)*E=B*(A-C*D*E)`] +THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] +THEN SUBGOAL_THEN`~(norm((v - x) cross (u - x:real^3))= &0)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[NORM_EQ_0] +THEN MP_TAC(ISPECL[`v-x:real^3`;`u-x:real^3`]CROSS_EQ_0) +THEN ONCE_REWRITE_TAC[GSYM COLLINEAR_3;] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[]; +MP_TAC(ISPEC`norm((v - x) cross (u - x:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`(v - x) cross (u - x:real^3)`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(norm ((v - x) cross (u - x:real^3)) = &0)/\ &0 <= norm ((v - x) cross (u - x:real^3))==> &0< norm ((v - x) cross (u - x:real^3)) `) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`norm((v - x) cross (u - x:real^3))` + +THEN ASSUME_TAC(ISPEC`(v - x:real^3)`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(norm ((v - x:real^3)) = &0)/\ &0 <= norm ((v - x:real^3))==> &0< norm ((v - x:real^3)) `) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`norm((v - x:real^3))` +THEN MRESA1_TAC COS_POS_PI2`s1:real` +THEN MRESA1_TAC SIN_POS_PI2`s1:real` +THEN EXISTS_TAC`&1-(sin s1 * norm (v - x) * inv (norm ((v - x) cross (u - x)))) +-(inv (norm (v - x)) * + (cos s1 - + sin s1 * inv (norm ((v - x) cross (u - x))) * ((v - x) dot (u - x:real^3))))` +THEN EXISTS_TAC `(inv (norm (v - x)) * + (cos s1 - + sin s1 * inv (norm ((v - x) cross (u - x))) * ((v - x) dot (u - x:real^3))))` +THEN EXISTS_TAC`(sin s1 * norm (v - x) * inv (norm ((v - x) cross (u - x:real^3))))` +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0 B sin s1 * inv (norm ((v - x) cross (u - x))) * ((v - x) dot (u - x)) < cos s1`) +THEN ASM_REWRITE_TAC[REAL_ARITH`A *B *C<= &0<=> &0<= A*B*(-- C)`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN MP_TAC(REAL_ARITH`&0< sin s1==> &0<= sin s1`) THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN MP_TAC(REAL_ARITH`&0< inv (norm ((v - x) cross (u - x)))==> &0<= inv (norm ((v - x) cross (u - x)))`) THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ +MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THENL[ +REAL_ARITH_TAC; +VECTOR_ARITH_TAC]]]]]);; + + + + +let angle_is_small_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ fan80(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> + azim x v u w <= azim x v u (sigma_fan x V E v u) `, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "BE") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "BE" MP_TAC +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `v:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge v V E = {u} \/ ~(set_of_edge v V E = {u:real^3})`) +THENL(*1*)[ +MRESA_TAC CARD_SING[`u:real^3`; `(set_of_edge v V E):real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) +THEN ASM_TAC THEN ARITH_TAC;(*1*) +MRESA_TAC SIGMA_FAN[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` sigma_fan x V E v (u:real^3)`;` (v:real^3)`] +THEN POP_ASSUM MP_TAC THEN RESA_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`] +THEN ABBREV_TAC`w1=(sigma_fan x V E v u) :real^3` +THEN MRESA_TAC properties_of_fully_surrounded1_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN DISJ_CASES_TAC(REAL_ARITH` azim x v u w1 < azim x v u w\/ azim x v u w <= azim x v u w1 `) +THENL(*2*)[ +MP_TAC(REAL_ARITH`azim x v u w1 < azim x v u w ==> azim x v u w1 <= azim x v u w`) +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`;`w:real^3`] +THEN MP_TAC(REAL_ARITH` &0< azim x v u w1 /\ azim x v u w1 < azim x v u w /\ azim x v u w = azim x v u w1 + azim x v w1 w +==> &0< azim x v w1 w /\ azim x v w1 w <= azim x v u w`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x v w1 w <= azim x v u w /\ azim x v u w < pi +==> azim x v w1 w < pi`) +THEN RESA_TAC +THEN MRESA_TAC exists_cut_in_edge_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[SET_RULE`~(A={})<=> ?x. x IN A`;INTER] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ABBREV_TAC`va=(&1-a)%u + a%w:real^3` +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w1:real^3`;`va:real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*3*)[ +MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v:real^3)`;`(w1:real^3)`] +THEN MRESA_TAC not_cut_in_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MP_TAC(SET_RULE`w1 IN aff_gt {x} {v, va} + /\ w1 IN aff_ge {x} {v, w1}==> ~(aff_gt {x} {v, va} INTER aff_ge {x:real^3} {v, w1}={})`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`{v,w1:real^3} IN E` +THEN SET_TAC[];(*3*) +MRESA_TAC pos_in_aff_ge_fan [`x:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MP_TAC(SET_RULE`va IN aff_ge {x} {v, w1:real^3} /\ va IN aff_ge {x} {u, w} +==>va IN aff_ge {x} {u, w} INTER aff_ge {x} {v, w1:real^3} `) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPECL[`{(u:real^3),(w:real^3)}`;`{(v:real^3),(w1:real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] +THEN DISCH_TAC THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`~(v=u) /\ DISJOINT{x,v} {w} ==> ~(v IN {u,w:real^3}) `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(v IN {u,w:real^3})/\ ~(u=w)==> ~({u, w} INTER {v, w1} = {u, w:real^3})`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~({u, w} INTER {v, w1} = {u, w:real^3}) ==> {u, w} INTER {v, w1} PSUBSET {u, w} `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{u, w} INTER {v, w1} PSUBSET {u, w:real^3} ==> {u, w} INTER {v, w1} SUBSET {u}\/ {u, w} INTER {v, w1} SUBSET {w} `) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*4*)[ +MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v, w1:real^3}`; `{u:real^3}`][DISJOINT;SET_RULE`{x} INTER {u} = {}<=> ~(x=u:real^3)`] +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{u:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] +THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v, w1}) SUBSET aff_ge {x} {u}/\ aff_ge {x} {u} SUBSET aff {x, u}/\ va IN aff_ge {x} ({u, w} INTER {v, w1})==> va IN aff {x,u}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % u +<=> a % w = u' % x + (v''+a- &1) % u`] +THEN MP_TAC(REAL_ARITH`&0< a==> ~(a = &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`a % w = u' % x + (v' + a - &1) % u:real^3 ==> (inv (a))%(a % w ) = (inv (a))%( u' % x + (v' + a - &1) % u)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN `w IN aff {x,u:real^3}` ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`(inv a * u'):real` +THEN EXISTS_TAC`(inv a * (v' + a - &1)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv a * u' + inv a * (v' + a - &1) =inv a * ( a+ (u' + v') - &1)`;REAL_ARITH`A+ &1- &1=A`];(*5*) +POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `~(w IN aff {x, u:real^3})` +THEN SET_TAC[]](*5*);(*4*) + +FIND_ASSUM MP_TAC`{u,w:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`w:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v, w1:real^3}`; `{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {w} = {}<=> ~(x=w:real^3)`] +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{w:real^3}`][SET_RULE`{x} UNION {w}={x,w}`;GSYM aff] +THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v, w1}) SUBSET aff_ge {x} {w}/\ aff_ge {x} {w} SUBSET aff {x, w}/\ va IN aff_ge {x} ({u, w} INTER {v, w1})==> va IN aff {x,w}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % w +<=> (&1-a) % u = u' % x + (v''-a) % w`] +THEN MP_TAC(REAL_ARITH`a < &1==> ~(&1- a= &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`&1-a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(&1-a) % u = u' % x + (v' - a) % w:real^3 ==> (inv (&1-a))%((&1-a) % u ) = (inv (&1-a))%( u' % x + (v' - a) % w)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN `u IN aff {x,w:real^3}` ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`(inv (&1-a) * u'):real` +THEN EXISTS_TAC`(inv (&1-a) * (v' - a)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1-a') * u' + inv (&1-a') * (v' - a') =inv (&1-a') * ( (u' + v') - a')`;];(*5*) + +POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `~(u IN aff {x, w:real^3})` +THEN SET_TAC[]](*5*)](*4*)](*3*);(*2*) + +ASM_REWRITE_TAC[]]]);; + + + +let angle_is_smallpi_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ fan80(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> +&0< azim x v u w /\ azim x v u w MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN SUBGOAL_THEN`~(azim x v u (w:real^3)= &0)`ASSUME_TAC +THENL[STRIP_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`]; +MATCH_MP_TAC(REAL_ARITH`~(azim x v u (w:real^3)= &0)/\ &0<= azim x v u w ==> &0 < azim x v u w`) +THEN ASM_REWRITE_TAC[azim]]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "BE") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "BE" MP_TAC +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC angle_is_small_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w:real^3`] +THEN ASM_TAC THEN REAL_ARITH_TAC]);; + + + + +let exists_rw_dart_inter_aff_gt_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 . +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ fan80(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> +(?h:real. &0< h /\ +(!t:real. &0< t /\ t< h==> +(!s:real. &0 +~(rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),(sigma_fan x V E v (u:real^3))) (cos(s)) INTER aff_gt {x} {v, (&1-t)%u+t%w}={}) +)))`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "BE") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "BE" MP_TAC +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `v:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge v V E = {u} \/ ~(set_of_edge v V E = {u:real^3})`) +THENL(*1*)[ +MRESA_TAC CARD_SING[`u:real^3`; `(set_of_edge v V E):real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) +THEN ASM_TAC THEN ARITH_TAC;(*1*) + +MRESA_TAC SIGMA_FAN[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` sigma_fan x V E v (u:real^3)`;` (v:real^3)`] +THEN POP_ASSUM MP_TAC THEN RESA_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`] +THEN ABBREV_TAC`w1=(sigma_fan x V E v u) :real^3` +THEN MRESA_TAC properties_of_fully_surrounded1_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN DISJ_CASES_TAC(REAL_ARITH` azim x v u w1 < azim x v u w\/ azim x v u w <= azim x v u w1 `) +THENL(*2*)[ +MP_TAC(REAL_ARITH`azim x v u w1 < azim x v u w ==> azim x v u w1 <= azim x v u w`) +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`;`w:real^3`] +THEN MP_TAC(REAL_ARITH` &0< azim x v u w1 /\ azim x v u w1 < azim x v u w /\ azim x v u w = azim x v u w1 + azim x v w1 w +==> &0< azim x v w1 w /\ azim x v w1 w <= azim x v u w`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x v w1 w <= azim x v u w /\ azim x v u w < pi +==> azim x v w1 w < pi`) +THEN RESA_TAC +THEN MRESA_TAC exists_cut_in_edge_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[SET_RULE`~(A={})<=> ?x. x IN A`;INTER] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ABBREV_TAC`va=(&1-a)%u + a%w:real^3` +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w1:real^3`;`va:real^3`] decomposition_planar_by_angle_fan) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*3*)[ +MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v:real^3)`;`(w1:real^3)`] +THEN MRESA_TAC not_cut_in_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MP_TAC(SET_RULE`w1 IN aff_gt {x} {v, va} + /\ w1 IN aff_ge {x} {v, w1}==> ~(aff_gt {x} {v, va} INTER aff_ge {x:real^3} {v, w1}={})`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`{v,w1:real^3} IN E` +THEN SET_TAC[];(*3*) + +MRESA_TAC pos_in_aff_ge_fan [`x:real^3`;`u:real^3`;`w:real^3`;`a:real`] +THEN MP_TAC(SET_RULE`va IN aff_ge {x} {v, w1:real^3} /\ va IN aff_ge {x} {u, w} +==>va IN aff_ge {x} {u, w} INTER aff_ge {x} {v, w1:real^3} `) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPECL[`{(u:real^3),(w:real^3)}`;`{(v:real^3),(w1:real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM;] +THEN DISCH_TAC THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`~(v=u) /\ DISJOINT{x,v} {w} ==> ~(v IN {u,w:real^3}) `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(v IN {u,w:real^3})/\ ~(u=w)==> ~({u, w} INTER {v, w1} = {u, w:real^3})`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~({u, w} INTER {v, w1} = {u, w:real^3}) ==> {u, w} INTER {v, w1} PSUBSET {u, w} `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{u, w} INTER {v, w1} PSUBSET {u, w:real^3} ==> {u, w} INTER {v, w1} SUBSET {u}\/ {u, w} INTER {v, w1} SUBSET {w} `) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*4*)[ +MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v, w1:real^3}`; `{u:real^3}`][DISJOINT;SET_RULE`{x} INTER {u} = {}<=> ~(x=u:real^3)`] +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{u:real^3}`][SET_RULE`{x} UNION {u}={x,u}`;GSYM aff] +THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v, w1}) SUBSET aff_ge {x} {u}/\ aff_ge {x} {u} SUBSET aff {x, u}/\ va IN aff_ge {x} ({u, w} INTER {v, w1})==> va IN aff {x,u}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % u +<=> a % w = u' % x + (v''+a- &1) % u`] +THEN MP_TAC(REAL_ARITH`&0< a==> ~(a = &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`a % w = u' % x + (v' + a - &1) % u:real^3 ==> (inv (a))%(a % w ) = (inv (a))%( u' % x + (v' + a - &1) % u)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN `w IN aff {x,u:real^3}` ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`(inv a * u'):real` +THEN EXISTS_TAC`(inv a * (v' + a - &1)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv a * u' + inv a * (v' + a - &1) =inv a * ( a+ (u' + v') - &1)`;REAL_ARITH`A+ &1- &1=A`];(*5*) +POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `~(w IN aff {x, u:real^3})` +THEN SET_TAC[]](*5*);(*4*) + +FIND_ASSUM MP_TAC`{u,w:real^3} IN E` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`w:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESAL_TAC AFF_GE_MONO_RIGHT [`{x:real^3}`;`{u, w} INTER {v, w1:real^3}`; `{w:real^3}`][DISJOINT;SET_RULE`{x} INTER {w} = {}<=> ~(x=w:real^3)`] +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{x:real^3}`;`{w:real^3}`][SET_RULE`{x} UNION {w}={x,w}`;GSYM aff] +THEN MP_TAC(SET_RULE`aff_ge {x:real^3} ({u, w} INTER {v, w1}) SUBSET aff_ge {x} {w}/\ aff_ge {x} {w} SUBSET aff {x, w}/\ va IN aff_ge {x} ({u, w} INTER {v, w1})==> va IN aff {x,w}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - a) % u + a % w = u' % x + v'' % w +<=> (&1-a) % u = u' % x + (v''-a) % w`] +THEN MP_TAC(REAL_ARITH`a < &1==> ~(&1- a= &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`&1-a:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(&1-a) % u = u' % x + (v' - a) % w:real^3 ==> (inv (&1-a))%((&1-a) % u ) = (inv (&1-a))%( u' % x + (v' - a) % w)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN `u IN aff {x,w:real^3}` ASSUME_TAC +THENL(*5*)[REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`(inv (&1-a) * u'):real` +THEN EXISTS_TAC`(inv (&1-a) * (v' - a)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1-a') * u' + inv (&1-a') * (v' - a') =inv (&1-a') * ( (u' + v') - a')`;];(*5*) + +POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC `~(u IN aff {x, w:real^3})` +THEN SET_TAC[]](*5*)](*4*)](*3*);(*2*) + +EXISTS_TAC`&1` +THEN REWRITE_TAC[REAL_ARITH`&0< &1`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC`va=(&1-t)%u + t%w:real^3` +THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`t:real`] +THEN MRESA_TAC inequality4_aim_in_convex_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`t:real`] +THEN ASM_REWRITE_TAC[rw_dart_fan;w_dart_fan] +THEN SUBGOAL_THEN`aff_gt {x} {v,va:real^3} SUBSET wedge x v u w1` ASSUME_TAC +THENL(*3*)[ +REWRITE_TAC[SUBSET; IN_ELIM_THM; wedge] +THEN GEN_TAC +THEN MRESAL_TAC aff_gt_inter_aff_gt [`(x:real^3)`;`(v:real^3)`;`(va:real^3)`][INTER;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESAL_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`va:real^3`;`x':real^3`][IN_ELIM_THM] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`; `x':real^3`;`va:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*3*) + +MP_TAC(SET_RULE`aff_gt {x} {v, va:real^3} SUBSET wedge x v u w1 ==> (wedge x v u w1 INTER rcone_fan x v (cos s)) INTER aff_gt {x} {v, va}=(rcone_fan x v (cos s)) INTER aff_gt {x} {v, va}`) +THEN RESA_TAC +THEN REWRITE_TAC[rcone_fan;INTER;IN_ELIM_THM] +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`;IN_ELIM_THM] +THEN DISJ_CASES_TAC(REAL_ARITH`(v - x) dot (va - x:real^3) <= &0 \/ &0< (v - x) dot (va - x)`) +THENL(*4*)[ +ABBREV_TAC`s1= s/ &2:real` +THEN MP_TAC(REAL_ARITH`&0< s /\ s< pi/ &2/\ s1= s/ &2 /\ &0< pi ==> &0<= s1 /\ s1< s /\ s <= pi/\ &0 REWRITE_TAC[SYM(th); REAL_ARITH`&1* &1= &1`]) +THEN RESA_TAC +THEN REDUCE_ARITH_TAC +THEN SUBGOAL_THEN`~(norm((v:real^3)-(x:real^3))= &0)` ASSUME_TAC +THENL(*5*)[ ASM_REWRITE_TAC[NORM_EQ_0;VECTOR_ARITH`v-x=vec 0<=> x=v`];(*5*) + +MP_TAC(ISPEC`norm((v:real^3)-(x:real^3))`REAL_MUL_LINV) +THEN REWRITE_TAC[REAL_ARITH`A*B*D *D=(B*D) *D *A`;REAL_ARITH`A>B<=> B &0< norm (v - x) `) +THEN RESA_TAC +THEN MATCH_MP_TAC COS_MONO_LT +THEN ASM_REWRITE_TAC[];(*6*) + +MRESA_TAC condition1_to_in_aff_gt_by_angle[`x:real^3`;`v:real^3`;`va:real^3`;`s1:real`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[e3_fan]](*6*)](*5*);(*4*) +SUBGOAL_THEN`&0<(atn ((norm ((v - x) cross (va - x))) * inv((v - x) dot (va - x))))` ASSUME_TAC +THENL(*5*)[ +MP_TAC(ISPEC`(v - x) dot (va - x:real^3)`REAL_LT_INV) +THEN RESA_TAC +THEN ASSUME_TAC(PI_WORKS) +THEN MP_TAC(REAL_ARITH`&0< pi ==> --(pi / &2) < &0`) +THEN RESA_TAC +THEN MRESAL_TAC ATN_MONO_LT[`&0:real`;` (norm ((v - x) cross (va - x)) * inv ((v - x) dot (va - x))):real`][ ATN_0] +THEN POP_ASSUM MATCH_MP_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`~(norm((v - x) cross (va - x:real^3))= &0)` ASSUME_TAC +THENL(*6*)[ASM_REWRITE_TAC[NORM_EQ_0] +THEN MP_TAC(ISPECL[`v-x:real^3`;`va-x:real^3`]CROSS_EQ_0) +THEN ONCE_REWRITE_TAC[GSYM COLLINEAR_3;] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`(v - x) cross (va - x:real^3)`NORM_POS_LE) +THEN REAL_ARITH_TAC];(*5*) + +ABBREV_TAC`s1= min (s:real) (atn ((norm ((v - x) cross (va - x))) * inv((v - x) dot (va - x)))) / &2` +THEN ASSUME_TAC(ISPEC`(norm ((v - x) cross (u - x)) * inv ((v - x) dot (u - x))):real`ATN_BOUNDS) +THEN MP_TAC(REAL_ARITH`&0< s /\ s< pi/ &2/\ s1= min (s:real) (atn ((norm ((v - x) cross (va - x))) * inv((v - x) dot (va - x)))) / &2 + /\ &0< pi /\ &0< (atn ((norm ((v - x) cross (va - x))) * inv((v - x) dot (va - x)))) +/\ (atn ((norm ((v - x) cross (va - x))) * inv((v - x) dot (va - x)))) < pi/ &2 +==> &0<= s1 /\ s1< s /\ s <= pi/\ &0 REWRITE_TAC[SYM(th); REAL_ARITH`&1* &1= &1`]) +THEN RESA_TAC +THEN REDUCE_ARITH_TAC +THEN SUBGOAL_THEN`~(norm((v:real^3)-(x:real^3))= &0)` ASSUME_TAC +THENL(*6*)[ASM_REWRITE_TAC[NORM_EQ_0;VECTOR_ARITH`v-x=vec 0<=> x=v`];(*6*) +MP_TAC(ISPEC`norm((v:real^3)-(x:real^3))`REAL_MUL_LINV) +THEN REWRITE_TAC[REAL_ARITH`A*B*D *D=(B*D) *D *A`;REAL_ARITH`A>B<=> B &0< norm (v - x) `) +THEN RESA_TAC +THEN MATCH_MP_TAC COS_MONO_LT +THEN ASM_REWRITE_TAC[]; +MRESA_TAC condition_to_in_aff_gt_by_angle[`x:real^3`;`v:real^3`;`va:real^3`;`s1:real`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[e3_fan]]]]]]]]);; + + +let scale_in_edges_fan=prove(`!(x:real^3) (v:real^3) (u:real^3) (w:real^3). +DISJOINT {x} {v,u} +/\ w IN aff_gt {x} {v,u} +==> +(?a t:real. &0 w-x = ((t1+t2+t3)- &1) % x + (((t1+t2+t3) -t1)- t3)% (v-x) + t3 % (u-x):real^3`] +THEN ASM_REWRITE_TAC[REAL_ARITH`&1- &1= &0`] THEN REDUCE_VECTOR_TAC +THEN MP_TAC(REAL_ARITH`&0< t2 /\ &0< t3 /\ t1+t2+t3= &1 ==> ~(&1-t1= &0)/\ &0< &1- t1`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV `(&1-t1:real)` +THEN MRESA1_TAC REAL_LT_INV `(&1-t1:real)` +THEN MRESA_TAC REAL_LT_MUL [`inv(&1-t1:real)`;`t3:real`] +THEN MRESA_TAC REAL_LT_MUL [`inv(&1-t1:real)`;`t2:real`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[REAL_ARITH`inv (&1 - t1) * t2=inv (&1 - t1) * ((t1+t2+t3)-t1)- inv(&1-t1)*t3:real`] +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +w - x = (&1 - t1 - t3) % (v - x) + t3 % (u - x):real^3 +==> (inv (&1- t1))%(w - x ) = (inv (&1-t1))%((&1 - t1 - t3) % (v - x) + t3 % (u - x)) +`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`;REAL_ARITH`inv (&1 - t1) * (&1 - t1 - t3)=inv (&1 - t1) * (&1 - t1) - inv (&1 - t1) * (t3)`;VECTOR_ARITH`(&1-A)%(U-X)+A%(V-X)=(&1-A)%U+A%V-X`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`inv(&1- t1:real)` +THEN EXISTS_TAC`inv(&1-t1) *t3:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`A< &1<=> &0< &1- A`]);; + + + +let aff_gt_imp_not_collinear=prove(`!x u v w:real^3. +~collinear{x,v,u}/\ w IN aff_gt{x,v} {u}==> ~collinear{x,v,w}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(u:real^3) `;] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN ASM_REWRITE_TAC[collinear_fan;aff;AFFINE_HULL_2;IN_ELIM_THM;] +THEN DISCH_THEN(LABEL_TAC"A") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % u = u' % x + v' % v<=> +t3 % u = (u'-t1) % x + (v'-t2) % v`] +THEN MP_TAC(REAL_ARITH`&0 ~(t3= &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t3:real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`t3 % u = (u' - t1) % x + (v' - t2) % v:real^3 + ==> (inv (t3))%(t3 % u ) = (inv (t3))%( (u' - t1) % x + (v' - t2) % v)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`; VECTOR_ARITH`A%(B+C)=A%B+A%C`] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`(inv (t3)) * (u' - t1):real` +THEN EXISTS_TAC`(inv (t3)) * (v' -t2):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (t3) * (u' - t1) + inv (t3) * (v'- t2) += inv (t3) * (t3+ (u'+v')- (t1 + t2 +t3)):real`; REAL_ARITH`A+ &1- &1= A`]);; + + +let conditions_in_rcone_fan=prove(`!x v u w:real^3 s:real. +~collinear {x,v,u}/\ w IN aff_gt {x} {v,u} /\ &0 w IN rcone_fan x v (cos s) `, + +REWRITE_TAC[rcone_fan;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_TAC +THEN DISCH_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(u:real^3)`;] +THEN MRESAL_TAC AFF_GT_1_2[`(x:real^3)` ;` (v:real^3)`;` (u:real^3) `;][IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[dist;VECTOR_ARITH`(t1 % x + t2 % v + t3 % u) - x=((t1+t2+t3)- &1) % x + t2 % (v-x) + t3 % (u-x)`;REAL_ARITH`&1 - &1= &0`;REAL_ARITH`A>B<=> B &0<= t3`) THEN RESA_TAC +THEN MRESA1_TAC REAL_ABS_REFL`t3:real` +THEN MRESA_TAC NORM_MUL[`t3:real`;`u-x:real^3`] +THEN MP_TAC(REAL_ARITH`&0< t2==> &0<= t2`) THEN RESA_TAC +THEN MRESA1_TAC REAL_ABS_REFL`t2:real` +THEN MRESA_TAC NORM_MUL[`t2:real`;`v-x:real^3`] +THEN MRESA_TAC REAL_LT_LMUL[`t3:real`;`norm (u - x) * norm (v - x:real^3) * (cos s):real`;`(u - x) dot (v - x:real^3)`] +THEN MRESA1_TAC COS_BOUNDS`s:real` +THEN MRESA1_TAC DOT_POS_LE`(v - x):real^3` +THEN MRESA_TAC REAL_LE_MUL[`t2:real`;`(v-x) dot (v-x:real^3)`;] +THEN MRESA_TAC REAL_LE_LMUL[`t2*((v - x:real^3) dot (v-x)):real`;`cos s:real`;`&1`] +THEN POP_ASSUM MP_TAC THEN REDUCE_ARITH_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[DOT_SQUARE_NORM;] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH` t3 * norm (u - x) * norm (v - x) * cos s< t3 * ((u - x) dot (v - x)) +/\(t2 * norm (v - x) pow 2) * cos s <= t2 * ((v - x) dot (v - x)) +==> (t2 * norm (v - x:real^3) + t3 * norm (u - x)) * norm (v - x) * cos s< t2 * ((v - x) dot (v - x))+ t3 * ((u - x) dot (v - x))`) +THEN RESA_TAC +THEN MRESA_TAC NORM_TRIANGLE[`t2 %(v - x:real^3)`;`t3 % (u - x:real^3)`] +THEN MRESA1_TAC NORM_POS_LE`(v - x):real^3` +THEN MRESA1_TAC COS_POS_PI2`(s):real` +THEN MP_TAC(REAL_ARITH`&0< cos s:real ==> &0<= cos s`) THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`norm (v-x:real^3)`;`cos s:real`] +THEN MRESA_TAC REAL_LE_RMUL[`norm (t2 % (v - x) + t3 % (u - x):real^3):real`;`t2 * norm (v - x:real^3) + t3 * norm (u - x)`;`norm (v - x:real^3) * cos s`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC);; + + +let exists_point_inside_domain_cone_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 s:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0CARD (set_of_edge v V E) >1) +==> +(?y:real^3. y IN rw_dart_fan x V E ((x:real^3),(u:real^3),(w:real^3),(w2:real^3)) (cos(s)) /\ +azim x v u y< azim x v u w)`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "BE") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "BE" MP_TAC +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `u:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge u V E = {w} \/ ~(set_of_edge u V E = {w:real^3})`) +THENL(*1*)[ +MRESA_TAC CARD_SING[`w:real^3`; `(set_of_edge u V E):real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC;(*1*) + +MRESA_TAC not_empty_rw_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`; `w:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `s:real`) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`;rw_dart_fan;INTER; w_dart_fan;wedge;IN_ELIM_THM;] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x u w y< azim x u w v==> azim x u w y<= azim x u w (v:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`u:real^3`;`w:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN MP_TAC(REAL_ARITH`azim x u w y< azim x u w v/\ &0< azim x u w y/\ azim x u w v < pi /\ azim x u w v = azim x u w y + azim x u y v==> ~(azim x u y (v:real^3)= &0)/\ &0< azim x u y v/\ azim x u y v < pi/\ ~(azim x u y (v:real^3)= pi)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN REPEAT DISCH_TAC +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR[`x:real^3`;`v:real^3`;`y:real^3`;`u:real^3`] +THEN SUBGOAL_THEN`~(azim x v u (y:real^3)= &0)`ASSUME_TAC +THENL(*2*)[ +STRIP_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[];(*2*) + +SUBGOAL_THEN`~(azim x v u (y:real^3)= pi)`ASSUME_TAC +THENL(*3*)[ + +STRIP_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[];(*3*) + +MP_TAC(REAL_ARITH`~(azim x v u y=pi)==>pi< azim x v u y \/ azim x v u (y:real^3) < pi`) +THEN RESA_TAC +THENL(*4*)[ + +MRESA_TAC AZIM_COMPL[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN MRESA_TAC azim[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN MP_TAC(REAL_ARITH`pi< azim x v u y /\ azim x v u y < &2 * pi /\ azim x v y u = &2 * pi - azim x v u y +==> azim x v y u< pi/\ &0 REWRITE_TAC[SYM(th)]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`u:real^3`;`v:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;CROSS_TRIPLE;] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[DOT_LNEG] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*4*) + +DISJ_CASES_TAC(REAL_ARITH`azim x v u w <= azim x v u (y:real^3) \/ azim x v u y < azim x v u w`) +THENL(*5*)[ +ABBREV_TAC`a1=(v-x):real^3` +THEN ABBREV_TAC`a2=(y-x):real^3` +THEN ABBREV_TAC`a3=(u-x) :real^3` +THEN ABBREV_TAC`a4=w-x:real^3` +THEN ABBREV_TAC`va=a1 cross a4:real^3` +THEN ABBREV_TAC`vb=a2 cross a3:real^3` +THEN ABBREV_TAC`v3= (vb:real^3) cross (va:real^3)+(x:real^3)` +THEN ABBREV_TAC`v4= &1/ &2 % v3+ &1/ &2 % u:real^3` +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;CROSS_TRIPLE;] +THEN ONCE_REWRITE_TAC[CROSS_SKEW; ] +THEN ASM_REWRITE_TAC[DOT_LNEG] +THEN STRIP_TAC +THEN SUBGOAL_THEN `v3 IN aff_gt {x,u} {y:real^3}` ASSUME_TAC +THENL(*6*)[ +MRESA_TAC th3[`(x:real^3)` ;` (u:real^3)`;`(y:real^3) `;] +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`u:real^3`;`y:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&1-(va:real^3) dot (a2:real^3)+va dot (a3:real^3)` +THEN EXISTS_TAC`((va:real^3) dot (a2:real^3))` +THEN EXISTS_TAC`(--((va:real^3) dot (a3:real^3)))` +THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 - va dot a3 + va dot a2) + (va dot a3) + --(va dot a2) = &1`;VECTOR_ARITH`(&1-A+B)%X+ (A)%U+ (--B) %V=A%(U-X)- B%(V-X)+X`] +THEN EXPAND_TAC"v3" +THEN EXPAND_TAC"vb" +THEN ONCE_REWRITE_TAC[CROSS_SKEW; ] +THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_ARITH`--(A-B)+C=B-A+C:real^3`];(*6*) +SUBGOAL_THEN `(v4:real^3) IN aff_gt {x,u} {y:real^3}` ASSUME_TAC +THENL(*7*)[ +POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;` (u:real^3)`;`(y:real^3) `;] +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`u:real^3`;`y:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`&1/ &2 * t1:real` +THEN EXISTS_TAC`&1/ &2 * t2+ &1/ &2:real` +THEN EXISTS_TAC`&1/ &2*t3:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 / &2 * t1 + (&1 / &2 * t2 + &1 / &2) + &1 / &2 * t3 = &1/ &2*(t1+t2+t3)+ &1/ &2`; REAL_ARITH`&1/ &2 * &1 + &1/ &2= &1`;VECTOR_ARITH`(&1 / &2 * t1) % x + (&1 / &2 * t2 + &1 / &2) % u + (&1 / &2 * t3) % y= &1/ &2 %(t1 % x + t2 % u + t3 % y)+ &1/ &2 % u`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;(*7*) +MRESA_TAC aff_gt_imp_not_collinear[`x:real^3`;`y:real^3`;`u:real^3`; `v4:real^3`] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`w:real^3`; `v4:real^3`;`y:real^3`] +THEN EXISTS_TAC`v4:real^3` +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN `v3 IN aff_gt {x,v} {w:real^3}` ASSUME_TAC +THENL(*8*)[ + +MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(w:real^3) `;] +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&1-(vb:real^3) dot (a4:real^3)+vb dot (a1:real^3)` +THEN EXISTS_TAC`((vb:real^3) dot (a4:real^3))` +THEN EXISTS_TAC`(--((vb:real^3) dot (a1:real^3)))` +THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 - vb dot a4 + vb dot a1) + (vb dot a4) + --(vb dot a1) = &1`;VECTOR_ARITH`(&1-A+B)%X+ (A)%U+ (--B) %V=A%(U-X)- B%(V-X)+X`] +THEN EXPAND_TAC"v3" +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_ARITH`--(A-B)+C=B-A+C:real^3`] +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`;`y:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;CROSS_TRIPLE;] +THEN ONCE_REWRITE_TAC[CROSS_SKEW; ] +THEN ASM_REWRITE_TAC[DOT_LNEG] +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESA_TAC azim[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN FIND_ASSUM(MP_TAC)`~(azim x v u (y:real^3)= &0)` +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*8*) + +REMOVE_THEN "YEU EM"(fun th-> ASM_REWRITE_TAC[SYM(th)]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_imp_not_collinear[`x:real^3`;`w:real^3`;`v:real^3`; `v3:real^3`] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`; `v3:real^3`;`w:real^3`] +THEN SUBGOAL_THEN`~(coplanar{x,v,u,v3:real^3})`ASSUME_TAC +THENL(*9*)[ +STRIP_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`v3:real^3`] +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`];(*9*) + +SUBGOAL_THEN`~(azim x u v3 (v:real^3)= &0)`ASSUME_TAC +THENL(*10*)[ +POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR[`x:real^3`;`u:real^3`;`v3:real^3`;`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN ASM_REWRITE_TAC[];(*10*) +MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`v3:real^3`] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`v:real^3`; `v3:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;] +THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;] +THEN RESA_TAC +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`v3:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&2 * pi - azim x u y v = &2 * pi - azim x u v3 v==> azim x u v3 v= azim x u y v `) +THEN RESA_TAC +THEN MRESAL_TAC inequality4_aim_in_convex_fan[`x:real^3`;`v:real^3`;`u:real^3`;`v3:real^3`;`&1/ &2`][REAL_ARITH`&1- &1/ &2= &1/ &2/\ &0< &1/ &2 /\ &1/ &2< &1`;VECTOR_ARITH`A+B=B+A:real^3`] +THEN MATCH_MP_TAC conditions_in_rcone_fan +THEN EXISTS_TAC `y:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC th3[`(x:real^3)` ;` (u:real^3)`;`(y:real^3) `;] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`u:real^3`;`y:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&1/ &2 *(&1-(va:real^3) dot (a2:real^3)+va dot (a3:real^3))` +THEN EXISTS_TAC`&1/ &2 *((va:real^3) dot (a2:real^3))+ &1/ &2` +THEN EXISTS_TAC`&1/ &2 *(--((va:real^3) dot (a3:real^3)))` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 / &2 * t1 + (&1 / &2 * t2 + &1 / &2) + &1 / &2 * t3 = &1/ &2*(t1+t2+t3)+ &1/ &2`; REAL_ARITH`&1/ &2 * &1 + &1/ &2= &1`;VECTOR_ARITH`(&1 / &2 * t1) % x + (&1 / &2 * t2 + &1 / &2) % u + (&1 / &2 * t3) % y= &1/ &2 %(t1 % x + t2 % u + t3 % y)+ &1/ &2 % u`;REAL_ARITH`(&1 - va dot a3 + va dot a2) + (va dot a3) + --(va dot a2) = &1`;VECTOR_ARITH`(&1-A+B)%X+ (A)%U+ (--B) %V=A%(U-X)- B%(V-X)+X`] +THEN EXPAND_TAC"v4" +THEN EXPAND_TAC"v3" +THEN EXPAND_TAC"vb" +THEN ONCE_REWRITE_TAC[CROSS_SKEW; ] +THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_ARITH`--(A-B)+C=B-A+C:real^3`] +THEN MP_TAC(REAL_ARITH`&0< --(va dot (a3:real^3))==> &0 < &1 / &2 * --(va dot a3)`) +THEN RESA_TAC +THEN MATCH_MP_TAC(REAL_ARITH`&0<= (va dot (a2:real^3))==> &0 < &1 / &2 * (va dot a2)+ &1/ &2`) +THEN MRESA_TAC cross_dot_fully_surrounded_ge_fan[`x:real^3`;`v:real^3`;`y:real^3`;`w:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`y:real^3`] +THEN REWRITE_TAC[azim] +THEN MATCH_MP_TAC(REAL_ARITH`azim x v u y = azim x v u w + azim x v w y/\ &0<= azim x v u w /\ azim x v u y < pi ==>azim x v w y <= pi`) +THEN ASM_REWRITE_TAC[azim]](*10*)](*9*)](*8*)](*7*)](*6*);(*5*) +EXISTS_TAC`y:real^3` +THEN REMOVE_THEN "YEU EM" (fun th-> REWRITE_TAC[SYM(th)]) +THEN ASM_REWRITE_TAC[]]]]]]);; +let cut_in_angle_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 y:real^3. + ~coplanar {x,v,u,w} /\ ~collinear {x,u,y} +/\ &0< azim x u w v /\ azim x u w v< pi +/\ azim x u w y< azim x u w v /\ &0< azim x u w y +==> let a1=(v-x):real^3 in + let a2=w-x:real^3 in + let a3=(y-x):real^3 in + let a4=(u-x) :real^3 in + let va=a1 cross a2:real^3 in + let vb=a3 cross a4:real^3 in + let v3= (vb:real^3) cross (va:real^3)+(x:real^3) +in v3 IN aff_gt {x} {v,w:real^3}`, + +REPEAT STRIP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ABBREV_TAC`a1=(v-x):real^3` +THEN ABBREV_TAC`a2=(y-x):real^3` +THEN ABBREV_TAC`a3=(u-x) :real^3` +THEN ABBREV_TAC`a4=w-x:real^3` +THEN ABBREV_TAC`va=a1 cross a4:real^3` +THEN ABBREV_TAC`vb=a2 cross a3:real^3` +THEN ABBREV_TAC`v3= (vb:real^3) cross (va:real^3)+(x:real^3)` +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(w:real^3) `;] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&1-(vb:real^3) dot (a4:real^3)+vb dot (a1:real^3)` +THEN EXISTS_TAC`((vb:real^3) dot (a4:real^3))` +THEN EXISTS_TAC`(--((vb:real^3) dot (a1:real^3)))` +THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 - vb dot a4 + vb dot a1) + (vb dot a4) + --(vb dot a1) = &1`;VECTOR_ARITH`(&1-A+B)%X+ (A)%U+ (--B) %V=A%(U-X)- B%(V-X)+X`] +THEN EXPAND_TAC"v3" +THEN EXPAND_TAC"va" +THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_ARITH`--(A-B)+C=B-A+C:real^3`] +THEN MP_TAC(REAL_ARITH`azim x u w v< pi +/\ azim x u w y< azim x u w v==>azim x u w (y:real^3)< pi`) +THEN RESA_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`u:real^3`;`y:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW; ] +THEN ASM_REWRITE_TAC[DOT_LNEG] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE;] THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN ASM_REWRITE_TAC[DOT_LNEG;REAL_ARITH`--(--A)=A`] +THEN DISCH_TAC +THEN MP_TAC(REAL_ARITH`azim x u w y< azim x u w v==> azim x u w y<= azim x u w (v:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`u:real^3`;`w:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim x u w y< azim x u w v/\ &0< azim x u w y/\ azim x u w v < pi /\ azim x u w v = azim x u w y + azim x u y v==> ~(azim x u y (v:real^3)= &0)/\ &0< azim x u y v/\ azim x u y v < pi/\ ~(azim x u y (v:real^3)= pi)`) +THEN RESA_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`u:real^3`;`v:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[CROSS_SKEW; ] +THEN ASM_REWRITE_TAC[DOT_LNEG] );; + +let aff_gt_1_2_scale_fan=prove(`!x:real^3 v:real^3 u:real^3 w:real^3 a:real. +&0< a /\ a % (u-x)= w-x /\ ~collinear {x,w,v} +==> aff_gt {x} {u,v} =aff_gt {x} {w,v}`, +REPEAT GEN_TAC +THEN GEOM_ORIGIN_TAC `x:real^3` +THEN REDUCE_VECTOR_TAC +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(a= &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV `a:real` +THEN MRESA1_TAC REAL_LT_INV`a:real` +THEN FIND_ASSUM(MP_TAC)`a %u=w:real^3` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` +a%u=w:real^3 +==> (inv (a))%(a%u) = (inv (a))%(w)`) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C:real^3`] +THEN REWRITE_TAC[VECTOR_ARITH`&1 % u= inv a % w<=> inv a % w= u`] +THEN STRIP_TAC +THEN MRESA_TAC COLLINEAR_SPECIAL_SCALE[`a:real`;`u:real^3`;`v:real^3`] +THEN MRESA_TAC th3[`((vec 0):real^3)` ;` (u:real^3)`;`(v:real^3) `;] +THEN MRESA_TAC th3[`((vec 0):real^3)` ;` (w:real^3)`;`(v:real^3) `;] +THEN MRESAL_TAC AFF_GT_1_2[`(vec 0):real^3`;`u:real^3`;`v:real^3`][IN_ELIM_THM;EXTENSION] +THEN MRESAL_TAC AFF_GT_1_2[`(vec 0):real^3`;`w:real^3`;`v:real^3`][IN_ELIM_THM] +THEN REDUCE_VECTOR_TAC +THEN GEN_TAC THEN EQ_TAC +THENL[ STRIP_TAC +THEN EXISTS_TAC`&1- inv a * t2-t3:real` +THEN EXISTS_TAC `inv a * t2:real` +THEN EXISTS_TAC `t3:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - inv a * t2 - t3 + inv a * t2 + t3 = &1`;VECTOR_ARITH`(A*B)%C=B%(A%C)`] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THEN EXISTS_TAC`&1- a * t2-t3:real` +THEN EXISTS_TAC `a * t2:real` +THEN EXISTS_TAC `t3:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - a * t2 - t3 + a * t2 + t3 = &1`;VECTOR_ARITH`(A*B)%C=B%(A%C)`] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]]);; + + + +let exists_cut_rcone_fan_with_edge_run_fan=prove( +`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 s:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0CARD (set_of_edge v V E) >1) +==> +(?t:real. &0< t /\ t< &1 /\ +~(rw_dart_fan x V E ((x:real^3),(u:real^3),(w:real^3),(sigma_fan x V E u w:real^3)) (cos(s)) INTER aff_gt {x} {v, (&1-t)%u+t%w}={}))`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "BE") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "BE" MP_TAC +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `u:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge u V E = {w} \/ ~(set_of_edge u V E = {w:real^3})`) +THENL[ +MRESA_TAC CARD_SING[`w:real^3`; `(set_of_edge u V E):real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; +MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN ASM_REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`;rw_dart_fan;INTER; w_dart_fan;wedge;IN_ELIM_THM;] +THEN MRESA_TAC inequality3_aim_in_convex_fan +[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;` w:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"NHO EM") +THEN MRESA_TAC exists_point_inside_domain_cone_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;`s:real`] +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[rw_dart_fan;INTER; w_dart_fan;wedge;IN_ELIM_THM;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x u w y< azim x u w v==> azim x u w y<= azim x u w (v:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`u:real^3`;`w:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"YEU EM") +THEN MP_TAC(REAL_ARITH`azim x u w y< azim x u w v/\ &0< azim x u w y/\ azim x u w v < pi /\ azim x u w v = azim x u w y + azim x u y v==> ~(azim x u y (v:real^3)= &0)/\ &0< azim x u y v/\ azim x u y v < pi/\ ~(azim x u y (v:real^3)= pi)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN REPEAT DISCH_TAC +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR[`x:real^3`;`v:real^3`;`y:real^3`;`u:real^3`] +THEN SUBGOAL_THEN`~(azim x v u (y:real^3)= &0)`ASSUME_TAC +THENL[STRIP_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[]; +MP_TAC(REAL_ARITH`&0<= azim x v u (y:real^3) /\ ~(azim x v u y= &0)==> &0< azim x v u y`) +THEN ASM_REWRITE_TAC[azim] THEN STRIP_TAC +THEN MRESA_TAC angle_is_smallpi_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN ABBREV_TAC`a1=(v-x):real^3` +THEN ABBREV_TAC`a2=(y-x):real^3` +THEN ABBREV_TAC`a3=(u-x) :real^3` +THEN ABBREV_TAC`a4=w-x:real^3` +THEN ABBREV_TAC`va=a2 cross a1:real^3` +THEN ABBREV_TAC`vb=a4 cross a3:real^3` +THEN ABBREV_TAC`v3=(va:real^3) cross (vb:real^3)+(x:real^3)` +THEN MRESA_TAC cut_in_angle_fan[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN DISCH_TAC +THEN MRESA_TAC scale_in_edges_fan[`(x:real^3)`;`(u:real^3)`;`(w:real^3)`;`(v3:real^3)`] +THEN EXISTS_TAC`t:real` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`y:real^3` +THEN REMOVE_THEN "YEU EM" (fun th-> REWRITE_TAC[SYM(th)]) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0 ~(t= &0)`) THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(a= &0)`) THEN RESA_TAC +THEN MRESA_TAC continuous_coplanar_fan [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `t:real`) +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`(&1 - t) % u + t % w:real^3`] +THEN MRESAL_TAC aff_gt_1_2_scale_fan[`x:real^3`;`v:real^3`;`v3:real^3`;`(&1 - t) % u + t % w:real^3`;`a:real`][VECTOR_ARITH`(&1 - t) % u + t % w - x = ((&1 - t) % u + t % w) - x`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN MRESAL_TAC COLLINEAR_SPECIAL_SCALE[`a:real`;`(v3 - x):real^3`;`v-x:real^3`][VECTOR_ARITH`(&1 - t) % u + t % w - x = ((&1 - t) % u + t % w) - x`] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"a1" +THEN ONCE_REWRITE_TAC[GSYM COLLINEAR_3] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,C,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;` (v3:real^3)`;`(v:real^3) `;] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v3:real^3`;`v:real^3`][IN_ELIM_THM;] +THEN EXPAND_TAC"v3" +THEN EXPAND_TAC"va" +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN REWRITE_TAC[CROSS_LAGRANGE;] +THEN MP_TAC(REAL_ARITH`azim x u w y < azim x u w v /\ azim x u w v< pi==> azim x u w y< pi`) +THEN RESA_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`u:real^3`;`y:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[DOT_LNEG] +THEN STRIP_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[DOT_LNEG] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0< --(vb dot (a1:real^3))==> ~(--(vb dot (a1:real^3))= &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV `(--(vb dot (a1:real^3)):real)` +THEN MRESA1_TAC REAL_LT_INV `(--(vb dot (a1:real^3)):real)` +THEN MRESA_TAC REAL_LT_MUL [`inv(--(vb dot (a1:real^3)):real)`;`--(vb dot (a2:real^3)):real`] +THEN EXISTS_TAC`&1- inv (--(vb dot (a1:real^3)))- inv (--(vb dot a1)) * --(vb dot a2)` +THEN EXISTS_TAC`inv (--(vb dot (a1:real^3)))` +THEN EXISTS_TAC`inv (--(vb dot a1)) * --(vb dot (a2:real^3))` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1- T1 -T2 +T1 +T2 = &1`;VECTOR_ARITH`A%(--(B%X-C%Y)+Z)=(A*(--B))%X-(A*(--C))%Y+A%Z:real^3`] +THEN EXPAND_TAC"a1" +THEN EXPAND_TAC"a2" +THEN VECTOR_ARITH_TAC]]);; + + + + + + +let aff_gt_in_rw_dart_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 y:real^3 s:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0CARD (set_of_edge v V E) >1) +==> aff_gt {x} {u,y} SUBSET rw_dart_fan x V E ((x:real^3),(u:real^3),(w:real^3),(sigma_fan x V E u w:real^3)) (cos(s)) `, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "CON") +THEN DISCH_THEN(LABEL_TAC "BE") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "BE" MP_TAC +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `u:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge u V E = {w} \/ ~(set_of_edge u V E = {w:real^3})`) +THENL[MRESA_TAC CARD_SING[`w:real^3`; `(set_of_edge u V E):real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; +REMOVE_THEN "CON" MP_TAC +THEN ASM_REWRITE_TAC[rw_dart_fan;INTER; SUBSET; w_dart_fan;wedge;IN_ELIM_THM;] +THEN STRIP_TAC THEN GEN_TAC THEN STRIP_TAC +THEN MRESA_TAC aff_gt_inter_aff_gt [`(x:real^3)`;`(u:real^3)`;`(y:real^3)`] +THEN MP_TAC(SET_RULE`aff_gt {x} {u, y} = aff_gt {x, u} {y} INTER aff_gt {x, y} {u} +/\ x' IN aff_gt {x} {u, y:real^3} ==> x' IN aff_gt {x,u} {y}`) THEN RESA_TAC +THEN MRESA_TAC aff_gt_imp_not_collinear[`x:real^3`;`y:real^3`;`u:real^3`; `x':real^3`] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`w:real^3`;`x':real^3`;`y:real^3`;] +THEN MATCH_MP_TAC conditions_in_rcone_fan +THEN EXISTS_TAC`y:real^3` +THEN ASM_REWRITE_TAC[]]);; + +let in_aff_gt_1_2=prove(`!x:real^3 v:real^3 u:real^3 t:real. +DISJOINT {x} {v,u} /\ &0< t /\ t< &1==> (&1-t)% v+ t% u IN aff_gt {x} {v,u}`, +REPEAT STRIP_TAC +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM;] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1 - t:real` +THEN EXISTS_TAC`t:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1 - t<=> t< &1`;REAL_ARITH`&0 + &1 - t + t= &1`] +THEN VECTOR_ARITH_TAC);; + + +let exists_rw_dart_inter_aff_gt1_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 s:real. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ &0CARD (set_of_edge v V E) >1) +==> +(?h:real. &0< h /\ +(!t:real. &0< t /\ t< h==> +~(rw_dart_fan x V E ((x:real^3),(u:real^3),(w:real^3),(sigma_fan x V E u w:real^3)) (cos(s)) INTER aff_gt {x} {v, (&1-t)%u+t%w}={}) +))`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "BE") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "BE" MP_TAC +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `u:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge u V E = {w} \/ ~(set_of_edge u V E = {w:real^3})`) +THENL[ MRESA_TAC CARD_SING[`w:real^3`; `(set_of_edge u V E):real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; +MRESA_TAC exists_cut_rcone_fan_with_edge_run_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;`u:real^3`;`w:real^3`;`s:real`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`;INTER;IN_ELIM_THM;] +THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"OK") THEN DISCH_TAC +THEN USE_THEN "OK" MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[rw_dart_fan;] +THEN ASM_REWRITE_TAC[INTER; w_dart_fan;wedge;IN_ELIM_THM;] +THEN STRIP_TAC +THEN EXISTS_TAC`t:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`vt= (&1 - t':real) % u + t' % w :real^3` +THEN ABBREV_TAC`a1=(v-x):real^3` +THEN ABBREV_TAC`a2=vt-x:real^3` +THEN ABBREV_TAC`a3=(y-x):real^3` +THEN ABBREV_TAC`a4=(u-x) :real^3` +THEN ABBREV_TAC`va=a1 cross a2:real^3` +THEN ABBREV_TAC`vb=a3 cross a4:real^3` +THEN ABBREV_TAC`v3=(vb:real^3) cross (va:real^3)+(x:real^3)` +THEN MP_TAC(REAL_ARITH`&0< t'/\ t'< t /\ t< &1==> ~(t'= &0) /\ t'< &1`) THEN RESA_TAC +THEN MRESA_TAC in_aff_gt_1_2[`x:real^3`;`u:real^3`;`w:real^3 `;`t':real`] +THEN MRESA_TAC aff_gt_inter_aff_gt [`(x:real^3)`;`(u:real^3)`;`(w:real^3)`] +THEN MP_TAC(SET_RULE`aff_gt {x} {u, w} = aff_gt {x, u} {w} INTER aff_gt {x, w} {u} +/\ vt IN aff_gt {x} {u, w:real^3} ==> vt IN aff_gt {x,u} {w}`) THEN RESA_TAC +THEN MRESA_TAC aff_gt_imp_not_collinear[`x:real^3`;`w:real^3`;`u:real^3`; `vt:real^3`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN ASM_REWRITE_TAC[DE_MORGAN_THM] THEN STRIP_TAC +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`v:real^3`;`vt:real^3`;`w:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;] +THEN RESA_TAC +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`v:real^3`;`vt:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN STRIP_TAC +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`y:real^3`;`vt:real^3`;`w:real^3`;] +THEN MP_TAC(REAL_ARITH`&0< azim x u w y /\ azim x u w y< azim x u w v /\ azim x u w v< pi==> +azim x u w y<= azim x u w v/\ ~(azim x u w y = &0 \/ azim x u w y= pi)`) THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`w:real^3`;`y:real^3`] +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`y:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`] +THEN ASM_REWRITE_TAC[DE_MORGAN_THM] THEN STRIP_TAC +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`y:real^3`;`w:real^3`] +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`y:real^3`;`vt:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN STRIP_TAC +THEN MRESA_TAC continuous_coplanar_fan [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `t':real`) +THEN MRESA_TAC cut_in_angle_fan[`x:real^3`;`v:real^3`;`u:real^3`;`vt:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN MRESA_TAC aff_gt_in_rw_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`y:real^3`;`s:real`] +THEN EXISTS_TAC`v3:real^3` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(SET_RULE`aff_gt {x} {u, y} SUBSET rw_dart_fan x V E (x,u,w,v) (cos s) +/\ v3 IN aff_gt {x} {u, y} ==> v3 IN rw_dart_fan x V E (x,u,w,v) (cos s)`) +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC cut_in_angle_fan[`x:real^3`;`y:real^3`;`v:real^3`;`u:real^3`;`vt:real^3`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[CROSS_LNEG;CROSS_RNEG] +THEN ONCE_REWRITE_TAC[GSYM CROSS_RNEG] +THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`u:real^3`;`w:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"NHO EM") +THEN MP_TAC(REAL_ARITH`azim x u w y< azim x u w v/\ &0< azim x u w y/\ azim x u w v < pi /\ azim x u w v = azim x u w y + azim x u y v==> ~(azim x u y (v:real^3)= &0 \/ azim x u y (v:real^3)= pi)`) +THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`u:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`u:real^3`;`v:real^3`;`y:real^3`] +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN ASM_REWRITE_TAC[DE_MORGAN_THM] THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0<=azim x v u y /\ ~(azim x v u y= &0)==> &0< azim x v u y`) +THEN ASM_REWRITE_TAC[azim] THEN RESA_TAC +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`vt:real^3`] +THEN MRESAL_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`vt:real^3`][DE_MORGAN_THM] +THEN MP_TAC(REAL_ARITH`&0<=azim x v u vt /\ ~(azim x v u vt= &0)==> &0< azim x v u vt`) +THEN ASM_REWRITE_TAC[azim] THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(t= &0)`) THEN RESA_TAC +THEN MRESA_TAC continuous_coplanar_fan [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `t:real`) +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`(&1-t) %u+ t%w:real^3`] +THEN MRESA_TAC aff_gt_inter_aff_gt [`(x:real^3)`;`(v:real^3)`;`((&1-t) %u+ t%w:real^3)`] +THEN MP_TAC(SET_RULE`aff_gt {x} {v, (&1-t) %u+ t%w} = aff_gt {x, v} {(&1-t) %u+ t%w} INTER aff_gt {x, (&1-t) %u+ t%w} {v} +/\ y IN aff_gt {x} {v, (&1-t) %u+ t%w:real^3} ==> y IN aff_gt {x,v} {(&1-t) %u+ t%w}`) THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`;`(&1-t) %u+ t%w:real^3`;] +THEN MRESA_TAC inequality4_aim_in_convex_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`t:real`] +THEN MRESA_TAC angle_is_smallpi_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MP_TAC(REAL_ARITH`azim x v u w< pi /\ azim x v u ((&1 - t) % u + t % w) < azim x v u w +==> azim x v u ((&1 - t) % u + t % w) < pi`) THEN RESA_TAC +THEN ABBREV_TAC`vs= (&1 - t:real) % u + t % w :real^3` +THEN MRESA_TAC in_aff_gt_1_2[`x:real^3`;`u:real^3`;`w:real^3 `;`t:real`] +THEN MP_TAC(SET_RULE`aff_gt {x} {u, w} = aff_gt {x, u} {w} INTER aff_gt {x, w} {u} +/\ vs IN aff_gt {x} {u, w:real^3} ==> vs IN aff_gt {x,u} {w}`) THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t:real` +THEN MRESA1_TAC REAL_LT_INV`t:real` +THEN MRESA_TAC REAL_LT_MUL[`inv t:real`;`t':real`] +THEN MRESA_TAC REAL_LT_LMUL[`inv t:real`;`t':real`;`t:real`] + +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`v:real^3`;`vs:real^3`;`w:real^3`;] +THEN REMOVE_THEN"NHO EM" MP_TAC +THEN DISCH_TAC THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`v:real^3`;`vs:real^3`] +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC inequality4_aim_in_convex_fan[`x:real^3`;`v:real^3`;`u:real^3`;`vs:real^3`;`inv (t) * t':real`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM(th)]) +THEN STRIP_TAC +THEN MATCH_MP_TAC(SET_RULE`azim x v u ((&1 - inv t * t') % u + (inv t * t') % vs) < azim x v u vs /\ +(&1 - inv t * t') % u + (inv t * t') % vs = vt ==> azim x v u vt < azim x v u vs`) +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"vs" +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - inv t * t') % u + (inv t * t') % ((&1 - t) % u + t % w) += (&1 - (inv t * t) * t') % u + ((inv t * t) *t') % w`;REAL_ARITH`&1* A=A`]]);; + + + +let there_exists_component_contain_aff_gt_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ fan80(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> + (?h:real. &0< h /\ (?y:real^3. + aff_gt {x} {v, (&1-h)%u+h%w} SUBSET connected_component (yfan(x,V,E)) y ))`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "BE") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "BE" MP_TAC +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `u:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN MRESA_TAC fan_run_in_small_is_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `h/ &2`) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0< h==> ~(h/ &2 = &0)/\ &0< h/ &2 /\ h/ &2 < h`) THEN RESA_TAC +THEN DISCH_TAC +THEN EXISTS_TAC`h/ &2 :real` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`&1/ &2 % v + &1/ &2 %((&1 - h / &2) % u + h / &2 % w:real^3)` +THEN MATCH_MP_TAC CONNECTED_COMPONENT_MAXIMAL +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC CONVEX_AFF_GT[`{x:real^3}`;`{v, (&1 - h / &2) % u + h / &2 % w:real^3}`] +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC continuous_coplanar_fan [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `h/ &2:real`) +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`(&1-h/ &2) %u+ h / &2 %w:real^3`] +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(&1 - h/ &2) % (u:real^3) + h / &2 % (w:real^3)`;] +THEN MRESAL_TAC in_aff_gt_1_2[`x:real^3`;`v:real^3`;`(&1 - h / &2) % u + h / &2 % w:real^3 `;`&1/ &2:real`] +[REAL_ARITH`&1/ &2 < &1 /\ &0< &1/ &2 `; REAL_ARITH`&1 - &1/ &2 = &1/ &2` ] +THEN MATCH_MP_TAC CONVEX_CONNECTED +THEN ASM_REWRITE_TAC[]);; + + + +let CONNECTED_COMPONENT_OF_SUBSET = prove + (`!s t x y. s SUBSET t /\ connected_component s x y + ==> connected_component t x y`, + REWRITE_TAC[connected_component] THEN SET_TAC[]);; + +let connected_component_of_faces_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +==> +dart_leads_into x V E v u = dart_leads_into x V E u w`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "BE") +THEN DISCH_THEN(LABEL_TAC"con") +THEN USE_THEN "con" MP_TAC +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC exists_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"ANH") +THEN MRESA_TAC exists_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;` w:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"YEU") +THEN ABBREV_TAC`h00= min h' (pi/ &2) / &2 :real` +THEN MP_TAC(REAL_ARITH`&0< h' /\ &0< pi /\ h00= min h' (pi/ &2) / &2 :real==> &0< h00 /\ h00 < pi / &2`) +THEN REWRITE_TAC[PI_WORKS] +THEN RESA_TAC +THEN MRESA_TAC exists_rw_dart_inter_aff_gt1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;` w:real^3`;`h00:real`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`] +THEN DISCH_THEN (LABEL_TAC"EM") +THEN MRESA_TAC exists_rw_dart_inter_aff_gt_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`] +THEN DISCH_THEN (LABEL_TAC"NHIEU") +THEN MRESA_TAC fan_run_in_small_is_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"HA") +THEN ABBREV_TAC`h1' = min h'' h''' / &2 :real` +THEN ABBREV_TAC`h1= min h1' h'''' / &2 :real` +THEN MP_TAC(REAL_ARITH`&0< h'' /\ &0 < h''' /\ h1'= min h'' h''' / &2 ==> &0< h1' /\ h1'< h'' /\ h1' < h'''`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0< h1'/\ h1'< h'' /\ h1' < h''' /\ &0 < h'''' /\ h1= min h1' h'''' / &2 ==> &0< h1 /\ h1< h'' /\ h1 < h''' /\ h1< h''''`) +THEN RESA_TAC +THEN ABBREV_TAC`h2= min h (pi/ &2) / &2 :real` +THEN MP_TAC(REAL_ARITH`&0< h /\ &0< pi /\ h2= min h (pi/ &2) / &2 :real==> &0< h2 /\ h2 < pi / &2`) +THEN REWRITE_TAC[PI_WORKS] +THEN RESA_TAC +THEN REMOVE_THEN "NHIEU" (fun th-> MRESAL1_TAC th `h1:real`[INTER;IN_ELIM_THM]) +THEN POP_ASSUM (fun th-> MRESA1_TAC th `h2:real`) +THEN MP_TAC(REAL_ARITH`&0< h2 /\ h2= min h (pi/ &2) / &2 :real==> h2 < h`) +THEN RESA_TAC +THEN USE_THEN "ANH" (fun th -> MP_TAC(ISPECL[`h2:real`;`y:real^3`]th)) +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"LAM") +THEN REMOVE_THEN "EM" (fun th-> MRESAL1_TAC th `h1:real`[INTER;IN_ELIM_THM]) +THEN MP_TAC(REAL_ARITH`&0< h00 /\ h00= min h' (pi/ &2) / &2 :real==> h00 < h'`) +THEN RESA_TAC +THEN USE_THEN "YEU" (fun th -> MP_TAC(ISPECL[`h00:real`;`y':real^3`]th)) +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN RESA_TAC +THEN SUBGOAL_THEN `U=U':real^3->bool` ASSUME_TAC +THENL[ +REMOVE_THEN "LAM" (fun th-> REWRITE_TAC[SYM(th)]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN REWRITE_TAC[CONNECTED_COMPONENT_EQ_EQ] +THEN MRESA_TAC CONVEX_AFF_GT[`{x:real^3}`;`{v, (&1 - h1) % u + h1 % w:real^3}`] +THEN MRESA_TAC CONVEX_CONNECTED[`aff_gt {x} {v, (&1 - h1) % u + h1 % w}:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONNECTED_IFF_CONNECTED_COMPONENT] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`y:real^3`;`y':real^3`]) +THEN REMOVE_THEN "HA" (fun th-> MRESA1_TAC th `h1:real`) +THEN MRESA_TAC CONNECTED_COMPONENT_OF_SUBSET[`aff_gt {x} {v, (&1 - h1) % u + h1 % w:real^3}:real^3-> bool`;`yfan (x:real^3,(V:real^3->bool),(E:(real^3->bool)->bool)):real^3->bool`;`y:real^3`;`y':real^3`] +THEN ASM_TAC THEN SET_TAC[]; +SUBGOAL_THEN`dart_leads_into x V E v u= U:real^3->bool` ASSUME_TAC +THENL[ +REMOVE_ASSUM_TAC +THEN MATCH_MP_TAC unique_dart_leads_into +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`h:real` +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`dart_leads_into x V E u w= U':real^3->bool` ASSUME_TAC +THENL[ MATCH_MP_TAC unique_dart_leads_into +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`h':real` +THEN ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[]]]]);; + + + + +(************************) + + + + + + + +let dart_leads_into1 = new_definition + `dart_leads_into1 (x,V,E) (v,u) = @s. s IN topological_component_yfan (x,V,E) /\ + (?eps. (eps < &1) /\ + rw_dart_fan x V E (x,v,u,sigma_fan x V E v u) eps SUBSET s)`;; + + +let dartset_leads_into = new_definition + `dartset_leads_into (x,V,E) ds = + @s. (!y. (y IN ds) ==> (s = dart_leads_into1 (x,V,E) y))`;; + + + +let exists_dartset_leads_into_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> +?s:real^3->bool. !y. y IN ds==> s= dart_leads_into x V E (pr2 y) (pr3 y)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`dart_leads_into x V E (pr2 x') (pr3 x'):real^3->bool` +THEN ASM_REWRITE_TAC[orbit_map;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(x' IN d1_fan (x,V,E) )\/ (x' IN d1_fan (x:real^3,V,E))`) +THENL[MRESA_TAC id_power_enf_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`x':real^3#real^3#real^3#real^3` ;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]; +SPEC_TAC (`y:real^3#real^3#real^3#real^3`,`y:real^3#real^3#real^3#real^3`) +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC +THENL[ +REWRITE_TAC[POWER_0;I_THM] +THEN SET_TAC[]; + +POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':real^3#real^3#real^3#real^3` ) +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC n:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':real^3#real^3#real^3#real^3` ) +THEN ABBREV_TAC`y1=(f1_fan x V E POWER n) (x':real^3#real^3#real^3#real^3)` +THEN DISCH_THEN(LABEL_TAC "EM") +THEN ASM_REWRITE_TAC[COM_POWER;o_DEF] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`y1:real^3#real^3#real^3#real^3`[ARITH_RULE`(n:num)>= 0`]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`n:num`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x':real^3#real^3#real^3#real^3`) +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`y:real^3#real^3#real^3#real^3`; `y1:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"EM") THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`u=pr2 (f1_fan x V E y1):real^3` +THEN ABBREV_TAC`w=pr3 (f1_fan x V E y1):real^3` +THEN ABBREV_TAC`v=sigma_fan x V E u w:real^3` +THEN REMOVE_THEN "EM" MP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN MRESA_TAC connected_component_of_faces_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`]]]);; + + + + +let dartset_leads_into_fan = new_definition + `dartset_leads_into_fan x V E ds = + @s. (!y. (y IN ds) ==> (s = dart_leads_into x V E (pr2 y) (pr3 y)))`;; + + + +let DARTSET_LEADS_INTO_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> +(!y. y IN ds==> dartset_leads_into_fan x V E ds= dart_leads_into x V E (pr2 y) (pr3 y))`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[dartset_leads_into_fan] +THEN MRESA_TAC exists_dartset_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`] +THEN SELECT_ELIM_TAC +THEN EXISTS_TAC`s:real^3->bool` + THEN ASM_REWRITE_TAC[]);; + + + + + + + + +let UNIQUE_DARTSET_LEADS_INTO_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds s. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ (!y. y IN ds==> s= dart_leads_into x V E (pr2 y) (pr3 y)) +==> dartset_leads_into_fan x V E ds= s`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC FACE_FAN_NOT_EMPTY[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`] +THEN STRIP_TAC +THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`) +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`));; + + + + +let equality_dart_leads_into=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y y1. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ y IN ds /\ y1 IN ds + +==>dart_leads_into x V E (pr2 y) (pr3 y)= dart_leads_into x V E (pr2 y1) (pr3 y1)`, +REPEAT STRIP_TAC +THEN MRESA_TAC exists_dartset_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3` THEN ASSUME_TAC(th)) +THEN POP_ASSUM (fun th-> MRESA1_TAC th `y1:real^3#real^3#real^3#real^3`));; + + +let UNIQUE_DARTSET_LEADS_INTO1_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds s y. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ y IN ds /\ s= dart_leads_into x V E (pr2 y) (pr3 y) +==> dartset_leads_into_fan x V E ds= s`, +REPEAT STRIP_TAC +THEN SUBGOAL_THEN`(!y. y IN ds==> s= dart_leads_into (x:real^3) V E (pr2 y) (pr3 y))` ASSUME_TAC +THENL[REPEAT STRIP_TAC +THEN MRESA_TAC equality_dart_leads_into[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`;`y':real^3#real^3#real^3#real^3`]; +MRESA_TAC UNIQUE_DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`s:real^3->bool`]]);; + + +let exists_point_dart_leads_into_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> ?y. y IN ds /\ dartset_leads_into_fan x V E ds =dart_leads_into x V E (pr2 y) (pr3 y)`, + +REPEAT STRIP_TAC +THEN MRESA_TAC FACE_FAN_NOT_EMPTY[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`] +THEN STRIP_TAC +THEN EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC UNIQUE_DARTSET_LEADS_INTO1_FAN [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;`(dart_leads_into x V E (pr2 y) (pr3 y)):real^3->bool`;`y:real^3#real^3#real^3#real^3`]);; + + + + + + +let dartset_leads_into_is_topological_component_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> dartset_leads_into_fan x V E ds IN topological_component_yfan (x,V,E)`, +REPEAT STRIP_TAC +THEN MRESA_TAC exists_point_dart_leads_into_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`ds:real^3#real^3#real^3#real^3->bool`;] +THEN MRESA_TAC properties_of_elements_in_face_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC dart_leads_into_fan_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`pr2(y):real^3`; `pr3(y):real^3`]);; + + +let dartset_leads_into_subset_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds:real^3#real^3#real^3#real^3->bool. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> +dartset_leads_into_fan x V E ds SUBSET yfan (x,V,E)`, +REPEAT STRIP_TAC +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[CONNECTED_COMPONENT_SUBSET]);; + + + + +let RWXUYZZ=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds:real^3#real^3#real^3#real^3->bool. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> +(?s:real^3->bool. !y. y IN ds==> s= dart_leads_into x V E (pr2 y) (pr3 y)) +/\ dartset_leads_into_fan x V E ds IN topological_component_yfan (x,V,E)`, +MESON_TAC[dartset_leads_into_is_topological_component_yfan;exists_dartset_leads_into_fan]);; + + + +(************DWWUTKW*********) +let add_edge_graph_fan=prove(`!(V:A->bool) (E:(A->bool)->bool) v:A u:A. + v IN V /\ u IN V /\ E1=E UNION {{v,u}} /\ UNIONS E SUBSET V==> UNIONS E1 SUBSET V`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[UNIONS; SUBSET; UNION; IN_ELIM_THM;IN_SING] +THEN DISCH_THEN(LABEL_TAC "YEU") +THEN REPEAT STRIP_TAC +THENL[SUBGOAL_THEN`(?u. u IN E /\ x IN (u:A->bool))`ASSUME_TAC +THENL[ +EXISTS_TAC`u':A->bool` THEN ASM_REWRITE_TAC[]; +REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th `x:A`)]; +ASM_TAC THEN SET_TAC[]]);; + + +let garph_add_edge_is_garph=prove(`!(V:A->bool) (E:(A->bool)->bool) v:A u:A. + E1=E UNION {{v,u}} /\ ~(v=u) /\ graph E==> graph E1`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[GRAPH; UNION;IN_ELIM_THM;IN_SING] +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN GEN_TAC THEN STRIP_TAC +THENL[REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th `e:A->bool`); +ASM_REWRITE_TAC[HAS_SIZE] THEN STRIP_TAC +THEN MRESA_TAC CARD_2_FAN[`v:A`;`u:A`] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY]]);; + +let add_edge_into_collinear_fan=prove(`!x:real^3 (E:(real^3->bool)->bool) v:real^3 u:real^3. +~collinear {x,v,u} /\ +(!e. e IN E ==> ~collinear ({x} UNION e)) +==> +(!e. e IN E UNION {{v, u}} ==> ~collinear ({x} UNION e))`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV)[UNION;] +THEN REWRITE_TAC[IN_ELIM_THM;IN_SING] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC"YEU") +THEN STRIP_TAC +THENL[REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th `e:real^3->bool`); +ASM_REWRITE_TAC[SET_RULE`{X} UNION {A,B}={X,A,B}`]]);; + + +let condition_not_edge_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 ds. +FAN(x,V,E) /\ v IN V /\ u IN V /\ ~collinear {x,v,u} +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ e1 IN E /\ e2 = {v, u} +/\ aff_gt {x} {v,u} SUBSET dartset_leads_into_fan x V E ds +==> ~(e1=e2)`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN STRIP_TAC +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;` (u:real^3)`] +THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`dartset_leads_into_fan x V E ds SUBSET yfan (x,V,E)/\ aff_gt {x} {v, u} SUBSET dartset_leads_into_fan x V E ds==> aff_gt {x} {v, u} SUBSET yfan (x:real^3,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan; SET_RULE`A SUBSET (:real^3) DIFF B <=> A INTER B={}`;] +THEN DISCH_TAC +THEN SUBGOAL_THEN`aff_ge {x} e1 SUBSET xfan(x:real^3,V:real^3->bool,E)` ASSUME_TAC +THENL[REWRITE_TAC[xfan;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC `e1:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC(`(e1:real^3->bool) IN E`) +THEN REWRITE_TAC[IN] +THEN ASM_REWRITE_TAC[]; +ASSUME_TAC(SET_RULE`aff_gt {x} {v, u} INTER + (aff_gt {x} {v, u} UNION aff_ge {x} {v} UNION aff_ge {x} {u}) +=aff_gt {x} {v, u} `) +THEN MP_TAC(SET_RULE`aff_gt {x:real^3} {v, u} INTER xfan (x,V:real^3->bool,E) = {}/\aff_ge {x} e1 SUBSET xfan (x,V,E) +==> aff_gt {x} {v, u} INTER aff_ge {x} e1={}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`] +THEN MATCH_MP_TAC exists_in_aff_gt +THEN ASM_REWRITE_TAC[]]);; + + +let properties_edges_eq_fan=prove(`!e:A-> bool v:A u:A. +FINITE e /\ ~(e={v,u}) /\ ~(v=u) /\ CARD e=2 ==> ~(v IN e)\/ ~(u IN e)`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "YEU") +THEN ONCE_REWRITE_TAC[SET_RULE`~A \/ ~B<=> ~(A/\B)`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`v IN e /\ u IN e ==> {v:A,u} SUBSET e`) +THEN RESA_TAC +THEN MRESA_TAC CARD_2_FAN[`v:A`;`u:A`] +THEN REMOVE_THEN "YEU" MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN STRIP_TAC +THEN MRESA_TAC CARD_SUBSET_EQ[`{v,u:A}`;`e:A->bool`]);; + + +let condition_not_intersection_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 ds e1:real^3->bool e2:real^3->bool. +FAN(x,V,E) /\ v IN V /\ u IN V /\ ~collinear {x,v,u} +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ aff_gt {x} {v,u} SUBSET dartset_leads_into_fan x V E ds +/\ e1 IN E /\ e2 = {v, u} +==>aff_ge {x} e1 INTER aff_ge {x} e2 = aff_ge {x} (e1 INTER e2)`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;` (u:real^3)`] +THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`dartset_leads_into_fan x V E ds SUBSET yfan (x,V,E)/\ aff_gt {x} {v, u} SUBSET dartset_leads_into_fan x V E ds==> aff_gt {x} {v, u} SUBSET yfan (x:real^3,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan; SET_RULE`A SUBSET (:real^3) DIFF B <=> A INTER B={}`;] +THEN DISCH_TAC +THEN SUBGOAL_THEN`aff_ge {x} e1 SUBSET xfan(x:real^3,V:real^3->bool,E)` ASSUME_TAC +THENL[ +REWRITE_TAC[xfan;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC `e1:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN SET_TAC[IN]; +MP_TAC(SET_RULE`aff_gt {x:real^3} {v, u} INTER xfan (x,V:real^3->bool,E) = {}/\aff_ge {x} e1 SUBSET xfan (x,V,E) +==> aff_gt {x} {v, u} INTER aff_ge {x} e1={}`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE` +aff_gt {x:real^3} {v, u} INTER aff_ge {x} e1={}==> +aff_ge {x} e1 INTER (aff_gt {x} {v, u} UNION aff_ge {x} {v} UNION aff_ge {x} {u}) += (aff_ge {x} e1 INTER aff_ge {x} {v}) UNION (aff_ge {x} e1 INTER aff_ge {x} {u})`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`e1 IN E==> e1 IN E UNION {{v:real^3} | v IN V}`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`v:real^3 IN V==> {v} IN E UNION {{v} | v IN V}`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`u:real^3 IN V==> {u} IN E UNION {{v} | v IN V}`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC(`FAN(x:real^3,V,E)`) +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th [`e1:real^3->bool`;`{v:real^3}`]THEN ASSUME_TAC th) +THEN POP_ASSUM(fun th-> MRESA_TAC th [`e1:real^3->bool`;`{u:real^3}`]) +THEN MRESA_TAC condition_not_edge_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN FIND_ASSUM MP_TAC (`graph (E:(real^3->bool)->bool)`) +THEN REWRITE_TAC[GRAPH] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL1_TAC th `e1:real^3->bool`[HAS_SIZE]) +THEN MRESA_TAC th3[`v:real^3`;`u:real^3`;`x:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MRESA_TAC properties_edges_eq_fan[`e1:real^3->bool`; `v:real^3`;`u:real^3`] +THENL[MP_TAC(SET_RULE`~(v IN e1)==> e1 INTER {v:real^3}={} /\ e1 INTER {v, u}=e1 INTER {u}`) +THEN RESA_TAC +THEN ASSUME_TAC(SET_RULE`{} SUBSET e1 INTER {u}:real^3->bool`) +THEN MP_TAC(SET_RULE`DISJOINT {v, u} {x:real^3}==> DISJOINT {x} (e1 INTER {u})`) +THEN RESA_TAC +THEN MRESA_TAC AFF_GE_MONO_RIGHT[`{x:real^3}`;`{}:real^3->bool`;`e1 INTER {u}:real^3->bool`] +THEN POP_ASSUM MP_TAC THEN SET_TAC[]; +MP_TAC(SET_RULE`~(u IN e1)==> e1 INTER {u:real^3}={} /\ e1 INTER {v, u}=e1 INTER {v}`) +THEN RESA_TAC +THEN ASSUME_TAC(SET_RULE`{} SUBSET e1 INTER {v}:real^3->bool`) +THEN MP_TAC(SET_RULE`DISJOINT {v, u} {x:real^3}==> DISJOINT {x} (e1 INTER {v})`) +THEN RESA_TAC +THEN MRESA_TAC AFF_GE_MONO_RIGHT[`{x:real^3}`;`{}:real^3->bool`;`e1 INTER {v}:real^3->bool`] +THEN POP_ASSUM MP_TAC THEN SET_TAC[]]]);; + + +let exists_edge_fully_surround_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) w:real^3. +FAN(x,V,E) /\ w IN V +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> ?v. {w,v} IN E /\ v IN V`, +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`) +THEN SUBGOAL_THEN`~(set_of_edge (w:real^3) V E={})`ASSUME_TAC +THENL[ POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "YEU") THEN STRIP_TAC THEN REMOVE_THEN "YEU" MP_TAC +THEN ASM_REWRITE_TAC[CARD_CLAUSES] THEN ARITH_TAC; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`; set_of_edge;IN_ELIM_THM]]);; + + + + +let condition_not_intersection_point_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 ds:real^3#real^3#real^3#real^3->bool e1:real^3->bool w:real^3. +FAN(x,V,E) /\ v IN V /\ u IN V /\ ~collinear {x,v,u} +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ aff_gt {x} {v,u} SUBSET dartset_leads_into_fan x V E ds +/\ w IN V /\ e1 = {v, u} +==>aff_ge {x} e1 INTER aff_ge {x} {w} = aff_ge {x} (e1 INTER {w})`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;` (u:real^3)`] +THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`dartset_leads_into_fan x V E ds SUBSET yfan (x,V,E)/\ aff_gt {x} {v, u} SUBSET dartset_leads_into_fan x V E ds==> aff_gt {x} {v, u} SUBSET yfan (x:real^3,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan; SET_RULE`A SUBSET (:real^3) DIFF B <=> A INTER B={}`;] +THEN DISCH_TAC +THEN SUBGOAL_THEN`aff_ge {x} {w} SUBSET xfan(x:real^3,V:real^3->bool,E)` ASSUME_TAC +THENL[ +REWRITE_TAC[xfan;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC exists_edge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` w:real^3`] +THEN EXISTS_TAC `{w,v'}:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v':real^3)`; +` (w:real^3)`] +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(w:real^3)`;` (v':real^3)`] +THEN ASM_TAC THEN SET_TAC[IN]; +MP_TAC(SET_RULE`aff_gt {x:real^3} {v, u} INTER xfan (x,V:real^3->bool,E) = {}/\aff_ge {x} {w} SUBSET xfan (x,V,E) +==> aff_gt {x} {v, u} INTER aff_ge {x} {w}={}`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE` +aff_gt {x:real^3} {v, u} INTER aff_ge {x} {w}={}==> +(aff_gt {x} {v, u} UNION aff_ge {x} {v} UNION aff_ge {x} {u}) INTER aff_ge {x} {w} += (aff_ge {x} {w} INTER aff_ge {x} {v}) UNION (aff_ge {x} {w} INTER aff_ge {x} {u})`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`w IN V==> {w} IN E UNION {{v:real^3} | v IN V}`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`v:real^3 IN V==> {v} IN E UNION {{v} | v IN V}`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`u:real^3 IN V==> {u} IN E UNION {{v} | v IN V}`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC(`FAN(x:real^3,V,E)`) +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th [`{w}:real^3->bool`;`{v:real^3}`]THEN ASSUME_TAC th) +THEN POP_ASSUM(fun th-> MRESA_TAC th [`{w}:real^3->bool`;`{u:real^3}`]) +THEN MRESA_TAC th3[`v:real^3`;`u:real^3`;`x:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(v=u:real^3)==> ({v, u} INTER {w}= {w} INTER {v} /\ {w} INTER {u}={}) \/ ({v, u} INTER {w}= {w} INTER {u} /\ {w} INTER {v}={})`) +THEN RESA_TAC +THENL[ ASSUME_TAC(SET_RULE`{} SUBSET {w} INTER {v}:real^3->bool`) +THEN MP_TAC(SET_RULE`DISJOINT {v, u} {x:real^3}==> DISJOINT {x} ({w} INTER {v})`) +THEN RESA_TAC +THEN MRESA_TAC AFF_GE_MONO_RIGHT[`{x:real^3}`;`{}:real^3->bool`;`{w} INTER {v}:real^3->bool`] +THEN POP_ASSUM MP_TAC THEN SET_TAC[]; +ASSUME_TAC(SET_RULE`{} SUBSET {w} INTER {u}:real^3->bool`) +THEN MP_TAC(SET_RULE`DISJOINT {v, u} {x:real^3}==> DISJOINT {x} ({w} INTER {u})`) +THEN RESA_TAC +THEN MRESA_TAC AFF_GE_MONO_RIGHT[`{x:real^3}`;`{}:real^3->bool`;`{w} INTER {u}:real^3->bool`] +THEN POP_ASSUM MP_TAC THEN SET_TAC[]]]);; + + + +let DWWUTKW=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 ds. +FAN(x,V,E) /\ v IN V /\ u IN V /\ ~collinear {x,v,u} +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ aff_gt {x} {v,u} SUBSET dartset_leads_into_fan x V E ds +/\ E1=E UNION {{v,u}} +==> FAN (x,V,E1)`, +REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC`FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan1;fan2;fan6;fan7] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC th3[`v:real^3`;`u:real^3`;`x:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MRESA_TAC add_edge_graph_fan[`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC garph_add_edge_is_garph[`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC add_edge_into_collinear_fan[`x:real^3`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN REWRITE_TAC[UNION;IN_ELIM_THM;IN_SING] +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THENL[ REMOVE_THEN"YEU" (fun th-> MRESA_TAC th[`e1:real^3->bool`;`e2:real^3->bool`]) +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]; + +MRESA_TAC condition_not_intersection_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `ds:real^3#real^3#real^3#real^3->bool`;`e1:real^3->bool`;`e2:real^3->bool`]; + +REMOVE_THEN"YEU" (fun th-> MRESA_TAC th[`e1:real^3->bool`;`e2:real^3->bool`]) +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]; + +MRESA_TAC condition_not_intersection_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `ds:real^3#real^3#real^3#real^3->bool`;`e2:real^3->bool`;`e1:real^3->bool`] +THEN ASM_REWRITE_TAC[SET_RULE`A INTER B= B INTER A`]; + +ASM_REWRITE_TAC[SET_RULE`A INTER A=A`]; + +MRESA_TAC condition_not_intersection_point_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `ds:real^3#real^3#real^3#real^3->bool`;`e1:real^3->bool`;`v':real^3`]; + +REMOVE_THEN"YEU" (fun th-> MRESA_TAC th[`e2:real^3->bool`;`e1:real^3->bool`]) +THEN ASM_REWRITE_TAC[SET_RULE`A INTER B=B INTER A`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]; + +MRESA_TAC condition_not_intersection_point_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `ds:real^3#real^3#real^3#real^3->bool`;`e2:real^3->bool`;`v':real^3`] +THEN ASM_REWRITE_TAC[SET_RULE`A INTER B=B INTER A`]; + +REMOVE_THEN"YEU" (fun th-> MRESA_TAC th[`e1:real^3->bool`;`e2:real^3->bool`]) +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]]);; + + + + +(**************JUTSTKG*******************) + + +let exists_point_in_component_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool. +U IN topological_component_yfan (x,V,E) +==> ?z. z IN U`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`y:real^3` +THEN ASM_REWRITE_TAC[CONNECTED_COMPONENT_SET;IN_ELIM_THM] +THEN EXISTS_TAC`{y:real^3}` +THEN ASM_REWRITE_TAC[CONNECTED_SING;IN_SING] +THEN ASM_TAC THEN SET_TAC[]);; + + + + +let nonsetedge_fully_surround_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +(!v. v IN V==>CARD (set_of_edge v V E) >1)/\ FAN(x,V,E) +==> ~(E={})`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[] +THEN POP_ASSUM (fun th-> MP_TAC th THEN REWRITE_TAC[FAN;fan1] THEN STRIP_TAC THEN ASSUME_TAC(th)) +THEN FIND_ASSUM MP_TAC(`~((V:real^3->bool) SUBSET {})`) +THEN REWRITE_TAC[SET_RULE`~(V SUBSET {})<=> ?w. w IN V`] +THEN STRIP_TAC +THEN MRESA_TAC exists_edge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`] +THEN ASM_TAC THEN SET_TAC[]);; + + + + + +let exists_point_notx_in_xfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) /\ ~(E={}) +==> ?v. v IN xfan(x,V,E) /\ ~(v=x)`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[] +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`;xfan;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"YEU") +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(y:real^3->bool)`] +THEN REMOVE_THEN "YEU" MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] +THEN MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v:real^3)`;`(w:real^3)`] +THEN EXISTS_TAC `v:real^3` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC `y:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN SET_TAC[]);; + + + +let x_in_xfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) /\ ~(E={}) +==> x IN xfan(x,V,E)`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[] +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`;xfan;IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC `y:real^3->bool` +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"YEU") +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(y:real^3->bool)`] +THEN REMOVE_THEN "YEU" MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] +THEN MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v:real^3)`;`(w:real^3)`] +THEN ASM_TAC THEN SET_TAC[]);; + + + +let xfan_notempty_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) /\ ~(E={}) +==> ~(xfan(x,V,E)={})`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[] +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`] +THEN EXISTS_TAC `x:real^3` +THEN ASM_TAC +THEN SET_TAC[x_in_xfan]);; + + + + + + + + +let xfan_closed_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) +==> closed (xfan(x,V,E))`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[xfan;SET_RULE`{v | ?e. E e /\ v IN aff_ge {x} e}= UNIONS{y | ?x'. x' IN E /\ y = aff_ge {x} x'}`] +THEN MATCH_MP_TAC CLOSED_UNIONS +THEN MRESA_TAC set_edges_is_finite_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESAL_TAC FINITE_IMAGE[`(\e:real^3->bool. aff_ge {x:real^3} e)`;`E:(real^3->bool)->bool`][IMAGE;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") THEN DISCH_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(x':real^3->bool)`] +THEN REMOVE_THEN "YEU"MP_TAC THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] +THEN MRESA_TAC closed_aff_ge_1_2[`x:real^3`;`v:real^3`;`w:real^3`]);; + + +let topological_component_subset_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool. +U IN topological_component_yfan (x,V,E) +==> U SUBSET yfan(x,V,E)`, +REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[CONNECTED_COMPONENT_SUBSET]);; + + + + + + + + + +let aff_gt_connect_bound_not_inter_edges_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 y:real^3 z:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ DISJOINT {x} {y,z} +/\ (!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan (x,V,E)) +==> +aff_gt {x} {y,z} INTER aff_ge {x} {v,u}={}`, + +REWRITE_TAC[SET_RULE`A={}<=> ~(?w. w IN A)`;INTER;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") +THEN REPEAT STRIP_TAC +THEN MRESA_TAC scale_in_edges_fan[`x:real^3`;`y:real^3`;`z:real^3`;`w:real^3`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MP_TAC(REAL_ARITH`&0 &0 <= a`) THEN RESA_TAC +THEN MRESA_TAC scale_aff_ge_fan[`x:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`w:real^3`;`a:real`][VECTOR_ARITH`(A+B-C)+C=A+B:real^3`]) +THEN MRESA_TAC in_aff_gt_1_2[`x:real^3`;`y:real^3`;`z:real^3 `;`t:real`] +THEN REMOVE_THEN "YEU" (fun th-> MRESAL1_TAC th`t:real`[yfan]) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[SET_RULE`~((&1 - t) % y + t % z IN (:real^3) DIFF xfan (x,V,E))<=>(&1 - t) % y + t % z IN xfan (x,V,E)`;xfan;IN_ELIM_THM] +THEN EXISTS_TAC`{v,u}:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN SET_TAC[IN]);; + + + + + + + + +let aff_gt_connect_bound_subset_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) y:real^3 z:real^3. +FAN(x,V,E) /\ DISJOINT {x} {y,z} +/\ (!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan (x,V,E)) +==> aff_gt {x} {y,z} SUBSET yfan (x,V,E)`, + +REPEAT STRIP_TAC +THEN +REWRITE_TAC[yfan;xfan;SET_RULE`aff_gt {x} {y, z} SUBSET + (:real^3) DIFF {v | ?e. E e /\ v IN aff_ge {x} e} +<=> (!e. e IN E ==> aff_gt {x} {y,z} INTER aff_ge {x} e={})`] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN MRESA_TAC aff_gt_connect_bound_not_inter_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` w:real^3`;`y:real^3`;`z:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM(th)] ));; + + +let sym_line1_fan=prove(`!x y z:real^N. x IN aff {y, z} /\ ~(x=y) +==> z IN aff {x,y}`, +REPEAT GEN_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(v= &0)\/ ~(v= &0)`) +THENL[ ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN RESA_TAC +THEN REDUCE_VECTOR_TAC +THEN RESA_TAC +THEN SET_TAC[]; +MP_TAC(ISPEC`(v:real)`REAL_MUL_LINV) +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`inv(v:real)` +THEN EXISTS_TAC`-- inv(v:real) *u` +THEN ASM_REWRITE_TAC[REAL_ARITH` inv v + --inv v * u = inv v * (v+ &1- (u+v)) `;REAL_ARITH`A+ &1 - &1= A`;VECTOR_ARITH`inv v % (u % y + v % z) + (--inv v * u) % y=(inv v * v) % z `] +THEN REDUCE_VECTOR_TAC]);; + + + +let POINT_IN_LINE=prove(`!x y:real^N. x IN aff {x,y}`, +REPEAT GEN_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC);; + +let POINT_IN_LINE1=prove(`!x y:real^N. y IN aff {x,y}`, +REPEAT GEN_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC);; + + +let AFFINE_HULL_AFFINE_EQ =prove(`!s:real^N->bool. affine hull (affine hull s)= affine hull s`, +STRIP_TAC THEN MATCH_MP_TAC AFFINE_HULLS_EQ +THEN ASSUME_TAC(ISPEC `s:real^N->bool` AFFINE_AFFINE_HULL) +THEN MRESA1_TAC AFFINE_HULL_EQ`affine hull s:real^N->bool` +THEN MRESA_TAC HULL_SUBSET[`affine:(real^N->bool)->bool`;` s:real^N->bool`;] +THEN SET_TAC[]);; + +let sym_line0_fan=prove( `!x y z:real^N. x IN aff {y, z} /\ DISJOINT {x} {y,z} +==> aff {x,z} SUBSET aff {x,y}`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`DISJOINT {x} {y,z}==> ~(x=y:real^N)`) +THEN RESA_TAC +THEN MRESA_TAC sym_line1_fan[`x:real^N`;`y:real^N`;`z:real^N`] +THEN MP_TAC(SET_RULE`x IN aff {x, y} /\ z IN aff {x, y} ==> {x, z:real^N} SUBSET aff {x, y}`) +THEN REWRITE_TAC[POINT_IN_LINE;] +THEN RESA_TAC +THEN MRESA_TAC HULL_MONO[`affine:(real^N->bool)->bool`;` {x, z:real^N}`;`aff {x, y:real^N}`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_AFFINE_EQ ]);; + + +let sym_line_fan=prove(`!x y z:real^N. x IN aff {y, z} /\ DISJOINT {x} {y,z} +==> aff {x,z} = aff {x,y}`, +REPEAT STRIP_TAC +THEN MRESA_TAC sym_line0_fan[`x:real^N`;`y:real^N`;`z:real^N`] +THEN MRESA_TAC sym_line0_fan[`x:real^N`;`z:real^N`;`y:real^N`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + +let sym_line01_fan=prove(`!x y z:real^N. x IN aff {y, z} /\ DISJOINT {y} {x,z} +==> aff {y,x} SUBSET aff {y,z}`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`y IN aff {y, z} /\ x IN aff {y, z} ==> {y,x:real^N} SUBSET aff {y,z}`) +THEN ASM_REWRITE_TAC[POINT_IN_LINE;] +THEN STRIP_TAC +THEN MRESA_TAC HULL_MONO[`affine:(real^N->bool)->bool`;` {y,x:real^N}`;`aff { y,z:real^N}`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_AFFINE_EQ ]);; + + +let sym_line02_fan=prove(`!x y z:real^N. x IN aff {y, z} /\ DISJOINT {y} {x,z} +==> aff {y,z} SUBSET aff {y,x}`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`DISJOINT {y} {x,z}==> ~(x=y:real^N)`) +THEN RESA_TAC +THEN MRESA_TAC sym_line1_fan[`x:real^N`;`y:real^N`;`z:real^N`] +THEN MP_TAC(SET_RULE`y IN aff {y, x} /\ z IN aff {y, x} ==> {y,z:real^N} SUBSET aff {y,x}`) +THEN ASM_REWRITE_TAC[POINT_IN_LINE;] +THEN STRIP_TAC +THEN MRESA_TAC HULL_MONO[`affine:(real^N->bool)->bool`;` {y,z:real^N}`;`aff { y,x:real^N}`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[aff;AFFINE_HULL_AFFINE_EQ ] +THEN POP_ASSUM MP_TAC +THEN ASSUME_TAC(SET_RULE`{y,x}={x,y}`) +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[th;]) +THEN REWRITE_TAC[aff] +THEN RESA_TAC);; + + + +let sym_line_fan0=prove(`!x y z:real^N. x IN aff {y, z} /\ DISJOINT {x} {y,z} /\ DISJOINT {y} {x,z} +==> aff {x,z} = aff {y,z}`, +REPEAT STRIP_TAC +THEN MRESA_TAC sym_line_fan[`x:real^N`;`y:real^N`;`z:real^N`] +THEN SUBGOAL_THEN `y IN aff {x,z:real^N}` ASSUME_TAC +THENL[ASM_REWRITE_TAC[POINT_IN_LINE1]; +MRESA_TAC sym_line_fan[`y:real^N`;`x:real^N`;`z:real^N`] +THEN ASSUME_TAC(SET_RULE`{x,y}={y,x:real^N}`) +THEN ASM_REWRITE_TAC[]]);; + + +let sym_line_fan1=prove(`!x y z:real^N. x IN aff {y, z} /\ DISJOINT {y} {x,z} +==> aff {y,z} = aff {y,x}`, +REPEAT STRIP_TAC +THEN MRESA_TAC sym_line01_fan[`x:real^N`;`y:real^N`;`z:real^N`] +THEN MRESA_TAC sym_line02_fan[`x:real^N`;`y:real^N`;`z:real^N`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + +let aff_ge_1_1_subset_aff_fan=prove(`!x y z:real^3. ~(y=z) /\ x IN aff_ge {y} {z} ==> x IN aff {y,z} `, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GE_1_1[`y:real^3`;`z:real^3`][IN_ELIM_THM] +THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN ASM_REWRITE_TAC[]);; + + + +let exists_point_notxin_convex_in_xfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) z:real^3. +FAN(x,V,E) /\ ~(x=z) /\ ~(E={}) +==> ?v. v IN xfan(x,V,E) /\ ~(x IN convex hull{v,z})`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[] +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`;xfan;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"YEU") +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(y:real^3->bool)`] +THEN REMOVE_THEN "YEU" MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`v:real^3`] +THEN MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(v:real^3)`;`(w:real^3)`] +THEN DISJ_CASES_TAC(SET_RULE`~(x IN convex hull{v,z:real^3})\/ (x IN convex hull{v,z})`) +THENL[ +EXISTS_TAC `v:real^3` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC `y:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN SET_TAC[]; +EXISTS_TAC `w:real^3` +THEN STRIP_TAC +THENL[ +EXISTS_TAC `y:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN SET_TAC[]; +MRESA1_TAC CONVEX_HULL_SUBSET_AFFINE_HULL`{v,z:real^3}` +THEN MP_TAC(SET_RULE`x IN convex hull {v, z:real^3}/\ convex hull {v, z} SUBSET affine hull {v, z} +==> x IN affine hull {v, z}`) +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA1_TAC CONVEX_HULL_SUBSET_AFFINE_HULL`{w,z:real^3}` +THEN MP_TAC(SET_RULE`x IN convex hull {w, z:real^3}/\ convex hull {w, z} SUBSET affine hull {w, z} +==> x IN affine hull {w, z}`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(x=z) /\ ~(x=v) /\ ~(x=w)==> DISJOINT {x:real^3} {v,z} /\ DISJOINT{x} {w,z}`) THEN RESA_TAC +THEN MRESAL_TAC sym_line_fan[`x:real^3`;`v:real^3`;`z:real^3`][aff] +THEN MRESAL_TAC sym_line_fan[`x:real^3`;`w:real^3`;`z:real^3`][aff] +THEN MRESA_TAC POINT_IN_LINE1[`x:real^3` ;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[aff] +THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM(th)]) +THEN ASM_REWRITE_TAC[SYM aff]]]);; + + + +let notempty_xfan_inter_segment_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) z:real^3 v:real^3. +FAN(x,V,E) /\ v IN xfan(x,V,E) +==> ~(xfan(x,V,E) INTER segment[v,z] ={})`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`;IN_ELIM_THM;INTER;segment] +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`&0` +THEN REWRITE_TAC[REAL_ARITH`&1- &0= &1 /\ &0<= &0 /\ &0<= &1`] +THEN REDUCE_VECTOR_TAC);; + + + +let xfan_inter_segment_closed_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) z:real^3 v:real^3. +FAN(x,V,E) ==> closed(xfan(x,V,E) INTER segment[v,z])`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC CLOSED_INTER +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CLOSED_SEGMENT;xfan_closed_fan]);; + + + +let point_in_yfan_not_x_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool z:real^3. +FAN(x,V,E) /\ ~(E={}) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +==> ~(x=z)`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC topological_component_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` U:real^3->bool`] +THEN MP_TAC(SET_RULE`U SUBSET yfan (x:real^3,V:real^3->bool,E)/\ z IN U ==> z IN yfan(x,V,E)`) +THEN RESA_TAC +THEN MRESA_TAC x_in_xfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan] +THEN SET_TAC[]);; + + +let zpoint_in_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool z:real^3. +FAN(x,V,E) /\ ~(E={}) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +==> z IN yfan(x,V,E)`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC topological_component_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` U:real^3->bool`] +THEN MP_TAC(SET_RULE`U SUBSET yfan (x:real^3,V:real^3->bool,E)/\ z IN U ==> z IN yfan(x,V,E)`) +THEN RESA_TAC +THEN SET_TAC[]);; + + + + +let segment_in_segment=prove(`!x y z:real^N. z IN segment [x,y]==> (!t. &0<= t /\ t<= &1 ==> (&1-t) %z +t %y IN segment[x,y])`, +REWRITE_TAC[segment;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`(&1- t)* u+t:real` +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - t) % ((&1 - u) % x + u % y) + t % y = + (&1 - ((&1 - t) * u + t)) % x + ((&1 - t) * u + t) % y:real^N`] +THEN STRIP_TAC +THENL[MATCH_MP_TAC REAL_LE_ADD +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &1- t<=> t<= &1`]; + +REWRITE_TAC[REAL_ARITH`(&1 - t) * u + t <= &1<=> &0<= (&1 - t) * (&1-u)`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &1- t<=> t<= &1`]]);; + + +let connect_insidepoint_to_bound_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool z:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +==> ?y. ~(y=x)/\ y IN xfan(x,V,E) /\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan(x,V,E))`, +REPEAT STRIP_TAC +THEN MRESA_TAC nonsetedge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;` z:real^3`] +THEN MRESA_TAC exists_point_notxin_convex_in_xfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` z:real^3`] +THEN EXISTS_TAC`closest_point (xfan (x:real^3,V:real^3->bool,E) INTER segment[v,z]) (z:real^3)` +THEN MRESA_TAC xfan_inter_segment_closed_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` z:real^3`;`v:real^3`] +THEN MRESA_TAC notempty_xfan_inter_segment_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` z:real^3`;`v:real^3`] +THEN MRESA_TAC CLOSEST_POINT_EXISTS[`xfan (x:real^3,V:real^3->bool,E) INTER segment[v,z]`;`(z:real^3)`] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MP_TAC (SET_RULE`closest_point (xfan (x:real^3,V:real^3->bool,E) INTER segment [v,z:real^3]) z IN + xfan (x,V,E) INTER segment [v,z]==> closest_point (xfan (x,V,E) INTER segment [v,z]) z IN + xfan (x,V,E)/\ closest_point (xfan (x,V,E) INTER segment [v,z]) z IN segment [v,z]`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"EM") THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN ASSUME_TAC(th)) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SEGMENT_CONVEX_HULL] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`closest_point (xfan (x:real^3,V:real^3->bool,E) INTER convex hull {v, z}) z IN + convex hull {v, z} /\ ~(x IN convex hull {v, z})==> ~(closest_point (xfan (x,V,E) INTER convex hull {v, z} ) z = x)`) +THEN RESA_TAC +THEN STRIP_TAC +THENL[ASM_REWRITE_TAC[SEGMENT_CONVEX_HULL]; +ABBREV_TAC`y1=closest_point (xfan (x:real^3,V:real^3->bool,E) INTER segment [v,z]) z` +THEN SUBGOAL_THEN`!t. &0< t /\ t< &1==>dist (z,(&1 - t) % y1 + t % z) t<= &1`;NORM_MUL] +THEN MP_TAC(REAL_ARITH`t< &1==> t<= &1`) THEN RESA_TAC +THEN RESA_TAC +THEN MRESAL_TAC REAL_LT_RMUL[`&1-t:real`;`&1:real`;`norm (z - y1:real^3)`][REAL_ARITH`&1*A=A`;REAL_ARITH`&1-t< &1<=> &0< t`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MATCH_MP_TAC(REAL_ARITH`&0<= A /\ ~(A= &0) ==> &0 < A`) +THEN REWRITE_TAC[NORM_POS_LE;NORM_EQ_0;VECTOR_ARITH`A-B= vec 0<=>A=B`] +THEN STRIP_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN MRESA_TAC topological_component_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`] +THEN MP_TAC(SET_RULE`z:real^3 IN U /\ U SUBSET yfan(x,V,E) ==> z IN yfan(x:real^3,V:real^3->bool,E)`) +THEN ASM_REWRITE_TAC[yfan] +THEN SET_TAC[]; +POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"NHIEU") +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[yfan;DIFF;IN_ELIM_THM;SET_RULE`(&1 - t) % y1 + t % z IN (:real^3)`] +THEN STRIP_TAC +THEN MP_TAC (REAL_ARITH`&0 &0<= t /\ t:real<= &1`) THEN RESA_TAC +THEN MRESA_TAC segment_in_segment[`v:real^3`;`z:real^3`;`y1:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`t:real`) +THEN MP_TAC(SET_RULE`(&1 - t) % y1 + t % z IN xfan (x:real^3,V:real^3->bool,E) /\ (&1 - t) % y1 + t % z IN segment [v,z]==> (&1 - t) % y1 + t % z IN xfan (x,V,E) INTER segment [v,z]`) +THEN RESA_TAC +THEN REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th`(&1 - t) % y1 + t % z:real^3`) +THEN REMOVE_THEN "NHIEU"(fun th-> MRESA1_TAC th`t:real`) +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]]);; + + +let in_topological_component_yfan_is_connected=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool. +U IN topological_component_yfan (x,V,E) +==> connected U`, +REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[CONNECTED_CONNECTED_COMPONENT]);; + + + +let expand_element_in_topological_component_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool z:real^3. +FAN(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +==> U=connected_component (yfan(x,V,E)) z`, +REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y:real^3`;`z:real^3`]);; + + + +let segmentsubset_aff_gt=prove(`!x y z w:real^N. +DISJOINT {x} {y,z}/\ w IN aff_gt {x} {y,z} +==> !t. &0<= t /\ t< &1 ==> (&1-t) %w+t%z IN aff_gt {x} {y,z}`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GT_1_2[`x:real^N`;`y:real^N`;`z:real^N`][IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`(&1-t)*t1:real` +THEN EXISTS_TAC`(&1-t)*t2:real` +THEN EXISTS_TAC`(&1-t)*t3+t:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - t) % (t1 % x + t2 % y + t3 % z) + t % z = + ((&1 - t) * t1) % x + ((&1 - t) * t2) % y + ((&1 - t) * t3 + t) % z:real^N`;REAL_ARITH`(&1 - t) * t1 + (&1 - t) * t2 + (&1 - t) * t3 + t=(&1 - t) * (t1 + t2 +t3) + t/\ (&1 - t) * &1 + t = &1`] +THEN STRIP_TAC +THENL[MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1- t<=> t< &1`]; + +MATCH_MP_TAC (REAL_ARITH`&0 &0< A+B`) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1- t<=> t< &1`]]);; + +let point_in_aff_gt_in_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) y:real^3 z:real^3 w:real^3. +FAN(x,V,E) /\ DISJOINT {x} {y,z} /\ w IN aff_gt {x} {y,z} +/\ (!t. &0 < t /\ t < &1 ==> (&1 - t) % y + t % z IN yfan (x,V,E)) +==> w IN yfan(x,V,E)`, +REPEAT STRIP_TAC +THEN MRESA_TAC aff_gt_connect_bound_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`y:real^3`;`z:real^3`] +THEN ASM_TAC THEN SET_TAC[]);; + + + + +let segment_subset_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) y:real^3 z:real^3 w:real^3. +FAN(x,V,E) /\ DISJOINT {x} {y,z} /\ z IN yfan(x,V,E) /\ w IN aff_gt {x} {y,z} +/\ (!t. &0 < t /\ t < &1 ==> (&1 - t) % y + t % z IN yfan (x,V,E)) +==> segment[w,z] SUBSET yfan(x,V,E)`, + +REWRITE_TAC[segment;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC aff_gt_connect_bound_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC segmentsubset_aff_gt[`x:real^3`;`y:real^3`;`z:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real`) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`u<= &1==> u< &1\/ u= &1`) +THEN RESA_TAC +THENL[ +ASM_TAC THEN SET_TAC[]; +ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - &1) % w + &1 % z=z:real^3`]]);; + + +let exists_in_aff_gt_disjoint=prove(`!x:real^3 v:real^3 u:real^3. +DISJOINT {x} {v,u} ==> ?y:real^3. y IN aff_gt {x} {v, u}`, +REPEAT STRIP_TAC +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0 % x+ &1 / &2 % v+ &1/ &2 %u:real^3 ` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1/ &2` +THEN EXISTS_TAC`&1/ &2` +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC);; + + + +let aff_gt_subset_component_y_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool y:real^3 z:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +/\ DISJOINT {x} {y,z} +/\ (!t. &0 < t /\ t < &1 ==> (&1 - t) % y + t % z IN yfan (x,V,E)) +==> aff_gt {x} {y,z} SUBSET U`, +REPEAT STRIP_TAC +THEN MRESA_TAC expand_element_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`U:real^3->bool`;`z:real^3`] +THEN MRESA_TAC exists_in_aff_gt_disjoint[`x:real^3`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC CONVEX_AFF_GT[`{x:real^3}`;`{y,z:real^3}`] +THEN MRESA1_TAC CONVEX_CONNECTED`aff_gt {x:real^3} {y,z:real^3}` +THEN MRESA_TAC aff_gt_connect_bound_subset_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC CONNECTED_COMPONENT_MAXIMAL[`yfan(x:real^3, (V:real^3->bool) ,E)`;`aff_gt {x:real^3} {y,z}`;`y':real^3`;] +THEN MATCH_MP_TAC(SET_RULE`aff_gt {x} {y, z} SUBSET connected_component (yfan (x,V,E)) y'/\ connected_component (yfan (x:real^3, (V:real^3->bool),E)) y'= connected_component (yfan (x,V,E)) z==> aff_gt {x} {y, z} SUBSET connected_component (yfan (x,V,E)) z`) +THEN ASM_REWRITE_TAC[CONNECTED_COMPONENT_EQ_EQ;] +THEN MRESA_TAC point_in_aff_gt_in_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`y:real^3`;`z:real^3`;`y':real^3`] +THEN MRESA_TAC nonsetedge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC zpoint_in_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`z:real^3`] +THEN MRESA_TAC CONNECTED_COMPONENT_OF_SUBSET [`segment [y',z:real^3]`;`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`z:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESA_TAC segment_subset_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`y:real^3`;`z:real^3`;`y':real^3`] +THEN REWRITE_TAC[SEGMENT_CONVEX_HULL] +THEN MRESA1_TAC CONVEX_CONVEX_HULL`{y',z:real^3}` +THEN MRESA1_TAC CONVEX_CONNECTED `convex hull {y', z:real^3}` +THEN MRESA1_TAC CONNECTED_IFF_CONNECTED_COMPONENT`convex hull {y', z:real^3}` +THEN POP_ASSUM(fun th-> MRESA_TAC th[`y':real^3`;`z:real^3`]) +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESAL_TAC expansion1_convex_fan[`y':real^3`;`z:real^3`;`&0`][REAL_ARITH`&0<= &0 /\ &0<= &1`;VECTOR_ARITH`(&1- &0)%v+ &0 % u=v`] +THEN MRESAL_TAC expansion1_convex_fan[`y':real^3`;`z:real^3`;`&1`][REAL_ARITH`&0<= &1 /\ &1 <= &1`;VECTOR_ARITH`(&1- &1)%v+ &1 % u=u`]);; + + + + + + +let exists_connect_point_in_xfanto_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool z:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +==> ?y. ~(y=x) /\ y IN xfan(x,V,E) /\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN U)`, + +REPEAT STRIP_TAC +THEN MRESA_TAC connect_insidepoint_to_bound_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `U:real^3->bool`;`z:real^3`] +THEN EXISTS_TAC `y:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC nonsetedge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;` z:real^3`] +THEN MP_TAC(SET_RULE`~(x=z) /\ ~(y=x)==> DISJOINT {x} {y,z:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC aff_gt_subset_component_y_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC(SET_RULE`aff_gt {x:real^3} {y, z} SUBSET U /\ (&1 - t) % y + t % z IN aff_gt {x} {y, z}==> (&1 - t) % y + t % z IN U`) +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC AFF_GT_1_2[`(x:real^3)` ;` (y:real^3)`;`(z:real^3) `;][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC `&1- t:real` +THEN EXISTS_TAC `t:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1- t<=> t< &1`;REAL_ARITH`&0 + &1 - t + t = &1`] +THEN VECTOR_ARITH_TAC);; + + + + +let place_there_point_line_fan=prove(`!x:real^3 y:real^3 z:real^3. +~(x=y)/\ z IN aff {x,y}==> ?t:real. &0 (u+v)< u `] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&1< u==> &0< u /\ ~(u= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV `u:real` +THEN MRESA1_TAC REAL_INV_LT_1 `u:real` +THEN MRESA1_TAC REAL_MUL_LINV `u:real` +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC `&0` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &0 /\ &1 + &0 = &1/\ u+ &1 - &1 =u`;VECTOR_ARITH`(&1 - inv u) % y + inv u % (u % x + v % y)=(&1 - inv u*(u+ &1- (u+v))) % y + (inv u * u) % x /\ (&1 - &1) % y + &1 % x = &1 % x + &0 % y`]]);; + + + + +let aff_ge_1_1_subset_xfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) y:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ y IN xfan(x,V,E) /\ ~(x=y) +==> aff_ge {x} {y} SUBSET xfan(x,V,E)`, + +REWRITE_TAC[xfan;IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[IN] +THEN RESA_TAC +THEN EXISTS_TAC`e:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC aff_ge_1_1_subset_aff_ge_fan[`x:real^3`;`v:real^3`;`w:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)] THEN ASM_REWRITE_TAC[] THEN ASSUME_TAC(th)) +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)] THEN GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[IN]THEN ASM_REWRITE_TAC[] THEN ASSUME_TAC(th)) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN SET_TAC[]);; + + +let point_in_yfan_and_point_in_xfan_indepent_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool y:real^3 z:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +/\ y IN xfan(x,V,E) +/\ ~(y=x) /\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan (x,V,E)) +==> ~collinear {x,y,z}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC nonsetedge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC zpoint_in_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`z:real^3`] +THEN ASM_REWRITE_TAC[collinear_fan;SET_RULE`~(y=x)<=> ~(x=y)`] +THEN STRIP_TAC +THEN MRESA_TAC place_there_point_line_fan[`x:real^3`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC aff_ge_1_1_subset_xfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`y:real^3`] +THEN MP_TAC(SET_RULE`(&1 - t) % y + t % z IN aff_ge {x:real^3} {y}/\ aff_ge {x} {y} SUBSET xfan (x,V:real^3->bool,E) ==> (&1 - t) % y + t % z IN xfan (x,V,E)`) +THEN RESA_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th`t:real`) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[yfan] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + +let permutes_4points_collinear=prove(`!x y z w:real^N. +~(x=y)/\ ~(x=z) /\ y IN aff {x,z}/\ ~collinear{x,y,w}==> ~collinear{x,z,w}`, +REWRITE_TAC[collinear_fan] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`~(x=y)/\ ~(x=z) ==> DISJOINT {x} {y, z:real^N}`) +THEN RESA_TAC +THEN MRESA_TAC sym_line_fan1[`y:real^N`;`x:real^N`;`z:real^N`]);; + + +let permutes_4points_collinear1=prove(`!x y z w:real^N. +~(x=y)/\ ~(x=z) /\ y IN aff {x,z}/\ ~collinear{x,z,w}==> ~collinear{x,y,w}`, +REWRITE_TAC[collinear_fan] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`~(x=y)/\ ~(x=z) ==>DISJOINT {x} {y, z:real^N}`) +THEN RESA_TAC +THEN MRESA_TAC sym_line01_fan[`y:real^N`;`x:real^N`;`z:real^N`] +THEN ASM_TAC THEN SET_TAC[]);; + + +let in_aff_gt_eq_azim=prove(`!x y z w0 w1:real^3. +~(x=z) /\ y IN aff_gt {x} {z}==> azim x y w0 w1=azim x z w0 w1`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GT_1_1[`x:real^3`;`z:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT {x} {z}<=> ~(x=z)`] +THEN ASM_TAC +THEN GEOM_ORIGIN_TAC `x:real^3` +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`u % (x + vec 0) + v%(x+ z)= (u+v)%x+v %z`;VECTOR_ARITH`(x + y = &1 % x + v % z)<=> y = v % z`] +THEN RESA_TAC +THEN ASM_TAC THEN SET_TAC[AZIM_SPECIAL_SCALE]);; + +let no_origin_aff_ge_is_aff_gt=prove(`!x y z:real^3. +~(x=y) /\ ~(x=z) /\ z IN aff_ge {x} {y}==> z IN aff_gt {x} {y}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GT_1_1[`x:real^3`;`y:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT {x} {z}<=> ~(x=z)`] +THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`y:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT {x} {z}<=> ~(x=z)`] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0<= t2==> t2= &0 \/ &0< t2`) +THEN RESA_TAC +THEN REDUCE_ARITH_TAC +THEN RESA_TAC +THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN ASM_REWRITE_TAC[]);; + + + +(*CASE 1*) + + + +let exists_edge_component_yfan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (y:real^3). + FAN(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) /\ v IN V +/\ ~(y IN set_of_edge v V E) +==> +(?(w:real^3). (w IN (set_of_edge v V E)) /\ +(!(w1:real^3). (w1 IN (set_of_edge v V E)) ==> azim1 x v y w <= azim1 x v y w1))`, + +(let lemma = prove + (`!X:real->bool. + FINITE X /\ ~(X = {}) + ==> ?a. a IN X /\ !x. x IN X ==> a <= x`, + MESON_TAC[INF_FINITE]) in + +REPEAT STRIP_TAC +THEN MRESA_TAC exists_edge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v':real^3`;`v:real^3`] +THEN MRESA_TAC FINITE_IMAGE [`azim1 (x:real^3) v y`;`(set_of_edge v (V:real^3->bool) (E:(real^3->bool)->bool))`] +THEN MP_TAC(SET_RULE`v' IN set_of_edge v V E==> ~(set_of_edge v (V:real^3->bool) (E:(real^3->bool)->bool)= {}) `) +THEN RESA_TAC +THEN MRESA_TAC IMAGE_EQ_EMPTY[`azim1 (x:real^3) v y`;`(set_of_edge v (V:real^3->bool) (E:(real^3->bool)->bool))`] +THEN MRESA1_TAC lemma`IMAGE (azim1 (x:real^3) v y) (set_of_edge v (V:real^3->bool) (E:(real^3->bool)->bool)) +` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`x':real^3` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`(?x'. x' IN set_of_edge v V E /\ azim1 x v y w1 = azim1 x v y (x':real^3))`ASSUME_TAC +THENL[ +EXISTS_TAC`w1:real^3` +THEN ASM_REWRITE_TAC[]; +REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th`azim1 x v y (w1:real^3)`)]));; + + + + +let v_subset_xfan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool). +FAN(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> V SUBSET xfan(x,V,E)`, +REWRITE_TAC[xfan;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC exists_edge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` x':real^3`] +THEN EXISTS_TAC`{x',v:real^3}` +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v:real^3`;`x':real^3`] +THEN MRESA_TAC point_in_aff_ge[`(x:real^3)`;`(x':real^3)`;`(v:real^3)`] +THEN ASM_TAC THEN SET_TAC[IN]);; + + + + +let set_of_edge_subset_edges=prove(`!(V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3). + set_of_edge v V E SUBSET V`, +REWRITE_TAC[set_of_edge] THEN SET_TAC[]);; + + + + + + + +let aff_ge_2_1_is_exists_point_inaff_ge_1_2=prove(`!x:real^3 y:real^3 z:real^3 w:real^3. +DISJOINT {x} {y,w} /\ DISJOINT {x,y} {w}/\ z IN aff_ge {x,y} {w}==> ?t. &0 &0< &1 -t2 /\ &1< &1 -t2 /\ &0<= &1 -t2 /\ ~(&1- t2= &0) `) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`&1-t2` +THEN MRESA1_TAC REAL_LE_INV`&1-t2` +THEN MRESA1_TAC REAL_MUL_LINV `&1- t2:real` +THEN MRESA1_TAC REAL_INV_LT_1`&1- t2` +THEN EXISTS_TAC`inv(&1 - t2)* t1:real` +THEN EXISTS_TAC`inv(&1 - t2)* t2 + &1 - inv(&1 - t2):real` +THEN EXISTS_TAC`inv(&1 - t2)* t3` +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1 - t2) * t1 + + (inv (&1 - t2) * t2 + &1 - inv (&1 - t2)) + + inv (&1 - t2) * t3= inv (&1 - t2) * (t1 +t2+t3)+ &1 - inv (&1 - t2) /\ inv (&1 - t2) * &1 + &1 - inv (&1 - t2) = &1`;VECTOR_ARITH`(&1 - inv (&1 - t2)) % y + inv (&1 - t2) % (t1 % x + t2 % y + t3 % w) = + (inv (&1 - t2) * t1) % x + + (inv (&1 - t2) * t2 + &1 - inv (&1 - t2)) % y + + (inv (&1 - t2) * t3) % w`;REAL_ARITH`inv (&1 - t2) * t2 + &1 - inv (&1 - t2)= &1 - inv (&1 - t2) *(&1-t2)`;REAL_ARITH`&0<= &1 - &1`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[]]);; + + +let not_azim_points_in_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool y:real^3 z:real^3 u:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +/\ u IN V +/\ y IN aff_ge {x} {u} +/\ y IN xfan (x,V,E) +/\ ~(y=x) + /\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan (x,V,E)) +==>(!(w1:real^3). (w1 IN (set_of_edge u V E)) ==> ~(azim x u z w1= &0))`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"YEU") +THEN DISCH_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (u:real^3)`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC nonsetedge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;` z:real^3`] +THEN MRESA_TAC no_origin_aff_ge_is_aff_gt[`x:real^3`;`u:real^3`;`y:real^3`] +THEN MRESA_TAC in_aff_gt_eq_azim[`x:real^3`;`y:real^3`;`u:real^3`;`z:real^3`;`w1:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(SYM(th))) +THEN MRESA_TAC point_in_yfan_and_point_in_xfan_indepent_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;` z:real^3`] +THEN MRESA_TAC aff_ge_1_1_subset_aff_fan[`y:real^3`;`x:real^3`;`u:real^3`] +THEN MRESA_TAC permutes_4points_collinear1[`x:real^3`;`y:real^3`;`u:real^3`;`w1:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`y:real^3`;`w1:real^3`] +THEN STRIP_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`y:real^3`;`z:real^3`;`w1:real^3`] +THEN MRESA_TAC aff_ge_2_1_is_exists_point_inaff_ge_1_2[`x:real^3`;`y:real^3`;`z:real^3`;`w1:real^3`] +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`x:real^3`;`u:real^3`;`w1:real^3`] +THEN MP_TAC(SET_RULE`y IN aff_ge {x} {u}/\ aff_ge {x} {u, w1} = + aff_gt {x} {u, w1} UNION aff_ge {x} {u} UNION aff_ge {x} {w1}==> y IN aff_ge {x} {u, w1:real^3}`) +THEN POP_ASSUM(fun th -> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`u:real^3`;`w1:real^3`;`y:real^3`] +THEN MP_TAC(SET_RULE`(&1 - t) % y + t % z IN aff_ge {x} {y, w1} + /\ aff_ge {x} {y, w1:real^3} SUBSET aff_ge {x} {u, w1}==> (&1 - t) % y + t % z IN aff_ge {x} {u, w1}`) +THEN RESA_TAC +THEN SUBGOAL_THEN`aff_ge {x} {u,w1} SUBSET xfan(x:real^3,V:real^3->bool,E)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[xfan; SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`{u,w1:real^3}` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN SET_TAC[IN]; +MP_TAC(SET_RULE`(&1 - t) % y + t % z IN aff_ge {x:real^3} {u, w1}/\ aff_ge {x} {u, w1} SUBSET xfan (x,V:real^3->bool,E) +==> (&1 - t) % y + t % z IN xfan (x,V,E)`) +THEN RESA_TAC +THEN REMOVE_THEN "YEU"(fun th -> MRESA1_TAC th`t:real` ) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan] +THEN SET_TAC[]]);; + + +let exists_edge_bounded_topological_component_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool y:real^3 z:real^3 u:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +/\ u IN V +/\ y IN aff_ge {x} {u} +/\ y IN xfan(x,V,E) +/\ ~(y=x) +/\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan (x,V,E)) +==> ?w. {u,w} IN E /\ z IN w_dart_fan x V E (x,u,w,sigma_fan x V E u w)`, + +REPEAT STRIP_TAC +THEN MRESA_TAC nonsetedge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC zpoint_in_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`z:real^3`] +THEN MRESA_TAC v_subset_xfan[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC set_of_edge_subset_edges[`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`] +THEN MP_TAC (SET_RULE`V SUBSET xfan (x,(V:real^3->bool),(E:(real^3->bool)->bool)) /\ set_of_edge u V E SUBSET V==> set_of_edge u V E SUBSET xfan (x,V,E)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE` z IN yfan (x,(V:real^3->bool),(E:(real^3->bool)->bool)) /\ set_of_edge u V E SUBSET xfan (x,V,E)/\ yfan (x,V,E)= (:real^3) DIFF xfan (x,V,E) +==> ~(z IN set_of_edge u V E)`) +THEN ASM_REWRITE_TAC[yfan] +THEN STRIP_TAC +THEN MRESA_TAC exists_edge_component_yfan[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (u:real^3)`; `(z:real^3)`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[w_dart_fan] +THEN FIND_ASSUM MP_TAC(`(!v:real^3. v IN V==>CARD (set_of_edge v V E) >1)`) +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`u:real^3` th)) +THEN FIND_ASSUM MP_TAC(`(u:real^3) IN V`) +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[wedge;IN_ELIM_THM] +THEN MRESA_TAC point_in_yfan_and_point_in_xfan_indepent_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;` z:real^3`] +THEN MRESA_TAC aff_ge_1_1_subset_aff_fan[`y:real^3`;`x:real^3`;`u:real^3`] +THEN MRESA_TAC permutes_4points_collinear[`x:real^3`;`y:real^3`;`u:real^3`;`z:real^3`] +THEN MRESA_TAC not_azim_points_in_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` U:real^3->bool`;`y:real^3`;`z:real^3`;`u:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`) +THEN MRESA_TAC azim[`x:real^3`;`u:real^3`;`w:real^3`;`z:real^3`] +THEN REMOVE_ASSUM_TAC +THEN MP_TAC(REAL_ARITH`&0<= azim x u w z ==> azim x u w z = &0 \/ &0< azim x u w (z:real^3)`) +THEN RESA_TAC +THENL(*1*)[ MRESA_TAC AZIM_COMPL_EQ_0[`x:real^3`;`u:real^3`;`w:real^3`;`z:real^3`];(*1*) +ABBREV_TAC`w1=sigma_fan x V E u w:real^3` +THEN SUBGOAL_THEN`~(set_of_edge u V E = {w:real^3})`ASSUME_TAC +THENL(*2*)[ +STRIP_TAC +THEN FIND_ASSUM (MP_TAC)`CARD (set_of_edge (u:real^3) V E) > 1` +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN SUBGOAL_THEN `FINITE {(w:real^3)}` ASSUME_TAC +THENL (*3*)[SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY]; +MRESAL_TAC CARD_PSUBSET[`{}:real^3->bool`;`{w:real^3}`][SET_RULE`{} PSUBSET {w}`] +THEN MRESAL_TAC CARD_DELETE[`w:real^3`;`{w:real^3}`][SET_RULE`w IN {w}/\ {w} DELETE w= {}`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CARD_CLAUSES] +THEN ARITH_TAC];(*2*) + +MRESA_TAC SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w1:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC not_azim_points_in_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` U:real^3->bool`;`y:real^3`;`z:real^3`;`u:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w1:real^3`) +THEN REMOVE_THEN "YEU" (fun th-> MRESAL1_TAC th`w1:real^3`[azim1]) +THEN MP_TAC(REAL_ARITH`&2 * pi - azim x u z w <= &2 * pi - azim x u z w1==> azim x u z (w1:real^3) <= azim x u z w`) +THEN RESA_TAC +THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`u:real^3`;`z:real^3`;`w1:real^3`;` w:real^3`] +THEN MP_TAC(REAL_ARITH` azim x u z w = azim x u z w1 + azim x u w1 w /\ &0<= azim x u z w1 +==> &2 * pi - azim x u z w <= &2 * pi - azim x u w1 (w:real^3)`) +THEN ASM_REWRITE_TAC[azim] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(SYM(th))) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"BE") +THEN SUBGOAL_THEN`~(azim x u w1 (w:real^3)= &0)` ASSUME_TAC +THENL[ STRIP_TAC +THEN MRESA_TAC UNIQUE_AZIM_0_POINT_FAN[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(u:real^3)`;`(w1:real^3)`;`w:real^3`]; + +MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`z:real^3`;`w:real^3`] +THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`u:real^3`;`w1:real^3`;`w:real^3`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&2 * pi - azim x u z w <= &2 * pi - azim x u w1 w + ==> &2 * pi - azim x u z w < &2 * pi - azim x u w1 w \/ azim x u z w = azim x u w1 (w:real^3)`) +THEN RESA_TAC +THEN REMOVE_THEN"BE" MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A+B=B<=>A= &0`]]]]);; + + + + + +let aff_gt_in_w_dart_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) u:real^3 w:real^3 y:real^3. +FAN(x,V,E) /\ {u,w} IN E +/\ y IN w_dart_fan x V E ((x:real^3),(u:real^3),(w:real^3),(sigma_fan x V E u w:real^3)) +/\ fan80(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> aff_gt {x} {u,y} SUBSET w_dart_fan x V E ((x:real^3),(u:real^3),(w:real^3),(sigma_fan x V E u w:real^3)) `, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "CON") +THEN DISCH_THEN(LABEL_TAC "BE") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN USE_THEN "BE" MP_TAC +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`u:real^3`;`w:real^3`] +THEN MRESA_TAC th [`v:real^3`;`u:real^3`]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `u:real^3` THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"EM")) +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge u V E = {w} \/ ~(set_of_edge u V E = {w:real^3})`) +THENL[ +MRESA_TAC CARD_SING[`w:real^3`; `(set_of_edge u V E):real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) +THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; +REMOVE_THEN "CON" MP_TAC +THEN ASM_REWRITE_TAC[SUBSET; w_dart_fan;wedge;IN_ELIM_THM;] +THEN STRIP_TAC THEN GEN_TAC THEN STRIP_TAC +THEN MRESA_TAC aff_gt_inter_aff_gt [`(x:real^3)`;`(u:real^3)`;`(y:real^3)`] +THEN MP_TAC(SET_RULE`aff_gt {x} {u, y} = aff_gt {x, u} {y} INTER aff_gt {x, y} {u} +/\ x' IN aff_gt {x} {u, y:real^3} ==> x' IN aff_gt {x,u} {y}`) THEN RESA_TAC +THEN MRESA_TAC aff_gt_imp_not_collinear[`x:real^3`;`y:real^3`;`u:real^3`; `x':real^3`] +THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`u:real^3`;`w:real^3`;`x':real^3`;`y:real^3`;]]);; + + +let not_empty_rcone_fan_inter_aff_gt=prove(`!x v u:real^3 h:real. +~collinear {x,v,u} /\ &0< h /\ h<= pi==> +~(rcone_fan x v (cos h) INTER aff_gt {x} {v, u}={})`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN SUBGOAL_THEN`~(norm((v:real^3)-(x:real^3))= &0)` ASSUME_TAC +THENL(*1*)[ASM_REWRITE_TAC[NORM_EQ_0;VECTOR_ARITH`v-x=vec 0<=> x=v`]; +ASM_REWRITE_TAC[rcone_fan;SET_RULE`~(A={})<=> ?y. y IN A`;INTER;IN_ELIM_THM] +THEN DISJ_CASES_TAC(REAL_ARITH`(v - x) dot (u - x:real^3) <= &0 \/ &0< (v - x) dot (u - x)`) +THENL(*2*)[ABBREV_TAC`s1= min h (pi / &2) / &2:real` +THEN MP_TAC(REAL_ARITH` &0< pi /\ min h (pi / &2) / &2 =s1 /\ &0< h:real ==> &0<= s1 /\ &0 REWRITE_TAC[SYM(th); REAL_ARITH`&1* &1= &1`]) +THEN RESA_TAC +THEN REDUCE_ARITH_TAC +THEN MP_TAC(ISPEC`norm((v:real^3)-(x:real^3))`REAL_MUL_LINV) +THEN REWRITE_TAC[REAL_ARITH`A*B*D *D=(B*D) *D *A`;REAL_ARITH`A>B<=> B &0< norm (v - x) `) +THEN RESA_TAC +THEN MATCH_MP_TAC COS_MONO_LT +THEN ASM_REWRITE_TAC[];(*3*) +MRESA_TAC condition1_to_in_aff_gt_by_angle[`x:real^3`;`v:real^3`;`u:real^3`;`s1:real`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[e3_fan]](*3*);(*2*) +SUBGOAL_THEN`&0<(atn ((norm ((v - x) cross (u - x))) * inv((v - x) dot (u - x:real^3))))` ASSUME_TAC +THENL(*3*)[MP_TAC(ISPEC`(v - x) dot (u - x:real^3)`REAL_LT_INV) +THEN RESA_TAC +THEN ASSUME_TAC(PI_WORKS) +THEN MP_TAC(REAL_ARITH`&0< pi ==> --(pi / &2) < &0`) +THEN RESA_TAC +THEN MRESAL_TAC ATN_MONO_LT[`&0:real`;` (norm ((v - x) cross (u - x)) * inv ((v - x) dot (u - x))):real`][ ATN_0] +THEN POP_ASSUM MATCH_MP_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`~(norm((v - x) cross (u - x:real^3))= &0)` ASSUME_TAC +THENL(*4*)[ +ASM_REWRITE_TAC[NORM_EQ_0] +THEN MP_TAC(ISPECL[`v-x:real^3`;`u-x:real^3`]CROSS_EQ_0) +THEN ONCE_REWRITE_TAC[GSYM COLLINEAR_3;] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[];(*4*) + +POP_ASSUM MP_TAC +THEN MP_TAC(ISPEC`(v - x) cross (u - x:real^3)`NORM_POS_LE) +THEN REAL_ARITH_TAC](*4*);(*3*) + + ASSUME_TAC(ISPEC`(norm ((v - x) cross (u - x)) * inv ((v - x) dot (u - x))):real`ATN_BOUNDS) +THEN ABBREV_TAC`s2= atn ((norm ((v - x) cross (u - x))) * inv((v - x) dot (u - x))):real` +THEN ABBREV_TAC`s1= min (h:real) (s2:real) / &2` +THEN MP_TAC(REAL_ARITH`&0< h /\ s1= min (h:real) (s2) / &2 /\ &0< pi /\ &0< s2 /\ s2 < pi/ &2==> &0<= s1 /\ &0 REWRITE_TAC[SYM(th); REAL_ARITH`&1* &1= &1`]) +THEN RESA_TAC +THEN REDUCE_ARITH_TAC +THEN MP_TAC(ISPEC`norm((v:real^3)-(x:real^3))`REAL_MUL_LINV) +THEN REWRITE_TAC[REAL_ARITH`A*B*D *D=(B*D) *D *A`;REAL_ARITH`A>B<=> B &0< norm (v - x) `) +THEN RESA_TAC +THEN MATCH_MP_TAC COS_MONO_LT +THEN ASM_REWRITE_TAC[];(*4*) +MRESA_TAC condition_to_in_aff_gt_by_angle[`x:real^3`;`v:real^3`;`u:real^3`;`s1:real`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[e3_fan]]]]]);; + + + + + + +let condition_rw_dart_fan_inter_aff_gt_is_not_empty=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 z:real^3 h:real. +FAN(x,V,E)/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) /\ ~collinear {x,v,z} +/\ {v,u} IN E /\ z IN w_dart_fan x V E (x,v,u,sigma_fan x V E v u) +/\ &0 +~(rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u ) (cos(h)) INTER aff_gt {x} {v,z}={})`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt_in_w_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`z:real^3`] +THEN MP_TAC(SET_RULE`aff_gt {x} {v, z} SUBSET w_dart_fan x V E (x,v,u,sigma_fan x V E v u) ==> +(w_dart_fan x V E (x,v,u,sigma_fan x V E v u) INTER + rcone_fan x v (cos h)) INTER + aff_gt {x} {v, z}= rcone_fan x v (cos h) INTER + aff_gt {x} {v, z:real^3}`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[rw_dart_fan;SET_RULE`~(A={})<=> ?y. y IN A`] +THEN MRESA_TAC not_empty_rcone_fan_inter_aff_gt[`x:real^3`;`v:real^3`;`z:real^3`;`h:real`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + + + +let exists_edge_rw_dart_fan_inter_aff_gt_not_empty_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool y:real^3 z:real^3 u:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +/\ u IN V +/\ y IN aff_ge {x} {u} +/\ y IN xfan(x,V,E) +/\ ~(y=x) +/\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan (x,V,E)) +==> ?w. {u,w} IN E /\ +(!h. &0 ~((rw_dart_fan x V E (x,u,w,sigma_fan x V E u w) (cos h)) INTER aff_gt {x} {u,z}={}))`, + +REPEAT STRIP_TAC +THEN MRESA_TAC exists_edge_bounded_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`;`u:real^3`] +THEN EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC THEN STRIP_TAC +THEN MATCH_MP_TAC condition_rw_dart_fan_inter_aff_gt_is_not_empty +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN MRESA_TAC point_in_yfan_and_point_in_xfan_indepent_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;` z:real^3`] +THEN MRESA_TAC aff_ge_1_1_subset_aff_fan[`y:real^3`;`x:real^3`;`u:real^3`] +THEN MRESA_TAC permutes_4points_collinear[`x:real^3`;`y:real^3`;`u:real^3`;`z:real^3`]);; + + + + + +let exists_edge_rw_dart_fan_inter_topological_component_not_empty_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool y:real^3 z:real^3 u:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +/\ u IN V +/\ y IN aff_ge {x} {u} +/\ y IN xfan(x,V,E) +/\ ~(y=x) +/\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan (x,V,E)) + +==> ?w. {u,w} IN E +/\(!h. &0 ~((rw_dart_fan x V E (x,u,w,sigma_fan x V E u w) (cos h)) INTER U={}))`, + +REPEAT STRIP_TAC +THEN MRESA_TAC nonsetedge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;` z:real^3`] +THEN MP_TAC(SET_RULE`~(x=z) /\ ~(y=x)==> DISJOINT {x} {y,z:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC aff_gt_subset_component_y_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC exists_edge_rw_dart_fan_inter_aff_gt_not_empty_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN EXISTS_TAC `w:real^3` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC THEN STRIP_TAC +THEN REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th`h:real`) +THEN MATCH_MP_TAC(SET_RULE`~(rw_dart_fan x V E (x,u,w,sigma_fan x V E u w) (cos h) INTER aff_gt {x} {u, z} = {}) +/\ aff_gt {x:real^3} {y, z} SUBSET U /\ aff_gt {x} {u, z} =aff_gt {x} {y, z} +==> ~(rw_dart_fan x V E (x,u,w,sigma_fan x V E u w) (cos h) INTER U = {})`) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC aff_gt_1_2_scale_fan +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` w:real^3`;`u:real^3`] +THEN MRESA_TAC aff_ge_1_1_subset_aff_fan[`y:real^3`;`x:real^3`;`u:real^3`] +THEN MRESA_TAC point_in_yfan_and_point_in_xfan_indepent_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;` z:real^3`] +THEN MRESA_TAC permutes_4points_collinear[`x:real^3`;`y:real^3`;`u:real^3`;`z:real^3`] +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC `y IN aff_ge {x} {u:real^3}` +THEN FIND_ASSUM MP_TAC ` ~(x=u:real^3)` +THEN FIND_ASSUM MP_TAC ` ~(y=x:real^3)` +THEN REPEAT REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GE_1_1[`x:real^3`;`u:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`t2:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH` (t1 % x + t2 % u) - x= ((t1+t2)- &1) %x+ t2%(u-x)`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0<= t2==> t2= &0 \/ &0< t2`) +THEN RESA_TAC +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[] +THEN VECTOR_ARITH_TAC);; + + + + + + +let exists_dart_leads_into_edge_eq_topological_component_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool y:real^3 z:real^3 u:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +/\ u IN V +/\ y IN aff_ge {x} {u} +/\ y IN xfan(x,V,E) +/\ ~(y=x) +/\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan(x,V,E)) +==> ?w. {u,w} IN E /\ dart_leads_into x V E u w = U`, + +REPEAT STRIP_TAC +THEN MRESA_TAC exists_edge_rw_dart_fan_inter_topological_component_not_empty_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`;`u:real^3`;] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MA") +THEN MRESA_TAC not_empty_rw_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC DART_LEADS_INTO[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`u:real^3`;`w:real^3`;] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC rw_dart_avoids_fan[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"OI") +THEN MP_TAC(REAL_ARITH`&1> h' /\ h' > &0==> -- &1 < h' /\ h'< &1 /\ -- &1 <= h' /\ h'<= &1/\ &0 < h' /\ h' <= &1`) THEN RESA_TAC +THEN MRESA1_TAC ACS_BOUNDS_LT`h':real` +THEN MRESAL_TAC ACS_MONO_LT[`&0`;`h':real`][ACS_0;REAL_ARITH`-- &1 <= &0`] +THEN MRESA1_TAC COS_ACS `h':real` +THEN ABBREV_TAC`h1= min (h:real) (acs h')/ &2` +THEN MP_TAC(REAL_ARITH`h1= min (h:real) (acs h')/ &2 /\ &0 &0< h1 /\ h1< h /\ h1 h'<= cos h1`) THEN RESA_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESAL1_TAC th `h1:real`[SET_RULE`~(A={})<=> ?y. y IN A`]) +THEN REMOVE_THEN "YEU"(fun th-> MRESA_TAC th [`h1:real`;`y':real^3`]) +THEN EXISTS_TAC `w:real^3` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "EM") +THEN DISCH_TAC +THEN REMOVE_THEN "EM" MP_TAC +THEN POP_ASSUM(fun th -> REWRITE_TAC[SYM(th);]) +THEN DISCH_TAC +THEN MRESA_TAC expand_element_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`U:real^3->bool`;`z:real^3`] +THEN REMOVE_THEN "MA"(fun th-> MRESA1_TAC th `h1:real`) +THEN MP_TAC(SET_RULE`rw_dart_fan x V E (x,u,w,sigma_fan x V E u w) (cos h1) SUBSET + connected_component (yfan (x,V,E)) y'/\ +~(rw_dart_fan x V E (x,u,w,sigma_fan x V E u w) (cos h1) INTER + connected_component (yfan (x,V,E)) z = + {}) +==> +~( connected_component (yfan (x,V,E)) y' INTER + connected_component (yfan (x,V,E)) z = + {})`) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[CONNECTED_COMPONENT_OVERLAP] +THEN SET_TAC[]);; + + +(*CASE 2*) + + + +let not_azim_points1_in_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool y:real^3 z:real^3 u:real^3 w:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +/\ {u,w} IN E +/\ y IN aff_gt {x} {u,w} +/\ y IN xfan (x,V,E) +/\ ~(y=x) + /\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan (x,V,E)) +==> ~(azim x y z w= &0)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"YEU") +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC nonsetedge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;` z:real^3`] +THEN MRESA_TAC point_in_yfan_and_point_in_xfan_indepent_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;` z:real^3`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`w:real^3`;`u:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`;] +THEN STRIP_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`y:real^3`;`z:real^3`;`w:real^3`] +THEN STRIP_TAC +THEN MRESA_TAC th3[`x:real^3`;`y:real^3`;`w:real^3`] +THEN MRESA_TAC aff_ge_2_1_is_exists_point_inaff_ge_1_2[`x:real^3`;`y:real^3`;`z:real^3`;`w:real^3`] +THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`x:real^3`;`u:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE`aff_ge {x} {u, w} = + aff_gt {x} {u, w} UNION aff_ge {x} {u} UNION aff_ge {x} {w} +/\ y IN aff_gt {x} {u,w}==> y IN aff_ge {x:real^3} {u,w}`) +THEN POP_ASSUM(fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN RESA_TAC +THEN MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`u:real^3`; `w:real^3`;`y:real^3`] +THEN SUBGOAL_THEN`aff_ge {x} {u,w} SUBSET xfan(x:real^3,V:real^3->bool,E)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[xfan; SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`{u,w:real^3}` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN SET_TAC[IN]; +MP_TAC(SET_RULE`(&1 - t) % y + t % z IN aff_ge {x:real^3} {y, w}/\ aff_ge {x} {y, w} SUBSET aff_ge {x} {u, w} /\aff_ge {x} {u, w} SUBSET xfan (x,V:real^3->bool,E) +==> (&1 - t) % y + t % z IN xfan (x,V,E)`) +THEN RESA_TAC +THEN REMOVE_THEN "YEU"(fun th -> MRESA1_TAC th`t:real` ) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[yfan] +THEN SET_TAC[]]);; + + + +let not_azim_points2_in_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool y:real^3 z:real^3 u:real^3 w:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +/\ {u,w} IN E +/\ y IN aff_gt {x} {u,w} +/\ y IN xfan (x,V,E) +/\ ~(y=x) + /\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan (x,V,E)) +==> ~(azim x y z u= &0)`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN MATCH_MP_TAC not_azim_points1_in_yfan +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN EXISTS_TAC`U:real^3->bool` +THEN EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]);; + + + + + + +let condition_cross_dot_4point=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + let va = a1 cross a2 in + let vb = a3 cross a4 in + let v3 = va cross vb + x in + ~collinear {x,v,u} +/\ &0<(a1 cross a2) dot a4 /\ &0 < --((a1 cross a2) dot a3) +==> v3 IN aff_gt {x} {v,u}`, +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ABBREV_TAC`a1=(y-x):real^3` +THEN ABBREV_TAC`a2=(z-x):real^3` +THEN ABBREV_TAC`a3=(v-x) :real^3` +THEN ABBREV_TAC`a4=u-x:real^3` +THEN ABBREV_TAC`va=a1 cross a2:real^3` +THEN ABBREV_TAC`vb=a3 cross a4:real^3` +THEN ABBREV_TAC`v3= (va:real^3) cross (vb:real^3)+(x:real^3)` +THEN REPEAT STRIP_TAC +THEN MRESA_TAC th3[`(x:real^3)` ;` (v:real^3)`;`(u:real^3) `;] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&1-(va:real^3) dot (a4:real^3)+va dot (a3:real^3)` +THEN EXISTS_TAC`((va:real^3) dot (a4:real^3))` +THEN EXISTS_TAC`(--((va:real^3) dot (a3:real^3)))` +THEN ASM_REWRITE_TAC[REAL_ARITH` (&1 - va dot a4 + va dot a3) + (va dot a4) + --(va dot a3) = &1`] +THEN EXPAND_TAC"v3" +THEN EXPAND_TAC"vb" +THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_ARITH`A+ B + --U%C=A +B-U%C:real^3`] +THEN EXPAND_TAC"a3" +THEN EXPAND_TAC"a4" +THEN VECTOR_ARITH_TAC);; + + + + +let aff_gt_2_1_crossr_dot_4point=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + ~collinear {x,y,z} +/\ u IN aff_gt {x,y} {z} +/\ &0<(a1 cross a2) dot a3 +==> &0<(a1 cross a4) dot a3 `, +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`y:real^3`;`z:real^3`] +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`y:real^3`;`z:real^3`][IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(u' % x + v' % y + w % z) - x=((u'+v'+w) - &1) % x + v' % (y-x) + w % (z - x)`;REAL_ARITH`&1- &1= &0`] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[CROSS_RMUL;CROSS_RADD;CROSS_REFL;] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[DOT_LMUL] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]);; + + +let aff_gt_2_1_rcross_dot_4pointl=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + ~collinear {x,y,z} +/\ u IN aff_gt {x,z} {y} +/\ &0<(a1 cross a2) dot a3 +==> &0<(a4 cross a2) dot a3 `, +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`z:real^3`;`y:real^3`] +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`z:real^3`;`y:real^3`][IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(u' % x + v' % z + w % y) - x=((u'+v'+w) - &1) % x + v' % (z-x) + w % (y - x)`;REAL_ARITH`&1- &1= &0`] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[CROSS_LMUL;CROSS_LADD;CROSS_REFL;] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[DOT_LMUL] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]);; + + + + +let aff_gt_2_1_cross_dotr_4point=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + ~collinear {x,y,v} +/\ u IN aff_gt {x,y} {v} +/\ &0<(a1 cross a2) dot a3 +==> &0<(a1 cross a2) dot a4 `, +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`y:real^3`;`v:real^3`] +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`y:real^3`;`v:real^3`][IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(u' % x + v' % z + w % y) - x=((u'+v'+w) - &1) % x + v' % (z-x) + w % (y - x)`;REAL_ARITH`&1- &1= &0`] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[DOT_RMUL;DOT_RADD;DOT_CROSS_SELF] +THEN REDUCE_ARITH_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]);; + + +let aff_gt_2_1_cross_dotl_4point=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + ~collinear {x,z,v} +/\ u IN aff_gt {x,z} {v} +/\ &0<(a1 cross a2) dot a3 +==> &0<(a1 cross a2) dot a4 `, +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`z:real^3`;`v:real^3`] +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`z:real^3`;`v:real^3`][IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(u' % x + v' % z + w % y) - x=((u'+v'+w) - &1) % x + v' % (z-x) + w % (y - x)`;REAL_ARITH`&1- &1= &0`] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[DOT_RMUL;DOT_RADD;DOT_CROSS_SELF] +THEN REDUCE_ARITH_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]);; + + + + + +let aff_gt_2_1r_rcross_dotl_4point=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + ~collinear {x,v,y} +/\ u IN aff_gt {x,v} {y} +/\ &0<(a1 cross a2) dot a3 +==> &0<(a4 cross a2) dot a3 `, +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`y:real^3`] +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`v:real^3`;`y:real^3`][IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(u' % x + v' % z + w % y) - x=((u'+v'+w) - &1) % x + v' % (z-x) + w % (y - x)`;REAL_ARITH`&1- &1= &0`] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[CROSS_LMUL;CROSS_LADD;DOT_LMUL;DOT_LADD;DOT_CROSS_SELF] +THEN REDUCE_ARITH_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]);; + + + + + +let aff_gt_1_2_cross_dotr_4point=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + ~collinear {x,v,u} +/\ y IN aff_gt {x} {v,u} +/\ &0<(a1 cross a2) dot a3 + ==> &0< --((a1 cross a2) dot a4)`, + +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(u' % x + v' % z + w % y) - x=((u'+v'+w) - &1) % x + v' % (z-x) + w % (y - x)`;REAL_ARITH`&1- &1= &0`] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[CROSS_LNEG;CROSS_LMUL;CROSS_LADD;CROSS_REFL;DOT_LMUL;DOT_LADD;] +THEN ONCE_REWRITE_TAC[CROSS_SKEW;CROSS_TRIPLE] +THEN REWRITE_TAC[CROSS_TRIPLE;CROSS_REFL;DOT_LZERO] +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[DOT_LNEG;REAL_ARITH`--(A* (--B))=A*B`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE;] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC REAL_LT_RCANCEL_IMP[`&0`;`((u - x) cross (z - x)) dot (v - x:real^3)`;`t3:real`;][REAL_ARITH`&0 * A= &0`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC);; + + + + + +let aff_gt_1_2_cross_dotr_4point_neg=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + ~collinear {x,v,u} +/\ y IN aff_gt {x} {v,u} +/\ &0< --((a1 cross a2) dot a3) + ==> &0< ((a1 cross a2) dot a4)`, +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(u' % x + v' % z + w % y) - x=((u'+v'+w) - &1) % x + v' % (z-x) + w % (y - x)`;REAL_ARITH`&1- &1= &0`] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[CROSS_LNEG;CROSS_LMUL;CROSS_LADD;CROSS_REFL;DOT_LMUL;DOT_LADD;] +THEN ONCE_REWRITE_TAC[CROSS_SKEW;CROSS_TRIPLE] +THEN REWRITE_TAC[CROSS_TRIPLE;CROSS_REFL;DOT_LZERO] +THEN REDUCE_ARITH_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[DOT_LNEG;REAL_ARITH`--(A* (--B))=A*B`] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[DOT_LNEG;REAL_ARITH`-- --A=A`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE;] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE;] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC REAL_LT_RCANCEL_IMP[`&0`;`((z - x) cross (u - x)) dot (v - x):real^3`;`t3:real`;][REAL_ARITH`&0 * A= &0`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC);; + + + +let aff_gt_1_2_cross_dotr_4point_zero=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + ~collinear {x,v,u} +/\ y IN aff_gt {x} {v,u} +/\ (a1 cross a2) dot a3= &0 + ==> ((a1 cross a2) dot a4)= &0`, + +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(u' % x + v' % z + w % y) - x=((u'+v'+w) - &1) % x + v' % (z-x) + w % (y - x)`;REAL_ARITH`&1- &1= &0`] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[CROSS_LNEG;CROSS_LMUL;CROSS_LADD;CROSS_REFL;DOT_LMUL;DOT_LADD;] +THEN ONCE_REWRITE_TAC[CROSS_SKEW;CROSS_TRIPLE] +THEN REWRITE_TAC[CROSS_TRIPLE;CROSS_REFL;DOT_LZERO] +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[DOT_LNEG;REAL_ARITH`--(A* (--B))=A*B`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[REAL_ENTIRE] +THEN STRIP_TAC +THEN ASM_TAC THEN REAL_ARITH_TAC);; + + +let exists_esilon_real=prove(`!a:real b:real. +&0 ?t. &0< t /\ t< &1 /\ +(!h. &0< h /\ h< t==> &0< a- h * b)`, +REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`b <= &0 \/ &0< b`) +THENL[ EXISTS_TAC`&1/ &2` +THEN REWRITE_TAC[REAL_ARITH`&0< &1/ &2 /\ &1/ &2< &1`;] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC(REAL_ARITH`&0 &0< a-h*b`) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= --B<=> B<= &0`] +THEN ASM_TAC THEN REAL_ARITH_TAC; +ABBREV_TAC`t1= (min (inv (b:real) * a) (&1)) / &2` +THEN MRESA1_TAC REAL_LT_INV`b:real` +THEN MRESA_TAC REAL_LT_MUL[`inv b:real`;`a:real`] +THEN MP_TAC(REAL_ARITH`&0 < inv b * a /\ t1= (min (inv (b:real) * a) (&1)) / &2 +==> &0< t1 /\ t1< &1 /\ t1< inv b * a`) +THEN RESA_TAC +THEN EXISTS_TAC `t1:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`h &0< inv b *a- h`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`b:real`;`inv b *a- h:real`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`b * (inv b * a - h)= (inv b * b) * a- h *b `] +THEN MP_TAC(REAL_ARITH`&0 ~(b= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`b:real` +THEN REAL_ARITH_TAC]);; + + + +let invariant_cross_dotr_esilon_3piont=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + &0<(a1 cross a2) dot a3 + ==> +?t. &0< t /\ t< &1 /\ +(!h. &0< h /\ h< t==> + &0< ((a1 cross a2) dot ((&1 - h) % v + h % u-x)))`, + +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - h) % v + h % u-x=(&1 - h) % (v-x) + h % (u-x)`;] +THEN REWRITE_TAC[DOT_RMUL;DOT_RADD;] +THEN REWRITE_TAC[REAL_ARITH`(&1-h)*A+h*B=A-h*(A-B)`] +THEN MATCH_MP_TAC exists_esilon_real +THEN ASM_REWRITE_TAC[]);; + + + +let invariant_rcross_dot_esilon_3piont=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + &0<(a1 cross a2) dot a3 + ==> +?t. &0< t /\ t< &1 /\ +(!h. &0< h /\ h< t==> + &0< (((&1 - h) % y + h % u-x) cross a2) dot a3)`, +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - h) % v + h % u-x=(&1 - h) % (v-x) + h % (u-x)`;] +THEN REWRITE_TAC[CROSS_LMUL;CROSS_LADD;DOT_LMUL;DOT_LADD;] +THEN REWRITE_TAC[REAL_ARITH`(&1-h)*A+h*B=A-h*(A-B)`] +THEN MATCH_MP_TAC exists_esilon_real +THEN ASM_REWRITE_TAC[]);; + + +let invariant_crossr_dot_esilon_3piont=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + &0<(a1 cross a2) dot a3 + ==> +?t. &0< t /\ t< &1 /\ +(!h. &0< h /\ h< t==> + &0< (a1 cross ((&1 - h) % z + h % u-x)) dot a3)`, +REPEAT GEN_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - h) % v + h % u-x=(&1 - h) % (v-x) + h % (u-x)`;] +THEN REWRITE_TAC[CROSS_RMUL;CROSS_RADD;DOT_LMUL;DOT_LADD;] +THEN REWRITE_TAC[REAL_ARITH`(&1-h)*A+h*B=A-h*(A-B)`] +THEN MATCH_MP_TAC exists_esilon_real +THEN ASM_REWRITE_TAC[]);; + + +let point_in_aff_gt_2_1_change_point_in_aff_gt_1_2=prove(` !x:real^3 v:real^3 u:real^3 y:real^3. + ~collinear {x,v,u} +/\ y IN aff_gt {x} {v,u} +==> u IN aff_gt {x,v} {y}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN REMOVE_THEN "YEU" MP_TAC +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`;] +THEN MRESA_TAC th3[`x:real^3`;`y:real^3`;`v:real^3`;] +THEN MRESA_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`;] +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`v:real^3`;`y:real^3`;][IN_ELIM_THM] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0< t3==> ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`t3:real` +THEN MRESA1_TAC REAL_MUL_LINV`t3:real` +THEN EXISTS_TAC`-- inv t3 * t1:real` +THEN EXISTS_TAC`-- inv t3 * t2:real` +THEN EXISTS_TAC`inv t3 :real` +THEN ASM_REWRITE_TAC[REAL_ARITH`--inv t3 * t1 + --inv t3 * t2 + inv t3= inv t3 *( t3 + &1- (t1+t2+t3))`;REAL_ARITH`A+ &1- &1 =A`;VECTOR_ARITH`(--inv t3 * t1) % x + + (--inv t3 * t2) % v + + inv t3 % (t1 % x + t2 % v + t3 % u)= (inv t3 * t3) % u`] +THEN VECTOR_ARITH_TAC);; + +let pos_in_aff_gt_fan=prove(`!x:real^3 v:real^3 u:real^3 a:real. +DISJOINT {x} {v,u} +/\ &0 +(&1-a)%v + a % u IN aff_gt {x} {v,u:real^3}`, + +REPEAT STRIP_TAC +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1 -a:real` +THEN EXISTS_TAC`a:real` +THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 < &1 - a /\ &0 < a`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC);; + + +let pos_in_aff_gt_2_1_fan=prove(`!x:real^3 v:real^3 u:real^3 a:real. +DISJOINT {x,v} {u} +/\ &0 +(&1-a)%v + a % u IN aff_gt {x,v} {u:real^3}`, + +REPEAT STRIP_TAC +THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1 -a:real` +THEN EXISTS_TAC`a:real` +THEN MP_TAC(REAL_ARITH`&0< a /\ a < &1 ==> &0 < &1 - a /\ &0 < a`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC);; + + + +let condition_4point_aff_gt_1_2inter_aff_gt_1_2=prove(`!x:real^3 y:real^3 z:real^3 v:real^3 u:real^3 w:real^3 a:real. + let a1 = y - x in + let a2 = z - x in + let a3 = v - x in + let a4 = u - x in + let a5 = w - x in + + ~collinear {x,v,u} +/\ ~collinear {x,u,w} +/\ ~collinear {x,y,z} +/\ &0< a /\ a< &1 +/\ y IN aff_gt {x} {v,u} +/\ &0<(a3 cross a4) dot a5 +/\ (!h. &0< h /\ h< a==> ~collinear {x,v,(&1-h)%u+h%w}) +/\ &0<(a3 cross a1) dot a2 + ==> ?t. &0< t /\ t< &1 /\ +(!h. &0< h /\ h< t==> ~(aff_gt {x} {y,z} INTER aff_gt {x} {v,(&1-h)%u+h%w}={}))`, + +REPEAT STRIP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN MRESA_TAC aff_gt_1_2_cross_dotr_4point[`x:real^3`;`y:real^3`;`z:real^3`;`v:real^3`;`u:real^3`;] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN MRESA_TAC invariant_cross_dotr_esilon_3piont[`x:real^3`; `z:real^3`;`y:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[DOT_LNEG] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN MRESA_TAC point_in_aff_gt_2_1_change_point_in_aff_gt_1_2[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`] +THEN MRESA_TAC aff_gt_2_1r_rcross_dotl_4point[`x:real^3`;`y:real^3`;`z:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC invariant_rcross_dot_esilon_3piont[`x:real^3`; `u:real^3`;`z:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"EM") +THEN ABBREV_TAC`t1= min (min t t') a:real` +THEN MP_TAC(REAL_ARITH`&0 &0< t1 /\ t1 < &1`) +THEN RESA_TAC +THEN EXISTS_TAC`t1:real` +THEN ASM_REWRITE_TAC[SET_RULE`~(A={})<=> ?y1. y1 IN A`] +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`a1=(y-x):real^3` +THEN ABBREV_TAC`a2=(z-x):real^3` +THEN ABBREV_TAC`a3=(v-x) :real^3` +THEN ABBREV_TAC`a4=(&1 - h) % u + h % w-x:real^3` +THEN ABBREV_TAC`va=a1 cross a2:real^3` +THEN ABBREV_TAC`vb=a3 cross a4:real^3` +THEN ABBREV_TAC`v3= (vb:real^3) cross (va:real^3)+(x:real^3)` +THEN EXISTS_TAC `v3:real^3` +THEN MP_TAC(REAL_ARITH`h h MRESA1_TAC th `h:real`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN REWRITE_TAC[DOT_LNEG] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN REWRITE_TAC[GSYM DOT_LNEG] +THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] +THEN RESA_TAC +THEN MRESA_TAC th3[`x:real^3`;`u:real^3`;`w:real^3`;] +THEN MRESA_TAC pos_in_aff_gt_2_1_fan [`x:real^3`;`u:real^3`;`w:real^3`;`h:real`] +THEN MRESAL_TAC aff_gt_2_1_cross_dotl_4point[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`(&1 - h) % u + h % w:real^3`][VECTOR_ARITH`((&1 - h) % u + h % w) - x=(&1 - h) % u + h % w - x`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN MRESA_TAC aff_gt_inter_aff_gt [`(x:real^3)`;`(v:real^3)`;`(u:real^3)`] +THEN MP_TAC(SET_RULE`y IN aff_gt {x} {v, u} /\ aff_gt {x} {v, u} = aff_gt {x, v} {u} INTER aff_gt {x, u} {v} +==> y IN aff_gt {x, v} {u:real^3}`) +THEN RESA_TAC +THEN MRESAL_TAC aff_gt_2_1r_rcross_dotl_4point[`x:real^3`;`u:real^3`;`(&1 - h) % u + h % w:real^3`;`v:real^3`;`y:real^3`][VECTOR_ARITH`((&1 - h) % u + h % w) - x=(&1 - h) % u + h % w - x`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[DOT_LNEG] +THEN STRIP_TAC +THEN MRESAL_TAC condition_cross_dot_4point[`x:real^3`;`v:real^3`;`(&1 - h) % u + h % w:real^3`;`y:real^3`;`z:real^3` ][VECTOR_ARITH`((&1 - h) % u + h % w) - x=(&1 - h) % u + h % w - x`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC condition_cross_dot_4point[`x:real^3`; `z:real^3`;`y:real^3` ;`v:real^3`;`(&1 - h) % u + h % w:real^3`][VECTOR_ARITH`((&1 - h) % u + h % w) - x=(&1 - h) % u + h % w - x`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[GSYM CROSS_RNEG] +THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] +THEN REWRITE_TAC[DOT_LNEG;REAL_ARITH`--(--A)=A`] +THEN REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th`h:real`) +THEN REMOVE_THEN "LINH" (fun th-> MRESA1_TAC th`h:real`) +THEN SET_TAC[]);; + + + + + + + + + + + +let exists_dart_leads_into_edge_eq_topological1_component_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool y:real^3 z:real^3 v:real^3 u:real^3 w:real^3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ y IN aff_gt {x} {v,u} +/\ y IN xfan(x,V,E) +/\ ~(y=x) +/\(!t. &0< t /\ t< &1==> (&1-t)%y+t%z IN yfan(x,V,E)) +/\ &0<((v-x) cross (y-x)) dot (z-x) + +==> dart_leads_into x V E v u = U`, + + +REPEAT STRIP_TAC +THEN MRESA_TAC connected_component_of_faces_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`]) +THEN MRESA_TAC fan_run_in_small_is_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"HA") +THEN MRESA_TAC not_empty_rw_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC DART_LEADS_INTO[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`u:real^3`;`w:real^3`;] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC rw_dart_avoids_fan[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"OI") +THEN MP_TAC(REAL_ARITH`&1> h'' /\ h'' > &0==> -- &1 < h'' /\ h''< &1 /\ -- &1 <= h'' /\ h''<= &1/\ &0 < h'' /\ h'' <= &1`) THEN RESA_TAC +THEN MRESA1_TAC ACS_BOUNDS_LT`h'':real` +THEN MRESAL_TAC ACS_MONO_LT[`&0`;`h'':real`][ACS_0;REAL_ARITH`-- &1 <= &0`] +THEN MRESA1_TAC COS_ACS `h'':real` +THEN ABBREV_TAC`h1= min h (min (h':real) (acs h''))/ &2` +THEN MP_TAC(REAL_ARITH`h1= min h (min (h':real) (acs h''))/ &2 /\ &0< h /\ &0 &0< h1 /\ h1< h /\ h1 h''<= cos h1`) THEN RESA_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESAL1_TAC th `h1:real`[SET_RULE`~(A={})<=> ?y. y IN A`]) +THEN REMOVE_THEN "YEU"(fun th-> MRESA_TAC th [`h1:real`;`y':real^3`]) +THEN MRESA_TAC exists_rw_dart_inter_aff_gt1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;` w:real^3`;`h1:real`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MA1") +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC point_in_yfan_and_point_in_xfan_indepent_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;` z:real^3`] +THEN MRESA_TAC exists_open_not_collinear[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(u:real^3)`;`(w:real^3)`] +THEN SUBGOAL_THEN`(!h. &0 < h /\ h < t1 / &2 ==> ~collinear {x, v, (&1 - h) % u + h % w:real^3})`ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CHANGE") +THEN GEN_TAC THEN STRIP_TAC +THEN REMOVE_THEN "CHANGE"(fun th-> MRESA1_TAC th`h'''':real`) +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +MP_TAC(REAL_ARITH`&0< t1 /\ t1<= &1==> &0< t1/ &2 /\ t1/ &2 < &1`) +THEN RESA_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `u:real^3`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN RESA_TAC +THEN MRESA_TAC condition_4point_aff_gt_1_2inter_aff_gt_1_2[`x:real^3`;`y:real^3`;`z:real^3`;`v:real^3`;` u:real^3`;`w:real^3`;`t1/ &2:real`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MA2") +THEN ABBREV_TAC`t2=min h ( min h''' t) / &2:real` +THEN MP_TAC(REAL_ARITH`t2=min h ( min h''' t) / &2:real /\ &0 t2< h''' /\ t2< t /\ &0< t2/\ t2< h`) +THEN RESA_TAC +THEN REMOVE_THEN "MA1"(fun th-> MRESA1_TAC th `t2:real`) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y1. y1 IN A`;INTER;IN_ELIM_THM] +THEN RESA_TAC +THEN REMOVE_THEN "MA2"(fun th-> MRESA1_TAC th `t2:real`) +THEN MRESA_TAC nonsetedge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;` z:real^3`] +THEN MP_TAC(SET_RULE`~(x=z) /\ ~(y=x)==> DISJOINT {x} {y,z:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC aff_gt_subset_component_y_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`] +THEN MP_TAC(SET_RULE`~(aff_gt {x} {y, z} INTER aff_gt {x} {v, (&1 - t2) % u + t2 % w} = {})/\ +aff_gt {x} {y, z} SUBSET U==> ~(U INTER aff_gt {x:real^3} {v, (&1 - t2) % u + t2 % w} = {})`) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?y2. y2 IN A`;INTER;IN_ELIM_THM] +THEN RESA_TAC +THEN MRESA_TAC expand_element_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`U:real^3->bool`;`y2:real^3`] +THEN MRESA_TAC dart_leads_into_fan_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN MP_TAC(SET_RULE`y1 IN rw_dart_fan x V E (x,u,w,v) (cos h1) +/\ rw_dart_fan x V E (x,u,w,v) (cos h1) SUBSET (dart_leads_into x V E u w) +==> y1 IN (dart_leads_into x V E u (w:real^3))`) +THEN RESA_TAC +THEN MRESA_TAC expand_element_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(dart_leads_into x V E u w):real^3->bool`;`y1:real^3`] +THEN MRESA_TAC zpoint_in_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y2:real^3`] +THEN MRESA_TAC zpoint_in_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(dart_leads_into x V E u w):real^3->bool`;`y1:real^3`] +THEN ASM_REWRITE_TAC[CONNECTED_COMPONENT_EQ_EQ] +THEN MRESA_TAC CONVEX_AFF_GT[`{x:real^3}`;`{v, (&1 - t2) % u + t2 % w:real^3}`] +THEN MRESA_TAC CONVEX_CONNECTED[`aff_gt {x} {v, (&1 - t2) % u + t2 % w}:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONNECTED_IFF_CONNECTED_COMPONENT] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th [`y1:real^3`;`y2:real^3`]) +THEN REMOVE_THEN "HA" (fun th-> MRESA1_TAC th `t2:real`) +THEN MRESA_TAC CONNECTED_COMPONENT_OF_SUBSET[`aff_gt {x} {v, (&1 - t2) % u + t2 % w:real^3}:real^3-> bool`;`yfan (x:real^3,(V:real^3->bool),(E:(real^3->bool)->bool)):real^3->bool`;`y1:real^3`;`y2:real^3`] +]);; + + + + + +let JUTSTKG=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ U IN topological_component_yfan (x,V,E) +==> ?v u. {v,u} IN E /\ dart_leads_into x V E v u = U`, + +REPEAT STRIP_TAC +THEN MRESA_TAC exists_point_in_component_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)` ;`U:real^3->bool`] +THEN MRESA_TAC connect_insidepoint_to_bound_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)` ;`U:real^3->bool`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN ASSUME_TAC th) +THEN REWRITE_TAC[xfan;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[IN] +THEN RESA_TAC +THEN SUBGOAL_THEN `{v,w:real^3} IN E`ASSUME_TAC +THENL(*1*)[POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th);IN]);(*1*) +MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN MRESAL_TAC aff_ge_eq_aff_gt_union_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`][UNION;IN_ELIM_THM] +THEN STRIP_TAC +THENL(*2*)[ +STRIP_TAC +THEN MRESA_TAC point_in_yfan_and_point_in_xfan_indepent_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;` z:real^3`] +THEN DISJ_CASES_TAC(REAL_ARITH`&0 < ((v - x) cross (y - x)) dot (z - x) \/ &0< --(((v - x) cross (y - x)) dot (z - x)) \/ ((v - x:real^3) cross (y - x)) dot (z - x)= &0`) +THENL(*3*)[ +MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC exists_dart_leads_into_edge_eq_topological1_component_fan[`x:real^3`;`(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`;`v:real^3`;`w:real^3`;`inverse1_sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (w:real^3) (v:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*3*) + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL(*4*)[ +MRESA_TAC aff_gt_1_2_cross_dotr_4point_neg[`x:real^3`;`y:real^3`;`z:real^3`;`v:real^3`;`w:real^3`;] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN RESA_TAC +THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`) +THEN STRIP_TAC +THEN MRESA_TAC exists_dart_leads_into_edge_eq_topological1_component_fan[`x:real^3`;`(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`;`w:real^3`;`v:real^3`;`inverse1_sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN EXISTS_TAC`w:real^3` +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];(*4*) + +MRESA_TAC aff_gt_1_2_cross_dotr_4point_zero[`x:real^3`;`y:real^3`;`z:real^3`;`v:real^3`;`w:real^3`;] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN RESA_TAC +THEN MRESA_TAC not_azim_points1_in_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC not_azim_points1_in_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`;`w:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`~(azim x y z v = &0) /\ &0<= azim x y z v==> &0< azim x y z (v:real^3) `) +THEN ASM_REWRITE_TAC[azim] +THEN STRIP_TAC +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`w:real^3`;`y:real^3`] +THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`w:real^3`;`v:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`azim x y z (v:real^3)< pi \/ pi<= azim x y z (v:real^3)`) +THENL(*5*)[ +MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`y:real^3`; `v:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC;(*5*) + +POP_ASSUM MP_TAC +THEN MRESA_TAC aff_gt2_subset_aff_ge [`x:real^3`;`w:real^3`; `v:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`y:real^3`;`z:real^3`;`w:real^3`;`v:real^3`] +THEN MP_TAC(REAL_ARITH`azim x y z v = azim x y z w + pi/\ +azim x y z v < &2 * pi/\ ~(azim x y z w = &0) /\ &0 <= azim x y z w +==> &0< azim x y z w /\ azim x y z w < pi +`) +THEN ASM_REWRITE_TAC[azim] +THEN STRIP_TAC +THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`y:real^3`; `w:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC](*5*)](*4*)](*3*);(*2*) + + +STRIP_TAC +THEN MRESA_TAC exists_dart_leads_into_edge_eq_topological_component_fan[`x:real^3`;`(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`;`v:real^3`] +THEN EXISTS_TAC `v:real^3` +THEN EXISTS_TAC `w':real^3` +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`; +` (w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC exists_dart_leads_into_edge_eq_topological_component_fan[`x:real^3`;`(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`;`U:real^3->bool`;`y:real^3`;`z:real^3`;`w:real^3`] +THEN EXISTS_TAC `w:real^3` +THEN EXISTS_TAC `w':real^3` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]]]);; + + + +(**************KVQWYDL*******************) + + + +let AFF_GT_3_1 = prove + (`!x v u w. + DISJOINT {x,v,u} {w} + ==> aff_gt {x,v,u} {w} = + {y | ?t1 t2 t3 t4. + &0 < t4 /\ + t1 + t2 +t3 +t4 = &1 /\ + y = t1 % x + t2 % v + t3 % u +t4 % w }`, + AFF_TAC);; + + + +let AFF_GT_1_3 = prove + (`!x v u w. + DISJOINT {x} {v,u,w} + ==> aff_gt {x} {v,u,w} = + {y | ?t1 t2 t3 t4. + &0 < t2 /\ &0< t3 /\ &0 aff_ge {x} {v,u,w} = + {y | ?t1 t2 t3 t4. + &0 <= t2 /\ &0<= t3 /\ &0<= t4 /\ + t1 + t2 +t3 +t4 = &1 /\ + y = t1 % x + t2 % v + t3 % u +t4 % w }`, + AFF_TAC);; + + + +let notcoplanar_disjoint=prove(`!x v u w:real^3. +~coplanar {x,v,u,w} +==> ~(x=v) /\ ~(x=u) /\ ~(x=w)/\ ~(v=u) /\ ~(v=w) /\ ~(u=w)`, +REPEAT GEN_TAC +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={B,C,D,A}`] THEN DISCH_TAC THEN MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={C,D,A,B}`] THEN DISCH_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`v:real^3`;`u:real^3`;`w:real^3`;`x:real^3`] +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`u:real^3`;`w:real^3`;`x:real^3`;`v:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC th3[`u:real^3`;`w:real^3`;`x:real^3`]);; + + + +let notcoplanar_disjoints=prove(`!x v u w:real^3. +~coplanar {x,v,u,w} +==> DISJOINT{x,v,u} {w} /\ DISJOINT{x,u,w} {v} /\ DISJOINT{x,w,v} {u} /\ DISJOINT{x} {v,u,w}/\ DISJOINT {x,u} {v,w} /\ DISJOINT {x} {v,u} /\ DISJOINT {x} {u,w} /\ DISJOINT {x} {w,v} `, +REPEAT STRIP_TAC +THEN MRESA_TAC notcoplanar_disjoint[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN ASM_TAC THEN SET_TAC[]);; + + + +let coplanar_imp_continuous_collinear=prove(`!x:real^3 v:real^3 u:real^3 w:real^3. + ~(coplanar{x,v,u,w}) +==>(!t:real. ~(t= &0) ==> ~collinear {x,v,(&1-t)%u+t%w} )`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC continuous_coplanar_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`t:real`) +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`(&1 - t) % u + t % w:real^3`]);; + + + + + +let aff_gt_1_3_eq_unions_aff_gt_1_2=prove(`!x v u w:real^3. +~coplanar {x,v,u,w} +==> +aff_gt {x} {v,u,w} = UNIONS {aff_gt{x} {v,(&1-a)%u+ a % w}| &0 &0< t3+t4/\ ~(t3+t4= &0)`) THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV `t3+t4:real` +THEN MRESA_TAC REAL_LT_MUL [`inv(t3+t4:real)`;`t4:real`] +THEN MRESA_TAC REAL_LT_MUL [`inv(t3+t4:real)`;`t3:real`] +THEN MRESA1_TAC REAL_MUL_LINV `t3+t4:real` +THEN POP_ASSUM (fun th-> MP_TAC th THEN REWRITE_TAC[REAL_ARITH`A*(B+C)= &1<=> A*B = &1 - A*C`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`inv (t3 + t4) * t3 = &1 -inv (t3 + t4) * t4/\ &0< inv (t3 + t4) * t3 ==> +inv (t3 + t4) * t4 < &1 `) +THEN RESA_TAC THEN ASSUME_TAC th) +THEN MP_TAC(REAL_ARITH`&0 ~(inv (t3 + t4) * t4= &0)`) THEN RESA_TAC +THEN EXISTS_TAC`aff_gt {x:real^3} {v, (&1 - inv (t3 + t4:real) * t4) %u + (inv (t3 + t4) * t4) % w}` +THEN STRIP_TAC +THENL[ +EXISTS_TAC`inv(t3 + t4:real) * t4` +THEN ASM_REWRITE_TAC[]; + + MRESA_TAC coplanar_imp_continuous_collinear[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`inv (t3 + t4:real) * t4`) +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`(&1 - inv (t3 + t4) * t4) % u + (inv (t3 + t4) * t4) % w:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1 - inv (t3 + t4) * t4) % u + (inv (t3 + t4) * t4) % w:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t3+ t4:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(t3 + t4) % ((&1 - inv (t3 + t4) * t4) % u + (inv (t3 + t4) * t4) % w) +=(t3 + t4 - (inv (t3 + t4) *(t3+t4))* t4) % u + ((inv (t3 + t4)*(t3+t4)) * t4) % w`] +THEN VECTOR_ARITH_TAC]; + + +REWRITE_TAC[UNIONS;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0 ~(a= &0)`) THEN RESA_TAC +THEN MRESA_TAC coplanar_imp_continuous_collinear[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`a:real`) +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`(&1 - a) % u + (a) % w:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`(&1 - a) % u + a % w:real^3`][IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t3 *(&1-a):real` +THEN EXISTS_TAC`t3 * a:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`t1 + t2 + t3 * (&1 - a) + t3 * a=t1+t2+t3`; +VECTOR_ARITH`t1 % x + t2 % v + t3 % ((&1 - a) % u + a % w) = + t1 % x + t2 % v + (t3 * (&1 - a)) % u + (t3 * a) % w:real^3`] +THEN STRIP_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN REAL_ARITH_TAC]);; + + + + + + + + + + + + + + +let aff_gt_1_3_subset_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +==> (aff_gt{x} {v,u,w} SUBSET yfan (x,V,E))`, +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESAL_TAC aff_gt_1_3_eq_unions_aff_gt_1_2[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][UNIONS;IN_ELIM_THM;yfan;xfan] +THEN MRESA_TAC not_cut_in_edges_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + + + +let aff_gt_1_3_subset_dart_leads_into_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E +/\ sigma_fan x V E u w = v +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +==> aff_gt{x} {v,u,w} SUBSET dart_leads_into x V E u w`, +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESAL_TAC aff_gt_1_3_eq_unions_aff_gt_1_2[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][UNIONS;IN_ELIM_THM;yfan;xfan] +THEN MRESA_TAC not_empty_rw_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC DART_LEADS_INTO[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`u:real^3`;`w:real^3`;] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC rw_dart_avoids_fan[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"OI") +THEN MP_TAC(REAL_ARITH`&1> h' /\ h' > &0==> -- &1 < h' /\ h'< &1 /\ -- &1 <= h' /\ h'<= &1/\ &0 < h' /\ h' <= &1`) THEN RESA_TAC +THEN MRESA1_TAC ACS_BOUNDS_LT`h':real` +THEN MRESAL_TAC ACS_MONO_LT[`&0`;`h':real`][ACS_0;REAL_ARITH`-- &1 <= &0`] +THEN MRESA1_TAC COS_ACS `h':real` +THEN ABBREV_TAC`h1= min (h:real) (acs h')/ &2` +THEN MP_TAC(REAL_ARITH`h1= min (h:real) (acs h')/ &2 /\ &0 &0< h1 /\ h1< h /\ h1 h'<= cos h1`) THEN RESA_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESAL1_TAC th `h1:real`[SET_RULE`~(A={})<=> ?y. y IN A`]) +THEN REMOVE_THEN "YEU"(fun th-> MRESA_TAC th [`h1:real`;`y:real^3`]) +THEN POP_ASSUM(fun th -> REWRITE_TAC[SYM(th);IN_ELIM_THM;topological_component_yfan;] THEN ASSUME_TAC th) +THEN MRESA_TAC exists_rw_dart_inter_aff_gt1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`h1:real`) +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC`a1=min h'' (&1) / &2` +THEN MP_TAC(REAL_ARITH`&0< h'' /\ a1=min h'' (&1) / &2 ==> &0< a1 /\ a1< h'' /\ a1< &1`) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`a1:real`[SET_RULE`~(A={})<=> ?y. y IN A`;INTER;IN_ELIM_THM]) +THEN MP_TAC(SET_RULE`y' IN rw_dart_fan x V E (x,u,w,v) (cos h1)/\ rw_dart_fan x V E (x,u,w,v) (cos h1) SUBSET dart_leads_into x V E u w +==> y' IN dart_leads_into x V E u w`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`y' IN aff_gt {x} {v, (&1 - a1) % u + a1 % w:real^3} /\ &0< a1 /\ (a1:real) < &1 +==> y' IN {x' | ?u'. (?a. (&0 < a /\ a < &1) /\ + u' = aff_gt {x} {v, (&1 - a) % u + a % w}) /\ + x' IN u'}`) +THEN RESA_TAC +THEN MRESA_TAC dart_leads_into_fan_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC expand_element_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(dart_leads_into x V E u w):real^3->bool`;`y':real^3`] +THEN MRESA_TAC CONVEX_AFF_GT[`{x:real^3}`;`{v, u, w:real^3}`] +THEN MRESA_TAC CONVEX_CONNECTED[`aff_gt {x} {v, u,w}:real^3->bool`] +THEN MRESA_TAC aff_gt_1_3_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;` w:real^3`] +THEN MATCH_MP_TAC CONNECTED_COMPONENT_MAXIMAL +THEN ASM_REWRITE_TAC[]);; + + + + + + + +let inter_aff_gt_3_1_is_aff_gt_1_3=prove(`!x v u w:real^3. +~coplanar {x,v,u,w} +==> +aff_gt {x,v,u} {w} INTER aff_gt {x,u,w} {v} INTER aff_gt {x,w,v} {u}=aff_gt {x} {v,u,w}`, +GEOM_ORIGIN_TAC `x:real^3` +THEN REPEAT STRIP_TAC +THEN MRESA_TAC notcoplanar_disjoints[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_disjoint[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC AFF_GT_3_1[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC AFF_GT_3_1[`(vec 0):real^3`;`u:real^3`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC AFF_GT_3_1[`(vec 0):real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC AFF_GT_1_3[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC NOT_COPLANAR_0_4_IMP_INDEPENDENT[`v:real^3`;`u:real^3`;`w:real^3`] +THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM;INTER] +THEN REDUCE_VECTOR_TAC +THEN GEN_TAC +THEN EQ_TAC +THENL[ +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t2 % v + t3 % u + t4 % w = t2'' % w + t3'' % v + t4'' % u <=> (t2-t3'') % v + (t3-t4'') % u + (t4-t2'') % w= vec 0`] +THEN STRIP_TAC +THEN MRESAL_TAC INDEPENDENT_3[`v:real^3`;`u:real^3`;`w:real^3`;`t2-t3'':real`; `t3-t4'':real`; `t4 -t2'':real`][REAL_ARITH`A-B= &0<=> A=B`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t2 % v + t3 % u + t4 % w = t2' % u + t3' % w + t4' % v <=> (t2-t4') % v + (t3-t2') % u + (t4-t3') % w= vec 0`] +THEN STRIP_TAC +THEN MRESAL_TAC INDEPENDENT_3[`v:real^3`;`u:real^3`;`w:real^3`;`t2-t4':real`; `t3-t2':real`; `t4 -t3':real`][REAL_ARITH`A-B= &0<=> A=B`] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`t1'':real` +THEN EXISTS_TAC`t3'':real` +THEN EXISTS_TAC`t4'':real` +THEN EXISTS_TAC`t2'':real` +THEN ASM_REWRITE_TAC[REAL_ARITH`t1+t2+t3+t4=t1+t4+t2+t3:real`] +THEN ASM_TAC +THEN REAL_ARITH_TAC; + +STRIP_TAC +THEN STRIP_TAC +THENL[EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t3:real` +THEN EXISTS_TAC`t4:real` +THEN ASM_REWRITE_TAC[]; + +STRIP_TAC +THENL[ +EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t3:real` +THEN EXISTS_TAC`t4:real` +THEN EXISTS_TAC`t2:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`t1 + t3 + t4+ t2:real=t1 + t2 + t3 + t4`] +THEN VECTOR_ARITH_TAC; +EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t4:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t3:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`t1 + t4+ t2+ t3:real=t1 + t2 + t3 + t4`] +THEN VECTOR_ARITH_TAC]]]);; + + +let coplanar_cross_dot=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +~coplanar {x,v,u,v1} +==> ~(((v-x) cross (u-x)) dot (v1-x)= &0)`, +REPEAT GEN_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[DOT_SYM;] +THEN REWRITE_TAC[DOT_CROSS_DET] +THEN ONCE_REWRITE_TAC[ COPLANAR_DET_EQ_0] +THEN ASM_REWRITE_TAC[]);; + + +let CRAMER_LEMMA1 = prove + (`!A:real^N^N x:real^N k:num. + 1 <= k /\ k <= dimindex(:N) + ==> det((lambda i j. if j = k then (A**x)$i else A$i$j):real^N^N) = + x$k * det(A)`, + REPEAT GEN_TAC THEN DISCH_TAC THEN REWRITE_TAC[MATRIX_MUL_VSUM] THEN + FIRST_ASSUM(MP_TAC o SYM o SPECL [`transp(A:real^N^N)`; `x:real^N`] o + MATCH_MP CRAMER_LEMMA_TRANSP) THEN + REWRITE_TAC[DET_TRANSP] THEN DISCH_THEN SUBST1_TAC THEN + GEN_REWRITE_TAC LAND_CONV [GSYM DET_TRANSP] THEN AP_TERM_TAC THEN + ASM_SIMP_TAC[CART_EQ; transp; LAMBDA_BETA; MATRIX_MUL_VSUM; row; column; + COND_COMPONENT; VECTOR_MUL_COMPONENT; VSUM_COMPONENT]);; + +let aff_gt_3_1_rep_cross_dot=prove(`!x:real^3 v:real^3 u:real^3 w:real^3. +~coplanar {x,v,u,w} +/\ &0< ((v-x) cross (u-x)) dot (w-x) + +==> aff_gt {x,v,u} {w} ={y:real^3| &0< (((v-x) cross (u-x)) dot (y-x)) }`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_disjoints[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC AFF_GT_3_1[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL[STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`((t1 % x + t2 % v + t3 % u + t4 % w) - x)=((t1+t2+t3+t4) - &1) % x + t2 % (v-x) + t3 % (u-x) + t4 % (w - x)`; REAL_ARITH`&1- &1= &0`] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[CROSS_LNEG;CROSS_LMUL;CROSS_LADD;CROSS_REFL;DOT_RMUL;DOT_RADD;DOT_CROSS_SELF;] +THEN REDUCE_ARITH_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]; +DISCH_THEN(LABEL_TAC"ME") +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]properties_coordinate) THEN RESA_TAC +THEN MRESA_TAC ORTHONORMAL_IMP_SPANNING[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3)( v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[SPAN_3;EXTENSION] + THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(x':real^3)-(x:real^3)`th) THEN ASSUME_TAC(th)) +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(w:real^3)-(x:real^3)`th)THEN ASSUME_TAC(th)) +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(u:real^3)-(x:real^3)`th)THEN ASSUME_TAC(th)) +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(v:real^3)-(x:real^3)`th)) +THEN REWRITE_TAC[SET_RULE`(a:real^3) IN (:real^3)`;IN_ELIM_THM;VECTOR_ARITH`A-B=C<=>A=C+B:real^3`] +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`e1=e1_fan x v u:real^3` +THEN ABBREV_TAC`e2=e2_fan x v u:real^3` +THEN ABBREV_TAC`e3=e3_fan x v u:real^3` +THEN REMOVE_THEN"YEU" MP_TAC +THEN MRESA_TAC ORTHONORMAL_CROSS[`e1:real^3`;`e2:real^3`;`e3:real^3`;] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + + t2 % ((u' % e1 + v' % e2 + w' % e3) + x) + + t3 % ((u'' % e1 + v'' % e2 + w'' % e3) + x) + + t4 % ((u''' % e1 + v''' % e2 + w''' % e3) + x) += (t2 * u' + t3 * u'' +t4 * u''') % e1 + (t2 * v'+t3*v''+ t4 * v''') % e2 + (t2 * w'+ t3 * w''+ t4 * w''') % e3 +(t1+t2+t3+t4) % x :real^3`;VECTOR_ARITH`((u' % e1 + v' % e2 + w' % e3) + x) - x=u' % e1 + v' % e2 + w' % e3`;CROSS_LMUL;CROSS_RMUL;CROSS_LADD;CROSS_RADD;CROSS_REFL;] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN FIND_ASSUM MP_TAC`orthonormal e1 e2 (e3:real^3)` +THEN REWRITE_TAC[orthonormal] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;DOT_LNEG] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN ABBREV_TAC`a1=vector[u':real;u'':real;u''':real]:real^3` +THEN ABBREV_TAC`a2=vector[v':real;v'':real;v''':real]:real^3` +THEN ABBREV_TAC`a3=vector[w':real;w'':real;w''':real]:real^3` +THEN ABBREV_TAC`A=vector[a1;a2;a3:real^3]:real^3^3` +THEN ABBREV_TAC`b=vector[u'''':real;v'''':real;w'''':real]:real^3` +THEN STRIP_TAC +THEN SUBGOAL_THEN`&0< det(A:real^3^3)`ASSUME_TAC +THENL[ +EXPAND_TAC"A" +THEN EXPAND_TAC "a1" +THEN EXPAND_TAC "a2" +THEN EXPAND_TAC "a3" +THEN REWRITE_TAC[DET_3;VECTOR_3] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +MP_TAC(REAL_ARITH`&0< det (A:real^3^3)==> ~(det A= &0)`) THEN RESA_TAC +THEN MRESA_TAC CRAMER[`A:real^3^3`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SWAP_FORALL_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`b:real^3`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[MESON[] + ` (!x. p(x) <=> x = a) <=> (?x. p(x)) /\ (!x. p(x) ==> x = a)`] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "LINH1") +THEN DISCH_THEN(LABEL_TAC "LINH2") +THEN REMOVE_THEN "LINH1" MP_TAC +THEN MRESAL_TAC MATRIX_VECTOR_MUL_COMPONENT[`A:real^3^3`;`x'':real^3`][DIMINDEX_3] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`1:num`[ARITH_RULE`1<=1/\ 1<=3`;LAMBDA_BETA;VECTOR_3] THEN ASSUME_TAC th) +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`2:num`[ARITH_RULE`1<=2/\ 2<=3`;VECTOR_3] THEN ASSUME_TAC th) +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3:num`[ARITH_RULE`1<=3/\ 3<=3`;VECTOR_3;]) +THEN DISCH_TAC +THEN POP_ASSUM(fun th -> MP_TAC th THEN ASSUME_TAC th) +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[VECTOR_3;CART_EQ;] +THEN REWRITE_TAC[DIMINDEX_3] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`1:num`[ARITH_RULE`1<=1/\ 1<=3`;DOT_SYM;] THEN ASSUME_TAC th) +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`2:num`[ARITH_RULE`1<=2/\ 2<=3`;DOT_SYM;] THEN ASSUME_TAC th) +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3:num`[ARITH_RULE`1<=3/\ 3<=3`;DOT_SYM;]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"A" +THEN EXPAND_TAC "a1" +THEN EXPAND_TAC "a2" +THEN EXPAND_TAC "a3" +THEN EXPAND_TAC "b" +THEN REWRITE_TAC[VECTOR_3;DOT_3] +THEN DISCH_THEN(LABEL_TAC"MA") +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`&1- (x'':real^3)$1 - x''$2 -x''$3` +THEN EXISTS_TAC`(x'':real^3)$1` +THEN EXISTS_TAC`(x'':real^3)$2` +THEN EXISTS_TAC`(x'':real^3)$3` +THEN ASM_REWRITE_TAC[REAL_ARITH` &1 - x''$1 - x''$2 - x''$3 + x''$1 + x''$2 + x''$3= &1`;VECTOR_ARITH`(u'''' % e1 + v'''' % e2 + w'''' % e3) + x = + u'''' % e1 + v'''' % e2 + w'''' % e3 + &1 % x`] +THEN REMOVE_THEN "MA" MP_TAC +THEN RESA_TAC +THEN MRESAL_TAC CRAMER_LEMMA1[`A:real^3^3`;`x'':real^3`;`3`][ARITH_RULE`1<=3/\ 3<=3`;DIMINDEX_3;] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN DISCH_THEN(LABEL_TAC"LINH3") +THEN ABBREV_TAC`b1=vector[u':real;u'':real;u'''':real]:real^3` +THEN ABBREV_TAC`b2=vector[v':real;v'':real;v'''':real]:real^3` +THEN ABBREV_TAC`b3=vector[w':real;w'':real;w'''':real]:real^3` +THEN ABBREV_TAC`B=vector[b1;b2;b3:real^3]:real^3^3` +THEN SUBGOAL_THEN`(lambda i j. if j = 3 then (b:real^3)$i else (A:real^3^3)$i$j):real^3^3=B` ASSUME_TAC +THENL[ONCE_ASM_SIMP_TAC[CART_EQ;] +THEN ONCE_ASM_SIMP_TAC[CART_EQ;] +THEN ASM_SIMP_TAC[LAMBDA_BETA;DIMINDEX_3] +THEN REPEAT STRIP_TAC +THEN COND_CASES_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`1<=i /\ i<= 3==> i=1 \/ i=2 \/ i=3`) +THEN RESA_TAC +THEN EXPAND_TAC"B" +THEN EXPAND_TAC "b1" +THEN EXPAND_TAC "b2" +THEN EXPAND_TAC "b3" +THEN EXPAND_TAC "b" +THEN MP_TAC(ARITH_RULE`1<=i' /\ i'<= 3/\ ~(i'=3)==> i'=1 \/ i'=2`) +THEN EXPAND_TAC "A" +THEN REWRITE_TAC[VECTOR_3] +THEN RESA_TAC +THEN EXPAND_TAC "b1" +THEN EXPAND_TAC "b2" +THEN EXPAND_TAC "b3" +THEN EXPAND_TAC "a3" +THEN EXPAND_TAC "a1" +THEN EXPAND_TAC "a2" +THEN REWRITE_TAC[VECTOR_3]; +REMOVE_THEN"LINH3" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`&0< det(B:real^3^3)`ASSUME_TAC +THENL[REMOVE_ASSUM_TAC +THEN EXPAND_TAC"B" +THEN EXPAND_TAC "b1" +THEN EXPAND_TAC "b2" +THEN EXPAND_TAC "b3" +THEN REWRITE_TAC[DET_3;VECTOR_3] +THEN REMOVE_THEN "ME" MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`((u' % e1 + v' % e2 + w' % e3) + x) - x=u' % e1 + v' % e2 + w' % e3`;CROSS_LMUL;CROSS_RMUL;CROSS_LADD;CROSS_RADD;CROSS_REFL;] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;DOT_LNEG] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`det (A:real^3^3)` +THEN MRESA1_TAC REAL_MUL_LINV`det (A:real^3^3)` +THEN MRESAL_TAC REAL_LT_MUL[`inv(det(A:real^3^3))`;`(x'':real^3)$3 * det(A:real^3^3)`][REAL_ARITH`A*(B*C)=(A*C)*B`;REAL_ARITH`&1*A=A`]]]]]);; + + + + + +let OPEN_AFF_GT_1_3=prove(`!x v u w:real^3. +~coplanar {x,v,u,w} +==> +open (aff_gt {x} {v,u,w})`, + + GEOM_ORIGIN_TAC `x:real^3` THEN + REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN DISCH_TAC THEN +MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] THEN DISCH_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_1_3[`vec 0:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC coplanar_cross_dot[`vec 0:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN MP_TAC (REAL_ARITH`~((v cross u) dot w = &0)==> &0< (v cross u) dot w \/ &0< --((v cross u) dot w)`) +THEN RESA_TAC +THENL[POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN DISCH_TAC THEN ASSUME_TAC th) THEN ASSUME_TAC th) +THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`][VECTOR_ARITH`A- vec 0=A`;] +THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`(vec 0):real^3`;`u:real^3`;`w:real^3`;`v:real^3`][VECTOR_ARITH`A- vec 0=A`;] +THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`(vec 0):real^3`;`w:real^3`;`v:real^3`;`u:real^3`][VECTOR_ARITH`A- vec 0=A`;] +THEN MATCH_MP_TAC OPEN_INTER +THEN REWRITE_TAC[REAL_ARITH`&0 A> &0`; OPEN_HALFSPACE_GT;] +THEN MATCH_MP_TAC OPEN_INTER +THEN REWRITE_TAC[ OPEN_HALFSPACE_GT;] ; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM DOT_LNEG] +THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] +THEN ASM_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN DISCH_TAC THEN ASSUME_TAC th) THEN ASSUME_TAC th) +THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`(vec 0):real^3`;`u:real^3`;`v:real^3`;`w:real^3`][VECTOR_ARITH`A- vec 0=A`;] +THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`(vec 0):real^3`;`w:real^3`;`u:real^3`;`v:real^3`][VECTOR_ARITH`A- vec 0=A`;] +THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`(vec 0):real^3`;`v:real^3`;`w:real^3`;`u:real^3`][VECTOR_ARITH`A- vec 0=A`;] +THEN MATCH_MP_TAC OPEN_INTER +THEN REWRITE_TAC[REAL_ARITH`&0 A> &0`; OPEN_HALFSPACE_GT;] +THEN MATCH_MP_TAC OPEN_INTER +THEN REWRITE_TAC[ OPEN_HALFSPACE_GT;] ]);; + + + +let OPEN_DIFF_AFF_GE=prove(`!x v u w:real^3. +open ((:real^3) DIFF (aff_ge {x} {v,u,w}))`, +REWRITE_TAC[OPEN_CLOSED;SET_RULE`(:real^3) DIFF ((:real^3) DIFF aff_ge {x} {v, u, w})= aff_ge {x} {v, u, w}`] +THEN REPEAT GEN_TAC +THEN MATCH_MP_TAC CLOSED_AFF_GE +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY]);; + + + +let aff_ge_1_3_eq_unions_aff_ge_1_2_and_aff_gt_1_3=prove(`!x v u w:real^3. +~coplanar {x,v,u,w} +==> +aff_ge {x} {v,u,w}= aff_ge {x} {v,u} UNION aff_ge {x} {u,w} UNION aff_ge {x} {w,v} UNION aff_gt {x} {v,u,w}`, +GEOM_ORIGIN_TAC `x:real^3` +THEN REPEAT STRIP_TAC +THEN MRESA_TAC notcoplanar_disjoints[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_disjoint[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC AFF_GE_1_2[`(vec 0):real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC AFF_GE_1_2[`(vec 0):real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC AFF_GE_1_2[`(vec 0):real^3`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC AFF_GT_1_3[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC AFF_GE_1_3[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC NOT_COPLANAR_0_4_IMP_INDEPENDENT[`v:real^3`;`u:real^3`;`w:real^3`] +THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM;UNION] +THEN REDUCE_VECTOR_TAC +THEN GEN_TAC +THEN EQ_TAC +THENL[ +STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0<= t2==> t2= &0 \/ &0< t2`) THEN RESA_TAC +THENL[ + +SUBGOAL_THEN ` (?t1 t2' t3'. + &0 <= t2' /\ + &0 <= t3' /\ + t1 + t2' + t3' = &1 /\ + &0 % v + t3 % u + t4 % w = t2' % u + t3' % w:real^3)` ASSUME_TAC +THENL[ +REDUCE_VECTOR_TAC +THEN EXISTS_TAC `t1:real` +THEN EXISTS_TAC `t3:real` +THEN EXISTS_TAC `t4:real` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[]]; + +MP_TAC(REAL_ARITH`&0<= t3==> t3= &0 \/ &0< t3`) THEN RESA_TAC +THENL[ +SUBGOAL_THEN ` (?t1 t2' t3'. + &0 <= t2' /\ + &0 <= t3' /\ + t1 + t2' + t3' = &1 /\ + t2 % v + &0 % u + t4 % w = t2' % w + t3' % v:real^3)` ASSUME_TAC +THENL[ +REDUCE_VECTOR_TAC +THEN EXISTS_TAC `t1:real` +THEN EXISTS_TAC `t4:real` +THEN EXISTS_TAC `t2:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t2 % v + t4 % w = t4 % w + t2 % v`] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[]]; + +MP_TAC(REAL_ARITH`&0<= t4 ==> t4= &0 \/ &0< t4`) THEN RESA_TAC +THENL[ +SUBGOAL_THEN ` (?t1 t2' t3'. + &0 <= t2' /\ + &0 <= t3' /\ + t1 + t2' + t3' = &1 /\ + t2 % v + t3 % u + &0 % w = t2' % v + t3' % u:real^3)` ASSUME_TAC +THENL[ +REDUCE_VECTOR_TAC +THEN EXISTS_TAC `t1:real` +THEN EXISTS_TAC `t2:real` +THEN EXISTS_TAC `t3:real` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[]]; +SUBGOAL_THEN ` (?t1 t2' t3' t4'. + &0 < t2' /\ + &0 < t3' /\ + &0 < t4' /\ + t1 + t2' + t3' + t4' = &1 /\ + t2 % v + t3 % u + t4 % w = t2' % v + t3' % u + t4' % w:real^3)` ASSUME_TAC +THENL[ REDUCE_VECTOR_TAC +THEN EXISTS_TAC `t1:real` +THEN EXISTS_TAC `t2:real` +THEN EXISTS_TAC `t3:real` +THEN EXISTS_TAC `t4:real` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[]]]]]; + +STRIP_TAC +THENL[ +EXISTS_TAC `t1:real` +THEN EXISTS_TAC `t2:real` +THEN EXISTS_TAC `t3:real` +THEN EXISTS_TAC `&0:real` +THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REAL_ARITH_TAC; + +EXISTS_TAC `t1:real` +THEN EXISTS_TAC `&0:real` +THEN EXISTS_TAC `t2:real` +THEN EXISTS_TAC `t3:real` +THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REAL_ARITH_TAC; + +EXISTS_TAC `t1:real` +THEN EXISTS_TAC `t3:real` +THEN EXISTS_TAC `&0:real` +THEN EXISTS_TAC `t2:real` +THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t2 % w + t3 % v = t3 % v + t2 % w:real^3`] +THEN ASM_TAC +THEN REAL_ARITH_TAC; + +EXISTS_TAC `t1:real` +THEN EXISTS_TAC `t2:real` +THEN EXISTS_TAC `t3:real` +THEN EXISTS_TAC `t4:real` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REAL_ARITH_TAC]]);; + + + + +let cut_aff_gt_1_3_connected=prove(`!x y z v u w:real^3 s:real^3->bool. + connected s /\ ~coplanar {x,v,u,w} + /\ y IN s /\ z IN s /\ y IN aff_gt {x} {v,u,w} /\ ~(z IN aff_gt {x} {v,u,w}) + ==> ?t. t IN s /\ t IN aff_ge {x} {v,u} UNION aff_ge {x} {u,w} UNION aff_ge {x} {w,v}`, + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [connected]) THEN + REWRITE_TAC[NOT_EXISTS_THM] THEN DISCH_THEN(MP_TAC o SPECL + [`aff_gt {x} {v,u,w:real^3}`; `(:real^3) DIFF (aff_ge {x} {v,u,w})`]) +THEN MRESA_TAC OPEN_AFF_GT_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] + THEN REWRITE_TAC[ OPEN_DIFF_AFF_GE] THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] +THEN STRIP_TAC +THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_INTER; NOT_IN_EMPTY; SUBSET; + IN_UNION; ] +THEN MRESA_TAC aff_ge_1_3_eq_unions_aff_ge_1_2_and_aff_gt_1_3 +[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_EXISTS_THM;UNION;DIFF;IN_ELIM_THM;DE_MORGAN_THM] +THEN DISCH_THEN (LABEL_TAC"A") +THEN STRIP_TAC +THENL[ +REPEAT STRIP_TAC +THEN REMOVE_THEN "A"(fun th -> MRESA1_TAC th`x':real^3`) +THEN SET_TAC[]; +STRIP_TAC +THENL[ + +REPEAT STRIP_TAC +THEN REMOVE_THEN "A"(fun th -> MRESA1_TAC th`x':real^3`) +THEN SET_TAC[]; + +STRIP_TAC +THENL[ +ASM_MESON_TAC[]; +REWRITE_TAC[NOT_FORALL_THM;DE_MORGAN_THM] +THEN EXISTS_TAC`z:real^3` +THEN REMOVE_THEN "A"(fun th -> MRESA1_TAC th`z:real^3`) +THEN SET_TAC[]]]]);; + + + + + + +let AFF_GE_SUBSET_XFAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) u:real^3 w:real^3. + {u,w} IN E +==> +aff_ge {x} {u,w} SUBSET xfan(x:real^3,V:real^3->bool,E)`, +ASM_REWRITE_TAC[xfan; SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`{u,w:real^3}` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN SET_TAC[IN]);; + + +let notcoplanar_4point_aff_gt_3_1_not_empty=prove(`!x v u w:real^3. +~coplanar {x,v,u,w} +==> ~(aff_gt {x,v,u} {w} INTER aff_gt {x,u,w} {v} INTER aff_gt {x,w,v} {u} = {})`, +REWRITE_TAC[SET_RULE`~(A={})<=> ?y. y IN A`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN DISCH_TAC THEN +MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] THEN DISCH_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC coplanar_cross_dot[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MP_TAC(REAL_ARITH` ~(((v - x) cross (u - x)) dot (w - x) = &0) +==> &0 <((v - x) cross (u - x)) dot (w - x) \/ &0< --(((v - x) cross (u - x)) dot (w - x)) `) +THEN RESA_TAC +THENL[ +POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN DISCH_TAC THEN ASSUME_TAC th) THEN ASSUME_TAC th) +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`u:real^3`;`w:real^3`;`v:real^3`] +THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`][INTER; IN_ELIM_THM] +THEN EXISTS_TAC`&1/ &3 % v + &1/ &3 % u+ &1/ &3 % w:real^3` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(&1 / &3 % v + &1 / &3 % u + &1 / &3 % w) - x= &1 / &3 % (v-x) + &1 / &3 % (u-x) + &1 / &3 % (w - x)`;DOT_RADD;DOT_RMUL;DOT_CROSS_SELF] +THEN REDUCE_ARITH_TAC +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1/ &3`] ; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM DOT_LNEG] +THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN DISCH_TAC THEN ASSUME_TAC th) THEN ASSUME_TAC th) +THEN ASM_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`u:real^3`;`v:real^3`] +THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`w:real^3`;`u:real^3`][INTER; IN_ELIM_THM] +THEN EXISTS_TAC`&1/ &3 % v + &1/ &3 % u+ &1/ &3 % w:real^3` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(&1 / &3 % v + &1 / &3 % u + &1 / &3 % w) - x= &1 / &3 % (v-x) + &1 / &3 % (u-x) + &1 / &3 % (w - x)`;DOT_RADD;DOT_RMUL;DOT_CROSS_SELF] +THEN REDUCE_ARITH_TAC +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1/ &3`]]) ;; + + +let notcoplanar_4point_aff_gt_1_3_not_empty=prove(`!x v u w:real^3. +~coplanar {x,v,u,w} +==> ~(aff_gt {x} {v,u,w} = {})`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN SET_TAC[notcoplanar_4point_aff_gt_3_1_not_empty]);; + + +let KVQWYDL_lemma1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {w,v} IN E +/\ sigma_fan x V E u w = v +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +==> aff_gt{x} {v,u,w} = dart_leads_into x V E u w`, +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MATCH_MP_TAC (SET_RULE`A SUBSET B /\ B SUBSET A==> A=B`) +THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;` w:real^3`] +THEN MATCH_MP_TAC (SET_RULE`~(?z. z IN A /\ ~(z IN B))==> A SUBSET B`) +THEN STRIP_TAC +THEN MRESA_TAC connected_dart_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` u:real^3`;` w:real^3`] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC notcoplanar_4point_aff_gt_1_3_not_empty[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][SET_RULE`~(A={})<=> ?y. y IN A`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`aff_gt {x} {v, u, w} SUBSET dart_leads_into x V E u w /\ y IN aff_gt {x} {v, u, w} +==> y IN dart_leads_into x V E u w `) +THEN RESA_TAC +THEN MRESA_TAC cut_aff_gt_1_3_connected[`x:real^3`;`y:real^3`;`z:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`(dart_leads_into x V E u w):real^3->bool`] +THEN MRESA_TAC dart_leads_into_fan_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC topological_component_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (dart_leads_into x V E u w):real^3->bool`] +THEN MP_TAC (SET_RULE`t IN dart_leads_into x V E u w /\ dart_leads_into x V E u w SUBSET yfan (x,V,E) +==>t IN yfan (x,V,E)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[yfan] +THEN MRESA_TAC AFF_GE_SUBSET_XFAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC AFF_GE_SUBSET_XFAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC AFF_GE_SUBSET_XFAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`] +THEN ASM_TAC +THEN SET_TAC[]);; + + + + + +let point_in_yfan_is_not_inv_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool z:real^3 u:real^3. +FAN(x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ U IN topological_component_yfan (x,V,E) +/\ z IN U +/\ u IN V +==> ~(u=z)`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC nonsetedge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC zpoint_in_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`; `z:real^3`;] +THEN MRESA_TAC v_subset_xfan[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`] +THEN ASM_TAC THEN REWRITE_TAC[yfan] +THEN SET_TAC[]);; + + + + +let point_in_aff_ge_1_1=prove(`!(x:real^3) (v:real^3). +~(x=v) +==> +x IN aff_ge {x} {v} +/\ v IN aff_ge {x} {v}`, + +REPEAT GEN_TAC THEN STRIP_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`]AFF_GE_1_1) +THEN RESA_TAC + THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THENL[ EXISTS_TAC`&1:real` +THEN EXISTS_TAC`&0:real` +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC; + + EXISTS_TAC`&0:real` +THEN EXISTS_TAC`&1:real` +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC]);; + + + +let POINT_IN_AFF_GE_IMP_IN_EDGE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 u1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ u1 IN V /\ ~(x=u1) +/\ u1 IN aff_ge {x} {v,u} +==> u1 IN {v,u}`, + +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC aff_ge_1_1_subset_aff_ge_fan[`x:real^3`;`v:real^3`;`u:real^3`;`u1:real^3`] +THEN MP_TAC(SET_RULE`aff_ge {x} {u1} SUBSET aff_ge {x} {v, u}==> +aff_ge {x} {u1} INTER aff_ge {x} {v, u:real^3}=aff_ge {x} {u1}`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`?v. v IN V /\ {u1} = {v:real^3} <=> u1 IN V`) +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN FIND_ASSUM MP_TAC `FAN(x:real^3,V,E)` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`{u1:real^3}`;`{v,u:real^3}`][UNION;IN_ELIM_THM;]) +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`{u1} INTER {v,u:real^3}= {}\/ u1 IN {v, u}`) +THENL [ASM_REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_1;SET_RULE`{u % x| u= &1} ={&1 %x}`; VECTOR_ARITH`&1 %X=X`] +THEN STRIP_TAC +THEN MRESAL_TAC point_in_aff_ge_1_1[`(x:real^3)`;`(u1:real^3) `][IN_SING]; +ASM_REWRITE_TAC[]]);; + + + + + + + +let POINT_IN_CLOSURE_AFF_GT_1_2=prove(`!x:real^3 v:real^3 u:real^3. +~(x=v) /\ ~(x=u) /\ ~(v=u) +==> v IN closure(aff_gt {x} {v,u})`, +REPEAT GEN_TAC +THEN GEOM_ORIGIN_TAC `x:real^3` +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`~((vec 0:real^3) =v) /\ ~((vec 0:real^3)=u) /\ ~(v=u:real^3) ==> DISJOINT {vec 0} {v,u}/\ ~(u=v)`) THEN RESA_TAC +THEN MRESAL_TAC AFF_GT_1_2[`vec 0:real^3`;`v:real^3`;`u:real^3`][CLOSURE_APPROACHABLE;IN_ELIM_THM;dist] +THEN REDUCE_VECTOR_TAC +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`t3=min (inv(norm(u-v:real^3)) * e) (&1)/ &2:real` +THEN ABBREV_TAC`t2= &1- t3:real` +THEN MRESA_TAC IMP_NORM_FAN[`u:real^3`;`v:real^3`] +THEN MRESA_TAC REAL_LT_MUL[`inv (norm (u - v:real^3))`;`e:real`] +THEN MP_TAC(REAL_ARITH`&0 < inv (norm (u - v:real^3)) * e /\ t3=min (inv(norm(u-v:real^3)) * e) (&1)/ &2 +==> &0<= t3/\ &0< t3 /\ t3< &1 /\ &0< &1- t3 /\ t3< inv (norm (u - v:real^3)) * e `) THEN RESA_TAC +THEN MRESA1_TAC REAL_ABS_REFL`t3:real` +THEN MRESAL_TAC REAL_LT_LMUL[`norm (u - v:real^3)`;`t3:real`;`inv (norm (u - v:real^3)) * e:real`][REAL_ARITH`A*B*C=(B*A)*C`] +THEN EXISTS_TAC`t2%v +t3 % u:real^3` +THEN STRIP_TAC +THENL[ +EXISTS_TAC`&0` +THEN EXISTS_TAC `t2:real` +THEN EXISTS_TAC `t3:real` +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC "t2" +THEN REAL_ARITH_TAC; +EXPAND_TAC "t2" +THEN REWRITE_TAC[VECTOR_ARITH`((&1 - t3) % v + t3 % u) - v=t3% (u-v)`;NORM_MUL] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]);; + + + + +let KVQWYDL_lemma2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 u1:real^3 w1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {w,v} IN E /\ {u1,w1} IN E +/\ sigma_fan x V E u w = v +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ aff_gt{x} {v,u,w} = dart_leads_into x V E u1 w1 +==> u1 IN {v,u,w}`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC not_empty_rw_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u1:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC DART_LEADS_INTO[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`u1:real^3`;`w1:real^3`;] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC rw_dart_avoids_fan[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u1:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"OI") +THEN MP_TAC(REAL_ARITH`&1> h' /\ h' > &0==> -- &1 < h' /\ h'< &1 /\ -- &1 <= h' /\ h'<= &1/\ &0 < h' /\ h' <= &1`) THEN RESA_TAC +THEN MRESA1_TAC ACS_BOUNDS_LT`h':real` +THEN MRESAL_TAC ACS_MONO_LT[`&0`;`h':real`][ACS_0;REAL_ARITH`-- &1 <= &0`] +THEN MRESA1_TAC COS_ACS `h':real` +THEN ABBREV_TAC`h1= min (h:real) (acs h')/ &2` +THEN MP_TAC(REAL_ARITH`h1= min (h:real) (acs h')/ &2 /\ &0 &0< h1 /\ h1< h /\ h1 h'<= cos h1`) THEN RESA_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESAL1_TAC th `h1:real`[SET_RULE`~(A={})<=> ?y. y IN A`]) +THEN REMOVE_THEN "YEU"(fun th-> MRESA_TAC th [`h1:real`;`y:real^3`]) +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u1:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u1:real^3`;`w1:real^3`] +THEN DISCH_TAC +THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u1:real^3`;`sigma_fan x V E u1 w1:real^3`] +THEN MRESA_TAC aff_gt_in_rw_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`sigma_fan x V E u1 w1:real^3`;`u1:real^3`;`w1:real^3`;`y:real^3`;`h1:real`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (u1:real^3)`] +THEN MRESA_TAC dart_leads_into_fan_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`u1:real^3`;`w1:real^3`] +THEN MP_TAC (SET_RULE`y IN rw_dart_fan x V E (x,u1,w1,sigma_fan x V E u1 w1) (cos h1) +/\ rw_dart_fan x V E (x,u1,w1,sigma_fan x V E u1 w1) (cos h1) SUBSET + dart_leads_into x V E u1 w1 +==> y IN dart_leads_into x V E u1 w1`) +THEN RESA_TAC +THEN MRESA_TAC point_in_yfan_is_not_inv_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `(dart_leads_into x V E u1 w1):real^3->bool`;`y:real^3`;`u1:real^3`] +THEN MRESA_TAC nonsetedge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(dart_leads_into x V E u1 w1):real^3->bool`;` y:real^3`] +THEN DISCH_THEN(fun th-> ASSUME_TAC (SYM th)) +THEN MP_TAC (SET_RULE`aff_gt {x} {u1, y} SUBSET + rw_dart_fan x V E (x,u1,w1,sigma_fan x V E u1 w1) (cos h1) +/\ aff_gt {x} {v, u, w} = dart_leads_into x V E u1 w1 +/\ rw_dart_fan x V E (x,u1,w1,sigma_fan x V E u1 w1) (cos h1) SUBSET + dart_leads_into x V E u1 w1 +==> aff_gt {x} {u1, y} SUBSET aff_gt {x} {v, u, w}`) +THEN RESA_TAC +THEN MRESA_TAC aff_ge_1_3_eq_unions_aff_ge_1_2_and_aff_gt_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MP_TAC (SET_RULE`aff_gt {x} {u1, y} SUBSET aff_gt {x} {v, u, w} +/\ aff_ge {x} {v, u, w} = + aff_ge {x} {v, u} UNION + aff_ge {x} {u, w} UNION + aff_ge {x} {w, v} UNION + aff_gt {x} {v, u, w:real^3} +==> aff_gt {x} {u1, y} SUBSET aff_ge {x} {v, u, w}`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN RESA_TAC +THEN SUBGOAL_THEN`closed (aff_ge {x:real^3} {v, u, w})` ASSUME_TAC +THENL[MATCH_MP_TAC CLOSED_AFF_GE +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY]; +MRESA1_TAC CLOSURE_EQ`aff_ge {x:real^3} {v, u, w}` +THEN MRESA_TAC SUBSET_CLOSURE[`aff_gt {x} {u1, y:real^3}`;`aff_ge {x:real^3} {v, u, w}`] +THEN MRESA_TAC POINT_IN_CLOSURE_AFF_GT_1_2[`x:real^3`;`u1:real^3`;`y:real^3`] +THEN MP_TAC (SET_RULE`u1 IN closure(aff_gt {x} {u1, y}) +/\ closure (aff_gt {x} {u1, y}) SUBSET aff_ge {x} {v, u, w} +==> u1 IN aff_ge {x} {v, u, w:real^3}`) +THEN ASM_REWRITE_TAC[] + THEN MRESA_TAC aff_ge_1_3_eq_unions_aff_ge_1_2_and_aff_gt_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESAL_TAC topological_component_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (dart_leads_into x V E u1 w1):real^3->bool`][yfan] +THEN MRESA_TAC v_subset_xfan[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`aff_gt {x} {v, u, w} SUBSET (:real^3) DIFF xfan (x,V,E) /\ + V SUBSET xfan (x,V,E) +/\ u1 IN V +/\ u1 IN + aff_ge {x} {v, u} UNION + aff_ge {x} {u, w} UNION + aff_ge {x} {w, v} UNION + aff_gt {x} {v, u, w} +==> u1 IN + aff_ge {x} {v, u} UNION + aff_ge {x} {u, w} UNION + aff_ge {x} {w, v} `) +THEN ASM_REWRITE_TAC[UNION;IN_ELIM_THM] +THEN STRIP_TAC +THENL[ +MRESA_TAC POINT_IN_AFF_GE_IMP_IN_EDGE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`; `u:real^3`;`u1:real^3`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[];MRESA_TAC POINT_IN_AFF_GE_IMP_IN_EDGE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`; `w:real^3`;`u1:real^3`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; +MRESA_TAC POINT_IN_AFF_GE_IMP_IN_EDGE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`; `v:real^3`;`u1:real^3`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]]);; + + + + +let DISJOINT_RW_DART_FAN_SAME_NODE_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 h1:real h2:real. +FAN(x,V,E)/\ {u,w} IN E /\ {u,w1} IN E/\ ~(w=w1) +==> rw_dart_fan x V E (x,u,w,sigma_fan x V E u w) (cos h1) +INTER rw_dart_fan x V E (x,u,w1,sigma_fan x V E u w1) (cos h2)= {}`, +REPEAT STRIP_TAC +THEN MRESA_TAC disjoint_fan2[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(u:real^3)`;`(w:real^3)`;` (w1:real^3)`] +THEN REWRITE_TAC[rw_dart_fan] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + + + +let condition_unique_by_dart_leads_into=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) w:real^3 u:real^3 w1:real^3. +FAN(x,V,E)/\ {u,w} IN E /\ {u,w1} IN E +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ dart_leads_into x V E u w SUBSET w_dart_fan x V E (x,u,w,sigma_fan x V E u w) +/\ dart_leads_into x V E u w = dart_leads_into x V E u w1 +==> w= w1`, + +REPEAT STRIP_TAC +THEN MRESA_TAC not_empty_rw_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC DART_LEADS_INTO[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`u:real^3`;`w1:real^3`;] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC rw_dart_avoids_fan[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"OI") +THEN MP_TAC(REAL_ARITH`&1> h' /\ h' > &0==> -- &1 < h' /\ h'< &1 /\ -- &1 <= h' /\ h'<= &1/\ &0 < h' /\ h' <= &1`) THEN RESA_TAC +THEN MRESA1_TAC ACS_BOUNDS_LT`h':real` +THEN MRESAL_TAC ACS_MONO_LT[`&0`;`h':real`][ACS_0;REAL_ARITH`-- &1 <= &0`] +THEN MRESA1_TAC COS_ACS `h':real` +THEN ABBREV_TAC`h1= min (h:real) (acs h')/ &2` +THEN MP_TAC(REAL_ARITH`h1= min (h:real) (acs h')/ &2 /\ &0 &0< h1 /\ h1< h /\ h1 h'<= cos h1`) THEN RESA_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESAL1_TAC th `h1:real`[SET_RULE`~(A={})<=> ?y. y IN A`]) +THEN POP_ASSUM (fun th-> MP_TAC th THEN REWRITE_TAC[rw_dart_fan] THEN STRIP_TAC THEN ASSUME_TAC th) +THEN REMOVE_THEN "YEU"(fun th-> MRESA_TAC th [`h1:real`;`y:real^3`]) +THEN MP_TAC(SET_RULE` dart_leads_into x V E u w SUBSET w_dart_fan x V E (x,u,w,sigma_fan x V E u w) +/\ dart_leads_into x V E u w = dart_leads_into x V E u w1 +/\ rw_dart_fan x V E (x,u,w1,sigma_fan x V E u w1) (cos h1) SUBSET + dart_leads_into x V E u w1 +/\ y IN rw_dart_fan x V E (x,u,w1,sigma_fan x V E u w1) (cos h1) +/\ y IN + w_dart_fan x V E (x,u,w1,sigma_fan x V E u w1) INTER + rcone_fan x u (cos h1) +==> ~(w_dart_fan x V E (x,u,w,sigma_fan x V E u w) INTER w_dart_fan x V E (x,u,w1,sigma_fan x V E u w1) ={})`) +THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(w=w1:real^3)\/ w=w1`) +THENL[ +MRESA_TAC disjoint_fan2[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(u:real^3)`;`(w:real^3)`;` (w1:real^3)`]; +ASM_REWRITE_TAC[]]);; + + + +let PROPERTIES_TRIANGLE_FAN_lemma1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {w,v} IN E +/\ sigma_fan x V E u w = v +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +==> sigma_fan x V E v u = w `, + +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (u:real^3)`] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`u IN set_of_edge v V E /\ w IN set_of_edge v V E /\ ~(u=w)==> ~( set_of_edge v V E= {u:real^3}) `) +THEN RESA_TAC +THEN MATCH_MP_TAC UNIQUE_SIGMA_FAN +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `w1:real^3`) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC angle_is_small_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC);; + + +let PROPERTIES_TRIANGLE_FAN_lemma2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {w,v} IN E +/\ sigma_fan x V E u w = v +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +==> sigma_fan x V E w v=u`, +REPEAT STRIP_TAC +THEN MRESA_TAC PROPERTIES_TRIANGLE_FAN_lemma1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`] +THEN MRESA_TAC PROPERTIES_TRIANGLE_FAN_lemma1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`; `u:real^3`]);; + + +let PROPERTIES_TRIANGLE_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {w,v} IN E +/\ sigma_fan x V E u w = v +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +==> sigma_fan x V E v u = w/\ sigma_fan x V E w v=u`, +MESON_TAC[PROPERTIES_TRIANGLE_FAN_lemma1; PROPERTIES_TRIANGLE_FAN_lemma2]);; + + + + + +let inter_aff_gt_3_1_is_aff_gt_2_2=prove(`!x v u w:real^3. +~coplanar {x,v,u,w} +==> +aff_gt {x,v,u} {w} INTER aff_gt {x,u,w} {v} =aff_gt {x,u} {v,w}`, +GEOM_ORIGIN_TAC `x:real^3` +THEN REPEAT STRIP_TAC +THEN MRESA_TAC notcoplanar_disjoints[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_disjoint[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC AFF_GT_3_1[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC AFF_GT_3_1[`(vec 0):real^3`;`u:real^3`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC AFF_GT_2_2[`(vec 0):real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC NOT_COPLANAR_0_4_IMP_INDEPENDENT[`v:real^3`;`u:real^3`;`w:real^3`] +THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM;INTER] +THEN REDUCE_VECTOR_TAC +THEN GEN_TAC +THEN EQ_TAC +THENL[ +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t2 % v + t3 % u + t4 % w = t2' % u + t3' % w + t4' % v <=> (t2-t4') % v + (t3-t2') % u + (t4-t3') % w= vec 0`] +THEN STRIP_TAC +THEN MRESAL_TAC INDEPENDENT_3[`v:real^3`;`u:real^3`;`w:real^3`;`t2-t4':real`; `t3-t2':real`; `t4 -t3':real`][REAL_ARITH`A-B= &0<=> A=B`] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`t1':real` +THEN EXISTS_TAC`t2':real` +THEN EXISTS_TAC`t4':real` +THEN EXISTS_TAC`t3':real` +THEN ASM_REWRITE_TAC[REAL_ARITH`t1+t2+t3+t4=t1+t2+t4+t3:real`;VECTOR_ARITH`t4' % v + t2' % u + t3' % w = t2' % u + t4' % v + t3' % w:real^3`] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THEN STRIP_TAC +THENL[ +EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t3:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t4:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t2 % u + t3 % v + t4 % w = t3 % v + t2 % u + t4 % w:real^3`;REAL_ARITH`t1 + t3 + t2 + t4=t1 + t2 + t3 + t4`]; +EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t4:real` +THEN EXISTS_TAC`t3:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`t1 + t2 + t4+ t3:real=t1 + t2 + t3 + t4`] +THEN VECTOR_ARITH_TAC]]);; + + + + + + +let condition_edge_in_face_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 u1:real^3 w1:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {w,v} IN E /\ {u1,w1} IN E +/\ sigma_fan x V E u w = v +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ u1=v +/\ aff_gt{x} {v,u,w} = dart_leads_into x V E u1 w1 +==> (u1,w1) IN {(v,u),(u,w),(w,v)}`, + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC "EM") +THEN DISCH_THEN (LABEL_TAC "YEU") +THEN SUBGOAL_THEN`u=w1:real^3`ASSUME_TAC +THENL[ +MATCH_MP_TAC condition_unique_by_dart_leads_into +THEN EXISTS_TAC `x:real^3` +THEN EXISTS_TAC `V:real^3->bool` +THEN EXISTS_TAC `E:(real^3->bool)->bool` +THEN EXISTS_TAC `v:real^3` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL[ REMOVE_THEN "EM"(fun th-> ASM_REWRITE_TAC[SYM th]); + STRIP_TAC +THENL[ + +MRESA_TAC PROPERTIES_TRIANGLE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;` w:real^3`] +THEN MRESA_TAC KVQWYDL_lemma1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`; `u:real^3`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`; +` (v:real^3)`] +THEN FIND_ASSUM MP_TAC`(!v:real^3. v IN V==>CARD (set_of_edge v V E) >1)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MP_TAC(ISPEC `v:real^3` th) THEN FIND_ASSUM MP_TAC `(v:real^3) IN V` THEN DISCH_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN STRIP_TAC) +THEN ASM_REWRITE_TAC[w_dart_fan] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`; +` (w:real^3)`] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u:real^3`] THEN MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM")) +THEN MRESA_TAC WEDGE_LUNE_GT[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN DISCH_TAC THEN MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] THEN DISCH_TAC THEN ASSUME_TAC th) +THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_2_2[`x:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_1_3[`x:real^3`;`w:real^3`;`u:real^3`;`v:real^3`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN SET_TAC[]; +REMOVE_THEN "YEU" MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC PROPERTIES_TRIANGLE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;` w:real^3`] +THEN MRESA_TAC KVQWYDL_lemma1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`; `u:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])]]; + +ASM_REWRITE_TAC[] +THEN SET_TAC[]]);; + + +let KVQWYDL_lemma3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 w:real^3 u1 w1. +FAN(x,V,E)/\ {v,u} IN E /\ {u,w} IN E /\ {w,v} IN E /\ {u1,w1} IN E +/\ sigma_fan x V E u w = v +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ aff_gt{x} {v,u,w} = dart_leads_into x V E u1 w1 +==> (u1,w1) IN {(v,u),(u,w),(w,v)}`, + +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,C,A}`] THEN DISCH_TAC +THEN MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] THEN DISCH_TAC +THEN ASSUME_TAC th) +THEN MRESA_TAC KVQWYDL_lemma2 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`u1:real^3`;` w1:real^3`] +THEN MRESA_TAC PROPERTIES_TRIANGLE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;` w:real^3`] +THEN MP_TAC(SET_RULE`u1 IN {v, u, w}==> u1=v \/ u1= u \/ u1=w:real^3`) +THEN RESA_TAC +THENL[ +MRESA_TAC condition_edge_in_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`; `u:real^3`;`w:real^3`;`u1:real^3`;`w1:real^3`]; +MRESA_TAC condition_edge_in_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `u:real^3`;`w:real^3`;`v:real^3`;`u1:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; +MRESA_TAC condition_edge_in_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `w:real^3`;`v:real^3`;`u:real^3`;`u1:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]);; + + + + + +let CARD_3=prove(`!e:A->bool. + CARD e=3 /\ FINITE e +==> ?v u w:A. e={v,u,w} /\ ~(v=u)/\ ~(u=w) /\ ~(w=v)`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN `~((e:A->bool)={})` ASSUME_TAC +THENL[ +STRIP_TAC +THEN MP_TAC(ISPEC`(e:A->bool)`CARD_EQ_0) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; + +MP_TAC(SET_RULE `~((e:A->bool)={})==> ?v:A. v IN e`) +THEN RESA_TAC +THEN SUBGOAL_THEN`~((e:A->bool) DELETE v={})` ASSUME_TAC +THENL[ +STRIP_TAC +THEN MP_TAC(ISPECL[`v:A`;`(e:A->bool)`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(e:A->bool)`;`v:A`] FINITE_DELETE) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(e:A->bool) DELETE v`CARD_EQ_0) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MP_TAC(SET_RULE `~((e:A->bool)DELETE v={})==> ?w:A. w IN (e:A->bool)DELETE v/\ w IN e`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `(w IN (e:A->bool)DELETE v)==> ~(v=w)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`~((e:A->bool) DELETE v DELETE w ={})` ASSUME_TAC +THENL[ +STRIP_TAC +THEN MP_TAC(ISPECL[`v:A`;`(e:A->bool)`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(e:A->bool)`;`v:A`] FINITE_DELETE) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`w:A`;`(e:A->bool) DELETE v`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(e:A->bool) DELETE v`;`w:A`] FINITE_DELETE) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(e:A->bool) DELETE v DELETE w`CARD_EQ_0) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MP_TAC(SET_RULE `~((e:A->bool) DELETE v DELETE w={})==> ?u:A. u IN ((e:A->bool)DELETE v DELETE w)/\ u IN e`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `(v IN (e:A->bool))/\ (w IN (e:A->bool)) /\ (u IN (e:A->bool))==> {v,w,u} SUBSET e`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `(u IN (e:A->bool)DELETE v DELETE w)==> ~(u=v)/\ ~(w=u)`) +THEN RESA_TAC +THEN SUBGOAL_THEN(`CARD {v:A,w,u}=3`)ASSUME_TAC +THENL[ +SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] + +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + + +POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`CARD (e:A->bool)=3` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`{v:A,w,u}`;`e:A->bool`]CARD_SUBSET_EQ) +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) +THEN RESA_TAC +THEN EXISTS_TAC`v:A` +THEN EXISTS_TAC`w:A` +THEN EXISTS_TAC`u:A` +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) +THEN ASM_TAC +THEN SET_TAC[]]]]]);; + + +let FINITE_FACE_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> FINITE ds `, +REPEAT STRIP_TAC +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC finite_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`] +THEN MRESA_TAC FINITE_SUBSET[`ds:real^3#real^3#real^3#real^3->bool`;`d_fan (x:real^3, V:real^3->bool, (E:(real^3->bool)->bool))`]);; + + + +let condition_f1_fan_in_face_set=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) y y1 ds. +FAN(x,V,E) +/\ y = f1_fan x V E y1 +/\ ds IN face_set (hypermap1_of_fanx (x,V,E)) +/\ d_fan (x,V,E) =d1_fan (x,V,E) +/\ y1 IN ds +==> y IN ds`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC lemma_face_representation[`hypermap1_of_fanx(x:real^3,V,E)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN ASM_REWRITE_TAC[face; orbit_map;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`n:num`;`( \ t. res (t x V E ) (d1_fan (x:real^3, V:real^3->bool, (E:(real^3->bool)->bool))))`] + +THEN POP_ASSUM (fun th-> MRESA1_TAC th `x':real^3#real^3#real^3#real^3`) +THEN STRIP_TAC +THEN EXISTS_TAC`SUC n:num` +THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`SUC n:num`;`( \ t. res (t x V E ) (d1_fan (x:real^3, V:real^3->bool, (E:(real^3->bool)->bool))))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th `x':real^3#real^3#real^3#real^3`) +THEN REWRITE_TAC[COM_POWER;o_DEF] +THEN ASM_TAC +THEN ARITH_TAC);; + + + +let CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +==> 3<= CARD ds`, + +REPEAT STRIP_TAC +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC lemma_face_representation[`hypermap1_of_fanx(x:real^3,V,E)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN SUBGOAL_THEN`x' IN ds:real^3#real^3#real^3#real^3->bool` ASSUME_TAC + +THENL (*1*)[ +ASM_REWRITE_TAC[face;orbit_map;IN_ELIM_THM;] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC;(*1*) +ABBREV_TAC`y=f1_fan x V E (x':real^3#real^3#real^3#real^3)` +THEN MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(y:real^3#real^3#real^3#real^3)` ;`(x':real^3#real^3#real^3#real^3)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN ABBREV_TAC`y1=f1_fan x V E (y:real^3#real^3#real^3#real^3)` +THEN MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(y1:real^3#real^3#real^3#real^3)` ;`(y:real^3#real^3#real^3#real^3)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC f_fan_no_fix_point[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(x':real^3#real^3#real^3#real^3)` +THEN MP_TAC(SET_RULE`y IN face (hypermap1_of_fanx (x,V,E)) x'/\ face (hypermap1_of_fanx (x,V,E)) x' SUBSET d1_fan (x,V,E)==> y IN d1_fan (x,V,E)`) THEN RESA_TAC +THEN MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`) +THEN DISJ_CASES_TAC(SET_RULE`y1=x' \/ ~(y1=x':real^3#real^3#real^3#real^3)`) +THENL(*2*)[ +MP_TAC(SET_RULE`x'=y1:real^3#real^3#real^3#real^3==> pr2 x'= pr2 y1`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(y1:real^3#real^3#real^3#real^3)` ;`(y:real^3#real^3#real^3#real^3)`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(y:real^3#real^3#real^3#real^3)` ;`(x':real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` pr2 (y1:real^3#real^3#real^3#real^3)`; +` pr2 (y:real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge (pr2 (y:real^3#real^3#real^3#real^3)) V E = {pr2 y1} \/ ~(set_of_edge (pr2 (y:real^3#real^3#real^3#real^3)) V E = {pr2 y1})`) +THENL(*3*)[ +MRESA_TAC CARD_SING[`(pr2 y1):real^3`; `(set_of_edge (pr2 (y:real^3#real^3#real^3#real^3)) V E):real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) +THEN FIND_ASSUM (fun th -> MP_TAC(ISPEC `(pr2 (y:real^3#real^3#real^3#real^3))` th))`(!v:real^3. v IN V==>CARD (set_of_edge v V E) >1)` +THEN FIND_ASSUM (fun th-> REWRITE_TAC[th])`(pr2 (y:real^3#real^3#real^3#real^3)) IN V` +THEN ARITH_TAC;(*3*) +MRESA_TAC SIGMA_FAN [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` pr2 (y:real^3#real^3#real^3#real^3)`; +` pr2 (y1:real^3#real^3#real^3#real^3)`] +THEN ASM_TAC THEN SET_TAC[]](*2*); +MP_TAC(SET_RULE`x' IN ds /\ y IN ds /\ y1 IN ds==> {x',y,y1:real^3#real^3#real^3#real^3} SUBSET ds`) +THEN RESA_TAC +THEN SUBGOAL_THEN(`CARD {x',y,y1:real^3#real^3#real^3#real^3}=3`)ASSUME_TAC +THENL(*3*)[SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] + +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + + MRESA_TAC FINITE_FACE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC CARD_SUBSET[`{x',y,y1:real^3#real^3#real^3#real^3}`; `ds:real^3#real^3#real^3#real^3->bool`] +]]]);; + + + + + + + + + +let CARD_FACE_SET_EQ_3_FULLY_SURROUNDED_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ CARD ds =3 +==> ?f1 f2 f3. ds={f1,f2,f3}/\ f2=f1_fan x V E f1 /\ f3=f1_fan x V E f2 `, + + +REPEAT STRIP_TAC +THEN MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC lemma_face_representation[`hypermap1_of_fanx(x:real^3,V,E)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN SUBGOAL_THEN`x' IN ds:real^3#real^3#real^3#real^3->bool` ASSUME_TAC + +THENL (*1*)[ +ASM_REWRITE_TAC[face;orbit_map;IN_ELIM_THM;] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[POWER;I_DEF] +THEN ARITH_TAC;(*1*) +ABBREV_TAC`y=f1_fan x V E (x':real^3#real^3#real^3#real^3)` +THEN MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(y:real^3#real^3#real^3#real^3)` ;`(x':real^3#real^3#real^3#real^3)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN ABBREV_TAC`y1=f1_fan x V E (y:real^3#real^3#real^3#real^3)` +THEN MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(y1:real^3#real^3#real^3#real^3)` ;`(y:real^3#real^3#real^3#real^3)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC f_fan_no_fix_point[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(x':real^3#real^3#real^3#real^3)` +THEN MP_TAC(SET_RULE`y IN face (hypermap1_of_fanx (x,V,E)) x'/\ face (hypermap1_of_fanx (x,V,E)) x' SUBSET d1_fan (x,V,E)==> y IN d1_fan (x,V,E)`) THEN RESA_TAC +THEN MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`) +THEN DISJ_CASES_TAC(SET_RULE`y1=x' \/ ~(y1=x':real^3#real^3#real^3#real^3)`) +THENL(*2*)[ +MP_TAC(SET_RULE`x'=y1:real^3#real^3#real^3#real^3==> pr2 x'= pr2 y1`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(y1:real^3#real^3#real^3#real^3)` ;`(y:real^3#real^3#real^3#real^3)`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(y:real^3#real^3#real^3#real^3)` ;`(x':real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` pr2 (y1:real^3#real^3#real^3#real^3)`; +` pr2 (y:real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge (pr2 (y:real^3#real^3#real^3#real^3)) V E = {pr2 y1} \/ ~(set_of_edge (pr2 (y:real^3#real^3#real^3#real^3)) V E = {pr2 y1})`) +THENL(*3*)[ +MRESA_TAC CARD_SING[`(pr2 y1):real^3`; `(set_of_edge (pr2 (y:real^3#real^3#real^3#real^3)) V E):real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) +THEN FIND_ASSUM (fun th -> MP_TAC(ISPEC `(pr2 (y:real^3#real^3#real^3#real^3))` th))`(!v:real^3. v IN V==>CARD (set_of_edge v V E) >1)` +THEN FIND_ASSUM (fun th-> REWRITE_TAC[th])`(pr2 (y:real^3#real^3#real^3#real^3)) IN V` +THEN ARITH_TAC;(*3*) +MRESA_TAC SIGMA_FAN [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` pr2 (y:real^3#real^3#real^3#real^3)`; +` pr2 (y1:real^3#real^3#real^3#real^3)`] +THEN ASM_TAC THEN SET_TAC[]](*2*); +MP_TAC(SET_RULE`x' IN ds /\ y IN ds /\ y1 IN ds==> {x',y,y1:real^3#real^3#real^3#real^3} SUBSET ds`) +THEN RESA_TAC +THEN SUBGOAL_THEN(`CARD {x',y,y1:real^3#real^3#real^3#real^3}=3`)ASSUME_TAC +THENL(*3*)[SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] + +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + + MRESA_TAC FINITE_FACE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC CARD_SUBSET_EQ[`{x',y,y1:real^3#real^3#real^3#real^3}`; `ds:real^3#real^3#real^3#real^3->bool`] +THEN EXISTS_TAC`x':real^3#real^3#real^3#real^3` +THEN EXISTS_TAC`y:real^3#real^3#real^3#real^3` +THEN EXISTS_TAC`y1:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +]]]);; + + + + + +let lemma_CARD_FACE_SET_EQ_3_FULLY_SURROUNDED_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds f1 f2 f3. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ CARD ds =3 +/\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ds={f1,f2,f3} +==> f1=f1_fan x V E f3`, +REPEAT STRIP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1, f2, f3} SUBSET d1_fan (x,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)`) THEN RESA_TAC +THEN ABBREV_TAC`y1=f1_fan x V E (f3:real^3#real^3#real^3#real^3)` +THEN DISJ_CASES_TAC(SET_RULE`y1=f2 \/ ~(y1=f2:real^3#real^3#real^3#real^3)`) +THENL[ +MP_TAC(SET_RULE`f2=y1:real^3#real^3#real^3#real^3==> pr2 f2= pr2 y1`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(y1:real^3#real^3#real^3#real^3)` ;`(f3:real^3#real^3#real^3#real^3)`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f3:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` pr2 (y1:real^3#real^3#real^3#real^3)`; +` pr2 (f3:real^3#real^3#real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge (pr2 (f3:real^3#real^3#real^3#real^3)) V E = {pr2 y1} \/ ~(set_of_edge (pr2 (f3:real^3#real^3#real^3#real^3)) V E = {pr2 y1})`) +THENL[ +MRESA_TAC CARD_SING[`(pr2 y1):real^3`; `(set_of_edge (pr2 (f3:real^3#real^3#real^3#real^3)) V E):real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) +THEN FIND_ASSUM (fun th -> MP_TAC(ISPEC `(pr2 (f3:real^3#real^3#real^3#real^3))` th))`(!v:real^3. v IN V==>CARD (set_of_edge v V E) >1)` +THEN FIND_ASSUM (fun th-> REWRITE_TAC[th])`(pr2 (f3:real^3#real^3#real^3#real^3)) IN V` +THEN ARITH_TAC; + +MRESA_TAC SIGMA_FAN [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` pr2 (f3:real^3#real^3#real^3#real^3)`; +` pr2 (y1:real^3#real^3#real^3#real^3)`] +THEN ASM_TAC THEN SET_TAC[]]; +MRESA_TAC f_fan_no_fix_point[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f3:real^3#real^3#real^3#real^3)`) +THEN MRESAL_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(y1:real^3#real^3#real^3#real^3)` ;`(f3:real^3#real^3#real^3#real^3)`;`ds:real^3#real^3#real^3#real^3->bool`][SET_RULE`A IN {B,C,A}`] +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SET_TAC[]]);; + + + + +let CARD_FACE_SET_EQ_3_FULLY_SURROUNDED_FAN1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ CARD ds =3 +==> ?f1 f2 f3. ds={f1,f2,f3}/\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ f1_fan x V E f3 =f1 +/\ {pr2 f2, pr2 f3} IN E +/\ {pr2 f3, pr2 f1 } IN E +/\ {pr2 f1, pr2 f2 } IN E +/\ sigma_fan x V E (pr2 f2) (pr2 f3)=pr2 f1 +/\ pr2 f3= pr3 f2 +/\ pr2 f2= pr3 f1 +/\ pr2 f1= pr3 f3`, + +REPEAT STRIP_TAC +THEN MRESA_TAC CARD_FACE_SET_EQ_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM (fun th->MP_TAC(SYM th)) +THEN POP_ASSUM (fun th->MP_TAC(SYM th)) +THEN DISCH_TAC THEN DISCH_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1, f2, f3} SUBSET d1_fan (x,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)`) THEN RESA_TAC +THEN MRESA_TAC lemma_CARD_FACE_SET_EQ_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f1:real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`;`f3:real^3#real^3#real^3#real^3`] +THEN POP_ASSUM (fun th->MP_TAC(SYM th)) +THEN DISCH_TAC +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f2:real^3#real^3#real^3#real^3)` ;`(f1:real^3#real^3#real^3#real^3)`] +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f3:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`] +THEN EXISTS_TAC`f1:real^3#real^3#real^3#real^3` +THEN EXISTS_TAC`f2:real^3#real^3#real^3#real^3` +THEN EXISTS_TAC`f3:real^3#real^3#real^3#real^3` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f1:real^3#real^3#real^3#real^3)` ;`(f3:real^3#real^3#real^3#real^3)`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN ASM_REWRITE_TAC[]);; + + + + +let KVQWYDL_lemma10=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ CARD ds=3 +==> aff_gt {x} ({pr2(y)| y IN ds}) = dartset_leads_into_fan x V E ds`, + +REPEAT STRIP_TAC +THEN MRESA_TAC CARD_FACE_SET_EQ_3_FULLY_SURROUNDED_FAN1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN REWRITE_TAC[SET_RULE`{pr2 y | y IN {f1, f2, f3}}= {pr2 f1, pr2 f2, pr2 f3}`] +THEN MRESA_TAC KVQWYDL_lemma1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(pr2 f1):real^3`; `(pr2 f2):real^3`;`pr2 f3:real^3`] +THEN MRESAL_TAC UNIQUE_DARTSET_LEADS_INTO1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`aff_gt {x} {pr2 f1, pr2 f2, pr2 f3}:real^3->bool`;`f2:real^3#real^3#real^3#real^3`][SET_RULE`A IN {B,A,C}`]);; + + + +let IN_D1_FAN_IMP_EDGE_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) y. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ y IN d_fan(x,V,E) +==> {pr2 y, pr3 y} IN E`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr2;pr3]);; + + +let EQ_PAIR_IMP_EQ_4_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) y y1. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ y IN d_fan(x,V,E) +/\ y1 IN d_fan(x,V,E) +/\ (pr2 y,pr3 y)= (pr2 y1,pr3 y1) +==> y=y1`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN REWRITE_TAC[PAIR_EQ;IN_ELIM_THM;d1_fan] +THEN STRIP_TAC +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[pr2; pr3] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[]);; + +let KVQWYDL_lemma30=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ CARD ds=3 + +==> (!y. y IN d_fan(x,V,E) /\ dartset_leads_into_fan x V E ds = dart_leads_into x V E (pr2 y) (pr3 y) +==> y IN ds)`, + + +REPEAT STRIP_TAC +THEN MRESA_TAC CARD_FACE_SET_EQ_3_FULLY_SURROUNDED_FAN1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MRESA_TAC IN_D1_FAN_IMP_EDGE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC KVQWYDL_lemma1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(pr2 f1):real^3`; `(pr2 f2):real^3`;`pr2 f3:real^3`] +THEN MRESAL_TAC UNIQUE_DARTSET_LEADS_INTO1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`aff_gt {x} {pr2 f1, pr2 f2, pr2 f3}:real^3->bool`;`f2:real^3#real^3#real^3#real^3`][SET_RULE`A IN {B,A,C}`] +THEN MRESA_TAC KVQWYDL_lemma3[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(pr2 f1):real^3`; `(pr2 f2):real^3`;`pr2 f3:real^3`; `(pr2 y):real^3`;`pr3 y:real^3`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1, f2, f3} SUBSET d_fan (x,V,E)==> f1 IN d_fan (x,V,E) /\ f2 IN d_fan (x,V,E) /\ f3 IN d_fan (x,V,E)`) THEN RESA_TAC +THEN MP_TAC(SET_RULE`pr2 y,pr3 y IN {(pr2 f1,pr2 f2), (pr2 f2,pr3 f2), (pr3 f2,pr2 f1)}==> +(pr2 y,pr3 y) =(pr2 f1,pr2 f2)\/ (pr2 y,pr3 y) = (pr2 f2,pr3 f2)\/ (pr2 y,pr3 y) =(pr3 f2,pr2 f1)`) +THEN RESA_TAC +THENL[ +MRESA_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`y:real^3#real^3#real^3#real^3`;`f1:real^3#real^3#real^3#real^3`] +THEN SET_TAC[]; +MRESA_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`y:real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`] +THEN SET_TAC[]; +MRESA_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`y:real^3#real^3#real^3#real^3`;`f3:real^3#real^3#real^3#real^3`] +THEN SET_TAC[]]);; + + +let KVQWYDL=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ CARD ds=3 + +==> aff_gt {x} ({pr2(y)| y IN ds}) = dartset_leads_into_fan x V E ds +/\ (!y. y IN d_fan(x,V,E) /\ dartset_leads_into_fan x V E ds = dart_leads_into x V E (pr2 y) (pr3 y) +==> y IN ds)`, +MESON_TAC[KVQWYDL_lemma30;KVQWYDL_lemma10]);; + + + +(**************MOZNWEH*******************) + + +let dartset_leads_into_fan_radial=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds r. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ CARD ds=3 +/\ r> &0 +==> radial_norm r x ((dartset_leads_into_fan x V E ds) INTER normball x r) `, + +REPEAT STRIP_TAC +THEN MRESA_TAC KVQWYDL_lemma10[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) +THEN MRESA_TAC CARD_FACE_SET_EQ_3_FULLY_SURROUNDED_FAN1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN REWRITE_TAC[SET_RULE`{pr2 y | y IN {f1, f2, f3}}={pr2 f1,pr2 f2,pr2 f3}`] +THEN MATCH_MP_TAC aff_gt_radial +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr2 f2):real^3`;`(pr2 f1):real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr2 f3):real^3`;`(pr2 f2):real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr2 f1):real^3`;`(pr2 f3):real^3`] +THEN ASM_TAC THEN SET_TAC[]);; + + +let ball_eq_normball=prove(`!x r.ball (x,r)= normball x r`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[ball; normball;DIST_SYM]);; + + +let dartset_leads_into_fan_eventually_radial_norm=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ CARD ds=3 +==> eventually_radial_norm x ((dartset_leads_into_fan x V E ds)) `, + +REPEAT STRIP_TAC +THEN MRESAL_TAC dartset_leads_into_fan_radial[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`&1`][eventually_radial_norm;REAL_ARITH`&1> &0`] +THEN EXISTS_TAC`&1` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1> &0`]);; + + + +let measurable_dartset_leads_into3_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds e:real. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ CARD ds=3 +/\ e> &0 +==> measurable((dartset_leads_into_fan x V E ds) INTER ball (x,e))`, +REPEAT STRIP_TAC +THEN MRESA_TAC KVQWYDL_lemma10[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) +THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B=B INTER A`] +THEN MESON_TAC[MEASURABLE_BALL_AFF_GT]);; + + + + +let CARD_GT1_IMP_AZIM_FAN_EQ_AZIM=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) y. +FAN(x,V,E) +/\ y IN d_fan(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +==> +azim_fan x V E (pr2 y) (pr3 y)= azim x (pr2 y) (pr3 y) (sigma_fan x V E (pr2 y) (pr3 y))`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[azim_fan] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "EM") +THEN MRESA_TAC IN_D1_FAN_IMP_EDGE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr3 y):real^3`;`(pr2 y):real^3`] +THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `pr2 (y:real^3#real^3#real^3#real^3)`));; + + +let CARD_GT1_IMP_AZIM_FAN_EQ_DIHV=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) y. +FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ y IN d_fan(x,V,E) +==> +azim_fan x V E (pr2 y) (pr3 y)= dihV x (pr2 y) (pr3 y) (sigma_fan x V E (pr2 y) (pr3 y))`, + +REPEAT STRIP_TAC +THEN MRESA_TAC CARD_GT1_IMP_AZIM_FAN_EQ_AZIM[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`y:real^3#real^3#real +^3#real^3`] +THEN MRESA_TAC IN_D1_FAN_IMP_EDGE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`y:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr3 y):real^3`;`(pr2 y):real^3`] + +THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` (pr2 y):real^3`;`(pr3 y):real^3`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E (pr2 y) (pr3 y)):real^3`;`(pr2 y):real^3`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`fan80(x:real^3,V,E)` +THEN REWRITE_TAC[fan80] +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(pr2 y):real^3`;`(pr3 y):real^3`]) +THEN MRESA_TAC AZIM_DIVH[`x:real^3`;`(pr2 y):real^3`;`(pr3 y):real^3`; `(sigma_fan x V E (pr2 y) (pr3 y)):real^3`]);; + + + + + + + + + + + + + + +let solid_of_dartset_leads_into_fan_triangle_fan=prove( `!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds. + FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ CARD ds=3 +==> +sol x (dartset_leads_into_fan x V E ds)= &2 * pi + sum (ds) (\y. (azim_fan x V E (pr2 y) (pr3 y)) - pi) +`, + +REPEAT STRIP_TAC +THEN MRESA_TAC CARD_FACE_SET_EQ_3_FULLY_SURROUNDED_FAN1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MAS") +THEN REPEAT STRIP_TAC +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`] +THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`] +THEN MP_TAC(SET_RULE`{f1, f2, f3} SUBSET d1_fan (x,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)`) THEN RESA_TAC +THEN MRESA_TAC f_fan_no_fix_point[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f3:real^3#real^3#real^3#real^3)` THEN MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)` THEN MRESA1_TAC th`(f1:real^3#real^3#real^3#real^3)`) +THEN MP_TAC(SET_RULE`~(f1 = f3) /\ ~(f3 = f2) /\ ~(f2 = f1)==> DISJOINT {f1:real^3#real^3#real^3#real^3} {f2, f3} /\ DISJOINT {f2:real^3#real^3#real^3#real^3} { f3}`) +THEN RESA_TAC +THEN MRESAL_TAC SUM_UNION[`(\y. azim_fan x V E (pr2 (y:real^3#real^3#real^3#real^3)) (pr3 y) - pi)`;`{(f1:real^3#real^3#real^3#real^3)}`;`{(f2:real^3#real^3#real^3#real^3),(f3:real^3#real^3#real^3#real^3)}`;][SUM_SING] +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] + +THEN MRESAL_TAC SUM_UNION[`(\y. azim_fan x V E (pr2 (y:real^3#real^3#real^3#real^3)) (pr3 y) - pi)`;`{(f2:real^3#real^3#real^3#real^3)}`;`{(f3:real^3#real^3#real^3#real^3)}`;][SUM_SING] +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN REWRITE_TAC[SET_RULE`{f2} UNION {f3}={f2,f3}`;SET_RULE`{f1} UNION {f2,f3}={f1,f2,f3}`] +THEN RESA_TAC THEN RESA_TAC +THEN MRESAL_TAC measurable_dartset_leads_into3_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`&1`][REAL_ARITH`&1> &0`] +THEN MRESAL_TAC dartset_leads_into_fan_radial[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`&1`][REAL_ARITH`&1> &0`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ball_eq_normball] +THEN MRESA_TAC KVQWYDL_lemma1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(pr2 f1):real^3`; `(pr2 f2):real^3`;`pr2 f3:real^3`] + +THEN MRESAL_TAC UNIQUE_DARTSET_LEADS_INTO1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`aff_gt {x} {pr2 f1, pr2 f2, pr2 f3}:real^3->bool`;`f2:real^3#real^3#real^3#real^3`][SET_RULE`A IN {B,A,C}`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) +THEN MRESA_TAC CARD_GT1_IMP_AZIM_FAN_EQ_DIHV[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f1:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC CARD_GT1_IMP_AZIM_FAN_EQ_DIHV[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f2:real^3#real^3#real^3#real^3`] +THEN MRESA_TAC CARD_GT1_IMP_AZIM_FAN_EQ_DIHV[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f3:real^3#real^3#real^3#real^3`] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC sol[`x:real^3`;`aff_gt {x} {pr3 f3, pr3 f1, pr3 f2}`;`&1`][REAL_ARITH`&1> &0`;REAL_ARITH`A/ &1 pow 3=A`] +THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B=B INTER A`] +THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MP_TAC th +THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th) +THEN DISCH_TAC +THEN POP_ASSUM (fun th -> MRESA_TAC th [`(pr2 f2):real^3`;`pr2 f3:real^3`]) +THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(pr2 f1):real^3`; `(pr2 f2):real^3`;`pr2 f3:real^3`] +THEN MRESAL_TAC VOLUME_SOLID_TRIANGLE[`&1`;`x:real^3`;`(pr2 f1):real^3`; `(pr2 f2):real^3`;`pr2 f3:real^3`][REAL_ARITH`&0 < &1`;ball_eq_normball] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN MRESA_TAC PROPERTIES_TRIANGLE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(pr2 f1):real^3`; `(pr2 f2):real^3`;`pr2 f3:real^3`] +THEN REMOVE_THEN "MAS" MP_TAC +THEN RESA_TAC +THEN REAL_ARITH_TAC);; + + + + + + + + +let MOZNWEH=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds e. + FAN(x,V,E) +/\ (!v. v IN V==>CARD (set_of_edge v V E) >1) +/\ fan80(x,V,E) +/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) +/\ CARD ds=3 +/\ e> &0 +==> measurable((dartset_leads_into_fan x V E ds) INTER ball (x,e)) +/\ eventually_radial_norm x ((dartset_leads_into_fan x V E ds)) +/\ sol x (dartset_leads_into_fan x V E ds)= &2 * pi + sum (ds) (\y. (azim_fan x V E (pr2 y) (pr3 y)) - pi) +`, + +MESON_TAC[solid_of_dartset_leads_into_fan_triangle_fan;measurable_dartset_leads_into3_fan;dartset_leads_into_fan_eventually_radial_norm]);; + +(* open Planarity;; + + +*) + + +end;; diff --git a/text_formalization/fan/polyhedron.hl b/text_formalization/fan/polyhedron.hl new file mode 100644 index 0000000..a7064de --- /dev/null +++ b/text_formalization/fan/polyhedron.hl @@ -0,0 +1,3163 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Lemma: AJXXAWK, EDANAOL, QLITJET MUGGQUF QSRHLXB LTHQIAA *) +(* CZZHBLI QOEPBJD NEHRQPR ZMQQFUP JLIGZGS *) +(* Section: Polyhedron *) +(* Chapter: Packing *) +(* Author: John Harrison, Hoang Le Truong *) +(* Date: 2010-07-15 *) +(* ========================================================================== *) + + +(* + +John Harrison's material on polyhedra in mostly in Multivariate/flyspeck.ml + +AJXXAWK +Definition 4.5: IS_AFFINE_HULL + affine / hull + aff_dim + AFF_DIM_EMPTY + +EDANAOL + Definition 4.6 : IN_INTERIOR + IN_RELATIVE_INTERIOR + CLOSURE_APPROACHABLE + (Don't have definition of relative boundary, but + several theorems use closure s DIFF relative_interior s.) + +QLITJET + Definition 4.7: face_of + extreme_point_of (presumably it's meant to be the point not + the singleton set, which the definition literally gives) + facet_of + edge_of + (Don't have a definition of "proper"; I just use + ~(f = {}) and/or ~(f = P) as needed.) + +MUGGQUF + Lemma 4.18: KREIN_MILMAN_MINKOWSKI + +QSRHLXB + Definition 4.8: polyhedron + vertices + +LTHQIAA + Lemma 4.19: AFFINE_IMP_POLYHEDRON + +CZZHBLI + Lemma 4.20 (i): FACET_OF_POLYHEDRON_EXPLICIT + + Lemma 4.20 (ii): Direct consequence of RELATIVE_INTERIOR_POLYHEDRON + + Lemma 4.20 (iii): FACE_OF_POLYHEDRON_EXPLICIT / FACE_OF_POLYHEDRON + + Lemma 4.20 (iv): FACE_OF_TRANS + + Lemma 4.20 (v): EXTREME_POINT_OF_FACE + + Lemma 4.20 (vi): FACE_OF_EQ + +QOEPBJD + Corr. 4.7: FACE_OF_POLYHEDRON_POLYHEDRON + +NEHRQPR: + Lemma 4.21: POLYHEDRON_COLLINEAR_FACES + +ZMQQFUP: + Def 4.9: vertices + edges + +JLIGZGS: + POLYHEDRON_FAN + +[Library completed by HLT, July 2011]. + +AMHFNXP: + AMHFNXP_BIJ + +WBLARHH: + WBLARHH_BIJ + +BSXAQBQ: + BSXAQBQ + + + + +Email tchales<->John Harrison: July 15, 2010: + +|I'm not sure whether your work covers the results +| relating polyhedra to fans. I wasn't able to find any theorems on that +| topic, but I recall that you had mentioned it in an earlier email. I want +| to confirm with you that this still needs to be formalized. + +I believe that I just did the most basic of these theorems, that a +polyhedron gives rise to a fan, together with a bunch of invariance +emmas for some relevant concepts. + +*) + + +(* ************************************************* *) +(* Invariance theorems *) + +module Polyhedron = struct + + open Sphere;; + open Fan;; + + open Topology;; + open Sphere;; + open Hypermap;; + open Fan;; + open Planarity;; + open Topology;; + open Fan_defs;; + open Conforming;; + + + +let GRAPH = prove + (`!E. graph E <=> !e. e IN E ==> e HAS_SIZE 2`, + REWRITE_TAC[graph; IN]);; + +let CYCLIC_SET = prove + (`cyclic_set W v w <=> + ~(v = w) /\ + FINITE W /\ + (!p q h. p IN W /\ q IN W /\ p - q = h % (v - w) ==> p = q) /\ + W INTER affine hull {v, w} = {}`, + REWRITE_TAC[cyclic_set; IN; VECTOR_ARITH `p - q:real^N = r <=> p = q + r`]);; + +let CYCLIC_SET_TRANSLATION_EQ = prove + (`!a:real^N s x y. + cyclic_set (IMAGE (\x. a + x) s) (a + x) (a + y) <=> cyclic_set s x y`, + REWRITE_TAC[CYCLIC_SET] THEN GEOM_TRANSLATE_TAC[]);; + +let CYCLIC_SET_LINEAR_IMAGE = prove + (`!f:real^M->real^N s x y. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (cyclic_set (IMAGE f s) (f x) (f y) <=> cyclic_set s x y)`, + GEN_REWRITE_TAC (funpow 4 BINDER_CONV o RAND_CONV o TOP_DEPTH_CONV) + [CYCLIC_SET; RIGHT_FORALL_IMP_THM; IMP_CONJ; FORALL_IN_IMAGE] THEN + GEOM_TRANSFORM_TAC[]);; + +add_translation_invariants [CYCLIC_SET_TRANSLATION_EQ];; + +add_linear_invariants [CYCLIC_SET_LINEAR_IMAGE];; + +let GRAPH_TRANSLATION_EQ = prove + (`!a:real^N E. graph (IMAGE (IMAGE (\x. a + x)) E) <=> graph E`, + REWRITE_TAC[GRAPH] THEN GEOM_TRANSLATE_TAC[]);; + +let GRAPH_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (graph(IMAGE (IMAGE f) E) <=> graph E)`, + REWRITE_TAC[GRAPH] THEN GEOM_TRANSFORM_TAC[]);; + +let FAN1_TRANSLATION_EQ = prove + (`!a:real^N x V E. + fan1(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + fan1(x,V,E)`, + REWRITE_TAC[fan1] THEN GEOM_TRANSLATE_TAC[]);; + +let FAN1_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (fan1(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> fan1(x,V,E))`, + REWRITE_TAC[fan1] THEN GEOM_TRANSFORM_TAC[]);; + +let FAN2_TRANSLATION_EQ = prove + (`!a:real^N x V E. + fan2(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + fan2(x,V,E)`, + REWRITE_TAC[fan2] THEN GEOM_TRANSLATE_TAC[]);; + +let FAN2_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (fan2(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> fan2(x,V,E))`, + REWRITE_TAC[fan2] THEN GEOM_TRANSFORM_TAC[]);; + +let FAN3_TRANSLATION_EQ = prove + (`!a:real^N x V E. + fan3(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + fan3(x,V,E)`, + REWRITE_TAC[fan3] THEN GEOM_TRANSLATE_TAC[]);; + +let FAN3_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (fan3(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> fan3(x,V,E))`, + let lemma = prove + (`{w | {a,w} IN IMAGE (IMAGE f) s} = + IMAGE f {w |w| {a,f w} IN IMAGE (IMAGE f) s}`, + MATCH_MP_TAC(SET_RULE + `(!y. P y ==> ?x. y = f x) ==> {w | P w} = IMAGE f {w | P(f w)}`) THEN + REWRITE_TAC[IN_IMAGE; EXTENSION; IN_IMAGE; IN_INSERT; NOT_IN_EMPTY] THEN + MESON_TAC[]) in + REWRITE_TAC[fan3; FORALL_IN_IMAGE; lemma] THEN GEOM_TRANSFORM_TAC[]);; + +let FAN4_TRANSLATION_EQ = prove + (`!a:real^N x V E. + fan4(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + fan4(x,V,E)`, + REWRITE_TAC[fan4] THEN GEOM_TRANSLATE_TAC[]);; + +let FAN4_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (fan4(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> fan4(x,V,E))`, + REWRITE_TAC[fan4] THEN GEOM_TRANSFORM_TAC[]);; + +let FAN5_TRANSLATION_EQ = prove + (`!a:real^N x V E. + fan5(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + fan5(x,V,E)`, + REWRITE_TAC[fan5] THEN GEOM_TRANSLATE_TAC[]);; + +let FAN5_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (fan5(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> fan5(x,V,E))`, + GEN_REWRITE_TAC (funpow 4 BINDER_CONV o RAND_CONV o TOP_DEPTH_CONV) + [fan5; IMP_CONJ; RIGHT_FORALL_IMP_THM; FORALL_IN_IMAGE] THEN + GEOM_TRANSFORM_TAC[]);; + +let FAN6_TRANSLATION_EQ = prove + (`!a:real^N x V E. + fan6(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + fan6(x,V,E)`, + REWRITE_TAC[fan6] THEN GEOM_TRANSLATE_TAC[]);; + +let FAN6_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (fan6(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> fan6(x,V,E))`, + REWRITE_TAC[fan6] THEN GEOM_TRANSFORM_TAC[]);; + +let FAN7_TRANSLATION_EQ = prove + (`!a:real^N x V E. + fan7(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + fan7(x,V,E)`, + REWRITE_TAC[fan7] THEN + REWRITE_TAC[SET_RULE + `e IN s UNION {f x | t x} <=> e IN s \/ ?x. t x /\ e = f x`] THEN + GEOM_TRANSLATE_TAC[]);; + +let FAN7_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (fan7(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> fan7(x,V,E))`, + REWRITE_TAC[fan7; IN_UNION] THEN + REWRITE_TAC[LEFT_OR_DISTRIB; RIGHT_OR_DISTRIB; + TAUT `a \/ b ==> c <=> (a ==> c) /\ (b ==> c)`] THEN + GEN_REWRITE_TAC (funpow 4 BINDER_CONV o RAND_CONV o TOP_DEPTH_CONV) + [FORALL_AND_THM; IMP_CONJ; RIGHT_FORALL_IMP_THM] THEN + REWRITE_TAC[FORALL_IN_GSPEC] THEN REWRITE_TAC[IMP_IMP] THEN + GEOM_TRANSFORM_TAC[]);; + +add_translation_invariants + [GRAPH_TRANSLATION_EQ; + FAN1_TRANSLATION_EQ; + FAN2_TRANSLATION_EQ; + FAN3_TRANSLATION_EQ; + FAN4_TRANSLATION_EQ; + FAN5_TRANSLATION_EQ; + FAN6_TRANSLATION_EQ; + FAN7_TRANSLATION_EQ];; + +add_linear_invariants + [GRAPH_LINEAR_IMAGE_EQ; + FAN1_LINEAR_IMAGE_EQ; + FAN2_LINEAR_IMAGE_EQ; + FAN3_LINEAR_IMAGE_EQ; + FAN4_LINEAR_IMAGE_EQ; + FAN5_LINEAR_IMAGE_EQ; + FAN6_LINEAR_IMAGE_EQ; + FAN7_LINEAR_IMAGE_EQ];; + +let FAN_TRANSLATION_EQ = prove + (`!a:real^N x V E. + FAN(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) <=> + FAN(x,V,E)`, + REWRITE_TAC[FAN] THEN GEOM_TRANSLATE_TAC[]);; + +let FAN_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> (FAN(f x,IMAGE f V,IMAGE (IMAGE f) E) <=> FAN(x,V,E))`, + REWRITE_TAC[FAN] THEN GEOM_TRANSFORM_TAC[]);; + +add_translation_invariants [FAN_TRANSLATION_EQ];; +add_linear_invariants [FAN_LINEAR_IMAGE_EQ];; + +let BASE_POINT_FAN_TRANSLATION_EQ = prove + (`!a x V E. + base_point_fan(a + x,IMAGE (\x. a + x) V,IMAGE (IMAGE (\x. a + x)) E) = + a + base_point_fan(x,V,E)`, + REWRITE_TAC[base_point_fan]);; + +let BASE_POINT_FAN_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f + ==> base_point_fan(f x,IMAGE f V,IMAGE (IMAGE f) E) = + f(base_point_fan(x,V,E))`, + REWRITE_TAC[base_point_fan]);; + +let SET_OF_EDGE_TRANSLATION_EQ = prove + (`!a:real^N x V E. + set_of_edge (a + x) (IMAGE (\x. a + x) V) + (IMAGE (IMAGE (\x. a + x)) E) = + IMAGE (\x. a + x) (set_of_edge x V E)`, + REWRITE_TAC[set_of_edge] THEN GEOM_TRANSLATE_TAC[]);; + +let SET_OF_EDGE_LINEAR_IMAGE_EQ = prove + (`!f:real^M->real^N x V E. + linear f /\ (!x y. f x = f y ==> x = y) + ==> set_of_edge (f x) (IMAGE f V) (IMAGE (IMAGE f) E) = + IMAGE f (set_of_edge x V E)`, + let lemma = prove + (`{w | {a,w} IN IMAGE (IMAGE f) s /\ P w} = + {f w |w| {a,f w} IN IMAGE (IMAGE f) s /\ P(f w)}`, + MATCH_MP_TAC(SET_RULE + `(!y. P y ==> ?x. y = f x) ==> {w | P w} = {f w |w| P(f w)}`) THEN + REWRITE_TAC[IN_IMAGE; EXTENSION; IN_IMAGE; IN_INSERT; NOT_IN_EMPTY] THEN + MESON_TAC[]) in + REWRITE_TAC[set_of_edge; lemma] THEN + GEOM_TRANSFORM_TAC[] THEN SET_TAC[]);; + +add_translation_invariants + [BASE_POINT_FAN_TRANSLATION_EQ; SET_OF_EDGE_TRANSLATION_EQ];; + +add_linear_invariants + [BASE_POINT_FAN_LINEAR_IMAGE_EQ; SET_OF_EDGE_LINEAR_IMAGE_EQ];; + +(* ************************************************* *) +(* Polyhedron gives rise to a fan *) + +let POLYHEDRON_FAN = prove + (`!p z:real^3. + bounded p /\ polyhedron p /\ z IN interior p + ==> FAN(z,vertices p,edges p)`, + let lemma = prove + (`!s a b c d:real^N. + segment[a,b] face_of s /\ segment[c,d] face_of s + ==> {a,b} = {c,d} \/ + segment[a,b] INTER segment[c,d] = {a,b} INTER {c,d}`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPECL [`s:real^N->bool`; `segment[a:real^N,b]`; + `segment[c:real^N,d]`] SUBSET_OF_FACE_OF) THEN + MP_TAC(ISPECL [`s:real^N->bool`; `segment[c:real^N,d]`; + `segment[a:real^N,b]`] SUBSET_OF_FACE_OF) THEN + ASM_SIMP_TAC[FACE_OF_IMP_SUBSET; RELATIVE_INTERIOR_SEGMENT] THEN + REPEAT(COND_CASES_TAC THEN ASM_REWRITE_TAC[SEGMENT_REFL; INSERT_AC]) THEN + MP_TAC(ISPECL [`a:real^N`; `b:real^N`; `c:real^N`; `d:real^N`] + SUBSET_SEGMENT_OPEN_CLOSED) THEN + MP_TAC(ISPECL [`c:real^N`; `d:real^N`; `a:real^N`; `b:real^N`] + SUBSET_SEGMENT_OPEN_CLOSED) THEN + ASM_REWRITE_TAC[open_segment] THEN + MP_TAC(ISPECL [`a:real^N`; `b:real^N`] ENDS_IN_SEGMENT) THEN + MP_TAC(ISPECL [`c:real^N`; `d:real^N`] ENDS_IN_SEGMENT) THEN + ASM SET_TAC[]) in + REPEAT GEN_TAC THEN GEOM_ORIGIN_TAC `z:real^3` THEN + REWRITE_TAC[FAN] THEN REPEAT GEN_TAC THEN STRIP_TAC THEN + SUBGOAL_THEN `polytope(p:real^3->bool)` ASSUME_TAC THENL + [ASM_REWRITE_TAC[POLYTOPE_EQ_BOUNDED_POLYHEDRON]; ALL_TAC] THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP POLYTOPE_IMP_COMPACT) THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP POLYTOPE_IMP_CONVEX) THEN + SUBGOAL_THEN `(vec 0:real^3) IN p` ASSUME_TAC THENL + [ASM_MESON_TAC[INTERIOR_SUBSET; SUBSET]; ALL_TAC] THEN + SUBGOAL_THEN `!a b:real^3. ~(p = segment[a,b])` ASSUME_TAC THENL + [REPEAT GEN_TAC THEN DISCH_THEN SUBST_ALL_TAC THEN + RULE_ASSUM_TAC(REWRITE_RULE[INTERIOR_SEGMENT; DIMINDEX_3; ARITH]) THEN + ASM SET_TAC[]; + ALL_TAC] THEN + REPEAT STRIP_TAC THENL + [REWRITE_TAC[SUBSET; FORALL_IN_UNIONS; IMP_CONJ; RIGHT_FORALL_IMP_THM] THEN + REWRITE_TAC[edges; FORALL_IN_GSPEC; FORALL_IN_INSERT; NOT_IN_EMPTY] THEN + REWRITE_TAC[vertices; edge_of; IN_ELIM_THM; GSYM FACE_OF_SING] THEN + MAP_EVERY X_GEN_TAC [`v:real^3`; `w:real^3`] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC FACE_OF_TRANS THEN EXISTS_TAC `segment[v:real^3,w]` THEN + ASM_REWRITE_TAC[FACE_OF_SING; EXTREME_POINT_OF_SEGMENT]; + REWRITE_TAC[GRAPH; edges; edge_of; FORALL_IN_GSPEC] THEN + MAP_EVERY X_GEN_TAC [`v:real^3`; `w:real^3`] THEN + ASM_CASES_TAC `w:real^3 = v` THEN + ASM_REWRITE_TAC[SEGMENT_REFL; AFF_DIM_SING] THEN + CONV_TAC INT_REDUCE_CONV THEN STRIP_TAC THEN + ASM_SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] THEN + CONV_TAC NUM_REDUCE_CONV; + REWRITE_TAC[fan1; SUBSET_EMPTY; vertices] THEN + ASM_SIMP_TAC[FINITE_POLYHEDRON_EXTREME_POINTS] THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY; IN_ELIM_THM] THEN + MATCH_MP_TAC EXTREME_POINT_EXISTS_CONVEX THEN + ASM_REWRITE_TAC[] THEN ASM SET_TAC[]; + REWRITE_TAC[fan2; vertices; IN_ELIM_THM] THEN + ASM_MESON_TAC[EXTREME_POINT_NOT_IN_INTERIOR]; + REWRITE_TAC[fan6; edges; FORALL_IN_GSPEC; edge_of] THEN + MAP_EVERY X_GEN_TAC [`v:real^3`; `w:real^3`] THEN + ASM_CASES_TAC `w:real^3 = v` THEN + ASM_REWRITE_TAC[SEGMENT_REFL; AFF_DIM_SING] THEN + CONV_TAC INT_REDUCE_CONV THEN STRIP_TAC THEN + SUBGOAL_THEN `(v:real^3) extreme_point_of p /\ w extreme_point_of p` + STRIP_ASSUME_TAC THENL + [REWRITE_TAC[GSYM FACE_OF_SING] THEN CONJ_TAC THEN + MATCH_MP_TAC FACE_OF_TRANS THEN EXISTS_TAC `segment[v:real^3,w]` THEN + ASM_REWRITE_TAC[FACE_OF_SING; EXTREME_POINT_OF_SEGMENT]; + ALL_TAC] THEN + SUBGOAL_THEN `~(v:real^3 = vec 0) /\ ~(w:real^3 = vec 0)` + STRIP_ASSUME_TAC THENL + [ASM_MESON_TAC[EXTREME_POINT_NOT_IN_INTERIOR]; ALL_TAC] THEN + REWRITE_TAC[SET_RULE `{a} UNION {b,c} = {a,b,c}`] THEN + ASM_REWRITE_TAC[COLLINEAR_LEMMA_ALT; NOT_EXISTS_THM] THEN + X_GEN_TAC `t:real` THEN + ASM_CASES_TAC `t = &0` THEN ASM_REWRITE_TAC[VECTOR_MUL_LZERO] THEN + DISCH_THEN SUBST_ALL_TAC THEN + FIRST_ASSUM(DISJ_CASES_TAC o MATCH_MP (REAL_ARITH + `~(x = &0) ==> x < &0 \/ &0 < x`)) + THENL + [MP_TAC(ISPECL [`segment[v:real^3,t % v]`; `p:real^3->bool`] + FACE_OF_DISJOINT_INTERIOR) THEN + ASM_REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + EXISTS_TAC `vec 0:real^3` THEN ASM_REWRITE_TAC[IN_INTER] THEN + REWRITE_TAC[IN_SEGMENT] THEN EXISTS_TAC `&1 / (&1 - t)` THEN + ASM_SIMP_TAC[REAL_LE_RDIV_EQ; REAL_LE_LDIV_EQ; + REAL_ARITH `t < &0 ==> &0 < &1 - t`] THEN + REPEAT(CONJ_TAC THENL [ASM_ARITH_TAC; ALL_TAC]) THEN + CONV_TAC SYM_CONV THEN + REWRITE_TAC[VECTOR_MUL_ASSOC; GSYM VECTOR_ADD_RDISTRIB] THEN + REWRITE_TAC[VECTOR_MUL_EQ_0] THEN DISJ1_TAC THEN + UNDISCH_TAC `t < &0` THEN CONV_TAC REAL_FIELD; + MP_TAC(ISPECL [`p:real^3->bool`; `segment[v:real^3,t % v]`; + `segment[v:real^3,t % v]`; `v:real^3`; `t % v:real^3`; + `t:real`; `&1`] POLYHEDRON_COLLINEAR_FACES) THEN + ASM_REWRITE_TAC[ENDS_IN_SEGMENT; real_gt; REAL_LT_01] THEN + ASM_REWRITE_TAC[VECTOR_MUL_ASSOC; VECTOR_MUL_RCANCEL; REAL_MUL_LID] THEN + ASM_MESON_TAC[VECTOR_MUL_LID]]; + REWRITE_TAC[fan7] THEN + MAP_EVERY X_GEN_TAC [`e1:real^3->bool`; `e2:real^3->bool`] THEN + DISCH_TAC THEN + SUBGOAL_THEN + `(?x1 y1:real^3. e1 = {x1,y1} /\ segment[x1,y1] face_of p) /\ + (?x2 y2:real^3. e2 = {x2,y2} /\ segment[x2,y2] face_of p)` + STRIP_ASSUME_TAC THENL + [FIRST_X_ASSUM(fun th -> MP_TAC th THEN MATCH_MP_TAC MONO_AND) THEN + SIMP_TAC[IN_UNION; TAUT `(a \/ b ==> c) <=> (a ==> c) /\ (b ==> c)`] THEN + REWRITE_TAC[edges; edge_of; vertices; IN_ELIM_THM] THEN + REPEAT CONJ_TAC THENL + [MESON_TAC[]; ALL_TAC; MESON_TAC[]; ALL_TAC] THEN + DISCH_THEN(X_CHOOSE_TAC `v:real^3`) THEN + REPEAT(EXISTS_TAC `v:real^3`) THEN + ASM_REWRITE_TAC[SEGMENT_REFL; FACE_OF_SING; INSERT_AC]; + ALL_TAC] THEN + SUBGOAL_THEN + `(x1:real^3) extreme_point_of p /\ y1 extreme_point_of p /\ + x2 extreme_point_of p /\ y2 extreme_point_of p` + STRIP_ASSUME_TAC THENL + [REWRITE_TAC[GSYM FACE_OF_SING] THEN REPEAT CONJ_TAC THEN + MATCH_MP_TAC FACE_OF_TRANS THEN + ASM_MESON_TAC[FACE_OF_SING; EXTREME_POINT_OF_SEGMENT]; + ALL_TAC] THEN + SUBGOAL_THEN + `~(x1:real^3 = vec 0) /\ ~(y1:real^3 = vec 0) /\ + ~(x2:real^3 = vec 0) /\ ~(y2:real^3 = vec 0)` + STRIP_ASSUME_TAC THENL + [ASM_MESON_TAC[EXTREME_POINT_NOT_IN_INTERIOR]; ALL_TAC] THEN + ASM_SIMP_TAC[AFF_GE_0_CONVEX_HULL_ALT; FINITE_INTER; IN_INTER; + IN_INSERT; NOT_IN_EMPTY; FINITE_INSERT; FINITE_EMPTY] THEN + MATCH_MP_TAC(SET_RULE + `s INTER t = u ==> (a INSERT s) INTER (a INSERT t) = a INSERT u`) THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `{t % y:real^3 | &0 < t /\ + y IN (convex hull {x1,y1}) INTER + (convex hull {x2,y2})}` THEN + CONJ_TAC THENL + [REWRITE_TAC[GSYM SEGMENT_CONVEX_HULL] THEN + MATCH_MP_TAC SUBSET_ANTISYM THEN CONJ_TAC THENL + [ALL_TAC; SET_TAC[]] THEN + REWRITE_TAC[SUBSET; IN_INTER; IMP_CONJ; FORALL_IN_GSPEC] THEN + MAP_EVERY X_GEN_TAC [`s:real`; `x:real^3`] THEN + DISCH_TAC THEN DISCH_TAC THEN + REWRITE_TAC[IN_ELIM_THM; LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`t:real`; `y:real^3`] THEN STRIP_TAC THEN + MP_TAC(ISPECL [`p:real^3->bool`; `segment[x1:real^3,y1]`; + `segment[x2:real^3,y2]`; `x:real^3`; `y:real^3`; + `s:real`; `t:real`] POLYHEDRON_COLLINEAR_FACES) THEN + ASM_REWRITE_TAC[real_gt] THEN DISCH_THEN SUBST_ALL_TAC THEN + MAP_EVERY EXISTS_TAC [`t:real`; `y:real^3`] THEN ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `t % x:real^3 = t % y` THEN + ASM_SIMP_TAC[VECTOR_MUL_LCANCEL; REAL_LT_IMP_NZ] THEN ASM_MESON_TAC[]; + SUBGOAL_THEN + `(convex hull {x1,y1}) INTER (convex hull {x2,y2}) :real^3->bool = + convex hull ({x1, y1} INTER {x2, y2})` + (fun th -> REWRITE_TAC[th]) THEN + MATCH_MP_TAC SUBSET_ANTISYM THEN CONJ_TAC THENL + [ALL_TAC; + REWRITE_TAC[SUBSET_INTER] THEN CONJ_TAC THEN + MATCH_MP_TAC HULL_MONO THEN SET_TAC[]] THEN + MP_TAC(ISPECL [`p:real^3->bool`; `x1:real^3`; `y1:real^3`; + `x2:real^3`; `y2:real^3`] lemma) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THENL + [ASM_REWRITE_TAC[INTER_IDEMPOT; SUBSET_REFL]; + ASM_REWRITE_TAC[GSYM SEGMENT_CONVEX_HULL; HULL_SUBSET]]]]);; + + + +(* Hoang Le Truong's additions start here. *) + +let fchanged=new_definition`fchanged f={v| ?v1 t. v=t% v1 /\ v1 IN (relative_interior f)/\ t> &0}`;; + +let CONVEX_RELATIVE_INTERIOR=prove(`!p:real^3->bool. + polyhedron p +==> convex (relative_interior p) `, +let LEMMA=prove(`!f:(real^3->bool)->bool (a:(real^3->bool)->real^3) (b:(real^3->bool)->real). +{x | !h. h IN f ==> a h dot x < b h}=INTERS{{x | a h dot x < b h}| h IN f} `, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[INTERS;IN_ELIM_THM;] +THEN ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN ASM_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th`h:real^3->bool`); + DISCH_THEN(LABEL_TAC"LINH") +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`?(h':real^3->bool). h' IN f /\ {x | (a:(real^3->bool)->real^3) h dot x < (b:(real^3->bool)->real) h} = {x | a h' dot x < b h'}`ASSUME_TAC +THENL[ +EXISTS_TAC`h:real^3->bool` +THEN ASM_REWRITE_TAC[]; +REMOVE_THEN "LINH"(fun th-> MRESAL1_TAC th`{x:real^3 | (a:(real^3->bool)->real^3) (h:real^3->bool) dot x < (b:(real^3->bool)->real) h}`[IN_ELIM_THM])]])in + +REPEAT STRIP_TAC THEN FIRST_ASSUM + (MP_TAC o GEN_REWRITE_RULE I [POLYHEDRON_INTER_AFFINE_MINIMAL]) THEN + REWRITE_TAC[RIGHT_IMP_EXISTS_THM; SKOLEM_THM] THEN + SIMP_TAC[LEFT_IMP_EXISTS_THM; RIGHT_AND_EXISTS_THM; LEFT_AND_EXISTS_THM] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC RELATIVE_INTERIOR_POLYHEDRON_EXPLICIT[`p:real^3->bool`;`f:(real^3->bool)->bool`;`a:(real^3->bool)->real^3`;`b:(real^3->bool)->real`] +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th])`(p:real^3->bool) = affine hull p INTER INTERS f` +THEN REWRITE_TAC[] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{x | x IN p /\ (!h. h IN f ==> a h dot x < b h)}= p INTER {x | (!h. h IN f ==> a h dot x < b h)}`] +THEN MATCH_MP_TAC CONVEX_INTER +THEN MRESA1_TAC POLYHEDRON_EQ_FINITE_FACES`p:real^3->bool` +THEN MRESA_TAC LEMMA [`f:(real^3->bool)->bool`;`(a:(real^3->bool)->real^3)`; `(b:(real^3->bool)->real)`] +THEN MATCH_MP_TAC CONVEX_INTERS +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[CONVEX_HALFSPACE_LT]);; + + +let CONVEX_RELATIVE_INTERIOR_FACE=prove(`!p f:(real^3->bool). + polyhedron p +/\ f face_of p +==> convex (relative_interior f) `, + +REPEAT STRIP_TAC +THEN MRESA_TAC FACE_OF_POLYHEDRON_POLYHEDRON[`p:(real^3->bool)`;`f:real^3->bool`] +THEN MRESA1_TAC CONVEX_RELATIVE_INTERIOR`f:(real^3->bool)`);; + +let CONVEX_RELATIVE_INTERIOR_FACET=prove(`!p f:(real^3->bool). + polyhedron p +/\ f facet_of p +==> convex (relative_interior f) `, +REPEAT STRIP_TAC +THEN MRESA_TAC CONVEX_RELATIVE_INTERIOR_FACE[`p:(real^3->bool)`;`f:real^3->bool`] +THEN MRESA_TAC FACET_OF_IMP_FACE_OF[`f:(real^3->bool)`;`p:(real^3->bool)`]);; + +let CONNECTED_RELATIVE_INTERIOR_FACET=prove(`!p f:(real^3->bool). + polyhedron p +/\ f facet_of p +==> connected (relative_interior f) `, +REPEAT STRIP_TAC +THEN MRESA_TAC CONVEX_RELATIVE_INTERIOR_FACET[`p:(real^3->bool)`;`f:real^3->bool`] +THEN MRESA1_TAC CONVEX_CONNECTED `relative_interior f:(real^3->bool)`);; + +let CONNECTED_HALF_LINE=prove(`!x:real^3 v. connected(aff_gt {x} {v})`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC CONVEX_CONNECTED +THEN SIMP_TAC[CONVEX_AFF_GT]);; + + + +let RELATIVE_SUBSET_FCHANGE=prove(`!p x f:(real^3->bool). + bounded p /\ polyhedron p /\ x IN interior p +/\ f facet_of p +==> (relative_interior f) SUBSET fchanged f`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[SUBSET; fchanged;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`x':real^3` +THEN EXISTS_TAC `&1` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1> &0`;VECTOR_ARITH`A= &1 %A`]);; + + + +let AFF_GT_SUBSET_FCHANGED=prove(`!p x f:(real^3->bool) y. + bounded p /\ polyhedron p /\ x IN interior p +/\ f facet_of p +/\ y IN (relative_interior f) +==> {v| ?t. &0< t /\ v=t%y} SUBSET fchanged f `, +REWRITE_TAC[fchanged;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`y:real^3` +THEN EXISTS_TAC`t:real` +THEN ASM_REWRITE_TAC[REAL_ARITH` t> &0<=> &0< t`]);; + + + +let CONNECTED_HALF_LINE1=prove(`!y:real^3. connected {v| ?t. &0< t /\ v=t%y}`, +let LEMMA=prove(`!x:real^3. ~(x= vec 0)==>aff_gt {vec 0} {x}= {v| ?t. &0< t /\ v=t%x}`, + +REPEAT STRIP_TAC +THEN MRESAL_TAC AFF_GT_1_1[`(vec 0):real^3`;`x:real^3`][SET_RULE`DISJOINT {vec 0} {x} <=> ~(x= vec 0)`;VECTOR_ARITH`t % (vec 0)+A=A:real^3`;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +REPEAT STRIP_TAC +THEN EXISTS_TAC`t2:real` +THEN ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC +THEN EXISTS_TAC`&1-t:real` +THEN EXISTS_TAC`t:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1-t+t= &1`]]) in + +REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(y= vec 0)\/ ~(y:real^3 = vec 0)`) +THENL[ +ASM_REWRITE_TAC[VECTOR_ARITH`t % vec 0= vec 0`] +THEN SUBGOAL_THEN`{v:real^3 | ?t. &0 < t /\ v = vec 0}= {vec 0}` ASSUME_TAC +THENL[ +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +STRIP_TAC THEN ASM_REWRITE_TAC[]; +STRIP_TAC THEN EXISTS_TAC`&1` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1`]]; + +ASM_REWRITE_TAC[CONNECTED_SING]]; + +MRESA1_TAC LEMMA`y:real^3` +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC CONNECTED_HALF_LINE[`vec 0:real^3`;`y:real^3`]]);; + + +let CONNECTED_COMPONENT_OF_SUBSET = prove + (`!s t x y. s SUBSET t /\ connected_component s x y + ==> connected_component t x y`, + REWRITE_TAC[connected_component] THEN SET_TAC[]);; + +let CONNECTED_COMPONENT_TRANS = prove + (`!s x y z:real^N. + connected_component s x y /\ connected_component s y z + ==> connected_component s x z`, + REPEAT GEN_TAC THEN REWRITE_TAC[connected_component] THEN + DISCH_THEN(CONJUNCTS_THEN2 (X_CHOOSE_TAC `t:real^N->bool`) + (X_CHOOSE_TAC `u:real^N->bool`)) THEN + EXISTS_TAC `t UNION u:real^N->bool` THEN + ASM_REWRITE_TAC[IN_UNION; UNION_SUBSET] THEN + MATCH_MP_TAC CONNECTED_UNION THEN ASM SET_TAC[]);; + + + +let CONNECTED_FCHANGED=prove(`!p x f:(real^3->bool). + bounded p /\ polyhedron p /\ x IN interior p +/\ f facet_of p +==> connected (fchanged f) `, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[CONNECTED_IFF_CONNECTED_COMPONENT;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[fchanged] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[fchanged] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN`x' IN {v| ?t. &0< t /\ v=t % v1:real^3}`ASSUME_TAC +THENL[ +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`t:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< t<=> t> &0`]; + +SUBGOAL_THEN`v1 IN {v| ?t. &0< t /\ v=t % v1:real^3}`ASSUME_TAC +THENL[ +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`&1:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`&1 %A=A`] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +MRESA1_TAC CONNECTED_HALF_LINE1`v1:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONNECTED_IFF_CONNECTED_COMPONENT] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`x':real^3`;`v1:real^3`]) +THEN SUBGOAL_THEN`y IN {v| ?t. &0< t /\ v=t % v1':real^3}`ASSUME_TAC +THENL[ +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`t':real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< t' <=> t'> &0`]; + +SUBGOAL_THEN`v1' IN {v| ?t. &0< t /\ v=t % v1':real^3}`ASSUME_TAC +THENL[ +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`&1:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`&1 %A=A`] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + + +MRESA1_TAC CONNECTED_HALF_LINE1`v1':real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONNECTED_IFF_CONNECTED_COMPONENT] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`v1':real^3`;`y:real^3`;]) +THEN MRESA_TAC CONNECTED_RELATIVE_INTERIOR_FACET[`p:real^3->bool`;`f:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONNECTED_IFF_CONNECTED_COMPONENT] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`v1:real^3`;`v1':real^3`;]) +THEN MRESA_TAC AFF_GT_SUBSET_FCHANGED[`p:real^3->bool`;`x:real^3`;`f:real^3->bool`;`v1:real^3`] +THEN MRESA_TAC AFF_GT_SUBSET_FCHANGED[`p:real^3->bool`;`x:real^3`;`f:real^3->bool`;`v1':real^3`] +THEN MRESA_TAC RELATIVE_SUBSET_FCHANGE[`p:real^3->bool`;`x:real^3`;`f:real^3->bool`;] + THEN MRESA_TAC CONNECTED_COMPONENT_OF_SUBSET[`{v | ?t. &0 < t /\ v = t % v1:real^3}`;`fchanged (f:real^3->bool)`;`t% v1:real^3`;`v1:real^3`] + THEN MRESA_TAC CONNECTED_COMPONENT_OF_SUBSET[`{v | ?t. &0 < t /\ v = t % v1':real^3}`;`fchanged (f:real^3->bool)`;`v1':real^3`;`t'% v1':real^3`] + THEN MRESA_TAC CONNECTED_COMPONENT_OF_SUBSET[`relative_interior (f:real^3->bool)`;`fchanged (f:real^3->bool)`;`v1:real^3`;` v1':real^3`] +THEN MRESA_TAC CONNECTED_COMPONENT_TRANS[`fchanged f:real^3->bool`;`t % v1:real^3`;`v1:real^3`;`v1':real^3`] +THEN MRESA_TAC CONNECTED_COMPONENT_TRANS[`fchanged f:real^3->bool`;`t % v1:real^3`;`v1':real^3`;`t' % v1':real^3`]]]]]);; + + +let CONTINUOUS_ON_LIFT_DOT = prove + (`!s a. (lift o (\y. a dot y)) continuous_on s`, + SIMP_TAC[CONTINUOUS_AT_IMP_CONTINUOUS_ON; CONTINUOUS_AT_LIFT_DOT]);; + + + + +let AFFINITE_HULL_BALL_EQ_UNIV=prove(`!x e. &0< e ==> affine hull ball (x,e) =(:real^3)`, +let delta_func=new_definition`delta_func x y= (if x=y then &1 else &0) ` in +(let func1=new_definition`func1 a x y z= (if x=z then a else (if y= z then (&1- a) else &0)) ` in + +REPEAT STRIP_TAC +THEN REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[AFFINE_HULL_EXPLICIT;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +SET_TAC[]; +STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`x'= x:real^3\/ ~(x'=x)`) +THENL[ +ASM_REWRITE_TAC[] +THEN EXISTS_TAC`{x:real^3}` +THEN EXISTS_TAC`(delta_func (x:real^3))` +THEN REWRITE_TAC[FINITE_SING;SET_RULE`~({x}={})`;SUM_SING;VSUM_SING;delta_func;VECTOR_ARITH`&1 % x=x`;SUBSET;IN_SING] +THEN STRIP_TAC +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[ball;IN_ELIM_THM;dist; VECTOR_ARITH`x-x= vec 0`;NORM_0]; + +ABBREV_TAC`v =(inv(norm (x'-x)) * e/ &2) % (x'-x) +x:real^3` +THEN SUBGOAL_THEN `~(x=v:real^3)` ASSUME_TAC +THENL[ +POP_ASSUM (fun th-> REWRITE_TAC[SYM th; VECTOR_ARITH`A= B+A<=> B= vec 0`; GSYM NORM_EQ_0;NORM_MUL;]) +THEN REWRITE_TAC[REAL_ENTIRE; REAL_ABS_MUL;REAL_ABS_INV;REAL_ABS_NORM;DE_MORGAN_THM] +THEN MRESA_TAC imp_norm_not_zero_fan[`x':real^3`;`x:real^3`] +THEN MRESA_TAC imp_inv_norm_not_zero_fan[`x':real^3`;`x:real^3`] +THEN ASM_TAC +THEN REAL_ARITH_TAC; + +ABBREV_TAC`a= (norm(x'-x:real^3) *inv e * &2)` +THEN EXISTS_TAC`{x,v:real^3}` +THEN EXISTS_TAC `func1 (a:real) v (x:real^3)` +THEN ASM_REWRITE_TAC[SET_RULE`~({x, v} = {})`] +THEN SIMP_TAC[HAS_SIZE; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY;VSUM_CLAUSES;SUM_CLAUSES;func1] +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - a + a + &0 = &1`; VECTOR_ARITH`(&1 - a) % x + a % v + vec 0 = x'<=> a % (v-x) = x'- x`] +THEN EXPAND_TAC"v" +THEN REWRITE_TAC[VECTOR_ARITH`(A+B)-B=A:real^3 /\ a % b % v=(a*b)%v`] +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[REAL_ARITH`(norm (x' - x) * inv e * &2) * inv (norm (x' - x)) * e / &2= ( inv (norm (x' - x)) * norm (x' - x)) *( inv e * e) `] +THEN MRESA_TAC IMP_NORM_FAN[`x':real^3`;`x:real^3`] +THEN MP_TAC(REAL_ARITH`&0< e==> ~(e= &0) /\ &0 <= e`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`e:real` +THEN REWRITE_TAC[VECTOR_ARITH`(&1 * &1) %v= v`;SUBSET;SET_RULE`x IN {y,z}<=> x= y \/ x= z`] +THEN GEN_TAC +THEN STRIP_TAC +THENL[ +ASM_REWRITE_TAC[ball;IN_ELIM_THM;dist; VECTOR_ARITH`x-x= vec 0`;NORM_0]; +ASM_REWRITE_TAC[ball;IN_ELIM_THM;dist; ] +THEN POP_ASSUM (fun th-> REWRITE_TAC[]) +THEN EXPAND_TAC"v" +THEN REWRITE_TAC[VECTOR_ARITH`A-(B+A)= -- B:real^3`; NORM_NEG;NORM_MUL;REAL_ABS_MUL;REAL_ABS_INV;REAL_ABS_NORM;] +THEN ONCE_REWRITE_TAC[ REAL_ARITH`(a * b)* c= (a * c) * b`] +THEN ASM_REWRITE_TAC[REAL_ARITH`abs(e/ &2)= abs(e)/ &2`] +THEN MRESA1_TAC REAL_ABS_REFL`e:real` +THEN ASM_TAC +THEN REAL_ARITH_TAC]]]]));; + + +let INTERIOR_AFFINIE_HUL_EQ_UNIV=prove(`!x p:(real^3->bool). + x IN interior p +==> affine hull p= (:real^3)`, + +REWRITE_TAC[IN_INTERIOR] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC AFFINITE_HULL_BALL_EQ_UNIV[`x:real^3`;`e:real`] +THEN MRESA_TAC HULL_MONO [`affine:(real^3->bool)->bool`;`ball(x:real^3,e)`;`p:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + + +let AFF_DIM_INTERIOR_EQ_3=prove(`!x p:(real^3->bool). + x IN interior p +==> aff_dim p= &3`, + +REPEAT STRIP_TAC +THEN MRESA_TAC INTERIOR_AFFINIE_HUL_EQ_UNIV[`x:real^3`;`p:real^3->bool`] +THEN MRESA1_TAC AFF_DIM_AFFINE_HULL`p:real^3->bool` +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN SIMP_TAC[AFF_DIM_UNIV;DIMINDEX_3]);; + + + +let INTERIOR_IMP_RELATIVE_INTERIOR=prove(`!x p:(real^3->bool). + x IN interior p +==> x IN relative_interior p`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[RELATIVE_INTERIOR;IN_ELIM_THM] +THEN MRESA1_TAC INTERIOR_SUBSET`p:real^3->bool` +THEN MP_TAC(SET_RULE`x IN interior p /\ interior p SUBSET p ==> (x:real^3) IN p`) +THEN RESA_TAC +THEN MRESA_TAC INTERIOR_AFFINIE_HUL_EQ_UNIV[`x:real^3`;`p:real^3->bool`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[interior;IN_ELIM_THM; SET_RULE`t INTER (:real^3)= (t:real^3->bool)`]);; + + + + +let IN_RELATIVE_INTERIOR1 = prove + (`!x:real^N s. + x IN relative_interior s ==> + ?e. &0 < e /\ (ball(x,e) INTER (affine hull s)) SUBSET relative_interior s`, + + REPEAT GEN_TAC THEN REWRITE_TAC[IN_RELATIVE_INTERIOR; IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[SUBSET ;IN_RELATIVE_INTERIOR; IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THENL[ASM_TAC THEN SET_TAC[]; + + +MP_TAC(SET_RULE`x' IN ball (x,e) INTER affine hull s ==> x' IN ball (x:real^N,e)`) +THEN RESA_TAC +THEN MRESAL_TAC OPEN_BALL[`x:real^N`;`e:real`][open_def] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x':real^N`) +THEN SUBGOAL_THEN`ball(x':real^N,e') SUBSET ball(x,e)` ASSUME_TAC +THENL[ +REWRITE_TAC[SUBSET] +THEN GEN_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[ball;IN_ELIM_THM;] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]; + EXISTS_TAC`e':real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN ASM_TAC +THEN SET_TAC[]]]);; + + + + +let FCHANGED_OPEN=prove(`!p f:(real^3->bool). + bounded p /\ polyhedron p /\ vec 0 IN interior p +/\ f facet_of p +==> open (fchanged f) `, + +REPEAT STRIP_TAC THEN FIRST_ASSUM + (MP_TAC o GEN_REWRITE_RULE I [POLYHEDRON_INTER_AFFINE_MINIMAL]) THEN + REWRITE_TAC[RIGHT_IMP_EXISTS_THM; SKOLEM_THM] THEN + SIMP_TAC[LEFT_IMP_EXISTS_THM; RIGHT_AND_EXISTS_THM; LEFT_AND_EXISTS_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN STRIP_TAC +THEN MRESA_TAC FACET_OF_POLYHEDRON_EXPLICIT[`p:real^3->bool`;`f':(real^3->bool)->bool`;`a:(real^3->bool)->real^3`;`b:(real^3->bool)->real`] +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th])`p = affine hull p INTER INTERS (f':(real^3->bool)->bool)` +THEN REWRITE_TAC[open_def] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th `f:real^3->bool`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC(SYM th)) +THEN GEN_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[fchanged] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC CONTINUOUS_ON_LIFT_DOT[`(:real^3)`;`(a:(real^3->bool)->real^3) (h:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[continuous_on;] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th `v1:real^3`[SET_RULE`v1 IN (:real^3)`;o_DEF;dist;GSYM LIFT_SUB]) +THEN POP_ASSUM MP_TAC +THEN MRESA1_TAC RELATIVE_INTERIOR_SUBSET`f:real^3->bool` +THEN MP_TAC(SET_RULE`(v1:real^3) IN relative_interior f /\ relative_interior f SUBSET f /\ p INTER {x | a h dot x = b h} = f +==> v1 IN {x | a (h:real^3->bool) dot x = b h}`) +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN SUBGOAL_THEN`affine hull f= {x | (a:(real^3->bool)->real^3) (h:real^3->bool) dot x = b h}` ASSUME_TAC +THENL(*1*)[ + +FIND_ASSUM(MP_TAC)`f facet_of (p:real^3->bool)` +THEN REWRITE_TAC[facet_of] +THEN MRESA_TAC AFF_DIM_INTERIOR_EQ_3[`vec 0:real^3`;`p:real^3->bool`] +THEN STRIP_TAC +THEN USE_THEN "LINH1"(fun th-> MP_TAC(ISPEC `h:real^3->bool` th)) +THEN FIND_ASSUM (fun th-> REWRITE_TAC[th])`(h:real^3->bool) IN f'` +THEN STRIP_TAC +THEN MRESA_TAC AFF_DIM_HYPERPLANE[`(a:(real^3->bool)->real^3) (h:real^3->bool)`; +`(b:(real^3->bool)->real) (h:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[DIMINDEX_3] +THEN STRIP_TAC +THEN MRESA_TAC AFFINE_HYPERPLANE[`(a:(real^3->bool)->real^3) (h:real^3->bool)`; +`(b:(real^3->bool)->real) (h:real^3->bool)`] +THEN MRESA1_TAC AFFINE_HULL_EQ`{x | (a:(real^3->bool)->real^3) (h:real^3->bool) dot x = b h}` +THEN MRESA_TAC AFF_DIM_EQ_AFFINE_HULL[`f:real^3->bool`;`{x | (a:(real^3->bool)->real^3) (h:real^3->bool) dot x = b h}`] +THEN POP_ASSUM MATCH_MP_TAC +THEN STRIP_TAC +THENL[ ASM_TAC THEN SET_TAC[];ARITH_TAC];(*1*) + +MRESA_TAC IN_RELATIVE_INTERIOR1[`v1:real^3`;`f:real^3->bool`] +THEN MRESA_TAC IN_RELATIVE_INTERIOR[`v1:real^3`;`f:real^3->bool`] +THEN ABBREV_TAC`r1= min (inv(norm (v1:real^3)) *e / &6) (&1) / &2 ` +THEN ABBREV_TAC`r2= abs((b:(real^3->bool)->real) (h:real^3->bool)) * r1 / &2` +THEN MRESA1_TAC RELATIVE_INTERIOR_OF_POLYHEDRON`p:real^3->bool` +THEN MRESA_TAC INTERIOR_IMP_RELATIVE_INTERIOR[`vec 0:real^3`;`p:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[DIFF;IN_ELIM_THM] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`~(vec 0 IN UNIONS {f | f facet_of p}) /\ v1 IN f /\ f facet_of p==> ~(v1 = vec 0:real^3)`) +THEN RESA_TAC +THEN MRESAL_TAC IMP_NORM_FAN[`v1:real^3`;`vec 0:real^3`][VECTOR_ARITH`a - vec 0 = a`] +THEN MRESA_TAC REAL_LT_MUL[`inv(norm (v1:real^3))`;`e:real`] +THEN MP_TAC(REAL_ARITH`&0< inv (norm (v1:real^3)) * e ==> &0 < min (inv (norm v1) * e / &6) (&1) / &2 `) +THEN RESA_TAC +THEN USE_THEN "LINH1"(fun th-> MP_TAC(ISPEC `h:real^3->bool` th)) +THEN FIND_ASSUM (fun th-> REWRITE_TAC[th])`(h:real^3->bool) IN f'` +THEN STRIP_TAC +THEN MRESA1_TAC REAL_ABS_CASES`(b:(real^3->bool)->real) (h:real^3->bool)` +THENL(*2*)[ + +SUBGOAL_THEN `vec 0 IN {x | (a:(real^3->bool)->real^3) (h:real^3->bool) dot x = b h}` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[IN_ELIM_THM;DOT_RZERO]; + +MP_TAC(SET_RULE`p INTER {x | a h dot x = b h} = f /\ vec 0 IN {x | (a:(real^3->bool)->real^3) (h:real^3->bool) dot x = b h} /\ vec 0 IN p ==> vec 0 IN f `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(vec 0 IN UNIONS {f | f facet_of (p:real^3->bool)}) /\ vec 0 IN f /\ f facet_of p ==> F`) +THEN ASM_REWRITE_TAC[]];(*2*) + +MRESA_TAC REAL_LT_MUL[`abs ((b:(real^3->bool)->real) (h:real^3->bool))`;`r1:real`] +THEN MP_TAC(REAL_ARITH`&0 < abs ((b:(real^3->bool)->real) (h:real^3->bool)) * r1 ==> &0 < abs (b h) * r1/ &2`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th`r2:real`) +THEN SUBGOAL_THEN`!y:real^3. norm(y-v1)< d ==> ?t1. abs(&1- t1)< r1 /\ &0 < t1 /\ t1 % y IN {x | (a:(real^3->bool)->real^3) (h:real^3->bool) dot x = b h}` +ASSUME_TAC +THENL(*3*)[ +POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"LINH2") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "LINH2"(fun th-> MRESA1_TAC th`y:real^3`) +THEN REWRITE_TAC[IN_ELIM_THM;DOT_RMUL] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NORM_LIFT] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`min (inv (norm (v1:real^3)) * e / &6) (&1) / &2 = r1 ==> r1< &1`) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LT_LMUL[`abs ((b:(real^3->bool)->real) (h:real^3->bool))`;`r1:real`;`&1`][REAL_ARITH`a* &1=a`] +THEN MP_TAC(REAL_ARITH`abs ((b:(real^3->bool)->real) (h:real^3->bool)) * r1 < abs (b h) ==> abs (b h) * r1 / &2 < abs (b h)/ &2`) +THEN RESA_TAC +THEN MRESAL_TAC REAL_SUB_ABS[`(b:(real^3->bool)->real) (h:real^3->bool)`;`(b:(real^3->bool)->real) (h:real^3->bool) - (a:(real^3->bool)->real^3) (h:real^3->bool) dot y`;][REAL_ARITH`A- (A-B)=B`] +THEN MP_TAC(REAL_ARITH`abs ((a:(real^3->bool)->real^3) (h:real^3->bool) dot y - b h) < r2 /\ r2 < abs ((b:(real^3->bool)->real) (h:real^3->bool)) / &2 /\ abs (b h) - abs (b h - a h dot y) <= abs (a h dot y)==> &0 < abs (a h dot y ) /\ abs((b:(real^3->bool)->real) (h:real^3->bool))/ &2 < abs (a h dot y )`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_ABS_NZ`(a:(real^3->bool)->real^3) (h:real^3->bool) dot y` +THEN MRESA1_TAC REAL_ABS_NZ`(b:(real^3->bool)->real) (h:real^3->bool) ` +THEN EXISTS_TAC`inv((a:(real^3->bool)->real^3) (h:real^3->bool) dot y) * (b:(real^3->bool)->real) (h:real^3->bool)` +THEN ONCE_REWRITE_TAC[REAL_ARITH`(a * b)* c= (a * c) * b`] +THEN MRESA1_TAC REAL_MUL_LINV`(a:(real^3->bool)->real^3) (h:real^3->bool) dot y` +THEN REWRITE_TAC[REAL_ARITH`&1 * a= a`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[REAL_ARITH`a * b - a * c= a*(b-c)`] +THEN MP_TAC(REAL_ARITH`&0< abs((b:(real^3->bool)->real) (h:real^3->bool)) ==> &0< abs((b:(real^3->bool)->real) (h:real^3->bool))/ &2`) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LT_INV2[`abs((b:(real^3->bool)->real) (h:real^3->bool)/ &2)`;`abs((a:(real^3->bool)->real^3) (h:real^3->bool) dot y)`][REAL_ARITH`abs(a/ &2)= abs a/ &2`] +THEN REWRITE_TAC[REAL_ABS_MUL;REAL_ABS_INV] +THEN MRESAL_TAC REAL_LT_MUL2[`inv(abs((a:(real^3->bool)->real^3) (h:real^3->bool) dot y))`;`inv (abs ((b:(real^3->bool)->real) (h:real^3->bool)) / &2)`;`abs ((a:(real^3->bool)->real^3) (h:real^3->bool) dot y- (b:(real^3->bool)->real) (h:real^3->bool))`;`r2:real`][REAL_ABS_POS] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM REAL_ABS_INV;REAL_ABS_POS] +THEN REWRITE_TAC[REAL_ABS_INV] +THEN MP_TAC(REAL_ARITH`&0< abs((b:(real^3->bool)->real) (h:real^3->bool))/ &2 ==> ~(abs(b h)/ &2 = &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`abs((b:(real^3->bool)->real) (h:real^3->bool))/ &2` +THEN EXPAND_TAC"r2" +THEN REWRITE_TAC[REAL_ARITH`inv (abs (b h) / &2) * abs (b h) * r1 / &2= (inv (abs (b h) / &2) * (abs (b h) / &2)) * r1`] +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 * a= a`] +THEN RESA_TAC +THEN MP_TAC (REAL_ARITH`~((b:(real^3->bool)->real) (h:real^3->bool) = &0)==> &0< (b:(real^3->bool)->real) (h:real^3->bool) \/ &0< -- (b:(real^3->bool)->real) (h:real^3->bool)`) +THEN RESA_TAC + +THENL[ + +MRESA_TAC REAL_ABS_BETWEEN[`(b:(real^3->bool)->real) (h:real^3->bool)`;`(a:(real^3->bool)->real^3) (h:real^3->bool) dot y`;`r2:real`] +THEN MP_TAC(REAL_ARITH`r2 < abs ((b:(real^3->bool)->real) (h:real^3->bool)) / &2 /\ &0< b h /\ b h - r2 < a h dot y ==> &0 < (a:(real^3->bool)->real^3) (h:real^3->bool) dot y`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`(a:(real^3->bool)->real^3) (h:real^3->bool) dot y` +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[]; + + +MRESA_TAC REAL_ABS_BETWEEN[`(b:(real^3->bool)->real) (h:real^3->bool)`;`(a:(real^3->bool)->real^3) (h:real^3->bool) dot y`;`r2:real`] +THEN MP_TAC(REAL_ARITH`r2 < abs ((b:(real^3->bool)->real) (h:real^3->bool)) / &2 /\ &0< --b h /\ a h dot y< b h + r2 ==> &0 < -- ((a:(real^3->bool)->real^3) (h:real^3->bool) dot y)`) +THEN RESA_TAC +THEN MRESAL1_TAC REAL_LT_INV`--((a:(real^3->bool)->real^3) (h:real^3->bool) dot y)`[REAL_INV_NEG] +THEN MRESAL_TAC REAL_LT_MUL[`-- inv ((a:(real^3->bool)->real^3) (h:real^3->bool) dot y)`;`--((b:(real^3->bool)->real) (h:real^3->bool) )`][REAL_ARITH`-- a * -- b= a* b`]]; (*3*) + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH2") +THEN ABBREV_TAC`r3= min (e:real / &12) (d/ &2)` +THEN SUBGOAL_THEN `!y:real^3. norm(y- v1)< r3 ==> ?t1. &0< t1/\ t1 % y IN relative_interior (f:real^3->bool) ` ASSUME_TAC +THENL(*4*)[ + +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0< d /\ min (e / &12) (d / &2) = r3 /\ norm (y - (v1:real^3)) < r3 ==> norm (y - v1) < d`) +THEN RESA_TAC +THEN REMOVE_THEN "LINH2"(fun th-> MRESA1_TAC th `y:real^3`) +THEN EXISTS_TAC `t1:real` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC (SET_RULE`!A B C x. A INTER B SUBSET C /\ x IN A /\ x IN B==> x IN C`) +THEN EXISTS_TAC `ball(v1:real^3,e)` +THEN EXISTS_TAC`{x | (a:(real^3->bool)->real^3) (h:real^3->bool) dot x = (b:(real^3->bool)->real) (h:real^3->bool)}` +THEN ASM_REWRITE_TAC[ball;IN_ELIM_THM;dist] +THEN MRESAL_TAC NORM_TRIANGLE[`(&1- t1) % v1:real^3`;`t1%(v1- y:real^3)`][VECTOR_ARITH`(&1 - t1) % v1 + t1 % (v1 - y)= v1- t1 % y`; NORM_MUL] +THEN MRESA_TAC REAL_LT_RMUL [`abs(&1- t1:real)`;`r1:real`;`norm (v1:real^3)`] +THEN MP_TAC (REAL_ARITH`&0< r1 /\ min (inv (norm (v1:real^3)) * e / &6) (&1) / &2 = r1 ==> r1 <= inv (norm v1) * e / &6/\ r1<= &1/ &2`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_RMUL [`r1:real`;`(inv (norm( v1:real^3)) * e / &6)`;`norm (v1:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[REAL_ARITH`(a * b/ &6) *c= (a * c) * b/ &6`] +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 *A=A`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`abs (&1 - t1) * norm v1 < r1 * norm (v1:real^3) /\ + r1 * norm v1<= e/ &6 ==> abs (&1 - t1) * norm v1 < e/ &6`) +THEN RESA_TAC +THEN MRESA_TAC REAL_ABS_BETWEEN[`t1:real`;`&1`;`r1:real`] +THEN MP_TAC(REAL_ARITH`t1- r1< &1 /\ r1<= &1/ &2 ==> t1< &2`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0< t1==> &0<= t1`) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LT_MUL2[`t1:real`;`&2`;`norm(y- v1:real^3)`;`r3:real`][NORM_POS_LE; NORM_SUB] +THEN MP_TAC(REAL_ARITH`min (e / &12) (d / &2) = r3 /\ &0< e /\ &0< d ==> &2 * r3<= e/ &6 `) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t1 * norm (v1 - y:real^3) < &2 * r3 /\ &2 * r3<= e/ &6 ==> t1 * norm (v1 - y) < e/ &6 `) +THEN RESA_TAC +THEN MRESA1_TAC REAL_ABS_REFL`t1:real` +THEN MRESA_TAC REAL_LT_ADD2[`abs (&1 - t1) * norm (v1:real^3)`;`e/ &6`;`abs t1 * norm (v1 - y:real^3)`;`e/ &6`;] +THEN MP_TAC(REAL_ARITH` abs (&1 - t1) * norm v1 + abs t1 * norm (v1 - y) < e/ &6 + e/ &6 /\ &0< e +/\ norm (v1 - t1 % y) <= abs (&1 - t1) * norm v1 + abs t1 * norm (v1 - y) ==> norm (v1 - t1 % y:real^3) < e`) +THEN ASM_REWRITE_TAC[]; + + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH3") +THEN EXISTS_TAC`t * r3:real` +THEN MP_TAC(REAL_ARITH`&0< e /\ &0< d==> &0< min (e / &12) (d / &2)`) +THEN RESA_TAC +THEN STRIP_TAC +THENL(*5*)[ +MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[REAL_ARITH`&0< t<=> t> &0`] +THEN ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC +THEN REWRITE_TAC[fchanged;IN_ELIM_THM] +THEN MP_TAC(REAL_ARITH`t > &0 ==> &0< t /\ ~(t= &0) /\ &0<= t`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`t:real` +THEN MRESA1_TAC REAL_LE_INV`t:real` +THEN MRESA1_TAC REAL_MUL_LINV`t:real` +THEN MRESA1_TAC REAL_ABS_REFL`inv t:real` +THEN MRESAL_TAC NORM_MUL[`inv t:real`;`x' - t % v1:real^3`][VECTOR_ARITH`inv t % (x' - t % v1)=inv t % x' -(inv t * t) % v1 /\ &1 %a=a`] +THEN MRESAL_TAC REAL_LT_LMUL[`inv (t:real)`;`norm (x' - t % v1:real^3)`;`t * r3:real`][REAL_ARITH`A *B *C= (A* B) *C/\ &1 *A=A`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN REMOVE_THEN "LINH3"(fun th-> MRESAL1_TAC th `(inv t) % (x':real^3)`[VECTOR_ARITH`a %b % v= (a * b)%v`]) +THEN MRESA_TAC REAL_LT_MUL[`t1:real`;`inv t:real`] +THEN MRESA1_TAC REAL_LT_INV`t1 * inv t:real` +THEN EXISTS_TAC`(t1 * inv t) % x':real^3` +THEN EXISTS_TAC`inv(t1 * inv t) :real` +THEN ASM_REWRITE_TAC[REAL_ARITH`t> &0 <=> &0 < t`;VECTOR_ARITH`a %b % v= (a * b)%v`] +THEN MP_TAC(REAL_ARITH`&0 < t1 * inv t==> ~(t1 * inv t= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t1 * inv t:real` +THEN VECTOR_ARITH_TAC]]]]]);; + + + + +let FCHANGED_ONE_TO_ONE=prove(`!p f1 f2:real^3->bool. + bounded p /\ polyhedron p /\ vec 0 IN interior p /\ f1 facet_of p + /\ f2 facet_of p /\ ~(fchanged f1 INTER fchanged f2= {}) +==> f1=f2`, + +REWRITE_TAC[SET_RULE`~(A= {})<=> ?y. y IN A`; fchanged;INTER;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN REPEAT STRIP_TAC +THEN MRESA1_TAC RELATIVE_INTERIOR_SUBSET`f1:real^3->bool` +THEN MRESA1_TAC RELATIVE_INTERIOR_SUBSET`f2:real^3->bool` +THEN MP_TAC(SET_RULE`v1 IN relative_interior f1 /\ v1' IN relative_interior f2 /\ relative_interior f2 SUBSET f2 /\ relative_interior f1 SUBSET f1 +==> v1 IN (f1:real^3->bool) /\ v1' IN (f2:real^3->bool)`) +THEN RESA_TAC +THEN FIND_ASSUM(MP_TAC)`f1 facet_of (p:real^3->bool)` +THEN FIND_ASSUM(MP_TAC)`f2 facet_of (p:real^3->bool)` +THEN REWRITE_TAC[facet_of] +THEN MRESA_TAC AFF_DIM_INTERIOR_EQ_3[`vec 0:real^3`;`p:real^3->bool`] +THEN DISJ_CASES_TAC(SET_RULE`f1= p \/ ~(f1= p:real^3->bool)`) +THENL[ +ASM_REWRITE_TAC[] +THEN ARITH_TAC; +DISJ_CASES_TAC(SET_RULE`f2= p \/ ~(f2= p:real^3->bool)`) +THENL[ + +ASM_REWRITE_TAC[] +THEN ARITH_TAC; +REPEAT STRIP_TAC +THEN MRESA_TAC POLYHEDRON_COLLINEAR_FACES[`p:real^3->bool`;`f1:real^3->bool`;`f2:real^3->bool`;`v1:real^3`;`v1':real^3`;`t:real`;`t':real`] +THEN REMOVE_THEN "LINH1" MP_TAC +THEN RESA_TAC +THEN MP_TAC(SET_RULE`t' % v1 = t' % v1'==> inv t' % (t' % v1) = inv t' % (t' % v1':real^3)`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[VECTOR_ARITH`A%B%v=(A*B)%v`] +THEN MP_TAC(REAL_ARITH`t'> &0 ==> ~(t'= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t':real` +THEN REWRITE_TAC[VECTOR_ARITH`&1 %A=A`] +THEN STRIP_TAC +THEN MATCH_MP_TAC FACE_OF_EQ +THEN EXISTS_TAC`p:real^3->bool` +THEN ASM_REWRITE_TAC[DISJOINT;SET_RULE`~(A= {})<=> ?y. y IN A`;INTER;IN_ELIM_THM] +THEN EXISTS_TAC `v1:real^3` +THEN ASM_REWRITE_TAC[]]]);; + + + + +let CARD_EXISTS_2=prove(`!e:A->bool. + FINITE e /\ CARD e=2 +==> ?v:A w:A. e={v,w}`, + +REPEAT GEN_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN `~((e:A->bool)={})` ASSUME_TAC +THENL[ +STRIP_TAC +THEN MP_TAC(ISPEC`(e:A->bool)`CARD_EQ_0) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MP_TAC(SET_RULE `~((e:A->bool)={})==> ?v:A. v IN e`) +THEN RESA_TAC +THEN SUBGOAL_THEN`~((e:A->bool) DELETE v={})` ASSUME_TAC +THENL[ +STRIP_TAC +THEN MP_TAC(ISPECL[`v:A`;`(e:A->bool)`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(e:A->bool)`;`v:A`] FINITE_DELETE) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(e:A->bool) DELETE v`CARD_EQ_0) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MP_TAC(SET_RULE `~((e:A->bool)DELETE v={})==> ?w:A. w IN (e:A->bool)DELETE v/\ w IN e`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `(v IN (e:A->bool))/\ (w IN (e:A->bool))==> {v,w} SUBSET e`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `(w IN (e:A->bool)DELETE v)==> ~(v=w)`) +THEN RESA_TAC +THEN MP_TAC(ISPECL [`{v:A,w:A}`;`(e:(A->bool))`] FINITE_SUBSET) +THEN RESA_TAC +THEN ASSUME_TAC(SET_RULE `v:A IN {v:A,w:A} `) +THEN MP_TAC(ISPECL[`v:A`;`{v:A,w:A}`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `v IN {v,w}==>{v:A,w:A} DELETE v PSUBSET {v,w}`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`{v:A,w:A} DELETE v`;`{v:A,w:A}`]CARD_PSUBSET) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`FINITE {v:A,w:A}` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN DISCH_TAC +THEN MP_TAC(ARITH_RULE`CARD ({v, w} DELETE v) < CARD {v, w}/\ CARD ({v, w} DELETE v) = CARD {v, w}-1 +<=>CARD ({v, w} DELETE v) +1= CARD {v:A, w:A}`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th;]) +THEN REWRITE_TAC[ARITH_RULE`A=A`] +THEN DISCH_TAC +THEN SUBGOAL_THEN `w:A IN ({v:A,w:A} DELETE v)` ASSUME_TAC +THENL[ +ASM_SET_TAC[]; +MP_TAC(ISPECL[`{v:A,w:A}`;`v:A`] FINITE_DELETE) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`w:A`;`{v:A,w:A} DELETE v`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `w IN ({v,w} DELETE v)==>{v:A,w:A} DELETE v DELETE w PSUBSET {v,w} DELETE v`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`{v:A,w:A} DELETE v DELETE w`;`{v:A,w:A} DELETE v`]CARD_PSUBSET) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`FINITE ({v:A,w:A} DELETE v)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN DISCH_TAC +THEN MP_TAC(ARITH_RULE`CARD ({v, w} DELETE v DELETE w) < CARD ({v, w} DELETE v)/\ CARD ({v, w} DELETE v DELETE w) = CARD ({v, w} DELETE v)-1 +<=>CARD ({v, w} DELETE v DELETE w) +1= CARD ({v:A, w:A} DELETE v)`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th;]) +THEN REWRITE_TAC[ARITH_RULE`A=A`] +THEN DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[]) +THEN POP_ASSUM (fun th->REWRITE_TAC[]) +THEN ASSUME_TAC(SET_RULE `{v, w} DELETE v:A DELETE w:A={}`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th;CARD_CLAUSES; ARITH_RULE `0+1=1`]) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"B") +THEN DISCH_TAC +THEN REMOVE_THEN "B" MP_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th);ARITH_RULE` 1+1=2`]) +THEN FIND_ASSUM MP_TAC`CARD (e:A->bool)=2` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`{v:A,w:A}`;`e:A->bool`]CARD_SUBSET_EQ) +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) +THEN RESA_TAC +THEN EXISTS_TAC`v:A` +THEN EXISTS_TAC`w:A` +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)])]]]);; + + +let EXISTS_EDGE_POLYTOPE=prove(`!p:real^3->bool. + bounded p /\ polyhedron p /\ vec 0 IN interior p +==> ?e. e IN edges p`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[edges;IN_ELIM_THM] +THEN MRESA1_TAC POLYTOPE_EQ_BOUNDED_POLYHEDRON`p:real^3->bool` +THEN MRESA_TAC AFF_DIM_INTERIOR_EQ_3[`vec 0:real^3`;`p:real^3->bool`] +THEN MRESAL1_TAC POLYTOPE_FACET_EXISTS`p:real^3->bool`[ARITH_RULE`&0:int < &3`; facet_of; ARITH_RULE`&3- &1= &2:int`] +THEN MRESA_TAC FACE_OF_POLYTOPE_POLYTOPE[`f:real^3->bool`;`p:real^3->bool`] +THEN MRESAL1_TAC POLYTOPE_FACET_EXISTS`f:real^3->bool`[ARITH_RULE`&0:int < &2`; facet_of; ARITH_RULE`&2- &1= &1:int`] +THEN MRESA1_TAC AFF_DIM`f':real^3->bool` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`&1=A - &1:int <=> A= &2`;INT_OF_NUM_EQ] +THEN STRIP_TAC +THEN MRESA1_TAC AFFINE_INDEPENDENT_IMP_FINITE`b:real^3->bool` +THEN MRESA1_TAC CARD_EXISTS_2`b:real^3->bool` +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC FACE_OF_POLYTOPE_POLYTOPE[`f':real^3->bool`;`f:real^3->bool`] +THEN MRESA1_TAC POLYTOPE_IMP_COMPACT`f':real^3->bool` +THEN MRESA1_TAC POLYTOPE_IMP_CONVEX`f':real^3->bool` +THEN SUBGOAL_THEN`?u v. f' SUBSET affine hull {u,v:real^3}` ASSUME_TAC +THENL[ + EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[HULL_SUBSET]; + MRESAL1_TAC COMPACT_CONVEX_COLLINEAR_SEGMENT`f':real^3->bool`[COLLINEAR_AFFINE_HULL] +THEN MRESA_TAC FACE_OF_TRANS[`f':real^3->bool`;`f:real^3->bool`;`p:real^3->bool`] +THEN EXISTS_TAC`{a,b:real^3}` +THEN EXISTS_TAC`a:real^3` +THEN EXISTS_TAC`b:real^3` +THEN ASM_REWRITE_TAC[edge_of] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])]);; + + + +let EXISTS_EDGE_POLYTOPE1=prove(`!p:real^3->bool. + bounded p /\ polyhedron p /\ vec 0 IN interior p +==> ~(edges p= {})`, +REWRITE_TAC[SET_RULE`~(A= {})<=> ?x. x IN A`;EXISTS_EDGE_POLYTOPE]);; + + + + +let REDUCE_POINT_FACET=prove(`!x p:real^3->bool. + bounded p /\ polyhedron p /\ vec 0 IN interior p +/\ x IN yfan(vec 0,vertices p,edges p) +==> ?f t. &0< t /\ f facet_of p /\ t % x IN f `, + + +REPEAT STRIP_TAC +THEN MRESA_TAC POLYHEDRON_FAN[`p:real^3->bool`;`vec 0:real^3`] +THEN MRESA1_TAC EXISTS_EDGE_POLYTOPE1`p:real^3->bool` +THEN MRESA_TAC x_in_xfan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`] +THEN SUBGOAL_THEN`~(x= vec 0:real^3)`ASSUME_TAC +THENL[ +ASM_TAC +THEN REWRITE_TAC[yfan; DIFF;IN_ELIM_THM] +THEN SET_TAC[]; +MRESA1_TAC POLYTOPE_EQ_BOUNDED_POLYHEDRON`p:real^3->bool` +THEN MRESA1_TAC POLYTOPE_IMP_COMPACT`p:real^3->bool` +THEN MRESA1_TAC INTERIOR_SUBSET`p:real^3->bool` +THEN MP_TAC(SET_RULE`interior p SUBSET p /\ vec 0 IN interior p ==> vec 0 IN (p:real^3->bool)`) +THEN RESA_TAC +THEN MRESA_TAC INTERIOR_AFFINIE_HUL_EQ_UNIV[`vec 0:real^3`;`p:real^3->bool`] +THEN MRESA1_TAC RELATIVE_INTERIOR_INTERIOR`p:real^3->bool` +THEN MRESA1_TAC RELATIVE_FRONTIER_OF_POLYHEDRON`p:real^3->bool` +THEN MRESA1_TAC COMPACT_IMP_CLOSED`p:real^3->bool` +THEN MRESA1_TAC CLOSURE_CLOSED`p:real^3->bool` +THEN MRESAL_TAC COMPACT_FRONTIER_LINE_LEMMA[`p:real^3->bool`;`x:real^3`][frontier;UNIONS;IN_ELIM_THM] +THEN EXISTS_TAC`u':real^3->bool` +THEN EXISTS_TAC`u:real` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0<= u==> u= &0 \/ &0< u`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th; VECTOR_ARITH`&0 % v= vec 0:real^3`] THEN REPEAT STRIP_TAC) +THEN ASM_TAC THEN SET_TAC[]]);; + + + +let aff_ge_1_1_subset_xfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) y:real^3. +FAN(x,V,E) +/\ y IN xfan(x,V,E) /\ ~(x=y) +==> aff_ge {x} {y} SUBSET xfan(x,V,E)`, + +REWRITE_TAC[xfan;IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC expand_edge_graph_fan [`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[IN] +THEN RESA_TAC +THEN EXISTS_TAC`e:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC aff_ge_1_1_subset_aff_ge_fan[`x:real^3`;`v:real^3`;`w:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)] THEN ASM_REWRITE_TAC[] THEN ASSUME_TAC(th)) +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)] THEN GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[IN]THEN ASM_REWRITE_TAC[] THEN ASSUME_TAC(th)) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN SET_TAC[]);; + + +let YFAN_SUBSET_UNIONS_FCHANGED=prove(`!y p:real^3->bool. + bounded p /\ polyhedron p /\ vec 0 IN interior p +/\ y IN yfan(vec 0,vertices p,edges p) +==> y IN UNIONS {fchanged f| f facet_of p}`, + +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[UNIONS;IN_ELIM_THM] +THEN MRESA_TAC REDUCE_POINT_FACET[`y:real^3`;`p:real^3->bool`] +THEN MRESA_TAC FACET_OF_IMP_FACE_OF[`f:real^3->bool`;`p:real^3->bool`] +THEN MRESA_TAC FACE_OF_POLYHEDRON_POLYHEDRON[`p:real^3->bool`;`f:real^3->bool`] +THEN MRESA1_TAC RELATIVE_FRONTIER_OF_POLYHEDRON`f:real^3->bool` +THEN MRESA1_TAC RELATIVE_INTERIOR_SUBSET`f:real^3->bool` +THEN MP_TAC(SET_RULE`t % y IN f ==> t % y IN relative_interior f \/ t % (y:real^3) IN f DIFF relative_interior f `) +THEN RESA_TAC +THENL[ +EXISTS_TAC`fchanged (f:real^3->bool)` +THEN STRIP_TAC +THENL[ +EXISTS_TAC`f:real^3->bool` +THEN ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[fchanged;IN_ELIM_THM] +THEN EXISTS_TAC`t % y:real^3` +THEN EXISTS_TAC`inv t :real` +THEN MP_TAC(REAL_ARITH`&0< t==> ~(t= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a % b % v= (a* b)% v/\ &1 % w= w`;] +THEN ONCE_REWRITE_TAC[REAL_ARITH`t> &0<=> &0< t`] +THEN MATCH_MP_TAC REAL_LT_INV +THEN ASM_REWRITE_TAC[]]; + +POP_ASSUM MP_TAC +THEN MRESA_TAC AFF_DIM_INTERIOR_EQ_3[`vec 0:real^3`;`p:real^3->bool`] +THEN FIND_ASSUM MP_TAC`f facet_of p:real^3->bool` +THEN REWRITE_TAC[UNIONS;IN_ELIM_THM; facet_of] +THEN ASM_REWRITE_TAC[ARITH_RULE`&3- &1= &2:int`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`&2- &1= &1:int`] +THEN RESA_TAC +THEN MRESA1_TAC AFF_DIM`u:real^3->bool` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`&1=A - &1:int <=> A= &2`;INT_OF_NUM_EQ] +THEN STRIP_TAC +THEN MRESA1_TAC AFFINE_INDEPENDENT_IMP_FINITE`b:real^3->bool` +THEN MRESA1_TAC CARD_EXISTS_2`b:real^3->bool` +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA1_TAC POLYTOPE_EQ_BOUNDED_POLYHEDRON`p:real^3->bool` +THEN MRESA_TAC FACE_OF_POLYTOPE_POLYTOPE[`f:real^3->bool`;`p:real^3->bool`] +THEN MRESA_TAC FACE_OF_POLYTOPE_POLYTOPE[`u:real^3->bool`;`f:real^3->bool`] +THEN MRESA1_TAC POLYTOPE_IMP_COMPACT`u:real^3->bool` +THEN MRESA1_TAC POLYTOPE_IMP_CONVEX`u:real^3->bool` +THEN SUBGOAL_THEN`?u1 v. u SUBSET affine hull {u1,v:real^3}` ASSUME_TAC +THENL[ + EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[HULL_SUBSET]; + MRESAL1_TAC COMPACT_CONVEX_COLLINEAR_SEGMENT`u:real^3->bool`[COLLINEAR_AFFINE_HULL] +THEN MRESA_TAC FACE_OF_TRANS[`u:real^3->bool`;`f:real^3->bool`;`p:real^3->bool`] +THEN SUBGOAL_THEN `{a,b} IN edges (p:real^3->bool)`ASSUME_TAC +THENL[ +REWRITE_TAC[edges;edge_of;IN_ELIM_THM] +THEN EXISTS_TAC`a:real^3` +THEN EXISTS_TAC`b:real^3` +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) ; + +MRESA_TAC AFF_GE_SUBSET_XFAN[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;`a:real^3`;`b:real^3`] +THEN MRESAL_TAC CONVEX_AFF_GE[`{vec 0:real^3}`;`{a,b:real^3}`][GSYM CONVEX_HULL_EQ] +THEN MRESA_TAC SEGMENT_CONVEX_HULL[`a:real^3`;`b:real^3`] +THEN POP_ASSUM (fun th-> MP_TAC(SYM th) THEN STRIP_TAC) +THEN MRESA_TAC POLYHEDRON_FAN[`p:real^3->bool`;`vec 0:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[FAN; fan6] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`{a,b:real^3}`[SET_RULE`{x} UNION {a,b}={x,a,b}`]) +THEN MRESA_TAC point_in_aff_ge[`vec 0:real^3`;`a:real^3`;`b:real^3`] +THEN MP_TAC(SET_RULE`a IN aff_ge {vec 0} {a, b} /\ b IN aff_ge {vec 0} {a, b} +==> {a,b:real^3} SUBSET aff_ge {vec 0} {a, b}`) +THEN RESA_TAC +THEN MRESA_TAC HULL_MONO[`convex:(real^3->bool)->bool`;`{a,b:real^3}`;`aff_ge {vec 0} {a, b:real^3}`] +THEN MP_TAC(SET_RULE`segment [a,b] SUBSET aff_ge {vec 0} {a, b} +/\ aff_ge {vec 0} {a, b} SUBSET xfan (vec 0,vertices p,edges p) +/\ u = segment [a,b] /\ t % y IN u +==> t % y IN xfan (vec 0,vertices p,edges (p:real^3->bool))`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC POLYHEDRON_FAN[`p:real^3->bool`;`vec 0:real^3`] +THEN DISJ_CASES_TAC(SET_RULE`(vec 0 = t % y:real^3) \/ ~(vec 0 = t % y) `) +THENL[ +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC INTERIOR_AFFINIE_HUL_EQ_UNIV[`vec 0:real^3`;`p:real^3->bool`] +THEN MRESA1_TAC RELATIVE_INTERIOR_INTERIOR`p:real^3->bool` +THEN MRESA1_TAC RELATIVE_FRONTIER_OF_POLYHEDRON`p:real^3->bool` +THEN MP_TAC (SET_RULE`vec 0 IN interior (p:real^3->bool) +/\ p DIFF interior p = UNIONS {f | f facet_of p} +==> ~(vec 0 IN UNIONS {f | f facet_of p})`) +THEN ASM_REWRITE_TAC[UNIONS;IN_ELIM_THM] +THEN ASM_TAC +THEN SET_TAC[]; + +MRESA_TAC aff_ge_1_1_subset_xfan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;`t % y:real^3`] +THEN SUBGOAL_THEN`y IN aff_ge {vec 0} {t % y:real^3}`ASSUME_TAC +THENL[ +MRESAL_TAC AFF_GE_1_1[`vec 0:real^3`;`t % y:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&1- inv t:real` +THEN EXISTS_TAC`inv t` +THEN MP_TAC(REAL_ARITH`&0< t==> ~(t= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a % b % v= (a* b)% v/\ &1 % w= w/\ y = (&1 - inv t) % vec 0 + y`; REAL_ARITH`&1 - a+ a= &1`;REAL_LE_INV_EQ] +THEN ASM_TAC THEN REAL_ARITH_TAC; + +ASM_TAC +THEN REWRITE_TAC[yfan; DIFF; IN_ELIM_THM] +THEN SET_TAC[]]]]]]);; + +let in_aff_ge_fan=prove(`!x:real^3 v:real^3 u:real^3 a:real. +DISJOINT {x} {v,u} +/\ &0<=a /\ a<= &1 +==> +(&1-a)%v + a % u IN aff_ge {x} {v,u:real^3}`, + +REPEAT STRIP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1 -a:real` +THEN EXISTS_TAC`a:real` +THEN MP_TAC(REAL_ARITH`&0<= a /\ a <= &1 ==> &0 <= &1 - a /\ &0 <= a`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC);; + + + +let REDUCE_POINT_FACET_EXISTS=prove(`!x p:real^3->bool. + bounded p /\ polyhedron p /\ vec 0 IN interior p +/\ ~(x= vec 0) +==> ?f t. &0< t /\ f facet_of p /\ t % x IN f `, + + +REPEAT STRIP_TAC +THEN MRESA_TAC POLYHEDRON_FAN[`p:real^3->bool`;`vec 0:real^3`] +THEN MRESA1_TAC EXISTS_EDGE_POLYTOPE1`p:real^3->bool` +THEN MRESA_TAC x_in_xfan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`] +THEN SUBGOAL_THEN`~(x= vec 0:real^3)`ASSUME_TAC +THENL[ +ASM_TAC +THEN REWRITE_TAC[yfan; DIFF;IN_ELIM_THM] +THEN SET_TAC[]; +MRESA1_TAC POLYTOPE_EQ_BOUNDED_POLYHEDRON`p:real^3->bool` +THEN MRESA1_TAC POLYTOPE_IMP_COMPACT`p:real^3->bool` +THEN MRESA1_TAC INTERIOR_SUBSET`p:real^3->bool` +THEN MP_TAC(SET_RULE`interior p SUBSET p /\ vec 0 IN interior p ==> vec 0 IN (p:real^3->bool)`) +THEN RESA_TAC +THEN MRESA_TAC INTERIOR_AFFINIE_HUL_EQ_UNIV[`vec 0:real^3`;`p:real^3->bool`] +THEN MRESA1_TAC RELATIVE_INTERIOR_INTERIOR`p:real^3->bool` +THEN MRESA1_TAC RELATIVE_FRONTIER_OF_POLYHEDRON`p:real^3->bool` +THEN MRESA1_TAC COMPACT_IMP_CLOSED`p:real^3->bool` +THEN MRESA1_TAC CLOSURE_CLOSED`p:real^3->bool` +THEN MRESAL_TAC COMPACT_FRONTIER_LINE_LEMMA[`p:real^3->bool`;`x:real^3`][frontier;UNIONS;IN_ELIM_THM] +THEN EXISTS_TAC`u':real^3->bool` +THEN EXISTS_TAC`u:real` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0<= u==> u= &0 \/ &0< u`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th; VECTOR_ARITH`&0 % v= vec 0:real^3`] THEN REPEAT STRIP_TAC) +THEN ASM_TAC THEN SET_TAC[]]);; + + + + + + + +let FCHANGED_SUBSET_YFAN=prove(`!x p:real^3->bool. + bounded p /\ polyhedron p /\ vec 0 IN interior p +/\ x IN UNIONS {fchanged f| f facet_of p} +==> x IN yfan(vec 0,vertices p,edges p)`, + +REWRITE_TAC[UNIONS;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[fchanged;IN_ELIM_THM;yfan;DIFF;SET_RULE`x:real^3 IN (:real^3)`;XFAN_EQ_UNIONS_AFF_GE_1_2;UNIONS;] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[edges;edge_of;IN_ELIM_THM] THEN STRIP_TAC THEN MP_TAC th THEN RESA_TAC) +THEN RESA_TAC +THEN RESA_TAC +THEN SUBGOAL_THEN`?t1. &0< t1 /\ t1 % x IN segment[v,w:real^3]`ASSUME_TAC +THENL[ +POP_ASSUM MP_TAC +THEN MRESA_TAC POLYHEDRON_FAN[`p:real^3->bool`;`vec 0:real^3`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;` (w:real^3)`; +` (v:real^3)`] +THEN MRESAL_TAC AFF_GE_1_2[`vec 0:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM;VECTOR_ARITH`t% vec 0+A+B=A+B`;] +THEN RESA_TAC +THEN EXISTS_TAC`inv (t2+ t3)` +THEN REWRITE_TAC[segment;IN_ELIM_THM;VECTOR_ARITH`a%(b % v+ c % w)=(a*b)%v+(a* c)%w`] +THEN MP_TAC(REAL_ARITH`&0<= t2/\ &0<= t3:real ==> (t2= &0 /\ t3= &0)\/ &0< t2+t3`) +THEN RESA_TAC +THENL[ +POP_ASSUM (fun th -> POP_ASSUM (fun th1 -> POP_ASSUM MP_TAC THEN REWRITE_TAC[th; th1; VECTOR_ARITH`&0 % v= vec 0/\ vec 0 + vec 0= vec 0`;VECTOR_MUL_EQ_0])) +THEN MP_TAC(REAL_ARITH`t> &0 ==> ~(t= &0)`) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th -> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA1_TAC RELATIVE_INTERIOR_SUBSET`f:real^3->bool` +THEN MRESA_TAC INTERIOR_AFFINIE_HUL_EQ_UNIV[`vec 0:real^3`;`p:real^3->bool`] +THEN MRESA1_TAC RELATIVE_INTERIOR_INTERIOR`p:real^3->bool` +THEN MRESA1_TAC RELATIVE_FRONTIER_OF_POLYHEDRON`p:real^3->bool` +THEN MP_TAC (SET_RULE`vec 0 IN interior (p:real^3->bool) +/\ p DIFF interior p = UNIONS {f | f facet_of p} +==> ~(vec 0 IN UNIONS {f | f facet_of p})`) +THEN ASM_REWRITE_TAC[UNIONS;IN_ELIM_THM] +THEN ASM_TAC +THEN SET_TAC[]; + +MRESA1_TAC REAL_LT_INV`t2+t3:real` +THEN MP_TAC(REAL_ARITH`&0< inv(t2+t3)/\ &0< t2+t3==> &0<= inv(t2+t3:real) /\ ~(t2+ t3= &0) `) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`inv(t2+ t3):real`;`t2:real`] +THEN MRESA_TAC REAL_LE_MUL[`inv(t2+ t3):real`;`t3:real`] +THEN MRESAL1_TAC REAL_MUL_LINV`t2+ t3:real`[REAL_ARITH`c*(a+b)=c*a+ c*b`] +THEN EXISTS_TAC`inv(t2+t3) * t3` +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th; REAL_ARITH`(a+b)-b=a`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]; + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC AFF_DIM_INTERIOR_EQ_3[`vec 0:real^3`;`p:real^3->bool`] +THEN FIND_ASSUM MP_TAC`f facet_of (p:real^3->bool)` +THEN REWRITE_TAC[facet_of; ] +THEN DISJ_CASES_TAC(SET_RULE`f= p\/ ~(f=p:real^3->bool)`) +THENL[ +ASM_REWRITE_TAC[] +THEN ARITH_TAC; + +RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`segment [v,w]= p\/ ~(segment [v,w]=p:real^3->bool)`) +THENL[ +POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] ) +THEN ARITH_TAC; + +MRESA1_TAC RELATIVE_INTERIOR_SUBSET`f:real^3->bool` +THEN MP_TAC(SET_RULE`v1 IN relative_interior (f:real^3->bool) /\ relative_interior f SUBSET f ==> v1 IN f`) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LT_MUL[`t:real`;`t1:real`][REAL_ARITH`&0< t<=> t> &0`] +THEN MRESAL_TAC POLYHEDRON_COLLINEAR_FACES[`p:real^3->bool`;`f:real^3->bool`;`segment[v,w]:real^3->bool`;`v1:real^3`;`t1% x:real^3`;`t * t1:real`;`&1:real`][VECTOR_ARITH`(t * t1) % v1 = &1 % t1 % t % v1`;REAL_ARITH`&1> &0`] +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th; VECTOR_ARITH`a%b % v= (b*a)%v/\ &1 %v=v`] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SEGMENT_CLOSED_OPEN[`v:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE`segment [v,w] = segment (v,w) UNION {v, w} +/\ v1 IN segment [v,w] ==> v1 IN segment (v,w:real^3) \/ v1=v \/ v1= w`) +THEN RESA_TAC +THENL[ +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN MRESA_TAC POLYHEDRON_FAN[`p:real^3->bool`;`vec 0:real^3`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;` (w:real^3)`; +` (v:real^3)`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`v1 IN segment (v,w) /\ v1 IN relative_interior f +==> ~DISJOINT (relative_interior f) (segment (v,w:real^3))`) +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC FACE_OF_EQ[`p:real^3->bool`;`f:real^3->bool`;`segment[v,w:real^3]`][RELATIVE_INTERIOR_SEGMENT;] +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT RESA_TAC) +THEN ASM_TAC +THEN ARITH_TAC; + +POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SEGMENT_FACE_OF[`p:real^3->bool`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC EXTREME_POINT_OF_FACE[`f:real^3->bool`;`p:real^3->bool`;`v:real^3`] +THEN MP_TAC( ISPECL [`f:real^3->bool`;`v:real^3`]EXTREME_POINT_NOT_IN_RELATIVE_INTERIOR) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th; +AFF_DIM_SING]) +THEN ARITH_TAC; + +POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC SEGMENT_FACE_OF[`p:real^3->bool`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC EXTREME_POINT_OF_FACE[`f:real^3->bool`;`p:real^3->bool`;`w:real^3`] +THEN MP_TAC( ISPECL [`f:real^3->bool`;`w:real^3`]EXTREME_POINT_NOT_IN_RELATIVE_INTERIOR) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th; +AFF_DIM_SING]) +THEN ARITH_TAC]]]]);; + + + + +let FCHANGED_EQ_YFAN=prove(`!p:real^3->bool. + bounded p /\ polyhedron p /\ vec 0 IN interior p +==> UNIONS {fchanged f| f facet_of p}= yfan(vec 0,vertices p,edges p)`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[EXTENSION] +THEN GEN_TAC +THEN EQ_TAC +THENL[ ASM_SIMP_TAC[FCHANGED_SUBSET_YFAN]; +ASM_SIMP_TAC[YFAN_SUBSET_UNIONS_FCHANGED]]);; + + + +let EXISTS_POINT_IN_FCHANGED=prove(`!f p:real^3->bool. + bounded p /\ polyhedron p /\ vec 0 IN interior p /\ + f facet_of p +==> ?y. y IN fchanged f `, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[fchanged;IN_ELIM_THM;IN_ELIM_THM;facet_of] +THEN STRIP_TAC +THEN MRESA_TAC FACE_OF_IMP_CONVEX[`p:real^3->bool`;`f:real^3->bool`] +THEN MRESAL1_TAC RELATIVE_INTERIOR_EQ_EMPTY`f:real^3->bool`[SET_RULE`~(A={})<=> ?v1. v1 IN A`] +THEN EXISTS_TAC`v1:real^3` +THEN EXISTS_TAC`v1:real^3` +THEN EXISTS_TAC`&1` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`&1 % v= v`;REAL_ARITH`&1> &0`]);; + + + +let FCHANGED_IN_COMPONENT=prove(`!f p:real^3->bool. + bounded p /\ polyhedron p /\ vec 0 IN interior p /\ + f facet_of p +==> fchanged f IN topological_component_yfan(vec 0:real^3,vertices (p:real^3->bool),edges (p:real^3->bool))`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN MRESA1_TAC FCHANGED_EQ_YFAN`p:real^3->bool` +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC EXISTS_POINT_IN_FCHANGED[`f:real^3->bool`;`p:real^3->bool`] +THEN EXISTS_TAC`y:real^3` +THEN MP_TAC(SET_RULE`f facet_of (p:real^3->bool) /\ y IN fchanged f ==> y IN UNIONS{fchanged f| f facet_of p} /\ fchanged f SUBSET UNIONS{fchanged f| f facet_of p}`) +THEN RESA_TAC +THEN MRESAL_TAC CONNECTED_FCHANGED[`p:real^3->bool`;`vec 0:real^3`;`f:real^3->bool`][CONNECTED_CONNECTED_COMPONENT_SET] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3`) +THEN MRESA_TAC CONNECTED_COMPONENT_MONO[`fchanged (f:real^3->bool)`;`UNIONS{fchanged f| f facet_of (p:real^3->bool)}`;`y:real^3`] +THEN REWRITE_TAC[EXTENSION;] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +POP_ASSUM MP_TAC +THEN SET_TAC[]; + + +STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(x IN fchanged (f:real^3->bool))\/ (x IN fchanged (f:real^3->bool))`) +THENL[ + +ASM_REWRITE_TAC[] +THEN MRESAL_TAC CONNECTED_COMPONENT_SUBSET[`UNIONS{fchanged f| f facet_of (p:real^3->bool)}`;`y:real^3`][SUBSET] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x:real^3`[UNIONS;IN_ELIM_THM]) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`f= f'\/ ~(f= f':real^3->bool)`) +THENL[ +POP_ASSUM (fun th-> POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[SYM th]); + + +MRESA_TAC CONNECTED_CONNECTED_COMPONENT[`UNIONS{fchanged f| f facet_of (p:real^3->bool)}`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[connected] +THEN ABBREV_TAC`e1=UNIONS {fchanged f1 | f1 facet_of (p:real^3->bool) /\ ~(f1= f)}` +THEN MRESA_TAC FCHANGED_OPEN[`p:real^3->bool`;`f:real^3->bool`] +THEN EXISTS_TAC`fchanged (f:real^3->bool)` +THEN EXISTS_TAC`e1:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL[ + +EXPAND_TAC "e1" +THEN MATCH_MP_TAC OPEN_UNIONS +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC FCHANGED_OPEN[`p:real^3->bool`;`f1:real^3->bool`]; + +STRIP_TAC +THENL[ + +MATCH_MP_TAC (SET_RULE`!A B C. A SUBSET B/\ B SUBSET C==> A SUBSET C`) +THEN EXISTS_TAC`UNIONS{fchanged f| f facet_of (p:real^3->bool)}` +THEN ASM_REWRITE_TAC[CONNECTED_COMPONENT_SUBSET] +THEN EXPAND_TAC"e1" +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;UNION;UNIONS;EX] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`f= f'' \/ ~(f''= f:real^3->bool )`) +THENL[ +ASM_REWRITE_TAC[]; + +MATCH_MP_TAC(SET_RULE`A==> B\/ A`) +THEN EXISTS_TAC`fchanged (f'':real^3->bool)` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`f'':real^3->bool` +THEN ASM_REWRITE_TAC[]]; + +STRIP_TAC +THENL[ + +MATCH_MP_TAC(SET_RULE`A INTER B= {}==> A INTER B INTER C= {}`) +THEN EXPAND_TAC"e1" +THEN MATCH_MP_TAC(SET_RULE`(!s. s IN B==> A INTER s= {} )==> A INTER UNIONS B={}`) +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC FCHANGED_ONE_TO_ONE[`p:real^3->bool`;`f:real^3->bool`;`f1:real^3->bool`]; + + + +STRIP_TAC +THENL[ + +ASM_TAC +THEN SET_TAC[]; +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;INTER; IN_ELIM_THM] +THEN EXISTS_TAC`x:real^3` +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"e1" +THEN REWRITE_TAC[UNIONS;IN_ELIM_THM] +THEN EXISTS_TAC`fchanged (f':real^3->bool)` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`f':real^3->bool` +THEN ASM_REWRITE_TAC[]]]]]]; + +ASM_REWRITE_TAC[]]]);; + + + +let SUR_FCHANGED=prove(`!s p:real^3->bool. + bounded p /\ polyhedron p /\ vec 0 IN interior p /\ + s IN topological_component_yfan(vec 0:real^3,vertices (p:real^3->bool),edges (p:real^3->bool)) +==> ?f. f facet_of p /\ s= fchanged f`, + +REPEAT STRIP_TAC +THEN MRESA1_TAC FCHANGED_EQ_YFAN`p:real^3->bool` +THEN MRESA_TAC topological_component_subset_yfan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;`s:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;SUBSET;IN_ELIM_THM;UNIONS]) +THEN MRESA_TAC exists_point_in_component_yfan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;`s:real^3->bool`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`z:real^3`) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`f:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC FCHANGED_IN_COMPONENT[`f:real^3->bool`;`p:real^3->bool`] +THEN ASM_TAC +THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`z IN connected_component (yfan (vec 0,vertices p,edges p)) y +/\ z IN fchanged f /\ fchanged f=connected_component (yfan (vec 0,vertices p,edges p)) y' +==> ~(connected_component (yfan (vec 0,vertices p,edges p)) y INTER connected_component (yfan (vec 0,vertices p,edges p)) y'= {}) +`) +THEN RESA_TAC +THEN MRESA_TAC CONNECTED_COMPONENT_OVERLAP[`yfan (vec 0,vertices p,edges p)`;`y:real^3`;`y':real^3`]);; + + + + + +let AMHFNXP= prove(`!p:real^3->bool. + bounded p /\ polyhedron p /\ vec 0 IN interior p +==> +(!s. s IN topological_component_yfan (vec 0,vertices (p:real^3->bool),edges (p:real^3->bool)) ==> (?!f. f facet_of p /\ + s = fchanged f))`, + +REWRITE_TAC[EXISTS_UNIQUE] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC SUR_FCHANGED[`s:real^3->bool`;`p:real^3->bool`] +THEN EXISTS_TAC`f:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC FCHANGED_ONE_TO_ONE[`p:real^3->bool`;`y:real^3->bool`;`f:real^3->bool`] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[SET_RULE`A INTER A= A`] +THEN MRESA_TAC EXISTS_POINT_IN_FCHANGED[`y:real^3->bool`;`p:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + +let AMHFNXP_BIJ = prove_by_refinement( + `!p:real^3->bool. bounded p /\ polyhedron p /\ vec 0 IN interior p ==> + (BIJ fchanged (\f. f facet_of p) (topological_component_yfan (vec 0,vertices p,edges p)))`, + (* {{{ proof *) + [ +REWRITE_TAC [BIJ;INJ;SURJ;IN;IN_ELIM_THM]; +STRIP_TAC ; +STRIP_TAC ; +ASM_SIMP_TAC [REWRITE_RULE[IN] FCHANGED_IN_COMPONENT]; +MP_TAC (REWRITE_RULE[IN] FCHANGED_IN_COMPONENT); +MP_TAC (SPEC `p:real^3->bool` (REWRITE_RULE[IN] AMHFNXP)); +ASM_REWRITE_TAC [EXISTS_UNIQUE]; +ASM_MESON_TAC [] + ]);; + (* }}} *) + + + +let EXPAND_EDGE_POLYTOPE=prove(`!f p:real^N->bool. +polytope p /\ f face_of p /\ aff_dim f= &1 +==> ?a b. f= segment[a,b]`, +REPEAT STRIP_TAC +THEN MRESA1_TAC AFF_DIM`f:real^N->bool` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`&1=A - &1:int <=> A= &2`;INT_OF_NUM_EQ] +THEN STRIP_TAC +THEN MRESA1_TAC AFFINE_INDEPENDENT_IMP_FINITE`b:real^N->bool` +THEN MRESA1_TAC CARD_EXISTS_2`b:real^N->bool` +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MATCH_MP_TAC COMPACT_CONVEX_COLLINEAR_SEGMENT +THEN MRESA_TAC FACE_OF_POLYTOPE_POLYTOPE[`f:real^N->bool`;`p:real^N->bool`] +THEN MRESA1_TAC POLYTOPE_IMP_COMPACT`f:real^N->bool` +THEN MRESA1_TAC POLYTOPE_IMP_CONVEX`f:real^N->bool` +THEN SUBGOAL_THEN`?u v. f SUBSET affine hull {u,v:real^N}` ASSUME_TAC +THENL[ EXISTS_TAC`v:real^N` +THEN EXISTS_TAC`w:real^N` +THEN ASM_REWRITE_TAC[HULL_SUBSET]; +ASM_REWRITE_TAC[COLLINEAR_AFFINE_HULL] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;AFF_DIM_EMPTY]) +THEN ARITH_TAC]);; + + + + + + + + + + + + + + + + +let EXISTS_EDGE_AT_VERTICES=prove(`!p:real^3->bool. + bounded p /\ polyhedron p /\ vec 0 IN interior p +==> (!v. v IN vertices p ==> ~(set_of_edge v (vertices p) (edges p) ={}) )`, + +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[vertices; IN_ELIM_THM;GSYM FACE_OF_SING] +THEN STRIP_TAC +THEN MRESA1_TAC AFF_DIM_SING`v:real^3` +THEN MRESA_TAC AFF_DIM_INTERIOR_EQ_3[`vec 0:real^3`;`p:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`p ={v}\/ ~({v}=p:real^3->bool) `) +THENL[ +ASM_REWRITE_TAC[] +THEN ARITH_TAC; +STRIP_TAC +THEN MRESAL_TAC FACE_OF_POLYHEDRON_SUBSET_FACET[`p:real^3->bool`;`{v:real^3}`][SET_RULE`~({v}={})`] +THEN MRESA_TAC FACE_OF_SING[`v:real^3`;`p:real^3->bool`] +THEN MP_TAC(SET_RULE`{v:real^3} SUBSET f==> v IN f`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`f facet_of (p:real^3->bool)` +THEN REWRITE_TAC[facet_of] +THEN STRIP_TAC +THEN MRESAL_TAC EXTREME_POINT_OF_FACE[`f:real^3->bool`;`p:real^3->bool`;`v:real^3`][GSYM FACE_OF_SING] +THEN MRESA_TAC FACE_OF_SING[`v:real^3`;`f:real^3->bool`] +THEN MRESA_TAC FACE_OF_POLYHEDRON_POLYHEDRON[`p:real^3->bool`;`f:real^3->bool`] +THEN DISJ_CASES_TAC(SET_RULE`f ={v}\/ ~({v}=f:real^3->bool) `) +THENL[ +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT RESA_TAC) +THEN ASM_TAC +THEN ARITH_TAC; + MRESAL_TAC FACE_OF_POLYHEDRON_SUBSET_FACET[`f:real^3->bool`;`{v:real^3}`][SET_RULE`~({v}={})`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[facet_of;ARITH_RULE`&3- &1- &1= &1:int`] +THEN STRIP_TAC +THEN MRESA_TAC FACE_OF_TRANS[`f':real^3->bool`;`f:real^3->bool`;`p:real^3->bool`] +THEN MRESA1_TAC POLYTOPE_EQ_BOUNDED_POLYHEDRON`p:real^3->bool` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`{v:real^3} SUBSET f' ==> v IN f'`) +THEN RESA_TAC +THEN MRESAL_TAC EXTREME_POINT_OF_FACE[`f':real^3->bool`;`f:real^3->bool`;`v:real^3`][GSYM FACE_OF_SING] +THEN MRESA_TAC FACE_OF_SING[`v:real^3`;`f':real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC EXPAND_EDGE_POLYTOPE[`f':real^3->bool`;`p:real^3->bool`] +THEN REWRITE_TAC[EXTREME_POINT_OF_SEGMENT] +THEN STRIP_TAC +THENL[ +POP_ASSUM(fun th-> ASM_TAC THEN ASM_REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN ASM_REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN EXISTS_TAC`b:real^3` +THEN ASM_REWRITE_TAC[set_of_edge;IN_ELIM_THM;edges;vertices] +THEN MRESAL_TAC SEGMENT_EDGE_OF[`p:real^3->bool`;`a:real^3`;`b:real^3`][edge_of] +THEN EXISTS_TAC`a:real^3` +THEN EXISTS_TAC`b:real^3` +THEN ASM_REWRITE_TAC[]; +POP_ASSUM(fun th-> ASM_TAC THEN ASM_REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN ASM_REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN EXISTS_TAC`a:real^3` +THEN ASM_REWRITE_TAC[set_of_edge;IN_ELIM_THM;edges;vertices] +THEN MRESAL_TAC SEGMENT_EDGE_OF[`p:real^3->bool`;`a:real^3`;`b:real^3`][edge_of] +THEN EXISTS_TAC`a:real^3` +THEN EXISTS_TAC`b:real^3` +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]]]]);; + + + + + + + +let FLVNSME=prove(`!v A a b p:real^3->bool. + bounded p /\ polyhedron p /\ vec 0 IN interior p + /\ A={x| a dot x < b } /\ ~(a= vec 0) +/\ v IN {x| a dot x = b } /\ vec 0 IN {x| a dot x = b } +/\ v IN vertices p +==> ?w. w IN vertices p /\ w IN A/\ {v,w} IN edges p`, +(let lemma = prove + (`!X:real->bool. + FINITE X /\ ~(X = {}) + ==> ?a. a IN X /\ !x. x IN X ==> a <= x`, + MESON_TAC[INF_FINITE]) in + + +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[vertices; IN_ELIM_THM;GSYM FACE_OF_SING] THEN ASSUME_TAC(th) +THEN STRIP_TAC) +THEN MRESA1_TAC AFF_DIM_SING`v:real^3` +THEN MRESA_TAC AFF_DIM_INTERIOR_EQ_3[`vec 0:real^3`;`p:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`p ={v}\/ ~({v}=p:real^3->bool) `) + +THENL(*1*)[ + +ASM_REWRITE_TAC[] +THEN ARITH_TAC;(*1*) + +STRIP_TAC +THEN MRESAL_TAC FACE_OF_POLYHEDRON_SUBSET_FACET[`p:real^3->bool`;`{v:real^3}`][SET_RULE`~({v}={})`] +THEN MRESA_TAC FACE_OF_SING[`v:real^3`;`p:real^3->bool`] +THEN MRESAL_TAC EXPOSED_FACE_OF_POLYHEDRON[`p:real^3->bool`;`{v:real^3}`][EXPOSED_FACE_OF;SET_RULE`~({v}={})`] +THEN ABBREV_TAC`s={-- (a':real^3) dot w| w IN vertices p /\ ~(v=w)}` +THEN SUBGOAL_THEN`~(s:real->bool={})`ASSUME_TAC + +THENL(*2*)[ + +MRESA1_TAC EXISTS_EDGE_AT_VERTICES`p:real^3->bool` +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[set_of_edge;SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM; edges; ] +THEN STRIP_TAC +THEN EXISTS_TAC`-- a' dot (a'':real^3)` +THEN EXISTS_TAC`a'':real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC SEGMENT_EDGE_OF[`p:real^3->bool`;`v':real^3`;`w':real^3`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th; SET_RULE`{v,v}={v}`] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(SET_RULE`{a''} = {v', w':real^3}==> v'=w'`) +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN SET_TAC[];(*2*) + + MRESAL_TAC POLYHEDRON_FAN[`p:real^3->bool`;`vec 0:real^3`][FAN;fan1] +THEN ASSUME_TAC(SET_RULE`{w|w IN vertices p /\ ~(v = w:real^3)} SUBSET vertices p`) +THEN MRESA_TAC FINITE_SUBSET[`{w|w IN vertices p /\ ~(v = w:real^3)}`;`vertices (p:real^3->bool)`] +THEN MRESAL_TAC FINITE_IMAGE[`(\w:real^3. -- a' dot w)`;`{w|w IN vertices p /\ ~(v = w:real^3)}`][IMAGE;IN_ELIM_THM;SET_RULE`{y | ?x. (x IN vertices p /\ ~(v = x)) /\ y = -- a' dot x}={-- a' dot w | w IN vertices p /\ ~(v = w)}`] +THEN MRESA1_TAC lemma`s:real->bool` +THEN SUBGOAL_THEN(`-- a''< b':real`)ASSUME_TAC + +THENL(*3*)[ + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[IN_ELIM_THM;vertices;GSYM FACE_OF_SING] +THEN RESA_TAC +THEN MRESA_TAC FACE_OF_IMP_SUBSET[`p:real^3->bool`;`{w:real^3}`] +THEN MP_TAC(SET_RULE`p SUBSET {x | a' dot x <= b'} /\ {w:real^3} SUBSET p==> w IN {x | a' dot x <= b'}`) +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`a' dot (w:real^3) <= b'==> a' dot w = b' \/ a' dot w < b'`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*4*)[ + +MP_TAC(SET_RULE`a' dot w = b'/\ {w} SUBSET p /\{v}=p INTER {x | a' dot (x:real^3) = b'}==> w =v`) +THEN RESA_TAC;(*4*) + +ASM_REWRITE_TAC[VECTOR_ARITH`--(-- a dot w)= a dot w`]](*4*);(*3*) + +MRESA1_TAC INTERIOR_SUBSET`p:real^3->bool` +THEN MP_TAC(SET_RULE` interior p SUBSET p /\ p SUBSET {x:real^3 | a' dot x <= b'} ==> interior p SUBSET {x | a' dot x <= b'} `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`(vec 0) IN interior (p:real^3->bool) /\ interior p SUBSET {x | a' dot x <= b'}==> (vec 0) IN {x:real^3 | a' dot x <= b'}`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN_ELIM_THM; DOT_RZERO] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0<= b' ==> b'= &0 \/ &0< b'`) +THEN RESA_TAC +THENL(*6*)[ + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN SUBGOAL_THEN`vec 0 IN {x:real^3 | a' dot x = &0}` ASSUME_TAC + +THENL(*7*)[ +REWRITE_TAC[IN_ELIM_THM; DOT_RZERO];(*7*) + +MP_TAC(SET_RULE`(vec 0) IN interior (p:real^3->bool) /\ interior p SUBSET p ==> (vec 0) IN p`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`(vec 0) IN (p:real^3->bool) /\ vec 0 IN {x:real^3 | a' dot x = &0} ==> (vec 0) IN p INTER {x:real^3 | a' dot x = &0}`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`(vec 0) IN p INTER {x:real^3 | a' dot x = &0} /\ + p INTER {x:real^3 | a' dot x = &0} = {v} ==> v= vec 0`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC EXTREME_POINT_NOT_IN_INTERIOR[`p:real^3->bool`;`vec 0:real^3`]](*7*);(*6*) + + + +ABBREV_TAC`b1= max (-- a'') (&0) + (b'- max (-- a'') (&0))/ &2` +THEN MP_TAC(REAL_ARITH`max (-- a'') (&0) + (b'- max (-- a'') (&0))/ &2 = b1 /\ -- a''< b' /\ &0< b' ==> -- a''< b1 /\ b1< b' /\ &0< b1`) +THEN RESA_TAC +THEN SUBGOAL_THEN`vertices (p:real^3->bool) INTER {x| a' dot x >= b1}={v}` ASSUME_TAC +THENL(*7*)[ + +REWRITE_TAC[EXTENSION; IN_SING; INTER;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC + +THENL(*8*)[ + +STRIP_TAC +THEN MP_TAC(REAL_ARITH`--a'' < b1 /\ a' dot (x:real^3) >= b1 ==> -- (a' dot x) < a''`) +THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(v= x) \/ x=v:real^3`) + +THENL(*9*)[ + +MP_TAC(SET_RULE`~(v = x) /\ x IN vertices p ==> -- a' dot x IN {--a' dot w | w IN vertices p /\ ~(v = w:real^3)}`) +THEN RESA_TAC +THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `--a' dot x:real^3` th))`!x. x IN s ==> a'' <= x` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th; VECTOR_ARITH`--a' dot x= --(a' dot x)`]) +THEN ASM_TAC +THEN REAL_ARITH_TAC;(*9*) + +ASM_REWRITE_TAC[]](*9*);(*8*) + + +RESA_TAC +THEN MP_TAC(SET_RULE`{v} = p INTER {x | a' dot x:real^3 = b'} ==> a' dot v= b'`) +THEN RESA_TAC +THEN ASM_TAC +THEN REAL_ARITH_TAC](*8*);(*7*) + +ABBREV_TAC`p'= p INTER {x | a' dot x:real^3 = b1}` +THEN SUBGOAL_THEN `vec 0 IN {x:real^3 | a' dot x < b1}`ASSUME_TAC +THENL(*8*)[ +ASM_REWRITE_TAC[IN_ELIM_THM; DOT_RZERO];(*8*) + + +MRESAL_TAC OPEN_HALFSPACE_LT[`a':real^3`;`b1:real`][open_def] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`vec 0:real^3`) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN FIND_ASSUM MP_TAC`vec 0 IN interior p:real^3->bool` +THEN REWRITE_TAC[IN_INTERIOR] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN SUBGOAL_THEN`vec 0 IN closure {x:real^3 | a dot x < b}`ASSUME_TAC +THENL(*9*)[ + +MRESAL_TAC CLOSURE_HALFSPACE_LT[`a:real^3`;`b:real`][IN_ELIM_THM] +THEN ASM_TAC +THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT RESA_TAC +THEN REAL_ARITH_TAC;(*9*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[CLOSURE_APPROACHABLE] +THEN MP_TAC(REAL_ARITH`&0< e /\ &0< e'==> &0< min (e:real) e'/ &2 /\ min (e:real) e'/ &2< e/\ min (e:real) e'/ &2< e'`) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(min (e:real) e') / &2`) +THEN MP_TAC(REAL_ARITH`dist (y:real^3,vec 0) < min e e' / &2 /\ min e e' / &2 < e +/\ min e e' / &2 < e'==> dist (y,vec 0) < e /\ dist (y,vec 0) < e'`) +THEN RESA_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th`y:real^3`) +THEN SUBGOAL_THEN `y:real^3 IN ball(vec 0, e')` ASSUME_TAC + +THENL(*10*)[ + +ASM_REWRITE_TAC[SUBSET;ball;IN_ELIM_THM; DIST_SYM];(*10*) + +MRESAL_TAC OPEN_BALL[`vec 0:real^3`;`e':real`][open_def] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3`) +THEN SUBGOAL_THEN`y IN interior p:real^3->bool` ASSUME_TAC +THENL(*11*)[ + +REWRITE_TAC[IN_INTERIOR] +THEN EXISTS_TAC`e'':real` +THEN ASM_REWRITE_TAC[SUBSET;IN_ELIM_THM;ball;DIST_SYM] +THEN GEN_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH2") +THEN STRIP_TAC +THEN REMOVE_THEN"LINH2"(fun th-> MRESA1_TAC th`x:real^3`) +THEN ASM_TAC +THEN SET_TAC[];(*11*) + +MP_TAC(SET_RULE`y IN interior p /\ interior p SUBSET p ==> y IN (p:real^3->bool)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`?z. z IN segment[y,v:real^3] INTER {x| a' dot x= b1} /\ ~(z= v)` ASSUME_TAC +THENL(*12*)[ + +MP_TAC(SET_RULE`vertices p INTER {x | a' dot x >= b1} = {v:real^3} ==> v IN {x | a' dot x >= b1}`) +THEN RESA_TAC +THEN REWRITE_TAC[INTER;IN_SEGMENT;IN_ELIM_THM] +THEN ASM_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`{v} = p INTER {x | a' dot x = b'}==> a' dot (v:real^3)= b'`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`a' dot y < b1 /\ a' dot v >= b1 /\ a' dot v = b' /\ b1< b' ==> &0< a' dot v - a' dot (y:real^3) /\ &0< b1- a' dot y/\ b1- a' dot y < a' dot v - a' dot (y:real^3) /\ ~(a' dot v - a' dot (y:real^3)= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`a' dot v - a' dot (y:real^3)` +THEN MRESA_TAC REAL_LT_MUL[`inv(a' dot v - a' dot (y:real^3))`;`b1 - a' dot (y:real^3)`] +THEN MP_TAC(REAL_ARITH`&0< inv(a' dot v - a' dot (y:real^3))==> &0<= inv(a' dot v - a' dot (y:real^3))`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`a' dot v - a' dot (y:real^3)` +THEN MRESA_TAC REAL_LT_LMUL[`inv(a' dot v - a' dot (y:real^3))`;`b1 - a' dot (y:real^3)`;`a' dot v - a' dot (y:real^3)`] +THEN EXISTS_TAC`(&1- inv (a' dot v - a' dot y) * (b1 - a' dot y)) % (y:real^3)+ (inv (a' dot v - a' dot y) * (b1 - a' dot y))% v` +THEN REWRITE_TAC[DOT_RMUL; DOT_RADD; REAL_ARITH`(&1- b)* c+b * d=a<=>b*(d-c)= a- c`;] +THEN ASM_REWRITE_TAC[ REAL_ARITH`(a*b)*c= b*(a*c)`; REAL_ARITH`a * &1= a`] +THEN STRIP_TAC +THENL(*13*)[ + + + EXISTS_TAC`inv (a' dot v - a' dot y) * (b1 - a' dot (y:real^3))` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REAL_ARITH_TAC;(*13*) + +REWRITE_TAC[VECTOR_ARITH`(&1- b)%a + b % v= v<=> (&1-b)%(a-v)= vec 0`;VECTOR_MUL_EQ_0] +THEN STRIP_TAC + +THENL(*14*)[ +ASM_TAC THEN REAL_ARITH_TAC;(*14*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`y- v= vec 0<=> y= v`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] ) +THEN REAL_ARITH_TAC](*14*)](*13*);(*12*) + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN MRESA_TAC FACET_OF_IMP_SUBSET[`f:real^3->bool`;`p:real^3->bool`] +THEN MP_TAC(SET_RULE`{v:real^3} SUBSET f /\ f SUBSET p/\ y IN p==> {v,y} SUBSET p `) +THEN RESA_TAC +THEN MRESA1_TAC POLYHEDRON_IMP_CONVEX`p:real^3->bool` +THEN MRESAL_TAC SUBSET_HULL [`convex:(real^3->bool)->bool`;`{v,y:real^3}`;`p:real^3->bool`] [GSYM SEGMENT_CONVEX_HULL;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SEGMENT_SYM] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`z IN segment [y,v] INTER {x | a' dot x = b1} +/\ segment [y,v:real^3] SUBSET p ==> z IN p INTER {x | a' dot x = b1}`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`y IN {x | a dot x < b}==> a dot (y:real^3) < b`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`a dot (y:real^3) < b==> a dot (y:real^3) <= b `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`v IN {x | a dot x = b} ==> a dot (v:real^3) = b`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`a dot (v:real^3) = b==> a dot (v:real^3) <= b `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE` a dot (y:real^3) <= b /\ a dot v <= b ==> {v,y} SUBSET {x | a dot x <= b}`) +THEN RESA_TAC +THEN MRESA_TAC CONVEX_HALFSPACE_LE[`a:real^3`;`b:real`] +THEN MRESAL_TAC SUBSET_HULL [`convex:(real^3->bool)->bool`;`{v,y:real^3}`;`{x | a dot x <= b}:real^3->bool`] [GSYM SEGMENT_CONVEX_HULL;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SEGMENT_SYM] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`z IN segment [y,v] INTER {x | a' dot x = b1} +/\ segment [y,v:real^3] SUBSET {x | a dot x <= b} ==> z IN {x | a dot x <= b}/\ z IN segment [y,v] `) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN_ELIM_THM; REAL_ARITH`a<=b<=> a=b\/ a ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DOT_RADD;DOT_RMUL;REAL_ARITH`(&1-a) *b+a*c=c<=> (&1-a)*(b-c)= &0`;REAL_ENTIRE; REAL_ARITH`a-b= &0<=> b=a`] +THEN ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC THEN ASSUME_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`z = (&1 - &1) % y + &1 % v <=> z=v `] +THEN ASM_TAC THEN REAL_ARITH_TAC;(*13*) + + +STRIP_TAC +THEN MP_TAC(SET_RULE` a dot z < b ==> z IN {x:real^3 | a dot x < b}`) +THEN RESA_TAC +THEN MRESA_TAC POLYHEDRON_HYPERPLANE[`a':real^3`;`b1:real`] +THEN MRESA_TAC POLYHEDRON_INTER[`p:real^3->bool`;`{x:real^3 | a' dot x = b1}`] +THEN MRESAL_TAC BOUNDED_SUBSET[`p INTER {x:real^3 | a' dot x = b1}`;`p:real^3->bool`;][SET_RULE`p INTER {x:real^3 | a' dot x = b1} SUBSET p`] +THEN MRESA1_TAC POLYTOPE_EQ_BOUNDED_POLYHEDRON`p':real^3->bool` +THEN MRESA1_TAC POLYTOPE_IMP_COMPACT`p':real^3->bool` +THEN MRESA1_TAC POLYTOPE_IMP_CONVEX`p':real^3->bool` +THEN MRESA1_TAC KREIN_MILMAN_MINKOWSKI `p':real^3->bool` +THEN POP_ASSUM (fun th-> MP_TAC(SYM th)) +THEN STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE` ({x:real^3 | x extreme_point_of p'} SUBSET {x | a dot x>=b}) \/ (?w. w extreme_point_of p' /\ ~(w IN {x | a dot x>=b})) `) +THENL(*14*)[ + +MRESA_TAC CONVEX_HALFSPACE_GE[`a:real^3`;`b:real`] +THEN MRESA_TAC SUBSET_HULL [`convex:(real^3->bool)->bool`;`{x:real^3 | x extreme_point_of p'}`;`{x | a dot x >= b}:real^3->bool`] +THEN MP_TAC(SET_RULE`convex hull {x:real^3 | x extreme_point_of p'} SUBSET {x | a dot x >= b} +/\ p' = convex hull {x | x extreme_point_of p'} /\ z IN p' ==> a dot z>= b`) +THEN RESA_TAC +THEN ASM_TAC +THEN REAL_ARITH_TAC;(*14*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN_ELIM_THM;REAL_ARITH`~(a>=b)<=> a< b`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` a dot w < b ==> w IN {x:real^3 | a dot x < b}`) +THEN RESA_TAC +THEN ABBREV_TAC`p1= p INTER {x:real^3| a' dot x >= b1}` +THEN MRESA1_TAC POLYTOPE_EQ_BOUNDED_POLYHEDRON`p:real^3->bool` +THEN MRESA1_TAC POLYTOPE_IMP_CLOSED`p:real^3->bool` +THEN MRESA1_TAC CLOSURE_CLOSED`p:real^3->bool` +THEN MRESAL_TAC IN_INTERIOR_CLOSURE_CONVEX_SEGMENT[`p:real^3->bool`;`y:real^3`;`v:real^3`][SET_RULE`v IN p<=> {v} SUBSET p`; SET_RULE`A INTER B SUBSET A`] +THEN MRESA_TAC CONVEX_HALFSPACE_GE[`a':real^3`;`b1:real`] +THEN MRESA_TAC CLOSED_HALFSPACE_GE[`a':real^3`;`b1:real`] +THEN MRESA1_TAC CLOSURE_CLOSED`{x:real^3| a' dot x >= b1}:real^3->bool` +THEN MRESA_TAC INTERIOR_HALFSPACE_GE[`a':real^3`;`b1:real`] +THEN MP_TAC(SET_RULE`{v:real^3} = p INTER {x | a' dot x = b'}==> a' dot v = b'`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`z IN segment [y,v:real^3] INTER {x | a' dot x = b1}==> a' dot z = b1`) +THEN RESA_TAC +THEN MRESAL_TAC IN_INTERIOR_CLOSURE_CONVEX_SEGMENT[`{x:real^3| a' dot x >= b1}:real^3->bool`;`v:real^3`;`z:real^3`][IN_ELIM_THM; REAL_ARITH`a>b<=> b=b`; ] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`a< b<=> b> a`] +THEN STRIP_TAC +THEN MRESA_TAC SUBSET_SEGMENT_OPEN_CLOSED [`v:real^3`;`z:real^3`;`y:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[SUBSET_SEGMENT] +THEN ASM_REWRITE_TAC[ENDS_IN_SEGMENT] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`segment (v,z) SUBSET segment (y,v) /\ segment (y,v) SUBSET interior (p:real^3->bool)==> segment (v,z) SUBSET interior p`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`~(z = v:real^3)` +THEN REWRITE_TAC[GSYM SEGMENT_EQ_EMPTY;SEGMENT_SYM;SET_RULE`~(A={})<=> ?v1. v1 IN A`] +THEN STRIP_TAC +THEN SUBGOAL_THEN` v1:real^3 IN interior p1`ASSUME_TAC +THENL(*15*)[ + +EXPAND_TAC"p1" +THEN REWRITE_TAC[INTERIOR_INTER] +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM] +THEN ASM_TAC +THEN SET_TAC[];(*15*) + + + +MRESAL_TAC POLYHEDRON_INTER[`p:real^3->bool`;`{x:real^3| a' dot x >= b1}`][POLYHEDRON_HALFSPACE_GE] +THEN MRESAL_TAC BOUNDED_SUBSET[`p INTER {x:real^3| a' dot x >= b1} `;`p:real^3->bool`;][SET_RULE`(A INTER B) SUBSET A`] +THEN MRESA1_TAC POLYTOPE_EQ_BOUNDED_POLYHEDRON`p1:real^3->bool` +THEN MRESA1_TAC POLYTOPE_IMP_CONVEX`p1:real^3->bool` +THEN MRESA_TAC FACE_OF_INTER_SUPPORTING_HYPERPLANE_GE[`p1:real^3->bool`;`a':real^3`;`b1:real`] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"p1" +THEN GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o DEPTH_CONV)[INTER;IN_ELIM_THM] +THEN ASM_REWRITE_TAC[IN_ELIM_THM;SET_RULE`(!x. x IN p /\ a' dot x >= b1 ==> a' dot x >= b1)`] +THEN SUBGOAL_THEN`p1 INTER {x:real^3 | a' dot x = b1}= p'`ASSUME_TAC +THENL(*16*)[ + +EXPAND_TAC"p1" +THEN REWRITE_TAC[INTER;IN_ELIM_THM;SET_RULE`(A INTER B) INTER C= A INTER (B INTER C)` +; REAL_ARITH`(a>=b /\ a=b) <=> a = b`] +THEN ASM_TAC +THEN REWRITE_TAC[INTER;IN_ELIM_THM] +THEN REPEAT RESA_TAC;(*16*) + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC EXPOSED_FACE_OF_POLYHEDRON[`p1:real^3->bool`;`p':real^3->bool`] +THEN MRESA_TAC FACE_OF_SING[`w:real^3`;`p':real^3->bool`] +THEN MRESA_TAC EXPOSED_FACE_OF_POLYHEDRON[`p':real^3->bool`;`{w}:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[exposed_face_of] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH10") +THEN ABBREV_TAC`a2= (v-w:real^3) cross (a''' cross a')` +THEN ABBREV_TAC`b2= a2 dot w:real^3` +THEN SUBGOAL_THEN`{x| a' dot x =b1} INTER {x | a''' dot x <= b''}= {x| a' dot x =b1} INTER {x:real^3 | a2 dot x <= b2}`ASSUME_TAC +THENL(*17*)[ + +REWRITE_TAC[INTER;IN_ELIM_THM] +THEN EXPAND_TAC "b2" +THEN EXPAND_TAC "a2" +THEN REWRITE_TAC[CROSS_LADD;VECTOR_ARITH`A-B=A+(-- B:real^3)`;DOT_LADD;CROSS_LNEG;DOT_LNEG;DOT_CROSS_SELF;] +THEN REWRITE_TAC[CROSS_LAGRANGE;DOT_LSUB;DOT_LMUL;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL(*18*)[ + + +RESA_TAC +THEN MP_TAC(SET_RULE`{w:real^3} = p' INTER {x | a''' dot x = b''} +/\ p1 INTER {x | a' dot x = b1} = p' ==> a''' dot w = b'' /\ a' dot w= b1`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[DOT_SYM;REAL_ARITH`b' * (a''' dot x) - (a''' dot v) * b1 + --(b1 * (a''' dot x) - b'' * b1) <= + b' * b'' - (a''' dot v) * b1 + -- &0 +<=> +&0<= ( b'-b1) * (b''- a''' dot x) +`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= a-b<=> b<=a`] +THEN ASM_TAC +THEN REAL_ARITH_TAC;(*18*) + +RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`{w:real^3} = p' INTER {x | a''' dot x = b''} +/\ p1 INTER {x | a' dot x = b1} = p' ==> a''' dot w = b'' /\ a' dot w= b1`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[DOT_SYM;REAL_ARITH`b' * (a''' dot x) - (a''' dot v) * b1 + --(b1 * (a''' dot x) - b'' * b1) <= + b' * b'' - (a''' dot v) * b1 + -- &0 +<=> +&0<= ( b'-b1) * (b''- a''' dot x) +`] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`b1< b' ==> ~(b'- b1= &0) /\ &0< b'-b1`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`b'-b1:real` +THEN MRESA1_TAC REAL_LT_INV_EQ`b'-b1:real` +THEN MP_TAC(ARITH_RULE` &0< inv(b'-b1)==> &0<= inv(b'- b1)`) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_MUL[`inv(b'-b1)`;`(b' - b1) * (b'' - a''' dot (x:real^3))`][REAL_ARITH`A*B*C=(A*B)*C`;REAL_ARITH`&1*A=A`] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC](*18*);(*17*) + + +SUBGOAL_THEN`{x| a' dot x =b1} INTER {x | a''' dot x = b''}= {x| a' dot x =b1} INTER {x:real^3 | a2 dot x = b2}`ASSUME_TAC +THENL(*18*)[ + +REWRITE_TAC[INTER;IN_ELIM_THM] +THEN EXPAND_TAC "b2" +THEN EXPAND_TAC "a2" +THEN REWRITE_TAC[CROSS_LADD;VECTOR_ARITH`A-B=A+(-- B:real^3)`;DOT_LADD;CROSS_LNEG;DOT_LNEG;DOT_CROSS_SELF;] +THEN REWRITE_TAC[CROSS_LAGRANGE;DOT_LSUB;DOT_LMUL;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL(*19*)[ + +RESA_TAC +THEN MP_TAC(SET_RULE`{w:real^3} = p' INTER {x | a''' dot x = b''} +/\ p1 INTER {x | a' dot x = b1} = p' ==> a''' dot w = b'' /\ a' dot w= b1`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[DOT_SYM;REAL_ARITH`b' * (a''' dot x) - (a''' dot v) * b1 + --(b1 * (a''' dot x) - b'' * b1) = + b' * b'' - (a''' dot v) * b1 + -- &0 +<=> +&0= ( b'-b1) * (b''- a''' dot x) +`] +THEN REAL_ARITH_TAC;(*19*) + +RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`{w:real^3} = p' INTER {x | a''' dot x = b''} +/\ p1 INTER {x | a' dot x = b1} = p' ==> a''' dot w = b'' /\ a' dot w= b1`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`b1< b' ==> ~(b'- b1= &0) `) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[DOT_SYM;REAL_ARITH`b' * (a''' dot x) - (a''' dot v) * b1 + --(b1 * (a''' dot x) - b'' * b1) = + b' * b'' - (a''' dot v) * b1 + -- &0 +<=> + ( b'-b1) * (b''- a''' dot x) = &0 +`;REAL_ENTIRE] +THEN REAL_ARITH_TAC](*19*);(*18*) + + + + +REMOVE_THEN "LINH10" MP_TAC +THEN EXPAND_TAC"p'" +THEN REWRITE_TAC[SET_RULE`(A INTER B) INTER C=A INTER(B INTER C)`] +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[SET_RULE`A INTER(B INTER C)= (A INTER B) INTER C`] +THEN MP_TAC(SET_RULE`p' SUBSET {x | a''' dot x <= b''} /\ p1 INTER {x | a' dot x = b1} = p' ==> p' SUBSET {x:real^3 | a' dot x = b1} INTER {x | a''' dot x <= b''} `) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`p' SUBSET {x | a' dot x = b1} INTER {x | a2 dot x <= b2} +==> p' SUBSET {x:real^3 | a2 dot x <= b2}`) +THEN RESA_TAC +THEN RESA_TAC +THEN SUBGOAL_THEN`v IN {x:real^3 | a2 dot x = b2}`ASSUME_TAC +THENL(*19*)[ + +REWRITE_TAC[IN_ELIM_THM] +THEN EXPAND_TAC "b2" +THEN EXPAND_TAC "a2" +THEN REWRITE_TAC[CROSS_LADD;VECTOR_ARITH`A-B=A+(-- B:real^3)`;DOT_LADD;CROSS_LNEG;DOT_LNEG;DOT_CROSS_SELF;] +THEN REWRITE_TAC[CROSS_LAGRANGE;DOT_LSUB;DOT_LMUL;EXTENSION;IN_ELIM_THM] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[DOT_SYM] +THEN REAL_ARITH_TAC;(*19*) + + +SUBGOAL_THEN`!v3:real^3. v3 IN p /\ ~(v3=v)==> ?v4. v4 IN p' /\ v4 IN aff_ge {v} {v3}`ASSUME_TAC +THENL(*10*)[ + +REPEAT STRIP_TAC +THEN MRESA1_TAC POLYTOPE_IMP_COMPACT`p:real^3->bool` +THEN MRESAL1_TAC KREIN_MILMAN_MINKOWSKI`p:real^3->bool`[GSYM vertices] +THEN MP_TAC(SET_RULE`(v3:real^3) IN p /\ (p:real^3->bool) = convex hull vertices p ==> v3 IN convex hull vertices p`) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th;]) +THEN ASM_REWRITE_TAC[CONVEX_HULL_EXPLICIT;IN_ELIM_THM] +THEN STRIP_TAC +THEN ABBREV_TAC`s1= s' DELETE (v:real^3)` +THEN MRESA_TAC FINITE_DELETE[`s':real^3->bool`;`v:real^3`] +THEN ABBREV_TAC`v12=vsum s1 (\v:real^3. u v % v)` +THEN ABBREV_TAC`t12=sum (s1:real^3->bool) (u:real^3->real)` +THEN MP_TAC(SET_RULE`(!x. x IN s' ==> &0 <= u x) ==>(!x:real^3. x IN s' DELETE v ==> &0 <= u x)`) +THEN RESA_TAC +THEN MRESA_TAC SUM_POS_LE[`u:real^3->real`;`s1:real^3->bool`] +THEN MP_TAC(REAL_ARITH`&0<= t12==> t12= &0 \/ &0< t12`) +THEN RESA_TAC +THENL(*11*)[ + +MRESA_TAC SUM_DELETE_CASES[`u:real^3->real`;`s':real^3->bool`;`v:real^3`] +THEN MP_TAC(SET_RULE`&0 = (if (v:real^3) IN s' then &1 - (u:real^3->real) v else &1) /\ ~(&0= &1)==> v IN s' /\ &1- u v= &0`) +THEN REWRITE_TAC[REAL_ARITH`~(&0= &1) `;REAL_ARITH`A- B= &0<=> B=A` ] +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN RESA_TAC +THEN MRESA_TAC VSUM_DELETE_CASES[`v:real^3`;`(\v:real^3. (u:real^3->real) v % v)`;`s':real^3->bool`] +THEN MRESA_TAC SUM_POS_EQ_0[`u:real^3->real`;`s1:real^3->bool`] +THEN SUBGOAL_THEN`(!x:real^3. x IN s1 ==> (u x) % x = vec 0)`ASSUME_TAC +THENL(*12*)[ + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th`x:real^3`) +THEN VECTOR_ARITH_TAC;(*12*) + +MRESAL_TAC VSUM_EQ_0[`(\v. (u:real^3->real) v % v)`;`s1:real^3->bool`][VECTOR_ARITH`v3 - &1 % v = vec 0 <=> v3=v`]](*12*);(*11*) + + +SUBGOAL_THEN`(inv t12) % v12 IN p:real^3->bool`ASSUME_TAC +THENL(*12*)[ + +MRESAL1_TAC KREIN_MILMAN_MINKOWSKI`p:real^3->bool`[GSYM vertices] +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th;]) +THEN ASM_REWRITE_TAC[CONVEX_HULL_EXPLICIT;IN_ELIM_THM] +THEN MP_TAC(REAL_ARITH`&0< t12==> ~(t12= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t12:real` +THEN EXISTS_TAC`s1:real^3->bool` +THEN EXISTS_TAC`(\v. inv(t12) * (u:real^3->real) v)` +THEN ASM_REWRITE_TAC[SUM_LMUL;VECTOR_ARITH`(a*b) %v=a%(b%v)`;VSUM_LMUL] +THEN MP_TAC(SET_RULE`s1= s' DELETE v:real^3 /\ s' SUBSET vertices p ==> s1 SUBSET vertices p`) +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[REAL_LE_INV_EQ] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[];(*12*) + + + + +SUBGOAL_THEN`a' dot inv t12 % v12:real^3 <= b1`ASSUME_TAC +THENL(*13*)[ + +EXPAND_TAC"v12" +THEN REWRITE_TAC[GSYM VSUM_LMUL] +THEN MRESA_TAC DOT_RSUM[`s1:real^3->bool`;`(\x:real^3. inv t12 % u x % x)`;`a':real^3`] +THEN REWRITE_TAC[DOT_RMUL] +THEN SUBGOAL_THEN`!x:real^3. x IN s1 ==> (\y. inv t12 * u y * (a' dot y)) x<= (\y. inv t12 * u y * b1) x` ASSUME_TAC +THENL(*14*)[ + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"s1" +THEN REWRITE_TAC[DELETE;IN_ELIM_THM] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`vertices p INTER {x:real^3 | a' dot x >= b1} = {v:real^3} /\ x IN s' /\ s' SUBSET vertices p /\ ~(x=v) ==> ~(a' dot x >= b1)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`~(a>= b)<=> a a' dot x:real^3 <= b1`) +THEN RESA_TAC +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[REAL_LE_INV_EQ] +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[];(*14*) + +MP_TAC(REAL_ARITH`&0< t12==> ~(t12= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t12:real` +THEN MRESA_TAC SUM_LE[`(\y:real^3. inv t12 * u y * (a' dot y))`;`(\y:real^3. inv t12 * u y * b1)`;`s1:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`a*b*c= (a*c) *b`;] +THEN ASM_REWRITE_TAC[SUM_LMUL; REAL_ARITH`(a*b)*c= b*(a*c)`; REAL_ARITH`a* &1=a` ]](*14*);(*13*) + +SUBGOAL_THEN`~(inv t12 % v12= v:real^3)` ASSUME_TAC +THENL(*14*)[ + +STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`~(a<= b)<=> b< a`];(*14*) + +SUBGOAL_THEN `aff_ge {v:real^3} {inv t12 % v12}= aff_ge {v:real^3} {v3}` ASSUME_TAC +THENL(*15*)[ + +MRESA_TAC AFF_GE_1_1[`v:real^3`;`inv t12 % v12:real^3`] +THEN MRESA_TAC AFF_GE_1_1[`v:real^3`;`v3:real^3`] +THEN EXPAND_TAC"v3" +THEN MRESAL_TAC VSUM_DELETE_CASES[`v:real^3`;`(\v:real^3. (u:real^3->real) v % v)`;`s':real^3->bool`][VECTOR_ARITH`a= b-c<=> b=a+c:real^3`] +THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL(*16*)[ + + +DISJ_CASES_TAC(SET_RULE`v IN (s':real^3->bool) \/ ~(v IN s')`) +THENL(*17*)[ + +RESA_TAC +THEN EXISTS_TAC`t1 - t2 * inv t12 * (u (v:real^3))` +THEN EXISTS_TAC`t2* inv t12:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % v + t2 % inv t12 % (v3 - u v % v) = + (t1 - t2 * inv t12 * u v) % v + (t2 * inv t12) % v3`;REAL_ARITH`t1 - t2 * inv t12 * u v + t2 * inv t12= t1 +t2 * inv t12 *(&1- u v)`] +THEN MRESA_TAC SUM_DELETE_CASES[`u:real^3->real`;`s':real^3->bool`;`v:real^3`] +THEN MP_TAC(REAL_ARITH`&0< t12==> ~(t12= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t12:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`a* &1=a`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_INV +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]);(*17*) + + + +MRESA_TAC SUM_DELETE_CASES[`u:real^3->real`;`s':real^3->bool`;`v:real^3`] +THEN REWRITE_TAC[VECTOR_ARITH`a % inv (&1) %v=a %v`]](*17*);(*16*) + +DISJ_CASES_TAC(SET_RULE`v IN (s':real^3->bool) \/ ~(v IN s')`) +THENL(*17*)[ + +ASM_REWRITE_TAC[VECTOR_ARITH`t1 % v + t2 % inv t12 % (v3 - u v % v)= (t1 - t2 * inv t12 * u v) %v+ (inv t12 * t2)% v3`] +THEN STRIP_TAC +THEN EXISTS_TAC`&1- t12 * t2:real` +THEN EXISTS_TAC`t12 * t2:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1- a+a= &1`;] +THEN MP_TAC(REAL_ARITH`&0< t12==> ~(t12= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t12:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 *a=a`;REAL_ARITH`a * b * c=(a*b)*c`] +THEN ASM_REWRITE_TAC[REAL_ARITH`((a*b)*c)*d=(c*a)*(b*d)`;REAL_ARITH`&1 *a=a`;REAL_ARITH`&1- a*b-b*c= &1- (c+a)*b`] +THEN MRESA_TAC SUM_DELETE_CASES[`u:real^3->real`;`s':real^3->bool`;`v:real^3`] +THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 - (u v + &1 - u v) * t2) = &1-(t1+t2) +t1`;REAL_ARITH`&1- &1+a=a`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM th]);(*17*) + +MRESA_TAC SUM_DELETE_CASES[`u:real^3->real`;`s':real^3->bool`;`v:real^3`] +THEN REWRITE_TAC[VECTOR_ARITH`a % inv (&1) %v=a %v`]](*17*)](*16*);(*15*) + + +ABBREV_TAC`v31=inv t12 % (v12:real^3)` +THEN MP_TAC(REAL_ARITH`(a':real^3) dot v31<= b1 ==> a' dot v31:real^3< b1\/ a' dot v31 = b1`) +THEN RESA_TAC +THENL(*16*)[ + + +SUBGOAL_THEN`?z. z IN segment[v31,v:real^3] INTER {x| a' dot x= b1} /\ ~(z= v)` ASSUME_TAC +THENL(*17*)[ + +MP_TAC(SET_RULE`vertices p INTER {x | a' dot x >= b1} = {v:real^3} ==> v IN {x | a' dot x >= b1}`) +THEN RESA_TAC +THEN REWRITE_TAC[INTER;IN_SEGMENT;IN_ELIM_THM] +THEN ASM_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MP_TAC(REAL_ARITH`a' dot v31 < b1 /\ a' dot v >= b1 /\ a' dot v = b' /\ b1< b' ==> &0< a' dot v - a' dot (v31:real^3) /\ &0< b1- a' dot v31 /\ b1- a' dot v31 < a' dot v - a' dot (v31:real^3) /\ ~(a' dot v - a' dot (v31:real^3)= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`a' dot v - a' dot (v31:real^3)` +THEN MRESA_TAC REAL_LT_MUL[`inv(a' dot v - a' dot (v31:real^3))`;`b1 - a' dot (v31:real^3)`] +THEN MP_TAC(REAL_ARITH`&0< inv(a' dot v - a' dot (v31:real^3))==> &0<= inv(a' dot v - a' dot (v31:real^3))`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`a' dot v - a' dot (v31:real^3)` +THEN MRESA_TAC REAL_LT_LMUL[`inv(a' dot v - a' dot (v31:real^3))`;`b1 - a' dot (v31:real^3)`;`a' dot v - a' dot (v31:real^3)`] +THEN EXISTS_TAC`(&1- inv (a' dot v - a' dot v31) * (b1 - a' dot v31)) % (v31:real^3)+ (inv (a' dot v - a' dot v31) * (b1 - a' dot v31))% v` +THEN REWRITE_TAC[DOT_RMUL; DOT_RADD; REAL_ARITH`(&1- b)* c+b * d=a<=>b*(d-c)= a- c`;] +THEN ASM_REWRITE_TAC[ REAL_ARITH`(a*b)*c= b*(a*c)`; REAL_ARITH`a * &1= a`] +THEN STRIP_TAC +THENL(*18*)[ + + + EXISTS_TAC`inv (a' dot v - a' dot v31) * (b1 - a' dot (v31:real^3))` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REAL_ARITH_TAC;(*18*) + +REWRITE_TAC[VECTOR_ARITH`(&1- b)%a + b % v= v<=> (&1-b)%(a-v)= vec 0`;VECTOR_MUL_EQ_0] +THEN STRIP_TAC +THENL(*19*)[ + +ASM_TAC THEN REAL_ARITH_TAC;(*19*) + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-B= vec 0 <=> A=B`]](*19*)](*18*);(*17*) + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`{v:real^3} SUBSET f /\ f SUBSET p/\ v31 IN p==> {v,v31} SUBSET p `) +THEN RESA_TAC +THEN MRESAL_TAC SUBSET_HULL [`convex:(real^3->bool)->bool`;`{v,v31:real^3}`;`p:real^3->bool`] [GSYM +SEGMENT_CONVEX_HULL;] +THEN MRESA_TAC SEGMENT_SUBSET_HALFLINE[`v:real^3`;`v31:real^3`] +THEN EXISTS_TAC`z':real^3` +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC +THEN ONCE_REWRITE_TAC[SEGMENT_SYM] +THEN ASM_TAC +THEN SET_TAC[]](*17*);(*16*) + + +EXISTS_TAC`v31:real^3` +THEN MP_TAC(SET_RULE`a' dot v31 = b1 /\ v31 IN p ==> v31 IN p INTER {x:real^3| a' dot x= b1}`) +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &1`] +THEN RESA_TAC +THEN MRESA_TAC point_in_aff_ge_1_1[`v:real^3`;`v31:real^3`]](*16*)](*15*)](*14*)](*13*)](*12*)](*11*);(*10*) + + +SUBGOAL_THEN`p SUBSET {x:real^3| a2 dot x <= b2}` ASSUME_TAC +THENL(*11*)[ + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM] +THEN GEN_TAC +THEN STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`x=v \/ ~(x=v:real^3)`) +THENL(*12*)[ + +ASM_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`a<=a`];(*12*) + +MRESA_TAC AFF_GE_1_1[`v:real^3`;`x:real^3`] +THEN REMOVE_THEN "LINH" (fun th-> MRESAL1_TAC th`x:real^3`[IN_ELIM_THM]) +THEN MP_TAC(SET_RULE`v4 IN p' /\p' SUBSET {x:real^3 | a2 dot x <= b2} ==> a2 dot v4<= b2`) +THEN ASM_REWRITE_TAC[DOT_RADD;DOT_RMUL] +THEN ASM_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`t1 * b2 + t2 * (a2 dot x) <= b2<=> t2 * (a2 dot x) <= (t2+ &1 -(t1+t2))*b2`; REAL_ARITH`a + &1- &1=a`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0<= t2==> t2= &0 \/ &0< t2`) +THEN RESA_TAC +THENL(*13*)[ + +ASM_REWRITE_TAC[REAL_ARITH`t1+ &0= &1<=> t1= &1`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`v4 = &1 % v + &0 % x<=> v4=v`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MP_TAC(SET_RULE`v IN p' /\ p INTER {x:real^3 | a' dot x = b1}= p' ==> a' dot v =b1`) +THEN RESA_TAC +THEN ASM_TAC +THEN REAL_ARITH_TAC;(*13*) + +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0< t2==> ~(t2= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2:real` +THEN MRESAL_TAC REAL_LE_LMUL[`inv t2`;`t2 * (a2 dot (x:real^3))`;`t2 * b2`][REAL_LE_INV_EQ;REAL_ARITH`a*b*c=(a*b)*c`;REAL_ARITH`&1 * a=a`] +](*13*)](*12*);(*11*) + + + + + +SUBGOAL_THEN`p INTER {x| a2 dot x = b2} SUBSET aff_ge {v:real^3} {w}`ASSUME_TAC +THENL(*12*)[ +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN STRIP_TAC +THEN REWRITE_TAC[INTER;SUBSET;IN_ELIM_THM] +THEN DISJ_CASES_TAC(SET_RULE`w=v \/ ~(v=(w:real^3))`) +THENL(*13*)[ + MP_TAC(SET_RULE`{w:real^3} = p' INTER {x | a2 dot x = b2} /\ p INTER {x :real^3| a' dot x = b1} = p'==> a' dot w= b1`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN ASM_TAC +THEN REAL_ARITH_TAC;(*13*) + +MRESAL_TAC AFF_GE_1_1[`v:real^3`;`w:real^3`][IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`x=v \/ ~(x=(v:real^3))`) +THENL(*14*)[ + +EXISTS_TAC`&1:real` +THEN EXISTS_TAC`&0:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &0 /\ &1 + &0= &1`] +THEN VECTOR_ARITH_TAC;(*14*) + +MRESA_TAC AFF_GE_1_1[`v:real^3`;`x:real^3`] +THEN REMOVE_THEN "LINH" (fun th-> MRESAL1_TAC th`x:real^3`[IN_ELIM_THM]) +THEN SUBGOAL_THEN`v4 IN {x:real^3 | a2 dot x=b2}` ASSUME_TAC +THENL(*15*)[ + +ASM_REWRITE_TAC[IN_ELIM_THM;DOT_RADD;DOT_RMUL] +THEN ASM_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`t1 * b2 + t2 * b2 =(t1+ t2) * b2`] +THEN REAL_ARITH_TAC;(*15*) + +MP_TAC(SET_RULE`{w} = p' INTER {x | a2 dot x = b2} /\ v4 IN p'/\ v4 IN {x:real^3 | a2 dot x = b2}==> v4=w`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC THEN MP_TAC(SYM th)) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC ) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0<= t2==> t2= &0 \/ &0 t1= &1`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`v4 = &1 % v + &0 % x<=> v4=v`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC);(*16*) + +REPEAT RESA_TAC +THEN EXISTS_TAC`&1 - inv t2:real` +THEN EXISTS_TAC`inv t2:real` +THEN MP_TAC(REAL_ARITH`&0< t2==> ~(t2= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1- a +a= &1`;REAL_LE_INV_EQ;VECTOR_ARITH`(&1 - inv t2) % v + inv t2 % (t1 % v + t2 % x)= (&1 - inv t2*(t2 + &1-(t1+t2))) % v + (inv t2 * t2) % x`;REAL_ARITH`a+ &1- &1=a`] +THEN VECTOR_ARITH_TAC](*16*)](*15*)](*14*)](*13*);(*12*) + + + + +SUBGOAL_THEN`aff_ge {v:real^3} {w} SUBSET {x | a2 dot x = b2}` ASSUME_TAC +THENL(*13*)[ + +DISJ_CASES_TAC(SET_RULE`w=v \/ ~(v=w:real^3)`) +THENL(*14*)[ + + MP_TAC(SET_RULE`{w:real^3} = p' INTER {x | a2 dot x = b2} /\ p INTER {x :real^3| a' dot x = b1} = p'==> a' dot w= b1`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN ASM_TAC +THEN REAL_ARITH_TAC;(*14*) + +MRESA_TAC AFF_GE_1_1[`v:real^3`;`w:real^3`] +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[DOT_RADD;DOT_RMUL] +THEN ASM_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`a*b+c*b=(a+c)*b`;REAL_ARITH`&1 *a=a`] +](*14*);(*13*) + +MP_TAC(SET_RULE`p INTER {x | a2 dot x = b2} SUBSET aff_ge {v} {w} +/\ aff_ge {v} {w} SUBSET {x | a2 dot x = b2}/\ {v, y} SUBSET p +==> aff_ge {v} {w} INTER p= p INTER {x:real^3 | a2 dot x = b2} /\ v IN p `) +THEN RESA_TAC +THEN MRESA1_TAC POLYTOPE_IMP_COMPACT`p:real^3->bool` +THEN MRESA_TAC HALFLINE_INTER_COMPACT_SEGMENT[`p:real^3->bool`;`v:real^3`;`w:real^3`] +THEN MRESAL_TAC FACE_OF_INTER_SUPPORTING_HYPERPLANE_LE_STRONG[`p:real^3->bool`;`a2:real^3`;`b2:real`][SET_RULE`(!x. x IN p ==> a2 dot x <= b2)<=> p SUBSET {x| a2 dot x<= b2}`;CONVEX_SEGMENT;SET_RULE`{a} SUBSET A<=> a IN A`] +THEN MRESA_TAC SEGMENT_FACE_OF[`p:real^3->bool`;`v:real^3`;`c:real^3`] +THEN MP_TAC(SET_RULE`p INTER {x | a2 dot x = b2} SUBSET aff_ge {v} {w} +/\ p INTER {x | a2 dot x = b2} =segment[v,c] /\ c IN segment[v,c] ==> c IN aff_ge {v} {w:real^3}`) +THEN ASM_REWRITE_TAC[ENDS_IN_SEGMENT] +THEN DISJ_CASES_TAC(SET_RULE`w=v \/ ~(v=w:real^3)`) +THENL(*14*)[ + + MP_TAC(SET_RULE`{w:real^3} = p' INTER {x | a2 dot x = b2} /\ p INTER {x :real^3| a' dot x = b1} = p'==> a' dot w= b1`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN ASM_TAC +THEN REAL_ARITH_TAC;(*14*) + +MRESA_TAC AFF_GE_1_1[`v:real^3`;`w:real^3`] +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM] +THEN DISCH_TAC +THEN EXISTS_TAC`c:real^3` +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[edges; IN_ELIM_THM;vertices] +THEN MP_TAC(SET_RULE`{w} = p' INTER {x | a2 dot x = b2} /\ p INTER {x | a' dot x = b1} = p' ==> w IN p INTER {x:real^3| a2 dot x = b2}`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(v:real^3 = w) /\ w IN segment [v,c] ==> ~(segment [v,c]={v})`) +THEN REWRITE_TAC[SEGMENT_EQ_SING] +THEN RESA_TAC +THEN DISCH_TAC +THEN STRIP_TAC +THENL(*15*)[ + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN ASM_REWRITE_TAC[DOT_RADD;DOT_RMUL] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0<= t2==> t2= &0 \/ &0< t2 `) +THEN RESA_TAC +THENL(*16*)[ + +REWRITE_TAC[REAL_ARITH`t+ &0= &1<=> t= &1`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH` &1 % v + &0 % w= v`];(*16*) + +REPEAT STRIP_TAC +THEN MRESA_TAC REAL_LT_LMUL[`t2:real`;`a dot w:real^3`;`b:real`] +THEN MP_TAC(REAL_ARITH`t2 * (a dot w:real^3) < t2 * b ==> t1 * b+ t2 * (a dot w) < (t1+t2) * b`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC](*16*);(*15*) + +EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`c:real^3` +THEN ASM_REWRITE_TAC[edge_of] +THEN ONCE_REWRITE_TAC[GSYM AFF_DIM_AFFINE_HULL] +THEN REWRITE_TAC[AFFINE_HULL_SEGMENT] +THEN ASM_REWRITE_TAC[AFF_DIM_AFFINE_HULL;AFF_DIM_2] +]]]]]]]]]]]]]]]]]]]]]]]));; + + + +let CARD_SET_OF_EDGE_INEQ_1_POLYHEDRON=prove(`!p:real^3->bool. + bounded p /\ polyhedron p /\ vec 0 IN interior p +==> (!v. v IN vertices p ==>CARD (set_of_edge v (vertices p) (edges p)) >1)`, +REPEAT STRIP_TAC +THEN MRESA1_TAC EXISTS_EDGE_AT_VERTICES`p:real^3->bool` +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`v:real^3`[SET_RULE`~(A={})<=> ?w. w IN A`]) +THEN MRESA_TAC POLYHEDRON_FAN[`p:real^3->bool`;`vec 0:real^3`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;` (w:real^3)`; +` (v:real^3)`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESAL_TAC properties_coordinate[`((vec 0):real^3)`;` (v:real^3)`;` (w:real^3)`][VECTOR_ARITH`a - vec 0=a`] +THEN ABBREV_TAC`a= e2_fan (vec 0) v (w:real^3)` +THEN MRESA_TAC ORTHONORMAL_IMP_NONZERO [`e1_fan ((vec 0):real^3) (v:real^3) (w:real^3)`;`e2_fan ((vec 0):real^3) (v:real^3) (w:real^3)`;`e3_fan ((vec 0):real^3) (v:real^3) (w:real^3)`] +THEN MRESAL_TAC FLVNSME[`v:real^3`;`{x:real^3| a dot x < &0}`;`a:real^3`;`&0`;`p:real^3->bool`][IN_ELIM_THM; DOT_RZERO] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`w =w' \/ ~(w= w':real^3)`) +THENL[ +POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REAL_ARITH_TAC); +MRESA_TAC CARD_2_FAN[`w:real^3`;`w':real^3`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;` (w':real^3)`; +` (v:real^3)`] +THEN MP_TAC(SET_RULE`w' IN set_of_edge v (vertices p) (edges p) /\ w IN set_of_edge v (vertices p) (edges p) +==> {w,w':real^3} SUBSET set_of_edge v (vertices p) (edges p)`) +THEN RESA_TAC +THEN MRESA_TAC CARD_SUBSET[`{w,w':real^3}`;`set_of_edge v (vertices p) (edges (p:real^3->bool))`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC]);; + + +let BSXAQBQ=prove(`!p:real^3->bool x. + bounded p /\ polyhedron p /\ vec 0 IN interior p +/\ x IN d_fan((vec 0),(vertices p),(edges p)) +==> azim_fan (vec 0) (vertices p) (edges p) (pr2 x) (pr3 x) < pi`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA1_TAC CARD_SET_OF_EDGE_INEQ_1_POLYHEDRON`p:real^3->bool` +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN MRESA_TAC POLYHEDRON_FAN[`p:real^3->bool`;`vec 0:real^3`] +THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`] +THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;` (w:real^3)`; +` (v:real^3)`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_THEN"LINH"(fun th-> MP_TAC(ISPEC `v:real^3` th)) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[azim_fan;pr2;pr3] +THEN ABBREV_TAC`a= v cross w:real^3` +THEN MRESAL_TAC FLVNSME[`v:real^3`;`{x:real^3| (-- a) dot x < &0}`;`(-- a):real^3`;`&0`;`p:real^3->bool`][IN_ELIM_THM; DOT_LNEG; DOT_RZERO; VECTOR_ARITH`((-- A:real^3)= vec 0) <=> (A = vec 0)`;REAL_ARITH`(-- a= &0) <=> (a= &0)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN REWRITE_TAC[REAL_ARITH`-- a< &0<=> &0< a`] +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[CROSS_EQ_0;DOT_CROSS_SELF] +THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`w =w' \/ ~(w'= w:real^3)`) +THENL[ +POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[CROSS_EQ_0;DOT_CROSS_SELF] +THEN REAL_ARITH_TAC; + MRESA_TAC remark1_fan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;` (w':real^3)`; +` (v:real^3)`] +THEN MP_TAC(SET_RULE`w' IN set_of_edge v (vertices p) (edges p) /\ w IN set_of_edge v (vertices p) (edges p)/\ ~(w'=w:real^3) +==> ~( set_of_edge v (vertices p) (edges p)= {w})`) +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;` (v:real^3)`; +` (w:real^3)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w':real^3`) +THEN MRESA_TAC JBDNJJB[`v:real^3`;`w:real^3`;`w':real^3`] +THEN MRESA_TAC REAL_LT_MUL[`t:real`;`a dot w':real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;]) +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim (vec 0) v w w' < &2 * pi ==> (&0 <= azim (vec 0) v w w' -pi /\ azim (vec 0) v w w' - pi <= pi) \/ azim (vec 0) v w w'< pi`) +THEN ASM_REWRITE_TAC[azim] +THEN STRIP_TAC +THENL[ +MRESA1_TAC SIN_POS_PI_LE`azim (vec 0) v w w' - pi` +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[SIN_SUB; SIN_PI;COS_PI; REAL_ARITH`&0<= a * -- &1- b * &0<=> ~( &0< a)`]; + ASM_TAC +THEN REAL_ARITH_TAC]]);; + + + +let POLYTOPE_FAN80=prove(`!p:real^3->bool. + bounded p /\ polyhedron p /\ vec 0 IN interior p +==> fan80 (vec 0,vertices p,edges p)`, + +REWRITE_TAC[fan80] +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN MRESA1_TAC CARD_SET_OF_EDGE_INEQ_1_POLYHEDRON`p:real^3->bool` +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN MRESA_TAC POLYHEDRON_FAN[`p:real^3->bool`;`vec 0:real^3`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;` (u:real^3)`; +` (v:real^3)`] +THEN ABBREV_TAC`a= v cross u:real^3` +THEN MRESAL_TAC FLVNSME[`v:real^3`;`{x:real^3| (-- a) dot x < &0}`;`(-- a):real^3`;`&0`;`p:real^3->bool`][IN_ELIM_THM; DOT_LNEG; DOT_RZERO; VECTOR_ARITH`((-- A:real^3)= vec 0) <=> (A = vec 0)`;REAL_ARITH`(-- a= &0) <=> (a= &0)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN REWRITE_TAC[REAL_ARITH`-- a< &0<=> &0< a`] +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[CROSS_EQ_0;DOT_CROSS_SELF] +THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`u =w \/ ~(w= u:real^3)`) +THENL[ +POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[CROSS_EQ_0;DOT_CROSS_SELF] +THEN REAL_ARITH_TAC; + + + MRESA_TAC remark1_fan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;` (w:real^3)`; +` (v:real^3)`] +THEN MP_TAC(SET_RULE`w IN set_of_edge v (vertices p) (edges p) /\ u IN set_of_edge v (vertices p) (edges p)/\ ~(w=u:real^3) +==> ~( set_of_edge v (vertices p) (edges p)= {u})`) +THEN RESA_TAC +THEN MRESA_TAC SIGMA_FAN[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;` (v:real^3)`; +` (u:real^3)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`) +THEN MRESA_TAC JBDNJJB[`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC REAL_LT_MUL[`t:real`;`a dot w:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;]) +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`azim (vec 0) v u w < &2 * pi ==> (&0 <= azim (vec 0) v u w -pi /\ azim (vec 0) v u w - pi <= pi) \/ azim (vec 0) v u w< pi`) +THEN ASM_REWRITE_TAC[azim] +THEN STRIP_TAC +THENL[ + +MRESA1_TAC SIN_POS_PI_LE`azim (vec 0) v u w - pi` +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[SIN_SUB; SIN_PI;COS_PI; REAL_ARITH`&0<= a * -- &1- b * &0<=> ~( &0< a)`]; +MP_TAC(REAL_ARITH`azim (vec 0) v u w < pi /\ azim (vec 0) v u (sigma_fan (vec 0) (vertices p) (edges p) v u) <= azim (vec 0) v u w ==> azim (vec 0) v u (sigma_fan (vec 0) (vertices p) (edges p) v u)< pi `) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0<= azim (vec 0) v u (sigma_fan (vec 0) (vertices p) (edges p) v u) ==> (azim (vec 0) v u (sigma_fan (vec 0) (vertices p) (edges p) v u)= &0) \/ &0< azim (vec 0) v u (sigma_fan (vec 0) (vertices p) (edges p) v u)`) +THEN ASM_REWRITE_TAC[azim] +THEN STRIP_TAC +THEN + MRESA_TAC remark1_fan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;`(sigma_fan (vec 0) (vertices p) (edges p) v u):real^3`; +` (v:real^3)`] +THEN MRESA_TAC UNIQUE_AZIM_0_POINT_FAN[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;` (v:real^3)`; +` (u:real^3)`; `(sigma_fan (vec 0) (vertices p) (edges p) v u):real^3`]]]);; + + + + +let WBLARHH=prove(`!p:real^3->bool. + bounded p /\ polyhedron p /\ vec 0 IN interior p +==> + (!f. f IN face_set (hypermap1_of_fanx (vec 0,vertices p,edges p)) ==> (?!f1. f1 facet_of p /\ dartset_leads_into_fan (vec 0) (vertices p) (edges p) f = fchanged f1))`, + +REPEAT STRIP_TAC +THEN MRESA_TAC POLYHEDRON_FAN[`p:real^3->bool`;`vec 0:real^3`] +THEN MRESA1_TAC CARD_SET_OF_EDGE_INEQ_1_POLYHEDRON`p:real^3->bool` +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN MRESA1_TAC POLYTOPE_FAN80`p:real^3->bool` +THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;`f:real^3#real^3#real^3#real^3->bool`] +THEN ABBREV_TAC`s= dartset_leads_into_fan (vec 0) (vertices p) (edges (p:real^3->bool)) f` +THEN MRESAL_TAC PIIJBJK[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;][conforming_fan;conforming_bijection_fan] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`s:real^3->bool`) +THEN POP_ASSUM MP_TAC +THEN MRESA1_TAC AMHFNXP`p:real^3->bool` +THEN POP_ASSUM (fun th-> MRESA1_TAC th`s:real^3->bool`));; + +let WBLARHH_BIJ = prove_by_refinement( + `!p:real^3->bool. bounded p /\ polyhedron p /\ vec 0 IN interior p ==> + (BIJ + (dartset_leads_into_fan (vec 0) (vertices p) (edges p)) + (face_set (hypermap1_of_fanx(vec 0,vertices p,edges p))) + (topological_component_yfan (vec 0,vertices p, edges p)))`, + (* {{{ proof *) + [ +REWRITE_TAC [BIJ;INJ;SURJ;IN;IN_ELIM_THM]; +GEN_TAC ; +STRIP_TAC ; +MRESA_TAC (REWRITE_RULE[IN] POLYHEDRON_FAN) [`p:real^3->bool`;`vec 0:real^3`]; +MRESA1_TAC (REWRITE_RULE[IN] CARD_SET_OF_EDGE_INEQ_1_POLYHEDRON)`p:real^3->bool`; + MRESA1_TAC (REWRITE_RULE[IN] POLYTOPE_FAN80) `p:real^3->bool`; +MRESA_TAC (REWRITE_RULE[IN] dartset_leads_into_is_topological_component_yfan) [`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`]; + MRESAL_TAC (REWRITE_RULE[IN] Conforming.PIIJBJK)[`vec 0:real^3`;`vertices (p:real^3->bool)`;`edges (p:real^3->bool)`;][REWRITE_RULE[IN] Conforming.conforming_fan;REWRITE_RULE[IN] Conforming.conforming_bijection_fan]; +ASM_MESON_TAC [] + ]);; + (* }}} *) + +end;; diff --git a/text_formalization/fan/topology.hl b/text_formalization/fan/topology.hl new file mode 100755 index 0000000..6a3b7ea --- /dev/null +++ b/text_formalization/fan/topology.hl @@ -0,0 +1,4775 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + +flyspeck_needs "general/sphere.hl";; +flyspeck_needs "fan/introduction.hl";; + + +module Topology = struct + + +(* +# use "/home/truong/Desktop/googlecode/hol_light/hol.ml";; +needs "/home/truong/Desktop/googlecode/hol_light/Multivariate/flyspeck.ml";; +needs "/home/truong/Desktop/googlecode/flyspeck/text_formalization/general/sphere.hl";; +*) + + +open Sphere;; +open Fan_defs;; +open Fan;; + + + +let CARD_SIGMA_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3). +FAN(x,V,E) ==> +CARD( IMAGE (sigma_fan x V E v) (set_of_edge v V E))= CARD(set_of_edge v V E) +`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN MATCH_MP_TAC CARD_IMAGE_INJ THEN STRIP_TAC +THENL[ +REPEAT GEN_TAC THEN STRIP_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`x':real^3`]properties_of_set_of_edge_fan) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`y:real^3`]properties_of_set_of_edge_fan) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN +ASM_MESON_TAC[MONO_SIGMA_FAN]; +POP_ASSUM MP_TAC THEN REWRITE_TAC[FAN;fan1] THEN MESON_TAC[remark_finite_fan1]]);; + + + + + + +let MONO_AZIM_SIGMA_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3). +FAN(x,V,E) /\ ({v,u} IN E) +/\ ({v,w} IN E) /\ ~(sigma_fan x V E v w =u) +==> (azim x v u w <= azim x v u (sigma_fan x V E v w))`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT(POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"1") +THEN USE_THEN "1" MP_TAC THEN REWRITE_TAC[FAN;fan6] +THEN REPEAT STRIP_TAC +THEN REPEAT(POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"1") THEN +DISCH_THEN (LABEL_TAC"a") THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_THEN(LABEL_TAC "b") + THEN REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (u:real^3)`;` (v:real^3)`]properties_of_graph) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN DISJ_CASES_TAC(SET_RULE`({(w:real^3)}=set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) \/ ~({(w:real^3)}=set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))`) +THENL(*1*)[ +ASM_REWRITE_TAC[sigma_fan] THEN REAL_ARITH_TAC;(*1*) + +DISJ_CASES_TAC(SET_RULE`((u:real^3)=(w:real^3))\/ ~(u=w)`) +THENL (*2*)[ + +ASM_REWRITE_TAC[AZIM_REFL] THEN MESON_TAC[azim];(*2*) + +DISJ_CASES_TAC(SET_RULE`(azim (x:real^3) (v:real^3) (u:real^3) (w:real^3) <= azim (x:real^3) (v:real^3) (u:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) ) \/ ~(azim (x:real^3) (v:real^3) (u:real^3) (w:real^3) <= azim (x:real^3) (v:real^3) (u:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) )`) + THENL (*3*)[ +ASM_REWRITE_TAC[];(*3*) + +SUBGOAL_THEN`azim (x:real^3) (v:real^3) (u:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) +<= azim (x:real^3) (v:real^3) (u:real^3) (w:real^3) ` ASSUME_TAC +THENL(*4*)[ +POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*4*) + +MP_TAC(ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (u:real^3)`]properties_of_set_of_edge) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN +MP_TAC(ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (w:real^3)`]properties_of_set_of_edge) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`]SIGMA_FAN) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "c") THEN + SUBGOAL_THEN `{(u:real^3),(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)),(w:real^3)}SUBSET set_of_edge v V E` ASSUME_TAC +THENL(*5*)[ +ASM_TAC THEN SET_TAC[];(*5*) + +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`]CYCLIC_SET_EDGE_FAN) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;`{(u:real^3), (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)),(w:real^3)}`;`set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)` ]subset_cyclic_set_fan) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`;` (w:real^3)`]sum2_azim_fan) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN SUBGOAL_THEN `azim (x:real^3) (v:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) (w:real^3)<= azim x v u w` ASSUME_TAC + +THENL(*6*)[ +MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3`; `sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)`]azim) THEN REPEAT(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC;(*6*) + +POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[])THEN ASM_REWRITE_TAC[] THEN +MP_TAC (ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`]properties_of_set_of_edge) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN REMOVE_THEN "b" (fun th->MP_TAC (ISPEC`{(v:real^3),(w:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(u:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))}`th) THEN ASSUME_TAC(th)) + THEN REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] +THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] + THEN + DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (w:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))= &0) \/ ~(azim (x:real^3) (v:real^3) (w:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) = &0)`) +THENL(*7*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`]UNIQUE_AZIM_0_POINT_FAN) +THEN ASM_TAC THEN SET_TAC[];(*7*) + +DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (w:real^3) (u:real^3)= &0) \/ ~(azim (x:real^3) (v:real^3) (w:real^3) (u:real^3) = &0)`) + +THENL(*8*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;`(u:real^3)`]UNIQUE_AZIM_0_POINT_FAN) +THEN ASM_TAC THEN SET_TAC[];(*8*) + +MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;`w:real^3`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`]AZIM_COMPL) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (w:real^3)`;` (u:real^3)`]AZIM_COMPL) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`&2 * pi - a<= &2 * pi - (b:real) <=> b<= (a:real)`] + THEN REMOVE_THEN "c" (fun th -> MP_TAC(ISPEC `u:real^3` th) ) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN STRIP_TAC + THEN SUBGOAL_THEN `azim (x:real^3) (v:real^3) (w:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) = azim x v w u` ASSUME_TAC + +THENL(*9*)[ +POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*9*) + +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`;`u:real^3`]UNIQUE_AZIM_POINT_FAN) + THEN ASM_REWRITE_TAC[]]]]]]]]]]);; + + + + + + + + + + +let MONO_POWER_SIGMA_FAN=prove(`!(i:num) (j:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ ({v,u} IN E)/\(j u=power_map_points sigma_fan x V E v u (i-j)`, +INDUCT_TAC THENL +[ARITH_TAC; + +INDUCT_TAC THENL +[REWRITE_TAC[ARITH_RULE `SUC i- 0 =SUC (i:num)`;power_map_points] THEN ASM_TAC THEN SET_TAC[]; + +REWRITE_TAC[ARITH_RULE `SUC (i:num)-SUC (j:num)= i - j`; ARITH_RULE `SUC(j:num) < SUC (i) <=> j < i`;power_map_points] + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "a") THEN DISCH_TAC + THEN REPEAT GEN_TAC THEN STRIP_TAC THEN + MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;` (u:real^3)`]properties_of_set_of_edge_fan) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN MP_TAC(ISPECL[`(i:num)`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]image_power_map_points) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(j:num)`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]image_power_map_points) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`]properties_of_set_of_edge_fan) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (j:num)`]properties_of_set_of_edge_fan) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN MP_TAC(ISPECL[` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`;`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (j:num)`]MONO_SIGMA_FAN) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN REMOVE_THEN "a"(fun th-> MP_TAC(ISPECL[`(j:num) `;`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]th)) + THEN ASM_REWRITE_TAC[]]]);; + + + + + + +let MONO_POWER_MAP_POINTS1_FAN=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ (u IN set_of_edge v V E) /\ ~(set_of_edge v V E={u}) +==> ~(power_map_points (sigma_fan) x V E v u i=power_map_points (sigma_fan) x V E v u (SUC i)) +`, +INDUCT_TAC THENL[ +REWRITE_TAC[power_map_points] THEN REPEAT GEN_TAC THEN STRIP_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]SIGMA_FAN) THEN ASM_MESON_TAC[]; +REPEAT GEN_TAC THEN POP_ASSUM + (fun th-> MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]th))THEN REWRITE_TAC[power_map_points] + THEN STRIP_TAC THEN STRIP_TAC THEN REPEAT(POP_ASSUM MP_TAC) +THEN DISCH_THEN (LABEL_TAC "a") THEN DISCH_THEN (LABEL_TAC "b") +THEN USE_THEN "b" MP_TAC THEN REWRITE_TAC[FAN] +THEN STRIP_TAC +THEN DISCH_TAC THEN DISCH_TAC +THEN REMOVE_THEN "a" MP_TAC THEN MP_TAC(ARITH_RULE `SUC (i:num)< CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))==> i < CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))`) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC MONO_NOT THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(i:num)`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]image_power_map_points) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC +THEN MP_TAC(ISPECL[`SUC (i:num)`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]image_power_map_points) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[` (v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))`] properties_of_set_of_edge) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[` (v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (SUC (i:num)))`] properties_of_set_of_edge) + THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`;`sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))`]MONO_SIGMA_FAN) +THEN ASM_MESON_TAC[]]);; + + + + + + + + +let MONO_AZIM_POWER_SIGMA_FAN=prove(`! (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num). +FAN(x,V,E) /\ ({v,u} IN E) /\ ~(power_map_points (sigma_fan) x V E v u (SUC i) = u) +==> azim x v u (power_map_points (sigma_fan) x V E v u i)<= azim x v u (power_map_points (sigma_fan) x V E v u (SUC i)) +`, +REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT(POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"1") +THEN USE_THEN "1" MP_TAC THEN REWRITE_TAC[FAN;fan6; power_map_points] +THEN REPEAT STRIP_TAC +THEN REPEAT(POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"1") THEN REPEAT STRIP_TAC + THEN MP_TAC (ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (u:real^3)`]properties_of_set_of_edge) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(i:num)`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]image_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC (ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`power_map_points (sigma_fan)(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`]properties_of_set_of_edge) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;`power_map_points (sigma_fan)(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`]MONO_AZIM_SIGMA_FAN) THEN ASM_REWRITE_TAC[]);; + + + + + + + + + + + +(* Proof of Lemma [VBTIKLP] *) + +(*let lemma62=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 w:real^3 w1:real^3. +a IN a_node_fan x V E (x,v,w,w1)==>(?n. a=(x,v,(power_map_points sigma_fan x V E v w n),(power_map_points sigma_fan x V E v w (SUC n))))`, +REWRITE_TAC[a_node_fan; IN_ELIM_THM; ] THEN REWRITE_TAC[node_fan] THEN REWRITE_TAC[power_n_fan]);;*) + +(* local definitions *) + +let complement_set= new_definition`complement_set {x:real^3, v:real^3} = {y:real^3| ~(y IN aff {x,v})} `;; + +let subset_aff=prove(`!x:real^3 v:real^3. (aff{x, v} SUBSET (UNIV:real^3->bool))`, REPEAT GEN_TAC THEN SET_TAC[]);; + + +let union_aff=prove(`!x v:real^3. (UNIV:real^3->bool) = aff{x, v} UNION complement_set {x, v} `, +REPEAT GEN_TAC THEN REWRITE_TAC[complement_set] THEN SET_TAC[]);; + +(*---------------------------------------------------------------*) +(* the properties of if_azims_fan *) +(*---------------------------------------------------------------*) + + + + +(* azim pf powers of node map *) + +let if_azims_fan= new_definition` +if_azims_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) + = if i = CARD(set_of_edge v V E) + then &2 * pi + else azim x v u (power_map_points sigma_fan x V E v u i)`;; + +let if_azims_works_fan=prove( +`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num). +( &0 <= if_azims_fan x V E v u i) /\ if_azims_fan x V E v u i <= &2 * pi`, +REPEAT GEN_TAC THEN REWRITE_TAC[REAL_ARITH `(a:real) <= (b:real) <=> (b >= a)`; if_azims_fan; azim;COND_ELIM_THM] + THEN MP_TAC(ISPECL [`x:real^3`; `v:real^3`; `u:real^3`; +`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`]azim) + THEN STRIP_TAC + THEN ASSUME_TAC(PI_WORKS) THEN ASM_REWRITE_TAC[] + THEN REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC);; + + + + +let set_of_orbits_points_fan = new_definition `set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) = {power_map_points sigma_fan x V E v u i| 0<=i }`;; + +let number_of_orbits_fan = new_definition `number_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) = CARD(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))`;; + + + +let addition_sigma_fan = prove(`!(m:num) (n:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +power_map_points sigma_fan x V E v u (m + n) = (power_map_points sigma_fan x V E v (power_map_points sigma_fan x V E v u n) m) `, +INDUCT_TAC +THENL [ +REWRITE_TAC[power_map_points; ARITH_RULE`0 + n:num =n`]; +REWRITE_TAC[ARITH_RULE` SUC (m:num) + n= SUC(m+n)`; power_map_points] THEN REPEAT GEN_TAC + THEN POP_ASSUM(ASSUME_TAC o GSYM o (ISPECL[`(n:num) `;`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`])) + THEN ASM_TAC THEN SET_TAC[]]);; + + + + + + +let fix_point_sigma_fan=prove(`! (q:num) (i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +(power_map_points (sigma_fan) x V E v u i=u) +==>power_map_points sigma_fan x V E v u (q * i)=u +`, +INDUCT_TAC THENL[ +ASM_REWRITE_TAC[ARITH_RULE`0 * i:num = 0`;power_map_points]; +REWRITE_TAC[ARITH_RULE`SUC q * i:num= q * i + i`] THEN REPEAT GEN_TAC THEN + POP_ASSUM(MP_TAC o (ISPECL[`(i:num) `;`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`])) + THEN DISCH_THEN(LABEL_TAC "a") THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[addition_sigma_fan]]);; + +let i_IN_ORBITS_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num). + power_map_points (sigma_fan) x V E v u i IN set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`, +REWRITE_TAC[set_of_orbits_points_fan; IN_ELIM_THM] THEN REPEAT GEN_TAC THEN EXISTS_TAC`i:num` THEN REWRITE_TAC[power_map_points] THEN SIMP_TAC[] THEN ARITH_TAC);; + +let u_IN_ORBITS_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . + u IN set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`, +REWRITE_TAC[set_of_orbits_points_fan; IN_ELIM_THM] THEN REPEAT GEN_TAC THEN EXISTS_TAC`0` THEN REWRITE_TAC[power_map_points] THEN SIMP_TAC[] THEN ARITH_TAC);; + + +let IN_ORBITS_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (w:real^3). + w IN set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) +==> sigma_fan x V E v w IN set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`, + +REPEAT GEN_TAC THEN REWRITE_TAC[set_of_orbits_points_fan; IN_ELIM_THM] THEN STRIP_TAC THEN EXISTS_TAC`SUC i` THEN ASM_REWRITE_TAC[power_map_points] THEN ARITH_TAC);; + + +let ORBITS_SUBSET_EDGE_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ ({v,u} IN E) +==> set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) +SUBSET set_of_edge v V E`, +REPEAT GEN_TAC THEN STRIP_TAC + THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;` (u:real^3)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[set_of_orbits_points_fan;SUBSET; IN_ELIM_THM] THEN DISCH_TAC THEN GEN_TAC THEN STRIP_TAC +THEN MP_TAC(ISPECL[`(i:num)`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]image_power_map_points) THEN ASM_REWRITE_TAC[]);; + + +let CARD_ORBITS_EDGE_FAN_LE=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ ({v,u} IN E) +==> CARD(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) ) +<=CARD( set_of_edge v V E)`, +REPEAT GEN_TAC THEN STRIP_TAC + THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;` (u:real^3)`]ORBITS_SUBSET_EDGE_FAN) + THEN ASM_REWRITE_TAC[] THEN REPEAT (POP_ASSUM MP_TAC) +THEN REWRITE_TAC[FAN;fan1] THEN REPEAT STRIP_TAC + THEN MP_TAC(ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`] remark_finite_fan1) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(ISPECL[`set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`;`set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)`]CARD_SUBSET) + THEN ASM_REWRITE_TAC[]);; + + + + +let FINITE_ORBITS_SIGMA_FAN=prove( `!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ ({v,u} IN E) +==> FINITE(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) `, + +REPEAT GEN_TAC THEN DISCH_TAC THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;` (u:real^3)`] ORBITS_SUBSET_EDGE_FAN)THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[FAN;fan1] THEN STRIP_TAC + THEN MP_TAC(ISPECL[`(v:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`] remark_finite_fan1) + THEN ASM_REWRITE_TAC[] THEN MESON_TAC[FINITE_SUBSET]);; + + + +let ORBITS_SIGMA_FAN=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ ({v,u} IN E)/\ +(power_map_points (sigma_fan) x V E v u i=u) /\ ~(i=0) +==> set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) = +{power_map_points sigma_fan x V E v u j| j < i } +`, +REPEAT STRIP_TAC THEN REWRITE_TAC[set_of_orbits_points_fan; EXTENSION; IN_ELIM_THM] +THEN GEN_TAC THEN EQ_TAC +THENL [ +STRIP_TAC THEN ASM_REWRITE_TAC[] THEN +FIND_ASSUM (MP_TAC o (SPEC `i':num`) o MATCH_MP DIVMOD_EXIST) `~(i:num = 0)` + THEN REPEAT STRIP_TAC + THEN EXISTS_TAC`r:num` THEN ASM_REWRITE_TAC[ARITH_RULE`q * (i:num) + r = r+ q * i`;addition_sigma_fan] + THEN MP_TAC (SPECL [`(q:num)`;` (i:num)`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3) `;`(u:real^3)`]fix_point_sigma_fan) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[]; + +STRIP_TAC THEN EXISTS_TAC `j:num` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC]);; + +(***********lemmas in hypermap.ml***************) + + +let IMAGE_SEG = prove(`!(n:num) (f:num->A). IMAGE f {i:num | i < n:num} = {f (i:num) | i < n}`, + REPEAT STRIP_TAC + THEN REWRITE_TAC[IMAGE; IN_ELIM_THM] THEN ASM_SET_TAC[]);; + +let FINITE_SERIES = prove(`!(n:num) (f:num->A). FINITE {f(i) | i < n}`, + REPEAT GEN_TAC + THEN ONCE_REWRITE_TAC[SYM(SPECL[`n:num`; `f:num->A`] IMAGE_SEG)] + THEN MATCH_MP_TAC FINITE_IMAGE + THEN REWRITE_TAC[FINITE_NUMSEG_LT]);; + +let CARD_FINITE_SERIES_LE = prove(`!(n:num) (f:num->A). CARD {f(i) | i < n} <= n`, + REPEAT GEN_TAC + THEN ONCE_REWRITE_TAC[SYM(SPECL[`n:num`; `f:num->A`] IMAGE_SEG)] + THEN MP_TAC(ISPEC `f:num ->A` (MATCH_MP CARD_IMAGE_LE (SPEC `n:num` FINITE_NUMSEG_LT))) + THEN REWRITE_TAC[CARD_NUMSEG_LT]);; + +let LEMMA_INJ = prove(`!(n:num) (f:num->A).(!i:num j:num. i < n /\ j < i ==> ~(f i = f j)) ==> (!i:num j:num. i < n /\ j < n /\ f i = f j ==> i = j)`, + REPEAT GEN_TAC + THEN DISCH_TAC THEN MATCH_MP_TAC WLOG_LT + THEN STRIP_TAC THENL[ARITH_TAC; ALL_TAC] + THEN STRIP_TAC THENL[MESON_TAC[]; ALL_TAC] + THEN ASM_MESON_TAC[]);; + +let CARD_FINITE_SERIES_EQ = prove(`!(n:num) (f:num->A). (!i:num j:num. i < n /\ j < i ==> ~(f i = f j)) ==> CARD {f(i) | i < n} = n`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1" o MATCH_MP LEMMA_INJ) + THEN ONCE_REWRITE_TAC[GSYM IMAGE_SEG] + THEN GEN_REWRITE_TAC(RAND_CONV o ONCE_DEPTH_CONV) [GSYM (SPEC `n:num` CARD_NUMSEG_LT)] + THEN MATCH_MP_TAC CARD_IMAGE_INJ + THEN REWRITE_TAC[FINITE_NUMSEG_LT] + THEN REWRITE_TAC[IN_ELIM_THM] + THEN ASM_REWRITE_TAC[]);; + + + +(**************************************) + + +let CARD_ORBITS_SIGMA_FAN_LE=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ ({v,u} IN E)/\ +(power_map_points (sigma_fan) x V E v u i=u) /\ ~(i=0) +==> CARD(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))<=i`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN MP_TAC(ISPECL[`(i:num)`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]ORBITS_SIGMA_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ISPECL[`i:num`;`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`]CARD_FINITE_SERIES_LE) THEN ASM_TAC THEN SET_TAC[]);; + + + + +let exists_inverse_in_orbits_sigma_fan=prove(` +!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (y:real^3). + FAN(x,V,E) /\({v,u} IN E)/\ ~(y IN set_of_orbits_points_fan x V E v u) +==> +(?(w:real^3). (w IN (set_of_orbits_points_fan x V E v u)) /\ ~(w=y) /\ +(!(w1:real^3). (w1 IN (set_of_orbits_points_fan x V E v u))/\ ~(w1=y) ==> azim1 x v y w <= azim1 x v y w1)) +`, + +(let lemma = prove + (`!X:real->bool. + FINITE X /\ ~(X = {}) + ==> ?a. a IN X /\ !x. x IN X ==> a <= x`, + MESON_TAC[INF_FINITE]) in + +MP_TAC(lemma) THEN DISCH_THEN(LABEL_TAC "a") THEN REPEAT GEN_TAC +THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "ba") +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` (u:real^3)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;` (u:real^3)`]FINITE_ORBITS_SIGMA_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +SUBGOAL_THEN `FINITE ((set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) (v:real^3) (u:real^3) DELETE (y:real^3))` ASSUME_TAC +THENL[(*1*) + +ASM_MESON_TAC[FINITE_DELETE_IMP];(*1*) +DISJ_CASES_TAC(SET_RULE`(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) DELETE (y:real^3)={})\/ + ~(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) DELETE (y:real^3)={})`) +THENL(*2*)[ +MP_TAC (ISPECL[`y:real^3`;`set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`]DELETE_NON_ELEMENT) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;` (u:real^3)`]u_IN_ORBITS_FAN) + THEN ASM_TAC THEN SET_TAC[];(*2*) +SUBGOAL_THEN`~(IMAGE ( azim1 x v y) (set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) DELETE (y:real^3))={})` ASSUME_TAC +THENL(*3*)[ +REWRITE_TAC[IMAGE_EQ_EMPTY] THEN ASM_MESON_TAC[];(*3*) + +SUBGOAL_THEN` FINITE (IMAGE (azim1 x v y) (set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) DELETE (y:real^3)))` ASSUME_TAC +THENL(*4*)[ +ASM_MESON_TAC[FINITE_IMAGE];(*4*) + +REMOVE_THEN "a" (fun th ->MP_TAC(ISPEC `(IMAGE (azim1 x v y) (set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) DELETE (y:real^3)))` th)) + THEN ASM_REWRITE_TAC[IMAGE;DELETE;IN_ELIM_THM]THEN STRIP_TAC +THEN EXISTS_TAC`x':real^3` + THEN ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[]]]]]));; + + + + + + + + + + +let key_lemma_cyclic_fan=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ (0 < i) /\(i< CARD(set_of_edge v V E)) /\ ({v,u} IN E) +==> ~(power_map_points (sigma_fan) x V E v u i=u) +`, +INDUCT_TAC +THENL(*1*)[ARITH_TAC;(*1*) +REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[power_map_points] THEN +MP_TAC(ISPECL[` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]ORBITS_SUBSET_EDGE_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN DISJ_CASES_TAC(SET_RULE`(sigma_fan x V E v (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))= u)\/ ~(sigma_fan x V E v (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))= u)`) +THENL(*2*)[ +ASM_REWRITE_TAC[] THEN MP_TAC(ISPECL[`SUC (i:num)`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]CARD_ORBITS_SIGMA_FAN_LE) + THEN ASM_REWRITE_TAC[power_map_points; ARITH_RULE`~(SUC i = 0)`] THEN STRIP_TAC + THEN SUBGOAL_THEN `CARD(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) PSUBSET set_of_edge v V E` ASSUME_TAC +THENL(*4*)[ +ASM_REWRITE_TAC[PSUBSET] THEN DISJ_CASES_TAC(SET_RULE`(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) = set_of_edge v V E)\/ ~(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) = set_of_edge v V E)`) +THENL(*5*)[ +SUBGOAL_THEN`CARD(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) =CARD( set_of_edge v V E)`ASSUME_TAC +THENL(*6*)[ +POP_ASSUM(fun th->REWRITE_TAC[th]);(*6*) +POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC](*6*);(*5*) + +POP_ASSUM(fun th->REWRITE_TAC[th])](*5*);(*4*) + + +POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[PSUBSET_MEMBER] THEN STRIP_TAC + THEN MP_TAC(ISPECL[` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;`y:real^3`] +exists_inverse_in_orbits_sigma_fan) + THEN ASM_REWRITE_TAC[] THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={(u:real^3)})\/ ~(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={(u:real^3)})`) +THENL(*5*)[ +POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") + THEN DISCH_THEN(LABEL_TAC "b") THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[IN_SING] THEN DISCH_TAC + THEN REMOVE_THEN "b" MP_TAC THEN ASM_REWRITE_TAC[u_IN_ORBITS_FAN];(*5*) + +ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN +DISJ_CASES_TAC(SET_RULE`(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={(w:real^3)})\/ ~(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={(w:real^3)})`) +THENL(*6*)[ + +POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") + THEN DISCH_THEN(LABEL_TAC "b") THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[IN_SING] THEN DISCH_TAC + THEN REMOVE_THEN "b" MP_TAC THEN ASM_REWRITE_TAC[];(*6*) + +MP_TAC(ISPECL[` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`u:real^3`;` (w:real^3)`]IN_ORBITS_FAN) + THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC THEN STRIP_TAC +THEN POP_ASSUM(fun th->MP_TAC(ISPEC `sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)` th)) + THEN ASM_REWRITE_TAC[] + THEN DISJ_CASES_TAC(SET_RULE`sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)=(y:real^3) \/ ~(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)=(y:real^3))`) +THENL(*7*)[ +POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC + THEN ASM_REWRITE_TAC[];(*7*) + +ASM_REWRITE_TAC[azim1;REAL_ARITH` (a:real) - b <= a - c <=> c<=b`] THEN STRIP_TAC +THEN +SUBGOAL_THEN `sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) IN set_of_edge v V E` ASSUME_TAC +THENL(*8*)[ + ASM_TAC THEN SET_TAC[];(*8*) + +SUBGOAL_THEN `(w:real^3) IN set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)` ASSUME_TAC +THENL(*9*)[ + ASM_TAC THEN SET_TAC[];(*9*) + +SUBGOAL_THEN `{(y:real^3),sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3),(w:real^3)} SUBSET set_of_edge v V E` ASSUME_TAC + +THENL(*10*)[ + ASM_TAC THEN SET_TAC[];(*10*) + +FIND_ASSUM(MP_TAC)`FAN((x:real^3),V,E)` THEN REWRITE_TAC[FAN;fan6] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "b") THEN STRIP_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (u:real^3)`;` (v:real^3)`]properties_of_graph) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`]CYCLIC_SET_EDGE_FAN) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;`{(y:real^3),sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3),(w:real^3)}`;`set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)` ]subset_cyclic_set_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`y:real^3`;`sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)`;`w:real^3`]sum2_azim_fan) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`y:real^3`;`sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)`]azim) +THEN STRIP_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `azim (x:real^3) (v:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) (w:real^3) <= azim (x:real^3) (v:real^3) (y:real^3) (w:real^3)` +ASSUME_TAC +THENL(*11*)[ +REPEAT(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC;(*11*) + +POP_ASSUM MP_TAC THEN POP_ASSUM(fun th ->REWRITE_TAC[]) THEN ASM_REWRITE_TAC[] THEN +MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` (y:real^3)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` (w:real^3)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (w:real^3) (y:real^3)= &0) \/ ~(azim (x:real^3) (v:real^3) (w:real^3) (y:real^3) = &0)`) +THENL(*12*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;`(y:real^3)`]UNIQUE_AZIM_0_POINT_FAN) +THEN ASM_REWRITE_TAC[];(*12*) + +DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (w:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))= &0) \/ ~(azim (x:real^3) (v:real^3) (w:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) = &0)`) +THENL(*13*)[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`; ` (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))` ]UNIQUE_AZIM_0_POINT_FAN) + THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`] SIGMA_FAN) + THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN SET_TAC[];(*13*) + + REMOVE_THEN "b" (fun th->MP_TAC (ISPEC`{(v:real^3),(w:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(y:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))}`th) THEN ASSUME_TAC(th)) + THEN REWRITE_TAC[SET_RULE`{(a:real^3)} UNION {b,c}={a,b,c}`] THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;`(w:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))`]AZIM_COMPL) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (w:real^3)`;` (y:real^3)`]AZIM_COMPL) THEN +ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[REAL_ARITH`(a - (b:real) <= (a:real)- (c:real))<=> c <= b`] + THEN STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`; `(w:real^3)`] SIGMA_FAN) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(y:real^3)`th)) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN SUBGOAL_THEN`azim (x:real^3) (v:real^3) (w:real^3) (y:real^3) = azim x v w (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))` ASSUME_TAC +THENL(*14*)[ +POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*14*) + +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;`(w:real^3)`;` (y:real^3)`; ` (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3))` ]UNIQUE_AZIM_POINT_FAN) + THEN ASM_REWRITE_TAC[] + +]]]]]]]]]]]]; +ASM_REWRITE_TAC[]]]);; + + + + + +let cyclic_power_sigma_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) (j:num). +FAN(x,V,E) /\ (i< CARD(set_of_edge v V E)) /\ (j ~(power_map_points (sigma_fan) x V E v u i= power_map_points (sigma_fan) x V E v u j) +`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN STRIP_TAC THEN +MP_TAC(ISPECL[`(i:num)`;` (j:num)`;` (x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]MONO_POWER_SIGMA_FAN) + THEN ASM_REWRITE_TAC[] THEN MP_TAC(ARITH_RULE` j < i ==> 0 < (i:num)-(j:num)`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ARITH_RULE` (j:num) <(i:num)==> i-j <= i`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ARITH_RULE` (i :num )-(j:num) <= i /\ i< CARD(set_of_edge (v:real^3)(V:real^3->bool) (E:(real^3->bool)->bool))==> i-j bool) (E:(real^3->bool)->bool))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(i:num)-(j:num)`;` (x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]key_lemma_cyclic_fan) + THEN ASM_REWRITE_TAC[] THEN MESON_TAC[]);; + + + + + +let CARD_SET_OF_ORBITS_POINTS_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ ({v,u} IN E) +==> CARD(set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))= CARD(set_of_edge v V E)`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN +SUBGOAL_THEN`{power_map_points (sigma_fan) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) |i| (i< CARD(set_of_edge v V E))} +SUBSET set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) +`ASSUME_TAC +THENL[ REWRITE_TAC[set_of_orbits_points_fan;SUBSET;IN_ELIM_THM] + THEN GEN_TAC THEN STRIP_TAC THEN EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC; + +SUBGOAL_THEN`CARD {power_map_points (sigma_fan) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) |i| (i< CARD(set_of_edge v V E))} +<= CARD (set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))` +ASSUME_TAC +THENL[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] FINITE_ORBITS_SIGMA_FAN) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`{power_map_points (sigma_fan) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) |i| (i< CARD(set_of_edge v V E))}`;`set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`]CARD_SUBSET) THEN ASM_REWRITE_TAC[]; + +MP_TAC(SPECL[`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]cyclic_power_sigma_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))`;`power_map_points (sigma_fan) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`]CARD_FINITE_SERIES_EQ) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]CARD_ORBITS_EDGE_FAN_LE) + THEN ASM_REWRITE_TAC[] THEN REPEAT (POP_ASSUM MP_TAC) THEN ARITH_TAC]]);; + + +let ORBITS_EQ_SET_EDGE_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ ({v,u} IN E) +==> +set_of_edge v V E += set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`, + +REWRITE_TAC[SET_RULE`(set_of_edge v V E += set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))<=> (set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)= set_of_edge v V E) `] THEN +REPEAT STRIP_TAC THEN MATCH_MP_TAC CARD_SUBSET_EQ THEN +STRIP_TAC THENL[REPEAT (POP_ASSUM MP_TAC) THEN REWRITE_TAC[FAN;fan1] THEN MESON_TAC[remark_finite_fan1]; +ASM_MESON_TAC[ORBITS_SUBSET_EDGE_FAN;CARD_SET_OF_ORBITS_POINTS_FAN]]);; + + +let SIMP_ORBITS_POINTS_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ ({v,u} IN E) +==> +{power_map_points (sigma_fan) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) |i| (i< CARD(set_of_edge v V E))} += set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) +`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN`{power_map_points (sigma_fan) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) |i| (i< CARD(set_of_edge v V E))} +SUBSET set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) +`ASSUME_TAC +THENL[ + REWRITE_TAC[set_of_orbits_points_fan;SUBSET;IN_ELIM_THM] + THEN GEN_TAC THEN STRIP_TAC THEN EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC; + +POP_ASSUM MP_TAC THEN MP_TAC(SPECL[`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]cyclic_power_sigma_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))`;`power_map_points (sigma_fan) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`]CARD_FINITE_SERIES_EQ) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"a") + THEN MP_TAC(SPECL[`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]CARD_SET_OF_ORBITS_POINTS_FAN) THEN ASM_REWRITE_TAC[SET_RULE`a=b<=> b=a`] THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] FINITE_ORBITS_SIGMA_FAN) THEN ASM_REWRITE_TAC[] + THEN MESON_TAC[CARD_SUBSET_EQ]]);; + + +let ORDER_POWER_SIGMA_FAN=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) . +FAN(x,V,E) /\ (i=CARD(set_of_edge v V E)) /\ ({v,u} IN E) +==> power_map_points (sigma_fan) x V E v u i= u +`, +REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `power_map_points (sigma_fan) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) IN set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)` ASSUME_TAC +THENL[ + REWRITE_TAC[ set_of_orbits_points_fan; IN_ELIM_THM] THEN EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC; + +POP_ASSUM MP_TAC THEN MP_TAC(SPECL[`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]SIMP_ORBITS_POINTS_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th);]) THEN REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))`;`i':num`;`(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]MONO_POWER_SIGMA_FAN) THEN ASM_REWRITE_TAC[] + THEN DISJ_CASES_TAC(ARITH_RULE`(0<(i':num))\/ i'=0`) +THENL[ +DISCH_TAC THEN +MP_TAC(ARITH_RULE`0 < (i':num)/\ i'< CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) ==> (CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))- (i':num) < CARD (set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ARITH_RULE`(i':num)< CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))==> 0< CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))-i'`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN +MP_TAC(ISPECL[`CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))-(i':num)`; `(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]key_lemma_cyclic_fan) + THEN ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]; + +ASM_REWRITE_TAC[power_map_points]]]);; + + + + +let SUM_IF_AZIMS_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num). +FAN(x,V,E) /\ ({v,u} IN E) +/\(0 + if_azims_fan x V E v u (SUC i)= if_azims_fan x V E v u i + azim x v ((power_map_points sigma_fan x V E v u i)) (power_map_points sigma_fan x V E v u (SUC i))`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"a") THEN USE_THEN "a" MP_TAC + THEN REWRITE_TAC[FAN;fan6] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "b") + THEN REPEAT STRIP_TAC +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` (u:real^3)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`(i:num)`; `(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] image_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`SUC(i:num)`; `(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] image_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (SUC(i:num))`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN SUBGOAL_THEN `~((i:num)=CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))` ASSUME_TAC +THENL(*1*)[ +REPEAT(POP_ASSUM MP_TAC) THEN ARITH_TAC;(*1*) + +DISJ_CASES_TAC(ARITH_RULE ` SUC (i:num)= CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) \/ ~(SUC i=CARD(set_of_edge v V E))`) +THENL(*2*)[ + +MP_TAC(ISPECL[`SUC (i:num)`; `(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]ORDER_POWER_SIGMA_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +REWRITE_TAC[if_azims_fan] THEN ASM_REWRITE_TAC[] THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) + THEN REMOVE_THEN "b" (fun th->MP_TAC (ISPEC`{(v:real^3),(u:real^3)}`th) THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th->MP_TAC (ISPEC`{(v:real^3),(power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))}`th) THEN ASSUME_TAC(th)) + THEN REWRITE_TAC[SET_RULE`{(a:real^3)} UNION {b,c}={a,b,c}`] THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN DISCH_TAC THEN +DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (u:real^3) (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))= &0) \/ ~(azim (x:real^3) (v:real^3) (u:real^3) (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) = &0)`) +THENL(*3*)[ + +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`; ` (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))` ]UNIQUE_AZIM_0_POINT_FAN) + THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`i:num`;`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] key_lemma_cyclic_fan) + THEN ASM_REWRITE_TAC[] THEN ASM_SET_TAC[];(*3*) + + MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`;` (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))`]AZIM_COMPL) THEN +ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC];(*2*) + +ASM_REWRITE_TAC[if_azims_fan] THEN MP_TAC(ARITH_RULE`i:num < CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) /\ ~(SUC(i) = CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))==> SUC(i)bool) (E:(real^3->bool)->bool))`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASSUME_TAC(ARITH_RULE`0bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] key_lemma_cyclic_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;`i:num`]MONO_AZIM_POWER_SIGMA_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN SUBGOAL_THEN `{(u:real^3),power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num),power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (SUC(i:num))} SUBSET set_of_edge v V E` ASSUME_TAC +THENL(*3*)[ +ASM_SET_TAC[];(*3*) + +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (u:real^3)`;` (v:real^3)`]properties_of_graph) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`]CYCLIC_SET_EDGE_FAN) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;`{(u:real^3),power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num),power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (SUC(i:num))}`;`set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)` ]subset_cyclic_set_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`;`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (SUC(i:num))`]sum2_azim_fan) THEN ASM_REWRITE_TAC[]]]]);; + +let azim_i_fan=new_definition` +azim_i_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) += azim x v (power_map_points sigma_fan x V E v u i) (power_map_points sigma_fan x V E v u (SUC i))`;; + + + + +let SUM_EQ_IF_AZIMS_FAN=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ ({v,u} IN E) +/\ ~(set_of_edge v V E ={u}) +/\ ~(1=CARD(set_of_edge v V E )) +/\ (i< CARD(set_of_edge v V E)) +==> +sum (0..i) (azim_i_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) += if_azims_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (SUC i)`, + + +INDUCT_TAC +THENL[ +REPEAT STRIP_TAC THEN +ASM_REWRITE_TAC[SUM_CLAUSES_NUMSEG;azim_i_fan;power_map_points;if_azims_fan; ARITH_RULE`SUC 0=1`]; + +POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "a") +THEN REPEAT STRIP_TAC +THEN +ASSUME_TAC(ARITH_RULE`0<= SUC (i:num)`)THEN ASSUME_TAC(ARITH_RULE`0< SUC (i:num)`) THEN +MP_TAC(ARITH_RULE`SUC (i:num)bool) (E:(real^3->bool)->bool))==> i< CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))`) THEN +ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +ASM_REWRITE_TAC[SUM_CLAUSES_NUMSEG] + THEN REMOVE_THEN"a"(fun th-> MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]th)) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool) `;`(v:real^3) `;`(u:real^3)`;` (SUC(i:num))`]SUM_IF_AZIMS_FAN) + THEN ASM_REWRITE_TAC[azim_i_fan] THEN REAL_ARITH_TAC]);; + + + + + +let SUM_AZIMS_EQ_2PI_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ ({v,u} IN E) +/\ ~(set_of_edge v V E ={u}) +/\ (1 +sum (0..(CARD(set_of_edge v V E )-1)) (azim_i_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) += &2 *pi`, +REPEAT STRIP_TAC THEN +MP_TAC(ARITH_RULE`(1 CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))-1 < CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ARITH_RULE`(1 ~(1=CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ARITH_RULE`(1 SUC(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))-1)= CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))-1`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]SUM_EQ_IF_AZIMS_FAN) + THEN ASM_REWRITE_TAC[if_azims_fan]);; + + +let AZIM_LE_POWER_SIGMA_FAN=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (j:num). +FAN(x,V,E) /\ ({v,u} IN E) +/\ ~(set_of_edge v V E ={u}) +/\ (j + azim x v u (power_map_points sigma_fan x V E v u j) < azim x v u (power_map_points sigma_fan x V E v u i)`, +INDUCT_TAC +THENL(*1*)[ +ARITH_TAC;(*1*) + +REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_THEN(LABEL_TAC"1") THEN DISCH_THEN (LABEL_TAC"a") THEN USE_THEN "a" MP_TAC + THEN REWRITE_TAC[FAN;fan6] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "b") + THEN REPEAT STRIP_TAC +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` (u:real^3)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`(i:num)`; `(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] image_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`SUC(i:num)`; `(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] image_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (SUC(i:num))`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + + +THEN ASSUME_TAC(ARITH_RULE`i< SUC(i:num)`) THEN ASSUME_TAC(ARITH_RULE`0< SUC(i:num)`) + THEN MP_TAC(ARITH_RULE`SUC(i)< CARD(set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))==> i< CARD(set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`SUC(i:num)`;`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] key_lemma_cyclic_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;`i:num`]MONO_AZIM_POWER_SIGMA_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + +THEN DISJ_CASES_TAC(ARITH_RULE `(j:num)< (i:num) \/ (i <= j)`) +THENL[ +REMOVE_THEN "1" (fun th-> MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`; `(j:num)`] th)) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; + +MP_TAC(ARITH_RULE`(j:num) < SUC(i:num) ==> j <= i`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ARITH_RULE` (j:num) <= (i:num) /\ i<= j==> j=i`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] + THEN SUBGOAL_THEN`~(azim x v u (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) ((i:num))) = azim x v u (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (SUC(i:num))))` ASSUME_TAC +THENL[ +STRIP_TAC THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;`u:real^3`;` power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`;` power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (SUC(i:num))`]UNIQUE_AZIM_POINT_FAN) +THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`(i:num)`;`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`]MONO_POWER_MAP_POINTS1_FAN) + THEN ASM_REWRITE_TAC[]; + +REPEAT(POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC]]]);; + + + + +let SUM_AZIM_POWER_SIGMA_FAN=prove(`!(i:num) (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (j:num). +FAN(x,V,E) /\ ({v,u} IN E) +/\ ~(set_of_edge v V E ={u}) +/\ (j + azim x v u (power_map_points sigma_fan x V E v u i)= azim x v u (power_map_points sigma_fan x V E v u j) + azim x v (power_map_points sigma_fan x V E v u j) (power_map_points sigma_fan x V E v u i)`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"a") THEN USE_THEN "a" MP_TAC + THEN REWRITE_TAC[FAN;fan6] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "b") + THEN REPEAT STRIP_TAC +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` (u:real^3)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`(i:num)`; `(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] image_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`(j:num)`; `(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] image_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN + MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) ((j:num))`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + + THEN SUBGOAL_THEN `{(u:real^3),power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (j:num),power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) ((i:num))} SUBSET set_of_edge v V E` ASSUME_TAC +THENL[ASM_SET_TAC[]; + +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (u:real^3)`;` (v:real^3)`]properties_of_graph) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`]CYCLIC_SET_EDGE_FAN) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;`{(u:real^3),power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (j:num),power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) ((i:num))}`;`set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)` ]subset_cyclic_set_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`(i:num)`;` (x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;` (j:num)`] +AZIM_LE_POWER_SIGMA_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + +MP_TAC(REAL_ARITH`(azim x v u (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) ((j:num))) < azim x v u (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) ((i:num))))==>(azim x v u (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) ((j:num))) <= azim x v u (power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) ((i:num))))`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (j:num)`;`power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) ((i:num))`]sum2_azim_fan) THEN ASM_REWRITE_TAC[]]);; + + + + + + +let SUM1_IFAZIMS_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) (j:num). +FAN(x,V,E) /\ ({v,u} IN E) +/\ ~(set_of_edge v V E ={u}) +/\ (j + if_azims_fan x V E v u i= if_azims_fan x V E v u j + azim x v ((power_map_points sigma_fan x V E v u j)) (power_map_points sigma_fan x V E v u i)`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN MP_TAC(ARITH_RULE`(i:num) < CARD(set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))==> ~(i=CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ARITH_RULE`(j:num) < i /\(i:num) < CARD(set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))==> ~(j=CARD(set_of_edge(v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN +ASM_REWRITE_TAC[if_azims_fan] +THEN +ASM_MESON_TAC[SUM_AZIM_POWER_SIGMA_FAN]);; + + + + + +let ULEKUUB=prove(`(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) (j:num). +FAN(x,V,E) /\ ({v,u} IN E) +/\ ~(set_of_edge v V E ={u}) +/\ (j + if_azims_fan x V E v u i= if_azims_fan x V E v u j + azim x v ((power_map_points sigma_fan x V E v u j)) (power_map_points sigma_fan x V E v u i)) +/\ + +(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E) /\ ({v,u} IN E) +/\ ~(set_of_edge v V E ={u}) +/\ (1 +sum (0..(CARD(set_of_edge v V E )-1)) (azim_i_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) += &2 *pi) +`, +MESON_TAC[SUM1_IFAZIMS_FAN; SUM_AZIMS_EQ_2PI_FAN]);; + + + + + +(* g`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E)/\ {v,u} IN E +==> azim_cycle (set_of_edge v V E) x v u=sigma_fan x V E v u`;;*) + + + + + + + + + + + +(* deprecated, 2011-08-01, thales +let lemma_disjiont_exists_fan2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 n:num. + ~(v=x) /\ ~(u=x) /\ (~(collinear {x, v, u})) /\ {v,u} IN E /\ (v IN V) /\ (u IN V) /\ fan (x,V,E) + ==> if_azims_fan x V E v u (0) = &0`, +REPEAT GEN_TAC THEN REWRITE_TAC[fan;fan1] THEN STRIP_TAC + THEN MP_TAC(ISPECL [`v:real^3`; `(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]remark_finite_fan1) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN SUBGOAL_THEN `(u:real^3) IN set_of_edge (v:real^3) (V:real^3->bool)(E:(real^3->bool)->bool)` ASSUME_TAC + THENL[ + REWRITE_TAC[set_of_edge; IN_ELIM_THM] THEN ASM_REWRITE_TAC[]; + SUBGOAL_THEN ` ~( 0 = CARD (set_of_edge (v:real^3) (V:real^3->bool)(E:((real^3)->bool)->bool))) ` ASSUME_TAC + THENL[ + STRIP_TAC + THEN MP_TAC(ISPEC `set_of_edge (v:real^3) (V:real^3->bool) (E:((real^3)->bool)->bool)`CARD_EQ_0) + THEN ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]; + SUBGOAL_THEN `azim (x:real^3) (v:real^3) (u:real^3) (u:real^3)= &0` ASSUME_TAC + THENL[ + ASM_MESON_TAC[ azim_is_zero_fan]; + REWRITE_TAC[if_azims_fan; power_map_points;azim;] THEN ASM_REWRITE_TAC[]]]]);; + + + + + + +let lemma_disjiont_exists_fan3=prove( +`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 y:real^3 n:num. + ~(v=x) /\ ~(u=x) /\ (~(collinear {x, v, u})) /\ {v,u} IN E /\ (v IN V) /\ (u IN V) /\ fan (x,V,E) + ==> (if_azims_fan x V E v u 0 <= azim x v u y)`, +REPEAT GEN_TAC THEN STRIP_TAC + THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`; `u:real^3`; `y:real^3`] azim) + THEN STRIP_TAC + THEN MP_TAC(ISPECL[`x:real^3` ; `(V:real^3->bool)`; `(E:(real^3->bool)->bool)` ;`v:real^3` ;`u:real^3`; `n:num`]lemma_disjiont_exists_fan2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[azim]);; + +*) + +let wedge2_fan=new_definition`wedge2_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) = +{y:real^3 | ( if_azims_fan x V E v u i = azim x v u y)/\ ( y IN complement_set {x, v})}`;; + +(*wedge2_fan=aff_gt*) + + +let affine_hull_2_fan= prove(`(!x:real^3 v:real^3. aff {x , v} = {y:real^3| ?t1:real t2:real. (t1 + t2 = &1 )/\ (y = t1 % x + t2 % v )})`, +REWRITE_TAC[aff;AFFINE_HULL_2] THEN ASM_SET_TAC[]);; + +let AFF_GT_1_1 = prove + (`!x v. + DISJOINT {x} {v} + ==> aff_gt {x} {v} = + {y | ?t1 t2. + &0 < t2 /\ + t1 + t2 = &1 /\ + y = t1 % x + t2 % v}`, + AFF_TAC);; + +let th = prove + (`!x:real^3 v:real^3 u:real^3 w:real^3. + ~collinear {x,v,u} /\ ~collinear{x,v,w} + ==> {y:real^3 | ~collinear {x,v,y} /\ azim x v u w = azim x v u y} = + aff_gt {x , v} {w}`, + GEOM_ORIGIN_TAC `x:real^3` THEN + GEOM_BASIS_MULTIPLE_TAC 3 `v:real^3` THEN + X_GEN_TAC `v:real` THEN ASM_CASES_TAC `v = &0` THENL + [ASM_REWRITE_TAC[VECTOR_MUL_LZERO; INSERT_AC; COLLINEAR_2]; ALL_TAC] THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; REAL_LE_LT] THEN DISCH_TAC THEN + MAP_EVERY X_GEN_TAC [`u:real^3`; `w:real^3`] THEN + ASM_CASES_TAC `w:real^3 = vec 0` THENL + [ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_2]; ALL_TAC] THEN + ASM_CASES_TAC `w:real^3 = v % basis 3` THENL + [ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_2]; ALL_TAC] THEN + ASM_SIMP_TAC[AZIM_SPECIAL_SCALE; COLLINEAR_SPECIAL_SCALE] THEN + ASM_CASES_TAC `w:real^3 = basis 3` THENL + [ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_2]; ALL_TAC] THEN + ASM_SIMP_TAC[AFF_GT_SPECIAL_SCALE; IN_SING; FINITE_INSERT; FINITE_EMPTY] THEN + POP_ASSUM_LIST(K ALL_TAC) THEN REWRITE_TAC[COLLINEAR_BASIS_3; AZIM_ARG] THEN + DISCH_TAC THEN MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `{y:real^3 | (dropout 3 y:real^2) IN + aff_gt {vec 0} {dropout 3 (w:real^3)}}` THEN + CONJ_TAC THENL + [REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN X_GEN_TAC `y:real^3` THEN + POP_ASSUM MP_TAC THEN + MAP_EVERY SPEC_TAC + [`(dropout 3:real^3->real^2) u`,`u:real^2`; + `(dropout 3:real^3->real^2) v`,`v:real^2`; + `(dropout 3:real^3->real^2) w`,`w:real^2`; + `(dropout 3:real^3->real^2) y`,`y:real^2`] THEN + SIMP_TAC[AFF_GT_1_1; SET_RULE `DISJOINT {x} {y} <=> ~(x = y)`] THEN + REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN ONCE_REWRITE_TAC[SWAP_EXISTS_THM] THEN + ONCE_REWRITE_TAC[TAUT `a /\ b /\ c <=> a /\ c /\ b`] THEN + REWRITE_TAC[REAL_ARITH `t1 + t2 = &1 <=> t1 = &1 - t2`] THEN + REWRITE_TAC[RIGHT_EXISTS_AND_THM; EXISTS_REFL] THEN + ASM_CASES_TAC `y:real^2 = vec 0` THEN ASM_REWRITE_TAC[] THENL + [ASM_MESON_TAC[VECTOR_MUL_EQ_0; REAL_LT_IMP_NZ]; ALL_TAC] THEN + RULE_ASSUM_TAC(REWRITE_RULE[COMPLEX_VEC_0]) THEN + GEN_REWRITE_TAC LAND_CONV [EQ_SYM_EQ] THEN + ASM_SIMP_TAC[ARG_EQ; COMPLEX_CMUL; COMPLEX_FIELD + `~(w = Cx(&0)) /\ ~(z = Cx(&0)) ==> ~(w / z = Cx(&0))`] THEN + ASM_SIMP_TAC[COMPLEX_FIELD + `~(u = Cx(&0)) ==> (w / u = x * y / u <=> w = x * y)`]; + SUBGOAL_THEN `~(w:real^3 = vec 0) /\ ~(w = basis 3)` ASSUME_TAC THENL + [ASM_MESON_TAC[DROPOUT_BASIS_3; DROPOUT_0]; ALL_TAC] THEN + ASM_SIMP_TAC[AFF_GT_1_1; AFF_GT_2_1; DISJOINT_INSERT; IN_INSERT; + DISJOINT_EMPTY; NOT_IN_EMPTY] THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN X_GEN_TAC `y:real^3` THEN + REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + ONCE_REWRITE_TAC[SWAP_EXISTS_THM] THEN + GEN_REWRITE_TAC (RAND_CONV o BINDER_CONV) [SWAP_EXISTS_THM] THEN + ONCE_REWRITE_TAC[TAUT `a /\ b /\ c <=> a /\ c /\ b`] THEN + REWRITE_TAC[REAL_ARITH `t1 + t2 = &1 <=> t1 = &1 - t2`] THEN + REWRITE_TAC[RIGHT_EXISTS_AND_THM; EXISTS_REFL] THEN + SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VECTOR_ADD_COMPONENT; + VECTOR_MUL_COMPONENT; BASIS_COMPONENT; ARITH; DIMINDEX_2; + DROPOUT_BASIS_3; FORALL_2; dropout; LAMBDA_BETA] THEN + ONCE_REWRITE_TAC[SWAP_EXISTS_THM] THEN + REWRITE_TAC[REAL_MUL_RZERO; REAL_ADD_LID; RIGHT_EXISTS_AND_THM] THEN + REWRITE_TAC[REAL_ARITH `y = t * &1 + s <=> t = y - s`; EXISTS_REFL]]);; + + + +let th1=prove(`(!x:real^3 v:real^3 u:real^3 w:real^3 t1:real t2:real t3:real. (t3 > &0) /\ (t1 + t2 + t3 = &1) +/\ DISJOINT {x,v} {w} /\ ~collinear {x,v,u}/\ ~collinear {x,v,w} + ==> azim x v u w = + azim x v u (t1 % x + t2 % v + t3 % w))`, +REPEAT GEN_TAC THEN STRIP_TAC THEN ASSUME_TAC(AFF_GT_2_1) +THEN POP_ASSUM(MP_TAC o ISPECL [`x:real^3`;`v:real^3`;`w:real^3`]) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN ABBREV_TAC `(y:real^3)= (t1:real) % (x:real^3) + (t2:real) % (v:real^3) + (t3:real) % (w:real^3)` + THEN SUBGOAL_THEN `(y:real^3) IN aff_gt {(x:real^3),(v:real^3)} {w:real^3}` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC `t1:real` +THEN EXISTS_TAC `t2:real` THEN EXISTS_TAC `t3:real` +THEN EXPAND_TAC "y" THEN ASM_MESON_TAC[REAL_ARITH`(a:real)> &0 <=> &0 < a ` ]; + + POP_ASSUM MP_TAC THEN +ASSUME_TAC(th) THEN POP_ASSUM(MP_TAC o ISPECL [`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`]) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) +THEN REWRITE_TAC[IN_ELIM_THM] THEN ASM_SET_TAC[]]);; + + let th2= prove(`!x:real^3 v:real^3 w:real^3. ~(x=v)==> (w IN complement_set {x,v}==> ~ collinear {x,v,w})`, +REPEAT GEN_TAC THEN DISCH_TAC THEN REWRITE_TAC[CONTRAPOS_THM; COLLINEAR_3;COLLINEAR_LEMMA; complement_set; IN_ELIM_THM;affine_hull_2_fan] THEN STRIP_TAC +THENL[ +ASM_MESON_TAC[VECTOR_ARITH`(x-v= vec 0)<=> (x=v)`]; + EXISTS_TAC `&0` THEN EXISTS_TAC `&1` THEN REWRITE_TAC[REAL_ARITH`&0+ &1 = &1`; VECTOR_ARITH`&0 % x= vec 0`; VECTOR_ARITH`w=vec 0 + &1 % v <=> w - v = vec 0`] THEN ASM_SET_TAC[]; +EXISTS_TAC `c:real` THEN EXISTS_TAC `&1 - (c:real)` THEN REWRITE_TAC[REAL_ARITH`c+ &1 - c = &1`; VECTOR_ARITH`w=c % x + (&1 - c) % v <=> w - v = c % (x-v)`] THEN ASM_SET_TAC[]]);; + + + + + +let COMPLEMENT_SET_FAN=prove(`!x:real^3 v:real^3 u:real^3 y:real^3 w:real^3 t1:real t2:real t3:real. +~( w IN aff {x, v}) /\ ~(t3 = &0) /\ (t1 + t2 + t3 = &1) +==> t1 % x + t2 % v + t3 % w IN + complement_set {x, v}`, + REPEAT GEN_TAC THEN ASSUME_TAC(affine_hull_2_fan) THEN STRIP_TAC THEN +REWRITE_TAC[complement_set; IN_ELIM_THM] THEN ASM_REWRITE_TAC[] THEN +REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN REPEAT(POP_ASSUM MP_TAC) THEN DISCH_TAC THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT DISCH_TAC THEN + SUBGOAL_THEN ` (t3:real) % w =((t1':real)- (t1:real)) % (x:real^3) + ((t2':real)- (t2:real)) % (v:real^3) ` ASSUME_TAC + THENL + [POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC; + REPEAT(POP_ASSUM MP_TAC) THEN DISCH_THEN(LABEL_TAC "b") THEN DISCH_THEN(LABEL_TAC "c") THEN DISCH_THEN(LABEL_TAC "d") + THEN REPEAT STRIP_TAC THEN USE_THEN "c" MP_TAC THEN REWRITE_TAC[CONTRAPOS_THM] THEN + EXISTS_TAC `((t1':real) - (t1:real))/(t3:real)` THEN EXISTS_TAC `((t2':real) - (t2:real))/(t3:real)` + THEN SUBGOAL_THEN `((t1':real) - (t1:real))/(t3:real)+ ((t2':real) - (t2:real))/(t3:real) = &1` ASSUME_TAC THENL + [REWRITE_TAC[real_div] THEN REWRITE_TAC[REAL_ARITH `a*b+c*b=(a+c)*b`] THEN + SUBGOAL_THEN `(t1':real) - (t1:real) + (t2':real) - (t2:real) - (t3:real) = &0` ASSUME_TAC THENL + [REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; + SUBGOAL_THEN `(t1':real) - (t1:real) + (t2':real) - (t2:real) = (t3:real)` ASSUME_TAC THENL + [POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + ASM_MESON_TAC[REAL_MUL_RINV]]]; + ASM_REWRITE_TAC[] THEN REWRITE_TAC[real_div] THEN + REWRITE_TAC[VECTOR_ARITH ` (((t1':real) - (t1:real)) * inv (t3:real)) % (x:real^3) + (((t2':real) - (t2:real)) * inv t3) % (v:real^3) = inv t3 % ((t1' - t1) % x + (t2' - t2) % v)`] THEN + SUBGOAL_THEN `(t3:real) % (w:real^3) = t3 %( inv t3 % (((t1':real) - (t1:real)) % (x:real^3) + ((t2':real) - (t2:real)) % (v:real^3)))` ASSUME_TAC THENL + [REWRITE_TAC[VECTOR_ARITH ` (t3:real) % (inv t3 % (((t1':real) - (t1:real)) % (x:real^3) + ((t2':real) - (t2:real)) % (v:real^3)))= (t3 * inv t3) % ((t1' - t1) % x + (t2' - t2) % v) `] THEN + SUBGOAL_THEN `((t3:real) * inv (t3:real) = &1) ` ASSUME_TAC THENL + [ASM_MESON_TAC[REAL_MUL_RINV]; + ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC]; + ASM_MESON_TAC[VECTOR_MUL_LCANCEL_IMP]]]]);; + + +let aff_gt_subset_wedge_fan2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 i:num. + ~(i= CARD (set_of_edge v V E)) +/\ ~collinear {x,v,u} /\ ~collinear {x,v, power_map_points sigma_fan x V E v u i} +==> + aff_gt {x , v} {power_map_points sigma_fan x V E v u i} SUBSET wedge2_fan x V E v u i `, + +REWRITE_TAC[SUBSET] THEN REPEAT GEN_TAC THEN +ASSUME_TAC(affine_hull_2_fan) +THEN STRIP_TAC THEN ASSUME_TAC(th3) +THEN POP_ASSUM (MP_TAC o ISPECL [`x:real^3`;`v:real^3`;`(power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))`]) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN ASSUME_TAC(AFF_GT_2_1) + THEN POP_ASSUM (MP_TAC o ISPECL [`x:real^3`;`v:real^3`;`(power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))`]) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] +THEN GEN_TAC THEN REWRITE_TAC[wedge2_fan; IN_ELIM_THM; LEFT_IMP_EXISTS_THM] THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN SUBGOAL_THEN `~((t3:real) = &0)` ASSUME_TAC +THENL + [REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; +ASSUME_TAC(th1) +THEN POP_ASSUM( MP_TAC o ISPECL[`x:real^3`;` v:real^3`;` u:real^3`;` power_map_points sigma_fan x V E v u i` ;`t1:real` ;`t2:real` ;`t3:real`]) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +SUBGOAL_THEN `t1 % x + t2 % v + t3 % power_map_points sigma_fan x V E v u i IN + complement_set {x, v}` ASSUME_TAC +THENL + [ASM_MESON_TAC[COMPLEMENT_SET_FAN]; +ASM_REWRITE_TAC[] THEN REWRITE_TAC[if_azims_fan;] +THEN ASM_MESON_TAC[REAL_ARITH`((t3:real)> &0) <=> (&0 < t3)`]]]);; + + + +let wedge_fan2_subset_aff_gt=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 i:num. + ~collinear {x,v,u} /\ ~collinear {x, v, power_map_points sigma_fan x V E v u i} +/\ ~(i= CARD (set_of_edge v V E)) +==> +wedge2_fan x V E v u i SUBSET aff_gt {x , v} {power_map_points sigma_fan x V E v u i}`, +REPEAT GEN_TAC THEN +ASSUME_TAC(affine_hull_2_fan) THEN +STRIP_TAC THEN ASSUME_TAC(th3) +THEN POP_ASSUM (MP_TAC o ISPECL [`x:real^3`;`v:real^3`;`(power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))`]) +THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THEN ASSUME_TAC(AFF_GT_2_1) + THEN POP_ASSUM (MP_TAC o ISPECL [`x:real^3`;`v:real^3`;`(power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))`]) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[SUBSET] THEN GEN_TAC + THEN REWRITE_TAC[wedge2_fan;IN_ELIM_THM] THEN REWRITE_TAC[if_azims_fan; azim] THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC + THEN ASSUME_TAC(th2) THEN POP_ASSUM(MP_TAC o ISPECL[`x:real^3`; `v:real^3`;`x':real^3`]) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASSUME_TAC(th) +THEN POP_ASSUM (MP_TAC o SPECL [`x:real^3`;`v:real^3`;`u:real^3`;`(power_map_points sigma_fan x (V:real^3->bool) (E:(real^3->bool)->bool) v u (i:num)):real^3`;]) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[EXTENSION] THEN DISCH_TAC + THEN POP_ASSUM (MP_TAC o ISPEC `x':real^3`)THEN + REWRITE_TAC[IN_ELIM_THM] THEN ASM_REWRITE_TAC[]);; + + + +let wedge_fan2_equal_aff_gt=prove( +` !x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 i:num. + ~collinear {x,v,u} /\ ~collinear {x, v, power_map_points sigma_fan x V E v u i} +/\ ~(i= CARD (set_of_edge v V E)) +==> + wedge2_fan x V E v u i = aff_gt {x , v} {power_map_points sigma_fan x V E v u i} `, +REPEAT GEN_TAC THEN STRIP_TAC THEN +SUBGOAL_THEN `wedge2_fan x V E v u i SUBSET aff_gt {x , v} {power_map_points sigma_fan x V E v u i}` ASSUME_TAC +THENL + [ ASM_MESON_TAC[ wedge_fan2_subset_aff_gt;aff_gt_subset_wedge_fan2]; + SUBGOAL_THEN ` + aff_gt {(x:real^3), (v:real^3)} {power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)} SUBSET wedge2_fan (x:real^3) V E (v:real^3) (u:real^3) (i:num)` ASSUME_TAC +THENL[ASM_MESON_TAC[aff_gt_subset_wedge_fan2]; + ASM_SET_TAC[]]]);; + + +let wedge_fan2_equal_aff_gt_fan=prove(` !x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 i:num. +FAN(x,V,E)/\ ({v,u} IN E) +/\ ~(i= CARD (set_of_edge v V E)) +==> + wedge2_fan x V E v u i = aff_gt {x , v} {power_map_points sigma_fan x V E v u i} `, + + REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC"a") THEN USE_THEN "a" MP_TAC + THEN REWRITE_TAC[FAN;fan6] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN (LABEL_TAC "b") + THEN REPEAT STRIP_TAC +THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` (u:real^3)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`(i:num)`; `(x:real^3)`;` (V:real^3->bool)`; +` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`] image_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN + MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(v:real^3)`;` power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)`]properties_of_set_of_edge_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN USE_THEN "b" (fun th-> MP_TAC(ISPEC`{(v:real^3),(u:real^3)}`th)) THEN REMOVE_THEN "b" (fun th-> MP_TAC(ISPEC`{(v:real^3),(power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))}`th)) THEN ASM_REWRITE_TAC[SET_RULE`{a} UNION {b,c}={a,b,c}`] THEN DISCH_TAC THEN DISCH_TAC THEN ASM_MESON_TAC[wedge_fan2_equal_aff_gt]);; + + + + + + +(*****wedge3_fan=w_dart_fan*******) + +let wedge3_fan=new_definition`wedge3_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) = +{y:real^3 | ( if_azims_fan x V E v u (i) < azim x v u y)/\ +(azim x v u y < if_azims_fan x V E v u (SUC i)) /\( y IN complement_set {x, v})}`;; + + + + + + + + +let w_dart_eq_wedge3_fan=prove(` !x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 i:num. + FAN(x,V,E) /\ ({v,u} IN E) +/\ (i< CARD (set_of_edge v V E)) +/\ CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))> 1 +==> +w_dart_fan x V E (x,v,power_map_points sigma_fan x V E v u i, power_map_points sigma_fan x V E v u (SUC i)) += wedge3_fan x V E v u i`, + +REPEAT GEN_TAC THEN STRIP_TAC + THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_THEN(LABEL_TAC "a") THEN USE_THEN "a" MP_TAC THEN REWRITE_TAC[FAN;fan6] THEN +STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"1") THEN REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3 `;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;` v:real^3`]th4) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +ASM_REWRITE_TAC[w_dart_fan;wedge;wedge3_fan;complement_set; IN_ELIM_THM;collinear_fan] + THEN DISJ_CASES_TAC(ARITH_RULE`i=0 \/ 0< (i:num)`) +THENL[ + +MP_TAC(ARITH_RULE`CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) > 1 ==> ~(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))= 0)/\ ~(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))=1)`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +ASM_REWRITE_TAC[power_map_points;if_azims_fan;ARITH_RULE`SUC 0 =1`;AZIM_REFL;] THEN ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]; + +MP_TAC(ARITH_RULE`(i:num)bool) (E:(real^3->bool)->bool))==> ~(i=CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC(ISPECL[`x:real^3 `;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;`i:num`]SUM_IF_AZIMS_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC "bc") THEN ASM_REWRITE_TAC[if_azims_fan;EXTENSION;IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC +THENL[ + +STRIP_TAC THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH`azim (x:real^3) (v:real^3) ( power_map_points sigma_fan (x:real^3) + (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) (x':real^3) < azim (x:real^3) (v:real^3) +( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) +(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (power_map_points sigma_fan (x:real^3) (V:real^3->bool) +(E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) ) +==> azim (x:real^3) (v:real^3) (u:real^3) ( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) + (v:real^3) (u:real^3) (i:num)) + azim (x:real^3) (v:real^3) ( power_map_points sigma_fan (x:real^3) (V:real^3->bool) + (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) (x':real^3)< azim (x:real^3) (v:real^3) (u:real^3) +( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) + + azim (x:real^3) (v:real^3) ( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num)) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) +( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) )`) + THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "bc" MP_TAC THEN GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o REDEPTH_CONV) [if_azims_fan;power_map_points] + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) THEN DISCH_TAC + THEN ASSUME_TAC (ISPECL[`x:real^3 `;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`;`SUC i:num`]if_azims_works_fan) + THEN MP_TAC(REAL_ARITH`azim (x:real^3) (v:real^3) (u:real^3) ( power_map_points sigma_fan (x:real^3) + (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) + azim (x:real^3) (v:real^3) +( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) +(x':real^3)< if_azims_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) + (v:real^3) (u:real^3) (SUC(i:num)) /\ if_azims_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) + (v:real^3) (u:real^3) (SUC(i:num)) <= &2 *pi ==> azim (x:real^3) (v:real^3) (u:real^3) +( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) + + azim (x:real^3) (v:real^3) ( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num)) (x':real^3)< &2 * pi`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`x':real^3`]collinear_fan) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`i:num`;`x:real^3 `;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`]IN2_ORBITS_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`SUC(i:num)`;`x:real^3 `;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`]IN2_ORBITS_FAN) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC + THEN REMOVE_THEN "1" (fun th-> MP_TAC(ISPEC`{(v:real^3),(u:real^3)}`th)THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`{(v:real^3),( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num))}`th)) THEN ASM_REWRITE_TAC[SET_RULE`{a}UNION {b,c}={a,b,c}`]THEN DISCH_TAC THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num))`; `x':real^3`]sum3_azim_fan) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[] + THEN ASM_REWRITE_TAC[REAL_ARITH`(a:real) < a +b <=> &0 < b`; REAL_ARITH`(a:real) + c< a +b<=> c< b`;]; + +STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN DISCH_THEN(LABEL_TAC"ma1") THEN DISCH_THEN(LABEL_TAC"ma2") THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] THEN +MP_TAC(REAL_ARITH`azim (x:real^3) (v:real^3) (u:real^3) ( power_map_points sigma_fan (x:real^3) + (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) < azim (x:real^3) (v:real^3) (u:real^3) +(x':real^3) +==> azim (x:real^3) (v:real^3) (u:real^3) ( power_map_points sigma_fan (x:real^3) + (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)) <= azim (x:real^3) (v:real^3) (u:real^3) +(x':real^3) +`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN + MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`x':real^3`]collinear_fan) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`i:num`;`x:real^3 `;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`]IN2_ORBITS_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`SUC(i:num)`;`x:real^3 `;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` v:real^3`;` u:real^3`]IN2_ORBITS_FAN) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC + THEN REMOVE_THEN "1" (fun th-> MP_TAC(ISPEC`{(v:real^3),(u:real^3)}`th)THEN ASSUME_TAC(th)) + THEN POP_ASSUM (fun th-> MP_TAC(ISPEC`{(v:real^3),( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num))}`th)) THEN ASM_REWRITE_TAC[SET_RULE`{a}UNION {b,c}={a,b,c}`]THEN DISCH_TAC THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num))`; `x':real^3`]sum4_azim_fan) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN REMOVE_THEN "ma1" MP_TAC THEN REMOVE_THEN "ma2" MP_TAC +THEN ASM_REWRITE_TAC[power_map_points] THEN REAL_ARITH_TAC]]);; + + + + + + + + +let UNION_FAN=prove( +`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E)/\ ({v,u}IN E) +==> + (UNIV:real^3->bool) = aff {x,v} UNION (UNIONS {wedge3_fan x V E v u i|i| 0 <= i /\ i< CARD(set_of_edge v V E) }) +UNION + (UNIONS {wedge2_fan x V E v u i|i| 0 <= i /\ i< CARD(set_of_edge v V E) } ) +`, + +REPEAT STRIP_TAC THEN REWRITE_TAC[EXTENSION; UNION;IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC +THENL(*1*)[ +STRIP_TAC THEN DISJ_CASES_TAC(SET_RULE`(x':real^3) IN aff {(x:real^3),(v:real^3)} \/ ~((x':real^3) IN aff {x,v})`) +THENL(*2*)[ +ASM_SET_TAC[];(*2*) + +ASM_REWRITE_TAC[] + THEN DISJ_CASES_TAC(SET_RULE`(x':real^3) IN (UNIONS {wedge2_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)|i| 0 <= i /\ i< CARD(set_of_edge v V E)} ) + \/ ~((x':real^3) IN (UNIONS {wedge2_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)|i| 0 <= i/\ i< CARD(set_of_edge v V E)}) )`) +THENL(*3*)[ +ASM_REWRITE_TAC[];(*3*) +ASM_REWRITE_TAC[] + THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[UNIONS;IN_ELIM_THM;NOT_EXISTS_THM;DE_MORGAN_THM;ARITH_RULE `(0 <= (i:num))`] + THEN DISCH_TAC THEN SUBGOAL_THEN`!i:num. ~((x':real^3) IN wedge2_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num))\/ ~(i< CARD(set_of_edge v V E)) ` ASSUME_TAC +THENL(*4*)[ +ASM_SET_TAC[];(*4*) + +POP_ASSUM MP_TAC THEN REWRITE_TAC[wedge2_fan;IN_ELIM_THM] THEN DISCH_THEN(LABEL_TAC"100") + THEN SUBGOAL_THEN`(~((x':real^3) IN set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)))` ASSUME_TAC +THENL(*5*)[ +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`]SIMP_ORBITS_POINTS_FAN) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) + THEN REWRITE_TAC[IN_ELIM_THM] THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") THEN STRIP_TAC + THEN REMOVE_THEN "a"(fun th-> MP_TAC(ISPEC`i:num`th)) + THEN MP_TAC(ARITH_RULE`(i:num) < CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))==> ~(i=CARD(set_of_edge v V E))`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[if_azims_fan;complement_set; IN_ELIM_THM] + THEN ASM_MESON_TAC[remark_power_map_points];(*5*) + +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`]SIMP_ORBITS_POINTS_FAN) THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN(LABEL_TAC"a") + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;`x':real^3`]exists_inverse_in_orbits_sigma_fan) THEN ASM_REWRITE_TAC[azim1] + THEN STRIP_TAC + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"b") +THEN DISCH_TAC THEN DISCH_TAC + THEN REMOVE_THEN "b" MP_TAC + THEN REMOVE_THEN "a"(fun th->REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") THEN DISCH_TAC + THEN REWRITE_TAC[IN_ELIM_THM] + THEN STRIP_TAC + THEN EXISTS_TAC`wedge3_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num)` + THEN STRIP_TAC +THENL(*6*)[ +EXISTS_TAC`i:num` THEN ASM_REWRITE_TAC[];(*6*) + +ASM_REWRITE_TAC[wedge3_fan; complement_set; IN_ELIM_THM;] + THEN SUBGOAL_THEN`if_azims_fan x (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3) (i:num) < azim (x:real^3) v u (x':real^3)` ASSUME_TAC +THENL(*7*)[ +MP_TAC(ARITH_RULE`(i:num) < CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))==> ~(i=CARD(set_of_edge v V E))`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[if_azims_fan;complement_set; IN_ELIM_THM] + THEN POP_ASSUM MP_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`(i:num)=0 \/ 0< i`) +THENL(*8*)[ + +ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC THEN ASM_REWRITE_TAC[AZIM_REFL] + THEN POP_ASSUM (fun th->REWRITE_TAC[]) + THEN POP_ASSUM (fun th->REWRITE_TAC[]) + THEN POP_ASSUM (fun th->REWRITE_TAC[]) + THEN POP_ASSUM (fun th->REWRITE_TAC[]) + THEN POP_ASSUM (fun th->REWRITE_TAC[]) + THEN POP_ASSUM (fun th->REWRITE_TAC[]) + THEN POP_ASSUM (fun th->REWRITE_TAC[]) + THEN POP_ASSUM (fun th->MP_TAC(ISPEC`0`th)) THEN DISCH_THEN(LABEL_TAC"a") + THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[if_azims_fan;power_map_points;DE_MORGAN_THM; complement_set; IN_ELIM_THM;AZIM_REFL;ARITH_RULE`(~(0 (0=a))`] + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x':real^3`]azim ) THEN POP_ASSUM MP_TAC + THEN REAL_ARITH_TAC;(*8*) + +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;] u_IN_ORBITS_FAN) THEN DISCH_TAC + THEN SUBGOAL_THEN `~(u=(x':real^3))` ASSUME_TAC +THENL(*9*)[ +ASM_SET_TAC[];(*9*) + + DISCH_TAC THEN REMOVE_THEN "a"(fun th-> MP_TAC(ISPEC`u:real^3`th)) THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[REAL_ARITH`(b:real)- a<= b-c <=> c <= a`] THEN DISCH_THEN(LABEL_TAC"b1") + THEN MP_TAC(ARITH_RULE`0< (i:num)/\ i ~(0=CARD(set_of_edge v V E))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN USE_THEN"100"(fun th-> MP_TAC(ISPEC`0`th)) THEN +REWRITE_TAC[if_azims_fan] THEN ASM_REWRITE_TAC[power_map_points;AZIM_REFL;complement_set; IN_ELIM_THM] + THEN MP_TAC(ARITH_RULE`i ~(i=CARD(set_of_edge v V E))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN USE_THEN"100"(fun th-> MP_TAC(ISPEC`i:num`th)) THEN +REWRITE_TAC[if_azims_fan] THEN ASM_REWRITE_TAC[power_map_points;AZIM_REFL;complement_set; IN_ELIM_THM] + + THEN GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b <=> b=a`] THEN DISCH_TAC +THEN +DISJ_CASES_TAC(SET_RULE`collinear {(x:real^3),v,x'} \/ ~collinear {x,v,x'}`) +THENL(*10*)[ + +POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC( LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [SET_RULE`{a,b,c}= {a,c,b}`] + THEN REWRITE_TAC[COLLINEAR_3_EXPAND;] + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;` (v:real^3)`] remark1_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN SUBGOAL_THEN `(x':real^3) IN aff {x,v}` ASSUME_TAC +THENL(*11*)[ +REWRITE_TAC[aff; AFFINE_HULL_2; IN_ELIM_THM] THEN EXISTS_TAC`u':real` THEN EXISTS_TAC`&1 -(u':real)` THEN ASM_REWRITE_TAC[] + THEN REAL_ARITH_TAC;(*11*) +ASM_MESON_TAC[]](*11*);(*10*) + +STRIP_TAC +THENL(*11*)[ +POP_ASSUM MP_TAC THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;` (v:real^3)`] remark1_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`i:num`;`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] remark_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x':real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num))`]AZIM_EQ_ALT) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num))`;`x':real^3`]AZIM_EQ_0_ALT) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN DISCH_TAC THEN MP_TAC(ISPECL[`(x:real^3) `;`(v:real^3)`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num))`;` (x':real^3)`] AZIM_COMPL) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`(x:real^3) `;`(v:real^3)`;` (u:real^3)`;`(x':real^3)`] AZIM_COMPL) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN DISCH_TAC + THEN REMOVE_THEN"b1" MP_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`b-a<= b-c <=> c<= a`] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`; `( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num))`;` (x':real^3)`]sum5_azim_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (i:num))`;` (x':real^3)`]azim) THEN POP_ASSUM MP_TAC + THEN POP_ASSUM(fun th->REWRITE_TAC[]) + THEN POP_ASSUM(fun th->REWRITE_TAC[]) + THEN POP_ASSUM(fun th->REWRITE_TAC[]) + THEN POP_ASSUM(fun th->REWRITE_TAC[]) + THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*11*) +REPEAT (POP_ASSUM MP_TAC) THEN ARITH_TAC](*11*)](*10*)](*9*)](*8*);(*7*) + + +ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"b") THEN DISCH_THEN(LABEL_TAC"c") + THEN DISJ_CASES_TAC(ARITH_RULE`SUC (i:num)= CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))\/ ~(SUC (i)= CARD(set_of_edge v V E))`) +THENL(*8*)[ + +ASM_REWRITE_TAC[if_azims_fan] THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x':real^3`]azim) THEN REAL_ARITH_TAC; +(*8*) +DISJ_CASES_TAC(ARITH_RULE`(i:num)=0 \/ 0 REWRITE_TAC[SYM(th)]THEN ASSUME_TAC(SYM(th))) + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;] u_IN_ORBITS_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;`w:real^3`] IN_ORBITS_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN SUBGOAL_THEN `~(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (w:real^3)=(x':real^3))` ASSUME_TAC +THENL(*10*)[ASM_SET_TAC[];(*10*) + +REMOVE_THEN "a" (fun th -> MP_TAC(ISPEC`sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (w:real^3)`th)) THEN ASM_REWRITE_TAC[REAL_ARITH`b-a<= b-c <=> c<= a`]THEN DISCH_THEN(LABEL_TAC"b1") + THEN MP_TAC(ARITH_RULE`(i:num)=0/\ i ~(0=CARD(set_of_edge v V E))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN USE_THEN"100"(fun th-> MP_TAC(ISPEC`i:num`th)) THEN +REWRITE_TAC[if_azims_fan] THEN ASM_REWRITE_TAC[power_map_points;AZIM_REFL;complement_set; IN_ELIM_THM] + + THEN GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b <=> b=a`] THEN DISCH_TAC + + THEN MP_TAC(ARITH_RULE`(i:num)=0/\ ~(SUC(i) =CARD(set_of_edge (v:real^3) V E))==> ~(SUC(0)=CARD(set_of_edge v V E))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN USE_THEN"100"(fun th-> MP_TAC(ISPEC`SUC(0):num`th)) THEN +REWRITE_TAC[if_azims_fan] THEN ASM_REWRITE_TAC[power_map_points;AZIM_REFL;complement_set; IN_ELIM_THM] + + THEN GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b <=> b=a`] THEN REWRITE_TAC[power_map_points] +THEN +DISJ_CASES_TAC(SET_RULE`collinear {(x:real^3),v,x'} \/ ~collinear {x,v,x'}`) +THENL(*11*)[ +POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC( LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [SET_RULE`{a,b,c}= {a,c,b}`] + THEN REWRITE_TAC[COLLINEAR_3_EXPAND;] + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;` (v:real^3)`] remark1_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN SUBGOAL_THEN `(x':real^3) IN aff {x,v}` ASSUME_TAC +THENL(*12*)[ +REWRITE_TAC[aff; AFFINE_HULL_2; IN_ELIM_THM] THEN EXISTS_TAC`u':real` THEN EXISTS_TAC`&1 -(u':real)` THEN ASM_REWRITE_TAC[] + THEN REAL_ARITH_TAC;(*12*) +ASM_MESON_TAC[]](*12*);(*11*) + +STRIP_TAC THENL(*12*)[ + +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;` (v:real^3)`] remark1_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(SET_RULE`(u:real^3)=(w:real^3) /\ {v,u} IN (E:(real^3->bool)->bool)==> {v,w} IN E`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + + THEN MP_TAC(ISPECL[`SUC(0):num`;`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`] remark_power_map_points) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x':real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (SUC(0):num))`]AZIM_EQ_ALT) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (SUC(0):num))`;`x':real^3`]AZIM_EQ_0_ALT) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(v:real^3)`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (SUC(0):num))`;` (x':real^3)`] AZIM_COMPL) THEN ASM_REWRITE_TAC[power_map_points] + THEN MP_TAC(ISPECL[`(x:real^3) `;`(v:real^3)`;` (u:real^3)`;`(x':real^3)`] AZIM_COMPL) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN DISCH_TAC + THEN REMOVE_THEN"b1" MP_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`b-a<= b-c <=> c<= a`] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (SUC(0):num))`;`w:real^3`;` (x':real^3)`]sum5_azim_fan) + THEN ASM_REWRITE_TAC[power_map_points;REAL_ARITH`a=b+c <=> c=a-b`] THEN +DISCH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`a-b a< b+c`] + THEN MP_TAC(ARITH_RULE` (i:num) < (CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))) /\ ~(SUC(i)=CARD(set_of_edge v V E)) ==> SUC(i) < CARD(set_of_edge v V E)`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`; `SUC(i):num`; `i:num`] cyclic_power_sigma_fan) THEN ASM_REWRITE_TAC[power_map_points;ARITH_RULE`0< SUC 0`; ] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3))`; `w:real^3`; ] UNIQUE_AZIM_0_POINT_FAN) THEN ASM_REWRITE_TAC[power_map_points; ] + THEN DISCH_TAC THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`;` (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3))`; `w:real^3`]AZIM_COMPL) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`c c REWRITE_TAC[SYM(th)]THEN ASSUME_TAC(SYM(th))) + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;`i:num`] i_IN_ORBITS_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;`w:real^3`] IN_ORBITS_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN SUBGOAL_THEN `~(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (w:real^3)=(x':real^3))` ASSUME_TAC +THENL(*10*)[ ASM_SET_TAC[];(*10*) + +REMOVE_THEN "a" (fun th -> MP_TAC(ISPEC`sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (w:real^3)`th)) THEN ASM_REWRITE_TAC[REAL_ARITH`b-a<= b-c <=> c<= a`]THEN DISCH_THEN(LABEL_TAC"b1") + THEN MP_TAC(ARITH_RULE`i ~(i=CARD(set_of_edge v V E))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN USE_THEN"100"(fun th-> MP_TAC(ISPEC`i:num`th)) THEN +REWRITE_TAC[if_azims_fan] THEN ASM_REWRITE_TAC[power_map_points;AZIM_REFL;complement_set; IN_ELIM_THM] + + THEN GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b <=> b=a`] THEN DISCH_TAC + THEN USE_THEN"100"(fun th-> MP_TAC(ISPEC`SUC(i):num`th)) THEN +REWRITE_TAC[if_azims_fan] THEN ASM_REWRITE_TAC[power_map_points;AZIM_REFL;complement_set; IN_ELIM_THM] + + THEN GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b <=> b=a`] THEN REWRITE_TAC[power_map_points] +THEN +DISJ_CASES_TAC(SET_RULE`collinear {(x:real^3),v,x'} \/ ~collinear {x,v,x'}`) +THENL(*11*)[ +POP_ASSUM MP_TAC THEN GEN_REWRITE_TAC( LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [SET_RULE`{a,b,c}= {a,c,b}`] + THEN REWRITE_TAC[COLLINEAR_3_EXPAND;] + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;` (v:real^3)`] remark1_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN SUBGOAL_THEN `(x':real^3) IN aff {x,v}` ASSUME_TAC +THENL(*12*)[ +REWRITE_TAC[aff; AFFINE_HULL_2; IN_ELIM_THM] THEN EXISTS_TAC`u':real` THEN EXISTS_TAC`&1 -(u':real)` THEN ASM_REWRITE_TAC[] + THEN REAL_ARITH_TAC;(*12*) +ASM_MESON_TAC[]](*12*);(*11*) + +STRIP_TAC THENL(*12*)[ +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;` (v:real^3)`] remark1_fan) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`i:num`;`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] remark_power_map_points) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`SUC(i):num`;`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] remark_power_map_points) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC +THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x':real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (SUC(i):num))`]AZIM_EQ_ALT) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (SUC(i):num))`;`x':real^3`]AZIM_EQ_0_ALT) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC + THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x':real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) ((i):num))`]AZIM_EQ_ALT) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) ((i):num))`;`x':real^3`]AZIM_EQ_0_ALT) THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(v:real^3)`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (SUC(i):num))`;` (x':real^3)`] AZIM_COMPL) THEN ASM_REWRITE_TAC[power_map_points] + THEN MP_TAC(ISPECL[`(x:real^3) `;`(v:real^3)`;` (w:real^3)`;`(x':real^3)`] AZIM_COMPL) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN DISCH_TAC +THEN + REMOVE_THEN "c" MP_TAC THEN ASM_REWRITE_TAC[if_azims_fan] THEN DISCH_TAC THEN +MP_TAC(REAL_ARITH`azim x v u w< azim (x:real^3) v u x'==> azim x v u w<= azim (x:real^3) v u x'`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`(u:real^3)`;`w:real^3`;` (x':real^3)`]sum4_azim_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;`i:num`] SUM_IF_AZIMS_FAN) THEN ASM_REWRITE_TAC[if_azims_fan;power_map_points] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[REAL_ARITH`a+b b c<= a`] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) (SUC(i):num))`;`w:real^3`;` (x':real^3)`]sum5_azim_fan) + THEN ASM_REWRITE_TAC[power_map_points;REAL_ARITH`a=b+c <=> c=a-b`] +THEN DISCH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`a-b a< b+c`] +THEN MP_TAC(ARITH_RULE` (i:num) < (CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))) /\ ~(SUC(i)=CARD(set_of_edge v V E)) ==> SUC(i) < CARD(set_of_edge v V E)`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`; `SUC(i):num`; `i:num`] cyclic_power_sigma_fan) THEN ASM_REWRITE_TAC[power_map_points;ARITH_RULE`i< SUC i`; ] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (w:real^3))`; `w:real^3`; ] UNIQUE_AZIM_0_POINT_FAN) THEN ASM_REWRITE_TAC[power_map_points; ] + THEN DISCH_TAC THEN MP_TAC(ISPECL[`x:real^3`; `v:real^3`;` (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (w:real^3))`; `w:real^3`]AZIM_COMPL) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[REAL_ARITH`c c aff {x,v} SUBSET aff_ge {x,v} {w}`, + +REPEAT GEN_TAC THEN STRIP_TAC THEN +MP_TAC(ISPECL[`(x:real^3) `;` (v:real^3)`;` (w:real^3)`]AFF_GE_2_1) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC +THEN ASM_REWRITE_TAC[aff; AFFINE_HULL_2; SUBSET; AFF_GE_2_1; IN_ELIM_THM] + THEN GEN_TAC THEN STRIP_TAC + THEN EXISTS_TAC`u:real` THEN EXISTS_TAC`v':real` THEN EXISTS_TAC`&0` + THEN ASM_REWRITE_TAC[VECTOR_ARITH`a=b +c + &0 % d<=>a=b+c`] + THEN REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC);; + + + + +let eq_set_wdart_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E)/\ ({v,u}IN E) +==> +({w_dart_fan x V E (x,v,w,(sigma_fan x V E v w))|w| {v,w} IN E } += {wedge3_fan x V E v u i|i| 0 <= i/\ i< CARD(set_of_edge v V E) }) +`, + +(let lem= prove(`!x v u w. +(&0 < azim x v u w) <=> ~(azim x v u w= &0)`, +MESON_TAC[azim; REAL_ARITH`&0 <= a==> (&0 < a) <=> ~(a= &0)`]) in +( let lem1=prove(`!x v. ~(x = v)==>(!u. ~(u IN aff {x, v}) <=> ~collinear {x, v, u})`, +MESON_TAC[collinear_fan]) in +(let lem2=prove(`!v0 v1 w. + ~collinear{v0,v1,w} ==> +!x. ( ~(azim v0 v1 w x = &0)/\ ~collinear{v0,v1,x} <=> ~(x IN aff_ge {v0,v1} {w}) /\ ~collinear{v0,v1,x})`, +MESON_TAC[AZIM_EQ_0_GE_ALT]) in + +REPEAT STRIP_TAC THEN REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC +THENL(*1*)[ +REWRITE_TAC[GSYM(EXTENSION)] THEN STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`] properties_of_set_of_edge_fan) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] ORBITS_EQ_SET_EDGE_FAN) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] SIMP_ORBITS_POINTS_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)])THEN DISCH_TAC +THEN POP_ASSUM(fun th->GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[th]) + THEN REWRITE_TAC[IN_ELIM_THM;] THEN STRIP_TAC THEN EXISTS_TAC `i:num` THEN +ASM_REWRITE_TAC[ARITH_RULE`0<= (i:num)`] + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`]CARD_SET_OF_ORBITS_POINTS_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC +THEN +DISJ_CASES_TAC(ARITH_RULE`(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))>1 \/ ~((CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))> 1)`) +THENL[ +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;`i:num`] w_dart_eq_wedge3_fan) + THEN ASM_REWRITE_TAC[power_map_points]; + +MP_TAC(ARITH_RULE`(i:num)bool) (E:(real^3->bool)->bool)) /\ ~(CARD(set_of_edge v V E)>1)==> i=0`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +ASM_REWRITE_TAC[w_dart_fan;wedge3_fan;if_azims_fan;power_map_points] + THEN DISJ_CASES_TAC(ARITH_RULE` 0= CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) \/ ~(0=CARD(set_of_edge v V E))`) +THENL[ + +REPEAT (POP_ASSUM MP_TAC) THEN ARITH_TAC; + +MP_TAC(ARITH_RULE`~(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))>1) /\ ~(0=CARD(set_of_edge v V E))==> SUC (0)=CARD(set_of_edge v V E)`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +ASM_REWRITE_TAC[complement_set;IN_ELIM_THM;AZIM_REFL;azim] + + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] ORBITS_EQ_SET_EDGE_FAN) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] SIMP_ORBITS_POINTS_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)])THEN + POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) THEN REWRITE_TAC[ARITH_RULE`(a:num) < SUC 0 <=> a=0`;SET_RULE`{f i| i=0}={f 0}`; +power_map_points] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;` (v:real^3)`] remark1_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`]lem1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN ASM_REWRITE_TAC[lem] THEN POP_ASSUM (fun th-> REWRITE_TAC[]) + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]lem2) THEN POP_ASSUM (fun th-> REWRITE_TAC[th] THEN ASSUME_TAC(th)) +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]aff_subset_aff_ge) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th] THEN ASSUME_TAC(th)) THEN DISCH_TAC + THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[th;collinear_fan;]) THEN ASM_REWRITE_TAC[GSYM(DE_MORGAN_THM);] + THEN ASM_SET_TAC[]]]; + +REWRITE_TAC[GSYM(EXTENSION)] THEN STRIP_TAC +THEN EXISTS_TAC`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) ((i):num)) ` THEN +MP_TAC(ISPECL[`i:num`;`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] remark_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th->REWRITE_TAC[th]) + THEN DISJ_CASES_TAC(ARITH_RULE`(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))>1 \/ ~((CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))> 1)`) +THENL[ +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;`i:num`] w_dart_eq_wedge3_fan) + THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC THEN POP_ASSUM(fun th->REWRITE_TAC[th]); + +MP_TAC(ARITH_RULE`(i:num)bool) (E:(real^3->bool)->bool)) /\ ~(CARD(set_of_edge v V E)>1)==> i=0`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +ASM_REWRITE_TAC[w_dart_fan;wedge3_fan;if_azims_fan;power_map_points] + THEN DISJ_CASES_TAC(ARITH_RULE` 0= CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) \/ ~(0=CARD(set_of_edge v V E))`) +THENL[ +REPEAT (POP_ASSUM MP_TAC) THEN ARITH_TAC; + +MP_TAC(ARITH_RULE`~(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))>1) /\ ~(0=CARD(set_of_edge v V E))==> SUC (0)=CARD(set_of_edge v V E)`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +ASM_REWRITE_TAC[complement_set;IN_ELIM_THM;AZIM_REFL;azim] + + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] ORBITS_EQ_SET_EDGE_FAN) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] SIMP_ORBITS_POINTS_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)])THEN + POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) THEN REWRITE_TAC[ARITH_RULE`(a:num) < SUC 0 <=> a=0`;SET_RULE`{f i| i=0}={f 0}`; +power_map_points] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;` (v:real^3)`] remark1_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`x:real^3`;`v:real^3`]lem1) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC +THEN ASM_REWRITE_TAC[lem] THEN POP_ASSUM (fun th-> REWRITE_TAC[]) + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]lem2) THEN POP_ASSUM (fun th-> REWRITE_TAC[th] THEN ASSUME_TAC(th)) +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]aff_subset_aff_ge) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th] THEN ASSUME_TAC(th)) THEN DISCH_TAC + THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[th;collinear_fan;]) THEN ASM_REWRITE_TAC[GSYM(DE_MORGAN_THM);] + THEN ASM_SET_TAC[]]]]))));; + + + + +let eq_set_aff_gt=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E)/\ ({v,u}IN E) +==> {aff_gt {x,v} {w} |w| {v,w} IN E} +={wedge2_fan x V E v u i|i| 0 <= i /\ i< CARD(set_of_edge v V E) }`, + +REPEAT STRIP_TAC THEN REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC +THENL[ +REWRITE_TAC[GSYM(EXTENSION)] THEN STRIP_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`] properties_of_set_of_edge_fan) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] ORBITS_EQ_SET_EDGE_FAN) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] SIMP_ORBITS_POINTS_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)])THEN DISCH_TAC +THEN POP_ASSUM(fun th->GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[th]) + THEN REWRITE_TAC[IN_ELIM_THM;] THEN STRIP_TAC THEN EXISTS_TAC `i:num` THEN + ASM_REWRITE_TAC[ARITH_RULE`0 <= i`] + + THEN MP_TAC(ARITH_RULE`(i:num) < CARD(set_of_edge v V E) ==> ~(i= CARD(set_of_edge (v:real^3) (V:real^3->bool)(E:(real^3->bool)->bool)))`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;`i:num`] wedge_fan2_equal_aff_gt_fan) + + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]); + +REWRITE_TAC[GSYM(EXTENSION)] THEN STRIP_TAC +THEN EXISTS_TAC`( power_map_points sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) + (u:real^3) ((i):num)) ` THEN +MP_TAC(ISPECL[`i:num`;`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`] remark_power_map_points) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th->REWRITE_TAC[th]) + + THEN MP_TAC(ARITH_RULE`(i:num) < CARD(set_of_edge v V E) ==> ~(i= CARD(set_of_edge (v:real^3) (V:real^3->bool)(E:(real^3->bool)->bool)))`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`;`i:num`] wedge_fan2_equal_aff_gt_fan) + + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)])]);; + + + + + + +let UNION1_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). + +FAN(x,V,E)/\ ({v,u}IN E) +==> + (UNIV:real^3->bool) = aff {x,v} UNION (UNIONS {w_dart_fan x V E (x,v,w,(sigma_fan x V E v w))|w| {v,w} IN E }) +UNION + (UNIONS {aff_gt {x,v} {w} |w| {v,w} IN E} ) +`, + +REPEAT STRIP_TAC + THEN MP_TAC (ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`]UNION_FAN) THEN ASM_REWRITE_TAC[] + THEN MP_TAC (ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`]eq_set_wdart_fan) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN MP_TAC (ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (u:real^3)`]eq_set_aff_gt ) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN ASM_SET_TAC[]);; + + + + + + + + + + +let CARD_SING=prove(`!x:real^3 s:real^3->bool. + FINITE s +/\ s={x} +==> +CARD s = 1`, +REPEAT STRIP_TAC THEN +MP_TAC(SET_RULE`(s:real^3->bool)={(x:real^3)} ==> ~(s={}) /\ x IN s /\ s DELETE x ={}`) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPEC`s:real^3->bool`CARD_EQ_0) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`x:real^3`;`s:real^3->bool`]CARD_DELETE) THEN ASM_REWRITE_TAC[CARD_CLAUSES] + THEN ARITH_TAC);; + + + +let disjoint_set_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (w1:real^3). +FAN(x,V,E)/\ ({v,w}IN E) /\ ({v,w1}IN E) +==> + w_dart_fan x V E (x,v,w,(sigma_fan x V E v w)) INTER + aff_gt {x,v} {w1}={}`, + +(let lem =prove(`!x:real^3. + FINITE {x} +==> +CARD {x} = 1`,MESON_TAC[CARD_SING]) in +(let lem1=prove(`!x v. ~(x = v)==>(!u. ~(u IN aff {x, v}) <=> ~collinear {x, v, u})`, +MESON_TAC[collinear_fan]) in +(let lem2=prove(`!v0 v1 w. + ~collinear{v0,v1,w} ==> +!x. ( &0 = azim v0 v1 w x /\ ~collinear{v0,v1,x} <=> (x IN aff_ge {v0,v1} {w}) /\ ~collinear{v0,v1,x})`, +MESON_TAC[AZIM_EQ_0_GE_ALT]) in + + +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w1:real^3)`] properties_of_set_of_edge_fan) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`] ORBITS_EQ_SET_EDGE_FAN) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`] SIMP_ORBITS_POINTS_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)])THEN DISCH_TAC +THEN POP_ASSUM(fun th->GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[th]) + THEN REWRITE_TAC[IN_ELIM_THM;] THEN STRIP_TAC + THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ARITH_RULE`i< CARD(set_of_edge (v:real^3) V E)==> ~(i=CARD(set_of_edge v V E))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`i:num`] wedge_fan2_equal_aff_gt_fan) + + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) + THEN DISJ_CASES_TAC(ARITH_RULE`(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))>1 \/ ~((CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))> 1)`) +THENL(*1*)[ + MP_TAC(ARITH_RULE`CARD(set_of_edge (v:real^3) V E)>1==> 0< CARD(set_of_edge v V E)`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN + MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`0:num`] w_dart_eq_wedge3_fan) + THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[wedge2_fan;wedge3_fan;EXTENSION] THEN GEN_TAC THEN +REWRITE_TAC[INTER; EMPTY;IN_ELIM_THM] + THEN DISJ_CASES_TAC(ARITH_RULE`(i:num)=0 \/ (0< i)`) +THENL(*2*)[ +ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC;(*2*) + + MP_TAC(ARITH_RULE`CARD(set_of_edge (v:real^3) V E)>1==> ~(0= CARD(set_of_edge v V E))/\ ~(SUC 0= CARD(set_of_edge v V E))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN +ASM_REWRITE_TAC[if_azims_fan] +THEN +MP_TAC(ARITH_RULE` (0< i)==> SUC (0)= i \/ SUC 0 bool) (E:(real^3->bool)->bool)={w} \/ ~(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={w})`) +THENL(*4*)[ + MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`;` (v:real^3)`]remark1_fan) + THEN ASM_REWRITE_TAC[IN_SING] THEN DISCH_TAC THEN ASM_REWRITE_TAC[power_map_points] THEN REAL_ARITH_TAC;(*4*) + +MP_TAC(ISPECL[`i:num`;`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`SUC (0):num`] AZIM_LE_POWER_SIGMA_FAN) + THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC](*4*)](*3*)](*2*);(*1*) + + + MP_TAC(ARITH_RULE`~(CARD(set_of_edge (v:real^3) V E)>1) /\ (i< CARD(set_of_edge v V E))==> i=0/\ ~(0=CARD(set_of_edge (v:real^3) V E))`) THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[wedge2_fan;w_dart_fan;if_azims_fan;power_map_points;complement_set;AZIM_REFL;EXTENSION] THEN GEN_TAC THEN +REWRITE_TAC[DIFF;INTER;IN_ELIM_THM;GSYM(EXTENSION);COND_ELIM_THM] + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`;` (v:real^3)`] remark1_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;]lem1) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]lem2) THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[th] ) THEN ASM_REWRITE_TAC[collinear_fan] +THEN +DISJ_CASES_TAC(SET_RULE`set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={w} \/ ~(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={w})`) + + +THENL(*2*)[ +ASM_SET_TAC[];(*2*) + +MP_TAC(ARITH_RULE`~(CARD(set_of_edge (v:real^3) V E)>1) /\ ~(0= CARD(set_of_edge v V E))==> (1=CARD(set_of_edge (v:real^3) V E))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(SET_RULE`w IN set_of_edge (v:real^3) V E==> {w} SUBSET set_of_edge (v:real^3) V E`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`{(w:real^3)}`;`set_of_edge (v:real^3) V E`] FINITE_SUBSET) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN +MP_TAC(ISPEC`w:real^3`lem) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`{(w:real^3)}`;`set_of_edge (v:real^3) V E`]CARD_SUBSET_EQ) + THEN ASM_REWRITE_TAC[]]]))));; + + +let disjiont1_cor6dot1 = prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 i:num. +wedge3_fan x V E v u i INTER aff {x,v}={}`, +REPEAT GEN_TAC THEN REWRITE_TAC[wedge3_fan; INTER] THEN REWRITE_TAC[complement_set; FUN_EQ_THM; EMPTY] THEN +GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN MESON_TAC[]);; + + + +let disjoint_fan1=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3). +FAN(x,V,E)/\ ({v,w}IN E) +==> + w_dart_fan x V E (x,v,w,(sigma_fan x V E v w)) INTER aff {x,v}={}`, +REPEAT STRIP_TAC + THEN DISJ_CASES_TAC(ARITH_RULE`(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))>1 \/ ~((CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))> 1)`) + +THENL[ + MP_TAC(ARITH_RULE`CARD(set_of_edge (v:real^3) V E)>1==> (0bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`0:num`] w_dart_eq_wedge3_fan) + THEN ASM_REWRITE_TAC[power_map_points;] THEN DISCH_TAC THEN ASM_REWRITE_TAC[disjiont1_cor6dot1]; + + MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`;` (v:real^3)`] remark1_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[w_dart_fan;INTER; IN_ELIM_THM;COND_ELIM_THM] + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]aff_subset_aff_ge) THEN ASM_REWRITE_TAC[] + THEN ASM_SET_TAC[]]);; + + + + + + + +let disjoint_fan2=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (w1:real^3). +FAN(x,V,E)/\ ({v,w}IN E) /\ ({v,w1}IN E) /\ ~(w=w1) +==> + w_dart_fan x V E (x,v,w,(sigma_fan x V E v w)) INTER + w_dart_fan x V E (x,v,w1,(sigma_fan x V E v w1))={}`, +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w1:real^3)`] properties_of_set_of_edge_fan) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`] ORBITS_EQ_SET_EDGE_FAN) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`] SIMP_ORBITS_POINTS_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)])THEN DISCH_TAC +THEN POP_ASSUM(fun th->GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[th]) + THEN REWRITE_TAC[IN_ELIM_THM;] THEN STRIP_TAC + THEN ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(ARITH_RULE`(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))>1 \/ ~((CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)))> 1)`) +THENL(*1*)[ + MP_TAC(ARITH_RULE`CARD(set_of_edge (v:real^3) V E)>1==> 0< CARD(set_of_edge v V E)`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN + MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`0:num`] w_dart_eq_wedge3_fan) + THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] + THEN + MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`i:num`] w_dart_eq_wedge3_fan) + THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC THEN ASM_REWRITE_TAC[wedge3_fan;INTER] + THEN POP_ASSUM(fun th -> REWRITE_TAC[]) + THEN POP_ASSUM(fun th -> REWRITE_TAC[]) + THEN POP_ASSUM MP_TAC + THEN POP_ASSUM MP_TAC + THEN POP_ASSUM MP_TAC THEN DISJ_CASES_TAC(ARITH_RULE`i:num =0 \/ SUC(0) <= i`) +THENL(*2*)[ +ASM_REWRITE_TAC[power_map_points];(*2*) + +DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[if_azims_fan] THEN +MP_TAC(ARITH_RULE`CARD(set_of_edge (v:real^3) V E)>1==> ~(SUC 0= CARD(set_of_edge v V E))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN +MP_TAC(ARITH_RULE`i ~(i= CARD(set_of_edge v V E))`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] + THEN MP_TAC(ARITH_RULE`SUC 0<= i ==> i:num = SUC 0 \/ SUC(0) < i`) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THENL(*3*)[ +ASM_REWRITE_TAC[EMPTY;EXTENSION;IN_ELIM_THM] THEN GEN_TAC THEN REAL_ARITH_TAC;(*3*) + + MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`;` (v:real^3)`] remark1_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +DISJ_CASES_TAC(SET_RULE`set_of_edge (v:real^3) V E ={w} \/ ~(set_of_edge (v:real^3) V E ={w})`) +THENL(*4*)[ +MP_TAC(ISPECL[`w:real^3`;`set_of_edge (v:real^3) V E`]CARD_SING) THEN ASM_REWRITE_TAC[] THEN +POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) THEN REPEAT(POP_ASSUM MP_TAC) THEN ARITH_TAC;(*4*) + +MP_TAC(ISPECL[`i:num`;`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`SUC (0):num`] AZIM_LE_POWER_SIGMA_FAN) + THEN ASM_REWRITE_TAC[] THEN ASM_REWRITE_TAC[EMPTY;EXTENSION;IN_ELIM_THM] THEN REAL_ARITH_TAC]]]; + +POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") THEN DISCH_TAC THEN +MP_TAC(ARITH_RULE`~(CARD(set_of_edge (v:real^3) V E)>1) /\ (i < CARD(set_of_edge v V E)) +==> (i:num =0)`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[power_map_points]]);; + + +let disjoint_fan3=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3). +FAN(x,V,E)/\ ({v,w}IN E) +==>aff{x,v} INTER aff_gt {x,v} {w}={}`, +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`;` (v:real^3)`] remark1_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN DISJ_CASES_TAC(SET_RULE`aff{(x:real^3),(v:real^3)} INTER aff_gt {x,v} {(w:real^3)}={} \/ (?(u:real^3). u IN aff{x,v} INTER aff_gt {x,v} {w})`) + THENL[ +ASM_SET_TAC[]; + +POP_ASSUM MP_TAC THEN STRIP_TAC THEN POP_ASSUM MP_TAC +THEN + MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GT_2_1) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`]affine_hull_2_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"a") THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;] + THEN STRIP_TAC +THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v = t1' % x + t2' % v + t3 % w <=> t3 % w = (t1 - t1') % x + (t2 -t2') % v`] + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM(th);REAL_ARITH`a+b+c=d+e <=> c = (d-a)+ (e-b)`]) +THEN DISCH_TAC THEN MP_TAC(REAL_ARITH`&0 < (t3:real) ==> ~(t3= &0)`) + THEN ASM_REWRITE_TAC[]THEN DISCH_TAC + THEN MP_TAC(ISPEC`t3:real`REAL_MUL_LINV) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN DISCH_TAC + THEN MP_TAC(SET_RULE` (t3:real) = (t1- t1') + (t2-t2') ==> (inv t3) *(t3:real) = (inv t3) * ((t1- t1')+ (t2-t2'))`) + THEN ASM_REWRITE_TAC[REAL_ARITH`a*(b+c)= a *b + a*c`] THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) + THEN DISCH_TAC THEN DISCH_TAC + THEN MP_TAC(SET_RULE` (t3:real) % w= (t1- t1') % (x:real^3) + (t2-t2') % v ==> (inv t3) % ((t3:real)% w) = (inv t3) % ((t1- t1') %x+ (t2-t2') % v)`) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`m% (n% p)=a%(b % x + c % v)<=> (m*n) %p = (a *b)%x + (a*c)% v`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) + THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(SYM(th))) THEN REWRITE_TAC[VECTOR_ARITH`&1 %w=w`] + THEN DISCH_TAC + THEN SUBGOAL_THEN`w IN aff{(x:real^3),v}` ASSUME_TAC +THENL[ +REMOVE_THEN"a"(fun th-> REWRITE_TAC[th;IN_ELIM_THM]) THEN EXISTS_TAC`inv t3 * (t1-t1')` THEN EXISTS_TAC`inv t3 * (t2-t2')` + THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM(fun th-> REWRITE_TAC[th]); +ASM_SET_TAC[]]]);; + + +let remark3_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (w1:real^3). +FAN(x,V,E)/\ ({v,w}IN E) /\ ({v,w1}IN E) /\ ~(w=w1) +==> + aff_gt{x,v} {w} INTER + aff_gt {x,v} {w1}={}`, +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w1:real^3)`] properties_of_set_of_edge_fan) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`] ORBITS_EQ_SET_EDGE_FAN) + THEN ASM_REWRITE_TAC[] THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`] SIMP_ORBITS_POINTS_FAN) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)])THEN DISCH_TAC +THEN POP_ASSUM(fun th->GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[th]) + THEN REWRITE_TAC[IN_ELIM_THM;] THEN STRIP_TAC + THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN DISJ_CASES_TAC(ARITH_RULE`i:num =0 \/ 0 < i`) +THENL[ +ASM_REWRITE_TAC[power_map_points]; + + MP_TAC(ARITH_RULE`i ~(i= CARD(set_of_edge v V E)) /\ ~(0=CARD(set_of_edge (v:real^3) V E))`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`i:num`] wedge_fan2_equal_aff_gt_fan) + THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`0:num`] wedge_fan2_equal_aff_gt_fan) + THEN ASM_REWRITE_TAC[power_map_points] THEN DISCH_TAC THEN DISCH_TAC + THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) + THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) + + THEN ASM_REWRITE_TAC[wedge2_fan;if_azims_fan;power_map_points;INTER;IN_ELIM_THM;AZIM_REFL;] + THEN DISCH_TAC THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)]) + THEN DISJ_CASES_TAC(REAL_ARITH`azim x v w w1 = &0 \/ ~(azim x v w w1 = &0)`) +THENL[ + MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`w1:real^3`] UNIQUE_AZIM_0_POINT_FAN) + THEN ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[EMPTY;EXTENSION;IN_ELIM_THM] THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC]]);; + + + + + +(* (!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 w:real^3 w1:real^3. +a IN a_node_fan x V E (x,v,w,w1)==>(?n. a=(x,v,(power_map_points sigma_fan x V E v w n),(power_map_points sigma_fan x V E v w (SUC n))))) + +/\ *) + +let VBTIKLP=prove(`(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3). +FAN(x,V,E)/\ ({v,u}IN E) +==> + (UNIV:real^3->bool) = aff {x,v} UNION (UNIONS {w_dart_fan x V E (x,v,w,(sigma_fan x V E v w))|w| {v,w} IN E }) +UNION + (UNIONS {aff_gt {x,v} {w} |w| {v,w} IN E} )) +/\ +(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3). +FAN(x,V,E)/\ ({v,w}IN E) +==> + w_dart_fan x V E (x,v,w,(sigma_fan x V E v w)) INTER aff {x,v}={}) +/\ +(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (w1:real^3). +FAN(x,V,E)/\ ({v,w}IN E) /\ ({v,w1}IN E) +==> + w_dart_fan x V E (x,v,w,(sigma_fan x V E v w)) INTER + (aff_gt {x,v} {w1})={}) +/\ +(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (w1:real^3). +FAN(x,V,E)/\ ({v,w}IN E) /\ ({v,w1}IN E) /\ ~(w=w1) +==> + w_dart_fan x V E (x,v,w,(sigma_fan x V E v w)) INTER + w_dart_fan x V E (x,v,w1,(sigma_fan x V E v w1))={}) +/\ +(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (w1:real^3). +FAN(x,V,E)/\ ({v,w}IN E) /\ ({v,w1}IN E) /\ ~(w=w1) +==> + aff_gt{x,v} {w} INTER + aff_gt {x,v} {w1}={}) +/\ (!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3). +FAN(x,V,E)/\ ({v,w}IN E) +==>aff{x,v} INTER aff_gt {x,v} {w}={}) +`, +MESON_TAC[UNION1_FAN;disjoint_set_fan;disjoint_fan1;disjoint_fan2;remark3_fan;disjoint_fan3]);; + +(*lemma62*) + + +(*******************[cor:W]*************************) + + + +let disjiont_union_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (w1:real^3). +FAN(x,V,E)/\ ({v,w}IN E) /\ ({v,w1}IN E) +==> + w_dart_fan x V E (x,v,w,(sigma_fan x V E v w)) INTER + (aff{x,v} UNION aff_gt {x,v} {w1})={}`, + +REPEAT STRIP_TAC THEN REWRITE_TAC[UNION_OVER_INTER] + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;` (w1:real^3)`] disjoint_set_fan) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;] disjoint_fan1) THEN ASM_REWRITE_TAC[] + THEN ASM_SET_TAC[]);; + + +let aff_ge_subset_aff_gt_union_aff=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3). +FAN(x,V,E)/\ {v,w} IN E +==> +aff_ge {x} {v , w} SUBSET (aff_gt {x , v} {w}) UNION (aff {x, v})`, + +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`;` (v:real^3)`] remark1_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GE_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GT_2_1) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`]affine_hull_2_fan) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[SUBSET; UNION;IN_ELIM_THM] + THEN GEN_TAC THEN +REWRITE_TAC[REAL_ARITH `(&0 <= (t3:real)) <=> (&0 < t3) \/ ( t3 = &0)`; TAUT `(a \/ b) /\ (c \/ d) /\ e /\ f <=> ((a \/ b)/\ c /\ e /\ f) \/ ((a \/ b) /\ d /\ e /\ f)`; EXISTS_OR_THM] THEN +MATCH_MP_TAC MONO_OR THEN +SUBGOAL_THEN `((?t1:real t2:real t3:real. + (&0 < t2 \/ t2 = &0) /\ + &0< t3 /\ + t1 + t2 + t3 = &1 /\ + (x':real^3) = t1 % x + t2 % v + t3 % w) + ==> (?t1 t2 t3. + &0< t3 /\ t1 + t2 + t3 = &1 /\ x' = t1 % x + t2 % v + t3 % w))` ASSUME_TAC +THENL +[MESON_TAC[]; + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC MONO_EXISTS THEN GEN_TAC THEN MATCH_MP_TAC MONO_EXISTS THEN GEN_TAC THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN GEN_TAC THEN + REWRITE_TAC[REAL_ARITH `(&0< (t2:real) \/ (t2 = &0)) <=> ( &0<= t2)`] THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC [REAL_ARITH `(a:real)+ &0 = a`; VECTOR_ARITH `&0 % (w:real^3) = vec 0`; + VECTOR_ARITH ` ((x':real^3) = (t1:real) % (x:real^3) + (t2:real) % (v:real^3) + vec 0)<=> ( x' = t1 % x + t2 % v )` ] + THEN MESON_TAC[]]);; + + + + + + +let IBZWFFH=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (w1:real^3). +FAN(x,V,E)/\ ({v,w}IN E) /\ ({v,w1}IN E) +==> + w_dart_fan x V E (x,v,w,(sigma_fan x V E v w)) INTER +aff_ge {x} {v , w1}={}`, +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w1:real^3)`] aff_ge_subset_aff_gt_union_aff) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;`w:real^3`;` (w1:real^3)`] disjiont_union_fan) + THEN ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]);; + + + + + + + + + +(*---------------------------------------------------------------------------------*) +(* aff_ge {x} {v , w}) = (aff_ge {x , v} {w}) INTER (aff_ge {x , w} {v}) *) +(*---------------------------------------------------------------------------------*) + +let aff_ge_inter_aff_ge=prove(`!(x:real^3) (v:real^3) (w:real^3). +~collinear {x,v,w} +==> +aff_ge {x} {v , w} = aff_ge {x , v} {w} INTER aff_ge {x , w} {v}`, + + REPEAT STRIP_TAC THEN MRESA_TAC th3 [`x:real^3`;`v:real^3`;`w:real^3`] + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GE_1_2) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w:real^3`]AFF_GE_2_1) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`w:real^3`;`v:real^3`]AFF_GE_2_1) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;EXTENSION]THEN GEN_TAC THEN EQ_TAC +THENL(*1*)[ +STRIP_TAC THEN STRIP_TAC +THENL(*2*)[ + EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN EXISTS_TAC `t3:real` THEN ASM_MESON_TAC[]; +EXISTS_TAC `(t1:real)` THEN + EXISTS_TAC `(t3:real)` THEN EXISTS_TAC `(t2:real)` +THEN + ASM_MESON_TAC[REAL_ARITH `(t1:real)+ (t3:real) +(t2:real)=t1 + t2 + t3`;VECTOR_ARITH ` t1 % x + t2 % v + t3 % w = (t1:real) % (x:real^3) + (t3:real) % (w:real^3) + (t2:real) % (v:real^3)`]](*2*); + + STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC + THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(PATH_CONV "rrlr" o ONCE_DEPTH_CONV )[th] THEN ASSUME_TAC(th)) THEN POP_ASSUM MP_TAC + THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(PATH_CONV "rrlr" o ONCE_DEPTH_CONV )[SYM(th)] THEN ASSUME_TAC(th)) +THEN DISJ_CASES_TAC(SET_RULE`t3 - t2' = &0 \/ ~((t3:real) - (t2':real) = &0) `) +THENL[POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A-B= &0 <=> A=B`] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`t1':real` +THEN EXISTS_TAC`t3':real` +THEN EXISTS_TAC`t2':real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % w + t3' % v = t1' % x + t3' % v + t2' % w`; +REAL_ARITH`t1' + t3' + t2'=t1' + t2' + t3'`] +THEN ASM_TAC THEN REAL_ARITH_TAC; + +REWRITE_TAC[VECTOR_ARITH + `a % x + b % y + c % z= a1 % x + b1 % z + c1 % y <=> (c-b1) % z = (a1-a) % x + (c1-b)% y`] + THEN REWRITE_TAC[REAL_ARITH`a+b+c=a1+b1+c1<=> c1-b=(a-a1)+(c-b1)`] +THEN MRESA1_TAC REAL_MUL_LINV`t3 - t2'` + THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC +THEN MP_TAC(SET_RULE` +(t3 - t2') % w = (t1' - t1) % x + (t3' - t2) % v:real^3 +==> (inv (t3 - t2'))%((t3 - t2') % w ) = (inv (t3 - t2'))%((t1' - t1) % x + (t3' - t2) % v:real^3)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C= (A*B)%C`;VECTOR_ARITH`&1 %A=A`;VECTOR_ARITH`A%(B+C)=A%B+A%C`] THEN ASSUME_TAC(SYM(th))) +THEN STRIP_TAC +THEN SUBGOAL_THEN`w IN aff{(x:real^3),v}` ASSUME_TAC +THENL[REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM;] THEN EXISTS_TAC`inv(t3-t2') *(t1'-t1)` +THEN EXISTS_TAC`inv(t3-t2') *(t3'-t2)` THEN ASM_REWRITE_TAC[REAL_ARITH`A*B+A*C=A*(B+C)`]; + +ASM_SET_TAC[]]]]);; + + + + + + + +(*************JGIYDLE*******************) +(* rcone^0(x,v,h) *) + +let rcone_fan = new_definition `rcone_fan (x:real^3) (v:real^3) (h:real) = {y:real^3 | (y-x) dot (v-x) >(dist(y,x)*dist(v,x)*h)}`;; + + + + + +(*---------------------------------------------------------------------------------*) +(* aff_ge {x} {v , w} is closed *) +(*---------------------------------------------------------------------------------*) + + + + +let exp_aff_ge_by_dot=prove(`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u} +==> aff_ge {x,v} {u}={w:real^3| (w-x) dot (e2_fan x v u)= &0 /\ &0 <= (w-x) dot (e1_fan x v u) }`, +(let CROSS_LAGRANGE1 = prove + (`!x y z. (x cross y) cross z = (x dot z) % y - (z dot y) % x`, + VEC3_TAC) in + +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]th3) THEN RES_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]AFF_GE_2_1) THEN RESA_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]properties_coordinate) THEN RESA_TAC + THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC +THENL[ +STRIP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`(a % x + b +c) -x= (a- &1)% x + b + c `] THEN +REMOVE_ASSUM_TAC THEN SYM_ASSUM_TAC THEN REWRITE_TAC[VECTOR_ARITH`((a-(a+b+c)) % x + b % v +c % u)= b % (v-x) + c % (u-x)`] +THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL] + THEN REDUCE_ARITH_TAC + THEN ASM_MESON_TAC[REAL_LE_MUL] ; + +STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") + THEN DISCH_THEN(LABEL_TAC"b") +THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3)( v:real^3) (u:real^3)`; +`e3_fan (x:real^3) (v:real^3) (u:real^3)`;]ORTHONORMAL_IMP_SPANNING) THEN ASM_REWRITE_TAC[SPAN_3;EXTENSION] + THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(x':real^3)-(x:real^3)`th)) THEN REWRITE_TAC[SET_RULE`(a:real^3) IN (:real^3)`;IN_ELIM_THM] THEN RES_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL] + THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"c") + THEN FIND_ASSUM(MP_TAC)`orthonormal (e1_fan (x:real^3) (v:real^3) (u:real^3)) (e2_fan x v u) (e3_fan x v u)` + THEN REWRITE_TAC[orthonormal] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN ASM_REWRITE_TAC[DOT_SYM] + THEN REDUCE_ARITH_TAC + THEN DISCH_TAC THEN REMOVE_THEN "c" MP_TAC THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC THEN DISCH_THEN (LABEL_TAC"a") + THEN REMOVE_THEN "b" MP_TAC THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL;] THEN REWRITE_TAC[DOT_SYM] THEN ASM_REWRITE_TAC[] + THEN REDUCE_ARITH_TAC + THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC + THEN ASM_REWRITE_TAC[e1_fan;e2_fan;CROSS_LMUL;VECTOR_ARITH`a% b% v=(a*b)%v`;CROSS_LAGRANGE1] + THEN REDUCE_VECTOR_TAC THEN REWRITE_TAC[VECTOR_ARITH`a%(x- b % v)+ c % v=(c- a* b) % v+ a % x `; +e3_fan;VECTOR_ARITH`a% b% v=(a*b)%v`] + THEN STRIP_TAC THEN +EXISTS_TAC +`&1 - ((((w:real) - + ((u':real) * inv (norm (inv (norm ((v:real^3) - (x:real^3))) % (v - x) cross ((u:real^3) - x)))) * + (inv (norm (v - x)) % (v - x) dot (u - x))) * + inv (norm (v - x)))+ +((u':real) * inv (norm (e3_fan (x:real^3) (v:real^3) (u:real^3) cross (u - x)))))` + THEN EXISTS_TAC +`(((w:real) - + ((u':real) * inv (norm (inv (norm ((v:real^3) - (x:real^3))) % (v - x) cross ((u:real^3) - x)))) * + (inv (norm (v - x)) % (v - x) dot (u - x))) * + inv (norm (v - x)))` + THEN EXISTS_TAC +` ((u':real) * inv (norm (e3_fan (x:real^3) (v:real^3) (u:real^3) cross (u - x))))` +THEN +STRIP_TAC +THENL[ + +SUBGOAL_THEN `~(collinear {vec 0, v-x, u-x})==> ~((e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3))= vec 0)` ASSUME_TAC +THENL[ + MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[e3_fan;CROSS_LMUL] +THEN DISCH_TAC THEN MP_TAC(ISPECL [`v:real^3`; `x:real^3`] imp_inv_norm_not_zero_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL [`inv(norm((v:real^3)-(x:real^3)))`; `((v:real^3) -(x:real^3)) cross ((u:real^3)-(x:real^3))`; `(vec 0):real^3`] VECTOR_MUL_LCANCEL_IMP) +THEN ASM_REWRITE_TAC[VECTOR_MUL_RZERO;CROSS_EQ_0 ]; + +POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM COLLINEAR_3] +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{a,b,c}={b,a,c}`] THEN RED_TAC +THEN +MP_TAC(ISPECL [`(e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3))`; `((vec 0):real^3)`] imp_norm_ge_zero_fan) + THEN REDUCE_VECTOR_TAC THEN RES_TAC THEN +MP_TAC(ISPECL[`u':real`;`inv (norm ((e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3))))`] +REAL_LE_MUL) THEN RES_TAC THEN POP_ASSUM MATCH_MP_TAC THEN POP_ASSUM MP_TAC + THEN REAL_ARITH_TAC]; + +STRIP_TAC THENL[REAL_ARITH_TAC; +REWRITE_TAC[e3_fan] THEN POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC]]]));; + + + + +let closed_aff_ge_2_1=prove(`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u} +==> +closed (aff_ge {x,v} {u})`, +(let lemma=prove(`!x:real^3 v:real^3 u:real^3. +{w:real^3| (w-x) dot (e2_fan x v u)= &0 /\ &0 <= (w-x) dot (e1_fan x v u) } +={w:real^3| (w-x) dot (e2_fan x v u)= &0} INTER {w:real^3| (w-x) dot (e1_fan x v u) >= &0 }`, +REWRITE_TAC[INTER; IN_ELIM_THM;REAL_ARITH`&0<=a <=> a >= &0`]) in +( +let lemma1=prove(`!x:real^3 v:real^3 u:real^3. +closed {w:real^3| (w-x) dot (e2_fan x v u)= &0}`, +REWRITE_TAC[ DOT_SYM] THEN REWRITE_TAC[DOT_RSUB;REAL_ARITH`a-b= &0<=> a=b`;] + THEN REPEAT GEN_TAC THEN MP_TAC(ISPECL[`e2_fan (x:real^3) (v:real^3) (u:real^3)`; +` e2_fan (x:real^3) (v:real^3) (u:real^3) dot x`]CLOSED_HYPERPLANE) THEN ASM_SET_TAC[]) in + ( +let lemma2=prove(`!x:real^3 v:real^3 u:real^3. +closed {w:real^3| (w-x) dot (e1_fan x v u) >= &0 }`, +REWRITE_TAC[ DOT_SYM] THEN REWRITE_TAC[DOT_RSUB;REAL_ARITH`a-b>= &0<=> a>=b`;] + THEN REPEAT GEN_TAC THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`; +` e1_fan (x:real^3) (v:real^3) (u:real^3) dot x`]CLOSED_HALFSPACE_GE) THEN ASM_SET_TAC[]) in + +REPEAT STRIP_TAC THEN +ASM_MESON_TAC[exp_aff_ge_by_dot;lemma;lemma1;lemma2;CLOSED_INTER]))));; + + + + + +let closed_aff_ge_1_2=prove(`!(x:real^3) (v:real^3) (w:real^3). +~collinear {x, v, w} +==> +closed (aff_ge {x} {v , w})`, +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC (th) THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] THEN ASSUME_TAC(th)) +THEN MRESA_TAC aff_ge_inter_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC closed_aff_ge_2_1[`x:real^3`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC closed_aff_ge_2_1[`x:real^3`;`v:real^3`;`w:real^3`] +THEN ASM_MESON_TAC[CLOSED_INTER]);; + + +(*--------------------------------------------------------------------------------------------*) +(* closed_halfline_fan closed aff_ge {x} {v} *) +(*--------------------------------------------------------------------------------------------*) + +let AFF_GE_1_1=prove(`!x:real^3 v:real^3. +~(x=v) +==> aff_ge {x} {v} = {y:real^3 | ?t1:real t2:real. (&0 <= t2 ) /\ (t1 + t2 = &1) /\ (y = t1 % x + t2 % v )}`, +(let lemma=prove(`!x v. ~(x=v) <=> DISJOINT {x} {v} `, + +REWRITE_TAC[DISJOINT; INTER; IN_SING; EXTENSION; EMPTY; IN_ELIM_THM] THEN ASM_SET_TAC[]) in + +REWRITE_TAC[lemma] THEN AFF_TAC));; + + +let exp_aff_ge_by_dot_1_1=prove(`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u} +==> +aff_ge {x} {v}={w:real^3| (w-x) dot (e2_fan x v u)= &0 /\ &0 <= (w-x) dot (e3_fan x v u) +/\ (w-x) dot (e1_fan x v u)= &0 }`, + +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]th3) + THEN RES_TAC THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`]AFF_GE_1_1) THEN RESA_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]properties_coordinate) THEN RESA_TAC + THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC +THENL[ +STRIP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`(a % x + b) -x= (a- &1)% x + b `] +THEN +REMOVE_ASSUM_TAC THEN SYM_ASSUM_TAC THEN REWRITE_TAC[VECTOR_ARITH`((a-(a+b)) % x + b % v)= b % (v-x)`] +THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL] + THEN REDUCE_ARITH_TAC THEN POP_ASSUM MP_TAC + THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM(th)])`dist (v,x) % e3_fan x v u = v- x:real^3` + THEN REWRITE_TAC[DOT_LMUL] + THEN FIND_ASSUM(MP_TAC)`orthonormal (e1_fan (x:real^3) (v:real^3) (u:real^3)) (e2_fan x v u) (e3_fan x v u)` + THEN REWRITE_TAC[orthonormal] THEN RESA_TAC THEN REDUCE_ARITH_TAC THEN MP_TAC(ISPECL[`v:real^3`;`x:real^3`]DIST_POS_LE) + THEN MESON_TAC[REAL_LE_MUL]; + +STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") + THEN DISCH_THEN(LABEL_TAC"b") THEN DISCH_THEN (LABEL_TAC "c") +THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3)( v:real^3) (u:real^3)`; +`e3_fan (x:real^3) (v:real^3) (u:real^3)`;]ORTHONORMAL_IMP_SPANNING) THEN ASM_REWRITE_TAC[SPAN_3;EXTENSION] + THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(x':real^3)-(x:real^3)`th)) THEN REWRITE_TAC[SET_RULE`(a:real^3) IN (:real^3)`;IN_ELIM_THM] THEN RES_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL] + THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"d") + THEN FIND_ASSUM(MP_TAC)`orthonormal (e1_fan (x:real^3) (v:real^3) (u:real^3)) (e2_fan x v u) (e3_fan x v u)` + THEN REWRITE_TAC[orthonormal] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN ASM_REWRITE_TAC[DOT_SYM] + THEN REDUCE_ARITH_TAC + THEN REMOVE_THEN "c" MP_TAC THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL] + THEN ASM_REWRITE_TAC[DOT_SYM] + THEN REDUCE_ARITH_TAC THEN DISCH_TAC + THEN DISCH_TAC THEN REMOVE_THEN "d" MP_TAC THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC + THEN DISCH_TAC + THEN REMOVE_THEN "b" MP_TAC THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL;] THEN REWRITE_TAC[DOT_SYM] THEN ASM_REWRITE_TAC[] + THEN REDUCE_ARITH_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[e3_fan;VECTOR_ARITH`a% b% v=(a*b)%v`; +VECTOR_ARITH`a-b=c %(v-b)<=> a= (&1-c) % b + c % v`] THEN DISCH_THEN (LABEL_TAC"a") + THEN STRIP_TAC THEN +EXISTS_TAC +`&1 - (w:real) * (inv (norm ((v:real^3) - (x:real^3))))` + THEN EXISTS_TAC +`(w:real) * (inv (norm ((v:real^3) - (x:real^3))))` +THEN +STRIP_TAC +THENL[ +MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_ge_zero_fan) THEN RES_TAC THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; +STRIP_TAC THENL[REAL_ARITH_TAC; +ASM_REWRITE_TAC[]]]]);; + + + + +let closed_halfline_fan=prove(`!(x:real^3) (v:real^3) (u:real^3). +~collinear {x,v,u} +==> +closed (aff_ge {x} { v})`, + + +(let lemma=prove(`!x v u :real^3. +{w:real^3| (w-x) dot (e2_fan x v u)= &0 /\ &0 <= (w-x) dot (e3_fan x v u) +/\ (w-x) dot (e1_fan x v u)= &0 }= {w:real^3| (w-x) dot (e2_fan x v u)= &0} INTER +({w:real^3| (w-x) dot (e1_fan x v u)= &0} INTER {w:real^3| &0 <= (w-x) dot (e3_fan x v u)})`, +REWRITE_TAC[INTER;IN_ELIM_THM] THEN ASM_SET_TAC[]) in + + +(let lemma1=prove(`!x:real^3 v:real^3 u:real^3. +closed {w:real^3| (w-x) dot (e2_fan x v u)= &0}`, +REWRITE_TAC[ DOT_SYM] THEN REWRITE_TAC[DOT_RSUB;REAL_ARITH`a-b= &0<=> a=b`;] + THEN REPEAT GEN_TAC THEN MP_TAC(ISPECL[`e2_fan (x:real^3) (v:real^3) (u:real^3)`; +` e2_fan (x:real^3) (v:real^3) (u:real^3) dot x`]CLOSED_HYPERPLANE) THEN ASM_SET_TAC[]) in + +(let lemma3=prove(`!x:real^3 v:real^3 u:real^3. +closed {w:real^3| (w-x) dot (e1_fan x v u)= &0}`, +REWRITE_TAC[ DOT_SYM] THEN REWRITE_TAC[DOT_RSUB;REAL_ARITH`a-b= &0<=> a=b`;] + THEN REPEAT GEN_TAC THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`; +` e1_fan (x:real^3) (v:real^3) (u:real^3) dot x`]CLOSED_HYPERPLANE) THEN ASM_SET_TAC[]) in + +(let lemma2=prove(`!x:real^3 v:real^3 u:real^3. +closed {w:real^3| &0 <= (w-x) dot (e3_fan x v u) }`, +REWRITE_TAC[ DOT_SYM] THEN REWRITE_TAC[DOT_RSUB;REAL_ARITH`&0 <= a-b<=> a>=b`;] + THEN REPEAT GEN_TAC THEN MP_TAC(ISPECL[`e3_fan (x:real^3) (v:real^3) (u:real^3)`; +` e3_fan (x:real^3) (v:real^3) (u:real^3) dot x`]CLOSED_HALFSPACE_GE) THEN ASM_SET_TAC[]) in +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`x:real^3`;` v:real^3`; `u:real^3`]exp_aff_ge_by_dot_1_1) + THEN REWRITE_TAC[lemma] +THEN RESA_TAC THEN ASSUME_TAC(ISPECL[`x:real^3`;` v:real^3`; `u:real^3`]lemma1) THEN ASSUME_TAC(ISPECL[`x:real^3`;` v:real^3`; `u:real^3`]lemma2) THEN ASSUME_TAC(ISPECL[`x:real^3`;` v:real^3`; `u:real^3`]lemma3) + THEN SUBGOAL_THEN`closed({w:real^3| (w-x) dot (e1_fan x v u)= &0} INTER {w:real^3| &0 <= (w-x) dot (e3_fan x v u)})` +ASSUME_TAC +THENL[ASM_MESON_TAC[CLOSED_INTER]; +ASM_MESON_TAC[CLOSED_INTER]])))));; + + + + +(*--------------------------------------------------------------------------------------------*) +(* The properties of ballnorm_fan (x:real^3)={y:real^3 | dist(x,y) = &1} *) +(*--------------------------------------------------------------------------------------------*) + + + + + +let ballnorm_fan=new_definition`ballnorm_fan (x:real^3)={y:real^3 | dist(x,y) = &1}`;; + + +let closed_ballnorm_fan=prove(`!x:real^3. closed (ballnorm_fan x)`, +GEN_TAC THEN REWRITE_TAC[ballnorm_fan] THEN +SUBGOAL_THEN `{y:real^3 | dist((x:real^3),(y:real^3)) = &1} = frontier( ball((x:real^3), &1))` ASSUME_TAC + THENL [ASSUME_TAC(REAL_ARITH `&0 < &1`) THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[frontier; CLOSURE_BALL; INTERIOR_OPEN; OPEN_BALL; + REAL_LT_IMP_LE] THEN + REWRITE_TAC[EXTENSION; IN_DIFF; IN_ELIM_THM; IN_BALL; IN_CBALL] THEN + REAL_ARITH_TAC; + ASM_REWRITE_TAC[] THEN MESON_TAC[FRONTIER_CLOSED]]);; + +let bounded_ballnorm_fan=prove(`!x:real^3 . bounded(ballnorm_fan x)`, +REPEAT GEN_TAC THEN REWRITE_TAC[ballnorm_fan;bounded] THEN + EXISTS_TAC `norm(x:real^3) + &1` THEN REWRITE_TAC[ dist; IN_ELIM_THM] + THEN GEN_TAC THEN STRIP_TAC THEN ASSUME_TAC(NORM_TRIANGLE_SUB) THEN +POP_ASSUM (MP_TAC o ISPECL [`(x':real^3)`; `(x:real^3)`] o INST_TYPE [`:real^3`,`:real^3`]) + THEN REWRITE_TAC[NORM_SUB] THEN ASM_REWRITE_TAC[]);; + +let bounded_ballnorm_fans=prove(`!x:real^3 v:real^3 w:real^3. bounded (aff_ge {x} {v, w} INTER ballnorm_fan x)`, +REPEAT GEN_TAC THEN ASSUME_TAC (bounded_ballnorm_fan) THEN +POP_ASSUM (MP_TAC o ISPEC `x:real^3`) THEN DISCH_TAC THEN +SUBGOAL_THEN `aff_ge {x} {(v:real^3), (w:real^3)} INTER ballnorm_fan x SUBSET ballnorm_fan (x:real^3)` ASSUME_TAC THENL +[ASM_SET_TAC[]; +ASM_MESON_TAC[BOUNDED_SUBSET ]]);; + + + +(*--------------------------------------------------------------------------------------------*) +(* The properties of sets in norm ball *) +(*--------------------------------------------------------------------------------------------*) + + + + +let closed_aff_ge_ballnorm_fan=prove(`!(x:real^3) (v:real^3) (w:real^3). +~collinear{x,v,w} +==> +closed (aff_ge {x} {v, w} INTER ballnorm_fan x)`, +ASM_MESON_TAC[closed_aff_ge_1_2; closed_ballnorm_fan;CLOSED_INTER]);; + + + + + +let compact_aff_ge_ballnorm_fan=prove(` +!(x:real^3) (v:real^3) (w:real^3). +~collinear{x,v,w} +==> +compact (aff_ge {x} {v, w} INTER ballnorm_fan x)`, +REPEAT GEN_TAC THEN DISCH_TAC THEN +SUBGOAL_THEN `closed (aff_ge {x} {v, w} INTER ballnorm_fan x)` ASSUME_TAC +THENL + [ASM_MESON_TAC[closed_aff_ge_ballnorm_fan]; + ASSUME_TAC(bounded_ballnorm_fans) + THEN + POP_ASSUM (MP_TAC o ISPECL [`x:real^3`; `v:real^3`; `w:real^3`]) THEN + ASM_MESON_TAC[BOUNDED_CLOSED_IMP_COMPACT ]]);; + + + + + + + +let closed_point_fan=prove(` +(!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u} +==> +closed (aff_ge {x} {v} INTER ballnorm_fan x) )`, +REPEAT GEN_TAC THEN DISCH_TAC THEN +SUBGOAL_THEN `closed (aff_ge {(x:real^3)} {(v:real^3)})` ASSUME_TAC THENL + [ASM_MESON_TAC[ closed_halfline_fan]; + SUBGOAL_THEN `closed (ballnorm_fan (x:real^3))` ASSUME_TAC THENL + [ASM_MESON_TAC[closed_ballnorm_fan]; + ASM_MESON_TAC[CLOSED_INTER]]]);; + + + +let exist_fan=prove(`(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (v1:real^3) (w1:real^3). + +FAN(x,V,E) /\ ~(v IN {v1,w1}) /\ {v1,w1} IN E /\ {v,w} IN E +==> +?h:real. +(&0 < h) +/\ +(!y1:real^3 y2:real^3. (y1 IN aff_ge {x} {v} INTER ballnorm_fan x) /\ y2 IN (aff_ge {x} {v1, w1} INTER ballnorm_fan x) +==> h <= dist(y1,y2) ))`, +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +` (v:real^3)`] remark1_fan) +THEN RES_TAC +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +` (v1:real^3)`] remark1_fan) +THEN RES_TAC +THEN MATCH_MP_TAC( ISPECL [`aff_ge {(x:real^3)} {(v:real^3)} INTER ballnorm_fan x`; + `aff_ge {(x:real^3)} {(v1:real^3), (w1:real^3)} INTER ballnorm_fan x`] SEPARATE_CLOSED_COMPACT) + THEN MP_TAC(ISPECL[`(x:real^3) `;` (v:real^3)`;` (w:real^3)`]closed_point_fan) +THEN RESA_TAC + THEN MP_TAC(ISPECL[`(x:real^3) `;` (v1:real^3)`;` (w1:real^3)`]compact_aff_ge_ballnorm_fan) THEN RESA_TAC + THEN FIND_ASSUM(MP_TAC)`FAN(x:real^3,V,E)` + THEN REWRITE_TAC[FAN;fan7] THEN STRIP_TAC + THEN POP_ASSUM(fun th-> MP_TAC(ISPECL[`{(v:real^3)}`;`{(v1:real^3),(w1:real^3)}`]th)) + THEN ASM_REWRITE_TAC[UNION; IN_ELIM_THM;] + THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[EXTENSION;] + THEN ASM_REWRITE_TAC[IN_SING; SET_RULE`(!x. x = v <=> x = v') <=> v =v'`;SET_RULE`(?v'. v' IN V /\ v = v')<=> v IN V`] + THEN SUBGOAL_THEN `{v:real^3} INTER {v1,w1} ={}` ASSUME_TAC +THENL[ +REWRITE_TAC[INTER;IN_SING; EXTENSION; EMPTY; IN_ELIM_THM] THEN ASM_SET_TAC[]; + +ASM_REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL; SET_RULE`(A INTER C) INTER (B INTER C)= (A INTER B) INTER C`;] +THEN ASSUME_TAC(AFFINE_SING) THEN MP_TAC(ISPEC`{ (x:real^3) }` AFFINE_HULL_EQ ) + THEN RESA_TAC THEN RESA_TAC THEN REWRITE_TAC[ballnorm_fan;INTER; IN_SING; EXTENSION;EMPTY;IN_ELIM_THM; +] THEN GEN_TAC THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[DIST_REFL ] THEN REAL_ARITH_TAC]);; + + + + + + + + + + + + + + + +let ballsets_fan=new_definition`ballsets_fan (s:real^3->bool) (h:real)= {y:real^3| ?x:real^3. dist(x,y) < h /\ x IN s} `;; + + +let exists_ballsets_fan =prove( +`(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (v1:real^3) (w1:real^3). +FAN(x,V,E) /\ ~(v IN {v1,w1}) /\ {v1,w1} IN E /\ {v,w} IN E +==> +?h:real. +(&0 < h) +/\ (ballsets_fan (aff_ge {x} {v} INTER ballnorm_fan x) h INTER (aff_ge {x} {v1, w1} INTER ballnorm_fan x) = {}) +)`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;` (v1:real^3)`;` (w1:real^3)`] exist_fan) THEN RES_TAC + THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[ballsets_fan; INTER; IN_ELIM_THM] + THEN DISCH_TAC THEN EXISTS_TAC`h:real` + THEN ASM_REWRITE_TAC[EXTENSION;IN_ELIM_THM;] THEN GEN_TAC THEN EQ_TAC +THENL[ + POP_ASSUM MP_TAC + THEN DISCH_THEN(LABEL_TAC"a") + THEN STRIP_TAC THEN REMOVE_THEN "a"(fun th-> MP_TAC(ISPECL[`x'':real^3`;`x':real^3`]th)) +THEN ASM_REWRITE_TAC[EMPTY;IN_ELIM_THM] THEN REPEAT (POP_ASSUM MP_TAC) + THEN REAL_ARITH_TAC; +REWRITE_TAC[EMPTY;IN_ELIM_THM]]);; + + + + +(*-------------------------------------------------------------------------------------------*) +(* cone_ge_fan_inter_aff_ge_is_empty *) +(*-------------------------------------------------------------------------------------------*) + + + +let cone_ge_fan=new_definition`cone_ge_fan (x:real^3) (s:real^3->bool)= {y:real^3| ?a:real z:real^3. (&0 <= a)/\(z IN s) /\ (y =a % (z - x) + x)}`;; + + + + + +let cone_ge_fan_inter_aff_ge_is_empty=prove( +`(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (v1:real^3) (w1:real^3). +FAN(x,V,E) /\ ~(v IN {v1,w1}) /\ {v1,w1} IN E /\ {v,w} IN E +==> + +?h:real. +(h > &0) +/\ (cone_ge_fan x ((ballsets_fan (aff_ge {x} {v} INTER ballnorm_fan x) h)INTER ballnorm_fan x ) INTER aff_ge {x} {v1, w1} = {x}) +)`, + +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`; +`(v:real^3)`] remark1_fan) + THEN RES_TAC +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`; +`(v1:real^3)`] remark1_fan) + THEN RES_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`; +`(w:real^3)`;` (v1:real^3)`;` (w1:real^3)`] exists_ballsets_fan) +THEN ASM_REWRITE_TAC[] + THEN MATCH_MP_TAC MONO_EXISTS +THEN GEN_TAC THEN STRIP_TAC THEN STRIP_TAC +THENL(*1*)[ + +ASM_REWRITE_TAC[REAL_ARITH`a> &0 <=> &0< a`];(*1*) + REWRITE_TAC [cone_ge_fan; EXTENSION; IN_SING; INTER; IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC +THENL(*2*)[ + ASM_CASES_TAC `(x':real^3)=(x:real^3)` +THENL(*3*)[ASM_REWRITE_TAC[];(*3*) + MP_TAC (ISPECL [`x':real^3`; `x:real^3`] imp_norm_not_zero_fan) + THEN RES_TAC THEN STRIP_TAC THEN + POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "a") + THEN REPEAT STRIP_TAC + THEN ASM_REWRITE_TAC[] + THEN ABBREV_TAC `(x1:real^3)= inv (norm ((x':real^3)-(x:real^3))) % (x'-x) + x` + THEN SUBGOAL_THEN `(x1:real^3) IN ballnorm_fan (x:real^3)` ASSUME_TAC +THENL(*4*)[ REWRITE_TAC[ballnorm_fan; IN_ELIM_THM] + THEN EXPAND_TAC "x1" + THEN REWRITE_TAC[dist] + THEN REWRITE_TAC[VECTOR_ARITH `(x:real^3)-((a:real^3)+(x:real^3))= --(a)`; VECTOR_ARITH `-- ((a:real)% (v:real^3))=(-- a) % v`; NORM_MUL;REAL_ABS_NEG; REAL_ABS_INV; REAL_ABS_NORM] + THEN USE_THEN "a" MP_TAC + THEN MP_TAC(ISPEC `norm ((x':real^3)-(x:real^3))` REAL_MUL_LINV) + THEN ASM_MESON_TAC[];(*4*) + SUBGOAL_THEN `(x1:real^3) IN aff_ge {(x:real^3)} {(v1:real^3),(w1:real^3)}` ASSUME_TAC +THENL(*5*)[REMOVE_THEN "a" MP_TAC THEN +MP_TAC(ISPECL[`x:real^3`;`v1:real^3`;`w1:real^3`]AFF_GE_1_2) THEN RESA_TAC + THEN REWRITE_TAC[IN_ELIM_THM] + THEN STRIP_TAC THEN + EXISTS_TAC `&1 - inv (norm((x':real^3)-(x:real^3))) + inv (norm (x' - x)) * (t1:real) ` + THEN EXISTS_TAC `inv (norm((x':real^3)-(x:real^3))) * (t2:real) ` + THEN EXISTS_TAC `inv (norm((x':real^3)-(x:real^3))) * (t3:real) ` + THEN EXPAND_TAC "x1" + THEN REWRITE_TAC[VECTOR_ARITH`((a:real)-(b:real)+(c:real))%(v:real^3)=(a:real) % v -(b:real)% v+(c:real) %(v:real^3)`; +VECTOR_ARITH `&1 % (x:real^3)=x`; VECTOR_ARITH `((a:real)*(b:real)) % (v:real^3)= (a % (b % v))`; +VECTOR_ARITH `(x - inv (norm (x' - x)) % x + inv (norm (x' - x)) % t1 % x) + + inv (norm (x' - x)) % t2 % v1 + + inv (norm (x' - x)) % t3 % w1 =(inv (norm ((x':real^3)- x))) % ( t1 % x + t2 % v1+ t3% w1 -x)+ (x:real^3)` + +] + THEN STRIP_TAC +THENL(*6*)[SUBGOAL_THEN `&0 <= inv (norm ((x':real^3)-(x:real^3))) ` ASSUME_TAC +THENL(*7*)[ MATCH_MP_TAC REAL_LE_INV + THEN MESON_TAC[NORM_POS_LE];(*7*) + ASM_MESON_TAC[REAL_LE_MUL]](*7*);(*6*) + +STRIP_TAC +THENL(*7*)[ SUBGOAL_THEN `&0 <= inv (norm ((x':real^3)-(x:real^3))) ` ASSUME_TAC +THENL(*8*)[ MATCH_MP_TAC REAL_LE_INV + THEN MESON_TAC[NORM_POS_LE];(*8*) + ASM_MESON_TAC[REAL_LE_MUL; REAL_ARITH `(a:real)>= &0 <=> &0 <= a`]](*8*);(*7*) + +REWRITE_TAC[REAL_ARITH `(&1 - inv (norm (x' - x)) + inv (norm (x' - x)) * t1) + + inv (norm (x' - x)) * t2 + + inv (norm (x' - x)) * t3= &1 - inv (norm (x' - x)) + inv (norm (x' - x)) * (t1 + t2 + t3)`] + THEN STRIP_TAC +THENL(*8*)[ +ASM_REWRITE_TAC[] THEN REWRITE_TAC[REAL_ARITH `(a:real) * &1 = a`; REAL_ARITH `&1 - (a:real) +(a:real) = &1`];(*8*) + +SUBGOAL_THEN `(x':real^3) -(x:real^3)= (t1:real) % (x:real^3) + (t2:real) % (v1:real^3) + (t3:real) % (w1:real^3) -(x:real^3)` ASSUME_TAC +THENL(*9*)[ ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC;(*9*) + SUBGOAL_THEN `inv (norm ((x':real^3) -(x:real^3)) ) % ((x':real^3) -(x:real^3)) = inv (norm ((x':real^3) -(x:real^3)) ) % ((t1:real) % (x:real^3) + (t2:real) % (v1:real^3) + (t3:real) % (w1:real^3) -(x:real^3))` ASSUME_TAC +THENL(*10*)[ASM_MESON_TAC[ VECTOR_MUL_LCANCEL ];(*10*) +ASM_MESON_TAC[]](*10*)](*9*)](*8*)](*7*)](*6*); (*5*) + +SUBGOAL_THEN `(x1:real^3) IN ballsets_fan (aff_ge {(x:real^3)} {(v:real^3)} INTER ballnorm_fan x) (h:real)` ASSUME_TAC +THENL(*6*)[ + SUBGOAL_THEN `norm ((z:real^3)-(x:real^3))= &1` ASSUME_TAC +THENL(*7*)[FIND_ASSUM(MP_TAC)`z IN ballnorm_fan (x:real^3)` + THEN REWRITE_TAC[ballnorm_fan; IN_ELIM_THM; dist; NORM_SUB];(*7*) + POP_ASSUM MP_TAC + THEN DISCH_THEN (LABEL_TAC "k") + THEN SUBGOAL_THEN `(x':real^3)- (x:real^3)= (a:real) % ((z:real^3)-x )` ASSUME_TAC +THENL(*8*)[ FIND_ASSUM(MP_TAC)`x'=a %(z-x) +x:real^3` THEN VECTOR_ARITH_TAC;(*8*) + +SUBGOAL_THEN `norm((x':real^3)- (x:real^3))= norm((a:real) % ((z:real^3)-x ))` ASSUME_TAC +THENL(*9*)[ASM_SET_TAC[];(*9*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NORM_MUL] +THEN POP_ASSUM MP_TAC + THEN USE_THEN "k" (fun th -> REWRITE_TAC[th]) + THEN REDUCE_ARITH_TAC + THEN SUBGOAL_THEN `abs (a:real)=a`ASSUME_TAC + THENL(*10*)[FIND_ASSUM(MP_TAC)`&0 <= a:real` THEN REAL_ARITH_TAC;(*10*) +POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN DISCH_THEN(LABEL_TAC"l") + THEN DISCH_THEN (LABEL_TAC "n") + THEN REMOVE_THEN "l" MP_TAC THEN USE_THEN "n" (fun th-> REWRITE_TAC[SYM th]) + THEN DISCH_THEN (LABEL_TAC "l") + THEN SUBGOAL_THEN `(inv (norm (x'- x))) % ((x':real^3)- (x:real^3)) = (inv (norm (x' - x))) % (norm (x' - x) % ((z:real^3)- x ))` ASSUME_TAC +THENL(*11*)[POP_ASSUM MP_TAC THEN MESON_TAC[];(*11*) + POP_ASSUM MP_TAC + THEN REWRITE_TAC[VECTOR_ARITH `(a:real)%(b:real)%(v:real^3)=(a*b)%v`] + THEN MP_TAC(ISPEC`norm((x':real^3)-(x:real^3))`REAL_MUL_LINV) + THEN FIND_ASSUM(fun th ->REWRITE_TAC[th]) `~(norm((x':real^3)-(x:real^3))= &0)` + THEN DISCH_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN REDUCE_VECTOR_TAC + THEN REWRITE_TAC[VECTOR_ARITH `((a:real^3)=(z:real^3)-(x:real^3))<=>(a+x=z)`] + THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`inv (norm (x' - x)) % (x' - x) + x = x1:real^3` + THEN DISCH_TAC THEN ASM_REWRITE_TAC[INTER]](*11*)](*10*)](*9*)](*8*)](*7*);(*6*) +ASM_SET_TAC[]](*6*)](*5*)](*4*)](*3*);(*2*) + +STRIP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC +THENL(*2*)[ EXISTS_TAC `&0` THEN EXISTS_TAC`inv (norm ((v:real^3)-(x:real^3))) % (v-x) + x` THEN REDUCE_VECTOR_TAC + THEN STRIP_TAC +THENL(*3*)[ REAL_ARITH_TAC;(*3*) + STRIP_TAC +THENL(*4*)[ REWRITE_TAC[ballsets_fan; IN_ELIM_THM] + THEN EXISTS_TAC `inv(norm((v:real^3)-(x:real^3))) % (v-x)+x` + THEN REWRITE_TAC[dist; VECTOR_ARITH `(a)-a= vec 0`; NORM_0] + THEN STRIP_TAC +THENL(*5*)[ ASM_SET_TAC[];(*5*) + +STRIP_TAC +THENL(*6*)[ +MP_TAC(ISPECL[`x:real^3`;`v:real^3`]AFF_GE_1_1) THEN RESA_TAC + THEN REWRITE_TAC[IN_ELIM_THM] + THEN EXISTS_TAC `&1 - inv (norm ((v:real^3)-(x:real^3)))` + THEN EXISTS_TAC `inv (norm ((v:real^3)-(x:real^3)))` + THEN STRIP_TAC +THENL(*7*)[ + MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_ge_zero_fan) THEN RES_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*7*) +STRIP_TAC +THENL(*8*)[ REAL_ARITH_TAC;(*8*) +VECTOR_ARITH_TAC](*8*)](*7*);(*6*) + + REWRITE_TAC[ballnorm_fan; IN_ELIM_THM; dist; VECTOR_ARITH `(x:real^3)-((a:real^3)+(x:real^3))= --a`; NORM_NEG; NORM_MUL ] + THEN SUBGOAL_THEN `inv(norm((v:real^3)-(x:real^3))) > &0 ` ASSUME_TAC +THENL(*7*)[MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_gl_zero_fan) THEN RESA_TAC;(*7*) + +SUBGOAL_THEN `abs(inv(norm((v:real^3)-(x:real^3))))=inv(norm((v:real^3)-(x:real^3)))` ASSUME_TAC +THENL(*8*)[ASM_REWRITE_TAC[REAL_ABS_REFL] THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*8*) + +POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN SUBGOAL_THEN `~ (norm ((v:real^3)-(x:real^3))= &0)` ASSUME_TAC +THENL(*9*)[MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_not_zero_fan) THEN RESA_TAC;(*9*) + POP_ASSUM MP_TAC THEN MESON_TAC[REAL_MUL_RINV;REAL_MUL_SYM]](*9*)](*8*)](*7*)](*6*)](*5*);(*4*) +REWRITE_TAC[ballnorm_fan; IN_ELIM_THM; dist; VECTOR_ARITH `(x:real^3)-((a:real^3)+(x:real^3))= --a`; NORM_NEG; NORM_MUL ] + THEN SUBGOAL_THEN `inv(norm((v:real^3)-(x:real^3))) > &0 ` ASSUME_TAC +THENL(*5*)[ MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_gl_zero_fan) THEN RESA_TAC;(*5*) + SUBGOAL_THEN `abs(inv(norm((v:real^3)-(x:real^3))))=inv(norm((v:real^3)-(x:real^3)))` ASSUME_TAC +THENL(*6*)[ASM_REWRITE_TAC[REAL_ABS_REFL] THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*6*) +POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN SUBGOAL_THEN `~ (norm ((v:real^3)-(x:real^3))= &0)` ASSUME_TAC +THENL(*7*)[ MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_not_zero_fan) THEN RESA_TAC;(*7*) + POP_ASSUM MP_TAC THEN MESON_TAC[REAL_MUL_RINV;REAL_MUL_SYM]](*7*)](*6*)](*5*)](*4*)](*3*);(*2*) + +MP_TAC(ISPECL[`x:real^3`;`v1:real^3`;`w1:real^3`]AFF_GE_1_2) THEN RESA_TAC THEN REWRITE_TAC[IN_ELIM_THM] +THEN +EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0` + THEN STRIP_TAC THENL [REAL_ARITH_TAC; STRIP_TAC THENL [REAL_ARITH_TAC; STRIP_TAC THENL [REAL_ARITH_TAC; VECTOR_ARITH_TAC]]]]]]);; + + +let subset_by_inequality_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (v1:real^3) (w1:real^3) (h:real) (h1:real). +FAN(x,V,E) /\ ~(v IN {v1,w1}) /\ {v1,w1} IN E /\ {v,w} IN E /\ h < h1 +==> + cone_ge_fan x ((ballsets_fan (aff_ge {x} {v} INTER ballnorm_fan x) h)INTER ballnorm_fan x ) INTER aff_ge {x} {v1, w1} SUBSET cone_ge_fan x ((ballsets_fan (aff_ge {x} {v} INTER ballnorm_fan x) h1)INTER ballnorm_fan x ) INTER aff_ge {x} {v1, w1} +`, +REPEAT STRIP_TAC +THEN SUBGOAL_THEN` cone_ge_fan x ((ballsets_fan (aff_ge {x} {v} INTER ballnorm_fan x) h)INTER ballnorm_fan x) SUBSET cone_ge_fan x ((ballsets_fan (aff_ge {x} {v} INTER ballnorm_fan x) h1)INTER ballnorm_fan x ) ` ASSUME_TAC +THENL[ +REWRITE_TAC[cone_ge_fan; SUBSET;IN_ELIM_THM] +THEN GEN_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`a:real` +THEN EXISTS_TAC`z:real^3` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM (fun th-> REWRITE_TAC[]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ballsets_fan;INTER; IN_ELIM_THM] +THEN RESA_TAC +THEN EXISTS_TAC`x'':real^3` +THEN ASM_REWRITE_TAC[] +THEN REPEAT (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; +ASM_SET_TAC[]]);; + + + +let cone_ge_fan_inter_aff_ge_is_empty_fan=prove( `(!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (v1:real^3) (w1:real^3). +FAN(x,V,E) /\ ~(v IN {v1,w1}) /\ {v1,w1} IN E /\ {v,w} IN E +==> + +?h:real. +(&1> h) +/\ (h > &0) +/\ (cone_ge_fan x ((ballsets_fan (aff_ge {x} {v} INTER ballnorm_fan x) h)INTER ballnorm_fan x ) INTER aff_ge {x} {v1, w1} SUBSET {x}) +)`, + +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `; +`(w:real^3) `;`(v1:real^3)`;` (w1:real^3)`]cone_ge_fan_inter_aff_ge_is_empty) +THEN RESA_TAC +THEN DISJ_CASES_TAC(REAL_ARITH `(h >= &1) \/ (&1 > h)` ) +THENL[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `; +`(w:real^3) `;`(v1:real^3)`;` (w1:real^3)`; `&1/ &2`; `(h:real)`]subset_by_inequality_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`h>= &1==> &1 / &2 bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) h:real. +FAN(x,V,E) /\ {v,w} IN E /\(&0< h) /\ (h< &1) +==> +?h1:real. +&1 > h1 /\ +h1> &0 /\ +(rcone_fan x v h1) SUBSET cone_ge_fan x ((ballsets_fan (aff_ge {x} {v} INTER ballnorm_fan x) h)INTER ballnorm_fan x )`, + +REWRITE_TAC[rcone_fan;cone_ge_fan; SUBSET;IN_ELIM_THM;dist] + THEN REPEAT STRIP_TAC + THEN EXISTS_TAC`(&2 -(h:real) pow 2)/ &2` +THEN STRIP_TAC +THENL[ +REWRITE_TAC[REAL_ARITH`&1 > (&2 -(h:real) pow 2)/ &2 <=> h pow 2> &0`] +THEN MP_TAC (ISPECL[`h:real`;`2`]REAL_POW_LT) +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +STRIP_TAC +THENL[ +REWRITE_TAC[REAL_ARITH`(&2 -h pow 2)/ &2> &0<=> &2 > h pow 2`] +THEN MATCH_MP_TAC(REAL_ARITH` h pow 2<= &1 ==> &2 > h pow 2`) +THEN MATCH_MP_TAC (ISPECL[`2`;`h:real`;]REAL_POW_1_LE) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + + REPEAT STRIP_TAC + THEN EXISTS_TAC `norm ((x':real^3)-(x:real^3))` + THEN EXISTS_TAC `inv(norm ((x':real^3)-(x:real^3)))%(x'-x)+x` + THEN REWRITE_TAC[NORM_POS_LE] + THEN POP_ASSUM MP_TAC + THEN DISJ_CASES_TAC(SET_RULE`((x':real^3)-(x:real^3)= vec 0) \/ ~((x':real^3)-(x:real^3)= vec 0)`) +THENL(*1*)[ + +ASM_REWRITE_TAC[NORM_0;DOT_LZERO;] THEN REDUCE_ARITH_TAC THEN REAL_ARITH_TAC;(*1*) + +REWRITE_TAC[VECTOR_ARITH`(A+B)-B=A:real^3`;VECTOR_MUL_ASSOC] + THEN MP_TAC(ISPEC`x':real^3- x`NORM_EQ_0) + THEN RESA_TAC + THEN MP_TAC(ISPEC`norm(x':real^3- x)`REAL_MUL_LINV) + THEN ASM_REWRITE_TAC[REAL_MUL_SYM] + THEN RESA_TAC + THEN REDUCE_VECTOR_TAC + THEN REWRITE_TAC[VECTOR_ARITH`A-B+B=A:real^3`] + THEN SUBGOAL_THEN` inv (norm (x' - x)) % (x' - x) + x IN ballnorm_fan (x:real^3)` ASSUME_TAC +THENL(*2*)[ + REWRITE_TAC[ballnorm_fan; IN_ELIM_THM; dist; VECTOR_ARITH `(x:real^3)-((a:real^3)+(x:real^3))= --a`; NORM_NEG; NORM_MUL ] + THEN MP_TAC(ISPECL[`x':real^3`;`x:real^3`]imp_norm_ge_zero_fan) + THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[VECTOR_ARITH`(a:real^3)=b <=> a - b = vec 0`] + THEN RESA_TAC + THEN MP_TAC(ISPEC`inv(norm((x':real^3)-(x:real^3)))`REAL_ABS_REFL) + THEN GEN_REWRITE_TAC( LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[REAL_ARITH`&0<= (a:real) <=> a >= &0`] + THEN RESA_TAC;(*2*) + +STRIP_TAC + THEN SUBGOAL_THEN` inv (norm (x' - x)) % (x' - x) + x IN ballsets_fan (aff_ge {x} {v} INTER ballnorm_fan (x:real^3)) (h:real)` ASSUME_TAC +THENL(*3*)[ + +REWRITE_TAC[ballsets_fan;IN_ELIM_THM;dist] + THEN EXISTS_TAC`inv (norm (v - x)) % (v - x) + (x:real^3)` + THEN STRIP_TAC +THENL(*4*)[ + +REWRITE_TAC[VECTOR_ARITH`((v:real^3)+b)-(u+b)= (v-u)`;] + THEN SUBGOAL_THEN`norm(inv(norm(v-x))%(v:real^3-x)-inv(norm(x'-x))%(x'-x)) pow 2< h pow 2` ASSUME_TAC +THENL(*5*)[ +REWRITE_TAC[NORM_POW_2;DOT_LSUB;DOT_RSUB] +THEN REWRITE_TAC[DOT_RMUL;DOT_LMUL;DOT_SQUARE_NORM; REAL_ARITH`a-b-(c-d)=a+d-b-c`; +REAL_ARITH`a*a*b pow 2=(a*b) pow 2`;DOT_SYM;REAL_ARITH`a+b-e*d*c-d*e*c=a+b- &2 * d*e *c`] +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(w:real^3)`; +`(v:real^3)`;] remark1_fan) +THEN RES_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;`(v:real^3)`;] imp_norm_not_zero_fan) +THEN REWRITE_TAC[NORM_SUB] + THEN RES_TAC + THEN MP_TAC(ISPEC`norm(v:real^3- x)`REAL_MUL_LINV) +THEN RES_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 pow 2= &1`; +REAL_ARITH`&1+ &1 - &2 * a< h pow 2 <=> a > (&2- h pow 2)/ &2`] +THEN MP_TAC (ISPEC `(v:real^3)-(x:real^3)` NORM_POS_LE) + THEN DISCH_TAC +THEN SUBGOAL_THEN `norm((v:real^3)-(x:real^3))> &0` ASSUME_TAC +THENL(*6*)[ + +REPEAT( POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC;(*6*) + + MP_TAC (ISPEC `(x':real^3)-(x:real^3)` NORM_POS_LE) + THEN DISCH_TAC +THEN SUBGOAL_THEN ` norm((x:real^3)-(x':real^3))> &0 ` ASSUME_TAC +THENL(*7*)[ + +ONCE_REWRITE_TAC[NORM_ARITH`norm (x:real^3- x')> &0 <=> norm(x'-x)> &0`] +THEN REPEAT( POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC;(*7*) + +MP_TAC(ISPECL[`(&2 - (h:real) pow 2) / &2`; +`inv (norm (x:real^3 - x')) * inv (norm (v - x)) * ((v - x) dot (x' - x))`; +`norm (x:real^3 - x')`]REAL_LT_LMUL_EQ) +THEN REWRITE_TAC[REAL_ARITH`a b>a`] +THEN POP_ASSUM(fun th->REWRITE_TAC[th]) +THEN POP_ASSUM(fun th->REWRITE_TAC[]) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`(A<=>B)<=>(B<=>A)`] +THEN DISCH_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[th]) +THEN MP_TAC(ISPECL[`norm (x:real^3 - x') * (&2 - (h:real) pow 2) / &2`; +`norm (x:real^3 - x')*inv (norm (x:real^3 - x')) * inv (norm (v - x)) * ((v - x) dot (x' - x))`; +`norm (v:real^3 - x)`]REAL_LT_LMUL_EQ) +THEN REWRITE_TAC[REAL_ARITH`a b>a`] +THEN POP_ASSUM(fun th->REWRITE_TAC[th]) +THEN POP_ASSUM(fun th->REWRITE_TAC[]) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`(A<=>B)<=>(B<=>A)`] +THEN DISCH_TAC +THEN POP_ASSUM(fun th->REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*B*C*D*E>a*b*c<=>(C*B)*(D*A)*E>b*c*a`] +THEN ONCE_REWRITE_TAC[NORM_ARITH`norm (x:real^3- x')= norm(x'-x)`] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN GEN_REWRITE_TAC(RAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[NORM_SUB] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[DOT_SYM] +THEN ASM_REWRITE_TAC[]](*7*)](*6*)(*5*); + +ASM_REWRITE_TAC[NORM_LT_SQUARE;DOT_SQUARE_NORM]](*5*);(*4*) + + +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(w:real^3)`; +`(v:real^3)`;] remark1_fan) +THEN RES_TAC +THEN +SUBGOAL_THEN`inv(norm(v-x:real^3)) % (v-x) +x IN aff_ge {x} {v}` ASSUME_TAC +THENL(*5*)[ +MP_TAC(ISPECL[`x:real^3`;`v:real^3`]AFF_GE_1_1) THEN RESA_TAC + THEN REWRITE_TAC[IN_ELIM_THM] + THEN EXISTS_TAC `&1 - inv (norm ((v:real^3)-(x:real^3)))` + THEN EXISTS_TAC `inv (norm ((v:real^3)-(x:real^3)))` + THEN STRIP_TAC +THENL(*6*)[ + + + MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_ge_zero_fan) THEN RES_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;(*6*) +STRIP_TAC +THENL(*7*)[ + REAL_ARITH_TAC; +VECTOR_ARITH_TAC]](*6*);(*5*) + +SUBGOAL_THEN` inv (norm (v- x)) % (v - x) + x IN ballnorm_fan (x:real^3)` ASSUME_TAC +THENL(*6*)[ + REWRITE_TAC[ballnorm_fan; IN_ELIM_THM; dist; VECTOR_ARITH `(x:real^3)-((a:real^3)+(x:real^3))= --a`; NORM_NEG; NORM_MUL ] + THEN MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_ge_zero_fan) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`v-x=vec 0<=> v=x`] + + THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[VECTOR_ARITH`(a:real^3)=b <=> a - b = vec 0`] + THEN RESA_TAC + THEN MP_TAC(ISPEC`inv(norm((v:real^3)-(x:real^3)))`REAL_ABS_REFL) + THEN GEN_REWRITE_TAC( LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[REAL_ARITH`&0<= (a:real) <=> a >= &0`] + THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;`(v:real^3)`;] imp_norm_not_zero_fan) +THEN REWRITE_TAC[NORM_SUB] + THEN RES_TAC + THEN MP_TAC(ISPEC`norm(v:real^3- x)`REAL_MUL_LINV) +THEN RES_TAC +THEN ASM_REWRITE_TAC[];(*6*) +ASM_SET_TAC[]](*6*)](*5*)](*4*);(*3*) +ASM_SET_TAC[]]]]]]);; + + + + + + + + + + +let origin_not_in_rcone_fan=prove(`!(x:real^3) (v:real^3) (h:real). ~(x IN rcone_fan x v h)`, +REPEAT GEN_TAC +THEN REWRITE_TAC[rcone_fan; IN_ELIM_THM; VECTOR_ARITH`x-x= vec 0`; DOT_LZERO;DIST_REFL] +THEN REDUCE_ARITH_TAC +THEN REAL_ARITH_TAC);; + + + +let inter_is_empty=prove(` +!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (v1:real^3) (w1:real^3). +FAN(x,V,E) /\ ~(v IN {v1,w1}) /\ {v1,w1} IN E /\ {v,w} IN E +==> +?h1:real. +&1 > h1 /\ +h1> &0 /\ +rcone_fan x v h1 INTER aff_ge {x} {v1, w1} = {} +`, +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`; `(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3) ` +;`(w:real^3)`;` (v1:real^3) `;`(w1:real^3)`]cone_ge_fan_inter_aff_ge_is_empty_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`(v:real^3)`; +`(w:real^3)`;` h:real`]rcone_subset_cone) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`&0 h> &0`; REAL_ARITH`h< &1 <=> &1 >h`] +THEN RES_TAC +THEN SUBGOAL_THEN`(rcone_fan x v h1 INTER aff_ge {x} {v1, w1}) SUBSET + {x:real^3}` ASSUME_TAC +THENL[ +ASM_SET_TAC[]; +MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (h1:real)`]origin_not_in_rcone_fan) +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`h1:real` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SUBSET; IN_SING;EXTENSION;EMPTY] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ + POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"a") +THEN DISCH_TAC +THEN DISCH_TAC +THEN REMOVE_THEN "a" (fun th->MP_TAC(ISPEC`x':real^3`th)) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"a") +THEN DISCH_TAC +THEN REMOVE_THEN "a" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN SUBGOAL_THEN`x:real^3 IN rcone_fan x v h1` ASSUME_TAC +THENL[ASM_SET_TAC[]; +ASM_SET_TAC[]]; +ASM_SET_TAC[]]]);; + + +(* +W^0_{dart}(x,epsilon) +*) + +let rw_dart_fan= new_definition`rw_dart_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) ((y:real^3),(v:real^3),(w:real^3),(w1:real^3)) (h:real)= w_dart_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) ((y:real^3),(v:real^3),(w:real^3),(w1:real^3)) INTER rcone_fan x v h`;; + + + +let avoids_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (v1:real^3) (w1:real^3)(w2:real^3). +FAN(x,V,E) /\ ~(v IN {v1,w1}) /\ {v1,w1} IN E /\ {v,w} IN E +==> +?h:real. +&1 >h /\ +h> &0 +/\ rw_dart_fan x V E ((x:real^3),(v:real^3),(w:real^3),(w2:real^3)) h INTER aff_ge {x} {v1, w1} = {} +`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[rw_dart_fan] +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`;` (v1:real^3)` ;`(w1:real^3)`]inter_is_empty) +THEN RESA_TAC +THEN EXISTS_TAC`h1:real` +THEN ASM_SET_TAC[] + +);; + + +let avoids1_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (w1:real^3). +FAN(x,V,E) /\ {v,w} IN E /\ {v,w1} IN E +==> +?h:real. +&1 > h /\ +h > &0 /\ + rw_dart_fan x V E ((x:real^3),(v:real^3),(w:real^3),sigma_fan x V E v w) h INTER aff_ge {x} {v, w1} = {}`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[rw_dart_fan] +THEN MP_TAC(ISPECL[`(x:real^3) `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3)`; +` (w:real^3)`;`(w1:real^3)`]IBZWFFH) +THEN RESA_TAC +THEN EXISTS_TAC`&1/ &2` +THEN REWRITE_TAC[REAL_ARITH`&1/ &2 > &0`;REAL_ARITH`&1 > &1/ &2`] +THEN ASM_SET_TAC[]);; + + +let finish_avoids_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (v1:real^3) (w1:real^3). +FAN(x,V,E) /\ {v,w} IN E /\ {v1,w1} IN E +==> +?h:real. +&1 >h /\ +h> &0/\ +rw_dart_fan x V E ((x:real^3),(v:real^3),(w:real^3),sigma_fan x V E v w) h INTER aff_ge {x} {v1, w1} = {}`, + +REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(v:real^3 IN {v1,w1})\/ (v=v1\/ v=w1)`) +THENL[ +MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(w:real^3) `;`(v1:real^3)`;`w1:real^3`;` (sigma_fan x V E v w:real^3)`]avoids_fan) +THEN RESA_TAC +THEN ASM_SET_TAC[]; + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THENL[ +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN DISCH_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN POP_ASSUM( fun th-> REWRITE_TAC[SYM(th)]) +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(w:real^3) `;`w1:real^3`]avoids1_fan) +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN DISCH_TAC +THEN REMOVE_THEN "A" MP_TAC +THEN POP_ASSUM( fun th-> REWRITE_TAC[SYM(th)]) +THEN ONCE_REWRITE_TAC[SET_RULE`{X,Y}={Y,X}`] +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (v:real^3) `;`(w:real^3) `;`v1:real^3`]avoids1_fan) +THEN RESA_TAC]]);; + +let continuous_set_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) (h:real) (h1:real). +FAN(x,V,E) /\ {v,w} IN E /\ h1 <= h +==> +rw_dart_fan x V E ((x:real^3),(v:real^3),(w:real^3),sigma_fan x V E v w) h SUBSET rw_dart_fan x V E ((x:real^3),(v:real^3),(w:real^3),sigma_fan x V E v w) h1`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[rw_dart_fan] +THEN SUBGOAL_THEN `rcone_fan x v h SUBSET rcone_fan x v h1` ASSUME_TAC +THENL[ +REWRITE_TAC[rcone_fan;SUBSET; IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASSUME_TAC(ISPECL[`v:real^3`;`x:real^3`]DIST_POS_LE) +THEN ASSUME_TAC(ISPECL[`x':real^3`;`x:real^3`]DIST_POS_LE) +THEN MP_TAC(ISPECL[`dist((v:real^3),x)`;`h1:real`;`h:real`] REAL_LE_LMUL) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`dist((x':real^3),x)`;`dist((v:real^3),x)* (h1:real)`;`dist((v:real^3),x)* (h:real)`] REAL_LE_LMUL) +THEN RESA_TAC +THEN REPEAT (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; +ASM_SET_TAC[]]);; + + + + + + + + + +let CTVTAQA=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (E1:(real^3->bool)->bool). +FAN(x,V,E) /\ E1 SUBSET E +==> +FAN(x,V,E1)`, +REPEAT GEN_TAC +THEN REWRITE_TAC[FAN;fan1;fan2;fan6;fan7;graph] +THEN ASM_SET_TAC[]);; + + +let expand_edge_graph_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (e:real^3->bool). +FAN(x,V,E) /\ e IN E +==> ?v:real^3 w:real^3. e={v,w}`, +REPEAT GEN_TAC +THEN REWRITE_TAC[FAN;IN] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC `graph (E:(real^3->bool)->bool)` +THEN REWRITE_TAC[graph] +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`e:real^3->bool`th)) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[HAS_SIZE] +THEN STRIP_TAC +THEN SUBGOAL_THEN `~((e:real^3->bool)={})` ASSUME_TAC +THENL[ +STRIP_TAC +THEN MP_TAC(ISPEC`(e:real^3->bool)`CARD_EQ_0) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MP_TAC(SET_RULE `~((e:real^3->bool)={})==> ?v:real^3. v IN e`) +THEN RESA_TAC +THEN SUBGOAL_THEN`~((e:real^3->bool) DELETE v={})` ASSUME_TAC +THENL[ +STRIP_TAC +THEN MP_TAC(ISPECL[`v:real^3`;`(e:real^3->bool)`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(e:real^3->bool)`;`v:real^3`] FINITE_DELETE) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(e:real^3->bool) DELETE v`CARD_EQ_0) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MP_TAC(SET_RULE `~((e:real^3->bool)DELETE v={})==> ?w:real^3. w IN (e:real^3->bool)DELETE v/\ w IN e`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `(v IN (e:real^3->bool))/\ (w IN (e:real^3->bool))==> {v,w} SUBSET e`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `(w IN (e:real^3->bool)DELETE v)==> ~(v=w)`) +THEN RESA_TAC +THEN MP_TAC(ISPECL [`{v:real^3,w:real^3}`;`(e:(real^3->bool))`] FINITE_SUBSET) +THEN RESA_TAC +THEN ASSUME_TAC(SET_RULE `v:real^3 IN {v:real^3,w:real^3} `) +THEN MP_TAC(ISPECL[`v:real^3`;`{v:real^3,w:real^3}`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `v IN {v,w}==>{v:real^3,w:real^3} DELETE v PSUBSET {v,w}`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`{v:real^3,w:real^3} DELETE v`;`{v:real^3,w:real^3}`]CARD_PSUBSET) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`FINITE {v:real^3,w:real^3}` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN DISCH_TAC +THEN MP_TAC(ARITH_RULE`CARD ({v, w} DELETE v) < CARD {v, w}/\ CARD ({v, w} DELETE v) = CARD {v, w}-1 +<=>CARD ({v, w} DELETE v) +1= CARD {v:real^3, w:real^3}`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th;]) +THEN REWRITE_TAC[ARITH_RULE`A=A`] +THEN DISCH_TAC +THEN SUBGOAL_THEN `w:real^3 IN ({v:real^3,w:real^3} DELETE v)` ASSUME_TAC +THENL[ +ASM_SET_TAC[]; +MP_TAC(ISPECL[`{v:real^3,w:real^3}`;`v:real^3`] FINITE_DELETE) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`w:real^3`;`{v:real^3,w:real^3} DELETE v`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `w IN ({v,w} DELETE v)==>{v:real^3,w:real^3} DELETE v DELETE w PSUBSET {v,w} DELETE v`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`{v:real^3,w:real^3} DELETE v DELETE w`;`{v:real^3,w:real^3} DELETE v`]CARD_PSUBSET) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`FINITE ({v:real^3,w:real^3} DELETE v)` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN DISCH_TAC +THEN MP_TAC(ARITH_RULE`CARD ({v, w} DELETE v DELETE w) < CARD ({v, w} DELETE v)/\ CARD ({v, w} DELETE v DELETE w) = CARD ({v, w} DELETE v)-1 +<=>CARD ({v, w} DELETE v DELETE w) +1= CARD ({v:real^3, w:real^3} DELETE v)`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th;]) +THEN REWRITE_TAC[ARITH_RULE`A=A`] +THEN DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[]) +THEN POP_ASSUM (fun th->REWRITE_TAC[]) +THEN ASSUME_TAC(SET_RULE `{v, w} DELETE v:real^3 DELETE w:real^3={}`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th;CARD_CLAUSES; ARITH_RULE `0+1=1`]) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"B") +THEN DISCH_TAC +THEN REMOVE_THEN "B" MP_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th);ARITH_RULE` 1+1=2`]) +THEN FIND_ASSUM MP_TAC`CARD (e:real^3->bool)=2` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`{v:real^3,w:real^3}`;`e:real^3->bool`]CARD_SUBSET_EQ) +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) +THEN RESA_TAC +THEN EXISTS_TAC`v:real^3` +THEN EXISTS_TAC`w:real^3` +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)])]]]);; + + + + + +let finish_avoids1_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (E':(real^3->bool)->bool) (v:real^3) (w:real^3). +FAN(x,V,E) /\ {v,w} IN E /\ E' SUBSET E +==> +?h:real. +&1> h /\ +h> &0 /\ +rw_dart_fan x V E ((x:real^3),(v:real^3),(w:real^3),sigma_fan x V E v w) h INTER {v | ?e. e IN E' /\ v IN aff_ge {x} e}={}`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[xfan; IN_ELIM_THM] +THEN MP_TAC(ISPECL[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`]set_edges_is_finite_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL [`(E':(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`] FINITE_SUBSET) +THEN RESA_TAC +THEN ABBREV_TAC`n=CARD (E':(real^3->bool)->bool)` +THEN REPEAT(POP_ASSUM MP_TAC) +THEN SPEC_TAC (`(E':(real^3->bool)->bool)`,`(E':(real^3->bool)->bool)`) +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC +THENL(*1*)[ +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`E':(real^3->bool)->bool`]CARD_EQ_0) +THEN RESA_TAC +THEN EXISTS_TAC`&1 / &2` +THEN REWRITE_TAC[REAL_ARITH`&1/ &2 > &0`;REAL_ARITH`&1 > &1/ &2`] +THEN ASM_SET_TAC[];(*1*) + +REPEAT GEN_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC "A") +THEN REPEAT STRIP_TAC +THEN MP_TAC(ISPEC`(E':(real^3->bool)->bool)` CHOOSE_SUBSET) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`n:num `th)) +THEN REWRITE_TAC[ARITH_RULE `n:num <= SUC n`; HAS_SIZE] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE` t SUBSET E' /\ E' SUBSET E ==> (t:(real^3->bool)->bool) SUBSET E`) +THEN RESA_TAC +THEN REMOVE_THEN "A" (fun th-> MP_TAC(ISPEC`(t:(real^3->bool)->bool)`th)) +THEN RESA_TAC +THEN SUBGOAL_THEN `~((E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)= {})` ASSUME_TAC +THENL(*2*)[ +STRIP_TAC +THEN MP_TAC(SET_RULE`(E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)={} /\ t SUBSET E' ==> t= E'`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`CARD (t:(real^3->bool)->bool)=n` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC;(*2*) + +SUBGOAL_THEN`?e. e IN (E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)` +ASSUME_TAC +THENL(*3*)[ +ASM_SET_TAC[];(*3*) + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`e IN (E':(real^3->bool)->bool) DIFF (t:(real^3->bool)->bool)/\ +(E':(real^3->bool)->bool) SUBSET (E:(real^3->bool)->bool) /\ t SUBSET E' ==> e IN E'/\ e IN E/\ ~(e IN t) /\ {e} UNION t SUBSET E'`) +THEN RESA_TAC +THEN MP_TAC(ISPECL [`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;`(E':(real^3->bool)->bool)`] FINITE_SUBSET) +THEN RESA_TAC +THEN ASSUME_TAC(SET_RULE`e IN {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`) +THEN MP_TAC(ISPECL[`e:real^3->bool`;`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(SET_RULE `e IN {e:(real^3->bool)} UNION (t:(real^3->bool)->bool) +==> ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e PSUBSET {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))DELETE e`;`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`]CARD_PSUBSET) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`FINITE ( {e:(real^3->bool)} UNION (t:(real^3->bool)->bool))` +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN DISCH_TAC +THEN MP_TAC(ARITH_RULE`CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) < CARD ( {e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) +/\ CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) = CARD ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))-1 +<=>CARD (({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e) +1= CARD ({e:(real^3->bool)} UNION (t:(real^3->bool)->bool))`) +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th;]) +THEN REWRITE_TAC[ARITH_RULE`A=A`; ] +THEN MP_TAC(SET_RULE`~(e IN t)==>({e:(real^3->bool)} UNION (t:(real^3->bool)->bool)) DELETE e=t`) +THEN RESA_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`(CARD (E':(real^3->bool)->bool)=SUC n)` +THEN REWRITE_TAC[ARITH_RULE`SUC n=(n:num) +1`] +THEN DISCH_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`{e:(real^3->bool)} UNION (t:(real^3->bool)->bool)`;`E':(real^3->bool)->bool`]CARD_SUBSET_EQ) +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM(th)]) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MA") +THEN MP_TAC(ISPECL[`(x:real^3)`;` (V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(e:real^3->bool)`]expand_edge_graph_fan) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(w:real^3)`; `(v':real^3)`;` (w':real^3)`]finish_avoids_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN STRIP_TAC +THEN ABBREV_TAC`h1= max (h:real) (h':real)` +THEN EXISTS_TAC`h1:real` +THEN STRIP_TAC +THENL(*4*)[ +POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC;(*4*) + +STRIP_TAC +THENL(*5*)[ +POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]) +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC;(*5*) + +REMOVE_THEN "MA" MP_TAC +THEN DISCH_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) +THEN REWRITE_TAC[UNION;IN_ELIM_THM;EXTENSION; INTER;] +THEN GEN_TAC +THEN EQ_TAC +THENL(*6*)[ + +ASM_REWRITE_TAC[IN_SING] +THEN STRIP_TAC +THENL[ + POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)` ;`(h1:real)`;` (h':real)`]continuous_set_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"h1" +THEN REWRITE_TAC[REAL_ARITH`h'<= max (h:real) (h':real)`] +THEN RESA_TAC +THEN ASM_SET_TAC[]; + + POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN DISCH_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)` ;`(h1:real)`;` (h:real)`]continuous_set_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"h1" +THEN REWRITE_TAC[REAL_ARITH`h<= max (h:real) (h':real)`] +THEN RESA_TAC +THEN ASM_SET_TAC[]]; + +ASM_SET_TAC[]]]]]]]);; + + + + + + + +let rw_dart_avoids_fan=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3). +FAN(x,V,E) /\ {v,w} IN E +==> +?h:real. +&1> h /\ +h> &0 /\ +rw_dart_fan x V E ((x:real^3),(v:real^3),(w:real^3),sigma_fan x V E v w) h SUBSET yfan(x,V,E) `, + +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;` (w:real^3)`]finish_avoids1_fan) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`A SUBSET A`;yfan;xfan] +THEN RESA_TAC +THEN EXISTS_TAC`h:real` +THEN ASM_REWRITE_TAC[] +THEN ASM_SET_TAC[]);; + + + + + +(*------------------------------------------------------------------------*) +(*------------------------------------------------------------------------*) + + + +let r_fan=new_definition`r_fan (a:real) (b:real) (c:real) = { y:real^3 | y$1 > &0 /\ y$2 > a /\ y$2 < b /\ y$3 > &0 /\ y$3 < c}`;; + + + +let r1_le_fan=new_definition`r1_le_fan (a:real)={ y:real^3 | y$1 > a}`;; + + +let r2_le_fan=new_definition`r2_le_fan (a:real)={ y:real^3 | y$2 > a}`;; + + + +let r3_le_fan=new_definition`r3_le_fan (a:real)={ y:real^3 | y$3 > a}`;; + + + +let r1_ge_fan=new_definition`r1_ge_fan (a:real)={ y:real^3 | y$1 < a}`;; + + +let r2_ge_fan=new_definition`r2_ge_fan (a:real)={ y:real^3 | y$2 < a}`;; + +let r3_ge_fan=new_definition`r3_ge_fan (a:real)={ y:real^3 | y$3 < a}`;; + + + + +let r_fan_is_inter_halfspace=prove(`!a:real b:real c:real. +r_fan a b c = r1_le_fan (&0) INTER r2_le_fan a INTER r2_ge_fan b INTER r3_le_fan (&0) INTER r3_ge_fan c`, +REWRITE_TAC[r_fan; r1_le_fan; r2_le_fan; r2_ge_fan; r3_le_fan; r3_ge_fan; INTER; IN_ELIM_THM]);; + + + + + +let r1_ge_is_convex_fan = prove(`!a:real. convex (r1_ge_fan a)/\ open (r1_ge_fan a) `,REWRITE_TAC[r1_ge_fan] THEN REWRITE_TAC[CONVEX_HALFSPACE_COMPONENT_LT;OPEN_HALFSPACE_COMPONENT_LT]);; + + +let r2_ge_is_convex_fan = prove(`!a:real. convex (r2_ge_fan a)/\ open (r2_ge_fan a)`, +REWRITE_TAC[r2_ge_fan] THEN REWRITE_TAC[CONVEX_HALFSPACE_COMPONENT_LT;OPEN_HALFSPACE_COMPONENT_LT]);; + +let r3_ge_is_convex_fan = prove(`!a:real. convex (r3_ge_fan a) /\ open(r3_ge_fan a)`, +REWRITE_TAC[r3_ge_fan] THEN REWRITE_TAC[CONVEX_HALFSPACE_COMPONENT_LT;OPEN_HALFSPACE_COMPONENT_LT]);; + +let r1_le_is_convex_fan = prove(`!a:real. convex (r1_le_fan a)/\ open (r1_le_fan a) `, +REWRITE_TAC[r1_le_fan] THEN REWRITE_TAC[CONVEX_HALFSPACE_COMPONENT_GT;OPEN_HALFSPACE_COMPONENT_GT]);; + +let r2_le_is_convex_fan = prove(`!a:real. convex (r2_le_fan a)/\ open (r2_le_fan a) `, +REWRITE_TAC[r2_le_fan] THEN REWRITE_TAC[CONVEX_HALFSPACE_COMPONENT_GT;OPEN_HALFSPACE_COMPONENT_GT]);; + +let r3_le_is_convex_fan = prove(`!a:real. convex (r3_le_fan a)/\ open (r3_le_fan a) `, +REWRITE_TAC[r3_le_fan] THEN REWRITE_TAC[CONVEX_HALFSPACE_COMPONENT_GT;OPEN_HALFSPACE_COMPONENT_GT]);; + +let r_is_connected_fan=prove(`!a:real b:real c:real. connected (r_fan a b c)/\convex (r_fan a b c) /\ open (r_fan a b c)`, + (let lemma = prove(`!a:real b:real c:real. convex (r_fan a b c)/\ open (r_fan a b c)`, +ASSUME_TAC (r_fan_is_inter_halfspace) THEN ASM_REWRITE_TAC[] THEN +ASSUME_TAC (r1_ge_is_convex_fan) THEN ASSUME_TAC ( r2_ge_is_convex_fan) THEN +ASSUME_TAC (r3_ge_is_convex_fan) THEN ASSUME_TAC(r1_le_is_convex_fan) THEN +ASSUME_TAC(r2_le_is_convex_fan) THEN ASSUME_TAC( r3_le_is_convex_fan) THEN +ASM_MESON_TAC[CONVEX_INTER;OPEN_INTER]) + in +SUBGOAL_THEN `!a:real b:real c:real. convex (r_fan a b c)/\ open (r_fan a b c) ` ASSUME_TAC +THENL [MESON_TAC[lemma]; + ASM_MESON_TAC[CONVEX_CONNECTED]]));; + + + + +(*------------------------------------------------------------*) +(* change spherical coordinate in fan *) +(*------------------------------------------------------------*) + + + +let change_spherical_coordinate_fan= new_definition`change_spherical_coordinate_fan (x:real^3) (v:real^3) (u:real^3) = ((\t. let r = t$1 and theta = t$2 and phi = t$3 in + x +(r * cos theta * sin phi) % e1_fan x v u + + (r * sin theta * sin phi) % e2_fan x v u + + (r * cos phi) % e3_fan x v u):real^3->real^3) ` ;; + + + + + +(*---------------------------------------------------------------------------------------*) +(* the function of change coordinate is(spherecial) continuous *) +(*---------------------------------------------------------------------------------------*) + + +let REAL_CONTINUOUS_AT_COMPONENT = prove + (`!i a. 1 <= i /\ i <= dimindex(:N) + ==> (\x:real^N. x$i) real_continuous at a`, + REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1; o_DEF; + CONTINUOUS_AT_LIFT_COMPONENT]);; + + + let continuous_change_spherical_coordinate_fan = prove + (`!x':real^3 v:real^3 u:real^3 x:real^3. +((\t. let r = t$1 and theta = t$2 and phi = t$3 in + (r * cos theta * sin phi) % e1_fan x' v u + + (r * sin theta * sin phi) % e2_fan x' v u + + (r * cos phi) % e3_fan x' v u)) + continuous at x`, +REPEAT STRIP_TAC THEN +CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN + REPEAT(MATCH_MP_TAC CONTINUOUS_ADD THEN CONJ_TAC) THEN + MATCH_MP_TAC CONTINUOUS_VMUL THEN + REWRITE_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS1] THEN + REPEAT(MATCH_MP_TAC REAL_CONTINUOUS_MUL THEN CONJ_TAC) THEN + SIMP_TAC[REAL_CONTINUOUS_AT_COMPONENT; DIMINDEX_3; ARITH] THEN + MATCH_MP_TAC(REWRITE_RULE[o_DEF] REAL_CONTINUOUS_AT_COMPOSE) THEN + SIMP_TAC[REAL_CONTINUOUS_AT_COMPONENT; DIMINDEX_3; ARITH] THEN + REWRITE_TAC[REAL_CONTINUOUS_WITHIN_SIN; REAL_CONTINUOUS_WITHIN_COS]);; + + +let one_edge_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3. +FAN(x,V,E)/\ {v,u} IN E /\ ~(CARD (set_of_edge v V E) > 1) +==> set_of_edge v V E={u}`, +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool) `;`u:real^3 `;`v:real^3`]remark1_fan) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`(u:real^3) IN set_of_edge v V E==> ~(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)={})/\ {(u:real^3)} SUBSET set_of_edge v V E`) +THEN RESA_TAC +THEN MP_TAC(ISPECL [`{(u:real^3)}`;`set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)`] FINITE_SUBSET) +THEN RESA_TAC +THEN ASSUME_TAC(SET_RULE`u IN {(u:real^3)} /\ {(u:real^3)} DELETE u= {} /\ {} PSUBSET {(u:real^3)}`) +THEN MP_TAC(ISPECL[`(u:real^3)`;`{(u:real^3)}`;]CARD_DELETE) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`{}:real^3->bool`;`{(u:real^3)}`]CARD_PSUBSET) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CARD_CLAUSES] +THEN REPEAT DISCH_TAC +THEN MP_TAC(ARITH_RULE` 0 = CARD ({(u:real^3)}) - 1 /\ 0 < CARD ({u}) <=> 1= CARD {u}`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`~(CARD (set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) > 1)==> CARD (set_of_edge v V E) <= 1`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`{u:real^3}`;`set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)`]CARD_SUBSET_LE) +THEN ASM_SET_TAC[]);; + +(* +azim(x), x dart. +*) + + +let azim_fan=new_definition`azim_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (w:real^3) += if (CARD (set_of_edge v V E) > 1) then azim x v w (sigma_fan x V E v w) else &2* pi`;; + + + +let expand_elements_by_azim_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 x1:real x2:real x3:real. +FAN(x,V,E)/\ {v,u} IN E /\ &0 < x1 /\ &0<= x2 +/\ x2 < &2 * pi +/\ &0< x3 +/\ x3 < pi/ &2 +==> +azim x v u + (x + + (x1 * cos (x2) * sin (x3)) % e1_fan x v u + + (x1 * sin (x2) * sin (x3)) % e2_fan x v u + + (x1 * cos (x3)) % e3_fan x v u) = x2`, + +(let lem=prove(`!x v u. {x,v,u}= {x,u,v}`,SET_TAC[]) in + (let lem1=prove(`!x v u. {x,v,u}= {v,x,u}`,SET_TAC[]) in + +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3 `;`(V:real^3->bool) `; +`(E:(real^3->bool)->bool)`;` u:real^3`;` v:real^3`]remark1_fan) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`~collinear {(x:real^3),(v:real^3),(u:real^3)}` +THEN GEN_REWRITE_TAC( LAND_CONV o ONCE_DEPTH_CONV)[lem1] +THEN ONCE_REWRITE_TAC[COLLINEAR_3] +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]orthonormal_e1_e2_e3_fan) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MP_TAC(th) THEN ASSUME_TAC(th)) +THEN REWRITE_TAC[orthonormal] +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]properties_coordinate) +THEN RESA_TAC +THEN MP_TAC(ISPEC`x3:real`SIN_POS_PI2) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`(x + + (x1 * cos (x2) * sin (x3)) % e1_fan x v u + + (x1 * sin (x2) * sin (x3)) % e2_fan x v u + + (x1 * cos (x3)) % e3_fan (x:real^3) (v:real^3) (u:real^3))`; + `((u-x) dot (e3_fan (x:real^3) (v:real^3) (u:real^3))) *inv (norm((v:real^3)-(x:real^3)))`; + `(x1 * cos (x3)) * (inv (norm((v:real^3)-(x:real^3))))`; +`((u-x) dot (e1_fan (x:real^3) (v:real^3) (u:real^3)))`; +`x1 * sin (x3:real)`; +`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`;`&0`;`x2:real`]AZIM_UNIQUE) +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`&0+a=a`;] +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC REAL_LT_MUL +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +STRIP_TAC +THENL[ + +REWRITE_TAC[SIN_0;COS_0;VECTOR_ARITH`(A*B)%C=A%(B%C)`] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN ONCE_REWRITE_TAC[GSYM e3_fan] +THEN MATCH_MP_TAC(ISPECL[`e3_fan (x:real^3) (v:real^3) (u:real^3)`;`(u:real^3)-(x:real^3)`;` +((u - x) dot e1_fan x v u) % (e1_fan (x:real^3) (v:real^3) (u:real^3)) + + ((u - x) dot e3_fan x v u) % (e3_fan x v u)`]CROSS_DOT_CANCEL) +THEN ASM_REWRITE_TAC[DOT_RADD;DOT_RMUL;DOT_SYM] +THEN REDUCE_ARITH_TAC +THEN REWRITE_TAC[CROSS_RADD;CROSS_RMUL;CROSS_REFL] +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]ORTHONORMAL_CROSS) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[e1_fan] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE;e2_fan] +THEN REWRITE_TAC[VECTOR_ARITH`A%(B%C)=(B*A)%C`] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ONCE_REWRITE_TAC[GSYM DOT_RMUL] +THEN ONCE_REWRITE_TAC[GSYM e2_fan] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`&0<(e1_fan x v u cross e2_fan x v u) dot e3_fan (x:real^3) (v:real^3) (u:real^3)` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[DOT_RZERO] +THEN REAL_ARITH_TAC; +REWRITE_TAC[e3_fan] +THEN VECTOR_ARITH_TAC]])));; + + + + +let rw_dart_is_image_set_spherical_coordinate=prove(`(!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 h:real. +FAN(x,V,E)/\ {v,u} IN E/\ &0 + IMAGE (change_spherical_coordinate_fan x v u) +(r_fan (azim x v u u) (azim_fan x V E v u) h)= + rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) (cos(h))) `, +(let lem=prove(`!x v u. {x,v,u}= {x,u,v}`,ASM_SET_TAC[]) in +( let lem1=prove(`!x v u. {x,v,u}= {v,x,u}`,SET_TAC[]) in + +REWRITE_TAC[azim_fan;r_fan; rw_dart_fan; change_spherical_coordinate_fan;IMAGE;INTER; +w_dart_fan;rcone_fan;EXTENSION;IN_ELIM_THM] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3 `;`(V:real^3->bool) `; +`(E:(real^3->bool)->bool)`;` u:real^3`;` v:real^3`]remark1_fan) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`~collinear {(x:real^3),(v:real^3),(u:real^3)}` +THEN GEN_REWRITE_TAC( LAND_CONV o ONCE_DEPTH_CONV)[lem1] +THEN ONCE_REWRITE_TAC[COLLINEAR_3] +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]orthonormal_e1_e2_e3_fan) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MP_TAC(th) THEN ASSUME_TAC(th)) +THEN REWRITE_TAC[orthonormal] +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]properties_coordinate) +THEN RESA_TAC +THEN EQ_TAC +THENL(*1*)[ +STRIP_TAC +THEN MP_TAC(ISPEC`(x'':real^3)$3`SIN_POS_PI2) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A /\ B <=> B /\ A`] +THEN STRIP_TAC +THENL(*2*)[ + + + + +REWRITE_TAC[dist;vector_norm;VECTOR_ARITH`(A+B)-A=(B:real^3)`; DOT_LADD;DOT_RADD;DOT_RMUL;DOT_LMUL;] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN REWRITE_TAC[REAL_ARITH`((x'':real^3)$1 * cos (x''$2) * sin (x''$3)) * x''$1 * cos (x''$2) * sin (x''$3) + + (x''$1 * sin (x''$2) * sin (x''$3)) * x''$1 * sin (x''$2) * sin (x''$3) + + (x''$1 * cos (x''$3)) * x''$1 * cos (x''$3)=(x''$1 * x''$1)* (( sin (x''$2) pow 2 +(cos (x''$2) pow 2)) * (sin (x''$3) pow 2)+ cos (x''$3) pow 2)`] +THEN ASSUME_TAC(ISPEC`(x'':real^3)$2`SIN_CIRCLE) +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN ASSUME_TAC(ISPEC`(x'':real^3)$3`SIN_CIRCLE) +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN MP_TAC(ISPEC`(x'':real^3)$1`SQRT_POW_2) +THEN MP_TAC(REAL_ARITH`(x'':real^3)$1> &0==> &0 <= (x'':real^3)$1`) +THEN RESA_TAC +THEN RESA_TAC +THEN MP_TAC(ISPECL[`(x'':real^3)$1`;`(x'':real^3)$1`]SQRT_MUL) +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ARITH`A*(A:real)=A pow 2`] +THEN ASM_REWRITE_TAC[e3_fan;DOT_LMUL] +THEN ONCE_REWRITE_TAC[GSYM vector_norm;] +THEN ASSUME_TAC(ISPEC`(v:real^3)-(x:real^3)`DOT_SQUARE_NORM) +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[REAL_ARITH`(A*B)*C *D pow 2=A*D*B *(C*D)`] +THEN SUBGOAL_THEN`~(norm((v:real^3)-(x:real^3))= &0)` ASSUME_TAC +THENL(*3*)[ + +ASM_REWRITE_TAC[NORM_EQ_0;VECTOR_ARITH`v-x=vec 0<=> x=v`];(*3*) + +MP_TAC(ISPEC`norm((v:real^3)-(x:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN MP_TAC(ISPEC`((v:real^3)-(x:real^3))`NORM_POS_LT) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`v-x=vec 0<=> x=v`;REAL_ARITH`A>B<=> B A> &0`] +THEN MATCH_MP_TAC REAL_LT_LMUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC COS_MONO_LT +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC];(*2*) + + + +SUBGOAL_THEN`azim (x:real^3) (v:real^3) (u:real^3) + (x + + (x''$1 * cos (x''$2) * sin (x''$3)) % e1_fan x v u + + (x''$1 * sin (x''$2) * sin (x''$3)) % e2_fan x v u + + (x''$1 * cos (x''$3)) % e3_fan x v u)= (x'':real^3)$2 ` ASSUME_TAC +THENL(*3*)[ + +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`(x + + (x''$1 * cos (x''$2) * sin (x''$3)) % e1_fan x v u + + (x''$1 * sin (x''$2) * sin ((x'':real^3)$3)) % e2_fan x v u + + (x''$1 * cos (x''$3)) % e3_fan (x:real^3) (v:real^3) (u:real^3))`; + `((u-x) dot (e3_fan (x:real^3) (v:real^3) (u:real^3))) *inv (norm((v:real^3)-(x:real^3)))`; + `(x''$1 * cos ((x'':real^3)$3)) * (inv (norm((v:real^3)-(x:real^3))))`; +`((u-x) dot (e1_fan (x:real^3) (v:real^3) (u:real^3)))`; +`x''$1 * sin ((x'':real^3)$3)`; +`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`;`&0`;`(x'':real^3)$2`]AZIM_UNIQUE) +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`&0+a=a`;] +THEN STRIP_TAC +THENL(*4*)[ + +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;]AZIM_REFL) +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC;(*4*) + +STRIP_TAC +THENL(*5*)[ + +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)`] azim) +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC;(*5*) + +STRIP_TAC +THENL(*6*)[ + +MATCH_MP_TAC REAL_LT_MUL +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC;(*6*) + +STRIP_TAC +THENL(*7*)[ + +REWRITE_TAC[SIN_0;COS_0;VECTOR_ARITH`(A*B)%C=A%(B%C)`] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN ONCE_REWRITE_TAC[GSYM e3_fan] +THEN MATCH_MP_TAC(ISPECL[`e3_fan (x:real^3) (v:real^3) (u:real^3)`;`(u:real^3)-(x:real^3)`;` +((u - x) dot e1_fan x v u) % (e1_fan (x:real^3) (v:real^3) (u:real^3)) + + ((u - x) dot e3_fan x v u) % (e3_fan x v u)`]CROSS_DOT_CANCEL) +THEN ASM_REWRITE_TAC[DOT_RADD;DOT_RMUL;DOT_SYM] +THEN REDUCE_ARITH_TAC +THEN REWRITE_TAC[CROSS_RADD;CROSS_RMUL;CROSS_REFL] +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]ORTHONORMAL_CROSS) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[e1_fan] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE;e2_fan] +THEN REWRITE_TAC[VECTOR_ARITH`A%(B%C)=(B*A)%C`] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ONCE_REWRITE_TAC[GSYM DOT_RMUL] +THEN ONCE_REWRITE_TAC[GSYM e2_fan] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`&0<(e1_fan x v u cross e2_fan x v u) dot e3_fan (x:real^3) (v:real^3) (u:real^3)` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[DOT_RZERO] +THEN REAL_ARITH_TAC;(*7*) + +REWRITE_TAC[e3_fan] +THEN VECTOR_ARITH_TAC](*7*)](*6*)](*5*)](*4*);(*3*) + + + + +SUBGOAL_THEN`~collinear + {(x:real^3), (v:real^3), x + + (x''$1 * cos (x''$2) * sin (x''$3)) % e1_fan x v (u:real^3) + + (x''$1 * sin (x''$2) * sin ((x'':real^3)$3)) % e2_fan x v u + + (x''$1 * cos (x''$3)) % e3_fan x v u}`ASSUME_TAC +THENL(*4*)[ + +ONCE_REWRITE_TAC[lem] +THEN REWRITE_TAC[collinear1_fan] +THEN ASM_REWRITE_TAC[aff;AFFINE_HULL_2; IN_ELIM_THM; REAL_ARITH`A+B= &1<=>A= &1-B`] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[VECTOR_ARITH`A+B=(&1-c) % A+ c % D<=>B=c%(D-A)`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`((x''$1 * cos (x''$2) * sin (x''$3)) % e1_fan x v u + + (x''$1 * sin (x''$2) * sin (x''$3)) % e2_fan x v u + + (x''$1 * cos ((x'':real^3)$3)) % e3_fan x v (u:real^3)) dot e1_fan x v u = + ((v':real) % ((v:real^3) - (x:real^3))) dot e1_fan x v u` ASSUME_TAC +THENL(*5*)[ +ASM_REWRITE_TAC[];(*5*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[DOT_LADD;DOT_LMUL] +THEN ASM_REWRITE_TAC[DOT_SYM] +THEN REDUCE_ARITH_TAC +THEN SUBGOAL_THEN`((x''$1 * cos (x''$2) * sin (x''$3)) % e1_fan x v u + + (x''$1 * sin (x''$2) * sin (x''$3)) % e2_fan x v u + + (x''$1 * cos ((x'':real^3)$3)) % e3_fan x v (u:real^3)) dot e2_fan x v u = + ((v':real) % ((v:real^3) - (x:real^3))) dot e2_fan x v u` ASSUME_TAC +THENL(*6*)[ +ASM_REWRITE_TAC[];(*6*) + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[DOT_LADD;DOT_LMUL] +THEN ASM_REWRITE_TAC[DOT_SYM] +THEN REDUCE_ARITH_TAC +THEN REWRITE_TAC[REAL_ENTIRE] +THEN STRIP_TAC +THENL(*7*)[ + +REPEAT (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC;(*7*) + +STRIP_TAC +THENL(*8*)[ + +REPEAT (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC;(*8*) + + +MP_TAC(ISPEC`(x'':real^3)$2`SIN_CIRCLE) +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; + +REPEAT (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC]; + +REPEAT (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC](*7*)](*6*)](*5*);(*4*) + + +REPEAT(POP_ASSUM MP_TAC) +THEN DISJ_CASES_TAC(ARITH_RULE`CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))>1 +\/ ~(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) >1)`) +THENL(*5*)[ +ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[wedge;IN_ELIM_THM] +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC`(x'':real^3)$2 > azim (x:real^3) (v:real^3) u (u:real^3)` +THEN REWRITE_TAC[AZIM_REFL] +THEN REAL_ARITH_TAC;(*5*) + + +ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`]one_edge_fan) +THEN RESA_TAC +THEN REWRITE_TAC[DIFF;IN_ELIM_THM] +THEN STRIP_TAC +THENL(*6*)[ + +ASM_SET_TAC[];(*6*) + +STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`(x:real^3) + + (x''$1 * cos (x''$2) * sin ((x'':real^3)$3)) % e1_fan x (v:real^3) (u:real^3) + + (x''$1 * sin (x''$2) * sin (x''$3)) % e2_fan x v u + + (x''$1 * cos (x''$3)) % e3_fan x v u`]AZIM_EQ_0_GE_ALT) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;]AZIM_REFL) +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC](*6*)](*5*)](*4*)](*3*)](*2*);(*1*) + + + +ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN DISJ_CASES_TAC(ARITH_RULE`CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool))>1 +\/ ~(CARD(set_of_edge (v:real^3) (V:real^3->bool) (E:(real^3->bool)->bool)) >1)`) +THENL(*2*)[ +ASM_REWRITE_TAC[wedge;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN EXISTS_TAC`vector[(dist((x:real^3),(x':real^3)));(azim (x:real^3) (v:real^3) (u:real^3) (x':real^3));(arcV (x:real^3) (x':real^3) (v:real^3))]:real^3` +THEN ASM_REWRITE_TAC[VECTOR_3;AZIM_REFL;REAL_ARITH`A> &0 <=> &0 &0 < dist((x:real^3),(x':real^3))`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL(*4*)[ +STRIP_TAC +THENL(*5*)[ + +REWRITE_TAC[ARCV_ANGLE; angle;] +THEN MP_TAC(ISPECL[`((x':real^3) - (x:real^3)) `;`((v:real^3) - (x:real^3))`]VECTOR_ANGLE_RANGE) +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`((x':real^3) - (x:real^3)) `;`((v:real^3) - (x:real^3))`]COLLINEAR_VECTOR_ANGLE) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-B= vec 0<=> B=A`;] +THEN ONCE_REWRITE_TAC[GSYM COLLINEAR_3;] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,C,A}`] +THEN DISCH_TAC +THEN FIND_ASSUM MP_TAC `~collinear {(x:real^3),(v:real^3),(x':real^3)}` +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[DE_MORGAN_THM] +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC;(*5*) + +MP_TAC(ISPECL[`v:real^3`;`x:real^3`]DIST_EQ_0) +THEN RESA_TAC +THEN ASSUME_TAC(ISPECL[`v:real^3`;`x:real^3`]DIST_POS_LE) +THEN MP_TAC(REAL_ARITH`~(dist((v:real^3),(x:real^3))= &0)/\ &0 <= dist((v:real^3),(x:real^3))==> &0 < dist((v:real^3),(x:real^3))`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x':real^3`;`x:real^3`]DIST_EQ_0) +THEN RESA_TAC +THEN ASSUME_TAC(ISPECL[`x':real^3`;`x:real^3`]DIST_POS_LE) +THEN MP_TAC(REAL_ARITH`~(dist((x':real^3),(x:real^3))= &0)/\ &0 <= dist((x':real^3),(x:real^3))==> &0 < dist((x':real^3),(x:real^3))`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`dist ((v:real^3),(x:real^3)) * cos (h:real)`;`((x':real^3) - x) dot ((v:real^3) - (x:real^3))`; `dist((x':real^3),(x:real^3))`]REAL_LT_RDIV_EQ) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`cos (h:real)`;`(((x':real^3) - x) dot ((v:real^3) - (x:real^3)) )/ dist ((x':real^3),(x:real^3)) `; `dist((v:real^3),(x:real^3))`]REAL_LT_RDIV_EQ) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B=B*A`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[REAL_ARITH`(A*B)*C =C* A*B`] +THEN REWRITE_TAC[REAL_ARITH`A B>A`;] +THEN ASM_REWRITE_TAC[real_div;REAL_ARITH`(A*B)*C =A*(B *C)`] +THEN ONCE_REWRITE_TAC[GSYM REAL_INV_MUL;] +THEN ONCE_REWRITE_TAC[GSYM real_div;] +THEN REWRITE_TAC[dist;arcV] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 < (h:real) /\ h< pi/ &2==> &0<= h /\ h<=pi`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`h:real`ACS_COS) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`cos (h:real)`;`(((x':real^3) - x) dot ((v:real^3) - (x:real^3))) / (norm (x' - x) * norm (v - x))` ;]ACS_MONO_LT) +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ARITH`A>B<=> B B>A`] +THEN MP_TAC(ISPECL[`(x':real^3)-(x:real^3)`;`(v:real^3)-(x:real^3)`]NORM_CAUCHY_SCHWARZ_DIV) +THEN MP_TAC(ISPEC`(((x':real^3)-(x:real^3)) dot ((v:real^3)-(x:real^3))) / (norm (x' - x) * norm (v - x))`REAL_ABS_LE) +THEN REAL_ARITH_TAC](*5*);(*4*) + + +MATCH_MP_TAC(ISPECL[`u:real^3`;`x:real^3`;`v:real^3`;`x':real^3`;`e1_fan (x:real^3) (v:real^3) (u:real^3)`; +`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`;`dist((x:real^3),(x':real^3))`;`arcV (x:real^3) (x':real^3) (v:real^3)`;`azim (x:real^3) (v:real^3) (u:real^3) (x':real^3)`]SPHERICAL_COORDINATES) +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`azim x v u (x+e1_fan (x:real^3) (v:real^3) (u:real^3))= &0` ASSUME_TAC +THENL(*5*)[ + +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x + e1_fan (x:real^3) (v:real^3) (u:real^3)`; + `((u-x) dot (e3_fan (x:real^3) (v:real^3) (u:real^3))) *inv (norm((v:real^3)-(x:real^3)))`; + `&0`; +`((u-x) dot (e1_fan (x:real^3) (v:real^3) (u:real^3)))`;`&1`; +`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`;`&0`;`&0`]AZIM_UNIQUE) +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`&0+a=a`;REAL_ARITH`&0<= &0/\ &0 < &1`] +THEN STRIP_TAC +THENL(*6*)[ +MP_TAC(PI_WORKS) +THEN REAL_ARITH_TAC;(*6*) + +STRIP_TAC +THENL(*7*)[ + +REWRITE_TAC[SIN_0;COS_0;VECTOR_ARITH`(A*B)%C=A%(B%C)`] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN ONCE_REWRITE_TAC[GSYM e3_fan] +THEN MATCH_MP_TAC(ISPECL[`e3_fan (x:real^3) (v:real^3) (u:real^3)`;`(u:real^3)-(x:real^3)`;` +((u - x) dot e1_fan x v u) % (e1_fan (x:real^3) (v:real^3) (u:real^3)) + + ((u - x) dot e3_fan x v u) % (e3_fan x v u)`]CROSS_DOT_CANCEL) +THEN ASM_REWRITE_TAC[DOT_RADD;DOT_RMUL;DOT_SYM] +THEN REDUCE_ARITH_TAC +THEN REWRITE_TAC[CROSS_RADD;CROSS_RMUL;CROSS_REFL] +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]ORTHONORMAL_CROSS) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[e1_fan] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE;e2_fan] +THEN REWRITE_TAC[VECTOR_ARITH`A%(B%C)=(B*A)%C`] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ONCE_REWRITE_TAC[GSYM DOT_RMUL] +THEN ONCE_REWRITE_TAC[GSYM e2_fan] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`&0<(e1_fan x v u cross e2_fan x v u) dot e3_fan (x:real^3) (v:real^3) (u:real^3)` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[DOT_RZERO] +THEN REAL_ARITH_TAC;(*7*) + +REWRITE_TAC[SIN_0;COS_0] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN VECTOR_ARITH_TAC](*7*)](*6*);(*5*) + + +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x + e1_fan (x:real^3) (v:real^3) (u:real^3)`]AZIM_EQ_0_ALT) +THEN RESA_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ONCE_REWRITE_TAC[COLLINEAR_3] +THEN REWRITE_TAC[ VECTOR_ARITH`((A:real^3)+(B:real^3))-A=B`;] +THEN ONCE_REWRITE_TAC[GSYM DOT_CAUCHY_SCHWARZ_EQUAL] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0 pow 2= &0`;REAL_ARITH `A=B:real <=> B=A`] +THEN REDUCE_ARITH_TAC +THEN ASM_REWRITE_TAC[DOT_EQ_0;VECTOR_ARITH`A-B=vec 0<=> A=B:real^3`]](*5*)](*4*)](*3*);(*2*) + + + + + + + +ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN MP_TAC(ISPECL[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`]one_edge_fan) +THEN RESA_TAC +THEN REWRITE_TAC[DIFF;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN EXISTS_TAC`vector[(dist((x:real^3),(x':real^3)));(azim (x:real^3) (v:real^3) (u:real^3) (x':real^3));(arcV (x:real^3) (x':real^3) (v:real^3))]:real^3` +THEN ASM_REWRITE_TAC[VECTOR_3;AZIM_REFL;REAL_ARITH`A> &0 <=> &0 &0 < dist((x:real^3),(x':real^3))`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[azim] +THEN SUBGOAL_THEN`~collinear{(x:real^3),(v:real^3),(x':real^3)}` ASSUME_TAC +THENL(*4*)[ + +POP_ASSUM (fun th-> REWRITE_TAC[]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[]) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MA") +THEN ONCE_REWRITE_TAC[lem1] +THEN ASM_REWRITE_TAC[COLLINEAR_3;COLLINEAR_LEMMA;VECTOR_ARITH`v-x=vec 0<=> v=x`] +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]AFF_GE_2_1) +THEN RESA_TAC +THEN STRIP_TAC +THENL(*5*)[ + +REMOVE_THEN "MA" MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN REAL_ARITH_TAC;(*5*) + +REMOVE_THEN "MA" MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`&1- (c:real)` +THEN EXISTS_TAC`c:real` +THEN EXISTS_TAC`&0` +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(x':real^3)=(&1 - (c:real)) % (x:real^3)+ c % (v:real^3)<=>x'-x=c%(v-x)`] +THEN REAL_ARITH_TAC](*5*);(*4*) + + + +STRIP_TAC +THENL(*5*)[ +STRIP_TAC +THENL(*6*)[ + +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x':real^3`]AZIM_EQ_0_GE_ALT) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x':real^3`]azim) +THEN REAL_ARITH_TAC;(*6*) + + +STRIP_TAC +THENL(*7*)[ + +REWRITE_TAC[ARCV_ANGLE; angle;] +THEN MP_TAC(ISPECL[`((x':real^3) - (x:real^3)) `;`((v:real^3) - (x:real^3))`]VECTOR_ANGLE_RANGE) +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`((x':real^3) - (x:real^3)) `;`((v:real^3) - (x:real^3))`]COLLINEAR_VECTOR_ANGLE) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-B= vec 0<=> B=A`;] +THEN ONCE_REWRITE_TAC[GSYM COLLINEAR_3;] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,C,A}`] +THEN DISCH_TAC +THEN FIND_ASSUM MP_TAC `~collinear {(x:real^3),(v:real^3),(x':real^3)}` +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[DE_MORGAN_THM] +THEN REPEAT(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC;(*7*) + +MP_TAC(ISPECL[`v:real^3`;`x:real^3`]DIST_EQ_0) +THEN RESA_TAC +THEN ASSUME_TAC(ISPECL[`v:real^3`;`x:real^3`]DIST_POS_LE) +THEN MP_TAC(REAL_ARITH`~(dist((v:real^3),(x:real^3))= &0)/\ &0 <= dist((v:real^3),(x:real^3))==> &0 < dist((v:real^3),(x:real^3))`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`x':real^3`;`x:real^3`]DIST_EQ_0) +THEN RESA_TAC +THEN ASSUME_TAC(ISPECL[`x':real^3`;`x:real^3`]DIST_POS_LE) +THEN MP_TAC(REAL_ARITH`~(dist((x':real^3),(x:real^3))= &0)/\ &0 <= dist((x':real^3),(x:real^3))==> &0 < dist((x':real^3),(x:real^3))`) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`dist ((v:real^3),(x:real^3)) * cos (h:real)`;`((x':real^3) - x) dot ((v:real^3) - (x:real^3))`; `dist((x':real^3),(x:real^3))`]REAL_LT_RDIV_EQ) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`cos (h:real)`;`(((x':real^3) - x) dot ((v:real^3) - (x:real^3)) )/ dist ((x':real^3),(x:real^3)) `; `dist((v:real^3),(x:real^3))`]REAL_LT_RDIV_EQ) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B=B*A`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[REAL_ARITH`(A*B)*C =C* A*B`] +THEN REWRITE_TAC[REAL_ARITH`A B>A`;] +THEN ASM_REWRITE_TAC[real_div;REAL_ARITH`(A*B)*C =A*(B *C)`] +THEN ONCE_REWRITE_TAC[GSYM REAL_INV_MUL;] +THEN ONCE_REWRITE_TAC[GSYM real_div;] +THEN REWRITE_TAC[dist;arcV] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 < (h:real) /\ h< pi/ &2==> &0<= h /\ h<=pi`) +THEN RESA_TAC +THEN MP_TAC(ISPEC`h:real`ACS_COS) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`cos (h:real)`;`(((x':real^3) - x) dot ((v:real^3) - (x:real^3))) / (norm (x' - x) * norm (v - x))` ;]ACS_MONO_LT) +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ARITH`A>B<=> B B>A`] +THEN MP_TAC(ISPECL[`(x':real^3)-(x:real^3)`;`(v:real^3)-(x:real^3)`]NORM_CAUCHY_SCHWARZ_DIV) +THEN MP_TAC(ISPEC`(((x':real^3)-(x:real^3)) dot ((v:real^3)-(x:real^3))) / (norm (x' - x) * norm (v - x))`REAL_ABS_LE) +THEN REAL_ARITH_TAC](*7*)](*6*);(*5*) + +MATCH_MP_TAC(ISPECL[`u:real^3`;`x:real^3`;`v:real^3`;`x':real^3`;`e1_fan (x:real^3) (v:real^3) (u:real^3)`; +`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`;`dist((x:real^3),(x':real^3))`;`arcV (x:real^3) (x':real^3) (v:real^3)`;`azim (x:real^3) (v:real^3) (u:real^3) (x':real^3)`]SPHERICAL_COORDINATES) +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`azim x v u (x+e1_fan (x:real^3) (v:real^3) (u:real^3))= &0` ASSUME_TAC +THENL(*6*)[ + +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x + e1_fan (x:real^3) (v:real^3) (u:real^3)`; + `((u-x) dot (e3_fan (x:real^3) (v:real^3) (u:real^3))) *inv (norm((v:real^3)-(x:real^3)))`; + `&0`; +`((u-x) dot (e1_fan (x:real^3) (v:real^3) (u:real^3)))`;`&1`; +`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`;`&0`;`&0`]AZIM_UNIQUE) +THEN DISCH_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`&0+a=a`;REAL_ARITH`&0<= &0/\ &0 < &1`] +THEN STRIP_TAC +THENL(*7*)[ +MP_TAC(PI_WORKS) +THEN REAL_ARITH_TAC;(*7*) + +STRIP_TAC +THENL(*8*)[ + +REWRITE_TAC[SIN_0;COS_0;VECTOR_ARITH`(A*B)%C=A%(B%C)`] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN ONCE_REWRITE_TAC[GSYM e3_fan] +THEN MATCH_MP_TAC(ISPECL[`e3_fan (x:real^3) (v:real^3) (u:real^3)`;`(u:real^3)-(x:real^3)`;` +((u - x) dot e1_fan x v u) % (e1_fan (x:real^3) (v:real^3) (u:real^3)) + + ((u - x) dot e3_fan x v u) % (e3_fan x v u)`]CROSS_DOT_CANCEL) +THEN ASM_REWRITE_TAC[DOT_RADD;DOT_RMUL;DOT_SYM] +THEN REDUCE_ARITH_TAC +THEN REWRITE_TAC[CROSS_RADD;CROSS_RMUL;CROSS_REFL] +THEN REDUCE_VECTOR_TAC +THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3) (v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`]ORTHONORMAL_CROSS) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[e1_fan] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE;e2_fan] +THEN REWRITE_TAC[VECTOR_ARITH`A%(B%C)=(B*A)%C`] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ONCE_REWRITE_TAC[GSYM DOT_RMUL] +THEN ONCE_REWRITE_TAC[GSYM e2_fan] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`&0<(e1_fan x v u cross e2_fan x v u) dot e3_fan (x:real^3) (v:real^3) (u:real^3)` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN REWRITE_TAC[DOT_RZERO] +THEN REAL_ARITH_TAC;(*8*) + +REWRITE_TAC[SIN_0;COS_0] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN VECTOR_ARITH_TAC](*8*)](*7*);(*6*) + + +MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`;`x + e1_fan (x:real^3) (v:real^3) (u:real^3)`]AZIM_EQ_0_ALT) +THEN RESA_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ONCE_REWRITE_TAC[COLLINEAR_3] +THEN REWRITE_TAC[ VECTOR_ARITH`((A:real^3)+(B:real^3))-A=B`;] +THEN ONCE_REWRITE_TAC[GSYM DOT_CAUCHY_SCHWARZ_EQUAL] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0 pow 2= &0`;REAL_ARITH `A=B:real <=> B=A`] +THEN REDUCE_ARITH_TAC +THEN ASM_REWRITE_TAC[DOT_EQ_0;VECTOR_ARITH`A-B=vec 0<=> A=B:real^3`]](*6*)](*5*)](*4*)](*3*)](*2*)](*1*))));; + + + + +let connected_rw_dart_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 h:real. +FAN(x,V,E)/\ {v,u} IN E/\ &0 connected(rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) (cos(h)))`, +REPEAT STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`v:real^3`; +` u:real^3` ;`h:real`]rw_dart_is_image_set_spherical_coordinate) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[] +THEN ASSUME_TAC(ISPECL[`(azim (x:real^3) (v:real^3) (u:real^3) u)`; `(azim_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) `;`h:real`] r_is_connected_fan) +THEN MP_TAC(ISPECL[`change_spherical_coordinate_fan (x:real^3) (v:real^3) (u:real^3)`;`r_fan (azim x v u u) (azim_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) (h:real)`]CONTINUOUS_ON_EQ_CONTINUOUS_AT) +THEN RESA_TAC +THEN MP_TAC(ISPECL[`change_spherical_coordinate_fan (x:real^3) (v:real^3) (u:real^3)`;`r_fan (azim x v u u) (azim_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) (h:real)`] CONNECTED_CONTINUOUS_IMAGE) +THEN RESA_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN GEN_TAC +THEN STRIP_TAC +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`; +`u:real^3`;`x':real^3`]continuous_change_spherical_coordinate_fan) +THEN REWRITE_TAC[change_spherical_coordinate_fan] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN DISCH_TAC +THEN MATCH_MP_TAC CONTINUOUS_ADD +THEN ASM_REWRITE_TAC[] +THEN SIMP_TAC[CONTINUOUS_CONST]);; + + +let not_empty_rw_dart_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3. +FAN(x,V,E)/\ {v,u} IN E +==> +(!h:real. &0 +~(rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) (cos(h))={}))`, +REPEAT STRIP_TAC +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` u:real^3`;`v:real^3`] +THEN MRESA_TAC rw_dart_is_image_set_spherical_coordinate[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`h:real`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[IMAGE_EQ_EMPTY;r_fan;EXTENSION;IN_ELIM_THM;IN;EMPTY;NOT_FORALL_THM;AZIM_REFL;azim_fan] +THEN DISJ_CASES_TAC(ARITH_RULE`~(CARD (set_of_edge (v:real^3) V E) > 1)\/ CARD (set_of_edge v V E) > 1`) +THENL[ +ASM_REWRITE_TAC[] +THEN EXISTS_TAC`vector[&1; pi; h/ &2]:real^3` +THEN SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH] +THEN MP_TAC PI_WORKS +THEN ASM_TAC +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E = {u:real^3})\/ ~(set_of_edge v V E = {u})`) +THENL[ +MRESA_TAC CARD_SING[`u:real^3`; `(set_of_edge v V E):real^3->bool`] +THEN FIND_ASSUM MP_TAC `CARD ((set_of_edge v V E):real^3->bool) >1` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun TH-> REWRITE_TAC[TH]) +THEN ARITH_TAC; + +DISJ_CASES_TAC(REAL_ARITH `(azim (x:real^3) (v:real^3) (u:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))= &0) \/ ~(azim (x:real^3) (v:real^3) (u:real^3) (sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)) = &0)`) +THENL[ +MRESA_TAC SIGMA_FAN[`(x:real^3)`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(v:real^3)`;`(u:real^3)`] +THEN MRESA_TAC UNIQUE_AZIM_0_POINT_FAN[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))`] +THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))`;`v:real^3`]; + +MRESA_TAC azim[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`;`(sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))`] +THEN EXISTS_TAC`vector[&1; (azim x v u ((sigma_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3))))/ &2;h/ &2]:real^3` +THEN SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH] +THEN ASM_TAC +THEN REAL_ARITH_TAC]]]);; + + + +let JGIYDLE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3. +FAN(x,V,E)/\ {v,u} IN E +==> +(!h:real. &0 +~(rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) (cos(h))={})) +/\(!h:real h1:real. h1 <= h +==> +(rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) h SUBSET rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) h1)) + +/\ +(?h:real. +&1> h /\ +h> &0 /\ +rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) h SUBSET yfan(x,V,E)) +/\ +(!h:real. &0 connected(rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) (cos(h))))`, +MESON_TAC[not_empty_rw_dart_fan;continuous_set_fan;rw_dart_avoids_fan;connected_rw_dart_fan]);; + + + +(****************************************************************************) +(****************************LEADS INTO**************************************) +(****************************************************************************) + +let dart_leads_into=new_definition`dart_leads_into (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (v:real^3) (u:real^3)= +@(U:real^3->bool). ?h:real. &0 (rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) (cos(s)) SUBSET U /\ connected_component (yfan(x,V,E)) y=U))`;; + + + + + + +let exists_leads_into_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3. +FAN(x,V,E)/\ {v,u} IN E +==> +?(U:real^3->bool). ?h:real. &0 (rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) (cos(s)) SUBSET U /\ connected_component (yfan(x,V,E)) y=U))`, +REPEAT STRIP_TAC +THEN MRESA_TAC JGIYDLE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN ASM_TAC +THEN DISCH_TAC +THEN DISCH_TAC +THEN DISCH_THEN (LABEL_TAC "BE") +THEN DISCH_THEN (LABEL_TAC "YEU") +THEN DISCH_TAC +THEN DISCH_TAC +THEN DISCH_THEN (LABEL_TAC "EM") +THEN DISCH_THEN (LABEL_TAC "NHIEU") +THEN MP_TAC(REAL_ARITH`h> &0/\ &1>h ==> -- &1< (h:real)/\ -- &1<= (h:real) /\ h< &1 /\ &0 MRESA1_TAC th `acs(h:real)`) +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[EXTENSION] +THEN REWRITE_TAC[EMPTY;IN;NOT_FORALL_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM IN] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[GSYM FUN_EQ_THM] +THEN EXISTS_TAC`(connected_component (yfan((x:real^3),(V:real^3->bool) ,(E:(real^3->bool)->bool))) (x':real^3)):real^3->bool` +THEN EXISTS_TAC`acs(h:real)` +THEN ASM_REWRITE_TAC[] +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM IN] +THEN DISCH_TAC +THEN ASSUME_TAC(PI_WORKS) +THEN MP_TAC(REAL_ARITH` &0< s /\ acs (h:real)< pi/ &2 /\ &0< pi ==> &0<= (s:real)/\ acs h<= pi`) +THEN RESA_TAC +THEN MRESAL_TAC COS_MONO_LT[`s:real`;`acs(h:real)`][] +THEN MP_TAC(REAL_ARITH` h< cos(s:real)==>h<= cos(s:real)`) +THEN RESA_TAC +THEN REMOVE_THEN "NHIEU"(fun th-> MRESA1_TAC th `acs(h:real)`) +THEN REMOVE_THEN "YEU" (fun th-> MRESA_TAC th[`cos(s:real)`;`h:real`]) +THEN MRESA_TAC CONNECTED_COMPONENT_MAXIMAL [`yfan(x:real^3,(V:real^3->bool),(E:(real^3->bool)->bool))`;`rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) (h:real)`;`x':real^3`] +THEN STRIP_TAC +THENL[ +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; +MATCH_MP_TAC CONNECTED_COMPONENT_EQ +THEN ASM_TAC +THEN SET_TAC[]]);; + + + + +let DART_LEADS_INTO=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3. +FAN(x,V,E)/\ {v,u} IN E +==> +?h:real. &0 (rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) (cos(s)) SUBSET dart_leads_into x V E v u /\ connected_component (yfan(x,V,E)) y=dart_leads_into x V E v u))`, + +REPEAT STRIP_TAC +THEN ONCE_REWRITE_TAC[dart_leads_into] +THEN MRESA_TAC exists_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`] + THEN SELECT_ELIM_TAC +THEN EXISTS_TAC`U:real^3->bool` +THEN EXISTS_TAC`h:real` + THEN ASM_REWRITE_TAC[]);; + + +let unique_dart_leads_into=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3 (U:real^3->bool). +FAN(x,V,E)/\ {v,u} IN E +/\(?h:real. &0 (rw_dart_fan x V E ((x:real^3),(v:real^3),(u:real^3),sigma_fan x V E v u) (cos(s)) SUBSET U /\ connected_component (yfan(x,V,E)) y=U))) +==> dart_leads_into x V E v u =U`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"A") +THEN MRESA_TAC DART_LEADS_INTO [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC "BE") +THEN MRESA_TAC JGIYDLE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC "YEU") +THEN DISCH_THEN (LABEL_TAC "EM") +THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC +THEN DISCH_THEN (LABEL_TAC "MAI") +THEN ASSUME_TAC(PI_WORKS) +THEN MP_TAC(REAL_ARITH`&0 +-- &1< (min (min (h:real) (h':real)/ &2) (pi/ &3)) /\ +-- &1<= (min (min (h:real) (h':real)/ &2) (pi/ &3)) /\ + (min (min (h:real) (h':real)/ &2) (pi/ &3))< pi/ &2 /\ + &0 <(min (min (h:real) (h':real)/ &2) (pi/ &3)) /\ + (min (min (h:real) (h':real)/ &2) (pi/ &3))<= pi/ &2 /\ + (min (min (h:real) (h':real)/ &2) (pi/ &3))< h /\ + (min (min (h:real) (h':real)/ &2) (pi/ &3))< h' +`) +THEN RESA_TAC +THEN REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th ` (min (min (h:real) (h':real)/ &2) (pi/ &3))`) +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[EXTENSION] +THEN REWRITE_TAC[EMPTY;IN;NOT_FORALL_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM IN] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[GSYM FUN_EQ_THM] +THEN REMOVE_THEN "BE" (fun th-> MRESA_TAC th[`(min ((min (h:real) (h':real))/ &2) (pi/ &3))`;`x':real^3`]) +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "A" (fun th-> MRESA_TAC th[`(min ((min (h:real) (h':real))/ &2) (pi/ &3))`;`x':real^3`]) +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + +let dart_leads_into_fan_in_topological_component_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3. +FAN(x,V,E)/\ {v,u} IN E +==> dart_leads_into x V E v u IN topological_component_yfan (x,V,E)`, +REPEAT STRIP_TAC +THEN MRESA_TAC not_empty_rw_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESA_TAC DART_LEADS_INTO[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; +`v:real^3`;`u:real^3`;] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC rw_dart_avoids_fan[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"OI") +THEN MP_TAC(REAL_ARITH`&1> h' /\ h' > &0==> -- &1 < h' /\ h'< &1 /\ -- &1 <= h' /\ h'<= &1/\ &0 < h' /\ h' <= &1`) THEN RESA_TAC +THEN MRESA1_TAC ACS_BOUNDS_LT`h':real` +THEN MRESAL_TAC ACS_MONO_LT[`&0`;`h':real`][ACS_0;REAL_ARITH`-- &1 <= &0`] +THEN MRESA1_TAC COS_ACS `h':real` +THEN ABBREV_TAC`h1= min (h:real) (acs h')/ &2` +THEN MP_TAC(REAL_ARITH`h1= min (h:real) (acs h')/ &2 /\ &0 &0< h1 /\ h1< h /\ h1 h'<= cos h1`) THEN RESA_TAC +THEN REMOVE_THEN "EM"(fun th-> MRESAL1_TAC th `h1:real`[SET_RULE`~(A={})<=> ?y. y IN A`]) +THEN REMOVE_THEN "YEU"(fun th-> MRESA_TAC th [`h1:real`;`y:real^3`]) +THEN POP_ASSUM(fun th -> REWRITE_TAC[SYM(th);IN_ELIM_THM;topological_component_yfan;]) +THEN EXISTS_TAC`y:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC continuous_set_fan[`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`(cos h1:real)`;`(h':real)`] +THEN ASM_TAC THEN SET_TAC[]);; + +let in_topological_component_yfan_is_connected=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool. +U IN topological_component_yfan (x,V,E) +==> connected U`, +REWRITE_TAC[topological_component_yfan;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[CONNECTED_CONNECTED_COMPONENT]);; + + +let connected_dart_leads_into_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 u:real^3. +FAN(x,V,E)/\ {v,u} IN E +==> connected(dart_leads_into x V E v u )`, +REPEAT STRIP_TAC +THEN MRESA_TAC dart_leads_into_fan_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`] +THEN MATCH_MP_TAC in_topological_component_yfan_is_connected +THEN EXISTS_TAC`x:real^3` +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[]);; + + + +end;; diff --git a/text_formalization/general/debug.hl b/text_formalization/general/debug.hl new file mode 100644 index 0000000..beff348 --- /dev/null +++ b/text_formalization/general/debug.hl @@ -0,0 +1,118 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: General *) +(* Author: Thomas C. Hales *) +(* Date: 2010-02-13 *) +(* ========================================================================== *) + +(* verbose error messages on definitions and theorems and parsing. *) + + +module Debug = struct + + open Parser_verbose;; + + let silent= ref false;; + + let print_mtm m s = if !silent then () else + (print_string ("\n"^m^"\n"); print_term s; print_string "\n");; + + let print_m f m s = if !silent then () else + (print_string ("\n"^m^"\n"); f s; print_string "\n";);; + + let parse_error_msg msg r s = if !silent then failwith msg else (print_string ("Parse error, cannot create "^r^" from \""^s^"\"\n"); failwith msg);; + + let verbose_1 p s = + try p s with Failure msg -> + print_mtm "Error while processing_1 " s; failwith msg;; + + let verbose_thm p r s = + try p r s with Failure msg -> + print_m print_thm "Error while processing_1_thm " s; failwith msg;; + + let verbose p (s,t) = + try p (s,t) with Failure msg -> + print_mtm "Error while processing " s; failwith msg;; + + let very_verbose_1 p s = + print_mtm "VERBOSE MODE (1 argument)" s; p s;; + + let very_verbose p (s,t) = + print_mtm "VERBOSE MODE" s; p (s,t);; + +(* +Type and Term parsing +*) + + let conflicts s1 s2 = + let v1 = map dest_var (frees s1) in + let v2 = map dest_var (frees s2) in + let ss = intersect (map fst v1) (map fst v2) in + let f s = mk_type ("prod", [assoc s v1;assoc s v2]) in + map (fun s -> ("clash",mk_var (s,aty),f s)) ss;; + +let rec find_subterms ptm = + let r = term_of_preterm o (retypecheck[]) in + let m s p = (s,r p,type_of (r p)) in + match ptm with + |Varp (s,ty) -> (try (let _ = r ptm in []) with Failure _ -> + failwith ("variable typing error: "^s)) + | Constp (s,pty) -> (try let _ = r ptm in [] + with Failure _ -> failwith ("constant typing error: "^s)) + | Combp (s,t) -> (try let _ = r ptm in [] with Failure _ -> + if (can r s) && (can r t) then ([m "function head" s; m "function arg" t] @ conflicts (r s) (r t)) + else if (can r s) then find_subterms t else find_subterms s) + | Absp (s,t) -> (try let _ = r ptm in [] with Failure _ -> + if (can r s) && (can r t) then [m "absvar" s; m "absbody" t] + else if (can r s) then find_subterms t else find_subterms s) + | Typing (s,_) -> (try let _ = r ptm in [] with Failure _ -> + if (can r s) then [m "user type constraint on term" s] else find_subterms s);; + +exception Term_of_preterm_error of (string * term * hol_type) list;; + +let parse_fail ptm = let flag = !type_invention_warning in + let r = (type_invention_warning := false; find_subterms ptm) in + let _ = type_invention_warning := flag in + raise (Term_of_preterm_error r);; + + + + +let parse_type_verbose s = + let (pty,l) = try ((parse_pretype_verbose o lex o explode) s) with + Failure msg -> parse_error_msg msg "pretype" s in + if l = [] then try (type_of_pretype pty) with + Failure msg -> parse_error_msg msg "type" s + else failwith ("Unparsed input "^(string_of_lexcodel l)^" following type in string "^s);; + +let parse_term_verbose s = + let lexstream = try lex ( explode s) with + Failure msg -> parse_error_msg msg "lex stream" s in + let ptm,l = try (parse_preterm_verbose lexstream) with + | Failure msg -> parse_error_msg msg "preterm " s + | Noparse -> parse_error_msg "preterm" " preterm " (string_of_lexcodel (lex (explode s))) in + if l = [] then + try (term_of_preterm o (retypecheck [])) ptm + with Failure msg -> (report msg; report ("bad input: "^s); parse_fail ptm) + else failwith ("Trailing junk "^(string_of_lexcodel l)^" following preterm in string "^s);; + + let quotexpander_verbose s = + if String.sub s 0 1 = ":" then + "Debug.parse_type_verbose \""^ + (String.escaped (String.sub s 1 (String.length s - 1)))^"\"" + else "Debug.parse_term_verbose \""^(String.escaped s)^"\"";; + + +unset_jrh_lexer + + let set_verbose_parsing() = + Quotation.add "tot" (Quotation.ExStr (fun x -> quotexpander_verbose));; + + let restore_parsing() = + Quotation.add "tot" (Quotation.ExStr (fun x -> quotexpander));; + +set_jrh_lexer + + +end;; diff --git a/text_formalization/general/flyspeck_lib.hl b/text_formalization/general/flyspeck_lib.hl new file mode 100644 index 0000000..8d2e767 --- /dev/null +++ b/text_formalization/general/flyspeck_lib.hl @@ -0,0 +1,125 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* HOL LIGHT pervasives *) +(* Author: Thomas C. Hales *) +(* Date: 2012-04-15 *) +(* ========================================================================== *) + + +(* This file contains Ocaml library functions *) + + +module Flyspeck_lib = struct + + +(* +eval_command comes from + +http://solaria.dimino.org/cgi-bin/darcsweb.cgi?r=peps;a=headblob;f=/src/core/peps_top.ml +License: BSD3 + +If the expression is syntactically correct +and the evaluation raises an exception, then the return value is true. +*) + + +let eval_command ?(silent=false) command = + let buffer = Buffer.create 512 in + let pp = Format.formatter_of_buffer buffer in + Format.pp_set_margin pp max_int; + try + let _ = + Toploop.execute_phrase (not silent) pp + (!Toploop.parse_toplevel_phrase (Lexing.from_string (command ^ ";;"))) + in + (true, Buffer.contents buffer) + with exn -> + let save = !Toploop.parse_use_file in + Toploop.parse_use_file := (fun _ -> raise exn); + Pervasives.ignore (Toploop.use_silently pp "/dev/null"); + Toploop.parse_use_file := save; + (false, Buffer.contents buffer);; + +(* eval_command ~silent:false "g `x=y`";; *) + + +(* process_to_string in strictbuild.hl *) + +let svn_version() = "svn("^ + (process_to_string ("svnversion -n " ^ flyspeck_dir))^ + ","^ + (process_to_string("svnversion -n " ^ hollight_dir))^ + ")";; + + +(* duplicated code *) +let unsplit d f = function + | (x::xs) -> List.fold_left (fun s t -> s^d^(f t)) (f x) xs + | [] -> "";; + +let join_comma = unsplit "," (fun x-> x);; + +let join_lines = unsplit "\n" (fun x-> x);; + +let join_space = unsplit " " (fun x-> x);; + +let rec nub = function (* from lpproc.ml *) + | [] -> [] + | x::xs -> x::filter ((<>) x) (nub xs);; + +(* duplicated code *) + +(* System commands *) + +let output_filestring tmpfile a = + let outs = open_out tmpfile in + let _ = try (Printf.fprintf outs "%s" a) + with _ as t -> (close_out outs; raise t) in + close_out outs ;; + +(* from glpk_link.ml *) + +let load_and_close_channel do_close ic = + let rec lf ichan a = + try + lf ic (Pervasives.input_line ic::a) + with End_of_file -> a in + let rs = lf ic [] in + if do_close then Pervasives.close_in ic else (); + rev rs;; + +let load_and_close_channel_true ic = + let rec lf ichan a = + try + lf ic (Pervasives.input_line ic::a) + with End_of_file -> a | _ as t -> (Pervasives.close_in ic; raise t) in + let rs = lf ic [] in + let _ = Pervasives.close_in ic in + rev rs;; + +let load_file filename = + let ic = Pervasives.open_in filename in load_and_close_channel_true ic;; + + + +(* deprecated +let print_string_as_text = report;; +*) + +let exists_pgm s = + let com = "command -v " ^ s in + not(process_to_string com = "");; + + +(* numerical *) + +let dest_decimal x = match strip_comb x with + | (dec,[a;b]) -> + div_num (dest_numeral a) (dest_numeral b) + | _ -> failwith ("dest_decimal: '" ^ string_of_term x ^ "'") ;; + +let string_of_num' x = string_of_float (float_of_num x);; + + +end;; diff --git a/text_formalization/general/hol_pervasives.hl b/text_formalization/general/hol_pervasives.hl new file mode 100644 index 0000000..6a3d8b5 --- /dev/null +++ b/text_formalization/general/hol_pervasives.hl @@ -0,0 +1,64 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* HOL LIGHT pervasives *) +(* Author: Thomas C. Hales *) +(* Date: 2012-04-15 *) +(* ========================================================================== *) + + +(* +This module contains things in HOL Light that clash and get overwriten. +This file needs to be loaded immediately after +tactics.ml and lib.ml to get the intended values. +*) + + +(* from tactics *) + +module Hol_pervasives = struct + +let e tac = refine(by(VALID tac));; + +let r n = refine(rotate n);; + +let g t = + let fvs = sort (<) (map (fst o dest_var) (frees t)) in + (if fvs <> [] then + let errmsg = end_itlist (fun s t -> s^", "^t) fvs in + warn true ("Free variables in goal: "^errmsg) + else ()); + set_goal([],t);; + +let b() = + let l = !current_goalstack in + if length l = 1 then failwith "Can't back up any more" else + current_goalstack := tl l; + !current_goalstack;; + +let p() = + !current_goalstack;; + +(* HOL Light lib, in general raises Failure _ + unlike Ocaml List, which raises Not_found. *) + +let assoc = assoc;; + +let hd = hd;; + +let tl = tl;; + +let sort = sort;; + +let prove = prove;; + +let zip = zip;; + +let find = find;; + +let ISPECL = ISPECL;; + + +(* abs, sqrt, .... *) + +end;; diff --git a/text_formalization/general/lib.hl b/text_formalization/general/lib.hl new file mode 100644 index 0000000..b3988cb --- /dev/null +++ b/text_formalization/general/lib.hl @@ -0,0 +1,848 @@ +(* ========================================================================= *) +(* Convenient library functions. *) +(* *) +(* John Harrison, University of Cambridge Computer Laboratory *) +(* *) +(* (c) Copyright, University of Cambridge 1998 *) +(* (c) Copyright, John Harrison 1998-2007 *) +(* ========================================================================= *) + +module Lib = struct + +let fail() = failwith "";; + +(* ------------------------------------------------------------------------- *) +(* Combinators. *) +(* ------------------------------------------------------------------------- *) + +let curry f x y = f(x,y);; + +let uncurry f(x,y) = f x y;; + +let I x = x;; + +let K x y = x;; + +let C f x y = f y x;; + +let W f x = f x x;; + +let (o) = fun f g x -> f(g x);; + +let (F_F) = fun f g (x,y) -> (f x,g y);; + +(* ------------------------------------------------------------------------- *) +(* List basics. *) +(* ------------------------------------------------------------------------- *) + +let hd l = + match l with + h::t -> h + | _ -> failwith "hd";; + +let tl l = + match l with + h::t -> t + | _ -> failwith "tl";; + +let map f = + let rec mapf l = + match l with + [] -> [] + | (x::t) -> let y = f x in y::(mapf t) in + mapf;; + +let rec last l = + match l with + [x] -> x + | (h::t) -> last t + | [] -> failwith "last";; + +let rec butlast l = + match l with + [_] -> [] + | (h::t) -> h::(butlast t) + | [] -> failwith "butlast";; + +let rec el n l = + if n = 0 then hd l else el (n - 1) (tl l);; + +let rev = + let rec rev_append acc l = + match l with + [] -> acc + | h::t -> rev_append (h::acc) t in + fun l -> rev_append [] l;; + +let rec map2 f l1 l2 = + match (l1,l2) with + [],[] -> [] + | (h1::t1),(h2::t2) -> let h = f h1 h2 in h::(map2 f t1 t2) + | _ -> failwith "map2: length mismatch";; + +(* ------------------------------------------------------------------------- *) +(* Attempting function or predicate applications. *) +(* ------------------------------------------------------------------------- *) + +let can f x = try (f x; true) with Failure _ -> false;; + +let check p x = if p x then x else failwith "check";; + +(* ------------------------------------------------------------------------- *) +(* Repetition of a function. *) +(* ------------------------------------------------------------------------- *) + +let rec funpow n f x = + if n < 1 then x else funpow (n-1) f (f x);; + +let rec repeat f x = + try let y = f x in repeat f y with Failure _ -> x;; + +(* ------------------------------------------------------------------------- *) +(* To avoid consing in various situations, we propagate this exception. *) +(* I should probably eliminate this and use pointer EQ tests instead. *) +(* ------------------------------------------------------------------------- *) + +exception Unchanged;; + +(* ------------------------------------------------------------------------- *) +(* Various versions of list iteration. *) +(* ------------------------------------------------------------------------- *) + +let rec itlist f l b = + match l with + [] -> b + | (h::t) -> f h (itlist f t b);; + +let rec rev_itlist f l b = + match l with + [] -> b + | (h::t) -> rev_itlist f t (f h b);; + +let rec end_itlist f l = + match l with + [] -> failwith "end_itlist" + | [x] -> x + | (h::t) -> f h (end_itlist f t);; + +let rec itlist2 f l1 l2 b = + match (l1,l2) with + ([],[]) -> b + | (h1::t1,h2::t2) -> f h1 h2 (itlist2 f t1 t2 b) + | _ -> failwith "itlist2";; + +let rec rev_itlist2 f l1 l2 b = + match (l1,l2) with + ([],[]) -> b + | (h1::t1,h2::t2) -> rev_itlist2 f t1 t2 (f h1 h2 b) + | _ -> failwith "rev_itlist2";; + +(* ------------------------------------------------------------------------- *) +(* Iterative splitting (list) and stripping (tree) via destructor. *) +(* ------------------------------------------------------------------------- *) + +let rec splitlist dest x = + try let l,r = dest x in + let ls,res = splitlist dest r in + (l::ls,res) + with Failure _ -> ([],x);; + +let rev_splitlist dest = + let rec rsplist ls x = + try let l,r = dest x in + rsplist (r::ls) l + with Failure _ -> (x,ls) in + fun x -> rsplist [] x;; + +let striplist dest = + let rec strip x acc = + try let l,r = dest x in + strip l (strip r acc) + with Failure _ -> x::acc in + fun x -> strip x [];; + +(* ------------------------------------------------------------------------- *) +(* Apply a destructor as many times as elements in list. *) +(* ------------------------------------------------------------------------- *) + +let rec nsplit dest clist x = + if clist = [] then [],x else + let l,r = dest x in + let ll,y = nsplit dest (tl clist) r in + l::ll,y;; + +(* ------------------------------------------------------------------------- *) +(* Replication and sequences. *) +(* ------------------------------------------------------------------------- *) + +let rec replicate x n = + if n < 1 then [] + else x::(replicate x (n - 1));; + +let rec (--) = fun m n -> if m > n then [] else m::((m + 1) -- n);; + +(* ------------------------------------------------------------------------- *) +(* Various useful list operations. *) +(* ------------------------------------------------------------------------- *) + +let rec forall p l = + match l with + [] -> true + | h::t -> p(h) & forall p t;; + +let rec forall2 p l1 l2 = + match (l1,l2) with + [],[] -> true + | (h1::t1,h2::t2) -> p h1 h2 & forall2 p t1 t2 + | _ -> false;; + +let rec exists p l = + match l with + [] -> false + | h::t -> p(h) or exists p t;; + +let length = + let rec len k l = + if l = [] then k else len (k + 1) (tl l) in + fun l -> len 0 l;; + +let rec filter p l = + match l with + [] -> l + | h::t -> let t' = filter p t in + if p(h) then if t'==t then l else h::t' + else t';; + +let rec partition p l = + match l with + [] -> [],l + | h::t -> let yes,no = partition p t in + if p(h) then (if yes == t then l,[] else h::yes,no) + else (if no == t then [],l else yes,h::no);; + +let rec mapfilter f l = + match l with + [] -> [] + | (h::t) -> let rest = mapfilter f t in + try (f h)::rest with Failure _ -> rest;; + +let rec find p l = + match l with + [] -> failwith "find" + | (h::t) -> if p(h) then h else find p t;; + +let rec tryfind f l = + match l with + [] -> failwith "tryfind" + | (h::t) -> try f h with Failure _ -> tryfind f t;; + +let flat l = itlist (@) l [];; + +let rec remove p l = + match l with + [] -> failwith "remove" + | (h::t) -> if p(h) then h,t else + let y,n = remove p t in y,h::n;; + +let rec chop_list n l = + if n = 0 then [],l else + try let m,l' = chop_list (n-1) (tl l) in (hd l)::m,l' + with Failure _ -> failwith "chop_list";; + +let index x = + let rec ind n l = + match l with + [] -> failwith "index" + | (h::t) -> if Pervasives.compare x h = 0 then n else ind (n + 1) t in + ind 0;; + +(* ------------------------------------------------------------------------- *) +(* "Set" operations on lists. *) +(* ------------------------------------------------------------------------- *) + +let rec mem x lis = + match lis with + [] -> false + | (h::t) -> Pervasives.compare x h = 0 or mem x t;; + +let insert x l = + if mem x l then l else x::l;; + +let union l1 l2 = itlist insert l1 l2;; + +let unions l = itlist union l [];; + +let intersect l1 l2 = filter (fun x -> mem x l2) l1;; + +let subtract l1 l2 = filter (fun x -> not (mem x l2)) l1;; + +let subset l1 l2 = forall (fun t -> mem t l2) l1;; + +let set_eq l1 l2 = subset l1 l2 & subset l2 l1;; + +(* ------------------------------------------------------------------------- *) +(* Association lists. *) +(* ------------------------------------------------------------------------- *) + +let rec assoc a l = + match l with + (x,y)::t -> if Pervasives.compare x a = 0 then y else assoc a t + | [] -> failwith "find";; + +let rec rev_assoc a l = + match l with + (x,y)::t -> if Pervasives.compare y a = 0 then x else rev_assoc a t + | [] -> failwith "find";; + +(* ------------------------------------------------------------------------- *) +(* Zipping, unzipping etc. *) +(* ------------------------------------------------------------------------- *) + +let rec zip l1 l2 = + match (l1,l2) with + ([],[]) -> [] + | (h1::t1,h2::t2) -> (h1,h2)::(zip t1 t2) + | _ -> failwith "zip";; + +let rec unzip = + function [] -> [],[] + | ((a,b)::rest) -> let alist,blist = unzip rest in + (a::alist,b::blist);; + +(* ------------------------------------------------------------------------- *) +(* Sharing out a list according to pattern in list-of-lists. *) +(* ------------------------------------------------------------------------- *) + +let rec shareout pat all = + if pat = [] then [] else + let l,r = chop_list (length (hd pat)) all in + l::(shareout (tl pat) r);; + +(* ------------------------------------------------------------------------- *) +(* Iterating functions over lists. *) +(* ------------------------------------------------------------------------- *) + +let rec do_list f l = + match l with + [] -> () + | (h::t) -> (f h; do_list f t);; + +(* ------------------------------------------------------------------------- *) +(* Sorting. *) +(* ------------------------------------------------------------------------- *) + +let rec sort cmp lis = + match lis with + [] -> [] + | piv::rest -> + let r,l = partition (cmp piv) rest in + (sort cmp l) @ (piv::(sort cmp r));; + +(* ------------------------------------------------------------------------- *) +(* Removing adjacent (NB!) equal elements from list. *) +(* ------------------------------------------------------------------------- *) + +let rec uniq l = + match l with + x::(y::_ as t) -> let t' = uniq t in + if Pervasives.compare x y = 0 then t' else + if t'==t then l else x::t' + | _ -> l;; + +(* ------------------------------------------------------------------------- *) +(* Convert list into set by eliminating duplicates. *) +(* ------------------------------------------------------------------------- *) + +let setify s = uniq (sort (fun x y -> Pervasives.compare x y <= 0) s);; + +(* ------------------------------------------------------------------------- *) +(* String operations (surely there is a better way...) *) +(* ------------------------------------------------------------------------- *) + +let implode l = itlist (^) l "";; + +let explode s = + let rec exap n l = + if n < 0 then l else + exap (n - 1) ((String.sub s n 1)::l) in + exap (String.length s - 1) [];; + +(* ------------------------------------------------------------------------- *) +(* Greatest common divisor. *) +(* ------------------------------------------------------------------------- *) + +let gcd = + let rec gxd x y = + if y = 0 then x else gxd y (x mod y) in + fun x y -> let x' = abs x and y' = abs y in + if x' < y' then gxd y' x' else gxd x' y';; + +(* ------------------------------------------------------------------------- *) +(* Some useful functions on "num" type. *) +(* ------------------------------------------------------------------------- *) + +let num_0 = Int 0 +and num_1 = Int 1 +and num_2 = Int 2 +and num_10 = Int 10;; + +let pow2 n = power_num num_2 (Int n);; +let pow10 n = power_num num_10 (Int n);; + +let numdom r = + let r' = Ratio.normalize_ratio (ratio_of_num r) in + num_of_big_int(Ratio.numerator_ratio r'), + num_of_big_int(Ratio.denominator_ratio r');; + +let numerator = fst o numdom +and denominator = snd o numdom;; + +let gcd_num n1 n2 = + num_of_big_int(Big_int.gcd_big_int (big_int_of_num n1) (big_int_of_num n2));; + +let lcm_num x y = + if x =/ num_0 & y =/ num_0 then num_0 + else abs_num((x */ y) // gcd_num x y);; + +(* ------------------------------------------------------------------------- *) +(* All pairs arising from applying a function over two lists. *) +(* ------------------------------------------------------------------------- *) + +let rec allpairs f l1 l2 = + match l1 with + h1::t1 -> itlist (fun x a -> f h1 x :: a) l2 (allpairs f t1 l2) + | [] -> [];; + +(* ------------------------------------------------------------------------- *) +(* Issue a report with a newline. *) +(* ------------------------------------------------------------------------- *) + +let report s = + Format.print_string s; Format.print_newline();; + +(* ------------------------------------------------------------------------- *) +(* Convenient function for issuing a warning. *) +(* ------------------------------------------------------------------------- *) + +let warn cond s = + if cond then report ("Warning: "^s) else ();; + +(* ------------------------------------------------------------------------- *) +(* Flags to switch on verbose mode. *) +(* ------------------------------------------------------------------------- *) + +let verbose = ref true;; +let report_timing = ref true;; + +(* ------------------------------------------------------------------------- *) +(* Switchable version of "report". *) +(* ------------------------------------------------------------------------- *) + +let remark s = + if !verbose then report s else ();; + +(* ------------------------------------------------------------------------- *) +(* Time a function. *) +(* ------------------------------------------------------------------------- *) + +let time f x = + if not (!report_timing) then f x else + let start_time = Sys.time() in + try let result = f x in + let finish_time = Sys.time() in + report("CPU time (user): "^(string_of_float(finish_time -. start_time))); + result + with e -> + let finish_time = Sys.time() in + Format.print_string("Failed after (user) CPU time of "^ + (string_of_float(finish_time -. start_time))^": "); + raise e;; + +(* ------------------------------------------------------------------------- *) +(* Versions of assoc and rev_assoc with default rather than failure. *) +(* ------------------------------------------------------------------------- *) + +let rec assocd a l d = + match l with + [] -> d + | (x,y)::t -> if Pervasives.compare x a = 0 then y else assocd a t d;; + +let rec rev_assocd a l d = + match l with + [] -> d + | (x,y)::t -> if Pervasives.compare y a = 0 then x else rev_assocd a t d;; + +(* ------------------------------------------------------------------------- *) +(* Version of map that avoids rebuilding unchanged subterms. *) +(* ------------------------------------------------------------------------- *) + +let rec qmap f l = + match l with + h::t -> let h' = f h and t' = qmap f t in + if h' == h & t' == t then l else h'::t' + | _ -> l;; + +(* ------------------------------------------------------------------------- *) +(* Merging and bottom-up mergesort. *) +(* ------------------------------------------------------------------------- *) + +let rec merge ord l1 l2 = + match l1 with + [] -> l2 + | h1::t1 -> match l2 with + [] -> l1 + | h2::t2 -> if ord h1 h2 then h1::(merge ord t1 l2) + else h2::(merge ord l1 t2);; + +let mergesort ord = + let rec mergepairs l1 l2 = + match (l1,l2) with + ([s],[]) -> s + | (l,[]) -> mergepairs [] l + | (l,[s1]) -> mergepairs (s1::l) [] + | (l,(s1::s2::ss)) -> mergepairs ((merge ord s1 s2)::l) ss in + fun l -> if l = [] then [] else mergepairs [] (map (fun x -> [x]) l);; + +(* ------------------------------------------------------------------------- *) +(* Common measure predicates to use with "sort". *) +(* ------------------------------------------------------------------------- *) + +let increasing f x y = Pervasives.compare (f x) (f y) < 0;; + +let decreasing f x y = Pervasives.compare (f x) (f y) > 0;; + +(* ------------------------------------------------------------------------- *) +(* Polymorphic finite partial functions via Patricia trees. *) +(* *) +(* The point of this strange representation is that it is canonical (equal *) +(* functions have the same encoding) yet reasonably efficient on average. *) +(* *) +(* Idea due to Diego Olivier Fernandez Pons (OCaml list, 2003/11/10). *) +(* ------------------------------------------------------------------------- *) + +type ('a,'b)func = + Empty + | Leaf of int * ('a*'b)list + | Branch of int * int * ('a,'b)func * ('a,'b)func;; + +(* ------------------------------------------------------------------------- *) +(* Undefined function. *) +(* ------------------------------------------------------------------------- *) + +let undefined = Empty;; + +(* ------------------------------------------------------------------------- *) +(* In case of equality comparison worries, better use this. *) +(* ------------------------------------------------------------------------- *) + +let is_undefined f = + match f with + Empty -> true + | _ -> false;; + +(* ------------------------------------------------------------------------- *) +(* Operation analagous to "map" for lists. *) +(* ------------------------------------------------------------------------- *) + +let mapf = + let rec map_list f l = + match l with + [] -> [] + | (x,y)::t -> (x,f(y))::(map_list f t) in + let rec mapf f t = + match t with + Empty -> Empty + | Leaf(h,l) -> Leaf(h,map_list f l) + | Branch(p,b,l,r) -> Branch(p,b,mapf f l,mapf f r) in + mapf;; + +(* ------------------------------------------------------------------------- *) +(* Operations analogous to "fold" for lists. *) +(* ------------------------------------------------------------------------- *) + +let foldl = + let rec foldl_list f a l = + match l with + [] -> a + | (x,y)::t -> foldl_list f (f a x y) t in + let rec foldl f a t = + match t with + Empty -> a + | Leaf(h,l) -> foldl_list f a l + | Branch(p,b,l,r) -> foldl f (foldl f a l) r in + foldl;; + +let foldr = + let rec foldr_list f l a = + match l with + [] -> a + | (x,y)::t -> f x y (foldr_list f t a) in + let rec foldr f t a = + match t with + Empty -> a + | Leaf(h,l) -> foldr_list f l a + | Branch(p,b,l,r) -> foldr f l (foldr f r a) in + foldr;; + +(* ------------------------------------------------------------------------- *) +(* Mapping to sorted-list representation of the graph, domain and range. *) +(* ------------------------------------------------------------------------- *) + +let graph f = setify (foldl (fun a x y -> (x,y)::a) [] f);; + +let dom f = setify(foldl (fun a x y -> x::a) [] f);; + +let ran f = setify(foldl (fun a x y -> y::a) [] f);; + +(* ------------------------------------------------------------------------- *) +(* Application. *) +(* ------------------------------------------------------------------------- *) + +let applyd = + let rec apply_listd l d x = + match l with + (a,b)::t -> let c = Pervasives.compare x a in + if c = 0 then b else if c > 0 then apply_listd t d x else d x + | [] -> d x in + fun f d x -> + let k = Hashtbl.hash x in + let rec look t = + match t with + Leaf(h,l) when h = k -> apply_listd l d x + | Branch(p,b,l,r) when (k lxor p) land (b - 1) = 0 + -> look (if k land b = 0 then l else r) + | _ -> d x in + look f;; + +let apply f = applyd f (fun x -> failwith "apply");; + +let tryapplyd f a d = applyd f (fun x -> d) a;; + +let defined f x = try apply f x; true with Failure _ -> false;; + +(* ------------------------------------------------------------------------- *) +(* Undefinition. *) +(* ------------------------------------------------------------------------- *) + +let undefine = + let rec undefine_list x l = + match l with + (a,b as ab)::t -> + let c = Pervasives.compare x a in + if c = 0 then t + else if c < 0 then l else + let t' = undefine_list x t in + if t' == t then l else ab::t' + | [] -> [] in + fun x -> + let k = Hashtbl.hash x in + let rec und t = + match t with + Leaf(h,l) when h = k -> + let l' = undefine_list x l in + if l' == l then t + else if l' = [] then Empty + else Leaf(h,l') + | Branch(p,b,l,r) when k land (b - 1) = p -> + if k land b = 0 then + let l' = und l in + if l' == l then t + else (match l' with Empty -> r | _ -> Branch(p,b,l',r)) + else + let r' = und r in + if r' == r then t + else (match r' with Empty -> l | _ -> Branch(p,b,l,r')) + | _ -> t in + und;; + +(* ------------------------------------------------------------------------- *) +(* Redefinition and combination. *) +(* ------------------------------------------------------------------------- *) + +let (|->),combine = + let newbranch p1 t1 p2 t2 = + let zp = p1 lxor p2 in + let b = zp land (-zp) in + let p = p1 land (b - 1) in + if p1 land b = 0 then Branch(p,b,t1,t2) + else Branch(p,b,t2,t1) in + let rec define_list (x,y as xy) l = + match l with + (a,b as ab)::t -> + let c = Pervasives.compare x a in + if c = 0 then xy::t + else if c < 0 then xy::l + else ab::(define_list xy t) + | [] -> [xy] + and combine_list op z l1 l2 = + match (l1,l2) with + [],_ -> l2 + | _,[] -> l1 + | ((x1,y1 as xy1)::t1,(x2,y2 as xy2)::t2) -> + let c = Pervasives.compare x1 x2 in + if c < 0 then xy1::(combine_list op z t1 l2) + else if c > 0 then xy2::(combine_list op z l1 t2) else + let y = op y1 y2 and l = combine_list op z t1 t2 in + if z(y) then l else (x1,y)::l in + let (|->) x y = + let k = Hashtbl.hash x in + let rec upd t = + match t with + Empty -> Leaf (k,[x,y]) + | Leaf(h,l) -> + if h = k then Leaf(h,define_list (x,y) l) + else newbranch h t k (Leaf(k,[x,y])) + | Branch(p,b,l,r) -> + if k land (b - 1) <> p then newbranch p t k (Leaf(k,[x,y])) + else if k land b = 0 then Branch(p,b,upd l,r) + else Branch(p,b,l,upd r) in + upd in + let rec combine op z t1 t2 = + match (t1,t2) with + Empty,_ -> t2 + | _,Empty -> t1 + | Leaf(h1,l1),Leaf(h2,l2) -> + if h1 = h2 then + let l = combine_list op z l1 l2 in + if l = [] then Empty else Leaf(h1,l) + else newbranch h1 t1 h2 t2 + | (Leaf(k,lis) as lf),(Branch(p,b,l,r) as br) -> + if k land (b - 1) = p then + if k land b = 0 then + (match combine op z lf l with + Empty -> r | l' -> Branch(p,b,l',r)) + else + (match combine op z lf r with + Empty -> l | r' -> Branch(p,b,l,r')) + else + newbranch k lf p br + | (Branch(p,b,l,r) as br),(Leaf(k,lis) as lf) -> + if k land (b - 1) = p then + if k land b = 0 then + (match combine op z l lf with + Empty -> r | l' -> Branch(p,b,l',r)) + else + (match combine op z r lf with + Empty -> l | r' -> Branch(p,b,l,r')) + else + newbranch p br k lf + | Branch(p1,b1,l1,r1),Branch(p2,b2,l2,r2) -> + if b1 < b2 then + if p2 land (b1 - 1) <> p1 then newbranch p1 t1 p2 t2 + else if p2 land b1 = 0 then + (match combine op z l1 t2 with + Empty -> r1 | l -> Branch(p1,b1,l,r1)) + else + (match combine op z r1 t2 with + Empty -> l1 | r -> Branch(p1,b1,l1,r)) + else if b2 < b1 then + if p1 land (b2 - 1) <> p2 then newbranch p1 t1 p2 t2 + else if p1 land b2 = 0 then + (match combine op z t1 l2 with + Empty -> r2 | l -> Branch(p2,b2,l,r2)) + else + (match combine op z t1 r2 with + Empty -> l2 | r -> Branch(p2,b2,l2,r)) + else if p1 = p2 then + (match (combine op z l1 l2,combine op z r1 r2) with + (Empty,r) -> r | (l,Empty) -> l | (l,r) -> Branch(p1,b1,l,r)) + else + newbranch p1 t1 p2 t2 in + (|->),combine;; + +(* ------------------------------------------------------------------------- *) +(* Special case of point function. *) +(* ------------------------------------------------------------------------- *) + +let (|=>) = fun x y -> (x |-> y) undefined;; + +(* ------------------------------------------------------------------------- *) +(* Grab an arbitrary element. *) +(* ------------------------------------------------------------------------- *) + +let rec choose t = + match t with + Empty -> failwith "choose: completely undefined function" + | Leaf(h,l) -> hd l + | Branch(b,p,t1,t2) -> choose t1;; + +(* ------------------------------------------------------------------------- *) +(* Install a trivial printer for the general polymorphic case. *) +(* ------------------------------------------------------------------------- *) + +(* let print_fpf (f:('a,'b)func) = Format.print_string "";; + +#install_printer print_fpf;; +*) + +(* ------------------------------------------------------------------------- *) +(* Set operations parametrized by equality (from Steven Obua). *) +(* ------------------------------------------------------------------------- *) + +let rec mem' eq = + let rec mem x lis = + match lis with + [] -> false + | (h::t) -> eq x h or mem x t + in mem;; + +let insert' eq x l = + if mem' eq x l then l else x::l;; + +let union' eq l1 l2 = itlist (insert' eq) l1 l2;; + +let unions' eq l = itlist (union' eq) l [];; + +let subtract' eq l1 l2 = filter (fun x -> not (mem' eq x l2)) l1;; + +(* ------------------------------------------------------------------------- *) +(* Accepts decimal, hex or binary numeral, using C notation 0x... for hex *) +(* and analogous 0b... for binary. *) +(* ------------------------------------------------------------------------- *) + +let num_of_string = + let values = + ["0",0; "1",1; "2",2; "3",3; "4",4; + "5",5; "6",6; "7",7; "8",8; "9",9; + "a",10; "A",10; "b",11; "B",11; + "c",12; "C",12; "d",13; "D",13; + "e",14; "E",14; "f",15; "F",15] in + let valof b s = + let v = Int(assoc s values) in + if v failwith "num_of_string: no digits after base indicator" + | [h] -> valof b h + | h::t -> valof b h +/ b */ num_of_stringlist b t in + fun s -> + match explode(s) with + [] -> failwith "num_of_string: no digits" + | "0"::"x"::hexdigits -> num_of_stringlist sixteen (rev hexdigits) + | "0"::"b"::bindigits -> num_of_stringlist two (rev bindigits) + | decdigits -> num_of_stringlist ten (rev decdigits);; + +(* ------------------------------------------------------------------------- *) +(* Convenient conversion between files and (lists of) strings. *) +(* ------------------------------------------------------------------------- *) + +let strings_of_file filename = + let fd = try Pervasives.open_in filename + with Sys_error _ -> + failwith("strings_of_file: can't open "^filename) in + let rec suck_lines acc = + try let l = Pervasives.input_line fd in + suck_lines (l::acc) + with End_of_file -> rev acc in + let data = suck_lines [] in + (Pervasives.close_in fd; data);; + +let string_of_file filename = + end_itlist (fun s t -> s^"\n"^t) (strings_of_file filename);; + +let file_of_string filename s = + let fd = Pervasives.open_out filename in + output_string fd s; close_out fd;; + +end;; diff --git a/text_formalization/general/package_constant.hl b/text_formalization/general/package_constant.hl new file mode 100644 index 0000000..a74ee0a --- /dev/null +++ b/text_formalization/general/package_constant.hl @@ -0,0 +1,67 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* General Utility *) +(* Author: Thomas C. Hales *) +(* Date: 2010-02-11 *) +(* ========================================================================== *) + + +(* ------------------------------------------------------------------ *) +(* LOCAL DEFINITIONS , from Jordan curve lib_ext.ml *) +(* ------------------------------------------------------------------ *) + + + +module type Local_definition_type = sig + + +end;; + + +module Local_definition : Local_definition_type = struct + +let local_defs = ref ([]:(string * (string * term)) list);; + +let add_interface (sym,tm) = + if (can (assoc sym) (!the_overload_skeletons)) then + (overload_interface (sym,tm)) + else (override_interface(sym,tm));; + +let local_definition package_name tm = + let list_mk_forall(vars,bod) = itlist (curry mk_forall) vars bod in + let avs,bod = strip_forall tm in + let l,r = try dest_eq bod + with Failure _ -> failwith "new_local_definition: Not an equation" in + let lv,largs = strip_comb l in + let cname,ty = dest_var lv in + let cname' = package_name^"'"^cname in + let lv' = mk_var(cname',ty) in + let l' = list_mk_comb(lv',largs) in + let bod' = mk_eq(l',r) in + let tm'= list_mk_forall(avs,bod') in + let thm = new_definition tm' in + let _ = (local_defs := (package_name,(cname,lv'))::(!local_defs)) in + let _ = add_interface(cname,lv') in + thm;; + +let reduce_local_interface(package_name) = + map (reduce_interface o snd) + (filter (fun x -> ((fst x) = package_name)) !local_defs);; + +let mk_local_interface(package_name) = + map (add_interface o snd) + (filter (fun x -> ((fst x) = package_name)) !local_defs);; + + +(* adapted from HOL Light code, true if it is a local def. *) + +let is_benign = + fun tm -> + let tm' = snd(strip_forall tm) in + try let th,th' = tryfind (fun th -> th,PART_MATCH I th tm') + (!the_definitions) in + (can (PART_MATCH I th') (concl th)) + with Failure _ -> false;; + +end;; diff --git a/text_formalization/general/parser_verbose.hl b/text_formalization/general/parser_verbose.hl new file mode 100644 index 0000000..521c96d --- /dev/null +++ b/text_formalization/general/parser_verbose.hl @@ -0,0 +1,297 @@ +(* ========================================================================= *) +(* Lexical analyzer, type and preterm parsers. *) +(* *) +(* John Harrison, University of Cambridge Computer Laboratory *) +(* *) +(* (c) Copyright, University of Cambridge 1998 *) +(* (c) Copyright, John Harrison 1998-2007 *) +(* ========================================================================= *) + +(* +Slightly more verbose error messages added by thales, July 2010 +*) + + + +module Parser_verbose = struct + +let string_of_lexcode = function + Ident s -> s + |Resword s -> s;; + + let string_of_lexcodel r = itlist (fun a b -> string_of_lexcode a^" "^b) r "";; + +let err_lex_rest prs i = + try prs i with + Failure s -> failwith (s^ "\n unread tokens:\n"^string_of_lexcodel i);; + +let parse_pretype_verbose = + let btyop n n' x y = Ptycon(n,[x;y]) + and mk_apptype = + function + ([s],[]) -> s + | (tys,[c]) -> Ptycon(c,tys) + | _ -> failwith "Bad type construction" + and type_atom input = + match input with + (Ident s)::rest -> + (try pretype_of_type(assoc s (type_abbrevs())) with Failure _ -> + if try get_type_arity s = 0 with Failure _ -> false + then Ptycon(s,[]) else Utv(s)),rest + | _ -> raise Noparse + and type_constructor input = + match input with + (Ident s)::rest -> if try get_type_arity s > 0 with Failure _ -> false + then s,rest else raise Noparse + | _ -> raise Noparse in + let rec pretype i = rightbin sumtype (a (Resword "->")) (btyop "fun") "proper use of type operator (->)" i + and sumtype i = rightbin prodtype (a (Ident "+")) (btyop "sum") "proper use of type operator (+)" i + and prodtype i = rightbin carttype (a (Ident "#")) (btyop "prod") "proper use of type operator (#)" i + and carttype i = leftbin apptype (a (Ident "^")) (btyop "cart") " proper use of type operator (^) " i + and apptype i = (atomictypes ++ (type_constructor >> (fun x -> [x]) + || nothing) >> mk_apptype) i + and atomictypes i = + (((a (Resword "(")) ++ typelist ++ a (Resword ")") >> (snd o fst)) + || type_atom >> (fun x -> [x])) i + and typelist i = listof pretype (a (Ident ",")) "comma separated list for type constructor" i in + pretype;; + +let parse_preterm_verbose = + let rec pfrees ptm acc = + match ptm with + Varp(v,pty) -> + if v = "" & pty = dpty then acc + else if can get_const_type v or can num_of_string v + or exists (fun (w,_) -> v = w) (!the_interface) then acc + else insert ptm acc + | Constp(_,_) -> acc + | Combp(p1,p2) -> pfrees p1 (pfrees p2 acc) + | Absp(p1,p2) -> subtract (pfrees p2 acc) (pfrees p1 []) + | Typing(p,_) -> pfrees p acc in + let pdest_eq (Combp(Combp(Varp(("="|"<=>"),_),l),r)) = l,r in + let pmk_let (letbindings,body) = + let vars,tms = unzip (map pdest_eq letbindings) in + let lend = Combp(Varp("LET_END",dpty),body) in + let abs = itlist (fun v t -> Absp(v,t)) vars lend in + let labs = Combp(Varp("LET",dpty),abs) in + rev_itlist (fun x f -> Combp(f,x)) tms labs in + let pmk_vbinder(n,v,bod) = + if n = "\\" then Absp(v,bod) + else Combp(Varp(n,dpty),Absp(v,bod)) in + let pmk_binder(n,vs,bod) = + itlist (fun v b -> pmk_vbinder(n,v,b)) vs bod in + let pmk_set_enum ptms = + itlist (fun x t -> Combp(Combp(Varp("INSERT",dpty),x),t)) ptms + (Varp("EMPTY",dpty)) in + let pgenvar = + let gcounter = ref 0 in + fun () -> let count = !gcounter in + (gcounter := count + 1; + Varp("GEN%PVAR%"^(string_of_int count),dpty)) in + let pmk_exists(v,ptm) = Combp(Varp("?",dpty),Absp(v,ptm)) in + let pmk_list els = + itlist (fun x y -> Combp(Combp(Varp("CONS",dpty),x),y)) + els (Varp("NIL",dpty)) in + let pmk_bool = + let tt = Varp("T",dpty) and ff = Varp("F",dpty) in + fun b -> if b then tt else ff in + let pmk_char c = + let lis = map (fun i -> pmk_bool((c / (1 lsl i)) mod 2 = 1)) (0--7) in + itlist (fun x y -> Combp(y,x)) lis (Varp("ASCII",dpty)) in + let pmk_string s = + let ns = map (fun i -> Char.code(String.get s i)) + (0--(String.length s - 1)) in + pmk_list(map pmk_char ns) in + let pmk_setcompr (fabs,bvs,babs) = + let v = pgenvar() in + let bod = itlist (curry pmk_exists) bvs + (Combp(Combp(Combp(Varp("SETSPEC",dpty),v),babs),fabs)) in + Combp(Varp("GSPEC",dpty),Absp(v,bod)) in + let pmk_setabs (fabs,babs) = + let evs = + let fvs = pfrees fabs [] + and bvs = pfrees babs [] in + if length fvs <= 1 or bvs = [] then fvs + else intersect fvs bvs in + pmk_setcompr (fabs,evs,babs) in + let rec mk_precedence infxs prs inp = + match infxs with + (s,(p,at))::_ -> + let topins,rest = partition (fun (s',pat') -> pat' = (p,at)) infxs in + (if at = "right" then rightbin else leftbin) + (mk_precedence rest prs) + (end_itlist (||) (map (fun (s,_) -> a (Ident s)) topins)) + (fun (Ident op) x y -> Combp(Combp(Varp(op,dpty),x),y)) + ("preterm after binary operator ("^s^")") + inp + | _ -> prs inp in + let pmk_geq s t = Combp(Combp(Varp("GEQ",dpty),s),t) in + let pmk_pattern ((pat,guards),res) = + let x = pgenvar() and y = pgenvar() in + let vs = pfrees pat [] + and bod = + if guards = [] then + Combp(Combp(Varp("_UNGUARDED_PATTERN",dpty),pmk_geq pat x), + pmk_geq res y) + else + Combp(Combp(Combp(Varp("_GUARDED_PATTERN",dpty),pmk_geq pat x), + hd guards), + pmk_geq res y) in + Absp(x,Absp(y,itlist (curry pmk_exists) vs bod)) in + let pretype = parse_pretype_verbose + and string inp = + match inp with + Ident s::rst when String.length s >= 2 & + String.sub s 0 1 = "\"" & + String.sub s (String.length s - 1) 1 = "\"" + -> String.sub s 1 (String.length s - 2),rst + | _ -> raise Noparse + and singleton1 x = [x] + and lmk_ite (((((_,b),_),l),_),r) = + Combp(Combp(Combp(Varp("COND",dpty),b),l),r) + and lmk_typed = + function (p,[]) -> p | (p,[ty]) -> Typing(p,ty) | _ -> fail() + and lmk_let (((_,bnds),_),ptm) = pmk_let (bnds,ptm) + and lmk_binder ((((s,h),t),_),p) = pmk_binder(s,h::t,p) + and lmk_setenum(l,_) = pmk_set_enum l + and lmk_setabs(((l,_),r),_) = pmk_setabs(l,r) + and lmk_setcompr(((((f,_),vs),_),b),_) = + pmk_setcompr(f,pfrees vs [],b) + and lmk_decimal ((_,l0),ropt) = + let l,r = if ropt = [] then l0,"1" else + let r0 = hd ropt in + let n_l = num_of_string l0 + and n_r = num_of_string r0 in + let n_d = power_num (Int 10) (Int (String.length r0)) in + let n_n = n_l */ n_d +/ n_r in + string_of_num n_n,string_of_num n_d in + Combp(Combp(Varp("DECIMAL",dpty),Varp(l,dpty)),Varp(r,dpty)) + and lmk_univ((_,pty),_) = + Typing(Varp("UNIV",dpty),Ptycon("fun",[pty;Ptycon("bool",[])])) + and any_identifier = + function + ((Ident s):: rest) -> s,rest + | _ -> raise Noparse + and identifier = + function + ((Ident s):: rest) -> + if can get_infix_status s or is_prefix s or parses_as_binder s + then raise Noparse else s,rest + | _ -> raise Noparse + and binder = + function + ((Ident s):: rest) -> + if parses_as_binder s then s,rest else raise Noparse + | _ -> raise Noparse + and pre_fix = + function + ((Ident s):: rest) -> + if is_prefix s then s,rest else raise Noparse + | _ -> raise Noparse in + let rec preterm i = + mk_precedence (infixes()) (typed_appl_preterm) i + and nocommapreterm i = + let infs = filter (fun (s,_) -> s <> ",") (infixes()) in + mk_precedence infs typed_appl_preterm i + and typed_appl_preterm i = + (appl_preterm ++ + possibly (a (Resword ":") ++ pretype >> snd) + >> lmk_typed) i + and appl_preterm i = + (pre_fix ++ appl_preterm + >> (fun (x,y) -> Combp(Varp(x,dpty),y)) + || binder_preterm ++ many binder_preterm >> + (fun (h,t) -> itlist (fun x y -> Combp(y,x)) (rev t) h)) i + and binder_preterm i = + (a (Resword "let") ++ + leftbin (preterm >> singleton1) (a (Resword "and")) (K (@)) "binding" ++ + a (Resword "in") ++ + preterm + >> lmk_let + || binder ++ + typed_apreterm ++ + many typed_apreterm ++ + a (Resword ".") ++ + preterm + >> lmk_binder + || atomic_preterm) i + and typed_apreterm i = + (atomic_preterm ++ + possibly (a (Resword ":") ++ pretype >> snd) + >> lmk_typed) i + and atomic_preterm i = + (try_user_parser + || (a (Resword "(") ++ a (Resword ":")) ++ pretype ++ a (Resword ")") + >> lmk_univ + || (a (Resword "(") ++ a (Resword ":")) ++ pretype + >>(fun _ -> failwith "closing right parenthesis on universe expected") + || (a (Resword "(") ++ a (Resword ":")) + >>(fun _ -> failwith "pretype in universe construction expected") + || string + >> pmk_string + || a (Resword "(") ++ + (any_identifier >> (fun s -> Varp(s,dpty))) ++ + a (Resword ")") + >> (snd o fst) + || a (Resword "(") ++ + preterm ++ + a (Resword ")") + >> (snd o fst) +(* || a (Resword "(") ++ + preterm >> (fun _ -> failwith "closing right parenthesis expected") + || a (Resword "(") >> (fun _ -> failwith "preterm following left parenthesis expected") *) + || a (Resword "if") ++ + preterm ++ + a (Resword "then") ++ + preterm ++ + a (Resword "else") ++ + preterm + >> lmk_ite + || (a (Resword "if") ) ++ preterm ++ a (Resword "then") ++ preterm ++ a (Resword "else") >> (fun _ -> failwith "malformed else clause") + || (a (Resword "if") ) ++ preterm ++ a (Resword "then") ++ preterm >> (fun _ -> failwith "missing else following then clause") + || (a (Resword "if") ) ++ preterm ++ a (Resword "then") >> (fun _ -> failwith "malformed then clause in if-then-else statement") + || (a (Resword "if") ) ++ preterm >> (fun _ -> failwith "missing 'then' reserved word if-then-else statement") + || (a (Resword "if") ) >> (fun _ -> failwith "malformed if-then-else") + || a (Resword "[") ++ + elistof preterm (a (Resword ";")) "semicolon separated list of preterms" ++ + a (Resword "]") + >> (pmk_list o snd o fst) + || a (Resword "[") ++ + elistof preterm (a (Resword ";")) "semicolon separated list of preterms" + >> (fun _ -> failwith "closing square bracket on list expected") + || a (Resword "{") ++ + (elistof nocommapreterm (a (Ident ",")) "comma separated list of preterms" ++ a (Resword "}") + >> lmk_setenum + || preterm ++ a (Resword "|") ++ preterm ++ a (Resword "}") + >> lmk_setabs + || preterm ++ a (Resword "|") ++ preterm ++ + a (Resword "|") ++ preterm ++ a (Resword "}") + >> lmk_setcompr) + >> snd + || a (Resword "{") >> (fun _ -> failwith "malformed set {}") + || a (Resword "match") ++ preterm ++ a (Resword "with") ++ clauses + >> (fun (((_,e),_),c) -> Combp(Combp(Varp("_MATCH",dpty),e),c)) + || a (Resword "match") >> (fun _ -> failwith "malformed match-with statement") + || a (Resword "function") ++ clauses + >> (fun (_,c) -> Combp(Varp("_FUNCTION",dpty),c)) + || a (Resword "function") >> (fun _ -> failwith "malformed function and pattern clauses") + || a (Ident "#") ++ identifier ++ + possibly (a (Resword ".") ++ identifier >> snd) + >> lmk_decimal + || a (Ident "#") >> (fun _ -> failwith "malformed numerical # identifier") + || identifier + >> (fun s -> Varp(s,dpty))) i + and pattern i = + (preterm ++ possibly (a (Resword "when") ++ preterm >> snd)) i + and clause i = + ((pattern ++ (a (Resword "->") ++ preterm >> snd)) >> pmk_pattern) i + and clauses i = + ((possibly (a (Resword "|")) ++ + listof clause (a (Resword "|")) "pattern-match clause" >> snd) + >> end_itlist (fun s t -> Combp(Combp(Varp("_SEQPATTERN",dpty),s),t))) i in + (fun inp -> + match inp with + [Ident s] -> Varp(s,dpty),[] + | _ -> preterm inp);; + +end;; diff --git a/text_formalization/general/print_types.hl b/text_formalization/general/print_types.hl new file mode 100644 index 0000000..f37225f --- /dev/null +++ b/text_formalization/general/print_types.hl @@ -0,0 +1,92 @@ +(* +copied from repository 'http://seanmcl-ocaml-lib.googlecode.com/svn' +*) +(* + Print the types of the atoms of terms, thms and the goal. +*) +module Print_types + : sig + val print_goal_types: unit -> unit + val print_thm_types: thm -> unit + val print_term_types: term -> unit + val print_goal_var_overload: unit -> unit + + val get_term_types: term -> (string*hol_type) list + val get_const_types: term -> (string*hol_type) list + + (* I've elided the common symbols from the list + to avoid clutter. You can add and remove names + of constants from this list with (un)suppress *) + val suppress: string -> unit + val unsuppress: string -> unit + + end = +struct + + let suppressed = ref + ["==>";"?";"!";"/\\";"\\/";",";"~";"APPEND";"CONS";"HD";"LAST"; + "NIL";"=";"real_lt";"real_gt";"real_le";"real_ge";"BIT0";"BIT1";"NUMERAL"; + "DECIMAL";"real_sub";"real_add";"real_neg"; + "real_of_num";"_0";"_1";"real_div";"real_mul";"real_pow";"COND";"LET";"LET_END"] + + let suppress s = suppressed := s :: !suppressed + + let unsuppress s = suppressed := List.filter ((!=) s) (!suppressed) + + let rec get_term_types tm = + match tm with + Var(s,t) -> if mem s !suppressed then [] else [(s,t)] + | Const(s,t) -> if mem s !suppressed then [] else [(s,t)] + | Comb (t1,t2) -> get_term_types t1 @ get_term_types t2 + | Abs (t1,t2) -> get_term_types t1 @ get_term_types t2 + + let rec get_const_types tm = + match tm with + Var(s,t) -> [] + | Const(s,t) -> if mem s !suppressed then [] else [(s,t)] + | Comb (t1,t2) -> get_const_types t1 @ get_const_types t2 + | Abs (t1,t2) -> get_const_types t1 @ get_const_types t2 + + let rec get_var_types = function + Var(s,t) -> [(s,t)] + | Const(s,t) -> [] + | Comb (t1,t2) -> get_var_types t1 @ get_var_types t2 + | Abs (t1,t2) -> get_var_types t1 @ get_var_types t2 + + let print_atom_type : string * hol_type -> unit = + fun (s,t) -> + begin + print_string ("(\"" ^ s ^ "\", "); + print_type t; + print_string ")\n" + end + + let setify_types tm = ((sort (<)) o setify o get_term_types) tm + + let print_term_types = List.iter print_atom_type o setify_types + + let print_thm_types tm = print_term_types (concl tm) + + let print_goal_types() = + let (asms,g) = top_goal() in + let tms = g::asms in + let tm = end_itlist (curry mk_conj) tms in + (print_term_types tm) + + let print_goal_var_overload() = + let (asms,g) = top_goal() in + let tms = g::asms in + let tm = end_itlist (curry mk_conj) tms in + let vt = ((sort (<)) o setify) (get_var_types tm) in + let ct = ((sort (<)) o setify) (get_const_types tm @ vt) in + let ft x = filter (fun t -> (fst t = fst x) && not(snd t = snd x)) ct in + let ov = ((sort (<)) o setify) (List.flatten ( map ft vt )) in + if (List.length ov >0) then + (print_string "Warning: type-overloaded variables\n"; + List.iter print_atom_type ov) + else ();; + + +end;; + +open Print_types;; diff --git a/text_formalization/general/prove_by_refinement.hl b/text_formalization/general/prove_by_refinement.hl new file mode 100644 index 0000000..1bfe707 --- /dev/null +++ b/text_formalization/general/prove_by_refinement.hl @@ -0,0 +1,125 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* prove_by_refinement *) +(* Chapter: General *) +(* Author: Thomas C. Hales *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + +(* + +This is an alternative to "prove" +Instead of chaining tactics together with THEN and THENL, +a list is given of all the tactics used, in the exact same order as the sequence of steps used with "e" + +The advantage of this over "prove" is that the list exactly matches the sequence of steps with "e". +There is no need to reorganize the interactive proof by working out what branches were followed +when multiple goals are in play. + +The navigation commands are for a proof set up with prove_by_step. It allows one to step +through the tactics in the tactic list one-by-one for purposes of debugging. + +*) + + + +module type Prove_by_refinement_type = sig + + val prove_by_refinement : term*(tactic list) -> thm + val prove_by_refinement_2 : string*term*(tactic list) -> thm + +(* + val prove_by_step : term*(tactic list) -> goalstack +*) + +(* navigation of prove_by_step: *) + +(* + val e' : unit -> goalstack (* one step forward *) + val f' : int -> goalstack (* n steps forward *) + val b' : unit -> goalstack (* one step backwards *) + val p' : unit -> goalstack (* print goalstack *) + val r' : unit -> goalstack (* revert to original goal *) + val n' : unit -> int (* number of next step *) + val l' : unit -> int (* total number of steps *) + val x' : unit -> int (* step position of next error *) +*) + +end;; + + +module Prove_by_refinement : Prove_by_refinement_type = struct + + + +(* adapted from +hol_til_2005/HOL_TIL_2005/FLYSPECK_PUB_9_2004/hol_light_o/hol-ext/tactics_2.ml +:prove_by_refinement *) + + + + let prove_by_refinement(t,(tacl:tactic list)) = + let gstate = mk_goalstate ([],t) in + let _,sgs,just = rev_itlist + (fun tac gs -> by + (tac) gs) + tacl gstate in + let th = if sgs = [] then just null_inst [] + else failwith "BY_REFINEMENT_PROOF: Unsolved goals" in + let t' = concl th in + if t' = t then th else + try EQ_MP (ALPHA t' t) th + with Failure _ -> failwith "prove_by_refinement: generated wrong theorem";; + + let prove_by_refinement_2(thm_name,t,(tacl:tactic list)) = + let gstate = mk_goalstate ([],t) in + let ctacl = zip (0--(List.length tacl -1)) tacl in + let _,sgs,just = rev_itlist + (fun (i,tac) gs -> + try by + (tac) gs + with Failure s -> + let _ = print_goalstack ([gs]) in + let _ = report ("Proof of "^thm_name^" fails at step: "^(string_of_int i)) in + failwith s + ) + ctacl gstate in + let th = if sgs = [] then just null_inst [] + else failwith "BY_REFINEMENT_PROOF: Unsolved goals" in + let t' = concl th in + if t' = t then th else + try EQ_MP (ALPHA t' t) th + with Failure _ -> failwith "prove_by_refinement: generated wrong theorem";; + + +(* replaying proof by refinement *) + +(* + let tl = ref ([]:tactic list);; + let step = ref 0;; + let gtm = ref `T`;; + + let g_step t = (step:=0; gtm := t; g t);; + let e_step() = let gs = e(List.nth (!tl) (!step)) in (step:= (!step + 1);gs);; + let rec f_step n = if (n<=0) then p() else if (n=1) then e_step() else f_step (n-1);; + let p_step() =p();; + let get_step() = (!step);; + let get_steplength() = List.length (!tl);; + + let b_step() = + if (!step <= 0) then failwith "Can't back up any more" + else let gs = b() in (step:= (!step -1);gs);; + + let rec next_error () = if (!step >= List.length (!tl)) then (!step) else + try ((let _ = e(List.nth (!tl) (!step)) in () ) ; step:= (!step + 1);next_error()) + with Failure _ -> (!step);; + + let prove_by_step (gl,t) = + (tl := t;g_step gl);; + let r_step () = (prove_by_step (!gtm,!tl));; (* revert *) + + let (e',f',b',p',r',n',l',x') = (e_step,f_step,b_step,p_step,r_step,get_step,get_steplength,next_error);; +*) + +end;; diff --git a/text_formalization/general/sphere.hl b/text_formalization/general/sphere.hl new file mode 100644 index 0000000..e21f725 --- /dev/null +++ b/text_formalization/general/sphere.hl @@ -0,0 +1,851 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Definitions: (General definitions file) *) +(* Chapter: General *) +(* Author: Thomas C. Hales *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + +(* needs "Multivariate/flyspeck.ml";; *) + + +module Sphere = struct + +prioritize_real();; + +let ineq = define + `(!c. ineq [] c <=> c) + /\ (!a x b xs c. ineq (CONS (a,x,b) xs) c <=> a <= x /\ x <= b ==> ineq xs c)`;; + +let all_forall bod = + let mk_forall = mk_binder "!" in + itlist (curry mk_forall) (sort (<) (frees bod)) bod;; + +let periodic = new_definition `periodic (f:num->A) n = (!i. (f (i+n) = f (i:num)))`;; + + +(* symmetric difference *) + +let SDIFF = new_definition `SDIFF X Y = (X DIFF Y) UNION (Y DIFF X)`;; + +(* +With the following definition, we should have +atn2(x,y) = pi - Arg(complex(-- x, y)), +including in the degenerate cases. In this sense, it is the "right" definition. +*) + +let atn2 = new_definition(`atn2(x,y) = + if ( abs y < x ) then atn(y / x) else + (if (&0 < y) then ((pi / &2) - atn(x / y)) else + (if (y < &0) then (-- (pi/ &2) - atn (x / y)) else ( pi )))`);; + +(* ------------------------------------------------------------------ *) + +(* +f = \x. a x^2 + b x + c, extract a b c +*) + + let abc_of_quadratic = +new_definition `abc_of_quadratic f = + let c = f (&0) in + let p = f (&1) in + let n = f (-- &1) in + ((p + n)/(&2) - c, (p -n)/(&2), c)` ;; + + + let quadratic_root_plus = + new_definition `quadratic_root_plus (a, b, c) = + ( -- b + sqrt(b pow 2 - &4 * a * c))/ (&2 * a)`;; + + + +(* ------------------------------------------------------------------ *) + +let sqrt8 = new_definition (`sqrt8 = sqrt (&8) `);; +let sqrt2 = new_definition (`sqrt2 = sqrt (&2) `);; +let sqrt3 = new_definition `sqrt3 = sqrt(&3)`;; + + +let pi_rt18 = new_definition(`pi_rt18= pi/(sqrt (&18))`);; + + +(* ------------------------------------------------------------------ *) +(* This polynomial is essentially the Cayley-Menger determinant. *) +(* ------------------------------------------------------------------ *) +let delta_x = new_definition (`delta_x x1 x2 x3 x4 x5 x6 = + x1*x4*(--x1 + x2 + x3 -x4 + x5 + x6) + + x2*x5*(x1 - x2 + x3 + x4 -x5 + x6) + + x3*x6*(x1 + x2 - x3 + x4 + x5 - x6) + -x2*x3*x4 - x1*x3*x5 - x1*x2*x6 -x4*x5*x6`);; + +let delta_y = new_definition `delta_y y1 y2 y3 y4 y5 y6 = + delta_x (y1*y1) (y2*y2) (y3*y3) (y4*y4) (y5*y5) (y6*y6)`;; + +let edge_flat = new_definition`edge_flat y1 y2 y3 y5 y6 = + sqrt(quadratic_root_plus (abc_of_quadratic ( + \x4. -- delta_x (y1*y1) (y2*y2) (y3*y3) x4 (y5*y5) (y6*y6))))`;; + +let edge_flat2_x = new_definition `edge_flat2_x x1 x2 x3 x4 x5 x6 = + (edge_flat (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x5) (sqrt x6)) pow 2`;; (* x4 dummy *) + +let edge_flat_x = new_definition`edge_flat_x x1 x2 x3 (x4:real) x5 x6 = + edge_flat (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x5) (sqrt x6)`;; + + +(* ------------------------------------------------------------------ *) +(* The partial derivative of delta_x with respect to x4. *) +(* ------------------------------------------------------------------ *) + +let delta_x4= new_definition(`delta_x4 x1 x2 x3 x4 x5 x6 + = -- x2* x3 - x1* x4 + x2* x5 + + x3* x6 - x5* x6 + x1* (-- x1 + x2 + x3 - x4 + x5 + x6)`);; + +let delta_x6 = new_definition(`delta_x6 x1 x2 x3 x4 x5 x6 + = -- x1 * x2 - x3*x6 + x1 * x4 + + x2* x5 - x4* x5 + x3*(-- x3 + x1 + x2 - x6 + x4 + x5)`);; + +(* ------------------------------------------------------------------ *) +(* Circumradius . *) +(* ------------------------------------------------------------------ *) + +let ups_x = new_definition(`ups_x x1 x2 x6 = + --x1*x1 - x2*x2 - x6*x6 + + &2 *x1*x6 + &2 *x1*x2 + &2 *x2*x6`);; + + +let eta_x = new_definition(`eta_x x1 x2 x3 = + (sqrt ((x1*x2*x3)/(ups_x x1 x2 x3))) + `);; + +let eta_y = new_definition(`eta_y y1 y2 y3 = + let x1 = y1*y1 in + let x2 = y2*y2 in + let x3 = y3*y3 in + eta_x x1 x2 x3`);; + +let rho_x = new_definition(`rho_x x1 x2 x3 x4 x5 x6 = + --x1*x1*x4*x4 - x2*x2*x5*x5 - x3*x3*x6*x6 + + (&2)*x1*x2*x4*x5 + (&2)*x1*x3*x4*x6 + (&2)*x2*x3*x5*x6`);; + + +let chi_x = new_definition(`chi_x x1 x2 x3 x4 x5 x6 + = -- (x1*x4*x4) + x1*x4*x5 + x2*x4*x5 - x2*x5*x5 + + x1*x4*x6 + x3*x4*x6 + + x2*x5*x6 + x3*x5*x6 - (&2) * x4*x5*x6 - x3*x6*x6`);; + +(* ------------------------------------------------------------------ *) +(* The formula for the dihedral angle of a simplex. *) +(* The variables xi are the squares of the lengths of the edges. *) +(* The angle is computed along the first edge (x1). *) +(* ------------------------------------------------------------------ *) + +let dih_x = new_definition(`dih_x x1 x2 x3 x4 x5 x6 = + let d_x4 = delta_x4 x1 x2 x3 x4 x5 x6 in + let d = delta_x x1 x2 x3 x4 x5 x6 in + pi/ (&2) + atn2( (sqrt ((&4) * x1 * d)),-- d_x4)`);; + + +let dih_y = new_definition(`dih_y y1 y2 y3 y4 y5 y6 = + let (x1,x2,x3,x4,x5,x6)= (y1*y1,y2*y2,y3*y3,y4*y4,y5*y5,y6*y6) in + dih_x x1 x2 x3 x4 x5 x6`);; + +let dih2_y = new_definition(`dih2_y y1 y2 y3 y4 y5 y6 = + dih_y y2 y1 y3 y5 y4 y6`);; + +let dih3_y = new_definition(`dih3_y y1 y2 y3 y4 y5 y6 = + dih_y y3 y1 y2 y6 y4 y5`);; + +let dih2_x = new_definition(`dih2_x x1 x2 x3 x4 x5 x6 = + dih_x x2 x1 x3 x5 x4 x6`);; + +let dih3_x = new_definition(`dih3_x x1 x2 x3 x4 x5 x6 = + dih_x x3 x1 x2 x6 x4 x5`);; + + +(* ------------------------------------------------------------------ *) +(* Harriot-Euler formula for the area of a spherical triangle *) +(* in terms of the angles: area = alpha+beta+gamma - pi *) +(* ------------------------------------------------------------------ *) + +let sol_x = new_definition(`sol_x x1 x2 x3 x4 x5 x6 = + (dih_x x1 x2 x3 x4 x5 x6) + + (dih_x x2 x3 x1 x5 x6 x4) + (dih_x x3 x1 x2 x6 x4 x5) - pi`);; + +let sol_y = new_definition(`sol_y y1 y2 y3 y4 y5 y6 = + (dih_y y1 y2 y3 y4 y5 y6) + + (dih_y y2 y3 y1 y5 y6 y4) + (dih_y y3 y1 y2 y6 y4 y5) - pi`);; + + +(* ------------------------------------------------------------------ *) +(* squander functions -2009 version *) + +(* ------------------------------------------------------------------ *) + +let interp = new_definition `interp x1 y1 x2 y2 x = y1 + (x - x1) * (y2- y1)/(x2-x1)`;; + +let const1 = new_definition `const1 = sol_y (&2) (&2) (&2) (&2) (&2) (&2) / pi`;; + +let ly = new_definition `ly y = interp (&2) (&1) (#2.52) (&0) y`;; + +let rho = new_definition `rho y = &1 + const1 - const1* ly y`;; + +let h0 = new_definition `h0 = #1.26`;; + +let sol0 = new_definition `sol0 = &3 * acs (&1 / &3) - pi`;; + +let rho_fun = new_definition `rho_fun y = &1 + (inv (&2 * h0 - &2)) * (inv pi) * sol0 * (y - &2)`;; + +let rhazim = new_definition `rhazim y1 y2 y3 y4 y5 y6 = rho y1 * dih_y y1 y2 y3 y4 y5 y6`;; + +let lnazim = new_definition `lnazim y1 y2 y3 y4 y5 y6 = ly y1 * dih_y y1 y2 y3 y4 y5 y6`;; + +let taum = new_definition + `taum y1 y2 y3 y4 y5 y6 = sol_y y1 y2 y3 y4 y5 y6 * (&1 + const1) - + const1 * (lnazim y1 y2 y3 y4 y5 y6 + lnazim y2 y3 y1 y5 y6 y4 + lnazim y3 y1 y2 y6 y4 y5)`;; + +let tauV = new_definition + `tauV (v1:real^3) v2 v3 = taum (norm v1) (norm v2) (norm v3) (dist(v2,v3)) (dist(v1,v3)) (dist(v1,v2))`;; + +let node2_y = new_definition `node2_y f y1 y2 y3 y4 y5 y6 = f y2 y3 y1 y5 y6 y4`;; + +let node3_y = new_definition `node3_y f y1 y2 y3 y4 y5 y6 = f y3 y1 y2 y6 y4 y5`;; + +let rhazim2 = new_definition `rhazim2 = node2_y rhazim`;; + +let rhazim3 = new_definition `rhazim3 = node3_y rhazim`;; + +let dih4_y = define `dih4_y y1 y2 y3 y4 y5 y6 = dih_y y4 y2 y6 y1 y5 y3`;; + +let dih5_y = define `dih5_y y1 y2 y3 y4 y5 y6 = dih_y y5 y1 y6 y2 y4 y3`;; + +let dih6_y = define `dih6_y y1 y2 y3 y4 y5 y6 = dih_y y6 y1 y5 y3 y4 y2`;; + +let rhazim4 = define `rhazim4 y1 y2 y3 y4 y5 y6 = rho y4 * dih4_y y1 y2 y3 y4 y5 y6`;; + +let rhazim5 = define `rhazim5 y1 y2 y3 y4 y5 y6 = rho y5 * dih5_y y1 y2 y3 y4 y5 y6 `;; + +let rhazim6 = define `rhazim6 y1 y2 y3 y4 y5 y6 = rho y6 * dih6_y y1 y2 y3 y4 y5 y6`;; + +(* two tetrahedra, shared edges y2 y3 y4 *) + +let tauq = new_definition `tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 = taum y1 y2 y3 y4 y5 y6 + taum y7 y2 y3 y4 y8 y9`;; + +(* ------------------------------------------------------------------ *) +(* The Cayley-Menger formula for the volume of a simplex *) +(* The variables xi are the squares of the lengths of the edges. *) +(* ------------------------------------------------------------------ *) + +let vol_x = new_definition(`vol_x x1 x2 x3 x4 x5 x6 = + (sqrt (delta_x x1 x2 x3 x4 x5 x6))/ (&12)`);; + +(* ------------------------------------------------------------------ *) +(* Some lower dimensional funcions and Rogers simplices. *) +(* ------------------------------------------------------------------ *) + +let arclength = new_definition(`arclength a b c = + pi/(&2) + (atn2( (sqrt (ups_x (a*a) (b*b) (c*c))),(c*c - a*a -b*b)))`);; + + +let volR = new_definition(`volR a b c = + (sqrt (a*a*(b*b-a*a)*(c*c-b*b)))/(&6)`);; + +let solR = new_definition(`solR a b c = + (&2)*atn2( sqrt(((c+b)*(b+a))), sqrt ((c-b)*(b-a)))`);; + +let dihR = new_definition(`dihR a b c = + atn2( sqrt(b*b-a*a),sqrt (c*c-b*b))`);; + +let rad2_x = new_definition(`rad2_x x1 x2 x3 x4 x5 x6 = + (rho_x x1 x2 x3 x4 x5 x6)/((delta_x x1 x2 x3 x4 x5 x6)*(&4))`);; + +(* aff is deprecated *) +let aff = new_definition `aff = ( hull ) affine`;; + +let lin_combo = new_definition `lin_combo V f = vsum V (\v. f v % (v:real^N))`;; + +let affsign = new_definition `affsign sgn s t (v:real^A) = (?f. + (v = lin_combo (s UNION t) f) /\ (!w. t w ==> sgn (f w)) /\ (sum (s UNION t) f = &1))`;; + +let sgn_gt = new_definition `sgn_gt = (\t. (&0 < t))`;; + +let sgn_ge = new_definition `sgn_ge = (\t. (&0 <= t))`;; + +let sgn_lt = new_definition `sgn_lt = (\t. (t < &0))`;; + +let sgn_le = new_definition `sgn_le = (\t. (t <= &0))`;; + +let cone = new_definition `cone v S:real^A->bool = affsign sgn_ge {v} S`;; + +let cone0 = new_definition `cone0 v S:real^A->bool = affsign sgn_gt {v} S`;; + +let conv0 = new_definition `conv0 S:real^A->bool = affsign sgn_gt {} S`;; + +let aff_gt_def = new_definition `aff_gt = affsign sgn_gt`;; + +let aff_ge_def = new_definition `aff_ge = affsign sgn_ge`;; + +let aff_lt_def = new_definition `aff_lt = affsign sgn_lt`;; + +let aff_le_def = new_definition `aff_le = affsign sgn_le`;; + +let voronoi_open = new_definition + `voronoi_open S (v:real^N) = { x | !w. ((S w) /\ ~(w=v)) ==> (dist( x, v) < dist( x, w)) }`;; + +let voronoi_closed = new_definition + `voronoi_closed S (v:real^N) = { x | !w. S w ==> (dist( x, v) <= dist( x, w)) }`;; + +let VORONOI_SET = new_definition + `voronoi_set V W = INTERS { voronoi_closed V (v:real^3) | v IN W}`;; + +let VORONOI_LIST = + new_definition `voronoi_list V wl = voronoi_set (V:real^3 -> bool) (set_of_list wl)`;; + +let VORONOI_NONDG = + new_definition `voronoi_nondg V ul = + ((LENGTH ul < 5) /\ (set_of_list ul SUBSET V) /\ + (aff_dim (voronoi_list V ul) + &(LENGTH ul) = &4))`;; + +let INITIAL_SUBLIST = new_definition + `initial_sublist (xl:(A)list) zl = (?yl. zl = APPEND xl yl)`;; + +let BARV = new_definition `barV V k ul = ((LENGTH ul = k+1) /\ + (!vl. (initial_sublist vl ul /\ 0 < LENGTH vl) ==> voronoi_nondg V vl))`;; + +let TRUNCATE_SIMPLEX = new_definition + `truncate_simplex j (ul:(A) list) = + @vl. ( LENGTH vl = j+1 /\ initial_sublist vl ul)`;; + +let OMEGA_LIST_N = define `(omega_list_n V ul 0 = HD ul) /\ + (omega_list_n V ul (SUC i) = + closest_point (voronoi_list V (truncate_simplex (SUC i) ul)) (omega_list_n V ul i))`;; + +let OMEGA_LIST = new_definition + `!V ul. omega_list V ul = omega_list_n V ul ((LENGTH ul) - 1)`;; + +let ROGERS = new_definition `!V ul. rogers V ul = + convex hull (IMAGE (omega_list_n V ul) { j | j < LENGTH ul })`;; + +(* AFFINE GEOMETRY *) + +let line = new_definition `line x = (?(v:real^N) w. ~(v =w) /\ (x = affine hull {v,w}))`;; + +let plane = new_definition + `plane x = (?(u:real^N) v w. ~(collinear {u,v,w}) /\ (x = affine hull {u,v,w}))`;; + +let closed_half_plane = new_definition + `closed_half_plane x = (?(u:real^N) v w. ~(collinear {u,v,w}) /\ (x = aff_ge {u,v} {w}))`;; + +let open_half_plane = new_definition + `open_half_plane x = (?(u:real^N) v w. ~(collinear {u,v,w}) /\ (x = aff_gt {u,v} {w}))`;; + +let closed_half_space = new_definition + `closed_half_space x = (?u v w w'. ~(coplanar {u,v,w,w'}) /\ (x = aff_ge {u,v,w} {w'}))`;; + +let open_half_space = new_definition + `open_half_space x = (?u v w w'. ~(coplanar {u,v,w,w'}) /\ (x = aff_gt {u,v,w} {w'}))`;; + +let bis = new_definition `bis (u:real^N) v = {x | dist(x,u) = dist(x,v)}`;; + +let bis_le = new_definition `bis_le (u:real^N) v = {x | dist(x,u) <= dist(x,v) }`;; + +let bis_lt = new_definition `bis_lt (u:real^N) v = {x | dist(x,u) < dist(x,v) }`;; + +let BIS_SYM = prove(`!p (q:real^N). bis p q = bis q p`, + REWRITE_TAC[bis] THEN SET_TAC[]);; + +let circumcenter = new_definition `circumcenter S = @v. ( (affine hull S) v /\ (?c. !w. (S w) ==> (c = dist(v,w))))`;; + +let radV = new_definition `radV S = @c. !w. (S w) ==> (c = dist(circumcenter S,w))`;; + +let orientation = new_definition `orientation S v sgn = affsign sgn (S DIFF {v}) {v} (circumcenter S)`;; + +let arcV = new_definition `arcV u v w = acs (( (v - u) dot (w - u))/((norm (v-u)) * (norm (w-u))))`;; + +let dihV = new_definition `dihV w0 w1 w2 w3 = + let va = w2 - w0 in + let vb = w3 - w0 in + let vc = w1 - w0 in + let vap = ( vc dot vc) % va - ( va dot vc) % vc in + let vbp = ( vc dot vc) % vb - ( vb dot vc) % vc in + arcV (vec 0) vap vbp`;; + +(* conventional ordering on variables *) + +let ylist = new_definition `ylist w0 w1 w2 w3 = + ((dist (w0, w1)),(dist( w0, w2)),(dist( w0, w3)),(dist( w2, w3)),(dist( w1, w3)),(dist( w1, w2)))`;; + +let xlist = new_definition `xlist w0 w1 w2 w3 = + let (y1,y2,y3,y4,y5,y6) = ylist w0 w1 w2 w3 in + (y1 pow 2, y2 pow 2, y3 pow 2, y4 pow 2, y5 pow 2, y6 pow 2)`;; + +let euler_p = new_definition `euler_p v0 v1 v2 v3 = + (let (y1,y2,y3,y4,y5,y6) = ylist v0 v1 v2 v3 in + let w1 = v1 - v0 in + let w2 = v2 - v0 in + let w3 = v3 - v0 in + y1*y2*y3 + y1*( w2 dot w3) + y2*( w3 dot w1) + y3*( w1 dot w2))`;; + +let orthonormal = new_definition `orthonormal e1 e2 e3 = + (( e1 dot e1 = &1) /\ (e2 dot e2 = &1) /\ ( e3 dot e3 = &1) /\ + ( e1 dot e2 = &0) /\ ( e1 dot e3 = &0) /\ ( e2 dot e3 = &0) /\ + (&0 < (e1 cross e2) dot e3))`;; + +let cyclic_set = new_definition `cyclic_set W v w = + (~(v=w) /\ (FINITE W) /\ (!p q h. W p /\ W q /\ (p = q + h % (v - w)) ==> (p=q)) /\ + (W INTER (affine hull {v,w}) = EMPTY))`;; + +(* projection to plane orth to e *) +let projection = new_definition `projection e x = + x - ((x dot e)/(e dot e)) % e`;; + +let azim_cycle = new_definition `azim_cycle W v w p = + if (W SUBSET {p}) then p else + (@u. ~(u=p) /\ W u /\ + (!q. ~(q=p) /\ W q ==> + (azim v w p u < azim v w p q) \/ + ((azim v w p u = azim v w p q) /\ + (norm (projection (w-v) (u-v)) <= norm (projection (w-v) (q-v))))))`;; + +let packing = new_definition `packing (S:real^3 -> bool) = (!u v. S u /\ S v /\ ~(u = v) ==> (&2 <= dist( u, v)))`;; + +let packing_lt = prove(`packing (V:real^3 -> bool) = + (!u:real^3 v:real^3. (u IN V) /\ (v IN V) /\ (dist( u, v) < &2) ==> + (u = v))`, + REWRITE_TAC[packing;IN;REAL_ARITH `x ~(y<= x)`] + THEN MESON_TAC[]);; + +let saturated =new_definition `saturated S= (!x. ?(y:real^N). y IN S /\ dist (x,y)< &2)`;; + +let c_cone = new_definition `c_cone (v,w:real^3, r:real)={x:real^3 | ((x-v) dot w = norm (x-v)* norm w* r)}`;; + +let circular_cone =new_definition + `circular_cone (V:real^3-> bool)= + (? (v,w:real^3)(r:real). ~(w = vec 0) /\ V = c_cone (v,w,r))`;; + +let null_equiv = new_definition `null_equiv (s,t :real^3->bool)=(? (B:real^3-> bool). NULLSET B /\ +((s DIFF t) UNION (t DIFF s)) SUBSET B)`;; + +let radial = new_definition `radial r (x:real^A) C <=> (C SUBSET ball (x,r)) /\ (!u. (x+u) IN C ==> (!t.(t> &0) /\ (t* norm u < r)==>(x+ t % u) IN C))`;; + +let eventually_radial = new_definition `eventually_radial x C <=> (?r. (r> &0) /\ radial r x (C INTER ball (x, r)))`;; + +let rconesgn = new_definition `rconesgn sgn v w h = {x:real^A | sgn ((x-v) dot (w-v)) (dist(x,v)*dist(w,v)*h)}`;; + +let rcone_ge = new_definition `rcone_ge = rconesgn ( >= )`;; + +let rcone_gt = new_definition `rcone_gt = rconesgn ( > )`;; + +let rcone_lt = new_definition `rcone_lt = rconesgn ( < )`;; + +let rcone_eq = new_definition `rcone_eq = rconesgn ( = )`;; + +let scale = new_definition `scale (t:real^3) (u:real^3) = vector[t$1 * u$1; t$2 * u$2; t$3 * u$3]`;; + +let vol_solid_triangle = new_definition `vol_solid_triangle v0 v1 v2 v3 r = + let a123 = dihV v0 v1 v2 v3 in + let a231 = dihV v0 v2 v3 v1 in + let a312 = dihV v0 v3 v1 v2 in + (a123 + a231 + a312 - pi)*(r pow 3)/(&3)`;; + +let vol_frustt_wedge = new_definition `vol_frustt_wedge v0 v1 v2 v3 h a = + (azim v0 v1 v2 v3)*(h pow 3)*(&1/(a*a) - &1)/(&6)`;; + +(* volume of intersection of conic cap and wedge *) +let vol_conic_cap_wedge = new_definition `vol_conic_cap_wedge v0 v1 v2 v3 r c = + (azim v0 v1 v2 v3)*(&1 - c)*(r pow 3)/(&3)`;; + +let vol_conv = new_definition `vol_conv v1 v2 v3 v4 = + let x12 = dist(v1,v2) pow 2 in + let x13 = dist(v1,v3) pow 2 in + let x14 = dist(v1,v4) pow 2 in + let x23 = dist(v2,v3) pow 2 in + let x24 = dist(v2,v4) pow 2 in + let x34 = dist(v3,v4) pow 2 in + sqrt(delta_x x12 x13 x14 x34 x24 x23)/(&12)`;; + +let vol_rect = new_definition `vol_rect a b = + if (a$1 < b$1) /\ (a$2 < b$2) /\ (a$3 < b$3) then (b$3-a$3)*(b$2-a$2)*(b$1-a$1) else &0`;; + +let vol_ball_wedge = new_definition `vol_ball_wedge v0 v1 v2 v3 r = + (azim v0 v1 v2 v3)*(&2)*(r pow 3)/(&3)`;; + +let ortho0 = new_definition `ortho0 x v1 v2 v3 = conv0 {x,x+v1,x+v1+v2,x+v1+v2+v3}`;; + +let make_point = new_definition `make_point v1 v2 v3 w r1 r2 r3 = @v. (aff_ge {v1,v2,v3} {w} (v:real^3)) /\ (r1 = dist(v1,v)) /\ (r2 = dist(v2,v)) /\ (r3 = dist(v3,v))`;; + +let abc_param = new_definition `abc_param v0 v1 v2 c = + let a = (&1/(&2)) * dist(v0,v1) in + let b = radV {v0,v1,v2} in + (a,b,c)`;; + +let res = new_definition `!f:A->A s:A->bool x:A. res f s x = if x IN s then f x else x`;; + +let regular_spherical_polygon_area = new_definition + `regular_spherical_polygon_area ca k = + &2 * pi - &2 * k * asn (ca * sin (pi /k))`;; (* corrected 2010-06-06. *) + +let tau0 = new_definition `tau0 = &4 * pi - &20 * sol0`;; + +let mm1 = new_definition `mm1 = sol0 * sqrt(&8)/tau0`;; + +let mm2 = new_definition `mm2 = (&6 * sol0 - pi) * sqrt(&2) /(&6 * tau0)`;; + +let hplus = new_definition `hplus = #1.3254`;; + +let h0cut = new_definition `h0cut y = if (y <= &2 * h0) then &1 else &0`;; + +let marchal_quartic = new_definition `marchal_quartic h = + (sqrt(&2)-h)*(h- hplus )*(&9*(h pow 2) - &17*h + &3)/ + ((sqrt(&2) - &1)* &5 *(hplus - &1))`;; + +let lmfun = new_definition`lmfun h = if (h<=h0) then (h0 - h)/(h0 - &1) else &0`;; + +let lfun = new_definition `lfun h = (h0 - h)/(h0 - &1)`;; + +let flat_term = new_definition `flat_term y = sol0 * (y - &2 * h0)/(&2 * h0 - &2)`;; + +let hminus = new_definition `hminus = @x. #1.2 <= x /\ x < #1.3 /\ marchal_quartic x = lmfun x`;; + +let cstab=new_definition ` cstab= #3.01`;; + + + + +(* --- *) + +let y_of_x = new_definition `y_of_x fx y1 y2 y3 y4 y5 y6 = + fx (y1*y1) (y2*y2) (y3*y3) (y4*y4) (y5*y5) (y6*y6)`;; + +let rad2_y = new_definition `rad2_y = y_of_x rad2_x`;; + +let delta4_y = new_definition `delta4_y = y_of_x delta_x4`;; + +(* real and fake 4-cell volumes *) + +let vol_y = new_definition `vol_y = y_of_x vol_x`;; + +let vol4f = new_definition `vol4f y1 y2 y3 y4 y5 y6 f = + (&2 * mm1 / pi) * + (sol_y y1 y2 y3 y4 y5 y6 + + sol_y y1 y5 y6 y4 y2 y3 + + sol_y y4 y5 y3 y1 y2 y6 + + sol_y y4 y2 y6 y1 y5 y3) + - (&8 * mm2/pi) * + (f(y1/ &2)* dih_y y1 y2 y3 y4 y5 y6 + + f(y2/ &2)* dih_y y2 y3 y1 y5 y6 y4 + + f(y3/ &2)* dih_y y3 y1 y2 y6 y4 y5 + + f(y4/ &2)* dih_y y4 y3 y5 y1 y6 y2 + + f(y5/ &2)* dih_y y5 y1 y6 y2 y4 y3 + + f(y6/ &2)* dih_y y6 y1 y5 y3 y4 y2)`;; + +let gamma4f = new_definition `gamma4f y1 y2 y3 y4 y5 y6 f = + vol_y y1 y2 y3 y4 y5 y6 - vol4f y1 y2 y3 y4 y5 y6 f`;; + +let gamma4fgcy = new_definition `gamma4fgcy y1 y2 y3 y4 y5 y6 f = + gamma4f y1 y2 y3 y4 y5 y6 f`;; + +(* real and fake 3-cell volumes *) + +let vol3r = new_definition `vol3r y1 y2 y3 r = vol_y r r r y1 y2 y3`;; + +let vol3f = new_definition `vol3f y1 y2 y3 r f = (&2 * mm1 / pi) * + (sol_y y1 y2 r r r y3 + + sol_y y2 y3 r r r y1 + + sol_y y3 y1 r r r y2) + - (&8 * mm2/pi) * + (f(y1/ &2)* dih_y y1 y2 r r r y3 + + f(y2/ &2)* dih_y y2 y3 r r r y1 + + f(y3/ &2)* dih_y y3 y1 r r r y2)`;; + +let gamma3f = new_definition `gamma3f y1 y2 y3 r f = vol3r y1 y2 y3 r - vol3f y1 y2 y3 r f`;; + + + (* error XX. vol2r missing factor of (y/2). *) + +let vol2r = new_definition `vol2r y r = &2 * pi * (r*r - (y / (&2)) pow 2)/(&3)`;; + +let vol2f = new_definition `vol2f y r f = (&2 * mm1 / pi) * &2 *pi* (&1- y/ (r * &2)) + - (&8 * mm2/pi) * &2 * pi * f (y/ (&2)) `;; + + + +(* For nonlinear inequalities *) + + +let norm2hh = new_definition `norm2hh y1 y2 y3 y4 y5 y6 = + (y1- hminus - hplus) pow 2 + (y2 - &2) pow 2 + (y3 - &2) pow 2 + (y4 - &2) pow 2 + + (y5 - &2) pow 2 + (y6 - &2) pow 2`;; + +let bump = new_definition `!h. bump h = #0.005*(&1 - ((h- h0) pow 2)/((hplus - h0) pow 2))`;; + +let critical_edge_y = new_definition `critical_edge_y y = ((&2*hminus <= y) /\ (y <= &2 *hplus))`;; + +let beta_bumpA_y = new_definition `beta_bumpA_y y1 y2 y3 y4 y5 y6 = + (if critical_edge_y y1 then &1 else &0) * + (if y2 < &2 * hminus then &1 else &0) * + (if y3 < &2 * hminus then &1 else &0) * + (if critical_edge_y y4 then &1 else &0) * + (if y5 < &2 * hminus then &1 else &0) * + (if y6 < &2 * hminus then &1 else &0) * + (bump (y1 / &2) - bump (y4 / &2))`;; + +let beta_bump_force_y = new_definition `beta_bump_force_y y1 y2 y3 y4 y5 y6 = + (bump (y1/ &2) - bump (y4 / &2))`;; + +let wtcount3_y = new_definition `wtcount3_y y1 y2 y3 = + (if critical_edge_y y1 then 1 else 0) + + (if critical_edge_y y2 then 1 else 0) + + (if critical_edge_y y3 then 1 else 0) `;; + +let wtcount6_y = new_definition + `wtcount6_y y1 y2 y3 y4 y5 y6 = wtcount3_y y1 y2 y3 + wtcount3_y y4 y5 y6`;; + +(* machine_eps is a + hack for numerical procedures. It is irrelevant for formal proofs. *) +let machine_eps = new_definition `machine_eps = &0`;; + + +(* nonlinear inequalities *) + +let a_spine5 = new_definition `a_spine5 = #0.0560305`;; + +let b_spine5 = new_definition `b_spine5 = -- #0.0445813`;; + +let beta_bump_lb = new_definition `beta_bump_lb = -- #0.005`;; + +let gamma23f = new_definition `gamma23f y1 y2 y3 y4 y5 y6 w1 w2 r f = + (gamma3f y1 y2 y6 r f / &w1 + gamma3f y1 y3 y5 r f / &w2 + + (dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 r r r y6 - dih_y y1 y3 r r r y5) * (vol2r y1 r - vol2f y1 r f)/(&2 * pi)) `;; + +let gamma23f_126_03 = new_definition `gamma23f_126_03 y1 y2 y3 y4 y5 y6 w1 r f = + (gamma3f y1 y2 y6 r f / &w1 + + (dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 r r r y6 - #0.03) * (vol2r y1 r - vol2f y1 r f)/(&2 * pi)) `;; + +let gamma23f_red_03 = new_definition `gamma23f_red_03 y1 y2 y3 y4 y5 y6 r f = + (dih_y y1 y2 y3 y4 y5 y6 - &2 * #0.03) * (vol2r y1 r - vol2f y1 r f)/(&2 * pi)`;; + +let pathL = new_definition `pathL (a,b) = (a,(a+b)/ &2)`;; + +let pathR = new_definition `pathR (a,b) = ((a+b)/ &2,b)`;; + + +let rotate2 = new_definition `rotate2 f x1 x2 x3 x4 x5 x6 = + f x2 x3 x1 x5 x6 x4`;; + +let rotate3 = new_definition `rotate3 f x1 x2 x3 x4 x5 x6 = + f x3 x1 x2 x6 x4 x5`;; + +let rotate4 = new_definition `rotate4 f x1 x2 x3 x4 x5 x6 = + f x4 x2 x6 x1 x5 x3`;; + +let rotate5 = new_definition `rotate5 f x1 x2 x3 x4 x5 x6 = + f x5 x3 x4 x2 x6 x1`;; + +let rotate6 = new_definition `rotate6 f x1 x2 x3 x4 x5 x6 = + f x6 x1 x5 x3 x4 x2`;; + + + + +let rad2_y = new_definition `rad2_y = y_of_x rad2_x`;; + +let norm2hh_x = new_definition `norm2hh_x x1 x2 x3 x4 x5 x6 = + norm2hh (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let rhazim_x = new_definition `rhazim_x x1 x2 x3 x4 x5 x6 = + rhazim (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let rhazim2_x = new_definition `rhazim2_x x1 x2 x3 x4 x5 x6 = + rhazim2 (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let rhazim3_x = new_definition `rhazim3_x x1 x2 x3 x4 x5 x6 = + rhazim3 (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let dih4_x = new_definition `dih4_x x1 x2 x3 x4 x5 x6 = + dih4_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let dih5_x = new_definition `dih5_x x1 x2 x3 x4 x5 x6 = + dih5_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let dih6_x = new_definition `dih6_x x1 x2 x3 x4 x5 x6 = + dih6_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let gcy = new_definition `gcy y = &4 * mm1/pi - (&8*mm2/pi) * lmfun(y/ &2)`;; + +let gchi = new_definition `gchi y = (&4*mm1/pi) - (&504*(mm2/pi))/(&13) + (&200*y*(mm2/pi))/(&13) `;; + + +let gchi1_x = new_definition `gchi1_x x1 x2 x3 x4 x5 x6 = gchi (sqrt x1) * dih_x x1 x2 x3 x4 x5 x6`;; + +let gchi2_x = new_definition `gchi2_x x1 x2 x3 x4 x5 x6 = gchi (sqrt x2) * dih2_x x1 x2 x3 x4 x5 x6`;; + +let gchi3_x = new_definition `gchi3_x x1 x2 x3 x4 x5 x6 = gchi (sqrt x3) * dih3_x x1 x2 x3 x4 x5 x6`;; + +let gchi4_x = new_definition `gchi4_x x1 x2 x3 x4 x5 x6 = gchi (sqrt x4) * dih4_x x1 x2 x3 x4 x5 x6`;; + +let gchi5_x = new_definition `gchi5_x x1 x2 x3 x4 x5 x6 = gchi (sqrt x5) * dih5_x x1 x2 x3 x4 x5 x6`;; + +let gchi6_x = new_definition `gchi6_x x1 x2 x3 x4 x5 x6 = gchi (sqrt x6) * dih6_x x1 x2 x3 x4 x5 x6`;; + +let ldih_x = new_definition `ldih_x x1 x2 x3 x4 x5 x6 = + lfun(sqrt(x1) / &2) * dih_x x1 x2 x3 x4 x5 x6`;; + +let ldih2_x = new_definition `ldih2_x x1 x2 x3 x4 x5 x6 = + lfun(sqrt(x2) / &2) * dih2_x x1 x2 x3 x4 x5 x6`;; + +let ldih3_x = new_definition `ldih3_x x1 x2 x3 x4 x5 x6 = + lfun(sqrt(x3) / &2) * dih3_x x1 x2 x3 x4 x5 x6`;; + +let ldih6_x = new_definition `ldih6_x x1 x2 x3 x4 x5 x6 = + lfun(sqrt(x6) / &2) * dih6_x x1 x2 x3 x4 x5 x6`;; + + +(* modified arctangent, analytic continuation of ArcTan[Sqrt[x]]/Sqrt[x] *) + +let matan = new_definition `matan x = + if (x = &0) then &1 + else if (x > &0) then atn (sqrt x) / (sqrt x) + else (log ((&1 + sqrt( -- x))/(&1 - sqrt( -- x)))) / (&2 * sqrt (-- x))`;; + +(* compare "Euler_main_theorem.EULER_ANGLE_SUM_rescal" *) + +let sol_euler_x = new_definition `sol_euler_x x1 x2 x3 x4 x5 x6 = + (let a = sqrt(x1*x2*x3) + sqrt( x1)*(x2 + x3 - x4)/ &2 + + sqrt(x2)*(x1 + x3 - x5)/ &2 + sqrt(x3)*(x1 + x2 - x6)/ &2 in + &2 * atn2( &2 * a, sqrt (delta_x x1 x2 x3 x4 x5 x6)))`;; + + +let taum_y1 = new_definition + `taum_y1 a b y1 (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) = + taum (&2) (&2) (&2) a b y1`;; + +let taum_y2 = new_definition + `taum_y2 a b (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) = + taum (&2) (&2) (&2) a b y2`;; + +let taum_y1_y2 = new_definition + `taum_y1_y2 a (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) = + taum (&2) (&2) (&2) a y1 y2`;; + +let taum_x1 = new_definition `taum_x1 a b x1 x2 x3 x4 x5 x6 = + taum_y1 a b (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let taum_x2 = new_definition `taum_x2 a b x1 x2 x3 x4 x5 x6 = + taum_y2 a b (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let taum_x1_x2 = new_definition `taum_x1_x2 a x1 x2 x3 x4 x5 x6 = + taum_y1_y2 a (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let arclength_y1 = new_definition + `arclength_y1 a b + (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) = + arclength y1 a b`;; + +let arclength_y2 = new_definition + `arclength_y2 a b + (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) = + arclength y2 a b`;; + +let arclength_x1 = new_definition + `arclength_x1 a b x1 x2 x3 x4 x5 x6 = + arclength_y1 a b (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let arclength_x2 = new_definition + `arclength_x2 a b x1 x2 x3 x4 x5 x6 = + arclength_y2 a b (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let arc_hhn = new_definition `arc_hhn = + arclength (&2 * h0) (&2 * h0) (&2)`;; + +let asn797k = new_definition `asn797k k x2 x3 x4 x5 x6 = + k * asn (cos (#0.797) * sin (pi / k))`;; + +let asnFnhk = new_definition `asnFnhk h k x3 x4 x5 x6 = + k * asn (( h * sqrt3 / #4.0 + sqrt(&1 - (h/ &2) pow 2)/ &2) * sin (pi/ k))`;; + +let lfun_y1 = new_definition `lfun_y1 (y1:real) (y2:real) (y3:real) + (y4:real) (y5:real) (y6:real) = lfun y1`;; + +let acs_sqrt_x1_d4 = new_definition `acs_sqrt_x1_d4 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + acs (sqrt(x1)/ &4)`;; + +let acs_sqrt_x2_d4 = new_definition `acs_sqrt_x2_d4 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + acs (sqrt(x2) / &4)`;; + +let arclength_x_123 = new_definition `arclength_x_123 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = arclength (sqrt x1) (sqrt x2) (sqrt x3)`;; + + +(* tame hypermap *) + +let tame_table_d = new_definition + `tame_table_d r s = if (r + 2*s > 3) + then #0.103 * (&2 - &s) + #0.2759 * (&r + &2* &s - &4) + else #0.0`;; (* preferred term over d2_tame *) + + +let eta2_126 = new_definition `eta2_126 x1 (x2:real) (x3:real) (x4:real) (x5:real) x6 = + (eta_y (sqrt x1) (sqrt x2) (sqrt x6)) pow 2`;; + +let eta2_135 = new_definition `eta2_135 x1 (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + (eta_y (sqrt x1) (sqrt x3) (sqrt x5)) pow 2`;; + +let eta2_456 = new_definition `eta2_456 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + (eta_y (sqrt x4) (sqrt x5) (sqrt x6)) pow 2`;; + +let num1 = new_definition `num1 e1 e2 e3 a2 b2 c2 = + -- &4*((a2 pow 2) *e1 + &8*(b2 - c2)*(e2 - e3) - + a2*(&16*e1 + ( b2 - &8 )*e2 + (c2 - &8)*e3))`;; + +let flat_term_x = new_definition `flat_term_x x = flat_term (sqrt x)`;; + +let taum_x = new_definition `taum_x x1 x2 x3 x4 x5 x6 = + rhazim_x x1 x2 x3 x4 x5 x6 + rhazim2_x x1 x2 x3 x4 x5 x6 + + rhazim3_x x1 x2 x3 x4 x5 x6 - (&1 + const1)* pi`;; + +let eulerA_x = new_definition `eulerA_x x1 x2 x3 x4 x5 x6 = + sqrt(x1) * sqrt(x2) * sqrt(x3) + sqrt(x1) * (x2 + x3 - x4) / &2 + sqrt(x2) * (x1 + x3 - x5) / &2 + + sqrt(x3) * (x1 + x2 - x6) / &2`;; + +let delta4_squared_x = new_definition + `delta4_squared_x x1 x2 x3 x4 x5 x6 = (delta_x4 x1 x2 x3 x4 x5 x6) pow 2`;; + +let delta4_squared_y = new_definition `delta4_squared_y = y_of_x delta4_squared_x`;; + +let x1_delta_x = new_definition `x1_delta_x x1 x2 x3 x4 x5 x6 = x1 * delta_x x1 x2 x3 x4 x5 x6`;; + +let x1_delta_y = new_definition `x1_delta_y = y_of_x x1_delta_x`;; + +let delta_126_x = new_definition + `delta_126_x (x3s:real) (x4s:real) (x5s:real) (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + delta_x x1 x2 x3s x4s x5s x6`;; + +let delta_234_x = new_definition + `delta_234_x (x1s:real) (x5s:real) (x6s:real) (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + delta_x x1s x2 x3 x4 x5s x6s`;; + +let delta_135_x = new_definition + `delta_135_x (x2s:real) (x4s:real) (x6s:real) (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + delta_x x1 x2s x3 x4s x5 x6s`;; + + +(* Added May 22, 2011 *) + +let delta_sub1_x = new_definition + `delta_sub1_x (x1s:real) (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + delta_x x1s x2 x3 x4 x5 x6`;; + +let taum_sub1_x = new_definition `taum_sub1_x x1s (x1:real) x2 x3 x4 x5 x6 = + taum_x x1s x2 x3 x4 x5 x6`;; + +let taum_sub246_x = new_definition + `taum_sub246_x x2s x4s x6s (x1:real) (x2:real) x3 (x4:real) x5 (x6:real) = + taum_x x1 x2s x3 x4s x5 x6s`;; + +let taum_sub345_x = new_definition + `taum_sub345_x x3s x4s x5s (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + taum_x x1 x2 x3s x4s x5s x6`;; + +end;; + diff --git a/text_formalization/general/state_manager.hl b/text_formalization/general/state_manager.hl new file mode 100644 index 0000000..8d197b6 --- /dev/null +++ b/text_formalization/general/state_manager.hl @@ -0,0 +1,294 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: general *) +(* Author: Thomas C. Hales *) +(* Date: 2010-02-13 *) +(* ========================================================================== *) + + +module State_manager:sig + val neutralize_state:unit->unit + end = struct + +(* +not neutralized: +set_jrh_lexer;; +installed printers... + +binders, infixes, and prefixes add on July 18, 2010. +*) + +(* +Bring conversions back to the following state of hol_version 2.20+ 100110: + +basic_convs();; +val it : (string * (term * conv)) list = + [("FUN_ONEPATTERN_CONV", (`_FUNCTION (\y z. P y z) x`, )); + ("MATCH_ONEPATTERN_CONV", (`_MATCH x (\y z. P y z)`, )); + ("FUN_SEQPATTERN_CONV", (`_FUNCTION (_SEQPATTERN r s) x`, )); + ("MATCH_SEQPATTERN_CONV", (`_MATCH x (_SEQPATTERN r s)`, )); + ("GEN_BETA_CONV", (`GABS (\a. b) c`, ))] + +We cannot restore the list above if someone changes it before this file is read. +The following checking can easily be defeated. An honor system is in place. *) + + + let neutralize_basic_convs = + let bc = basic_convs() in + let msg = "conversions beyond hol_version 2.20+ 100110. Cannot neutralize state" in + let original=["FUN_ONEPATTERN_CONV"; "MATCH_ONEPATTERN_CONV"; + "FUN_SEQPATTERN_CONV"; + "MATCH_SEQPATTERN_CONV"; "GEN_BETA_CONV"] in + let _ = if not(List.length(bc)=5) then failwith ("Added "^msg) in + let _ = if not(map fst bc=original) then failwith ("Changed "^msg) in + fun () -> set_basic_convs(bc);; + +(* +34 basic rewrites + +val rewrites : thm list = + [|- FST (x,y) = x; |- SND (x,y) = y; |- FST x,SND x = x; + |- (if x = x then y else z) = y; |- (if T then t1 else t2) = t1; + |- (if F then t1 else t2) = t2; |- ~ ~t <=> t; |- (@y. y = x) = x; + |- x = x <=> T; |- (T <=> t) <=> t; |- (t <=> T) <=> t; + |- (F <=> t) <=> ~t; |- (t <=> F) <=> ~t; |- ~T <=> F; |- ~F <=> T; + |- T /\ t <=> t; |- t /\ T <=> t; |- F /\ t <=> F; |- t /\ F <=> F; + |- t /\ t <=> t; |- T \/ t <=> T; |- t \/ T <=> T; |- F \/ t <=> t; + |- t \/ F <=> t; |- t \/ t <=> t; |- T ==> t <=> t; |- t ==> T <=> T; + |- F ==> t <=> T; |- t ==> t <=> T; |- t ==> F <=> ~t; |- (!x. t) <=> t; + |- (?x. t) <=> t; |- (\x. f x) y = f y; |- x = x ==> p <=> p] + +Again, we do not really check that this list is the one above. +*) + + let neutralize_basic_rewrites= + let bw = basic_rewrites() in + let msg = "Added rewrites beyond hol_version 2.20+ 100110. Cannot neutralize" in + let _ = if not(List.length(bw)=34) then failwith msg in + fun () -> set_basic_rewrites(bw);; + +(* +16 Basic congruences + + [|- (!x. ~(x = a) ==> f x = g x) + ==> (((\x. f x) --> l) (at a within s) <=> (g --> l) (at a within s)); + |- (!x. ~(x = a) ==> f x = g x) + ==> (((\x. f x) --> l) (at a) <=> (g --> l) (at a)); + |- (!x. x IN s ==> f x = g x) ==> product s (\i. f i) = product s g; + |- (!i. a <= i /\ i <= b ==> f i = g i) + ==> product (a..b) (\i. f i) = product (a..b) g; + |- (!x. p x ==> f x = g x) + ==> product {y | p y} (\i. f i) = product {y | p y} g; + |- (!x. x IN s ==> f x = g x) ==> vsum s (\i. f i) = vsum s g; + |- (!i. a <= i /\ i <= b ==> f i = g i) + ==> vsum (a..b) (\i. f i) = vsum (a..b) g; + |- (!x. p x ==> f x = g x) ==> vsum {y | p y} (\i. f i) = vsum {y | p y} g; + |- (!x. x IN s ==> f x = g x) ==> sum s (\i. f i) = sum s g; + |- (!i. a <= i /\ i <= b ==> f i = g i) + ==> sum (a..b) (\i. f i) = sum (a..b) g; + |- (!x. p x ==> f x = g x) ==> sum {y | p y} (\i. f i) = sum {y | p y} g; + |- (!x. x IN s ==> f x = g x) ==> nsum s (\i. f i) = nsum s g; + |- (!i. a <= i /\ i <= b ==> f i = g i) + ==> nsum (a..b) (\i. f i) = nsum (a..b) g; + |- (!x. p x ==> f x = g x) ==> nsum {y | p y} (\i. f i) = nsum {y | p y} g; + |- (g <=> g') + ==> (g' ==> t = t') + ==> (~g' ==> e = e') + ==> (if g then t else e) = (if g' then t' else e'); + |- (p <=> p') ==> (p' ==> (q <=> q')) ==> (p ==> q <=> p' ==> q')] + + +*) + + let neutralize_basic_congs= + let bc = basic_congs() in + let msg = "Added "^string_of_int(List.length bc)^ + " congruences. Cannot neutralize. " in + let _ = if not(List.length(bc)=16) then + (let _ = map print_thm bc in failwith msg) in + fun () -> set_basic_congs(bc);; + + let default_overload_skeletons = (* unchanged since July 31 2009 *) + [("real_interval", `:A`); ("segment", `:A`); ("interval", `:A`); + ("**", `:A->B->C`); ("norm", `:A->real`); ("gcd", `:A#A->A`); + ("coprime", `:A#A->bool`); ("mod", `:A->A->A->bool`); + ("divides", `:A->A->bool`); ("&", `:num->A`); ("min", `:A->A->A`); + ("max", `:A->A->A`); ("abs", `:A->A`); ("inv", `:A->A`); + ("pow", `:A->num->A`); ("--", `:A->A`); (">=", `:A->A->bool`); + (">", `:A->A->bool`); ("<=", `:A->A->bool`); ("<", `:A->A->bool`); + ("/", `:A->A->A`); ("*", `:A->A->A`); ("-", `:A->A->A`); + ("+", `:A->A->A`)];; + + let neutralize_overload_skeletons()= + the_overload_skeletons:= default_overload_skeletons;; + + + let the_default_interface = (* set on Feb 12 2010 *) + [("+", ("real_add", `:real->real->real`)); + ("-", ("real_sub", `:real->real->real`)); + ("*", ("real_mul", `:real->real->real`)); + ("/", ("real_div", `:real->real->real`)); + ("<", ("real_lt", `:real->real->bool`)); + ("<=", ("real_le", `:real->real->bool`)); + (">", ("real_gt", `:real->real->bool`)); + (">=", ("real_ge", `:real->real->bool`)); + ("--", ("real_neg", `:real->real`)); + ("pow", ("real_pow", `:real->num->real`)); + ("inv", ("real_inv", `:real->real`)); + ("abs", ("real_abs", `:real->real`)); + ("max", ("real_max", `:real->real->real`)); + ("min", ("real_min", `:real->real->real`)); + ("&", ("real_of_num", `:num->real`)); + ("mod", ("real_mod", `:real->real->real->bool`)); + ("+", ("vector_add", `:real^N->real^N->real^N`)); + ("-", ("vector_sub", `:real^N->real^N->real^N`)); + ("--", ("vector_neg", `:real^N->real^N`)); + ("norm", ("vector_norm", `:real^N->real`)); + ("**", ("vector_matrix_mul", `:real^M->real^N^M->real^N`)); + ("+", ("+", `:num->num->num`)); ("-", ("-", `:num->num->num`)); + ("*", ("*", `:num->num->num`)); ("<", ("<", `:num->num->bool`)); + ("<=", ("<=", `:num->num->bool`)); (">", (">", `:num->num->bool`)); + (">=", (">=", `:num->num->bool`)); + ("divides", ("num_divides", `:num->num->bool`)); + ("mod", ("num_mod", `:num->num->num->bool`)); + ("coprime", ("num_coprime", `:num#num->bool`)); + ("gcd", ("num_gcd", `:num#num->num`)); + ("+", ("int_add", `:int->int->int`)); + ("-", ("int_sub", `:int->int->int`)); + ("*", ("int_mul", `:int->int->int`)); + ("<", ("int_lt", `:int->int->bool`)); + ("<=", ("int_le", `:int->int->bool`)); + (">", ("int_gt", `:int->int->bool`)); + (">=", ("int_ge", `:int->int->bool`)); ("--", ("int_neg", `:int->int`)); + ("pow", ("int_pow", `:int->num->int`)); ("abs", ("int_abs", `:int->int`)); + ("max", ("int_max", `:int->int->int`)); + ("min", ("int_min", `:int->int->int`)); + ("&", ("int_of_num", `:num->int`)); + ("divides", ("int_divides", `:int->int->bool`)); + ("mod", ("int_mod", `:int->int->int->bool`)); + ("coprime", ("int_coprime", `:int#int->bool`)); + ("gcd", ("int_gcd", `:int#int->int`)); + ("inv", ("complex_inv", `:real^2->real^2`)); + ("pow", ("complex_pow", `:real^2->num->real^2`)); + ("/", ("complex_div", `:real^2->real^2->real^2`)); + ("*", ("complex_mul", `:real^2->real^2->real^2`)); + ("-", ("vector_sub", `:real^2->real^2->real^2`)); + ("+", ("vector_add", `:real^2->real^2->real^2`)); + ("--", ("vector_neg", `:real^2->real^2`)); + ("vol", ("measure", `:(real^3->bool)->real`)); + ("NULLSET", ("negligible", `:(real^3->bool)->bool`)); + ("real_interval", + ("closed_real_interval", `:(real#real)list->real->bool`)); + ("real_interval", ("open_real_interval", `:real#real->real->bool`)); + ("segment", ("closed_segment", `:(real^A#real^A)list->real^A->bool`)); + ("segment", ("open_segment", `:real^A#real^A->real^A->bool`)); + ("interval", ("closed_interval", `:(real^A#real^A)list->real^A->bool`)); + ("interval", ("open_interval", `:real^A#real^A->real^A->bool`)); + ("**", ("matrix_vector_mul", `:real^N^M->real^N->real^M`)); + ("**", ("matrix_mul", `:real^N^M->real^P^N->real^P^M`)); + ("-", ("matrix_sub", `:real^N^M->real^N^M->real^N^M`)); + ("+", ("matrix_add", `:real^N^M->real^N^M->real^N^M`)); + ("--", ("matrix_neg", `:real^N^M->real^N^M`)); + ("dist", ("distance", `:real^N#real^N->real`)); + ("&", ("hreal_of_num", `:num->hreal`)); + ("<=>", ("=", `:bool->bool->bool`))];; + + let neutralize_interface()= + the_interface:= the_default_interface;; + +let set_parsel f g h xl = + (let _ = map f (h()) in let _ = map g xl in ());; + +let neutralize_binders() = + let bind = ["\\"; "!"; "?"; "?!"; "@"; "minimal"; "lambda"] in + set_parsel unparse_as_binder parse_as_binder binders bind;; + +let neutralize_prefixes() = + let pre = ["~"; "--"; "mod"] in + set_parsel unparse_as_prefix parse_as_prefix prefixes pre;; + +let neutralize_infixes() = + let inf = [("<=>", (2, "right")); ("==>", (4, "right")); ("\\/", (6, "right")); + ("/\\", (8, "right")); ("==", (10, "right")); ("===", (10, "right")); + ("treal_eq", (10, "right")); ("IN", (11, "right")); + ("--->", (12, "right")); ("-->", (12, "right")); ("<", (12, "right")); + ("<<", (12, "right")); + ("<<<", (12, "right")); ("<<=", (12, "right")); ("<=", (12, "right")); + ("<=_c", (12, "right")); + ("<_c", (12, "right")); + ("=", (12, "right")); ("=_c", (12, "right")); (">", (12, "right")); + (">=", (12, "right")); + (">=_c", (12, "right")); + (">_c", (12, "right")); + ("HAS_SIZE", (12, "right")); ("PSUBSET", (12, "right")); + ("SUBSET", (12, "right")); ("absolutely_integrable_on", (12, "right")); + ("absolutely_real_integrable_on", (12, "right")); + ("analytic_on", (12, "right")); ("complex_differentiable", (12, "right")); + ("continuous", (12, "right")); ("continuous_on", (12, "right")); + ("convex_on", (12, "right")); ("differentiable", (12, "right")); + ("differentiable_on", (12, "right")); ("divides", (12, "right")); + ("division_of", (12, "right")); ("edge_of", (12, "right")); + ("exposed_face_of", (12, "right")); ("extreme_point_of", (12, "right")); + ("face_of", (12, "right")); ("facet_of", (12, "right")); + ("fine", (12, "right")); ("has_complex_derivative", (12, "right")); + ("has_derivative", (12, "right")); ("has_integral", (12, "right")); + ("has_integral_compact_interval", (12, "right")); + ("has_measure", (12, "right")); ("has_real_derivative", (12, "right")); + ("has_real_integral", (12, "right")); ("has_real_measure", (12, "right")); + ("has_vector_derivative", (12, "right")); + ("holomorphic_on", (12, "right")); ("homeomorphic", (12, "right")); + ("inseg", (12, "right")); ("integrable_on", (12, "right")); + ("limit_point_of", (12, "right")); ("permutes", (12, "right")); + ("real_continuous", (12, "right")); ("real_continuous_on", (12, "right")); + ("real_convex_on", (12, "right")); ("real_differentiable", (12, "right")); + ("real_differentiable_on", (12, "right")); + ("real_integrable_on", (12, "right")); ("real_sums", (12, "right")); + ("real_uniformly_continuous_on", (12, "right")); + ("retract_of", (12, "right")); ("simplex", (12, "right")); + ("sums", (12, "right")); ("tagged_division_of", (12, "right")); + ("tagged_partial_division_of", (12, "right")); + ("treal_le", (12, "right")); ("uniformly_continuous_on", (12, "right")); + (",", (14, "right")); ("in_direction", (14, "right")); + ("within", (14, "right")); ("..", (15, "right")); ("+", (16, "right")); + ("++", (16, "right")); + ("+_c", (16, "right")); ("UNION", (16, "right")); + ("treal_add", (16, "right")); ("-", (18, "left")); + ("DIFF", (18, "left")); ("*", (20, "right")); + ("**", (20, "right")); + ("*_c", (20, "right")); ("INTER", (20, "right")); + ("cross", (20, "right")); ("dot", (20, "right")); + ("treal_mul", (20, "right")); ("%", (21, "right")); + ("INSERT", (21, "right")); ("DELETE", (21, "left")); + ("hull", (21, "left")); ("CROSS", (22, "right")); + ("/", (22, "left")); ("DIV", (22, "left")); + ("MOD", (22, "left")); ("div", (22, "left")); ("rem", (22, "left")); + ("POWER",(24,"right")); + ("EXP", (24, "left")); ("cpow", (24, "left")); ("pow", (24, "left")); + ("$", (25, "left")); ("o", (26, "right"))] + in + set_parsel (fun (a,_) -> unparse_as_infix a) parse_as_infix infixes inf ;; + + + + (* What we cannot neutralize we destroy *) + + let neutralize_axioms() = + if not(List.length(axioms()) =3) then failwith ("Further axioms are not allowed");; + + + let neutralize_state()= + ( + current_goalstack := ([]:goalstack); + neutralize_overload_skeletons(); + neutralize_interface(); + neutralize_basic_congs(); + neutralize_basic_convs(); + neutralize_basic_rewrites(); + neutralize_binders(); + neutralize_prefixes(); + neutralize_infixes(); + neutralize_axioms(); + );; + +end;; diff --git a/text_formalization/general/tactics.hl b/text_formalization/general/tactics.hl new file mode 100644 index 0000000..0bb367e --- /dev/null +++ b/text_formalization/general/tactics.hl @@ -0,0 +1,118 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Lemma: General Tactics *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-16 *) +(* ========================================================================== *) + +module Tactics = struct + +(* ASSUMPTION LISTS *) + +let ASM_STRIP_TAC = + FIRST[FIRST_X_ASSUM CHOOSE_TAC; + FIRST_X_ASSUM (CONJUNCTS_THEN ASSUME_TAC); + ];; + +let FIRST_RULE_ASSUM rule ttc = FIRST_ASSUM (ttc o rule );; + +let FIRST_RULE_X_ASSUM rule ttc = FIRST_X_ASSUM (ttc o rule );; + +(* INDUCTION *) + +let INDUCT_SPEC_TAC vn = + let v = mk_var (vn,`:nat`) in + SPEC_TAC (v,v) THEN INDUCT_TAC;; + + +(* ------------------------------------------------------------------ *) +(* SELECT ELIMINATION. + SELECT_TAC should work whenever there is a single predicate selected. + Something more sophisticated might be needed when there + is (@)A and (@)B + in the same formula. + Useful for proving statements such as `1 + (@x. (x=3)) = 4` *) +(* ------------------------------------------------------------------ *) + +(* spec form of SELECT_AX *) +let select_thm select_fn select_exist = + BETA_RULE (ISPECL [select_fn;select_exist] + SELECT_AX);; + +(* example *) +select_thm + `\m. (X:num->bool) m /\ (!n. X n ==> m <= n)` `n:num`;; + +let SELECT_EXIST = prove_by_refinement( + `!(P:A->bool) Q. (?y. P y) /\ (!t. (P t ==> Q t)) ==> Q ((@) P)`, + (* {{{ proof *) + + [ + REPEAT STRIP_TAC; + ASSUME_TAC (ISPECL[`P:(A->bool)`;`y:A`] SELECT_AX); + ASM_MESON_TAC[]; + ]);; + + (* }}} *) + +let SELECT_THM = MESON[SELECT_EXIST] + `!(P:A->bool) Q. (((?y. P y) ==> (!t. (P t ==> Q t))) /\ ((~(?y. P y)) ==> + (!t. Q t))) ==> Q ((@) P)`;; + +let SELECT_TAC = + let unbeta = prove( + `!(P:A->bool) (Q:A->bool). (Q ((@) P)) <=> (\t. Q t) ((@) P)`,MESON_TAC[]) in + let unbeta_tac = CONV_TAC (HIGHER_REWRITE_CONV[unbeta] true) in + unbeta_tac THEN (MATCH_MP_TAC SELECT_THM) THEN BETA_TAC THEN + REPEAT STRIP_TAC;; + +(* PATTERNS *) + +let (PAT_MATCH:term list -> (string*thm) -> bool) = fun pat sth -> + not(search_thml (term_match[]) pat [sth] = []);; + +let (PAT_TAC2:tactic -> tactic -> term list -> (string * thm) -> tactic) = fun tac1 tac2 pat sth -> if PAT_MATCH pat sth then tac1 else tac2;; + +let (PAT_TAC:term list -> (string * thm) -> tactic) = + PAT_TAC2 ALL_TAC NO_TAC;; + +let (FIRST_PAT_ASSUM: term list -> thm_tactic -> tactic) = + fun pat ttac gl -> tryfind (fun sth -> (PAT_TAC pat sth THEN ttac (snd sth)) gl) (goal_asms gl);; + +let (FIRST_PAT_X_ASSUM:term list -> thm_tactic -> tactic) = + fun pat ttac -> + FIRST_PAT_ASSUM pat (fun th -> UNDISCH_THEN (concl th) ttac);; + +let (EVERY_PAT_ASSUM:term list -> thm_tactic -> tactic) = + fun pat ttac gl -> + let rl = map snd (filter (PAT_MATCH pat) (goal_asms gl)) in + let tacl = map ttac rl in + EVERY tacl gl;; + +(* Well defined functions *) + +(* Harrison's lemma *) +let WELLDEFINED_FUNCTION_1 = prove + (`(?f:B->C. !x:A. f(s x) = t x) <=> (!x x'. s x = s x' ==> t x = t x')`, + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `?f:B->C. !y. !x:A. s x = y ==> f y = t x` THEN + CONJ_TAC THENL + [MESON_TAC[]; REWRITE_TAC[GSYM SKOLEM_THM] THEN + MESON_TAC[]]);; + + +let WELLDEFINED_FUNCTION_2b = prove_by_refinement( +`(?f:C->D. (!x:A y:B. P x y ==> f(s x y) = t x y)) <=> + (!x x' y y'. (P x y /\ P x' y' /\ (s x y = s x' y')) ==> t x y = t x' y')`, +[ + MATCH_MP_TAC EQ_TRANS ; + EXISTS_TAC `?f:C->D. !z. !x:A y:B. ((P x y) /\ (s x y = z)) ==> f z = t x y`; + CONJ_TAC; + MESON_TAC[]; + REWRITE_TAC[GSYM SKOLEM_THM]; + MESON_TAC[]; +]);; + + + end;; diff --git a/text_formalization/general/update_database_310.ml b/text_formalization/general/update_database_310.ml new file mode 100644 index 0000000..0cd748f --- /dev/null +++ b/text_formalization/general/update_database_310.ml @@ -0,0 +1,315 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Update theorem search *) +(* Date: 2010-07-16 *) +(* ========================================================================== *) + +(* ========================================================================= *) +(* Create search database from OCaml / modify search database dynamically. *) +(* *) +(* This file assigns to "theorems", which is a list of name-theorem pairs. *) +(* The core system already has such a database set up. Use this file if you *) +(* want to update the database beyond the core, so you can search it. *) +(* *) +(* The trickery to get at the OCaml environment is due to Roland Zumkeller. *) +(* It works by copying some internal data structures and casting into the *) +(* copy using Obj.magic. *) +(* ========================================================================= *) + + +(* module Update_database_310 = struct *) + +(* Execute any OCaml expression given as a string. *) + +(* module Update_database_310 = struct *) + +let exec = ignore o Toploop.execute_phrase false Format.std_formatter + o !Toploop.parse_toplevel_phrase o Lexing.from_string;; + +type dummy;; + +(* ------------------------------------------------------------------------- *) +(* Basic data structures copied from OCaml. May be version-dependent. *) +(* ------------------------------------------------------------------------- *) + +type label = int;; + +(*** from ./typing/ident.ml: ***) + +type ident_t = { stamp: int; name: string; mutable flags: int };; + +type 'a tbl = + Empty + | Node of 'a tbl * 'a data * 'a tbl * int + +and 'a data = + { ident: ident_t; + data: 'a; + previous: 'a data option };; + +(*** from ./typing/path.ml: ***) + +type path_t = + Pident of ident_t + | Pdot of path_t * string * int + | Papply of path_t * path_t;; + +(*** from typing/types.ml: ***) + +type type_expr = + { mutable desc: type_desc; + mutable level: int; + mutable id: int } + +and type_desc = + Tvar + | Tarrow of label * type_expr * type_expr * commutable + | Ttuple of type_expr list + | Tconstr of path_t * type_expr list * abbrev_memo ref + | Tobject of type_expr * (path_t * type_expr list) option ref + | Tfield of string * field_kind * type_expr * type_expr + | Tnil + | Tlink of type_expr + | Tsubst of type_expr + | Tvariant of row_desc + | Tunivar + | Tpoly of type_expr * type_expr list + +and row_desc = + { row_fields: (label * row_field) list; + row_more: type_expr; + row_bound: type_expr list; + row_closed: bool; + row_fixed: bool; + row_name: (path_t * type_expr list) option } + +and row_field = + Rpresent of type_expr option + | Reither of bool * type_expr list * bool * row_field option ref + | Rabsent + +and abbrev_memo = + Mnil + | Mcons of path_t * type_expr * type_expr * abbrev_memo + | Mlink of abbrev_memo ref + +and field_kind = + Fvar of field_kind option ref + | Fpresent + | Fabsent + +and commutable = + Cok + | Cunknown + | Clink of commutable ref;; + +type value_description = + { val_type: type_expr; + val_kind: dummy };; + +type module_type = + Tmty_ident of path_t + | Tmty_signature of signature + | Tmty_functor of ident_t * module_type * module_type + +and signature = signature_item list + +and signature_item = + Tsig_value of ident_t * value_description + | Tsig_type of ident_t * dummy * dummy + | Tsig_exception of ident_t * dummy + | Tsig_module of ident_t * module_type * dummy + | Tsig_modtype of ident_t * dummy + | Tsig_class of ident_t * dummy * dummy + | Tsig_cltype of ident_t * dummy * dummy;; + + +(*** from ./typing/env.ml: ***) + +exec ( +"type env_t = { + values: (path_t * value_description) tbl; +" ^ (if (let v = String.sub Sys.ocaml_version 0 4 in v = "3.09" or v = "3.10") then "" else +" annotations: dummy; +") ^ +" constrs: dummy; + labels: dummy; + types: dummy; + modules: (path_t * module_type) tbl; + modtypes: dummy; + components: dummy; + classes: dummy; + cltypes: dummy; + summary: dummy +};;");; + +(* ------------------------------------------------------------------------- *) +(* End of basic data structures copied from OCaml. *) +(* ------------------------------------------------------------------------- *) + + +(* Iterate over the entries of a table. *) + +let rec iterTbl (f : ident_t -> 'a -> unit) = function + | Empty -> () + | Node (t1,d,t2,_) -> + f d.ident d.data; + iterTbl f t1; + iterTbl f t2;; + +(* If the given type is simple return its name, otherwise None. *) + +let rec get_simple_type = function + | Tlink { desc = Tconstr (Pident p,[],_) } -> Some p.name + | Tlink { desc = d } -> get_simple_type d + | _ -> None;; + +(* Evaluate any OCaml expression given as a string. *) + +let eval n = + exec ("let buf__ = ( " ^ n ^ " );;"); + Obj.magic (Toploop.getvalue "buf__");; + +(* Register all theorems added since the last update. *) +let thm_hashtable = Hashtbl.create 5000;; + +let update_database = + let lastStamp = ref 0 + and currentStamp = ref 0 + and thms = thm_hashtable (* Hashtbl.create 5000 *) in + + let ifNew f i x = + if i.stamp > !lastStamp then + ((if i.stamp > !currentStamp then currentStamp := i.stamp); + f i x) in + + let rec regVal pfx = ifNew (fun i vd -> + let n = pfx ^ i.name in + if n <> "buf__" then + (if get_simple_type vd.val_type.desc = Some "thm" + then Hashtbl.replace thms n (eval n) + else Hashtbl.remove thms n)) + + and regMod pfx = ifNew (fun i mt -> + match mt with + | Tmty_signature sg -> + let pfx' = pfx ^ i.name ^ "." in + List.iter (function + | Tsig_value (i',vd) -> regVal pfx' i' vd + | Tsig_module (i',mt',_) -> regMod pfx' i' mt' + | _ -> ()) sg + | _ -> ()) + + in fun () -> + let env = Obj.magic !Toploop.toplevel_env in + iterTbl (fun i (_,vd) -> regVal "" i vd) env.values; + iterTbl (fun i (_,mt) -> regMod "" i mt) env.modules; + lastStamp := !currentStamp; + theorems := Hashtbl.fold (fun s t l -> (s,t)::l) thms [];; + +(* ------------------------------------------------------------------------- *) +(* Search (automatically updates) *) +(* ------------------------------------------------------------------------- *) + +let omit t = mk_comb(mk_var("",W mk_fun_ty (type_of t)),t);; + +let exactly t = mk_comb(mk_var("",W mk_fun_ty (type_of t)),t);; + +let name s = mk_comb(mk_var("",W mk_fun_ty aty), + mk_var(s,aty));; + +let full t = mk_comb(mk_var("",W mk_fun_ty (type_of t)),t);; + +let rewrite t = mk_comb(mk_var("",W mk_fun_ty (type_of t)),t);; + +let regexp s = mk_comb(mk_var("",W mk_fun_ty aty), + mk_var(s,aty));; + +let disjunct pr = + let u = mk_pair pr in + let ty = type_of u in + let h = mk_var ("",(mk_type("fun",[ty;aty]))) in + mk_comb (h,u);; + + +(* very rough measure of the size of a printed term *) +let rec term_length = + let n = `NUMERAL` in + let d = `DECIMAL` in + function + | Abs(s,x) -> 1 + term_length x + | Comb(s,x) -> if ((s = n) or (s = d)) then 2 + else ( term_length s + term_length x) + | _ -> 1;; + +let sortlength_thml thml = + let ltml = map + (function (s,t) as r -> (term_length (concl t),r)) thml in + let stml = sort (fun (a,_) (b,_) -> (a < b)) ltml in + map snd stml;; + + +(* main search function *) + +let search_thml term_matcher = + let rec immediatesublist l1 l2 = + match (l1,l2) with + [],_ -> true + | _,[] -> false + | (h1::t1,h2::t2) -> h1 = h2 & immediatesublist t1 t2 in + let rec sublist l1 l2 = + match (l1,l2) with + [],_ -> true + | _,[] -> false + | (h1::t1,h2::t2) -> immediatesublist l1 l2 or sublist l1 t2 in + + let rec conjuncts t = + let t' = snd (strip_forall t) in + if (is_conj t') then (let (a,b) = dest_conj t' in conjuncts a @ conjuncts b) else [t'] in + + let heads t = + let c = map (fst o dest_eq) (filter (is_eq) (conjuncts t)) in + let h = map (fst o strip_comb) c in + let hc = filter (is_const) h in + map (fst o dest_const) hc in + + let is_rewrite t (n,th) = + mem (fst(dest_const t)) (heads(snd( dest_thm th))) in + + let name_matches_regexp s (n,th) = + let pat = Str.regexp (".*"^s) in + Str.string_match pat n 0 in + + let exists_subterm_satisfying p (n,th) = can (find_term p) (concl th) in + let exists_fullterm_satisfying p (n,th) = p (concl th) in + let name_contains s (n,th) = sublist (explode s) (explode n) in + let rec filterpred tm = + match tm with + Comb(Var("",_),t) -> not o filterpred t + | Comb(Var("",_),Var(pat,_)) -> name_contains pat + | Comb(Var("",_),Var(pat,_)) -> name_matches_regexp pat + | Comb(Var("",_),t) -> + let (pat1,pat2) = dest_pair t in + (fun (n,th) -> exists_subterm_satisfying (can (term_matcher pat1)) (n,th) or + exists_subterm_satisfying (can (term_matcher pat2)) (n,th)) + | Comb(Var("",_),t) -> is_rewrite t + | Comb(Var("",_),pat) -> exists_subterm_satisfying (aconv pat) + | Comb(Var("",_),pat) -> exists_fullterm_satisfying (can (term_matcher pat)) + | pat -> exists_subterm_satisfying (can (term_matcher pat)) in + fun pats thml -> update_database (); + if (pats = []) then failwith ("keywords: omit (term), name (string),"^ + " disjunct (term,term), "^ + " regexp (string), exactly (term), full (term), rewrite (term constant)") else + (itlist (filter o filterpred) pats thml);; + + +let search pat = search_thml (term_match []) pat (!theorems);; + +(* ------------------------------------------------------------------------- *) +(* Update to bring to current state. *) +(* ------------------------------------------------------------------------- *) + +update_database ();; + +(* end;; *) diff --git a/text_formalization/general/update_database_400.ml b/text_formalization/general/update_database_400.ml new file mode 100644 index 0000000..bb2a467 --- /dev/null +++ b/text_formalization/general/update_database_400.ml @@ -0,0 +1,340 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Update theorem search *) +(* Date: 2010-07-16 *) +(* *) +(* 2012-09-06: JRH fixed up for OCaml 4.0 and added alphabetic sorting. *) +(* ========================================================================== *) + +(* ========================================================================= *) +(* Create search database from OCaml / modify search database dynamically. *) +(* *) +(* This file assigns to "theorems", which is a list of name-theorem pairs. *) +(* The core system already has such a database set up. Use this file if you *) +(* want to update the database beyond the core, so you can search it. *) +(* *) +(* The trickery to get at the OCaml environment is due to Roland Zumkeller. *) +(* It works by copying some internal data structures and casting into the *) +(* copy using Obj.magic. *) +(* ========================================================================= *) + + +(* module Update_database_310 = struct *) + +(* Execute any OCaml expression given as a string. *) + +let exec = ignore o Toploop.execute_phrase false Format.std_formatter + o !Toploop.parse_toplevel_phrase o Lexing.from_string;; + +type dummy;; + +(* ------------------------------------------------------------------------- *) +(* Basic data structures copied from OCaml. May be version-dependent. *) +(* ------------------------------------------------------------------------- *) + +type label = int;; + +(*** from ./typing/ident.ml: ***) + +type ident_t = { stamp: int; name: string; mutable flags: int };; + +type 'a tbl = + Empty + | Node of 'a tbl * 'a data * 'a tbl * int + +and 'a data = + { ident: ident_t; + data: 'a; + previous: 'a data option };; + +(*** from ./typing/path.ml: ***) + +type path_t = + Pident of ident_t + | Pdot of path_t * string * int + | Papply of path_t * path_t;; + +(*** from typing/types.ml: ***) + +exec ( +"type type_expr = + { mutable desc: type_desc; + mutable level: int; + mutable id: int } + +and type_desc = +" ^ +(if String.sub Sys.ocaml_version 0 1 = "4" + then "Tvar of string option\n" + else "Tvar\n") ^ +" | Tarrow of label * type_expr * type_expr * commutable + | Ttuple of type_expr list + | Tconstr of path_t * type_expr list * abbrev_memo ref + | Tobject of type_expr * (path_t * type_expr list) option ref + | Tfield of string * field_kind * type_expr * type_expr + | Tnil + | Tlink of type_expr + | Tsubst of type_expr + | Tvariant of row_desc + | Tunivar + | Tpoly of type_expr * type_expr list + +and row_desc = + { row_fields: (label * row_field) list; + row_more: type_expr; + row_bound: type_expr list; + row_closed: bool; + row_fixed: bool; + row_name: (path_t * type_expr list) option } + +and row_field = + Rpresent of type_expr option + | Reither of bool * type_expr list * bool * row_field option ref + | Rabsent + +and abbrev_memo = + Mnil + | Mcons of path_t * type_expr * type_expr * abbrev_memo + | Mlink of abbrev_memo ref + +and field_kind = + Fvar of field_kind option ref + | Fpresent + | Fabsent + +and commutable = + Cok + | Cunknown + | Clink of commutable ref;; +");; + +type value_description = + { val_type: type_expr; + val_kind: dummy };; + +type module_type = + Tmty_ident of path_t + | Tmty_signature of signature + | Tmty_functor of ident_t * module_type * module_type + +and signature = signature_item list + +and signature_item = + Tsig_value of ident_t * value_description + | Tsig_type of ident_t * dummy * dummy + | Tsig_exception of ident_t * dummy + | Tsig_module of ident_t * module_type * dummy + | Tsig_modtype of ident_t * dummy + | Tsig_class of ident_t * dummy * dummy + | Tsig_cltype of ident_t * dummy * dummy;; + +(*** from ./typing/env.ml: ***) + +exec ( +"type env_t = {\n" ^ + (if String.sub Sys.ocaml_version 0 1 = "4" + then "values: ((path_t * value_description) * bool ref) tbl;\n" + else "values: (path_t * value_description) tbl;\n") ^ + (if (let v = String.sub Sys.ocaml_version 0 4 in v = "3.09" or v = "3.10") + then "" + else "annotations: dummy;\n") ^ +" constrs: dummy; + labels: dummy;\n" ^ +(if String.sub Sys.ocaml_version 0 1 = "4" + then "constrs_by_path: dummy;\n" + else "") ^ +" types: dummy;\n" ^ +(if String.sub Sys.ocaml_version 0 1 = "4" + then "modules: ((path_t * module_type) * bool ref) tbl;\n" + else "modules: (path_t * module_type) tbl;\n") ^ +" modtypes: dummy; + components: dummy; + classes: dummy; + cltypes: dummy; + summary: dummy;\n" ^ +(if String.sub Sys.ocaml_version 0 1 = "4" + then "local_constraints: dummy; + gadt_instances: dummy; + in_signature: dummy; + };;\n" + else "};;\n"));; + +(* ------------------------------------------------------------------------- *) +(* End of basic data structures copied from OCaml. *) +(* ------------------------------------------------------------------------- *) + +(* Iterate over the entries of a table. *) + +let rec iterTbl (f : ident_t -> 'a -> unit) = function + | Empty -> () + | Node (t1,d,t2,_) -> + f d.ident d.data; + iterTbl f t1; + iterTbl f t2;; + +(* If the given type is simple return its name, otherwise None. *) + +let rec get_simple_type = function + | Tlink { desc = Tconstr (Pident p,[],_) } -> Some p.name + | Tlink { desc = d } -> get_simple_type d + | _ -> None;; + +(* Evaluate any OCaml expression given as a string. *) + +let eval n = + exec ("let buf__ = ( " ^ n ^ " );;"); + Obj.magic (Toploop.getvalue "buf__");; + +(* Register all theorems added since the last update. *) + +let thm_hashtable = Hashtbl.create 5000;; + +exec ( +"let update_database = + let lastStamp = ref 0 + and currentStamp = ref 0 + and thms = thm_hashtable in + + let ifNew f i x = + if i.stamp > !lastStamp then + ((if i.stamp > !currentStamp then currentStamp := i.stamp); + f i x) in + + let rec regVal pfx = ifNew (fun i vd -> + let n = pfx ^ i.name in + if n <> \"buf__\" then + (if get_simple_type vd.val_type.desc = Some \"thm\" + then Hashtbl.replace thms n (eval n) + else Hashtbl.remove thms n)) + + and regMod pfx = ifNew (fun i mt -> + match mt with + | Tmty_signature sg -> + let pfx' = pfx ^ i.name ^ \".\" in + List.iter (function + | Tsig_value (i',vd) -> regVal pfx' i' vd + | Tsig_module (i',mt',_) -> regMod pfx' i' mt' + | _ -> ()) sg + | _ -> ()) + + in fun () -> + let env = Obj.magic !Toploop.toplevel_env in +" ^ +(if String.sub Sys.ocaml_version 0 1 = "4" + then "iterTbl (fun i ((_,vd),_) -> regVal \"\" i vd) env.values; + iterTbl (fun i ((_,mt),_) -> regMod \"\" i mt) env.modules; + " + else + "iterTbl (fun i (_,vd) -> regVal \"\" i vd) env.values; + iterTbl (fun i (_,mt) -> regMod \"\" i mt) env.modules; + ") ^ +" lastStamp := !currentStamp; + theorems := Hashtbl.fold (fun s t l -> (s,t)::l) thms [];; +");; + +(* ------------------------------------------------------------------------- *) +(* Search (automatically updates) *) +(* ------------------------------------------------------------------------- *) + +let omit t = mk_comb(mk_var("",W mk_fun_ty (type_of t)),t);; + +let exactly t = mk_comb(mk_var("",W mk_fun_ty (type_of t)),t);; + +let name s = mk_comb(mk_var("",W mk_fun_ty aty), + mk_var(s,aty));; + +let full t = mk_comb(mk_var("",W mk_fun_ty (type_of t)),t);; + +let rewrite t = mk_comb(mk_var("",W mk_fun_ty (type_of t)),t);; + +let regexp s = mk_comb(mk_var("",W mk_fun_ty aty), + mk_var(s,aty));; + +let disjunct pr = + let u = mk_pair pr in + let ty = type_of u in + let h = mk_var ("",(mk_type("fun",[ty;aty]))) in + mk_comb (h,u);; + + +(* very rough measure of the size of a printed term *) +let rec term_length = + let n = `NUMERAL` in + let d = `DECIMAL` in + function + | Abs(s,x) -> 1 + term_length x + | Comb(s,x) -> if ((s = n) or (s = d)) then 2 + else ( term_length s + term_length x) + | _ -> 1;; + +let sortlength_thml thml = + let ltml = map + (function (s,t) as r -> (term_length (concl t),r)) thml in + let stml = sort (fun (a,_) (b,_) -> (a < b)) ltml in + map snd stml;; + + +(* main search function *) + +let search_thml term_matcher = + let rec immediatesublist l1 l2 = + match (l1,l2) with + [],_ -> true + | _,[] -> false + | (h1::t1,h2::t2) -> h1 = h2 & immediatesublist t1 t2 in + let rec sublist l1 l2 = + match (l1,l2) with + [],_ -> true + | _,[] -> false + | (h1::t1,h2::t2) -> immediatesublist l1 l2 or sublist l1 t2 in + + let rec conjuncts t = + let t' = snd (strip_forall t) in + if (is_conj t') then (let (a,b) = dest_conj t' in conjuncts a @ conjuncts b) else [t'] in + + let heads t = + let c = map (fst o dest_eq) (filter (is_eq) (conjuncts t)) in + let h = map (fst o strip_comb) c in + let hc = filter (is_const) h in + map (fst o dest_const) hc in + + let is_rewrite t (n,th) = + mem (fst(dest_const t)) (heads(snd( dest_thm th))) in + + let name_matches_regexp s (n,th) = + let pat = Str.regexp (".*"^s) in + Str.string_match pat n 0 in + + let exists_subterm_satisfying p (n,th) = can (find_term p) (concl th) in + let exists_fullterm_satisfying p (n,th) = p (concl th) in + let name_contains s (n,th) = sublist (explode s) (explode n) in + let rec filterpred tm = + match tm with + Comb(Var("",_),t) -> not o filterpred t + | Comb(Var("",_),Var(pat,_)) -> name_contains pat + | Comb(Var("",_),Var(pat,_)) -> name_matches_regexp pat + | Comb(Var("",_),t) -> + let (pat1,pat2) = dest_pair t in + (fun (n,th) -> exists_subterm_satisfying (can (term_matcher pat1)) (n,th) or + exists_subterm_satisfying (can (term_matcher pat2)) (n,th)) + | Comb(Var("",_),t) -> is_rewrite t + | Comb(Var("",_),pat) -> exists_subterm_satisfying (aconv pat) + | Comb(Var("",_),pat) -> exists_fullterm_satisfying (can (term_matcher pat)) + | pat -> exists_subterm_satisfying (can (term_matcher pat)) in + fun pats thml -> update_database (); + if (pats = []) then failwith ("keywords: omit (term), name (string),"^ + " disjunct (term,term), "^ + " regexp (string), exactly (term), full (term), rewrite (term constant)") else + (itlist (filter o filterpred) pats thml);; + + +let search pat = sort (increasing fst) (search_thml (term_match []) pat (!theorems));; + +(* ------------------------------------------------------------------------- *) +(* Update to bring to current state. *) +(* ------------------------------------------------------------------------- *) + +update_database ();; + +(* end;; *) diff --git a/text_formalization/hypermap/bauer_nipkow.hl b/text_formalization/hypermap/bauer_nipkow.hl new file mode 100644 index 0000000..e4fcdfe --- /dev/null +++ b/text_formalization/hypermap/bauer_nipkow.hl @@ -0,0 +1,1011 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: hypermap *) +(* Author: Thomas Hales *) +(* Date: 2011-04-29 *) +(* ========================================================================== *) + +(* Port The Bauer-Nipkow completeness theorem from Isabelle, + based on + http://afp.sourceforge.net/browser_info/current/HOL/Flyspeck-Tame/outline.pdf + + This is a human-translation of the Isabelle code. As a correctness + check, it should be autmatically translated back into Isabelle, + then checked that the Isabelle thm implies the retranslation of the + thm here. + + The tame_graph_classification_theorem is the translation into HOL + Light of the main result of Flyspeck I, Bauer-Nipkow. To use it, + we should prove that a (restricted) planar hypermap has a + face listing that in bn_planar, and a tame hypermap has a + face listing that is bn_tame. + +*) + +needs "Library/rstc.ml";; (* for RTC reflexive transitive closure *) + +(* flyspeck_needs "../../tame_archive/tame_archive.hl";; *) + +module Tame_classification = struct + + open Hales_tactic;; +(* +types: num, (A) list, (A ==> B), (A) Option, A#B, bool. +*) + +let translate a = ();; + +translate ("#",`CONS`);; +translate ("@",`APPEND`);; +translate ("!",`EL`);; +translate ("length",`LENGTH`);; +translate ("rev",`REVERSE`);; +translate ("?",`ITER`);; + +(* List operations in Isabelle-Main: + op @, concat, filter, length, map, op !, remove1, rev, + rotate, rotate1, upto, upt, zip. + + Other things in main: + the, + See http://www.cl.cam.ac.uk/research/hvg/Isabelle/dist/Isabelle2013/doc/main.pdf +*) + +(* +(* HOL Light definition from hypermap. Use ITER instead. *) + +parse_as_infix("POWER",(24,"right"));; + +let POWER = new_recursive_definition num_RECURSION + `(!(f:A->A). f POWER 0 = I) /\ + (!(f:A->A) (n:num). f POWER (SUC n) = (f POWER n) o f)`;; +*) + + +(* import of 1.1 HOL *) + +translate ("the",`the`);; + +let the = new_definition `the s = @(x:A). (s = SOME x)`;; + +let the_some = prove_by_refinement( + `!(x:A). the (SOME x) = x`, + (* {{{ proof *) + [ + REWRITE_TAC[the]; + GEN_TAC; + SELECT_TAC; + INTRO_TAC option_RECURSION [`x`;`I:A->A`]; + REWRITE_TAC[I_THM]; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + + +(* definition enum :: "nat \ nat set" where + [code del]: "enum n = {..bool) [] = [] /\ + filter f (x:: xs) = if (f x) then (x :: (filter f xs)) else filter f xs`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Seq.filter]) + ]);; + (* }}} *) + +(* +let bn_filter = new_recursive_definition list_RECURSION + `bn_filter (f:A->bool) [] = [] /\ + bn_filter f ( x:: xs) = if (f x) then (x :: (bn_filter f xs)) else bn_filter f xs`;; + +let bn_filter_FILTER = prove_by_refinement (`bn_filter = FILTER`, + [ + ONCE_REWRITE_TAC[FUN_EQ_THM]; + GEN_TAC; + ONCE_REWRITE_TAC[FUN_EQ_THM]; + LIST_INDUCT_TAC THEN ASM_REWRITE_TAC[FILTER;bn_filter]; + ]);; +*) + + +let filter_FILTER = prove_by_refinement( + `filter = FILTER`, + (* {{{ proof *) + [ + ONCE_REWRITE_TAC[FUN_EQ_THM]; + GEN_TAC; + ONCE_REWRITE_TAC[FUN_EQ_THM]; + BY(LIST_INDUCT_TAC THEN ASM_REWRITE_TAC[Seq.filter;FILTER]) + ]);; + (* }}} *) + +translate ("concat",`concat`);; + + +let concat = new_recursive_definition list_RECURSION + `concat ([]:(A list)list) = [] /\ + concat ( (x:A list) :: xs) = APPEND x (concat xs)`;; + +(* notation: disjoint_sum { x in xs } f = concat (MAP (\x. f) xs) *) + +(* list_update *) + +(* 1.2.3 listProd1, listProd *) + +translate ("map",`MAP`);; +translate ("listProd1",`list_prod1`);; +translate ("listProd",`list_prod`);; +translate ("bn_minimal",`bn_minimal`);; + +Seq.map_MAP;; (`map = MAP`);; + +let list_prod1 = new_definition `list_prod1 (a:A) (b:B list) = + MAP(\x. (a,x)) b`;; + +let list_prod = new_definition `list_prod (a:A list) (b:B list) = + concat (MAP (\x. list_prod1 x b) a)`;; + +(* 1.2.5 *) + +let bn_minimal = new_recursive_definition list_RECURSION + `(bn_minimal (f:A->num) [] = CHOICE (UNIV:A->bool)) /\ + (bn_minimal (f:A->num) ( (x:A) :: xs) = if (xs= []) then (x:A) else + (let m = bn_minimal f xs in (if(f x <= f m) then x else m)))`;; + +(* benign redefinition from Misc_defs_and_lemmas module *) + +translate ("min_list",`min_list`);; + +let min_num = new_definition `min_num X = (@m. (m:num) IN X /\ (!n. n IN X ==> m <= n))`;; + +let min_list = new_definition `min_list (xs:num list) = min_num (set_of_list xs)`;; + +let min_num_single = prove_by_refinement( + `!x. min_num {x} = x`, + (* {{{ proof *) + [ + GEN_TAC; + TYPIFY `x IN {x} ==> min_num {x} IN {x}` (C SUBGOAL_THEN MP_TAC); + REWRITE_TAC[IN]; + BY(MESON_TAC[Misc_defs_and_lemmas.min_least ]); + BY(REWRITE_TAC[IN_SING]) + ]);; + (* }}} *) + +let min_num_in = prove_by_refinement( + `!X. ~(X = {}) ==> min_num X IN X`, + (* {{{ proof *) + [ + REWRITE_TAC[EXTENSION;NOT_IN_EMPTY;NOT_FORALL_THM]; + REWRITE_TAC[IN]; + BY(MESON_TAC[Misc_defs_and_lemmas.min_least ]) + ]);; + (* }}} *) + +let min_num_le = prove_by_refinement( + `!X c. c IN X ==> min_num X <= c`, + (* {{{ proof *) + [ + REWRITE_TAC[IN]; + BY(MESON_TAC[Misc_defs_and_lemmas.min_least ]) + ]);; + (* }}} *) + +let min_num_unique = prove_by_refinement( + `!X c. c IN X /\ (!c'. c' IN X ==> c <= c') ==> min_num X = c`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (arith `x <= (c:num) /\ c <= x ==> x = c`); + CONJ_TAC; + MATCH_MP_TAC min_num_le; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + MATCH_MP_TAC min_num_in; + BY(FIRST_X_ASSUM MP_TAC THEN SET_TAC[]) + ]);; + (* }}} *) + +let min_num_insert = prove_by_refinement( + `!x X. ~(X = {}) ==> min_num (x INSERT X) = MIN x (min_num X)`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + TYPIFY `x IN x INSERT X` (C SUBGOAL_THEN ASSUME_TAC); + BY(SET_TAC[]); + DISCH_TAC; + MATCH_MP_TAC min_num_unique; + CONJ_TAC; + REWRITE_TAC[MIN]; + COND_CASES_TAC; + BY(SET_TAC[]); + TYPIFY `min_num X IN X` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + MATCH_MP_TAC min_num_in; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[IN_INSERT]; + REPEAT STRIP_TAC; + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[MIN] THEN ARITH_TAC); + MATCH_MP_TAC (arith `m <= min_num X /\ min_num X <= c' ==> m <= c'`); + CONJ_TAC; + BY(REWRITE_TAC[MIN] THEN ARITH_TAC); + MATCH_MP_TAC min_num_le; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let minn_MIN = prove_by_refinement( + `minn = MIN`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[MIN;Ssrnat.minn]; + BY(ARITH_TAC) + ]);; + (* }}} *) + +let min_list_liz = prove_by_refinement( + `!x xs. min_list (x :: xs) = if (xs = []) then x else MIN x (min_list xs)`, + (* {{{ proof *) + [ + REWRITE_TAC[min_list;set_of_list]; + REPEAT GEN_TAC; + COND_CASES_TAC; + BY(ASM_REWRITE_TAC[set_of_list;min_num_single]); + MATCH_MP_TAC min_num_insert; + BY(ASM_REWRITE_TAC[SET_OF_LIST_EQ_EMPTY]) + ]);; + (* }}} *) + +(* +let max_num = new_definition `max_num (x:num->bool) = (@m. x m /\ (!n. x n ==> n <= m))`;; + +let bn_max_list = new_definition `bn_max_list (xs:num list) = max_num (set_of_list xs)`;; +*) + +(* 1.2.6 replace *) + +translate ("replace",`replace`);; + +let replace = new_recursive_definition list_RECURSION + `(replace x ys [] = []) /\ + replace x ys ( (z:A) :: zs) = + if (z = x) then APPEND ys zs else z:: (replace x ys zs)`;; + +(* +let sub_list = new_recursive_definition list_RECURSION + `sub_list r n xs [] = REVERSE xs /\ + sub_list r n xs ( (y:A) :: ys) = if (n=0) then (APPEND (REVERSE xs) ( r :: ys)) + else (sub_list r (n-1) ( y :: xs) ys)`;; +*) + +translate ("mapAt",`bn_mapAt`);; + +(* clean this up later. Isabelle has special notation for (mapAt1 f n [] xs) *) + +let mapAt1 = new_recursive_definition list_RECURSION + `mapAt1 (f:A->A) n xs [] = REVERSE xs /\ + mapAt1 (f:A->A) n xs ((y:A) :: ys) = if (n=0) then (APPEND (REVERSE xs) ( (f y) :: ys)) + else (mapAt1 f (n-1) (y :: xs) ys)`;; + +let bn_mapAt = new_recursive_definition list_RECURSION + `(bn_mapAt [] (f:A->A) (xs:A list) = xs) /\ + (bn_mapAt ((n:num) :: ns) (f:A->A) (xs:A list) = if (n < LENGTH xs) + then bn_mapAt ns f (mapAt1 f n [] xs) else bn_mapAt ns f xs)`;; + +(* 1.2.9 rotate *) + +translate ("rotate1",`rotate1`);; +translate ("rotate",`rotate`);; + +(* `rot` is different because rot changes only up to the length of the list *) + +let rotate1 = new_recursive_definition list_RECURSION + `rotate1 ([]:A list) = [] /\ + rotate1 ((x:A) :: xs) = APPEND xs [x]`;; + +let rotate = new_definition `rotate (n:num) (xs:A list) = (ITER n rotate1) xs`;; + +(* 1.3 splitAt *) + +translate ("splitAtRec",`splitAtRec`);; +translate ("splitAt",`splitAt`);; + +let splitAtRec = new_recursive_definition list_RECURSION + `splitAtRec (c:A) bs [] = (bs,[]) /\ + splitAtRec c bs ((a:A) :: xs) = if (a = c) then (bs,xs) else splitAtRec c (APPEND bs [a]) xs`;; + +let splitAt = new_definition `splitAt (c:A) xs = splitAtRec c [] xs`;; + +(* 1.4 between *) + +translate ("set",`set_of_list`);; +translate ("?",`IN`);; +translate ("between",`between'`);; (* between is already used in HOL-Light *) + +let between' = new_definition `between' (vs:A list) (ram1:A) (ram2:A) = + (let (pre1,post1) = splitAt ram1 vs in + if (ram2 IN set_of_list post1) then + (let (pre2,post2) = splitAt ram2 post1 in pre2) + else (let (pre2,post2) = splitAt ram2 pre1 in APPEND post1 pre2))`;; + +(* 1.5 Tables *) + +(* type (a,b) table is (a#b) list *) + +let bn_isTable = new_definition `bn_isTable (f:A->B) vs t = + !p. (set_of_list t p ==> ((SND p = f (FST p)) /\ set_of_list vs (FST p)))`;; + +let bn_removeKey = new_definition `bn_removeKey a (ps:(A#B) list) = + FILTER (\p. ~(a = FST p)) ps`;; + +let bn_removeKeyList = new_recursive_definition list_RECURSION + `bn_removeKeyList [] ps = ps /\ + bn_removeKeyList (w :: ws) (ps:(A#B) list) = bn_removeKey w (bn_removeKeyList ws ps)`;; + +(* infixes: =~ (congs) is congruence modulo rotation on lists, -~ unused on lists. + =~ is pr_isomorphism on graphs, -~ isomorphic of graphs. + + {=~} is Isabelle notation for {(f1,f2). f1 =~ f2}. + + type a Fgraph a list -> bool + a fgraph a list list +*) + +let bn_congs = new_definition `bn_congs (f1:A list) f2 = ?n. f2 = rotate n f1`;; + +(* 2.2 homomorphism and isomorphism *) + +let bn_is_Hom = new_definition`bn_is_Hom (phi:A->B) Fs1 Fs2 = + IMAGE bn_congs (IMAGE (MAP phi) Fs1) + = IMAGE bn_congs (Fs2)`;; + +let bn_inj_on = new_definition + `bn_inj_on (f:A->B) s = ( !x y. (s x /\ s y /\ (f x = f y)) ==> (x = y))`;; + +let bn_is_pr_Iso = new_definition `bn_is_pr_Iso (phi:A->B) Fs1 Fs2 = + (bn_is_Hom phi Fs1 Fs2 /\ bn_inj_on phi (UNIONS (IMAGE set_of_list Fs1)))`;; + +let bn_is_hom = new_definition + `bn_is_hom (phi:A->B) fs1 fs2 = bn_is_Hom phi (set_of_list fs1) (set_of_list fs2)`;; + +let bn_is_pr_iso = new_definition + `bn_is_pr_iso (phi:A->B) fs1 fs2 = bn_is_pr_Iso phi (set_of_list fs1) (set_of_list fs2)`;; + +(* +I don't think I'll need these: +*) + +(* bn_pr_iso_test0, bn_pr_iso_test1, *) + +(* 2.3.1 + def bn_oneone, + types (A,B) tester, (A,B) merger. + def bn_pr_iso_test2 + def bn_test:(A,B) tester + bn_merge:(A,B) merger + bn_test2:(A,B) tester + bn_merge2:(A,B) merger + bn_pr_iso_test3, + bn_pr_iso_test, +*) + +(* 2.3.2, improper isomorphisms *) + +let bn_is_Iso = new_definition `bn_is_Iso (phi:A->B) Fs1 Fs2 = + (bn_is_pr_Iso phi Fs1 Fs2 \/ bn_is_pr_Iso phi Fs1 (IMAGE REVERSE Fs2))`;; + +let bn_is_iso = new_definition `bn_is_iso (phi:A->B) fs1 fs2 = + bn_is_Iso phi (set_of_list fs1) (set_of_list fs2)`;; + +let bn_cong_iso = new_definition + `bn_cong_iso fs1 fs2 = ?(phi:A->B). bn_is_iso phi fs1 fs2`;; + +let bn_cong_pr_iso = new_definition + `bn_cong_pr_iso fs1 fs2 = ?(phi:A->B). bn_is_pr_iso phi fs1 fs2`;; + +(* -~ abbrev for bn_cong_iso, =~ bn_cong_pr_iso *) + +(* bn_iso_test, +*) + +(* 2.4 Elementhood *) + +(* XX drop primes *) + +let bn_pr_iso_in = new_definition + `bn_pr_iso_in (x:(A list) list) M = ?(y:(B list) list). (bn_cong_pr_iso x y /\ M y)`;; + +let bn_pr_iso_subseteq = new_definition + `bn_pr_iso_subseteq (M:(A list) list -> bool) (N:(B list) list -> bool) + = !x. M x ==> bn_pr_iso_in x N`;; + +let bn_iso_in = new_definition + `bn_iso_in (x:(A list) list) M = ?(y:(B list) list). (bn_cong_iso x y /\ M y)`;; + +let bn_iso_subseteq = new_definition + `bn_iso_subseteq (M:(A list) list -> bool) (N:(B list) list -> bool) + = !x. M x ==> bn_iso_in x N`;; + +(* 3.0 More rotation *) + +let rotate_to = new_definition `rotate_to (vs:A list) v = + v :: (APPEND (SND (splitAt v vs)) (FST (splitAt v vs)))`;; + +let rotate_min = new_definition `rotate_min (vs:num list) = + rotate_to vs (min_list vs)`;; + +(* 4.0 Graph + +UNION1 +INTER1 +UNION +INTER + +types vertex = nat + +const + vertices + edges + +abbrev vertices_set + +4.2 Faces + + facetype = Final | Nonfinal + datatype face = Face (vertex list) facetype + consts final:A->bool + type:A->facetype + + final_face = final:face->bool + type_face = type:face->facetype + vertices_face = vertices:face -> vertex list + + +*) + +let bn_final_face = new_definition `bn_final_face (vs:A,f:bool) = f`;; + +(* bn_type_face = bn_final_face *) + +let bn_vertices_face = new_definition `bn_vertices_face (vs:A,f:B) = vs`;; + +let bn_vertices_set = new_definition `bn_vertices_set (fs:A list#B) = + set_of_list (bn_vertices_face fs)`;; + +(* =~ on faces means =~ on vertex list *) + +(* delete: +let bn_set_final = new_definition `bn_set_final (vs:A,f:bool) = (vs,T)`;; +*) + +let bn_setFinal = new_definition `bn_setFinal (vs:A,f:bool) = (vs,T)`;; + +(* nextVertex written as a dot . *) + +let bn_nextElem = new_recursive_definition list_RECURSION + `bn_nextElem [] (b:A) x = b /\ + bn_nextElem (a :: aas) b x = + if (x=a) then (if (LENGTH aas = 0) then b else HD aas) else bn_nextElem aas b x`;; + +let bn_nextVertex = new_definition `bn_nextVertex (vs:A list,f:bool) = + bn_nextElem vs (HD vs)`;; + +let bn_edges = new_definition `bn_edges (fs:A list # bool) = + IMAGE (\a. (a, bn_nextVertex fs a)) (bn_vertices_set fs)`;; + +let bn_nextVertices = new_definition `bn_nextVertices (vs:A list,f:bool) (n:num) v = + (ITER n (bn_nextVertex (vs,f))) v`;; + +(* op = REVERSE, op_graph = Graph.op, op_graph *) + +let bn_prevVertex = new_definition `bn_prevVertex (vs:A list,f:bool) v = + (bn_nextElem (REVERSE vs) (LAST vs) v)`;; + +let bn_triangle = new_definition `bn_triangle (vs:A list,f:bool) = (LENGTH vs = 3)`;; + +(* 4.3 Graphs *) + +(* XX drop primes *) + +(* +bn_graph: +list of faces (with boolean marking if each face is final), +number of vertices, +list whose ith entry is the list of faces containing vertex i, +a list of heights. +*) + +let new_graph_th = prove(`?(x:((num list # bool) list) # (num) + # (((num list # bool) list) list) # (num list)) . T`,MESON_TAC[]);; + +let bn_graph_type = new_type_definition + "bn_graph" ("mk_bn_graph","dest_bn_graph") new_graph_th;; + +let bn_faces = new_definition `bn_faces g = FST (dest_bn_graph g)`;; + +(* abbrev F *) + +let bn_Faces = new_definition `bn_Faces g = set_of_list (bn_faces g)`;; + +let bn_countVertices = new_definition + `bn_countVertices g = FST (SND (dest_bn_graph g))`;; + +let bn_vertices_graph = new_definition + `bn_vertices_graph g = 0.. (bn_countVertices g - 1)`;; + +let bn_faceListAt = new_definition + `bn_faceListAt g = FST (SND (SND (dest_bn_graph g)))`;; + +let bn_facesAt = new_definition + `bn_facesAt g v = EL v (bn_faceListAt g )`;; + +let bn_heights = new_definition `bn_heights g = SND(SND(SND(dest_bn_graph g)))`;; + +let bn_height = new_definition `bn_height g v = EL v (bn_heights g)`;; + +(* seed *) + +let LIST_TO = new_recursive_definition num_RECURSION + `LIST_TO 0 = [] /\ LIST_TO (SUC n) = APPEND (LIST_TO n) [n]`;; + +let UPT= new_recursive_definition num_RECURSION + `UPT m 0 = [] /\ (UPT m (SUC n) = if (n < m) then [] else APPEND (UPT m n) [n] )`;; + +(* notation: [m.. bn_final_face f)`;; + +let bn_degree = new_definition `bn_degree g v = LENGTH(bn_facesAt g v)`;; + +let bn_tri = new_definition `bn_tri g v = + LENGTH(FILTER (\f. bn_final_face f /\ LENGTH(bn_vertices_face f)=3) (bn_facesAt g v))`;; + +let bn_quad = new_definition `bn_quad g v = + LENGTH(FILTER (\f. bn_final_face f /\ LENGTH(bn_vertices_face f)=4) (bn_facesAt g v))`;; + +let bn_except = new_definition `bn_except g v = + LENGTH(FILTER (\f. bn_final_face f /\ 5 <= LENGTH(bn_vertices_face f)) (bn_facesAt g v))`;; + +let bn_vertextype = new_definition `bn_vertextype g v = + (bn_tri g v, bn_quad g v, bn_except g v)`;; + +let bn_exceptionalVertex = new_definition `bn_exceptionalVertex g v = + ~(bn_except g v = 0)`;; + +let bn_noExceptionals = new_definition `bn_noExceptionals g V = + (!v. V v ==> ~(bn_exceptionalVertex g v))`;; + +let bn_edges_graph = new_definition + `bn_edges_graph g = UNIONS { bn_edges f | bn_Faces g f }`;; + +let bn_neighbors = new_definition + `bn_neighbors g v = MAP (\f. bn_nextVertex f v ) (bn_facesAt g v)`;; + +(* 4.5 Navigation in graphs *) + +(* nextFace *) + +let bn_directedLength = new_definition `bn_directedLength f (a:A) b = + if (a=b) then 0 else LENGTH(between'(bn_vertices_face f) a b) + 1`;; + +(* 4.6 Code generator setup *) + +(* 5 Vector *) + +(* vector = list *) + +(* 5.1 Tabulation *) + +let bn_tabulate0 = new_definition `bn_tabulate0 (p:num# (num->A)) = + (MAP (SND p) (LIST_TO (FST p)))`;; + +let bn_tabulate = new_definition `bn_tabulate n (f:num->A) = bn_tabulate0 (n,f)`;; + +let bn_tabulate2 = new_definition `bn_tabulate2 m n (f:num->num->A) = + bn_tabulate m (\i. bn_tabulate n (f i))`;; + +let bn_tabulate3 = new_definition `bn_tabulate3 l m n (f:num->num->num->A) = + bn_tabulate l (\i. bn_tabulate m (\j. bn_tabulate n (\k. f i j k)))`;; + +(* +syntax. [f. x < n], [f. x < m, y < n], [f. x < l, y < m, z < n]. +*) + +(* 5.2 Access *) + +let bn_sub1 = new_definition `bn_sub1 ((xs:A list), (n:num)) = EL n xs`;; + +let bn_sub = new_definition `bn_sub (a:A list) n = bn_sub1 (a,n)`;; + +(* notaton: a[n] = sub a n, a[m,n] = sub (sub a m) n, a[l,m,n] = sub(sub(sub a l)m)n *) + + +(* 6 Enumerating Patches *) + +let bn_enumBase = new_definition + `bn_enumBase nmax = MAP (\i. [i]) (LIST_TO (SUC nmax))`;; + +let bn_enumAppend = new_definition + `bn_enumAppend nmax iss = + concat (MAP (\is. MAP (\n. APPEND is [n]) (UPT (LAST is) (SUC nmax))) iss)`;; + +let bn_enumerator = new_definition + `bn_enumerator inner outer = + (let nmax = outer - 2 in + let k = inner - 3 in + (MAP (\is. APPEND [0] (APPEND is [outer -1])) + ((bn_enumAppend nmax POWER k) (bn_enumBase nmax))))`;; + +let bn_enumTab = new_definition + `bn_enumTab = bn_tabulate2 9 9 bn_enumerator`;; + +(* bn_enum already defined above, call this bn_enumt *) + +let bn_enumt = new_definition `bn_enumt inner outer = + if (inner < 9 /\ outer < 9) then (bn_sub(bn_sub bn_enumTab inner) outer) else + bn_enumerator inner outer`;; + +let bn_hideDupsRec = new_recursive_definition list_RECURSION + `bn_hideDupsRec (a:A) [] = [] /\ + bn_hideDupsRec a (b :: bs) = + if (a = b) then NONE :: (bn_hideDupsRec b bs) + else (SOME b) :: (bn_hideDupsRec b bs)`;; + +let bn_hideDups = new_recursive_definition list_RECURSION + `bn_hideDups ([]:A list) = [] /\ + bn_hideDups ((b:A) :: bs) = (SOME b) :: (bn_hideDupsRec b bs)`;; + +let bn_indexToVertexList = new_definition `bn_indexToVertexList f v is = + bn_hideDups (MAP (\k. bn_nextVertices f k (v:A)) is)`;; + +(* 7 Subdividing a Face *) + +let bn_split_face = new_definition + `bn_split_face f (ram1:A) ram2 newVs = + (let vs = bn_vertices_face f in + let f1 = APPEND [ram1] (APPEND (between' vs ram1 ram2) [ram2]) in + let f2 = APPEND [ram2] (APPEND (between' vs ram2 ram1) [ram1]) in + ((APPEND (REVERSE newVs) f1,F), ((APPEND f2 newVs), F)))`;; + +let bn_replacefacesAt = new_definition + `bn_replacefacesAt ns f fs Fs = bn_mapAt ns (replace f fs) Fs`;; + +let bn_makeFaceFinalFaceList = new_definition + `bn_makeFaceFinalFaceList f fs = replace f [bn_setFinal f] fs`;; + +let bn_makeFaceFinal = new_definition + `bn_makeFaceFinal f g = + mk_bn_graph ( + bn_makeFaceFinalFaceList f (bn_faces g), + bn_countVertices g, + MAP (\fs. bn_makeFaceFinalFaceList f fs) (bn_faceListAt g), + (bn_heights g) + )`;; + +let bn_heightsNewVertices = new_definition + `bn_heightsNewVertices h1 h2 n = + MAP (\i. min_num { (h1 + i + 1), (h2 + n -i) } ) (LIST_TO n)`;; + +let bn_splitFace = new_definition + `bn_splitFace g ram1 ram2 oldF newVs = + (let fs = bn_faces g in + let n = bn_countVertices g in + let Fs = bn_faceListAt g in + let h = bn_heights g in + let lVs = LENGTH(newVs) in + let vs1 = between' (bn_vertices_face oldF) ram1 ram2 in + let vs2 = between' (bn_vertices_face oldF) ram2 ram1 in + let (f1,f2) = bn_split_face oldF ram1 ram2 newVs in + let Fs = bn_replacefacesAt vs1 oldF [f1] Fs in + let Fs = bn_replacefacesAt vs2 oldF [f2] Fs in + let Fs = bn_replacefacesAt [ram1] oldF [f2;f1] Fs in + let Fs = bn_replacefacesAt [ram2] oldF [f1;f2] Fs in + let Fs = APPEND Fs (REPLICATE lVs [f1;f2]) in + (f1,f2, mk_bn_graph ((APPEND(replace oldF [f2] fs ) [f1]), (n + lVs), + Fs,(APPEND h (bn_heightsNewVertices (EL ram1 h) (EL ram2 h) lVs))) + ))`;; + +(* XX replaced @ with 'the' vo *) + +let bn_subdivFace0 = new_recursive_definition list_RECURSION + `bn_subdivFace0 g f u n [] = bn_makeFaceFinal f g /\ + bn_subdivFace0 g f u n (vo :: vos) = + if (vo = NONE) then bn_subdivFace0 g f u (SUC n) vos else + (let v = the vo in + if (bn_nextVertex f u = v /\ n = 0) then bn_subdivFace0 g f v 0 vos + else + (let ws = UPT (bn_countVertices g) (bn_countVertices g + n) in + let (f1,f2,g') = bn_splitFace g u v f ws in + bn_subdivFace0 g' f2 v 0 vos))`;; + +let bn_subdivFace = new_definition + `bn_subdivFace g f vos = bn_subdivFace0 g f (the(HD vos)) 0 (TL vos)`;; + + +(* 8. Transitive closure *) + +(* doing it somewhat differently from the Isabelle since Library/rstc.ml + already does the reflexive and transitive closure of a relation *) + +let bn_RTranCl = new_definition `bn_RTranCl (g:A -> A list) = + UNCURRY (RTC (\x y. MEM y (g x)))`;; + +let bn_invariant = new_definition `bn_invariant (P:A->bool) succs = + !g g'. MEM g (succs g) ==> P g ==> P g'`;; + +(* notation: g [s]->* g' for (g,g') IN (RTranCl s) *) + +(* 9. Plane Graph Enumeration *) + +let bn_maxGon = new_definition `bn_maxGon (p:num) = p + 3`;; + +let bn_duplicateEdge = new_definition `bn_duplicateEdge g f a b = + (2 <= bn_directedLength f a b /\ 2 <= bn_directedLength f b a /\ + set_of_list (bn_neighbors g a) b)`;; + +let bn_containsUnacceptableEdgeSnd = new_recursive_definition list_RECURSION + `bn_containsUnacceptableEdgeSnd N (v:num) [] = F /\ + bn_containsUnacceptableEdgeSnd N v (w :: ws) = + if (LENGTH ws = 0) then F else + (let w' = HD ws in + let ws' = TL ws in + if (v < w /\ w < w' /\ N w w') then T + else bn_containsUnacceptableEdgeSnd N w ws)`;; + +let bn_containsUnacceptableEdge = new_recursive_definition list_RECURSION + `bn_containsUnacceptableEdge N [] = F /\ + bn_containsUnacceptableEdge N (v :: vs) = + if (LENGTH vs = 0) then F else + (let w = HD vs in + let ws = TL vs in + if ((v:num) < w /\ N v w) then T else bn_containsUnacceptableEdgeSnd N v vs)`;; + +let bn_containsDuplicateEdge = new_definition + `bn_containsDuplicateEdge g f v is = bn_containsUnacceptableEdge + (\i j. bn_duplicateEdge g f (bn_nextVertices f i v ) (bn_nextVertices f j v)) is`;; + +(* a lemma in 13.3 proves this to be the same *) + +let bn_containsDuplicateEdge0 = new_definition + `bn_containsDuplicateEdge0 g f v is = + ((2 <= LENGTH is) /\ + ((?k. (k < LENGTH is - 2) /\ + (let i0 = EL k is in + let i1 = EL (k+1) is in + let i2 = EL (k+2) is in + (bn_duplicateEdge g f (bn_nextVertices f i1 v) (bn_nextVertices f i2 v) /\ + (i0 < i1 /\ i1 < i2)))) + \/ + (let i0 = EL 0 is in + let i1 = EL 1 is in + (bn_duplicateEdge g f (bn_nextVertices f i0 v) (bn_nextVertices f i1 v) /\ + (i0 < i1)))))`;; + +let bn_generatePolygon = new_definition + `bn_generatePolygon n v f g = + (let enumeration = bn_enumerator n (LENGTH (bn_vertices_face f)) in + let enumeration = FILTER (\is. ~(bn_containsDuplicateEdge g f v is)) enumeration in + let vertexLists = MAP (\is. bn_indexToVertexList f v is) enumeration in + MAP (\vs. bn_subdivFace g f vs) vertexLists)`;; + +(* concatenated union *) + +let c_union = new_definition `c_union xs r = concat (MAP r xs)`;; + +let bn_Seed = new_definition + `bn_Seed p = bn_graph (bn_maxGon p)`;; + +(* + +let bn_next_plane0 = new_definition + `bn_next_plane0 p g = if (bn_finalGraph g) then [] else + c_union (bn_nonFinals g) + (\f. c_union (bn_vertices_face f) + (\v. c_union (UPT 3 (SUC(bn_maxGon p))) + (\i. bn_generatePolygon i v f g)))`;; + + +let bn_PlaneGraphs0 = new_definition + `bn_PlaneGraphs0 = + { g | ? p. bn_RTranCl (bn_next_plane0 p) (bn_Seed p,g) /\ bn_finalGraph g }`;; + +*) + +(* Plane1 *) + +let bn_minimalFace = new_definition + `bn_minimalFace = bn_minimal (LENGTH o bn_vertices_face)`;; + +let bn_minimalVertex = new_definition + `bn_minimalVertex g f = bn_minimal (bn_height g) (bn_vertices_face f)`;; + +let bn_next_plane = new_definition + `bn_next_plane p g = + (let fs = bn_nonFinals g in + if (fs = []) then [] else + (let f = bn_minimalFace fs in + let v = bn_minimalVertex g f in + c_union (UPT 3 (SUC (bn_maxGon p))) (\i. bn_generatePolygon i v f g)))`;; + +let bn_PlaneGraphsP = new_definition + `bn_planeGraphsP p = + { g | bn_RTranCl (bn_next_plane p) (bn_Seed p,g) /\ bn_finalGraph g} `;; + +let bn_PlaneGraphs = new_definition +`bn_PlaneGraphs = UNIONS (IMAGE bn_planeGraphsP (:num))`;; + +(* 10 Properties *) + +(* 11 Properties of Patch Enumeration *) + +(* bn_increasing *) + +(* 12 Properties of Face Division *) + +(* bn_is_prefix *) + +(* bn_is_sublist *) + +(* 12.4, bn_is_nextElem *) +(* 12.6, bn_before *) +(* 12.7, bn_pre_between *) +(* 12.8, bn_pre_split_face *) +(* 12.9, bn_verticesFrom *) +(* 12.10 bn_pre_splitFace, bn_Edges, *) +(* 12.11 bn_removeNones *) +(* 12.12 bn_natToVertexListRec, bn_natToVertexList *) +(* 12.13 bn_is_duplicateEdge, bn_invalidVertexList *) +(* 12.14 bn_subdivFace, bn_pre_subdivFace, bn_pre_subdivFace0 *) + +(* 13 *) + +(* 13.1, bn_minVertex, bn_normFace, bn_normFaces, +etc. etc. + +*) + + +(* 16 Tameness *) + +let bn_squanderTarget = new_definition `bn_squanderTarget = 15410`;; + +let bn_excessTCount = new_definition `bn_excessTCount = 6300`;; + +let bn_squanderVertex = new_definition `bn_squanderVertex p q = + if (p=0 /\ q=3) then 6180 else + if (p=0 /\ q=4) then 9700 else + if (p=1 /\ q=2) then 6560 else + if (p=1 /\ q=3) then 6180 else + if (p=2 /\ q=1) then 7970 else + if (p=2 /\ q=2) then 4120 else + if (p=2 /\ q=3) then 12851 else + if (p=3 /\ q=1) then 3110 else + if (p=3 /\ q=2) then 8170 else + if (p=4 /\ q=0) then 3470 else + if (p=4 /\ q=1) then 3660 else + if (p=5 /\ q=0) then 400 else + if (p=5 /\ q=1) then 11360 else + if (p=6 /\ q=0) then 6860 else + if (p=7 /\ q=0) then 14500 else bn_squanderTarget`;; + +let bn_squanderFace = new_definition `bn_squanderFace n = + if (n=3) then 0 else + if (n=4) then 2060 else + if (n=5) then 4819 else + if (n=6) then 7120 else bn_squanderTarget`;; +(* tchales, changed n=6 case from 7578, 1/15/2012 to match + tame_defs.hl, main_estimate_ineq.hl and graph generator *) + +(* +let bn_separated2 = new_definition `bn_separated2 g V = + !v. V v ==> ( !f. (MEM f (bn_facesAt g v)) ==> ~(V (bn_nextVertex f v)))`;; + +let bn_separated3 = new_definition `bn_separated3 g V = + !v. V v ==> (!f. (MEM f (bn_facesAt g v)) ==> LENGTH (bn_vertices_face f)<= 4 ==> + (bn_vertices_set f INTER V = { v }) )`;; + +let bn_separated = new_definition `bn_separated g V = + (bn_separated2 g V /\ bn_separated3 g V)`;; +*) + + +(* 16.3 Admissible weight assignments *) + +let bn_admissible1 = new_definition `bn_admissible1 w g = + (!f. bn_Faces g f ==> bn_squanderFace (LENGTH (bn_vertices_face f)) <= w f)`;; + +let LIST_SUM = new_definition `LIST_SUM xs (f:A->num) = ITLIST (\x y. f x + y) xs 0`;; + +let bn_admissible2 = new_definition `bn_admissible2 w g = + (!v. bn_vertices_graph g v ==> (bn_except g v = 0) ==> + bn_squanderVertex (bn_tri g v) (bn_quad g v) <= LIST_SUM (bn_facesAt g v) w)`;; + +let bn_admissible3 = new_definition `bn_admissible3 w g = + (!v. bn_vertices_graph g v ==> (bn_vertextype g v = (5,0,1)) ==> + (LIST_SUM (FILTER bn_triangle (bn_facesAt g v)) w >= bn_excessTCount))`;; + +let bn_admissible = new_definition `bn_admissible w g = + (bn_admissible1 w g /\ bn_admissible2 w g /\ bn_admissible3 w g) `;; + +(* 16.4 Tameness *) + +let bn_tame9a = new_definition `bn_tame9a g = + (!f. bn_Faces g f ==> + 3 <= LENGTH(bn_vertices_face f) /\ LENGTH(bn_vertices_face f) <= 6)`;; + +let bn_tame10 = new_definition `bn_tame10 g = + (let n = bn_countVertices g in + 13 <= n /\ n <= 15)`;; + +let bn_tame11a = new_definition `bn_tame11a g = + (!v. bn_vertices_graph g v ==> 3 <= bn_degree g v)`;; + +let bn_tame11b = new_definition `bn_tame11b g = + (!v. bn_vertices_graph g v ==> + bn_degree g v <= (if (bn_except g v = 0) then 7 else 6))`;; + +let bn_tame12o = new_definition `bn_tame12o g = + (!v. bn_vertices_graph g v ==> + (~(bn_except g v = 0) /\ bn_degree g v = 6) ==> (bn_vertextype g v = (5,0,1)))`;; + +let bn_tame13a = new_definition `bn_tame13a g = + (?w. bn_admissible w g /\ LIST_SUM (bn_faces g) w < bn_squanderTarget)`;; + +let bn_tame = new_definition `bn_tame g= + (bn_tame9a g /\ bn_tame10 g/\ bn_tame11a g/\ + bn_tame11b g/\ bn_tame12o g/\ bn_tame13a g)`;; + +(* 26 *) + +let bn_fgraph = new_definition `bn_fgraph g = MAP bn_vertices_face (bn_faces g)`;; + +(* the list bn_Archive is the concatenation of bn_Tri, bn_Quad, bn_Pent, and bn_Hex. + These definitions need to be loaded from the Arch theory (which converts + them from .ML files) *) + +(* (* bn_tame_archive is defined in ../../tame_archive/tame_archive.hl *) +let tame_graph_classification_theorem = (* new_definition *) + `tame_graph_classification_theorem = + (!g. bn_PlaneGraphs g /\ bn_tame g ==> bn_iso_in (bn_fgraph g) bn_tame_archive)`;; + +*) + + +*) + + +end;; diff --git a/text_formalization/hypermap/hypermap.hl b/text_formalization/hypermap/hypermap.hl new file mode 100644 index 0000000..8420bc1 --- /dev/null +++ b/text_formalization/hypermap/hypermap.hl @@ -0,0 +1,15868 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Hypermap *) +(* Author: Tran Nam Trung *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + +module type Hypermap_type = sig + +end;; + +(* needs "Library/permutations.ml";; *) + +module Hypermap (* : Hypermap_type *) = struct + +prioritize_num();; + + +parse_as_infix("POWER",(24,"right"));; + +parse_as_infix("belong",(11,"right"));; + +parse_as_infix("iso",(24,"right"));; + +(* The definition of the nth exponent of a map *) + + let EQ_SUC = SUC_INJ;; (* Harrison eliminated EQ_SUC because it duplicates SUC_INJ *) + + +let POWER = new_recursive_definition num_RECURSION + `(!(f:A->A). f POWER 0 = I) /\ + (!(f:A->A) (n:num). f POWER (SUC n) = (f POWER n) o f)`;; + +let POWER_0 = prove(`!f:A->A. f POWER 0 = I`, + REWRITE_TAC[POWER]);; + +let POWER_1 = prove(`!f:A->A. f POWER 1 = f`, + REWRITE_TAC[POWER; ONE; I_O_ID]);; + +let POWER_2 = prove(`!f:A->A. f POWER 2 = f o f`, + REWRITE_TAC[POWER; TWO; POWER_1]);; + +let orbit_map = new_definition `orbit_map (f:A->A) (x:A) = {(f POWER n) x | n >= 0}`;; + + +let ASM_ASM_SET_TAC = ASSUM_LIST (MP_TAC o end_itlist CONJ) THEN SET_TAC[];; + +let lemma_two_series_eq = prove(`!p:num->A q:num->A n:num. (!i:num. i <= n ==> p i = q i) ==> {p (i:num) | i <= n} = {q (i:num) | i <= n}`, + REPEAT STRIP_TAC THEN ASM_ASM_SET_TAC);; + +let lemma_add_one_assumption = prove(`!P. !(n:num). (!i:num. i <= SUC n ==> P i) <=> (!i:num. i <= n ==> P i) /\ P (SUC n)`, + REPEAT GEN_TAC + THEN EQ_TAC + THENL[STRIP_TAC + THEN STRIP_TAC + THENL[REPEAT STRIP_TAC + THEN FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `i:num <= n:num ==> i <= SUC n`) th]); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[LE_REFL] o SPEC `SUC n`) + THEN SIMP_TAC[]; ALL_TAC] + THEN STRIP_TAC + THEN REPEAT STRIP_TAC + THEN ASM_CASES_TAC `i:num = SUC n` + THENL[POP_ASSUM SUBST1_TAC + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) + THEN REWRITE_TAC[IMP_IMP; GSYM LT_LE; LT_SUC_LE] + THEN DISCH_TAC + THEN FIRST_X_ASSUM (MP_TAC o SPEC `i:num` o check (is_forall o concl)) + THEN ASM_REWRITE_TAC[]);; + +let lemma_sub_part = prove(`!P. !n:num m:num. (!i:num. i <= n ==> P i) /\ m <= n ==> (!i:num. i <= m ==> P i)`, + REPEAT STRIP_TAC THEN FIRST_ASSUM (MP_TAC o SPEC `i:num`) + THEN POP_ASSUM (fun th1-> POP_ASSUM (fun th2-> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ th1 th2)])));; + +(* the definition of hypermap *) + +let exist_hypermap = prove(`?H:((A->bool)#(A->A)#(A->A)#(A->A)). FINITE (FST H) /\ (FST(SND H)) permutes (FST H) /\ (FST(SND(SND H))) permutes (FST H) /\ (SND(SND(SND H))) permutes (FST H) /\ (FST(SND H)) o (FST(SND(SND H))) o (SND(SND(SND H))) = I`,EXISTS_TAC +`({},I,I,I):(A->bool)#(A->A)#(A->A)#(A->A)` THEN REWRITE_TAC[FINITE_RULES; PERMUTES_I; I_O_ID]);; + +let hypermap_tybij = (new_type_definition "hypermap" ("hypermap", "tuple_hypermap")exist_hypermap);; + +let dart = new_definition `dart (H:(A)hypermap) = FST (tuple_hypermap H)`;; + +let edge_map = new_definition `edge_map (H:(A)hypermap) = FST(SND(tuple_hypermap H))`;; + +let node_map = new_definition `node_map (H:(A)hypermap) = FST(SND(SND(tuple_hypermap H)))`;; + +let face_map = new_definition `face_map (H:(A)hypermap) = SND(SND(SND(tuple_hypermap H)))`;; + +let hypermap_lemma = prove(`!H:(A)hypermap. FINITE (dart H) /\ edge_map H + permutes dart H /\ node_map H permutes dart H /\ face_map H permutes dart + H /\ edge_map H o node_map H o face_map H = I`, + + ASM_REWRITE_TAC[hypermap_tybij;dart;edge_map; node_map; face_map]);; + +(* some technical lemmas *) + +let edge_map_and_darts = prove(`!(H:(A)hypermap). FINITE (dart H) /\ edge_map H permutes (dart H)`, + REWRITE_TAC[hypermap_lemma]);; + +let node_map_and_darts = prove(`!(H:(A)hypermap). FINITE (dart H) /\ node_map H permutes (dart H)`, + REWRITE_TAC[hypermap_lemma]);; + +let face_map_and_darts = prove(`!(H:(A)hypermap). FINITE (dart H) /\ face_map H permutes (dart H)`, + REWRITE_TAC[hypermap_lemma]);; + +(* edges, nodes and faces of a hypermap *) + +let edge = new_definition `edge (H:(A)hypermap) (x:A) = orbit_map (edge_map H) x`;; + +let node = new_definition `node (H:(A)hypermap) (x:A) = orbit_map (node_map H) x`;; + +let face = new_definition `face (H:(A)hypermap) (x:A) = orbit_map (face_map H) x`;; + + +(* We define the combinatorial component *) + +let go_one_step = new_definition `go_one_step (H:(A)hypermap) (x:A) (y:A) <=> (y = (edge_map H) x) \/ (y = (node_map H) x) \/ (y = (face_map H) x)`;; + +let is_path = new_recursive_definition num_RECURSION `(is_path (H:(A)hypermap) (p:num->A) 0 <=> T)/\ +(is_path (H:(A)hypermap) (p:num->A) (SUC n) <=> ((is_path H p n) /\ go_one_step H (p n) (p (SUC n))))`;; + +let is_in_component = new_definition `is_in_component (H:(A)hypermap) (x:A) (y:A) <=> ?p:num->A n:num. p 0 = x /\ p n = y /\ is_path H p n`;; + +let comb_component = new_definition `comb_component (H:(A)hypermap) (x:A) = {y:A| is_in_component H x y}`;; + + +(* some definitions on orbits *) + +let set_of_orbits = new_definition `set_of_orbits (D:A->bool) (f:A->A) = {orbit_map f x | x IN D}`;; + +let number_of_orbits = new_definition `number_of_orbits (D:A->bool) (f:A->A) = CARD(set_of_orbits D f)`;; + + +(* the orbits on hypermaps*) + +let edge_set = new_definition `edge_set (H:(A)hypermap) = set_of_orbits (dart H) (edge_map H)`;; + +let node_set = new_definition `node_set (H:(A)hypermap) = set_of_orbits (dart H) (node_map H)`;; + +let face_set = new_definition `face_set (H:(A)hypermap) = set_of_orbits (dart H) (face_map H)`;; + + +let set_components = new_definition `set_components (H:(A)hypermap) (D:A->bool) = {comb_component H (x:A) | x IN D}`;; + +let set_part_components = new_definition `set_part_components (H:(A)hypermap) (D:A->bool) = {(comb_component H (x:A)) | x IN D}`;; + +let set_of_components = new_definition `set_of_components (H:(A)hypermap) = set_part_components H (dart H)`;; + + +(* counting the numbers of edges, nodes, faces and combinatorial components *) + +let number_of_edges = new_definition `number_of_edges (H:(A)hypermap) = CARD (edge_set H)`;; + +let number_of_nodes = new_definition `number_of_nodes (H:(A)hypermap) = CARD (node_set H)`;; + +let number_of_faces = new_definition `number_of_faces (H:(A)hypermap) = CARD (face_set H)`;; + +let number_of_components = new_definition `number_of_components (H:(A)hypermap) = CARD (set_of_components H)`;; + +(* some special kinds of hypergraphs *) + +let plain_hypermap = new_definition `plain_hypermap (H:(A)hypermap) <=> edge_map H o edge_map H = I`;; + +let planar_hypermap = new_definition `planar_hypermap (H:(A)hypermap) <=> + number_of_nodes H + number_of_edges H + number_of_faces H + = (CARD (dart H)) + 2 * number_of_components H`;; + +let simple_hypermap = new_definition `simple_hypermap (H:(A)hypermap) <=> + (!x:A. x IN dart H ==> (node H x) INTER (face H x) = {x})`;; + + +(* a dart x is degenerate or nondegenerate *) + +let dart_degenerate = new_definition `dart_degenerate (H:(A)hypermap) (x:A) + <=> (edge_map H x = x \/ node_map H x = x \/ face_map H x = x)`;; + +let dart_nondegenerate = new_definition `dart_nondegenerate (H:(A)hypermap) (x:A) + <=> ~(edge_map H x = x) /\ ~(node_map H x = x) /\ ~(face_map H x = x)`;; + +let is_edge_nondegenerate = new_definition `is_edge_nondegenerate (H:(A)hypermap) <=> (!x:A. x IN dart H ==> ~(edge_map H x = x))`;; + +let is_node_nondegenerate = new_definition `is_node_nondegenerate (H:(A)hypermap) <=> (!x:A. x IN dart H ==> ~(node_map H x = x))`;; + +let is_face_nondegenerate = new_definition `is_face_nondegenerate (H:(A)hypermap) <=> (!x:A. x IN dart H ==> ~(face_map H x = x))`;; + + +(* some relationships of maps and orbits of maps *) + +let LEFT_MULT_MAP = prove(`!u:A->A v:A->A w:A->A. v = w ==> u o v = u o w`, MESON_TAC[]);; + +let RIGHT_MULT_MAP = prove(`!u:A->A v:A->A w:A->A. u = v ==> u o w = v o w`, MESON_TAC[]);; + +let LEFT_INVERSE_EQUATION = prove(`!s:A->bool u:A->A v:A->A w:A->A. u permutes s /\ u o v = w ==> v = inverse u o w`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `inverse (u:A->A) o u o (v:A->A) = inverse u o (w:A->A)` MP_TAC + THENL[ ASM_MESON_TAC[]; REWRITE_TAC[o_ASSOC] + THEN ASM_MESON_TAC[PERMUTES_INVERSES_o; I_O_ID]]);; + +let RIGHT_INVERSE_EQUATION = prove(`!s:A->bool u:A->A v:A->A w:A->A. v permutes s /\ u o v = w ==> u = w o inverse v`, + REPEAT STRIP_TAC + THEN SUBGOAL_THEN `(u:A->A) o (v:A->A) o inverse v = (w:A->A) o inverse v` MP_TAC + THENL [ASM_MESON_TAC[o_ASSOC]; ASM_MESON_TAC[PERMUTES_INVERSES_o;I_O_ID]]);; + +let iterate_orbit = prove(`!(s:A->bool) (u:A->A). u permutes s ==> !(n:num) (x:A). x IN s ==> (u POWER n) x IN s`, + REPEAT GEN_TAC THEN DISCH_THEN(ASSUME_TAC o MATCH_MP PERMUTES_IN_IMAGE) + THEN INDUCT_TAC + THENL[GEN_TAC THEN REWRITE_TAC[POWER; I_THM]; REPEAT GEN_TAC + THEN REWRITE_TAC[POWER; o_DEF] THEN ASM_MESON_TAC[]]);; + +let orbit_subset = prove(`!(s:A->bool) (u:A->A). u permutes s ==> !(x:A). x IN s ==> (orbit_map u x) SUBSET s`, + REPEAT STRIP_TAC THEN REWRITE_TAC[SUBSET; orbit_map; IN_ELIM_THM] + THEN ASM_MESON_TAC[iterate_orbit]);; + +let COM_POWER = prove(`!(n:num) (f:A->A). f POWER (SUC n) = f o (f POWER n)`, + INDUCT_TAC THENL[REWRITE_TAC [ONE; POWER;I_O_ID]; ALL_TAC] + THEN REPEAT STRIP_TAC THEN POP_ASSUM(ASSUME_TAC o GSYM o (ISPEC `f:A->A`)) + THEN ASM_REWRITE_TAC[POWER; o_ASSOC]);; + +let COM_POWER_FUNCTION = prove(`!f:A->A x:A n:num. f ((f POWER n) x) = (f POWER (SUC n)) x`, + REPEAT GEN_TAC THEN MP_TAC (AP_THM (SPECL[`n:num`; `f:A->A`] COM_POWER) `x:A`) THEN REWRITE_TAC[o_THM; EQ_SYM]);; + +let POWER_FUNCTION = prove(`!f:A->A x:A n:num. (f POWER n) (f x) = (f POWER (SUC n)) x`, + REPEAT GEN_TAC THEN MP_TAC (AP_THM (SPECL[`f:A->A`; `n:num`] (CONJUNCT2 POWER)) `x:A`) THEN REWRITE_TAC[o_THM; EQ_SYM]);; + +let addition_exponents = prove(`!m n (f:A->A). f POWER (m + n) = (f POWER m) o (f POWER n)`, + INDUCT_TAC THENL [STRIP_TAC THEN REWRITE_TAC[ADD; POWER; I_O_ID]; ALL_TAC] + THEN POP_ASSUM(ASSUME_TAC o GSYM o (ISPECL[`n:num`;`f:A->A`])) + THEN REWRITE_TAC[COM_POWER; GSYM o_ASSOC] + THEN ASM_REWRITE_TAC[COM_POWER; GSYM o_ASSOC; ADD]);; + +let multiplication_exponents = prove(`!m n (f:A->A). f POWER (m * n) = (f POWER n) POWER m`, + INDUCT_TAC + THENL [STRIP_TAC THEN REWRITE_TAC[MULT; POWER; I_O_ID]; ALL_TAC] + THEN REPEAT GEN_TAC THEN POP_ASSUM(ASSUME_TAC o (SPECL[`n:num`; `f:A->A`])) + THEN ASM_REWRITE_TAC[MULT; addition_exponents; POWER]);; + +let power_unit_map = prove(`!n f:A->A. f POWER n = I ==> !m. f POWER (m * n) = I`, + REPLICATE_TAC 3 STRIP_TAC THEN INDUCT_TAC THENL[REWRITE_TAC[MULT; POWER]; + REWRITE_TAC[MULT; addition_exponents] THEN ASM_REWRITE_TAC[I_O_ID]]);; + +let power_map_fix_point = prove(`!n f:A->A x:A. (f POWER n) x = x ==> !m. (f POWER (m * n)) x = x`, + REPEAT GEN_TAC THEN STRIP_TAC THEN INDUCT_TAC + THENL [REWRITE_TAC[MULT; POWER; I_THM]; + REWRITE_TAC[MULT; addition_exponents; o_DEF] THEN ASM_REWRITE_TAC[]]);; + +let lemma_add_exponent_function = prove(`!(p:A->A) m:num n:num x:A. (p POWER (m+n)) x = (p POWER m) ((p POWER n) x)`, + REPEAT STRIP_TAC THEN ASSUME_TAC (SPECL[`m:num`;`n:num`; `p:A->A`] addition_exponents) + THEN POP_ASSUM (fun th -> (MP_TAC(AP_THM th `x:A`))) THEN REWRITE_TAC[o_THM]);; + +let iterate_map_valuation = prove(`!(p:A->A) (n:num) (x:A). p ((p POWER n) x) = (p POWER (SUC n)) x`, + REPEAT STRIP_TAC THEN ASSUME_TAC (SPECL[`n:num`; `p:A->A`] (GSYM COM_POWER)) + THEN POP_ASSUM (fun th -> (MP_TAC (AP_THM th `x:A`))) + THEN REWRITE_TAC[o_THM]);; + +let iterate_map_valuation2 = prove(`!(p:A->A) (n:num) (x:A). (p POWER n) (p x) = (p POWER (SUC n)) x`, + REPEAT STRIP_TAC THEN ASSUME_TAC (SPECL[`p:A->A`; `n:num`] (CONJUNCT2 POWER)) + THEN POP_ASSUM (fun th -> (MP_TAC (AP_THM th `x:A`))) + THEN REWRITE_TAC[o_THM; EQ_SYM]);; + +let in_orbit_lemma = prove(`!f:A->A n:num x:A y:A. y = (f POWER n) x ==> y IN orbit_map f x`, + REPEAT STRIP_TAC THEN REWRITE_TAC[orbit_map;IN_ELIM_THM] + THEN EXISTS_TAC `n:num` + THEN ASM_REWRITE_TAC[ARITH_RULE `n:num >= 0`]);; + +let lemma_in_orbit = prove(`!f:A->A n:num x:A. (f POWER n) x IN orbit_map f x`, + REPEAT STRIP_TAC + THEN REWRITE_TAC[orbit_map;IN_ELIM_THM] + THEN EXISTS_TAC `n:num` THEN REWRITE_TAC[LE_0; GE]);; + +let orbit_one_point = prove(`!f:A->A x:A. f x = x <=> orbit_map f x = {x}`, + REPEAT GEN_TAC THEN EQ_TAC + THENL[STRIP_TAC THEN REWRITE_TAC[EXTENSION;IN_SING] THEN GEN_TAC + THEN REWRITE_TAC[orbit_map; IN_ELIM_THM] + THEN EQ_TAC + THENL[STRIP_TAC THEN MP_TAC(SPECL[`1`; `f:A->A`; `x:A`] power_map_fix_point) + THEN ASM_REWRITE_TAC[POWER_1;MULT_CLAUSES] + THEN DISCH_THEN (ASSUME_TAC o SPEC `n:num`) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN STRIP_TAC THEN EXISTS_TAC `0` THEN ASM_REWRITE_TAC [ARITH_RULE `0 >= 0`; POWER; I_THM]; ALL_TAC] + THEN STRIP_TAC THEN MP_TAC (SPECL[`f:A->A`; `1`; `(x:A)`; `(f:A->A) (x:A)`] in_orbit_lemma) + THEN ASM_REWRITE_TAC[POWER_1; IN_SING]);; + +let lemma_orbit_finite = prove(`!(s:A->bool) (p:A->A) (x:A). FINITE s /\ p permutes s ==> FINITE (orbit_map p x)`, + REPEAT STRIP_TAC THEN ASM_CASES_TAC `x:A IN s:A->bool` + THENL[REPEAT STRIP_TAC + THEN UNDISCH_THEN `(p:A->A) permutes (s:A->bool)` (MP_TAC o SPEC `x:A` o MATCH_MP orbit_subset) + THEN ASM_MESON_TAC[FINITE_SUBSET]; ALL_TAC] + THEN SUBGOAL_THEN `(p:A->A) x:A = x:A` MP_TAC + THENL[ASM_MESON_TAC[permutes]; ALL_TAC] + THEN ONCE_REWRITE_TAC[orbit_one_point] THEN DISCH_THEN SUBST1_TAC THEN ASSUME_TAC (CONJUNCT1 CARD_CLAUSES) + THEN ASSUME_TAC (CONJUNCT1 FINITE_RULES) THEN MP_TAC(SPECL[`x:A`;`{}:A->bool`] (CONJUNCT2 FINITE_RULES)) + THEN ASM_REWRITE_TAC[NOT_IN_EMPTY] THEN ARITH_TAC);; + +let orbit_cyclic = prove(`!(f:A->A) m:num (x:A). ~(m = 0) /\ (f POWER m) x = x ==> orbit_map f x = {(f POWER k) x | k < m}`, + REPEAT STRIP_TAC THEN REWRITE_TAC[orbit_map; EXTENSION; IN_ELIM_THM] + THEN GEN_TAC THEN EQ_TAC + THENL [STRIP_TAC THEN ASM_REWRITE_TAC[] + THEN FIND_ASSUM (MP_TAC o (SPEC `n:num`) o MATCH_MP DIVMOD_EXIST) `~(m:num = 0)` + THEN REPEAT STRIP_TAC + THEN UNDISCH_THEN `((f:A->A) POWER (m:num)) (x:A) = x` (ASSUME_TAC o (SPEC `q:num`) o MATCH_MP power_map_fix_point) + THEN ASM_REWRITE_TAC[ADD_SYM; addition_exponents; o_DEF] + THEN EXISTS_TAC `r:num` THEN ASM_SIMP_TAC[]; REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] + THEN EXISTS_TAC `k:num` THEN SIMP_TAC[LE_0; GE]]);; + +(* Some obviuos facts about common hypermap maps *) + +let power_permutation = prove(`!(s:A->bool) (p:A->A). p permutes s ==> !(n:num). (p POWER n) permutes s`, + REPLICATE_TAC 3 STRIP_TAC THEN INDUCT_TAC + THENL[REWRITE_TAC[POWER; PERMUTES_I]; REWRITE_TAC[POWER] THEN ASM_MESON_TAC[PERMUTES_COMPOSE]]);; + +let inverse_function = prove( `!s:A->bool p:A->A x:A y:A. p permutes s /\ p x = y ==> x = (inverse p) y`, + REPEAT STRIP_TAC THEN POP_ASSUM (MP_TAC o AP_TERM `inverse (p:A->A)`) THEN STRIP_TAC + THEN MP_TAC (ISPECL[`inverse(p:A->A)`; `p:A->A`; `x:A`] o_THM) + THEN POP_ASSUM (SUBST1_TAC o SYM) THEN POP_ASSUM (ASSUME_TAC o CONJUNCT2 o MATCH_MP PERMUTES_INVERSES_o) + THEN POP_ASSUM SUBST1_TAC THEN REWRITE_TAC[I_THM]);; + +let lemma_4functions = prove(`!f g h r. f o g o h o r = f o (g o h) o r `, REPEAT STRIP_TAC THEN REWRITE_TAC[GSYM o_ASSOC]);; + +let lemma_power_inverse_map = prove(`!s:A->bool p:A->A n:num. p permutes s ==> + ((inverse p) POWER n) o (p POWER n) = I /\ (p POWER n) o ((inverse p) POWER n) = I`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN SUBGOAL_THEN `((p:A->A) POWER (n:num)) o ((inverse p) POWER n) = I` (LABEL_TAC "F2") + THENL[SPEC_TAC(`n:num`, `n:num`) + THEN INDUCT_TAC + THENL[REWRITE_TAC[POWER_0; I_O_ID]; ALL_TAC] + THEN GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [COM_POWER] + THEN GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [POWER] + THEN REWRITE_TAC[GSYM o_ASSOC] + THEN REWRITE_TAC[lemma_4functions] + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[I_O_ID] + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP PERMUTES_INVERSES_o th]); ALL_TAC] + THEN ASM_REWRITE_TAC[] + THEN REMOVE_THEN "F1" (LABEL_TAC "F1" o SPEC `n:num` o MATCH_MP power_permutation) + THEN USE_THEN "F1" (fun th -> (REMOVE_THEN "F2" (fun th2 -> (MP_TAC (MATCH_MP LEFT_INVERSE_EQUATION (CONJ th th2)))))) + THEN DISCH_THEN (SUBST1_TAC o REWRITE_RULE[I_O_ID]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP PERMUTES_INVERSES_o th]));; + +let lemma_power_inverse = prove(`!s:A->bool p:A->A n:num. p permutes s + ==> (inverse p) POWER n = inverse (p POWER n) /\ inverse ((inverse p) POWER n) = p POWER n`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN USE_THEN "F1" (LABEL_TAC "F2" o SPEC `n:num` o MATCH_MP power_permutation) + THEN SUBGOAL_THEN `(inverse (p:A->A)) POWER (n:num) = inverse (p POWER n)` ASSUME_TAC + THENL[REMOVE_THEN "F1" (MP_TAC o CONJUNCT1 o SPEC `n:num` o MATCH_MP lemma_power_inverse_map) + THEN DISCH_THEN (fun th1 -> (POP_ASSUM (fun th -> MP_TAC (MATCH_MP RIGHT_INVERSE_EQUATION (CONJ th th1))))) + THEN REWRITE_TAC[I_O_ID]; ALL_TAC] + THEN ASM_REWRITE_TAC[] + THEN USE_THEN "F2" (fun th ->REWRITE_TAC[MATCH_MP PERMUTES_INVERSE_INVERSE th]));; + +let inverse_power_function = prove(`!(s:A->bool) (p:A->A) n:num x:A y:A. p permutes s ==> (y = (p POWER n) x <=> x = ((inverse p) POWER n) y)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN USE_THEN "F1" (ASSUME_TAC o SPEC `n:num` o MATCH_MP power_permutation) + THEN POP_ASSUM (MP_TAC o SPECL[`x:A`; `y:A`] o MATCH_MP PERMUTES_INVERSE_EQ) + THEN POP_ASSUM (SUBST1_TAC o SYM o CONJUNCT1 o SPEC `n:num` o MATCH_MP lemma_power_inverse) + THEN MESON_TAC[]);; + +let edge_map_inverse_representation = prove(`!(H:(A)hypermap) (x:A) (y:A). y = edge_map H x <=> x = inverse (edge_map H) y`, + REPEAT GEN_TAC + THEN MP_TAC (GSYM(SPECL[`x:A`; `y:A`] (MATCH_MP PERMUTES_INVERSE_EQ (CONJUNCT1(CONJUNCT2(SPEC `H:(A)hypermap` hypermap_lemma)))))) + THEN MESON_TAC[EQ_SYM]);; + +let node_map_inverse_representation = prove(`!(H:(A)hypermap) (x:A) (y:A). y = node_map H x <=> x = inverse (node_map H) y`, + REPEAT GEN_TAC + THEN MP_TAC (GSYM(SPECL[`x:A`; `y:A`] (MATCH_MP PERMUTES_INVERSE_EQ (CONJUNCT1(CONJUNCT2(CONJUNCT2(SPEC `H:(A)hypermap` hypermap_lemma))))))) + THEN MESON_TAC[EQ_SYM]);; + +let face_map_inverse_representation = prove(`!(H:(A)hypermap) (x:A) (y:A). y = face_map H x <=> x = inverse (face_map H) y`, + REPEAT GEN_TAC THEN MP_TAC (GSYM(SPECL[`x:A`; `y:A`] (MATCH_MP PERMUTES_INVERSE_EQ (CONJUNCT1(CONJUNCT2(CONJUNCT2(CONJUNCT2(SPEC `H:(A)hypermap` hypermap_lemma)))))))) + THEN MESON_TAC[EQ_SYM]);; + +let edge_map_injective = prove(`!(H:(A)hypermap) (x:A) (y:A). edge_map H x = edge_map H y <=> x = y`, + REPEAT GEN_TAC + THEN MP_TAC (GSYM(SPECL[`x:A`; `y:A`] (MATCH_MP PERMUTES_INJECTIVE (CONJUNCT1(CONJUNCT2(SPEC `H:(A)hypermap` hypermap_lemma)))))) + THEN MESON_TAC[EQ_SYM]);; + +let node_map_injective = prove(`!(H:(A)hypermap) (x:A) (y:A). node_map H x = node_map H y <=> x = y`, + REPEAT GEN_TAC + THEN MP_TAC (GSYM(SPECL[`x:A`; `y:A`] (MATCH_MP PERMUTES_INJECTIVE (CONJUNCT1(CONJUNCT2(CONJUNCT2(SPEC `H:(A)hypermap` hypermap_lemma))))))) + THEN MESON_TAC[EQ_SYM]);; + +let face_map_injective = prove(`!(H:(A)hypermap) (x:A) (y:A). face_map H x = face_map H y <=> x = y`, + REPEAT GEN_TAC THEN MP_TAC (GSYM(SPECL[`x:A`; `y:A`] (MATCH_MP PERMUTES_INJECTIVE (CONJUNCT1(CONJUNCT2(CONJUNCT2(CONJUNCT2(SPEC `H:(A)hypermap` hypermap_lemma)))))))) + THEN MESON_TAC[EQ_SYM]);; + +(* Some label_TAC *) + +let label_4Gs_TAC th = CONJUNCTS_THEN2 (LABEL_TAC "G1") (CONJUNCTS_THEN2(LABEL_TAC "G2") (CONJUNCTS_THEN2 (LABEL_TAC "G3") (LABEL_TAC "G4"))) th;; + +let label_hypermap_TAC th = CONJUNCTS_THEN2 (LABEL_TAC "H1") (CONJUNCTS_THEN2(LABEL_TAC "H2") (CONJUNCTS_THEN2 (LABEL_TAC "H3") (CONJUNCTS_THEN2 (LABEL_TAC "H4") (LABEL_TAC "H5")) )) (SPEC th hypermap_lemma);; + +let label_hypermap4_TAC th = CONJUNCTS_THEN2 (LABEL_TAC "H1") (CONJUNCTS_THEN2(LABEL_TAC "H2") (CONJUNCTS_THEN2 (LABEL_TAC "H3") (LABEL_TAC "H4" o CONJUNCT1))) (SPEC th hypermap_lemma);; + +let label_hypermapG_TAC th = CONJUNCTS_THEN2 (LABEL_TAC "G1") (CONJUNCTS_THEN2(LABEL_TAC "G2") (CONJUNCTS_THEN2 (LABEL_TAC "G3") (CONJUNCTS_THEN2 (LABEL_TAC "G4") (LABEL_TAC "G5")) )) (SPEC th hypermap_lemma);; + +let label_strip3A_TAC th = CONJUNCTS_THEN2 (LABEL_TAC "A1") (CONJUNCTS_THEN2(LABEL_TAC "A2")(LABEL_TAC "A3")) th;; + +(* Darts and its images under edge_map, node_map and face_map *) + + +let lemma_dart_invariant = prove(`!(H:(A)hypermap) x:A. x IN dart H ==> edge_map H x IN dart H /\ node_map H x IN dart H /\ face_map H x IN dart H`, + REPEAT GEN_TAC THEN label_hypermap4_TAC `H:(A)hypermap` THEN ASM_MESON_TAC[PERMUTES_IN_IMAGE]);; + +let lemma_dart_invariant_power_node = prove(`!(H:(A)hypermap) x:A n:num. x IN dart H ==> (node_map H POWER n) x IN dart H`, + REPEAT GEN_TAC + THEN REWRITE_TAC[MATCH_MP iterate_orbit (CONJUNCT2(SPEC `H:(A)hypermap` node_map_and_darts))]);; + +let lemma_dart_invariant_power_face = prove(`!(H:(A)hypermap) x:A n:num. x IN dart H ==> (face_map H POWER n) x IN dart H`, + REPEAT GEN_TAC + THEN REWRITE_TAC[MATCH_MP iterate_orbit (CONJUNCT2(SPEC `H:(A)hypermap` face_map_and_darts))]);; + +let lemma_dart_inveriant_under_inverse_maps = prove(`!(H:(A)hypermap) x:A. x IN dart H + ==> inverse(edge_map H) x IN dart H /\ inverse(node_map H) x IN dart H /\ inverse(face_map H) x IN dart H`, + REPEAT GEN_TAC THEN DISCH_THEN (LABEL_TAC "F1") + THEN MP_TAC (MATCH_MP PERMUTES_INVERSE (CONJUNCT2(SPEC `H:(A)hypermap` edge_map_and_darts))) + THEN USE_THEN "F1"(fun th-> DISCH_THEN (fun th1->REWRITE_TAC[REWRITE_RULE[th] (GSYM (SPEC `x:A` (MATCH_MP PERMUTES_IN_IMAGE th1)))])) + THEN MP_TAC (MATCH_MP PERMUTES_INVERSE (CONJUNCT2(SPEC `H:(A)hypermap` node_map_and_darts))) + THEN USE_THEN "F1"(fun th-> DISCH_THEN (fun th1->REWRITE_TAC[REWRITE_RULE[th] (GSYM (SPEC `x:A` (MATCH_MP PERMUTES_IN_IMAGE th1)))])) + THEN MP_TAC (MATCH_MP PERMUTES_INVERSE (CONJUNCT2(SPEC `H:(A)hypermap` face_map_and_darts))) + THEN USE_THEN "F1"(fun th-> DISCH_THEN (fun th1->REWRITE_TAC[REWRITE_RULE[th] (GSYM (SPEC `x:A` (MATCH_MP PERMUTES_IN_IMAGE th1)))])));; + +(* Some lemmas on the cardinality of finite series *) + +let IMAGE_SEG = prove(`!(n:num) (f:num->A). IMAGE f {i:num | i < n:num} = {f (i:num) | i < n}`, + REPEAT STRIP_TAC + THEN REWRITE_TAC[IMAGE; IN_ELIM_THM] THEN SET_TAC[]);; + +let FINITE_SERIES = prove(`!(n:num) (f:num->A). FINITE {f(i) | i < n}`, + REPEAT GEN_TAC + THEN ONCE_REWRITE_TAC[SYM(SPECL[`n:num`; `f:num->A`] IMAGE_SEG)] + THEN MATCH_MP_TAC FINITE_IMAGE + THEN REWRITE_TAC[FINITE_NUMSEG_LT]);; + +let CARD_FINITE_SERIES_LE = prove(`!(n:num) (f:num->A). CARD {f(i) | i < n} <= n`, + REPEAT GEN_TAC + THEN ONCE_REWRITE_TAC[SYM(SPECL[`n:num`; `f:num->A`] IMAGE_SEG)] + THEN MP_TAC(ISPEC `f:num ->A` (MATCH_MP CARD_IMAGE_LE (SPEC `n:num` FINITE_NUMSEG_LT))) + THEN REWRITE_TAC[CARD_NUMSEG_LT]);; + +let LEMMA_INJ = prove(`!(n:num) (f:num->A).(!i:num j:num. i < n /\ j < i ==> ~(f i = f j)) ==> (!i:num j:num. i < n /\ j < n /\ f i = f j ==> i = j)`, + REPEAT GEN_TAC + THEN DISCH_TAC THEN MATCH_MP_TAC WLOG_LT + THEN STRIP_TAC THENL[ARITH_TAC; ALL_TAC] + THEN STRIP_TAC THENL[MESON_TAC[]; ALL_TAC] + THEN ASM_MESON_TAC[]);; + +let LEMMA_INJ2 = prove(`!(n:num) (f:num->A).(!i:num j:num. i <= n /\ j < i ==> ~(f j = f i)) ==> (!i:num j:num. i <= n /\ j <= n /\ f i = f j ==> i = j)`, + REPEAT GEN_TAC + THEN DISCH_TAC THEN MATCH_MP_TAC WLOG_LT + THEN STRIP_TAC THENL[ARITH_TAC; ALL_TAC] + THEN STRIP_TAC THENL[MESON_TAC[]; ALL_TAC] + THEN ASM_MESON_TAC[]);; + +let CARD_FINITE_SERIES_EQ = prove(`!(n:num) (f:num->A). (!i:num j:num. i < n /\ j < i ==> ~(f i = f j)) ==> CARD {f(i) | i < n} = n`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1" o MATCH_MP LEMMA_INJ) + THEN ONCE_REWRITE_TAC[GSYM IMAGE_SEG] + THEN GEN_REWRITE_TAC(RAND_CONV o ONCE_DEPTH_CONV) [GSYM (SPEC `n:num` CARD_NUMSEG_LT)] + THEN MATCH_MP_TAC CARD_IMAGE_INJ + THEN REWRITE_TAC[FINITE_NUMSEG_LT] + THEN REWRITE_TAC[IN_ELIM_THM] + THEN ASM_REWRITE_TAC[]);; + +let LM_AUX = prove(`!m n. m < n ==> ?k. ~(k = 0) /\ n = m + k`, + REPEAT GEN_TAC THEN REWRITE_TAC[LT_EXISTS] + THEN DISCH_THEN(X_CHOOSE_THEN `d:num` ASSUME_TAC) + THEN EXISTS_TAC `SUC d` + THEN ASM_REWRITE_TAC[ARITH_RULE `~(SUC d = 0)`]);; + +let LM1 = prove(`!s:A->bool p:A->A n:num m:num. p permutes s /\ p POWER (m+n) = p POWER m ==> p POWER n = I`, + REPEAT GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN2 (LABEL_TAC "c1") (MP_TAC)) + THEN REWRITE_TAC[addition_exponents] THEN DISCH_TAC THEN + REMOVE_THEN "c1" (ASSUME_TAC o (SPEC `m:num`) o MATCH_MP power_permutation) + THEN MP_TAC (SPECL[`s:A->bool`; `(p:A->A) POWER (m:num)`;`(p:A->A) POWER (n:num)`; `(p:A->A) POWER (m:num)`] LEFT_INVERSE_EQUATION) + THEN ASM_REWRITE_TAC[] THEN POP_ASSUM(MP_TAC o CONJUNCT2 o (MATCH_MP PERMUTES_INVERSES_o)) + THEN SIMP_TAC[]);; + +let lemma_sub_two_numbers = prove(`!m:num n:num p:num. m - n - p = m - (n + p)`, ARITH_TAC);; + +let NON_ZERO = prove(`!n:num. ~(SUC n = 0)`, REWRITE_TAC[GSYM LT_NZ; LT_0]);; + +let LT1_NZ = prove(`!n:num. 1 <= n <=> 0 < n`, ARITH_TAC);; + +let GE_1 = prove(`!n:num. 1 <= SUC n`, REWRITE_TAC[LT1_NZ; LT_NZ; NON_ZERO]);; + +let LT_PLUS = prove(`!n:num. n < SUC n`, ARITH_TAC);; + +let LE_PLUS = prove(`!n:num. n <= SUC n`, ARITH_TAC);; + +let LT_SUC_PRE = prove(`!n:num. 0 < n ==> n = SUC(PRE n)`, ARITH_TAC);; + +let LE_SUC_PRE = prove(`!n:num. 1 <= n ==> SUC(PRE n) = n`, REWRITE_TAC[LT1_NZ] THEN MESON_TAC[LT_SUC_PRE]);; + +let LT_PRE = prove(`!n:num. 0 < n ==> n = (PRE n) + 1`, + GEN_TAC THEN DISCH_THEN (MP_TAC o MATCH_MP LT_SUC_PRE) THEN REWRITE_TAC[ADD1]);; + +let SUC_PRE_2 = prove(`!n:num. 2 <= n ==> SUC (SUC (PRE (PRE n))) = n`, ARITH_TAC);; + +let LE_MOD_SUC = prove(`!n m. m MOD (SUC n) <= n`, + REPEAT GEN_TAC + THEN MP_TAC(CONJUNCT2(SPEC `m:num`(MATCH_MP DIVISION (SPEC `n:num` NON_ZERO)))) + THEN REWRITE_TAC[LT_SUC_LE]);; + +let LT0_LE1 = prove(`!n:num. 0 < n <=> 1 <= n`, ARITH_TAC);; + +let ZR_LT_1 = prove(`0 < 1`, ARITH_TAC);; + +let LT_RIGHT_SUC = prove(`!i:num n:num. i < n ==> i < SUC n`, ARITH_TAC);; + +let LE_RIGHT_SUC = prove(`!i:num n:num. i <= n ==> i <= SUC n`, ARITH_TAC);; + +let LT_PRE_LE = prove(`!i:num n:num. i < n ==> i <= PRE n`, ARITH_TAC);; + +let MOD_REFL = prove(`!m n. ~(n = 0) ==> ((m MOD n) MOD n = m MOD n)`, (* in file ARITH.ML *) + REPEAT GEN_TAC THEN DISCH_TAC THEN + MP_TAC(SPECL [`m:num`; `n:num`; `1`] MOD_MOD) THEN + ASM_REWRITE_TAC[MULT_CLAUSES; MULT_EQ_0] THEN + REWRITE_TAC[ONE; NOT_SUC]);; +let compare_left = prove(`!m:num n p. m + n = p ==> m <= p`, ARITH_TAC);; + +let compare_right = prove(`!m:num n p. m + n = p ==> n <= p`, ARITH_TAC);; + +let le_compare_left = prove(`!m:num n p. m + n <= p ==> m <= p`, ARITH_TAC);; + +let le_compare_right = prove(`!m:num n p. m + n <= p ==> n <= p`, ARITH_TAC);; + +let THREE = num_CONV `3`;; + +let SEGMENT_TO_ONE = prove(`!n:num. n <= 1 <=> n = 0 \/ n = 1`, ARITH_TAC);; + +let SEGMENT_TO_TWO = prove(`!n:num. n <= 2 <=> n = 0 \/ n = 1 \/ n = 2`, ARITH_TAC);; + +let EXPAND_SET_TWO_ELEMENTS = prove(`!p:num->A. {p (i:num) | i <= 1} = {p 0, p 1}`, + GEN_TAC THEN REWRITE_TAC[SEGMENT_TO_ONE] THEN SET_TAC[]);; + +let EXPAND_SET_THREE_ELEMENTS = prove(`!p:num->A. {p (i:num) | i <= 2} = {p 0, p 1, p 2}`, + GEN_TAC THEN REWRITE_TAC[SEGMENT_TO_TWO] THEN SET_TAC[]);; + +let lemma_add_one_assumption_lt = prove(`!P. !(n:num). (!i:num. i < SUC n ==> P i) <=> (!i:num. i < n ==> P i) /\ P n`, + REPEAT GEN_TAC + THEN ASM_CASES_TAC `n:num = 0` + THENL[POP_ASSUM SUBST1_TAC THEN REWRITE_TAC[GSYM ONE; CONJUNCT1 LT; ARITH_RULE `!i. i < 1 <=> i = 0`] + THEN MESON_TAC[]; ALL_TAC] + THEN POP_ASSUM (MP_TAC o MATCH_MP LT_SUC_PRE o REWRITE_RULE[GSYM LT_NZ]) + THEN DISCH_THEN (fun th-> ONCE_REWRITE_TAC[th]) THEN REWRITE_TAC[LT_SUC_LE; lemma_add_one_assumption]);; + +(***********************************************************************) + +let is_inj_list = new_recursive_definition num_RECURSION `(is_inj_list (p:num->A) 0 <=> T) /\ + (is_inj_list (p:num->A) (SUC n) <=> ((is_inj_list p n) /\ (!i:num. i <= n ==> ~(p i = p (SUC n)))))`;; + +let lemma_sub_list = prove(`!p:num->A n:num. is_inj_list p n ==> (!i. i <= n ==> is_inj_list p i)`, + GEN_TAC THEN INDUCT_TAC THENL[SIMP_TAC[is_inj_list; LE]; ALL_TAC] + THEN STRIP_TAC THEN GEN_TAC THEN REWRITE_TAC[LE] + THEN STRIP_TAC + THENL[POP_ASSUM SUBST1_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN UNDISCH_THEN `is_inj_list (p:num->A) (SUC n)` (MP_TAC o REWRITE_RULE[is_inj_list]) + THEN ASM_MESON_TAC[]);; + +let lemma_inj_list = prove(`!p:num->A n:num. is_inj_list p n <=> (!i:num j:num. i <= n /\ j < i ==> ~(p j = p i))`, + GEN_TAC + THEN INDUCT_TAC THENL[REWRITE_TAC[is_inj_list] THEN ARITH_TAC; ALL_TAC] + THEN REWRITE_TAC[is_inj_list] + THEN POP_ASSUM (fun th-> REWRITE_TAC[th; LE]) + THEN EQ_TAC + THENL[DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN REPEAT GEN_TAC + THEN STRIP_TAC + THENL[POP_ASSUM MP_TAC THEN POP_ASSUM SUBST1_TAC + THEN ASM_REWRITE_TAC[LT_SUC_LE]; ALL_TAC] + THEN ASM_MESON_TAC[]; ALL_TAC] + THEN REWRITE_TAC[RIGHT_OR_DISTRIB] + THEN SIMP_TAC[] + THEN DISCH_TAC + THEN GEN_TAC + THEN POP_ASSUM (MP_TAC o SPECL[`SUC n`; `i:num`]) + THEN SIMP_TAC[EQ_REFL; ARITH_RULE `~(SUC n <= n)`; LT_SUC_LE]);; + +let lemma_inj_list2 = prove(`!p:num->A n:num. is_inj_list p n <=> (!i:num j:num. i <= n /\ j <= n /\ p i = p j ==> i = j)`, + REPEAT GEN_TAC THEN REWRITE_TAC[lemma_inj_list] + THEN EQ_TAC + THENL[DISCH_TAC THEN MATCH_MP_TAC WLOG_LT + THEN STRIP_TAC THENL[ARITH_TAC; ALL_TAC] + THEN STRIP_TAC THENL[MESON_TAC[]; ALL_TAC] + THEN ASM_MESON_TAC[]; ALL_TAC] + THEN DISCH_THEN (LABEL_TAC "F1") THEN REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3")) + THEN DISCH_TAC + THEN REMOVE_THEN "F1" (MP_TAC o SPECL[`j:num`; `i:num`]) + THEN ASM_REWRITE_TAC[] + THEN USE_THEN "F3"(fun th -> USE_THEN "F2" (fun th1 -> (ASSUME_TAC (MATCH_MP LTE_TRANS (CONJ th th1))))) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN REMOVE_THEN "F3" MP_TAC + THEN ARITH_TAC);; + +let support_list = new_definition `support_list (p:num->A) (n:num) = {p (i:num) | i <= n}`;; + +let lemma_finite_list = prove(`!(p:num->A) (n:num). FINITE (support_list p n)`, + REWRITE_TAC[support_list; GSYM LT_SUC_LE; FINITE_SERIES]);; + +let lemma_size_list = prove(`!(p:num->A) (n:num). is_inj_list p n ==> CARD (support_list p n) = SUC n`, + REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_inj_list; support_list] + THEN CONV_TAC ((LAND_CONV o ONCE_DEPTH_CONV) SYM_CONV) + THEN REWRITE_TAC[GSYM LT_SUC_LE] + THEN DISCH_THEN (fun th -> REWRITE_TAC[MATCH_MP CARD_FINITE_SERIES_EQ th]));; + +let in_list = new_definition `in_list (p:num->A) (n:num) (x:A) <=> x IN support_list p n`;; + +let lemma_in_list = prove(`!p:num->A n:num x:A. in_list p n x <=> ?j:num. j <= n /\ x = p j`, + REWRITE_TAC[in_list; support_list; IN_ELIM_THM]);; + +let lemma_in_list2 = prove(`!p:num->A n:num x:A j:num. j <= n /\ x = p j ==> in_list p n x`, MESON_TAC[lemma_in_list]);; + +let lemma_element_in_list = prove(`!p:num->A n:num i:num. i <= n ==> in_list p n (p i)`, + REWRITE_TAC[lemma_in_list] THEN MESON_TAC[]);; + +let lemma_not_in_list = prove(`!p:num->A n:num x:A. ~(in_list p n x) <=> !j:num. j <= n ==> ~(x = p j)`, + REPEAT GEN_TAC THEN REWRITE_TAC[lemma_in_list] THEN MESON_TAC[]);; + +let is_disjoint = new_definition `!p:num->A q:num->A n:num m:num. is_disjoint p q n m <=> DISJOINT (support_list p n) (support_list q m)`;; + +let lemma_set_disjoint = prove(`!s:A->bool t:A->bool. ~(DISJOINT s t) <=> ?x:A. x IN s /\ x IN t`, SET_TAC[IN_DISJOINT]);; + +let lemma_list_disjoint1 = prove(`!p:num->A q:num->A n:num m:num. is_disjoint p q n m <=> !i:num. i <= n ==> ~(in_list q m (p i))`, + REPEAT GEN_TAC + THEN EQ_TAC + THENL[DISCH_THEN (LABEL_TAC "F1") + THEN REPEAT STRIP_TAC + THEN REMOVE_THEN "F1" MP_TAC THEN REWRITE_TAC[] + THEN REWRITE_TAC[is_disjoint; lemma_set_disjoint] + THEN REWRITE_TAC[GSYM in_list] + THEN EXISTS_TAC `(p:num->A) i` + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[lemma_element_in_list]; ALL_TAC] + THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] + THEN REWRITE_TAC[NOT_FORALL_THM; NOT_IMP] + THEN REWRITE_TAC[is_disjoint; GSYM in_list; lemma_set_disjoint] + THEN DISCH_THEN (X_CHOOSE_THEN `x:A` (CONJUNCTS_THEN2 (MP_TAC o REWRITE_RULE[lemma_in_list]) (ASSUME_TAC))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (CONJUNCTS_THEN2 MP_TAC (SUBST_ALL_TAC))) + THEN ASM_MESON_TAC[]);; + +let lemma_list_disjoint2 = prove(`!p:num->A q:num->A n:num m:num. is_disjoint p q n m <=> !i:num. i <= m ==> ~(in_list p n (q i))`, + REPEAT GEN_TAC + THEN EQ_TAC + THENL[DISCH_THEN (LABEL_TAC "F1") + THEN REPEAT STRIP_TAC + THEN REMOVE_THEN "F1" MP_TAC THEN REWRITE_TAC[] + THEN REWRITE_TAC[is_disjoint; lemma_set_disjoint] + THEN REWRITE_TAC[GSYM in_list] + THEN EXISTS_TAC `(q:num->A) i` + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[lemma_element_in_list]; ALL_TAC] + THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] + THEN REWRITE_TAC[NOT_FORALL_THM; NOT_IMP] + THEN REWRITE_TAC[is_disjoint; GSYM in_list; lemma_set_disjoint] + THEN DISCH_THEN (X_CHOOSE_THEN `x:A` (CONJUNCTS_THEN2 ASSUME_TAC (MP_TAC o REWRITE_RULE[lemma_in_list]))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (CONJUNCTS_THEN2 MP_TAC (SUBST_ALL_TAC))) + THEN ASM_MESON_TAC[]);; + +let lemma_list_disjoint = prove(`!p:num->A q:num->A n:num m:num. is_disjoint p q n m + <=> !i:num j:num. i <= n /\ j <= m ==> ~(p i = q j)`, + REPEAT GEN_TAC THEN REWRITE_TAC[lemma_list_disjoint1; lemma_not_in_list] THEN MESON_TAC[]);; + + +let glue = new_definition `!p:num->A q:num->A n:num. glue p q n = (\i:num. if i <= n then p i else q (i-n))`;; + +let start_glue_evaluation = prove(`!p:num->A q:num->A n:num. glue p q n 0 = p 0`, + REPEAT GEN_TAC THEN REWRITE_TAC[glue; LE_0]);; + +let first_glue_evaluation = prove(`!p:num->A q:num->A n:num i:num. i <= n ==> glue p q n i = p i`, + REPEAT GEN_TAC THEN REWRITE_TAC[glue] THEN SIMP_TAC[COND_ELIM_THM]);; + +let second_glue_evaluation = prove(`!p:num->A q:num->A n:num i:num. p n = q 0 ==> glue p q n (n + i) = q i`, + REPEAT STRIP_TAC THEN REWRITE_TAC[glue] + THEN ASM_CASES_TAC `i:num = 0` + THENL[POP_ASSUM SUBST1_TAC THEN ASM_REWRITE_TAC[ADD_0; LE_REFL; COND_ELIM_THM]; ALL_TAC] + THEN POP_ASSUM ((X_CHOOSE_THEN `j:num` SUBST1_TAC) o REWRITE_RULE[GSYM LT_NZ; LT_EXISTS; CONJUNCT1 ADD]) + THEN SIMP_TAC[COND_ELIM_THM; ARITH_RULE `~((n:num) + (SUC j) <= n)`] + THEN AP_TERM_TAC THEN REWRITE_TAC[ADD_SUB2]);; + +let is_glueing = new_definition `!p:num->A q:num->A n:num m:num. is_glueing p q n m + <=> (p n = q 0) /\ (!j:num. 1 <= j /\ j <= m ==> ~(in_list p n (q j)))`;; + +let lemma_glueing_condition = prove(`!p:num->A q:num->A n:num m:num. is_inj_list p n /\ is_inj_list q m ==> (is_glueing p q n m + <=> (p n = q 0) /\ (!i:num. i < n ==> ~(in_list q m (p i))))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "FC") (LABEL_TAC "GC")) + THEN REWRITE_TAC[is_glueing; lemma_not_in_list] + THEN EQ_TAC + THENL[DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[th]) + THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F3") + THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F5") + THEN ASM_CASES_TAC `j:num = 0` + THENL[POP_ASSUM SUBST1_TAC + THEN USE_THEN "F1" (SUBST1_TAC o SYM) + THEN USE_THEN "FC" (MP_TAC o SPECL[`n:num`; `i:num`] o REWRITE_RULE[lemma_inj_list]) + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[th; LE_REFL]); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[GSYM LT_NZ; GSYM LT1_NZ]) + THEN DISCH_THEN (fun th-> POP_ASSUM (fun th1-> USE_THEN "F2" (fun th2 -> MP_TAC (GSYM (SPEC `i:num` (MATCH_MP th2 (CONJ th th1))))))) + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP LT_IMP_LE th]); ALL_TAC] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[th]) + THEN GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")) + THEN GEN_TAC THEN DISCH_THEN (LABEL_TAC "F5") + THEN ASM_CASES_TAC `j':num = n:num` + THENL[POP_ASSUM SUBST1_TAC + THEN USE_THEN "F1" SUBST1_TAC + THEN USE_THEN "GC" (MP_TAC o GSYM o SPECL[`j:num`; `0`] o REWRITE_RULE[lemma_inj_list]) + THEN USE_THEN "F4" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[REWRITE_RULE[LT1_NZ] th]); ALL_TAC] + THEN POP_ASSUM (fun th-> (POP_ASSUM(fun th1-> ASSUME_TAC (REWRITE_RULE[GSYM LT_LE] (CONJ th1 th))))) + THEN USE_THEN "F2" (fun th-> POP_ASSUM (MP_TAC o GSYM o SPEC `j:num`o MATCH_MP th)) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]));; + +let lemma_glue_inj_lists = prove(`!p:num->A q:num->A n:num m:num. is_inj_list p n /\ is_inj_list q m /\ is_glueing p q n m + ==> is_inj_list (glue p q n) (n + m)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_inj_list; is_glueing] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")))) + THEN REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6")) + THEN ASM_CASES_TAC `i:num <= n` + THENL[POP_ASSUM (LABEL_TAC "F7") + THEN USE_THEN "F6"(fun th-> USE_THEN "F7" (fun th1 -> (MP_TAC (MATCH_MP LTE_TRANS (CONJ th th1))))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP first_glue_evaluation (MATCH_MP LT_IMP_LE th)]) + THEN USE_THEN "F7" (fun th-> REWRITE_TAC[MATCH_MP first_glue_evaluation th]) + THEN USE_THEN "F1" (MATCH_MP_TAC) + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th-> REWRITE_TAC[th])); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[NOT_LE; LT_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` (SUBST_ALL_TAC)) + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[MATCH_MP second_glue_evaluation th]) + THEN REMOVE_THEN "F5" (LABEL_TAC "F5" o REWRITE_RULE[GSYM ADD1; LE_ADD_LCANCEL; LE_SUC]) + THEN ASM_CASES_TAC `j:num <= n` + THENL[POP_ASSUM (LABEL_TAC "F6") + THEN USE_THEN "F6" (fun th-> REWRITE_TAC[MATCH_MP first_glue_evaluation th]) + THEN USE_THEN "F4" (MP_TAC o SPEC `SUC d`) + THEN USE_THEN "F5" (fun th-> REWRITE_TAC[th; GE_1]) + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN USE_THEN "F6" (fun th-> REWRITE_TAC[MATCH_MP lemma_element_in_list th]); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[NOT_LE; LT_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `e:num` (SUBST_ALL_TAC)) + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[MATCH_MP second_glue_evaluation th]) + THEN USE_THEN "F6"(MP_TAC o REWRITE_RULE[LT_ADD_LCANCEL]) + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[IMP_IMP] + THEN USE_THEN "F2" (fun th-> REWRITE_TAC[th]));; + + +let join = new_definition `!p:num->A q:num->A n:num. join p q n = (\i:num. if i <= n then p i else q (PRE (i-n)))`;; + +let first_join_evaluation = prove(`!p:num->A q:num->A n:num i:num. i <= n ==> join p q n i = p i`, + REPEAT GEN_TAC THEN REWRITE_TAC[join] THEN SIMP_TAC[COND_ELIM_THM]);; + +let second_join_evaluation = prove(`!p:num->A q:num->A n:num i:num. join p q n (n + (SUC i)) = q i`, + REPEAT GEN_TAC THEN REWRITE_TAC[join] + THEN SIMP_TAC[COND_ELIM_THM; ARITH_RULE `~((n:num) + (SUC i) <= n)`] + THEN AP_TERM_TAC THEN REWRITE_TAC[ADD_SUB2; PRE]);; + +let lemma_join_inj_lists = prove(`!p:num->A q:num->A n:num m:num. is_inj_list p n /\ is_inj_list q m /\ is_disjoint p q n m + ==> is_inj_list (join p q n) (n + m + 1)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_inj_list] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5")) + THEN ASM_CASES_TAC `i:num <= n` + THENL[POP_ASSUM (LABEL_TAC "F6") + THEN USE_THEN "F5"(fun th-> USE_THEN "F6" (fun th1 -> (MP_TAC (MATCH_MP LTE_TRANS (CONJ th th1))))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP first_join_evaluation (MATCH_MP LT_IMP_LE th)]) + THEN USE_THEN "F6" (fun th-> REWRITE_TAC[MATCH_MP first_join_evaluation th]) + THEN REMOVE_THEN "F1" (MATCH_MP_TAC) + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th-> REWRITE_TAC[th])); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[NOT_LE; LT_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` (SUBST_ALL_TAC)) + THEN REWRITE_TAC[second_join_evaluation] + THEN REMOVE_THEN "F4" (LABEL_TAC "F4" o REWRITE_RULE[GSYM ADD1; LE_ADD_LCANCEL; LE_SUC]) + THEN ASM_CASES_TAC `j:num <= n` + THENL[POP_ASSUM (LABEL_TAC "F5") + THEN USE_THEN "F5" (fun th-> REWRITE_TAC[MATCH_MP first_join_evaluation th]) + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[IMP_IMP] THEN ONCE_REWRITE_TAC[CONJ_SYM] + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[REWRITE_RULE[th] (SPECL[`p:num->A`; `q:num->A`; `n:num`; `m:num`] lemma_list_disjoint)]); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[NOT_LE; LT_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `e:num` (SUBST_ALL_TAC)) + THEN REWRITE_TAC[second_join_evaluation] + THEN REMOVE_THEN "F5"(MP_TAC o REWRITE_RULE[LT_ADD_LCANCEL; LT_SUC]) + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[IMP_IMP] + THEN USE_THEN "F2" (fun th-> REWRITE_TAC[th]));; + + +(******************************************************************************) + +let inj_iterate_segment = prove(`!s:A->bool p:A->A (n:num). p permutes s /\ + ~(n = 0) ==> (!m:num. ~(m = 0) /\ (m < n) ==> ~(p POWER m = I)) + ==> (!i:num j:num. (i < n) /\ (j < i) ==> ~(p POWER i = p POWER j))`, + REPEAT GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN2 (LABEL_TAC "c2") (ASSUME_TAC)) + THEN DISCH_THEN (LABEL_TAC "c3") THEN REPLICATE_TAC 3 STRIP_TAC + THEN DISCH_THEN (LABEL_TAC "c4") THEN FIRST_X_ASSUM(MP_TAC o MATCH_MP LM_AUX) + THEN REPEAT STRIP_TAC THEN REMOVE_THEN "c3" MP_TAC THEN + REWRITE_TAC[NOT_FORALL_THM; NOT_IMP] + THEN EXISTS_TAC `k:num` THEN MP_TAC (ARITH_RULE `(i:num < n:num) /\ (i = (j:num) + (k:num)) ==> k < n`) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] + THEN REMOVE_THEN "c4" MP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN MP_TAC (ISPECL[`s:A->bool`; `p:A->A`; `k:num`; `j:num`] LM1) + THEN ASM_REWRITE_TAC[]);; + +let inj_iterate_lemma = prove(`!s:A->bool p:A->A. p permutes s /\ + (!(n:num). ~(n = 0) ==> ~(p POWER n = I)) ==> (!m. CARD({p POWER k | k < m}) = m)`, + REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "c1") (LABEL_TAC "c2")) + THEN GEN_TAC + THEN SUBGOAL_THEN `!i:num j:num. i < (m:num) /\ j < i ==> ~((p:A->A) POWER i = p POWER j)` ASSUME_TAC + THENL[REPEAT GEN_TAC THEN STRIP_TAC THEN POP_ASSUM (MP_TAC o MATCH_MP LM_AUX) + THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN MP_TAC (ISPECL[`s:A->bool`; `p:A->A`; `k:num`; `j:num`] LM1) + THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC THEN REMOVE_THEN "c2" (MP_TAC o SPEC(`k:num`)) + THEN REWRITE_TAC[NOT_IMP] + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM(MP_TAC o MATCH_MP CARD_FINITE_SERIES_EQ) + THEN SIMP_TAC[]);; + +(* finite order theorem on every element in arbitrary finite group *) + +let finite_order = prove(`!s:A->bool p:A->A. FINITE s /\ p permutes s ==> ?(n:num). ~(n = 0) /\ p POWER n = I`, + REPEAT GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN ASM_CASES_TAC `?(n:num). ~(n = 0) /\ (p:A->A) POWER n = I` + THENL[POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[NOT_EXISTS_THM; DE_MORGAN_THM; TAUT `!a b. ~(a /\ b) = (a ==> ~b)`]) + THEN DISCH_TAC THEN MP_TAC (ISPECL[`s:A->bool`; `p:A->A`] inj_iterate_lemma) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ABBREV_TAC `md = SUC(CARD({p | p permutes (s:A->bool)}))` + THEN MP_TAC (ISPECL[`{(p:A->A) POWER (k:num) | k < (md:num)}` ;`{p | p permutes (s:A->bool)}`] CARD_SUBSET) + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP FINITE_PERMUTATIONS th]) + THEN SUBGOAL_THEN `{(p:A->A) POWER (k:num) | k < (md:num)} SUBSET {p | p permutes (s:A->bool)}` (fun th-> REWRITE_TAC[th]) + THENL[REWRITE_TAC[SUBSET; IN_ELIM_THM] + THEN GEN_TAC THEN DISCH_THEN (X_CHOOSE_THEN `k:num` (CONJUNCTS_THEN2 ASSUME_TAC SUBST1_TAC)) + THEN USE_THEN "F2" (fun th-> REWRITE_TAC[MATCH_MP power_permutation th]); ALL_TAC] + THEN FIRST_X_ASSUM (SUBST1_TAC o SPEC `md:num` o check (is_forall o concl)) + THEN POP_ASSUM (SUBST1_TAC o SYM) THEN ARITH_TAC);; + +let lemma_order_permutation_exists = prove(`!s:A->bool p:A->A. FINITE s /\ p permutes s + ==> ?n:num. ~(n = 0) /\ (p POWER n = I) /\ (!m:num. ~(m = 0) /\ (m < n) ==> ~(p POWER m = I))`, + REPEAT GEN_TAC THEN DISCH_THEN (MP_TAC o MATCH_MP finite_order) + THEN GEN_REWRITE_TAC (LAND_CONV) [num_WOP] + THEN GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [TAUT `(A ==> ~(~B /\ C)) <=> (~B /\ A ==> ~C)`] + THEN MESON_TAC[]);; + +let lemma_order_permutation = new_specification["order_permutation"] (REWRITE_RULE[GSYM RIGHT_EXISTS_IMP_THM; SKOLEM_THM] lemma_order_permutation_exists);; + +let inverse_element_lemma = prove(`!s:A->bool p:A->A. FINITE s /\ p permutes s ==> ?j:num. inverse p = p POWER j`, + REPEAT GEN_TAC + THEN DISCH_THEN(fun th -> MP_TAC (MATCH_MP finite_order th) THEN ASSUME_TAC(CONJUNCT2 th)) + THEN REWRITE_TAC[GSYM LT_NZ] + THEN DISCH_THEN (X_CHOOSE_THEN `n:num` (CONJUNCTS_THEN2 (MP_TAC) (ASSUME_TAC))) + THEN DISCH_THEN (SUBST_ALL_TAC o MATCH_MP LT_SUC_PRE) + THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[POWER] + THEN POP_ASSUM (fun th -> (DISCH_THEN (fun th1 -> MP_TAC (MATCH_MP RIGHT_INVERSE_EQUATION (CONJ th th1))))) + THEN REWRITE_TAC[I_O_ID] + THEN DISCH_THEN (ASSUME_TAC o SYM) + THEN EXISTS_TAC `PRE n` THEN ASM_REWRITE_TAC[]);; + +let inverse_element_via_order = prove(`!s:A->bool p:A->A. FINITE s /\ p permutes s ==> inverse p = p POWER (PRE (order_permutation s p))`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN USE_THEN "F1" (MP_TAC o MATCH_MP lemma_order_permutation) + THEN DISCH_THEN (CONJUNCTS_THEN2 (MP_TAC o REWRITE_RULE[GSYM LT_NZ; LT_EXISTS; CONJUNCT1 ADD]) (LABEL_TAC "F2" o CONJUNCT1)) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` SUBST_ALL_TAC) + THEN REWRITE_TAC[PRE] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[COM_POWER]) + THEN USE_THEN "F1" (fun th-> DISCH_THEN (fun th1 -> MP_TAC (MATCH_MP LEFT_INVERSE_EQUATION (CONJ (CONJUNCT2 th) th1)))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[REWRITE_RULE[I_O_ID] (SYM th)]));; + +let lemma_permutation_via_its_inverse = prove(`!s:A->bool p:A->A. FINITE s /\ p permutes s ==> ?j:num. p = (inverse p) POWER j`, + REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN USE_THEN "F2" (ASSUME_TAC o MATCH_MP PERMUTES_INVERSE) + THEN POP_ASSUM (fun th -> (REMOVE_THEN "F1" (fun th2 -> (MP_TAC (MATCH_MP inverse_element_lemma (CONJ th2 th)))))) + THEN POP_ASSUM (SUBST1_TAC o MATCH_MP PERMUTES_INVERSE_INVERSE) THEN SIMP_TAC[]);; + +let power_inverse_element_lemma = prove(`!s:A->bool p:A->A n:num. FINITE s /\ p permutes s ==> ?j:num. (inverse p) POWER n = p POWER j`, + REPLICATE_TAC 2 GEN_TAC + THEN INDUCT_TAC + THENL[STRIP_TAC + THEN EXISTS_TAC `0` + THEN REWRITE_TAC[POWER_0]; ALL_TAC] + THEN DISCH_TAC + THEN FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) + THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC + THEN FIRST_X_ASSUM (MP_TAC o MATCH_MP inverse_element_lemma) + THEN DISCH_THEN (X_CHOOSE_THEN `i:num` ASSUME_TAC) + THEN EXISTS_TAC `(j:num) + (i:num)` + THEN REWRITE_TAC[POWER] + THEN POP_ASSUM (fun th -> GEN_REWRITE_TAC (LAND_CONV o RAND_CONV) [th]) + THEN ASM_REWRITE_TAC[addition_exponents]);; + +let inverse_relation = prove(`!(s:A->bool) p:A->A x:A y:A. FINITE s /\ p permutes s /\ y = p x ==>(?k:num. x = (p POWER k) y)`, + REPEAT STRIP_TAC THEN MP_TAC(SPECL[`s:A->bool`; `p:A->A`] inverse_element_lemma) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN EXISTS_TAC `j:num` + THEN POP_ASSUM(fun th -> REWRITE_TAC[SYM th]) + THEN REWRITE_TAC[GSYM(ISPECL[`(inverse (p:A->A)):(A->A)`; `p:A->A`; `(x:A)`] o_THM)] + THEN UNDISCH_THEN `p:A->A permutes s`(fun th-> REWRITE_TAC[CONJUNCT2 (MATCH_MP PERMUTES_INVERSES_o th);I_THM]));; + +let power_power_relation = prove(`!(s:A->bool) p:A->A x:A y:A n:num. FINITE s /\ p permutes s /\ (p POWER n) x = y ==> ?j:num. x = (p POWER j) y`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC (CONJUNCTS_THEN2 (LABEL_TAC "F1") MP_TAC)) + THEN USE_THEN "F1" (fun th-> DISCH_THEN (MP_TAC o REWRITE_RULE[MATCH_MP inverse_power_function th] o SYM)) + THEN POP_ASSUM (fun th1 -> POP_ASSUM (fun th-> MP_TAC (SPEC `n:num` (MATCH_MP power_inverse_element_lemma (CONJ th th1))))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` SUBST1_TAC) + THEN DISCH_TAC THEN EXISTS_TAC `j:num` THEN ASM_REWRITE_TAC[]);; + +let elim_power_function = prove( + `!s:A->bool p:A->A x:A n:num m:num. p permutes s /\ (p POWER (m+n)) x = (p POWER m) x + ==> (p POWER n) x = x`, + REPEAT GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN2 (LABEL_TAC "c1") (MP_TAC)) + THEN REWRITE_TAC[addition_exponents; o_THM] THEN DISCH_TAC + THEN REMOVE_THEN "c1" (ASSUME_TAC o (SPEC `m:num`) o MATCH_MP power_permutation) + THEN POP_ASSUM (MP_TAC o ISPECL[`((p:A->A) POWER (n:num)) (x:A)`; `x:A` ] o MATCH_MP PERMUTES_INJECTIVE) + THEN ASM_REWRITE_TAC[]);; + +(* some properties of orbits *) + +let orbit_reflect = prove(`!f:A->A x:A. x IN (orbit_map f x)`, + REPEAT GEN_TAC THEN REWRITE_TAC[orbit_map; IN_ELIM_THM] + THEN EXISTS_TAC `0` THEN REWRITE_TAC[POWER; ARITH_RULE `0>=0`;I_THM]);; + +let orbit_sym = prove(`!s:A->bool p:A->A x:A y:A. FINITE s /\ p permutes s + ==> (x IN (orbit_map p y) ==> y IN (orbit_map p x))`, + REPLICATE_TAC 5 STRIP_TAC THEN REWRITE_TAC[orbit_map; IN_ELIM_THM] + THEN STRIP_TAC + THEN FIND_ASSUM (ASSUME_TAC o (SPEC `n:num`) o MATCH_MP power_permutation) `p:A->A permutes (s:A->bool)` + THEN POP_ASSUM (MP_TAC o (SPECL[`y:A`; `x:A`]) o MATCH_MP PERMUTES_INVERSE_EQ) + THEN POP_ASSUM(ASSUME_TAC o SYM) THEN ASM_REWRITE_TAC[] + THEN UNDISCH_THEN `p:A->A permutes s` (ASSUME_TAC o (SPEC `n:num`) o MATCH_MP power_permutation) + THEN MP_TAC(SPECL[`s:A->bool`; `(p:A->A) POWER (n:num)`] inverse_element_lemma) + THEN ASM_REWRITE_TAC[GSYM multiplication_exponents] + THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN EXISTS_TAC `(j:num) * (n:num)` + THEN ASM_REWRITE_TAC[ARITH_RULE `(j:num) * (n:num) >= 0`]);; + +let orbit_trans = prove(`!f:A->A x:A y:A z:A. x IN orbit_map f y /\ y IN orbit_map f z + ==> x IN orbit_map f z`, + REPEAT GEN_TAC THEN REWRITE_TAC[orbit_map; IN_ELIM_THM] + THEN REPEAT STRIP_TAC THEN + UNDISCH_THEN `x:A = ((f:A->A) POWER (n:num)) (y:A)` MP_TAC + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (ASSUME_TAC o SYM) THEN MP_TAC (SPECL[`n:num`; `n':num`; `f:A->A`] addition_exponents) + THEN DISCH_THEN(fun th -> MP_TAC (AP_THM th `z:A`)) + THEN ASM_REWRITE_TAC[o_DEF] THEN DISCH_THEN (ASSUME_TAC o SYM) + THEN EXISTS_TAC `(n:num) + n'` + THEN ASM_REWRITE_TAC[ARITH_RULE `(n:num) + (n':num) >= 0`]);; + +let partition_orbit = prove(`!s:A->bool p:A->A. FINITE s /\ p permutes s + ==>(!x:A y:A. (orbit_map p x INTER orbit_map p y = {}) \/ (orbit_map p x = orbit_map p y))`, + REPEAT STRIP_TAC THEN ASM_CASES_TAC `orbit_map (p:A->A)(x:A) INTER orbit_map (p:A->A) (y:A) = {}` + THENL[ASM_REWRITE_TAC[]; ALL_TAC] + THEN DISJ2_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] + THEN REWRITE_TAC[INTER; IN_ELIM_THM] THEN STRIP_TAC + THEN MP_TAC (SPECL[`s:A->bool`; `p:A->A`; `x':A`; `x:A`] orbit_sym) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN MP_TAC (SPECL[`s:A->bool`; `p:A->A`; `x':A`; `y:A`] orbit_sym) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN REWRITE_TAC[EXTENSION] THEN GEN_TAC + THEN EQ_TAC + THENL[STRIP_TAC THEN MP_TAC (SPECL[`p:A->A`; `x'':A`; `x:A`;`x':A`] orbit_trans) + THEN ASM_MESON_TAC[orbit_trans]; + STRIP_TAC THEN MP_TAC (SPECL[`p:A->A`; `x'':A`; `y:A`;`x':A`] orbit_trans) + THEN ASM_MESON_TAC[orbit_trans]]);; + +let card_orbit_le = prove(`!f:A->A n:num x:A. ~(n = 0) /\ (f POWER n) x = x ==> CARD(orbit_map f x) <= n`, + REPEAT GEN_TAC + THEN DISCH_THEN (fun th -> SUBST1_TAC (MATCH_MP orbit_cyclic th) + THEN ASSUME_TAC (CONJUNCT1 th)) + THEN MP_TAC (SPECL[`n:num`; `(\k. ((f:A->A) POWER k) (x:A))`] CARD_FINITE_SERIES_LE) + THEN MESON_TAC[]);; + + +(* some properties of hypermap *) + +let cyclic_maps = prove(`!D:A->bool e:A->A n:A->A f:A->A. + (FINITE D) /\ e permutes D /\ n permutes D /\ f permutes D /\ e o n o f = I + ==> (n o f o e = I) /\ (f o e o n = I)`, + REPEAT STRIP_TAC + THENL[MP_TAC (ISPECL[`D:A->bool`;`e:A->A`; `(n:A->A) o (f:A->A)`; `I:A->A`] + LEFT_INVERSE_EQUATION) THEN ASM_REWRITE_TAC[I_O_ID] + THEN FIND_ASSUM (ASSUME_TAC o CONJUNCT2 o MATCH_MP PERMUTES_INVERSES_o) `e:A->A permutes D:A->bool` + THEN DISCH_TAC + THEN MP_TAC (ISPECL[`(n:A->A)o(f:A->A)`;`inverse(e:A->A)`;`e:A->A` ] RIGHT_MULT_MAP) + THEN ASM_REWRITE_TAC[o_ASSOC]; + MP_TAC (ISPECL[`D:A->bool`;`(e:A->A)o(n:A->A)`;`(f:A->A)`; `I:A->A`] RIGHT_INVERSE_EQUATION) + THEN ASM_REWRITE_TAC[I_O_ID; GSYM o_ASSOC] + THEN DISCH_TAC THEN MP_TAC (ISPECL[`D:A->bool`;`(e:A->A) o (n:A->A)`; `(f:A->A)`; `I:A->A`] RIGHT_INVERSE_EQUATION) + THEN ASM_REWRITE_TAC[GSYM o_ASSOC; I_O_ID] + THEN FIND_ASSUM (ASSUME_TAC o CONJUNCT1 o MATCH_MP PERMUTES_INVERSES_o) `f:A->A permutes D:A->bool` + THEN ASM_SIMP_TAC[]]);; + +let cyclic_inverses_maps = prove(`!D:A->bool e:A->A n:A->A f:A->A. + (FINITE D) /\ e permutes D /\ n permutes D /\ f permutes D /\ e o n o f = I + ==> inverse n o inverse e o inverse f = I`, + + REPEAT STRIP_TAC THEN MP_TAC (ISPECL[`D:A->bool`; `e:A->A`; `n:A->A`; `f:A->A`] cyclic_maps) + THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC + THEN MP_TAC (ISPECL[`D:A->bool`;`f:A->A`; `(e:A->A) o (n:A->A)`; `I:A->A`] LEFT_INVERSE_EQUATION) + THEN ASM_REWRITE_TAC[I_O_ID] THEN STRIP_TAC + THEN MP_TAC (ISPECL[`D:A->bool`;`e:A->A`; `(n:A->A)`; `inverse(f:A->A)`] LEFT_INVERSE_EQUATION) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC (ISPECL[`inverse(n:A->A)`; `n:A->A`; `inverse(e:A->A) o inverse(f:A->A)`] LEFT_MULT_MAP) + THEN FIND_ASSUM (ASSUME_TAC o CONJUNCT2 o MATCH_MP PERMUTES_INVERSES_o) `n:A->A permutes D:A->bool` + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(MP_TAC o SYM) THEN REWRITE_TAC[]);; + +let edge_refl = prove(`!H:(A)hypermap x:A. x IN edge H x`, REWRITE_TAC[edge; orbit_reflect]);; + +let node_refl = prove(`!H:(A)hypermap x:A. x IN node H x`, REWRITE_TAC[node; orbit_reflect]);; + +let face_refl = prove(`!H:(A)hypermap x:A. x IN face H x`, REWRITE_TAC[face; orbit_reflect]);; + + +(* Hypermap cycle *) + +let hypermap_cyclic = prove(`!(H:(A)hypermap). (node_map H) o (face_map H) o (edge_map H) = I /\ (face_map H) o (edge_map H) o (node_map H) = I`, + GEN_TAC THEN label_hypermap_TAC `H:(A)hypermap` + THEN MP_TAC(SPECL[`dart (H:(A)hypermap)`; `edge_map (H:(A)hypermap)`; `node_map (H:(A)hypermap)`;`face_map (H:(A)hypermap)`] cyclic_maps) + THEN ASM_REWRITE_TAC[]);; + + +(* INVERSES HYPERMAP MAPS *) + +let label_cyclic_maps_TAC th = CONJUNCTS_THEN2 (LABEL_TAC "H6") (LABEL_TAC "H7") (SPEC th hypermap_cyclic);; + +let inverse_hypermap_maps = prove(`!(H:(A)hypermap). inverse(edge_map H) = (node_map H) o (face_map H) /\ inverse(node_map H) = (face_map H) o (edge_map H) /\ inverse(face_map H) = (edge_map H) o (node_map H)`, + GEN_TAC + THEN STRIP_TAC + THENL[MP_TAC (CONJUNCT2(CONJUNCT2(CONJUNCT2(CONJUNCT2(SPEC `H:(A)hypermap` hypermap_lemma))))) + THEN DISCH_THEN (fun th-> MP_TAC(SYM(MATCH_MP LEFT_INVERSE_EQUATION (CONJ (CONJUNCT2 (SPEC `H:(A)hypermap` edge_map_and_darts)) th)))) + THEN REWRITE_TAC[I_O_ID]; ALL_TAC] + THEN STRIP_TAC + THENL[MP_TAC (CONJUNCT1(SPEC `H:(A)hypermap` hypermap_cyclic)) + THEN DISCH_THEN (fun th-> MP_TAC(SYM(MATCH_MP LEFT_INVERSE_EQUATION (CONJ (CONJUNCT2 (SPEC `H:(A)hypermap` node_map_and_darts)) th)))) + THEN REWRITE_TAC[I_O_ID]; ALL_TAC] + THEN MP_TAC (CONJUNCT2(SPEC `H:(A)hypermap` hypermap_cyclic)) + THEN DISCH_THEN (fun th-> MP_TAC(SYM(MATCH_MP LEFT_INVERSE_EQUATION (CONJ (CONJUNCT2 (SPEC `H:(A)hypermap` face_map_and_darts)) th)))) + THEN REWRITE_TAC[I_O_ID]);; + +let inverse2_hypermap_maps = prove(`!(H:(A)hypermap). edge_map H = inverse (face_map H) o inverse (node_map H) /\ node_map H = inverse (edge_map H) o inverse (face_map H) /\ face_map H = inverse (node_map H) o inverse(edge_map H)`, + GEN_TAC + THEN STRIP_TAC + THENL[MP_TAC (SYM(CONJUNCT1(CONJUNCT2(SPEC `H:(A)hypermap` inverse_hypermap_maps)))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP LEFT_INVERSE_EQUATION (CONJ (CONJUNCT2 (SPEC `H:(A)hypermap` face_map_and_darts)) th)]); ALL_TAC] + THEN STRIP_TAC + THENL[MP_TAC (SYM(CONJUNCT2(CONJUNCT2(SPEC `H:(A)hypermap` inverse_hypermap_maps)))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP LEFT_INVERSE_EQUATION (CONJ (CONJUNCT2 (SPEC `H:(A)hypermap` edge_map_and_darts)) th)]); ALL_TAC] + THEN MP_TAC (SYM(CONJUNCT1(SPEC `H:(A)hypermap` inverse_hypermap_maps))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP LEFT_INVERSE_EQUATION (CONJ (CONJUNCT2 (SPEC `H:(A)hypermap` node_map_and_darts)) th)]));; + +let lemmaZHQCZLX = prove(`!H:(A)hypermap. (simple_hypermap H /\ plain_hypermap H /\ (!x:A. x IN dart H ==> 3 <= CARD (face H x))) + ==> (!x:A. x IN dart H ==> ~(node_map H x = x))`, + GEN_TAC THEN REWRITE_TAC[simple_hypermap; plain_hypermap;face; node; GSYM GE] + THEN MP_TAC (SPEC `H:(A)hypermap` hypermap_lemma) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "c1") (CONJUNCTS_THEN2 (LABEL_TAC "c2") (CONJUNCTS_THEN2 (LABEL_TAC "c3") (CONJUNCTS_THEN2 (LABEL_TAC "c4") (LABEL_TAC "c5"))))) + THEN DISCH_THEN(CONJUNCTS_THEN2 (LABEL_TAC "c6") (CONJUNCTS_THEN2 (LABEL_TAC "c7") (LABEL_TAC "c8"))) + THEN GEN_TAC THEN DISCH_THEN (LABEL_TAC "c9") + THEN DISCH_THEN (LABEL_TAC "c10") + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `e = edge_map (H:(A)hypermap)` + THEN ABBREV_TAC `n = node_map (H:(A)hypermap)` + THEN ABBREV_TAC `f = face_map (H:(A)hypermap)` + THEN USE_THEN "c2" (MP_TAC o (SPEC `x:A`) o MATCH_MP PERMUTES_IN_IMAGE) + THEN USE_THEN "c4" (MP_TAC o (SPEC `x:A`) o MATCH_MP PERMUTES_IN_IMAGE) + THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC + THEN ABBREV_TAC `y:A = (f:A->A) (x:A)` THEN ABBREV_TAC `z:A = (e:A->A) (x:A)` + THEN USE_THEN "c7" MP_TAC THEN USE_THEN "c2" MP_TAC THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (MP_TAC o MATCH_MP LEFT_INVERSE_EQUATION) + THEN REWRITE_TAC[I_O_ID] + THEN DISCH_THEN(fun th -> (ASSUME_TAC (SYM th)) + THEN (ASSUME_TAC (AP_THM (SYM th) `x:A`))) + THEN USE_THEN "c3" (MP_TAC o (SPECL[`x:A`;`x:A`]) o MATCH_MP PERMUTES_INVERSE_EQ) + THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN USE_THEN "c5" MP_TAC + THEN USE_THEN "c2" MP_TAC THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (MP_TAC o MATCH_MP LEFT_INVERSE_EQUATION) THEN REWRITE_TAC[I_O_ID] + THEN DISCH_THEN(fun th -> (ASSUME_TAC (SYM th)) + THEN (MP_TAC (AP_THM (SYM th) `x:A`))) + THEN ASM_REWRITE_TAC[o_THM] THEN DISCH_THEN (MP_TAC o SYM) + THEN MP_TAC (SPECL[`D:A->bool`; `e:A->A`; `n:A->A`; `f:A->A`] cyclic_maps) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> MP_TAC (AP_THM (CONJUNCT2 th) `x:A`)) + THEN ASM_REWRITE_TAC[o_THM; I_THM] THEN DISCH_THEN (MP_TAC o AP_TERM `f:A->A`) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "c11") THEN DISCH_THEN (LABEL_TAC "c12") + THEN MP_TAC (SPECL[`f:A->A`; `2`; `z:A`; `y:A`] in_orbit_lemma) + THEN ASM_REWRITE_TAC[POWER_2; o_THM] + THEN DISCH_TAC THEN MP_TAC (SPECL[`D:A->bool`; `f:A->A`; `y:A`; `z:A`] orbit_sym) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (LABEL_TAC "d1") + THEN MP_TAC (SPECL[`n:A->A`; `1`; `y:A`; `z:A`] in_orbit_lemma) + THEN ASM_REWRITE_TAC[POWER_1] THEN DISCH_THEN (LABEL_TAC "d2") + THEN REMOVE_THEN "c6" (MP_TAC o (SPEC `y:A`)) + THEN UNDISCH_TAC `(y:A) IN D` THEN ASM_REWRITE_TAC[IN] THEN STRIP_TAC + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN MP_TAC (SPECL[`orbit_map (n:A->A) (y:A)`;`orbit_map (f:A->A) (y:A)`;`z:A`] IN_INTER) + THEN ASM_REWRITE_TAC[IN_SING] THEN STRIP_TAC + THEN REMOVE_THEN "c11" MP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN MP_TAC (SPECL[`f:A->A`; `2`; `y:A`] card_orbit_le) + THEN ASM_REWRITE_TAC[ARITH; POWER_2; o_DEF] THEN DISCH_TAC + THEN REMOVE_THEN "c8" (MP_TAC o (SPEC `y:A`)) THEN ASM_REWRITE_TAC[IN] + THEN POP_ASSUM MP_TAC THEN ARITH_TAC);; + +(* Definition of connected hypermap *) + +let connected_hypermap = new_definition `connected_hypermap (H:(A)hypermap) <=> number_of_components H = 1`;; + + +(* Some facts on sets with one element or two elements *) + +let CARD_SINGLETON = prove(`!x:A. CARD{x} = 1`, GEN_TAC THEN ASSUME_TAC (CONJUNCT1 CARD_CLAUSES) + THEN ASSUME_TAC (CONJUNCT1 FINITE_RULES) THEN MP_TAC(SPECL[`x:A`;`{}:A->bool`] (CONJUNCT2 CARD_CLAUSES)) + THEN ASM_REWRITE_TAC[NOT_IN_EMPTY] THEN ARITH_TAC);; + +let FINITE_SINGLETON = prove(`!x:A. FINITE {x}`, + REPEAT STRIP_TAC THEN ASSUME_TAC (CONJUNCT1 FINITE_RULES) + THEN MP_TAC (ISPECL[`x:A`; `{}:A->bool`] (CONJUNCT2 FINITE_RULES)) + THEN ASM_REWRITE_TAC[]);; + +let CARD_TWO_ELEMENTS = prove(`!x:A y:A. ~(x = y) ==> CARD {x ,y} = 2`, + REPEAT STRIP_TAC + THEN ASSUME_TAC(SPEC `y:A` FINITE_SINGLETON) + THEN ASSUME_TAC(SPEC `y:A` CARD_SINGLETON) + THEN MP_TAC(SPECL[`x:A`; `{y:A}`] (CONJUNCT2 CARD_CLAUSES)) + THEN ASM_REWRITE_TAC[IN_SING; TWO]);; + +let FINITE_TWO_ELEMENTS = prove(`!x:A y:A. FINITE {x ,y}`, + REPEAT STRIP_TAC THEN ASSUME_TAC(SPEC `y:A` FINITE_SINGLETON) + THEN MP_TAC(SPECL[`x:A`; `{y:A}`] (CONJUNCT2 FINITE_RULES)) + THEN ASM_REWRITE_TAC[]);; + +let CARD_ATLEAST_1 = prove(`!s:A->bool x:A. FINITE s /\ x IN s ==> 1 <= CARD s`, + REPEAT STRIP_TAC + THEN SUBGOAL_THEN `{x:A} SUBSET s` ASSUME_TAC + THENL[ASM_ASM_SET_TAC; ALL_TAC] + THEN ASSUME_TAC(SPEC `x:A` CARD_SINGLETON) + THEN MP_TAC (SPECL[`{x:A}`; `s:A->bool`] CARD_SUBSET) + THEN ASM_REWRITE_TAC[]);; + +let CARD_ATLEAST_2 = prove(`!s:A->bool x:A y:A. FINITE s /\ x IN s /\ y IN s /\ ~(x = y) ==> 2 <= CARD s`, + REPEAT STRIP_TAC + THEN SUBGOAL_THEN `{x:A, y:A} SUBSET s` ASSUME_TAC + THENL[ASM_ASM_SET_TAC; ALL_TAC] + THEN MP_TAC(SPECL[`x:A`;`y:A`] CARD_TWO_ELEMENTS) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN MP_TAC(SPECL[`{x:A, y:A}`; `s:A->bool`] CARD_SUBSET) + THEN ASM_REWRITE_TAC[]);; + +let orbit_single_lemma = prove(`!f:A->A x:A y:A. orbit_map f y = {x} ==> x = y`, + REPEAT STRIP_TAC THEN CONV_TAC SYM_CONV + THEN REWRITE_TAC[GSYM IN_SING] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN MP_TAC (SPECL[`f:A->A`; `0`; `y:A`] lemma_in_orbit) + THEN REWRITE_TAC[POWER_0; I_THM]);; + +(* Some lemmas about counting the orbits of a permutation *) + +let finite_orbits_lemma = prove(`!D:A->bool p:A->A. (FINITE D /\ p permutes D) ==> FINITE (set_of_orbits D p)`, + REPEAT STRIP_TAC THEN SUBGOAL_THEN `IMAGE (\x:A. orbit_map (p:A->A) x) (D:A->bool) = set_of_orbits D p` ASSUME_TAC + THENL[REWRITE_TAC[EXTENSION] THEN STRIP_TAC THEN EQ_TAC THENL[REWRITE_TAC[set_of_orbits;IMAGE;IN;IN_ELIM_THM];ALL_TAC] + THEN REWRITE_TAC[set_of_orbits;IMAGE;IN;IN_ELIM_THM];ALL_TAC] + THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) + THEN MATCH_MP_TAC FINITE_IMAGE THEN ASM_SIMP_TAC[]);; + +let lemma_disjoints = prove(`!(s:(A->bool)->bool) (t:A->bool). (!(v:A->bool). v IN s ==> DISJOINT t v) ==> DISJOINT t (UNIONS s)`, SET_TAC[]);; + +let lemma_partition = prove( `!s:A->bool p:A->A. FINITE s /\ p permutes s ==> s = UNIONS (set_of_orbits s p)`, + REPEAT STRIP_TAC THEN REWRITE_TAC[EXTENSION;IN_UNIONS] THEN GEN_TAC THEN EQ_TAC + THENL[MP_TAC (ISPECL[`p:A->A`;`x:A`] orbit_reflect) THEN REWRITE_TAC[set_of_orbits] + THEN REPEAT STRIP_TAC THEN EXISTS_TAC `(orbit_map p x):A->bool` THEN (ASM_ASM_SET_TAC); + DISCH_THEN(X_CHOOSE_THEN `t:A->bool` MP_TAC) THEN REWRITE_TAC[IN_ELIM_THM;set_of_orbits] + THEN STRIP_TAC THEN FIRST_ASSUM SUBST_ALL_TAC THEN FIRST_ASSUM(MP_TAC o MATCH_MP orbit_subset) THEN ASM_ASM_SET_TAC]);; + +let lemma_card_of_disjoint_covering = prove(`!(t:(A->bool)->bool). (FINITE t /\ (!u:A->bool. u IN t ==> FINITE u) + /\ (!(s1:A->bool) (s2:A->bool). s1 IN t /\ s2 IN t /\ ~(s1 = s2) ==> DISJOINT s1 s2)) ==> CARD (UNIONS t) = nsum t (\u. CARD u)`, + GEN_TAC + THEN ABBREV_TAC `n = CARD (t:(A->bool)->bool)` + THEN POP_ASSUM (MP_TAC) + THEN REWRITE_TAC[IMP_IMP] + THEN SPEC_TAC(`t:(A->bool)->bool`, `t:(A->bool)->bool`) + THEN SPEC_TAC(`n:num`, `n:num`) + THEN INDUCT_TAC + THENL[REPEAT STRIP_TAC + THEN UNDISCH_TAC `CARD (t:(A->bool)->bool) = 0` + THEN UNDISCH_TAC `FINITE (t:(A->bool)->bool)` + THEN REWRITE_TAC[IMP_IMP; GSYM HAS_SIZE; HAS_SIZE_0] + THEN DISCH_THEN SUBST_ALL_TAC + THEN REWRITE_TAC[SET_RULE `UNIONS {} = {}`] + THEN REWRITE_TAC[CARD_CLAUSES; NSUM_CLAUSES]; ALL_TAC] + THEN GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5")))) + THEN MP_TAC (SPEC `n:num` NON_ZERO) + THEN USE_THEN "F2" (SUBST1_TAC o SYM) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP CARD_EQ_0 th]) + THEN REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] + THEN DISCH_THEN (X_CHOOSE_THEN `u:A->bool` (LABEL_TAC "F6")) + THEN SUBGOAL_THEN `FINITE (UNIONS (t:(A->bool)->bool))` (LABEL_TAC "F7") + THENL[USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP FINITE_FINITE_UNIONS th]) + THEN USE_THEN "F4" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `UNIONS (t:(A->bool)->bool) = (UNIONS (t DELETE (u:A->bool))) UNION u` (LABEL_TAC "F8") + THENL[ASM_ASM_SET_TAC; ALL_TAC] + THEN SUBGOAL_THEN `DISJOINT (UNIONS ((t:(A->bool)->bool) DELETE (u:A->bool))) u` (LABEL_TAC "F9") + THENL[REWRITE_TAC[DISJOINT; INTER; EXTENSION; IN_ELIM_THM] + THEN GEN_TAC + THEN EQ_TAC + THENL[REWRITE_TAC[IN_UNIONS] + THEN STRIP_TAC + THEN SUBGOAL_THEN `~(DISJOINT (u:A->bool) (t':A->bool))` ASSUME_TAC + THENL[REWRITE_TAC[IN_DISJOINT] + THEN EXISTS_TAC `x:A` + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[th])); ALL_TAC] + THEN UNDISCH_TAC `t':A->bool IN (t:(A->bool)->bool) DELETE (u:A->bool)` + THEN REWRITE_TAC[IN_DELETE] + THEN STRIP_TAC + THEN USE_THEN "F5" (MP_TAC o SPECL[`t':A->bool`; `u:A->bool`]) + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[th])) + THEN USE_THEN "F6" (fun th -> REWRITE_TAC[th]) + THEN ONCE_REWRITE_TAC[DISJOINT_SYM] + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN MESON_TAC[NOT_IN_EMPTY]; ALL_TAC] + THEN USE_THEN "F3" (MP_TAC o ISPEC `u:A->bool` o MATCH_MP CARD_DELETE) + THEN USE_THEN "F6" (fun th -> REWRITE_TAC[th]) + THEN REMOVE_THEN "F2" SUBST1_TAC + THEN REWRITE_TAC[ADD1; ADD_SUB] + THEN DISCH_TAC + THEN FIRST_X_ASSUM (MP_TAC o SPEC`(t:(A->bool)->bool) DELETE (u:A->bool)`) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP FINITE_DELETE_IMP th]) + THEN SUBGOAL_THEN `!(u':A->bool). u' IN ((t:(A->bool)->bool) DELETE (u:A->bool)) ==> FINITE u'` (fun th -> REWRITE_TAC[th]) + THENL[REWRITE_TAC[IN_DELETE] + THEN USE_THEN "F4" (fun th -> MESON_TAC[SPEC `u':A->bool` th]); ALL_TAC] + THEN SUBGOAL_THEN `!s1:A->bool s2:A->bool. s1 IN ((t:(A->bool)->bool) DELETE (u:A->bool)) /\ s2 IN ((t:(A->bool)->bool) DELETE (u:A->bool)) /\ ~(s1 = s2) ==> DISJOINT s1 s2` (fun th -> REWRITE_TAC[th]) + THENL[REWRITE_TAC[IN_DELETE] + THEN REMOVE_THEN "F5" (fun th -> MESON_TAC[th]); ALL_TAC] + THEN DISCH_TAC + THEN SUBGOAL_THEN `CARD (UNIONS (t:(A->bool)->bool)) = CARD(UNIONS (t DELETE (u:A->bool))) + CARD (u:A->bool)` ASSUME_TAC + THENL[USE_THEN "F8" SUBST1_TAC + THEN MATCH_MP_TAC CARD_UNION + THEN USE_THEN "F9" (MP_TAC o REWRITE_RULE[DISJOINT]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F6" (fun th -> (USE_THEN "F4" (fun ths -> REWRITE_TAC[MATCH_MP ths th]))) + THEN USE_THEN "F7" MP_TAC + THEN USE_THEN "F8" SUBST1_TAC + THEN REWRITE_TAC[FINITE_UNION] + THEN SIMP_TAC[]; ALL_TAC] + THEN USE_THEN "F3" (fun th -> (USE_THEN "F6" (fun th1 -> (MP_TAC (SPEC `(\u:A->bool. CARD u)` (MATCH_MP NSUM_DELETE (CONJ th th1))))))) + THEN POP_ASSUM MP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[] + THEN ARITH_TAC);; + +let card_partition_formula = prove(`!s:A->bool p:A->A. FINITE s /\ p permutes s ==> CARD s = nsum (set_of_orbits s p) (\u:A->bool. CARD u)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN USE_THEN "F1" (fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [MATCH_MP lemma_partition th]) + THEN MATCH_MP_TAC lemma_card_of_disjoint_covering + THEN USE_THEN "F1" (fun th -> REWRITE_TAC [MATCH_MP finite_orbits_lemma th]) + THEN STRIP_TAC + THENL[GEN_TAC + THEN REWRITE_TAC[set_of_orbits; IN_ELIM_THM] + THEN STRIP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[MATCH_MP lemma_orbit_finite th]); ALL_TAC] + THEN REPEAT GEN_TAC + THEN REWRITE_TAC[set_of_orbits; IN_ELIM_THM] + THEN STRIP_TAC + THEN POP_ASSUM MP_TAC + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[DISJOINT] + THEN USE_THEN "F1" (MP_TAC o SPECL[`x:A`; `x':A`] o MATCH_MP partition_orbit) + THEN MESON_TAC[]);; + +let lemma_card_lower_bound = prove(`!s:A->bool p:A->A m:num. FINITE s /\ p permutes s /\ (!x:A. x IN s ==> m <= CARD(orbit_map p x)) + ==> (m * (number_of_orbits s p) <= CARD s)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (LABEL_TAC "F4" (MATCH_MP finite_orbits_lemma (CONJ th1 th2)))))) + THEN SUBGOAL_THEN `!x:(A->bool). x IN set_of_orbits s p ==> (\u:A->bool. (m:num)) x <= (\u:A->bool. CARD u) x` ASSUME_TAC + THENL[GEN_TAC + THEN REWRITE_TAC[set_of_orbits; IN_ELIM_THM] + THEN STRIP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN REMOVE_THEN "F3" (MP_TAC o SPEC `x':A`) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN USE_THEN "F4" (fun th1 -> (POP_ASSUM (fun th2 -> (MP_TAC (MATCH_MP NSUM_LE (CONJ th1 th2)))))) + THEN USE_THEN "F4" (fun th -> REWRITE_TAC[MATCH_MP NSUM_CONST th]) + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> REWRITE_TAC [GSYM(MATCH_MP card_partition_formula (CONJ th1 th2))]))) + THEN REWRITE_TAC[GSYM number_of_orbits] + THEN ARITH_TAC);; + +let lemma_card_eq = prove(`!(s:A->bool) p:A->A m:num. FINITE s /\ p permutes s /\ (!x:A. x IN s ==> CARD(orbit_map p x) = m) + ==> CARD s = m * (number_of_orbits s p)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3" o GSYM))) + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (LABEL_TAC "F4" (MATCH_MP finite_orbits_lemma (CONJ th1 th2)))))) + THEN SUBGOAL_THEN `!x:(A->bool). x IN set_of_orbits s p ==> (\u:A->bool. (m:num)) x = (\u:A->bool. CARD u) x` ASSUME_TAC + THENL[GEN_TAC + THEN REWRITE_TAC[set_of_orbits; IN_ELIM_THM] + THEN STRIP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN REMOVE_THEN "F3" (MP_TAC o SPEC `x':A`) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM (fun th2 -> (MP_TAC (MATCH_MP NSUM_EQ th2))) + THEN USE_THEN "F4" (fun th -> REWRITE_TAC[MATCH_MP NSUM_CONST th]) + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> REWRITE_TAC [GSYM(MATCH_MP card_partition_formula (CONJ th1 th2))]))) + THEN REWRITE_TAC[GSYM number_of_orbits] + THEN ARITH_TAC);; + +let lemma_orbit_convolution_map = prove(`!p:A->A. p o p = I ==> (!x:A. orbit_map p x = {x, p x})`, + REPEAT STRIP_TAC + THEN POP_ASSUM (fun th -> MP_TAC (AP_THM th `x:A`)) + THEN REWRITE_TAC[GSYM POWER_2; I_THM] + THEN MP_TAC (ARITH_RULE `~(2 = 0)`) + THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (fun th -> REWRITE_TAC[MATCH_MP orbit_cyclic th]) + THEN REWRITE_TAC[TWO; LT_SUC_LE] + THEN REWRITE_TAC[EXPAND_SET_TWO_ELEMENTS; POWER_0; POWER_1; I_THM]);; + +let lemma_nondegenerate_convolution = prove(`!s:A->bool p:A->A. FINITE s /\ p permutes s /\ p o p = I /\ + (!x:A. x IN s ==> ~(p x = x)) ==> (!x:A. x IN s ==> FINITE (orbit_map p x) /\ CARD(orbit_map p x) = 2)`, + REPEAT GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2")(CONJUNCTS_THEN2 (LABEL_TAC "F3")(LABEL_TAC "F4")))) + THEN GEN_TAC THEN (DISCH_THEN(LABEL_TAC "F5")) THEN USE_THEN "F2"(MP_TAC o SPEC `x:A` o MATCH_MP orbit_subset) THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "F6") THEN + USE_THEN "F1"(fun th1 -> (USE_THEN "F6"(fun th2 -> (MP_TAC(MATCH_MP FINITE_SUBSET (CONJ th1 th2)))))) + THEN DISCH_THEN(LABEL_TAC "F7") THEN ASM_REWRITE_TAC[] THEN MP_TAC(ISPECL[`p:A->A`;`2`;`x:A`] card_orbit_le) + THEN ASM_REWRITE_TAC[ARITH; SPEC `(p:A->A)` POWER_2;I_THM] THEN DISCH_THEN(LABEL_TAC "F8") + THEN MP_TAC(ISPECL[`p:A->A`;`1`; `x:A`; `(p:A->A) (x:A)`] in_orbit_lemma) THEN REWRITE_TAC[POWER_1] + THEN DISCH_THEN(LABEL_TAC "F9") THEN LABEL_TAC "F10" (ISPECL[`p:A->A`;`x:A`] orbit_reflect) + THEN USE_THEN "F5" (fun th-> USE_THEN "F4" (MP_TAC o REWRITE_RULE[th] o SPEC `x:A`)) + THEN USE_THEN "F10" MP_TAC THEN USE_THEN "F9" MP_TAC THEN USE_THEN "F7" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP CARD_ATLEAST_2) + THEN USE_THEN "F8" MP_TAC THEN REWRITE_TAC[IMP_IMP; LE_ANTISYM]);; + +let lemmaTGJISOK = prove(`!H:(A)hypermap. connected_hypermap H /\ plain_hypermap H /\ planar_hypermap H /\ + (!x:A. x IN (dart H) ==> ~(edge_map H x = x) /\ (3 <= CARD(node H x))) + ==> (CARD (dart H) <= (6*(number_of_faces H)-12))`, + + GEN_TAC THEN REWRITE_TAC[connected_hypermap; plain_hypermap; planar_hypermap] + THEN DISCH_THEN(CONJUNCTS_THEN2 (ASSUME_TAC) (MP_TAC )) THEN POP_ASSUM SUBST1_TAC THEN SIMP_TAC[ARITH] + THEN DISCH_THEN(CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN SUBGOAL_THEN `!x:A. x IN dart (H:(A)hypermap) ==> CARD (edge H x) = 2` MP_TAC + THENL[MP_TAC(SPECL[`dart (H:(A)hypermap)`; `edge_map (H:(A)hypermap)`] lemma_nondegenerate_convolution) + THEN REWRITE_TAC[edge_map_and_darts; GSYM edge] + THEN ASM_SIMP_TAC[]; ALL_TAC] + THEN REWRITE_TAC[edge] + THEN DISCH_THEN (fun th -> (MP_TAC (MATCH_MP lemma_card_eq(REWRITE_RULE[GSYM CONJ_ASSOC] (CONJ (SPEC `H:(A)hypermap` edge_map_and_darts) th))))) + THEN GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [number_of_orbits] + THEN REWRITE_TAC[GSYM edge_set; GSYM number_of_edges] + THEN DISCH_THEN (LABEL_TAC "F4") + THEN SUBGOAL_THEN `!x:A. x IN dart (H:(A)hypermap) ==> 3 <= CARD (node H x)` MP_TAC + THENL[ASM_SIMP_TAC[]; ALL_TAC] + THEN REWRITE_TAC[node] + THEN DISCH_THEN (fun th->(MP_TAC (MATCH_MP lemma_card_lower_bound(REWRITE_RULE[GSYM CONJ_ASSOC] (CONJ (SPEC `H:(A)hypermap` node_map_and_darts) th))))) + THEN GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [number_of_orbits] + THEN REWRITE_TAC[GSYM node_set; GSYM number_of_nodes] + THEN DISCH_TAC + THEN REMOVE_THEN "F2" MP_TAC + THEN POP_ASSUM MP_TAC + THEN REMOVE_THEN "F4" SUBST1_TAC + THEN ARITH_TAC);; + +(* We set up some lemmas on combinatorial commponents *) + +let lemma_subpath = prove(`!H:(A)hypermap p:num->A n:num. is_path H p n ==> (!i. i <= n ==> is_path H p i)`, + REPLICATE_TAC 2 GEN_TAC THEN INDUCT_TAC THENL[ SIMP_TAC[is_path; CONJUNCT1 LE]; ALL_TAC] + THEN STRIP_TAC THEN GEN_TAC THEN REWRITE_TAC[CONJUNCT2 LE] THEN STRIP_TAC + THENL[ASM_REWRITE_TAC[]; UNDISCH_TAC `is_path (H:(A)hypermap) (p:num->A) (SUC n)` THEN ASM_REWRITE_TAC[is_path] THEN ASM_MESON_TAC[]]);; + +let lemma_path_subset = prove(`!H:(A)hypermap x:A p:num->A n:num. (x IN dart H) /\ (p 0 = x) /\ (is_path H p n) ==> p n IN dart H`, + REPLICATE_TAC 3 GEN_TAC THEN INDUCT_TAC THENL[SIMP_TAC[is_path;go_one_step];ALL_TAC] + THEN REWRITE_TAC[is_path] + THEN DISCH_THEN (fun th-> POP_ASSUM (ASSUME_TAC o REWRITE_RULE[th]) THEN (MP_TAC(REWRITE_RULE[go_one_step] (CONJUNCT2(CONJUNCT2(CONJUNCT2 th)))))) + THEN STRIP_TAC + THENL[POP_ASSUM SUBST1_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP lemma_dart_invariant th]); + POP_ASSUM SUBST1_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP lemma_dart_invariant th]); ALL_TAC] + THEN POP_ASSUM SUBST1_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP lemma_dart_invariant th]));; + +let lemma_component_subset = prove(`!H:(A)hypermap x:A. x IN dart H ==> comb_component H x SUBSET dart H`, + REPEAT STRIP_TAC THEN STRIP_ASSUME_TAC(SPEC `H:(A)hypermap` hypermap_lemma) + THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;comb_component] + THEN GEN_TAC THEN REWRITE_TAC[is_in_component] THEN ASM_MESON_TAC[lemma_path_subset]);; + +let lemma_edge_subset = prove(`!(H:(A)hypermap) x:A. x IN dart H ==> edge H x SUBSET dart H`, + REWRITE_TAC[edge] THEN MESON_TAC[edge_map_and_darts; orbit_subset]);; + +let lemma_node_subset = prove(`!(H:(A)hypermap) x:A. x IN dart H ==> node H x SUBSET dart H`, + REWRITE_TAC[node] THEN MESON_TAC[ node_map_and_darts; orbit_subset]);; + +let lemma_face_subset = prove(`!(H:(A)hypermap) x:A. x IN dart H ==> face H x SUBSET dart H`, + REWRITE_TAC[face] THEN MESON_TAC[face_map_and_darts; orbit_subset]);; + +let lemma_component_reflect = prove(`!H:(A)hypermap x:A. x IN comb_component H x`, + REPEAT STRIP_TAC THEN REWRITE_TAC[IN_ELIM_THM; comb_component;is_in_component] + THEN EXISTS_TAC `(\k:num. x:A)` THEN EXISTS_TAC `0` THEN MESON_TAC[is_path]);; + +(* The definition of path is exactly here *) + +let lemma_def_path = prove(`!H:(A)hypermap p:num->A n:num.(is_path H p n <=> (!i:num. i < n ==> go_one_step H (p i) (p (SUC i))))`, + REPLICATE_TAC 2 GEN_TAC THEN INDUCT_TAC + THENL[REWRITE_TAC[is_path] THEN ARITH_TAC; ALL_TAC] + THEN ASM_REWRITE_TAC[is_path] + THEN REWRITE_TAC[lemma_add_one_assumption_lt]);; + +(* Three special paths *) + +let edge_path = new_definition `!(H:(A)hypermap) (x:A) (i:num). edge_path H x i = ((edge_map H) POWER i) x`;; + +let node_path = new_definition `!(H:(A)hypermap) (x:A) (i:num). node_path H x i = ((node_map H) POWER i) x`;; + +let face_path = new_definition `!(H:(A)hypermap) (x:A) (i:num). face_path H x i = ((face_map H) POWER i) x`;; + +let lemma_edge_path = prove(`!(H:(A)hypermap) (x:A) k:num. is_path H (edge_path H x) k`, + REPLICATE_TAC 2 GEN_TAC + THEN INDUCT_TAC THENL[REWRITE_TAC[is_path]; ALL_TAC] + THEN REWRITE_TAC[is_path] THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[go_one_step] THEN DISJ1_TAC THEN REWRITE_TAC[edge_path; COM_POWER; o_THM]);; + +let lemma_node_path = prove(`!(H:(A)hypermap) (x:A) k:num. is_path H (node_path H x) k`, + REPLICATE_TAC 2 GEN_TAC + THEN INDUCT_TAC THENL[REWRITE_TAC[is_path]; ALL_TAC] + THEN REWRITE_TAC[is_path] THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[go_one_step] THEN DISJ2_TAC THEN DISJ1_TAC THEN REWRITE_TAC[node_path; COM_POWER; o_THM]);; + +let lemma_face_path = prove(`!(H:(A)hypermap) (x:A) k:num. is_path H (face_path H x) k`, + REPLICATE_TAC 2 GEN_TAC + THEN INDUCT_TAC THENL[REWRITE_TAC[is_path]; ALL_TAC] + THEN REWRITE_TAC[is_path] THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[go_one_step] THEN DISJ2_TAC THEN DISJ2_TAC THEN REWRITE_TAC[face_path; COM_POWER; o_THM]);; + +(* Some lemmas on concatenate paths *) + +let lemma_glue_paths = prove(`!(H:(A)hypermap) p:num->A q:num->A n:num m:num. is_path H p n /\ is_path H q m /\ (p n = q 0) + ==> is_path H (glue p q n) (n + m)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_def_path] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN GEN_TAC THEN DISCH_THEN (LABEL_TAC "F4") + THEN ASM_CASES_TAC `i:num < n:num` + THENL[POP_ASSUM (LABEL_TAC "F5") + THEN USE_THEN "F5" (fun th -> (MP_TAC (MATCH_MP LT_IMP_LE th)) THEN ASSUME_TAC (REWRITE_RULE[GSYM LE_SUC_LT] th)) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP first_glue_evaluation th]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP first_glue_evaluation th]) + THEN POP_ASSUM (fun th-> USE_THEN "F1" (fun thm -> REWRITE_TAC[MATCH_MP thm th])); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F5" o REWRITE_RULE[NOT_LT]) + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[LE_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` SUBST_ALL_TAC) + THEN GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [ADD_SYM] + THEN GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [CONJUNCT2(GSYM ADD)] + THEN GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [ADD_SYM] + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP second_glue_evaluation th]) + THEN USE_THEN "F4" (MP_TAC o REWRITE_RULE[GSYM ADD1; LT_ADD_LCANCEL; LT_SUC]) + THEN DISCH_THEN(fun th-> USE_THEN "F2" (fun thm -> REWRITE_TAC[MATCH_MP thm th])));; + +let concatenate_two_paths = prove(`!H:(A)hypermap p:num->A q:num->A n:num m:num. is_path H p n /\ is_path H q m /\ (p n = q 0) +==> ?g:num->A. g 0 = p 0 /\ g (n+m) = q m /\ is_path H g (n+m) /\ (!i:num. i <= n ==> g i = p i) /\ (!i:num. i <= m ==> g (n+i) = q i)`, + REPEAT GEN_TAC + THEN DISCH_THEN ASSUME_TAC + THEN EXISTS_TAC `glue (p:num->A) (q:num->A) (n:num)` + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP lemma_glue_paths th] THEN ASSUME_TAC (CONJUNCT2 (CONJUNCT2 th))) + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP second_glue_evaluation th]) + THEN SIMP_TAC[glue; LE_0; COND_ELIM_THM]);; + +let concatenate_paths = prove(`!H:(A)hypermap p:num->A q:num->A n:num m:num. is_path H p n /\ is_path H q m /\ (p n = q 0) + ==> ?g:num->A. g 0 = p 0 /\ g (n+m) = q m /\ is_path H g (n+m)`, + REPEAT GEN_TAC + THEN DISCH_THEN (MP_TAC o MATCH_MP concatenate_two_paths) THEN MESON_TAC[]);; + +let lemma_component_trans = prove(`!H:(A)hypermap x:A y:A z:A. y IN comb_component H x /\ z IN comb_component H y + ==> z IN comb_component H x`, + REPEAT GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM; comb_component; is_in_component] + THEN REPEAT STRIP_TAC + THEN MP_TAC(ISPECL[`H:(A)hypermap`; `p:num->A`;`p':num->A`;`n:num`;`n':num`] concatenate_paths) + THEN ASM_REWRITE_TAC[] THEN MESON_TAC[]);; + +let lemma_reverse_path = prove(`!H:(A)hypermap p:num->A n:num. is_path H p n ==> ?q:num->A m:num. q 0 = p n /\ q m = p 0 /\ is_path H q m`, + REPLICATE_TAC 2 GEN_TAC + THEN INDUCT_TAC + THENL[REWRITE_TAC[is_path] + THEN EXISTS_TAC `p:num->A` THEN EXISTS_TAC `0` + THEN REWRITE_TAC[is_path]; ALL_TAC] + THEN REWRITE_TAC[is_path] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) + THEN REMOVE_THEN "F1" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (X_CHOOSE_THEN `g:num->A`(X_CHOOSE_THEN `m:num`(CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5"))))) + THEN USE_THEN "F2" MP_TAC + THEN REWRITE_TAC[go_one_step] + THEN STRIP_TAC + THENL[MP_TAC (SPEC `H:(A)hypermap` hypermap_lemma) + THEN DISCH_THEN (fun th-> (POP_ASSUM (fun th1 -> (MP_TAC (MATCH_MP inverse_relation (CONJ (CONJUNCT1 th) (CONJ (CONJUNCT1(CONJUNCT2 th)) th1))))))) + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` MP_TAC) + THEN REWRITE_TAC[GSYM edge_path] + THEN USE_THEN "F3" (SUBST1_TAC o SYM) + THEN USE_THEN "F5"(fun th1->(DISCH_THEN(fun th->(MP_TAC(MATCH_MP concatenate_two_paths (CONJ (SPECL[`H:(A)hypermap`; `(p:num->A) (SUC n)`; `k:num`] lemma_edge_path) (CONJ th1 (SYM th)))))))) + THEN STRIP_TAC + THEN EXISTS_TAC `g':num->A` + THEN EXISTS_TAC `(k:num) + (m:num)` + THEN ASM_REWRITE_TAC[edge_path; POWER_0; I_THM]; + MP_TAC (SPEC `H:(A)hypermap` hypermap_lemma) + THEN DISCH_THEN(fun th->(POP_ASSUM(fun th1->(MP_TAC(MATCH_MP inverse_relation (CONJ(CONJUNCT1 th)(CONJ(CONJUNCT1(CONJUNCT2(CONJUNCT2 th))) th1))))))) + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` MP_TAC) + THEN REWRITE_TAC[GSYM node_path] + THEN USE_THEN "F3" (SUBST1_TAC o SYM) + THEN USE_THEN "F5" (fun th1 -> (DISCH_THEN (fun th -> (MP_TAC (MATCH_MP concatenate_two_paths (CONJ (SPECL[`H:(A)hypermap`; `(p:num->A) (SUC n)`; `k:num`] lemma_node_path) (CONJ th1 (SYM th)))))))) + THEN STRIP_TAC + THEN EXISTS_TAC `g':num->A` + THEN EXISTS_TAC `(k:num) + (m:num)` + THEN ASM_REWRITE_TAC[node_path; POWER_0; I_THM]; ALL_TAC] + THEN MP_TAC (SPEC `H:(A)hypermap` hypermap_lemma) + THEN DISCH_THEN (fun th-> (POP_ASSUM (fun th1 -> (MP_TAC (MATCH_MP inverse_relation (CONJ (CONJUNCT1 th) (CONJ (CONJUNCT1(CONJUNCT2(CONJUNCT2(CONJUNCT2 th)))) th1))))))) + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` MP_TAC) + THEN REWRITE_TAC[GSYM face_path] + THEN USE_THEN "F3" (SUBST1_TAC o SYM) + THEN USE_THEN "F5" (fun th1 -> (DISCH_THEN (fun th -> (MP_TAC (MATCH_MP concatenate_two_paths (CONJ (SPECL[`H:(A)hypermap`; `(p:num->A) (SUC n)`; `k:num`] lemma_face_path) (CONJ th1 (SYM th)))))))) + THEN STRIP_TAC + THEN EXISTS_TAC `g':num->A` + THEN EXISTS_TAC `(k:num) + (m:num)` + THEN ASM_REWRITE_TAC[face_path; POWER_0; I_THM]);; + +let lemma_component_symmetry = prove(`!H:(A)hypermap x:A y:A. y IN comb_component H x + ==> x IN comb_component H y`, + REPEAT GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM; comb_component; is_in_component] + THEN REPEAT STRIP_TAC THEN POP_ASSUM (MP_TAC o MATCH_MP lemma_reverse_path) + THEN ASM_REWRITE_TAC[]);; + +let partition_components = prove(`!(H:(A)hypermap) x:A y:A. + comb_component H x = comb_component H y \/ comb_component H x INTER comb_component H y ={}`, + REPEAT GEN_TAC THEN ASM_CASES_TAC `comb_component (H:(A)hypermap) (x:A) INTER comb_component H (y:A) ={}` + THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] + THEN DISCH_THEN (X_CHOOSE_THEN `t:A` MP_TAC) THEN REWRITE_TAC[INTER; IN_ELIM_THM] + THEN DISCH_THEN(CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) THEN REWRITE_TAC[EXTENSION] + THEN GEN_TAC THEN EQ_TAC THENL[USE_THEN "F1" (LABEL_TAC "F3" o MATCH_MP lemma_component_symmetry) + THEN DISCH_THEN (LABEL_TAC "F4") + THEN REMOVE_THEN "F4"(fun th1 -> REMOVE_THEN "F3" (fun th2 -> MP_TAC (MATCH_MP lemma_component_trans (CONJ th2 th1)))) + THEN DISCH_THEN(fun th1 -> (REMOVE_THEN "F2" (fun th2 -> MP_TAC (MATCH_MP lemma_component_trans (CONJ th2 th1))))) THEN REWRITE_TAC[];ALL_TAC] + THEN USE_THEN "F2" (LABEL_TAC "F5" o MATCH_MP lemma_component_symmetry) + THEN DISCH_THEN (LABEL_TAC "F6") + THEN REMOVE_THEN "F6"(fun th1 -> REMOVE_THEN "F5" (fun th2 -> MP_TAC (MATCH_MP lemma_component_trans (CONJ th2 th1)))) + THEN DISCH_THEN(fun th1 -> (REMOVE_THEN "F1" (fun th2 -> MP_TAC (MATCH_MP lemma_component_trans (CONJ th2 th1))))) + THEN REWRITE_TAC[]);; + +let lemma_partition_by_components = prove(`!(H:(A)hypermap). dart H = UNIONS (set_of_components H)`, + GEN_TAC THEN REWRITE_TAC[set_of_components; set_part_components; EXTENSION; IN_UNIONS] + THEN GEN_TAC THEN EQ_TAC + THENL[STRIP_TAC + THEN REWRITE_TAC[IN_ELIM_THM] + THEN MP_TAC (SPECL[`H:(A)hypermap`;`x:A`] lemma_component_reflect) + THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC + THEN EXISTS_TAC `comb_component (H:(A)hypermap) (x:A)` + THEN ASM_REWRITE_TAC[] + THEN EXISTS_TAC `x:A` THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC + THEN FIRST_ASSUM (MP_TAC o MATCH_MP lemma_component_subset) THEN ASM_ASM_SET_TAC);; + +(* We define the CONTOUR PATHS *) + +let one_step_contour = new_definition `one_step_contour (H:(A)hypermap) (x:A) (y:A) <=> (y = (face_map H) x) \/ (y = (inverse (node_map H)) x)`;; + +let is_contour = new_recursive_definition num_RECURSION `(is_contour (H:(A)hypermap) (p:num->A) 0 <=> T)/\ + (is_contour (H:(A)hypermap) (p:num->A) (SUC n) <=> ((is_contour H p n) /\ one_step_contour H (p n) (p (SUC n))))`;; + +let lemma_subcontour = prove(`!H:(A)hypermap p:num->A n:num. is_contour H p n ==> (!i. i <= n ==> is_contour H p i)`, + REPLICATE_TAC 2 GEN_TAC THEN INDUCT_TAC + THENL[SIMP_TAC[is_contour; CONJUNCT1 LE]; ALL_TAC] + THEN STRIP_TAC THEN GEN_TAC THEN REWRITE_TAC[CONJUNCT2 LE] + THEN STRIP_TAC + THENL[ASM_REWRITE_TAC[]; + UNDISCH_TAC `is_contour (H:(A)hypermap) (p:num->A) (SUC n)` THEN ASM_REWRITE_TAC[is_contour] THEN ASM_MESON_TAC[]]);; + +let lemma_def_contour = prove(`!H:(A)hypermap p:num->A n:num.(is_contour H p n <=> (!i:num. i < n ==> one_step_contour H (p i) (p (SUC i))))`, + REPLICATE_TAC 2 GEN_TAC THEN INDUCT_TAC + THENL[REWRITE_TAC[is_contour] THEN ARITH_TAC; ALL_TAC] + THEN ASM_REWRITE_TAC[is_contour] THEN REWRITE_TAC[lemma_add_one_assumption_lt]);; + +let lemma_glue_contours = prove(`!(H:(A)hypermap) p:num->A q:num->A n:num m:num. is_contour H p n /\ is_contour H q m /\ (p n = q 0) + ==> is_contour H (glue p q n) (n + m)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_def_contour] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN GEN_TAC THEN DISCH_THEN (LABEL_TAC "F4") + THEN ASM_CASES_TAC `i:num < n:num` + THENL[POP_ASSUM (LABEL_TAC "F5") + THEN USE_THEN "F5" (fun th -> (MP_TAC (MATCH_MP LT_IMP_LE th)) THEN ASSUME_TAC (REWRITE_RULE[GSYM LE_SUC_LT] th)) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP first_glue_evaluation th]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP first_glue_evaluation th]) + THEN POP_ASSUM (fun th-> USE_THEN "F1" (fun thm -> REWRITE_TAC[MATCH_MP thm th])); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F5" o REWRITE_RULE[NOT_LT]) + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[LE_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` SUBST_ALL_TAC) + THEN GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [ADD_SYM] + THEN GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [CONJUNCT2(GSYM ADD)] + THEN GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [ADD_SYM] + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP second_glue_evaluation th]) + THEN USE_THEN "F4" (MP_TAC o REWRITE_RULE[GSYM ADD1; LT_ADD_LCANCEL; LT_SUC]) + THEN DISCH_THEN(fun th-> USE_THEN "F2" (fun thm -> REWRITE_TAC[MATCH_MP thm th])));; + +let concatenate_contours = prove(`!H:(A)hypermap p:num->A q:num->A n:num m:num. is_contour H p n /\ is_contour H q m /\ (p n = q 0) +==> ?g:num->A. g 0 = p 0 /\ g (n+m) = q m /\ is_contour H g (n+m) /\ (!i:num. i <= n ==> g i = p i) /\ (!i:num. i <= m ==> g (n+i) = q i)`, + REPEAT GEN_TAC + THEN DISCH_THEN ASSUME_TAC + THEN EXISTS_TAC `glue (p:num->A) (q:num->A) (n:num)` + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP lemma_glue_contours th] THEN ASSUME_TAC (CONJUNCT2 (CONJUNCT2 th))) + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP second_glue_evaluation th]) + THEN SIMP_TAC[glue; LE_0; COND_ELIM_THM]);; + +let node_contour = new_definition `!(H:(A)hypermap) (x:A) (i:num). node_contour H x i = ((inverse (node_map H)) POWER i) x`;; + +(* face contour is exactly: face_path *) + +let face_contour = new_definition `!(H:(A)hypermap) (x:A) (i:num). face_contour H x i = ((face_map H) POWER i) x`;; + +let lemma_node_contour = prove(`!(H:(A)hypermap) (x:A) (k:num). is_contour H (node_contour H x) k`, + REPLICATE_TAC 2 GEN_TAC + THEN INDUCT_TAC THENL[REWRITE_TAC[is_contour]; ALL_TAC] + THEN REWRITE_TAC[is_contour] + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[one_step_contour] + THEN DISJ2_TAC THEN REWRITE_TAC[node_contour; COM_POWER; o_THM]);; + +let lemma_face_contour = prove(`!(H:(A)hypermap) (x:A) (k:num). is_contour H (face_contour H x) k`, + REPLICATE_TAC 2 GEN_TAC + THEN INDUCT_TAC THENL[REWRITE_TAC[is_contour]; ALL_TAC] + THEN REWRITE_TAC[is_contour] + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[one_step_contour] + THEN DISJ1_TAC THEN REWRITE_TAC[face_contour; COM_POWER; o_THM]);; + +let existence_contour = prove(`!(H:(A)hypermap) p:num->A n:num. is_path H p n ==> ?q:num->A m:num. q 0 = p 0 /\ q m = p n /\ is_contour H q m`, + REPLICATE_TAC 2 GEN_TAC THEN INDUCT_TAC + THENL[REWRITE_TAC[is_path] + THEN EXISTS_TAC `p:num->A` THEN EXISTS_TAC `0` THEN ASM_REWRITE_TAC[is_contour]; ALL_TAC] + THEN REWRITE_TAC[is_path] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) + THEN REMOVE_THEN "F1" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (X_CHOOSE_THEN `q:num->A`(X_CHOOSE_THEN `m:num`(CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5"))))) + THEN REMOVE_THEN "F2" MP_TAC + THEN REWRITE_TAC[go_one_step] + THEN STRIP_TAC + THENL[ POP_ASSUM (LABEL_TAC "G1") + THEN MP_TAC (SPECL[`H:(A)hypermap`; `(q:num->A) (m:num)`; `0`] node_contour) + THEN REWRITE_TAC[POWER_0; I_THM] + THEN USE_THEN "F5" (fun th1 -> (DISCH_THEN (fun th2 -> MP_TAC(MATCH_MP concatenate_contours (CONJ th1 (CONJ (SPECL[`H:(A)hypermap`; `(q:num->A) (m:num)`; `1`] lemma_node_contour) (SYM th2))))))) + THEN REWRITE_TAC[GSYM ADD1] + THEN DISCH_THEN (X_CHOOSE_THEN `g:num->A` (CONJUNCTS_THEN2 (LABEL_TAC "G2") (CONJUNCTS_THEN2 (LABEL_TAC "G3") (LABEL_TAC "G4" o CONJUNCT1)))) + THEN REMOVE_THEN "G3" MP_TAC + THEN REWRITE_TAC[node_contour; POWER_1] + THEN DISCH_THEN (LABEL_TAC "G2") + THEN MP_TAC (SPEC `H:(A)hypermap` hypermap_lemma) + THEN DISCH_THEN (fun th -> MP_TAC(MATCH_MP inverse_element_lemma (CONJ (CONJUNCT1 th) (CONJUNCT1(CONJUNCT2(CONJUNCT2(CONJUNCT2 th))))))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (LABEL_TAC "G7" o SYM)) + THEN MP_TAC (SPECL[`H:(A)hypermap`; `(g:num->A) (SUC m)`; `0:num`] face_contour) + THEN REWRITE_TAC[POWER_0; I_THM] + THEN USE_THEN "G4" (fun th1 -> (DISCH_THEN (fun th2 -> MP_TAC(MATCH_MP concatenate_contours (CONJ th1 (CONJ (SPECL[`H:(A)hypermap`; `(g:num->A) (SUC m)`; `j:num`] lemma_face_contour) (SYM th2))))))) + THEN REWRITE_TAC[face_contour] + THEN DISCH_THEN (X_CHOOSE_THEN `w:num->A` STRIP_ASSUME_TAC) + THEN EXISTS_TAC `w:num->A` + THEN EXISTS_TAC `(SUC m) + (j:num)` + THEN ASM_REWRITE_TAC[] + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [GSYM o_THM] + THEN REWRITE_TAC[GSYM inverse2_hypermap_maps]; + POP_ASSUM (LABEL_TAC "G1") + THEN MP_TAC (SPEC `H:(A)hypermap` hypermap_lemma) + THEN DISCH_THEN (fun th -> MP_TAC(MATCH_MP inverse_element_lemma (CONJ (CONJUNCT1 th) (CONJUNCT1(CONJUNCT2(CONJUNCT2 th)))))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (LABEL_TAC "G7" o SYM)) + THEN MP_TAC (SPECL[`H:(A)hypermap`; `(q:num->A) (m:num)`; `0:num`] node_contour) + THEN REWRITE_TAC[POWER_0; I_THM] + THEN USE_THEN "F5" (fun th1 -> (DISCH_THEN (fun th2 -> MP_TAC(MATCH_MP concatenate_contours (CONJ th1 (CONJ (SPECL[`H:(A)hypermap`; `(q:num->A) (m:num)`; `j:num`] lemma_node_contour) (SYM th2))))))) + THEN REWRITE_TAC[node_contour] + THEN DISCH_THEN (X_CHOOSE_THEN `w:num->A` STRIP_ASSUME_TAC) + THEN EXISTS_TAC `w:num->A` + THEN EXISTS_TAC `(m:num) + (j:num)` + THEN ASM_REWRITE_TAC[] + THEN CONV_TAC SYM_CONV + THEN REWRITE_TAC[GSYM(MATCH_MP inverse_power_function (CONJUNCT1(CONJUNCT2(CONJUNCT2(SPEC `H:(A)hypermap` hypermap_lemma)))))] + THEN GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [GSYM o_THM] + THEN REWRITE_TAC[GSYM POWER] + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN USE_THEN "G7" SUBST1_TAC + THEN REWRITE_TAC[node_map_inverse_representation]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "G1") + THEN MP_TAC (SPECL[`H:(A)hypermap`; `(q:num->A) (m:num)`; `0`] face_contour) + THEN REWRITE_TAC[POWER_0; I_THM] + THEN USE_THEN "F5" (fun th1 -> (DISCH_THEN (fun th2 -> MP_TAC(MATCH_MP concatenate_contours (CONJ th1 (CONJ (SPECL[`H:(A)hypermap`; `(q:num->A) (m:num)`; `1`] lemma_face_contour) (SYM th2))))))) + THEN REWRITE_TAC[GSYM ADD1] + THEN STRIP_TAC + THEN EXISTS_TAC `g:num->A` + THEN EXISTS_TAC `(SUC m)` + THEN ASM_REWRITE_TAC[face_contour; POWER_1]);; + +let lemmaKDAEDEX = prove(`!H:(A)hypermap x:A y:A. y IN comb_component H x + ==> ?p:num->A n:num. (p 0 = x) /\ (p n = y) /\ (is_contour H p n)`, + REPEAT GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM; comb_component; is_in_component] + THEN REPEAT STRIP_TAC THEN POP_ASSUM (MP_TAC o MATCH_MP existence_contour) + THEN REPEAT STRIP_TAC THEN EXISTS_TAC `q:num->A` THEN EXISTS_TAC `m:num` + THEN ASM_REWRITE_TAC[]);; + + +(* the definition of injectve contours *) + +let is_inj_contour = new_recursive_definition num_RECURSION `(is_inj_contour (H:(A)hypermap) (p:num->A) 0 <=> T) /\ + (is_inj_contour (H:(A)hypermap) (p:num->A) (SUC n) <=> ((is_inj_contour H p n) /\ one_step_contour H (p n) (p (SUC n)) /\ + (!i:num. i <= n ==> ~(p i = p (SUC n))) ))`;; + +let lemma_sub_inj_contour = prove(`!H:(A)hypermap p:num->A n:num. is_inj_contour H p n ==> (!i. i <= n ==> is_inj_contour H p i)`, + REPLICATE_TAC 2 GEN_TAC THEN INDUCT_TAC + THENL[SIMP_TAC[is_inj_contour; CONJUNCT1 LE]; ALL_TAC] + THEN SIMP_TAC[lemma_add_one_assumption] + THEN POP_ASSUM (fun th-> DISCH_THEN (MP_TAC o MATCH_MP th o CONJUNCT1 o REWRITE_RULE[is_inj_contour])) + THEN SIMP_TAC[]);; + +let identify_inj_contour = prove(`!(H:(A)hypermap) p:num->A q:num->A n:num. is_inj_contour H p n /\ (!i:num. i<= n ==> p i = q i) + ==> is_inj_contour H q n`, + REPLICATE_TAC 3 GEN_TAC THEN INDUCT_TAC + THENL[STRIP_TAC THEN REWRITE_TAC[is_inj_contour]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F1") + THEN REWRITE_TAC[is_inj_contour] + THEN DISCH_THEN (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4"))) MP_TAC) + THEN DISCH_THEN (MP_TAC o REWRITE_RULE[lemma_add_one_assumption]) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F5") (SUBST1_TAC o SYM)) + THEN REMOVE_THEN "F1" (fun th-> REMOVE_THEN "F2" (fun th1-> USE_THEN "F5" (fun th2-> REWRITE_TAC[MATCH_MP th (CONJ th1 th2)]))) + THEN USE_THEN "F5" (SUBST1_TAC o SYM o REWRITE_RULE[LE_REFL] o SPEC `n:num`) + THEN REMOVE_THEN "F3" (fun th-> REWRITE_TAC[th]) + THEN GEN_TAC THEN DISCH_THEN (fun th-> (POP_ASSUM (fun th1-> REWRITE_TAC[SYM(MATCH_MP th1 th)]) THEN MP_TAC th)) + THEN ASM_SIMP_TAC[]);; + +let lemma_def_inj_contour = prove(`!(H:(A)hypermap) p:num->A n:num. + is_inj_contour H p n <=> is_contour H p n /\ (!i:num j:num. i <= n /\ j < i ==> ~(p j = p i))`, + REPLICATE_TAC 2 GEN_TAC THEN INDUCT_TAC + THENL[REWRITE_TAC[is_inj_contour; is_contour] THEN ARITH_TAC; ALL_TAC] + THEN POP_ASSUM (fun th -> REWRITE_TAC[is_contour; is_inj_contour; th]) + THEN EQ_TAC + THENL[SIMP_TAC[] THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1" o CONJUNCT2) (LABEL_TAC "F2" o CONJUNCT2)) + THEN REPEAT GEN_TAC THEN REWRITE_TAC[CONJUNCT2 LE] + THEN STRIP_TAC + THENL[FIRST_X_ASSUM SUBST_ALL_TAC + THEN USE_THEN "F2" (fun th-> POP_ASSUM (fun th1-> REWRITE_TAC[MATCH_MP th (REWRITE_RULE[LT_SUC_LE] th1)])); ALL_TAC] + THEN REMOVE_THEN "F1" (fun th-> (POP_ASSUM (fun th2-> POP_ASSUM (fun th1-> REWRITE_TAC[MATCH_MP th (CONJ th1 th2)])))); ALL_TAC] + THEN SIMP_TAC[] + THEN DISCH_THEN (ASSUME_TAC o CONJUNCT2) + THEN STRIP_TAC + THENL[REPEAT GEN_TAC THEN STRIP_TAC + THEN FIRST_X_ASSUM (MP_TAC o SPECL[`i:num`; `j:num`]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ th (MATCH_MP LT_IMP_LE (SPEC `n:num` LT_PLUS)))]); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[LE_REFL; LT_SUC_LE] o SPEC `SUC n`) + THEN SIMP_TAC[]);; + +(* The theory of walkup in detail here with many trial facts *) + +let isolated_dart = new_definition `!(H:(A)hypermap) (x:A). isolated_dart H x <=> (edge_map H x = x /\ node_map H x = x /\ face_map H x = x)`;; + +let is_edge_degenerate = new_definition `is_edge_degenerate (H:(A)hypermap) (x:A) + <=> (edge_map H x = x) /\ ~(node_map H x = x) /\ ~(face_map H x = x)`;; + +let is_node_degenerate = new_definition `is_node_degenerate (H:(A)hypermap) (x:A) + <=> ~(edge_map H x = x) /\ (node_map H x = x) /\ ~(face_map H x = x)`;; + +let is_face_degenerate = new_definition `is_face_degenerate (H:(A)hypermap) (x:A) + <=> ~(edge_map H x = x) /\ ~(node_map H x = x) /\ (face_map H x = x)`;; + + +let degenerate_lemma = prove(`!(H:(A)hypermap) (x:A). dart_degenerate H x + <=> isolated_dart H x \/ is_edge_degenerate H x \/ is_node_degenerate H x \/ is_face_degenerate H x`, + +REPEAT GEN_TAC THEN STRIP_ASSUME_TAC (SPEC `H:(A)hypermap` hypermap_lemma) + THEN REWRITE_TAC[dart_degenerate;isolated_dart; is_edge_degenerate; is_node_degenerate; is_face_degenerate] + THEN POP_ASSUM (LABEL_TAC "F1") THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `e = edge_map (H:(A)hypermap)` + THEN ABBREV_TAC `n = node_map (H:(A)hypermap)` + THEN ABBREV_TAC `f = face_map (H:(A)hypermap)` + THEN MP_TAC(SPECL[`D:A->bool`; `e:A->A`;`n:A->A`;`f:A->A`] cyclic_maps) THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3")) THEN EQ_TAC + THENL[STRIP_TAC THENL [ASM_REWRITE_TAC[] THEN ASM_CASES_TAC `(n:A->A) (x:A) = x` + THENL[ASM_REWRITE_TAC[] THEN USE_THEN "F3" (fun th -> (MP_TAC(AP_THM th `x:A`))) + THEN ASM_REWRITE_TAC[o_THM;I_THM]; ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN USE_THEN "F2" (fun th -> (MP_TAC(AP_THM th `x:A`))) + THEN ASM_REWRITE_TAC[o_THM;I_THM]] ; ASM_REWRITE_TAC[] + THEN ASM_CASES_TAC `(e:A->A) (x:A) = x` + THENL[ ASM_REWRITE_TAC[] THEN USE_THEN "F3" (fun th -> (MP_TAC(AP_THM th `x:A`))) + THEN ASM_REWRITE_TAC[o_THM;I_THM]; ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN USE_THEN "F1" (fun th -> (MP_TAC(AP_THM th `x:A`))) THEN ASM_REWRITE_TAC[o_THM;I_THM]]; + ASM_REWRITE_TAC[] THEN ASM_CASES_TAC `(e:A->A) (x:A) = x` + THENL[ASM_REWRITE_TAC[] THEN USE_THEN "F2" (fun th -> (MP_TAC(AP_THM th `x:A`))) + THEN ASM_REWRITE_TAC[o_THM;I_THM]; ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + USE_THEN "F1" (fun th -> (MP_TAC(AP_THM th `x:A`))) THEN ASM_REWRITE_TAC[o_THM;I_THM]]]; + MESON_TAC[]]);; + +let lemma_category_darts = prove(`!(H:(A)hypermap) (x:A). dart_nondegenerate H x \/ dart_degenerate H x`, + REPEAT STRIP_TAC + THEN ASM_CASES_TAC `dart_degenerate (H:(A)hypermap) (x:A)` + THENL[ASM_REWRITE_TAC[]; ALL_TAC] + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[dart_degenerate; dart_nondegenerate] + THEN MESON_TAC[]);; + +(* Some trivial lemmas on PAIRS *) + +let lemma_pair_representation = prove(`!(S:((A->bool)#(A->A)#(A->A)#(A->A))). + S = (FST S, FST (SND S), FST(SND(SND S)), SND(SND(SND S)))`, + REWRITE_TAC[PAIR_SURJECTIVE]);; + +let lemma_pair_eq = prove(`!(S:((A->bool)#(A->A)#(A->A)#(A->A))) (U:((A->bool)#(A->A)#(A->A)#(A->A))). + ((FST S = FST U) /\ (FST (SND S) = FST (SND U)) /\ (FST(SND(SND S)) = FST(SND(SND U))) /\ (SND(SND(SND S))) = SND(SND(SND U))) ==>(S = U)`, + ASM_MESON_TAC[lemma_pair_representation]);; + +let lemma_hypermap_eq = prove(`!(H:(A)hypermap) (H':(A)hypermap). + H = H' <=> dart H = dart H' /\ edge_map H = edge_map H' /\ node_map H = node_map H' /\ face_map H = face_map H'`, + REPEAT GEN_TAC THEN EQ_TAC + THENL[ASM_MESON_TAC[hypermap_tybij; dart; edge_map; node_map; face_map]; ALL_TAC] + THEN ASM_REWRITE_TAC[hypermap_tybij; dart; edge_map; node_map; face_map] + THEN REPEAT STRIP_TAC + THEN SUBGOAL_THEN `tuple_hypermap (H:(A)hypermap) = tuple_hypermap (H':(A)hypermap)` ASSUME_TAC + THENL[ASM_MESON_TAC[lemma_pair_eq]; ASM_MESON_TAC[CONJUNCT1 hypermap_tybij]]);; + +let lemma_hypermap_rep = prove(`!(D:A->bool) (e:A->A) (n:A->A) (f:A->A). (FINITE D /\ e permutes D /\ n permutes D /\ f permutes D /\ (e o n o f = I)) ==> dart (hypermap (D,e,n,f)) = D /\ edge_map (hypermap (D,e,n,f)) = e /\ node_map (hypermap (D,e,n,f)) = n /\ face_map (hypermap (D,e,n,f)) = f`, + REPEAT GEN_TAC + THEN DISCH_TAC + THEN MP_TAC (SPEC `(D:A->bool, e:A->A, n:A->A, f:A->A)` (CONJUNCT2 hypermap_tybij)) + THEN ASM_REWRITE_TAC[dart; edge_map; node_map; face_map] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[]);; + +let shift = new_definition `shift (H:(A)hypermap) = hypermap(dart H, node_map H, face_map H, edge_map H)`;; + +let shift_lemma = prove(`!(H:(A)hypermap). dart H = dart (shift H) /\ edge_map H = face_map (shift H) /\ node_map H = edge_map (shift H) /\ face_map H = node_map (shift H)`, + GEN_TAC THEN REWRITE_TAC [shift] + THEN label_hypermap4_TAC `H:(A)hypermap` + THEN POP_ASSUM(fun th2->(POP_ASSUM(fun th1->(POP_ASSUM(fun th3->(POP_ASSUM(fun th->ASSUME_TAC(CONJ th (CONJ th1(CONJ th2 th3)))))))))) + THEN MP_TAC (CONJUNCT1 (SPEC `H:(A)hypermap` hypermap_cyclic)) + THEN POP_ASSUM(fun th->(DISCH_THEN(fun th1-> REWRITE_TAC[MATCH_MP lemma_hypermap_rep (REWRITE_RULE[GSYM CONJ_ASSOC](CONJ th th1))]))));; + +let double_shift_lemma = prove( `!(H:(A)hypermap). dart H = dart (shift(shift H)) /\ edge_map H = node_map (shift(shift H)) /\ node_map H = face_map (shift(shift H)) /\ face_map H = edge_map (shift (shift H))`, + GEN_TAC THEN STRIP_ASSUME_TAC(SPEC `shift(H:(A)hypermap)` shift_lemma) + THEN STRIP_ASSUME_TAC(SPEC `H:(A)hypermap` shift_lemma) THEN ASM_REWRITE_TAC[]);; + +(* the definition of walkups *) + +let edge_walkup = new_definition `edge_walkup (H:(A)hypermap) (x:A) = hypermap((dart H) DELETE x,inverse(swap(x, face_map H x) o face_map H) o inverse(swap(x, node_map H x) o node_map H) , swap(x, node_map H x) o node_map H, swap(x, face_map H x) o face_map H)`;; + +let node_walkup = new_definition `node_walkup (H:(A)hypermap) (x:A) = shift(shift(edge_walkup (shift H) x))`;; + +let face_walkup = new_definition `face_walkup (H:(A)hypermap) (x:A) = shift(edge_walkup (shift (shift H)) x)`;; + +let double_edge_walkup = new_definition `double_edge_walkup (H:(A)hypermap) (x:A) (y:A) = edge_walkup (edge_walkup H x) y`;; + +let double_node_walkup = new_definition `double_node_walkup (H:(A)hypermap) (x:A) (y:A) = node_walkup (node_walkup H x) y`;; + +let double_face_walkup = new_definition `double_face_walkup (H:(A)hypermap) (x:A) (y:A) = face_walkup (face_walkup H x) y`;; + +let walkup_permutes = prove(`!(D:A->bool) (p:A->A) (x:A). FINITE D /\p permutes D ==> (swap(x, p x) o p) permutes (D DELETE x)`, + REPEAT STRIP_TAC THEN UNDISCH_THEN `FINITE (D:A->bool)` (fun th -> ASSUME_TAC th THEN MP_TAC(SPEC `x:A` (MATCH_MP FINITE_DELETE_IMP th))) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN ASM_CASES_TAC `x:A IN (D:A->bool)` + THENL[MP_TAC (SET_RULE `(x:A) IN (D:A->bool) ==> (D = x INSERT (D DELETE x))`) + THEN ASM_REWRITE_TAC[] THEN ABBREV_TAC `S = (D:A->bool) DELETE (x:A)` + THEN DISCH_THEN SUBST_ALL_TAC THEN MP_TAC(ISPECL[`p:A->A`;`x:A`;`(S:A->bool)`] PERMUTES_INSERT_LEMMA) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN MP_TAC (SET_RULE `~((x:A) IN (D:A->bool)) ==> D DELETE x = D`) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN SUBST_ALL_TAC + THEN UNDISCH_THEN `p:A->A permutes (D:A->bool)` (fun th -> ASSUME_TAC th THEN MP_TAC th) + THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV) [permutes] + THEN DISCH_THEN (MP_TAC o SPEC `x:A` o CONJUNCT1) THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th -> ASM_REWRITE_TAC[th; SWAP_REFL; I_O_ID]));; + +let PERMUTES_COMPOSITION = prove(`!p q s. p permutes s /\ q permutes s ==> (q o p) permutes s`, + REWRITE_TAC[permutes; o_THM] THEN MESON_TAC[]);; + +let lemma_edge_walkup = prove(`!(H:(A)hypermap) (x:A). dart (edge_walkup H x) = dart H DELETE x /\ edge_map (edge_walkup H x) = inverse(swap(x, face_map H x) o face_map H) o inverse(swap(x, node_map H x) o node_map H) /\ node_map (edge_walkup H x) = swap(x, node_map H x) o node_map H /\ face_map (edge_walkup H x) = swap(x, face_map H x) o face_map H`, + REPEAT GEN_TAC THEN REWRITE_TAC[edge_walkup] + THEN label_hypermap_TAC `H:(A)hypermap` + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `e = edge_map (H:(A)hypermap)` + THEN ABBREV_TAC `n = node_map (H:(A)hypermap)` + THEN ABBREV_TAC `f = face_map (H:(A)hypermap)` + THEN ABBREV_TAC `n' = swap(x:A, (n:A->A) x) o n` + THEN ABBREV_TAC `f' = swap(x:A, (f:A->A) x) o f` + THEN ABBREV_TAC `D' = (D:A->bool) DELETE (x:A)` + THEN MP_TAC(ISPECL[`D:A->bool`;`n:A->A`; `x:A`] walkup_permutes) + THEN ASM_REWRITE_TAC[] THEN MP_TAC(ISPECL[`D:A->bool`;`f:A->A`; `x:A`] walkup_permutes) + THEN ASM_REWRITE_TAC[] + THEN REPLICATE_TAC 2 STRIP_TAC + THEN ABBREV_TAC `e' = inverse (f':A->A) o inverse (n':A->A)` + THEN SUBGOAL_THEN `(e':A->A) permutes (D':A->bool)` MP_TAC + THENL[UNDISCH_THEN `(n':A->A) permutes (D':A->bool)` (MP_TAC o MATCH_MP PERMUTES_INVERSE) + THEN UNDISCH_THEN `(f':A->A) permutes (D':A->bool)` (MP_TAC o MATCH_MP PERMUTES_INVERSE) + THEN REPEAT STRIP_TAC THEN MP_TAC (ISPECL[`inverse(n':A->A)`; `inverse(f':A->A)`; `D':A->bool`] + PERMUTES_COMPOSITION) THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN STRIP_TAC THEN SUBGOAL_THEN `(e':A->A) o (n':A->A) o (f':A->A) = I` ASSUME_TAC + THENL[MP_TAC ((ISPECL[`n':A->A`; `D':A->bool`] PERMUTES_INVERSES_o)) + THEN ASM_REWRITE_TAC[] THEN MP_TAC ((ISPECL[`f':A->A`; `D':A->bool`] PERMUTES_INVERSES_o)) + THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN EXPAND_TAC "e'" + THEN REWRITE_TAC[GSYM o_ASSOC] THEN REWRITE_TAC[lemma_4functions] + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN ASM_REWRITE_TAC[I_O_ID]; ALL_TAC] + THEN MP_TAC (SPECL[`D':A->bool`; `e':A->A`; `n':A->A`; `f':A->A`] lemma_hypermap_rep) + THEN MP_TAC (ISPECL[`D:A->bool`; `x:A`] FINITE_DELETE_IMP) + THEN ASM_SIMP_TAC[]);; + +let node_map_walkup = prove(`!(H:(A)hypermap) (x:A) (y:A). node_map (edge_walkup H x) x = x /\ node_map (edge_walkup H x) (inverse (node_map H) x) = node_map H x /\ (~(y = x) /\ ~(y = inverse (node_map H) x) ==> node_map (edge_walkup H x) y = node_map H y)`, + REPEAT GEN_TAC THEN LABEL_TAC "F1" (CONJUNCT1 (CONJUNCT2(CONJUNCT2(SPEC `H:(A)hypermap` hypermap_lemma)))) + THEN REWRITE_TAC[CONJUNCT1 (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`] lemma_edge_walkup)))] + THEN REWRITE_TAC[o_THM] THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `n = node_map (H:(A)hypermap)` THEN STRIP_TAC + THENL[ABBREV_TAC `z = (n:A->A) (x:A)` THEN REWRITE_TAC[swap] THEN ASM_CASES_TAC `z:A = x:A` THENL[ASM_MESON_TAC[]; ASM_MESON_TAC[]]; ALL_TAC] + THEN STRIP_TAC + THENL[SUBGOAL_THEN `(n:A->A)(inverse(n) (x:A)) = x` (fun th-> REWRITE_TAC[th]) + THENL[GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [GSYM o_THM] + THEN REMOVE_THEN "F1" (ASSUME_TAC o CONJUNCT1 o MATCH_MP PERMUTES_INVERSES_o) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th; I_THM]); MESON_TAC[swap]];ALL_TAC] + THEN STRIP_TAC THEN REWRITE_TAC[o_THM] THEN SUBGOAL_THEN `~((n:A->A) (y:A) = n (x:A))` MP_TAC + THENL[USE_THEN "F1"(MP_TAC o SPECL[`y:A`;`x:A`] o MATCH_MP PERMUTES_INJECTIVE) THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN STRIP_TAC THEN SUBGOAL_THEN `~((n:A->A) (y:A) = (x:A))` ASSUME_TAC + THENL[STRIP_TAC THEN POP_ASSUM(fun th1 -> (USE_THEN "F1"(fun th2 -> MP_TAC(MATCH_MP inverse_function (CONJ th2 th1))))) THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN ASM_MESON_TAC[swap]);; + +let face_map_walkup = prove(`!(H:(A)hypermap) (x:A) (y:A). face_map (edge_walkup H x) x = x /\ face_map (edge_walkup H x) (inverse (face_map H) x) = face_map H x /\ (~(y = x) /\ ~(y = inverse (face_map H) x) ==> face_map (edge_walkup H x) y = face_map H y)`, + REPEAT GEN_TAC THEN LABEL_TAC "F1" (CONJUNCT1 (CONJUNCT2(CONJUNCT2(CONJUNCT2(SPEC `H:(A)hypermap` hypermap_lemma))))) + THEN REWRITE_TAC[CONJUNCT2(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`] lemma_edge_walkup)))] + THEN REWRITE_TAC[o_THM] THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `f = face_map (H:(A)hypermap)` THEN STRIP_TAC + THENL[ABBREV_TAC `z = (n:A->A) (x:A)` THEN REWRITE_TAC[swap] THEN ASM_CASES_TAC `z:A = x:A` THENL[ASM_MESON_TAC[]; ASM_MESON_TAC[]]; ALL_TAC] + THEN STRIP_TAC + THENL[SUBGOAL_THEN `(f:A->A)(inverse(f) (x:A)) = x` (fun th-> REWRITE_TAC[th]) + THENL[GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [GSYM o_THM] + THEN REMOVE_THEN "F1" (ASSUME_TAC o CONJUNCT1 o MATCH_MP PERMUTES_INVERSES_o) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th; I_THM]); MESON_TAC[swap]];ALL_TAC] + THEN STRIP_TAC THEN REWRITE_TAC[o_THM] THEN SUBGOAL_THEN `~((f:A->A) (y:A) = f (x:A))` MP_TAC + THENL[USE_THEN "F1"(MP_TAC o SPECL[`y:A`;`x:A`] o MATCH_MP PERMUTES_INJECTIVE) THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN STRIP_TAC THEN SUBGOAL_THEN `~((f:A->A) (y:A) = (x:A))` ASSUME_TAC + THENL[STRIP_TAC THEN POP_ASSUM(fun th1 -> (USE_THEN "F1"(fun th2 -> MP_TAC(MATCH_MP inverse_function (CONJ th2 th1))))) THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN ASM_MESON_TAC[swap]);; + +let lemma_edge_degenerate = prove(`!(H:(A)hypermap) (x:A). (edge_map H x = x) <=> (face_map H x = (inverse (node_map H)) x)`, + REPEAT STRIP_TAC THEN label_hypermap_TAC `H:(A)hypermap` + THEN MP_TAC(AP_THM (SYM (CONJUNCT1(CONJUNCT2(SPEC `H:(A)hypermap` inverse_hypermap_maps)))) `x:A`) + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `e = edge_map (H:(A)hypermap)` + THEN ABBREV_TAC `n = node_map (H:(A)hypermap)` + THEN ABBREV_TAC `f = face_map (H:(A)hypermap)` + THEN REWRITE_TAC[o_THM] THEN DISCH_THEN (LABEL_TAC "F1") THEN EQ_TAC + THENL[DISCH_TAC THEN REMOVE_THEN "F1" MP_TAC THEN ASM_REWRITE_TAC[o_THM]; ALL_TAC] + THEN DISCH_THEN (fun th1 -> (USE_THEN "F1" (fun th2 -> (MP_TAC (MATCH_MP EQ_TRANS (CONJ th2 (SYM th1)) ))))) + THEN DISCH_TAC THEN USE_THEN "H4" (MP_TAC o ISPECL[`(e:A->A) (x:A)`; `x:A`] o MATCH_MP PERMUTES_INJECTIVE) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]));; + +let lemma_node_degenerate = prove(`!(H:(A)hypermap) (x:A). (node_map H x = x) <=> (edge_map H x = (inverse (face_map H)) x)`, + REPEAT STRIP_TAC THEN label_hypermap_TAC `H:(A)hypermap` + THEN MP_TAC(AP_THM (SYM (CONJUNCT2(CONJUNCT2(SPEC `H:(A)hypermap` inverse_hypermap_maps)))) `x:A`) + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `e = edge_map (H:(A)hypermap)` + THEN ABBREV_TAC `n = node_map (H:(A)hypermap)` + THEN ABBREV_TAC `f = face_map (H:(A)hypermap)` + THEN REWRITE_TAC[o_THM] THEN DISCH_THEN (LABEL_TAC "F1") THEN EQ_TAC + THENL[DISCH_TAC THEN REMOVE_THEN "F1" MP_TAC THEN ASM_REWRITE_TAC[o_THM]; ALL_TAC] + THEN DISCH_THEN (fun th1 -> (USE_THEN "F1" (fun th2 -> (MP_TAC (MATCH_MP EQ_TRANS (CONJ th2 (SYM th1)) ))))) + THEN DISCH_TAC THEN USE_THEN "H2" (MP_TAC o ISPECL[`(n:A->A) (x:A)`; `x:A`] o MATCH_MP PERMUTES_INJECTIVE) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]));; + +let lemma_face_degenerate = prove(`!(H:(A)hypermap) (x:A). (face_map H x = x) <=> (node_map H x = (inverse (edge_map H)) x)`, + REPEAT STRIP_TAC THEN label_hypermap_TAC `H:(A)hypermap` + THEN MP_TAC(AP_THM (SYM (CONJUNCT1(SPEC `H:(A)hypermap` inverse_hypermap_maps))) `x:A`) + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `e = edge_map (H:(A)hypermap)` + THEN ABBREV_TAC `n = node_map (H:(A)hypermap)` + THEN ABBREV_TAC `f = face_map (H:(A)hypermap)` + THEN REWRITE_TAC[o_THM] THEN DISCH_THEN (LABEL_TAC "F1") THEN EQ_TAC + THENL[DISCH_TAC THEN REMOVE_THEN "F1" MP_TAC THEN ASM_REWRITE_TAC[o_THM]; ALL_TAC] + THEN DISCH_THEN (fun th1 -> (USE_THEN "F1" (fun th2 -> (MP_TAC (MATCH_MP EQ_TRANS (CONJ th2 (SYM th1)) ))))) + THEN DISCH_TAC THEN USE_THEN "H3" (MP_TAC o ISPECL[`(f:A->A) (x:A)`; `x:A`] o MATCH_MP PERMUTES_INJECTIVE) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]));; + +let fixed_point_lemma = prove(`!(D:A->bool) (p:A->A). p permutes D ==> (!(x:A). p x = x <=> inverse p x = x)`, + REPEAT STRIP_TAC THEN EQ_TAC + THENL[POP_ASSUM (fun th1 -> (DISCH_THEN(fun th2 -> (MP_TAC(MATCH_MP inverse_function (CONJ th1 th2)))))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[SYM th]); ALL_TAC] + THEN DISCH_THEN (MP_TAC o AP_TERM `p:A->A`) + THEN GEN_REWRITE_TAC (LAND_CONV o LAND_CONV) [GSYM o_THM] + THEN (POP_ASSUM (ASSUME_TAC o CONJUNCT1 o MATCH_MP PERMUTES_INVERSES_o)) + THEN ASM_REWRITE_TAC[I_THM] THEN DISCH_THEN (fun th-> REWRITE_TAC[SYM th]));; + +let non_fixed_point_lemma = prove(`!(s:A->bool) (p:A->A). p permutes s ==> (!(x:A). ~(p x = x) <=> ~(inverse p x = x))`, + REPEAT STRIP_TAC THEN REWRITE_TAC[TAUT `(~p <=> ~q) <=> (p <=> q)`] + THEN ASM_MESON_TAC[fixed_point_lemma]);; + +let lemma_inverse_maps_at_nondegenerate_dart = prove(`!(H:(A)hypermap) (x:A). dart_nondegenerate H x ==> ~((inverse (edge_map H) x) = x) /\ ~((inverse (node_map H) x) = x) /\ ~((inverse (face_map H) x) = x)`, + REPEAT GEN_TAC THEN REWRITE_TAC[dart_nondegenerate] + THEN MESON_TAC[hypermap_lemma; non_fixed_point_lemma]);; + +let aux_permutes_conversion = prove(`!(D:A->bool) (p:A->A) (q:A->A) (x:A) (y:A). (p permutes D) /\ (q permutes D) + ==> ((inverse p)((inverse q) x) = y <=> q ( p y) = x)`, + REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN USE_THEN "F1" (MP_TAC o ISPECL[`y:A`; `inverse(q:A->A) (x:A)`] o MATCH_MP PERMUTES_INVERSE_EQ) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F2" (MP_TAC o ISPECL[`(p:A->A) (y:A)`; `(x:A)`] o MATCH_MP PERMUTES_INVERSE_EQ) + THEN MESON_TAC[]);; + +let edge_map_walkup = prove(`!(H:(A)hypermap) (x:A) (y:A). edge_map (edge_walkup H x) x = x /\ ( ~(node_map H x = x) /\ ~(edge_map H x = x) ==> edge_map (edge_walkup H x) (node_map H x) = edge_map H x) /\ (~(inverse (face_map H) x = x) /\ ~(inverse(edge_map H) x = x) ==> edge_map (edge_walkup H x) (inverse(edge_map H) x) = inverse(face_map H) x) /\ (~(y = x) /\ ~(y = (inverse (edge_map H)) x) /\ ~(y = (node_map H) x) ==> (edge_map (edge_walkup H x)) y = edge_map H y)`, + REPEAT GEN_TAC THEN label_hypermap_TAC `H:(A)hypermap` THEN label_hypermapG_TAC `(edge_walkup (H:(A)hypermap) (x:A))` + THEN LABEL_TAC "A1" (SPECL[`H:(A)hypermap`;`x:A`] node_map_walkup) THEN LABEL_TAC "A2" (SPECL[`H:(A)hypermap`;`x:A`] face_map_walkup) + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `e = edge_map (H:(A)hypermap)` + THEN ABBREV_TAC `n = node_map (H:(A)hypermap)` + THEN ABBREV_TAC `f = face_map (H:(A)hypermap)` + THEN ABBREV_TAC `G = edge_walkup (H:(A)hypermap) (x:A)` + THEN ABBREV_TAC `D' = dart (G:(A)hypermap)` + THEN ABBREV_TAC `e' = edge_map (G:(A)hypermap)` + THEN ABBREV_TAC `n' = node_map (G:(A)hypermap)` + THEN ABBREV_TAC `f' = face_map (G:(A)hypermap)` + THEN MP_TAC(CONJUNCT1 (SPEC `G:(A)hypermap` inverse2_hypermap_maps)) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN SUBST_ALL_TAC THEN REWRITE_TAC[o_THM] + THEN STRIP_TAC + THENL[REMOVE_THEN "A1" (MP_TAC o CONJUNCT1 o SPEC `y:A`) + THEN DISCH_THEN (fun th -> (USE_THEN "G3" (fun th1 ->MP_TAC (MATCH_MP inverse_function (CONJ th1 th))))) + THEN DISCH_THEN (SUBST1_TAC o SYM) THEN REMOVE_THEN "A2" (MP_TAC o CONJUNCT1 o SPEC `y:A`) + THEN DISCH_THEN (fun th -> (USE_THEN "G4" (fun th1 ->MP_TAC (MATCH_MP inverse_function (CONJ th1 th))))) + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]); ALL_TAC] + THEN STRIP_TAC + THENL[MP_TAC (SPECL[`D':A->bool`; `f':A->A`; `n':A->A`; `(n:A->A) (x:A)`; `(e:A->A) (x:A)`] aux_permutes_conversion) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN STRIP_TAC + THEN SUBGOAL_THEN `~((e:A->A) (x:A) = inverse (f:A->A) x)` ASSUME_TAC + THENL[UNDISCH_THEN `~((n:A->A) (x:A) = x)` (MP_TAC o GSYM) + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "H2" (MP_TAC o SYM o SPECL[`x:A`; `inverse(f:A->A) x:A`] o MATCH_MP PERMUTES_INVERSE_EQ) + THEN DISCH_THEN(fun th -> REWRITE_TAC[th]) + THEN GEN_REWRITE_TAC (LAND_CONV o LAND_CONV) [GSYM o_THM] + THEN MP_TAC (CONJUNCT1(CONJUNCT2(SPECL[`H:(A)hypermap`] inverse2_hypermap_maps))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) + THEN DISCH_THEN (fun th -> MP_TAC (SYM th)) THEN SIMP_TAC[]; ALL_TAC] + THEN REMOVE_THEN "A2" (MP_TAC o CONJUNCT2 o CONJUNCT2 o SPEC `(e:A->A) (x:A)`) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN MP_TAC(CONJUNCT1(CONJUNCT2(SPEC `H:(A)hypermap` inverse_hypermap_maps))) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(fun th -> MP_TAC(SYM(AP_THM th `x:A`))) + THEN REWRITE_TAC[o_THM] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN REMOVE_THEN "A1" (MP_TAC o CONJUNCT1 o CONJUNCT2 o SPEC `x:A`) THEN REWRITE_TAC[]; ALL_TAC] + THEN STRIP_TAC + THENL[STRIP_TAC THEN MP_TAC (SPECL[`D':A->bool`; `f':A->A`; `n':A->A`; `inverse (e:A->A) (x:A)`; `inverse(f:A->A) (x:A)`] aux_permutes_conversion) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN SUBGOAL_THEN `~((f:A->A) (x:A) = inverse (n:A->A) x)` ASSUME_TAC + THENL[POP_ASSUM MP_TAC THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "H4" (MP_TAC o SYM o SPECL[`x:A`; `inverse(n:A->A) x:A`] o MATCH_MP PERMUTES_INVERSE_EQ) + THEN DISCH_THEN(fun th -> REWRITE_TAC[th]) + THEN GEN_REWRITE_TAC (LAND_CONV o LAND_CONV) [GSYM o_THM] + THEN MP_TAC (CONJUNCT1(SPECL[`H:(A)hypermap`] inverse2_hypermap_maps)) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) + THEN STRIP_TAC THEN USE_THEN "H2" (MP_TAC o SPEC `x:A` o MATCH_MP fixed_point_lemma) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `~((f:A->A) (x:A) = x)` ASSUME_TAC + THENL[UNDISCH_TAC `~(inverse (f:A->A) (x:A) = x)` + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN STRIP_TAC THEN USE_THEN "H4" (MP_TAC o SPEC `x:A` o MATCH_MP fixed_point_lemma) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN REMOVE_THEN "A1" (MP_TAC o CONJUNCT2 o CONJUNCT2 o SPEC `(f:A->A) (x:A)`) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN GEN_REWRITE_TAC (LAND_CONV) [GSYM o_THM] + THEN MP_TAC(CONJUNCT1(SPEC `H:(A)hypermap` inverse_hypermap_maps)) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(fun th -> REWRITE_TAC[SYM th]); ALL_TAC] + THEN STRIP_TAC THEN MP_TAC (ISPECL[`D':A->bool`; `f':A->A`; `n':A->A`; `y:A`; `(e:A->A) (y:A)`] aux_permutes_conversion) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN SUBGOAL_THEN `~((e:A->A) (y:A) = (inverse (f:A->A)) (x:A))` ASSUME_TAC + THENL[STRIP_TAC THEN UNDISCH_THEN `~((y:A) = (n:A->A) (x:A))` MP_TAC THEN REWRITE_TAC[] + THEN POP_ASSUM (MP_TAC o AP_TERM `inverse (e:A->A)`) + THEN GEN_REWRITE_TAC (LAND_CONV o LAND_CONV) [GSYM o_THM] + THEN USE_THEN "H2" (MP_TAC o CONJUNCT2 o MATCH_MP PERMUTES_INVERSES_o) + THEN DISCH_THEN (fun th-> REWRITE_TAC[th; I_THM]) + THEN GEN_REWRITE_TAC (LAND_CONV o RAND_CONV) [GSYM o_THM] + THEN MP_TAC (CONJUNCT1(CONJUNCT2(SPEC `H:(A)hypermap` inverse2_hypermap_maps))) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]); ALL_TAC] + THEN SUBGOAL_THEN `~((e:A->A) (y:A) = (x:A))` ASSUME_TAC + THENL[UNDISCH_TAC `~(y:A = inverse (e:A->A) (x:A))` + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN (fun th -> (USE_THEN "H2" (fun th1 -> (MP_TAC (MATCH_MP inverse_function (CONJ th1 th)))))) + THEN REWRITE_TAC[]; ALL_TAC] + THEN REMOVE_THEN "A2" (MP_TAC o CONJUNCT2 o CONJUNCT2 o SPEC `(e:A->A) (y:A)`) + THEN ASM_REWRITE_TAC[] THEN GEN_REWRITE_TAC (LAND_CONV o RAND_CONV) [GSYM o_THM] + THEN MP_TAC(CONJUNCT1(CONJUNCT2(SPEC `H:(A)hypermap` inverse_hypermap_maps))) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) + THEN SUBGOAL_THEN `~(inverse (n:A->A) (y:A) = inverse (n:A->A) (x:A))` ASSUME_TAC + THENL[UNDISCH_TAC `~(y:A = x:A)` THEN REWRITE_TAC[CONTRAPOS_THM] THEN USE_THEN "H3" (MP_TAC o MATCH_MP PERMUTES_INVERSE) + THEN DISCH_THEN (MP_TAC o ISPECL[`y:A`; `x:A`] o MATCH_MP PERMUTES_INJECTIVE) + THEN MESON_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `~(inverse (n:A->A) (y:A) = x:A)` ASSUME_TAC + THENL[UNDISCH_TAC `~(y:A = (n:A->A) (x:A))` + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN (MP_TAC o AP_TERM `n:A->A`) + THEN GEN_REWRITE_TAC (LAND_CONV o LAND_CONV) [GSYM o_THM] + THEN USE_THEN "H3" (MP_TAC o CONJUNCT1 o MATCH_MP PERMUTES_INVERSES_o) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th; I_THM]); ALL_TAC] + THEN DISCH_TAC THEN REMOVE_THEN "A1" (MP_TAC o CONJUNCT2 o CONJUNCT2 o SPEC `(inverse (n:A->A)) (y:A)`) + THEN ASM_REWRITE_TAC[] THEN GEN_REWRITE_TAC (LAND_CONV o RAND_CONV) [GSYM o_THM] + THEN USE_THEN "H3" (MP_TAC o CONJUNCT1 o MATCH_MP PERMUTES_INVERSES_o) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th; I_THM]));; + +(* About orbits of permutations *) + +let power_list = new_definition `!p:A->A x:A. power_list p x = (\i:num. (p POWER i) x)`;; + +let inj_orbit = new_recursive_definition num_RECURSION + `(inj_orbit (p:A->A) (x:A) 0 <=> T) /\ (inj_orbit (p:A->A) (x:A) (SUC n) + <=> (inj_orbit p x n) /\ (!j:num. j <= n ==> ~((p POWER (SUC n)) x = (p POWER j) x)))`;; + +let lemma_inj_orbit_via_list = prove(`!p:A->A x:A n:num. inj_orbit p x n <=> is_inj_list (power_list p x) n`, + REPLICATE_TAC 2 GEN_TAC THEN INDUCT_TAC + THENL[REWRITE_TAC[inj_orbit; is_inj_list]; ALL_TAC] + THEN REWRITE_TAC[inj_orbit; is_inj_list] + THEN POP_ASSUM (fun th-> REWRITE_TAC[GSYM th; power_list]) + THEN MESON_TAC[EQ_SYM]);; + +let lemma_def_inj_orbit = prove(`!(p:A->A) (x:A) (n:num). (inj_orbit p x n + <=> (!i:num j:num. i <= n /\ j < i ==> ~((p POWER i) x = (p POWER j) x)))`, + REWRITE_TAC[lemma_inj_orbit_via_list; lemma_inj_list; power_list] + THEN MESON_TAC[EQ_SYM]);; + +let lemma_inj_orbit = prove(`!p:A->A x:A n:num. inj_orbit p x n <=> (!i:num j:num. i <= n /\ j <= n /\ (p POWER i) x = (p POWER j) x ==> i = j)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_inj_orbit_via_list; lemma_inj_list2; power_list]);; + +let lemma_sub_inj_orbit = prove(`!(p:A->A) x:A n:num. inj_orbit p x n ==> !m:num. m <= n ==> inj_orbit p x m`, + REWRITE_TAC[lemma_inj_orbit_via_list; lemma_sub_list]);; + +let inj_orbit_step = prove(`!(s:A->bool) (p:A->A) (x:A) (n:num). (p permutes s) /\ (inj_orbit p x n) /\ ~((p POWER (SUC n:num)) x = x) + ==> (inj_orbit p x (SUC n))`, + REPEAT STRIP_TAC + THEN REWRITE_TAC[inj_orbit] THEN ASM_REWRITE_TAC[] + THEN REPLICATE_TAC 2 STRIP_TAC THEN FIRST_X_ASSUM (MP_TAC o check(is_neg o concl)) + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN ASM_CASES_TAC `j:num = 0` + THENL[POP_ASSUM SUBST1_TAC THEN REWRITE_TAC[POWER_0; I_THM]; ALL_TAC] + THEN UNDISCH_TAC `j:num <= n:num` THEN REWRITE_TAC[GSYM LT_SUC_LE] + THEN REWRITE_TAC[LT_EXISTS] THEN DISCH_THEN(X_CHOOSE_THEN `d:num` (LABEL_TAC "G")) + THEN USE_THEN "G" SUBST1_TAC + THEN UNDISCH_THEN `(p:A->A) permutes (s:A->bool)` (fun th1 -> (DISCH_THEN (fun th2 -> (MP_TAC ( MATCH_MP elim_power_function (CONJ th1 th2)))))) + THEN MP_TAC(ARITH_RULE `~(j = 0) /\ SUC (n:num) = j + SUC (d:num) ==> SUC d <= n`) + THEN ASM_REWRITE_TAC[] + THEN REPEAT STRIP_TAC + THEN MP_TAC(SPECL[`p:A->A`; `x:A`; `n:num`] lemma_def_inj_orbit) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (MP_TAC o SPECL[`SUC (d:num)`; `0`]) + THEN ASM_REWRITE_TAC[LT_NZ; POWER_0; ARITH; I_THM] THEN ARITH_TAC);; + +let lemma_subset_orbit = prove(`!(p:A->A) x:A n:num. {(p POWER (i:num)) x | i <= n} SUBSET orbit_map p x`, + REPEAT STRIP_TAC THEN REWRITE_TAC[SUBSET] THEN GEN_TAC + THEN REWRITE_TAC[orbit_map; IN_ELIM_THM] THEN STRIP_TAC + THEN EXISTS_TAC `i:num` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC);; + +let lemma_segment_orbit = prove(`!(s:A->bool) (p:A->A) (x:A). FINITE s /\ p permutes s ==> (!m:num. m < CARD(orbit_map p x) ==> inj_orbit p x m)`, + REPLICATE_TAC 4 STRIP_TAC THEN INDUCT_TAC + THENL[REWRITE_TAC[inj_orbit]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F1") THEN DISCH_THEN (LABEL_TAC "F2") + THEN MP_TAC (ARITH_RULE `SUC (m:num) < CARD (orbit_map (p:A->A) (x:A)) ==> m < CARD (orbit_map p x)`) + THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN REMOVE_THEN "F1" MP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN STRIP_TAC + THEN MATCH_MP_TAC inj_orbit_step + THEN EXISTS_TAC `s:A->bool` THEN ASM_REWRITE_TAC[] THEN STRIP_TAC + THEN MP_TAC(SPECL[`p:A->A`; `SUC (m:num)`; `x:A`] card_orbit_le) + THEN ASM_REWRITE_TAC[ARITH_RULE `~(SUC(d:num) = 0)`] + THEN REMOVE_THEN "F2" MP_TAC THEN ARITH_TAC);; + +let lemma_cycle_orbit = prove(`!(s:A->bool) (p:A->A) (x:A). FINITE s /\ p permutes s ==> (p POWER (CARD(orbit_map p x))) x = x`, + REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN MP_TAC (SPECL[`p:A->A`; `x:A`] orbit_reflect) + THEN ABBREV_TAC `m = PRE (CARD (orbit_map (p:A->A) (x:A)))` + THEN POP_ASSUM (LABEL_TAC "F3") + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (MP_TAC o SPEC `x:A` o MATCH_MP lemma_orbit_finite o CONJ th)) + THEN REWRITE_TAC[IMP_IMP] THEN DISCH_THEN (MP_TAC o MATCH_MP CARD_ATLEAST_1) + THEN DISCH_THEN (MP_TAC o SYM o MATCH_MP LE_SUC_PRE) + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "F3") + THEN ASM_CASES_TAC `~(((p:A->A) POWER (SUC m)) (x:A) = x)` + THENL[POP_ASSUM MP_TAC + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (MP_TAC o SPECL[`x:A`; `m:num`] o MATCH_MP lemma_segment_orbit o CONJ th)) + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[th; LT_PLUS]) + THEN USE_THEN "F2" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP inj_orbit_step) + THEN REWRITE_TAC[lemma_inj_orbit_via_list] + THEN DISCH_THEN (MP_TAC o REWRITE_RULE[support_list; power_list] o MATCH_MP lemma_size_list) + THEN DISCH_TAC + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (MP_TAC o SPEC `x:A` o MATCH_MP lemma_orbit_finite o CONJ th)) + THEN MP_TAC (SPECL[`p:A->A`; `x:A`; `SUC m`] lemma_subset_orbit) THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (MP_TAC o MATCH_MP CARD_SUBSET) + THEN POP_ASSUM SUBST1_TAC THEN POP_ASSUM SUBST1_TAC THEN ARITH_TAC; ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[]) THEN POP_ASSUM SUBST1_TAC THEN SIMP_TAC[]);; + +let lemma_index_on_orbit = prove(`!s:A->bool p:A->A x:A y:A. FINITE s /\ p permutes s /\ y IN orbit_map p x + ==> ?n:num. n < CARD (orbit_map p x) /\ y = (p POWER n) x`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1-> LABEL_TAC "FC" (CONJ th th1))) + THEN MP_TAC (SPECL[`p:A->A`; `x:A`] orbit_reflect) + THEN USE_THEN "FC" (MP_TAC o SPEC `x:A` o MATCH_MP lemma_orbit_finite) + THEN REWRITE_TAC[IMP_IMP] THEN DISCH_THEN (MP_TAC o REWRITE_RULE[LT1_NZ; LT_NZ] o MATCH_MP CARD_ATLEAST_1) + THEN USE_THEN "FC"(fun th->DISCH_THEN(fun th1-> (ASSUME_TAC(MATCH_MP orbit_cyclic (CONJ th1 (SPEC `x:A` (MATCH_MP lemma_cycle_orbit th))))))) + THEN USE_THEN "F3" (MP_TAC) THEN POP_ASSUM (fun th-> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN REWRITE_TAC[IN_ELIM_THM]);; + +let lemma_congruence_on_orbit = prove(`!s:A->bool p:A->A x:A n:num m:num. FINITE s /\ p permutes s /\ n < CARD (orbit_map p x) /\ (p POWER n) x = (p POWER m) x ==> ?q:num. m = q * CARD (orbit_map p x) + n`, + REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1")(CONJUNCTS_THEN2 (LABEL_TAC "F2")(CONJUNCTS_THEN2 (LABEL_TAC "F3")(LABEL_TAC "F4")))) + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1-> LABEL_TAC "FC" (CONJ th th1))) + THEN MP_TAC (SPECL[`p:A->A`; `x:A`] orbit_reflect) + THEN USE_THEN "FC" (MP_TAC o SPEC `x:A` o MATCH_MP lemma_orbit_finite) + THEN REWRITE_TAC[IMP_IMP] THEN DISCH_THEN (LABEL_TAC "F5" o MATCH_MP CARD_ATLEAST_1) + THEN USE_THEN "F5" (MP_TAC o REWRITE_RULE[LT1_NZ; LT_NZ]) + THEN DISCH_THEN (MP_TAC o SPEC `m:num` o MATCH_MP DIVMOD_EXIST) + THEN DISCH_THEN (X_CHOOSE_THEN `q:num` (X_CHOOSE_THEN `r:num` (CONJUNCTS_THEN2 SUBST_ALL_TAC (LABEL_TAC "F6")))) + THEN EXISTS_TAC `q:num` THEN REWRITE_TAC[EQ_ADD_LCANCEL] + THEN USE_THEN "F4" (MP_TAC o ONCE_REWRITE_RULE[ADD_SYM]) + THEN REWRITE_TAC[lemma_add_exponent_function] + THEN USE_THEN "FC" (MP_TAC o SPEC `x:A` o MATCH_MP lemma_cycle_orbit) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP power_map_fix_point th]) + THEN DISCH_TAC + THEN USE_THEN "FC" (MP_TAC o REWRITE_RULE[GSYM LE_SUC_LT] o SPECL[`x:A`; `PRE (CARD (orbit_map (p:A->A) (x:A)))`] o MATCH_MP lemma_segment_orbit) + THEN USE_THEN "F5" (fun th-> REWRITE_TAC[MATCH_MP LE_SUC_PRE th; LE_REFL]) + THEN DISCH_THEN (MP_TAC o SPECL[`r:num`; `n:num`] o REWRITE_RULE[GSYM LT_SUC_LE] o REWRITE_RULE[lemma_inj_orbit]) + THEN USE_THEN "F5" (fun th-> REWRITE_TAC[MATCH_MP LE_SUC_PRE th; LE_REFL]) + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F6" (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th; EQ_SYM]));; + + +(*******************************************) + + +let is_edge_merge = new_definition `!(H:(A)hypermap) (x:A). is_edge_merge H x <=> dart_nondegenerate H x /\ ~(node_map H x IN edge H x)`;; + +let is_node_merge = new_definition `!(H:(A)hypermap) (x:A). is_node_merge H x <=> dart_nondegenerate H x /\ ~(face_map H x IN node H x)`;; + +let is_face_merge = new_definition `!(H:(A)hypermap) (x:A). is_face_merge H x <=> dart_nondegenerate H x /\ ~(edge_map H x IN face H x)`;; + +let is_edge_split = new_definition `!(H:(A)hypermap) (x:A). is_edge_split H x <=> dart_nondegenerate H x /\ node_map H x IN edge H x`;; + +let is_node_split = new_definition `!(H:(A)hypermap) (x:A). is_node_split H x <=> dart_nondegenerate H x /\ face_map H x IN node H x`;; + +let is_face_split = new_definition `!(H:(A)hypermap) (x:A). is_face_split H x <=> dart_nondegenerate H x /\ edge_map H x IN face H x`;; + +let INVERSE_EVALUATION = prove(`!s:A->bool p:A->A x:A. FINITE s /\ p permutes s ==> ?j:num. (inverse p) x = (p POWER j) x`, + REPEAT STRIP_TAC + THEN MP_TAC (SPECL[`s:A->bool`; `p:A->A`] inverse_element_lemma) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (fun th -> (ASSUME_TAC (AP_THM th `x:A`)))) + THEN EXISTS_TAC `j:num` + THEN ASM_REWRITE_TAC[]);; + +let lemma_orbit_identity = prove(`!s:A->bool p:A->A x:A y:A. FINITE s /\ p permutes s /\ y IN orbit_map p x + ==> orbit_map p x = orbit_map p y`, + REPEAT STRIP_TAC + THEN MP_TAC (SPECL[`s:A->bool`; `p:A->A`] partition_orbit) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (MP_TAC o SPECL[`x:A`; `y:A`]) + THEN ASSUME_TAC (SPECL[`p:A->A`; `y:A`] orbit_reflect) + THEN SUBGOAL_THEN `?z:A.z IN orbit_map (p:A->A) (x:A) INTER orbit_map (p:A->A) (y:A)` MP_TAC + THENL[MP_TAC (ISPECL[`orbit_map (p:A->A) (x:A)`; `orbit_map (p:A->A) (y:A)`; `y:A`] IN_INTER) + THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN EXISTS_TAC `y:A` + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN REWRITE_TAC[MEMBER_NOT_EMPTY] + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]));; + +let lemma_edge_identity = prove(`!(H:(A)hypermap) x:A y:A. y IN edge H x ==> edge H x = edge H y`, + REPEAT GEN_TAC THEN REWRITE_TAC[edge] THEN MESON_TAC[lemma_orbit_identity; hypermap_lemma]);; + +let lemma_node_identity = prove(`!(H:(A)hypermap) x:A y:A. y IN node H x ==> node H x = node H y`, + REPEAT GEN_TAC THEN REWRITE_TAC[node] THEN MESON_TAC[lemma_orbit_identity; hypermap_lemma]);; + +let lemma_face_identity = prove(`!(H:(A)hypermap) x:A y:A. y IN face H x ==> face H x = face H y`, + REPEAT GEN_TAC THEN REWRITE_TAC[face] THEN MESON_TAC[lemma_orbit_identity; hypermap_lemma]);; + + +let lemma_orbit_disjoint = prove(`!s:A->bool p:A->A x:A y:A. FINITE s /\ p permutes s /\ ~(y IN orbit_map p x) + ==> orbit_map p x INTER orbit_map p y = {}`, + REPEAT STRIP_TAC + THEN MP_TAC (SPECL[`s:A->bool`; `p:A->A`] partition_orbit) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (MP_TAC o SPECL[`x:A`; `y:A`]) + THEN SUBGOAL_THEN `~(orbit_map (p:A->A) (x:A) = orbit_map (p:A->A) (y:A))` ASSUME_TAC + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[orbit_reflect]; ALL_TAC] + THEN ASM_REWRITE_TAC[]);; + +let INVERSE_POWER_MAP = prove(`!s:A->bool p:A->A n:num. FINITE s /\ p permutes s + ==> (inverse p) o (p POWER (SUC n)) = p POWER n`, + REPEAT STRIP_TAC THEN REWRITE_TAC[COM_POWER; o_ASSOC] + THEN POP_ASSUM (MP_TAC o CONJUNCT2 o MATCH_MP PERMUTES_INVERSES_o) + THEN DISCH_THEN SUBST1_TAC THEN REWRITE_TAC[I_O_ID]);; + +let INVERSE_POWER_EVALUATION = prove(`!s:A->bool p:A->A x:A n:num. FINITE s /\ p permutes s + ==> (inverse p)((p POWER (SUC n)) x) = (p POWER n) x`, + REPEAT STRIP_TAC + THEN MP_TAC (SPECL[`s:A->bool`; `p:A->A`; `n:num`] INVERSE_POWER_MAP) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th -> (MP_TAC (AP_THM th `x:A`))) + THEN REWRITE_TAC[o_THM]);; + +let lemma_in_disjoint = prove(`!s:A->bool t:A->bool x:A. s INTER t = {} /\ x IN s ==> ~(x IN t)`, + REPEAT STRIP_TAC + THEN MP_TAC(SPECL[`s:A->bool`; `t:A->bool`; `x:A`] IN_INTER) + THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[NOT_IN_EMPTY]);; + +let lemma_not_in_orbit = prove(`!s:A->bool p :A->A x:A y:A n:num. FINITE s /\ p permutes s /\ ~(y IN orbit_map p x) ==> ~(y = (p POWER n) x)`, + REPEAT STRIP_TAC + THEN FIRST_X_ASSUM (MP_TAC o check (is_neg o concl)) + THEN REWRITE_TAC[] + THEN REWRITE_TAC[orbit_map; IN_ELIM_THM] + THEN EXISTS_TAC `n:num` THEN ASM_REWRITE_TAC[GE; LE_0]);; + +let lemma_orbit_power = prove(`!(s:A->bool) (p:A->A) (x:A) (n:num). (FINITE s /\ p permutes s) ==> (orbit_map p x = orbit_map p ((p POWER n) x))`, + REPEAT STRIP_TAC + THEN MP_TAC(SPECL[`p:A->A`; `n:num`; `x:A`; `((p:A->A) POWER (n:num)) (x:A)` ] in_orbit_lemma) + THEN SIMP_TAC[] THEN STRIP_TAC + THEN MP_TAC (SPECL[`s:A->bool`; `p:A->A`; `x:A`; `((p:A->A) POWER (n:num)) (x:A)`] lemma_orbit_identity) + THEN ASM_REWRITE_TAC[]);; + +let lemma_inverse_in_orbit = prove(`!s:A->bool p:A->A x:A. FINITE s /\ p permutes s ==> (inverse p) x IN orbit_map p x`, + REPEAT GEN_TAC + THEN DISCH_THEN (fun th -> (ASSUME_TAC th THEN MP_TAC(SPEC `x:A` (MATCH_MP INVERSE_EVALUATION th)))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` SUBST1_TAC) + THEN POP_ASSUM (SUBST1_TAC o SPECL[`x:A`; `j:num`] o MATCH_MP lemma_orbit_power) + THEN REWRITE_TAC[orbit_reflect]);; + +let lemmaFKSNTKR = prove(`!(H:(A)hypermap) (x:A). simple_hypermap H /\ x IN dart H /\ ~((edge_map H) x = x) /\ (dart_nondegenerate H x) + /\ dart_nondegenerate H ((edge_map H) x) ==> ((edge_map H) ((edge_map H) x) = x ==> is_face_merge H x) /\ is_node_merge H x`, + REPEAT GEN_TAC + THEN REWRITE_TAC[simple_hypermap; dart_nondegenerate; is_face_merge; is_node_merge; node; face; o_THM] + THEN STRIP_TAC + THEN ASM_REWRITE_TAC[] + THEN label_hypermap_TAC `H:(A)hypermap` + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `e = edge_map (H:(A)hypermap)` + THEN ABBREV_TAC `n = node_map (H:(A)hypermap)` + THEN ABBREV_TAC `f = face_map (H:(A)hypermap)` + THEN FIRST_X_ASSUM (MP_TAC o SPEC `(f:A->A) (x:A)` o check (is_forall o concl)) + THEN USE_THEN "H4" (MP_TAC o SYM o SPEC `x:A` o MATCH_MP PERMUTES_IN_IMAGE) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "FF") + THEN STRIP_TAC + THENL[USE_THEN "H2" (fun th2 -> (DISCH_THEN (fun th3 -> (MP_TAC(MATCH_MP inverse_function (CONJ th2 th3)))))) + THEN MP_TAC(CONJUNCT1(SPEC `H:(A)hypermap` inverse_hypermap_maps)) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[o_THM] + THEN DISCH_TAC + THEN MP_TAC(SPECL[`n:A->A`; `1`;`(f:A->A) (x:A)`; `(e:A->A) (x:A)`] in_orbit_lemma) + THEN POP_ASSUM (fun th -> ((ASSUME_TAC (SYM th)) THEN GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o DEPTH_CONV) [POWER_1; th])) + THEN SIMP_TAC[] + THEN DISCH_THEN (LABEL_TAC "F2") + THEN UNDISCH_TAC `~((n:A->A) ((e:A->A) (x:A)) = e x)` + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN (LABEL_TAC "F3") + THEN MP_TAC(SPECL[`f:A->A`; `1`;`(x:A)`; `(f:A->A) (x:A)`] in_orbit_lemma) + THEN REWRITE_TAC[POWER_1] + THEN DISCH_THEN (fun th3 -> (USE_THEN "H1" (fun th1 -> (USE_THEN "H4" (fun th2 -> (MP_TAC (MATCH_MP lemma_orbit_identity (CONJ th1 (CONJ th2 th3))))))))) + THEN DISCH_THEN SUBST_ALL_TAC + THEN REMOVE_THEN "F2" (fun th1 -> (REMOVE_THEN "F3" (fun th2 -> MP_TAC (CONJ th1 th2)))) + THEN REWRITE_TAC[GSYM IN_INTER] + THEN USE_THEN "FF" SUBST1_TAC + THEN REWRITE_TAC[IN_SING] + THEN DISCH_THEN (MP_TAC o AP_TERM `n:A->A`) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN UNDISCH_TAC `~((f:A->A) (x:A) = x)` + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_TAC + THEN USE_THEN "H1" (fun th1 -> (USE_THEN "H3" (fun th2 -> (MP_TAC (SPECL[`(f:A->A) (x:A)`; `x:A`] (MATCH_MP orbit_sym (CONJ th1 th2))))))) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F8") + THEN MP_TAC(SPECL[`f:A->A`; `1`; `x:A`;`(f:A->A) (x:A)`] in_orbit_lemma) + THEN REWRITE_TAC[POWER_1] + THEN DISCH_TAC + THEN USE_THEN "H1" (fun th1 -> (USE_THEN "H4" (fun th2 -> (MP_TAC (SPECL[`(f:A->A) (x:A)`; `x:A`] (MATCH_MP orbit_sym (CONJ th1 th2))))))) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F9") + THEN REMOVE_THEN "F8" (fun th1 -> (REMOVE_THEN "F9" (fun th2 -> MP_TAC (CONJ th1 th2)))) + THEN REWRITE_TAC[GSYM IN_INTER] + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[IN_SING] + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]));; + + +(* PLANARITY *) + +let planar_ind = new_definition `planar_ind (H:(A)hypermap) = &(number_of_edges H) + &(number_of_nodes H) + &(number_of_faces H) - &(CARD (dart H)) - ((&2) * (&(number_of_components (H))))`;; + + +(* some trivial lemmas *) + +let lemma_planar_hypermap = prove(`!(H:(A)hypermap). planar_hypermap H <=> planar_ind H = &0`, + REWRITE_TAC[planar_hypermap; planar_ind;GSYM REAL_OF_NUM_EQ; GSYM REAL_OF_NUM_ADD; GSYM REAL_OF_NUM_MUL] + THEN REAL_ARITH_TAC);; + +let lemma_null_hypermap_planar_index = prove(`!(H:(A)hypermap). CARD (dart H) = 0 ==> planar_ind H = &0`, +GEN_TAC THEN label_hypermap_TAC `H:(A)hypermap` + THEN USE_THEN "H1"(fun th -> REWRITE_TAC[MATCH_MP CARD_EQ_0 th]) + THEN REWRITE_TAC[planar_ind; number_of_edges; number_of_nodes; number_of_faces; number_of_components] + THEN REWRITE_TAC[edge_set; node_set; face_set; set_of_components; set_part_components] + THEN DISCH_THEN (LABEL_TAC "F1") + THEN REMOVE_THEN "F1" (fun th -> SUBST_ALL_TAC th THEN ASSUME_TAC th) + THEN SUBGOAL_THEN `!(p:A->A). set_of_orbits {} p = {}` (fun th -> REWRITE_TAC[th]) THENL[REWRITE_TAC[set_of_orbits] THEN SET_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `{comb_component (H:(A)hypermap) (x:A)| x IN {}} = {}` SUBST1_TAC THENL[SET_TAC[]; ALL_TAC] + THEN REWRITE_TAC[CARD_CLAUSES] THEN REAL_ARITH_TAC);; + +let lemma_shift_component_invariant = prove(`!(H:(A)hypermap). set_of_components H = set_of_components (shift H)`, +GEN_TAC THEN REWRITE_TAC[set_of_components] + THEN REWRITE_TAC[GSYM shift_lemma] + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN REWRITE_TAC[set_part_components] + THEN REWRITE_TAC[EXTENSION] + THEN GEN_TAC THEN EQ_TAC + THENL[REWRITE_TAC[IN_ELIM_THM] + THEN STRIP_TAC THEN EXISTS_TAC `x':A` + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[comb_component; EXTENSION] + THEN GEN_TAC THEN EQ_TAC + THENL[REWRITE_TAC[IN_ELIM_THM] + THEN REWRITE_TAC[is_in_component] + THEN STRIP_TAC THEN EXISTS_TAC `p:num -> A` + THEN EXISTS_TAC `n:num` + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[is_path; lemma_def_path] + THEN DISCH_THEN (LABEL_TAC "F1") + THEN REPEAT STRIP_TAC + THEN REMOVE_THEN "F1" (MP_TAC o SPEC `i:num`) + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[go_one_step] THEN DISCH_TAC + THEN REWRITE_TAC [GSYM shift_lemma] + THEN POP_ASSUM MP_TAC THEN MESON_TAC[]; ALL_TAC] + THEN REWRITE_TAC[IN_ELIM_THM] + THEN REWRITE_TAC[is_in_component] + THEN STRIP_TAC THEN EXISTS_TAC `p:num -> A` + THEN EXISTS_TAC `n:num` THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[is_path; lemma_def_path] + THEN DISCH_THEN (LABEL_TAC "F1") THEN REPEAT STRIP_TAC + THEN REMOVE_THEN "F1" (MP_TAC o SPEC `i:num`) + THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[go_one_step] + THEN DISCH_TAC THEN ONCE_REWRITE_TAC [shift_lemma] + THEN POP_ASSUM MP_TAC THEN MESON_TAC[]; ALL_TAC] + THEN REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC + THEN EXISTS_TAC `x':A` THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC + THENL[REWRITE_TAC[comb_component; IN_ELIM_THM; is_in_component] + THEN STRIP_TAC THEN EXISTS_TAC `p:num -> A` THEN EXISTS_TAC `n:num` + THEN ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[is_path; lemma_def_path] + THEN DISCH_THEN (LABEL_TAC "F2") + THEN REPEAT STRIP_TAC THEN REMOVE_THEN "F2" (MP_TAC o SPEC `i:num`) + THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[go_one_step] + THEN DISCH_TAC THEN ONCE_REWRITE_TAC [shift_lemma] + THEN POP_ASSUM MP_TAC THEN MESON_TAC[]; ALL_TAC] + THEN REWRITE_TAC[IN_ELIM_THM] + THEN REWRITE_TAC[comb_component; is_in_component; IN_ELIM_THM] + THEN STRIP_TAC THEN EXISTS_TAC `p:num -> A` + THEN EXISTS_TAC `n:num` THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[is_path; lemma_def_path] + THEN DISCH_THEN (LABEL_TAC "F2") + THEN REPEAT STRIP_TAC THEN REMOVE_THEN "F2" (MP_TAC o SPEC `i:num`) + THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[go_one_step] + THEN DISCH_TAC THEN REWRITE_TAC[GSYM shift_lemma] + THEN POP_ASSUM MP_TAC THEN MESON_TAC[]);; + + +let lemma_planar_invariant_shift = prove(`!(H:(A)hypermap). planar_ind H = planar_ind (shift H)`, + GEN_TAC THEN REWRITE_TAC[planar_ind; number_of_edges; number_of_nodes; number_of_faces; number_of_components] + THEN ONCE_REWRITE_TAC[GSYM lemma_shift_component_invariant] + THEN REWRITE_TAC[edge_set; node_set; face_set] + THEN ONCE_REWRITE_TAC[GSYM shift_lemma] + THEN REAL_ARITH_TAC);; + +let in_orbit_map1 = prove(`!p:A->A x:A. p x IN orbit_map p x`, + REPEAT GEN_TAC THEN MP_TAC (SPECL[`p:A->A`; `1`; `x:A`; `(p:A->A) (x:A)`] in_orbit_lemma) + THEN REWRITE_TAC[POWER_1]);; + + +let lemma_orbit_eq = prove(`!p:A->A q:A->A x:A. (!n:num. (p POWER n) x = (q POWER n) x) ==> orbit_map p x = orbit_map q x`, +REPEAT STRIP_TAC THEN REWRITE_TAC[orbit_map; EXTENSION; IN_ELIM_THM] + THEN STRIP_TAC THEN EQ_TAC + THENL[STRIP_TAC THEN EXISTS_TAC `n:num` + THEN REWRITE_TAC[ARITH_RULE `n:num >= 0`] + THEN FIRST_X_ASSUM (MP_TAC o SPEC `n:num` o check (is_forall o concl)) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN STRIP_TAC THEN EXISTS_TAC `n:num` + THEN REWRITE_TAC[ARITH_RULE `n:num >= 0`] + THEN FIRST_X_ASSUM (MP_TAC o SYM o SPEC `n:num` o check (is_forall o concl)) + THEN ASM_REWRITE_TAC[]);; + +let lemma_not_in_orbit_powers = prove(`!s:A->bool p:A->A x:A y:A n:num m:num. FINITE s /\ p permutes s /\ ~(y IN orbit_map p x) ==> ~((p POWER n) y = (p POWER m) x)`, +REPEAT STRIP_TAC THEN FIRST_X_ASSUM (MP_TAC o check (is_neg o concl)) + THEN REWRITE_TAC[] + THEN MP_TAC(SPECL[`p:A->A`; `m:num`; `x:A`; `((p:A->A) POWER (m:num)) (x:A)`] in_orbit_lemma) + THEN SIMP_TAC[] THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN DISCH_TAC THEN MP_TAC(SPECL[`p:A->A`; `y:A`] orbit_reflect) + THEN MP_TAC(SPECL[`s:A->bool`; `p:A->A`; `y:A`; `n:num`] lemma_orbit_power) + THEN ASM_REWRITE_TAC[] THEN DISCH_THEN SUBST1_TAC THEN STRIP_TAC + THEN MP_TAC(SPECL[`p:A->A`; `y:A`; `((p:A->A) POWER (n:num)) (y:A)`; `x:A` ] orbit_trans) + THEN ASM_REWRITE_TAC[]);; + +let lemma_walkup_nodes = prove(`!(H:(A)hypermap) x:A. x IN dart H ==> (node_set H) DELETE (node H x) = (node_set (edge_walkup H x)) DELETE (node (edge_walkup H x) (inverse(node_map H) x))`, + REPEAT GEN_TAC + THEN label_hypermap_TAC `H:(A)hypermap` + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `e = edge_map (H:(A)hypermap)` + THEN ABBREV_TAC `n = node_map (H:(A)hypermap)` + THEN ABBREV_TAC `f = face_map (H:(A)hypermap)` + THEN MP_TAC (CONJUNCT1 (SPECL[`H:(A)hypermap`; `x:A`] lemma_edge_walkup)) + THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC + THEN ABBREV_TAC `D' = dart (edge_walkup (H:(A)hypermap) (x:A))` + THEN ABBREV_TAC `n' = node_map (edge_walkup (H:(A)hypermap) (x:A))` + THEN LABEL_TAC "F1" (SPECL[`n:A->A`; `x:A`] orbit_reflect) + THEN DISCH_THEN (LABEL_TAC "F2") + THEN USE_THEN "H1" (fun th1 -> (USE_THEN "H3" (fun th2 -> MP_TAC(SPEC `x:A` (MATCH_MP INVERSE_EVALUATION (CONJ th1 th2)))))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (LABEL_TAC "F3")) + THEN USE_THEN "F3" ((LABEL_TAC "F4") o MATCH_MP in_orbit_lemma) + THEN ASM_REWRITE_TAC[node_set; node] + THEN REPEAT STRIP_TAC + THEN REWRITE_TAC[set_of_orbits] + THEN REWRITE_TAC[EXTENSION] + THEN STRIP_TAC + THEN REWRITE_TAC[IN_DELETE] + THEN EQ_TAC + THENL[REWRITE_TAC[IN_ELIM_THM] + THEN DISCH_THEN (CONJUNCTS_THEN2 (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6"))) (LABEL_TAC "F7")) + THEN REMOVE_THEN "F6" SUBST_ALL_TAC + THEN SUBGOAL_THEN `~(y:A IN orbit_map (n:A->A) (x:A))` (LABEL_TAC "F8") + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "H1" (fun th1 -> (USE_THEN "H3" (fun th2 -> (DISCH_THEN (fun th3 -> (MP_TAC (MATCH_MP lemma_orbit_identity (CONJ th1 (CONJ th2 th3))))))))) + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]); ALL_TAC] + THEN SUBGOAL_THEN `!m:num. ((n:A->A) POWER (m:num)) (y:A) = ((n':A->A) POWER (m:num)) (y:A)` (LABEL_TAC "F9") + THENL[INDUCT_TAC THENL[REWRITE_TAC[POWER_0]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F9" o SYM) + THEN MP_TAC(SPECL[`D:A->bool`; `n:A->A`; `x:A`; `y:A`; `m:num`; `j:num`] lemma_not_in_orbit_powers) + THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC + THEN MP_TAC(SPECL[`D:A->bool`; `n:A->A`; `x:A`; `y:A`; `m:num`; `0`] lemma_not_in_orbit_powers) + THEN ASM_REWRITE_TAC[POWER_0; I_THM] + THEN STRIP_TAC + THEN REWRITE_TAC[GSYM iterate_map_valuation] + THEN REMOVE_THEN "F9" SUBST1_TAC + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `((n:A->A) POWER (m:num)) (y:A)`] node_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]); ALL_TAC] + THEN SUBGOAL_THEN `~(((n:A->A) POWER (j:num)) (x:A) IN orbit_map n (y:A))` (LABEL_TAC "F10") + THENL[ REMOVE_THEN "F8" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "H1" (fun th1 -> (USE_THEN "H3" (fun th2 -> (DISCH_THEN (fun th3 -> (MP_TAC (MATCH_MP lemma_orbit_identity (CONJ th1 (CONJ th2 th3))))))))) + THEN MP_TAC(SPECL[`D:A->bool`; `n:A->A`; `x:A`; `j:num`] lemma_orbit_power) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) + THEN REWRITE_TAC[orbit_reflect]; ALL_TAC] + THEN REMOVE_THEN "F9" (MP_TAC o MATCH_MP lemma_orbit_eq) + THEN DISCH_THEN SUBST_ALL_TAC + THEN STRIP_TAC + THENL[EXISTS_TAC `y:A` + THEN MP_TAC(SPECL[`D:A->bool`; `n:A->A`; `x:A`; `y:A`; `0`; `0`] lemma_not_in_orbit_powers) + THEN ASM_REWRITE_TAC[POWER_0; I_THM]; ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[orbit_reflect]; ALL_TAC] + THEN REWRITE_TAC[IN_ELIM_THM] + THEN DISCH_THEN (CONJUNCTS_THEN2 (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "FF")) (LABEL_TAC "F6"))) (LABEL_TAC "F7")) + THEN REMOVE_THEN "F6" SUBST_ALL_TAC + THEN SUBGOAL_THEN `y:A IN (D:A->bool) DELETE (x:A)` (LABEL_TAC "F8") + THENL[FIND_ASSUM SUBST1_TAC `D':A->bool = (D:A->bool) DELETE x:A` + THEN ASM_ASM_SET_TAC; ALL_TAC] + THEN SUBGOAL_THEN `!k:num. ~(((n':A->A) POWER k) (y:A) = x:A)` (LABEL_TAC "FG") + THENL[GEN_TAC + THEN MP_TAC (MESON[hypermap_lemma] `node_map (edge_walkup (H:(A)hypermap) (x:A)) permutes dart(edge_walkup H x)`) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (MP_TAC o SPECL[`k:num`; `y:A`] o MATCH_MP iterate_orbit) + THEN USE_THEN "F8" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[IN_DELETE] + THEN SIMP_TAC[]; ALL_TAC] + THEN MP_TAC(SPEC `edge_walkup (H:(A)hypermap) (x:A)` hypermap_lemma) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G1") (LABEL_TAC "G2" o CONJUNCT1 o CONJUNCT2)) + THEN SUBGOAL_THEN `~(((n:A->A) POWER (j:num)) (x:A) IN orbit_map (n':A->A) (y:A))` (LABEL_TAC "FH") + THENL[ USE_THEN "F7" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "G1" (fun th1 -> (USE_THEN "G2" (fun th2 -> (DISCH_THEN (fun th3 -> (MP_TAC (MATCH_MP lemma_orbit_identity (CONJ th1 (CONJ th2 th3))))))))) + THEN REWRITE_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `!m:num. ((n:A->A) POWER (m:num)) (y:A) = ((n':A->A) POWER (m:num)) (y:A)` (LABEL_TAC "F9") + THENL[INDUCT_TAC THENL[REWRITE_TAC[POWER_0]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F9" o SYM) + THEN REMOVE_THEN "FG" (LABEL_TAC "F10" o SPEC `m:num`) + THEN MP_TAC(SPECL[`D':A->bool`; `n':A->A`; `y:A`; `((n:A->A) POWER (j:num)) (x:A)`; `0`; `m:num`] lemma_not_in_orbit_powers) + THEN ASM_REWRITE_TAC[POWER_0; I_THM] + THEN DISCH_THEN (LABEL_TAC "F11" o GSYM) + THEN REWRITE_TAC[GSYM iterate_map_valuation] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `((n:A->A) POWER (m:num)) (y:A)`] node_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN USE_THEN "F9" (fun th -> GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o DEPTH_CONV) [SYM th]) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]); ALL_TAC] + THEN REMOVE_THEN "F9" (MP_TAC o MATCH_MP lemma_orbit_eq) + THEN DISCH_THEN (SUBST_ALL_TAC o SYM) + THEN STRIP_TAC + THENL[EXISTS_TAC `y:A` THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[orbit_map; IN_ELIM_THM] + THEN EXISTS_TAC `j:num` THEN ARITH_TAC);; + + +let lemma_walkup_faces = prove(`!(H:(A)hypermap) x:A. x IN dart H ==> (face_set H) DELETE (face H x) = (face_set (edge_walkup H x)) DELETE (face (edge_walkup H x) (inverse(face_map H) x))`, + REPEAT GEN_TAC + THEN label_hypermap_TAC `H:(A)hypermap` + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `e = edge_map (H:(A)hypermap)` + THEN ABBREV_TAC `n = node_map (H:(A)hypermap)` + THEN ABBREV_TAC `f = face_map (H:(A)hypermap)` + THEN MP_TAC (CONJUNCT1 (SPECL[`H:(A)hypermap`; `x:A`] lemma_edge_walkup)) + THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC + THEN ABBREV_TAC `D' = dart (edge_walkup (H:(A)hypermap) (x:A))` + THEN ABBREV_TAC `f' = face_map (edge_walkup (H:(A)hypermap) (x:A))` + THEN LABEL_TAC "F1" (SPECL[`f:A->A`; `x:A`] orbit_reflect) + THEN DISCH_THEN (LABEL_TAC "F2") + THEN USE_THEN "H1" (fun th1 -> (USE_THEN "H4" (fun th2 -> MP_TAC(SPEC `x:A` (MATCH_MP INVERSE_EVALUATION (CONJ th1 th2)))))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (LABEL_TAC "F3")) + THEN USE_THEN "F3" ((LABEL_TAC "F4") o MATCH_MP in_orbit_lemma) + THEN ASM_REWRITE_TAC[face_set; face] + THEN REPEAT STRIP_TAC + THEN REWRITE_TAC[set_of_orbits] + THEN REWRITE_TAC[EXTENSION] + THEN STRIP_TAC + THEN REWRITE_TAC[IN_DELETE] + THEN EQ_TAC + THENL[REWRITE_TAC[IN_ELIM_THM] + THEN DISCH_THEN (CONJUNCTS_THEN2 (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6"))) (LABEL_TAC "F7")) + THEN REMOVE_THEN "F6" SUBST_ALL_TAC + THEN SUBGOAL_THEN `~(y:A IN orbit_map (f:A->A) (x:A))` (LABEL_TAC "F8") + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "H1" (fun th1 -> (USE_THEN "H4" (fun th2 -> (DISCH_THEN (fun th3 -> (MP_TAC (MATCH_MP lemma_orbit_identity (CONJ th1 (CONJ th2 th3))))))))) + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]); ALL_TAC] + THEN SUBGOAL_THEN `!m:num. ((f:A->A) POWER (m:num)) (y:A) = ((f':A->A) POWER (m:num)) (y:A)` (LABEL_TAC "F9") + THENL[INDUCT_TAC THENL[REWRITE_TAC[POWER_0]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F9" o SYM) + THEN MP_TAC(SPECL[`D:A->bool`; `f:A->A`; `x:A`; `y:A`; `m:num`; `j:num`] lemma_not_in_orbit_powers) + THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC + THEN MP_TAC(SPECL[`D:A->bool`; `f:A->A`; `x:A`; `y:A`; `m:num`; `0`] lemma_not_in_orbit_powers) + THEN ASM_REWRITE_TAC[POWER_0; I_THM] + THEN STRIP_TAC + THEN REWRITE_TAC[GSYM iterate_map_valuation] + THEN REMOVE_THEN "F9" SUBST1_TAC + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `((f:A->A) POWER (m:num)) (y:A)`] face_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]); ALL_TAC] + THEN SUBGOAL_THEN `~(((f:A->A) POWER (j:num)) (x:A) IN orbit_map f (y:A))` (LABEL_TAC "F10") + THENL[ REMOVE_THEN "F8" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "H1" (fun th1 -> (USE_THEN "H4" (fun th2 -> (DISCH_THEN (fun th3 -> (MP_TAC (MATCH_MP lemma_orbit_identity (CONJ th1 (CONJ th2 th3))))))))) + THEN MP_TAC(SPECL[`D:A->bool`; `f:A->A`; `x:A`; `j:num`] lemma_orbit_power) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) + THEN REWRITE_TAC[orbit_reflect]; ALL_TAC] + THEN REMOVE_THEN "F9" (MP_TAC o MATCH_MP lemma_orbit_eq) + THEN DISCH_THEN SUBST_ALL_TAC + THEN STRIP_TAC + THENL[EXISTS_TAC `y:A` + THEN MP_TAC(SPECL[`D:A->bool`; `f:A->A`; `x:A`; `y:A`; `0`; `0`] lemma_not_in_orbit_powers) + THEN ASM_REWRITE_TAC[POWER_0; I_THM]; ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[orbit_reflect]; ALL_TAC] + THEN REWRITE_TAC[IN_ELIM_THM] + THEN DISCH_THEN (CONJUNCTS_THEN2 (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "FF")) (LABEL_TAC "F6"))) (LABEL_TAC "F7")) + THEN REMOVE_THEN "F6" SUBST_ALL_TAC + THEN SUBGOAL_THEN `y:A IN (D:A->bool) DELETE (x:A)` (LABEL_TAC "F8") + THENL[FIND_ASSUM SUBST1_TAC `D':A->bool = (D:A->bool) DELETE x:A` + THEN ASM_ASM_SET_TAC; ALL_TAC] + THEN SUBGOAL_THEN `!k:num. ~(((f':A->A) POWER k) (y:A) = x:A)` (LABEL_TAC "FG") + THENL[GEN_TAC + THEN MP_TAC (MESON[hypermap_lemma] `face_map (edge_walkup (H:(A)hypermap) (x:A)) permutes dart(edge_walkup H x)`) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (MP_TAC o SPECL[`k:num`; `y:A`] o MATCH_MP iterate_orbit) + THEN USE_THEN "F8" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[IN_DELETE] + THEN SIMP_TAC[]; ALL_TAC] + THEN MP_TAC(SPEC `edge_walkup (H:(A)hypermap) (x:A)` hypermap_lemma) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G1") (LABEL_TAC "G2" o CONJUNCT1 o CONJUNCT2 o CONJUNCT2)) + THEN SUBGOAL_THEN `~(((f:A->A) POWER (j:num)) (x:A) IN orbit_map (f':A->A) (y:A))` (LABEL_TAC "FH") + THENL[ USE_THEN "F7" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "G1" (fun th1 -> (USE_THEN "G2" (fun th2 -> (DISCH_THEN (fun th3 -> (MP_TAC (MATCH_MP lemma_orbit_identity (CONJ th1 (CONJ th2 th3))))))))) + THEN REWRITE_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `!m:num. ((f:A->A) POWER (m:num)) (y:A) = ((f':A->A) POWER (m:num)) (y:A)` (LABEL_TAC "F9") + THENL[INDUCT_TAC THENL[REWRITE_TAC[POWER_0]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F9" o SYM) + THEN REMOVE_THEN "FG" (LABEL_TAC "F10" o SPEC `m:num`) + THEN MP_TAC(SPECL[`D':A->bool`; `f':A->A`; `y:A`; `((f:A->A) POWER (j:num)) (x:A)`; `0`; `m:num`] lemma_not_in_orbit_powers) + THEN ASM_REWRITE_TAC[POWER_0; I_THM] + THEN DISCH_THEN (LABEL_TAC "F11" o GSYM) + THEN REWRITE_TAC[GSYM iterate_map_valuation] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `((f:A->A) POWER (m:num)) (y:A)`] face_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN USE_THEN "F9" (fun th -> GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o DEPTH_CONV) [SYM th]) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]); ALL_TAC] + THEN REMOVE_THEN "F9" (MP_TAC o MATCH_MP lemma_orbit_eq) + THEN DISCH_THEN (SUBST_ALL_TAC o SYM) + THEN STRIP_TAC + THENL[EXISTS_TAC `y:A` THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[orbit_map; IN_ELIM_THM] + THEN EXISTS_TAC `j:num` THEN ARITH_TAC);; + + +let lemma_walkup_first_edge_eq = prove(`!(H:(A)hypermap) (x:A) (y:A).x IN dart H /\ ~(x IN edge H y) /\ ~(node_map H x IN edge H y) ==> edge H y = edge (edge_walkup H x) y /\ ~(inverse (edge_map H) x IN edge H y)`, + REPEAT GEN_TAC + THEN label_hypermap_TAC `H:(A)hypermap` + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `e = edge_map (H:(A)hypermap)` + THEN ABBREV_TAC `n = node_map (H:(A)hypermap)` + THEN ABBREV_TAC `f = face_map (H:(A)hypermap)` + THEN ABBREV_TAC `D' = dart (edge_walkup (H:(A)hypermap) (x:A))` + THEN ABBREV_TAC `e' = edge_map (edge_walkup (H:(A)hypermap) (x:A))` + THEN REWRITE_TAC[edge] + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F4"))) + THEN SUBGOAL_THEN `!m:num. ((e:A->A) POWER m) (y:A) = ((e':A->A) POWER m) (y:A)` ASSUME_TAC + THENL[INDUCT_TAC THENL[REWRITE_TAC[POWER_0]; ALL_TAC] + THEN REWRITE_TAC[GSYM iterate_map_valuation] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN SUBGOAL_THEN `~(((e:A->A) POWER (m:num)) (y:A) = x:A)` (LABEL_TAC "F5") + THENL[USE_THEN "F2" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN CONV_TAC (ONCE_DEPTH_CONV SYM_CONV) + THEN REWRITE_TAC[in_orbit_lemma]; ALL_TAC] + THEN SUBGOAL_THEN `~(((e:A->A) POWER (m:num)) (y:A) = (inverse e) (x:A))` (LABEL_TAC "F6") + THENL[USE_THEN "F2" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN CONV_TAC (ONCE_DEPTH_CONV SYM_CONV) + THEN DISCH_THEN (MP_TAC o AP_TERM `e:A->A`) + THEN GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o DEPTH_CONV)[GSYM o_THM] + THEN USE_THEN "H2" (fun th -> REWRITE_TAC[MATCH_MP PERMUTES_INVERSES_o th; I_THM; iterate_map_valuation]) + THEN REWRITE_TAC[in_orbit_lemma]; ALL_TAC] + THEN SUBGOAL_THEN `~(((e:A->A) POWER (m:num)) (y:A) = (n:A->A) (x:A))` (LABEL_TAC "F7") + THENL[USE_THEN "F4" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN CONV_TAC (ONCE_DEPTH_CONV SYM_CONV) + THEN REWRITE_TAC[in_orbit_lemma]; ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `((e:A->A) POWER (m:num)) (y:A)`] edge_map_walkup)))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]); ALL_TAC] + THEN STRIP_TAC + THENL[POP_ASSUM (MP_TAC o MATCH_MP lemma_orbit_eq) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN SIMP_TAC[]; ALL_TAC] + THEN REMOVE_THEN "F2" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "H1" (fun th1 -> (USE_THEN "H2" (fun th2 -> (DISCH_THEN (fun th3 -> (ASSUME_TAC (MATCH_MP lemma_orbit_identity (CONJ th1 (CONJ th2 th3))))))))) + THEN POP_ASSUM SUBST1_TAC + THEN USE_THEN "H1" (fun th1 -> (USE_THEN "H2" (fun th2 -> MP_TAC (SPEC `x:A` (MATCH_MP lemma_inverse_in_orbit (CONJ th1 th2)))))) + THEN MATCH_MP_TAC orbit_sym + THEN EXISTS_TAC `D:A->bool` + THEN ASM_REWRITE_TAC[]);; + + +let lemma_walkup_second_edge_eq = prove(`!(H:(A)hypermap) (x:A) (y:A).x IN dart H /\ y IN dart H /\ ~(y = x) /\ ~(node_map H x IN edge (edge_walkup H x) y) /\ ~((inverse (edge_map H)) x IN edge (edge_walkup H x) y) ==> edge H y = edge (edge_walkup H x) y /\ ~(x IN edge H y) /\ ~ (node_map H x IN edge H y)`, + REPEAT GEN_TAC + THEN label_hypermap_TAC `H:(A)hypermap` + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `e = edge_map (H:(A)hypermap)` + THEN ABBREV_TAC `n = node_map (H:(A)hypermap)` + THEN ABBREV_TAC `f = face_map (H:(A)hypermap)` + THEN ABBREV_TAC `D' = dart (edge_walkup (H:(A)hypermap) (x:A))` + THEN ABBREV_TAC `e' = edge_map (edge_walkup (H:(A)hypermap) (x:A))` + THEN REWRITE_TAC[edge] + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5"))))) + THEN SUBGOAL_THEN `!m:num. ((e:A->A) POWER m) (y:A) = ((e':A->A) POWER m) (y:A)` ASSUME_TAC + THENL[INDUCT_TAC THENL[REWRITE_TAC[POWER_0]; ALL_TAC] + THEN REWRITE_TAC[GSYM iterate_map_valuation] + THEN POP_ASSUM (SUBST1_TAC) + THEN MP_TAC (SPEC `edge_walkup (H:(A)hypermap) (x:A)` hypermap_lemma) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G1") (LABEL_TAC "G2" o CONJUNCT1)) + THEN MP_TAC (CONJUNCT1 (SPECL[`H:(A)hypermap`; `x:A`] lemma_edge_walkup)) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN ASSUME_TAC + THEN SUBGOAL_THEN `y:A IN D':A->bool` ASSUME_TAC + THENL[POP_ASSUM SUBST1_TAC THEN ASM_ASM_SET_TAC; ALL_TAC] + THEN USE_THEN "G2" (MP_TAC o MATCH_MP iterate_orbit) + THEN DISCH_THEN (MP_TAC o SPECL[`m:num`; `y:A`]) + THEN ASM_REWRITE_TAC[] + THEN ASM_REWRITE_TAC[IN_DELETE] + THEN DISCH_THEN (ASSUME_TAC o CONJUNCT2) + THEN SUBGOAL_THEN `~(((e':A->A) POWER (m:num)) (y:A) = (inverse e) (x:A))` ASSUME_TAC + THENL[USE_THEN "F5" MP_TAC THEN REWRITE_TAC[CONTRAPOS_THM] + THEN CONV_TAC (ONCE_DEPTH_CONV SYM_CONV) + THEN REWRITE_TAC[in_orbit_lemma]; ALL_TAC] + THEN SUBGOAL_THEN `~(((e':A->A) POWER (m:num)) (y:A) = (n:A->A) (x:A))` ASSUME_TAC + THENL[USE_THEN "F4" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN CONV_TAC (ONCE_DEPTH_CONV SYM_CONV) + THEN REWRITE_TAC[in_orbit_lemma]; ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `((e':A->A) POWER (m:num)) (y:A)`] edge_map_walkup)))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "FF" o MATCH_MP lemma_orbit_eq) + THEN USE_THEN "FF" (fun th -> REWRITE_TAC[th]) + THEN POP_ASSUM (SUBST_ALL_TAC o SYM) + THEN STRIP_TAC + THENL[POP_ASSUM MP_TAC THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "H1" (fun th1 -> (USE_THEN "H2" (fun th2 -> (DISCH_THEN (fun th3 -> (ASSUME_TAC (MATCH_MP lemma_orbit_identity (CONJ th1 (CONJ th2 th3))))))))) + THEN POP_ASSUM SUBST1_TAC + THEN MATCH_MP_TAC lemma_inverse_in_orbit + THEN EXISTS_TAC `D:A->bool` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN USE_THEN "F4"(fun th -> REWRITE_TAC[th]));; + +let lemma_walkup_edges = prove(`!(H:(A)hypermap) x:A. x IN dart H ==> (edge_set H) DIFF {edge H x, edge H (node_map H x)} = (edge_set (edge_walkup H x)) DIFF {edge (edge_walkup H x) (node_map H x), edge (edge_walkup H x) (inverse (edge_map H) x)}`, + REPEAT GEN_TAC THEN DISCH_THEN (LABEL_TAC "F1") + THEN REWRITE_TAC[edge_set; edge] THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `D' = dart (edge_walkup (H:(A)hypermap) (x:A))` + THEN REWRITE_TAC[set_of_orbits; SET_RULE `s DIFF {a, b} = (s DELETE a) DELETE b`] + THEN REWRITE_TAC[EXTENSION] THEN GEN_TAC + THEN ABBREV_TAC `e = edge_map (H:(A)hypermap)` + THEN ABBREV_TAC `e' = edge_map (edge_walkup (H:(A)hypermap) (x:A))` + THEN MP_TAC (SPEC `H:(A)hypermap` hypermap_lemma) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "H1") (LABEL_TAC "H2" o CONJUNCT1)) + THEN MP_TAC (CONJUNCT1(SPECL[`H:(A)hypermap`; `x:A`] lemma_edge_walkup)) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "G1") + THEN EQ_TAC THENL[REWRITE_TAC[IN_ELIM_THM; IN_DELETE] + THEN DISCH_THEN (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3")) ) (LABEL_TAC "F4")) (LABEL_TAC "F5")) + THEN REMOVE_THEN "F3" SUBST_ALL_TAC + THEN SUBGOAL_THEN `~(x:A IN orbit_map (e:A->A) (y:A))` (LABEL_TAC "F6") + THENL[USE_THEN "F4" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_TAC THEN MATCH_MP_TAC lemma_orbit_identity + THEN EXISTS_TAC `D:A->bool` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `~(node_map (H:(A)hypermap) x:A IN orbit_map (e:A->A) (y:A))` (LABEL_TAC "F6") + THENL[USE_THEN "F5" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_TAC THEN MATCH_MP_TAC lemma_orbit_identity + THEN EXISTS_TAC `D:A->bool` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`; `y:A`] lemma_walkup_first_edge_eq) + THEN ASM_REWRITE_TAC[edge] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F7") (LABEL_TAC "F8")) + THEN STRIP_TAC + THENL[STRIP_TAC + THENL[EXISTS_TAC `y:A` + THEN USE_THEN "F7" (fun th -> REWRITE_TAC[th]) + THEN SUBGOAL_THEN `~(y:A = x:A)` MP_TAC + THENL[USE_THEN "F4" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN SUBST1_TAC + THEN SIMP_TAC[]; ALL_TAC] + THEN USE_THEN "F2" MP_TAC + THEN REWRITE_TAC[IMP_IMP] + THEN ASM_ASM_SET_TAC; ALL_TAC] + THEN USE_THEN "F6" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[orbit_reflect]; ALL_TAC] + THEN USE_THEN "F8" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[orbit_reflect]; ALL_TAC] + THEN REWRITE_TAC[IN_ELIM_THM; IN_DELETE] + THEN DISCH_THEN (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3")) ) (LABEL_TAC "F4")) (LABEL_TAC "F5")) + THEN REMOVE_THEN "F3" SUBST_ALL_TAC + THEN ABBREV_TAC `G = edge_walkup (H:(A)hypermap) (x:A)` + THEN MP_TAC (SPEC `G:(A)hypermap` hypermap_lemma) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "GA") (LABEL_TAC "GB" o CONJUNCT1)) + THEN SUBGOAL_THEN `(y:A IN D:A->bool) /\ ~(y:A = x:A)` ASSUME_TAC + THENL[USE_THEN "F2" MP_TAC + THEN USE_THEN "G1" SUBST1_TAC + THEN REWRITE_TAC[IN_DELETE]; ALL_TAC] + THEN SUBGOAL_THEN `~(node_map (H:(A)hypermap) (x:A) IN orbit_map (e':A->A) (y:A))` (LABEL_TAC "F6") + THENL[ USE_THEN "F4" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_TAC + THEN MATCH_MP_TAC lemma_orbit_identity + THEN EXISTS_TAC `D':A->bool` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `~((inverse(e:A->A)) (x:A) IN orbit_map (e':A->A) (y:A))` (LABEL_TAC "F7") + THENL[USE_THEN "F5" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_TAC + THEN MATCH_MP_TAC lemma_orbit_identity + THEN EXISTS_TAC `D':A->bool` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`; `y:A`] lemma_walkup_second_edge_eq) + THEN ASM_REWRITE_TAC[edge] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F8") (CONJUNCTS_THEN2 (LABEL_TAC "F9") (LABEL_TAC "F10"))) + THEN STRIP_TAC + THENL[STRIP_TAC + THENL[EXISTS_TAC `y:A` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN USE_THEN "F7" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN SUBST1_TAC + THEN MATCH_MP_TAC lemma_inverse_in_orbit + THEN EXISTS_TAC `D:A->bool` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN USE_THEN "F8" (SUBST_ALL_TAC o SYM) + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[orbit_reflect]);; + +let in_set_of_orbits = prove(`!s:A->bool p:A->A. p permutes s ==> (!x:A. x IN s <=> orbit_map p x IN set_of_orbits s p)`, + REPEAT STRIP_TAC THEN EQ_TAC + THENL[STRIP_TAC + THEN REWRITE_TAC[set_of_orbits; IN_ELIM_THM] + THEN EXISTS_TAC `x:A` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN REWRITE_TAC[set_of_orbits; IN_ELIM_THM] + THEN STRIP_TAC + THEN FIRST_ASSUM (MP_TAC o SPEC `x':A` o MATCH_MP orbit_subset) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN MESON_TAC[orbit_reflect; SUBSET]);; + +let lemma_in_hypermap_orbits = prove(`!(H:(A)hypermap) x:A. (x IN dart H <=> edge H x IN edge_set H) /\ (x IN dart H <=> node H x IN node_set H) /\ (x IN dart H <=> face H x IN face_set H)`, + REPEAT GEN_TAC THEN REWRITE_TAC[edge; node;face; edge_set;node_set;face_set] + THEN ASM_MESON_TAC[in_set_of_orbits; CONJUNCT2(SPEC `H:(A)hypermap` hypermap_lemma)]);; + +let lemma_in_edge_set = prove(`!(H:(A)hypermap) x:A. x IN dart H <=> edge H x IN edge_set H`, MESON_TAC[ lemma_in_hypermap_orbits]);; +let lemma_in_node_set = prove(`!(H:(A)hypermap) x:A. x IN dart H <=> node H x IN node_set H`, MESON_TAC[ lemma_in_hypermap_orbits]);; +let lemma_in_face_set = prove(`!(H:(A)hypermap) x:A. x IN dart H <=> face H x IN face_set H`, MESON_TAC[ lemma_in_hypermap_orbits]);; + +let lemma_edge_representation = prove(`!(H:(A)hypermap) u:A->bool. u IN edge_set H ==> ?x:A. x IN dart H /\ u = edge H x`, + REPEAT GEN_TAC THEN REWRITE_TAC[edge_set; set_of_orbits; IN_ELIM_THM] + THEN REWRITE_TAC[GSYM edge]);; + +let lemma_node_representation = prove(`!(H:(A)hypermap) u:A->bool. u IN node_set H ==> ?x:A. x IN dart H /\ u = node H x`, + REPEAT GEN_TAC THEN REWRITE_TAC[node_set; set_of_orbits; IN_ELIM_THM] + THEN REWRITE_TAC[GSYM node]);; + +let lemma_face_representation = prove(`!(H:(A)hypermap) u:A->bool. u IN face_set H ==> ?x:A. x IN dart H /\ u = face H x`, + REPEAT GEN_TAC THEN REWRITE_TAC[face_set; set_of_orbits; IN_ELIM_THM] + THEN REWRITE_TAC[GSYM face]);; + +let lemma_component_representation = prove(`!(H:(A)hypermap) u:A->bool. u IN set_of_components H ==> ?x:A. x IN dart H /\ u = comb_component H x`, + REPEAT GEN_TAC THEN REWRITE_TAC[set_of_components; set_part_components; IN_ELIM_THM] + THEN REWRITE_TAC[GSYM comb_component]);; + +let lemma_in_subset = prove(`!s t x. s SUBSET t /\ x IN s ==> x IN t`, SET_TAC[]);; + +let lemma_complement_two_edges = prove(`!(H:(A)hypermap) (x:A) (y:A). x IN dart H /\ y IN dart H + ==> edge H x UNION edge H y = (dart H) DIFF (UNIONS (edge_set H DIFF {edge H x, edge H y}))`, + REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN REWRITE_TAC[EXTENSION] THEN GEN_TAC THEN EQ_TAC + THENL[REWRITE_TAC[IN_UNION] + THEN STRIP_TAC + THENL[POP_ASSUM (LABEL_TAC "F3") + THEN REWRITE_TAC[IN_DIFF; IN_UNIONS; IN_DELETE] + THEN USE_THEN "F1" (MP_TAC o MATCH_MP lemma_edge_subset) + THEN DISCH_THEN (fun th-> USE_THEN "F3"(fun th1-> LABEL_TAC "F4" (MATCH_MP lemma_in_subset (CONJ th th1)))) + THEN USE_THEN "F4" (fun th-> REWRITE_TAC[th]) + THEN REWRITE_TAC[NOT_EXISTS_THM; DE_MORGAN_THM; GSYM DISJ_ASSOC] + THEN GEN_TAC + THEN ASM_CASES_TAC `t:A->bool IN edge_set (H:(A)hypermap)` + THENL[DISJ2_TAC THEN POP_ASSUM (MP_TAC o MATCH_MP lemma_edge_representation) + THEN DISCH_THEN (X_CHOOSE_THEN `u:A` (CONJUNCTS_THEN2 (LABEL_TAC "F5") SUBST1_TAC)) + THEN ASM_CASES_TAC `x':A IN edge (H:(A)hypermap) (u:A)` + THENL[POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP lemma_edge_identity th]) + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[MATCH_MP lemma_edge_identity th]) + THEN DISJ1_TAC THEN SET_TAC[]; ALL_TAC] + THEN POP_ASSUM (fun th-> SIMP_TAC[th]); ALL_TAC] + THEN POP_ASSUM (fun th-> SIMP_TAC[th]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F6") + THEN REWRITE_TAC[IN_DIFF; IN_UNIONS; IN_DELETE] + THEN USE_THEN "F2" (MP_TAC o MATCH_MP lemma_edge_subset) + THEN DISCH_THEN (fun th-> USE_THEN "F6"(fun th1-> LABEL_TAC "F7" (MATCH_MP lemma_in_subset (CONJ th th1)))) + THEN USE_THEN "F7" (fun th-> REWRITE_TAC[th]) + THEN REWRITE_TAC[NOT_EXISTS_THM; DE_MORGAN_THM; GSYM DISJ_ASSOC] + THEN GEN_TAC + THEN ASM_CASES_TAC `t:A->bool IN edge_set (H:(A)hypermap)` + THENL[DISJ2_TAC THEN POP_ASSUM (MP_TAC o MATCH_MP lemma_edge_representation) + THEN DISCH_THEN (X_CHOOSE_THEN `v:A` (CONJUNCTS_THEN2 (LABEL_TAC "F8") SUBST1_TAC)) + THEN ASM_CASES_TAC `x':A IN edge (H:(A)hypermap) (v:A)` + THENL[POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP lemma_edge_identity th]) + THEN USE_THEN "F6" (fun th-> REWRITE_TAC[MATCH_MP lemma_edge_identity th]) + THEN DISJ1_TAC THEN SET_TAC[]; ALL_TAC] + THEN POP_ASSUM (fun th-> SIMP_TAC[th]); ALL_TAC] + THEN POP_ASSUM (fun th-> SIMP_TAC[th]); ALL_TAC] + THEN REWRITE_TAC[UNIONS; IN_DIFF; IN_ELIM_THM; IN_DIFF; NOT_EXISTS_THM; DE_MORGAN_THM] + THEN DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC (MP_TAC o SPEC `edge (H:(A)hypermap) (x':A)`)) + THEN POP_ASSUM (fun th-> REWRITE_TAC[REWRITE_RULE[lemma_in_edge_set] th; edge_refl; SET_RULE `z:A IN {a, b} <=> z = a \/ z = b`]) + THEN STRIP_TAC + THENL[REWRITE_TAC[IN_UNION] + THEN DISJ1_TAC THEN POP_ASSUM (SUBST1_TAC o SYM) THEN REWRITE_TAC[edge_refl]; ALL_TAC] + THEN REWRITE_TAC[IN_UNION] + THEN DISJ2_TAC THEN POP_ASSUM (SUBST1_TAC o SYM) THEN REWRITE_TAC[edge_refl]);; + +let lemma_edge_complement = prove(`!(H:(A)hypermap) x:A. x IN dart H ==> edge H x = dart H DIFF UNIONS (edge_set H DELETE edge H x)`, + REPEAT STRIP_TAC THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`; `x:A`] lemma_complement_two_edges) + THEN ASM_REWRITE_TAC[] THEN SET_TAC[]);; + +let lemma_in_walkup_dart = prove(`!(H:(A)hypermap) (x:A) (y:A). x IN dart H /\ y IN dart H /\ ~(y = x) ==> y IN dart (edge_walkup H x)`, + REPEAT GEN_TAC THEN REWRITE_TAC[lemma_edge_walkup; IN_DELETE] THEN SIMP_TAC[]);; + +let lemma_edge_map_walkup_in_dart = prove(`!H:(A)hypermap x:A. x IN dart H /\ ~(edge_map H x = x) + ==> (edge_map H x IN dart (edge_walkup H x)) /\ (inverse (edge_map H) x IN dart (edge_walkup H x))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN REWRITE_TAC[lemma_edge_walkup] + THEN USE_THEN "F1" (ASSUME_TAC o CONJUNCT1 o MATCH_MP lemma_dart_invariant) + THEN USE_THEN "F1" (ASSUME_TAC o CONJUNCT1 o MATCH_MP lemma_dart_inveriant_under_inverse_maps) + THEN MP_TAC (SPEC `x:A` (MATCH_MP non_fixed_point_lemma (CONJUNCT2 (SPEC `H:(A)hypermap` edge_map_and_darts)))) + THEN ASM_REWRITE_TAC[IN_DELETE]);; + +let lemma_node_map_walkup_in_dart = prove(`!H:(A)hypermap x:A. x IN dart H /\ ~(node_map H x = x) ==> (node_map H x IN dart (edge_walkup H x)) /\ (inverse (node_map H) x IN dart (edge_walkup H x))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN REWRITE_TAC[lemma_edge_walkup] + THEN USE_THEN "F1" (ASSUME_TAC o CONJUNCT1 o CONJUNCT2 o MATCH_MP lemma_dart_invariant) + THEN USE_THEN "F1" (ASSUME_TAC o CONJUNCT1 o CONJUNCT2 o MATCH_MP lemma_dart_inveriant_under_inverse_maps) + THEN MP_TAC (SPEC `x:A` (MATCH_MP non_fixed_point_lemma (CONJUNCT2((SPEC `H:(A)hypermap` node_map_and_darts))))) + THEN ASM_REWRITE_TAC[IN_DELETE]);; + +let lemma_face_map_walkup_in_dart = prove(`!H:(A)hypermap x:A. x IN dart H /\ ~(face_map H x = x) ==> (face_map H x IN dart (edge_walkup H x)) /\ (inverse (face_map H) x IN dart (edge_walkup H x))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN REWRITE_TAC[lemma_edge_walkup] + THEN USE_THEN "F1" (ASSUME_TAC o CONJUNCT2 o CONJUNCT2 o MATCH_MP lemma_dart_invariant) + THEN USE_THEN "F1" (ASSUME_TAC o CONJUNCT2 o CONJUNCT2 o MATCH_MP lemma_dart_inveriant_under_inverse_maps) + THEN MP_TAC (SPEC `x:A` (MATCH_MP non_fixed_point_lemma (CONJUNCT2(SPEC `H:(A)hypermap` face_map_and_darts)))) + THEN ASM_REWRITE_TAC[IN_DELETE]);; + +let lemma_walkup_support_edges = prove(`!(H:(A)hypermap) (x:A). x IN dart H /\ dart_nondegenerate H x ==> edge H x UNION edge H (node_map H x) = {x} UNION (edge (edge_walkup H x) (node_map H x) UNION edge (edge_walkup H x) (inverse (edge_map H) x))`, + REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT1 o CONJUNCT2 o MATCH_MP lemma_dart_invariant) + THEN USE_THEN "F1" (fun th-> DISCH_THEN (fun th1-> REWRITE_TAC[MATCH_MP lemma_complement_two_edges (CONJ th th1)])) + THEN USE_THEN "F2" (MP_TAC o CONJUNCT1 o REWRITE_RULE[dart_nondegenerate]) + THEN USE_THEN "F1" (fun th-> DISCH_THEN (fun th1-> MP_TAC(CONJUNCT2(MATCH_MP lemma_edge_map_walkup_in_dart (CONJ th th1))))) + THEN USE_THEN "F2" (MP_TAC o CONJUNCT1 o CONJUNCT2 o REWRITE_RULE[dart_nondegenerate]) + THEN USE_THEN "F1" (fun th-> DISCH_THEN (fun th1-> MP_TAC(CONJUNCT1(MATCH_MP lemma_node_map_walkup_in_dart (CONJ th th1))))) + THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_complement_two_edges th]) + THEN USE_THEN "F1" (SUBST1_TAC o SYM o MATCH_MP lemma_walkup_edges) + THEN REWRITE_TAC[lemma_edge_walkup] + THEN ABBREV_TAC `t = UNIONS (edge_set (H:(A)hypermap) DIFF {edge H (x:A), edge H (node_map H x)})` + THEN SUBGOAL_THEN `~(x:A IN t:A->bool)` ASSUME_TAC + THENL[EXPAND_TAC "t" + THEN REWRITE_TAC[IN_UNIONS; DIFF; IN_ELIM_THM; NOT_EXISTS_THM; DE_MORGAN_THM; GSYM DISJ_ASSOC] + THEN GEN_TAC + THEN ASM_CASES_TAC `t':A->bool IN edge_set (H:(A)hypermap)` + THENL[DISJ2_TAC THEN POP_ASSUM (MP_TAC o MATCH_MP lemma_edge_representation) + THEN DISCH_THEN (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (LABEL_TAC "G1") SUBST1_TAC)) + THEN ASM_CASES_TAC `x:A IN edge (H:(A)hypermap) (y:A)` + THENL[DISJ1_TAC + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP lemma_edge_identity th]) + THEN SET_TAC[]; ALL_TAC] + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN REWRITE_TAC[SET_RULE `{u} UNION v = u INSERT v`] + THEN MP_TAC(SPECL[`dart (H:(A)hypermap) DELETE (x:A)`; `t:A->bool`; `x:A`] INSERT_DIFF) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP INSERT_DELETE th]));; + +let lemma_in_edge = prove(`!(H:(A)hypermap) (x:A) (y:A). y IN edge H x <=> (?j:num. y = ((edge_map H) POWER j) x)`, + REPEAT GEN_TAC THEN REWRITE_TAC[edge; orbit_map; IN_ELIM_THM] THEN REWRITE_TAC[ARITH_RULE `(n:num) >= 0`]);; + +let lemma_in_edge2 = prove(`!H:(A)hypermap x:A n:num. (edge_map H POWER n) x IN edge H x`, MESON_TAC[lemma_in_edge]);; + +let lemma_edge_cycle = prove(`!(H:(A)hypermap) (x:A). ((edge_map H) POWER (CARD (edge H x))) x = x`, + REWRITE_TAC[edge] THEN MESON_TAC[hypermap_lemma; lemma_cycle_orbit]);; + +(* SPLITTING CASE FOR EDGES *) + +let lemma_edge_split = prove(`!(H:(A)hypermap) (x:A). x IN dart H /\ is_edge_split H x + ==> (~((inverse(face_map H)) x IN edge (edge_walkup H x) (node_map H x))) /\ + (edge H x = {x} UNION (edge (edge_walkup H x) (node_map H x)) UNION (edge (edge_walkup H x) ((inverse (face_map H)) x)))`, + REPEAT GEN_TAC THEN REWRITE_TAC[is_edge_split] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN STRIP_TAC + THENL[USE_THEN "F3" MP_TAC THEN REWRITE_TAC[edge] + THEN MP_TAC (SPEC `H:(A)hypermap` edge_map_and_darts) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_index_on_orbit) + THEN DISCH_THEN (X_CHOOSE_THEN `n:num` (CONJUNCTS_THEN2 (LABEL_TAC "G1" o REWRITE_RULE[GSYM edge]) (LABEL_TAC "G2"))) + THEN USE_THEN "G2" (MP_TAC o REWRITE_RULE[] o AP_TERM `edge_map (H:(A)hypermap)`) + THEN REWRITE_TAC[COM_POWER_FUNCTION] + THEN GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [GSYM (ISPECL[`edge_map (H:(A)hypermap)`; `node_map (H:(A)hypermap)`] o_THM)] + THEN REWRITE_TAC[GSYM inverse_hypermap_maps] + THEN DISCH_THEN (LABEL_TAC "G3") + THEN ASM_CASES_TAC `SUC n = CARD (edge (H:(A)hypermap) (x:A))` + THENL[POP_ASSUM (fun th-> USE_THEN "G3" (MP_TAC o REWRITE_RULE[th; lemma_edge_cycle])) + THEN USE_THEN "F2" (fun th-> REWRITE_TAC[MATCH_MP lemma_inverse_maps_at_nondegenerate_dart th]); ALL_TAC] + THEN USE_THEN "G1" (MP_TAC o REWRITE_RULE[GSYM LE_SUC_LT]) + THEN ONCE_REWRITE_TAC[LE_LT] + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "G4") + THEN ASM_CASES_TAC `~(0 < n:num)` + THENL[USE_THEN "G2" MP_TAC + THEN POP_ASSUM (fun th-> REWRITE_TAC[REWRITE_RULE[LT_NZ] th; POWER_0; I_THM]) + THEN USE_THEN "F2" (fun th-> REWRITE_TAC[REWRITE_RULE[dart_nondegenerate] th]); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[LT_EXISTS; CONJUNCT1 ADD]) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` SUBST_ALL_TAC) + THEN SUBGOAL_THEN `!i:num. i<=d ==>(edge_map (edge_walkup (H:(A)hypermap) (x:A)) POWER i) (edge_map H x)=(edge_map H POWER i) (edge_map H x)` (LABEL_TAC "G5") + THENL[INDUCT_TAC THENL[REWRITE_TAC[LE_0; POWER_0; I_THM]; ALL_TAC] + THEN REWRITE_TAC[GSYM COM_POWER_FUNCTION] + THEN POP_ASSUM (LABEL_TAC "G5") THEN DISCH_THEN (LABEL_TAC "G6") + THEN USE_THEN "G5" MP_TAC + THEN USE_THEN "G6" (fun th-> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ (SPEC `i:num` LE_PLUS) th)]) + THEN DISCH_THEN SUBST1_TAC + THEN ABBREV_TAC `y = (edge_map (H:(A)hypermap) POWER (i:num)) (edge_map H x)` + THEN SUBGOAL_THEN `~(y:A = node_map (H:(A)hypermap) (x:A))` MP_TAC + THENL[USE_THEN "G2" SUBST1_TAC THEN EXPAND_TAC "y" + THEN REWRITE_TAC[POWER_FUNCTION] + THEN MP_TAC (SPECL[`x:A`; `SUC d`] (MATCH_MP lemma_segment_orbit (SPEC `H:(A)hypermap` edge_map_and_darts))) + THEN REWRITE_TAC[GSYM edge] + THEN USE_THEN "G4" (fun th-> REWRITE_TAC[MATCH_MP LT_TRANS (CONJ (SPEC `SUC d` LT_PLUS) th)]) + THEN DISCH_THEN (MP_TAC o SPECL[`SUC d`; `SUC i`] o REWRITE_RULE[lemma_def_inj_orbit]) + THEN USE_THEN "G6" (fun th-> REWRITE_TAC[REWRITE_RULE[GSYM LT_SUC_LE] th; LE_REFL]) + THEN SIMP_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `~(y:A = inverse (edge_map (H:(A)hypermap)) (x:A))` MP_TAC + THENL[EXPAND_TAC "y" THEN REWRITE_TAC[GSYM edge_map_inverse_representation] + THEN REWRITE_TAC[POWER_FUNCTION] THEN REWRITE_TAC[COM_POWER_FUNCTION] + THEN MP_TAC (SPECL[`x:A`; `SUC(SUC i)`] (MATCH_MP lemma_segment_orbit (SPEC `H:(A)hypermap` edge_map_and_darts))) + THEN REWRITE_TAC[GSYM edge] THEN USE_THEN "G6" (MP_TAC o REWRITE_RULE[GSYM LT_SUC_LE]) + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [GSYM LT_SUC] + THEN USE_THEN "G4" (fun th-> DISCH_THEN (fun th1-> REWRITE_TAC[MATCH_MP LT_TRANS (CONJ th1 th)])) + THEN DISCH_THEN (MP_TAC o SPECL[`SUC(SUC i)`; `0`] o REWRITE_RULE[lemma_def_inj_orbit]) + THEN REWRITE_TAC[LT_0; LE_REFL; POWER_0; I_THM] THEN SIMP_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `~(y:A = (x:A))` MP_TAC + THENL[EXPAND_TAC "y" THEN REWRITE_TAC[POWER_FUNCTION] + THEN MP_TAC (SPECL[`x:A`; `SUC i`] (MATCH_MP lemma_segment_orbit (SPEC `H:(A)hypermap` edge_map_and_darts))) + THEN REWRITE_TAC[GSYM edge] THEN USE_THEN "G6" (MP_TAC o REWRITE_RULE[GSYM LT_SUC_LE]) + THEN DISCH_THEN (fun th-> (MP_TAC (MATCH_MP LT_TRANS (CONJ th (SPEC `SUC d` LT_PLUS))))) + THEN USE_THEN "G4" (fun th-> (DISCH_THEN (fun th1-> REWRITE_TAC[MATCH_MP LT_TRANS (CONJ th1 th)]))) + THEN DISCH_THEN (MP_TAC o SPECL[`SUC i`; `0`] o REWRITE_RULE[lemma_def_inj_orbit]) + THEN REWRITE_TAC[LT_0; LE_REFL; POWER_0; I_THM]; ALL_TAC] + THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (fun th-> MP_TAC(REWRITE_RULE[th] (CONJUNCT2(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `y:A`] edge_map_walkup)))))) + THEN SIMP_TAC[]; ALL_TAC] + THEN USE_THEN "G5" (MP_TAC o REWRITE_RULE[LE_REFL] o SPEC `d:num`) + THEN GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [POWER_FUNCTION] + THEN USE_THEN "G2" (SUBST1_TAC o SYM) + THEN DISCH_THEN (MP_TAC o AP_TERM `edge_map (edge_walkup (H:(A)hypermap) (x:A))`) + THEN REWRITE_TAC[COM_POWER_FUNCTION] + THEN MP_TAC(CONJUNCT1(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `x:A`] edge_map_walkup))) + THEN USE_THEN "F2" (fun th-> REWRITE_TAC[REWRITE_RULE[dart_nondegenerate] th]) + THEN ABBREV_TAC `G = edge_walkup (H:(A)hypermap) (x:A)` THEN REWRITE_TAC[GSYM edge] + THEN DISCH_THEN (fun th -> SUBST1_TAC th THEN ASSUME_TAC th) + THEN MP_TAC (REWRITE_RULE[POWER_1] (SPECL[`G:(A)hypermap`; `node_map (H:(A)hypermap) (x:A)`; `1`] lemma_in_edge2)) + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_edge_identity th]) + THEN DISCH_THEN (fun th-> (MP_TAC (MATCH_MP orbit_cyclic (CONJ (SPEC `d:num` NON_ZERO) th)))) + THEN REWRITE_TAC[GSYM edge] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[IN_ELIM_THM; NOT_EXISTS_THM; DE_MORGAN_THM] + THEN GEN_TAC + THEN ASM_CASES_TAC `~(k:num < SUC d)` THENL[POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "G7" o REWRITE_RULE[LT_SUC_LE]) + THEN DISJ2_TAC + THEN USE_THEN "G7" (fun th-> USE_THEN "G5" (fun th1-> REWRITE_TAC[MATCH_MP th1 th])) + THEN USE_THEN "G3" SUBST1_TAC + THEN REWRITE_TAC[POWER_FUNCTION] + THEN MP_TAC (SPECL[`x:A`; `SUC(SUC d)`] (MATCH_MP lemma_segment_orbit (SPEC `H:(A)hypermap` edge_map_and_darts))) + THEN REWRITE_TAC[GSYM edge] + THEN USE_THEN "G4" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (MP_TAC o SPECL[`SUC(SUC d)`; `SUC k`] o REWRITE_RULE[lemma_def_inj_orbit]) + THEN USE_THEN "G7" (MP_TAC o REWRITE_RULE[GSYM LT_SUC_LE]) + THEN DISCH_THEN (fun th-> REWRITE_TAC[LE_REFL; ONCE_REWRITE_RULE[GSYM LT_SUC] th]); ALL_TAC] + THEN MP_TAC(CONJUNCT1(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `y:A`] edge_map_walkup)))) + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[MATCH_MP lemma_inverse_maps_at_nondegenerate_dart th]) + THEN DISCH_TAC + THEN MP_TAC (REWRITE_RULE[POWER_1] (SPECL[`edge_walkup (H:(A)hypermap) (x:A)`; `inverse (edge_map (H:(A)hypermap)) (x:A)`; `1`] lemma_in_edge2)) + THEN POP_ASSUM SUBST1_TAC THEN DISCH_THEN (SUBST1_TAC o SYM o MATCH_MP lemma_edge_identity) + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1-> REWRITE_TAC[SYM(MATCH_MP lemma_walkup_support_edges (CONJ th th1))])) + THEN POP_ASSUM (SUBST1_TAC o SYM o MATCH_MP lemma_edge_identity) + THEN SET_TAC[]);; + +(* MERGE CASE - FOR EDGES *) + +let lemma_edge_merge = prove(`!(H:(A)hypermap) (x:A). x IN dart H /\ is_edge_merge H x + ==> {x} UNION (edge (edge_walkup H x) (node_map H x)) = (edge H x) UNION (edge H (node_map H x))`, + REPEAT GEN_TAC THEN REWRITE_TAC[is_edge_merge] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN MP_TAC (SPEC `x:A` (MATCH_MP lemma_inverse_in_orbit (SPEC `H:(A)hypermap` edge_map_and_darts))) + THEN MP_TAC (SPEC `H:(A)hypermap` edge_map_and_darts) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_index_on_orbit) + THEN REWRITE_TAC[GSYM edge] + THEN DISCH_THEN (X_CHOOSE_THEN `n:num` (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5"))) + THEN ASM_CASES_TAC `~(0 < n:num)` + THENL[USE_THEN "F5" MP_TAC + THEN POP_ASSUM (fun th-> REWRITE_TAC[REWRITE_RULE[LT_NZ] th; POWER_0; I_THM]) + THEN USE_THEN "F2" (fun th-> REWRITE_TAC[REWRITE_RULE[dart_nondegenerate] th]) + THEN USE_THEN "F2" (fun th-> REWRITE_TAC[MATCH_MP lemma_inverse_maps_at_nondegenerate_dart th]); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[LT_EXISTS; CONJUNCT1 ADD]) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` SUBST_ALL_TAC) + THEN SUBGOAL_THEN `!i:num. i<=d ==>(edge_map (edge_walkup (H:(A)hypermap) (x:A)) POWER i) (edge_map H x)=(edge_map H POWER i) (edge_map H x)` (LABEL_TAC "F6") + THENL[INDUCT_TAC THENL[REWRITE_TAC[LE_0; POWER_0; I_THM]; ALL_TAC] + THEN REWRITE_TAC[GSYM COM_POWER_FUNCTION] THEN POP_ASSUM (LABEL_TAC "G1") + THEN DISCH_THEN (LABEL_TAC "G2") THEN USE_THEN "G1" MP_TAC + THEN USE_THEN "G2" (fun th-> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ (SPEC `i:num` LE_PLUS) th)]) + THEN DISCH_THEN SUBST1_TAC + THEN ABBREV_TAC `y = (edge_map (H:(A)hypermap) POWER (i:num)) (edge_map H x)` + THEN SUBGOAL_THEN `~(y:A = node_map (H:(A)hypermap) (x:A))` MP_TAC + THENL[EXPAND_TAC "y" THEN USE_THEN "F3" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM; POWER_FUNCTION] THEN DISCH_TAC + THEN MP_TAC (REWRITE_RULE[POWER_1] (SPECL[`H:(A)hypermap`; `(x:A)`; `SUC i`] lemma_in_edge2)) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `~(y:A = inverse (edge_map (H:(A)hypermap)) (x:A))` MP_TAC + THENL[EXPAND_TAC "y" THEN USE_THEN "F5" SUBST1_TAC + THEN REWRITE_TAC[POWER_FUNCTION] THEN REWRITE_TAC[COM_POWER_FUNCTION] + THEN MP_TAC (SPECL[`x:A`; `SUC d`] (MATCH_MP lemma_segment_orbit (SPEC `H:(A)hypermap` edge_map_and_darts))) + THEN USE_THEN "F4" (fun th-> REWRITE_TAC[GSYM edge; th]) + THEN DISCH_THEN (MP_TAC o SPECL[`SUC d`; `SUC i`] o REWRITE_RULE[lemma_def_inj_orbit]) + THEN USE_THEN "G2" (fun th-> REWRITE_TAC[LE_REFL; REWRITE_RULE[GSYM LT_SUC_LE] th]) + THEN SIMP_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `~(y:A = (x:A))` MP_TAC + THENL[EXPAND_TAC "y" THEN REWRITE_TAC[POWER_FUNCTION] + THEN MP_TAC (SPECL[`x:A`; `SUC i`] (MATCH_MP lemma_segment_orbit (SPEC `H:(A)hypermap` edge_map_and_darts))) + THEN REWRITE_TAC[GSYM edge] + THEN USE_THEN "G2" (fun th-> USE_THEN "F4" (fun th1-> REWRITE_TAC[MATCH_MP LT_TRANS (CONJ (REWRITE_RULE[GSYM LT_SUC_LE] th) th1)])) + THEN DISCH_THEN (MP_TAC o SPECL[`SUC i`; `0`] o REWRITE_RULE[lemma_def_inj_orbit]) + THEN REWRITE_TAC[LT_0; LE_REFL; POWER_0; I_THM]; ALL_TAC] + THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (fun th-> MP_TAC(REWRITE_RULE[th] (CONJUNCT2(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `y:A`] edge_map_walkup)))))) + THEN SIMP_TAC[]; ALL_TAC] + THEN USE_THEN "F6" (MP_TAC o REWRITE_RULE[LE_REFL] o SPEC `d:num`) + THEN GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [POWER_FUNCTION] + THEN USE_THEN "F5" (SUBST1_TAC o SYM) THEN DISCH_TAC + THEN MP_TAC(CONJUNCT1(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `y:A`] edge_map_walkup))) + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[REWRITE_RULE[dart_nondegenerate] th]) + THEN DISCH_THEN (MP_TAC o AP_TERM `(edge_map (edge_walkup (H:(A)hypermap) (x:A))) POWER (d:num)`) + THEN POP_ASSUM SUBST1_TAC THEN REWRITE_TAC[POWER_FUNCTION] THEN DISCH_TAC + THEN MP_TAC (REWRITE_RULE[POWER_1] (SPECL[`edge_walkup (H:(A)hypermap) (x:A)`; `node_map (H:(A)hypermap) (x:A)`; `SUC d`] lemma_in_edge2)) + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "G7" o MATCH_MP lemma_edge_identity) + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1-> REWRITE_TAC[MATCH_MP lemma_walkup_support_edges (CONJ th th1)])) + THEN POP_ASSUM (SUBST1_TAC o SYM) THEN SET_TAC[]);; + +(* Node *) + +let lemma_shift_non_degenerate = prove(`!(H:(A)hypermap) (x:A). dart_nondegenerate H x <=> dart_nondegenerate (shift H) x`, + REPEAT GEN_TAC THEN REWRITE_TAC[dart_nondegenerate] + THEN STRIP_ASSUME_TAC (SPEC `H:(A)hypermap` (GSYM shift_lemma)) + THEN ASM_REWRITE_TAC[] THEN MESON_TAC[]);; + +let lemma_change_node_walkup = prove(`!(H:(A)hypermap) (x:A). (is_node_merge H x ==> is_edge_merge (shift H) x) /\ (is_node_split H x ==> is_edge_split (shift H) x)`, +REPEAT GEN_TAC + THEN STRIP_ASSUME_TAC (SPEC `H:(A)hypermap` (GSYM shift_lemma)) + THEN ASM_REWRITE_TAC[is_node_merge; is_edge_merge; is_node_split; is_edge_split; edge; node] + THEN STRIP_TAC + THENL[STRIP_TAC + THEN ONCE_ASM_REWRITE_TAC[GSYM lemma_shift_non_degenerate] + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN STRIP_TAC + THEN ONCE_ASM_REWRITE_TAC[GSYM lemma_shift_non_degenerate] + THEN ASM_REWRITE_TAC[]);; + +let lemma_node_merge = prove(`!(H:(A)hypermap) (x:A). x IN dart H /\ is_node_merge H x + ==> {x} UNION (node (node_walkup H x) (face_map H x)) = (node H x) UNION (node H (face_map H x))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (ASSUME_TAC)) + THEN REWRITE_TAC[node_walkup] + THEN MP_TAC (CONJUNCT1 (SPECL[`H:(A)hypermap`; `x:A`] lemma_change_node_walkup)) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F2") + THEN label_4Gs_TAC (SPEC `H:(A)hypermap` (GSYM shift_lemma)) + THEN REMOVE_THEN "F1" MP_TAC + THEN USE_THEN "G1" (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "F3") + THEN MP_TAC(SPECL[`shift (H:(A)hypermap)`; `x:A`] lemma_edge_merge) + THEN ASM_REWRITE_TAC[node; edge] + THEN STRIP_ASSUME_TAC (GSYM (SPEC `edge_walkup (shift(H:(A)hypermap)) (x:A)` double_shift_lemma)) + THEN ASM_REWRITE_TAC[]);; + +let lemma_node_split = prove(`!(H:(A)hypermap) (x:A). x IN dart H /\ is_node_split H x + ==> (~((inverse(edge_map H)) x IN node (node_walkup H x) (face_map H x))) /\ + (node H x = {x} UNION (node (node_walkup H x) (face_map H x)) UNION (node (node_walkup H x) ((inverse (edge_map H)) x)))`, + + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (ASSUME_TAC)) + THEN REWRITE_TAC[node_walkup] + THEN MP_TAC (CONJUNCT2 (SPECL[`H:(A)hypermap`; `x:A`] lemma_change_node_walkup)) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F2") + THEN label_4Gs_TAC (SPEC `H:(A)hypermap` (GSYM shift_lemma)) + THEN REMOVE_THEN "F1" MP_TAC + THEN USE_THEN "G1" (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "F3") + THEN MP_TAC(SPECL[`shift (H:(A)hypermap)`; `x:A`] lemma_edge_split) + THEN ASM_REWRITE_TAC[node; edge] + THEN STRIP_ASSUME_TAC (GSYM (SPEC `edge_walkup (shift(H:(A)hypermap)) (x:A)` double_shift_lemma)) + THEN ASM_REWRITE_TAC[]);; + +(* face *) + +let lemma_double_shift_non_degenerate = prove(`!(H:(A)hypermap) (x:A). dart_nondegenerate H x <=> dart_nondegenerate (shift(shift H)) x`, + REPEAT GEN_TAC THEN REWRITE_TAC[dart_nondegenerate] + THEN STRIP_ASSUME_TAC (SPEC `H:(A)hypermap` (GSYM double_shift_lemma)) + THEN ASM_REWRITE_TAC[] THEN MESON_TAC[]);; + + +let lemma_change_face_walkup = prove(`!(H:(A)hypermap) (x:A). (is_face_merge H x ==> is_edge_merge (shift(shift H)) x) /\ (is_face_split H x ==> is_edge_split (shift (shift H)) x)`, +REPEAT GEN_TAC + THEN STRIP_ASSUME_TAC (SPEC `H:(A)hypermap` (GSYM double_shift_lemma)) + THEN ASM_REWRITE_TAC[is_face_merge; is_edge_merge; is_face_split; is_edge_split; edge; face] + THEN STRIP_TAC + THENL[STRIP_TAC + THEN ONCE_ASM_REWRITE_TAC[GSYM lemma_double_shift_non_degenerate] + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN STRIP_TAC + THEN ONCE_ASM_REWRITE_TAC[GSYM lemma_double_shift_non_degenerate] + THEN ASM_REWRITE_TAC[]);; + +let lemma_face_merge = prove(`!(H:(A)hypermap) (x:A). x IN dart H /\ is_face_merge H x + ==> {x} UNION (face (face_walkup H x) (edge_map H x)) = (face H x) UNION (face H (edge_map H x))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (ASSUME_TAC)) + THEN REWRITE_TAC[face_walkup] + THEN MP_TAC (CONJUNCT1 (SPECL[`H:(A)hypermap`; `x:A`] lemma_change_face_walkup)) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F2") + THEN label_4Gs_TAC (SPEC `H:(A)hypermap` (GSYM double_shift_lemma)) + THEN REMOVE_THEN "F1" MP_TAC + THEN USE_THEN "G1" (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "F3") + THEN MP_TAC(SPECL[`shift(shift (H:(A)hypermap))`; `x:A`] lemma_edge_merge) + THEN ASM_REWRITE_TAC[face; edge] + THEN STRIP_ASSUME_TAC (GSYM (SPEC `edge_walkup (shift(shift(H:(A)hypermap))) (x:A)` shift_lemma)) + THEN ASM_REWRITE_TAC[]);; + +let lemma_face_split = prove(`!(H:(A)hypermap) (x:A). x IN dart H /\ is_face_split H x + ==> (~((inverse(node_map H)) x IN face (face_walkup H x) (edge_map H x))) /\ + (face H x = {x} UNION (face (face_walkup H x) (edge_map H x)) UNION (face (face_walkup H x) ((inverse (node_map H)) x)))`, + + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (ASSUME_TAC)) + THEN REWRITE_TAC[face_walkup] + THEN MP_TAC (CONJUNCT2 (SPECL[`H:(A)hypermap`; `x:A`] lemma_change_face_walkup)) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F2") + THEN label_4Gs_TAC (SPEC `H:(A)hypermap` (GSYM double_shift_lemma)) + THEN REMOVE_THEN "F1" MP_TAC + THEN USE_THEN "G1" (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "F3") + THEN MP_TAC(SPECL[`shift(shift (H:(A)hypermap))`; `x:A`] lemma_edge_split) + THEN ASM_REWRITE_TAC[face; edge] + THEN STRIP_ASSUME_TAC (GSYM (SPEC `edge_walkup (shift(shift(H:(A)hypermap))) (x:A)` shift_lemma)) + THEN ASM_REWRITE_TAC[]);; + + +(* A SOME FACTS ON COMPONETS *) + +let lemma_powers_in_component = prove(`!(H:(A)hypermap) (x:A) (j:num). (((edge_map H) POWER j) x IN comb_component H x) /\ (((node_map H) POWER j) x IN comb_component H x) /\ (((face_map H) POWER j) x IN comb_component H x)`, + REWRITE_TAC[comb_component; is_in_component; IN_ELIM_THM] + THEN REPEAT GEN_TAC + THEN STRIP_TAC + THENL[EXISTS_TAC `edge_path (H:(A)hypermap) (x:A)` + THEN EXISTS_TAC `j:num` + THEN REWRITE_TAC[edge_path; lemma_edge_path; POWER_0; I_THM]; ALL_TAC] + THEN STRIP_TAC + THENL[EXISTS_TAC `node_path (H:(A)hypermap) (x:A)` + THEN EXISTS_TAC `j:num` + THEN REWRITE_TAC[node_path; lemma_node_path; POWER_0; I_THM]; ALL_TAC] + THEN EXISTS_TAC `face_path (H:(A)hypermap) (x:A)` + THEN EXISTS_TAC `j:num` + THEN REWRITE_TAC[face_path; lemma_face_path; POWER_0; I_THM]);; + +let lemma_inverses_in_component = prove(`!(H:(A)hypermap) (x:A) (j:num). (inverse(edge_map H) x IN comb_component H x) /\ (inverse(node_map H) x IN comb_component H x) /\ (inverse(face_map H) x IN comb_component H x)`, +REPEAT GEN_TAC + THEN label_hypermap_TAC `H:(A)hypermap` + THEN REPEAT STRIP_TAC + THENL[USE_THEN "H1" (fun th1 -> (USE_THEN "H2" (fun th2 -> (MP_TAC (SPEC `x:A` (MATCH_MP INVERSE_EVALUATION (CONJ th1 th2))))))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` SUBST1_TAC) + THEN REWRITE_TAC[ lemma_powers_in_component]; + USE_THEN "H1" (fun th1 -> (USE_THEN "H3" (fun th2 -> (MP_TAC (SPEC `x:A` (MATCH_MP INVERSE_EVALUATION (CONJ th1 th2))))))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` SUBST1_TAC) + THEN REWRITE_TAC[ lemma_powers_in_component]; + USE_THEN "H1" (fun th1 -> (USE_THEN "H4" (fun th2 -> (MP_TAC (SPEC `x:A` (MATCH_MP INVERSE_EVALUATION (CONJ th1 th2))))))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` SUBST1_TAC) + THEN REWRITE_TAC[ lemma_powers_in_component]]);; + +let lemma_edge_subset_component = prove(`!(H:(A)hypermap) (x:A). edge H x SUBSET comb_component H x`, + REPEAT GEN_TAC + THEN REWRITE_TAC[SUBSET; edge; orbit_map; IN_ELIM_THM] + THEN REPEAT STRIP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[lemma_powers_in_component]);; + +let lemma_node_subset_component = prove(`!(H:(A)hypermap) (x:A). node H x SUBSET comb_component H x`, + REPEAT GEN_TAC + THEN REWRITE_TAC[SUBSET; node; orbit_map; IN_ELIM_THM] + THEN REPEAT STRIP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[lemma_powers_in_component]);; + +let lemma_face_subset_component = prove(`!(H:(A)hypermap) (x:A). face H x SUBSET comb_component H x`, + REPEAT GEN_TAC + THEN REWRITE_TAC[SUBSET; face; orbit_map; IN_ELIM_THM] + THEN REPEAT STRIP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[lemma_powers_in_component]);; + +let lemma_component_identity = prove(`!(H:(A)hypermap) x:A y:A. y IN comb_component H x ==> comb_component H x = comb_component H y`, + REPEAT STRIP_TAC + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`; `y:A`] partition_components) + THEN SUBGOAL_THEN `?z:A. z IN comb_component (H:(A)hypermap) (x:A) INTER comb_component (H:(A)hypermap) (y:A)` MP_TAC + THENL[ASSUME_TAC (SPECL[`H:(A)hypermap`; `y:A`] lemma_component_reflect) + THEN EXISTS_TAC `y:A` + THEN ASM_REWRITE_TAC[IN_INTER]; ALL_TAC] + THEN REWRITE_TAC[MEMBER_NOT_EMPTY] + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]));; + + +let lemma_walkup_first_component_eq = prove(`!(H:(A)hypermap) (x:A) (y:A).x IN dart H /\ ~(x IN comb_component H y) ==> comb_component H y = comb_component (edge_walkup H x) y /\ ~(node_map H x IN comb_component H y) /\ ~((inverse (edge_map H)) x IN comb_component H y)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN label_hypermap_TAC `H:(A)hypermap` + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `e = edge_map (H:(A)hypermap)` + THEN ABBREV_TAC `n = node_map (H:(A)hypermap)` + THEN ABBREV_TAC `f = face_map (H:(A)hypermap)` + THEN ABBREV_TAC `D' = dart (edge_walkup (H:(A)hypermap) (x:A))` + THEN ABBREV_TAC `e' = edge_map (edge_walkup (H:(A)hypermap) (x:A))` + THEN ABBREV_TAC `n' = node_map (edge_walkup (H:(A)hypermap) (x:A))` + THEN ABBREV_TAC `f' = face_map (edge_walkup (H:(A)hypermap) (x:A))` + THEN SUBGOAL_THEN `!z:A. z IN comb_component (H:(A)hypermap) (y:A) ==> ~(z = (x:A))` (LABEL_TAC "F3") + THENL[ GEN_TAC THEN STRIP_TAC + THEN REMOVE_THEN "F2" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN SUBST_ALL_TAC + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `!z:A. z IN comb_component (H:(A)hypermap) (y:A) ==> ~(z = (e:A->A) (x:A))` (LABEL_TAC "F4") + THENL[ GEN_TAC THEN (DISCH_THEN (LABEL_TAC "G1")) + THEN REMOVE_THEN "F2" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN STRIP_TAC + THEN MP_TAC (CONJUNCT1(SPECL[`H:(A)hypermap`; `x:A`; `1`] lemma_powers_in_component)) + THEN ASM_REWRITE_TAC[POWER_1] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_component_symmetry) + THEN POP_ASSUM MP_TAC + THEN MESON_TAC[lemma_component_trans]; ALL_TAC] + THEN SUBGOAL_THEN `!z:A. z IN comb_component (H:(A)hypermap) (y:A) ==> ~(z = (n:A->A) (x:A))` (LABEL_TAC "F5") + THENL[ GEN_TAC THEN (DISCH_THEN (LABEL_TAC "G1")) + THEN REMOVE_THEN "F2" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN STRIP_TAC + THEN MP_TAC (CONJUNCT1(CONJUNCT2((SPECL[`H:(A)hypermap`; `x:A`; `1`] lemma_powers_in_component)))) + THEN ASM_REWRITE_TAC[POWER_1] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_component_symmetry) + THEN POP_ASSUM MP_TAC + THEN ASM_MESON_TAC[lemma_component_trans]; ALL_TAC] + THEN SUBGOAL_THEN `!z:A. z IN comb_component (H:(A)hypermap) (y:A) ==> ~(z = (f:A->A) (x:A))` (LABEL_TAC "F6") + THENL[ GEN_TAC THEN (DISCH_THEN (LABEL_TAC "G1")) + THEN REMOVE_THEN "F2" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN STRIP_TAC + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `1`] lemma_powers_in_component))) + THEN ASM_REWRITE_TAC[POWER_1] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_component_symmetry) + THEN POP_ASSUM MP_TAC + THEN ASM_MESON_TAC[lemma_component_trans]; ALL_TAC] + THEN SUBGOAL_THEN `!z:A. z IN comb_component (H:(A)hypermap) (y:A) ==> ~(z = (inverse(e:A->A)) (x:A))` (LABEL_TAC "F7") + THENL[GEN_TAC THEN (DISCH_THEN (LABEL_TAC "G1")) + THEN REMOVE_THEN "F2" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "H1" (fun th1 -> (USE_THEN "H2" (fun th2 -> (MP_TAC (SPEC`x:A` (MATCH_MP INVERSE_EVALUATION (CONJ th1 th2))))))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` SUBST1_TAC) + THEN STRIP_TAC + THEN MP_TAC (CONJUNCT1(SPECL[`H:(A)hypermap`; `x:A`; `j:num`] lemma_powers_in_component)) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_component_symmetry) + THEN POP_ASSUM MP_TAC + THEN MESON_TAC[lemma_component_trans]; ALL_TAC] + THEN SUBGOAL_THEN `!z:A. z IN comb_component (H:(A)hypermap) (y:A) ==> ~(z = (inverse(n:A->A)) (x:A))` (LABEL_TAC "F8") + THENL[GEN_TAC THEN (DISCH_THEN (LABEL_TAC "G1")) + THEN REMOVE_THEN "F2" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "H1" (fun th1 -> (USE_THEN "H3" (fun th2 -> (MP_TAC (SPEC`x:A` (MATCH_MP INVERSE_EVALUATION (CONJ th1 th2))))))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` SUBST1_TAC) + THEN STRIP_TAC + THEN MP_TAC (CONJUNCT1(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `j:num`] lemma_powers_in_component))) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_component_symmetry) + THEN POP_ASSUM MP_TAC + THEN MESON_TAC[lemma_component_trans]; ALL_TAC] + THEN SUBGOAL_THEN `!z:A. z IN comb_component (H:(A)hypermap) (y:A) ==> ~(z = (inverse(f:A->A)) (x:A))` (LABEL_TAC "F8f") + THENL[GEN_TAC THEN (DISCH_THEN (LABEL_TAC "G1")) + THEN REMOVE_THEN "F2" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "H1" (fun th1 -> (USE_THEN "H4" (fun th2 -> (MP_TAC (SPEC`x:A` (MATCH_MP INVERSE_EVALUATION (CONJ th1 th2))))))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` SUBST1_TAC) + THEN STRIP_TAC + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `j:num`] lemma_powers_in_component))) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_component_symmetry) + THEN POP_ASSUM MP_TAC + THEN MESON_TAC[lemma_component_trans]; ALL_TAC] + THEN SUBGOAL_THEN `~((n:A->A) (x:A) IN comb_component (H:(A)hypermap) (y:A))` ASSUME_TAC + THENL[USE_THEN "F2" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN STRIP_TAC + THEN USE_THEN "F5" (MP_TAC o SPEC `(n:A->A) (x:A)`) + THEN POP_ASSUM(fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM(fun th -> REWRITE_TAC[th]) + THEN SUBGOAL_THEN `~((inverse(e:A->A)) (x:A) IN comb_component (H:(A)hypermap) (y:A))` ASSUME_TAC + THENL[USE_THEN "F2" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN STRIP_TAC + THEN USE_THEN "F7" (MP_TAC o SPEC `(inverse(e:A->A)) (x:A)`) + THEN POP_ASSUM(fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[comb_component; is_in_component; EXTENSION; IN_ELIM_THM] + THEN GEN_TAC + THEN EQ_TAC + THENL[DISCH_THEN (X_CHOOSE_THEN `p:num->A` (X_CHOOSE_THEN `m:num` (CONJUNCTS_THEN2 (LABEL_TAC "F9") (CONJUNCTS_THEN2 (LABEL_TAC "F10") (LABEL_TAC "F11"))))) + THEN EXISTS_TAC `p:num->A` + THEN EXISTS_TAC `m:num` + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[lemma_def_path] + THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F12") + THEN USE_THEN "F11" MP_TAC + THEN REWRITE_TAC[lemma_def_path] + THEN DISCH_THEN (MP_TAC o SPEC `i:num`) + THEN USE_THEN "F12" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F11" (MP_TAC o SPEC `i:num` o MATCH_MP lemma_subpath) + THEN USE_THEN "F12" (fun th -> (REWRITE_TAC[MATCH_MP LT_IMP_LE th])) + THEN DISCH_TAC + THEN SUBGOAL_THEN `(p:num->A) (i:num) IN comb_component (H:(A)hypermap) (y:A)` (LABEL_TAC "F14") + THENL[REWRITE_TAC[comb_component; IN_ELIM_THM] + THEN REWRITE_TAC[is_in_component] + THEN EXISTS_TAC `p:num->A` + THEN EXISTS_TAC `i:num` + THEN ASM_SIMP_TAC[]; ALL_TAC] + THEN REPLICATE_TAC 7 (FIRST_X_ASSUM(MP_TAC o (SPEC `(p:num->A) (i:num)`) o check(is_forall o concl))) + THEN ASM_REWRITE_TAC[] + THEN REPLICATE_TAC 7 STRIP_TAC + THEN REWRITE_TAC[go_one_step] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `(p:num->A) (i:num)`] edge_map_walkup)))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `(p:num->A) (i:num)`] node_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `(p:num->A) (i:num)`] face_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC THEN SIMP_TAC[]; ALL_TAC] + THEN DISCH_THEN (X_CHOOSE_THEN `p:num->A` (X_CHOOSE_THEN `m:num` (CONJUNCTS_THEN2 (LABEL_TAC "F9") (CONJUNCTS_THEN2 (LABEL_TAC "F10") (LABEL_TAC "F11"))))) + THEN EXISTS_TAC `p:num->A` THEN EXISTS_TAC `m:num` + THEN ASM_REWRITE_TAC[] + THEN SUBGOAL_THEN `!k:num. k <= m ==> is_path (H:(A)hypermap) (p:num->A) k` ASSUME_TAC + THENL[INDUCT_TAC THENL[REWRITE_TAC[is_path]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F12") + THEN DISCH_THEN (LABEL_TAC "F14") + THEN REMOVE_THEN "F12" MP_TAC + THEN USE_THEN "F14" (fun th-> (REWRITE_TAC[MP (ARITH_RULE `SUC (k:num) <= m:num ==> k <= m`) th])) + THEN REWRITE_TAC[is_path] + THEN DISCH_THEN (LABEL_TAC "F15") + THEN REWRITE_TAC[is_path] + THEN USE_THEN "F15" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F11" (MP_TAC o SPEC `SUC (k:num)` o MATCH_MP lemma_subpath) + THEN USE_THEN "F14" (fun th -> (REWRITE_TAC[th])) + THEN REWRITE_TAC[is_path] + THEN DISCH_THEN (MP_TAC o CONJUNCT2) + THEN SUBGOAL_THEN `(p:num->A) (k:num) IN comb_component (H:(A)hypermap) (y:A)` (LABEL_TAC "F16") + THENL[REWRITE_TAC[comb_component; IN_ELIM_THM] + THEN REWRITE_TAC[is_in_component] + THEN EXISTS_TAC `p:num->A` + THEN EXISTS_TAC `k:num` + THEN ASM_SIMP_TAC[]; ALL_TAC] + THEN REPLICATE_TAC 7 (FIRST_X_ASSUM(MP_TAC o (SPEC `(p:num->A) (k:num)`) o check(is_forall o concl))) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN REPLICATE_TAC 7 STRIP_TAC + THEN REWRITE_TAC[go_one_step] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `(p:num->A) (k:num)`] edge_map_walkup)))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `(p:num->A) (k:num)`] node_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `(p:num->A) (k:num)`] face_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN SIMP_TAC[]; ALL_TAC] + THEN POP_ASSUM (MP_TAC o SPEC `m:num`) THEN REWRITE_TAC[LE_REFL]);; + +let lemma_walkup_second_component_eq = prove(`!(H:(A)hypermap) (x:A) (y:A).x IN dart H /\ y IN dart H /\ ~(y = x) /\ ~((inverse (edge_map H)) x IN comb_component (edge_walkup H x) y) /\ ~(node_map H x IN comb_component (edge_walkup H x) y) ==> comb_component H y = comb_component (edge_walkup H x) y /\ ~(y IN comb_component H x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5"))))) + THEN label_hypermap_TAC `H:(A)hypermap` + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `e = edge_map (H:(A)hypermap)` + THEN ABBREV_TAC `n = node_map (H:(A)hypermap)` + THEN ABBREV_TAC `f = face_map (H:(A)hypermap)` + THEN ABBREV_TAC `D' = dart (edge_walkup (H:(A)hypermap) (x:A))` + THEN ABBREV_TAC `e' = edge_map (edge_walkup (H:(A)hypermap) (x:A))` + THEN ABBREV_TAC `n' = node_map (edge_walkup (H:(A)hypermap) (x:A))` + THEN ABBREV_TAC `f' = face_map (edge_walkup (H:(A)hypermap) (x:A))` + THEN ABBREV_TAC `G = edge_walkup (H:(A)hypermap) (x:A)` + THEN MP_TAC (CONJUNCT1(SPECL[`H:(A)hypermap`; `x:A`] lemma_edge_walkup)) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "F6") + THEN MP_TAC (SPEC `edge_walkup (H:(A)hypermap) (x:A)` hypermap_lemma) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "W1") (CONJUNCTS_THEN2 (LABEL_TAC "W2") (CONJUNCTS_THEN2 (LABEL_TAC "W3") (LABEL_TAC "W4" o CONJUNCT1)))) + THEN SUBGOAL_THEN `(y:A) IN ((D:A->bool) DELETE (x:A))` (LABEL_TAC "F7") + THENL[ASM_ASM_SET_TAC; ALL_TAC] + THEN SUBGOAL_THEN `!z:A. z IN comb_component (G:(A)hypermap) (y:A) ==> ~(z = (x:A))` (LABEL_TAC "F8") + THENL[GEN_TAC THEN STRIP_TAC + THEN MP_TAC (SPECL[`G:(A)hypermap`; `y:A`] lemma_component_subset) + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[SUBSET] + THEN DISCH_THEN (MP_TAC o SPEC `z:A`) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th; IN_DELETE]) + THEN SIMP_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `!z:A. z IN comb_component (G:(A)hypermap) (y:A) ==> ~(z = (n:A->A) (x:A))` (LABEL_TAC "F9") + THENL[GEN_TAC THEN (DISCH_THEN (LABEL_TAC "G1")) + THEN REMOVE_THEN "F5" MP_TAC THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `!z:A. z IN comb_component (G:(A)hypermap) (y:A) ==> ~(z = (inverse(e:A->A)) (x:A))` (LABEL_TAC "F10") + THENL[GEN_TAC THEN (DISCH_THEN (LABEL_TAC "G1")) + THEN REMOVE_THEN "F4" MP_TAC THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `!z:A. z IN comb_component (G:(A)hypermap) (y:A) ==> ~(z = (inverse(n:A->A)) (x:A))` (LABEL_TAC "F11") + THENL[ GEN_TAC THEN (DISCH_THEN (LABEL_TAC "G1")) + THEN REMOVE_THEN "F5" MP_TAC THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN (MP_TAC o AP_TERM `node_map (edge_walkup (H:(A)hypermap) (x:A))`) + THEN EXPAND_TAC "n" + THEN REWRITE_TAC[node_map_walkup] + THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC (CONJUNCT1(CONJUNCT2(SPECL[`G:(A)hypermap`; `z:A`; `1`] lemma_powers_in_component))) + THEN ASM_REWRITE_TAC[POWER_1] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP lemma_component_identity th]); ALL_TAC] + THEN SUBGOAL_THEN `!z:A. z IN comb_component (G:(A)hypermap) (y:A) ==> ~(z = (inverse(f:A->A)) (x:A))` (LABEL_TAC "F12") + THENL[GEN_TAC THEN (DISCH_THEN (LABEL_TAC "G1")) + THEN REMOVE_THEN "F4" MP_TAC THEN REWRITE_TAC[CONTRAPOS_THM] + THEN ASM_CASES_TAC `(inverse(f:A->A)) (x:A) = x` + THENL[POP_ASSUM SUBST1_TAC + THEN USE_THEN "F8" (MP_TAC o SPEC `z:A`) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN SIMP_TAC[]; ALL_TAC] + THEN ASM_CASES_TAC `inverse(e:A->A) (x:A) = x` + THENL[USE_THEN "H2" (MP_TAC o SPEC `x:A` o MATCH_MP fixed_point_lemma) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN EXPAND_TAC "e" + THEN REWRITE_TAC[lemma_edge_degenerate] + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN ASSUME_TAC + THEN DISCH_THEN (MP_TAC o AP_TERM `f':A->A`) + THEN MP_TAC (CONJUNCT1(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `x:A`] face_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_TAC + THEN MP_TAC(CONJUNCT2(CONJUNCT2(SPECL[`G:(A)hypermap`; `z:A`; `1`] lemma_powers_in_component))) + THEN ASM_REWRITE_TAC[POWER_1] + THEN USE_THEN "G1" (fun th1 -> (DISCH_THEN (fun th2 -> (MP_TAC (MATCH_MP lemma_component_trans (CONJ th1 th2)))))) + THEN DISCH_TAC + THEN USE_THEN "F11" (MP_TAC o SPEC `(inverse (n:A->A)) (x:A)`) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN MP_TAC (CONJUNCT1(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `x:A`] edge_map_walkup)))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN DISCH_THEN (fun th1 -> (USE_THEN "W2" (fun th2 -> (MP_TAC (MATCH_MP inverse_function (CONJ th2 (SYM th1))))))) + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC(CONJUNCT1(SPECL[`G:(A)hypermap`; `z:A`; `1`] lemma_inverses_in_component)) + THEN ASM_REWRITE_TAC[] + THEN USE_THEN "G1" MP_TAC + THEN MESON_TAC[lemma_component_trans]; ALL_TAC] + THEN SUBGOAL_THEN `comb_component (H:(A)hypermap) (y:A) = comb_component (G:(A)hypermap) (y:A)` (LABEL_TAC "FF") + THENL[REWRITE_TAC[comb_component; is_in_component; EXTENSION; IN_ELIM_THM] + THEN GEN_TAC THEN EQ_TAC + THENL[DISCH_THEN (X_CHOOSE_THEN `p:num->A` (X_CHOOSE_THEN `m:num` (CONJUNCTS_THEN2 (LABEL_TAC "F14") (CONJUNCTS_THEN2 (LABEL_TAC "F15") (LABEL_TAC "F16"))))) + THEN EXISTS_TAC `p:num->A` THEN EXISTS_TAC `m:num` + THEN ASM_REWRITE_TAC[] + THEN SUBGOAL_THEN `!k:num. k <= m:num ==> is_path (G:(A)hypermap) (p:num->A) k` ASSUME_TAC + THENL[INDUCT_TAC THENL[REWRITE_TAC[is_path]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "G4") + THEN DISCH_THEN (LABEL_TAC "G5") + THEN REMOVE_THEN "G4" MP_TAC + THEN USE_THEN "G5" (fun th -> (REWRITE_TAC[MATCH_MP (ARITH_RULE `SUC (k:num) <= m ==> k <= m`) th])) + THEN DISCH_THEN (LABEL_TAC "G6") + THEN USE_THEN "F16" (MP_TAC o SPEC `SUC (k:num)` o MATCH_MP lemma_subpath) + THEN ASM_REWRITE_TAC[is_path] + THEN DISCH_THEN (MP_TAC o CONJUNCT2) + THEN ABBREV_TAC `z:A = (p:num->A) (k:num)` + THEN SUBGOAL_THEN `(z:A) IN comb_component (G:(A)hypermap) (y:A)` (LABEL_TAC "G7") + THENL[REWRITE_TAC[comb_component;IN_ELIM_THM] (*NOTE*) + THEN REWRITE_TAC[is_in_component] + THEN EXISTS_TAC `p:num->A` + THEN EXISTS_TAC `k:num` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN REPLICATE_TAC 5 (FIRST_X_ASSUM(MP_TAC o (SPEC `(p:num->A) (k:num)`) o check(is_forall o concl))) + THEN ASM_REWRITE_TAC[] THEN REPLICATE_TAC 5 STRIP_TAC + THEN REWRITE_TAC[go_one_step] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `(p:num->A) (k:num)`] edge_map_walkup)))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `(p:num->A) (k:num)`] node_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `(p:num->A) (k:num)`] face_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC THEN SIMP_TAC[]; ALL_TAC] + THEN POP_ASSUM (MP_TAC o SPEC `m:num`) + THEN SIMP_TAC[LE_REFL]; ALL_TAC] + THEN DISCH_THEN (X_CHOOSE_THEN `p:num->A` (X_CHOOSE_THEN `m:num` (CONJUNCTS_THEN2 (LABEL_TAC "F14") (CONJUNCTS_THEN2 (LABEL_TAC "F15") (LABEL_TAC "F16"))))) + THEN EXISTS_TAC `p:num->A` THEN EXISTS_TAC `m:num` + THEN ASM_REWRITE_TAC[] + THEN SUBGOAL_THEN `!k:num. k <= m ==> is_path (H:(A)hypermap) (p:num->A) k` ASSUME_TAC + THENL[INDUCT_TAC THENL[REWRITE_TAC[is_path]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F17") + THEN DISCH_THEN (LABEL_TAC "F18") + THEN REMOVE_THEN "F17" MP_TAC + THEN USE_THEN "F18" (fun th-> (REWRITE_TAC[MP (ARITH_RULE `SUC (k:num) <= m:num ==> k <= m`) th])) + THEN REWRITE_TAC[is_path] + THEN DISCH_THEN (LABEL_TAC "F19") + THEN USE_THEN "F19" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F16" (MP_TAC o SPEC `SUC (k:num)` o MATCH_MP lemma_subpath) + THEN ASM_REWRITE_TAC[is_path] + THEN DISCH_THEN (fun th -> (LABEL_TAC "F20" (CONJUNCT1 th) THEN (MP_TAC(CONJUNCT2 th)))) + THEN SUBGOAL_THEN `(p:num->A) (k:num) IN comb_component (G:(A)hypermap) (y:A)` (LABEL_TAC "F21") + THENL[REWRITE_TAC[comb_component; IN_ELIM_THM] + THEN REWRITE_TAC[is_in_component] + THEN EXISTS_TAC `p:num->A` THEN EXISTS_TAC `k:num` THEN ASM_SIMP_TAC[]; ALL_TAC] + THEN REPLICATE_TAC 5 (FIRST_X_ASSUM(MP_TAC o (SPEC `(p:num->A) (k:num)`) o check(is_forall o concl))) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN REPLICATE_TAC 5 STRIP_TAC + THEN REWRITE_TAC[go_one_step] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `(p:num->A) (k:num)`] edge_map_walkup)))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `(p:num->A) (k:num)`] node_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `(p:num->A) (k:num)`] face_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC THEN SIMP_TAC[]; ALL_TAC] + THEN POP_ASSUM (MP_TAC o SPEC `m:num`) THEN REWRITE_TAC[LE_REFL]; ALL_TAC] + THEN USE_THEN "FF" (fun th -> REWRITE_TAC[th]) + THEN ONCE_REWRITE_TAC[TAUT `~pp <=> (pp ==> F)`] + THEN DISCH_THEN (ASSUME_TAC o MATCH_MP lemma_component_symmetry) + THEN USE_THEN "F8" (MP_TAC o SPEC `x:A`) + THEN USE_THEN "FF" (SUBST1_TAC o SYM) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]));; + +let lemma_walkup_components = prove(`!(H:(A)hypermap) (x:A). x IN dart H ==> set_of_components H DELETE comb_component H x = set_of_components (edge_walkup H x) DIFF {comb_component (edge_walkup H x) (node_map H x), comb_component (edge_walkup H x) ((inverse (edge_map H)) x)}`, + REPEAT GEN_TAC + THEN REWRITE_TAC[set_of_components] + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `D' = dart (edge_walkup (H:(A)hypermap) (x:A))` + THEN REWRITE_TAC[set_part_components] + THEN DISCH_THEN (LABEL_TAC "F1") + THEN REWRITE_TAC[SET_RULE `s DIFF {a, b} = (s DELETE a) DELETE b`] + THEN REWRITE_TAC[EXTENSION] + THEN GEN_TAC + THEN EQ_TAC + THENL[REWRITE_TAC[IN_DELETE; IN_ELIM_THM] + THEN DISCH_THEN (CONJUNCTS_THEN2 (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) (LABEL_TAC "F4")) + THEN REMOVE_THEN "F3" SUBST_ALL_TAC + THEN SUBGOAL_THEN `~(x:A IN comb_component (H:(A)hypermap) (y:A))` (LABEL_TAC "F5") + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN MESON_TAC[lemma_component_identity]; ALL_TAC] + THEN MP_TAC(SPECL[`H:(A)hypermap`; `x:A`; `y:A`] lemma_walkup_first_component_eq) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F6") (CONJUNCTS_THEN2 (LABEL_TAC "F7") (LABEL_TAC "F8"))) + THEN SUBGOAL_THEN `~(comb_component (H:(A)hypermap) (y:A) = comb_component (edge_walkup H (x:A)) (inverse (edge_map H) x))` ASSUME_TAC + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_TAC + THEN MP_TAC(SPECL[`edge_walkup (H:(A)hypermap) (x:A)`; `(inverse (edge_map (H:(A)hypermap))) (x:A)`] lemma_component_reflect) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN STRIP_TAC + THENL[EXISTS_TAC `y:A` + THEN MP_TAC (CONJUNCT1(SPECL[`H:(A)hypermap`; `x:A`] lemma_edge_walkup)) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN ASM_ASM_SET_TAC; ALL_TAC] + THEN USE_THEN "F7" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_TAC + THEN MP_TAC(SPECL[`edge_walkup (H:(A)hypermap) (x:A)`; `node_map (H:(A)hypermap) (x:A)`] lemma_component_reflect) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN REWRITE_TAC[IN_DELETE; IN_ELIM_THM] + THEN DISCH_THEN (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) (LABEL_TAC "F4")) (LABEL_TAC "F5")) + THEN REMOVE_THEN "F3" SUBST_ALL_TAC + THEN SUBGOAL_THEN `~((node_map (H:(A)hypermap)) (x:A) IN comb_component (edge_walkup (H:(A)hypermap) (x:A)) (y:A))` (LABEL_TAC "F6") + THENL[USE_THEN "F4" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN MESON_TAC[lemma_component_identity]; ALL_TAC] + THEN SUBGOAL_THEN `~((inverse (edge_map (H:(A)hypermap))) (x:A) IN comb_component (edge_walkup (H:(A)hypermap) (x:A)) (y:A))` (LABEL_TAC "F7") + THENL[USE_THEN "F5" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN MESON_TAC[lemma_component_identity]; ALL_TAC] + THEN MP_TAC (CONJUNCT1(SPECL[`H:(A)hypermap`; `x:A`] lemma_edge_walkup)) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST_ALL_TAC + THEN USE_THEN "F2" MP_TAC + THEN REWRITE_TAC[IN_DELETE] + THEN STRIP_TAC + THEN MP_TAC(SPECL[`H:(A)hypermap`; `x:A`; `y:A`] lemma_walkup_second_component_eq) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F8") (LABEL_TAC "F9")) + THEN STRIP_TAC + THENL[EXISTS_TAC `y:A` + THEN USE_THEN "F8" (SUBST1_TAC o SYM) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN USE_THEN "F8" (SUBST1_TAC o SYM) + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN REWRITE_TAC[lemma_component_reflect]);; + + +(* walkup at an edge-degenerate point *) + +let edge_degenerate_walkup_edge_map = prove(`!(H:(A)hypermap) x:A y:A. x IN dart H /\ edge_map H x = x ==> edge_map (edge_walkup H x) y = edge_map H y`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN ASM_CASES_TAC `y:A = x:A` + THENL[ASM_REWRITE_TAC[edge_map_walkup]; ALL_TAC] + THEN label_hypermap4_TAC `edge_walkup (H:(A)hypermap) (x:A)` + THEN ASM_CASES_TAC `y:A = (node_map (H:(A)hypermap)) (x:A)` + THENL[POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[CONJUNCT1(SPEC `edge_walkup (H:(A)hypermap) (x:A)` inverse2_hypermap_maps); o_THM] + THEN GEN_REWRITE_TAC (RAND_CONV o DEPTH_CONV) [GSYM o_THM] + THEN REWRITE_TAC[GSYM inverse_hypermap_maps] + THEN USE_THEN "H3" (fun th1 -> (USE_THEN "H4" (fun th2 -> (MP_TAC (SPECL[`node_map (H:(A)hypermap) (x:A)`; `(inverse(face_map (H:(A)hypermap))) (x:A)`] (MATCH_MP aux_permutes_conversion (CONJ th2 th1))))))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN REWRITE_TAC[face_map_walkup] + THEN USE_THEN "F2" MP_TAC + THEN REWRITE_TAC[lemma_edge_degenerate] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[node_map_walkup]; ALL_TAC] + THEN MP_TAC (SPECL[`dart (H:(A)hypermap)`; `edge_map (H:(A)hypermap)`] fixed_point_lemma) + THEN REWRITE_TAC[SPEC `H:(A)hypermap` hypermap_lemma] + THEN DISCH_THEN (MP_TAC o SPEC `x:A`) + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[th]) + THEN DISCH_TAC + THEN MP_TAC(CONJUNCT2(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `y:A`] edge_map_walkup)))) + THEN ASM_REWRITE_TAC[]);; + +(* walkup at a node-degenerate point *) + +let node_degenerate_walkup_node_map = prove(`!(H:(A)hypermap) x:A y:A. x IN dart H /\ node_map H x = x ==> node_map (edge_walkup H x) y = node_map H y`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN ASM_CASES_TAC `y:A = x:A` + THENL[ASM_REWRITE_TAC[node_map_walkup]; ALL_TAC] + THEN MP_TAC (SPECL[`dart (H:(A)hypermap)`; `node_map (H:(A)hypermap)`] fixed_point_lemma) + THEN REWRITE_TAC[SPEC `H:(A)hypermap` hypermap_lemma] + THEN DISCH_THEN (MP_TAC o SPEC `x:A`) + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[th]) + THEN DISCH_TAC + THEN MP_TAC(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `y:A`] node_map_walkup))) + THEN ASM_REWRITE_TAC[]);; + +let node_degenerate_walkup_edge_map = prove(`!(H:(A)hypermap) x:A. x IN dart H /\ node_map H x = x ==> (edge_map (edge_walkup H x) x = x) /\ (edge_map (edge_walkup H x) ((inverse (edge_map H)) x) = edge_map H x) /\ (!y:A. ~(y = x) /\ ~(y = (inverse (edge_map H)) x) ==> edge_map (edge_walkup H x) y = edge_map H y)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN REWRITE_TAC[edge_map_walkup] + THEN STRIP_TAC + THENL[label_hypermap4_TAC `edge_walkup (H:(A)hypermap) (x:A)` + THEN USE_THEN "F2" MP_TAC + THEN REWRITE_TAC[lemma_node_degenerate] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[CONJUNCT1(SPEC `edge_walkup (H:(A)hypermap) (x:A)` inverse2_hypermap_maps); o_THM] + THEN USE_THEN "H3" (fun th1 -> (USE_THEN "H4" (fun th2 -> (MP_TAC (SPECL[`inverse(edge_map (H:(A)hypermap)) (x:A)`; `(inverse(face_map (H:(A)hypermap))) (x:A)`] (MATCH_MP aux_permutes_conversion (CONJ th2 th1))))))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN REWRITE_TAC[face_map_walkup] + THEN ASM_CASES_TAC `face_map (H:(A)hypermap) (x:A) = x` + THENL[MP_TAC(CONJUNCT1(SPEC `H:(A)hypermap` inverse_hypermap_maps)) + THEN DISCH_THEN (fun th -> (MP_TAC (AP_THM th `x:A`))) + THEN ASM_REWRITE_TAC[o_THM] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[node_map_walkup]; ALL_TAC] + THEN MP_TAC (SPECL[`dart (H:(A)hypermap)`; `node_map (H:(A)hypermap)`] fixed_point_lemma) + THEN REWRITE_TAC[SPEC `H:(A)hypermap` hypermap_lemma] + THEN DISCH_THEN (MP_TAC o SPEC `x:A`) + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[th]) + THEN DISCH_TAC + THEN MP_TAC(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `face_map (H:(A)hypermap) (x:A)`] node_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV) [GSYM o_THM] + THEN REWRITE_TAC[inverse_hypermap_maps]; ALL_TAC] + THEN REPEAT STRIP_TAC + THEN MP_TAC(CONJUNCT2(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `y:A`] edge_map_walkup)))) + THEN ASM_REWRITE_TAC[]);; + +(* walkup at a face-degenerate point *) + +let face_degenerate_walkup_face_map = prove(`!(H:(A)hypermap) x:A y:A. x IN dart H /\ face_map H x = x ==> face_map (edge_walkup H x) y = face_map H y`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN ASM_CASES_TAC `y:A = x:A` + THENL[ASM_REWRITE_TAC[face_map_walkup]; ALL_TAC] + THEN MP_TAC (SPECL[`dart (H:(A)hypermap)`; `face_map (H:(A)hypermap)`] fixed_point_lemma) + THEN REWRITE_TAC[SPEC `H:(A)hypermap` hypermap_lemma] + THEN DISCH_THEN (MP_TAC o SPEC `x:A`) + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[th]) + THEN DISCH_TAC + THEN MP_TAC(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `y:A`] face_map_walkup))) + THEN ASM_REWRITE_TAC[]);; + + +let face_degenerate_walkup_edge_map = prove(`!(H:(A)hypermap) x:A. x IN dart H /\ face_map H x = x ==> (edge_map (edge_walkup H x) x = x) /\ (edge_map (edge_walkup H x) ((inverse (edge_map H)) x) = edge_map H x) /\ (!y:A. ~(y = x) /\ ~(y = (inverse (edge_map H)) x) ==> edge_map (edge_walkup H x) y = edge_map H y)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN REWRITE_TAC[edge_map_walkup] + THEN USE_THEN "F2" MP_TAC + THEN REWRITE_TAC[lemma_face_degenerate] + THEN DISCH_THEN (LABEL_TAC "FG") + THEN STRIP_TAC + THENL[label_hypermap4_TAC `edge_walkup (H:(A)hypermap) (x:A)` + THEN USE_THEN "FG" (SUBST1_TAC o SYM) + THEN USE_THEN "F2" MP_TAC + THEN MP_TAC (SPECL[`dart (H:(A)hypermap)`; `face_map (H:(A)hypermap)`] fixed_point_lemma) + THEN REWRITE_TAC[SPEC `H:(A)hypermap` hypermap_lemma] + THEN DISCH_THEN (MP_TAC o SPEC `x:A`) + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F3") + THEN ASM_CASES_TAC `node_map (H:(A)hypermap) (x:A) = x` + THENL[USE_THEN "FG" (MP_TAC o SYM) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_TAC + THEN MP_TAC (SPECL[`dart (H:(A)hypermap)`; `edge_map (H:(A)hypermap)`] fixed_point_lemma) + THEN REWRITE_TAC[SPEC `H:(A)hypermap` hypermap_lemma] + THEN DISCH_THEN (MP_TAC o SPEC `x:A`) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[edge_map_walkup]; ALL_TAC] + THEN REWRITE_TAC[CONJUNCT1(SPEC `edge_walkup (H:(A)hypermap) (x:A)` inverse2_hypermap_maps); o_THM] + THEN USE_THEN "H3" (fun th1 -> (USE_THEN "H4" (fun th2 -> (MP_TAC (SPECL[`node_map (H:(A)hypermap) (x:A)`; `(edge_map (H:(A)hypermap)) (x:A)`] (MATCH_MP aux_permutes_conversion (CONJ th2 th1))))))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN SUBGOAL_THEN `~(edge_map (H:(A)hypermap) (x:A) = x)` ASSUME_TAC + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN ASSUME_TAC + THEN MP_TAC (SPECL[`dart (H:(A)hypermap)`; `edge_map (H:(A)hypermap)`] fixed_point_lemma) + THEN REWRITE_TAC[SPEC `H:(A)hypermap` hypermap_lemma] + THEN DISCH_THEN (MP_TAC o SPEC `x:A`) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "FG" (fun th -> REWRITE_TAC[SYM th]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `edge_map (H:(A)hypermap) (x:A)`] face_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o DEPTH_CONV) [GSYM o_THM] + THEN REWRITE_TAC[GSYM inverse_hypermap_maps] + THEN ASM_REWRITE_TAC[node_map_walkup]; ALL_TAC] + THEN REPEAT STRIP_TAC + THEN MP_TAC(CONJUNCT2(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `y:A`] edge_map_walkup)))) + THEN ASM_REWRITE_TAC[]);; + + +(* WALKUP AT A DEGENERATE DART: THREE WALKUPS ARE EQUAL *) + + +let edge_degenerate_walkup_first_eq = prove(`!(H:(A)hypermap) x:A.x IN dart H /\ edge_map H x = x ==> node_walkup H x = edge_walkup H x`, + REPEAT GEN_TAC + THEN label_4Gs_TAC (SPEC `H:(A)hypermap` shift_lemma) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN USE_THEN "F1" MP_TAC + THEN USE_THEN "G1" SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "F3") + THEN USE_THEN "F2" MP_TAC + THEN USE_THEN "G2" SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "F4") + THEN ONCE_REWRITE_TAC[lemma_hypermap_eq] + THEN REWRITE_TAC[node_walkup] + THEN ONCE_REWRITE_TAC[GSYM double_shift_lemma] + THEN STRIP_TAC + THENL[REWRITE_TAC[lemma_edge_walkup] + THEN USE_THEN "G1" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN STRIP_TAC + THENL[ REWRITE_TAC[FUN_EQ_THM] + THEN STRIP_TAC + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`; `x':A`] edge_degenerate_walkup_edge_map) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC (SPECL[`shift (H:(A)hypermap)`; `x:A`; `x':A`] face_degenerate_walkup_face_map) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN STRIP_TAC + THENL[REWRITE_TAC[FUN_EQ_THM] + THEN STRIP_TAC + THEN ASM_CASES_TAC `x':A = (inverse (node_map (H:(A)hypermap))) (x:A)` + THENL[ POP_ASSUM (LABEL_TAC "G1") + THEN USE_THEN "G1" (fun th -> (GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [th])) + THEN REWRITE_TAC[node_map_walkup] + THEN POP_ASSUM MP_TAC + THEN USE_THEN "G3" SUBST1_TAC + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F3" (fun th1 -> (USE_THEN "F4" (fun th2 -> (MP_TAC ( CONJUNCT1(CONJUNCT2(MATCH_MP face_degenerate_walkup_edge_map (CONJ th1 th2)))))))) + THEN DISCH_THEN SUBST1_TAC + THEN SIMP_TAC[]; ALL_TAC] + THEN ASM_CASES_TAC `x':A = x:A` + THENL[ POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[edge_map_walkup; node_map_walkup]; ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `x':A`] node_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F3" (fun th1 -> (USE_THEN "F4" (fun th2 -> (MP_TAC ( CONJUNCT2(CONJUNCT2(MATCH_MP face_degenerate_walkup_edge_map (CONJ th1 th2)))))))) + THEN DISCH_THEN (MP_TAC o SPEC `x':A`) + THEN USE_THEN "G3" (SUBST1_TAC o SYM) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN REWRITE_TAC[FUN_EQ_THM] + THEN STRIP_TAC + THEN ASM_CASES_TAC `x':A = (inverse (face_map (H:(A)hypermap))) (x:A)` + THENL[POP_ASSUM (LABEL_TAC "G1") + THEN USE_THEN "G1" (fun th -> (GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [th])) + THEN REWRITE_TAC[face_map_walkup] + THEN POP_ASSUM MP_TAC + THEN USE_THEN "G4" SUBST1_TAC + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[node_map_walkup]; ALL_TAC] + THEN ASM_CASES_TAC `x':A = x:A` + THENL[POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[face_map_walkup; node_map_walkup]; ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `x':A`] face_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`shift (H:(A)hypermap)`; `x:A`; `x':A`] node_map_walkup))) + THEN USE_THEN "G4" (fun th -> REWRITE_TAC[SYM th]) + THEN ASM_REWRITE_TAC[]);; + + +let edge_degenerate_walkup_second_eq = prove(`!(H:(A)hypermap) x:A.x IN dart H /\ edge_map H x = x ==> face_walkup H x = edge_walkup H x`, + REPEAT GEN_TAC + THEN label_4Gs_TAC (SPEC `H:(A)hypermap` double_shift_lemma) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN USE_THEN "F1" MP_TAC + THEN USE_THEN "G1" SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "F3") + THEN USE_THEN "F2" MP_TAC + THEN USE_THEN "G2" SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "F4") + THEN ONCE_REWRITE_TAC[lemma_hypermap_eq] + THEN REWRITE_TAC[face_walkup] + THEN ONCE_REWRITE_TAC[GSYM shift_lemma] + THEN STRIP_TAC + THENL[REWRITE_TAC[lemma_edge_walkup] + THEN USE_THEN "G1" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN STRIP_TAC + THENL[REWRITE_TAC[FUN_EQ_THM] + THEN STRIP_TAC + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`; `x':A`] edge_degenerate_walkup_edge_map) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC (SPECL[`shift(shift (H:(A)hypermap))`; `x:A`; `x':A`] node_degenerate_walkup_node_map) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN STRIP_TAC + THENL[REWRITE_TAC[FUN_EQ_THM] + THEN STRIP_TAC + THEN ASM_CASES_TAC `x':A = (inverse (node_map (H:(A)hypermap))) (x:A)` + THENL[POP_ASSUM (LABEL_TAC "G1") + THEN USE_THEN "G1" (fun th -> (GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [th])) + THEN REWRITE_TAC[node_map_walkup] + THEN POP_ASSUM MP_TAC + THEN USE_THEN "G3" SUBST1_TAC + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[face_map_walkup]; ALL_TAC] + THEN ASM_CASES_TAC `x':A = x:A` + THENL[POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[face_map_walkup; node_map_walkup]; ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `x':A`] node_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`shift(shift(H:(A)hypermap))`; `x:A`; `x':A`] face_map_walkup))) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN REMOVE_THEN "G3" (SUBST1_TAC o SYM) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN REWRITE_TAC[FUN_EQ_THM] THEN STRIP_TAC + THEN ASM_CASES_TAC `x':A = x:A` + THENL[POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[face_map_walkup; edge_map_walkup]; ALL_TAC] + THEN ASM_CASES_TAC `x':A = (inverse (face_map (H:(A)hypermap))) (x:A)` + THENL[POP_ASSUM (LABEL_TAC "G1") + THEN USE_THEN "G1" (fun th -> (GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [th])) + THEN REWRITE_TAC[face_map_walkup] + THEN POP_ASSUM MP_TAC + THEN USE_THEN "G4" SUBST1_TAC + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F3" (fun th1 -> (USE_THEN "F4" (fun th2 -> (MP_TAC (CONJUNCT1(CONJUNCT2(MATCH_MP node_degenerate_walkup_edge_map (CONJ th1 th2)))))))) + THEN SIMP_TAC[]; ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN USE_THEN "G4" SUBST1_TAC + THEN DISCH_TAC + THEN USE_THEN "F3" (fun th1 -> (USE_THEN "F4" (fun th2 -> (MP_TAC (CONJUNCT2(CONJUNCT2(MATCH_MP node_degenerate_walkup_edge_map (CONJ th1 th2)))))))) + THEN DISCH_THEN (MP_TAC o SPEC `x':A`) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "G4" (SUBST1_TAC o SYM) + THEN POP_ASSUM MP_TAC + THEN USE_THEN "G4" (SUBST1_TAC o SYM) + THEN DISCH_TAC + THEN MP_TAC(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `x':A`] face_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN SIMP_TAC[]);; + + +let edge_degenerate_walkup_third_eq = prove(`!(H:(A)hypermap) x:A.x IN dart H /\ edge_map H x = x ==> node_walkup H x = face_walkup H x`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN USE_THEN "F1" (MP_TAC o MATCH_MP edge_degenerate_walkup_first_eq) + THEN DISCH_THEN SUBST1_TAC + THEN CONV_TAC SYM_CONV + THEN MATCH_MP_TAC edge_degenerate_walkup_second_eq + THEN ASM_REWRITE_TAC[]);; + +let lemma_shift_cycle = prove(`!(H:(A)hypermap). shift (shift (shift H)) = H`, + GEN_TAC + THEN ONCE_REWRITE_TAC[lemma_hypermap_eq] + THEN REWRITE_TAC[GSYM shift_lemma]);; + +let lemma_eq_iff_shift_eq = prove(`!(H:(A)hypermap) (H':(A)hypermap). H = H' <=> shift H = shift H'`, + REPEAT GEN_TAC + THEN EQ_TAC + THENL[DISCH_THEN SUBST1_TAC THEN SIMP_TAC[]; ALL_TAC] + THEN REWRITE_TAC[lemma_hypermap_eq; GSYM shift_lemma] + THEN MESON_TAC[]);; + +let lemma_degenerate_walkup_first_eq = prove(`!(H:(A)hypermap) x:A. x IN dart H /\ dart_degenerate H x ==> node_walkup H x = edge_walkup H x`, + REPEAT GEN_TAC + THEN REWRITE_TAC[dart_degenerate] + THEN STRIP_TAC + THENL[MATCH_MP_TAC edge_degenerate_walkup_first_eq + THEN ASM_REWRITE_TAC[]; + label_4Gs_TAC (SPEC `H:(A)hypermap` shift_lemma) + THEN UNDISCH_TAC `x:A IN dart (H:(A)hypermap)` + THEN UNDISCH_TAC `node_map (H:(A)hypermap) (x:A) = x` + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "F1") + THEN DISCH_THEN (LABEL_TAC "F2") + THEN REWRITE_TAC[node_walkup] + THEN ONCE_REWRITE_TAC[lemma_eq_iff_shift_eq] + THEN REWRITE_TAC[lemma_shift_cycle] + THEN MP_TAC(SPECL[`shift (H:(A)hypermap)`; `x:A`] edge_degenerate_walkup_second_eq) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN REWRITE_TAC[face_walkup] + THEN REWRITE_TAC[lemma_shift_cycle]; ALL_TAC] + THEN label_4Gs_TAC (SPEC `H:(A)hypermap` double_shift_lemma) + THEN UNDISCH_TAC `x:A IN dart (H:(A)hypermap)` + THEN UNDISCH_TAC `face_map (H:(A)hypermap) (x:A) = x` + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "F1") + THEN DISCH_THEN (LABEL_TAC "F2") + THEN MP_TAC(SPECL[`shift(shift (H:(A)hypermap))`; `x:A`] edge_degenerate_walkup_third_eq) + THEN ASM_REWRITE_TAC[] + THEN ASM_REWRITE_TAC[face_walkup; node_walkup] + THEN REWRITE_TAC[lemma_shift_cycle] + THEN DISCH_THEN (MP_TAC o SYM o AP_TERM `shift:((A)hypermap) -> ((A)hypermap)`) + THEN REWRITE_TAC[lemma_shift_cycle]);; + +let lemma_degenerate_walkup_second_eq = prove(`!(H:(A)hypermap) x:A. x IN dart H /\ dart_degenerate H x ==> face_walkup H x = edge_walkup H x`, + REPEAT GEN_TAC + THEN REWRITE_TAC[dart_degenerate] + THEN STRIP_TAC + THENL[MATCH_MP_TAC edge_degenerate_walkup_second_eq + THEN ASM_REWRITE_TAC[]; + label_4Gs_TAC (SPEC `H:(A)hypermap` shift_lemma) + THEN UNDISCH_TAC `x:A IN dart (H:(A)hypermap)` + THEN UNDISCH_TAC `node_map (H:(A)hypermap) (x:A) = x` + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "F1") + THEN DISCH_THEN (LABEL_TAC "F2") + THEN REWRITE_TAC[face_walkup] + THEN MP_TAC(SPECL[`shift (H:(A)hypermap)`; `x:A`] edge_degenerate_walkup_third_eq) + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[node_walkup; face_walkup] + THEN REWRITE_TAC[GSYM lemma_eq_iff_shift_eq; lemma_shift_cycle]; ALL_TAC] + THEN label_4Gs_TAC (SPEC `H:(A)hypermap` double_shift_lemma) + THEN UNDISCH_TAC `x:A IN dart (H:(A)hypermap)` + THEN UNDISCH_TAC `face_map (H:(A)hypermap) (x:A) = x` + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "F1") + THEN DISCH_THEN (LABEL_TAC "F2") + THEN REWRITE_TAC[face_walkup] + THEN MP_TAC(SPECL[`shift(shift (H:(A)hypermap))`; `x:A`] edge_degenerate_walkup_first_eq) + THEN ASM_REWRITE_TAC[node_walkup; lemma_shift_cycle] + THEN DISCH_THEN (MP_TAC o SYM o AP_TERM `shift:((A)hypermap) -> ((A)hypermap)`) + THEN REWRITE_TAC[lemma_shift_cycle]);; + +let lemma_degenerate_walkup_third_eq = prove(`!(H:(A)hypermap) x:A.x IN dart H /\ dart_degenerate H x ==> node_walkup H x = face_walkup H x`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN USE_THEN "F1" (MP_TAC o MATCH_MP lemma_degenerate_walkup_first_eq) + THEN DISCH_THEN SUBST1_TAC + THEN CONV_TAC SYM_CONV + THEN MATCH_MP_TAC lemma_degenerate_walkup_second_eq + THEN ASM_REWRITE_TAC[]);; + +(* I prove that walkup at a degenerate dart do not change the plannar indices *) + + +let component_at_isolated_dart = prove(`!(H:(A)hypermap) x:A. isolated_dart H x ==> comb_component H x = {x}`, + REPEAT GEN_TAC + THEN REWRITE_TAC[isolated_dart] + THEN REPEAT STRIP_TAC + THEN REWRITE_TAC[comb_component; EXTENSION; IN_ELIM_THM; IN_SING; is_in_component] + THEN GEN_TAC + THEN REWRITE_TAC[lemma_def_path] + THEN EQ_TAC + THENL[STRIP_TAC + THEN SUBGOAL_THEN `!j:num. j <= n:num ==> (p:num->A) j = x:A` (LABEL_TAC "F1") + THENL[INDUCT_TAC THENL[ASM_REWRITE_TAC[]; ALL_TAC] + THEN DISCH_THEN (LABEL_TAC "F1") + THEN FIRST_ASSUM (MP_TAC o SPEC `j:num` o check (is_forall o concl)) + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[MP (ARITH_RULE `SUC (j:num) <= n:num ==> j < n`) th]) + THEN REWRITE_TAC[go_one_step] + THEN FIRST_ASSUM (MP_TAC o check (is_imp o concl)) + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[MP (ARITH_RULE `SUC (j:num) <= n:num ==> j <= n`) th]) + THEN DISCH_THEN SUBST1_TAC + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM (MP_TAC o SPEC `n:num`) + THEN REWRITE_TAC[LE_REFL] + THEN FIRST_ASSUM SUBST1_TAC + THEN DISCH_THEN SUBST1_TAC + THEN SIMP_TAC[]; ALL_TAC] + THEN STRIP_TAC + THEN EXISTS_TAC `(\k:num. x:A)` + THEN EXISTS_TAC `0` + THEN ASM_REWRITE_TAC[] + THEN ARITH_TAC);; + +let LEMMA_CARD_DIFF = prove(`!(s:A->bool) (t:A->bool). FINITE s /\ t SUBSET s ==> CARD s = CARD (s DIFF t) + CARD t`, + REPEAT STRIP_TAC + THEN CONV_TAC SYM_CONV + THEN MATCH_MP_TAC CARD_UNION_EQ + THEN ASM_SIMP_TAC[] THEN ASM_ASM_SET_TAC);; + +let CARD_MINUS_ONE = prove(`!(s:B -> bool) (x:B). FINITE s /\ x IN s ==> CARD s = CARD (s DELETE x) + 1`, + REPEAT STRIP_TAC + THEN ASSUME_TAC (ISPECL[`x:B`; `s:B->bool`] DELETE_SUBSET) + THEN MP_TAC (ISPECL[`(s:B->bool) DELETE (x:B)`; `s:B->bool`] FINITE_SUBSET) + THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`x:B`; `(s:B->bool) DELETE (x:B)`] (CONJUNCT2 CARD_CLAUSES)) + THEN ASM_REWRITE_TAC[IN_DELETE] + THEN MP_TAC(ISPECL[`x:B`; `s:B->bool`] INSERT_DELETE) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN ARITH_TAC);; + +let CARD_MINUS_DIFF_TWO_SET = prove(`!(s:B -> bool) (x:B) (y:B). FINITE s /\ x IN s /\ y IN s ==> CARD s = CARD (s DIFF {x, y}) + CARD {x,y}`, + REPEAT STRIP_TAC + THEN MATCH_MP_TAC LEMMA_CARD_DIFF + THEN ASM_ASM_SET_TAC);; + +let EDGE_FINITE = prove(`!(H:(A)hypermap) (x:A). FINITE (edge H x)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[edge] + THEN MATCH_MP_TAC lemma_orbit_finite + THEN EXISTS_TAC `dart (H:(A)hypermap)` + THEN REWRITE_TAC[hypermap_lemma]);; + +let EDGE_NOT_EMPTY = prove(`!(H:(A)hypermap) (x:A). 1 <= CARD (edge H x)`, + REPEAT GEN_TAC THEN MATCH_MP_TAC CARD_ATLEAST_1 + THEN EXISTS_TAC `x:A` + THEN REWRITE_TAC[EDGE_FINITE; edge] + THEN REWRITE_TAC[orbit_reflect]);; + +let NODE_FINITE = prove(`!(H:(A)hypermap) (x:A). FINITE (node H x)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[node] + THEN MATCH_MP_TAC lemma_orbit_finite + THEN EXISTS_TAC `dart (H:(A)hypermap)` + THEN REWRITE_TAC[hypermap_lemma]);; + +let NODE_NOT_EMPTY = prove(`!(H:(A)hypermap) (x:A). 1 <= CARD (node H x)`, + REPEAT GEN_TAC THEN MATCH_MP_TAC CARD_ATLEAST_1 + THEN EXISTS_TAC `x:A` + THEN REWRITE_TAC[NODE_FINITE; node] + THEN REWRITE_TAC[orbit_reflect]);; + +let FACE_FINITE = prove(`!(H:(A)hypermap) (x:A). FINITE (face H x)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[face] + THEN MATCH_MP_TAC lemma_orbit_finite + THEN EXISTS_TAC `dart (H:(A)hypermap)` + THEN REWRITE_TAC[hypermap_lemma]);; + +let FACE_NOT_EMPTY = prove(`!(H:(A)hypermap) (x:A). 1 <= CARD (face H x)`, + REPEAT GEN_TAC THEN MATCH_MP_TAC CARD_ATLEAST_1 + THEN EXISTS_TAC `x:A` + THEN REWRITE_TAC[FACE_FINITE; face] + THEN REWRITE_TAC[orbit_reflect]);; + +let FINITE_HYPERMAP_ORBITS = prove(`!(H:(A)hypermap). FINITE (edge_set H) /\ FINITE (node_set H) /\ FINITE (face_set H)`, + GEN_TAC THEN REWRITE_TAC[edge_set; node_set; face_set] THEN REPEAT STRIP_TAC + THENL[MATCH_MP_TAC finite_orbits_lemma THEN REWRITE_TAC[hypermap_lemma]; + MATCH_MP_TAC finite_orbits_lemma THEN REWRITE_TAC[hypermap_lemma]; + MATCH_MP_TAC finite_orbits_lemma THEN REWRITE_TAC[hypermap_lemma]]);; + +let FINITE_HYPERMAP_COMPONENTS = prove(`!H:(A)hypermap. FINITE (set_of_components H)`, + GEN_TAC THEN REWRITE_TAC[set_of_components] THEN label_hypermap4_TAC `H:(A)hypermap` + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `e = edge_map (H:(A)hypermap)` + THEN ABBREV_TAC `n = node_map (H:(A)hypermap)` + THEN ABBREV_TAC `f = face_map (H:(A)hypermap)` + THEN SUBGOAL_THEN `IMAGE (\x:A. comb_component (H:(A)hypermap) (x:A)) (D:A->bool) = set_part_components H D` ASSUME_TAC + THENL[REWRITE_TAC[EXTENSION] THEN STRIP_TAC THEN EQ_TAC + THENL[REWRITE_TAC[set_part_components;IMAGE;IN;IN_ELIM_THM]; + REWRITE_TAC[set_part_components;IMAGE;IN;IN_ELIM_THM]]; ALL_TAC] + THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) + THEN MATCH_MP_TAC FINITE_IMAGE THEN ASM_SIMP_TAC[]);; + +let WALKUP_EXCEPTION_COMPONENT = prove(`!(H:(A)hypermap) x:A. x IN dart H ==> comb_component (edge_walkup H x) x = {x}`, + REPEAT STRIP_TAC + THEN ASSUME_TAC (CONJUNCT1 (SPECL[`H:(A)hypermap`; `x:A`; `x:A`] edge_map_walkup)) + THEN ASSUME_TAC (CONJUNCT1 (SPECL[`H:(A)hypermap`; `x:A`; `x:A`] node_map_walkup)) + THEN ASSUME_TAC (CONJUNCT1 (SPECL[`H:(A)hypermap`; `x:A`; `x:A`] face_map_walkup)) + THEN ABBREV_TAC `G = edge_walkup (H:(A)hypermap) (x:A)` + THEN MP_TAC(SPECL[`G:(A)hypermap`; `x:A`] isolated_dart) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (MP_TAC o MATCH_MP component_at_isolated_dart) + THEN SIMP_TAC[]);; + + +(* SOME TRIVIAL LEMMAS ON INCIDENT RELATIONSHIPS *) + +let lemma_in_components = prove(`!(H:(A)hypermap) x:A. x IN dart H <=> comb_component H x IN set_of_components H`, + REPEAT GEN_TAC THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ASM_REWRITE_TAC[set_of_components] + THEN REWRITE_TAC[set_part_components] + THEN EQ_TAC + THENL[STRIP_TAC THEN REWRITE_TAC[IN_ELIM_THM] + THEN EXISTS_TAC `x:A` THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN REWRITE_TAC[IN_ELIM_THM] + THEN STRIP_TAC + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x':A`] lemma_component_subset) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN MESON_TAC[lemma_component_reflect; SUBSET]);; + +let lemma_card_eq_reflect = prove(`!s t. s = t ==> CARD s = CARD t`,MESON_TAC[]);; + +let lemma_different_edges = prove(`!(H:(A)hypermap) (x:A) (y:A). ~(x IN edge H y) ==> ~(edge H x = edge H y)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[edge] + THEN ASSUME_TAC(CONJUNCT1(CONJUNCT2(SPEC `H:(A)hypermap` hypermap_lemma))) + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `e = edge_map (H:(A)hypermap)` + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN REWRITE_TAC[orbit_reflect]);; + +let lemma_different_nodes = prove(`!(H:(A)hypermap) (x:A) (y:A). ~(x IN node H y) ==> ~(node H x = node H y)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[node] + THEN ASSUME_TAC(CONJUNCT1(CONJUNCT2(CONJUNCT2(SPEC `H:(A)hypermap` hypermap_lemma)))) + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `e = node_map (H:(A)hypermap)` + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN REWRITE_TAC[orbit_reflect]);; + +let lemma_different_faces = prove(`!(H:(A)hypermap) (x:A) (y:A). ~(x IN face H y) ==> ~(face H x = face H y)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[face] + THEN ASSUME_TAC(CONJUNCT1(CONJUNCT2(CONJUNCT2(CONJUNCT2(SPEC `H:(A)hypermap` hypermap_lemma))))) + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `e = face_map (H:(A)hypermap)` + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN REWRITE_TAC[orbit_reflect]);; + + +(* WALKUP AT AN ISOLATED DART *) + + +let lemma_planar_index_on_walkup_at_isolated_dart = prove(`!(H:(A)hypermap) x:A. x IN dart H /\ isolated_dart H x ==> planar_ind H = planar_ind (edge_walkup H x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN USE_THEN "F2" MP_TAC THEN REWRITE_TAC[isolated_dart] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5"))) + THEN LABEL_TAC "F6" (CONJUNCT1(SPECL[`H:(A)hypermap`; `x:A`] lemma_edge_walkup)) + THEN label_hypermap_TAC `H:(A)hypermap` + THEN label_hypermapG_TAC `edge_walkup (H:(A)hypermap) (x:A)` + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `e = edge_map (H:(A)hypermap)` + THEN ABBREV_TAC `n = node_map (H:(A)hypermap)` + THEN ABBREV_TAC `f = face_map (H:(A)hypermap)` + THEN ABBREV_TAC `D' = dart (edge_walkup (H:(A)hypermap) (x:A))` + THEN ABBREV_TAC `e' = edge_map (edge_walkup (H:(A)hypermap) (x:A))` + THEN ABBREV_TAC `n' = node_map (edge_walkup (H:(A)hypermap) (x:A))` + THEN ABBREV_TAC `f' = face_map (edge_walkup (H:(A)hypermap) (x:A))` + THEN SUBGOAL_THEN `number_of_edges (H:(A)hypermap) = number_of_edges (edge_walkup H (x:A)) + 1` (LABEL_TAC "X1") + THENL[REWRITE_TAC[number_of_edges] THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] lemma_walkup_edges) + THEN REWRITE_TAC[edge] THEN ASM_REWRITE_TAC[] + THEN USE_THEN "F3" MP_TAC + THEN GEN_REWRITE_TAC(LAND_CONV) [SPECL[`e:A->A`; `x:A`] orbit_one_point] + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "H2" (MP_TAC o SPEC `x:A` o MATCH_MP fixed_point_lemma) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN MP_TAC (CONJUNCT1 (SPECL[`H:(A)hypermap`; `x:A`; `x:A`] edge_map_walkup)) + THEN ASM_REWRITE_TAC[] + THEN GEN_REWRITE_TAC(LAND_CONV) [SPECL[`e':A->A`; `x:A`] orbit_one_point] + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[SET_RULE `{x, x} = {x}`] + THEN SUBGOAL_THEN `{x:A} IN edge_set (H:(A)hypermap)` ASSUME_TAC + THENL[REWRITE_TAC[edge_set] THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[set_of_orbits; IN_ELIM_THM] + THEN EXISTS_TAC `x:A` + THEN USE_THEN "F3" MP_TAC + THEN GEN_REWRITE_TAC (LAND_CONV) [orbit_one_point] + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `~({x:A} IN edge_set (edge_walkup (H:(A)hypermap) (x:A)))` ASSUME_TAC + THENL[REWRITE_TAC[edge_set] THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[set_of_orbits; IN_ELIM_THM] + THEN ONCE_REWRITE_TAC[GSYM FORALL_NOT_THM] + THEN REWRITE_TAC[IN_DELETE] + THEN REPEAT STRIP_TAC + THEN FIRST_X_ASSUM(MP_TAC o check(is_neg o concl)) + THEN REWRITE_TAC[] + THEN POP_ASSUM (fun th -> (ASSUME_TAC (SYM th))) + THEN POP_ASSUM (MP_TAC o MATCH_MP orbit_single_lemma) + THEN SIMP_TAC[]; ALL_TAC] + THEN REWRITE_TAC[SET_RULE `((edge_set (H:(A)hypermap)):((A->bool)->bool)) DIFF {{x:A}} = (edge_set (H:(A)hypermap)) DELETE {x:A}`] + THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[DELETE_NON_ELEMENT] + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) + THEN MP_TAC(ISPECL[`edge_set (H:(A)hypermap)`; `{x:A}`] CARD_MINUS_ONE) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[FINITE_HYPERMAP_ORBITS]; ALL_TAC] + THEN SUBGOAL_THEN `number_of_nodes (H:(A)hypermap) = number_of_nodes (edge_walkup H (x:A)) + 1` (LABEL_TAC "X2") + THENL[REWRITE_TAC[number_of_nodes] THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] lemma_walkup_nodes) + THEN REWRITE_TAC[node] THEN ASM_REWRITE_TAC[] + THEN USE_THEN "F4" MP_TAC THEN GEN_REWRITE_TAC(LAND_CONV) [SPECL[`n:A->A`; `x:A`] orbit_one_point] + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "H3" (MP_TAC o SPEC `x:A` o MATCH_MP fixed_point_lemma) + THEN USE_THEN "F4" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN MP_TAC (CONJUNCT1 (SPECL[`H:(A)hypermap`; `x:A`; `x:A`] node_map_walkup)) + THEN ASM_REWRITE_TAC[] + THEN GEN_REWRITE_TAC(LAND_CONV) [SPECL[`n':A->A`; `x:A`] orbit_one_point] + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN SUBGOAL_THEN `{x:A} IN node_set (H:(A)hypermap)` ASSUME_TAC + THENL[REWRITE_TAC[node_set] THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[set_of_orbits; IN_ELIM_THM] + THEN EXISTS_TAC `x:A` THEN USE_THEN "F4" MP_TAC + THEN GEN_REWRITE_TAC (LAND_CONV) [orbit_one_point] + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `~({x:A} IN node_set (edge_walkup (H:(A)hypermap) (x:A)))` ASSUME_TAC + THENL[REWRITE_TAC[node_set] THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[set_of_orbits; IN_ELIM_THM] + THEN ONCE_REWRITE_TAC[GSYM FORALL_NOT_THM] + THEN REWRITE_TAC[IN_DELETE] THEN REPEAT STRIP_TAC + THEN FIRST_X_ASSUM(MP_TAC o check(is_neg o concl)) + THEN REWRITE_TAC[] + THEN POP_ASSUM (fun th -> (ASSUME_TAC (SYM th))) + THEN POP_ASSUM (MP_TAC o MATCH_MP orbit_single_lemma) + THEN SIMP_TAC[]; ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[DELETE_NON_ELEMENT] + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) + THEN MP_TAC(ISPECL[`node_set (H:(A)hypermap)`; `{x:A}`] CARD_MINUS_ONE) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[FINITE_HYPERMAP_ORBITS]; ALL_TAC] + THEN SUBGOAL_THEN `number_of_faces (H:(A)hypermap) = number_of_faces (edge_walkup H (x:A)) + 1` (LABEL_TAC "X3") + THENL[REWRITE_TAC[number_of_faces] THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] lemma_walkup_faces) + THEN REWRITE_TAC[face] THEN ASM_REWRITE_TAC[] + THEN USE_THEN "F5" MP_TAC THEN GEN_REWRITE_TAC(LAND_CONV) [SPECL[`n:A->A`; `x:A`] orbit_one_point] + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "H4" (MP_TAC o SPEC `x:A` o MATCH_MP fixed_point_lemma) + THEN USE_THEN "F5" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN MP_TAC (CONJUNCT1 (SPECL[`H:(A)hypermap`; `x:A`; `x:A`] face_map_walkup)) + THEN ASM_REWRITE_TAC[] + THEN GEN_REWRITE_TAC(LAND_CONV) [SPECL[`f':A->A`; `x:A`] orbit_one_point] + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN SUBGOAL_THEN `{x:A} IN face_set (H:(A)hypermap)` ASSUME_TAC + THENL[REWRITE_TAC[face_set] THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[set_of_orbits; IN_ELIM_THM] + THEN EXISTS_TAC `x:A` THEN USE_THEN "F5" MP_TAC + THEN GEN_REWRITE_TAC (LAND_CONV) [orbit_one_point] + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `~({x:A} IN face_set (edge_walkup (H:(A)hypermap) (x:A)))` ASSUME_TAC + THENL[REWRITE_TAC[face_set] THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[set_of_orbits; IN_ELIM_THM] + THEN ONCE_REWRITE_TAC[GSYM FORALL_NOT_THM] + THEN REWRITE_TAC[IN_DELETE] THEN REPEAT STRIP_TAC + THEN FIRST_X_ASSUM(MP_TAC o check(is_neg o concl)) + THEN REWRITE_TAC[] + THEN POP_ASSUM (fun th -> (ASSUME_TAC (SYM th))) + THEN POP_ASSUM (MP_TAC o MATCH_MP orbit_single_lemma) + THEN SIMP_TAC[]; ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[DELETE_NON_ELEMENT] + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) + THEN MP_TAC(ISPECL[`face_set (H:(A)hypermap)`; `{x:A}`] CARD_MINUS_ONE) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[FINITE_HYPERMAP_ORBITS]; ALL_TAC] + THEN SUBGOAL_THEN `number_of_components (H:(A)hypermap) = number_of_components (edge_walkup H (x:A)) + 1` (LABEL_TAC "X4") + THENL[REWRITE_TAC[number_of_components] + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] lemma_walkup_components) + THEN ASM_REWRITE_TAC[] + THEN USE_THEN "H2" (MP_TAC o SPEC `x:A` o MATCH_MP fixed_point_lemma) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[SET_RULE `{x, x} = {x}`] + THEN REWRITE_TAC[SET_RULE `set_of_components (edge_walkup (H:(A)hypermap) (x:A)) DIFF {comb_component (edge_walkup H x) x} = set_of_components (edge_walkup (H:(A)hypermap) (x:A)) DELETE (comb_component (edge_walkup H x) x )`] + THEN SUBGOAL_THEN `comb_component (H:(A)hypermap) (x:A) IN set_of_components H` ASSUME_TAC + THENL[REWRITE_TAC[set_of_components] + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[set_part_components; IN_ELIM_THM] + THEN EXISTS_TAC `x:A` + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `~(comb_component (edge_walkup (H:(A)hypermap) (x:A)) x IN set_of_components (edge_walkup H x))` ASSUME_TAC + THENL[REWRITE_TAC[set_of_components] + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[set_part_components; IN_ELIM_THM; IN_DELETE] + THEN STRIP_TAC + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] WALKUP_EXCEPTION_COMPONENT) + THEN ASM_REWRITE_TAC[] + THEN FIRST_X_ASSUM(MP_TAC o check(is_neg o concl)) + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN STRIP_TAC + THEN MP_TAC (SPECL[`edge_walkup (H:(A)hypermap) (x:A)`; `x':A`] lemma_component_reflect) + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[IN_SING]; ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[DELETE_NON_ELEMENT] + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) + THEN MP_TAC(ISPECL[`set_of_components (H:(A)hypermap)`; `comb_component (H:(A)hypermap) (x:A)`] CARD_MINUS_ONE) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[FINITE_HYPERMAP_COMPONENTS]; ALL_TAC] + THEN SUBGOAL_THEN `CARD (dart (H:(A)hypermap)) = CARD(dart (edge_walkup H (x:A))) + 1` (LABEL_TAC "X5") + THENL[MP_TAC(CONJUNCT1(SPECL[`H:(A)hypermap`; `x:A`] lemma_edge_walkup)) + THEN DISCH_THEN SUBST1_TAC + THEN MATCH_MP_TAC CARD_MINUS_ONE + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN REWRITE_TAC[planar_ind] + THEN ASM_REWRITE_TAC[GSYM REAL_OF_NUM_ADD] + THEN REAL_ARITH_TAC);; + + +(* Walkup at an edge-degenerate dart *) + +let lemma_planar_index_on_walkup_at_edge_degenerate_dart = prove(`!(H:(A)hypermap) x:A. x IN dart H /\ is_edge_degenerate H x ==> planar_ind H = planar_ind (edge_walkup H x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN USE_THEN "F2" MP_TAC THEN REWRITE_TAC[is_edge_degenerate] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5"))) + THEN LABEL_TAC "F6" (CONJUNCT1(SPECL[`H:(A)hypermap`; `x:A`] lemma_edge_walkup)) + THEN label_hypermap_TAC `H:(A)hypermap` + THEN label_hypermapG_TAC `edge_walkup (H:(A)hypermap) (x:A)` + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `e = edge_map (H:(A)hypermap)` + THEN ABBREV_TAC `n = node_map (H:(A)hypermap)` + THEN ABBREV_TAC `f = face_map (H:(A)hypermap)` + THEN ABBREV_TAC `D' = dart (edge_walkup (H:(A)hypermap) (x:A))` + THEN ABBREV_TAC `e' = edge_map (edge_walkup (H:(A)hypermap) (x:A))` + THEN ABBREV_TAC `n' = node_map (edge_walkup (H:(A)hypermap) (x:A))` + THEN ABBREV_TAC `f' = face_map (edge_walkup (H:(A)hypermap) (x:A))` + THEN MP_TAC(SPECL[`H:(A)hypermap`; `x:A`] lemma_in_hypermap_orbits) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F7") (CONJUNCTS_THEN2 (LABEL_TAC "F8") (LABEL_TAC "F9"))) + THEN SUBGOAL_THEN `number_of_edges (H:(A)hypermap) = number_of_edges (edge_walkup H (x:A)) + 1` (LABEL_TAC "X1") + THENL[REWRITE_TAC[number_of_edges] THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] lemma_walkup_edges) + THEN ASM_REWRITE_TAC[] + THEN LABEL_TAC "F10" (CONJUNCT1(SPEC `H:(A)hypermap` FINITE_HYPERMAP_ORBITS)) + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] lemma_dart_invariant) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th -> (LABEL_TAC "F11" (CONJUNCT1 th))) + THEN MP_TAC(SPECL[`H:(A)hypermap`; `(n:A->A) (x:A)`] lemma_in_hypermap_orbits) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN ((LABEL_TAC "F11") o CONJUNCT1) + THEN DISCH_THEN (ASSUME_TAC o MATCH_MP lemma_card_eq_reflect) + THEN MP_TAC (ISPECL[`edge_set (H:(A)hypermap)`; `edge (H:(A)hypermap) (x:A)`; `edge (H:(A)hypermap) ((n:A->A) (x:A))`] CARD_MINUS_DIFF_TWO_SET) + THEN POP_ASSUM SUBST1_TAC + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "H2" (MP_TAC o SPEC `x:A` o MATCH_MP fixed_point_lemma) + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN SUBST1_TAC + THEN ASSUME_TAC (CONJUNCT1(SPECL[`H:(A)hypermap`; `x:A`;`x:A`] edge_map_walkup)) + THEN MP_TAC(SPECL[`edge_map (edge_walkup (H:(A)hypermap) (x:A))`; `x:A`] orbit_one_point) + THEN POP_ASSUM(fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[GSYM edge] + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC(SPECL[`e:A->A`; `x:A`] orbit_one_point) + THEN USE_THEN "F3"(fun th -> REWRITE_TAC[th]) + THEN EXPAND_TAC "e" + THEN REWRITE_TAC[GSYM edge] + THEN DISCH_THEN SUBST1_TAC + THEN SUBGOAL_THEN `~({x:A} IN edge_set (edge_walkup (H:(A)hypermap) (x:A)))` ASSUME_TAC + THENL[REWRITE_TAC[edge_set] THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[set_of_orbits; IN_ELIM_THM] + THEN ONCE_REWRITE_TAC[GSYM FORALL_NOT_THM] + THEN REWRITE_TAC[IN_DELETE] + THEN REPEAT STRIP_TAC + THEN FIRST_X_ASSUM(MP_TAC o check(is_neg o concl)) + THEN REWRITE_TAC[] + THEN POP_ASSUM (fun th -> (ASSUME_TAC (SYM th))) + THEN POP_ASSUM (MP_TAC o MATCH_MP orbit_single_lemma) + THEN SIMP_TAC[]; ALL_TAC] + THEN REWRITE_TAC[SET_RULE `s DIFF {a,b} = (s DELETE b) DELETE a`] + THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[DELETE_NON_ELEMENT] + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN SUBGOAL_THEN `(n:A->A) (x:A) IN dart (edge_walkup (H:(A)hypermap) (x:A))` MP_TAC + THENL[ASM_REWRITE_TAC[IN_DELETE]; ALL_TAC] + THEN REWRITE_TAC[CONJUNCT1(SPECL[`edge_walkup (H:(A)hypermap) (x:A)`; `(n:A->A) (x:A)`] lemma_in_hypermap_orbits)] + THEN DISCH_TAC + THEN MP_TAC(ISPECL[`edge_set (edge_walkup (H:(A)hypermap) (x:A))`; `edge (edge_walkup (H:(A)hypermap) (x:A)) ((n:A->A) (x:A))`] CARD_MINUS_ONE) + THEN ASM_REWRITE_TAC[FINITE_HYPERMAP_ORBITS] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[ARITH_RULE `((l:num) + 1) + 1 = l + 2`] + THEN REWRITE_TAC[ARITH_RULE `(k:num)+ a = k + b <=> a = b`] + THEN ASM_CASES_TAC `~({x:A} = edge (H:(A)hypermap) ((n:A->A) (x:A)))` + THENL[POP_ASSUM (MP_TAC o MATCH_MP CARD_TWO_ELEMENTS) THEN SIMP_TAC[]; ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[TAUT `~ ~p = p`] + THEN REWRITE_TAC[edge] + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (ASSUME_TAC o SYM) + THEN MP_TAC (SPECL[`e:A->A`; `(n:A->A) (x:A)`] orbit_reflect) + THEN POP_ASSUM SUBST1_TAC + THEN ASM_REWRITE_TAC[IN_SING]; ALL_TAC] + THEN SUBGOAL_THEN `number_of_nodes (H:(A)hypermap) = number_of_nodes (edge_walkup H (x:A))` (LABEL_TAC "X2") + THENL[REWRITE_TAC[number_of_nodes] THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] lemma_walkup_nodes) + THEN ASM_REWRITE_TAC[] + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] lemma_dart_invariant) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th -> (LABEL_TAC "G11" (CONJUNCT1 th))) + THEN MP_TAC (ISPECL[`node_set (H:(A)hypermap)`; `node (H:(A)hypermap) (x:A)`] CARD_MINUS_ONE) + THEN ASM_REWRITE_TAC[FINITE_HYPERMAP_ORBITS] + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_THEN SUBST1_TAC + THEN CONV_TAC SYM_CONV + THEN SUBGOAL_THEN `(inverse (n:A->A)) (x:A) IN dart (edge_walkup (H:(A)hypermap) (x:A))` ASSUME_TAC + THENL[ASM_REWRITE_TAC[IN_DELETE] + THEN USE_THEN "H3" (MP_TAC o SPEC `x:A` o MATCH_MP non_fixed_point_lemma) + THEN USE_THEN "F4" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F1" MP_TAC + THEN EXPAND_TAC "D" + THEN DISCH_THEN (MP_TAC o CONJUNCT1 o CONJUNCT2 o MATCH_MP lemma_dart_inveriant_under_inverse_maps) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN MP_TAC (CONJUNCT1(CONJUNCT2(SPECL[`edge_walkup (H:(A)hypermap) (x:A)`; `inverse (n:A->A) (x:A)`]lemma_in_hypermap_orbits))) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_TAC + THEN MP_TAC (ISPECL[`node_set (edge_walkup (H:(A)hypermap) (x:A))`; `node (edge_walkup (H:(A)hypermap) (x:A)) (inverse (n:A->A) (x:A))`] CARD_MINUS_ONE) + THEN ASM_REWRITE_TAC[FINITE_HYPERMAP_ORBITS]; ALL_TAC] + THEN SUBGOAL_THEN `number_of_faces (H:(A)hypermap) = number_of_faces (edge_walkup H (x:A))` (LABEL_TAC "X4") + THENL[REWRITE_TAC[number_of_faces] THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] lemma_walkup_faces) + THEN ASM_REWRITE_TAC[] + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] lemma_dart_invariant) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th -> (LABEL_TAC "J11" (CONJUNCT2 th))) + THEN MP_TAC (ISPECL[`face_set (H:(A)hypermap)`; `face (H:(A)hypermap) (x:A)`] CARD_MINUS_ONE) + THEN ASM_REWRITE_TAC[FINITE_HYPERMAP_ORBITS] + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_THEN SUBST1_TAC + THEN CONV_TAC SYM_CONV + THEN SUBGOAL_THEN `(inverse (f:A->A)) (x:A) IN dart (edge_walkup (H:(A)hypermap) (x:A))` ASSUME_TAC + THENL[ASM_REWRITE_TAC[IN_DELETE] + THEN USE_THEN "H4" (MP_TAC o SPEC `x:A` o MATCH_MP non_fixed_point_lemma) + THEN USE_THEN "F5" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F1" MP_TAC + THEN EXPAND_TAC "D" + THEN DISCH_THEN (MP_TAC o CONJUNCT2 o CONJUNCT2 o MATCH_MP lemma_dart_inveriant_under_inverse_maps) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`edge_walkup (H:(A)hypermap) (x:A)`; `inverse (f:A->A) (x:A)`]lemma_in_hypermap_orbits))) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_TAC + THEN MP_TAC (ISPECL[`face_set (edge_walkup (H:(A)hypermap) (x:A))`; `face (edge_walkup (H:(A)hypermap) (x:A)) (inverse (f:A->A) (x:A))`] CARD_MINUS_ONE) + THEN ASM_REWRITE_TAC[FINITE_HYPERMAP_ORBITS]; ALL_TAC] + THEN SUBGOAL_THEN `number_of_components (H:(A)hypermap) = number_of_components (edge_walkup H (x:A))` (LABEL_TAC "X5") + THENL[REWRITE_TAC[number_of_components] THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] lemma_walkup_components) + THEN ASM_REWRITE_TAC[] THEN USE_THEN "H2" (MP_TAC o SPEC `x:A` o MATCH_MP fixed_point_lemma) + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN SUBST1_TAC + THEN ASM_CASES_TAC `(comb_component (edge_walkup (H:(A)hypermap) (x:A)) x) IN set_of_components (edge_walkup H x)` + THENL[POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM lemma_in_components] + THEN ASM_REWRITE_TAC[IN_DELETE]; ALL_TAC] + THEN REWRITE_TAC[SET_RULE `s DIFF {a,b} = (s DELETE b) DELETE a`] + THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[DELETE_NON_ELEMENT] + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F1" MP_TAC + THEN EXPAND_TAC "D" + THEN REWRITE_TAC[lemma_in_components] + THEN DISCH_TAC + THEN MP_TAC (ISPECL[`set_of_components (H:(A)hypermap)`; `comb_component (H:(A)hypermap) (x:A)`] CARD_MINUS_ONE) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th; FINITE_HYPERMAP_COMPONENTS]) + THEN DISCH_THEN SUBST1_TAC + THEN ASM_CASES_TAC `(n:A->A) (x:A) IN dart (edge_walkup (H:(A)hypermap) (x:A))` + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[lemma_in_components] + THEN DISCH_TAC + THEN MP_TAC (ISPECL[`set_of_components (edge_walkup (H:(A)hypermap) (x:A))`; `comb_component (edge_walkup (H:(A)hypermap) (x:A)) ((n:A->A) (x:A))`] CARD_MINUS_ONE) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th; FINITE_HYPERMAP_COMPONENTS]) + THEN DISCH_THEN SUBST1_TAC + THEN SIMP_TAC[]; ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN ASM_REWRITE_TAC[IN_DELETE] + THEN DISCH_TAC + THEN MP_TAC(SPECL[`H:(A)hypermap`; `x:A`] lemma_dart_invariant) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `CARD (dart (H:(A)hypermap)) = CARD(dart (edge_walkup H (x:A))) + 1` (LABEL_TAC "X6") + THENL[MP_TAC(CONJUNCT1(SPECL[`H:(A)hypermap`; `x:A`] lemma_edge_walkup)) + THEN DISCH_THEN SUBST1_TAC + THEN MATCH_MP_TAC CARD_MINUS_ONE + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN REWRITE_TAC[planar_ind] + THEN ASM_REWRITE_TAC[GSYM REAL_OF_NUM_ADD] + THEN REAL_ARITH_TAC);; + +let lemma_planar_index_on_walkup_at_degenerate_dart = prove(`!(H:(A)hypermap) (x:A). x IN dart H /\ dart_degenerate H x ==> planar_ind H = planar_ind (edge_walkup H x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN USE_THEN "F2" MP_TAC + THEN REWRITE_TAC[degenerate_lemma] + THEN STRIP_TAC + THENL[MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] lemma_planar_index_on_walkup_at_isolated_dart) + THEN ASM_REWRITE_TAC[]; MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] lemma_planar_index_on_walkup_at_edge_degenerate_dart) + THEN ASM_REWRITE_TAC[]; USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (MP_TAC (MATCH_MP (lemma_degenerate_walkup_first_eq) (CONJ th1 th2)))))) THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN REWRITE_TAC[node_walkup] THEN ONCE_REWRITE_TAC[lemma_planar_invariant_shift] + THEN REWRITE_TAC[lemma_shift_cycle] + THEN SUBGOAL_THEN `is_edge_degenerate (shift (H:(A)hypermap)) (x:A)` ASSUME_TAC + THENL[POP_ASSUM MP_TAC THEN REWRITE_TAC[is_edge_degenerate] + THEN REWRITE_TAC[GSYM shift_lemma; is_node_degenerate] + THEN SIMP_TAC[]; ALL_TAC] + THEN MP_TAC (SPECL[`shift(H:(A)hypermap)`; `x:A`] lemma_planar_index_on_walkup_at_edge_degenerate_dart) + THEN GEN_REWRITE_TAC (LAND_CONV o TOP_DEPTH_CONV ) [GSYM shift_lemma] + THEN ASM_REWRITE_TAC[]; USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (MP_TAC (MATCH_MP (lemma_degenerate_walkup_second_eq) (CONJ th1 th2)))))) THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN REWRITE_TAC[face_walkup] + THEN REPLICATE_TAC 2 (ONCE_REWRITE_TAC[lemma_planar_invariant_shift]) + THEN REWRITE_TAC[lemma_shift_cycle] + THEN SUBGOAL_THEN `is_edge_degenerate (shift(shift (H:(A)hypermap))) (x:A)` ASSUME_TAC + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[is_edge_degenerate] + THEN REWRITE_TAC[GSYM shift_lemma; is_face_degenerate] + THEN SIMP_TAC[]; ALL_TAC] + THEN MP_TAC (SPECL[`shift(shift(H:(A)hypermap))`; `x:A`] lemma_planar_index_on_walkup_at_edge_degenerate_dart) + THEN GEN_REWRITE_TAC (LAND_CONV o TOP_DEPTH_CONV ) [GSYM double_shift_lemma] + THEN ASM_REWRITE_TAC[]]);; + +(* COMPUTE the numbers on edge-walkup at a non-degerate dart *) + +(* Trivial for darts *) + +let lemma_card_walkup_dart = prove(`!(H:(A)hypermap) (x:A). x IN dart H ==> CARD(dart H) = CARD(dart(edge_walkup H x)) + 1`, + REPEAT STRIP_TAC THEN MP_TAC(CONJUNCT1(SPECL[`H:(A)hypermap`; `x:A`] lemma_edge_walkup)) + THEN DISCH_THEN SUBST1_TAC THEN MATCH_MP_TAC CARD_MINUS_ONE + THEN ASM_REWRITE_TAC[hypermap_lemma]);; + + +(* Compute number of edges acording to then splitting cas *) + +let lemma_splitting_case_count_edges = prove(`!(H:(A)hypermap) (x:A). x IN dart H /\ is_edge_split H x ==> number_of_edges H + 1 = number_of_edges (edge_walkup H x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN REWRITE_TAC[number_of_edges] + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] lemma_walkup_edges) + THEN ASM_REWRITE_TAC[] + THEN USE_THEN "F2" MP_TAC + THEN REWRITE_TAC[is_edge_split] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")) + THEN USE_THEN "F4" (MP_TAC o MATCH_MP lemma_edge_identity) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN REWRITE_TAC[SET_RULE `s DIFF {a,a} = s DELETE a`] + THEN MP_TAC (CONJUNCT1(SPECL[`H:(A)hypermap`; `x:A`] lemma_in_hypermap_orbits)) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN ASSUME_TAC + THEN MP_TAC (ISPECL[`edge_set (H:(A)hypermap)`; `edge (H:(A)hypermap) (x:A)`] CARD_MINUS_ONE) + THEN POP_ASSUM (fun th ->REWRITE_TAC[th; FINITE_HYPERMAP_ORBITS]) + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_THEN SUBST1_TAC + THEN CONV_TAC SYM_CONV + THEN REWRITE_TAC[ARITH_RULE `((k:num)+1)+1 = k + 2`] + THEN MP_TAC (CONJUNCT1(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `x:A`] edge_map_walkup)))) + THEN USE_THEN "F3" (MP_TAC o MATCH_MP lemma_inverse_maps_at_nondegenerate_dart) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7"))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC (SPECL[`edge_map(edge_walkup (H:(A)hypermap) (x:A))`; `1`; `inverse(edge_map (H:(A)hypermap)) (x:A)`; `inverse(face_map (H:(A)hypermap)) (x:A)`] in_orbit_lemma) + THEN REWRITE_TAC[POWER_1] + THEN POP_ASSUM(fun th -> GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o TOP_DEPTH_CONV) [SYM th]) + THEN REWRITE_TAC[lemma_edge_identity; GSYM edge] + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_edge_identity) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (MP_TAC (CONJUNCT1(MATCH_MP lemma_edge_split (CONJ th1 th2))))))) + THEN DISCH_THEN (MP_TAC o GSYM o MATCH_MP lemma_different_edges) + THEN DISCH_THEN (MP_TAC o MATCH_MP CARD_TWO_ELEMENTS) + THEN DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) + THEN MATCH_MP_TAC CARD_MINUS_DIFF_TWO_SET + THEN REWRITE_TAC[FINITE_HYPERMAP_ORBITS] + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (MP_TAC (CONJUNCT1(MATCH_MP lemma_edge_split (CONJ th1 th2))))))) + THEN USE_THEN "F3" MP_TAC + THEN REWRITE_TAC[dart_nondegenerate] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "G3"))) + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (MP_TAC (CONJUNCT1(MATCH_MP lemma_node_map_walkup_in_dart (CONJ th1 th2))))))) + THEN REWRITE_TAC[lemma_in_edge_set] + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "G3" (fun th2 -> (MP_TAC (CONJUNCT2(MATCH_MP lemma_face_map_walkup_in_dart (CONJ th1 th2))))))) + THEN REWRITE_TAC[lemma_in_edge_set] + THEN SIMP_TAC[]);; + +(* Compute number of edges acording to then splitting cas *) + +let lemma_merge_case_count_edges = prove(`!(H:(A)hypermap) (x:A). x IN dart H /\ is_edge_merge H x ==> number_of_edges H = number_of_edges (edge_walkup H x) + 1`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN REWRITE_TAC[number_of_edges] + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] lemma_walkup_edges) + THEN ASM_REWRITE_TAC[] + THEN USE_THEN "F2" MP_TAC + THEN REWRITE_TAC[is_edge_merge] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")) + THEN USE_THEN "F3" MP_TAC + THEN REWRITE_TAC[dart_nondegenerate] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7"))) + THEN USE_THEN "F4" (ASSUME_TAC o GSYM o MATCH_MP lemma_different_edges) + THEN MP_TAC(ISPECL[`edge_set (H:(A)hypermap)`; `edge (H:(A)hypermap) (x:A)`; `edge (H:(A)hypermap) (node_map H (x:A))`] CARD_MINUS_DIFF_TWO_SET) + THEN REWRITE_TAC[FINITE_HYPERMAP_ORBITS] + THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[lemma_in_edge_set] + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT1 o CONJUNCT2 o MATCH_MP lemma_dart_invariant) + THEN REWRITE_TAC[lemma_in_edge_set] + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN POP_ASSUM (SUBST1_TAC o MATCH_MP CARD_TWO_ELEMENTS) + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (LABEL_TAC "F8" (SYM(MATCH_MP lemma_edge_merge (CONJ th1 th2))))))) + THEN MP_TAC (SPECL[`dart (H:(A)hypermap)`; `edge_map (H:(A)hypermap)`; `x:A`] lemma_inverse_in_orbit) + THEN GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [hypermap_lemma] + THEN REWRITE_TAC[GSYM edge] + THEN DISCH_TAC + THEN MP_TAC (SET_RULE `(inverse (edge_map (H:(A)hypermap)) (x:A)) IN (edge H x) ==> (inverse (edge_map H) x) IN ((edge H x) UNION (edge H ((node_map H) x)))`) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[IN_UNION; IN_SING] + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP lemma_inverse_maps_at_nondegenerate_dart th]) + THEN REWRITE_TAC[lemma_edge_identity] + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_edge_identity) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN REWRITE_TAC[SET_RULE `s DIFF {a,a} = s DELETE a`] + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F6" (fun th2 -> (MP_TAC (CONJUNCT1(MATCH_MP lemma_node_map_walkup_in_dart (CONJ th1 th2))))))) + THEN REWRITE_TAC[lemma_in_edge_set] + THEN DISCH_TAC + THEN REWRITE_TAC[ARITH_RULE `(m:num) + 2 = (n:num) + 1 <=> m + 1 = n`] + THEN CONV_TAC SYM_CONV + THEN MATCH_MP_TAC CARD_MINUS_ONE + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[FINITE_HYPERMAP_ORBITS]);; + +(* NODES and FACES IN all cases are invariant*) + +let lemma_walkup_count_nodes = prove(`!(H:(A)hypermap) (x:A). x IN dart H /\ dart_nondegenerate H x + ==> number_of_nodes H = number_of_nodes (edge_walkup H x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (MP_TAC)) + THEN REWRITE_TAC[dart_nondegenerate] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4"))) + THEN REWRITE_TAC[number_of_nodes] + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] lemma_walkup_nodes) + THEN ASM_REWRITE_TAC[] + THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[lemma_in_node_set] + THEN DISCH_TAC + THEN MP_TAC (ISPECL[`node_set (H:(A)hypermap)`; `node (H:(A)hypermap) (x:A)`] CARD_MINUS_ONE) + THEN POP_ASSUM (fun th ->REWRITE_TAC[th; FINITE_HYPERMAP_ORBITS]) + THEN REPLICATE_TAC 2 (DISCH_THEN SUBST1_TAC) + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F3" (fun th2 -> (MP_TAC (CONJUNCT2(MATCH_MP lemma_node_map_walkup_in_dart (CONJ th1 th2))))))) + THEN REWRITE_TAC[lemma_in_node_set] + THEN DISCH_TAC + THEN MP_TAC (ISPECL[`node_set (edge_walkup (H:(A)hypermap) (x:A))`; `node (edge_walkup (H:(A)hypermap) (x:A)) ((inverse (node_map H) (x:A)))`] CARD_MINUS_ONE) + THEN POP_ASSUM (fun th ->REWRITE_TAC[th; FINITE_HYPERMAP_ORBITS]) + THEN DISCH_THEN SUBST1_TAC + THEN SIMP_TAC[]);; + +let lemma_walkup_count_faces = prove(`!(H:(A)hypermap) (x:A). x IN dart H /\ dart_nondegenerate H x + ==> number_of_faces H = number_of_faces (edge_walkup H x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (MP_TAC)) + THEN REWRITE_TAC[dart_nondegenerate] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4"))) + THEN REWRITE_TAC[number_of_faces] + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] lemma_walkup_faces) + THEN ASM_REWRITE_TAC[] + THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[lemma_in_face_set] + THEN DISCH_TAC + THEN MP_TAC (ISPECL[`face_set (H:(A)hypermap)`; `face (H:(A)hypermap) (x:A)`] CARD_MINUS_ONE) + THEN POP_ASSUM (fun th ->REWRITE_TAC[th; FINITE_HYPERMAP_ORBITS]) + THEN REPLICATE_TAC 2 (DISCH_THEN SUBST1_TAC) + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F4" (fun th2 -> (MP_TAC (CONJUNCT2(MATCH_MP lemma_face_map_walkup_in_dart (CONJ th1 th2))))))) + THEN REWRITE_TAC[lemma_in_face_set] + THEN DISCH_TAC + THEN MP_TAC (ISPECL[`face_set (edge_walkup (H:(A)hypermap) (x:A))`; `face (edge_walkup (H:(A)hypermap) (x:A)) ((inverse (face_map H) (x:A)))`] CARD_MINUS_ONE) + THEN POP_ASSUM (fun th ->REWRITE_TAC[th; FINITE_HYPERMAP_ORBITS]) + THEN DISCH_THEN SUBST1_TAC + THEN SIMP_TAC[]);; + +(* For components, we have two cases: component splitting and not splitting *) + + +let lemma_walkup_count_splitting_components = prove(`!(H:(A)hypermap) (x:A).x IN dart H /\ dart_nondegenerate H x /\ ~(comb_component (edge_walkup H x) (node_map H x) = comb_component (edge_walkup H x) (inverse (edge_map H) x)) ==> (number_of_components H) + 1 = number_of_components (edge_walkup H x)`, +REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN REWRITE_TAC[number_of_components] + THEN USE_THEN "F1" (MP_TAC o MATCH_MP lemma_walkup_components) + THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[lemma_in_components] + THEN DISCH_TAC + THEN POP_ASSUM (fun th -> (MP_TAC (MATCH_MP CARD_MINUS_ONE (CONJ (SPEC `H:(A)hypermap` FINITE_HYPERMAP_COMPONENTS) th)))) + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[ARITH_RULE `((m:num) + 1) + 1 = m + 2`] + THEN POP_ASSUM (MP_TAC o MATCH_MP CARD_TWO_ELEMENTS) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN CONV_TAC SYM_CONV + THEN MATCH_MP_TAC CARD_MINUS_DIFF_TWO_SET + THEN REWRITE_TAC[FINITE_HYPERMAP_COMPONENTS] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[dart_nondegenerate] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G2") (LABEL_TAC "G3" o CONJUNCT1)) + THEN USE_THEN "F1" (fun th-> (USE_THEN "G3" (fun th1 -> (MP_TAC (CONJUNCT1(MATCH_MP lemma_node_map_walkup_in_dart (CONJ th th1))))))) + THEN REWRITE_TAC[lemma_in_components] + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F1" (fun th-> (USE_THEN "G2" (fun th1 -> (MP_TAC (CONJUNCT2(MATCH_MP lemma_edge_map_walkup_in_dart (CONJ th th1))))))) + THEN REWRITE_TAC[lemma_in_components]);; + + +let lemma_walkup_count_not_splitting_components = prove(`!(H:(A)hypermap) (x:A).x IN dart H /\ dart_nondegenerate H x /\ comb_component (edge_walkup H x) (node_map H x) = comb_component (edge_walkup H x) (inverse (edge_map H) x) ==> (number_of_components H) = number_of_components (edge_walkup H x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN REWRITE_TAC[number_of_components] + THEN USE_THEN "F1" (MP_TAC o MATCH_MP lemma_walkup_components) + THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[lemma_in_components] + THEN DISCH_TAC + THEN POP_ASSUM (fun th -> (MP_TAC (MATCH_MP CARD_MINUS_ONE (CONJ (SPEC `H:(A)hypermap` FINITE_HYPERMAP_COMPONENTS) th)))) + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_THEN SUBST1_TAC + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN REWRITE_TAC[SET_RULE `s DIFF {a,a} = s DELETE a`] + THEN CONV_TAC SYM_CONV + THEN MATCH_MP_TAC CARD_MINUS_ONE + THEN REWRITE_TAC[FINITE_HYPERMAP_COMPONENTS] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[dart_nondegenerate] + THEN DISCH_THEN (LABEL_TAC "G2" o CONJUNCT1 o CONJUNCT2) + THEN USE_THEN "F1" (fun th-> (USE_THEN "G2" (fun th1 -> (MP_TAC (CONJUNCT1(MATCH_MP lemma_node_map_walkup_in_dart (CONJ th th1))))))) + THEN REWRITE_TAC[lemma_in_components]);; + +let is_splitting_component = new_definition `is_splitting_component (H:(A)hypermap) (x:A) <=> ~(comb_component (edge_walkup H x) (node_map H x) = comb_component (edge_walkup H x) (inverse (edge_map H) x))`;; + +let lemma_planar_index_on_nondegenerate = prove(`!(H:(A)hypermap) (x:A). x IN dart H /\ dart_nondegenerate H x ==> +(is_edge_split H x /\ ~(is_splitting_component H x) ==> (planar_ind H) + &2 = planar_ind (edge_walkup H x)) /\ +(~(is_edge_split H x /\ ~(is_splitting_component H x)) ==> (planar_ind H) = planar_ind (edge_walkup H x))`, + REPEAT GEN_TAC THEN REWRITE_TAC[is_splitting_component] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN STRIP_TAC + THENL[DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G1") (LABEL_TAC "G2")) + THEN REWRITE_TAC[planar_ind] + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (SUBST1_TAC (SYM(MATCH_MP lemma_walkup_count_nodes (CONJ th1 th2))))))) + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (SUBST1_TAC (SYM(MATCH_MP lemma_walkup_count_faces (CONJ th1 th2))))))) + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "G1" (fun th2 -> (SUBST1_TAC (SYM(MATCH_MP lemma_splitting_case_count_edges (CONJ th1 th2))))))) + THEN USE_THEN "F1" (fun th1 -> (SUBST1_TAC (MATCH_MP lemma_card_walkup_dart th1))) + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (USE_THEN "G2" (fun th3 -> SUBST1_TAC (SYM(MATCH_MP lemma_walkup_count_not_splitting_components (CONJ th1 (CONJ th2 th3))))))))) + THEN REWRITE_TAC[GSYM REAL_OF_NUM_ADD] + THEN REAL_ARITH_TAC; ALL_TAC] + THEN REWRITE_TAC[DE_MORGAN_THM] + THEN ASM_CASES_TAC `~(is_edge_split (H:(A)hypermap) (x:A))` + THENL[ ASM_REWRITE_TAC[] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[is_edge_split] + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "F3") + THEN MP_TAC(SPECL[`H:(A)hypermap`; `x:A`] is_edge_merge) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "F4") + THEN SUBGOAL_THEN `comb_component (edge_walkup (H:(A)hypermap) (x:A)) (node_map H x) = comb_component (edge_walkup H x) (inverse (edge_map H) x)` (LABEL_TAC "J1") + THENL[USE_THEN "F1" (fun th1 -> (USE_THEN "F4" (fun th2 -> (LABEL_TAC "F8" (SYM(MATCH_MP lemma_edge_merge (CONJ th1 th2))))))) + THEN MP_TAC (SPECL[`dart (H:(A)hypermap)`; `edge_map (H:(A)hypermap)`; `x:A`] lemma_inverse_in_orbit) + THEN GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [hypermap_lemma] + THEN REWRITE_TAC[GSYM edge] + THEN DISCH_TAC + THEN MP_TAC (SET_RULE `(inverse (edge_map (H:(A)hypermap)) (x:A)) IN (edge H x) ==> (inverse (edge_map H) x) IN ((edge H x) UNION (edge H ((node_map H) x)))`) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[IN_UNION; IN_SING] + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[MATCH_MP lemma_inverse_maps_at_nondegenerate_dart th]) + THEN REWRITE_TAC[lemma_in_edge] + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` ASSUME_TAC) + THEN MP_TAC (CONJUNCT1(SPECL[`edge_walkup (H:(A)hypermap) (x:A)`; `node_map (H:(A)hypermap) (x:A)`; `j:num`] lemma_powers_in_component)) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_component_identity) + THEN SIMP_TAC[]; ALL_TAC] + THEN REWRITE_TAC[planar_ind] + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (SUBST1_TAC (SYM(MATCH_MP lemma_walkup_count_nodes (CONJ th1 th2))))))) + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (SUBST1_TAC (SYM(MATCH_MP lemma_walkup_count_faces (CONJ th1 th2))))))) + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F4" (fun th2 -> (SUBST1_TAC (MATCH_MP lemma_merge_case_count_edges (CONJ th1 th2)))))) + THEN USE_THEN "F1" (fun th1 -> (SUBST1_TAC (MATCH_MP lemma_card_walkup_dart th1))) + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (USE_THEN "J1" (fun th3 -> SUBST1_TAC (SYM(MATCH_MP lemma_walkup_count_not_splitting_components (CONJ th1 (CONJ th2 th3))))))))) + THEN REWRITE_TAC[GSYM REAL_OF_NUM_ADD] + THEN REAL_ARITH_TAC; ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[TAUT `~ ~P = P`] + THEN DISCH_THEN (LABEL_TAC "K1") + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "K2") + THEN REWRITE_TAC[planar_ind] + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (SUBST1_TAC (SYM(MATCH_MP lemma_walkup_count_nodes (CONJ th1 th2))))))) + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (SUBST1_TAC (SYM(MATCH_MP lemma_walkup_count_faces (CONJ th1 th2))))))) + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "K1" (fun th2 -> (SUBST1_TAC (SYM(MATCH_MP lemma_splitting_case_count_edges (CONJ th1 th2))))))) + THEN USE_THEN "F1" (fun th1 -> (SUBST1_TAC (MATCH_MP lemma_card_walkup_dart th1))) + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (USE_THEN "K2" (fun th3 -> SUBST1_TAC (SYM(MATCH_MP lemma_walkup_count_splitting_components (CONJ th1 (CONJ th2 th3))))))))) + THEN REWRITE_TAC[GSYM REAL_OF_NUM_ADD] + THEN REAL_ARITH_TAC);; + +(* LEMMA IUCLZYI *) + +let lemmaIUCLZYI = prove(`!(H:(A)hypermap) x:A. (x IN dart H /\ dart_nondegenerate H x ==> +(is_edge_split H x ==> number_of_edges H + 1 = number_of_edges (edge_walkup H x)) /\ (is_edge_merge H x ==> number_of_edges H = number_of_edges (edge_walkup H x) + 1) /\ (number_of_nodes H = number_of_nodes (edge_walkup H x)) /\ (number_of_faces H = number_of_faces (edge_walkup H x)) +/\ (is_splitting_component H x ==> (number_of_components H) + 1 = number_of_components (edge_walkup H x))/\ (~(is_splitting_component H x) ==> (number_of_components H) = number_of_components (edge_walkup H x)) /\(is_edge_split H x /\ ~(is_splitting_component H x) ==> (planar_ind H) + &2 = planar_ind (edge_walkup H x)) /\ (~(is_edge_split H x /\ ~(is_splitting_component H x)) ==> (planar_ind H) = planar_ind (edge_walkup H x))) /\ (x IN dart H /\ dart_degenerate H x ==> planar_ind H = planar_ind (edge_walkup H x))`, + SIMP_TAC[lemma_planar_index_on_walkup_at_degenerate_dart] + THEN SIMP_TAC[lemma_planar_index_on_nondegenerate] + THEN SIMP_TAC[lemma_walkup_count_nodes; lemma_walkup_count_faces] + THEN SIMP_TAC[lemma_merge_case_count_edges; lemma_splitting_case_count_edges] + THEN REWRITE_TAC[is_splitting_component] + THEN MESON_TAC[lemma_walkup_count_not_splitting_components; lemma_walkup_count_splitting_components]);; + +let lemma_desc_planar_index = prove(`!(H:(A)hypermap) (x:A). x IN dart H ==> planar_ind H <= planar_ind (edge_walkup H x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN MP_TAC(SPECL[`H:(A)hypermap`; `x:A`] lemma_category_darts) + THEN STRIP_TAC + THENL[POP_ASSUM (LABEL_TAC "F2") + THEN ASM_CASES_TAC `is_edge_split (H:(A)hypermap) (x:A) /\ ~is_splitting_component H x` + THENL[USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (MP_TAC (CONJUNCT1(MATCH_MP lemma_planar_index_on_nondegenerate (CONJ th1 th2))))))) + THEN ASM_REWRITE_TAC[] + THEN REAL_ARITH_TAC; ALL_TAC] + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (MP_TAC (CONJUNCT2(MATCH_MP lemma_planar_index_on_nondegenerate (CONJ th1 th2))))))) + THEN ASM_REWRITE_TAC[] + THEN REAL_ARITH_TAC; ALL_TAC] + THEN POP_ASSUM (fun th1 -> (USE_THEN "F1" (fun th2 -> (MP_TAC (MATCH_MP lemma_planar_index_on_walkup_at_degenerate_dart (CONJ th2 th1)))))) + THEN REAL_ARITH_TAC);; + +let lemmaBISHKQW = prove(`!(H:(A)hypermap) (x:A). x IN dart H ==> planar_ind H <= planar_ind (edge_walkup H x) /\ planar_ind H <= planar_ind (node_walkup H x) /\ planar_ind H <= planar_ind (face_walkup H x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[MATCH_MP lemma_desc_planar_index th]) + THEN STRIP_TAC + THENL[REWRITE_TAC[node_walkup] + THEN ONCE_REWRITE_TAC[lemma_planar_invariant_shift] + THEN REWRITE_TAC[lemma_shift_cycle] + THEN POP_ASSUM MP_TAC + THEN ONCE_REWRITE_TAC[shift_lemma] + THEN DISCH_THEN (fun th -> REWRITE_TAC[MATCH_MP lemma_desc_planar_index th]); ALL_TAC] + THEN REWRITE_TAC[face_walkup] + THEN ONCE_REWRITE_TAC[lemma_planar_invariant_shift] + THEN ONCE_REWRITE_TAC[lemma_planar_invariant_shift] + THEN REWRITE_TAC[lemma_shift_cycle] + THEN POP_ASSUM MP_TAC + THEN ONCE_REWRITE_TAC[double_shift_lemma] + THEN DISCH_THEN (fun th -> REWRITE_TAC[MATCH_MP lemma_desc_planar_index th]));; + + +let lemmaFOAGLPA = prove(`!(H:(A)hypermap). planar_ind H <= &0`, + GEN_TAC + THEN ABBREV_TAC `n = CARD(dart (H:(A)hypermap))` + THEN POP_ASSUM (MP_TAC) + THEN SPEC_TAC(`H:(A)hypermap`, `H:(A)hypermap`) + THEN SPEC_TAC(`n:num`, `n:num`) + THEN INDUCT_TAC + THENL[REPEAT STRIP_TAC + THEN POP_ASSUM (MP_TAC o MATCH_MP lemma_null_hypermap_planar_index) + THEN REAL_ARITH_TAC; ALL_TAC] + THEN REPEAT STRIP_TAC + THEN POP_ASSUM (LABEL_TAC "F2") + THEN ASM_CASES_TAC `dart (H:(A)hypermap) = {}` + THENL[POP_ASSUM (MP_TAC o MATCH_MP lemma_card_eq_reflect) + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[CARD_CLAUSES] + THEN ARITH_TAC; ALL_TAC] + THEN POP_ASSUM (MP_TAC o MATCH_MP CHOICE_DEF) + THEN ABBREV_TAC `(x:A) = CHOICE (dart (H:(A)hypermap))` + THEN DISCH_THEN (LABEL_TAC "F1") + THEN USE_THEN "F1" (ASSUME_TAC o MATCH_MP lemma_desc_planar_index) + THEN USE_THEN "F1" (MP_TAC o MATCH_MP lemma_card_walkup_dart) + THEN REMOVE_THEN "F2" SUBST1_TAC + THEN REWRITE_TAC[GSYM ADD1; EQ_SUC] + THEN DISCH_THEN (LABEL_TAC "F3" o SYM) + THEN FIRST_ASSUM (MP_TAC o SPEC `edge_walkup (H:(A)hypermap) (x:A)`) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN POP_ASSUM MP_TAC + THEN REAL_ARITH_TAC);; + +let lemmaSGCOSXK = prove(`!(H:(A)hypermap) (x:A). x IN dart H /\ planar_hypermap H ==> planar_hypermap (edge_walkup H x) /\ planar_hypermap (node_walkup H x) /\ planar_hypermap (face_walkup H x)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_planar_hypermap] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN STRIP_TAC + THENL[USE_THEN "F1" (MP_TAC o CONJUNCT1 o MATCH_MP lemmaBISHKQW) + THEN POP_ASSUM SUBST1_TAC + THEN MP_TAC (SPEC `edge_walkup (H:(A)hypermap) (x:A)` lemmaFOAGLPA) + THEN REAL_ARITH_TAC; ALL_TAC] + THEN STRIP_TAC + THENL[USE_THEN "F1" (MP_TAC o CONJUNCT1 o CONJUNCT2 o MATCH_MP lemmaBISHKQW) + THEN POP_ASSUM SUBST1_TAC + THEN MP_TAC (SPEC `node_walkup (H:(A)hypermap) (x:A)` lemmaFOAGLPA) + THEN REAL_ARITH_TAC; ALL_TAC] + THEN USE_THEN "F1" (MP_TAC o CONJUNCT2 o CONJUNCT2 o MATCH_MP lemmaBISHKQW) + THEN POP_ASSUM SUBST1_TAC + THEN MP_TAC (SPEC `face_walkup (H:(A)hypermap) (x:A)` lemmaFOAGLPA) + THEN REAL_ARITH_TAC);; + +(* double walkups *) + + +let convolution_rep = prove(`!s:A->bool p:A->A. p permutes s ==> (p o p = I <=> p = inverse p)`, + REPEAT STRIP_TAC + THEN EQ_TAC + THENL[POP_ASSUM (fun th-> (DISCH_THEN (fun th1->(MP_TAC (MATCH_MP LEFT_INVERSE_EQUATION (CONJ th th1)))))) + THEN REWRITE_TAC[I_O_ID]; ALL_TAC] + THEN DISCH_THEN (MP_TAC o SPEC `p:A->A` o MATCH_MP RIGHT_MULT_MAP) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP PERMUTES_INVERSES_o th]));; + +let convolution_inv = prove(`!s:A->bool p:A->A. p permutes s ==> (p o p = I <=> inverse p o inverse p = I)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN EQ_TAC + THENL[DISCH_THEN (fun th -> LABEL_TAC "F2" th THEN MP_TAC th) + THEN USE_THEN "F1" (fun th->(DISCH_THEN (fun th1->(MP_TAC (MATCH_MP LEFT_INVERSE_EQUATION (CONJ th th1)))))) + THEN REWRITE_TAC[I_O_ID] + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN DISCH_THEN (MP_TAC o SPEC `p:A->A` o MATCH_MP RIGHT_MULT_MAP) + THEN REWRITE_TAC[GSYM o_ASSOC] + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP PERMUTES_INVERSES_o th; I_O_ID]) + THEN DISCH_THEN(fun th -> GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [SYM th]) + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP PERMUTES_INVERSES_o th; I_O_ID]));; + +let convolution_belong = prove(`!s:A->bool p:A->A. p permutes s ==> (p o p = I <=> (!x:A. x IN s ==> p (p x) = x))`, + REPEAT STRIP_TAC + THEN EQ_TAC + THENL[REPEAT STRIP_TAC + THEN FIRST_X_ASSUM (fun th -> (MP_TAC(AP_THM th `x:A`))) + THEN REWRITE_TAC[o_THM; I_THM]; ALL_TAC] + THEN STRIP_TAC + THEN REWRITE_TAC[FUN_EQ_THM] + THEN GEN_TAC + THEN REWRITE_TAC[o_THM; I_THM] + THEN ASM_CASES_TAC `~(x:A IN s:A->bool)` + THENL[POP_ASSUM MP_TAC + THEN UNDISCH_TAC `p:A->A permutes s:A->bool` + THEN REWRITE_TAC[permutes] + THEN DISCH_THEN (MP_TAC o CONJUNCT1) + THEN MESON_TAC[]; ALL_TAC] + THEN ASM_MESON_TAC[]);; + +let edge_convolution = prove(`!(H:(A)hypermap). plain_hypermap H <=> !x:A. x IN dart H ==> node_map H (face_map H (node_map H (face_map H x))) = x`, + REPEAT GEN_TAC + THEN REWRITE_TAC[plain_hypermap] + THEN REWRITE_TAC[MATCH_MP convolution_inv (CONJUNCT2 (SPEC `H:(A)hypermap` edge_map_and_darts))] + THEN ASSUME_TAC (MATCH_MP PERMUTES_INVERSE (CONJUNCT2(SPEC `H:(A)hypermap` edge_map_and_darts))) + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP convolution_belong th]) + THEN ONCE_REWRITE_TAC[CONJUNCT1(SPEC `H:(A)hypermap` inverse_hypermap_maps)] + THEN REWRITE_TAC[inverse_hypermap_maps; o_THM]);; + +let edge_map_convolution = prove(`!(H:(A)hypermap). plain_hypermap H <=> edge_map H = node_map H o face_map H`, + REPEAT GEN_TAC + THEN REWRITE_TAC[plain_hypermap] + THEN REWRITE_TAC[MATCH_MP convolution_rep (CONJUNCT2 (SPEC `H:(A)hypermap` edge_map_and_darts))] + THEN GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [CONJUNCT1(SPEC `H:(A)hypermap` inverse_hypermap_maps)] + THEN SIMP_TAC[]);; + +let lemma_convolution_evaluation = prove(`!s:A->bool p:A->A x:A. FINITE s /\ p permutes s ==> ((p (p x)) = x <=> CARD (orbit_map p x) <= 2)`, + REPEAT GEN_TAC THEN DISCH_TAC THEN EQ_TAC + THENL[STRIP_TAC THEN MP_TAC (SPECL[`p:A->A`; `2`; `x:A`] card_orbit_le) + THEN REWRITE_TAC[POWER_2; o_THM; ARITH_RULE `~(2 = 0)`] + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN ASM_CASES_TAC `(p:A->A) (x:A) = x` THENL[REWRITE_TAC[POWER_2; o_THM] THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN ASM_CASES_TAC `(p:A->A) (p (x:A)) = x` THENL[ASM_REWRITE_TAC[]; ALL_TAC] + THEN DISCH_TAC + THEN FIRST_ASSUM (MP_TAC o SPEC `x:A` o MATCH_MP lemma_cycle_orbit) + THEN ASM_REWRITE_TAC[] + THEN MP_TAC (SPECL[`p:A->A`; `x:A`] orbit_reflect) + THEN FIRST_ASSUM (MP_TAC o SPEC `x:A` o MATCH_MP lemma_orbit_finite) + THEN REWRITE_TAC[IMP_IMP] THEN DISCH_THEN (ASSUME_TAC o MATCH_MP CARD_ATLEAST_1) + THEN ABBREV_TAC `n = CARD(orbit_map (p:A->A) (x:A))` THEN MP_TAC (SPEC `n:num` SEGMENT_TO_TWO) + THEN FIND_ASSUM (fun th-> REWRITE_TAC[th]) (`n:num <= 2`) + THEN FIND_ASSUM (fun th-> REWRITE_TAC[REWRITE_RULE[LT1_NZ; LT_NZ] th]) (`1 <= n:num`) + THEN STRIP_TAC THENL[POP_ASSUM (fun th-> ASM_REWRITE_TAC[th; POWER_1]); ALL_TAC] + THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[th; POWER_2; o_THM]));; + + +let lemma_convolution_map = prove(`!s:A->bool p:A->A. FINITE s /\ p permutes s ==> (p o p = I <=> !x:A. x IN s ==> CARD (orbit_map p x) <= 2)`, + REPEAT GEN_TAC THEN DISCH_TAC THEN EQ_TAC + THENL[DISCH_THEN (LABEL_TAC "F1") THEN REPEAT STRIP_TAC + THEN REMOVE_THEN "F1" (fun th -> (MP_TAC (AP_THM th `x:A`))) + THEN REWRITE_TAC[GSYM POWER_2; I_THM] + THEN MP_TAC (SPECL[`p:A->A`; `2`; `x:A`] card_orbit_le) + THEN REWRITE_TAC[ARITH_RULE `~(2 = 0)`]; ALL_TAC] + THEN STRIP_TAC THEN REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM] + THEN GEN_TAC THEN ASM_CASES_TAC `x:A IN (s:A->bool)` + THENL[FIRST_ASSUM (MP_TAC o SPEC `x:A` o check (is_forall o concl)) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN ASM_REWRITE_TAC[] + THEN FIRST_ASSUM (MP_TAC o MATCH_MP lemma_convolution_evaluation) + THEN MESON_TAC[]; ALL_TAC] + THEN FIND_ASSUM (MP_TAC o CONJUNCT2) `FINITE (s:A->bool) /\ (p:A->A) permutes s` + THEN REWRITE_TAC[permutes] + THEN DISCH_THEN (MP_TAC o SPEC `x:A` o CONJUNCT1) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN ASSUME_TAC + THEN ASM_REWRITE_TAC[]);; + +let lemma_orbit_of_size_2 = prove(`!s:A->bool p:A->A. FINITE s /\ p permutes s ==> (CARD (orbit_map p x) = 2 <=> ~(p x = x) /\ (p (p x) = x))`, + REPEAT GEN_TAC THEN DISCH_THEN (LABEL_TAC "F1") THEN EQ_TAC + THENL[DISCH_THEN (LABEL_TAC "F2") + THEN USE_THEN "F1" (MP_TAC o SPEC `x:A` o MATCH_MP lemma_convolution_evaluation) + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `m:num = 2 ==> m <= 2`) th]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN ONCE_REWRITE_TAC[orbit_one_point] + THEN POP_ASSUM MP_TAC + THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] + THEN REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[CARD_SINGLETON] + THEN ARITH_TAC; ALL_TAC] + THEN STRIP_TAC + THEN USE_THEN "F1" (MP_TAC o SPEC `x:A` o MATCH_MP lemma_convolution_evaluation) + THEN ASM_REWRITE_TAC[] + THEN ASSUME_TAC (SPECL[`p:A->A`; `x:A`] orbit_reflect) + THEN MP_TAC (SPECL[`p:A->A`; `1`; `x:A`] lemma_in_orbit) + THEN REWRITE_TAC[POWER_1] + THEN USE_THEN "F1" (ASSUME_TAC o SPEC `x:A` o MATCH_MP lemma_orbit_finite) + THEN REPEAT STRIP_TAC + THEN MP_TAC (SPECL[`orbit_map (p:A->A) (x:A)`; `x:A`; `(p:A->A) (x:A)`] CARD_ATLEAST_2) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM MP_TAC + THEN ARITH_TAC);; + +let EDGE_OF_SIZE_2 = prove(`!(H:(A)hypermap) x:A. (CARD(edge H x) = 2 <=> ~(edge_map H x = x) /\ (edge_map H (edge_map H x) = x))`, + REPEAT STRIP_TAC THEN REWRITE_TAC[edge] THEN MATCH_MP_TAC lemma_orbit_of_size_2 + THEN EXISTS_TAC `dart (H:(A)hypermap)` THEN REWRITE_TAC[SPEC `H:(A)hypermap` hypermap_lemma]);; + +let NODE_OF_SIZE_2 = prove(`!(H:(A)hypermap) x:A. (CARD(node H x) = 2 <=> ~(node_map H x = x) /\ (node_map H (node_map H x) = x))`, + REPEAT STRIP_TAC THEN REWRITE_TAC[node] THEN MATCH_MP_TAC lemma_orbit_of_size_2 + THEN EXISTS_TAC `dart (H:(A)hypermap)` THEN REWRITE_TAC[SPEC `H:(A)hypermap` hypermap_lemma]);; + +let FACE_OF_SIZE_2 = prove(`!(H:(A)hypermap) x:A. (CARD(face H x) = 2 <=> ~(face_map H x = x) /\ (face_map H (face_map H x) = x))`, + REPEAT STRIP_TAC THEN REWRITE_TAC[face] THEN MATCH_MP_TAC lemma_orbit_of_size_2 + THEN EXISTS_TAC `dart (H:(A)hypermap)` THEN REWRITE_TAC[SPEC `H:(A)hypermap` hypermap_lemma]);; + +let lemma_sub_unions_diff = prove(`!s:(A->bool)->bool t:(A->bool)->bool. t SUBSET s ==> UNIONS s = (UNIONS (s DIFF t)) UNION (UNIONS t)`, + REPEAT STRIP_TAC THEN REWRITE_TAC[UNIONS; UNION; DIFF] + THEN REWRITE_TAC[IN_ELIM_THM; EXTENSION] THEN GEN_TAC + THEN EQ_TAC THENL[STRIP_TAC + THEN ASM_CASES_TAC `(u:A->bool) IN (t:(A->bool)->bool)` + THENL[DISJ2_TAC THEN EXISTS_TAC `u:A->bool` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN DISJ1_TAC + THEN EXISTS_TAC `u:A->bool` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN STRIP_TAC + THENL[EXISTS_TAC `u:A->bool` THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN UNDISCH_TAC `t:(A->bool)->bool SUBSET s:(A->bool)->bool` + THEN REWRITE_TAC[SUBSET] + THEN DISCH_THEN (MP_TAC o SPEC `u:A->bool`) + THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN EXISTS_TAC `u:A->bool` + THEN ASM_REWRITE_TAC[]);; + +let lemma_card_unions_diff = prove(`!s:(A->bool)->bool t:(A->bool)->bool. t SUBSET s /\ FINITE (UNIONS s) /\ (!a:A->bool b:A->bool. a IN s /\ b IN s ==> a = b \/ a INTER b = {}) ==> CARD (UNIONS s) = CARD (UNIONS (s DIFF t)) + CARD (UNIONS t)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN USE_THEN "F1" (LABEL_TAC "F4" o MATCH_MP lemma_sub_unions_diff) + THEN USE_THEN "F4" (fun th2-> (MP_TAC(MATCH_MP (SET_RULE `u = v UNION w ==> v SUBSET u /\ w SUBSET u`) th2 ))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6")) + THEN USE_THEN "F2" (fun th1 -> (USE_THEN "F5" (fun th2 -> (MP_TAC (MATCH_MP FINITE_SUBSET (CONJ th1 th2)))))) + THEN DISCH_THEN (LABEL_TAC "F7") + THEN USE_THEN "F2" (fun th1 -> (USE_THEN "F6" (fun th2 -> (MP_TAC (MATCH_MP FINITE_SUBSET (CONJ th1 th2)))))) + THEN DISCH_THEN (LABEL_TAC "F8") + THEN ASM_CASES_TAC `~(((UNIONS ((s:(A->bool)->bool) DIFF (t:(A->bool)->bool))) INTER (UNIONS t)) = {})` + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] + THEN DISCH_THEN (X_CHOOSE_THEN `el:A` MP_TAC) + THEN GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [UNIONS; DIFF; IN_INTER] + THEN REWRITE_TAC[IN_ELIM_THM] + THEN STRIP_TAC + THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[SUBSET] + THEN DISCH_THEN (MP_TAC o (SPEC `u':A->bool`)) + THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC (SPECL[`u:A->bool`; `u':A->bool`; `el:A`] IN_INTER) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (MP_TAC o SIMPLE_EXISTS `el:A`) + THEN REWRITE_TAC[MEMBER_NOT_EMPTY] + THEN STRIP_TAC + THEN REMOVE_THEN "F3" (MP_TAC o SPECL[`u:A->bool`; `u':A->bool`]) + THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN UNDISCH_TAC `u':A->bool IN (t:(A->bool)->bool)` + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[] + THEN DISCH_TAC + THEN USE_THEN "F4" SUBST1_TAC + THEN MATCH_MP_TAC CARD_UNION + THEN ASM_REWRITE_TAC[]);; + + +let lemma_card_partion2_unions = prove(`!(H:(A)hypermap) (x:A) (y:A). x IN dart H /\ y IN dart H ==> CARD (dart H) = CARD(UNIONS (edge_set H DIFF {edge H x, edge H y})) + CARD(UNIONS {edge H x, edge H y})`, + REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN SUBGOAL_THEN `dart (H:(A)hypermap) = UNIONS (edge_set H)` (LABEL_TAC "F3") + THENL[REWRITE_TAC[edge_set] + THEN MATCH_MP_TAC lemma_partition + THEN REWRITE_TAC[hypermap_lemma]; ALL_TAC] + THEN SUBGOAL_THEN `FINITE (UNIONS (edge_set (H:(A)hypermap)))` ASSUME_TAC + THENL[USE_THEN "F3" (SUBST1_TAC o SYM) THEN REWRITE_TAC[hypermap_lemma]; ALL_TAC] + THEN REMOVE_THEN "F3" (SUBST1_TAC) + THEN MATCH_MP_TAC lemma_card_unions_diff + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[SET_RULE `{u, v} SUBSET w <=> u IN w /\ v IN w`] + THEN REWRITE_TAC[GSYM lemma_in_edge_set] + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[edge_set; IN_ELIM_THM] + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN REPEAT GEN_TAC + THEN REWRITE_TAC[set_of_orbits; IN_ELIM_THM] + THEN STRIP_TAC + THEN ASM_REWRITE_TAC[] + THEN MP_TAC (MATCH_MP partition_orbit (CONJ (CONJUNCT1 (SPEC `H:(A)hypermap` hypermap_lemma)) (CONJUNCT1(CONJUNCT2(SPEC `H:(A)hypermap` hypermap_lemma))))) + THEN MESON_TAC[]);; + +let CARD_UNION_EDGES_LE = prove(`!(H:(A)hypermap) (x:A) (y:A). CARD (edge H x UNION edge H y) <= CARD (edge H x) + CARD (edge H y)`, + REPEAT GEN_TAC + THEN MATCH_MP_TAC CARD_UNION_LE + THEN REWRITE_TAC[EDGE_FINITE]);; + +let lemma_card_partion2_unions_approx = prove(`!(H:(A)hypermap) (x:A) (y:A). x IN dart H /\ y IN dart H ==> CARD (dart H) <= CARD(UNIONS (edge_set H DIFF {edge H x, edge H y})) + CARD(edge H x) + CARD(edge H y)`, + REPEAT GEN_TAC + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_card_partion2_unions) + THEN REWRITE_TAC[UNIONS_2] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[ARITH_RULE `(m:num) + a <= m + b +c <=> a <= b + c`] + THEN MATCH_MP_TAC CARD_UNION_LE + THEN REWRITE_TAC[edge] + THEN label_hypermap4_TAC `H:(A)hypermap` + THEN STRIP_TAC + THENL[MATCH_MP_TAC lemma_orbit_finite + THEN EXISTS_TAC `dart (H:(A)hypermap)` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN MATCH_MP_TAC lemma_orbit_finite + THEN EXISTS_TAC `dart (H:(A)hypermap)` + THEN ASM_REWRITE_TAC[]);; + +let lemma_card_partion2_unions_eq = prove(`!(H:(A)hypermap) (x:A) (y:A). x IN dart H /\ y IN dart H /\ ~(edge H x = edge H y) ==> CARD (dart H) = CARD(UNIONS (edge_set H DIFF {edge H x, edge H y})) + CARD(edge H x) + CARD(edge H y)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (MP_TAC (MATCH_MP lemma_card_partion2_unions (CONJ th1 th2)))))) + THEN REWRITE_TAC[UNIONS_2] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[ARITH_RULE `(m:num) + a = m + b +c <=> a = b + c`] + THEN CONV_TAC SYM_CONV + THEN MATCH_MP_TAC CARD_UNION_EQ + THEN REWRITE_TAC[FINITE_UNION] + THEN REWRITE_TAC[edge] + THEN label_hypermap4_TAC `H:(A)hypermap` + THEN STRIP_TAC + THENL[STRIP_TAC + THENL[MATCH_MP_TAC lemma_orbit_finite + THEN EXISTS_TAC `dart (H:(A)hypermap)` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN MATCH_MP_TAC lemma_orbit_finite + THEN EXISTS_TAC `dart (H:(A)hypermap)` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN USE_THEN "H1" (fun th1 -> (USE_THEN "H2" (fun th2 -> (MP_TAC (SPECL[`x:A`; `y:A`] (MATCH_MP partition_orbit (CONJ th1 th2))))))) + THEN REWRITE_TAC[GSYM edge] + THEN USE_THEN "F3" MP_TAC + THEN MESON_TAC[]);; + +let lemma_card_partion1_unions_eq = prove(`!(H:(A)hypermap) (x:A). x IN dart H ==> CARD (dart H) = CARD(UNIONS (edge_set H DELETE (edge H x))) + CARD(edge H x)`, + REPEAT STRIP_TAC + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`; `x:A`] lemma_card_partion2_unions) + THEN ASM_REWRITE_TAC[SET_RULE `{a,a} = {a} /\ (s DIFF {a} = s DELETE a)`; UNIONS_1]);; + +let lemma_permutes_exception = prove(`!s:A->bool p:A->A x:A. p permutes s /\ ~(x IN s) ==> p x = x`, + REWRITE_TAC[permutes] THEN MESON_TAC[]);; + +let map_permutes_outside_domain = prove(`!s:A->bool p:A->A. p permutes s ==> (!x:A. ~(x IN s) ==> p x = x)`, + REWRITE_TAC[permutes] THEN MESON_TAC[]);; + +let power_permutation_outside_domain = prove(`!s:A->bool p:A->A x:A n:num. p permutes s /\ ~(x IN s) ==> (p POWER n) x = x`, + REPEAT STRIP_TAC + THEN SPEC_TAC(`n:num`, `n:num`) + THEN INDUCT_TAC + THENL[REWRITE_TAC[POWER_0; I_THM]; ALL_TAC] + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN POP_ASSUM SUBST1_TAC + THEN POP_ASSUM MP_TAC + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP map_permutes_outside_domain th]));; + +let lemma_edge_exception = prove(`!(H:(A)hypermap) (x:A). ~(x IN dart H) ==> edge H x = {x}`, + REPEAT STRIP_TAC + THEN MP_TAC (SPEC `x:A` (MATCH_MP map_permutes_outside_domain (CONJUNCT2(SPEC `H:(A)hypermap` edge_map_and_darts)))) + THEN ASM_REWRITE_TAC[edge] + THEN MESON_TAC[orbit_one_point]);; + +let lemma_node_exception = prove(`!(H:(A)hypermap) (x:A). ~(x IN dart H) ==> node H x = {x}`, + REPEAT STRIP_TAC + THEN MP_TAC (SPEC `x:A` (MATCH_MP map_permutes_outside_domain (CONJUNCT2(SPEC `H:(A)hypermap` node_map_and_darts)))) + THEN ASM_REWRITE_TAC[node] + THEN MESON_TAC[orbit_one_point]);; + +let lemma_face_exception = prove(`!(H:(A)hypermap) (x:A). ~(x IN dart H) ==> face H x = {x}`, + REPEAT STRIP_TAC + THEN MP_TAC (SPEC `x:A` (MATCH_MP map_permutes_outside_domain (CONJUNCT2(SPEC `H:(A)hypermap` face_map_and_darts)))) + THEN ASM_REWRITE_TAC[face] + THEN MESON_TAC[orbit_one_point]);; + +let lemma_simple_hypermap = prove(`simple_hypermap (H:(A)hypermap) ==> !x:A. (node H x) INTER (face H x) = {x}`, + REPEAT STRIP_TAC + THEN ASM_CASES_TAC `x:A IN dart (H:(A)hypermap)` + THENL[POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[REWRITE_RULE[simple_hypermap] th]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F1") + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP lemma_node_exception th] THEN ASSUME_TAC th) + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP lemma_face_exception th]) + THEN SET_TAC[]);; + +(* DOUBLE EDGE WALKUP ALONG A NODE OF SIZE 2 CARRING A PLAIN HYPERMAP TO A PLAIN ONE *) + +let double_edge_walkup_plain_hypermap = prove(`!(H:(A)hypermap) (x:A).x IN dart H /\ plain_hypermap H /\ CARD (node H x) = 2 ==> plain_hypermap (double_edge_walkup H x (node_map H x))`, + REPEAT GEN_TAC + THEN GEN_REWRITE_TAC (LAND_CONV o TOP_DEPTH_CONV) [plain_hypermap] + THEN MP_TAC (SPECL[`dart (H:(A)hypermap)`; `edge_map (H:(A)hypermap)`] lemma_convolution_map) + THEN REWRITE_TAC[hypermap_lemma] + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[NODE_OF_SIZE_2] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")))) + THEN ABBREV_TAC `y = node_map (H:(A)hypermap) (x:A)` + THEN POP_ASSUM (LABEL_TAC "F5") + THEN MP_TAC (SPECL[`dart (H:(A)hypermap)`; `node_map (H:(A)hypermap)`; `x:A`; `y:A`] inverse_function) + THEN ASM_REWRITE_TAC[hypermap_lemma] + THEN USE_THEN "F4" (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "F6" o SYM) + THEN MP_TAC (SPECL[`dart (H:(A)hypermap)`; `node_map (H:(A)hypermap)`; `y:A`; `x:A`] inverse_function) + THEN ASM_REWRITE_TAC[hypermap_lemma] + THEN USE_THEN "F4" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F7" o SYM) + THEN USE_THEN "F1" (MP_TAC o MATCH_MP lemma_walkup_edges) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "F8") + THEN ABBREV_TAC `G = edge_walkup (H:(A)hypermap) (x:A)` + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] lemma_node_map_walkup_in_dart) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "F9") + THEN MP_TAC (CONJUNCT1(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `y:A`] node_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "F10") + THEN USE_THEN "F9" (MP_TAC o MATCH_MP lemma_walkup_edges) + THEN ASM_REWRITE_TAC[SET_RULE `{a,a} = {a} /\ s DIFF {a} = s DELETE a`] + THEN ABBREV_TAC `W = edge_walkup (G:(A)hypermap) (y:A)` + THEN DISCH_THEN (LABEL_TAC "F11") + THEN SUBGOAL_THEN `~(edge (W:(A)hypermap) (y:A) IN edge_set W)` (LABEL_TAC "F12") + THENL[REWRITE_TAC[GSYM lemma_in_edge_set] + THEN EXPAND_TAC "W" + THEN MP_TAC (CONJUNCT1(SPECL[`G:(A)hypermap`; `y:A`] lemma_edge_walkup)) + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[IN_DELETE]; ALL_TAC] + THEN REMOVE_THEN "F11" MP_TAC + THEN REWRITE_TAC[SET_RULE `s DIFF {a,b} = (s DELETE a) DELETE b`] + THEN USE_THEN "F12" (MP_TAC o MATCH_MP (SET_RULE `~(a IN s) ==> s DELETE a = s`)) + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "F14") + THEN MP_TAC (CONJUNCT1 (SPECL[`G:(A)hypermap`; `y:A`] lemma_edge_walkup)) + THEN FIND_ASSUM (fun th -> REWRITE_TAC[th]) `edge_walkup (G:(A)hypermap) (y:A) = W` + THEN DISCH_THEN (LABEL_TAC "F15") + THEN SUBGOAL_THEN `~(y:A IN dart (W:(A)hypermap))` (LABEL_TAC "F16") + THEN USE_THEN "F15" SUBST1_TAC + THEN REWRITE_TAC[IN_DELETE] + THEN USE_THEN "F1" (MP_TAC o CONJUNCT1 o CONJUNCT2 o MATCH_MP lemma_dart_invariant) + THEN USE_THEN "F5" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F17") + THEN ASM_CASES_TAC `(inverse (edge_map (H:(A)hypermap)) (x:A)) = x \/ edge (G:(A)hypermap) (y:A) = edge G (inverse (edge_map H) x)` + THENL[SUBGOAL_THEN `edge_set (G:(A)hypermap) DIFF {edge G (y:A), edge G (inverse (edge_map (H:(A)hypermap)) (x:A))} = edge_set G DELETE (edge G y)` ASSUME_TAC + THENL[POP_ASSUM MP_TAC THEN STRIP_TAC + THENL[REWRITE_TAC[SET_RULE `s DIFF {a,b} = (s DELETE b) DELETE a`] + THEN POP_ASSUM SUBST1_TAC + THEN MP_TAC (ISPECL[`edge (G:(A)hypermap) (x:A)`; `edge_set (G:(A)hypermap)`] DELETE_NON_ELEMENT) + THEN REWRITE_TAC[GSYM lemma_in_edge_set] + THEN REWRITE_TAC[lemma_edge_walkup] + THEN MP_TAC (CONJUNCT1 (SPECL[`H:(A)hypermap`; `x:A`] lemma_edge_walkup)) + THEN FIND_ASSUM SUBST1_TAC `edge_walkup (H:(A)hypermap) (x:A) = G` + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[IN_DELETE] + THEN DISCH_THEN SUBST1_TAC + THEN SIMP_TAC[]; ALL_TAC] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN REWRITE_TAC[SET_RULE `s DIFF {a,a} = s DELETE a`]; ALL_TAC] + THEN REMOVE_THEN "F8" MP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "K1") + THEN SUBGOAL_THEN `CARD (edge (G:(A)hypermap) (y:A)) <= 3` (LABEL_TAC "K2") + THENL[USE_THEN "F1" (fun th1 -> (USE_THEN "F17" (fun th2 -> (MP_TAC (MATCH_MP lemma_card_partion2_unions (CONJ th1 th2)))))) + THEN USE_THEN "F1" (MP_TAC o MATCH_MP lemma_card_walkup_dart) + THEN FIND_ASSUM (fun th-> REWRITE_TAC[th]) `edge_walkup (H:(A)hypermap) (x:A) = G` + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "K1" SUBST1_TAC + THEN USE_THEN "F9" (MP_TAC o MATCH_MP lemma_card_partion1_unions_eq) + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[ARITH_RULE `((m:num)+n) +1 = m + k <=> n+1 = k`; UNIONS_2] + THEN DISCH_THEN (fun th -> (MP_TAC (MATCH_MP (ARITH_RULE `(a:num) = b /\ b <= c ==> a <= c`) (CONJ th (SPECL[`H:(A)hypermap`; `x:A`; `y:A`] CARD_UNION_EDGES_LE))))) + THEN USE_THEN "F2" (MP_TAC o SPEC `x:A`) + THEN USE_THEN "F2" (MP_TAC o SPEC `y:A`) + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F17" (fun th-> REWRITE_TAC[th]) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN REWRITE_TAC[GSYM edge] + THEN DISCH_THEN (MP_TAC o MATCH_MP (ARITH_RULE `(a:num) <= 2 /\ (b:num) <= 2 /\ (c:num) + 1 <= b + a ==> c <= 3`)) + THEN SIMP_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `CARD (edge (W:(A)hypermap) (inverse (edge_map (G:(A)hypermap)) (y:A))) <= 2` (LABEL_TAC "K3") + THENL[ASM_CASES_TAC `inverse (edge_map (G:(A)hypermap)) (y:A) = y` + THENL[POP_ASSUM SUBST1_TAC + THEN USE_THEN "F16" (MP_TAC o MATCH_MP lemma_edge_exception) + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[CARD_SINGLETON] + THEN ARITH_TAC; ALL_TAC] + THEN MP_TAC (SPEC `y:A` (MATCH_MP non_fixed_point_lemma (CONJUNCT1(CONJUNCT2(SPEC `G:(A)hypermap` hypermap_lemma))))) + THEN POP_ASSUM (fun th -> ((LABEL_TAC "K4" th) THEN REWRITE_TAC[th])) + THEN USE_THEN "F9" (fun th1 -> (DISCH_THEN (fun th2 -> (MP_TAC (CONJUNCT2(MATCH_MP lemma_edge_map_walkup_in_dart (CONJ th1 th2))))))) + THEN FIND_ASSUM SUBST1_TAC `edge_walkup (G:(A)hypermap) (y:A) = W` + THEN DISCH_THEN (LABEL_TAC "K5") + THEN USE_THEN "F9" (MP_TAC o MATCH_MP lemma_card_partion1_unions_eq) + THEN USE_THEN "F14" SUBST1_TAC + THEN USE_THEN "F9" (MP_TAC o MATCH_MP lemma_card_walkup_dart) + THEN FIND_ASSUM (fun th-> REWRITE_TAC[th]) `edge_walkup (G:(A)hypermap) (y:A) = W` + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "K5" (MP_TAC o MATCH_MP lemma_card_partion1_unions_eq) + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[ARITH_RULE `((m:num)+n) +1 = m + k <=> n+1 = k`] + THEN USE_THEN "K2" (fun th1 -> (DISCH_THEN (fun th2 -> (MP_TAC (MATCH_MP (ARITH_RULE `((a:num) <= 3 /\ (b:num) + 1 = a) ==> b <=2`) (CONJ th1 th2)))))) + THEN SIMP_TAC[]; ALL_TAC] + THEN ASM_REWRITE_TAC[plain_hypermap; double_edge_walkup] + THEN MP_TAC (SPECL[`dart (W:(A)hypermap)`; `edge_map (W:(A)hypermap)`] lemma_convolution_map) + THEN REWRITE_TAC[hypermap_lemma] + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[GSYM edge] + THEN GEN_TAC + THEN ASM_CASES_TAC `edge (W:(A)hypermap) (x':A) = edge W (inverse (edge_map (G:(A)hypermap)) (y:A))` + THENL[POP_ASSUM SUBST1_TAC + THEN USE_THEN "K3" (fun th -> REWRITE_TAC[th]); ALL_TAC] + + THEN POP_ASSUM (LABEL_TAC "K10") + THEN DISCH_THEN (fun th -> (LABEL_TAC "K11" th THEN MP_TAC th)) + THEN REWRITE_TAC[lemma_in_edge_set] + THEN DISCH_THEN (LABEL_TAC "K12") + THEN MP_TAC (ISPECL[`edge_set (W:(A)hypermap)`; `edge (W:(A)hypermap) (x':A)`; `edge (W:(A)hypermap) (inverse (edge_map (G:(A)hypermap)) (y:A))` ] IN_DELETE) + THEN USE_THEN "K12" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "K10" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F14" (SUBST1_TAC o SYM) + THEN USE_THEN "K1" (SUBST1_TAC o SYM) + THEN ABBREV_TAC `E = edge (W:(A)hypermap) (x':A)` + THEN REWRITE_TAC[IN_DIFF] + THEN DISCH_THEN (fun th -> (MP_TAC (MATCH_MP lemma_edge_representation (CONJUNCT1 th)))) + THEN STRIP_TAC + THEN USE_THEN "F2" (MP_TAC o SPEC `x'':A`) + THEN REWRITE_TAC[GSYM edge] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]);ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[DE_MORGAN_THM] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "J1") (LABEL_TAC "J2")) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT1 o MATCH_MP lemma_dart_inveriant_under_inverse_maps) + THEN USE_THEN "F1" (fun th1 -> USE_THEN "J1" (fun th2 -> (DISCH_THEN (fun th3 -> (MP_TAC (MATCH_MP lemma_in_walkup_dart (CONJ th1 (CONJ th3 th2)))))))) + THEN FIND_ASSUM SUBST1_TAC `edge_walkup (H:(A)hypermap) (x:A) = G` + THEN DISCH_THEN (fun th -> (MP_TAC th THEN (LABEL_TAC "J3" th))) + THEN REWRITE_TAC[lemma_in_edge_set] + THEN DISCH_THEN (LABEL_TAC "J4") + THEN ABBREV_TAC `u = inverse (edge_map (H:(A)hypermap)) (x:A)` + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F17" (fun th2 -> (MP_TAC (MATCH_MP lemma_card_partion2_unions_approx (CONJ th1 th2)))))) + THEN USE_THEN "F1" (MP_TAC o MATCH_MP lemma_card_walkup_dart) + THEN FIND_ASSUM (fun th-> REWRITE_TAC[th]) `edge_walkup (H:(A)hypermap) (x:A) = G` + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F9" (fun th1 -> (USE_THEN "J3" (fun th2 -> (USE_THEN "J2" (fun th3 -> (MP_TAC (MATCH_MP lemma_card_partion2_unions_eq (CONJ th1 (CONJ th2 th3))))))))) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F8" (SUBST1_TAC) + THEN REWRITE_TAC[ARITH_RULE `((m:num)+n+k) + 1 <= m + a + b <=> n+k+1 <= a+b`] + THEN USE_THEN "F2" (MP_TAC o SPEC `x:A`) + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F2" (MP_TAC o SPEC `y:A`) + THEN USE_THEN "F17" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN REWRITE_TAC[GSYM edge] + THEN DISCH_THEN (fun th -> (MP_TAC (MATCH_MP (ARITH_RULE `b:num <= 2 /\ a:num <= 2 /\ (m:num) + (n:num) + 1 <=a + b ==> m +n <= 3`) th))) + THEN MP_TAC (SPECL[`G:(A)hypermap`; `y:A`] EDGE_NOT_EMPTY) + THEN MP_TAC (SPECL[`G:(A)hypermap`; `u:A`] EDGE_NOT_EMPTY) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP (ARITH_RULE `1 <= n:num /\ 1 <= m:num /\ m + n <= 3 ==> m <=2 /\ n <=2`)) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "J5") (LABEL_TAC "J6")) + THEN SUBGOAL_THEN `CARD (edge (W:(A)hypermap) (inverse (edge_map (G:(A)hypermap)) (y:A))) <= 2` (LABEL_TAC "J6a") + THENL[ASM_CASES_TAC `inverse (edge_map (G:(A)hypermap)) (y:A) = y` + THENL[POP_ASSUM SUBST1_TAC + THEN MP_TAC (CONJUNCT1(SPECL[`G:(A)hypermap`; `y:A`; `y:A`] edge_map_walkup)) + THEN FIND_ASSUM SUBST1_TAC `edge_walkup (G:(A)hypermap) (y:A) = W` + THEN MP_TAC (SPECL[`edge_map (W:(A)hypermap)`; `y:A`] orbit_one_point) + THEN REWRITE_TAC[GSYM edge] + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[CARD_SINGLETON] + THEN ARITH_TAC; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "J7") + THEN MP_TAC (SPEC `y:A` (MATCH_MP non_fixed_point_lemma (CONJUNCT1(CONJUNCT2(SPEC `G:(A)hypermap` hypermap_lemma))))) + THEN USE_THEN "J7" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F9" (fun th1 -> (DISCH_THEN (fun th2 -> (MP_TAC (CONJUNCT2(MATCH_MP lemma_edge_map_walkup_in_dart (CONJ th1 th2))))))) + THEN FIND_ASSUM SUBST1_TAC `edge_walkup (G:(A)hypermap) (y:A) = W` + THEN DISCH_THEN (LABEL_TAC "J8") + THEN USE_THEN "F9" (MP_TAC o MATCH_MP lemma_card_partion1_unions_eq) + THEN (USE_THEN "F9" (MP_TAC o MATCH_MP lemma_card_walkup_dart)) + THEN FIND_ASSUM (fun th-> REWRITE_TAC[th]) `edge_walkup (G:(A)hypermap) (y:A) = W` + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F14" SUBST1_TAC + THEN USE_THEN "J8" (MP_TAC o MATCH_MP lemma_card_partion1_unions_eq) + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[ARITH_RULE `((m:num)+n) +1 = m + k <=> n+1 = k`] + THEN USE_THEN "J5" MP_TAC + THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (MP_TAC o MATCH_MP (ARITH_RULE `a:num <= 2 /\ (m:num) + 1 = a ==> m <= 2`)) + THEN SIMP_TAC[]; ALL_TAC] + THEN ABBREV_TAC `v = inverse (edge_map (G:(A)hypermap)) (y:A)` + THEN ASM_REWRITE_TAC[plain_hypermap; double_edge_walkup] + THEN MP_TAC (SPECL[`dart (W:(A)hypermap)`; `edge_map (W:(A)hypermap)`] lemma_convolution_map) + THEN REWRITE_TAC[hypermap_lemma] + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[GSYM edge] + THEN GEN_TAC + THEN ASM_CASES_TAC `edge (W:(A)hypermap) (x':A) = edge W (v:A)` + THENL[POP_ASSUM SUBST1_TAC THEN USE_THEN "J6a" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "J16") + THEN DISCH_THEN (fun th -> (LABEL_TAC "J17" th THEN MP_TAC th)) + THEN REWRITE_TAC[lemma_in_edge_set] + THEN DISCH_THEN (LABEL_TAC "J18") + THEN MP_TAC (ISPECL[`edge_set (W:(A)hypermap)`; `edge (W:(A)hypermap) (x':A)`; `edge (W:(A)hypermap) (v:A)` ] IN_DELETE) + THEN USE_THEN "J18" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "J16" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F14" (SUBST1_TAC o SYM) + THEN ASM_CASES_TAC `edge (W:(A)hypermap) (x':A) = edge (G:(A)hypermap) (u:A)` + THENL[POP_ASSUM SUBST1_TAC + THEN USE_THEN "J6" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN DISCH_THEN (fun th -> (POP_ASSUM (fun th2 -> (MP_TAC (MATCH_MP (SET_RULE `~(a = b) /\ a IN (s DELETE c) ==> a IN (s DIFF {c, b})`) (CONJ th2 th)))))) + THEN USE_THEN "F8" (SUBST1_TAC o SYM) + THEN ABBREV_TAC `ED = edge (W:(A)hypermap) (x':A)` + THEN REWRITE_TAC[IN_DIFF] + THEN DISCH_THEN (fun th -> (MP_TAC (MATCH_MP lemma_edge_representation (CONJUNCT1 th)))) + THEN STRIP_TAC + THEN USE_THEN "F2" (MP_TAC o SPEC `x'':A`) + THEN REWRITE_TAC[GSYM edge] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]));; + +let lemma_representaion_Wn = prove(`!(H:(A)hypermap) (x:A) (y:A). double_node_walkup H x y = shift(shift(double_edge_walkup (shift H) x y))`, + REPEAT GEN_TAC THEN REWRITE_TAC[double_node_walkup; node_walkup; double_edge_walkup] + THEN REWRITE_TAC[lemma_shift_cycle]);; + +let lemma_representaion_Wf = prove(`!(H:(A)hypermap) (x:A) (y:A). double_face_walkup H x y = shift(double_edge_walkup (shift(shift H)) x y)`, + REPEAT GEN_TAC THEN REWRITE_TAC[double_face_walkup; face_walkup; double_edge_walkup] + THEN REWRITE_TAC[lemma_shift_cycle]);; + + +let double_node_walkup_plain_hypermap = prove(`!(H:(A)hypermap) (x:A).x IN dart H /\ plain_hypermap H /\ CARD (edge H x) = 2 ==> plain_hypermap (double_node_walkup H x (edge_map H x))`, + REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_representaion_Wn] + THEN REWRITE_TAC[plain_hypermap] + THEN ABBREV_TAC `G = shift (H:(A)hypermap)` + THEN REWRITE_TAC[GSYM shift_lemma] + THEN MP_TAC (CONJUNCT1(SPEC `H:(A)hypermap` shift_lemma)) + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[edge] + THEN MP_TAC (CONJUNCT1(CONJUNCT2(SPEC `H:(A)hypermap` shift_lemma))) + THEN DISCH_THEN SUBST1_TAC + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[GSYM face] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN MP_TAC (SPECL[`dart (G:(A)hypermap)`; `face_map (G:(A)hypermap)`] lemma_convolution_map) + THEN ASM_REWRITE_TAC[hypermap_lemma; GSYM face] + THEN DISCH_THEN (LABEL_TAC "F4") + THEN REMOVE_THEN "F3" MP_TAC + THEN REWRITE_TAC[FACE_OF_SIZE_2] + THEN ABBREV_TAC `y = face_map (G:(A)hypermap) (x:A)` + THEN POP_ASSUM (LABEL_TAC "J0") + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6")) + THEN USE_THEN "F1" (MP_TAC o MATCH_MP lemma_walkup_faces) + THEN ABBREV_TAC `J = edge_walkup (G:(A)hypermap) (x:A)` + THEN POP_ASSUM (LABEL_TAC "J1") + THEN USE_THEN "F6" (fun th -> (MP_TAC (MATCH_MP inverse_function (CONJ (CONJUNCT1(CONJUNCT2(CONJUNCT2(CONJUNCT2(SPEC `G:(A)hypermap` hypermap_lemma))))) th)))) + THEN DISCH_THEN (fun th -> (LABEL_TAC "J2" (SYM th) THEN (SUBST1_TAC (SYM th)))) + THEN DISCH_THEN (LABEL_TAC "F7") + THEN USE_THEN "F5" MP_TAC + THEN USE_THEN "F1" (MP_TAC o CONJUNCT2 o CONJUNCT2 o MATCH_MP lemma_dart_invariant) + THEN USE_THEN "F5" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "J0" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F8") + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F8" (fun th2 -> (USE_THEN "F5" (fun th3 -> (MP_TAC (MATCH_MP lemma_in_walkup_dart (CONJ th1 (CONJ th2 th3))))))))) + THEN USE_THEN "J1" (fun th->REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F9") + THEN USE_THEN "F9" (MP_TAC o MATCH_MP lemma_walkup_faces) + THEN MP_TAC (CONJUNCT1(CONJUNCT2(SPECL[`G:(A)hypermap`; `x:A`; `x:A`] face_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th -> (MP_TAC (MATCH_MP inverse_function (CONJ (CONJUNCT1(CONJUNCT2(CONJUNCT2(CONJUNCT2(SPEC `J:(A)hypermap` hypermap_lemma))))) th)))) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN ABBREV_TAC `W = edge_walkup (J:(A)hypermap) (y:A)` + THEN SUBGOAL_THEN `~(face (W:(A)hypermap) (y:A) IN face_set W)` ASSUME_TAC + THENL[REWRITE_TAC[GSYM lemma_in_face_set] + THEN EXPAND_TAC "W" + THEN REWRITE_TAC[lemma_edge_walkup] + THEN REWRITE_TAC[IN_DELETE]; ALL_TAC] + THEN POP_ASSUM (MP_TAC o MATCH_MP (SET_RULE `~(a IN s) ==> (s DELETE a = s)`)) + THEN DISCH_THEN SUBST1_TAC + THEN REMOVE_THEN "F7" (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "F10" o SYM) + THEN REWRITE_TAC[double_edge_walkup] + THEN USE_THEN "J1" (fun th -> REWRITE_TAC[th]) + THEN FIND_ASSUM (fun th -> REWRITE_TAC[th]) `edge_walkup (J:(A)hypermap) (y:A) = W` + THEN MP_TAC (SPECL[`dart (W:(A)hypermap)`; `face_map (W:(A)hypermap)`] lemma_convolution_map) + THEN REWRITE_TAC[hypermap_lemma] + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[GSYM face] + THEN GEN_TAC + THEN REWRITE_TAC[lemma_in_face_set] + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[IN_DELETE] + THEN ABBREV_TAC `FF = face (W:(A)hypermap) (x':A)` + THEN DISCH_THEN (fun th -> (MP_TAC (MATCH_MP lemma_face_representation (CONJUNCT1 th)))) + THEN REPEAT STRIP_TAC + THEN REMOVE_THEN "F4" (MP_TAC o SPEC `x'':A`) + THEN ASM_REWRITE_TAC[]);; + +let double_face_walkup_plain_hypermap = prove(`!(H:(A)hypermap) (x:A).x IN dart H /\ plain_hypermap H /\ CARD (edge H x) = 2 ==> plain_hypermap (double_face_walkup H x (edge_map H x))`, + REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_representaion_Wf] + THEN REWRITE_TAC[plain_hypermap] + THEN ABBREV_TAC `G = shift(shift (H:(A)hypermap))` + THEN REWRITE_TAC[GSYM shift_lemma] + THEN MP_TAC (CONJUNCT1(SPEC `H:(A)hypermap` double_shift_lemma)) + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[edge] + THEN MP_TAC (CONJUNCT1(CONJUNCT2(SPEC `H:(A)hypermap` double_shift_lemma))) + THEN DISCH_THEN SUBST1_TAC + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[GSYM node] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN MP_TAC (SPECL[`dart (G:(A)hypermap)`; `node_map (G:(A)hypermap)`] lemma_convolution_map) + THEN ASM_REWRITE_TAC[hypermap_lemma; GSYM node] + THEN DISCH_THEN (LABEL_TAC "F4") + THEN REMOVE_THEN "F3" MP_TAC + THEN REWRITE_TAC[NODE_OF_SIZE_2] + THEN ABBREV_TAC `y = node_map (G:(A)hypermap) (x:A)` + THEN POP_ASSUM (LABEL_TAC "J0") + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6")) + THEN USE_THEN "F1" (MP_TAC o MATCH_MP lemma_walkup_nodes) + THEN ABBREV_TAC `J = edge_walkup (G:(A)hypermap) (x:A)` + THEN POP_ASSUM (LABEL_TAC "J1") + THEN USE_THEN "F6" (fun th -> (MP_TAC (MATCH_MP inverse_function (CONJ (CONJUNCT1(CONJUNCT2(CONJUNCT2(SPEC `G:(A)hypermap` hypermap_lemma)))) th)))) + THEN DISCH_THEN (fun th -> (LABEL_TAC "J2" (SYM th) THEN (SUBST1_TAC (SYM th)))) + THEN DISCH_THEN (LABEL_TAC "F7") + THEN USE_THEN "F5" MP_TAC + THEN USE_THEN "F1" (MP_TAC o CONJUNCT1 o CONJUNCT2 o MATCH_MP lemma_dart_invariant) + THEN USE_THEN "F5" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "J0" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F8") + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F8" (fun th2 -> (USE_THEN "F5" (fun th3 -> (MP_TAC (MATCH_MP lemma_in_walkup_dart (CONJ th1 (CONJ th2 th3))))))))) + THEN USE_THEN "J1" (fun th->REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F9") + THEN USE_THEN "F9" (MP_TAC o MATCH_MP lemma_walkup_nodes) + THEN MP_TAC (CONJUNCT1(CONJUNCT2(SPECL[`G:(A)hypermap`; `x:A`; `x:A`] node_map_walkup))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th -> (MP_TAC (MATCH_MP inverse_function (CONJ (CONJUNCT1(CONJUNCT2(CONJUNCT2(SPEC `J:(A)hypermap` hypermap_lemma)))) th)))) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN ABBREV_TAC `W = edge_walkup (J:(A)hypermap) (y:A)` + THEN SUBGOAL_THEN `~(node (W:(A)hypermap) (y:A) IN node_set W)` ASSUME_TAC + THENL[REWRITE_TAC[GSYM lemma_in_node_set] + THEN EXPAND_TAC "W" + THEN REWRITE_TAC[lemma_edge_walkup] + THEN REWRITE_TAC[IN_DELETE]; ALL_TAC] + THEN POP_ASSUM (MP_TAC o MATCH_MP (SET_RULE `~(a IN s) ==> (s DELETE a = s)`)) + THEN DISCH_THEN SUBST1_TAC + THEN REMOVE_THEN "F7" (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "F10" o SYM) + THEN REWRITE_TAC[double_edge_walkup] + THEN USE_THEN "J1" (fun th -> REWRITE_TAC[th]) + THEN FIND_ASSUM (fun th -> REWRITE_TAC[th]) `edge_walkup (J:(A)hypermap) (y:A) = W` + THEN MP_TAC (SPECL[`dart (W:(A)hypermap)`; `node_map (W:(A)hypermap)`] lemma_convolution_map) + THEN REWRITE_TAC[hypermap_lemma] + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[GSYM node] + THEN GEN_TAC + THEN REWRITE_TAC[lemma_in_node_set] + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[IN_DELETE] + THEN ABBREV_TAC `NN = node (W:(A)hypermap) (x':A)` + THEN DISCH_THEN (fun th -> (MP_TAC (MATCH_MP lemma_node_representation (CONJUNCT1 th)))) + THEN REPEAT STRIP_TAC + THEN REMOVE_THEN "F4" (MP_TAC o SPEC `x'':A`) + THEN ASM_REWRITE_TAC[]);; + +let lemmaHOZKXVW = prove(`!(H:(A)hypermap) (x:A).x IN dart H /\ plain_hypermap H ==> (CARD (edge H x) = 2 ==> plain_hypermap (double_face_walkup H x (edge_map H x)) /\ plain_hypermap (double_node_walkup H x (edge_map H x))) /\ (CARD (node H x) = 2 ==> plain_hypermap (double_edge_walkup H x (node_map H x)))`, + REPEAT STRIP_TAC + THENL[ASM_MESON_TAC[double_face_walkup_plain_hypermap]; + ASM_MESON_TAC[double_node_walkup_plain_hypermap]; + ASM_MESON_TAC[double_edge_walkup_plain_hypermap]]);; + +(* WE DEFINE THE MOEBIUS CONTOUR HERE *) + +let is_Moebius_contour = new_definition `is_Moebius_contour (H:(A)hypermap) (p:num->A) (k:num) <=> (is_inj_contour H p k /\ (?i:num j:num. 0 < i /\ i <=j /\ j < k /\ (p j = node_map H (p 0)) /\ (p k = node_map H (p i))))`;; + +let lemma_contour_in_dart = prove(`!(H:(A)hypermap) (p:num->A) (n:num). p 0 IN dart H /\ is_contour H p n ==> p n IN dart H`, + REPLICATE_TAC 2 GEN_TAC + THEN INDUCT_TAC + THENL[SIMP_TAC[]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F1") + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F2") (MP_TAC)) + THEN REWRITE_TAC[is_contour] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")) + THEN REMOVE_THEN "F1" MP_TAC + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "F5") + THEN REMOVE_THEN "F4" MP_TAC + THEN REWRITE_TAC[one_step_contour] + THEN STRIP_TAC + THENL[USE_THEN "F5" (fun th -> (MP_TAC(CONJUNCT2(CONJUNCT2(MATCH_MP lemma_dart_invariant th))))) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN SIMP_TAC[]; ALL_TAC] + THEN USE_THEN "F5" (fun th -> (MP_TAC(CONJUNCT1(CONJUNCT2(MATCH_MP lemma_dart_inveriant_under_inverse_maps th))))) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN SIMP_TAC[]);; + +let lemma_darts_in_contour = prove(`!(H:(A)hypermap) (p:num->A) (n:num). p 0 IN dart H /\ is_contour H p n ==> {p (i:num) | i <= n} SUBSET dart H`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN REWRITE_TAC[SUBSET; EXTENSION; IN_ELIM_THM] + THEN REPEAT STRIP_TAC + THEN USE_THEN "F2" (MP_TAC o SPEC `i:num` o MATCH_MP lemma_subcontour) + THEN POP_ASSUM SUBST1_TAC + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F1" (fun th1 -> (DISCH_THEN (fun th2 -> (MP_TAC (MATCH_MP lemma_contour_in_dart (CONJ th1 th2)))))) + THEN SIMP_TAC[]);; + +let lemma_first_dart_on_inj_contour = prove(`!(H:(A)hypermap) (p:num->A) (n:num). 0 < n /\ is_inj_contour H p n ==> p 0 IN dart H`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN ASM_CASES_TAC `~(((p:num->A) 0) IN dart (H:(A)hypermap))` + THENL[SUBGOAL_THEN `!m:num. m <= n ==> (p:num->A) m = p 0` ASSUME_TAC + THENL[INDUCT_TAC THENL[ ARITH_TAC; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "J0") + THEN DISCH_THEN (LABEL_TAC "J1") + THEN REMOVE_THEN "J0" MP_TAC + THEN USE_THEN "J1" (ASSUME_TAC o REWRITE_RULE[LE_SUC_LT]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN DISCH_TAC + THEN ABBREV_TAC `x = (p:num->A) 0` + THEN USE_THEN "F2" (MP_TAC o SPEC `m:num` o CONJUNCT1 o REWRITE_RULE[lemma_def_inj_contour; lemma_def_contour]) + THEN REWRITE_TAC[GSYM LE_SUC_LT] + THEN REMOVE_THEN "J1" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[one_step_contour] + THEN ASM_REWRITE_TAC[] + THEN MP_TAC (SPEC `x:A` (MATCH_MP map_permutes_outside_domain (CONJUNCT2(SPEC `H:(A)hypermap` face_map_and_darts)))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC (SPEC `x:A` (MATCH_MP map_permutes_outside_domain (CONJUNCT2(SPEC `H:(A)hypermap` node_map_and_darts)))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (SUBST1_TAC o SYM o ONCE_REWRITE_RULE[node_map_inverse_representation] o SYM) + THEN SIMP_TAC[]; ALL_TAC] + THEN USE_THEN "F2" (MP_TAC o SPECL[`n:num`; `0`] o CONJUNCT2 o REWRITE_RULE[lemma_def_inj_contour]) + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[th; LE_REFL]) + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[LE_REFL] o SPEC `n:num`) + THEN MESON_TAC[]; ALL_TAC] + THEN POP_ASSUM (fun th -> MESON_TAC[th]));; + +let lemma_darts_on_Moebius_contour = prove(`!(H:(A)hypermap) (p:num->A) (k:num). is_Moebius_contour H p k ==> (2 <= k) /\ (p:num->A) 0 IN dart H /\ SUC k <= CARD(dart H)`, + REPEAT GEN_TAC THEN REWRITE_TAC[is_Moebius_contour] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "FJ") (STRIP_ASSUME_TAC)) + THEN MP_TAC (ARITH_RULE `0 < i:num /\ i <= j:num /\ j < k:num ==> 2 <= k`) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th -> (ASSUME_TAC th THEN REWRITE_TAC[th])) + THEN MP_TAC (SPECL[`H:(A)hypermap`; `p:num->A`; `k:num`] lemma_first_dart_on_inj_contour) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE`2 <= k:num ==> 0 < k`) th]) + THEN USE_THEN "FJ" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F1") + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "FJ" (MP_TAC o CONJUNCT2 o REWRITE_RULE[lemma_def_inj_contour]) + THEN GEN_REWRITE_TAC (LAND_CONV o TOP_DEPTH_CONV) [GSYM LT_SUC_LE] + THEN REWRITE_TAC[MESON[] `~(a = b) <=> ~(b=a)`] + THEN DISCH_THEN (MP_TAC o MATCH_MP CARD_FINITE_SERIES_EQ) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN USE_THEN "FJ" (MP_TAC o CONJUNCT1 o REWRITE_RULE[lemma_def_inj_contour]) + THEN DISCH_THEN (fun th1 -> (USE_THEN "F1" (fun th -> (MP_TAC(MATCH_MP lemma_darts_in_contour (CONJ th th1)))))) + THEN GEN_REWRITE_TAC (LAND_CONV o TOP_DEPTH_CONV) [GSYM LT_SUC_LE] + THEN DISCH_TAC + THEN MATCH_MP_TAC CARD_SUBSET + THEN POP_ASSUM (fun th -> REWRITE_TAC[th; hypermap_lemma]));; + +let lemma_Moebius_contour_points_subset_darts = prove(`!(H:(A)hypermap) (p:num -> A) (k:num). is_Moebius_contour H p k ==> {p (i:num) | i <= k} SUBSET dart H /\ CARD ({p (i:num) | i <= k}) = SUC k`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN USE_THEN "F1" (LABEL_TAC "F2" o CONJUNCT1 o CONJUNCT2 o MATCH_MP lemma_darts_on_Moebius_contour) + THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[is_Moebius_contour] + THEN DISCH_THEN (MP_TAC o CONJUNCT1) + THEN REWRITE_TAC[lemma_def_inj_contour] + THEN DISCH_THEN (CONJUNCTS_THEN2 (MP_TAC) (LABEL_TAC "F3")) + THEN REMOVE_THEN "F2" (fun th1 -> (DISCH_THEN (fun th2 -> (MP_TAC (MATCH_MP lemma_darts_in_contour (CONJ th1 th2)))))) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN MP_TAC (GSYM (SPECL[`SUC (k:num)`; `p:num->A`] CARD_FINITE_SERIES_EQ)) + THEN REWRITE_TAC[LT_SUC_LE] + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[EQ_SYM]);; + +let lemma_darts_is_Moebius_contour = prove(`!(H:(A)hypermap) (p:num->A) (k:num). is_Moebius_contour H p k /\ SUC k = CARD(dart H) ==> dart H = {p (i:num) | i <= k}`, + REPEAT STRIP_TAC + THEN CONV_TAC SYM_CONV + THEN FIRST_X_ASSUM (MP_TAC o MATCH_MP lemma_Moebius_contour_points_subset_darts) + THEN POP_ASSUM SUBST1_TAC + THEN MP_TAC (CONJUNCT1 (SPEC `H:(A)hypermap` hypermap_lemma)) + THEN REWRITE_TAC[IMP_IMP; CARD_SUBSET_EQ]);; + +let lemma_point_in_list = prove(`!(p:num->A) k:num x:A. (x IN {p (i:num) | i <= k} <=> ?j:num. j <= k /\ x = p j)`, REWRITE_TAC[IN_ELIM_THM]);; + +let lemma_point_not_in_list = prove(`!(p:num->A) k:num x:A. ~(x IN {p (i:num) | i <= k}) <=> !j:num. j <= k ==> ~(x = p j)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_point_in_list] + THEN MESON_TAC[]);; + +let lemma_eliminate_dart_ouside_Moebius_contour = prove(`!(H:(A)hypermap) (p:num->A) (k:num) (x:A). is_Moebius_contour H p k /\ ~(x IN {p (i:num) | i <= k}) ==> is_Moebius_contour (edge_walkup H x) p k`, + REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_point_not_in_list] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN label_hypermap4_TAC `H:(A)hypermap` + THEN (LABEL_TAC "G1" (CONJUNCT1(CONJUNCT2(SPEC `edge_walkup (H:(A)hypermap) (x:A)` hypermap_lemma)))) + THEN (LABEL_TAC "G2" (CONJUNCT1(CONJUNCT2(CONJUNCT2(SPEC `edge_walkup (H:(A)hypermap) (x:A)` hypermap_lemma))))) + THEN (LABEL_TAC "G3" (CONJUNCT1(CONJUNCT2(CONJUNCT2(CONJUNCT2(SPEC `edge_walkup (H:(A)hypermap) (x:A)` hypermap_lemma)))))) + THEN ABBREV_TAC `G = edge_walkup (H:(A)hypermap) (x:A)` + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN ABBREV_TAC `e = edge_map (H:(A)hypermap)` + THEN ABBREV_TAC `n = node_map (H:(A)hypermap)` + THEN ABBREV_TAC `f = face_map (H:(A)hypermap)` + THEN ABBREV_TAC `D' = dart (G:(A)hypermap)` + THEN ABBREV_TAC `e' = edge_map (G:(A)hypermap)` + THEN ABBREV_TAC `n' = node_map (G:(A)hypermap)` + THEN ABBREV_TAC `f' = face_map (G:(A)hypermap)` + THEN SUBGOAL_THEN `!i:num j:num. i <= k /\ j <= k /\ (n:A->A) ((p:num->A) i) = p j ==> (n':A->A) (p i) = p j` (LABEL_TAC "F3") + THENL[REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "E3") (CONJUNCTS_THEN2 (LABEL_TAC "E4") (LABEL_TAC "E5"))) + THEN USE_THEN "F2" (MP_TAC o GSYM o SPEC `i:num`) + THEN USE_THEN "E3" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "E6") + THEN USE_THEN "F2" (MP_TAC o GSYM o SPEC `j:num`) + THEN USE_THEN "E4" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "E7") + THEN SUBGOAL_THEN `~((p:num->A) (i:num) = inverse (n:A->A) (x:A))` (LABEL_TAC "E8") + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN (MP_TAC o AP_TERM `n:A->A`) + THEN USE_THEN "E5" SUBST1_TAC + THEN USE_THEN "H3" (fun th -> REWRITE_TAC[MATCH_MP PERMUTES_INVERSES th]); ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `(p:num->A) (i:num)`] node_map_walkup))) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `!i:num j:num. i <= k /\ j <= k /\ inverse (n:A->A) ((p:num->A) i) = p j ==> inverse (n':A->A) (p i) = p j` (LABEL_TAC "F4") + THENL[USE_THEN "H3" (fun th -> REWRITE_TAC[MATCH_MP PERMUTES_INVERSE_EQ th]) + THEN USE_THEN "G2" (fun th -> REWRITE_TAC[MATCH_MP PERMUTES_INVERSE_EQ th]) + THEN POP_ASSUM (fun th -> MESON_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `!i:num j:num. i <= k /\ j <= k /\ (f:A->A) ((p:num->A) i) = p j ==> (f':A->A) (p i) = p j` (LABEL_TAC "F5") + THENL[ REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "FE3") (CONJUNCTS_THEN2 (LABEL_TAC "FE4") (LABEL_TAC "FE5"))) + THEN USE_THEN "F2" (MP_TAC o GSYM o SPEC `i:num`) + THEN USE_THEN "FE3" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "FE6") + THEN USE_THEN "F2" (MP_TAC o GSYM o SPEC `j:num`) + THEN USE_THEN "FE4" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "FE7") + THEN SUBGOAL_THEN `~((p:num->A) (i:num) = inverse (f:A->A) (x:A))` (LABEL_TAC "FE8") + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN (MP_TAC o AP_TERM `f:A->A`) + THEN USE_THEN "FE5" SUBST1_TAC + THEN USE_THEN "H4" (fun th -> REWRITE_TAC[MATCH_MP PERMUTES_INVERSES th]); ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `x:A`; `(p:num->A) (i:num)`] face_map_walkup))) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `!i:num. i <= k:num /\is_inj_contour (H:(A)hypermap) (p:num->A) i ==> is_inj_contour (G:(A)hypermap) (p:num->A) i` ASSUME_TAC + THENL[INDUCT_TAC + THENL[REWRITE_TAC[is_inj_contour]; ALL_TAC] + THEN REWRITE_TAC[is_inj_contour] + THEN POP_ASSUM (LABEL_TAC "J1") + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "J2") (CONJUNCTS_THEN2 (LABEL_TAC "J3") (CONJUNCTS_THEN2 (LABEL_TAC "J4") (LABEL_TAC "J10")))) + THEN USE_THEN "J2" (LABEL_TAC "J5" o MATCH_MP (ARITH_RULE `SUC (i:num) <= (k:num) ==> i <= k`)) + THEN REMOVE_THEN "J1" MP_TAC + THEN USE_THEN "J5" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "J3" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "J10" (fun th -> REWRITE_TAC[th]) + THEN REMOVE_THEN "J4" MP_TAC + THEN REWRITE_TAC[one_step_contour] + THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC + THENL[DISJ1_TAC + THEN USE_THEN "F5" (MP_TAC o SPECL[`i:num`; `SUC (i:num)`]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "J2" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN DISJ2_TAC + THEN USE_THEN "F4" (MP_TAC o SPECL[`i:num`; `SUC i`]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "J2" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN POP_ASSUM (MP_TAC o SPEC `k:num`) + THEN REWRITE_TAC[LE_REFL] + THEN DISCH_THEN (LABEL_TAC "F6") + THEN REMOVE_THEN "F1" (MP_TAC) + THEN REWRITE_TAC[is_Moebius_contour] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F7") (LABEL_TAC "F8")) + THEN REMOVE_THEN "F6" MP_TAC + THEN USE_THEN "F7" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN POP_ASSUM (X_CHOOSE_THEN `i:num` (X_CHOOSE_THEN `j:num` MP_TAC)) + THEN FIND_ASSUM SUBST1_TAC `node_map (H:(A)hypermap) = n` + THEN FIND_ASSUM SUBST1_TAC `node_map (G:(A)hypermap) = n'` + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F9") (CONJUNCTS_THEN2 (LABEL_TAC "F10") (CONJUNCTS_THEN2 (LABEL_TAC "F11") (CONJUNCTS_THEN2 (LABEL_TAC "F12") (LABEL_TAC "F13"))))) + THEN EXISTS_TAC `i:num` + THEN EXISTS_TAC `j:num` + THEN USE_THEN "F9" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F10" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F11" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F11" (LABEL_TAC "F15" o MATCH_MP (ARITH_RULE `j:num < k:num ==> j <= k`)) + THEN USE_THEN "F10" (fun th1 -> (USE_THEN "F15" (fun th2-> (LABEL_TAC "F16" (MATCH_MP LE_TRANS (CONJ th1 th2)))))) + THEN USE_THEN "F3" (MP_TAC o SPECL[`0`; `j:num`]) + THEN USE_THEN "F16" (fun th -> REWRITE_TAC[th; LE_0]) + THEN USE_THEN "F15" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F12" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F3" (MP_TAC o SPECL[`i:num`; `k:num`]) + THEN USE_THEN "F16" (fun th -> REWRITE_TAC[th; LE_REFL]) + THEN USE_THEN "F13" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[EQ_SYM]);; + +let shift_path = new_definition `shift_path (p:num->A) (l:num) = \i:num. p (l + i)`;; + +let lemma_shift_path_evaluation = prove(`!p:num->A l:num i:num. shift_path p l i = p (l+i)`, REWRITE_TAC[shift_path]);; + +let lemma_shift_path = prove(`!(H:(A)hypermap) (p:num->A) (n:num) (l:num). is_path H p n /\ l <= n ==> is_path H (shift_path p l) (n-l)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_def_path] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F3") + THEN REWRITE_TAC[go_one_step] + THEN REWRITE_TAC[lemma_shift_path_evaluation; ADD_SUC] + THEN USE_THEN "F3" (ASSUME_TAC o MATCH_MP (ARITH_RULE `i:num < (n:num) - (l:num) ==> l +i < n`)) + THEN REWRITE_TAC[GSYM go_one_step] + THEN USE_THEN "F1" (MP_TAC o SPEC `(l:num) + (i:num)`) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]));; + + +let lemma_shift_contour = prove(`!(H:(A)hypermap) (p:num->A) (n:num) (l:num). is_contour H p n /\ l <= n ==> is_contour H (shift_path p l) (n-l)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_def_contour] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F3") + THEN REWRITE_TAC[one_step_contour] + THEN REWRITE_TAC[lemma_shift_path_evaluation; ADD_SUC] + THEN USE_THEN "F3" (ASSUME_TAC o MATCH_MP (ARITH_RULE `i:num < (n:num) - (l:num) ==> l +i < n`)) + THEN REWRITE_TAC[GSYM one_step_contour] + THEN USE_THEN "F1" (MP_TAC o SPEC `(l:num) + (i:num)`) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]));; + +let lemma_shift_inj_contour = prove(`!(H:(A)hypermap) (p:num->A) (n:num) (l:num). is_inj_contour H p n /\ l <= n + ==> is_inj_contour H (shift_path p l) (n-l)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_def_inj_contour] + THEN REWRITE_TAC[lemma_shift_path_evaluation] + THEN DISCH_THEN (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) (LABEL_TAC "F3")) + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F3" (fun th2 -> REWRITE_TAC[MATCH_MP lemma_shift_contour (CONJ th1 th2)]))) + THEN REPEAT GEN_TAC + THEN DISCH_THEN (MP_TAC o MATCH_MP (ARITH_RULE `i:num <= (n:num) -(l:num) /\ j:num < i ==> l + i <= n /\ l + j < l + i`)) + THEN DISCH_TAC + THEN USE_THEN "F2" (MP_TAC o SPECL[`(l:num) + (i:num)`; `(l:num) + (j:num)`]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]));; + +let lemma_join_contours = prove(`!(H:(A)hypermap) p:num->A q:num->A n:num m:num. is_contour H p n /\ is_contour H q m /\ one_step_contour H (p n) (q 0) + ==> is_contour H (join p q n) (n + m + 1)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_def_contour] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN GEN_TAC THEN DISCH_THEN (LABEL_TAC "F4") + THEN ASM_CASES_TAC `i:num < n:num` + THENL[POP_ASSUM (LABEL_TAC "F5") + THEN USE_THEN "F5" (fun th -> (MP_TAC (MATCH_MP LT_IMP_LE th)) THEN ASSUME_TAC (REWRITE_RULE[GSYM LE_SUC_LT] th)) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP first_join_evaluation th]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP first_join_evaluation th]) + THEN POP_ASSUM (fun th-> USE_THEN "F1" (fun thm -> REWRITE_TAC[MATCH_MP thm th])); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F5" o REWRITE_RULE[NOT_LT]) + THEN ASM_CASES_TAC `i = n:num` + THENL[POP_ASSUM (SUBST_ALL_TAC) + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP first_join_evaluation th]) + THEN ONCE_REWRITE_TAC[ADD1] THEN REWRITE_TAC[ONE] + THEN REWRITE_TAC[second_join_evaluation] + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (fun th-> POP_ASSUM (fun th1 -> ASSUME_TAC (REWRITE_RULE[GSYM LT_LE] (CONJ th1 (GSYM th))))) + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[LT_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` SUBST_ALL_TAC) + THEN GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [ADD_SYM] + THEN GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [CONJUNCT2(GSYM ADD)] + THEN GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [ADD_SYM] + THEN REWRITE_TAC[second_join_evaluation] + THEN USE_THEN "F4" (MP_TAC o REWRITE_RULE[GSYM ADD1; LT_ADD_LCANCEL; LT_SUC]) + THEN DISCH_THEN(fun th-> USE_THEN "F2" (fun thm -> REWRITE_TAC[MATCH_MP thm th])));; + +let lemma_inj_contour_via_list = prove(`!(H:(A)hypermap) p:num->A n:num. is_inj_contour H p n + <=> is_contour H p n /\ is_inj_list p n`, + REWRITE_TAC[lemma_inj_list; lemma_def_inj_contour]);; + +let lemma_join_inj_contours = prove(`!(H:(A)hypermap) p:num->A q:num->A n:num m:num. is_inj_contour H p n /\ is_inj_contour H q m /\ one_step_contour H (p n) (q 0) /\ is_disjoint p q n m ==> is_inj_contour H (join p q n) (n + m + 1)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 MP_TAC (LABEL_TAC "F3")))) + THEN REWRITE_TAC[lemma_inj_contour_via_list] + THEN USE_THEN "F2" (MP_TAC o CONJUNCT1 o REWRITE_RULE[lemma_inj_contour_via_list]) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT1 o REWRITE_RULE[lemma_inj_contour_via_list]) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_join_contours th]) + THEN POP_ASSUM MP_TAC + THEN REPLICATE_TAC 2 (POP_ASSUM (MP_TAC o CONJUNCT2 o REWRITE_RULE[lemma_inj_contour_via_list])) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_join_inj_lists th]));; + +let lemma_glue_inj_contours = prove(`!(H:(A)hypermap) (p:num->A) (q:num->A) n:num m:num. is_inj_contour H p n /\ is_inj_contour H q m /\ is_glueing p q n m ==> is_inj_contour H (glue p q n) (n+m)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_inj_contour_via_list; GSYM LT1_NZ; GSYM lemma_not_in_list] + THEN DISCH_THEN (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) (CONJUNCTS_THEN2(CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4"))(LABEL_TAC "F5"))) + THEN USE_THEN "F2" (fun th-> USE_THEN "F4" (fun th1-> USE_THEN "F5" (fun th2-> REWRITE_TAC[MATCH_MP lemma_glue_inj_lists (CONJ th (CONJ th1 th2))]))) + THEN USE_THEN "F5" (LABEL_TAC "F6" o CONJUNCT1 o REWRITE_RULE[is_glueing]) + THEN USE_THEN "F1" (fun th-> USE_THEN "F3" (fun th1-> USE_THEN "F6" (fun th2-> REWRITE_TAC[MATCH_MP lemma_glue_contours (CONJ th (CONJ th1 th2))]))));; + +let concatenate_two_contours = prove(`!(H:(A)hypermap) (p:num->A) (q:num->A) n:num m:num. is_inj_contour H p n /\ is_inj_contour H q m /\ p n = q 0 /\ (!j:num. 0 < j /\ j <= m ==> (!i:num. i <= n ==> ~(q j = p i))) ==> ?g:num->A. g 0 = p 0 /\ g (n+m) = q m /\ is_inj_contour H g (n+m) /\ (!i:num. i <= n ==> g i = p i) /\ (!i:num. i <= m ==> g (n+i) = q i)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[GSYM LT1_NZ; GSYM lemma_not_in_list; GSYM is_glueing] + THEN DISCH_THEN (LABEL_TAC "F1") THEN EXISTS_TAC `glue (p:num->A) (q:num->A) (n:num)` + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_glue_inj_contours th]) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT1 o REWRITE_RULE[is_glueing] o CONJUNCT2 o CONJUNCT2) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP second_glue_evaluation th]) + THEN REWRITE_TAC[first_glue_evaluation] THEN REWRITE_TAC[glue; LE_0]);; + +let concatenate_two_disjoint_contours = prove(`!(H:(A)hypermap) (p:num->A) (q:num->A) n:num m:num. is_inj_contour H p n /\ is_inj_contour H q m /\ one_step_contour H (p n) (q 0) /\(!i:num j:num. i <= n /\ j <= m ==> ~(q j = p i)) ==> ?g:num->A. g 0 = p 0 /\ g (n+m+1) = q m /\ is_inj_contour H g (n+m+1) /\ (!i:num. i <= n ==> g i = p i) /\ (!i:num. i <= m ==> g (n+i+1) = q i)`, + REPEAT GEN_TAC + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [MESON[] `~(A = B) <=> ~(B = A)`] + THEN REWRITE_TAC[GSYM lemma_list_disjoint] + THEN DISCH_THEN (ASSUME_TAC o MATCH_MP lemma_join_inj_contours) + THEN EXISTS_TAC `join (p:num->A) (q:num->A) (n:num)` + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN REWRITE_TAC[first_join_evaluation] + THEN REWRITE_TAC[GSYM ADD1; second_join_evaluation] + THEN REWRITE_TAC[join; LE_0]);; + +(* Lemma on reducing darts from a contour to make an injective contour *) + +let lemmaQZTPGJV = prove(`!(H:(A)hypermap) p:num->A n:num. is_contour H p n ==> ?q:num->A m:num. m <= n /\q 0 = p 0 /\ q m = p n /\ is_inj_contour H q m /\ (!i:num. (i < m)==>(?j:num. i <= j /\ j < n /\ q i = p j /\ q (SUC i) = p (SUC j)))`, + REPLICATE_TAC 2 GEN_TAC + THEN INDUCT_TAC + THENL[STRIP_TAC THEN EXISTS_TAC `p:num->A` THEN EXISTS_TAC `0` THEN ASM_REWRITE_TAC[is_inj_contour] THEN ARITH_TAC; ALL_TAC] + THEN REWRITE_TAC[is_contour] THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN FIRST_X_ASSUM(MP_TAC o check(is_imp o concl)) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (X_CHOOSE_THEN `q:num->A` (X_CHOOSE_THEN `m:num` (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7"))))))) + THEN ASM_CASES_TAC `?k:num. k <= m:num /\ (q:num->A) k = p (SUC n:num)` + THENL[POP_ASSUM (X_CHOOSE_THEN `k:num` (CONJUNCTS_THEN2 (LABEL_TAC "G1") (LABEL_TAC "G2"))) + THEN EXISTS_TAC `q:num->A` + THEN EXISTS_TAC `k:num` + THEN ASM_REWRITE_TAC[] + THEN USE_THEN "G1" (fun th1 -> (USE_THEN "F3" (fun th2 -> MP_TAC(MATCH_MP LE_TRANS (CONJ th1 th2))))) + THEN DISCH_THEN (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `k:num <= n:num ==> k <= SUC n`) th]) + THEN USE_THEN "F6" (MP_TAC o (SPEC `k:num`) o MATCH_MP lemma_sub_inj_contour) + THEN USE_THEN "G1" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN REPEAT STRIP_TAC + THEN USE_THEN "F7" (MP_TAC o SPEC `i:num`) + THEN POP_ASSUM (fun th -> (USE_THEN "G1" (fun th1 -> REWRITE_TAC[MATCH_MP LTE_TRANS (CONJ th th1)]))) + THEN MESON_TAC[LT_RIGHT_SUC]; ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN STRIP_TAC + THEN ABBREV_TAC `g = (\i:num. (p:num->A) (SUC n))` + THEN SUBGOAL_THEN `is_inj_contour (H:(A)hypermap) (g:num->A) 0` ASSUME_TAC + THENL[REWRITE_TAC[is_inj_contour]; ALL_TAC] + THEN SUBGOAL_THEN `one_step_contour (H:(A)hypermap) ((q:num->A) (m:num)) ((g:num->A) 0)` ASSUME_TAC + THENL[USE_THEN "F5" SUBST1_TAC + THEN EXPAND_TAC "g" + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `!i:num j:num. i <= m:num /\ j <= 0 ==> ~((g:num->A) j = (q:num->A) i)` ASSUME_TAC + THENL[REPEAT GEN_TAC + THEN REWRITE_TAC[LE] + THEN STRIP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN EXPAND_TAC "g" + THEN FIRST_ASSUM (MP_TAC o check (is_neg o concl)) + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN SUBST1_TAC + THEN EXISTS_TAC `i:num` + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN USE_THEN "F6" (fun th1 -> (POP_ASSUM (fun th4 -> (POP_ASSUM (fun th3 -> (POP_ASSUM (fun th2 -> (MP_TAC (MATCH_MP concatenate_two_disjoint_contours (CONJ th1 (CONJ th2 (CONJ th3 th4)))))))))))) + THEN EXPAND_TAC "g" + THEN REWRITE_TAC[ADD;GSYM ADD1; ADD_SUC] + THEN DISCH_THEN (X_CHOOSE_THEN `w:num->A` (CONJUNCTS_THEN2 (LABEL_TAC "H1") (CONJUNCTS_THEN2 (LABEL_TAC "H2") (CONJUNCTS_THEN2 (LABEL_TAC "H3") (LABEL_TAC "H4" o CONJUNCT1))))) + THEN EXISTS_TAC `w:num->A` + THEN EXISTS_TAC `SUC m` + THEN REWRITE_TAC[LE_SUC] + THEN ASM_REWRITE_TAC[] + THEN REPEAT STRIP_TAC + THEN POP_ASSUM MP_TAC + THEN GEN_REWRITE_TAC (LAND_CONV o TOP_DEPTH_CONV) [LT_SUC_LE; LE_LT] + THEN STRIP_TAC + THENL[POP_ASSUM (LABEL_TAC "H5") + THEN USE_THEN "F7" (MP_TAC o SPEC `i:num`) + THEN USE_THEN "H5" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "H4" (MP_TAC o SPEC `i:num`) + THEN USE_THEN "H5" (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "H4" (MP_TAC o SPEC `SUC i`) + THEN REWRITE_TAC[LE_SUC_LT] + THEN USE_THEN "H5" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN SUBST1_TAC + THEN MESON_TAC[ARITH_RULE `j:num < n:num ==> j < SUC n`]; ALL_TAC] + THEN EXISTS_TAC `n:num` + THEN REWRITE_TAC[LT_PLUS] + THEN POP_ASSUM SUBST1_TAC + THEN USE_THEN "H2" SUBST1_TAC + THEN USE_THEN "H4" (MP_TAC o SPEC `m:num`) + THEN REWRITE_TAC[LE_REFL; EQ_SYM] + THEN USE_THEN "F5" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[th]));; + +let lemma_one_step_contour = prove(`!(H:(A)hypermap) (x:A) (y:A). one_step_contour H x y <=> y = face_map H x \/ x = node_map H y`, + REPEAT GEN_TAC + THEN REWRITE_TAC[one_step_contour] + THEN REWRITE_TAC[] + THEN MP_TAC(SPECL[`y:A`; `x:A`] (MATCH_MP PERMUTES_INVERSE_EQ (CONJUNCT1(CONJUNCT2(CONJUNCT2(SPEC `H:(A)hypermap` hypermap_lemma)))))) + THEN MESON_TAC[]);; + +let lemma_only_one_orbit = prove(`!s:A->bool p:A->A x:A. FINITE s /\ p permutes s /\ orbit_map p x = s ==> set_of_orbits s p = {orbit_map p x}`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN MP_TAC (SPECL[`p:A->A`; `x:A`] orbit_reflect) + THEN USE_THEN "F3" (fun th -> GEN_REWRITE_TAC (LAND_CONV o RAND_CONV) [th]) + THEN DISCH_THEN (LABEL_TAC "F4") + THEN MATCH_MP_TAC SUBSET_ANTISYM + THEN STRIP_TAC + THENL[REWRITE_TAC[SUBSET; IN_SING] + THEN GEN_TAC + THEN REWRITE_TAC[set_of_orbits; IN_ELIM_THM] + THEN STRIP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN POP_ASSUM MP_TAC + THEN USE_THEN "F3" (SUBST1_TAC o SYM) + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (DISCH_THEN (fun th3 -> (MP_TAC (MATCH_MP lemma_orbit_identity (CONJ th1 (CONJ th2 th3))))))))) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN REWRITE_TAC[set_of_orbits; SUBSET; IN_SING; IN_ELIM_THM] + THEN GEN_TAC + THEN DISCH_TAC + THEN EXISTS_TAC `x:A` + THEN ASM_REWRITE_TAC[]);; + +let lemma_atmost_two_orbits = prove(`!s:A->bool p:A->A x:A y:A. FINITE s /\ p permutes s /\ s SUBSET (orbit_map p x UNION orbit_map p y) + ==> number_of_orbits s p <=2`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN SUBGOAL_THEN `set_of_orbits (s:A->bool) (p:A->A) SUBSET {orbit_map p (x:A), orbit_map p (y:A)}` ASSUME_TAC + THENL[ REWRITE_TAC[set_of_orbits; SUBSET; IN_ELIM_THM] + THEN REPEAT STRIP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN USE_THEN "F3" MP_TAC + THEN REWRITE_TAC[SUBSET] + THEN DISCH_THEN (MP_TAC o SPEC `x'':A`) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[IN_UNION] + THEN STRIP_TAC + THENL[USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (POP_ASSUM (fun th3 -> (MP_TAC (MATCH_MP lemma_orbit_identity (CONJ th1 (CONJ th2 th3))))))))) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN SET_TAC[]; ALL_TAC] + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F2" (fun th2 -> (POP_ASSUM (fun th3 -> (MP_TAC (MATCH_MP lemma_orbit_identity (CONJ th1 (CONJ th2 th3))))))))) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN SET_TAC[]; ALL_TAC] + THEN MP_TAC (ISPECL[`orbit_map (p:A->A) (x:A)`; `orbit_map (p:A->A) (y:A)`] FINITE_TWO_ELEMENTS) + THEN POP_ASSUM (fun th1 -> (DISCH_THEN (fun th2 -> (MP_TAC (MATCH_MP CARD_SUBSET (CONJ th1 th2)))))) + THEN REWRITE_TAC[number_of_orbits] + THEN ASM_CASES_TAC `orbit_map (p:A->A) (x:A) = orbit_map p (y:A)` + THENL[POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[SET_RULE `{a,a} = {a}`; CARD_SINGLETON] + THEN ARITH_TAC; ALL_TAC] + THEN POP_ASSUM (MP_TAC o MATCH_MP CARD_TWO_ELEMENTS) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]));; + +let lemma_only_one_component = prove(`!(H:(A)hypermap) (x:A). comb_component H x = dart H ==> set_of_components H = {comb_component H x}`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] lemma_component_reflect) + THEN DISCH_THEN (LABEL_TAC "F2") + THEN MATCH_MP_TAC SUBSET_ANTISYM + THEN STRIP_TAC + THENL[REWRITE_TAC[SUBSET; IN_SING] + THEN GEN_TAC + THEN REWRITE_TAC[set_of_components; set_part_components;IN_ELIM_THM] + THEN STRIP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN POP_ASSUM MP_TAC + THEN USE_THEN "F1" (SUBST1_TAC o SYM) + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_component_identity) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN REWRITE_TAC[set_of_components; SUBSET; IN_SING; IN_ELIM_THM; set_part_components] + THEN GEN_TAC + THEN DISCH_TAC + THEN EXISTS_TAC `x:A` + THEN REMOVE_THEN "F1" (SUBST1_TAC o SYM) + THEN ASM_REWRITE_TAC[]);; + + +(* THE MINIMUM HYPERMAP WHICH HAS A MOEBIUS CONTOUR - THE HYPERMAP OF ORDER 3 *) + +let lemma_minimum_Moebius_hypermap = prove(`!(H:(A)hypermap). CARD(dart H) = 3 /\ (?p:num->A k:num. is_Moebius_contour H p k) ==> ~(planar_hypermap H)`, + GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (X_CHOOSE_THEN `p:num->A` (X_CHOOSE_THEN `k:num` (LABEL_TAC "F2")))) + THEN USE_THEN "F2" (MP_TAC o MATCH_MP lemma_darts_on_Moebius_contour) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN ASSUME_TAC + THEN MP_TAC (ARITH_RULE `2 <= k:num /\ SUC k <= 3 ==> k = 2`) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN SUBST_ALL_TAC + THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[ARITH_RULE `3 = SUC 2`] + THEN USE_THEN "F2" (fun th1 -> (DISCH_THEN (fun th2 -> (MP_TAC(MATCH_MP lemma_darts_is_Moebius_contour (CONJ th1 (SYM th2))))))) + THEN DISCH_THEN (LABEL_TAC "F3") + THEN USE_THEN "F2" MP_TAC + THEN REWRITE_TAC[is_Moebius_contour] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F4") (X_CHOOSE_THEN `i:num` (X_CHOOSE_THEN `j:num` MP_TAC))) + THEN USE_THEN "F3" SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "C1") + THEN MP_TAC (ARITH_RULE `0 < i:num /\ i <= j:num /\ j < 2 ==> (i = 1) /\ (j = 1)`) + THEN USE_THEN "C1" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6")) + THEN REMOVE_THEN "C1" MP_TAC + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[ARITH_RULE `0 < 1 /\ 1 <= 1 /\ 1 < 2`] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F7") (LABEL_TAC "F8")) + THEN USE_THEN "F4" MP_TAC + THEN REWRITE_TAC[lemma_def_inj_contour] + THEN DISCH_THEN (LABEL_TAC "C2" o CONJUNCT2) + THEN USE_THEN "C2" (MP_TAC o SPECL[`1`; `0`]) + THEN REWRITE_TAC[ARITH_RULE `1 <= 2 /\ 0 < 1`] + THEN DISCH_THEN (LABEL_TAC "F9") + THEN USE_THEN "C2" (MP_TAC o SPECL[`2`; `1`]) + THEN REWRITE_TAC[LE_REFL; ARITH_RULE `1 < 2`] + THEN DISCH_THEN (LABEL_TAC "F10") + THEN REMOVE_THEN "C2" (MP_TAC o SPECL[`2`; `0`]) + THEN REWRITE_TAC[LE_REFL; ARITH_RULE `0 < 2`] + THEN DISCH_THEN (LABEL_TAC "F11") + THEN USE_THEN "F4" MP_TAC + THEN REWRITE_TAC[lemma_def_inj_contour] + THEN DISCH_THEN (MP_TAC o CONJUNCT1) + THEN REWRITE_TAC[lemma_def_contour] + THEN DISCH_THEN (LABEL_TAC "C2") + THEN USE_THEN "C2" (MP_TAC o SPEC `0`) + THEN REWRITE_TAC[ARITH_RULE `0 < 2`; GSYM ONE; one_step_contour] + THEN GEN_REWRITE_TAC (LAND_CONV) [GSYM DISJ_SYM] + THEN STRIP_TAC + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[GSYM node_map_inverse_representation] + THEN USE_THEN "F8" (SUBST1_TAC o SYM) + THEN USE_THEN "F11" (fun th -> REWRITE_TAC[GSYM th]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F12") + THEN REMOVE_THEN "C2" (MP_TAC o SPEC `1`) + THEN REWRITE_TAC[ARITH_RULE `1 < 2`; GSYM TWO; one_step_contour] + THEN GEN_REWRITE_TAC (LAND_CONV) [GSYM DISJ_SYM] + THEN STRIP_TAC + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[GSYM node_map_inverse_representation] + THEN USE_THEN "F7" (fun th1 -> (DISCH_THEN (fun th2 -> (MP_TAC (MATCH_MP EQ_TRANS (CONJ (SYM th1) th2)))))) + THEN REWRITE_TAC[MATCH_MP PERMUTES_INJECTIVE (CONJUNCT1(CONJUNCT2(CONJUNCT2(SPEC `H:(A)hypermap` hypermap_lemma))))] + THEN USE_THEN "F11" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F14") + THEN SUBGOAL_THEN `!x:A. x IN {(p:num->A) (i:num) | i <= 2} <=> x = p 0 \/ x = p 1 \/ x = p 2` MP_TAC + THENL[GEN_TAC + THEN REWRITE_TAC[SPEC `i:num` SEGMENT_TO_TWO] + THEN REWRITE_TAC[IN_ELIM_THM] + THEN MESON_TAC[]; ALL_TAC] + THEN USE_THEN "F3" (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "F15") + THEN ABBREV_TAC `a = (p:num->A) 0` + THEN ABBREV_TAC `b = (p:num->A) 1` + THEN ABBREV_TAC `c = (p:num->A) 2` + THEN label_hypermap_TAC `H:(A)hypermap` + THEN ABBREV_TAC `D = dart (H:(A)hypermap)` + THEN POP_ASSUM (LABEL_TAC "AB1") + THEN ABBREV_TAC `e = edge_map (H:(A)hypermap)` + THEN POP_ASSUM (LABEL_TAC "AB2") + THEN ABBREV_TAC `n = node_map (H:(A)hypermap)` + THEN POP_ASSUM (LABEL_TAC "AB3") + THEN ABBREV_TAC `f = face_map (H:(A)hypermap)` + THEN POP_ASSUM (LABEL_TAC "AB4") + THEN USE_THEN "F15" (MP_TAC o SPEC `c:A`) + THEN REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "F16") + THEN SUBGOAL_THEN `(f:A->A) (c:A) = a:A` (LABEL_TAC "F17") + THENL[USE_THEN "F16" MP_TAC + THEN EXPAND_TAC "D" + THEN DISCH_THEN (MP_TAC o CONJUNCT2 o CONJUNCT2 o MATCH_MP lemma_dart_invariant) + THEN USE_THEN "AB4" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "AB1" (fun th -> REWRITE_TAC[th]) + THEN DISCH_TAC + THEN USE_THEN "F15" (MP_TAC o SPEC `(f:A->A) (c:A)`) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN STRIP_TAC + THENL[POP_ASSUM (fun th1 -> (USE_THEN "F12" (fun th2 -> MP_TAC(MATCH_MP EQ_TRANS (CONJ th1 th2))))) + THEN USE_THEN "H4"(fun th -> REWRITE_TAC[MATCH_MP PERMUTES_INJECTIVE th]) + THEN USE_THEN "F11" (fun th -> REWRITE_TAC[GSYM th]); ALL_TAC] + THEN POP_ASSUM (fun th1 -> (USE_THEN "F14" (fun th2 -> MP_TAC(MATCH_MP EQ_TRANS (CONJ th1 th2))))) + THEN USE_THEN "H4"(fun th -> REWRITE_TAC[MATCH_MP PERMUTES_INJECTIVE th]) + THEN USE_THEN "F10" (fun th -> REWRITE_TAC[GSYM th]); ALL_TAC] + THEN USE_THEN "F15" (MP_TAC o SPEC `a:A`) + THEN REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "F18") + THEN USE_THEN "F15" (MP_TAC o SPEC `b:A`) + THEN REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "F19") + THEN SUBGOAL_THEN `orbit_map (f:A->A) (a:A) = D:A->bool` (LABEL_TAC "F20") + THENL[MATCH_MP_TAC SUBSET_ANTISYM + THEN USE_THEN "H4" (MP_TAC o SPEC `a:A` o MATCH_MP orbit_subset) + THEN USE_THEN "F18" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[SUBSET] + THEN GEN_TAC + THEN DISCH_TAC + THEN USE_THEN "F15" (MP_TAC o SPEC `x:A`) + THEN POP_ASSUM(fun th -> REWRITE_TAC[th]) + THEN STRIP_TAC + THENL[POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[orbit_reflect]; + POP_ASSUM SUBST1_TAC + THEN MP_TAC (SPECL[`f:A->A`; `1`; `a:A`] lemma_in_orbit) + THEN REWRITE_TAC[POWER_1] + THEN USE_THEN "F12" (SUBST1_TAC o SYM) + THEN SIMP_TAC[]; + POP_ASSUM SUBST1_TAC + THEN MP_TAC (SPECL[`f:A->A`; `2`; `a:A`] lemma_in_orbit) + THEN REWRITE_TAC[POWER_2; o_THM] + THEN USE_THEN "F12" (SUBST1_TAC o SYM) + THEN USE_THEN "F14" (SUBST1_TAC o SYM) + THEN SIMP_TAC[]]; ALL_TAC] + THEN SUBGOAL_THEN `orbit_map (n:A->A) (a:A) = D:A->bool` (LABEL_TAC "F21") + THENL[MATCH_MP_TAC SUBSET_ANTISYM + THEN USE_THEN "H3" (MP_TAC o SPEC `a:A` o MATCH_MP orbit_subset) + THEN USE_THEN "F18" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[SUBSET] + THEN GEN_TAC + THEN DISCH_TAC + THEN USE_THEN "F15" (MP_TAC o SPEC `x:A`) + THEN POP_ASSUM(fun th -> REWRITE_TAC[th]) + THEN STRIP_TAC + THENL[POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[orbit_reflect]; + POP_ASSUM SUBST1_TAC + THEN MP_TAC (SPECL[`n:A->A`; `1`; `a:A`] lemma_in_orbit) + THEN REWRITE_TAC[POWER_1] + THEN USE_THEN "F7" (SUBST1_TAC o SYM) + THEN SIMP_TAC[]; + POP_ASSUM SUBST1_TAC + THEN MP_TAC (SPECL[`n:A->A`; `2`; `a:A`] lemma_in_orbit) + THEN REWRITE_TAC[POWER_2; o_THM] + THEN USE_THEN "F7" (SUBST1_TAC o SYM) + THEN USE_THEN "F8" (SUBST1_TAC o SYM) + THEN SIMP_TAC[]]; ALL_TAC] + THEN SUBGOAL_THEN `orbit_map (e:A->A) (b:A) = D:A->bool` (LABEL_TAC "F22") + THENL[USE_THEN "H5" (fun th -> (MP_TAC (AP_THM th `c:A`))) + THEN REWRITE_TAC[o_THM; I_THM] + THEN USE_THEN "F17" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F7" (fun th -> REWRITE_TAC[SYM th]) + THEN DISCH_THEN (LABEL_TAC "EE1") + THEN USE_THEN "H5" (fun th -> (MP_TAC (AP_THM th `a:A`))) + THEN REWRITE_TAC[o_THM; I_THM] + THEN USE_THEN "F12" (fun th -> REWRITE_TAC[SYM th]) + THEN USE_THEN "F8" (fun th -> REWRITE_TAC[SYM th]) + THEN DISCH_THEN (LABEL_TAC "EE2") + THEN MATCH_MP_TAC SUBSET_ANTISYM + THEN USE_THEN "H2" (MP_TAC o SPEC `b:A` o MATCH_MP orbit_subset) + THEN USE_THEN "F19" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[SUBSET] + THEN GEN_TAC + THEN DISCH_TAC + THEN USE_THEN "F15" (MP_TAC o SPEC `x:A`) + THEN POP_ASSUM(fun th -> REWRITE_TAC[th]) + THEN STRIP_TAC + THENL[POP_ASSUM SUBST1_TAC + THEN MP_TAC (SPECL[`e:A->A`; `2`; `b:A`] lemma_in_orbit) + THEN REWRITE_TAC[POWER_2; o_THM] + THEN USE_THEN "EE1" SUBST1_TAC + THEN USE_THEN "EE2" SUBST1_TAC + THEN SIMP_TAC[]; + POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[orbit_reflect]; + POP_ASSUM SUBST1_TAC + THEN MP_TAC (SPECL[`e:A->A`; `1`; `b:A`] lemma_in_orbit) + THEN REWRITE_TAC[POWER_1] + THEN USE_THEN "EE1" SUBST1_TAC + THEN SIMP_TAC[]]; ALL_TAC] + THEN SUBGOAL_THEN `comb_component (H:(A)hypermap) (a:A) = dart (H:(A)hypermap)` (LABEL_TAC "F23") + THENL[MATCH_MP_TAC SUBSET_ANTISYM + THEN USE_THEN "F18" MP_TAC + THEN USE_THEN "AB1" (SUBST1_TAC o SYM) + THEN DISCH_THEN (fun th -> (REWRITE_TAC[MATCH_MP lemma_component_subset th])) + THEN USE_THEN "AB1" (SUBST1_TAC) + THEN USE_THEN "F21" (SUBST1_TAC o SYM) + THEN EXPAND_TAC "n" + THEN REWRITE_TAC[GSYM node] + THEN REWRITE_TAC[lemma_node_subset_component]; ALL_TAC] + THEN REWRITE_TAC[planar_hypermap; number_of_components] + THEN POP_ASSUM (fun th -> (REWRITE_TAC[MATCH_MP lemma_only_one_component th])) + THEN REWRITE_TAC[number_of_nodes; number_of_edges; number_of_faces; node_set; edge_set; face_set] + THEN USE_THEN "AB1" SUBST1_TAC + THEN USE_THEN "F1" SUBST1_TAC + THEN USE_THEN "AB2" SUBST1_TAC + THEN USE_THEN "AB3" SUBST1_TAC + THEN USE_THEN "AB4" SUBST1_TAC + THEN USE_THEN "H1" (fun th1 -> (USE_THEN "H4" (fun th2 -> (USE_THEN "F20" (fun th3 -> (MP_TAC(MATCH_MP lemma_only_one_orbit (CONJ th1 (CONJ th2 th3))))))))) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "H1" (fun th1 -> (USE_THEN "H3" (fun th2 -> (USE_THEN "F21" (fun th3 -> (MP_TAC(MATCH_MP lemma_only_one_orbit (CONJ th1 (CONJ th2 th3))))))))) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "H1" (fun th1 -> (USE_THEN "H2" (fun th2 -> (USE_THEN "F22" (fun th3 -> (MP_TAC(MATCH_MP lemma_only_one_orbit (CONJ th1 (CONJ th2 th3))))))))) + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[CARD_SINGLETON] + THEN CONV_TAC NUM_REDUCE_CONV);; + +(* FACE_WALKUP *) + +let dart_face_walkup = prove(`!(H:(A)hypermap) (x:A). dart (face_walkup H x) = (dart H) DELETE x`, + REPEAT STRIP_TAC + THEN REWRITE_TAC[face_walkup] + THEN REWRITE_TAC[GSYM shift_lemma] + THEN REWRITE_TAC[lemma_edge_walkup] + THEN REWRITE_TAC[GSYM double_shift_lemma]);; + +let lemma_card_face_walkup_dart = prove(`!(H:(A)hypermap) (x:A). x IN dart H ==> CARD(dart H) = CARD(dart(face_walkup H x)) + 1`, + REPEAT STRIP_TAC THEN MP_TAC(SPECL[`H:(A)hypermap`; `x:A`] dart_face_walkup) + THEN DISCH_THEN SUBST1_TAC THEN MATCH_MP_TAC CARD_MINUS_ONE + THEN ASM_REWRITE_TAC[hypermap_lemma]);; + +let face_map_face_walkup = prove(`!(H:(A)hypermap) (x:A) (y:A). face_map (face_walkup H x) x = x +/\ (~(edge_map H x = x) /\ ~(face_map H x = x) ==> face_map (face_walkup H x) (edge_map H x) = face_map H x) +/\ (~(inverse (node_map H) x = x) /\ ~(inverse (face_map H) x = x) ==> face_map (face_walkup H x) (inverse (face_map H) x) = inverse (node_map H) x) +/\ (~(y = x) /\ ~(y = inverse (face_map H) x) /\ ~(y = edge_map H x) ==> face_map (face_walkup H x) y = face_map H y)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[face_walkup] + THEN ONCE_REWRITE_TAC[double_shift_lemma] + THEN REWRITE_TAC[lemma_shift_cycle] + THEN ABBREV_TAC `G = shift (shift (H:(A)hypermap))` + THEN REWRITE_TAC[edge_map_walkup]);; + +let node_map_face_walkup = prove(`!(H:(A)hypermap) (x:A) (y:A). node_map (face_walkup H x) x = x /\ node_map (face_walkup H x) (inverse (node_map H) x) = node_map H x /\ (~(y = x) /\ ~(y = inverse (node_map H) x) ==> node_map (face_walkup H x) y = node_map H y)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[face_walkup] + THEN ONCE_REWRITE_TAC[double_shift_lemma] + THEN REWRITE_TAC[lemma_shift_cycle] + THEN ABBREV_TAC `G = shift (shift (H:(A)hypermap))` + THEN REWRITE_TAC[face_map_walkup]);; + +(* NODE_WALKUP *) + +let dart_node_walkup = prove(`!(H:(A)hypermap) (x:A). dart (node_walkup H x) = (dart H) DELETE x`, + REPEAT STRIP_TAC + THEN REWRITE_TAC[node_walkup] + THEN REWRITE_TAC[GSYM double_shift_lemma] + THEN REWRITE_TAC[lemma_edge_walkup] + THEN REWRITE_TAC[GSYM shift_lemma]);; + +let lemma_card_node_walkup_dart = prove(`!(H:(A)hypermap) (x:A). x IN dart H ==> CARD(dart H) = CARD(dart(node_walkup H x)) + 1`, + REPEAT STRIP_TAC THEN MP_TAC(SPECL[`H:(A)hypermap`; `x:A`] dart_node_walkup) + THEN DISCH_THEN SUBST1_TAC THEN MATCH_MP_TAC CARD_MINUS_ONE + THEN ASM_REWRITE_TAC[hypermap_lemma]);; + + +let node_map_node_walkup = prove(`!(H:(A)hypermap) (x:A) (y:A). node_map (node_walkup H x) x = x /\ (~(face_map H x = x) /\ ~(node_map H x = x) ==> node_map (node_walkup H x) (face_map H x) = node_map H x) /\ (~(inverse (edge_map H) x = x) /\ ~(inverse (node_map H) x = x) ==> node_map (node_walkup H x) (inverse (node_map H) x) = inverse (edge_map H) x) /\ (~(y = x) /\ ~(y = inverse (node_map H) x) /\ ~(y = face_map H x) ==> node_map (node_walkup H x) y = node_map H y)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[node_walkup] + THEN ONCE_REWRITE_TAC[shift_lemma] + THEN REWRITE_TAC[lemma_shift_cycle] + THEN ABBREV_TAC `G = shift (H:(A)hypermap)` + THEN REWRITE_TAC[edge_map_walkup]);; + +let face_map_node_walkup = prove(`!(H:(A)hypermap) (x:A) (y:A). face_map (node_walkup H x) x = x /\ face_map (node_walkup H x) (inverse (face_map H) x) = face_map H x /\ (~(y = x) /\ ~(y = inverse (face_map H) x) ==> face_map (node_walkup H x) y = face_map H y)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[node_walkup] + THEN ONCE_REWRITE_TAC[shift_lemma] + THEN REWRITE_TAC[lemma_shift_cycle] + THEN ABBREV_TAC `G = shift (H:(A)hypermap)` + THEN REWRITE_TAC[node_map_walkup]);; + +let lemma_face_walkup_second_segment_contour = prove(`!(H:(A)hypermap) (p:num->A) (k:num) (m:num). (is_inj_contour H p k /\ m < k /\ node_map H (p (m+1)) = p m) ==> is_inj_contour (face_walkup H (p m)) (shift_path p (m+1)) (k-(m+1))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[lemma_def_inj_contour; lemma_def_contour] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "J1") (LABEL_TAC "J2")) + THEN STRIP_TAC + THENL[GEN_TAC + THEN REWRITE_TAC[lemma_sub_two_numbers] + THEN DISCH_THEN (LABEL_TAC "J3") + THEN REWRITE_TAC[lemma_shift_path_evaluation] + THEN REWRITE_TAC[ARITH_RULE `((m:num) + 1) + (i:num) = m + i + 1 /\ (m+1) + SUC i = SUC (m + i + 1)`] + THEN REMOVE_THEN "J3" (fun th -> (LABEL_TAC "J4") (MATCH_MP (ARITH_RULE `i:num < (k:num) - ((m:num) + 1) ==> m + i + 1 < k`) th)) + THEN LABEL_TAC "J5" (ARITH_RULE `m:num < m + (i:num) + 1`) + THEN ABBREV_TAC `id = (m:num) + (i:num) + 1` + THEN USE_THEN "J1" (MP_TAC o SPEC `id:num`) + THEN USE_THEN "J4" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[one_step_contour] + THEN STRIP_TAC + THENL[DISJ1_TAC + THEN POP_ASSUM (LABEL_TAC "J6") + THEN USE_THEN "J2" (MP_TAC o SPECL[`id:num`; `m:num`]) + THEN USE_THEN "J5" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "J4" (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN DISCH_THEN (LABEL_TAC "J7" o GSYM) + THEN SUBGOAL_THEN `~((p:num->A) (id:num) = inverse (face_map (H:(A)hypermap)) ((p:num->A) (m:num)))` (LABEL_TAC "J8") + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN REWRITE_TAC[GSYM face_map_inverse_representation] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN USE_THEN "J2" (MP_TAC o SPECL[`SUC (id:num)`; `m:num`]) + THEN USE_THEN "J5" (fun th -> REWRITE_TAC[MP (ARITH_RULE `m:num < id:num ==> m < SUC id`) th]) + THEN USE_THEN "J4" (fun th -> REWRITE_TAC[MP (ARITH_RULE `id:num < k:num ==> SUC id <= k`) th]) + THEN MESON_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `~((p:num->A) (id:num) = edge_map (H:(A)hypermap) ((p:num->A) (m:num)))` (LABEL_TAC "J9") + THENL[USE_THEN "J7" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "F3" (SUBST1_TAC o SYM) + THEN DISCH_THEN (MP_TAC o AP_TERM `face_map (H:(A)hypermap)`) + THEN REPLICATE_TAC 2 (GEN_REWRITE_TAC (LAND_CONV o RAND_CONV) [GSYM o_THM]) + THEN REWRITE_TAC[GSYM o_ASSOC] + THEN REWRITE_TAC[hypermap_cyclic; I_THM] + THEN USE_THEN "J6" (SUBST1_TAC o SYM) + THEN USE_THEN "J2" (MP_TAC o SPECL[`SUC (id:num)`; `(m:num) + 1`]) + THEN USE_THEN "J4" (fun th -> REWRITE_TAC[MP (ARITH_RULE `id:num < k:num ==> SUC id <= k`) th]) + THEN USE_THEN "J5" (fun th -> REWRITE_TAC[MP (ARITH_RULE `m:num < id:num ==> m + 1 < SUC id`) th]) + THEN MESON_TAC[]; ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `(p:num->A) (m:num)`; `(p:num->A) (id:num)`] face_map_face_walkup)))) + THEN REPLICATE_TAC 3 (POP_ASSUM (fun th -> REWRITE_TAC[th])) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN DISJ2_TAC + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[GSYM node_map_inverse_representation] + THEN DISCH_THEN (LABEL_TAC "J10") + THEN USE_THEN "J2" (MP_TAC o SPECL[`SUC (id:num)`; `m:num`]) + THEN USE_THEN "J4" (fun th -> REWRITE_TAC[MP (ARITH_RULE `id:num < k:num ==> SUC id <= k`) th]) + THEN USE_THEN "J5" (fun th -> REWRITE_TAC[MP (ARITH_RULE `m:num < id:num ==> m < SUC id`) th]) + THEN DISCH_THEN (LABEL_TAC "J11" o GSYM) + THEN SUBGOAL_THEN `~((p:num->A) (SUC (id:num)) = inverse (node_map (H:(A)hypermap)) ((p:num->A) (m:num)))` (LABEL_TAC "J12") + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN REWRITE_TAC[GSYM node_map_inverse_representation] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN USE_THEN "J2" (MP_TAC o SPECL[`id:num`; `m:num`]) + THEN USE_THEN "J5" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "J4" (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN MESON_TAC[]; ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `(p:num->A) (m:num)`; `(p:num->A) (SUC (id:num))`] node_map_face_walkup))) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN REWRITE_TAC[lemma_shift_path_evaluation] + THEN REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_sub_two_numbers] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "K1") (LABEL_TAC "K2")) + THEN USE_THEN "J2" (MP_TAC o SPECL[`((m:num) + 1) + (i:num)`; `((m:num)+1)+(j:num)`]) + THEN USE_THEN "K1" (fun th -> (USE_THEN "F2" (fun th1-> REWRITE_TAC[MP (ARITH_RULE `i:num <= (k:num) - ((m:num) + 1) /\ m < k ==> (m + 1) + i <= k`) (CONJ th th1)]))) + THEN USE_THEN "K2" (fun th -> REWRITE_TAC[MP (ARITH_RULE `j:num < i:num ==> ((m:num) + 1) + j < (m + 1) + i`) th]) + );; + + +let lemma_face_walkup_eliminate_dart_on_Moebius_contour = prove(`!(H:(A)hypermap) (p:num->A) (k:num) (m:num). (is_inj_contour H p k /\ 0 < m /\ m < k /\ node_map H (p (m+1)) = p m) ==> is_inj_contour (face_walkup H (p m)) p (m-1) /\ is_inj_contour (face_walkup H (p m)) (shift_path p (m+1)) (k-m-1) +/\ one_step_contour (face_walkup H (p m)) (p (m-1)) (p (m+1))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")))) + THEN STRIP_TAC + THENL[USE_THEN "F1" (MP_TAC o SPEC `(m:num)-1` o MATCH_MP lemma_sub_inj_contour) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `m:num < k:num ==> m - 1 <= k`) th]) + THEN REWRITE_TAC[lemma_def_inj_contour; lemma_def_contour] + THEN SIMP_TAC[] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G1") (LABEL_TAC "G2")) + THEN STRIP_TAC + THEN DISCH_THEN (LABEL_TAC "G3") + THEN USE_THEN "G1" (MP_TAC o SPEC `i:num`) + THEN USE_THEN "G3" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[lemma_def_inj_contour; lemma_def_contour] + THEN DISCH_THEN (LABEL_TAC "G4" o CONJUNCT2) + THEN USE_THEN "G4" (MP_TAC o SPECL[`m:num`; `i:num`]) + THEN USE_THEN "G3" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `i:num < (m:num) - 1 ==> i < m`) th]) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN DISCH_THEN (LABEL_TAC "G5") + THEN REWRITE_TAC[one_step_contour] + THEN STRIP_TAC + THENL[DISJ1_TAC + THEN POP_ASSUM (LABEL_TAC "G6") + THEN SUBGOAL_THEN `~((p:num->A) (i:num) = inverse (face_map H) (p (m:num)))` (LABEL_TAC "G7") + THENL[USE_THEN "G4" (MP_TAC o SPECL[`m:num`; `SUC (i:num)`]) + THEN USE_THEN "G3" (fun th -> (REWRITE_TAC[MATCH_MP (ARITH_RULE `i:num < (m:num) - 1 ==> SUC i < m`) th])) + THEN USE_THEN "F3" (fun th -> (REWRITE_TAC[MATCH_MP LT_IMP_LE th])) + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN REWRITE_TAC[GSYM face_map_inverse_representation] + THEN USE_THEN "G6" (SUBST1_TAC o SYM) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN SUBGOAL_THEN `~((p:num->A) (i:num) = (edge_map H) (p (m:num)))` (LABEL_TAC "G8") + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_TAC + THEN REMOVE_THEN "G6" MP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_THEN (MP_TAC o AP_TERM `node_map (H:(A)hypermap)`) + THEN GEN_REWRITE_TAC (LAND_CONV o RAND_CONV) [GSYM o_THM] + THEN GEN_REWRITE_TAC (LAND_CONV o RAND_CONV) [GSYM o_THM] + THEN REWRITE_TAC[GSYM o_ASSOC] + THEN REWRITE_TAC[hypermap_cyclic; I_THM] + THEN USE_THEN "F4" (SUBST1_TAC o SYM) + THEN REWRITE_TAC[node_map_injective; ADD1] + THEN DISCH_TAC + THEN USE_THEN "G4" (MP_TAC o SPECL[`(m:num) + 1`; `(i:num) + 1`]) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `(m:num) < k:num ==> m+ 1 <= k:num`) th]) + THEN USE_THEN "G3" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `i:num < (m:num) -1 ==> i+ 1 < m+1`) th]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `(p:num->A) (m:num)`; `(p:num->A) (i:num)`] face_map_face_walkup)))) + THEN ASM_REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN DISJ2_TAC + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[GSYM node_map_inverse_representation] + THEN DISCH_THEN (LABEL_TAC "G10") + THEN USE_THEN "G4" (MP_TAC o SPECL[`m:num`; `SUC (i:num)`]) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN USE_THEN "G3" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `i:num < (m:num) -1 ==> SUC i < m`) th]) + THEN DISCH_THEN (LABEL_TAC"G11") + THEN SUBGOAL_THEN `~((p:num->A) (SUC (i:num)) = inverse (node_map (H:(A)hypermap)) ((p:num->A) (m:num)))` (LABEL_TAC "G12") + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN REWRITE_TAC[GSYM node_map_inverse_representation] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN POP_ASSUM (fun th -> REWRITE_TAC[GSYM th]); ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `(p:num->A) (m:num)`; `(p:num->A) (SUC (i:num))`] node_map_face_walkup))) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN REWRITE_TAC[lemma_sub_two_numbers] + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F3" (fun th2 -> (USE_THEN "F4" (fun th3 -> (REWRITE_TAC[MATCH_MP lemma_face_walkup_second_segment_contour (CONJ th1 (CONJ th2 th3))])))))) + THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[lemma_def_inj_contour] + THEN DISCH_THEN (CONJUNCTS_THEN2 (MP_TAC) (LABEL_TAC "FF")) + THEN REWRITE_TAC[lemma_def_contour] + THEN DISCH_THEN (MP_TAC o SPEC `(m:num) - 1`) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MP (ARITH_RULE `m:num < k:num ==> m - 1 < k`) th]) + THEN REWRITE_TAC[lemma_one_step_contour] + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `0 < m:num ==> SUC (m-1) = m`) th]) + THEN STRIP_TAC + THENL[DISJ1_TAC + THEN POP_ASSUM MP_TAC + THEN GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [face_map_inverse_representation] + THEN DISCH_THEN (LABEL_TAC "L1") + THEN USE_THEN "F4" (MP_TAC o SYM) + THEN GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [node_map_inverse_representation] + THEN DISCH_THEN (LABEL_TAC "L2") + THEN USE_THEN "FF" (MP_TAC o SPECL[`m:num`; `(m:num)-1`]) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `0 < m:num ==> m - 1 < m`) th]) + THEN USE_THEN "L1" SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "L3") + THEN USE_THEN "FF" (MP_TAC o GSYM o SPECL[`(m:num)+1`; `(m:num)`]) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MP (ARITH_RULE `m:num < k:num ==> m + 1 <= k`) th]) + THEN REWRITE_TAC[ARITH_RULE ` m:num < m + 1`] + THEN USE_THEN "L2" SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "L4") + THEN MP_TAC (CONJUNCT1(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `(p:num->A) (m:num)`; `(p:num->A) (m:num)`] face_map_face_walkup)))) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN DISJ2_TAC + THEN POP_ASSUM SUBST1_TAC + THEN USE_THEN "F4" (MP_TAC o SYM) + THEN GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [node_map_inverse_representation] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[node_map_face_walkup] +);; + +(* FORMULATE THIS LEMMA FOR f STEP *) + +let lemma_node_walkup_second_segment_contour = prove(`!(H:(A)hypermap) (p:num->A) (k:num) (m:num). is_inj_contour H p k /\ m < k /\ p (m+1) = face_map H (p m) ==> is_inj_contour (node_walkup H (p m)) (shift_path p (m+1)) (k-(m+1))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN REWRITE_TAC[lemma_sub_two_numbers] + THEN ASM_CASES_TAC `k:num = ((m:num) + 1)` + THENL[POP_ASSUM SUBST1_TAC THEN REWRITE_TAC[SUB_REFL; is_inj_contour]; ALL_TAC] + THEN POP_ASSUM (fun th -> (USE_THEN "F2"(fun th2 -> (LABEL_TAC "F4" (MATCH_MP (ARITH_RULE `m:num < k:num /\ ~(k = m+1) ==> m + 1 < k`) (CONJ th2 th)))))) + THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[lemma_def_inj_contour] + THEN DISCH_THEN (CONJUNCTS_THEN2 (MP_TAC) (LABEL_TAC "F5")) + THEN REWRITE_TAC[lemma_def_contour] + THEN DISCH_THEN (LABEL_TAC "F6") + THEN STRIP_TAC + THENL[GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F7") + THEN REWRITE_TAC[lemma_shift_path_evaluation] + THEN USE_THEN "F6" (MP_TAC o SPEC `((m:num)+1) + (i:num)`) + THEN USE_THEN "F7" (fun th1 -> (USE_THEN "F4" (fun th2 -> (LABEL_TAC "F8" (MATCH_MP (ARITH_RULE `i:num < (k:num) - ((m:num) + 1) /\ m + 1 < k ==> (m+1)+ i < k`) (CONJ th1 th2)))))) + THEN ABBREV_TAC `id = ((m:num) + 1) + (i:num)` + THEN POP_ASSUM (LABEL_TAC "F9") + THEN USE_THEN "F8" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[ADD_SUC] + THEN USE_THEN "F9" (SUBST1_TAC) + THEN REWRITE_TAC[lemma_one_step_contour] + THEN CONV_TAC (ONCE_REWRITE_CONV[DISJ_SYM]) + THEN STRIP_TAC + THENL[DISJ1_TAC + THEN POP_ASSUM (LABEL_TAC "F10") + THEN USE_THEN "F5" (MP_TAC o SPECL[`SUC (id:num)`; `m:num`]) + THEN USE_THEN "F8" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `id:num < k:num ==> SUC id <= k`) th]) + THEN USE_THEN "F9" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `((m:num) + 1) + (i:num) = id ==> m < SUC id`) th]) + THEN DISCH_THEN (LABEL_TAC "F11" o GSYM) + THEN SUBGOAL_THEN `~((p:num->A) (SUC (id:num)) = face_map (H:(A)hypermap) ((p:num->A) (m:num)))` (LABEL_TAC "F12") + THENL[USE_THEN "F11" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "F3" (SUBST1_TAC o SYM) + THEN USE_THEN "F5" (MP_TAC o SPECL[`SUC (id:num)`; `(m:num) + 1`]) + THEN USE_THEN "F8" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `id:num < k:num ==> SUC id <= k`) th]) + THEN USE_THEN "F9" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `((m:num) + 1) + (i:num) = id ==> m + 1 < SUC id`) th]) + THEN MESON_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `~((p:num->A) (SUC (id:num)) = inverse (node_map (H:(A)hypermap)) ((p:num->A) (m:num)))` (LABEL_TAC "F14") + THENL[USE_THEN "F12" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN REWRITE_TAC[GSYM node_map_inverse_representation] + THEN USE_THEN "F10" (SUBST1_TAC o SYM) + THEN USE_THEN "F5" (MP_TAC o SPECL[`(id:num)`; `(m:num)`]) + THEN USE_THEN "F8" (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN USE_THEN "F9" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `((m:num) + 1) + (i:num) = id ==> m < id`) th]) + THEN MESON_TAC[]; ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `(p:num->A) (m:num)`; `(p:num->A) (SUC (id:num))`] node_map_node_walkup)))) + THEN REPLICATE_TAC 3 (POP_ASSUM (fun th -> REWRITE_TAC[th])) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN DISJ2_TAC + THEN POP_ASSUM (LABEL_TAC "F10") + THEN USE_THEN "F5" (MP_TAC o SPECL[`id:num`; `m:num`]) + THEN USE_THEN "F8" (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN USE_THEN "F9" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `((m:num) + 1) + (i:num) = id ==> m < id`) th]) + THEN DISCH_TAC + THEN SUBGOAL_THEN `~((p:num->A) (id:num) = inverse (face_map (H:(A)hypermap)) ((p:num->A) (m:num)))` ASSUME_TAC + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN REWRITE_TAC[GSYM face_map_inverse_representation] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN USE_THEN "F5" (MP_TAC o SPECL[`SUC (id:num)`; `m:num`]) + THEN USE_THEN "F8" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `id:num < k:num ==> SUC id <= k`) th]) + THEN USE_THEN "F9" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `((m:num) + 1) + (i:num) = id ==> m < SUC id`) th]) + THEN MESON_TAC[]; ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `(p:num->A) (m:num)`; `(p:num->A) (id:num)`] face_map_node_walkup))) + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[th])) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN REWRITE_TAC[lemma_shift_path_evaluation] + THEN REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_sub_two_numbers] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "K1") (LABEL_TAC "K2")) + THEN USE_THEN "F5" (MP_TAC o SPECL[`((m:num) + 1) + (i:num)`; `((m:num)+1)+(j:num)`]) + THEN USE_THEN "K1" (fun th -> (USE_THEN "F2" (fun th1-> REWRITE_TAC[MP (ARITH_RULE `i:num <= (k:num) - ((m:num) + 1) /\ m < k ==> (m + 1) + i <= k`) (CONJ th th1)]))) + THEN USE_THEN "K2" (fun th -> REWRITE_TAC[MP (ARITH_RULE `j:num < i:num ==> ((m:num) + 1) + j < (m + 1) + i`) th]) + );; + +let lemma_node_walkup_eliminate_dart_on_Moebius_contour = prove(`!(H:(A)hypermap) (p:num->A) (k:num) (m:num). is_inj_contour H p k /\ 0 < m /\ m < k /\ p (m+1) = face_map H (p m) ==> is_inj_contour (node_walkup H (p m)) p (m-1) /\ is_inj_contour (node_walkup H (p m)) (shift_path p (m+1)) (k-m-1) +/\ one_step_contour (node_walkup H (p m)) (p (m-1)) (p (m+1))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")))) + THEN STRIP_TAC + THENL[USE_THEN "F1" (MP_TAC o SPEC `(m:num)-1` o MATCH_MP lemma_sub_inj_contour) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `m:num < k:num ==> m - 1 <= k`) th]) + THEN REWRITE_TAC[lemma_def_inj_contour; lemma_def_contour] + THEN SIMP_TAC[] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G1") (LABEL_TAC "G2")) + THEN STRIP_TAC + THEN DISCH_THEN (LABEL_TAC "G3") + THEN USE_THEN "G1" (MP_TAC o SPEC `i:num`) + THEN USE_THEN "G3" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[lemma_def_inj_contour; lemma_def_contour] + THEN DISCH_THEN (LABEL_TAC "G4" o CONJUNCT2) + THEN USE_THEN "G4" (MP_TAC o SPECL[`m:num`; `SUC (i:num)`]) + THEN USE_THEN "G3" (fun th -> (USE_THEN "F2"(fun th2 -> REWRITE_TAC[MATCH_MP (ARITH_RULE `i:num < (m:num) - 1 /\ 0 < m ==> SUC i < m`) (CONJ th th2)]))) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN DISCH_THEN (LABEL_TAC "G5") + THEN REWRITE_TAC[one_step_contour] + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [DISJ_SYM] + THEN STRIP_TAC + THENL[DISJ2_TAC + THEN POP_ASSUM (LABEL_TAC "G6") + THEN SUBGOAL_THEN `~((p:num->A) (SUC (i:num)) = inverse (node_map H) (p (m:num)))` (LABEL_TAC "G7") + THENL[USE_THEN "G5" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[GSYM node_map_inverse_representation] + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN USE_THEN "G4" (MP_TAC o SPECL[`m:num`; `i:num`]) + THEN USE_THEN "G3" (fun th -> (REWRITE_TAC[MATCH_MP (ARITH_RULE `i:num < (m:num) - 1 ==> i < m`) th])) + THEN USE_THEN "F3" (fun th -> (REWRITE_TAC[MATCH_MP LT_IMP_LE th])) + THEN MESON_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `~((p:num->A) (SUC(i:num)) = (face_map H) (p (m:num)))` (LABEL_TAC "G8") + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "F4" (SUBST1_TAC o SYM) + THEN DISCH_TAC + THEN USE_THEN "G4" (MP_TAC o SPECL[`(m:num) + 1`; `SUC (i:num)`]) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `(m:num) < k:num ==> m+ 1 <= k:num`) th]) + THEN USE_THEN "G3" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `i:num < (m:num) -1 ==> SUC i < m+1`) th]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `(p:num->A) (m:num)`; `(p:num->A) (SUC (i:num))`] node_map_node_walkup)))) + THEN REPLICATE_TAC 2(POP_ASSUM (fun th -> REWRITE_TAC[th])) + THEN USE_THEN "G5" (fun th -> REWRITE_TAC[th]) + THEN POP_ASSUM MP_TAC + THEN GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [GSYM node_map_inverse_representation] + THEN ASM_REWRITE_TAC[EQ_SYM] + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN REWRITE_TAC[GSYM node_map_inverse_representation; EQ_SYM]; ALL_TAC] + THEN DISJ1_TAC + THEN POP_ASSUM (LABEL_TAC "G10") + THEN USE_THEN "G4" (MP_TAC o SPECL[`m:num`; `(i:num)`]) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN USE_THEN "G3" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `i:num < (m:num) -1 ==> i < m`) th]) + THEN DISCH_THEN (LABEL_TAC"G11") + THEN SUBGOAL_THEN `~((p:num->A) (i:num) = inverse (face_map (H:(A)hypermap)) ((p:num->A) (m:num)))` (LABEL_TAC "G12") + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN REWRITE_TAC[GSYM face_map_inverse_representation] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN POP_ASSUM (fun th -> REWRITE_TAC[GSYM th]); ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `(p:num->A) (m:num)`; `(p:num->A) (i:num)`] face_map_node_walkup))) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN REWRITE_TAC[lemma_sub_two_numbers] + THEN USE_THEN "F1" (fun th1 -> (USE_THEN "F3" (fun th2 -> (USE_THEN "F4" (fun th3 -> (REWRITE_TAC[MATCH_MP lemma_node_walkup_second_segment_contour (CONJ th1 (CONJ th2 th3))])))))) + THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[lemma_def_inj_contour] + THEN DISCH_THEN (CONJUNCTS_THEN2 (MP_TAC) (LABEL_TAC "FF")) + THEN REWRITE_TAC[lemma_def_contour] + THEN DISCH_THEN (MP_TAC o SPEC `(m:num) - 1`) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MP (ARITH_RULE `m:num < k:num ==> m - 1 < k`) th]) + THEN REWRITE_TAC[lemma_one_step_contour] + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `0 < m:num ==> SUC (m-1) = m`) th]) + THEN CONV_TAC (ONCE_REWRITE_CONV[DISJ_SYM]) + THEN STRIP_TAC + THENL[DISJ1_TAC + THEN POP_ASSUM MP_TAC + THEN DISCH_THEN (LABEL_TAC "L1") + THEN USE_THEN "FF" (MP_TAC o SPECL[`m:num`; `(m:num)-1`]) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `0 < m:num ==> m - 1 < m`) th]) + THEN USE_THEN "L1" SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "L3") + THEN USE_THEN "FF" (MP_TAC o GSYM o SPECL[`(m:num)+1`; `(m:num)`]) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MP (ARITH_RULE `m:num < k:num ==> m + 1 <= k`) th]) + THEN REWRITE_TAC[ARITH_RULE ` m:num < m + 1`] + THEN USE_THEN "F4" SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "L4") + THEN MP_TAC (CONJUNCT1(CONJUNCT2(SPECL[`H:(A)hypermap`; `(p:num->A) (m:num)`; `(p:num->A) (m:num)`] node_map_node_walkup))) + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[th])) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN DISJ2_TAC + THEN POP_ASSUM MP_TAC + THEN GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [face_map_inverse_representation] + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F4" SUBST1_TAC + THEN REWRITE_TAC[face_map_node_walkup] + );; + +(* THE COMBINATORIAL JORDAN CURVE THEOREM *) + +let lemmaLIPYTUI = prove(`!(H:(A)hypermap). planar_hypermap H ==> ~(?(p:num->A) k:num. is_Moebius_contour H p k)`, + GEN_TAC + THEN ABBREV_TAC `n = CARD (dart (H:(A)hypermap))` + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[IMP_IMP] + THEN SPEC_TAC (`H:(A)hypermap`, `H:(A)hypermap`) + THEN SPEC_TAC (`n:num`, `n:num`) + THEN INDUCT_TAC + THENL[REPEAT STRIP_TAC + THEN POP_ASSUM (MP_TAC o CONJUNCT2 o CONJUNCT2 o MATCH_MP lemma_darts_on_Moebius_contour) + THEN DISCH_THEN (MP_TAC o MATCH_MP (ARITH_RULE `SUC (k:num) <= l:num ==> ~(l = 0)`)) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "FI") + THEN GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN STRIP_TAC + THEN POP_ASSUM (LABEL_TAC "F3") + THEN USE_THEN "F3" (MP_TAC o MATCH_MP lemma_Moebius_contour_points_subset_darts) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5")) + THEN LABEL_TAC "F6" (CONJUNCT1(SPEC `H:(A)hypermap` hypermap_lemma)) + THEN ASM_CASES_TAC `~({(p:num->A) (i:num) | i <= (k:num)} = dart (H:(A)hypermap))` + THENL[POP_ASSUM MP_TAC + THEN USE_THEN "F4" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM PSUBSET] + THEN REWRITE_TAC[PSUBSET_MEMBER] + THEN USE_THEN "F4" (fun th -> REWRITE_TAC[th]) + THEN STRIP_TAC + THEN POP_ASSUM (fun th1 -> (USE_THEN "F3" (fun th2 -> (MP_TAC (MATCH_MP lemma_eliminate_dart_ouside_Moebius_contour (CONJ th2 th1)))))) + THEN FIRST_ASSUM (MP_TAC o (SPEC `edge_walkup (H:(A)hypermap) (y:A)`)) + THEN REWRITE_TAC[] + THEN POP_ASSUM (fun th -> (MP_TAC (MATCH_MP lemma_card_walkup_dart th) THEN ASSUME_TAC th)) + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[th; GSYM ADD1; EQ_SUC]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) + THEN POP_ASSUM (fun th1 -> (USE_THEN "F2" (fun th2 -> REWRITE_TAC[MATCH_MP lemmaSGCOSXK (CONJ th1 th2)]))) + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN STRIP_TAC + THEN EXISTS_TAC `p:num->A` THEN EXISTS_TAC `k:num` + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[] + THEN USE_THEN "F3" MP_TAC + THEN REWRITE_TAC[is_Moebius_contour] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F7") (LABEL_TAC "F8")) + THEN USE_THEN "F7" MP_TAC + THEN REWRITE_TAC[lemma_def_inj_contour] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F9") (LABEL_TAC "F10")) + THEN DISCH_THEN (LABEL_TAC "F11") + THEN REMOVE_THEN "F8" (X_CHOOSE_THEN `m:num` (X_CHOOSE_THEN `t:num` (CONJUNCTS_THEN2 (LABEL_TAC "F12") (CONJUNCTS_THEN2 (LABEL_TAC "F14") (CONJUNCTS_THEN2 (LABEL_TAC "F15") (CONJUNCTS_THEN2 (LABEL_TAC "F16") (LABEL_TAC "F16k"))))))) + THEN USE_THEN "F9" MP_TAC + THEN REWRITE_TAC[lemma_def_contour] + THEN DISCH_THEN (LABEL_TAC "F17") + THEN ASM_CASES_TAC `m:num < t:num` + THENL[POP_ASSUM (fun th -> (LABEL_TAC "G1" (MATCH_MP (ARITH_RULE `m:num < t:num ==> SUC m <= t`) th))) + THEN USE_THEN "F17" (MP_TAC o SPEC `m:num`) + THEN USE_THEN "F14" (fun th1 -> (USE_THEN "F15" (fun th2 -> (LABEL_TAC "G2" (MP (ARITH_RULE `m:num <= t:num /\ t < k:num ==> m < k`) (CONJ th1 th2)))))) + THEN USE_THEN "G2" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[one_step_contour] + THEN STRIP_TAC + THENL[POP_ASSUM (fun th -> (LABEL_TAC "G3" th THEN MP_TAC th)) + THEN REWRITE_TAC[ADD1] + THEN USE_THEN "F7"(fun th1 -> (USE_THEN "F12" (fun th2 -> (USE_THEN "G2" (fun th3 -> (DISCH_THEN (fun th4 -> (MP_TAC (MATCH_MP lemma_node_walkup_eliminate_dart_on_Moebius_contour (CONJ th1 (CONJ th2 (CONJ th3 th4)))))))))))) + THEN REWRITE_TAC[lemma_sub_two_numbers] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G4") (CONJUNCTS_THEN2 (LABEL_TAC "G5") (LABEL_TAC "G6"))) + THEN ABBREV_TAC `G = node_walkup (H:(A)hypermap) ((p:num->A) (m:num))` + THEN POP_ASSUM (LABEL_TAC "G7") + THEN SUBGOAL_THEN `one_step_contour G ((p:num->A) ((m:num)-1)) ((shift_path (p:num->A) ((m:num)+1)) 0)` ASSUME_TAC + THENL[REWRITE_TAC[lemma_shift_path_evaluation] + THEN REWRITE_TAC[ADD_0] + THEN REMOVE_THEN "G6" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `(!i:num j:num. i <= (m:num-1) /\ j <= (k:num) - (m+1) ==> ~(shift_path (p:num->A) (m+1) j = p i))` ASSUME_TAC + THENL[REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G8") (LABEL_TAC "G9")) + THEN REWRITE_TAC[lemma_shift_path_evaluation; GSYM ADD_ASSOC] + THEN USE_THEN "F10" (MP_TAC o SPECL[`(m:num) + 1 + (j:num)`; `i:num`]) + THEN USE_THEN "G8" (fun th1 -> (REWRITE_TAC[MATCH_MP (ARITH_RULE `i:num <= (m:num) - 1 ==> i < m + 1 + (j:num)`) th1])) + THEN USE_THEN "G9" (fun th1 -> (USE_THEN "G2" (fun th2 -> (REWRITE_TAC[MATCH_MP (ARITH_RULE `j:num <= (k:num) - ((m:num) + 1) /\ m < k:num ==> m + 1 + j <= k`) (CONJ th1 th2)])))) + THEN REWRITE_TAC[CONTRAPOS_THM; EQ_SYM]; ALL_TAC] + THEN REMOVE_THEN "G4" (fun th1 -> (REMOVE_THEN "G5" (fun th2 -> (POP_ASSUM (fun th4-> (POP_ASSUM (fun th3 -> MP_TAC (MATCH_MP concatenate_two_disjoint_contours (CONJ th1 (CONJ th2 (CONJ th3 th4))))))))))) + THEN REWRITE_TAC[lemma_shift_path_evaluation] + THEN USE_THEN "F12" (fun th1 -> (USE_THEN "G2" (fun th2 -> REWRITE_TAC[MATCH_MP (ARITH_RULE `0 < (m:num) /\ m < (k:num) ==> m - 1 + k - (m+1) + 1 = k -1`) (CONJ th1 th2)]))) + THEN USE_THEN "G2" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `(m:num) < (k:num) ==> (m + 1) + k - (m+1) = k`) th]) + THEN USE_THEN "F12" (fun th -> REWRITE_TAC[MP (ARITH_RULE `0 < (m:num) ==> m - 1 + (i:num) + 1 = m + i`) th]) + THEN DISCH_THEN (X_CHOOSE_THEN `g:num->A` (CONJUNCTS_THEN2 (LABEL_TAC "G10") (CONJUNCTS_THEN2 (LABEL_TAC "G11") (CONJUNCTS_THEN2 (LABEL_TAC "G12") (CONJUNCTS_THEN2 (LABEL_TAC "G14") (LABEL_TAC "G15")))))) + THEN SUBGOAL_THEN `is_Moebius_contour (G:(A)hypermap) (g:num->A) ((k:num) - 1)` (LABEL_TAC "G16") + THENL[REWRITE_TAC[is_Moebius_contour] + THEN USE_THEN "G12" (fun th -> REWRITE_TAC[th]) + THEN EXISTS_TAC `m:num` + THEN EXISTS_TAC `(t:num) - 1` + THEN USE_THEN "F12" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "G1" (fun th -> REWRITE_TAC[MP (ARITH_RULE `SUC (m:num) <= t:num ==> m <= t - 1`) th]) + THEN USE_THEN "G1" (fun th1 -> (USE_THEN "F15" (fun th2 -> REWRITE_TAC[MP (ARITH_RULE `SUC (m:num) <= t:num /\ t < k:num ==> t - 1 < k - 1`) (CONJ th1 th2)]))) + THEN USE_THEN "G10" (SUBST1_TAC) + THEN USE_THEN "G11" (SUBST1_TAC) + THEN USE_THEN "G15" (MP_TAC o SPEC `0`) + THEN REWRITE_TAC[LE_0; ADD_0] + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "G1" MP_TAC + THEN REWRITE_TAC[LE_EXISTS; ADD1] + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` (LABEL_TAC "G16")) + THEN USE_THEN "F15" (fun th1 -> (USE_THEN "G16" (fun th2 -> (ASSUME_TAC (MATCH_MP (ARITH_RULE `t:num < k:num /\ t = ((m:num) + 1) + (d:num) ==> d <= k - (m+1)`) (CONJ th1 th2)))))) + THEN USE_THEN "G15" (MP_TAC o SPEC `d:num`) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "G16" (fun th -> GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o RAND_CONV) [SYM th]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `t:num = ((m:num)+1) + (d:num) ==> m + d = t - 1`) th]) + THEN DISCH_THEN SUBST1_TAC + THEN EXPAND_TAC "G" + THEN STRIP_TAC + THENL[USE_THEN "F10" (MP_TAC o SPECL[`m:num`; `0`]) + THEN USE_THEN "F12" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "G2" (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN DISCH_THEN (LABEL_TAC "G21") + THEN SUBGOAL_THEN `~((p:num->A) 0 = face_map (H:(A)hypermap) ((p:num->A) (m:num)))` (LABEL_TAC "G22") + THENL[USE_THEN "G21" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "G3" (SUBST1_TAC o SYM) + THEN USE_THEN "F10" (MP_TAC o SPECL[`SUC (m:num)`; `0`]) + THEN USE_THEN "G2" (fun th -> (REWRITE_TAC[MATCH_MP (ARITH_RULE `m:num < k:num ==> SUC m <= k`) th])) + THEN REWRITE_TAC[LT_0] + THEN MESON_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `~((p:num->A) 0 = inverse (node_map (H:(A)hypermap)) ((p:num->A) (m:num)))` (LABEL_TAC "G23") + THENL[ REWRITE_TAC[GSYM node_map_inverse_representation] + THEN USE_THEN "G21" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "F16" (SUBST1_TAC o SYM) + THEN USE_THEN "F10" (MP_TAC o SPECL[`t:num`; `m:num`]) + THEN USE_THEN "F15" (fun th -> (REWRITE_TAC[MATCH_MP LT_IMP_LE th])) + THEN USE_THEN "G1" (fun th -> (REWRITE_TAC[MATCH_MP (ARITH_RULE `SUC (m:num) <= t:num ==> m < t`) th])) + THEN MESON_TAC[]; ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `(p:num->A) (m:num)`; `(p:num->A) 0`] node_map_node_walkup)))) + THEN REPLICATE_TAC 3 (POP_ASSUM (fun th -> REWRITE_TAC[th])) + THEN USE_THEN "F16" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN USE_THEN "F10" (MP_TAC o SPECL[`(m:num) + 1`; `m:num`]) + THEN USE_THEN "F12" (fun th -> REWRITE_TAC[ARITH_RULE `m:num < m + 1`]) + THEN USE_THEN "G2" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `m:num < k:num ==> m+1 <= k`) th]) + THEN USE_THEN "G3" MP_TAC + THEN REWRITE_TAC[ADD1] + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "G3" o GSYM) + THEN SUBGOAL_THEN `~(node_map (H:(A)hypermap) ((p:num->A) (m:num)) = p m)` (LABEL_TAC "G25") + THENL[USE_THEN "F16k" (SUBST1_TAC o SYM) + THEN USE_THEN "F10" (MP_TAC o SPECL[`k:num`; `m:num`]) + THEN USE_THEN "G2" (fun th -> REWRITE_TAC[LE_REFL; th]) + THEN MESON_TAC[]; ALL_TAC] + THEN MP_TAC (CONJUNCT1(CONJUNCT2(SPECL[`H:(A)hypermap`; `(p:num->A) (m:num)`; `(p:num->A) (m:num)`] node_map_node_walkup))) + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[th])) + THEN USE_THEN "F16k" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN SUBGOAL_THEN `(p:num->A) (m:num) IN dart (H:(A)hypermap)` (LABEL_TAC "G26") + THENL[USE_THEN "F11" (SUBST1_TAC o SYM) + THEN REWRITE_TAC[IN_ELIM_THM; LE_0] + THEN EXISTS_TAC `m:num` + THEN USE_THEN "G2" (fun th -> (REWRITE_TAC[MATCH_MP LT_IMP_LE th])); ALL_TAC] + THEN USE_THEN "G26" (MP_TAC o MATCH_MP lemma_card_node_walkup_dart) + THEN USE_THEN "G7" SUBST1_TAC + THEN USE_THEN "F1" SUBST1_TAC + THEN REWRITE_TAC[GSYM ADD1; EQ_SUC] + THEN DISCH_THEN (LABEL_TAC "G21") + THEN USE_THEN "FI" (MP_TAC o SPEC `node_walkup (H:(A)hypermap) ((p:num->A) (m:num))`) + THEN USE_THEN "G26" (fun th1 -> (USE_THEN "F2" (fun th2 -> REWRITE_TAC[MATCH_MP lemmaSGCOSXK (CONJ th1 th2)]))) + THEN USE_THEN "G7" SUBST1_TAC + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN EXISTS_TAC `g:num->A` + THEN EXISTS_TAC `(k:num) - 1` + THEN USE_THEN "G16" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[ADD1] + THEN DISCH_THEN (fun th -> (LABEL_TAC "K3A" th THEN MP_TAC th)) + THEN REWRITE_TAC[GSYM node_map_inverse_representation] + THEN DISCH_THEN (LABEL_TAC "K3B") + THEN USE_THEN "F7"(fun th1 -> (USE_THEN "F12" (fun th2 -> (USE_THEN "G2" (fun th3 -> (USE_THEN "K3B" (fun th4 -> (MP_TAC (MATCH_MP lemma_face_walkup_eliminate_dart_on_Moebius_contour (CONJ th1 (CONJ th2 (CONJ th3 (SYM th4))))))))))))) + THEN REWRITE_TAC[lemma_sub_two_numbers] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "K4") (CONJUNCTS_THEN2 (LABEL_TAC "K5") (LABEL_TAC "K6"))) + THEN ABBREV_TAC `G = face_walkup (H:(A)hypermap) ((p:num->A) (m:num))` + THEN POP_ASSUM (LABEL_TAC "K7") + THEN SUBGOAL_THEN `one_step_contour G ((p:num->A) ((m:num)-1)) ((shift_path (p:num->A) ((m:num)+1)) 0)` ASSUME_TAC + THENL[REWRITE_TAC[lemma_shift_path_evaluation] + THEN REWRITE_TAC[ADD_0] + THEN REMOVE_THEN "K6" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `(!i:num j:num. i <= (m:num-1) /\ j <= (k:num) - (m+1) ==> ~(shift_path (p:num->A) (m+1) j = p i))` ASSUME_TAC + THENL[REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "K8") (LABEL_TAC "K9")) + THEN REWRITE_TAC[lemma_shift_path_evaluation; GSYM ADD_ASSOC] + THEN USE_THEN "F10" (MP_TAC o SPECL[`(m:num) + 1 + (j:num)`; `i:num`]) + THEN USE_THEN "K8" (fun th1 -> (REWRITE_TAC[MATCH_MP (ARITH_RULE `i:num <= (m:num) - 1 ==> i < m + 1 + (j:num)`) th1])) + THEN USE_THEN "K9" (fun th1 -> (USE_THEN "G2" (fun th2 -> (REWRITE_TAC[MATCH_MP (ARITH_RULE `j:num <= (k:num) - ((m:num) + 1) /\ m < k:num ==> m + 1 + j <= k`) (CONJ th1 th2)])))) + THEN REWRITE_TAC[CONTRAPOS_THM; EQ_SYM]; ALL_TAC] + THEN REMOVE_THEN "K4" (fun th1 -> (REMOVE_THEN "K5" (fun th2 -> (POP_ASSUM (fun th4-> (POP_ASSUM (fun th3 -> MP_TAC (MATCH_MP concatenate_two_disjoint_contours (CONJ th1 (CONJ th2 (CONJ th3 th4))))))))))) + THEN REWRITE_TAC[lemma_shift_path_evaluation] + THEN USE_THEN "F12" (fun th1 -> (USE_THEN "G2" (fun th2 -> REWRITE_TAC[MATCH_MP (ARITH_RULE `0 < (m:num) /\ m < (k:num) ==> m - 1 + k - (m+1) + 1 = k -1`) (CONJ th1 th2)]))) + THEN USE_THEN "G2" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `(m:num) < (k:num) ==> (m + 1) + k - (m+1) = k`) th]) + THEN USE_THEN "F12" (fun th -> REWRITE_TAC[MP (ARITH_RULE `0 < (m:num) ==> m - 1 + (i:num) + 1 = m + i`) th]) + THEN DISCH_THEN (X_CHOOSE_THEN `g:num->A` (CONJUNCTS_THEN2 (LABEL_TAC "K10") (CONJUNCTS_THEN2 (LABEL_TAC "K11") (CONJUNCTS_THEN2 (LABEL_TAC "K12") (CONJUNCTS_THEN2 (LABEL_TAC "K14") (LABEL_TAC "K15")))))) + THEN SUBGOAL_THEN `is_Moebius_contour (G:(A)hypermap) (g:num->A) ((k:num) - 1)` (LABEL_TAC "K16") + THENL[REWRITE_TAC[is_Moebius_contour] + THEN USE_THEN "K12" (fun th -> REWRITE_TAC[th]) + THEN EXISTS_TAC `m:num` + THEN EXISTS_TAC `(t:num) - 1` + THEN USE_THEN "F12" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "G1" (fun th -> REWRITE_TAC[MP (ARITH_RULE `SUC (m:num) <= t:num ==> m <= t - 1`) th]) + THEN USE_THEN "G1" (fun th1 -> (USE_THEN "F15" (fun th2 -> REWRITE_TAC[MP (ARITH_RULE `SUC (m:num) <= t:num /\ t < k:num ==> t - 1 < k - 1`) (CONJ th1 th2)]))) + THEN USE_THEN "K10" (SUBST1_TAC) + THEN USE_THEN "K11" (SUBST1_TAC) + THEN USE_THEN "K15" (MP_TAC o SPEC `0`) + THEN REWRITE_TAC[LE_0; ADD_0] + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "G1" MP_TAC + THEN REWRITE_TAC[LE_EXISTS; ADD1] + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` (LABEL_TAC "K16")) + THEN USE_THEN "F15" (fun th1 -> (USE_THEN "K16" (fun th2 -> (ASSUME_TAC (MATCH_MP (ARITH_RULE `t:num < k:num /\ t = ((m:num) + 1) + (d:num) ==> d <= k - (m+1)`) (CONJ th1 th2)))))) + THEN USE_THEN "K15" (MP_TAC o SPEC `d:num`) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "K16" (fun th -> GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o RAND_CONV) [SYM th]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `t:num = ((m:num)+1) + (d:num) ==> m + d = t - 1`) th]) + THEN DISCH_THEN SUBST1_TAC + THEN EXPAND_TAC "G" + THEN STRIP_TAC + THENL[USE_THEN "F10" (MP_TAC o SPECL[`m:num`; `0`]) + THEN USE_THEN "F12" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "G2" (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN DISCH_THEN (LABEL_TAC "K21") + THEN SUBGOAL_THEN `~((p:num->A) 0 = inverse (node_map (H:(A)hypermap)) ((p:num->A) (m:num)))` (LABEL_TAC "K23") + THENL[ REWRITE_TAC[GSYM node_map_inverse_representation] + THEN USE_THEN "K21" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "F16" (SUBST1_TAC o SYM) + THEN USE_THEN "F10" (MP_TAC o SPECL[`t:num`; `m:num`]) + THEN USE_THEN "F15" (fun th -> (REWRITE_TAC[MATCH_MP LT_IMP_LE th])) + THEN USE_THEN "G1" (fun th -> (REWRITE_TAC[MATCH_MP (ARITH_RULE `SUC (m:num) <= t:num ==> m < t`) th])) + THEN MESON_TAC[]; ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `(p:num->A) (m:num)`; `(p:num->A) 0`] node_map_face_walkup))) + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[th])) + THEN USE_THEN "F16" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN USE_THEN "K3A" SUBST1_TAC + THEN REWRITE_TAC[node_map_face_walkup] + THEN USE_THEN "F16k" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `(p:num->A) (m:num) IN dart (H:(A)hypermap)` (LABEL_TAC "K17") + THENL[USE_THEN "F11" (SUBST1_TAC o SYM) + THEN REWRITE_TAC[IN_ELIM_THM; LE_0] + THEN EXISTS_TAC `m:num` + THEN USE_THEN "G2" (fun th -> (REWRITE_TAC[MATCH_MP LT_IMP_LE th])); ALL_TAC] + THEN USE_THEN "K17" (MP_TAC o MATCH_MP lemma_card_face_walkup_dart) + THEN USE_THEN "K7" SUBST1_TAC + THEN USE_THEN "F1" SUBST1_TAC + THEN REWRITE_TAC[GSYM ADD1; EQ_SUC] + THEN DISCH_THEN (LABEL_TAC "K18") + THEN USE_THEN "FI" (MP_TAC o SPEC `face_walkup (H:(A)hypermap) ((p:num->A) (m:num))`) + THEN USE_THEN "K17" (fun th1 -> (USE_THEN "F2" (fun th2 -> REWRITE_TAC[MATCH_MP lemmaSGCOSXK (CONJ th1 th2)]))) + THEN USE_THEN "K7" SUBST1_TAC + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN EXISTS_TAC `g:num->A` + THEN EXISTS_TAC `(k:num) - 1` + THEN USE_THEN "K16" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (fun th1 -> (REMOVE_THEN "F14" (fun th2 -> (MP_TAC (MATCH_MP (ARITH_RULE `m:num <= t:num /\ ~(m < t) ==> t = m`) (CONJ th2 th1)))))) + THEN DISCH_THEN SUBST_ALL_TAC + THEN ASM_CASES_TAC `1 < m:num` + THENL[ POP_ASSUM (fun th -> (LABEL_TAC "B1" th THEN LABEL_TAC "B2" (MATCH_MP (ARITH_RULE `1 < m:num ==> 2 <= m`) th))) + THEN USE_THEN "F17" (MP_TAC o SPEC `0:num`) + THEN USE_THEN "B2" (fun th1 -> (USE_THEN "F15" (fun th2 -> (LABEL_TAC "B3" (MP (ARITH_RULE `2 <= m:num /\ m < k:num ==> 2 < k`) (CONJ th1 th2)))))) + THEN USE_THEN "B3" (fun th -> REWRITE_TAC[MP (ARITH_RULE `2 < k:num ==> 0 < k`) th]) + THEN REWRITE_TAC[one_step_contour] + THEN STRIP_TAC + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[ADD1] + THEN DISCH_THEN (LABEL_TAC "B4") + THEN USE_THEN "F15" (fun th -> MP_TAC (MATCH_MP (ARITH_RULE `m:num < k:num ==> 0 < k`) th)) + THEN USE_THEN "F7" (fun th1 -> (DISCH_THEN (fun th2 -> (USE_THEN "B4" (fun th3 -> (MP_TAC (MATCH_MP lemma_node_walkup_second_segment_contour (CONJ th1 (CONJ th2 th3))))))))) + THEN REWRITE_TAC[ADD] + THEN DISCH_THEN (LABEL_TAC "B5") + THEN ABBREV_TAC `G = node_walkup (H:(A)hypermap) ((p:num->A) 0)` + THEN POP_ASSUM (LABEL_TAC "B6") + THEN ABBREV_TAC `g = shift_path (p:num->A) 1` + THEN POP_ASSUM (LABEL_TAC "B7") + THEN SUBGOAL_THEN `is_Moebius_contour (G:(A)hypermap) (g:num->A) ((k:num) - 1)` (LABEL_TAC "B8") + THENL[REWRITE_TAC[is_Moebius_contour] + THEN USE_THEN "B5" (fun th -> REWRITE_TAC[th]) + THEN EXISTS_TAC `(m:num) - 1` + THEN EXISTS_TAC `(m:num) - 1` + THEN USE_THEN "B2" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `2 <= m:num ==> 0 < m - 1`) th; LE_REFL]) + THEN USE_THEN "F12" (fun th1 -> (USE_THEN "F15" (fun th2 -> REWRITE_TAC[MP (ARITH_RULE `0 < m:num /\ m < k:num ==> m - 1 < k - 1`) (CONJ th1 th2)]))) + THEN EXPAND_TAC "g" + THEN REWRITE_TAC[lemma_shift_path_evaluation] + THEN REWRITE_TAC[ADD_SYM; GSYM ADD] + THEN USE_THEN "F12" (fun th -> REWRITE_TAC[MP (ARITH_RULE `0 < m:num ==> m - 1 + 1 = m`) th]) + THEN USE_THEN "B3" (fun th -> REWRITE_TAC[MP (ARITH_RULE `2 < k:num ==> k - 1 + 1 = k`) th]) + THEN REWRITE_TAC[ARITH_RULE `1+0 = 1`] + THEN POP_ASSUM (LABEL_TAC "B9") + THEN EXPAND_TAC "G" + THEN STRIP_TAC + THENL[USE_THEN "B4" MP_TAC + THEN REWRITE_TAC[ADD] + THEN DISCH_THEN SUBST1_TAC + THEN SUBGOAL_THEN `~(face_map (H:(A)hypermap) ((p:num->A) 0) = p 0)` ASSUME_TAC + THENL[ USE_THEN "B4" (SUBST1_TAC o SYM) + THEN REWRITE_TAC[ADD] + THEN USE_THEN "F10" (MP_TAC o SPECL[`1`; `0`]) + THEN USE_THEN "B3" (fun th -> REWRITE_TAC[MP (ARITH_RULE `2 < k:num ==> 1 <= k`) th]) + THEN REWRITE_TAC[ARITH_RULE `0 < 1`] + THEN MESON_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `~(node_map (H:(A)hypermap) ((p:num->A) 0) = p 0)` ASSUME_TAC + THENL[USE_THEN "F16" (SUBST1_TAC o SYM) + THEN USE_THEN "F10" (MP_TAC o SPECL[`m:num`; `0`]) + THEN USE_THEN "F15" (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN USE_THEN "F12" (fun th -> REWRITE_TAC[th]) + THEN MESON_TAC[]; ALL_TAC] + THEN MP_TAC (CONJUNCT1(CONJUNCT2(SPECL[`H:(A)hypermap`; `(p:num->A) 0`; `(p:num->A) 0`] node_map_node_walkup))) + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[th])) + THEN USE_THEN "F16" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN USE_THEN "F10" (MP_TAC o SPECL[`m:num`; `0`]) + THEN USE_THEN "F15" (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN USE_THEN "F12" (fun th -> REWRITE_TAC[th]) + THEN DISCH_TAC + THEN SUBGOAL_THEN `~((p:num->A) (m:num) = face_map (H:(A)hypermap) ((p:num->A) 0))` ASSUME_TAC + THENL[USE_THEN "B4" (SUBST1_TAC o SYM) + THEN REWRITE_TAC[ADD] + THEN USE_THEN "F10" (MP_TAC o SPECL[`m:num`; `1`]) + THEN USE_THEN "F15" (fun th -> (REWRITE_TAC[MATCH_MP LT_IMP_LE th])) + THEN USE_THEN "B1" (fun th -> (REWRITE_TAC[th])) + THEN MESON_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `~((p:num->A) (m:num) = inverse (node_map (H:(A)hypermap)) ((p:num->A) 0))` ASSUME_TAC + THENL[REWRITE_TAC[GSYM node_map_inverse_representation] + THEN USE_THEN "F16k" (SUBST1_TAC o SYM) + THEN USE_THEN "F10" (MP_TAC o SPECL[`k:num`; `0`]) + THEN USE_THEN "B3" (fun th -> (REWRITE_TAC[MATCH_MP (ARITH_RULE `2 < k:num ==> 0 < k`) th; LE_REFL])); ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `(p:num->A) 0`; `(p:num->A) (m:num)`] node_map_node_walkup)))) + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[th])) + THEN POP_ASSUM (fun th -> REWRITE_TAC[GSYM th]) + THEN USE_THEN "F16k" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN SUBGOAL_THEN `(p:num->A) 0 IN dart (H:(A)hypermap)` (LABEL_TAC "B10") + THENL[USE_THEN "F11" (SUBST1_TAC o SYM) + THEN REWRITE_TAC[IN_ELIM_THM; LE_0] + THEN EXISTS_TAC `0` + THEN REWRITE_TAC[LE_0]; ALL_TAC] + THEN USE_THEN "B10" (MP_TAC o MATCH_MP lemma_card_node_walkup_dart) + THEN USE_THEN "B6" SUBST1_TAC + THEN USE_THEN "F1" SUBST1_TAC + THEN REWRITE_TAC[GSYM ADD1; EQ_SUC] + THEN DISCH_THEN (LABEL_TAC "B11") + THEN USE_THEN "FI" (MP_TAC o SPEC `node_walkup (H:(A)hypermap) ((p:num->A) 0)`) + THEN USE_THEN "B10" (fun th1 -> (USE_THEN "F2" (fun th2 -> REWRITE_TAC[MATCH_MP lemmaSGCOSXK (CONJ th1 th2)]))) + THEN USE_THEN "B6" SUBST1_TAC + THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) + THEN EXISTS_TAC `g:num->A` + THEN EXISTS_TAC `(k:num) - 1` + THEN USE_THEN "B8" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[ADD1] + THEN REWRITE_TAC[GSYM node_map_inverse_representation] + THEN DISCH_THEN (LABEL_TAC "C4" o GSYM) + THEN USE_THEN "F15" (fun th -> MP_TAC (MATCH_MP (ARITH_RULE `m:num < k:num ==> 0 < k`) th)) + THEN USE_THEN "F7" (fun th1 -> (DISCH_THEN (fun th2 -> (USE_THEN "C4" (fun th3 -> (MP_TAC (MATCH_MP lemma_face_walkup_second_segment_contour (CONJ th1 (CONJ th2 th3))))))))) + THEN REWRITE_TAC[ADD] + THEN DISCH_THEN (LABEL_TAC "C5") + THEN ABBREV_TAC `G = face_walkup (H:(A)hypermap) ((p:num->A) 0)` + THEN POP_ASSUM (LABEL_TAC "C6") + THEN ABBREV_TAC `g = shift_path (p:num->A) 1` + THEN POP_ASSUM (LABEL_TAC "C7") + THEN SUBGOAL_THEN `is_Moebius_contour (G:(A)hypermap) (g:num->A) ((k:num) - 1)` (LABEL_TAC "C8") + THENL[REWRITE_TAC[is_Moebius_contour] + THEN USE_THEN "C5" (fun th -> REWRITE_TAC[th]) + THEN EXISTS_TAC `(m:num) - 1` + THEN EXISTS_TAC `(m:num) - 1` + THEN USE_THEN "B2" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `2 <= m:num ==> 0 < m - 1`) th; LE_REFL]) + THEN USE_THEN "F12" (fun th1 -> (USE_THEN "F15" (fun th2 -> REWRITE_TAC[MP (ARITH_RULE `0 < m:num /\ m < k:num ==> m - 1 < k - 1`) (CONJ th1 th2)]))) + THEN EXPAND_TAC "g" + THEN REWRITE_TAC[lemma_shift_path_evaluation] + THEN REWRITE_TAC[ADD_SYM; GSYM ADD] + THEN USE_THEN "F12" (fun th -> REWRITE_TAC[MP (ARITH_RULE `0 < m:num ==> m - 1 + 1 = m`) th]) + THEN USE_THEN "B3" (fun th -> REWRITE_TAC[MP (ARITH_RULE `2 < k:num ==> k - 1 + 1 = k`) th]) + THEN REWRITE_TAC[ARITH_RULE `1+0 = 1`] + THEN POP_ASSUM (LABEL_TAC "C9") + THEN EXPAND_TAC "G" + THEN STRIP_TAC + THENL[USE_THEN "C4" (MP_TAC o SYM) + THEN REWRITE_TAC[ADD] + THEN GEN_REWRITE_TAC (LAND_CONV o TOP_DEPTH_CONV) [node_map_inverse_representation] + THEN DISCH_THEN (SUBST1_TAC) + THEN REWRITE_TAC[node_map_face_walkup] + THEN USE_THEN "F16" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN USE_THEN "F10" (MP_TAC o SPECL[`m:num`; `0`]) + THEN USE_THEN "F12" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F15" (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN DISCH_THEN (ASSUME_TAC o GSYM) + THEN SUBGOAL_THEN `~((p:num->A) (m:num) = inverse(node_map (H:(A)hypermap)) ((p:num->A) 0))` ASSUME_TAC + THENL[REWRITE_TAC[GSYM node_map_inverse_representation] + THEN USE_THEN "F16k" (SUBST1_TAC o SYM) + THEN USE_THEN "F10" (MP_TAC o SPECL[`k:num`; `0`]) + THEN USE_THEN "B3" (fun th -> (REWRITE_TAC[MATCH_MP (ARITH_RULE `2 < k:num ==> 0 < k`) th; LE_REFL])); ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2 (SPECL[`H:(A)hypermap`; `(p:num->A) 0`; `(p:num->A) (m:num)`] node_map_face_walkup))) + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[th])) + THEN USE_THEN "F16k" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN SUBGOAL_THEN `(p:num->A) 0 IN dart (H:(A)hypermap)` (LABEL_TAC "C10") + THENL[USE_THEN "F11" (SUBST1_TAC o SYM) + THEN REWRITE_TAC[IN_ELIM_THM; LE_0] + THEN EXISTS_TAC `0` + THEN REWRITE_TAC[LE_0]; ALL_TAC] + THEN USE_THEN "C10" (MP_TAC o MATCH_MP lemma_card_face_walkup_dart) + THEN USE_THEN "C6" SUBST1_TAC + THEN USE_THEN "F1" SUBST1_TAC + THEN REWRITE_TAC[GSYM ADD1; EQ_SUC] + THEN DISCH_THEN (LABEL_TAC "C11" o GSYM) + THEN USE_THEN "FI" (MP_TAC o SPEC `face_walkup (H:(A)hypermap) ((p:num->A) 0)`) + THEN USE_THEN "C10" (fun th1 -> (USE_THEN "F2" (fun th2 -> REWRITE_TAC[MATCH_MP lemmaSGCOSXK (CONJ th1 th2)]))) + THEN USE_THEN "C6" SUBST1_TAC + THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) + THEN EXISTS_TAC `g:num->A` + THEN EXISTS_TAC `(k:num) - 1` + THEN USE_THEN "C8" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (fun th1 -> (REMOVE_THEN "F12" (fun th2 -> ASSUME_TAC (MATCH_MP (ARITH_RULE `0 < m:num /\ ~(1 < m) ==> m = 1`) (CONJ th2 th1))))) + THEN POP_ASSUM SUBST_ALL_TAC + THEN ASM_CASES_TAC `2 < k:num` + THENL[POP_ASSUM (LABEL_TAC "F18") + THEN USE_THEN "F15" MP_TAC + THEN REWRITE_TAC[LT_EXISTS] + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` MP_TAC) + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [ADD_SYM] + THEN ABBREV_TAC `s = SUC (d:num)` + THEN DISCH_THEN SUBST_ALL_TAC + THEN USE_THEN "F18" (fun th -> (LABEL_TAC "F19" (MATCH_MP (ARITH_RULE `2 < (s:num) + 1 ==> 2 <= s`) th))) + THEN USE_THEN "F17" (MP_TAC o SPEC `s:num`) + THEN REWRITE_TAC[ARITH_RULE `(s:num) < s + 1`] + THEN REWRITE_TAC[ADD1] + THEN REWRITE_TAC[one_step_contour] + THEN STRIP_TAC + THENL[POP_ASSUM (LABEL_TAC "X1") + THEN MP_TAC (ARITH_RULE `s:num < s + 1`) + THEN USE_THEN "F19" (fun th -> MP_TAC (MP (ARITH_RULE `2 <= s:num ==> 0 < s`) th)) + THEN USE_THEN "F7" (fun th1 -> (DISCH_THEN (fun th2 -> (DISCH_THEN (fun th3 -> (USE_THEN "X1" (fun th4 -> (MP_TAC (MATCH_MP lemma_node_walkup_eliminate_dart_on_Moebius_contour (CONJ th1 (CONJ th2 (CONJ th3 th4)))))))))))) + THEN REWRITE_TAC[lemma_sub_two_numbers; SUB_REFL] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "X4") (CONJUNCTS_THEN2 (LABEL_TAC "X5") (LABEL_TAC "X6"))) + THEN ABBREV_TAC `G = node_walkup (H:(A)hypermap) ((p:num->A) (s:num))` + THEN POP_ASSUM (LABEL_TAC "X7") + THEN SUBGOAL_THEN `one_step_contour (G:(A)hypermap) ((p:num->A) ((s:num)-1)) ((shift_path (p:num->A) ((s:num)+1)) 0)` ASSUME_TAC + THENL[REWRITE_TAC[lemma_shift_path_evaluation] + THEN REWRITE_TAC[ADD_0] + THEN REMOVE_THEN "X6" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `(!i:num j:num. i <= (s:num-1) /\ j <= 0 ==> ~(shift_path (p:num->A) (s+1) j = p i))` ASSUME_TAC + THENL[REWRITE_TAC[LE] + THEN REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (ASSUME_TAC) (SUBST1_TAC)) + THEN REWRITE_TAC[lemma_shift_path_evaluation; GSYM ADD_ASSOC; ADD_0] + THEN USE_THEN "F10" (MP_TAC o SPECL[`(s:num) + 1 `; `i:num`]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MP (ARITH_RULE `i:num <= (s:num) - 1 ==> i < s + 1`) th; LE_REFL]) + THEN MESON_TAC[]; ALL_TAC] + THEN REMOVE_THEN "X4" (fun th1 -> (REMOVE_THEN "X5" (fun th2 -> (POP_ASSUM (fun th4-> (POP_ASSUM (fun th3 -> MP_TAC (MATCH_MP concatenate_two_disjoint_contours (CONJ th1 (CONJ th2 (CONJ th3 th4))))))))))) + THEN REWRITE_TAC[lemma_shift_path_evaluation] + THEN REWRITE_TAC[ADD_0] + THEN USE_THEN "F19" (fun th -> REWRITE_TAC[MP (ARITH_RULE `2 <= s:num ==> s-1+0+1 = s`) th]) + THEN DISCH_THEN (X_CHOOSE_THEN `g:num->A` (CONJUNCTS_THEN2 (LABEL_TAC "X10") (CONJUNCTS_THEN2 (LABEL_TAC "X11") (CONJUNCTS_THEN2 (LABEL_TAC "X12") (LABEL_TAC "X14" o CONJUNCT1))))) + THEN SUBGOAL_THEN `is_Moebius_contour (G:(A)hypermap) (g:num->A) (s:num)` (LABEL_TAC "X15") + THENL[REWRITE_TAC[is_Moebius_contour] + THEN USE_THEN "X12" (fun th -> REWRITE_TAC[th]) + THEN EXISTS_TAC `1:num` + THEN EXISTS_TAC `1:num` + THEN USE_THEN "F19" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `2 <= s:num ==> 1 < s`) th; ARITH_RULE `0 < 1 /\ 1 <= 1`]) + THEN REMOVE_THEN "X10" SUBST1_TAC + THEN REMOVE_THEN "X11" SUBST1_TAC + THEN POP_ASSUM (MP_TAC o SPEC `1`) + THEN USE_THEN "F19" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `2 <= s:num ==> 1 <= s - 1`) th]) + THEN DISCH_THEN SUBST1_TAC + THEN EXPAND_TAC "G" + THEN STRIP_TAC + THENL[USE_THEN "F10" (MP_TAC o SPECL[`s:num`; `0`]) + THEN USE_THEN "F19" (fun th -> REWRITE_TAC[MP (ARITH_RULE `2 <= s:num ==> 0 < s`) th; ARITH_RULE `s:num <= s + 1`]) + THEN DISCH_TAC + THEN SUBGOAL_THEN `~((p:num->A) 0 = face_map (H:(A)hypermap) ((p:num->A) (s:num)))` ASSUME_TAC + THENL[USE_THEN "X1" (SUBST1_TAC o SYM) + THEN USE_THEN "F10" (MP_TAC o SPECL[`(s:num) + 1`; `0`]) + THEN REWRITE_TAC[ARITH_RULE `0 < (s:num) + 1`; LE_REFL]; ALL_TAC] + THEN SUBGOAL_THEN `~((p:num->A) 0 = inverse (node_map (H:(A)hypermap)) ((p:num->A) (s:num)))` (ASSUME_TAC) + THENL[REWRITE_TAC[GSYM node_map_inverse_representation] + THEN USE_THEN "F16" (SUBST1_TAC o SYM) + THEN USE_THEN "F10" (MP_TAC o SPECL[`(s:num)`; `1`]) + THEN USE_THEN "F19" (fun th -> REWRITE_TAC[MP (ARITH_RULE `2 <= (s:num) ==> 1 < s`) th; ARITH_RULE `s:num <= s + 1`]) + THEN MESON_TAC[]; ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `(p:num->A) (s:num)`; `(p:num->A) (0:num)`] node_map_node_walkup)))) + THEN REPLICATE_TAC 3 (POP_ASSUM (fun th -> REWRITE_TAC[th])) + THEN USE_THEN "F16" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN USE_THEN "F10" (MP_TAC o SPECL[`s:num`; `1`]) + THEN USE_THEN "F19" (fun th -> REWRITE_TAC[MP (ARITH_RULE `2 <= s:num ==> 1 < s`) th; ARITH_RULE `s:num <= s + 1`]) + THEN DISCH_TAC + THEN SUBGOAL_THEN `~((p:num->A) 1 = face_map (H:(A)hypermap) ((p:num->A) (s:num)))` ASSUME_TAC + THENL[USE_THEN "X1" (SUBST1_TAC o SYM) + THEN USE_THEN "F10" (MP_TAC o SPECL[`(s:num) + 1`; `1`]) + THEN USE_THEN "F19" (fun th -> REWRITE_TAC[MP (ARITH_RULE `2 <= s:num ==> 1 < s + 1`) th; ARITH_RULE `0 < (s:num) + 1`; LE_REFL]); + ALL_TAC] + THEN SUBGOAL_THEN `~((p:num->A) 1 = inverse (node_map (H:(A)hypermap)) ((p:num->A) (s:num)))` (ASSUME_TAC) + THENL[REWRITE_TAC[GSYM node_map_inverse_representation] + THEN USE_THEN "F16k" (SUBST1_TAC o SYM) + THEN USE_THEN "F10" (MP_TAC o SPECL[`(s:num)+1`; `s:num`]) + THEN USE_THEN "F19" (fun th -> REWRITE_TAC[ARITH_RULE `s:num < s + 1`; LE_REFL]); ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `(p:num->A) (s:num)`; `(p:num->A) (1:num)`] node_map_node_walkup)))) + THEN REPLICATE_TAC 3 (POP_ASSUM (fun th -> REWRITE_TAC[th])) + THEN USE_THEN "F16k" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN SUBGOAL_THEN `(p:num->A) (s:num) IN dart (H:(A)hypermap)` (LABEL_TAC "X20") + THENL[ USE_THEN "F11" (SUBST1_TAC o SYM) + THEN REWRITE_TAC[IN_ELIM_THM; LE_0] + THEN EXISTS_TAC `s:num` + THEN REWRITE_TAC[ARITH_RULE `s:num <= s + 1`]; ALL_TAC] + THEN USE_THEN "X20" (MP_TAC o MATCH_MP lemma_card_node_walkup_dart) + THEN USE_THEN "X7" SUBST1_TAC + THEN USE_THEN "F1" SUBST1_TAC + THEN REWRITE_TAC[GSYM ADD1; EQ_SUC] + THEN DISCH_THEN (LABEL_TAC "X21") + THEN USE_THEN "FI" (MP_TAC o SPEC `node_walkup (H:(A)hypermap) ((p:num->A) (s:num))`) + THEN USE_THEN "X20" (fun th1 -> (USE_THEN "F2" (fun th2 -> REWRITE_TAC[MATCH_MP lemmaSGCOSXK (CONJ th1 th2)]))) + THEN USE_THEN "X7" SUBST1_TAC + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN EXISTS_TAC `g:num->A` + THEN EXISTS_TAC `s:num` + THEN USE_THEN "X15" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[GSYM node_map_inverse_representation] + THEN DISCH_THEN (LABEL_TAC "Y1") + THEN MP_TAC (ARITH_RULE `s:num < s + 1`) + THEN USE_THEN "F19" (fun th -> MP_TAC (MP (ARITH_RULE `2 <= s:num ==> 0 < s`) th)) + THEN USE_THEN "F7" (fun th1 -> (DISCH_THEN (fun th2 -> (DISCH_THEN (fun th3 -> (USE_THEN "Y1" (fun th4 -> (MP_TAC (MATCH_MP lemma_face_walkup_eliminate_dart_on_Moebius_contour (CONJ th1 (CONJ th2 (CONJ th3 (SYM th4))))))))))))) + THEN REWRITE_TAC[lemma_sub_two_numbers; SUB_REFL] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "Y4") (CONJUNCTS_THEN2 (LABEL_TAC "Y5") (LABEL_TAC "Y6"))) + THEN ABBREV_TAC `G = face_walkup (H:(A)hypermap) ((p:num->A) (s:num))` + THEN POP_ASSUM (LABEL_TAC "Y7") + THEN SUBGOAL_THEN `one_step_contour (G:(A)hypermap) ((p:num->A) ((s:num)-1)) ((shift_path (p:num->A) ((s:num)+1)) 0)` ASSUME_TAC + THEN REWRITE_TAC[lemma_shift_path_evaluation] + THEN REWRITE_TAC[ADD_0] + THEN REMOVE_THEN "Y6" (fun th -> REWRITE_TAC[th]) + THEN SUBGOAL_THEN `(!i:num j:num. i <= (s:num-1) /\ j <= 0 ==> ~(shift_path (p:num->A) (s+1) j = p i))` ASSUME_TAC + THENL[REWRITE_TAC[LE] + THEN REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (ASSUME_TAC) (SUBST1_TAC)) + THEN REWRITE_TAC[lemma_shift_path_evaluation; GSYM ADD_ASSOC; ADD_0] + THEN USE_THEN "F10" (MP_TAC o SPECL[`(s:num) + 1 `; `i:num`]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MP (ARITH_RULE `i:num <= (s:num) - 1 ==> i < s + 1`) th; LE_REFL]) + THEN MESON_TAC[]; ALL_TAC] + THEN REMOVE_THEN "Y4" (fun th1 -> (REMOVE_THEN "Y5" (fun th2 -> (POP_ASSUM (fun th4-> (POP_ASSUM (fun th3 -> MP_TAC (MATCH_MP concatenate_two_disjoint_contours (CONJ th1 (CONJ th2 (CONJ th3 th4))))))))))) + THEN REWRITE_TAC[lemma_shift_path_evaluation] + THEN REWRITE_TAC[ADD_0] + THEN USE_THEN "F19" (fun th -> REWRITE_TAC[MP (ARITH_RULE `2 <= s:num ==> s-1+0+1 = s`) th]) + THEN DISCH_THEN (X_CHOOSE_THEN `g:num->A` (CONJUNCTS_THEN2 (LABEL_TAC "Y10") (CONJUNCTS_THEN2 (LABEL_TAC "Y11") (CONJUNCTS_THEN2 (LABEL_TAC "Y12") (LABEL_TAC "Y14" o CONJUNCT1))))) + THEN SUBGOAL_THEN `is_Moebius_contour (G:(A)hypermap) (g:num->A) (s:num)` (LABEL_TAC "Y15") + THENL[REWRITE_TAC[is_Moebius_contour] + THEN USE_THEN "Y12" (fun th -> REWRITE_TAC[th]) + THEN EXISTS_TAC `1:num` + THEN EXISTS_TAC `1:num` + THEN USE_THEN "F19" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `2 <= s:num ==> 1 < s`) th; ARITH_RULE `0 < 1 /\ 1 <= 1`]) + THEN REMOVE_THEN "Y10" SUBST1_TAC + THEN REMOVE_THEN "Y11" SUBST1_TAC + THEN POP_ASSUM (MP_TAC o SPEC `1`) + THEN USE_THEN "F19" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `2 <= s:num ==> 1 <= s - 1`) th]) + THEN DISCH_THEN SUBST1_TAC + THEN EXPAND_TAC "G" + THEN STRIP_TAC + THENL[USE_THEN "F10" (MP_TAC o SPECL[`s:num`; `0`]) + THEN USE_THEN "F19" (fun th -> REWRITE_TAC[MP (ARITH_RULE `2 <= s:num ==> 0 < s`) th; ARITH_RULE `s:num <= s + 1`]) + THEN DISCH_TAC + THEN SUBGOAL_THEN `~((p:num->A) 0 = inverse (node_map (H:(A)hypermap)) ((p:num->A) (s:num)))` (ASSUME_TAC) + THENL[REWRITE_TAC[GSYM node_map_inverse_representation] + THEN USE_THEN "F16" (SUBST1_TAC o SYM) + THEN USE_THEN "F10" (MP_TAC o SPECL[`(s:num)`; `1`]) + THEN USE_THEN "F19" (fun th -> REWRITE_TAC[MP (ARITH_RULE `2 <= (s:num) ==> 1 < s`) th; ARITH_RULE `s:num <= s + 1`]) + THEN MESON_TAC[]; ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `(p:num->A) (s:num)`; `(p:num->A) (0:num)`] node_map_face_walkup))) + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[th])) + THEN USE_THEN "F16" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN USE_THEN "F10" (MP_TAC o SPECL[`s:num`; `1`]) + THEN USE_THEN "F19" (fun th -> REWRITE_TAC[MP (ARITH_RULE `2 <= s:num ==> 1 < s`) th; ARITH_RULE `s:num <= s + 1`]) + THEN DISCH_TAC + THEN SUBGOAL_THEN `~((p:num->A) 1 = inverse (node_map (H:(A)hypermap)) ((p:num->A) (s:num)))` (ASSUME_TAC) + THENL[REWRITE_TAC[GSYM node_map_inverse_representation] + THEN USE_THEN "F16k" (SUBST1_TAC o SYM) + THEN USE_THEN "F10" (MP_TAC o SPECL[`(s:num)+1`; `s:num`]) + THEN USE_THEN "F19" (fun th -> REWRITE_TAC[ARITH_RULE `s:num < s + 1`; LE_REFL]); ALL_TAC] + THEN MP_TAC (CONJUNCT2(CONJUNCT2(SPECL[`H:(A)hypermap`; `(p:num->A) (s:num)`; `(p:num->A) (1:num)`] node_map_face_walkup))) + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[th])) + THEN USE_THEN "F16k" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN SUBGOAL_THEN `(p:num->A) (s:num) IN dart (H:(A)hypermap)` (LABEL_TAC "Y20") + THENL[USE_THEN "F11" (SUBST1_TAC o SYM) + THEN REWRITE_TAC[IN_ELIM_THM; LE_0] + THEN EXISTS_TAC `s:num` + THEN REWRITE_TAC[ARITH_RULE `s:num <= s + 1`]; ALL_TAC] + THEN USE_THEN "Y20" (MP_TAC o MATCH_MP lemma_card_face_walkup_dart) + THEN USE_THEN "Y7" SUBST1_TAC + THEN USE_THEN "F1" SUBST1_TAC + THEN REWRITE_TAC[GSYM ADD1; EQ_SUC] + THEN DISCH_THEN (LABEL_TAC "Y21") + THEN USE_THEN "FI" (MP_TAC o SPEC `face_walkup (H:(A)hypermap) ((p:num->A) (s:num))`) + THEN USE_THEN "Y20" (fun th1 -> (USE_THEN "F2" (fun th2 -> REWRITE_TAC[MATCH_MP lemmaSGCOSXK (CONJ th1 th2)]))) + THEN USE_THEN "Y7" SUBST1_TAC + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN EXISTS_TAC `g:num->A` + THEN EXISTS_TAC `s:num` + THEN USE_THEN "Y15" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (fun th1 -> (REMOVE_THEN "F15" (fun th2 -> (MP_TAC (MP (ARITH_RULE `~(2 < k:num) /\ 1 < k ==> k =2`) (CONJ th1 th2)))))) + THEN DISCH_THEN (SUBST_ALL_TAC) + THEN REMOVE_THEN "F5" MP_TAC + THEN USE_THEN "F11" SUBST1_TAC + THEN REWRITE_TAC[GSYM THREE] + THEN DISCH_TAC + THEN MP_TAC (SPEC `H:(A)hypermap` lemma_minimum_Moebius_hypermap) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[NOT_IMP] + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[th]) + THEN EXISTS_TAC `p:num->A` + THEN EXISTS_TAC `2` + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[th]));; + +(* HERE I DEFINE THE NOTION OF THE LOOP. THIS DEFINITION DOES NOT DEPEND ON THE ORDER OF ITS VERTICES *) + +let exist_loop = prove(`?L:(A->bool)#(A->A). FINITE (FST L) /\ SND L permutes FST L /\ ?x:A. x IN FST L /\ orbit_map (SND L) x = FST L`, + MP_TAC(SPEC `UNIV:A->bool` MEMBER_NOT_EMPTY) + THEN REWRITE_TAC[UNIV_NOT_EMPTY] + THEN DISCH_THEN (X_CHOOSE_THEN `x:A` (ASSUME_TAC)) + THEN EXISTS_TAC `({x:A}, I:A->A)` + THEN REWRITE_TAC[FST; SND] + THEN REWRITE_TAC[FINITE_SINGLETON; PERMUTES_I; I_O_ID] + THEN EXISTS_TAC `x:A` + THEN REWRITE_TAC[IN_SING; GSYM orbit_one_point; I_THM]);; + +let loop_tybij = new_type_definition "loop"("loop", "tuple_loop") exist_loop;; + +let dart_of = new_definition `!L:(A)loop. dart_of L = FST (tuple_loop L)`;; + +let next = new_definition `!L:(A)loop. next L = SND (tuple_loop L)`;; + +let back = new_definition `!L:(A)loop. back L = inverse (SND (tuple_loop L))`;; + +let belong = new_definition `!(L:(A)loop) x:A. x belong L <=> x IN (dart_of L)`;; + +let size = new_definition `size (L:(A)loop) = CARD (dart_of L)`;; + +let top = new_definition `top (L:(A)loop) = PRE (CARD (dart_of L))`;; + +let is_loop = new_definition `!(H:(A)hypermap) (L:(A)loop). is_loop H L <=> (!x:A. x belong L ==> one_step_contour H x (next L x))`;; + +let loop_path = new_definition `!(L:(A)loop) x:A k:num. loop_path L x k = ((next L) POWER k) x`;; + +let lemma_loop_path_via_list = prove(`!L:(A)loop x:A. loop_path L x = power_list (next L) x`, + REPEAT GEN_TAC THEN REWRITE_TAC[loop_path; power_list; FUN_EQ_THM]);; + +let loop_lemma = prove(`!L:(A)loop. FINITE (dart_of L) /\(next L) permutes (dart_of L) /\ (?x:A. x belong L /\ orbit_map (next L) x = dart_of L)`, + GEN_TAC THEN REWRITE_TAC[belong; loop_tybij; dart_of; next] THEN MESON_TAC[loop_tybij]);; + +let lemma_loop_representation = prove(`!s:A->bool p:A->A x:A. FINITE s /\ p permutes s /\ orbit_map p x = s + ==> dart_of (loop (s, p)) = s /\ next (loop (s,p)) = p`, + REPEAT GEN_TAC THEN STRIP_TAC + THEN MP_TAC (SPECL[`p:A->A`; `x:A`] orbit_reflect) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[IMP_IMP] + THEN ONCE_REWRITE_TAC[CONJ_SYM] + THEN DISCH_THEN (ASSUME_TAC o SIMPLE_EXISTS `x:A`) + THEN MP_TAC (SPEC `(s:A->bool, p:A->A)` (CONJUNCT2 loop_tybij)) + THEN REWRITE_TAC[FST; SND; next; dart_of] + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[FST; SND]);; + +let lemma_loop_identity = prove(`!(L:(A)loop) (L':(A)loop). L = L' <=> (dart_of L = dart_of L' /\ next L = next L')`, + REPEAT GEN_TAC + THEN EQ_TAC + THENL[MESON_TAC[]; ALL_TAC] + THEN REWRITE_TAC[dart_of; next] + THEN STRIP_TAC + THEN SUBGOAL_THEN `tuple_loop (L:(A)loop) = tuple_loop (L':(A)loop)` ASSUME_TAC + THENL[SUBGOAL_THEN `tuple_loop (L:(A)loop) = FST (tuple_loop (L:(A)loop)), SND (tuple_loop (L:(A)loop))` ASSUME_TAC + THENL[MESON_TAC[PAIR]; ALL_TAC] + THEN SUBGOAL_THEN `tuple_loop (L':(A)loop) = FST (tuple_loop (L':(A)loop)), SND (tuple_loop (L':(A)loop))` ASSUME_TAC + THENL[MESON_TAC[PAIR]; ALL_TAC] + THEN REPLICATE_TAC 2 (POP_ASSUM SUBST1_TAC); ALL_TAC] + THEN ASM_REWRITE_TAC[PAIR_EQ] + THEN POP_ASSUM (fun th -> MESON_TAC[CONJUNCT1 loop_tybij; th]));; + +let lemma_permute_loop = prove(`!L:(A)loop. next L permutes dart_of L /\ back L permutes dart_of L`, + GEN_TAC THEN REWRITE_TAC[loop_lemma] + THEN REWRITE_TAC[back; GSYM next] + THEN MATCH_MP_TAC PERMUTES_INVERSE + THEN REWRITE_TAC[loop_lemma]);; + +let lemma_transitive_permutation = prove(`!(L:(A)loop) x:A. x belong L ==> dart_of L = orbit_map (next L) x`, + REPEAT GEN_TAC + THEN MP_TAC (SPEC `L:(A)loop` loop_lemma) + THEN REWRITE_TAC[belong] + THEN DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC(CONJUNCTS_THEN2 ASSUME_TAC (X_CHOOSE_THEN `y:A`(CONJUNCTS_THEN2 ASSUME_TAC(SUBST1_TAC o SYM))))) + THEN REPEAT STRIP_TAC + THEN MATCH_MP_TAC lemma_orbit_identity + THEN EXISTS_TAC `dart_of (L:(A)loop)` + THEN ASM_REWRITE_TAC[]);; + +let lemma_size = prove(`!(L:(A)loop). ~(dart_of L = {}) /\ 0 < size L /\ size L = SUC(top L)`, + REPEAT GEN_TAC + THEN MP_TAC (SPEC `L:(A)loop` loop_lemma) + THEN DISCH_THEN(CONJUNCTS_THEN2(LABEL_TAC "F1")(CONJUNCTS_THEN2 (LABEL_TAC "F2")(X_CHOOSE_THEN `y:A`(ASSUME_TAC o REWRITE_RULE[belong] o CONJUNCT1)))) + THEN SUBGOAL_THEN `~(dart_of (L:(A)loop) = {})` (fun th-> REWRITE_TAC[th]) + THENL[REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] + THEN EXISTS_TAC `y:A` THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `0 < size (L:(A)loop)` ASSUME_TAC + THENL[ REWRITE_TAC[size] + THEN USE_THEN "F1"(fun th -> (POP_ASSUM(fun th1-> (MP_TAC (MATCH_MP CARD_ATLEAST_1 (CONJ th th1)))))) + THEN DISCH_THEN (fun th -> REWRITE_TAC[REWRITE_RULE[LT1_NZ] th]) + THEN REWRITE_TAC[FUN_EQ_THM; I_THM]; ALL_TAC] + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[top; GSYM size] + THEN MATCH_MP_TAC LT_SUC_PRE + THEN ASM_REWRITE_TAC[]);; + +let lemma_order_next = prove(`!L:(A)loop. (next L) POWER (size L) = I`, + REPEAT GEN_TAC + THEN MP_TAC (SPEC `L:(A)loop` loop_lemma) + THEN DISCH_THEN(CONJUNCTS_THEN2(LABEL_TAC "F1")(LABEL_TAC "F2" o CONJUNCT1)) + THEN REWRITE_TAC[FUN_EQ_THM; I_THM; size] + THEN GEN_TAC + THEN ASM_CASES_TAC `~((x:A) IN dart_of (L:(A)loop))` + THENL[USE_THEN "F2" (fun th->(POP_ASSUM(fun th1->REWRITE_TAC[MATCH_MP power_permutation_outside_domain (CONJ th th1)]))); ALL_TAC] + THEN POP_ASSUM (ASSUME_TAC o REWRITE_RULE[GSYM belong]) + THEN MP_TAC (SPECL[`L:(A)loop`; `x:A`] lemma_transitive_permutation) + THEN POP_ASSUM(fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN SUBST1_TAC + THEN REMOVE_THEN "F1"(fun th -> (POP_ASSUM(fun th1-> (MESON_TAC[MATCH_MP lemma_cycle_orbit (CONJ th th1)])))));; + +let lemma_congruence_on_loop = prove(`!L:(A)loop x:A n:num m:num. x belong L /\ n <= top L /\ (next L POWER n) x = (next L POWER m) x + ==> ?q:num. m = q * (size L) + n`, + REWRITE_TAC[GSYM LT_SUC_LE; GSYM lemma_size; size] + THEN REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 MP_TAC (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN DISCH_THEN (SUBST_ALL_TAC o MATCH_MP lemma_transitive_permutation) + THEN MATCH_MP_TAC lemma_congruence_on_orbit + THEN EXISTS_TAC `dart_of (L:(A)loop)` THEN ASM_REWRITE_TAC[loop_lemma]);; + +let lemma_back_and_next_outside_loop = prove(`!L:(A)loop x:A. ~(x belong L) ==> back L x = x /\ next L x = x`, + REPEAT GEN_TAC + THEN REWRITE_TAC[belong] + THEN DISCH_THEN (LABEL_TAC "F1") + THEN ASSUME_TAC ((CONJUNCT1(CONJUNCT2(SPEC `L:(A)loop` loop_lemma)))) + THEN USE_THEN "F1"(fun th->(POP_ASSUM (MP_TAC o REWRITE_RULE[th] o SPEC `x:A` o MATCH_MP map_permutes_outside_domain))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN ASSUME_TAC ((CONJUNCT2(SPEC `L:(A)loop` lemma_permute_loop))) + THEN REMOVE_THEN "F1"(fun th->(POP_ASSUM (MP_TAC o REWRITE_RULE[th] o SPEC `x:A` o MATCH_MP map_permutes_outside_domain))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN SIMP_TAC[]);; + +let lemma_power_back_and_next_outside_loop = prove(`!L:(A)loop x:A m:num. ~(x belong L) ==> ((back L) POWER m) x = x /\ ((next L) POWER m) x = x`, + REPEAT GEN_TAC + THEN REWRITE_TAC[belong] + THEN DISCH_THEN (LABEL_TAC "F1") + THEN ASSUME_TAC ((CONJUNCT1(CONJUNCT2(SPEC `L:(A)loop` loop_lemma)))) + THEN USE_THEN "F1"(fun th1->(POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP power_permutation_outside_domain (CONJ th th1)]))) + THEN ASSUME_TAC ((CONJUNCT2(SPEC `L:(A)loop` lemma_permute_loop))) + THEN REMOVE_THEN "F1"(fun th1->(POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP power_permutation_outside_domain (CONJ th th1)]))));; + +let lemma_inverse_on_loop = prove(`!L:(A)loop. next L = inverse (back L) /\ back L = inverse (next L)`, + STRIP_TAC + THEN REWRITE_TAC[ back; GSYM next] + THEN CONV_TAC SYM_CONV + THEN ASSUME_TAC ((CONJUNCT1(CONJUNCT2(SPEC `L:(A)loop` loop_lemma)))) + THEN POP_ASSUM(fun th-> REWRITE_TAC[MATCH_MP PERMUTES_INVERSE_INVERSE th]));; + +let lemma_inverse_evaluation = prove(`!L:(A)loop x:A. back L (next L x) = x /\ next L (back L x) = x`, + REPEAT GEN_TAC + THEN REWRITE_TAC[CONJUNCT2(SPEC `L:(A)loop` lemma_inverse_on_loop)] + THEN REWRITE_TAC[MATCH_MP PERMUTES_INVERSES (CONJUNCT1(SPEC `L:(A)loop` lemma_permute_loop))]);; + +let lemma_second_inverse_on_loop = prove(`!L:(A)loop m:num. next L POWER m = inverse ((back L) POWER m) /\ back L POWER m = inverse ((next L) POWER m)`, + REPEAT GEN_TAC + THEN (MP_TAC(CONJUNCT1(SPEC `L:(A)loop`lemma_permute_loop))) + THEN DISCH_THEN (MP_TAC o SPEC `m:num` o MATCH_MP lemma_power_inverse) + THEN REWRITE_TAC[GSYM lemma_inverse_on_loop] + THEN MESON_TAC[]);; + +let lemma_second_inverse_evaluation = prove(`!L:(A)loop (x:A) (m:num).(next L POWER m) ((back L POWER m) x) = x /\ (back L POWER m) ((next L POWER m) x) = x`, + REPEAT GEN_TAC + THEN LABEL_TAC "F1" (CONJUNCT1(SPEC `L:(A)loop` lemma_permute_loop)) + THEN REWRITE_TAC[CONJUNCT2(SPECL[`L:(A)loop`; `m:num`] lemma_second_inverse_on_loop)] + THEN POP_ASSUM (MP_TAC o SPEC `m:num` o MATCH_MP power_permutation) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP PERMUTES_INVERSES th]));; + +let lemma_next_power_representation = prove(`!L:(A)loop (x:A) (y:A). x belong L /\ y belong L ==> ?k:num. k <= top L /\ y = ((next L) POWER k) x`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC (MP_TAC o REWRITE_RULE[belong])) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP lemma_transitive_permutation th]) + THEN REWRITE_TAC[GSYM LT_SUC_LE] + THEN STRIP_ASSUME_TAC(CONJUNCT2(SPEC `L:(A)loop` lemma_size)) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN ASSUME_TAC (SPEC `L:(A)loop` lemma_order_next) + THEN POP_ASSUM (fun th-> MP_TAC (REWRITE_RULE[I_THM](AP_THM th `x:A`))) + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[LT_NZ]) + THEN DISCH_THEN(fun th-> DISCH_THEN(fun th1-> REWRITE_TAC[MATCH_MP orbit_cyclic (CONJ th th1)])) + THEN REWRITE_TAC[IN_ELIM_THM]);; + +let lemma_loop_index = new_specification["index"] (REWRITE_RULE[GSYM RIGHT_EXISTS_IMP_THM; SKOLEM_THM] lemma_next_power_representation);; + +let lemma_power_next_in_loop = prove(`!L:(A)loop x:A k:num. x belong L ==> ((next L POWER k) x) belong L`, + REPEAT GEN_TAC + THEN REWRITE_TAC[belong] + THEN STRIP_TAC + THEN MP_TAC(SPECL[`k:num`; `x:A`] (MATCH_MP iterate_orbit (CONJUNCT1(SPEC `L:(A)loop` lemma_permute_loop)))) + THEN ASM_REWRITE_TAC[]);; + +let lemma_belong_loop = prove(`!L:(A)loop x:A. x belong L ==> (!y:A. y belong L <=> ?i:num. i <= top L /\ y = (next L POWER i) x)`, + MESON_TAC[lemma_power_next_in_loop; lemma_next_power_representation]);; + +let lemma_next_in_loop = prove(`!L:(A)loop x:A. x belong L ==> next L x belong L`, + REPEAT GEN_TAC + THEN DISCH_THEN(fun th-> REWRITE_TAC[REWRITE_RULE[POWER_1](SPEC `1` (MATCH_MP lemma_power_next_in_loop th))]));; + +let lemma_power_back_in_loop = prove(`!L:(A)loop x:A k:num. x belong L ==> ((back L POWER k) x) belong L`, + REPEAT GEN_TAC + THEN REWRITE_TAC[belong] + THEN STRIP_TAC + THEN MP_TAC(SPECL[`k:num`; `x:A`] (MATCH_MP iterate_orbit (CONJUNCT2(SPEC `L:(A)loop` lemma_permute_loop)))) + THEN ASM_REWRITE_TAC[]);; + +let lemma_back_in_loop = prove(`!L:(A)loop x:A. x belong L ==> back L x belong L`, + REPEAT GEN_TAC + THEN DISCH_THEN(fun th-> REWRITE_TAC[REWRITE_RULE[POWER_1](SPEC `1` (MATCH_MP lemma_power_back_in_loop th))]));; + +let determine_loop_index = prove(`!L:(A)loop x:A y:A k:num. x belong L /\ k <= top L /\ y = (next L POWER k) x ==> index L x y = k`, + REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN USE_THEN "F1" (MP_TAC o SPEC `k:num` o MATCH_MP lemma_power_next_in_loop) + THEN USE_THEN "F3" (SUBST1_TAC o SYM) + THEN USE_THEN "F1" (fun th-> DISCH_THEN (fun th1-> (MP_TAC (MATCH_MP lemma_loop_index (CONJ th th1))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5")) + THEN ABBREV_TAC `n = index (L:(A)loop) (x:A) (y:A)` + THEN MP_TAC (CONJUNCT1 (REWRITE_RULE[CONJ_ASSOC] (SPEC `L:(A)loop` loop_lemma))) + THEN DISCH_THEN (MP_TAC o SPECL[`x:A`; `top (L:(A)loop)`] o MATCH_MP lemma_segment_orbit) + THEN USE_THEN "F1"(fun th->REWRITE_TAC[SYM(MATCH_MP lemma_transitive_permutation th)]) + THEN REWRITE_TAC[GSYM size; lemma_size; LT_PLUS] + THEN DISCH_THEN (MP_TAC o SPECL[`n:num`; `k:num`] o REWRITE_RULE[lemma_inj_orbit_via_list; lemma_inj_list2; power_list]) + THEN USE_THEN "F5" (fun th->USE_THEN "F3" (fun th1-> USE_THEN "F4" (fun th2-> USE_THEN "F2" (fun th3-> REWRITE_TAC[SYM th; SYM th1; th2; th3])))));; + +let support_loop_sub_dart = prove(`!(H:(A)hypermap) (L:(A)loop) (x:A). is_loop H L /\ x IN dart H /\ x belong L ==> dart_of L SUBSET dart H`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP lemma_transitive_permutation th]) + THEN SUBGOAL_THEN `!j:num. ((next (L:(A)loop)) POWER j) (x:A) IN dart (H:(A)hypermap)` ASSUME_TAC + THENL[INDUCT_TAC THENL[ASM_REWRITE_TAC[POWER_0; I_THM] THEN REWRITE_TAC[COM_POWER; o_THM]; ALL_TAC] + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN REMOVE_THEN "F3" (fun th -> ASSUME_TAC(SPEC `j:num` (MATCH_MP lemma_power_next_in_loop th))) + THEN ABBREV_TAC `y = (next (L:(A)loop) POWER (j:num)) (x:A)` + THEN REMOVE_THEN "F1" (MP_TAC o SPEC `y:A` o REWRITE_RULE[is_loop]) + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[one_step_contour] + THEN STRIP_TAC + THENL[POP_ASSUM SUBST1_TAC + THEN UNDISCH_THEN `y:A IN dart (H:(A)hypermap)` (fun th -> REWRITE_TAC[MATCH_MP lemma_dart_invariant th]); ALL_TAC] + THEN POP_ASSUM SUBST1_TAC + THEN UNDISCH_THEN `y:A IN dart (H:(A)hypermap)` (fun th -> REWRITE_TAC[MATCH_MP lemma_dart_inveriant_under_inverse_maps th]); ALL_TAC] + THEN REWRITE_TAC[orbit_map; SUBSET; IN_ELIM_THM] + THEN GEN_TAC + THEN DISCH_THEN (X_CHOOSE_THEN `m:num` (SUBST1_TAC o CONJUNCT2)) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]));; + +let lemma_loop_contour = prove(`!(H:(A)hypermap) (L:(A)loop) (x:A) n:num. is_loop H L /\ x belong L ==> is_contour H (loop_path L x) n`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN REWRITE_TAC[lemma_def_contour] + THEN REPEAT STRIP_TAC + THEN REWRITE_TAC[loop_path] + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN USE_THEN "F2" (MP_TAC o SPEC `i:num` o MATCH_MP lemma_power_next_in_loop) + THEN DISCH_THEN (fun th-> USE_THEN "F1"(MP_TAC o REWRITE_RULE[th] o SPEC `(next (L:(A)loop) POWER (i:num)) (x:A)` o REWRITE_RULE[is_loop])) + THEN SIMP_TAC[]);; + +let lemma_inj_loop_path = prove(`!L:(A)loop (x:A). x belong L ==> (!n:num. n <= top L <=> is_inj_list (loop_path L x) n)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN REWRITE_TAC[lemma_loop_path_via_list; GSYM LT_SUC_LE; GSYM lemma_size; GSYM lemma_def_inj_orbit; size; GSYM lemma_inj_orbit_via_list] + THEN GEN_TAC + THEN EQ_TAC + THENL[MP_TAC(CONJUNCT1(REWRITE_RULE[CONJ_ASSOC] (SPEC `L:(A)loop` loop_lemma))) + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_transitive_permutation th]) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_segment_orbit th]); ALL_TAC] + THEN ASM_CASES_TAC `n:num < CARD (dart_of (L:(A)loop))` + THENL[POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN DISCH_THEN (MP_TAC o SPECL[] o SPECL[`0`; `CARD (dart_of (L:(A)loop))`] o REWRITE_RULE[lemma_inj_orbit]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[LE_0; REWRITE_RULE[NOT_LT] th; POWER_0; I_THM]) + THEN MP_TAC(CONJUNCT1(REWRITE_RULE[CONJ_ASSOC] (SPEC `L:(A)loop` loop_lemma))) + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_transitive_permutation th]) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_cycle_orbit th]) + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[GSYM(MATCH_MP lemma_transitive_permutation th); GSYM size]) + THEN MP_TAC (CONJUNCT1(CONJUNCT2(SPEC `L:(A)loop` lemma_size))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[GSYM (REWRITE_RULE[LT_NZ] th)]));; + +let let_order_for_loop = prove(`!(H:(A)hypermap) (L:(A)loop) (x:A). is_loop H L /\ x belong L + ==> is_inj_contour H (loop_path L x) (top L) /\ one_step_contour H (loop_path L x (top L)) (loop_path L x 0)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN STRIP_TAC + THENL[REWRITE_TAC[lemma_inj_contour_via_list] + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1 -> REWRITE_TAC[MATCH_MP lemma_loop_contour (CONJ th th1)])) + THEN USE_THEN "F2" (fun th-> REWRITE_TAC[GSYM(MATCH_MP lemma_inj_loop_path th); LE_REFL]); ALL_TAC] + THEN REWRITE_TAC[loop_path; POWER_0; I_THM] + THEN USE_THEN "F1"(MP_TAC o SPEC `(next (L:(A)loop) POWER top L) x` o REWRITE_RULE[is_loop]) + THEN REWRITE_TAC[iterate_map_valuation; GSYM lemma_size; lemma_order_next; I_THM] + THEN USE_THEN "F2" (MP_TAC o SPEC `top (L:(A)loop)` o MATCH_MP lemma_power_next_in_loop) + THEN SIMP_TAC[]);; + +let lemma_list_next = prove(`!p:num->A n:num. ?h:A->A. (!x:A. (~(in_list p n x) ==> h x = x) /\ (in_list p n x ==> ?j:num. j <= n /\ x = p j /\ h x = p (SUC j MOD SUC n)))`, + REPEAT GEN_TAC + THEN REWRITE_TAC[GSYM SKOLEM_THM] + THEN GEN_TAC + THEN ASM_CASES_TAC `~(in_list (p:num->A) (n:num) (x:A))` + THENL[EXISTS_TAC `x:A` THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM (ASSUME_TAC o REWRITE_RULE[]) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[lemma_in_list]) + THEN STRIP_TAC THEN ONCE_REWRITE_TAC[SWAP_EXISTS_THM] + THEN EXISTS_TAC `j:num` THEN EXISTS_TAC `(p:num->A) (SUC j MOD SUC n)` + THEN ASM_REWRITE_TAC[]);; + +let lemma_samsara = new_specification["samsara"] (REWRITE_RULE[SKOLEM_THM] lemma_list_next);; + +let samsara_formula = prove(`!p:num->A n:num. is_inj_list p n ==> (!j:num. j <= n ==> samsara p n (p j) = p (SUC j MOD SUC n))`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN GEN_TAC THEN DISCH_THEN (LABEL_TAC "F2") + THEN USE_THEN "F2" (MP_TAC o SPEC `p:num->A` o MATCH_MP lemma_element_in_list) + THEN DISCH_THEN (fun th-> MP_TAC(MATCH_MP (CONJUNCT2 (SPECL[`p:num->A`; `n:num`; `(p:num->A) j`] lemma_samsara)) th)) + THEN DISCH_THEN (X_CHOOSE_THEN `i:num` (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F3") SUBST1_TAC))) + THEN AP_TERM_TAC + THEN REMOVE_THEN "F1" (MP_TAC o SPECL[`i:num`; `j:num`] o REWRITE_RULE[lemma_inj_list2]) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC THEN SIMP_TAC[]);; + +let evaluation_samsara = prove(`!p:num->A n:num. is_inj_list p n + ==> samsara p n (p n) = p 0 /\ !j:num. j < n ==> samsara p n (p j) = p (SUC j)`, + REPEAT GEN_TAC + THEN DISCH_THEN (ASSUME_TAC o MATCH_MP samsara_formula) + THEN STRIP_TAC + THENL[POP_ASSUM (MP_TAC o REWRITE_RULE[LE_REFL] o SPEC `n:num`) + THEN DISCH_THEN SUBST1_TAC THEN AP_TERM_TAC + THEN MP_TAC (SPEC `1` (MATCH_MP MOD_MULT (SPEC `n:num` NON_ZERO))) + THEN REWRITE_TAC [ARITH_RULE `(SUC n) * 1 = SUC n`]; ALL_TAC] + THEN REPEAT STRIP_TAC + THEN FIRST_X_ASSUM (MP_TAC o SPEC `j:num` o check (is_forall o concl)) + THEN POP_ASSUM(fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th] THEN ASSUME_TAC th) + THEN DISCH_THEN SUBST1_TAC THEN AP_TERM_TAC + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP MOD_LT (ONCE_REWRITE_RULE[GSYM LT_SUC] th)]));; + +let lemma_permutes_via_surjetive = prove(`!s:A->bool p:A->A. + FINITE s /\ (!x:A. ~(x IN s) ==> p x = x) /\ (!x:A. x IN s ==> p x IN s) /\ (!y:A. y IN s ==> ?x:A. p x = y) ==> p permutes s`, +REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "G4")))) + THEN SUBGOAL_THEN `!y:A. y IN s:A->bool ==> (?x:A. x IN s /\ p x = y)` (LABEL_TAC "F4") + THENL[GEN_TAC THEN DISCH_THEN (LABEL_TAC "G1") + THEN REMOVE_THEN "G4" (fun th-> (USE_THEN "G1" (MP_TAC o MATCH_MP th))) + THEN DISCH_THEN (X_CHOOSE_THEN `t:A` (SUBST_ALL_TAC o SYM)) + THEN EXISTS_TAC `t:A` + THEN SIMP_TAC[] + THEN ASM_CASES_TAC `~(t:A IN s:A->bool)` + THENL[USE_THEN "F2" (fun th-> (POP_ASSUM (SUBST_ALL_TAC o MATCH_MP th))) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (fun th-> REWRITE_TAC[REWRITE_RULE[] th]); ALL_TAC] + THEN REWRITE_TAC[permutes] + THEN USE_THEN "F2" (fun th-> REWRITE_TAC[th]) + THEN GEN_TAC + THEN REWRITE_TAC[EXISTS_UNIQUE_THM] + THEN ASM_CASES_TAC `~(y:A IN s:A->bool)` + THENL[STRIP_TAC + THENL[EXISTS_TAC `y:A` THEN POP_ASSUM MP_TAC + THEN USE_THEN "F2" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F5") + THEN REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7")) + THEN ASM_CASES_TAC `x:A IN s:A->bool` + THENL[USE_THEN "F3"(fun th-> (POP_ASSUM (MP_TAC o MATCH_MP th))) + THEN REMOVE_THEN "F6" (SUBST1_TAC) + THEN REMOVE_THEN "F5" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN USE_THEN "F2"(fun th-> (POP_ASSUM (MP_TAC o MATCH_MP th))) + THEN REMOVE_THEN "F6" SUBST1_TAC + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN ASM_CASES_TAC `x':A IN s:A->bool` + THENL[USE_THEN "F3"(fun th-> (POP_ASSUM (MP_TAC o MATCH_MP th))) + THEN REMOVE_THEN "F7" (SUBST1_TAC) + THEN REMOVE_THEN "F5" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN USE_THEN "F2"(fun th-> (POP_ASSUM (MP_TAC o MATCH_MP th))) + THEN REMOVE_THEN "F7" SUBST1_TAC + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F8" o REWRITE_RULE[]) + THEN STRIP_TAC + THENL[USE_THEN "F4"(fun th-> (POP_ASSUM (MP_TAC o MATCH_MP th))) + THEN STRIP_TAC THEN EXISTS_TAC `x:A` + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F9") (LABEL_TAC "F10")) + THEN ASM_CASES_TAC `~(x:A IN s:A->bool)` + THENL[POP_ASSUM (LABEL_TAC "F11") + THEN USE_THEN "F2"(fun th-> (USE_THEN "F11" (MP_TAC o MATCH_MP th))) + THEN REMOVE_THEN "F9" SUBST1_TAC + THEN DISCH_THEN (fun th-> (POP_ASSUM (MP_TAC o REWRITE_RULE[SYM th]))) + THEN REMOVE_THEN "F8" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F12" o REWRITE_RULE[]) + THEN ASM_CASES_TAC `~(x':A IN s:A->bool)` + THENL[POP_ASSUM (LABEL_TAC "F14") + THEN USE_THEN "F2"(fun th-> (USE_THEN "F14" (MP_TAC o MATCH_MP th))) + THEN REMOVE_THEN "F10" SUBST1_TAC + THEN DISCH_THEN (fun th-> (POP_ASSUM (MP_TAC o REWRITE_RULE[SYM th]))) + THEN REMOVE_THEN "F8" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN REMOVE_THEN "F9" MP_TAC + THEN REMOVE_THEN "F10" (SUBST1_TAC o SYM) + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[]) + THEN POP_ASSUM (MP_TAC) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN SUBGOAL_THEN `IMAGE (p:A->A) (s:A->bool) SUBSET s` MP_TAC + THENL[REWRITE_TAC[IMAGE; SUBSET] + THEN GEN_TAC + THEN REWRITE_TAC[IN_ELIM_THM] + THEN DISCH_THEN (X_CHOOSE_THEN `t:A` (CONJUNCTS_THEN2 ASSUME_TAC SUBST1_TAC)) + THEN USE_THEN "F3"(fun th-> (POP_ASSUM (MP_TAC o MATCH_MP th))) + THEN SIMP_TAC[]; ALL_TAC] + THEN USE_THEN "F1" (fun th-> (DISCH_THEN (fun th1-> (MP_TAC (MATCH_MP SURJECTIVE_IFF_INJECTIVE (CONJ th th1)))))) + THEN USE_THEN "F4" (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (MP_TAC o SPECL[`x:A`; `x':A`]) + THEN SIMP_TAC[]);; + +let lemma_back_index = prove(`!n:num i:num. 0 < i /\ i <= n ==> (i + n) MOD (SUC n) = PRE i`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN USE_THEN "F1" (fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [MATCH_MP LT_SUC_PRE th]) + THEN REWRITE_TAC[ADD] THEN REWRITE_TAC[GSYM ADD_SUC] + THEN ONCE_REWRITE_TAC[ADD_SYM] + THEN REWRITE_TAC[REWRITE_RULE[MULT_CLAUSES] (SPECL[`1`; `SUC n`; `PRE i`] MOD_MULT_ADD)] + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP MOD_LT (MATCH_MP (ARITH_RULE `i:num <= n:num ==> PRE i < SUC n`) th)]));; + +let lemma_suc_mod = prove(`!m:num n:num. ~(n = 0) ==> SUC (m MOD n) MOD n = SUC m MOD n`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN USE_THEN "F1" (MP_TAC o SPEC `m:num` o MATCH_MP DIVMOD_EXIST) + THEN DISCH_THEN (X_CHOOSE_THEN `q:num` (X_CHOOSE_THEN `r:num` (CONJUNCTS_THEN2 (LABEL_TAC "F2") ASSUME_TAC))) + THEN USE_THEN "F2" (fun th-> (POP_ASSUM(fun th1-> SUBST_ALL_TAC (CONJUNCT2 (MATCH_MP DIVMOD_UNIQ (CONJ th th1)))))) + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[GSYM ADD_SUC; MOD_MULT_ADD]);; + +let lemma_from_index = prove(`!n:num j:num. j <= n ==> SUC ((j + n) MOD SUC n) MOD SUC n = j`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN REWRITE_TAC[MATCH_MP lemma_suc_mod (SPEC `k:num` NON_ZERO); GSYM ADD_SUC] + THEN ONCE_REWRITE_TAC[ADD_SYM] + THEN REWRITE_TAC[REWRITE_RULE[MULT_CLAUSES] (SPECL[`1`; `SUC k`; `i:num`] MOD_MULT_ADD)] + THEN POP_ASSUM(fun th-> REWRITE_TAC[MATCH_MP MOD_LT (REWRITE_RULE[GSYM LT_SUC_LE] th)]));; + +let lemma_from_index2 = prove(`!n:num i:num. i <= n ==> (((SUC i MOD SUC n) + n) MOD SUC n) = i`, + REPEAT STRIP_TAC + THEN GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [GSYM(MATCH_MP MOD_LT (SPEC `k:num` LT_PLUS))] + THEN REWRITE_TAC[MATCH_MP MOD_ADD_MOD (SPEC `k:num` NON_ZERO)] + THEN REWRITE_TAC[ADD] + THEN REWRITE_TAC[GSYM ADD_SUC] + THEN ONCE_REWRITE_TAC[ADD_SYM] + THEN REWRITE_TAC[(REWRITE_RULE[MULT_CLAUSES] (SPECL[`1`; `SUC k`; `i:num`] MOD_MULT_ADD))] + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP MOD_LT (REWRITE_RULE[GSYM LT_SUC_LE] th)]));; + +let lemma_samsara_permute = prove(`!p:num->A n:num. is_inj_list p n ==> samsara p n permutes support_list p n`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN MATCH_MP_TAC lemma_permutes_via_surjetive + THEN REWRITE_TAC[lemma_finite_list; GSYM in_list; lemma_samsara] + THEN STRIP_TAC + THENL[GEN_TAC + THEN REWRITE_TAC[lemma_in_list] + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (CONJUNCTS_THEN2 (LABEL_TAC "F2") (SUBST1_TAC))) + THEN EXISTS_TAC `SUC j MOD SUC n` + THEN REWRITE_TAC[LE_MOD_SUC] + THEN USE_THEN "F1" (MP_TAC o SPEC `j:num` o MATCH_MP samsara_formula) + THEN POP_ASSUM(fun th->REWRITE_TAC[th]); ALL_TAC] + THEN GEN_TAC THEN REWRITE_TAC[lemma_in_list] + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (CONJUNCTS_THEN2 (LABEL_TAC "F2") (SUBST1_TAC))) + THEN EXISTS_TAC `(p:num->A) (((j:num) + (n:num)) MOD SUC n)` + THEN USE_THEN "F1" (MP_TAC o SPEC `((j:num) + (n:num)) MOD SUC n` o MATCH_MP samsara_formula) + THEN REWRITE_TAC[LE_MOD_SUC] + THEN DISCH_THEN SUBST1_TAC + THEN AP_TERM_TAC + THEN POP_ASSUM(fun th-> REWRITE_TAC[MATCH_MP lemma_from_index th]));; + +let lemma_samsara_power = prove(`!p:num->A n:num. is_inj_list p n + ==> ((samsara p n) POWER (SUC n)) (p 0) = p 0 /\ (!j:num. j <= n ==> ((samsara p n) POWER j) (p 0) = p j)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN SUBGOAL_THEN `!j:num. j <= n ==> ((samsara (p:num->A) n) POWER j) (p 0) = p j` ASSUME_TAC + THENL[INDUCT_TAC THENL[REWRITE_TAC[LE_0; POWER_0; I_THM]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F2") + THEN DISCH_THEN (LABEL_TAC "F3") + THEN USE_THEN "F3" (fun th -> (ASSUME_TAC (MATCH_MP LT_IMP_LE (REWRITE_RULE[LE_SUC_LT] th)))) + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN POP_ASSUM (fun th-> REMOVE_THEN "F2" (fun th1 -> REWRITE_TAC[REWRITE_RULE[th] th1])) + THEN USE_THEN "F1" (MP_TAC o SPEC `j:num` o CONJUNCT2 o MATCH_MP evaluation_samsara) + THEN POP_ASSUM (fun th -> REWRITE_TAC[REWRITE_RULE[LE_SUC_LT] th]); ALL_TAC] + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN POP_ASSUM (fun th -> REWRITE_TAC[REWRITE_RULE[LE_REFL] (SPEC `n:num` th)]) + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[MATCH_MP evaluation_samsara th]));; + +let lemma_generate_loop = prove(`!p:num->A n:num. is_inj_list p n + ==> dart_of (loop(support_list p n, samsara p n)) = support_list p n /\ next (loop(support_list p n, samsara p n)) = samsara p n`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN MATCH_MP_TAC lemma_loop_representation + THEN EXISTS_TAC `(p:num->A) 0` + THEN REWRITE_TAC[lemma_finite_list] + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[MATCH_MP lemma_samsara_permute th]) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT1 o MATCH_MP lemma_samsara_power) + THEN MP_TAC (SPEC `n:num` NON_ZERO) + THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (fun th -> REWRITE_TAC[MATCH_MP orbit_cyclic th]) + THEN REWRITE_TAC[LT_SUC_LE; support_list] + THEN USE_THEN "F1" (MP_TAC o CONJUNCT2 o MATCH_MP lemma_samsara_power) + THEN SET_TAC[lemma_two_series_eq]);; + +let lemma_make_contour_loop = prove(`!(H:(A)hypermap) (p:num->A) (n:num). is_inj_contour H p n /\ one_step_contour H (p n) (p 0) + ==> is_loop H (loop(support_list p n, samsara p n))`, + REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_inj_contour_via_list] + THEN DISCH_THEN (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) (LABEL_TAC "F3")) + THEN REWRITE_TAC[is_loop] + THEN GEN_TAC + THEN REWRITE_TAC[belong] + THEN USE_THEN "F2" (fun th-> REWRITE_TAC[MATCH_MP lemma_generate_loop th]) + THEN REWRITE_TAC[GSYM in_list; lemma_in_list] + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (CONJUNCTS_THEN2 ASSUME_TAC SUBST1_TAC)) + THEN ASM_CASES_TAC `j:num = n` + THENL[POP_ASSUM SUBST1_TAC + THEN USE_THEN "F2"(fun th-> REWRITE_TAC[MATCH_MP evaluation_samsara th]) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM(fun th-> (POP_ASSUM(fun th1->(LABEL_TAC "F4" (REWRITE_RULE[GSYM LT_LE] (CONJ th1 th)))))) + THEN USE_THEN "F4"(fun th1->(USE_THEN "F2" (fun th-> REWRITE_TAC[MATCH_MP (CONJUNCT2(MATCH_MP evaluation_samsara th)) th1]))) + THEN REMOVE_THEN "F1" (MP_TAC o SPEC `j:num` o REWRITE_RULE[lemma_def_contour]) + THEN ASM_REWRITE_TAC[]);; + +let lemma_number_darts_of_inj_contour = prove(`!(H:(A)hypermap) (p:num->A) (n:num). is_inj_contour H p n ==> CARD (support_list p n) = SUC n`, + REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_def_inj_contour; support_list] + THEN CONV_TAC ((LAND_CONV o ONCE_DEPTH_CONV) SYM_CONV) + THEN REWRITE_TAC[GSYM LT_SUC_LE] + THEN DISCH_THEN (fun th -> REWRITE_TAC[MATCH_MP CARD_FINITE_SERIES_EQ (CONJUNCT2 th)]));; + +let lemma_inj_contour_belong_darts = prove(`!(H:(A)hypermap) (p:num->A) (n:num). 0 < n /\ is_inj_contour H p n ==> support_list p n SUBSET dart H`, + REPEAT GEN_TAC + THEN DISCH_THEN (fun th -> (MP_TAC (MATCH_MP lemma_first_dart_on_inj_contour th) THEN ASSUME_TAC (CONJUNCT2 th))) + THEN POP_ASSUM (MP_TAC o CONJUNCT1 o REWRITE_RULE[lemma_def_inj_contour]) + THEN REWRITE_TAC[IMP_IMP; CONJ_SYM] + THEN DISCH_THEN (fun th -> REWRITE_TAC[MATCH_MP lemma_darts_in_contour th; support_list]));; + +let lemma_dart_loop_via_path = prove(`!L:(A)loop x:A. x belong L ==> dart_of L = support_list (loop_path L x) (top L)`, + REPEAT STRIP_TAC + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP lemma_transitive_permutation th]) + THEN MP_TAC (AP_THM (SPEC `L:(A)loop` lemma_order_next) `x:A`) + THEN REWRITE_TAC[I_THM] + THEN MP_TAC(CONJUNCT1(CONJUNCT2(SPEC `L:(A)loop` lemma_size))) + THEN REWRITE_TAC[LT_NZ; IMP_IMP; support_list; loop_path] + THEN DISCH_THEN (MP_TAC o MATCH_MP orbit_cyclic) + THEN REWRITE_TAC[lemma_size; GSYM LT_SUC_LE]);; + +let lemma_belong = prove(`!L:(A)loop x:A. x belong L ==> (!y:A. y belong L <=> in_list (loop_path L x) (top L) y)`, + REPEAT STRIP_TAC + THEN REWRITE_TAC[belong] + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP lemma_dart_loop_via_path th]) + THEN REWRITE_TAC[in_list]);; + +(*******************************************************************************************************************************) + +let lemmaILTXRQD =prove(`!(H:(A)hypermap) (L:(A)loop) (p:num->A) (k:num).((is_loop H L) /\ (is_inj_contour H p k) /\ (2 <= k) /\ ((p 0) belong L) /\ (p k) belong L /\ (!i:num. 0 < i /\ i < k ==> ~((p i) belong L)) /\ (!q:num->A m:num. ~(is_Moebius_contour H q m))) ==> +(p 1 = inverse (node_map H) (p 0) ==> ~(p k = face_map H (p (PRE k)))) /\ (p 1 = face_map H (p 0) ==> ~(p k = inverse (node_map H) (p (PRE k))))`, + REPEAT GEN_TAC + THEN DISCH_THEN(CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7"))))))) + THEN USE_THEN "F2" MP_TAC + THEN REWRITE_TAC[lemma_def_inj_contour] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "FC") (LABEL_TAC "F8")) + THEN USE_THEN "F8" (MP_TAC o SPECL[`k:num`; `0`]) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `2 <= k:num ==> 0 < k`) th; LE_REFL]) + THEN DISCH_THEN (LABEL_TAC "F9") + THEN SUBGOAL_THEN `1 <= top (L:(A)loop)` (LABEL_TAC "F10") + THENL[ ONCE_REWRITE_TAC[GSYM LE_SUC] + THEN REWRITE_TAC[GSYM TWO] + THEN REWRITE_TAC[GSYM lemma_size; size] + THEN MATCH_MP_TAC CARD_ATLEAST_2 + THEN EXISTS_TAC `(p:num->A) 0` + THEN EXISTS_TAC `(p:num->A) (k:num)` + THEN REWRITE_TAC[GSYM belong] + THEN ASM_REWRITE_TAC[loop_lemma]; ALL_TAC] + THEN USE_THEN "F3" (MP_TAC o MATCH_MP (ARITH_RULE `2 <= k:num ==> 0 < PRE k /\ 0 < k /\ PRE k < k`)) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "K1") (CONJUNCTS_THEN2 (LABEL_TAC "K2") (LABEL_TAC "K3"))) + THEN STRIP_TAC + THENL[REWRITE_TAC[GSYM node_map_inverse_representation] + THEN DISCH_THEN (LABEL_TAC "G10") + THEN DISCH_THEN (LABEL_TAC "G12") + THEN REMOVE_THEN "F7" MP_TAC + THEN REWRITE_TAC[NOT_FORALL_THM] + THEN REMOVE_THEN "F4" MP_TAC + THEN USE_THEN "F5" (fun th-> REWRITE_TAC[MATCH_MP lemma_belong th]) + THEN DISCH_THEN (LABEL_TAC "G4") + THEN REMOVE_THEN "F6" MP_TAC + THEN USE_THEN "F5" (fun th-> REWRITE_TAC[MATCH_MP lemma_belong th]) + THEN DISCH_THEN (LABEL_TAC "G6") + THEN MP_TAC (SPECL[`L:(A)loop`; `(p:num->A) (k:num)`; `0`] loop_path) + THEN REWRITE_TAC[POWER_0; I_THM] + THEN DISCH_THEN (LABEL_TAC "G15") + THEN USE_THEN "F1" (fun th-> (REMOVE_THEN "F5" (fun th1-> (MP_TAC (MATCH_MP let_order_for_loop (CONJ th th1)))))) + THEN ABBREV_TAC `ploop = loop_path (L:(A)loop) ((p:num->A) (k:num))` + THEN ABBREV_TAC `n = top (L:(A)loop)` + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G16") (MP_TAC)) + THEN REWRITE_TAC[one_step_contour] + THEN USE_THEN "G15" SUBST1_TAC + THEN STRIP_TAC + THENL[POP_ASSUM MP_TAC + THEN USE_THEN "G12" SUBST1_TAC + THEN REWRITE_TAC[face_map_injective] + THEN DISCH_THEN (fun th-> (ASSUME_TAC (MATCH_MP lemma_in_list2 (CONJ (SPEC `n:num` LE_REFL) th)))) + THEN USE_THEN "G6" (MP_TAC o SPEC `PRE k`) + THEN USE_THEN "K1" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "K3" (fun th -> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[GSYM node_map_inverse_representation] + THEN DISCH_THEN (LABEL_TAC "G17") + THEN USE_THEN "K2" MP_TAC + THEN REWRITE_TAC[LT0_LE1] + THEN USE_THEN "F2" (fun th1 -> (DISCH_THEN (fun th2 -> (MP_TAC (MATCH_MP lemma_shift_inj_contour (CONJ th1 th2)))))) + THEN USE_THEN "K2" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `0 < k:num ==> k-1 = PRE k`) th]) + THEN DISCH_THEN (LABEL_TAC "G18") + THEN USE_THEN "K2" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `0 < k:num ==> k - 1 = PRE k`) th]) + THEN MP_TAC(SPECL[`p:num->A`; `1`; `PRE k`] lemma_shift_path_evaluation) + THEN ONCE_REWRITE_TAC[GSYM ADD_SYM] + THEN USE_THEN "K2" (fun th -> REWRITE_TAC[SYM(MATCH_MP LT_PRE th)]) + THEN DISCH_THEN (fun th -> LABEL_TAC "G19" th THEN MP_TAC th) + THEN USE_THEN "G15" (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "G20") + THEN SUBGOAL_THEN `!j:num. 0 < j /\ j <= n:num ==> (!i:num. i <= PRE k ==> ~((ploop:num->A) j = shift_path (p:num->A) 1 i))` ASSUME_TAC + THENL[REWRITE_TAC[shift_path] + THEN ONCE_REWRITE_TAC[ADD_SYM] + THEN GEN_TAC + THEN REPLICATE_TAC 2 STRIP_TAC + THEN ASM_CASES_TAC `i:num = PRE k` + THENL[POP_ASSUM SUBST1_TAC + THEN USE_THEN "K2" (fun th -> REWRITE_TAC[SYM(MATCH_MP LT_PRE th); LE_REFL]) + THEN USE_THEN "G15" (SUBST1_TAC o SYM) + THEN USE_THEN "G16" MP_TAC + THEN REWRITE_TAC[lemma_def_inj_contour] + THEN DISCH_THEN (MP_TAC o SPECL[`j:num`; `0`] o CONJUNCT2) + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[th])) + THEN MESON_TAC[]; ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[IMP_IMP] + THEN ONCE_REWRITE_TAC[CONJ_SYM] + THEN REWRITE_TAC[GSYM LT_LE] + THEN REWRITE_TAC[GSYM ADD1] + THEN ONCE_REWRITE_TAC[GSYM LT_SUC] + THEN USE_THEN "K2" (fun th -> REWRITE_TAC[SYM(MATCH_MP LT_SUC_PRE th)]) + THEN DISCH_TAC + THEN DISCH_THEN (ASSUME_TAC o SYM) + THEN MP_TAC (SPECL[`ploop:num->A`; `n:num`; `(p:num->A) (SUC i)`; `j:num`] lemma_in_list2) + THEN POP_ASSUM (fun th -> GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o DEPTH_CONV) [th]) + THEN USE_THEN "G6" (MP_TAC o SPEC `SUC i`) + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[th])) + THEN REWRITE_TAC[LT_0]; ALL_TAC] + THEN REMOVE_THEN "G18" (fun th1 -> (REMOVE_THEN "G16" (fun th2 -> (REMOVE_THEN "G20" (fun th3 -> (POP_ASSUM (fun th4 -> (MP_TAC (MATCH_MP concatenate_two_contours (CONJ th1 (CONJ th2 (CONJ th3 th4)))))))))))) + THEN DISCH_THEN (X_CHOOSE_THEN `g:num->A` (CONJUNCTS_THEN2 (LABEL_TAC "G21") (CONJUNCTS_THEN2 (LABEL_TAC "G22") (CONJUNCTS_THEN2 (LABEL_TAC "G23") (CONJUNCTS_THEN2 (LABEL_TAC "G24") (LABEL_TAC "G25")))))) + THEN USE_THEN "G24" (MP_TAC o SPEC `PRE k`) + THEN REWRITE_TAC[LE_REFL; shift_path] + THEN ONCE_REWRITE_TAC[ADD_SYM] + THEN USE_THEN "K2" (fun th -> (REWRITE_TAC[SYM(MATCH_MP LT_PRE th)])) + THEN DISCH_THEN (LABEL_TAC "G26") + THEN REMOVE_THEN "G4" MP_TAC + THEN REWRITE_TAC[lemma_in_list] + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (CONJUNCTS_THEN2 (LABEL_TAC "G27") (LABEL_TAC "G28"))) + THEN SUBGOAL_THEN `j:num < n:num` (LABEL_TAC "G30") + THENL[REWRITE_TAC[LT_LE] + THEN USE_THEN "G27" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F9" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_TAC + THEN USE_THEN "G28" MP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN USE_THEN "G17" SUBST1_TAC + THEN USE_THEN "G10" SUBST1_TAC + THEN REWRITE_TAC[node_map_injective] + THEN USE_THEN "F8" (MP_TAC o SPECL[`k:num`; `1`]) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `2 <=k ==> 1 < k`) th; LE_REFL]) + THEN MESON_TAC[]; ALL_TAC] + THEN REMOVE_THEN "G21" MP_TAC + THEN REWRITE_TAC[shift_path] + THEN REWRITE_TAC[ADD_0] + THEN DISCH_THEN (LABEL_TAC "G31") + THEN REMOVE_THEN "G25" (MP_TAC o SPEC `j:num`) + THEN USE_THEN "G30" (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN REMOVE_THEN "G28" (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "G31") + THEN EXISTS_TAC `g:num->A` + THEN EXISTS_TAC `PRE k + (n:num)` + THEN REWRITE_TAC[is_Moebius_contour] + THEN USE_THEN "G23" (fun th -> REWRITE_TAC[th]) + THEN EXISTS_TAC `PRE k` + THEN EXISTS_TAC `PRE k + (j:num)` + THEN USE_THEN "K1" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[LE_ADD] + THEN ONCE_REWRITE_TAC[LT_ADD_LCANCEL] + THEN USE_THEN "G30" (fun th -> REWRITE_TAC[th]) + THEN REPLICATE_TAC 2 (POP_ASSUM SUBST1_TAC) + THEN USE_THEN "G10" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "G26" SUBST1_TAC + THEN USE_THEN "G22" SUBST1_TAC + THEN USE_THEN "G17" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN REMOVE_THEN "F4" (LABEL_TAC "TP" o REWRITE_RULE[POWER_1] o SPEC `1` o MATCH_MP lemma_power_next_in_loop) + THEN REMOVE_THEN "F1" (fun th->(USE_THEN "TP"(fun th1-> (LABEL_TAC "F1" (MATCH_MP let_order_for_loop (CONJ th th1)))))) + THEN MP_TAC (SPECL[`L:(A)loop`; `next (L:(A)loop) ((p:num->A) 0)`; `top (L:(A)loop)`] loop_path) + THEN REWRITE_TAC[iterate_map_valuation2; GSYM lemma_size; lemma_order_next; I_THM] + THEN DISCH_THEN (LABEL_TAC "F4" o SYM) + THEN REMOVE_THEN "F5" MP_TAC + THEN USE_THEN "TP" (fun th -> REWRITE_TAC[MATCH_MP lemma_belong th]) + THEN DISCH_THEN (LABEL_TAC "F5") + THEN REMOVE_THEN "F6" MP_TAC + THEN REMOVE_THEN "TP" (fun th -> REWRITE_TAC[MATCH_MP lemma_belong th]) + THEN DISCH_THEN (LABEL_TAC "F6") + THEN ABBREV_TAC `ploop = loop_path (L:(A)loop) (next L ((p:num->A) 0))` + THEN ABBREV_TAC `n = top (L:(A)loop)` + THEN REWRITE_TAC[GSYM node_map_inverse_representation] + THEN DISCH_THEN (LABEL_TAC "G10") + THEN DISCH_THEN (LABEL_TAC "G12") + THEN REMOVE_THEN "F7" MP_TAC + THEN REWRITE_TAC[NOT_FORALL_THM] + THEN USE_THEN "F1" (CONJUNCTS_THEN2 (LABEL_TAC "G16") (MP_TAC)) + THEN REWRITE_TAC[one_step_contour] + THEN USE_THEN "F4" (SUBST1_TAC o SYM) + THEN STRIP_TAC + THENL[POP_ASSUM MP_TAC + THEN USE_THEN "G10" (SUBST1_TAC o SYM) + THEN DISCH_THEN (fun th-> (ASSUME_TAC (MATCH_MP lemma_in_list2 (CONJ (SPEC `n:num` LE_0) (SYM th))))) + THEN USE_THEN "F6" (MP_TAC o SPEC `1`) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `2 <= k:num ==> 1 < k`) th]) + THEN REWRITE_TAC[ARITH_RULE `0 < 1`] + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[GSYM node_map_inverse_representation] + THEN DISCH_THEN (LABEL_TAC "G17") + THEN REMOVE_THEN "F2" (MP_TAC o SPEC `PRE k` o MATCH_MP lemma_sub_inj_contour) + THEN USE_THEN "K3" (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN DISCH_THEN (LABEL_TAC "G18") + THEN SUBGOAL_THEN `!j:num. 0 < j /\ j <= PRE k ==> (!i:num. i <= (n:num) ==> ~((p:num->A) j = (ploop:num->A) i))` ASSUME_TAC + THENL[REPEAT STRIP_TAC + THEN MP_TAC (SPECL[`ploop:num->A`; `n:num`; `(p:num->A) (j:num)`; `i:num`] lemma_in_list2) + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th -> GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o DEPTH_CONV) [th])) + THEN REWRITE_TAC[] + THEN USE_THEN "F6" (MP_TAC o SPEC `j:num`) + THEN POP_ASSUM (fun th -> (USE_THEN "K2" (fun th2 -> REWRITE_TAC[MATCH_MP (ARITH_RULE `0 < k:num /\ j:num <= PRE k ==> j < k`) (CONJ th2 th)]))) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN REMOVE_THEN "G16" (fun th1 -> (REMOVE_THEN "G18" (fun th2 -> (USE_THEN "F4" (fun th3 -> (POP_ASSUM (fun th4 -> (MP_TAC (MATCH_MP concatenate_two_contours (CONJ th1 (CONJ th2 (CONJ (SYM th3) th4)))))))))))) + THEN DISCH_THEN (X_CHOOSE_THEN `g:num->A` (CONJUNCTS_THEN2 (LABEL_TAC "G21") (CONJUNCTS_THEN2 (LABEL_TAC "G22") (CONJUNCTS_THEN2 (LABEL_TAC "G23") (CONJUNCTS_THEN2 (LABEL_TAC "G24") (LABEL_TAC "G25")))))) + THEN USE_THEN "G24" (MP_TAC o SPEC `n:num`) + THEN REWRITE_TAC[LE_REFL] + THEN DISCH_THEN (LABEL_TAC "G26") + THEN REMOVE_THEN "F5" MP_TAC + THEN REWRITE_TAC[lemma_in_list] + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (CONJUNCTS_THEN2 (LABEL_TAC "G27") (LABEL_TAC "G28"))) + THEN SUBGOAL_THEN `~(j:num = 0)` MP_TAC + THENL[USE_THEN "F9" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_TAC + THEN USE_THEN "G28" MP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [GSYM (SPEC `H:(A)hypermap` node_map_injective)] + THEN USE_THEN "G12" (SUBST1_TAC o SYM) + THEN USE_THEN "G17" (SUBST1_TAC o SYM) + THEN USE_THEN "F8" (MP_TAC o SPECL[`PRE k`; `0`]) + THEN USE_THEN "K3" (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN USE_THEN "K1" (fun th -> REWRITE_TAC[th]) + THEN MESON_TAC[]; ALL_TAC] + THEN REWRITE_TAC[GSYM LT_NZ] + THEN DISCH_THEN (LABEL_TAC "G29") + THEN EXISTS_TAC `g:num->A` + THEN EXISTS_TAC `(n:num) + PRE k` + THEN REWRITE_TAC[is_Moebius_contour] + THEN USE_THEN "G23" (fun th -> REWRITE_TAC[th]) + THEN EXISTS_TAC `j:num` + THEN EXISTS_TAC `n:num` + THEN USE_THEN "G29" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "G27" (fun th -> REWRITE_TAC[th]) + THEN ONCE_REWRITE_TAC[LT_ADD] + THEN USE_THEN "K1" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "G26" SUBST1_TAC + THEN USE_THEN "G21" SUBST1_TAC + THEN USE_THEN "G22" SUBST1_TAC + THEN USE_THEN "G24" (MP_TAC o SPEC `j:num`) + THEN USE_THEN "G27" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "G28" (SUBST1_TAC o SYM) + THEN USE_THEN "F4" (SUBST1_TAC o SYM) + THEN USE_THEN "G12" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "G17" (fun th -> REWRITE_TAC[th]));; + + +(* Some facts about face_loop, node_loop and their injective contours *) + +let inj_orbit_imp_inj_face_contour = prove(`!(H:(A)hypermap) (x:A) (k:num). inj_orbit (face_map H) x k ==> is_inj_contour H (face_contour H x) k`, + REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_def_inj_contour] + THEN REWRITE_TAC[lemma_face_contour; face_contour] + THEN REWRITE_TAC[lemma_def_inj_orbit] + THEN MESON_TAC[]);; + +let lemma_inj_face_contour = prove(`!(H:(A)hypermap) x:A k:num. k < CARD(face H x) ==> is_inj_contour H (face_contour H x) k`, + REWRITE_TAC[face] + THEN REPEAT STRIP_TAC + THEN MP_TAC(SPECL[`x:A`; `k:num`](MATCH_MP lemma_segment_orbit (SPEC `H:(A)hypermap` face_map_and_darts))) + THEN ASM_REWRITE_TAC[inj_orbit_imp_inj_face_contour]);; + +let lemma_face_cycle = prove(`!(H:(A)hypermap) (x:A). ((face_map H) POWER (CARD (face H x))) x = x`, + REWRITE_TAC[face] THEN MESON_TAC[face_map_and_darts; lemma_cycle_orbit]);; + +let lemma_orbit_inverse_map_eq = prove(`!s:A->bool p:A->A x:A. FINITE s /\ p permutes s ==> orbit_map (inverse p) x = orbit_map p x`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN REWRITE_TAC[orbit_map;GE; LE_0; EXTENSION; IN_ELIM_THM] + THEN GEN_TAC + THEN EQ_TAC + THENL[STRIP_TAC + THEN REMOVE_THEN "F1" (MP_TAC o SPEC `n:num` o MATCH_MP power_inverse_element_lemma) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` SUBST_ALL_TAC) + THEN EXISTS_TAC `j:num` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM (MP_TAC o MATCH_MP lemma_permutation_via_its_inverse) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` MP_TAC) + THEN DISCH_THEN (fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN REWRITE_TAC[GSYM multiplication_exponents] + THEN MESON_TAC[]);; + +let inj_orbit_imp_inj_node_contour = prove( + `!(H:(A)hypermap) (x:A) (k:num). inj_orbit (inverse (node_map H)) x k ==> is_inj_contour H (node_contour H x) k`, + REPEAT GEN_TAC + THEN REWRITE_TAC[lemma_def_inj_contour] + THEN REWRITE_TAC[lemma_node_contour; node_contour] + THEN REWRITE_TAC[lemma_def_inj_orbit] + THEN MESON_TAC[]);; + +let lemma_inj_node_contour = prove(`!(H:(A)hypermap) x:A k:num. k < CARD(node H x) ==> is_inj_contour H (node_contour H x) k`, + REPEAT GEN_TAC + THEN REWRITE_TAC[node] + THEN MP_TAC (SPEC `H:(A)hypermap` node_map_and_darts) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN USE_THEN "F2" (LABEL_TAC "F3" o MATCH_MP PERMUTES_INVERSE) + THEN USE_THEN "F1" (fun th1-> (USE_THEN "F3" (fun th2 ->(MP_TAC(SPECL[`x:A`; `k:num`](MATCH_MP lemma_segment_orbit (CONJ th1 th2))))))) + THEN USE_THEN "F1" (fun th1-> (USE_THEN "F2" (fun th2 ->(REWRITE_TAC[SYM((SPEC `x:A` (MATCH_MP lemma_orbit_inverse_map_eq (CONJ th1 th2))))])))) + THEN MESON_TAC[inj_orbit_imp_inj_node_contour]);; + +let lemma_node_cycle = prove(`!(H:(A)hypermap) (x:A). ((node_map H) POWER (CARD (node H x))) x = x`, + REWRITE_TAC[node] THEN MESON_TAC[hypermap_lemma; lemma_cycle_orbit]);; + +let lemma_node_inverse_cycle = prove(`!(H:(A)hypermap) (x:A). ((inverse (node_map H)) POWER (CARD (node H x))) x = x`, + REPEAT GEN_TAC + THEN ASSUME_TAC (CONJUNCT2(SPEC `H:(A)hypermap` node_map_and_darts)) + THEN CONV_TAC SYM_CONV + THEN POP_ASSUM (fun th -> REWRITE_TAC[GSYM(MATCH_MP inverse_power_function th)]) + THEN CONV_TAC SYM_CONV + THEN REWRITE_TAC[lemma_node_cycle]);; + + +let lemma_node_contour_connection = prove(`!(H:(A)hypermap) (x:A) (y:A). y IN node H x + ==> (?k:num. k < CARD(node H x) /\ node_contour H x 0 = x /\ node_contour H x k = y /\ is_inj_contour H (node_contour H x) k)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] lemma_node_inverse_cycle) + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] NODE_NOT_EMPTY) + THEN REWRITE_TAC[LT1_NZ; LT_NZ; IMP_IMP] + THEN MP_TAC (SPEC`x:A` (MATCH_MP lemma_orbit_inverse_map_eq (SPEC `H:(A)hypermap` node_map_and_darts))) + THEN REWRITE_TAC[GSYM node] + THEN DISCH_THEN (fun th -> (ASSUME_TAC th THEN GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV)[SYM th])) + THEN DISCH_THEN (MP_TAC o MATCH_MP orbit_cyclic) + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_TAC + THEN REMOVE_THEN "F1" MP_TAC + THEN POP_ASSUM (fun th -> GEN_REWRITE_TAC (LAND_CONV o RAND_CONV) [th]) + THEN REWRITE_TAC[IN_ELIM_THM] + THEN REWRITE_TAC[GSYM node_contour] + THEN STRIP_TAC + THEN EXISTS_TAC `k:num` + THEN ASM_REWRITE_TAC[] + THEN FIRST_ASSUM (fun th -> REWRITE_TAC[MATCH_MP lemma_inj_node_contour th]) + THEN REWRITE_TAC[node_contour; POWER_0; I_THM]);; + +let lemma_via_inverse_node_map = prove(`!H:(A)hypermap x:A y:A. y IN node H x + ==> ?j:num. j < CARD (node H x) /\ y = (inverse (node_map H) POWER j) x`, + REPEAT GEN_TAC + THEN DISCH_THEN (MP_TAC o REWRITE_RULE[node_contour] o MATCH_MP lemma_node_contour_connection) THEN MESON_TAC[]);; + + +let lemmaICJHAOQ = prove(`!(H:(A)hypermap) L:(A)loop. is_loop H L /\ (!g:num->A m:num. ~(is_Moebius_contour H g m)) +==> ~(?p:num->A k:num. 1 <= k /\ is_contour H p k /\ (p 0) belong L /\ (!i:num. 0 < i /\ i <= k ==> ~((p i) belong L)) /\ p 1 = face_map H (p 0) /\ ~(node H (p 0) = node H (p k)) /\ (?y:A. y IN node H (p k) /\ y belong L))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") MP_TAC) + THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] + THEN REWRITE_TAC[NOT_FORALL_THM] + THEN DISCH_THEN (X_CHOOSE_THEN `p:num->A` (X_CHOOSE_THEN `k:num` (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (CONJUNCTS_THEN2 (LABEL_TAC "F7") (LABEL_TAC "F8"))))))))) + THEN SUBGOAL_THEN `?s:num. s <= k /\(p:num->A) s IN node (H:(A)hypermap) (p (k:num))` MP_TAC + THENL[EXISTS_TAC `k:num` THEN REWRITE_TAC[node; orbit_reflect; LE_REFL]; ALL_TAC] + THEN GEN_REWRITE_TAC (LAND_CONV) [num_WOP] + THEN DISCH_THEN (X_CHOOSE_THEN `s:num` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "F9") (LABEL_TAC "F10")) (LABEL_TAC "F11"))) + THEN REMOVE_THEN "F10" (SUBST_ALL_TAC o MATCH_MP lemma_node_identity) + THEN SUBGOAL_THEN `~((p:num->A) 0 = p (s:num))` (LABEL_TAC "F12") + THENL[USE_THEN "F7" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN MESON_TAC[lemma_node_identity]; ALL_TAC] + THEN SUBGOAL_THEN `0 < s:num` (LABEL_TAC "F14") + THENL[ASM_CASES_TAC `s:num = 0` + THENL[USE_THEN "F12" MP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN MESON_TAC[]; ALL_TAC] + THEN REWRITE_TAC[LT_NZ] + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN REMOVE_THEN "F3" (MP_TAC o SPEC `s:num` o MATCH_MP lemma_subcontour) + THEN USE_THEN "F9" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F16") + THEN USE_THEN "F5" (MP_TAC o SPEC `s:num`) + THEN USE_THEN "F14" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F9" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F17") + THEN SUBGOAL_THEN `?u:num. u < CARD(node (H:(A)hypermap) ((p:num->A) (s:num))) /\ (node_contour H (p s) u) belong (L:(A)loop)` MP_TAC + THENL[USE_THEN "F8" (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (MP_TAC o MATCH_MP lemma_node_contour_connection) ASSUME_TAC)) + THEN DISCH_THEN (X_CHOOSE_THEN `u:num` (CONJUNCTS_THEN2 (ASSUME_TAC) (ASSUME_TAC o CONJUNCT1 o CONJUNCT2))) + THEN EXISTS_TAC `u:num` + THEN POP_ASSUM SUBST1_TAC + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th -> (REWRITE_TAC[th]))); ALL_TAC] + THEN GEN_REWRITE_TAC (LAND_CONV) [num_WOP] + THEN DISCH_THEN (X_CHOOSE_THEN `t:num` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "F18") (LABEL_TAC "F19")) (LABEL_TAC "F20"))) + THEN SUBGOAL_THEN `0 < t:num` (LABEL_TAC "F21") + THENL[ASM_CASES_TAC `t:num = 0` + THENL[USE_THEN "F19" MP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[node_contour; POWER_0; I_THM] + THEN USE_THEN "F17" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN REWRITE_TAC[LT_NZ] + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN USE_THEN "F16" (MP_TAC o MATCH_MP lemmaQZTPGJV) + THEN DISCH_THEN (X_CHOOSE_THEN `w:num->A` (X_CHOOSE_THEN `d:num` (CONJUNCTS_THEN2 (LABEL_TAC "FC") (CONJUNCTS_THEN2 (LABEL_TAC "F22") (CONJUNCTS_THEN2 (LABEL_TAC "F23") (CONJUNCTS_THEN2 (LABEL_TAC "F24") (LABEL_TAC "F25"))))))) + THEN SUBGOAL_THEN `0 < d:num` (LABEL_TAC "F26") + THENL[ASM_CASES_TAC `d:num = 0` + THENL[USE_THEN "F23" MP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN USE_THEN "F22" SUBST1_TAC + THEN USE_THEN "F12" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN REWRITE_TAC[LT_NZ] + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN REMOVE_THEN "F22" (SUBST_ALL_TAC o SYM) + THEN REMOVE_THEN "F23" (SUBST_ALL_TAC o SYM) + THEN SUBGOAL_THEN `!i:num. 0 < i /\ i <= d:num ==> ~(((w:num->A) i) belong (L:(A)loop) )` (LABEL_TAC "F27") + THENL[REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G4") MP_TAC) + THEN REWRITE_TAC[LE_LT] + THEN STRIP_TAC + THENL[POP_ASSUM (LABEL_TAC "G5") + THEN USE_THEN "F25" (MP_TAC o SPEC `i:num`) + THEN USE_THEN "G5" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (CONJUNCTS_THEN2 (LABEL_TAC "G6") (CONJUNCTS_THEN2 (LABEL_TAC "G7") (SUBST1_TAC o CONJUNCT1)))) + THEN USE_THEN "G4" (fun th1 -> (USE_THEN "G6" (fun th2 -> (ASSUME_TAC (MATCH_MP LTE_TRANS (CONJ th1 th2)))))) + THEN USE_THEN "G7" (fun th1 -> (USE_THEN "F9" (fun th2 -> (ASSUME_TAC (MATCH_MP LTE_TRANS (CONJ th1 th2)))))) + THEN USE_THEN "F5" (MP_TAC o SPEC `j:num`) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM SUBST1_TAC + THEN USE_THEN "F17" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `(w:num->A) 1 = face_map (H:(A)hypermap) (w 0)` (LABEL_TAC "F28") + THENL[USE_THEN "F4" (LABEL_TAC "G7" o REWRITE_RULE[POWER_1] o SPEC `1` o MATCH_MP lemma_power_next_in_loop) + THEN USE_THEN "F1"(MP_TAC o SPEC `(w:num->A) 0` o REWRITE_RULE[is_loop]) + THEN USE_THEN "F4" (fun th-> REWRITE_TAC[th]) + THEN REWRITE_TAC[one_step_contour] + THEN STRIP_TAC + THENL[REMOVE_THEN "G7" MP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN USE_THEN "F6" (fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [GSYM th]) + THEN USE_THEN "F5" (MP_TAC o SPEC `1`) + THEN USE_THEN "F2" (fun th-> REWRITE_TAC[th; ARITH_RULE `0 < 1`]) + THEN MESON_TAC[]; ALL_TAC] + THEN USE_THEN "F24" (MP_TAC o SPEC `0` o REWRITE_RULE[lemma_def_contour] o CONJUNCT1 o REWRITE_RULE[lemma_def_inj_contour]) + THEN USE_THEN "F26" (fun th-> REWRITE_TAC[th; one_step_contour; GSYM ONE]) + THEN STRIP_TAC + THEN POP_ASSUM MP_TAC + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN DISCH_TAC + THEN REMOVE_THEN "G7" MP_TAC + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN POP_ASSUM (MP_TAC o SPEC `1`) + THEN POP_ASSUM (ASSUME_TAC o REWRITE_RULE[GSYM LT1_NZ]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[ th; ARITH_RULE `0 < 1`]) + THEN MESON_TAC[]; ALL_TAC] + THEN USE_THEN "F18" (LABEL_TAC "F29" o MATCH_MP lemma_inj_node_contour) + THEN MP_TAC(SPECL[`H:(A)hypermap`; `(w:num->A) (d:num)`; `0`] node_contour) + THEN REWRITE_TAC[POWER_0; I_THM] + THEN DISCH_THEN (LABEL_TAC "F30") + THEN SUBGOAL_THEN `!j:num. 0 < j /\ j <= t:num ==> (!i:num. i <= d ==> ~(node_contour (H:(A)hypermap) ((w:num->A) (d:num)) j = w i))` ASSUME_TAC + THENL[GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G20") (LABEL_TAC "G21")) + THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "G22") + THEN ASM_CASES_TAC `i:num = d:num` + THENL[POP_ASSUM SUBST1_TAC + THEN USE_THEN "F30" (fun th -> GEN_REWRITE_TAC (RAND_CONV o RAND_CONV) [SYM th]) + THEN (USE_THEN "F29" (MP_TAC o SPECL[`j:num`; `0`] o CONJUNCT2 o REWRITE_RULE[lemma_def_inj_contour; lemma_def_contour])) + THEN USE_THEN "G20" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "G21" (fun th -> REWRITE_TAC[th]) + THEN MESON_TAC[]; ALL_TAC] + THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) + THEN REWRITE_TAC[IMP_IMP; GSYM LT_LE] + THEN DISCH_THEN (LABEL_TAC "G25") + THEN REWRITE_TAC[node_contour] + THEN MP_TAC (SPEC `j:num` (MATCH_MP power_inverse_element_lemma (SPEC `H:(A)hypermap` node_map_and_darts))) + THEN DISCH_THEN (X_CHOOSE_THEN `v:num` SUBST1_TAC) + THEN REWRITE_TAC[GSYM node] + THEN DISCH_THEN (fun th -> (MP_TAC (MATCH_MP in_orbit_lemma (SYM th)))) + THEN USE_THEN "G25" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F25" (MP_TAC o SPEC `i:num`) + THEN USE_THEN "G25" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (X_CHOOSE_THEN `u:num` (fun th -> (LABEL_TAC "G26" (CONJUNCT1(CONJUNCT2 th)) THEN LABEL_TAC "G27" (CONJUNCT1(CONJUNCT2(CONJUNCT2 th)))))) + THEN USE_THEN "F11" (MP_TAC o SPEC `u:num`) + THEN USE_THEN "G26" (fun th-> REWRITE_TAC[th]) + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "F9" (fun th -> (USE_THEN "G26" (fun th1 -> MP_TAC(MATCH_MP LTE_TRANS (CONJ th1 th))))) + THEN DISCH_THEN (fun th -> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN REWRITE_TAC[GSYM node] + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN USE_THEN "F24" (fun th1 -> (USE_THEN "F29" (fun th2 -> (USE_THEN "F30" (fun th3 -> (POP_ASSUM (fun th4 ->MP_TAC (MATCH_MP concatenate_two_contours (CONJ th1 (CONJ th2 (CONJ (SYM th3) th4))))))))))) + THEN DISCH_THEN (X_CHOOSE_THEN `g:num->A` (CONJUNCTS_THEN2 (LABEL_TAC "M1") (CONJUNCTS_THEN2 (LABEL_TAC "M2") (CONJUNCTS_THEN2 (LABEL_TAC "M3") (CONJUNCTS_THEN2 (LABEL_TAC "M4") (LABEL_TAC "M5")))))) + THEN SUBGOAL_THEN `!i:num. 0 < i /\ i < (d:num) + (t:num) ==> ~((g:num->A) i belong (L:(A)loop))` (LABEL_TAC "M6") + THENL[GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G30") (LABEL_TAC "G31")) + THEN ASM_CASES_TAC `i:num <= d:num` + THENL[POP_ASSUM (LABEL_TAC "G32") + THEN USE_THEN "M4" (MP_TAC o SPEC `i:num`) + THEN USE_THEN "G32" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F27" (MP_TAC o SPEC `i:num`) + THEN USE_THEN "G30" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "G32" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[NOT_LE]) + THEN REWRITE_TAC[LT_EXISTS] + THEN DISCH_THEN (X_CHOOSE_THEN `l:num` ASSUME_TAC) + THEN USE_THEN "G31" MP_TAC + THEN POP_ASSUM (SUBST1_TAC) + THEN REWRITE_TAC[LT_ADD_LCANCEL] + THEN DISCH_THEN (LABEL_TAC "G34") + THEN USE_THEN "M5" (MP_TAC o SPEC `SUC l`) + THEN USE_THEN "G34" (fun th-> (REWRITE_TAC[MATCH_MP LT_IMP_LE th])) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F20" (MP_TAC o SPEC `SUC l`) + THEN USE_THEN "G34" (fun th -> REWRITE_TAC[th; CONTRAPOS_THM]) + THEN DISCH_THEN(fun th -> SIMP_TAC[th]) + THEN USE_THEN "G34" (fun th1 -> (USE_THEN "F18" (fun th -> REWRITE_TAC[MATCH_MP LT_TRANS (CONJ th1 th)]))); ALL_TAC] + THEN REMOVE_THEN "F19" (MP_TAC) + THEN USE_THEN "M2" (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "F19") + THEN REMOVE_THEN "M1" (SUBST_ALL_TAC o SYM) + THEN REMOVE_THEN "F28" MP_TAC + THEN USE_THEN "M4" (MP_TAC o SPEC `1`) + THEN USE_THEN "F26" (MP_TAC o REWRITE_RULE[GSYM LT1_NZ]) + THEN DISCH_THEN(fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "F28") + THEN USE_THEN "M5" (MP_TAC o SPEC `PRE t`) + THEN REWRITE_TAC[ARITH_RULE `PRE (t:num) <= t`] + THEN REWRITE_TAC[node_contour] + THEN DISCH_TAC + THEN REMOVE_THEN "M2" MP_TAC + THEN REWRITE_TAC[node_contour] + THEN USE_THEN "F21" (fun th -> (GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [MATCH_MP LT_SUC_PRE th])) + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN REWRITE_TAC[GSYM node_contour] + THEN USE_THEN "F21" (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `0 < t:num ==> (d:num) + (PRE t) = PRE(d + t)`) th]) + THEN DISCH_THEN (LABEL_TAC "M2") + THEN USE_THEN "F26"(fun th1 ->(USE_THEN "F21" (fun th2 -> (LABEL_TAC "F29" (MATCH_MP (ARITH_RULE `0 < d:num /\ 0 < t:num ==> 2 <= d + t`) (CONJ th1 th2)))))) + THEN ABBREV_TAC `m = (d:num) + (t:num)` + THEN ONCE_REWRITE_TAC[TAUT `p <=> (~p ==> F)`] + THEN DISCH_THEN ASSUME_TAC + THEN MP_TAC(SPECL[`H:(A)hypermap`; `L:(A)loop`; `g:num->A`;`m:num`] lemmaILTXRQD) + THEN ASM_REWRITE_TAC[] + THEN USE_THEN "M2" (fun th -> REWRITE_TAC[SYM th]) + THEN USE_THEN "F19" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[GSYM NOT_EXISTS_THM] + THEN POP_ASSUM(fun th -> MESON_TAC[th]));; + +let lemmaThreeDarts = prove(`!(H:(A)hypermap) (L:(A)loop). is_loop H L /\ (!x:A. x IN dart H ==> 3 <= CARD (face H x)) /\ (?x:A y:A. ~(node H x = node H y) /\ x belong L /\ y belong L) ==> 3 <= size L`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (X_CHOOSE_THEN `x:A` (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5"))))))) + THEN USE_THEN "F4" (MP_TAC o REWRITE_RULE[lemma_in_list]) + THEN STRIP_TAC + THEN REWRITE_TAC[THREE; lemma_size; LE_SUC] + THEN USE_THEN "F1" (fun th-> (USE_THEN "F4" (fun th1 -> MP_TAC (MATCH_MP let_order_for_loop (CONJ th th1))))) + THEN REWRITE_TAC[POWER_0; I_THM] + THEN MP_TAC (SPECL[`L:(A)loop`; `x:A`; `0`] loop_path) + THEN REWRITE_TAC[POWER_0; I_THM] + THEN DISCH_THEN (fun th -> (LABEL_TAC "F6" th THEN SUBST1_TAC th)) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "H1") (LABEL_TAC "H2")) + THEN REMOVE_THEN "F5" MP_TAC + THEN USE_THEN "F4"(fun th -> REWRITE_TAC[MATCH_MP lemma_belong th]) + THEN DISCH_THEN (LABEL_TAC "F5") + THEN USE_THEN "F4" MP_TAC + THEN REMOVE_THEN "F4"(fun th -> REWRITE_TAC[MATCH_MP lemma_belong th]) + THEN DISCH_THEN (LABEL_TAC "F4") + THEN ABBREV_TAC `ploop = loop_path (L:(A)loop) (x:A)` + THEN ABBREV_TAC `n = top (L:(A)loop)` + THEN SUBGOAL_THEN `~(x:A = y:A)` (LABEL_TAC "F7") + THENL[FIRST_X_ASSUM (MP_TAC o check (is_neg o concl)) THEN MESON_TAC[]; ALL_TAC] + THEN MP_TAC(SPECL[`support_list (ploop:num->A) (n:num)`; `x:A`; `y:A`] CARD_ATLEAST_2) + THEN REWRITE_TAC[GSYM in_list] + THEN ASM_REWRITE_TAC[lemma_finite_list] + THEN USE_THEN "H1" (fun th -> (MP_TAC (MATCH_MP lemma_number_darts_of_inj_contour th) THEN ASSUME_TAC th)) + THEN DISCH_THEN SUBST1_TAC + THEN GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [TWO; LE_SUC; LE_LT] + THEN STRIP_TAC THENL[POP_ASSUM MP_TAC THEN ARITH_TAC; ALL_TAC] + THEN POP_ASSUM (SUBST_ALL_TAC o SYM) + THEN USE_THEN "F5" (MP_TAC o REWRITE_RULE[lemma_in_list]) + THEN DISCH_THEN (X_CHOOSE_THEN `m:num` (CONJUNCTS_THEN2 MP_TAC ASSUME_TAC)) + THEN REWRITE_TAC[SPEC `m:num` SEGMENT_TO_ONE] + THEN STRIP_TAC + THENL[POP_ASSUM SUBST_ALL_TAC + THEN FIRST_X_ASSUM (MP_TAC o check (is_neg o concl)) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM SUBST_ALL_TAC + THEN POP_ASSUM SUBST_ALL_TAC + THEN REMOVE_THEN "F6" (SUBST_ALL_TAC o SYM) + THEN USE_THEN "H2" (MP_TAC o REWRITE_RULE[one_step_contour]) + THEN ONCE_REWRITE_TAC[DISJ_SYM] + THEN STRIP_TAC + THENL[POP_ASSUM (MP_TAC o ONCE_REWRITE_RULE[GSYM node_map_inverse_representation]) + THEN DISCH_TAC + THEN MP_TAC (SPECL[`node_map (H:(A)hypermap)`; `(ploop:num->A) 0`] in_orbit_map1) + THEN POP_ASSUM (fun th -> REWRITE_TAC[GSYM node; SYM th]) + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_node_identity) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F8") + THEN USE_THEN "H1" (MP_TAC o SPEC `0` o CONJUNCT1 o REWRITE_RULE[lemma_def_inj_contour; lemma_def_contour]) + THEN REWRITE_TAC[ZR_LT_1; GSYM ONE; one_step_contour] + THEN ONCE_REWRITE_TAC[DISJ_SYM] + THEN STRIP_TAC + THENL[POP_ASSUM (MP_TAC o ONCE_REWRITE_RULE[GSYM node_map_inverse_representation]) + THEN DISCH_TAC + THEN MP_TAC (SPECL[`node_map (H:(A)hypermap)`; `(ploop:num->A) 1`] in_orbit_map1) + THEN POP_ASSUM (fun th -> REWRITE_TAC[GSYM node; SYM th]) + THEN DISCH_THEN (MP_TAC o SYM o MATCH_MP lemma_node_identity) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN REMOVE_THEN "F8" (MP_TAC o SYM) + THEN POP_ASSUM SUBST1_TAC + THEN GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [GSYM o_THM] + THEN REWRITE_TAC[GSYM POWER_2] + THEN MP_TAC (ARITH_RULE `~(2 = 0)`) + THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (ASSUME_TAC o REWRITE_RULE[GSYM face] o MATCH_MP card_orbit_le) + THEN UNDISCH_TAC `is_inj_contour (H:(A)hypermap) (ploop:num->A) 1` + THEN DISCH_THEN ( fun th -> (ASSUME_TAC (MATCH_MP lemma_first_dart_on_inj_contour (CONJ ZR_LT_1 th)))) + THEN USE_THEN "F2" (MP_TAC o SPEC `(ploop:num->A) 0`) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN POP_ASSUM MP_TAC + THEN ARITH_TAC);; + + +(************ GENERATION PART *****************) + + +let is_node_going = new_definition `!(H:(A)hypermap) (L:(A)loop) x:A y:A. is_node_going H L x y + <=> ?k:num. y = ((next L) POWER k) x /\ (!i:num. i <= k ==> ((next L) POWER i) x = ((inverse (node_map H)) POWER i) x)`;; + +let atom = new_definition `!(H:(A)hypermap) (L:(A)loop) x:A. atom H L x = {y:A | is_node_going H L x y \/ is_node_going H L y x}`;; + +(* Intuitively, a loop is partitioned by atoms *) + +let atom_reflect = prove(`!(H:(A)hypermap) (L:(A)loop) (x:A). x IN atom H L x`, + REPEAT GEN_TAC + THEN REWRITE_TAC[atom; IN_ELIM_THM; is_node_going] + THEN EXISTS_TAC `0` + THEN REWRITE_TAC[LE_0; LE; POWER_0; I_THM] + THEN GEN_TAC + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[POWER_0; I_THM]);; + +let atom_sym = prove(`!(H:(A)hypermap) (L:(A)loop) (x:A) (y:A). y IN atom H L x ==> x IN atom H L y`, + REWRITE_TAC[atom; IN_ELIM_THM] + THEN MESON_TAC[]);; + +let lemma_transitive_going = prove(`!(H:(A)hypermap) (L: (A)loop) (x:A) (y:A) (z:A). is_node_going H L x y /\ is_node_going H L y z ==> is_node_going H L x z`, + REPEAT GEN_TAC + THEN REWRITE_TAC[is_node_going] + THEN DISCH_THEN (CONJUNCTS_THEN2 (X_CHOOSE_THEN `m:num` (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2"))) +(X_CHOOSE_THEN `k:num` (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")))) + THEN EXISTS_TAC `(k:num) + (m:num)` + THEN REWRITE_TAC[addition_exponents; o_THM] + THEN USE_THEN "F1" (SUBST1_TAC o SYM) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[th]) + THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F5") + THEN ASM_CASES_TAC `i:num <= m:num` + THENL[POP_ASSUM (fun th -> (USE_THEN "F2" (fun thm-> REWRITE_TAC[MATCH_MP (SPEC `i:num` thm) th]))); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[NOT_LE; LT_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` MP_TAC) + THEN ABBREV_TAC `j = SUC d` + THEN DISCH_THEN SUBST_ALL_TAC + THEN ONCE_REWRITE_TAC[ADD_SYM] + THEN REWRITE_TAC[addition_exponents; o_THM] + THEN REMOVE_THEN "F2" (MP_TAC o REWRITE_RULE[LE_REFL] o SPEC `m:num`) + THEN REMOVE_THEN "F1" (SUBST1_TAC o SYM) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN REMOVE_THEN "F5" MP_TAC + THEN GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [ADD_SYM] + THEN REWRITE_TAC[LE_ADD_LCANCEL] + THEN DISCH_THEN (fun th -> (REMOVE_THEN "F4" (fun thm -> REWRITE_TAC[MATCH_MP (SPEC `j:num` thm) th]))));; + +let lemma_on_way_going = prove(`!(H:(A)hypermap) (L:(A)loop) (x:A) (y:A) (z:A). is_node_going H L x y /\ is_node_going H L x z ==> is_node_going H L y z \/ is_node_going H L z y `, + REPEAT GEN_TAC + THEN REWRITE_TAC[is_node_going] + THEN DISCH_THEN (CONJUNCTS_THEN2 (X_CHOOSE_THEN `m:num` (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2"))) (X_CHOOSE_THEN `k:num` (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")))) + THEN ASM_CASES_TAC `m:num <= k:num` + THENL[DISJ1_TAC + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[LE_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` SUBST_ALL_TAC) + THEN EXISTS_TAC `d:num` + THEN USE_THEN "F3" (MP_TAC o ONCE_REWRITE_RULE[ADD_SYM]) + THEN REWRITE_TAC[addition_exponents; o_THM] + THEN USE_THEN "F1" (SUBST1_TAC o SYM) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F5") + THEN USE_THEN "F4" (MP_TAC o SPEC `(m:num) + (i:num)`) + THEN REWRITE_TAC[LE_ADD_LCANCEL] + THEN USE_THEN "F5" (fun th -> REWRITE_TAC[th]) + THEN ONCE_REWRITE_TAC[ADD_SYM] + THEN REWRITE_TAC[addition_exponents; o_THM] + THEN USE_THEN "F2" (MP_TAC o REWRITE_RULE[LE_REFL] o SPEC `m:num`) + THEN REMOVE_THEN "F1" (SUBST1_TAC o SYM) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN SIMP_TAC[]; ALL_TAC] + THEN DISJ2_TAC + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[NOT_LE; LT_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `d1:num` SUBST_ALL_TAC) + THEN ABBREV_TAC `d = SUC d1` + THEN EXISTS_TAC `d:num` + THEN USE_THEN "F1" (MP_TAC o ONCE_REWRITE_RULE[ADD_SYM]) + THEN REWRITE_TAC[addition_exponents; o_THM] + THEN USE_THEN "F3" (SUBST1_TAC o SYM) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F5") + THEN USE_THEN "F2" (MP_TAC o SPEC `(k:num) + (i:num)`) + THEN REWRITE_TAC[LE_ADD_LCANCEL] + THEN USE_THEN "F5" (fun th -> REWRITE_TAC[th]) + THEN ONCE_REWRITE_TAC[ADD_SYM] + THEN REWRITE_TAC[addition_exponents; o_THM] + THEN USE_THEN "F4" (MP_TAC o REWRITE_RULE[LE_REFL] o SPEC `k:num`) + THEN REMOVE_THEN "F3" (SUBST1_TAC o SYM) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN SIMP_TAC[]);; + +let lemma_second_on_way_going = prove(`!(H:(A)hypermap) (L:(A)loop) (x:A) (y:A) (z:A). is_node_going H L x z /\ is_node_going H L y z ==> is_node_going H L x y \/ is_node_going H L y x`, + REPEAT GEN_TAC + THEN DISCH_THEN (MP_TAC o REWRITE_RULE[is_node_going]) + THEN DISCH_THEN (CONJUNCTS_THEN2 (X_CHOOSE_THEN `m:num` (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4"))) (X_CHOOSE_THEN `k:num`(CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6")))) + THEN ASM_CASES_TAC `m:num <= k:num` + THENL[DISJ2_TAC + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[LE_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` SUBST_ALL_TAC) + THEN REWRITE_TAC[is_node_going] + THEN EXISTS_TAC `d:num` + THEN USE_THEN "F3" (MP_TAC o SYM) + THEN USE_THEN "F5" (SUBST1_TAC) + THEN REWRITE_TAC[addition_exponents; o_THM] + THEN DISCH_THEN (MP_TAC o REWRITE_RULE[o_THM; I_THM] o AP_TERM `(back (L:(A)loop)) POWER (m:num)`) + THEN REWRITE_TAC[lemma_second_inverse_evaluation] + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) + THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F9") + THEN USE_THEN "F6" (MP_TAC o SPEC `i:num`) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `i:num <= d:num ==> i <= (m:num) + d`) th]); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[NOT_LE; LT_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `d1:num` (SUBST_ALL_TAC)) + THEN ABBREV_TAC `d = SUC d1` + THEN DISJ1_TAC + THEN REWRITE_TAC[is_node_going] + THEN EXISTS_TAC `d:num` + THEN USE_THEN "F3" (MP_TAC o SYM) + THEN USE_THEN "F5" (SUBST1_TAC) + THEN REWRITE_TAC[addition_exponents; o_THM] + THEN DISCH_THEN (MP_TAC o REWRITE_RULE[o_THM; I_THM] o AP_TERM `(back (L:(A)loop)) POWER (k:num)`) + THEN REWRITE_TAC[lemma_second_inverse_evaluation] + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) + THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F9") + THEN USE_THEN "F4" (MP_TAC o SPEC `i:num`) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP (ARITH_RULE `i:num <= d:num ==> i <= (k:num) + d`) th]));; + +let atom_trans = prove(`!(H:(A)hypermap) (L:(A)loop) (x:A) (y:A) (z:A). x IN atom H L y /\ y IN atom H L z ==> x IN atom H L z`, + REPEAT GEN_TAC + THEN REWRITE_TAC[atom; IN_ELIM_THM] + THEN STRIP_TAC + THENL[POP_ASSUM (fun th1 -> (POP_ASSUM (fun th2 -> REWRITE_TAC[MATCH_MP lemma_transitive_going (CONJ th1 th2)]))); + POP_ASSUM (fun th1 -> (POP_ASSUM (fun th2 -> REWRITE_TAC[MATCH_MP lemma_on_way_going (CONJ th1 th2)]))); + POP_ASSUM (fun th1 -> (POP_ASSUM (fun th2 -> REWRITE_TAC[MATCH_MP lemma_second_on_way_going (CONJ th1 th2)]))); + POP_ASSUM (fun th1 -> (POP_ASSUM (fun th2 -> REWRITE_TAC[MATCH_MP lemma_transitive_going (CONJ th2 th1)])))]);; + +let lemma_atom_sub_loop = prove(`!(H:(A)hypermap) (L:(A)loop) (x:A). x belong L ==> atom H L x SUBSET dart_of L`, + REPEAT STRIP_TAC + THEN REWRITE_TAC[atom; SUBSET; IN_ELIM_THM; GSYM belong] + THEN REPEAT STRIP_TAC + THENL[POP_ASSUM ((X_CHOOSE_THEN `k:num` (SUBST1_TAC o CONJUNCT1)) o REWRITE_RULE[is_node_going]) + THEN POP_ASSUM(fun th -> REWRITE_TAC[MATCH_MP lemma_power_next_in_loop th]); ALL_TAC] + THEN POP_ASSUM ((X_CHOOSE_THEN `k:num` (MP_TAC o CONJUNCT1)) o REWRITE_RULE[is_node_going]) + THEN ASM_CASES_TAC `~((x':A) belong (L:(A)loop))` + THENL[POP_ASSUM(fun th -> (REWRITE_TAC[MATCH_MP lemma_power_back_and_next_outside_loop th])) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM (fun th -> MESON_TAC[th]));; + +let lemma_atom_out_side_loop = prove(`!(H:(A)hypermap) (L:(A)loop) (x:A). ~(x belong L) ==> atom H L x = {x}`, + REPEAT STRIP_TAC + THEN MATCH_MP_TAC SUBSET_ANTISYM + THEN STRIP_TAC + THENL[REWRITE_TAC[atom; SUBSET; IN_ELIM_THM; IN_SING] + THEN GEN_TAC + THEN STRIP_TAC + THENL[POP_ASSUM ((X_CHOOSE_THEN `k:num` (SUBST1_TAC o CONJUNCT1)) o REWRITE_RULE[is_node_going]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP lemma_power_back_and_next_outside_loop th]); ALL_TAC] + THEN POP_ASSUM ((X_CHOOSE_THEN `k:num` (MP_TAC o CONJUNCT1)) o REWRITE_RULE[is_node_going]) + THEN DISCH_THEN (MP_TAC o REWRITE_RULE[o_THM] o AP_TERM `(back (L:(A)loop)) POWER (k:num)`) + THEN REWRITE_TAC[lemma_second_inverse_evaluation] + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP lemma_power_back_and_next_outside_loop th]) + THEN REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN REWRITE_TAC[SUBSET; IN_SING] + THEN GEN_TAC + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[atom_reflect]);; + +let lemma_atom_sub_node = prove(`!(H:(A)hypermap) (L:(A)loop) (x:A). (atom H L x) SUBSET (node H x)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[atom; SUBSET; IN_ELIM_THM] + THEN GEN_TAC + THEN STRIP_TAC + THENL[POP_ASSUM (MP_TAC o REWRITE_RULE[is_node_going]) + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` (CONJUNCTS_THEN2 SUBST1_TAC (LABEL_TAC "F1"))) + THEN POP_ASSUM (SUBST1_TAC o REWRITE_RULE[LE_REFL] o SPEC `k:num`) + THEN MP_TAC (SPEC `k:num` (MATCH_MP power_inverse_element_lemma (SPEC `H:(A)hypermap` node_map_and_darts))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` SUBST1_TAC) + THEN REWRITE_TAC[node; lemma_in_orbit]; ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[is_node_going]) + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` (CONJUNCTS_THEN2 (ASSUME_TAC) (MP_TAC o REWRITE_RULE[LE_REFL] o SPEC `k:num`))) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN REWRITE_TAC[GSYM(MATCH_MP inverse_power_function (CONJUNCT2 (SPEC `H:(A)hypermap` node_map_and_darts)))] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[node; lemma_in_orbit]);; + +let lemma_atom_sub_dart_set = prove(`!(H:(A)hypermap) (L:(A)loop) (x:A). x IN dart H ==> atom H L x SUBSET dart H`, + REPEAT STRIP_TAC + THEN MATCH_MP_TAC SUBSET_TRANS + THEN EXISTS_TAC `node (H:(A)hypermap) (x:A)` + THEN REWRITE_TAC[lemma_atom_sub_node; node] + THEN MP_TAC (SPEC `x:A` (MATCH_MP orbit_subset (CONJUNCT2(SPEC `H:(A)hypermap` node_map_and_darts)))) + THEN ASM_REWRITE_TAC[]);; + +let lemma_atom_finite = prove(`!(H:(A)hypermap) (L:(A)loop) (x:A). FINITE (atom H L x) /\ 1 <= CARD (atom H L x)`, + REPEAT GEN_TAC + THEN SUBGOAL_THEN `FINITE (atom (H:(A)hypermap) (L:(A)loop) (x:A))` ASSUME_TAC + THENL[MATCH_MP_TAC FINITE_SUBSET + THEN EXISTS_TAC `node (H:(A)hypermap) (x:A)` + THEN REWRITE_TAC[NODE_FINITE; lemma_atom_sub_node]; ALL_TAC] + THEN ASM_REWRITE_TAC[] + THEN MATCH_MP_TAC CARD_ATLEAST_1 + THEN EXISTS_TAC `x:A` + THEN ASM_REWRITE_TAC[atom_reflect]);; + +let lemma_identity_atom = prove(`!(H:(A)hypermap) (L:(A)loop) (x:A) (y:A). y IN (atom H L x) ==> atom H L x = atom H L y`, + REPEAT STRIP_TAC + THEN MATCH_MP_TAC SUBSET_ANTISYM + THEN STRIP_TAC + THENL[REWRITE_TAC[SUBSET; IN_ELIM_THM] + THEN GEN_TAC + THEN POP_ASSUM (MP_TAC o MATCH_MP atom_sym) + THEN REWRITE_TAC[IMP_IMP] + THEN ONCE_REWRITE_TAC[CONJ_SYM] + THEN DISCH_THEN (fun th -> REWRITE_TAC[MATCH_MP atom_trans th]); ALL_TAC] + THEN REWRITE_TAC[SUBSET; IN_ELIM_THM] + THEN GEN_TAC + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[IMP_IMP] + THEN ONCE_REWRITE_TAC[CONJ_SYM] + THEN DISCH_THEN (fun th2 -> REWRITE_TAC[MATCH_MP atom_trans th2]));; + +let lemma_atom_absorb_quark = prove(`!(H:(A)hypermap) (L:(A)loop) (x:A) (y:A). y IN (atom H L x) /\ next L y = inverse (node_map H) y + ==> (next L y) IN (atom H L x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) + THEN DISCH_THEN (fun th -> REWRITE_TAC[MATCH_MP lemma_identity_atom th]) + THEN REWRITE_TAC[atom; IN_ELIM_THM] + THEN DISJ1_TAC + THEN REWRITE_TAC[is_node_going] + THEN EXISTS_TAC `1` + THEN REWRITE_TAC[POWER_1] + THEN REPEAT STRIP_TAC + THEN ASM_CASES_TAC `i:num = 1` + THENL[POP_ASSUM SUBST1_TAC + THEN ASM_REWRITE_TAC[POWER_1]; ALL_TAC] + THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) + THEN REWRITE_TAC[IMP_IMP; GSYM LT_LE] + THEN REWRITE_TAC[ARITH_RULE `!i:num. i < 1 <=> i = 0`] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[POWER_0]);; + +let lemma_second_absorb_quark = prove(`!(H:(A)hypermap) (L:(A)loop) (x:A) (y:A). y IN (atom H L x) /\ y = inverse (node_map H) (back L y) ==> (back L y) IN (atom H L x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) + THEN DISCH_THEN (fun th -> REWRITE_TAC[MATCH_MP lemma_identity_atom th]) + THEN REWRITE_TAC[atom; IN_ELIM_THM] + THEN DISJ2_TAC + THEN REWRITE_TAC[is_node_going] + THEN EXISTS_TAC `1` + THEN REWRITE_TAC[POWER_1] + THEN REWRITE_TAC[lemma_inverse_evaluation] + THEN REPEAT STRIP_TAC + THEN ASM_CASES_TAC `i:num = 1` + THENL[POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[POWER_1] + THEN REWRITE_TAC[lemma_inverse_evaluation] + THEN ASM_MESON_TAC[]; ALL_TAC] + THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) + THEN REWRITE_TAC[IMP_IMP; GSYM LT_LE] + THEN REWRITE_TAC[ARITH_RULE `!i:num. i < 1 <=> i = 0`] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[POWER_0] );; + +let next_and_loop_darts = prove(`!L:(A)loop. FINITE(dart_of L) /\ (next L permutes dart_of L)`, MESON_TAC[loop_lemma]);; + +let back_and_loop_darts = prove(`!L:(A)loop. FINITE(dart_of L) /\ (back L permutes dart_of L)`, MESON_TAC[loop_lemma; lemma_permute_loop]);; + +let lemma_border_of_atom = prove(`!(H:(A)hypermap) (L:(A)loop).(?h:A->A t:A->A.(!x:A. (x belong L /\ (?y:A z:A. y belong L /\ z belong L /\ ~(node H y = node H z))) ==> (h x) IN (atom H L x) /\ (t x) IN (atom H L x) /\ ~((next L (h x)) = (inverse (node_map H)) (h x)) /\ ~(t x = (inverse (node_map H)) (back L (t x)))))`, + REPEAT GEN_TAC + THEN REWRITE_TAC [GSYM SKOLEM_THM] + THEN GEN_TAC + THEN REWRITE_TAC[RIGHT_EXISTS_IMP_THM] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F2") (X_CHOOSE_THEN `y:A` (X_CHOOSE_THEN `z:A` (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2(LABEL_TAC "F4") (LABEL_TAC "F5")))))) + THEN SUBGOAL_THEN `?a:A. a IN (atom (H:(A)hypermap) (L:(A)loop) (x:A)) /\ ~(next L a = (inverse (node_map H)) a)` (LABEL_TAC "F4") + THENL[ONCE_REWRITE_TAC[TAUT `A <=> (~A ==> F)`] + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [NOT_EXISTS_THM] + THEN GEN_REWRITE_TAC (LAND_CONV o TOP_DEPTH_CONV) [DE_MORGAN_THM; TAUT `~ ~A = A`; TAUT `(~A \/ B) <=> (A==>B)`] + THEN DISCH_THEN (LABEL_TAC "G1") + THEN REMOVE_THEN "F5" MP_TAC + THEN REWRITE_TAC[] + THEN SUBGOAL_THEN `dart_of (L:(A)loop) = atom (H:(A)hypermap) L (x:A)` (LABEL_TAC "G2") + THENL[SUBGOAL_THEN `!k:num. ((next (L:(A)loop)) POWER k) (x:A) IN (atom (H:(A)hypermap) L x)` ASSUME_TAC + THENL[INDUCT_TAC + THENL[REWRITE_TAC[POWER_0; I_THM; node; atom_reflect]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "G2") + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN USE_THEN "G2" (fun th1 -> (USE_THEN "G1" (fun th2 -> (MP_TAC(MATCH_MP th2 th1))))) + THEN (USE_THEN "G2" (fun th2-> (DISCH_THEN (fun th3 -> (REWRITE_TAC[MATCH_MP lemma_atom_absorb_quark (CONJ th2 th3)]))))); ALL_TAC] + THEN MATCH_MP_TAC SUBSET_ANTISYM + THEN USE_THEN "F2" (fun th2 -> REWRITE_TAC[MATCH_MP lemma_atom_sub_loop th2]) + THEN REWRITE_TAC[SUBSET; GSYM belong] + THEN GEN_TAC + THEN USE_THEN "F2" (fun th2-> (DISCH_THEN (fun th3-> (MP_TAC (MATCH_MP lemma_next_power_representation (CONJ th2 th3)))))) + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` (SUBST1_TAC o CONJUNCT2)) + THEN POP_ASSUM (fun th -> REWRITE_TAC[SPEC `k:num` th]); ALL_TAC] + THEN REMOVE_THEN "F3" (LABEL_TAC "F3" o REWRITE_RULE[belong]) + THEN REMOVE_THEN "F4" (LABEL_TAC "F4" o REWRITE_RULE[belong]) + THEN REMOVE_THEN "G2" SUBST_ALL_TAC + THEN LABEL_TAC "G3" (SPECL[`H:(A)hypermap`; `L:(A)loop`; `x:A`] lemma_atom_sub_node) + THEN USE_THEN "F3" (fun th1 -> (USE_THEN "G3" (fun th2 -> (MP_TAC(MATCH_MP lemma_in_subset (CONJ th2 th1)))))) + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM(MATCH_MP lemma_node_identity th)]) + THEN USE_THEN "F4" (fun th1 -> (USE_THEN "G3" (fun th2 -> (MP_TAC(MATCH_MP lemma_in_subset (CONJ th2 th1)))))) + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM(MATCH_MP lemma_node_identity th)]); ALL_TAC] + THEN POP_ASSUM (X_CHOOSE_THEN `h:A` ASSUME_TAC) + THEN EXISTS_TAC `h:A` + THEN POP_ASSUM (fun th -> SIMP_TAC[th]) + THEN ONCE_REWRITE_TAC[TAUT `A <=> (~A ==> F)`] + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [NOT_EXISTS_THM] + THEN GEN_REWRITE_TAC (LAND_CONV o TOP_DEPTH_CONV) [DE_MORGAN_THM; TAUT `~ ~A = A`; TAUT `(~A \/ B) <=> (A==>B)`] + THEN DISCH_THEN (LABEL_TAC "G1") + THEN REMOVE_THEN "F5" MP_TAC + THEN REWRITE_TAC[] + THEN SUBGOAL_THEN `dart_of (L:(A)loop) = atom (H:(A)hypermap) L (x:A)` (LABEL_TAC "G2") + THENL[SUBGOAL_THEN `!k:num. ((back (L:(A)loop)) POWER k) (x:A) IN (atom (H:(A)hypermap) L x)` ASSUME_TAC + THENL[INDUCT_TAC + THENL[REWRITE_TAC[POWER_0; I_THM; node; atom_reflect]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "G2") + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN USE_THEN "G2" (fun th1 -> (USE_THEN "G1" (fun th2 -> (MP_TAC(MATCH_MP th2 th1))))) + THEN (USE_THEN "G2" (fun th2-> (DISCH_THEN (fun th3 -> (REWRITE_TAC[MATCH_MP lemma_second_absorb_quark (CONJ th2 th3)]))))); ALL_TAC] + THEN MATCH_MP_TAC SUBSET_ANTISYM + THEN USE_THEN "F2" (fun th2 -> REWRITE_TAC[MATCH_MP lemma_atom_sub_loop th2]) + THEN REWRITE_TAC[SUBSET; GSYM belong] + THEN GEN_TAC + THEN USE_THEN "F2" (fun th2-> (DISCH_THEN (fun th3-> (MP_TAC (MATCH_MP lemma_next_power_representation (CONJ th2 th3) ))))) + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` (MP_TAC o CONJUNCT2)) + THEN ONCE_REWRITE_TAC[lemma_inverse_on_loop] + THEN MP_TAC (SPEC `k:num` (MATCH_MP power_inverse_element_lemma (SPEC `L:(A)loop` back_and_loop_darts))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` SUBST1_TAC) + THEN DISCH_THEN SUBST1_TAC + THEN POP_ASSUM (fun th -> REWRITE_TAC[SPEC `j:num` th]); ALL_TAC] + THEN REMOVE_THEN "F3" (LABEL_TAC "F3" o REWRITE_RULE[belong]) + THEN REMOVE_THEN "F4" (LABEL_TAC "F4" o REWRITE_RULE[belong]) + THEN REMOVE_THEN "G2" SUBST_ALL_TAC + THEN LABEL_TAC "G3" (SPECL[`H:(A)hypermap`; `L:(A)loop`; `x:A`] lemma_atom_sub_node) + THEN USE_THEN "F3" (fun th1 -> (USE_THEN "G3" (fun th2 -> (MP_TAC(MATCH_MP lemma_in_subset (CONJ th2 th1)))))) + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM(MATCH_MP lemma_node_identity th)]) + THEN USE_THEN "F4" (fun th1 -> (USE_THEN "G3" (fun th2 -> (MP_TAC(MATCH_MP lemma_in_subset (CONJ th2 th1)))))) + THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM(MATCH_MP lemma_node_identity th)]));; + +(* The definition of quotient hypermaps *) + +let is_normal = new_definition `!(H:(A)hypermap) (NF:(A)loop -> bool). is_normal H NF +<=> (!(L:(A)loop). L IN NF ==> ((is_loop H L) /\ (?x:A. x IN dart H /\ x belong L))) /\ + (!(L:(A)loop). L IN NF ==> (?y:A z:A. y belong L /\ z belong L /\ ~(node H y = node H z ))) /\ + (!(L:(A)loop) (L':(A)loop) (x:A). L IN NF /\ L' IN NF /\ x belong L /\ x belong L' ==> L = L') /\ + (!(L:(A)loop) x:A y:A. L IN NF /\ x belong L /\ y IN node H x ==> ?L':(A)loop. L' IN NF /\ y belong L') `;; + +let lemm_nornal_loop_sub_dart = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop). is_normal H NF /\ L IN NF ==> (dart_of L) SUBSET dart H`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (MP_TAC o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]) ASSUME_TAC) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC (X_CHOOSE_THEN `x:A` MP_TAC)) + THEN POP_ASSUM (fun th1 -> (DISCH_THEN (fun th2-> REWRITE_TAC[MATCH_MP support_loop_sub_dart (CONJ th1 th2)]))));; + + +let quotient_darts = new_definition `!(H:(A)hypermap) (NF:(A)loop->bool). quotient_darts H NF = {atom H L x | (L:(A)loop) (x:A) | L IN NF /\ x belong L}`;; + +let support_darts = new_definition `!(NF:(A)loop->bool). support_darts NF = UNIONS {dart_of (L:(A)loop) | L IN NF}`;; + +let lemma_in_loop = prove(`!(H:(A)hypermap) (L:(A)loop) (x:A) (y:A). x belong L /\ y IN atom H L x ==> y belong L`, + REPEAT STRIP_TAC + THEN REWRITE_TAC[belong] + THEN MATCH_MP_TAC lemma_in_subset + THEN EXISTS_TAC `atom (H:(A)hypermap) (L:(A)loop) (x:A)` + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN MATCH_MP_TAC lemma_atom_sub_loop + THEN ASM_REWRITE_TAC[]);; + +let lemma_in_dart = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_normal H NF /\ L IN NF /\ x belong L ==> x IN dart H`, + REPEAT STRIP_TAC + THEN MATCH_MP_TAC lemma_in_subset + THEN EXISTS_TAC `dart_of (L:(A)loop)` + THEN POP_ASSUM (fun th-> REWRITE_TAC[GSYM belong; th]) + THEN POP_ASSUM(fun th1->(POP_ASSUM(fun th -> REWRITE_TAC[MATCH_MP lemm_nornal_loop_sub_dart (CONJ th th1)]))));; + +let lemma_support_and_atoms = prove(`!(H:(A)hypermap) (NF:(A)loop->bool). is_normal H NF ==> support_darts NF = UNIONS (quotient_darts H NF)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN CONV_TAC SYM_CONV + THEN REWRITE_TAC[support_darts; quotient_darts] + THEN MATCH_MP_TAC SUBSET_ANTISYM + THEN STRIP_TAC + THENL[REWRITE_TAC[SUBSET; IN_UNIONS; IN_ELIM_THM] + THEN REPEAT STRIP_TAC + THEN EXISTS_TAC `dart_of (L:(A)loop)` + THEN STRIP_TAC + THENL[EXISTS_TAC `L:(A)loop` THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN UNDISCH_THEN `t:A->bool = atom (H:(A)hypermap) (L:(A)loop) (x':A)` SUBST_ALL_TAC + THEN MATCH_MP_TAC lemma_in_subset + THEN EXISTS_TAC `atom (H:(A)hypermap) (L:(A)loop) (x':A)` + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th -> (REWRITE_TAC[MATCH_MP lemma_atom_sub_loop th])); ALL_TAC] + THEN REWRITE_TAC[SUBSET; IN_UNIONS; IN_ELIM_THM] + THEN REPEAT STRIP_TAC + THEN EXISTS_TAC `atom (H:(A)hypermap) (L:(A)loop) (x:A)` + THEN STRIP_TAC + THENL[EXISTS_TAC `L:(A)loop` + THEN EXISTS_TAC `x:A` + THEN POP_ASSUM MP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN ASM_REWRITE_TAC[GSYM belong]; ALL_TAC] + THEN REWRITE_TAC[atom_reflect]);; + +let lemma_finite_support = prove(`!(H:(A)hypermap) (NF:(A)loop->bool). is_normal H NF ==> support_darts NF SUBSET dart H /\ FINITE (support_darts NF)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN SUBGOAL_THEN `support_darts (NF:(A)loop->bool) SUBSET dart H` ASSUME_TAC + THENL[REWRITE_TAC[support_darts; SUBSET; IN_UNIONS; IN_ELIM_THM] + THEN REPEAT STRIP_TAC + THEN POP_ASSUM MP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN POP_ASSUM (fun th2 -> (POP_ASSUM (fun th1 -> MP_TAC (MATCH_MP lemm_nornal_loop_sub_dart (CONJ th1 th2))))) + THEN REWRITE_TAC[IMP_IMP] + THEN REWRITE_TAC[lemma_in_subset]; ALL_TAC] + THEN ASM_REWRITE_TAC[] + THEN MATCH_MP_TAC FINITE_SUBSET + THEN EXISTS_TAC `dart (H:(A)hypermap)` + THEN ASM_REWRITE_TAC[hypermap_lemma]);; + +let lemma_in_support2 = prove(`!(NF:(A)loop->bool) L:(A)loop (x:A). x belong L /\ L IN NF ==> x IN support_darts NF`, + REWRITE_TAC[belong; support_darts] THEN SET_TAC[]);; + +let lemma_in_support = prove(`!(NF:(A)loop->bool) (x:A). x IN support_darts NF <=> ?L:(A)loop. L IN NF /\ x belong L`, + REPEAT GEN_TAC + THEN EQ_TAC + THENL[REWRITE_TAC[support_darts; IN_UNIONS; IN_ELIM_THM] + THEN REPEAT STRIP_TAC + THEN EXISTS_TAC `L:(A)loop` + THEN POP_ASSUM MP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[GSYM belong] + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN MESON_TAC[lemma_in_support2]);; + +let lemma_node_in_support2 = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) x:A n:num. is_normal H NF /\ x IN support_darts NF ==> ((node_map H) POWER n) x IN support_darts NF`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") MP_TAC) + THEN SPEC_TAC (`n:num`, `n:num`) + THEN INDUCT_TAC + THENL[REWRITE_TAC[POWER_0; I_THM] THEN SIMP_TAC[]; ALL_TAC] + THEN DISCH_TAC + THEN FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F2") + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN ABBREV_TAC `y = ((node_map (H:(A)hypermap)) POWER (n:num)) (x:A)` + THEN REMOVE_THEN "F2" (MP_TAC o REWRITE_RULE[lemma_in_support]) + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN MP_TAC (SPECL[`node_map (H:(A)hypermap)`; `1`; `y:A`] lemma_in_orbit) + THEN REWRITE_TAC[POWER_1; GSYM node] + THEN DISCH_TAC + THEN USE_THEN "F1" (MP_TAC o SPECL[`L:(A)loop`; `y:A`; `node_map (H:(A)hypermap) (y:A)`] o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_normal]) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (X_CHOOSE_THEN `L':(A)loop` (MP_TAC o ONCE_REWRITE_RULE[CONJ_SYM])) + THEN REWRITE_TAC[lemma_in_support2]);; + +let lemma_loop_outside_node = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). + is_normal H NF /\ L IN NF ==> ~(dart_of L SUBSET node H x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (MP_TAC o SPEC `L:(A)loop` o CONJUNCT1 o CONJUNCT2 o REWRITE_RULE[is_normal]) (ASSUME_TAC)) + THEN ASM_REWRITE_TAC[] + THEN ONCE_REWRITE_TAC[TAUT `(A ==> ~B) <=> (B ==> ~A)`] + THEN REWRITE_TAC[NOT_EXISTS_THM; TAUT `~(A /\ B /\ ~C) <=> (A /\ B ==> C)`] + THEN DISCH_TAC + THEN REPEAT GEN_TAC + THEN REWRITE_TAC[belong] + THEN POP_ASSUM (fun th -> (DISCH_THEN (CONJUNCTS_THEN2 (fun th1 -> (ASSUME_TAC (MATCH_MP lemma_in_subset (CONJ th th1)))) (fun th2 -> (ASSUME_TAC (MATCH_MP lemma_in_subset (CONJ th th2))))))) + THEN REPLICATE_TAC 2 (POP_ASSUM (SUBST1_TAC o SYM o MATCH_MP lemma_node_identity)) + THEN SIMP_TAC[]);; + +let lemma_size_of_normal_loop = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop). is_normal H NF /\ L IN NF ==> 2 <= size L`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN USE_THEN "F2" (fun th -> (USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN DISCH_THEN (LABEL_TAC "F3" o CONJUNCT1) + THEN USE_THEN "F1" (MP_TAC o SPEC `L:(A)loop` o CONJUNCT1 o CONJUNCT2 o REWRITE_RULE[is_normal]) + THEN ASM_REWRITE_TAC[belong] + THEN DISCH_THEN (X_CHOOSE_THEN `x:A` (X_CHOOSE_THEN `y:A` STRIP_ASSUME_TAC)) + THEN SUBGOAL_THEN `~(x:A = y:A)` ASSUME_TAC + THENL[POP_ASSUM MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN MESON_TAC[]; ALL_TAC] + THEN REWRITE_TAC[size] + THEN MATCH_MP_TAC CARD_ATLEAST_2 + THEN EXISTS_TAC `x:A` THEN EXISTS_TAC `y:A` + THEN ASM_REWRITE_TAC[loop_lemma]);; + +let disjoint_loops = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (L':(A)loop) (x:A). + is_normal H NF /\ L IN NF /\ L' IN NF /\ x belong L /\ x belong L' ==> L = L'`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (ASSUME_TAC) MP_TAC) + THEN POP_ASSUM (fun th-> MESON_TAC[CONJUNCT1(CONJUNCT2(CONJUNCT2(REWRITE_RULE[is_normal] th)))]));; + +let lemma_choice_function = prove(`!(H:(A)hypermap) (NF:(A)loop->bool). ?choice_function: A->(A->bool). !x:A. is_normal H NF ==> ((~(x IN support_darts NF) ==> choice_function x = {x}) /\ (x IN support_darts NF ==> (?L:(A)loop. L IN NF /\ x belong L /\ choice_function x = atom H L x)))`, + REPEAT GEN_TAC + THEN REWRITE_TAC[GSYM SKOLEM_THM] + THEN GEN_TAC + THEN REWRITE_TAC[RIGHT_EXISTS_IMP_THM] + THEN DISCH_THEN (LABEL_TAC "F1") + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[MATCH_MP lemma_support_and_atoms th]) + THEN ASM_CASES_TAC `~(x:A IN UNIONS (quotient_darts (H:(A)hypermap) (NF:(A)loop->bool)))` + THENL[EXISTS_TAC `{x:A}` + THEN POP_ASSUM(fun th -> SIMP_TAC[th]); ALL_TAC] + THEN POP_ASSUM (ASSUME_TAC o REWRITE_RULE[]) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[quotient_darts; IN_UNIONS; IN_ELIM_THM]) + THEN DISCH_THEN (X_CHOOSE_THEN `t:A->bool` (CONJUNCTS_THEN2 MP_TAC (LABEL_TAC "F2" ))) + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")) (LABEL_TAC "F5")))) + THEN ONCE_REWRITE_TAC[SWAP_EXISTS_THM] + THEN EXISTS_TAC `L:(A)loop` + THEN EXISTS_TAC `t:A->bool` + THEN POP_ASSUM SUBST_ALL_TAC + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F1" (fun th -> (MP_TAC (SPEC `L:(A)loop`(CONJUNCT1 (REWRITE_RULE[is_normal] th))))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "F5" o CONJUNCT1) + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[MATCH_MP lemma_identity_atom th]) + THEN MATCH_MP_TAC lemma_in_loop + THEN ASM_MESON_TAC[]);; + +let lemma_choice = new_specification ["choice"] (REWRITE_RULE[SKOLEM_THM] lemma_choice_function);; + +let first_unique_choice = prove(`!(H:(A)hypermap) (NF:(A)loop->bool). is_normal H NF ==> (!x:A. ~(x IN support_darts NF) ==> choice H NF x = {x}) +/\ (!L:(A)loop x:A. L IN NF /\ x belong L ==> choice H NF x = atom H L x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN STRIP_TAC + THENL[POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP lemma_choice th]); ALL_TAC] + THEN REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3")) + THEN USE_THEN "F2"(fun th ->(USE_THEN "F3" (fun th1-> (ASSUME_TAC(MATCH_MP lemma_in_support2 (CONJ th1 th)))))) + THEN USE_THEN "F1" (fun th-> MP_TAC(CONJUNCT2(SPEC `x:A` (MATCH_MP lemma_choice th)))) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (X_CHOOSE_THEN `L':(A)loop` (CONJUNCTS_THEN2 (ASSUME_TAC) (CONJUNCTS_THEN2 (LABEL_TAC "F4") SUBST1_TAC))) + THEN SUBGOAL_THEN `L' = L:(A)loop` SUBST_ALL_TAC + THENL[MATCH_MP_TAC disjoint_loops THEN ASM_MESON_TAC[]; ALL_TAC] + THEN SIMP_TAC[]);; + +let unique_choice = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_normal H NF /\ L IN NF /\ x belong L ==> choice H NF x = atom H L x`, + REPEAT STRIP_TAC + THEN UNDISCH_THEN `is_normal (H:(A)hypermap) (NF:(A)loop->bool)` (MP_TAC o SPECL[`L:(A)loop`; `x:A`] o CONJUNCT2 o MATCH_MP first_unique_choice) + THEN ASM_REWRITE_TAC[]);; + +let lemma_in_quotient = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). L IN NF /\ x belong L ==> (atom H L x) IN (quotient_darts H NF)`, + REPEAT STRIP_TAC + THEN REWRITE_TAC[quotient_darts; IN_ELIM_THM] + THEN EXISTS_TAC `L:(A)loop` + THEN EXISTS_TAC `x:A` + THEN ASM_REWRITE_TAC[]);; + +let lemma_finite_quotient_darts = prove(`!(H:(A)hypermap) (NF:(A)loop->bool). is_normal H NF ==> FINITE (quotient_darts H NF)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN SUBGOAL_THEN `IMAGE (choice (H:(A)hypermap) (NF:(A)loop->bool)) (support_darts NF) = quotient_darts H NF` ASSUME_TAC + THENL[REWRITE_TAC[IMAGE; EXTENSION; IN_ELIM_THM] + THEN GEN_TAC + THEN REWRITE_TAC[GSYM EXTENSION] + THEN EQ_TAC + THENL[DISCH_THEN (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (MP_TAC o REWRITE_RULE[lemma_in_support]) (SUBST1_TAC))) + THEN DISCH_THEN (X_CHOOSE_THEN `L':(A)loop` (LABEL_TAC "F2")) + THEN USE_THEN "F1" (ASSUME_TAC o CONJUNCT2 o MATCH_MP first_unique_choice) + THEN POP_ASSUM (fun th-> (USE_THEN "F2" (fun th1-> REWRITE_TAC[MATCH_MP th th1]))) + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP lemma_in_quotient th]); ALL_TAC] + THEN REWRITE_TAC[quotient_darts; IN_ELIM_THM] + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "G1") (LABEL_TAC "G2")) (SUBST1_TAC)))) + THEN USE_THEN "G1" (fun th-> (USE_THEN "G2" (fun th1-> (MP_TAC (MATCH_MP lemma_in_support2 (CONJ th1 th)))))) + THEN DISCH_TAC + THEN EXISTS_TAC `y:A` + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F1" (MP_TAC o SPECL[`L:(A)loop`; `y:A`] o CONJUNCT2 o MATCH_MP first_unique_choice) + THEN ASM_REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN MATCH_MP_TAC FINITE_IMAGE + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[MATCH_MP lemma_finite_support th]));; + +let lemma_finite_normal_loops = prove(`!H:(A)hypermap NF:(A)loop->bool. is_normal H NF ==> FINITE NF /\ CARD NF <= CARD (dart H)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN SUBGOAL_THEN `?f:A->(A)loop. !x:A. (x IN support_darts NF ==> ?L:(A)loop. L IN NF /\ x belong L /\ f x = L)` MP_TAC + THENL[REWRITE_TAC[GSYM SKOLEM_THM] + THEN GEN_TAC + THEN REWRITE_TAC[GSYM RIGHT_IMP_EXISTS_THM] + THEN REWRITE_TAC[lemma_in_support] + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "G1") (LABEL_TAC "G2"))) + THEN REWRITE_TAC[SWAP_EXISTS_THM] + THEN EXISTS_TAC `L:(A)loop` + THEN EXISTS_TAC `L:(A)loop` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN DISCH_THEN (X_CHOOSE_THEN `f:A->(A)loop` (LABEL_TAC "F2")) + THEN SUBGOAL_THEN `IMAGE (f:A->(A)loop) (support_darts (NF:(A)loop->bool)) = NF` (SUBST1_TAC o SYM) + THENL[REWRITE_TAC[IMAGE; EXTENSION; IN_ELIM_THM] + THEN GEN_TAC + THEN EQ_TAC + THENL[ DISCH_THEN (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 MP_TAC SUBST1_TAC)) + THEN DISCH_THEN (fun th-> (USE_THEN "F2" (fun thm -> MP_TAC(MATCH_MP thm th)))) + THEN DISCH_THEN (X_CHOOSE_THEN `L':(A)loop` (CONJUNCTS_THEN2 ASSUME_TAC (SUBST1_TAC o CONJUNCT2))) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN DISCH_THEN (LABEL_TAC "F3") + THEN USE_THEN "F3" (fun th -> USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o SPEC `x:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal])) + THEN DISCH_THEN (MP_TAC o CONJUNCT2) + THEN DISCH_THEN (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5"))) + THEN EXISTS_TAC `y:A` + THEN USE_THEN "F3" (fun th-> (USE_THEN "F5" (fun th1-> (ASSUME_TAC (MATCH_MP lemma_in_support2 (CONJ th1 th)))))) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM (fun th-> (USE_THEN "F2" (fun thm -> MP_TAC(MATCH_MP thm th)))) + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (CONJUNCTS_THEN2 ASSUME_TAC (CONJUNCTS_THEN2 ASSUME_TAC SUBST1_TAC))) + THEN MATCH_MP_TAC disjoint_loops + THEN EXISTS_TAC `H:(A)hypermap` THEN EXISTS_TAC `NF:(A)loop->bool` THEN EXISTS_TAC `y:A` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN USE_THEN "F1" (fun th -> ((CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")) (MATCH_MP lemma_finite_support th))) + THEN STRIP_TAC + THENL[MATCH_MP_TAC FINITE_IMAGE THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN MATCH_MP_TAC LE_TRANS + THEN EXISTS_TAC `CARD (support_darts (NF:(A)loop->bool))` + THEN USE_THEN "F4" (fun th-> REWRITE_TAC[MATCH_MP CARD_IMAGE_LE th]) + THEN MATCH_MP_TAC CARD_SUBSET + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[th; hypermap_lemma]));; + +let lemma_border_of_atom2 = prove(`!(H:(A)hypermap) (NF:(A)loop->bool). ?(h:A->A) (t:A->A).(!x:A. is_normal H NF ==> (~(x IN support_darts NF) ==> h x = x /\ t x = x) /\ (x IN support_darts NF ==> (?L:(A)loop. L IN NF /\ x belong L /\ (h x) IN (atom H L x) /\ ~(next L (h x) = inverse (node_map H) (h x)) /\ (t x) IN (atom H L x) /\ ~(t x = inverse (node_map H) (back L (t x))))))`, + REPEAT GEN_TAC + THEN ONCE_REWRITE_TAC[RIGHT_FORALL_IMP_THM] + THEN REPLICATE_TAC 2 (ONCE_REWRITE_TAC[RIGHT_EXISTS_IMP_THM]) + THEN DISCH_THEN (LABEL_TAC "F1") + THEN REWRITE_TAC[GSYM SKOLEM_THM] + THEN GEN_TAC + THEN ASM_CASES_TAC `~(x:A IN support_darts (NF:(A)loop->bool))` + THENL[EXISTS_TAC `x:A` + THEN EXISTS_TAC `x:A` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM (ASSUME_TAC o REWRITE_RULE[]) + THEN POP_ASSUM (fun th -> (REWRITE_TAC[th] THEN MP_TAC (REWRITE_RULE[lemma_in_support] th))) + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN MP_TAC(SPECL[`H:(A)hypermap`; `L:(A)loop`] lemma_border_of_atom) + THEN DISCH_THEN (X_CHOOSE_THEN `h1:A->A` (X_CHOOSE_THEN `t1:A->A` (MP_TAC o SPEC `x:A`))) + THEN ASM_REWRITE_TAC[] + THEN USE_THEN "F1" (MP_TAC o SPEC `L:(A)loop` o CONJUNCT1 o CONJUNCT2 o REWRITE_RULE[is_normal]) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th -> SIMP_TAC[th]) + THEN USE_THEN "F1" (MP_TAC o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th -> SIMP_TAC[th]) + THEN REPEAT STRIP_TAC + THEN EXISTS_TAC `(h1:A->A) (x:A)` + THEN EXISTS_TAC `(t1:A->A) (x:A)` + THEN EXISTS_TAC `L:(A)loop` + THEN ASM_REWRITE_TAC[]);; + +let lemma_head_tail = new_specification ["head"; "tail"] (REWRITE_RULE[SKOLEM_THM] lemma_border_of_atom2);; + +let lemma_unique_head = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A) (y:A). is_normal H NF /\ L IN NF /\ x belong L /\ y IN atom H L x /\ ~(next L y = inverse (node_map H) y) ==> head H NF x = y`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") +(LABEL_TAC "F5"))))) + THEN USE_THEN "F1" (MP_TAC o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]) + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F6" o CONJUNCT1) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT2 o SPEC `x:A` o MATCH_MP lemma_head_tail) + THEN USE_THEN "F3" (fun th1 -> (USE_THEN "F2" (fun th2 -> REWRITE_TAC[MATCH_MP lemma_in_support2 (CONJ th1 th2)]))) + THEN DISCH_THEN (X_CHOOSE_THEN `L':(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "F7") (CONJUNCTS_THEN2 (LABEL_TAC "F8") (CONJUNCTS_THEN2 (LABEL_TAC "F9") +(LABEL_TAC "F10" o CONJUNCT1))))) + THEN USE_THEN "F1" (MP_TAC o SPECL[`L':(A)loop`; `L:(A)loop`; `x:A`] o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_normal]) + THEN REMOVE_THEN "F8" (fun th -> REWRITE_TAC[th]) + THEN REMOVE_THEN "F7" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN SUBST_ALL_TAC + THEN ABBREV_TAC `z = head (H:(A)hypermap) (NF:(A)loop->bool) (x:A)` + THEN REMOVE_THEN "F4" (fun th2 -> (MP_TAC (MATCH_MP lemma_identity_atom th2))) + THEN DISCH_THEN SUBST_ALL_TAC + THEN REMOVE_THEN "F9" (MP_TAC o REWRITE_RULE[atom; IN_ELIM_THM; is_node_going]) + THEN STRIP_TAC + THENL[ASM_CASES_TAC `k:num = 0` + THENL[UNDISCH_TAC `z:A = ((next (L:(A)loop)) POWER (k:num)) (y:A)` + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[POWER_0; I_THM]; ALL_TAC] + THEN FIRST_X_ASSUM (MP_TAC o SPEC `1` o check (is_forall o concl)) + THEN POP_ASSUM (ASSUME_TAC o REWRITE_RULE[GSYM LT_NZ; GSYM LT1_NZ]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th; POWER_1]) + THEN USE_THEN "F5" (fun th -> SIMP_TAC[th]); ALL_TAC] + THEN ASM_CASES_TAC `k:num = 0` + THENL[UNDISCH_TAC `y:A = ((next (L:(A)loop)) POWER (k:num)) (z:A)` + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[POWER_0; I_THM; EQ_SYM]; ALL_TAC] + THEN FIRST_X_ASSUM (MP_TAC o SPEC `1` o check (is_forall o concl)) + THEN POP_ASSUM (ASSUME_TAC o REWRITE_RULE[GSYM LT_NZ; GSYM LT1_NZ]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th; POWER_1]) + THEN USE_THEN "F10" (fun th -> SIMP_TAC[th]));; + +let lemma_unique_tail = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A) (y:A). is_normal H NF /\ L IN NF /\ x belong L /\ y IN atom H L x /\ ~(y = inverse (node_map H) (back L y)) ==> tail H NF x = y`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") +(LABEL_TAC "F5"))))) + THEN USE_THEN "F1" (MP_TAC o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]) + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F6" o CONJUNCT1) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT2 o SPEC `x:A` o MATCH_MP lemma_head_tail) + THEN USE_THEN "F3" (fun th1 -> (USE_THEN "F2" (fun th2 -> REWRITE_TAC[MATCH_MP lemma_in_support2 (CONJ th1 th2)]))) + THEN DISCH_THEN (X_CHOOSE_THEN `L':(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "F7") (CONJUNCTS_THEN2 (LABEL_TAC "F8") (MP_TAC o CONJUNCT2 o CONJUNCT2)))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F9") (LABEL_TAC "F10")) + THEN USE_THEN "F1" (MP_TAC o SPECL[`L':(A)loop`; `L:(A)loop`; `x:A`] o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_normal]) + THEN REMOVE_THEN "F8" (fun th -> REWRITE_TAC[th]) + THEN REMOVE_THEN "F7" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN SUBST_ALL_TAC + THEN ABBREV_TAC `z = tail (H:(A)hypermap) (NF:(A)loop->bool) (x:A)` + THEN REMOVE_THEN "F4" (fun th2 -> (MP_TAC (MATCH_MP lemma_identity_atom th2))) + THEN DISCH_THEN SUBST_ALL_TAC + THEN REMOVE_THEN "F9" (MP_TAC o REWRITE_RULE[atom; IN_ELIM_THM; is_node_going]) + THEN STRIP_TAC + THENL[ASM_CASES_TAC `k:num = 0` + THENL[UNDISCH_TAC `z:A = ((next (L:(A)loop)) POWER (k:num)) (y:A)` + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[POWER_0; I_THM]; ALL_TAC] + THEN FIND_ASSUM (MP_TAC o AP_TERM `back (L:(A)loop)`) `z:A = ((next (L:(A)loop)) POWER (k:num)) (y:A)` + THEN POP_ASSUM (ASSUME_TAC o REWRITE_RULE[GSYM LT_NZ]) + THEN POP_ASSUM (fun th -> ONCE_REWRITE_TAC[MATCH_MP LT_SUC_PRE th] THEN ASSUME_TAC th) + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN REWRITE_TAC[lemma_inverse_evaluation] + THEN FIRST_ASSUM (MP_TAC o REWRITE_RULE[ARITH_RULE `PRE k <= k`] o SPEC `PRE k` o check (is_forall o concl)) + THEN DISCH_THEN (SUBST1_TAC) + THEN DISCH_THEN (MP_TAC o AP_TERM `inverse (node_map (H:(A)hypermap))`) + THEN REWRITE_TAC[iterate_map_valuation] + THEN POP_ASSUM (fun th -> ONCE_REWRITE_TAC[SYM(MATCH_MP LT_SUC_PRE th)]) + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[LE_REFL] o SPEC `k:num`) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN USE_THEN "F10" (fun th -> REWRITE_TAC[GSYM th]); ALL_TAC] + THEN ASM_CASES_TAC `k:num = 0` + THENL[UNDISCH_TAC `y:A = ((next (L:(A)loop)) POWER (k:num)) (z:A)` + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[POWER_0; I_THM; EQ_SYM]; ALL_TAC] + THEN FIND_ASSUM (MP_TAC o AP_TERM `back (L:(A)loop)`) `y:A = ((next (L:(A)loop)) POWER (k:num)) (z:A)` + THEN POP_ASSUM (ASSUME_TAC o REWRITE_RULE[GSYM LT_NZ]) + THEN POP_ASSUM (fun th -> ONCE_REWRITE_TAC[MATCH_MP LT_SUC_PRE th] THEN ASSUME_TAC th) + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN REWRITE_TAC[lemma_inverse_evaluation] + THEN FIRST_ASSUM (MP_TAC o REWRITE_RULE[ARITH_RULE `PRE k <= k`] o SPEC `PRE k` o check (is_forall o concl)) + THEN DISCH_THEN (SUBST1_TAC) + THEN DISCH_THEN (MP_TAC o AP_TERM `inverse (node_map (H:(A)hypermap))`) + THEN REWRITE_TAC[iterate_map_valuation] + THEN POP_ASSUM (fun th -> ONCE_REWRITE_TAC[SYM(MATCH_MP LT_SUC_PRE th)]) + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[LE_REFL] o SPEC `k:num`) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN USE_THEN "F5" (fun th -> REWRITE_TAC[GSYM th]));; + +let head_on_loop = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_normal H NF /\ L IN NF /\ x belong L + ==> head H NF x IN atom H L x /\ ~(next L (head H NF x) = inverse (node_map H) (head H NF x))`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "FC") + THEN USE_THEN "FC" (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN USE_THEN "F2"(fun th -> (USE_THEN "F3"(fun th1-> ASSUME_TAC (MATCH_MP lemma_in_support2 (CONJ th1 th))))) + THEN USE_THEN "F1"(fun th-> MP_TAC (CONJUNCT2(SPEC `x:A`(MATCH_MP lemma_head_tail th)))) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (X_CHOOSE_THEN `L':(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7" o CONJUNCT1))))) + THEN SUBGOAL_THEN `L':(A)loop = L:(A)loop` (SUBST_ALL_TAC) + THENL[MATCH_MP_TAC disjoint_loops + THEN EXISTS_TAC `H:(A)hypermap` THEN EXISTS_TAC `NF:(A)loop->bool` THEN EXISTS_TAC `x:A` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN ASM_REWRITE_TAC[]);; + +let tail_on_loop = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_normal H NF /\ L IN NF /\ x belong L + ==> tail H NF x IN atom H L x /\ ~(tail H NF x = inverse (node_map H) (back L (tail H NF x)))`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "FC") + THEN USE_THEN "FC" (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN USE_THEN "F2"(fun th -> (USE_THEN "F3"(fun th1-> ASSUME_TAC (MATCH_MP lemma_in_support2 (CONJ th1 th))))) + THEN USE_THEN "F1"(fun th-> MP_TAC (CONJUNCT2(SPEC `x:A`(MATCH_MP lemma_head_tail th)))) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (X_CHOOSE_THEN `L':(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (MP_TAC o CONJUNCT2 o CONJUNCT2)))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7")) + THEN SUBGOAL_THEN `L':(A)loop = L:(A)loop` (SUBST_ALL_TAC) + THENL[MATCH_MP_TAC disjoint_loops + THEN EXISTS_TAC `H:(A)hypermap` THEN EXISTS_TAC `NF:(A)loop->bool` THEN EXISTS_TAC `x:A` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN ASM_REWRITE_TAC[]);; + +let change_to_margin = prove( `!(H:(A)hypermap) (NF:(A)loop->bool) (x:A) (L:(A)loop). is_normal H NF /\ L IN NF /\ x belong L + ==> atom H L x = atom H L (tail H NF x) /\ atom H L x = atom H L (head H NF x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN USE_THEN "F1"(fun th->(USE_THEN "F2"(fun th1->(USE_THEN "F3"(fun th2->MP_TAC(CONJUNCT1(MATCH_MP head_on_loop (CONJ th (CONJ th1 th2))))))))) + THEN DISCH_THEN(fun th1->MP_TAC(MATCH_MP lemma_identity_atom th1)) + THEN USE_THEN "F1"(fun th->(USE_THEN "F2"(fun th1->(USE_THEN "F3"(fun th2->MP_TAC(CONJUNCT1(MATCH_MP tail_on_loop (CONJ th (CONJ th1 th2))))))))) + THEN DISCH_THEN(fun th1->MP_TAC(MATCH_MP lemma_identity_atom th1)) + THEN MESON_TAC[]);; + +let change_parameters = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A) (y:A). is_normal H NF /\ L IN NF /\ x belong L /\ y IN atom H L x + ==> head H NF y = head H NF x /\ tail H NF y = tail H NF x`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "FC") + THEN USE_THEN "FC" (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2")(CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")))) + THEN USE_THEN "F3"(fun th2->(USE_THEN "F4"(fun th3->LABEL_TAC "F6"(MATCH_MP lemma_in_loop (CONJ th2 th3))))) + THEN USE_THEN "F4"(fun th1->(LABEL_TAC "F7"(MATCH_MP lemma_identity_atom th1))) + THEN STRIP_TAC + THENL[MATCH_MP_TAC lemma_unique_head + THEN EXISTS_TAC `L:(A)loop` + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN USE_THEN "F1"(fun th->(USE_THEN "F2"(fun th1->(USE_THEN "F3"(fun th2-> REWRITE_TAC[MATCH_MP head_on_loop (CONJ th(CONJ th1 th2))]))))) + ; ALL_TAC] + THEN MATCH_MP_TAC lemma_unique_tail + THEN EXISTS_TAC `L:(A)loop` + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN USE_THEN "F1"(fun th->(USE_THEN "F2"(fun th1->(USE_THEN "F3"(fun th2-> REWRITE_TAC[MATCH_MP tail_on_loop (CONJ th(CONJ th1 th2))]))))));; + +let margin_in_loop = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_normal H NF /\ L IN NF /\ x belong L + ==> head H NF x belong L /\ tail H NF x belong L`, + REPEAT GEN_TAC THEN DISCH_TAC + THEN STRIP_TAC + THENL[MATCH_MP_TAC lemma_in_loop THEN EXISTS_TAC `H:(A)hypermap` THEN EXISTS_TAC `x:A` + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP head_on_loop th; CONJUNCT2(CONJUNCT2 th)]); ALL_TAC] + THEN MATCH_MP_TAC lemma_in_loop + THEN EXISTS_TAC `H:(A)hypermap` THEN EXISTS_TAC `x:A` + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP tail_on_loop th; CONJUNCT2(CONJUNCT2 th)]));; + +let lemma_map_next = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_normal H NF /\ L IN NF /\ x belong L /\ next L x IN atom H L x + ==> next L x = inverse (node_map H) x`, + REPEAT GEN_TAC + THEN DISCH_THEN(CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "FC")))) + THEN USE_THEN "F2" (fun th -> (USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN DISCH_THEN (LABEL_TAC "F4" o CONJUNCT1) + THEN USE_THEN "FC" (MP_TAC o REWRITE_RULE[atom; IN_ELIM_THM]) + THEN STRIP_TAC + THENL[POP_ASSUM (MP_TAC o REWRITE_RULE[is_node_going]) + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6"))) + THEN ASM_CASES_TAC `k:num = 0` + THENL[POP_ASSUM SUBST_ALL_TAC + THEN REMOVE_THEN "F5" (MP_TAC o REWRITE_RULE[POWER_0; I_THM]) + THEN DISCH_THEN (ASSUME_TAC o ONCE_REWRITE_RULE[SPEC `next (L:(A)loop)` orbit_one_point]) + THEN USE_THEN "F3"(fun th2->MP_TAC(MATCH_MP lemma_transitive_permutation th2)) + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_TAC + THEN SUBGOAL_THEN `dart_of (L:(A)loop) SUBSET node (H:(A)hypermap) (x:A)` MP_TAC + THENL[POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[SUBSET; IN_SING; node] + THEN GEN_TAC + THEN DISCH_THEN SUBST1_TAC THEN REWRITE_TAC[orbit_reflect]; ALL_TAC] + THEN USE_THEN "F1"(fun th->(USE_THEN "F2"(fun th1->REWRITE_TAC[MATCH_MP lemma_loop_outside_node (CONJ th th1)]))); ALL_TAC] + THEN REMOVE_THEN "F6" (MP_TAC o REWRITE_RULE[POWER_1; LT1_NZ; LT_NZ ] o SPEC `1`) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[is_node_going]) + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6"))) + THEN SUBGOAL_THEN `dart_of (L:(A)loop) SUBSET node (H:(A)hypermap) (x:A)` MP_TAC + THENL[MP_TAC (SPECL[`H:(A)hypermap`; `L:(A)loop`; `x:A`] lemma_atom_sub_node) + THEN USE_THEN "FC"(fun th->(DISCH_THEN(fun th1->MP_TAC(MATCH_MP lemma_in_subset (CONJ th1 th))))) + THEN DISCH_THEN(fun th->REWRITE_TAC[MATCH_MP lemma_node_identity th]) + THEN USE_THEN "F3" (fun th1-> (MP_TAC (SPEC `1` (MATCH_MP lemma_power_next_in_loop th1)))) + THEN REWRITE_TAC[POWER_1] + THEN DISCH_THEN(fun th2->MP_TAC(MATCH_MP lemma_transitive_permutation th2)) + THEN DISCH_THEN SUBST1_TAC + THEN REMOVE_THEN "F5" (MP_TAC o REWRITE_RULE[iterate_map_valuation] o SYM o AP_TERM `next (L:(A)loop)`) + THEN DISCH_THEN (fun th-> MP_TAC (REWRITE_RULE[LT_SUC_LE] (MATCH_MP orbit_cyclic (CONJ (SPEC `k:num` NON_ZERO) th)))) + THEN POP_ASSUM (MP_TAC o MATCH_MP lemma_two_series_eq) + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[SUBSET; IN_ELIM_THM] + THEN GEN_TAC + THEN DISCH_THEN (X_CHOOSE_THEN `i:num` (SUBST1_TAC o CONJUNCT2)) + THEN MP_TAC (SPEC `i:num` (MATCH_MP power_inverse_element_lemma (SPEC `H:(A)hypermap` node_map_and_darts))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (SUBST1_TAC)) + THEN REWRITE_TAC[node; lemma_in_orbit]; ALL_TAC] + THEN USE_THEN "F1"(fun th->(USE_THEN "F2"(fun th1->REWRITE_TAC[MATCH_MP lemma_loop_outside_node (CONJ th th1)]))));; + +let next_head_outside_atom = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_normal H NF /\ L IN NF /\ x belong L + ==> ~((next L (head H NF x)) IN (atom H L x))`, +REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "FC") + THEN USE_THEN "FC" (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN USE_THEN "F2" (fun th -> (USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN DISCH_THEN (LABEL_TAC "F4" o CONJUNCT1) + THEN USE_THEN "FC" ((CONJUNCTS_THEN2 (LABEL_TAC "F5") (MP_TAC)) o MATCH_MP head_on_loop) + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_TAC + THEN MATCH_MP_TAC lemma_map_next + THEN EXISTS_TAC `NF:(A)loop->bool` + THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC + THENL[MATCH_MP_TAC lemma_in_loop + THEN EXISTS_TAC `H:(A)hypermap` THEN EXISTS_TAC `x:A` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN USE_THEN "F5" (fun th2 -> (ONCE_REWRITE_TAC[GSYM (MATCH_MP lemma_identity_atom th2)])) + THEN POP_ASSUM (fun th2 -> (ONCE_REWRITE_TAC[MATCH_MP lemma_identity_atom th2])) + THEN REWRITE_TAC[atom_reflect]);; + +let value_next_of_head = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_normal H NF /\ L IN NF /\ x belong L ==> next L (head H NF x) = face_map H (head H NF x)`, + REPEAT GEN_TAC THEN DISCH_THEN (LABEL_TAC "FC") + THEN USE_THEN "FC" (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN REMOVE_THEN "FC"(fun th-> (MP_TAC (MATCH_MP head_on_loop th ))) + THEN DISCH_THEN (CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) + THEN REMOVE_THEN "F3"(fun th->(DISCH_THEN(fun th1->ASSUME_TAC(MATCH_MP lemma_in_loop (CONJ th th1))))) + THEN USE_THEN "F2" (fun th -> (USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN DISCH_THEN (MP_TAC o SPEC `head (H:(A)hypermap) (NF:(A)loop->bool) (x:A)` o REWRITE_RULE[is_loop] o CONJUNCT1) + THEN REWRITE_TAC[one_step_contour] + THEN ASM_REWRITE_TAC[]);; + +let back_tail_outside_atom = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_normal H NF /\ L IN NF /\ x belong L ==> ~((back L (tail H NF x)) IN (atom H L x))`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "FC") + THEN USE_THEN "FC" (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN USE_THEN "F2" (fun th -> (USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN DISCH_THEN (LABEL_TAC "F4" o CONJUNCT1) + THEN USE_THEN "FC" ((CONJUNCTS_THEN2 (LABEL_TAC "F5") (MP_TAC)) o MATCH_MP tail_on_loop) + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_TAC + THEN ABBREV_TAC `y = back (L:(A)loop) (tail (H:(A)hypermap) (NF:(A)loop->bool) (x:A))` + THEN POP_ASSUM (MP_TAC o AP_TERM `next (L:(A)loop)`) + THEN ONCE_REWRITE_TAC[lemma_inverse_evaluation] + THEN DISCH_THEN SUBST_ALL_TAC + THEN MATCH_MP_TAC lemma_map_next + THEN EXISTS_TAC `NF:(A)loop->bool` + THEN POP_ASSUM (LABEL_TAC "F6") + THEN USE_THEN "F6" (fun th2 -> (SUBST_ALL_TAC (SYM(MATCH_MP lemma_identity_atom th2)))) + THEN ASM_REWRITE_TAC[] + THEN MATCH_MP_TAC lemma_in_loop + THEN EXISTS_TAC `H:(A)hypermap` THEN EXISTS_TAC `x:A` THEN ASM_REWRITE_TAC[]);; + +let face_map_on_margin = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_normal H NF /\ L IN NF /\ x belong L ==> +face_map H (head H NF x) belong L /\ inverse (face_map H) (tail H NF x) belong L /\ face_map H (head H NF x) = tail H NF (face_map H (head H NF x)) +/\ inverse (face_map H) (tail H NF x) = head H NF (inverse (face_map H) (tail H NF x))`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "FC") + THEN USE_THEN "FC" (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN USE_THEN "F2" (fun th -> (USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN DISCH_THEN (LABEL_TAC "F4" o CONJUNCT1) + THEN USE_THEN "FC" ((CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6")) o MATCH_MP head_on_loop) + THEN ABBREV_TAC `y = head (H:(A)hypermap) (NF:(A)loop->bool) (x:A)` + THEN USE_THEN "F3"(fun th2->(REMOVE_THEN "F5"(fun th3->LABEL_TAC "F8" (MATCH_MP lemma_in_loop (CONJ th2 th3))))) + THEN USE_THEN "F8"(fun th-> (USE_THEN "F4"(MP_TAC o REWRITE_RULE[th; one_step_contour] o SPEC `y:A` o REWRITE_RULE[is_loop]))) + THEN USE_THEN "F6" (fun th -> SIMP_TAC[th]) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN USE_THEN "F8" (fun th1-> (MP_TAC (SPEC `1` (MATCH_MP lemma_power_next_in_loop th1)))) + THEN REWRITE_TAC[POWER_1] + THEN DISCH_THEN (fun th -> (REWRITE_TAC[th] THEN LABEL_TAC "F9" th)) + THEN SUBGOAL_THEN `next (L:(A)loop) (y:A) = tail (H:(A)hypermap) (NF:(A)loop->bool) (next L y)` (LABEL_TAC "F10") + THENL[CONV_TAC SYM_CONV + THEN MATCH_MP_TAC lemma_unique_tail + THEN EXISTS_TAC `L:(A)loop` + THEN ONCE_REWRITE_TAC[lemma_inverse_evaluation] + THEN ASM_REWRITE_TAC[atom_reflect]; ALL_TAC] + THEN REMOVE_THEN "F10" (SUBST1_TAC o SYM) + THEN SIMP_TAC[] + THEN USE_THEN "FC" ((CONJUNCTS_THEN2 (LABEL_TAC "F11") (LABEL_TAC "F12")) o MATCH_MP tail_on_loop) + THEN ABBREV_TAC `z = tail (H:(A)hypermap) (NF:(A)loop->bool) (x:A)` + THEN USE_THEN "F3"(fun th2->(REMOVE_THEN "F11"(fun th3->LABEL_TAC "F14" (MATCH_MP lemma_in_loop (CONJ th2 th3))))) + THEN USE_THEN "F14" (fun th1-> (MP_TAC (SPEC `1` (MATCH_MP lemma_power_back_in_loop th1)))) + THEN REWRITE_TAC[POWER_1] + THEN DISCH_THEN (LABEL_TAC "F15") + THEN USE_THEN "F15"(fun th-> (USE_THEN "F4"(MP_TAC o REWRITE_RULE[th; one_step_contour] o SPEC `back (L:(A)loop) (z:A)` o REWRITE_RULE[is_loop]))) + THEN ONCE_REWRITE_TAC[lemma_inverse_evaluation] + THEN REWRITE_TAC[one_step_contour] + THEN USE_THEN "F12" (fun th -> SIMP_TAC[th]) + THEN REWRITE_TAC[face_map_inverse_representation] + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN USE_THEN "F15" (fun th->REWRITE_TAC[th]) + THEN CONV_TAC SYM_CONV + THEN MATCH_MP_TAC lemma_unique_head + THEN EXISTS_TAC `L:(A)loop` + THEN ONCE_REWRITE_TAC[lemma_inverse_evaluation] + THEN ASM_REWRITE_TAC[atom_reflect]);; + +let node_map_on_margin = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_normal H NF /\ L IN NF /\ x belong L ==> (?L':(A)loop. L' IN NF /\ node_map H (tail H NF x) belong L' /\ node_map H (tail H NF x) = head H NF (node_map H (tail H NF x))) +/\ (?P:(A)loop. P IN NF /\ inverse (node_map H) (head H NF x) belong P /\ inverse (node_map H) (head H NF x) = tail H NF (inverse (node_map H) (head H NF x)))`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "FC") + THEN USE_THEN "FC" (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN USE_THEN "F2" (fun th -> (USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN DISCH_THEN (LABEL_TAC "F4" o CONJUNCT1) + THEN STRIP_TAC + THENL[USE_THEN "FC" ((CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6")) o MATCH_MP tail_on_loop) + THEN ABBREV_TAC `y = tail (H:(A)hypermap) (NF:(A)loop->bool) (x:A)` + THEN USE_THEN "F3"(fun th2->(REMOVE_THEN "F5"(fun th3->LABEL_TAC "F8" (MATCH_MP lemma_in_loop (CONJ th2 th3))))) + THEN USE_THEN "F8"(fun th1->(USE_THEN "F2"(fun th2->(MP_TAC (MATCH_MP lemma_in_support2 (CONJ th1 th2)))))) + THEN USE_THEN "F1"(fun th1->(DISCH_THEN(fun th2->(MP_TAC (SPEC `1` (MATCH_MP lemma_node_in_support2 (CONJ th1 th2))))))) + THEN REWRITE_TAC[POWER_1; lemma_in_support] + THEN DISCH_THEN (X_CHOOSE_THEN `L':(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "F9") (LABEL_TAC "F10"))) + THEN EXISTS_TAC `L':(A)loop` + THEN ASM_REWRITE_TAC[] + THEN CONV_TAC SYM_CONV + THEN MATCH_MP_TAC lemma_unique_head + THEN EXISTS_TAC `L':(A)loop` + THEN ASM_REWRITE_TAC[atom_reflect] + THEN REMOVE_THEN "F6" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN REWRITE_TAC[MATCH_MP PERMUTES_INVERSES (CONJUNCT2(SPEC `H:(A)hypermap` node_map_and_darts))] + THEN DISCH_TAC + THEN USE_THEN "F10" (fun th1-> (MP_TAC (SPEC `1` (MATCH_MP lemma_power_next_in_loop th1)))) + THEN REWRITE_TAC[POWER_1] + THEN POP_ASSUM (fun th -> SUBST1_TAC th THEN LABEL_TAC "F11" th) + THEN DISCH_TAC + THEN SUBGOAL_THEN `L':(A)loop = L:(A)loop` SUBST_ALL_TAC + THENL[MATCH_MP_TAC disjoint_loops + THEN EXISTS_TAC `H:(A)hypermap` THEN EXISTS_TAC `NF:(A)loop->bool` THEN EXISTS_TAC `y:A` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN REMOVE_THEN "F11" (MP_TAC o AP_TERM `back (L:(A)loop)`) + THEN ONCE_REWRITE_TAC[lemma_inverse_evaluation] + THEN REWRITE_TAC[GSYM node_map_inverse_representation] + THEN MESON_TAC[EQ_SYM]; ALL_TAC] + THEN USE_THEN "FC" ((CONJUNCTS_THEN2 (LABEL_TAC "F15") (LABEL_TAC "F16")) o MATCH_MP head_on_loop) + THEN ABBREV_TAC `y = head (H:(A)hypermap) (NF:(A)loop->bool) (x:A)` + THEN USE_THEN "F3"(fun th2->(REMOVE_THEN "F15"(fun th3->LABEL_TAC "F17" (MATCH_MP lemma_in_loop (CONJ th2 th3))))) + THEN USE_THEN "F17"(fun th1->(USE_THEN "F2"(fun th2->(MP_TAC (MATCH_MP lemma_in_support2 (CONJ th1 th2)))))) + THEN MP_TAC (MATCH_MP inverse_element_lemma (SPEC `H:(A)hypermap` node_map_and_darts)) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` ASSUME_TAC) + THEN USE_THEN "F1"(fun th1->(DISCH_THEN(fun th2->(MP_TAC (SPEC `j:num` (MATCH_MP lemma_node_in_support2 (CONJ th1 th2))))))) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN REWRITE_TAC[lemma_in_support] + THEN DISCH_THEN (X_CHOOSE_THEN `P:(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "F18") (LABEL_TAC "F19"))) + THEN EXISTS_TAC `P:(A)loop` + THEN ASM_REWRITE_TAC[] + THEN CONV_TAC SYM_CONV + THEN MATCH_MP_TAC lemma_unique_tail + THEN EXISTS_TAC `P:(A)loop` + THEN ASM_REWRITE_TAC[atom_reflect] + THEN REMOVE_THEN "F16" MP_TAC + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN (MP_TAC o AP_TERM `node_map (H:(A)hypermap)`) + THEN REWRITE_TAC[MATCH_MP PERMUTES_INVERSES (CONJUNCT2(SPEC `H:(A)hypermap` node_map_and_darts))] + THEN DISCH_THEN (MP_TAC o AP_TERM `next (P:(A)loop)`) + THEN REWRITE_TAC[lemma_inverse_evaluation] + THEN DISCH_THEN (SUBST_ALL_TAC o SYM) + THEN REMOVE_THEN "F19" (fun th1-> (MP_TAC (SPEC `1` (MATCH_MP lemma_power_back_in_loop th1)))) + THEN REWRITE_TAC[POWER_1] + THEN REWRITE_TAC[lemma_inverse_evaluation] + THEN DISCH_TAC + THEN SUBGOAL_THEN `L:(A)loop = P:(A)loop` SUBST1_TAC + THENL[MATCH_MP_TAC disjoint_loops + THEN EXISTS_TAC `H:(A)hypermap` THEN EXISTS_TAC `NF:(A)loop->bool` THEN EXISTS_TAC `y:A` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN SIMP_TAC[]);; + +let node_map_free_loop = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_normal H NF /\ L IN NF /\ x belong L ==> node_map H (tail H NF x) = head H NF (node_map H (tail H NF x)) /\ inverse (node_map H) (head H NF x) = tail H NF (inverse (node_map H) (head H NF x))`, + MESON_TAC[node_map_on_margin]);; + +let from_tail = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A) (y:A). is_normal H NF /\ L IN NF /\ x belong L /\ y IN atom H L x + ==> (!i:num. i <= index L (tail H NF x) y ==> (next L POWER i) (tail H NF x) = (inverse (node_map H) POWER i) (tail H NF x))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")))) + THEN USE_THEN "F3" (fun th-> USE_THEN "F4" (fun th1-> (LABEL_TAC "F5" (MATCH_MP lemma_in_loop (CONJ th th1))))) + THEN USE_THEN "F1"(fun th->(USE_THEN "F2"(fun th2->(USE_THEN "F3"(fun th3-> MP_TAC (MATCH_MP tail_on_loop (CONJ th (CONJ th2 th3)))))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7")) + THEN USE_THEN "F2" (fun th -> (USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN DISCH_THEN (LABEL_TAC "F8" o CONJUNCT1) + THEN USE_THEN "F3" (fun th-> USE_THEN "F6" (fun th1-> (LABEL_TAC "F9" (MATCH_MP lemma_in_loop (CONJ th th1))))) + THEN ABBREV_TAC `z = tail (H:(A)hypermap) (NF:(A)loop->bool) (x:A)` + THEN REMOVE_THEN "F6" (SUBST_ALL_TAC o MATCH_MP lemma_identity_atom) + THEN USE_THEN "F4" (MP_TAC o REWRITE_RULE[atom; IN_ELIM_THM]) + THEN STRIP_TAC + THENL[POP_ASSUM (MP_TAC o REWRITE_RULE[is_node_going]) + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` (CONJUNCTS_THEN2 (LABEL_TAC "H1") (LABEL_TAC "H2"))) + THEN USE_THEN "F9" (fun th-> USE_THEN "F5" (fun th1-> (MP_TAC (MATCH_MP lemma_loop_index (CONJ th th1))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "H3") (LABEL_TAC "H4")) + THEN ASM_CASES_TAC `k:num <= top (L:(A)loop)` + THENL[USE_THEN "F9"(fun th-> POP_ASSUM (fun th1-> USE_THEN "H1" (fun th2-> MP_TAC (MATCH_MP determine_loop_index (CONJ th (CONJ th1 th2)))))) + THEN DISCH_THEN SUBST1_TAC THEN USE_THEN "H2" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM(fun th-> MP_TAC (MATCH_MP LT_IMP_LE (REWRITE_RULE[NOT_LE] th))) + THEN USE_THEN "H3" (fun th -> DISCH_THEN (fun th1-> MP_TAC (MATCH_MP LE_TRANS (CONJ th th1)))) + THEN USE_THEN "H2"(fun th-> DISCH_THEN (fun th1-> REWRITE_TAC[MATCH_MP lemma_sub_part (CONJ th th1)])); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[is_node_going]) + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` (CONJUNCTS_THEN2 (LABEL_TAC "G1") (LABEL_TAC "G2"))) + THEN ASM_CASES_TAC `k:num = 0` + THENL[POP_ASSUM SUBST_ALL_TAC + THEN USE_THEN "G1" (MP_TAC o REWRITE_RULE[POWER_0; I_THM]) + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC (REWRITE_RULE[I_THM] (SYM(AP_THM (SPEC `next (L:(A)loop)` POWER_0) `y:A`))) + THEN MP_TAC (SPEC `top (L:(A)loop)` LE_0) + THEN USE_THEN "F5" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP determine_loop_index th]) + THEN USE_THEN "G2" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN USE_THEN "G2" (MP_TAC o REWRITE_RULE[LE_REFL] o SPEC `k:num`) + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[GSYM LT_NZ; NOT_LE; LT_EXISTS; CONJUNCT1 ADD]) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` SUBST_ALL_TAC) + THEN USE_THEN "G2" (MP_TAC o REWRITE_RULE[LE_REFL] o SPEC `SUC d`) + THEN USE_THEN "G1" (SUBST1_TAC o SYM) + THEN REWRITE_TAC[GSYM (COM_POWER_FUNCTION)] + THEN USE_THEN "G2" (SUBST1_TAC o SYM o REWRITE_RULE[LE_PLUS] o SPEC `d:num`) + THEN USE_THEN "G1" (SUBST1_TAC o SYM o REWRITE_RULE[GSYM (COM_POWER_FUNCTION); lemma_inverse_evaluation] o AP_TERM `back (L:(A)loop)`) + THEN USE_THEN "F7" (fun th-> REWRITE_TAC[th]));; + +let to_head = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A) (y:A). is_normal H NF /\ L IN NF /\ x belong L /\ y IN atom H L x + ==> (!i:num. i <= index L y (head H NF x) ==> (next L POWER i) y = (inverse (node_map H) POWER i) y)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")))) + THEN USE_THEN "F3" (fun th-> USE_THEN "F4" (fun th1-> (LABEL_TAC "F5" (MATCH_MP lemma_in_loop (CONJ th th1))))) + THEN USE_THEN "F1"(fun th->(USE_THEN "F2"(fun th2->(USE_THEN "F3"(fun th3-> MP_TAC (MATCH_MP head_on_loop (CONJ th (CONJ th2 th3)))))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7")) + THEN USE_THEN "F2" (fun th -> (USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN DISCH_THEN (LABEL_TAC "F8" o CONJUNCT1) + THEN USE_THEN "F3" (fun th-> USE_THEN "F6" (fun th1-> (LABEL_TAC "F9" (MATCH_MP lemma_in_loop (CONJ th th1))))) + THEN ABBREV_TAC `z = head (H:(A)hypermap) (NF:(A)loop->bool) (x:A)` + THEN REMOVE_THEN "F6" (SUBST_ALL_TAC o MATCH_MP lemma_identity_atom) + THEN USE_THEN "F4" (MP_TAC o REWRITE_RULE[atom; IN_ELIM_THM]) + THEN STRIP_TAC + THENL[POP_ASSUM (MP_TAC o REWRITE_RULE[is_node_going]) + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` (CONJUNCTS_THEN2 (LABEL_TAC "G1") (LABEL_TAC "G2"))) + THEN ASM_CASES_TAC `k:num = 0` + THENL[POP_ASSUM SUBST_ALL_TAC + THEN USE_THEN "G1" (MP_TAC o REWRITE_RULE[POWER_0; I_THM]) + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC (REWRITE_RULE[I_THM] (SYM(AP_THM (SPEC `next (L:(A)loop)` POWER_0) `z:A`))) + THEN MP_TAC (SPEC `top (L:(A)loop)` LE_0) + THEN USE_THEN "F9" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP determine_loop_index th]) + THEN USE_THEN "G2" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN USE_THEN "G2" (MP_TAC o SPEC `1`) + THEN POP_ASSUM(fun th-> REWRITE_TAC[REWRITE_RULE[GSYM LT_NZ; GSYM LT1_NZ] th; POWER_1]) + THEN USE_THEN "F7" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[is_node_going]) + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` (CONJUNCTS_THEN2 (LABEL_TAC "H1") (LABEL_TAC "H2"))) + THEN USE_THEN "F5" (fun th-> USE_THEN "F9" (fun th1-> (MP_TAC (MATCH_MP lemma_loop_index (CONJ th th1))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "H3") (LABEL_TAC "H4")) + THEN ASM_CASES_TAC `k:num <= top (L:(A)loop)` + THENL[USE_THEN "F5"(fun th-> POP_ASSUM (fun th1-> USE_THEN "H1" (fun th2-> MP_TAC (MATCH_MP determine_loop_index (CONJ th (CONJ th1 th2)))))) + THEN DISCH_THEN SUBST1_TAC THEN USE_THEN "H2" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM(fun th-> MP_TAC (MATCH_MP LT_IMP_LE (REWRITE_RULE[NOT_LE] th))) + THEN USE_THEN "H3" (fun th -> DISCH_THEN (fun th1-> ASSUME_TAC (MATCH_MP LE_TRANS (CONJ th th1)))) + THEN REPEAT STRIP_TAC + THEN USE_THEN "H2" (MP_TAC o SPEC `i:num`) + THEN POP_ASSUM (fun th-> POP_ASSUM (fun th1-> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ th th1)])));; + +let add_steps = prove(`!L:(A)loop x:A y:A z:A. x belong L /\ y belong L /\ z belong L /\ index L x y <= index L x z + ==> (index L x y) + (index L y z) = index L x z`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")))) + THEN USE_THEN "F1"(fun th-> USE_THEN "F2"(fun th1-> MP_TAC(MATCH_MP lemma_loop_index (CONJ th th1)))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6")) + THEN USE_THEN "F1"(fun th-> USE_THEN "F3"(fun th1-> MP_TAC(MATCH_MP lemma_loop_index (CONJ th th1)))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F7") (LABEL_TAC "F8")) + THEN USE_THEN "F2"(fun th-> USE_THEN "F3"(fun th1-> MP_TAC(MATCH_MP lemma_loop_index (CONJ th th1)))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F9") (LABEL_TAC "F10")) + THEN ABBREV_TAC `nz = index (L:(A)loop) y z` + THEN ABBREV_TAC `n = index (L:(A)loop) x y` + THEN ABBREV_TAC `m = index (L:(A)loop) x z` + THEN USE_THEN "F10" MP_TAC + THEN USE_THEN "F6" SUBST1_TAC + THEN REWRITE_TAC[GSYM lemma_add_exponent_function] + THEN USE_THEN "F8" SUBST1_TAC + THEN USE_THEN "F7" MP_TAC THEN USE_THEN "F1" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN ((X_CHOOSE_THEN `q:num` MP_TAC) o MATCH_MP lemma_congruence_on_loop) + THEN ASM_CASES_TAC `q:num = 0` + THENL[POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[CONJUNCT1 MULT; CONJUNCT1 ADD; lemma_size] + THEN DISCH_THEN (fun th-> REWRITE_TAC[ONCE_REWRITE_RULE[ADD_SYM] th]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F11") + THEN DISCH_TAC + THEN USE_THEN "F11"(fun th-> MP_TAC (MATCH_MP LE_MULT2 (CONJ (REWRITE_RULE[GSYM LT_NZ; GSYM LT1_NZ] th) (SPEC `size (L:(A)loop)` LE_REFL)))) + THEN REWRITE_TAC[MULT_CLAUSES] + THEN DISCH_TAC THEN MP_TAC(SPECL[`size (L:(A)loop)`; `(q:num) * (size (L:(A)loop))`; `m:num`] LE_ADD_RCANCEL) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN USE_THEN "F9"(fun th-> USE_THEN "F4" (fun th1-> MP_TAC (MATCH_MP LE_ADD2 (CONJ th th1)))) + THEN DISCH_THEN (fun th-> DISCH_THEN (fun th1-> (MP_TAC (MATCH_MP LE_TRANS (CONJ th1 th))))) + THEN REWRITE_TAC[lemma_size; CONJUNCT2 ADD] THEN ARITH_TAC);; + +let add_steps_in_atom = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A y:A. is_normal H NF /\ L IN NF /\ x belong L /\ y IN atom H L x + ==> (index L (tail H NF x) y) + (index L y (head H NF x)) = index L (tail H NF x) (head H NF x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (fun th-> LABEL_TAC "FC"(MATCH_MP from_tail th) THEN MP_TAC th) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")))) + THEN USE_THEN "F1"(fun th-> USE_THEN "F2"(fun th1->USE_THEN "F3"(fun th2->MP_TAC(MATCH_MP margin_in_loop (CONJ th (CONJ th1 th2)))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6")) + THEN MATCH_MP_TAC add_steps + THEN ASM_REWRITE_TAC[] + THEN USE_THEN "F3" (fun th-> USE_THEN "F4" (fun th1-> REWRITE_TAC[MATCH_MP lemma_in_loop (CONJ th th1)])) + THEN USE_THEN "F1" (fun th-> USE_THEN "F2"(fun th1-> USE_THEN "F3" (fun th2-> MP_TAC(MATCH_MP head_on_loop (CONJ th (CONJ th1 th2)))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F7") (LABEL_TAC "F8")) + THEN USE_THEN "F6" (fun th-> USE_THEN "F5"(fun th1-> LABEL_TAC "F9" (CONJUNCT2(MATCH_MP lemma_loop_index (CONJ th th1))))) + THEN ABBREV_TAC `u = tail (H:(A)hypermap) NF x` + THEN ABBREV_TAC `v = head (H:(A)hypermap) NF x` + THEN ASM_CASES_TAC `index (L:(A)loop) u y <= index L u v` + THENL[POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F10" o REWRITE_RULE[NOT_LE; GSYM LE_SUC_LT]) + THEN USE_THEN "FC" (MP_TAC o SPEC `SUC(index (L:(A)loop) u v)`) + THEN USE_THEN "F10" (fun th-> REWRITE_TAC[th; GSYM COM_POWER_FUNCTION]) + THEN USE_THEN "FC" (MP_TAC o SPEC `index (L:(A)loop) u v`) + THEN USE_THEN "F10" (fun th-> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ (SPEC `index (L:(A)loop) u v` LE_PLUS) th)]) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN USE_THEN "F9" (SUBST1_TAC o SYM) + THEN USE_THEN "F8" (fun th-> REWRITE_TAC[th]));; + +let lemma_in_atom = prove(`!(H:(A)hypermap) (L:(A)loop) (x:A) (m:num). is_loop H L /\ (!i:num .i <= m ==> ((next L) POWER i) x = ((inverse (node_map H)) POWER i) x) ==> ((next L) POWER m) x IN atom H L x`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F3")) + THEN ASM_CASES_TAC `~(x:A belong L:(A)loop)` + THENL[POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP lemma_power_back_and_next_outside_loop th]) + THEN REWRITE_TAC[atom_reflect]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F2" o REWRITE_RULE[]) + THEN ABBREV_TAC `y = ((next (L:(A)loop)) POWER (m:num)) (x:A)` + THEN REWRITE_TAC[atom; IN_ELIM_THM] + THEN DISJ1_TAC + THEN REWRITE_TAC[is_node_going] + THEN EXISTS_TAC `m:num` + THEN ASM_SIMP_TAC[]);; + +let lemma_in_atom2 = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_normal H NF /\ L IN NF /\ x belong L + ==> (!i:num. i <= index L x (head H NF x) ==> (next L POWER i) x IN atom H L x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F4") + THEN USE_THEN "F2" (fun th->(USE_THEN "F1" (LABEL_TAC "F5" o CONJUNCT1 o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN MP_TAC (SPECL[`H:(A)hypermap`; `L:(A)loop`; `x:A`] atom_reflect) + THEN USE_THEN "F3" MP_TAC THEN USE_THEN "F2" MP_TAC THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP to_head) + THEN DISCH_THEN (fun th-> USE_THEN "F4" (fun th1-> (MP_TAC (MATCH_MP lemma_sub_part (CONJ th th1))))) + THEN USE_THEN "F5"(fun th-> DISCH_THEN (fun th1-> (REWRITE_TAC [MATCH_MP lemma_in_atom (CONJ th th1)]))));; + +let atomic_particles = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_normal H NF /\ L IN NF /\ x belong L + ==> atom H L x = {(next L POWER (i:num)) (tail H NF x) |i:num| i <= index L (tail H NF x) (head H NF x)} /\ + (!i:num. i <= index L (tail H NF x) (head H NF x) ==> (next L POWER i) (tail H NF x) = (inverse (node_map H) POWER i) (tail H NF x)) /\ + atom H L x = {(inverse (node_map H) POWER (i:num)) (tail H NF x) |i:num| i <= index L (tail H NF x) (head H NF x)}`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN USE_THEN "F1"(fun th-> USE_THEN "F2"(fun th1->USE_THEN "F3"(fun th2-> MP_TAC(MATCH_MP margin_in_loop (CONJ th (CONJ th1 th2)))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5")) + THEN USE_THEN "F5" (fun th-> USE_THEN "F4"(fun th1-> (MP_TAC(MATCH_MP lemma_loop_index (CONJ th th1))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7")) + THEN ABBREV_TAC `u = tail (H:(A)hypermap) NF x` THEN POP_ASSUM (LABEL_TAC "UL") + THEN ABBREV_TAC `v = head (H:(A)hypermap) NF x` THEN POP_ASSUM (LABEL_TAC "VL") + THEN SUBGOAL_THEN `?n:num. (!j:num. j <= n ==> (next (L:(A)loop) POWER j) u = (inverse (node_map (H:(A)hypermap)) POWER j) u) /\ ~(next L ((next L POWER n) u) = inverse (node_map H) ((next L POWER n) u))` MP_TAC + THENL[ONCE_REWRITE_TAC[TAUT `A <=> ~ ~A`] + THEN GEN_REWRITE_TAC (RAND_CONV o TOP_DEPTH_CONV) [NOT_EXISTS_THM; DE_MORGAN_THM; NOT_FORALL_THM] + THEN DISCH_THEN (LABEL_TAC "H1" o REWRITE_RULE[]) + THEN SUBGOAL_THEN `!n:num. (next (L:(A)loop) POWER n) u = (inverse (node_map (H:(A)hypermap)) POWER n) u` (LABEL_TAC "H2") + THENL[MATCH_MP_TAC num_WF + THEN INDUCT_TAC THENL[REWRITE_TAC[POWER_0; I_THM]; ALL_TAC] + THEN DISCH_THEN (LABEL_TAC "G1") + THEN USE_THEN "H1" (MP_TAC o SPEC `n:num`) + THEN STRIP_TAC + THENL[POP_ASSUM MP_TAC THEN USE_THEN "G1" ((fun th-> REWRITE_TAC[th]) o REWRITE_RULE[LT_SUC_LE] o SPEC `j:num`); ALL_TAC] + THEN GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [GSYM COM_POWER_FUNCTION] + THEN USE_THEN "G1" (SUBST1_TAC o SYM o REWRITE_RULE[LT_PLUS] o SPEC `n:num`) + THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th; COM_POWER_FUNCTION]); ALL_TAC] + THEN USE_THEN "F5" (MP_TAC o MATCH_MP lemma_transitive_permutation) + THEN USE_THEN "H2" (SUBST1_TAC o MATCH_MP lemma_orbit_eq) + THEN REWRITE_TAC[MATCH_MP lemma_orbit_inverse_map_eq (SPEC `H:(A)hypermap` node_map_and_darts); GSYM node] + THEN USE_THEN "F1"(fun th-> USE_THEN "F2"(fun th1-> MP_TAC(SPEC `u:A`(MATCH_MP lemma_loop_outside_node (CONJ th th1))))) + THEN REWRITE_TAC[CONTRAPOS_THM] THEN SET_TAC[]; ALL_TAC] + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [num_WOP] + THEN DISCH_THEN (X_CHOOSE_THEN `n:num` ((CONJUNCTS_THEN2 (LABEL_TAC "F8") (LABEL_TAC "F9")) o CONJUNCT1)) + THEN SUBGOAL_THEN `n:num <= index (L:(A)loop) u v` (LABEL_TAC "F10") + THENL[USE_THEN "F9" MP_TAC THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN REWRITE_TAC[NOT_LE] + THEN DISCH_THEN (LABEL_TAC "H1") + THEN USE_THEN "H1"(fun th-> USE_THEN "F8" (MP_TAC o REWRITE_RULE[REWRITE_RULE[GSYM LE_SUC_LT] th ] o SPEC `SUC (index (L:(A)loop) u v)`)) + THEN REWRITE_TAC[GSYM COM_POWER_FUNCTION] + THEN USE_THEN "H1"(fun th-> USE_THEN "F8" (MP_TAC o REWRITE_RULE[MATCH_MP LT_IMP_LE th ] o SPEC `index (L:(A)loop) u v`)) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN USE_THEN "F7" (SUBST1_TAC o SYM) + THEN EXPAND_TAC "v" + THEN USE_THEN "F1"(fun th-> USE_THEN "F2"(fun th1-> USE_THEN "F3"(fun th2-> REWRITE_TAC[MATCH_MP head_on_loop (CONJ th (CONJ th1 th2))]))); ALL_TAC] + THEN ABBREV_TAC `w = (next (L:(A)loop) POWER n) u` + THEN POP_ASSUM (LABEL_TAC "WL") + THEN USE_THEN "WL" (MP_TAC o SYM) + THEN USE_THEN "F10"(fun th-> USE_THEN "F6"(fun th1-> MP_TAC(MATCH_MP LE_TRANS (CONJ th th1)))) + THEN USE_THEN "F5" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (ASSUME_TAC o MATCH_MP determine_loop_index) + THEN USE_THEN "F8" MP_TAC + THEN USE_THEN "F2" (fun th-> USE_THEN "F1" (MP_TAC o CONJUNCT1 o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal])) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN USE_THEN "WL" (fun th -> DISCH_THEN (MP_TAC o REWRITE_RULE[th] o MATCH_MP lemma_in_atom)) + THEN USE_THEN "UL" (fun th-> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [SYM th]) + THEN USE_THEN "F1"(fun th-> USE_THEN "F2"(fun th1-> USE_THEN "F3"(fun th2-> REWRITE_TAC[GSYM(MATCH_MP change_to_margin (CONJ th (CONJ th1 th2)))]))) + THEN DISCH_TAC + THEN USE_THEN "F9" MP_TAC + THEN POP_ASSUM MP_TAC + THEN USE_THEN "F3" MP_TAC THEN USE_THEN "F2" MP_TAC THEN USE_THEN "F1" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_unique_head) + THEN USE_THEN "VL" SUBST1_TAC + THEN DISCH_THEN (SUBST_ALL_TAC o SYM) + THEN POP_ASSUM (SUBST_ALL_TAC o SYM) + THEN USE_THEN "F8" (fun th-> REWRITE_TAC[th]) + THEN SUBGOAL_THEN `atom (H:(A)hypermap) L x = {(next L POWER i) u | i:num | i <= index L u v}` (LABEL_TAC "F11") + THENL[REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN X_GEN_TAC `y:A` + THEN EQ_TAC + THENL[DISCH_THEN (LABEL_TAC "H1") + THEN USE_THEN "H1" (fun th-> USE_THEN "F3" (fun th1-> MP_TAC (MATCH_MP lemma_in_loop (CONJ th1 th)))) + THEN USE_THEN "F5" (fun th-> DISCH_THEN (ASSUME_TAC o CONJUNCT2 o MATCH_MP lemma_loop_index o CONJ th)) + THEN EXISTS_TAC `index (L:(A)loop) u y` + THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) + THEN USE_THEN "H1" MP_TAC THEN USE_THEN "F3" MP_TAC THEN USE_THEN "F2" MP_TAC THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN USE_THEN "UL"(fun th-> USE_THEN "VL"(fun th1-> DISCH_THEN (MP_TAC o REWRITE_RULE[th; th1] o MATCH_MP add_steps_in_atom))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[SYM th; LE_ADD]); ALL_TAC] + THEN DISCH_THEN (X_CHOOSE_THEN `i:num` (CONJUNCTS_THEN2 (LABEL_TAC "H1") (LABEL_TAC "H2"))) + THEN USE_THEN "F8"(fun th-> USE_THEN "H1" (fun th1-> MP_TAC (MATCH_MP lemma_sub_part (CONJ th th1)))) + THEN USE_THEN "F2" (fun th-> USE_THEN "F1" (MP_TAC o CONJUNCT1 o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal])) + THEN REWRITE_TAC[IMP_IMP] + THEN USE_THEN "H2" (fun th-> DISCH_THEN (fun th1-> MP_TAC(REWRITE_RULE[SYM th] (MATCH_MP lemma_in_atom th1)))) + THEN EXPAND_TAC "u" + THEN USE_THEN "F1"(fun th-> USE_THEN "F2"(fun th1-> USE_THEN "F3"(fun th2-> REWRITE_TAC[GSYM(MATCH_MP change_to_margin (CONJ th (CONJ th1 th2)))]))); ALL_TAC] + THEN USE_THEN "F11"(fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F8"(fun th-> REWRITE_TAC[MATCH_MP lemma_two_series_eq th]));; + +let atom_one_point = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_normal H NF /\ L IN NF /\ x belong L /\ head H NF x = tail H NF x + ==> atom H L x = {x}`, + REPEAT GEN_TAC + THEN DISCH_THEN((CONJUNCTS_THEN2 (LABEL_TAC "F1" o REWRITE_RULE[GSYM CONJ_ASSOC]) (LABEL_TAC "F2")) o REWRITE_RULE[CONJ_ASSOC]) + THEN USE_THEN "F2" (MP_TAC o AP_TERM `next (L:(A)loop) POWER 0`) + THEN GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o DEPTH_CONV) [POWER_0; I_THM] + THEN MP_TAC (SPEC `top (L:(A)loop)` LE_0) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT2 o MATCH_MP margin_in_loop) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] THEN DISCH_THEN (LABEL_TAC "F3" o MATCH_MP determine_loop_index) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT1 o MATCH_MP atomic_particles) + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[th; CONJUNCT1 LE]) + THEN REWRITE_TAC[SET_RULE `!p:num->A. {p i | i = 0} = {p 0}`; POWER_0; I_THM] + THEN DISCH_TAC THEN MP_TAC (SPECL[`H:(A)hypermap`; `L:(A)loop`; `x:A`] atom_reflect) + THEN POP_ASSUM (SUBST1_TAC) THEN REWRITE_TAC[IN_SING] + THEN DISCH_THEN (fun th-> REWRITE_TAC[SYM th]));; + +let lemma_map_next = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_normal H NF /\ L IN NF /\ x belong L /\ next L x IN atom H L x + ==> next L x = inverse (node_map H) x`, + REPEAT GEN_TAC + THEN DISCH_THEN(CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "FC")))) + THEN USE_THEN "F2" (fun th -> (USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN DISCH_THEN (LABEL_TAC "F4" o CONJUNCT1) + THEN USE_THEN "FC" (MP_TAC o REWRITE_RULE[atom; IN_ELIM_THM]) + THEN STRIP_TAC + THENL[POP_ASSUM (MP_TAC o REWRITE_RULE[is_node_going]) + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6"))) + THEN ASM_CASES_TAC `k:num = 0` + THENL[POP_ASSUM SUBST_ALL_TAC + THEN REMOVE_THEN "F5" (MP_TAC o REWRITE_RULE[POWER_0; I_THM]) + THEN DISCH_THEN (ASSUME_TAC o ONCE_REWRITE_RULE[SPEC `next (L:(A)loop)` orbit_one_point]) + THEN USE_THEN "F3"(fun th2->MP_TAC(MATCH_MP lemma_transitive_permutation th2)) + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_TAC + THEN SUBGOAL_THEN `dart_of (L:(A)loop) SUBSET node (H:(A)hypermap) (x:A)` MP_TAC + THENL[POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[SUBSET; IN_SING; node] + THEN GEN_TAC + THEN DISCH_THEN SUBST1_TAC THEN REWRITE_TAC[orbit_reflect]; ALL_TAC] + THEN USE_THEN "F1"(fun th->(USE_THEN "F2"(fun th1->REWRITE_TAC[MATCH_MP lemma_loop_outside_node (CONJ th th1)]))); ALL_TAC] + THEN REMOVE_THEN "F6" (MP_TAC o REWRITE_RULE[POWER_1; LT1_NZ; LT_NZ ] o SPEC `1`) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[is_node_going]) + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6"))) + THEN SUBGOAL_THEN `dart_of (L:(A)loop) SUBSET node (H:(A)hypermap) (x:A)` MP_TAC + THENL[MP_TAC (SPECL[`H:(A)hypermap`; `L:(A)loop`; `x:A`] lemma_atom_sub_node) + THEN USE_THEN "FC"(fun th->(DISCH_THEN(fun th1->MP_TAC(MATCH_MP lemma_in_subset (CONJ th1 th))))) + THEN DISCH_THEN(fun th->REWRITE_TAC[MATCH_MP lemma_node_identity th]) + THEN USE_THEN "F3" (fun th1-> (MP_TAC (SPEC `1` (MATCH_MP lemma_power_next_in_loop th1)))) + THEN REWRITE_TAC[POWER_1] + THEN DISCH_THEN(fun th2->MP_TAC(MATCH_MP lemma_transitive_permutation th2)) + THEN DISCH_THEN SUBST1_TAC + THEN REMOVE_THEN "F5" (MP_TAC o REWRITE_RULE[iterate_map_valuation] o SYM o AP_TERM `next (L:(A)loop)`) + THEN DISCH_THEN (fun th-> MP_TAC (REWRITE_RULE[LT_SUC_LE] (MATCH_MP orbit_cyclic (CONJ (SPEC `k:num` NON_ZERO) th)))) + THEN POP_ASSUM (MP_TAC o MATCH_MP lemma_two_series_eq) + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[SUBSET; IN_ELIM_THM] + THEN GEN_TAC + THEN DISCH_THEN (X_CHOOSE_THEN `i:num` (SUBST1_TAC o CONJUNCT2)) + THEN MP_TAC (SPEC `i:num` (MATCH_MP power_inverse_element_lemma (SPEC `H:(A)hypermap` node_map_and_darts))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (SUBST1_TAC)) + THEN REWRITE_TAC[node; lemma_in_orbit]; ALL_TAC] + THEN USE_THEN "F1"(fun th->(USE_THEN "F2"(fun th1->REWRITE_TAC[MATCH_MP lemma_loop_outside_node (CONJ th th1)]))));; + +let lemma_atom_node_eq = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (x:A) (L:(A)loop). is_normal H NF /\ L IN NF /\ x belong L /\ node_map H (tail H NF x) IN (atom H L x) ==> atom H L x = node H x`, + REPEAT GEN_TAC + THEN DISCH_THEN ((CONJUNCTS_THEN2 (LABEL_TAC "F1" o REWRITE_RULE[GSYM CONJ_ASSOC]) (LABEL_TAC "F2")) o REWRITE_RULE[CONJ_ASSOC]) + THEN USE_THEN "F1" (MP_TAC o MATCH_MP margin_in_loop) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT1 o MATCH_MP node_map_free_loop) + THEN USE_THEN "F1"(fun th->USE_THEN "F2"(fun th1-> REWRITE_TAC[CONJUNCT1(MATCH_MP change_parameters (REWRITE_RULE[GSYM CONJ_ASSOC] (CONJ th th1)))])) + THEN DISCH_THEN (LABEL_TAC "F5") + THEN USE_THEN "F1" (MP_TAC o CONJUNCT1 o MATCH_MP tail_on_loop) + THEN MP_TAC (SPECL[`H:(A)hypermap`; `L:(A)loop`; `x:A`] lemma_atom_sub_node) + THEN REWRITE_TAC[IMP_IMP] THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_in_subset) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_node_identity th]) + THEN USE_THEN "F1"(MP_TAC o CONJUNCT2 o MATCH_MP atomic_particles) + THEN USE_THEN "F1"(fun th->REWRITE_TAC[CONJUNCT1(MATCH_MP change_to_margin th)]) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7")) + THEN USE_THEN "F3"(fun th-> USE_THEN "F4"(fun th1->MP_TAC(CONJUNCT2(MATCH_MP lemma_loop_index (CONJ th1 th))))) + THEN ABBREV_TAC `u = tail (H:(A)hypermap) NF x` + THEN ABBREV_TAC `v = head (H:(A)hypermap) NF x` + THEN ABBREV_TAC `n = index (L:(A)loop) u v` + THEN USE_THEN "F6" (SUBST1_TAC o REWRITE_RULE[LE_REFL] o SPEC `n:num`) + THEN USE_THEN "F5" (SUBST1_TAC o SYM) + THEN DISCH_THEN (MP_TAC o SYM) + THEN REWRITE_TAC[node_map_inverse_representation; COM_POWER_FUNCTION] + THEN DISCH_THEN (fun th->(MP_TAC(MATCH_MP orbit_cyclic (CONJ (SPEC `n:num` NON_ZERO) (SYM th))))) + THEN REWRITE_TAC[MATCH_MP lemma_orbit_inverse_map_eq (SPEC `H:(A)hypermap` node_map_and_darts); LT_SUC_LE; GSYM node] + THEN DISCH_THEN SUBST1_TAC THEN USE_THEN "F7"(fun th-> REWRITE_TAC[th]));; + +let lemma_fmap = prove(`!(H:(A)hypermap) (NF:(A)loop->bool). ?f:(A->bool)->(A->bool). (!s:A->bool. is_normal H NF ==> +(~(s IN quotient_darts H NF) ==> f s = s) /\ + (s IN quotient_darts H NF ==> (?L:(A)loop x:A. L IN NF /\ x belong L /\ s = atom H L x /\ f s = atom H L ((face_map H) (head H NF x)))))`, + REPEAT GEN_TAC + THEN REWRITE_TAC[GSYM SKOLEM_THM] + THEN GEN_TAC + THEN REWRITE_TAC[RIGHT_EXISTS_IMP_THM] + THEN DISCH_THEN (LABEL_TAC "F1") + THEN ASM_CASES_TAC `~((s:A->bool) IN quotient_darts (H:(A)hypermap) (NF:(A)loop->bool))` + THENL[EXISTS_TAC `s:A->bool` THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM (ASSUME_TAC o REWRITE_RULE[]) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[quotient_darts; IN_ELIM_THM]) + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (X_CHOOSE_THEN `x:A` MP_TAC)) + THEN DISCH_THEN (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3")) (LABEL_TAC "F4")) + THEN ASM_REWRITE_TAC[SWAP_EXISTS_THM] + THEN EXISTS_TAC `x:A` + THEN ONCE_REWRITE_TAC[SWAP_EXISTS_THM] + THEN EXISTS_TAC `L:(A)loop` + THEN EXISTS_TAC `atom (H:(A)hypermap) (L:(A)loop) (face_map H (head H NF (x:A)))` + THEN ASM_REWRITE_TAC[]);; + +let lemma_nmap = prove(`!(H:(A)hypermap) (NF:(A)loop->bool). ?f:(A->bool)->(A->bool). (!s:A->bool. is_normal H NF ==> +(~(s IN quotient_darts H NF) ==> f s = s) /\ + (s IN quotient_darts H NF ==> (?L:(A)loop L':(A)loop x:A. L IN NF /\ L' IN NF /\ x belong L /\ node_map H (tail H NF x) belong L' /\ s = atom H L x /\ + f s = atom H L' ((node_map H) (tail H NF x)))))`, + REPEAT GEN_TAC + THEN REWRITE_TAC[GSYM SKOLEM_THM] + THEN GEN_TAC + THEN REWRITE_TAC[RIGHT_EXISTS_IMP_THM] + THEN DISCH_THEN (LABEL_TAC "F1") + THEN ASM_CASES_TAC `~((s:A->bool) IN quotient_darts (H:(A)hypermap) (NF:(A)loop->bool))` + THENL[EXISTS_TAC `s:A->bool` THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM (ASSUME_TAC o REWRITE_RULE[]) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[quotient_darts; IN_ELIM_THM]) + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (X_CHOOSE_THEN `x:A` MP_TAC)) + THEN DISCH_THEN (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3")) (LABEL_TAC "F4")) + THEN USE_THEN "F1"(fun th1->(USE_THEN "F2"(fun th2->USE_THEN "F3"(fun th3->MP_TAC (CONJUNCT1(MATCH_MP node_map_on_margin (CONJ th1 (CONJ th2 th3)))))))) + THEN DISCH_THEN (X_CHOOSE_THEN `L':(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3" o CONJUNCT1))) + THEN ASM_REWRITE_TAC[SWAP_EXISTS_THM] + THEN EXISTS_TAC `x:A` + THEN ONCE_REWRITE_TAC[SWAP_EXISTS_THM] + THEN EXISTS_TAC `L:(A)loop` + THEN ONCE_REWRITE_TAC[SWAP_EXISTS_THM] + THEN EXISTS_TAC `L':(A)loop` + THEN EXISTS_TAC `atom (H:(A)hypermap) (L':(A)loop) (node_map H (tail H NF (x:A)))` + THEN ASM_REWRITE_TAC[]);; + +let lemma_face_map = new_specification ["fmap"] (REWRITE_RULE[SKOLEM_THM] lemma_fmap);; + +let lemma_node_map = new_specification ["nmap"] (REWRITE_RULE[SKOLEM_THM] lemma_nmap);; + +let unique_fmap = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) L:(A)loop x:A. is_normal H NF /\ L IN NF /\ x belong L ==> fmap H NF (atom H L x) = atom H L ((face_map H) (head H NF x))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT2 o SPEC `atom (H:(A)hypermap) (L:(A)loop) (x:A)` o MATCH_MP lemma_face_map) + THEN USE_THEN "F2" (fun th-> (USE_THEN "F3" (fun th1-> REWRITE_TAC[MATCH_MP lemma_in_quotient (CONJ th th1)]))) + THEN STRIP_TAC + THEN SUBGOAL_THEN `L':(A)loop = L:(A)loop` SUBST_ALL_TAC + THENL[MP_TAC(SPECL[`H:(A)hypermap`; `L':(A)loop`; `x':A`] atom_reflect) + THEN UNDISCH_THEN `atom (H:(A)hypermap) (L:(A)loop) (x:A) = atom (H:(A)hypermap) (L':(A)loop) (x':A)` (SUBST1_TAC o SYM) + THEN USE_THEN "F3"(fun th2->(DISCH_THEN(fun th3->ASSUME_TAC(MATCH_MP lemma_in_loop (CONJ th2 th3))))) + THEN MATCH_MP_TAC disjoint_loops + THEN EXISTS_TAC `H:(A)hypermap` THEN EXISTS_TAC `NF:(A)loop->bool` THEN EXISTS_TAC `x':A` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM MP_TAC + THEN MP_TAC(SPECL[`H:(A)hypermap`; `L:(A)loop`; `x':A`] atom_reflect) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN USE_THEN "F1"(fun th1->(USE_THEN "F2"(fun th2->(USE_THEN "F3"(fun th3->(DISCH_THEN(fun th4->MP_TAC(MATCH_MP change_parameters (CONJ th1 (CONJ th2 (CONJ th3 th4))))))))))) + THEN DISCH_THEN (SUBST1_TAC o CONJUNCT1) + THEN SIMP_TAC[]);; + +let unique_nmap = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) L:(A)loop L':(A)loop x:A. is_normal H NF /\ L IN NF /\ L' IN NF /\ x belong L /\ node_map H (tail H NF x) belong L' ==> nmap H NF (atom H L x) = atom H L' ((node_map H) (tail H NF x))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5"))))) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT2 o SPEC `atom (H:(A)hypermap) (L:(A)loop) (x:A)` o MATCH_MP lemma_node_map) + THEN USE_THEN "F2" (fun th-> (USE_THEN "F4" (fun th1-> REWRITE_TAC[MATCH_MP lemma_in_quotient (CONJ th th1)]))) + THEN STRIP_TAC + THEN SUBGOAL_THEN `L'':(A)loop = L:(A)loop` SUBST_ALL_TAC + THENL[MP_TAC(SPECL[`H:(A)hypermap`; `L'':(A)loop`; `x':A`] atom_reflect) + THEN UNDISCH_THEN `atom (H:(A)hypermap) (L:(A)loop) (x:A) = atom (H:(A)hypermap) (L'':(A)loop) (x':A)` (SUBST1_TAC o SYM) + THEN USE_THEN "F4"(fun th2->(DISCH_THEN(fun th3->ASSUME_TAC(MATCH_MP lemma_in_loop (CONJ th2 th3))))) + THEN MATCH_MP_TAC disjoint_loops + THEN EXISTS_TAC `H:(A)hypermap` THEN EXISTS_TAC `NF:(A)loop->bool` THEN EXISTS_TAC `x':A` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN MP_TAC(SPECL[`H:(A)hypermap`; `L:(A)loop`; `x':A`] atom_reflect) + THEN UNDISCH_THEN `atom (H:(A)hypermap) (L:(A)loop) (x:A) = atom (H:(A)hypermap) (L:(A)loop) (x':A)` (SUBST1_TAC o SYM) + THEN USE_THEN "F1"(fun th1->(USE_THEN "F2"(fun th2->(USE_THEN "F4"(fun th3->(DISCH_THEN(fun th4->MP_TAC(MATCH_MP change_parameters (CONJ th1 (CONJ th2 (CONJ th3 th4))))))))))) + THEN DISCH_THEN (ASSUME_TAC o CONJUNCT2) + THEN SUBGOAL_THEN `L''':(A)loop = L':(A)loop` SUBST_ALL_TAC + THENL[MATCH_MP_TAC disjoint_loops + THEN EXISTS_TAC `H:(A)hypermap` THEN EXISTS_TAC `NF:(A)loop->bool` + THEN EXISTS_TAC `node_map (H:(A)hypermap) (tail H (NF:(A)loop->bool) (x':A))` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]));; + +let fmap_permute = prove(`!(H:(A)hypermap) (NF:(A)loop->bool). is_normal H NF ==> (fmap H NF) permutes (quotient_darts H NF)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN REWRITE_TAC[permutes] + THEN STRIP_TAC + THENL[USE_THEN "F1" (fun th -> REWRITE_TAC[MATCH_MP lemma_face_map th]); ALL_TAC] + THEN REWRITE_TAC[EXISTS_UNIQUE] + THEN GEN_TAC + THEN ASM_CASES_TAC `~(y:A->bool IN (quotient_darts (H:(A)hypermap) (NF:(A)loop->bool)))` + THENL[EXISTS_TAC `y:A->bool` + THEN USE_THEN "F1" (MP_TAC o CONJUNCT1 o SPEC `y:A->bool` o MATCH_MP lemma_face_map) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th-> REWRITE_TAC[th] THEN (LABEL_TAC "G1" th)) + THEN GEN_TAC + THEN ASM_CASES_TAC `~(y':A->bool IN quotient_darts (H:(A)hypermap) (NF:(A)loop->bool))` + THENL[USE_THEN "F1" (MP_TAC o CONJUNCT1 o SPEC `y':A->bool` o MATCH_MP lemma_face_map) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN(fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[quotient_darts; IN_ELIM_THM]) + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (X_CHOOSE_THEN `x:A` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "G2") (LABEL_TAC "G3")) SUBST1_TAC))) + THEN USE_THEN "F1"(fun th1->(USE_THEN "G2"(fun th2->(USE_THEN "G3"(fun th3->(MP_TAC(MATCH_MP unique_fmap(CONJ th1 (CONJ th2 th3))))))))) + THEN DISCH_THEN (SUBST1_TAC) + THEN DISCH_TAC + THEN SUBGOAL_THEN `y:A->bool IN quotient_darts (H:(A)hypermap) (NF:(A)loop->bool)` MP_TAC + THENL[ POP_ASSUM (SUBST1_TAC o SYM) + THEN MATCH_MP_TAC lemma_in_quotient + THEN USE_THEN "F1"(fun th1->(USE_THEN "G2"(fun th2->(USE_THEN "G3"(fun th3->REWRITE_TAC[MATCH_MP face_map_on_margin (CONJ th1 (CONJ th2 th3))]))))) + THEN USE_THEN "G2" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F2" o REWRITE_RULE[]) + THEN USE_THEN "F2" (MP_TAC o REWRITE_RULE[quotient_darts; IN_ELIM_THM]) + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (X_CHOOSE_THEN `x:A` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")) SUBST1_TAC))) + THEN USE_THEN "F3" (fun th -> (USE_THEN "F1" (LABEL_TAC "FC" o CONJUNCT1 o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN EXISTS_TAC `atom (H:(A)hypermap) (L:(A)loop) ((inverse (face_map (H:(A)hypermap))) (tail H (NF:(A)loop->bool) (x:A)))` + THEN STRIP_TAC + THENL[USE_THEN "F1"(fun th1->(USE_THEN "F3"(fun th2->(USE_THEN "F4"(fun th3->MP_TAC(MATCH_MP face_map_on_margin (CONJ th1 (CONJ th2 th3)))))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (CONJUNCTS_THEN2 (LABEL_TAC "F7") (LABEL_TAC "F8")))) + THEN USE_THEN "F1"(fun th1->(USE_THEN "F3"(fun th2->(USE_THEN "F6"(fun th3->(MP_TAC(MATCH_MP unique_fmap(CONJ th1 (CONJ th2 th3))))))))) + THEN DISCH_THEN SUBST1_TAC + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN REWRITE_TAC[MATCH_MP PERMUTES_INVERSES (CONJUNCT2 (SPEC `H:(A)hypermap` face_map_and_darts))] + THEN CONV_TAC SYM_CONV + THEN MATCH_MP_TAC lemma_identity_atom + THEN USE_THEN "F1"(fun th1->(USE_THEN "F3"(fun th2->(USE_THEN "F4"(fun th3->(REWRITE_TAC[CONJUNCT1(MATCH_MP tail_on_loop (CONJ th1 (CONJ th2 th3)))])))))) + THEN USE_THEN "FC" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN GEN_TAC + THEN ASM_CASES_TAC `~(y':A->bool IN quotient_darts (H:(A)hypermap) (NF:(A)loop->bool))` + THENL[USE_THEN "F1" (MP_TAC o CONJUNCT1 o SPEC `y':A->bool` o MATCH_MP lemma_face_map) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_TAC + THEN FIRST_X_ASSUM (MP_TAC o check (is_neg o concl)) + THEN POP_ASSUM SUBST1_TAC + THEN USE_THEN "F3" (fun th-> (USE_THEN "F4" (fun th1 -> (REWRITE_TAC[MATCH_MP lemma_in_quotient (CONJ th th1)])))); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[quotient_darts; IN_ELIM_THM]) + THEN DISCH_THEN (X_CHOOSE_THEN `L':(A)loop` (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6")) SUBST1_TAC))) + THEN USE_THEN "F1"(fun th1->(USE_THEN "F5"(fun th2->(USE_THEN "F6"(fun th3->(MP_TAC(MATCH_MP unique_fmap(CONJ th1 (CONJ th2 th3))))))))) + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "F7") + THEN USE_THEN "F1"(fun th1->(USE_THEN "F5"(fun th2->(USE_THEN "F6"(fun th3->MP_TAC(CONJUNCT1(MATCH_MP face_map_on_margin (CONJ th1 (CONJ th2 th3))))))))) + THEN DISCH_THEN (LABEL_TAC "F8") + THEN SUBGOAL_THEN `L':(A)loop = L:(A)loop` SUBST_ALL_TAC + THENL[MP_TAC(SPECL[`H:(A)hypermap`; `L:(A)loop`; `x:A`] atom_reflect) + THEN REMOVE_THEN "F7" (SUBST1_TAC o SYM) + THEN USE_THEN "F8"(fun th2->(DISCH_THEN(fun th3->ASSUME_TAC(MATCH_MP lemma_in_loop (CONJ th2 th3))))) + THEN MATCH_MP_TAC disjoint_loops + THEN EXISTS_TAC `H:(A)hypermap` THEN EXISTS_TAC `NF:(A)loop->bool` THEN EXISTS_TAC `x:A` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN MP_TAC(SPECL[`H:(A)hypermap`; `L:(A)loop`; `x:A`] atom_reflect) + THEN USE_THEN "F7" (SUBST1_TAC o SYM) + THEN USE_THEN "F1"(fun th1->(USE_THEN "F3"(fun th2->(USE_THEN "F8"(fun th3->(DISCH_THEN(fun th4->MP_TAC(MATCH_MP change_parameters (CONJ th1 (CONJ th2 (CONJ th3 th4))))))))))) + THEN DISCH_THEN (SUBST1_TAC o CONJUNCT2) + THEN USE_THEN "F1"(fun th1->(USE_THEN "F5"(fun th2->(USE_THEN "F6"(fun th3->MP_TAC(MATCH_MP face_map_on_margin (CONJ th1 (CONJ th2 th3)))))))) + THEN DISCH_THEN (SUBST1_TAC o SYM o CONJUNCT1 o CONJUNCT2 o CONJUNCT2) + THEN REWRITE_TAC [MATCH_MP PERMUTES_INVERSES (CONJUNCT2 (SPEC `H:(A)hypermap` face_map_and_darts))] + THEN USE_THEN "F1"(fun th1->(USE_THEN "F5"(fun th2->(USE_THEN "F6"(fun th3->REWRITE_TAC[MATCH_MP change_to_margin (CONJ th1 (CONJ th2 th3))]))))));; + +let nmap_permute = prove(`!(H:(A)hypermap) (NF:(A)loop->bool). is_normal H NF ==> (nmap H NF) permutes (quotient_darts H NF)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN REWRITE_TAC[permutes] + THEN STRIP_TAC + THENL[USE_THEN "F1" (fun th -> REWRITE_TAC[MATCH_MP lemma_node_map th]); ALL_TAC] + THEN REWRITE_TAC[EXISTS_UNIQUE] + THEN GEN_TAC + THEN ASM_CASES_TAC `~(y:A->bool IN (quotient_darts (H:(A)hypermap) (NF:(A)loop->bool)))` +THENL[EXISTS_TAC `y:A->bool` + THEN USE_THEN "F1" (MP_TAC o CONJUNCT1 o SPEC `y:A->bool` o MATCH_MP lemma_node_map) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (fun th-> REWRITE_TAC[th] THEN (LABEL_TAC "G1" th)) + THEN GEN_TAC + THEN ASM_CASES_TAC `~(y':A->bool IN quotient_darts (H:(A)hypermap) (NF:(A)loop->bool))` + THENL[USE_THEN "F1" (MP_TAC o CONJUNCT1 o SPEC `y':A->bool` o MATCH_MP lemma_node_map) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN(fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[quotient_darts; IN_ELIM_THM]) + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (X_CHOOSE_THEN `x:A` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "G2") (LABEL_TAC "G3")) SUBST1_TAC))) + THEN USE_THEN "G2" (fun th -> (USE_THEN "F1" (LABEL_TAC "FC" o CONJUNCT1 o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN USE_THEN "F1"(fun th->(USE_THEN "G2"(fun th2->(USE_THEN "G3"(fun th3-> MP_TAC (CONJUNCT1 (MATCH_MP node_map_on_margin (CONJ th (CONJ th2 th3))))))))) + THEN DISCH_THEN (X_CHOOSE_THEN `L':(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "G4") (CONJUNCTS_THEN2 (LABEL_TAC "G5") (LABEL_TAC "G6")))) + THEN DISCH_THEN (LABEL_TAC "G7") + THEN USE_THEN "G5" MP_TAC THEN USE_THEN "G3" MP_TAC THEN USE_THEN "G4" MP_TAC THEN USE_THEN "G2" MP_TAC THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP unique_nmap) + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_TAC + THEN FIRST_X_ASSUM (MP_TAC o check (is_neg o concl)) + THEN POP_ASSUM (fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN USE_THEN "G4" (fun th1 -> (USE_THEN "G5" (fun th2 -> REWRITE_TAC[MATCH_MP lemma_in_quotient (CONJ th1 th2)]))); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[quotient_darts; IN_ELIM_THM]) + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (X_CHOOSE_THEN `x:A` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")) SUBST1_TAC))) + THEN USE_THEN "F3" (fun th -> (USE_THEN "F1" (LABEL_TAC "FC" o CONJUNCT1 o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN USE_THEN "F1"(fun th->(USE_THEN "F3"(fun th2->(USE_THEN "F4"(fun th3-> MP_TAC (CONJUNCT2 (MATCH_MP node_map_on_margin (CONJ th (CONJ th2 th3))))))))) + THEN DISCH_THEN (X_CHOOSE_THEN `L':(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "G4") (CONJUNCTS_THEN2 (LABEL_TAC "G5") (LABEL_TAC "G6")))) + THEN EXISTS_TAC `atom (H:(A)hypermap) (L':(A)loop) ((inverse (node_map (H:(A)hypermap))) (head H (NF:(A)loop->bool) (x:A)))` + THEN ABBREV_TAC `y = inverse (node_map H) (head H NF (x:A))` + THEN POP_ASSUM (MP_TAC o AP_TERM `node_map (H:(A)hypermap)`) + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [MATCH_MP PERMUTES_INVERSES (CONJUNCT2(SPEC `H:(A)hypermap` node_map_and_darts))] + THEN DISCH_THEN (LABEL_TAC "G7" o SYM) + THEN USE_THEN "F1"(fun th->(USE_THEN "F3"(fun th2->(USE_THEN "F4"(fun th3-> MP_TAC (CONJUNCT1 (MATCH_MP head_on_loop (CONJ th (CONJ th2 th3))))))))) + THEN USE_THEN "G7" (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "F8") + THEN USE_THEN "F4"(fun th2->(USE_THEN "F8"(fun th3-> MP_TAC (MATCH_MP lemma_in_loop (CONJ th2 th3))))) + THEN USE_THEN "G6" (fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN USE_THEN "G5" MP_TAC THEN USE_THEN "F3" MP_TAC THEN USE_THEN "G4" MP_TAC THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP unique_nmap) + THEN USE_THEN "G6" (SUBST1_TAC o SYM) + THEN USE_THEN "G7" (SUBST1_TAC ) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F1"(fun th->(USE_THEN "F3"(fun th2->(USE_THEN "F4"(fun th3-> REWRITE_TAC[MATCH_MP change_to_margin (CONJ th (CONJ th2 th3))]))))) + THEN GEN_TAC + THEN ASM_CASES_TAC `~(y':A->bool IN quotient_darts (H:(A)hypermap) (NF:(A)loop->bool))` + THENL[USE_THEN "F1" (fun th -> REWRITE_TAC[MATCH_MP lemma_node_map th]) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT1 o SPEC `y':A->bool` o MATCH_MP lemma_node_map) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_TAC + THEN FIRST_X_ASSUM (MP_TAC o check (is_neg o concl)) + THEN POP_ASSUM SUBST1_TAC + THEN USE_THEN "F1"(fun th->(USE_THEN "F3"(fun th2->(USE_THEN "F4"(fun th3-> MP_TAC (CONJUNCT1 (MATCH_MP head_on_loop (CONJ th (CONJ th2 th3))))))))) + THEN USE_THEN "F4"(fun th2->(DISCH_THEN(fun th3-> MP_TAC (MATCH_MP lemma_in_loop (CONJ th2 th3))))) + THEN USE_THEN "F3" (fun th1 -> (DISCH_THEN (fun th2 -> REWRITE_TAC[MATCH_MP lemma_in_quotient (CONJ th1 th2)]))); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[quotient_darts; IN_ELIM_THM]) + THEN DISCH_THEN (X_CHOOSE_THEN `P:(A)loop`(X_CHOOSE_THEN `z:A` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "F9") (LABEL_TAC "F10")) SUBST1_TAC))) + THEN USE_THEN "F9" (fun th1 -> (USE_THEN "F10" (fun th2 -> ASSUME_TAC(SPEC `H:(A)hypermap`(MATCH_MP lemma_in_quotient (CONJ th1 th2)))))) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT2 o SPEC `atom (H:(A)hypermap) (P:(A)loop) (z:A)` o MATCH_MP lemma_node_map) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (X_CHOOSE_THEN `Q:(A)loop` (X_CHOOSE_THEN `Q':(A)loop` (X_CHOOSE_THEN `t:A` (CONJUNCTS_THEN2 (LABEL_TAC "F11") MP_TAC)))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F12") (CONJUNCTS_THEN2 (LABEL_TAC "F14") (CONJUNCTS_THEN2 (LABEL_TAC "F15") MP_TAC))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F17") SUBST1_TAC) + THEN USE_THEN "F1"(fun th->(USE_THEN "F3"(fun th2->(USE_THEN "F4"(fun th3-> REWRITE_TAC[GSYM(MATCH_MP change_to_margin (CONJ th (CONJ th2 th3)))]))))) + THEN DISCH_THEN (LABEL_TAC "F18") + THEN SUBGOAL_THEN `Q:(A)loop = P:(A)loop` SUBST_ALL_TAC + THENL[MP_TAC(SPECL[`H:(A)hypermap`; `P:(A)loop`; `z:A`] atom_reflect) + THEN USE_THEN "F17" SUBST1_TAC + THEN USE_THEN "F14" MP_TAC + THEN USE_THEN "F11" (fun th -> (USE_THEN "F1" (MP_TAC o CONJUNCT1 o REWRITE_RULE[th] o SPEC `Q:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (ASSUME_TAC o MATCH_MP lemma_in_loop o CONJUNCT2) + THEN MATCH_MP_TAC disjoint_loops + THEN EXISTS_TAC `H:(A)hypermap` THEN EXISTS_TAC `NF:(A)loop->bool` THEN EXISTS_TAC `z:A` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `Q':(A)loop = L:(A)loop` SUBST_ALL_TAC + THENL[MP_TAC(SPECL[`H:(A)hypermap`; `L:(A)loop`; `x:A`] atom_reflect) + THEN USE_THEN "F18" (SUBST1_TAC o SYM) + THEN USE_THEN "F15" MP_TAC + THEN USE_THEN "F12" (fun th -> (USE_THEN "F1" (MP_TAC o CONJUNCT1 o REWRITE_RULE[th] o SPEC `Q':(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (ASSUME_TAC o MATCH_MP lemma_in_loop o (CONJUNCT2)) + THEN MATCH_MP_TAC disjoint_loops + THEN EXISTS_TAC `H:(A)hypermap` THEN EXISTS_TAC `NF:(A)loop->bool` THEN EXISTS_TAC `x:A` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN REMOVE_THEN "F17" (SUBST1_TAC) + THEN USE_THEN "F1"(fun th->(USE_THEN "F11"(fun th2->(USE_THEN "F14"(fun th3->MP_TAC(CONJUNCT1(MATCH_MP node_map_free_loop (CONJ th (CONJ th2 th3))))))))) + THEN MP_TAC(SPECL[`H:(A)hypermap`; `L:(A)loop`; `node_map (H:(A)hypermap) (tail H (NF:(A)loop->bool) (t:A))`] atom_reflect) + THEN USE_THEN "F18" SUBST1_TAC + THEN USE_THEN "F1"(fun th1->(USE_THEN "F3"(fun th2->(USE_THEN "F4"(fun th3->(DISCH_THEN(fun th4->MP_TAC(CONJUNCT1(MATCH_MP change_parameters (CONJ th1 (CONJ th2 (CONJ th3 th4)))))))))))) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "G7" (SUBST1_TAC o SYM) + THEN REWRITE_TAC[node_map_injective] + THEN DISCH_THEN (LABEL_TAC "F19") + THEN USE_THEN "F1"(fun th1->(USE_THEN "F11"(fun th2->(USE_THEN "F14"(fun th3->LABEL_TAC "F20"(CONJUNCT1(MATCH_MP change_to_margin (CONJ th1 (CONJ th2 th3))))))))) + THEN SUBGOAL_THEN `P:(A)loop = L':(A)loop` SUBST_ALL_TAC + THENL[ MP_TAC(SPECL[`H:(A)hypermap`; `P:(A)loop`; `(tail H (NF:(A)loop->bool) (t:A))`] atom_reflect) + THEN USE_THEN "F20" (SUBST1_TAC o SYM) + THEN USE_THEN "F19" SUBST1_TAC + THEN USE_THEN "F14" MP_TAC + THEN USE_THEN "F11" (fun th -> (USE_THEN "F1" (MP_TAC o CONJUNCT1 o REWRITE_RULE[th] o SPEC `P:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (ASSUME_TAC o MATCH_MP lemma_in_loop o CONJUNCT2) + THEN MATCH_MP_TAC disjoint_loops + THEN EXISTS_TAC `H:(A)hypermap` THEN EXISTS_TAC `NF:(A)loop->bool` THEN EXISTS_TAC `y:A` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN REPLICATE_TAC 2 (POP_ASSUM SUBST1_TAC) + THEN POP_ASSUM SUBST1_TAC + THEN SIMP_TAC[]);; + +(* THE DEFINITION OF THE QUOTION HYPERMAP *) + +let emap = new_definition `!(H:(A)hypermap) (NF:(A)loop->bool). emap H NF = inverse (fmap H NF) o inverse (nmap H NF)`;; + +let emap_permute = prove(`!(H:(A)hypermap) (NF:(A)loop->bool). is_normal H NF ==> (emap H NF) permutes (quotient_darts H NF)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN REWRITE_TAC[emap] + THEN MATCH_MP_TAC PERMUTES_COMPOSE + THEN USE_THEN "F1" (MP_TAC o MATCH_MP nmap_permute) + THEN DISCH_THEN (fun th->REWRITE_TAC[MATCH_MP PERMUTES_INVERSE th]) + THEN USE_THEN "F1" (MP_TAC o MATCH_MP fmap_permute) + THEN DISCH_THEN (fun th->REWRITE_TAC[MATCH_MP PERMUTES_INVERSE th]));; + +let quotient = new_definition `!(H:(A)hypermap) (NF:(A)loop->bool). quotient H NF = hypermap (quotient_darts H NF, emap H NF, nmap H NF, fmap H NF)`;; + +let lemma_quotient = prove(`!(H:(A)hypermap) (NF:(A)loop->bool). is_normal H NF ==> dart (quotient H NF) = quotient_darts H NF /\ edge_map (quotient H NF) = emap H NF /\ node_map (quotient H NF) = nmap H NF /\ face_map (quotient H NF) = fmap H NF`, + REPEAT GEN_TAC THEN DISCH_THEN (LABEL_TAC "F1") + THEN USE_THEN "F1" (ASSUME_TAC o MATCH_MP lemma_finite_quotient_darts) + THEN USE_THEN "F1" (LABEL_TAC "F2" o MATCH_MP nmap_permute) + THEN USE_THEN "F1" (LABEL_TAC "F3" o MATCH_MP fmap_permute) + THEN USE_THEN "F1" (LABEL_TAC "F4" o MATCH_MP emap_permute) + THEN REWRITE_TAC[quotient] + THEN ABBREV_TAC `D = quotient_darts (H:(A)hypermap) (NF:(A)loop->bool)` + THEN ABBREV_TAC `e = emap (H:(A)hypermap) (NF:(A)loop->bool)` + THEN ABBREV_TAC `n = nmap (H:(A)hypermap) (NF:(A)loop->bool)` + THEN ABBREV_TAC `f = fmap (H:(A)hypermap) (NF:(A)loop->bool)` + THEN SUBGOAL_THEN `(e:(A->bool)->(A->bool)) o (n:(A->bool)->(A->bool)) o (f:(A->bool)->(A->bool)) = I` ASSUME_TAC + THENL[EXPAND_TAC "e" THEN EXPAND_TAC "n" THEN EXPAND_TAC "f" + THEN REWRITE_TAC[emap] THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[GSYM o_ASSOC] THEN REWRITE_TAC[lemma_4functions] + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[MATCH_MP PERMUTES_INVERSES_o th; I_O_ID]) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP PERMUTES_INVERSES_o th; I_O_ID]); ALL_TAC] + THEN MATCH_MP_TAC lemma_hypermap_rep THEN ASM_REWRITE_TAC[]);; + +let choice_reflect = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (x:A). is_normal H NF ==> x IN choice H NF x`, + REPEAT GEN_TAC THEN DISCH_THEN (LABEL_TAC "F1") + THEN ASM_CASES_TAC `~(x:A IN support_darts NF)` + THENL[USE_THEN "F1" (MP_TAC o SPEC `x:A` o CONJUNCT1 o MATCH_MP first_unique_choice) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC THEN REWRITE_TAC[IN_SING]; ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[support_darts; lemma_in_support]) + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` MP_TAC) + THEN POP_ASSUM (fun th -> (DISCH_THEN (fun th1-> MP_TAC (MATCH_MP unique_choice (CONJ th th1))))) + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[atom_reflect]);; + +let lemma_choice_in_quotient = prove(`!(H:(A)hypermap) (NF:(A)loop->bool). is_normal H NF ==> (!x:A. choice H NF x IN quotient_darts H NF <=> x IN support_darts NF)`, + REPEAT GEN_TAC THEN DISCH_THEN (LABEL_TAC "F1") THEN GEN_TAC + THEN REWRITE_TAC[quotient_darts; IN_ELIM_THM] + THEN EQ_TAC + THENL[DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3")) (ASSUME_TAC)))) + THEN MP_TAC (SPECL[`H:(A)hypermap`; `NF:(A)loop->bool`; `x:A`] choice_reflect) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM SUBST1_TAC + THEN POP_ASSUM (fun th->(DISCH_THEN(fun th1->MP_TAC(MATCH_MP lemma_in_loop (CONJ th th1))))) + THEN POP_ASSUM (fun th->(DISCH_THEN(fun th1->MP_TAC(MATCH_MP lemma_in_support2 (CONJ th1 th))))) + THEN SIMP_TAC[]; ALL_TAC] + THEN REWRITE_TAC[lemma_in_support] + THEN DISCH_THEN (X_CHOOSE_THEN `L':(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "G1") (LABEL_TAC "G2"))) + THEN EXISTS_TAC `L':(A)loop` + THEN EXISTS_TAC `x:A` + THEN ASM_REWRITE_TAC[] + THEN MATCH_MP_TAC unique_choice + THEN ASM_REWRITE_TAC[]);; + +let atom_via_choice = prove(`!(H:(A)hypermap) (NF:(A)loop->bool). is_normal H NF ==> !atm:A->bool. atm IN quotient_darts H NF <=> ?x:A. x IN support_darts NF /\ atm = choice H NF x`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN GEN_TAC + THEN EQ_TAC + THENL[REWRITE_TAC[quotient_darts; IN_ELIM_THM] + THEN DISCH_THEN(X_CHOOSE_THEN `L:(A)loop`(X_CHOOSE_THEN `x:A` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3")) (SUBST1_TAC)))) + THEN EXISTS_TAC `x:A` + THEN USE_THEN "F3"(fun th->(USE_THEN "F2"(fun th1-> REWRITE_TAC[MATCH_MP lemma_in_support2 (CONJ th th1)]))) + THEN CONV_TAC SYM_CONV + THEN MATCH_MP_TAC unique_choice + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN ASM_MESON_TAC[lemma_choice_in_quotient]);; + +let choice_identity = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (x:A) (y:A). is_normal H NF /\ y IN choice H NF x ==> choice H NF y = choice H NF x`, + REPEAT GEN_TAC + THEN REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN ASM_CASES_TAC `~(x:A IN support_darts (NF:(A)loop->bool))` + THENL[USE_THEN "F1" (MP_TAC o SPEC `x:A` o CONJUNCT1 o MATCH_MP first_unique_choice) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "F3") + THEN REMOVE_THEN "F2" MP_TAC + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[th]) + THEN REWRITE_TAC[IN_SING] + THEN DISCH_THEN SUBST1_TAC + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[lemma_in_support]) + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4"))) + THEN USE_THEN "F1"(fun th->(USE_THEN "F3"(fun th2->(USE_THEN "F4"(fun th3->MP_TAC (MATCH_MP unique_choice (CONJ th(CONJ th2 th3)))))))) + THEN DISCH_THEN SUBST_ALL_TAC + THEN USE_THEN "F2" (fun th->REWRITE_TAC[MATCH_MP lemma_identity_atom th]) + THEN MATCH_MP_TAC unique_choice + THEN ASM_REWRITE_TAC[] + THEN USE_THEN "F4"(fun th->(USE_THEN "F2"(fun th1->REWRITE_TAC[MATCH_MP lemma_in_loop (CONJ th th1)]))));; + +let choice_at_margin = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (x:A). is_normal H NF + ==> choice H NF x = choice H NF (tail H NF x) /\ choice H NF x = choice H NF (head H NF x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN ASM_CASES_TAC `~(x:A IN support_darts (NF:(A)loop->bool))` + THENL[USE_THEN "F1" (MP_TAC o CONJUNCT1 o SPEC `x:A` o MATCH_MP lemma_head_tail) + THEN ASM_REWRITE_TAC[] + THEN MESON_TAC[]; ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[lemma_in_support]) + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN USE_THEN "F1"(fun th->(USE_THEN "F2"(fun th1->(USE_THEN "F3"(fun th2->LABEL_TAC "F4"(CONJUNCT1(MATCH_MP head_on_loop (CONJ th (CONJ th1 th2))))))))) + THEN USE_THEN "F1"(fun th->(USE_THEN "F2"(fun th1->(USE_THEN "F3"(fun th2->LABEL_TAC "F5"(CONJUNCT1(MATCH_MP tail_on_loop (CONJ th (CONJ th1 th2))))))))) + THEN USE_THEN "F1"(fun th->(USE_THEN "F2"(fun th1->(USE_THEN "F3"(fun th2->MP_TAC(MATCH_MP unique_choice (CONJ th (CONJ th1 th2)))))))) + THEN DISCH_THEN (SUBST_ALL_TAC o SYM) + THEN USE_THEN "F1" (fun th-> (USE_THEN "F4"(fun th1->REWRITE_TAC[MATCH_MP choice_identity (CONJ th th1)]))) + THEN USE_THEN "F1" (fun th-> (USE_THEN "F5"(fun th1->REWRITE_TAC[MATCH_MP choice_identity (CONJ th th1)]))));; + +let choice_and_head_tail = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (x:A). is_normal H NF + ==> tail H NF x IN choice H NF x /\ head H NF x IN choice H NF x`, + REPEAT GEN_TAC THEN DISCH_THEN (LABEL_TAC "F1") + THEN STRIP_TAC + THENL[USE_THEN "F1" (MP_TAC o CONJUNCT1 o SPEC `x:A` o MATCH_MP choice_at_margin) + THEN DISCH_THEN SUBST1_TAC + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP choice_reflect th]); ALL_TAC] + THEN USE_THEN "F1" (MP_TAC o CONJUNCT2 o SPEC `x:A` o MATCH_MP choice_at_margin) + THEN DISCH_THEN SUBST1_TAC + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP choice_reflect th]));; + + +let fmap_via_choice = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (x:A). is_normal H NF /\ x IN support_darts NF ==> face_map H (head H NF x) IN support_darts NF /\ face_map H (head H NF x) = tail H NF (face_map H (head H NF x)) /\ fmap H NF (choice H NF x) = choice H NF (face_map H (head H NF x))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (MP_TAC o REWRITE_RULE[lemma_in_support])) + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN USE_THEN "F1"(fun th->(USE_THEN "F2"(fun th1->(USE_THEN "F3"(fun th2->MP_TAC(MATCH_MP face_map_on_margin (CONJ th (CONJ th1 th2)))))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F4") (SUBST1_TAC o SYM o CONJUNCT1 o CONJUNCT2)) + THEN REWRITE_TAC[] + THEN USE_THEN "F4"(fun th->(USE_THEN "F2"(fun th1->(REWRITE_TAC[MATCH_MP lemma_in_support2 (CONJ th th1)])))) + THEN USE_THEN "F1"(fun th->(USE_THEN "F2"(fun th1->(USE_THEN "F3"(fun th2->MP_TAC(MATCH_MP unique_fmap (CONJ th (CONJ th1 th2)))))))) + THEN USE_THEN "F1"(fun th->(USE_THEN "F2"(fun th1->(USE_THEN "F3"(fun th2->MP_TAC(MATCH_MP unique_choice (CONJ th (CONJ th1 th2)))))))) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F1"(fun th->(USE_THEN "F2"(fun th1->(USE_THEN "F4"(fun th2->MP_TAC(MATCH_MP unique_choice (CONJ th (CONJ th1 th2)))))))) + THEN DISCH_THEN SUBST1_TAC + THEN SIMP_TAC[]);; + +let nmap_via_choice = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (x:A). is_normal H NF /\ x IN support_darts NF ==> node_map H (tail H NF x) IN support_darts NF /\ node_map H (tail H NF x) = head H NF (node_map H (tail H NF x)) /\ nmap H NF (choice H NF x) = choice H NF (node_map H (tail H NF x))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (MP_TAC o REWRITE_RULE[lemma_in_support])) + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN USE_THEN "F1"(fun th->(USE_THEN "F2"(fun th1->(USE_THEN "F3"(fun th2->MP_TAC(CONJUNCT1(MATCH_MP node_map_on_margin (CONJ th (CONJ th1 th2))))))))) + THEN DISCH_THEN (X_CHOOSE_THEN `L':(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (SUBST1_TAC o SYM)))) + THEN REWRITE_TAC[] + THEN USE_THEN "F5"(fun th->(USE_THEN "F4"(fun th1->(REWRITE_TAC[MATCH_MP lemma_in_support2 (CONJ th th1)])))) + THEN USE_THEN "F1"(fun th->(USE_THEN "F2"(fun th1->(USE_THEN "F3"(fun th2->REWRITE_TAC[MATCH_MP unique_choice (CONJ th (CONJ th1 th2))]))))) + THEN USE_THEN "F1"(fun th->(USE_THEN "F4"(fun th1->(USE_THEN "F5"(fun th2->REWRITE_TAC[MATCH_MP unique_choice (CONJ th (CONJ th1 th2))]))))) + THEN USE_THEN "F5" MP_TAC THEN USE_THEN "F3" MP_TAC THEN USE_THEN "F4" MP_TAC THEN USE_THEN "F2" MP_TAC THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (SUBST1_TAC o MATCH_MP unique_nmap) + THEN SIMP_TAC[]);; + +let emap_via_choice = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (x:A). is_normal H NF /\ x IN support_darts NF ==> edge_map H (head H NF x) IN support_darts NF /\ edge_map H (head H NF x) = head H NF (edge_map H (head H NF x)) /\ emap H NF (choice H NF x) = choice H NF (edge_map H (head H NF x))`, + REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (MP_TAC o REWRITE_RULE[lemma_in_support])) + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN USE_THEN "F1"(fun th->(USE_THEN "F2"(fun th1->(USE_THEN "F3"(fun th2->(MP_TAC(CONJUNCT2(MATCH_MP node_map_on_margin (CONJ th(CONJ th1 th2)))))))))) + THEN DISCH_THEN (X_CHOOSE_THEN `L':(A)loop`(CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6")))) + THEN USE_THEN "F1"(fun th->(USE_THEN "F4"(fun th1->(USE_THEN "F5"(fun th2->(MP_TAC(CONJUNCT2(MATCH_MP face_map_on_margin (CONJ th(CONJ th1 th2)))))))))) + THEN USE_THEN "F6" (fun th->REWRITE_TAC[SYM th]) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F7") (LABEL_TAC "F8" o CONJUNCT2)) + THEN REWRITE_TAC[CONJUNCT1(SPEC `H:(A)hypermap` inverse2_hypermap_maps); o_THM] + THEN USE_THEN "F8" (SUBST1_TAC o SYM) + THEN REWRITE_TAC[emap; o_THM] + THEN USE_THEN "F7" (fun th-> (USE_THEN "F4" (fun th1 -> REWRITE_TAC[MATCH_MP lemma_in_support2 (CONJ th th1)]))) + THEN USE_THEN "F1" (fun th-> MP_TAC (MATCH_MP fmap_permute th)) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP PERMUTES_INVERSE_EQ th]) + THEN CONV_TAC SYM_CONV + THEN USE_THEN "F1" (fun th-> MP_TAC (MATCH_MP nmap_permute th)) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP PERMUTES_INVERSE_EQ th]) + THEN USE_THEN "F4"(fun th->(USE_THEN "F7"(fun th1->MP_TAC(MATCH_MP lemma_in_support2 (CONJ th1 th))))) + THEN USE_THEN "F1"(fun th->(DISCH_THEN (fun th1->REWRITE_TAC[MATCH_MP fmap_via_choice (CONJ th th1)]))) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN REWRITE_TAC[MATCH_MP PERMUTES_INVERSES (CONJUNCT2(SPEC `H:(A)hypermap` face_map_and_darts))] + THEN USE_THEN "F4"(fun th->(USE_THEN "F5"(fun th1->MP_TAC(MATCH_MP lemma_in_support2 (CONJ th1 th))))) + THEN USE_THEN "F1"(fun th->(DISCH_THEN (fun th1->REWRITE_TAC[MATCH_MP nmap_via_choice (CONJ th th1)]))) + THEN REMOVE_THEN "F6" (SUBST1_TAC o SYM) + THEN REWRITE_TAC[MATCH_MP PERMUTES_INVERSES (CONJUNCT2(SPEC `H:(A)hypermap` node_map_and_darts))] + THEN USE_THEN "F1"(fun th->REWRITE_TAC[SYM(CONJUNCT2(SPEC `x:A`(MATCH_MP choice_at_margin th)))]));; + +let lemmaJMKRXLA = prove(`!(H:(A)hypermap) (NF:(A)loop->bool). is_normal H NF /\ plain_hypermap H ==> plain_hypermap (quotient H NF)`, + REPEAT GEN_TAC THEN REWRITE_TAC[plain_hypermap] + THEN DISCH_THEN(CONJUNCTS_THEN2 (LABEL_TAC "F1") ASSUME_TAC) + THEN REWRITE_TAC[MATCH_MP convolution_belong (CONJUNCT2 (ISPEC `quotient (H:(A)hypermap) (NF:(A)loop->bool)` edge_map_and_darts))] + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[MATCH_MP lemma_quotient th]) + THEN GEN_TAC + THEN USE_THEN "F1"(fun th-> REWRITE_TAC[MATCH_MP atom_via_choice th]) + THEN DISCH_THEN (X_CHOOSE_THEN `x:A` (CONJUNCTS_THEN2 ASSUME_TAC SUBST1_TAC)) + THEN USE_THEN "F1"(fun th -> (POP_ASSUM (fun th1 -> MP_TAC (MATCH_MP emap_via_choice (CONJ th th1))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 ASSUME_TAC (SUBST1_TAC))) + THEN USE_THEN "F1"(fun th -> (REMOVE_THEN "F3" (fun th1 -> MP_TAC (MATCH_MP emap_via_choice (CONJ th th1))))) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN DISCH_THEN (SUBST1_TAC o CONJUNCT2 o CONJUNCT2) + THEN POP_ASSUM(fun th->(MP_TAC (AP_THM th `head (H:(A)hypermap) (NF:(A)loop->bool) (x:A)`))) + THEN REWRITE_TAC[o_THM; I_THM] + THEN DISCH_THEN SUBST1_TAC + THEN POP_ASSUM (fun th-> MESON_TAC[MATCH_MP choice_at_margin th]));; + +(* The definition of isomorphic hypermaps *) + +let COMPOSE_INJ = prove(`!f:A->B g:B->C s t w. INJ f s t /\ INJ g t w ==> INJ (g o f) s w`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN SUBGOAL_THEN `!x:A. x IN s ==> (f:A->B) x IN t /\ ((g:B->C) (f x)) IN w` (LABEL_TAC "F3") + THENL[GEN_TAC THEN DISCH_TAC + THEN POP_ASSUM(fun th-> USE_THEN "F1" (ASSUME_TAC o REWRITE_RULE[th] o SPEC `x:A` o CONJUNCT1 o REWRITE_RULE[INJ])) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM(fun th-> USE_THEN "F2" (ASSUME_TAC o REWRITE_RULE[th] o SPEC `(f:A->B) (x:A)` o CONJUNCT1 o REWRITE_RULE[INJ])) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN REWRITE_TAC[INJ; o_THM] + THEN STRIP_TAC + THENL[GEN_TAC + THEN DISCH_THEN(fun th->(POP_ASSUM (MP_TAC o CONJUNCT2 o REWRITE_RULE[th] o SPEC `x:A`))) + THEN SIMP_TAC[]; ALL_TAC] + THEN REPEAT STRIP_TAC + THEN USE_THEN "F3" (MP_TAC o SPEC `x:A`) + THEN REMOVE_THEN "F3" (MP_TAC o SPEC `y:A`) + THEN ASM_REWRITE_TAC[] + THEN REPEAT STRIP_TAC + THEN REMOVE_THEN "F2" (MP_TAC o SPECL[`(f:A->B) (x:A)`; `(f:A->B) (y:A)`] o CONJUNCT2 o REWRITE_RULE[INJ]) + THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN REMOVE_THEN "F1" (MP_TAC o SPECL[`x:A`; `y:A`] o CONJUNCT2 o REWRITE_RULE[INJ] ) + THEN ASM_REWRITE_TAC[]);; + +let COMPOSE_SURJ = prove(`!f:A->B g:B->C s t w. SURJ f s t /\ SURJ g t w ==> SURJ (g o f) s w`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN REWRITE_TAC[SURJ; o_THM] + THEN STRIP_TAC + THENL[REPEAT STRIP_TAC + THEN POP_ASSUM(fun th-> USE_THEN "F1" (ASSUME_TAC o REWRITE_RULE[th] o SPEC `x:A` o CONJUNCT1 o REWRITE_RULE[SURJ])) + THEN POP_ASSUM(fun th-> USE_THEN "F2" (ASSUME_TAC o REWRITE_RULE[th] o SPEC `(f:A->B) (x:A)` o CONJUNCT1 o REWRITE_RULE[SURJ])) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN REPEAT STRIP_TAC + THEN POP_ASSUM(fun th->(REMOVE_THEN "F2" (MP_TAC o REWRITE_RULE[th] o SPEC `x:C` o CONJUNCT2 o REWRITE_RULE[SURJ]))) + THEN DISCH_THEN (X_CHOOSE_THEN `y:B` (CONJUNCTS_THEN2 ASSUME_TAC (SUBST1_TAC o SYM))) + THEN POP_ASSUM(fun th->(REMOVE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o SPEC `y:B` o CONJUNCT2 o REWRITE_RULE[SURJ]))) + THEN DISCH_THEN (X_CHOOSE_THEN `z:A` (CONJUNCTS_THEN2 ASSUME_TAC (SUBST1_TAC o SYM))) + THEN EXISTS_TAC `z:A` + THEN ASM_REWRITE_TAC[]);; + +let COMPOSE_BIJ = prove(`!f:A->B g:B->C s t w. BIJ f s t /\ BIJ g t w ==> BIJ (g o f) s w`, + MESON_TAC[BIJ; COMPOSE_INJ; COMPOSE_SURJ]);; + +let BIJ_INVERSE = prove(`!f:A->B s t. BIJ f s t ==> ?g:B->A. (!x:A. x IN s ==> g (f x) = x) /\ (!x:B. x IN t ==> f (g x) = x) /\ BIJ g t s`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1" o REWRITE_RULE[BIJ]) + THEN USE_THEN "F1" (MP_TAC o REWRITE_RULE[INJ] o CONJUNCT1) + THEN REWRITE_TAC[ISPECL[`f:A->B`; `s:A->bool`] INJECTIVE_ON_LEFT_INVERSE] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F2") (X_CHOOSE_THEN `g:B->A` (LABEL_TAC "F3"))) + THEN EXISTS_TAC `g:B->A` + THEN ASM_REWRITE_TAC[] + THEN SUBGOAL_THEN `SURJ (g:B->A) t s` (LABEL_TAC "F4") + THENL[REWRITE_TAC[SURJ] + THEN STRIP_TAC + THENL[REPEAT STRIP_TAC + THEN USE_THEN "F1" (MP_TAC o SPEC `x:B` o CONJUNCT2 o REWRITE_RULE[SURJ] o CONJUNCT2) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 ASSUME_TAC (SUBST1_TAC o SYM))) + THEN REMOVE_THEN "F3" (MP_TAC o SPEC `y:A`) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM (fun th -> MESON_TAC[th]); ALL_TAC] + THEN REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F4") + THEN USE_THEN "F4" (fun th -> (USE_THEN "F2" (ASSUME_TAC o REWRITE_RULE[th] o SPEC `x:A`))) + THEN EXISTS_TAC `(f:A->B) x` + THEN USE_THEN "F4" (fun th -> (USE_THEN "F3" (MP_TAC o REWRITE_RULE[th] o SPEC `x:A`))) + THEN POP_ASSUM (fun th-> SIMP_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `BIJ (g:B->A) t s` (LABEL_TAC "F5") + THENL[REWRITE_TAC[BIJ] + THEN ASM_REWRITE_TAC[INJ] + THEN STRIP_TAC + THENL[POP_ASSUM (fun th-> MESON_TAC[REWRITE_RULE[SURJ] th]); ALL_TAC] + THEN REPEAT GEN_TAC + THEN DISCH_THEN(CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7"))) + THEN REMOVE_THEN "F5"(fun th->(USE_THEN "F1"(MP_TAC o REWRITE_RULE[th] o SPEC `x:B` o CONJUNCT2 o REWRITE_RULE[SURJ] o CONJUNCT2))) + THEN DISCH_THEN (X_CHOOSE_THEN `a:A` (CONJUNCTS_THEN2 ASSUME_TAC (SUBST_ALL_TAC o SYM))) + THEN REMOVE_THEN "F6"(fun th->(USE_THEN "F1"(MP_TAC o REWRITE_RULE[th] o SPEC `y:B` o CONJUNCT2 o REWRITE_RULE[SURJ] o CONJUNCT2))) + THEN DISCH_THEN (X_CHOOSE_THEN `b:A` (CONJUNCTS_THEN2 ASSUME_TAC (SUBST_ALL_TAC o SYM))) + THEN AP_TERM_TAC + THEN POP_ASSUM(fun th->(USE_THEN "F3"(MP_TAC o REWRITE_RULE[th] o SPEC `b:A`))) + THEN REMOVE_THEN "F7" (SUBST1_TAC o SYM) + THEN POP_ASSUM(fun th->(REMOVE_THEN "F3"(MP_TAC o REWRITE_RULE[th] o SPEC `a:A`))) + THEN MESON_TAC[]; ALL_TAC] + THEN USE_THEN "F5" (fun th-> REWRITE_TAC[th]) + THEN GEN_TAC THEN (DISCH_THEN (LABEL_TAC "G1")) + THEN USE_THEN "G1" (fun th-> (USE_THEN "F4" (LABEL_TAC "G2" o REWRITE_RULE[th] o SPEC `x:B` o CONJUNCT1 o REWRITE_RULE[SURJ]))) + THEN USE_THEN "G2" (fun th-> (USE_THEN "F3" (fun thm -> (ASSUME_TAC (MATCH_MP thm th))))) + THEN USE_THEN "G2" (fun th-> (USE_THEN "F2" (fun thm -> (ASSUME_TAC (MATCH_MP thm th))))) + THEN USE_THEN "F5" (MP_TAC o CONJUNCT1 o REWRITE_RULE[BIJ]) + THEN USE_THEN "G1" (fun th-> (DISCH_THEN (MP_TAC o REWRITE_RULE[th] o SPECL[`(f:A->B) ((g:B->A) x)`; `x:B`] o CONJUNCT2 o REWRITE_RULE[INJ]))) + THEN ASM_REWRITE_TAC[]);; + +let I_BIJ = prove(`!s:A->bool. BIJ I s s`, REWRITE_TAC[BIJ; INJ; SURJ] THEN REWRITE_TAC[I_THM] THEN MESON_TAC[]);; + +let iso = new_definition `!(H:(A)hypermap) (H':(B)hypermap) . H iso H' <=> (?f:A->B. BIJ f (dart H) (dart H') /\ +!x:A. x IN dart H ==> (edge_map H') (f x) = f (edge_map H x) /\ (node_map H') (f x) = f (node_map H x) /\ (face_map H') (f x) = f (face_map H x))`;; + +let iso_reflect = prove(`!(H:(A)hypermap). H iso H`, + GEN_TAC THEN REWRITE_TAC[iso] THEN EXISTS_TAC `I:A->A` THEN REWRITE_TAC[I_THM; I_BIJ]);; + +let iso_sym = prove(`!(H:(A)hypermap) (G:(B)hypermap). H iso G ==> G iso H`, + REPEAT GEN_TAC + THEN REWRITE_TAC[iso] + THEN DISCH_THEN (X_CHOOSE_THEN `f:A->B` (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2"))) + THEN USE_THEN "F1" (MP_TAC o MATCH_MP BIJ_INVERSE) + THEN DISCH_THEN(X_CHOOSE_THEN `g:B->A` (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2(LABEL_TAC "FC") (LABEL_TAC "F4")))) + THEN EXISTS_TAC `g:B->A` + THEN ASM_REWRITE_TAC[] + THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F5") + THEN STRIP_TAC + THENL[USE_THEN "F5" (LABEL_TAC "F6" o CONJUNCT1 o MATCH_MP lemma_dart_invariant) + THEN USE_THEN "F4" (MP_TAC o SPEC `x:B` o CONJUNCT1 o REWRITE_RULE[INJ] o CONJUNCT1 o REWRITE_RULE[BIJ]) + THEN USE_THEN "F5" (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F7") + THEN USE_THEN "F7" (LABEL_TAC "F8" o CONJUNCT1 o MATCH_MP lemma_dart_invariant) + THEN USE_THEN "F7" (fun th-> (USE_THEN "F2" (MP_TAC o CONJUNCT1 o REWRITE_RULE[th] o SPEC `(g:B->A) x`))) + THEN USE_THEN "F5" (fun th-> USE_THEN "FC" (MP_TAC o REWRITE_RULE[th] o SPEC `x:B`)) + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_THEN (MP_TAC o SYM o AP_TERM `g:B->A`) + THEN USE_THEN "F3" (fun thm-> (USE_THEN "F8" (fun th -> REWRITE_TAC[MATCH_MP thm th]))); ALL_TAC] + THEN STRIP_TAC + THENL[USE_THEN "F5" (LABEL_TAC "F6" o CONJUNCT1 o CONJUNCT2 o MATCH_MP lemma_dart_invariant) + THEN USE_THEN "F4" (MP_TAC o SPEC `x:B` o CONJUNCT1 o REWRITE_RULE[INJ] o CONJUNCT1 o REWRITE_RULE[BIJ]) + THEN USE_THEN "F5" (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F7") + THEN USE_THEN "F7" (LABEL_TAC "F8" o CONJUNCT1 o CONJUNCT2 o MATCH_MP lemma_dart_invariant) + THEN USE_THEN "F7" (fun th-> (USE_THEN "F2" (MP_TAC o CONJUNCT1 o CONJUNCT2 o REWRITE_RULE[th] o SPEC `(g:B->A) x`))) + THEN USE_THEN "F5" (fun th-> USE_THEN "FC" (MP_TAC o REWRITE_RULE[th] o SPEC `x:B`)) + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_THEN (MP_TAC o SYM o AP_TERM `g:B->A`) + THEN USE_THEN "F3" (fun thm-> (USE_THEN "F8" (fun th -> REWRITE_TAC[MATCH_MP thm th]))); ALL_TAC] + THEN USE_THEN "F5" (LABEL_TAC "F6" o CONJUNCT2 o CONJUNCT2 o MATCH_MP lemma_dart_invariant) + THEN USE_THEN "F4" (MP_TAC o SPEC `x:B` o CONJUNCT1 o REWRITE_RULE[INJ] o CONJUNCT1 o REWRITE_RULE[BIJ]) + THEN USE_THEN "F5" (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F7") + THEN USE_THEN "F7" (LABEL_TAC "F8" o CONJUNCT2 o CONJUNCT2 o MATCH_MP lemma_dart_invariant) + THEN USE_THEN "F7" (fun th-> (USE_THEN "F2" (MP_TAC o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[th] o SPEC `(g:B->A) x`))) + THEN USE_THEN "F5" (fun th-> USE_THEN "FC" (MP_TAC o REWRITE_RULE[th] o SPEC `x:B`)) + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_THEN (MP_TAC o SYM o AP_TERM `g:B->A`) + THEN USE_THEN "F3" (fun thm-> (USE_THEN "F8" (fun th -> REWRITE_TAC[MATCH_MP thm th]))));; + +let iso_trans = prove(`!(H:(A)hypermap) (G:(B)hypermap) (W:(C)hypermap). H iso G /\ G iso W ==> H iso W`, + REPEAT GEN_TAC + THEN REWRITE_TAC[iso] + THEN DISCH_THEN (CONJUNCTS_THEN2 (X_CHOOSE_THEN `f:A->B` (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2"))) (X_CHOOSE_THEN `g:B->C` (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")))) + THEN EXISTS_TAC `(g:B->C) o (f:A->B)` + THEN USE_THEN "F1" (fun th-> (USE_THEN "F3" (fun th1-> REWRITE_TAC[MATCH_MP COMPOSE_BIJ (CONJ th th1)]))) + THEN GEN_TAC THEN DISCH_THEN (LABEL_TAC "F5") + THEN USE_THEN "F1" (MP_TAC o SPEC `x:A` o CONJUNCT1 o REWRITE_RULE[INJ] o CONJUNCT1 o REWRITE_RULE[BIJ]) + THEN USE_THEN "F5" (fun th-> (DISCH_THEN(fun thm-> (LABEL_TAC "F6" (MATCH_MP thm th))))) + THEN REWRITE_TAC[o_THM] + THEN STRIP_TAC + THENL[USE_THEN "F5" (fun th-> (USE_THEN "F2" (MP_TAC o CONJUNCT1 o REWRITE_RULE[th] o SPEC `x:A`))) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN USE_THEN "F6" (fun th-> (USE_THEN "F4" (MP_TAC o CONJUNCT1 o REWRITE_RULE[th] o SPEC `(f:A->B) x`))) + THEN SIMP_TAC[]; ALL_TAC] + THEN STRIP_TAC + THENL[USE_THEN "F5" (fun th-> (USE_THEN "F2" (MP_TAC o CONJUNCT1 o CONJUNCT2 o REWRITE_RULE[th] o SPEC `x:A`))) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN USE_THEN "F6" (fun th-> (USE_THEN "F4" (MP_TAC o CONJUNCT1 o CONJUNCT2 o REWRITE_RULE[th] o SPEC `(f:A->B) x`))) + THEN SIMP_TAC[]; ALL_TAC] + THEN USE_THEN "F5" (fun th-> (USE_THEN "F2" (MP_TAC o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[th] o SPEC `x:A`))) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN USE_THEN "F6" (fun th-> (USE_THEN "F4" (MP_TAC o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[th] o SPEC `(f:A->B) x`))) + THEN SIMP_TAC[]);; + +(* DESCRIBE FACES OF QUOTIENT HYPERMAPS - This is definition of F(L) in the blueprint *) + +let cycle = new_definition `!(H:(A)hypermap) (L:(A)loop). cycle H L = {atom H L x |x:A | x belong L}`;; + +let lemma_in_cycle2 = prove(`!(H:(A)hypermap) (L:(A)loop) (x:A). x belong L ==> atom H L x IN cycle H L`, + REWRITE_TAC[cycle; IN_ELIM_THM] THEN MESON_TAC[]);; + +let lemma_cycle_eq = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop L':(A)loop. is_normal H NF /\ L IN NF /\ L' IN NF /\ cycle H L = cycle H L' + ==> L = L'`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN USE_THEN "F1" (MP_TAC o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (MP_TAC o CONJUNCT2) + THEN DISCH_THEN (X_CHOOSE_THEN `x:A` (LABEL_TAC "F3" o CONJUNCT2)) + THEN SUBGOAL_THEN `atom (H:(A)hypermap) (L:(A)loop) (x:A) IN cycle H L` MP_TAC + THENL[REWRITE_TAC[cycle; IN_ELIM_THM] + THEN EXISTS_TAC `x:A` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN USE_THEN "F2" (SUBST1_TAC o CONJUNCT2 o CONJUNCT2) + THEN REWRITE_TAC[cycle; IN_ELIM_THM] + THEN DISCH_THEN (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5"))) + THEN MP_TAC(SPECL[`H:(A)hypermap`; `L':(A)loop`; `y:A`] atom_reflect) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN USE_THEN "F3"(fun th->(DISCH_THEN(fun th1->ASSUME_TAC(MATCH_MP lemma_in_loop (CONJ th th1))))) + THEN MATCH_MP_TAC disjoint_loops + THEN EXISTS_TAC `H:(A)hypermap` THEN EXISTS_TAC `NF:(A)loop->bool` THEN EXISTS_TAC `y:A` + THEN ASM_REWRITE_TAC[]);; + +let lemma_cycle_is_face = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_normal H NF /\ L IN NF /\ x belong L + ==> cycle H L = orbit_map (fmap H NF) (atom H L x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN SUBGOAL_THEN `(!m:num u:A v:A. u belong (L:(A)loop) /\ v belong L /\ v = ((next L) POWER m) u ==> (?j:num. atom (H:(A)hypermap) L v = ((fmap H (NF:(A)loop->bool)) POWER j) (atom H L u)))` (LABEL_TAC "F4") + THENL[INDUCT_TAC + THENL[REWRITE_TAC[POWER_0; I_THM] + THEN REPEAT STRIP_TAC + THEN EXISTS_TAC `0` + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[POWER_0; I_THM]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "G1") + THEN REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G2") (CONJUNCTS_THEN2 (LABEL_TAC "G3") (LABEL_TAC "G4"))) + THEN ASM_CASES_TAC `next (L:(A)loop) (u:A) = inverse (node_map (H:(A)hypermap)) u` + THENL[MP_TAC (SPECL[`H:(A)hypermap`; `L:(A)loop`; `u:A`] atom_reflect) + THEN DISCH_THEN(fun th->POP_ASSUM(fun th1->MP_TAC(MATCH_MP lemma_atom_absorb_quark (CONJ th th1)))) + THEN DISCH_THEN (SUBST1_TAC o MATCH_MP lemma_identity_atom) + THEN USE_THEN "G2" (ASSUME_TAC o REWRITE_RULE[POWER_1] o SPEC `1` o MATCH_MP lemma_power_next_in_loop) + THEN REMOVE_THEN "G4" (ASSUME_TAC o REWRITE_RULE[POWER; o_THM]) + THEN ABBREV_TAC `z = (next (L:(A)loop) (u:A))` + THEN REMOVE_THEN "G1" (MP_TAC o SPECL[`z:A`; `v:A`]) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM MP_TAC THEN MP_TAC (SPECL[`H:(A)hypermap`; `L:(A)loop`; `u:A`] atom_reflect) + THEN USE_THEN "G2" MP_TAC THEN USE_THEN "F2" MP_TAC THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (ASSUME_TAC o MATCH_MP lemma_unique_head) + THEN USE_THEN "F1"(fun th->USE_THEN "F2"(fun th1->(USE_THEN "G2" (fun th2 -> MP_TAC(MATCH_MP unique_fmap (CONJ th (CONJ th1 th2))))))) + THEN USE_THEN "F1"(fun th->USE_THEN "F2"(fun th1->(USE_THEN "G2" (fun th2 -> MP_TAC(MATCH_MP value_next_of_head (CONJ th (CONJ th1 th2))))))) + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN USE_THEN "G2" (ASSUME_TAC o REWRITE_RULE[POWER_1] o SPEC `1` o MATCH_MP lemma_power_next_in_loop) + THEN DISCH_THEN (LABEL_TAC "G5") + THEN REMOVE_THEN "G4" (ASSUME_TAC o REWRITE_RULE[POWER; o_THM]) + THEN ABBREV_TAC `z = (next (L:(A)loop) (u:A))` + THEN REMOVE_THEN "G1" (MP_TAC o SPECL[`z:A`; `v:A`]) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` MP_TAC) + THEN REMOVE_THEN "G5" (SUBST1_TAC o SYM) + THEN REWRITE_TAC[iterate_map_valuation2] + THEN MESON_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `!m:num x:A. x belong (L:(A)loop) ==> ?y:A. y belong L /\ ((fmap (H:(A)hypermap) (NF:(A)loop->bool)) POWER m) (atom H L x) = atom H L y` (LABEL_TAC "F5") + THENL[INDUCT_TAC + THENL[REPEAT STRIP_TAC THEN EXISTS_TAC `x':A` THEN ASM_REWRITE_TAC[POWER_0; I_THM]; ALL_TAC] + THEN GEN_TAC + THEN POP_ASSUM (LABEL_TAC "G4") + THEN DISCH_THEN (LABEL_TAC "G5") + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN REMOVE_THEN "G5" (fun th-> (REMOVE_THEN "G4" (MP_TAC o REWRITE_RULE[th] o SPEC `x':A`))) + THEN DISCH_THEN (X_CHOOSE_THEN `a:A` (CONJUNCTS_THEN2 (LABEL_TAC "G6") (SUBST1_TAC))) + THEN EXISTS_TAC `(face_map (H:(A)hypermap)) (head H (NF:(A)loop->bool) (a:A))` + THEN USE_THEN "F1"(fun th->(USE_THEN "F2"(fun th1->(USE_THEN "G6"(fun th2->REWRITE_TAC[MATCH_MP face_map_on_margin (CONJ th (CONJ th1 th2))]))))) + THEN MATCH_MP_TAC unique_fmap + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN REWRITE_TAC[EXTENSION] + THEN GEN_TAC + THEN REWRITE_TAC[cycle; orbit_map; IN_ELIM_THM; GE; LE_0] + THEN EQ_TAC + THENL[DISCH_THEN (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (LABEL_TAC "F6") (SUBST1_TAC))) + THEN USE_THEN "F3"(fun th->(USE_THEN "F6"(fun th1->(MP_TAC (MATCH_MP lemma_next_power_representation (CONJ th th1)))))) + THEN DISCH_THEN (X_CHOOSE_THEN `n:num` (ASSUME_TAC o CONJUNCT2)) + THEN REMOVE_THEN "F4" (MP_TAC o SPECL[`n:num`; `x:A`; `y:A`]) + THEN ASM_MESON_TAC[]; ALL_TAC] + THEN STRIP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN POP_ASSUM (MP_TAC o SPECL[`n:num`; `x:A`]) + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[th]));; + +let lemma_cycle_finite = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop. is_normal H NF /\ L IN NF ==> FINITE (cycle H L)`, + REPEAT GEN_TAC + THEN DISCH_THEN (fun th-> LABEL_TAC "F1" th THEN MP_TAC (SPEC `L:(A)loop` (CONJUNCT1(REWRITE_RULE[is_normal] (CONJUNCT1 th))))) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN ((X_CHOOSE_THEN `x:A` (MP_TAC o CONJUNCT2)) o CONJUNCT2) + THEN DISCH_THEN (fun th-> USE_THEN "F1" (fun th1-> (REWRITE_TAC[MATCH_MP lemma_cycle_is_face (REWRITE_RULE[GSYM CONJ_ASSOC] (CONJ th1 th))]))) + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[GSYM(MATCH_MP lemma_quotient (CONJUNCT1 th)); GSYM face; FACE_FINITE]));; + +let lemmaQuotientFace = prove(`!H:(A)hypermap NF:(A)loop->bool. is_normal H NF ==> face_set (quotient H NF) = {cycle H L | L IN NF}`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN REWRITE_TAC[EXTENSION; face_set; set_of_orbits; IN_ELIM_THM] + THEN GEN_TAC + THEN REWRITE_TAC[GSYM EXTENSION] + THEN USE_THEN "F1"(fun th-> REWRITE_TAC[MATCH_MP lemma_quotient th]) + THEN EQ_TAC + THENL[REWRITE_TAC[quotient_darts; IN_ELIM_THM] + THEN DISCH_THEN (X_CHOOSE_THEN `atm:A->bool` (CONJUNCTS_THEN2 MP_TAC (SUBST1_TAC))) + THEN DISCH_THEN(X_CHOOSE_THEN `L:(A)loop`(X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3")) SUBST1_TAC))) + THEN EXISTS_TAC `L:(A)loop` + THEN ASM_REWRITE_TAC[] + THEN CONV_TAC SYM_CONV + THEN MATCH_MP_TAC lemma_cycle_is_face + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN DISCH_THEN(X_CHOOSE_THEN `L:(A)loop`(CONJUNCTS_THEN2 (LABEL_TAC "F2") SUBST1_TAC)) + THEN USE_THEN "F2" (fun th-> (USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN DISCH_THEN ((X_CHOOSE_THEN `x:A` (LABEL_TAC "F3" o CONJUNCT2)) o CONJUNCT2) + THEN EXISTS_TAC `atom (H:(A)hypermap) (L:(A)loop) (x:A)` + THEN STRIP_TAC + THENL[MATCH_MP_TAC lemma_in_quotient THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN MATCH_MP_TAC lemma_cycle_is_face THEN ASM_REWRITE_TAC[]);; + +let lemma_support_cycle = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop). is_normal H NF /\ L IN NF ==> dart_of L = UNIONS (cycle H L)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN REWRITE_TAC[EXTENSION; IN_UNIONS; GSYM belong] + THEN GEN_TAC + THEN EQ_TAC + THENL[DISCH_TAC + THEN EXISTS_TAC `atom (H:(A)hypermap) (L:(A)loop) (x:A)` + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP lemma_in_cycle2 th; atom_reflect]); ALL_TAC] + THEN DISCH_THEN (X_CHOOSE_THEN `t:A->bool` (CONJUNCTS_THEN2 (MP_TAC o REWRITE_RULE[cycle; IN_ELIM_THM]) (LABEL_TAC "F3"))) + THEN DISCH_THEN (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (LABEL_TAC "F4") SUBST_ALL_TAC)) + THEN POP_ASSUM (fun th-> (POP_ASSUM (fun th1 -> (REWRITE_TAC[MATCH_MP lemma_in_loop (CONJ th th1)])))));; + +let lemmaQF = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_normal H NF /\ L IN NF /\ x belong L + ==> face (quotient H NF) (atom H L x) = cycle H L`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") ASSUME_TAC) + THEN REWRITE_TAC[face] + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[MATCH_MP lemma_quotient th]) + THEN CONV_TAC SYM_CONV + THEN POP_ASSUM (fun th1 -> (POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP lemma_cycle_is_face (CONJ th th1)]))));; + +let lemma_support_QF = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_normal H NF /\ L IN NF /\ x belong L + ==> UNIONS(face (quotient H NF) (atom H L x)) = dart_of L`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[MATCH_MP lemmaQF th]) THEN CONV_TAC SYM_CONV + THEN MATCH_MP_TAC lemma_support_cycle + THEN EXISTS_TAC `NF:(A)loop->bool` THEN ASM_REWRITE_TAC[]);; + +let lemma_in_unions = prove(`!s:(A->bool)->bool t:A->bool x:A. x IN t /\ t IN s ==> x IN (UNIONS s)`, SET_TAC[IN_UNIONS]);; + +let lemma_sub_support = prove(`!s:(A->bool)->bool t:A->bool. t IN s ==> t SUBSET (UNIONS s)`, SET_TAC[]);; + +let lemma_in_QF = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_normal H NF /\ L IN NF /\ x belong L ==> + (!y:A. y belong L <=> choice H NF y IN face (quotient H NF) (atom H L x))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN GEN_TAC + THEN EQ_TAC + THENL[DISCH_THEN (fun th -> ASSUME_TAC th THEN MP_TAC th) + THEN USE_THEN "F2" (MP_TAC o CONJUNCT1) + THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN(fun th -> REWRITE_TAC[MATCH_MP unique_choice th]) + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1 -> REWRITE_TAC[MATCH_MP lemmaQF (CONJ th th1)])) + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP lemma_in_cycle2 th]); ALL_TAC] + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_sub_support) + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1 -> REWRITE_TAC[MATCH_MP lemma_support_QF (CONJ th th1)])) + THEN USE_THEN "F1" (ASSUME_TAC o SPEC `y:A` o MATCH_MP choice_reflect) + THEN DISCH_THEN (fun th-> POP_ASSUM(fun th1 -> REWRITE_TAC[belong; MATCH_MP lemma_in_subset (CONJ th th1)])));; + +let lemma_in_QuotientFace = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A) (y:A). + is_normal H NF /\ L IN NF /\ x belong L /\ y belong L ==> atom H L y IN face (quotient H NF) (atom H L x)`, + REPEAT GEN_TAC THEN DISCH_TAC + THEN SUBGOAL_THEN `atom (H:(A)hypermap) (L:(A)loop) (y:A) = choice H (NF:(A)loop->bool) y` SUBST1_TAC + THENL[CONV_TAC SYM_CONV + THEN MATCH_MP_TAC unique_choice + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN ASM_MESON_TAC[lemma_in_QF]);; + + +(* DESCRIBE NODES OF QUOTIENT HYPERMAPS *) + +let support_node = new_definition `!(H:(A)hypermap) (NF:(A)loop->bool) (atm:A->bool). support_node H NF atm = UNIONS (node (quotient H NF) atm)`;; + +let lemma_node_sub_support_darts = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) x:A. is_normal H NF /\ x IN support_darts NF + ==> node H x SUBSET support_darts NF`, + REPEAT GEN_TAC THEN DISCH_TAC + THEN REWRITE_TAC[SUBSET; node; orbit_map; IN_ELIM_THM; GE; LE_0] + THEN GEN_TAC + THEN DISCH_THEN (X_CHOOSE_THEN `n:num` SUBST1_TAC) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP lemma_node_in_support2 th]));; + +let lemma_in_node = prove(`!H:(A)hypermap x:A y:A. y IN node H x <=> ?n:num. y = (node_map H POWER n) x`, + REWRITE_TAC[node; orbit_map; GE; LE_0; IN_ELIM_THM]);; + +let lemma_in_node2 = prove(`!H:(A)hypermap x:A n:num. (node_map H POWER n) x IN node H x`, MESON_TAC[lemma_in_node]);; + +let lemma_choice_sub_node = prove(`!H:(A)hypermap NF:(A)loop->bool x:A. is_normal H NF ==> choice H NF x SUBSET node H x`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN ASM_CASES_TAC `~((x:A) IN support_darts (NF:(A)loop->bool))` + THENL[USE_THEN "F1" (MP_TAC o SPEC `x:A` o CONJUNCT1 o MATCH_MP first_unique_choice) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN SUBST1_TAC THEN REWRITE_TAC[SUBSET; IN_SING] + THEN GEN_TAC THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[node_refl]; ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[lemma_in_support]) + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` MP_TAC) + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (fun th -> REWRITE_TAC[MATCH_MP unique_choice th]) + THEN REWRITE_TAC[lemma_atom_sub_node]);; + +let lemma_support_QN = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) x:A. is_normal H NF /\ x IN support_darts NF + ==> support_node H NF (choice H NF x) = node H x`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN REWRITE_TAC[EXTENSION; support_node; IN_UNIONS; IN_ELIM_THM] + THEN GEN_TAC + THEN EQ_TAC + THENL[DISCH_THEN (X_CHOOSE_THEN `t:A->bool` (CONJUNCTS_THEN2 (MP_TAC o REWRITE_RULE[lemma_in_node]) ASSUME_TAC)) + THEN DISCH_THEN (X_CHOOSE_THEN `n:num` SUBST_ALL_TAC) + THEN POP_ASSUM MP_TAC + THEN SUBGOAL_THEN `!i:num. (node_map (quotient (H:(A)hypermap) (NF:(A)loop->bool)) POWER i) (choice H NF (x:A)) SUBSET node H x` ASSUME_TAC + THENL[INDUCT_TAC + THENL[REWRITE_TAC[POWER_0; I_THM] + THEN USE_THEN "F1" (MP_TAC o SPEC `x:A` o MATCH_MP lemma_choice_sub_node) + THEN SIMP_TAC[]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "G1") + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN REMOVE_THEN "F2" (fun th-> USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o SYM o SPEC `x:A` o MATCH_MP lemma_choice_in_quotient)) + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[SYM(CONJUNCT1 (MATCH_MP lemma_quotient th))]) + THEN DISCH_THEN (MP_TAC o SPEC `i:num` o MATCH_MP lemma_dart_invariant_power_node) + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[CONJUNCT1 (MATCH_MP lemma_quotient th)]) + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP atom_via_choice th]) + THEN DISCH_THEN (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2(LABEL_TAC "G2") SUBST_ALL_TAC)) + THEN USE_THEN "F1" (MP_TAC o SPEC `y:A` o MATCH_MP choice_reflect) + THEN REMOVE_THEN "G1" (fun th-> (DISCH_THEN (fun th1 -> MP_TAC (MATCH_MP lemma_in_subset (CONJ th th1))))) + THEN DISCH_THEN (SUBST1_TAC o MATCH_MP lemma_node_identity) + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[CONJUNCT1(CONJUNCT2(CONJUNCT2(MATCH_MP lemma_quotient th)))]) + THEN USE_THEN "F1" (LABEL_TAC "G3" o CONJUNCT1 o SPEC `y:A` o MATCH_MP choice_and_head_tail) + THEN USE_THEN "F1" (MP_TAC o SPEC `y:A` o MATCH_MP lemma_choice_sub_node) + THEN DISCH_THEN (fun th -> USE_THEN "G3" (fun th1 -> MP_TAC (MATCH_MP lemma_in_subset (CONJ th th1)))) + THEN DISCH_THEN (fun th -> REWRITE_TAC[MATCH_MP lemma_node_identity th]) + THEN USE_THEN "F1"(fun th-> USE_THEN "G2" (fun th1-> REWRITE_TAC[CONJUNCT2(CONJUNCT2(MATCH_MP nmap_via_choice (CONJ th th1)))])) + THEN ABBREV_TAC `z = tail (H:(A)hypermap) (NF:(A)loop->bool) (y:A)` + THEN MP_TAC (REWRITE_RULE[POWER_1] (SPECL[`H:(A)hypermap`; `z:A`; `1`] lemma_in_node2)) + THEN DISCH_THEN (fun th -> REWRITE_TAC[MATCH_MP lemma_node_identity th]) + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_choice_sub_node th]); ALL_TAC] + THEN POP_ASSUM (MP_TAC o SPEC `n:num`) THEN REWRITE_TAC[IMP_IMP; lemma_in_subset]; ALL_TAC] + THEN SUBGOAL_THEN `!i:num. ?j:num. (node_map (H:(A)hypermap) POWER i) x IN ((nmap H (NF:(A)loop->bool) POWER j) (choice H NF x))` ASSUME_TAC + THENL[INDUCT_TAC + THENL[EXISTS_TAC `0` THEN REWRITE_TAC[POWER_0; I_THM] + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[MATCH_MP choice_reflect th]); ALL_TAC] + THEN POP_ASSUM (X_CHOOSE_THEN `k:num` (LABEL_TAC "F3")) + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN ABBREV_TAC `y = (node_map (H:(A)hypermap) POWER (i:num)) (x:A)` + THEN USE_THEN "F2" (fun th-> USE_THEN "F1" (LABEL_TAC "F4" o REWRITE_RULE[th] o SYM o SPEC `x:A` o MATCH_MP lemma_choice_in_quotient)) + THEN USE_THEN "F1" (MP_TAC o MATCH_MP nmap_permute) + THEN DISCH_THEN (MP_TAC o SPEC `k:num` o MATCH_MP iterate_orbit) + THEN DISCH_THEN (fun thm-> (USE_THEN "F4" (fun th -> (MP_TAC (MATCH_MP thm th))))) + THEN REWRITE_TAC[quotient_darts; IN_ELIM_THM] + THEN DISCH_THEN(X_CHOOSE_THEN `L:(A)loop`(X_CHOOSE_THEN `a:A`(CONJUNCTS_THEN2 (CONJUNCTS_THEN2(LABEL_TAC "F5") (LABEL_TAC "F6")) (LABEL_TAC "F7")))) + THEN REMOVE_THEN "F3" MP_TAC + THEN USE_THEN "F7" SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "F3") + THEN ASM_CASES_TAC `~(y:A = inverse (node_map (H:(A)hypermap)) (back (L:(A)loop) (y:A)))` + THENL[EXISTS_TAC `SUC k` + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN USE_THEN "F7" (SUBST1_TAC) + THEN USE_THEN "F1"(fun th->(USE_THEN "F5"(fun th2->(USE_THEN "F6"(fun th3->MP_TAC (MATCH_MP unique_choice (CONJ th(CONJ th2 th3)))))))) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN USE_THEN "F6"(fun th->(USE_THEN "F5"(fun th1->MP_TAC(MATCH_MP lemma_in_support2 (CONJ th th1))))) + THEN USE_THEN "F1"(fun th->(DISCH_THEN (fun th1->REWRITE_TAC[MATCH_MP nmap_via_choice (CONJ th th1)]))) + THEN POP_ASSUM MP_TAC + THEN POP_ASSUM MP_TAC + THEN USE_THEN "F6" MP_TAC + THEN USE_THEN "F5" MP_TAC + THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (fun th -> REWRITE_TAC[MATCH_MP lemma_unique_tail th]) + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[MATCH_MP choice_reflect th]); ALL_TAC] + THEN EXISTS_TAC `k:num` + THEN USE_THEN "F7" SUBST1_TAC + THEN POP_ASSUM (LABEL_TAC "F8" o REWRITE_RULE[]) + THEN USE_THEN "F3" (fun th-> (USE_THEN "F8" (fun th1 -> MP_TAC (MATCH_MP lemma_second_absorb_quark (CONJ th th1))))) + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[GSYM node_map_inverse_representation]) + THEN DISCH_THEN (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN DISCH_THEN (MP_TAC o REWRITE_RULE[lemma_in_node]) + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` SUBST1_TAC) + THEN POP_ASSUM (MP_TAC o SPEC `k:num`) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (LABEL_TAC "F3")) + THEN EXISTS_TAC `(nmap (H:(A)hypermap) (NF:(A)loop->bool) POWER (j:num)) (choice (H:(A)hypermap) (NF:(A)loop->bool) (x:A))` + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[SYM(CONJUNCT1(CONJUNCT2(CONJUNCT2(MATCH_MP lemma_quotient th))))]) + THEN MESON_TAC[lemma_in_node]);; + +let lemma_QuotientNode = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) x:A. is_normal H NF /\ x IN support_darts NF + ==> node (quotient H NF) (choice H NF x) = {choice H NF y |y:A | y IN node H x}`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN USE_THEN "F2" (fun th -> USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o SYM o SPEC `x:A` o MATCH_MP lemma_choice_in_quotient)) + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[SYM(CONJUNCT1(MATCH_MP lemma_quotient th))]) + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_node_subset) + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[CONJUNCT1(MATCH_MP lemma_quotient th)]) + THEN DISCH_THEN (LABEL_TAC "F3") + THEN REWRITE_TAC[EXTENSION; IN_ELIM_THM] + THEN GEN_TAC + THEN REWRITE_TAC[GSYM EXTENSION] + THEN EQ_TAC + THENL[DISCH_THEN (fun th-> ASSUME_TAC th THEN MP_TAC th) + THEN USE_THEN "F3" MP_TAC + THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (MP_TAC o (MATCH_MP lemma_in_subset)) + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[MATCH_MP atom_via_choice th]) + THEN DISCH_THEN (X_CHOOSE_THEN `y:A` (SUBST_ALL_TAC o CONJUNCT2)) + THEN EXISTS_TAC `y:A` THEN SIMP_TAC[] + THEN POP_ASSUM (MP_TAC o MATCH_MP lemma_sub_support) + THEN REWRITE_TAC[GSYM support_node] + THEN USE_THEN "F1" (fun th-> (USE_THEN "F2" (fun th1-> REWRITE_TAC[MATCH_MP lemma_support_QN (CONJ th th1)]))) + THEN USE_THEN "F1" (MP_TAC o SPEC `y:A` o MATCH_MP choice_reflect) + THEN REWRITE_TAC[IMP_IMP] THEN ONCE_REWRITE_TAC[CONJ_SYM] THEN REWRITE_TAC[lemma_in_subset]; ALL_TAC] + THEN DISCH_THEN (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 MP_TAC SUBST1_TAC)) + THEN USE_THEN "F1" (fun th-> (USE_THEN "F2" (fun th1-> REWRITE_TAC[GSYM(MATCH_MP lemma_support_QN (CONJ th th1))]))) + THEN REWRITE_TAC[support_node; IN_UNIONS] + THEN DISCH_THEN (X_CHOOSE_THEN `t:A->bool` (CONJUNCTS_THEN2 (fun th -> MP_TAC th THEN (LABEL_TAC "GG" th)) (LABEL_TAC "F4"))) + THEN USE_THEN "F3" (MP_TAC) + THEN REWRITE_TAC[IMP_IMP] THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_in_subset) + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[MATCH_MP atom_via_choice th]) + THEN DISCH_THEN (X_CHOOSE_THEN `a:A` (SUBST_ALL_TAC o CONJUNCT2)) + THEN USE_THEN "F1" (fun th-> (USE_THEN "F4" (fun th1 -> (REWRITE_TAC[MATCH_MP choice_identity (CONJ th th1)])))) + THEN USE_THEN "GG" (fun th-> REWRITE_TAC[th]));; + +let lemma_in_QN = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (x:A). is_normal H NF /\ x IN support_darts NF + ==> (!y:A. choice H NF y IN node (quotient H NF) (choice H NF x) <=> y IN node H x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN GEN_TAC + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1 -> REWRITE_TAC[MATCH_MP lemma_QuotientNode (CONJ th th1)])) + THEN REWRITE_TAC[IN_ELIM_THM] + THEN EQ_TAC + THENL[DISCH_THEN (X_CHOOSE_THEN `a:A` (CONJUNCTS_THEN2 (fun th-> REWRITE_TAC[MATCH_MP lemma_node_identity th]) (LABEL_TAC "F3"))) + THEN MATCH_MP_TAC lemma_in_subset + THEN EXISTS_TAC `choice (H:(A)hypermap) (NF:(A)loop->bool) (a:A)` + THEN USE_THEN "F1" (MP_TAC o SPEC `y:A` o MATCH_MP lemma_choice_sub_node) + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_choice_sub_node th]) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP choice_reflect th]); ALL_TAC] + THEN MESON_TAC[]);; + +let lemma_in_QuotientNode = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (x:A) (y:A). is_normal H NF /\ x IN support_darts NF /\ y IN node H x + ==> choice H NF y IN node (quotient H NF) (choice H NF x)`, + MESON_TAC[lemma_in_QN]);; + +let lemma_in_node3 = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (x:A) (y:A). + is_normal H NF /\ x IN support_darts NF /\ choice H NF y IN node (quotient H NF) (choice H NF x) ==> y IN node H x`, + MESON_TAC[lemma_in_QN]);; + + +(* The definition of face collections *) + +let res = new_definition `!f:A->A s:A->bool x:A. res f s x = if x IN s then f x else x`;; + +let lemma_in_face = prove(`!(H:(A)hypermap) x:A n:num. ((face_map H) POWER n) x IN face H x`, REWRITE_TAC[face; lemma_in_orbit]);; + +let face_map_restrict = prove(`!(H:(A)hypermap) x:A. res (face_map H) (face H x) permutes face H x`, + REPEAT GEN_TAC THEN REWRITE_TAC[permutes] THEN SIMP_TAC[res] + THEN GEN_TAC THEN REWRITE_TAC[EXISTS_UNIQUE] + THEN ASM_CASES_TAC `~((y:A) IN face (H:(A)hypermap) x)` + THENL[EXISTS_TAC `y:A` + THEN ASM_REWRITE_TAC[] + THEN GEN_TAC + THEN ASM_CASES_TAC `~(y':A IN face (H:(A)hypermap) x)` + THENL[ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM (ASSUME_TAC o REWRITE_RULE[]) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM (SUBST_ALL_TAC o MATCH_MP lemma_face_identity) + THEN DISCH_TAC + THEN MP_TAC(REWRITE_RULE[POWER_1] (SPECL[`H:(A)hypermap`; `y':A`; `1`] lemma_in_face)) + THEN POP_ASSUM SUBST1_TAC + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F1" o REWRITE_RULE[]) + THEN POP_ASSUM (SUBST1_TAC o MATCH_MP lemma_face_identity) + THEN MP_TAC (MATCH_MP inverse_element_lemma (SPEC `H:(A)hypermap` face_map_and_darts)) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (fun th -> (ASSUME_TAC (AP_THM th `y:A`)))) + THEN MP_TAC (SPECL[`H:(A)hypermap`; `y:A`; `j:num`] lemma_in_face) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN DISCH_TAC + THEN EXISTS_TAC `inverse (face_map (H:(A)hypermap)) y` + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[MATCH_MP PERMUTES_INVERSES (CONJUNCT2 (SPEC `H:(A)hypermap` face_map_and_darts))] + THEN GEN_TAC + THEN ASM_CASES_TAC `~(y':A IN face (H:(A)hypermap) y)` + THENL[ASM_REWRITE_TAC[] + THEN DISCH_THEN (SUBST_ALL_TAC) + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[face; orbit_reflect]) + THEN MESON_TAC[]; ALL_TAC] + THEN POP_ASSUM (ASSUME_TAC o REWRITE_RULE[]) + THEN ASM_REWRITE_TAC[] + THEN MESON_TAC[face_map_inverse_representation]);; + +let power_res_face_map = prove(`!(H:(A)hypermap) x:A n:num. ((res (face_map H) (face H x)) POWER n) x = ((face_map H) POWER n) x`, + REPLICATE_TAC 2 GEN_TAC + THEN INDUCT_TAC + THENL[REWRITE_TAC[POWER_0; orbit_reflect]; ALL_TAC] + THEN MP_TAC(SPECL[`H:(A)hypermap`; `x:A`; `n:num`] lemma_in_face) + THEN ABBREV_TAC `y = (face_map (H:(A)hypermap) POWER n) x` + THEN DISCH_TAC + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN ASM_REWRITE_TAC[res]);; + +let face_loop = new_definition `!H:(A)hypermap x:A. face_loop H x = loop(face H x, res (face_map H) (face H x))`;; + +let face_collection = new_definition `!H:(A)hypermap. face_collection H = {face_loop H x |x:A| x IN dart H}`;; + +let face_loop_rep = prove(`!(H:(A)hypermap) x:A. dart_of (face_loop H x) = face H x /\ next (face_loop H x) = res (face_map H) (face H x)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[face_loop] + THEN MATCH_MP_TAC lemma_loop_representation + THEN EXISTS_TAC `x:A` + THEN REWRITE_TAC[FACE_FINITE; face_map_restrict] + THEN REWRITE_TAC[orbit_map; power_res_face_map; face]);; + +let lemma_inverse_res = prove(`!(H:(A)hypermap) x:A y:A. y IN face H x ==> inverse (res (face_map H) (face H x)) y = inverse(face_map H) y`, + REPEAT STRIP_TAC + THEN REWRITE_TAC[face_loop] + THEN POP_ASSUM (SUBST1_TAC o MATCH_MP lemma_face_identity) + THEN REWRITE_TAC[GSYM face_loop] + THEN MP_TAC (MATCH_MP inverse_element_lemma (SPEC `H:(A)hypermap` face_map_and_darts)) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (LABEL_TAC "F0")) + THEN USE_THEN "F0" (MP_TAC o SPEC `face_map (H:(A)hypermap)` o MATCH_MP RIGHT_MULT_MAP) + THEN REWRITE_TAC[MATCH_MP PERMUTES_INVERSES_o (CONJUNCT2(SPEC `H:(A)hypermap` face_map_and_darts))] + THEN REWRITE_TAC[GSYM (CONJUNCT2 POWER)] + THEN DISCH_THEN (LABEL_TAC "F1" o SYM) + THEN SUBGOAL_THEN `(res (face_map (H:(A)hypermap)) (face H y)) POWER (SUC j) = I` ASSUME_TAC + THENL[REWRITE_TAC[FUN_EQ_THM;I_THM] + THEN GEN_TAC + THEN ASM_CASES_TAC `~(x:A IN face (H:(A)hypermap) (y:A))` + THENL[MATCH_MP_TAC power_permutation_outside_domain + THEN EXISTS_TAC `face (H:(A)hypermap) y` + THEN ASM_REWRITE_TAC[face_map_restrict; FACE_FINITE]; ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[]) + THEN DISCH_THEN (SUBST1_TAC o MATCH_MP lemma_face_identity) + THEN REWRITE_TAC[power_res_face_map] + THEN POP_ASSUM (fun th-> MP_TAC (AP_THM th `x:A`)) + THEN REWRITE_TAC[I_THM]; ALL_TAC] + THEN POP_ASSUM (MP_TAC o SPEC `inverse(res (face_map (H:(A)hypermap)) (face H y))` o MATCH_MP RIGHT_MULT_MAP) + THEN REWRITE_TAC[POWER; I_O_ID; GSYM o_ASSOC] + THEN REWRITE_TAC[MATCH_MP PERMUTES_INVERSES_o (SPECL[`H:(A)hypermap`; `y:A`] face_map_restrict); I_O_ID] + THEN DISCH_THEN (LABEL_TAC "F3") + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN REMOVE_THEN "F0" (SUBST1_TAC) + THEN REWRITE_TAC[power_res_face_map]);; + +let face_loop_lemma = prove(`!(H:(A)hypermap) x:A. is_loop H (face_loop H x)`, + REPEAT STRIP_TAC + THEN REWRITE_TAC[is_loop; belong; face_loop_rep] + THEN REPEAT STRIP_TAC + THEN ASM_REWRITE_TAC[res] + THEN REWRITE_TAC[one_step_contour]);; + +let lemma_edge_nondegenerate = prove(`!(H:(A)hypermap). is_edge_nondegenerate H <=> (!x:A. x IN dart H ==> ~(face_map H x = (inverse (node_map H)) x))`, + REWRITE_TAC[is_edge_nondegenerate] THEN MESON_TAC[is_edge_nondegenerate; lemma_edge_degenerate]);; + +let normal_face_collection = prove(`!(H:(A)hypermap). (!x:A. x IN dart H ==> (?y:A.y IN dart H /\ y IN face H x /\ ~(node H x = node H y))) + ==> is_normal H (face_collection H)`, + REPEAT GEN_TAC + THEN REWRITE_TAC[is_normal] + THEN DISCH_THEN (LABEL_TAC "F2") + THEN STRIP_TAC + THENL[GEN_TAC + THEN REWRITE_TAC [face_collection; IN_ELIM_THM; belong] + THEN STRIP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[face_loop_lemma] + THEN EXISTS_TAC `x:A` + THEN ASM_REWRITE_TAC[face; orbit_reflect; face_loop_rep]; ALL_TAC] + THEN STRIP_TAC + THENL[GEN_TAC + THEN REWRITE_TAC [face_collection; IN_ELIM_THM; belong] + THEN STRIP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[face_loop_rep] + THEN EXISTS_TAC `x:A` + THEN REWRITE_TAC[face; orbit_reflect] + THEN REWRITE_TAC[GSYM face] + THEN USE_THEN "F2" (fun thm->(POP_ASSUM (fun th-> MESON_TAC[MATCH_MP thm th]))); ALL_TAC] + THEN STRIP_TAC + THENL[REPEAT GEN_TAC + THEN REWRITE_TAC [face_collection; IN_ELIM_THM; belong] + THEN DISCH_THEN (CONJUNCTS_THEN2 (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 ASSUME_TAC (LABEL_TAC "G1"))) (CONJUNCTS_THEN2 (X_CHOOSE_THEN `z:A` (CONJUNCTS_THEN2 ASSUME_TAC (LABEL_TAC "G2"))) MP_TAC)) + THEN REMOVE_THEN "G1" SUBST_ALL_TAC + THEN REMOVE_THEN "G2" SUBST_ALL_TAC + THEN REWRITE_TAC[face_loop_rep] + THEN STRIP_TAC + THEN REWRITE_TAC[face_loop] + THEN POP_ASSUM (SUBST1_TAC o MATCH_MP lemma_face_identity) + THEN POP_ASSUM (SUBST1_TAC o MATCH_MP lemma_face_identity) + THEN SIMP_TAC[]; ALL_TAC] + THEN REPEAT GEN_TAC + THEN REWRITE_TAC [face_collection;IN_ELIM_THM; belong] + THEN DISCH_THEN (CONJUNCTS_THEN2 (X_CHOOSE_THEN `z:A` (CONJUNCTS_THEN2 ASSUME_TAC ASSUME_TAC)) MP_TAC) + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[face_loop_rep] + THEN POP_ASSUM (LABEL_TAC "H1") + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "H2") (LABEL_TAC "H3")) + THEN EXISTS_TAC `face_loop (H:(A)hypermap) y` + THEN REWRITE_TAC[face_loop_rep; face; orbit_reflect] + THEN EXISTS_TAC `y:A` + THEN SIMP_TAC[] + THEN USE_THEN "H1" (MP_TAC o MATCH_MP lemma_face_subset) + THEN USE_THEN "H2" (SUBST1_TAC o MATCH_MP lemma_face_identity) + THEN REWRITE_TAC[face] + THEN DISCH_THEN (fun th-> MP_TAC (MATCH_MP lemma_in_subset (CONJ th (SPECL[`face_map (H:(A)hypermap)`; `x:A`] orbit_reflect)))) + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_node_subset) + THEN USE_THEN "H3" (SUBST_ALL_TAC o MATCH_MP lemma_node_identity) + THEN DISCH_THEN (fun th-> (POP_ASSUM(fun th1 -> REWRITE_TAC[MATCH_MP lemma_in_subset (CONJ th th1)]))));; + +let lemma_support_face_collection = prove(`!(H:(A)hypermap). support_darts (face_collection H) = dart H`, + GEN_TAC + THEN REWRITE_TAC[EXTENSION] + THEN GEN_TAC + THEN REWRITE_TAC[lemma_in_support] + THEN REWRITE_TAC[face_collection; IN_ELIM_THM] + THEN EQ_TAC + THENL[STRIP_TAC + THEN POP_ASSUM MP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[belong; face_loop_rep] + THEN POP_ASSUM (MP_TAC o MATCH_MP lemma_face_subset) + THEN REWRITE_TAC[IMP_IMP; lemma_in_subset]; ALL_TAC] + THEN STRIP_TAC + THEN EXISTS_TAC `face_loop (H:(A)hypermap) x` + THEN REWRITE_TAC[belong; face; face_loop_rep; orbit_reflect] + THEN EXISTS_TAC `x:A` + THEN ASM_REWRITE_TAC[]);; + +let lemma_card_face_collection = prove(`!(H:(A)hypermap). FINITE (face_collection H) /\ CARD (face_collection H) = number_of_faces H`, + GEN_TAC + THEN SUBGOAL_THEN `?t:(A->bool)->(A)loop.(!s:(A->bool).s IN face_set H ==> ?x:A.x IN dart H /\ s = face (H:(A)hypermap) x /\ t s = face_loop H x)` MP_TAC + THENL[REWRITE_TAC[GSYM SKOLEM_THM] + THEN GEN_TAC + THEN REWRITE_TAC[GSYM RIGHT_IMP_EXISTS_THM] + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_face_representation) + THEN STRIP_TAC + THEN REWRITE_TAC[SWAP_EXISTS_THM] + THEN EXISTS_TAC `x:A` + THEN EXISTS_TAC `face_loop (H:(A)hypermap) (x:A)` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN DISCH_THEN (X_CHOOSE_THEN `t:(A->bool)->(A)loop` (LABEL_TAC "F1")) + THEN SUBGOAL_THEN `IMAGE (t:(A->bool)->(A)loop) (face_set (H:(A)hypermap)) = (face_collection H)` (LABEL_TAC "F2") + THENL[REWRITE_TAC[IMAGE; face_collection; face_set; EXTENSION; IN_ELIM_THM] + THEN GEN_TAC + THEN EQ_TAC + THENL[REWRITE_TAC[set_of_orbits; IN_ELIM_THM] + THEN REWRITE_TAC[GSYM face] + THEN STRIP_TAC + THEN EXISTS_TAC `x'':A` + THEN POP_ASSUM SUBST1_TAC + THEN POP_ASSUM SUBST1_TAC + THEN ASM_REWRITE_TAC[] + THEN USE_THEN "F1" (MP_TAC o SPEC `face (H:(A)hypermap) x''`) + THEN POP_ASSUM (fun th -> ASSUME_TAC th THEN REWRITE_TAC[REWRITE_RULE[lemma_in_face_set] th]) + THEN STRIP_TAC + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[face_loop] + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN DISCH_THEN (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (LABEL_TAC "G1") SUBST1_TAC)) + THEN REWRITE_TAC[set_of_orbits; IN_ELIM_THM; GSYM face] + THEN EXISTS_TAC `face (H:(A)hypermap) (y:A)` + THEN STRIP_TAC THENL[EXISTS_TAC `y:A` THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN USE_THEN "F1" (MP_TAC o SPEC `face (H:(A)hypermap) (y:A)`) + THEN USE_THEN "G1" (fun th -> REWRITE_TAC[REWRITE_RULE[lemma_in_face_set] th]) + THEN STRIP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[face_loop] + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `FINITE (face_collection (H:(A)hypermap))` (LABEL_TAC "F3") + THENL[ POP_ASSUM (SUBST1_TAC o SYM) + THEN MATCH_MP_TAC FINITE_IMAGE THEN REWRITE_TAC[FINITE_HYPERMAP_ORBITS]; ALL_TAC] + THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[number_of_faces] THEN REMOVE_THEN "F2" (SUBST1_TAC o SYM) + THEN MATCH_MP_TAC CARD_IMAGE_INJ THEN REWRITE_TAC[FINITE_HYPERMAP_ORBITS] + THEN REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6"))) + THEN REMOVE_THEN "F4" (fun th -> USE_THEN "F1" (fun thm -> MP_TAC (MATCH_MP thm th))) THEN STRIP_TAC + THEN REMOVE_THEN "F5" (fun th -> USE_THEN "F1" (fun thm -> MP_TAC (MATCH_MP thm th))) + THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN REMOVE_THEN "F6" MP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN UNDISCH_THEN `(t:(A->bool)->(A)loop) x = face_loop (H:(A)hypermap) (x')` SUBST1_TAC + THEN DISCH_THEN (MP_TAC o AP_TERM `dart_of:(A)loop->(A->bool)`) + THEN REWRITE_TAC[face_loop_rep]);; + +let lemma_inverse_in_face = prove(`!(H:(A)hypermap) (x:A) (y:A). y IN face H x ==> inverse (face_map H) y IN face H x`, + REPEAT STRIP_TAC + THEN POP_ASSUM (SUBST1_TAC o MATCH_MP lemma_face_identity) + THEN REPEAT GEN_TAC + THEN MP_TAC (MATCH_MP inverse_element_lemma (SPEC `H:(A)hypermap` face_map_and_darts)) + THEN DISCH_THEN(X_CHOOSE_THEN `j:num` SUBST1_TAC) + THEN REWRITE_TAC[lemma_in_face]);; + +let lemma_power_inverse_in_face = prove(`!(H:(A)hypermap) (x:A) (y:A) (n:num).y IN face H x ==> (inverse (face_map H) POWER n) y IN face H x`, + REPEAT STRIP_TAC + THEN POP_ASSUM (SUBST1_TAC o MATCH_MP lemma_face_identity) + THEN REPEAT GEN_TAC + THEN (X_CHOOSE_THEN `j:num` (fun th -> (SUBST1_TAC (AP_THM th `y:A`)))) (SPEC `n:num` (MATCH_MP power_inverse_element_lemma (SPEC `H:(A)hypermap` face_map_and_darts))) + THEN REWRITE_TAC[lemma_in_face]);; + +let lemma_power_inverse_in_face2 = prove(`!(H:(A)hypermap) (x:A) (n:num).(inverse (face_map H) POWER n) x IN face H x`, + REPEAT GEN_TAC + THEN REPEAT GEN_TAC + THEN (X_CHOOSE_THEN `j:num` (fun th -> (SUBST1_TAC (AP_THM th `x:A`)))) (SPEC `n:num` (MATCH_MP power_inverse_element_lemma (SPEC `H:(A)hypermap` face_map_and_darts))) + THEN REWRITE_TAC[lemma_in_face]);; + +let lemma_inverse_in_node = prove(`!(H:(A)hypermap) (x:A) (y:A). y IN node H x ==> inverse (node_map H) y IN node H x`, + REPEAT STRIP_TAC + THEN POP_ASSUM (SUBST1_TAC o MATCH_MP lemma_node_identity) + THEN REPEAT GEN_TAC + THEN MP_TAC (MATCH_MP inverse_element_lemma (SPEC `H:(A)hypermap` node_map_and_darts)) + THEN DISCH_THEN(X_CHOOSE_THEN `j:num` SUBST1_TAC) + THEN REWRITE_TAC[lemma_in_node2]);; + +let lemma_power_inverse_in_node = prove(`!(H:(A)hypermap) (x:A) (y:A) (n:num).y IN node H x ==> (inverse (node_map H) POWER n) y IN node H x`, + REPEAT STRIP_TAC + THEN POP_ASSUM (SUBST1_TAC o MATCH_MP lemma_node_identity) + THEN REPEAT GEN_TAC + THEN (X_CHOOSE_THEN `j:num` (fun th -> (SUBST1_TAC (AP_THM th `y:A`)))) (SPEC `n:num` (MATCH_MP power_inverse_element_lemma (SPEC `H:(A)hypermap` node_map_and_darts))) + THEN REWRITE_TAC[lemma_in_node2]);; + +let lemma_power_inverse_in_node2 = prove(`!(H:(A)hypermap) (x:A) (n:num).(inverse (node_map H) POWER n) x IN node H x`, + REPEAT GEN_TAC + THEN REPEAT GEN_TAC + THEN (X_CHOOSE_THEN `j:num` (fun th -> (SUBST1_TAC (AP_THM th `x:A`)))) (SPEC `n:num` (MATCH_MP power_inverse_element_lemma (SPEC `H:(A)hypermap` node_map_and_darts))) + THEN REWRITE_TAC[lemma_in_node2]);; + + +let SING_EQ = prove(`!x:A y:A. {x} = {y} <=> x = y`, SET_TAC[]);; + +let face_quotient_lemma = prove(`!(H:(A)hypermap). is_edge_nondegenerate H /\ (!x:A. x IN dart H ==> (?y:A. y IN dart H /\ y IN face H x /\ ~(node H x = node H y))) ==> (!x:A. choice H (face_collection H) x = {x}) /\ H iso (quotient H (face_collection H))`, + GEN_TAC + THEN REWRITE_TAC[lemma_edge_nondegenerate] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN USE_THEN "F2"(LABEL_TAC "F3" o MATCH_MP normal_face_collection) + THEN SUBGOAL_THEN `!x:A. choice (H:(A)hypermap) (face_collection H) x = {x}` (LABEL_TAC "F4") + THENL[GEN_TAC + THEN ASM_CASES_TAC `~(x:A IN dart (H:(A)hypermap))` + THENL[POP_ASSUM (ASSUME_TAC o REWRITE_RULE[GSYM lemma_support_face_collection]) + THEN USE_THEN "F3" (MP_TAC o SPEC `x:A` o CONJUNCT1 o MATCH_MP first_unique_choice) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "G4" o REWRITE_RULE[]) + THEN USE_THEN "G4" (MP_TAC o REWRITE_RULE[GSYM lemma_support_face_collection]) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[GSYM(MATCH_MP lemma_choice_in_quotient th)]) + THEN REWRITE_TAC[quotient_darts; IN_ELIM_THM] + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "G5") (LABEL_TAC "G6")) (LABEL_TAC "G7")))) + THEN USE_THEN "G5" (MP_TAC o REWRITE_RULE[face_collection; IN_ELIM_THM]) + THEN DISCH_THEN (X_CHOOSE_THEN `z:A` (CONJUNCTS_THEN2 (LABEL_TAC "G8") (LABEL_TAC "G9"))) + THEN USE_THEN "F3" (MP_TAC o SPEC `x:A` o MATCH_MP choice_reflect) + THEN REMOVE_THEN "G7" SUBST1_TAC + THEN USE_THEN "G6" (MP_TAC o REWRITE_RULE[belong]) + THEN USE_THEN "G9" SUBST1_TAC + THEN REWRITE_TAC[face_loop_rep] + THEN DISCH_THEN (LABEL_TAC "G10") + THEN DISCH_THEN (LABEL_TAC "G11") + THEN SUBGOAL_THEN `~(next (L:(A)loop) y = inverse (node_map (H:(A)hypermap)) y)` MP_TAC + THENL[USE_THEN "G9" (fun th-> REWRITE_TAC[th]) + THEN REWRITE_TAC[face_loop_rep] + THEN USE_THEN "G10" (fun th-> REWRITE_TAC[res; th]) + THEN USE_THEN "F1" (MP_TAC o SPEC `y:A`) + THEN USE_THEN "G8" (MP_TAC o MATCH_MP lemma_face_subset) + THEN DISCH_THEN (fun th -> (USE_THEN "G10" (fun th1-> (LABEL_TAC "G12" (MATCH_MP lemma_in_subset (CONJ th th1)))))) + THEN USE_THEN "G12" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN MP_TAC(SPECL[`H:(A)hypermap`; `L:(A)loop`; `y:A`] atom_reflect) + THEN USE_THEN "G6" MP_TAC THEN USE_THEN "G5" MP_TAC THEN USE_THEN "F3" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (LABEL_TAC "G14" o MATCH_MP lemma_unique_head) + THEN SUBGOAL_THEN `~(y = inverse (node_map (H:(A)hypermap)) (back (L:(A)loop) y))` MP_TAC + THENL[ONCE_REWRITE_TAC[lemma_inverse_on_loop] + THEN REWRITE_TAC[face_loop_rep] + THEN USE_THEN "G9" SUBST1_TAC + THEN REWRITE_TAC[face_loop_rep] + THEN USE_THEN "G10" (fun th-> REWRITE_TAC[MATCH_MP lemma_inverse_res th]) + THEN USE_THEN "G10" (ASSUME_TAC o MATCH_MP lemma_inverse_in_face) + THEN ABBREV_TAC `t = inverse (face_map (H:(A)hypermap)) y` + THEN POP_ASSUM (SUBST1_TAC o REWRITE_RULE[GSYM face_map_inverse_representation] o SYM) + THEN USE_THEN "F1" (MP_TAC o SPEC `t:A`) + THEN USE_THEN "G8" (MP_TAC o MATCH_MP lemma_face_subset) + THEN DISCH_THEN (fun th -> (POP_ASSUM (fun th1-> (ASSUME_TAC (MATCH_MP lemma_in_subset (CONJ th th1)))))) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN MP_TAC(SPECL[`H:(A)hypermap`; `L:(A)loop`; `y:A`] atom_reflect) + THEN USE_THEN "G6" MP_TAC THEN USE_THEN "G5" MP_TAC THEN USE_THEN "F3" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o SYM o MATCH_MP lemma_unique_tail) + THEN POP_ASSUM(fun th-> (DISCH_THEN (fun th1 -> (ASSUME_TAC (MATCH_MP EQ_TRANS (CONJ th th1)))))) + THEN POP_ASSUM MP_TAC THEN USE_THEN "G6" MP_TAC THEN USE_THEN "G5" MP_TAC THEN USE_THEN "F3" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o SYM o MATCH_MP atom_one_point) + THEN DISCH_TAC + THEN REMOVE_THEN "G11" MP_TAC + THEN USE_THEN "G9" (SUBST1_TAC o SYM) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN REWRITE_TAC[IN_SING] + THEN DISCH_THEN SUBST1_TAC THEN SIMP_TAC[]; ALL_TAC] + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[iso] + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP lemma_quotient th]) + THEN EXISTS_TAC `(\x:A. {x})` + THEN STRIP_TAC + THENL[REWRITE_TAC[BIJ] + THEN STRIP_TAC + THENL[REWRITE_TAC[INJ] + THEN STRIP_TAC + THENL[GEN_TAC + THEN REWRITE_TAC[GSYM lemma_support_face_collection] + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[GSYM(MATCH_MP lemma_choice_in_quotient th)]) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP lemma_quotient th]) + THEN USE_THEN "F4" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN MESON_TAC[SING_EQ]; ALL_TAC] + THEN REWRITE_TAC[SURJ] + THEN STRIP_TAC + THENL[GEN_TAC + THEN REWRITE_TAC[GSYM lemma_support_face_collection] + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[GSYM(MATCH_MP lemma_choice_in_quotient th)]) + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP lemma_quotient th]) + THEN USE_THEN "F4" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN GEN_TAC + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[MATCH_MP atom_via_choice th]) + THEN REWRITE_TAC[lemma_support_face_collection] + THEN USE_THEN "F4" (fun th -> REWRITE_TAC[th]) + THEN MESON_TAC[]; ALL_TAC] + THEN REWRITE_TAC[] + THEN SUBGOAL_THEN `!x:A. x IN dart (H:(A)hypermap) ==> nmap H (face_collection H) {x} = {node_map H x}` (LABEL_TAC "F5") + THENL[REWRITE_TAC[GSYM lemma_support_face_collection] + THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "G1") + THEN USE_THEN "F4" (fun th -> REWRITE_TAC[GSYM th]) + THEN USE_THEN "F3"(fun th-> (USE_THEN "G1" (fun th1-> REWRITE_TAC[MATCH_MP nmap_via_choice (CONJ th th1)]))) + THEN USE_THEN "F4" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F3" (fun th-> MP_TAC(CONJUNCT1(SPEC `x:A` (GSYM(MATCH_MP choice_at_margin th))))) + THEN USE_THEN "F4" (fun th -> REWRITE_TAC[th; SING_EQ]) + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `!x:A. x IN dart (H:(A)hypermap) ==> fmap H (face_collection H) {x} = {face_map H x}` (LABEL_TAC "F6") + THENL[REWRITE_TAC[GSYM lemma_support_face_collection] + THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "G1") + THEN USE_THEN "F4" (fun th -> REWRITE_TAC[GSYM th]) + THEN USE_THEN "F3"(fun th-> (USE_THEN "G1" (fun th1-> REWRITE_TAC[MATCH_MP fmap_via_choice (CONJ th th1)]))) + THEN USE_THEN "F4" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F3" (fun th-> MP_TAC(CONJUNCT2(SPEC `x:A` (GSYM(MATCH_MP choice_at_margin th))))) + THEN USE_THEN "F4" (fun th -> REWRITE_TAC[th; SING_EQ]) + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN ASM_REWRITE_TAC[emap] + THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F7") + THEN USE_THEN "F7"(fun th-> (USE_THEN "F5"(fun thm -> REWRITE_TAC[MATCH_MP thm th]))) + THEN USE_THEN "F7"(fun th-> (USE_THEN "F6"(fun thm -> REWRITE_TAC[MATCH_MP thm th]))) + THEN REWRITE_TAC [o_THM] + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[GSYM(MATCH_MP lemma_quotient th)]) + THEN CONV_TAC SYM_CONV + THEN REWRITE_TAC[GSYM face_map_inverse_representation] + THEN CONV_TAC SYM_CONV + THEN REWRITE_TAC[GSYM node_map_inverse_representation] + THEN USE_THEN "F3" (fun th -> REWRITE_TAC[MATCH_MP lemma_quotient th]) + THEN USE_THEN "F7" (LABEL_TAC "F8" o CONJUNCT1 o MATCH_MP lemma_dart_invariant) + THEN USE_THEN "F8" (fun th-> (USE_THEN "F6" (fun thm -> REWRITE_TAC[MATCH_MP thm th]))) + THEN USE_THEN "F8" (LABEL_TAC "F9" o CONJUNCT2 o CONJUNCT2 o MATCH_MP lemma_dart_invariant) + THEN USE_THEN "F9" (fun th-> (USE_THEN "F5" (fun thm -> REWRITE_TAC[MATCH_MP thm th]))) + THEN MP_TAC (AP_THM (CONJUNCT1 (SPEC `H:(A)hypermap` hypermap_cyclic)) `x:A`) + THEN DISCH_THEN (MP_TAC o SYM o REWRITE_RULE[o_THM; I_THM]) + THEN REWRITE_TAC[SING_EQ]);; + +let canon_loop = new_definition `!(H:(A)hypermap) (NF:(A)loop->bool). canon_loop H NF = {qf:(A->bool)->bool | qf IN face_set (quotient H NF) /\ (!s:A->bool. s IN qf ==> CARD s = 1)}`;; + +let set_one_point = prove(`!s:A->bool x:A. FINITE s /\ CARD s = 1 /\ x IN s ==> s = {x}`, + REPEAT GEN_TAC + THEN DISCH_THEN(CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN USE_THEN "F1" (MP_TAC o SPEC `x:A` o MATCH_MP CARD_DELETE) + THEN ASM_REWRITE_TAC[SUB_REFL] + THEN USE_THEN "F1" (MP_TAC o SPEC `x:A` o MATCH_MP FINITE_DELETE_IMP) + THEN REWRITE_TAC[IMP_IMP; GSYM HAS_SIZE; HAS_SIZE_0] + THEN DISCH_TAC + THEN USE_THEN "F3" (fun th-> MP_TAC th THEN MP_TAC (MATCH_MP INSERT_DELETE th)) + THEN POP_ASSUM SUBST1_TAC + THEN ASM_REWRITE_TAC[EQ_SYM]);; + +let lemma_canonical_function = prove(`!(H:(A)hypermap) (NF:(A)loop->bool). is_normal H NF ==> (!t:(A->bool)->bool. t IN canon_loop H NF <=> (?L:(A)loop. L IN NF /\ t = cycle H L /\ (!x:A. x belong L ==> L = face_loop H x /\ atom H L x = {x})))`, + REPEAT GEN_TAC THEN DISCH_THEN (LABEL_TAC "F1") THEN GEN_TAC + THEN EQ_TAC + THENL[REWRITE_TAC[canon_loop; IN_ELIM_THM; IN_ELIM_THM] + THEN DISCH_THEN (CONJUNCTS_THEN2 MP_TAC (LABEL_TAC "F2")) + THEN USE_THEN "F1"(fun th -> REWRITE_TAC[MATCH_MP lemmaQuotientFace th; IN_ELIM_THM]) + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "F3") SUBST_ALL_TAC)) + THEN EXISTS_TAC `L:(A)loop` + THEN ASM_REWRITE_TAC[] + THEN SUBGOAL_THEN `!y:A. atom (H:(A)hypermap) (L:(A)loop) (y:A) = {y}` (LABEL_TAC "F4") + THENL[GEN_TAC + THEN ASM_CASES_TAC `y:A belong L` + THENL[MATCH_MP_TAC set_one_point + THEN USE_THEN "F2" (MP_TAC o SPEC `atom (H:(A)hypermap) (L:(A)loop) (y:A)`) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP lemma_in_cycle2 th]) + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN REWRITE_TAC[lemma_atom_finite; atom_reflect]; ALL_TAC] + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP lemma_atom_out_side_loop th]); ALL_TAC] + THEN SUBGOAL_THEN `!z:A. z belong L ==> (!n:num. ((next (L:(A)loop)) POWER n) z = ((face_map (H:(A)hypermap)) POWER n) z)` (LABEL_TAC "F5") + THENL[REWRITE_TAC[RIGHT_IMP_FORALL_THM] + THEN ONCE_REWRITE_TAC[SWAP_FORALL_THM] + THEN INDUCT_TAC THENL[REWRITE_TAC[POWER_0]; ALL_TAC] + THEN GEN_TAC + THEN POP_ASSUM (LABEL_TAC "F5") + THEN DISCH_THEN (LABEL_TAC "F6") + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN USE_THEN "F6"(fun th-> (USE_THEN "F5"(fun thm->REWRITE_TAC[SYM(MATCH_MP thm th)]))) + THEN USE_THEN "F6" (LABEL_TAC "F7" o SPEC `n:num` o MATCH_MP lemma_power_next_in_loop) + THEN ABBREV_TAC `a = (next (L:(A)loop) POWER n) z` + THEN USE_THEN "F1"(fun th->(USE_THEN "F3"(fun th2->(USE_THEN "F7"(fun th3-> MP_TAC (MATCH_MP value_next_of_head (CONJ th (CONJ th2 th3)))))))) + THEN USE_THEN "F1"(fun th->(USE_THEN "F3"(fun th2->(USE_THEN "F7"(fun th3-> MP_TAC(CONJUNCT1(MATCH_MP head_on_loop (CONJ th (CONJ th2 th3))))))))) + THEN USE_THEN "F4" (fun th -> REWRITE_TAC[th; IN_SING]) + THEN DISCH_THEN SUBST1_TAC + THEN SIMP_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `!z:A. z belong L ==>dart_of L = face H z` (LABEL_TAC "F6") + THENL[GEN_TAC THEN DISCH_THEN (LABEL_TAC "F7") + THEN USE_THEN "F7" (fun th-> REWRITE_TAC[MATCH_MP lemma_transitive_permutation th]) + THEN USE_THEN "F7" (fun th-> USE_THEN "F5"(fun thm-> (MP_TAC ( MATCH_MP thm th)))) + THEN REWRITE_TAC[face; orbit_map; GE; LE_0] + THEN ASM_ASM_SET_TAC; ALL_TAC] + THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[lemma_loop_identity; face_loop_rep] + THEN GEN_TAC THEN DISCH_THEN (LABEL_TAC "F7") + THEN USE_THEN "F7" (fun th-> (USE_THEN "F6"(fun thm-> (LABEL_TAC "F8" (MATCH_MP thm th))))) + THEN USE_THEN "F8" (fun th-> REWRITE_TAC[th]) + THEN REWRITE_TAC[FUN_EQ_THM] + THEN GEN_TAC + THEN ASM_CASES_TAC `~(x':A belong L)` + THENL[POP_ASSUM (LABEL_TAC "F9") + THEN USE_THEN "F9" (fun th-> REWRITE_TAC[MATCH_MP lemma_back_and_next_outside_loop th]) + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[belong]) + THEN POP_ASSUM SUBST1_TAC + THEN MESON_TAC[res]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F9" o REWRITE_RULE[]) + THEN USE_THEN "F5"(fun thm -> USE_THEN "F9" (fun th-> REWRITE_TAC[REWRITE_RULE[POWER_1] (SPEC `1` (MATCH_MP thm th))])) + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[belong]) + THEN POP_ASSUM SUBST1_TAC + THEN MESON_TAC[res]; ALL_TAC] + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 SUBST1_TAC (LABEL_TAC "F3")))) + THEN REWRITE_TAC[canon_loop; IN_ELIM_THM] + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemmaQuotientFace th]) + THEN STRIP_TAC THENL[ASM_ASM_SET_TAC; ALL_TAC] + THEN GEN_TAC + THEN REWRITE_TAC[cycle; IN_ELIM_THM] + THEN STRIP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN USE_THEN "F3" (MP_TAC o SPEC `x:A`) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (SUBST1_TAC o CONJUNCT2) + THEN REWRITE_TAC[CARD_SINGLETON]);; + +let lemmaSTKBEPH = prove(`!(H:(A)hypermap) (NF:(A)loop->bool). is_normal H NF /\ number_of_faces H <= CARD (canon_loop H NF) + ==> NF = face_collection H /\ H iso quotient H NF`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN SUBGOAL_THEN `?t:(A)loop->((A->bool)->bool).(!L:(A)loop.L IN (NF:(A)loop->bool)/\cycle (H:(A)hypermap) L IN canon_loop H NF ==>t L = cycle H L)` MP_TAC + THENL[REWRITE_TAC[GSYM SKOLEM_THM] THEN GEN_TAC + THEN REWRITE_TAC[GSYM RIGHT_IMP_EXISTS_THM] + THEN STRIP_TAC THEN EXISTS_TAC `cycle (H:(A)hypermap) (L:(A)loop)` THEN SIMP_TAC[]; ALL_TAC] + THEN DISCH_THEN(X_CHOOSE_THEN `t:(A)loop->((A->bool)->bool)` (LABEL_TAC "F3")) + THEN ABBREV_TAC `S = {L:(A)loop | L IN (NF:(A)loop->bool) /\ cycle (H:(A)hypermap) L IN canon_loop H NF}` + THEN SUBGOAL_THEN `IMAGE (t:(A)loop->((A->bool)->bool)) (S:(A)loop->bool) = canon_loop (H:(A)hypermap) (NF:(A)loop->bool)` (LABEL_TAC "F4") + THENL[REWRITE_TAC[EXTENSION] THEN GEN_TAC + THEN REWRITE_TAC[IMAGE; IN_ELIM_THM] + THEN EQ_TAC + THENL[DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (CONJUNCTS_THEN2 MP_TAC SUBST1_TAC)) + THEN EXPAND_TAC "S" + THEN REWRITE_TAC[IN_ELIM_THM] + THEN DISCH_THEN (fun th-> (USE_THEN "F3"(fun thm-> REWRITE_TAC[MATCH_MP thm th])) THEN REWRITE_TAC[th]); ALL_TAC] + THEN DISCH_THEN (fun th -> (LABEL_TAC "F4" th THEN MP_TAC th)) + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[MATCH_MP lemma_canonical_function th]) + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (CONJUNCTS_THEN2 (ASSUME_TAC) (SUBST_ALL_TAC o CONJUNCT1))) + THEN EXISTS_TAC `L:(A)loop` + THEN EXPAND_TAC "S" + THEN ASM_REWRITE_TAC[IN_ELIM_THM] + THEN REMOVE_THEN "F3" (MP_TAC o SPEC `L:(A)loop`) + THEN ASM_REWRITE_TAC[] + THEN MESON_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `(S:(A)loop->bool) = face_collection (H:(A)hypermap)` (LABEL_TAC "F5") + THENL[SUBGOAL_THEN `(S:(A)loop->bool) SUBSET face_collection (H:(A)hypermap)` (LABEL_TAC "GG") + THENL[EXPAND_TAC "S" + THEN REWRITE_TAC[SUBSET; IN_ELIM_THM] + THEN GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G1") (MP_TAC)) + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_canonical_function th]) + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "G2") (CONJUNCTS_THEN2 MP_TAC (LABEL_TAC "G3")))) + THEN USE_THEN "G2" MP_TAC THEN USE_THEN "G1" MP_TAC THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (SUBST_ALL_TAC o MATCH_MP lemma_cycle_eq) + THEN USE_THEN "G1" (fun th -> (USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN DISCH_THEN (MP_TAC o CONJUNCT2) + THEN DISCH_THEN (X_CHOOSE_THEN `x:A` (CONJUNCTS_THEN2 (LABEL_TAC "G4") (LABEL_TAC "G5"))) + THEN REWRITE_TAC[face_collection; IN_ELIM_THM] + THEN EXISTS_TAC `x:A` + THEN USE_THEN "G3" (MP_TAC o SPEC `x:A`) + THEN ASM_MESON_TAC[]; ALL_TAC] + THEN MP_TAC (SPEC `H:(A)hypermap` lemma_card_face_collection) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G1") (LABEL_TAC "G2")) + THEN USE_THEN "G1"(fun th->(USE_THEN "GG"(fun th1->(MP_TAC(MATCH_MP FINITE_SUBSET (CONJ th th1)))))) + THEN DISCH_THEN (MP_TAC o ISPEC `t:(A)loop->((A->bool)->bool)` o MATCH_MP CARD_IMAGE_LE) + THEN REMOVE_THEN "F4" SUBST1_TAC + THEN REMOVE_THEN "F2" (fun th-> (DISCH_THEN (fun th1 -> MP_TAC (MATCH_MP LE_TRANS (CONJ th th1))))) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN USE_THEN "GG"(fun th->(USE_THEN "G1"(fun th1->(MP_TAC(MATCH_MP CARD_SUBSET (CONJ th th1)))))) + THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (LABEL_TAC "G3" o REWRITE_RULE[LE_ANTISYM]) + THEN MATCH_MP_TAC CARD_SUBSET_EQ + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `S:(A)loop->bool SUBSET NF:(A)loop->bool` (LABEL_TAC "F6") + THENL[EXPAND_TAC "S" THEN SET_TAC[]; ALL_TAC] + THEN SUBGOAL_THEN `S:(A)loop->bool = NF:(A)loop->bool` (LABEL_TAC "F7") + THENL[MATCH_MP_TAC SUBSET_ANTISYM + THEN USE_THEN "F6" (fun th-> REWRITE_TAC[th]) + THEN REWRITE_TAC[SUBSET] + THEN GEN_TAC THEN DISCH_THEN (LABEL_TAC "G7") + THEN USE_THEN "G7" (fun th -> (USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o SPEC `x:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN DISCH_THEN (MP_TAC o CONJUNCT2) + THEN DISCH_THEN (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (LABEL_TAC "G9") (LABEL_TAC "G10"))) + THEN SUBGOAL_THEN `face_loop (H:(A)hypermap) (y:A) IN face_collection H` MP_TAC + THENL[REWRITE_TAC[face_collection;IN_ELIM_THM] + THEN EXISTS_TAC `y:A` THEN USE_THEN "G9" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN REMOVE_THEN "F5" (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "G11") + THEN SUBGOAL_THEN `y:A belong face_loop (H:(A)hypermap) y` (LABEL_TAC "G12") + THENL[REWRITE_TAC[belong; face_loop_rep; face; orbit_reflect]; ALL_TAC] + THEN ABBREV_TAC `L' = face_loop (H:(A)hypermap) y` + THEN SUBGOAL_THEN `x:(A)loop = L'` SUBST1_TAC + THENL[MATCH_MP_TAC disjoint_loops + THEN EXISTS_TAC `H:(A)hypermap` THEN EXISTS_TAC `NF:(A)loop->bool` THEN EXISTS_TAC `y:A` + THEN ASM_REWRITE_TAC[] + THEN USE_THEN "F6"(fun th-> (USE_THEN "G11" (fun th1-> REWRITE_TAC[MATCH_MP lemma_in_subset (CONJ th th1)]))); ALL_TAC] + THEN USE_THEN "G11" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN STRIP_TAC + THENL[USE_THEN "F7" (SUBST1_TAC o SYM) THEN USE_THEN "F5" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `is_edge_nondegenerate (H:(A)hypermap)` (LABEL_TAC "F8") + THENL[REWRITE_TAC[lemma_edge_nondegenerate] + THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "G1") + THEN SUBGOAL_THEN `x:A belong face_loop (H:(A)hypermap) x` (LABEL_TAC "G2") + THENL[REWRITE_TAC[belong; face_loop_rep; face; orbit_reflect]; ALL_TAC] + THEN SUBGOAL_THEN `face_loop (H:(A)hypermap) x IN face_collection H` MP_TAC + THENL[REWRITE_TAC[face_collection; IN_ELIM_THM] THEN EXISTS_TAC `x:A` THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN ABBREV_TAC `L = face_loop (H:(A)hypermap) x` + THEN USE_THEN "F5" (SUBST1_TAC o SYM) + THEN EXPAND_TAC "S" + THEN REWRITE_TAC[IN_ELIM_THM] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G3") MP_TAC) + THEN USE_THEN "F1"(fun th ->REWRITE_TAC[MATCH_MP lemma_canonical_function th]) + THEN DISCH_THEN (X_CHOOSE_THEN `L':(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "G4") (CONJUNCTS_THEN2 MP_TAC (LABEL_TAC "G5")))) + THEN REMOVE_THEN "G4" MP_TAC THEN USE_THEN "G3" MP_TAC THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (SUBST_ALL_TAC o SYM o MATCH_MP lemma_cycle_eq) + THEN POP_ASSUM (MP_TAC o SPEC `x:A`) + THEN USE_THEN "G2" (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (ASSUME_TAC o CONJUNCT2) + THEN USE_THEN "F1"(fun th->USE_THEN "G3"(fun th1->(USE_THEN "G2" (fun th2 -> MP_TAC(MATCH_MP value_next_of_head (CONJ th (CONJ th1 th2))))))) + THEN USE_THEN "F1"(fun th->USE_THEN "G3"(fun th1->(USE_THEN "G2" (fun th2 -> MP_TAC(MATCH_MP head_on_loop (CONJ th (CONJ th1 th2))))))) + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[IN_SING] + THEN DISCH_THEN (CONJUNCTS_THEN2 (ASSUME_TAC) (MP_TAC)) + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_TAC + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `!x:A. x IN dart H ==> (?y:A. y IN dart H /\ y IN face H x /\ ~(node H x = node H y))` MP_TAC + THENL[ GEN_TAC + THEN DISCH_THEN (LABEL_TAC "G1") + THEN SUBGOAL_THEN `x:A belong face_loop (H:(A)hypermap) x` (LABEL_TAC "G2") + THENL[REWRITE_TAC[belong; face_loop_rep; face; orbit_reflect]; ALL_TAC] + THEN SUBGOAL_THEN `face_loop (H:(A)hypermap) x IN face_collection (H:(A)hypermap)` MP_TAC + THENL[REWRITE_TAC[face_collection; IN_ELIM_THM] THEN EXISTS_TAC `x:A` THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN USE_THEN "F5" (SUBST1_TAC o SYM) + THEN USE_THEN "F7" SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "G3") + THEN REWRITE_TAC[GSYM face_loop_rep; GSYM belong] + THEN ABBREV_TAC `L = face_loop (H:(A)hypermap) x` + THEN ONCE_REWRITE_TAC[TAUT `A <=> (~A ==> F)`] + THEN GEN_REWRITE_TAC (LAND_CONV o TOP_DEPTH_CONV) [NOT_EXISTS_THM; DE_MORGAN_THM; TAUT `~ ~A <=> A`] + THEN STRIP_TAC + THEN SUBGOAL_THEN `dart_of (L:(A)loop) SUBSET node (H:(A)hypermap) (x:A)` MP_TAC + THENL[REWRITE_TAC[SUBSET; GSYM belong] + THEN GEN_TAC + THEN POP_ASSUM (LABEL_TAC "G20") + THEN DISCH_THEN (LABEL_TAC "G21") + THEN REMOVE_THEN "G20" (MP_TAC o SPEC `x':A`) + THEN USE_THEN "F1"(fun th->(USE_THEN "G3"(fun th2->(USE_THEN "G21"(fun th3-> ASSUME_TAC (MATCH_MP lemma_in_dart (CONJ th (CONJ th2 th3)))))))) + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[th])) + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[node; orbit_reflect]; ALL_TAC] + THEN USE_THEN "F1" (fun th -> (USE_THEN "G3" (fun th1-> REWRITE_TAC[MATCH_MP lemma_loop_outside_node (CONJ th th1)]))); ALL_TAC] + THEN USE_THEN "F7" (SUBST1_TAC o SYM) + THEN USE_THEN "F5" SUBST1_TAC + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP face_quotient_lemma th]));; + +(* Cyclic hypermaps *) + +let edge_cyclic_map_lemma = prove(`!p:num->A q:num->A k:num. ?e:A->A. !x:A. ((~(x IN ((support_list p k) UNION (support_list q k))) ==> e x = x) /\ +(x IN ((support_list p k) UNION (support_list q k)) ==> (x IN support_list p k ==> ?j:num. j <= k /\ x = p j /\ e x = q (SUC j MOD (SUC k))) /\ (~(x IN support_list p k) ==> ?j:num. j <= k /\ x = q j /\ e x = p ((j+k) MOD (SUC k)))))`, + REPEAT GEN_TAC + THEN REWRITE_TAC[GSYM SKOLEM_THM] + THEN GEN_TAC + THEN ASM_CASES_TAC `~(x:A IN (support_list (p:num->A) (k:num)) UNION (support_list (q:num->A) k))` + THENL[EXISTS_TAC `x:A` THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM (ASSUME_TAC o REWRITE_RULE[]) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM (LABEL_TAC "F1" o REWRITE_RULE[IN_UNION]) + THEN ASM_CASES_TAC `x:A IN support_list (p:num->A) (k:num)` + THENL[ASM_REWRITE_TAC[] + THEN ONCE_REWRITE_TAC[SWAP_EXISTS_THM] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[support_list; IN_ELIM_THM]) + THEN STRIP_TAC THEN EXISTS_TAC `i:num` + THEN EXISTS_TAC `(q:num->A) (SUC i MOD SUC k)` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN ASM_REWRITE_TAC[] + THEN REMOVE_THEN "F1" MP_TAC + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (MP_TAC o REWRITE_RULE[support_list; IN_ELIM_THM]) + THEN STRIP_TAC + THEN ONCE_REWRITE_TAC[SWAP_EXISTS_THM] + THEN EXISTS_TAC `i:num` + THEN EXISTS_TAC `(p:num->A) (((i:num) + (k:num)) MOD (SUC k))` + THEN ASM_REWRITE_TAC[]);; + +let node_cyclic_map_lemma = prove(`!p:num->A q:num->A k:num. ?n:A->A. !x:A. ((~(x IN ((support_list p k) UNION (support_list q k))) ==> n x = x) /\ +((x IN ((support_list p k) UNION (support_list q k)) ==> ((x IN support_list p k ==> ?j:num. j <= k /\ x = p j /\ n x = q j)) /\ (~(x IN support_list p k) ==> ?j:num. j <= k /\ x = q j /\ n x = p j))))`, + REPEAT GEN_TAC + THEN REWRITE_TAC[GSYM SKOLEM_THM] + THEN GEN_TAC + THEN ASM_CASES_TAC `~(x:A IN (support_list (p:num->A) (k:num)) UNION (support_list (q:num->A) k))` + THENL[EXISTS_TAC `x:A` THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM (ASSUME_TAC o REWRITE_RULE[]) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM (LABEL_TAC "F1" o REWRITE_RULE[IN_UNION]) + THEN ASM_CASES_TAC `x:A IN support_list (p:num->A) (k:num)` + THENL[ASM_REWRITE_TAC[] + THEN ONCE_REWRITE_TAC[SWAP_EXISTS_THM] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[support_list; IN_ELIM_THM]) + THEN STRIP_TAC THEN EXISTS_TAC `i:num` + THEN EXISTS_TAC `(q:num->A) i` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN ASM_REWRITE_TAC[] + THEN REMOVE_THEN "F1" MP_TAC + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (MP_TAC o REWRITE_RULE[support_list; IN_ELIM_THM]) + THEN STRIP_TAC + THEN ONCE_REWRITE_TAC[SWAP_EXISTS_THM] + THEN EXISTS_TAC `i:num` + THEN EXISTS_TAC `(p:num->A) i` + THEN ASM_REWRITE_TAC[]);; + +let face_cyclic_map_lemma = prove(`!p:num->A q:num->A k:num. ?f:A->A. !x:A. ((~(x IN ((support_list p k) UNION (support_list q k))) ==> f x = x) /\ +(x IN ((support_list p k) UNION (support_list q k)) ==> (x IN support_list p k ==> ?j:num. j <= k /\ x = p j /\ f x = p ((SUC j) MOD (SUC k))) /\ (~(x IN support_list p k) ==> ?j:num. j <= k /\ x = q j /\ f x = q ((j + k) MOD (SUC k)))))`, + REPEAT GEN_TAC + THEN REWRITE_TAC[GSYM SKOLEM_THM] + THEN GEN_TAC + THEN ASM_CASES_TAC `~(x:A IN (support_list (p:num->A) (k:num)) UNION (support_list (q:num->A) k))` + THENL[EXISTS_TAC `x:A` THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN POP_ASSUM (ASSUME_TAC o REWRITE_RULE[]) + THEN ASM_REWRITE_TAC[] + THEN POP_ASSUM (LABEL_TAC "F1" o REWRITE_RULE[IN_UNION]) + THEN ASM_CASES_TAC `x:A IN support_list (p:num->A) (k:num)` + THENL[ASM_REWRITE_TAC[] + THEN ONCE_REWRITE_TAC[SWAP_EXISTS_THM] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[support_list; IN_ELIM_THM]) + THEN STRIP_TAC THEN EXISTS_TAC `i:num` + THEN EXISTS_TAC `(p:num->A) ((SUC i) MOD (SUC k))` + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN ASM_REWRITE_TAC[] + THEN REMOVE_THEN "F1" MP_TAC + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (MP_TAC o REWRITE_RULE[support_list; IN_ELIM_THM]) + THEN STRIP_TAC + THEN ONCE_REWRITE_TAC[SWAP_EXISTS_THM] + THEN EXISTS_TAC `i:num` + THEN EXISTS_TAC `(q:num->A) ((i + k) MOD (SUC k))` + THEN ASM_REWRITE_TAC[]);; + +let lemma_cyclic_edge_map = new_specification ["cyc_emap"] (REWRITE_RULE[SKOLEM_THM] edge_cyclic_map_lemma);; + +let lemma_cyclic_node_map = new_specification ["cyc_nmap"] (REWRITE_RULE[SKOLEM_THM] node_cyclic_map_lemma);; + +let lemma_cyclic_face_map = new_specification ["cyc_fmap"] (REWRITE_RULE[SKOLEM_THM] face_cyclic_map_lemma);; + +let lemma_cyclic_emap = prove(`!p:num->A q:num->A k:num. is_inj_list p k /\ is_inj_list q k /\ is_disjoint p q k k + ==> (!i:num. i <= k ==> cyc_emap p q k (p i) = (q (SUC i MOD SUC k)) /\ cyc_emap p q k (q i) = p ((i+k) MOD SUC k))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F4") + THEN STRIP_TAC + THENL[MP_TAC (CONJUNCT2(SPECL[`p:num->A`; `q:num->A`; `k:num`; `(p:num->A) i`] lemma_cyclic_edge_map)) + THEN USE_THEN "F4" (fun th -> LABEL_TAC "F5" (MATCH_MP (SPEC `p:num->A` lemma_element_in_list) th)) + THEN SUBGOAL_THEN `(p:num->A) i IN (support_list p (k:num) UNION support_list (q:num->A) k)` (fun th -> REWRITE_TAC[th]) + THENL[REWRITE_TAC[IN_UNION; GSYM in_list] + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN USE_THEN "F5" (fun th -> REWRITE_TAC[REWRITE_RULE[in_list] th]) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (CONJUNCTS_THEN2 (LABEL_TAC "F6") (CONJUNCTS_THEN2 (LABEL_TAC "F7") SUBST1_TAC))) + THEN USE_THEN "F1" (MP_TAC o SPECL[`j:num`; `i:num`] o REWRITE_RULE[lemma_inj_list2]) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC THEN SIMP_TAC[]; ALL_TAC] + THEN MP_TAC (CONJUNCT2(SPECL[`p:num->A`; `q:num->A`; `k:num`; `(q:num->A) i`] lemma_cyclic_edge_map)) + THEN USE_THEN "F4" (fun th -> LABEL_TAC "F5" (MATCH_MP (SPEC `q:num->A` lemma_element_in_list) th)) + THEN SUBGOAL_THEN `(q:num->A) i IN (support_list p (k:num) UNION support_list (q:num->A) k)` (fun th -> REWRITE_TAC[th]) + THENL[REWRITE_TAC[IN_UNION; GSYM in_list] + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `~((q:num->A) i IN (support_list p (k:num)))`(fun th -> REWRITE_TAC[th]) + THENL[REWRITE_TAC[GSYM in_list] + THEN USE_THEN "F3" (MP_TAC o SPEC `i:num` o REWRITE_RULE[lemma_list_disjoint2]) + THEN USE_THEN "F4"(fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (CONJUNCTS_THEN2 (LABEL_TAC "F6") (CONJUNCTS_THEN2 (LABEL_TAC "F7") SUBST1_TAC))) + THEN USE_THEN "F2" (MP_TAC o SPECL[`j:num`; `i:num`] o REWRITE_RULE[lemma_inj_list2]) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC THEN SIMP_TAC[]);; + +let lemma_cyclic_nmap = prove(`!p:num->A q:num->A k:num. is_inj_list p k /\ is_inj_list q k /\ is_disjoint p q k k + ==> (!i:num. i <= k ==> cyc_nmap p q k (p i) = q i /\ cyc_nmap p q k (q i) = p i)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F4") + THEN STRIP_TAC + THENL[MP_TAC (CONJUNCT2(SPECL[`p:num->A`; `q:num->A`; `k:num`; `(p:num->A) i`] lemma_cyclic_node_map)) + THEN USE_THEN "F4" (fun th -> LABEL_TAC "F5" (MATCH_MP (SPEC `p:num->A` lemma_element_in_list) th)) + THEN SUBGOAL_THEN `(p:num->A) i IN (support_list p (k:num) UNION support_list (q:num->A) k)` (fun th -> REWRITE_TAC[th]) + THENL[REWRITE_TAC[IN_UNION; GSYM in_list] + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN USE_THEN "F5" (fun th -> REWRITE_TAC[REWRITE_RULE[in_list] th]) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (CONJUNCTS_THEN2 (LABEL_TAC "F6") (CONJUNCTS_THEN2 (LABEL_TAC "F7") SUBST1_TAC))) + THEN USE_THEN "F1" (MP_TAC o SPECL[`j:num`; `i:num`] o REWRITE_RULE[lemma_inj_list2]) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC THEN SIMP_TAC[]; ALL_TAC] + THEN MP_TAC (CONJUNCT2(SPECL[`p:num->A`; `q:num->A`; `k:num`; `(q:num->A) i`] lemma_cyclic_node_map)) + THEN USE_THEN "F4" (fun th -> LABEL_TAC "F5" (MATCH_MP (SPEC `q:num->A` lemma_element_in_list) th)) + THEN SUBGOAL_THEN `(q:num->A) i IN (support_list p (k:num) UNION support_list (q:num->A) k)` (fun th -> REWRITE_TAC[th]) + THENL[REWRITE_TAC[IN_UNION; GSYM in_list] + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `~((q:num->A) i IN (support_list p (k:num)))`(fun th -> REWRITE_TAC[th]) + THENL[REWRITE_TAC[GSYM in_list] + THEN USE_THEN "F3" (MP_TAC o SPEC `i:num` o REWRITE_RULE[lemma_list_disjoint2]) + THEN USE_THEN "F4"(fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (CONJUNCTS_THEN2 (LABEL_TAC "F6") (CONJUNCTS_THEN2 (LABEL_TAC "F7") SUBST1_TAC))) + THEN USE_THEN "F2" (MP_TAC o SPECL[`j:num`; `i:num`] o REWRITE_RULE[lemma_inj_list2]) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC THEN SIMP_TAC[]);; + +let lemma_cyclic_fmap = prove(`!p:num->A q:num->A k:num. is_inj_list p k /\ is_inj_list q k /\ is_disjoint p q k k + ==> (!i:num. i <= k ==> cyc_fmap p q k (p i) = (p (SUC i MOD SUC k)) /\ cyc_fmap p q k (q i) = q ((i+k) MOD SUC k))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F4") + THEN STRIP_TAC + THENL[MP_TAC (CONJUNCT2(SPECL[`p:num->A`; `q:num->A`; `k:num`; `(p:num->A) i`] lemma_cyclic_face_map)) + THEN USE_THEN "F4" (fun th -> LABEL_TAC "F5" (MATCH_MP (SPEC `p:num->A` lemma_element_in_list) th)) + THEN SUBGOAL_THEN `(p:num->A) i IN (support_list p (k:num) UNION support_list (q:num->A) k)` (fun th -> REWRITE_TAC[th]) + THENL[REWRITE_TAC[IN_UNION; GSYM in_list] + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN USE_THEN "F5" (fun th -> REWRITE_TAC[REWRITE_RULE[in_list] th]) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (CONJUNCTS_THEN2 (LABEL_TAC "F6") (CONJUNCTS_THEN2 (LABEL_TAC "F7") SUBST1_TAC))) + THEN USE_THEN "F1" (MP_TAC o SPECL[`j:num`; `i:num`] o REWRITE_RULE[lemma_inj_list2]) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC THEN SIMP_TAC[]; ALL_TAC] + THEN MP_TAC (CONJUNCT2(SPECL[`p:num->A`; `q:num->A`; `k:num`; `(q:num->A) i`] lemma_cyclic_face_map)) + THEN USE_THEN "F4" (fun th -> LABEL_TAC "F5" (MATCH_MP (SPEC `q:num->A` lemma_element_in_list) th)) + THEN SUBGOAL_THEN `(q:num->A) i IN (support_list p (k:num) UNION support_list (q:num->A) k)` (fun th -> REWRITE_TAC[th]) + THENL[REWRITE_TAC[IN_UNION; GSYM in_list] + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `~((q:num->A) i IN (support_list p (k:num)))`(fun th -> REWRITE_TAC[th]) + THENL[REWRITE_TAC[GSYM in_list] + THEN USE_THEN "F3" (MP_TAC o SPEC `i:num` o REWRITE_RULE[lemma_list_disjoint2]) + THEN USE_THEN "F4"(fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (CONJUNCTS_THEN2 (LABEL_TAC "F6") (CONJUNCTS_THEN2 (LABEL_TAC "F7") SUBST1_TAC))) + THEN USE_THEN "F2" (MP_TAC o SPECL[`j:num`; `i:num`] o REWRITE_RULE[lemma_inj_list2]) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN SUBST1_TAC THEN SIMP_TAC[]);; + +let cyclic_hypermap = new_definition `!p:num->A q:num->A k:num. cyclic_hypermap p q k + = hypermap(support_list p k UNION support_list q k, cyc_emap p q k, cyc_nmap p q k, cyc_fmap p q k)`;; + +let lemma_cyclic_hypermap = prove(`!p:num->A q:num->A k:num. is_inj_list p k /\ is_inj_list q k /\ is_disjoint p q k k ==> dart (cyclic_hypermap p q k) = support_list p k UNION support_list q k /\ edge_map (cyclic_hypermap p q k) = cyc_emap p q k /\ node_map (cyclic_hypermap p q k) = cyc_nmap p q k /\ face_map (cyclic_hypermap p q k) = cyc_fmap p q k`, + REPEAT GEN_TAC THEN DISCH_THEN (LABEL_TAC "FF") + THEN REWRITE_TAC[cyclic_hypermap] + THEN MATCH_MP_TAC lemma_hypermap_rep + THEN SUBGOAL_THEN `FINITE (support_list (p:num->A) (k:num) UNION support_list (q:num->A) k)` (LABEL_TAC "F1") + THENL[REWRITE_TAC[FINITE_UNION; lemma_finite_list]; ALL_TAC] + THEN USE_THEN "F1" (fun th->REWRITE_TAC[th]) + THEN STRIP_TAC + THENL[MATCH_MP_TAC lemma_permutes_via_surjetive + THEN USE_THEN "F1" (fun th->REWRITE_TAC[th]) + THEN REWRITE_TAC[lemma_cyclic_edge_map] + THEN STRIP_TAC + THENL[GEN_TAC THEN REWRITE_TAC[IN_UNION; support_list; IN_ELIM_THM] + THEN STRIP_TAC + THENL[DISJ2_TAC + THEN POP_ASSUM SUBST1_TAC + THEN EXISTS_TAC `SUC i MOD SUC k` + THEN REWRITE_TAC[LE_MOD_SUC] + THEN USE_THEN "FF" (MP_TAC o SPEC `i:num` o MATCH_MP lemma_cyclic_emap) + THEN POP_ASSUM (fun th->REWRITE_TAC[th]) + THEN DISCH_THEN (SUBST1_TAC o CONJUNCT1) + THEN SIMP_TAC[]; ALL_TAC] + THEN DISJ1_TAC + THEN POP_ASSUM SUBST1_TAC + THEN EXISTS_TAC `((i:num) + (k:num)) MOD SUC k` + THEN REWRITE_TAC[LE_MOD_SUC] + THEN USE_THEN "FF" (MP_TAC o SPEC `i:num` o MATCH_MP lemma_cyclic_emap) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (SUBST1_TAC o CONJUNCT2) THEN SIMP_TAC[]; ALL_TAC] + THEN GEN_TAC + THEN REWRITE_TAC[IN_UNION; support_list; IN_ELIM_THM] + THEN STRIP_TAC + THENL[POP_ASSUM SUBST1_TAC + THEN EXISTS_TAC `(q:num->A) (SUC i MOD SUC k)` + THEN USE_THEN "FF" (MP_TAC o CONJUNCT2 o REWRITE_RULE[LE_MOD_SUC] o SPEC `SUC i MOD SUC k` o MATCH_MP lemma_cyclic_emap) + THEN DISCH_THEN SUBST1_TAC + THEN AP_TERM_TAC + THEN GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [GSYM(MATCH_MP MOD_LT (SPEC `k:num` LT_PLUS))] + THEN REWRITE_TAC[MATCH_MP MOD_ADD_MOD (SPEC `k:num` NON_ZERO)] + THEN REWRITE_TAC[ADD] + THEN REWRITE_TAC[GSYM ADD_SUC] + THEN ONCE_REWRITE_TAC[ADD_SYM] + THEN REWRITE_TAC[(REWRITE_RULE[MULT_CLAUSES] (SPECL[`1`; `SUC k`; `i:num`] MOD_MULT_ADD))] + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP MOD_LT (REWRITE_RULE[GSYM LT_SUC_LE] th)]); ALL_TAC] + THEN POP_ASSUM SUBST1_TAC + THEN EXISTS_TAC `(p:num->A) (((i:num) + k) MOD SUC k)` + THEN USE_THEN "FF" (MP_TAC o CONJUNCT1 o REWRITE_RULE[LE_MOD_SUC] o SPEC `((i:num) + k) MOD SUC k` o MATCH_MP lemma_cyclic_emap) + THEN DISCH_THEN SUBST1_TAC + THEN POP_ASSUM (fun th->REWRITE_TAC[MATCH_MP lemma_from_index th]); ALL_TAC] + THEN STRIP_TAC + THENL[MATCH_MP_TAC lemma_permutes_via_surjetive + THEN USE_THEN "F1" (fun th->REWRITE_TAC[th]) + THEN REWRITE_TAC[lemma_cyclic_node_map] + THEN STRIP_TAC + THENL[GEN_TAC THEN REWRITE_TAC[IN_UNION; support_list; IN_ELIM_THM] + THEN STRIP_TAC + THENL[DISJ2_TAC + THEN POP_ASSUM SUBST1_TAC + THEN EXISTS_TAC `i:num` + THEN USE_THEN "FF" (MP_TAC o SPEC `i:num` o MATCH_MP lemma_cyclic_nmap) + THEN POP_ASSUM (fun th->REWRITE_TAC[th]) + THEN DISCH_THEN (SUBST1_TAC o CONJUNCT1) + THEN SIMP_TAC[]; ALL_TAC] + THEN DISJ1_TAC + THEN POP_ASSUM SUBST1_TAC + THEN EXISTS_TAC `i:num` + THEN USE_THEN "FF" (MP_TAC o SPEC `i:num` o MATCH_MP lemma_cyclic_nmap) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (SUBST1_TAC o CONJUNCT2) THEN SIMP_TAC[]; ALL_TAC] + THEN GEN_TAC + THEN REWRITE_TAC[IN_UNION; support_list; IN_ELIM_THM] + THEN STRIP_TAC + THENL[POP_ASSUM SUBST1_TAC + THEN EXISTS_TAC `(q:num->A) i` + THEN POP_ASSUM(fun th1-> USE_THEN "FF"(MP_TAC o CONJUNCT2 o REWRITE_RULE[th1] o SPEC `i:num` o MATCH_MP lemma_cyclic_nmap)) + THEN SIMP_TAC[]; ALL_TAC] + THEN POP_ASSUM SUBST1_TAC + THEN EXISTS_TAC `(p:num->A) i` + THEN POP_ASSUM (fun th-> (USE_THEN "FF" (MP_TAC o CONJUNCT1 o REWRITE_RULE[th] o SPEC `i:num` o MATCH_MP lemma_cyclic_nmap))) + THEN SIMP_TAC[]; ALL_TAC] + THEN STRIP_TAC + THENL[MATCH_MP_TAC lemma_permutes_via_surjetive + THEN USE_THEN "F1" (fun th->REWRITE_TAC[th]) + THEN REWRITE_TAC[lemma_cyclic_face_map] + THEN STRIP_TAC + THENL[GEN_TAC THEN REWRITE_TAC[IN_UNION; support_list; IN_ELIM_THM] + THEN STRIP_TAC + THENL[DISJ1_TAC + THEN POP_ASSUM SUBST1_TAC + THEN EXISTS_TAC `SUC i MOD SUC k` + THEN REWRITE_TAC[LE_MOD_SUC] + THEN USE_THEN "FF" (MP_TAC o SPEC `i:num` o MATCH_MP lemma_cyclic_fmap) + THEN POP_ASSUM (fun th->REWRITE_TAC[th]) + THEN DISCH_THEN (SUBST1_TAC o CONJUNCT1) + THEN SIMP_TAC[]; ALL_TAC] + THEN DISJ2_TAC + THEN POP_ASSUM SUBST1_TAC + THEN EXISTS_TAC `((i:num) + (k:num)) MOD SUC k` + THEN REWRITE_TAC[LE_MOD_SUC] + THEN USE_THEN "FF" (MP_TAC o SPEC `i:num` o MATCH_MP lemma_cyclic_fmap) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) + THEN DISCH_THEN (SUBST1_TAC o CONJUNCT2) THEN SIMP_TAC[]; ALL_TAC] + THEN GEN_TAC + THEN REWRITE_TAC[IN_UNION; support_list; IN_ELIM_THM] + THEN STRIP_TAC + THENL[POP_ASSUM SUBST1_TAC + THEN EXISTS_TAC `(p:num->A) (((i:num) + (k:num)) MOD SUC k)` + THEN USE_THEN "FF" (MP_TAC o CONJUNCT1 o REWRITE_RULE[LE_MOD_SUC] o SPEC `((i:num) + k) MOD SUC k` o MATCH_MP lemma_cyclic_fmap) + THEN DISCH_THEN SUBST1_TAC + THEN AP_TERM_TAC + THEN POP_ASSUM (fun th->REWRITE_TAC[MATCH_MP lemma_from_index th]); ALL_TAC] + THEN POP_ASSUM SUBST1_TAC + THEN EXISTS_TAC `(q:num->A) (SUC i MOD SUC k)` + THEN USE_THEN "FF" (MP_TAC o CONJUNCT2 o REWRITE_RULE[LE_MOD_SUC] o SPEC `SUC i MOD SUC k` o MATCH_MP lemma_cyclic_fmap) + THEN DISCH_THEN SUBST1_TAC + THEN AP_TERM_TAC + THEN POP_ASSUM(fun th -> REWRITE_TAC[MATCH_MP lemma_from_index2 th]); ALL_TAC] + THEN REWRITE_TAC[FUN_EQ_THM; I_THM; o_THM] + THEN GEN_TAC + THEN ASM_CASES_TAC `~(x:A IN (support_list (p:num->A) (k:num)) UNION (support_list (q:num->A) k))` + THENL[POP_ASSUM (LABEL_TAC "G10") + THEN MP_TAC (CONJUNCT1(SPECL[`p:num->A`; `q:num->A`; `k:num`; `x:A`] lemma_cyclic_face_map)) + THEN USE_THEN "G10" (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC (CONJUNCT1(SPECL[`p:num->A`; `q:num->A`; `k:num`; `x:A`] lemma_cyclic_node_map)) + THEN USE_THEN "G10" (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC (CONJUNCT1(SPECL[`p:num->A`; `q:num->A`; `k:num`; `x:A`] lemma_cyclic_edge_map)) + THEN USE_THEN "G10" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[IN_UNION; support_list; IN_ELIM_THM]) + THEN STRIP_TAC + THENL[POP_ASSUM SUBST1_TAC + THEN POP_ASSUM (LABEL_TAC "H1") + THEN USE_THEN "H1" (fun th-> USE_THEN "FF" (SUBST1_TAC o CONJUNCT1 o REWRITE_RULE[th] o SPEC `i:num` o MATCH_MP lemma_cyclic_fmap)) + THEN USE_THEN "FF" (SUBST1_TAC o CONJUNCT1 o REWRITE_RULE[LE_MOD_SUC] o SPEC `SUC i MOD SUC k` o MATCH_MP lemma_cyclic_nmap) + THEN USE_THEN "FF" (SUBST1_TAC o CONJUNCT2 o REWRITE_RULE[LE_MOD_SUC] o SPEC `SUC i MOD SUC k` o MATCH_MP lemma_cyclic_emap) + THEN AP_TERM_TAC + THEN POP_ASSUM(fun th -> REWRITE_TAC[MATCH_MP lemma_from_index2 th]); ALL_TAC] + THEN POP_ASSUM SUBST1_TAC + THEN POP_ASSUM (LABEL_TAC "H1") + THEN USE_THEN "H1" (fun th-> USE_THEN "FF" (SUBST1_TAC o CONJUNCT2 o REWRITE_RULE[th] o SPEC `i:num` o MATCH_MP lemma_cyclic_fmap)) + THEN USE_THEN "FF" (SUBST1_TAC o CONJUNCT2 o REWRITE_RULE[LE_MOD_SUC] o SPEC `((i:num) + k) MOD SUC k` o MATCH_MP lemma_cyclic_nmap) + THEN USE_THEN "FF" (SUBST1_TAC o CONJUNCT1 o REWRITE_RULE[LE_MOD_SUC] o SPEC `((i:num) +k) MOD SUC k` o MATCH_MP lemma_cyclic_emap) + THEN AP_TERM_TAC + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP lemma_from_index th]));; + + +(* no double joints *) + +let is_no_double_joins = new_definition `is_no_double_joins (H:(A)hypermap) + <=> (!x y. x IN dart H /\ y IN node H x /\ edge_map H y IN node H (edge_map H x) ==> x = y)`;; + +let margin_in_support_darts = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) x:A. is_normal H NF /\ x IN support_darts NF + ==> head H NF x IN support_darts NF /\ tail H NF x IN support_darts NF`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (MP_TAC o REWRITE_RULE[lemma_in_support])) + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4"))) + THEN STRIP_TAC + THENL[MATCH_MP_TAC lemma_in_support2 + THEN EXISTS_TAC `L:(A)loop` + THEN ASM_REWRITE_TAC[belong] + THEN MATCH_MP_TAC lemma_in_subset + THEN EXISTS_TAC `atom (H:(A)hypermap) (L:(A)loop) (x:A)` + THEN USE_THEN "F4"(fun th -> REWRITE_TAC[MATCH_MP lemma_atom_sub_loop th]) + THEN USE_THEN "F1"(fun th->USE_THEN "F3"(fun th1->USE_THEN "F4"(fun th2->REWRITE_TAC[CONJUNCT2(MATCH_MP change_to_margin (CONJ th (CONJ th1 th2)))]))) + THEN REWRITE_TAC[atom_reflect]; ALL_TAC] + THEN MATCH_MP_TAC lemma_in_support2 + THEN EXISTS_TAC `L:(A)loop` + THEN ASM_REWRITE_TAC[belong] + THEN MATCH_MP_TAC lemma_in_subset + THEN EXISTS_TAC `atom (H:(A)hypermap) (L:(A)loop) (x:A)` + THEN USE_THEN "F4" (fun th->REWRITE_TAC[MATCH_MP lemma_atom_sub_loop th]) + THEN USE_THEN "F1"(fun th->USE_THEN "F3" (fun th1->USE_THEN "F4"(fun th2->REWRITE_TAC[CONJUNCT1(MATCH_MP change_to_margin (CONJ th (CONJ th1 th2)))]))) + THEN REWRITE_TAC[atom_reflect]);; + +let lemmaQuotientNoDoubleJoins = prove(`!(H:(A)hypermap) (NF:(A)loop->bool). is_normal H NF /\ is_no_double_joins H /\ plain_hypermap H + ==> is_no_double_joins (quotient H NF)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN REWRITE_TAC[is_no_double_joins] + THEN REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7"))) + THEN USE_THEN "F5" (MP_TAC o MATCH_MP lemma_node_subset) + THEN DISCH_THEN (fun th-> (USE_THEN "F6" (fun th1 -> LABEL_TAC "F8" (MATCH_MP lemma_in_subset (CONJ th th1))))) + THEN USE_THEN "F1" (MP_TAC o MATCH_MP lemma_quotient) + THEN DISCH_THEN (CONJUNCTS_THEN2 SUBST_ALL_TAC (SUBST_ALL_TAC o CONJUNCT1)) + THEN REMOVE_THEN "F5" MP_TAC + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP atom_via_choice th]) + THEN DISCH_THEN (X_CHOOSE_THEN `a:A` (CONJUNCTS_THEN2 (LABEL_TAC "F5") MP_TAC)) + THEN USE_THEN "F1" (fun th -> ONCE_REWRITE_TAC[CONJUNCT2 (SPEC `a:A`(MATCH_MP choice_at_margin th))]) + THEN DISCH_THEN SUBST_ALL_TAC + THEN REMOVE_THEN "F8" MP_TAC + THEN USE_THEN "F1" (fun th-> ONCE_REWRITE_TAC[MATCH_MP atom_via_choice th]) + THEN DISCH_THEN (X_CHOOSE_THEN `b:A` (CONJUNCTS_THEN2 (LABEL_TAC "F8") MP_TAC)) + THEN USE_THEN "F1" (fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [CONJUNCT2 (SPEC `b:A`(MATCH_MP choice_at_margin th))]) + THEN DISCH_THEN SUBST_ALL_TAC + THEN REMOVE_THEN "F7" MP_TAC + THEN USE_THEN "F1" (fun th-> (USE_THEN "F5" (fun th1 -> MP_TAC (MATCH_MP emap_via_choice (CONJ th th1))))) + THEN USE_THEN "F1"(fun th->GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [CONJUNCT2 (SPEC `a:A`(MATCH_MP choice_at_margin th))]) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F9") (CONJUNCTS_THEN2 MP_TAC SUBST1_TAC)) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN USE_THEN "F1" (fun th-> (USE_THEN "F8" (fun th1 -> MP_TAC (MATCH_MP emap_via_choice (CONJ th th1))))) + THEN USE_THEN "F1" (fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [CONJUNCT2 (SPEC `b:A`(MATCH_MP choice_at_margin th))]) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F10") (CONJUNCTS_THEN2 MP_TAC SUBST1_TAC)) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "F7") + THEN USE_THEN "F1" (fun th-> (REMOVE_THEN "F5" (fun th1-> (LABEL_TAC "F5" (CONJUNCT1 (MATCH_MP margin_in_support_darts (CONJ th th1))))))) + THEN USE_THEN "F1" (fun th-> (REMOVE_THEN "F8" (fun th1-> (LABEL_TAC "F8" (CONJUNCT1 (MATCH_MP margin_in_support_darts (CONJ th th1))))))) + THEN ABBREV_TAC `u = head (H:(A)hypermap) (NF:(A)loop->bool) (a:A)` + THEN ABBREV_TAC `v = head (H:(A)hypermap) (NF:(A)loop->bool) (b:A)` + THEN USE_THEN "F6" MP_TAC THEN USE_THEN "F5" MP_TAC THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (ASSUME_TAC o MATCH_MP lemma_in_node3) + THEN USE_THEN "F7" MP_TAC THEN USE_THEN "F9" MP_TAC THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (ASSUME_TAC o MATCH_MP lemma_in_node3) + THEN REMOVE_THEN "F2" (MP_TAC o SPECL[`u:A`; `v:A`] o REWRITE_RULE[is_no_double_joins]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT1 o MATCH_MP lemma_finite_support) + THEN DISCH_THEN (fun th-> USE_THEN "F5" (fun th1 -> REWRITE_TAC[MATCH_MP lemma_in_subset (CONJ th th1)])) + THEN DISCH_THEN SUBST1_TAC THEN SIMP_TAC[]);; + +let lemmaSimpleQuotient = prove(`!H:(A)hypermap NF:(A)loop->bool. is_normal H NF + ==> (simple_hypermap (quotient H NF) <=> (!L:(A)loop x:A y:A. L IN NF /\ x belong L /\ y belong L /\ y IN node H x ==> atom H L x = atom H L y))`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN EQ_TAC + THENL[DISCH_THEN (LABEL_TAC "F2" o REWRITE_RULE[simple_hypermap]) + THEN REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6")))) + THEN REMOVE_THEN "F2" (MP_TAC o SPEC `atom (H:(A)hypermap) (L:(A)loop) (x:A)`) + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_quotient th]) + THEN USE_THEN "F3" (fun th-> (USE_THEN "F4" (fun th1 -> REWRITE_TAC[MATCH_MP lemma_in_quotient (CONJ th th1)]))) + THEN DISCH_THEN (LABEL_TAC "F2") + THEN USE_THEN "F3" (fun th-> USE_THEN "F4" (fun th1 -> MP_TAC (MATCH_MP lemma_in_support2 (CONJ th1 th)))) + THEN USE_THEN "F1"(fun th->DISCH_THEN(fun th1->USE_THEN "F6"(fun th2->MP_TAC (MATCH_MP lemma_in_QuotientNode (CONJ th (CONJ th1 th2)))))) + THEN USE_THEN "F1"(fun th->USE_THEN "F3"(fun th1->USE_THEN "F4"(fun th2 ->REWRITE_TAC[MATCH_MP unique_choice (CONJ th (CONJ th1 th2))]))) + THEN USE_THEN "F1"(fun th->USE_THEN "F3"(fun th1->USE_THEN "F5"(fun th2 ->REWRITE_TAC[MATCH_MP unique_choice (CONJ th (CONJ th1 th2))]))) + THEN DISCH_THEN (LABEL_TAC "F7") + THEN USE_THEN "F5" MP_TAC THEN USE_THEN "F4" MP_TAC THEN REWRITE_TAC[IMP_IMP] + THEN USE_THEN "F1"(fun th->USE_THEN "F3"(fun th1->DISCH_THEN(fun th2->MP_TAC (MATCH_MP lemma_in_QuotientFace (CONJ th (CONJ th1 th2)))))) + THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM IN_INTER] + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[IN_SING; EQ_SYM]; ALL_TAC] + THEN DISCH_THEN (LABEL_TAC "F2") + THEN REWRITE_TAC[simple_hypermap] + THEN GEN_TAC + THEN DISCH_TAC + THEN MATCH_MP_TAC SUBSET_ANTISYM + THEN STRIP_TAC + THENL[POP_ASSUM MP_TAC + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_quotient th]) + THEN REWRITE_TAC[quotient_darts; IN_ELIM_THM] + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (X_CHOOSE_THEN `x:A` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")) SUBST1_TAC))) + THEN REWRITE_TAC[SUBSET; IN_SING] + THEN GEN_TAC + THEN REWRITE_TAC[IN_INTER] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F5") MP_TAC) + THEN USE_THEN "F1"(fun th->USE_THEN "F3"(fun th1->USE_THEN "F4"(fun th2 ->REWRITE_TAC[MATCH_MP lemmaQF (CONJ th (CONJ th1 th2))]))) + THEN REWRITE_TAC[cycle; IN_ELIM_THM] + THEN DISCH_THEN (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (LABEL_TAC "F6") SUBST_ALL_TAC)) + THEN SUBGOAL_THEN `(y:A) IN node (H:(A)hypermap) (x:A)` (LABEL_TAC "F7") + THENL[MATCH_MP_TAC lemma_in_node3 + THEN EXISTS_TAC `NF:(A)loop->bool` + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F3" (fun th-> USE_THEN "F4" (fun th1-> REWRITE_TAC[MATCH_MP lemma_in_support2 (CONJ th1 th)])) + THEN USE_THEN "F1"(fun th->USE_THEN "F3"(fun th1->USE_THEN "F4"(fun th2 ->REWRITE_TAC[MATCH_MP unique_choice (CONJ th (CONJ th1 th2))]))) + THEN USE_THEN "F1"(fun th->USE_THEN "F3"(fun th1->USE_THEN "F6"(fun th2 ->REWRITE_TAC[MATCH_MP unique_choice (CONJ th (CONJ th1 th2))]))) + THEN USE_THEN "F5" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN REMOVE_THEN "F2" (MP_TAC o SPECL[`L:(A)loop`; `x:A`; `y:A`]) + THEN ASM_REWRITE_TAC[EQ_SYM]; ALL_TAC] + THEN REWRITE_TAC[SUBSET; IN_ELIM_THM; IN_SING] + THEN GEN_TAC + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[IN_INTER; node_refl; face_refl] + );; + +let lemmaNodalFixedPoint = prove(`!(H:(A)hypermap) (NF:(A)loop->bool). (is_normal H NF /\ simple_hypermap (quotient H NF) + ==> (~(is_node_nondegenerate (quotient H NF)) <=> (?(L:(A)loop) x:A. L IN NF /\ x belong L /\ node H x SUBSET (dart_of L))))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN REWRITE_TAC[is_node_nondegenerate; NOT_FORALL_THM; NOT_IMP] + THEN EQ_TAC + THENL[USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_quotient th]) + THEN DISCH_THEN (X_CHOOSE_THEN `atm:A->bool` (CONJUNCTS_THEN2 MP_TAC (LABEL_TAC "F3"))) + THEN REWRITE_TAC[quotient_darts; IN_ELIM_THM] + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (X_CHOOSE_THEN `x:A`(CONJUNCTS_THEN2(CONJUNCTS_THEN2 (LABEL_TAC "F4")(LABEL_TAC "F5")) SUBST_ALL_TAC))) + THEN EXISTS_TAC `L:(A)loop` THEN EXISTS_TAC `x:A` + THEN ASM_REWRITE_TAC[] + THEN REMOVE_THEN "F3" MP_TAC + THEN REWRITE_TAC[ISPEC `nmap (H:(A)hypermap) (NF:(A)loop->bool)` orbit_one_point] + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[GSYM(MATCH_MP lemma_quotient th)]) + THEN REWRITE_TAC[GSYM node] + THEN DISCH_THEN (LABEL_TAC "F6") + THEN USE_THEN "F5" (fun th-> USE_THEN "F4" (fun th1 -> (MP_TAC (MATCH_MP lemma_in_support2 (CONJ th th1))))) + THEN USE_THEN "F1" (fun th->DISCH_THEN(fun th1-> (MP_TAC(MATCH_MP lemma_support_QN (CONJ th th1))))) + THEN REWRITE_TAC[support_node] + THEN USE_THEN "F1"(fun th->USE_THEN "F4"(fun th1->USE_THEN "F5"(fun th2 ->REWRITE_TAC[MATCH_MP unique_choice (CONJ th (CONJ th1 th2))]))) + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[UNIONS_1] + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP lemma_atom_sub_loop th]); ALL_TAC] + THEN DISCH_THEN (X_CHOOSE_THEN `L:(A)loop` (X_CHOOSE_THEN `x:A` (CONJUNCTS_THEN2 (LABEL_TAC "F4")(CONJUNCTS_THEN2(LABEL_TAC "F5")(LABEL_TAC "F6"))))) + THEN USE_THEN "F5" (fun th-> USE_THEN "F4" (fun th1 -> (LABEL_TAC "F7" (MATCH_MP lemma_in_support2 (CONJ th th1))))) + THEN SUBGOAL_THEN `atom (H:(A)hypermap) (L:(A)loop) (x:A) = node H x` (LABEL_TAC "F8") + THENL[MATCH_MP_TAC SUBSET_ANTISYM + THEN REWRITE_TAC[lemma_atom_sub_node] + THEN REWRITE_TAC[SUBSET] THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "G1") + THEN USE_THEN "F6" (fun th-> USE_THEN "G1" (fun th1-> MP_TAC (MATCH_MP lemma_in_subset (CONJ th th1)))) + THEN REWRITE_TAC[GSYM belong] + THEN DISCH_THEN (LABEL_TAC "G2") + THEN USE_THEN "G2" (fun th-> USE_THEN "F4" (fun th1 -> (LABEL_TAC "G3" (MATCH_MP lemma_in_support2 (CONJ th th1))))) + THEN USE_THEN "F1"(fun th->USE_THEN "F7"(fun th1->USE_THEN "G1"(fun th2->MP_TAC (MATCH_MP lemma_in_QuotientNode (CONJ th (CONJ th1 th2)))))) + THEN USE_THEN "F1"(fun th->USE_THEN "F4"(fun th1->USE_THEN "F5"(fun th2 ->REWRITE_TAC[MATCH_MP unique_choice (CONJ th (CONJ th1 th2))]))) + THEN USE_THEN "F1"(fun th->USE_THEN "F4"(fun th1->USE_THEN "G2"(fun th2 ->REWRITE_TAC[MATCH_MP unique_choice (CONJ th (CONJ th1 th2))]))) + THEN DISCH_THEN (LABEL_TAC "G4") + THEN USE_THEN "G2" MP_TAC + THEN USE_THEN "F5" MP_TAC + THEN REWRITE_TAC[IMP_IMP] + THEN USE_THEN "F1"(fun th->USE_THEN "F4"(fun th1->DISCH_THEN(fun th2->MP_TAC (MATCH_MP lemma_in_QuotientFace (CONJ th (CONJ th1 th2)))))) + THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM IN_INTER] + THEN USE_THEN "F2" (MP_TAC o SPEC `atom (H:(A)hypermap) (L:(A)loop) (x:A)` o REWRITE_RULE[simple_hypermap]) + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_quotient th]) + THEN USE_THEN "F4"(fun th->USE_THEN "F5"(fun th1->REWRITE_TAC[MATCH_MP lemma_in_quotient (CONJ th th1)])) + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[IN_SING] + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN REWRITE_TAC[atom_reflect]; ALL_TAC] + THEN EXISTS_TAC `atom (H:(A)hypermap) (L:(A)loop) (x:A)` + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_quotient th]) + THEN USE_THEN "F4" (fun th-> USE_THEN "F5" (fun th1 -> REWRITE_TAC[MATCH_MP lemma_in_quotient (CONJ th th1)])) + THEN POP_ASSUM MP_TAC + THEN USE_THEN "F1"(fun th->USE_THEN "F4"(fun th1->USE_THEN "F5"(fun th2 ->REWRITE_TAC[SYM(MATCH_MP unique_choice (CONJ th (CONJ th1 th2)))]))) + THEN DISCH_THEN (LABEL_TAC "F9") + THEN USE_THEN "F1" (fun th-> USE_THEN "F7" (fun th1 -> REWRITE_TAC[CONJUNCT2(CONJUNCT2(MATCH_MP nmap_via_choice (CONJ th th1)))])) + THEN USE_THEN "F1" (MP_TAC o SPEC `tail (H:(A)hypermap) (NF:(A)loop->bool) (x:A)` o MATCH_MP choice_reflect) + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[SYM(CONJUNCT1(SPEC `x:A` (MATCH_MP choice_at_margin th)))]) + THEN USE_THEN "F9" (fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN REWRITE_TAC[node; orbit_map; GE; LE_0; IN_ELIM_THM] + THEN DISCH_THEN (X_CHOOSE_THEN `n:num` (MP_TAC o REWRITE_RULE[GSYM COM_POWER] o AP_TERM `node_map (H:(A)hypermap)`)) + THEN MP_TAC (AP_THM (SPECL[`n:num`; `node_map (H:(A)hypermap)`] COM_POWER) `x:A`) + THEN REWRITE_TAC[o_THM] + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN DISCH_TAC + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`; `SUC n`]lemma_in_node2) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN USE_THEN "F1" (fun th-> DISCH_THEN (fun th1-> REWRITE_TAC[MATCH_MP choice_identity (CONJ th th1)])));; + +(* Complementary contours and complementary contour loops - name: complement. Only for face contours *) + +let ind = new_recursive_definition num_RECURSION + `(!H:(A)hypermap x:A. ind H x 0 = 0) + /\ (!H:(A)hypermap x:A n:num. ind H x (SUC n) = (ind H x n) + PRE(CARD (node H ((inverse (face_map H) POWER (SUC n)) x))))`;; + +let mirror = new_recursive_definition num_RECURSION `(!H:(A)hypermap x:A. mirror H x 0 = node_contour H (node_map H x)) /\(!H:(A)hypermap x:A n:num. mirror H x (SUC n) = join (mirror H x n) (node_contour H (inverse (node_map H) ((inverse (face_map H) POWER (SUC n)) x))) (ind H x n))`;; + +let complement = new_definition `!H:(A)hypermap x:A n:num. complement H x n = mirror H x n n`;; + +let lemma_node_nondegenerate = prove(`!H:(A)hypermap. is_node_nondegenerate H <=> (!x:A. x IN dart H ==> 2 <= CARD (node H x))`, + GEN_TAC THEN EQ_TAC + THENL[DISCH_THEN (LABEL_TAC "F1") + THEN GEN_TAC THEN STRIP_TAC + THEN MATCH_MP_TAC CARD_ATLEAST_2 + THEN EXISTS_TAC `node_map (H:(A)hypermap) (x:A)` THEN EXISTS_TAC `x:A` THEN REWRITE_TAC[NODE_FINITE; node_refl] + THEN REWRITE_TAC[REWRITE_RULE[POWER_1] (SPECL[`H:(A)hypermap`; `x:A`; `1`] lemma_in_node2)] + THEN REMOVE_THEN "F1" (MP_TAC o SPEC `x:A` o REWRITE_RULE[is_node_nondegenerate]) + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN DISCH_THEN (LABEL_TAC "F1") THEN REWRITE_TAC[is_node_nondegenerate] + THEN REPEAT STRIP_TAC THEN REMOVE_THEN "F1" (MP_TAC o SPEC `x:A`) + THEN POP_ASSUM (MP_TAC o ONCE_REWRITE_RULE[SPEC `node_map (H:(A)hypermap)` orbit_one_point]) + THEN REWRITE_TAC[GSYM node] + THEN DISCH_THEN SUBST1_TAC + THEN ASM_REWRITE_TAC[CARD_SINGLETON] THEN ARITH_TAC);; + +let lemma_in_node1 = prove(`!H:(A)hypermap x:A y:A. y IN node H x ==> node_map H y IN node H x`, + REPEAT GEN_TAC + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_node_identity th]) + THEN MESON_TAC[lemma_in_node2; POWER_1]);; + +let lemma_increasing_index_one = prove(`!H:(A)hypermap x:A n:num. is_node_nondegenerate H /\ x IN dart H ==> ind H x n < ind H x (SUC n)`, + REPLICATE_TAC 2 GEN_TAC + THEN INDUCT_TAC + THENL[REWRITE_TAC[ind; ONE; POWER; o_THM; I_THM; ADD ] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (MP_TAC o CONJUNCT2 o CONJUNCT2 o MATCH_MP lemma_dart_inveriant_under_inverse_maps)) + THEN DISCH_THEN (fun th-> POP_ASSUM (fun th1 -> MP_TAC (MATCH_MP (REWRITE_RULE[lemma_node_nondegenerate] th1) th))) + THEN ARITH_TAC; ALL_TAC] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) + THEN ASM_REWRITE_TAC[] + THEN DISCH_THEN (LABEL_TAC "F3") + THEN REWRITE_TAC[ind; LT_ADD] + THEN MP_TAC (SPEC `SUC(SUC n)` (MATCH_MP power_inverse_element_lemma (SPEC `H:(A)hypermap` face_map_and_darts))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` SUBST1_TAC) + THEN REMOVE_THEN "F2" (MP_TAC o SPEC `j:num` o MATCH_MP lemma_dart_invariant_power_face) + THEN ABBREV_TAC `y:A = (face_map (H:(A)hypermap) POWER j) x` THEN DISCH_TAC + THEN REMOVE_THEN "F1" (MP_TAC o SPEC `y:A` o REWRITE_RULE[lemma_node_nondegenerate]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN ARITH_TAC);; + +let lemma_increasing_index = prove(`!H:(A)hypermap x:A n:num m:num. is_node_nondegenerate H /\ x IN dart H /\ n < m ==> ind H x n < ind H x m`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") MP_TAC)) + THEN SPEC_TAC (`m:num`, `m:num`) + THEN INDUCT_TAC THENL[REWRITE_TAC[LT]; ALL_TAC] + THEN ASM_CASES_TAC `n:num = m:num` + THENL[POP_ASSUM SUBST1_TAC + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1-> REWRITE_TAC[MATCH_MP lemma_increasing_index_one (CONJ th th1)])); ALL_TAC] + THEN DISCH_THEN(fun th-> POP_ASSUM(fun th1-> ASSUME_TAC(REWRITE_RULE[GSYM LT_LE] (CONJ (REWRITE_RULE[LT_SUC_LE] th) th1)))) + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1-> MP_TAC(SPEC `m:num` (MATCH_MP lemma_increasing_index_one (CONJ th th1))))) + THEN POP_ASSUM (fun th-> POP_ASSUM (fun thm -> MP_TAC (MATCH_MP thm th))) + THEN REWRITE_TAC[IMP_IMP; LT_TRANS]);; + +let lemma_lower_bound_index = prove(`!H:(A)hypermap x:A n:num. is_node_nondegenerate H /\ x IN dart H ==> n <= ind H x n`, + REPLICATE_TAC 2 GEN_TAC + THEN INDUCT_TAC + THENL[REWRITE_TAC[LE_0]; ALL_TAC] + THEN POP_ASSUM (fun thm-> (DISCH_THEN (fun th-> MP_TAC (MATCH_MP thm th) THEN ASSUME_TAC th))) + THEN POP_ASSUM (MP_TAC o SPEC `n:num` o MATCH_MP lemma_increasing_index_one) THEN ARITH_TAC);; + +let lemma_segment_complement = prove(`!H:(A)hypermap x:A n:num i:num. is_node_nondegenerate H /\ x IN dart H /\ i <= n + ==> (!j:num. j <= ind H x i ==> mirror H x i j = mirror H x n j)`, + REPEAT GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") MP_TAC)) + THEN SPEC_TAC (`i:num`, `i:num`) + THEN SPEC_TAC (`n:num`, `n:num`) + THEN MATCH_MP_TAC num_WF + THEN INDUCT_TAC + THENL[REWRITE_TAC[LT] + THEN GEN_TAC THEN REWRITE_TAC[LE] THEN DISCH_THEN SUBST1_TAC THEN GEN_TAC THEN REWRITE_TAC[ind; LE] THEN DISCH_THEN SUBST1_TAC; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F3") + THEN DISCH_THEN (LABEL_TAC "F4") + THEN GEN_TAC + THEN DISCH_TAC + THEN ASM_CASES_TAC `i:num = SUC n` + THENL[POP_ASSUM SUBST1_TAC THEN SIMP_TAC[]; ALL_TAC] + THEN POP_ASSUM (fun th -> (POP_ASSUM (fun th1 -> LABEL_TAC "F5" (REWRITE_RULE[GSYM LT_LE] (CONJ th1 th))))) + THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F6") + THEN REWRITE_TAC[mirror; join] + THEN USE_THEN "F5" (LABEL_TAC "F7" o REWRITE_RULE[LT_SUC_LE]) + THEN SUBGOAL_THEN `j:num <= ind (H:(A)hypermap) (x:A) (n:num)` (LABEL_TAC "F8") + THENL[ASM_CASES_TAC `i:num = n` + THENL[POP_ASSUM (SUBST1_TAC o SYM) + THEN USE_THEN "F6" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (fun th-> (POP_ASSUM(fun th1-> (MP_TAC (REWRITE_RULE[GSYM LT_LE] (CONJ th1 th)))))) + THEN USE_THEN "F1"(fun th-> (USE_THEN "F2"(fun th1->DISCH_THEN(fun th2-> MP_TAC(MATCH_MP lemma_increasing_index (CONJ th (CONJ th1 th2))))))) + THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[IMP_IMP] THEN ARITH_TAC; ALL_TAC] + THEN USE_THEN "F8" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "F7" (fun th-> USE_THEN "F4" (MP_TAC o REWRITE_RULE[th] o SPEC `i:num` o REWRITE_RULE[LT_PLUS] o SPEC `n:num`)) + THEN DISCH_THEN(fun thm-> USE_THEN "F6"(MP_TAC o MATCH_MP thm)) THEN SIMP_TAC[]);; + +let lemma_indepentdent_complement = prove(`!H:(A)hypermap x:A n:num m:num. is_node_nondegenerate H /\ x IN dart H /\ n <= m + ==> complement H x n = mirror H x m n`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (MP_TAC o REWRITE_RULE[LE_EXISTS]))) + THEN DISCH_THEN (X_CHOOSE_THEN `i:num` SUBST1_TAC) + THEN SPEC_TAC (`i:num`, `i:num`) + THEN INDUCT_TAC THENL[REWRITE_TAC[ADD_0; complement]; ALL_TAC] + THEN REWRITE_TAC[ADD_SUC] + THEN REWRITE_TAC[mirror; join] + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1-> MP_TAC (SPEC `(n:num) + i` (MATCH_MP lemma_lower_bound_index (CONJ th th1))))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[COND_ELIM_THM; MATCH_MP (ARITH_RULE `!n:num i m. n + i <= m ==> n <= m`) th]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]));; + +let lemma_evaluation_complement = prove(`!H:(A)hypermap x:A n:num i:num. is_node_nondegenerate H /\ x IN dart H /\ n <= ind H x i + ==> complement H x n = mirror H x i n`, + REPEAT GEN_TAC + THEN DISCH_THEN(CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") MP_TAC)) + THEN DISCH_THEN (LABEL_TAC "F3") + THEN ASM_CASES_TAC `n:num <= i:num` + THENL[POP_ASSUM(fun th2->USE_THEN "F1"(fun th->USE_THEN "F2"(fun th1->REWRITE_TAC[MATCH_MP lemma_indepentdent_complement (CONJ th (CONJ th1 th2))]))) + ;ALL_TAC] + THEN REWRITE_TAC[complement] THEN CONV_TAC SYM_CONV + THEN POP_ASSUM (ASSUME_TAC o MATCH_MP LT_IMP_LE o REWRITE_RULE[NOT_LE]) + THEN REMOVE_THEN "F3" MP_TAC + THEN POP_ASSUM (fun th2->USE_THEN "F1"(fun th->USE_THEN "F2"(fun th1->REWRITE_TAC[MATCH_MP lemma_segment_complement (CONJ th (CONJ th1 th2))]))));; + +let lemma_inc_monotone = prove(`!id:num->num.(!i:num. id i < id (SUC i)) ==> (!i:num j:num. i < j <=> id i < id j)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN SUBGOAL_THEN `!i:num j:num. i < j ==> (id:num->num) i < id j` (LABEL_TAC "F2") + THENL[REPEAT GEN_TAC THEN DISCH_THEN ((X_CHOOSE_THEN `k:num` SUBST1_TAC) o REWRITE_RULE[LT_EXISTS]) + THEN SPEC_TAC(`k:num`, `k:num`) + THEN INDUCT_TAC + THENL[USE_THEN "F1" (fun th -> REWRITE_TAC[GSYM ONE; GSYM ADD1; th]); ALL_TAC] + THEN REMOVE_THEN "F1" (MP_TAC o SPEC `((i:num) + (SUC k))`) + THEN REWRITE_TAC[GSYM ADD_SUC] + THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[IMP_IMP] THEN REWRITE_TAC[LT_TRANS]; ALL_TAC] + THEN REPEAT GEN_TAC + THEN EQ_TAC + THENL[POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN ASM_CASES_TAC `i:num = j:num` + THENL[POP_ASSUM SUBST1_TAC THEN ARITH_TAC; ALL_TAC] + THEN ASM_CASES_TAC `j:num < i:num` + THENL[REMOVE_THEN "F2" (fun thm -> POP_ASSUM (MP_TAC o MATCH_MP thm)) + THEN REWRITE_TAC[IMP_IMP] + THEN REWRITE_TAC[ARITH_RULE `!a:num b. a < b /\ b < a <=> F`]; ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[NOT_LT]) + THEN DISCH_THEN (fun th-> POP_ASSUM (fun th1 -> REWRITE_TAC[REWRITE_RULE[GSYM LT_LE] (CONJ th th1)])));; + +let lemma_inc_injective = prove(`!id:num->num.(!i:num. id i < id (SUC i)) ==> (!i:num j:num. i = j <=> id i = id j)`, + REPEAT GEN_TAC THEN (DISCH_THEN (LABEL_TAC "F1")) + THEN MATCH_MP_TAC WLOG_LT THEN REWRITE_TAC[EQ_REFL] + THEN STRIP_TAC THENL[MESON_TAC[]; ALL_TAC] + THEN REPEAT GEN_TAC + THEN DISCH_THEN (fun th-> REWRITE_TAC[REWRITE_RULE[LT_LE] th] THEN ASSUME_TAC th) + THEN REMOVE_THEN "F1" (fun th-> (MP_TAC (SPECL[`i:num`; `n:num`] (MATCH_MP lemma_inc_monotone th)))) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th; LT_LE]) THEN SIMP_TAC[]);; + +let lemma_inc_not_decreasing = prove(`!id:num->num.(!i:num. id i < id (SUC i)) ==> (!i:num j:num. i <= j <=> id i <= id j)`, + MESON_TAC[lemma_inc_injective; lemma_inc_monotone; LE_LT]);; + +let lemma_num_partition = prove(`!id:num->num. id 0 = 0 /\ (!i:num. id i < id (SUC i)) + ==> (!n:num. (?i:num. n = id i) \/ (?j:num. id j < n /\ n < id (SUC j)))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN GEN_TAC + THEN SUBGOAL_THEN `!i:num. i <= (id:num->num) i` (LABEL_TAC "F3") + THENL[INDUCT_TAC THENL[REWRITE_TAC[LE_0]; ALL_TAC] + THEN USE_THEN "F2" (MP_TAC o SPEC `i:num`) THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[IMP_IMP] THEN DISCH_THEN (MP_TAC o MATCH_MP LET_TRANS) THEN ARITH_TAC; ALL_TAC] + THEN SUBGOAL_THEN `!i:num j:num. i < j ==> (id:num->num) i < id j` (LABEL_TAC "GG") + THENL[REPEAT GEN_TAC THEN GEN_REWRITE_TAC (LAND_CONV) [LT_EXISTS] + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` SUBST1_TAC) + THEN SPEC_TAC (`d:num`, `d:num`) + THEN INDUCT_TAC + THENL[USE_THEN "F2" (fun th-> REWRITE_TAC[GSYM ONE; GSYM ADD1; th]); ALL_TAC] + THEN USE_THEN "F2" (MP_TAC o SPEC `(i:num) + (SUC d)`) + THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[ADD_SUC; IMP_IMP] THEN ARITH_TAC; ALL_TAC] + THEN ASM_CASES_TAC `n:num = 0` + THENL[DISJ1_TAC THEN EXISTS_TAC `0` THEN POP_ASSUM SUBST1_TAC THEN USE_THEN "F1" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F4" o REWRITE_RULE[GSYM LT_NZ]) + THEN SUBGOAL_THEN `(?x:num. (id:num->num) x < n) /\ (?M:num. !x:num. id x < n ==> x <= M)` MP_TAC + THENL[STRIP_TAC + THENL[EXISTS_TAC `0` THEN USE_THEN "F1" SUBST1_TAC + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN EXISTS_TAC `n:num` + THEN GEN_TAC + THEN USE_THEN "F3" (MP_TAC o SPEC `x:num`) THEN REWRITE_TAC[IMP_IMP] THEN ARITH_TAC; ALL_TAC] + THEN GEN_REWRITE_TAC (LAND_CONV) [num_MAX] + THEN DISCH_THEN (X_CHOOSE_THEN `m:num` (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6"))) + THEN SUBGOAL_THEN `(?x:num. n <= (id:num->num) x)` MP_TAC + THENL[EXISTS_TAC `n:num` THEN USE_THEN "F3" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN GEN_REWRITE_TAC (LAND_CONV) [num_WOP] + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` (CONJUNCTS_THEN2 (LABEL_TAC "F7") (LABEL_TAC "F8"))) + THEN SUBGOAL_THEN `m:num < k:num` (LABEL_TAC "F9") + THENL[USE_THEN "F7" MP_TAC THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] + THEN REWRITE_TAC[NOT_LT; NOT_LE] + THEN GEN_REWRITE_TAC (LAND_CONV)[LE_LT] + THEN STRIP_TAC + THENL[USE_THEN "GG" (fun thm -> POP_ASSUM (MP_TAC o MATCH_MP thm)) + THEN USE_THEN "F7" MP_TAC THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (MP_TAC o MATCH_MP LET_TRANS) + THEN USE_THEN "F5" MP_TAC THEN ARITH_TAC; ALL_TAC] + THEN POP_ASSUM SUBST_ALL_TAC + THEN USE_THEN "F5" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN ASM_CASES_TAC `n:num = (id:num->num) k` + THENL[DISJ1_TAC THEN EXISTS_TAC `k:num` THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN REMOVE_THEN "F7" (fun th-> (POP_ASSUM (fun th1 -> (LABEL_TAC "F7" (REWRITE_RULE[GSYM LT_LE] (CONJ th th1)))))) + THEN DISJ2_TAC + THEN EXISTS_TAC `m:num` THEN USE_THEN "F5" (fun th-> REWRITE_TAC[th]) + THEN REMOVE_THEN "F9" (MP_TAC o REWRITE_RULE[LT_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` (SUBST_ALL_TAC)) + THEN ASM_CASES_TAC `1 <= d:num` + THENL[POP_ASSUM (MP_TAC o REWRITE_RULE[LE_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `u:num` (SUBST_ALL_TAC)) + THEN REMOVE_THEN "F8" (MP_TAC o SPEC `(m:num) + 1` o ONCE_REWRITE_RULE[GSYM ADD_SUC]) + THEN REWRITE_TAC[ARITH_RULE `!a:num b:num. a + 1 < a + 1 + (SUC b)`] + THEN DISCH_THEN (ASSUME_TAC o REWRITE_RULE[NOT_LE; GSYM ADD1]) + THEN REMOVE_THEN "F6" (MP_TAC o SPEC `SUC m`) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN ARITH_TAC; ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[NOT_LE; ARITH_RULE `d:num < 1 <=> d = 0`]) + THEN DISCH_THEN (fun th-> POP_ASSUM (MP_TAC o REWRITE_RULE[th; GSYM ONE; GSYM ADD1])) + THEN SIMP_TAC[]);; + +let index_representation = prove(`!m:num u:num n:num. m < n /\ n < u ==> ?j:num. 1 <= j /\ j < u - m /\ n = m + j`, + REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN REMOVE_THEN "F1" (MP_TAC o REWRITE_RULE[LT_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` SUBST_ALL_TAC) + THEN EXISTS_TAC `SUC d` THEN REWRITE_TAC[EQ_REFL; GE_1] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[LT_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `i:num` (SUBST1_TAC)) + THEN GEN_REWRITE_TAC (RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [GSYM ADD_ASSOC] + THEN REWRITE_TAC[ADD_SUB2] THEN ARITH_TAC);; + +let lemma_num_partition2 = prove(`!id:num->num. id 0 = 0 /\ (!i:num. id i < id (SUC i)) + ==> (!n:num. n = 0 \/ (?i:num j:num. 1 <= j /\ j <= (id (SUC i)) - (id i) /\ n = (id i) + j))`, + GEN_TAC THEN (DISCH_THEN (LABEL_TAC "F1")) + THEN GEN_TAC + THEN ASM_CASES_TAC `n:num = 0` THENL[POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th) + THEN USE_THEN "F1" (MP_TAC o SPEC `n:num` o MATCH_MP lemma_num_partition) + THEN STRIP_TAC + THENL[POP_ASSUM MP_TAC + THEN ASM_CASES_TAC `i:num = 0` + THENL[POP_ASSUM SUBST1_TAC + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[CONJUNCT1 th]) + THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[IMP_IMP; TAUT `~A /\ A <=> F`]; ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[GSYM LT_NZ; LT_EXISTS; ADD]) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` SUBST1_TAC) + THEN DISCH_THEN SUBST1_TAC + THEN EXISTS_TAC `d:num` + THEN EXISTS_TAC `((id:num->num) (SUC d)) - (id d)` + THEN REWRITE_TAC[LE_REFL] + THEN USE_THEN "F1" (MP_TAC o REWRITE_RULE[LT_EXISTS] o SPEC `d:num` o CONJUNCT2) + THEN DISCH_THEN (X_CHOOSE_THEN `m:num` SUBST1_TAC) + THEN REWRITE_TAC[ADD_SUB2; GE_1]; ALL_TAC] + THEN POP_ASSUM MP_TAC THEN (POP_ASSUM (MP_TAC o REWRITE_RULE[LT_EXISTS])) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` (SUBST1_TAC)) + THEN DISCH_THEN (MP_TAC o REWRITE_RULE[LT_EXISTS]) + THEN DISCH_THEN(X_CHOOSE_THEN `m:num` (ASSUME_TAC o REWRITE_RULE[GSYM ADD_ASSOC])) + THEN EXISTS_TAC `j:num` THEN EXISTS_TAC `SUC d` + THEN REWRITE_TAC[EQ_REFL; GE_1] + THEN POP_ASSUM SUBST1_TAC THEN REWRITE_TAC[GSYM ADD_ASSOC; ADD_SUB2] THEN ARITH_TAC);; + +let lemma_complement_path = prove(`!(H:(A)hypermap) (x:A). plain_hypermap H /\ is_node_nondegenerate H /\ x IN dart H ==> +(!i:num. complement H x (ind H x i) = node_map H ((inverse (face_map H) POWER i) x)) +/\ (!i:num. complement H x (SUC (ind H x i)) = inverse (node_map H) ((inverse (face_map H) POWER (SUC i)) x)) +/\ (!i:num. face_map H (complement H x (ind H x i)) = complement H x (SUC (ind H x i))) +/\ (!i:num j:num. 1 <= j /\ j < CARD (node H ((inverse (face_map H) POWER (SUC i)) x)) ==> complement H x ((ind H x i) + j) = (inverse (node_map H) POWER j) ((inverse (face_map H) POWER (SUC i)) x)) +/\ (!n:num. is_contour H (complement H x) n)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN SUBGOAL_THEN `!i:num. complement (H:(A)hypermap) (x:A) (ind H x i) = node_map H ((inverse (face_map H) POWER i) x)` (LABEL_TAC "F4") + THENL[INDUCT_TAC THENL[REWRITE_TAC[POWER; ind; I_THM; complement; mirror; node_contour]; ALL_TAC] + THEN USE_THEN "F2"(fun th->USE_THEN "F3"(fun th1-> REWRITE_TAC[MATCH_MP lemma_evaluation_complement (CONJ th (CONJ th1 (SPEC `ind (H:(A)hypermap) (x:A) (SUC i)` LE_REFL)))])) + THEN REWRITE_TAC[mirror; join] + THEN USE_THEN "F2" (fun th-> USE_THEN "F3" (fun th1 -> (LABEL_TAC "G1" (SPEC `i:num` (MATCH_MP lemma_increasing_index_one (CONJ th th1)))))) + THEN USE_THEN "G1" (fun th -> REWRITE_TAC[REWRITE_RULE[GSYM NOT_LE] th]) + THEN REWRITE_TAC[node_contour; ind; ADD_SUB2] + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN ONCE_REWRITE_TAC[COM_POWER_FUNCTION] + THEN ABBREV_TAC `y = (inverse (face_map (H:(A)hypermap)) POWER (SUC i)) x` + THEN CONV_TAC SYM_CONV + THEN REWRITE_TAC[GSYM(MATCH_MP inverse_power_function (CONJUNCT2(SPEC `H:(A)hypermap` node_map_and_darts)))] + THEN REWRITE_TAC[POWER_FUNCTION] + THEN CONV_TAC SYM_CONV + THEN REWRITE_TAC[GSYM node_map_inverse_representation; COM_POWER_FUNCTION] + THEN POP_ASSUM (LABEL_TAC "G2") + THEN MP_TAC (SPEC `SUC i` (MATCH_MP power_inverse_element_lemma (SPEC `H:(A)hypermap` face_map_and_darts))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (fun th -> (ASSUME_TAC (AP_THM th `x:A`)))) + THEN USE_THEN "F3" (MP_TAC o SPEC `j:num` o MATCH_MP lemma_dart_invariant_power_face) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN USE_THEN "G2" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F2" (fun th-> (DISCH_THEN(MP_TAC o MATCH_MP (REWRITE_RULE[lemma_node_nondegenerate] th)))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP SUC_PRE_2 th]) + THEN REWRITE_TAC[lemma_node_cycle]; ALL_TAC] + THEN STRIP_TAC + THENL[POP_ASSUM (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `!i:num. complement (H:(A)hypermap) (x:A) (SUC(ind H x i))=inverse(node_map H)((inverse (face_map H) POWER (SUC i)) x)` (LABEL_TAC "F5") + THENL[GEN_TAC + THEN USE_THEN "F2"(fun th->USE_THEN "F3"(fun th1-> MP_TAC(SPEC `i:num` (MATCH_MP lemma_increasing_index_one (CONJ th th1))))) + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [GSYM LE_SUC_LT] + THEN USE_THEN "F2"(fun th->USE_THEN "F3"(fun th1->DISCH_THEN (fun th2->REWRITE_TAC[MATCH_MP lemma_evaluation_complement (CONJ th (CONJ th1 th2))]))) + THEN REWRITE_TAC[mirror; join; REWRITE_RULE[GSYM NOT_LE] (SPEC `i:num` LT_PLUS)] + THEN GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o DEPTH_CONV) [ADD1; ADD_SUB2] + THEN GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o DEPTH_CONV) [ONE; PRE] + THEN REWRITE_TAC[node_contour; POWER_0; I_THM]; ALL_TAC] + THEN STRIP_TAC THENL[POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `!i:num. face_map (H:(A)hypermap) (complement H (x:A) (ind H x i)) = complement H x (SUC (ind H x i))` (LABEL_TAC "F6") + THENL[REPLICATE_TAC 2 (POP_ASSUM (fun th-> REWRITE_TAC[th])) + THEN GEN_TAC + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN ABBREV_TAC `y = (node_map (H:(A)hypermap)) ((inverse (face_map H) POWER (i:num)) (x:A))` + THEN POP_ASSUM (fun th-> REWRITE_TAC[REWRITE_RULE[node_map_inverse_representation] (SYM th)]) + THEN REWRITE_TAC[GSYM (ISPECL[`inverse (face_map (H:(A)hypermap))`; `inverse(node_map (H:(A)hypermap))`; `y:A`] o_THM)] + THEN REWRITE_TAC[GSYM inverse2_hypermap_maps] + THEN CONV_TAC SYM_CONV + THEN REWRITE_TAC[face_map_inverse_representation] + THEN REWRITE_TAC[GSYM (ISPECL[`inverse (face_map (H:(A)hypermap))`; `inverse(node_map (H:(A)hypermap))`] o_THM)] + THEN REWRITE_TAC[GSYM inverse2_hypermap_maps] + THEN REWRITE_TAC[GSYM (ISPECL[`edge_map (H:(A)hypermap)`; `edge_map (H:(A)hypermap)`] o_THM)] + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[REWRITE_RULE[plain_hypermap] th; I_THM]); ALL_TAC] + THEN STRIP_TAC THENL[POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `(!i:num j:num. 1 <= j /\ j < CARD (node (H:(A)hypermap) ((inverse (face_map H) POWER (SUC i)) (x:A))) ==> complement H x ((ind H x i) + j) = (inverse (node_map H) POWER j) ((inverse (face_map H) POWER (SUC i)) x))` (LABEL_TAC "F7") + THENL[REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G3") (LABEL_TAC "G4")) + THEN SUBGOAL_THEN `(ind (H:(A)hypermap) (x:A) (i:num)) + (j:num) <= ind H x (SUC i)` MP_TAC + THENL[REWRITE_TAC[ind; LE_ADD_LCANCEL] THEN POP_ASSUM MP_TAC THEN ARITH_TAC; ALL_TAC] + THEN USE_THEN "F2"(fun th->USE_THEN "F3"(fun th1->DISCH_THEN(fun th2-> REWRITE_TAC[MATCH_MP lemma_evaluation_complement (CONJ th (CONJ th1 th2))]))) + THEN REWRITE_TAC[mirror; join] + THEN USE_THEN "G3" (fun th-> (REWRITE_TAC[MATCH_MP (ARITH_RULE `!n:num j:num. 1 <= j ==> ~(n +j <= n)`) th])) + THEN REWRITE_TAC[ADD_SUB2] + THEN REWRITE_TAC[node_contour; POWER_FUNCTION] + THEN USE_THEN "G3" (fun th-> REWRITE_TAC[GSYM(MATCH_MP LT_SUC_PRE (REWRITE_RULE[LT1_NZ] th))]); ALL_TAC] + THEN USE_THEN "F7" (fun th-> REWRITE_TAC[th]) + THEN GEN_TAC + THEN REWRITE_TAC[lemma_def_contour] + THEN REPEAT STRIP_TAC THEN REWRITE_TAC[one_step_contour] + THEN SUBGOAL_THEN `ind (H:(A)hypermap) (x:A) 0 = 0 /\ (!i:num. ind H x i < ind H x (SUC i))` MP_TAC + THENL[USE_THEN "F2" (fun th -> (USE_THEN "F3" (fun th1 -> REWRITE_TAC[MATCH_MP lemma_increasing_index_one (CONJ th th1); ind]))); ALL_TAC] + THEN DISCH_THEN (MP_TAC o SPEC `i:num` o MATCH_MP lemma_num_partition) + THEN STRIP_TAC + THENL[DISJ1_TAC THEN POP_ASSUM SUBST1_TAC + THEN USE_THEN "F6" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN DISJ2_TAC + THEN POP_ASSUM (fun th1 -> POP_ASSUM (fun th-> MP_TAC (MATCH_MP index_representation (CONJ th th1)))) + THEN REWRITE_TAC[ind; ADD_SUB2] + THEN DISCH_THEN (X_CHOOSE_THEN `t:num` (CONJUNCTS_THEN2 (LABEL_TAC "F10") (CONJUNCTS_THEN2 (LABEL_TAC "F11") SUBST1_TAC))) + THEN USE_THEN "F11" (MP_TAC o MATCH_MP (ARITH_RULE `a:num < PRE b ==> a < b`)) + THEN USE_THEN "F10" (fun th -> DISCH_THEN (fun th1 -> USE_THEN "F7"(fun thm -> REWRITE_TAC[MATCH_MP thm (CONJ th th1)]))) + THEN REWRITE_TAC[GSYM ADD_SUC] + THEN POP_ASSUM (MP_TAC o MATCH_MP (ARITH_RULE `a:num < PRE b ==> SUC a < b`)) + THEN POP_ASSUM (MP_TAC o MATCH_MP (ARITH_RULE `1 <= t:num ==> 1 <= SUC t `)) + THEN REWRITE_TAC[IMP_IMP] + THEN USE_THEN "F7" (fun thm -> DISCH_THEN(fun th -> REWRITE_TAC[MATCH_MP thm th])) + THEN ABBREV_TAC `y = (inverse (face_map (H:(A)hypermap)) POWER (SUC j)) (x:A)` + THEN REWRITE_TAC[COM_POWER; o_THM]);; + +let lemma_inj_complement = prove(`!H:(A)hypermap x:A. plain_hypermap H /\ simple_hypermap H /\ is_node_nondegenerate H /\ x IN dart H + ==> is_inj_contour H (complement H x) (PRE (ind H x (CARD (face H x))))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")))) + THEN REWRITE_TAC[lemma_inj_contour_via_list] + THEN USE_THEN "F1"(fun th-> USE_THEN "F3"(fun th1-> USE_THEN "F4"(fun th2-> (LABEL_TAC "GG" (CONJ th (CONJ th1 th2)))))) + THEN USE_THEN "GG" (LABEL_TAC "GH" o MATCH_MP lemma_increasing_index_one o CONJUNCT2) + THEN SUBGOAL_THEN `ind (H:(A)hypermap) (x:A) 0 = 0 /\ (!i:num. ind H x i < ind H x (SUC i))` (LABEL_TAC "F6") + THENL[USE_THEN "F3" (fun th -> (USE_THEN "F4" (fun th1 -> REWRITE_TAC[MATCH_MP lemma_increasing_index_one (CONJ th th1); ind]))); ALL_TAC] + THEN USE_THEN "GG" (fun th -> REWRITE_TAC[MATCH_MP lemma_complement_path th]) + THEN REWRITE_TAC[lemma_inj_list2] + THEN MATCH_MP_TAC WLOG_LT + THEN SIMP_TAC[] THEN STRIP_TAC THENL[MESON_TAC[]; ALL_TAC] + THEN REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F7") + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F8") (CONJUNCTS_THEN2 (LABEL_TAC "F9") (LABEL_TAC "F10"))) + THEN ASM_CASES_TAC `i:num = 0` + THENL[POP_ASSUM SUBST_ALL_TAC + THEN SUBGOAL_THEN `!a:num b:num. 2 <= b ==> PRE (a + (PRE b)) = a + (PRE (PRE b))` (LABEL_TAC "N1") + THENL[REPEAT GEN_TAC + THEN DISCH_THEN ((X_CHOOSE_THEN `d:num` SUBST1_TAC o ONCE_REWRITE_RULE[ADD_SYM]) o REWRITE_RULE[LE_EXISTS]) + THEN REWRITE_TAC[TWO; ADD_SUC; GSYM ADD1; PRE]; ALL_TAC] + THEN USE_THEN "F6" (MP_TAC o SPEC `n:num` o MATCH_MP lemma_num_partition2) + THEN USE_THEN "F7" (fun th-> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [REWRITE_RULE[LT_NZ] th]) + THEN SIMP_TAC[] + THEN DISCH_THEN(X_CHOOSE_THEN `m:num` (X_CHOOSE_THEN `j:num`(CONJUNCTS_THEN2(LABEL_TAC "G1")(CONJUNCTS_THEN2 MP_TAC SUBST_ALL_TAC)))) + THEN REWRITE_TAC[ind; ADD_SUB2] + THEN DISCH_THEN (LABEL_TAC "G3") + THEN REMOVE_THEN "F10" (MP_TAC o ONCE_REWRITE_RULE[SYM(SPECL[`H:(A)hypermap`; `x:A`] (CONJUNCT1 ind))]) + THEN USE_THEN "GG" (fun th -> REWRITE_TAC[CONJUNCT1(MATCH_MP lemma_complement_path th); POWER_0; I_THM]) + THEN USE_THEN "GG" (fun th -> MP_TAC(SPECL[`m:num`; `j:num`] (CONJUNCT1(CONJUNCT2(CONJUNCT2(CONJUNCT2(MATCH_MP lemma_complement_path th))))))) + THEN USE_THEN "G1" (fun th-> REWRITE_TAC[th]) + THEN ABBREV_TAC `y = (inverse (face_map (H:(A)hypermap)) POWER (SUC m)) (x:A)` + THEN POP_ASSUM (LABEL_TAC "G4") + THEN USE_THEN "G4"(LABEL_TAC "G5" o SYM o REWRITE_RULE[GSYM(MATCH_MP inverse_power_function (CONJUNCT2(SPEC `H:(A)hypermap` face_map_and_darts)))] o SYM) + THEN USE_THEN "G3" (ASSUME_TAC o REWRITE_RULE[MATCH_MP LE_SUC_PRE (SPECL[`H:(A)hypermap`; `y:A`] NODE_NOT_EMPTY)] o ONCE_REWRITE_RULE[GSYM LE_SUC]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP LTE_TRANS (CONJ (SPEC `j:num` LT_PLUS) th)]) + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[GSYM(MATCH_MP inverse_power_function (CONJUNCT2(SPEC `H:(A)hypermap` node_map_and_darts)))] + THEN REWRITE_TAC[POWER_FUNCTION] + THEN DISCH_THEN (LABEL_TAC "G6" o SYM) + THEN USE_THEN "G6" (fun th-> (ASSUME_TAC (REWRITE_RULE[th] (SPECL[`H:(A)hypermap`; `x:A`; `SUC j`] lemma_in_node2)))) + THEN USE_THEN "G4" (fun th-> (MP_TAC (REWRITE_RULE[th] (SPECL[`H:(A)hypermap`; `x:A`; `SUC m`] lemma_power_inverse_in_face2)))) + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM IN_INTER] + THEN USE_THEN "F4" (fun th -> USE_THEN "F2" (fun th1 -> REWRITE_TAC[MATCH_MP (REWRITE_RULE[simple_hypermap] th1) th])) + THEN REWRITE_TAC[IN_SING] + THEN DISCH_THEN SUBST_ALL_TAC + THEN USE_THEN "G1" (fun th-> USE_THEN "F9" (fun th1-> (MP_TAC (MATCH_MP (ARITH_RULE `!a:num b c. 1 <= b /\ a + b <= PRE c ==> a < c`) (CONJ th th1))))) + THEN USE_THEN "GH" (fun th -> REWRITE_TAC[GSYM(MATCH_MP lemma_inc_monotone th)]) + THEN REWRITE_TAC[GSYM LE_SUC_LT] + THEN ONCE_REWRITE_TAC[LE_LT] + THEN STRIP_TAC + THENL[MP_TAC (SPECL[`x:A`;`SUC m`] (MATCH_MP lemma_segment_orbit (SPEC `H:(A)hypermap` face_map_and_darts))) + THEN REWRITE_TAC[GSYM face] + THEN POP_ASSUM (fun th -> (LABEL_TAC "G7" th THEN REWRITE_TAC[th; lemma_def_inj_orbit])) + THEN DISCH_THEN (MP_TAC o SPECL[`SUC m`; `0`]) + THEN REWRITE_TAC[LE_REFL; LT_NZ; NON_ZERO; POWER_0; I_THM] + THEN USE_THEN "G5" (fun th-> (REWRITE_TAC[th])); ALL_TAC] + THEN POP_ASSUM (SUBST_ALL_TAC o SYM) + THEN USE_THEN "F9" (MP_TAC o REWRITE_RULE[ind]) + THEN USE_THEN "G4" SUBST1_TAC + THEN USE_THEN "F4" (fun th1-> USE_THEN "F3" (fun th-> (LABEL_TAC "G8" (MATCH_MP (REWRITE_RULE[lemma_node_nondegenerate] th) th1)))) + THEN USE_THEN "G8" (fun th -> USE_THEN "N1"(fun thm -> REWRITE_TAC[MATCH_MP thm th])) + THEN REWRITE_TAC[LE_ADD_LCANCEL] + THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (ASSUME_TAC o MATCH_MP (ARITH_RULE `!a:num b. 2 <= b /\ a <= PRE (PRE b) ==> SUC a < b`)) + THEN MP_TAC (SPECL[`x:A`;`SUC j`] (MATCH_MP lemma_segment_orbit (SPEC `H:(A)hypermap` node_map_and_darts))) + THEN REWRITE_TAC[GSYM node] + THEN POP_ASSUM (fun th -> REWRITE_TAC[th;lemma_def_inj_orbit]) + THEN DISCH_THEN (MP_TAC o SPECL[`SUC j`; `0`]) + THEN REWRITE_TAC[LE_REFL; LT_NZ; NON_ZERO; POWER_0; I_THM] + THEN USE_THEN "G6" (fun th-> (REWRITE_TAC[th])); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "H1" o REWRITE_RULE[GSYM LT_NZ]) + THEN USE_THEN "H1" (fun th-> USE_THEN "F7" (fun th1-> (LABEL_TAC "H2" (MATCH_MP LT_TRANS (CONJ th th1))))) + THEN USE_THEN "F6" (MP_TAC o SPEC `n:num` o MATCH_MP lemma_num_partition2) + THEN USE_THEN "H2" (fun th-> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [REWRITE_RULE[LT_NZ] th]) + THEN SIMP_TAC[] + THEN DISCH_THEN(X_CHOOSE_THEN `m:num` (X_CHOOSE_THEN `k:num`(CONJUNCTS_THEN2(LABEL_TAC "H3")(CONJUNCTS_THEN2 MP_TAC SUBST_ALL_TAC)))) + THEN REWRITE_TAC[ind; ADD_SUB2] + THEN DISCH_THEN (LABEL_TAC "H4") + THEN USE_THEN "F6" (MP_TAC o SPEC `i:num` o MATCH_MP lemma_num_partition2) + THEN USE_THEN "H1" (fun th-> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [REWRITE_RULE[LT_NZ] th]) + THEN SIMP_TAC[] + THEN DISCH_THEN(X_CHOOSE_THEN `u:num` (X_CHOOSE_THEN `v:num`(CONJUNCTS_THEN2(LABEL_TAC "H5")(CONJUNCTS_THEN2 MP_TAC SUBST_ALL_TAC)))) + THEN REWRITE_TAC[ind; ADD_SUB2] + THEN DISCH_THEN (LABEL_TAC "H6") + THEN REMOVE_THEN "F10" (MP_TAC o ONCE_REWRITE_RULE[SYM(SPECL[`H:(A)hypermap`; `x:A`] (CONJUNCT1 ind))]) + THEN USE_THEN "GG" (fun th -> MP_TAC(SPECL[`m:num`; `k:num`] (CONJUNCT1(CONJUNCT2(CONJUNCT2(CONJUNCT2(MATCH_MP lemma_complement_path th))))))) + THEN USE_THEN "H3" (fun th-> REWRITE_TAC[th]) + THEN ABBREV_TAC `y = (inverse (face_map (H:(A)hypermap)) POWER (SUC m)) (x:A)` + THEN POP_ASSUM (LABEL_TAC "H7") + THEN USE_THEN "H7"(LABEL_TAC "H8" o SYM o REWRITE_RULE[GSYM(MATCH_MP inverse_power_function (CONJUNCT2(SPEC `H:(A)hypermap` face_map_and_darts)))] o SYM) + THEN USE_THEN "H4" (ASSUME_TAC o REWRITE_RULE[MATCH_MP LE_SUC_PRE (SPECL[`H:(A)hypermap`; `y:A`] NODE_NOT_EMPTY)] o ONCE_REWRITE_RULE[GSYM LE_SUC]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP LTE_TRANS (CONJ (SPEC `k:num` LT_PLUS) th)]) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "GG" (fun th -> MP_TAC(SPECL[`u:num`; `v:num`] (CONJUNCT1(CONJUNCT2(CONJUNCT2(CONJUNCT2(MATCH_MP lemma_complement_path th))))))) + THEN USE_THEN "H5" (fun th-> REWRITE_TAC[th]) + THEN ABBREV_TAC `z = (inverse (face_map (H:(A)hypermap)) POWER (SUC u)) (x:A)` + THEN POP_ASSUM (LABEL_TAC "H9") + THEN USE_THEN "H9"(LABEL_TAC "K1" o SYM o REWRITE_RULE[GSYM(MATCH_MP inverse_power_function (CONJUNCT2(SPEC `H:(A)hypermap` face_map_and_darts)))] o SYM) + THEN USE_THEN "H6" (ASSUME_TAC o REWRITE_RULE[MATCH_MP LE_SUC_PRE (SPECL[`H:(A)hypermap`; `y:A`] NODE_NOT_EMPTY)] o ONCE_REWRITE_RULE[GSYM LE_SUC]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[MATCH_MP LTE_TRANS (CONJ (SPEC `v:num` LT_PLUS) th)]) + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "K2") + THEN SUBGOAL_THEN `(z:A) IN face H (y:A)` MP_TAC + THENL[USE_THEN "H8" (MP_TAC) + THEN USE_THEN "K1" (SUBST1_TAC o SYM) + THEN GEN_REWRITE_TAC (LAND_CONV) [MATCH_MP inverse_power_function (CONJUNCT2(SPEC `H:(A)hypermap` face_map_and_darts))] + THEN MP_TAC(SPEC `SUC u` (MATCH_MP power_inverse_element_lemma (SPEC `H:(A)hypermap` face_map_and_darts))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (SUBST1_TAC)) + THEN REWRITE_TAC[GSYM lemma_add_exponent_function; ADD_SUC] + THEN DISCH_THEN SUBST1_TAC THEN REWRITE_TAC[lemma_in_face]; ALL_TAC] + THEN SUBGOAL_THEN `(z:A) IN node H (y:A)` MP_TAC + THENL[USE_THEN "K2" (MP_TAC o SYM) + THEN GEN_REWRITE_TAC (LAND_CONV) [GSYM(MATCH_MP inverse_power_function (CONJUNCT2(SPEC `H:(A)hypermap` node_map_and_darts)))] + THEN MP_TAC(SPEC `k:num` (MATCH_MP power_inverse_element_lemma (SPEC `H:(A)hypermap` node_map_and_darts))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (SUBST1_TAC)) + THEN REWRITE_TAC[GSYM lemma_add_exponent_function; ADD_SUC] + THEN DISCH_THEN SUBST1_TAC THEN REWRITE_TAC[lemma_in_node2]; ALL_TAC] + THEN REWRITE_TAC[IMP_IMP; GSYM IN_INTER] + THEN SUBGOAL_THEN `y:A IN dart (H:(A)hypermap)` (LABEL_TAC "K3") + THENL[USE_THEN "H7" (MP_TAC o SYM) + THEN MP_TAC(SPEC `SUC m` (MATCH_MP power_inverse_element_lemma (SPEC `H:(A)hypermap` face_map_and_darts))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (SUBST1_TAC)) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F4" (fun th-> REWRITE_TAC[MATCH_MP lemma_dart_invariant_power_face th]); ALL_TAC] + THEN USE_THEN "K3" (fun th -> USE_THEN "F2" (fun th1 -> REWRITE_TAC[MATCH_MP (REWRITE_RULE[simple_hypermap] th1) th])) + THEN REWRITE_TAC[IN_SING] + THEN DISCH_THEN SUBST_ALL_TAC + THEN SUBGOAL_THEN `v:num = k:num` (SUBST_ALL_TAC) + THENL[MP_TAC (MATCH_MP (ARITH_RULE `!i:num. 1 <= i ==> PRE i < i`) (SPECL[`H:(A)hypermap`; `y:A`] NODE_NOT_EMPTY)) + THEN DISCH_THEN (MP_TAC o CONJUNCT2 o REWRITE_RULE[lemma_inj_contour_via_list] o MATCH_MP lemma_inj_node_contour) + THEN DISCH_THEN (MP_TAC o REWRITE_RULE[node_contour] o SPECL[`v:num`; `k:num`] o REWRITE_RULE[lemma_inj_list2]) + THEN USE_THEN "K2" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "H4" (fun th -> REWRITE_TAC[th]) + THEN USE_THEN "H6" (fun th -> REWRITE_TAC[th]); ALL_TAC] + THEN REWRITE_TAC[EQ_ADD_RCANCEL] + THEN REMOVE_THEN "F7" (MP_TAC o REWRITE_RULE[LT_ADD_RCANCEL]) + THEN USE_THEN "GH" (fun th -> (DISCH_THEN (MP_TAC o REWRITE_RULE[GSYM(MATCH_MP lemma_inc_monotone th)]))) + THEN USE_THEN "H5" (fun th-> USE_THEN "F9" (fun th1-> (MP_TAC (MATCH_MP (ARITH_RULE `!a:num b c. 1 <= b /\ a + b <= PRE c ==> a < c`) (CONJ th th1))))) + THEN USE_THEN "GH" (fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [GSYM(MATCH_MP lemma_inc_monotone th)]) + THEN USE_THEN "K1" (fun th-> (MP_TAC (REWRITE_RULE[th] (SPECL[`H:(A)hypermap`; `y:A`; `SUC u`] lemma_in_face)))) + THEN DISCH_THEN (SUBST1_TAC o SYM o MATCH_MP lemma_face_identity) + THEN DISCH_THEN (LABEL_TAC "K4") + THEN DISCH_THEN ((X_CHOOSE_THEN `d:num` SUBST_ALL_TAC) o REWRITE_RULE[LT_EXISTS]) + THEN USE_THEN "K1" MP_TAC THEN USE_THEN "H8" (fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [SYM th]) + THEN REWRITE_TAC[GSYM (CONJUNCT2 ADD); addition_exponents; o_THM] + THEN MP_TAC (SPEC `SUC u` (MATCH_MP power_permutation (CONJUNCT2 (SPEC `H:(A)hypermap` face_map_and_darts)))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP PERMUTES_INJECTIVE th]) + THEN DISCH_TAC + THEN USE_THEN "K4" (MP_TAC o MATCH_MP (ARITH_RULE `!a:num b c. a + b < c ==> b < c`)) + THEN DISCH_THEN (MP_TAC o CONJUNCT2 o REWRITE_RULE[lemma_inj_contour_via_list] o MATCH_MP lemma_inj_face_contour) + THEN DISCH_THEN (MP_TAC o REWRITE_RULE[face_contour] o SPECL[`0`; `SUC d`] o REWRITE_RULE[lemma_inj_list2]) + THEN REWRITE_TAC[LE_0; LE_REFL; POWER_0; I_THM] + THEN POP_ASSUM (fun th-> MESON_TAC[th; GSYM NON_ZERO]));; + + +(* Restricted hypermap *) + +let is_restricted = new_definition `!H:(A)hypermap. is_restricted H <=> (~(dart H = {}) /\ planar_hypermap H /\ plain_hypermap H /\ connected_hypermap H /\ simple_hypermap H /\ is_no_double_joins H /\ is_edge_nondegenerate H /\ is_node_nondegenerate H /\ (!x:A. x IN dart H ==> 3 <= CARD (face H x)))`;; + +let canon = new_definition `!H:(A)hypermap NF:(A)loop->bool. + canon H NF = {L |L:(A)loop| L IN NF /\ ?x:A. x belong L /\ L = face_loop H x}`;; + +let canon_darts = new_definition `!(H:(A)hypermap) (NF:(A)loop->bool). canon_darts H NF = UNIONS {dart_of (L:(A)loop) | L:(A)loop | L IN canon H NF}`;; + +let is_in_canon_darts = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) L:(A)loop (x:A). x belong L /\ L IN canon H NF ==> x IN canon_darts H NF`, + REWRITE_TAC[belong; canon_darts] THEN SET_TAC[]);; + +let lemma_in_canon_darts = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (x:A). x IN canon_darts H NF <=> ?L:(A)loop. L IN canon H NF /\ x belong L`, + REPEAT GEN_TAC + THEN EQ_TAC + THENL[REWRITE_TAC[canon_darts; IN_UNIONS; IN_ELIM_THM] + THEN REPEAT STRIP_TAC + THEN EXISTS_TAC `L:(A)loop` + THEN POP_ASSUM MP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[GSYM belong] + THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN MESON_TAC[is_in_canon_darts]);; + +let lemma_not_in_canon_darts = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) L:(A)loop (x:A). is_normal H NF /\ L IN NF /\ ~(L IN canon H NF) /\ x belong L + ==> ~(x IN canon_darts H NF)`, + REPEAT GEN_TAC THEN STRIP_TAC THEN FIRST_X_ASSUM (MP_TAC o check (is_neg o concl)) + THEN ONCE_REWRITE_TAC[CONTRAPOS_THM] + THEN REWRITE_TAC[lemma_in_canon_darts] + THEN DISCH_THEN (X_CHOOSE_THEN `L':(A)loop` STRIP_ASSUME_TAC) + THEN SUBGOAL_THEN `L':(A)loop = L:(A)loop` SUBST_ALL_TAC + THENL[MATCH_MP_TAC disjoint_loops + THEN EXISTS_TAC `H:(A)hypermap` THEN EXISTS_TAC `NF:(A)loop->bool` THEN EXISTS_TAC `x:A` + THEN ASM_REWRITE_TAC[] THEN UNDISCH_TAC `L':(A)loop IN canon (H:(A)hypermap) (NF:(A)loop->bool)` + THEN SIMP_TAC[canon; IN_ELIM_THM]; ALL_TAC] + THEN ASM_REWRITE_TAC[]);; + +let GET_EDGE_NONDEGENERATE hpmap = (CONJUNCT1(CONJUNCT2(CONJUNCT2(CONJUNCT2(CONJUNCT2(CONJUNCT2(CONJUNCT2(REWRITE_RULE[is_restricted] hpmap))))))));; + +let lemma_power_canon_next = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. L IN canon H NF /\ x belong L + ==> (!n:num.((face_map H) POWER n) x = (next L POWER n) x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (MP_TAC o REWRITE_RULE[canon; IN_ELIM_THM]) (LABEL_TAC "F1")) + THEN DISCH_THEN ((X_CHOOSE_THEN `y:A` (SUBST_ALL_TAC o CONJUNCT2)) o CONJUNCT2) + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[belong; face_loop_rep] + THEN DISCH_THEN (fun th -> REWRITE_TAC[MATCH_MP lemma_face_identity th]) + THEN REWRITE_TAC[power_res_face_map]);; + +let lemma_true_loop1 = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop. is_restricted H /\ is_normal H NF /\ L IN NF + ==> (L IN canon H NF <=> ?x:A. x belong L /\ (!n. ((face_map H) POWER n) x = (next L POWER n) x))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F2" o GET_EDGE_NONDEGENERATE) (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F3"))) + THEN EQ_TAC + THENL[REWRITE_TAC[canon; IN_ELIM_THM] + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (X_CHOOSE_THEN `x:A` (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5"))) + THEN EXISTS_TAC `x:A` THEN USE_THEN "F4" (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM SUBST1_TAC THEN GEN_TAC + THEN REWRITE_TAC[face_loop_rep; GSYM power_res_face_map]; ALL_TAC] + THEN DISCH_THEN (X_CHOOSE_THEN `x:A` (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5"))) + THEN REWRITE_TAC[canon; IN_ELIM_THM] + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[th]) + THEN EXISTS_TAC `x:A` THEN USE_THEN "F4" (fun th-> REWRITE_TAC[th]) + THEN REWRITE_TAC[lemma_loop_identity; face_loop_rep] + THEN SUBGOAL_THEN `dart_of (L:(A)loop) = face (H:(A)hypermap) (x:A)` (LABEL_TAC "F6") + THENL[USE_THEN "F4" (fun th-> REWRITE_TAC[MATCH_MP lemma_transitive_permutation th]) + THEN REWRITE_TAC[face; orbit_map] + THEN CONV_TAC SYM_CONV THEN POP_ASSUM MP_TAC THEN SET_TAC[]; ALL_TAC] + THEN USE_THEN "F6" (fun th-> REWRITE_TAC[th]) + THEN REWRITE_TAC[FUN_EQ_THM] THEN GEN_TAC + THEN ASM_CASES_TAC `~((x':A) IN (dart_of (L:(A)loop)))` + THENL[POP_ASSUM (LABEL_TAC "F7") + THEN USE_THEN "F7" (fun th-> REWRITE_TAC[MATCH_MP lemma_permutes_exception (CONJ (CONJUNCT1 (SPEC `L:(A)loop` lemma_permute_loop)) th)]) + THEN REMOVE_THEN "F6" (fun th-> REMOVE_THEN "F7" (LABEL_TAC "F8" o REWRITE_RULE[th])) + THEN USE_THEN "F8" (fun th-> REWRITE_TAC[MATCH_MP lemma_permutes_exception (CONJ (SPECL[`H:(A)hypermap`; `x:A`] face_map_restrict) th)]); ALL_TAC] + THEN USE_THEN "F6" (fun th-> POP_ASSUM (LABEL_TAC "F9" o REWRITE_RULE[th])) + THEN USE_THEN "F9" (fun th-> REWRITE_TAC[MATCH_MP lemma_face_identity th]) + THEN REWRITE_TAC[res; face_refl] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[face; orbit_map; IN_ELIM_THM; GE; LE_0]) + THEN DISCH_THEN (X_CHOOSE_THEN `n:num` SUBST1_TAC) + THEN REWRITE_TAC[COM_POWER_FUNCTION] + THEN USE_THEN "F5" (fun th-> REWRITE_TAC[SPEC `n:num` th]) + THEN REWRITE_TAC[COM_POWER_FUNCTION]);; + +let GET_SIMPLE_PROPERTY hpmap = (CONJUNCT1(CONJUNCT2(CONJUNCT2(CONJUNCT2(CONJUNCT2(REWRITE_RULE[is_restricted] hpmap))))));; + +let GET_NODE_NONDEGENERATE hpmap + = (CONJUNCT1(CONJUNCT2(CONJUNCT2(CONJUNCT2(CONJUNCT2(CONJUNCT2(CONJUNCT2(CONJUNCT2(REWRITE_RULE[is_restricted] hpmap)))))))));; + +let lemma_true_loop = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop. is_restricted H /\ is_normal H NF /\ L IN NF + ==> (L IN canon H NF <=> ?x:A. dart_of L = face H x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 MP_TAC (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5"))) + THEN DISCH_THEN (fun th-> (LABEL_TAC "F1" (GET_SIMPLE_PROPERTY th) THEN LABEL_TAC "F2" (GET_NODE_NONDEGENERATE th) THEN (LABEL_TAC "GC" th))) + THEN EQ_TAC + THENL[USE_THEN "GC"(fun th-> USE_THEN "F4"(fun th1-> USE_THEN "F5"(fun th2-> REWRITE_TAC[MATCH_MP lemma_true_loop1 (CONJ th (CONJ th1 th2))]))) + THEN DISCH_THEN (X_CHOOSE_THEN `y:A` (CONJUNCTS_THEN2 (LABEL_TAC "G1") (LABEL_TAC "G2"))) + THEN EXISTS_TAC `y:A` THEN USE_THEN "G1" (fun th-> REWRITE_TAC[MATCH_MP lemma_transitive_permutation th]) + THEN REWRITE_TAC[face; orbit_map] THEN POP_ASSUM MP_TAC THEN SET_TAC[]; ALL_TAC] + THEN DISCH_THEN(X_CHOOSE_THEN `x:A` (LABEL_TAC "H1")) + THEN USE_THEN "GC"(fun th-> USE_THEN "F4"(fun th1-> USE_THEN "F5"(fun th2-> REWRITE_TAC[MATCH_MP lemma_true_loop1 (CONJ th (CONJ th1 th2))]))) + THEN EXISTS_TAC `x:A` THEN USE_THEN "H1" (fun th-> (LABEL_TAC "H2" (REWRITE_RULE[SYM th; GSYM belong] (SPECL[`H:(A)hypermap`; `x:A`] face_refl)))) + THEN USE_THEN "H2" (fun th-> REWRITE_TAC[th]) + THEN INDUCT_TAC THENL[REWRITE_TAC[POWER_0]; ALL_TAC] + THEN CONV_TAC SYM_CONV + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN USE_THEN "H2" (MP_TAC o SPEC `n:num` o MATCH_MP lemma_power_next_in_loop) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "H3") + THEN LABEL_TAC "H4" (SPECL[`H:(A)hypermap`; `x:A`; `n:num`] lemma_in_face) + THEN ABBREV_TAC `y:A = (face_map (H:(A)hypermap) POWER (n:num)) (x:A)` + THEN REMOVE_THEN "H4" (fun th-> SUBST_ALL_TAC (MATCH_MP lemma_face_identity th)) + THEN USE_THEN "F4" (MP_TAC o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]) + THEN DISCH_THEN (fun thm-> USE_THEN "F5" (MP_TAC o SPEC `y:A` o REWRITE_RULE[is_loop] o CONJUNCT1 o MATCH_MP thm)) + THEN USE_THEN "H3" (fun th-> REWRITE_TAC[th; one_step_contour]) + THEN STRIP_TAC + THEN USE_THEN "H3" (MP_TAC o REWRITE_RULE[belong; POWER_1] o SPEC `1` o MATCH_MP lemma_power_next_in_loop) + THEN USE_THEN "H1" (SUBST1_TAC) + THEN POP_ASSUM (LABEL_TAC "H4") + THEN USE_THEN "H4" (fun th-> (MP_TAC (REWRITE_RULE[SYM th] (MATCH_MP lemma_inverse_in_node (SPECL[`H:(A)hypermap`; `y:A`] node_refl))))) + THEN REWRITE_TAC[IMP_IMP; GSYM IN_INTER] + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_simple_hypermap th; IN_SING]) + THEN POP_ASSUM (fun th-> (GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [th])) + THEN CONV_TAC (LAND_CONV SYM_CONV) + THEN ONCE_REWRITE_TAC[GSYM node_map_inverse_representation] + THEN USE_THEN "F2" (MP_TAC o GSYM o SPEC `y:A` o REWRITE_RULE[is_node_nondegenerate]) + THEN USE_THEN "F4"(fun th-> USE_THEN "F5"(fun th1-> USE_THEN "H3"(fun th2-> REWRITE_TAC[MATCH_MP lemma_in_dart (CONJ th (CONJ th1 th2))]))) + THEN REWRITE_TAC[IMP_IMP] THEN MESON_TAC[]);; + +let lemma_true_loop_via_map = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop. is_restricted H /\ is_normal H NF /\ L IN NF + ==> (L IN canon H NF <=> (!x:A. x belong L ==> next L x = face_map H x))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN EQ_TAC + THENL[DISCH_TAC THEN GEN_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (fun th -> REWRITE_TAC[REWRITE_RULE[POWER_1] (SPEC `1` (MATCH_MP lemma_power_canon_next th))]); ALL_TAC] + THEN DISCH_THEN (LABEL_TAC "F4") + THEN USE_THEN "F3" (fun th -> (USE_THEN "F2" (MP_TAC o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F5") (X_CHOOSE_THEN `y:A` (LABEL_TAC "F6" o CONJUNCT2))) + THEN USE_THEN "F1"(fun th-> USE_THEN "F2"(fun th1-> USE_THEN "F3"(fun th2-> REWRITE_TAC[MATCH_MP lemma_true_loop1 (CONJ th (CONJ th1 th2))]))) + THEN EXISTS_TAC `y:A` THEN USE_THEN "F6" (fun th-> REWRITE_TAC[th]) + THEN INDUCT_TAC THENL[REWRITE_TAC[POWER_0; I_THM]; ALL_TAC] + THEN REWRITE_TAC[COM_POWER; o_THM] + THEN POP_ASSUM (fun th-> SUBST1_TAC th THEN ASSUME_TAC th) + THEN CONV_TAC SYM_CONV + THEN USE_THEN "F6" (MP_TAC o SPEC `n:num` o MATCH_MP lemma_power_next_in_loop) + THEN USE_THEN "F4" (fun thm -> DISCH_THEN (fun th -> REWRITE_TAC[MATCH_MP thm th])));; + +let lemma_false_loop = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop. is_restricted H /\ is_normal H NF /\ L IN NF + ==> (~(L IN canon H NF) <=> (?x:A. x belong L /\ next L x = inverse (node_map H) x))`, + REPEAT GEN_TAC THEN DISCH_THEN (LABEL_TAC "F1") + THEN ONCE_REWRITE_TAC[TAUT `(~A <=> B) <=> (A <=> ~B)`] + THEN REWRITE_TAC[NOT_EXISTS_THM; DE_MORGAN_THM; TAUT `(~A \/ B) <=> (A ==> B)`] + THEN USE_THEN "F1" (fun th -> REWRITE_TAC[MATCH_MP lemma_true_loop_via_map th]) + THEN EQ_TAC + THENL[DISCH_THEN (LABEL_TAC "F2") THEN GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F3") + THEN POP_ASSUM (fun th-> REWRITE_TAC[th] THEN (LABEL_TAC "F3" th)) + THEN USE_THEN "F2" (fun th-> USE_THEN "F3" (SUBST1_TAC o MATCH_MP th)) + THEN REMOVE_THEN "F1" (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5")) + THEN USE_THEN "F5" (fun th-> USE_THEN "F3" (fun th1-> ASSUME_TAC (MATCH_MP lemma_in_dart (REWRITE_RULE[GSYM CONJ_ASSOC] (CONJ th th1))))) + THEN USE_THEN "F4" (MP_TAC o SPEC `x:A` o REWRITE_RULE[lemma_edge_nondegenerate] o GET_EDGE_NONDEGENERATE) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN DISCH_THEN (LABEL_TAC "F6") + THEN GEN_TAC THEN DISCH_THEN (LABEL_TAC "F7") + THEN USE_THEN "F6" (fun th-> (USE_THEN "F7" (LABEL_TAC "F8" o MATCH_MP th))) + THEN USE_THEN "F1" (CONJUNCTS_THEN2 (LABEL_TAC "G1") (CONJUNCTS_THEN2 (LABEL_TAC "G2") (LABEL_TAC "G3"))) + THEN USE_THEN "G3" (fun th -> (USE_THEN "G2" (MP_TAC o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN DISCH_THEN (MP_TAC o SPEC `x:A` o REWRITE_RULE[is_loop] o CONJUNCT1) + THEN USE_THEN "F7" (fun th-> REWRITE_TAC[th; one_step_contour]) + THEN USE_THEN "F8" (fun th-> REWRITE_TAC[th]));; + +let lemma_next_on_normal_loop = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_normal H NF /\ L IN NF /\ x belong L + ==> next L x = face_map H x \/ next L x = inverse(node_map H) x`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") ASSUME_TAC)) + THEN USE_THEN "F2" (fun th -> (USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN DISCH_THEN (MP_TAC o SPEC `x:A` o REWRITE_RULE[is_loop] o CONJUNCT1) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th; one_step_contour]));; + +let lemma_next_exclusive = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_restricted H /\ is_normal H NF /\ L IN NF /\ x belong L + ==> (next L x = face_map H x <=> ~(next L x = inverse(node_map H) x))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1" o GET_EDGE_NONDEGENERATE) (LABEL_TAC "F2")) + THEN USE_THEN "F2" (STRIP_ASSUME_TAC o MATCH_MP lemma_next_on_normal_loop) + THENL[POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN REMOVE_THEN "F1" (MP_TAC o SPEC `x:A` o REWRITE_RULE[lemma_edge_nondegenerate]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP lemma_in_dart th]); ALL_TAC] + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN CONV_TAC (RAND_CONV SYM_CONV) + THEN REMOVE_THEN "F1" (MP_TAC o SPEC `x:A` o REWRITE_RULE[lemma_edge_nondegenerate]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP lemma_in_dart th]));; + +let lemma_next_exclusive2 = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_restricted H /\ is_normal H NF /\ L IN NF /\ x belong L + ==> (next L x = inverse(node_map H) x <=> ~(next L x = face_map H x))`, + ONCE_REWRITE_TAC[TAUT `(A <=> ~B) <=> (B <=> ~A)`] THEN REWRITE_TAC[lemma_next_exclusive]);; + +let lemma_head_via_restricted = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_restricted H /\ is_normal H NF /\ L IN NF /\ x belong L + ==> (head H NF x = x <=> next L x = face_map H x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN EQ_TAC + THENL[DISCH_TAC THEN USE_THEN "F2" (MP_TAC o CONJUNCT2 o MATCH_MP head_on_loop) + THEN POP_ASSUM SUBST1_TAC + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1 -> MP_TAC (MATCH_MP lemma_next_exclusive (CONJ th th1)))) + THEN SIMP_TAC[]; ALL_TAC] + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1 -> REWRITE_TAC [MATCH_MP lemma_next_exclusive (CONJ th th1)])) + THEN DISCH_TAC THEN MATCH_MP_TAC lemma_unique_head + THEN EXISTS_TAC `L:(A)loop` THEN ASM_REWRITE_TAC[atom_reflect]);; + +let lemma_head = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A) (y:A). is_restricted H /\ is_normal H NF /\ L IN NF /\ x belong L /\ y IN atom H L x ==> (head H NF x = y <=> next L y = face_map H y)`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (MP_TAC)) + THEN DISCH_THEN (fun th-> REWRITE_TAC[SYM(CONJUNCT1(MATCH_MP change_parameters th))] THEN MP_TAC th) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") MP_TAC)) + THEN DISCH_THEN (ASSUME_TAC o MATCH_MP lemma_in_loop) + THEN MATCH_MP_TAC lemma_head_via_restricted THEN ASM_REWRITE_TAC[]);; + +let lemma_tail_via_restricted = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_restricted H /\ is_normal H NF /\ L IN NF /\ x belong L + ==> (tail H NF x = x <=> x = face_map H (back L x))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN EQ_TAC + THENL[DISCH_TAC THEN USE_THEN "F2" (MP_TAC o CONJUNCT2 o MATCH_MP tail_on_loop) + THEN POP_ASSUM SUBST1_TAC + THEN REMOVE_THEN "F2" (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5"))) + THEN USE_THEN "F5" (LABEL_TAC "F6" o REWRITE_RULE[POWER_1] o SPEC `1` o (MATCH_MP lemma_power_back_in_loop)) + THEN ABBREV_TAC `y = back (L:(A)loop) (x:A)` + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[lemma_inverse_evaluation] o AP_TERM `next (L:(A)loop)`) + THEN DISCH_THEN SUBST1_TAC THEN DISCH_TAC + THEN USE_THEN "F6" MP_TAC THEN USE_THEN "F4" MP_TAC THEN USE_THEN "F3" MP_TAC THEN USE_THEN "F1" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_next_exclusive) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN REMOVE_THEN "F2" (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5"))) + THEN USE_THEN "F5" (LABEL_TAC "F6" o REWRITE_RULE[POWER_1] o SPEC `1` o (MATCH_MP lemma_power_back_in_loop)) + THEN ABBREV_TAC `y = back (L:(A)loop) (x:A)` THEN POP_ASSUM (MP_TAC o REWRITE_RULE[lemma_inverse_evaluation] o AP_TERM `next (L:(A)loop)`) + THEN DISCH_THEN SUBST1_TAC THEN DISCH_TAC + THEN USE_THEN "F6" MP_TAC THEN USE_THEN "F4" MP_TAC THEN USE_THEN "F3" MP_TAC THEN USE_THEN "F1" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_next_exclusive) + THEN POP_ASSUM (fun th-> GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [th]) THEN SIMP_TAC[] + THEN DISCH_TAC THEN MATCH_MP_TAC lemma_unique_tail + THEN EXISTS_TAC `L:(A)loop` THEN ASM_REWRITE_TAC[atom_reflect] + THEN USE_THEN "F6" (fun th-> REWRITE_TAC[REWRITE_RULE[POWER_1] (SPEC `1` (MATCH_MP lemma_power_next_in_loop th))]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[lemma_inverse_evaluation; th]));; + +let lemma_tail = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A) (y:A). is_restricted H /\ is_normal H NF /\ L IN NF /\ x belong L /\ y IN atom H L x ==> (tail H NF x = y <=> y = face_map H (back L y))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (MP_TAC)) + THEN DISCH_THEN (fun th-> REWRITE_TAC[SYM(CONJUNCT2(MATCH_MP change_parameters th))] THEN MP_TAC th) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") MP_TAC)) + THEN DISCH_THEN (ASSUME_TAC o MATCH_MP lemma_in_loop) + THEN MATCH_MP_TAC lemma_tail_via_restricted THEN ASM_REWRITE_TAC[]);; + +let lemma_singleton_atom = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_restricted H /\ is_normal H NF /\ L IN NF /\ x belong L + ==> (atom H L x = {x} <=> next L x = face_map H x /\ face_map H (back L x) = x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN USE_THEN "F1" (LABEL_TAC "F2" o CONJUNCT2) + THEN EQ_TAC + THENL[DISCH_THEN (LABEL_TAC "F3") + THEN USE_THEN "F2" (MP_TAC o CONJUNCT1 o MATCH_MP head_on_loop) + THEN USE_THEN "F3" SUBST1_TAC + THEN REWRITE_TAC[IN_SING] + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_head_via_restricted th]) + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F2" (MP_TAC o CONJUNCT1 o MATCH_MP tail_on_loop) + THEN USE_THEN "F3" SUBST1_TAC + THEN REWRITE_TAC[IN_SING] + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_tail_via_restricted th]) + THEN DISCH_THEN (fun th-> REWRITE_TAC[SYM th]); ALL_TAC] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")) + THEN MATCH_MP_TAC atom_one_point + THEN EXISTS_TAC `NF:(A)loop->bool` THEN USE_THEN "F2" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F1" (MP_TAC o MATCH_MP lemma_head_via_restricted) + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F1" (MP_TAC o MATCH_MP lemma_tail_via_restricted) + THEN USE_THEN "F4" (fun th-> MESON_TAC[SYM th; EQ_SYM]));; + + +(* the condition which neeeds to split a loop into two other special loops *) + +let is_split_condition = new_definition `!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_split_condition H NF L x + <=> is_restricted H /\ is_normal H NF /\ L IN NF /\ ~(L IN canon H NF) /\ x belong L /\ head H NF x = x`;; + +let lemma_mInside_Exists = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_split_condition H NF L x + ==> ?m:num. ((!i:num. i <= SUC m ==> ((next L POWER i) x = (face_map H POWER i) x)) + /\ ~((next L POWER (SUC (SUC m))) x = (face_map H POWER (SUC (SUC m))) x))`, + REPEAT GEN_TAC + THEN REWRITE_TAC[is_split_condition] THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6")))))) + THEN REMOVE_THEN "F4" MP_TAC THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] + THEN REWRITE_TAC[NOT_EXISTS_THM; DE_MORGAN_THM; NOT_FORALL_THM;NOT_IMP ] + THEN DISCH_THEN (LABEL_TAC "F7") + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1 -> USE_THEN "F3" (fun th2-> REWRITE_TAC[MATCH_MP lemma_true_loop1 (CONJ th (CONJ th1 th2))]))) + THEN EXISTS_TAC `x:A` THEN USE_THEN "F5" (fun th-> REWRITE_TAC[th]) + THEN MATCH_MP_TAC num_WF + THEN INDUCT_TAC THENL[REWRITE_TAC[ARITH_RULE `m:num < 0 <=> F`; POWER_0; I_THM]; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F8") + THEN DISCH_THEN (LABEL_TAC "F9") + THEN ASM_CASES_TAC `n:num = 0` + THENL[POP_ASSUM SUBST_ALL_TAC + THEN REWRITE_TAC[GSYM ONE; POWER_1] THEN CONV_TAC SYM_CONV + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th2-> USE_THEN "F3" (fun th3-> USE_THEN "F5" (fun th5-> MP_TAC (MATCH_MP lemma_head_via_restricted (CONJ th (CONJ th2 (CONJ th3 th5)))))))) + THEN USE_THEN "F6" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[GSYM LT_NZ; LT_EXISTS; ADD]) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` SUBST_ALL_TAC) + THEN REMOVE_THEN "F7" (MP_TAC o SPEC `d:num`) + THEN STRIP_TAC + THENL[USE_THEN "F9" (MP_TAC o REWRITE_RULE[LT_SUC_LE] o SPEC `i:num`) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM SUBST1_TAC THEN SIMP_TAC[]);; + +(* The notion of flag is actually defined on quotient hypermaps. I only use this notion for those with restricted cover hypermap, + so I define that in term of cover hypermaps. *) + +let lemma_mInside = new_specification["mInside"] (REWRITE_RULE[GSYM RIGHT_EXISTS_IMP_THM; SKOLEM_THM] lemma_mInside_Exists);; + +let lemma_bound_mInside = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_split_condition H NF L x + ==> SUC (mInside H NF L x) < CARD (face H x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN USE_THEN "F1" ((CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 MP_TAC (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7")))))) o REWRITE_RULE[is_split_condition]) + THEN USE_THEN "F1" (LABEL_TAC "F8" o CONJUNCT1 o MATCH_MP lemma_mInside) + THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN REWRITE_TAC[NOT_LT] + THEN DISCH_THEN (LABEL_TAC "F9") + THEN USE_THEN "F2" (fun th-> USE_THEN "F3"(fun th1-> USE_THEN "F4" (fun th2 -> REWRITE_TAC[MATCH_MP lemma_true_loop1 (CONJ th (CONJ th1 th2))]))) + THEN EXISTS_TAC `x:A` THEN USE_THEN "F6" (fun th-> REWRITE_TAC[th]) THEN GEN_TAC + THEN MP_TAC (REWRITE_RULE[LT1_NZ; LT_NZ] (SPECL[`H:(A)hypermap`; `x:A`] FACE_NOT_EMPTY)) + THEN DISCH_THEN (MP_TAC o SPEC `n:num` o MATCH_MP DIVMOD_EXIST) + THEN DISCH_THEN (X_CHOOSE_THEN `q:num` (X_CHOOSE_THEN `r:num` (CONJUNCTS_THEN2 (SUBST1_TAC o REWRITE_RULE[ADD_SYM]) (LABEL_TAC "G1")))) + THEN REWRITE_TAC[lemma_add_exponent_function] + THEN LABEL_TAC "G2" (SPECL[`H:(A)hypermap`; `x:A`] lemma_face_cycle) + THEN USE_THEN "G2" (fun th-> REWRITE_TAC[MATCH_MP power_map_fix_point th]) + THEN USE_THEN "F8" (MP_TAC o SPEC `CARD (face (H:(A)hypermap) (x:A))`) + THEN USE_THEN "F9" (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP power_map_fix_point th]) + THEN REMOVE_THEN "F8" (MP_TAC o SPEC `r:num`) + THEN USE_THEN "G1" (fun th-> USE_THEN "F9" (fun th1-> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ (MATCH_MP LT_IMP_LE th) th1); EQ_SYM])));; + +let lemma_congruence_on_face = prove(`!H:(A)hypermap x:A n:num m:num. n < CARD (face H x) /\ (face_map H POWER n) x = (face_map H POWER m) x + ==> ?q:num. m = q * CARD (face H x) + n`, + REWRITE_TAC[face] THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC lemma_congruence_on_orbit + THEN EXISTS_TAC `dart (H:(A)hypermap)` THEN ASM_REWRITE_TAC[SPEC`H:(A)hypermap` face_map_and_darts]);; + +let dart_inside = new_definition `!H:(A)hypermap (NF:(A)loop->bool) (L:(A)loop) (x:A). + dart_inside H NF L x = {((face_map H) POWER i) x | i:num | 1 <= i /\ i <= mInside H NF L x}`;; + +let lemma_dart_inside_sub_loop = prove(`!H:(A)hypermap (NF:(A)loop->bool) (L:(A)loop) (x:A). is_split_condition H NF L x + ==> dart_inside H NF L x SUBSET dart_of L`, + REPEAT GEN_TAC THEN DISCH_THEN (LABEL_TAC "F1") THEN REWRITE_TAC[SUBSET; dart_inside; IN_ELIM_THM; GSYM belong] + THEN GEN_TAC THEN DISCH_THEN (X_CHOOSE_THEN `i:num` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3")) SUBST1_TAC)) + THEN USE_THEN "F1" (MP_TAC o SPEC `i:num` o CONJUNCT1 o MATCH_MP lemma_mInside) + THEN USE_THEN "F3"(fun th->REWRITE_TAC[MATCH_MP LT_IMP_LE (MATCH_MP LET_TRANS (CONJ th (SPEC `mInside (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` LT_PLUS)))]) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN MATCH_MP_TAC lemma_power_next_in_loop THEN USE_THEN "F1" (fun th-> REWRITE_TAC[REWRITE_RULE[is_split_condition] th]));; + +let canon_flag = new_definition `!(H:(A)hypermap) (NF:(A)loop->bool). canon_flag H NF <=> (!x:A y:A. x IN canon_darts H NF /\ y IN canon_darts H NF ==> (?p:num->A k:num. p 0 = x /\ p k = y /\ is_contour H p k /\ support_list p k SUBSET canon_darts H NF)) /\ (!L:(A)loop x:A. L IN NF /\ ~(L IN canon H NF) /\ x belong L ==> edge_map H (head H NF x) IN canon_darts H NF)`;; + +let flag = new_definition `!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). flag H NF L x <=> ((!u:A v:A. u IN canon_darts H NF /\ v IN canon_darts H NF ==> (?p:num->A k:num. p 0 = u /\ p k = v /\ is_contour H p k /\ support_list p k SUBSET canon_darts H NF)) + /\ (!L':(A)loop y:A. L' IN NF /\ ~(L' IN canon H NF) /\ y belong L' /\ ~(head H NF y IN dart_inside H NF L x) ==> edge_map H (head H NF y) IN (canon_darts H NF UNION dart_inside H NF L x)))`;; + +let heading = new_definition `!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. heading H NF L x = ((face_map H) POWER (SUC(mInside H NF L x))) x`;; + +let lemma_loop_eq_face = prove(`!H:(A)hypermap L:(A)loop x:A n:num. 1 <= n /\ x belong L /\ (!i:num. i <= n ==> (next L POWER i) x = (face_map H POWER i) x) /\ (next L POWER n) x = x ==> dart_of L = face H x /\ size L <= n`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1" o REWRITE_RULE[LT1_NZ; LT_NZ]) (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")))) + THEN USE_THEN "F4" (fun th-> USE_THEN "F3" (ASSUME_TAC o SYM o REWRITE_RULE[LE_REFL; th] o SPEC `n:num`)) + THEN USE_THEN "F2" (fun th -> REWRITE_TAC[size; MATCH_MP lemma_transitive_permutation th; face]) + THEN STRIP_TAC + THENL[USE_THEN "F1"(fun th-> POP_ASSUM (fun th1-> REWRITE_TAC[MATCH_MP orbit_cyclic (CONJ th th1)])) + THEN USE_THEN "F1"(fun th-> USE_THEN "F4" (fun th1-> REWRITE_TAC[MATCH_MP orbit_cyclic (CONJ th th1)])) + THEN REMOVE_THEN "F1" (MP_TAC o REWRITE_RULE[GSYM LT_NZ; LT_EXISTS; ADD]) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` SUBST_ALL_TAC) + THEN REWRITE_TAC[LT_SUC_LE] + THEN USE_THEN "F3" (MP_TAC o CONJUNCT1 o REWRITE_RULE[lemma_add_one_assumption]) + THEN REWRITE_TAC[lemma_two_series_eq]; ALL_TAC] + THEN USE_THEN "F1"(fun th-> USE_THEN "F4" (fun th1-> REWRITE_TAC[MATCH_MP orbit_cyclic (CONJ th th1); CARD_FINITE_SERIES_LE])));; + +let lemma_on_heading = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_split_condition H NF L x ==> (heading H NF L x) belong L /\ next L (heading H NF L x) = (inverse (node_map H) (heading H NF L x)) /\ ~(node H (heading H NF L x) = node H x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN USE_THEN "F1" (MP_TAC o MATCH_MP lemma_mInside) + THEN DISCH_THEN(CONJUNCTS_THEN2 (MP_TAC o SPEC `SUC (mInside (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A))`) MP_TAC) + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [COM_POWER] + THEN REWRITE_TAC[o_THM; LE_REFL; GSYM heading] THEN (DISCH_THEN (LABEL_TAC "F2")) + THEN DISCH_THEN (SUBST_ALL_TAC o SYM) + THEN ABBREV_TAC `m = SUC (mInside (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A))` + THEN POP_ASSUM (LABEL_TAC "FC") + THEN USE_THEN "F1" (MP_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_split_condition]) + THEN DISCH_THEN (LABEL_TAC "F3" o SPEC `m:num` o MATCH_MP lemma_power_next_in_loop) + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[th]) + THEN ABBREV_TAC `y = (next (L:(A)loop) POWER (m:num)) (x:A)` THEN USE_THEN "F3" MP_TAC + THEN USE_THEN "F1" ((CONJUNCTS_THEN2 ASSUME_TAC (CONJUNCTS_THEN2 ASSUME_TAC (MP_TAC o CONJUNCT1))) o REWRITE_RULE[is_split_condition]) + THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN USE_THEN "F2" (fun th-> DISCH_THEN (fun th1 -> REWRITE_TAC[REWRITE_RULE[th] (MATCH_MP lemma_next_exclusive th1)])) + THEN POP_ASSUM (LABEL_TAC "F4") + THEN USE_THEN "F2" MP_TAC THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_TAC THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`; `m:num`] lemma_in_face) + THEN USE_THEN "FC" (fun th-> USE_THEN "F1" (MP_TAC o REWRITE_RULE[th; LE_REFL] o SPEC `m:num` o CONJUNCT1 o MATCH_MP lemma_mInside)) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN USE_THEN "F4" SUBST1_TAC + THEN MP_TAC(SPECL[`H:(A)hypermap`; `y:A`] node_refl) + THEN POP_ASSUM SUBST1_TAC THEN REWRITE_TAC[IMP_IMP; GSYM IN_INTER] + THEN USE_THEN "F1" (ASSUME_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted] o CONJUNCT1 o REWRITE_RULE[is_split_condition]) + THEN SUBGOAL_THEN `x:A IN dart (H:(A)hypermap)` MP_TAC + THENL[MATCH_MP_TAC lemma_in_dart + THEN EXISTS_TAC `NF:(A)loop->bool` THEN EXISTS_TAC `L:(A)loop` THEN USE_THEN "F1" (fun th-> REWRITE_TAC[REWRITE_RULE[is_split_condition] th]) + ; ALL_TAC] + THEN DISCH_THEN (fun th-> (POP_ASSUM (fun th1-> REWRITE_TAC[MATCH_MP (REWRITE_RULE[simple_hypermap] th1) th; IN_SING]))) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F1" (MP_TAC o REWRITE_RULE[POWER_1; GE_1] o SPEC `1` o CONJUNCT1 o MATCH_MP lemma_mInside) + THEN SIMP_TAC[]);; + +let CONJ3 th1 th2 th3 = (CONJ th1 (CONJ th2 th3));; + +let CONJ4 th1 th2 th3 th4 = (CONJ th1 (CONJ th2 (CONJ th3 th4)));; + +let lemma_face_contour_on_loop = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A m:num. is_restricted H /\ is_normal H NF /\ L IN NF /\ x belong L /\ head H NF x = x /\ (!i:num. i <= SUC m ==> (next L POWER i) x = (face_map H POWER i) x) ==> ((!i:num. 1 <= i /\ i <= m ==> atom H L ((next L POWER i) x) = {(face_map H POWER i)x}) /\ (!i:num. 1 <= i /\ i <= m ==> (face_map (quotient H NF) POWER i) (atom H L x) = {(face_map H POWER i) x}) /\ +((face_map (quotient H NF) POWER (SUC m)) (atom H L x) = atom H L ((face_map H POWER (SUC m)) x)))`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6")))))) + THEN USE_THEN "F2" (fun th-> REWRITE_TAC[MATCH_MP lemma_quotient th]) + THEN SUBGOAL_THEN `!i:num. 1 <= i /\ i <= m:num ==> atom (H:(A)hypermap) L ((next L POWER i) x) = {(face_map H POWER i) x}` (LABEL_TAC "F7") + THENL[GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "H1") (LABEL_TAC "H2")) + THEN USE_THEN "H2" (fun th-> MP_TAC (MATCH_MP LE_TRANS (CONJ th (SPEC `m:num` LE_PLUS)))) + THEN USE_THEN "F6" (fun th-> DISCH_THEN (SUBST1_TAC o SYM o MATCH_MP th)) + THEN USE_THEN "F4" (MP_TAC o SPEC `i:num` o MATCH_MP lemma_power_next_in_loop) + THEN USE_THEN "F3" MP_TAC THEN USE_THEN "F2" MP_TAC THEN USE_THEN "F1" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_singleton_atom th]) + THEN STRIP_TAC + THENL[REWRITE_TAC[COM_POWER_FUNCTION] + THEN USE_THEN "H2" (fun th-> MP_TAC (MATCH_MP LE_TRANS (CONJ th (SPEC `m:num` LE_PLUS)))) + THEN USE_THEN "F6" (fun th-> DISCH_THEN (SUBST1_TAC o MATCH_MP th)) + THEN REWRITE_TAC[COM_POWER_FUNCTION] + THEN USE_THEN "H2" (fun th-> USE_THEN "F6"(fun th1-> REWRITE_TAC[MATCH_MP th1 (ONCE_REWRITE_RULE[GSYM LE_SUC] th)])); ALL_TAC] + THEN USE_THEN "H1" ((X_CHOOSE_THEN `d:num` (MP_TAC o REWRITE_RULE[GSYM ADD1] o ONCE_REWRITE_RULE[ADD_SYM]) o REWRITE_RULE[LE_EXISTS])) + THEN DISCH_THEN (fun th-> LABEL_TAC "H3" th THEN SUBST1_TAC th) + THEN GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [GSYM COM_POWER_FUNCTION; lemma_inverse_evaluation] + THEN USE_THEN "H3" (fun th-> USE_THEN "H2" (MP_TAC o REWRITE_RULE[th])) + THEN DISCH_THEN (MP_TAC o MATCH_MP LE_TRANS o CONJ (SPEC `d:num` LE_PLUS)) + THEN DISCH_THEN (fun th-> MP_TAC(MATCH_MP LE_TRANS (CONJ th (SPEC `m:num` LE_PLUS)))) + THEN DISCH_THEN (fun th-> USE_THEN "F6" (fun th1-> REWRITE_TAC[MATCH_MP th1 th; COM_POWER_FUNCTION])) + THEN USE_THEN "H3" (fun th-> USE_THEN "H2" (MP_TAC o REWRITE_RULE[th])) + THEN DISCH_THEN (fun th-> MP_TAC (MATCH_MP LE_TRANS (CONJ th (SPEC `m:num` LE_PLUS)))) + THEN USE_THEN "F6"(fun th-> DISCH_THEN (fun th1-> REWRITE_TAC[MATCH_MP th th1])); ALL_TAC] + THEN USE_THEN "F7" (fun th-> REWRITE_TAC[th]) + THEN SUBGOAL_THEN `!i:num. 1 <= i /\ i <= (m:num) ==> (fmap (H:(A)hypermap) NF POWER i) (atom H L x) = {(face_map H POWER i) x}` (LABEL_TAC "F8") + THENL[INDUCT_TAC THENL[REWRITE_TAC[LE_0; POWER_0; I_THM] THEN ARITH_TAC; ALL_TAC] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "H1") (LABEL_TAC "H2")) + THEN ASM_CASES_TAC `i:num = 0` + THENL[POP_ASSUM (LABEL_TAC "H3") + THEN USE_THEN "H3" (fun th-> REWRITE_TAC[th; GSYM ONE; POWER_1; I_THM]) + THEN USE_THEN "F2" (fun th->USE_THEN "F3"(fun th1->USE_THEN "F4"(fun th2-> REWRITE_TAC[MATCH_MP unique_fmap (CONJ3 th th1 th2)]))) + THEN USE_THEN "F5" SUBST1_TAC + THEN USE_THEN "F7" (MP_TAC o SPEC `SUC 0`) + THEN USE_THEN "H2" MP_TAC THEN USE_THEN "H3" SUBST1_TAC THEN REWRITE_TAC[GSYM ONE] + THEN DISCH_THEN (fun th-> REWRITE_TAC[th; LE_REFL; POWER_1]) + THEN USE_THEN "F6" (fun th-> REWRITE_TAC[REWRITE_RULE[GE_1; POWER_1] (SPEC `1` th)]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "H3" o REWRITE_RULE[GSYM LT_NZ; GSYM LT1_NZ]) + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [GSYM COM_POWER_FUNCTION] + THEN FIRST_ASSUM (MP_TAC o check (is_imp o concl)) + THEN USE_THEN "H3"(fun th->USE_THEN "H2" (fun th1-> REWRITE_TAC[th; MATCH_MP LE_TRANS (CONJ (SPEC `i:num` LE_PLUS)th1)])) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F4" (MP_TAC o SPEC `i:num` o MATCH_MP lemma_power_next_in_loop) + THEN USE_THEN "F7" (MP_TAC o SPEC `i:num`) + THEN USE_THEN "H3" (fun th1-> (USE_THEN "H2"(fun th-> REWRITE_TAC[th1; MATCH_MP LE_TRANS (CONJ (SPEC `i:num` LE_PLUS) th)]))) + THEN USE_THEN "F6" (MP_TAC o SPEC `i:num`) + THEN USE_THEN "H2" (fun th-> MP_TAC (MATCH_MP LE_TRANS (CONJ (SPEC `i:num` LE_PLUS) th))) + THEN DISCH_THEN (fun th -> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ th (SPEC `m:num` LE_PLUS))]) + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "H4") + THEN USE_THEN "H4" (fun th-> GEN_REWRITE_TAC (RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [SYM th]) + THEN REWRITE_TAC[GSYM COM_POWER_FUNCTION] + THEN ABBREV_TAC `u = (face_map (H:(A)hypermap) POWER i) x` + THEN DISCH_THEN (LABEL_TAC "H5") + THEN USE_THEN "F2" (fun th->USE_THEN "F3"(fun th1->USE_THEN "H5"(fun th2-> REWRITE_TAC[MATCH_MP unique_fmap (CONJ3 th th1 th2)]))) + THEN USE_THEN "F2" (fun th->USE_THEN "F3"(fun th1->USE_THEN "H5"(fun th2-> MP_TAC(CONJUNCT1(MATCH_MP head_on_loop (CONJ3 th th1 th2)))))) + THEN USE_THEN "H4" SUBST1_TAC + THEN REWRITE_TAC[IN_SING] + THEN DISCH_THEN SUBST1_TAC THEN EXPAND_TAC "u" + THEN REWRITE_TAC[COM_POWER_FUNCTION] + THEN USE_THEN "H2" (fun th-> MP_TAC (MATCH_MP LE_TRANS (CONJ th (SPEC `m:num` LE_PLUS)))) + THEN DISCH_THEN(fun th->USE_THEN "F6"(fun th1->GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [SYM(MATCH_MP th1 th)])) + THEN USE_THEN "H1"(fun th->USE_THEN "H2"(fun th1->USE_THEN "F7"(fun th2-> REWRITE_TAC [MATCH_MP th2 (CONJ th th1)]))); ALL_TAC] + THEN USE_THEN "F8" (fun th-> REWRITE_TAC[th]) + THEN ASM_CASES_TAC `m = 0` + THENL[POP_ASSUM SUBST1_TAC THEN REWRITE_TAC[GSYM ONE; POWER_1] + THEN USE_THEN "F2" (fun th->USE_THEN "F3"(fun th1->USE_THEN "F4"(fun th2-> REWRITE_TAC[MATCH_MP unique_fmap (CONJ3 th th1 th2)]))) + THEN USE_THEN "F5" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "H1" o REWRITE_RULE[GSYM LT_NZ; GSYM LT1_NZ]) + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV)[GSYM COM_POWER_FUNCTION] + THEN USE_THEN "H1" (fun th-> USE_THEN "F8" (SUBST1_TAC o REWRITE_RULE[th; LE_REFL] o SPEC `m:num`)) + THEN USE_THEN "F4" (MP_TAC o SPEC `m:num` o MATCH_MP lemma_power_next_in_loop) + THEN USE_THEN "F7" (MP_TAC o SPEC `m:num`) + THEN USE_THEN "H1" (fun th-> REWRITE_TAC[th; LE_REFL]) + THEN USE_THEN "F6" (MP_TAC o REWRITE_RULE[LE_PLUS] o SPEC `m:num`) + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "H2") + THEN USE_THEN "H2" (fun th-> GEN_REWRITE_TAC (RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [SYM th]) + THEN REWRITE_TAC[GSYM COM_POWER_FUNCTION] + THEN ABBREV_TAC `u = (face_map (H:(A)hypermap) POWER m) x` + THEN DISCH_THEN (LABEL_TAC "H3") + THEN USE_THEN "F2" (fun th->USE_THEN "F3"(fun th1->USE_THEN "H3"(fun th2-> REWRITE_TAC[MATCH_MP unique_fmap (CONJ3 th th1 th2)]))) + THEN USE_THEN "F2" (fun th->USE_THEN "F3"(fun th1->USE_THEN "H3"(fun th2-> MP_TAC(CONJUNCT1(MATCH_MP head_on_loop (CONJ3 th th1 th2)))))) + THEN USE_THEN "H2" SUBST1_TAC + THEN REWRITE_TAC[IN_SING] + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]));; + +let lemma_atom_on_inside_dart = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_split_condition H NF L x ==> (!i:num. 1 <= i /\ i <= mInside H NF L x ==> ((face_map (quotient H NF) POWER i) (atom H L x) = {(face_map H POWER i) x})) /\ ((face_map (quotient H NF) POWER (SUC(mInside H NF L x))) (atom H L x) = atom H L (heading H NF L x))`, + REPEAT GEN_TAC THEN DISCH_THEN (LABEL_TAC "FC") + THEN USE_THEN "FC" (MP_TAC o REWRITE_RULE[is_split_condition]) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (LABEL_TAC "F6")))))) + THEN REWRITE_TAC[heading] + THEN USE_THEN "FC" (MP_TAC o CONJUNCT1 o MATCH_MP lemma_mInside) + THEN USE_THEN "F6" MP_TAC THEN USE_THEN "F5" MP_TAC THEN USE_THEN "F3" MP_TAC THEN USE_THEN "F2" MP_TAC THEN USE_THEN "F1" MP_TAC + THEN ABBREV_TAC `m = mInside (H:(A)hypermap) NF L x` THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_face_contour_on_loop th]));; + +let lemma_mInside_and_length_cycle = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_split_condition H NF L x + ==> SUC (mInside H NF L x) < CARD (cycle H L)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN USE_THEN "F1" ((CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 MP_TAC (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7")))))) o REWRITE_RULE[is_split_condition]) + THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] + THEN REWRITE_TAC[NOT_LT; CONJUNCT2 LE] + THEN STRIP_TAC + THENL[MP_TAC (SPEC `atom (H:(A)hypermap) (L:(A)loop) (x:A)` (MATCH_MP lemma_cycle_orbit (ISPEC `quotient (H:(A)hypermap) (NF:(A)loop->bool)` face_map_and_darts))) + THEN USE_THEN "F3"(fun th->(USE_THEN "F4"(fun th2->(USE_THEN "F6"(fun th3-> MP_TAC(GSYM(MATCH_MP lemma_cycle_is_face (CONJ th (CONJ th2 th3))))))))) + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[GSYM(MATCH_MP lemma_quotient th)]) + THEN DISCH_THEN SUBST1_TAC + THEN POP_ASSUM SUBST1_TAC + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_atom_on_inside_dart th]) + THEN DISCH_TAC + THEN MP_TAC (SPECL[`H:(A)hypermap`; `L:(A)loop`; `heading (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)`] atom_reflect) + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_THEN (fun th-> (MP_TAC (MATCH_MP lemma_in_subset (CONJ (SPECL[`H:(A)hypermap`; `L:(A)loop`; `x:A`] lemma_atom_sub_node) th)))) + THEN DISCH_THEN (MP_TAC o SYM o MATCH_MP lemma_node_identity) + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_on_heading th]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F10") + THEN USE_THEN "F1" (MP_TAC o SPEC `CARD (cycle (H:(A)hypermap) (L:(A)loop))` o CONJUNCT1 o MATCH_MP lemma_atom_on_inside_dart) + THEN USE_THEN "F10" (fun th-> REWRITE_TAC[th]) + THEN SUBGOAL_THEN `1 <= CARD (cycle (H:(A)hypermap) (L:(A)loop))` (LABEL_TAC "F11") + THENL[MATCH_MP_TAC CARD_ATLEAST_1 + THEN EXISTS_TAC `atom (H:(A)hypermap) (L:(A)loop) (x:A)` + THEN USE_THEN "F3" (fun th-> (USE_THEN "F4"(fun th1-> REWRITE_TAC[MATCH_MP lemma_cycle_finite (CONJ th th1)]))) + THEN USE_THEN "F6" (fun th-> REWRITE_TAC[MATCH_MP lemma_in_cycle2 th]); ALL_TAC] + THEN USE_THEN "F11" (fun th-> REWRITE_TAC[th]) + THEN MP_TAC (SPEC `atom (H:(A)hypermap) (L:(A)loop) (x:A)` (MATCH_MP lemma_cycle_orbit (ISPEC `quotient (H:(A)hypermap) (NF:(A)loop->bool)` face_map_and_darts))) + THEN USE_THEN "F3"(fun th->(USE_THEN "F4"(fun th2->(USE_THEN "F6"(fun th3-> MP_TAC(GSYM(MATCH_MP lemma_cycle_is_face (CONJ th (CONJ th2 th3))))))))) + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[GSYM(MATCH_MP lemma_quotient th)]) + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_THEN SUBST1_TAC + THEN ABBREV_TAC `n = CARD (cycle (H:(A)hypermap) (L:(A)loop))` THEN DISCH_TAC + THEN MP_TAC (SPECL[`(H:(A)hypermap)`;`(L:(A)loop)`; `(x:A)`] atom_reflect) + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[IN_SING] + THEN DISCH_THEN (LABEL_TAC "F12" o SYM) + THEN SUBGOAL_THEN `!i:num. i <= n:num ==> (next (L:(A)loop) POWER i) (x:A) = (face_map (H:(A)hypermap) POWER i) x` (LABEL_TAC "F14") + THENL[REPEAT STRIP_TAC + THEN USE_THEN "F1" (MP_TAC o SPEC `i:num` o CONJUNCT1 o MATCH_MP lemma_mInside) + THEN POP_ASSUM(fun th-> USE_THEN "F10" (fun th1 -> MP_TAC (MATCH_MP LE_TRANS (CONJ th th1)))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ th (SPEC `mInside (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` LE_PLUS))]) + ; ALL_TAC] + THEN USE_THEN "F14" (MP_TAC o REWRITE_RULE[LE_REFL] o SPEC `n:num`) + THEN USE_THEN "F12" SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "F15") + THEN USE_THEN "F2"(fun th->USE_THEN "F3"(fun th1->USE_THEN "F4" (fun th2-> REWRITE_TAC[MATCH_MP lemma_true_loop (CONJ th (CONJ th1 th2))]))) + THEN EXISTS_TAC `x:A` + THEN USE_THEN "F15" MP_TAC THEN USE_THEN "F14" MP_TAC THEN USE_THEN "F6" MP_TAC THEN USE_THEN "F11" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_loop_eq_face th]));; + +let lemma_mAdd_Exists = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_split_condition H NF L x ==> + ?p:num. (!i:num. 1 <= i /\ i <= p ==> ~((face_map H POWER i) (heading H NF L x) IN support_darts NF)) + /\ ((face_map H POWER (SUC p)) (heading H NF L x) IN support_darts NF)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN ABBREV_TAC `y = heading (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "F2") + THEN SUBGOAL_THEN `?n:num. 1 <= n /\ (face_map (H:(A)hypermap) POWER n) (y:A) IN support_darts (NF:(A)loop->bool)` ASSUME_TAC + THENL[POP_ASSUM (MP_TAC o SYM o REWRITE_RULE[heading]) + THEN REWRITE_TAC[MATCH_MP inverse_power_function (CONJUNCT2 (SPEC `H:(A)hypermap` face_map_and_darts))] + THEN MP_TAC (SPEC `SUC (mInside (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A))` (MATCH_MP power_inverse_element_lemma (SPEC `H:(A)hypermap` face_map_and_darts))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` SUBST1_TAC) + THEN DISCH_THEN (MP_TAC o AP_TERM `face_map (H:(A)hypermap) POWER (CARD (face H (x:A)))`) + THEN REWRITE_TAC[lemma_face_cycle; GSYM lemma_add_exponent_function] + THEN ABBREV_TAC `k = CARD (face (H:(A)hypermap) (x:A)) + (j:num)` + THEN POP_ASSUM (fun th-> (LABEL_TAC "F2" (MATCH_MP (ARITH_RULE `!m:num n:num t:num. 1 <= m /\ m + n = t ==> 1 <= t`) (CONJ (SPECL[`H:(A)hypermap`; `x:A`] FACE_NOT_EMPTY) th)))) + THEN DISCH_THEN (ASSUME_TAC o SYM) + THEN EXISTS_TAC `k:num` THEN POP_ASSUM (SUBST1_TAC) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN REWRITE_TAC[lemma_in_support] THEN EXISTS_TAC `L:(A)loop` + THEN POP_ASSUM (fun th-> (REWRITE_TAC[REWRITE_RULE[is_split_condition] th])); ALL_TAC] + THEN POP_ASSUM (MP_TAC o ONCE_REWRITE_RULE[num_WOP]) + THEN DISCH_THEN (X_CHOOSE_THEN `n:num` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (MP_TAC o REWRITE_RULE[LE_EXISTS]) (LABEL_TAC "F3")) (LABEL_TAC "F4"))) + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [ADD_SYM] + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` (SUBST_ALL_TAC o REWRITE_RULE[GSYM ADD1])) + THEN EXISTS_TAC `d:num` THEN REMOVE_THEN "F3" (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[LT_SUC_LE; DE_MORGAN_THM]) + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [TAUT `(A ==> ~B \/ C) <=> (A /\ B ==> C)`] THEN SIMP_TAC[]);; + +let lemma_mAdd = new_specification["mAdd"] (REWRITE_RULE[GSYM RIGHT_EXISTS_IMP_THM; SKOLEM_THM] lemma_mAdd_Exists);; + +let is_marked = new_definition `!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_marked H NF L x <=> is_restricted H /\ is_normal H NF /\ L IN NF /\ x belong L /\ next L x = face_map H x /\ simple_hypermap (quotient H NF) /\ is_node_nondegenerate (quotient H NF) /\ (edge_map H x IN canon_darts H NF) /\ +(L IN canon H NF ==> canon_flag H NF) /\ (~(L IN canon H NF) ==> flag H NF L x)`;; + +let lemma_marked_dart = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_marked H NF L x + ==> head H NF x = x /\ inverse (node_map H) x IN canon_darts H NF`, + REPEAT GEN_TAC + THEN REWRITE_TAC[is_marked] + THEN DISCH_THEN(CONJUNCTS_THEN2(LABEL_TAC "F1")(CONJUNCTS_THEN2(LABEL_TAC "F2")(CONJUNCTS_THEN2(LABEL_TAC "F3")(CONJUNCTS_THEN2(LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (ASSUME_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2)))))) + THEN USE_THEN "F1"(fun th->USE_THEN "F2"(fun th1->USE_THEN "F3"(fun th2->USE_THEN "F4"(fun th3->MP_TAC(MATCH_MP lemma_head_via_restricted (CONJ th (CONJ th1 (CONJ th2 th3)))))))) + THEN USE_THEN "F5" (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[lemma_in_canon_darts]) + THEN DISCH_THEN (X_CHOOSE_THEN `L':(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7"))) + THEN USE_THEN "F7" (MP_TAC o REWRITE_RULE[POWER_1] o SPEC `1` o MATCH_MP lemma_power_next_in_loop) + THEN USE_THEN "F6" (fun th-> USE_THEN "F7" (fun th1-> MP_TAC (REWRITE_RULE[POWER_1] (SPEC `1` (MATCH_MP lemma_power_canon_next (CONJ th th1)))))) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN ONCE_REWRITE_TAC[CONJUNCT1 (SPEC `H:(A)hypermap` inverse2_hypermap_maps)] + THEN REWRITE_TAC[o_THM; MATCH_MP PERMUTES_INVERSES (CONJUNCT2(SPEC `H:(A)hypermap` face_map_and_darts))] + THEN USE_THEN "F6"(fun th-> DISCH_THEN(fun th1-> REWRITE_TAC[MATCH_MP is_in_canon_darts (CONJ th1 th)])));; + +let lemma_split_marked_loop = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_marked H NF L x /\ ~(L IN canon H NF) + ==> is_split_condition H NF L x`, + REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") ASSUME_TAC) THEN REWRITE_TAC[is_split_condition] + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_marked_dart th]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[REWRITE_RULE[is_marked] th]));; + +let attach = new_definition `!H:(A)hypermap (NF:(A)loop->bool) (L:(A)loop) (x:A). + attach H NF L x = ((face_map H) POWER (SUC (mAdd H NF L x))) (heading H NF L x)`;; + +let lemma_new_darts_in_face = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. heading H NF L x IN face H x /\ attach H NF L x IN face H x`, + REWRITE_TAC[attach; heading; GSYM lemma_add_exponent_function; lemma_in_face]);; + +let lemma_on_attach = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_split_condition H NF L x + ==> ~(node H (heading H NF L x) = node H (attach H NF L x)) /\ SUC (mAdd H NF L x) < CARD (face H x)`, + REPEAT GEN_TAC + THEN DISCH_THEN (LABEL_TAC "F1") + THEN USE_THEN "F1" (LABEL_TAC "F2" o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_split_condition]) + THEN USE_THEN "F1"((CONJUNCTS_THEN2 (LABEL_TAC "F6")(CONJUNCTS_THEN2(LABEL_TAC "F7")(LABEL_TAC "F8" o CONJUNCT1))) o REWRITE_RULE[is_split_condition]) + THEN USE_THEN "F7"(fun th->USE_THEN "F8"(fun th1->USE_THEN "F2" (fun th2->LABEL_TAC "FA" (MATCH_MP lemma_in_dart (CONJ th (CONJ th1 th2)))))) + THEN STRIP_TAC + THENL[ USE_THEN "F1" (LABEL_TAC "F3" o CONJUNCT1 o MATCH_MP lemma_mInside) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT1 o MATCH_MP lemma_mAdd) + THEN GEN_REWRITE_TAC (LAND_CONV o TOP_DEPTH_CONV) [TAUT `(A ==> ~B) <=> ~(A /\B)`; GSYM NOT_EXISTS_THM] + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN ABBREV_TAC `m = mInside (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "F4") + THEN REWRITE_TAC[attach] + THEN ABBREV_TAC `p = mAdd (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN ABBREV_TAC `y = heading (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN DISCH_TAC THEN MP_TAC (SPECL[`H:(A)hypermap`; `y:A`; `SUC p`] lemma_in_face) + THEN MP_TAC(SPECL[`H:(A)hypermap`; `(face_map (H:(A)hypermap) POWER (SUC p)) (y:A)`] node_refl) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN REWRITE_TAC[IMP_IMP; GSYM IN_INTER] + THEN POP_ASSUM (LABEL_TAC "F5") + THEN USE_THEN "FA" (MP_TAC o SPEC `SUC m` o MATCH_MP lemma_dart_invariant_power_face) + THEN EXPAND_TAC "m" THEN USE_THEN "F5" (fun th-> REWRITE_TAC[GSYM heading; th]) + THEN DISCH_THEN (LABEL_TAC "F9") + THEN USE_THEN "F6" (ASSUME_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN USE_THEN "F9" (fun th-> (POP_ASSUM (fun th1-> REWRITE_TAC[MATCH_MP (REWRITE_RULE[simple_hypermap] th1) th; IN_SING]))) + THEN ASM_CASES_TAC `p:num = 0` + THENL[POP_ASSUM (fun th-> REWRITE_TAC[th; GSYM ONE; POWER_1]) + THEN ONCE_REWRITE_TAC[SPEC `face_map (H:(A)hypermap)` orbit_one_point] + THEN DISCH_THEN (ASSUME_TAC o REWRITE_RULE[GSYM face]) + THEN USE_THEN "F6" (MP_TAC o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN DISCH_THEN (MP_TAC o SPEC `y:A`) + THEN POP_ASSUM SUBST1_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[th; CARD_SINGLETON]) THEN ARITH_TAC; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F10" o REWRITE_RULE[GSYM LT_NZ; GSYM LT1_NZ]) + THEN USE_THEN "F5" (fun th-> GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[SYM th]) + THEN REWRITE_TAC[heading; COM_POWER; o_THM;face_map_injective] + THEN USE_THEN "F4" SUBST1_TAC + THEN USE_THEN "F3" (fun th-> MP_TAC(MATCH_MP th (MATCH_MP LT_IMP_LE (SPEC `m:num` LT_PLUS)))) + THEN DISCH_THEN (SUBST1_TAC o SYM) THEN DISCH_TAC THEN EXISTS_TAC `p:num` THEN POP_ASSUM SUBST1_TAC + THEN POP_ASSUM (fun th-> REWRITE_TAC[th; LE_REFL]) + THEN MATCH_MP_TAC lemma_in_support2 + THEN EXISTS_TAC `L:(A)loop` THEN USE_THEN "F8" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F2" (fun th-> REWRITE_TAC[MATCH_MP lemma_power_next_in_loop th]); ALL_TAC] + THEN SUBGOAL_THEN `1 < CARD (face (H:(A)hypermap) (x:A))` MP_TAC + THENL[ + USE_THEN "F6" (MP_TAC o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN DISCH_THEN (fun th-> USE_THEN "FA" (MP_TAC o MATCH_MP th)) + THEN REWRITE_TAC[THREE] THEN ARITH_TAC; ALL_TAC] + THEN DISCH_THEN ((X_CHOOSE_THEN `d:num` (MP_TAC o REWRITE_RULE[GSYM ADD1] o ONCE_REWRITE_RULE[ADD_SYM])) o REWRITE_RULE[LT_EXISTS]) + THEN DISCH_THEN (LABEL_TAC "F9") THEN USE_THEN "F9" SUBST1_TAC THEN REWRITE_TAC[LT_SUC] + THEN USE_THEN "F1" (MP_TAC o SPEC `PRE (CARD (face (H:(A)hypermap) (x:A)))` o CONJUNCT1 o MATCH_MP lemma_mAdd) + THEN USE_THEN "F9" SUBST1_TAC THEN REWRITE_TAC[PRE; GE_1] + THEN REWRITE_TAC[GSYM NOT_LT] + THEN REWRITE_TAC[CONTRAPOS_THM] THEN SIMP_TAC[] THEN DISCH_THEN (fun th-> (MATCH_MP_TAC th)) + THEN REWRITE_TAC[heading] + THEN REWRITE_TAC[GSYM (SPEC `face_map (H:(A)hypermap)` lemma_add_exponent_function)] + THEN ONCE_REWRITE_TAC[ADD_SYM] + THEN REWRITE_TAC[ARITH_RULE `!m:num n:num. (SUC m) + (SUC n) = m + SUC (SUC n)`] + THEN USE_THEN "F9" (SUBST1_TAC o SYM) + THEN REWRITE_TAC[SPEC `face_map (H:(A)hypermap)` lemma_add_exponent_function] + THEN REWRITE_TAC[lemma_face_cycle] + THEN USE_THEN "F1" (MP_TAC o SPEC `mInside (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` o CONJUNCT1 o MATCH_MP lemma_mInside) + THEN REWRITE_TAC[LE_PLUS] + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN MATCH_MP_TAC lemma_in_support2 + THEN EXISTS_TAC `L:(A)loop` THEN USE_THEN "F2" (fun th-> REWRITE_TAC[MATCH_MP lemma_power_next_in_loop th]) + THEN USE_THEN "F8" (fun th-> REWRITE_TAC[th]));; + +let lemmaLoopSeparation = prove(`!(H:(A)hypermap) L:(A)loop p:num->A k:num. is_loop H L /\ 1 <= k /\ is_contour H p k /\ (p 0) belong L /\ p 1 = face_map H (p 0) /\ (!i:num. 1 <= i /\ i <= k ==> ~((p i) belong L)) /\ ~(node H (p 0) = node H (p k)) /\ (?y:A. y IN node H (p k) /\ y belong L) ==> ~(planar_hypermap H)`, + REPEAT GEN_TAC THEN (DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2"))) + THEN SUBGOAL_THEN `?g:num->A m:num. is_Moebius_contour (H:(A)hypermap) (g:num->A) (m:num)` MP_TAC + THENL[POP_ASSUM MP_TAC + THEN GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [ARITH_RULE `!i:num. 1 <= i:num <=> 0 < i`] + THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] + THEN REWRITE_TAC[NOT_EXISTS_THM] THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (MP_TAC o MATCH_MP lemmaICJHAOQ) THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_TAC THEN EXISTS_TAC `p:num->A` THEN EXISTS_TAC `k:num` THEN ASM_REWRITE_TAC[]; ALL_TAC] + THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN REWRITE_TAC[lemmaLIPYTUI]);; + +let lemmaHQYMRTX = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_marked H NF L x /\ ~(L IN canon H NF) + ==> attach H NF L x belong L /\ (!k:num. 1 <= k /\ k <= SUC (mInside H NF L x) ==> ~(attach H NF L x = ((face_map H) POWER k) x))`, + REPEAT GEN_TAC + THEN DISCH_THEN (fun th -> LABEL_TAC "FC" (CONJUNCT1 th) THEN LABEL_TAC "F1" (MATCH_MP lemma_split_marked_loop th)) + THEN USE_THEN "F1" ((CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (CONJUNCTS_THEN2 (LABEL_TAC "F7") (LABEL_TAC "F8")))))) o REWRITE_RULE[is_split_condition]) + THEN SUBGOAL_THEN `flag (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` (LABEL_TAC "F2") + THENL[USE_THEN "F6" MP_TAC THEN USE_THEN "FC" (fun th-> REWRITE_TAC[REWRITE_RULE[is_marked] th]); ALL_TAC] + THEN USE_THEN "F1" ((CONJUNCTS_THEN2 (LABEL_TAC "F9") (LABEL_TAC "F10")) o MATCH_MP lemma_mInside) + THEN USE_THEN "F1"((CONJUNCTS_THEN2 (LABEL_TAC "F11" o REWRITE_RULE[heading])(LABEL_TAC "F12" o REWRITE_RULE[heading])) o MATCH_MP lemma_mAdd) + THEN USE_THEN "F1" (LABEL_TAC "HD" o REWRITE_RULE[heading] o CONJUNCT1 o MATCH_MP lemma_on_heading) + THEN REWRITE_TAC[attach; heading] + THEN ABBREV_TAC `m = mInside (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "MN") + THEN ABBREV_TAC `p = mAdd (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "PN") + THEN ABBREV_TAC `y = (face_map (H:(A)hypermap) POWER (SUC m)) (x:A)` + THEN POP_ASSUM (LABEL_TAC "F14") + THEN ABBREV_TAC `z = (face_map (H:(A)hypermap) POWER (SUC p)) (y:A)` + THEN POP_ASSUM (LABEL_TAC "F15") + THEN SUBGOAL_THEN `!k:num. 1 <= k /\ k <= SUC m ==> ~((z:A) = (face_map H POWER k) (x:A))` (LABEL_TAC "F16") + THENL[GEN_TAC + THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] + THEN REWRITE_TAC[DE_MORGAN_THM; NOT_LE] + THEN USE_THEN "F15" (SUBST1_TAC o SYM) + THEN ASM_CASES_TAC `k:num < 1` + THENL[POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[GSYM ADD1] o ONCE_REWRITE_RULE[GSYM ADD_SYM] o REWRITE_RULE[NOT_LT; LE_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` SUBST1_TAC) + THEN REWRITE_TAC[COM_POWER; o_THM; face_map_injective] + THEN DISCH_THEN (LABEL_TAC "G1") + THEN ASM_CASES_TAC `p:num = 0` + THENL[POP_ASSUM (fun th-> POP_ASSUM (MP_TAC o REWRITE_RULE[th; POWER_0; I_THM])) + THEN USE_THEN "F14" (SUBST1_TAC o SYM) + THEN USE_THEN "F1" (MP_TAC o MATCH_MP lemma_bound_mInside) + THEN USE_THEN "MN" (fun th-> REWRITE_TAC[th]) + THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_congruence_on_face) + THEN DISCH_THEN (X_CHOOSE_THEN `q:num` MP_TAC) THEN ARITH_TAC ; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "G2" o REWRITE_RULE[GSYM LT_NZ; GSYM LT1_NZ]) + THEN ASM_CASES_TAC `SUC m < SUC d` THENL[POP_ASSUM (fun th-> SIMP_TAC[th]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "G3" o REWRITE_RULE[NOT_LT]) + THEN USE_THEN "F11" (MP_TAC o SPEC `p:num`) + THEN USE_THEN "G2" (fun th-> REWRITE_TAC[th; LE_REFL]) + THEN DISCH_TAC + THEN USE_THEN "F7" (MP_TAC o SPEC `d:num` o MATCH_MP lemma_power_next_in_loop) + THEN USE_THEN "F9" (MP_TAC o SPEC `d:num`) + THEN USE_THEN "G3" (fun th-> (REWRITE_TAC[MATCH_MP LE_TRANS (CONJ (MATCH_MP LT_IMP_LE (SPEC `d:num` LT_PLUS)) th)])) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "G1" (SUBST1_TAC o SYM) + THEN DISCH_THEN (fun th-> USE_THEN "F5" (fun th1 -> MP_TAC(MATCH_MP lemma_in_support2 (CONJ th th1)))) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN USE_THEN "F16" (fun th-> REWRITE_TAC[th]) + THEN REMOVE_THEN "F12" (MP_TAC o REWRITE_RULE[lemma_in_support]) + THEN DISCH_THEN (X_CHOOSE_THEN `L':(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "F17") (LABEL_TAC "F18"))) + THEN ASM_CASES_TAC `L':(A)loop = L:(A)loop` + THENL[POP_ASSUM (SUBST1_TAC o SYM) THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F19") + THEN ASM_CASES_TAC `L':(A)loop IN canon (H:(A)hypermap) (NF:(A)loop->bool)` + THENL[POP_ASSUM (LABEL_TAC "G4") + THEN USE_THEN "F15" MP_TAC THEN USE_THEN "F14" (SUBST1_TAC o SYM) + THEN REWRITE_TAC[GSYM lemma_add_exponent_function] + THEN DISCH_THEN (fun th-> MP_TAC (MATCH_MP power_power_relation (REWRITE_RULE[GSYM CONJ_ASSOC](CONJ (SPEC `H:(A)hypermap` face_map_and_darts) th)))) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` MP_TAC) + THEN USE_THEN "G4" (fun th-> USE_THEN "F18" (fun th1 -> REWRITE_TAC[MATCH_MP lemma_power_canon_next (CONJ th th1)])) + THEN DISCH_TAC THEN USE_THEN "F18" (MP_TAC o SPEC `j:num` o MATCH_MP lemma_power_next_in_loop) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN USE_THEN "F7" MP_TAC THEN USE_THEN "F17" MP_TAC THEN USE_THEN "F5" MP_TAC THEN USE_THEN "F4" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP disjoint_loops) + THEN DISCH_THEN SUBST1_TAC THEN USE_THEN "F18" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F20") + THEN USE_THEN "F4"(fun th->USE_THEN "F17"(fun th1->USE_THEN "F18"(fun th2->LABEL_TAC "F21"(CONJUNCT1(MATCH_MP head_on_loop (CONJ th (CONJ th1 th2))))))) + THEN USE_THEN "F21"(fun th->USE_THEN "F18"(fun th1-> LABEL_TAC "F22"(MATCH_MP lemma_in_loop (CONJ th1 th)))) + THEN SUBGOAL_THEN `~(head (H:(A)hypermap) (NF:(A)loop->bool) (z:A) IN dart_inside H NF (L:(A)loop) x)` (LABEL_TAC "F23") + THENL[USE_THEN "F19" MP_TAC THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "F1" (MP_TAC o MATCH_MP lemma_dart_inside_sub_loop) THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (MP_TAC o REWRITE_RULE[GSYM belong] o MATCH_MP lemma_in_subset) + THEN USE_THEN "F22" MP_TAC THEN USE_THEN "F5" MP_TAC THEN USE_THEN "F17" MP_TAC THEN USE_THEN "F4" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN MESON_TAC[disjoint_loops]; ALL_TAC] + THEN USE_THEN "F23" MP_TAC THEN USE_THEN "F18" MP_TAC THEN USE_THEN "F20" MP_TAC THEN USE_THEN "F17" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN USE_THEN "F2"(fun th-> DISCH_THEN (MP_TAC o MATCH_MP (CONJUNCT2 (REWRITE_RULE[flag] th)))) + THEN REWRITE_TAC[IN_UNION] + THEN STRIP_TAC + THENL[POP_ASSUM (MP_TAC o REWRITE_RULE[lemma_in_canon_darts]) + THEN ABBREV_TAC `u = head (H:(A)hypermap) (NF:(A)loop->bool) (z:A)` + THEN POP_ASSUM (LABEL_TAC "H1") + THEN DISCH_THEN (X_CHOOSE_THEN `K:(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "H2") (LABEL_TAC "H3"))) + THEN USE_THEN "H3" (MP_TAC o REWRITE_RULE[POWER_1] o SPEC `1` o MATCH_MP lemma_power_next_in_loop) + THEN USE_THEN "H2" (fun th-> USE_THEN "H3" (fun th1-> MP_TAC (REWRITE_RULE[POWER_1] (SPEC `1` (MATCH_MP lemma_power_canon_next (CONJ th th1)))))) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN REWRITE_TAC[CONJUNCT1 (SPEC `H:(A)hypermap` inverse2_hypermap_maps); o_THM] + THEN REWRITE_TAC[MATCH_MP PERMUTES_INVERSES (CONJUNCT2(SPEC `H:(A)hypermap` face_map_and_darts))] + THEN DISCH_THEN (LABEL_TAC "H4") + THEN USE_THEN "FC" (LABEL_TAC "H5" o CONJUNCT2 o MATCH_MP lemma_marked_dart) + THEN USE_THEN "F18"(fun th-> USE_THEN "F22"(fun th1-> MP_TAC (MATCH_MP lemma_next_power_representation (CONJ th th1)))) + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` (CONJUNCTS_THEN2 (LABEL_TAC "H6") (LABEL_TAC "H7"))) + THEN SUBGOAL_THEN `face_contour (H:(A)hypermap) (y:A) (SUC p) = loop_path (L':(A)loop) (z:A) 0` (LABEL_TAC "HG") + THENL[USE_THEN "F15" (fun th-> REWRITE_TAC[face_contour; loop_path; POWER_0; I_THM; th]); ALL_TAC] + THEN SUBGOAL_THEN `is_contour (H:(A)hypermap) (glue (face_contour H (y:A)) (loop_path (L':(A)loop) (z:A)) (SUC p)) ((SUC p) + (k:num))` (LABEL_TAC "H8") + THENL[MATCH_MP_TAC lemma_glue_contours + THEN REWRITE_TAC[lemma_face_contour] + THEN USE_THEN "F17" (fun th -> (USE_THEN "F4" (MP_TAC o CONJUNCT1 o REWRITE_RULE[th] o SPEC `L':(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN DISCH_THEN (fun th-> USE_THEN "F18" (fun th1 -> MP_TAC (CONJUNCT1(MATCH_MP let_order_for_loop (CONJ th th1))))) + THEN USE_THEN "H6"(fun th-> DISCH_THEN (MP_TAC o REWRITE_RULE[th] o SPEC `k:num` o MATCH_MP lemma_sub_inj_contour)) + THEN DISCH_THEN (fun th-> REWRITE_TAC[REWRITE_RULE[lemma_def_inj_contour] th]) + THEN USE_THEN "HG" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN ABBREV_TAC `fway = glue (face_contour H (y:A)) (loop_path (L':(A)loop) (z:A)) (SUC p)` + THEN POP_ASSUM (LABEL_TAC "H9") + THEN USE_THEN "H5" MP_TAC + THEN USE_THEN "H4" (fun th-> USE_THEN "H2" (fun th1-> MP_TAC (MATCH_MP is_in_canon_darts (CONJ th th1)))) + THEN REWRITE_TAC[IMP_IMP] + THEN USE_THEN "F2" (fun th-> DISCH_THEN (MP_TAC o MATCH_MP (CONJUNCT1(REWRITE_RULE[flag] th)))) + THEN DISCH_THEN (X_CHOOSE_THEN `sway:num->A` (X_CHOOSE_THEN `s:num` (CONJUNCTS_THEN2 (LABEL_TAC "H10") (CONJUNCTS_THEN2 (LABEL_TAC "H11") (CONJUNCTS_THEN2 (LABEL_TAC "H12") (LABEL_TAC "H14")))))) + THEN SUBGOAL_THEN `is_contour (H:(A)hypermap) (join (fway:num->A) (sway:num->A) ((SUC p)+(k:num))) (((SUC p)+(k:num))+(s:num)+1)` (LABEL_TAC "H15") + THENL[MATCH_MP_TAC lemma_join_contours + THEN USE_THEN "H8" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "H12" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "H10" (fun th-> REWRITE_TAC[th]) + THEN EXPAND_TAC "fway" + THEN USE_THEN "HG" (fun th-> REWRITE_TAC[MATCH_MP second_glue_evaluation th]) + THEN USE_THEN "H7" (fun th-> REWRITE_TAC[loop_path; SYM th; one_step_contour]); ALL_TAC] + THEN ABBREV_TAC `way = join (fway:num->A) (sway:num->A) ((SUC p) + (k:num))` + THEN SUBGOAL_THEN `~(planar_hypermap (H:(A)hypermap))` MP_TAC + THENL[MATCH_MP_TAC lemmaLoopSeparation + THEN EXISTS_TAC `L:(A)loop` THEN EXISTS_TAC `way:num->A` THEN EXISTS_TAC `((SUC p)+(k:num)) + (s:num) +1` + THEN USE_THEN "H15" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F5" (fun th -> (USE_THEN "F4" (MP_TAC o CONJUNCT1 o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN STRIP_TAC THENL[REWRITE_TAC [ADD_ASSOC; GSYM ADD1; GE_1]; ALL_TAC] + THEN SUBGOAL_THEN `(way:num->A) 0 = (y:A)` SUBST1_TAC + THENL[EXPAND_TAC "way" THEN REWRITE_TAC[join; LE_0] THEN EXPAND_TAC "fway" + THEN REWRITE_TAC[glue; LE_0] THEN REWRITE_TAC[face_contour; POWER_0;I_THM]; ALL_TAC] + THEN USE_THEN "HD" (fun th-> REWRITE_TAC[th]) + THEN STRIP_TAC + THENL[EXPAND_TAC "way" THEN REWRITE_TAC[join] + THEN REWRITE_TAC[CONJUNCT2 ADD; GE_1] THEN EXPAND_TAC "fway" THEN REWRITE_TAC[glue; GE_1; face_contour; POWER_1]; ALL_TAC] + THEN SUBGOAL_THEN `(way:num->A) (((SUC p) +(k:num)) +(s:num) + 1) = inverse (node_map (H:(A)hypermap)) (x:A)` SUBST1_TAC + THENL[EXPAND_TAC "way" THEN GEN_REWRITE_TAC (DEPTH_CONV) [GSYM ADD1] + THEN REWRITE_TAC[second_join_evaluation] THEN USE_THEN "H11" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN STRIP_TAC + THENL[GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "H16") (LABEL_TAC "H17")) + THEN ASM_CASES_TAC `i:num <= (SUC p) + (k:num)` + THENL[POP_ASSUM (LABEL_TAC "H18") + THEN EXPAND_TAC "way" THEN USE_THEN "H18" (fun th -> REWRITE_TAC[join; th]) + THEN ASM_CASES_TAC `i <= SUC p` + THENL[POP_ASSUM (LABEL_TAC "H19") + THEN EXPAND_TAC "fway" + THEN USE_THEN "H19" (fun th -> REWRITE_TAC[glue; th; face_contour]) + THEN ASM_CASES_TAC `i:num = SUC p` + THENL[POP_ASSUM SUBST1_TAC + THEN USE_THEN "H19" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F15" SUBST1_TAC + THEN USE_THEN "F19" MP_TAC THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_TAC THEN MATCH_MP_TAC disjoint_loops + THEN EXISTS_TAC `H:(A)hypermap` THEN EXISTS_TAC `NF:(A)loop->bool` THEN EXISTS_TAC `z:A` + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F18" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F4" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F17" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F5" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (fun th-> POP_ASSUM (fun th1 -> LABEL_TAC "H20" (REWRITE_RULE[LT_SUC_LE ] (REWRITE_RULE[GSYM LT_LE] (CONJ th1 th))))) + THEN USE_THEN "F11" (MP_TAC o SPEC `i:num`) + THEN USE_THEN "H20" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "H16" (fun th-> REWRITE_TAC[th]) + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN (fun th1-> USE_THEN "F5"(fun th-> REWRITE_TAC[MATCH_MP lemma_in_support2 (CONJ th1 th)])); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "H21") + THEN EXPAND_TAC "fway" + THEN USE_THEN "H21" (fun th-> REWRITE_TAC[glue; th]) + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[NOT_LE; LT_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` SUBST1_TAC) + THEN REWRITE_TAC[ADD_SUB2; loop_path] + THEN USE_THEN "F19" MP_TAC THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_TAC THEN MATCH_MP_TAC disjoint_loops + THEN EXISTS_TAC `H:(A)hypermap` THEN EXISTS_TAC `NF:(A)loop->bool` THEN EXISTS_TAC `(next (L':(A)loop) POWER (SUC d)) (z:A)` + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F4" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F17" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F5" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F18" (fun th-> REWRITE_TAC[MATCH_MP lemma_power_next_in_loop th]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "H21") + THEN EXPAND_TAC "way" + THEN USE_THEN "H21" (fun th-> REWRITE_TAC[join; th]) + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[NOT_LE; LT_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` (LABEL_TAC "H22")) + THEN USE_THEN "H22" (SUBST1_TAC) + THEN REWRITE_TAC[ADD_SUB2; PRE] + THEN POP_ASSUM (fun th-> USE_THEN "H17" (LABEL_TAC "H24" o REWRITE_RULE[th; LE_ADD_LCANCEL; GSYM ADD1; LE_SUC])) + THEN USE_THEN "H24" (MP_TAC o REWRITE_RULE[in_list] o SPEC `sway:num->A` o MATCH_MP lemma_element_in_list) + THEN DISCH_THEN (fun th1-> USE_THEN "H14" (fun th-> MP_TAC (MATCH_MP lemma_in_subset (CONJ th th1)))) + THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] + THEN DISCH_THEN (ASSUME_TAC o REWRITE_RULE[]) + THEN MATCH_MP_TAC lemma_not_in_canon_darts + THEN EXISTS_TAC `L:(A)loop` + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F4" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F6" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F5" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN MP_TAC (REWRITE_RULE[POWER_1] (SPECL[`H:(A)hypermap`; `x:A`; `1`] lemma_power_inverse_in_node2)) + THEN DISCH_THEN (SUBST1_TAC o SYM o MATCH_MP lemma_node_identity) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT2 o CONJUNCT2 o MATCH_MP lemma_on_heading) + THEN REWRITE_TAC[heading] + THEN USE_THEN "MN" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F14" SUBST1_TAC + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) THEN EXISTS_TAC `x:A` + THEN USE_THEN "F7" (fun th-> REWRITE_TAC[th; node_refl]); ALL_TAC] + THEN USE_THEN "F3"(fun th-> REWRITE_TAC[REWRITE_RULE[is_restricted] th]); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[dart_inside; IN_ELIM_THM]) + THEN USE_THEN "MN" SUBST1_TAC + THEN ABBREV_TAC `u = head (H:(A)hypermap) (NF:(A)loop->bool) (z:A)` + THEN POP_ASSUM (LABEL_TAC "G1") + THEN DISCH_THEN(X_CHOOSE_THEN `i:num`(CONJUNCTS_THEN2(CONJUNCTS_THEN2(LABEL_TAC "G2")(LABEL_TAC "G3"))(MP_TAC o AP_TERM `face_map (H:(A)hypermap)`))) + THEN REWRITE_TAC[CONJUNCT1(SPEC `H:(A)hypermap` inverse2_hypermap_maps); o_THM; COM_POWER_FUNCTION] + THEN REWRITE_TAC[MATCH_MP PERMUTES_INVERSES (CONJUNCT2 (SPEC `H:(A)hypermap` face_map_and_darts))] + THEN DISCH_THEN (LABEL_TAC "G4") + THEN USE_THEN "F9" (MP_TAC o SPEC `SUC i`) + THEN USE_THEN "G3" (fun th-> REWRITE_TAC[ONCE_REWRITE_RULE[GSYM LE_SUC] th]) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "G5" o SYM) + THEN USE_THEN "F7" (LABEL_TAC "G6" o SPEC `SUC i` o MATCH_MP lemma_power_next_in_loop) + THEN ABBREV_TAC `v = (next (L:(A)loop) POWER (SUC i)) (x:A)` + THEN MP_TAC (REWRITE_RULE[POWER_1] (SPECL[`H:(A)hypermap`; `u:A`; `1`] lemma_power_inverse_in_node2)) + THEN USE_THEN "G5" SUBST1_TAC + THEN DISCH_TAC + THEN USE_THEN "F4"(fun th->(USE_THEN "F17"(fun th2->(USE_THEN "F18"(fun th3->MP_TAC(CONJUNCT1(MATCH_MP head_on_loop (CONJ th (CONJ th2 th3))))))))) + THEN MP_TAC (SPECL[`H:(A)hypermap`; `L':(A)loop`; `z:A`] lemma_atom_sub_node) + THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_in_subset) + THEN USE_THEN "G1" SUBST1_TAC + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_node_identity) + THEN DISCH_THEN (fun th-> POP_ASSUM (LABEL_TAC "G7" o REWRITE_RULE[SYM th])) + THEN SUBGOAL_THEN `~(planar_hypermap (H:(A)hypermap))` MP_TAC + THENL[MATCH_MP_TAC lemmaLoopSeparation + THEN EXISTS_TAC `L:(A)loop` THEN EXISTS_TAC `face_contour (H:(A)hypermap) (y:A)` THEN EXISTS_TAC `SUC p` + THEN REWRITE_TAC[GE_1; lemma_face_contour; face_contour; POWER_0; I_THM; POWER_1] + THEN USE_THEN "F5" (fun th -> (USE_THEN "F4" (MP_TAC o CONJUNCT1 o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "HD" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F1" (MP_TAC o MATCH_MP lemma_on_attach) + THEN REWRITE_TAC[attach; heading] + THEN USE_THEN "MN" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "PN" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F14" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F15" (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (CONJUNCTS_THEN2 (fun th-> REWRITE_TAC[th]) (LABEL_TAC "G8")) + THEN STRIP_TAC + THENL[GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G9") (LABEL_TAC "G10")) + THEN ASM_CASES_TAC `i':num = SUC p` + THENL[POP_ASSUM SUBST1_TAC + THEN USE_THEN "F15" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F19" MP_TAC THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "F18" MP_TAC THEN USE_THEN "F5" MP_TAC THEN USE_THEN "F17" MP_TAC THEN USE_THEN "F4" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN REWRITE_TAC[disjoint_loops]; ALL_TAC] + THEN POP_ASSUM (fun th-> POP_ASSUM(fun th1-> (LABEL_TAC "G11" (REWRITE_RULE[GSYM LT_LE; LT_SUC_LE] (CONJ th1 th))))) + THEN USE_THEN "F11" (MP_TAC o SPEC `i':num`) + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th-> REWRITE_TAC[th])) + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN (fun th-> USE_THEN "F5" (fun th1 -> REWRITE_TAC[MATCH_MP lemma_in_support2 (CONJ th th1)])); ALL_TAC] + THEN EXISTS_TAC `v:A` THEN USE_THEN "G6" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "G7" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN USE_THEN "F3"(fun th-> REWRITE_TAC[REWRITE_RULE[is_restricted] th]));; + +let lemma_route_exists = prove(`!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). is_marked H NF L x /\ ~(L IN canon H NF) + ==> ?q:num. mInside H NF L x < q /\ q < CARD (cycle H L) /\ (face_map (quotient H NF) POWER (SUC q)) (atom H L x) = atom H L (attach H NF L x)`, REPEAT GEN_TAC + THEN DISCH_THEN(fun th ->LABEL_TAC "FC"(CONJUNCT1 th) THEN LABEL_TAC "F1"(MATCH_MP lemma_split_marked_loop th)) + THEN USE_THEN "F1" ((CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (CONJUNCTS_THEN2 (LABEL_TAC "F7") (LABEL_TAC "F8")))))) o REWRITE_RULE[is_split_condition]) + THEN USE_THEN "F1" (LABEL_TAC "F9" o CONJUNCT1 o MATCH_MP lemma_on_heading) + THEN ABBREV_TAC `y = heading (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "F10") + THEN USE_THEN "FC" (fun th-> (USE_THEN "F6" (fun th1 -> (CONJUNCTS_THEN2 (LABEL_TAC "F12") (LABEL_TAC "F14") (MATCH_MP lemmaHQYMRTX (CONJ th th1)))))) + THEN ABBREV_TAC `z = attach (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "F15") + THEN ABBREV_TAC `m = mInside (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "MN") + THEN SUBGOAL_THEN `2 <= CARD (cycle (H:(A)hypermap) (L:(A)loop))` (LABEL_TAC "F16") + THENL[MATCH_MP_TAC CARD_ATLEAST_2 + THEN EXISTS_TAC `atom (H:(A)hypermap) (L:(A)loop) (y:A)` + THEN EXISTS_TAC `atom (H:(A)hypermap) (L:(A)loop) (z:A)` + THEN USE_THEN "F4"(fun th-> USE_THEN "F5" (fun th1 -> REWRITE_TAC[MATCH_MP lemma_cycle_finite (CONJ th th1)])) + THEN USE_THEN "F9" (fun th-> REWRITE_TAC[MATCH_MP lemma_in_cycle2 th]) + THEN USE_THEN "F12" (fun th-> REWRITE_TAC[MATCH_MP lemma_in_cycle2 th]) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT1 o MATCH_MP lemma_on_attach) + THEN USE_THEN "F15" (fun th -> USE_THEN "F10" (fun th1-> REWRITE_TAC[th; th1; CONTRAPOS_THM])) + THEN DISCH_TAC + THEN MP_TAC (SPECL[`H:(A)hypermap`; `L:(A)loop`; `z:A`] atom_reflect) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN DISCH_THEN (fun th-> MP_TAC(MATCH_MP lemma_in_subset (CONJ (SPECL[`H:(A)hypermap`; `L:(A)loop`; `y:A`] lemma_atom_sub_node) th))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_node_identity th]); ALL_TAC] + THEN USE_THEN "F12" (MP_TAC o SPEC `H:(A)hypermap` o MATCH_MP lemma_in_cycle2) + THEN USE_THEN "F4"(fun th->(USE_THEN "F5"(fun th2->(USE_THEN "F7"(fun th3-> LABEL_TAC "CF" (MATCH_MP lemma_cycle_is_face (CONJ th (CONJ th2 th3)))))))) + THEN USE_THEN "CF" SUBST1_TAC + THEN MP_TAC (ISPEC `quotient (H:(A)hypermap) (NF:(A)loop->bool)` face_map_and_darts) + THEN USE_THEN "F4" (fun th-> REWRITE_TAC[MATCH_MP lemma_quotient th]) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_index_on_orbit) + THEN USE_THEN "CF" (SUBST1_TAC o SYM) + THEN DISCH_THEN (X_CHOOSE_THEN `n:num` (CONJUNCTS_THEN2 (LABEL_TAC "F18") (LABEL_TAC "F19"))) + THEN USE_THEN "F4"(LABEL_TAC "QF" o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o MATCH_MP lemma_quotient) + THEN ASM_CASES_TAC `n = 0` + THENL[REMOVE_THEN "F19" MP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[POWER_0; I_THM] + THEN DISCH_THEN (LABEL_TAC "F19") + THEN EXISTS_TAC `PRE (CARD (cycle (H:(A)hypermap) (L:(A)loop)))` + THEN ONCE_REWRITE_TAC[GSYM LT_SUC] + THEN USE_THEN "F16" (fun th-> MP_TAC (MATCH_MP LE_TRANS (CONJ (SPEC `1` LE_PLUS) (REWRITE_RULE[TWO] th)))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP LE_SUC_PRE th; LT_PLUS]) + THEN EXPAND_TAC "m" + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_mInside_and_length_cycle th]) + THEN POP_ASSUM SUBST1_TAC + THEN MP_TAC (MATCH_MP lemma_cycle_orbit (ISPEC `quotient (H:(A)hypermap) (NF:(A)loop->bool)` face_map_and_darts)) + THEN DISCH_THEN (MP_TAC o SPEC `atom (H:(A)hypermap) (L:(A)loop) (x:A)`) + THEN USE_THEN "QF" SUBST1_TAC + THEN USE_THEN "CF" (SUBST1_TAC o SYM) + THEN SIMP_TAC[]; ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[GSYM LT_NZ; LT_EXISTS; CONJUNCT1 ADD]) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` SUBST_ALL_TAC) + THEN EXISTS_TAC `d:num` THEN USE_THEN "F19" (fun th-> REWRITE_TAC[SYM th]) + THEN USE_THEN "F18" (fun th->REWRITE_TAC[MATCH_MP LT_TRANS (CONJ (SPEC `d:num` LT_PLUS) th)]) + THEN USE_THEN "F6" MP_TAC THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] + THEN REWRITE_TAC[NOT_LT; LE_LT] + THEN STRIP_TAC + THENL[POP_ASSUM (LABEL_TAC "F24") + THEN USE_THEN "F1" (MP_TAC o SPEC `SUC d` o CONJUNCT1 o MATCH_MP lemma_atom_on_inside_dart) + THEN USE_THEN "MN" SUBST1_TAC + THEN USE_THEN "F24" (fun th-> REWRITE_TAC[GE_1; REWRITE_RULE[GSYM LE_SUC_LT] th]) + THEN USE_THEN "QF" SUBST1_TAC + THEN USE_THEN "F19" (SUBST1_TAC o SYM) + THEN DISCH_TAC + THEN MP_TAC (SPECL[`H:(A)hypermap`; `L:(A)loop`; `z:A`] atom_reflect) + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[IN_SING] + THEN USE_THEN "F14" (MP_TAC o SPEC `SUC d`) + THEN USE_THEN "F24" (fun th-> REWRITE_TAC[GE_1; MATCH_MP LT_IMP_LE (ONCE_REWRITE_RULE[GSYM LT_SUC] th)]) + THEN SIMP_TAC[]; ALL_TAC] + THEN USE_THEN "F19" MP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN USE_THEN "F1" (MP_TAC o CONJUNCT2 o MATCH_MP lemma_atom_on_inside_dart) + THEN USE_THEN "MN" SUBST1_TAC + THEN USE_THEN "QF" SUBST1_TAC + THEN DISCH_THEN (SUBST1_TAC) + THEN USE_THEN "F10" SUBST1_TAC + THEN DISCH_TAC + THEN MP_TAC (SPECL[`H:(A)hypermap`; `L:(A)loop`; `z:A`] atom_reflect) + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_THEN (fun th-> MP_TAC (MATCH_MP lemma_in_subset (CONJ (SPECL[`H:(A)hypermap`; `L:(A)loop`; `y:A`] lemma_atom_sub_node) th))) + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_node_identity) + THEN EXPAND_TAC "y" THEN EXPAND_TAC "z" + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_on_attach th]));; + +let lemma_route = new_specification["mRoute"] (REWRITE_RULE[GSYM RIGHT_EXISTS_IMP_THM; SKOLEM_THM] lemma_route_exists);; + +let lemmaParameters = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_marked H NF L x /\ ~(L IN canon H NF) ==> mInside H NF L x < mRoute H NF L x /\ mRoute H NF L x < CARD(cycle H L) /\ SUC (mInside H NF L x) < (mAdd H NF L x) + (mRoute H NF L x) /\ ~(node H (heading H NF L x) = node H x) /\ ~(node H (heading H NF L x) = node H (attach H NF L x))`, + REPEAT GEN_TAC + THEN DISCH_THEN(fun th ->LABEL_TAC "FC"(CONJUNCT1 th) THEN LABEL_TAC "F1"(MATCH_MP lemma_split_marked_loop th)) + THEN USE_THEN "F1" ((CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (CONJUNCTS_THEN2 (LABEL_TAC "F7") (LABEL_TAC "F8")))))) o REWRITE_RULE[is_split_condition]) + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (fun th1-> MP_TAC (MATCH_MP lemma_route (CONJ th th1)))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F9") (CONJUNCTS_THEN2 (LABEL_TAC "F10") (LABEL_TAC "F11"))) + THEN USE_THEN "F9" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F10" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_on_heading th]) + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_on_attach th]) + THEN ABBREV_TAC `m = mInside (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "F12") + THEN ABBREV_TAC `p = mAdd (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "F14") + THEN ABBREV_TAC `q = mRoute (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "F15") + THEN GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [ADD_SYM] + THEN USE_THEN "F9" (MP_TAC o REWRITE_RULE[LT_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` (MP_TAC o REWRITE_RULE[ADD_SYM; ADD_SUC])) + THEN REWRITE_TAC[GSYM ADD_SUC] + THEN DISCH_THEN (SUBST_ALL_TAC o ONCE_REWRITE_RULE[ADD_SYM]) + THEN REWRITE_TAC[GSYM ADD_ASSOC] + THEN REWRITE_TAC[LT_ADD] + THEN ASM_CASES_TAC `~((d:num) + (p:num) = 0)` + THENL[POP_ASSUM (MP_TAC o REWRITE_RULE[GSYM LT_NZ]) THEN SIMP_TAC[]; ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[]) + THEN DISCH_THEN (MP_TAC o MATCH_MP (ARITH_RULE `!a:num b:num. a + b = 0 ==> a = 0 /\ b = 0`)) + THEN DISCH_THEN (CONJUNCTS_THEN2 SUBST_ALL_TAC SUBST_ALL_TAC) + THEN USE_THEN "F11" MP_TAC + THEN REWRITE_TAC[GSYM COM_POWER_FUNCTION] + THEN REWRITE_TAC[ADD_0] + THEN USE_THEN "F1" (MP_TAC o CONJUNCT2 o MATCH_MP lemma_atom_on_inside_dart) + THEN USE_THEN "F12" SUBST1_TAC + THEN DISCH_THEN (SUBST1_TAC) + THEN USE_THEN "F4" (fun th-> REWRITE_TAC[MATCH_MP lemma_quotient th]) + THEN ABBREV_TAC `y = heading (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "F16") + THEN ABBREV_TAC `z = attach (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "F17") + THEN USE_THEN "F16" (MP_TAC o REWRITE_RULE[heading]) + THEN USE_THEN "F7" (MP_TAC o SPEC `SUC m` o MATCH_MP lemma_power_next_in_loop) + THEN USE_THEN "F1" (MP_TAC o SPEC `SUC m` o CONJUNCT1 o MATCH_MP lemma_mInside) + THEN EXPAND_TAC "m" THEN REWRITE_TAC[LE_REFL] + THEN DISCH_THEN SUBST1_TAC THEN REWRITE_TAC[GSYM heading] + THEN USE_THEN "F16" SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "F18") + THEN USE_THEN "F4" (fun th->USE_THEN "F5"(fun th1->USE_THEN "F18"(fun th2->REWRITE_TAC[MATCH_MP unique_fmap (CONJ th (CONJ th1 th2))]))) + THEN DISCH_TAC + THEN MP_TAC(SPECL[`H:(A)hypermap`; `L:(A)loop`; `face_map (H:(A)hypermap) (head H (NF:(A)loop->bool) (y:A))`] atom_reflect) + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_THEN (fun th -> MP_TAC(MATCH_MP lemma_in_subset (CONJ (SPECL[`H:(A)hypermap`; `L:(A)loop`; `z:A`] lemma_atom_sub_node) th))) + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_in_node1) + THEN USE_THEN "F3" (fun th-> LABEL_TAC "CV"(REWRITE_RULE[edge_map_convolution] (CONJUNCT1(CONJUNCT2(CONJUNCT2(REWRITE_RULE[is_restricted] th)))))) + THEN USE_THEN "CV" (fun th-> MP_TAC (AP_THM th `head (H:(A)hypermap) (NF:(A)loop->bool) (y:A)`)) + THEN DISCH_THEN (SUBST1_TAC o SYM o REWRITE_RULE[o_THM]) + THEN DISCH_THEN (LABEL_TAC "F19") + THEN USE_THEN "F17" (MP_TAC o REWRITE_RULE[attach]) + THEN USE_THEN "F14" SUBST1_TAC THEN REWRITE_TAC[GSYM ONE; POWER_1] + THEN USE_THEN "F16" SUBST1_TAC + THEN DISCH_TAC + THEN MP_TAC (SPECL[`H:(A)hypermap`; `z:A`] node_refl) + THEN POP_ASSUM (fun th-> GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [SYM th]) + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_in_node1) + THEN USE_THEN "CV" (fun th -> MP_TAC (AP_THM th `y:A`)) + THEN REWRITE_TAC[o_THM] + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "F20" o MATCH_MP lemma_node_identity) + THEN REMOVE_THEN "F19" MP_TAC + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "F21") + THEN USE_THEN "F4" (fun th-> USE_THEN "F5" (fun th1->USE_THEN "F18" (fun th2-> MP_TAC (MATCH_MP head_on_loop (CONJ th (CONJ th1 th2)))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F22") (LABEL_TAC "F24")) + THEN USE_THEN "F22" (fun th-> (LABEL_TAC "F25" (MATCH_MP lemma_in_subset (CONJ (SPECL[`H:(A)hypermap`; `L:(A)loop`; `y:A`] lemma_atom_sub_node) th)))) + THEN USE_THEN "F4" (fun th-> USE_THEN "F5" (fun th1->USE_THEN "F18" (fun th2-> ASSUME_TAC (MATCH_MP lemma_in_dart (CONJ th (CONJ th1 th2)))))) + THEN USE_THEN "F3" (MP_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN DISCH_THEN (MP_TAC o SPECL[`y:A`; `head (H:(A)hypermap) (NF:(A)loop->bool) (y:A)`] o REWRITE_RULE[is_no_double_joins]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F25" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F21" (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (fun th-> USE_THEN "F24" (LABEL_TAC "F26" o REWRITE_RULE[SYM th])) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT2 o MATCH_MP lemma_mInside) + THEN ONCE_REWRITE_TAC[COM_POWER] + THEN REWRITE_TAC[o_THM] + THEN USE_THEN "F1" (MP_TAC o SPEC `SUC m` o CONJUNCT1 o MATCH_MP lemma_mInside) + THEN EXPAND_TAC "m" THEN REWRITE_TAC[LE_REFL] + THEN DISCH_THEN SUBST1_TAC THEN REWRITE_TAC[GSYM heading] + THEN USE_THEN "F16" SUBST1_TAC + THEN USE_THEN "F3" (fun th-> USE_THEN "F4" (fun th1->USE_THEN "F5" (fun th2-> (USE_THEN "F18"(fun th3-> MP_TAC (MATCH_MP lemma_next_exclusive (CONJ th (CONJ th1 (CONJ th2 th3))))))))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th -> REWRITE_TAC[th]));; + +let genex = new_definition `!H:(A)hypermap (NF:(A)loop->bool) (L:(A)loop) x:A. genex H NF L x += glue (loop_path L (attach H NF L x)) (face_contour H (heading H NF L x)) (index L (attach H NF L x) (heading H NF L x))`;; + +let tpx = new_definition `!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. tpx H NF L x = (index L (attach H NF L x) (heading H NF L x)) + (mAdd H NF L x)`;; + +let geney = new_definition `!H:(A)hypermap (NF:(A)loop->bool) (L:(A)loop) x:A. geney H NF L x += glue (loop_path L (inverse (node_map H) (heading H NF L x))) (complement H (attach H NF L x)) (index L (inverse (node_map H) (heading H NF L x)) (node_map H (attach H NF L x)))`;; + +let tpy = new_definition `!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. tpy H NF L x = (index L (inverse (node_map H) (heading H NF L x)) (node_map H (attach H NF L x))) + (ind H (attach H NF L x) (mAdd H NF L x))`;; + +let dnax = new_definition `!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). dnax H NF L x = loop(support_list (genex H NF L x) (tpx H NF L x), samsara (genex H NF L x) (tpx H NF L x))`;; + +let dnay = new_definition `!(H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A). dnay H NF L x = loop(support_list (geney H NF L x) (tpy H NF L x), samsara (geney H NF L x) (tpy H NF L x))`;; + +let lemma_genex_loop = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_marked H NF L x /\ ~(L IN canon H NF) + ==> (is_inj_contour H (genex H NF L x) (tpx H NF L x) /\ face_map H (genex H NF L x (tpx H NF L x)) = genex H NF L x 0)`, + REPEAT GEN_TAC + THEN DISCH_THEN(fun th ->LABEL_TAC "FC"(CONJUNCT1 th) THEN LABEL_TAC "F1"(MATCH_MP lemma_split_marked_loop th)) + THEN USE_THEN "F1" ((CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7" o CONJUNCT1))))) o REWRITE_RULE[is_split_condition]) + THEN USE_THEN "F5"(fun th->(USE_THEN "F4"(LABEL_TAC "F8" o CONJUNCT1 o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN USE_THEN "F1" (LABEL_TAC "F9" o CONJUNCT1 o MATCH_MP lemma_on_heading) + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (fun th1-> LABEL_TAC "F10" (CONJUNCT1(MATCH_MP lemmaHQYMRTX (CONJ th th1))))) + THEN REWRITE_TAC[genex; tpx; start_glue_evaluation; loop_path; POWER_0; I_THM] + THEN ABBREV_TAC `y = heading (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "YEL") + THEN ABBREV_TAC `z = attach (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "ZEL") + THEN ABBREV_TAC `m = mAdd (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "MN") + THEN USE_THEN "F10" (fun th-> USE_THEN "F9" (fun th1-> MP_TAC (MATCH_MP lemma_loop_index (CONJ th th1)))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F11") (LABEL_TAC "F12")) + THEN ABBREV_TAC `id = index (L:(A)loop) (z:A) (y:A)` + THEN STRIP_TAC + THENL[MATCH_MP_TAC lemma_glue_inj_contours + THEN USE_THEN "F8" (fun th-> USE_THEN "F10" (fun th1-> MP_TAC (CONJUNCT1(MATCH_MP let_order_for_loop (CONJ th th1))))) + THEN USE_THEN "F11"(fun th-> DISCH_THEN(fun th1-> REWRITE_TAC[REWRITE_RULE[th] (SPEC `id:num` (MATCH_MP lemma_sub_inj_contour th1))])) + THEN USE_THEN "MN" (fun th-> USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o CONJUNCT2 o MATCH_MP lemma_on_attach)) + THEN DISCH_THEN (fun th-> MP_TAC(MATCH_MP LT_TRANS (CONJ (SPEC `m:num` LT_PLUS) th))) + THEN MP_TAC (CONJUNCT1(SPECL[`H:(A)hypermap`; `NF:(A)loop->bool`; `L:(A)loop`; `x:A`] lemma_new_darts_in_face)) + THEN USE_THEN "YEL" (fun th-> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_face_identity th]) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_inj_face_contour th]) + THEN REWRITE_TAC[is_glueing] + THEN USE_THEN "F12" (fun th-> GEN_REWRITE_TAC (LAND_CONV o TOP_DEPTH_CONV) [loop_path; face_contour; POWER_0; GSYM th; I_THM]) + THEN SIMP_TAC[] + THEN GEN_TAC + THEN REWRITE_TAC[face_contour] + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G1") (LABEL_TAC "G2")) + THEN USE_THEN "MN" (fun th-> USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o SPEC `j:num` o CONJUNCT1 o MATCH_MP lemma_mAdd)) + THEN USE_THEN "G1" (fun th-> USE_THEN "G2" (fun th1-> USE_THEN "YEL" (fun th2-> REWRITE_TAC[th; th1; th2]))) + THEN REWRITE_TAC[CONTRAPOS_THM; loop_path; lemma_in_list] + THEN DISCH_THEN (X_CHOOSE_THEN `i:num` (SUBST1_TAC o CONJUNCT2)) + THEN MATCH_MP_TAC lemma_in_support2 + THEN EXISTS_TAC `L:(A)loop` THEN USE_THEN "F5" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F10" (fun th-> REWRITE_TAC[MATCH_MP lemma_power_next_in_loop th]); ALL_TAC] + THEN SUBGOAL_THEN `loop_path (L:(A)loop) (z:A) (id:num) = face_contour (H:(A)hypermap) (y:A) 0` MP_TAC + THENL[USE_THEN "F12" (fun th-> REWRITE_TAC[loop_path; face_contour; POWER_0;I_THM; th]); ALL_TAC] + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP second_glue_evaluation th]) + THEN REWRITE_TAC[face_contour; COM_POWER_FUNCTION] + THEN EXPAND_TAC "z" + THEN USE_THEN "YEL" (fun th-> USE_THEN "MN" (fun th1-> REWRITE_TAC[attach; th; th1])));; + +let complement_index = prove(`!H:(A)hypermap x:A m:num k:num. is_node_nondegenerate H /\ x IN dart H /\ 1 <= k /\ k <= ind H x m + ==> ?i:num j:num. i < m /\ 1 <= j /\ j < CARD (node H ((inverse (face_map H) POWER (SUC i)) x)) /\ k = (ind H x i) + j`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (LABEL_TAC "F4")))) + THEN USE_THEN "F1"(fun th->USE_THEN "F2"(fun th1-> MP_TAC(MATCH_MP lemma_increasing_index_one (CONJ th th1)))) + THEN MP_TAC (SPECL[`H:(A)hypermap`; `x:A`] (CONJUNCT1 ind)) + THEN REWRITE_TAC[IMP_IMP] THEN DISCH_THEN (LABEL_TAC "INC") + THEN USE_THEN "INC" (MP_TAC o SPEC `k:num` o MATCH_MP lemma_num_partition2) + THEN USE_THEN "F3" (fun th->REWRITE_TAC[REWRITE_RULE[LT1_NZ; LT_NZ] th]) + THEN DISCH_THEN (X_CHOOSE_THEN `i:num` (X_CHOOSE_THEN `j:num` (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 MP_TAC (LABEL_TAC "F6"))))) + THEN GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [ind; ADD_SUB2; GSYM LT_SUC_LE] + THEN REWRITE_TAC[MATCH_MP LE_SUC_PRE (SPECL[`H:(A)hypermap`; `(inverse (face_map (H:(A)hypermap)) POWER (SUC i)) (x:A)`] NODE_NOT_EMPTY)] + THEN DISCH_THEN ASSUME_TAC + THEN EXISTS_TAC `i:num` THEN EXISTS_TAC `j:num` THEN ASM_REWRITE_TAC[] + THEN USE_THEN "INC" (fun th-> ONCE_REWRITE_TAC[MATCH_MP lemma_inc_monotone (CONJUNCT2 th)]) + THEN USE_THEN "F4" MP_TAC THEN USE_THEN "F6" SUBST1_TAC + THEN USE_THEN "F5" (MP_TAC o REWRITE_RULE[GSYM (SPEC `ind (H:(A)hypermap) (x:A) (i:num)` LT_ADD)] o REWRITE_RULE[LT1_NZ]) + THEN REWRITE_TAC[IMP_IMP] THEN DISCH_THEN (MP_TAC o MATCH_MP LTE_TRANS) THEN SIMP_TAC[]);; + +let reduce_exponent = prove(`!s:A->bool p:A->A m:num n:num x:A. p permutes s /\ m <= n ==> (inverse p POWER m) ((p POWER n) x) = (p POWER (n - m)) x`, + REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (MP_TAC o REWRITE_RULE[LE_EXISTS])) + THEN DISCH_THEN (X_CHOOSE_THEN `i:num` SUBST1_TAC) + THEN REWRITE_TAC[ADD_SUB2; lemma_add_exponent_function ] + THEN USE_THEN "F1" (fun th-> REWRITE_TAC[MATCH_MP lemma_power_inverse th]) + THEN USE_THEN "F1" (MP_TAC o SPEC `m:num` o MATCH_MP power_permutation) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP PERMUTES_INVERSES th]));; + +let lemma_on_adding_darts = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_marked H NF L x /\ ~(L IN canon H NF) ==> next L (heading H NF L x) = inverse (node_map H) (heading H NF L x) /\ back L (attach H NF L x) = node_map H (attach H NF L x)`, + REPEAT GEN_TAC + THEN DISCH_THEN(fun th ->LABEL_TAC "FC"(CONJUNCT1 th) THEN LABEL_TAC "F1"(MATCH_MP lemma_split_marked_loop th)) + THEN USE_THEN "F1" ((CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7" o CONJUNCT1))))) o REWRITE_RULE[is_split_condition]) + THEN USE_THEN "F5" (fun th->(USE_THEN "F4" (LABEL_TAC "F8" o CONJUNCT1 o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN USE_THEN "F1" (LABEL_TAC "F9" o CONJUNCT1 o MATCH_MP lemma_on_heading) + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (fun th1-> LABEL_TAC "F10" (CONJUNCT1(MATCH_MP lemmaHQYMRTX (CONJ th th1))))) + THEN REWRITE_TAC[geney; tpy; start_glue_evaluation; loop_path; POWER_0; I_THM] + THEN ABBREV_TAC `y = heading (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "YEL") + THEN ABBREV_TAC `z = attach (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "ZEL") + THEN ABBREV_TAC `m = mAdd (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "MN") + THEN USE_THEN "YEL" (fun th-> USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o CONJUNCT1 o CONJUNCT2 o MATCH_MP lemma_on_heading)) + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN ABBREV_TAC `u = back (L:(A)loop) (z:A)` THEN POP_ASSUM (LABEL_TAC "G1") + THEN USE_THEN "G1" (MP_TAC o AP_TERM `next (L:(A)loop)`) + THEN REWRITE_TAC[lemma_inverse_evaluation] + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "G1" (fun th-> USE_THEN "F10" (LABEL_TAC "G2" o REWRITE_RULE[th] o MATCH_MP lemma_back_in_loop)) + THEN REWRITE_TAC[node_map_inverse_representation] + THEN ONCE_REWRITE_TAC[TAUT `A <=> (~A ==> F)`] + THEN USE_THEN "F3"(fun th->USE_THEN "F4"(fun th1-> USE_THEN "F5"(fun th2->USE_THEN "G2"(fun th3->GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [GSYM(MATCH_MP lemma_next_exclusive (CONJ th (CONJ th1 (CONJ th2 th3))))])))) + THEN USE_THEN "G1" (SUBST1_TAC o SYM) + THEN REWRITE_TAC[lemma_inverse_evaluation] + THEN ASM_CASES_TAC `m:num = 0` + THENL[EXPAND_TAC "z" + THEN USE_THEN "YEL" (fun th1-> USE_THEN "MN"(fun th-> REWRITE_TAC[attach; GSYM COM_POWER_FUNCTION; th; th1])) + THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[POWER_0; I_THM; face_map_injective] + THEN DISCH_THEN (MP_TAC o AP_TERM `next (L:(A)loop)`) + THEN REWRITE_TAC[lemma_inverse_evaluation] + THEN USE_THEN "YEL" (fun th-> USE_THEN "F1" (MP_TAC o CONJUNCT1 o CONJUNCT2 o REWRITE_RULE[th] o MATCH_MP lemma_on_heading)) + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [TAUT `A <=> ~(~A)`] + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "F3"(fun th->USE_THEN "F4"(fun th1-> USE_THEN "F5"(fun th2->USE_THEN "F9"(fun th3->GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [MATCH_MP lemma_next_exclusive (CONJ th (CONJ th1 (CONJ th2 th3)))])))) + THEN SIMP_TAC[]; ALL_TAC] + THEN USE_THEN "ZEL" (fun th-> GEN_REWRITE_TAC (RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [SYM th]) + THEN USE_THEN "YEL" (fun th1-> USE_THEN "MN"(fun th-> REWRITE_TAC[attach; GSYM COM_POWER_FUNCTION; th; th1])) + THEN REWRITE_TAC[POWER_0; I_THM; face_map_injective] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[GSYM LT_NZ; GSYM LT1_NZ]) + THEN DISCH_THEN(fun th->USE_THEN "MN"(fun th1-> USE_THEN "F1"(MP_TAC o REWRITE_RULE[th1;th;LE_REFL] o SPEC `m:num` o CONJUNCT1 o MATCH_MP lemma_mAdd))) + THEN USE_THEN "YEL" (fun th-> REWRITE_TAC[CONTRAPOS_THM; th]) + THEN DISCH_THEN SUBST1_TAC THEN USE_THEN "G1" SUBST1_TAC + THEN USE_THEN "G2" (fun th -> USE_THEN "F5"(fun th1-> REWRITE_TAC[MATCH_MP lemma_in_support2 (CONJ th th1)])));; + +let lemma_geney_loop = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_marked H NF L x /\ ~(L IN canon H NF) + ==> (is_inj_contour H (geney H NF L x) (tpy H NF L x) /\ face_map H (geney H NF L x (tpy H NF L x)) = geney H NF L x 0)`, + REPEAT GEN_TAC + THEN DISCH_THEN(fun th ->LABEL_TAC "FC"(CONJUNCT1 th) THEN LABEL_TAC "F1"(MATCH_MP lemma_split_marked_loop th)) + THEN USE_THEN "F1" ((CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7" o CONJUNCT1))))) o REWRITE_RULE[is_split_condition]) + THEN USE_THEN "F5" (fun th->(USE_THEN "F4" (LABEL_TAC "F8" o CONJUNCT1 o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN USE_THEN "F1" (LABEL_TAC "F9" o CONJUNCT1 o MATCH_MP lemma_on_heading) + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (fun th1-> LABEL_TAC "F10" (CONJUNCT1(MATCH_MP lemmaHQYMRTX (CONJ th th1))))) + THEN REWRITE_TAC[geney; tpy; start_glue_evaluation; loop_path; POWER_0; I_THM] + THEN ABBREV_TAC `y = heading (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "YEL") + THEN ABBREV_TAC `z = attach (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "ZEL") + THEN ABBREV_TAC `m = mAdd (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "MN") + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (fun th1-> MP_TAC(MATCH_MP lemma_on_adding_darts (CONJ th th1)))) + THEN USE_THEN "YEL" (fun th-> USE_THEN "ZEL" (fun th1-> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [th; th1])) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F11") (LABEL_TAC "F12")) + THEN USE_THEN "F11" (fun th-> USE_THEN "F9" (LABEL_TAC "F14" o REWRITE_RULE[th] o MATCH_MP lemma_next_in_loop)) + THEN USE_THEN "F12" (fun th-> USE_THEN "F10" (LABEL_TAC "F15" o REWRITE_RULE[th] o MATCH_MP lemma_back_in_loop)) + THEN ABBREV_TAC `v = node_map (H:(A)hypermap) (z:A)` THEN POP_ASSUM (LABEL_TAC "VL") + THEN ABBREV_TAC `u = inverse (node_map (H:(A)hypermap)) (y:A)` THEN POP_ASSUM (LABEL_TAC "UL") + THEN USE_THEN "F14" (fun th-> USE_THEN "F15" (fun th1-> MP_TAC (MATCH_MP lemma_loop_index (CONJ th th1)))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F16") (LABEL_TAC "F17")) + THEN ABBREV_TAC `id = index (L:(A)loop) (u:A) (v:A)` + THEN USE_THEN "F3" (MP_TAC o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "R1") ((CONJUNCTS_THEN2 (LABEL_TAC "R2") (MP_TAC o CONJUNCT2)) o CONJUNCT2)) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "R3") (LABEL_TAC "R4" o CONJUNCT1)) + THEN USE_THEN "F10"(fun th2->USE_THEN "F5"(fun th1-> USE_THEN "F4"(fun th-> LABEL_TAC "F18" (MATCH_MP lemma_in_dart (CONJ th (CONJ th1 th2)))))) + THEN STRIP_TAC + THENL[MATCH_MP_TAC lemma_glue_inj_contours + THEN USE_THEN "F8" (fun th-> USE_THEN "F14" (fun th1-> MP_TAC (CONJUNCT1(MATCH_MP let_order_for_loop (CONJ th th1))))) + THEN USE_THEN "F16"(fun th-> DISCH_THEN(fun th1-> REWRITE_TAC[REWRITE_RULE[th] (SPEC `id:num` (MATCH_MP lemma_sub_inj_contour th1))])) + THEN USE_THEN "F18" MP_TAC THEN USE_THEN "R4" MP_TAC THEN USE_THEN "R2" MP_TAC THEN USE_THEN "R1" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_inj_complement) + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_sub_inj_contour) + THEN USE_THEN "MN" (fun th-> USE_THEN "F1"(LABEL_TAC "F19" o REWRITE_RULE[th] o CONJUNCT2 o MATCH_MP lemma_on_attach)) + THEN USE_THEN "F19" (MP_TAC o MATCH_MP LT_TRANS o CONJ (SPEC `m:num` LT_PLUS)) + THEN USE_THEN "ZEL"(fun th->MP_TAC(REWRITE_RULE[th](CONJUNCT2(SPECL[`H:(A)hypermap`; `NF:(A)loop->bool`; `L:(A)loop`; `x:A`] lemma_new_darts_in_face)))) + THEN DISCH_THEN (LABEL_TAC "F20" o MATCH_MP lemma_face_identity) + THEN USE_THEN "F20"(fun th-> REWRITE_TAC[th]) + THEN USE_THEN "R4"(fun th->USE_THEN "F18"(fun th1->DISCH_THEN(fun th2-> (MP_TAC (MATCH_MP lemma_increasing_index (CONJ th (CONJ th1 th2))))))) + THEN DISCH_THEN (MP_TAC o MATCH_MP LT_PRE_LE) + THEN DISCH_THEN (fun th-> DISCH_THEN (fun th1-> REWRITE_TAC[MATCH_MP th1 th])) + THEN REWRITE_TAC[is_glueing] + THEN USE_THEN "F17" (fun th-> GEN_REWRITE_TAC (LAND_CONV o TOP_DEPTH_CONV) [loop_path; face_contour; POWER_0; GSYM th; I_THM]) + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [GSYM(SPECL[`H:(A)hypermap`; `z:A`] (CONJUNCT1 ind))] + THEN USE_THEN "R1"(fun th-> USE_THEN "R4"(fun th1-> USE_THEN "F18"(fun th2-> REWRITE_TAC[CONJUNCT1(MATCH_MP lemma_complement_path (CONJ th (CONJ th1 th2)))]))) + THEN USE_THEN "VL" (fun th-> REWRITE_TAC[POWER_0; I_THM; th]) + THEN GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F21") (LABEL_TAC "F22")) + THEN USE_THEN "R4" (fun th-> USE_THEN "F18"(fun th1-> USE_THEN "F21" (fun th2-> USE_THEN "F22" (fun th3-> MP_TAC(MATCH_MP complement_index (CONJ th (CONJ th1 (CONJ th2 th3)))))))) + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` (X_CHOOSE_THEN `i:num` MP_TAC)) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F23") (CONJUNCTS_THEN2 (LABEL_TAC "F24") (CONJUNCTS_THEN2 (LABEL_TAC "F25") SUBST1_TAC))) + THEN USE_THEN "R1" (fun th-> USE_THEN "R4" (fun th1-> USE_THEN "F18" (fun th2->MP_TAC (SPECL[`k:num`; `i:num`] (CONJUNCT1(CONJUNCT2(CONJUNCT2(CONJUNCT2(MATCH_MP lemma_complement_path (CONJ th (CONJ th1 th2))))))))))) + THEN USE_THEN "F24" (fun th-> USE_THEN "F25" (fun th1-> REWRITE_TAC[th; th1])) + THEN DISCH_THEN SUBST1_TAC THEN EXPAND_TAC "z" + THEN USE_THEN "MN" (fun th-> REWRITE_TAC[attach; th]) + THEN USE_THEN "F23" (MP_TAC o MATCH_MP LT_IMP_LE o ONCE_REWRITE_RULE[GSYM LT_SUC]) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP reduce_exponent (CONJ (CONJUNCT2 (SPEC `H:(A)hypermap` face_map_and_darts)) th)]) + THEN REWRITE_TAC[SUB_SUC] THEN USE_THEN "F23" (MP_TAC o REWRITE_RULE[LT_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` (LABEL_TAC "F26")) + THEN USE_THEN "F26" (SUBST1_TAC) + THEN REWRITE_TAC[ADD_SUB2] + THEN USE_THEN "F1" (MP_TAC o SPEC `SUC d` o CONJUNCT1 o MATCH_MP lemma_mAdd) + THEN USE_THEN "MN" (fun th-> USE_THEN "YEL" (fun th1-> REWRITE_TAC[th; th1; GE_1])) + THEN USE_THEN "F26" (fun th-> REWRITE_TAC[th; LE_ADDR; CONTRAPOS_THM; lemma_in_list; loop_path]) + THEN DISCH_THEN (X_CHOOSE_THEN `n:num` (MP_TAC o CONJUNCT2)) + THEN ABBREV_TAC `g = (face_map (H:(A)hypermap) POWER (SUC d)) (y:A)` + THEN DISCH_THEN (fun th-> USE_THEN "F14" (MP_TAC o REWRITE_RULE[SYM th] o SPEC `n:num` o MATCH_MP lemma_power_next_in_loop)) + THEN DISCH_THEN (fun th-> USE_THEN "F5" (fun th1-> MP_TAC (MATCH_MP lemma_in_support2 (CONJ th th1)))) + THEN USE_THEN "F4" (fun th-> DISCH_THEN(fun th1-> MP_TAC (MATCH_MP lemma_node_sub_support_darts (CONJ th th1)))) + THEN MP_TAC (SPECL[`H:(A)hypermap`; `g:A`; `i:num`] lemma_power_inverse_in_node2) + THEN DISCH_THEN (fun th-> REWRITE_TAC[GSYM(MATCH_MP lemma_node_identity th)]) + THEN DISCH_THEN(fun th->REWRITE_TAC[MATCH_MP lemma_in_subset (CONJ th (SPECL[`H:(A)hypermap`; `g:A`] node_refl))]); ALL_TAC] + THEN SUBGOAL_THEN `loop_path (L:(A)loop) (u:A) (id:num) = complement (H:(A)hypermap) (z:A) 0` MP_TAC + THENL[GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [GSYM(SPECL[`H:(A)hypermap`; `z:A`] (CONJUNCT1 ind))] + THEN USE_THEN "R1"(fun th-> USE_THEN "R4"(fun th1-> USE_THEN "F18"(fun th2-> REWRITE_TAC[CONJUNCT1(MATCH_MP lemma_complement_path (CONJ th (CONJ th1 th2)))]))) + THEN USE_THEN "VL" (fun th-> REWRITE_TAC[POWER_0; I_THM; loop_path; th]) + THEN USE_THEN "F17" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP second_glue_evaluation th]) + THEN USE_THEN "R1" (fun th-> USE_THEN "R4"(fun th1-> USE_THEN "F18" (fun th2-> (REWRITE_TAC[CONJUNCT1(MATCH_MP lemma_complement_path (CONJ th (CONJ th1 th2)))])))) + THEN EXPAND_TAC "z" + THEN USE_THEN "MN" (fun th-> USE_THEN "YEL" (fun th1-> REWRITE_TAC[attach; th; th1])) + THEN REWRITE_TAC[MATCH_MP reduce_exponent (CONJ (CONJUNCT2 (SPEC `H:(A)hypermap` face_map_and_darts)) (SPEC `m:num` LE_PLUS))] + THEN REWRITE_TAC[ADD1; ADD_SUB2; POWER_1] + THEN ONCE_REWRITE_TAC[GSYM(MATCH_MP PERMUTES_INJECTIVE (CONJUNCT2 (SPEC`H:(A)hypermap` node_map_and_darts)))] + THEN USE_THEN "R1" (MP_TAC o SPEC `y:A` o REWRITE_RULE[edge_convolution]) + THEN USE_THEN "F4"(fun th-> USE_THEN "F5"(fun th1-> USE_THEN "F9" (fun th2-> REWRITE_TAC[MATCH_MP lemma_in_dart (CONJ th (CONJ th1 th2))]))) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "UL" (MP_TAC o AP_TERM `node_map (H:(A)hypermap)`) + THEN REWRITE_TAC[MATCH_MP PERMUTES_INVERSES (CONJUNCT2 (SPEC `H:(A)hypermap` node_map_and_darts))]);; + +let genesis = new_definition `!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. genesis H NF L x = (NF DELETE L) UNION {dnax H NF L x, dnay H NF L x}`;; + +let lemma_in_couple = prove(`!x:A a:A b:A. x IN {a, b} <=> x = a \/ x = b`, SET_TAC[]);; + +let lemma_on_dnax = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_marked H NF L x /\ ~(L IN canon H NF) ==> (genex H NF L x 0 = attach H NF L x) /\ attach H NF L x belong dnax H NF L x /\ top (dnax H NF L x) = tpx H NF L x /\ (!i:num. i <= index L (attach H NF L x) (heading H NF L x) ==> (next (dnax H NF L x) POWER i) (attach H NF L x) = (next L POWER i) (attach H NF L x)) /\ (!i:num. i <= mAdd H NF L x ==> (next (dnax H NF L x) POWER ((index L (attach H NF L x) (heading H NF L x)) + i)) (attach H NF L x) = (face_map H POWER i) (heading H NF L x))`, + REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1-> MP_TAC(CONJUNCT1(MATCH_MP lemma_genex_loop (CONJ th th1))))) + THEN DISCH_THEN (LABEL_TAC "F3" o CONJUNCT2 o REWRITE_RULE[lemma_inj_contour_via_list]) + THEN SUBGOAL_THEN `genex (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A) 0 = attach H NF L x` (LABEL_TAC "F4") + THENL[REWRITE_TAC[genex; start_glue_evaluation; loop_path; POWER_0; I_THM]; ALL_TAC] + THEN USE_THEN "F4" (fun th-> REWRITE_TAC[th]) + THEN STRIP_TAC + THENL[REWRITE_TAC[belong] + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[dnax; MATCH_MP lemma_generate_loop th; GSYM in_list]) + THEN USE_THEN "F4" (SUBST1_TAC o SYM) THEN MP_TAC (SPEC `tpx (H:(A)hypermap) NF L x` LE_0) + THEN REWRITE_TAC[lemma_element_in_list]; ALL_TAC] + THEN STRIP_TAC + THENL[ONCE_REWRITE_TAC[GSYM EQ_SUC] THEN REWRITE_TAC[GSYM lemma_size; size] + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[dnax; MATCH_MP lemma_generate_loop th]) + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[MATCH_MP lemma_size_list th]); ALL_TAC] + THEN STRIP_TAC + THENL[GEN_TAC THEN DISCH_THEN (LABEL_TAC "F5") + THEN USE_THEN "F4" (fun th-> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [SYM th]) + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[dnax; MATCH_MP lemma_generate_loop th]) + THEN USE_THEN "F3" (fun th-> MP_TAC(SPEC `i:num` (CONJUNCT2 (MATCH_MP lemma_samsara_power th)))) + THEN SUBGOAL_THEN `i:num <= tpx (H:(A)hypermap) NF L x` (fun th-> REWRITE_TAC[th]) + THENL[MATCH_MP_TAC LE_TRANS + THEN EXISTS_TAC `index (L:(A)loop) (attach (H:(A)hypermap) NF L x) (heading H NF L x)` + THEN USE_THEN "F5" (fun th -> REWRITE_TAC[th; tpx; LE_ADD]); ALL_TAC] + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[genex] + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP first_glue_evaluation th; loop_path]); ALL_TAC] + THEN GEN_TAC THEN DISCH_THEN (LABEL_TAC "H1") + THEN USE_THEN "F4" (fun th-> GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [SYM th]) + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[dnax; MATCH_MP lemma_generate_loop th]) + THEN ABBREV_TAC `m = index (L:(A)loop) (attach (H:(A)hypermap) NF L x) (heading H NF L x)` + THEN USE_THEN "F3" (fun th-> MP_TAC(SPEC `(m:num) + (i:num)` (CONJUNCT2 (MATCH_MP lemma_samsara_power th)))) + THEN SUBGOAL_THEN `(m:num) + (i:num) <= tpx (H:(A)hypermap) NF L x` (fun th-> REWRITE_TAC[th]) + THENL[EXPAND_TAC "m" THEN USE_THEN "H1" (fun th->REWRITE_TAC[tpx; LE_ADD_LCANCEL; th]); ALL_TAC] + THEN DISCH_THEN SUBST1_TAC + THEN SUBGOAL_THEN `loop_path (L:(A)loop) (attach (H:(A)hypermap) NF L x) (m:num) = face_contour H (heading H NF L x) 0` MP_TAC + THENL[REWRITE_TAC[loop_path; face_contour; POWER_0; I_THM] THEN EXPAND_TAC "m" + THEN POP_ASSUM (LABEL_TAC "H2") + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1-> MP_TAC (MATCH_MP lemma_split_marked_loop (CONJ th th1)))) + THEN DISCH_THEN (MP_TAC o CONJUNCT1 o MATCH_MP lemma_on_heading) + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1-> MP_TAC (CONJUNCT1(MATCH_MP lemmaHQYMRTX (CONJ th th1))))) + THEN REWRITE_TAC[IMP_IMP] + THEN DISCH_THEN (fun th-> REWRITE_TAC[SYM(CONJUNCT2(MATCH_MP lemma_loop_index th))]); ALL_TAC] + THEN REWRITE_TAC[genex] + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP second_glue_evaluation th; face_contour]));; + +let lemma_on_dnay = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_marked H NF L x /\ ~(L IN canon H NF) ==> geney H NF L x 0 = inverse (node_map H) (heading H NF L x) /\ inverse (node_map H) (heading H NF L x) belong dnay H NF L x /\ top (dnay H NF L x) = tpy H NF L x /\ (!i:num. i <= index L (inverse (node_map H) (heading H NF L x)) (node_map H (attach H NF L x)) ==> (next (dnay H NF L x) POWER i) (inverse (node_map H) (heading H NF L x)) = (next L POWER i) (inverse (node_map H) (heading H NF L x))) /\ (!i:num. i <= ind H (attach H NF L x) (mAdd H NF L x) ==> (next (dnay H NF L x) POWER ((index L (inverse (node_map H) (heading H NF L x)) (node_map H (attach H NF L x))) + i))(inverse (node_map H) (heading H NF L x)) = complement H (attach H NF L x) i)`, + REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (LABEL_TAC "F2")) + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1-> MP_TAC(CONJUNCT1(MATCH_MP lemma_geney_loop (CONJ th th1))))) + THEN DISCH_THEN (LABEL_TAC "F3" o CONJUNCT2 o REWRITE_RULE[lemma_inj_contour_via_list]) + THEN SUBGOAL_THEN `geney (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A) 0 = inverse (node_map H) (heading H NF L x)` (LABEL_TAC "F4") + THENL[REWRITE_TAC[geney; start_glue_evaluation; loop_path; POWER_0; I_THM]; ALL_TAC] + THEN USE_THEN "F4" (fun th-> REWRITE_TAC[th]) + THEN STRIP_TAC + THENL[REWRITE_TAC[belong] + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[dnay; MATCH_MP lemma_generate_loop th; GSYM in_list]) + THEN USE_THEN "F4" (SUBST1_TAC o SYM) THEN MP_TAC (SPEC `tpy (H:(A)hypermap) NF L x` LE_0) + THEN REWRITE_TAC[lemma_element_in_list]; ALL_TAC] + THEN STRIP_TAC + THENL[ONCE_REWRITE_TAC[GSYM EQ_SUC] THEN REWRITE_TAC[GSYM lemma_size; size] + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[dnay; MATCH_MP lemma_generate_loop th]) + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[MATCH_MP lemma_size_list th]); ALL_TAC] + THEN STRIP_TAC + THENL[GEN_TAC THEN DISCH_THEN (LABEL_TAC "F5") + THEN USE_THEN "F4" (fun th-> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [SYM th]) + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[dnay; MATCH_MP lemma_generate_loop th]) + THEN USE_THEN "F3" (fun th-> MP_TAC(SPEC `i:num` (CONJUNCT2 (MATCH_MP lemma_samsara_power th)))) + THEN SUBGOAL_THEN `i:num <= tpy (H:(A)hypermap) NF L x` (fun th-> REWRITE_TAC[th]) + THENL[MATCH_MP_TAC LE_TRANS + THEN EXISTS_TAC `index (L:(A)loop) (inverse (node_map H) (heading H NF L x)) (node_map H (attach H NF L x))` + THEN USE_THEN "F5" (fun th -> REWRITE_TAC[th; tpy; LE_ADD]); ALL_TAC] + THEN DISCH_THEN SUBST1_TAC THEN REWRITE_TAC[geney] + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP first_glue_evaluation th; loop_path]); ALL_TAC] + THEN GEN_TAC THEN DISCH_THEN (LABEL_TAC "H1") + THEN USE_THEN "F4" (fun th-> GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [SYM th]) + THEN USE_THEN "F3" (fun th-> REWRITE_TAC[dnay; MATCH_MP lemma_generate_loop th]) + THEN ABBREV_TAC `m = index (L:(A)loop) (inverse (node_map H) (heading H NF L x)) (node_map H (attach H NF L x))` + THEN USE_THEN "F3" (fun th-> MP_TAC(SPEC `(m:num) + (i:num)` (CONJUNCT2 (MATCH_MP lemma_samsara_power th)))) + THEN SUBGOAL_THEN `(m:num) + (i:num) <= tpy (H:(A)hypermap) NF L x` (fun th-> REWRITE_TAC[th]) + THENL[EXPAND_TAC "m" THEN USE_THEN "H1" (fun th->REWRITE_TAC[tpy; LE_ADD_LCANCEL; th]); ALL_TAC] + THEN DISCH_THEN SUBST1_TAC THEN POP_ASSUM (LABEL_TAC "H2") + THEN SUBGOAL_THEN `loop_path (L:(A)loop) (inverse (node_map H) (heading H NF L x)) (m:num) = complement H (attach H NF L x) 0` MP_TAC + THENL[REWRITE_TAC[loop_path; face_contour; POWER_0; I_THM] THEN EXPAND_TAC "m" + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1-> LABEL_TAC "H3" (MATCH_MP lemma_split_marked_loop (CONJ th th1)))) + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1-> MP_TAC (CONJUNCT1(MATCH_MP lemmaHQYMRTX (CONJ th th1))))) + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_back_in_loop) + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1-> REWRITE_TAC[CONJUNCT2(MATCH_MP lemma_on_adding_darts (CONJ th th1))])) + THEN USE_THEN "H3" ((CONJUNCTS_THEN2 MP_TAC (ASSUME_TAC o CONJUNCT1)) o MATCH_MP lemma_on_heading) + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_next_in_loop) + THEN POP_ASSUM (SUBST1_TAC) + THEN REWRITE_TAC[IMP_IMP] THEN DISCH_THEN (SUBST1_TAC o SYM o CONJUNCT2 o MATCH_MP lemma_loop_index) + THEN ONCE_REWRITE_TAC[SYM(SPECL[`H:(A)hypermap`; `attach (H:(A)hypermap) NF L x`] (CONJUNCT1 ind))] + THEN USE_THEN "F1" (fun th-> USE_THEN "F2" (fun th1-> MP_TAC (CONJUNCT1(MATCH_MP lemmaHQYMRTX (CONJ th th1))))) + THEN USE_THEN "H3" (MP_TAC o CONJUNCT2 o REWRITE_RULE[is_split_condition]) + THEN DISCH_THEN (fun th-> (MP_TAC (CONJUNCT1 (CONJUNCT2 th)) THEN MP_TAC (CONJUNCT1 th))) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_in_dart) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT1 o REWRITE_RULE[is_marked]) + THEN DISCH_THEN ((CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN DISCH_THEN (MP_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2) + THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[IMP_IMP;GSYM CONJ_ASSOC] + THEN DISCH_THEN (fun th-> REWRITE_TAC[CONJUNCT1(MATCH_MP lemma_complement_path th)]) + THEN REWRITE_TAC[POWER_0; I_THM]; ALL_TAC] + THEN USE_THEN "H2" (fun th-> REWRITE_TAC[geney; th]) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP second_glue_evaluation th]));; + + +let lemma_node_outside_support_darts = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A i:num. is_split_condition H NF L x /\ 1 <= i /\ i <= mAdd H NF L x ==> (!y:A. y IN node H ((face_map H POWER i) (heading H NF L x)) ==> ~(y IN support_darts NF))`, + REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (LABEL_TAC "F3"))) + THEN GEN_TAC THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] + THEN REWRITE_TAC[lemma_in_support] + THEN DISCH_THEN (X_CHOOSE_THEN `L':(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5"))) + THEN USE_THEN "F1" (MP_TAC o SPEC `i:num` o CONJUNCT1 o MATCH_MP lemma_mAdd) + THEN USE_THEN "F2" (fun th-> USE_THEN "F3" (fun th1-> REWRITE_TAC[th; th1])) + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_node_identity) + THEN ABBREV_TAC `z = (face_map (H:(A)hypermap) POWER (i:num)) (heading H NF L x)` + THEN DISCH_TAC THEN MP_TAC (SPECL[`H:(A)hypermap`; `z:A`] node_refl) + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "F6") + THEN USE_THEN "F1" (LABEL_TAC "F7" o CONJUNCT1 o CONJUNCT2 o REWRITE_RULE[is_split_condition]) + THEN USE_THEN "F5" (fun th-> USE_THEN "F4" (fun th1-> MP_TAC (MATCH_MP lemma_in_support2 (CONJ th th1)))) + THEN USE_THEN "F7" (fun th-> DISCH_THEN (fun th1-> MP_TAC (MATCH_MP lemma_node_sub_support_darts (CONJ th th1)))) + THEN DISCH_THEN (fun th-> USE_THEN "F6" (fun th1-> REWRITE_TAC[MATCH_MP lemma_in_subset (CONJ th th1)])));; + +let lemma_in_dnax = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_marked H NF L x /\ ~(L IN canon H NF) ==> (!y:A. y belong dnax H NF L x <=> +(?i:num. i <= index L (attach H NF L x) (heading H NF L x) /\ y = (next L POWER i) (attach H NF L x)) \/ ((?i:num. 1 <= i /\ i <= mAdd H NF L x /\ y = (face_map H POWER i) (heading H NF L x))))`, + REPEAT GEN_TAC + THEN DISCH_THEN(fun th ->LABEL_TAC "FC"(CONJUNCT1 th) THEN LABEL_TAC "F1"(MATCH_MP lemma_split_marked_loop th)) + THEN USE_THEN "F1" ((CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7" o CONJUNCT1))))) o REWRITE_RULE[is_split_condition]) + THEN USE_THEN "F5" (fun th->(USE_THEN "F4" (LABEL_TAC "F8" o CONJUNCT1 o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN USE_THEN "F1" (LABEL_TAC "F9" o CONJUNCT1 o MATCH_MP lemma_on_heading) + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (fun th1-> LABEL_TAC "F10" (CONJUNCT1(MATCH_MP lemmaHQYMRTX (CONJ th th1))))) + THEN REWRITE_TAC[geney; tpy; start_glue_evaluation; loop_path; POWER_0; I_THM] + THEN ABBREV_TAC `y = heading (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "YEL") + THEN ABBREV_TAC `z = attach (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "ZEL") + THEN ABBREV_TAC `m = mAdd (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "MN") + THEN GEN_TAC + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (MP_TAC o CONJUNCT2 o MATCH_MP lemma_on_dnax o CONJ th)) + THEN USE_THEN "YEL" (fun th-> USE_THEN "ZEL" (fun th1-> USE_THEN "MN" (fun th2-> REWRITE_TAC[tpx; th; th1; th2]))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F11") (CONJUNCTS_THEN2 (LABEL_TAC "F12") (CONJUNCTS_THEN2 (LABEL_TAC "F14") (LABEL_TAC "F15")))) + THEN USE_THEN "F11" (fun th-> REWRITE_TAC[MATCH_MP lemma_belong_loop th]) + THEN USE_THEN "F12" SUBST1_TAC + THEN EQ_TAC + THENL[DISCH_THEN (X_CHOOSE_THEN `i:num` (CONJUNCTS_THEN2 (LABEL_TAC "H1") (LABEL_TAC "H2"))) + THEN ASM_CASES_TAC `i:num <= index (L:(A)loop) z y` + THENL[POP_ASSUM (LABEL_TAC "H3") + THEN USE_THEN "F14" (fun th-> USE_THEN "H3" (MP_TAC o MATCH_MP th)) + THEN USE_THEN "H2" (fun th-> REWRITE_TAC[SYM th]) + THEN DISCH_TAC THEN DISJ1_TAC THEN EXISTS_TAC `i:num` + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th-> REWRITE_TAC[th])); ALL_TAC] + THEN POP_ASSUM ((X_CHOOSE_THEN `d:num` (LABEL_TAC "H4")) o REWRITE_RULE[NOT_LE; LT_EXISTS]) + THEN USE_THEN "H1" MP_TAC + THEN USE_THEN "H4" (fun th-> GEN_REWRITE_TAC (LAND_CONV o TOP_DEPTH_CONV) [th; LE_ADD_LCANCEL]) + THEN DISCH_THEN (LABEL_TAC "F5") THEN DISJ2_TAC + THEN USE_THEN "F15" (fun th-> USE_THEN "F5" (MP_TAC o MATCH_MP th)) + THEN USE_THEN "H4" (fun th-> USE_THEN "H2" (fun th1-> REWRITE_TAC[SYM th; SYM th1])) + THEN DISCH_TAC + THEN EXISTS_TAC `SUC d` + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[GE_1; th]); ALL_TAC] + THEN ASM_CASES_TAC `(?i:num. i <= index (L:(A)loop) z y /\ y' = (next L POWER (i:num)) z)` + THENL[POP_ASSUM (fun th-> REWRITE_TAC[th] THEN (X_CHOOSE_THEN `i:num` (CONJUNCTS_THEN2 (LABEL_TAC "H6") SUBST1_TAC) th)) + THEN EXISTS_TAC `i:num` + THEN USE_THEN "H6" (fun th-> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ th (SPECL[`index (L:(A)loop) z y`; `m:num`] LE_ADD))]) + THEN USE_THEN "H6" (fun th-> USE_THEN "F14" (fun th1-> REWRITE_TAC[SYM (MATCH_MP th1 th)])); ALL_TAC] + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (X_CHOOSE_THEN `i:num` (CONJUNCTS_THEN2 (LABEL_TAC "H7") (CONJUNCTS_THEN2 ASSUME_TAC SUBST1_TAC))) + THEN POP_ASSUM ((X_CHOOSE_THEN `d:num` (LABEL_TAC "H7")) o REWRITE_RULE[LE_EXISTS]) + THEN USE_THEN "H7" (SUBST1_TAC) + THEN EXISTS_TAC `(index (L:(A)loop) z y)+ i` + THEN REWRITE_TAC[ADD_ASSOC; LE_ADD] + THEN USE_THEN "H7" (fun th-> MP_TAC(REWRITE_RULE[SYM th] (SPECL[`i:num`; `d:num`] LE_ADD))) + THEN DISCH_THEN (fun th-> USE_THEN "F15" (fun th1-> REWRITE_TAC[SYM(MATCH_MP th1 th)])));; + +let lemma_in_dnax1 = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A y:A i:num. is_marked H NF L x /\ ~(L IN canon H NF) /\ i <= index L (attach H NF L x) (heading H NF L x) /\ y = (next L POWER i) (attach H NF L x) ==> y belong dnax H NF L x`, + MESON_TAC[lemma_in_dnax]);; + +let lemma_in_dnax2 = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A y:A i:num. is_marked H NF L x /\ ~(L IN canon H NF) /\ 1 <= i /\ i <= mAdd H NF L x /\ y = (face_map H POWER i) (heading H NF L x) ==> y belong dnax H NF L x`, + MESON_TAC[lemma_in_dnax]);; + +let lemma_in_dnay = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_marked H NF L x /\ ~(L IN canon H NF) ==> (!y:A. y belong dnay H NF L x <=> +(?i:num. i <= index L (inverse (node_map H) (heading H NF L x)) (node_map H (attach H NF L x)) /\ y = (next L POWER i) (inverse (node_map H) (heading H NF L x))) \/ (?i:num j:num. 1 <= i /\ i <= mAdd H NF L x /\ 1 <= j /\ j < CARD (node H ((face_map H POWER i) (heading H NF L x))) /\ y = (inverse (node_map H) POWER j) ((face_map H POWER i) (heading H NF L x))))`, + REPEAT GEN_TAC + THEN DISCH_THEN(fun th ->LABEL_TAC "FC"(CONJUNCT1 th) THEN LABEL_TAC "F1"(MATCH_MP lemma_split_marked_loop th)) + THEN USE_THEN "F1" ((CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7" o CONJUNCT1))))) o REWRITE_RULE[is_split_condition]) + THEN USE_THEN "F5" (fun th->(USE_THEN "F4" (LABEL_TAC "F8" o CONJUNCT1 o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN USE_THEN "F1" (LABEL_TAC "F9" o CONJUNCT1 o MATCH_MP lemma_on_heading) + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (fun th1-> LABEL_TAC "F10" (CONJUNCT1(MATCH_MP lemmaHQYMRTX (CONJ th th1))))) + THEN REWRITE_TAC[geney; tpy; start_glue_evaluation; loop_path; POWER_0; I_THM] + THEN ABBREV_TAC `y = heading (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "YEL") + THEN ABBREV_TAC `z = attach (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "ZEL") + THEN ABBREV_TAC `m = mAdd (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "MN") + THEN USE_THEN "YEL" (fun th-> USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o MATCH_MP lemma_on_heading)) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F11") (LABEL_TAC "F12" o CONJUNCT1)) + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (fun th1-> MP_TAC (CONJUNCT2(MATCH_MP lemma_on_adding_darts (CONJ th th1))))) + THEN USE_THEN "ZEL" (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F15") + THEN USE_THEN "F12" (fun th-> USE_THEN "F15" (fun th1 -> REWRITE_TAC[GSYM th; GSYM th1])) + THEN USE_THEN "F9" (LABEL_TAC "A3" o MATCH_MP lemma_next_in_loop) + THEN USE_THEN "F10" (LABEL_TAC "A4" o MATCH_MP lemma_back_in_loop) + THEN USE_THEN "A4" (fun th-> USE_THEN "A3" (fun th1-> (MP_TAC (MATCH_MP lemma_loop_index (CONJ th1 th))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "A5") (LABEL_TAC "A6")) + THEN ABBREV_TAC `ny = index (L:(A)loop) (next L y) (back L z)` THEN POP_ASSUM (LABEL_TAC "A8") + THEN GEN_TAC + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (MP_TAC o CONJUNCT2 o MATCH_MP lemma_on_dnay o CONJ th)) + THEN USE_THEN "YEL" (fun th-> USE_THEN "ZEL" (fun th1-> USE_THEN "MN" (fun th2-> REWRITE_TAC[tpy; th; th1; th2]))) + THEN USE_THEN "A8" (fun th2-> USE_THEN "F12" (fun th-> USE_THEN "F15" (fun th1-> REWRITE_TAC[SYM th; SYM th1; th2]))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "B1") (CONJUNCTS_THEN2 (LABEL_TAC "B2") (CONJUNCTS_THEN2 (LABEL_TAC "B3") (LABEL_TAC "B4")))) + THEN USE_THEN "B1" (fun th-> REWRITE_TAC[MATCH_MP lemma_belong_loop th]) + THEN USE_THEN "B2" SUBST1_TAC + THEN EQ_TAC + THENL[DISCH_THEN (X_CHOOSE_THEN `i:num` (CONJUNCTS_THEN2 (LABEL_TAC "H1") (LABEL_TAC "H2"))) + THEN ASM_CASES_TAC `i:num <= ny` + THENL[POP_ASSUM (LABEL_TAC "H3") THEN DISJ1_TAC + THEN USE_THEN "B3" (fun th-> USE_THEN "H3" (MP_TAC o MATCH_MP th)) + THEN USE_THEN "H2" (fun th-> REWRITE_TAC[SYM th]) + THEN DISCH_TAC THEN EXISTS_TAC `i:num` + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th-> REWRITE_TAC[th])); ALL_TAC] + THEN POP_ASSUM ((X_CHOOSE_THEN `d:num` (LABEL_TAC "H4")) o REWRITE_RULE[NOT_LE; LT_EXISTS]) + THEN USE_THEN "H1" MP_TAC + THEN USE_THEN "H4" (fun th-> GEN_REWRITE_TAC (LAND_CONV o TOP_DEPTH_CONV) [th; LE_ADD_LCANCEL]) + THEN DISCH_THEN (LABEL_TAC "H5") + THEN DISJ2_TAC + THEN USE_THEN "H5" MP_TAC THEN MP_TAC (SPEC `d:num` GE_1) + THEN USE_THEN "F4" (fun th-> USE_THEN "F5" (fun th1-> USE_THEN "F10" (fun th2 -> MP_TAC (MATCH_MP lemma_in_dart (CONJ th (CONJ th1 th2)))))) + THEN USE_THEN "F3" (MP_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP complement_index) + THEN DISCH_THEN (X_CHOOSE_THEN `a:num` (X_CHOOSE_THEN `b:num` (CONJUNCTS_THEN2 (LABEL_TAC "H6") (CONJUNCTS_THEN2 (LABEL_TAC "H7") (CONJUNCTS_THEN2 (LABEL_TAC "H8") (LABEL_TAC "H9")))))) + THEN USE_THEN "B4" (fun th-> USE_THEN "H5" (MP_TAC o MATCH_MP th)) + THEN USE_THEN "H4" (fun th-> USE_THEN "H2" (fun th1-> REWRITE_TAC[SYM th; SYM th1])) + THEN DISCH_TAC + THEN USE_THEN "F4" (fun th-> USE_THEN "F5" (fun th1-> USE_THEN "F10" (fun th2 -> MP_TAC (MATCH_MP lemma_in_dart (CONJ th (CONJ th1 th2)))))) + THEN USE_THEN "F3" (MP_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN USE_THEN "F3" (MP_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o SPECL[`a:num`; `b:num`] o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o MATCH_MP lemma_complement_path) + THEN USE_THEN "H7" (fun th-> USE_THEN "H8" (fun th1-> USE_THEN "H9" (fun th2-> REWRITE_TAC[th; th1; SYM th2]))) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN REMOVE_THEN "H8" MP_TAC THEN REWRITE_TAC[IMP_IMP] + THEN MP_TAC (SPECL[`H:(A)hypermap`; `NF:(A)loop->bool`; `L:(A)loop`; `x:A`] attach) + THEN USE_THEN "ZEL" (fun th-> USE_THEN "YEL" (fun th1-> USE_THEN "MN" (fun th2-> REWRITE_TAC[th; th1; th2]))) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "H6" (fun th-> MP_TAC (SPEC `y:A` (MATCH_MP reduce_exponent (CONJ (CONJUNCT2 (SPEC `H:(A)hypermap` face_map_and_darts)) (MATCH_MP LT_IMP_LE (ONCE_REWRITE_RULE[GSYM LT_SUC] th)))))) + THEN REWRITE_TAC[SUB_SUC] + THEN USE_THEN "H6" ((X_CHOOSE_THEN `s:num` (LABEL_TAC "H10") o REWRITE_RULE[LT_EXISTS])) + THEN USE_THEN "H10" (fun th-> GEN_REWRITE_TAC (LAND_CONV o TOP_DEPTH_CONV) [th; ADD_SUB2]) + THEN USE_THEN "H10" (fun th -> GEN_REWRITE_TAC (LAND_CONV o TOP_DEPTH_CONV) [SYM th]) + THEN DISCH_THEN (SUBST1_TAC) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "H11") (LABEL_TAC "H12")) + THEN EXISTS_TAC `SUC s` THEN EXISTS_TAC `b:num` + THEN USE_THEN "H7" (fun th-> USE_THEN "H11" (fun th1 -> USE_THEN "H12" (fun th2-> REWRITE_TAC[th; th1; th2; GE_1]))) + THEN USE_THEN "H10" (fun th-> REWRITE_TAC[th; LE_ADDR]); ALL_TAC] + THEN ASM_CASES_TAC `(?i:num. i <= ny:num /\ y' = (next (L:(A)loop) POWER (i:num)) (next L y))` + THENL[POP_ASSUM (fun th-> REWRITE_TAC[th] THEN (X_CHOOSE_THEN `i:num` (CONJUNCTS_THEN2 (LABEL_TAC "T1") SUBST1_TAC) th)) + THEN EXISTS_TAC `i:num` + THEN USE_THEN "T1" (fun th-> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ th (SPECL[`ny:num`; `ind (H:(A)hypermap) z m`] LE_ADD))]) + THEN USE_THEN "T1" (fun th-> USE_THEN "B3" (fun th1-> REWRITE_TAC[SYM (MATCH_MP th1 th)])); ALL_TAC] + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (X_CHOOSE_THEN `a:num` (X_CHOOSE_THEN `b:num` (CONJUNCTS_THEN2 (LABEL_TAC "T2") (CONJUNCTS_THEN2 (LABEL_TAC "T3") (CONJUNCTS_THEN2 (LABEL_TAC "T4") (CONJUNCTS_THEN2 (LABEL_TAC "T5") (LABEL_TAC "T6"))))))) + THEN USE_THEN "T3" ((X_CHOOSE_THEN `d:num` (LABEL_TAC "T7")) o REWRITE_RULE[LE_EXISTS]) + THEN EXISTS_TAC `(ny:num) + ((ind (H:(A)hypermap) z d) + b)` + THEN REWRITE_TAC[LE_ADD_LCANCEL] + THEN USE_THEN "T5" (MP_TAC) + THEN MP_TAC (SPECL[`H:(A)hypermap`; `NF:(A)loop->bool`; `L:(A)loop`; `x:A`] attach) + THEN USE_THEN "ZEL" (fun th-> USE_THEN "YEL" (fun th1-> USE_THEN "MN" (fun th2-> REWRITE_TAC[th; th1; th2]))) + THEN USE_THEN "T7" (fun th-> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [ONCE_REWRITE_RULE[ADD_SYM] th]) + THEN GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV)[GSYM (CONJUNCT2 ADD); lemma_add_exponent_function] + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [MATCH_MP inverse_power_function (CONJUNCT2(SPEC `H:(A)hypermap` face_map_and_darts))] + THEN DISCH_THEN (SUBST1_TAC) + THEN DISCH_THEN (LABEL_TAC "T8") + THEN SUBGOAL_THEN `(ind (H:(A)hypermap) z d) + b <= ind H z m` (LABEL_TAC "T9") + THENL[MATCH_MP_TAC LE_TRANS + THEN EXISTS_TAC `ind (H:(A)hypermap) z (SUC d)` + THEN USE_THEN "T7" MP_TAC + THEN USE_THEN "T2" (fun th-> ONCE_REWRITE_TAC[SYM(MATCH_MP LE_SUC_PRE th)]) + THEN REWRITE_TAC[CONJUNCT2 ADD; GSYM ADD_SUC] + THEN DISCH_THEN (fun th-> MP_TAC (REWRITE_RULE[SYM th] (SPECL[`PRE a`; `SUC d`] LE_ADDR))) + THEN DISCH_TAC + THEN USE_THEN "F4" (fun th-> USE_THEN "F5" (fun th1-> USE_THEN "F10" (fun th2 -> MP_TAC (MATCH_MP lemma_in_dart (CONJ th (CONJ th1 th2)))))) + THEN USE_THEN "F3" (MP_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_increasing_index_one) + THEN POP_ASSUM (fun th-> DISCH_THEN (fun th1-> REWRITE_TAC[REWRITE_RULE[th] (SPECL[`SUC d`; `m:num`] (MATCH_MP lemma_inc_not_decreasing th1))])) + THEN REWRITE_TAC[ind] + THEN REWRITE_TAC[LE_ADD_LCANCEL; GSYM LT_SUC_LE] + THEN MP_TAC (SPECL[`H:(A)hypermap`; `(inverse (face_map (H:(A)hypermap)) POWER (SUC d)) z`] NODE_NOT_EMPTY) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP LE_SUC_PRE th]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN USE_THEN "T9" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "B4" (fun th-> USE_THEN "T9" (MP_TAC o MATCH_MP th)) + THEN DISCH_THEN (SUBST1_TAC) + THEN USE_THEN "F4" (fun th-> USE_THEN "F5" (fun th1-> USE_THEN "F10" (fun th2 -> MP_TAC (MATCH_MP lemma_in_dart (CONJ th (CONJ th1 th2)))))) + THEN USE_THEN "F3"(MP_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN USE_THEN "F3" (MP_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o SPECL[`d:num`; `b:num`] o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o MATCH_MP lemma_complement_path) + THEN USE_THEN "T8" (fun th-> USE_THEN "T4" (fun th1-> REWRITE_TAC[th; th1])) + THEN DISCH_THEN (SUBST1_TAC) + THEN MP_TAC (SPECL[`H:(A)hypermap`; `NF:(A)loop->bool`; `L:(A)loop`; `x:A`] attach) + THEN USE_THEN "ZEL" (fun th-> USE_THEN "YEL" (fun th1-> USE_THEN "MN" (fun th2-> REWRITE_TAC[th; th1; th2]))) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "T7" (fun th-> (MP_TAC (REWRITE_RULE[SYM th] (SPECL[`a:num`; `d:num`] LE_ADDR)))) + THEN ONCE_REWRITE_TAC[GSYM LE_SUC] + THEN DISCH_THEN (fun th-> MP_TAC (SPEC `y:A` (MATCH_MP reduce_exponent (CONJ (CONJUNCT2 (SPEC `H:(A)hypermap` face_map_and_darts)) th)))) + THEN REWRITE_TAC[SUB_SUC] + THEN USE_THEN "T7" (fun th-> GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o DEPTH_CONV) [th; ADD_SUB]) + THEN DISCH_THEN (SUBST1_TAC) THEN USE_THEN "T6" (fun th-> REWRITE_TAC[th]));; + +let lemma_in_dnay1 = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A y:A i:num. is_marked H NF L x /\ ~(L IN canon H NF) /\ i <= index L (inverse (node_map H) (heading H NF L x)) (node_map H (attach H NF L x)) /\ y = (next L POWER i) (inverse (node_map H) (heading H NF L x)) ==> y belong dnay H NF L x`, + MESON_TAC[lemma_in_dnay]);; + +let lemma_in_dnay2 = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A y:A i:num j:num. is_marked H NF L x /\ ~(L IN canon H NF) /\ 1 <= i /\ i <= mAdd H NF L x /\ 1 <= j /\ j < CARD (node H ((face_map H POWER i) (heading H NF L x))) /\ y = (inverse (node_map H) POWER j) ((face_map H POWER i) (heading H NF L x)) ==> y belong dnay H NF L x`, + MESON_TAC[lemma_in_dnay]);; + +let lemma_disjoint_new_loops = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_marked H NF L x /\ ~(L IN canon H NF) ==> ( (index L (inverse (node_map H) (heading H NF L x)) (node_map H (attach H NF L x))) + (SUC (index L (attach H NF L x) (heading H NF L x))) = top L) /\ (!u:A. u belong dnax H NF L x ==> ~(u belong dnay H NF L x)) /\ (!u:A. u belong dnay H NF L x ==> ~(u belong dnax H NF L x)) /\ ~(dnax H NF L x IN NF) /\ ~(dnay H NF L x IN NF) /\ (!u:A. u belong L ==> u belong dnax H NF L x \/ u belong dnay H NF L x)`, + REPEAT GEN_TAC + THEN DISCH_THEN(fun th ->LABEL_TAC "FC"(CONJUNCT1 th) THEN LABEL_TAC "F1"(MATCH_MP lemma_split_marked_loop th)) + THEN USE_THEN "F1" ((CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7" o CONJUNCT1))))) o REWRITE_RULE[is_split_condition]) + THEN USE_THEN "F5" (fun th->(USE_THEN "F4" (LABEL_TAC "F8" o CONJUNCT1 o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN USE_THEN "F1" (LABEL_TAC "F9" o CONJUNCT1 o MATCH_MP lemma_on_heading) + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (fun th1-> LABEL_TAC "F10" (CONJUNCT1(MATCH_MP lemmaHQYMRTX (CONJ th th1))))) + THEN REWRITE_TAC[geney; tpy; start_glue_evaluation; loop_path; POWER_0; I_THM] + THEN ABBREV_TAC `y = heading (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "YEL") + THEN ABBREV_TAC `z = attach (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "ZEL") + THEN ABBREV_TAC `m = mAdd (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "MN") + THEN USE_THEN "YEL" (fun th-> USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o MATCH_MP lemma_on_heading)) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F11") (LABEL_TAC "F12" o CONJUNCT1)) + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (fun th1-> MP_TAC (CONJUNCT2(MATCH_MP lemma_on_adding_darts (CONJ th th1))))) + THEN USE_THEN "ZEL" (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F15") + THEN USE_THEN "F12" (fun th-> USE_THEN "F15" (fun th1 -> REWRITE_TAC[GSYM th; GSYM th1])) + THEN USE_THEN "F9" (fun th-> USE_THEN "F10" (fun th1-> (MP_TAC (MATCH_MP lemma_loop_index (CONJ th1 th))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "A1") (LABEL_TAC "A2")) + THEN USE_THEN "F9" (fun th-> USE_THEN "F10" (fun th1-> (MP_TAC (MATCH_MP lemma_loop_index (CONJ th1 th))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "A1") (LABEL_TAC "A2")) + THEN USE_THEN "F9" (LABEL_TAC "A3" o MATCH_MP lemma_next_in_loop) + THEN USE_THEN "F10" (LABEL_TAC "A4" o MATCH_MP lemma_back_in_loop) + THEN USE_THEN "A4" (fun th-> USE_THEN "A3" (fun th1-> (MP_TAC (MATCH_MP lemma_loop_index (CONJ th1 th))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "A5") (LABEL_TAC "A6")) + THEN ABBREV_TAC `nz = index (L:(A)loop) z y` THEN POP_ASSUM (LABEL_TAC "A7") + THEN ABBREV_TAC `ny = index (L:(A)loop) (next L y) (back L z)` THEN POP_ASSUM (LABEL_TAC "A8") + THEN SUBGOAL_THEN `(ny:num) + (SUC nz) = top (L:(A)loop)` (LABEL_TAC "F16") + THENL[ASM_CASES_TAC `nz:num = top (L:(A)loop)` + THENL[USE_THEN "A2" (MP_TAC o REWRITE_RULE[COM_POWER_FUNCTION] o AP_TERM `next (L:(A)loop)`) + THEN POP_ASSUM (LABEL_TAC "B1") + THEN USE_THEN "B1" (fun th-> REWRITE_TAC[th; GSYM lemma_size; lemma_order_next; I_THM]) + THEN USE_THEN "F12" (fun th-> DISCH_THEN (ASSUME_TAC o REWRITE_RULE[th])) + THEN MP_TAC (REWRITE_RULE[POWER_1] (SPECL[`H:(A)hypermap`; `y:A`; `1`] lemma_power_inverse_in_node2)) + THEN POP_ASSUM SUBST1_TAC THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_node_identity) + THEN USE_THEN "F1" (MP_TAC o CONJUNCT1 o MATCH_MP lemma_on_attach) + THEN USE_THEN "YEL"(fun th-> USE_THEN "ZEL" (fun th1-> REWRITE_TAC[th; th1])) + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN USE_THEN "A1" (fun th-> POP_ASSUM(fun th1 -> LABEL_TAC "B2" (REWRITE_RULE[GSYM LT_LE] (CONJ th th1)))) + THEN USE_THEN "A6" (MP_TAC o AP_TERM `next (L:(A)loop)`) + THEN REWRITE_TAC[lemma_inverse_evaluation; POWER_FUNCTION; COM_POWER_FUNCTION] + THEN USE_THEN "A2" (fun th-> GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN REWRITE_TAC[GSYM lemma_add_exponent_function] + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [CONJUNCT2 ADD] + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [GSYM ADD_SUC] + THEN DISCH_THEN (LABEL_TAC "B3" o SYM) + THEN SUBGOAL_THEN `(next L POWER 0) z = (next (L:(A)loop) POWER ((SUC ny) + (SUC nz))) z` MP_TAC + THENL[USE_THEN "B3" (fun th-> REWRITE_TAC[POWER_0; I_THM; th]); ALL_TAC] + THEN SUBGOAL_THEN `0 < CARD (orbit_map (next (L:(A)loop)) z)` MP_TAC + THENL[USE_THEN "F10" (fun th-> REWRITE_TAC[GSYM(MATCH_MP lemma_transitive_permutation th); GSYM size; lemma_size; LT_0]); ALL_TAC] + THEN MP_TAC (CONJUNCT1(SPEC `L:(A)loop` lemma_permute_loop)) + THEN MP_TAC (CONJUNCT1(SPEC `L:(A)loop` loop_lemma)) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_congruence_on_orbit) + THEN USE_THEN "F10" (fun th-> REWRITE_TAC[GSYM(MATCH_MP lemma_transitive_permutation th); GSYM size; ADD_0]) + THEN DISCH_THEN (X_CHOOSE_THEN `q:num` (LABEL_TAC "B4")) + THEN ASM_CASES_TAC `q:num = 0` + THENL[USE_THEN "B4" MP_TAC THEN POP_ASSUM (SUBST1_TAC) THEN REWRITE_TAC[CONJUNCT1 MULT] THEN ARITH_TAC; ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "B5") + THEN ASM_CASES_TAC `1 < q:num` + THENL[USE_THEN "B2" (MP_TAC o ONCE_REWRITE_RULE[GSYM LT_SUC]) + THEN USE_THEN "A5" (MP_TAC o ONCE_REWRITE_RULE[GSYM LE_SUC]) + THEN REWRITE_TAC[GSYM lemma_size; IMP_IMP] + THEN DISCH_THEN (MP_TAC o MATCH_MP LET_ADD2) + THEN USE_THEN "B4" SUBST1_TAC + THEN POP_ASSUM ((X_CHOOSE_THEN `d:num` SUBST1_TAC) o REWRITE_RULE[GSYM ADD1] o ONCE_REWRITE_RULE[ADD_SYM] o REWRITE_RULE[LT_EXISTS]) + THEN REWRITE_TAC[MULT] THEN REWRITE_TAC[LT_ADD_RCANCEL] THEN ARITH_TAC; ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[NOT_LT]) THEN POP_ASSUM (MP_TAC o REWRITE_RULE[GSYM LT_NZ; GSYM LT1_NZ]) + THEN REWRITE_TAC[IMP_IMP; LE_ANTISYM] + THEN DISCH_TAC THEN USE_THEN "B4" MP_TAC THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN REWRITE_TAC[MULT_CLAUSES; lemma_size; CONJUNCT2 ADD; EQ_SUC]; ALL_TAC] + THEN USE_THEN "F16" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (fun th1-> MP_TAC (CONJUNCT2 (MATCH_MP lemma_on_dnax (CONJ th th1))))) + THEN USE_THEN "YEL" (fun th -> USE_THEN "ZEL" (fun th1-> REWRITE_TAC[tpx; th; th1])) + THEN USE_THEN "MN" (fun th-> USE_THEN "A7" (fun th1-> REWRITE_TAC[th; th1])) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G1") (CONJUNCTS_THEN2 (LABEL_TAC "G2") (CONJUNCTS_THEN2 (LABEL_TAC "G3") (LABEL_TAC "G4")))) + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (fun th1-> MP_TAC (CONJUNCT2 (MATCH_MP lemma_on_dnay (CONJ th th1))))) + THEN USE_THEN "YEL" (fun th -> USE_THEN "ZEL" (fun th1-> REWRITE_TAC[tpy; th; th1])) + THEN USE_THEN "F12" (fun th2->USE_THEN "F15" (fun th3-> REWRITE_TAC[GSYM th2; GSYM th3])) + THEN USE_THEN "MN" (fun th-> USE_THEN "A8" (fun th1-> REWRITE_TAC[tpy; th; th1])) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G5") (CONJUNCTS_THEN2 (LABEL_TAC "G6") (CONJUNCTS_THEN2 (LABEL_TAC "G7") (LABEL_TAC "G8")))) + THEN SUBGOAL_THEN `!u:A. u belong dnax (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A) ==> ~(u belong dnay H NF L x)` (LABEL_TAC "F17") + THENL[GEN_TAC THEN DISCH_THEN (LABEL_TAC "H1") + THEN USE_THEN "F6" MP_TAC THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN (fun th1-> USE_THEN "G5" (fun th-> MP_TAC (MATCH_MP lemma_next_power_representation (CONJ th th1)))) + THEN USE_THEN "G6" (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` (CONJUNCTS_THEN2 (LABEL_TAC "H2") (LABEL_TAC "H3"))) + THEN REMOVE_THEN "H1" (fun th1-> USE_THEN "G1" (fun th-> MP_TAC (MATCH_MP lemma_next_power_representation (CONJ th th1)))) + THEN USE_THEN "G2" (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (X_CHOOSE_THEN `t:num` (CONJUNCTS_THEN2 (LABEL_TAC "H4") (LABEL_TAC "H5"))) + THEN ASM_CASES_TAC `t:num <= nz` + THENL[POP_ASSUM (LABEL_TAC "H6") + THEN REMOVE_THEN "H5" (MP_TAC) + THEN USE_THEN "H6" (fun th-> USE_THEN "G3" (fun th1 -> REWRITE_TAC[MATCH_MP th1 th])) + THEN DISCH_THEN (LABEL_TAC "H7") + THEN ASM_CASES_TAC `k:num <= ny` + THENL[POP_ASSUM (LABEL_TAC "H8") + THEN REMOVE_THEN "H3" MP_TAC + THEN USE_THEN "H8" (fun th-> USE_THEN "G7" (fun th1-> REWRITE_TAC[MATCH_MP th1 th])) + THEN USE_THEN "A2" (SUBST1_TAC o AP_TERM `next (L:(A)loop)`) + THEN REWRITE_TAC[COM_POWER_FUNCTION; GSYM lemma_add_exponent_function] + THEN USE_THEN "H7" SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "H9") + THEN USE_THEN "F8" (fun th-> USE_THEN "F10" (MP_TAC o CONJUNCT1 o MATCH_MP let_order_for_loop o CONJ th)) + THEN DISCH_THEN (MP_TAC o CONJUNCT2 o REWRITE_RULE[lemma_inj_contour_via_list]) + THEN DISCH_THEN (MP_TAC o SPECL[`(k:num) +(SUC nz)`; `t:num`] o REWRITE_RULE[lemma_inj_list]) + THEN USE_THEN "H8" (fun th-> USE_THEN "A5" (fun th1-> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ th th1)])) + THEN USE_THEN "H6" (fun th-> REWRITE_TAC[MATCH_MP LTE_TRANS (CONJ (REWRITE_RULE[GSYM LT_SUC_LE] th) (SPECL[`k:num`; `SUC nz`] LE_ADDR))]) + THEN USE_THEN "F16" (SUBST1_TAC o SYM) + THEN USE_THEN "H8" (fun th-> REWRITE_TAC[LE_ADD_RCANCEL; th; loop_path]) + THEN USE_THEN "H9" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN USE_THEN "H2" MP_TAC + THEN POP_ASSUM ((X_CHOOSE_THEN `d:num` (LABEL_TAC "H10")) o REWRITE_RULE[NOT_LE; LT_EXISTS]) + THEN USE_THEN "H10" SUBST1_TAC THEN REWRITE_TAC[LE_ADD_LCANCEL] + THEN DISCH_THEN (LABEL_TAC "H11") THEN USE_THEN "H3" MP_TAC + THEN USE_THEN "H10" SUBST1_TAC + THEN USE_THEN "H11" (fun th-> USE_THEN "G8" (fun th1-> REWRITE_TAC[MATCH_MP th1 th])) + THEN DISCH_THEN (LABEL_TAC "H12") THEN USE_THEN "H11" MP_TAC + THEN MP_TAC (SPEC `d:num` GE_1) + THEN USE_THEN "F4" (fun th-> USE_THEN "F5" (fun th1-> USE_THEN "F10" (fun th2 -> MP_TAC (MATCH_MP lemma_in_dart (CONJ th (CONJ th1 th2)))))) + THEN USE_THEN "F3" (MP_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP complement_index) + THEN DISCH_THEN (X_CHOOSE_THEN `a:num` (X_CHOOSE_THEN `b:num` (CONJUNCTS_THEN2 (LABEL_TAC "H14") (CONJUNCTS_THEN2 (LABEL_TAC "H15") (CONJUNCTS_THEN2 (LABEL_TAC "H16") (LABEL_TAC "H17")))))) + THEN USE_THEN "F4" (fun th-> USE_THEN "F5" (fun th1-> USE_THEN "F10" (fun th2 -> MP_TAC (MATCH_MP lemma_in_dart (CONJ th (CONJ th1 th2)))))) + THEN USE_THEN "F3" (MP_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN USE_THEN "F3" (MP_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o SPECL[`a:num`; `b:num`] o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o MATCH_MP lemma_complement_path) + THEN USE_THEN "H15" (fun th-> USE_THEN "H16" (fun th1-> USE_THEN "H17" (fun th2-> REWRITE_TAC[th; th1; SYM th2]))) + THEN USE_THEN "H12" (SUBST1_TAC o SYM) + THEN MP_TAC (SPECL[`H:(A)hypermap`; `NF:(A)loop->bool`; `L:(A)loop`; `x:A`] attach) + THEN USE_THEN "ZEL" (fun th-> USE_THEN "YEL" (fun th1-> USE_THEN "MN" (fun th2-> REWRITE_TAC[th; th1; th2]))) + THEN DISCH_THEN (fun th-> GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN USE_THEN "H14" (fun th-> MP_TAC (SPEC `y:A` (MATCH_MP reduce_exponent (CONJ (CONJUNCT2 (SPEC `H:(A)hypermap` face_map_and_darts)) (MATCH_MP LT_IMP_LE (ONCE_REWRITE_RULE[GSYM LT_SUC] th)))))) + THEN REWRITE_TAC[SUB_SUC] + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "H14" ((X_CHOOSE_THEN `s:num` (LABEL_TAC "H18") o REWRITE_RULE[LT_EXISTS])) + THEN USE_THEN "H18" (fun th-> REWRITE_TAC[th; ADD_SUB2]) + THEN DISCH_THEN (LABEL_TAC "H19") + THEN MP_TAC (SPECL[`H:(A)hypermap`; `(face_map (H:(A)hypermap) POWER (SUC s)) (y:A)`; `b:num`] lemma_power_inverse_in_node2) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "H19") + THEN MP_TAC(SPECL[`a:num`; `SUC s`] LE_ADDR) + THEN USE_THEN "H18" (SUBST1_TAC o SYM) + THEN MP_TAC (SPEC `s:num` GE_1) + THEN USE_THEN "F1" MP_TAC + THEN EXPAND_TAC "m" + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o SPEC `u:A` o MATCH_MP lemma_node_outside_support_darts) + THEN USE_THEN "YEL" (fun th-> POP_ASSUM (fun th1-> REWRITE_TAC[th; th1])) + THEN USE_THEN "H7" (fun th-> USE_THEN "F10" (MP_TAC o REWRITE_RULE[SYM th] o SPEC `t:num` o MATCH_MP lemma_power_next_in_loop)) + THEN DISCH_THEN (fun th-> USE_THEN "F5" (fun th1-> REWRITE_TAC[MATCH_MP lemma_in_support2 (CONJ th th1)])); ALL_TAC] + THEN USE_THEN "H4" MP_TAC + THEN POP_ASSUM ((X_CHOOSE_THEN `d:num` (LABEL_TAC "K1")) o REWRITE_RULE[NOT_LE; LT_EXISTS]) + THEN USE_THEN "K1" SUBST1_TAC + THEN REWRITE_TAC[LE_ADD_LCANCEL] + THEN DISCH_THEN (LABEL_TAC "K2") + THEN USE_THEN "K2" (fun th-> USE_THEN "G4" (fun th1-> MP_TAC (MATCH_MP th1 th))) + THEN USE_THEN "K1" (SUBST1_TAC o SYM) + THEN USE_THEN "H5" (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "K3") + THEN ASM_CASES_TAC `k:num <= ny` + THENL[POP_ASSUM (LABEL_TAC "K4") + THEN REMOVE_THEN "H3" MP_TAC + THEN USE_THEN "K4" (fun th-> USE_THEN "G7" (fun th1-> REWRITE_TAC[MATCH_MP th1 th])) + THEN REWRITE_TAC[POWER_FUNCTION] + THEN DISCH_THEN (fun th-> USE_THEN "F9" (MP_TAC o REWRITE_RULE[SYM th] o SPEC `SUC k` o MATCH_MP lemma_power_next_in_loop)) + THEN DISCH_THEN (fun th-> USE_THEN "F5" (fun th1 -> (ASSUME_TAC (MATCH_MP lemma_in_support2 (CONJ th th1))))) + THEN USE_THEN "K2" MP_TAC + THEN MP_TAC (SPEC `d:num` GE_1) + THEN USE_THEN "F1" MP_TAC + THEN EXPAND_TAC "m" + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o SPEC `u:A` o MATCH_MP lemma_node_outside_support_darts) + THEN USE_THEN "K3"(fun th-> USE_THEN "YEL" (fun th1-> REWRITE_TAC[th1; th; node_refl])) + THEN USE_THEN "K3" (fun th-> POP_ASSUM (fun th1-> REWRITE_TAC[SYM th; th1])); ALL_TAC] + THEN POP_ASSUM ((X_CHOOSE_THEN `w:num` (LABEL_TAC "K5")) o REWRITE_RULE[NOT_LE; LT_EXISTS]) + THEN USE_THEN "H2" MP_TAC + THEN USE_THEN "K5" SUBST1_TAC + THEN REWRITE_TAC[LE_ADD_LCANCEL] + THEN DISCH_THEN (LABEL_TAC "K6") + THEN USE_THEN "H3" MP_TAC + THEN USE_THEN "K5" SUBST1_TAC + THEN USE_THEN "K6" (fun th-> USE_THEN "G8" (fun th1-> REWRITE_TAC[MATCH_MP th1 th])) + THEN DISCH_THEN (LABEL_TAC "K7") + THEN USE_THEN "K6" MP_TAC + THEN MP_TAC (SPEC `w:num` GE_1) + THEN USE_THEN "F4" (fun th-> USE_THEN "F5" (fun th1-> USE_THEN "F10" (fun th2 -> MP_TAC (MATCH_MP lemma_in_dart (CONJ th (CONJ th1 th2)))))) + THEN USE_THEN "F3" (MP_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP complement_index) + THEN DISCH_THEN (X_CHOOSE_THEN `a:num` (X_CHOOSE_THEN `b:num` (CONJUNCTS_THEN2 (LABEL_TAC "K8") (CONJUNCTS_THEN2 (LABEL_TAC "K9") (CONJUNCTS_THEN2 (LABEL_TAC "K10") (LABEL_TAC "K11")))))) + THEN USE_THEN "F4" (fun th-> USE_THEN "F5" (fun th1-> USE_THEN "F10" (fun th2 -> MP_TAC (MATCH_MP lemma_in_dart (CONJ th (CONJ th1 th2)))))) + THEN USE_THEN "F3" (MP_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN USE_THEN "F3" (MP_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o SPECL[`a:num`; `b:num`] o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o MATCH_MP lemma_complement_path) + THEN USE_THEN "K9" (fun th-> USE_THEN "K10" (fun th1-> USE_THEN "K11" (fun th2-> REWRITE_TAC[th; th1; SYM th2]))) + THEN USE_THEN "K7" (SUBST1_TAC o SYM) + THEN MP_TAC (SPECL[`H:(A)hypermap`; `NF:(A)loop->bool`; `L:(A)loop`; `x:A`] attach) + THEN USE_THEN "ZEL" (fun th-> USE_THEN "YEL" (fun th1-> USE_THEN "MN" (fun th2-> REWRITE_TAC[th; th1; th2]))) + THEN DISCH_THEN (fun th-> GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN USE_THEN "K8" (fun th-> MP_TAC (SPEC `y:A` (MATCH_MP reduce_exponent (CONJ (CONJUNCT2 (SPEC `H:(A)hypermap` face_map_and_darts)) (MATCH_MP LT_IMP_LE (ONCE_REWRITE_RULE[GSYM LT_SUC] th)))))) + THEN REWRITE_TAC[SUB_SUC] + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "K8" ((X_CHOOSE_THEN `p:num` (LABEL_TAC "K12") o REWRITE_RULE[LT_EXISTS])) + THEN USE_THEN "K12" (fun th-> REWRITE_TAC[th; ADD_SUB2]) + THEN DISCH_THEN (LABEL_TAC "K14") + THEN USE_THEN "K3" (fun th-> MP_TAC (REWRITE_RULE[SYM th] (SPECL[`H:(A)hypermap`; `y:A`; `SUC d`] lemma_in_face))) + THEN DISCH_THEN (LABEL_TAC "K15" o MATCH_MP lemma_face_identity) + THEN USE_THEN "K14" MP_TAC + THEN REWRITE_TAC[GSYM (MATCH_MP inverse_power_function (CONJUNCT2 (SPEC `H:(A)hypermap` node_map_and_darts)))] + THEN DISCH_TAC + THEN MP_TAC (SPECL[`H:(A)hypermap`; `u:A`; `b:num`] lemma_in_node2) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN DISCH_TAC + THEN USE_THEN "K15" (fun th-> MP_TAC (REWRITE_RULE[th] (SPECL[`H:(A)hypermap`; `y:A`; `SUC p`] lemma_in_face))) + THEN POP_ASSUM MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM IN_INTER] + THEN USE_THEN "F9"(fun th2->USE_THEN "F4"(fun th->USE_THEN "F5" (fun th1-> MP_TAC(MATCH_MP lemma_in_dart (CONJ th (CONJ th1 th2)))))) + THEN USE_THEN "K3" (fun th-> DISCH_THEN (ASSUME_TAC o REWRITE_RULE[SYM th] o SPEC `SUC d` o MATCH_MP lemma_dart_invariant_power_face)) + THEN USE_THEN "F3" (MP_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN POP_ASSUM (fun th-> DISCH_THEN (fun th1-> REWRITE_TAC[MATCH_MP (REWRITE_RULE[simple_hypermap] th1) th; IN_SING])) + THEN USE_THEN "K14" SUBST1_TAC + THEN DISCH_THEN (LABEL_TAC "K16") + THEN USE_THEN "K10" MP_TAC + THEN MP_TAC (SPECL[`H:(A)hypermap`; `NF:(A)loop->bool`; `L:(A)loop`; `x:A`] attach) + THEN USE_THEN "ZEL" (fun th-> USE_THEN "YEL" (fun th1-> USE_THEN "MN" (fun th2-> REWRITE_TAC[th; th1; th2]))) + THEN DISCH_THEN (fun th-> GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN USE_THEN "K8" (fun th-> MP_TAC (SPEC `y:A` (MATCH_MP reduce_exponent (CONJ (CONJUNCT2 (SPEC `H:(A)hypermap` face_map_and_darts)) (MATCH_MP LT_IMP_LE (ONCE_REWRITE_RULE[GSYM LT_SUC] th)))))) + THEN REWRITE_TAC[SUB_SUC] + THEN USE_THEN "K12" (fun th-> REWRITE_TAC[th; ADD_SUB2]) + THEN DISCH_THEN (SUBST1_TAC) + THEN DISCH_THEN (MP_TAC o CONJUNCT2 o REWRITE_RULE[lemma_inj_contour_via_list] o MATCH_MP lemma_inj_node_contour) + THEN DISCH_THEN (MP_TAC o SPECL[`b:num`; `0`] o REWRITE_RULE[lemma_inj_list2]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[LE_0; LE_REFL; node_contour; POWER_0; I_THM; SYM th]) + THEN USE_THEN "K9" (fun th-> REWRITE_TAC[REWRITE_RULE[LT1_NZ; LT_NZ] th]); ALL_TAC] + THEN USE_THEN "F17" (fun th-> REWRITE_TAC[th]) + THEN ONCE_REWRITE_TAC[TAUT `(A ==> ~B) <=> (B ==> ~A)`] + THEN USE_THEN "F17" (fun th-> REWRITE_TAC[th]) + THEN STRIP_TAC + THENL[USE_THEN "F17" (MP_TAC o SPEC `next (L:(A)loop) (y:A)`) + THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] + THEN REWRITE_TAC[NOT_IMP] + THEN DISCH_TAC THEN USE_THEN "G5" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "G1" MP_TAC THEN USE_THEN "F10" MP_TAC THEN POP_ASSUM MP_TAC THEN USE_THEN "F5" MP_TAC THEN USE_THEN "F4" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (fun th-> REWRITE_TAC[SYM(MATCH_MP disjoint_loops th)]) + THEN USE_THEN "A3" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN STRIP_TAC + THENL[USE_THEN "F17" (MP_TAC o SPEC `z:A`) THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] + THEN REWRITE_TAC[NOT_IMP] + THEN DISCH_TAC + THEN USE_THEN "G1" (fun th-> REWRITE_TAC[th]) + THEN USE_THEN "G5" MP_TAC THEN USE_THEN "A3" MP_TAC THEN POP_ASSUM MP_TAC THEN USE_THEN "F5" MP_TAC THEN USE_THEN "F4" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (fun th-> REWRITE_TAC[SYM(MATCH_MP disjoint_loops th)]) + THEN USE_THEN "F10" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN GEN_TAC + THEN USE_THEN "F10" (fun th-> DISCH_THEN (fun th1-> MP_TAC(MATCH_MP lemma_loop_index (CONJ th th1)))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "T1") (LABEL_TAC "T2")) + THEN ABBREV_TAC `nu = index (L:(A)loop) (z:A) u` + THEN ASM_CASES_TAC `nu:num <= nz` + THENL[DISJ1_TAC THEN USE_THEN "T2" SUBST1_TAC + THEN POP_ASSUM (fun th-> USE_THEN "G3"(fun th1->REWRITE_TAC[SYM (MATCH_MP th1 th)])) + THEN USE_THEN "G1" (fun th-> REWRITE_TAC[MATCH_MP lemma_power_next_in_loop th]); ALL_TAC] + THEN DISJ2_TAC + THEN POP_ASSUM ((X_CHOOSE_THEN `q:num` (LABEL_TAC "T3")) o REWRITE_RULE[NOT_LE; LT_EXISTS]) + THEN USE_THEN "T3" (fun th-> USE_THEN "T2" (SUBST1_TAC o ONCE_REWRITE_RULE[ADD_SYM] o REWRITE_RULE[th])) + THEN USE_THEN "A2" (fun th-> REWRITE_TAC[lemma_add_exponent_function; SYM th]) + THEN USE_THEN "T1" MP_TAC THEN USE_THEN "T3" SUBST1_TAC + THEN USE_THEN "F16" (SUBST1_TAC o SYM o REWRITE_RULE[CONJUNCT2 ADD; GSYM ADD_SUC] o ONCE_REWRITE_RULE[ADD_SYM]) + THEN REWRITE_TAC[LE_ADD_LCANCEL; LE_SUC] + THEN DISCH_TAC THEN REWRITE_TAC[GSYM POWER_FUNCTION] + THEN POP_ASSUM (fun th-> USE_THEN "G7"(fun th1->REWRITE_TAC[SYM (MATCH_MP th1 th)])) + THEN USE_THEN "G5" (fun th-> REWRITE_TAC[MATCH_MP lemma_power_next_in_loop th]));; + + +let lemma_normal_genesis = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_marked H NF L x /\ ~(L IN canon H NF) + ==> is_normal H (genesis H NF L x)`, + REPEAT GEN_TAC + THEN DISCH_THEN(fun th ->LABEL_TAC "FC"(CONJUNCT1 th) THEN LABEL_TAC "F1"(MATCH_MP lemma_split_marked_loop th)) + THEN USE_THEN "F1" ((CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7" o CONJUNCT1))))) o REWRITE_RULE[is_split_condition]) + THEN USE_THEN "F5" (fun th->(USE_THEN "F4" (LABEL_TAC "F8" o CONJUNCT1 o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN USE_THEN "F1" (LABEL_TAC "F9" o CONJUNCT1 o MATCH_MP lemma_on_heading) + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (fun th1-> LABEL_TAC "F10" (CONJUNCT1(MATCH_MP lemmaHQYMRTX (CONJ th th1))))) + THEN REWRITE_TAC[geney; tpy; start_glue_evaluation; loop_path; POWER_0; I_THM] + THEN ABBREV_TAC `y = heading (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "YEL") + THEN ABBREV_TAC `z = attach (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "ZEL") + THEN ABBREV_TAC `m = mAdd (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "MN") + THEN USE_THEN "YEL" (fun th-> USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o MATCH_MP lemma_on_heading)) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F11") (LABEL_TAC "F12" o CONJUNCT1)) + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (fun th1-> MP_TAC (CONJUNCT2(MATCH_MP lemma_on_adding_darts (CONJ th th1))))) + THEN USE_THEN "ZEL" (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (LABEL_TAC "F15") + THEN USE_THEN "F12" (fun th-> USE_THEN "F15" (fun th1 -> REWRITE_TAC[GSYM th; GSYM th1])) + THEN USE_THEN "F9" (fun th-> USE_THEN "F10" (fun th1-> (MP_TAC (MATCH_MP lemma_loop_index (CONJ th1 th))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "A1") (LABEL_TAC "A2")) + THEN USE_THEN "F9" (LABEL_TAC "A3" o MATCH_MP lemma_next_in_loop) + THEN USE_THEN "F10" (LABEL_TAC "A4" o MATCH_MP lemma_back_in_loop) + THEN USE_THEN "A4" (fun th-> USE_THEN "A3" (fun th1-> (MP_TAC (MATCH_MP lemma_loop_index (CONJ th1 th))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "A5") (LABEL_TAC "A6")) + THEN ABBREV_TAC `nz = index (L:(A)loop) z y` THEN POP_ASSUM (LABEL_TAC "A7") + THEN ABBREV_TAC `ny = index (L:(A)loop) (next L y) (back L z)` THEN POP_ASSUM (LABEL_TAC "A8") + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (fun th1-> MP_TAC (CONJUNCT2 (MATCH_MP lemma_on_dnax (CONJ th th1))))) + THEN USE_THEN "YEL" (fun th -> USE_THEN "ZEL" (fun th1-> REWRITE_TAC[tpx; th; th1])) + THEN USE_THEN "MN" (fun th-> USE_THEN "A7" (fun th1-> REWRITE_TAC[th; th1])) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G1") (CONJUNCTS_THEN2 (LABEL_TAC "G2") (CONJUNCTS_THEN2 (LABEL_TAC "G3") (LABEL_TAC "G4")))) + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (fun th1-> MP_TAC (CONJUNCT2 (MATCH_MP lemma_on_dnay (CONJ th th1))))) + THEN USE_THEN "YEL" (fun th -> USE_THEN "ZEL" (fun th1-> REWRITE_TAC[tpy; th; th1])) + THEN USE_THEN "F12" (fun th2->USE_THEN "F15" (fun th3-> REWRITE_TAC[GSYM th2; GSYM th3])) + THEN USE_THEN "MN" (fun th-> USE_THEN "A8" (fun th1-> REWRITE_TAC[tpy; th; th1])) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "G5") (CONJUNCTS_THEN2 (LABEL_TAC "G6") (CONJUNCTS_THEN2 (LABEL_TAC "G7") (LABEL_TAC "G8")))) + THEN USE_THEN "F4" (fun th-> USE_THEN "F5"(fun th1-> USE_THEN "F9" (fun th2-> LABEL_TAC "F16" (MATCH_MP lemma_in_dart (CONJ th (CONJ th1 th2)))))) + THEN USE_THEN "F4" (fun th-> USE_THEN "F5"(fun th1-> USE_THEN "F10" (fun th2-> LABEL_TAC "F17" (MATCH_MP lemma_in_dart (CONJ th (CONJ th1 th2)))))) + THEN USE_THEN "F4" (fun th-> USE_THEN "F5"(fun th1-> USE_THEN "A3" (fun th2-> LABEL_TAC "F18" (MATCH_MP lemma_in_dart (CONJ th (CONJ th1 th2)))))) + THEN USE_THEN "G7" (fun th-> (MP_TAC(MATCH_MP th (SPEC `ny:num` LE_REFL)))) + THEN USE_THEN "A6" (SUBST1_TAC o SYM) + THEN DISCH_TAC + THEN USE_THEN "G5" (MP_TAC o SPEC `ny:num` o MATCH_MP lemma_power_next_in_loop) + THEN POP_ASSUM (SUBST1_TAC) + THEN DISCH_THEN (LABEL_TAC "F19") + THEN USE_THEN "G3" (fun th-> (MP_TAC(MATCH_MP th (SPEC `nz:num` LE_REFL)))) + THEN USE_THEN "A2" (SUBST1_TAC o SYM) + THEN DISCH_TAC + THEN USE_THEN "G1" (MP_TAC o SPEC `nz:num` o MATCH_MP lemma_power_next_in_loop) + THEN POP_ASSUM (SUBST1_TAC) + THEN DISCH_THEN (LABEL_TAC "F20") + THEN USE_THEN "ZEL"(fun th->USE_THEN "YEL"(fun th1->USE_THEN "MN"(fun th2->USE_THEN "F1" (MP_TAC o REWRITE_RULE[th; th1; th2] o MATCH_MP lemma_on_attach)))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F21") (LABEL_TAC "F22")) + THEN SUBGOAL_THEN `!el:A nm:num. node (H:(A)hypermap) ((inverse (node_map H) POWER nm) el) = node H el` (LABEL_TAC "F22E") + THENL[REPEAT GEN_TAC THEN MP_TAC (SPECL[`H:(A)hypermap`; `el:A`; `nm:num`] lemma_power_inverse_in_node2) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_node_identity th]); ALL_TAC] + THEN REWRITE_TAC[is_normal] + THEN STRIP_TAC + THENL[GEN_TAC THEN REWRITE_TAC[genesis; IN_DELETE; IN_UNION; lemma_in_couple] + THEN STRIP_TAC + THENL[USE_THEN "F4" (MP_TAC o SPEC `L':(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]) + THEN FIND_ASSUM (fun th-> REWRITE_TAC[th]) `L':(A)loop IN NF`; + POP_ASSUM SUBST1_TAC + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [dnax] + THEN SUBGOAL_THEN `is_inj_contour (H:(A)hypermap) (genex H NF L x) (tpx H NF L x) /\ one_step_contour H (genex H NF L x (tpx H NF L x)) (genex H NF L x 0)` MP_TAC + THENL[REWRITE_TAC[one_step_contour] + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (fun th1-> MESON_TAC[MATCH_MP lemma_genex_loop (CONJ th th1)])); ALL_TAC] + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_make_contour_loop th]) + THEN EXISTS_TAC `z:A` + THEN USE_THEN "F17" (fun th-> USE_THEN "G1" (fun th1-> REWRITE_TAC[th; th1])); + POP_ASSUM SUBST1_TAC + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [dnay] + THEN SUBGOAL_THEN `is_inj_contour (H:(A)hypermap) (geney H NF L x) (tpy H NF L x) /\ one_step_contour H (geney H NF L x (tpy H NF L x)) (geney H NF L x 0)` MP_TAC + THENL[REWRITE_TAC[one_step_contour] + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (fun th1-> MESON_TAC[MATCH_MP lemma_geney_loop (CONJ th th1)])); ALL_TAC] + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_make_contour_loop th]) + THEN EXISTS_TAC `next (L:(A)loop) y` + THEN USE_THEN "F18" (fun th-> USE_THEN "G5" (fun th1-> REWRITE_TAC[th; th1]))]; ALL_TAC] + THEN STRIP_TAC + THENL[GEN_TAC THEN REWRITE_TAC[genesis; IN_DELETE; IN_UNION; lemma_in_couple] + THEN STRIP_TAC + THENL[USE_THEN "F4" (MP_TAC o SPEC `L':(A)loop` o CONJUNCT1 o CONJUNCT2 o REWRITE_RULE[is_normal]) + THEN FIND_ASSUM (fun th-> REWRITE_TAC[th]) `L':(A)loop IN NF`; + POP_ASSUM SUBST1_TAC THEN EXISTS_TAC `y:A` THEN EXISTS_TAC `z:A` + THEN USE_THEN "G1" (fun th-> USE_THEN "F20" (fun th1-> USE_THEN "F21" (fun th2-> REWRITE_TAC[th; th1; th2]))); + POP_ASSUM SUBST1_TAC + THEN EXISTS_TAC `next (L:(A)loop) y` THEN EXISTS_TAC `back (L:(A)loop) z` + THEN USE_THEN "F19" (fun th-> USE_THEN "G5" (fun th1-> REWRITE_TAC[th; th1])) + THEN USE_THEN "F12" (fun th-> MP_TAC (REWRITE_RULE[POWER_1; SYM th] (SPECL[`H:(A)hypermap`; `y:A`; `1`] lemma_power_inverse_in_node2))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[SYM(MATCH_MP lemma_node_identity th)]) + THEN USE_THEN "F15" (fun th-> MP_TAC (REWRITE_RULE[POWER_1; SYM th] (SPECL[`H:(A)hypermap`; `z:A`; `1`] lemma_in_node2))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[SYM(MATCH_MP lemma_node_identity th)]) + THEN USE_THEN "F21" (fun th-> REWRITE_TAC[th])]; ALL_TAC] + THEN SUBGOAL_THEN `!M:(A)loop t:A. M IN (NF:(A)loop->bool) /\ ~(M = L) /\ t belong M ==> ~(t belong dnax H NF L x)` (LABEL_TAC "F24") + THENL[REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "H1") (CONJUNCTS_THEN2 MP_TAC (LABEL_TAC "H2"))) + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "G2" (fun th1-> USE_THEN "G1" (fun th-> DISCH_THEN (MP_TAC o REWRITE_RULE[th1] o MATCH_MP lemma_loop_index o CONJ th))) + THEN ABBREV_TAC `g = index (dnax (H:(A)hypermap) NF L x) (z:A) t` THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "H3") (LABEL_TAC "H4")) + THEN ASM_CASES_TAC `g:num <= nz` + THENL[POP_ASSUM (fun th-> USE_THEN "G3" (fun th1 -> MP_TAC (MATCH_MP th1 th))) + THEN USE_THEN "H4" (SUBST1_TAC o SYM) + THEN DISCH_THEN (fun th-> USE_THEN "F10" (MP_TAC o REWRITE_RULE[SYM th] o SPEC `g:num` o MATCH_MP lemma_power_next_in_loop)) + THEN USE_THEN "H2" MP_TAC THEN USE_THEN "F5" MP_TAC THEN USE_THEN "H1" MP_TAC THEN USE_THEN "F4" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP disjoint_loops th]); ALL_TAC] + THEN USE_THEN "H3" MP_TAC + THEN POP_ASSUM ((X_CHOOSE_THEN `a:num` (LABEL_TAC "H5") o REWRITE_RULE[NOT_LE; LT_EXISTS])) + THEN USE_THEN "H5" (fun th -> REWRITE_TAC[th; LE_ADD_LCANCEL]) + THEN DISCH_THEN (LABEL_TAC "H6") + THEN USE_THEN "G4" (fun th -> USE_THEN "H6" (MP_TAC o MATCH_MP th)) + THEN USE_THEN "H5" (fun th-> USE_THEN "H4" (fun th1 -> REWRITE_TAC[GSYM th; SYM th1])) + THEN DISCH_THEN (LABEL_TAC "H7") + THEN USE_THEN "H6" MP_TAC THEN MP_TAC (SPEC `a:num` GE_1) THEN USE_THEN "F1" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN EXPAND_TAC "m" + THEN DISCH_THEN (MP_TAC o SPEC `t:A` o MATCH_MP lemma_node_outside_support_darts) + THEN USE_THEN "YEL" (fun th-> USE_THEN "H7" (fun th1-> REWRITE_TAC[th; th1; node_refl])) + THEN USE_THEN "H7" (SUBST1_TAC o SYM) + THEN USE_THEN "H2" (fun th-> USE_THEN "H1" (fun th1-> REWRITE_TAC[MATCH_MP lemma_in_support2 (CONJ th th1)])); ALL_TAC] + THEN SUBGOAL_THEN `!M:(A)loop t:A. M IN (NF:(A)loop->bool) /\ ~(M = L) /\ t belong M ==> ~(t belong dnay H NF L x)` (LABEL_TAC "F25") + THENL[REPEAT GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "H1") (CONJUNCTS_THEN2 MP_TAC (LABEL_TAC "H2"))) + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN USE_THEN "G6" (fun th1-> USE_THEN "G5" (fun th-> DISCH_THEN (MP_TAC o REWRITE_RULE[th1] o MATCH_MP lemma_loop_index o CONJ th))) + THEN ABBREV_TAC `g = index (dnay (H:(A)hypermap) NF L x) (next L y) t` + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "H3") (LABEL_TAC "H4")) + THEN ASM_CASES_TAC `g:num <= ny` + THENL[POP_ASSUM (fun th-> USE_THEN "G7" (fun th1 -> MP_TAC (MATCH_MP th1 th))) + THEN USE_THEN "H4" (SUBST1_TAC o SYM) THEN DISCH_TAC + THEN POP_ASSUM (fun th-> USE_THEN "A3" (MP_TAC o REWRITE_RULE[SYM th] o SPEC `g:num` o MATCH_MP lemma_power_next_in_loop)) + THEN USE_THEN "H2" MP_TAC THEN USE_THEN "F5" MP_TAC THEN USE_THEN "H1" MP_TAC THEN USE_THEN "F4" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP disjoint_loops th]); ALL_TAC] + THEN USE_THEN "H3" MP_TAC + THEN POP_ASSUM ((X_CHOOSE_THEN `a:num` (LABEL_TAC "H5") o REWRITE_RULE[NOT_LE; LT_EXISTS])) + THEN USE_THEN "H5" (fun th -> REWRITE_TAC[th; LE_ADD_LCANCEL]) + THEN DISCH_THEN (LABEL_TAC "H6") + THEN USE_THEN "G8" (fun th -> USE_THEN "H6" (MP_TAC o MATCH_MP th)) + THEN USE_THEN "H5" (fun th-> USE_THEN "H4" (fun th1 -> REWRITE_TAC[GSYM th; SYM th1])) + THEN DISCH_THEN (LABEL_TAC "H7") + THEN USE_THEN "H6" MP_TAC THEN MP_TAC (SPEC `a:num` GE_1) THEN USE_THEN "F17" MP_TAC + THEN USE_THEN "F3" (MP_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP complement_index) + THEN DISCH_THEN (X_CHOOSE_THEN `u:num`(X_CHOOSE_THEN `v:num` (CONJUNCTS_THEN2 (LABEL_TAC "H8") (CONJUNCTS_THEN2 (LABEL_TAC "H9") (CONJUNCTS_THEN2 (LABEL_TAC "H10") (LABEL_TAC "H11")))))) + THEN USE_THEN "F17" MP_TAC + THEN USE_THEN "F3" (MP_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN USE_THEN "F3" (MP_TAC o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_restricted]) + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o SPECL[`u:num`; `v:num`] o CONJUNCT1 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o MATCH_MP lemma_complement_path) + THEN USE_THEN "H9" (fun th-> USE_THEN "H10" (fun th1-> USE_THEN "H11" (fun th2-> REWRITE_TAC[th; th1; SYM th2]))) + THEN USE_THEN "H7" (SUBST1_TAC o SYM) + THEN MP_TAC (SPECL[`H:(A)hypermap`; `NF:(A)loop->bool`; `L:(A)loop`; `x:A`] attach) + THEN USE_THEN "ZEL" (fun th-> USE_THEN "YEL" (fun th1-> USE_THEN "MN" (fun th2-> REWRITE_TAC[th; th1; th2]))) + THEN DISCH_THEN (fun th-> GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN USE_THEN "H8" (fun th-> MP_TAC (SPEC `y:A` (MATCH_MP reduce_exponent (CONJ (CONJUNCT2 (SPEC `H:(A)hypermap` face_map_and_darts)) (MATCH_MP LT_IMP_LE (ONCE_REWRITE_RULE[GSYM LT_SUC] th)))))) + THEN REWRITE_TAC[SUB_SUC] THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "H8" ((X_CHOOSE_THEN `p:num` (LABEL_TAC "H12") o REWRITE_RULE[LT_EXISTS])) + THEN USE_THEN "H12" (fun th-> REWRITE_TAC[th; ADD_SUB2]) + THEN DISCH_TAC + THEN MP_TAC (SPECL[`H:(A)hypermap`; `(face_map (H:(A)hypermap) POWER (SUC p)) y`;`v:num`] lemma_power_inverse_in_node2) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN DISCH_TAC THEN MP_TAC (SPECL[`u:num`; `SUC p`] LE_ADDR) + THEN USE_THEN "H12" (SUBST1_TAC o SYM) THEN EXPAND_TAC "m" + THEN MP_TAC (SPEC `p:num` GE_1) THEN USE_THEN "F1" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o SPEC `t:A` o MATCH_MP lemma_node_outside_support_darts) + THEN USE_THEN "YEL" (fun th-> POP_ASSUM (fun th1-> REWRITE_TAC[th; th1])) + THEN USE_THEN "H2" (fun th-> USE_THEN "H1" (fun th1-> REWRITE_TAC[MATCH_MP lemma_in_support2 (CONJ th th1)])); ALL_TAC] + THEN STRIP_TAC + THENL[REPEAT GEN_TAC THEN REWRITE_TAC[genesis; IN_DELETE; IN_UNION; lemma_in_couple] + THEN ASM_CASES_TAC `(L':(A)loop IN NF) /\ ~(L' = L)` + THENL[POP_ASSUM (LABEL_TAC "H1") + THEN USE_THEN "H1" (fun th-> REWRITE_TAC[th]) + THEN ASM_CASES_TAC `(L'':(A)loop IN NF) /\ ~(L'' = L)` + THENL[POP_ASSUM (LABEL_TAC "H2") + THEN USE_THEN "H2" (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (MP_TAC o CONJUNCT1) + THEN POP_ASSUM (MP_TAC o CONJUNCT1) + THEN USE_THEN "F4" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN REWRITE_TAC[disjoint_loops]; ALL_TAC] + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM (CONJUNCTS_THEN2 (LABEL_TAC "H3") (LABEL_TAC "H4")) + THEN ASM_CASES_TAC `L'':(A)loop = dnax (H:(A)hypermap) NF L x` + THENL[POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) + THEN USE_THEN "H4" MP_TAC THEN USE_THEN "H3" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN USE_THEN "F24" (fun th-> DISCH_THEN (MP_TAC o MATCH_MP th)) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_THEN(CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) + THEN USE_THEN "H4" MP_TAC THEN USE_THEN "H3" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN USE_THEN "F25" (fun th-> DISCH_THEN (MP_TAC o MATCH_MP th)) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN ASM_CASES_TAC `(L'':(A)loop IN NF) /\ ~(L'' = L)` + THENL[POP_ASSUM (LABEL_TAC "H1") + THEN USE_THEN "H1" (fun th-> REWRITE_TAC[th]) + THEN ASM_CASES_TAC `L':(A)loop = dnax (H:(A)hypermap) NF L x` + THENL[POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) + THEN USE_THEN "H1" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN USE_THEN "F24" (fun th-> DISCH_THEN (MP_TAC o MATCH_MP th)) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) + THEN USE_THEN "H1" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN USE_THEN "F25" (fun th-> DISCH_THEN (MP_TAC o MATCH_MP th)) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN ASM_CASES_TAC `L':(A)loop = dnax (H:(A)hypermap) (NF:(A)loop->bool) L x` + THENL[POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN ASM_CASES_TAC `L'':(A)loop = dnax (H:(A)hypermap) NF L x` + THENL[POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (fun th-> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN REWRITE_TAC[] + THEN DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "H1") (LABEL_TAC "H2")) + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (MP_TAC o SPEC `x':A` o CONJUNCT1 o CONJUNCT2 o MATCH_MP lemma_disjoint_new_loops o CONJ th)) + THEN USE_THEN "H1" (fun th-> USE_THEN "H2" (fun th1-> REWRITE_TAC[th; th1])); ALL_TAC] + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) + THEN POP_ASSUM (SUBST1_TAC) + THEN ASM_CASES_TAC `L'':(A)loop = dnay (H:(A)hypermap) (NF:(A)loop->bool) L x` + THENL[POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (fun th-> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN REWRITE_TAC[] THEN DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "H1") (LABEL_TAC "H2")) + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (MP_TAC o SPEC `x':A` o CONJUNCT1 o CONJUNCT2 o MATCH_MP lemma_disjoint_new_loops o CONJ th)) + THEN USE_THEN "H1" (fun th-> USE_THEN "H2" (fun th1-> REWRITE_TAC[th; th1])); ALL_TAC] + THEN REPEAT GEN_TAC + THEN REWRITE_TAC[genesis; IN_ELIM_THM; IN_DELETE; IN_UNION; lemma_in_couple] + THEN ASM_CASES_TAC `(L':(A)loop IN (NF:(A)loop->bool)) /\ ~(L' = L)` + THENL[POP_ASSUM (fun th -> REWRITE_TAC[th] THEN LABEL_TAC "H1" (CONJUNCT1 th)) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "H2") (LABEL_TAC "H3")) + THEN USE_THEN "F4" (MP_TAC o SPECL[`L':(A)loop`; `x':A`; `y':A`] o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_normal]) + THEN USE_THEN "H1" (fun th-> USE_THEN "H2" (fun th1-> USE_THEN "H3" (fun th2-> REWRITE_TAC[th; th1; th2]))) + THEN DISCH_THEN (X_CHOOSE_THEN `M:(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "H4") (LABEL_TAC "H5"))) + THEN ASM_CASES_TAC `~(M = L:(A)loop)` + THENL[EXISTS_TAC `M:(A)loop` + THEN POP_ASSUM (fun th-> POP_ASSUM (fun th2 -> POP_ASSUM (fun th1-> REWRITE_TAC[CONJ th1 th; th2]))); ALL_TAC] + THEN USE_THEN "H5" MP_TAC + THEN POP_ASSUM (SUBST1_TAC o REWRITE_RULE[]) + THEN DISCH_THEN (fun th1-> USE_THEN "FC"(fun th-> USE_THEN "F6"(MP_TAC o REWRITE_RULE[th1] o SPEC `y':A` o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o MATCH_MP lemma_disjoint_new_loops o CONJ th))) + THEN STRIP_TAC + THENL[EXISTS_TAC `dnax (H:(A)hypermap) NF L x` THEN REPLICATE_TAC 2 (POP_ASSUM (fun th-> REWRITE_TAC[th])); ALL_TAC] + THEN EXISTS_TAC `dnay (H:(A)hypermap) NF L x` + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th-> REWRITE_TAC[th])); ALL_TAC] + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN ASM_CASES_TAC `L' = dnax (H:(A)hypermap) NF L x` + THENL[POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "H1") (LABEL_TAC "H2")) + THEN USE_THEN "H1" MP_TAC + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (fun th1-> REWRITE_TAC[MATCH_MP lemma_in_dnax (CONJ th th1)])) + THEN USE_THEN "YEL"(fun th->USE_THEN "ZEL"(fun th1->USE_THEN "MN"(fun th2->USE_THEN "A7" (fun th3-> REWRITE_TAC[th; th1; th2; th3])))) + THEN STRIP_TAC + THENL[POP_ASSUM (fun th-> USE_THEN "F10" (MP_TAC o REWRITE_RULE[GSYM th] o SPEC `i:num` o MATCH_MP lemma_power_next_in_loop)) + THEN DISCH_THEN (LABEL_TAC "H3") + THEN USE_THEN "F4" (MP_TAC o SPECL[`L:(A)loop`; `x':A`; `y':A`] o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_normal]) + THEN USE_THEN "F5" (fun th-> USE_THEN "H2" (fun th1-> USE_THEN "H3" (fun th2-> REWRITE_TAC[th; th1; th2]))) + THEN DISCH_THEN (X_CHOOSE_THEN `M:(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "H4") (LABEL_TAC "H5"))) + THEN ASM_CASES_TAC `~(M = L:(A)loop)` + THENL[EXISTS_TAC `M:(A)loop` + THEN POP_ASSUM (fun th-> POP_ASSUM (fun th2 -> POP_ASSUM (fun th1-> REWRITE_TAC[CONJ th1 th; th2]))); ALL_TAC] + THEN USE_THEN "H5" MP_TAC + THEN POP_ASSUM (SUBST1_TAC o REWRITE_RULE[]) + THEN DISCH_THEN (fun th1-> USE_THEN "FC"(fun th-> USE_THEN "F6"(MP_TAC o REWRITE_RULE[th1] o SPEC `y':A` o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o MATCH_MP lemma_disjoint_new_loops o CONJ th))) + THEN STRIP_TAC + THENL[EXISTS_TAC `dnax (H:(A)hypermap) NF L x` THEN REPLICATE_TAC 2 (POP_ASSUM (fun th-> REWRITE_TAC[th])); ALL_TAC] + THEN EXISTS_TAC `dnay (H:(A)hypermap) NF L x` + THEN REPLICATE_TAC 2 (POP_ASSUM (fun th-> REWRITE_TAC[th])); ALL_TAC] + THEN USE_THEN "H2" MP_TAC + THEN POP_ASSUM (fun th -> LABEL_TAC "H3" th THEN SUBST1_TAC th) + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_via_inverse_node_map) + THEN DISCH_THEN (X_CHOOSE_THEN `j:num` (CONJUNCTS_THEN2 (LABEL_TAC "H4") (LABEL_TAC "H5"))) + THEN ASM_CASES_TAC `j:num = 0` + THENL[USE_THEN "H5" MP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[th; POWER_0; I_THM]) + THEN USE_THEN "H3" (SUBST1_TAC o SYM) THEN DISCH_THEN SUBST1_TAC + THEN EXISTS_TAC `dnax (H:(A)hypermap) NF L x` THEN USE_THEN "H1" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "F5" o REWRITE_RULE[GSYM LT_NZ; GSYM LT1_NZ]) + THEN EXISTS_TAC `dnay (H:(A)hypermap) NF L x` THEN REWRITE_TAC[] + THEN REMOVE_THEN "H5" MP_TAC THEN REMOVE_THEN "H4" MP_TAC THEN POP_ASSUM MP_TAC + THEN UNDISCH_TAC `i:num <= m` THEN UNDISCH_TAC `1 <= i:num` + THEN USE_THEN "F6" MP_TAC THEN USE_THEN "FC" MP_TAC THEN EXPAND_TAC "m" THEN EXPAND_TAC "y" THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN REWRITE_TAC[lemma_in_dnay2]; ALL_TAC] + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) + THEN POP_ASSUM SUBST1_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "H1") (LABEL_TAC "H2")) + THEN USE_THEN "H1" MP_TAC + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (fun th1-> REWRITE_TAC[MATCH_MP lemma_in_dnay (CONJ th th1)])) + THEN USE_THEN "YEL"(fun th->USE_THEN "ZEL"(fun th1->USE_THEN "MN"(fun th2->USE_THEN "A7" (fun th3-> REWRITE_TAC[th; th1; th2; th3])))) + THEN USE_THEN "F12" (fun th-> USE_THEN "F15" (fun th1 -> USE_THEN "A8" (fun th2-> REWRITE_TAC[SYM th; SYM th1; th2]))) + THEN STRIP_TAC + THENL[POP_ASSUM (fun th-> USE_THEN "A3" (MP_TAC o REWRITE_RULE[GSYM th] o SPEC `i:num` o MATCH_MP lemma_power_next_in_loop)) + THEN DISCH_THEN (LABEL_TAC "H3") + THEN USE_THEN "F4" (MP_TAC o SPECL[`L:(A)loop`; `x':A`; `y':A`] o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o REWRITE_RULE[is_normal]) + THEN USE_THEN "F5" (fun th-> USE_THEN "H2" (fun th1-> USE_THEN "H3" (fun th2-> REWRITE_TAC[th; th1; th2]))) + THEN DISCH_THEN (X_CHOOSE_THEN `M:(A)loop` (CONJUNCTS_THEN2 (LABEL_TAC "H4") (LABEL_TAC "H5"))) + THEN ASM_CASES_TAC `~(M = L:(A)loop)` + THENL[EXISTS_TAC `M:(A)loop` + THEN POP_ASSUM (fun th-> POP_ASSUM (fun th2 -> POP_ASSUM (fun th1-> REWRITE_TAC[CONJ th1 th; th2]))); ALL_TAC] + THEN USE_THEN "H5" MP_TAC THEN POP_ASSUM (SUBST1_TAC o REWRITE_RULE[]) + THEN DISCH_THEN (fun th1-> USE_THEN "FC"(fun th-> USE_THEN "F6"(MP_TAC o REWRITE_RULE[th1] o SPEC `y':A` o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o CONJUNCT2 o MATCH_MP lemma_disjoint_new_loops o CONJ th))) + THEN STRIP_TAC + THENL[EXISTS_TAC `dnax (H:(A)hypermap) NF L x` THEN REPLICATE_TAC 2 (POP_ASSUM (fun th-> REWRITE_TAC[th])); ALL_TAC] + THEN EXISTS_TAC `dnay (H:(A)hypermap) NF L x` THEN REPLICATE_TAC 2 (POP_ASSUM (fun th-> REWRITE_TAC[th])); ALL_TAC] + THEN USE_THEN "H2" MP_TAC + THEN POP_ASSUM (fun th -> LABEL_TAC "H3" th THEN SUBST1_TAC th) + THEN USE_THEN "F22E" (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_via_inverse_node_map) + THEN DISCH_THEN (X_CHOOSE_THEN `u:num` (CONJUNCTS_THEN2 (LABEL_TAC "H4") (LABEL_TAC "H5"))) + THEN ASM_CASES_TAC `u:num = 0` + THENL[USE_THEN "H5" MP_TAC + THEN POP_ASSUM (fun th-> REWRITE_TAC[th; POWER_0; I_THM]) THEN DISCH_TAC + THEN EXISTS_TAC `dnax (H:(A)hypermap) NF L x` THEN REWRITE_TAC[] + THEN POP_ASSUM MP_TAC THEN UNDISCH_TAC `i:num <= m` THEN UNDISCH_TAC `1 <= i:num` + THEN USE_THEN "F6" MP_TAC THEN USE_THEN "FC" MP_TAC THEN EXPAND_TAC "m" THEN EXPAND_TAC "y" + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC; lemma_in_dnax2]; ALL_TAC] + THEN EXISTS_TAC `dnay (H:(A)hypermap) NF L x` + THEN REWRITE_TAC[] + THEN USE_THEN "H5" MP_TAC THEN USE_THEN "H4" MP_TAC THEN (POP_ASSUM (MP_TAC o REWRITE_RULE[GSYM LT_NZ; GSYM LT1_NZ])) + THEN UNDISCH_TAC `i:num <= m` THEN UNDISCH_TAC `1 <= i` THEN USE_THEN "F6" MP_TAC THEN USE_THEN "FC" MP_TAC + THEN EXPAND_TAC "m" THEN EXPAND_TAC "y" THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC; lemma_in_dnay2]);; + + +(* Atoms of dnax *) + +let lemma_separation_on_loop = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A y:A z:A. is_restricted H /\ is_normal H NF /\ L IN NF /\ z belong L /\ x belong L /\ y belong L /\ head H NF x = x /\ index L z (head H NF z) < index L z y /\ index L z y <= index L z x ==> index L z (head H NF z) < index L z (tail H NF y) /\ index L z (tail H NF y) <= index L z y /\ index L z y <= index L z (head H NF y) /\ index L z (head H NF y) <= index L z x`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (CONJUNCTS_THEN2 (LABEL_TAC "F7") (CONJUNCTS_THEN2 (LABEL_TAC "F8") (LABEL_TAC "F9"))))))))) + THEN USE_THEN "F2"(fun th->USE_THEN "F3"(fun th1->USE_THEN "F4"(fun th2-> MP_TAC (MATCH_MP head_on_loop (CONJ th (CONJ th1 th2)))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F10") (LABEL_TAC "F11")) + THEN USE_THEN "F4"(fun th->USE_THEN "F10"(fun th1-> LABEL_TAC "F12"(MATCH_MP lemma_in_loop (CONJ th th1)))) + THEN USE_THEN "F4"(fun th-> USE_THEN "F5" (fun th1-> MP_TAC (MATCH_MP lemma_loop_index (CONJ th th1)))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "XB") (LABEL_TAC "F14")) + THEN USE_THEN "F4"(fun th-> USE_THEN "F6" (fun th1-> MP_TAC (MATCH_MP lemma_loop_index (CONJ th th1)))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "YB") (LABEL_TAC "F15")) + THEN USE_THEN "F4"(fun th-> USE_THEN "F12" (fun th1-> LABEL_TAC "F16" (CONJUNCT2(MATCH_MP lemma_loop_index (CONJ th th1))))) + THEN USE_THEN "F2"(fun th->USE_THEN "F3"(fun th1->USE_THEN "F6" (fun th2-> MP_TAC (MATCH_MP margin_in_loop (CONJ th (CONJ th1 th2)))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F17") (LABEL_TAC "F18")) + THEN ABBREV_TAC `nz = index (L:(A)loop) z (head (H:(A)hypermap) NF z)` + THEN POP_ASSUM (LABEL_TAC "NZ") + THEN ABBREV_TAC `n1 = index (L:(A)loop) z (tail (H:(A)hypermap) NF y)` + THEN POP_ASSUM (LABEL_TAC "N1") + THEN ABBREV_TAC `ny = index (L:(A)loop) z y` + THEN POP_ASSUM (LABEL_TAC "NY") + THEN ABBREV_TAC `n2 = index (L:(A)loop) z (head (H:(A)hypermap) NF y)` + THEN POP_ASSUM (LABEL_TAC "N2") + THEN ABBREV_TAC `nx = index (L:(A)loop) z x` + THEN POP_ASSUM (LABEL_TAC "NX") + THEN SUBGOAL_THEN `(?n:num. nz < n /\ n <= ny:num /\ (next L POWER n) z = face_map (H:(A)hypermap) (back L ((next L POWER n) z))) /\ (?M:num. !n:num. nz < n /\ n <= ny:num /\ (next L POWER n) z = face_map H (back L ((next L POWER n) z)) ==> n <= M)` MP_TAC + THENL[STRIP_TAC + THENL[EXISTS_TAC `SUC nz` + THEN USE_THEN "F8" (fun th-> REWRITE_TAC[REWRITE_RULE[GSYM LE_SUC_LT] th; LT_PLUS]) + THEN USE_THEN "F16" (fun th-> REWRITE_TAC[GSYM COM_POWER_FUNCTION; GSYM th; lemma_inverse_evaluation]) + THEN USE_THEN "F2"(fun th->USE_THEN "F3"(fun th1->USE_THEN "F4"(fun th2-> REWRITE_TAC[MATCH_MP value_next_of_head (CONJ th (CONJ th1 th2))]))); ALL_TAC] + THEN EXISTS_TAC `ny:num` + THEN GEN_TAC THEN DISCH_THEN (fun th-> REWRITE_TAC[CONJUNCT1 (CONJUNCT2 th)]); ALL_TAC] + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [num_MAX] + THEN DISCH_THEN (X_CHOOSE_THEN `m:num` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "H1") (CONJUNCTS_THEN2 (LABEL_TAC "H2") (LABEL_TAC "H3"))) (LABEL_TAC "H4"))) + THEN SUBGOAL_THEN `m:num = n1:num` (LABEL_TAC "H5") + THENL[REMOVE_THEN "H2" ((X_CHOOSE_THEN `d:num` (LABEL_TAC "H2") o REWRITE_RULE[LE_EXISTS])) + THEN USE_THEN "F4" (LABEL_TAC "H6" o SPEC `m:num` o MATCH_MP lemma_power_next_in_loop) + THEN ABBREV_TAC `u = (next (L:(A)loop) POWER m) z` THEN POP_ASSUM (LABEL_TAC "UL") + THEN SUBGOAL_THEN `!i:num. i <= d:num ==> (next (L:(A)loop) POWER i) u = (inverse (node_map (H:(A)hypermap)) POWER i) u` MP_TAC + THENL[INDUCT_TAC THENL[REWRITE_TAC[LE_0; POWER_0; I_THM]; ALL_TAC] + THEN DISCH_THEN (LABEL_TAC "H7") + THEN REWRITE_TAC [GSYM COM_POWER_FUNCTION] + THEN FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) + THEN USE_THEN "H7"(fun th-> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ (SPEC `i:num` LE_PLUS) th)]) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN USE_THEN "H6" (MP_TAC o SPEC `i:num` o MATCH_MP lemma_power_next_in_loop) + THEN USE_THEN "F3" MP_TAC THEN USE_THEN "F2" MP_TAC THEN USE_THEN "F1" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_next_exclusive2 th]) + THEN STRIP_TAC + THEN USE_THEN "H4" (MP_TAC o SPEC `(SUC i) + (m:num)`) + THEN USE_THEN "H1" (fun th-> REWRITE_TAC[MATCH_MP LTE_TRANS (CONJ th (SPECL[`SUC i`; `m:num`] LE_ADDR))]) + THEN USE_THEN "H2" (SUBST1_TAC o ONCE_REWRITE_RULE[ADD_SYM]) + THEN USE_THEN "H7"(fun th-> REWRITE_TAC[LE_ADD_RCANCEL; th]) + THEN USE_THEN "UL" (fun th-> REWRITE_TAC[lemma_add_exponent_function; th]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[GSYM COM_POWER_FUNCTION; lemma_inverse_evaluation; SYM th]) + THEN REWRITE_TAC[NOT_LE; LT_ADDR; GSYM LT1_NZ; GE_1]; ALL_TAC] + THEN USE_THEN "F3"(fun th-> USE_THEN "F2" (MP_TAC o CONJUNCT1 o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal])) + THEN REWRITE_TAC[IMP_IMP] THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_in_atom) + THEN USE_THEN "UL" (fun th-> GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [SYM th]) + THEN REWRITE_TAC[GSYM lemma_add_exponent_function] + THEN USE_THEN "H2" (fun th-> USE_THEN "F15" (fun th1-> REWRITE_TAC[GSYM (ONCE_REWRITE_RULE[ADD_SYM] th); GSYM th1])) + THEN DISCH_TAC + THEN MP_TAC (SPECL[`H:(A)hypermap`; `L:(A)loop`; `u:A`] atom_reflect) + THEN POP_ASSUM (fun th-> REWRITE_TAC[MATCH_MP lemma_identity_atom th]) + THEN USE_THEN "F6" MP_TAC THEN USE_THEN "F3" MP_TAC THEN USE_THEN "F2" MP_TAC THEN USE_THEN "F1" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN USE_THEN "H3" (fun th-> DISCH_THEN (MP_TAC o REWRITE_RULE[SYM th] o MATCH_MP lemma_tail)) + THEN DISCH_TAC THEN USE_THEN "UL" (MP_TAC o SYM) + THEN USE_THEN "H2" (MP_TAC o MATCH_MP compare_left o SYM) + THEN DISCH_THEN (fun th-> USE_THEN "YB" (fun th1-> MP_TAC (MATCH_MP LE_TRANS (CONJ th th1)))) + THEN USE_THEN "F4" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o SYM o MATCH_MP determine_loop_index) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN USE_THEN "N1"(fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN USE_THEN "H1" (fun th-> USE_THEN "H2" (fun th1-> REWRITE_TAC[th; th1])) + THEN SUBGOAL_THEN `(?n:num. ny:num <= n /\ n <= nx:num /\ next (L:(A)loop) ((next L POWER n) z) = face_map (H:(A)hypermap) ((next L POWER n) z))` MP_TAC + THENL[EXISTS_TAC `nx:num` + THEN USE_THEN "F9"(fun th-> USE_THEN "F14"(fun th1-> REWRITE_TAC[th; GSYM th1; LE_REFL])) + THEN USE_THEN "F7" (fun th-> ONCE_REWRITE_TAC[SYM th]) + THEN USE_THEN "F2"(fun th->USE_THEN "F3"(fun th1->USE_THEN "F5"(fun th2-> REWRITE_TAC[MATCH_MP value_next_of_head (CONJ th (CONJ th1 th2))]))); ALL_TAC] + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [num_WOP] + THEN DISCH_THEN (X_CHOOSE_THEN `n:num` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "G1") (CONJUNCTS_THEN2 (LABEL_TAC "G2") (LABEL_TAC "G3"))) (LABEL_TAC "G4"))) + THEN SUBGOAL_THEN `n:num = n2:num` (LABEL_TAC "FG") + THENL[REMOVE_THEN "G1" ((X_CHOOSE_THEN `d:num` (LABEL_TAC "G1") o REWRITE_RULE[LE_EXISTS])) + THEN ABBREV_TAC `v = (next (L:(A)loop) POWER n) z` THEN POP_ASSUM (LABEL_TAC "VL") + THEN SUBGOAL_THEN `!i:num. i <= d:num ==> (next (L:(A)loop) POWER i) y = (inverse (node_map (H:(A)hypermap)) POWER i) y` MP_TAC + THENL[INDUCT_TAC THENL[REWRITE_TAC[LE_0; POWER_0; I_THM]; ALL_TAC] + THEN DISCH_THEN (LABEL_TAC "G6") + THEN REWRITE_TAC [GSYM COM_POWER_FUNCTION] + THEN FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) + THEN USE_THEN "G6"(fun th-> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ (SPEC `i:num` LE_PLUS) th)]) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN USE_THEN "F6" (MP_TAC o SPEC `i:num` o MATCH_MP lemma_power_next_in_loop) + THEN USE_THEN "F3" MP_TAC THEN USE_THEN "F2" MP_TAC THEN USE_THEN "F1" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_next_exclusive2 th]) + THEN STRIP_TAC + THEN USE_THEN "G4" (MP_TAC o SPEC `(i:num) + (ny:num)`) + THEN USE_THEN "G1" (SUBST1_TAC o ONCE_REWRITE_RULE[ADD_SYM]) + THEN USE_THEN "G6"(fun th-> REWRITE_TAC[LT_ADD_RCANCEL; REWRITE_RULE[LE_SUC_LT] th; LE_ADDR]) + THEN USE_THEN "G6" (MP_TAC o MATCH_MP LE_TRANS o CONJ (SPEC `i:num` LE_PLUS)) + THEN DISCH_THEN (fun th-> (MP_TAC (ONCE_REWRITE_RULE[GSYM (SPECL[`i:num`; `d:num`; `ny:num`] LE_ADD_RCANCEL)] th))) + THEN USE_THEN "G1" (fun th-> REWRITE_TAC[GSYM (ONCE_REWRITE_RULE[ADD_SYM] th)]) + THEN DISCH_THEN (fun th -> USE_THEN "G2" (fun th1-> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ th th1)])) + THEN USE_THEN "F15" (fun th-> REWRITE_TAC[lemma_add_exponent_function; SYM th]) + THEN POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN USE_THEN "F3"(fun th-> USE_THEN "F2" (MP_TAC o CONJUNCT1 o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal])) + THEN REWRITE_TAC[IMP_IMP] THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_in_atom) + THEN USE_THEN "F15" (fun th-> GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN REWRITE_TAC[GSYM lemma_add_exponent_function] + THEN USE_THEN "G1" (fun th-> USE_THEN "VL" (fun th1-> REWRITE_TAC[GSYM (ONCE_REWRITE_RULE[ADD_SYM] th); th1])) + THEN USE_THEN "F6" MP_TAC THEN USE_THEN "F3" MP_TAC THEN USE_THEN "F2" MP_TAC THEN USE_THEN "F1" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN USE_THEN "G3" (fun th-> DISCH_THEN (MP_TAC o REWRITE_RULE[SYM th] o MATCH_MP lemma_head)) + THEN DISCH_TAC THEN USE_THEN "VL" (MP_TAC o SYM) + THEN USE_THEN "G2" (fun th-> USE_THEN "XB" (MP_TAC o MATCH_MP LE_TRANS o CONJ th)) + THEN USE_THEN "F4" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o SYM o MATCH_MP determine_loop_index) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN USE_THEN "N2"(fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN USE_THEN "G1" (fun th-> USE_THEN "G2" (fun th1-> REWRITE_TAC[th; th1])));; + +let atom_eq = prove(`!H:(A)hypermap N1:(A)loop->bool N2:(A)loop->bool L1:(A)loop L2:(A)loop x:A y:A m:num n:num. is_restricted H /\ is_normal H N1 /\ is_normal H N2 /\ L1 IN N1 /\ L2 IN N2 /\ x belong L1 /\ x belong L2 /\ y belong L1 /\ n <= top L1 /\ n <= top L2 /\ m < index L1 x (tail H N1 y) /\ index L1 x (tail H N1 y) <= index L1 x (head H N1 y) /\ index L1 x (head H N1 y) < n /\ (!i:num. m <= i /\ i <= n ==> (next L2 POWER i) x = (next L1 POWER i) x) ==> tail H N2 y = tail H N1 y /\ head H N2 y = head H N1 y /\ atom H L2 y = atom H L1 y`, + REPEAT GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2(LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (CONJUNCTS_THEN2 (LABEL_TAC "F7") (CONJUNCTS_THEN2 (LABEL_TAC "F8") (CONJUNCTS_THEN2 (LABEL_TAC "F9") (CONJUNCTS_THEN2 (LABEL_TAC "F10") (CONJUNCTS_THEN2 (LABEL_TAC "F11") (CONJUNCTS_THEN2 (LABEL_TAC "F12") (CONJUNCTS_THEN2 (LABEL_TAC "F14") (LABEL_TAC "F15")))))))))))))) + THEN USE_THEN "F2"(fun th->USE_THEN "F4"(fun th1->USE_THEN "F8"(fun th2->MP_TAC(MATCH_MP margin_in_loop (CONJ th (CONJ th1 th2)))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F16") (LABEL_TAC "F17")) + THEN USE_THEN "F6"(fun th-> USE_THEN "F16" (fun th1->MP_TAC(MATCH_MP lemma_loop_index (CONJ th th1)))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F18") (LABEL_TAC "F19")) + THEN USE_THEN "F6"(fun th-> USE_THEN "F17" (fun th1->MP_TAC(MATCH_MP lemma_loop_index (CONJ th th1)))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F20") (LABEL_TAC "F21")) + THEN USE_THEN "F2"(fun th-> USE_THEN "F4"(fun th1->USE_THEN "F8"(fun th2-> MP_TAC(MATCH_MP atomic_particles (CONJ th (CONJ th1 th2)))))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F22") (LABEL_TAC "F23" o CONJUNCT1)) + THEN USE_THEN "F2"(fun th-> USE_THEN "F4"(fun th1->USE_THEN "F8"(fun th2-> LABEL_TAC "F24"(MATCH_MP value_next_of_head (CONJ th (CONJ th1 th2)))))) + THEN USE_THEN "F1"(fun th->USE_THEN "F2"(fun th1->USE_THEN "F4"(fun th2->USE_THEN "F17"(fun th3-> MP_TAC(MATCH_MP lemma_tail_via_restricted (CONJ4 th th1 th2 th3)))))) + THEN USE_THEN "F2"(fun th->USE_THEN "F4"(fun th1->USE_THEN "F8"(fun th2->MP_TAC(CONJUNCT1(MATCH_MP tail_on_loop (CONJ3 th th1 th2)))))) + THEN USE_THEN "F2"(fun th->USE_THEN "F4"(fun th1->USE_THEN "F8"(fun th2->DISCH_THEN(fun th3-> REWRITE_TAC[CONJUNCT2(MATCH_MP change_parameters (CONJ4 th th1 th2 th3))])))) + THEN DISCH_THEN (LABEL_TAC "F25") + THEN USE_THEN "F2"(fun th->USE_THEN "F4"(fun th1->USE_THEN "F8"(fun th2->MP_TAC(CONJUNCT1(MATCH_MP tail_on_loop (CONJ3 th th1 th2)))))) + THEN LABEL_TAC "F26" (SPECL[`H:(A)hypermap`; `L1:(A)loop`; `y:A`] atom_reflect) + THEN DISCH_THEN (SUBST_ALL_TAC o MATCH_MP lemma_identity_atom) + THEN ABBREV_TAC `u = tail (H:(A)hypermap) N1 y` + THEN ABBREV_TAC `v = head (H:(A)hypermap) N1 y` + THEN ABBREV_TAC `a = index (L1:(A)loop) x u` + THEN ABBREV_TAC `b = index (L1:(A)loop) x v` + THEN USE_THEN "F12" (MP_TAC o REWRITE_RULE[LE_EXISTS]) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` (LABEL_TAC "F27")) + THEN USE_THEN "F27" (fun th-> USE_THEN "F19" (MP_TAC o REWRITE_RULE[ONCE_REWRITE_RULE[ADD_SYM] th; lemma_add_exponent_function])) + THEN USE_THEN "F21" (SUBST1_TAC o SYM) + THEN DISCH_THEN (fun th-> LABEL_TAC "F28" th THEN MP_TAC th) + THEN USE_THEN "F18"(fun th-> USE_THEN "F27"(fun th1-> MP_TAC(MATCH_MP LE_TRANS (CONJ (MATCH_MP compare_right (SYM th1)) th)))) + THEN USE_THEN "F17" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP determine_loop_index) + THEN DISCH_THEN SUBST_ALL_TAC + THEN USE_THEN "F22" (fun th-> USE_THEN "F26"(MP_TAC o REWRITE_RULE[th; IN_ELIM_THM])) + THEN DISCH_THEN (X_CHOOSE_THEN `k:num` (CONJUNCTS_THEN2 (LABEL_TAC "F29") (LABEL_TAC "F30"))) + THEN USE_THEN "F15" (MP_TAC o SPEC `a:num`) + THEN USE_THEN "F11" (fun th-> REWRITE_TAC[MATCH_MP LT_IMP_LE th]) + THEN USE_THEN "F12"(fun th-> USE_THEN "F14" (fun th1-> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ th (MATCH_MP LT_IMP_LE th1))])) + THEN USE_THEN "F21" (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "F31") + THEN USE_THEN "F31"(fun th-> USE_THEN "F7" (LABEL_TAC "F32" o REWRITE_RULE[th] o SPEC `a:num` o MATCH_MP lemma_power_next_in_loop)) + THEN SUBGOAL_THEN `!i:num. i <= d:num ==> (next (L2:(A)loop) POWER i) u = (inverse (node_map (H:(A)hypermap)) POWER i) u` (LABEL_TAC "F33") + THENL[GEN_TAC + THEN DISCH_THEN (LABEL_TAC "H1") + THEN USE_THEN "F21" (fun th-> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN REWRITE_TAC[lemma_add_exponent_function] + THEN USE_THEN "F21" (SUBST1_TAC o SYM) + THEN USE_THEN "F31" (fun th-> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [SYM th]) + THEN REWRITE_TAC[GSYM lemma_add_exponent_function] + THEN USE_THEN "F15" (MP_TAC o SPEC `(i:num) + (a:num)`) + THEN USE_THEN "F11" (fun th-> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ (MATCH_MP LT_IMP_LE th) (SPECL[`i:num`; `a:num`] LE_ADDR))]) + THEN USE_THEN "F27" (fun th->USE_THEN "H1" (MP_TAC o ONCE_REWRITE_RULE[GSYM(SPECL[`a:num`; `i:num`; `d:num`] LE_ADD_LCANCEL)])) + THEN USE_THEN "F27" (fun th-> DISCH_THEN(MP_TAC o ONCE_REWRITE_RULE[ADD_SYM] o REWRITE_RULE[SYM th])) + THEN DISCH_THEN (fun th-> USE_THEN "F14" (fun th1-> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ th (MATCH_MP LT_IMP_LE th1))])) + THEN DISCH_THEN SUBST1_TAC + THEN REWRITE_TAC[lemma_add_exponent_function] + THEN USE_THEN "F21" (SUBST1_TAC o SYM) + THEN POP_ASSUM MP_TAC THEN USE_THEN "F23" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN USE_THEN "F33"(fun th-> USE_THEN "F29" (fun th1 -> MP_TAC (MATCH_MP lemma_sub_part (CONJ th th1)))) + THEN USE_THEN "F5"(fun th->USE_THEN "F3"(MP_TAC o CONJUNCT1 o REWRITE_RULE[th] o SPEC `L2:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal])) + THEN REWRITE_TAC[IMP_IMP] THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_in_atom) + THEN USE_THEN "F29" (fun th-> USE_THEN "F33"(fun th1-> REWRITE_TAC[MATCH_MP th1 th])) + THEN REMOVE_THEN "F29" (fun th-> USE_THEN "F23"(fun th1-> REWRITE_TAC[SYM(MATCH_MP th1 th)])) + THEN REMOVE_THEN "F30" (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "F30") + THEN USE_THEN "F3"(fun th->USE_THEN "F5"(fun th1->USE_THEN "F32"(fun th2->USE_THEN "F30"(fun th3->REWRITE_TAC[MATCH_MP change_parameters (CONJ4 th th1 th2 th3)])))) + THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(MATCH_MP lemma_identity_atom th)]) + THEN USE_THEN "F33" MP_TAC + THEN USE_THEN "F5"(fun th->USE_THEN "F3"(MP_TAC o CONJUNCT1 o REWRITE_RULE[th] o SPEC `L2:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal])) + THEN REWRITE_TAC[IMP_IMP] THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_in_atom) + THEN USE_THEN "F33"(fun th1-> REWRITE_TAC[MATCH_MP th1 (SPEC `d:num` LE_REFL)]) + THEN USE_THEN "F23"(fun th1-> REWRITE_TAC[SYM(MATCH_MP th1 (SPEC `d:num` LE_REFL))]) + THEN USE_THEN "F28" (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "F34") + THEN USE_THEN "F32" MP_TAC THEN USE_THEN "F5" MP_TAC THEN USE_THEN "F3" MP_TAC THEN USE_THEN "F1" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_tail_via_restricted) + THEN SUBGOAL_THEN `back (L2:(A)loop) u = back (L1:(A)loop) u` SUBST1_TAC + THENL[USE_THEN "F31" (fun th-> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [SYM th]) + THEN USE_THEN "F21" (fun th-> GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN USE_THEN "F11" (fun th -> MP_TAC(MATCH_MP LET_TRANS (CONJ (SPEC `m:num` LE_0) th))) + THEN DISCH_THEN ((X_CHOOSE_THEN `t:num` (LABEL_TAC "H1" o REWRITE_RULE[CONJUNCT1 ADD])) o REWRITE_RULE[LT_EXISTS]) + THEN USE_THEN "H1" SUBST1_TAC + THEN REWRITE_TAC[GSYM COM_POWER_FUNCTION; lemma_inverse_evaluation] + THEN USE_THEN "F15" MATCH_MP_TAC + THEN ONCE_REWRITE_TAC[GSYM LE_SUC] + THEN USE_THEN "H1" (SUBST1_TAC o SYM) + THEN USE_THEN "F11" (fun th-> REWRITE_TAC[REWRITE_RULE[GSYM LE_SUC_LT] th]) + THEN USE_THEN "F12" (fun th-> USE_THEN "F14" (fun th1-> (MP_TAC(MATCH_MP LET_TRANS (CONJ th th1))))) + THEN ARITH_TAC; ALL_TAC] + THEN USE_THEN "F25" (fun th-> REWRITE_TAC[SYM th]) + THEN DISCH_THEN (fun th-> LABEL_TAC "F35" th THEN REWRITE_TAC[th]) + THEN USE_THEN "F33" (MP_TAC o REWRITE_RULE[LE_REFL] o SPEC `d:num`) + THEN USE_THEN "F23" (SUBST1_TAC o SYM o REWRITE_RULE[LE_REFL] o SPEC `d:num`) + THEN USE_THEN "F28" (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "F36") + THEN USE_THEN "F34" MP_TAC THEN USE_THEN "F32" MP_TAC THEN USE_THEN "F5" MP_TAC THEN USE_THEN "F3" MP_TAC + THEN USE_THEN "F1" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_head) + THEN SUBGOAL_THEN `next (L2:(A)loop) v = next (L1:(A)loop) v` SUBST1_TAC + THENL[USE_THEN "F36" (fun th-> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [SYM th]) + THEN USE_THEN "F28" (fun th-> GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN REWRITE_TAC[COM_POWER_FUNCTION] + THEN USE_THEN "F31" (fun th-> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [SYM th]) + THEN USE_THEN "F21" (fun th-> GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN REWRITE_TAC[GSYM lemma_add_exponent_function; CONJUNCT2 ADD] + THEN USE_THEN "F15" MATCH_MP_TAC + THEN REWRITE_TAC[LE_SUC_LT] + THEN USE_THEN "F27" (SUBST1_TAC o SYM o ONCE_REWRITE_RULE[ADD_SYM]) + THEN USE_THEN "F14"(fun th-> REWRITE_TAC[th]) + THEN USE_THEN "F11" (fun th-> USE_THEN "F12" (fun th1-> MP_TAC(MATCH_MP LTE_TRANS (CONJ th th1)))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ (MATCH_MP LT_IMP_LE th) (SPEC `b:num` LE_PLUS))]); ALL_TAC] + THEN USE_THEN "F24" (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN (fun th-> REWRITE_TAC[th] THEN LABEL_TAC "F37" th) + THEN USE_THEN "F36" (MP_TAC o SYM) + THEN USE_THEN "F14"(fun th->USE_THEN "F27"(fun th1->MP_TAC(MATCH_MP LE_TRANS (CONJ (MATCH_MP compare_right (SYM th1)) (MATCH_MP LT_IMP_LE th))))) + THEN DISCH_THEN (fun th->USE_THEN "F10" (MP_TAC o MATCH_MP LE_TRANS o CONJ th)) + THEN USE_THEN "F32" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP determine_loop_index) + THEN DISCH_THEN (LABEL_TAC "F38") THEN CONV_TAC SYM_CONV + THEN USE_THEN "F3"(fun th->USE_THEN "F5"(fun th1->USE_THEN "F32"(fun th2->SUBST1_TAC(CONJUNCT2(CONJUNCT2(MATCH_MP atomic_particles (CONJ th (CONJ th1 th2)))))))) + THEN USE_THEN "F37"(fun th-> USE_THEN "F35"(fun th1-> USE_THEN "F38"(fun th2-> REWRITE_TAC[th; th1; th2]))) + THEN USE_THEN "F22" SUBST1_TAC THEN USE_THEN "F23"(fun th-> REWRITE_TAC[MATCH_MP lemma_two_series_eq th]));; + +let lemma_dnax_atomic_structure = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A. is_marked H NF L x /\ ~(L IN canon H NF) ==> +index L (attach H NF L x) (head H NF (attach H NF L x)) <= index L (attach H NF L x) x /\ +index L (attach H NF L x) x + (SUC (mInside H NF L x)) = index L (attach H NF L x) (heading H NF L x) /\ +dnax H NF L x IN genesis H NF L x /\ +head H (genesis H NF L x) (attach H NF L x) = head H NF (attach H NF L x) /\ +tail H (genesis H NF L x) (attach H NF L x) = attach H NF L x /\ +(!i:num. i <= index L (attach H NF L x) (head H NF (attach H NF L x)) + ==> atom H (dnax H NF L x) ((next L POWER i) (attach H NF L x)) = atom H (dnax H NF L x) (attach H NF L x)) /\ +(!i:num. index L (attach H NF L x) (head H NF (attach H NF L x)) < i /\ i <= index L (attach H NF L x) x + ==> tail H (genesis H NF L x) ((next L POWER i) (attach H NF L x)) = tail H NF ((next L POWER i) (attach H NF L x)) /\ + head H (genesis H NF L x) ((next L POWER i) (attach H NF L x)) = head H NF ((next L POWER i) (attach H NF L x)) /\ + atom H (dnax H NF L x) ((next L POWER i) (attach H NF L x)) = atom H L ((next L POWER i) (attach H NF L x))) /\ +(!i:num. index L (attach H NF L x) x < i /\ i <= index L (attach H NF L x) (heading H NF L x) + ==> atom H (dnax H NF L x) ((next L POWER i) (attach H NF L x)) = {(next L POWER i) (attach H NF L x)}) /\ +(!i:num. 1 <= i /\ i <= mAdd H NF L x + ==> atom H (dnax H NF L x) ((face_map H POWER i) (heading H NF L x)) = {(face_map H POWER i) (heading H NF L x)}) +/\ (!i:num. i <= (SUC (mInside H NF L x)) + (SUC (mAdd H NF L x)) ==> (next (dnax H NF L x) POWER i) x = (face_map H POWER i) x)`, + REPEAT GEN_TAC + THEN DISCH_THEN(fun th ->LABEL_TAC "FC"(CONJUNCT1 th) THEN LABEL_TAC "F1"(MATCH_MP lemma_split_marked_loop th)) + THEN USE_THEN "F1" ((CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (CONJUNCTS_THEN2 (LABEL_TAC "F5") (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7" o CONJUNCT1))))) o REWRITE_RULE[is_split_condition]) + THEN USE_THEN "F5" (fun th->(USE_THEN "F4" (LABEL_TAC "F8" o CONJUNCT1 o REWRITE_RULE[th] o SPEC `L:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN USE_THEN "F1" (LABEL_TAC "F9" o CONJUNCT1 o MATCH_MP lemma_on_heading) + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (fun th1-> LABEL_TAC "F10" (CONJUNCT1(MATCH_MP lemmaHQYMRTX (CONJ th th1))))) + THEN REWRITE_TAC[geney; tpy; start_glue_evaluation; loop_path; POWER_0; I_THM] + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (LABEL_TAC "F11" o MATCH_MP lemma_normal_genesis o CONJ th)) + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (MP_TAC o CONJUNCT2 o MATCH_MP lemma_on_dnax o CONJ th)) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "F12") (CONJUNCTS_THEN2 (LABEL_TAC "F14") (CONJUNCTS_THEN2 (LABEL_TAC "F15") (LABEL_TAC "F16")))) + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (LABEL_TAC "F17" o MATCH_MP lemma_in_dnax o CONJ th)) + THEN USE_THEN "F1" (LABEL_TAC "F17i" o CONJUNCT1 o MATCH_MP lemma_mInside) + THEN LABEL_TAC "F18" (SPECL[`H:(A)hypermap`; `NF:(A)loop->bool`; `L:(A)loop`; `x:A`] attach) + THEN USE_THEN "F10" (fun th-> USE_THEN "F7" ((CONJUNCTS_THEN2 (LABEL_TAC "F19") (LABEL_TAC "F20")) o MATCH_MP lemma_loop_index o CONJ th)) + THEN USE_THEN "F10" (fun th-> USE_THEN "F9" ((CONJUNCTS_THEN2 (LABEL_TAC "F21") (LABEL_TAC "F22")) o MATCH_MP lemma_loop_index o CONJ th)) + THEN USE_THEN "F4" (fun th->USE_THEN "F5"(fun th1-> USE_THEN "F10" (fun th2-> MP_TAC (MATCH_MP head_on_loop (CONJ th (CONJ th1 th2)))))) + THEN USE_THEN "F10" (fun th->DISCH_THEN (fun th1-> LABEL_TAC "F24" (MATCH_MP lemma_in_loop (CONJ th (CONJUNCT1 th1))))) + THEN USE_THEN "F10" (fun th-> USE_THEN "F24" ((CONJUNCTS_THEN2 (LABEL_TAC "F25") (LABEL_TAC "F26")) o MATCH_MP lemma_loop_index o CONJ th)) + THEN ABBREV_TAC `G = genesis (H:(A)hypermap) NF L x` + THEN POP_ASSUM (LABEL_TAC "GL") + THEN ABBREV_TAC `Q = dnax (H:(A)hypermap) NF L x` THEN POP_ASSUM (LABEL_TAC "QL") + THEN ABBREV_TAC `y = heading (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "YEL") + THEN ABBREV_TAC `z = attach (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "ZEL") + THEN ABBREV_TAC `m = mAdd (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "MN") + THEN ABBREV_TAC `p = mInside (H:(A)hypermap) (NF:(A)loop->bool) (L:(A)loop) (x:A)` + THEN POP_ASSUM (LABEL_TAC "PN") + THEN ABBREV_TAC `ny = index (L:(A)loop) z y` THEN POP_ASSUM (LABEL_TAC "YN") + THEN ABBREV_TAC `nx = index (L:(A)loop) z x` THEN POP_ASSUM (LABEL_TAC "XN") + THEN ABBREV_TAC `nh = index (L:(A)loop) z (head (H:(A)hypermap) NF z)` THEN POP_ASSUM (LABEL_TAC "HN") + THEN SUBGOAL_THEN `nh:num <= nx` (LABEL_TAC "F27") + THENL[MP_TAC (SPECL[`H:(A)hypermap`; `L:(A)loop`; `z:A`] atom_reflect) + THEN USE_THEN "F10" MP_TAC THEN USE_THEN "F5" MP_TAC THEN USE_THEN "F4" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN USE_THEN "HN" (fun th-> DISCH_THEN (LABEL_TAC "H1" o REWRITE_RULE[th] o MATCH_MP to_head)) + THEN ASM_CASES_TAC `nh:num <= nx` THENL[POP_ASSUM (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "H2" o REWRITE_RULE[NOT_LE; GSYM LE_SUC_LT]) + THEN USE_THEN "H1" (MP_TAC o SPEC `nx:num`) + THEN USE_THEN "H2" (fun th-> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ (SPEC `nx:num` LE_PLUS) th)]) + THEN DISCH_TAC THEN USE_THEN "H1" (MP_TAC o SPEC `SUC nx`) + THEN USE_THEN "H2" (fun th-> REWRITE_TAC[th; GSYM COM_POWER_FUNCTION]) + THEN POP_ASSUM (SUBST1_TAC o SYM) + THEN USE_THEN "F20" (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "H3") + THEN USE_THEN "F7" MP_TAC THEN USE_THEN "F5" MP_TAC THEN USE_THEN "F4" MP_TAC THEN USE_THEN "F3" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (LABEL_TAC "H4") + THEN USE_THEN "H3" (fun th-> (USE_THEN "H4" (MP_TAC o REWRITE_RULE[th] o MATCH_MP lemma_next_exclusive))) + THEN USE_THEN "H3" (SUBST1_TAC o SYM) + THEN DISCH_THEN (fun th-> (USE_THEN "H4"(MP_TAC o REWRITE_RULE[th] o MATCH_MP lemma_head_via_restricted))) + THEN USE_THEN "F1"(fun th-> REWRITE_TAC[REWRITE_RULE[is_split_condition] th]); ALL_TAC] + THEN USE_THEN "F27" (fun th-> REWRITE_TAC[th]) + THEN SUBGOAL_THEN `!i:num. i <= SUC p ==> is_inj_list (loop_path (L:(A)loop) (z:A)) ((nx:num) + i)` (LABEL_TAC "F28") + THENL[REWRITE_TAC[lemma_loop_path_via_list; GSYM lemma_inj_orbit_via_list] + THEN INDUCT_TAC + THENL[REWRITE_TAC[LE_0; ADD_0; lemma_inj_orbit_via_list; GSYM lemma_loop_path_via_list] + THEN USE_THEN "F19"(fun th->USE_THEN "F10"(fun th1->REWRITE_TAC[REWRITE_RULE[th](SPEC `nx:num`(MATCH_MP lemma_inj_loop_path th1))])); ALL_TAC] + THEN POP_ASSUM (LABEL_TAC "H1") + THEN DISCH_THEN (LABEL_TAC "H2") + THEN REWRITE_TAC[ADD_SUC] + THEN MATCH_MP_TAC inj_orbit_step + THEN EXISTS_TAC `dart_of (L:(A)loop)` + THEN REWRITE_TAC[loop_lemma] + THEN USE_THEN "H1" MP_TAC + THEN USE_THEN "H2" (fun th-> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ (SPEC `i:num` LE_PLUS) th)]) + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]) + THEN REWRITE_TAC[GSYM ADD_SUC] + THEN ONCE_REWRITE_TAC[ADD_SYM] + THEN USE_THEN "F20" (fun th-> REWRITE_TAC[lemma_add_exponent_function; GSYM th]) + THEN USE_THEN "FC" (fun th-> USE_THEN "F6" (MP_TAC o SPEC `SUC i` o CONJUNCT2 o MATCH_MP lemmaHQYMRTX o CONJ th)) + THEN USE_THEN "PN" (fun th-> USE_THEN "ZEL" (fun th1-> REWRITE_TAC[th; th1])) + THEN USE_THEN "H2" (fun th-> REWRITE_TAC[GE_1; th]) + THEN USE_THEN "PN" (fun th-> USE_THEN "F1" (MP_TAC o REWRITE_RULE[th] o SPEC `SUC i` o CONJUNCT1 o MATCH_MP lemma_mInside)) + THEN USE_THEN "H2" (fun th-> REWRITE_TAC[th]) + THEN DISCH_THEN SUBST1_TAC + THEN DISCH_THEN (fun th-> REWRITE_TAC[GSYM th]); ALL_TAC] + THEN SUBGOAL_THEN `(nx:num) + (SUC p) = ny` (LABEL_TAC "F29") + THENL[USE_THEN "F28" (MP_TAC o REWRITE_RULE[LE_REFL] o SPEC `SUC p`) + THEN USE_THEN "F10" (fun th-> REWRITE_TAC[GSYM(SPEC `(nx:num) + (SUC p)` (MATCH_MP lemma_inj_loop_path th))]) + THEN DISCH_TAC + THEN MP_TAC (SPECL[`H:(A)hypermap`; `NF:(A)loop->bool`; `L:(A)loop`; `x:A`] heading) + THEN USE_THEN "F1" (MP_TAC o SPEC `SUC (mInside (H:(A)hypermap) NF L x)` o CONJUNCT1 o MATCH_MP lemma_mInside) + THEN USE_THEN "YEL" (fun th-> USE_THEN "PN" (fun th1-> REWRITE_TAC[th; th1; LE_REFL])) + THEN DISCH_THEN (SUBST1_TAC o SYM) + THEN USE_THEN "F20" SUBST1_TAC + THEN REWRITE_TAC[GSYM lemma_add_exponent_function] + THEN GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [ADD_SYM] + THEN POP_ASSUM MP_TAC + THEN USE_THEN "F10" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o SYM o MATCH_MP determine_loop_index) + THEN USE_THEN "YN" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN USE_THEN "F29" (fun th-> REWRITE_TAC[th]) + THEN SUBGOAL_THEN `Q IN (G:(A)loop-> bool)` (LABEL_TAC "F30") + THENL[EXPAND_TAC "Q" THEN EXPAND_TAC "G" THEN REWRITE_TAC[genesis; IN_ELIM_THM; IN_DELETE; IN_UNION; lemma_in_couple]; ALL_TAC] + THEN USE_THEN "F30" (fun th-> REWRITE_TAC[th]) + THEN SUBGOAL_THEN `tail (H:(A)hypermap) G z = z` (LABEL_TAC "F31") + THENL[USE_THEN "F12" MP_TAC THEN USE_THEN "F30" MP_TAC THEN USE_THEN "F11" MP_TAC THEN USE_THEN "F3" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_tail_via_restricted th]) + THEN MP_TAC (AP_THM (SPEC `Q:(A)loop` lemma_order_next) `z:A`) + THEN USE_THEN "F14" (fun th-> REWRITE_TAC[I_THM; lemma_size; GSYM COM_POWER_FUNCTION; th]) + THEN DISCH_THEN (MP_TAC o REWRITE_RULE[lemma_inverse_evaluation] o SYM o AP_TERM `back (Q:(A)loop)`) + THEN USE_THEN "YEL"(fun th-> USE_THEN "ZEL"(fun th1->USE_THEN "MN"(fun th2->USE_THEN "YN" (fun th3->(REWRITE_TAC[tpx; th; th1; th2; th3]))))) + THEN USE_THEN "F16" (fun th-> REWRITE_TAC[REWRITE_RULE[LE_REFL] (SPEC `m:num` th)]) + THEN DISCH_THEN SUBST1_TAC THEN USE_THEN "F18" (fun th-> REWRITE_TAC[COM_POWER_FUNCTION; th]); ALL_TAC] + THEN USE_THEN "F31" (fun th-> REWRITE_TAC[th]) + THEN SUBGOAL_THEN `!i:num. i <= nh ==> (next (Q:(A)loop) POWER i) (z:A) = (inverse (node_map (H:(A)hypermap)) POWER i) z` (LABEL_TAC "F32") + THENL[GEN_TAC THEN DISCH_THEN (LABEL_TAC "H1") + THEN USE_THEN "F15" (MP_TAC o SPEC `i:num`) + THEN USE_THEN "F29" (fun th-> MP_TAC (REWRITE_RULE[th] (SPECL[`nx:num`; `SUC p`] LE_ADD))) + THEN USE_THEN "H1" (fun th-> USE_THEN "F27" (fun th1-> MP_TAC (MATCH_MP LE_TRANS (CONJ th th1)))) + THEN DISCH_THEN (fun th-> DISCH_THEN (fun th1-> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ th th1)])) + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC(SPECL[`H:(A)hypermap`; `L:(A)loop`; `z:A`] atom_reflect) + THEN USE_THEN "F10" MP_TAC THEN USE_THEN "F5" MP_TAC THEN USE_THEN "F4" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o SPEC `i:num` o MATCH_MP to_head) + THEN USE_THEN "H1"(fun th1-> USE_THEN "HN" (fun th-> REWRITE_TAC[th; th1])); ALL_TAC] + THEN USE_THEN "F30"(fun th->(USE_THEN "F11" (LABEL_TAC "F33" o CONJUNCT1 o REWRITE_RULE[th] o SPEC `Q:(A)loop` o CONJUNCT1 o REWRITE_RULE[is_normal]))) + THEN SUBGOAL_THEN `head (H:(A)hypermap) (G:(A)loop->bool) z = head (H:(A)hypermap) NF z` (LABEL_TAC "F34") + THENL[USE_THEN "F33"(fun th->USE_THEN "F32" (MP_TAC o MATCH_MP lemma_in_atom o CONJ th)) + THEN DISCH_TAC THEN USE_THEN "F15" (MP_TAC o SPEC `SUC nh`) + THEN USE_THEN "F27"(fun th->USE_THEN "F29"(fun th1->(REWRITE_TAC[REWRITE_RULE[th1; GSYM ADD1] (MATCH_MP LE_ADD2 (CONJ th (SPEC `p:num` GE_1)))]))) + THEN REWRITE_TAC[GSYM COM_POWER_FUNCTION] THEN POP_ASSUM MP_TAC + THEN USE_THEN "F15" (MP_TAC o SPEC `nh:num`) + THEN USE_THEN "F29" (fun th-> MP_TAC (REWRITE_RULE[th] (SPECL[`nx:num`; `SUC p`] LE_ADD))) + THEN DISCH_THEN (fun th1 -> USE_THEN "F27" (fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [MATCH_MP LE_TRANS (CONJ th th1)])) + THEN USE_THEN "F26" (fun th-> REWRITE_TAC[SYM th]) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F4"(fun th->USE_THEN "F5"(fun th1-> USE_THEN "F10"(fun th2-> REWRITE_TAC[MATCH_MP value_next_of_head (CONJ th (CONJ th1 th2))]))) + THEN DISCH_THEN (LABEL_TAC "H1") THEN DISCH_TAC + THEN USE_THEN "H1" MP_TAC THEN USE_THEN "F12" MP_TAC THEN USE_THEN "F30" MP_TAC THEN USE_THEN "F11" MP_TAC THEN USE_THEN "F3" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN POP_ASSUM (fun th-> DISCH_THEN (fun th1-> REWRITE_TAC[REWRITE_RULE[th] (SYM(MATCH_MP lemma_head th1))])); ALL_TAC] + THEN USE_THEN "F34"(fun th-> REWRITE_TAC[th]) + THEN STRIP_TAC + THENL[GEN_TAC + THEN DISCH_THEN (LABEL_TAC "H1") + THEN USE_THEN "H1"(fun th-> USE_THEN "F32"(fun th1-> MP_TAC(MATCH_MP lemma_sub_part (CONJ th1 th)))) + THEN USE_THEN "F33"(fun th-> DISCH_THEN (fun th1-> MP_TAC(MATCH_MP lemma_in_atom (CONJ th th1)))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_identity_atom th]) + THEN USE_THEN "F15" (MP_TAC o SPEC `i:num`) + THEN USE_THEN "F29"(fun th-> MP_TAC(REWRITE_RULE[th] (SPECL[`nx:num`; `SUC p`] LE_ADD))) + THEN DISCH_THEN (fun th1-> USE_THEN "F27" (fun th-> MP_TAC (MATCH_MP LE_TRANS (CONJ th th1)))) + THEN USE_THEN "H1" (fun th-> DISCH_THEN(fun th1-> REWRITE_TAC [MATCH_MP LE_TRANS (CONJ th th1)])) + THEN DISCH_THEN (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN STRIP_TAC + THENL[GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "H1") (LABEL_TAC "H2")) + THEN ABBREV_TAC `u = (next (L:(A)loop) POWER (i:num)) (z:A)` + THEN POP_ASSUM (LABEL_TAC "UL") + THEN USE_THEN "UL" (MP_TAC o SYM) + THEN USE_THEN "H2"(fun th-> USE_THEN "F19"(fun th1-> MP_TAC (MATCH_MP LE_TRANS (CONJ th th1)))) + THEN USE_THEN "F10" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (LABEL_TAC "H3" o MATCH_MP determine_loop_index) + THEN USE_THEN "H2" MP_TAC THEN USE_THEN "H1" MP_TAC THEN USE_THEN "H3" (SUBST1_TAC o SYM) + THEN EXPAND_TAC "nh" THEN EXPAND_TAC "nx" + THEN USE_THEN "FC" (MP_TAC o CONJUNCT1 o MATCH_MP lemma_marked_dart) + THEN USE_THEN "UL" (fun th-> USE_THEN "F10" (MP_TAC o REWRITE_RULE[th] o SPEC `i:num` o MATCH_MP lemma_power_next_in_loop)) + THEN USE_THEN "F7" MP_TAC THEN USE_THEN "F10" MP_TAC THEN USE_THEN "F5" MP_TAC THEN USE_THEN "F4" MP_TAC THEN USE_THEN "F3" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_separation_on_loop) + THEN USE_THEN "H3" SUBST1_TAC + THEN USE_THEN "H3" (fun th-> USE_THEN "XN"(fun th1-> USE_THEN "HN" (fun th2-> REWRITE_TAC[th; th1; th2]))) + THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "H4") (CONJUNCTS_THEN2 (LABEL_TAC "H5") (CONJUNCTS_THEN2 (LABEL_TAC "H6") (LABEL_TAC "H7")))) + THEN SUBGOAL_THEN `!i:num. 0 <= i /\ i <= ny:num ==> (next (Q:(A)loop) POWER i) z = (next (L:(A)loop) POWER i) z` MP_TAC + THENL[USE_THEN "F15"(fun th-> REWRITE_TAC[LE_0; th]); ALL_TAC] + THEN USE_THEN "F29" ((fun th-> MP_TAC (MATCH_MP compare_left th)) o REWRITE_RULE[ADD_SUC; GSYM(CONJUNCT2 ADD)]) + THEN DISCH_THEN (MP_TAC o MATCH_MP LTE_TRANS o CONJ (SPEC `nx:num` LT_PLUS)) + THEN USE_THEN "H7" (fun th-> DISCH_THEN (MP_TAC o MATCH_MP LET_TRANS o CONJ th)) + THEN USE_THEN "H5"(fun th-> USE_THEN "H6"(MP_TAC o MATCH_MP LE_TRANS o CONJ th)) + THEN USE_THEN "H4" (MP_TAC o MATCH_MP LET_TRANS o CONJ (SPEC `nh:num` LE_0)) + THEN USE_THEN "F14" (MP_TAC o MATCH_MP compare_left o SYM o REWRITE_RULE[tpx]) + THEN USE_THEN "ZEL" (fun th-> USE_THEN "YEL" (fun th1-> USE_THEN "YN"(fun th2-> REWRITE_TAC[th; th1; th2]))) + THEN USE_THEN "F21" MP_TAC + THEN USE_THEN "UL" (fun th-> USE_THEN "F10"(MP_TAC o REWRITE_RULE[th] o SPEC `i:num` o MATCH_MP lemma_power_next_in_loop)) + THEN USE_THEN "F12" MP_TAC THEN USE_THEN "F10" MP_TAC THEN USE_THEN "F30" MP_TAC THEN USE_THEN "F5" MP_TAC + THEN USE_THEN "F11" MP_TAC THEN USE_THEN "F4" MP_TAC THEN USE_THEN "F3" MP_TAC THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP atom_eq th]); ALL_TAC] + THEN SUBGOAL_THEN `!i:num. i <= (SUC p) + (SUC m) ==> (next (Q:(A)loop) POWER i) (x:A) = (face_map (H:(A)hypermap) POWER i) x` (LABEL_TAC "F35") + THENL[GEN_TAC THEN DISCH_THEN (LABEL_TAC "H1") + THEN ASM_CASES_TAC `i:num <= SUC p` + THENL[POP_ASSUM (LABEL_TAC "H2") + THEN USE_THEN "F20" (fun th-> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN USE_THEN "F15" (fun th-> USE_THEN "F29" (SUBST1_TAC o SYM o MATCH_MP th o (MATCH_MP compare_left))) + THEN REWRITE_TAC[GSYM lemma_add_exponent_function] + THEN CONV_TAC (ONCE_DEPTH_CONV(LAND_CONV(REWR_CONV ADD_SYM))) + THEN USE_THEN "F29"(fun th->USE_THEN "H2"(fun th1->MP_TAC(REWRITE_RULE[GSYM (SPECL[`nx:num`; `i:num`; `SUC p`] LE_ADD_LCANCEL); th] th1))) + THEN USE_THEN "F15" (fun th-> DISCH_THEN (SUBST1_TAC o MATCH_MP th)) + THEN CONV_TAC (ONCE_DEPTH_CONV(LAND_CONV (REWR_CONV ADD_SYM))) + THEN USE_THEN "F20"(fun th-> REWRITE_TAC[lemma_add_exponent_function; SYM th]) + THEN USE_THEN "F17i" (fun th-> USE_THEN "H2" (fun th1-> REWRITE_TAC[MATCH_MP th th1])); ALL_TAC] + THEN POP_ASSUM ((X_CHOOSE_THEN `d:num` (LABEL_TAC "H2")) o REWRITE_RULE[NOT_LE; LT_EXISTS]) + THEN USE_THEN "H2" (fun th-> USE_THEN "H1" (LABEL_TAC "H3" o REWRITE_RULE[th; LE_ADD_LCANCEL])) + THEN USE_THEN "H2" SUBST1_TAC + THEN ONCE_REWRITE_TAC[ADD_SYM] + THEN GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [lemma_add_exponent_function] + THEN USE_THEN "F17i" (SUBST1_TAC o SYM o REWRITE_RULE[LE_REFL] o SPEC `SUC p`) + THEN SUBGOAL_THEN `(next (L:(A)loop) POWER (SUC p)) x = y` SUBST1_TAC + THENL[USE_THEN "F20" SUBST1_TAC + THEN REWRITE_TAC[GSYM lemma_add_exponent_function] + THEN ONCE_REWRITE_TAC[ADD_SYM] + THEN USE_THEN "F29" (fun th-> USE_THEN "F22" (fun th1-> REWRITE_TAC[th; th1])); ALL_TAC] + THEN USE_THEN "F20" SUBST1_TAC + THEN USE_THEN "F15" (fun th-> USE_THEN "F29" (SUBST1_TAC o SYM o MATCH_MP th o (MATCH_MP compare_left))) + THEN REWRITE_TAC[GSYM lemma_add_exponent_function; GSYM ADD_ASSOC] + THEN USE_THEN "F29" (SUBST1_TAC o ONCE_REWRITE_RULE[ADD_SYM]) + THEN ONCE_REWRITE_TAC[ADD_SYM] + THEN ASM_CASES_TAC `SUC d < SUC m` + THENL[POP_ASSUM (fun th-> USE_THEN "F16"(fun th1-> REWRITE_TAC[MATCH_MP th1 (REWRITE_RULE[LT_SUC_LE] th)])); ALL_TAC] + THEN POP_ASSUM (fun th-> USE_THEN "H3"(fun th1-> REWRITE_TAC [REWRITE_RULE[LE_ANTISYM] (CONJ th1 (REWRITE_RULE[NOT_LT] th))])) + THEN REWRITE_TAC[ADD_SUC] + THEN USE_THEN "F18" (SUBST1_TAC o SYM) + THEN USE_THEN "F14" (MP_TAC o REWRITE_RULE[tpx]) + THEN USE_THEN "ZEL"(fun th->USE_THEN "YEL"(fun th1->USE_THEN "MN"(fun th2-> USE_THEN "YN"(fun th3->REWRITE_TAC[th; th1; th2; th3])))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[SYM th; GSYM lemma_size; lemma_order_next; I_THM]); ALL_TAC] + THEN USE_THEN "F35"(fun th-> REWRITE_TAC[th]) + THEN STRIP_TAC + THENL[GEN_TAC + THEN DISCH_THEN (CONJUNCTS_THEN2 ((X_CHOOSE_THEN `d:num` ASSUME_TAC) o REWRITE_RULE[LT_EXISTS]) MP_TAC) + THEN DISCH_THEN (fun th-> (USE_THEN "F15"(fun th1-> (SUBST1_TAC (SYM (MATCH_MP th1 th))))) THEN MP_TAC th) + THEN POP_ASSUM SUBST1_TAC + THEN USE_THEN "F29" (SUBST1_TAC o SYM) + THEN DISCH_THEN (LABEL_TAC "H1" o REWRITE_RULE[LE_ADD_LCANCEL]) + THEN ONCE_REWRITE_TAC[ADD_SYM] + THEN REWRITE_TAC[lemma_add_exponent_function] + THEN USE_THEN "F29" (MP_TAC o MATCH_MP compare_left) + THEN USE_THEN "F15"(fun th-> DISCH_THEN (MP_TAC o MATCH_MP th)) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F20" (SUBST1_TAC o SYM) + THEN SUBGOAL_THEN `!i:num. i <= SUC (SUC p) ==> (next (Q:(A)loop) POWER i) x = (face_map (H:(A)hypermap) POWER i) x` MP_TAC + THENL[MP_TAC (REWRITE_RULE[GE_1; GSYM ADD1] (SYM(SPECL[`SUC p`; `1`; `SUC m`] LE_ADD_LCANCEL))) + THEN USE_THEN "F35"(fun th -> DISCH_THEN (fun th1-> REWRITE_TAC[MATCH_MP lemma_sub_part (CONJ th th1)])); ALL_TAC] + THEN SUBGOAL_THEN `x:A belong (Q:(A)loop)` (LABEL_TAC "H2") + THENL[USE_THEN "F17" (fun th-> REWRITE_TAC[th]) + THEN DISJ1_TAC THEN EXISTS_TAC `nx:num` + THEN USE_THEN "F29" (fun th-> REWRITE_TAC[MATCH_MP compare_left th]) + THEN USE_THEN "F20" (fun th-> REWRITE_TAC[th]); ALL_TAC] + THEN SUBGOAL_THEN `head (H:(A)hypermap) G x = x` MP_TAC + THENL[USE_THEN "H2" MP_TAC THEN USE_THEN "F30" MP_TAC THEN USE_THEN "F11" MP_TAC THEN USE_THEN "F3" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_head_via_restricted th]) + THEN USE_THEN "F35" (MP_TAC o REWRITE_RULE[POWER_1; ADD_SUC; GE_1] o SPEC `1`) THEN SIMP_TAC[]; ALL_TAC] + THEN USE_THEN "H2" MP_TAC THEN USE_THEN "F30" MP_TAC THEN USE_THEN "F11" MP_TAC THEN USE_THEN "F3" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o SPEC `SUC d` o CONJUNCT1 o MATCH_MP lemma_face_contour_on_loop) + THEN USE_THEN "H1"(fun th-> REWRITE_TAC[th; GE_1]) + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC(SPECL[`SUC p`; `SUC m`] LE_ADD) + THEN USE_THEN "H1"(fun th-> DISCH_THEN (fun th1-> MP_TAC(MATCH_MP LE_TRANS (CONJ th th1)))) + THEN DISCH_THEN (fun th-> USE_THEN "F35"(fun th1-> REWRITE_TAC[SYM(MATCH_MP th1 th)])); ALL_TAC] + THEN GEN_TAC THEN DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "H1") (LABEL_TAC "H2")) + THEN SUBGOAL_THEN `(face_map (H:(A)hypermap) POWER (i:num)) (y:A) = (next (Q:(A)loop) POWER i) y` MP_TAC + THENL[USE_THEN "F22" (fun th-> GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN USE_THEN "F15" (SUBST1_TAC o SYM o REWRITE_RULE[LE_REFL] o SPEC `ny:num`) + THEN REWRITE_TAC[GSYM lemma_add_exponent_function] + THEN CONV_TAC (RAND_CONV (LAND_CONV (ONCE_DEPTH_CONV (REWR_CONV ADD_SYM)))) + THEN USE_THEN "F16" (fun th-> USE_THEN "H2"(fun th1-> REWRITE_TAC[MATCH_MP th th1])); ALL_TAC] + THEN DISCH_THEN (fun th-> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN SUBGOAL_THEN `!i:num. i <= SUC m ==> (next (Q:(A)loop) POWER i) y = (face_map (H:(A)hypermap) POWER i) y` MP_TAC + THENL[X_GEN_TAC `j:num` THEN DISCH_THEN (LABEL_TAC "H3") + THEN USE_THEN "F22" (fun th-> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [th]) + THEN USE_THEN "F15" (SUBST1_TAC o SYM o REWRITE_RULE[LE_REFL] o SPEC `ny:num`) + THEN REWRITE_TAC[GSYM lemma_add_exponent_function] + THEN CONV_TAC (LAND_CONV (LAND_CONV (ONCE_DEPTH_CONV (REWR_CONV ADD_SYM)))) + THEN ASM_CASES_TAC `j:num <= m` + THENL[USE_THEN "F16" (fun th-> POP_ASSUM(fun th1-> REWRITE_TAC[MATCH_MP th th1])); ALL_TAC] + THEN POP_ASSUM (MP_TAC o REWRITE_RULE[NOT_LE; GSYM LE_SUC_LT]) + THEN USE_THEN "H3"(fun th-> DISCH_THEN (MP_TAC o REWRITE_RULE[LE_ANTISYM] o CONJ th)) + THEN DISCH_THEN (SUBST1_TAC) + THEN USE_THEN "F18" (SUBST1_TAC o SYM) + THEN USE_THEN "F14"(MP_TAC o REWRITE_RULE[tpx]) + THEN USE_THEN "ZEL"(fun th->USE_THEN "YEL"(fun th1->USE_THEN "MN"(fun th2->USE_THEN "YN"(fun th3->REWRITE_TAC[th; th1; th2; th3])))) + THEN DISCH_THEN (fun th-> REWRITE_TAC[ADD_SUC; SYM th; GSYM lemma_size; lemma_order_next; I_THM]); ALL_TAC] + THEN SUBGOAL_THEN `y:A belong (Q:(A)loop)` (LABEL_TAC "H4") + THENL[USE_THEN "F17" (fun th-> REWRITE_TAC[th]) + THEN DISJ1_TAC THEN EXISTS_TAC `ny:num` + THEN USE_THEN "F22" (fun th-> REWRITE_TAC[th; LE_REFL]); ALL_TAC] + THEN SUBGOAL_THEN `head (H:(A)hypermap) G y = y` MP_TAC + THENL[USE_THEN "H4" MP_TAC THEN USE_THEN "F30" MP_TAC THEN USE_THEN "F11" MP_TAC THEN USE_THEN "F3" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (fun th-> REWRITE_TAC[MATCH_MP lemma_head_via_restricted th]) + THEN MP_TAC (REWRITE_RULE[GE_1; GSYM ADD1] (SYM(SPECL[`SUC p`; `1`; `SUC m`] LE_ADD_LCANCEL))) + THEN USE_THEN "F35"(fun th-> DISCH_THEN (MP_TAC o MATCH_MP th)) + THEN ONCE_REWRITE_TAC[GSYM COM_POWER_FUNCTION] + THEN MP_TAC (SPECL[`SUC p`; `SUC m`] LE_ADD) + THEN USE_THEN "F35"(fun th-> DISCH_THEN (MP_TAC o MATCH_MP th)) + THEN DISCH_THEN SUBST1_TAC + THEN MP_TAC (SPECL[`H:(A)hypermap`; `NF:(A)loop->bool`; `L:(A)loop`; `x:A`] heading) + THEN USE_THEN "YEL"(fun th-> USE_THEN "PN"(fun th1-> REWRITE_TAC[th; th1])) + THEN DISCH_THEN (SUBST1_TAC o SYM) THEN SIMP_TAC[]; ALL_TAC] + THEN USE_THEN "H4" MP_TAC THEN USE_THEN "F30" MP_TAC THEN USE_THEN "F11" MP_TAC THEN USE_THEN "F3" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o SPEC `i:num` o CONJUNCT1 o MATCH_MP lemma_face_contour_on_loop) + THEN USE_THEN "H1"(fun th-> USE_THEN "H2"(fun th1->REWRITE_TAC[th; th1])));; + +let go_into_atom = prove(`!H:(A)hypermap NF:(A)loop->bool L:(A)loop x:A y:A. is_normal H NF /\ L IN NF /\ x belong L /\ y belong L /\ ~(y IN atom H L x) ==>index L y (tail H NF x) <= index L y x`, + REPEAT GEN_TAC + THEN DISCH_THEN(CONJUNCTS_THEN2 (LABEL_TAC "F1") (CONJUNCTS_THEN2 (LABEL_TAC "F2") (CONJUNCTS_THEN2 (LABEL_TAC "F3") (CONJUNCTS_THEN2 (LABEL_TAC "F4") (LABEL_TAC "F5"))))) + THEN USE_THEN "F4"(fun th->USE_THEN "F3"(fun th1-> (CONJUNCTS_THEN2 (LABEL_TAC "F6") (LABEL_TAC "F7")) (MATCH_MP lemma_loop_index (CONJ th th1)))) + THEN SUBGOAL_THEN `?n:num. n <= top (L:(A)loop) /\ ((next (L:(A)loop)) POWER n) (y:A) IN atom (H:(A)hypermap) L x` MP_TAC + THENL[EXISTS_TAC `index (L:(A)loop) (y:A) (x:A)` + THEN USE_THEN "F6"(fun th-> USE_THEN "F7" (fun th1-> REWRITE_TAC[th; SYM th1; atom_reflect])); ALL_TAC] + THEN DISCH_THEN (MP_TAC o ONCE_REWRITE_RULE[num_WOP]) + THEN DISCH_THEN (X_CHOOSE_THEN `n:num` (CONJUNCTS_THEN2 (CONJUNCTS_THEN2 (LABEL_TAC "F8") (LABEL_TAC "F9")) (LABEL_TAC "F10"))) + THEN SUBGOAL_THEN `0 < n:num` MP_TAC + THENL[REMOVE_THEN "F5" MP_TAC + THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] + THEN REWRITE_TAC[NOT_LT; CONJUNCT1 LE] + THEN DISCH_TAC THEN USE_THEN "F9" MP_TAC THEN POP_ASSUM SUBST1_TAC + THEN REWRITE_TAC[POWER_0; I_THM]; ALL_TAC] + THEN DISCH_THEN (MP_TAC o REWRITE_RULE[LT_EXISTS; CONJUNCT1 ADD]) + THEN DISCH_THEN (X_CHOOSE_THEN `d:num` SUBST_ALL_TAC) + THEN ABBREV_TAC `z = (next (L:(A)loop) POWER (SUC d)) y` + THEN POP_ASSUM (LABEL_TAC "F11") + THEN SUBGOAL_THEN `~(z:A = inverse (node_map (H:(A)hypermap)) (back (L:(A)loop) z))` (LABEL_TAC "F12") + THENL[USE_THEN "F10" (MP_TAC o REWRITE_RULE[LT_PLUS] o SPEC `d:num`) + THEN REWRITE_TAC[CONTRAPOS_THM] + THEN DISCH_THEN ASSUME_TAC + THEN USE_THEN "F8"(fun th-> REWRITE_TAC[MATCH_MP LE_TRANS (CONJ (SPEC `d:num` LE_PLUS) th)]) + THEN USE_THEN "F11" (MP_TAC o REWRITE_RULE[GSYM COM_POWER_FUNCTION]) + THEN DISCH_THEN (MP_TAC o AP_TERM `back (L:(A)loop)`) + THEN DISCH_THEN (SUBST1_TAC o REWRITE_RULE[lemma_inverse_evaluation]) + THEN USE_THEN "F9"(fun th->POP_ASSUM (fun th1-> REWRITE_TAC[MATCH_MP lemma_second_absorb_quark (CONJ th th1)])); ALL_TAC] + THEN USE_THEN "F12" MP_TAC THEN USE_THEN "F9" MP_TAC THEN USE_THEN "F3" MP_TAC THEN USE_THEN "F2" MP_TAC THEN USE_THEN "F1" MP_TAC + THEN REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] + THEN DISCH_THEN (MP_TAC o MATCH_MP lemma_unique_tail) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F4"(fun th-> USE_THEN "F8"(fun th1-> USE_THEN "F11" (fun th2-> MP_TAC (MATCH_MP determine_loop_index (CONJ th (CONJ th1 (SYM th2))))))) + THEN DISCH_THEN SUBST1_TAC + THEN USE_THEN "F10" (MP_TAC o SPEC `index (L:(A)loop) y x`) + THEN USE_THEN "F7"(fun th-> USE_THEN "F6"(fun th1-> REWRITE_TAC[th1; SYM th; atom_reflect; NOT_LT])));; + +let square_edge_convolution = prove(`!(H:(A)hypermap). plain_hypermap H ==> !x:A. node_map H (face_map H (node_map H (face_map H x))) = x`, + REPEAT GEN_TAC + THEN REWRITE_TAC[plain_hypermap] + THEN REWRITE_TAC[MATCH_MP convolution_inv (CONJUNCT2 (SPEC `H:(A)hypermap` edge_map_and_darts))] + THEN ONCE_REWRITE_TAC[CONJUNCT1(SPEC `H:(A)hypermap` inverse_hypermap_maps)] + THEN DISCH_TAC THEN GEN_TAC THEN POP_ASSUM (fun th-> MP_TAC (AP_THM th `x:A`)) + THEN REWRITE_TAC[o_THM; I_THM]);; + +let square_edge_convolution2 = prove(`!(H:(A)hypermap). plain_hypermap H ==> !x:A. face_map H (node_map H (face_map H (node_map H x))) = x`, + REPEAT STRIP_TAC + THEN ONCE_REWRITE_TAC[GSYM node_map_injective] + THEN ABBREV_TAC `y = node_map (H:(A)hypermap) x` + THEN ASM_MESON_TAC[square_edge_convolution]);; + + +(* deprecated *) +let lemma_card_inverse_map_eq = lemma_orbit_inverse_map_eq;; + + +prioritize_real();; + +end;; diff --git a/text_formalization/hypermap/summary.hl b/text_formalization/hypermap/summary.hl new file mode 100644 index 0000000..a737a85 --- /dev/null +++ b/text_formalization/hypermap/summary.hl @@ -0,0 +1,303 @@ +(* +Notes on the hypermap chapter. + +new type: hypermap + +infixes: POWER, belong, iso. + +key definitions: orbit_map f x (the orbit of x under f), + edge x (edge map orbit of x), node x, face x. + edge_map, face_map, node_map (the permutations) + + + + +*) + +(* +Notes by Tom Hales in a conversation with TNT on Sep 9, 2010. + + TNT has completed essentially everything up the section with title "transform" + The main theorem in the "transform" section is called AQIUNPP (markup transform). + It is a long proof that is complete except for (flag1) and (flag2). TNT promises + to send the completed proof of AQIUNPP on Sep 12, 2010. + + TNT's general naming convention is lemmaABC for the lemma with guid + ABC. In particular, + lemmaZHQCZLX; lemmaFKSNTKR; lemmaHOZKXVW; lemmaTGJISOK; lemmaIUCLZYI; + lemmaBISHKQW; lemmaFOAGLPA; lemmaSGCOSXK; lemmaQZTPGJV; lemmaKDAEDEX; + lemmaLIPYTUI; lemmaILTXRQD; lemmaICJHAOQ; lemmaJMKRXLA; + lemmaHQYMRTX; lemmaQRDYXYJ. + + [Note: 2/15/2012 + *On HYQMRTX, the furthermore clause in the flypaper hasn't been included in lemmaHQYMRTX. + *I can't find lemmaQRDYXY. It must not have been uploaded. + *Also found lemmaSTKBEPH. This is the algorithm termination; once there are sufficiently many + loops in a normal family, it must be the collection of faces. This seems to have been deleted + from flypaper.pdf. + ] + + + RDW. Reverse double walkup. This is not implemented as of Sep 2010. + He plans to do it in two cases. The special case that does not add + any new nodes and the general case. HLT needs the special case in + the fans chapter. + +*) + +(* + + KHGAQRG. Not done as a separate lemma, but instead it appears many + times as a subgoal. If you have a restricted hypermap and and f step, + then you get a singleton. compare set_one_point, + lemma_singleton_atom, . + + YBGABWW. Equivalent but not identical to theorems in TNT. + + PKRQTKP. There are many orbit theorems in hypermap.hl + + ZJIOZB (def of merge and split), ZMFKZNH (merge-split). Both TNT + and Gonthier reverse things so that the lemma serves as a definition + and the def is proved as a lemma. + + ZMFKZNH breaks into several formal lemmas: lemma_face_merge, + lemma_edge_merge, lemma_node_merge. + + IUCLZYI. This has been formalized, but it is not used directly + elsewhere. Instead, a number of smaller preliminary lemmas get + used. + + EUXPBPO = lemmaThreeDarts // + + WIRLCNL. Something equivalent gets done in lemma_cycle_is_face and + lemmaQuotientFace. + + UDJNSHH. Not formalized. Instead the proofs that rely on it go back + to definitions instead. + + KSRDPTZ = lemmaQuotientNoDoubleJoints // + + PYOVATA = lemmaNodalFixedPoint (not exactly the same, the hypotheses + are different) + + Note May 2012. + QQYVCFM. Not formalized. dih2k defined in such a way to avoid lemma. + WRGCVDR_CIZMRRH.hl defines dih2k in terms of the properties + of QQYVCHEM. So it appears that QQYVCFM is not needed. + cyclic_hypermap.hl and related notions are dead code, never used. + + KHGAQRG. Not formalized because TNT never needs to use it. + +*) + +(* Notes by Hales Feb 12, 2012. + + There are over 600 lemmas in the file. + + TNT has 108 definitions in his file, which makes it hard to + understand the statements and how they related to the + flypaper. Here is an informal summary of definitions. + + infixes: POWER, belong, iso + + Types: + (A)hypermap with extraction functions + dart (H:(A)hypermap -> + edge_map + node_map + face_map + + edge H x ; edge orbit of dart x + node H x ; node orbit of dart x + face H x ; face orbit of dart x + + (A)loop with extraction functions. A loop is an unordered set (of darts) together with a permutation + that acts transitively on he set. (This is what gets called torsor in flypaper.pdf.) + dart_of ; dart set of loop + next ; successor function + back ; inverse of successor function + belong ; in dart set + size ; card of dart set + top ; PRE(CARD dart_of L) + is_loop H L ; x IN L ==>one_step_contour H x (next L x) + loop_path L x k ; ((next L) POWER k) x; path out of loop starting at x. + index L x y ; (specification) smallest i such that y = next^i x. + + Informal definitions: + POWER : nth iterate of a function. + orbit_map (f:A->A) (x:A) orbit of x under f + go_one_step H x y <=> y is the image of dart x under e,n, or f. + is_path H (p:num->A) (n:num) ; (p 0) ... (p n) is a dart path in H. + is_in_component H x y ; darts x and y are in the same path component of H + comb_component H x ; (same as is_in_component H x) + set_of_orbits D f = set of orbits in D of f + number_of_orbits D f = card of set_of_orbits + + edge_set H = set_of_orbits (dart H) (edge_map H) + node_set H = set_of_orbits (dart H) (node_map H) + face_set H = set_of_orbits (dart H) (face_map H) + set_components H D = set of combinatorial components of all darts x in D + set_part_components H D = same as set_components H D + set_of_components H = set_components H (dart H) + + number_of_edges H = Klar + number_of_nodes H = Klar + number_of_faces H = Klar + number_of_components H = Klar + connected_hypermpa H = Klar + + plain_hypermap H + planar_hypermap H + simple_hypermap H + is_no_double_joins H + + dart_degenerate H x; the dart x is fixed by e,n, or f. + dart_nondegenerate H x; negation + is_edge_nondegenerate + is_node_nondegenerate + is_face_nondegenerate + isolated_dart ; x = f x = n x = e x. + is_edge_degenerate ; x = e x but x != n x, x != f x. + is_node_degenerate + is_face_degenerae + + *** + ** lists as functions p:num->A: ** : + + is_inj_list (p:num->A) n ; (p is 1-1 on 0..n) + support_list (p:num->A) n ; { p i | i <= n} + in_list p n ; i IN (support_list p n) + is_disjoint p q + glue p q n ; list concatenation. + is_glueing p q n m ; This states roughly that no member of (q,m) is in (p,n), except (p n = q 0). + Used to concatenate injective lists (p,n) @ (q,m). + join p q n ; list concatenation, swallowing head of q. + + edge_path H x i = ((edge_map H) POWER i) x + node_path H x i = similar + face_path H x i = similar + + samsara p n x = the successor to x in list (p,n), wrapping to the beginning if necessary. + + *** contours + + one_step_contour H x y ; y = f x or n^{-1} x + is_contour H p n ; (p,n) is a contour path + node_contour H x i ; ((inverse (node_map H)) POWER i) x + face_contour H x i ; ((face_map H) POWER i) x + is_inj_contour H p n ; (p,n) is an injective contour path + + + *** walkup + + shift H ; rotates (e,n,f) -> (n,f,e) triality of H. + edge_walkup H x ; new hypermap after edge_walkup of H at x. + node_walkup H x + face_walkup H x + double_edge_walkup H x y + double_node_walkup H x y + double_face_walkup H x y + + *** more on orbits + + power_list f x = \i. (f POWER i) x + inj_orbit f x n ; the power_list of f x is an inj list (p,n) + + order_permutation ; the order of a permutation of finite order. + + *** merge + + is_edge_merge H x. + is_node_merge + is_face_merge + is_edge_split + is_node_split + is_face_split + + is_splitting_component H x ; n x and e^{-1} x are in the same comb component of (edge_walkup H x) + is_Moebius_contour H p k ; (p,k) is an (injective) Moebius contour + + shift_path p i ; \j. p (j + i) + + *** complements + + ind H x n ; + mirror H x k n ; + complement H x n =mirror H x n n ; implements complementary loop of face contour + + *** misc + + res (f:A->A) s ; restriction of function f to s, extension by identity. + + planar_ind H ; planar index iota + + iso H H' ; isomorphism of hypermap + + *** cyclic hypermap + + cyclic_hypermap ; darts two sets of k, cyc_emap, cyc_nmap, cyc_fmap. + + cyc_emap + cyc_nmap + cyc_fmap face map on cyclic hypermap + + + *** quotients + + is_node_going H L x y ; n^{-1} steps from dart x to y in loop L + atom H L x = the "atom" [ .... x;n^{-1} x ....] of x in loop L + is_normal H NF ; NF is a normal family of loops. + quotient_darts H NF ; set of atoms from loops in NF. + support_darts NF ; darts visiting NF + fmap ; face map on atoms + emap ; edge map on atoms + nmap ; node map on atoms + quotient H NF ; quotient hypermap by a normal family NF. + cycle H L ; set of atoms of L + support_node H NF a ; set of darts of H at the node containing the atom a + + choice H NF x ; the atom containing x in the normal family. + head H NF x; head of atom containing dart x. + tail ; tail of a atom containing dart x + + + face_loop H x ; returns the loop on the face of x. + face_collection H ; the set of face loops. + + canon_loop H NF ; this says that every atom in NF has size 1. + canon H NF ; the set of loops that are canonical + canon_darts ; the set of darts of loops that are canonical + + canon_flag H NF ; this is not quite the way it is presented in flypaper. + flag H NF L x ; + + *** m,p,q,x,y,z: + + minside H L x ; specification m st. next^i x = f^i x. + mAdd H L x ; specification p st. f^{p+1} in support of NF. + mRoute H L x ; specification q st ... + + dart_inside H NF L x. { f^i x | 1<= i <= m} + heading H NF L x ; I think this is the dart y = f^{m+1} x. + attach H NF L x ; I think this is the dart z = f^{p+1} y. + + *** restricted hypermaps + + is_restricted H + + is_split_condition H NF L x ; long list of hypotheses; needed to split a loop into two + + is_marked H NF L x; defines marked hypermap + + *** transform of hypermap + + genex H NF L x; glues "attach" dart to "heading" dart + tpx H NF L x; I think this is the size of the new face? + geney NF L x; glues "heading" dart to "attach" dart + tpy H NF L x; again size of new face? + dnax H NF L x ; new loop X + dnay H NF L x = new loop Y + + genesis H NF L x = new set of loops, deleting L, adding two new loops. + +*) diff --git a/text_formalization/jordan/compute_pi.hl b/text_formalization/jordan/compute_pi.hl new file mode 100644 index 0000000..68e063c --- /dev/null +++ b/text_formalization/jordan/compute_pi.hl @@ -0,0 +1,223 @@ + + +(* split off from misc_defs_and_lemmas.ml *) + + +(* ------------------------------------------------------------------ *) +(* COMPUTING PI *) +(* ------------------------------------------------------------------ *) + +Parse_ext_override_interface.unambiguous_interface();; +Parse_ext_override_interface.prioritize_real();; + +(* ------------------------------------------------------------------ *) +(* general series approximations *) +(* ------------------------------------------------------------------ *) + +let SER_APPROX1 = prove_by_refinement( + `!s f g. (f sums s) /\ (summable g) ==> + (!k. ((!n. (||. (f (n+k)) <=. (g (n+k)))) ==> + ( (s - (sum(0,k) f)) <=. (suminf (\n. (g (n +| k)))))))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + DISCH_ALL_TAC; + GEN_TAC; + DISCH_TAC; + IMP_RES_THEN ASSUME_TAC SUM_SUMMABLE; + IMP_RES_THEN (fun th -> (ASSUME_TAC (SPEC `k:num` th))) SER_OFFSET; + IMP_RES_THEN ASSUME_TAC SUM_UNIQ; + SUBGOAL_THEN `(\n. (f (n+ k))) sums (s - (sum(0,k) f))` ASSUME_TAC; + ASM_MESON_TAC[]; + SUBGOAL_THEN `summable (\n. (f (n+k))) /\ (suminf (\n. (f (n+k))) <=. (suminf (\n. (g (n+k)))))` ASSUME_TAC; + MATCH_MP_TAC SER_LE2; + BETA_TAC; + ASM_REWRITE_TAC[]; + IMP_RES_THEN ASSUME_TAC SER_OFFSET; + FIRST_X_ASSUM (fun th -> ACCEPT_TAC (MATCH_MP SUM_SUMMABLE (((SPEC `k:num`) th)))); + ASM_MESON_TAC[SUM_UNIQ] + ]);; + (* }}} *) + +let SER_APPROX = prove_by_refinement( + `!s f g. (f sums s) /\ (!n. (||. (f n) <=. (g n))) /\ + (summable g) ==> + (!k. (abs (s - (sum(0,k) f)) <=. (suminf (\n. (g (n +| k))))))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + DISCH_ALL_TAC; + GEN_TAC; + REWRITE_TAC[REAL_ABS_BOUNDS]; + CONJ_TAC; + SUBGOAL_THEN `(!k. ((!n. (||. ((\p. (--. (f p))) (n+k))) <=. (g (n+k)))) ==> ((--.s) - (sum(0,k) (\p. (--. (f p)))) <=. (suminf (\n. (g (n +k))))))` ASSUME_TAC; + MATCH_MP_TAC SER_APPROX1; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC SER_NEG ; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (REAL_ARITH (`(--. s -. (--. u) <=. x) ==> (--. x <=. (s -. u))`)); + ONCE_REWRITE_TAC[GSYM SUM_NEG]; + FIRST_X_ASSUM (fun th -> (MATCH_MP_TAC th)); + BETA_TAC; + ASM_REWRITE_TAC[REAL_ABS_NEG]; + H_VAL2 CONJ (HYP "0") (HYP "2"); + IMP_RES_THEN MATCH_MP_TAC SER_APPROX1 ; + GEN_TAC; + ASM_MESON_TAC[]; + ]);; + (* }}} *) + +(* ------------------------------------------------------------------ *) +(* now for pi calculation stuff *) +(* ------------------------------------------------------------------ *) + + +let local_def = local_definition "trig";; + + +let PI_EST = prove_by_refinement( + `!n. (1 <=| n) ==> (abs(&4 / &(8 * n + 1) - + &2 / &(8 * n + 4) - + &1 / &(8 * n + 5) - + &1 / &(8 * n + 6)) <= &.622/(&.819))`, + (* {{{ proof *) + [ + GEN_TAC THEN DISCH_ALL_TAC; + REWRITE_TAC[real_div]; + MATCH_MP_TAC (REWRITE_RULE[real_div] (REWRITE_RULE[REAL_RAT_REDUCE_CONV `(&.4/(&.9) +(&.2/(&.12)) + (&.1/(&.13))+ (&.1/(&.14)))`] (REAL_ARITH `(abs((&.4)*.u)<=. (&.4)/(&.9)) /\ (abs((&.2)*.v)<=. (&.2)/(&.12)) /\ (abs((&.1)*w) <=. (&.1)/(&.13)) /\ (abs((&.1)*x) <=. (&.1)/(&.14)) ==> (abs((&.4)*u -(&.2)*v - (&.1)*w - (&.1)*x) <= (&.4/(&.9) +(&.2/(&.12)) + (&.1/(&.13))+ (&.1/(&.14))))`))); + IMP_RES_THEN ASSUME_TAC (ARITH_RULE `1 <=| n ==> (0 < n)`); + FIRST_X_ASSUM (fun th -> ASSUME_TAC (REWRITE_RULE[GSYM REAL_OF_NUM_LT] th)); + ASSUME_TAC (prove(`(a<=.b) ==> (&.n*a <=. (&.n)*b)`,MESON_TAC[REAL_PROP_LE_LMUL;REAL_POS])); + REWRITE_TAC[REAL_ABS_MUL;REAL_ABS_INV;prove(`||.(&.n) = (&.n)`,MESON_TAC[REAL_POS;REAL_ABS_REFL])]; + REPEAT CONJ_TAC THEN (POP_ASSUM (fun th -> MATCH_MP_TAC th)) THEN (MATCH_MP_TAC (prove(`((&.0 <. (&.n)) /\ (&.n <=. a)) ==> (inv(a)<=. (inv(&.n)))`,MESON_TAC[REAL_ABS_REFL;REAL_ABS_INV;REAL_LE_INV2]))) THEN + REWRITE_TAC[REAL_LT;REAL_LE] THEN (H_UNDISCH_TAC (HYP"0")) THEN + ARITH_TAC]);; + (* }}} *) + +let pi_fun = local_def `pi_fun n = inv (&.16 **. n) *. + (&.4 / &.(8 *| n +| 1) -. + &.2 / &.(8 *| n +| 4) -. + &.1 / &.(8 *| n +| 5) -. + &.1 / &.(8 *| n +| 6))`;; + +let pi_bound_fun = local_def `pi_bound_fun n = if (n=0) then (&.8) else + (((&.15)/(&.16))*(inv(&.16 **. n))) `;; + +let PI_EST2 = prove_by_refinement( + `!k. abs(pi_fun k) <=. (pi_bound_fun k)`, + (* {{{ proof *) + [ + GEN_TAC; + REWRITE_TAC[pi_fun;pi_bound_fun]; + COND_CASES_TAC; + ASM_REWRITE_TAC[]; + CONV_TAC (NUM_REDUCE_CONV); + (CONV_TAC (REAL_RAT_REDUCE_CONV)); + CONV_TAC (RAND_CONV (REWR_CONV (REAL_ARITH `a*b = b*.a`))); + REWRITE_TAC[REAL_ABS_MUL;REAL_ABS_INV;REAL_ABS_POW;prove(`||.(&.n) = (&.n)`,MESON_TAC[REAL_POS;REAL_ABS_REFL])]; + MATCH_MP_TAC (prove(`!x y z. (&.0 <. z /\ (y <=. x) ==> (z*y <=. (z*x)))`,MESON_TAC[REAL_LE_LMUL_EQ])); + ASSUME_TAC (REWRITE_RULE[] (REAL_RAT_REDUCE_CONV `(&.622)/(&.819) <=. (&.15)/(&.16)`)); + IMP_RES_THEN ASSUME_TAC (ARITH_RULE `~(k=0) ==> (1<=| k)`); + IMP_RES_THEN ASSUME_TAC (PI_EST); + CONJ_TAC; + SIMP_TAC[REAL_POW_LT;REAL_LT_INV;ARITH_RULE `&.0 < (&.16)`]; + ASM_MESON_TAC[REAL_LE_TRANS]; + ]);; + (* }}} *) + +let GP16 = prove_by_refinement( + `!k. (\n. inv (&16 pow k) * inv (&16 pow n)) sums + inv (&16 pow k) * &16 / &15`, + (* {{{ proof *) + [ + GEN_TAC; + ASSUME_TAC (REWRITE_RULE[] (REAL_RAT_REDUCE_CONV `abs (&.1 / (&. 16)) <. (&.1)`)); + IMP_RES_THEN (fun th -> ASSUME_TAC (CONV_RULE REAL_RAT_REDUCE_CONV th)) GP; + MATCH_MP_TAC SER_CMUL; + ASM_REWRITE_TAC[GSYM REAL_POW_INV;REAL_INV_1OVER]; + ]);; + (* }}} *) + +let GP16a = prove_by_refinement( + `!k. (0<|k) ==> (\n. (pi_bound_fun (n+k))) sums (inv(&.16 **. k))`, + (* {{{ proof *) + [ + GEN_TAC; + DISCH_TAC; + SUBGOAL_THEN `(\n. pi_bound_fun (n+k)) = (\n. ((&.15/(&.16))* (inv(&.16)**. k) *. inv(&.16 **. n)))` (fun th-> REWRITE_TAC[th]); + MATCH_MP_TAC EQ_EXT; + X_GEN_TAC `n:num` THEN BETA_TAC; + REWRITE_TAC[pi_bound_fun]; + COND_CASES_TAC; + ASM_MESON_TAC[ARITH_RULE `0<| k ==> (~(n+k = 0))`]; + REWRITE_TAC[GSYM REAL_MUL_ASSOC]; + AP_TERM_TAC; + REWRITE_TAC[REAL_INV_MUL;REAL_POW_ADD;REAL_POW_INV;REAL_MUL_AC]; + SUBGOAL_THEN `(\n. (&.15/(&.16)) *. ((inv(&.16)**. k)*. inv(&.16 **. n))) sums ((&.15/(&.16)) *.(inv(&.16**. k)*. ((&.16)/(&.15))))` ASSUME_TAC; + MATCH_MP_TAC SER_CMUL; + REWRITE_TAC[REAL_POW_INV]; + ACCEPT_TAC (SPEC `k:num` GP16); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[REAL_MUL_ASSOC]; + MATCH_MP_TAC (prove (`(x=y) ==> ((a sums x) ==> (a sums y))`,MESON_TAC[])); + MATCH_MP_TAC (REAL_ARITH `(b*(a*c) = (b*(&.1))) ==> ((a*b)*c = b)`); + AP_TERM_TAC; + CONV_TAC (REAL_RAT_REDUCE_CONV); + ]);; + (* }}} *) + +let PI_SER = prove_by_refinement( + `!k. (0<|k) ==> (abs(pi - (sum(0,k) pi_fun)) <=. (inv(&.16 **. (k))))`, + (* {{{ proof *) + [ + GEN_TAC THEN DISCH_TAC; + ASSUME_TAC (ONCE_REWRITE_RULE[ETA_AX] (REWRITE_RULE[GSYM pi_fun] POLYLOG_THM)); + ASSUME_TAC PI_EST2; + IMP_RES_THEN (ASSUME_TAC) GP16a; + IMP_RES_THEN (ASSUME_TAC) SUM_SUMMABLE; + IMP_RES_THEN (ASSUME_TAC) SER_OFFSET_REV; + IMP_RES_THEN (ASSUME_TAC) SUM_SUMMABLE; + MP_TAC (SPECL [`pi`;`pi_fun`;`pi_bound_fun` ] SER_APPROX); + ASM_REWRITE_TAC[]; + DISCH_THEN (fun th -> MP_TAC (SPEC `k:num` th)); + SUBGOAL_THEN `suminf (\n. pi_bound_fun (n + k)) = inv (&.16 **. k)` (fun th -> (MESON_TAC[th])); + ASM_MESON_TAC[SUM_UNIQ]; + ]);; + (* }}} *) + +(* replace 3 by SUC (SUC (SUC 0)) *) +let SUC_EXPAND_CONV tm = + let count = dest_numeral tm in + let rec add_suc i r = + if (i <=/ (Int 0)) then r + else add_suc (i -/ (Int 1)) (mk_comb (`SUC`,r)) in + let tm' = add_suc count `0` in + REWRITE_RULE[] (ARITH_REWRITE_CONV[] (mk_eq (tm,tm')));; + +let inv_twopow = prove( + `!n. inv (&.16 **. n) = (twopow (--: (&:(4*n)))) `, + REWRITE_TAC[TWOPOW_NEG;GSYM (NUM_RED_CONV `2 EXP 4`); + REAL_OF_NUM_POW;EXP_MULT]);; + +let PI_SERn n = + let SUM_EXPAND_CONV = + (ARITH_REWRITE_CONV[]) THENC + (TOP_DEPTH_CONV SUC_EXPAND_CONV) THENC + (REWRITE_CONV[sum]) THENC + (ARITH_REWRITE_CONV[REAL_ADD_LID;GSYM REAL_ADD_ASSOC]) in + let sum_thm = SUM_EXPAND_CONV (vsubst [n,`i:num`] `sum(0,i) f`) in + let gt_thm = ARITH_RULE (vsubst [n,`i:num`] `0 <| i`) in + ((* CONV_RULE REAL_RAT_REDUCE_CONV *)(CONV_RULE (ARITH_REWRITE_CONV[]) (BETA_RULE (REWRITE_RULE[sum_thm;pi_fun;inv_twopow] (MATCH_MP PI_SER gt_thm)))));; + +(* abs(pi - u ) < e *) +let recompute_pi bprec = + let n = (bprec /4) in + let pi_ser = PI_SERn (mk_numeral (Int n)) in + let _ = remove_real_constant `pi` in + (add_real_constant pi_ser; INTERVAL_OF_TERM bprec `pi`);; + +(* ------------------------------------------------------------------ *) +(* restore defaults *) +(* ------------------------------------------------------------------ *) + +reduce_local_interface("trig");; diff --git a/text_formalization/jordan/float.hl b/text_formalization/jordan/float.hl new file mode 100644 index 0000000..2ef2c8a --- /dev/null +++ b/text_formalization/jordan/float.hl @@ -0,0 +1,2108 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Jordan *) +(* Copied from HOL Light jordan directory *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-08 *) +(* ========================================================================== *) + +(* +A handheld calculator, implemented in HOL light. + +It implements + - / * sqrt, ssqrt, abs, atn, acs, pi, +The user can supply additional conversons to extend the calculator to other functions. + +There is an example file float_example.hl. +*) + +(* based on float.ml in hol/jordan/float.ml *) + +(* +To do. Allow the user to supply theorems that carry domain constraints, + (such as ACS_ATN). +*) + +flyspeck_needs "jordan/taylor_atn.hl";; + +module Float = struct + +open Lib_ext;; +open Num_ext_nabs;; +open Real_ext;; +open Refinement;; +open Tactics_jordan;; +open Taylor_atn;; + +Parse_ext_override_interface.unambiguous_interface();; +Parse_ext_override_interface.prioritize_real();; + +(* Three types of error: + Insufficient precision: the inequality might be true but there is not enough + precision to decide. Divide by zero generally lands here, because there is + no testing for exact equality. + + Internal failure: a bug in this code. + + User input failure: sqrt of negative numbers, false inequalities. + +*) + +exception Insufficient_precision;; + +(* +exception Mk_comb of (term*hol_type)*(term*hol_type);; + +let mk_comb(a,b) = try mk_comb(a,b) with + Failure _ -> raise (Mk_comb((a,type_of a),(b,type_of b)));; +*) +let add_test,test = new_test_suite();; + +let twopow = + new_definition( + `twopow x = if (?n. (x = (int_of_num n))) + then ((&2) pow (nabs x)) + else inv((&2) pow (nabs x))`);; + +let float = + new_definition( + `float x n = (real_of_int x)*(twopow n)`);; + +let interval_eps = + new_definition( + `interval_eps x f eps = ((abs (x-f)) <= eps)`);; + +(*--------------------------------------------------------------------*) + + +let mk_interval a b ex = + mk_comb(mk_comb (mk_comb (`interval_eps`,a),b),ex);; + +add_test("mk_interval", + mk_interval `#3` `#4` `#1` = `interval_eps #3 #4 #1`);; + +let dest_interval intv = + let (h1,ex) = dest_comb intv in + let (h2,f) = dest_comb h1 in + let (h3,a) = dest_comb h2 in + let _ = (h3 = `interval_eps`) or (print_term h3; failwith "dest_interval:interval_eps") in + (a,f,ex);; + +let _ = add_test("dest_interval", + let a = `#3` and b = `#4` and c = `#1` in + dest_interval (mk_interval a b c) = (a,b,c));; + +(*--------------------------------------------------------------------*) + +let (dest_int:term-> Num.num) = + fun b -> + let dest_pos_int a = + let (op,nat) = dest_comb a in + if (fst (dest_const op) = "int_of_num") then (dest_numeral nat) + else fail() in + let (op',u) = (dest_comb b) in + try (if (fst (dest_const op') = "int_neg") then + minus_num (dest_pos_int u) else + dest_pos_int b) with + Failure _ -> failwith "dest_int ";; + + +let (mk_int:Num.num -> term) = + fun a -> + let sgn = Num.sign_num a in + let abv = Num.abs_num a in + let r = mk_comb(`int_of_num`,mk_numeral abv) in + try (if (sgn<0) then mk_comb (`int_neg`,r) else r) with + Failure _ -> failwith ("dest_int "^(string_of_num a));; + +add_test("mk_int", + (mk_int (Int (-1443)) = `int_neg (int_of_num 1443)`) && + (mk_int (Int 37) = `(int_of_num 37)`));; + +(* ------------------------------------------------------------------ *) + +let (split_ratio:Num.num -> Num.num*Num.num) = + function + (Ratio r) -> (Big_int (Ratio.numerator_ratio r)), + (Big_int (Ratio.denominator_ratio r))| + u -> (u,(Int 1));; + +add_test("split_ratio", + let (a,b) = split_ratio ((Int 4)//(Int 20)) in + (a =/ (Int 1)) && (b =/ (Int 5)));; + +(* ------------------------------------------------------------------ *) + +(* break nonzero int r into a*(C**b) with a prime to C . *) +let (factor_C:int -> Num.num -> Num.num*Num.num) = + function c -> + let intC = (Int c) in + let rec divC (a,b) = + if ((Int 0) =/ mod_num a intC) then (divC (a//intC,b+/(Int 1))) + else (a,b) in + function r-> + if ((Num.is_integer_num r)&& not((Num.sign_num r) = 0)) then + divC (r,(Int 0)) else failwith "factor_C";; + +add_test("factor_C", + (factor_C 2 (Int (4096+32)) = (Int 129,Int 5)) && + (factor_C 10 (Int (5000)) = (Int 5,Int 3)) && + (cannot (factor_C 2) ((Int 50)//(Int 3))));; + +(*--------------------------------------------------------------------*) + +let (dest_float:term -> Num.num) = + fun f -> + let (a,b) = dest_binop `float` f in + (dest_int a)*/ ((Int 2) **/ (dest_int b));; + +add_test("dest_float", + dest_float `float (int_of_num 3) (int_of_num 17)` = (Int 393216));; + +add_test("dest_float2", (* must express as numeral first *) + cannot dest_float `float ((int_of_num 3)+:(int_of_num 1)) (int_of_num 17)`);; + +(* ------------------------------------------------------------------ *) +(* creates float of the form `float a b` with a odd *) +let (mk_float:Num.num -> term) = + function r -> + let (a,b) = split_ratio r in + let (a',exp_a) = if (a=/(Int 0)) then ((Int 0),(Int 0)) else factor_C 2 a in + let (b',exp_b) = factor_C 2 b in + let c = a'//b' in + if (Num.is_integer_num c) then + mk_binop `float` (mk_int c) (mk_int (exp_a -/ exp_b)) + else failwith "mk_float";; + +add_test("mk_float", + mk_float (Int (4096+32)) = `float (int_of_num 129) (int_of_num 5)` && + (mk_float (Int 0) = `float (int_of_num 0) (int_of_num 0)`));; + +add_test("mk_float2", (* throws exception exactly when denom != 2^k *) + let rtest = fun t -> (t =/ dest_float (mk_float t)) in + rtest ((Int 3)//(Int 1024)) && + (cannot rtest ((Int 1)//(Int 3))));; + +add_test("mk_float dest_float", (* constructs canonical form of float *) + mk_float (dest_float `float (int_of_num 4) (int_of_num 3)`) = `float (int_of_num 1) (int_of_num 5)`);; + +(* ------------------------------------------------------------------ *) +(* creates decimal of the form `DECIMAL a b` with a prime to 10 *) +let (mk_pos_decimal:Num.num -> term) = + let zero = `#0` in + function r -> + let _ = assert (r >=/ (Int 0)) in + let (a,b) = split_ratio r in + if (a=/(Int 0)) then zero else + let (a1,exp_a5) = factor_C 5 a in + let (a2,exp_a2) = factor_C 2 a1 in + let (b1,exp_b5) = factor_C 5 b in + let (b2,exp_b2) = factor_C 2 b1 in + let _ = assert(b2 =/ (Int 1)) in + let c = end_itlist Num.max_num [exp_b5-/exp_a5;exp_b2-/exp_a2;(Int 0)] in + let a' = a2*/((Int 2)**/ (c +/ exp_a2 -/ exp_b2))*/ + ((Int 5)**/(c +/ exp_a5 -/ exp_b5)) in + let b' = (Int 10) **/ c in + mk_binop `DECIMAL` (mk_numeral a') (mk_numeral b');; + +add_test("mk_pos_decimal", + mk_pos_decimal (Int (5000)) = `#5000` && + (mk_pos_decimal ((Int 30)//(Int 40)) = `#0.75`) && + (mk_pos_decimal (Int 0) = `#0`) && + (mk_pos_decimal ((Int 15)//(Int 25)) = `#0.6`) && + (mk_pos_decimal ((Int 25)//(Int 4)) = `#6.25`) && + (mk_pos_decimal ((Int 2)//(Int 25)) = `#0.08`));; + +let (mk_decimal:Num.num->term) = + function r -> + let a = Num.sign_num r in + let b = mk_pos_decimal (Num.abs_num r) in + if (a < 0) then (mk_comb (`real_neg`, b)) else b;; + +add_test("mk_decimal", + (mk_decimal (Int 3) = `#3`) && + (mk_decimal (Int (-3)) = `real_neg (#3)`));; + + + +(*--------------------------------------------------------------------*) + +let (dest_decimal:term -> Num.num) = + fun f -> + let (a,b) = dest_binop `DECIMAL` f in + let a1 = dest_numeral a in + let b1 = dest_numeral b in + a1//b1;; + +add_test("dest_decimal", + dest_decimal `#3.4` =/ ((Int 34)//(Int 10)));; +add_test("dest_decimal2", + cannot dest_decimal `real_neg (#3.4)`);; + + + + + +(*--------------------------------------------------------------------*) +(* Properties of integer powers of 2. *) +(* ------------------------------------------------------------------ *) + + +let TWOPOW_POS = prove(`!n. (twopow (int_of_num n) = (&2) pow n)`, + (REWRITE_TAC[twopow]) + THEN GEN_TAC + THEN COND_CASES_TAC + THENL [AP_TERM_TAC;ALL_TAC] + THEN (REWRITE_TAC[NABS_POS]) + THEN (UNDISCH_EL_TAC 0) + THEN (TAUT_TAC (` ( A ) ==> (~ A ==> B)`)) + THEN (MESON_TAC[]));; + +let TWOPOW_NEG = prove(`!n. (twopow (--(int_of_num n)) = inv((&2) pow n))`, + GEN_TAC + THEN (REWRITE_TAC[twopow]) + THEN (COND_CASES_TAC THENL [ALL_TAC;REWRITE_TAC[NABS_NEG]]) + THEN (POP_ASSUM CHOOSE_TAC) + THEN (REWRITE_TAC[NABS_NEG]) + THEN (UNDISCH_EL_TAC 0) + THEN (REWRITE_TAC[int_eq;int_neg_th;INT_NUM_REAL]) + THEN (REWRITE_TAC[prove (`! u y.((--(real_of_num u) = (real_of_num y))= + ((real_of_num u) +(real_of_num y) = (&0)))`,REAL_ARITH_TAC)]) + THEN (REWRITE_TAC[REAL_OF_NUM_ADD;REAL_OF_NUM_EQ;ADD_EQ_0]) + THEN (DISCH_TAC) + THEN (ASM_REWRITE_TAC[real_pow;REAL_INV_1]));; + + +let TWOPOW_INV = prove(`!a. (twopow (--: a) = (inv (twopow a)))`, + (GEN_TAC) + THEN ((ASSUME_TAC (SPEC `a:int` INT_REP2))) + THEN ((POP_ASSUM CHOOSE_TAC)) + THEN ((POP_ASSUM DISJ_CASES_TAC)) + THEN ((ASM_REWRITE_TAC[TWOPOW_POS;TWOPOW_NEG;REAL_INV_INV;INT_NEG_NEG])));; + +let INT_REP3 = prove(`!a .(?n.( (a = int_of_num n) \/ (a = --: (int_of_num (n+1)))))`, +(GEN_TAC) +THEN ((ASSUME_TAC (SPEC `a:int` INT_REP2))) +THEN ((POP_ASSUM CHOOSE_TAC)) +THEN ((DISJ_CASES_TAC (prove (`((a:int) = (int_of_num 0)) \/ ~((a:int) =(int_of_num 0))`, MESON_TAC[])))) +(* cases *) +THENL[ ((EXISTS_TAC `0`)) THEN ((ASM_REWRITE_TAC[]));ALL_TAC] +THEN ((UNDISCH_EL_TAC 0)) +THEN ((POP_ASSUM DISJ_CASES_TAC)) +THENL [DISCH_TAC THEN ((ASM MESON_TAC)[]);ALL_TAC] +THEN (DISCH_TAC) +THEN ((EXISTS_TAC `PRE n`)) +THEN ((DISJ2_TAC)) +THEN ((ASM_REWRITE_TAC[INT_EQ_NEG2])) +(*** Changed by JRH, 2006/03/28 to avoid PRE_ELIM_TAC ***) +THEN (FIRST_X_ASSUM(MP_TAC o check(is_neg o concl))) +THEN (ASM_REWRITE_TAC[INT_NEG_EQ_0; INT_OF_NUM_EQ]) +THEN (ARITH_TAC));; + +let REAL_EQ_INV = prove(`!x y. ((x:real = y) <=> (inv(x) = inv (y)))`, +((REPEAT GEN_TAC)) +THEN (EQ_TAC) +THENL [((DISCH_TAC THEN (ASM_REWRITE_TAC[]))); + (* branch 2*) ((DISCH_TAC)) +THEN ((ONCE_REWRITE_TAC [(GSYM REAL_INV_INV)])) +THEN ((ASM_REWRITE_TAC[]))]);; + +let TWOPOW_ADD_1 = + prove(`!a. (twopow (a +: (int_of_num 1)) = twopow (a) *. (twopow (int_of_num 1)))`, +EVERY[ + GEN_TAC; + CHOOSE_TAC (SPEC `a:int` INT_REP3); + POP_ASSUM DISJ_CASES_TAC + THENL[ + ASM_REWRITE_TAC[TWOPOW_POS;INT_OF_NUM_ADD;REAL_POW_ADD]; + EVERY[ + ASM_REWRITE_TAC[GSYM INT_OF_NUM_ADD;INT_NEG_ADD;GSYM INT_ADD_ASSOC;INT_ADD_LINV;INT_ADD_RID]; + REWRITE_TAC[GSYM INT_NEG_ADD;INT_OF_NUM_ADD;TWOPOW_NEG;TWOPOW_POS]; + ONCE_REWRITE_TAC[SPEC `(&. 2) pow 1` (GSYM REAL_INV_INV)]; + REWRITE_TAC[GSYM REAL_INV_MUL;GSYM REAL_EQ_INV;REAL_POW_ADD;GSYM REAL_MUL_ASSOC;REAL_POW_1]; + REWRITE_TAC[MATCH_MP REAL_MUL_RINV (REAL_ARITH `~((&. 2) = (&. 0))`); REAL_MUL_RID] + ] + ] +]);; + + +let TWOPOW_0 = prove(`twopow (int_of_num 0) = (&. 1)`, + (REWRITE_TAC[TWOPOW_POS;real_pow]));; + +let TWOPOW_SUB_NUM = prove(`!m n.( twopow((int_of_num m) - (int_of_num n)) = twopow((int_of_num m))*. twopow(--: (int_of_num n)))`, +((INDUCT_TAC)) +THENL [REWRITE_TAC[INT_SUB_LZERO;REAL_MUL_LID;TWOPOW_0];ALL_TAC] +THEN ((INDUCT_TAC THEN + ( (ASM_REWRITE_TAC[INT_SUB_RZERO;TWOPOW_0;REAL_MUL_RID;INT_NEG_0;ADD1;GSYM INT_OF_NUM_ADD])))) +THEN ((ASM_REWRITE_TAC [TWOPOW_ADD_1;TWOPOW_INV;prove (`((int_of_num m)+(int_of_num 1)) -: ((int_of_num n) +: (int_of_num 1)) = ((int_of_num m)-: (int_of_num n))`,INT_ARITH_TAC)])) +THEN ((REWRITE_TAC[REAL_INV_MUL])) +THEN ((ABBREV_TAC `a:real = twopow (int_of_num m)`)) +THEN ((ABBREV_TAC `b:real = inv(twopow (int_of_num n))`)) +THEN ((REWRITE_TAC[TWOPOW_POS;REAL_POW_1;GSYM REAL_MUL_ASSOC;prove (`!(x:real). ((&.2)*x = x*(&.2))`,REAL_ARITH_TAC)])) +THEN ((REWRITE_TAC[REAL_INV2;REAL_MUL_RID])));; + +let TWOPOW_ADD_NUM = prove( + `!m n. (twopow ((int_of_num m) + (int_of_num n)) = twopow((int_of_num m))*. twopow((int_of_num n)))`, +(REWRITE_TAC[TWOPOW_POS;REAL_POW_ADD;INT_OF_NUM_ADD]));; + +let TWOPOW_ADD_INT = prove( + `!a b. (twopow (a +: b) = twopow(a) *. (twopow(b)))`, + ((REPEAT GEN_TAC)) +THEN ((ASSUME_TAC (SPEC `a:int` INT_REP))) +THEN ((POP_ASSUM CHOOSE_TAC)) +THEN ((POP_ASSUM CHOOSE_TAC)) +THEN ((ASSUME_TAC (SPEC `b:int` INT_REP))) +THEN ((REPEAT (POP_ASSUM CHOOSE_TAC))) +THEN ((ASM_REWRITE_TAC[])) +THEN ((SUBGOAL_MP_TAC `int_of_num n -: int_of_num m +: int_of_num n' -: int_of_num m' = (int_of_num (n+n')) -: (int_of_num (m+m'))`)) +(* branch *) +THENL[ ((REWRITE_TAC[GSYM INT_OF_NUM_ADD])) +THEN ((INT_ARITH_TAC));ALL_TAC] +(* 2nd *) +THEN ((DISCH_TAC)) +THEN ((ASM_REWRITE_TAC[TWOPOW_SUB_NUM;TWOPOW_INV;TWOPOW_POS;REAL_POW_ADD;REAL_INV_MUL;GSYM REAL_MUL_ASSOC])) +THEN ((ABBREV_TAC `a':real = inv ((&. 2) pow m)`)) +THEN ((ABBREV_TAC `c :real = (&. 2) pow n`)) +THEN ((ABBREV_TAC `d :real = (&. 2) pow n'`)) +THEN ((ABBREV_TAC `e :real = inv ((&. 2) pow m')`)) +THEN (MESON_TAC[REAL_MUL_AC]));; + +let TWOPOW_ABS = prove(`!a. real_abs (twopow a) = (twopow a)`, +(GEN_TAC) +THEN ((CHOOSE_THEN DISJ_CASES_TAC (SPEC `a:int` INT_REP2))) +(* branch *) +THEN ((ASM_REWRITE_TAC[TWOPOW_POS;TWOPOW_NEG;REAL_ABS_POW;REAL_ABS_NUM;REAL_ABS_INV])));; + +let REAL_POW_POW = prove( + `!x m n . (x **. m) **. n = x **. (m *| n)`, +((GEN_TAC THEN GEN_TAC THEN INDUCT_TAC)) +(* branch *) +THENL[ ((REWRITE_TAC[real_pow;MULT_0])); +(* second branch *) +((REWRITE_TAC[real_pow])) +THEN ((ASM_REWRITE_TAC[ADD1;LEFT_ADD_DISTRIB;REAL_POW_ADD;REAL_MUL_AC;MULT_CLAUSES]))]);; + +let INT_POW_POW = INT_OF_REAL_THM REAL_POW_POW;; + +let TWOPOW_POW = prove( + `!a n. (twopow a) pow n = twopow (a *: (int_of_num n))`, +((REPEAT GEN_TAC)) +THEN ((CHOOSE_THEN DISJ_CASES_TAC (SPEC `a:int` INT_REP2))) +(* branch *) +THEN ((ASM_REWRITE_TAC[TWOPOW_POS;INT_OF_NUM_MUL; + REAL_POW_POW;TWOPOW_NEG;REAL_POW_INV;INT_OF_NUM_MUL;GSYM INT_NEG_LMUL])));; + +(* ------------------------------------------------------------------ *) +(* Arithmetic operations on float *) +(* ------------------------------------------------------------------ *) + + +let FLOAT_NEG = prove(`!a m. real_neg (float a m) = float (--: a) m`, + REPEAT GEN_TAC THEN + REWRITE_TAC[float;GSYM REAL_MUL_LNEG;int_neg_th]);; + + + +let FLOAT_MUL = prove(`!a b m n. (float a m) *. (float b n) = (float (a *: b) (m +: n))`, +((REPEAT GEN_TAC)) +THEN ((REWRITE_TAC[float;GSYM REAL_MUL_ASSOC;TWOPOW_ADD_INT;int_mul_th])) +THEN ((MESON_TAC[REAL_MUL_AC])));; + +let FLOAT_ADD = prove( + `!a b c m. (float a (m+: (int_of_num c))) +. (float b m) + = (float ( (int_of_num (2 EXP c))*a +: b) m)`, +((REWRITE_TAC[float;int_add_th;REAL_ADD_RDISTRIB;int_mul_th;TWOPOW_ADD_INT])) +THEN ((REPEAT GEN_TAC)) +THEN ((REWRITE_TAC[TWOPOW_POS;INT_NUM_REAL;GSYM REAL_OF_NUM_POW])) +THEN ((MESON_TAC[REAL_MUL_AC])));; + +let FLOAT_ADD_EQ = prove( + `!a b m. (float a m) +. (float b m) = + (float (a+:b) m)`, + ((REPEAT GEN_TAC)) +THEN ((REWRITE_TAC[REWRITE_RULE[INT_ADD_RID] (SPEC `m:int` (SPEC `0` (SPEC `b:int` (SPEC `a:int` FLOAT_ADD))))])) +THEN ((REWRITE_TAC[EXP;INT_MUL_LID])));; + +let FLOAT_ADD_NP = prove( + `!a b m n. (float b (--:(int_of_num n))) +. (float a (int_of_num m)) = (float a (int_of_num m)) +. (float b (--:(int_of_num n)))`, +(REWRITE_TAC[REAL_ADD_AC]));; + +let FLOAT_ADD_PN = prove( + `!a b m n. (float a (int_of_num m)) +. (float b (--(int_of_num n))) = (float ( (int_of_num (2 EXP (m+| n)))*a + b) (--:(int_of_num n)))`, +((REPEAT GEN_TAC)) +THEN ((SUBGOAL_MP_TAC `int_of_num m = (--:(int_of_num n)) + (int_of_num (m+n))`)) +THENL[ ((REWRITE_TAC[GSYM INT_OF_NUM_ADD])) +THEN ((INT_ARITH_TAC)); +(* branch *) +((DISCH_TAC)) +THEN ((ASM_REWRITE_TAC[FLOAT_ADD]))]);; + +let FLOAT_ADD_PP = prove( + `!a b m n. ((n <=| m) ==>( (float a (int_of_num m)) +. (float b (int_of_num n)) = (float ((int_of_num (2 EXP (m -| n))) *a + b) (int_of_num n))))`, +((REPEAT GEN_TAC)) +THEN (DISCH_TAC) +THEN ((SUBGOAL_MP_TAC `int_of_num m = (int_of_num n) + (int_of_num (m-n))`)) +THENL[ ((REWRITE_TAC[INT_OF_NUM_ADD])) +THEN (AP_TERM_TAC) +THEN ((REWRITE_TAC[prove (`!(m:num) n. (n+m-n) = (m-n)+n`,REWRITE_TAC[ADD_AC])])) +THEN ((UNDISCH_EL_TAC 0)) +THEN ((MATCH_ACCEPT_TAC(GSYM SUB_ADD))); +(* branch *) +((DISCH_TAC)) +THEN ((ASM_REWRITE_TAC[FLOAT_ADD]))]);; + +let FLOAT_ADD_PPv2 = prove( + `!a b m n. ((m <| n) ==>( (float a (int_of_num m)) +. (float b (int_of_num n)) = (float ((int_of_num (2 EXP (n -| m))) *b + a) (int_of_num m))))`, +((REPEAT GEN_TAC)) +THEN (DISCH_TAC) +THEN ((H_MATCH_MP (THM (prove(`!m n. m<|n ==> m <=|n`,MESON_TAC[LT_LE]))) (HYP_INT 0))) +THEN ((UNDISCH_EL_TAC 0)) +THEN ((SIMP_TAC[GSYM FLOAT_ADD_PP])) +THEN (DISCH_TAC) +THEN ((REWRITE_TAC[REAL_ADD_AC])));; + +let FLOAT_ADD_NN = prove( +`!a b m n. ((n <=| m) ==>( (float a (--:(int_of_num m))) +. (float b (--:(int_of_num n))) + = (float ((int_of_num (2 EXP (m -| n))) *b + a) (--:(int_of_num m)))))`, +((REPEAT GEN_TAC)) +THEN (DISCH_TAC) +THEN ((SUBGOAL_MP_TAC `--: (int_of_num n) = --: (int_of_num m) + (int_of_num (m-n))`)) +THENL [((UNDISCH_EL_TAC 0)) +THEN ((SIMP_TAC [INT_OF_REAL_THM (GSYM REAL_OF_NUM_SUB)])) +THEN (DISCH_TAC) +THEN ((INT_ARITH_TAC)); +(*branch*) +((DISCH_TAC)) +THEN (ASM_REWRITE_TAC[GSYM FLOAT_ADD;REAL_ADD_AC])]);; + +let FLOAT_ADD_NNv2 = prove( +`!a b m n. ((m <| n) ==>( (float a (--:(int_of_num m))) +. (float b (--:(int_of_num n))) + = (float ((int_of_num (2 EXP (n -| m))) *a + b) (--:(int_of_num n)))))`, +((REPEAT GEN_TAC)) +THEN (DISCH_TAC) +THEN (((H_MATCH_MP (THM (prove(`!m n. m<|n ==> m <=|n`,MESON_TAC[LT_LE]))) (HYP_INT 0)))) +THEN (((UNDISCH_EL_TAC 0))) +THEN (((SIMP_TAC[GSYM FLOAT_ADD_NN]))) +THEN ((DISCH_TAC)) +THEN (((REWRITE_TAC[REAL_ADD_AC]))));; + +let FLOAT_SUB = prove( + `!a b n m. (float a n) -. (float b m) + = (float a n) +. (float (--: b) m)`, +REWRITE_TAC[float;int_neg_th;real_sub;REAL_NEG_LMUL]);; + +let FLOAT_ABS = prove( + `!a n. real_abs (float a n) = (float (||: a) n)`, +(REWRITE_TAC[float;int_abs_th;REAL_ABS_MUL;TWOPOW_ABS]));; + + +let FLOAT_POW = prove( + `!a n m. (float a n) **. m = (float (a **: m) (n *: (int_of_num m)))`, +(REWRITE_TAC[float;REAL_POW_MUL;int_pow_th;TWOPOW_POW]));; + +let INT_SUB = prove( + `!a b. (a -: b) = (a +: (--: b))`, + (REWRITE_TAC[GSYM INT_SUB_RNEG;INT_NEG_NEG]));; + +let INT_ABS_NUM = prove( + `!n. ||: (int_of_num n) = (int_of_num n)`, + (REWRITE_TAC[int_eq;int_abs_th;INT_NUM_REAL;REAL_ABS_NUM]));; + +let INT_ABS_NEG_NUM = prove( + `!n. ||: (--: (int_of_num n)) = (int_of_num n)`, + (REWRITE_TAC[int_eq;int_abs_th;int_neg_th;INT_NUM_REAL;REAL_ABS_NUM;REAL_ABS_NEG]));; + +let INT_ADD_NEG_NUM = prove(`!x y. --: (int_of_num x) +: (int_of_num y) = (int_of_num y) +: (--: (int_of_num x))`, + (REWRITE_TAC[INT_ADD_AC]));; + +let INT_POW_MUL = INT_OF_REAL_THM REAL_POW_MUL;; + +let INT_POW_NEG1 = prove ( + `!x n. (--: (int_of_num x)) **: n = ((--: (int_of_num 1)) **: n) *: ((int_of_num x) **: n)`, +(REWRITE_TAC[GSYM INT_POW_MUL; GSYM INT_NEG_MINUS1]));; + +let pow = real_pow;; + + +let POW_1 = prove( + `!x. x pow 1 = x`, + GEN_TAC THEN REWRITE_TAC[num_CONV `1`] THEN + REWRITE_TAC[pow; REAL_MUL_RID]);; + +let POW_2 = prove( + `!x. x pow 2 = x * x`, + GEN_TAC THEN REWRITE_TAC[num_CONV `2`] THEN + REWRITE_TAC[pow; POW_1]);; + + +let INT_POW_EVEN_NEG1 = prove( + `!x n. (--: (int_of_num x)) **: (NUMERAL (BIT0 n)) = ((int_of_num x) **: (NUMERAL (BIT0 n)))`, +((REPEAT GEN_TAC)) +THEN ((ONCE_REWRITE_TAC[INT_POW_NEG1])) +THEN ((ABBREV_TAC `a = int_of_num 1`)) +THEN ((ABBREV_TAC `b = (int_of_num x)**: (NUMERAL (BIT0 n))`)) +THEN ((REWRITE_TAC[NUMERAL;BIT0])) +THEN ((REWRITE_TAC[GSYM MULT_2;GSYM INT_POW_POW;INT_OF_REAL_THM REAL_POW_2;INT_NEG_MUL2])) +THEN ((EXPAND_TAC "a")) +THEN ((REWRITE_TAC[INT_MUL_RID;INT_MUL_LID;INT_OF_REAL_THM REAL_POW_ONE])));; + + + +let POW_MINUS1 = prove( + `!n. (--(&1)) pow (2 * n) = &1`, + INDUCT_TAC THEN REWRITE_TAC[MULT_CLAUSES; pow] THEN + REWRITE_TAC[num_CONV `2`; num_CONV `1`; ADD_CLAUSES] THEN + REWRITE_TAC[pow] THEN + REWRITE_TAC[SYM(num_CONV `2`); SYM(num_CONV `1`)] THEN + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[GSYM REAL_NEG_LMUL; GSYM REAL_NEG_RMUL] THEN + REWRITE_TAC[REAL_MUL_LID; REAL_NEGNEG]);; + + +let POW_1 = prove( + `!x. x pow 1 = x`, + GEN_TAC THEN REWRITE_TAC[num_CONV `1`] THEN + REWRITE_TAC[pow; REAL_MUL_RID]);; + +let INT_POW_ODD_NEG1 = prove( + `!x n. (--: (int_of_num x)) **: (NUMERAL (BIT1 n)) = --: ((int_of_num x) **: (NUMERAL (BIT1 n)))`, +((REPEAT GEN_TAC)) +THEN ((ONCE_REWRITE_TAC[INT_POW_NEG1])) +THEN (((ABBREV_TAC `a = int_of_num 1`))) +THEN (((ABBREV_TAC `b = (int_of_num x)**: (NUMERAL (BIT1 n))`))) +THEN ((REWRITE_TAC[NUMERAL;BIT1])) +THEN ((ONCE_REWRITE_TAC[ADD1])) +THEN ((EXPAND_TAC "a")) +THEN ((REWRITE_TAC[GSYM MULT_2])) +THEN ((REWRITE_TAC[INT_OF_REAL_THM POW_MINUS1;INT_OF_REAL_THM REAL_POW_ADD])) +THEN ((REWRITE_TAC[INT_OF_REAL_THM POW_1;INT_MUL_LID;INT_MUL_LNEG])));; + +(* subtraction of integers *) + +let INT_ADD_NEG = prove( + `!x y. (x < y ==> ((int_of_num x) +: (--: (int_of_num y)) = --: (int_of_num (y - x))))`, +((REPEAT GEN_TAC)) +THEN ((DISCH_TAC)) +THEN ((SUBGOAL_MP_TAC `int_of_num (y-x ) = (int_of_num y) - (int_of_num x)`)) +THENL [((SUBGOAL_MP_TAC `x <=| y`)) + (* branch *) + THENL [(((ASM MESON_TAC)[LE_LT]));((SIMP_TAC[GSYM (INT_OF_REAL_THM REAL_OF_NUM_SUB)]))] +(* branch *) +; ((DISCH_TAC)) +THEN ((ASM_REWRITE_TAC[])) +THEN (ACCEPT_TAC(INT_ARITH `int_of_num x +: --: (int_of_num y) = --: (int_of_num y -: int_of_num x)`))]);; + +let INT_ADD_NEGv2 = prove( + `!x y. (y <= x ==> ((int_of_num x) +: (--: (int_of_num y)) = (int_of_num (x - y))))`, + ((REPEAT GEN_TAC)) + THEN ((DISCH_TAC)) + THEN ((SUBGOAL_MP_TAC `int_of_num (x - y) = (int_of_num x) - (int_of_num y)`)) + THENL[ + ((UNDISCH_EL_TAC 0)) THEN ((SIMP_TAC[GSYM (INT_OF_REAL_THM REAL_OF_NUM_SUB)])); + ((DISCH_TAC)) THEN ((ASM_REWRITE_TAC[INT_SUB])) + ] +);; + + +(* assumes a term of the form int_of_num a +: (--: (int_of_num b)) *) +let INT_SUB_CONV t = + let a,b = dest_binop `int_add` t in + let (_,a) = dest_comb a in + let (_,b) = dest_comb b in + let (_,b) = dest_comb b in + let a = dest_numeral a in + let b = dest_numeral b in + let thm = if (b <=/ a) then + INT_ADD_NEGv2 + else INT_ADD_NEG in + (ARITH_SIMP_CONV[thm]) t;; (* (SIMP_CONV[thm;ARITH]) t;; *) + +let FLOAT_EQ = prove( + `!a b a' b'. (float a b = (float a' b')) <=> + ((float a b) -. (float a' b') = (&.0))`,MESON_TAC[REAL_SUB_0]);; + +let FLOAT_LT = prove( + `!a b a' b'. (float a b <. (float a' b')) <=> + ((&.0) <. (float a' b') -. (float a b))`,MESON_TAC[REAL_SUB_LT]);; + +let FLOAT_LE = prove( + `!a b a' b'. (float a b <=. (float a' b')) <=> + ((&.0) <=. (float a' b') -. (float a b))`,MESON_TAC[REAL_SUB_LE]);; + +(* ------------------------------------------------------------------ *) +(* Simplifies an arithmetic expression in floats *) +(* A workhorse *) +(* ------------------------------------------------------------------ *) + +let FLOAT_CONV = + (ARITH_SIMP_CONV[FLOAT_LT;FLOAT_LE;FLOAT_MUL;FLOAT_SUB;FLOAT_ABS;FLOAT_POW; + FLOAT_ADD_NN;FLOAT_ADD_NNv2;FLOAT_ADD_PP;FLOAT_ADD_PPv2; + FLOAT_ADD_NP;FLOAT_ADD_PN;FLOAT_NEG; + INT_NEG_NEG;INT_SUB; + INT_ABS_NUM;INT_ABS_NEG_NUM; + INT_MUL_LNEG;INT_MUL_RNEG;INT_NEG_MUL2;INT_OF_NUM_MUL; + INT_OF_NUM_ADD;GSYM INT_NEG_ADD;INT_ADD_NEG_NUM; + INT_OF_NUM_POW;INT_POW_ODD_NEG1;INT_POW_EVEN_NEG1; + INT_ADD_NEG;INT_ADD_NEGv2 (* ; ARITH *) + ]) ;; + +add_test("FLOAT_CONV1", + let f z = + let (x,y) = dest_eq z in + let (u,v) = dest_thm (FLOAT_CONV x) in + (u=[]) && (z = v) in + f `float (int_of_num 3) (int_of_num 0) = float (int_of_num 3) (int_of_num 0)` && + f `float (int_of_num 3) (int_of_num 3) = float (int_of_num 3) (int_of_num 3)` && + f `float (int_of_num 3) (int_of_num 0) +. (float (int_of_num 4) (int_of_num 0)) = (float (int_of_num 7) (int_of_num 0))` && + f `float (int_of_num 1 + (int_of_num 3)) (int_of_num 4) = float (int_of_num 4) (int_of_num 4)` && + f `float (int_of_num 3 - (int_of_num 7)) (int_of_num 0) = float (--:(int_of_num 4)) (int_of_num 0)` && + f `float (int_of_num 3) (int_of_num 4) *. (float (--: (int_of_num 2)) (int_of_num 3)) = float (--: (int_of_num 6)) + (int_of_num 7)` && + f `real_neg (float (--: (int_of_num 3)) (int_of_num 0)) = float (int_of_num 3) (int_of_num 0)` + );; + +(* ------------------------------------------------------------------ *) +(* Operations on interval_eps. Preliminary stuff to deal with *) +(* chains of inequalities. *) +(* ------------------------------------------------------------------ *) + + +let REAL_ADD_LE_SUBST_RHS = prove( + `!a b c P. ((a <=. ((P b)) /\ (!x. (P x) = x + (P (&. 0))) /\ (b <=. c)) ==> (a <=. (P c)))`, +(((REPEAT GEN_TAC))) +THEN (((REPEAT (TAUT_TAC `(b ==> a==> c) ==> (a /\ b ==> c)`)))) +THEN (((REPEAT DISCH_TAC))) +THEN ((((H_RULER(ONCE_REWRITE_RULE))[HYP_INT 1] (HYP_INT 0)))) +THEN ((((ASM ONCE_REWRITE_TAC)[]))) +THEN ((((ASM MESON_TAC)[REAL_LE_RADD;REAL_LE_TRANS]))));; + +let REAL_ADD_LE_SUBST_LHS = prove( + `!a b c P. (((P(a) <=. b /\ (!x. (P x) = x + (P (&. 0))) /\ (c <=. a))) + ==> ((P c) <=. b))`, +(REP_GEN_TAC) +THEN (DISCH_ALL_TAC) +THEN (((H_RULER(ONCE_REWRITE_RULE)) [HYP_INT 1] (HYP_INT 0))) +THEN (((ASM ONCE_REWRITE_TAC)[])) +THEN (((ASM MESON_TAC)[REAL_LE_RADD;REAL_LE_TRANS])));; +(* +let rec SPECL = + function [] -> I | + (a::b) -> fun thm ->(SPECL b (SPEC a thm));; +*) +(* + input: + rel: b <=. c + thm: a <=. P(b). + + output: a <=. P(c). + + condition: REAL_ARITH must be able to prove !x. P(x) = x+. P(&.0). + condition: the term `a` must appear exactly once the lhs of the thm. + *) + +let IWRITE_REAL_LE_RHS rel thm = + let bvar = genvar `:real` in + let (bt,_) = dest_binop `real_le` (concl rel) in + let sub = SUBS_CONV[ASSUME (mk_eq(bt,bvar))] in + let rule = (fun th -> EQ_MP (sub (concl th)) th) in + let (subrel,subthm) = (rule rel,rule thm) in + let (a,p) = dest_binop `real_le` (concl subthm) in + let (_,c) = dest_binop `real_le` (concl subrel) in + let pfn = mk_abs (bvar,p) in + let imp_th = BETA_RULE (SPECL [a;bvar;c;pfn] REAL_ADD_LE_SUBST_RHS) in + let ppart = REAL_ARITH + (fst(dest_conj(snd(dest_conj(fst(dest_imp(concl imp_th))))))) in + let prethm = MATCH_MP imp_th (CONJ subthm (CONJ ppart subrel)) in + let prethm2 = SPEC bt (GEN bvar (DISCH + (find (fun x -> try(bvar = rhs x) with Failure _ -> false) (hyp prethm)) prethm)) in + MATCH_MP prethm2 (REFL bt);; + +(* + input: + rel: c <=. a + thm: P a <=. b + + output: P c <=. b + + condition: REAL_ARITH must be able to prove !x. P(x) = x+. P(&.0). + condition: the term `a` must appear exactly once the lhs of the thm. + *) + +let IWRITE_REAL_LE_LHS rel thm = + let avar = genvar `:real` in + let (_,at) = dest_binop `real_le` (concl rel) in + let sub = SUBS_CONV[ASSUME (mk_eq(at,avar))] in + let rule = (fun th -> EQ_MP (sub (concl th)) th) in + let (subrel,subthm) = (rule rel,rule thm) in + let (p,b) = dest_binop `real_le` (concl subthm) in + let (c,_) = dest_binop `real_le` (concl subrel) in + let pfn = mk_abs (avar,p) in + let imp_th = BETA_RULE (SPECL [avar;b;c;pfn] REAL_ADD_LE_SUBST_LHS) in + let ppart = REAL_ARITH + (fst(dest_conj(snd(dest_conj(fst(dest_imp(concl imp_th))))))) in + let prethm = MATCH_MP imp_th (CONJ subthm (CONJ ppart subrel)) in + let prethm2 = SPEC at (GEN avar (DISCH + (find (fun x -> try(avar = rhs x) with Failure _ -> false) (hyp prethm)) prethm)) in + MATCH_MP prethm2 (REFL at);; + +(* ------------------------------------------------------------------ *) +(* INTERVAL ADD, NEG, SUBTRACT *) +(* ------------------------------------------------------------------ *) + + + +let INTERVAL_ADD = prove( + `!x f ex y g ey. interval_eps x f ex /\ interval_eps y g ey ==> + interval_eps (x +. y) (f +. g) (ex +. ey)`, +EVERY[ + REPEAT GEN_TAC; + TAUT_TAC `(A==>B==>C)==>(A/\ B ==> C)`; + REWRITE_TAC[interval_eps]; + REWRITE_TAC[prove(`(x+.y) -. (f+.g) = (x-.f) +. (y-.g)`,REAL_ARITH_TAC)]; + ABBREV_TAC `a = x-.f`; + ABBREV_TAC `b = y-.g`; + ASSUME_TAC (SPEC `b:real` (SPEC `a:real` ABS_TRIANGLE)); + UNDISCH_EL_TAC 0; + ABBREV_TAC `a':real = abs a`; + ABBREV_TAC `b':real = abs b`; + REPEAT DISCH_TAC; + (H_VAL2(IWRITE_REAL_LE_RHS)) (HYP_INT 0) (HYP_INT 2); + (H_VAL2(IWRITE_REAL_LE_RHS)) (HYP_INT 2) (HYP_INT 0); + ASM_REWRITE_TAC[]]);; + +let INTERVAL_NEG = prove( + `!x f ex. interval_eps x f ex = interval_eps (real_neg x) (real_neg f) ex`, +(REWRITE_TAC[interval_eps;REAL_ABS_NEG;REAL_ARITH `!x y. -- x -. (-- y) = real_neg (x -. y)`]));; + +let INTERVAL_NEG2 = prove( + `!x f ex. interval_eps (real_neg x) f ex = interval_eps x (real_neg f) ex`, + (REWRITE_TAC[interval_eps;REAL_ABS_NEG;REAL_ARITH `!x y. -- x -. y = real_neg (x -. (real_neg y))`]));; + + +let INTERVAL_SUB = prove( + `!x f ex y g ey. interval_eps x f ex /\ interval_eps y g ey ==> interval_eps (x -. y) (f -. g) (ex +. ey)`, +((REWRITE_TAC[real_sub])) +THEN (DISCH_ALL_TAC) +THEN (((H_RULER (ONCE_REWRITE_RULE))[THM(INTERVAL_NEG)] (HYP_INT 1))) +THEN (((ASM MESON_TAC)[INTERVAL_ADD])));; + +(* ------------------------------------------------------------------ *) +(* INTERVAL MULTIPLICATION *) +(* ------------------------------------------------------------------ *) + + + +(* renamed from REAL_LE_ABS_RMUL *) +let REAL_PROP_LE_RABS = prove( + `!x y z. (y <=. z) ==> ( y * (abs x) <=. z *(abs x))`,(SIMP_TAC[REAL_LE_RMUL_IMP;ABS_POS]));; + +let REAL_LE_ABS_MUL = prove( + `!x y z w. (( x <=. y) /\ (abs z <=. w)) ==> (x*.w <=. y*.w) `, +(DISCH_ALL_TAC) +THEN ((ASSUME_TAC (REAL_ARITH `abs z <=. w ==> (&.0) <=. w`))) +THEN (((ASM MESON_TAC)[REAL_LE_RMUL_IMP])));; + +let ABS_MUL = REAL_ABS_MUL;; + +let INTERVAL_ABS = REAL_ARITH + `!(x:real) z d. (x - d) <= z /\ z <= (x + d) <=> abs(z - x) <= d`;; + +let INTERVAL_MUL = prove( + `!x f ex y g ey. (interval_eps x f ex) /\ (interval_eps y g ey) ==> + (interval_eps (x *. y) (f *. g) (abs(f)*.ey +. ex*. abs(g) +. ex*.ey))`, +(REP_GEN_TAC) +THEN ((REWRITE_TAC[interval_eps])) +THEN ((REWRITE_TAC[REAL_ARITH `(x*. y -. f*. g) = (f *.(y -. g) +. (x -. f)*.g +. (x-.f)*.(y-. g))`])) +THEN (DISCH_ALL_TAC) +THEN ((ASSUME_TAC (SPECL [`f*.(y-g)`;`(x-f)*g +. (x-f)*.(y-g)`] ABS_TRIANGLE))) +THEN ((ASSUME_TAC (SPECL [`(x-f)*.g`;`(x-f)*.(y-g)`] ABS_TRIANGLE))) +THEN (((H_VAL2(IWRITE_REAL_LE_RHS)) (HYP_INT 0) (HYP_INT 1))) +THEN ((H_REWRITE_RULE [THM ABS_MUL] (HYP_INT 0))) +THEN ((H_MATCH_MP (THM (SPECL [`g:real`; `abs (x -. f)`; `ex:real`] REAL_PROP_LE_RABS)) (HYP_INT 4))) +THEN (((H_VAL2(IWRITE_REAL_LE_RHS)) (HYP_INT 0) (HYP_INT 1))) +THEN ((H_MATCH_MP (THM (SPECL [`f:real`; `abs (y -. g)`; `ey:real`] REAL_PROP_LE_LABS)) (HYP_INT 7))) +THEN (((H_VAL2 (IWRITE_REAL_LE_RHS)) (HYP_INT 0) (HYP_INT 1))) +THEN ((H_MATCH_MP (THM (SPECL [`x-.f`; `abs (y -. g)`; `ey:real`] REAL_PROP_LE_LABS)) (HYP_INT 9))) +THEN (((H_VAL2(IWRITE_REAL_LE_RHS)) (HYP_INT 0) (HYP_INT 1))) +THEN ((ASSUME_TAC (SPECL [`abs(x-.f)`;`ex:real`;`y-.g`;`ey:real`] REAL_LE_ABS_MUL))) +THEN ((H_CONJ (HYP_INT 11) (HYP_INT 12))) +THEN ((H_MATCH_MP (HYP_INT 1) (HYP_INT 0))) +THEN (((H_VAL2(IWRITE_REAL_LE_RHS)) (HYP_INT 0) (HYP_INT 3))) +THEN ((POP_ASSUM ACCEPT_TAC)));; + +(* ------------------------------------------------------------------ *) +(* INTERVAL BASIC OPERATIONS *) +(* ------------------------------------------------------------------ *) + + +let INTERVAL_NUM = prove( + `!n. (interval_eps(&.n) (float(int_of_num n) (int_of_num 0)) (float (int_of_num 0) (int_of_num 0)))`, +(REWRITE_TAC[interval_eps;float;TWOPOW_POS;pow;REAL_MUL_RID;INT_NUM_REAL;REAL_SUB_REFL;REAL_ABS_0;REAL_LE_REFL]));; + +let INTERVAL_CENTER = prove( + `!x f ex g. (interval_eps x f ex) ==> (interval_eps x g (abs(f-g)+.ex))`, +((REWRITE_TAC[interval_eps])) +THEN (DISCH_ALL_TAC) +THEN ((ASSUME_TAC (REAL_ARITH `abs(x -. g) <=. abs(f-.g) +. abs(x -. f)`))) +THEN ((H_VAL2 IWRITE_REAL_LE_RHS (HYP_INT 1) (HYP_INT 0))) +THEN ((ASM_REWRITE_TAC[])));; + +let INTERVAL_WIDTH = prove( + `!x f ex ex'. (ex <=. ex') ==> (interval_eps x f ex) ==> (interval_eps x f ex')`, +((REWRITE_TAC[interval_eps])) +THEN (DISCH_ALL_TAC) +THEN ((H_VAL2 IWRITE_REAL_LE_RHS (HYP_INT 1) (HYP_INT 0))) +THEN ((ASM_REWRITE_TAC[])));; + +let INTERVAL_MAX = prove( + `!x f ex. interval_eps x f ex ==> (x <=. f+.ex)`, +(REWRITE_TAC[interval_eps]) THEN REAL_ARITH_TAC);; + +let INTERVAL_MIN = prove( + `!x f ex. interval_eps x f ex ==> (f-. ex <=. x)`, +(REWRITE_TAC[interval_eps]) THEN REAL_ARITH_TAC);; + +let INTERVAL_ABS_MIN = prove( + `!x f ex. interval_eps x f ex ==> (abs(f)-. ex <=. abs(x))`, + (REWRITE_TAC[interval_eps] THEN REAL_ARITH_TAC) +);; + +let INTERVAL_ABS_MAX = prove( + `!x f ex. interval_eps x f ex ==> (abs(x) <=. abs(f)+. ex)`, + (REWRITE_TAC[interval_eps] THEN REAL_ARITH_TAC) +);; + +let REAL_RINV_2 = prove( + `&.2 *. (inv (&.2 )) = &. 1`, +EVERY[ + MATCH_MP_TAC REAL_MUL_RINV; + REAL_ARITH_TAC]);; + +let INTERVAL_MK = prove( + `let half = float(int_of_num 1)(--:(int_of_num 1)) in + !x xmin xmax. ((xmin <=. x) /\ (x <=. xmax)) ==> + interval_eps x + ((xmin+.xmax)*.half) + ((xmax-.xmin)*.half)`, +EVERY[ + REWRITE_TAC[LET_DEF;LET_END_DEF]; + DISCH_ALL_TAC; + REWRITE_TAC[interval_eps;float;TWOPOW_NEG;INT_NUM_REAL;REAL_POW_1;REAL_MUL_LID]; + REWRITE_TAC[GSYM INTERVAL_ABS]; + CONJ_TAC + ] +THENL[ + EVERY[ + REWRITE_TAC[GSYM REAL_SUB_RDISTRIB]; + REWRITE_TAC[REAL_ARITH `(b+.a)-.(a-.b)=b*.(&.2)`;GSYM REAL_MUL_ASSOC]; + ASM_REWRITE_TAC[REAL_RINV_2;REAL_MUL_RID] + ]; + EVERY[ + REWRITE_TAC[GSYM REAL_ADD_RDISTRIB]; + REWRITE_TAC[REAL_ARITH `(b+.a)+. a -. b=a*.(&.2)`;GSYM REAL_MUL_ASSOC]; + ASM_REWRITE_TAC[REAL_RINV_2;REAL_MUL_RID] + ] +]);; + +let INTERVAL_EPS_POS = prove(`!x f ex. + (interval_eps x f ex) ==> (&.0 <=. ex)`, +EVERY[ + REWRITE_TAC[interval_eps]; + REPEAT (GEN_TAC); + DISCH_THEN(fun x -> (MP_TAC (CONJ (SPEC `x-.f` REAL_ABS_POS) x))); + MATCH_ACCEPT_TAC REAL_LE_TRANS]);; + +let INTERVAL_EPS_0 = prove( + `!x f n. (interval_eps x f (float (int_of_num 0) n)) ==> (x = f)`, +EVERY[ + REWRITE_TAC[interval_eps;float;int_of_num_th;REAL_MUL_LZERO]; + REAL_ARITH_TAC]);; + +let REAL_EQ_RCANCEL_IMP' = prove(`!x y z.(x * z = y * z) ==> (~(z = &0) ==> (x=y))`, + MESON_TAC[REAL_EQ_RCANCEL_IMP]);; + +(* renamed from REAL_ABS_POS *) +let REAL_MK_POS_ABS_' = prove (`!x. (~(x=(&.0))) ==> (&.0 < abs(x))`, + MESON_TAC[REAL_PROP_NZ_ABS;ABS_POS;REAL_LT_LE]);; + +(* ------------------------------------------------------------------ *) +(* INTERVAL DIVIDE *) +(* ------------------------------------------------------------------ *) + +let INTERVAL_DIV = prove(`!x f ex y g ey h ez. + (((interval_eps x f ex) /\ (interval_eps y g ey) /\ (ey <. (abs g)) /\ + ((ex +. (abs (f -. (h*.g))) +. (abs h)*. ey) <=. (ez*.((abs g) -. ey)))) + ==> (interval_eps (x / y) h ez))`, +let lemma1 = prove( `&.0 < u /\ real_abs z <=. e*. u ==> (&.0) <=. e`, + EVERY[ + DISCH_ALL_TAC; + ASSUME_TAC (SPEC `z:real` REAL_MK_NN_ABS); + H_MATCH_MP (THM REAL_LE_TRANS) (H_RULE2 CONJ (HYP_INT 0) (HYP_INT 2)); + H_MATCH_MP (THM REAL_PROP_NN_RCANCEL) (H_RULE2 CONJ (HYP_INT 2) (HYP_INT 0)); + ASM_REWRITE_TAC[] + ]) in +EVERY[ + DISCH_ALL_TAC; + SUBGOAL_MP_TAC `~(y= (&.0))` + THENL[ + EVERY[ + UNDISCH_LIST[1;2]; + REWRITE_TAC[interval_eps]; + REAL_ARITH_TAC + ]; + EVERY[ + REWRITE_TAC[interval_eps]; + DISCH_TAC THEN (H I (HYP_INT 0)) THEN (UNDISCH_EL_TAC 0); + DISCH_THEN (fun th -> (MP_TAC(MATCH_MP REAL_MK_POS_ABS_' th))); + MATCH_MP_TAC REAL_MUL_RTIMES_LE; + REWRITE_TAC[GSYM ABS_MUL;REAL_SUB_RDISTRIB;real_div;GSYM REAL_MUL_ASSOC]; + ASM_SIMP_TAC[REAL_MUL_LINV;REAL_MUL_RID]; + H (REWRITE_RULE[interval_eps]) (HYP_INT 1); + H (REWRITE_RULE[interval_eps]) (HYP_INT 3); + H (MATCH_MP INTERVAL_ABS_MIN) (HYP_INT 4); + POPL_TAC[3;4;5]; + H_VAL2 (IWRITE_REAL_LE_LHS) (HYP_INT 2) (HYP_INT 4); + H (REWRITE_RULE[ REAL_ADD_ASSOC]) (HYP_INT 0); + H_VAL2 (IWRITE_REAL_LE_LHS) (THM (SPEC `f-. h*g` (SPEC `x-.f` ABS_TRIANGLE))) (HYP_INT 0); + H (ONCE_REWRITE_RULE[REAL_ABS_SUB]) (HYP_INT 4); + H (MATCH_MP (SPEC `h:real` REAL_PROP_LE_LABS)) (HYP_INT 0); + H (REWRITE_RULE[GSYM ABS_MUL]) (HYP_INT 0); + H_VAL2 (IWRITE_REAL_LE_LHS) (HYP_INT 0) (HYP_INT 3); + H_VAL2 (IWRITE_REAL_LE_LHS) (THM (SPEC `h*.(g-.y)` (SPEC`(x-.f)+(f-. h*g)` ABS_TRIANGLE))) (HYP_INT 0); + POPL_TAC[1;2;3;4;5;6;7;9;10;12]; + H (ONCE_REWRITE_RULE[REAL_ARITH `((x-.f) +. (f -. h*. g)) +. h*.(g-. y) = x -. h*. y `]) (HYP_INT 0); + ABBREV_TAC `z = x -. h*.y`; + H (ONCE_REWRITE_RULE[GSYM REAL_SUB_LT]) (HYP_INT 4); + ABBREV_TAC `u = abs(g) -. ey`; + POPL_TAC[0;2;4;6]; + H (MATCH_MP lemma1 ) (H_RULE2 CONJ (HYP_INT 0) (HYP_INT 1)); + H (MATCH_MP REAL_PROP_LE_LMUL) (H_RULE2 CONJ (HYP_INT 0) (HYP_INT 3)); + H (MATCH_MP REAL_LE_TRANS) (H_RULE2 CONJ (HYP_INT 3) (HYP_INT 0)); + ASM_REWRITE_TAC[] + ]; + ]]);; + +(* ------------------------------------------------------------------ *) +(* INTERVAL ABS VALUE *) +(* ------------------------------------------------------------------ *) + +let INTERVAL_ABSV = prove(`!x f ex. interval_eps x f ex ==> (interval_eps (abs x) (abs f) ex)`, +EVERY[ + REWRITE_TAC[interval_eps]; + DISCH_ALL_TAC; + ASSUME_TAC (SPECL [`x:real`;`f:real`] REAL_ABS_SUB_ABS); + ASM_MESON_TAC[REAL_LE_TRANS] +]);; (* 7 minutes *) + +(* ------------------------------------------------------------------ *) +(* INTERVAL ATN VALUE *) +(* ------------------------------------------------------------------ *) + +let taylor_atn = prove_by_refinement( + `!n x v eps2 eps. + interval_eps (&16 * sum (0..n) (halfatn4_co x)) v eps2 /\ + float (int_of_num 1) ( -- int_of_num (6 * n + 5)) + eps2 <= eps ==> + interval_eps (atn x) v eps`, + (* {{{ proof *) + [ + REWRITE_TAC[interval_eps;float;TWOPOW_NEG;int_of_num_th;REAL_ARITH `&1 * x = x`]; + REPEAT STRIP_TAC; + MATCH_MP_TAC real_taylor_atn_approx; + EXISTS_TAC `n:num`; + EXISTS_TAC `inv(&2 pow (6 * n +5))`; + EXISTS_TAC `eps2:real`; + ASM_REWRITE_TAC[]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let pi_atn = prove_by_refinement( + `pi = &4 * atn (&1)`, + (* {{{ proof *) + [ + REWRITE_TAC[ATN_1]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + + +(* ------------------------------------------------------------------ *) +(* INTERVAL SQRT *) +(* This requires some preliminaries. Extend sqrt by 0 on negatives *) +(* ------------------------------------------------------------------ *) + +let ssqrt = new_definition `ssqrt x = if (x <. (&.0)) then (&.0) else sqrt x`;; (*2m*) + +let ssqrt_sqrt = prove_by_refinement( + `!x u f. &0 < x /\ interval_eps (ssqrt x) u f ==> + interval_eps (sqrt x) u f`, + (* {{{ proof *) + [ + REWRITE_TAC[ssqrt]; + MESON_TAC[REAL_ARITH `&0 < x ==> ~(x < &0)`]; + ]);; + (* }}} *) + +let LET_TAC = REWRITE_TAC[LET_DEF;LET_END_DEF];; + + +let REAL_SSQRT_NEG = prove(`!x. (x <. (&.0)) ==> (ssqrt x = (&.0))`, + EVERY[ + DISCH_ALL_TAC; + REWRITE_TAC[ssqrt]; + COND_CASES_TAC + THENL[ + ACCEPT_TAC (REFL `&.0`); + ASM_MESON_TAC[] + ] + ]);; +(* 5 min*) + +let REAL_SSQRT_NN = prove(`!x. (&.0) <=. x ==> (ssqrt x = (sqrt x))`, + EVERY[ + DISCH_ALL_TAC; + REWRITE_TAC[ssqrt]; + COND_CASES_TAC + THENL[ + ASM_MESON_TAC[real_lt]; + ACCEPT_TAC (REFL `sqrt x`) + ] + ]);; (* 12 min, mostly spent loading *index-shell* *) + + +(*17 minutes*) +let REAL_MK_NN_SSQRT = prove(`!x. (&.0) <=. (ssqrt x)`, + EVERY[ + GEN_TAC; + DISJ_CASES_TAC (SPECL[`x:real`;`&.0`] REAL_LTE_TOTAL) + THENL[ + POP_ASSUM (fun th -> MP_TAC(MATCH_MP (REAL_SSQRT_NEG) th)) THEN + MESON_TAC[REAL_LE_REFL]; + POP_ASSUM (fun th -> ASSUME_TAC(CONJ th (MATCH_MP (REAL_SSQRT_NN) th))) THEN + ASM_MESON_TAC[REAL_PROP_NN_SQRT] + ] + ]);; + +let REAL_SV_SSQRT_0 = prove(`!x. ssqrt (&.0) = (&.0)`, + EVERY[ + GEN_TAC; + MP_TAC (SPEC `&.0` REAL_LE_REFL); + DISCH_THEN(fun th -> REWRITE_TAC[MATCH_MP REAL_SSQRT_NN th]); + ACCEPT_TAC REAL_SV_SQRT_0 + ]);; (* 6 minutes *) + + +let REAL_SV_SSQRT_n = prove_by_refinement(`!n. ssqrt (&n) = sqrt(&n)`, +[ + GEN_TAC; + MATCH_MP_TAC REAL_SSQRT_NN; + REAL_ARITH_TAC; + ]);; + + +let REAL_SSQRT_EQ_0 = prove(`!(x:real). (ssqrt(x) = (&.0)) ==> (x <=. (&.0))`, + EVERY[ + GEN_TAC; + DISJ_CASES_TAC (SPECL[`x:real`;`&.0`] REAL_LTE_TOTAL) + THENL[ + ASM_MESON_TAC[REAL_LT_IMP_LE]; + ASM_SIMP_TAC[REAL_SSQRT_NN] THEN + ASM_MESON_TAC[SQRT_EQ_0;REAL_EQ_IMP_LE] + ] + ]);; (* 15 minutes *) + + +let REAL_SSQRT_MONO = prove(`!x. (x<=. y) ==> (ssqrt x <=. (ssqrt y))`, + EVERY[ + GEN_TAC; + DISJ_CASES_TAC (SPECL[`x:real`;`&.0`] REAL_LTE_TOTAL) + THENL[ + ASM_MESON_TAC[REAL_SSQRT_NEG;REAL_MK_NN_SSQRT]; + ASM_MESON_TAC[REAL_LE_TRANS;REAL_SSQRT_NN;REAL_PROP_LE_SQRT]; + ] + ]);; (* 5 minutes *) + +let REAL_SSQRT_CHAR = prove(`!x t. (&.0 <=. t /\ (t*t = x)) ==> (t = (ssqrt x))`, + EVERY[ + DISCH_ALL_TAC; + H_ASSUME_TAC (H_RULE_LIST REWRITE_RULE[HYP_INT 1] (THM (SPEC `t:real` REAL_MK_NN_SQUARE))); + ASM_MESON_TAC[REAL_SSQRT_NN;SQRT_MUL;POW_2_SQRT_ABS;REAL_POW_2;REAL_ABS_REFL]; + ]);; (* 13 minutes *) + +let REAL_SSQRT_SQUARE = prove(`!x. (&.0 <=. x) ==> ((ssqrt x)*.(ssqrt x) = x)`, + MESON_TAC[REAL_SSQRT_NN;POW_2;SQRT_POW_2]);;(* 7min *) + +let REAL_SSQRT_SQUARE' = prove(`!x. (&.0<=. x) ==> (ssqrt (x*.x) = x)`, + DISCH_ALL_TAC THEN + REWRITE_TAC[(MATCH_MP REAL_SSQRT_NN (SPEC `x:real` REAL_MK_NN_SQUARE))] THEN + ASM_SIMP_TAC[SQRT_MUL;GSYM POW_2;SQRT_POW_2]);; (*20min*) + + +(* an alternate proof appears in RCS *) +let INTERVAL_SSQRT = prove(`!x f ex u ey ez v. (interval_eps x f ex) /\ (interval_eps (u*.u) f ey) /\ + (ex +.ey <=. ez*.(v+.u)) /\ (v*.v <=. f-.ex) /\ (&.0 <. u) /\ (&.0 <=. v) ==> + (interval_eps (ssqrt x) u ez)`, +EVERY[ + DISCH_ALL_TAC; + H (MATCH_MP REAL_LE_TRANS) (H_RULE2 CONJ (THM (SPEC `v:real` REAL_MK_NN_SQUARE)) (HYP_INT 3)); + H (MATCH_MP (INTERVAL_MIN)) (HYP_INT 1); + H (MATCH_MP REAL_LE_TRANS) (H_RULE2 CONJ (HYP_INT 1) (HYP_INT 0)); + H (MATCH_MP INTERVAL_EPS_POS) (HYP_INT 3); + H (MATCH_MP INTERVAL_EPS_POS) (HYP_INT 5); + H (MATCH_MP REAL_PROP_NN_ADD2) (H_RULE2 CONJ (HYP_INT 1) (HYP_INT 0)); + H (MATCH_MP REAL_PROP_POS_LADD) (H_RULE2 CONJ (HYP_INT 11) (HYP_INT 10)); + H (MATCH_MP REAL_PROP_POS_LADD) (H_RULE2 CONJ (THM (SPEC `x:real` REAL_MK_NN_SSQRT)) (HYP_INT 11)); + H (MATCH_MP REAL_PROP_POS_INV) (HYP_INT 0); + ASSUME_TAC (REAL_ARITH `(ssqrt x -. u) = (ssqrt x -. u)*.(&.1)`); + H (MATCH_MP REAL_MK_NZ_POS) (HYP_INT 2); + H (MATCH_MP REAL_MUL_RINV) (HYP_INT 0); + H_REWRITE_RULE[(H_RULE GSYM) (HYP_INT 0)] (HYP_INT 2); + POPL_TAC[1;2;3]; + H (REWRITE_RULE[REAL_MUL_ASSOC]) (HYP_INT 0); + H (REWRITE_RULE[ONCE_REWRITE_RULE[REAL_MUL_SYM] REAL_DIFFSQ]) (HYP_INT 0); + POPL_TAC[1;2]; + H_SIMP_RULE[HYP_INT 7;THM REAL_SSQRT_SQUARE] (HYP_INT 0); + ASSUME_TAC (REAL_ARITH `abs(x -. u*.u) <=. abs(x -. f) + abs(f-. u*.u)`); + H (REWRITE_RULE[interval_eps]) (HYP_INT 12); + H (ONCE_REWRITE_RULE[interval_eps]) (HYP_INT 14); + H (ONCE_REWRITE_RULE[REAL_ABS_SUB]) (HYP_INT 0); + POPL_TAC[1;5;15;16]; + H (MATCH_MP REAL_LE_ADD2) (H_RULE2 CONJ (HYP_INT 1) (HYP_INT 0)); + H (MATCH_MP REAL_LE_TRANS) (H_RULE2 CONJ (HYP_INT 3) (HYP_INT 0)); + POPL_TAC[1;2;3;4]; + H (AP_TERM `real_abs `) (HYP_INT 1); + H (REWRITE_RULE[ABS_MUL]) (HYP_INT 0); + H (MATCH_MP REAL_LT_IMP_LE) (HYP_INT 4); + H (REWRITE_RULE[GSYM REAL_ABS_REFL]) (HYP_INT 0); + H_REWRITE_RULE [HYP_INT 0] (HYP_INT 2); + H (MATCH_MP REAL_LE_RMUL) (H_RULE2 CONJ (HYP_INT 5) (HYP_INT 2)); + H_REWRITE_RULE [H_RULE GSYM (HYP_INT 1)] (HYP_INT 0); + POPL_TAC[1;2;3;5;6;7;8]; + H (MATCH_MP REAL_LE_TRANS) (H_RULE2 CONJ (HYP_INT 12) (HYP_INT 9)); + H (MATCH_MP REAL_SSQRT_MONO) (HYP_INT 0); + H (MATCH_MP REAL_SSQRT_SQUARE') (HYP_INT 16); + H_REWRITE_RULE [HYP_INT 0] (HYP_INT 1); + H (ONCE_REWRITE_RULE[GSYM (SPECL[`v:real`;`ssqrt x`;`u:real`] REAL_LE_RADD)]) (HYP_INT 0); + H (MATCH_MP REAL_LE_INV2) (H_RULE2 CONJ (HYP_INT 9) (HYP_INT 0)); + POPL_TAC[1;2;3;4;5;7;8;9;12;13]; + H (MATCH_MP REAL_LE_LMUL) (H_RULE2 CONJ (HYP_INT 3) (HYP_INT 0)); + H (MATCH_MP REAL_LE_TRANS) (H_RULE2 CONJ (HYP_INT 2) (HYP_INT 0)); + H (MATCH_MP REAL_PROP_POS_INV) (HYP_INT 4); + H (MATCH_MP REAL_LT_IMP_LE) (HYP_INT 0); + H (MATCH_MP REAL_LE_RMUL) (H_RULE2 CONJ (HYP_INT 11) (HYP_INT 0)); + H (REWRITE_RULE[GSYM REAL_MUL_ASSOC]) (HYP_INT 0); + H (MATCH_MP REAL_MK_NZ_POS) (HYP_INT 8); + H (MATCH_MP REAL_MUL_RINV) (HYP_INT 0); + H_REWRITE_RULE[HYP_INT 0; THM REAL_MUL_RID] (HYP_INT 2); + H (MATCH_MP REAL_LE_TRANS) (H_RULE2 CONJ (HYP_INT 7) (HYP_INT 0)); + ASM_REWRITE_TAC[interval_eps] + ]);; + + + +test();; + + +(* conversion for interval_eps *) + +(* ------------------------------------------------------------------ *) +(* Take a term x of type real. Convert to a thm of the form *) +(* interval_eps x f eps *) +(* *) +(* ------------------------------------------------------------------ *) + +let add_test,test = new_test_suite();; + +(* ------------------------------------------------------------------ *) +(* num_exponent + Take the absolute value of input. + Write it as a*2^k, where 1 <= a < 2, return k. + + Except: + num_exponent (Int 0) is -1. +*) +let (num_exponent:Num.num -> Num.num) = + fun a -> + let afloat = float_of_num (abs_num a) in + Int ((snd (frexp afloat)) - 1);; + +(*test*)let f (u,v) = ((num_exponent u) =(Int v)) in + add_test("num_exponenwt", + forall f + [Int 1,0; Int 65,6; Int (-65),6; + Int 0,-1; (Int 3)//(Int 4),-1]);; +(* ------------------------------------------------------------------ *) + +let dest_unary op tm = + try let xop,r = dest_comb tm in + if xop = op then r else fail() + with Failure _ -> failwith "dest_unary";; + + +(* ------------------------------------------------------------------ *) + + +(* finds a nearby (outward-rounded) Int with only prec_b significant bits *) +let (round_outward: int -> Num.num -> Num.num) = + fun prec_b a -> + let b = abs_num a in + let sign = if (a =/ b) then I else minus_num in + let throw_bits = Num.max_num (Int 0) ((num_exponent b)-/ (Int prec_b)) in + let twoexp = power_num (Int 2) throw_bits in + (sign (ceiling_num (b // twoexp)))*/twoexp;; + +let (round_inward: int-> Num.num -> Num.num) = + fun prec_b a -> + let b = abs_num a in + let sign = if (a=/b) then I else minus_num in + let throw_bits = Num.max_num (Int 0) ((num_exponent b)-/ (Int prec_b)) in + let twoexp = power_num (Int 2) throw_bits in + (sign (floor_num (b // twoexp)))*/twoexp;; + +let round_rat bprec n = + let b = abs_num n in + let sign = if (b =/ n) then I else minus_num in + let powt = ((Int 2) **/ (Int bprec)) in + sign ((round_outward bprec (Num.ceiling_num (b */ powt)))//powt);; + +let round_inward_rat bprec n = + let b = abs_num n in + let sign = if (b =/ n) then I else minus_num in + let powt = ((Int 2) **/ (Int bprec)) in + sign ((round_inward bprec (Num.floor_num (b */ powt)))//powt);; + +let (round_outward_float: int -> float -> Num.num) = + fun bprec f -> + if (f=0.0) then (Int 0) else + begin + let b = abs_float f in + let sign = if (f >= 0.0) then I else minus_num in + let (x,n) = frexp b in + let u = int_of_float( ceil (ldexp x bprec)) in + sign ((Int u)*/ ((Int 2) **/ (Int (n - bprec)))) + end;; + +let (round_inward_float: int -> float -> Num.num) = + fun bprec f -> + if (f=0.0) then (Int 0) else + begin + (* avoid overflow on 30 bit integers *) + let bprec = if (bprec > 25) then 25 else bprec in + let b = abs_float f in + let sign = if (f >= 0.0) then I else minus_num in + let (x,n) = frexp b in + let u = int_of_float( floor (ldexp x bprec)) in + sign ((Int u)*/ ((Int 2) **/ (Int (n - bprec)))) + end;; + +(* ------------------------------------------------------------------ *) + +(* This doesn't belong here. A general term substitution function *) +let SUBST_TERM sublist tm = + rhs (concl ((SPECL (map fst sublist)) (GENL (map snd sublist) + (REFL tm))));; + +add_test("SUBST_TERM", + SUBST_TERM [(`#1`,`a:real`);(`#2`,`b:real`)] (`a +. b +. c`) = + `#1 + #2 + c`);; + +(* ------------------------------------------------------------------ *) + +(* take a term of the form `interval_eps x f ex` and clean up the f and ex *) + +let INTERVAL_CLEAN_CONV:conv = + fun interv -> + let (ixf,ex) = dest_comb interv in + let (ix,f) = dest_comb ixf in + let fthm = FLOAT_CONV f in + let exthm = FLOAT_CONV ex in + let ixfthm = AP_TERM ix fthm in + MK_COMB (ixfthm, exthm);; + +(*test*) add_test("INTERVAL_CLEAN_CONV", + let testval = INTERVAL_CLEAN_CONV `interval_eps ((&.1) +. (&.1)) + (float (int_of_num 3) (int_of_num 4) +. (float (int_of_num 2) (--: (int_of_num 3)))) + (float (int_of_num 1) (int_of_num 2) *. (float (int_of_num 3) (--: (int_of_num 2))))` in + let hypval = hyp testval in + let concval = concl testval in + (length hypval = 0) && + concval = + `interval_eps (&1 + &1) (float (int_of_num 3) (int_of_num 4) + float (int_of_num 2) (--: (int_of_num 3))) + (float (int_of_num 1) (int_of_num 2) * float (int_of_num 3) (--: (int_of_num 2))) = + interval_eps (&1 + &1) (float (int_of_num 386) (--: (int_of_num 3))) (float (int_of_num 3) (int_of_num 0))` + );; + +(* ------------------------------------------------------------------ *) +(* GENERAL lemmas *) +(* ------------------------------------------------------------------ *) + + +(* verifies statement of the form `float a b = float a' b'` *) + + + +let REAL_INV_POS = REAL_LT_INV;; + +let TWOPOW_MK_POS = prove( + `!a. (&.0 <. ( twopow a))`, +EVERY[ + GEN_TAC; + CHOOSE_TAC (SPEC `a:int` INT_REP2); + POP_ASSUM DISJ_CASES_TAC; + ASM_REWRITE_TAC[TWOPOW_POS;TWOPOW_NEG]; + TRY (MATCH_MP_TAC REAL_INV_POS); + MATCH_MP_TAC REAL_POW_LT ; + REAL_ARITH_TAC; +]);; + +let TWOPOW_NZ = prove( + `!a. ~(twopow a = (&.0))`, + GEN_TAC THEN + ACCEPT_TAC (MATCH_MP REAL_MK_NZ_POS (SPEC `a:int` TWOPOW_MK_POS)));; + +let FLOAT_ZERO = prove( + `!a b. (float a b = (&.0)) <=> (a = (int_of_num 0))`, +EVERY[ + REWRITE_TAC[float;REAL_ENTIRE;INT_OF_NUM_DEST]; + MESON_TAC[TWOPOW_NZ]; +]);; + +let INT_ZERO = prove( + `!n. ((int_of_num n = (int_of_num 0)) = (n=0))`,REWRITE_TAC[INT_OF_NUM_EQ]);; + +let INT_ZERO_NEG=prove( + `!n. ((--: (int_of_num n) = (int_of_num 0))) <=> (n=0)`, + REWRITE_TAC[INT_NEG_EQ_0;INT_ZERO]);; + +let FLOAT_NN = Prove_by_refinement.prove_by_refinement( + `!a b. ((&.0) <=. (float a b)) <=> (int_of_num 0 <=: a)`, +[ + REWRITE_TAC[float;INT_OF_NUM_DEST]; + REP_GEN_TAC; + REWRITE_TAC[int_of_num_th;int_le]; + MESON_TAC[REAL_PROP_NN_RCANCEL;TWOPOW_MK_POS;REAL_PROP_NN_POS;REAL_PROP_NN_MUL2]; +]);; + +let INT_NN = INT_POS;; + +let INT_NN_NEG = prove(`!n. ((int_of_num 0) <=: (--:(int_of_num n))) <=> (n = 0)`, + REWRITE_TAC[INT_NEG_GE0;INT_OF_NUM_LE] THEN ARITH_TAC + );; + +let FLOAT_POS = prove(`!a b. ((&.0) <. (float a b)) <=> (int_of_num 0 <: a)`, + MESON_TAC[FLOAT_NN;FLOAT_ZERO;INT_LT_LE;REAL_LT_LE]);; + +let INT_POS' = prove(`!n. (int_of_num 0) <: (int_of_num n) <=> (~(n=0) )`, + REWRITE_TAC[INT_OF_NUM_LT] THEN ARITH_TAC);; + +let INT_POS_NEG =prove(`!n. ((int_of_num 0) <: (--:(int_of_num n))) <=> F`, + REWRITE_TAC[INT_OF_NUM_LT] THEN ARITH_TAC);; + +let RAT_LEMMA1_SUB = prove(`~(y1 = &0) /\ ~(y2 = &0) ==> + ((x1 / y1) - (x2 / y2) = (x1 * y2 - x2 * y1) * inv(y1) * inv(y2))`, + EVERY[REWRITE_TAC[real_div]; + REWRITE_TAC[real_sub;GSYM REAL_MUL_LNEG]; + REWRITE_TAC[GSYM real_div]; + SIMP_TAC[RAT_LEMMA1]; + DISCH_TAC; + MESON_TAC[real_div]]);; + +let INTERVAL_0 = prove(`! a f ex. (interval_eps a f ex <=> (&.0 <= (ex - (abs (a -. f)))))`, + MESON_TAC[interval_eps;REAL_SUB_LE]);; + +let ABS_NUM_P = prove_by_refinement( + `!m n. (m <= n) ==> (abs (&. n -. (&. m)) = &.((m-|n) + (n-|m)))`, +[ + REPEAT STRIP_TAC; + ASM_SIMP_TAC[(ARITH_RULE `(m <= n ==> (m - n = 0) )/\ ( 0 + x = x)`)]; + ASM_SIMP_TAC[GSYM REAL_OF_NUM_SUB;REAL_ABS_REFL;]; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[GSYM REAL_OF_NUM_LE]; + REAL_ARITH_TAC; +]) +;; + +let ABS_NUM = prove_by_refinement ( +`!m n. abs (&. n -. (&. m)) = &.((m-|n) + (n-|m))`, +[ + REPEAT GEN_TAC ; + DISJ_CASES_TAC (SPECL [`m:num`;`n:num`] LTE_CASES) ; (* THENL[ *) + (* first case *) + MATCH_MP_TAC ABS_NUM_P; + FIRST_X_ASSUM MP_TAC; + ARITH_TAC; + (* second case *) + ONCE_REWRITE_TAC[REAL_ARITH `abs(x - y) = abs(y - x)`]; + ONCE_REWRITE_TAC[ARITH_RULE `(a:num) + b = b + a`]; + MATCH_MP_TAC ABS_NUM_P; + ASM_REWRITE_TAC[]; +]);; + + +let INTERVAL_TO_LESS = prove( + `!a f ex b g ey. ((interval_eps a f ex) /\ (interval_eps b g ey) /\ + (&.0 <. (g -. (ey +. ex +. f)))) ==> (a <. b)`, + let lemma1 = REAL_ARITH `!ex ey f g. (&.0 <. + (g -. (ey +. ex +. f))) ==> ((f +. ex)<. (g -. ey)) ` in + EVERY[ + REPEAT GEN_TAC; + DISCH_ALL_TAC; + H_MATCH_MP (THM lemma1) (HYP "2"); + H_MATCH_MP (THM INTERVAL_MAX) (HYP "0"); + H_MATCH_MP (THM INTERVAL_MIN) (HYP "1"); + LABEL_ALL_TAC; + H_MATCH_MP (THM REAL_LET_TRANS) (H_RULE2 CONJ (HYP "4") (HYP "5")); + LABEL_ALL_TAC; + H_MATCH_MP (THM REAL_LTE_TRANS) (H_RULE2 CONJ (HYP "6") (HYP "3")); + ASM_REWRITE_TAC[] + ]);; + +let ABS_TO_INTERVAL = prove( + `!c u k. (abs (c - u) <=. k) ==> (!f g ex ey.((interval_eps u f ex) /\ (interval_eps k g ey) ==> (interval_eps c f (g+.ey+.ex))))`, + EVERY[ + REWRITE_TAC[interval_eps]; + DISCH_ALL_TAC; + REPEAT GEN_TAC; + DISCH_ALL_TAC; + ONCE_REWRITE_TAC [REAL_ARITH `c -. f = (c-. u) + (u-. f)`]; + ONCE_REWRITE_TAC [REAL_ADD_ASSOC]; + ASSUME_TAC (SPECL [`c-.u`;`u-.f`] ABS_TRIANGLE); + IMP_RES_THEN ASSUME_TAC (REAL_ARITH `real_abs (k-.g) <=. ey ==> (k <=. (g +. ey))`); + MATCH_MP_TAC (REAL_ARITH `(?a b.((x <=. (a+.b)) /\ (a <=. u) /\ (b <=. v))) ==> (x <=. (u +. v))`); + EXISTS_TAC `abs (c-.u)`; + EXISTS_TAC `abs(u-.f)`; + ASM_REWRITE_TAC[]; + ASM_MESON_TAC[REAL_LE_TRANS]; + ]);; + + +(* end of general lemmas *) +(* ------------------------------------------------------------------ *) + + +(* ------------------------------------------------------------------ *) +(* Cache of computed constants (abs (r - u) <= k) + or interval r u eps *) +(* ------------------------------------------------------------------ *) + +let cache_entry_of_ineq bprec ineq = + try( + let (abst,_) = dest_binop `real_le` (concl ineq) in + let (_,cmu) = dest_comb abst in + let (r,_) = dest_binop `real_sub` cmu in + (r,bprec,ineq)) + with Failure _ -> + (try( + let (r,_,_) = dest_interval (concl ineq) in (r,bprec,ineq)) + with Failure _ -> (print_term (concl ineq); failwith "calculated_constants format : abs(r - u) <= k"));; + +let get_real_constant cache bprec tm = + (fun (_,_,r) -> r) (find (fun (t,p,th) -> (t = tm) & (p>= bprec)) cache);; + +let remove_entry t = filter (fun x -> not(x = t));; + +(* ------------------------------------------------------------------ *) + +(* take |- interval_eps r u e to interval_eps r' u e, where th_r gives r <=> r' *) + +let interval_rule th_r th_int = + let (iru,e) = dest_comb (concl th_int) in + let (ir,u) = dest_comb iru in + let (i,r) = dest_comb ir in + let ir_t = AP_TERM i th_r in + let iru_t = AP_THM ir_t u in + let irue_t = AP_THM iru_t e in + let a = try EQ_MP irue_t th_int + with Failure m -> (print_thm irue_t; print_thm th_int; failwith m) in + a;; + +(* term of the form '&.n'. Assume error checking done already. *) + +let INTERVAL_OF_NUM:conv = + fun tm -> + let n = snd (dest_comb tm) in + let th_r = (ARITH_REWRITE_CONV[] n) in + let th_int = SPEC (rhs (concl th_r)) INTERVAL_NUM in + interval_rule (SYM (AP_TERM `real_of_num` th_r)) th_int;; + + +add_test("INTERVAL_OF_NUM", + dest_thm (INTERVAL_OF_NUM `&.3`) = ([], + `interval_eps (&3) (float (int_of_num 3) (int_of_num 0)) (float (int_of_num 0) (int_of_num 0))`));; + +(* ------------------------------------------------------------------ *) +(* conversion for float inequalities *) +(* ------------------------------------------------------------------ *) + + +let FLOAT_LESS_CONV = FLOAT_CONV THENC ARITH_SIMP_CONV[FLOAT_POS; + INT_POS';INT_POS_NEG;FLOAT_NN;INT_NN;INT_NN_NEG;];; + +let FLOAT_INEQ_CONV t = + let th =FLOAT_LESS_CONV t in + let (_,rhs) = dest_eq (concl th) in + let _ = (rhs = `T`) or raise Insufficient_precision in + EQ_MP (SYM th) TRUTH;; + +add_test("FLOAT_INEQ_CONV", + let f c x = + dest_thm (c x) = ([],x) in + let t1 = + `(float (int_of_num 3) (int_of_num 0)) +. (float (int_of_num 4) (int_of_num 0)) <. (float (int_of_num 8) (int_of_num 1))` in + ((f FLOAT_INEQ_CONV t1)));; + + +let INTERVAL_TO_LESS_CONV = + let rthm = ASSUME `!f g ex ey. (&.0 <. (g -. (ey +. ex +. f)))` in + fun thm1 thm2 -> + let (a,f,ex) = dest_interval (concl thm1) in + let (b,g,ey) = dest_interval (concl thm2) in + let rspec = concl (SPECL [f;g;ex;ey] rthm) in + let rspec_th = FLOAT_INEQ_CONV rspec in + let fthm = CONJ thm1 (CONJ thm2 rspec_th) in + MATCH_MP INTERVAL_TO_LESS fthm;; + + + +add_test("INTERVAL_TO_LESS_CONV", + let thm1 = ASSUME + `interval_eps (#0.1) (float (int_of_num 1) (--: (int_of_num 1))) (float (int_of_num 1) (--: (int_of_num 2)))` in + let thm2 = ASSUME `interval_eps (#7) (float (int_of_num 4) (int_of_num 1)) (float (int_of_num 1) (int_of_num 0))` in + let thm3 = INTERVAL_TO_LESS_CONV thm1 thm2 in + concl thm3 = `#0.1 <. (#7)`);; + +add_test("INTERVAL_TO_LESS_CONV2", + let (h,c) = dest_thm (INTERVAL_TO_LESS_CONV + (INTERVAL_OF_NUM `&.3`) (INTERVAL_OF_NUM `&.8`)) in + (h=[]) && (c = `&.3 <. (&.8)`));; + +(* ------------------------------------------------------------------ *) + +(* conversion for DEC <= posfloat and posfloat <= DEC *) + +let lemma1 = prove( + `!n m p. ((&.p/(&.m)) <= (&.n)) <=> ((&.p/(&.m)) <= (&.n)/(&.1))`, + MESON_TAC[REAL_DIV_1]);; + +let lemma2 = prove( + `!n m p. ((&.p) <= ((&.n)/(&.m))) <=> ((&.p/(&.1)) <= (&.n)/(&.m))`, + MESON_TAC[REAL_DIV_1]);; + +let REAL_LT = REAL_OF_NUM_LT;; + +let REAL_LE = REAL_OF_NUM_LE;; + +let lemma3 = prove(`!a b c d. ( + ((0 (&.a/(&.b) <=. ((&.c)/(&.d))))`, + EVERY[REPEAT GEN_TAC; + DISCH_ALL_TAC; + ASM_SIMP_TAC[RAT_LEMMA4;REAL_LT;REAL_OF_NUM_MUL;REAL_LE]]);; + +let DEC_FLOAT = EQT_ELIM o + ARITH_SIMP_CONV[DECIMAL;float;TWOPOW_POS;TWOPOW_NEG;GSYM real_div; + REAL_OF_NUM_POW;INT_NUM_REAL;REAL_OF_NUM_MUL; + lemma1;lemma2;lemma3];; + +add_test("DEC_FLOAT", + let f c x = + dest_thm (c x) = ([],x) in + ((f DEC_FLOAT `#10.0 <= (float (int_of_num 3) (int_of_num 2))`) && + (f DEC_FLOAT `#10 <= (float (int_of_num 3) (int_of_num 2))`) && + (f DEC_FLOAT `#0.1 <= (float (int_of_num 1) (--: (int_of_num 2)))`) && + (f DEC_FLOAT `float (int_of_num 3) (int_of_num 2) <= (#13.0)`) && + (f DEC_FLOAT `float (int_of_num 3) (int_of_num 2) <= (#13)`) && + (f DEC_FLOAT `float (int_of_num 1) (--: (int_of_num 2)) <= (#0.3)`)));; + +(* Conversion for powers *) + +let pow_parity = prove( + `!x u. x pow (NUMERAL(BIT0 u)) = (x pow (NUMERAL u) * x pow (NUMERAL u)) /\ + x pow (NUMERAL(BIT1 u)) = x* x pow (NUMERAL u) * x pow (NUMERAL u)`, + REWRITE_TAC[GSYM REAL_POW_ADD;NUMERAL;BIT0;BIT1;real_pow]; + );; + +let pow_conv = PURE_ONCE_REWRITE_CONV[CONJUNCT1 real_pow;REAL_POW_1;pow_parity];; + +(* conversion for negation *) + +let neg_conv = + let th = REAL_ARITH `--x = &0 - x` in + PURE_ONCE_REWRITE_CONV[th];; + +(* conversion for sums *) + +let dest_sum = + let sum = `sum:(num->bool)->(num->real)->real` in + let rg = `(..)` in + fun tm -> + let (x,f) = dest_binop sum tm in + let (i,j) = dest_binop rg x in + (i,j,f);; + +let mk_sum = + let sum = `sum:(num->bool)->(num->real)->real` in + let rg = `(..)` in + fun (i,j,f) -> + let x = mk_binop rg i j in + mk_binop sum x f;; + +(* +mk_sum (dest_sum `sum (3..4) f`);; +*) + +let sum_conv = + fun tm -> + let (i,j,f) = dest_sum tm in + let i',j' = dest_numeral i,dest_numeral j in + if (i'=j') then (ONCE_REWRITE_CONV[SUM_SING_NUMSEG]) tm + else if (i' >/ j') then + let th = ARITH_RULE(mk_binop `(<):num->num->bool` j i) in + let th2 = MATCH_MP SUM_TRIV_NUMSEG th in + (PURE_ONCE_REWRITE_CONV[th2]) tm + else + let j_pred = mk_numeral (j'-/ Int 1) in + let j_new = mk_comb (`SUC`, j_pred) in + let th = (ISPECL [i;j_pred] (CONJUNCT2 SUM_CLAUSES_NUMSEG)) in + let rr = ARITH_RULE (mk_eq (j_new,j)) in + let th' = REWRITE_RULE[rr;ARITH_RULE (mk_binop `(<=):num->num->bool` i j)] th in + PURE_ONCE_REWRITE_CONV[th'] tm;; + +(* ------------------------------------------------------------------ *) + +(* converts a DECIMAL TO A THEOREM *) + +let ABS_BOUNDS = REAL_ABS_BOUNDS;; (* new *) + +let INTERVAL_MINMAX = prove(`!x f ex. + ((f -. ex) <= x) /\ (x <=. (f +. ex)) ==> (interval_eps x f ex)`, + EVERY[REPEAT GEN_TAC; + REWRITE_TAC[interval_eps;ABS_BOUNDS]; + REAL_ARITH_TAC]);; + +let INTERVAL_OF_DECIMAL bprec dec = + let a_num = dest_decimal dec in + let f_num = round_rat bprec a_num in + let ex_num = round_rat bprec (Num.abs_num (f_num -/ a_num)) in + let _ = assert (ex_num <=/ f_num) in + let f = mk_float f_num in + let ex= mk_float ex_num in + let fplus_ex = FLOAT_CONV (mk_binop `real_add` f ex) in + let fminus_ex= FLOAT_CONV (mk_binop `real_sub` f ex) in + let fplus_term = rhs (concl fplus_ex) in + let fminus_term = rhs (concl fminus_ex) in + let th1 = DEC_FLOAT (mk_binop `real_le` fminus_term dec) in + let th2 = DEC_FLOAT (mk_binop `real_le` dec fplus_term) in + let intv = mk_interval dec f ex in + EQT_ELIM (SIMP_CONV[INTERVAL_MINMAX;fplus_ex;fminus_ex;th1;th2] intv);; + +add_test("INTERVAL_OF_DECIMAL", + let (h,c) = dest_thm (INTERVAL_OF_DECIMAL 4 `#36.1`) in + let (x,f,ex) = dest_interval c in + (h=[]) && (x = `#36.1`));; + +add_test("INTERVAL_OF_DECIMAL2", + can (fun() -> INTERVAL_TO_LESS_CONV (INTERVAL_OF_DECIMAL 4 `#33.33`) + (INTERVAL_OF_DECIMAL 4 `#36.1`)) ());; + +let INTERVAL_FLOAT = prove_by_refinement( + `!a b. interval_eps (float a b) (float a b) (float (int_of_num 0) (int_of_num 0))`, + (* {{{ proof *) + [ + REWRITE_TAC[interval_eps;REAL_ARITH `abs(x - x) = &0`]; + REWRITE_TAC[float;int_of_num_th]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let INTERVAL_FLOAT_CONV flt = + let (a,b) = dest_binop `float` flt in + (ISPECL [a;b] INTERVAL_FLOAT);; + +(*--------------------------------------------------------------------*) +(* functions to check format. *) +(* There are various implicit rules: *) +(* NUMERAL is followed by bits and no other kind of num, etc. *) +(* FLOAT a b, both a and b are int_of_num NUMERAL or --:int_of_num NUMERAL, etc. *) +(*--------------------------------------------------------------------*) + + +(* converts exceptions to false *) +let falsify_ex f x = try (f x) with Failure _ -> false;; + +let is_bits_format = + let zero = `_0` in + let rec format x = + if (x = zero) then true + else let (h,t) = dest_comb x in + (((h = `BIT1`) or (h = `BIT0`)) && (format t)) + in falsify_ex format;; + +let is_numeral_format = + let fn x = + let (h,t) = dest_comb x in + ((h = `NUMERAL`) && (is_bits_format t)) in + falsify_ex fn;; + +let is_decimal_format = + let fn x = + let (t1,t2) = dest_binop `DECIMAL` x in + ((is_numeral_format t1) && (is_numeral_format t2)) in + falsify_ex fn;; + +let is_pos_int_format = + let fn x = + let (h,t) = dest_comb x in + (h = `int_of_num`) && (is_numeral_format t) in + falsify_ex fn;; + +let is_neg_int_format = + let fn x = + let (h,t) = dest_comb x in + (h = `real_neg`) && (is_pos_int_format t) in + falsify_ex fn;; + +let is_int_format x = + (is_neg_int_format x) or (is_pos_int_format x);; + +let is_float_format = + let fn x = + let (t1,t2) = dest_binop `float` x in + (is_int_format t1) && (is_int_format t2) in + falsify_ex fn;; + +let is_interval_format = + let fn x = + let (a,b,c) = dest_interval x in + (is_float_format b) && (is_float_format c) in + falsify_ex fn;; + +let is_neg_real = + let fn x = + let (h,t) = dest_comb x in + (h= `real_neg `) in + falsify_ex fn;; + +let is_real_num_format = + let fn x = + let (h,t) = dest_comb x in + (h=`real_of_num`) && (is_numeral_format t) in + falsify_ex fn;; + +let is_comb_of t u = + let fn t u = + t = (fst (dest_comb u)) in + try (fn t u) with Failure _ -> false;; + +(* ------------------------------------------------------------------ *) +(* Heron's formula for the square root of A + Return a value x that is always at most the actual square root + and such that abs (x - A/x ) < epsilon *) + +let rec heron_sqrt depth A x eps = + let half = (Int 1)//(Int 2) in + if (depth <= 0) + then raise (Failure "heron_sqrt:internal error:sqrt recursion depth exceeded") + else + if (Num.abs_num (x -/ (A//x) ) =/ A) then (A//x) else + let x' = half */ (x +/ (A//x)) in + heron_sqrt (depth -1) A x' eps;; + +let INTERVAL_OF_TWOPOW = prove( + `!n. interval_eps (twopow n) (float (int_of_num 1) n) (float (int_of_num 0) (int_of_num 0))`, + REWRITE_TAC[interval_eps;float;int_of_num_th] THEN + REAL_ARITH_TAC + );; + +(* compute ez parameter for division *) + +let division_ez bprec (f,ex,g,ey) = + let f_num = dest_float f in + let ex_num = dest_float ex in + let g_num = dest_float g in + let ey_num = dest_float ey in + let _ = (ey_num =/ (Int 0))) in + let ez = mk_float ez_num + in (h,ez);; + +let pureconv (s,t) = (s,PURE_ONCE_REWRITE_CONV[t]);; + +(* ------------------------------------------------------------------ *) + +(* +bprec gives the bits of precision. +*) + + +let rec (INTERVAL_OF_TERM:(string*conv)list -> (term *int*thm)list ->int -> term -> (term*int*thm) list * thm) = +fun convl cache bprec tm -> + let mk c th = (cache_entry_of_ineq bprec th :: c, th) in + (* treat user conversions *) + let interval_of_conv cache bprec conv tm = + let th_r = conv tm in + let (lhs,rhs) = dest_eq (concl th_r) in + let _ = (not (aconv lhs rhs)) or (print_term lhs; failwith "interval_of_conv: no change" )in + let (cache,th_rhs) = INTERVAL_OF_TERM convl cache bprec rhs in + let th_lhs = interval_rule (SYM th_r) th_rhs in + mk cache th_lhs in + let interval_of_binop op opname match_thm = + begin + let (a,b) = dest_binop op tm in + let (cache,a_int) = INTERVAL_OF_TERM convl cache bprec a in + let (cache,b_int) = INTERVAL_OF_TERM convl cache bprec b in + try( + let c_int = MATCH_MP match_thm (CONJ a_int b_int) in + let th = EQ_MP (INTERVAL_CLEAN_CONV (concl c_int)) c_int in + mk cache th) + with Failure _ -> failwith ("INTERVAL_OF_TERM: "^opname) + end in + (* treat cached values first *) + if (can (get_real_constant cache bprec) tm) then + begin + try( + let int_thm = get_real_constant cache bprec tm in + if (can dest_interval (concl int_thm)) then (cache,int_thm) + else ( + let absthm = int_thm in + let (abst,k) = dest_binop `real_le` (concl absthm) in + let (absh,cmu) = dest_comb abst in + let (c,u) = dest_binop `real_sub` cmu in + let (cache,intk) = INTERVAL_OF_TERM convl cache bprec k in + let (cache,intu) = INTERVAL_OF_TERM convl cache bprec u in + let thm1 = MATCH_MP ABS_TO_INTERVAL absthm in + let thm2 = MATCH_MP thm1 (CONJ intu intk) in + let (_,f,ex)= dest_interval (concl thm2) in + let fthm = FLOAT_CONV f in + let exthm = FLOAT_CONV ex in + let thm3 = REWRITE_RULE[fthm;exthm] thm2 in + (cache_entry_of_ineq bprec thm3 :: (remove_entry (tm,bprec,int_thm) cache), thm3) + )) + with Failure _ -> failwith "INTERVAL_OF_TERM : CONSTANT" + end + else if (is_real_num_format tm) then + let th = INTERVAL_OF_NUM tm in (cache,th) + else if (is_decimal_format tm) then + let th = (INTERVAL_OF_DECIMAL bprec tm) + in mk cache th + (* treat abs value *) + else if (is_comb_of `real_abs` tm) then + begin + let (_,b) = dest_comb tm in + let (cache,i1) = (INTERVAL_OF_TERM convl cache bprec b) in + try( + let b_int = MATCH_MP INTERVAL_ABSV i1 in + let th = EQ_MP (INTERVAL_CLEAN_CONV (concl b_int)) b_int in + mk cache th) + with Failure _ -> failwith "INTERVAL_OF_TERM : ABS" + end + (* treat twopow *) + else if (is_comb_of `twopow` tm) then + begin + try( + let (_,b) = dest_comb tm in + let th = SPEC b INTERVAL_OF_TWOPOW + in mk cache th + ) + with Failure _ -> failwith "INTERVAL_OF_TERM : TWOPOW" + end + (* treat addition *) + else if (can (dest_binop `real_add`) tm) then + interval_of_binop `real_add` "ADD" INTERVAL_ADD + (* treat subtraction *) + else if (can (dest_binop `real_sub`) tm) then + interval_of_binop `real_sub` "SUB" INTERVAL_SUB + (* treat multiplication *) + else if (can (dest_binop `real_mul`) tm) then + interval_of_binop `real_mul` "MUL" INTERVAL_MUL + (* treat division : instantiate INTERVAL_DIV *) + else if (can (dest_binop `( / )`) tm) then + begin + let (a,b) = dest_binop `( / )` tm in + let (cache,a_int) = INTERVAL_OF_TERM convl cache bprec a in + let (cache,b_int) = INTERVAL_OF_TERM convl cache bprec b in + try( + let (_,f,ex) = dest_interval (concl a_int) in + let (_,g,ey) = dest_interval (concl b_int) in + let (h,ez) = division_ez bprec (f,ex,g,ey) in + let hyp1 = a_int in + let hyp2 = b_int in + let hyp3 = try (FLOAT_INEQ_CONV (mk_binop `real_lt` ey (mk_comb (`real_abs`,g)))) + with Failure _ -> raise Insufficient_precision in + let thm = SPECL [a;f;ex;b;g;ey;h;ez] INTERVAL_DIV in + let conj2 x = snd (dest_conj x) in + let hyp4t = (conj2 (conj2 (conj2 (fst(dest_imp (concl thm)))))) in + let hyp4 = FLOAT_INEQ_CONV hyp4t in + let hyp_all = end_itlist CONJ [hyp1;hyp2;hyp3;hyp4] in + let th = MATCH_MP thm hyp_all in + mk cache th) + with Failure _ -> failwith "INTERVAL_OF_TERM :DIV" + end + (* treat pow *) + else if (can (dest_binary "real_pow") tm) then + interval_of_conv cache bprec pow_conv tm + (* treat negative terms *) + else if (is_neg_real tm) then + interval_of_conv cache bprec neg_conv tm + (* treat beta *) + else if can (fun t-> let (f,x) = dest_comb t in dest_abs f ) tm then + interval_of_conv cache bprec BETA_CONV tm + (* treat sum *) + else if can dest_sum tm then + interval_of_conv cache bprec sum_conv tm + (* treat float *) + else if can (dest_binop `float`) tm then + (cache,INTERVAL_FLOAT_CONV tm) + (* treat ssqrt : instantiate INTERVAL_SSQRT *) + else if (can (dest_unary `ssqrt`) tm) then + begin + try( + let x = dest_unary `ssqrt` tm in + let (cache,x_int) = INTERVAL_OF_TERM convl cache bprec x in + let (_,f,ex) = dest_interval (concl x_int) in + let f_num = dest_float f in + let ex_num = dest_float ex in + let fd_num = f_num -/ ex_num in + let fe_f = Num.float_of_num fd_num in + let apprx_sqrt = Pervasives.sqrt fe_f in + (* put in heron's formula *) + let v_num1 = round_inward_float 25 (apprx_sqrt) in + let v_num = round_inward_rat bprec + (heron_sqrt 10 fd_num v_num1 ((Int 2) **/ (Int (-bprec-4)))) in + let u_num1 = round_inward_float 25 + (Pervasives.sqrt (float_of_num f_num)) in + let u_num = round_inward_rat bprec + (heron_sqrt 10 f_num u_num1 ((Int 2) **/ (Int (-bprec-4)))) in + let ey_num = round_rat bprec (abs_num (f_num -/ (u_num */ u_num))) in + let ez_num = round_rat bprec ((ex_num +/ ey_num)//(u_num +/ v_num)) in + let (v,u) = (mk_float v_num,mk_float u_num) in + let (ey,ez) = (mk_float ey_num,mk_float ez_num) in + let thm = SPECL [x;f;ex;u;ey;ez;v] INTERVAL_SSQRT in + let conjhyp = fst (dest_imp (concl thm)) in + let [hyp6;hyp5;hyp4;hyp3;hyp2;hyp1] = + let rec break_conj c acc = + if (not(is_conj c)) then (c::acc) else + let (u,v) = dest_conj c in break_conj v (u::acc) in + (break_conj conjhyp []) in + let thm2 = prove(hyp2,REWRITE_TAC[interval_eps] THEN + (CONV_TAC FLOAT_INEQ_CONV)) in + let thm3 = FLOAT_INEQ_CONV hyp3 in + let thm4 = FLOAT_INEQ_CONV hyp4 in + let float_tac = REWRITE_TAC[FLOAT_NN;FLOAT_POS;INT_NN;INT_NN_NEG; + INT_POS';INT_POS_NEG] THEN ARITH_TAC in + let thm5 = prove( hyp5,float_tac) in + let thm6 = prove( hyp6,float_tac) in + let ant = end_itlist CONJ[x_int;thm2;thm3;thm4;thm5;thm6] in + let th = MATCH_MP thm ant + in mk cache th + ) + with Failure _ -> failwith "INTERVAL_OF_TERM : SSQRT" + end + else if (can (dest_unary `sqrt`) tm) then + begin + try( + let x = dest_unary `sqrt` tm in + let stm = mk_comb (`ssqrt`, x) in + let (cache,ssqrt_thm) = INTERVAL_OF_TERM convl cache bprec stm in + let (cache,int1) = INTERVAL_OF_TERM convl cache bprec`real_of_num 0` in + let (cache,int2) =INTERVAL_OF_TERM convl cache bprec x in + let ant = CONJ (INTERVAL_TO_LESS_CONV int1 int2) ssqrt_thm in + let th = MATCH_MP ssqrt_sqrt ant + in mk cache th) + with Failure _ -> failwith "INTERVAL_OF_TERM : SQRT" + end +(* treat atn *) + else if can (dest_unary `atn`) tm then + begin + let half_co = ("halfatn4_co",ARITH_SIMP_CONV[Taylor_atn.halfatn4_co]) in + let half4 = ("halfatn4",PURE_REWRITE_CONV[Taylor_atn.halfatn4;o_THM]) in + let halfatnconv = pureconv("halfatn",Taylor_atn.halfatn) in + let aconvl = (halfatnconv::half4::half_co::convl) in + let n = mk_numeral (Int (1 + (bprec - 5) / 6)) in + let x = dest_unary `atn` tm in + let sum_tm = instantiate ([],[(n,`n:num`);(x,`u:real`)],[]) `&16 * sum (0..n) (halfatn4_co u)` in + let (cache,hyp_1) = INTERVAL_OF_TERM (aconvl) cache bprec sum_tm in + let (_,_,eps2) = dest_interval (concl hyp_1) in + let eps_tm = instantiate([],[(n,`n:num`);(eps2,`eps2:real`)],[]) `float (int_of_num 1) ( -- int_of_num (6 * n + 5)) + eps2` in + let eps_thm = FLOAT_CONV eps_tm in + let eps = snd(dest_eq (concl eps_thm)) in + let hyp_2 = FLOAT_INEQ_CONV (mk_binop `(<=):real->real->bool` eps_tm eps) in (cache, MATCH_MP taylor_atn (CONJ hyp_1 hyp_2) ) + end +(* treat acs *) + else if can (dest_unary `acs`) tm then + begin + let x = dest_unary `acs` tm in + let (_,int_m1) = INTERVAL_OF_TERM convl cache bprec`-- real_of_num 1` in + let (_,int_p1) = INTERVAL_OF_TERM convl cache bprec`real_of_num 1` in + let (cache,int_x) =INTERVAL_OF_TERM convl cache bprec x in + let ant1 = INTERVAL_TO_LESS_CONV int_m1 int_x in + let ant2 = INTERVAL_TO_LESS_CONV int_x int_p1 in + let th = MATCH_MP ACS_ATN (CONJ ant1 ant2) in + interval_of_conv cache bprec (PURE_ONCE_REWRITE_CONV[th]) tm + end +(* treat pi *) + else if (tm = `pi`) then + begin + interval_of_conv cache bprec (PURE_ONCE_REWRITE_CONV[pi_atn]) tm + end +(* user supplied conversions *) + else + begin + let (c,b) = strip_comb tm in + let _ = is_const c or failwith "INTERVAL_OF_TERM: case not installed" in + let (s,_) = dest_const c in + let conv = try (assoc s convl) + with Failure _ -> failwith ("INTERVAL_OF_TERM: function not found "^s) in + interval_of_conv cache bprec conv tm + end;; + +let real_ineq convl cache bprec tm = + let (t1,t2) = try (dest_binop `real_lt` tm) + with Failure _ -> failwith "real_ineq: inequality of the form `x < y` expected" in + let (cache,int1) = INTERVAL_OF_TERM convl cache bprec t1 in + let (cache,int2) = INTERVAL_OF_TERM convl cache bprec t2 in + (cache,INTERVAL_TO_LESS_CONV int1 int2);; + +let rec rec_real_ineq convl cache bprec bprec_max tm = + try (bprec,real_ineq convl cache bprec tm) with + Insufficient_precision -> + let bprec = (16 * bprec) / 10 in + let _ = (bprec < bprec_max) or failwith ("insufficient precision "^ (string_of_int bprec_max)) in + let _ = Format.print_string ("increasing precision to "^(string_of_int bprec)^" bits"); + Format.print_newline() in + rec_real_ineq convl cache bprec bprec_max tm;; + +(* Give it a conjunction of strict inequalities *) + +let REAL_INEQUALITY_CALCULATOR_PREC (bprec_init,bprec_max) convl tm = + let tml = striplist dest_conj tm in + let (b,c,th) = List.fold_left (fun (b,c,thl) tm1 -> + let (bprec,(cache,th1)) = rec_real_ineq convl c b bprec_max tm1 + in (bprec,cache, th1 ::thl)) (bprec_init,[], []) (tml) in + (b, EQ_MP (SYM(REWRITE_CONV th tm)) TRUTH);; + +let REAL_INEQUALITY_CALCULATOR convl tm = + REAL_INEQUALITY_CALCULATOR_PREC (10,70) convl tm;; + +(* +let REAL_INEQUALITY_CALCULATOR convl tm = + let tml = striplist dest_conj tm in + let bprec_max = 70 in + let (b,c,th) = List.fold_left (fun (b,c,thl) tm1 -> + let (bprec,(cache,th1)) = rec_real_ineq convl c b bprec_max tm1 + in (bprec,cache, th1 ::thl)) (10,[], []) (tml) in + (b, EQ_MP (SYM(REWRITE_CONV th tm)) TRUTH);; +*) + +(* + let tmint = map (rec_real_ineq [] 10) tml in + List.fold_left CONJ (hd tmint) (tl tmint);; + +*) + +end;; diff --git a/text_formalization/jordan/float_example.hl b/text_formalization/jordan/float_example.hl new file mode 100644 index 0000000..c6f2b24 --- /dev/null +++ b/text_formalization/jordan/float_example.hl @@ -0,0 +1,79 @@ + +reneeds "jordan/float.hl";; + +Float.REAL_INEQUALITY_CALCULATOR [] `#3.1415 < #4.0 * atn (&1) /\ #4.0 * atn (&1) < #3.142`;; + +Float.REAL_INEQUALITY_CALCULATOR [] `#1.26 < acs(#0.3) /\ acs (#0.3) < #1.27`;; + +acos (0.3);; + +Float.REAL_INEQUALITY_CALCULATOR [] `#3.14159 < pi`;; + +Float.INTERVAL_OF_TERM [] [] 5 `&7 + (\i. &i pow 2) 1`;; + +Float.FLOAT_CONV `float (int_of_num 3) (int_of_num 20) <= float (int_of_num 3) (int_of_num 7) +. (float (int_of_num 4) (-- int_of_num 13))`;; + +Float.FLOAT_LESS_CONV `&0 < float (int_of_num 3) (int_of_num 7) -. (float (int_of_num 4) (-- int_of_num 13))`;; + +Float.REAL_INEQUALITY_CALCULATOR [] + `-- (sum (0..1) (\i. (&i) pow 2)) < &1000`;; + +Float.REAL_INEQUALITY_CALCULATOR [] + `cos (&3) < pi`;; + +let rjrj = new_definition `rjrj = sqrt(&3)`;; + +Float.REAL_INEQUALITY_CALCULATOR [("rjrj",PURE_ONCE_REWRITE_CONV[rjrj])] + `rjrj < #1.73206`;; + +let jrjr = new_definition `jrjr x = sqrt(x)`;; + +Float.REAL_INEQUALITY_CALCULATOR [("rjrj",PURE_ONCE_REWRITE_CONV[rjrj]); + ("jrjr",PURE_ONCE_REWRITE_CONV[jrjr])] + `#1.31607 < jrjr rjrj /\ jrjr rjrj < #1.31608`;; + +Pervasives.sqrt(Pervasives.sqrt(3.0));; + +let rkkk = new_definition `rkkk x y z = (x * y) pow 2 + z`;; + +Float.REAL_INEQUALITY_CALCULATOR [("rkkk",PURE_ONCE_REWRITE_CONV[rkkk])] + `rkkk (&2) (&3) (&4) < #40.1`;; + +Float.REAL_INEQUALITY_CALCULATOR [] + `#0.019 < abs (&3 - #3.02)`;; + +Float.REAL_INEQUALITY_CALCULATOR [] + `pi + #0.019 < abs (&3 - #3.02)`;; + + +Float.REAL_INEQUALITY_CALCULATOR [] + `sum (5..7) (\i. (&i) pow 2) < &1000`;; + +Float.REAL_INEQUALITY_CALCULATOR [] `#12.91553 < #1.29155 pow 10 /\ #1.29155 pow 10 < #12.91554`;; + +Float.REAL_INEQUALITY_CALCULATOR [] `#0.05 < &3 / (sqrt(&2) - #1.41)`;; +Float.REAL_INEQUALITY_CALCULATOR [] `#0.05 * #0.04 - #0.3 < &3 / (sqrt(&2) - #1.41)`;; + +Float.INTERVAL_DIV;; + +3.0 /. (Pervasives.sqrt(2.0) -. 1.0);; + +Float.REAL_INEQUALITY_CALCULATOR [] `((\t. t + &1) #12.0) < #15.0 `;; + +BETA_CONV `((\t. t + &1) #12.0)`;; + +Float.REAL_INEQUALITY_CALCULATOR [] `-- ((\t. &t + &1) 3) < -- #3.0`;; + +Float.REAL_INEQUALITY_CALCULATOR [] `#1.4142135 < sqrt(&2) /\ (sqrt(&2) < #1.4142136)`;; + +Float.REAL_INEQUALITY_CALCULATOR [] +`#4.059107977120 < sqrt(&7 / #3.2) + sqrt(&4 * sqrt(&2) + &1) /\ + sqrt(&7 / #3.2) + sqrt(&4 * sqrt(&2) + &1)< #4.059107977121`;; + +Float.INTERVAL_DIV;; + +Float.REAL_INEQUALITY_CALCULATOR [] `sqrt( #0.001 ) < #0.00001`;; + +Float.REAL_INEQUALITY_CALCULATOR [] `&1/ &0 < #0.00001`;; +Float.REAL_INEQUALITY_CALCULATOR [] + `(\i. (&i) pow 2 + (&i)) 33 < &1000000`;; diff --git a/text_formalization/jordan/flyspeck_constants.hl b/text_formalization/jordan/flyspeck_constants.hl new file mode 100644 index 0000000..84b5cab --- /dev/null +++ b/text_formalization/jordan/flyspeck_constants.hl @@ -0,0 +1,47 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Calculate Numeric constants *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-27 *) +(* ========================================================================== *) + + +module Flyspeck_constants = struct + + open Sphere;; + + let conv_of (s,t) = (s,PURE_ONCE_REWRITE_CONV[t]);; + + let convl = [ + conv_of ("sqrt2",sqrt2); + conv_of ("sqrt3",sqrt3); + conv_of ("sqrt8",sqrt8); + conv_of ("sol0",sol0); + conv_of("tau0",tau0); + conv_of("mm1",mm1); + conv_of("mm2",mm2); + conv_of("pi_rt18",pi_rt18); + conv_of("hplus",hplus); + ];; + + let calc = snd o (Float.REAL_INEQUALITY_CALCULATOR convl) ;; + + let bounds = calc `#1.414213 < sqrt2 /\ sqrt2 < #1.414214 /\ + #2.828427 < sqrt8 /\ sqrt8 < #2.828428 /\ + #1.732 < sqrt3 /\ sqrt3 < #1.7321 /\ + #3.14159 < pi /\ pi < #3.1416 /\ + #0.551285 < sol0 /\ sol0 < #0.551286 /\ + #1.54065 < tau0 /\ tau0 < #1.54066 /\ + #0.740480 < pi_rt18 /\ pi_rt18 < #0.740481 /\ + #1.012080 < mm1 /\ mm1 < #1.012081 /\ + #0.02541 < mm2 /\ mm2 < #0.02542 /\ + &0 < ((sqrt (&2) - &1) * &5 * (hplus - &1)) /\ + &0 < sqrt(&2) - hplus /\ + &0 < hplus - &1 `;; + + +end;; + + + diff --git a/text_formalization/jordan/goal_printer.hl b/text_formalization/jordan/goal_printer.hl new file mode 100644 index 0000000..568616b --- /dev/null +++ b/text_formalization/jordan/goal_printer.hl @@ -0,0 +1,160 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Jordan *) +(* Copied from HOL Light jordan directory *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-08 *) +(* ========================================================================== *) + +(* needs tactics_fix.ml;; + tactics_refine.ml ;; + lib_ext.ml *) + +module Goal_printer = struct + +open Refinement;; +open Hash_term;; +open Lib_ext;; +(* This file is in severe need of a rewrite! *) + +Parse_ext_override_interface.unambiguous_interface();; +Parse_ext_override_interface.prioritize_real();; + +(* + + To restore HOL-light defaults, type + #install_printer print_goal;; + #install_printer print_goalstack;; + +*) + + +(* To install: +#install_printer Goal_printer.print_goal_hashed;; +#install_printer Goal_printer.print_goalstack_hashed;; + + To install printer that reverses the assumption list, but no hashing: + + #install_printer Goal_printer.print_rev_goal;; + #install_printer Goal_printer.print_rev_goalstack;; + +*) + + + +(* ------------------------------------------------------------------------- *) +(* A printer for goals etc. *) +(* ------------------------------------------------------------------------- *) + + + + +(* had (rev asl) in this method. I don't want to reverse the list *) + + +let print_hyp n (s,th) = + open_hbox(); + print_string " "; + print_as 4 (string_of_int (hash_of_term (concl th))); + print_string " ["; + print_qterm (concl th); + print_string "]"; + (if not (s = "") then (print_string (" ("^s^")")) else ()); + close_box(); + print_newline();; + +let rec print_hyps n asl = + if asl = [] then () else + (print_hyp n (hd asl); + print_hyps (n + 1) (tl asl));; + +let (print_goal_hashed:goal->unit) = + fun gl -> + let (asl,w)= dest_goal gl in + print_newline(); + if asl <> [] then (print_hyps 0 (asl); print_newline()) else (); + print_qterm w; print_newline();; + +let (print_goalstate_hashed:int->goalstate->unit) = + fun k gs -> let (_,gl,_) = gs in + let n = length gl in + let s = if n = 0 then "No subgoals" else + (string_of_int k)^" subgoal"^(if k > 1 then "s" else "") + ^" ("^(string_of_int n)^" total)" in + print_string s; print_newline(); + if gl = [] then () else + do_list (print_goal_hashed o C el gl) (rev(0--(k-1)));; + +let (print_goalstack_hashed:goalstack->unit) = + fun l -> + if l = [] then print_string "Empty goalstack" + else if tl l = [] then + let (_,gl,_ as gs) = hd l in + print_goalstate_hashed 1 gs + else + let (_,gl,_ as gs) = hd l + and (_,gl0,_) = hd(tl l) in + let p = length gl - length gl0 in + let p' = if p < 1 then 1 else p + 1 in + print_goalstate_hashed p' gs;; + + + +(* To install printers: +#install_printer print_rev_goal;; +#install_printer print_rev_goalstack;; +*) + + +(* ------------------------------------------------------------------------- *) +(* A printer that reverses the assumption list *) +(* ------------------------------------------------------------------------- *) + +(* + + Objective version of HOL-light uses (rev asl) in the method print_goal. + This means that the numbers printed next to the assumptions + are the reverse of the numbering in the list. + + I want it the opposite way. + This reverses the numbering on the assumption list, + so that the printed numbers match the list order. + + To restore HOL-light defaults, type + #install_printer print_goal;; + #install_printer print_goalstack;; + +*) + +let (print_rev_goal:goal->unit) = + fun gl -> + let (asl,w) = dest_goal gl in + print_goal (mk_goal(rev asl,w));; + +let (print_rev_goalstate:int->goalstate->unit) = + fun k gs -> let (_,gl,_) = gs in + let n = length gl in + let s = if n = 0 then "No subgoals" else + (string_of_int k)^" subgoal"^(if k > 1 then "s" else "") + ^" ("^(string_of_int n)^" total)" in + print_string s; print_newline(); + if gl = [] then () else + do_list (print_rev_goal o C el gl) (rev(0--(k-1)));; + + +let (print_rev_goalstack:goalstack->unit) = + fun l -> + if l = [] then print_string "Empty goalstack" + else if tl l = [] then + let (_,gl,_ as gs) = hd l in + print_rev_goalstate 1 gs + else + let (_,gl,_ as gs) = hd l + and (_,gl0,_) = hd(tl l) in + let p = length gl - length gl0 in + let p' = if p < 1 then 1 else p + 1 in + print_rev_goalstate p' gs;; + + +end;; diff --git a/text_formalization/jordan/hash_term.hl b/text_formalization/jordan/hash_term.hl new file mode 100644 index 0000000..caef4a0 --- /dev/null +++ b/text_formalization/jordan/hash_term.hl @@ -0,0 +1,93 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Jordan *) +(* Copied from HOL Light jordan directory *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-08 *) +(* ========================================================================== *) + + +module Hash_term = struct + + +let hash_of_string = + let prime200 = 1223 in + let prime = 8831 in + let rec hashll v = match v with + | [] -> 0 + | h::t -> + (int_of_char (String.get h 0) + prime200*( hashll t)) mod prime in + fun s -> + let slt = explode s in + hashll slt;; + +let saved_hashstring = + ref ((Hashtbl.create 300):(string,int) Hashtbl.t);; +let save_hashstring string = + Hashtbl.add !saved_hashstring (string) (hash_of_string string);; +let mem_hashstring s = Hashtbl.mem !saved_hashstring s;; +let remove_hashstring s = Hashtbl.remove !saved_hashstring s;; +let find_hashstring s = Hashtbl.find !saved_hashstring s;; + +let memhash_of_string s = + if not(mem_hashstring s) then (save_hashstring s) ; + find_hashstring s;; + +let hash_of_type = + let prime150 = 863 in + let prime160 = 941 in + let prime180 = 1069 in + let prime190 = 1151 in + let prime1200 = 9733 in + let rec hashl u = match u with + | [] -> 0 + | h::t -> ((hasht h) + prime190*(hashl t)) mod prime1200 + and + hasht v = match v with + | Tyvar s -> (prime150*memhash_of_string s + prime160) mod prime1200 + | Tyapp (s,tlt) -> let h = memhash_of_string s in + let h2 = (h*h) mod prime1200 in + (prime180*h2 + hashl tlt ) mod prime1200 in + hasht;; + +(* make hash_of_term constant on alpha-equivalence classes of + terms *) + +let rename_var n = + fun v -> mk_var ("??_"^(string_of_int n),type_of v);; + +let paform = + let rec raform n env tm = + match tm with + | Var(_,_) -> assocd tm env tm + | Const(_,_) -> tm + | Comb (s,t) -> mk_comb(raform n env s, raform n env t) + | Abs (x,t) -> let x1 = rename_var n x in + mk_abs(x1, raform (n+1) ((x,x1)::env) t) in + raform 0 [];; + +let hash_of_term = + let prime1220 = 9887 in + let prime210 = 1291 in + let prime220 = 1373 in + let prime230 = 1451 in + let prime240 = 1511 in + let prime250 = 1583 in + let prime260 = 1657 in + let prime270 = 1733 in + let prime280 = 1811 in + let rec hasht u = match u with + | Var (s,t) -> + (prime210*(memhash_of_string s) + hash_of_type t) mod prime1220 + | Const (s,t) -> + (prime220*(memhash_of_string s) + hash_of_type t) mod prime1220 + | Comb (s,t) -> let h = hasht s in + let h2 = (h*h) mod prime1220 in + (prime230*h2 + prime240*hasht t + prime250) mod prime1220 + | Abs (s,t) -> let h = hasht s in + let h2 = (h*h) mod prime1220 in + (prime260*h2 + prime270*hasht t + prime280) mod prime1220 + in hasht o paform;; + +end;; diff --git a/text_formalization/jordan/lib_ext.hl b/text_formalization/jordan/lib_ext.hl new file mode 100644 index 0000000..999c402 --- /dev/null +++ b/text_formalization/jordan/lib_ext.hl @@ -0,0 +1,79 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Jordan *) +(* Copied from HOL Light jordan directory *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-08 *) +(* ========================================================================== *) + +module Lib_ext = struct + +let rec drop i list = + match (i,list) with (_,[]) -> failwith "drop null" + | (0,a::b) -> b + | (i,a::b) -> a::(drop (i-1) b);; + +let rec take i j = + function + [] -> [] | + a::b -> match (i,j) with + (0,0) -> [] | + (0,j) -> a::(take 0 (j-1) b) | + _ -> take (i-1) (j-1) b;; + +let cannot f x = try (f x; false) with Failure _ -> true;; + +(* ------------------------------------------------------------------ *) +(* UNIT TESTS *) +(* ------------------------------------------------------------------ *) + +let new_test_suite() = + let t = ref ([]:(string*bool) list) in + let add_test (s,f) = (t:= ((s,f)::!t)) in + let eval (s,f) = if f then () else failwith ("test suite: "^s) in + let test() = (ignore (List.map eval (!t));()) in + add_test,test;; + +let add_test,test = new_test_suite();; + + +(* ------------------------------------------------------------------ *) +(* LOCAL DEFINITIONS *) +(* ------------------------------------------------------------------ *) + +let local_defs = ref ([]:(string * (string * term)) list);; + +let add_interface (sym,tm) = + if (can (assoc sym) (!the_overload_skeletons)) then + (overload_interface (sym,tm)) + else (override_interface(sym,tm));; + +let local_definition package_name tm = + let list_mk_forall(vars,bod) = itlist (curry mk_forall) vars bod in + let avs,bod = strip_forall tm in + let l,r = try dest_eq bod + with Failure _ -> failwith "new_local_definition: Not an equation" in + let lv,largs = strip_comb l in + let cname,ty = dest_var lv in + let cname' = package_name^"'"^cname in + let lv' = mk_var(cname',ty) in + let l' = list_mk_comb(lv',largs) in + let bod' = mk_eq(l',r) in + let tm'= list_mk_forall(avs,bod') in + let thm = new_definition tm' in + let _ = (local_defs := (package_name,(cname,lv'))::(!local_defs)) in + let _ = add_interface(cname,lv') in + thm;; + +let reduce_local_interface(package_name) = + map (reduce_interface o snd) + (filter (fun x -> ((fst x) = package_name)) !local_defs);; + +let mk_local_interface(package_name) = + map (add_interface o snd) + (filter (fun x -> ((fst x) = package_name)) !local_defs);; + + + +end;; diff --git a/text_formalization/jordan/make.hl b/text_formalization/jordan/make.hl new file mode 100644 index 0000000..a702657 --- /dev/null +++ b/text_formalization/jordan/make.hl @@ -0,0 +1,33 @@ +(* ========================================================================= *) +(* The Jordan Curve Theorem *) +(* *) +(* Proof by Tom Hales *) +(* *) +(* A few tweaks by John Harrison for the latest HOL Light *) +(* ========================================================================= *) + +(*** Standard HOL Light library ***) + + +(*** New stuff ***) + +needs "Rqe/num_calc_simp.ml";; + +flyspeck_needs "jordan/tactics_refine.ml";; +flyspeck_needs "jordan/lib_ext.ml";; +flyspeck_needs "jordan/tactics_fix.ml";; +flyspeck_needs "jordan/parse_ext_override_interface.ml";; +flyspeck_needs "jordan/tactics_ext.ml";; +flyspeck_needs "jordan/num_ext_gcd.ml";; +flyspeck_needs "jordan/num_ext_nabs.ml";; +flyspeck_needs "jordan/real_ext_geom_series.ml";; +flyspeck_needs "jordan/real_ext.ml";; +flyspeck_needs "jordan/float.ml";; +flyspeck_needs "jordan/tactics_ext2.ml";; +flyspeck_needs "jordan/misc_defs_and_lemmas.ml";; + +(* (* need to be reworked. These don't currently load *) +flyspeck_needs "Jordan/compute_pi.ml";; +flyspeck_needs "Jordan/metric_spaces.ml";; +flyspeck_needs "Jordan/jordan_curve_theorem.ml";; +*) diff --git a/text_formalization/jordan/misc_defs_and_lemmas.hl b/text_formalization/jordan/misc_defs_and_lemmas.hl new file mode 100644 index 0000000..6894e11 --- /dev/null +++ b/text_formalization/jordan/misc_defs_and_lemmas.hl @@ -0,0 +1,1792 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Jordan *) +(* Copied from HOL Light jordan directory *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-08 *) +(* ========================================================================== *) + +(* +The file in the HOL Light distribution is longer, with results about +Euclidan space that are not relevant here. + +May 7, 2011, renamed INV -> INVERSE to avoid clash with HOL Library/rstc.ml +*) + +module Misc_defs_and_lemmas = struct + +open Tactics_jordan;; +open Tactics_jordan;; +open Parse_ext_override_interface;; +(* open Refinement;; *) +open Real_ext;; +open Float;; + +(* labels_flag:= true;; *) + +let prove_by_refinement = Refinement.enhanced_prove_by_refinement true ALL_TAC;; + +let LABEL_ALL_TAC = Refinement.LABEL_ALL_TAC;; + +unambiguous_interface();; + + +let dirac_delta = new_definition `dirac_delta i = + \j. if (i=j) then &1 else &0`;; + +(* +let dirac_delta = new_definition `dirac_delta (i:num) j = + if (i=j) then &. 1 else &. 0`;; +*) + +(* +let dirac_delta = prove_by_refinement(`!i. dirac_delta i = + (\j. if (i=j) then &. 1 else &. 0)`, + [ + GEN_TAC; + ONCE_REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[dirac_delta_thm]; + BETA_TAC; + ] );; +*) + +let min_num = new_definition + `min_num (X:num->bool) = @m. (m IN X) /\ (!n. (n IN X) ==> (m <= n))`;; + +let min_least = prove_by_refinement ( + `!(X:num->bool) c. (X c) ==> (X (min_num X) /\ (min_num X <=| c))`, + (* {{{ proof *) + + [ + REWRITE_TAC[min_num;IN]; + REPEAT GEN_TAC; + DISCH_TAC; + SUBGOAL_THEN `?n. (X:num->bool) n /\ (!m. m <| n ==> ~X m)` MP_TAC; + REWRITE_TAC[(GSYM (ISPEC `X:num->bool` num_WOP))]; + ASM_MESON_TAC[]; + DISCH_THEN CHOOSE_TAC; + ASSUME_TAC (select_thm `\m. (X:num->bool) m /\ (!n. X n ==> m <=| n)` `n:num`); + ABBREV_TAC `r = @m. (X:num->bool) m /\ (!n. X n ==> m <=| n)`; + ASM_MESON_TAC[ ARITH_RULE `~(n' < n) ==> (n <=| n') `] + ]);; + + (* }}} *) + +let max_real = new_definition(`max_real x y = + if (y <. x) then x else y`);; + +let min_real = new_definition(`min_real x y = + if (x <. y) then x else y`);; + +(* let deriv = new_definition(`deriv f x = @d. (f diffl d)(x)`);; +let deriv2 = new_definition(`deriv2 f = (deriv (deriv f))`);; *) + +let square_le = prove_by_refinement( + `!x y. (&.0 <=. x) /\ (&.0 <=. y) /\ (x*.x <=. y*.y) ==> (x <=. y)`, + (* {{{ proof *) + + [ + DISCH_ALL_TAC; + UNDISCH_FIND_TAC `( *. )` ; + ONCE_REWRITE_TAC[REAL_ARITH `(a <=. b) <=> (&.0 <= (b - a))`]; + REWRITE_TAC[GSYM REAL_DIFFSQ]; + DISCH_TAC; + DISJ_CASES_TAC (REAL_ARITH `&.0 < (y+x) \/ (y+x <=. (&.0))`); + MATCH_MP_TAC (SPEC `(y+x):real` REAL_LE_LCANCEL_IMP); + ASM_REWRITE_TAC [REAL_ARITH `x * (&.0) = (&.0)`]; + CLEAN_ASSUME_TAC (REAL_ARITH `(&.0 <= y) /\ (&.0 <=. x) /\ (y+x <= (&.0)) ==> ((x= &.0) /\ (y= &.0))`); + ASM_REWRITE_TAC[REAL_ARITH `&.0 <=. (&.0 -. (&.0))`]; + ]);; + + (* }}} *) + +let max_num_sequence = prove_by_refinement( + `!(t:num->num). (?n. !m. (n <=| m) ==> (t m = 0)) ==> + (?M. !i. (t i <=| M))`, + (* {{{ proof *) + [ + GEN_TAC; + REWRITE_TAC[GSYM LEFT_FORALL_IMP_THM]; + GEN_TAC; + SPEC_TAC (`t:num->num`,`t:num->num`); + SPEC_TAC (`n:num`,`n:num`); + INDUCT_TAC; + GEN_TAC; + REWRITE_TAC[ARITH_RULE `0<=|m`]; + DISCH_TAC; + EXISTS_TAC `0`; + ASM_MESON_TAC[ARITH_RULE`(a=0) ==> (a <=|0)`]; + DISCH_ALL_TAC; + ABBREV_TAC `b = \m. (if (m=n) then 0 else (t (m:num)) )`; + FIRST_ASSUM (fun t-> ASSUME_TAC (SPEC `b:num->num` t)); + SUBGOAL_MP_TAC `((b:num->num) (n) = 0) /\ (!m. ~(m=n) ==> (b m = t m))`; + EXPAND_TAC "b"; + CONJ_TAC; + COND_CASES_TAC; + REWRITE_TAC[]; + ASM_MESON_TAC[]; + GEN_TAC; + COND_CASES_TAC; + REWRITE_TAC[]; + REWRITE_TAC[]; + DISCH_ALL_TAC; + FIRST_ASSUM (fun t-> MP_TAC(SPEC `b:num->num` t)); + SUBGOAL_MP_TAC `!m. (n<=|m) ==> (b m =0)`; + GEN_TAC; + ASM_CASES_TAC `m = (n:num)`; + ASM_REWRITE_TAC[]; + SUBGOAL_MP_TAC ( `(n <=| m) /\ (~(m = n)) ==> (SUC n <=| m)`); + ARITH_TAC; + ASM_REWRITE_TAC[]; + DISCH_ALL_TAC; + ASM_MESON_TAC[]; (* good *) + DISCH_THEN (fun t-> REWRITE_TAC[t]); + DISCH_THEN CHOOSE_TAC; + EXISTS_TAC `(M:num) + (t:num->num) n`; + GEN_TAC; + ASM_CASES_TAC `(i:num) = n`; + ASM_REWRITE_TAC[]; + ARITH_TAC; + MATCH_MP_TAC (ARITH_RULE `x <=| M ==> (x <=| M+ u)`); + ASM_MESON_TAC[]; + ]);; + (* }}} *) + +let REAL_INV_LT = prove_by_refinement( + `!x y z. (&.0 <. x) ==> ((inv(x)*y < z) <=> (y <. x*z))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + DISCH_TAC; + REWRITE_TAC[REAL_ARITH `inv x * y = y* inv x`]; + REWRITE_TAC[GSYM real_div]; + ASM_SIMP_TAC[REAL_LT_LDIV_EQ]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let REAL_MUL_NN = prove_by_refinement( + `!x y. (&.0 <= x*y) <=> + ((&.0 <= x /\ (&.0 <=. y)) \/ ((x <= &.0) /\ (y <= &.0) ))`, + (* {{{ proof *) + [ + DISCH_ALL_TAC; + SUBGOAL_MP_TAC `! x y. ((&.0 < x) ==> ((&.0 <= x*y) <=> ((&.0 <= x /\ (&.0 <=. y)) \/ ((x <= &.0) /\ (y <= &.0) ))))`; + DISCH_ALL_TAC; + ASM_SIMP_TAC[REAL_ARITH `((&.0 <. x) ==> (&.0 <=. x))`;REAL_ARITH `(&.0 <. x) ==> ~(x <=. &.0)`]; + EQ_TAC; + ASM_MESON_TAC[REAL_PROP_NN_LCANCEL]; + ASM_MESON_TAC[REAL_LE_MUL;REAL_LT_IMP_LE]; + DISCH_TAC; + DISJ_CASES_TAC (REAL_ARITH `(&.0 < x) \/ (x = &.0) \/ (x < &.0)`); + ASM_MESON_TAC[]; + UND 1 THEN DISCH_THEN DISJ_CASES_TAC; + ASM_REWRITE_TAC[]; + REAL_ARITH_TAC; + ASM_SIMP_TAC[REAL_ARITH `((x <. &.0) ==> ~(&.0 <=. x))`;REAL_ARITH `(x <. &.0) ==> (x <=. &.0)`]; + USE 0 (SPECL [`--. (x:real)`;`--. (y:real)`]); + UND 0; + REDUCE_TAC; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[REAL_ARITH `((x <. &.0) ==> ~(&.0 <=. x))`;REAL_ARITH `(x <. &.0) ==> (x <=. &.0)`]; + ]);; + (* }}} *) + +let ABS_SQUARE = prove_by_refinement( + `!t u. abs(t) <. u ==> t*t <. u*u`, + (* {{{ proof *) + + [ + REP_GEN_TAC; + CONV_TAC (SUBS_CONV[SPEC `t:real` (REWRITE_RULE[POW_2] (GSYM REAL_POW2_ABS))]); + ASSUME_TAC REAL_ABS_POS; + USE 0 (SPEC `t:real`); + ABBREV_TAC `(b:real) = (abs t)`; + KILL 1; + DISCH_ALL_TAC; + MATCH_MP_TAC REAL_PROP_LT_LRMUL; + ASM_REWRITE_TAC[]; + ]);; + + (* }}} *) + +let ABS_SQUARE_LE = prove_by_refinement( + `!t u. abs(t) <=. u ==> t*t <=. u*u`, + (* {{{ proof *) + + [ + REP_GEN_TAC; + CONV_TAC (SUBS_CONV[SPEC `t:real` (REWRITE_RULE[POW_2] (GSYM REAL_POW2_ABS))]); + ASSUME_TAC REAL_ABS_POS; + USE 0 (SPEC `t:real`); + ABBREV_TAC `(b:real) = (abs t)`; + KILL 1; + DISCH_ALL_TAC; + MATCH_MP_TAC REAL_PROP_LE_LRMUL; + ASM_REWRITE_TAC[]; + ]);; + + (* }}} *) + +let POW_2_LE1 = REAL_LE_POW2;; + +let REAL_ADD = REAL_OF_NUM_ADD;; + +let POW_2_LT = prove_by_refinement( + `!n. &n < &2 pow n`, + [ + INDUCT_TAC; + REWRITE_TAC[pow; REAL_LT_01] ; + REWRITE_TAC[pow;ADD1; GSYM REAL_ADD; GSYM REAL_DOUBLE]; + MATCH_MP_TAC REAL_LTE_ADD2; + ASM_REWRITE_TAC[POW_2_LE1]; + ]);; + + +let twopow_eps = prove_by_refinement( + `!R e. ?n. (&.0 <. R)/\ (&.0 <. e) ==> R*(twopow(--: (&:n))) <. e`, + (* {{{ proof *) + + [ + DISCH_ALL_TAC; + REWRITE_TAC[TWOPOW_NEG]; (* cs6b *) + ASSUME_TAC (prove(`!n. &.0 < &.2 pow n`,REDUCE_TAC THEN ARITH_TAC)); + ONCE_REWRITE_TAC[REAL_MUL_AC]; + ASM_SIMP_TAC[REAL_INV_LT]; + ASM_SIMP_TAC[GSYM REAL_LT_LDIV_EQ]; + CONV_TAC (quant_right_CONV "n"); + DISCH_ALL_TAC; + ASSUME_TAC (SPEC `R/e` REAL_ARCH_SIMPLE); + CHO 3; + EXISTS_TAC `n:num`; + UND 3; + MESON_TAC[POW_2_LT;REAL_LET_TRANS]; + ]);; + + (* }}} *) + + +(* ------------------------------------------------------------------ *) +(* finite products, in imitation of finite sums *) +(* ------------------------------------------------------------------ *) + +let prod_EXISTS = prove_by_refinement( + `?prod. (!f n. prod(n,0) f = &1) /\ + (!f m n. prod(n,SUC m) f = prod(n,m) f * f(n + m))`, +(* {{{ proof *) + [ + (CHOOSE_TAC o prove_recursive_functions_exist num_RECURSION) `(!f n. sm n 0 f = &1) /\ (!f m n. sm n (SUC m) f = sm n m f * f(n + m))` ; + EXISTS_TAC `\(n,m) f. (sm:num->num->(num->real)->real) n m f`; + CONV_TAC(DEPTH_CONV GEN_BETA_CONV) THEN ASM_REWRITE_TAC[] + ]);; +(* }}} *) + +let prod_DEF = new_specification ["prod"] prod_EXISTS;; + +let prod = prove + (`!n m. (prod(n,0) f = &1) /\ + (prod(n,SUC m) f = prod(n,m) f * f(n + m))`, +(* {{{ proof *) + REWRITE_TAC[prod_DEF]);; +(* }}} *) + +let PROD_TWO = prove_by_refinement( + `!f n p. prod(0,n) f * prod(n,p) f = prod(0,n + p) f`, +(* {{{ proof *) + [ + GEN_TAC THEN GEN_TAC THEN INDUCT_TAC THEN REWRITE_TAC[prod; REAL_MUL_RID; MULT_CLAUSES;ADD_0]; + REWRITE_TAC[ARITH_RULE `n+| (SUC p) = (SUC (n+|p))`;prod;ARITH_RULE `0+|n = n`]; + ASM_REWRITE_TAC[REAL_MUL_ASSOC]; +]);; +(* }}} *) + + +let ABS_PROD = prove_by_refinement( + `!f m n. abs(prod(m,n) f) = prod(m,n) (\n. abs(f n))`, +(* {{{ proof *) + [ + GEN_TAC THEN GEN_TAC THEN INDUCT_TAC; + REWRITE_TAC[prod]; + REAL_ARITH_TAC; + ASM_REWRITE_TAC[prod;ABS_MUL] + ]);; +(* }}} *) + +let PROD_EQ = prove_by_refinement + (`!f g m n. (!r. m <= r /\ r < (n + m) ==> (f(r) = g(r))) + ==> (prod(m,n) f = prod(m,n) g)`, +(* {{{ proof *) + + [ + GEN_TAC THEN GEN_TAC THEN GEN_TAC THEN INDUCT_TAC THEN REWRITE_TAC[prod]; + REWRITE_TAC[prod]; + DISCH_THEN (fun th -> MP_TAC th THEN (MP_TAC (SPEC `m+|n` th))); + REWRITE_TAC[ARITH_RULE `(m<=| (m+|n))/\ (m +| n <| (SUC n +| m))`]; + DISCH_ALL_TAC; + ASM_REWRITE_TAC[]; + AP_THM_TAC THEN AP_TERM_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + GEN_TAC THEN DISCH_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_MESON_TAC[ARITH_RULE `r <| (n+| m) ==> (r <| (SUC n +| m))`] + ]);; + +(* }}} *) + +let PROD_POS = prove_by_refinement + (`!f. (!n. &0 <= f(n)) ==> !m n. &0 <= prod(m,n) f`, +(* {{{ proof *) + + [ + GEN_TAC THEN DISCH_TAC THEN GEN_TAC THEN INDUCT_TAC THEN REWRITE_TAC[prod]; + REAL_ARITH_TAC; + ASM_MESON_TAC[REAL_LE_MUL] + ]);; +(* }}} *) + +let PROD_POS_GEN = prove_by_refinement + (`!f m n. + (!n. m <= n ==> &0 <= f(n)) + ==> &0 <= prod(m,n) f`, +(* {{{ proof *) + + [ + REPEAT STRIP_TAC THEN SPEC_TAC(`n:num`,`n:num`) THEN INDUCT_TAC THEN REWRITE_TAC[prod]; + REAL_ARITH_TAC; + ASM_MESON_TAC[REAL_LE_MUL;ARITH_RULE `m <=| (m +| n)`] + ]);; +(* }}} *) + + +let PROD_ABS = prove + (`!f m n. abs(prod(m,n) (\m. abs(f m))) = prod(m,n) (\m. abs(f m))`, +(* {{{ proof *) + REWRITE_TAC[ABS_PROD;REAL_ARITH `||. (||. x) = (||. x)`]);; +(* }}} *) + +let PROD_ZERO = prove_by_refinement + (`!f m n. (?p. (m <= p /\ (p < (n+| m)) /\ (f p = (&.0)))) ==> + (prod(m,n) f = &0)`, +(* {{{ proof *) + [ + GEN_TAC THEN GEN_TAC THEN INDUCT_TAC THEN (REWRITE_TAC[prod]); + ARITH_TAC; + DISCH_THEN CHOOSE_TAC; + ASM_CASES_TAC `p <| (n+| m)`; + MATCH_MP_TAC (prove (`(x = (&.0)) ==> (x *. y = (&.0))`,(DISCH_THEN (fun th -> (REWRITE_TAC[th]))) THEN REAL_ARITH_TAC)); + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_MESON_TAC[]; + POP_ASSUM (fun th -> ASSUME_TAC (MATCH_MP (ARITH_RULE `(~(p <| (n+|m)) ==> ((p <| ((SUC n) +| m)) ==> (p = ((m +| n)))))`) th)); + MATCH_MP_TAC (prove (`(x = (&.0)) ==> (y *. x = (&.0))`,(DISCH_THEN (fun th -> (REWRITE_TAC[th]))) THEN REAL_ARITH_TAC)); + ASM_MESON_TAC[] + ]);; +(* }}} *) + +let PROD_MUL = prove_by_refinement( + `!f g m n. prod(m,n) (\n. f(n) * g(n)) = prod(m,n) f * prod(m,n) g`, + (* {{{ proof *) + [ + EVERY(replicate GEN_TAC 3) THEN INDUCT_TAC THEN ASM_REWRITE_TAC[prod]; + REAL_ARITH_TAC; + REWRITE_TAC[REAL_MUL_AC]; + ]);; + (* }}} *) + +let PROD_CMUL = prove_by_refinement( + `!f c m n. prod(m,n) (\n. c * f(n)) = (c **. n) * prod(m,n) f`, + (* {{{ proof *) + [ + EVERY(replicate GEN_TAC 3) THEN INDUCT_TAC THEN ASM_REWRITE_TAC[prod;pow]; + REAL_ARITH_TAC; + REWRITE_TAC[REAL_MUL_AC]; + ]);; + (* }}} *) + +(* ------------------------------------------------------------------ *) +(* LEMMAS ABOUT SETS *) +(* ------------------------------------------------------------------ *) + +(* IN_ELIM_THM produces garbled results at times. I like this better: *) + +(*** JRH replaced this with the "new" IN_ELIM_THM; see how it works. + +let IN_ELIM_THM' = prove_by_refinement( + `(!P. !x:A. x IN (GSPEC P) <=> P x) /\ + (!P. !x:A. x IN (\x. P x) <=> P x) /\ + (!P. !x:A. (GSPEC P) x <=> P x) /\ + (!P (x:A) (t:A). (\t. (?y:A. P y /\ (t = y))) x <=> P x)`, + (* {{{ proof *) + [ + REWRITE_TAC[IN; GSPEC]; + MESON_TAC[]; + ]);; + (* }}} *) + + ****) + +let IN_ELIM_THM' = IN_ELIM_THM;; + +let SURJ_IMAGE = prove_by_refinement( + `!(f:A->B) a b. SURJ f a b ==> (b = (IMAGE f a))`, +(* {{{ proof *) + + [ + REPEAT GEN_TAC; + REWRITE_TAC[SURJ;IMAGE]; + DISCH_ALL_TAC; + REWRITE_TAC[EXTENSION]; + GEN_TAC; + REWRITE_TAC[IN_ELIM_THM]; + ASM_MESON_TAC[]] + +(* }}} *) +);; + + +let SURJ_FINITE = prove_by_refinement( + `!a b (f:A->B). FINITE a /\ (SURJ f a b) ==> FINITE b`, +(* {{{ *) + + [ + ASM_MESON_TAC[SURJ_IMAGE;FINITE_IMAGE] + ]);; + +(* }}} *) + +let BIJ_INVERSE = prove_by_refinement( + `!a b (f:A->B). (SURJ f a b) ==> (?(g:B->A). (INJ g b a))`, +(* {{{ proof *) + + [ + REPEAT GEN_TAC; + DISCH_ALL_TAC; + SUBGOAL_THEN `!y. ?u. ((y IN b) ==> ((u IN a) /\ ((f:A->B) u = y)))` ASSUME_TAC; + ASM_MESON_TAC[SURJ]; + LABEL_ALL_TAC; + H_REWRITE_RULE[THM SKOLEM_THM] (HYP "1"); + LABEL_ALL_TAC; + H_UNDISCH_TAC (HYP"2"); + DISCH_THEN CHOOSE_TAC; + EXISTS_TAC `u:B->A`; + REWRITE_TAC[INJ] THEN CONJ_TAC THEN (ASM_MESON_TAC[]) + ] + +(* }}} *) +);; + +(* complement of an intersection is a union of complements *) +let UNIONS_INTERS = prove_by_refinement( + `!(X:A->bool) V. + (X DIFF (INTERS V) = UNIONS (IMAGE ((DIFF) X) V))`, +(* {{{ proof *) + + [ + REPEAT GEN_TAC; + MATCH_MP_TAC SUBSET_ANTISYM; + CONJ_TAC; + REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM]; + X_GEN_TAC `c:A`; + REWRITE_TAC[IN_DIFF;IN_INTERS;IN_UNIONS;NOT_FORALL_THM]; + DISCH_ALL_TAC; + UNDISCH_FIND_THEN `(?)` CHOOSE_TAC; + EXISTS_TAC `(X DIFF t):A->bool`; + REWRITE_TAC[IN_ELIM_THM]; + CONJ_TAC; + EXISTS_TAC `t:A->bool`; + ASM_MESON_TAC[]; + REWRITE_TAC[IN_DIFF]; + ASM_MESON_TAC[]; + REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM]; + X_GEN_TAC `c:A`; + REWRITE_TAC[IN_DIFF;IN_UNIONS]; + DISCH_THEN CHOOSE_TAC; + UNDISCH_FIND_TAC `(IN)`; + REWRITE_TAC[IN_INTERS;IN_ELIM_THM]; + DISCH_ALL_TAC; + UNDISCH_FIND_THEN `(?)` CHOOSE_TAC; + CONJ_TAC; + ASM_MESON_TAC[SUBSET_DIFF;SUBSET]; + REWRITE_TAC[NOT_FORALL_THM]; + EXISTS_TAC `x:A->bool`; + ASM_MESON_TAC[IN_DIFF]; + ]);; + +(* }}} *) + +let INTERS_SUBSET = prove_by_refinement ( + `!X (A:A->bool). (A IN X) ==> (INTERS X SUBSET A)`, +(* {{{ *) + [ + REPEAT GEN_TAC; + REWRITE_TAC[SUBSET;IN_INTERS]; + MESON_TAC[IN]; + ]);; +(* }}} *) + +let sub_union = prove_by_refinement( + `!X (U:(A->bool)->bool). (U X) ==> (X SUBSET (UNIONS U))`, +(* {{{ *) + [ + DISCH_ALL_TAC; + REWRITE_TAC[SUBSET;IN_ELIM_THM;UNIONS]; + REWRITE_TAC[IN]; + DISCH_ALL_TAC; + EXISTS_TAC `X:A->bool`; + ASM_REWRITE_TAC[]; + ]);; +(* }}} *) + +let IMAGE_SURJ = prove_by_refinement( + `!(f:A->B) a. SURJ f a (IMAGE f a)`, +(* {{{ *) + [ + REWRITE_TAC[SURJ;IMAGE;IN_ELIM_THM]; + MESON_TAC[IN]; + ]);; +(* }}} *) + +let SUBSET_PREIMAGE = prove_by_refinement( + `!(f:A->B) X Y. (Y SUBSET (IMAGE f X)) ==> + (?Z. (Z SUBSET X) /\ (Y = IMAGE f Z))`, +(* {{{ proof *) + [ + DISCH_ALL_TAC; + EXISTS_TAC `{x | (x IN (X:A->bool))/\ (f x IN (Y:B->bool)) }`; + CONJ_TAC; + REWRITE_TAC[SUBSET;IN_ELIM_THM]; + MESON_TAC[]; + REWRITE_TAC[EXTENSION]; + X_GEN_TAC `y:B`; + UNDISCH_FIND_TAC `(SUBSET)`; + REWRITE_TAC[SUBSET;IN_IMAGE]; + REWRITE_TAC[IN_ELIM_THM]; + DISCH_THEN (fun t-> MP_TAC (SPEC `y:B` t)); + MESON_TAC[]; + ]);; +(* }}} *) + +let UNIONS_INTER = prove_by_refinement( + `!(U:(A->bool)->bool) A. (((UNIONS U) INTER A) = + (UNIONS (IMAGE ((INTER) A) U)))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + MATCH_MP_TAC (prove(`((C SUBSET (B:A->bool)) /\ (C SUBSET A) /\ ((A INTER B) SUBSET C)) ==> ((B INTER A) = C)`,SET_TAC[])); + CONJ_TAC; + REWRITE_TAC[SUBSET;UNIONS;IN_ELIM_THM]; + REWRITE_TAC[IN_IMAGE]; + SET_TAC[]; + REWRITE_TAC[SUBSET;UNIONS;IN_IMAGE]; + CONJ_TAC; + REWRITE_TAC[IN_ELIM_THM]; + X_GEN_TAC `y:A`; + DISCH_THEN CHOOSE_TAC; + ASM_MESON_TAC[IN_INTER]; + REWRITE_TAC[IN_INTER]; + REWRITE_TAC[IN_ELIM_THM]; + X_GEN_TAC `y:A`; + DISCH_ALL_TAC; + UNDISCH_FIND_THEN `(?)` CHOOSE_TAC; + EXISTS_TAC `A INTER (u:A->bool)`; + ASM SET_TAC[]; + ]);; +(* }}} *) + +let UNIONS_SUBSET = prove_by_refinement( + `!U (X:A->bool). (!A. (A IN U) ==> (A SUBSET X)) ==> (UNIONS U SUBSET X)`, +(* {{{ *) + [ + REPEAT GEN_TAC; + SET_TAC[]; + ]);; +(* }}} *) + +let SUBSET_INTER = prove_by_refinement( + `!X A (B:A->bool). (X SUBSET (A INTER B)) <=> (X SUBSET A) /\ (X SUBSET B)`, +(* {{{ *) + [ + REWRITE_TAC[SUBSET;INTER;IN_ELIM_THM]; + MESON_TAC[IN]; + ]);; +(* }}} *) + +let EMPTY_EXISTS = prove_by_refinement( + `!X. ~(X = {}) <=> (? (u:A). (u IN X))`, +(* {{{ *) + [ + REWRITE_TAC[EXTENSION]; + REWRITE_TAC[IN;EMPTY]; + MESON_TAC[]; + ]);; +(* }}} *) + +let UNIONS_UNIONS = prove_by_refinement( + `!A B. (A SUBSET B) ==>(UNIONS (A:(A->bool)->bool) SUBSET (UNIONS B))`, +(* {{{ *) + [ + REWRITE_TAC[SUBSET;UNIONS;IN_ELIM_THM]; + MESON_TAC[IN]; + ]);; +(* }}} *) + + +(* nested union can flatten from outside in, or inside out *) +let UNIONS_IMAGE_UNIONS = prove_by_refinement( + `!(X:((A->bool)->bool)->bool). + UNIONS (UNIONS X) = (UNIONS (IMAGE UNIONS X))`, + (* {{{ proof *) + [ + GEN_TAC; + REWRITE_TAC[EXTENSION;IN_UNIONS]; + GEN_TAC; + REWRITE_TAC[EXTENSION;IN_UNIONS]; + EQ_TAC; + DISCH_THEN (CHOOSE_THEN MP_TAC); + DISCH_ALL_TAC; + FIRST_ASSUM MP_TAC; + DISCH_THEN CHOOSE_TAC; + EXISTS_TAC `UNIONS (t':(A->bool)->bool)`; + REWRITE_TAC[IN_UNIONS;IN_IMAGE]; + CONJ_TAC; + EXISTS_TAC `(t':(A->bool)->bool)`; + ASM_REWRITE_TAC[]; + ASM_MESON_TAC[]; + DISCH_THEN CHOOSE_TAC; + FIRST_ASSUM MP_TAC; + REWRITE_TAC[IN_IMAGE]; + DISCH_ALL_TAC; + FIRST_ASSUM MP_TAC; + DISCH_THEN CHOOSE_TAC; + UNDISCH_TAC `(x:A) IN t`; + FIRST_ASSUM (fun t-> REWRITE_TAC[t]); + REWRITE_TAC[IN_UNIONS]; + DISCH_THEN (CHOOSE_TAC); + EXISTS_TAC `t':(A->bool)`; + CONJ_TAC; + EXISTS_TAC `x':(A->bool)->bool`; + ASM_REWRITE_TAC[]; + ASM_REWRITE_TAC[]; + ]);; +(* }}} *) + + +let INTERS_SUBSET2 = prove_by_refinement( + `!X A. (?(x:A->bool). (A x /\ (x SUBSET X))) ==> ((INTERS A) SUBSET X)`, + (* {{{ proof *) + [ + REWRITE_TAC[SUBSET;INTERS;IN_ELIM_THM']; + REWRITE_TAC[IN]; + MESON_TAC[]; + ]);; + (* }}} *) + +(**** New proof by JRH; old one breaks because of new set comprehensions + +let INTERS_EMPTY = prove_by_refinement( + `INTERS EMPTY = (UNIV:A->bool)`, + (* {{{ proof *) + [ + REWRITE_TAC[INTERS;NOT_IN_EMPTY;IN_ELIM_THM';]; + REWRITE_TAC[UNIV;GSPEC]; + MATCH_MP_TAC EQ_EXT; + GEN_TAC; + REWRITE_TAC[IN_ELIM_THM']; + MESON_TAC[]; + ]);; + (* }}} *) + + ****) + +let INTERS_EMPTY = prove_by_refinement( + `INTERS EMPTY = (UNIV:A->bool)`, + [SET_TAC[]]);; + +let preimage = new_definition `preimage dom (f:A->B) + Z = {x | (x IN dom) /\ (f x IN Z)}`;; + +let in_preimage = prove_by_refinement( + `!f x Z dom. x IN (preimage dom (f:A->B) Z) <=> (x IN dom) /\ (f x IN Z)`, +(* {{{ *) + [ + REWRITE_TAC[preimage]; + REWRITE_TAC[IN_ELIM_THM'] + ]);; +(* }}} *) + +(* Partial functions, which we identify with functions that + take the canonical choice of element outside the domain. *) + +let supp = new_definition + `supp (f:A->B) = \ x. ~(f x = (CHOICE (UNIV:B ->bool)) )`;; + +let func = new_definition + `func a b = (\ (f:A->B). ((!x. (x IN a) ==> (f x IN b)) /\ + ((supp f) SUBSET a))) `;; + + +(* relations *) +let reflexive = new_definition + `reflexive (f:A->A->bool) <=> (!x. f x x)`;; + +let symmetric = new_definition + `symmetric (f:A->A->bool) <=> (!x y. f x y ==> f y x)`;; + +let transitive = new_definition + `transitive (f:A->A->bool) <=> (!x y z. f x y /\ f y z ==> f x z)`;; + +let equivalence_relation = new_definition + `equivalence_relation (f:A->A->bool) <=> + (reflexive f) /\ (symmetric f) /\ (transitive f)`;; + +(* We do not introduce the equivalence class of f explicitly, because + it is represented directly in HOL by (f a) *) + +let partition_DEF = new_definition + `partition (A:A->bool) SA <=> (UNIONS SA = A) /\ + (!a b. ((a IN SA) /\ (b IN SA) /\ (~(a = b)) ==> ({} = (a INTER b))))`;; + +let DIFF_DIFF2 = prove_by_refinement( + `!X (A:A->bool). (A SUBSET X) ==> ((X DIFF (X DIFF A)) = A)`, + [ + SET_TAC[] + ]);; + +(*** Old proof replaced by JRH: no longer UNWIND_THM[12] clause in IN_ELIM_THM + +let GSPEC_THM = prove_by_refinement( + `!P (x:A). (?y. P y /\ (x = y)) <=> P x`, + [REWRITE_TAC[IN_ELIM_THM]]);; + +***) + +let GSPEC_THM = prove_by_refinement( + `!P (x:A). (?y. P y /\ (x = y)) <=> P x`, + [MESON_TAC[]]);; + +let CARD_GE_REFL = prove + (`!s:A->bool. s >=_c s`, + GEN_TAC THEN REWRITE_TAC[GE_C] THEN + EXISTS_TAC `\x:A. x` THEN MESON_TAC[]);; + +let FINITE_HAS_SIZE_LEMMA = prove + (`!s:A->bool. FINITE s ==> ?n:num. {x | x < n} >=_c s`, + MATCH_MP_TAC FINITE_INDUCT THEN CONJ_TAC THENL + [EXISTS_TAC `0` THEN REWRITE_TAC[NOT_IN_EMPTY; GE_C; IN_ELIM_THM]; + REPEAT GEN_TAC THEN DISCH_THEN(X_CHOOSE_TAC `N:num`) THEN + EXISTS_TAC `SUC N` THEN POP_ASSUM MP_TAC THEN PURE_REWRITE_TAC[GE_C] THEN + DISCH_THEN(X_CHOOSE_TAC `f:num->A`) THEN + EXISTS_TAC `\n:num. if n = N then x:A else f n` THEN + X_GEN_TAC `y:A` THEN PURE_REWRITE_TAC[IN_INSERT] THEN + DISCH_THEN(DISJ_CASES_THEN2 SUBST_ALL_TAC (ANTE_RES_THEN MP_TAC)) THENL + [EXISTS_TAC `N:num` THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN ARITH_TAC; + DISCH_THEN(X_CHOOSE_THEN `n:num` MP_TAC) THEN + REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN + EXISTS_TAC `n:num` THEN ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `n:num < N` THEN COND_CASES_TAC THEN + ASM_REWRITE_TAC[LT_REFL] THEN ARITH_TAC]]);; + +let NUM_COUNTABLE = prove_by_refinement( + `COUNTABLE (UNIV:num->bool)`, + (* {{{ proof *) + + [ + REWRITE_TAC[COUNTABLE;CARD_GE_REFL]; + ]);; + + (* }}} *) + +let NUM2_COUNTABLE = prove_by_refinement( + `COUNTABLE {((x:num),(y:num)) | T}`, + (* {{{ proof *) + [ + CHOOSE_TAC (ISPECL[`(0,0)`;`(\ (a:num,b:num) (n:num) . if (b=0) then (0,a+b+1) else (a+1,b-1))`] num_RECURSION); + REWRITE_TAC[COUNTABLE;GE_C;IN_ELIM_THM']; + NAME_CONFLICT_TAC; + EXISTS_TAC `fn:num -> (num#num)`; + X_GEN_TAC `p:num#num`; + REPEAT (DISCH_THEN (CHOOSE_THEN MP_TAC)); + DISCH_THEN (fun t->REWRITE_TAC[t]); + REWRITE_TAC[IN_UNIV]; + SUBGOAL_MP_TAC `?t. t = x'+|y'`; + MESON_TAC[]; + SPEC_TAC (`x':num`,`a:num`); + SPEC_TAC (`y':num`,`b:num`); + CONV_TAC (quant_left_CONV "t"); + CONV_TAC (quant_left_CONV "t"); + CONV_TAC (quant_left_CONV "t"); + INDUCT_TAC; + REDUCE_TAC; + REP_GEN_TAC; + DISCH_THEN (fun t -> REWRITE_TAC[t]); + EXISTS_TAC `0`; + ASM_REWRITE_TAC[]; + CONV_TAC (quant_left_CONV "a"); + INDUCT_TAC; + REDUCE_TAC; + GEN_TAC; + USE 1 (SPECL [`0`;`t:num`]); + UND 1 THEN REDUCE_TAC; + DISCH_THEN (X_CHOOSE_TAC `n:num`); + AND 0; + USE 0 (SPEC `n:num`); + UND 0; + UND 1; + DISCH_THEN (fun t-> REWRITE_TAC[GSYM t]); + CONV_TAC (ONCE_DEPTH_CONV GEN_BETA_CONV); + BETA_TAC; + REDUCE_TAC; + DISCH_ALL_TAC; + EXISTS_TAC `SUC n`; + EXPAND_TAC "b"; + KILL 0; + ASM_REWRITE_TAC[]; + REWRITE_TAC [ARITH_RULE `SUC t = t+|1`]; + GEN_TAC; + ABBREV_TAC `t' = SUC t`; + USE 2 (SPEC `SUC b`); + DISCH_TAC; + UND 2; + ASM_REWRITE_TAC[]; + REWRITE_TAC[ARITH_RULE `SUC a +| b = a +| SUC b`]; + DISCH_THEN (X_CHOOSE_TAC `n:num`); + EXISTS_TAC `SUC n`; + AND 0; + USE 0 (SPEC `n:num`); + UND 0; + UND 2; + DISCH_THEN (fun t->REWRITE_TAC[GSYM t]); + CONV_TAC (ONCE_DEPTH_CONV GEN_BETA_CONV); + BETA_TAC; + REDUCE_TAC; + DISCH_THEN (fun t->REWRITE_TAC[t]); + REWRITE_TAC[ARITH_RULE `SUC a = a+| 1`]; + ]);; + (* }}} *) + +let COUNTABLE_UNIONS = prove_by_refinement( + `!A:(A->bool)->bool. (COUNTABLE A) /\ + (!a. (a IN A) ==> (COUNTABLE a)) ==> (COUNTABLE (UNIONS A))`, + (* {{{ proof *) + [ + GEN_TAC; + DISCH_ALL_TAC; + USE 0 (REWRITE_RULE[COUNTABLE;GE_C;IN_UNIV]); + CHO 0; + USE 0 (CONV_RULE (quant_left_CONV "x")); + USE 0 (CONV_RULE (quant_left_CONV "x")); + CHO 0; + USE 1 (REWRITE_RULE[COUNTABLE;GE_C;IN_UNIV]); + USE 1 (CONV_RULE (quant_left_CONV "f")); + USE 1 (CONV_RULE (quant_left_CONV "f")); + UND 1; + DISCH_THEN (X_CHOOSE_TAC `g:(A->bool)->num->A`); + SUBGOAL_MP_TAC `!a y. (a IN (A:(A->bool)->bool)) /\ (y IN a) ==> (? (u:num) (v:num). ( a = f u) /\ (y = g a v))`; + REP_GEN_TAC; + DISCH_ALL_TAC; + USE 1 (SPEC `a:A->bool`); + USE 0 (SPEC `a:A->bool`); + EXISTS_TAC `(x:(A->bool)->num) a`; + ASM_SIMP_TAC[]; + ASSUME_TAC NUM2_COUNTABLE; + USE 2 (REWRITE_RULE[COUNTABLE;GE_C;IN_ELIM_THM';IN_UNIV]); + USE 2 (CONV_RULE NAME_CONFLICT_CONV); + UND 2 THEN (DISCH_THEN (X_CHOOSE_TAC `h:num->(num#num)`)); + DISCH_TAC; + REWRITE_TAC[COUNTABLE;GE_C;IN_ELIM_THM';IN_UNIV;IN_UNIONS]; + EXISTS_TAC `(\p. (g:(A->bool)->num->A) ((f:num->(A->bool)) (FST ((h:num->(num#num)) p))) (SND (h p)))`; + BETA_TAC; + GEN_TAC; + DISCH_THEN (CHOOSE_THEN MP_TAC); + DISCH_ALL_TAC; + USE 3 (SPEC `t:A->bool`); + USE 3 (SPEC `y:A`); + UND 3 THEN (ASM_REWRITE_TAC[]); + REPEAT (DISCH_THEN(CHOOSE_THEN (MP_TAC))); + DISCH_ALL_TAC; + USE 2 (SPEC `(u:num,v:num)`); + SUBGOAL_MP_TAC `?x' y'. (u:num,v:num) = (x',y')`; + MESON_TAC[]; + DISCH_TAC; + UND 2; + ASM_REWRITE_TAC[]; + DISCH_THEN (CHOOSE_THEN (ASSUME_TAC o GSYM)); + EXISTS_TAC `x':num`; + ASM_REWRITE_TAC[]; + ]);; + (* }}} *) + +let COUNTABLE_IMAGE = prove_by_refinement( + `!(A:A->bool) (B:B->bool) . (COUNTABLE A) /\ (?f. (B SUBSET IMAGE f A)) ==> + (COUNTABLE B)`, + (* {{{ proof *) + [ + REWRITE_TAC[COUNTABLE;GE_C;IN_UNIV;IN_ELIM_THM';SUBSET]; + DISCH_ALL_TAC; + CHO 0; + USE 1 (REWRITE_RULE[IMAGE;IN_ELIM_THM']); + CHO 1; + USE 1 (REWRITE_RULE[IN_ELIM_THM']); + USE 1 (CONV_RULE NAME_CONFLICT_CONV); + EXISTS_TAC `(f':A->B) o (f:num->A)`; + REWRITE_TAC[o_DEF]; + DISCH_ALL_TAC; + USE 1 (SPEC `y:B`); + UND 1; + ASM_REWRITE_TAC[]; + DISCH_THEN CHOOSE_TAC; + USE 0 (SPEC `x':A`); + UND 0 THEN (ASM_REWRITE_TAC[]) THEN DISCH_TAC; + ASM_MESON_TAC[]; + ]);; + (* }}} *) + +let COUNTABLE_CARD = prove_by_refinement( + `!(A:A->bool) (B:B->bool). (COUNTABLE A) /\ (A >=_c B) ==> + (COUNTABLE B)`, + (* {{{ proof *) + + [ + DISCH_ALL_TAC; + MATCH_MP_TAC COUNTABLE_IMAGE; + EXISTS_TAC `A:A->bool`; + ASM_REWRITE_TAC[]; + REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM']; + USE 1 (REWRITE_RULE[GE_C]); + CHO 1; + EXISTS_TAC `f:A->B`; + ASM_REWRITE_TAC[]; + ]);; + + (* }}} *) + +let COUNTABLE_NUMSEG = prove_by_refinement( + `!n. COUNTABLE {x | x <| n}`, + (* {{{ proof *) + [ + GEN_TAC; + REWRITE_TAC[COUNTABLE;GE_C;IN_UNIV]; + EXISTS_TAC `I:num->num`; + REDUCE_TAC; + REWRITE_TAC[IN_ELIM_THM']; + MESON_TAC[]; + ]);; + (* }}} *) + +let FINITE_COUNTABLE = prove_by_refinement( + `!(A:A->bool). (FINITE A) ==> (COUNTABLE A)`, + (* {{{ proof *) + [ + DISCH_ALL_TAC; + USE 0 (MATCH_MP FINITE_HAS_SIZE_LEMMA); + CHO 0; + ASSUME_TAC(SPEC `n:num` COUNTABLE_NUMSEG); + JOIN 1 0; + USE 0 (MATCH_MP COUNTABLE_CARD); + ASM_REWRITE_TAC[]; + ]);; + (* }}} *) + +let num_infinite = prove_by_refinement( + `~ (FINITE (UNIV:num->bool))`, + (* {{{ proof *) + [ + PROOF_BY_CONTR_TAC; + USE 0 (REWRITE_RULE[]); + USE 0 (MATCH_MP num_FINITE_AVOID); + USE 0 (REWRITE_RULE[IN_UNIV]); + ASM_REWRITE_TAC[]; + ]);; + (* }}} *) + +let num_SEG_UNION = prove_by_refinement( + `!i. ({u | i <| u} UNION {m | m <=| i}) = UNIV`, + (* {{{ proof *) + [ + REP_BASIC_TAC; + SUBGOAL_MP_TAC `({u | i <| u} UNION {m | m <=| i}) = UNIV`; + MATCH_MP_TAC EQ_EXT; + GEN_TAC; + REWRITE_TAC[UNIV;UNION;IN_ELIM_THM']; + ARITH_TAC; + REWRITE_TAC[]; + ]);; + (* }}} *) + +let num_above_infinite = prove_by_refinement( + `!i. ~ (FINITE {u | i <| u})`, + (* {{{ proof *) + [ + GEN_TAC; + PROOF_BY_CONTR_TAC; + USE 0 (REWRITE_RULE[]); + ASSUME_TAC(SPEC `i:num` FINITE_NUMSEG_LE); + JOIN 0 1; + USE 0 (MATCH_MP FINITE_UNION_IMP); + SUBGOAL_MP_TAC `({u | i <| u} UNION {m | m <=| i}) = UNIV`; + REWRITE_TAC[num_SEG_UNION]; + DISCH_TAC; + UND 0; + ASM_REWRITE_TAC[]; + REWRITE_TAC[num_infinite]; + ]);; + (* }}} *) + +let INTER_FINITE = prove_by_refinement( + `!s (t:A->bool). (FINITE s ==> FINITE(s INTER t)) /\ (FINITE t ==> FINITE (s INTER t))`, + (* {{{ proof *) + + [ + CONV_TAC (quant_right_CONV "t"); + CONV_TAC (quant_right_CONV "s"); + SUBCONJ_TAC; + DISCH_ALL_TAC; + SUBGOAL_MP_TAC `s INTER t SUBSET (s:A->bool)`; + SET_TAC[]; + ASM_MESON_TAC[FINITE_SUBSET]; + MESON_TAC[INTER_COMM]; + ]);; + + (* }}} *) + +let num_above_finite = prove_by_refinement( + `!i J. (FINITE (J INTER {u | (i <| u)})) ==> (FINITE J)`, + (* {{{ proof *) + [ + DISCH_ALL_TAC; + SUBGOAL_MP_TAC `J = (J INTER {u | (i <| u)}) UNION (J INTER {m | m <=| i})`; + REWRITE_TAC[GSYM UNION_OVER_INTER;num_SEG_UNION;INTER_UNIV]; + DISCH_TAC; + ASM (ONCE_REWRITE_TAC)[]; + REWRITE_TAC[FINITE_UNION]; + ASM_REWRITE_TAC[]; + MP_TAC (SPEC `i:num` FINITE_NUMSEG_LE); + REWRITE_TAC[INTER_FINITE]; + ]);; + (* }}} *) + +let SUBSET_SUC = prove_by_refinement( + `!(f:num->A->bool). (!i. f i SUBSET f (SUC i)) ==> (! i j. ( i <=| j) ==> (f i SUBSET f j))`, + (* {{{ proof *) + [ + GEN_TAC; + DISCH_TAC; + REP_GEN_TAC; + MP_TAC (prove( `?n. n = j -| i`,MESON_TAC[])); + CONV_TAC (quant_left_CONV "n"); + SPEC_TAC (`i:num`,`i:num`); + SPEC_TAC (`j:num`,`j:num`); + REP 2( CONV_TAC (quant_left_CONV "n")); + INDUCT_TAC; + REP_GEN_TAC; + DISCH_ALL_TAC; + JOIN 1 2; + USE 1 (CONV_RULE REDUCE_CONV); + ASM_REWRITE_TAC[SUBSET]; + REP_GEN_TAC; + DISCH_TAC; + SUBGOAL_MP_TAC `?j'. j = SUC j'`; + DISJ_CASES_TAC (SPEC `j:num` num_CASES); + UND 2; + ASM_REWRITE_TAC[]; + REDUCE_TAC; + ASM_REWRITE_TAC[]; + DISCH_THEN CHOOSE_TAC; + ASM_REWRITE_TAC[]; + USE 0 (SPEC `j':num`); + USE 1(SPECL [`j':num`;`i:num`]); + DISCH_TAC; + SUBGOAL_MP_TAC `(n = j'-|i)`; + UND 2; + ASM_REWRITE_TAC[]; + ARITH_TAC; + DISCH_TAC; + SUBGOAL_MP_TAC `(i<=| j')`; + USE 2 (MATCH_MP(ARITH_RULE `(SUC n = j -| i) ==> (0 < j -| i)`)); + UND 2; + ASM_REWRITE_TAC[]; + ARITH_TAC; + UND 1; + ASM_REWRITE_TAC []; + DISCH_ALL_TAC; + REWR 6; + ASM_MESON_TAC[SUBSET_TRANS]; + ]);; + (* }}} *) + +let SUBSET_SUC2 = prove_by_refinement( + `!(f:num->A->bool). (!i. f (SUC i) SUBSET (f i)) ==> (! i j. ( i <=| j) ==> (f j SUBSET f i))`, + (* {{{ proof *) + [ + GEN_TAC; + DISCH_TAC; + REP_GEN_TAC; + MP_TAC (prove( `?n. n = j -| i`,MESON_TAC[])); + CONV_TAC (quant_left_CONV "n"); + SPEC_TAC (`i:num`,`i:num`); + SPEC_TAC (`j:num`,`j:num`); + REP 2( CONV_TAC (quant_left_CONV "n")); + INDUCT_TAC; + REP_GEN_TAC; + DISCH_ALL_TAC; + JOIN 1 2; + USE 1 (CONV_RULE REDUCE_CONV); + ASM_REWRITE_TAC[SUBSET]; + REP_GEN_TAC; + DISCH_TAC; + SUBGOAL_MP_TAC `?j'. j = SUC j'`; + DISJ_CASES_TAC (SPEC `j:num` num_CASES); + UND 2; + ASM_REWRITE_TAC[]; + REDUCE_TAC; + ASM_REWRITE_TAC[]; + DISCH_THEN CHOOSE_TAC; + ASM_REWRITE_TAC[]; + USE 0 (SPEC `j':num`); + USE 1(SPECL [`j':num`;`i:num`]); + DISCH_TAC; + SUBGOAL_MP_TAC `(n = j'-|i)`; + UND 2; + ASM_REWRITE_TAC[]; + ARITH_TAC; + DISCH_TAC; + SUBGOAL_MP_TAC `(i<=| j')`; + USE 2 (MATCH_MP(ARITH_RULE `(SUC n = j -| i) ==> (0 < j -| i)`)); + UND 2; + ASM_REWRITE_TAC[]; + ARITH_TAC; + UND 1; + ASM_REWRITE_TAC []; + DISCH_ALL_TAC; + REWR 6; + ASM_MESON_TAC[SUBSET_TRANS]; + ]);; + (* }}} *) + +let INFINITE_PIGEONHOLE = prove_by_refinement( + `!I (f:A->B) B C. (~(FINITE {i | (I i) /\ (C (f i))})) /\ (FINITE B) /\ + (C SUBSET (UNIONS B)) ==> + (?b. (B b) /\ ~(FINITE {i | (I i) /\ (C INTER b) (f i) }))`, + (* {{{ proof *) + [ + DISCH_ALL_TAC; + PROOF_BY_CONTR_TAC; + USE 3 ( CONV_RULE (quant_left_CONV "b")); + UND 0; + TAUT_TAC `P ==> (~P ==> F)`; + SUBGOAL_MP_TAC `{i | I' i /\ (C ((f:A->B) i))} = UNIONS (IMAGE (\b. {i | I' i /\ ((C INTER b) (f i))}) B)`; + REWRITE_TAC[UNIONS;IN_IMAGE]; + MATCH_MP_TAC EQ_EXT; + GEN_TAC; + REWRITE_TAC[IN_ELIM_THM']; + ABBREV_TAC `j = (x:A)`; + EQ_TAC; + DISCH_ALL_TAC; + USE 2 (REWRITE_RULE [SUBSET;UNIONS]); + USE 2 (REWRITE_RULE[IN_ELIM_THM']); + USE 2 (SPEC `(f:A->B) j`); + USE 2 (REWRITE_RULE[IN]); + REWR 2; + CHO 2; + CONV_TAC (quant_left_CONV "x"); + CONV_TAC (quant_left_CONV "x"); + EXISTS_TAC (`u:B->bool`); + NAME_CONFLICT_TAC; + EXISTS_TAC (`{i' | I' i' /\ (C INTER u) ((f:A->B) i')}`); + ASM_REWRITE_TAC[]; + REWRITE_TAC[IN_ELIM_THM';INTER]; + REWRITE_TAC[IN]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + CHO 4; + AND 4; + CHO 5; + REWR 4; + USE 4 (REWRITE_RULE[IN_ELIM_THM';INTER]); + USE 4 (REWRITE_RULE[IN]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + ASM_REWRITE_TAC[]; + SUBGOAL_MP_TAC `FINITE (IMAGE (\b. {i | I' i /\ (C INTER b) ((f:A->B) i)}) B)`; + MATCH_MP_TAC FINITE_IMAGE; + ASM_REWRITE_TAC[]; + SIMP_TAC[FINITE_UNIONS]; + DISCH_TAC; + GEN_TAC; + REWRITE_TAC[IN_IMAGE]; + DISCH_THEN (X_CHOOSE_TAC `b:B->bool`); + ASM_REWRITE_TAC[]; + USE 3 (SPEC `b:B->bool`); + UND 3; + AND 5; + UND 3; + ABBREV_TAC `r = {i | I' i /\ (C INTER b) ((f:A->B) i)}`; + MESON_TAC[IN]; + ]);; + (* }}} *) + +let real_FINITE = prove_by_refinement( + `!(s:real->bool). FINITE s ==> (?a. !x. x IN s ==> (x <=. a))`, + (* {{{ proof *) + [ + DISCH_ALL_TAC; + ASSUME_TAC REAL_ARCH_SIMPLE; + USE 1 (CONV_RULE (quant_left_CONV "n")); + CHO 1; + SUBGOAL_MP_TAC `FINITE (IMAGE (n:real->num) s)`; + ASM_MESON_TAC[FINITE_IMAGE]; +(*** JRH -- num_FINITE is now an equivalence not an implication + ASSUME_TAC (SPEC `IMAGE (n:real->num) s` num_FINITE); + ***) + ASSUME_TAC(fst(EQ_IMP_RULE(SPEC `IMAGE (n:real->num) s` num_FINITE))); + DISCH_TAC; + REWR 2; + CHO 2; + USE 2 (REWRITE_RULE[IN_IMAGE]); + USE 2 (CONV_RULE NAME_CONFLICT_CONV); + EXISTS_TAC `&.a`; + GEN_TAC; + USE 2 (CONV_RULE (quant_left_CONV "x'")); + USE 2 (CONV_RULE (quant_left_CONV "x'")); + USE 2 (SPEC `x:real`); + USE 2 (SPEC `(n:real->num) x`); + DISCH_TAC; + REWR 2; + USE 1 (SPEC `x:real`); + UND 1; + MATCH_MP_TAC (REAL_ARITH `a<=b ==> ((x <= a) ==> (x <=. b))`); + REDUCE_TAC; + ASM_REWRITE_TAC []; + ]);; + (* }}} *) + +let UNIONS_DELETE = prove_by_refinement( + `!s. (UNIONS (s:(A->bool)->bool)) = (UNIONS (s DELETE (EMPTY)))`, + (* {{{ proof *) + [ + REWRITE_TAC[UNIONS;DELETE;EMPTY]; + GEN_TAC; + MATCH_MP_TAC EQ_EXT; + REWRITE_TAC[IN_ELIM_THM']; + GEN_TAC; + REWRITE_TAC[IN]; + MESON_TAC[]; + ]);; + (* }}} *) + + +(* ------------------------------------------------------------------ *) +(* Partial functions, which we identify with functions that + take the canonical choice of element outside the domain. *) +(* ------------------------------------------------------------------ *) + +let SUPP = new_definition + `SUPP (f:A->B) = \ x. ~(f x = (CHOICE (UNIV:B ->bool)) )`;; + +let FUN = new_definition + `FUN a b = (\ (f:A->B). ((!x. (x IN a) ==> (f x IN b)) /\ + ((SUPP f) SUBSET a))) `;; + +(* ------------------------------------------------------------------ *) +(* compositions *) +(* ------------------------------------------------------------------ *) + +let compose = new_definition + `compose f g = \x. (f (g x))`;; + +let COMP_ASSOC = prove_by_refinement( + `!(f:num ->num) (g:num->num) (h:num->num). + (compose f (compose g h)) = (compose (compose f g) h)`, +(* {{{ proof *) + + [ + REPEAT GEN_TAC THEN REWRITE_TAC[compose]; + ]);; +(* }}} *) + +let COMP_INJ = prove (`!(f:A->B) (g:B->C) s t u. + INJ f s t /\ (INJ g t u) ==> + (INJ (compose g f) s u)`, +(* {{{ proof *) + + EVERY[REPEAT GEN_TAC; + REWRITE_TAC[INJ;compose]; + DISCH_ALL_TAC; + ASM_MESON_TAC[]]);; +(* }}} *) + +let COMP_SURJ = prove (`!(f:A->B) (g:B->C) s t u. + SURJ f s t /\ (SURJ g t u) ==> (SURJ (compose g f) s u)`, +(* {{{ proof *) + + EVERY[REWRITE_TAC[SURJ;compose]; + DISCH_ALL_TAC; + ASM_MESON_TAC[]]);; +(* }}} *) + +let COMP_BIJ = prove (`!(f:A->B) s t (g:B->C) u. + BIJ f s t /\ (BIJ g t u) ==> (BIJ (compose g f) s u)`, +(* {{{ proof *) + + EVERY[ + REPEAT GEN_TAC; + REWRITE_TAC[BIJ]; + DISCH_ALL_TAC; + ASM_MESON_TAC[COMP_INJ;COMP_SURJ]]);; + +(* }}} *) + + +(* ------------------------------------------------------------------ *) +(* general construction of an inverse function on a domain *) +(* ------------------------------------------------------------------ *) + +let INVERSE_FN = prove_by_refinement( + `?INVERSE. (! (f:A->B) a b. (SURJ f a b) ==> ((INJ (INVERSE f a b) b a) /\ + (!(x:B). (x IN b) ==> (f ((INVERSE f a b) x) = x))))`, +(* {{{ proof *) + + [ + REWRITE_TAC[GSYM SKOLEM_THM]; + REPEAT GEN_TAC; + MATCH_MP_TAC (prove_by_refinement( `!A B. (A ==> (?x. (B x))) ==> (?(x:B->A). (A ==> (B x)))`,[MESON_TAC[]])) ; + REWRITE_TAC[SURJ;INJ]; + DISCH_ALL_TAC; + SUBGOAL_MP_TAC `?u. !y. ((y IN b)==> ((u y IN a) /\ ((f:A->B) (u y) = y)))`; + REWRITE_TAC[GSYM SKOLEM_THM]; + GEN_TAC; + ASM_MESON_TAC[]; + DISCH_THEN CHOOSE_TAC; + EXISTS_TAC `u:B->A`; + REPEAT CONJ_TAC; + ASM_MESON_TAC[]; + REPEAT GEN_TAC; + DISCH_ALL_TAC; + FIRST_X_ASSUM (fun th -> ASSUME_TAC (AP_TERM `f:A->B` th)); + ASM_MESON_TAC[]; + ASM_MESON_TAC[] + ]);; + +(* }}} *) + +let INVERSE_DEF = new_specification ["INVERSE"] INVERSE_FN;; + +let INVERSE_BIJ = prove_by_refinement( + `!(f:A->B) a b. (BIJ f a b) ==> ((BIJ (INVERSE f a b) b a))`, +(* {{{ proof *) + [ + REPEAT GEN_TAC; + REWRITE_TAC[BIJ]; + DISCH_ALL_TAC; + ASM_SIMP_TAC[INVERSE_DEF]; + REWRITE_TAC[SURJ]; + CONJ_TAC; + ASM_MESON_TAC[INVERSE_DEF;INJ]; + GEN_TAC THEN DISCH_TAC; + EXISTS_TAC `(f:A->B) x`; + CONJ_TAC; + ASM_MESON_TAC[INJ]; + SUBGOAL_THEN `((f:A->B) x) IN b` ASSUME_TAC; + ASM_MESON_TAC[INJ]; + SUBGOAL_THEN `(f:A->B) (INVERSE f a b (f x)) = (f x)` ASSUME_TAC; + ASM_MESON_TAC[INVERSE_DEF]; + H_UNDISCH_TAC (HYP "0"); + REWRITE_TAC[INJ]; + DISCH_ALL_TAC; + FIRST_X_ASSUM (fun th -> MP_TAC (SPECL [`INVERSE (f:A->B) a b (f x)`;`x:A`] th)); + ASM_REWRITE_TAC[]; + DISCH_ALL_TAC; + SUBGOAL_THEN `INVERSE (f:A->B) a b (f x) IN a` ASSUME_TAC; + ASM_MESON_TAC[INVERSE_DEF;INJ]; + ASM_MESON_TAC[]; + ]);; +(* }}} *) + +let INVERSE_XY = prove_by_refinement( + `!(f:A->B) a b x y. (BIJ f a b) /\ (x IN a) /\ (y IN b) ==> ((INVERSE f a b y = x) <=> (f x = y))`, +(* {{{ proof *) + [ + REPEAT GEN_TAC; + DISCH_ALL_TAC; + EQ_TAC; + FIRST_X_ASSUM (fun th -> (ASSUME_TAC th THEN (ASSUME_TAC (MATCH_MP INVERSE_DEF (CONJUNCT2 (REWRITE_RULE[BIJ] th)))))); + ASM_MESON_TAC[]; + POP_ASSUM (fun th -> (ASSUME_TAC th THEN (ASSUME_TAC (CONJUNCT2 (REWRITE_RULE[INJ] (CONJUNCT1 (REWRITE_RULE[BIJ] th))))))); + DISCH_THEN (fun th -> ASSUME_TAC th THEN (REWRITE_TAC[GSYM th])); + FIRST_X_ASSUM MATCH_MP_TAC; + REPEAT CONJ_TAC; + ASM_REWRITE_TAC[]; + IMP_RES_THEN ASSUME_TAC INVERSE_BIJ; + ASM_MESON_TAC[BIJ;INJ]; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (fun th -> (ASSUME_TAC (CONJUNCT2 (REWRITE_RULE[BIJ] th)))); + IMP_RES_THEN (fun th -> ASSUME_TAC (CONJUNCT2 th)) INVERSE_DEF; + ASM_MESON_TAC[]; + ]);; +(* }}} *) + +let FINITE_BIJ = prove( + `!a b (f:A->B). FINITE a /\ (BIJ f a b) ==> (FINITE b)`, +(* {{{ proof *) + + MESON_TAC[SURJ_IMAGE;BIJ;INJ;FINITE_IMAGE] +);; + +(* }}} *) + +let FINITE_INJ = prove_by_refinement( + `!a b (f:A->B). FINITE b /\ (INJ f a b) ==> (FINITE a)`, +(* {{{ proof *) + + [ + REPEAT GEN_TAC; + DISCH_ALL_TAC; + MP_TAC (SPECL [`f:A->B`;`b:B->bool`;`a:A->bool`] FINITE_IMAGE_INJ_GENERAL); + DISCH_ALL_TAC; + SUBGOAL_THEN `(a:A->bool) SUBSET ({x | (x IN a) /\ ((f:A->B) x IN b)})` ASSUME_TAC; + REWRITE_TAC[SUBSET]; + GEN_TAC ; + REWRITE_TAC[IN_ELIM_THM]; + POPL_TAC[0;1]; + ASM_MESON_TAC[BIJ;INJ]; + MATCH_MP_TAC FINITE_SUBSET; + EXISTS_TAC `({x | (x IN a) /\ ((f:A->B) x IN b)})` ; + CONJ_TAC; + FIRST_X_ASSUM (fun th -> MATCH_MP_TAC th); + CONJ_TAC; + ASM_MESON_TAC[BIJ;INJ]; + ASM_REWRITE_TAC[]; + ASM_REWRITE_TAC[]; + ] +);; + +(* }}} *) + +let FINITE_BIJ2 = prove_by_refinement( + `!a b (f:A->B). FINITE b /\ (BIJ f a b) ==> (FINITE a)`, +(* {{{ proof *) + + [ + MESON_TAC[BIJ;FINITE_INJ] + ]);; +(* }}} *) + +let BIJ_CARD = prove_by_refinement( + `!a b (f:A->B). FINITE a /\ (BIJ f a b) ==> (CARD a = (CARD b))`, +(* {{{ proof *) + + [ + ASM_MESON_TAC[SURJ_IMAGE;BIJ;INJ;CARD_IMAGE_INJ]; + ]);; + +(* }}} *) + +let PAIR_LEMMA = prove_by_refinement( + `!(x:num#num) i j. ((FST x = i) /\ (SND x = j)) <=> (x = (i,j))` , +(* {{{ proof *) + + [ + MESON_TAC[FST;SND;PAIR]; + ]);; +(* }}} *) + +let CARD_SING = prove_by_refinement( + `!(u:A->bool). (SING u ) ==> (CARD u = 1)`, +(* {{{ proof *) + [ + REWRITE_TAC[SING]; + GEN_TAC; + DISCH_THEN (CHOOSE_TAC); + ASM_REWRITE_TAC[]; + ASSUME_TAC FINITE_RULES; + ASM_SIMP_TAC[CARD_CLAUSES;NOT_IN_EMPTY]; + ACCEPT_TAC (NUM_RED_CONV `SUC 0`) + ]);; +(* }}} *) + +let FINITE_SING = prove_by_refinement( + `!(x:A). FINITE ({x})`, +(* {{{ proof *) + + [ + MESON_TAC[FINITE_RULES] + ]);; +(* }}} *) + +let NUM_INTRO = prove_by_refinement( + `!f P.((!(n:num). !(g:A). (f g = n) ==> (P g)) ==> (!g. (P g)))`, +(* {{{ proof *) + + [ + REPEAT GEN_TAC; + DISCH_ALL_TAC; + GEN_TAC; + H_VAL (SPECL [`(f:A->num) (g:A)`; `g:A`]) (HYP "0"); + ASM_MESON_TAC[]; + ]);; +(* }}} *) + + + +(* ------------------------------------------------------------------ *) +(* Lemmas about the support of a function *) +(* ------------------------------------------------------------------ *) + + +(* Law of cardinal exponents B^0 = 1 *) +let DOMAIN_EMPTY = prove_by_refinement( + `!b. FUN (EMPTY:A->bool) b = { (\ (u:A). (CHOICE (UNIV:B->bool))) }`, +(* {{{ proof *) + [ + GEN_TAC; + REWRITE_TAC[EXTENSION;FUN]; + X_GEN_TAC `f:A->B`; + REWRITE_TAC[IN_ELIM_THM;INSERT;NOT_IN_EMPTY;SUBSET_EMPTY;SUPP]; + REWRITE_TAC[EMPTY]; + ONCE_REWRITE_TAC[EXTENSION]; + REWRITE_TAC[IN]; + EQ_TAC; + DISCH_TAC THEN (MATCH_MP_TAC EQ_EXT); + BETA_TAC; + ASM_REWRITE_TAC[]; + DISCH_TAC THEN (ASM_REWRITE_TAC[]) THEN BETA_TAC; + ]);; +(* }}} *) + +(* Law of cardinal exponents B^A * B = B^(A+1) *) +let DOMAIN_INSERT = prove_by_refinement( + `!a b s. (~((s:A) IN a) ==> + (?F. (BIJ F (FUN (s INSERT a) b) + { (u,v) | (u IN (FUN a b)) /\ ((v:B) IN b) } + )))`, +(* {{{ proof *) + [ + REPEAT GEN_TAC; + DISCH_TAC; + EXISTS_TAC `\ f. ((\ x. (if (x=(s:A)) then (CHOICE (UNIV:B->bool)) else (f x))),(f s))`; + REWRITE_TAC[BIJ;INJ;SURJ]; + TAUT_TAC `(A /\ (A ==> B) /\ (A ==>C)) ==> ((A/\ B) /\ (A /\ C))`; + REPEAT CONJ_TAC; + X_GEN_TAC `(f:A->B)`; + REWRITE_TAC[FUN;IN_ELIM_THM]; + REWRITE_TAC[INSERT;SUBSET]; + REWRITE_TAC[IN_ELIM_THM;SUPP]; + STRIP_TAC; + ABBREV_TAC `g = \ x. (if (x=(s:A)) then (CHOICE (UNIV:B->bool)) else (f x)) `; + EXISTS_TAC `g:A->B`; + EXISTS_TAC `(f:A->B) s`; + REWRITE_TAC[]; + REPEAT CONJ_TAC; + EXPAND_TAC "g" THEN BETA_TAC; + GEN_TAC; + REWRITE_TAC[IN;COND_ELIM_THM]; + ASM_MESON_TAC[IN]; + (* next *) ALL_TAC; + EXPAND_TAC "g" THEN BETA_TAC; + GEN_TAC; + ASM_CASES_TAC `(x:A) = s`; + ASM_REWRITE_TAC[]; + ASM_REWRITE_TAC[]; + ASM_MESON_TAC[]; + (* next *) ALL_TAC; + ASM_MESON_TAC[]; + (* INJ *) ALL_TAC; + REWRITE_TAC[FUN;SUPP]; + DISCH_TAC; + X_GEN_TAC `f1:A->B`; + X_GEN_TAC `f2:A->B`; + REWRITE_TAC[IN]; + DISCH_ALL_TAC; + MATCH_MP_TAC EQ_EXT; + GEN_TAC; + ASM_CASES_TAC `(x:A) = s`; + POPL_TAC[1;2;3;4;6;7]; + ASM_REWRITE_TAC[]; + ASM_MESON_TAC[PAIR;FST;SND]; + POPL_TAC[1;2;3;4;6;7]; + FIRST_X_ASSUM (fun th -> ASSUME_TAC (REWRITE_RULE[FST] (AP_TERM `FST:((A->B)#B)->(A->B)` th))) ; + FIRST_X_ASSUM (fun th -> ASSUME_TAC (REWRITE_RULE[COND_ELIM_THM] (BETA_RULE (AP_THM th `x:A`)))); + LABEL_ALL_TAC; + H_UNDISCH_TAC (HYP "0"); + COND_CASES_TAC; + ASM_MESON_TAC[]; + ASM_MESON_TAC[]; + (* SURJ *) ALL_TAC; + REWRITE_TAC[FUN;SUPP;IN_ELIM_THM]; + REWRITE_TAC[IN;INSERT;SUBSET]; + DISCH_ALL_TAC; + X_GEN_TAC `p:(A->B)#B`; + DISCH_THEN CHOOSE_TAC; + FIRST_X_ASSUM (fun th -> MP_TAC th); + DISCH_THEN CHOOSE_TAC; + FIRST_X_ASSUM MP_TAC; + DISCH_ALL_TAC; + ASM_REWRITE_TAC[]; + EXISTS_TAC `\ (x:A). if (x = s) then (v:B) else (u x)`; + REPEAT CONJ_TAC; + X_GEN_TAC `t:A`; + BETA_TAC; + REWRITE_TAC[IN_ELIM_THM;COND_ELIM_THM]; + POPL_TAC[1;3;4;5]; + ASM_MESON_TAC[]; + X_GEN_TAC `t:A`; + BETA_TAC; + REWRITE_TAC[IN_ELIM_THM;COND_ELIM_THM]; + ASM_CASES_TAC `(t:A) = s`; + POPL_TAC[1;3;4;5;6]; + ASM_REWRITE_TAC[]; + POPL_TAC[1;3;4;5;6]; + FIRST_X_ASSUM (fun th -> ASSUME_TAC (SPEC `t:A` th)); + ASM_SIMP_TAC[prove(`~((t:A)=s) ==> ((t=s)=F)`,MESON_TAC[])]; + BETA_TAC; + REWRITE_TAC[]; + POPL_TAC[0;2;3;4]; + AP_THM_TAC; + AP_TERM_TAC; + MATCH_MP_TAC EQ_EXT; + X_GEN_TAC `t:A`; + BETA_TAC; + DISJ_CASES_TAC (prove(`(((t:A)=s) <=> T) \/ ((t=s) <=> F)`,MESON_TAC[])); + ASM_REWRITE_TAC[]; + ASM_MESON_TAC[IN]; + ASM_REWRITE_TAC[] + ]);; +(* }}} *) + +let CARD_DELETE_CHOICE = prove_by_refinement( + `!(a:(A->bool)). ((FINITE a) /\ (~(a=EMPTY))) ==> + (SUC (CARD (a DELETE (CHOICE a))) = (CARD a))`, +(* {{{ proof *) + [ + REPEAT GEN_TAC; + DISCH_ALL_TAC; + ASM_SIMP_TAC[CARD_DELETE]; + ASM_SIMP_TAC[CHOICE_DEF]; + MATCH_MP_TAC (ARITH_RULE `~(x=0) ==> (SUC (x -| 1) = x)`); + ASM_MESON_TAC[HAS_SIZE_0;HAS_SIZE]; + ]);; +(* }}} *) + + +(* +let dets_flag = ref true;; +dets_flag:= !labels_flag;; +*) + + +(* labels_flag:=false;; *) + +(* Law of cardinals |B^A| = |B|^|A| *) +let FUN_SIZE = + Refinement.enhanced_prove_by_refinement false ALL_TAC ( + `!b a. (FINITE (a:A->bool)) /\ (FINITE (b:B->bool)) + ==> ((FUN a b) HAS_SIZE ((CARD b) EXP (CARD a)))`, +(* {{{ proof *) + [ + GEN_TAC; + MATCH_MP_TAC (SPEC `CARD:(A->bool)->num` ((INST_TYPE) [`:A->bool`,`:A`] NUM_INTRO)); + INDUCT_TAC; + GEN_TAC; + DISCH_ALL_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC [EXP]; + SUBGOAL_THEN `(a:A->bool) = EMPTY` ASSUME_TAC; + ASM_REWRITE_TAC[GSYM HAS_SIZE_0;HAS_SIZE]; + ASM_REWRITE_TAC[HAS_SIZE;DOMAIN_EMPTY]; + CONJ_TAC; + REWRITE_TAC[FINITE_SING]; + MATCH_MP_TAC CARD_SING; + REWRITE_TAC[SING]; + MESON_TAC[]; + GEN_TAC; + FIRST_X_ASSUM (fun th -> ASSUME_TAC (SPEC `(a:A->bool) DELETE (CHOICE a)` th)) ; + DISCH_ALL_TAC; + SUBGOAL_THEN `CARD ((a:A->bool) DELETE (CHOICE a)) = n` ASSUME_TAC; + ASM_SIMP_TAC[CARD_DELETE]; + SUBGOAL_THEN `CHOICE (a:A->bool) IN a` ASSUME_TAC; + MATCH_MP_TAC CHOICE_DEF; + ASSUME_TAC( ARITH_RULE `!x. (x = (SUC n)) ==> (~(x = 0))`); + REWRITE_TAC[GSYM HAS_SIZE_0;HAS_SIZE]; + ASM_MESON_TAC[]; + ASM_REWRITE_TAC[]; + MESON_TAC[ ( ARITH_RULE `!n. (SUC n -| 1) = n`)]; + LABEL_ALL_TAC; + H_MATCH_MP (HYP "3") (HYP "4"); + SUBGOAL_THEN `FUN ((a:A->bool) DELETE CHOICE a) (b:B->bool) HAS_SIZE CARD b **| CARD (a DELETE CHOICE a)` ASSUME_TAC; + ASM_MESON_TAC[FINITE_DELETE]; + ASSUME_TAC (SPECL [`((a:A->bool) DELETE (CHOICE a))`;`b:B->bool`;`(CHOICE (a:A->bool))` ] DOMAIN_INSERT); + LABEL_ALL_TAC; + H_UNDISCH_TAC (HYP "5"); + REWRITE_TAC[IN_DELETE]; + SUBGOAL_THEN `~((a:A->bool) = EMPTY)` ASSUME_TAC; + REWRITE_TAC[GSYM HAS_SIZE_0;HAS_SIZE]; + ASSUME_TAC( ARITH_RULE `!x. (x = (SUC n)) ==> (~(x = 0))`); + ASM_MESON_TAC[]; + ASM_SIMP_TAC[INSERT_DELETE;CHOICE_DEF]; + DISCH_THEN CHOOSE_TAC; + REWRITE_TAC[HAS_SIZE]; + SUBGOAL_THEN `FINITE (FUN (a:A->bool) (b:B->bool))` ASSUME_TAC; + (* CONJ_TAC; *) ALL_TAC; + MATCH_MP_TAC (SPEC `FUN (a:A->bool) (b:B->bool)` (PINST[(`:A->B`,`:A`);(`:(A->B)#B`,`:B`)] [] FINITE_BIJ2)); + EXISTS_TAC `{u,v | (u:A->B) IN FUN (a DELETE CHOICE a) b /\ (v:B) IN b}`; + EXISTS_TAC `F':(A->B)->((A->B)#B)`; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC FINITE_PRODUCT; + ASM_REWRITE_TAC[]; + ASM_MESON_TAC[HAS_SIZE]; + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `CARD (FUN (a:A->bool) (b:B->bool)) = (CARD {u,v | (u:A->B) IN FUN (a DELETE CHOICE a) b /\ (v:B) IN b})` ASSUME_TAC; + MATCH_MP_TAC BIJ_CARD; + EXISTS_TAC `F':(A->B)->((A->B)#B)`; + ASM_REWRITE_TAC[]; + (* *) ALL_TAC; + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `FINITE (a DELETE CHOICE (a:A->bool))` ASSUME_TAC; + ASM_MESON_TAC[FINITE_DELETE]; + SUBGOAL_THEN `(FUN ((a:A->bool) DELETE CHOICE a) (b:B->bool)) HAS_SIZE (CARD b **| (CARD (a DELETE CHOICE a)))` ASSUME_TAC; + POPL_TAC[1;2;3;4;5;10;11]; + ASM_MESON_TAC[CARD_DELETE]; + POP_ASSUM (fun th -> ASSUME_TAC (REWRITE_RULE[HAS_SIZE] th) THEN (ASSUME_TAC th)); + ASM_SIMP_TAC[CARD_PRODUCT]; + REWRITE_TAC[EXP;MULT_AC] + ]);; +(* }}} *) + +(* labels_flag:= true;; *) + + +(* ------------------------------------------------------------------ *) +(* ------------------------------------------------------------------ *) + + + +(* Definitions in math tend to be n-tuples of data. Let's make it + easy to pick out the individual components of a definition *) + +(* pick out the rest of n-tuples. Indexing consistent with lib.drop *) +let drop0 = new_definition(`drop0 (u:A#B) = SND u`);; +let drop1 = new_definition(`drop1 (u:A#B#C) = SND (SND u)`);; +let drop2 = new_definition(`drop2 (u:A#B#C#D) = SND (SND (SND u))`);; +let drop3 = new_definition(`drop3 (u:A#B#C#D#E) = SND (SND (SND (SND u)))`);; + +(* pick out parts of n-tuples *) + +let part0 = new_definition(`part0 (u:A#B) = FST u`);; +let part1 = new_definition(`part1 (u:A#B#C) = FST (drop0 u)`);; +let part2 = new_definition(`part2 (u:A#B#C#D) = FST (drop1 u)`);; +let part3 = new_definition(`part3 (u:A#B#C#D#E) = FST (drop2 u)`);; +let part4 = new_definition(`part4 (u:A#B#C#D#E#F) = FST (drop3 u)`);; +let part5 = new_definition(`part5 (u:A#B#C#D#E#F#G) = + FST (SND (SND (SND (SND (SND u)))))`);; +let part6 = new_definition(`part6 (u:A#B#C#D#E#F#G#H) = + FST (SND (SND (SND (SND (SND (SND u))))))`);; +let part7 = new_definition(`part7 (u:A#B#C#D#E#F#G#H#I) = + FST (SND (SND (SND (SND (SND (SND (SND u)))))))`);; +let part8 = new_definition(`part8 (u:A#B#C#D#E#F#G#H#I#J) = + FST (SND (SND (SND (SND (SND (SND (SND (SND u))))))))`);; + + + +pop_priority();; + +end;; diff --git a/text_formalization/jordan/num_ext_gcd.hl b/text_formalization/jordan/num_ext_gcd.hl new file mode 100644 index 0000000..2d1b98a --- /dev/null +++ b/text_formalization/jordan/num_ext_gcd.hl @@ -0,0 +1,266 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Jordan *) +(* Copied from HOL Light jordan directory *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-08 *) +(* ========================================================================== *) + +(* needs tactics_ext.ml;; + needs parse_ext_override_interface.ml;; *) + +module Num_ext_gcd = struct + +open Tactics_jordan;; +open Parse_ext_override_interface;; +(* + Author: Thomas C. Hales, 2003 + + GCD_CONV takes two HOL-light terms (NUMERALs) a and b and + produces a theorem of the form + |- GCD a b = g + + (In particular, the arguments cannot be negative.) + +*) + + +prioritize_num();; + +let DIVIDE = new_definition(`DIVIDE a b = ?m. (b = m*a )`);; + +parse_as_infix("||",(16,"right"));; + +override_interface("||",`DIVIDE:num->num->bool`);; + +(* Now prove the lemmas *) + +let DIV_TAC t = EVERY[ REP_GEN_TAC; + REWRITE_TAC[DIVIDE]; + DISCH_ALL_TAC; + REPEAT (FIRST_X_ASSUM CHOOSE_TAC); + TRY (EXISTS_TAC t)];; + + +let DIVIDE_DIVIDE = prove_by_refinement( + `!a b c. (((a || b) /\ (b || c)) ==> (a || c))`, + [ + DIV_TAC `m'*m`; + ASM_REWRITE_TAC[MULT_ASSOC] + ]);; + +let DIVIDE_EQ = prove_by_refinement( + `! a b. (((a || b) /\ (b || a)) ==> (a = b))`, + [ + DIV_TAC `1`; + FIRST_X_ASSUM (fun th -> (POP_ASSUM MP_TAC) THEN REWRITE_TAC[th]); + ASM_CASES_TAC `b=0`; + ASM_REWRITE_TAC[]; + ARITH_TAC; + REWRITE_TAC[ARITH_RULE `(b = m*m'*b) = (1*b = m*m'*b)`]; + ASM_REWRITE_TAC[MULT_ASSOC;EQ_MULT_RCANCEL]; + DISCH_THEN (fun th -> MP_TAC (REWRITE_RULE[MULT_EQ_1] (GSYM th)) ); + DISCH_THEN (fun th -> REWRITE_TAC[CONJUNCT2 th] THEN ARITH_TAC); + ]);; + +let DIVIDE_SUM = prove_by_refinement( + `!a b h. (((h || a) /\ (h||b)) ==> (h || (a+b)))`, + [ + DIV_TAC `m+m'`; + ASM_REWRITE_TAC[ARITH;RIGHT_ADD_DISTRIB]; + ]);; + +let DIVIDE_SUMMAND = prove_by_refinement( + `!a b h. (((h|| b) /\ (h || (a+b))) ==> (h|| a))`, + [ + DIV_TAC `m'-m`; + REWRITE_TAC[RIGHT_SUB_DISTRIB]; + REPEAT (FIRST_X_ASSUM (fun th -> REWRITE_TAC[GSYM th])); + ARITH_TAC; + ]);; + +let DIVIDE_PROD = prove_by_refinement( + `!a b h. (((h|| a) ==> (h || (b*a))))`, + [ + DIV_TAC `b*m`; + ASM_REWRITE_TAC[MULT_ASSOC]; + ]);; + +let DIVIDE_PROD2 = prove_by_refinement( + `!a b h. (((h|| a) ==> (h || (a*b))))`, + [ + DIV_TAC `b*m`; + ASM_REWRITE_TAC[MULT_AC] + ]);; + +let GCD = new_definition(`GCD a b = @g. + ((g || a) /\ (g || b) /\ + (!h. (((h || a) /\ (h || b)) ==> (h || g))))`);; + +let gcd_certificate = prove(`!a b g. ((? r s r' s' a' b'. + ((a = a'*g) /\ (b = b'*g) /\ (g +r'*a+s'*b= r*a + s*b))) + ==> (GCD a b = g))`, + let tac1 = ( + (REPEAT GEN_TAC) + THEN (DISCH_TAC) + THEN (REPEAT (POP_ASSUM CHOOSE_TAC)) + THEN (REWRITE_TAC[GCD]) + THEN (MATCH_MP_TAC SELECT_UNIQUE) + THEN BETA_TAC + THEN GEN_TAC + THEN EQ_TAC) and + + ygbranch = ( + DISCH_TAC + THEN (MATCH_MP_TAC DIVIDE_EQ) + THEN CONJ_TAC) and + + ydivg_branch = ( + (SUBGOAL_MP_TAC (` (y || (r*a + s*b))/\ (y || (r'*a +s'*b))`)) + THENL [((ASM MESON_TAC)[DIVIDE_SUM;DIVIDE_PROD]); + ((ASM MESON_TAC)[DIVIDE_SUMMAND])] + ) and + + gdivy_branch = ( + (UNDISCH_TAC + (`(y||a) /\ (y ||b) /\ (!h. (((h||a)/\(h||b))==> (h||y)))`)) + THEN (TAUT_TAC (` (A ==> B) ==> ((C /\ D/\ A)==> B)`)) + THEN (DISCH_TAC) + THEN (POP_ASSUM MATCH_MP_TAC) + THEN (REWRITE_TAC[DIVIDE]) + THEN (CONJ_TAC) + THEN ((ASM MESON_TAC)[]) + ) and + + yghyp_branch = ( + (DISCH_TAC) + THEN (let x t = REWRITE_TAC[t] in (POP_ASSUM x)) + THEN (CONJ_TAC) + THENL [((ASM MESON_TAC)[DIVIDE]);ALL_TAC] + THEN (CONJ_TAC) + THENL [((ASM MESON_TAC)[DIVIDE]);ALL_TAC] + THEN GEN_TAC + THEN DISCH_TAC + THEN (SUBGOAL_MP_TAC (` (h || (r*a + s*b))/\ (h || (r'*a+s'*b))`)) + THENL [((ASM MESON_TAC)[DIVIDE_SUM;DIVIDE_PROD]); + ((ASM MESON_TAC)[DIVIDE_SUMMAND])] + ) in + tac1 THENL [ygbranch THENL [ydivg_branch;gdivy_branch];yghyp_branch]);; + +(* Now compute gcd with CAML num calculations, + then check the answer in HOL-light *) +let gcd_num x1 x2 = + let rec gcd_data (a1,b1,x1,a2,b2,x2) = + if (x1 < (Int 0)) then + gcd_data(minus_num a1,minus_num b1,minus_num x1,a2,b2,x2) + else if (x2 < (Int 0)) then gcd_data(a1,b1,x1,minus_num a2,minus_num + b2,minus_num x2) + else if (x1 = (Int 0)) then (a2,b2,x2) + else if (x1>x2) then gcd_data (a2,b2,x2,a1,b1,x1) + else ( + let r = (quo_num x2 x1) in + gcd_data (a1,b1,x1,a2 -/ r*/ a1,b2 -/ r*/ b1, x2 -/ r*/ x1) + ) in + gcd_data ((Int 1),(Int 0),x1,(Int 0),(Int 1),x2);; + +let gcd_num x1 x2 = + let rec gcd_data (a1,b1,x1,a2,b2,x2) = + if (x1 < (Int 0)) then + gcd_data(minus_num a1,minus_num b1,minus_num x1,a2,b2,x2) + else if (x2 < (Int 0)) then gcd_data(a1,b1,x1,minus_num a2,minus_num + b2,minus_num x2) + else if (x1 = (Int 0)) then (a2,b2,x2) + else if (x1>x2) then gcd_data (a2,b2,x2,a1,b1,x1) + else ( + let r = (quo_num x2 x1) in + gcd_data (a1,b1,x1,a2 -/ r*/ a1,b2 -/ r*/ b1, x2 -/ r*/ x1) + ) in + gcd_data ((Int 1),(Int 0),x1,(Int 0),(Int 1),x2);; + + (* g = gcd, (a',b') = (a,b)/g, g +r1'*a+s1'*b = r1*a+s1*b *) +let gcd_numdata a b = + let a = abs_num a in + let b = abs_num b in + let Z = Int 0 in + let (r,s,g) = gcd_num a b in + let a' = if (g=Z) then Z else round_num(a//g) in + let b' = if (g=Z) then Z else round_num(b//g) in + let _ = if not(a=a'*/g) then failwith "GCD_CONV a" else 0 in + let _ = if not(b=b'*/g) then failwith "GCD_CONV b" else 0 in + let _ = if not(g=r*/a+/s*/b) then failwith "GCD_CONV g" else 0 in + let (r1,r1') = if (r >/ Z) then (r,Z) else (Z,minus_num r) in + let (s1,s1') = if (s >/ Z) then (s,Z) else (Z,minus_num s) in + (g,a,b,a',b',r1',s1',r1,s1);; + +(* Here is the conversion. + Example: + GCD_CONV (`66`) (`144`) + +*) +let GCD_CONV at bt = + let a = dest_numeral at in + let b = dest_numeral bt in + let (g,a,b,a',b',r1',s1',r1,s1) = gcd_numdata a b in + prove(parse_term("GCD "^(string_of_num a)^" "^(string_of_num b)^" = "^ + (string_of_num g)), + (MATCH_MP_TAC gcd_certificate) + THEN (EXISTS_TAC (mk_numeral r1)) + THEN (EXISTS_TAC (mk_numeral s1)) + THEN (EXISTS_TAC (mk_numeral r1')) + THEN (EXISTS_TAC (mk_numeral s1')) + THEN (EXISTS_TAC (mk_numeral a')) + THEN (EXISTS_TAC (mk_numeral b')) + THEN (ARITH_TAC));; + +(* Example: + hol_gcd 66 144 + + This version can overflow on CAML integers before it reaches hol-light. + Example: + hol_gcd 1000000000000000000 10000000000000000000000 + - : thm = |- GCD 660865024 843055104 = 262144 +*) + +let hol_gcd a b = GCD_CONV (mk_small_numeral a) (mk_small_numeral b);; + +remove_interface ("||");; +pop_priority();; + + +(* test code *) + +exception Test_suite_num_ext_gcd of string;; + +(* For the tests we use integers a and b. These can overflow if + a and b are too large, so that we should confine ourselves to + tests that are not too large. +*) + +let test_num_ext_gcd (a, b) = + let a1 = string_of_int (abs a) in + let b1 = string_of_int (abs b) in + let c = gcd a b in + let c1 = string_of_int (abs c) in + let th = GCD_CONV (mk_small_numeral a) (mk_small_numeral b) in + if (not (hyp th = ([]:term list))) then raise + (failwith ("num_ext_gcd test suite failure "^a1^" "^b1)) + else if (not (concl th = (parse_term ("GCD "^a1^" "^b1^"="^c1)))) + then raise (failwith ("num_ext_gcd test suite failure "^a1^" "^b1)) + else ();; + + +let test_suite_num_ext_gcd = + let _ = + map test_num_ext_gcd + [(0,0);(0,1);(1,0);(-0,-0); + (2,3);(4,6); + (0,2);(2,0); + (10,100);(100,10);(17,100);(100,17)] in + print_string "num_ext_gcd loaded\n";; + +let divide = DIVIDE and + gcd = GCD and + gcd_conv = GCD_CONV;; + +end;; diff --git a/text_formalization/jordan/num_ext_nabs.hl b/text_formalization/jordan/num_ext_nabs.hl new file mode 100644 index 0000000..eb25d67 --- /dev/null +++ b/text_formalization/jordan/num_ext_nabs.hl @@ -0,0 +1,114 @@ +(* ========================================================================== *) +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Jordan *) +(* Copied from HOL Light jordan directory *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-08 *) +(* ========================================================================== *) + + +(* needs tactics_ext.ml *) + +module Num_ext_nabs = struct + +open Tactics_jordan;; + +Parse_ext_override_interface.unambiguous_interface();; + +let INT_NUM = prove(`!u. (integer (real_of_num u))`, + (REWRITE_TAC[is_int]) THEN GEN_TAC THEN + (EXISTS_TAC (`u:num`)) THEN (MESON_TAC[]));; + +let INT_NUM_REAL = prove(`!u. (real_of_int (int_of_num u) = real_of_num u)`, + (REWRITE_TAC[int_of_num]) THEN + GEN_TAC THEN (MESON_TAC[INT_NUM;int_rep]));; + +let INT_IS_INT = prove(`!(a:int). (integer (real_of_int a))`, + REWRITE_TAC[int_rep;int_abstr]);; + +let INT_OF_NUM_DEST = prove(`!a n. ((real_of_int a = (real_of_num n)) = + (a = int_of_num n))`, + (REWRITE_TAC[int_eq]) + THEN (REPEAT GEN_TAC) + THEN (REWRITE_TAC[int_of_num]) + THEN (ASSUME_TAC (SPEC (`n:num`) INT_NUM)) + THEN (UNDISCH_EL_TAC 0) + THEN (SIMP_TAC[int_rep]));; + +let INT_REP = prove(`!a. ?n m. (a = (int_of_num n) - (int_of_num m))`, + GEN_TAC + THEN (let tt =(REWRITE_RULE[is_int] (SPEC (`a:int`) INT_IS_INT)) in + (CHOOSE_TAC tt)) + THEN (POP_ASSUM DISJ_CASES_TAC) + THENL [ + (EXISTS_TAC (`n:num`)) THEN (EXISTS_TAC (`0`)) THEN + (ASM_REWRITE_TAC[INT_SUB_RZERO;GSYM INT_OF_NUM_DEST]); + (EXISTS_TAC (`0`)) THEN (EXISTS_TAC (`n:num`)) THEN + (REWRITE_TAC[INT_SUB_LZERO]) THEN + (UNDISCH_EL_TAC 0) THEN + (REWRITE_TAC[GSYM REAL_NEG_EQ;GSYM INT_NEG_EQ;GSYM int_neg_th;GSYM + INT_OF_NUM_DEST])]);; + +let INT_REP2 = prove( `!a. ?n. ((a = (&: n)) \/ (a = (--: (&: n))))`, +(GEN_TAC) + THEN ((let tt =(REWRITE_RULE[is_int] (SPEC (`a:int`) INT_IS_INT)) in + (CHOOSE_TAC tt))) + THEN ((POP_ASSUM DISJ_CASES_TAC)) + THENL + [ ((EXISTS_TAC (`n:num`))) + THEN ((ASM_REWRITE_TAC[GSYM INT_OF_NUM_DEST])); + ((EXISTS_TAC (`n:num`))) + (* THEN ((RULE_EL 0 (REWRITE_RULE[GSYM REAL_NEG_EQ;GSYM int_neg_th]))) *) + THEN (H_REWRITE_RULE[THM (GSYM REAL_NEG_EQ);THM (GSYM int_neg_th)] (HYP_INT 0)) + THEN ((ASM_REWRITE_TAC[GSYM INT_NEG_EQ;GSYM INT_OF_NUM_DEST]))]);; + + + +(* ------------------------------------------------------------------ *) +(* nabs : int -> num gives the natural number abs. value of an int *) +(* ------------------------------------------------------------------ *) + + +let nabs = new_definition(`nabs n = @u. ((n = int_of_num u) \/ (n = + int_neg (int_of_num u)))`);; + +let NABS_POS = prove(`!u. (nabs (int_of_num u)) = u`, + GEN_TAC + THEN (REWRITE_TAC [nabs]) + THEN (MATCH_MP_TAC SELECT_UNIQUE) + THEN (GEN_TAC THEN BETA_TAC) + THEN (EQ_TAC) + THENL [(TAUT_TAC (` ((A==>C)/\ (B==>C)) ==> (A\/B ==>C) `)); + MESON_TAC[]] + THEN CONJ_TAC THENL + (let branch2 = (REWRITE_TAC[int_eq;int_neg_th;INT_NUM_REAL]) + THEN (REWRITE_TAC[prove (`! u y.(((real_of_num u) = --(real_of_num y))= + ((real_of_num u) +(real_of_num y) = (&0)))`,REAL_ARITH_TAC)]) + THEN (REWRITE_TAC[REAL_OF_NUM_ADD;REAL_OF_NUM_EQ]) + THEN (MESON_TAC[ADD_EQ_0]) in + [(REWRITE_TAC[int_eq;INT_NUM_REAL]);branch2]) + THEN (REWRITE_TAC[INT_NUM_REAL]) + THEN (MESON_TAC[REAL_OF_NUM_EQ]));; + +let NABS_NEG = prove(`!n. (nabs (-- (int_of_num n))) = n`, + GEN_TAC + THEN (REWRITE_TAC [nabs]) + THEN (MATCH_MP_TAC SELECT_UNIQUE) + THEN (GEN_TAC THEN BETA_TAC) + THEN (EQ_TAC) + THENL [(TAUT_TAC (` ((A==>C)/\ (B==>C)) ==> (A\/B ==>C) `)); + MESON_TAC[]] + THEN CONJ_TAC THENL + (let branch1 = (REWRITE_TAC[int_eq;int_neg_th;INT_NUM_REAL]) + THEN (REWRITE_TAC[prove (`! u y.((--(real_of_num u) = (real_of_num y))= + ((real_of_num u) +(real_of_num y) = (&0)))`,REAL_ARITH_TAC)]) + THEN (REWRITE_TAC[REAL_OF_NUM_ADD;REAL_OF_NUM_EQ]) + THEN (MESON_TAC[ADD_EQ_0]) in + [branch1;(REWRITE_TAC[int_eq;INT_NUM_REAL])]) + THEN (REWRITE_TAC[INT_NUM_REAL;int_neg_th;REAL_NEG_EQ;REAL_NEGNEG]) + THEN (MESON_TAC[REAL_OF_NUM_EQ]));; + + +end;; diff --git a/text_formalization/jordan/parse_ext_override_interface.hl b/text_formalization/jordan/parse_ext_override_interface.hl new file mode 100644 index 0000000..adbd86f --- /dev/null +++ b/text_formalization/jordan/parse_ext_override_interface.hl @@ -0,0 +1,213 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Jordan *) +(* Copied from HOL Light jordan directory *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-08 *) +(* ========================================================================== *) + +module Parse_ext_override_interface = struct + +(* + + As a new user of HOL-light, I have had a difficult time distinguishing + between the different uses of overloaded operators such as + (+), ( * ), (abs) (&), and so forth. + + Their interpretation is context dependent, according to which of + prioritize_num, prioritize_int, and prioritize_real was most + recently called. + + This file removes all ambiguities in notation. + Following the usage of CAML, we append a dot to operations on real + numbers so that addition is (+.), etc. + + In the same way, we remove ambiguities between natural numbers and + integers by appending a character. We have chosen to use + the character `|` for natural number operations + and the character `:` for integer operations. + + The character `&` continues to denote the embedding of + natural numbers into the integers or reals. + + HOL-light parsing does not permit an operator mixing alphanumeric + characters with symbols. Thus, we were not able to use (abs.) + and (abs:) for the absolute value. Instead we adapt the usual notation + |x| for absolute value and write it in prefix notation ||: and + ||. for the integer and real absolute value functions respectively. + + In deference to HOL-light notation, we use ** for the exponential + function. There are three versions: ( **| ), ( **: ), and ( **. ). + +*) + +(* natural number operations *) + + + +let unambiguous_interface() = +parse_as_infix("+|",(16,"right")); +parse_as_infix("-|",(18,"left")); +parse_as_infix("*|",(20,"right")); +parse_as_infix("**|",(24,"left")); (* EXP *) +parse_as_infix("/|",(22,"right")); (* DIV *) +parse_as_infix("%|",(22,"left")); (* MOD *) +parse_as_infix("<|",(12,"right")); +parse_as_infix("<=|",(12,"right")); +parse_as_infix(">|",(12,"right")); +parse_as_infix(">=|",(12,"right")); +override_interface("+|",`(+):num->(num->num)`); +override_interface("-|",`(-):num->(num->num)`); +override_interface("*|",`( * ):num->(num->num)`); +override_interface("**|",`(EXP):num->(num->num)`); +override_interface("/|",`(DIV):num->(num->num)`); +override_interface("%|",`(MOD):num->(num->num)`); +override_interface("<|",`(<):num->(num->bool)`); +override_interface("<=|",`(<=):num->(num->bool)`); +override_interface(">|",`(>):num->(num->bool)`); +override_interface(">=|",`(>=):num->(num->bool)`); +(* integer operations *) +parse_as_infix("+:",(16,"right")); +parse_as_infix("-:",(18,"left")); +parse_as_infix("*:",(20,"right")); +parse_as_infix("**:",(24,"left")); +parse_as_infix("<:",(12,"right")); +parse_as_infix("<=:",(12,"right")); +parse_as_infix(">:",(12,"right")); +parse_as_infix(">=:",(12,"right")); +override_interface("+:",`int_add:int->int->int`); +override_interface("-:",`int_sub:int->int->int`); +override_interface("*:",`int_mul:int->int->int`); +override_interface("**:",`int_pow:int->num->int`); +(* boolean *) +override_interface("<:",`int_lt:int->int->bool`); +override_interface("<=:",`int_le:int->int->bool`); +override_interface(">:",`int_gt:int->int->bool`); +override_interface(">=:",`int_ge:int->int->bool`); +(* unary *) +override_interface("--:",`int_neg:int->int`); +override_interface("&:",`int_of_num:num->int`); +override_interface("||:",`int_abs:int->int`); +(* real number operations *) +parse_as_infix("+.",(16,"right")); +parse_as_infix("-.",(18,"left")); +parse_as_infix("*.",(20,"right")); +parse_as_infix("**.",(24,"left")); +parse_as_infix("<.",(12,"right")); +parse_as_infix("<=.",(12,"right")); +parse_as_infix(">.",(12,"right")); +parse_as_infix(">=.",(12,"right")); +override_interface("+.",`real_add:real->real->real`); +override_interface("-.",`real_sub:real->real->real`); +override_interface("*.",`real_mul:real->real->real`); +override_interface("**.",`real_pow:real->num->real`); +(* boolean *) +override_interface("<.",`real_lt:real->real->bool`); +override_interface("<=.",`real_le:real->real->bool`); +override_interface(">.",`real_gt:real->real->bool`); +override_interface(">=.",`real_ge:real->real->bool`); +(* unary *) +override_interface("--.",`real_neg:real->real`); +override_interface("&.",`real_of_num:num->real`); +override_interface("||.",`real_abs:real->real`);; + +let ambiguous_interface() = +reduce_interface("+|",`(+):num->(num->num)`); +reduce_interface("-|",`(-):num->(num->num)`); +reduce_interface("*|",`( * ):num->(num->num)`); +reduce_interface("**|",`(EXP):num->(num->num)`); +reduce_interface("/|",`(DIV):num->(num->num)`); +reduce_interface("%|",`(MOD):num->(num->num)`); +reduce_interface("<|",`(<):num->(num->bool)`); +reduce_interface("<=|",`(<=):num->(num->bool)`); +reduce_interface(">|",`(>):num->(num->bool)`); +reduce_interface(">=|",`(>=):num->(num->bool)`); +(* integer operations *) +reduce_interface("+:",`int_add:int->int->int`); +reduce_interface("-:",`int_sub:int->int->int`); +reduce_interface("*:",`int_mul:int->int->int`); +reduce_interface("**:",`int_pow:int->num->int`); +(* boolean *) +reduce_interface("<:",`int_lt:int->int->bool`); +reduce_interface("<=:",`int_le:int->int->bool`); +reduce_interface(">:",`int_gt:int->int->bool`); +reduce_interface(">=:",`int_ge:int->int->bool`); +(* unary *) +reduce_interface("--:",`int_neg:int->int`); +reduce_interface("&:",`int_of_num:num->int`); +reduce_interface("||:",`int_abs:int->int`); +(* real *) +reduce_interface("+.",`real_add:real->real->real`); +reduce_interface("-.",`real_sub:real->real->real`); +reduce_interface("*.",`real_mul:real->real->real`); +reduce_interface("**.",`real_pow:real->num->real`); +(* boolean *) +reduce_interface("<.",`real_lt:real->real->bool`); +reduce_interface("<=.",`real_le:real->real->bool`); +reduce_interface(">.",`real_gt:real->real->bool`); +reduce_interface(">=.",`real_ge:real->real->bool`); +(* unary *) +reduce_interface("--.",`real_neg:real->real`); +reduce_interface("&.",`real_of_num:num->real`); +reduce_interface("||.",`real_abs:real->real`);; + +(* add to Harrison's priorities the functions pop_priority and get_priority *) + +let prioritize_int,prioritize_num,prioritize_real,pop_priority,get_priority = + let v = ref ([]:string list) in + let prioritize_int() = + v:= "int"::!v; + overload_interface ("+",`int_add:int->int->int`); + overload_interface ("-",`int_sub:int->int->int`); + overload_interface ("*",`int_mul:int->int->int`); + overload_interface ("<",`int_lt:int->int->bool`); + overload_interface ("<=",`int_le:int->int->bool`); + overload_interface (">",`int_gt:int->int->bool`); + overload_interface (">=",`int_ge:int->int->bool`); + overload_interface ("--",`int_neg:int->int`); + overload_interface ("pow",`int_pow:int->num->int`); + overload_interface ("abs",`int_abs:int->int`); + override_interface ("&",`int_of_num:num->int`) and + prioritize_num() = + v:= "num"::!v; + overload_interface ("+",`(+):num->num->num`); + overload_interface ("-",`(-):num->num->num`); + overload_interface ("*",`(*):num->num->num`); + overload_interface ("<",`(<):num->num->bool`); + overload_interface ("<=",`(<=):num->num->bool`); + overload_interface (">",`(>):num->num->bool`); + overload_interface (">=",`(>=):num->num->bool`) and + prioritize_real() = + v:= "real"::!v; + overload_interface ("+",`real_add:real->real->real`); + overload_interface ("-",`real_sub:real->real->real`); + overload_interface ("*",`real_mul:real->real->real`); + overload_interface ("/",`real_div:real->real->real`); + overload_interface ("<",`real_lt:real->real->bool`); + overload_interface ("<=",`real_le:real->real->bool`); + overload_interface (">",`real_gt:real->real->bool`); + overload_interface (">=",`real_ge:real->real->bool`); + overload_interface ("--",`real_neg:real->real`); + overload_interface ("pow",`real_pow:real->num->real`); + overload_interface ("inv",`real_inv:real->real`); + overload_interface ("abs",`real_abs:real->real`); + override_interface ("&",`real_of_num:num->real`) and + pop_priority() = + if (length !v <= 1) then (print_string "priority unchanged\n") else + let (a::b::c) = !v in + v:= (b::c); + print_string ("priority is now "^b^"\n"); + match a with + "num" -> prioritize_num() | + "int" -> prioritize_int() | + "real"-> prioritize_real()| + _ -> () and + get_priority() = + if (!v=[]) then "unknown" else + let (a::b) = !v in a + in + prioritize_int,prioritize_num,prioritize_real,pop_priority,get_priority;; + + +end;; diff --git a/text_formalization/jordan/real_ext.hl b/text_formalization/jordan/real_ext.hl new file mode 100644 index 0000000..adb0b8d --- /dev/null +++ b/text_formalization/jordan/real_ext.hl @@ -0,0 +1,306 @@ + +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Jordan *) +(* Copied from HOL Light jordan directory *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-08 *) +(* ========================================================================== *) + +module Real_ext = struct + +open Parse_ext_override_interface;; +(* open Tactics_jordan;; *) + + + +(* ------------------------------------------------------------------ *) +(* Theorems that construct and propagate equality and inequality *) +(* ------------------------------------------------------------------ *) + +(* ------------------------------------------------------------------ *) +(* Propagation of =EQUAL= *) +(* ------------------------------------------------------------------ *) + +unambiguous_interface();; +prioritize_num();; + +let REAL_LE = REAL_OF_NUM_LE;; + +let pow = real_pow;; + +let REAL_LE_POW_2 = Collect_geom.REAL_LE_POW_2;; + + +let REAL_INV2 = prove( + `(inv(&. 2)*(&. 2) = (&.1)) /\ ((&. 2)*inv(&. 2) = (&.1))`, + SUBGOAL_THEN `~((&.2) = (&.0))` MP_TAC +THENL[ + REAL_ARITH_TAC; + SIMP_TAC[REAL_MUL_RINV;REAL_MUL_LINV]]);; + + + + +let REAL_MUL_LTIMES = prove (`!x a b. (x*.a = x*.b) ==> (~(x=(&.0))) ==> (a =b)`, + MESON_TAC[REAL_EQ_MUL_LCANCEL]);; + +let REAL_MUL_RTIMES = prove (`!x a b. (a*.x = b*.x) ==> (~(x=(&.0))) ==> (a =b)`, + MESON_TAC[REAL_EQ_MUL_RCANCEL]);; + +let REAL_PROP_EQ_LMUL = REAL_MUL_LTIMES;; +let REAL_PROP_EQ_RMUL = REAL_MUL_RTIMES;; + +let REAL_PROP_EQ_LMUL_' = REAL_EQ_MUL_LCANCEL (* |- !x y z. (x * y = x * z) = (x = &0) \/ (y = z) *);; +let REAL_PROP_EQ_RMUL_' = REAL_EQ_MUL_LCANCEL (* |- !x y z. (x * z = y * z) = (x = y) \/ (z = &0) *);; +(* see also minor variations REAL_LT_LMUL_EQ, REAL_LT_RMUL_EQ *) + +let REAL_PROP_EQ_SQRT = SQRT_INJ;; (* |- !x y. &0 <= x /\ &0 <= y ==> ((sqrt x = sqrt y) = x = y) *) + +(* ------------------------------------------------------------------ *) +(* Construction of <=. *) +(* ------------------------------------------------------------------ *) +let REAL_MK_LE_SQUARE = Collect_geom.REAL_LE_SQUARE_POW ;; (* |- !x. &0 <= x pow 2 *) + +(* ------------------------------------------------------------------ *) +(* Propagation of <=. *) +(* ------------------------------------------------------------------ *) + +let REAL_MUL_LTIMES_LE = prove (`!x a b. (x*.a <=. x*.b) ==> (&.0 < x) ==> (a <=. b)`, + MESON_TAC[REAL_LE_LMUL_EQ]);; + (* virtually identical to REAL_LE_LCANCEL_IMP, REAL_LE_LMUL_EQ *) + +let REAL_MUL_RTIMES_LE = prove (`!x a b. (a*.x <=. b*.x) ==> (&.0 < x) ==> (a <=. b)`, + MESON_TAC[REAL_LE_RMUL_EQ]);; + (* virtually identical to REAL_LE_RCANCEL_IMP, REAL_LE_RMUL_EQ *) + +let REAL_PROP_LE_LCANCEL = REAL_MUL_LTIMES_LE;; +let REAL_PROP_LE_RCANCEL = REAL_MUL_RTIMES_LE;; +let REAL_PROP_LE_LMUL = REAL_LE_LMUL (* |- !x y z. &0 <= x /\ y <= z ==> x * y <= x * z *);; +let REAL_PROP_LE_RMUL = REAL_LE_RMUL (* |- !x y z. x <= y /\ &0 <= z ==> x * z <= y * z *);; +let REAL_PROP_LE_LRMUL = REAL_LE_MUL2;; (* |- !w x y z. &0 <= w /\ w <= x /\ &0 <= y /\ y <= z ==> w * y <= x * z *) +let REAL_PROP_LE_POW = REAL_POW_LE2;; (* 2010-07-08 thales: POW_LE;; *) (* |- !n x y. &0 <= x /\ x <= y ==> x pow n <= y pow n *) +let REAL_PROP_LE_SQRT = SQRT_MONO_LE_EQ;; (* |- !x y. &0 <= x /\ &0 <= y ==> (sqrt x <= sqrt y = x <= y) *) + +(* ------------------------------------------------------------------ *) +(* Construction of LT *) +(* ------------------------------------------------------------------ *) + +let REAL_MK_LT_SQUARE = REAL_LT_SQUARE;; (* |- !x. &0 < x * x = ~(x = &0) *) + +(* ------------------------------------------------------------------ *) +(* Propagation of LT *) +(* ------------------------------------------------------------------ *) + +let REAL_PROP_LT_LCANCEL = REAL_LT_LCANCEL_IMP (* |- !x y z. &0 < x /\ x * y < x * z ==> y < z *);; +let REAL_PROP_LT_RCANCEL = REAL_LT_RCANCEL_IMP (* |- !x y z. &0 < z /\ x * z < y * z ==> x < y *);; +let REAL_PROP_LT_LMUL = REAL_LT_LMUL (* |- !x y z. &0 < x /\ y < z ==> x * y < x * z *);; +let REAL_PROP_LT_RMUL = REAL_LT_RMUL (* |- !x y z. x < y /\ &0 < z ==> x * z < y * z *);; +(* minor variation REAL_LT_LMUL_IMP, REAL_LT_RMUL_IMP *) + +let REAL_PROP_LT_LRMUL= REAL_LT_MUL2;; (* |- !w x y z. &0 <= w /\ w < x /\ &0 <= y /\ y < z ==> w * y < x * z *) +let REAL_PROP_LT_SQRT = SQRT_MONO_LT_EQ;; (* |- !x y. &0 <= x /\ &0 <= y ==> (sqrt x < sqrt y = x < y) *) + +(* ------------------------------------------------------------------ *) +(* Constructors of Non-negative *) +(* ------------------------------------------------------------------ *) + +let REAL_MK_NN_SQUARE = REAL_LE_SQUARE;; (* |- !x. &0 <= x * x *) +let REAL_MK_NN_ABS = REAL_ABS_POS;; (* 2010 *) (* |- !x. &0 <= abs x *) + +(* moved here from float.hl *) + +(* from 778 *) + + +let REAL_LE_LMUL_LOCAL = prove( + `!x y z. &0 < x ==> ((x * y) <= (x * z) <=> y <= z)`, + REPEAT GEN_TAC THEN DISCH_TAC THEN ONCE_REWRITE_TAC[GSYM REAL_NOT_LT] THEN + AP_TERM_TAC THEN MATCH_MP_TAC REAL_LT_LMUL_EQ THEN ASM_REWRITE_TAC[]);; + + +let ABS_TRIANGLE = prove( + `!x y. abs(x + y) <= abs(x) + abs(y)`, + REPEAT GEN_TAC THEN REWRITE_TAC[real_abs] THEN + REPEAT COND_CASES_TAC THEN + REWRITE_TAC[REAL_NEG_ADD; REAL_LE_REFL; REAL_LE_LADD; REAL_LE_RADD] THEN + ASM_REWRITE_TAC[GSYM REAL_NEG_ADD; REAL_LE_NEGL; REAL_LE_NEGR] THEN + RULE_ASSUM_TAC(REWRITE_RULE[REAL_NOT_LE]) THEN + TRY(MATCH_MP_TAC REAL_LT_IMP_LE) THEN TRY(FIRST_ASSUM ACCEPT_TAC) THEN + TRY(UNDISCH_TAC `(x + y) < &0`) THEN SUBST1_TAC(SYM(SPEC `&0` REAL_ADD_LID)) + THEN REWRITE_TAC[REAL_NOT_LT] THEN + MAP_FIRST MATCH_MP_TAC [REAL_LT_ADD2; REAL_LE_ADD2] THEN + ASM_REWRITE_TAC[]);; + +let REAL_LE_LMUL_IMP = prove( + `!x y z. &0 <= x /\ y <= z ==> (x * y) <= (x * z)`, + REPEAT GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN + DISCH_THEN(DISJ_CASES_TAC o REWRITE_RULE[REAL_LE_LT]) THENL + [FIRST_ASSUM(fun th -> ASM_REWRITE_TAC[MATCH_MP REAL_LE_LMUL_LOCAL th]); + FIRST_ASSUM(SUBST1_TAC o SYM) THEN REWRITE_TAC[REAL_MUL_LZERO] THEN + MATCH_ACCEPT_TAC REAL_LE_REFL]);; + + +(* from ? *) + +let ABS_POS = prove( + `!x. &0 <= abs(x)`, + GEN_TAC THEN ASM_CASES_TAC `&0 <= x` THENL + [ALL_TAC; + MP_TAC(SPEC `x:real` REAL_LE_NEGTOTAL) THEN ASM_REWRITE_TAC[] THEN + DISCH_TAC] THEN + ASM_REWRITE_TAC[real_abs]);; + + +let REAL_PROP_LE_LABS = prove( + `!x y z. (y <=. z) ==> ((abs x)* y <=. (abs x) *z)`,(SIMP_TAC[REAL_LE_LMUL_IMP;ABS_POS]));; + +let REAL_LE_RMUL_IMP = prove( + `!x y z. &0 <= x /\ y <= z ==> (y * x) <= (z * x)`, + ONCE_REWRITE_TAC[REAL_MUL_SYM] THEN MATCH_ACCEPT_TAC REAL_LE_LMUL_IMP);; + + +(* ------------------------------------------------------------------ *) +(* Propagation of Non-negative *) +(* ------------------------------------------------------------------ *) + +let REAL_PROP_NN_POS = prove(`! x y. x<. y ==> x <= y`,MESON_TAC[REAL_LT_LE]);; +let REAL_PROP_NN_ADD2 = REAL_LE_ADD (* |- !x y. &0 <= x /\ &0 <= y ==> &0 <= x + y *);; +let REAL_PROP_NN_DOUBLE = REAL_LE_DOUBLE (* |- !x. &0 <= x + x <=> &0 <= x *);; +let REAL_PROP_NN_RCANCEL= prove(`!x y. &.0 <. x /\ (&.0) <=. y*.x ==> ((&.0) <=. y)`, + MESON_TAC[REAL_PROP_LE_RCANCEL;REAL_MUL_LZERO]);; +let REAL_PROP_NN_LCANCEL= prove(`!x y. &.0 <. x /\ (&.0) <=. x*.y ==> ((&.0) <=. y)`, + MESON_TAC[REAL_PROP_LE_LCANCEL;REAL_MUL_RZERO]);; +let REAL_PROP_NN_MUL2 = REAL_LE_MUL (* |- !x y. &0 <= x /\ &0 <= y ==> &0 <= x * y *);; +let REAL_PROP_NN_POW = REAL_POW_LE (* |- !x n. &0 <= x ==> &0 <= x pow n *);; +let REAL_PROP_NN_SQUARE = Collect_geom.REAL_LE_POW_2;; (* |- !x. &0 <= x pow 2 *) +let REAL_PROP_NN_SQRT = SQRT_POS_LE;; (* |- !x. &0 <= x ==> &0 <= sqrt x *) +let REAL_PROP_NN_INV = REAL_LE_INV_EQ (* |- !x. &0 <= inv x = &0 <= x *);; +let REAL_PROP_NN_SIN = SIN_POS_PI_LE;; (* |- !x. &0 <= x /\ x <= pi ==> &0 <= sin x *) +let REAL_PROP_NN_ATN = ATN_POS_LE;; (* |- &0 <= atn x = &0 <= x *) + + +(* ------------------------------------------------------------------ *) +(* Constructor of POS *) +(* ------------------------------------------------------------------ *) + +let REAL_MK_POS_ABS = REAL_ABS_NZ (* |- !x. ~(x = &0) = &0 < abs x *);; +let REAL_MK_POS_EXP = REAL_EXP_POS_LT;; (* |- !x. &0 < exp x *) + +(* let REAL_MK_POS_LN = LN_POS_LT;; (* |- !x. &1 < x ==> &0 < ln x *) *) + +let REAL_MK_POS_PI = PI_POS;; (* |- &0 < pi *) + + +(* ------------------------------------------------------------------ *) +(* Propagation of POS *) +(* ------------------------------------------------------------------ *) + +let REAL_PROP_POS_ADD2 = REAL_LT_ADD (* |- !x y. &0 < x /\ &0 < y ==> &0 < x + y *);; +let REAL_PROP_POS_LADD = REAL_LET_ADD (* |- !x y. &0 <= x /\ &0 < y ==> &0 < x + y *);; +let REAL_PROP_POS_RADD = REAL_LTE_ADD (* |- !x y. &0 < x /\ &0 <= y ==> &0 < x + y *);; +let REAL_PROP_POS_LMUL = REAL_LT_MUL_EQ;; (* REAL_LT_LMUL_0;; *) (* |- !x y. &0 < x ==> (&0 < x * y = &0 < y) *) +let REAL_PROP_POS_RMUL = REAL_LT_MUL_EQ;; (* REAL_LT_RMUL_0;; *) (* |- !x y. &0 < y ==> (&0 < x * y = &0 < x) *) +let REAL_PROP_POS_MUL2 = REAL_LT_MUL (* |- !x y. &0 < x /\ &0 < y ==> &0 < x * y *);; +let REAL_PROP_POS_SQRT = SQRT_POS_LT;; (* |- !x. &0 < x ==> &0 < sqrt x *) +let REAL_PROP_POS_POW = REAL_POW_LT (* |- !x n. &0 < x ==> &0 < x pow n *);; +let REAL_PROP_POS_INV = REAL_LT_INV (* |- !x. &0 < x ==> &0 < inv x *);; +let REAL_PROP_POS_SIN = SIN_POS_PI;; (* |- !x. &0 < x /\ x < pi ==> &0 < sin x *) +let REAL_PROP_POS_TAN = TAN_POS_PI2;; (* |- !x. &0 < x /\ x < pi / &2 ==> &0 < tan x *) +let REAL_PROP_POS_ATN = ATN_POS_LT;; (* |- &0 < atn x = &0 < x *) + +(* ------------------------------------------------------------------ *) +(* Construction of NZ *) +(* ------------------------------------------------------------------ *) + +(* renamed from REAL_MK_NZ_OF_POS *) +let REAL_MK_NZ_POS = REAL_POS_NZ (* |- !x. &0 < x ==> ~(x = &0) *);; +let REAL_MK_NZ_EXP = REAL_EXP_NZ;; (* |- !x. ~(exp x = &0) *) + +(* ------------------------------------------------------------------ *) +(* Propagation of NZ *) +(* ------------------------------------------------------------------ *) + +(* renamed from REAL_ABS_NZ, moved from float.ml *) +let REAL_PROP_NZ_ABS = prove(`!x. (~(x = (&.0))) ==> (~(abs(x) = (&.0)))`, + REWRITE_TAC[REAL_ABS_ZERO]);; +let REAL_PROP_NZ_POW = REAL_POW_NZ (* |- !x n. ~(x = &0) ==> ~(x pow n = &0) *);; + +(* +let REAL_PROP_NZ_INV = REAL_INV_NZ;; (* |- !x. ~(x = &0) ==> ~(inv x = &0) *) +*) + +(* ------------------------------------------------------------------ *) +(* Propagation of ZERO *) +(* ------------------------------------------------------------------ *) + +let REAL_PROP_ZERO_ABS = REAL_ABS_ZERO (* |- !x. (abs x = &0) = x = &0); *);; +(* let REAL_PROP_ZERO_NEG = REAL_NEG_EQ_0 ;; (* |- !x. (--x = &0) = x = &0 *) *) +let REAL_PROP_ZERO_INV = REAL_INV_EQ_0 (* |- !x. (inv x = &0) = x = &0 *);; +(* let REAL_PROP_ZERO_NEG = REAL_NEG_EQ0;; (* |- !x. (--x = &0) = x = &0 *) *) +(* let REAL_PROP_ZERO_SUMSQ = REAL_SUMSQ;; (* |- !x y. (x * x + y * y = &0) = (x = &0) /\ (y = &0) *) *) +let REAL_PROP_ZERO_POW = REAL_POW_EQ_0;; (* |- !x n. (x pow n = &0) = (x = &0) /\ ~(n = 0) *) +let REAL_PROP_ZERO_SQRT = SQRT_EQ_0;; (* |- !x. &0 <= x ==> (x / sqrt x = sqrt x) *) + +(* ------------------------------------------------------------------ *) +(* Special values of functions *) +(* ------------------------------------------------------------------ *) + +let REAL_SV_LADD_0 = REAL_ADD_LID (* |- !x. &0 + x = x); *);; +let REAL_SV_INV_0 = REAL_INV_0 (* |- inv (&0) = &0 *);; +let REAL_SV_RMUL_0 = REAL_MUL_RZERO (* |- !x. x * &0 = &0 *);; +let REAL_SV_LMUL_0 = REAL_MUL_LZERO (* |- !x. &0 * x = &0 *);; +let REAL_SV_NEG_0 = REAL_NEG_0 (* |- -- &0 = &0 *);; +let REAL_SV_ABS_0 = REAL_ABS_0 (* |- abs (&0) = &0 *);; +let REAL_SV_EXP_0 = REAL_EXP_0;; (* |- exp (&0) = &1 *) +(* let REAL_SV_LN_1 = LN_1;; (* |- ln (&1) = &0 *) *) +let REAL_SV_SQRT_0 = SQRT_0;; (* |- sqrt (&0) = &0 *) +let REAL_SV_TAN_0 = TAN_0;; (* |- tan (&0) = &0 *) +let REAL_SV_TAN_PI = TAN_PI;; (* |- tan pi = &0 *) + +(* ------------------------------------------------------------------ *) +(* A tactic that multiplies a real on the left *) +(* ------------------------------------------------------------------ *) + +(** +#g `a:real = b:real`;; +#e (REAL_LMUL_TAC `c:real`);; +it : goalstack = 2 subgoals (2 total) +`~(c = &0)` + +`c * a = c * b` + + 0 [`~(c = &0)`] +# +**) +(* ------------------------------------------------------------------ *) + + + +let REAL_LMUL_TAC t = + let REAL_MUL_LTIMES = + prove ((`!x a b. + (((~(x=(&0)) ==> (x*a = x*b)) /\ ~(x=(&0))) ==> (a = b))`), + MESON_TAC[REAL_EQ_MUL_LCANCEL]) in + (MATCH_MP_TAC (SPEC t REAL_MUL_LTIMES)) + THEN CONJ_TAC + THENL [DISCH_TAC; ALL_TAC];; + +(* ------------------------------------------------------------------ *) +(* Right multiply by a real *) +(* ------------------------------------------------------------------ *) + +let REAL_RMUL_TAC t = + let REAL_MUL_RTIMES = + prove (`!x a b. + ((~(x=(&0))==>(a*x = b*x)) /\ ~(x=(&0))) ==> (a = b)`, + MESON_TAC[REAL_EQ_MUL_RCANCEL]) in + (MATCH_MP_TAC (SPEC t REAL_MUL_RTIMES)) + THEN CONJ_TAC + THENL [DISCH_TAC; ALL_TAC];; + + +pop_priority();; + +end;; diff --git a/text_formalization/jordan/real_ext_geom_series.hl b/text_formalization/jordan/real_ext_geom_series.hl new file mode 100644 index 0000000..41a37e9 --- /dev/null +++ b/text_formalization/jordan/real_ext_geom_series.hl @@ -0,0 +1,66 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Jordan *) +(* Copied from HOL Light jordan directory *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-08 *) +(* ========================================================================== *) + +(* needs tactics_ext.ml *) + +module Real_ext_geom_series = struct + +open Tactics_jordan;; + +prioritize_real();; + +let (TRY_RULE:(thm->thm) -> (thm->thm)) = + fun rl t -> try (rl t) with _ -> t;; + + +let REAL_MUL_RTIMES = + prove ((`!x a b. + (((~(x=(&0))==>(a*x = b*x)) /\ ~(x=(&0))) ==> (a = b))`), + MESON_TAC[REAL_EQ_MUL_RCANCEL]);; + +(* +let GEOMETRIC_SUM = prove( + `!m n x.(~(x=(&1)) ==> + (sum(m,n) (\k.(x pow k)) = ((x pow m) - (x pow (m+n)))/((&1)-x)))`, + let tac1 = + GEN_TAC + THEN INDUCT_TAC + THEN GEN_TAC + THEN DISCH_TAC + THEN (REWRITE_TAC + [sum_DEF;real_pow;ADD_CLAUSES;real_div;REAL_SUB_RDISTRIB; + REAL_SUB_REFL]) in + let tac2 = + (RULE_ASSUM_TAC (TRY_RULE (SPEC (`x:real`)))) + THEN (UNDISCH_EL_TAC 1) + THEN (UNDISCH_EL_TAC 0) + THEN (TAUT_TAC (`(A==>(B==>C)) ==> (A ==> ((A==>B) ==>C))`)) + THEN (REPEAT DISCH_TAC) + THEN (ASM_REWRITE_TAC[real_div]) + THEN (ABBREV_TAC (`a:real = x pow m`)) + THEN (ABBREV_TAC (`b:real = x pow (m+n)`)) in + let tac3 = + (MATCH_MP_TAC (SPEC (`&1 - x`) REAL_MUL_RTIMES)) + THEN CONJ_TAC + THENL [ALL_TAC; (UNDISCH_TAC (`~(x = (&1))`)) + THEN (ACCEPT_TAC (REAL_ARITH (`~(x=(&1)) ==> ~((&1 - x = (&0)))`)))] + THEN (REWRITE_TAC + [GSYM REAL_MUL_ASSOC;REAL_ADD_RDISTRIB;REAL_SUB_RDISTRIB]) + THEN (SIMP_TAC[REAL_MUL_LINV]) + THEN DISCH_TAC + THEN (REWRITE_TAC + [REAL_SUB_LDISTRIB;REAL_MUL_LID;REAL_MUL_RID;REAL_MUL_ASSOC]) + THEN (ACCEPT_TAC (REAL_ARITH (`a - b + b - b*x = a - x*b`))) in + (tac1 THEN tac2 THEN tac3));; + + +(* pop_priority();; *) +*) + +end;; diff --git a/text_formalization/jordan/refinement.hl b/text_formalization/jordan/refinement.hl new file mode 100644 index 0000000..bac68a0 --- /dev/null +++ b/text_formalization/jordan/refinement.hl @@ -0,0 +1,80 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Jordan *) +(* Copied from HOL Light jordan directory *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-08 *) +(* ========================================================================== *) + + + +module Refinement = struct + +(* ------------------------------------------------------------------ *) +(* This bundles an interactive session into a proof. *) +(* Later split off into general/prove_by_refinement *) +(* ------------------------------------------------------------------ *) + +(* +let labels_flag = ref false;; (* if true add labels to assumptions *) +*) + +let LABEL_ALL_TAC:tactic = + let mk_label avoid = + let rec mk_one_label i avoid = + let label = "Z-"^(string_of_int i) in + if not(mem label avoid) then label else mk_one_label (i+1) avoid in + mk_one_label 0 avoid in + let update_label i asl = + let rec f_at_i f j = + function [] -> [] + | a::b -> if (j=0) then (f a)::b else a::(f_at_i f (j-1) b) in + let avoid = map fst asl in + let current = el i avoid in + let new_label = mk_label avoid in + if (String.length current > 0) then asl else + f_at_i (fun (_,y) -> (new_label,y) ) i asl in + fun gl -> + let (asl,w) = dest_goal gl in + let aslp = ref asl in + (for i=0 to ((length asl)-1) do (aslp := update_label i !aslp) done; + (ALL_TAC (mk_goal(!aslp,w))));; + +(* global_var *) +let enhance flag every tac = + if flag then (tac THEN every) THEN LABEL_ALL_TAC + else tac;; + +let (e_enhance :bool ->tactic->tactic ->goalstack) = + fun flag every tac -> refine(by(VALID (enhance flag every tac)));; + +(* +let e_bak = e;; +let every = ALL_TAC;; +let e = e_enhance true every;; +*) + +let has_stv t = + let typ = (type_vars_in_term t) in + can (find (fun ty -> (is_vartype ty) && ((dest_vartype ty).[0] = '?'))) typ;; + +let enhanced_prove_by_refinement flag every (t,(tacl:tactic list)) = + if (length (frees t) > 0) + then failwith "prove_by_refinement: free vars" else + if (has_stv t) + then failwith "prove_by_refinement: has stv" else + let gstate = mk_goalstate ([],t) in + let _,sgs,just = rev_itlist + (fun tac gs -> by (enhance flag every tac) gs) + tacl gstate in + let th = if sgs = [] then just null_inst [] + else failwith "BY_REFINEMENT_PROOF: Unsolved goals" in + let t' = concl th in + if t' = t then th else + try EQ_MP (ALPHA t' t) th + with Failure _ -> failwith "prove_by_refinement: generated wrong theorem";; + +let prove_by_refinement = enhanced_prove_by_refinement false ALL_TAC;; + +end;; diff --git a/text_formalization/jordan/tactics_jordan.hl b/text_formalization/jordan/tactics_jordan.hl new file mode 100644 index 0000000..101623c --- /dev/null +++ b/text_formalization/jordan/tactics_jordan.hl @@ -0,0 +1,1717 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Jordan *) +(* Copied from HOL Light jordan directory *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-08 *) +(* ========================================================================== *) + +module Tactics_jordan = struct + +open Refinement;; +open Real_ext;; +open Hash_term;; +open Lib_ext;; + +(* ------------------------------------------------------------------ *) +(* MORE RECENT ADDITIONS *) +(* ------------------------------------------------------------------ *) + +Parse_ext_override_interface.unambiguous_interface();; + + + +(* OLD ONES *) + +(* ------------------------------------------------------------------ *) +(* SOME EASY TACTICS *) +(* ------------------------------------------------------------------ *) + +let TAUT_TAC t = (MATCH_MP_TAC (TAUT t));; + +let REP_GEN_TAC = REPEAT GEN_TAC;; + +let SUBGOAL_MP_TAC t = SUBGOAL_THEN t MP_TAC;; + +let DISCH_ALL_TAC = REP_GEN_TAC THEN + let tac = TAUT_TAC `(b ==> a==> c) ==> (a /\ b ==> c)` in + (REPEAT ((REPEAT tac) THEN DISCH_TAC)) THEN LABEL_ALL_TAC;; + +(* ------------------------------------------------------------------ *) +(* TACTICS BY NUMBER. These are probably best avoided. + NB: + The numbering is that in the asm list -- not the printed numbers! *) +(* ------------------------------------------------------------------ *) + +let (UNDISCH_EL_TAC:int -> tactic) = + fun i gl -> + let (asl,w) = dest_goal gl in + try let sthm,asl' = (el i asl),(drop i asl) in + let tm = concl (snd (el i asl)) in + let thm = snd sthm in + null_meta,[asl',mk_imp(tm,w)], + fun i [th] -> MP th (INSTANTIATE_ALL i thm) + with Failure _ -> failwith "UNDISCH_EL_TAC";; + +(* remove hypotheses by number *) +let rec (POPL_TAC:int list ->tactic) = + let (POP_TAC:int->tactic) = + fun i -> (UNDISCH_EL_TAC i) THEN (TAUT_TAC `B ==> (A==>B)`) in + let renumber i = + map(fun j -> if j<=i then j else (j-1)) in + function [] -> ALL_TAC | + (i::b) -> (POP_TAC i) THEN (POPL_TAC (renumber i b));; + +let rec (UNDISCH_LIST:int list -> tactic) = + let renumber i = + map(fun j -> if j<=i then j else (j-1)) in + function [] -> ALL_TAC | + (i::b) -> (UNDISCH_EL_TAC i) THEN (UNDISCH_LIST (renumber i b));; + +(* ------------------------------------------------------------------ *) +(* Transformations of Hypothesis List by LABELS *) +(* ------------------------------------------------------------------ *) + +type goalthm = goal -> thm;; + +let (HYP_INT:int->goalthm) = + fun i-> + fun gl -> + snd (el i (goal_asms gl));; + +let (HYP:string->goalthm) = + fun s gl -> + let asl = goal_asms gl in + try assoc s asl + with Failure _ -> try assoc ("Z-"^s) asl + with Failure _ -> failwith ("HYP not found: "^ s);; + +let (THM:thm->goalthm) = + fun thm -> + fun (_:goal) -> thm;; + +(* We are constructing functors, so to speak *) + +let (H_RULER: (thm list->thm->thm)->(goalthm list)-> goalthm -> tactic) = + fun rule gthl gthm -> + fun gl -> + let (asl,w) = dest_goal gl in + let thl = map (fun x-> (x gl)) gthl in + let th = rule thl (gthm gl) in + ASSUME_TAC th gl;; + +(* The next few term rules into goal_rules *) +(* H_type (x:type) should return an object + similar to x but with thms made into goalthms *) + +let (H_RULE_LIST: (thm list->thm->thm)->(goalthm list)-> goalthm -> goalthm) = + fun rule gthl gthm g -> + let thl = map (fun x-> (x g)) gthl in + rule thl (gthm g);; + +let H_RULE2 (rule:thm->thm->thm) = + fun gthm1 gthm2 -> H_RULE_LIST (fun thl th -> rule (hd thl) th) [gthm1] gthm2;; + +let H_RULE (rule:thm->thm) = fun gthm -> H_RULE_LIST (fun _ th -> rule th) [] gthm;; + +let (H_TTAC : thm_tactic -> goalthm -> tactic ) = + fun ttac gthm g -> (ttac (gthm g) g);; + +let H_ASSUME_TAC = H_TTAC ASSUME_TAC;; +let INPUT = fun gth -> (H_ASSUME_TAC gth) THEN LABEL_ALL_TAC;; + +let H_VAL2 (rule:thm->thm->thm) = + fun gthm1 gthm2 -> H_RULER (fun thl th -> rule (hd thl) th) [gthm1] gthm2;; + +let H_CONJ = H_VAL2(CONJ);; +let H_MATCH_MP = H_VAL2(MATCH_MP);; + +let H_REWRITE_RULE gthml gth = H_RULER REWRITE_RULE gthml gth;; +let H_ONCE_REWRITE_RULE gthml gth = H_RULER ONCE_REWRITE_RULE gthml gth;; +let H_SIMP_RULE = H_RULER SIMP_RULE;; + +let H_VAL (rule:thm->thm) = fun gthm -> H_RULER (fun _ th -> rule th) [] gthm;; +let H = H_VAL;; + +let H_CONJUNCT1 = H_VAL CONJUNCT1;; +let H_CONJUNCT2 = H_VAL CONJUNCT2;; +let H_EQT_INTRO = H_VAL EQT_INTRO;; +let H_EQT_ELIM = H_VAL EQT_ELIM;; +let H_SPEC = fun t -> H_VAL(SPEC t);; +let H_GEN = fun t -> H_VAL(GEN t);; +let H_DISJ1 = C (fun t -> H_VAL ((C DISJ1) t));; +let H_DISJ2 = (fun t -> H_VAL (( DISJ2) t));; + (* beware! One is inverted here. *) +let H_NOT_ELIM = H_VAL (NOT_ELIM);; +let H_NOT_INTRO = H_VAL (NOT_INTRO);; +let H_EQF_ELIM = H_VAL (EQF_ELIM);; +let H_EQF_INTRO = H_VAL (EQF_INTRO);; +let (&&&) = H_RULE2 CONJ;; + +let (H_UNDISCH_TAC:goalthm -> tactic) = + fun gthm g -> + let tm = concl(gthm g) in + UNDISCH_TAC tm g;; + + + +(* let upgs tac gs = by tac gs;; *) + +let (thm_op:goalthm->goalthm->goalthm) = + fun gt1 gt2 g -> + if (is_eq (snd (strip_forall (concl (gt1 g))))) + then REWRITE_RULE[gt1 g] (gt2 g) else + MATCH_MP (gt1 g) (gt2 g);; + +let (COMBO:goalthm list-> goalthm) = + fun gthl -> end_itlist thm_op gthl;; + +let INPUT_COMBO = INPUT o COMBO;; + + + + +(* abbrev_type copied from definitions_group.ml *) + + +let pthm = prove_by_refinement( + `(\ (x:A) .T) (@(x:A). T)`, + [BETA_TAC]);; + +let abbrev_type ty s = let (a,b) = new_basic_type_definition s + ("mk_"^s,"dest_"^s) + (INST_TYPE [ty,`:A`] pthm) in + let abst t = list_mk_forall ((frees t), t) in + let a' = abst (concl a) in + let b' = abst (rhs (concl b)) in + ( + prove_by_refinement(a',[REWRITE_TAC[a]]), + prove_by_refinement(b',[REWRITE_TAC[GSYM b]]));; + + +(* ------------------------------------------------------------------ *) +(* KILL IN *) +(* ------------------------------------------------------------------ *) + +let un = REWRITE_RULE[IN];; + +(* ------------------------------------------------------------------ *) + +let SUBCONJ_TAC = + MATCH_MP_TAC (TAUT `A /\ (A ==>B) ==> (A /\ B)`) THEN CONJ_TAC;; + +let PROOF_BY_CONTR_TAC = + MATCH_MP_TAC (TAUT `(~A ==> F) ==> A`) THEN DISCH_TAC;; + + + +(* ------------------------------------------------------------------ *) +(* some general tactics *) +(* ------------------------------------------------------------------ *) + +(* before adding assumption to hypothesis list, cleanse it + of unnecessary conditions *) + + +let CLEAN_ASSUME_TAC th = + MP_TAC th THEN ASM_REWRITE_TAC[] THEN DISCH_TAC;; + +let CLEAN_THEN th ttac = + MP_TAC th THEN ASM_REWRITE_TAC[] THEN DISCH_THEN ttac;; + +(* looks for a hypothesis by matching a subterm *) +let (UNDISCH_FIND_TAC: term -> tactic) = + fun tm gl -> + let (asl,w) = dest_goal gl in + let p = can (term_match[] tm) in + try let sthm,_ = remove + (fun (_,asm) -> can (find_term p) (concl ( asm))) asl in + UNDISCH_TAC (concl (snd sthm)) gl + with Failure _ -> failwith "UNDISCH_FIND_TAC";; + +let (UNDISCH_FIND_THEN: term -> thm_tactic -> tactic) = + fun tm ttac gl -> + let (asl,w) = dest_goal gl in + let p = can (term_match[] tm) in + try let sthm,_ = remove + (fun (_,asm) -> can (find_term p) (concl ( asm))) asl in + UNDISCH_THEN (concl (snd sthm)) ttac gl + with Failure _ -> failwith "UNDISCH_FIND_TAC";; + +(* ------------------------------------------------------------------ *) +(* NAME_CONFLICT_TAC : eliminate name conflicts in a term *) +(* ------------------------------------------------------------------ *) + +let relabel_bound_conv tm = + let rec vars_and_constants tm acc = + match tm with + | Var _ -> tm::acc + | Const _ -> tm::acc + | Comb(a,b) -> vars_and_constants b (vars_and_constants a acc) + | Abs(a,b) -> a::(vars_and_constants b acc) in + let relabel_bound tm = + match tm with + | Abs(x,t) -> + let avoids = filter ((!=) x) (vars_and_constants tm []) in + let x' = mk_primed_var avoids x in + if (x=x') then failwith "relabel_bound" else (alpha x' tm) + | _ -> failwith "relabel_bound" in + DEPTH_CONV (fun t -> ALPHA t (relabel_bound t)) tm;; + +(* example *) +let _ = + let bad_term = mk_abs (`x:bool`,`(x:num)+1=2`) in + relabel_bound_conv bad_term;; + +let NAME_CONFLICT_CONV = relabel_bound_conv;; + +let NAME_CONFLICT_TAC = CONV_TAC (relabel_bound_conv);; + +(* renames given bound variables *) +let alpha_conv env tm = ALPHA tm (deep_alpha env tm);; + +(* replaces given alpha-equivalent terms with- the term itself *) +let unify_alpha_tac = SUBST_ALL_TAC o REFL;; + +let rec get_abs tm acc = match tm with + Abs(u,v) -> get_abs v (tm::acc) + |Comb(u,v) -> get_abs u (get_abs v acc) + |_ -> acc;; + +(* for purposes such as sorting, it helps if ALL ALPHA-equiv + abstractions are replaced by equal abstractions *) +let (alpha_tac:tactic) = + fun gl -> + EVERY (map unify_alpha_tac (get_abs (goal_concl gl) [])) gl;; + +(* ------------------------------------------------------------------ *) +(* SELECT ELIMINATION. + SELECT_TAC should work whenever there is a single predicate selected. + Something more sophisticated might be needed when there + is (@)A and (@)B + in the same formula. + Useful for proving statements such as `1 + (@x. (x=3)) = 4` *) +(* ------------------------------------------------------------------ *) + +(* spec form of SELECT_AX *) +let select_thm select_fn select_exist = + BETA_RULE (ISPECL [select_fn;select_exist] + SELECT_AX);; + +(* example *) +select_thm + `\m. (X:num->bool) m /\ (!n. X n ==> m <=| n)` `n:num`;; + +let SELECT_EXIST = prove_by_refinement( + `!(P:A->bool) Q. (?y. P y) /\ (!t. (P t ==> Q t)) ==> Q ((@) P)`, + (* {{{ proof *) + + [ + REPEAT GEN_TAC; + DISCH_ALL_TAC; + UNDISCH_FIND_TAC `(?)`; + DISCH_THEN CHOOSE_TAC; + ASSUME_TAC (ISPECL[`P:(A->bool)`;`y:A`] SELECT_AX); + ASM_MESON_TAC[]; + ]);; + + (* }}} *) + +let SELECT_THM = prove_by_refinement( + `!(P:A->bool) Q. (((?y. P y) ==> (!t. (P t ==> Q t))) /\ ((~(?y. P y)) ==> + (!t. Q t))) ==> Q ((@) P)`, + (* {{{ proof *) + [ + MESON_TAC[SELECT_EXIST]; + ]);; + (* }}} *) + +let SELECT_TAC = + (* explicitly pull apart the clause Q((@) P), + because MATCH_MP_TAC isn't powerful + enough to do this by itself. *) + let unbeta = prove( + `!(P:A->bool) (Q:A->bool). (Q ((@) P)) <=> (\t. Q t) ((@) P)`,MESON_TAC[]) in + let unbeta_tac = CONV_TAC (HIGHER_REWRITE_CONV[unbeta] true) in + unbeta_tac THEN (MATCH_MP_TAC SELECT_THM) THEN BETA_TAC THEN CONJ_TAC + THENL[ + (DISCH_THEN (fun t-> ALL_TAC)) THEN GEN_TAC; + DISCH_TAC THEN GEN_TAC];; + +(* EXAMPLE: + +# g `(R:A->bool) ((@) S)`;; +val it : Core.goalstack = 1 subgoal (1 total) + +`R ((@) S)` + +# e SELECT_TAC ;; +val it : Core.goalstack = 2 subgoals (2 total) + + 0 [`~(?y. S y)`] + +`R t` + +`S t ==> R t` + +*) + + +(* ------------------------------------------------------------------ *) +(* TYPE_THEN and TYPEL_THEN calculate the types of the terms supplied + in a proof, avoiding the hassle of working them out by hand. + It locates the terms among the free variables in the goal. + Ambiguious if a free variables have name conflicts. + + Now TYPE_THEN handles general terms. +*) +(* ------------------------------------------------------------------ *) + + +let rec type_set: (string*term) list -> (term list*term) -> (term list*term)= + fun typinfo (acclist,utm) -> match acclist with + | [] -> (acclist,utm) + | (Var(s,_) as a)::rest -> + let a' = (assocd s typinfo a) in + if (a = a') then type_set typinfo (rest,utm) + else let inst = instantiate (term_match [] a a') in + type_set typinfo ((map inst rest),inst utm) + | _ -> failwith "type_set: variable expected" + ;; + +let has_stv t = + let typ = (type_vars_in_term t) in + can (find (fun ty -> (is_vartype ty) && ((dest_vartype ty).[0] = '?'))) typ;; + + +let TYPE_THEN: term -> (term -> tactic) -> tactic = + fun t (tac:term->tactic) gl -> + let (asl,w) = dest_goal gl in + let avoids = itlist (union o frees o concl o snd) asl + (frees w) in + let strip = fun t-> (match t with + |Var(s,_) -> (s,t) | _ -> failwith "TYPE_THEN" ) in + let typinfo = map strip avoids in + let t' = (snd (type_set typinfo ((frees t),t))) in + (warn ((has_stv t')) "TYPE_THEN: unresolved type variables"); + tac t' gl;; + +(* this version must take variables *) +let TYPEL_THEN: term list -> (term list -> tactic) -> tactic = + fun t (tac:term list->tactic) gl -> + let (asl,w) = dest_goal gl in + let avoids = itlist (union o frees o concl o snd) asl + (frees w) in + let strip = fun t-> (match t with + |Var(s,_) -> (s,t) | _ -> failwith "TYPE_THEN" ) in + let typinfo = map strip avoids in + let t' = map (fun u -> snd (type_set typinfo ((frees u),u))) t in + (warn ((can (find has_stv) t')) "TYPEL_THEN: unresolved type vars"); + tac t' gl;; + +(* trivial example *) + +let _ = prove_by_refinement(`!y. y:num = y`, + [ + GEN_TAC; + TYPE_THEN `y:A` (fun t -> ASSUME_TAC(ISPEC t (TAUT `!x:B. x=x`))); + UNDISCH_TAC `y:num = y`; (* evidence that `y:A` was retyped as `y:num` *) + MESON_TAC[]; + ]);; + + + + +(* ------------------------------------------------------------------ *) +(* SAVE the goalstate, and retrieve later *) +(* ------------------------------------------------------------------ *) + +let (save_goal,get_goal) = + let goal_buffer = ref [] in + let save_goal s = + goal_buffer := (s,!current_goalstack )::!goal_buffer in + let get_goal (s:string) = (current_goalstack:= assoc s !goal_buffer) in + (save_goal,get_goal);; + + +(* ------------------------------------------------------------------ *) +(* ordered rewrites with general ord function . + This allows rewrites with an arbitrary condition + -- adapted from simp.ml *) +(* ------------------------------------------------------------------ *) + + + +let net_of_thm_ord ord rep force th = + let t = concl th in + let lconsts = freesl (hyp th) in + let matchable = can o term_match lconsts in + try let l,r = dest_eq t in + if rep & free_in l r then + let th' = EQT_INTRO th in + enter lconsts (l,(1,REWR_CONV th')) + else if rep & matchable l r & matchable r l then + enter lconsts (l,(1,ORDERED_REWR_CONV ord th)) + else if force then + enter lconsts (l,(1,ORDERED_REWR_CONV ord th)) + else enter lconsts (l,(1,REWR_CONV th)) + with Failure _ -> + let l,r = dest_eq(rand t) in + if rep & free_in l r then + let tm = lhand t in + let th' = DISCH tm (EQT_INTRO(UNDISCH th)) in + enter lconsts (l,(3,IMP_REWR_CONV th')) + else if rep & matchable l r & matchable r l then + enter lconsts (l,(3,ORDERED_IMP_REWR_CONV ord th)) + else enter lconsts(l,(3,IMP_REWR_CONV th));; + +let GENERAL_REWRITE_ORD_CONV ord rep force (cnvl:conv->conv) (builtin_net:gconv net) thl = + let thl_canon = itlist (mk_rewrites false) thl [] in + let final_net = itlist (net_of_thm_ord ord rep force ) thl_canon builtin_net in + cnvl (REWRITES_CONV final_net);; + +let GEN_REWRITE_ORD_CONV ord force (cnvl:conv->conv) thl = + GENERAL_REWRITE_ORD_CONV ord false force cnvl empty_net thl;; + +let PURE_REWRITE_ORD_CONV ord force thl = + GENERAL_REWRITE_ORD_CONV ord true force TOP_DEPTH_CONV empty_net thl;; + +let REWRITE_ORD_CONV ord force thl = + GENERAL_REWRITE_ORD_CONV ord true force TOP_DEPTH_CONV (basic_net()) thl;; + +let PURE_ONCE_REWRITE_ORD_CONV ord force thl = + GENERAL_REWRITE_ORD_CONV ord false force ONCE_DEPTH_CONV empty_net thl;; + +let ONCE_REWRITE_ORD_CONV ord force thl = + GENERAL_REWRITE_ORD_CONV ord false force ONCE_DEPTH_CONV (basic_net()) thl;; + +let REWRITE_ORD_TAC ord force thl = CONV_TAC(REWRITE_ORD_CONV ord force thl);; + + + + +(* ------------------------------------------------------------------ *) +(* poly reduction *) +(* ------------------------------------------------------------------ *) + + +(* move vars leftward *) +(* if ord old_lhs new_rhs THEN swap *) + + +let new_factor_order t1 t2 = + try let t1v = fst(dest_binop `( *. )` t1) in + let t2v = fst(dest_binop `( *. )` t2) in + if (is_var t1v) & (is_var t2v) then term_order t1v t2v + else if (is_var t2v) then true else false + with Failure _ -> false ;; + +(* false if it contains a variable or abstraction. *) +let rec is_arith_const tm = + if is_var tm then false else + if is_abs tm then false else + if is_comb tm then + let (a,b) = (dest_comb tm) in + is_arith_const (a) & is_arith_const (b) + else true;; + +(* const leftward *) +let new_factor_order2 t1 t2 = + try let t1v = fst(dest_binop `( *. )` t1) in + let t2v = fst(dest_binop `( *. )` t2) in + if (is_var t1v) & (is_var t2v) then term_order t1v t2v + else if (is_arith_const t2v) then true else false + with Failure _ -> false ;; + +let rec mon_sz tm = + if is_var tm then + Int (Hashtbl.hash tm) + else + try let (a,b) = dest_binop `( *. )` tm in + (mon_sz a) */ (mon_sz b) + with Failure _ -> Int 1;; + +let rec new_summand_order t1 t2 = + try let t1v = fst(dest_binop `( +. )` t1) in + let t2v = fst(dest_binop `( +. )` t2) in + (mon_sz t2v >/ mon_sz t1v) + with Failure _ -> false ;; + +let rec new_distrib_order t1 t2 = + try let t2v = fst(dest_binop `( *. )` t2) in + if (is_arith_const t2v) then true else false + with Failure _ -> + try + let t2' = fst(dest_binop `( +. )` t2) in + new_distrib_order t1 t2' + with Failure _ -> false ;; + +let REAL_RDISTRIB = REAL_ARITH + `!x y z. (x + y) * z = (x * z) + (y * z)`;; (* new *) + +let REAL_LDISTRIB = REAL_ADD_LDISTRIB;; + +let real_poly_conv = + (* same side *) + ONCE_REWRITE_CONV [GSYM REAL_SUB_0] THENC + (* expand ALL *) + REWRITE_CONV[real_div;REAL_RDISTRIB;REAL_SUB_RDISTRIB; + real_pow; + GSYM REAL_MUL_ASSOC;GSYM REAL_ADD_ASSOC; + REAL_ARITH `(x -. (--y) = x + y) /\ (x - y = x + (-- y)) /\ + (--(x + y) = --x + (--y)) /\ (--(x - y) = --x + y)`; + REAL_ARITH + `(x*.(-- y) = -- (x*. y)) /\ (--. (--. x) = x) /\ + ((--. x)*.y = --.(x*.y))`; + REAL_SUB_LDISTRIB;REAL_LDISTRIB] THENC + (* move constants rightward on monomials *) + REWRITE_ORD_CONV new_factor_order false [REAL_MUL_AC;] THENC + GEN_REWRITE_CONV ONCE_DEPTH_CONV + [REAL_ARITH `-- x = (x*(-- &.1))`] THENC + REWRITE_CONV[GSYM REAL_MUL_ASSOC] THENC + REAL_RAT_REDUCE_CONV THENC + (* collect like monomials *) + REWRITE_ORD_CONV new_summand_order false [REAL_ADD_AC;] THENC + (* move constants leftward AND collect them together *) + REWRITE_ORD_CONV new_factor_order2 false [REAL_MUL_AC;] THENC + REWRITE_ORD_CONV new_distrib_order true [ + REAL_ARITH `(a*b +. d*b = (a+d)*b) /\ + (a*b + b = (a+ &.1)*b ) /\ ( b + a*b = (a+ &.1)*b) /\ + (a*b +. d*b +e = (a+d)*b + e) /\ + (a*b + b + e= (a+. &.1)* b +e ) /\ + ( b + a*b + e = (a + &.1)*b +e) `;] THENC + REAL_RAT_REDUCE_CONV THENC + REWRITE_CONV[REAL_ARITH `(&.0 * x = &.0) /\ (x + &.0 = x) /\ + (&.0 + x = x)`];; + +let real_poly_tac = CONV_TAC real_poly_conv;; + +let test_real_poly_tac = prove_by_refinement( + `!x y . (x + (&.2)*y)*(x- (&.2)*y) = (x*x -. (&.4)*y*y)`, + (* {{{ proof *) + [ + DISCH_ALL_TAC; + real_poly_tac; + ]);; + (* }}} *) + + + + +(* ------------------------------------------------------------------ *) +(* REAL INEQUALITIES *) + + +(* Take inequality certificate A + B1 + B2 +.... + P = C as a term. + Prove it as an inequality. + Reduce to an ineq (A < C) WITH side conditions + 0 <= Bi, 0 < P. + + If (not strict), write as an ineq (A <= C) WITH side conditions + 0 <= Bi. + + Expand each Bi (or P) that is a product U*V as 0 <= U /\ 0 <= V. + To prevent expansion of Bi write (U*V) as (&0 + (U*V)). + + CALL as + ineq_le_tac `A + B1 + B2 = C`; + + *) +(* ------------------------------------------------------------------ *) + + +let strict_lemma = prove_by_refinement( + `!A B C. (A+B = C) ==> ((&.0 <. B) ==> (A <. C) )`, + (* {{{ proof *) + [ + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let weak_lemma = prove_by_refinement( + `!A B C. (A+B = C) ==> ((&.0 <=. B) ==> (A <=. C))`, + (* {{{ proof *) + [ + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let strip_lt_lemma = prove_by_refinement( + `!B1 B2 C. ((&.0 <. (B1+B2)) ==> C) ==> + ((&.0 <. B2) ==> ((&.0 <=. B1) ==> C))`, + (* {{{ proof *) + + [ + ASM_MESON_TAC[REAL_LET_ADD]; + ]);; + + (* }}} *) + +let strip_le_lemma = prove_by_refinement( + `!B1 B2 C. ((&.0 <=. (B1+B2)) ==> C) ==> + ((&.0 <=. B2) ==> ((&.0 <=. B1) ==> C))`, + (* {{{ proof *) + + [ + ASM_MESON_TAC[REAL_LE_ADD]; + ]);; + + (* }}} *) + +let is_x_prod_le tm = + try let hyp = fst(dest_binop `( ==> )` tm) in + let arg = snd(dest_binop `( <=. ) ` hyp) in + let fac = dest_binop `( *. )` arg in + true + with Failure _ -> false;; + +let switch_lemma_le_order t1 t2 = + if (is_x_prod_le t1) & (is_x_prod_le t2) then + term_order t1 t2 else + if (is_x_prod_le t2) then true else false;; + +let is_x_prod_lt tm = + try let hyp = fst(dest_binop `( ==> )` tm) in + let arg = snd(dest_binop `( <. ) ` hyp) in + let fac = dest_binop `( *. )` arg in + true + with Failure _ -> false;; + +let switch_lemma_lt_order t1 t2 = + if (is_x_prod_lt t1) & (is_x_prod_lt t2) then + term_order t1 t2 else + if (is_x_prod_lt t2) then true else false;; + +let switch_lemma_le = prove_by_refinement( + `!A B C. ((&.0 <= A) ==> (&.0 <= B) ==> C) = + ((&.0 <=. B) ==> (&.0 <= A) ==> C)`, + (* {{{ proof *) + [ + ASM_MESON_TAC[]; + ]);; + (* }}} *) + +let switch_lemma_let = prove_by_refinement( + `!A B C. ((&.0 < A) ==> (&.0 <= B) ==> C) = + ((&.0 <=. B) ==> (&.0 < A) ==> C)`, + (* {{{ proof *) + [ + ASM_MESON_TAC[]; + ]);; + (* }}} *) + +let switch_lemma_lt = prove_by_refinement( + `!A B C. ((&.0 < A) ==> (&.0 < B) ==> C) = + ((&.0 <. B) ==> (&.0 < A) ==> C)`, + (* {{{ proof *) + [ + ASM_MESON_TAC[]; + ]);; + (* }}} *) + +let expand_prod_lt = prove_by_refinement( + `!B1 B2 C. (&.0 < B1*B2 ==> C) ==> + ((&.0 <. B1) ==> (&.0 <. B2) ==> C)`, + (* {{{ proof *) + [ + ASM_MESON_TAC[REAL_LT_MUL ]; + ]);; + (* }}} *) + +let expand_prod_le = prove_by_refinement( + `!B1 B2 C. (&.0 <= B1*B2 ==> C) ==> + ((&.0 <=. B1) ==> (&.0 <=. B2) ==> C)`, + (* {{{ proof *) + + [ + ASM_MESON_TAC[REAL_LE_MUL ]; + ]);; + + (* }}} *) + + +let ineq_cert_gen_tac v cert = + let DISCH_RULE f = DISCH_THEN (fun t-> MP_TAC (f t)) in + TYPE_THEN cert + (MP_TAC o (REWRITE_CONV[REAL_POW_2] THENC real_poly_conv)) THEN + REWRITE_TAC[] THEN + DISCH_RULE (MATCH_MP v) THEN + DISCH_RULE (repeat (MATCH_MP strip_lt_lemma)) THEN + DISCH_RULE (repeat (MATCH_MP strip_le_lemma)) THEN + DISCH_RULE (repeat (MATCH_MP expand_prod_lt o + (CONV_RULE + (REWRITE_ORD_CONV switch_lemma_lt_order true[switch_lemma_lt])))) THEN + DISCH_RULE (repeat (MATCH_MP expand_prod_le o + (CONV_RULE (REWRITE_ORD_CONV switch_lemma_le_order true + [switch_lemma_le])) o + (REWRITE_RULE[switch_lemma_let]))) THEN + DISCH_RULE (repeat (MATCH_MP + (TAUT `(A ==> B==>C) ==> (A /\ B ==> C)`))) THEN + REWRITE_TAC[REAL_MUL_LID] THEN + DISCH_THEN MATCH_MP_TAC THEN + CONV_TAC REAL_RAT_REDUCE_CONV THEN + ASM_SIMP_TAC[REAL_LE_POW_2; + REAL_ARITH `(&.0 < x ==> &.0 <= x) /\ (&.0 + x = x) /\ + (a <= b ==> &.0 <= b - a) /\ + (a < b ==> &.0 <= b - a) /\ + (~(b < a) ==> &.0 <= b - a) /\ + (~(b <= a) ==> &.0 <= b - a) /\ + (a < b ==> &.0 < b - a) /\ + (~(b <= a) ==> &.0 < b - a)`];; + +let ineq_lt_tac = ineq_cert_gen_tac strict_lemma;; +let ineq_le_tac = ineq_cert_gen_tac weak_lemma;; + + + +(* test *) +let test_ineq_tac = prove_by_refinement( + `!x y z. (&.0 <= x*y) /\ (&.0 <. z) ==> + (x*y) <. x*x + (&.3)*x*y + &.4 `, + (* {{{ proof *) + [ + DISCH_ALL_TAC; + ineq_lt_tac `x * y + x pow 2 + &2 * (&.0 + x * y) + &2 * &2 = x * x + &3 * x * y + &4`; + ]);; + (* }}} *) + + + +(* ------------------------------------------------------------------ *) +(* Move quantifier left. Use class.ml and theorems.ml to bubble + quantifiers towards the head of an expression. It should move + quantifiers past other quantifiers, past conjunctions, disjunctions, + implications, etc. + + val quant_left_CONV : string -> term -> thm = + Arguments: + var_name:string -- The name of the variable that is to be shifted. + + It tends to return `T` when the conversion fails. + + Example: + quant_left_CONV "a" `!b. ?a. a = b*4`;; + val it : thm = |- (!b. ?a. a = b *| 4) <=> (?a. !b. a b = b *| 4) + *) +(* ------------------------------------------------------------------ *) + +let tagb = new_definition `TAGB (x:bool) = x`;; + +let is_quant tm = (is_forall tm) or (is_exists tm);; + +(*** JRH replaced Comb and Abs with abstract type constructors ***) + +let rec tag_quant var_name tm = + if (is_forall tm && (fst (dest_var (fst (dest_forall tm))) = var_name)) + then mk_comb (`TAGB`,tm) + else if (is_exists tm && (fst (dest_var (fst (dest_exists tm))) = var_name)) then mk_comb (`TAGB`,tm) + else match tm with + | Comb (x,y) -> mk_comb(tag_quant var_name x,tag_quant var_name y) + | Abs (x,y) -> mk_abs(x,tag_quant var_name y) + | _ -> tm;; + +let quant_left_CONV = + (* ~! -> ?~ *) + let iprove f = prove(f,REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let NOT_FORALL_TAG = prove(`!P. ~(TAGB(!x. P x)) <=> (?x:A. ~(P x))`, + REWRITE_TAC[tagb;NOT_FORALL_THM]) in + let SKOLEM_TAG = + prove(`!P. (?y. TAGB (!(x:A). P x ((y:A->B) x))) <=> + ( (!(x:A). ?y. P x ((y:B))))`,REWRITE_TAC[tagb;SKOLEM_THM]) in + let SKOLEM_TAG2 = + prove(`!P. (!x:A. TAGB(?y:B. P x y)) <=> (?y. !x. P x (y x))`, + REWRITE_TAC[tagb;SKOLEM_THM]) in + (* !1 !2 -> !2 !1 *) + let SWAP_FORALL_TAG = + prove(`!P:A->B->bool. (!x. TAGB(! y. P x y)) <=> (!y x. P x y)`, + REWRITE_TAC[SWAP_FORALL_THM;tagb]) in + let SWAP_EXISTS_THM = iprove + `!P:A->B->bool. (?x. TAGB (?y. P x y)) <=> (?y x. P x y)` in + (* ! /\ ! -> ! /\ *) + let AND_FORALL_TAG = prove(`!P Q. (TAGB (!x. P x) /\ TAGB (!x. Q x) <=> + (!x. P x /\ Q x))`,REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let LEFT_AND_FORALL_TAG = prove(`!P Q. (TAGB (!x. P x) /\ Q) <=> + (!x. P x /\ Q )`,REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let RIGHT_AND_FORALL_TAG = prove(`!P Q. P /\ TAGB (!x. Q x) <=> + (!x. P /\ Q x)`,REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let TRIV_OR_FORALL_TAG = prove + (`!P Q. TAGB (!x:A. P) \/ TAGB (!x:A. Q) <=> (!x:A. P \/ Q)`, + REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let RIGHT_IMP_FORALL_TAG = prove + (`!P Q. (P ==> TAGB (!x:A. Q x)) <=> (!x. P ==> Q x)`, + REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let OR_EXISTS_THM = iprove + `!P Q. TAGB (?x. P x) \/ TAGB (?x. Q x) <=> (?x:A. P x \/ Q x)` in + let LEFT_OR_EXISTS_THM = iprove + `!P Q. TAGB (?x. P x) \/ Q <=> (?x:A. P x \/ Q)` in + let RIGHT_OR_EXISTS_THM = iprove + `!P Q. P \/ TAGB (?x. Q x) <=> (?x:A. P \/ Q x)` in + let LEFT_AND_EXISTS_THM = iprove + `!P Q. TAGB (?x:A. P x) /\ Q <=> (?x:A. P x /\ Q)` in + let RIGHT_AND_EXISTS_THM = iprove + `!P Q. P /\ TAGB (?x:A. Q x) <=> (?x:A. P /\ Q x)` in + let TRIV_AND_EXISTS_THM = iprove + `!P Q. TAGB (?x:A. P) /\ TAGB (?x:A. Q) <=> (?x:A. P /\ Q)` in + let LEFT_IMP_EXISTS_THM = iprove + `!P Q. (TAGB (?x:A. P x) ==> Q) <=> (!x. P x ==> Q)` in + let TRIV_FORALL_IMP_THM = iprove + `!P Q. (TAGB (?x:A. P) ==> TAGB (!x:A. Q)) <=> (!x:A. P ==> Q) ` in + let TRIV_EXISTS_IMP_THM = iprove + `!P Q. (TAGB(!x:A. P) ==> TAGB (?x:A. Q)) <=> (?x:A. P ==> Q) ` in + let NOT_EXISTS_TAG = prove( + `!P. ~(TAGB(?x:A. P x)) <=> (!x. ~(P x))`, + REWRITE_TAC[tagb;NOT_EXISTS_THM]) in + let LEFT_OR_FORALL_TAG = prove + (`!P Q. TAGB(!x:A. P x) \/ Q <=> (!x. P x \/ Q)`, + REWRITE_TAC[tagb;LEFT_OR_FORALL_THM]) in + let RIGHT_OR_FORALL_TAG = prove + (`!P Q. P \/ TAGB(!x:A. Q x) <=> (!x. P \/ Q x)`, + REWRITE_TAC[tagb;RIGHT_OR_FORALL_THM]) in + let LEFT_IMP_FORALL_TAG = prove + (`!P Q. (TAGB(!x:A. P x) ==> Q) <=> (?x. P x ==> Q)`, + REWRITE_TAC[tagb;LEFT_IMP_FORALL_THM]) in + let RIGHT_IMP_EXISTS_TAG = prove + (`!P Q. (P ==> TAGB(?x:A. Q x)) <=> (?x:A. P ==> Q x)`, + REWRITE_TAC[tagb;RIGHT_IMP_EXISTS_THM]) in + fun var_name tm -> + REWRITE_RULE [tagb] + (TOP_SWEEP_CONV + (GEN_REWRITE_CONV I + [NOT_FORALL_TAG;SKOLEM_TAG;SKOLEM_TAG2; + SWAP_FORALL_TAG;SWAP_EXISTS_THM; + SWAP_EXISTS_THM; + AND_FORALL_TAG;LEFT_AND_FORALL_TAG;RIGHT_AND_FORALL_TAG; + TRIV_OR_FORALL_TAG;RIGHT_IMP_FORALL_TAG; + OR_EXISTS_THM;LEFT_OR_EXISTS_THM;RIGHT_OR_EXISTS_THM; + LEFT_AND_EXISTS_THM; + RIGHT_AND_EXISTS_THM; + TRIV_AND_EXISTS_THM;LEFT_IMP_EXISTS_THM;TRIV_FORALL_IMP_THM; + TRIV_EXISTS_IMP_THM;NOT_EXISTS_TAG; + LEFT_OR_FORALL_TAG;RIGHT_OR_FORALL_TAG;LEFT_IMP_FORALL_TAG; + RIGHT_IMP_EXISTS_TAG; + ]) + (tag_quant var_name tm));; + +(* same, but never pass a quantifier past another. No Skolem, etc. *) +let quant_left_noswap_CONV = + (* ~! -> ?~ *) + let iprove f = prove(f,REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let NOT_FORALL_TAG = prove(`!P. ~(TAGB(!x. P x)) <=> (?x:A. ~(P x))`, + REWRITE_TAC[tagb;NOT_FORALL_THM]) in + let SKOLEM_TAG = + prove(`!P. (?y. TAGB (!(x:A). P x ((y:A->B) x))) <=> + ( (!(x:A). ?y. P x ((y:B))))`,REWRITE_TAC[tagb;SKOLEM_THM]) in + let SKOLEM_TAG2 = + prove(`!P. (!x:A. TAGB(?y:B. P x y)) <=> (?y. !x. P x (y x))`, + REWRITE_TAC[tagb;SKOLEM_THM]) in + (* !1 !2 -> !2 !1 *) + let SWAP_FORALL_TAG = + prove(`!P:A->B->bool. (!x. TAGB(! y. P x y)) <=> (!y x. P x y)`, + REWRITE_TAC[SWAP_FORALL_THM;tagb]) in + let SWAP_EXISTS_THM = iprove + `!P:A->B->bool. (?x. TAGB (?y. P x y)) <=> (?y x. P x y)` in + (* ! /\ ! -> ! /\ *) + let AND_FORALL_TAG = prove(`!P Q. (TAGB (!x. P x) /\ TAGB (!x. Q x) <=> + (!x. P x /\ Q x))`,REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let LEFT_AND_FORALL_TAG = prove(`!P Q. (TAGB (!x. P x) /\ Q) <=> + (!x. P x /\ Q )`,REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let RIGHT_AND_FORALL_TAG = prove(`!P Q. P /\ TAGB (!x. Q x) <=> + (!x. P /\ Q x)`,REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let TRIV_OR_FORALL_TAG = prove + (`!P Q. TAGB (!x:A. P) \/ TAGB (!x:A. Q) <=> (!x:A. P \/ Q)`, + REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let RIGHT_IMP_FORALL_TAG = prove + (`!P Q. (P ==> TAGB (!x:A. Q x)) <=> (!x. P ==> Q x)`, + REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let OR_EXISTS_THM = iprove + `!P Q. TAGB (?x. P x) \/ TAGB (?x. Q x) <=> (?x:A. P x \/ Q x)` in + let LEFT_OR_EXISTS_THM = iprove + `!P Q. TAGB (?x. P x) \/ Q <=> (?x:A. P x \/ Q)` in + let RIGHT_OR_EXISTS_THM = iprove + `!P Q. P \/ TAGB (?x. Q x) <=> (?x:A. P \/ Q x)` in + let LEFT_AND_EXISTS_THM = iprove + `!P Q. TAGB (?x:A. P x) /\ Q <=> (?x:A. P x /\ Q)` in + let RIGHT_AND_EXISTS_THM = iprove + `!P Q. P /\ TAGB (?x:A. Q x) <=> (?x:A. P /\ Q x)` in + let TRIV_AND_EXISTS_THM = iprove + `!P Q. TAGB (?x:A. P) /\ TAGB (?x:A. Q) <=> (?x:A. P /\ Q)` in + let LEFT_IMP_EXISTS_THM = iprove + `!P Q. (TAGB (?x:A. P x) ==> Q) <=> (!x. P x ==> Q)` in + let TRIV_FORALL_IMP_THM = iprove + `!P Q. (TAGB (?x:A. P) ==> TAGB (!x:A. Q)) <=> (!x:A. P ==> Q) ` in + let TRIV_EXISTS_IMP_THM = iprove + `!P Q. (TAGB(!x:A. P) ==> TAGB (?x:A. Q)) <=> (?x:A. P ==> Q) ` in + let NOT_EXISTS_TAG = prove( + `!P. ~(TAGB(?x:A. P x)) <=> (!x. ~(P x))`, + REWRITE_TAC[tagb;NOT_EXISTS_THM]) in + let LEFT_OR_FORALL_TAG = prove + (`!P Q. TAGB(!x:A. P x) \/ Q <=> (!x. P x \/ Q)`, + REWRITE_TAC[tagb;LEFT_OR_FORALL_THM]) in + let RIGHT_OR_FORALL_TAG = prove + (`!P Q. P \/ TAGB(!x:A. Q x) <=> (!x. P \/ Q x)`, + REWRITE_TAC[tagb;RIGHT_OR_FORALL_THM]) in + let LEFT_IMP_FORALL_TAG = prove + (`!P Q. (TAGB(!x:A. P x) ==> Q) <=> (?x. P x ==> Q)`, + REWRITE_TAC[tagb;LEFT_IMP_FORALL_THM]) in + let RIGHT_IMP_EXISTS_TAG = prove + (`!P Q. (P ==> TAGB(?x:A. Q x)) <=> (?x:A. P ==> Q x)`, + REWRITE_TAC[tagb;RIGHT_IMP_EXISTS_THM]) in + fun var_name tm -> + REWRITE_RULE [tagb] + (TOP_SWEEP_CONV + (GEN_REWRITE_CONV I + [NOT_FORALL_TAG; (* SKOLEM_TAG;SKOLEM_TAG2; *) + (* SWAP_FORALL_TAG;SWAP_EXISTS_THM; + SWAP_EXISTS_THM; *) + AND_FORALL_TAG;LEFT_AND_FORALL_TAG;RIGHT_AND_FORALL_TAG; + TRIV_OR_FORALL_TAG;RIGHT_IMP_FORALL_TAG; + OR_EXISTS_THM;LEFT_OR_EXISTS_THM;RIGHT_OR_EXISTS_THM; + LEFT_AND_EXISTS_THM; + RIGHT_AND_EXISTS_THM; + TRIV_AND_EXISTS_THM;LEFT_IMP_EXISTS_THM;TRIV_FORALL_IMP_THM; + TRIV_EXISTS_IMP_THM;NOT_EXISTS_TAG; + LEFT_OR_FORALL_TAG;RIGHT_OR_FORALL_TAG;LEFT_IMP_FORALL_TAG; + RIGHT_IMP_EXISTS_TAG; + ]) + (tag_quant var_name tm));; + +let quant_right_CONV = + (* ~! -> ?~ *) + let iprove f = prove(f,REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let NOT_FORALL_TAG = prove(`!P. TAGB(?x:A. ~(P x)) <=> ~((!x. P x))`, + REWRITE_TAC[tagb;GSYM NOT_FORALL_THM]) in + let SKOLEM_TAG = + prove(`!P. ( TAGB(!(x:A). ?y. P x ((y:B)))) <=> + (?y. (!(x:A). P x ((y:A->B) x)))`, + REWRITE_TAC[tagb;GSYM SKOLEM_THM]) + in + let SKOLEM_TAG2 = + prove(`!P. TAGB(?y. !x. P x (y x)) <=> (!x:A. (?y:B. P x y))`, + REWRITE_TAC[tagb;GSYM SKOLEM_THM]) in + (* !1 !2 -> !2 !1.. *) + let SWAP_FORALL_TAG = + prove(`!P:A->B->bool. TAGB(!y x. P x y) <=> (!x. (! y. P x y))`, + REWRITE_TAC[GSYM SWAP_FORALL_THM;tagb]) in + let SWAP_EXISTS_THM = iprove + `!P:A->B->bool. TAGB (?y x. P x y) <=> (?x. (?y. P x y))` in + (* ! /\ ! -> ! /\ *) + let AND_FORALL_TAG = iprove`!P Q. TAGB(!x. P x /\ Q x) <=> + ((!x. P x) /\ (!x. Q x))` in + let LEFT_AND_FORALL_TAG = prove(`!P Q. + TAGB(!x. P x /\ Q ) <=> ((!x. P x) /\ Q)`, + REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let RIGHT_AND_FORALL_TAG = prove(`!P Q. + TAGB(!x. P /\ Q x) <=> P /\ (!x. Q x)`, + REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let TRIV_OR_FORALL_TAG = prove + (`!P Q. TAGB(!x:A. P \/ Q) <=>(!x:A. P) \/ (!x:A. Q)`, + REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let RIGHT_IMP_FORALL_TAG = prove + (`!P Q. TAGB (!x. P ==> Q x) <=> (P ==> (!x:A. Q x)) `, + REWRITE_TAC[tagb] THEN ITAUT_TAC) in + let OR_EXISTS_THM = iprove + `!P Q. TAGB(?x:A. P x \/ Q x) <=> (?x. P x) \/ (?x. Q x) ` in + let LEFT_OR_EXISTS_THM = iprove + `!P Q. TAGB (?x:A. P x \/ Q) <=> (?x. P x) \/ Q ` in + let RIGHT_OR_EXISTS_THM = iprove + `!P Q.TAGB (?x:A. P \/ Q x) <=> P \/ (?x. Q x)` in + let LEFT_AND_EXISTS_THM = iprove + `!P Q.TAGB (?x:A. P x /\ Q) <=> (?x:A. P x) /\ Q` in + let RIGHT_AND_EXISTS_THM = iprove + `!P Q. TAGB (?x:A. P /\ Q x) <=> P /\ (?x:A. Q x) ` in + let TRIV_AND_EXISTS_THM = iprove + `!P Q. TAGB(?x:A. P /\ Q) <=> (?x:A. P) /\ (?x:A. Q) ` in (* *) + let LEFT_IMP_EXISTS_THM = iprove + `!P Q. TAGB(!x. P x ==> Q) <=> ( (?x:A. P x) ==> Q) ` in (* *) + let TRIV_FORALL_IMP_THM = iprove + `!P Q. TAGB(!x:A. P ==> Q) <=> ( (?x:A. P) ==> (!x:A. Q)) ` in + let TRIV_EXISTS_IMP_THM = iprove + `!P Q. TAGB(?x:A. P ==> Q) <=> ((!x:A. P) ==> (?x:A. Q)) ` in + let NOT_EXISTS_TAG = prove( + `!P. TAGB(!x. ~(P x)) <=> ~((?x:A. P x)) `, + REWRITE_TAC[tagb;NOT_EXISTS_THM]) in + let LEFT_OR_FORALL_TAG = prove + (`!P Q. TAGB(!x. P x \/ Q) <=> (!x:A. P x) \/ Q `, + REWRITE_TAC[tagb;LEFT_OR_FORALL_THM]) in + let RIGHT_OR_FORALL_TAG = prove + (`!P Q. TAGB(!x. P \/ Q x) <=> P \/ (!x:A. Q x) `, + REWRITE_TAC[tagb;RIGHT_OR_FORALL_THM]) in + let LEFT_IMP_FORALL_TAG = prove + (`!P Q. TAGB(?x. P x ==> Q) <=> ((!x:A. P x) ==> Q) `, + REWRITE_TAC[tagb;LEFT_IMP_FORALL_THM]) in + let RIGHT_IMP_EXISTS_TAG = prove + (`!P Q. TAGB(?x:A. P ==> Q x) <=> (P ==> (?x:A. Q x)) `, + REWRITE_TAC[tagb;RIGHT_IMP_EXISTS_THM]) in + fun var_name tm -> + REWRITE_RULE [tagb] + (TOP_SWEEP_CONV + (GEN_REWRITE_CONV I + [NOT_FORALL_TAG;SKOLEM_TAG;SKOLEM_TAG2; + SWAP_FORALL_TAG;SWAP_EXISTS_THM; + SWAP_EXISTS_THM; + AND_FORALL_TAG;LEFT_AND_FORALL_TAG;RIGHT_AND_FORALL_TAG; + TRIV_OR_FORALL_TAG;RIGHT_IMP_FORALL_TAG; + OR_EXISTS_THM;LEFT_OR_EXISTS_THM;RIGHT_OR_EXISTS_THM; + LEFT_AND_EXISTS_THM; + RIGHT_AND_EXISTS_THM; + TRIV_AND_EXISTS_THM;LEFT_IMP_EXISTS_THM;TRIV_FORALL_IMP_THM; + TRIV_EXISTS_IMP_THM;NOT_EXISTS_TAG; + LEFT_OR_FORALL_TAG;RIGHT_OR_FORALL_TAG;LEFT_IMP_FORALL_TAG; + RIGHT_IMP_EXISTS_TAG; + ]) + (tag_quant var_name tm));; + + +(* ------------------------------------------------------------------ *) +(* Dropping Superfluous Quantifiers . + Example: ?u. (u = t) /\ ... + We can eliminate the u. + *) +(* ------------------------------------------------------------------ *) + +let mark_term = new_definition `mark_term (u:A) = u`;; + +(*** JRH replaced Comb and Abs with explicit constructors ***) + +let rec markq qname tm = + match tm with + Var (a,b) -> if (a=qname) then mk_icomb (`mark_term:A->A`,tm) else tm + |Const(_,_) -> tm + |Comb(s,b) -> mk_comb(markq qname s,markq qname b) + |Abs (x,t) -> mk_abs(x,markq qname t);; + +let rec getquants tm = + if (is_forall tm) then + (fst (dest_var (fst (dest_forall tm)))):: + (getquants (snd (dest_forall tm))) + else if (is_exists tm) then + (fst (dest_var (fst (dest_exists tm)))):: + (getquants (snd (dest_exists tm))) + else match tm with + Comb(s,b) -> (getquants s) @ (getquants b) + | Abs (x,t) -> (getquants t) + | _ -> [];; + +(* can loop if there are TWO *) +let rewrite_conjs = [ + prove_by_refinement (`!A B C. (A /\ B) /\ C <=> A /\ B /\ C`,[REWRITE_TAC[CONJ_ACI]]); + prove_by_refinement (`!u. (mark_term (u:A) = mark_term u) <=> T`,[MESON_TAC[]]); + prove_by_refinement (`!u t. (t = mark_term (u:A)) <=> (mark_term u = t)`,[MESON_TAC[]]); + prove_by_refinement (`!u a b. (mark_term (u:A) = a) /\ (mark_term u = b) <=> (mark_term u = a) /\ (a = b)`,[MESON_TAC[]]); + prove_by_refinement (`!u a b B. (mark_term (u:A) = a) /\ (mark_term u = b) /\ B <=> (mark_term u = a) /\ (a = b) /\ B`,[MESON_TAC[]]); + prove_by_refinement (`!u t A C. A /\ (mark_term (u:A) = t) /\ C <=> + (mark_term u = t) /\ A /\ C`,[MESON_TAC[]]); + prove_by_refinement (`!A u t. A /\ (mark_term (u:A) = t) <=> + (mark_term u = t) /\ A `,[MESON_TAC[]]); + prove_by_refinement (`!u t C D. (((mark_term (u:A) = t) /\ C) ==> D) <=> + ((mark_term (u:A) = t) ==> C ==> D)`,[MESON_TAC[]]); + prove_by_refinement (`!A u t B. (A ==> (mark_term (u:A) = t) ==> B) <=> + ((mark_term (u:A) = t) ==> A ==> B)`,[MESON_TAC[]]); +];; + +let higher_conjs = [ + prove_by_refinement (`!C u t. ((mark_term u = t) ==> C (mark_term u)) <=> + ((mark_term u = t) ==> C (t:A))`,[MESON_TAC[mark_term]]); + prove_by_refinement (`!C u t. ((mark_term u = t) /\ C (mark_term u)) <=> + ((mark_term u = t) /\ C (t:A))`,[MESON_TAC[mark_term]]); +];; + + +let dropq_conv = + let drop_exist = + REWRITE_CONV [prove_by_refinement (`!t. ?(u:A). (u = t)`,[MESON_TAC[]])] in + fun qname tm -> + let quanlist = getquants tm in + let quantleft_CONV = EVERY_CONV + (map (REPEATC o quant_left_noswap_CONV) quanlist) in + let qname_conv tm = prove(mk_eq(tm,markq qname tm), + REWRITE_TAC[mark_term]) in + let conj_conv = REWRITE_CONV rewrite_conjs in + let quantright_CONV = (REPEATC (quant_right_CONV qname)) in + let drop_mark_CONV = REWRITE_CONV [mark_term] in + (quantleft_CONV THENC qname_conv THENC conj_conv THENC + (ONCE_REWRITE_CONV higher_conjs) + THENC drop_mark_CONV THENC quantright_CONV THENC + drop_exist ) tm ;; + + +(* Examples : *) +dropq_conv "u" `!P Q R . (?(u:B). (?(x:A). (u = P x) /\ (Q x)) /\ (R u))`;; +dropq_conv "t" `!P Q R. (!(t:B). (?(x:A). P x /\ (t = Q x)) ==> R t)`;; + +dropq_conv "u" `?u v. + ((t * (a + &1) + (&1 - t) *a = u) /\ + (t * (b + &0) + (&1 - t) * b = v)) /\ + a < u /\ + u < r /\ + (v = b)`;; + + + +(* ------------------------------------------------------------------ *) +(* SOME GENERAL TACTICS FOR THE ASSUMPTION LIST *) +(* ------------------------------------------------------------------ *) + +let (%) i = HYP (string_of_int i);; + +let WITH i rule = (H_VAL (rule) (HYP (string_of_int i))) ;; + +let (UND:int -> tactic) = + fun i gl -> + let (asl,w) = dest_goal gl in + let name = "Z-"^(string_of_int i) in + try let thm= assoc name asl in + let tm = concl (thm) in + let (_,asl') = partition (fun t-> ((=) name (fst t))) asl in + null_meta,[asl',mk_imp(tm,w)], + fun i [th] -> MP th (INSTANTIATE_ALL i thm) + with Failure _ -> failwith "UND";; + +let KILL i = + (UND i) THEN (DISCH_THEN (fun t -> ALL_TAC));; + +let USE i rule = (WITH i rule) THEN (KILL i);; + +let CHO i = (UND i) THEN (DISCH_THEN CHOOSE_TAC);; + +let X_CHO i t = (UND i) THEN (DISCH_THEN (X_CHOOSE_TAC t));; + +let AND i = (UND i) THEN + (DISCH_THEN (fun t-> (ASSUME_TAC (CONJUNCT1 t) + THEN (ASSUME_TAC (CONJUNCT2 t)))));; + +let JOIN i j = + (H_VAL2 CONJ ((%)i) ((%)j)) THEN (KILL i) THEN (KILL j);; + +let COPY i = WITH i I;; + +let REP n tac = EVERY (replicate tac n);; + +let REWR i = (UND i) THEN (ASM_REWRITE_TAC[]) THEN DISCH_TAC;; + +let LEFT i t = (USE i (CONV_RULE (quant_left_CONV t)));; + +let RIGHT i t = (USE i (CONV_RULE (quant_right_CONV t)));; + +let LEFT_TAC t = ((CONV_TAC (quant_left_CONV t)));; + +let RIGHT_TAC t = ( (CONV_TAC (quant_right_CONV t)));; + +let INR = REWRITE_RULE[IN];; + +(* + + + +let rec REP n tac = if (n<=0) then ALL_TAC + else (tac THEN (REP (n-1) tac));; (* doesn't seem to work? *) + + +let COPY i = (UNDISCH_WITH i) THEN (DISCH_THEN (fun t->ALL_TAC));; + + +MANIPULATING ASSUMPTIONS. (MAKE 0= GOAL) + +COPY: int -> tactic Make a copy in adjacent slot. + + +EXPAND: int -> tactic. + conjunction -> two separate. + exists/goal-forall -> choose. + goal-if-then -> discharge +EXPAND_TERM: int -> term -> tactic. + constant -> expand definition or other rewrites associated. +ADD: term -> tactic. + +SIMPLIFY: int -> tactic. Apply simplification rules. + + +*) + +let CONTRAPOSITIVE_TAC = MATCH_MP_TAC (TAUT `(~q ==> ~p) ==> (p ==> q)`) + THEN REWRITE_TAC[];; + +let REWRT_TAC = (fun t-> REWRITE_TAC[t]);; + +let REAL_HALF_DOUBLE = REAL_ARITH `!x. (x / &2) + (x / &2) = x`;; +let REAL_DOUBLE = REAL_ARITH `!x. x + x = &2 * x`;; +let ABS_ZERO = REAL_ABS_ZERO;; (* new *) +let ABS_ABS = REAL_ABS_ABS;; + +let (REDUCE_CONV,REDUCE_TAC) = + let list = [ + (* reals *) REAL_NEG_GE0; + REAL_HALF_DOUBLE; + REAL_SUB_REFL ; + REAL_NEG_NEG; + REAL_LE; LE_0; + REAL_ADD_LINV;REAL_ADD_RINV; + REAL_NEG_0; + REAL_NEG_LE0; + REAL_NEG_GE0; + REAL_LE_NEGL; + REAL_LE_NEGR; + REAL_LE_NEG; + REAL_NEG_EQ_0; + REAL_SUB_RNEG; + REAL_ARITH `!(x:real). (--x = x) <=> (x = &.0)`; + REAL_ARITH `!(a:real) b. (a - b + b) = a`; + REAL_ADD_LID; + REAL_ADD_RID ; + REAL_INV_0; + REAL_OF_NUM_EQ; + REAL_OF_NUM_LE; + REAL_OF_NUM_LT; + REAL_OF_NUM_ADD; + REAL_OF_NUM_MUL; + REAL_POS; + REAL_MUL_RZERO; + REAL_MUL_LZERO; + REAL_LE_01; + REAL_SUB_RZERO; + REAL_LE_SQUARE; + REAL_MUL_RID; + REAL_MUL_LID; + REAL_ABS_ZERO; + REAL_ABS_NUM; + REAL_ABS_1; + REAL_ABS_NEG; + REAL_ABS_POS; +(* ABS_ZERO; *) + ABS_ABS; + REAL_NEG_LT0; + REAL_NEG_GT0; + REAL_LT_NEG; + REAL_NEG_MUL2; + REAL_OF_NUM_POW; + REAL_LT_INV_EQ; + REAL_POW_1; + REAL_INV2; + prove (`(--. (&.n) < (&.m)) <=> (&.0 < (&.n) + (&.m))`,REAL_ARITH_TAC); + prove (`(--. (&.n) <= (&.m)) <=> (&.0 <= (&.n) + (&.m))`,REAL_ARITH_TAC); + prove (`(--. (&.n) = (&.m)) <=> ((&.n) + (&.m) = (&.0))`,REAL_ARITH_TAC); + prove (`((&.n) < --.(&.m)) <=> ((&.n) + (&.m) <. (&.0))`,REAL_ARITH_TAC); + prove (`((&.n) <= --.(&.m)) <=> ((&.n) + (&.m) <=. (&.0))`,REAL_ARITH_TAC); + prove (`((&.n) = --.(&.m)) <=> ((&.n) + (&.m) = (&.0))`,REAL_ARITH_TAC); + prove (`((&.n) < --.(&.m) + &.r) <=> ((&.n) + (&.m) < (&.r))`,REAL_ARITH_TAC); + prove (`(--. x = --. y) <=> (x = y)`,REAL_ARITH_TAC); + prove (`(--(&.n) < --.(&.m) + &.r) <=> ( (&.m) < &.n + (&.r))`,REAL_ARITH_TAC); + prove (`(--. x = --. y) <=> (x = y)`,REAL_ARITH_TAC); + prove (`((--. (&.1))* x < --. y <=> y < x)`,REAL_ARITH_TAC ); + prove (`((--. (&.1))* x <= --. y <=> y <= x)`,REAL_ARITH_TAC ); + (* num *) + EXP_1; + EXP_LT_0; + ADD_0; + ARITH_RULE `0+| m = m`; + ADD_EQ_0; + prove (`(0 = m +|n) <=> (m = 0)/\ (n=0)`,MESON_TAC[ADD_EQ_0]); + EQ_ADD_LCANCEL_0; + EQ_ADD_RCANCEL_0; + LT_ADD; + LT_ADDR; + ARITH_RULE `(0 = j -| i) <=> (j <=| i)`; + ARITH_RULE `(j -| i = 0) <=> (j <=| i)`; + ARITH_RULE `0 -| i = 0`; + ARITH_RULE `(i<=| j) /\ (j <=| i) <=> (i = j)`; + ARITH_RULE `0 <| 1`; + (* SUC *) + NOT_SUC; + SUC_INJ; + PRE; + ADD_CLAUSES; + MULT; + MULT_CLAUSES; + LE; LT; + ARITH_RULE `SUC b -| 1 = b`; + ARITH_RULE `SUC b -| b = 1`; + prove(`&.(SUC x) - &.x = &.1`, + REWRITE_TAC [REAL_ARITH `(a -. b=c) <=> (a = b+.c)`; + REAL_OF_NUM_ADD;REAL_OF_NUM_EQ] THEN ARITH_TAC); + (* (o) *) + o_DEF; + (* I *) + I_THM; + I_O_ID; + (* pow *) + REAL_POW_1; + REAL_POW_ONE; + (* INT *) + INT_ADD_LINV; + INT_ADD_RINV; + INT_ADD_SUB2; + INT_EQ_NEG2; + INT_LE_NEG; + INT_LE_NEGL; + INT_LE_NEGR; + INT_LT_NEG; + INT_LT_NEG2; + INT_NEGNEG; + INT_NEG_0; + INT_NEG_EQ_0; + INT_NEG_GE0; + INT_NEG_GT0; + INT_NEG_LE0; + INT_NEG_LT0; + GSYM INT_NEG_MINUS1; + INT_NEG_MUL2; + INT_NEG_NEG; + (* sets *) + ] in +(REWRITE_CONV list,REWRITE_TAC list);; + + + + + +(* prove by squaring *) +let REAL_POW_2_LE = prove_by_refinement( + `!x y. (&.0 <= x) /\ (&.0 <= y) /\ (x pow 2 <=. y pow 2) ==> (x <=. y)`, + (* {{{ proof *) + [ + DISCH_ALL_TAC; + MP_TAC (SPECL[` (x:real) pow 2`;`(y:real)pow 2`] SQRT_MONO_LE); + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[REAL_POW_LE]; + ASM_SIMP_TAC[POW_2_SQRT]; + ]);; + (* }}} *) + +(* prove by squaring *) +let REAL_POW_2_LT = prove_by_refinement( + `!x y. (&.0 <= x) /\ (&.0 <= y) /\ (x pow 2 <. y pow 2) ==> (x <. y)`, + (* {{{ proof *) + + [ + DISCH_ALL_TAC; + MP_TAC (SPECL[` (x:real) pow 2`;`(y:real)pow 2`] SQRT_MONO_LT); + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[REAL_POW_LE]; + ASM_SIMP_TAC[POW_2_SQRT]; + ]);; + + (* }}} *) + +let SQUARE_TAC = + FIRST[ + MATCH_MP_TAC REAL_LE_LSQRT; + MATCH_MP_TAC REAL_POW_2_LT; + MATCH_MP_TAC REAL_POW_2_LE + ] + THEN REWRITE_TAC[];; + +(****) + +let SPEC2_TAC t = SPEC_TAC (t,t);; + +let IN_ELIM i = (USE i (REWRITE_RULE[IN]));; + +let rec range i n = + if (n>0) then (i::(range (i+1) (n-1))) else [];; + + +(* in elimination *) + +let (IN_OUT_TAC: tactic) = + fun gl -> (REWRITE_TAC [IN] THEN + (EVERY (map (IN_ELIM) (range 0 (length (goal_asms gl)))))) gl;; + +let (IWRITE_TAC : thm list -> tactic) = + fun thlist -> REWRITE_TAC (map INR thlist);; + +let (IWRITE_RULE : thm list -> thm -> thm) = + fun thlist -> REWRITE_RULE (map INR thlist);; + +let IMATCH_MP imp ant = MATCH_MP (INR imp) (INR ant);; + +let IMATCH_MP_TAC imp = MATCH_MP_TAC (INR imp);; + + +let GBETA_TAC = (CONV_TAC (TOP_DEPTH_CONV GEN_BETA_CONV));; +let GBETA_RULE = (CONV_RULE (TOP_DEPTH_CONV GEN_BETA_CONV));; + +(* breaks antecedent into multiple cases *) +let REP_CASES_TAC = + REPEAT (DISCH_THEN (REPEAT_TCL DISJ_CASES_THEN ASSUME_TAC));; + +let TSPEC t i = TYPE_THEN t (USE i o SPEC);; + +let IMP_REAL t i = (USE i (MATCH_MP (REAL_ARITH t)));; + +(* goes from f = g to fz = gz *) +let TAPP z i = TYPE_THEN z (fun u -> (USE i(fun t -> AP_THM t u)));; + +(* ONE NEW TACTIC -- DOESN'T WORK!! DON'T USE.... +let CONCL_TAC t = let co = snd (dest_imp (concl t)) in + SUBGOAL_MP_TAC co THEN (TRY (IMATCH_MP_TAC t));; +*) + +(* subgoal the antecedent of a THM, in order to USE the conclusion *) +let ANT_TAC t = let (ant,co) = (dest_imp (concl t)) in + SUBGOAL_MP_TAC ant + THENL [ALL_TAC;DISCH_THEN (fun u-> MP_TAC (MATCH_MP t u))];; + + +let TH_INTRO_TAC tl th = TYPEL_THEN tl (fun t-> ANT_TAC (ISPECL t th));; + +let THM_INTRO_TAC tl th = TYPEL_THEN tl + (fun t-> + let s = ISPECL t th in + if is_imp (concl s) then ANT_TAC s else ASSUME_TAC s);; + +let (DISCH_THEN_FULL_REWRITE:tactic) = + DISCH_THEN (fun t-> REWRITE_TAC[t] THEN + (RULE_ASSUM_TAC (REWRITE_RULE[t])));; + +let FULL_REWRITE_TAC t = (REWRITE_TAC t THEN (RULE_ASSUM_TAC (REWRITE_RULE t)));; + +(* ------------------------------------------------------------------ *) + +let BASIC_TAC = + [ GEN_TAC; + IMATCH_MP_TAC (TAUT ` (a ==> b ==> C) ==> ( a /\ b ==> C)`); + DISCH_THEN (CHOOSE_THEN MP_TAC); + FIRST_ASSUM (fun t-> UNDISCH_TAC (concl t) THEN + (DISCH_THEN CHOOSE_TAC)); + FIRST_ASSUM (fun t -> + (if (length (CONJUNCTS t) < 2) then failwith "BASIC_TAC" + else UNDISCH_TAC (concl t))); + DISCH_TAC; + ];; + +let REP_BASIC_TAC = REPEAT (CHANGED_TAC (FIRST BASIC_TAC));; + +(* ------------------------------------------------------------------ *) + +let USE_FIRST rule = + FIRST_ASSUM (fun t -> (UNDISCH_TAC (concl t) THEN + (DISCH_THEN (ASSUME_TAC o rule))));; + +let WITH_FIRST rule = + FIRST_ASSUM (fun t -> ASSUME_TAC (rule t));; + +let UNDF t = (TYPE_THEN t UNDISCH_FIND_TAC );; + +let GRABF t ttac = (UNDF t THEN (DISCH_THEN ttac));; + +let USEF t rule = + (TYPE_THEN t (fun t' -> UNDISCH_FIND_THEN t' + (fun u -> ASSUME_TAC (rule u))));; + + +(* ------------------------------------------------------------------ *) +(* UNIFY_EXISTS_TAC *) +(* ------------------------------------------------------------------ *) + +let rec EXISTSL_TAC tml = match tml with + a::tml' -> EXISTS_TAC a THEN EXISTSL_TAC tml' | + [] -> ALL_TAC;; + +(* + Goal: ?x1....xn. P1 /\ ... /\ Pm + Try to pick ALL of x1...xn to unify ONE or more Pi with terms + appearing in the assumption list, trying term_unify on + each Pi with each assumption. +*) +let (UNIFY_EXISTS_TAC:tactic) = + let run_one wc assum (varl,sofar) = + if varl = [] then (varl,sofar) else + try ( + let wc' = instantiate ([],sofar,[]) wc in + let (_,ins,_) = term_unify varl wc' assum in + let insv = map snd ins in + ( subtract varl insv , union sofar ins ) + ) with failure -> (varl,sofar) in + let run_onel asl wc (varl,sofar) = + itlist (run_one wc) asl (varl,sofar) in + let run_all varl sofar wcl asl = + itlist (run_onel asl) wcl (varl,sofar) in + let full_unify asl w = + let (varl,ws) = strip_exists w in + let vargl = map genvar (map type_of varl) in + let wg = instantiate ([],zip vargl varl,[]) ws in + let wcg = conjuncts wg in + let (vargl',sofar) = run_all vargl [] wcg ( asl) in + if (vargl' = []) then + map (C rev_assoc sofar) (map (C rev_assoc (zip vargl varl)) varl) + else failwith "full_unify: unification not found " in + fun gl -> + let (asl,w) = dest_goal gl in + try( + let asl' = map (concl o snd) asl in + let asl'' = flat (map (conjuncts ) asl') in + let varsub = full_unify asl'' w in + EXISTSL_TAC varsub gl + ) with failure -> failwith "UNIFY_EXIST_TAC: unification not found.";; + +(* partial example *) +let unify_exists_tac_example = try(prove_by_refinement( + `!C a b v A R TX U SS. (A v /\ (a = v) /\ (C:num->num->bool) a b /\ R a ==> + ?v v'. TX v' /\ U v v' /\ C v' v /\ SS v)`, + (* {{{ proof *) + + [ + REP_BASIC_TAC; + UNIFY_EXISTS_TAC; (* v' -> a and v -> b *) + (* not finished. Here is a variant approach. *) + REP_GEN_TAC; + DISCH_TAC; + UNIFY_EXISTS_TAC; + ])) with failure -> (REFL `T`);; + + (* }}} *) + +(* ------------------------------------------------------------------ *) +(* UNIFY_EXISTS conversion *) +(* ------------------------------------------------------------------ *) + +(* + FIRST argument is the "certificate" + second arg is the goal. + Example: + UNIFY_EXISTS `(f:num->bool) x` `?t. (f:num->bool) t` +*) + +let (UNIFY_EXISTS:thm -> term -> thm) = + let run_one wc assum (varl,sofar) = + if varl = [] then (varl,sofar) else + try ( + let wc' = instantiate ([],sofar,[]) wc in + let (_,ins,_) = term_unify varl wc' assum in + let insv = map snd ins in + ( subtract varl insv , union sofar ins ) + ) with failure -> (varl,sofar) in + let run_onel asl wc (varl,sofar) = + itlist (run_one wc) asl (varl,sofar) in + let run_all varl sofar wcl asl = + itlist (run_onel asl) wcl (varl,sofar) in + let full_unify (t,w) = + let (varl,ws) = strip_exists w in + let vargl = map genvar (map type_of varl) in + let wg = instantiate ([],zip vargl varl,[]) ws in + let wcg = conjuncts wg in + let (vargl',sofar) = run_all vargl [] wcg ( [concl t]) in + if (vargl' = []) then + map (C rev_assoc sofar) (map (C rev_assoc (zip vargl varl)) varl) + else failwith "full_unify: unification not found " in + fun t w -> + try( + if not(is_exists w) then failwith "UNIFY_EXISTS: not EXISTS" else + let varl' = (full_unify (t,w)) in + let (varl,ws) = strip_exists w in + let varsub = zip varl' varl in + let varlb = map (fun s-> chop_list s (rev varl)) + (range 1 (length varl)) in + let targets = map (fun s-> (instantiate ([],varsub,[]) + (list_mk_exists( rev (fst s), ws)) )) varlb in + let target_zip = zip (rev targets) varl' in + itlist (fun s th -> EXISTS s th) target_zip t + ) with failure -> failwith "UNIFY_EXISTS: unification not found.";; + +let unify_exists_example= + UNIFY_EXISTS (ARITH_RULE `2 = 0+2`) `(?x y. ((x:num) = y))`;; + +(* now make a prover for it *) + + +(* ------------------------------------------------------------------ *) + +(* +drop_ant_tac replaces + 0 A ==>B + 1 A +with + 0 B + 1 A +in hypothesis list +*) +let DROP_ANT_TAC pq = + UNDISCH_TAC pq THEN (UNDISCH_TAC (fst (dest_imp pq))) THEN + DISCH_THEN (fun pthm -> ASSUME_TAC pthm THEN + DISCH_THEN (fun pqthm -> ASSUME_TAC (MATCH_MP pqthm pthm )));; + +let (DROP_ALL_ANT_TAC:tactic) = + fun gl -> + let imps = filter (is_imp) (map (concl o snd) (goal_asms gl)) in + MAP_EVERY (TRY o DROP_ANT_TAC) imps gl;; + +let drop_ant_tac_example = prove_by_refinement( + `!A B C D E. (A /\ (A ==> B) /\ (C ==>D) /\ C) ==> (E \/ C \/ B)`, + (* {{{ proof *) + [ + REP_BASIC_TAC; + DROP_ALL_ANT_TAC; + ASM_REWRITE_TAC[]; + ]);; + (* }}} *) + +(* ------------------------------------------------------------------ *) + +(* ASSUME tm, then prove it later. almost the same as asm-cases-tac *) +let (BACK_TAC : term -> tactic) = + fun tm gl -> + let ng = mk_imp (tm,goal_concl gl) in + (SUBGOAL_MP_TAC ng THENL [ALL_TAC;DISCH_THEN IMATCH_MP_TAC ]) gl;; + +(* working with hashed assumptions *) + +let hash_of_term = Hash_term.hash_of_term;; + +let HASH_UNDISCH_TAC h = + FIRST_X_ASSUM (fun t-> + let _ = (hash_of_term (concl t) = h) or failwith "bad hash" in + MP_TAC t);; + +let HASH_COPY_TAC h = HASH_UNDISCH_TAC h THEN (DISCH_THEN (fun t -> ASSUME_TAC t THEN ASSUME_TAC t));; + +let HASH_RULE_TAC h r = HASH_UNDISCH_TAC h THEN DISCH_THEN (fun t -> MP_TAC (r t));; + +let HASH_KILL_TAC h = HASH_UNDISCH_TAC h THEN (DISCH_THEN (fun t -> ALL_TAC));; + +let HASH_CHOOSE_TAC h = HASH_UNDISCH_TAC h THEN (DISCH_THEN CHOOSE_TAC);; + +let HASH_X_CHOOSE_TAC h t = HASH_UNDISCH_TAC h THEN (DISCH_THEN (X_CHOOSE_TAC t));; + +let HASH_ASM_REWRITE_TAC h gl = + let (asl2) = filter (fun t -> not(hash_of_term (concl (snd t)) = h)) (goal_asms gl) in + (HASH_UNDISCH_TAC h THEN + DISCH_THEN (fun t-> ASSUME_TAC(REWRITE_RULE (map snd asl2) t))) gl;; + +(* working with numbered assumptions, + Follow HOL Light's reverse numbering convention on assumptions. *) + +let el_hash i gl = + hash_of_term (el i (map (concl o snd) (List.rev (goal_asms gl))));; + +let use_el i ttac gl = + let h = el_hash i gl in + (HASH_UNDISCH_TAC h THEN (DISCH_THEN ttac)) gl;; + + +(* --- *) +(* Using hash numbers for tactics *) +(* --- *) + +let label_of_hash gl (h:int) = + let one_label h (s,tm) = + if (h = hash_of_term (concl tm)) then + let s1 = String.sub s 2 (String.length s - 2) in + int_of_string s1 + else failwith "label_of_hash" in + tryfind (one_label h) (goal_asms gl);; + +let HASHIFY m h w = m (label_of_hash w h) w;; +let UNDH = HASHIFY UND;; +let REWRH = HASHIFY REWR;; +let KILLH = HASHIFY KILL;; +let COPYH = HASHIFY COPY;; +let HASHIFY1 m h tm w = m (label_of_hash w h) tm w;; +let USEH = HASHIFY1 USE;; +let LEFTH = HASHIFY1 LEFT;; +let RIGHTH = HASHIFY1 RIGHT;; +let TSPECH tm h w = TSPEC tm (label_of_hash w h) w ;; + + + +end;; diff --git a/text_formalization/jordan/taylor_atn.hl b/text_formalization/jordan/taylor_atn.hl new file mode 100644 index 0000000..4cb2876 --- /dev/null +++ b/text_formalization/jordan/taylor_atn.hl @@ -0,0 +1,869 @@ + + +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Lemma: Taylor Series for atn function *) +(* Chapter: Nonlinear Inequalities *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-14 *) +(* ========================================================================== *) + + +(* +This file gives the half-angle identity for atan + atn (2 x) = 2 atn (...) + +It gives a general formula for the nth derivative of catn + +It gives the complex Taylor polynomial of catn at Cx(&0). + +It gives the real Taylor polynomial of atn at (&0) +*) + +module Taylor_atn = struct + + +let FORCE_EQ = REPEAT (CHANGED_TAC (AP_TERM_TAC ORELSE AP_THM_TAC ORELSE BINOP_TAC)) ;; + +let FORCE_MATCH = (MATCH_MP_TAC (TAUT `(a = b) ==> (a ==> b)`)) THEN FORCE_EQ ;; + +let FORCE_MATCH_MP_TAC th = + MP_TAC th THEN ANTS_TAC THENL[ALL_TAC;FORCE_MATCH + ];; + +(* first we develop the half-angle identity for the atn function *) + +let halfatn = new_definition `halfatn x = x / (sqrt(&1 + x pow 2) + &1)`;; + +let pos1 = prove( + `!x. &0 < &1 + x pow 2 `, + MESON_TAC[Collect_geom.pow_g;REAL_ARITH `&0 <= t ==> &0 < &1 + t`]; +);; + +let ssqrt = new_definition `!x. ssqrt x = (if x < &0 then &0 else sqrt x)`;; + +let halfsqrt_ssqrt = prove_by_refinement( + `!x. sqrt(&1+ x pow 2) = ssqrt(&1 + x pow 2)`, + (* {{{ proof *) + [ + REWRITE_TAC[ssqrt;]; + MESON_TAC[pos1;REAL_ARITH `&0 < x ==> ~(x < &0)`]; + ]);; + (* }}} *) + +let pos2 = prove ( + `!x. &0 < sqrt(&1 + x pow 2) + &1`, +(* {{{ proof *) + MESON_TAC[pos1;REAL_ARITH `(&0 <= t ==> &0 < t + &1) /\ (&0 < t ==> &0 <= t)`;SQRT_POS_LE;] +(* }}} *));; + +let halfatn_bounds_abs = prove_by_refinement( + `!x. abs(halfatn x) < &1 `, +(* {{{ proof *) +[ +REWRITE_TAC[halfatn;REAL_ABS_DIV]; +GEN_TAC; +ASSUME_TAC (ISPEC `x:real` pos2); +ASM_SIMP_TAC[REAL_ARITH `(&0 < x ==> abs(x) = x)/\ (&1 * t = t)`;REAL_LT_LDIV_EQ]; +(* *) +REWRITE_TAC[GSYM POW_2_SQRT_ABS]; +MATCH_MP_TAC REAL_LET_TRANS; +EXISTS_TAC `sqrt(&1 + x pow 2)`; +CONJ_TAC; +MATCH_MP_TAC SQRT_MONO_LE; +REWRITE_TAC[Collect_geom.pow_g]; +ARITH_TAC; +ARITH_TAC; +] +(* }}} *));; + +let halfatn_bounds = prove( + `!x. -- &1 < halfatn x /\ halfatn x < &1 `, + REWRITE_TAC[REAL_BOUNDS_LT;halfatn_bounds_abs]);; + +let halfatn_half = prove_by_refinement( + `!x t. (abs (x) < t ==> abs(halfatn x) < t / &2) `, +(* {{{ proof *) +[ +REWRITE_TAC[halfatn;REAL_ABS_DIV]; +REPEAT STRIP_TAC; +ASSUME_TAC (ISPEC `x:real` pos2); +ASM_SIMP_TAC[REAL_ARITH `&0 < x ==> &0 < abs(x)`;REAL_LT_LDIV_EQ]; +MATCH_MP_TAC REAL_LTE_TRANS; +EXISTS_TAC `t:real`; +ASM_REWRITE_TAC[REAL_ARITH `(t / &2 * x = t * (x / &2)) /\ (t <= t * x/ &2 <=> t * &2 <= t * x)`]; +MATCH_MP_TAC REAL_LE_LMUL; +CONJ_TAC; +UNDISCH_TAC `abs x < t`; +REAL_ARITH_TAC; +ASM_SIMP_TAC [REAL_ARITH `&0 < x ==> (abs(x) = x)`]; +REWRITE_TAC[REAL_ARITH `(&2 <= x + &1) = (&1 <= x)`]; +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC `sqrt(&1)`; +CONJ_TAC; +REWRITE_TAC[SQRT_1;REAL_ARITH `&1 <= &1`]; +MATCH_MP_TAC SQRT_MONO_LE; +CONJ_TAC; +ARITH_TAC; +MATCH_MP_TAC (REAL_ARITH `&0 <= x ==> &1 <= &1 + x`); +REWRITE_TAC[Collect_geom.pow_g]; +] +(* }}} *));; + +let abs_pass_through = prove_by_refinement ( + `(!x f. (f (-- x) = -- f x) /\ (!y. &0 <= y ==> &0 <= f y) + ==> (abs (f x) = f (abs x)))`, +(* {{{ proof *) + [ + REPEAT STRIP_TAC; + DISJ_CASES_TAC (REAL_ARITH `&0 <= x \/ &0 <= --x`); + POP_ASSUM MP_TAC; + POP_ASSUM MP_TAC; + MESON_TAC[REAL_ARITH `&0 <= x ==> abs(x ) = x`]; + REPEAT (POP_ASSUM MP_TAC); + MESON_TAC[REAL_ARITH `&0 <= --x ==> abs(x) = -- x`; REAL_ARITH `abs( -- x ) = abs(x)`]; + ] +(* }}} *));; + +let atn_abs = prove_by_refinement( + `!x. abs(atn x) = atn (abs x) `, +(* {{{ proof *) +[ +GEN_TAC; +MATCH_MP_TAC abs_pass_through; +REWRITE_TAC[ATN_NEG;ATN_POS_LE]; +] +(* }}} *));; + +let atn_half_range = prove_by_refinement ( + `!x. abs(atn (halfatn x)) < pi / &4 `, +(* {{{ proof *) +[ +REWRITE_TAC[GSYM ATN_1;atn_abs;ATN_MONO_LT_EQ]; +GEN_TAC; +REWRITE_TAC [halfatn_bounds;GSYM REAL_BOUNDS_LT]; +] +(* }}} *));; + +let tan_one_one = prove_by_refinement( + `!x y. (abs(x) < pi/ &2 /\ (abs y < pi / &2 ) /\ (tan x = tan y) ==> (x = y))`, +(* {{{ proof *) +[ +REPEAT STRIP_TAC; +DISJ_CASES_TAC (REAL_ARITH `x < y \/ y < x \/ x = (y:real)`); +REPEAT (POP_ASSUM MP_TAC); +REWRITE_TAC[GSYM REAL_BOUNDS_LT]; +MESON_TAC[TAN_MONO_LT_EQ;REAL_ARITH `(x:real ~(x = y)`]; +POP_ASSUM DISJ_CASES_TAC; +REPEAT (POP_ASSUM MP_TAC); +REWRITE_TAC[GSYM REAL_BOUNDS_LT]; +MESON_TAC[TAN_MONO_LT_EQ;REAL_ARITH `(x:real ~(x = y)`]; +ASM_REWRITE_TAC[]; +] +(* }}} *));; + +let abs_lemma = prove( + `!f x. (?n. x = f n) \/ (?n. x = -- f n) <=> (?n. abs(x) = abs(f n))`, + ASM_MESON_TAC[REAL_ARITH `!x y. abs(x) = abs(y) <=> (x = y)\/ (x = -- y)`]);; + +let cos_nz = prove_by_refinement ( + `!x. (abs(x) < pi / &2) ==> ~(cos x = &0) `, +(* {{{ proof *) + +[ +GEN_TAC; +REWRITE_TAC[COS_ZERO_PI;abs_lemma]; +ONCE_REWRITE_TAC[TAUT `(a ==> ~b) <=> (b ==> ~a)`]; +ONCE_REWRITE_TAC[REAL_ARITH `~(x < y) <=> (y <= x)`]; +REPEAT STRIP_TAC; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC`(&n + &1/ &2) * pi `; +REWRITE_TAC[REAL_ARITH `x <= abs(x)`]; +MP_TAC PI_POS; +MP_TAC (REAL_ARITH `&1/ &2 <= (&n + &1/ &2)`); +REWRITE_TAC[REAL_ARITH `pi / &2 = (&1 / &2) * pi`]; +ASM_SIMP_TAC[REAL_ARITH `&0 < x ==> &0 <= x`;Real_ext.REAL_LE_RMUL_IMP]; +] + +(* }}} *));; + +let cos_2nz = prove_by_refinement( + `!x. (abs(x) < pi / &4) ==> ~(cos (&2 * x) = &0) `, +(* {{{ proof *) + [ + STRIP_TAC THEN STRIP_TAC; + MATCH_MP_TAC cos_nz; + REWRITE_TAC[REAL_ABS_MUL;REAL_ARITH `abs(&2)= &2 /\ (&2 * x < pi/ &2 <=> x < pi/ &4)`]; + ASM_REWRITE_TAC[]; + ] +(* }}} *));; + +let halfatn_double =prove_by_refinement( + `!x. ~(cos (atn (halfatn x)) = &0) /\ ~(cos(&2 * atn (halfatn x)) = &0) `, +(* {{{ proof *) +[ +REPLICATE_TAC 2 (STRIP_TAC); +MATCH_MP_TAC cos_nz; +MATCH_MP_TAC REAL_LTE_TRANS; +EXISTS_TAC `pi/ &4`; +REWRITE_TAC[atn_half_range]; +MP_TAC PI_POS; +REAL_ARITH_TAC; +MATCH_MP_TAC cos_2nz; +REWRITE_TAC[atn_half_range]; +] +(* }}} *));; + +let REAL_DIV_MUL2z = REAL_FIELD + `!x y z. (&0 < x) ==> (y /z = (x pow 2 * y) / (x pow 2* z)) `;; + +let atn_half = prove_by_refinement ( + `!x. atn x = &2 * atn (halfatn x) `, +(* {{{ proof *) +[ +GEN_TAC; +MATCH_MP_TAC tan_one_one; +MATCH_MP_TAC (TAUT `a /\ b /\ (a /\ b ==> c) ==> a /\ b /\ c`); +REPEAT CONJ_TAC; +REWRITE_TAC[GSYM REAL_BOUNDS_LT;ATN_BOUNDS]; +(* *) +REWRITE_TAC[REAL_ABS_MUL;REAL_ARITH `abs (&2) = &2`;REAL_ARITH `&2 * x < y / &2 <=> x < y / &4`;atn_half_range]; +(* *) +REPEAT STRIP_TAC; +ASSUME_TAC (ISPEC `x:real` halfatn_double); +ASM_SIMP_TAC[TAN_DOUBLE;ATN_TAN]; +REWRITE_TAC[halfatn]; +ASSUME_TAC (ISPEC `x:real` pos2); +ABBREV_TAC `t = sqrt(&1 + x pow 2) + &1`; +MP_TAC (ISPECL [`t:real`;`&2 * x / t`;`&1 - (x / t) pow 2`] REAL_DIV_MUL2z); +ASM_REWRITE_TAC[]; +DISCH_THEN (fun t-> REWRITE_TAC[t]); +ASM_SIMP_TAC[REAL_FIELD `&0 < t ==> t pow 2 * &2 * x / t = t * &2 * x`]; +ASM_SIMP_TAC[REAL_FIELD `&0 < t ==> t pow 2 * (&1 - (x / t) pow 2) = t pow 2 - x pow 2`]; +EXPAND_TAC "t"; +REWRITE_TAC[REAL_FIELD `(a + &1) pow 2 = a pow 2 + &2 * a + &1`]; +ASM_SIMP_TAC[pos1;REAL_ARITH `!x. &0 < x ==> &0 <= x`;SQRT_POW_2]; +ASM_REWRITE_TAC[REAL_ARITH `((&1 + v) + &2 * u + &1) - v = (u + &1) * &2`]; +UNDISCH_TAC `&0 < t`; +CONV_TAC REAL_FIELD; +] +(* }}} *));; + +(* complex taylor for atn *) + +prioritize_complex();; + +let id1 = COMPLEX_RING `inv (Cx (&1) + z pow 2) = (inv (Cx (&2))) * ( ( inv (Cx (&1) + z pow 2) * (Cx (&1) - ii *z)) + (inv (Cx (&1) + z pow 2)) * ( (Cx (&1) + ii * z)))`;; + +let id2 = SIMPLE_COMPLEX_ARITH ` (Cx (&1) + ii * z) * (Cx (&1) - ii * z) = (Cx (&1) - ii * ii * z * z)`;; + +let id3 = prove_by_refinement (`!u a. a - ii * ii * u = a + u`, +(* {{{ proof *) +[ +REWRITE_TAC[ii]; +SIMPLE_COMPLEX_ARITH_TAC; +] +(* }}} *));; + +let id4 = prove_by_refinement (`!z. (Cx (&1) + z pow 2) = (Cx (&1) + ii*z) * (Cx (&1) - ii*z)`, +(* {{{ proof *) +[ +REWRITE_TAC[id2;id3;COMPLEX_POW_2]; +] +(* }}} *));; + + +let tactic_list = [SUBGOAL_THEN `(Re (z) = &0) /\ (abs(Im (z)) = &1)` ASSUME_TAC ; +POP_ASSUM MP_TAC ; +ASM_REWRITE_TAC[] ; +REWRITE_TAC[REAL_ARITH `abs(x) = &1 <=> (x = &1 \/ x = -- &1)`;ii] ; +SIMPLE_COMPLEX_ARITH_TAC ; +ASM_MESON_TAC[]];; + +let idz = prove_by_refinement( + `!z a. (Re z = &0 ==> abs(Im z) < &1) /\ ((a = ii \/ a = --ii)) ==> + ~(Cx (&1) + a * z = Cx (&0))`, + (* {{{ proof *) + [ +ASSUME_TAC (REAL_ARITH `~(&1 < &1)`); +REPEAT STRIP_TAC; +] @ (tactic_list @ tactic_list));; + (* }}} *) + + +let id4a = prove_by_refinement (`!z. (Re z = &0 ==> abs(Im z) < &1) + ==>( inv(Cx (&1) + ii* z) * (Cx (&1) + ii*z) = Cx (&1))`, +(* {{{ proof *) +[ +REPEAT STRIP_TAC; +MATCH_MP_TAC COMPLEX_MUL_LINV; +MATCH_MP_TAC idz; +ASM_REWRITE_TAC[]; +] +(* }}} *));; + +let id4b = prove_by_refinement (`!z. (Re z = &0 ==> abs(Im z) < &1) + ==>( inv(Cx (&1) - ii* z) * (Cx (&1) - ii*z) = Cx (&1))`, +(* {{{ proof *) +[ +REPEAT STRIP_TAC; +MATCH_MP_TAC COMPLEX_MUL_LINV; +REWRITE_TAC[SIMPLE_COMPLEX_ARITH `a - ii * z = a + (-- ii) * z`]; +MATCH_MP_TAC idz; +ASM_REWRITE_TAC[]; +] +(* }}} *));; + +let id5 = prove_by_refinement (`!z. (Re z = &0 ==> abs(Im z) < &1) ==> ( inv (Cx (&1) + z pow 2) = (inv (Cx (&2))) * ( inv (Cx (&1) + ii * z) + inv (Cx (&1) - ii * z)))`, +(* {{{ proof *) +[ +REPEAT STRIP_TAC; +ONCE_REWRITE_TAC[id1]; +REWRITE_TAC[id4;COMPLEX_INV_MUL]; +REWRITE_TAC[SIMPLE_COMPLEX_ARITH `((a*b)*c + (e*f)*g = (a:complex)*(b*c) + f * (e *g))`]; +ASM_SIMP_TAC[id4a;id4b]; +REWRITE_TAC[COMPLEX_MUL_RID]; +] +(* }}} *));; + +let taylor_coeff_catn = new_definition `taylor_coeff_catn n (z:complex) = + if (n=0) then catn z else Cx (& (FACT (n-1))) * + (inv(Cx (&2))) * ( ( (-- ii) pow (n - 1) * ((inv (Cx (&1) + ii * z)) pow n)) + + ( ii pow (n - 1) * ((inv (Cx (&1) - ii * z)) pow n)))`;; + +let taylor_coeff_catn0 = prove_by_refinement ( + `taylor_coeff_catn 0 = catn `, +(* {{{ proof *) + [ + ONCE_REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[taylor_coeff_catn]; + ] +(* }}} *));; + +let taylor_coeff_catn1 = prove_by_refinement ( + `!z. (Re z = &0 ==> abs(Im z) < &1) ==> + (catn has_complex_derivative (taylor_coeff_catn 1 z)) (at z)`, +(* {{{ proof *) + [ + REPEAT STRIP_TAC; + SUBGOAL_THEN `taylor_coeff_catn 1 z = inv (Cx (&1) + z pow 2)` ASSUME_TAC; + REWRITE_TAC[taylor_coeff_catn;ARITH_RULE `~(1=0) /\ (1-1 = 0) /\ (FACT 0 =1)`;COMPLEX_POW_1;complex_pow;COMPLEX_MUL_LID]; + ASM_SIMP_TAC[id5]; + (* *) + ASM_SIMP_TAC[HAS_COMPLEX_DERIVATIVE_CATN;]; + ] +(* }}} *));; + +let taylor_coeff_catn_pos = prove_by_refinement( + `!n. (n > 0) ==> (taylor_coeff_catn n = (\z. + Cx (& (FACT (n-1))) * + (inv(Cx (&2))) * ( ( (-- ii) pow (n - 1) * ((inv (Cx (&1) + ii * z)) pow n)) + + ( ii pow (n - 1) * ((inv (Cx (&1) - ii * z)) pow n))) ))`, +(* {{{ proof *) + [ + REPEAT STRIP_TAC; + ONCE_REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[taylor_coeff_catn]; + ASM_SIMP_TAC[ARITH_RULE `n > 0 ==> ~(n=0)`]; + ] +(* }}} *));; + +let taylor_series_inv_pow = prove_by_refinement( + `!n a z. ~(Cx (&1) + a * z = Cx(&0)) ==> + (((\z. (inv (Cx (&1) + a * z)) pow n) has_complex_derivative + (-- Cx(&n) * a * (inv (Cx(&1) + a * z)) pow (n+1))) (at z))`, + (* {{{ proof *) + + [ + REPEAT STRIP_TAC; + DISJ_CASES_TAC (ARITH_RULE `(n=0) \/ (n > 0)`); + ASM_REWRITE_TAC[ARITH_RULE `0+1=1`;complex_pow;COMPLEX_POW_1;SIMPLE_COMPLEX_ARITH `-- Cx (&0) * u = Cx(&0)`;HAS_COMPLEX_DERIVATIVE_CONST]; + ASM_SIMP_TAC[ARITH_RULE `(n>0) ==> (n+1 = 2 + (n-1))`;]; + REWRITE_TAC[COMPLEX_POW_ADD]; + ONCE_REWRITE_TAC[SIMPLE_COMPLEX_ARITH `-- r * s * t * u = r * u * ( -- s * t)`]; + MATCH_MP_TAC HAS_COMPLEX_DERIVATIVE_POW_AT; + REWRITE_TAC[COMPLEX_POW_INV;GSYM complex_div]; + MATCH_MP_TAC HAS_COMPLEX_DERIVATIVE_INV_AT; + ASM_REWRITE_TAC[]; + CONV_TAC (PATH_CONV "lr" (ONCE_REWRITE_CONV[SIMPLE_COMPLEX_ARITH `a = Cx(&0) + a * Cx (&1)` ])); + MATCH_MP_TAC HAS_COMPLEX_DERIVATIVE_ADD; + REWRITE_TAC[HAS_COMPLEX_DERIVATIVE_CONST]; + MATCH_MP_TAC HAS_COMPLEX_DERIVATIVE_LMUL_AT; + REWRITE_TAC[HAS_COMPLEX_DERIVATIVE_ID]; + ]);; + + (* }}} *) + +let factorial_lemma = prove_by_refinement( + `!n. (n>0) ==> (FACT n = n * FACT (n-1))`, + (* {{{ proof *) + [ +REPEAT STRIP_TAC; +DISJ_CASES_TAC (ISPEC `n:num` num_CASES); +ASM_MESON_TAC[ARITH_RULE `(n>0) ==> ~(n=0)`]; +ASM_MESON_TAC[FACT;ARITH_RULE `SUC n - 1 = n`]; + ]);; + (* }}} *) + +let taylor_coeff_catn_deriv = prove_by_refinement( + `!z n. (Re z = &0 ==> abs(Im z) < &1) ==> + ((taylor_coeff_catn n) has_complex_derivative + (taylor_coeff_catn (n+1) z)) (at z)`, +(* {{{ proof *) +[ +REPEAT STRIP_TAC; +DISJ_CASES_TAC (ARITH_RULE `(n = 0) \/ (n >0)`); +ASM_SIMP_TAC[ taylor_coeff_catn0;taylor_coeff_catn1;ARITH_RULE `0+1=1`]; +REWRITE_TAC[taylor_coeff_catn;ARITH_RULE `(n+1)-1 = n`]; +ASM_SIMP_TAC[ARITH_RULE `(n>0) ==> ~(n+1=0)`]; +ASM_SIMP_TAC[taylor_coeff_catn_pos;factorial_lemma]; +(* fact finding *) +SUBGOAL_THEN `!u. Cx (&(n * FACT (n-1))) * u = Cx (&n) * (Cx (&(FACT (n-1))) * u)` MP_TAC; +REWRITE_TAC[CX_MUL;GSYM REAL_OF_NUM_MUL]; +SIMPLE_COMPLEX_ARITH_TAC; +DISCH_THEN (fun t-> REWRITE_TAC[t]); +ONCE_REWRITE_TAC[SIMPLE_COMPLEX_ARITH `(a:complex) * b * c * d = b * c * a * d`]; +ONCE_REWRITE_TAC[SIMPLE_COMPLEX_ARITH `(a:complex) * b * u = (a*b)*u`]; +MATCH_MP_TAC HAS_COMPLEX_DERIVATIVE_LMUL_AT; +REWRITE_TAC[COMPLEX_ADD_LDISTRIB]; +MATCH_MP_TAC HAS_COMPLEX_DERIVATIVE_ADD; +REWRITE_TAC[SIMPLE_COMPLEX_ARITH `a - ii * z = a + (-- ii) * z`]; +SUBGOAL_THEN `!a b r. a * b pow n * r = b pow (n-1) * ( -- a * ( -- b) * r)` MP_TAC; +REPEAT STRIP_TAC; +MP_TAC(ARITH_RULE `n>0 ==> n = (n-1) + 1`); +ASM_REWRITE_TAC[]; +DISCH_THEN (fun t -> CONV_TAC (PATH_CONV "lr" (ONCE_REWRITE_CONV[t]))); +REWRITE_TAC[COMPLEX_POW_ADD;COMPLEX_POW_1]; +SIMPLE_COMPLEX_ARITH_TAC; +DISCH_THEN (fun t->REWRITE_TAC[t]); +CONJ_TAC THEN (MATCH_MP_TAC HAS_COMPLEX_DERIVATIVE_LMUL_AT) ; +(* highly parallel branches *) +REWRITE_TAC[SIMPLE_COMPLEX_ARITH `-- --ii = ii`]; +MATCH_MP_TAC taylor_series_inv_pow; +STRIP_TAC; +ASM_MESON_TAC[idz]; +(* *) +MATCH_MP_TAC taylor_series_inv_pow; +STRIP_TAC; +ASM_MESON_TAC[idz]; +] +(* }}} *));; + +let ipows2 = prove_by_refinement( + `!n. (--ii ) pow (n + 2) = -- ((-- ii) pow n)`, + (* {{{ proof *) + [ + GEN_TAC; + REWRITE_TAC[COMPLEX_POW_ADD;COMPLEX_POW_2;]; + MATCH_MP_TAC (SIMPLE_COMPLEX_ARITH `(a * a = -- Cx(&1) ) ==> r * a * a = -- r`); + REWRITE_TAC[ii]; + SIMPLE_COMPLEX_ARITH_TAC; + ]);; + (* }}} *) + +let ipowsc2 = prove_by_refinement( + `!n. (ii ) pow (n + 2) = -- ((ii) pow n)`, + (* {{{ proof *) + [ + GEN_TAC; + REWRITE_TAC[COMPLEX_POW_ADD;COMPLEX_POW_2;]; + MATCH_MP_TAC (SIMPLE_COMPLEX_ARITH `(a * a = -- Cx(&1) ) ==> r * a * a = -- r`); + REWRITE_TAC[ii]; + SIMPLE_COMPLEX_ARITH_TAC; + ]);; + (* }}} *) + + +let taylor_coeff0 = prove_by_refinement( + `!n. (taylor_coeff_catn n (Cx (&0)) = if (EVEN n) then (Cx (&0)) else + Cx (&(FACT (n-1)) * (-- &1) pow ((n - 1) DIV 2)))`, + (* {{{ proof *) + [ + GEN_TAC; + DISJ_CASES_TAC (ISPEC `n:num` EVEN_OR_ODD); + DISJ_CASES_TAC (ARITH_RULE `(n=0) \/ (n >0)`); + ASM_REWRITE_TAC[taylor_coeff_catn;GSYM CX_ATN;ATN_0]; + (* *) + ASM_SIMP_TAC[taylor_coeff_catn_pos]; + REWRITE_TAC[SIMPLE_COMPLEX_ARITH `a + b * Cx(&0) = a /\ a - b * Cx(&0) =a`]; + REWRITE_TAC[SIMPLE_COMPLEX_ARITH `inv(Cx (&1)) = Cx (&1) /\ a * Cx(&1) = a`;COMPLEX_POW_ONE]; + MATCH_MP_TAC (SIMPLE_COMPLEX_ARITH `c = Cx(&0) ==> a*b*c = Cx(&0)`); + SUBGOAL_THEN ( `EVEN n ==> (?k. (n - 1) = 2 * k + 1)`) MP_TAC; + REWRITE_TAC[EVEN_EXISTS]; + REPEAT STRIP_TAC; + EXISTS_TAC `m-1`; + REPEAT (POP_ASSUM MP_TAC); + ARITH_TAC; + ASM_REWRITE_TAC[]; + REPEAT STRIP_TAC; + ASM_REWRITE_TAC[]; + SPEC_TAC (`k:num`,`k:num`); + INDUCT_TAC; + REWRITE_TAC[ARITH_RULE `2* 0 + 1 = 1`;COMPLEX_POW_1]; + SIMPLE_COMPLEX_ARITH_TAC; + ASM_REWRITE_TAC[ipows2;ipowsc2;ARITH_RULE `2* SUC k' + 1 = (2 * k' + 1) + 2`;SIMPLE_COMPLEX_ARITH `--a + --b = --(a+b) /\ -- Cx(&0) = Cx(&0) `]; + (* ODD *) + ASM_REWRITE_TAC[GSYM NOT_ODD]; + SUBGOAL_THEN (`ODD n ==> (?k. n = 2 * k + 1)`) MP_TAC; + REWRITE_TAC[ODD_EXISTS]; + REPEAT STRIP_TAC; + EXISTS_TAC `m:num`; + ASM_REWRITE_TAC[]; + ARITH_TAC; + ASM_REWRITE_TAC[]; + REPEAT STRIP_TAC; + SUBGOAL_THEN `n > 0` ASSUME_TAC; + POP_ASSUM MP_TAC; + ARITH_TAC; + ASM_SIMP_TAC[taylor_coeff_catn_pos]; + REWRITE_TAC[SIMPLE_COMPLEX_ARITH `a + b * Cx (&0) = a /\ a - b * Cx (&0) = a /\ inv (Cx (&1)) = Cx (&1) /\ a * Cx (&1) = a`;COMPLEX_POW_ONE;ARITH_RULE `(2 * k + 1 ) - 1 = 2 * k`;CX_MUL]; + MATCH_MP_TAC (SIMPLE_COMPLEX_ARITH `(b = c) ==> (a*b = a*c)`); + SPEC_TAC (`k:num`,`k:num`); + INDUCT_TAC; + REWRITE_TAC[ARITH_RULE `2 * 0 =0 /\ 0 DIV 2 = 0`;complex_pow;real_pow]; + SIMPLE_COMPLEX_ARITH_TAC; + REWRITE_TAC[ARITH_RULE `2 * SUC k' = 2 * k' + 2 /\ (2 * SUC k) DIV 2 = ((2 * k) DIV 2) + 1`;SIMPLE_COMPLEX_ARITH `a * (-- b + -- c) = -- (a * (b+c))`;ipows2;ipowsc2;COMPLEX_POW_ADD;REAL_POW_ADD;CX_MUL;REAL_POW_1]; + ASM_REWRITE_TAC[]; + SIMPLE_COMPLEX_ARITH_TAC; + ]);; + (* }}} *) + +let term_bound = prove_by_refinement( + `!a n z. Im (z) = &0 ==> + norm((Cx(a)* ii) pow n * ((inv (Cx (&1) - Cx(a)* ii * z)) pow (n+1))) + <= (abs a) pow n `, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[COMPLEX_NORM_MUL;COMPLEX_NORM_II;COMPLEX_NORM_CX;COMPLEX_NORM_POW;COMPLEX_NORM_INV;REAL_ARITH `a * &1 = a`]; + MATCH_MP_TAC (MESON[REAL_LE_LMUL;REAL_ARITH `x = x* &1`] ( `!x y. &0 <= x /\ y <= &1 ==> x *y <= x`)) ; + CONJ_TAC; + MATCH_MP_TAC REAL_POW_LE; + REWRITE_TAC[REAL_ABS_POS]; + MATCH_MP_TAC (MESON[REAL_POW_LE2;REAL_POW_ONE] `!x. &0 <= x /\ x <= &1 ==> x pow n <= &1`); + REWRITE_TAC[REAL_LE_INV_EQ;NORM_POS_LE]; + MATCH_MP_TAC (MESON[REAL_LE_INV2;REAL_INV_1;REAL_ARITH `&0 < &1`] `&1 <= x ==> inv (x) <= &1`); + SUBGOAL_THEN `Im z = &0 ==> Cx(&1) - Cx a * ii * z = complex(&1, -- a * Re(z))` MP_TAC; + REWRITE_TAC[ii]; + SIMPLE_COMPLEX_ARITH_TAC; + ASM_REWRITE_TAC[]; + DISCH_THEN (fun t -> REWRITE_TAC[t]); + (* *) + MATCH_MP_TAC (MESON[Collect_geom.POW2_COND;REAL_ARITH `&0 <= &1 /\ &1 pow 2 = &1`;NORM_POS_LE] `&1 <= norm x pow 2 ==> &1 <= norm x`); + REWRITE_TAC[COMPLEX_SQNORM;RE;IM]; + MESON_TAC[Collect_geom.pow_g;REAL_ARITH `&1 pow 2 = &1 /\ (&0 <= t ==> &1 <= &1 + t)`]; + ]);; + (* }}} *) + +let taylor_error_bound = prove_by_refinement( + `!n z. Im(z) = &0 ==> norm(taylor_coeff_catn (n+1) z) <= &(FACT n)`, + (* {{{ proof *) + + [ + REPEAT STRIP_TAC; + SIMP_TAC[taylor_coeff_catn_pos;ARITH_RULE `(n+1)>0 /\ ((n+1)-1 = n)`]; + REWRITE_TAC[COMPLEX_NORM_MUL;COMPLEX_NORM_NUM;COMPLEX_NORM_INV]; + REWRITE_TAC[COMPLEX_NORM_NUM]; + MATCH_MP_TAC (MESON[REAL_LE_LMUL;REAL_ARITH `x = x* &1`] ( `!x y. &0 <= x /\ y <= &1 ==> x *y <= x`)) ; + CONJ_TAC; + REWRITE_TAC[REAL_OF_NUM_LE]; + ARITH_TAC; +MATCH_MP_TAC (REAL_ARITH `x <= &1 + &1 ==> inv (&2)* x <= &1`); +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC `norm (--ii pow n * inv (Cx (&1) + ii * z) pow (n + 1)) + norm ( ii pow n * inv (Cx (&1) - ii * z) pow (n + 1))`; +REWRITE_TAC[NORM_TRIANGLE]; +MATCH_MP_TAC REAL_LE_ADD2; +(* *) +CONJ_TAC; +(* FORCE_MATCH_MP_TAC *) +FORCE_MATCH_MP_TAC (ISPECL [`-- &1`;`n:num`;`z:complex`] term_bound); +ASM_REWRITE_TAC[]; +ONCE_REWRITE_TAC[FUN_EQ_THM]; +SIMPLE_COMPLEX_ARITH_TAC; +SIMPLE_COMPLEX_ARITH_TAC; +REWRITE_TAC[REAL_ABS_NEG;REAL_ABS_NUM;REAL_POW_ONE]; +(* second *) +ONCE_REWRITE_TAC[SIMPLE_COMPLEX_ARITH `ii * z = Cx(&1) * ii * z`]; +FORCE_MATCH_MP_TAC (ISPECL [` &1`;`n:num`;`z:complex`] term_bound); +ASM_REWRITE_TAC[]; +SIMPLE_COMPLEX_ARITH_TAC; +REWRITE_TAC[REAL_ABS_NEG;REAL_ABS_NUM;REAL_POW_ONE]; + ]);; + + (* }}} *) + +let complex_taylor_catn = prove_by_refinement( + ` !n s. (s = {z | Im (z) = &0 }) ==> (!z. + (Cx(&0)) IN s /\ z IN s + ==> norm + (catn z - + vsum (0..n) + (\i. taylor_coeff_catn i (Cx(&0)) * (z) pow i / Cx (&(FACT i)))) <= + norm (z) pow (n + 1) )`, + (* {{{ proof *) + + [ + GEN_TAC THEN GEN_TAC; + DISCH_TAC; + MP_TAC (SPECL[`taylor_coeff_catn`;`n:num`;`s:complex->bool`;`&(FACT n)`] COMPLEX_TAYLOR); + ASM_REWRITE_TAC[IN_ELIM_THM]; + ANTS_TAC; + REPEAT (CONJ_TAC THEN (REPEAT STRIP_TAC)); + REWRITE_TAC[convex;IN_ELIM_THM;IM_ADD;IM_CMUL]; + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]; + REAL_ARITH_TAC; + MATCH_MP_TAC HAS_COMPLEX_DERIVATIVE_AT_WITHIN; + MATCH_MP_TAC taylor_coeff_catn_deriv; + ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; + (* *) + MATCH_MP_TAC taylor_error_bound; + ASM_REWRITE_TAC[]; + DISCH_THEN (MP_TAC o (ISPEC `Cx (&0)`)); + REWRITE_TAC[taylor_coeff_catn0;SIMPLE_COMPLEX_ARITH `z - Cx (&0) = z /\ Im (Cx (&0)) = &0`]; + DISCH_THEN (fun t-> REPEAT STRIP_TAC THEN MP_TAC t) ; + DISCH_THEN (MP_TAC o (ISPEC `z:complex`)); + DISCH_THEN FORCE_MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_DIV_LMUL; + REWRITE_TAC[REAL_OF_NUM_EQ]; + MESON_TAC[ FACT_LT;ARITH_RULE `0 < x ==> ~(x =0)`]; + ]);; + + (* }}} *) + +let real_axis = prove_by_refinement( (* not needed *) + `!z. (Im z = &0 <=> (?x. z = Cx(x)))`, + (* {{{ proof *) + [ + GEN_TAC; + EQ_TAC; + DISCH_TAC; + EXISTS_TAC `(Re z)`; + POP_ASSUM MP_TAC; + SIMPLE_COMPLEX_ARITH_TAC; + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[IM_CX]; + ]);; + (* }}} *) + +let THREAD_IF = prove_by_refinement( + `!x y z f. (f:A->B) (if x then y else z) = if x then f y else f z`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + BOOL_CASES_TAC `x:bool` THEN REWRITE_TAC[]; + ]);; + (* }}} *) + + +let real_taylor_atn_ver1 = prove_by_refinement( + `!n x. abs(atn x - sum (0..n) (\i. if EVEN i then &0 else ( -- &1 pow ((i-1) DIV 2) * x pow i / &i ))) <= abs(x) pow (n+1)`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + MP_TAC (ISPECL [`n:num`;`{ z | Im(z) = &0 }`] complex_taylor_catn); + REWRITE_TAC[]; + DISCH_THEN (fun t -> MP_TAC (ISPEC `Cx (x)` t)); + REWRITE_TAC[VSUM_CX_NUMSEG;COMPLEX_NORM_CX;GSYM CX_SUB;GSYM CX_POW;IN_ELIM_THM;GSYM CX_MUL;GSYM CX_DIV;GSYM CX_ATN;IM_CX;taylor_coeff0;GSYM THREAD_IF]; + FORCE_MATCH; + ONCE_REWRITE_TAC[FUN_EQ_THM]; + X_GEN_TAC `i:num`; + BETA_TAC; + DISJ_CASES_TAC (TAUT `EVEN i \/ ~(EVEN i)`) THEN ASM_REWRITE_TAC[]; + REAL_ARITH_TAC; + POP_ASSUM MP_TAC; + REWRITE_TAC[NOT_EVEN;ODD_EXISTS]; + REPEAT STRIP_TAC; + ASM_REWRITE_TAC[ARITH_RULE `SUC x - 1 = x`;FACT;GSYM REAL_OF_NUM_MUL ]; + ONCE_REWRITE_TAC[REAL_FIELD `((a:real) * b) * c/(d*a) = (b * c/d) * (a/a)`]; + MATCH_MP_TAC (REAL_FIELD `x = &1 ==> (y * x = y)`); + MATCH_MP_TAC REAL_DIV_REFL; + REWRITE_TAC[REAL_OF_NUM_EQ]; + MESON_TAC[FACT_LT;ARITH_RULE `0 < x ==> ~(x = 0)`]; + ]);; + (* }}} *) + +let sum_odd = prove_by_refinement( + `!(g:num->real) n. sum { i | ODD i /\ i IN 0.. 2 * n + 2 } g = sum (0.. n) (\i. g (2 * i +1))`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + FORCE_MATCH_MP_TAC (ISPECL [`\i. (2 * i + 1)`; `g:num->real`;`(0..n)`] SUM_IMAGE); + BETA_TAC; + ARITH_TAC; + REWRITE_TAC[IMAGE;numseg;IN_ELIM_THM;ODD_EXISTS]; + ONCE_REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[IN_ELIM_THM]; + GEN_TAC; + EQ_TAC; + REPEAT STRIP_TAC; + EXISTS_TAC `x':num`; + POP_ASSUM MP_TAC; + ARITH_TAC; + REPEAT (POP_ASSUM MP_TAC); + ARITH_TAC; + REPEAT (POP_ASSUM MP_TAC); + ARITH_TAC; + REPEAT STRIP_TAC; + EXISTS_TAC `m:num`; + REPEAT (POP_ASSUM MP_TAC); + ARITH_TAC; + ONCE_REWRITE_TAC[FUN_EQ_THM;]; + REWRITE_TAC[o_THM]] + (* }}} *) +);; + +let sum_even = prove_by_refinement( + `!g n. sum {i | ODD i /\ i IN 0..n } (\i. if EVEN i then &0 else g i) = sum (0..n) (\i. if EVEN i then &0 else g i)`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + ONCE_REWRITE_TAC [MESON[] `x = y <=> y = x`]; + FORCE_MATCH_MP_TAC (ISPECL [`(\i. if EVEN i then &0 else (g i))`;`{i | ODD i /\ i IN 0..n}`;`(0..n)`] SUM_SUPERSET); + REPEAT STRIP_TAC; + SET_TAC[]; + REPEAT (POP_ASSUM MP_TAC); + REWRITE_TAC[IN_ELIM_THM;numseg]; + MESON_TAC[NOT_ODD]; + REWRITE_TAC[]; + ]);; + (* }}} *) + +let real_taylor_atn = prove_by_refinement( + `!n x. abs(atn x - sum (0..n) (\j. (-- &1 pow j) * x pow (2 * j + 1)/ &(2 * j+ 1))) <= abs(x) pow (2 * n + 3)`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + MP_TAC (ISPECL [`2*n + 2`;`x:real`] real_taylor_atn_ver1); + REWRITE_TAC[ARITH_RULE `(2*n + 2) +1 = 2 *n + 3`]; + REWRITE_TAC[GSYM sum_even]; + REWRITE_TAC[sum_odd]; + SUBGOAL_THEN `!i. ~(EVEN (2 *i + 1))` MP_TAC; + MP_TAC NOT_EVEN; + REWRITE_TAC[EVEN_EXISTS;ODD_EXISTS;ARITH_RULE `!m. SUC (m) = m+1`]; + MESON_TAC[]; + DISCH_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[ARITH_RULE `((2 * i + 1) - 1) DIV 2 = i`]; + ]);; + (* }}} *) + +let halfatn4 = new_definition `halfatn4 = halfatn o halfatn o halfatn o halfatn`;; + +let real_taylor_atn_halfatn4 = prove_by_refinement( + `!n x. abs (atn(halfatn4 x) - sum (0..n) (\j. (-- &1 pow j) * halfatn4 x pow (2 * j + 1)/ &(2 * j+ 1))) <= inv (&8 pow (2 * n + 3))`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + MATCH_MP_TAC REAL_LE_TRANS; + EXISTS_TAC `abs(halfatn4 x) pow (2 * n + 3)`; + REWRITE_TAC[real_taylor_atn;REAL_INV_POW]; + MATCH_MP_TAC Real_ext.REAL_PROP_LE_POW; + REWRITE_TAC[REAL_ABS_POS;halfatn4;o_THM]; + MATCH_MP_TAC (REAL_ARITH `x < y ==> x <= y`); + MP_TAC (ISPEC `x:real` halfatn_bounds_abs); + REPLICATE_TAC 3( DISCH_THEN (fun t-> MP_TAC (MATCH_MP halfatn_half t))); + FORCE_MATCH; + CONV_TAC REAL_FIELD; + ]);; + (* }}} *) + +let atn_halfatn4 = prove_by_refinement( + `!x. atn x = &16 * atn(halfatn4 x)`, + (* {{{ proof *) + [ + ONCE_REWRITE_TAC[REAL_ARITH `&16 * x = &2 * &2 * &2 * &2 * x`]; + REWRITE_TAC[halfatn4;o_THM;GSYM atn_half]; + ]);; + (* }}} *) + +let real_taylor_atn_halfatn4_a = prove_by_refinement( + `!n x. abs (atn x - &16 * sum (0..n) (\j. (-- &1 pow j) * halfatn4 x pow (2 * j + 1)/ &(2 * j+ 1))) <= inv (&2 pow (6 * n + 5 ))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + ONCE_REWRITE_TAC [atn_halfatn4]; + REWRITE_TAC[REAL_ARITH `abs (&16 * x - &16 * y) <= z <=> abs(x - y) <= z *inv (&2 pow 4)`]; + MP_TAC (ISPECL [`n:num`;`x:real`] real_taylor_atn_halfatn4); + FORCE_MATCH; + REWRITE_TAC[GSYM REAL_INV_MUL;GSYM REAL_POW_ADD;REAL_ARITH `&8 = &2 pow 3`;REAL_POW_POW]; + REPEAT AP_TERM_TAC; + ARITH_TAC; + ]);; + (* }}} *) + +let halfatn4_co = new_definition `halfatn4_co x j = (-- &1 pow j) * halfatn4 x pow (2 * j + 1)/ &(2 * j+ 1)`;; + +let atn_bounds_anti = prove_by_refinement( + `!x y. x <= y ==> abs(atn x - atn y) <= abs(x - y)`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + MP_TAC (ISPECL [`atn`;`(\t. inv(&1 + t pow 2))`;`x:real`;`y:real`] REAL_MVT_VERY_SIMPLE); + REWRITE_TAC[real_interval;IN_ELIM_THM]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT STRIP_TAC; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_ATREAL_WITHIN; + REWRITE_TAC[HAS_REAL_DERIVATIVE_ATN]; + REPEAT STRIP_TAC; + ONCE_REWRITE_TAC[REAL_ARITH `abs(y - x) = abs(x-y)`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[REAL_ABS_MUL]; + FORCE_MATCH_MP_TAC (ISPECL [`abs(inv (&1 + x' pow 2))`;`&1`;`abs(y-x)`] REAL_LE_RMUL); + REWRITE_TAC[REAL_ABS_POS;REAL_ABS_INV]; + FORCE_MATCH_MP_TAC (ISPECL [`&1`;`abs(&1 + x' pow 2)`] REAL_LE_INV2); + CONJ_TAC THEN TRY(REAL_ARITH_TAC); + MP_TAC (ISPEC `x':real` pos1); + SIMP_TAC [REAL_ARITH `(&0 < x ==> (abs x = x)) /\ (&1 <= &1 + u <=> &0 <= u)`;Real_ext.REAL_LE_POW_2]; + REAL_ARITH_TAC; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +prioritize_real();; + +let atn_bounds = prove_by_refinement( + `!x y. abs(atn x - atn y) <= abs(x-y)`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + DISJ_CASES_TAC (REAL_ARITH `x<= y \/ y <= x`); + ASM_SIMP_TAC[atn_bounds_anti]; + ONCE_REWRITE_TAC[REAL_ARITH `abs(x -y) = abs(y-x)`]; + ASM_SIMP_TAC[atn_bounds_anti]; + ]);; + (* }}} *) + +let real_taylor_atn_approx = prove_by_refinement( + `!n x v eps1 eps2 eps. + inv (&2 pow (6 * n + 5)) <= eps1 /\ + abs(&16 *sum (0..n) (halfatn4_co x) - v )<= eps2 /\ + (eps1 + eps2 <= eps) ==> + abs(atn(x) - v) <= eps`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + MATCH_MP_TAC REAL_LE_TRANS; + EXISTS_TAC `( eps1:real) + eps2`; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_TRANS; + ABBREV_TAC `r = &16 * sum(0..n) (halfatn4_co x)`; + EXISTS_TAC`abs(atn x - r) + abs(r - v)`; + CONJ_TAC; + MESON_TAC[REAL_ABS_TRIANGLE;REAL_ARITH `atn x - v = (atn x - r) + r - v`]; + MATCH_MP_TAC (REAL_ARITH `a1 <= b1 /\ a2 <= b2 ==> a1 + a2 <= b1 + b2`); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_TRANS; + EXISTS_TAC `inv(&2 pow (6 * n + 5))`; + ASM_REWRITE_TAC[]; + EXPAND_TAC "r"; + MP_TAC (ISPECL [`n:num`;`x:real`] real_taylor_atn_halfatn4_a); + FORCE_MATCH; + REWRITE_TAC[FUN_EQ_THM;halfatn4_co]; + ]);; + (* }}} *) + + +end;; diff --git a/text_formalization/leg/AFF_SGN_TAC.hl b/text_formalization/leg/AFF_SGN_TAC.hl new file mode 100644 index 0000000..0dd44f1 --- /dev/null +++ b/text_formalization/leg/AFF_SGN_TAC.hl @@ -0,0 +1,50 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Tactic: AFF_SGN_TAC *) +(* Chapter: LEG *) +(* Author: John Harrison, with minor edits by T. Hales *) +(* Date: 2010-02-07 *) +(* ========================================================================== *) + +module type Aff_sgn_tac_type = sig + val AFF_SGN_TAC : tactic +end;; + +(* + + This is Harrison's 2009 workshop AFF_GE_TAC tactic, slightly adapted + to handle signs other than GE. + + The tactic is documented at + http://weyl.math.pitt.edu/hanoi2009/uploads/HOLLight/affsign_small.ml + Examples appear at the indicated URL. + + It proves conv0, aff_gt, aff_ge, and aff_lt formulas in special cases. + +*) + +module Aff_sgn_tac : Aff_sgn_tac_type = struct + + +let AFF_SGN_TAC = + REWRITE_TAC[DISJOINT_INSERT; DISJOINT_EMPTY] THEN + REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; DE_MORGAN_THM] THEN + REPEAT STRIP_TAC THEN + REWRITE_TAC[aff_ge_def; sgn_ge; aff_gt_def;sgn_gt;conv0;aff_lt_def;sgn_lt;AFFSIGN_ALT] THEN + REWRITE_TAC[SET_RULE `(x INSERT s) UNION t = x INSERT (s UNION t)`] THEN + REWRITE_TAC[UNION_EMPTY] THEN + SIMP_TAC[FINITE_INSERT; FINITE_UNION; AFFINE_HULL_FINITE_STEP_GEN; + FINITE_EMPTY; RIGHT_EXISTS_AND_THM; + REAL_LE_ADD; REAL_LT_ADD; + REAL_ARITH `a < &0 /\ b < &0 ==> a+ b< &0`; + REAL_ARITH `&0 < a/ &2 <=> &0 < a`; REAL_ARITH `&0 <= a / &2 <=> &0 <= a`; + REAL_ARITH `a/ &2 < &0 <=> a < &0`] THEN + ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; real_ge;real_gt] THEN + REWRITE_TAC[REAL_ARITH `x - y:real = z <=> x = y + z`; + VECTOR_ARITH `x - y:real^N = z <=> x = y + z`] THEN + REWRITE_TAC[RIGHT_AND_EXISTS_THM; REAL_ADD_RID; VECTOR_ADD_RID] THEN + ONCE_REWRITE_TAC[REAL_ARITH `&1 = x <=> x = &1`] THEN + REWRITE_TAC[] THEN SET_TAC[];; + +end;; diff --git a/text_formalization/leg/abc_of_quadratic_def.hl b/text_formalization/leg/abc_of_quadratic_def.hl new file mode 100644 index 0000000..49c6464 --- /dev/null +++ b/text_formalization/leg/abc_of_quadratic_def.hl @@ -0,0 +1,36 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Definition: abc_of_quadratic *) +(* Chapter: LEG *) +(* Author: Thomas C. Hales *) +(* Date: 2010-02-07 *) +(* ========================================================================== *) + + + + +(* +f = \x. a x^2 + b x + c, extract a b c +*) + + +(* moved to sphere.hl. This file is deprecated *) + +module type Abc_of_quadratic_def_type = sig + val abc_of_quadratic : thm +end;; + + + +module Abc_of_quadratic : Abc_of_quadratic_def_type = struct + + let abc_of_quadratic = +new_definition `abc_of_quadratic f = + let c = f (&0) in + let p = f (&1) in + let n = f (-- &1) in + ((p + n)/(&2) - c, (p -n)/(&2), c)` ;; + +end;; + diff --git a/text_formalization/leg/affprops.hl b/text_formalization/leg/affprops.hl new file mode 100644 index 0000000..ac8293b --- /dev/null +++ b/text_formalization/leg/affprops.hl @@ -0,0 +1,136 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Definition: affprops *) +(* Chapter: LEG *) +(* Author: Thomas C. Hales *) +(* Date: 2010-02-07 *) +(* ========================================================================== *) + + +module type Affprops_def_type = sig + val affprops_goal : term + val affprops : thm +end;; + +(* + simp_def2 was assumed as an axiom in collect_geom.ml. + Here is a proof. + The first and last clauses were corrected by inserting DISJOINT. +*) + +flyspeck_needs "leg/AFF_SGN_TAC.hl";; + + +module Affprops : Affprops_def_type = struct + + + let AFF_SGN_TAC = Aff_sgn_tac.AFF_SGN_TAC;; + + let affprops_goal = `(!a b v0. + DISJOINT {a,b} {v0} ==> aff_gt {a, b} {v0} = + {x | ?ta tb t. + ta + tb + t = &1 /\ &0 < t /\ x = ta % a + tb % b + t % v0} /\ + aff_ge {a, b} {v0} = + {x | ?ta tb t. + ta + tb + t = &1 /\ + &0 <= t /\ + x = ta % a + tb % b + t % v0}) /\ + (!x y z. + conv0 {x, y, z} = + {t | ?a b c. + a + b + c = &1 /\ + &0 < a /\ + &0 < b /\ + &0 < c /\ + t = a % x + b % y + c % z}) /\ + (!x y z. + affine hull {x, y, z} = + {t | ?a b c. a + b + c = &1 /\ t = a % x + b % y + c % z})/\ + (!v1 v2 v3. + DISJOINT {v2,v3} {v1} ==> aff_lt {v2, v3} {v1} = + {x | ?t2 t3 t1. + t2 + t3 + t1 = &1 /\ + t1 < &0 /\ + x = t2 % v2 + t3 % v3 + t1 % v1}) `;; + +let affprops_2_1_goal = `!a b v0. + DISJOINT {a,b} {v0} ==> aff_gt {a, b} {v0} = + {x | ?ta tb t. + ta + tb + t = &1 /\ &0 < t /\ x = ta % a + tb % b + t % v0} `;; + + let affprops_2_1 = prove(affprops_2_1_goal,AFF_SGN_TAC);; + + +let affprops_ge_2_1_goal = `(!a b v0. + DISJOINT {a,b} {v0} ==> + aff_ge {a, b} {v0} = + {x | ?ta tb t. + ta + tb + t = &1 /\ + &0 <= t /\ + x = ta % a + tb % b + t % v0})`;; + +let affprops_ge_2_1 = prove(affprops_ge_2_1_goal,AFF_SGN_TAC);; + + let affprops_0_3_goal = ` (!x y z. + conv0 {x, y, z} = + {t | ?a b c. + a + b + c = &1 /\ + &0 < a /\ + &0 < b /\ + &0 < c /\ + t = a % x + b % y + c % z})`;; + +let affprops_0_3 = prove(affprops_0_3_goal,REWRITE_TAC[conv0] THEN AFF_SGN_TAC);; + + let affprops_3_0_goal = ` (!x y z. + affine hull {x, y, z} = + {t | ?a b c. a + b + c = &1 /\ t = a % x + b % y + c % z}) `;; + +let affprops_3_0 = prove(affprops_3_0_goal, + REWRITE_TAC[AFFINE_HULL_3] THEN SET_TAC[]);; + + let affprops_lt_2_1_goal = ` (!v1 v2 v3. + DISJOINT {v2,v3} {v1} ==> aff_lt {v2, v3} {v1} = + {x | ?t2 t3 t1. + t2 + t3 + t1 = &1 /\ + t1 < &0 /\ + x = t2 % v2 + t3 % v3 + t1 % v1}) `;; + +let affpropos_lt_2_1 = prove(affprops_lt_2_1_goal,AFF_SGN_TAC);; + + + let affprops_goal = `(!a b v0. + DISJOINT {a,b} {v0} ==> aff_gt {a, b} {v0} = + {x | ?ta tb t. + ta + tb + t = &1 /\ &0 < t /\ x = ta % a + tb % b + t % v0} /\ + aff_ge {a, b} {v0} = + {x | ?ta tb t. + ta + tb + t = &1 /\ + &0 <= t /\ + x = ta % a + tb % b + t % v0}) /\ + (!x y z. + conv0 {x, y, z} = + {t | ?a b c. + a + b + c = &1 /\ + &0 < a /\ + &0 < b /\ + &0 < c /\ + t = a % x + b % y + c % z}) /\ + (!x y z. + affine hull {x, y, z} = + {t | ?a b c. a + b + c = &1 /\ t = a % x + b % y + c % z})/\ + (!v1 v2 v3. + DISJOINT {v2,v3} {v1} ==> aff_lt {v2, v3} {v1} = + {x | ?t2 t3 t1. + t2 + t3 + t1 = &1 /\ + t1 < &0 /\ + x = t2 % v2 + t3 % v3 + t1 % v1}) `;; + +let affprops = prove(affprops_goal, + REWRITE_TAC[affprops_0_3;affprops_3_0 ;affpropos_lt_2_1] THEN + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[affprops_2_1;affprops_ge_2_1]);; + + +end;; diff --git a/text_formalization/leg/basics.hl b/text_formalization/leg/basics.hl new file mode 100644 index 0000000..a51fd56 --- /dev/null +++ b/text_formalization/leg/basics.hl @@ -0,0 +1,518 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Author: Thomas C. Hales *) +(* Date: 2013-02-11 *) +(* ========================================================================== *) + +(* General lemmas *) + + + + +module Basics = struct + + open Hales_tactic;; + +(* SECTION: LOGIC *) + +let BETA_ORDERED_PAIR_THM = prove_by_refinement( + `!(g:A->B->C) x. + ((\ ( u, v). g u v) x = g (FST x) (SND x))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + INTRO_TAC (GSYM PAIR) [`x`]; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[GABS_DEF;GEQ_DEF]) + ]);; + (* }}} *) + +(* SECTION: SETS *) + +let SURJ_IMAGE = prove_by_refinement( + `!(f:A->B) a b. SURJ f a b ==> (b = (IMAGE f a))`, +(* {{{ proof *) + [ + REWRITE_TAC[SURJ;IMAGE]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[EXTENSION;IN_ELIM_THM]; + BY(ASM_MESON_TAC[]) + ] +(* }}} *) +);; + +let SURJ_FINITE = prove_by_refinement( + `!a b (f:A->B). FINITE a /\ (SURJ f a b) ==> FINITE b`, +(* {{{ *) + [ + ASM_MESON_TAC[SURJ_IMAGE;FINITE_IMAGE] + ]);; +(* }}} *) + +let BIJ_INVERSE = prove_by_refinement( + `!a b (f:A->B). (SURJ f a b) ==> (?(g:B->A). (INJ g b a))`, +(* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!y. ?u. ((y IN b) ==> ((u IN a) /\ ((f:A->B) u = y)))` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[SURJ]); + FIRST_X_ASSUM (MP_TAC o (REWRITE_RULE[SKOLEM_THM])); + REPEAT WEAKER_STRIP_TAC; + EXISTS_TAC `u:B->A`; + REWRITE_TAC[INJ]; + BY(ASM_MESON_TAC[]) + ] +(* }}} *) +);; + +let BIJ_SUM = prove_by_refinement( + `!(A:A->bool) (B:B->bool) f ab. + BIJ ab A B ==> (sum A (f o ab) = sum B f)`, + (* {{{ proof *) + [ + REWRITE_TAC[BIJ;INJ]; + BY(ASM_MESON_TAC[ SUM_IMAGE ; SURJ_IMAGE ]) + ]);; + (* }}} *) + +(* SECTION: LISTS *) + +let EL_EXPLICIT = prove_by_refinement( + `!h t. EL 0 (CONS (h:a) t) = h /\ + EL 1 (CONS h t) = EL 0 t /\ + EL 2 (CONS h t) = EL 1 t /\ + EL 3 (CONS h t) = EL 2 t /\ + EL 4 (CONS h t) = EL 3 t /\ + EL 5 (CONS h t) = EL 4 t /\ + EL 6 (CONS h t) = EL 5 t`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[EL;HD;TL;arith `6 = SUC 5 /\ 5 = SUC 4 /\ 4 = SUC 3 /\ 3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]) + ]);; + (* }}} *) + +let LENGTH1 = prove_by_refinement( + `!ul:(A) list. LENGTH ul = 1 ==> ul = [EL 0 ul]`, + (* {{{ proof *) + [ + REWRITE_TAC[LENGTH_EQ_CONS;arith `1 = SUC 0`;LENGTH_EQ_NIL]; + REPEAT WEAK_STRIP_TAC; + BY(ASM_REWRITE_TAC[EL;HD]) + ]);; + (* }}} *) + +let LENGTH2 = prove_by_refinement( + `!ul:(A) list. LENGTH ul = 2 ==> ul = [EL 0 ul;EL 1 ul]`, + (* {{{ proof *) + [ + REWRITE_TAC[LENGTH_EQ_CONS;arith `2 = SUC 1`]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (unlist ONCE_REWRITE_TAC o (MATCH_MP LENGTH1)); + BY(REWRITE_TAC[EL;HD;arith `1 = SUC 0`;TL]) + ]);; + (* }}} *) + +let LENGTH3 = prove_by_refinement( + `!(ul:(A)list). LENGTH ul = 3 ==> ul = [EL 0 ul; EL 1 ul; EL 2 ul]`, + (* {{{ proof *) + [ + REWRITE_TAC[LENGTH_EQ_CONS;arith `3 = SUC 2`]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (unlist ONCE_REWRITE_TAC o (MATCH_MP LENGTH2)); + BY(REWRITE_TAC[EL;HD;arith `1 = SUC 0`;arith `2 = SUC 1`;TL]) + ]);; + (* }}} *) + +let LENGTH4 = prove_by_refinement( + `!(ul:(A)list). LENGTH ul = 4 ==> ul = [EL 0 ul; EL 1 ul; EL 2 ul; EL 3 ul]`, + (* {{{ proof *) + [ + REWRITE_TAC[LENGTH_EQ_CONS;arith `4 = SUC 3`]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (unlist ONCE_REWRITE_TAC o (MATCH_MP LENGTH3)); + BY(REWRITE_TAC[EL;HD;arith `1 = SUC 0`;arith `2 = SUC 1`;arith `3 = SUC 2`;TL]) + ]);; + (* }}} *) + +let set_of_list2_explicit = prove_by_refinement( + `!(a:A) b. set_of_list [a;b] = {a,b}`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[set_of_list]) + ]);; + (* }}} *) + +let set_of_list2 = prove_by_refinement( + `!(ul:(A) list). LENGTH ul = 2 ==> set_of_list ul = {EL 0 ul, EL 1 ul}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP LENGTH2)); + ABBREV_TAC `a:A = EL 0 ul`; + ABBREV_TAC `b:A = EL 1 ul`; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[set_of_list]) + ]);; + (* }}} *) + +let set_of_list3_explicit = prove_by_refinement( + `!(a:A) b c. set_of_list [a;b;c] = {a,b,c}`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[set_of_list]) + ]);; + (* }}} *) + +let set_of_list3 = prove_by_refinement( + `!(ul:(A) list). LENGTH ul = 3 ==> set_of_list ul = {EL 0 ul, EL 1 ul, EL 2 ul}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP LENGTH3)); + ABBREV_TAC `a:A = EL 0 ul`; + ABBREV_TAC `b:A = EL 1 ul`; + ABBREV_TAC `c:A = EL 2 ul`; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[set_of_list]) + ]);; + (* }}} *) + +let set_of_list4_explicit = prove_by_refinement( + `!(a:A) b c d. set_of_list [a;b;c;d] = {a,b,c,d}`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[set_of_list]) + ]);; + (* }}} *) + +let set_of_list4 = prove_by_refinement( + `!(ul:(A) list). LENGTH ul = 4 ==> set_of_list ul = {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP LENGTH4)); + ABBREV_TAC `a:A = EL 0 ul`; + ABBREV_TAC `b:A = EL 1 ul`; + ABBREV_TAC `c:A = EL 2 ul`; + ABBREV_TAC `d:A = EL 3 ul`; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[set_of_list]) + ]);; + (* }}} *) + +let INITIAL_SUBLIST_NIL = prove(`!(zl:(A)list). initial_sublist [] zl`, + REWRITE_TAC[Sphere.INITIAL_SUBLIST; APPEND] THEN MESON_TAC[]);; + +let INITIAL_SUBLIST_CONS = prove_by_refinement( + `!(a:A) b x y. initial_sublist (CONS a x) (CONS b y) <=> (a = b) /\ initial_sublist x y`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.INITIAL_SUBLIST]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[APPEND]; + REWRITE_TAC[CONS_11]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let INITIAL_SUBLIST_TRANS = prove(`!(xl:(A)list) yl zl. initial_sublist xl yl /\ initial_sublist yl zl ==> initial_sublist xl zl`, + REWRITE_TAC[Sphere.INITIAL_SUBLIST] THEN + REPEAT STRIP_TAC THEN + ASM_MESON_TAC[APPEND_ASSOC]);; + + +(* truncate simplex *) + + +let BUTLAST_INITIAL_SUBLIST = prove(`!ul:(A)list. 1 <= LENGTH ul ==> initial_sublist (BUTLAST ul) ul`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPEC `ul:(A)list` APPEND_BUTLAST_LAST) THEN + REWRITE_TAC[GSYM LENGTH_EQ_NIL] THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= a ==> ~(a = 0)`] THEN + REWRITE_TAC[Sphere.INITIAL_SUBLIST] THEN + DISCH_TAC THEN + EXISTS_TAC `[LAST ul:A]` THEN + ASM_REWRITE_TAC[]);; + +let LENGTH_BUTLAST = prove(`!ul:(A)list. 1 <= LENGTH ul ==> LENGTH (BUTLAST ul) = LENGTH ul - 1`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPEC `ul:(A)list` APPEND_BUTLAST_LAST) THEN + REWRITE_TAC[GSYM LENGTH_EQ_NIL] THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= a ==> ~(a = 0)`] THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [GSYM th]) THEN + REWRITE_TAC[LENGTH_APPEND; LENGTH] THEN + ARITH_TAC);; + +let LENGTH_IMP_CONS = prove(`!l:(A)list. 1 <= LENGTH l ==> ?h t. l = CONS h t`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`l:(A)list`; `PRE (LENGTH (l:(A)list))`] LENGTH_EQ_CONS) THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= n ==> SUC (PRE n) = n`] THEN + STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`h:A`; `t:(A)list`] THEN + ASM_REWRITE_TAC[]);; + +let INITIAL_SUBLIST_REFL = prove(`!ul. initial_sublist ul ul`, MESON_TAC[Sphere.INITIAL_SUBLIST; APPEND_NIL]);; + +let TRUNCATE_SIMPLEX_EXISTS = prove_by_refinement( + `!k ul:(A)list. k+1 <= LENGTH ul ==> (?vl. + LENGTH vl = k+1 /\ initial_sublist vl ul)`, + (* {{{ proof *) + [ + TYPIFY `!r k (ul:(A)list). k + 1 <= LENGTH ul /\ LENGTH ul = r ==> (?vl. LENGTH vl = k + 1 /\ initial_sublist vl ul)` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[]); + INDUCT_TAC; + REPEAT WEAKER_STRIP_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `SUC r = k + 1` ASM_CASES_TAC; + TYPIFY `ul` EXISTS_TAC; + REWRITE_TAC[INITIAL_SUBLIST_REFL]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`k`;`BUTLAST ul`]); + ANTS_TAC; + INTRO_TAC LENGTH_BUTLAST [`ul`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `vl` EXISTS_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC INITIAL_SUBLIST_TRANS; + TYPIFY `BUTLAST ul` EXISTS_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC BUTLAST_INITIAL_SUBLIST; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC) + ]);; + (* }}} *) + +let TRUNCATE_SIMPLEX_PROP = prove_by_refinement( + `!k ul:(A)list. k + 1 <= LENGTH ul ==> + LENGTH (truncate_simplex k ul) = k + 1 /\ initial_sublist (truncate_simplex k ul) ul`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC TRUNCATE_SIMPLEX_EXISTS [`k`;`ul`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Sphere.TRUNCATE_SIMPLEX]; + SELECT_TAC THEN ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let LENGTH_TRUNCATE_SIMPLEX = prove_by_refinement( + `!k ul. k + 1 <= LENGTH ul ==> LENGTH (truncate_simplex k ul) = k + 1`, + (* {{{ proof *) + [ + BY(ASM_MESON_TAC[TRUNCATE_SIMPLEX_PROP]) + ]);; + (* }}} *) + +let INITIAL_SUBLIST_OF_NIL = prove_by_refinement( + `!ul:(A) list. initial_sublist ul [] <=> (ul = [])`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.INITIAL_SUBLIST]; + BY(MESON_TAC[APPEND_EQ_NIL]) + ]);; + (* }}} *) + +let INITIAL_SUBLIST_INJ = prove_by_refinement( + `!ul:(A) list vl wl. LENGTH ul = LENGTH vl /\ initial_sublist ul wl /\ initial_sublist vl wl ==> + (ul = vl)`, + (* {{{ proof *) + [ + TYPIFY `!k (ul:(A) list) vl wl. k = LENGTH ul /\ k = LENGTH vl /\ initial_sublist ul wl /\ initial_sublist vl wl ==> (ul = vl)` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[]); + INDUCT_TAC; + BY(MESON_TAC[LENGTH_EQ_NIL]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC LENGTH_IMP_CONS [`ul`]; + INTRO_TAC LENGTH_IMP_CONS [`vl`]; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + STRIP_TAC; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + STRIP_TAC; + TYPIFY `LENGTH wl = 0` ASM_CASES_TAC; + BY(ASM_MESON_TAC[LENGTH_EQ_NIL;INITIAL_SUBLIST_OF_NIL;NOT_CONS_NIL]); + INTRO_TAC LENGTH_IMP_CONS [`wl`]; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[CONS_11]; + PROOF_BY_CONTR_TAC; + REPEAT (FIRST_X_ASSUM_ST `initial_sublist` MP_TAC); + ASM_REWRITE_TAC[INITIAL_SUBLIST_CONS]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t`;`t'`;`t''`]); + ANTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `LENGTH` MP_TAC); + ASM_REWRITE_TAC[LENGTH;SUC_INJ]; + BY(MESON_TAC[]); + DISCH_TAC; + FIRST_X_ASSUM_ST `~` MP_TAC; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let TRUNCATE_SIMPLEX_UNIQUE = prove_by_refinement( + `!k ul:(A) list vl. k+1 <= LENGTH ul /\ LENGTH vl = k+ 1 /\ initial_sublist vl ul ==> + vl = truncate_simplex k ul`, + (* {{{ proof *) + [ + BY(ASM_MESON_TAC[INITIAL_SUBLIST_INJ;TRUNCATE_SIMPLEX_PROP]) + ]);; + (* }}} *) + +let INITIAL_SUBLIST_LENGTH_LE = prove_by_refinement( + `!xl:(A)list zl. initial_sublist xl zl ==> LENGTH xl <= LENGTH zl`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.INITIAL_SUBLIST]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[LENGTH_APPEND]; + BY(ARITH_TAC) + ]);; + (* }}} *) + +let TRUNCATE_SIMPLEX_INITIAL_SUBLIST = prove_by_refinement( + `!k (xl:(A)list) zl. + truncate_simplex k zl = xl /\ k + 1 <= LENGTH zl <=> + initial_sublist xl zl /\ LENGTH xl = k + 1`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (TAUT `((a ==> b) /\ (b ==> a)) ==> (a = b)`); + CONJ_TAC; + BY(ASM_MESON_TAC[TRUNCATE_SIMPLEX_PROP]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC TRUNCATE_SIMPLEX_PROP [`k`;`zl`]; + ANTS_TAC; + BY(ASM_MESON_TAC[INITIAL_SUBLIST_LENGTH_LE]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `k + 1 <= LENGTH zl` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[INITIAL_SUBLIST_LENGTH_LE]); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC EQ_SYM; + MATCH_MP_TAC TRUNCATE_SIMPLEX_UNIQUE; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let TRUNCATE_SIMPLEX0 = prove_by_refinement( + `!(x:A) y. truncate_simplex 0 (CONS x y) = [x]`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC TRUNCATE_SIMPLEX_INITIAL_SUBLIST [`0`;`[x]`;`(CONS x y)`]; + REWRITE_TAC[LENGTH (* _CONS *);INITIAL_SUBLIST_CONS;INITIAL_SUBLIST_NIL]; + BY(REWRITE_TAC[arith `SUC 0 = 0 + 1`;arith `0 + 1 <= SUC i`]) + ]);; + (* }}} *) + +let LENGTH_TRUNCATE_SIMPLEX = prove_by_refinement( + `!k (ul:(A)list). SUC k <= LENGTH ul ==> LENGTH (truncate_simplex k ul) = SUC k`, + (* {{{ proof *) + [ + BY(ASM_MESON_TAC[LENGTH_TRUNCATE_SIMPLEX;arith `SUC k = k + 1`]) + ]);; + (* }}} *) + +let TRUNCATE_SIMPLEX_CONS = prove_by_refinement( + `!(x:A) y k. SUC k <= LENGTH y ==> truncate_simplex (SUC k) (CONS x y) = CONS x (truncate_simplex k y)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC TRUNCATE_SIMPLEX_INITIAL_SUBLIST [`SUC k`;`CONS x (truncate_simplex k y)`;`(CONS x y)`]; + REWRITE_TAC[LENGTH (* _CONS *);INITIAL_SUBLIST_CONS]; + ASM_SIMP_TAC[arith `SUC k <= n ==> SUC k + 1 <= SUC n`]; + ASM_SIMP_TAC[ LENGTH_TRUNCATE_SIMPLEX]; + DISCH_THEN kill; + REWRITE_TAC[arith `SUC (SUC k) = SUC k + 1`]; + INTRO_TAC TRUNCATE_SIMPLEX_INITIAL_SUBLIST [`k`;`truncate_simplex k y`;`y`]; + BY(ASM_SIMP_TAC[LENGTH_TRUNCATE_SIMPLEX;arith `k+1 = SUC k`]) + ]);; + (* }}} *) + +let TRUNCATE_SIMPLEX_EXPLICIT = prove_by_refinement( + `!(x1:A) x2 x3 x4. truncate_simplex 3 [x1;x2;x3;x4] = [x1;x2;x3;x4] /\ + truncate_simplex 2 [x1;x2;x3;x4] = [x1;x2;x3] /\ + truncate_simplex 2 [x1;x2;x3] = [x1;x2;x3] /\ + truncate_simplex 1 [x1;x2;x3;x4] = [x1;x2] /\ + truncate_simplex 1 [x1;x2;x3] = [x1;x2] /\ + truncate_simplex 1 [x1;x2] = [x1;x2]`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]; + REPEAT (GMATCH_SIMP_TAC TRUNCATE_SIMPLEX_CONS); + REWRITE_TAC[LENGTH;TRUNCATE_SIMPLEX0]; + BY(ARITH_TAC) + ]);; + (* }}} *) + +let ADD_C_UNIV = prove_by_refinement( + `(:A) +_c (:B) = (:A+B)`, + (* {{{ proof *) + [ + REWRITE_TAC[add_c]; + REWRITE_TAC[EXTENSION;IN_UNION;IN_UNIV;IN_ELIM_THM]; + BY(MESON_TAC[sum_CASES]) + ]);; + (* }}} *) + +let SUM_HAS_SIZE = prove_by_refinement( + `!a b. (:A) HAS_SIZE a /\ (:B) HAS_SIZE b ==> + (:A+B) HAS_SIZE (a+b)`, + (* {{{ proof *) + [ + REWRITE_TAC[HAS_SIZE]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[GSYM ADD_C_UNIV]; + CONJ2_TAC; + BY(ASM_MESON_TAC[CARD_ADD_C]); + BY(ASM_MESON_TAC[CARD_ADD_FINITE]) + ]);; + (* }}} *) + +let DIMINDEX_4 = prove_by_refinement( + `dimindex(:2 + 2) = 4`, + (* {{{ proof *) + [ + MATCH_MP_TAC DIMINDEX_UNIQUE; + REWRITE_TAC[arith `4 = 2+ 2`]; + MATCH_MP_TAC SUM_HAS_SIZE; + BY(REWRITE_TAC[HAS_SIZE_2]) + ]);; + (* }}} *) + +let DIMINDEX_5 = prove_by_refinement( + `dimindex(:2 + 3) = 5`, + (* {{{ proof *) + [ + MATCH_MP_TAC DIMINDEX_UNIQUE; + REWRITE_TAC[arith `5 = 2+ 3`]; + REPEAT (GMATCH_SIMP_TAC SUM_HAS_SIZE); + BY(REWRITE_TAC[HAS_SIZE_2;HAS_SIZE_3]) + ]);; + (* }}} *) + +let DIMINDEX_6 = prove_by_refinement( + `dimindex(:3 + 3) = 6`, + (* {{{ proof *) + [ + MATCH_MP_TAC DIMINDEX_UNIQUE; + REWRITE_TAC[arith `6 = 3+ 3`]; + REPEAT (GMATCH_SIMP_TAC SUM_HAS_SIZE); + BY(REWRITE_TAC[HAS_SIZE_2;HAS_SIZE_3]) + ]);; + (* }}} *) + + +end;; diff --git a/text_formalization/leg/cayleyR_def.hl b/text_formalization/leg/cayleyR_def.hl new file mode 100644 index 0000000..5a2fe7c --- /dev/null +++ b/text_formalization/leg/cayleyR_def.hl @@ -0,0 +1,106 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Definition: cayleyR *) +(* Chapter: LEG *) +(* Author: Thomas C. Hales *) +(* Date: 2010-02-07 *) +(* ========================================================================== *) + + + + +(* +This is the 5 vertex Cayley-Menger determinant +EDSFZOT +NUHSVLM +See http://www.math.pitt.edu/~thales/papers/Lemmas_Elementary_Geometry.pdf +Properties of cayleyR have been formalized by Nguyen Quang Truong +*) + + + +module type Cayleyr_def_type = sig + val cayleyR : thm + val cayleyR_quadratic : thm +end;; + + +module Cayleyr : Cayleyr_def_type = struct + + + let cayleyR = +new_definition `cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 = + -- (x14*x14*x23*x23) + &2 *x14*x15*x23*x23 - x15*x15*x23*x23 + &2 *x13*x14*x23*x24 - &2 *x13*x15*x23*x24 - &2 *x14*x15*x23*x24 + + &2 *x15*x15*x23*x24 - x13*x13*x24*x24 + &2 *x13*x15*x24*x24 - x15*x15*x24*x24 - &2 *x13*x14*x23*x25 + + &2 *x14*x14*x23*x25 + &2 *x13*x15*x23*x25 - &2 *x14*x15*x23*x25 + &2 *x13*x13*x24*x25 - &2 *x13*x14*x24*x25 - &2 *x13*x15*x24*x25 + + &2 *x14*x15*x24*x25 - x13*x13*x25*x25 + &2 *x13*x14*x25*x25 - x14*x14*x25*x25 + &2 *x12*x14*x23*x34 - &2 *x12*x15*x23*x34 - + &2 *x14*x15*x23*x34 + &2 *x15*x15*x23*x34 + &2 *x12*x13*x24*x34 - &2 *x12*x15*x24*x34 - &2 *x13*x15*x24*x34 + &2 *x15*x15*x24*x34 + + &4 *x15*x23*x24*x34 - &2 *x12*x13*x25*x34 - &2 *x12*x14*x25*x34 + &4 *x13*x14*x25*x34 + &4 *x12*x15*x25*x34 - &2 *x13*x15*x25*x34 - &2 *x14*x15*x25*x34 - + &2 *x14*x23*x25*x34 - &2 *x15*x23*x25*x34 - &2 *x13*x24*x25*x34 - &2 *x15*x24*x25*x34 + &2 *x13*x25*x25*x34 + &2 *x14*x25*x25*x34 - + x12*x12*x34*x34 + &2 *x12*x15*x34*x34 - x15*x15*x34*x34 + &2 *x12*x25*x34*x34 + &2 *x15*x25*x34*x34 - + x25*x25*x34*x34 - &2 *x12*x14*x23*x35 + &2 *x14*x14*x23*x35 + &2 *x12*x15*x23*x35 - &2 *x14*x15*x23*x35 - &2 *x12*x13*x24*x35 + + &4 *x12*x14*x24*x35 - &2 *x13*x14*x24*x35 - &2 *x12*x15*x24*x35 + &4 *x13*x15*x24*x35 - &2 *x14*x15*x24*x35 - &2 *x14*x23*x24*x35 - &2 *x15*x23*x24*x35 + + &2 *x13*x24*x24*x35 + &2 *x15*x24*x24*x35 + &2 *x12*x13*x25*x35 - &2 *x12*x14*x25*x35 - &2 *x13*x14*x25*x35 + &2 *x14*x14*x25*x35 + + &4 *x14*x23*x25*x35 - &2 *x13*x24*x25*x35 - &2 *x14*x24*x25*x35 + &2 *x12*x12*x34*x35 - &2 *x12*x14*x34*x35 - &2 *x12*x15*x34*x35 + + &2 *x14*x15*x34*x35 - &2 *x12*x24*x34*x35 - &2 *x15*x24*x34*x35 - &2 *x12*x25*x34*x35 - &2 *x14*x25*x34*x35 + &2 *x24*x25*x34*x35 - + x12*x12*x35*x35 + &2 *x12*x14*x35*x35 - x14*x14*x35*x35 + &2 *x12*x24*x35*x35 + &2 *x14*x24*x35*x35 - + x24*x24*x35*x35 + &4 *x12*x13*x23*x45 - &2 *x12*x14*x23*x45 - &2 *x13*x14*x23*x45 - &2 *x12*x15*x23*x45 - &2 *x13*x15*x23*x45 + + &4 *x14*x15*x23*x45 + &2 *x14*x23*x23*x45 + &2 *x15*x23*x23*x45 - &2 *x12*x13*x24*x45 + &2 *x13*x13*x24*x45 + &2 *x12*x15*x24*x45 - + &2 *x13*x15*x24*x45 - &2 *x13*x23*x24*x45 - &2 *x15*x23*x24*x45 - &2 *x12*x13*x25*x45 + &2 *x13*x13*x25*x45 + &2 *x12*x14*x25*x45 - + &2 *x13*x14*x25*x45 - &2 *x13*x23*x25*x45 - &2 *x14*x23*x25*x45 + &4 *x13*x24*x25*x45 + &2 *x12*x12*x34*x45 - &2 *x12*x13*x34*x45 - + &2 *x12*x15*x34*x45 + &2 *x13*x15*x34*x45 - &2 *x12*x23*x34*x45 - &2 *x15*x23*x34*x45 - &2 *x12*x25*x34*x45 - &2 *x13*x25*x34*x45 + &2 *x23*x25*x34*x45 + + &2 *x12*x12*x35*x45 - &2 *x12*x13*x35*x45 - &2 *x12*x14*x35*x45 + &2 *x13*x14*x35*x45 - &2 *x12*x23*x35*x45 - &2 *x14*x23*x35*x45 - + &2 *x12*x24*x35*x45 - &2 *x13*x24*x35*x45 + &2 *x23*x24*x35*x45 + &4 *x12*x34*x35*x45 - x12*x12*x45*x45 + &2 *x12*x13*x45*x45 - + x13*x13*x45*x45 + &2 *x12*x23*x45*x45 + &2 *x13*x23*x45*x45 - x23*x23*x45*x45` ;; + +let cayleyR_quadratic = prove( `cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 = + \ x45 . + ( let a = (((-- &1) * (x12 pow 2)) + (((-- &1) * ((x13 + ((-- &1) * x23)) pow 2)) + +(&2 * (x12 * (x13 + x23))))) in + let b = (&2 * (((x13 pow 2) * (x24 + x25)) + (((x12 pow 2) * (x34 + x35)) + ((x23 * +((x15 * (x23 + (((-- &1) * x24) + ((-- &1) * x34)))) + ((x25 * x34) + ((x14 * +((&2 * x15) + (x23 + (((-- &1) * x25) + ((-- &1) * x35))))) + (x24 * x35))))) ++ (((-- &1) * (x13 * ((x23 * x24) + ((x23 * x25) + (((-- &2) * (x24 * x25)) + +((x15 * (x23 + (x24 + ((-- &1) * x34)))) + ((x25 * x34) + ((x14 * (x23 + (x25 ++ ((-- &1) * x35)))) + (x24 * x35))))))))) + (x12 * ((&2 * (x13 * x23)) + +(((-- &1) * (x14 * x23)) + (((-- &1) * (x15 * x23)) + (((-- &1) * (x13 * +x24)) + ((x15 * x24) + (((-- &1) * (x13 * x25)) + ((x14 * x25) + (((-- &1) * +(x13 * x34)) + (((-- &1) * (x15 * x34)) + (((-- &1) * (x23 * x34)) + (((-- +&1) * (x25 * x34)) + (((-- &1) * (x13 * x35)) + (((-- &1) * (x14 * x35)) + +(((-- &1) * (x23 * x35)) + (((-- &1) * (x24 * x35)) + (&2 * (x34 * +x35))))))))))))))))))))))) in + let c = (((-- &1) * ((x15 pow 2) * ((x23 pow 2) + (((x24 + ((-- &1) * x34)) pow 2) + +((-- &2) * (x23 * (x24 + x34))))))) + (((-- &1) * (((x13 * x24) + (((-- &1) * +(x13 * x25)) + (((-- &1) * (x12 * x34)) + ((x25 * x34) + ((x12 * x35) + ((-- +&1) * (x24 * x35))))))) pow 2)) + (((-- &1) * ((x14 pow 2) * ((x23 pow 2) + +(((x25 + ((-- &1) * x35)) pow 2) + ((-- &2) * (x23 * (x25 + x35))))))) + +(((-- &2) * (x15 * (((-- &2) * (x23 * (x24 * x34))) + ((x23 * (x25 * x34)) + +((x24 * (x25 * x34)) + (((-- &1) * (x25 * (x34 pow 2))) + ((x13 * (((-- &1) * +(x24 pow 2)) + ((x23 * (x24 + ((-- &1) * x25))) + ((x25 * x34) + (x24 * (x25 ++ (x34 + ((-- &2) * x35)))))))) + ((x23 * (x24 * x35)) + (((-- &1) * ((x24 pow 2) +* x35)) + ((x24 * (x34 * x35)) + (x12 * ((x23 * (x34 + ((-- &1) * x35))) ++ ((x34 * (((-- &2) * x25) + (((-- &1) * x34) + x35))) + (x24 * (x34 + +x35))))))))))))))) + (&2 * (x14 * ((x12 * (x23 * x34)) + (((-- &1) * (x12 * +(x25 * x34))) + (((-- &1) * (x23 * (x25 * x34))) + (((x25 pow 2) * x34) + +(((-- &1) * (x12 * (x23 * x35))) + ((&2 * (x12 * (x24 * x35))) + (((-- &1) * +(x23 * (x24 * x35))) + (((-- &1) * (x12 * (x25 * x35))) + ((&2 * (x23 * (x25 +* x35))) + (((-- &1) * (x24 * (x25 * x35))) + (((-- &1) * (x12 * (x34 * +x35))) + (((-- &1) * (x25 * (x34 * x35))) + ((x12 * (x35 pow 2)) + ((x24 * (x35 +pow 2)) + ((x13 * ((x23 * (x24 + ((-- &1) * x25))) + ((x25 * (x25 + ((&2 * +x34) + ((-- &1) * x35)))) + ((-- &1) * (x24 * (x25 + x35)))))) + (x15 * ((x23 +pow 2) + (((x24 + ((-- &1) * x34)) * (x25 + ((-- &1) * x35))) + ((-- &1) * +(x23 * (x24 + (x25 + (x34 + x35))))))))))))))))))))))))))))) in + (a * x45 pow 2 + b * x45 + c))`, + (ONCE_REWRITE_TAC[FUN_EQ_THM]) THEN + BETA_TAC THEN + ( REWRITE_TAC[cayleyR]) THEN + (REPEAT LET_TAC) THEN + (EXPAND_TAC "a") THEN + (EXPAND_TAC "b") THEN + (EXPAND_TAC "c") THEN + (ARITH_TAC));; + + +end;; + diff --git a/text_formalization/leg/collect_geom.hl b/text_formalization/leg/collect_geom.hl new file mode 100644 index 0000000..f1fdbf1 --- /dev/null +++ b/text_formalization/leg/collect_geom.hl @@ -0,0 +1,2775 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: leg *) +(* Author: Nguyen Quang Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + +flyspeck_needs "general/sphere.hl";; +flyspeck_needs "leg/geomdetail.hl";; +flyspeck_needs "leg/affprops.hl";; +flyspeck_needs "leg/cayleyR_def.hl";; + +module Collect_geom = struct + +(* + +thales: +global replace rho->rho_x + +This file gives an alternative def of rho_ij, delta, chi. +These should be reconciled with main flyspeck library + + +*) + + let packing = Sphere.packing;; + let eta_x = Sphere.eta_x;; + let eta_y = Sphere.eta_y;; + let aff = Sphere.aff;; (* also appears in Geomdetail *) + let line = Sphere.line;; + let circumcenter = Sphere.circumcenter;; + let radV = Sphere.radV;; + + let conv = Geomdetail.conv;; + let CONV0_SET2 = Geomdetail.CONV0_SET2;; + let OR_IMP_EX = Geomdetail.OR_IMP_EX;; + let CONV_SET3 = Geomdetail.CONV_SET3;; + let INTERS_SUBSET = Geomdetail.INTERS_SUBSET;; + let DOT_SUB_ADD = Geomdetail.DOT_SUB_ADD;; + let trg_dist3_sym = Geomdetail.trg_dist3_sym;; + let DIST_LT_HALF_PLANE = Geomdetail.DIST_LT_HALF_PLANE;; + + let simp_def2 = Affprops.affprops;; + + let cayleyR = Cayleyr.cayleyR;; + + let BY = Hales_tactic.BY;; + +prioritize_real();; + +(* dist3 is deprecated *) +let dist3 = new_definition `dist3 (v:real^3) w = dist(v,w)`;; + +let ups_x = new_definition ` ups_x x1 x2 x6 = + --x1 * x1 - x2 * x2 - x6 * x6 + + &2 * x1 * x6 + + &2 * x1 * x2 + + &2 * x2 * x6 `;; + +(* +let rho_ij = new_definition ` rho_ij (x12 :real) x13 x14 x23 x24 x34 = + --(x14 * x14 * x23 * x23) - + x13 * x13 * x24 * x24 - + x12 * x12 * x34 * x34 + + &2 * + (x12 * x14 * x23 * x34 + + x12 * x13 * x24 * x34 + + x13 * x14 * x23 * x24) `;; +*) + +let rho_ij'_rho_x = new_definition `rho_ij' x1 x2 x3 x6 x5 x4 = rho_x x1 x2 x3 x4 x5 x6`;; + +let rho_ij' = prove_by_refinement( + `!x12 x34 x13 x14 x23 x24. rho_ij' (x12 :real) x13 x14 x23 x24 x34 = + --(x14 * x14 * x23 * x23) - + x13 * x13 * x24 * x24 - + x12 * x12 * x34 * x34 + + &2 * + (x12 * x14 * x23 * x34 + + x12 * x13 * x24 * x34 + + x13 * x14 * x23 * x24)`, + (* {{{ proof *) + [ + (REWRITE_TAC[rho_ij'_rho_x;Sphere.rho_x]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let chi = new_definition ` chi x12 x13 x14 x23 x24 x34 = + x13 * x23 * x24 + + x14 * x23 * x24 + + x12 * x23 * x34 + + x14 * x23 * x34 + + x12 * x24 * x34 + + x13 * x24 * x34 - + &2 * x23 * x24 * x34 - + x12 * x34 * x34 - + x14 * x23 * x23 - + x13 * x24 * x24 `;; + +let delta = new_definition ` delta x12 x13 x14 x23 x24 x34 = + --(x12 * x13 * x23) - + x12 * x14 * x24 - + x13 * x14 * x34 - + x23 * x24 * x34 + + x12 * x34 * (--x12 + x13 + x14 + x23 + x24 - x34) + + x13 * x24 * (x12 - x13 + x14 + x23 - x24 + x34 ) + + x14 * x23 * ( x12 + x13 - x14 - x23 + x24 + x34 ) `;; + +let eta_v = new_definition ` eta_v v1 v2 (v3: real^N) = + let e1 = dist (v2, v3) in + let e2 = dist (v1, v3) in + let e3 = dist (v2, v1) in + e1 * e2 * e3 / sqrt ( ups_x (e1 pow 2 ) ( e2 pow 2) ( e3 pow 2 ) ) `;; + +let max_real = new_definition(`max_real x y = + if (y < x) then x else y`);; + +let max_real3 = new_definition ` max_real3 x y z = max_real (max_real x y ) z `;; + +let ups_x_pow2 = new_definition` ups_x_pow2 x y z = ups_x ( x*x ) ( y * y) ( z * z)`;; + +let plane_norm = new_definition ` + plane_norm p <=> + (?n v0. ~(n = vec 0) /\ p = {v | n dot (v - v0) = &0}) `;; + + +let delta_x34 = new_definition ` delta_x34 x12 x13 x14 x23 x24 x34 = +-- &2 * x12 * x34 + +(--x13 * x14 + + --x23 * x24 + + x13 * x24 + + x14 * x23 + + --x12 * x12 + + x12 * x14 + + x12 * x24 + + x12 * x13 + + x12 * x23) `;; + + +(* +let plane_3p = new_definition `plane_3p (a:real^3) b c = + {x | ~collinear {a, b, c} /\ + (?ta tb tc. ta + tb + tc = &1 /\ x = ta % a + tb % b + tc % c)}`;; +*) + +(* end new_definition *) + +(* NGUYEN DUC PHUONG *) +(* Definition of Cayley – Menger square cm3 *) + + +let cm3_ups_x = new_definition `!(v1:real^3) (v2:real^3) (v3:real^3). + cm3_ups_x v1 v2 v3 = + (((v2 - v1)$2 * (v3 - v1)$3 ) - ((v2 - v1)$3 * (v3 - v1)$2)) pow 2 + + (((v2 - v1)$3 * (v3 - v1)$1 ) - ((v2 - v1)$1 * (v3 - v1)$3)) pow 2 + + (((v2 - v1)$1 * (v3 - v1)$2 ) - ((v2 - v1)$2 * (v3 - v1)$1)) pow 2 `;; + + +(* Nguyen Tuyen Hoang, Nguyen Duc Phuong *) + +(* The polynomial ups can be expressed as a Cayley- Menger square *) + +let lemma_cm3 = prove (`!(x:real^3) y. +(x-y)$1 = x$1 - y$1 /\ (x-y)$2 = x$2 - y$2 /\ (x-y)$3 = x$3 - y$3`, + +(REPEAT GEN_TAC) THEN (REPEAT CONJ_TAC) THENL +[(MESON_TAC[VECTOR_SUB_COMPONENT;DIMINDEX_3;ARITH_RULE `1 <= 1 /\ 1 <= 3`]); +(MESON_TAC[VECTOR_SUB_COMPONENT;DIMINDEX_3;ARITH_RULE `1 <= 2 /\ 2 <= 3`]); +(MESON_TAC[VECTOR_SUB_COMPONENT;DIMINDEX_3;ARITH_RULE `1 <= 3 /\ 3 <= 3`])]);; + +let lemma7 = prove ( `! (v1 : real ^3)(v2: real^3)(v3:real^3). + cm3_ups_x v1 v2 v3 = + ups_x (norm (v1 -v2) pow 2) (norm (v2 -v3) pow 2) (norm (v3 -v1) pow 2) / &4`, + + (REPEAT GEN_TAC) THEN + (REWRITE_TAC[cm3_ups_x; ups_x]) THEN + (REWRITE_TAC[GSYM DOT_SQUARE_NORM;DOT_3;REAL_POW_2]) THEN + (REWRITE_TAC[lemma_cm3]) THEN + REAL_ARITH_TAC );; + +let pow_g = prove ( `! (x:real). &0 <= x pow 2`, + GEN_TAC THEN REWRITE_TAC[REAL_POW_2; REAL_LE_SQUARE]);; + +let lemma8 = prove ( `! (v1:real^3)(v2:real^3)(v3:real^3). +&0 <= ups_x (norm (v1 - v2) pow 2)(norm (v2 - v3) pow 2)(norm (v3 - v1) pow 2)`, + (REPEAT GEN_TAC) +THEN (MATCH_MP_TAC (REAL_ARITH `&0 <= a/ &4 ==> &0 <= a `)) +THEN (REWRITE_TAC[GSYM lemma7]) +THEN (REWRITE_TAC[cm3_ups_x]) + +THEN (ABBREV_TAC `(a:real) = (((v2:real^3) - v1)$2 * (v3 - v1)$3 - (v2 - v1)$3 * (v3 - v1)$2) pow 2`) +THEN (FIRST_X_ASSUM ((LABEL_TAC "1") o GSYM)) +THEN (ABBREV_TAC `(b:real) = (((v2:real^3) - v1)$3 * (v3 - v1)$1 - (v2 - v1)$1 * (v3 - v1)$3) pow 2`) +THEN (FIRST_X_ASSUM((LABEL_TAC "2") o GSYM)) +THEN (ABBREV_TAC `(c:real) = (((v2:real^3) - v1)$1 * (v3 - v1)$2 - (v2 - v1)$2 * (v3 - v1)$1) pow 2`) +THEN (FIRST_X_ASSUM((LABEL_TAC "3") o GSYM)) + +THEN (MATCH_MP_TAC (SPEC_ALL REAL_LE_ADD)) +THEN CONJ_TAC +THEN (ASM_REWRITE_TAC[pow_g]) +THEN (MATCH_MP_TAC (SPEC_ALL REAL_LE_ADD)) +THEN CONJ_TAC +THEN (ASM_REWRITE_TAC[pow_g]));; + +(* ========== *) +(* QUANG TRUONG *) +(* ============ *) +let GONTONG = REAL_RING ` ((a + b) + c = a + b + c ) `;; + +let SUB_SUM_SUB = REAL_RING ` (a - ( b + c ) = a - b - c )/\( a - (b- c) = a - b + c )` ;; + +(* lemma 4, p 7 *) +let JVUNDLC = prove(`!a b c s. + s = (a + b + c) / &2 + ==> &16 * s * (s - a) * (s - b) * (s - c) = + ups_x (a pow 2) (b pow 2) (c pow 2)`, SIMP_TAC [ ups_x] THEN +REWRITE_TAC[REAL_FIELD` a / &2 - b = ( a - &2 * b ) / &2 `] THEN +REWRITE_TAC[REAL_FIELD ` &16 * ( a / &2 ) * ( b / &2 ) * (c / &2 ) * +( d / &2 ) = a * b * c * d `] THEN REAL_ARITH_TAC);; + +let SET_TAC = + let basicthms = + [NOT_IN_EMPTY; IN_UNIV; IN_UNION; IN_INTER; IN_DIFF; IN_INSERT; + IN_DELETE; IN_REST; IN_INTERS; IN_UNIONS; IN_IMAGE] in + let allthms = basicthms @ map (REWRITE_RULE[IN]) basicthms @ + [IN_ELIM_THM; IN] in + let PRESET_TAC = + TRY(POP_ASSUM_LIST(MP_TAC o end_itlist CONJ)) THEN + REPEAT COND_CASES_TAC THEN + REWRITE_TAC[EXTENSION; SUBSET; PSUBSET; DISJOINT; SING] THEN + REWRITE_TAC allthms in + fun ths -> + PRESET_TAC THEN + (if ths = [] then ALL_TAC else MP_TAC(end_itlist CONJ ths)) THEN + MESON_TAC[];; + + let SET_RULE tm = prove(tm,SET_TAC[]);; + +(* some TRUONG TACTICS *) + +let PHA = REWRITE_TAC[ MESON[] ` (a/\b)/\c <=> a/\ b /\ c `];; + +let NGOAC = REWRITE_TAC[ MESON[] ` a/\b/\c <=> (a/\b)/\c `];; + +let DAO = NGOAC THEN REWRITE_TAC[ MESON[]` a /\ b <=> b /\ a`];; + +let PHAT = REWRITE_TAC[ MESON[] ` (a\/b)\/c <=> a\/b\/c `];; + +let NGOACT = REWRITE_TAC[ GSYM (MESON[] ` (a\/b)\/c <=> a\/b\/c `)];; + +let KHANANG = PHA THEN REWRITE_TAC[ MESON[]` ( a\/ b ) /\ c <=> a /\ c \/ b /\ c `] THEN + REWRITE_TAC[ MESON[]` a /\ ( b \/ c ) <=> a /\ b \/ a /\ c `];; + +let ATTACH thm = MATCH_MP (MESON[]` ! a b. ( a ==> b ) ==> ( a <=> a /\ b )`) thm;; + +let NHANH tm = ONCE_REWRITE_TAC[ ATTACH (tm)];; +let STRIP_TR = REPEAT STRIP_TAC THEN REPEAT (FIRST_X_ASSUM MP_TAC) + THEN REWRITE_TAC[IMP_IMP] THEN PHA;; + + +let elimin = REWRITE_RULE[IN];; + +let CONV_EM = prove(`conv {} = {}:real^A->bool`, + REWRITE_TAC[conv;sgn_ge;affsign;UNION_EMPTY;FUN_EQ_THM;elimin +NOT_IN_EMPTY;lin_combo;SUM_CLAUSES] + THEN REAL_ARITH_TAC);; + +let CONV_SING = prove(`!u. conv {u:real^A} = {u}`, + REWRITE_TAC[conv;sgn_ge;affsign;FUN_EQ_THM;UNION_EMPTY;lin_combo;SUM_SING;VSUM_SING; + elimin IN_SING] THEN REPEAT GEN_TAC THEN + REWRITE_TAC[TAUT `(p <=> q) = ((p ==> q) /\ (q ==> p))`] THEN + REPEAT STRIP_TAC THENL [ASM_MESON_TAC[VECTOR_MUL_LID]; + ASM_REWRITE_TAC[]] THEN EXISTS_TAC `\ (v:real^A). &1` THEN + MESON_TAC[VECTOR_MUL_LID;REAL_ARITH `&0 <= &1`] );; + +let IN_ACT_SING = SET_RULE `! a x. ({a} x <=> a = x ) /\ ( x IN {a} <=> x = a) /\ {a} a`;; + +let IN_SET2 = SET_RULE `!a b x. + (x IN {a, b} <=> x = a \/ x = b) /\ ({a, b} x <=> x = a \/ x = b)`;; + +let SUM_DIS2 = prove(`! x y f. ~(x=y) ==> sum {x,y} f = f x + f y `,REWRITE_TAC[ + SET_RULE ` ~( x = y) + <=> ~(x IN {y})`] THEN MESON_TAC[ FINITE_RULES; SUM_CLAUSES; SUM_SING]);; + + +let VSUM_DIS2 = prove(` ! x y f. ~(x=y) ==> vsum {x,y} f = f x + f y`, REWRITE_TAC[ + SET_RULE ` ~( x = y) + <=> ~(x IN {y})`] THEN MESON_TAC[ FINITE_RULES; VSUM_CLAUSES; VSUM_SING]);; + +let NOV10 = prove(` ! x y. (x = y + ==> (!x. y = x <=> + (?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ x = a % y + b % y))) `, +REWRITE_TAC[GSYM VECTOR_ADD_RDISTRIB] THEN +REWRITE_TAC[ MESON[VECTOR_MUL_LID]` a + b = &1 /\ x = (a + b) % y <=> a + b = &1 /\ +x = y`]THEN REPEAT GEN_TAC THEN DISCH_TAC THEN GEN_TAC THEN NGOAC THEN +REWRITE_TAC[LEFT_EXISTS_AND_THM] THEN MATCH_MP_TAC (MESON[]` a ==> ( x = y <=> a /\ + y = x )`)THEN EXISTS_TAC `&0` THEN EXISTS_TAC ` &1` THEN REAL_ARITH_TAC);; + + +let TRUONG_LEMMA = prove + ( `!x y x':real^N. + (?f. x' = f x % x + f y % y /\ (&0 <= f x /\ &0 <= f y) /\ + f x + f y = &1) <=> + (?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ x' = a % x + b % y)` , + REPEAT GEN_TAC THEN EQ_TAC +THENL [MESON_TAC[]; STRIP_TAC] THEN + ASM_CASES_TAC `y:real^N = x` THENL + [EXISTS_TAC `\x:real^N. &1 / &2`; + EXISTS_TAC `\u:real^N. if u = x then (a:real) else b`] THEN + ASM_REWRITE_TAC[GSYM VECTOR_ADD_RDISTRIB] THEN + CONV_TAC REAL_RAT_REDUCE_CONV);; + +let CONV_SET2 = prove(` ! x y:real^A. conv {x,y} = {w | ? a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ + w = a%x + b%y}`, +ONCE_REWRITE_TAC[ MESON[] ` (! a b. P a b ) <=> ( ! a b. a = b \/ ~( a= b) + ==> P a b )`] THEN +REWRITE_TAC[ MESON[]` a \/ b ==> c <=> ( a==> c) /\ ( b==> c)`] THEN +SIMP_TAC[] THEN REWRITE_TAC[ SET_RULE ` {a,a} = {a}`; CONV_SING; FUN_EQ_THM; + IN_ELIM_THM] THEN REWRITE_TAC[ IN_ACT_SING] THEN REWRITE_TAC[NOV10] THEN +REWRITE_TAC[conv; sgn_ge; affsign; lin_combo] THEN +REWRITE_TAC[UNION_EMPTY; IN_SET2] THEN +ONCE_REWRITE_TAC[ MESON[]` ~(x = y) ==> (!x'. (?f. P f x') <=> l x') <=> + ~(x = y) ==> (!x'. (?f. ~(x=y) /\ P f x') <=> l x')`] THEN +REWRITE_TAC[ MESON[VSUM_DIS2; SUM_DIS2]` ~(x = y) /\x' = vsum {x, y} ff /\ l /\ +sum {x, y} f = &1 <=> ~(x = y) /\ x' = ff x + ff y /\ l /\ f x + f y = &1 `] THEN +REWRITE_TAC[ MESON[]` (!w. w = x \/ w = y ==> &0 <= f w) <=> &0 <= f x /\ &0 <= f y`] +THEN ONCE_REWRITE_TAC[ GSYM (MESON[]` ~(x = y) ==> (!x'. (?f. P f x') <=> l x') <=> + ~(x = y) ==> (!x'. (?f. ~(x=y) /\ P f x') <=> l x')`)] THEN +REPEAT GEN_TAC THEN DISCH_TAC THEN GEN_TAC THEN REWRITE_TAC[ TRUONG_LEMMA]);; + +let LE_OF_ZPGPXNN = prove(` ! a b v v1 v2 . &0 <= a /\ &0 <= b /\ a + b = &1 /\ + v = a % v1 + b % v2 ==> dist ( v,v1) + dist (v,v2) = dist(v1,v2)`, +SIMP_TAC[dist; REAL_ARITH ` a + b = &1 <=> b = &1 - a `] THEN +REWRITE_TAC[VECTOR_ARITH ` (a % v1 + (&1 - a) % v2) - v1 = ( a - &1 )%( v1 - v2)`] THEN +REWRITE_TAC[VECTOR_ARITH` (a % v1 + (&1 - a) % v2) - v2 = a % ( v1 - v2) `] THEN +SIMP_TAC[NORM_MUL; GSYM REAL_ABS_REFL] THEN REWRITE_TAC[ REAL_ARITH ` abs ( a - &1 ) + = abs ( &1 - a ) `] THEN REAL_ARITH_TAC);; + +let LENGTH_EQUA = prove(` ! v v1 v2. v IN conv {v1,v2} ==> dist (v,v1) + + dist (v,v2) = dist (v1,v2) `,REWRITE_TAC[CONV_SET2; IN_ELIM_THM] THEN +MESON_TAC[LE_OF_ZPGPXNN]);; + +(* lemma 10. p 14 *) +let ZPGPXNN = prove(`!v1 v2 v. dist (v1,v2) < dist (v,v1) + dist (v,v2) ==> + ~(v IN conv {v1, v2})`, +REWRITE_TAC[MESON[] `a ==> ~ b <=> ~(a /\ b )`] THEN REWRITE_TAC[CONV_SET2; IN_ELIM_THM] +THEN MESON_TAC[LE_OF_ZPGPXNN; REAL_ARITH ` a < b ==> ~ ( a = b ) `]);; + +let REDUCE_T2 = MESON[]` !P Q. + (!v1 v2 v3 t1 t2 t3. P v1 t1 v2 t2 v3 t3 <=> P v2 t2 v1 t1 v3 t3) /\ + (!v1 v2 v3. Q v1 v2 v3 <=> Q v2 v1 v3) /\ + (!v1 v2 v3 t1 t2 t3. + ~(t1 = &0 /\ t3 = &0) /\ P v1 t1 v2 t2 v3 t3 ==> Q v1 v2 v3) + ==> (!v1 v2 v3 t1 t2 t3. + ~(t1 = &0 /\ t2 = &0 /\ t3 = &0) /\ P v1 t1 v2 t2 v3 t3 + ==> Q v1 v2 v3)`;; + +let VEC_PER2_3 = VECTOR_ARITH `((a:real^N ) + b + c = b + a + c)/\ + ( (a:real^N ) + b + c = c + b + a )`;; +let PER2_IN3 = SET_RULE ` {a,b,c} = {b,a,c} /\ {a,b,c} = {c,b,a}`;; + +let REDUCE_T3 = MESON[]`!P Q. + (!v1 v2 v3 t1 t2 t3. P v1 t1 v2 t2 v3 t3 <=> P v3 t3 v2 t2 v1 t1) /\ + (!v1 v2 v3. Q v1 v2 v3 <=> Q v3 v2 v1) /\ + (!v1 v2 v3 t1 t2 t3. ~(t1 = &0) /\ P v1 t1 v2 t2 v3 t3 ==> Q v1 v2 v3) + ==> (!v1 v2 v3 t1 t2 t3. + ~(t1 = &0 /\ t3 = &0) /\ P v1 t1 v2 t2 v3 t3 ==> Q v1 v2 v3)`;; + +let SUB_PACKING = prove(`!sub s. + packing s /\ sub SUBSET s + ==> (!x y. x IN sub /\ y IN sub /\ ~(x = y) ==> &2 <= dist3 x y)`, +REWRITE_TAC[ packing; GSYM dist3] THEN SET_TAC[]);; + + +let PAIR_EQ_EXPAND = + SET_RULE `{a,b} = {c,d} <=> a = c /\ b = d \/ a = d /\ b = c`;; + +let IN_SET3 = SET_RULE ` x IN {a,b,c} <=> x = a \/ x = b \/ x = c `;; +let IN_SET4 = SET_RULE ` x IN {a,b,c,d} <=> x = a \/ x = b \/ x = c \/ x = d `;; + +(* le 8. p 13 *) +let SGFCDZO = prove(`! (v1:real^3) v2 v3 t1 t2 t3. + t1 % v1 + t2 % v2 + t3 % v3 = vec 0 /\ + t1 + t2 + t3 = &0 /\ + ~(t1 = &0 /\ t2 = &0 /\ t3 = &0) + ==> collinear {v1, v2, v3}`, +ONCE_REWRITE_TAC[MESON[]` a /\ b/\c <=> c /\ a /\ b `] THEN +MATCH_MP_TAC REDUCE_T2 THEN +CONJ_TAC THENL [SIMP_TAC[VEC_PER2_3; REAL_ADD_AC]; CONJ_TAC THENL + [SIMP_TAC[PER2_IN3]; MATCH_MP_TAC REDUCE_T3]] THEN +CONJ_TAC THENL [SIMP_TAC[REAL_ADD_AC; VEC_PER2_3]; +CONJ_TAC THENL [SIMP_TAC[PER2_IN3]; REWRITE_TAC[]]] THEN +REPEAT GEN_TAC THEN REWRITE_TAC[collinear] THEN +STRIP_TAC THEN EXISTS_TAC `v2 - (v3:real^3)` THEN +ONCE_REWRITE_TAC[MESON[]` x IN s /\ y IN s <=> + ( x = y \/ ~ ( x = y))/\ x IN s /\ y IN s `] THEN +REWRITE_TAC[IN_SET3] THEN REPEAT GEN_TAC THEN +REWRITE_TAC[MESON[]` (a \/ b) /\ c ==> d <=> (a /\ c ==> d) /\ (b /\ c ==> d)`] +THEN CONJ_TAC THENL [DISCH_TAC THEN EXISTS_TAC `&0` THEN +FIRST_X_ASSUM MP_TAC THEN MATCH_MP_TAC (MESON[]` (a ==> c) ==> a /\ b ==> c `) THEN +MESON_TAC[VECTOR_MUL_LZERO; VECTOR_SUB_EQ]; STRIP_TAC] THENL [ + +ASM_MESON_TAC[] ; + +EXISTS_TAC ` t3 / t1 ` THEN ASM_SIMP_TAC[] THEN STRIP_TR THEN +ONCE_REWRITE_TAC[MESON[VECTOR_MUL_LCANCEL]` + ~(t1 = &0) /\ a ==> x = y <=> ~(t1 = &0) /\ a ==> t1 % x = t1 % y`] THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN SIMP_TAC[REAL_DIV_LMUL] THEN +ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN +REWRITE_TAC[ VECTOR_ARITH ` ( a + b + (c:real^N) ) - vec 0 = vec 0 <=> + a = -- ( b + c ) `; REAL_ARITH` a + b + c = &0 <=> a = -- ( b + c ) `] THEN +SIMP_TAC[VECTOR_SUB_LDISTRIB] THEN +MESON_TAC[VECTOR_ARITH ` --(t2 % v2 + t3 % v3) - --(t2 + t3) % v2 - + (t3 % v2 - t3 % v3) = vec 0`]; + +EXISTS_TAC ` ( -- t2 ) / t1 ` THEN ASM_SIMP_TAC[] THEN STRIP_TR THEN +ONCE_REWRITE_TAC[MESON[VECTOR_MUL_LCANCEL]` + ~(t1 = &0) /\ a ==> x = y <=> ~(t1 = &0) /\ a ==> t1 % x = t1 % y`] THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN SIMP_TAC[REAL_DIV_LMUL] THEN +ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN +REWRITE_TAC[ VECTOR_ARITH ` ( a + b + (c:real^N) ) - vec 0 = vec 0 <=> + a = -- ( b + c ) `; REAL_ARITH` a + b + c = &0 <=> a = -- ( b + c ) `] THEN +SIMP_TAC[VECTOR_SUB_LDISTRIB] THEN +MESON_TAC[VECTOR_ARITH ` --(t2 % v2 + t3 % v3) - --(t2 + t3) % v3 - + (--t2 % v2 - --t2 % v3) = vec 0`]; + + +EXISTS_TAC ` ( -- t3) / t1 ` THEN ASM_SIMP_TAC[] THEN STRIP_TR THEN +ONCE_REWRITE_TAC[MESON[VECTOR_MUL_LCANCEL]` + ~(t1 = &0) /\ a ==> x = y <=> ~(t1 = &0) /\ a ==> t1 % x = t1 % y`] THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN SIMP_TAC[REAL_DIV_LMUL] THEN +ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN +REWRITE_TAC[ VECTOR_ARITH ` ( a + b + (c:real^N) ) - vec 0 = vec 0 <=> + a = -- ( b + c ) `; REAL_ARITH` a + b + c = &0 <=> a = -- ( b + c ) `] THEN +SIMP_TAC[VECTOR_SUB_LDISTRIB] THEN MESON_TAC[VECTOR_ARITH ` --(t2 + t3) % v2 +- --(t2 % v2 + t3 % v3) - (--t3 % v2 - --t3 % v3) = vec 0`]; + + +ASM_MESON_TAC[]; + + +EXISTS_TAC ` &1 ` THEN ASM_SIMP_TAC[VECTOR_MUL_LID]; + + +EXISTS_TAC ` t2 / t1 ` THEN ASM_SIMP_TAC[] THEN STRIP_TR THEN +ONCE_REWRITE_TAC[MESON[VECTOR_MUL_LCANCEL]` + ~(t1 = &0) /\ a ==> x = y <=> ~(t1 = &0) /\ a ==> t1 % x = t1 % y`] THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN SIMP_TAC[REAL_DIV_LMUL] THEN +ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN +REWRITE_TAC[ VECTOR_ARITH ` ( a + b + (c:real^N) ) - vec 0 = vec 0 <=> + a = -- ( b + c ) `; REAL_ARITH` a + b + c = &0 <=> a = -- ( b + c ) `] THEN +SIMP_TAC[VECTOR_SUB_LDISTRIB] THEN +MESON_TAC[VECTOR_ARITH ` --(t2 + t3) % v3 - --(t2 % v2 + t3 % v3) - + (t2 % v2 - t2 % v3) = vec 0`]; + +EXISTS_TAC ` -- &1 ` THEN ASM_MESON_TAC[VECTOR_ARITH ` v3 - v2 = -- &1 % (v2 - v3)`]; + + +ASM_MESON_TAC[]]);; + + +(* le 2. p 6 *) +let RHUFIIB = prove( ` !x12 x13 x14 x23 x24 x34. + rho_ij' x12 x13 x14 x23 x24 x34 * ups_x x34 x24 x23 = + chi x12 x13 x14 x23 x24 x34 pow 2 + + &4 * delta x12 x13 x14 x23 x24 x34 * x34 * x24 * x23 `, +REWRITE_TAC[rho_ij'; chi; delta; ups_x] THEN REAL_ARITH_TAC);; + + +let RIGHT_END_POINT = prove( `!x aa bb. + (?a b. &0 < a /\ b = &0 /\ a + b = &1 /\ x = a % aa + b % bb) <=> x = aa`, +REPEAT GEN_TAC THEN EQ_TAC THENL [STRIP_TR THEN +REWRITE_TAC[ MESON[REAL_ARITH `b = &0 /\ a + b = &1 <=> b= &0 /\ a = &1 `]` + b = &0 /\ a + b = &1 /\ P a b <=> b = &0 /\ a = &1 /\ P (&1 ) ( &0 ) `] THEN +MESON_TAC[VECTOR_ARITH ` &1 % aa + &0 % bb = aa `]; +DISCH_TAC THEN EXISTS_TAC ` &1 ` THEN EXISTS_TAC ` &0 ` THEN +REWRITE_TAC[REAL_ARITH ` &0 < &1 /\ &1 + &0 = &1 `] THEN +ASM_MESON_TAC[VECTOR_ARITH ` &1 % aa + &0 % bb = aa `]]);; + +let LEFT_END_POINT = prove(` !x aa bb. + (?a b. a = &0 /\ &0 < b /\ a + b = &1 /\ x = &0 % aa + &1 % bb) + <=> x = bb `, +REWRITE_TAC[VECTOR_ARITH ` &0 % aa + &1 % bb = bb `] THEN +MESON_TAC[REAL_ARITH ` &0 = &0 /\ &0 < &1 /\ &0 + &1 = &1 `]);; + + +let CONV_CONV0 = prove(`! x a b. x IN conv {a,b} <=> x = a \/ x = b \/ x IN conv0 {a,b} `, +REWRITE_TAC[CONV_SET2; CONV0_SET2; IN_ELIM_THM] THEN +REWRITE_TAC[REAL_ARITH ` &0 <= a <=> a = &0 \/ &0 < a `] THEN +KHANANG THEN REWRITE_TAC[EXISTS_OR_THM] THEN +SIMP_TAC[MESON[REAL_ARITH ` ~(a = &0 /\ b = &0 /\ a + b = &1)`]` + ~(a = &0 /\ b = &0 /\ a + b = &1 /\ las )` ] THEN +REWRITE_TAC[MESON[REAL_ARITH ` a = &0 /\ a + b = &1 <=> a = &0 /\ b = &1 `]` + a = &0 /\ &0 < b /\ a + b = &1 /\ x = a % aa + b % ba <=> + a = &0 /\ &0 < b /\ a + b = &1 /\ x = &0 % aa + &1 % ba`] THEN +MESON_TAC[ RIGHT_END_POINT; LEFT_END_POINT]);; + + +let GONTONG = REWRITE_TAC[REAL_ARITH ` ( a + b ) + c = a + b + c `];; + +(* le 27. p 20 *) +let MAEWNPU = prove(` ?b c. + !x12 x13 x14 x23 x24 x34. + delta x12 x13 x14 x23 x24 x34 = + --x12 * x34 pow 2 + + b x12 x13 x14 x23 x24 * x34 + + c x12 x13 x14 x23 x24 `, +REWRITE_TAC[delta; REAL_ARITH ` a - b = a + -- b `; + REAL_ARITH ` a * (b + c )= a * b + a * c ` ] THEN +REWRITE_TAC[REAL_ARITH ` a * b * -- c = -- a * b * c /\ -- ( a * b ) = -- a * b `] THEN +REWRITE_TAC[REAL_ARITH` x12 * x34 * x23 + x12 * x34 * x24 + + --x12 * x34 * x34 = x12 * x34 * x23 + x12 * x34 * x24 + + -- x12 * ( x34 pow 2 ) `] THEN +REWRITE_TAC[REAL_ARITH ` ( a + b ) + c = a + b + c `] THEN +REWRITE_TAC[REAL_ARITH ` a + b * c pow 2 + d = b * c pow 2 + a + d `] THEN +ONCE_REWRITE_TAC[REAL_ARITH `a + b + c + d + e = a + d + b + c + e `] THEN +REWRITE_TAC[REAL_ARITH ` a * b * c = ( a * b ) * c `] THEN +REPLICATE_TAC 30 ( ONCE_REWRITE_TAC[REAL_ARITH ` a * x pow 2 + b * x + d + e + = a * x pow 2 + b * x + e + d `] THEN GONTONG THEN REWRITE_TAC[ REAL_ARITH + ` a * x pow 2 + b * x + d * x + e = a * x pow 2 + ( b + d) * x + e`]) THEN +REPLICATE_TAC 50 ( ONCE_REWRITE_TAC[REAL_ARITH ` a * x pow 2 + b * x + d + e + = a * x pow 2 + b * x + e + d `] THEN GONTONG THEN ONCE_REWRITE_TAC[ REAL_ARITH ` a * x pow 2 + b * x + (d * x) * h + e + = a * x pow 2 + ( b + d * h ) * x + e`]) THEN +EXISTS_TAC ` (\ x12 x13 x14 x23 x24. --x13 * x14 + + --x23 * x24 + + x13 * x24 + + x14 * x23 + + --x12 * x12 + + x12 * x14 + + x12 * x24 + + x12 * x13 + + x12 * x23 ) ` THEN +EXISTS_TAC ` (\ x12 x13 x14 x23 x24. (x14 * x23) * x12 + + (x14 * x23) * x13 + + (--x14 * x23) * x14 + + (--x14 * x23) * x23 + + (x14 * x23) * x24 + + (--x12 * x13) * x23 + + (--x12 * x14) * x24 + + (x13 * x24) * x12 + + (--x13 * x24) * x13 + + (x13 * x24) * x14 + + (x13 * x24) * x23 + + (--x13 * x24) * x24 ) ` THEN +SIMP_TAC[]);; + +(* ----new ------- *) + +let DELTA_COEFS = new_specification ["b_coef"; "c_coef"] MAEWNPU;; + + +let DELTA_X34 = prove(` !x12 x13 x14 x23 x24 x34. + delta x12 x13 x14 x23 x24 x34 = + --x12 * x34 pow 2 + + (--x13 * x14 + + --x23 * x24 + + x13 * x24 + + x14 * x23 + + --x12 * x12 + + x12 * x14 + + x12 * x24 + + x12 * x13 + + x12 * x23) * + x34 + + (x14 * x23) * x12 + + (x14 * x23) * x13 + + (--x14 * x23) * x14 + + (--x14 * x23) * x23 + + (x14 * x23) * x24 + + (--x12 * x13) * x23 + + (--x12 * x14) * x24 + + (x13 * x24) * x12 + + (--x13 * x24) * x13 + + (x13 * x24) * x14 + + (x13 * x24) * x23 + + (--x13 * x24) * x24`, REWRITE_TAC[delta] THEN REAL_ARITH_TAC);; + +let C_COEF_FORMULA = prove(`! x12 x13 x14 x23 x24. c_coef x12 x13 x14 x23 x24 + = (x14 * x23) * x12 + + (x14 * x23) * x13 + + (--x14 * x23) * x14 + + (--x14 * x23) * x23 + + (x14 * x23) * x24 + + (--x12 * x13) * x23 + + (--x12 * x14) * x24 + + (x13 * x24) * x12 + + (--x13 * x24) * x13 + + (x13 * x24) * x14 + + (x13 * x24) * x23 + + (--x13 * x24) * x24`, MP_TAC DELTA_COEFS THEN +NHANH (MESON[]` (!x12 x13 x14 x23 x24 x34. p x12 x13 x14 x23 x24 x34) + ==> (! x12 x13 x14 x23 x24. p x12 x13 x14 x23 x24 (&0) ) `) THEN +REWRITE_TAC[DELTA_X34] THEN +REWRITE_TAC[REAL_ARITH ` &0 pow 2 = &0 `; REAL_MUL_RZERO; REAL_ADD_LID] THEN +SIMP_TAC[]);; + +let BC_DEL_FOR = prove(` ! x12 x13 x14 x23 x24. b_coef x12 x13 x14 x23 x24 = + --x13 * x14 + + --x23 * x24 + + x13 * x24 + + x14 * x23 + + --x12 * x12 + + x12 * x14 + + x12 * x24 + + x12 * x13 + + x12 * x23 /\ + c_coef x12 x13 x14 x23 x24 = + (x14 * x23) * x12 + + (x14 * x23) * x13 + + (--x14 * x23) * x14 + + (--x14 * x23) * x23 + + (x14 * x23) * x24 + + (--x12 * x13) * x23 + + (--x12 * x14) * x24 + + (x13 * x24) * x12 + + (--x13 * x24) * x13 + + (x13 * x24) * x14 + + (x13 * x24) * x23 + + (--x13 * x24) * x24 `, REWRITE_TAC[C_COEF_FORMULA] THEN +MP_TAC DELTA_COEFS THEN NHANH (MESON[]` (!x12 x13 x14 x23 x24 x34. +p x12 x13 x14 x23 x24 x34) + ==> (! x12 x13 x14 x23 x24. p x12 x13 x14 x23 x24 (&1) ) `) THEN +REWRITE_TAC[DELTA_X34; C_COEF_FORMULA] THEN +REWRITE_TAC[REAL_ARITH ` a + b + c = a + b' + c <=> b = b' `] THEN +SIMP_TAC[REAL_RING` a * &1 = a `]);; + +(* +let AGBWHRD = prove(` !x12 x13 x14 x23 x24 x12 x13 x14 x23 x24. + b_coef x12 x13 x14 x23 x24 pow 2 + + &4 * x12 * c_coef x12 x13 x14 x23 x24 = + ups_x x12 x23 x13 * ups_x x12 x24 x14`, REWRITE_TAC[BC_DEL_FOR; ups_x] THEN +REAL_ARITH_TAC);; +*) + +let COLLINEAR_EX = prove(` ! x y (z:real^3) . collinear {x,y,z} <=> ( ? a b c. a + b + c = &0 /\ ~ ( a = &0 /\ +b = &0 /\ c = &0 ) /\ a % x + b % y + c % z = vec 0 ) `, +REWRITE_TAC[collinear] THEN +REPEAT GEN_TAC THEN +STRIP_TR THEN +EQ_TAC THENL [ +NHANH (SET_RULE` (!x' y'. x' IN {x, y, z} /\ y' IN {x, y, z} ==> P x' y' ) + ==> P x y /\ P x z `) THEN +STRIP_TR THEN +DISJ_CASES_TAC (MESON[]` c = &0 /\ c' = &0 \/ ~( c = &0 /\ c' = &0 ) `) THENL [ +ASM_SIMP_TAC[VECTOR_ARITH ` x - y = &0 % t <=> y = x`] THEN +DISCH_TAC THEN +EXISTS_TAC ` &1 ` THEN EXISTS_TAC ` &1 ` THEN +EXISTS_TAC ` -- &2 ` THEN +REWRITE_TAC[REAL_ARITH ` &1 + &1 + -- &2 = &0 /\ + ~(&1 = &0 /\ &1 = &0 /\ -- &2 = &0)`; VECTOR_ARITH` &1 % x + &1 % x + + -- &2 % x = vec 0`]; + + + +NHANH (MESON[VECTOR_MUL_LCANCEL]` x = c % u /\ + y = c' % u ==> c' % x = c' % (c % u) /\ c % y = c % c' % u `) THEN +REWRITE_TAC[VECTOR_ARITH ` x = c' % c % u /\ y = c % c' % u <=> + x = y /\ y = c % c' % u`] THEN +REWRITE_TAC[VECTOR_ARITH ` c' % (x - y) = c % (x - z) <=> (c - c' ) % x + c' % y + + -- c % z = vec 0 `] THEN +ASM_MESON_TAC[REAL_ARITH ` (( c - b ) + b + -- c = &0 ) /\ (~( c = &0 ) + <=> ~( -- c = &0 ))`]];REWRITE_TAC[GSYM collinear] THEN MESON_TAC[SGFCDZO]]);; + + +let MAX_REAL_LESS_EX = prove(`!x y a. max_real x y <= a <=> x <= a /\ y <= a`, +REWRITE_TAC[max_real; COND_EXPAND; COND_ELIM_THM;COND_RAND; COND_RATOR] THEN +REPEAT GEN_TAC THEN +MESON_TAC[REAL_ARITH ` (~ ( b < a ) /\ b <= c ==> a <= c)`; REAL_ARITH ` a < b /\ b <= c ==> a <= c `]);; + + +let MAX_REAL3_LESS_EX = prove(`! x y z a. max_real3 x y z <= a <=> x <= a /\ +y <= a /\ z <= a `, REWRITE_TAC[max_real3; MAX_REAL_LESS_EX] THEN MESON_TAC[]);; + + +MESON[]` (!x y z. + (P x y z <=> P y x z) /\ + (P x y z <=> P x z y) /\ + (Q x y z <=> Q y x z) /\ + (Q x y z <=> Q x z y)) /\ + (!x y z. P x y z ==> Q x y z) + ==> (!x y z. P x y z ==> Q x y z /\ Q y x z /\ Q z x y)`;; +(* ========== *) + +let UPS_X_SYM = prove(` ! x y z. ups_x x y z = ups_x y x z /\ + ups_x x y z = ups_x x z y `, REWRITE_TAC[ups_x] THEN REAL_ARITH_TAC);; + +let PER_MUL3 = REAL_ARITH ` a*b*c = b * a * c /\ a *b *c = a * c * b `;; + +let ETA_X_SYM = prove(` ! x y z. &0 <= x /\ &0 <= y /\ &0 <= z /\ &0 <= ups_x x y z ==> + eta_x x y z = eta_x y x z /\ eta_x x y z = eta_x x z y `, +REWRITE_TAC[eta_x] THEN +NHANH (MESON[UPS_X_SYM]` &0 <= ups_x x y z ==> &0 <= ups_x y x z + /\ &0 <= ups_x x z y `) THEN +NHANH (MESON[REAL_LE_MUL]`&0 <= x /\ &0 <= y /\ &0 <= z /\ las ==> + &0 <= x * y * z`) THEN +PHA THEN NHANH (MESON[REAL_LE_DIV; REAL_ARITH ` a * b * c = b * a * c + /\ a * b * c = a * c * b `]` + &0 <= ups_x x y z /\ &0 <= aa /\ &0 <= bb /\ &0 <= x * y * z + ==> &0 <= (x * y * z) / ups_x x y z /\ + &0 <= (y * x * z) / aa /\ + &0 <= (x * z * y) / bb`) THEN +SIMP_TAC[SQRT_INJ] THEN +MESON_TAC[UPS_X_SYM; PER_MUL3]);; + +let ETA_Y_SYM = prove(` ! x y z. &0 <= ups_x (x * x) (y * y) (z * z) ==> + eta_y x y z = eta_y y x z /\ eta_y x y z = eta_y x z y `, +REWRITE_TAC[eta_y] THEN REPEAT LET_TAC THEN MESON_TAC[ETA_X_SYM; REAL_LE_SQUARE]);; + + + +let ETA_Y_SYMM = MESON[UPS_X_SYM; ETA_Y_SYM]` ! x y z. &0 <= ups_x (x * x) (y * y) (z * z) + ==> eta_y x y z = eta_y x z y /\ + eta_y x y z = eta_y y x z /\ + eta_y x y z = eta_y z x y /\ + eta_y x y z = eta_y y z x /\ + eta_y x y z = eta_y z y x`;; + + +let IMPLY_POS = prove(`! x y z . &0 <= ups_x (x * x) (y * y) (z * z) ==> + &0 <= ((z * z) * (x * x) * y * y) / ups_x (z * z) (x * x) (y * y) /\ + &0 <= ((x * x) * (y * y) * z * z) / ups_x (x * x) (y * y) (z * z) /\ + &0 <= ((y * y) * (z * z) * x * x) / ups_x (y * y) (z * z) (x * x) `, MP_TAC + REAL_LE_SQUARE THEN MP_TAC REAL_LE_MUL THEN MESON_TAC[UPS_X_SYM; REAL_LE_DIV]);; + +let POW2_COND = MESON[REAL_ABS_REFL; REAL_LE_SQUARE_ABS]` ! a b. &0 <= a /\ &0 <= b ==> +( a <= b <=> a pow 2 <= b pow 2 ) `;; + + +let TRUONGG = prove(`! x y z. &0 < ups_x_pow2 z x y ==> + ((z * z) * (x * x) * y * y) / ups_x (z * z) (x * x) (y * y) - + z pow 2 / &4 = ( z pow 2 * (( z pow 2 - x pow 2 - y pow 2 ) pow 2 )) + / (&4 * ups_x_pow2 z x y )`, +REWRITE_TAC[ups_x; ups_x_pow2] THEN CONV_TAC REAL_FIELD);; + +let RE_TRUONGG = REWRITE_RULE[GSYM ups_x_pow2] TRUONGG;; + +let HVXIKHW = prove(` !x y z. + &0 <= x /\ &0 <= y /\ &0 <= z /\ &0 < ups_x_pow2 x y z + ==> max_real3 x y z / &2 <= eta_y x y z`, +REWRITE_TAC[REAL_ARITH` a / &2 <= b <=> a <= &2 * b `; MAX_REAL3_LESS_EX] THEN +REWRITE_TAC[eta_x; ups_x_pow2] THEN +NHANH (REAL_ARITH` &0 < a ==> &0 <= a `) THEN +DAO THEN REPEAT GEN_TAC THEN +REWRITE_TAC[MESON[ETA_Y_SYMM]` &0 <= ups_x (x * x) (y * y) (z * z) /\ las + ==> z <= &2 * eta_y x y z /\ x <= &2 * eta_y x y z /\ y <= &2 * eta_y x y z + <=> &0 <= ups_x (x * x) (y * y) (z * z) /\ las + ==> z <= &2 * eta_y z x y /\ x <= &2 * eta_y x y z /\ y <= &2 * eta_y y z x`] THEN +REWRITE_TAC[eta_y] THEN CONV_TAC (TOP_DEPTH_CONV let_CONV) THEN REWRITE_TAC[eta_x] +THEN NHANH (SPEC_ALL IMPLY_POS) THEN +NHANH (SPEC_ALL (prove(` ! a b x y. &0 <= a / b /\ &0 <= x /\ &0 <= y ==> + &0 <= &2 * sqrt ( a/b) /\ &0 <= &2 * sqrt x /\ &0 <= &2 * sqrt y `, +REWRITE_TAC[REAL_ARITH ` &0 <= &2 * a <=> &0 <= a `] THEN +SIMP_TAC[SQRT_WORKS]))) THEN SIMP_TAC[POW2_COND] THEN +REWRITE_TAC[REAL_ARITH ` x <= ( &2 * y ) pow 2 <=> x / &4 <= y pow 2 `] THEN +SIMP_TAC[ SQRT_POW_2] THEN REWRITE_TAC[ GSYM ups_x_pow2] THEN +REWRITE_TAC[REAL_FIELD` a / b <= c <=> &0 <= c - a / b `] THEN +SIMP_TAC[ups_x_pow2; UPS_X_SYM; RE_TRUONGG] THEN DAO THEN +MATCH_MP_TAC (MESON[]` (a4 ==> l) ==> (a1/\a2/\a3/\a4/\a5) ==> l `) THEN +MP_TAC REAL_LE_SQUARE THEN MP_TAC REAL_LE_MUL THEN MP_TAC REAL_LE_DIV THEN +REWRITE_TAC[GSYM REAL_POW_2] THEN MESON_TAC[REAL_ARITH ` &0 < a ==> &0 <= &4 * a `]);; + + +let EXISTS_INV = REAL_FIELD` ~( a = &0 ) <=> a * &1 / a = &1 /\ &1 / a * a = &1 `;; + + +let REAL_LT_RDIV_0 = prove( `!y z. &0 < z ==> (&0 < (y / z) <=> &0 < y)`, + MESON_TAC[REAL_LT_DIV;REAL_LT_MUL;REAL_DIV_RMUL;REAL_ARITH `&0 < x==> ~(x= &0)`]);; + +let POS_EQ_INV_POS = prove(`!x. &0 < x <=> &0 < &1 / x`, GEN_TAC THEN EQ_TAC +THENL [REWRITE_TAC[MESON[REAL_LT_RDIV_0; REAL_ARITH ` &0 < &1 `]`! b. &0 < b + ==> &0 < &1 / b `];REWRITE_TAC[] THEN +MESON_TAC[MESON[REAL_LT_RDIV_0; REAL_ARITH ` &0 < &1 `]` &0 < b + ==> &0 < &1 / b `; REAL_FIELD ` &1 / ( &1 / x ) = x ` ]]);; + + +let MIDDLE_POINT = prove(` ! x y (z:real^3) . collinear {x,y,z} ==> x IN conv {y,z} \/ +y IN conv {x,z} \/ z IN conv {x,y} `, REWRITE_TAC[COLLINEAR_EX] THEN REPEAT +GEN_TAC THEN +MATCH_MP_TAC (prove(`(!(a:real) (b:real) (c:real). P a b c <=> P (--a) (--b) (--c)) /\ + ((?a b c. &0 <= a /\ P a b c) ==> l) ==> ( ? a b c. P a b c ) ==> l `, + DISCH_TAC THEN ASM_MESON_TAC[REAL_ARITH ` ! a. a <= &0 \/ &0 <= a`; + REAL_ARITH ` a <= &0 <=> &0 <= -- a `])) THEN +CONJ_TAC THENL [MESON_TAC[REAL_ARITH` a = &0 <=> -- a = &0 `; REAL_ARITH ` a + b + c = &0 + <=> --a + --b + --c = &0`; VECTOR_ARITH ` a % x + b % y + c % z = vec 0 + <=> --a % x + --b % y + --c % z = vec 0 `]; STRIP_TAC] THEN +DISJ_CASES_TAC (REAL_ARITH ` &0 < b \/ b <= &0`) THENL +[STRIP_TR THEN REWRITE_TAC[VECTOR_ARITH ` a + b + c % z = vec 0 <=> + --c % z = a + b `] THEN +NHANH (MESON[VECTOR_MUL_LCANCEL]` a % x = y ==> (&1 / a) % a % x = &1 / a % y `) THEN +REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC] THEN +REWRITE_TAC[MESON[]` a1/\a2/\a3/\a4/\a5 ==> l <=> a1 /\ a5 /\ a2 ==> + a3/\a4 ==> l `] THEN +NHANH (REAL_FIELD ` &0 <= a /\ &0 < b /\ a + b + c = &0 ==> + a / ( -- c ) + b /( -- c ) = &1 /\ ~ ( -- c = &0 )/\ &0 < -- c `) THEN +SIMP_TAC[EXISTS_INV] THEN +ONCE_REWRITE_TAC[MESON[POS_EQ_INV_POS]` a /\ &0 < c <=> a /\ &0 < &1 / c `] THEN +REWRITE_TAC[VECTOR_MUL_LID; CONV_SET2; IN_ELIM_THM; GSYM (REAL_ARITH` a / b = + &1 / b * a `)] THEN +ONCE_REWRITE_TAC[REAL_ARITH` a / b = &1 / b * a `] THEN +MP_TAC (GEN_ALL (MESON[REAL_ARITH`( a * &1 = a ) /\ ( &0 < a ==> &0 <= a )`; + REAL_LE_MUL]` &0 < &1 / c * &1 /\ ( &0 <= a \/ &0 < a ) ==> &0 <= &1 / c * a `)) THEN +MESON_TAC[]; STRIP_TR THEN +NHANH (MESON[REAL_ARITH` &0 <= c \/ c <= &0`]` a + b + v = &0 ==> + &0 <= v \/ v <= &0 `) THEN +REWRITE_TAC[MESON[]` a1/\(a2 /\ (aa\/ bb))/\ dd <=> + (aa\/bb) /\ a1/\a2/\dd`] THEN SPEC_TAC (`a:real`, `a:real`) THEN +SPEC_TAC (`b:real`, `b:real`) THEN SPEC_TAC (`c:real`, `c:real`) THEN +KHANANG THEN REWRITE_TAC[(prove( `&0 <= c /\ &0 <= a /\ a + b + c = &0 /\ + ~(a = &0 /\ b = &0 /\ c = &0) /\ a % x + b % y + c % z = vec 0 /\ + b <= &0 <=> --a <= &0 /\ &0 <= --b /\ --b + --c + --a = &0 /\ + ~(--b = &0 /\ --c = &0 /\ --a = &0) /\ --b % y + --c % z + -- a % x = vec 0 /\ + --c <= &0`, MESON_TAC[ +REAL_ARITH ` (a = &0 <=> --a = &0) /\ ( b <= &0 <=> &0 <= -- b ) /\ + (&0 <= a <=> --a <= &0) /\ + (a + b + c = &0 <=> --b + --c + -- a = &0)`; +VECTOR_ARITH` a % x + b % y + c % z = vec 0 <=> + --b % y + --c % z + --a % x = vec 0 `]))] THEN +REWRITE_TAC[MESON[]` a \/ b ==> c <=> (a ==> c) /\(b==>c)`] THEN +REWRITE_TAC[MESON[REAL_ARITH `&0 <= a <=> a = &0 \/ &0 < a `]` + c <= &0 /\ &0 <= a /\ l <=> ( a = &0 \/ &0 < a ) /\ c <= &0 /\ l`] THEN +KHANANG THEN +REWRITE_TAC[MESON[REAL_ARITH `a = &0 /\ c <= &0 /\ a + b + c = &0 /\ b <= &0 + ==> a = &0 /\ b = &0 /\ c = &0`]`a = &0 /\ c <= &0 /\ + a + b + c = &0 /\ ~(a = &0 /\ b = &0 /\ c = &0) /\a2/\ b <= &0 <=> F `] THEN +NHANH (MESON[REAL_FIELD ` &0 < a /\ + a + b + c = &0 ==> -- b / a + -- c / a = &1 `]`&0 < a /\ c <= &0 /\ + a + b + c = &0 /\ l ==> --b / a + --c / a = &1 `) THEN +REWRITE_TAC[VECTOR_ARITH ` a % x + b % y + c % z = vec 0 <=> + a % x = -- b % y + -- c % z `] THEN +NHANH (MESON[VECTOR_MUL_LCANCEL]` a % x = y ==> &1 / a % a % x = &1 / a % y `) THEN +REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; REAL_ARITH ` &1 / a * b + = b / a `;VECTOR_MUL_LID ] THEN PHA THEN +PURE_ONCE_REWRITE_TAC[MESON[REAL_FIELD ` &0 < a ==> a / a = &1`]` + &0 < a /\ P ( a / a) <=> &0 < a /\ P ( &1 ) `] THEN +REWRITE_TAC[VECTOR_MUL_LID ] THEN +REWRITE_TAC[MESON[SET_RULE ` {a,b} = {b,a}`]` y IN conv {x, z} \/ z IN conv {x, y} + <=> y IN conv {z,x} \/ z IN conv {x,y} `] THEN +REWRITE_TAC[CONV_SET2; IN_ELIM_THM] THEN +REWRITE_TAC[ REAL_ARITH ` a <= &0 <=> &0 <= -- a `] THEN +MESON_TAC[REAL_LE_DIV; REAL_ARITH ` &0 < a ==> &0 <= a `]]);; + +let IN_CONV_COLLINEAR = prove(` ! (v:real^3) v1 v2. v IN conv {v1,v2} ==> +collinear {v,v1,v2} `, REWRITE_TAC[COLLINEAR_EX] THEN +REWRITE_TAC[COLLINEAR_EX; CONV_SET2; IN_ELIM_THM] THEN +REWRITE_TAC[VECTOR_ARITH ` v = a % v1 + b % v2 <=> + &1 % v + -- a % v1 + -- b % v2 = vec 0 `] THEN +MESON_TAC[REAL_ARITH `~ ( &1 = &0 ) /\ (a + b = &1 <=> &1 + --a + --b = &0 )`]);; + +let PER_SET3 = SET_RULE ` {a,b,c} = {a,c,b} /\ {a,b,c} = {b,a,c} /\ + {a,b,c} = {c,a,b} /\ {a,b,c} = {b,c,a} /\ {a,b,c} = {c,b,a} `;; + +let COLLINERA_AS_IN_CONV2 = prove(` ! x y (z:real^3) . collinear {x,y,z} <=> +x IN conv {y,z} \/ +y IN conv {x,z} \/ z IN conv {x,y}`, +MESON_TAC[PER_SET3; IN_CONV_COLLINEAR; MIDDLE_POINT]);; + +let LENGTH_EQ_EX = prove(`!v v1 v2. + dist (v1,v) + dist (v,v2) = dist (v1,v2) <=> + ~(dist (v1,v2) < dist (v1,v) + dist (v,v2))`, +REPEAT GEN_TAC THEN +REWRITE_TAC[REAL_ARITH ` ~( a < b) <=> b <= a `] THEN +EQ_TAC THENL [REAL_ARITH_TAC; +NHANH (MESON[DIST_TRIANGLE]` dist (v1,v) + dist (v,v2) <= dist (v1,v2) + ==> dist(v1,v2) <= dist (v1,v) + dist (v,v2)`) THEN +REAL_ARITH_TAC]);; + + +(* HARRISON have proved this lemma as following, but it must be loaded after convex.ml *) + +let BETWEEN_IFF_IN_CONVEX_HULL = prove + (`!v v1 v2:real^N. + dist(v1,v) + dist(v,v2) = dist(v1,v2) <=> v IN convex hull {v1,v2}`, + REPEAT GEN_TAC THEN ASM_CASES_TAC `v1:real^N = v2` THENL + [ASM_REWRITE_TAC[INSERT_AC; CONVEX_HULL_SING; IN_SING] THEN NORM_ARITH_TAC; + REWRITE_TAC[CONVEX_HULL_2_ALT; IN_ELIM_THM] THEN EQ_TAC THENL + [DISCH_TAC THEN EXISTS_TAC `dist(v1:real^N,v) / dist(v1,v2)` THEN + ASM_SIMP_TAC[REAL_LE_LDIV_EQ; REAL_LE_RDIV_EQ; DIST_POS_LT] THEN CONJ_TAC + THENL [FIRST_ASSUM(SUBST1_TAC o SYM) THEN NORM_ARITH_TAC; ALL_TAC] THEN + MATCH_MP_TAC VECTOR_MUL_LCANCEL_IMP THEN + EXISTS_TAC `dist(v1:real^N,v2)` THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; VECTOR_ADD_LDISTRIB; REAL_SUB_LDISTRIB; + REAL_DIV_LMUL; DIST_EQ_0] THEN + FIRST_ASSUM(MP_TAC o GEN_REWRITE_RULE I [DIST_TRIANGLE_EQ] o SYM) THEN + FIRST_ASSUM(SUBST1_TAC o SYM) THEN + REWRITE_TAC[dist; REAL_ARITH `(a + b) * &1 - a = b`] THEN + VECTOR_ARITH_TAC; + STRIP_TAC THEN ASM_REWRITE_TAC[dist] THEN + REWRITE_TAC[VECTOR_ARITH `a - (a + b:real^N) = --b`; + VECTOR_ARITH `(a + u % (b - a)) - b = (&1 - u) % (a - b)`; + NORM_NEG; NORM_MUL; GSYM REAL_ADD_LDISTRIB] THEN + REWRITE_TAC[NORM_SUB] THEN REPEAT(POP_ASSUM MP_TAC) THEN + CONV_TAC REAL_FIELD]]);; + +(* From this, your version follows easily: *) + + let BETWEEN_IMP_IN_CONVEX_HULL = prove + (`!v v1 v2. dist(v1,v) + dist(v,v2) = dist(v1,v2) + ==> (?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ + v = a % v1 + b % v2)`, + REWRITE_TAC[BETWEEN_IFF_IN_CONVEX_HULL; CONVEX_HULL_2; IN_ELIM_THM] THEN + REWRITE_TAC[CONJ_ASSOC]);; + + + +let PRE_HE = prove(` ! x y z. let p = ( x + y + z ) / &2 in + ups_x_pow2 x y z = &16 * p * ( p - x ) * ( p - y ) * ( p - z ) `, +CONV_TAC (TOP_DEPTH_CONV let_CONV) THEN +REWRITE_TAC[ups_x_pow2; ups_x] THEN REAL_ARITH_TAC);; + +let PRE_HER = prove(`!x y z. + ups_x_pow2 x y z = + &16 * + (x + y + z) / &2 * + ((x + y + z) / &2 - x) * + ((x + y + z) / &2 - y) * + ((x + y + z) / &2 - z)`, +REWRITE_TAC[ups_x_pow2; ups_x] THEN REAL_ARITH_TAC);; + + +let TRIVIVAL_LE = prove(`!v1 v2 v3. + ~(v2 = v3 /\ v1 = v2) + ==> ~(dist (v1,v2) + dist (v1,v3) + dist (v2,v3) = &0)`, +SIMP_TAC[DE_MORGAN_THM; DIST_NZ] THEN +NHANH (MESON[DIST_POS_LE]`&0 < dist (v2,v3) \/ &0 < dist (v1,v2) ==> + &0 <= dist(v1,v3) `) THEN MP_TAC DIST_POS_LE THEN KHANANG THEN +REWRITE_TAC[OR_IMP_EX] THEN +NHANH (MESON[DIST_POS_LE]`&0 < dist (v2,v3) /\ &0 <= dist (v1,v3) + ==> &0 <= dist(v1,v2) `) THEN +SIMP_TAC[REAL_ARITH`( &0 < a /\ &0 <= b ) /\ &0 <= c ==> ~(c + b + a = &0 ) `] THEN +NHANH (MESON[DIST_POS_LE]`&0 < dist (v1,v2) /\ &0 <= dist (v1,v3) ==> + &0 <= dist(v2,v3) `) THEN +MESON_TAC[REAL_ARITH ` &0 < a /\ &0 <= b /\ &0 <= c ==> ~( a + b + c = &0 ) `]);; + + + +let MID_COND = prove(` ! v v1 v2. v IN conv {v1,v2} <=> dist(v1,v) + dist(v,v2) + = dist(v1,v2) `, REPEAT GEN_TAC THEN EQ_TAC THENL [MESON_TAC[LENGTH_EQUA; DIST_SYM]; +REWRITE_TAC[CONV_SET2; IN_ELIM_THM] THEN +MESON_TAC[DIST_SYM; BETWEEN_IMP_IN_CONVEX_HULL]]);; + + +(* lemma 9. p 13 *) +let FHFMKIY = prove(`!(v1:real^3) v2 v3 x12 x13 x23. + x12 = dist (v1,v2) pow 2 /\ + x13 = dist (v1,v3) pow 2 /\ + x23 = dist (v2,v3) pow 2 + ==> (collinear {v1, v2, v3} <=> ups_x x12 x13 x23 = &0)`, +REPEAT STRIP_TAC THEN ASM_SIMP_TAC[] THEN REWRITE_TAC[COLLINERA_AS_IN_CONV2] + THEN REWRITE_TAC[REAL_ARITH ` x pow 2 = x * x `; GSYM ups_x_pow2] THEN +REWRITE_TAC[PRE_HER] THEN REWRITE_TAC[REAL_ENTIRE] THEN +ONCE_REWRITE_TAC[MESON[]`( v1 IN conv {v2, v3} \/ a \/ b <=> l ) <=> +(v1 = v2 /\ v1 = v3 ) \/ ~(v1 = v2 /\ v1 = v3) ==> ( v1 IN conv {v2, v3} +\/ a \/ b <=> l )`] THEN REWRITE_TAC[OR_IMP_EX] THEN +SIMP_TAC[DIST_SYM; DIST_REFL; MESON[]` a= b/\ a= c <=> b = c /\ a= b`] THEN +SIMP_TAC[SET_RULE ` {a,a} = {a} /\ a IN {a} `; CONV_SING; + REAL_ARITH ` (&0 + &0 + &0)/ &2 = &0 `] THEN SIMP_TAC[ TRIVIVAL_LE; +REAL_ARITH `~( &16 = &0) /\(~( a = &0) ==> ~( a / &2 = &0))`] THEN +REWRITE_TAC[REAL_ARITH ` (a+ b + c ) / &2 - a = &0 <=> b + c = a `] THEN +REWRITE_TAC[REAL_ARITH ` (a+ b + c ) / &2 - b = &0 <=> c + a = b `] THEN +REWRITE_TAC[REAL_ARITH ` (a+ b + c ) / &2 - c = &0 <=> a + b = c `] THEN +REWRITE_TAC[MESON[SET_RULE `{a,b} = {b,a} `]`v2 IN conv {v1, v3} \/ v3 IN +conv {v1, v2} <=> v2 IN conv {v3,v1} \/ v3 IN conv {v1, v2}`] THEN +REWRITE_TAC[MID_COND] THEN MESON_TAC[DIST_SYM]);; + +(* le 11. p 14 *) +(* NGUYEN QUANG TRUONG *) + + +(* These following lemma are Multivariate/convex.ml *) + + +let affine_dependent = new_definition + `affine_dependent (s:real^N -> bool) <=> + ?x. x IN s /\ x IN (affine hull (s DELETE x))`;; + + let AFFINE_HULL_FINITE = prove + (`!s:real^N->bool. + FINITE s + ==> affine hull s = {y | ?u. sum s u = &1 /\ vsum s (\v. u v % v) = y}`, + GEN_TAC THEN DISCH_TAC THEN + REWRITE_TAC[EXTENSION; AFFINE_HULL_EXPLICIT; IN_ELIM_THM] THEN + X_GEN_TAC `x:real^N` THEN EQ_TAC THEN REWRITE_TAC[LEFT_IMP_EXISTS_THM] THENL + [MAP_EVERY X_GEN_TAC [`t:real^N->bool`; `f:real^N->real`] THEN + STRIP_TAC THEN + EXISTS_TAC `\x:real^N. if x IN t then f x else &0` THEN + REWRITE_TAC[] THEN ONCE_REWRITE_TAC[COND_RAND] THEN + ONCE_REWRITE_TAC[COND_RATOR] THEN REWRITE_TAC[VECTOR_MUL_LZERO] THEN + ASM_SIMP_TAC[GSYM VSUM_RESTRICT_SET; GSYM SUM_RESTRICT_SET] THEN + ASM_SIMP_TAC[SET_RULE `t SUBSET s ==> {x | x IN s /\ x IN t} = t`]; + X_GEN_TAC `f:real^N->real` THEN + ASM_CASES_TAC `s:real^N->bool = {}` THEN + ASM_REWRITE_TAC[SUM_CLAUSES; REAL_OF_NUM_EQ; ARITH] THEN STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`s:real^N->bool`; `f:real^N->real`] THEN + ASM_REWRITE_TAC[GSYM EXTENSION; SUBSET_REFL]]);; + + let IN_AFFINE_HULL_IMP_COLLINEAR = prove + (`!a b c:real^N. a IN (affine hull {b,c}) ==> collinear {a,b,c}`, + REPEAT GEN_TAC THEN MAP_EVERY ASM_CASES_TAC + [`a:real^N = b`; `a:real^N = c`; `b:real^N = c`] THEN + TRY(ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_SING; COLLINEAR_2] THEN NO_TAC) THEN + SIMP_TAC[AFFINE_HULL_FINITE; FINITE_INSERT; FINITE_SING] THEN + SIMP_TAC[SUM_CLAUSES; VSUM_CLAUSES; FINITE_RULES; REAL_ADD_RID] THEN + ASM_REWRITE_TAC[IN_INSERT; IN_ELIM_THM; NOT_IN_EMPTY; VECTOR_ADD_RID] THEN + DISCH_THEN(X_CHOOSE_THEN `f:real^N->real` STRIP_ASSUME_TAC) THEN + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {c,b,a}`] THEN + ASM_REWRITE_TAC[COLLINEAR_3; COLLINEAR_LEMMA; VECTOR_SUB_EQ] THEN + EXISTS_TAC `(f:real^N->real) c` THEN EXPAND_TAC "a" THEN + FIRST_X_ASSUM(SUBST1_TAC o MATCH_MP (REAL_ARITH + `b + c = &1 ==> b = &1 - c`)) THEN VECTOR_ARITH_TAC);; + + + let AFFINE_DEPENDENT_3_IMP_COLLINEAR = prove + (`!a b c:real^N. affine_dependent{a,b,c} ==> collinear{a,b,c}`, + REPEAT GEN_TAC THEN + MAP_EVERY ASM_CASES_TAC + [`a:real^N = b`; `a:real^N = c`; `b:real^N = c`] THEN + TRY(ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_SING; COLLINEAR_2] THEN NO_TAC) THEN + REWRITE_TAC[affine_dependent; IN_INSERT; NOT_IN_EMPTY] THEN STRIP_TAC THEN + FIRST_X_ASSUM SUBST_ALL_TAC THENL + [ALL_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {b,a,c}`]; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {c,b,a}`]] THEN + MATCH_MP_TAC IN_AFFINE_HULL_IMP_COLLINEAR THEN + FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (MESON[] + `x IN s ==> s = t ==> x IN t`)) THEN + AP_TERM_TAC THEN ASM SET_TAC[]);; + +(* LEMMA 11 *) +let FAFKVLR = prove + (`!v1 v2 v3 v:real^N. + ~collinear{v1,v2,v3} /\ v IN (affine hull {v1,v2,v3}) + + ==> ?t1 t2 t3. v = t1 % v1 + t2 % v2 + t3 % v3 /\ + t1 + t2 + t3 = &1 /\ + !ta tb tc. v = ta % v1 + tb % v2 + tc % v3 /\ + + ta + tb + tc = &1 + ==> ta = t1 /\ tb = t2 /\ tc = t3`, + REPEAT GEN_TAC THEN + MAP_EVERY ASM_CASES_TAC + [`v1:real^N = v2`; `v2:real^N = v3`; `v1:real^N = v3`] THEN + TRY(ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_SING; COLLINEAR_2] THEN NO_TAC) THEN + SIMP_TAC[AFFINE_HULL_FINITE; FINITE_INSERT; FINITE_SING; IN_ELIM_THM] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + SIMP_TAC[SUM_CLAUSES; VSUM_CLAUSES; FINITE_INSERT; FINITE_SING; + SUM_SING; VSUM_SING] THEN + ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; LEFT_IMP_EXISTS_THM] THEN + X_GEN_TAC `f:real^N->real` THEN STRIP_TAC THEN + MAP_EVERY EXISTS_TAC + [`(f:real^N->real) v1`; `(f:real^N->real) v2`; `(f:real^N->real) v3`] THEN + ASM_REWRITE_TAC[] THEN REPEAT GEN_TAC THEN EXPAND_TAC "v" THEN + DISCH_TAC THEN MATCH_MP_TAC(TAUT `(~p ==> F) ==> p`) THEN DISCH_TAC THEN + UNDISCH_TAC `~collinear{v1:real^N,v2,v3}` THEN REWRITE_TAC[] THEN + MATCH_MP_TAC AFFINE_DEPENDENT_3_IMP_COLLINEAR THEN + SIMP_TAC[AFFINE_DEPENDENT_EXPLICIT_FINITE; FINITE_INSERT; FINITE_RULES; + SUM_CLAUSES; VSUM_CLAUSES] THEN + ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY] THEN + EXISTS_TAC `\x. if x = v1 then f v1 - ta + else if x = v2 then f v2 - tb + else (f:real^N->real) v3 - tc` THEN + ASM_REWRITE_TAC[REAL_ADD_RID; VECTOR_ADD_RID] THEN REPEAT CONJ_TAC THENL + [ASM_REAL_ARITH_TAC; + ASM_REWRITE_TAC[EXISTS_OR_THM; RIGHT_OR_DISTRIB; UNWIND_THM2] THEN + ASM_REWRITE_TAC[REAL_SUB_0] THEN ASM_MESON_TAC[]; + ASM_REWRITE_TAC[VECTOR_ARITH + `(a - a') % x + (b - b') % y + (c - c') % z = vec 0 <=> + a % x + b % y + c % z = a' % x + b' % y + c' % z`] THEN + ASM_MESON_TAC[]]);; + + + + let FAFKVLR_ALT = prove + (`!v1 v2 v3 v:real^N. + ~collinear{v1,v2,v3} /\ v IN (affine hull {v1,v2,v3}) + ==> ?!(t1,t2,t3). v = t1 % v1 + t2 % v2 + t3 % v3 /\ + t1 + t2 + t3 = &1`, + REWRITE_TAC(map(REWRITE_RULE[ETA_AX]) + [EXISTS_UNIQUE; FORALL_PAIR_THM; EXISTS_PAIR_THM]) THEN + REWRITE_TAC[PAIR_EQ; GSYM CONJ_ASSOC; FAFKVLR]);; + + +let equivalent_lemma = prove(` (?t1 t2 t3. + !v1 v2 v3 (v:real^N). + v IN affine hull {v1, v2, v3} /\ ~collinear {v1, v2, v3} + ==> v = + t1 v1 v2 v3 v % v1 + t2 v1 v2 v3 v % v2 + t3 v1 v2 v3 v % v3 /\ + t1 v1 v2 v3 v + t2 v1 v2 v3 v + t3 v1 v2 v3 v = &1 /\ + (!ta tb tc. + v = ta % v1 + tb % v2 + tc % v3 /\ ta + tb + tc = &1 + ==> ta = t1 v1 v2 v3 v /\ + tb = t2 v1 v2 v3 v /\ + tc = t3 v1 v2 v3 v)) <=> + + ( !v1 v2 v3 (v:real^N). + v IN affine hull {v1, v2, v3} /\ ~collinear {v1, v2, v3} + ==> (?t1 t2 t3. + v = t1 % v1 + t2 % v2 + t3 % v3 /\ + t1 + t2 + t3 = &1 /\ + (!ta tb tc. + v = ta % v1 + tb % v2 + tc % v3 /\ ta + tb + tc = &1 + ==> ta = t1 /\ tb = t2 /\ tc = t3))) `, +REWRITE_TAC[GSYM SKOLEM_THM; LEFT_FORALL_IMP_THM; RIGHT_EXISTS_IMP_THM]);; + + + let LAMBDA_TRIPLED_THM = prove + (`!t. (\(x,y,z). t x y z) = (\p. t (FST p) (FST(SND p)) (SND(SND p)))`, + REWRITE_TAC[FUN_EQ_THM; FORALL_PAIR_THM]);; + + let FORALL_TRIPLED_THM = prove + (`!P. (!(x,y,z). P x y z) <=> (!x y z. P x y z)`, + REWRITE_TAC[LAMBDA_TRIPLED_THM] THEN REWRITE_TAC[FORALL_PAIR_THM]);; + + let EXISTS_TRIPLED_THM = prove + (`!P. (?(x,y,z). P x y z) <=> (?x y z. P x y z)`, + REWRITE_TAC[LAMBDA_TRIPLED_THM] THEN REWRITE_TAC[EXISTS_PAIR_THM]);; + + let EXISTS_UNIQUE_TRIPLED_THM = prove + (`!P. (?!(x,y,z). P x y z) <=> + (?x y z. P x y z /\ + (!x' y' z'. P x' y' z' ==> x' = x /\ y' = y /\ z' = z))`, + REWRITE_TAC[REWRITE_RULE[ETA_AX] EXISTS_UNIQUE] THEN + REWRITE_TAC[FORALL_TRIPLED_THM; EXISTS_TRIPLED_THM] THEN + REWRITE_TAC[EXISTS_PAIR_THM; FORALL_PAIR_THM; PAIR_EQ]);; + + + let theoremmm = prove + (`( !v1 v2 v3 v:real^N. + v IN affine hull {v1, v2, v3} /\ ~collinear {v1, v2, v3} + ==> (?t1 t2 t3. + v = t1 % v1 + t2 % v2 + t3 % v3 /\ + t1 + t2 + t3 = &1 /\ + (!ta tb tc. + v = ta % v1 + tb % v2 + tc % v3 /\ + ta + tb + tc = &1 + ==> ta = t1 /\ tb = t2 /\ tc = t3)) ) + <=> + ( !v1 v2 v3 v:real^N. + ~collinear {v1, v2, v3} /\ v IN affine hull {v1, v2, v3} + ==> (?!(t1,t2,t3). v = t1 % v1 + t2 % v2 + t3 % v3 /\ + t1 + t2 + t3 = &1))`, + REWRITE_TAC[EXISTS_UNIQUE_TRIPLED_THM] THEN REWRITE_TAC[CONJ_ACI]);; + + + + +let FAFKVLR = prove(` (?t1 t2 t3. + !v1 v2 v3 (v:real^N). + v IN affine hull {v1, v2, v3} /\ ~collinear {v1, v2, v3} + ==> v = + t1 v1 v2 v3 v % v1 + t2 v1 v2 v3 v % v2 + t3 v1 v2 v3 v % v3 /\ + t1 v1 v2 v3 v + t2 v1 v2 v3 v + t3 v1 v2 v3 v = &1 /\ + (!ta tb tc. + v = ta % v1 + tb % v2 + tc % v3 /\ ta + tb + tc = &1 + ==> ta = t1 v1 v2 v3 v /\ + tb = t2 v1 v2 v3 v /\ + tc = t3 v1 v2 v3 v)) `, +SIMP_TAC[equivalent_lemma; FAFKVLR]);; +let LEMMA11 = FAFKVLR;; +let lemma11 = REWRITE_RULE[equivalent_lemma] FAFKVLR;; +let COEFS = new_specification ["coef1"; "coef2"; "coef3"] FAFKVLR;; + +let lem11 = REWRITE_RULE[simp_def2; IN_ELIM_THM] lemma11;; + +let REAL_PER3 = REAL_ARITH `!a b c. a + b + c = b + a + c /\ a + b + c = c + b + a `;; + + +MESON[VEC_PER2_3]` (!ta tb tc. + v = ta % v1 + tb % v2 + tc % v3 ==> ta = t1 /\ tb = t2 /\ tc = t3) /\bbb/\ + v = ta''' % v1 + tb''' % v2 + t''' % v3 /\ + v = ta'' % v3 + tb'' % v1 + t'' % v2 /\ + v = ta' % v2 + tb' % v3 + t' % v1 /\ +aa ==> t' = t1 /\ t'' = t2 /\ t''' = t3 `;; + +let NOT_COLLINEAR_IMP_2_UNEQUAL = MESON[INSERT_INSERT; COLLINEAR_2; INSERT_AC] +`~collinear {v0, va, vb} ==> ~(v0 = va) /\ ~(v0 = vb) `;; + +let COLLINEAR_DISJOINT3 = prove(`!v1:real^A v2 v3. ~collinear {v1,v2,v3} ==> + DISJOINT {v2,v3} {v1}`, + REWRITE_TAC[DISJOINT_INSERT;DISJOINT_EMPTY;IN_INSERT;NOT_IN_EMPTY] THEN + MESON_TAC[NOT_COLLINEAR_IMP_2_UNEQUAL] + );; + +let COLLINEAR_DISJOINT_PERM3 = prove(`!v1:real^A v2 v3. (~collinear {v1,v2,v3} ==> + DISJOINT {v1,v2} {v3}) /\ (~collinear {v1,v2,v3} ==> DISJOINT {v2,v3} {v1}) /\ + (~collinear {v1,v2,v3} ==> DISJOINT {v3,v1} {v2})`, + REPEAT GEN_TAC THEN + SUBGOAL_THEN `{v3:real^A,v1,v2} = {v1,v2,v3} /\ {v2,v3,v1}={v1,v2,v3}` MP_TAC THENL + [SET_TAC[] ; ASM_MESON_TAC[COLLINEAR_DISJOINT3]]);; + +let simp_def_ge = prove(` !a:real^A b v0. + DISJOINT {a, b} {v0} + ==> + aff_ge {a, b} {v0} = + {x | ?ta tb t. + ta + tb + t = &1 /\ + &0 <= t /\ + x = ta % a + tb % b + t % v0} `, + MESON_TAC[simp_def2]);; + + +let IN_CONV3_EQ = prove(`! (v:real^3) v1 v2 v3. ~collinear {v1,v2,v3} ==> (v IN conv {v1, v2, v3} <=> + v IN aff_ge {v1,v2} {v3} /\ + v IN aff_ge {v2,v3} {v1} /\ v IN aff_ge {v3,v1} {v2} )`, +SIMP_TAC[CONV_SET3; COLLINEAR_DISJOINT_PERM3;simp_def_ge; IN_ELIM_THM] THEN +REPEAT GEN_TAC THEN DISCH_TAC THEN EQ_TAC THENL [ +MESON_TAC[REAL_ARITH` a + b + c = b + a + c /\ a + b + c = c + b + a `; + VECTOR_ARITH `(a:real^N) + b + c = b + a + c /\ a + b + c = c + b + a `; lem11]; +NHANH (MESON[]` (? a b c. P a b c /\ Q c /\ R a b c) /\ aa /\ bb ==> + (? a b c. P a b c /\ R a b c) `) THEN +FIRST_X_ASSUM MP_TAC THEN +REWRITE_TAC[IMP_IMP] THEN +REWRITE_TAC[MESON[]` ~a/\ b <=> b /\ ~ a `] THEN +PHA THEN +NHANH (SPEC_ALL lem11) THEN +STRIP_TR THEN REWRITE_TAC[MESON[]` (v = w:real^N) /\ a <=> a /\ v = w `] THEN PHA] THEN +NHANH (MESON[VEC_PER2_3; REAL_PER3]` ta + tb + t = &1 /\ + &0 <= t /\ + ta' + tb' + t' = &1 /\ + &0 <= t' /\ + ta'' + tb'' + t'' = &1 /\ + &0 <= t'' /\ +a1/\ +a2/\ + t1 + t2 + t3 = &1 /\ + (!ta tb tc. + ta + tb + tc = &1 /\ v = ta % v1 + tb % v2 + tc % v3 + ==> ta = t1 /\ tb = t2 /\ tc = t3) /\ + v = t1 % v1 + t2 % v2 + t3 % v3 /\ +a3/\ + v = ta'' % v3 + tb'' % v1 + t'' % v2 /\ + v = ta' % v2 + tb' % v3 + t' % v1 /\ + v = ta % v1 + tb % v2 + t % v3 ==> t1 = t' /\ t2 = t'' /\ t3 = t`) THEN +MESON_TAC[]);; + + +let IN_CONV03_EQ = prove( +`! (v:real^3) v1 v2 v3. ~collinear {v1,v2,v3} ==> +(v IN conv0 {v1, v2, v3} <=> v IN aff_gt {v1,v2} {v3} /\ + v IN aff_gt {v2,v3} {v1} /\ v IN aff_gt {v3,v1} {v2} )`, +SIMP_TAC[CONV_SET3; COLLINEAR_DISJOINT_PERM3;simp_def2; IN_ELIM_THM] THEN +REPEAT GEN_TAC THEN DISCH_TAC THEN EQ_TAC THENL [ +MESON_TAC[REAL_ARITH` a + b + c = b + a + c /\ a + b + c = c + b + a `; + VECTOR_ARITH `(a:real^N) + b + c = b + a + c /\ a + b + c = c + b + a `; lem11]; +NHANH (MESON[]` (? a b c. P a b c /\ Q c /\ R a b c) /\ aa /\ bb ==> + (? a b c. P a b c /\ R a b c) `) THEN +FIRST_X_ASSUM MP_TAC THEN +REWRITE_TAC[IMP_IMP] THEN +REWRITE_TAC[MESON[]` ~a/\ b <=> b /\ ~ a `] THEN +PHA THEN +NHANH (SPEC_ALL lem11) THEN +STRIP_TR THEN REWRITE_TAC[MESON[]` (v = w:real^N) /\ a <=> a /\ v = w `]] + THEN PHA THEN NHANH (MESON[VEC_PER2_3; REAL_PER3]` + ta + tb + t = &1 /\ + &0 < t /\ + ta' + tb' + t' = &1 /\ + &0 < t' /\ + ta'' + tb'' + t'' = &1 /\ + &0 < t'' /\ a33 /\ a22 /\ + t1 + t2 + t3 = &1 /\ + (!ta tb tc. + ta + tb + tc = &1 /\ v = ta % v1 + tb % v2 + tc % v3 + ==> ta = t1 /\ tb = t2 /\ tc = t3) /\ + v = t1 % v1 + t2 % v2 + t3 % v3 /\ a11 /\ + v = ta'' % v3 + tb'' % v1 + t'' % v2 /\ + v = ta' % v2 + tb' % v3 + t' % v1 /\ + v = ta % v1 + tb % v2 + t % v3 ==> + t1 = t' /\ t2 = t'' /\ t3 = t `) THEN MESON_TAC[]);; + + +let AFFINE_SET_GEN_BY_TWO_POINTS = +prove(`! a b. affine {x | ?ta tb. ta + tb = &1 /\ x = ta % a + tb % b}`, +REWRITE_TAC[affine; IN_ELIM_THM] THEN +REPEAT GEN_TAC THEN +STRIP_TAC THEN +EXISTS_TAC ` u * ta + v * ta' ` THEN +EXISTS_TAC ` u * tb + v * tb' ` THEN +REWRITE_TAC[REAL_ARITH ` (u * ta + v * ta') + u * tb + v * tb' = + u * (ta + tb) + v * (ta' + tb' ) `] THEN +ASM_SIMP_TAC[REAL_ARITH ` a * &1 = a `] THEN +CONV_TAC VECTOR_ARITH);; + +let SET2_SU_EX = SET_RULE` {(a:A),b} SUBSET s <=> a IN s /\ b IN s `;; + +let GENERATING_POINT_IN_SET_AFF = prove(` ! a b. {a,b} SUBSET {x | ?ta tb. +ta + tb = &1 /\ x = ta % a + tb % b}`,REWRITE_TAC[SET2_SU_EX; IN_ELIM_THM] +THEN REPEAT GEN_TAC THEN +MESON_TAC[REAL_ARITH` &0 + &1 = &1 /\ a + b = b + a`; VECTOR_ARITH ` + a = &0 % b + &1 % a /\ a = &1 % a + &0 % b `]);; + + +let AFF_2POINTS_INTERPRET = prove(`!a b. aff {a, b} = {x | ?ta tb. ta + tb = &1 /\ x = ta % a + tb % b}`, +REWRITE_TAC[aff; hull] THEN +REPEAT GEN_TAC THEN +REWRITE_TAC[GSYM SUBSET_ANTISYM_EQ] THEN +SIMP_TAC[INTERS_SUBSET; AFFINE_SET_GEN_BY_TWO_POINTS; + GENERATING_POINT_IN_SET_AFF] THEN +REWRITE_TAC[SUBSET; IN_ELIM_THM] THEN +REWRITE_TAC[SUBSET; IN_ELIM_THM; IN_INTERS; affine] THEN +SET_TAC[]);; + + +(* corrected with DISJOINT by thales *) + +let IN_AFF_GE_INTERPRET_TO_AFF_GT_AND_AFF = prove(` ! v v1 v2 v3 . + DISJOINT{v1,v2} {v3} ==> +(v IN aff_ge {v1,v2} {v3} <=> v IN aff_gt {v1,v2} {v3} \/ + v IN aff {v1,v2}) `, +REPEAT STRIP_TAC THEN +ASM_SIMP_TAC[simp_def2; AFF_2POINTS_INTERPRET; IN_ELIM_THM ] THEN +REWRITE_TAC [REAL_ARITH ` &0 <= a <=> &0 < a \/ a = &0 `] THEN +MESON_TAC[REAL_ARITH ` (&0 <= a <=> &0 < a \/ a = &0 )/\( a + &0 = a ) `; + VECTOR_ARITH ` a + &0 % c = a `]);; + +let DOWN_TAC = REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[IMP_IMP] THEN PHA;; +let IMP_IMP_TAC = REWRITE_TAC[IMP_IMP] THEN PHA;; + + +let AFFINE_AFF_HULL = prove(` ! s. affine ( aff s ) `, +REWRITE_TAC[aff; AFFINE_AFFINE_HULL]);; + + +let AFFINE_CONTAIN_LINE = prove(`! a b s. affine s /\ {a,b} SUBSET s ==> + aff {a,b} SUBSET s `, +REWRITE_TAC[affine ; AFF_2POINTS_INTERPRET; IN_ELIM_THM] THEN SET_TAC[]);; + +let VECTOR_SUB_DISTRIBUTE = VECTOR_ARITH ` ! a x y. a % x - a % y = a % ( x - y ) `;; + + +let CHANGE_SIDE = prove(` ~( a = &0 ) ==> ( x = a % y <=> ( &1 / a) % x = y )`, +MESON_TAC[ VECTOR_ARITH ` ( a * b ) % x = a % b % x `; VECTOR_MUL_LID; + REAL_FIELD `~( a = &0 ) ==> a * &1 / a = &1 `; VECTOR_MUL_LCANCEL]);; + + +let PRE_INVERSE_SUB = prove(` ! a b v w. {a, b} SUBSET aff {v, w} /\ ~(a = b) + ==> {v, w} SUBSET aff {a, b}`, +REWRITE_TAC[AFF_2POINTS_INTERPRET; SET2_SU_EX; IN_ELIM_THM] THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN +REWRITE_TAC[IMP_IMP] THEN PHA THEN +NHANH (MESON[]` (a:real^N) = b /\ gg /\ a' = b' /\ ll ==> a - a' = b - b' `) THEN +REWRITE_TAC[VECTOR_ARITH` (ta % v + tb % w) - (ta' % v + tb' % w) = + ( ta - ta') % v + ( tb - tb' ) % w `] THEN +PHA THEN REWRITE_TAC[MESON[]` a = &1 /\ b <=> b /\ a = &1 `] THEN PHA THEN +NHANH (REAL_ARITH ` ta + tb = &1 /\ ta' + tb' = &1 ==> ta' - ta = tb - tb' `) THEN +REWRITE_TAC[VECTOR_ARITH ` a + ( x - y ) % b = a - ( y - x) % b `] THEN +REWRITE_TAC[MESON[]` a - b = ta % v - tb % w /\aa/\ + ta = tb <=> a - b = ta % v - ta % w /\ aa /\ ta = tb `] THEN +ASM_CASES_TAC `(ta:real) = ta' ` THENL [ASM_SIMP_TAC[REAL_SUB_REFL; +VECTOR_MUL_LZERO; VECTOR_SUB_RZERO; VECTOR_SUB_EQ] THEN MESON_TAC[]; ALL_TAC] THEN +REWRITE_TAC[VECTOR_SUB_DISTRIBUTE] THEN FIRST_X_ASSUM MP_TAC THEN +ONCE_REWRITE_TAC[REAL_ARITH` ~( a = b) <=> ~( a - b = &0 )`] THEN IMP_IMP_TAC THEN +REWRITE_TAC[MESON[]` ~( a = b:real) /\ l <=> l /\ ~(a = b) `; MESON[]` +a = d % b /\ l <=> l /\ a = d % b `] THEN PHA THEN +REWRITE_TAC[MESON[CHANGE_SIDE]` x = a % y /\ ~( a = &0 ) <=> &1 / a % x = y /\ + ~( a = &0 )`] THEN NHANH (MESON[VECTOR_MUL_LCANCEL]` ta - ta' = tb' - tb /\ + a = b /\ l ==> tb % a = tb % b /\ ta % a = ta % b `) THEN +ONCE_REWRITE_TAC[MESON[]` a = (b:real^n) /\ l <=> l /\ a = b `] THEN PHA +THEN REWRITE_TAC[GSYM VECTOR_SUB_DISTRIBUTE] THEN +ONCE_REWRITE_TAC[VECTOR_ARITH` a = (b:real^N) /\ a1 = (b1:real^N) /\ a2 = + (b2:real^N) <=> a2 = b2 /\ a + a2 = b + b2 /\ a2 - a1 = b2 - b1 `] THEN +REWRITE_TAC[VECTOR_ARITH` (ta % v + tb % w) - (ta % v - ta % w) = ( ta + tb ) % w `; + VECTOR_ARITH` tb % v - tb % w + ta % v + tb % w = ( ta + tb ) % v `] THEN +REWRITE_TAC[VECTOR_MUL_ASSOC; VECTOR_ARITH` a - ( x % a - y % b ) = +(&1 - x ) % a + y % b `] THEN REWRITE_TAC[VECTOR_ARITH` a % x - b % y + x = +(a + &1 ) % x + --b % y `] THEN +REWRITE_TAC[MESON[]` a = &1 /\ b = &1 /\ l <=> a = &1 /\ l /\b = &1 `] THEN +DAO THEN MATCH_MP_TAC (MESON[]`( a1 /\a2/\a3/\a5 ==> l) ==> +(a1/\a2/\a3/\a4/\a5/\a6 ==> l ) `) THEN PURE_ONCE_REWRITE_TAC[ MESON[]` + a + b = &1 /\ P ( a + b ) <=> a + b = &1 /\ P (&1) `] THEN +REWRITE_TAC[VECTOR_MUL_LID] THEN MESON_TAC[REAL_FIELD ` ~(ta - ta' = &0) + ==> (tb * &1 / (ta - ta') + &1) + --(tb * &1 / (ta - ta')) = &1 /\ + &1 - ta * &1 / (ta - ta') + ta * &1 / (ta - ta') = &1 `]);; + + + +let LEMMA5 = prove( +`!(a:real^N) b x. line x /\ {a, b} SUBSET x /\ ~(a = b) ==> x = aff {a, b}`, +REWRITE_TAC[line; GSYM aff] THEN REPEAT GEN_TAC THEN STRIP_TAC THEN +REWRITE_TAC[GSYM SUBSET_ANTISYM_EQ] THEN ASM_SIMP_TAC[AFFINE_AFF_HULL; +AFFINE_CONTAIN_LINE] THEN STRIP_TR THEN +ABBREV_TAC ` (ki : bool ) = aff {(v:real^N), (w:real^N)} + SUBSET aff {(a:real^N), (b:real^N)}` THEN +REWRITE_TAC[MESON[]` a/\b/\c ==> d <=> b ==> a/\c ==> d `] THEN SIMP_TAC[] +THEN DISCH_TAC THEN IMP_IMP_TAC THEN +NHANH (MESON[PRE_INVERSE_SUB]`{a, b} SUBSET aff {v, w} /\ aa /\ ~(a = b) + ==> {v, w} SUBSET aff {a, b} `) THEN +NHANH (MESON[AFFINE_AFF_HULL]` aa /\ v SUBSET aff {a, b} ==> affine (aff {a,b})`) +THEN DOWN_TAC THEN MESON_TAC[AFFINE_CONTAIN_LINE]);; + +let RCEABUJ = LEMMA5;; + + +let COL_EQ_UPS_0 = GEN_ALL (MESON[FHFMKIY]` collinear {(v1:real^3), v2, v3} <=> + ups_x (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v2,v3) pow 2) = &0`);; + + + +let EQ_POW2_COND = prove(`!a b. &0 <= a /\ &0 <= b ==> (a = b <=> a pow 2 = b pow 2)`, +REWRITE_TAC[REAL_ARITH` a = b <=> a <= b /\ b <= a `] THEN SIMP_TAC[POW2_COND]);; + + +let D3_POS_LE = MESON[dist3; DIST_POS_LE]` ! x y. &0 <= dist3 x y `;; + + +let delta_x12 = new_definition ` delta_x12 x12 x13 x14 x23 x24 x34 = + -- x13 * x23 + -- x14 * x24 + x34 * ( -- x12 + x13 + x14 + x23 + x24 + -- x34 ) + + -- x12 * x34 + x13 * x24 + x14 * x23 `;; + +let delta_x13 = new_definition` delta_x13 x12 x13 x14 x23 x24 x34 = + -- x12 * x23 + -- x14 * x34 + x12 * x34 + x24 * ( x12 + -- x13 + x14 + x23 + + -- x24 + x34 ) + -- x13 * x24 + x14 * x23 `;; + +let delta_x14 = new_definition`delta_x14 x12 x13 x14 x23 x24 x34 = + --x12 * x24 + + --x13 * x34 + + x12 * x34 + + x13 * x24 + + x23 * (x12 + x13 + --x14 + --x23 + x24 + x34) + + --x14 * x23`;; + + + +let DIST_POW2_DOT = +prove(` ! a (b:real^N) . dist (a,b) pow 2 = ( a - b ) dot ( a- b) `, +SIMP_TAC[dist; vector_norm; DOT_POS_LE; SQRT_WORKS]);; + + +(* REMOVED. thales +(* the following lemma is in Multivariate/convex.ml *) +let AFFINE_HULL_3 = new_axiom_removed` affine hull {a,b,c} = + { u % a + v % b + w % c | u + v + w = &1}`;; +*) + +let LET_TR = CONV_TAC (TOP_DEPTH_CONV let_CONV);; + + +(* BEGINING *) +(* lemma 16 SDIHJZK *) + +let TO_UYCH = prove(` &0 < ups_x a12 a13 a23 ==> + delta_x12 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 + + delta_x13 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 + + delta_x14 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 = + &1 `, +REWRITE_TAC[ups_x; delta_x12; delta_x13; delta_x14] THEN CONV_TAC REAL_FIELD);; + + + + +let NOT_UPS_X_ZERO_IMP_SMT = prove(`~(ups_x a12 a13 a23 = &0) + ==> (delta_x13 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23) pow 2 * a12 + + delta_x13 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 * + delta_x14 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 * + (a12 + a13 - a23) + + (delta_x14 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23) pow 2 * a13 + = + a01 - delta a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 /\ + +(delta_x14 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23) pow 2 * a23 + + delta_x14 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 * + delta_x12 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 * + (a23 + a12 - a13) + + (delta_x12 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23) pow 2 * a12 + = + a02 - delta a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 /\ + +(delta_x12 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23) pow 2 * a13 + + delta_x12 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 * + delta_x13 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23 * + (a13 + a23 - a12) + + (delta_x13 a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23) pow 2 * a23 = + a03 - delta a01 a02 a03 a12 a13 a23 / ups_x a12 a13 a23`, +ONCE_REWRITE_TAC[REAL_FIELD` ~( a = &0 ) ==> ( x = y ) /\ ( xx = yy ) /\ ( xxx = yyy) + <=> ~( a = &0 ) ==> ( x * a pow 2 = y * a pow 2 ) /\ + ( xx * a pow 2 = yy * a pow 2 ) /\ + ( xxx * a pow 2 = yyy * a pow 2 ) `] THEN +SIMP_TAC[REAL_FIELD` ~( a = &0 ) ==> ( b - c / a ) * a pow 2 = b * a pow 2 - c * a ` + ; REAL_ADD_RDISTRIB] THEN +SIMP_TAC[REAL_ARITH` ( a * b ) * c = a * b * c `; + REAL_FIELD` ~ ( a = &0 ) ==> ( b / a ) pow 2 * c * a pow 2 = + b pow 2 * c `; REAL_FIELD ` ~ ( a = &0 ) ==> b / a * c / a * d * + a pow 2 = b * c * d `] THEN DISCH_TAC THEN +REWRITE_TAC[delta_x12; delta_x13; delta_x14; delta; ups_x] THEN REAL_ARITH_TAC);; + + +let TROI_OI_DAT_HOI = MESON[ lemma8; dist; DIST_SYM]` &0 <= + ups_x ( dist((v1:real^3),v2) pow 2) (dist(v2,v3) pow 2) + (dist(v1,v3) pow 2)`;; + + + +let ZERO_LE_UPS_X = MESON[TROI_OI_DAT_HOI; dist3; DIST_SYM]` + &0 <= ups_x (dist3 x y pow 2) (dist3 x z pow 2) (dist3 y z pow 2) `;; + + +let UPS_X_EQ_ZERO_COND = prove(` ! v1 v2 (v3: real^3). (collinear {v1, v2, v3} <=> + ups_x (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) + (dist (v2,v3) pow 2) = + &0) `, +MP_TAC FHFMKIY THEN MESON_TAC[]);; + + + +let NORM_POW2_SUM2 = prove(` norm ( a % x + b % y ) pow 2 = + a pow 2 * norm x pow 2 + &2 * ( a * b ) * ( x dot y ) + + b pow 2 * norm y pow 2 `, REWRITE_TAC[vector_norm] THEN +SIMP_TAC[DOT_POS_LE; SQRT_WORKS] THEN CONV_TAC VECTOR_ARITH);; + + + +let X_DOT_X_EQ = prove( ` x dot x = norm x pow 2 `, +SIMP_TAC[vector_norm; DOT_POS_LE; SQRT_WORKS]);; + + + +let SUB_DIST_POW2_INTERPRETE = prove(`! x y (v:real^N) c. +dist(x,v) pow 2 - dist(y,v) pow 2 = c <=> +( &2 % v - ( x + y )) dot ( y - x ) = c `, +SIMP_TAC[DIST_POW2_DOT; DOT_SUB_ADD; VECTOR_ARITH` + (x - v - (y - v)) dot (x - v + y - v) = (&2 % v - (x + y)) dot (y - x) `]);; + +let D3_SYM = MESON[trg_dist3_sym]` ! x y. dist3 x y = dist3 y x `;; + +let REAL_DIV_LZERO = prove( + `!x. &0 / x = &0`, + REPEAT GEN_TAC THEN REWRITE_TAC[real_div; REAL_MUL_LZERO]);; + +let SDIHJZK = prove(`! (v1:real^3) v2 v3 (a01: real) a02 a03. + ~collinear {v1, v2, v3} /\ + (let x12 = dist3 v1 v2 pow 2 in + let x13 = dist3 v1 v3 pow 2 in + let x23 = dist3 v2 v3 pow 2 in delta a01 a02 a03 x12 x13 x23 = &0) + ==> (?!v0. a01 = dist3 v0 v1 pow 2 /\ + a02 = dist3 v0 v2 pow 2 /\ + a03 = dist3 v0 v3 pow 2 /\ + (let x12 = dist3 v1 v2 pow 2 in + let x13 = dist3 v1 v3 pow 2 in + let x23 = dist3 v2 v3 pow 2 in + let vv = ups_x x12 x13 x23 in + let t1 = delta_x12 a01 a02 a03 x12 x13 x23 / vv in + let t2 = delta_x13 a01 a02 a03 x12 x13 x23 / vv in + let t3 = delta_x14 a01 a02 a03 x12 x13 x23 / vv in + v0 = t1 % v1 + t2 % v2 + t3 % v3 /\ t1 + t2 + t3 = &1 ))`, +REPEAT GEN_TAC THEN +LET_TR THEN +STRIP_TAC THEN +REWRITE_TAC[EXISTS_UNIQUE] THEN +EXISTS_TAC ` delta_x12 a01 a02 a03 (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) + (dist3 v2 v3 pow 2) / + ups_x (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) (dist3 v2 v3 pow 2) % + v1 + + delta_x13 a01 a02 a03 (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) + (dist3 v2 v3 pow 2) / + ups_x (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) (dist3 v2 v3 pow 2) % + v2 + + delta_x14 a01 a02 a03 (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) + (dist3 v2 v3 pow 2) / + ups_x (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) (dist3 v2 v3 pow 2) % + v3 ` THEN +UNDISCH_TAC `~collinear {(v1:real^3), v2, v3}` THEN +MP_TAC (GEN_ALL ZERO_LE_UPS_X) THEN +REWRITE_TAC[UPS_X_EQ_ZERO_COND] THEN +REWRITE_TAC[MESON[]` a ==> b ==> c <=> a /\ b ==> c `; dist3] THEN +NHANH (MESON[REAL_ARITH ` &0 <= a <=> &0 < a \/ a = &0 `]` + (!(x:real^3) y z. + &0 <= ups_x (dist (x,y) pow 2) (dist (x,z) pow 2) (dist (y,z) pow 2)) /\ + ~(ups_x (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v2,v3) pow 2) = &0) + ==> &0 < ups_x (dist ((v1:real^3),v2) pow 2) (dist (v1,v3) pow 2) (dist (v2,v3) pow 2) `) THEN +REWRITE_TAC[ GSYM dist3] THEN +STRIP_TAC THEN +CONJ_TAC THENL [ + +UNDISCH_TAC ` &0 < ups_x (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) (dist3 v2 v3 pow 2)` THEN +ABBREV_TAC ` a12 = dist3 v1 v2 pow 2 ` THEN ABBREV_TAC ` a13 = dist3 v1 v3 pow 2 ` THEN +ABBREV_TAC ` a23 = dist3 v2 v3 pow 2 ` THEN SIMP_TAC[TO_UYCH] THEN +REWRITE_TAC[MESON[dist3; dist] ` aa = dist3 a b pow 2 <=> aa = norm ( a- b ) pow 2 `] THEN +ONCE_REWRITE_TAC[VECTOR_ARITH ` a - b = a - &1 % b `] THEN +NHANH (GSYM TO_UYCH) THEN SIMP_TAC[] THEN +SIMP_TAC[VECTOR_ARITH ` (a % v1 + b % v2 + c % v3) - (a + b + c) % v2 = + (b % v2 + c % v3 + a % v1) - (b + c + a) % v2 /\ + (a % v1 + b % v2 + c % v3) - (a + b + c) % v3 = + (c % v3 + a % v1 + b % v2 ) - ( c + a + b ) % v3 `] THEN +REWRITE_TAC[VECTOR_ARITH` ( a % v1 + b % v2 + c % v3) - + ( a + b + c ) % v1 = b % ( v2 - v1 ) + c % ( v3 - v1 ) `] THEN +REWRITE_TAC[NORM_POW2_SUM2 ; REAL_ARITH ` &2 * ( a * b ) * c = a * b * &2 * c `] THEN +REWRITE_TAC[VECTOR_ARITH ` &2 * ( x dot y ) = x dot x + y dot y - ( x - y ) dot ( x - y ) `] THEN +REWRITE_TAC[VECTOR_ARITH` v1 - v3 - (v2 - v3) = (v1:real^3) - v2 `] THEN +REWRITE_TAC[X_DOT_X_EQ; GSYM dist; GSYM dist3] THEN +SIMP_TAC[D3_SYM] THEN ASM_SIMP_TAC[] THEN STRIP_TAC THEN +UNDISCH_TAC ` ~(ups_x a12 a13 a23 = &0)` THEN NHANH NOT_UPS_X_ZERO_IMP_SMT THEN +ASM_SIMP_TAC[REAL_DIV_LZERO; REAL_SUB_RZERO]; +MESON_TAC[]]);; + + + +let HALF_OF_LE16 = prove(` ! (v1:real^3) v2 v3 (a01: real) a02 a03. + ~collinear {v1, v2, v3} /\ + (let x12 = dist3 v1 v2 pow 2 in + let x13 = dist3 v1 v3 pow 2 in + let x23 = dist3 v2 v3 pow 2 in delta a01 a02 a03 x12 x13 x23 = &0) +==> ?v0. (v0 IN aff {v1, v2, v3} /\ + a01 = dist3 v0 v1 pow 2 /\ + a02 = dist3 v0 v2 pow 2 /\ + a03 = dist3 v0 v3 pow 2 /\ + (let x12 = dist3 v1 v2 pow 2 in + let x13 = dist3 v1 v3 pow 2 in + let x23 = dist3 v2 v3 pow 2 in + let vv = ups_x x12 x13 x23 in + let t1 = delta_x12 a01 a02 a03 x12 x13 x23 / vv in + let t2 = delta_x13 a01 a02 a03 x12 x13 x23 / vv in + let t3 = delta_x14 a01 a02 a03 x12 x13 x23 / vv in + v0 = t1 % v1 + t2 % v2 + t3 % v3)) `, +REPEAT GEN_TAC THEN LET_TR THEN STRIP_TAC THEN REWRITE_TAC[EXISTS_UNIQUE] THEN +EXISTS_TAC ` delta_x12 a01 a02 a03 (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) + (dist3 v2 v3 pow 2) / + ups_x (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) (dist3 v2 v3 pow 2) % + v1 + + delta_x13 a01 a02 a03 (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) + (dist3 v2 v3 pow 2) / + ups_x (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) (dist3 v2 v3 pow 2) % + v2 + + delta_x14 a01 a02 a03 (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) + (dist3 v2 v3 pow 2) / + ups_x (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) (dist3 v2 v3 pow 2) % + v3 ` THEN +UNDISCH_TAC `~collinear {(v1:real^3), v2, v3}` THEN +MP_TAC (GEN_ALL ZERO_LE_UPS_X) THEN +REWRITE_TAC[UPS_X_EQ_ZERO_COND] THEN +REWRITE_TAC[MESON[]` a ==> b ==> c <=> a /\ b ==> c `; dist3] THEN +NHANH (MESON[REAL_ARITH ` &0 <= a <=> &0 < a \/ a = &0 `]` + (!(x:real^3) y z. + &0 <= ups_x (dist (x,y) pow 2) (dist (x,z) pow 2) (dist (y,z) pow 2)) /\ + ~(ups_x (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v2,v3) pow 2) = &0) + ==> &0 < ups_x (dist ((v1:real^3),v2) pow 2) (dist (v1,v3) pow 2) (dist (v2,v3) pow 2) `) THEN +REWRITE_TAC[ GSYM dist3] THEN +STRIP_TAC THEN +UNDISCH_TAC ` &0 < ups_x (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) (dist3 v2 v3 pow 2)` THEN +ABBREV_TAC ` a12 = dist3 v1 v2 pow 2 ` THEN ABBREV_TAC ` a13 = dist3 v1 v3 pow 2 ` THEN +ABBREV_TAC ` a23 = dist3 v2 v3 pow 2 ` THEN SIMP_TAC[TO_UYCH] THEN +REWRITE_TAC[MESON[dist3; dist] ` aa = dist3 a b pow 2 <=> aa = norm ( a- b ) pow 2 `] THEN +ONCE_REWRITE_TAC[VECTOR_ARITH ` a - b = a - &1 % b `] THEN +NHANH (GSYM TO_UYCH) THEN SIMP_TAC[] THEN +SIMP_TAC[VECTOR_ARITH ` (a % v1 + b % v2 + c % v3) - (a + b + c) % v2 = + (b % v2 + c % v3 + a % v1) - (b + c + a) % v2 /\ + (a % v1 + b % v2 + c % v3) - (a + b + c) % v3 = + (c % v3 + a % v1 + b % v2 ) - ( c + a + b ) % v3 `] THEN +REWRITE_TAC[VECTOR_ARITH` ( a % v1 + b % v2 + c % v3) - + ( a + b + c ) % v1 = b % ( v2 - v1 ) + c % ( v3 - v1 ) `] THEN +REWRITE_TAC[NORM_POW2_SUM2 ; REAL_ARITH ` &2 * ( a * b ) * c = a * b * &2 * c `] THEN +REWRITE_TAC[VECTOR_ARITH ` &2 * ( x dot y ) = x dot x + y dot y - ( x - y ) dot ( x - y ) `] THEN +REWRITE_TAC[VECTOR_ARITH` v1 - v3 - (v2 - v3) = (v1:real^3) - v2 `] THEN +REWRITE_TAC[X_DOT_X_EQ; GSYM dist; GSYM dist3] THEN +SIMP_TAC[D3_SYM] THEN ASM_SIMP_TAC[] THEN STRIP_TAC THEN +UNDISCH_TAC ` ~(ups_x a12 a13 a23 = &0)` THEN NHANH NOT_UPS_X_ZERO_IMP_SMT THEN +ASM_SIMP_TAC[REAL_DIV_LZERO; REAL_SUB_RZERO] THEN +REWRITE_TAC[aff; AFFINE_HULL_3; IN_ELIM_THM] THEN ASM_MESON_TAC[]);; + + + + +let EQ_SUB_DIST_POW2_IMP_IDENTIFIED = prove(` ! v1 v2 v3 (u:real^N) w. +{u,w} SUBSET affine hull {v1,v2,v3} /\ +dist (u,v2) pow 2 - dist (u,v1) pow 2 = dist (w,v2) pow 2 - dist (w,v1) pow 2 /\ +dist (u,v3) pow 2 - dist (u,v1) pow 2 = dist (w,v3) pow 2 - dist (w,v1) pow 2 ==> +w = u `, +REPEAT GEN_TAC THEN ONCE_REWRITE_TAC[DIST_SYM] THEN +SIMP_TAC[SUB_DIST_POW2_INTERPRETE ] THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +SIMP_TAC[SUB_DIST_POW2_INTERPRETE ] THEN +ONCE_REWRITE_TAC[REAL_ARITH` a = b <=> a - b = &0 `] THEN +SIMP_TAC[GSYM DOT_LSUB] THEN +SIMP_TAC[GSYM DOT_LSUB; VECTOR_ARITH` a - b - ( aa - b ) = + (a:real^N) - aa `; GSYM VECTOR_SUB_LDISTRIB; AFFINE_HULL_3; + SET2_SU_EX; IN_ELIM_THM] THEN STRIP_TAC THEN +REPEAT (FIRST_X_ASSUM MP_TAC ) THEN +REWRITE_TAC[MESON[]` a ==> b ==> c <=> b /\ a ==> c `] THEN +NHANH (MESON[]` a = (aa:real^N) /\ la /\ b = bb /\ lb ==> + a - b = aa - bb `) THEN +REWRITE_TAC[REAL_ARITH` a + b = &1 <=> a = &1 - b `] THEN PHA THEN +STRIP_TAC THEN FIRST_X_ASSUM MP_TAC THEN UNDISCH_TAC`u' = &1 - (v + w')` THEN +UNDISCH_TAC`u'' = &1 - (v' + w'')` THEN SIMP_TAC[] THEN +SIMP_TAC[VECTOR_ARITH` ((&1 - (v' + w'')) % v1 + v' % v2 + w'' % v3) - + ((&1 - (v + w')) % v1 + v % v2 + w' % v3) = + ( v - v' ) % ( v1 - v2 ) + (w' - w'' ) % ( v1 - v3 ) `] THEN +REPEAT STRIP_TAC THEN +ONCE_REWRITE_TAC[VECTOR_ARITH ` a = b <=> b - a = vec 0` ] THEN +REWRITE_TAC[GSYM DOT_EQ_0] THEN FIRST_X_ASSUM MP_TAC THEN +REWRITE_TAC[MESON[]` a = b ==> a dot a = &0 <=> a = b ==> + a dot b = &0 `] THEN +REWRITE_TAC[DOT_RADD; DOT_RMUL; REAL_ARITH ` a * ( b dot c ) + aa * bb = &0 + <=> a * &2 * ( b dot c ) + aa * &2 * bb = &0 `] THEN +ONCE_REWRITE_TAC[GSYM DOT_LMUL] THEN +ABBREV_TAC ` as = &2 % ((w:real^N) - u) dot (v1 - v2)` THEN +ABBREV_TAC ` bs = &2 % ((w:real^N) - u) dot (v1 - v3)` THEN +DISCH_TAC THEN ASM_SIMP_TAC[] THEN REAL_ARITH_TAC);; + +(* lemma 16 SDIHJZK *) + +let SDIHJZK = prove(`! (v1:real^3) v2 v3 (a01: real) a02 a03. + ~collinear {v1, v2, v3} /\ + (let x12 = dist3 v1 v2 pow 2 in + let x13 = dist3 v1 v3 pow 2 in + let x23 = dist3 v2 v3 pow 2 in delta a01 a02 a03 x12 x13 x23 = &0) + ==> (?v0. v0 IN aff {v1,v2,v3} /\ + a01 = dist3 v0 v1 pow 2 /\ + a02 = dist3 v0 v2 pow 2 /\ + a03 = dist3 v0 v3 pow 2 /\ + (! vv0. vv0 IN aff {v1,v2,v3} /\ + a01 = dist3 vv0 v1 pow 2 /\ + a02 = dist3 vv0 v2 pow 2 /\ + a03 = dist3 vv0 v3 pow 2 ==> vv0 = v0 ) /\ + (let x12 = dist3 v1 v2 pow 2 in + let x13 = dist3 v1 v3 pow 2 in + let x23 = dist3 v2 v3 pow 2 in + let vv = ups_x x12 x13 x23 in + let t1 = delta_x12 a01 a02 a03 x12 x13 x23 / vv in + let t2 = delta_x13 a01 a02 a03 x12 x13 x23 / vv in + let t3 = delta_x14 a01 a02 a03 x12 x13 x23 / vv in + v0 = t1 % v1 + t2 % v2 + t3 % v3))`, +REPEAT GEN_TAC THEN NHANH (SPEC_ALL HALF_OF_LE16 ) THEN STRIP_TAC THEN +EXISTS_TAC `v0:real^3` THEN ASM_SIMP_TAC[] THEN +GEN_TAC THEN UNDISCH_TAC ` (v0:real^3) IN aff {v1, v2, v3}` THEN +ONCE_REWRITE_TAC[REAL_ARITH ` a1 = b1 /\ a2 = b2 /\ a3 = b3 <=> + a2 - a1 = b2 - b1 /\ a3 - a1 = b3 - b1 /\ a1 = b1 `] THEN +REWRITE_TAC[aff; SET2_SU_EX] THEN REWRITE_TAC[dist3] THEN +PHA THEN MESON_TAC[SET2_SU_EX; EQ_SUB_DIST_POW2_IMP_IDENTIFIED]);; + + + +let SDIHJZK_INTERPRETE = prove(`!(v1:real^3) v2 v3 a01 a02 a03. + ~collinear {v1, v2, v3} /\ + delta a01 a02 a03 (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) (dist3 v2 v3 pow 2) = + &0 + ==> (?v0. v0 IN aff {v1, v2, v3} /\ + a01 = dist3 v0 v1 pow 2 /\ + a02 = dist3 v0 v2 pow 2 /\ + a03 = dist3 v0 v3 pow 2 /\ + (!vv0. vv0 IN aff {v1, v2, v3} /\ + a01 = dist3 vv0 v1 pow 2 /\ + a02 = dist3 vv0 v2 pow 2 /\ + a03 = dist3 vv0 v3 pow 2 + ==> vv0 = v0) /\ + v0 = + delta_x12 a01 a02 a03 (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) + (dist3 v2 v3 pow 2) / + ups_x (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) (dist3 v2 v3 pow 2) % + v1 + + delta_x13 a01 a02 a03 (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) + (dist3 v2 v3 pow 2) / + ups_x (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) (dist3 v2 v3 pow 2) % + v2 + + delta_x14 a01 a02 a03 (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) + (dist3 v2 v3 pow 2) / + ups_x (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) (dist3 v2 v3 pow 2) % + v3)`, MP_TAC SDIHJZK THEN LET_TR THEN SIMP_TAC[]);; + + + +let DELTA_RRR_INTERPRETE = prove(` delta r r r a b c = -- a * b * c + r * ups_x a b c `, +REWRITE_TAC[delta; ups_x] THEN REAL_ARITH_TAC);; + + +let NOT_UPS_X_EQ_0_IMP = prove(` ~( ups_x a b c = &0 ) + ==> delta ( ( a * b * c ) / ups_x a b c ) ( ( a * b * c ) / ups_x a b c ) + ( ( a * b * c ) / ups_x a b c ) a b c = &0 `, +REWRITE_TAC[DELTA_RRR_INTERPRETE ] THEN CONV_TAC REAL_FIELD);; + + + + +let COL_EQ_UPS_0 = GEN_ALL (MESON[FHFMKIY]` collinear {(v1:real^3), v2, v3} <=> + ups_x (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v2,v3) pow 2) = &0`);; + + +(* CDEUSDF POST ZERO_LE_UPS_X *) + + +let REAL_LE_SQUARE_POW = +MESON[REAL_POW_2; REAL_LE_SQUARE]`! x. &0 <= x pow 2 `;; + + +let PROVE_EXISTS_RADV = prove(`!(va:real^3) vb vc. + ~collinear {va, vb, vc} + ==> (?p. p IN affine hull {va, vb, vc} /\ + (?c. ( !w. w IN {va, vb, vc} ==> c = dist (p,w)) /\ + (!p'. p' IN affine hull {va, vb, vc} /\ + ( !w. w IN {va, vb, vc} ==> c = dist (p',w)) + ==> p = p'))) `, +REWRITE_TAC[COL_EQ_UPS_0] THEN +NHANH (NOT_UPS_X_EQ_0_IMP ) THEN +REWRITE_TAC[GSYM COL_EQ_UPS_0] THEN +REWRITE_TAC[GSYM dist3] THEN +NHANH (SPEC_ALL SDIHJZK_INTERPRETE) THEN +REWRITE_TAC[EXISTS_UNIQUE] THEN +REPEAT STRIP_TAC THEN +ABBREV_TAC ` r = (dist3 va vb pow 2 * dist3 va vc pow 2 * dist3 vb vc pow 2) / + ups_x (dist3 va vb pow 2) (dist3 va vc pow 2) (dist3 vb vc pow 2) ` THEN +EXISTS_TAC ` v0 :real^3` THEN +UNDISCH_TAC ` (v0:real^3) IN aff {va, vb, vc}` THEN +SIMP_TAC[aff; SET_RULE ` (! x. x IN {a,b,c} ==> P x ) <=> + P a /\ P b /\ P c `] THEN +DISCH_TAC THEN EXISTS_TAC ` sqrt ( r ) ` THEN +UNDISCH_TAC ` (dist3 va vb pow 2 * dist3 va vc pow 2 * dist3 vb vc pow 2) / + ups_x (dist3 va vb pow 2) (dist3 va vc pow 2) (dist3 vb vc pow 2) = r` THEN +NHANH (MESON[REAL_LE_SQUARE_POW; REAL_LE_DIV; REAL_LE_MUL; + ZERO_LE_UPS_X ]` (dist3 va vb pow 2 * dist3 va vc pow 2 * dist3 vb vc pow 2) / + ups_x (dist3 va vb pow 2) (dist3 va vc pow 2) (dist3 vb vc pow 2) = + r ==> &0 <= r `) THEN +SIMP_TAC[SQRT_WORKS; EQ_POW2_COND; D3_POS_LE] THEN +ASM_MESON_TAC[aff]);; + + + + +let COND_FOR_CIRCUMCENTER_PROPERTIESS = prove(`~collinear {(v1:real^3), v2, v3} + ==> circumcenter {v1, v2, v3} IN affine hull {v1, v2, v3} /\ + (?c. !v. v IN {v1, v2, v3} ==> c = dist (circumcenter {v1, v2, v3}, v))`, +NHANH (MESON[PROVE_EXISTS_RADV]`~collinear {(va:real^3), vb, vc} + ==> (?p. p IN affine hull {va, vb, vc} /\ + (?c. (!w. w IN {va, vb, vc} ==> c = dist (p,w)))) `) THEN +REWRITE_TAC[IN; circumcenter] THEN MESON_TAC[EXISTS_THM]);; + + +let DELTA_X14_RRR = prove(` delta_x14 r r r a b c = a * ( b + c - a ) `, +REWRITE_TAC[delta_x14] THEN REAL_ARITH_TAC);; + + +let DELTA_X1I_RRR = prove(` delta_x12 r r r a b c = c * ( b + a - c ) /\ + delta_x13 r r r a b c = b * ( c + a - b ) /\ + delta_x14 r r r a b c = a * (c + b - a) `, +REWRITE_TAC[delta_x12; delta_x13; delta_x14] THEN REAL_ARITH_TAC);; + + + + + +let PRE_RADV_COND = prove(` ~ collinear {va,vb,vc} ==> +(? c. ! w. {va,vb,(vc:real^3)} w ==> c = dist(circumcenter {va,vb,vc} , w )) `, +NHANH (COND_FOR_CIRCUMCENTER_PROPERTIESS ) THEN MESON_TAC[IN]);; + + +let NOT_COL_IMP_RADV_PROPERTIY = prove(` ~collinear {(va:real^3), vb, vc} + ==> ( ! w. {va, vb, vc} w ==> + radV {va, vb, vc} = dist (circumcenter {va, vb, vc},w)) `, +NHANH (PRE_RADV_COND ) THEN SIMP_TAC[EXISTS_THM; radV]);; + + + + +let CIRCUMCENTER_FORMULAR2 = prove(`! (va:real^3) vb vc a b c. + a = dist3 vb vc /\ b = dist3 va vc /\ c = dist3 va vb /\ ~collinear {va, vb, vc} + ==> + (let al_a = + (a pow 2 * (b pow 2 + c pow 2 - a pow 2)) / + (ups_x (a pow 2) (b pow 2) (c pow 2)) in + let al_b = + (b pow 2 * (a pow 2 + c pow 2 - b pow 2)) / + (ups_x (a pow 2) (b pow 2) (c pow 2)) in + let al_c = + (c pow 2 * (a pow 2 + b pow 2 - c pow 2)) / + (ups_x (a pow 2) (b pow 2) (c pow 2)) in + al_a % va + al_b % vb + al_c % vc = circumcenter {va, vb, vc})`, +REWRITE_TAC[COL_EQ_UPS_0] THEN +NHANH (NOT_UPS_X_EQ_0_IMP) THEN +REWRITE_TAC[GSYM COL_EQ_UPS_0; GSYM dist3] THEN +NHANH (SPEC_ALL SDIHJZK_INTERPRETE ) THEN +REPEAT STRIP_TAC THEN +ABBREV_TAC ` r = (dist3 va vb pow 2 * dist3 va vc pow 2 * dist3 vb vc pow 2) / + ups_x (dist3 va vb pow 2) (dist3 va vc pow 2) (dist3 vb vc pow 2) ` THEN +UNDISCH_TAC ` v0 = + delta_x12 r r r (dist3 va vb pow 2) (dist3 va vc pow 2) (dist3 vb vc pow 2) / + ups_x (dist3 va vb pow 2) (dist3 va vc pow 2) (dist3 vb vc pow 2) % + va + + delta_x13 r r r (dist3 va vb pow 2) (dist3 va vc pow 2) (dist3 vb vc pow 2) / + ups_x (dist3 va vb pow 2) (dist3 va vc pow 2) (dist3 vb vc pow 2) % + vb + + delta_x14 r r r (dist3 va vb pow 2) (dist3 va vc pow 2) (dist3 vb vc pow 2) / + ups_x (dist3 va vb pow 2) (dist3 va vc pow 2) (dist3 vb vc pow 2) % + vc` THEN +LET_TR THEN +UNDISCH_TAC ` a = dist3 vb vc ` THEN +UNDISCH_TAC ` b = dist3 va vc ` THEN +UNDISCH_TAC ` c = dist3 va vb ` THEN +SIMP_TAC[DELTA_X1I_RRR] THEN +SIMP_TAC[MESON[UPS_X_SYM]` ups_x a b c = ups_x c b a `] THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +SIMP_TAC[] THEN +REPEAT STRIP_TAC THEN +UNDISCH_TAC ` ~collinear {(va:real^3), vb, vc} ` THEN +NHANH (COND_FOR_CIRCUMCENTER_PROPERTIESS) THEN +REWRITE_TAC[SET_RULE ` (! x. x IN {a,b,c} ==> P x ) + <=> P a /\ P b /\ P c `] THEN +REWRITE_TAC[SET_RULE ` (! x. x IN {a,b,c} ==> P x ) + <=> P a /\ P b /\ P c `; MESON[]` (? cc. cc = a /\ cc = b /\ cc = c) + <=> a = b /\ a = c `] THEN +UNDISCH_TAC ` v0 IN aff {va, vb, (vc:real^3)}` THEN +REWRITE_TAC[aff; SET_RULE ` a IN s ==> b /\ aa IN s /\ l ==> + ll <=> b ==> {a,aa} SUBSET s /\ l ==> ll `] THEN +DISCH_TAC THEN +UNDISCH_TAC` r = dist3 v0 va pow 2 ` THEN +UNDISCH_TAC` r = dist3 v0 vb pow 2 ` THEN +UNDISCH_TAC` r = dist3 v0 vc pow 2 ` THEN +REWRITE_TAC[MESON[]` r = a1 ==> r = a2 ==> r = a3 ==> l ==> ll <=> + r = a1 /\ l /\ a2 = a3 /\ a1 = a3 ==> ll `;dist3] THEN +ONCE_REWRITE_TAC[MESON[]` dist(a,b) = s <=> s = dist(a,b) `] THEN +SIMP_TAC[DIST_POS_LE; EQ_POW2_COND] THEN +ONCE_REWRITE_TAC[REAL_ARITH` a = b <=> a - b = &0 `] THEN +MESON_TAC[EQ_SUB_DIST_POW2_IMP_IDENTIFIED ]);; + +let REAL_LE_POW_2 = prove(` ! x. &0 <= x pow 2 `, +REWRITE_TAC[REAL_POW_2; REAL_LE_SQUARE]);; + + + +let NOT_COLL_IMP_RADV_FORMULAR = prove(`! (va:real^3) vb vc a b c. + a = dist3 vb vc /\ b = dist3 va vc /\ c = dist3 va vb /\ ~collinear {va, vb, vc} + ==> radV {va, vb, vc} = eta_y a b c`, +REWRITE_TAC[COL_EQ_UPS_0] THEN +NHANH (NOT_UPS_X_EQ_0_IMP) THEN +REWRITE_TAC[GSYM COL_EQ_UPS_0; GSYM dist3] THEN +NHANH (SPEC_ALL SDIHJZK_INTERPRETE ) THEN +REPEAT STRIP_TAC THEN +ABBREV_TAC ` r = (dist3 va vb pow 2 * dist3 va vc pow 2 * dist3 vb vc pow 2) / + ups_x (dist3 va vb pow 2) (dist3 va vc pow 2) (dist3 vb vc pow 2) ` THEN +LET_TR THEN +UNDISCH_TAC ` a = dist3 vb vc ` THEN +UNDISCH_TAC ` b = dist3 va vc ` THEN +UNDISCH_TAC ` c = dist3 va vb ` THEN +SIMP_TAC[DELTA_X1I_RRR] THEN +SIMP_TAC[MESON[UPS_X_SYM]` ups_x a b c = ups_x c b a `] THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +SIMP_TAC[] THEN +REPEAT STRIP_TAC THEN +UNDISCH_TAC ` ~collinear {(va:real^3), vb, vc} ` THEN +NHANH (COND_FOR_CIRCUMCENTER_PROPERTIESS) THEN +REWRITE_TAC[SET_RULE ` (! x. x IN {a,b,c} ==> P x ) + <=> P a /\ P b /\ P c `] THEN +REWRITE_TAC[SET_RULE ` (! x. x IN {a,b,c} ==> P x ) + <=> P a /\ P b /\ P c `; MESON[]` (? cc. cc = a /\ cc = b /\ cc = c) + <=> a = b /\ a = c `] THEN +UNDISCH_TAC ` v0 IN aff {va, vb, (vc:real^3)}` THEN +REWRITE_TAC[aff; SET_RULE ` a IN s ==> b /\ aa IN s /\ l ==> + ll <=> b ==> {a,aa} SUBSET s /\ l ==> ll `] THEN +DISCH_TAC THEN +UNDISCH_TAC` r = dist3 v0 va pow 2 ` THEN +UNDISCH_TAC` r = dist3 v0 vb pow 2 ` THEN +UNDISCH_TAC` r = dist3 v0 vc pow 2 ` THEN +REWRITE_TAC[MESON[]` r = a1 ==> r = a2 ==> r = a3 ==> l ==> ll <=> + r = a1 /\ l /\ a2 = a3 /\ a1 = a3 ==> ll `;dist3] THEN +ONCE_REWRITE_TAC[MESON[]` dist(a,b) = s <=> s = dist(a,b) `] THEN +SIMP_TAC[DIST_POS_LE; EQ_POW2_COND] THEN +ONCE_REWRITE_TAC[REAL_ARITH` a = b <=> a - b = &0 `] THEN +REWRITE_TAC[MESON[]` ( a /\ a1 = &0 /\ a2 = &0 ) /\ b1 = &0 /\ b2 = &0 <=> + b1 = &0 /\ b2 = &0 /\ a /\ b1 = a1 /\ b2 = a2 `] THEN +NHANH (SPEC_ALL EQ_SUB_DIST_POW2_IMP_IDENTIFIED ) THEN +STRIP_TAC THEN +UNDISCH_TAC ` ~collinear {(va:real^3), vb, vc}` THEN +NHANH (NOT_COL_IMP_RADV_PROPERTIY ) THEN +FIRST_X_ASSUM MP_TAC THEN +SIMP_TAC[] THEN +SIMP_TAC[SET_RULE ` (!w. {va, vb, vc} w ==> P w ) <=> + P va /\ P vb /\ P vc `] THEN +REPEAT STRIP_TAC THEN +EXPAND_TAC "a" THEN +EXPAND_TAC "b" THEN +EXPAND_TAC "c" THEN +UNDISCH_TAC ` r - dist ((v0:real^3),vc) pow 2 = &0 ` THEN +SIMP_TAC[REAL_ARITH` a - b = &0 <=> b = a `] THEN +EXPAND_TAC "r" THEN +REWRITE_TAC[eta_y; eta_x] THEN +LET_TR THEN +MP_TAC (GEN_ALL ZERO_LE_UPS_X) THEN +SIMP_TAC[GSYM REAL_POW_2] THEN +SIMP_TAC[REAL_ARITH` a * b * c = c * b * a `; + UPS_X_SYM; dist3] THEN +MP_TAC (MESON[dist3; DIST_POS_LE]` &0 <= dist3 v0 vc `) THEN +MP_TAC (MESON[REAL_LE_DIV; REAL_LE_MUL_EQ; REAL_LE_POW_2;REAL_LE_MUL; ZERO_LE_UPS_X; +SQRT_WORKS]` &0 <= ((dist3 va vb pow 2 * dist3 va vc pow 2 * dist3 vb vc pow 2) / + ups_x (dist3 va vb pow 2) (dist3 va vc pow 2) (dist3 vb vc pow 2)) /\ + &0 <= sqrt ((dist3 va vb pow 2 * dist3 va vc pow 2 * dist3 vb vc pow 2) / + ups_x (dist3 va vb pow 2) (dist3 va vc pow 2) (dist3 vb vc pow 2)) `) THEN +REWRITE_TAC[MESON[]` a ==> b ==> c <=> b /\ a ==> c `] THEN +MATCH_MP_TAC (MESON[]` (a1 /\ a3 ==> l) ==> a1 /\a2 /\a3 ==> l`) THEN +SIMP_TAC[dist3; EQ_POW2_COND; SQRT_WORKS]);; + + +let CDEUSDF = prove(`!(va:real^3) vb vc a b c. + a = dist3 vb vc /\ b = dist3 va vc /\ c = dist3 va vb /\ ~collinear {va, vb, vc} + ==> (?p. p IN affine hull {va, vb, vc} /\ + (?c. ( !w. w IN {va, vb, vc} ==> c = dist (p,w)) /\ + (!p'. p' IN affine hull {va, vb, vc} /\ + ( !w. w IN {va, vb, vc} ==> c = dist (p',w)) + ==> p = p'))) /\ + (let al_a = + (a pow 2 * (b pow 2 + c pow 2 - a pow 2)) / + (ups_x (a pow 2) (b pow 2) (c pow 2)) in + let al_b = + (b pow 2 * (a pow 2 + c pow 2 - b pow 2)) / + (ups_x (a pow 2) (b pow 2) (c pow 2)) in + let al_c = + (c pow 2 * (a pow 2 + b pow 2 - c pow 2)) / + (ups_x (a pow 2) (b pow 2) (c pow 2)) in + al_a % va + al_b % vb + al_c % vc = circumcenter {va, vb, vc}) /\ + radV {va, vb, vc} = eta_y a b c`, +SIMP_TAC[PROVE_EXISTS_RADV; CIRCUMCENTER_FORMULAR2; NOT_COLL_IMP_RADV_FORMULAR ]);; + +let LEMMA17 = CDEUSDF;; + +let DIST_EQ_IS_UNIQUE = prove(` {u, w} SUBSET affine hull {v1, v2, v3} /\ + dist (u,v2) = dist (u,v1) /\ dist (u,v3) = dist (u,v1) /\ + dist (w,v2) = dist (w,v1) /\ dist (w,v3) = dist (w,v1) ==> + u = w `, +SIMP_TAC[EQ_POW2_COND; DIST_POS_LE] THEN ONCE_REWRITE_TAC[REAL_ARITH` + a = b <=> a - b = &0 `] THEN MESON_TAC[EQ_SUB_DIST_POW2_IMP_IDENTIFIED]);; + + +let NEVER_USED_AGAIN = prove(` p IN affine hull {va, vb, vc} /\ c = dist (p,va) +/\ c = dist (p,vb) /\ c = dist (p,vc) ==> + (! p'. p' IN affine hull {va, vb, vc} /\ + dist (p',vb) = dist (p',va) /\ + dist (p',vc) = dist (p',va) <=> + p' IN affine hull {va, vb, vc} /\ + c = dist (p',va) /\ + c = dist (p',vb) /\ + c = dist (p',vc) )`, +MESON_TAC[DIST_EQ_IS_UNIQUE; SET2_SU_EX]);; + + + +let TRUONG_WELL = prove(`! (va:real^3) vb vc. ~collinear {va, vb, vc} + ==> (?p. p IN affine hull {va, vb, vc} /\ + (?c. !w. w IN {va, vb, vc} ==> c = dist (p,w)) /\ + (!p'. p' IN affine hull {va, vb, vc} /\ + (?c. !w. w IN {va, vb, vc} ==> c = dist (p',w)) + ==> p = p'))`, +NHANH (SPEC_ALL PROVE_EXISTS_RADV) THEN REPEAT STRIP_TAC THEN EXISTS_TAC `p:real^3` +THEN CONJ_TAC THENL [ASM_SIMP_TAC[]; CONJ_TAC] THENL [ASM_MESON_TAC[]; +REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN +REWRITE_TAC[SET_RULE` (!a. a IN {x,y,z} ==> p a) + <=> p x /\ p y /\ p z `] THEN +REWRITE_TAC[MESON[]` (?c. c = a /\ c = b /\ c = cc ) <=> + b = a /\ cc = a `]] THEN +REWRITE_TAC[MESON[]` a ==> b ==> c <=> a /\b ==> c `] THEN + PHA THEN MESON_TAC[NEVER_USED_AGAIN ]);; + + + + +let NGAY_MONG6 = MESON[TRUONG_WELL] `! va vb (vc:real^3). + ~collinear {va, vb, vc} ==> (?p. p IN affine hull {va, vb, vc} /\ + (?c. !w. w IN {va, vb, vc} ==> c = dist (p,w)) ) `;; + + +let CIRCUMCENTER_PROPTIES = prove(`!va vb (vc:real^3). + ~collinear {va, vb, vc} + ==> circumcenter {va, vb, vc} IN affine hull {va, vb, vc} /\ +(?c. !w. w IN {va, vb, vc} + ==> c = dist (circumcenter {va, vb, vc},w))`, +NHANH (SPEC_ALL NGAY_MONG6) THEN REWRITE_TAC[IN; +circumcenter; EXISTS_THM] THEN SIMP_TAC[]);; + + + + + + +let SIMP_DOT_ALEM = prove( `&0 < (b - a) dot x <=> x dot (a - b) < &0`, +SIMP_TAC[DOT_SYM] THEN +REWRITE_TAC[ REAL_ARITH ` a < &0 <=> &0 < -- a `; GSYM DOT_RNEG] THEN +REWRITE_TAC[VECTOR_ARITH ` -- ((a:real^N) - b) = b - a `]);; + + + + +let MONG7_ROI = prove(` ! p a (b:real^A). dist (p,a) = dist (p,b) <=> + (p - &1 / &2 % ( a + b )) dot ( a - b) = &0 `, +REWRITE_TAC[ REAL_ARITH ` a = b <=> ~ ( a < b) /\ ~( b < a ) `; +DIST_LT_HALF_PLANE] THEN +REWRITE_TAC[VECTOR_ARITH` (p - &1 / &2 % (a + b)) dot (a - b) + = &1 / &2 * ( (&2 % p - (a + b ) ) dot ( a- b ) ) `] THEN +REWRITE_TAC[REAL_ARITH `( &1 / &2 * a < &0 <=> a < &0) /\ +(&0 < &1 / &2 * a <=> &0 < a )`] THEN +REWRITE_TAC[SIMP_DOT_ALEM] THEN +SIMP_TAC[VECTOR_ARITH` (a - b) dot (c - d) = (b - a) dot (d - c)`; DOT_SYM; +VECTOR_ADD_SYM] THEN MESON_TAC[]);; + +let LEMMA26 = prove(`!v1 v2 (v3:real^3) p. + ~collinear {v1, v2, v3} /\ p = circumcenter {v1, v2, v3} + ==> (p - &1 / &2 % (v1 + v2)) dot (v1 - v2) = &0 /\ + (p - &1 / &2 % (v2 + v3)) dot (v2 - v3) = &0 /\ + (p - &1 / &2 % (v3 + v1)) dot (v3 - v1) = &0`, +NHANH (SPEC_ALL CIRCUMCENTER_PROPTIES) THEN +NHANH (SET_RULE` (?c. !w. w IN {v1, v2, v3} ==> c = P w) ==> P v1 = P v2 + /\ P v2 = P v3 /\ P v3 = P v1 `) THEN +SIMP_TAC[MONG7_ROI]);; + +let POXDVXO = LEMMA26;; + + + +let NOT_COLL_IMP_RADV_EQ_ETA_Y = MESON[prove(`!va vb vc a b c. + a = dist3 vb vc /\ b = dist3 va vc /\ c = dist3 va vb /\ ~collinear {va, vb, vc} + ==> radV {va, vb, vc} = eta_y (dist3 vb vc) (dist3 va vc) (dist3 va vb)`, +SIMP_TAC[CDEUSDF])]` + !va vb vc . ~collinear {va, vb, vc} + ==> radV {va, vb, vc} = eta_y (dist3 vb vc) (dist3 va vc) (dist3 va vb)`;; + +let COLLINEAR2 = prove(` ! x (y:real^N). collinear {x,y} `, + REPEAT GEN_TAC THEN REWRITE_TAC[collinear] THEN + EXISTS_TAC ` x -(y: real^N)` THEN + ASM_SIMP_TAC[SET_RULE` a = b ==> {a,b,c} = {a,c} `] THEN + REWRITE_TAC[IN_SET2] THEN + REPEAT GEN_TAC THEN + STRIP_TAC THENL + [ASM_SIMP_TAC[] THEN EXISTS_TAC ` &0 ` THEN CONV_TAC VECTOR_ARITH; + ASM_SIMP_TAC[] THEN EXISTS_TAC ` &1 ` THEN CONV_TAC VECTOR_ARITH; + ASM_SIMP_TAC[] THEN EXISTS_TAC ` -- &1 ` THEN CONV_TAC VECTOR_ARITH; + ASM_SIMP_TAC[] THEN EXISTS_TAC ` &0 ` THEN CONV_TAC VECTOR_ARITH] + );; + +let TWO_EQ_IMP_COL3 = prove(` ! (x:real^N) y z . x = y ==> collinear {x, y, z} `, +STRIP_TR THEN SIMP_TAC[SET_RULE` a = b ==> {a,b,c} = {a,c} `; COLLINEAR2]);; + + +let NOT_CO_IMP_DIST_POS = prove(`! x y z. ~ collinear {x,y,z} ==> &0 < dist (x,y) `, +NHANH (MESON[TWO_EQ_IMP_COL3]` ~collinear {x, y, z} ==> ~( x= y) `) THEN +SIMP_TAC[DIST_POS_LT]);; + + +let NOT_COLL_IMP_POS_SUM = prove( ` !x y z. + ~collinear {x, y, z} ==> &0 < ( dist3 x y + dist3 y z + dist3 z x) / &2 `, +NHANH (SPEC_ALL NOT_CO_IMP_DIST_POS) THEN +NHANH (MESON[DIST_POS_LE]` ~collinear {x, y, z} ==> + &0 <= dist (y,z) /\ &0 <= dist (z,x) `) THEN +SIMP_TAC[dist3] THEN REAL_ARITH_TAC);; + +let PER_SET2 = SET_RULE ` {a,b} = {b,a} `;; + + +let COLLINEAR_AS_IN_CONV2 = MESON[PER_SET2; COLLINERA_AS_IN_CONV2]`! x y (z:real^3). collinear {x, y, z} <=> + x IN conv {y, z} \/ y IN conv {z, x} \/ z IN conv {x, y}`;; + +let COLLINEAR_IMP_POS_UPS2 = prove(` ! x y (z:real^3). ~ collinear {x,y,z} ==> + &0 < ups_x_pow2 ( dist3 x y ) ( dist3 y z ) ( dist3 z x ) `, +REWRITE_TAC[PRE_HER] THEN NHANH (SPEC_ALL NOT_COLL_IMP_POS_SUM ) THEN +REWRITE_TAC[COLLINEAR_AS_IN_CONV2] THEN REWRITE_TAC[MID_COND] THEN +REWRITE_TAC[LENGTH_EQ_EX] THEN REWRITE_TAC[DE_MORGAN_THM] THEN +SIMP_TAC[dist3] THEN REPEAT GEN_TAC THEN SIMP_TAC[ +prove(` &0 < a ==> ( &0 < &16 * a * b <=> &0 < b ) `, +REWRITE_TAC[REAL_ARITH ` &0 < &16 * a <=> &0 < a `] THEN +REWRITE_TAC[REAL_LT_MUL_EQ])] THEN +REWRITE_TAC[REAL_ARITH ` (a + b + c ) / &2 - a = ( b + c - a ) / &2 `] THEN +REWRITE_TAC[REAL_ARITH ` (a + b + c ) / &2 - b = ( c + a - b ) / &2 `] THEN +REWRITE_TAC[REAL_ARITH ` (a + b + c ) / &2 - c = ( a + b - c ) / &2 `] THEN +REWRITE_TAC[REAL_ARITH ` a < b + c <=> &0 < ( b + c - a ) / &2 `] THEN +SIMP_TAC[DIST_SYM] THEN SIMP_TAC[REAL_ARITH ` a + b - c = b + a - c `] THEN +SIMP_TAC[REAL_LT_MUL]);; + + + +let RADV_FORMULAR = MESON[CDEUSDF]` !(va:real^3) vb vc. + ~collinear {va, vb, vc} + ==> radV {va, vb, vc} = eta_y (dist3 vb vc) (dist3 va vc) (dist3 va vb)`;; + + + +let MUL3_SYM = REAL_ARITH ` ! a b c. a * b * c = b * a * c /\ + a * b * c = c * b * a `;; + +let ETA_X_SYMM = prove(` ! a b c. eta_x a b c = eta_x b a c /\ + eta_x a b c = eta_x c b a `,SIMP_TAC[eta_x; MUL3_SYM; UPS_X_SYM]);; + +let ETA_Y_SYYM = prove(` ! x y z. eta_y x y z = eta_y y x z /\ +eta_y x y z = eta_y z y x `, REWRITE_TAC[eta_y] THEN +CONV_TAC (TOP_DEPTH_CONV let_CONV) THEN MESON_TAC[ETA_X_SYMM]);; + + + +let NOT_COL3_IMP_DIFF = MESON[PER_SET3; TWO_EQ_IMP_COL3]`!a b c. +~collinear {a, b, c} ==> ~(a = b \/ a = c \/ b = c)`;; + +let LET_TR = CONV_TAC (TOP_DEPTH_CONV let_CONV);; + + +let POW2_COND_LT = MESON[POW2_COND; REAL_ARITH ` &0 < a ==> &0 <= a `]` + !a b. &0 < a /\ &0 < b ==> (a <= b <=> a pow 2 <= b pow 2)`;; + + +let ETA_Y_2 = prove(` eta_y (&2) (&2) (&2) = &2 / sqrt (&3) `, +REWRITE_TAC[eta_y; eta_x; ups_x] THEN +LET_TR THEN +REWRITE_TAC[REAL_ARITH ` ((&2 * &2) * (&2 * &2) * &2 * &2) / + (--(&2 * &2) * &2 * &2 - (&2 * &2) * &2 * &2 - (&2 * &2) * &2 * &2 + + &2 * (&2 * &2) * &2 * &2 + + &2 * (&2 * &2) * &2 * &2 + + &2 * (&2 * &2) * &2 * &2) = &4 / &3 `] THEN +MP_TAC (MESON[REAL_LT_DIV; MESON[SQRT_POS_LT; REAL_ARITH` &0 < &3 `] ` +&0 < sqrt (&3) `; REAL_ARITH ` &0 < &2 /\ &0 < &4 /\ &0 < &3 `] ` &0 < &4 / &3 +/\ &0 < &2 / sqrt (&3) `) THEN +REWRITE_TAC[REAL_ARITH` a = b <=> a <= b /\ b <= a `] THEN +SIMP_TAC[SQRT_POS_LT; POW2_COND_LT] THEN +REWRITE_TAC[GSYM (REAL_ARITH` a = b <=> a <= b /\ b <= a `)] THEN +SIMP_TAC[REAL_LT_IMP_LE; SQRT_POW_2] THEN +REWRITE_TAC[REAL_FIELD` (a/ b) pow 2 = a pow 2 / ( b pow 2 ) `] THEN +SIMP_TAC[REAL_ARITH ` &0 <= &3 `; SQRT_POW_2] THEN +REAL_ARITH_TAC);; + +let D3_POS_LE = MESON[dist3; DIST_POS_LE]` ! x y. &0 <= dist3 x y `;; + + +(* le 19. p 17 *) + + + +let cayleytr = new_definition ` + cayleytr x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 = + &2 * x23 * x25 * x34 + + &2 * x23 * x24 * x35 + + -- &1 * x23 pow 2 * x45 + + -- &2 * x15 * x23 * x34 + + -- &2 * x15 * x23 * x24 + + &2 * x15 * x23 pow 2 + + -- &2 * x14 * x23 * x35 + + -- &2 * x14 * x23 * x25 + + &2 * x14 * x23 pow 2 + + &4 * x14 * x15 * x23 + + -- &2 * x13 * x25 * x34 + + -- &2 * x13 * x24 * x35 + + &4 * x13 * x24 * x25 + + &2 * x13 * x23 * x45 + + -- &2 * x13 * x23 * x25 + + -- &2 * x13 * x23 * x24 + + &2 * x13 * x15 * x34 + + -- &2 * x13 * x15 * x24 + + -- &2 * x13 * x15 * x23 + + &2 * x13 * x14 * x35 + + -- &2 * x13 * x14 * x25 + + -- &2 * x13 * x14 * x23 + + -- &1 * x13 pow 2 * x45 + + &2 * x13 pow 2 * x25 + + &2 * x13 pow 2 * x24 + + &4 * x12 * x34 * x35 + + -- &2 * x12 * x25 * x34 + + -- &2 * x12 * x24 * x35 + + &2 * x12 * x23 * x45 + + -- &2 * x12 * x23 * x35 + + -- &2 * x12 * x23 * x34 + + -- &2 * x12 * x15 * x34 + + &2 * x12 * x15 * x24 + + -- &2 * x12 * x15 * x23 + + -- &2 * x12 * x14 * x35 + + &2 * x12 * x14 * x25 + + -- &2 * x12 * x14 * x23 + + &2 * x12 * x13 * x45 + + -- &2 * x12 * x13 * x35 + + -- &2 * x12 * x13 * x34 + + -- &2 * x12 * x13 * x25 + + -- &2 * x12 * x13 * x24 + + &4 * x12 * x13 * x23 + + -- &1 * x12 pow 2 * x45 + + &2 * x12 pow 2 * x35 + + &2 * x12 pow 2 * x34 `;; + + +let LTCTBAN = prove(` cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 = +ups_x x12 x13 x23 * x45 pow 2 + cayleytr x12 x13 x14 x15 x23 x24 x25 x34 x35 ( &0 ) +* x45 + cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 ( &0 ) `, +REWRITE_TAC[ups_x; cayleyR;cayleytr] THEN REAL_ARITH_TAC);; + + + +(* ------------------------------------------------------------------------- *) +(* Flyspeck definitions we use. *) +(* ------------------------------------------------------------------------- *) + +let plane = new_definition + `plane x = (?u v w. ~(collinear {u,v,w}) /\ (x = affine hull {u,v,w}))`;; + +(* renamed from coplanar, because j. harrison changed the def. -thales *) + +let coplanar_alt = new_definition `coplanar_alt S = (?x. plane x /\ S SUBSET x)`;; + + +(* renamed condA to condA, thales *) + +(* +let condA = new_definition `condA (v1:real^3) v2 v3 v4 x12 x13 x14 x23 x24 x34 = + ( ~ ( v1 = v2 ) /\ coplanar_alt {v1,v2,v3,v4} /\ + ( dist ( v1, v2) pow 2 ) = x12 /\ + dist (v1,v3) pow 2 = x13 /\ + dist (v1,v4) pow 2 = x14 /\ + dist (v2,v3) pow 2 = x23 /\ dist (v2,v4) pow 2 = x24 )`;; +*) + +let det_vec3 = new_definition ` det_vec3 (a:real^3) (b:real^3) (c:real^3) = + a$1 * b$2 * c$3 + b$1 * c$2 * a$3 + c$1 * a$2 * b$3 - + ( a$1 * c$2 * b$3 + b$1 * a$2 * c$3 + c$1 * b$2 * a$3 ) `;; + +let COPLANAR_DET_EQ_0 = prove + (`!v0 v1 (v2: real^3) v3. + coplanar_alt {v0,v1,v2,v3} <=> + det(vector[v1 - v0; v2 - v0; v3 - v0]) = &0`, + REPEAT GEN_TAC THEN REWRITE_TAC[DET_EQ_0_RANK; RANK_ROW] THEN + REWRITE_TAC[rows; row; LAMBDA_ETA] THEN + ONCE_REWRITE_TAC[SIMPLE_IMAGE_GEN] THEN + REWRITE_TAC[GSYM numseg; DIMINDEX_3] THEN + CONV_TAC(ONCE_DEPTH_CONV NUMSEG_CONV) THEN + SIMP_TAC[IMAGE_CLAUSES; VECTOR_3] THEN EQ_TAC THENL + [REWRITE_TAC[coplanar_alt; plane; LEFT_AND_EXISTS_THM; LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC + [`p:real^3->bool`; `a:real^3`; `b:real^3`; `c:real^3`] THEN + DISCH_THEN(CONJUNCTS_THEN2 STRIP_ASSUME_TAC MP_TAC) THEN + FIRST_X_ASSUM SUBST1_TAC THEN + W(MP_TAC o PART_MATCH lhand AFFINE_HULL_INSERT_SUBSET_SPAN o + rand o lhand o goal_concl) THEN + REWRITE_TAC[GSYM IMP_CONJ_ALT] THEN + DISCH_THEN(MP_TAC o MATCH_MP SUBSET_TRANS) THEN + DISCH_THEN(MP_TAC o ISPEC `\x:real^3. x - a` o MATCH_MP IMAGE_SUBSET) THEN + ONCE_REWRITE_TAC[SIMPLE_IMAGE_GEN] THEN + REWRITE_TAC[IMAGE_CLAUSES; GSYM IMAGE_o; o_DEF; VECTOR_ADD_SUB; IMAGE_ID; + SIMPLE_IMAGE] THEN + REWRITE_TAC[INSERT_SUBSET] THEN STRIP_TAC THEN + GEN_REWRITE_TAC LAND_CONV [GSYM DIM_SPAN] THEN MATCH_MP_TAC LET_TRANS THEN + EXISTS_TAC `CARD {b - a:real^3,c - a}` THEN + CONJ_TAC THENL + [MATCH_MP_TAC SPAN_CARD_GE_DIM; + SIMP_TAC[CARD_CLAUSES; FINITE_RULES] THEN ARITH_TAC] THEN + REWRITE_TAC[FINITE_INSERT; FINITE_RULES] THEN + GEN_REWRITE_TAC RAND_CONV [GSYM SPAN_SPAN] THEN + MATCH_MP_TAC SPAN_MONO THEN REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET] THEN + MP_TAC(VECTOR_ARITH `!x y:real^3. x - y = (x - a) - (y - a)`) THEN + DISCH_THEN(fun th -> REPEAT CONJ_TAC THEN + GEN_REWRITE_TAC LAND_CONV [th]) THEN + MATCH_MP_TAC SPAN_SUB THEN ASM_REWRITE_TAC[]; + + DISCH_TAC THEN + MP_TAC(ISPECL [`{v1 - v0,v2 - v0,v3 - v0}:real^3->bool`; `2`] + LOWDIM_EXPAND_BASIS) THEN + ASM_REWRITE_TAC[ARITH_RULE `n <= 2 <=> n < 3`; DIMINDEX_3; ARITH] THEN + DISCH_THEN(X_CHOOSE_THEN `t:real^3->bool` + (CONJUNCTS_THEN2 MP_TAC STRIP_ASSUME_TAC)) THEN + CONV_TAC(LAND_CONV HAS_SIZE_CONV) THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`a:real^3`; `b:real^3`] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC) THEN + REWRITE_TAC[coplanar_alt; plane] THEN + EXISTS_TAC `affine hull {v0,v0 + a,v0 + b}:real^3->bool` THEN + CONJ_TAC THENL + [MAP_EVERY EXISTS_TAC [`v0:real^3`; `v0 + a:real^3`; `v0 + b:real^3`] THEN + REWRITE_TAC[COLLINEAR_3; COLLINEAR_LEMMA; + VECTOR_ARITH `--x = vec 0 <=> x = vec 0`; + VECTOR_ARITH `u - (u + a):real^3 = --a`; + VECTOR_ARITH `(u + b) - (u + a):real^3 = b - a`] THEN + REWRITE_TAC[DE_MORGAN_THM; VECTOR_SUB_EQ; + VECTOR_ARITH `b - a = c % -- a <=> (c - &1) % a + &1 % b = vec 0`] THEN + ASM_REWRITE_TAC[] THEN CONJ_TAC THENL + [ASM_MESON_TAC[IN_INSERT; INDEPENDENT_NONZERO]; ALL_TAC] THEN + DISCH_THEN(X_CHOOSE_TAC `u:real`) THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [independent]) THEN + REWRITE_TAC[DEPENDENT_EXPLICIT] THEN + MAP_EVERY EXISTS_TAC [`{a:real^3,b}`; + `\x:real^3. if x = a then u - &1 else &1`] THEN + REWRITE_TAC[FINITE_INSERT; FINITE_RULES; SUBSET_REFL] THEN + CONJ_TAC THENL + [EXISTS_TAC `b:real^3` THEN ASM_REWRITE_TAC[IN_INSERT] THEN + REAL_ARITH_TAC; + ALL_TAC] THEN + SIMP_TAC[VSUM_CLAUSES; FINITE_RULES] THEN + ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; VECTOR_ADD_RID]; + ALL_TAC] THEN + W(MP_TAC o PART_MATCH (lhs o rand) AFFINE_HULL_INSERT_SPAN o + rand o goal_concl) THEN + ANTS_TAC THENL + [REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY] THEN + REWRITE_TAC[VECTOR_ARITH `u = u + a <=> a = vec 0`] THEN + ASM_MESON_TAC[INDEPENDENT_NONZERO; IN_INSERT]; + ALL_TAC] THEN + DISCH_THEN SUBST1_TAC THEN + ONCE_REWRITE_TAC[SIMPLE_IMAGE_GEN] THEN + REWRITE_TAC[SIMPLE_IMAGE; IMAGE_CLAUSES; IMAGE_ID; VECTOR_ADD_SUB] THEN + MATCH_MP_TAC SUBSET_TRANS THEN EXISTS_TAC + `IMAGE (\v:real^3. v0 + v) (span{v1 - v0, v2 - v0, v3 - v0})` THEN + ASM_SIMP_TAC[IMAGE_SUBSET] THEN + REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_IMAGE] THEN CONJ_TAC THENL + [EXISTS_TAC `vec 0:real^3` THEN REWRITE_TAC[SPAN_0] THEN VECTOR_ARITH_TAC; + REWRITE_TAC[VECTOR_ARITH `v1:real^N = v0 + x <=> x = v1 - v0`] THEN + REWRITE_TAC[UNWIND_THM2] THEN REPEAT CONJ_TAC THEN + MATCH_MP_TAC SPAN_SUPERSET THEN REWRITE_TAC[IN_INSERT]]]);; + + +(* renamed from COPLANAR Jan 2013, to avoid clash with hol-light/Multivariate/Flyspeck.ml thm *) + +let COPLANAR_ALT = prove + (`2 <= dimindex(:N) + ==> !s:real^N->bool. coplanar_alt s <=> ?u v w. s SUBSET affine hull {u,v,w}`, + DISCH_TAC THEN GEN_TAC THEN REWRITE_TAC[coplanar_alt; plane] THEN + REWRITE_TAC[LEFT_AND_EXISTS_THM] THEN + ONCE_REWRITE_TAC[MESON[] + `(?x u v w. p x u v w) <=> (?u v w x. p x u v w)`] THEN + REWRITE_TAC[GSYM CONJ_ASSOC; RIGHT_EXISTS_AND_THM; UNWIND_THM2] THEN + EQ_TAC THENL [MESON_TAC[]; REWRITE_TAC[LEFT_IMP_EXISTS_THM]] THEN + MAP_EVERY X_GEN_TAC [`u:real^N`; `v:real^N`; `w:real^N`] THEN DISCH_TAC THEN + SUBGOAL_THEN + `s SUBSET {u + x:real^N | x | x IN span {y - u | y IN {v,w}}}` + MP_TAC THENL + [FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP + (REWRITE_RULE[IMP_CONJ] SUBSET_TRANS)) THEN + REWRITE_TAC[AFFINE_HULL_INSERT_SUBSET_SPAN]; + ALL_TAC] THEN + ONCE_REWRITE_TAC[SIMPLE_IMAGE_GEN] THEN + DISCH_THEN(MP_TAC o ISPEC `\x:real^N. x - u` o MATCH_MP IMAGE_SUBSET) THEN + REWRITE_TAC[GSYM IMAGE_o; o_DEF; VECTOR_ADD_SUB; IMAGE_ID; SIMPLE_IMAGE] THEN + REWRITE_TAC[IMAGE_CLAUSES] THEN + MP_TAC(ISPECL [`{v - u:real^N,w - u}`; `2`] LOWDIM_EXPAND_BASIS) THEN + ANTS_TAC THENL + [ASM_REWRITE_TAC[] THEN MATCH_MP_TAC LE_TRANS THEN + EXISTS_TAC `CARD{v - u:real^N,w - u}` THEN + SIMP_TAC[DIM_LE_CARD; FINITE_INSERT; FINITE_RULES] THEN + SIMP_TAC[CARD_CLAUSES; FINITE_RULES] THEN ARITH_TAC; + ALL_TAC] THEN + DISCH_THEN(X_CHOOSE_THEN `t:real^N->bool` + (CONJUNCTS_THEN2 MP_TAC STRIP_ASSUME_TAC)) THEN + CONV_TAC(LAND_CONV HAS_SIZE_CONV) THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`a:real^N`; `b:real^N`] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC) THEN + UNDISCH_TAC `span {v - u, w - u} SUBSET span {a:real^N, b}` THEN + REWRITE_TAC[GSYM IMP_CONJ_ALT] THEN + DISCH_THEN(ASSUME_TAC o MATCH_MP SUBSET_TRANS) THEN + MAP_EVERY EXISTS_TAC [`u:real^N`; `u + a:real^N`; `u + b:real^N`] THEN + CONJ_TAC THENL + [REWRITE_TAC[COLLINEAR_3; COLLINEAR_LEMMA; + VECTOR_ARITH `--x = vec 0 <=> x = vec 0`; + VECTOR_ARITH `u - (u + a):real^N = --a`; + VECTOR_ARITH `(u + b) - (u + a):real^N = b - a`] THEN + REWRITE_TAC[DE_MORGAN_THM; VECTOR_SUB_EQ; + VECTOR_ARITH `b - a = c % -- a <=> (c - &1) % a + &1 % b = vec 0`] THEN + ASM_REWRITE_TAC[] THEN CONJ_TAC THENL + [ASM_MESON_TAC[IN_INSERT; INDEPENDENT_NONZERO]; ALL_TAC] THEN + DISCH_THEN(X_CHOOSE_TAC `u:real`) THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [independent]) THEN + REWRITE_TAC[DEPENDENT_EXPLICIT] THEN + MAP_EVERY EXISTS_TAC [`{a:real^N,b}`; + `\x:real^N. if x = a then u - &1 else &1`] THEN + REWRITE_TAC[FINITE_INSERT; FINITE_RULES; SUBSET_REFL] THEN + CONJ_TAC THENL + [EXISTS_TAC `b:real^N` THEN ASM_REWRITE_TAC[IN_INSERT] THEN + REAL_ARITH_TAC; + ALL_TAC] THEN + SIMP_TAC[VSUM_CLAUSES; FINITE_RULES] THEN + ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; VECTOR_ADD_RID]; + ALL_TAC] THEN + W(MP_TAC o PART_MATCH (lhs o rand) AFFINE_HULL_INSERT_SPAN o rand o goal_concl) THEN + ANTS_TAC THENL + [REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY] THEN + REWRITE_TAC[VECTOR_ARITH `u = u + a <=> a = vec 0`] THEN + ASM_MESON_TAC[INDEPENDENT_NONZERO; IN_INSERT]; + ALL_TAC] THEN + DISCH_THEN SUBST1_TAC THEN + FIRST_ASSUM(MP_TAC o ISPEC `\x:real^N. u + x` o MATCH_MP IMAGE_SUBSET) THEN + REWRITE_TAC[GSYM IMAGE_o; o_DEF; IMAGE_ID; + ONCE_REWRITE_RULE[VECTOR_ADD_SYM] VECTOR_SUB_ADD] THEN + MATCH_MP_TAC(REWRITE_RULE[IMP_CONJ_ALT] SUBSET_TRANS) THEN + REWRITE_TAC[SUBSET; FORALL_IN_IMAGE] THEN + REWRITE_TAC[SIMPLE_IMAGE; IMAGE_CLAUSES; VECTOR_ADD_SUB] THEN + SET_TAC[]);; + +(* this LEMMA in determinants.ml +let DET_3 = new_axiom_removed`!A:real^3^3. + det(A) = A$1$1 * A$2$2 * A$3$3 + + A$1$2 * A$2$3 * A$3$1 + + A$1$3 * A$2$1 * A$3$2 - + A$1$1 * A$2$3 * A$3$2 - + A$1$2 * A$2$1 * A$3$3 - + A$1$3 * A$2$2 * A$3$1`;; +*) + +let det_vec3 = new_definition ` det_vec3 (a:real^3) (b:real^3) (c:real^3) = + a$1 * b$2 * c$3 + b$1 * c$2 * a$3 + c$1 * a$2 * b$3 - + ( a$1 * c$2 * b$3 + b$1 * a$2 * c$3 + c$1 * b$2 * a$3 ) `;; + + +let DET_VEC3_EXPAND = prove + (`det (vector [a; b; (c:real^3)] ) = det_vec3 a b c`, + REWRITE_TAC[det_vec3; DET_3; VECTOR_3] THEN REAL_ARITH_TAC);; + +let COPLANAR_DET_VEC3_EQ_0 = prove( `!v0 v1 (v2: real^3) v3. + coplanar_alt {v0,v1,v2,v3} <=> + det_vec3 ( v1 - v0 ) ( v2 - v0 ) ( v3 - v0 ) = &0`, REWRITE_TAC[COPLANAR_DET_EQ_0; DET_VEC3_EXPAND]);; + + + +let COPLANAR_3 = prove + (`!a b c:real^N. 2 <= dimindex(:N) ==> coplanar_alt {a,b,c}`, + SIMP_TAC[COPLANAR_ALT; SUBSET] THEN MESON_TAC[HULL_INC]);; + +let NONCOPLANAR_4_DISTINCT = prove + (`!a b c d:real^N. + ~(coplanar_alt{a,b,c,d}) /\ 2 <= dimindex(:N) + ==> ~(a = b) /\ ~(a = c) /\ ~(a = d) /\ + ~(b = c) /\ ~(b = d) /\ ~(c = d)`, + REPEAT GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN REWRITE_TAC[DE_MORGAN_THM] THEN + STRIP_TAC THEN ASM_SIMP_TAC[INSERT_AC; COPLANAR_3]);; + + + +let NONCOPLANAR_3_BASIS = prove + (`!v1 v2 v3 v0 v:real^3. + ~coplanar_alt {v0, v1, v2, v3} + ==> (?t1 t2 t3. + v = t1 % (v1 - v0) + t2 % (v2 - v0) + t3 % (v3 - v0) /\ + (!ta tb tc. + v = ta % (v1 - v0) + tb % (v2 - v0) + tc % (v3 - v0) + ==> ta = t1 /\ tb = t2 /\ tc = t3))`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM(MP_TAC o MATCH_MP (REWRITE_RULE[IMP_CONJ] + NONCOPLANAR_4_DISTINCT)) THEN + REWRITE_TAC[DIMINDEX_3; ARITH] THEN STRIP_TAC THEN + SUBGOAL_THEN `independent {v1 - v0:real^3,v2 - v0,v3 - v0}` ASSUME_TAC THENL + [FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE RAND_CONV [COPLANAR_DET_EQ_0]) THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN REWRITE_TAC[independent] THEN + DISCH_TAC THEN MATCH_MP_TAC DET_DEPENDENT_ROWS THEN + REWRITE_TAC[rows; row; LAMBDA_ETA; GSYM IN_NUMSEG; DIMINDEX_3] THEN + ONCE_REWRITE_TAC[SIMPLE_IMAGE] THEN + CONV_TAC(ONCE_DEPTH_CONV NUMSEG_CONV) THEN + ASM_REWRITE_TAC[IMAGE_CLAUSES; VECTOR_3]; + ALL_TAC] THEN + MP_TAC(ISPECL [`(:real^3)`; `{v1 - v0:real^3,v2 - v0,v3 - v0}`] + CARD_GE_DIM_INDEPENDENT) THEN + ASM_REWRITE_TAC[DIM_UNIV; SUBSET_UNIV] THEN ANTS_TAC THENL + [SIMP_TAC[CARD_CLAUSES; FINITE_INSERT; FINITE_RULES] THEN + ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; DIMINDEX_3; ARITH; + VECTOR_ARITH `x - a:real^N = y - a <=> x = y`]; + ALL_TAC] THEN + REWRITE_TAC[SUBSET; IN_UNIV; SPAN_BREAKDOWN_EQ; SPAN_EMPTY] THEN + DISCH_THEN(MP_TAC o SPEC `v:real^3`) THEN + MAP_EVERY (fun t -> MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC t) + [`t1:real`; `t2:real`; `t3:real`] THEN + REWRITE_TAC[IN_SING; VECTOR_ARITH + `a - b - c - d:real^N = vec 0 <=> a = b + c + d`] THEN + DISCH_THEN SUBST1_TAC THEN REWRITE_TAC[] THEN + MAP_EVERY X_GEN_TAC [`ta:real`; `tb:real`; `tc:real`] THEN + REWRITE_TAC[VECTOR_ARITH + `t1 % x + t2 % y + t3 % z = ta % x + tb % y + tc % z <=> + (t1 - ta) % x + (t2 - tb) % y + (t3 - tc) % z = vec 0`] THEN + STRIP_TAC THEN FIRST_ASSUM(MP_TAC o GEN_REWRITE_RULE I [independent]) THEN + REWRITE_TAC[DEPENDENT_EXPLICIT; NOT_EXISTS_THM] THEN + DISCH_THEN(MP_TAC o SPECL + [`{v1 - v0:real^3,v2 - v0,v3 - v0}`; + `\v:real^3. if v = v1 - v0 then t1 - ta + else if v = v2 - v0 then t2 - tb + else t3 - tc`]) THEN + SIMP_TAC[FINITE_INSERT; FINITE_RULES; SUBSET_REFL; VSUM_CLAUSES] THEN + ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; VECTOR_ADD_RID; + RIGHT_OR_DISTRIB; EXISTS_OR_THM; UNWIND_THM2; + VECTOR_ARITH `x - a:real^N = y - a <=> x = y`] THEN + SIMP_TAC[DE_MORGAN_THM; REAL_SUB_0]);; + + + +let DET_VEC3_AND_DELTA = prove(`!(a:real^3) b c d. + &4 * ( det_vec3 (a - d) (b - d) (c - d) ) pow 2 = + delta ( dist3 a d pow 2) + (dist3 b d pow 2) + (dist3 c d pow 2) (dist3 a b pow 2) (dist3 a c pow 2) (dist3 b c pow 2) `, +SIMP_TAC[dist3; dist] THEN +REWRITE_TAC[GSYM (MESON[VECTOR_ARITH ` (a :real^N) - b = ( a - x ) - ( b - x ) `]` + delta (norm (a - d) pow 2) (norm (b - d) pow 2) + (norm (c - d) pow 2) (norm ((a - d) - (b - d )) pow 2) +(norm ((a - d) - ( c - d )) pow 2) (norm ((b - d ) - ( c - d )) pow 2) = + delta (norm (a - d) pow 2) (norm (b - d) pow 2) (norm (c - d) pow 2) +(norm (a - b) pow 2) (norm (a - c) pow 2) (norm (b - c) pow 2) `)] THEN +SIMP_TAC[ vector_norm; DOT_POS_LE; SQRT_WORKS] THEN +REWRITE_TAC[DOT_3] THEN +REWRITE_TAC[MESON[lemma_cm3]`((a:real^3) - d - (b - d))$1 = (a - d)$1 - (b - d)$1 /\ + (a - d - (b - d))$2 = (a - d)$2 - (b - d)$2 /\ + (a - d - (b - d))$3 = (a - d)$3 - (b - d)$3 `] THEN +REWRITE_TAC[delta; det_vec3] THEN +REAL_ARITH_TAC);; + + + +let POLFLZY = prove(` !(x1:real^3) x2 x3 x4. + let x12 = dist (x1,x2) pow 2 in + let x13 = dist (x1,x3) pow 2 in + let x14 = dist (x1,x4) pow 2 in + let x23 = dist (x2,x3) pow 2 in + let x24 = dist (x2,x4) pow 2 in + let x34 = dist (x3,x4) pow 2 in + coplanar_alt {x1, x2, x3, x4} <=> delta x12 x13 x14 x23 x24 x34 = &0 `, +LET_TR THEN REPEAT GEN_TAC THEN MP_TAC (GSYM (SPECL [` x2 :real^3`; +` x3:real^3`;` x4:real^3`; ` x1 :real^3`] DET_VEC3_AND_DELTA)) THEN +SIMP_TAC[dist3; DIST_SYM] THEN REWRITE_TAC[REAL_ARITH ` &4 * a = &0 <=> a = &0 `] +THEN SIMP_TAC[GSYM ( REAL_FIELD ` x = &0 <=> x pow 2 = &0 `); +COPLANAR_DET_VEC3_EQ_0]);; + + +let LEMMA15 = POLFLZY;; + +let muy_delta = new_definition ` muy_delta = delta `;; + + +(* LEMMA29 *) +(* +let VCRJIHC = prove(`!(v1:real^3) v2 v3 v4 x34 x12 x13 x14 x23 x24. + condA v1 v2 v3 v4 x12 x13 x14 x23 x24 x34 + ==> muy_delta x12 x13 x14 x23 x24 (dist (v3,v4) pow 2) = &0`, +REWRITE_TAC[condA; muy_delta] THEN MP_TAC POLFLZY THEN LET_TR THEN MESON_TAC[]);; +*) + +let ZERO_NEUTRAL = REAL_ARITH ` ! x. &0 * x = &0 /\ x * &0 = &0 /\ &0 + x = x /\ x + &0 = x /\ x - &0 = x /\ + -- &0 = &0 `;; + +let EQUATE_CONEFS_POLINOMIAL_POW2 = prove( `!a b c aa bb cc. ( ! x. + a * x pow 2 + b * x + c = aa * x pow 2 + bb * x + cc ) <=> + a = aa /\ b = bb /\ c = cc`, REPEAT GEN_TAC THEN EQ_TAC THENL [ +NHANH (MESON[]` (! (x:real). P x ) ==> P ( &0 ) /\ P ( &1 ) /\ P ( -- &1 )`) THEN +REAL_ARITH_TAC THEN REAL_ARITH_TAC; SIMP_TAC[]]);; + +let GJWYYPS = prove(`!x12 x13 x14 x15 x23 x24 x25 x34 x35 a b c. + (! x45. cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 = + a * x45 pow 2 + b * x45 + c ) + ==> b pow 2 - &4 * a * c = + &16 * delta x12 x13 x14 x23 x24 x34 * delta x12 x13 x15 x23 x25 x35`, +ONCE_REWRITE_TAC[LTCTBAN] THEN REPEAT GEN_TAC THEN +REWRITE_TAC[EQUATE_CONEFS_POLINOMIAL_POW2] THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] +THEN SIMP_TAC[] THEN DISCH_TAC THEN REWRITE_TAC[ups_x; cayleytr; cayleyR; + delta; ZERO_NEUTRAL] THEN REAL_ARITH_TAC);; + +let LEMMA51 = GJWYYPS ;; + +let NOT_TOW_EQ_IMP_COL_EQUAVALENT = prove_by_refinement( +`!v1 v2 (v:real^3). ~(v1 = v2) ==> (collinear {v, v1, v2} <=> v IN aff {v1, v2})`, + (* {{{ proof *) + [ + (REWRITE_TAC[COLLINEAR_EX]); + (NHANH (MESON[]` a % b + c = vec 0 ==> ( a = &0 \/ ~(a = &0 ))`)); + (KHANANG); + (NGOAC THEN PURE_ONCE_REWRITE_TAC[MESON[]` P a /\ a = &0 <=> P ( &0 ) /\ a = &0 `]); + (REWRITE_TAC[REAL_ADD_LID; VECTOR_MUL_LZERO; VECTOR_ADD_LID]); + (REWRITE_TAC[REAL_ARITH ` a + b= &0 <=> a = -- b `; VECTOR_ARITH` a % x + b % y = vec 0 <=> a % x = ( -- b) % y`]); + (NHANH (MESON[REAL_ARITH ` a = &0 <=> -- a = &0 `; VECTOR_MUL_LCANCEL]` (b = --c /\ ~(b = &0 /\ c = &0)) /\ b % v1 = --c % v2 ==> v1 = v2 `)); + (SIMP_TAC[]); + (REWRITE_TAC[AFF_2POINTS_INTERPRET; IN_ELIM_THM]); + (REPEAT GEN_TAC THEN DISCH_TAC THEN EQ_TAC); + (REWRITE_TAC[VECTOR_ARITH ` a % v + b % v1 + c % v2 = vec 0 <=> a % v = ( -- b) % v1 + ( --c ) % v2 `]); + (PHA THEN REWRITE_TAC[MESON[CHANGE_SIDE]` a % v = v1 /\ ~(a = &0) <=> v = &1 / a % v1 /\ ~( a = &0 ) `]); + (REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * b = b / a`]); + (REWRITE_TAC[AFF_2POINTS_INTERPRET; IN_ELIM_THM]); + BY( (MESON_TAC[REAL_FIELD ` ~ ( a = &0 ) /\ a = -- (b + c) ==> ( -- b) / a + ( -- c) / a = &1 `])); + (STRIP_TAC); + (EXISTS_TAC ` &1 `); + (EXISTS_TAC ` -- ta`); + (EXISTS_TAC ` -- tb`); + (PHA); + (ASM_SIMP_TAC[REAL_ARITH` ~(&1 = &0 ) /\ -- ( -- a + -- b ) = a + b `]); + BY( (CONV_TAC VECTOR_ARITH)) + ]);; + (* }}} *) + + +(* +let LEMMA30 = prove(`!v1 v2 v3 v4 x12 x13 x14 x23 x24 x34 a b c. + condA v1 v2 v3 v4 x12 x13 x14 x23 x24 x34 /\ + (!x12 x13 x14 x23 x24 x34. + muy_delta x12 x13 x14 x23 x24 x34 = + a x12 x13 x14 x23 x24 * x34 pow 2 + + b x12 x13 x14 x23 x24 * x34 + + c x12 x13 x14 x23 x24 ) + ==> (v3 IN aff {v1, v2} \/ v4 IN aff {v1, v2} <=> + b x12 x13 x14 x23 x24 pow 2 - + &4 * a x12 x13 x14 x23 x24 * c x12 x13 x14 x23 x24 = + &0)`, +REWRITE_TAC[muy_delta; DELTA_COEFS; EQUATE_CONEFS_POLINOMIAL_POW2 ] THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN SIMP_TAC[] THEN REPEAT GEN_TAC THEN +DISCH_TAC THEN REWRITE_TAC[REAL_ARITH` a - b * -- c * d = a + b * c * d `; +AGBWHRD] THEN DOWN_TAC THEN SIMP_TAC[condA; REAL_ENTIRE; +GSYM NOT_TOW_EQ_IMP_COL_EQUAVALENT] THEN ONCE_REWRITE_TAC[MESON[PER_SET3]` + p {v3, v1, v2} \/ p {v4, v1, v2} <=> p {v1,v2,v3} \/ p {v1,v2,v4} `] THEN +ONCE_REWRITE_TAC[MESON[UPS_X_SYM]` ups_x x12 x23 x13 = &0 \/ +ups_x x12 x24 x14 = &0 <=> ups_x x12 x13 x23 = &0 \/ +ups_x x12 x14 x24 = &0 `] THEN MESON_TAC[UPS_X_SYM; PER_SET3; FHFMKIY]);; +*) + +(* let EWVIFXW = LEMMA30;; *) + + +let LEMMA51 = GJWYYPS;; +let LEMMA50 = LTCTBAN;; +let muy_v = new_definition ` muy_v (x1: real^N ) (x2:real^N) (x3:real^N) (x4:real^N) +(x5:real^N) x45 = + (let x12 = dist (x1,x2) pow 2 in + let x13 = dist (x1,x3) pow 2 in + let x14 = dist (x1,x4) pow 2 in + let x15 = dist (x1,x5) pow 2 in + let x23 = dist (x2,x3) pow 2 in + let x24 = dist (x2,x4) pow 2 in + let x25 = dist (x2,x5) pow 2 in + let x34 = dist (x3,x4) pow 2 in + let x35 = dist (x3,x5) pow 2 in + cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45) `;; + +let REMOVE_TAC = MATCH_MP_TAC (MESON[]` a ==> b ==> a `);; + +let ALE = MESON[LTCTBAN]`!x12 x13 x14 x15 x23 x24 x25 x34 x35. + (!a b c. (! x. + cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x = + a * x pow 2 + b * x + c ) + ==> b pow 2 - &4 * a * c = &0) + ==> cayleytr x12 x13 x14 x15 x23 x24 x25 x34 x35 (&0) pow 2 - + &4 * + ups_x x12 x13 x23 * + cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 (&0) = + &0`;; + +let DISCRIMINANT_OF_CAY = MESON[LTCTBAN; GJWYYPS]`cayleytr x12 x13 x14 x15 x23 x24 x25 x34 x35 (&0) pow 2 - + &4 * ups_x x12 x13 x23 * cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 (&0) = + &16 * delta x12 x13 x14 x23 x24 x34 * delta x12 x13 x15 x23 x25 x35`;; + +let NOT_TWO_EQ_IMP_COL_EQUAVALENT = NOT_TOW_EQ_IMP_COL_EQUAVALENT;; + +let GDLRUZB = prove(` ! (v1:real^3) (v2:real^3) (v3:real^3) (v4:real^3) (v5:real^3) a b c. + coplanar_alt {v1, v2, v3, v4} \/ coplanar_alt {v1, v2, v3, v5} <=> + (! a b c. (! x. muy_v v1 v2 v3 v4 v5 x = a * x pow 2 + b * x + c ) + ==> b pow 2 - &4 * a * c = &0) `,REWRITE_TAC[muy_v] THEN LET_TR THEN +REPEAT GEN_TAC THEN EQ_TAC THENL [DISCH_TAC THEN +NHANH (MESON[GJWYYPS]` (!x45. cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 = + a * x45 pow 2 + b * x45 + c) + ==> b pow 2 - &4 * a * c = + &16 * + delta x12 x13 x14 x23 x24 x34 * + delta x12 x13 x15 x23 x25 x35`) THEN SIMP_TAC[] THEN +UNDISCH_TAC ` coplanar_alt {(v1:real^3), v2, v3, v4}\/ coplanar_alt {v1, v2, v3, v5}` THEN +MP_TAC LEMMA15 THEN LET_TR THEN REWRITE_TAC[REAL_FIELD` &16 * a * b = &0 +<=> a = &0 \/ b = &0 `] THEN SIMP_TAC[]; NHANH (SPEC_ALL ALE) THEN +REWRITE_TAC[DISCRIMINANT_OF_CAY ] THEN MP_TAC POLFLZY THEN LET_TR THEN +REWRITE_TAC[REAL_FIELD` &16 * a * b = &0 <=> a = &0 \/ b = &0 `] THEN +MESON_TAC[]]);; + + +let DET_VECC3_AND_DELTA = prove(` (! d a b c . + delta (dist3 d a pow 2) (dist3 d b pow 2) (dist3 d c pow 2) (dist3 a b pow 2) + (dist3 a c pow 2) + (dist3 b c pow 2) = + &4 * det_vec3 (a - d) (b - d) (c - d) pow 2) `, MESON_TAC[D3_SYM; +DET_VEC3_AND_DELTA]);; + + +let DELTA_POS_4POINTS = prove(`!x1 x2 x3 (x4:real^3). + &0 <= + delta (dist (x1,x2) pow 2) (dist (x1,x3) pow 2) (dist (x1,x4) pow 2) + (dist (x2,x3) pow 2) + (dist (x2,x4) pow 2) + (dist (x3,x4) pow 2)`, REWRITE_TAC[GSYM dist3] THEN SIMP_TAC[D3_SYM] THEN +MP_TAC (DET_VECC3_AND_DELTA) THEN SIMP_TAC[] THEN DISCH_TAC THEN MP_TAC + REAL_LE_SQUARE_POW THEN MESON_TAC[REAL_ARITH` &0 <= x <=> &0 <= &4 * x `]);; + + + +let DIST_POW2_DOT = +prove(` ! a (b:real^N) . dist (a,b) pow 2 = ( a - b ) dot ( a- b) `, +SIMP_TAC[dist; vector_norm; DOT_POS_LE; SQRT_WORKS]);; + +let UPS_X_POS = MESON[lemma8; UPS_X_SYM; NORM_SUB]` &0 <= + ups_x (norm ((x1 : real^3) - x2) pow 2) (norm (x1 - x3) pow 2) + (norm (x2 - x3) pow 2) `;; + +let UPS_X_SYM = MESON[UPS_X_SYM]` !x y z. ups_x x y z = ups_x y x z /\ ups_x x y z = ups_x x z y + /\ ups_x x y z = ups_x x z y `;; + + +end;; diff --git a/text_formalization/leg/collect_geom2.hl b/text_formalization/leg/collect_geom2.hl new file mode 100644 index 0000000..85dc2fa --- /dev/null +++ b/text_formalization/leg/collect_geom2.hl @@ -0,0 +1,3074 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Lemma: NUHSVLM *) +(* Chapter: leg *) +(* Author: Nguyen Quang Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + +(* second half of collect_geom.ml. +It was split in half by thales Feb 2010. + +This file was edited by thales on 2012-5-15 +to make it possible to load everything up through lemma GDRQXLG +giving the formula for the circumradius of a simplex. + +Everything dependent on unproved axioms was commented out. + +Feb 2013, some excess material removed. + *) + +flyspeck_needs "leg/cayleyR_def.hl";; +flyspeck_needs "leg/collect_geom.hl";; + +module Collect_geom2 (* : Collect_geom2_type *) = struct + + open Sphere;; + open Geomdetail;; + open Collect_geom;; + + + + let cayleyR = Cayleyr.cayleyR;; + + let LET_TR = Collect_geom.LET_TR;; + let DIST_POW2_DOT = Collect_geom.DIST_POW2_DOT;; + let UPS_X_POS = Collect_geom.UPS_X_POS;; + let DELTA_POS_4POINTS = Collect_geom.DELTA_POS_4POINTS;; + let REAL_LDISTRIB = REAL_ADD_LDISTRIB;; + let POW_2 = REAL_POW_2;; + let REAL_POSSQ = REAL_LT_SQUARE;; + let REAL_RDISTRIB = REAL_ARITH + `!x y z. (x + y) * z = (x * z) + (y * z)`;; (* Tactics_jordan *) + + let BY = Hales_tactic.BY;; + +(* deprecated def from sphere.hl *) + let mk_vec3 = new_definition + `mk_vec3 a b c = vector[a; b; c]`;; + let real3_of_triple = new_definition + `real3_of_triple (a,b,c) = (mk_vec3 a b c):real^3`;; + let triple_of_real3 = new_definition + `triple_of_real3 (v:real^3) = + (v$1, v$2, v$3)`;; +(* deprecated def from sphere.hl *) + + +(* this lemma is proved as below, but it take quite a long time to run it *) + +let CAYLEYR_5POINTS = prove(` !x1 x2 x3 x4 (x5 :real^3). + let x12 = dist (x1,x2) pow 2 in + let x13 = dist (x1,x3) pow 2 in + let x14 = dist (x1,x4) pow 2 in + let x15 = dist (x1,x5) pow 2 in + let x23 = dist (x2,x3) pow 2 in + let x24 = dist (x2,x4) pow 2 in + let x25 = dist (x2,x5) pow 2 in + let x34 = dist (x3,x4) pow 2 in + let x35 = dist (x3,x5) pow 2 in + let x45 = dist (x4,x5) pow 2 in + cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 = &0 `, +LET_TR THEN REWRITE_TAC[ DIST_POW2_DOT] THEN REPEAT GEN_TAC THEN +REWRITE_TAC[ MESON[VECTOR_ARITH` (a:real^n) - b = a - x - ( b - x ) `]` + AA ( (x1 - x5 ) dot ( x1 - x5)) ((x2 - x3) dot (x2 - x3)) + ((x2 - x4) dot (x2 - x4)) + ((x2 - x5) dot (x2 - x5)) + ((x3 - x4) dot (x3 - x4)) + ((x3 - x5) dot (x3 - x5)) + ((x4 - x5) dot (x4 - x5)) = + AA ( (x1 - x5 ) dot ( x1 - x5)) ((x2 - x1 - ( x3 - x1 )) dot (x2 - x1 - ( x3 - x1 ))) + ((x2 - x1 - ( x4 - x1 )) dot (x2 - x1 - ( x4 - x1 ))) + ((x2 - x1 - ( x5 - x1 )) dot (x2 - x1 - ( x5 - x1 ))) + ((x3 - x1 - ( x4 - x1 )) dot (x3 - x1 - ( x4 - x1 ))) + ((x3 - x1 - ( x5 - x1 )) dot (x3 - x1 - ( x5 - x1 ))) + ((x4 - x1 - ( x5 - x1 )) dot (x4 - x1 - ( x5 - x1 ))) ` ] THEN +SIMP_TAC[VECTOR_ARITH ` ((x4: real^N) - x1 - (x5 - x1)) = x1 - x5 - ( x1 - x4 ) `] THEN +ABBREV_TAC ` x12 = (x1 - ( x2:real^3)) ` THEN +ABBREV_TAC ` x13 = (x1 - ( x3:real^3)) ` THEN +ABBREV_TAC ` x14 = (x1 - ( x4:real^3)) ` THEN +ABBREV_TAC ` x15 = (x1 - ( x5:real^3)) ` THEN +REWRITE_TAC[DOT_3] THEN REWRITE_TAC[lemma_cm3; cayleyR] THEN REAL_ARITH_TAC);; + + + + +let LEMMA3 = prove(` !x1 x2 x3 x4 (x5 :real^3). + let x12 = dist (x1,x2) pow 2 in + let x13 = dist (x1,x3) pow 2 in + let x14 = dist (x1,x4) pow 2 in + let x15 = dist (x1,x5) pow 2 in + let x23 = dist (x2,x3) pow 2 in + let x24 = dist (x2,x4) pow 2 in + let x25 = dist (x2,x5) pow 2 in + let x34 = dist (x3,x4) pow 2 in + let x35 = dist (x3,x5) pow 2 in + let x45 = dist (x4,x5) pow 2 in + &0 <= ups_x x12 x13 x23 /\ + &0 <= delta x12 x13 x14 x23 x24 x34 /\ + cayleyR x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 = &0 `, MP_TAC +CAYLEYR_5POINTS THEN LET_TR THEN +SIMP_TAC[ dist; UPS_X_POS; DELTA_POS_4POINTS]);; + + +(* LEMMA 3 *) +let NUHSVLM = LEMMA3;; + + +(* OLD END OF MODULE *) + + +let LEMMA52 = prove( `! v1 v2 v3 v4 (v5:real^3). + muy_v v1 v2 v3 v4 v5 ( (dist3 v4 v5) pow 2 ) = &0 `, +REWRITE_TAC[muy_v; dist3] THEN MP_TAC LEMMA3 THEN +LET_TR THEN SIMP_TAC[]);; + +let PFDFWWV = LEMMA52;; + +let PRE_VIET = +REAL_ARITH `!x x1 x2. (x - x1) * (x - x2) = x pow 2 - (x1 + x2) * x + x1 * x2 /\ + a * (x - x1) * (x - x2) = a * x pow 2 + ( -- a * (x1 + x2)) * x + a * x1 * x2 `;; + + +let VIET_THEOREM = prove(`! x1 x2 a b c. (!x. a * x pow 2 + b * x + c = +a * (x - x1) * (x - x2)) ==> -- b = a * ( x1 + x2 ) /\ c = a * x1 * x2 `, +REWRITE_TAC[PRE_VIET; REAL_LDISTRIB;REAL_SUB_LDISTRIB; +REAL_ARITH ` a - b * c = a + -- b * c `; REAL_ARITH` ( a + b ) + c = +a + b + c `] THEN +REWRITE_TAC[REAL_MUL_ASSOC; EQUATE_CONEFS_POLINOMIAL_POW2] THEN +SIMP_TAC[] THEN REAL_ARITH_TAC);; + +let ADD_SUB_POW2_EX = REAL_RING ` ( a + b ) pow 2 = a pow 2 + &2 * a * b + b pow 2 /\ +( a - b ) pow 2 = a pow 2 - &2 * a * b + b pow 2 `;; + +let PRESENT_SUB_POW2 = REAL_RING` ! a b. ( a - b ) pow 2 = ( a + b ) pow 2 + - &4 * a * b `;; + +let DIST_ROOT_AND_DISCRIMINANT = prove(` ! a b c x1 x2. ( ! x. a * x pow 2 + b * x + c = + a * ( x - x1 ) * ( x - x2 ) ) + ==> ( a pow 2 ) * ( x1 - x2 ) pow 2 = b pow 2 - &4 * a * c `, +NHANH (SPEC_ALL VIET_THEOREM) THEN REWRITE_TAC[PRESENT_SUB_POW2] THEN +SIMP_TAC[REAL_ARITH ` -- b = a <=> b = -- a `] THEN REAL_ARITH_TAC);; + +(* le 33. P 22 MARKED *) + +let REAL_EQ_TO_LE_LT = REAL_ARITH ` + ( a = b <=> ~( a < b \/ b < a ) )`;; + +let FEBRUARY_13_09 = prove(` &0 < (u - v) dot (&2 % x - (u + v)) <=> + &0 < (u - v) dot (x - &1 / &2 % (u + v)) `, +ONCE_REWRITE_TAC[MESON[REAL_ARITH ` &0 < a <=> &0 < &2 * a `]` (a <=> &0 < b ) <=> + ( a <=> &0 < &2 * b ) `] THEN ONCE_REWRITE_TAC[VECTOR_ARITH ` x * (a dot b) = + a dot x % b `] THEN +REWRITE_TAC[GSYM VECTOR_SUB_DISTRIBUTE; VECTOR_MUL_ASSOC] THEN +REWRITE_TAC[REAL_ARITH ` &2 * &1 / &2 = &1 `; VECTOR_MUL_LID]);; + +let SUB_DOT_NEG_TO_POS = MESON[VECTOR_ARITH ` ( a - b ) dot x = +-- (( b - a ) dot x ) `; REAL_ARITH ` -- a < &0 <=> &0 < a `] +`! a b. ( a - b ) dot x < &0 <=> &0 < ( b - a ) dot x `;; + + +let LEMMA6 = prove(` !(u:real^3) v. ~(u = v) ==> plane_norm (bis u v) `, +REWRITE_TAC[plane_norm; bis] THEN REPEAT STRIP_TAC THEN +EXISTS_TAC ` (u: real^3) - v ` THEN +EXISTS_TAC ` &1 / &2 % ((u: real^3) + v )` THEN +REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM] THEN ASM_SIMP_TAC[VECTOR_SUB_EQ] THEN +REWRITE_TAC[REAL_EQ_TO_LE_LT; DIST_LT_HALF_PLANE;FEBRUARY_13_09; + SUB_DOT_NEG_TO_POS] THEN SIMP_TAC[VECTOR_ADD_SYM] THEN MESON_TAC[]);; + +let BXVMKNF = LEMMA6;; + + +let b_coef = BC_DEL_FOR;; +let c_coef = b_coef ;; + +let DELTA_X34_B = prove(` ! x12 x13 x14 x23 x24 x. delta_x34 x12 x13 x14 x23 x24 x = + -- &2 * x12 * x + b_coef x12 x13 x14 x23 x24 `, REWRITE_TAC[ delta_x34; b_coef]);; + + + + +let EQ_POW2_COND = prove(`!a b. &0 <= a /\ &0 <= b ==> (a = b <=> a pow 2 = b pow 2)`, +REWRITE_TAC[REAL_ARITH` a = b <=> a <= b /\ b <= a `] THEN SIMP_TAC[POW2_COND]);; + + +let EQ_SQRT_POW2_EQ = prove(` &0 <= a /\ &0 <= b ==> ( a = sqrt b <=> a pow 2 = b ) `, +SIMP_TAC[SQRT_WORKS; EQ_POW2_COND]);; + + +(* +let LEMMA33 = prove(` !x34 x12 x13 v1 x14 v3 x23 v2 v4 x24 x34' x34'' a. + condA v1 v2 v3 v4 x12 x13 x14 x23 x24 x34 /\ + (! x. muy_delta x12 x13 x14 x23 x24 x = a * ( x - x34' ) * ( x - x34'')) +/\ x34' <= x34'' + ==> delta_x34 x12 x13 x14 x23 x24 x34' = + sqrt (ups_x x12 x13 x23 * ups_x x12 x14 x24) /\ + delta_x34 x12 x13 x14 x23 x24 x34'' = + --sqrt (ups_x x12 x13 x23 * ups_x x12 x14 x24) `, +REWRITE_TAC[muy_delta; DELTA_X34_B; DELTA_COEFS] THEN +SIMP_TAC[EQUATE_CONEFS_POLINOMIAL_POW2; PRE_VIET; +REAL_ARITH ` -- a = b <=> b = -- a`] THEN +SIMP_TAC[REAL_RING `-- &2 * x12 * x34' + -- --x12 * (x34' + x34'') = a <=> + -- &2 * x12 * x34'' + -- --x12 * (x34' + x34'') = -- a `] THEN +REWRITE_TAC[REAL_ARITH` -- &2 * x12 * x34'' + -- --x12 * (x34' + x34'') + = x12 * ( x34' - x34'' ) `; condA] THEN REPEAT STRIP_TAC THEN +EXPAND_TAC "x12" THEN EXPAND_TAC "x13" THEN EXPAND_TAC "x23" THEN +EXPAND_TAC "x14" THEN EXPAND_TAC "x24" THEN +UNDISCH_TAC ` x34' <= (x34'':real)` THEN +ONCE_REWRITE_TAC[REAL_ARITH ` a <= b <=> &0 <= b - a `] THEN +ONCE_REWRITE_TAC[ REAL_ARITH ` a * ( b - c ) = -- ( a * ( c - b ) ) `] THEN +MP_TAC (GEN_ALL TROI_OI_DAT_HOI) THEN MP_TAC REAL_LE_POW_2 THEN +REWRITE_TAC[REAL_ARITH` -- a = -- b <=> a = b `] THEN +SIMP_TAC[UPS_X_SYM; REAL_LE_MUL; EQ_SQRT_POW2_EQ ] THEN +ASM_SIMP_TAC[] THEN REPEAT STRIP_TAC THEN +ONCE_REWRITE_TAC[ REAL_ARITH ` ( a * b ) pow 2 = a pow 2 * b pow 2 `] THEN +REWRITE_TAC[PRESENT_SUB_POW2] THEN +REWRITE_TAC[REAL_SUB_LDISTRIB; REAL_ARITH ` a pow 2 * b pow 2 = +( -- a * b ) pow 2 /\ a pow 2 * &4 * b = -- a * &4 * -- a * b `] THEN +UNDISCH_TAC `b_coef x12 x13 x14 x23 x24 = --a * (x34' + x34'')` THEN +UNDISCH_TAC `c_coef x12 x13 x14 x23 x24 = a * x34' * x34''` THEN +UNDISCH_TAC `(a: real) = --x12` THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +SIMP_TAC[] THEN SIMP_TAC[REAL_ARITH` -- -- a = a /\ ( -- a * b) pow 2 = + ( a * b ) pow 2 /\ ( a * -- b) pow 2 = ( a * b ) pow 2 `; REAL_ADD_SYM; + REAL_MUL_SYM] THEN SIMP_TAC[REAL_ADD_SYM; REAL_MUL_SYM] THEN +ONCE_REWRITE_TAC[REAL_ARITH ` ( a * b ) pow 2 = ( b * -- a ) pow 2 `] THEN +SIMP_TAC[] THEN REPEAT STRIP_TAC THEN EXPAND_TAC "a" THEN +REWRITE_TAC[REAL_RING ` a - -- c * b * &4 = a + &4 * c * b `] THEN +MESON_TAC[AGBWHRD; UPS_X_SYM]);; +*) + +(* let CMUDPKT = LEMMA33;; *) + +(* ============= *) + + +let LEMMA_OF_LE20 = prove(` ! x y z: real^3. + &2 <= dist3 x y /\ + dist3 x y <= #2.52 /\ + &2 <= dist3 x z /\ + dist3 x z <= #2.2 /\ + &2 <= dist3 y z /\ + dist3 y z <= #2.2 + ==> ~collinear {x, y, z} `, +MP_TAC JVUNDLC THEN +SIMP_TAC[] THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +REWRITE_TAC[MESON[]` (! a b c s. P a b c = s ==> Q a b c ) <=> + (! a b c . Q a b c ) `] THEN +SIMP_TAC[COL_EQ_UPS_0] THEN +MATCH_MP_TAC (TAUT` a ==> b ==> a `) THEN +REWRITE_TAC[GSYM dist3] THEN +REWRITE_TAC[REAL_ENTIRE] THEN +CONV_TAC REAL_FIELD);; + + + +let LT_POW2_EQ_LT = MESON[POW2_COND_LT; REAL_ARITH ` a <= b <=> ~ ( b < a ) `] +`&0 < a /\ &0 < b ==> ( a < b <=> a pow 2 < b pow 2 ) `;; + +let ETA_Y_LT_SQRT2 = prove(`eta_y #2.2 #2.2 #2.52 < sqrt #2`, +REWRITE_TAC[eta_y; eta_x; ups_x] THEN LET_TR THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN MP_TAC (REAL_FIELD ` &14641 / &8131< &2 `) + THEN MP_TAC (REAL_FIELD ` &0 < &2 /\ &0 < &14641 / &8131 `) THEN +NHANH (SPEC_ALL SQRT_POS_LT) THEN REWRITE_TAC[ REAL_ARITH ` #2 = &2 `] THEN +SIMP_TAC[REAL_ARITH ` &0 < a ==> &0 <= a `;SQRT_POS_LT; LT_POW2_EQ_LT; SQRT_WORKS]);; + +let ETA_YY_LT_SQRT2 = MESON[ETA_Y_LT_SQRT2; REAL_ARITH ` #2 = &2 `]` + eta_y #2.2 #2.2 #2.52 < sqrt ( &2 ) `;; + +let THANG_DEU = prove(` &2 <= x ==> &2 pow 2 <= x pow 2 `, +NHANH (REAL_ARITH ` &2 <= x ==> &0 <= &2 /\ &0 <= x `) +THEN MESON_TAC[POW2_COND]);; + +let NGAY23_THANG2_09 = prove(` &2 <= y /\ y <= sqrt (&8) ==> + &2 pow 2 <= y * y /\ y * y <= &8 `, +REWRITE_TAC[ GSYM REAL_POW_2] THEN DISCH_TAC THEN CONJ_TAC THENL +[ASM_MESON_TAC[REAL_ARITH ` &2 <= a ==> &0 <= &2 /\ &0 <= a `;POW2_COND]; +ASM_MESON_TAC[ SQRT_WORKS; REAL_ARITH ` &0 <= &8 `; + POW2_COND; REAL_ARITH `&2 <= a /\ a <= b ==> &0 <= b /\ &0 <= a `]]);; + + + +let ETA_Y_SQRT8_2_251 = prove(` eta_y ( sqrt (&8) ) (&2) #2.51 < #1.453`, +REWRITE_TAC[eta_y; eta_x; ups_x; GSYM POW_2] THEN +LET_TR THEN +REWRITE_TAC[MESON[SQRT_WORKS; REAL_ARITH ` &0 <= &8 `]` sqrt (&8) pow 2 = &8 `] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +MP_TAC (REAL_FIELD ` &0 < &20160320000 / &9551113999 /\ &0 < #1.453 `) THEN +NHANH (SPEC_ALL SQRT_POS_LT) THEN +SIMP_TAC[LT_POW2_EQ_LT; REAL_ARITH ` &0 < a ==> &0 <= a `; SQRT_POW_2] THEN +DISCH_TAC THEN +CONV_TAC REAL_FIELD );; + +let CDEUSDF_CHANGE = CDEUSDF;; + + +let CIRCUMCENTER_FORMULAR = prove(` ! va vb vc. ~collinear {va, vb, vc} + ==> circumcenter {va, vb, vc} = + (dist3 vb vc pow 2 * + (dist3 va vc pow 2 + dist3 va vb pow 2 - dist3 vb vc pow 2)) / + (ups_x (dist3 vb vc pow 2) (dist3 va vc pow 2) (dist3 va vb pow 2)) % + va + + (dist3 va vc pow 2 * + (dist3 vb vc pow 2 + dist3 va vb pow 2 - dist3 va vc pow 2)) / + (ups_x (dist3 vb vc pow 2) (dist3 va vc pow 2) (dist3 va vb pow 2)) % + vb + + (dist3 va vb pow 2 * + (dist3 vb vc pow 2 + dist3 va vc pow 2 - dist3 va vb pow 2)) / + (ups_x (dist3 vb vc pow 2) (dist3 va vc pow 2) (dist3 va vb pow 2)) % + vc `, +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +MP_TAC CDEUSDF_CHANGE THEN LET_TR THEN MESON_TAC[]);; + +let LE_EX = REAL_ARITH ` &0 <= a <=> a = &0 \/ &0 < a `;; + +let SUM_UPS_X_1 = prove(`!a b c. + &0 < ups_x a b c + ==> (c * (b + a - c)) / ups_x a b c + + (a * (c + b - a)) / ups_x a b c + + (b * (c + a - b)) / ups_x a b c = + &1`, REWRITE_TAC[ups_x] THEN CONV_TAC REAL_FIELD);; + + +MESON[POW2_COND; REAL_ARITH `&2 <= a /\ a <= b ==> &0 <= b /\ &0 <= a `]` + &2 <= y /\ y <= b ==> y pow 2 <= b pow 2 `;; + + +let FACTOR_OF_QUADRARTIC = prove(`! a b c x. ~(a = &0) /\ +&0 <= b pow 2 - &4 * a * c ==> a * x pow 2 + b * x + c = + a * + (x - (--b + sqrt (b pow 2 - &4 * a * c)) / (&2 * a)) * + (x - (--b - sqrt (b pow 2 - &4 * a * c)) / (&2 * a))` , +REWRITE_TAC[PRE_VIET] THEN SIMP_TAC[REAL_FIELD ` ~( a = &0 ) ==> +-- a * ( ( --b + del) / ( &2 * a ) + ( --b - del) / ( &2 * a )) = b `] THEN +REWRITE_TAC[REAL_FIELD ` a / b * a' / b = ( a * a' ) / ( b pow 2 ) `] THEN +REWRITE_TAC[REAL_FIELD ` a / b * a' / b = ( a * a' ) / ( b pow 2 ) `; + REAL_DIFFSQ; GSYM REAL_POW_2] THEN SIMP_TAC[SQRT_WORKS] THEN +SIMP_TAC[REAL_FIELD ` ~ ( a = &0 ) ==> a * (--b pow 2 - + (b pow 2 - &4 * a * c)) / (&2 * a) pow 2 = c `]);; + + +let COMPUTE_TO_QUA_POLY = prove(` #2.696 <= x /\ x <= sqrt8 ==> +x pow 2 * ( &1 / eta_y x #2.45 #2.45 pow 2 - + &1 / eta_y x ( &2 ) #2.51 pow 2 ) = &4331842500 / &363188227801 * x pow 4 + + -- &45702201 / &302530802 * x pow 2 + + &529046001 / &2520040000 `, REWRITE_TAC[eta_y; eta_x; ups_x] THEN +LET_TR THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +NHANH (MESON[REAL_ARITH ` #2.696 <= x /\ x <= sqrt8 ==> + &0 <= #2.696 /\ &0 <= x `; REAL_LE_MUL2] ` #2.696 <= x /\ x <= sqrt8 ==> + #2.696 * #2.696 <= x * x /\ x * x <= sqrt8 * sqrt8 `) THEN +NHANH (MESON[REAL_ARITH ` #2.696 * #2.696 <= x ==> &0 <= #2.696 * #2.696 /\ &0 <= x `; REAL_LE_MUL2] ` + #2.696 * #2.696 <= x /\ x <= hh ==> (#2.696 * #2.696) * #2.696 * #2.696 <= x * x /\ + x * x <= hh * hh `) THEN +REWRITE_TAC[sqrt8] THEN +REWRITE_TAC[REAL_POLY_CONV ` (--(x * x) * x * x - &16 - &3969126001 / &100000000 + + &2 * (x * x) * &63001 / &10000 + + &2 * (x * x) * &4 + + &63001 / &1250) `] THEN +REWRITE_TAC[REAL_POLY_CONV ` + (--(x * x) * x * x - &5764801 / &160000 - &5764801 / &160000 + + &2 * (x * x) * &2401 / &400 + + &2 * (x * x) * &2401 / &400 + + &5764801 / &80000) `] THEN +REWRITE_TAC[REAL_ARITH ` x pow 4 = ( x pow 2 ) pow 2 `] THEN +MP_TAC (REAL_ARITH ` ~ ( -- &1 = &0 ) /\ &0 <= ( &103001 / &5000 ) pow 2 - &4 * ( -- &1 ) * -- &529046001 / &100000000 `) THEN +SIMP_TAC[FACTOR_OF_QUADRARTIC] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +REWRITE_TAC[REAL_ARITH ` (&252004 / &625) = ( &502 / &25 ) * ( &502 / &25 ) `] THEN +REWRITE_TAC[MESON[REAL_ARITH ` &0 <= &502 / &25 /\ x * x = x pow 2 `; POW_2_SQRT]` + sqrt ( ( &502 / &25 ) * ( &502 / &25 )) = ( &502 / &25 ) `] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +REWRITE_TAC[ GSYM POW_2] THEN +REWRITE_TAC[REAL_ARITH ` a * x pow 2 + b * x = ( a * x + b ) * x `] THEN +REWRITE_TAC[MESON[SQRT_WORKS; REAL_ARITH ` &0 <= &8`]` sqrt (&8) pow 2 = &8 `] THEN +NHANH (REAL_FIELD ` (&113569 / &15625 <= x pow 2 /\ x pow 2 <= &8) + ==> &0 <= (-- &1 * x pow 2 + &2401 / &100) /\ + &0 <= (x pow 2 - &2601 / &10000 ) /\ + &0 <= -- ((x pow 2 - &203401 / &10000) )/\ &0 <= &5764801 / &160000 /\ +&0 <= &63001 / &2500`) THEN +MP_TAC REAL_LE_POW_2 THEN +REWRITE_TAC[REAL_ARITH ` -- &1 * a * b = a * -- b `] THEN +REWRITE_TAC[REAL_FIELD ` ( &1 / a ) pow 2 = &1 / ( a pow 2 ) `] THEN +MP_TAC REAL_LE_MUL THEN +MP_TAC REAL_LE_DIV THEN +SIMP_TAC[ SQRT_WORKS] THEN +REWRITE_TAC[REAL_SUB_LDISTRIB] THEN +REWRITE_TAC[REAL_FIELD ` &1 / ( a / b ) = b / a `] THEN +SIMP_TAC[REAL_FIELD ` &113569 / &15625 <= a ==> a * ( b / ( a * c )) = b / c `] THEN +REWRITE_TAC[REAL_POLY_CONV ` ((-- &1 * x pow 2 + &2401 / &100) * x pow 2) / (&5764801 / &160000) - + ((x pow 2 - &2601 / &10000) * --(x pow 2 - &203401 / &10000)) / + (&63001 / &2500) `] THEN +REWRITE_TAC[REAL_ARITH ` a pow 4 = a pow 2 pow 2 `]);; + +(* +REAL_ARITH ` &4650694416 = ( &68196 ) pow 2 `;; +REAL_ARITH` &4650694416 / &363188227801 = ( &68196 / &602651 ) pow 2 `;; +*) + +let PHAN_TICH = prove( `! x. &4331842500 / &363188227801 * + (x pow 2 - &488365801 / &44090000) * + (x pow 2 - &2081667 / &1310000) = + &4331842500 / &363188227801 * x pow 4 + + -- &45702201 / &302530802 * x pow 2 + + &529046001 / &2520040000` , REAL_ARITH_TAC);; + +let Q_TR = prove(`! x. #2.696 <= x /\ x <= sqrt8 ==> + x pow 2 * + (&1 / eta_y x #2.45 #2.45 pow 2 - &1 / eta_y x (&2) #2.51 pow 2) <= &0 `, +SIMP_TAC[COMPUTE_TO_QUA_POLY; GSYM PHAN_TICH ] THEN +NHANH (MESON[REAL_ARITH ` #2.696 <= x /\ x <= hh ==> &0 <= #2.696 /\ &0 <= x` + ; REAL_LE_MUL2] ` #2.696 <= x /\ x <= hh ==> + #2.696 * #2.696 <= x * x /\ x * x <= hh * hh `) THEN +REWRITE_TAC[REAL_ARITH ` + &4331842500 / &363188227801 * a <= &0 <=> a <= &0 `] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +REWRITE_TAC[REAL_ARITH ` &0 <= + &4331842500 / &363188227801 * a <=> &0 <= a `; sqrt8; GSYM POW_2; + MESON[SQRT_WORKS; REAL_ARITH ` &0 <= &8 `]` sqrt (&8) pow 2 = &8 `] THEN +NHANH (REAL_ARITH ` &113569 / &15625 <= x pow 2 /\ + x pow 2 <= &8 ==> x pow 2 - &488365801 / &44090000 <= &0 /\ + x pow 2 - &2081667 / &1310000 >= &0 `) THEN +REWRITE_TAC[ REAL_ARITH ` ( a >= &0 <=> &0 <= a)/\ (a <= &0 <=> &0 <= -- a ) `] THEN +REWRITE_TAC[REAL_ARITH ` -- ( a * b ) = -- a * b `] THEN +MESON_TAC[REAL_LE_MUL]);; + +let SQRT8_LT = prove(` sqrt (&8) < &4 * #2.45 `, +MP_TAC (REAL_ARITH ` &0 < &8 /\ &0 < &4 * #2.45`) THEN +SIMP_TAC[SQRT_POS_LT; LT_POW2_EQ_LT] THEN +SIMP_TAC[REAL_LT_IMP_LE; SQRT_WORKS] THEN REAL_ARITH_TAC);; + + + +let SQRT8_POW2 = MESON[SQRT_WORKS; REAL_ARITH ` &0 <= &8 `]` sqrt (&8) pow 2 = &8 `;; + + +let IM_UP_POS = prove(`! x. #2.696 <= x /\ x <= sqrt8 ==> +&0 < ups_x (x * x) (#2.45 * #2.45) (#2.45 * #2.45) /\ +&0 < ups_x (x * x) (&2 * &2) (#2.51 * #2.51) `, +REWRITE_TAC[ups_x] THEN +REWRITE_TAC[REAL_IDEAL_CONV [` (x:real) pow 2 `]` + --(x * x) * x * x - + (#2.45 * #2.45) * #2.45 * #2.45 - + (#2.45 * #2.45) * #2.45 * #2.45 + + &2 * (x * x) * #2.45 * #2.45 + + &2 * (x * x) * #2.45 * #2.45 + + &2 * (#2.45 * #2.45) * #2.45 * #2.45 `] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +REWRITE_TAC[REAL_POLY_CONV ` --(x * x) * x * x - &16 - &3969126001 / &100000000 + + &2 * (x * x) * &63001 / &10000 + + &2 * (x * x) * &4 + + &63001 / &1250 `] THEN +NHANH (REAL_ARITH` #2.696 <= x /\ x <= s ==> &0 <= #2.696 /\ + &0 <= x /\ &0 <= s `) THEN +ONCE_REWRITE_TAC[MESON[]` a /\ b ==> c <=> b ==> a ==> c `] THEN +SIMP_TAC[POW2_COND; sqrt8; SQRT8_POW2] THEN +NHANH (REAL_ARITH` #2.696 pow 2 <= x /\ x <= &8 ==> + &0 < &2401 / &100 + -- &1 * x /\ &0 < x /\ + ~ ( -- &1 = &0 ) /\ &0 <= ( &103001 / &5000 ) pow 2 - &4 * -- &1 * + -- &529046001 / &100000000 `) THEN +SIMP_TAC[REAL_ARITH ` x pow 4 = x pow 2 pow 2 `; FACTOR_OF_QUADRARTIC] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +REWRITE_TAC[REAL_ARITH ` &252004 / &625 = ( &502 / &25) pow 2 `] THEN +REWRITE_TAC[MESON[POW_2_SQRT; REAL_ARITH ` &0 <= &502 / &25 `]` + sqrt ((&502 / &25) pow 2) = &502 / &25 `] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +NHANH (REAL_ARITH ` &113569 / &15625 <= x pow 2 /\ x pow 2 <= &8 ==> + &0 < x pow 2 - &2601 / &10000 /\ &0 < -- (x pow 2 - &203401 / &10000) `) THEN +REWRITE_TAC[REAL_ARITH ` -- &1 * a * b = a * --b `] THEN +SIMP_TAC[REAL_LT_MUL]);; + + +let IMP_ETAY_POS = prove( `! x. #2.696 <= x /\ x <= sqrt8 ==> +&0 < eta_y x #2.45 #2.45 /\ &0 < eta_y x (&2) #2.51 `, +REWRITE_TAC[eta_y; eta_x] THEN +LET_TR THEN +NHANH (MESON[REAL_ARITH ` &0 <= #2.696`; REAL_LE_MUL2]` + #2.696 <= x ==> #2.696 * #2.696 <= x * x `) THEN +NHANH (REAL_ARITH ` #2.696 * #2.696 <= x * x ==> + &0 < ((x * x) * (#2.45 * #2.45) * #2.45 * #2.45) /\ + &0 < ((x * x) * (&2 * &2) * #2.51 * #2.51) `) THEN +MESON_TAC[IM_UP_POS; REAL_LT_DIV; SQRT_POS_LT]);; + + +let REAL_LE_RDIV_0 = prove(` ! a b. &0 < b ==> ( &0 <= a / b <=> &0 <= a ) `, +REWRITE_TAC[REAL_ARITH ` &0 <= a <=> &0 < a \/ a = &0 `] THEN +SIMP_TAC[REAL_LT_RDIV_0] THEN +SIMP_TAC[REAL_FIELD `&0 < b ==> ( a / b = &0 <=> a = &0 ) `]);; + + +let NHSJMDH = prove(` ! y. #2.696 <= y /\ y <= sqrt8 ==> + eta_y y (&2) (#2.51) <= eta_y y #2.45 (#2.45) `, +NHANH (SPEC_ALL Q_TR) THEN +ONCE_REWRITE_TAC[MESON[]` a /\ b ==> c <=> a ==> b ==> c `] THEN +NHANH (MESON[REAL_ARITH ` &0 <= #2.696`; REAL_LE_MUL2]` + #2.696 <= x ==> #2.696 * #2.696 <= x * x `) THEN +REWRITE_TAC[POW_2] THEN +NHANH (REAL_ARITH `#2.696 * #2.696 <= y ==> &0 < y `) THEN +REWRITE_TAC[REAL_ARITH ` a * b <= &0 <=> &0 <= a * -- b `] THEN +SIMP_TAC[REAL_LE_MUL_EQ] THEN +ONCE_REWRITE_TAC[MESON[]`( a/\b ) /\ c <=> ( a /\ c ) /\ b `] THEN +NHANH (SPEC_ALL IMP_ETAY_POS) THEN +NHANH (REAL_ARITH ` &0 < eta_y a b c ==> ~(eta_y a b c = &0 ) `) THEN +REWRITE_TAC[GSYM REAL_POSSQ] THEN SIMP_TAC[REAL_FIELD ` &0 < a /\ + &0 < b ==> -- (&1 / a - &1 / b) = (a - b) / ( a * b ) `] THEN +PHA THEN SIMP_TAC[REAL_LT_MUL; REAL_LE_RDIV_0] THEN +REWRITE_TAC[GSYM REAL_DIFFSQ] THEN +SIMP_TAC[REAL_LT_ADD; REAL_LE_MUL_EQ] THEN REAL_ARITH_TAC);; + +(* NEW WORKS *) +let SQRT8_LE = MESON[ REAL_ARITH ` &0 <= &8`; SQRT_WORKS]` &0 <= sqrt (&8) `;; + +let RELATE_POW2 = prove(` ( a = &0 <=> a pow 2 = &0 ) /\ + ( &0 < a pow 2 <=> &0 < a \/ ~( &0 <= a )) `, +MP_TAC (REAL_FIELD ` a = &0 <=> a pow 2 = &0 `) THEN DISCH_TAC THEN +CONJ_TAC THENL [ASM_SIMP_TAC[]; MP_TAC REAL_LE_POW_2] THEN +MP_TAC (REAL_ARITH `( ! a. &0 < a \/ ~(&0 <= a) \/ a = &0 )`) THEN +MP_TAC (REAL_FIELD ` a = &0 <=> a pow 2 = &0 `) THEN +REWRITE_TAC[REAL_ARITH ` A <= b <=> A = b \/ A < b `] THEN +MESON_TAC[REAL_ARITH ` ~ ( a = &0 /\ ( &0 < a \/ ~( &0 <= a ) )) `]);; + +let LT_POW2_COND = prove(`!a b. &0 <= a /\ &0 <= b ==> (a < b <=> a pow 2 < b pow 2)`, +REPEAT GEN_TAC THEN ASM_CASES_TAC ` a = &0 ` THENL +[ASM_SIMP_TAC[REAL_ARITH` &0 pow 2 = &0 `] THEN MESON_TAC[RELATE_POW2]; +ASM_SIMP_TAC[REAL_LE_LT]] THEN STRIP_TAC THENL [ASM_MESON_TAC[LT_POW2_EQ_LT]; +EXPAND_TAC "b"] THEN UNDISCH_TAC `&0 < a ` THEN REWRITE_TAC[REAL_ARITH ` + &0 pow 2 = &0 /\ (a < &0 <=> ~(&0 <= a))`] THEN MP_TAC REAL_LE_POW_2 THEN +MESON_TAC[REAL_LT_IMP_LE]);; + + +let POS_IMP_POW2 = MESON[REAL_LE_TRANS; POW2_COND]` &0 <= a /\ a <= b ==> a pow 2 + <= b pow 2 `;; + + +let SQRT8_LE_EQ_8_LESS_POW2 = prove(` sqrt (&8 ) <= a ==> &8 <= a pow 2 `, +MP_TAC SQRT8_LE THEN MESON_TAC[SQRT8_POW2; POS_IMP_POW2]);; + + +let MINIMAL_QUADRATIC_POLY = prove(` +! b c (x:real). ( &4 * c - b pow 2 ) / &4 <= x pow 2 + b * x + c `, +ONCE_REWRITE_TAC[REAL_ARITH ` a <= b <=> &0 <= b - a `] THEN +REWRITE_TAC[REAL_ARITH ` (x pow 2 + b * x + c) - (&4 * c - b pow 2) / &4 + = ( x + b / &2 ) pow 2 `; REAL_LE_POW_2]);; + +let GREATER_THAN_MID_QUADRATIC_PO = prove(` ! b c x x0. -- b / &2 <= x0 /\ x0 <= x ==> + x0 pow 2 + b * x0 + c <= x pow 2 + b * x + c `, +REWRITE_TAC[REAL_ARITH ` x0 pow 2 + b * x0 + c <= x pow 2 + b * x + c + <=> &0 <= ( x - x0 ) * ( x + x0 + b ) `] THEN +MESON_TAC[REAL_ARITH ` --b / &2 <= x0 /\ x0 <= x ==> + &0 <= x - x0 /\ &0 <= x + x0 + b `; REAL_LE_MUL]);; + +(* PERMAINENCE *) +(* MARCH WORKS *) + +let SQRT8_TWO_TWO = prove(` sqrt (&8) <= &2 + &2 `, +MP_TAC SQRT8_LE THEN NHANH (MESON[REAL_ARITH ` &0 <= &2 + &2 `] +`&0 <= sqrt (&8) ==> &0 <= &2 + &2 `) THEN SIMP_TAC[POW2_COND] THEN +SIMP_TAC[REAL_ARITH ` &0 <= &8 `; SQRT_WORKS] THEN REAL_ARITH_TAC);; + + +let A_POS_DELTA = prove(` &0 < delta (#3.2 pow 2 ) (sqrt8 pow 2 ) (&2 pow 2) (sqrt8 pow 2) +(&2 pow 2) (&2 pow 2) `, REWRITE_TAC[delta; sqrt8; SQRT8_POW2] THEN REAL_ARITH_TAC);; + +let MET_LAM_ROI = prove(` #3.2 < sqrt8 + &2 /\ #3.2 < &2 + &2 /\ sqrt8 < sqrt8 + &2 /\ +sqrt8 < &2 + &2 `, +REWRITE_TAC[sqrt8; REAL_ARITH ` a < sqrt (&8) + b <=> a - b < sqrt (&8) `] THEN +REWRITE_TAC[REAL_ARITH ` sqrt (&8) - &2 < sqrt (&8) `] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN MP_TAC SQRT8_LE THEN +MP_TAC (REAL_ARITH` &0 <= &6 / &5 /\ &0 <= &4 `) THEN +SIMP_TAC[LT_POW2_COND ] THEN SIMP_TAC[LT_POW2_COND; SQRT8_POW2 ] THEN +REAL_ARITH_TAC);; + + +let PROVE_POS_THINGS = prove(` ! x. x IN {#3.2 , sqrt8, &2 , sqrt8, &2, &2 } ==> &0 <= x `, +REWRITE_TAC[SET_RULE `( !x. x IN {a,b,c,d,s,e} ==> p x ) <=> + p a /\ p b /\ p c /\ p d /\ p s /\ p e `;sqrt8; SQRT8_LE] THEN REAL_ARITH_TAC);; + + + +let IMP_GT_THAN_TWO = prove(` ! v1 v2 w1 (w2:real^3). + CARD {v1, w1,v2, w2} = 4 /\ + packing {v1, w1,v2, w2} +==> &2 <= dist3 w1 v2 /\ + &2 <= dist3 v2 w2 /\ + &2 <= dist3 v1 w2 `, +REWRITE_TAC[CARD4; packing; GSYM dist3; sqrt8] THEN SET_TAC[]);; + +(* THADGSB *) + + +let LEMMA_FOR_PAHFWSI = prove(`! v1 v2 v3 v4. CARD {v1, v2, v3, v4} = 4 /\ + packing {v1, v2, v3, v4} /\ + dist (v1,v3) <= #3.2 /\ + #2.51 <= dist (v1,v2) /\ + dist (v2,v4) <= #2.51 +==> (!x. x IN {#3.2, #2.51, &2, #2.51, &2, &2} ==> &0 <= x) /\ + #3.2 < #2.51 + &2 /\ + #3.2 < &2 + &2 /\ + #2.51 < #2.51 + &2 /\ + #2.51 < &2 + &2 /\ + &0 < + delta (#3.2 pow 2) (#2.51 pow 2) (&2 pow 2) (#2.51 pow 2) (&2 pow 2) + (&2 pow 2) /\ + CARD {v1, v2, v3, v4} = 4 /\ + #2.51 <= dist3 v1 v2 /\ + &2 <= dist3 v2 v3 /\ + &2 <= dist3 v3 v4 /\ + &2 <= dist3 v1 v4 /\ + dist3 v1 v3 <= #3.2 /\ + dist3 v2 v4 <= #2.51 `, +REWRITE_TAC[SET_RULE ` (!x. x IN {a,b,c,d,e,f} ==> P x ) <=> + P a /\ P b /\ P c /\ P d /\ P e /\ P f `; REAL_ARITH ` + &0 <= #2.51 /\ + &0 <= &2 /\ + &0 <= &2 /\ + &0 <= #3.2 /\ + &0 <= &2 /\ + &0 <= #2.51 /\ #2.51 < &2 + #2.51 /\ + #2.51 < &2 + &2 /\ + #3.2 < &2 + &2 /\ + #3.2 < #2.51 + &2 /\ #3.2 < &2 + #2.51 /\ + #2.51 < #2.51 + &2 `] THEN SIMP_TAC[GSYM dist3] THEN +REWRITE_TAC[CARD4; packing; delta; dist3] THEN CONV_TAC REAL_RAT_REDUCE_CONV +THEN SET_TAC[]);; + +let LEMMA_OF_39 = prove(` ! (v1:real^3) v2 w1 w2. + CARD {v1, v2, w1, w2} = 4 /\ + packing {v1, v2, w1, w2} /\ + dist (w1,w2) <= #2.51 /\ + dist (v1,v2) <= #3.07 +==> (!x. x IN {#2.51, &2, &2, #3.07, &2, &2} ==> &0 <= x) /\ + #2.51 < &2 + &2 /\ + #2.51 < &2 + &2 /\ + #3.07 < &2 + &2 /\ + #3.07 < &2 + &2 /\ + &0 < + delta (#2.51 pow 2) (&2 pow 2) (&2 pow 2) (#3.07 pow 2) (&2 pow 2) + (&2 pow 2) /\ + CARD {w1, v1, w2, v2} = 4 /\ + &2 <= dist3 w1 v1 /\ + &2 <= dist3 v1 w2 /\ + &2 <= dist3 w2 v2 /\ + &2 <= dist3 w1 v2 /\ + dist3 w1 w2 <= #2.51 /\ + dist3 v1 v2 <= #3.07 `, +REWRITE_TAC[SET_RULE ` (!x. x IN {a,b,c,d,e,f} ==> P x ) <=> + P a /\ P b /\ P c /\ P d /\ P e /\ P f `; delta; GSYM dist3] THEN CONV_TAC +REAL_RAT_REDUCE_CONV THEN REPEAT GEN_TAC THEN STRIP_TAC THEN CONJ_TAC THENL +[ASM_MESON_TAC[SET_RULE ` {v1, v2, w1, w2} = {w1, v1, w2, v2}`];DOWN_TAC] + THEN REWRITE_TAC[CARD4; packing; dist3] THEN SET_TAC[]);; + +let LEMMA_OF_LEMMA40 = prove(`! v1 v2 w1 (w2:real^3). CARD {v1, v2, w1, w2} = 4 /\ + packing {v1, v2, w1, w2} /\ + dist (v1,v2) <= #3.2 /\ + dist (w1,w2) <= #2.51 /\ + #2.2 <= dist (v1,w1) +==> (!x. x IN {#3.2, #2.2, &2, #2.51, &2, &2} ==> &0 <= x) /\ + #3.2 < #2.2 + &2 /\ + #3.2 < &2 + &2 /\ + #2.51 < #2.2 + &2 /\ + #2.51 < &2 + &2 /\ + &0 < + delta (#3.2 pow 2) (#2.2 pow 2) (&2 pow 2) (#2.51 pow 2) (&2 pow 2) + (&2 pow 2) /\ + CARD {v1, w1, v2, w2} = 4 /\ + #2.2 <= dist3 v1 w1 /\ + &2 <= dist3 w1 v2 /\ + &2 <= dist3 v2 w2 /\ + &2 <= dist3 v1 w2 /\ + dist3 v1 v2 <= #3.2 /\ + dist3 w1 w2 <= #2.51 `, +REWRITE_TAC[SET_RULE ` (! x. x IN {a,b,c,d,e,f} ==> P x ) <=> + P a /\ P b /\ P c /\ P d /\ P e /\ P f `; delta] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN SIMP_TAC[SET_RULE ` +{v1, v2, w1, w2} = {v1, w1, v2, w2} `; packing] THEN +SIMP_TAC[CARD4; GSYM dist3] THEN SET_TAC[]);; + +let LEOF41 = prove( +`#3.114467 < x ==> delta (#2.51 pow 2) (&2 pow 2) (&2 pow 2) (&2 pow 2) + (&2 pow 2) (x pow 2) < &0`, +NHANH (MESON[REAL_ARITH ` #3.114467 < x ==> &0 < #3.114467 /\ &0 < x `; + LT_POW2_EQ_LT]` #3.114467 < x ==> ( #3.114467 ) pow 2 < x pow 2 `) THEN +REWRITE_TAC[delta] THEN CONV_TAC REAL_RAT_REDUCE_CONV THEN +REWRITE_TAC[ REAL_POLY_CONV ` -- &126002 / &625 - &4 * &4 * x pow 2 - &4 * &4 * x pow 2 + + &63001 / &10000 * x pow 2 * + (-- &63001 / &10000 + &4 + &4 + &4 + &4 - x pow 2) + + &4 * &4 * (&23001 / &10000 + &4 + &0 + x pow 2) + + &4 * &4 * (&63001 / &10000 + -- &4 + &4 + x pow 2) `] THEN +REWRITE_TAC[REAL_ARITH ` a pow 4 = a pow 2 pow 2 `] THEN +REWRITE_TAC[REAL_ARITH ` a * x pow 2 + b * x = ( a * x + b ) * x `] THEN +NHANH (REAL_ARITH `&9699904694089 / &1000000000000 < x pow 2 + ==> -- &63001 / &10000 * x pow 2 + &6111033999 / &100000000 < &0` ) THEN +NHANH (REAL_ARITH `&9699904694089 / &1000000000000 < x ==> &0 < x `) THEN +REWRITE_TAC[REAL_ARITH ` a < &0 <=> &0 < -- a `; + REAL_ARITH ` -- ( a * b ) = -- a * b `] THEN MESON_TAC[REAL_LT_MUL]);; + + +let LEMMA41 = prove(`! v1 v2 v3 (v4:real^3). + CARD {v1,v2,v3,v4} = 4 /\ + dist3 v1 v2 = #2.51 /\ + dist3 v1 v3 = &2 /\ + dist3 v1 v4 = &2 /\ + dist3 v2 v3 = &2 /\ + dist3 v2 v4 = &2 + ==> dist3 v3 v4 <= #3.114467 `, +REPEAT GEN_TAC THEN MP_TAC LEMMA3 THEN LET_TR THEN +REWRITE_TAC[REAL_ARITH ` x <= #3.114467 <=> ~ (#3.114467 < x ) `] THEN +REWRITE_TAC[REAL_ARITH ` x <= #3.114467 <=> ~ (#3.114467 < x ) `; + MESON[]` a ==> ~ b <=> a /\ b ==> F `] THEN PHA THEN +NHANH (SPEC_ALL (prove(`! (v1:real^3) v2 v3 v4. dist3 v1 v2 = #2.51 /\ +dist3 v1 v3 = &2 /\ dist3 v1 v4 = &2 /\ dist3 v2 v3 = &2 /\ dist3 v2 v4 = &2 /\ +#3.114467 < dist3 v3 v4 ==> delta (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) +(dist (v1,v4) pow 2) (dist (v2,v3) pow 2) (dist (v2,v4) pow 2) + (dist (v3,v4) pow 2) < &0 `, SIMP_TAC[dist3] THEN MESON_TAC[LEOF41]))) THEN +REWRITE_TAC[REAL_ARITH ` a < &0 <=> ~( &0 <= a ) `; dist3] THEN MESON_TAC[]);; + +let YXWIPMH = LEMMA41;; + +let LEMMA_OF_L42 = prove(`sqrt8 <= dist3 v2 v4 /\ #3.488 <= x + ==> -- &1 * x pow 2 * dist3 v2 v4 pow 2 + + -- &1 * x pow 4 + + &103001 / &5000 * x pow 2 + + -- &529046001 / &100000000 < + &0`, +MP_TAC SQRT8_LE THEN +IMP_IMP_TAC THEN +NHANH (MESON[REAL_ARITH ` &0 <= a /\ a <= b /\ #3.488 <= x ==> &0 <= b /\ + &0 <= #3.488 /\ &0 <= x `; POW2_COND]` + &0 <= a /\ a <= b /\ #3.488 <= x ==> a pow 2 <= b pow 2 /\ + #3.488 pow 2 <= x pow 2 `) THEN +REWRITE_TAC[SQRT8_POW2; sqrt8] THEN +NHANH (MESON[REAL_ARITH ` &0 <= a /\ a <= b /\ #3.488 <= x ==> &0 <= b /\ + &0 <= #3.488 /\ &0 <= x `; POW2_COND]` + &0 <= a /\ a <= b /\ #3.488 <= x ==> a pow 2 <= b pow 2 /\ + #3.488 pow 2 <= x pow 2 `) THEN +REWRITE_TAC[SQRT8_POW2] THEN +NHANH (MESON[REAL_ARITH ` &0 <= &8 /\ &0 <= #3.488 pow 2 `; REAL_LE_MUL2]` &8 <= a /\ + #3.488 pow 2 <= b ==> &8 * #3.488 pow 2 <= a * b `) THEN +REWRITE_TAC[REAL_ARITH` a pow 4 = a pow 2 pow 2 `] THEN +NHANH (MESON[REAL_ARITH ` #3.488 pow 2 <= x ==> &0 <= #3.488 pow 2 /\ + &0 <= x `; POW2_COND]` #3.488 pow 2 <= x ==> #3.488 pow 2 pow 2 <= x pow 2 `) THEN +REWRITE_TAC[REAL_ARITH ` a + -- &1 * x pow 2 + b * x + c = + a + -- &1 * ( x pow 2 + -- b * x + -- c ) `] THEN +NHANH (prove(` #3.488 pow 2 <= x pow 2 ==> + #3.488 pow 2 pow 2 + + --(&103001 / &5000) * #3.488 pow 2 + + --(-- &529046001 / &100000000) <= x pow 2 pow 2 + + --(&103001 / &5000) * x pow 2 + + --(-- &529046001 / &100000000) `, +MP_TAC (REAL_ARITH ` -- ( --(&103001 / &5000)) / &2 <= #3.488 pow 2 `) THEN +MESON_TAC[GREATER_THAN_MID_QUADRATIC_PO ])) THEN +REAL_ARITH_TAC);; + + + +let LEMMA_IN_LEMMA42_P25 = prove(` ! v1 v2 v3 v4 x. + dist3 v1 v2 = #2.51 /\ + dist3 v1 v4 = #2.51 /\ + dist3 v2 v3 = &2 /\ + dist3 v3 v4 = &2 /\ + sqrt8 <= dist3 v2 v4 /\ + #3.488 <= x +==> delta (dist3 v1 v2 pow 2) ( x pow 2) (dist3 v1 v4 pow 2) + (dist3 v2 v3 pow 2) + (dist3 v2 v4 pow 2) + (dist3 v3 v4 pow 2) < &0 `, +SIMP_TAC[] THEN +NHANH (MESON[REAL_ARITH` #3.488 <= x ==> &0 <= #3.488 /\ &0 <= x `; POW2_COND]` + #3.488 <= x ==> (#3.488 pow 2 <= x pow 2 ) `) THEN +REWRITE_TAC[delta] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +REWRITE_TAC[REAL_POLY_CONV `--(&63001 / &10000 * x pow 2 * &4) - + &63001 / &10000 * &63001 / &10000 * dist3 v2 v4 pow 2 - + x pow 2 * &63001 / &2500 - + &4 * dist3 v2 v4 pow 2 * &4 + + &63001 / &10000 * + &4 * + (-- &63001 / &10000 + + x pow 2 + + &63001 / &10000 + + &4 + + dist3 v2 v4 pow 2 - &4) + + x pow 2 * + dist3 v2 v4 pow 2 * + (&63001 / &10000 - x pow 2 + + &63001 / &10000 + + &4 - dist3 v2 v4 pow 2 + + &4) + + &63001 / &10000 * + &4 * + (&63001 / &10000 + + x pow 2 - &63001 / &10000 - &4 + + dist3 v2 v4 pow 2 + + &4) `] THEN +REWRITE_TAC[REAL_IDEAL_CONV [` y pow 2 `] `-- &1 * x pow 4 * y pow 2 + + -- &1 * x pow 2 * y pow 4 + + &103001 / &5000 * x pow 2 * y pow 2 + + -- &529046001 / &100000000 * y pow 2 `] THEN +REWRITE_TAC[MESON[]` a/\ #3.488 <= x /\ c <=> (a/\ #3.488 <= x )/\ c`] THEN +NHANH (LEMMA_OF_L42) THEN +REWRITE_TAC[sqrt8] THEN +NHANH (SQRT8_LE_EQ_8_LESS_POW2) THEN +REPEAT GEN_TAC THEN +STRIP_TAC THEN +UNDISCH_TAC ` &8 <= dist3 v2 v4 pow 2 ` THEN +UNDISCH_TAC ` -- &1 * x pow 2 * dist3 v2 v4 pow 2 + + -- &1 * x pow 4 + + &103001 / &5000 * x pow 2 + + -- &529046001 / &100000000 < + &0 ` THEN +ABBREV_TAC ` xx = (-- &1 * x pow 2 * dist3 v2 v4 pow 2 + + -- &1 * x pow 4 + + &103001 / &5000 * x pow 2 + + -- &529046001 / &100000000)` THEN +NHANH (REAL_ARITH ` &8 <= a ==> &0 < a `) THEN +REWRITE_TAC[REAL_ARITH ` ( a * b < &0 <=> &0 < ( -- a ) * b )/\ + ( a < &0 <=> &0 < -- a )`] THEN +SIMP_TAC[REAL_LT_MUL]);; + +let PAATDXJ =prove(` ! v1 v2 v3 (v4:real^3). + CARD {v1,v2,v3,v4} = 4 /\ + dist3 v1 v2 = #2.51 /\ + dist3 v1 v4 = #2.51 /\ + dist3 v2 v3 = &2 /\ + dist3 v3 v4 = &2 /\ + sqrt8 <= dist3 v2 v4 + ==> dist3 v1 v3 < #3.488 `, +MP_TAC LEMMA3 THEN LET_TR THEN REWRITE_TAC[REAL_ARITH ` a < b <=> ~ ( b <= a )`] +THEN REWRITE_TAC[MESON[]` a ==> ~ b <=> ~( a /\b)`] THEN +PHA THEN NHANH (SPEC_ALL LEMMA_IN_LEMMA42_P25) THEN +REWRITE_TAC[REAL_ARITH` a < b <=> ~(b <= a ) `] THEN SIMP_TAC[dist3]);; + + +let CONVEX_NORMBALL = REWRITE_RULE[GSYM NORMBALL_BALL] CONVEX_BALL ;; + +let CONVEX_HULL4 = +SPEC `{(v1:real^N),v2,v3,v4}` CONVEX_HULL_FINITE;; + +let CONVEX_HULL_4_EQUIV = prove(` ! v1 v2 v3 (v4:real^N). + conv {v1,v2,v3,v4} = { x | ? a b c d. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + &0 <= d /\ + a + b + c + d = &1 /\ + a % v1 + b % v2 + c % v3 + d % v4 = x } `, +REWRITE_TAC[conv; FUN_EQ_THM; affsign; lin_combo; UNION_EMPTY; + IN_ELIM_THM; sgn_ge] THEN +REWRITE_TAC[MESON[]` x = vsum aa bb /\ a /\ b <=> + a /\ b /\ vsum aa bb = x `] THEN +ONCE_REWRITE_TAC[SET_RULE ` a s ==> b <=> s IN a ==> b `] THEN + SIMP_TAC[CONVEX_HULL_FINITE_STEP; FINITE_INSERT; FINITE_RULES] THEN + REWRITE_TAC[REAL_ARITH `x - y = z:real <=> x = y + z`; + VECTOR_ARITH `x - y = z:real^N <=> x = y + z`] THEN + REWRITE_TAC[VECTOR_ADD_RID; REAL_ADD_RID] THEN MESON_TAC[IN]);; + + +let TXDIACY = prove(`! (a:real^3) b c d (v0: real^3) r. + {a, b, c, d} SUBSET normball v0 r + ==> convex hull {a, b, c, d} SUBSET normball v0 r `, +REPEAT GEN_TAC THEN MP_TAC (MESON[CONVEX_NORMBALL]` convex (normball (v0:real^3) r)`) THEN +NHANH (MESON[FINITE6] ` {a, b, c, d} SUBSET s ==> FINITE {(a:real^3),b,c,d} `) THEN +REWRITE_TAC[CONVEX_HULL4; CONVEX_EXPLICIT] THEN +IMP_IMP_TAC THEN +REWRITE_TAC[SET_RULE ` {a | P a } SUBSET b <=> (! a. P a ==> a IN b)`] THEN +REWRITE_TAC[MESON[]` (! y. ( ? u. P u y ) ==> Q y ) <=> + (! y u. P u y ==> Q y ) `] THEN +REWRITE_TAC[MESON[]`(!y u. P u /\ Q u /\ R u = y ==> Z y) <=> + (!u. P u /\ Q u ==> Z (R u)) `] THEN MESON_TAC[]);; +let LEMMA14 = TXDIACY;; + + +let ECSEVNC = prove(`?t1 t2 t3 t4. + !v1 v2 v3 v4 (v: real^3). + ~coplanar_alt {v1, v2, v3, v4} + ==> t1 v1 v2 v3 v4 v + + t2 v1 v2 v3 v4 v + + t3 v1 v2 v3 v4 v + + t4 v1 v2 v3 v4 v = + &1 /\ + v = + t1 v1 v2 v3 v4 v % v1 + + t2 v1 v2 v3 v4 v % v2 + + t3 v1 v2 v3 v4 v % v3 + + t4 v1 v2 v3 v4 v % v4 /\ + (!ta tb tc td. + v = ta % v1 + tb % v2 + tc % v3 + td % v4 /\ + ta + tb + tc + td = &1 + ==> ta = t1 v1 v2 v3 v4 v /\ + tb = t2 v1 v2 v3 v4 v /\ + tc = t3 v1 v2 v3 v4 v /\ + td = t4 v1 v2 v3 v4 v) `, +REWRITE_TAC[GSYM SKOLEM_THM; RIGHT_EXISTS_IMP_THM] THEN REPEAT +GEN_TAC THEN NHANH (SPEC_ALL (prove(`!v1 v2 v3 v0 v:real^3. + ~coplanar_alt {v0, v1, v2, v3} ==> (?t1 t2 t3. v - v0 = t1 % (v1 - v0) + + t2 % (v2 - v0) + t3 % (v3 - v0) /\ (!ta tb tc. v - v0 = ta % (v1 - v0) + + tb % (v2 - v0) + tc % (v3 - v0) ==> ta = t1 /\ + tb = t2 /\ tc = t3))`, SIMP_TAC[NONCOPLANAR_3_BASIS]))) THEN +STRIP_TAC THEN EXISTS_TAC ` &1 - t1 - t2 - t3 ` THEN +EXISTS_TAC ` t1:real ` THEN EXISTS_TAC ` t2:real ` THEN +EXISTS_TAC ` t3:real ` THEN CONJ_TAC THENL [REAL_ARITH_TAC; + CONJ_TAC] THENL [UNDISCH_TAC ` (v:real^3) - v1 = t1 % (v2 - v1) + +t2 % (v3 - v1) + t3 % (v4 - v1)` THEN +CONV_TAC VECTOR_ARITH; REPEAT GEN_TAC] THEN +REWRITE_TAC[MESON[]` a /\ b ==> c <=> b ==> a ==> c `; + REAL_ARITH ` ta + tb + tc + td = &1 <=> ta = &1 - tb - tc - td `] THEN +SIMP_TAC[] THEN REWRITE_TAC[VECTOR_ARITH ` v = (&1 - tb - tc - td) % v1 + + tb % v2 + tc % v3 + td % v4 <=> v - v1 = tb % ( v2 - v1 ) + +tc % ( v3 - v1 ) + td % ( v4 - v1 ) `] THEN ASM_MESON_TAC[]);; + +let LEMMA76 = ECSEVNC;; + +let COEFS_4 = new_specification ["COEF4_1"; "COEF4_2"; "COEF4_3"; "COEF4_4"] ECSEVNC ;; + +let COEF_1_EQ_ZERO = prove(` ! v1 v2 v3 v4 (v:real^3). + ~ coplanar_alt {v1,v2,v3,v4} ==> + ( COEF4_1 v1 v2 v3 v4 v = &0 <=> v IN aff {v2,v3,v4} ) `, +REWRITE_TAC[aff; AFFINE_HULL_3; IN_ELIM_THM] THEN +NHANH (SPEC_ALL COEFS_4) THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN +ONCE_REWRITE_TAC[REAL_ARITH` u + v + w = &0 + u + v + w `] THEN +ONCE_REWRITE_TAC[VECTOR_ARITH` u + v + w = &0 % v1 + u + v + w `] THEN +ASM_MESON_TAC[]);; + +let EQ_IMP_COPLANAR = prove(`! a b c (d:real^3). ( a = b \/ a = c \/ a = d ) + ==> coplanar_alt {a,b,c,d} `, +REPEAT STRIP_TAC THENL [ +ASM_SIMP_TAC[SET_RULE ` a INSERT ( a INSERT s ) = a INSERT s `] THEN +MP_TAC (DIMINDEX_3) THEN MESON_TAC[COPLANAR_3; ARITH_RULE` a = 3 ==> 2 <= a `]; +ONCE_REWRITE_TAC[SET_RULE` {a,b,v,c} = {a,v,b,c} `] THEN +ASM_SIMP_TAC[SET_RULE ` a INSERT ( a INSERT s ) = a INSERT s `] THEN +MP_TAC (DIMINDEX_3) THEN MESON_TAC[COPLANAR_3; ARITH_RULE` a = 3 ==> 2 <= a `]; +ONCE_REWRITE_TAC[SET_RULE` {a,b,v,c} = {a,c,v,b} `] THEN +ASM_SIMP_TAC[SET_RULE ` a INSERT ( a INSERT s ) = a INSERT s `] THEN +MP_TAC (DIMINDEX_3) THEN MESON_TAC[COPLANAR_3; ARITH_RULE` a = 3 ==> 2 <= a `]]);; + +let AFFINE_HULL_FINITE_STEP_GEN = prove + (`!P:real^N->real->bool. + ((?u. (!x. x IN {} ==> P x (u x)) /\ + sum {} u = w /\ vsum {} (\x. u(x) % x) = y) <=> + w = &0 /\ y = vec 0) /\ + (FINITE(s:real^N->bool) /\ + (!y. a IN s /\ P a y ==> P a (y / &2)) /\ + (!x y. a IN s /\ P a x /\ P a y ==> P a (x + y)) + ==> ((?u. (!x. x IN (a INSERT s) ==> P x (u x)) /\ + sum (a INSERT s) u = w /\ + vsum (a INSERT s) (\x. u(x) % x) = y) <=> + ?v u. P a v /\ (!x. x IN s ==> P x (u x)) /\ + sum s u = w - v /\ + vsum s (\x. u(x) % x) = y - v % a))`, + GEN_TAC THEN SIMP_TAC[SUM_CLAUSES; VSUM_CLAUSES; NOT_IN_EMPTY] THEN + CONJ_TAC THENL [MESON_TAC[]; ALL_TAC] THEN DISCH_TAC THEN + ASM_CASES_TAC `(a:real^N) IN s` THEN ASM_REWRITE_TAC[] THENL + [ASM_SIMP_TAC[SET_RULE `a IN s ==> a INSERT s = s`] THEN EQ_TAC THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THENL + [X_GEN_TAC `u:real^N->real` THEN STRIP_TAC THEN + EXISTS_TAC `(u:real^N->real) a / &2` THEN + EXISTS_TAC `\x:real^N. if x = a then u x / &2 else u x`; + MAP_EVERY X_GEN_TAC [`v:real`; `u:real^N->real`] THEN + STRIP_TAC THEN + EXISTS_TAC `\x:real^N. if x = a then u x + v else u x`] THEN + ASM_SIMP_TAC[] THEN (CONJ_TAC THENL [ASM_MESON_TAC[]; ALL_TAC]) THEN + ONCE_REWRITE_TAC[COND_RAND] THEN ONCE_REWRITE_TAC[COND_RATOR] THEN + ASM_SIMP_TAC[VSUM_CASES; SUM_CASES] THEN + ASM_SIMP_TAC[GSYM DELETE; SUM_DELETE; VSUM_DELETE] THEN + ASM_SIMP_TAC[SET_RULE `a IN s ==> {x | x IN s /\ x = a} = {a}`] THEN + REWRITE_TAC[SUM_SING; VSUM_SING] THEN + (CONJ_TAC THENL [REAL_ARITH_TAC; VECTOR_ARITH_TAC]); + EQ_TAC THEN REWRITE_TAC[LEFT_IMP_EXISTS_THM] THENL + [X_GEN_TAC `u:real^N->real` THEN STRIP_TAC THEN + EXISTS_TAC `(u:real^N->real) a` THEN + EXISTS_TAC `u:real^N->real` THEN ASM_SIMP_TAC[IN_INSERT] THEN + REPEAT(FIRST_X_ASSUM(SUBST1_TAC o SYM)) THEN + CONJ_TAC THENL [REAL_ARITH_TAC; VECTOR_ARITH_TAC]; + MAP_EVERY X_GEN_TAC [`v:real`; `u:real^N->real`] THEN + STRIP_TAC THEN + EXISTS_TAC `\x:real^N. if x = a then v:real else u x` THEN + ASM_SIMP_TAC[IN_INSERT] THEN CONJ_TAC THENL + [ASM_MESON_TAC[]; ALL_TAC] THEN + ONCE_REWRITE_TAC[COND_RAND] THEN ONCE_REWRITE_TAC[COND_RATOR] THEN + ASM_SIMP_TAC[VSUM_CASES; SUM_CASES] THEN + ASM_SIMP_TAC[GSYM DELETE; SUM_DELETE; VSUM_DELETE] THEN + ASM_SIMP_TAC[SET_RULE `~(a IN s) ==> {x | x IN s /\ x = a} = {}`] THEN + ASM_SIMP_TAC[SET_RULE `~(a IN s) ==> s DELETE a = s`] THEN + REWRITE_TAC[SUM_CLAUSES; VSUM_CLAUSES] THEN + CONJ_TAC THENL [REAL_ARITH_TAC; VECTOR_ARITH_TAC]]]);; + + + +let THEOREM_RE_AFF_LT31 = prove + (`!v1 v2 v3 vv x:real^N. + ~(v1 = vv) /\ ~(v2 = vv) /\ ~(v3 = vv) + ==> ((?f. f vv < &0 /\ + sum {v1, v2, v3, vv} f = &1 /\ + x = vsum {v1, v2, v3, vv} (\v. f v % v)) <=> + {x | ?a b c t. + a + b + c + t = &1 /\ + x = a % v1 + b % v2 + c % v3 + t % vv /\ + t < &0} + x)`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC + `?f. (!x:real^N. x IN {v1, v2, v3, vv} ==> vv = x ==> f x < &0) /\ + sum {v1, v2, v3, vv} f = &1 /\ + vsum {v1, v2, v3, vv} (\v. f v % v) = x` THEN + CONJ_TAC THENL + [ASM_REWRITE_TAC[FORALL_IN_INSERT; NOT_IN_EMPTY] THEN MESON_TAC[]; + SIMP_TAC[AFFINE_HULL_FINITE_STEP_GEN; + REAL_ARITH `x < &0 /\ y < &0 ==> x + y < &0`; + REAL_ARITH `x < &0 ==> x / &2 < &0`; + FINITE_INSERT; CONJUNCT1 FINITE_RULES; RIGHT_EXISTS_AND_THM] THEN + ASM_REWRITE_TAC[IN_ELIM_THM; + REAL_ARITH `x - y:real = z <=> x = y + z`; + VECTOR_ARITH `x - y:real^N = z <=> x = y + z`] THEN + REWRITE_TAC[VECTOR_ADD_RID; REAL_ADD_RID] THEN MESON_TAC[]]);; + +let AFF_LT31 = prove(` ! v1 v2 v3 (vv: real^N). ~ (vv IN {v1,v2,v3} ) ==> +aff_lt {v1,v2,v3} {vv} = + { x| ? a b c t. t < &0 /\ a + b + c + t = &1 /\ + x = a % v1 + b % v2 + c % v3 + t % vv } `, +REWRITE_TAC[IN_SET3; DE_MORGAN_THM; aff_lt_def;FUN_EQ_THM; + affsign; lin_combo; sgn_lt] THEN +REWRITE_TAC[SET_RULE` {v1, v2, v3} UNION {vv} = {v1, v2, v3, vv}`] THEN +REWRITE_TAC[SET_RULE` a /\ (!w. {vv} w ==> f w < &0) /\ b + <=> f vv < &0 /\ b /\ a `] THEN +SIMP_TAC[THEOREM_RE_AFF_LT31; IN_ELIM_THM] THEN SET_TAC[]);; + +let AFF_LT21 = prove(`! a b (v0:real^N). ~ ( a = v0 ) /\ ~( b = v0 ) ==> +aff_lt {a,b} {v0} = + {x | ? ta tb t. + ta + tb + t = &1 /\ + t < &0 /\ + x = ta % a + tb % b + t % v0} `, +REWRITE_TAC[SET_RULE` ~(a = v0) /\ ~(b = v0) <=> + ~ ( v0 IN {a,b} ) `] THEN +ONCE_REWRITE_TAC[SET_RULE` {a,b} = {a,b,b} `] THEN SIMP_TAC[AFF_LT31] THEN +SIMP_TAC[AFF_LT31; FUN_EQ_THM; IN_ELIM_THM] THEN +REWRITE_TAC[VECTOR_ARITH` a % b + c % b + x = ( a + c ) % b + x `] THEN +MESON_TAC[REAL_ARITH` a + b + c = ( a + b ) + c `; +VECTOR_ARITH ` a % v = ( a + &0 ) % v `; REAL_ARITH ` + a + b = a + &0 + b `]);; + + +let INSET3 = SET_RULE` a IN {a,b,c} /\ b IN {a,b,c} /\ c IN {a,b,c} `;; + +let AFF_GT33 = prove(`! (v1:real^N) v2 v3 w1 w2 w3. + {v1, v2, v3} INTER {w1, w2, w3} = {} + ==> aff_gt {v1, v2, v3} {w1, w2, w3} = + {x | ?a1 a2 a3 b1 b2 b3. + &0 < b1 /\ + &0 < b2 /\ + &0 < b3 /\ + a1 + a2 + a3 + b1 + b2 + b3 = &1 /\ + x = + a1 % v1 + a2 % v2 + a3 % v3 + b1 % w1 + b2 % w2 + b3 % w3}`, +REWRITE_TAC[aff_gt_def; FUN_EQ_THM; affsign; lin_combo; sgn_gt] THEN +REPEAT STRIP_TAC THEN +MATCH_MP_TAC EQ_TRANS THEN +REWRITE_TAC[SET_RULE ` ( a INSERT b ) UNION c = + b UNION ( a INSERT c ) /\ {} UNION b = b `] THEN +EXISTS_TAC ` (? f. x = vsum {v3, v2, v1, w1, w2, w3} (\v. f v % v) /\ + (!(w:real^N). w IN {v3,v2,v1, w1, w2, w3} ==> w IN {w1,w2,w3} ==> &0 < f w) /\ + sum {v3, v2, v1, w1, w2, w3} f = &1 ) ` THEN +REWRITE_TAC[SET_RULE` (!x. ({v1, v2, v3} INTER {w1, w2, w3}) x <=> {} x) + <=> {v1, v2, v3} INTER {w1, w2, w3} = {} `] THEN +CONJ_TAC THENL [ +FIRST_X_ASSUM MP_TAC THEN +REWRITE_TAC[SET_RULE` (!x. ({v1, v2, v3} INTER {w1, w2, w3}) x <=> {} x) + <=> {v1, v2, v3} INTER {w1, w2, w3} = {} `] THEN +MESON_TAC[SET_RULE` {v1, v2, v3} INTER {w1, w2, w3} = {} ==> + ( (!w. {w1, w2, w3} w ==> &0 < f w) <=> + (!w. w IN {v3, v2, v1, w1, w2, w3} + ==> w IN {w1, w2, w3} + ==> &0 < f w) ) `]; +REWRITE_TAC[MESON[]` a /\ (!z. P z ) /\ aa = &1 <=> + (!z. P z ) /\ aa = &1 /\ a `]] THEN +ONCE_REWRITE_TAC[MESON[]` a = vsum b c <=> vsum b c = a `] THEN + SIMP_TAC[AFFINE_HULL_FINITE_STEP_GEN;FINITE_INSERT; CONJUNCT1 FINITE_RULES; + RIGHT_EXISTS_AND_THM; + REAL_ARITH `&0 < x /\ &0 < y ==> &0 < x + y`; + REAL_ARITH `&0 < x ==> &0 < x / &2 `] THEN +FIRST_X_ASSUM MP_TAC THEN +REWRITE_TAC[SET_RULE` (!x. ({v1, v2, v3} INTER {w1, w2, w3}) x <=> {} x) + <=> {v1, v2, v3} INTER {w1, w2, w3} = {} `; SET_RULE` ( a INSERT s ) INTER ss = {} <=> +~ ( a IN ss ) /\ s INTER ss = {} `] THEN +SIMP_TAC[INSET3] THEN +SIMP_TAC[INSET3; REAL_ARITH` a - b = c <=> a = b + c `; + VECTOR_ARITH` a:real^N - b = c <=> a = b + c `] THEN +REWRITE_TAC[ GSYM RIGHT_EXISTS_AND_THM; ZERO_NEUTRAL; + IN_ELIM_THM; VECTOR_ARITH ` a + vec 0 = a `] THEN +DISCH_TAC THEN +MESON_TAC[REAL_ARITH` a + b + c + d = c + b + a + d `; + VECTOR_ARITH` ( a:real^N ) + b + c + d = c + b + a + d `]);; + +let AFF_GE33 = prove_by_refinement( +`! (v1:real^N) v2 v3 w1 w2 w3. + {v1, v2, v3} INTER {w1, w2, w3} = {} + ==> aff_ge {v1, v2, v3} {w1, w2, w3} = + {x | ?a1 a2 a3 b1 b2 b3. + &0 <= b1 /\ + &0 <= b2 /\ + &0 <= b3 /\ + a1 + a2 + a3 + b1 + b2 + b3 = &1 /\ + x = + a1 % v1 + a2 % v2 + a3 % v3 + b1 % w1 + b2 % w2 + b3 % w3}`, + (* {{{ proof *) + [ + (REWRITE_TAC[aff_gt_def; aff_ge_def; FUN_EQ_THM; affsign; lin_combo; sgn_gt; sgn_ge]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC EQ_TRANS ); + (REWRITE_TAC[SET_RULE ` ( a INSERT b ) UNION c = b UNION ( a INSERT c ) /\ {} UNION b = b `]); + (EXISTS_TAC ` (? f. x = vsum {v3, v2, v1, w1, w2, w3} (\v. f v % v) /\ (!(w:real^N). w IN {v3,v2,v1, w1, w2, w3} ==> w IN {w1,w2,w3} ==> &0 <= f w) /\ sum {v3, v2, v1, w1, w2, w3} f = &1 ) `); + (CONJ_TAC); + (FIRST_X_ASSUM MP_TAC); + (REWRITE_TAC[SET_RULE` (!x. ({v1, v2, v3} INTER {w1, w2, w3}) x <=> {} x) <=> {v1, v2, v3} INTER {w1, w2, w3} = {} `]); + BY((MESON_TAC[SET_RULE` {v1, v2, v3} INTER {w1, w2, w3} = {} ==> ( (!w. {w1, w2, w3} w ==> &0 <= f w) <=> (!w. w IN {v3, v2, v1, w1, w2, w3} ==> w IN {w1, w2, w3} ==> &0 <= f w) ) `])); + (REWRITE_TAC[MESON[]` a /\ (!z. P z ) /\ aa = &1 <=> (!z. P z ) /\ aa = &1 /\ a `]); + (ONCE_REWRITE_TAC[MESON[]` a = vsum b c <=> vsum b c = a `]); + ( SIMP_TAC[AFFINE_HULL_FINITE_STEP_GEN;FINITE_INSERT; CONJUNCT1 FINITE_RULES; RIGHT_EXISTS_AND_THM; REAL_ARITH `&0 <= x /\ &0 <= y ==> &0 <= x + y`; REAL_ARITH `&0 <= x ==> &0 <= x / &2 `]); + (FIRST_X_ASSUM MP_TAC); + (REWRITE_TAC[SET_RULE` (!x. ({v1, v2, v3} INTER {w1, w2, w3}) x <=> {} x) <=> {v1, v2, v3} INTER {w1, w2, w3} = {} `; SET_RULE` ( a INSERT s ) INTER ss = {} <=> ~ ( a IN ss ) /\ s INTER ss = {} `]); + (SIMP_TAC[INSET3]); + (SIMP_TAC[INSET3; REAL_ARITH` a - b = c <=> a = b + c `; VECTOR_ARITH` a:real^N - b = c <=> a = b + c `]); + (REWRITE_TAC[ GSYM RIGHT_EXISTS_AND_THM; ZERO_NEUTRAL; IN_ELIM_THM; VECTOR_ARITH ` a + vec 0 = a `]); + (DISCH_TAC); + BY( (MESON_TAC[REAL_ARITH` a + b + c + d = c + b + a + d `; VECTOR_ARITH` ( a:real^N ) + b + c + d = c + b + a + d `])) + ]);; + (* }}} *) + + +let AFF_GE_12 = prove(`!v0 (a:real^N) b. + ~(v0 = a \/ v0 = b) + ==> aff_ge {v0} {a, b} = + {x | ?tv ta tb. + &0 <= ta /\ + &0 <= tb /\ + tv + ta + tb = &1 /\ + x = tv % v0 + ta % a + tb % b}`, +REWRITE_TAC[SET_RULE ` ~(v0 = a \/ v0 = b) <=> {v0} INTER {a,b} = {} `] THEN +ONCE_REWRITE_TAC[SET_RULE` {a} = {a,a} `] THEN +ONCE_REWRITE_TAC[SET_RULE` {a,a} = {a,a,a} `] THEN +ONCE_REWRITE_TAC[SET_RULE` {a,b,b,b} = {a,b,b} `] THEN +SIMP_TAC[AFF_GE33] THEN REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM] THEN +REPEAT STRIP_TAC THEN +REWRITE_TAC[GSYM VECTOR_ADD_RDISTRIB; VECTOR_ARITH` a % v + + b % v + y = ( a + b ) % v + y `] THEN GONTONG THEN EQ_TAC THENL [ +MESON_TAC[REAL_ARITH` a1 + a2 + a3 + b1 + b2 + b3 = + ( a1 + a2 + a3 ) + b1 + b2 + b3 `; REAL_ARITH ` &0 <= a +/\ &0 <= b ==> &0 <= a + b `];STRIP_TAC] THEN EXISTS_TAC` tv: real ` +THEN EXISTS_TAC` &0 ` THEN EXISTS_TAC` &0` THEN EXISTS_TAC` ta :real ` + THEN EXISTS_TAC` &0` THEN EXISTS_TAC` tb:real ` THEN +ASM_SIMP_TAC[REAL_ARITH ` a <= a `; ZERO_NEUTRAL]);; + + +let INSET3 = SET_RULE` a IN {a, b, c} /\ b IN {a, b, c} /\ c IN {a, b, c} + /\ {a, b, c} a /\ {a, b, c} b /\ {a, b, c} c `;; + + + +let AFF_LE_LT33 = prove(`! (v1:real^N) v2 v3 w1 w2 w3. + {v1, v2, v3} INTER {w1, w2, w3} = {} + ==> aff_le {v1, v2, v3} {w1, w2, w3} = + {x | ?a1 a2 a3 b1 b2 b3. + b1 <= &0 /\ + b2 <= &0 /\ + b3 <= &0 /\ + a1 + a2 + a3 + b1 + b2 + b3 = &1 /\ + x = + a1 % v1 + a2 % v2 + a3 % v3 + b1 % w1 + b2 % w2 + b3 % w3} /\ + aff_lt {v1, v2, v3} {w1, w2, w3} = + {x | ?a1 a2 a3 b1 b2 b3. + b1 < &0 /\ + b2 < &0 /\ + b3 < &0 /\ + a1 + a2 + a3 + b1 + b2 + b3 = &1 /\ + x = + a1 % v1 + a2 % v2 + a3 % v3 + b1 % w1 + b2 % w2 + b3 % w3} `, +REWRITE_TAC[IN_ELIM_THM; aff_le_def; FUN_EQ_THM; aff_lt_def; + affsign; lin_combo; sgn_lt; sgn_le] THEN +REWRITE_TAC[SET_RULE` {v1, v2, v3} UNION {w1, w2, w3} = + {v1,v2,v3,w1,w2,w3} `] THEN +ONCE_REWRITE_TAC[SET_RULE` {w1, w2, w3} w ==> P w <=> + w IN {v1,v2,v3,w1,w2,w3} ==> {w1,w2,w3} w ==> P w `] THEN +REWRITE_TAC[MESON[]` a = vsum aa bb /\ + (! w. P w ) /\ b <=> (! w. P w ) /\ b /\ vsum aa bb = a `] THEN + SIMP_TAC[AFFINE_HULL_FINITE_STEP_GEN; + REAL_ARITH `( x < &0 /\ y < &0 ==> x + y < &0) /\ ( x <= &0 /\ y <= &0 ==> x + y <= &0)`; + REAL_ARITH ` (x < &0 ==> x / &2 < &0 ) /\ (x <= &0 ==> x / &2 <= &0 )`; + FINITE_INSERT; CONJUNCT1 FINITE_RULES +; RIGHT_EXISTS_AND_THM] THEN +SIMP_TAC[ GSYM RIGHT_EXISTS_AND_THM; SET_RULE ` + (!x. ({v1, v2, v3} INTER s ) x <=> {} x) <=> + ~ ( s v1 ) /\ ~ ( s v2 ) /\ ~ ( s v3 ) `; INSET3] THEN +REWRITE_TAC[REAL_ARITH` a - b = c <=> a = b + c`; REAL_ARITH ` + a + &0 = a `; VECTOR_ARITH` (a:real^N) - b = c <=> a = b + c`; + VECTOR_ARITH` a + vec 0 = a `] THEN +MESON_TAC[]);; + + + + +let AFF_GES_LTS = prove(` ! a b c (v0 :real^N). + ~ ( a = v0 ) /\ ~( b = v0 ) /\ ~( c = v0 ) ==> +aff_gt {a, b} {v0} = + {x | ?ta tb t. + ta + tb + t = &1 /\ &0 < t /\ x = ta % a + tb % b + t % v0} /\ +aff_ge {a, b} {v0} = + {x | ?ta tb t. + ta + tb + t = &1 /\ + &0 <= t /\ + x = ta % a + tb % b + t % v0} /\ +aff_lt {a,b,c} {v0} = + { x| ? ta tb tc t. t < &0 /\ ta + tb + tc + t = &1 /\ + x = ta % a + tb % b + tc % c + t % v0 } /\ +aff_gt {a,b,c} {v0} = + { x| ? ta tb tc t. &0 < t /\ ta + tb + tc + t = &1 /\ + x = ta % a + tb % b + tc % c + t % v0 } `, +ONCE_REWRITE_TAC[SET_RULE` {a} = {a,a,a} `] THEN +ONCE_REWRITE_TAC[SET_RULE` {a,b,b,b} = {a,b,b} `] THEN +ONCE_REWRITE_TAC[SET_RULE` {a,b,c,c} = {a,b,c} `] THEN +NHANH (SET_RULE` ~(a = v0) /\ ~(b = v0) /\ ~(c = v0) ==> + {a,b,b} INTER {v0,v0,v0} = {} /\ {a,b,c} INTER {v0,v0,v0} = {} `) THEN +SIMP_TAC[AFF_LE_LT33; AFF_GE33; AFF_GT33] THEN +REWRITE_TAC[GSYM VECTOR_ADD_RDISTRIB; VECTOR_ARITH` a % x + b % x + y + = ( a + b ) % x + y `] THEN +REWRITE_TAC[REAL_ARITH` (a + b ) + c = a + b + c `] THEN +REPEAT STRIP_TAC THENL [ +REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM] THEN GEN_TAC THEN +EQ_TAC THENL [MESON_TAC[REAL_ARITH ` &0 < a /\ &0 < b ==> &0 < a + b `; + REAL_ARITH ` a + b + c + d = a + ( b + c ) + d `]; +MESON_TAC[REAL_ARITH ` a + b + c = a + b / &2 + b / &2 + c / &3 + + c / &3 + c / &3 `; REAL_ARITH` &0 < a <=> &0 < a / &3 `; + REAL_ARITH` a = a / &2 + a / &2 /\ b = b / &3 + b / &3 + b / &3 /\ b = + ( b / &3 + b / &3 ) + b / &3 `]]; +REPEAT STRIP_TAC THEN +REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM] THEN GEN_TAC THEN +EQ_TAC THENL [ +MESON_TAC[REAL_ARITH ` ( &0 < a /\ &0 < b ==> &0 < a + b ) /\ ( &0 <= a /\ &0 <= b ==> &0 <= a + b ) `; + REAL_ARITH ` a + b + c + d = a + ( b + c ) + d `] ; +MESON_TAC[REAL_ARITH ` a + b + c = a + b / &2 + b / &2 + c / &3 + + c / &3 + c / &3 `; REAL_ARITH` ( &0 < a <=> &0 < a / &3) /\ ( &0 <= a <=> &0 <= a / &3) `; + REAL_ARITH` a = a / &2 + a / &2 /\ b = b / &3 + b / &3 + b / &3 /\ b = ( b / &3 + b / &3 ) + b / &3 `]]; +REPEAT STRIP_TAC THEN +REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM] THEN GEN_TAC THEN +EQ_TAC THENL [MESON_TAC[REAL_ARITH ` ( &0 < a /\ &0 < b ==> &0 < a + b ) +/\ ( &0 <= a /\ &0 <= b ==> &0 <= a + b ) `; REAL_ARITH ` ( a < &0 /\ b < &0 +==> a + b < &0 )`; REAL_ARITH ` a + b + c + d = a + ( b + c ) + d `]; STRIP_TAC] THEN +EXISTS_TAC `ta :real` THEN +EXISTS_TAC `tb :real` THEN +EXISTS_TAC `tc :real` THEN +REPEAT (EXISTS_TAC ` t / &3 `) THEN +ASM_MESON_TAC[REAL_ARITH` a < &0 <=> a / &3 < &0 `; + REAL_ARITH ` a = a / &3 + a / &3 + a / &3 `]; +REPEAT STRIP_TAC THEN +REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM] THEN GEN_TAC THEN +EQ_TAC THENL [MESON_TAC[REAL_ARITH ` ( &0 < a /\ &0 < b ==> &0 < a + b ) /\ ( &0 <= a /\ &0 <= b + ==> &0 <= a + b ) `; REAL_ARITH ` ( a < &0 /\ b < &0 ==> a + b < &0 )`; + REAL_ARITH ` a + b + c + d = a + ( b + c ) + d `]; STRIP_TAC] THEN +EXISTS_TAC `ta :real` THEN +EXISTS_TAC `tb :real` THEN +EXISTS_TAC `tc :real` THEN +REPEAT (EXISTS_TAC ` t / &3 `) THEN +ASM_MESON_TAC[REAL_ARITH ` a = a / &3 + a / &3 + a / &3 `; + REAL_ARITH ` &0 < a <=> &0 < a / &3 `]]);; + + +let AFF_GES_GTS = prove(` ! a b c (v0:real^N). +~(a = v0) /\ ~(b = v0) /\ ~(c = v0) + ==> aff_gt {a, b} {v0} = + {x | ?ta tb t. + ta + tb + t = &1 /\ + &0 < t /\ + x = ta % a + tb % b + t % v0} /\ + aff_ge {a, b} {v0} = + {x | ?ta tb t. + ta + tb + t = &1 /\ + &0 <= t /\ + x = ta % a + tb % b + t % v0} /\ + aff_lt {a, b, c} {v0} = + {x | ?ta tb tc t. + t < &0 /\ + ta + tb + tc + t = &1 /\ + x = ta % a + tb % b + tc % c + t % v0} /\ + aff_gt {a, b, c} {v0} = + {x | ?ta tb tc t. + &0 < t /\ + ta + tb + tc + t = &1 /\ + x = ta % a + tb % b + tc % c + t % v0} /\ + aff_ge {a, b, c} {v0} = + {x | ?ta tb tc t. + &0 <= t /\ + ta + tb + tc + t = &1 /\ + x = ta % a + tb % b + tc % c + t % v0} `, +REPEAT GEN_TAC THEN +REWRITE_TAC[MESON[]` (a ==> a1 /\ a2 /\ a3 /\ a4 /\ a5) <=> + ( a ==> a1 /\ a2 /\ a3 /\a4 ) /\ ( a ==> a5) `] THEN +REWRITE_TAC[AFF_GES_LTS] THEN +NHANH (SET_RULE` ~(a = v0) /\ ~(b = v0) /\ ~(c = v0) + ==> {a,b,c} INTER {v0,v0,v0} = {} `) THEN +ONCE_REWRITE_TAC[SET_RULE` {v} = {v,v,v} `] THEN +ONCE_REWRITE_TAC[SET_RULE` {a, b, c, c, c} = {a,b,c} `] THEN +SIMP_TAC[AFF_GE33] THEN +REPEAT STRIP_TAC THEN +REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM; GSYM VECTOR_ADD_RDISTRIB] THEN +GEN_TAC THEN EQ_TAC THENL [ +MESON_TAC[REAL_ARITH` &0 <= a /\ &0 <= b ==> &0 <= a + b `]; +STRIP_TAC THEN +EXISTS_TAC ` ta :real` THEN +EXISTS_TAC ` tb :real` THEN +EXISTS_TAC ` tc :real` THEN +REPEAT ( EXISTS_TAC ` t / &3 `) THEN +ASM_MESON_TAC[REAL_ARITH` a = a / &3 + a / &3 + a / &3 `; + REAL_ARITH` &0 <= a <=> &0 <= a / &3 `]]);; + + +let COEF_1_POS_NEG = prove(` ! v1 v2 v3 v4 (v:real^3). + ~ coplanar_alt {v1,v2,v3,v4} ==> + ( COEF4_1 v1 v2 v3 v4 v > &0 <=> v IN aff_gt {v2,v3,v4} {v1} ) /\ +( COEF4_1 v1 v2 v3 v4 v < &0 <=> v IN aff_lt {v2,v3, v4} {v1} ) `, +NHANH (MESON[EQ_IMP_COPLANAR]`~coplanar_alt {v1, v2, v3, v4} ==> + ~ ( v2 = v1 ) /\ ~ ((v3:real^3) = v1 ) /\ ~ (v4 = v1 ) `) THEN +SIMP_TAC[AFF_GES_LTS] THEN NHANH (SPEC_ALL COEFS_4) THEN +REWRITE_TAC[IN_ELIM_THM; REAL_ARITH ` a > b <=> b < a `] THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN +ONCE_REWRITE_TAC[REAL_ARITH ` a + b + c + t = t + a + b + c `] THEN +ONCE_REWRITE_TAC[VECTOR_ARITH ` (a:real^N) + b + c + t = t + a + b + c `] THEN +ASM_MESON_TAC[]);; + + +let ALL_ABOUT_COEF_1 = prove(` ! v1 v2 v3 v4 (v:real^3). + ~ coplanar_alt {v1,v2,v3,v4} ==> + ( COEF4_1 v1 v2 v3 v4 v < &0 <=> v IN aff_lt {v2,v3, v4} {v1} ) /\ + ( COEF4_1 v1 v2 v3 v4 v = &0 <=> v IN aff {v2,v3,v4} ) /\ + ( COEF4_1 v1 v2 v3 v4 v > &0 <=> v IN aff_gt {v2,v3,v4} {v1} )`, +SIMP_TAC[COEF_1_EQ_ZERO ; COEF_1_POS_NEG ]);; + +let PER_COEF1_WITH_COEF2 = prove(`! v1 v2 v3 v4 (v:real^3). + ~coplanar_alt {v1, v2, v3, v4} ==> + COEF4_2 v1 v2 v3 v4 v = COEF4_1 v2 v3 v4 v1 v `, +NHANH (SPEC_ALL COEFS_4) THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN +MP_TAC (SPECL [` v2:real^3 `; `v3:real^3`; `v4:real^3`; ` v1:real^3`; + `v:real^3 `] COEFS_4) THEN +UNDISCH_TAC ` ~coplanar_alt {v1, v2, v3, (v4:real^3)}` THEN +IMP_IMP_TAC THEN +REWRITE_TAC[MESON[SET_RULE` {v1, v2, v3, v4} = {v2, v3, v4, v1}`]` + ~coplanar_alt {v1, v2, v3, v4} /\ + (~coplanar_alt {v2, v3, v4, v1} ==> l ) <=> ~coplanar_alt {v1, v2, v3, v4} + /\ l `] THEN +ONCE_REWRITE_TAC[GSYM (REAL_ARITH` a + b + c + d = b + c + d + a `)] THEN +ONCE_REWRITE_TAC[GSYM (VECTOR_ARITH` (a:real^N) + b + c + d = b + c + d + a `)] THEN +ASM_MESON_TAC[]);; + +let PER_COEF1_WITH_COEF3 = prove(`! v1 v2 v3 v4 (v:real^3). + ~coplanar_alt {v1, v2, v3, v4} ==> + COEF4_3 v1 v2 v3 v4 v = COEF4_1 v3 v4 v1 v2 v `, +NHANH (SPEC_ALL COEFS_4) THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN +MP_TAC (SPECL [`v3:real^3`; `v4:real^3`; ` v1:real^3`; ` v2:real^3`; + `v:real^3 `] COEFS_4) THEN +UNDISCH_TAC ` ~coplanar_alt {v1, v2, v3, (v4:real^3)}` THEN +IMP_IMP_TAC THEN +REWRITE_TAC[MESON[SET_RULE` {v1, v2, v3, v4} = {v3, v4, v1, v2}`]` + ~coplanar_alt {v1, v2, v3, v4} /\ + (~coplanar_alt {v3, v4, v1, v2} ==> l ) <=> ~coplanar_alt {v1, v2, v3, v4} + /\ l `] THEN +ONCE_REWRITE_TAC[GSYM (REAL_ARITH` a + b + c + d = c + d + a + b`)] THEN +ONCE_REWRITE_TAC[GSYM (VECTOR_ARITH` (a:real^N) + b + c + d = c + d + a + b`)] + THEN ASM_MESON_TAC[]);; + +let PER_COEF1_WITH_COEF4 = prove(`! v1 v2 v3 v4 (v:real^3). + ~coplanar_alt {v1, v2, v3, v4} ==> + COEF4_4 v1 v2 v3 v4 v = COEF4_1 v4 v1 v2 v3 v `, +NHANH (SPEC_ALL COEFS_4) THEN +REPEAT GEN_TAC THEN +ONCE_REWRITE_TAC[SET_RULE` {v1, v2, v3, v4} = {v4,v1, v2, v3}`] THEN +NHANH (SPEC_ALL COEFS_4) THEN +MESON_TAC[REAL_ARITH` ta + tb + tc + td = td + ta + tb + tc`; + VECTOR_ARITH` ta + tb + tc + td = td + ta + tb + (tc:real^N)`]);; + +let ALL_ABOUT_COEF_2 = prove(` ! v1 v2 v3 v4 (v:real^3). + ~ coplanar_alt {v1,v2,v3,v4} ==> + ( COEF4_2 v1 v2 v3 v4 v < &0 <=> v IN aff_lt {v1,v3, v4} {v2} ) /\ + ( COEF4_2 v1 v2 v3 v4 v = &0 <=> v IN aff {v1,v3,v4} ) /\ + ( COEF4_2 v1 v2 v3 v4 v > &0 <=> v IN aff_gt {v1,v3,v4} {v2} )`, +SIMP_TAC[PER_COEF1_WITH_COEF2] THEN MP_TAC ALL_ABOUT_COEF_1 THEN +MESON_TAC[SET_RULE` {v1, v2, v3, v4} = {v2, v3, v4, v1}`; +SET_RULE` {v1, v2, v3} = {v2, v3,v1}`]);; + + + + +let ALL_ABOUT_COEF_3 = prove(` ! v1 v2 v3 v4 (v:real^3). + ~ coplanar_alt {v1,v2,v3,v4} ==> + ( COEF4_3 v1 v2 v3 v4 v < &0 <=> v IN aff_lt {v2,v1, v4} {v3} ) /\ + ( COEF4_3 v1 v2 v3 v4 v = &0 <=> v IN aff {v2,v1,v4} ) /\ + ( COEF4_3 v1 v2 v3 v4 v > &0 <=> v IN aff_gt {v2,v1,v4} {v3} ) `, +SIMP_TAC[PER_COEF1_WITH_COEF3] THEN +ONCE_REWRITE_TAC[SET_RULE` {v2, v1, v4} = {v4,v1,v2} `] THEN +ONCE_REWRITE_TAC[SET_RULE` {v1, v4, v3, v2} = {v3,v4,v1,v2} `] THEN +SIMP_TAC[ALL_ABOUT_COEF_1]);; + +let SRGTIHY = prove(` ! v1 v2 v3 v4 (v:real^3). + ~ coplanar_alt {v1,v2,v3,v4} ==> + ( COEF4_1 v1 v2 v3 v4 v < &0 <=> v IN aff_lt {v2,v3, v4} {v1} ) /\ + ( COEF4_1 v1 v2 v3 v4 v = &0 <=> v IN aff {v2,v3,v4} ) /\ + ( COEF4_1 v1 v2 v3 v4 v > &0 <=> v IN aff_gt {v2,v3,v4} {v1} ) /\ + ( COEF4_2 v1 v2 v3 v4 v < &0 <=> v IN aff_lt {v1,v3, v4} {v2} ) /\ + ( COEF4_2 v1 v2 v3 v4 v = &0 <=> v IN aff {v1,v3,v4} ) /\ + ( COEF4_2 v1 v2 v3 v4 v > &0 <=> v IN aff_gt {v1,v3,v4} {v2} ) /\ + ( COEF4_3 v1 v2 v3 v4 v < &0 <=> v IN aff_lt {v2,v1, v4} {v3} ) /\ + ( COEF4_3 v1 v2 v3 v4 v = &0 <=> v IN aff {v2,v1,v4} ) /\ + ( COEF4_3 v1 v2 v3 v4 v > &0 <=> v IN aff_gt {v2,v1,v4} {v3} )/\ + ( COEF4_4 v1 v2 v3 v4 v < &0 <=> v IN aff_lt {v2,v1, v3} {v4} ) /\ + ( COEF4_4 v1 v2 v3 v4 v = &0 <=> v IN aff {v2,v1,v3} ) /\ + ( COEF4_4 v1 v2 v3 v4 v > &0 <=> v IN aff_gt {v2,v1,v3} {v4} )`, +SIMP_TAC[ALL_ABOUT_COEF_1; ALL_ABOUT_COEF_2; ALL_ABOUT_COEF_3; + PER_COEF1_WITH_COEF4] THEN +ONCE_REWRITE_TAC[SET_RULE` {v2, v1, v3} = {v1,v2,v3}`] THEN +ONCE_REWRITE_TAC[SET_RULE` {v1, v3, v2, v4} = {v4,v1,v2,v3}`] THEN +SIMP_TAC[ALL_ABOUT_COEF_1]);; +let LEMMA77 = SRGTIHY;; + + + let CONV0_4 = prove + (`conv0 {v1, v2, v3, v4} = + {x:real^N | ?a b c d. + &0 < a /\ + &0 < b /\ + &0 < c /\ + &0 < d /\ + a + b + c + d = &1 /\ + a % v1 + b % v2 + c % v3 + d % v4 = x}`, + REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM] THEN X_GEN_TAC `y:real^N` THEN + REWRITE_TAC[conv0; affsign; sgn_gt; lin_combo; UNION_EMPTY] THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC + `?f. (!w:real^N. w IN {v1, v2, v3, v4} ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ + vsum {v1, v2, v3, v4} (\v. f v % v) = y` THEN + CONJ_TAC THENL [REWRITE_TAC[IN] THEN MESON_TAC[]; ALL_TAC] THEN + SIMP_TAC[AFFINE_HULL_FINITE_STEP_GEN; + REAL_ARITH `&0 < x /\ &0 < y ==> &0 < x + y`; + REAL_ARITH `&0 < x ==> &0 < x / &2`; + FINITE_INSERT; CONJUNCT1 FINITE_RULES; RIGHT_EXISTS_AND_THM] THEN + ASM_REWRITE_TAC[IN_ELIM_THM; + REAL_ARITH `x - y:real = z <=> x = y + z`; + VECTOR_ARITH `x - y:real^N = z <=> x = y + z`] THEN + REWRITE_TAC[VECTOR_ADD_RID; REAL_ADD_RID] THEN MESON_TAC[]);; + +(* ======================= *) +(* LEMMA 81 *) +(* ======================= *) + +let ARIKWRQ = prove(`! v1 v2 v3 (v4:real^3). + let s = {v1,v2,v3,v4} in + CARD s = 4 /\ ~ coplanar_alt s ==> + conv s = aff_ge ( s DIFF {v1} ) {v1} INTER + aff_ge ( s DIFF {v2} ) {v2} INTER + aff_ge ( s DIFF {v3} ) {v3} INTER + aff_ge ( s DIFF {v4} ) {v4} `, LET_TR THEN +SIMP_TAC[CARD4; SET_RULE ` ~(v1 IN {v2, v3, v4}) /\ ~(v2 = v3 \/ v3 = v4 \/ v4 = v2) + ==> {v1, v2, v3, v4} DIFF {v1} = {v2,v3,v4} /\ + {v1, v2, v3, v4} DIFF {v2} = {v3,v4,v1} /\ + {v1, v2, v3, v4} DIFF {v3} = {v4,v1,v2} /\ + {v1, v2, v3, v4} DIFF {v4} = {v1,v2,v3} `] THEN +REWRITE_TAC[CARD4; IN_SET3;DE_MORGAN_THM] THEN +SIMP_TAC[AFF_GES_GTS] THEN +REWRITE_TAC[CONVEX_HULL_4_EQUIV] THEN +REPEAT STRIP_TAC THEN +REWRITE_TAC[SET_RULE ` a = b <=> (! x. x IN a <=> x IN b ) `; + IN_INTER; IN_ELIM_THM] THEN +GEN_TAC THEN EQ_TAC THENL [ +ASM_MESON_TAC[REAL_ARITH` a + b + c + d = d + a + b + c `; + VECTOR_ARITH` (a:real^N) + b + c + d = d + a + b + c `]; +FIRST_X_ASSUM MP_TAC ] THEN +NHANH (SPEC ` x: real^3` (GEN ` v:real^3` (SPEC_ALL COEFS_4))) THEN +ABBREV_TAC ` aa = COEF4_1 v1 v2 v3 v4 x ` THEN +ABBREV_TAC ` bb = COEF4_2 v1 v2 v3 v4 x ` THEN +ABBREV_TAC ` cc = COEF4_3 v1 v2 v3 v4 x ` THEN +ABBREV_TAC ` dd = COEF4_4 v1 v2 v3 v4 x ` THEN +REWRITE_TAC[MESON[]` a ==> b ==> c <=> a /\ b ==> c `] THEN PHA THEN +NHANH (MESON[REAL_ARITH` a + b + c + d = d + a + b + c `; + VECTOR_ARITH` (a:real^N) + b + c + d = d + a + b + c `]` +aa + bb + cc + dd = &1 /\ + x = aa % v1 + bb % v2 + cc % v3 + dd % v4 /\ + (!ta tb tc td. + x = ta % v1 + tb % v2 + tc % v3 + td % v4 /\ ta + tb + tc + td = &1 + ==> ta = aa /\ tb = bb /\ tc = cc /\ td = dd) /\ + (?ta tb tc t. + &0 <= t /\ + ta + tb + tc + t = &1 /\ + x = ta % v2 + tb % v3 + tc % v4 + t % v1) /\ + (?ta tb tc t. + &0 <= t /\ + ta + tb + tc + t = &1 /\ + x = ta % v3 + tb % v4 + tc % v1 + t % v2) /\ + (?ta tb tc t. + &0 <= t /\ + ta + tb + tc + t = &1 /\ + x = ta % v4 + tb % v1 + tc % v2 + t % v3) /\ + (?ta tb tc t. + &0 <= t /\ + ta + tb + tc + t = &1 /\ + x = ta % v1 + tb % v2 + tc % v3 + t % v4) + ==> &0 <= aa /\ &0 <= bb /\ &0 <= cc /\ &0 <= dd`) THEN +MATCH_MP_TAC (MESON[]` ( a1 /\ a2 /\ a3 ==> l) ==> + aa /\ ( a1 /\ a2 /\ a4 ) /\ a3 ==> l `) THEN MESON_TAC[]);; + + + + + +(* ================ *) +(* LEMMA 82 *) +(* ================= *) + + + + +let MXHKOXR = prove(`! v1 v2 v3 (v4:real^3). let s = {v1,v2,v3,v4} in + CARD s = 4 /\ ~ coplanar_alt s ==> + conv0 s = aff_gt ( s DIFF {v1} ) {v1} INTER + aff_gt ( s DIFF {v2} ) {v2} INTER + aff_gt ( s DIFF {v3} ) {v3} INTER + aff_gt ( s DIFF {v4} ) {v4} `, LET_TR THEN +SIMP_TAC[CARD4; SET_RULE ` ~(v1 IN {v2, v3, v4}) /\ ~(v2 = v3 \/ v3 = v4 \/ v4 = v2) + ==> {v1, v2, v3, v4} DIFF {v1} = {v2,v3,v4} /\ + {v1, v2, v3, v4} DIFF {v2} = {v3,v4,v1} /\ + {v1, v2, v3, v4} DIFF {v3} = {v4,v1,v2} /\ + {v1, v2, v3, v4} DIFF {v4} = {v1,v2,v3} `] THEN +REWRITE_TAC[CARD4; IN_SET3;DE_MORGAN_THM] THEN +SIMP_TAC[AFF_GES_GTS; CONV0_4 ] THEN +REPEAT STRIP_TAC THEN +REWRITE_TAC[SET_RULE ` a = b <=> (! x. x IN a <=> x IN b ) `; + IN_INTER; IN_ELIM_THM] THEN +GEN_TAC THEN EQ_TAC THENL [ +ASM_MESON_TAC[REAL_ARITH` a + b + c + d = d + a + b + c `; + VECTOR_ARITH` (a:real^N) + b + c + d = d + a + b + c `]; +FIRST_X_ASSUM MP_TAC ] THEN +NHANH (SPEC ` x: real^3` (GEN ` v:real^3` (SPEC_ALL COEFS_4))) THEN +ABBREV_TAC ` aa = COEF4_1 v1 v2 v3 v4 x ` THEN +ABBREV_TAC ` bb = COEF4_2 v1 v2 v3 v4 x ` THEN +ABBREV_TAC ` cc = COEF4_3 v1 v2 v3 v4 x ` THEN +ABBREV_TAC ` dd = COEF4_4 v1 v2 v3 v4 x ` THEN +REWRITE_TAC[MESON[]` a ==> b ==> c <=> a /\ b ==> c `] THEN PHA THEN +NHANH (MESON[REAL_ARITH` a + b + c + d = d + a + b + c `; + VECTOR_ARITH` (a:real^N) + b + c + d = d + a + b + c `]` +aa + bb + cc + dd = &1 /\ + x = aa % v1 + bb % v2 + cc % v3 + dd % v4 /\ + (!ta tb tc td. + x = ta % v1 + tb % v2 + tc % v3 + td % v4 /\ ta + tb + tc + td = &1 + ==> ta = aa /\ tb = bb /\ tc = cc /\ td = dd) /\ + (?ta tb tc t. + &0 < t /\ + ta + tb + tc + t = &1 /\ + x = ta % v2 + tb % v3 + tc % v4 + t % v1) /\ + (?ta tb tc t. + &0 < t /\ + ta + tb + tc + t = &1 /\ + x = ta % v3 + tb % v4 + tc % v1 + t % v2) /\ + (?ta tb tc t. + &0 < t /\ + ta + tb + tc + t = &1 /\ + x = ta % v4 + tb % v1 + tc % v2 + t % v3) /\ + (?ta tb tc t. + &0 < t /\ + ta + tb + tc + t = &1 /\ + x = ta % v1 + tb % v2 + tc % v3 + t % v4) +==> &0 < aa /\ &0 < bb /\ &0 < cc /\ &0 < dd `) THEN +MATCH_MP_TAC (MESON[]` ( a1 /\ a2 /\ a3 ==> l) ==> + aa /\ ( a1 /\ a2 /\ a4 ) /\ a3 ==> l `) THEN MESON_TAC[]);; + + + let CONV0_4 = prove + (`conv0 {v1, v2, v3, v4} = + {x:real^N | ?a b c d. + &0 < a /\ + &0 < b /\ + &0 < c /\ + &0 < d /\ + a + b + c + d = &1 /\ + a % v1 + b % v2 + c % v3 + d % v4 = x}`, + REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM] THEN X_GEN_TAC `y:real^N` THEN + REWRITE_TAC[conv0; affsign; sgn_gt; lin_combo; UNION_EMPTY] THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC + `?f. (!w:real^N. w IN {v1, v2, v3, v4} ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ + vsum {v1, v2, v3, v4} (\v. f v % v) = y` THEN + CONJ_TAC THENL [REWRITE_TAC[IN] THEN MESON_TAC[]; ALL_TAC] THEN + SIMP_TAC[AFFINE_HULL_FINITE_STEP_GEN; + REAL_ARITH `&0 < x /\ &0 < y ==> &0 < x + y`; + REAL_ARITH `&0 < x ==> &0 < x / &2`; + FINITE_INSERT; CONJUNCT1 FINITE_RULES; RIGHT_EXISTS_AND_THM] THEN + ASM_REWRITE_TAC[IN_ELIM_THM; + REAL_ARITH `x - y:real = z <=> x = y + z`; + VECTOR_ARITH `x - y:real^N = z <=> x = y + z`] THEN + REWRITE_TAC[VECTOR_ADD_RID; REAL_ADD_RID] THEN MESON_TAC[]);; + + +let CONV0_4POINTS = CONV0_4;; + + + +(* ================== *) +(* LEMMA 78 *) + +(* ================== *) + + +let ZRFMKPY = prove(` ! v1 v2 v3 v4 (v:real^3). + ~coplanar_alt {v1, v2, v3, v4} + ==> (v IN conv {v1, v2, v3, v4} <=> + &0 <= COEF4_1 v1 v2 v3 v4 v /\ + &0 <= COEF4_2 v1 v2 v3 v4 v /\ + &0 <= COEF4_3 v1 v2 v3 v4 v /\ + &0 <= COEF4_4 v1 v2 v3 v4 v) /\ + (v IN conv0 {v1, v2, v3, v4} <=> + &0 < COEF4_1 v1 v2 v3 v4 v /\ + &0 < COEF4_2 v1 v2 v3 v4 v /\ + &0 < COEF4_3 v1 v2 v3 v4 v /\ + &0 < COEF4_4 v1 v2 v3 v4 v) `, +NHANH (SPEC_ALL COEFS_4) THEN REWRITE_TAC[CONVEX_HULL_4_EQUIV; +CONV0_4POINTS; IN_ELIM_THM] THEN MESON_TAC[]);; + +let LEMMA78 = ZRFMKPY;; + + + +(* APRIL WORKS *) +(* =========== *) +(* NGUYEN QUANG TRUONG *) +let IMP_TAC = IMP_IMP_TAC;; + + + +let QUAANG_TRUOONN = prove(` ! v0 v1 v2 v3 (v4:real^N). + CARD {v0, v1, v2, v3, v4} = 5 /\ + (?x. ~(x = v0) /\ x IN cone v0 {v1, v3} INTER cone v0 {v2, v4}) + ==> ~(conv {v1, v3} INTER cone v0 {v2, v4} = {})`, +REWRITE_TAC[CONV_SET2; cone; CARD5; SET_RULE ` a INTER b = {} <=> + ~ (? x. a x /\ b x ) `; GSYM aff_ge_def; IN; IN_INTER] THEN +NHANH (SET_RULE ` ~{v1, v2, v3, v4} v0 ==> + ~ ( v0 = v1 \/ v0 = v3 ) /\ ~ ( v0 = v2 \/ v0 = v4 ) `) THEN +ONCE_REWRITE_TAC[MESON[]` a /\ b ==> c <=> a ==> b ==> c `] THEN +SIMP_TAC[AFF_GE_12] THEN REWRITE_TAC[DE_MORGAN_THM] THEN +REWRITE_TAC[IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN +UNDISCH_TAC ` (x:real^N) = tv % v0 + ta % v1 + tb % v3` THEN +UNDISCH_TAC ` (x:real^N) = tv' % v0 + ta' % v2 + tb' % v4` THEN +REWRITE_TAC[MESON[]` x = a + ==> x = (b:real^N) ==> c <=> x = a /\ a = b ==> c `] THEN +REWRITE_TAC[VECTOR_ARITH` a % v + d = b % v + e <=> + ( a - b ) % v + d = e `] THEN +ASM_CASES_TAC ` &0 < ta + tb ` THENL [DOWN_TAC THEN +REWRITE_TAC[MESON[VECTOR_MUL_LCANCEL; REAL_FIELD ` &0 < a ==> ~ ( &1 / a = &0 )`]` + &0 < ta + tb /\ aaa /\ + aa = ta % v1 + tb % v3 <=> &0 < ta + tb /\ aaa /\ + &1 / ( ta + tb ) % aa = &1 / ( ta + tb ) % ( ta % v1 + tb % v3) `] THEN +REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; REAL_ARITH ` + &1 / a * b = b / a `] THEN STRIP_TAC THEN DOWN_TAC THEN +NHANH (MESON[REAL_LE_RDIV_0]`&0 <= ta /\ &0 <= tb /\ a1 /\ &0 <= ta' /\ + &0 <= tb' /\ a2 /\ + &0 < ta + tb /\ a3 ==> &0 <= ta / (ta + tb) /\ &0 <= tb / (ta + tb) /\ + &0 <= ta' / (ta + tb) /\ &0 <= tb' / (ta + tb) `) THEN ASM_MESON_TAC[ +REAL_FIELD` tv + ta + tb = &1 /\ tv' + ta' + tb' = &1 /\ + &0 < ta + tb ==> (tv' - tv) / (ta + tb) + ta' / (ta + tb) + + tb' / (ta + tb) = &1 /\ ta / ( ta + tb ) + tb / ( ta + tb ) = &1`]; +DOWN_TAC THEN +NHANH (MESON[REAL_ARITH` &0 <= a /\ &0 <= b /\ ~( &0 < a + b ) +==> a = &0 /\ b = &0 `]`&0 <= ta /\ &0 <= tb /\a1/\a2 /\a3/\a4 /\ + ~(&0 < ta + tb) /\ a5 ==> ta = &0 /\ tb = &0`) THEN +PURE_ONCE_REWRITE_TAC[MESON[]` P ta tb /\ ta = &0 /\ tb = &0 + <=> P ( &0 ) ( &0 ) /\ ta = &0 /\ tb = &0 `] THEN +REWRITE_TAC[ZERO_NEUTRAL; VECTOR_MUL_LZERO; VECTOR_ADD_LID] THEN +REWRITE_TAC[VECTOR_ARITH` (tv' - tv) % v + a = vec 0 <=> tv' % v + a + = tv % v `; MESON[]` a = b /\ b = c <=> a = c /\ b = c `] THEN +MESON_TAC[VECTOR_ARITH ` &1 % v = v `]]);; + +(* le 80. p 51 *) +(* ================ *) + +let JVDAFRS = prove(` ! v0 v1 v2 v3 (v4:real^N). + CARD {v0, v1, v2, v3, v4} = 5 /\ + (?x. ~(x = v0) /\ x IN cone v0 {v1, v3} INTER cone v0 {v2, v4}) + ==> ~(conv {v1, v3} INTER cone v0 {v2, v4} = {} /\ + conv {v2, v4} INTER cone v0 {v1, v3} = {})`, MESON_TAC[QUAANG_TRUOONN]);; + +(* LEMMA 22 *) +(* =========================== *) + +let SQRT8_POS = MESON[REAL_ARITH ` &0 < &8 `; SQRT_POS_LT]` &0 < sqrt (&8) `;; + +let SQRT8_LT_4_45 = prove(` sqrt8 < #4.45 `, +SIMP_TAC[sqrt8; REAL_ARITH ` &0 < #4.45 `; MESON[REAL_ARITH ` &0 < &8 `; +SQRT_POS_LT]` &0 < sqrt (&8) `; LT_POW2_EQ_LT; SQRT8_POW2] THEN REAL_ARITH_TAC);; + + +let PROVE_NOT_COLLINEAR = prove(` ! v0 v1 (v2:real^3). + &2 <= dist3 v0 v1 /\ + dist3 v0 v1 <= #2.51 /\ + #2.45 <= dist3 v1 v2 /\ + dist3 v1 v2 <= #2.51 /\ + #2.77 <= dist3 v0 v2 /\ + dist3 v0 v2 <= sqrt8 + ==> ~ collinear {v0, v1, v2}`, +REWRITE_TAC[COLLINEAR_AS_IN_CONV2; MID_COND; dist3; LENGTH_EQ_EX; DE_MORGAN_THM] THEN +SIMP_TAC[DIST_SYM] THEN +REPEAT GEN_TAC THEN +ABBREV_TAC ` a = dist(v0,v1:real^3)` THEN +ABBREV_TAC ` b = dist(v0,v2:real^3)` THEN +ABBREV_TAC ` c = dist(v1,v2:real^3)` THEN +MP_TAC SQRT8_LT_4_45 THEN +REAL_ARITH_TAC);; + +let BPOW8APOW2CPOW2 = prove(`&2 <= a /\ + a <= #2.51 /\ + #2.45 <= c /\ + c <= #2.51 /\ + #2.77 <= b /\ + b <= sqrt8 +==> b pow 2 <= &8 /\ a pow 2 <= #2.51 pow 2 /\ c pow 2 <= #2.51 pow 2 `, +REWRITE_TAC[MESON[]` a1 /\ a2 /\a3 /\a4 /\a5 /\a6 ==> l <=> + a1 /\a3 /\a5 ==> a2 /\a4 /\a6 ==> l `] THEN +NHANH (REAL_ARITH`&2 <= a /\ #2.45 <= c /\ #2.77 <= b ==> + &0 < a /\ &0 < b /\ &0 < c /\ &0 < #2.51 `) THEN +SIMP_TAC[sqrt8; POW2_COND_LT; SQRT8_POS; SQRT8_POW2]);; + +let IMP_PRE_LE_19 = prove(`&2 <= a /\ + a <= #2.51 /\ + #2.45 <= c /\ + c <= #2.51 /\ + #2.77 <= b /\ + b <= sqrt8 + ==> &0 < &2 /\ + &2 <= a /\ + &0 < #2.77 /\ + #2.77 <= b /\ + &0 < #2.45 /\ + #2.45 <= c /\ + a pow 2 <= #2.77 pow 2 + #2.45 pow 2 /\ + b pow 2 <= &2 pow 2 + #2.45 pow 2 /\ + c pow 2 <= &2 pow 2 + #2.77 pow 2 `, +CONV_TAC REAL_RAT_REDUCE_CONV THEN NHANH (BPOW8APOW2CPOW2 ) THEN REAL_ARITH_TAC);; + +(* ==================== *) + +let LT_SQ8_IMP_LT2 = prove_by_refinement( +` a < sqrt (&8) ==> ~ ( &2 <= &1 / &2 * a ) `, + (* {{{ proof *) + [ + (ASM_CASES_TAC ` &0 <= a `); + (UNDISCH_TAC `&0 <= a `); + (SIMP_TAC[REAL_LT_IMP_LE; SQRT8_POS; LT_POW2_COND; REAL_ARITH ` &2 <= &1 / &2 * a <=> &4 <= a `; REAL_ARITH` &0 <= &4 `; POW2_COND; SQRT8_POW2]); + BY((REAL_ARITH_TAC)); + (FIRST_X_ASSUM MP_TAC); + BY((REAL_ARITH_TAC)) + ]);; + (* }}} *) + +(* +let condC = new_definition ` condC M13 m12 m14 M24 m34 (m23:real) = + ((! x. x IN {M13, m12, m14, M24, m34, m23 } ==> &0 <= x ) /\ + M13 <= m12 + m23 /\ + M13 <= m14 + m34 /\ + M24 < m12 + m14 /\ + M24 < m23 + m34 /\ + &0 <= delta (M13 pow 2) (m12 pow 2) (m14 pow 2) (M24 pow 2) (m34 pow 2 ) + (m23 pow 2 ) )`;; + +let LE_FOR_LEMMA36 = prove(`(CARD {u, v, w} = 3 /\ packing {u, v, w} /\ dist (u,v) < sqrt8) /\ + ~(dist (u,v) / &2 < dist (w,&1 / &2 % (u + v))) ==> + condC (sqrt (&8)) (&2) (&2) (sqrt (&8)) (&2) (&2) /\ + CARD {u, w, v, u + v - w} = 4 /\ + &2 <= dist3 u w /\ + &2 <= dist3 w v /\ + &2 <= dist3 v (u + v - w) /\ + &2 <= dist3 u (u + v - w) /\ + dist3 u v < sqrt (&8) /\ + dist3 w (u + v - w) <= sqrt (&8) `, +REWRITE_TAC[condC; delta; SQRT8_POW2] THEN +REWRITE_TAC[SET_RULE ` (! x. x IN ( a INSERT b ) ==> p x ) <=> + p a /\ (! x. x IN b ==> p x ) `; NOT_IN_EMPTY] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +SIMP_TAC[SQRT8_POS; REAL_LT_IMP_LE; dist3; sqrt8; packing] THEN +SIMP_TAC[REAL_LT_IMP_LE; SQRT8_POS; LT_POW2_COND; + REAL_ARITH ` &0 <= &4 `; POW2_COND; SQRT8_POW2] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +REWRITE_TAC[NORM_ARITH` dist (v,u + v - w) = dist (u,w) /\ + dist (u,u + v - w) = dist (v,w) /\ + dist (w,u + v - w) = &2 * dist (w,&1 / &2 % (u + v)) `] THEN +STRIP_TAC THEN CONJ_TAC THENL [ +UNDISCH_TAC `CARD {(u:real^3), v, w} = 3` THEN +REWRITE_TAC[CARD3; CARD4; IN_SET3] THEN +REWRITE_TAC[DE_MORGAN_THM] THEN DAO THEN +STRIP_TAC THEN CONJ_TAC THENL [ +NHANH (NORM_ARITH`u + v - w = w ==> dist (w,u) = &1 / &2 * dist (u,v) `) THEN +UNDISCH_TAC `dist ((u:real^3),v) < sqrt (&8)` THEN + NHANH (LT_SQ8_IMP_LT2 ) THEN DOWN_TAC THEN SET_TAC[]; +REWRITE_TAC[VECTOR_ARITH ` ((v:real^N) = u + v - w <=> u = w )`; + VECTOR_ARITH ` ((u:real^N) = u + v - w <=> v = w ) `] THEN ASM_MESON_TAC[]]; +DAO THEN CONJ_TAC THENL [REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN +REAL_ARITH_TAC;DOWN_TAC THEN REWRITE_TAC[CARD3] THEN SET_TAC[]]]);; +*) + + +let MIDDLE_POINT_IN_CONV2 = prove(` &1 / &2 % ( u + v ) IN conv {u,v} `, +REWRITE_TAC[CONV_SET2; IN_ELIM_THM; VECTOR_ADD_LDISTRIB] THEN +MESON_TAC[REAL_ARITH ` &0 <= &1 / &2 `; REAL_ARITH` &1 / &2 + &1 / &2 = &1 `]);; + +let INTER_DISJONT_EX = +SET_RULE ` ( a INTER b = {} ) <=> (! x. ~ (x IN a /\ x IN b )) `;; + + +(* LEMMA36 *) + +(* ================== *) + +MATCH_MP (SPEC_ALL AFFINE_HULL_FINITE) (MESON[FINITE_RULES] ` FINITE {(a:real^N),b,c} `) ;; + + + +let PLANE_IMP_AFFINE = prove(`plane (p:real^N -> bool ) ==> affine p `, +MESON_TAC[plane; AFFINE_AFFINE_HULL]);; + + + +let PLANE_IMP_AFFINE = prove(` plane (p:real^N -> bool ) ==> affine p `, +REWRITE_TAC[plane; AFFINE_HULL_3; affine; FUN_EQ_THM; IN_ELIM_THM] THEN +STRIP_TAC THEN ASM_SIMP_TAC[IN] THEN REPEAT STRIP_TAC THEN ASM_SIMP_TAC[] THEN +SIMP_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC] THEN +REWRITE_TAC[VECTOR_ARITH` (( a:real^N) + b + c ) + a' + b' + c' + = ( a + a' ) + ( b + b') + c + c' `] THEN EXISTS_TAC ` u' * u'' + v' * u''' ` THEN +EXISTS_TAC ` (u' * v'' + v' * v''')` THEN EXISTS_TAC ` (u' * w' + v' * w'')` THEN +ASM_SIMP_TAC[prove(` u' + v' = &1 /\ + u''' + v''' + w'' = &1 /\ + u'' + v'' + w' = &1 ==> + (u' * u'' + v' * u''') + (u' * v'' + v' * v''') + u' * w' + v' * w'' = &1 `, +SIMP_TAC[REAL_ARITH` a + b = &1 <=> a = &1 - b `] THEN REAL_ARITH_TAC); + GSYM VECTOR_ADD_RDISTRIB]);; + + + + +let IMP_AFFINE_HULL_SUBSET = prove(` FINITE a /\ a SUBSET s /\ +~( a = {} )/\ affine s ==> ( affine hull a ) SUBSET s `, +SIMP_TAC[AFFINE_HULL_FINITE; SUBSET; IN_ELIM_THM] THEN +REWRITE_TAC[ GSYM SUBSET] THEN MESON_TAC[AFFINE]);; + + + +let SET_EQ_EX = SET_RULE `a = b <=> (! x. x IN a <=> x IN b ) `;; + +let SET_EQ_TO_SUBSET = SET_RULE ` a = b <=> a SUBSET b /\ b SUBSET a `;; + + + + +let OTHORGONAL_QUATER_FOR = prove(` delta x12 ( x12 + x23 ) ( x12 + x24 ) x23 x24 x34 = + x12 * ups_x x23 x24 x34 `, REWRITE_TAC[delta; ups_x] THEN REAL_ARITH_TAC);; + + +let ORTHOGONAL_CROSS_PRODUCT = prove(` u dot ( u cross v ) = &0 /\ + v dot ( u cross v ) = &0 `, +REWRITE_TAC[cross; triple_of_real3; real3_of_triple; mk_vec3] THEN +LET_TR THEN REWRITE_TAC[DOT_3; VECTOR_3] THEN REAL_ARITH_TAC);; + +let PITHAGOR_CROSS = prove(` dist (a + (b - a) cross (c - a),b) pow 2 = +dist (b,a) pow 2 + norm ( (b - a) cross (c - a) ) pow 2 `, +REWRITE_TAC[vector_norm; dist] THEN +SIMP_TAC[DOT_POS_LE; SQRT_WORKS] THEN +REWRITE_TAC[VECTOR_ARITH` ((a:real^N) + b) - c = b - (c - a ) `] THEN +ABBREV_TAC ` ab = ( b - (a:real^3)) ` THEN +ABBREV_TAC ` ac = ( c - (a:real^3)) ` THEN +REWRITE_TAC[DOT_LSUB; DOT_RSUB] THEN +SIMP_TAC[ORTHOGONAL_CROSS_PRODUCT; DOT_SYM] THEN +REAL_ARITH_TAC);; + +let PITHAGOR_NORM = prove(` a dot b = &0 ==> dist (a,b) pow 2 = norm a pow 2 + + norm b pow 2 `, +SIMP_TAC[dist; vector_norm; DOT_POS_LE; SQRT_WORKS] THEN +SIMP_TAC[DOT_LSUB; DOT_RSUB; DOT_SYM] THEN REAL_ARITH_TAC);; + +let VEC3_EQ_EX= prove(`! a (b:real^3). a = b <=> a$1 = b$1 /\ a$2 = b$2 /\ a$3 = b$3 `, +SIMP_TAC[CART_EQ; DIMINDEX_3] THEN +REWRITE_TAC[ARITH_RULE`1 <= i /\ i <= 3 <=> + i = 1 \/ i = 2 \/ i = 3 `] THEN MESON_TAC[]);; + +let CROSS_CONVERT = prove_by_refinement( +` (b - a) cross (c - d) = (a - b) cross (d - c )`, + (* {{{ proof *) + [ + (REWRITE_TAC[cross; triple_of_real3; real3_of_triple; mk_vec3]); + (LET_TR); + (REWRITE_TAC[lemma_cm3 ]); + (REWRITE_TAC[VEC3_EQ_EX]); + (REWRITE_TAC[VEC3_EQ_EX; VECTOR_3]); + BY((REAL_ARITH_TAC)) + ]);; + (* }}} *) + + +let lemma1 = MESON[prove(` dist(b,c) pow 2 = (a - c - (a - b)) dot (a - c - (a - b)) `, + SIMP_TAC[dist; vector_norm; DOT_POS_LE; SQRT_WORKS] THEN + MESON_TAC[VECTOR_ARITH + ` b - (c:real^N) = (a - c) - ( a - b) `])]` + ups_x aa bb (dist (b,c) pow 2 ) = + ups_x aa bb (( a - c - (a - b)) dot (a - c - (a - b))) `;; + +let NORM_CROSS_PRODUCT_UPS_X = prove_by_refinement( + `&4 * norm ( (b - a) cross (c - a)) pow 2 = + ups_x (dist (a,b) pow 2) (dist (a,c) pow 2) (dist (b,c) pow 2)`, + (* {{{ proof *) + [ + (REWRITE_TAC[lemma1 ]); + (ONCE_REWRITE_TAC[CROSS_CONVERT]); + (SIMP_TAC[ups_x;DIST_SYM; dist; vector_norm; DOT_POS_LE; SQRT_WORKS]); + (REWRITE_TAC[cross; triple_of_real3; real3_of_triple; mk_vec3]); + (LET_TR); + (REWRITE_TAC[DOT_3; VECTOR_3]); + (ABBREV_TAC ` ab = a - (b:real^3) `); + (ABBREV_TAC ` cc = a - (c:real^3) `); + BY((REWRITE_TAC[lemma_cm3 ] THEN REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let lemma1 = prove( + ` dist ( a cross b, a ) pow 2 = norm ( a cross b) pow 2 + + norm a pow 2 /\dist ( a cross b, b ) pow 2 = norm ( a cross b) pow 2 + + norm b pow 2 `, + SIMP_TAC[DOT_SYM;ORTHOGONAL_CROSS_PRODUCT ; PITHAGOR_NORM; DIST_SYM] +);; + +let NOT_COLLINEAR_IMP_CROSS_NOT_COPLANAR = prove_by_refinement( + ` ! u v (w:real^3). ~ collinear {a,b,c} ==> ~ coplanar_alt { + a + (b - a ) cross ( c - a ),a,b,c} `, + (* {{{ proof *) + [ + (MP_TAC POLFLZY); + (LET_TR); + (SIMP_TAC[]); + (DISCH_TAC); + (REWRITE_TAC[NORM_ARITH` dist (a + b ,a) = norm (b ) `]); + (REWRITE_TAC[NORM_ARITH`dist (a + c,b) = dist ( c, b - a ) `]); + (SIMP_TAC[lemma1]); + (REWRITE_TAC[GSYM dist]); + (SIMP_TAC[DIST_SYM; OTHORGONAL_QUATER_FOR]); + (ONCE_REWRITE_TAC[REAL_ARITH` a * b = &0 <=> ( &4 * a ) * b = &0 `]); + (SIMP_TAC[NORM_CROSS_PRODUCT_UPS_X]); + (REWRITE_TAC[REAL_ENTIRE]); + BY((MESON_TAC[FHFMKIY])) + ]);; + (* }}} *) + +let ORTHOGONAL_IMP_PITHAGOR = prove(` (x:real^N) dot ((a:real^N) - b) = &0 ==> + dist (a + x,b) pow 2 = norm x pow 2 + dist (a,b) pow 2`, +SIMP_TAC[dist; vector_norm; DOT_POS_LE; SQRT_WORKS] THEN +REWRITE_TAC[VECTOR_ARITH` (a + c) - b = c + a - (b:real^N)`] THEN +ABBREV_TAC ` aa = ( a - (b:real^N)) ` THEN +SIMP_TAC[DOT_LADD; DOT_RADD; DOT_SYM; ZERO_NEUTRAL]);; + +let NOT_COL_AND_ORTHO_IMP_NOT_COPL = prove(`! a b c (x:real^3). + ~collinear {a, b, c} /\ x dot (a - b) = &0 /\ + x dot (a - c) = &0 /\ ~(x = vec 0) + ==> ~coplanar_alt {a + x, a, b, c}`, +MP_TAC POLFLZY THEN LET_TR THEN SIMP_TAC[] THEN +SIMP_TAC[ORTHOGONAL_IMP_PITHAGOR ] THEN +SIMP_TAC[ORTHOGONAL_IMP_PITHAGOR; NORM_ARITH ` dist (a + x,a) = norm x `] THEN +SIMP_TAC[ORTHOGONAL_IMP_PITHAGOR; NORM_ARITH ` dist (a + x,a) = norm x `; +OTHORGONAL_QUATER_FOR] THEN SIMP_TAC[COL_EQ_UPS_0] THEN +SIMP_TAC[COL_EQ_UPS_0; GSYM NORM_POS_LT; REAL_ENTIRE; MESON[RELATE_POW2]` + a pow 2 = &0 <=> a = &0 `; REAL_ARITH ` &0 < a ==> ~( a = &0 ) `]);; + +let PLANE_NORM_IMP_AFFINE = prove(`! p. plane_norm p ==> affine p `, +REWRITE_TAC[plane_norm; affine] THEN GEN_TAC THEN STRIP_TAC THEN +ASM_SIMP_TAC[IN_ELIM_THM; MESON[]` a = &1 <=> &1 = a `] THEN +ONCE_REWRITE_TAC[ VECTOR_ARITH ` ( a + b ) - c = ( a + b ) - &1 % c `] THEN +ASM_SIMP_TAC[ VECTOR_ARITH` (u % x + v % y) - (u + v) % v0 = +u % ( x - v0 ) + v % ( y - v0 ) `; DOT_RADD; DOT_RMUL; ZERO_NEUTRAL]);; + +let IN_PLANE_IMP_OTHORGONAL = prove(` + n dot (x - v0) = &0 /\ n dot (y - v0) = &0 /\ n dot (z - v0) = &0 ==> + n dot ( x - y ) = &0 /\ n dot ( x - z ) = &0 `, +SIMP_TAC[DOT_RSUB] THEN REAL_ARITH_TAC);; + +let IMP_A1_EQ_0 = prove_by_refinement( +`(n:real^N) dot (x - v0) = &0 /\ + n dot (y - v0) = &0 /\ + n dot (z - v0) = &0 /\ + ~(n = vec 0) /\ + x' = a1 % (x + n) + a2 % x + a3 % y + a4 % z /\ + a1 + a2 + a3 + a4 = &1 /\ + n dot (x' - v0) = &0 + ==> a1 = &0`, + (* {{{ proof *) + [ + (STRIP_TAC); + (UNDISCH_TAC ` (n:real^N) dot (x' - v0) = &0`); + (ASM_SIMP_TAC[VECTOR_ARITH`(a1 % x + y ) - v0 = a1 % ( x - v0 ) + y - v0 + a1 % v0 `]); + (ONCE_REWRITE_TAC[ VECTOR_ARITH` a % x - y = a % ( x - y ) + a % y - y `]); + (ASM_SIMP_TAC[DOT_RADD; VECTOR_ARITH` ( a + b ) - (c:real^N) = b + a - c `; DOT_RMUL; ZERO_NEUTRAL]); + (ASM_SIMP_TAC[DOT_RADD; VECTOR_ARITH` ( a + b ) - (c:real^N) = b + a - c `; DOT_RMUL; ZERO_NEUTRAL; DOT_RSUB;REAL_ARITH` ((a4 * (n dot v0) - n dot v0 + a3 * (n dot v0)) + a2 * (n dot v0)) + a1 * (n dot v0) = ( a1 + a2 + a3 + a4 ) * ( n dot v0 ) - n dot v0 `; REAL_ARITH ` &1 * a - a = &0 `]); + BY((ASM_MESON_TAC[REAL_ENTIRE; GSYM DOT_EQ_0])) + ]);; + (* }}} *) + +let LEMMA7 = prove(` !x y z (p:real^3 -> bool). + plane_norm p /\ ~collinear {x, y, z} /\ {x, y, z} SUBSET p + ==> p = aff {x, y, z}`, +NHANH (PLANE_IMP_AFFINE) THEN +REPEAT STRIP_TAC THEN +REWRITE_TAC[aff; SET_EQ_TO_SUBSET] THEN CONJ_TAC THENL [ +UNDISCH_TAC ` plane_norm (p:real^3 -> bool ) ` THEN +REWRITE_TAC[plane_norm] THEN +STRIP_TAC THEN +UNDISCH_TAC ` {(x:real^3), y, z} SUBSET p` THEN +ASM_SIMP_TAC[SET3_SUBSET; IN_ELIM_THM] THEN +NHANH (IN_PLANE_IMP_OTHORGONAL ) THEN +DOWN_TAC THEN +NHANH (MESON[NOT_COL_AND_ORTHO_IMP_NOT_COPL]` + ~collinear {(x:real^3), y, z} /\ + ~(n = vec 0) /\a1 /\a2 /\a4 /\a3/\ + n dot (x - y) = &0 /\ + n dot (x - z) = &0 ==> ~coplanar_alt { x + n ,x,y,z} `) THEN +REWRITE_TAC[SUBSET; IN_ELIM_THM] THEN +REPEAT STRIP_TAC THEN +UNDISCH_TAC `~coplanar_alt {x + n, x, y, (z:real^3)} ` THEN +NHANH (SPEC `x' :real^3` (GEN `v :real^3` ( SPEC_ALL COEFS_4 ))) THEN +ABBREV_TAC ` a1 = COEF4_1 (x + n) x y z x'` THEN +ABBREV_TAC ` a2 = COEF4_2 (x + n) x y z x'` THEN +ABBREV_TAC ` a3 = COEF4_3 (x + n) x y z x'` THEN +ABBREV_TAC ` a4 = COEF4_4 (x + n) x y z x'` THEN +STRIP_TAC THEN +DOWN_TAC THEN +REWRITE_TAC[AFFINE_HULL_3; IN_ELIM_THM] THEN +NHANH (MESON[IMP_A1_EQ_0]` ~(n = vec 0) /\ + aa1 /\ + n dot (x - v0) = &0 /\ + n dot (y - v0) = &0 /\ + n dot (z - v0) = &0 /\ + aa2 /\aa3 /\ + n dot (x' - v0) = &0 /\aa4/\aa5 /\aa6/\aa7/\ + ~coplanar_alt {x + n, x, y, z} /\ + a1 + a2 + a3 + a4 = &1 /\ + x' = a1 % (x + n) + a2 % x + a3 % y + a4 % z /\ l ==> + a1 = &0 `) THEN +PURE_ONCE_REWRITE_TAC[MESON[]` P a1 /\ a1 = &0 <=> P (&0) /\ + a1 = &0 `] THEN +REWRITE_TAC[ZERO_NEUTRAL; VECTOR_ARITH` &0 % x + y = y `] THEN +MESON_TAC[]; +ASM_MESON_TAC[PLANE_NORM_IMP_AFFINE ; FINITE_RULES; +SET_RULE` ~({(x:real^N), y, z} = {} )`; IMP_AFFINE_HULL_SUBSET]]);; + +let SMWTDMU = LEMMA7;; + +let DET_VEC3_AS_CROSS_DOT = prove_by_refinement( +` det_vec3 v1 v2 v3 = ( v1 cross v2 ) dot v3 `, + (* {{{ proof *) + [ + (REWRITE_TAC[det_vec3; cross; triple_of_real3; real3_of_triple; mk_vec3; DOT_3; VECTOR_3]); + (LET_TR); + (REWRITE_TAC[det_vec3; cross; triple_of_real3; real3_of_triple; mk_vec3; DOT_3; VECTOR_3]); + BY((REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let COL_EQ_NORM_CROSS = prove_by_refinement( +` ! v1 v2 (v3:real^3). collinear {v1,v2,v3} <=> + norm ( (v2 - v1) cross (v3 - v1)) pow 2 = &0 `, + (* {{{ proof *) + [ + (REWRITE_TAC[COL_EQ_UPS_0]); + (REWRITE_TAC[GSYM NORM_CROSS_PRODUCT_UPS_X]); + BY((REAL_ARITH_TAC)) + ]);; + (* }}} *) + + + + +let COLLINEAR_IMP_COPLANAR = prove(` ! v1 v2 v3 v3 (v:real^3). collinear {v1,v2,v3} ==> +coplanar_alt {v1,v2,v3,v} `, +REWRITE_TAC[COPLANAR_DET_VEC3_EQ_0; COL_EQ_NORM_CROSS; DET_VEC3_AS_CROSS_DOT ] THEN +REWRITE_TAC[GSYM RELATE_POW2; NORM_EQ_0] THEN REPEAT GEN_TAC THEN +SIMP_TAC[VECTOR_ARITH ` vec 0 dot x = &0 `]);; + +(* MAY WORKS, LEMMA 85 ; VBVYGGT *) + + + + +let POS_EQ_NOT_COPLANANR = prove(` &0 < delta (dist ((x1:real^3),x2) pow 2) (dist (x1,x3) pow 2) + (dist (x1,x4) pow 2) + (dist (x2,x3) pow 2) + (dist (x2,x4) pow 2) + (dist (x3,x4) pow 2) <=> ~coplanar_alt {x1, x2, x3, x4} `, +MP_TAC (DELTA_POS_4POINTS) THEN MP_TAC POLFLZY THEN LET_TR THEN +REWRITE_TAC[REAL_ARITH` a <= b <=> a = b \/ a < b `] THEN +MESON_TAC[REAL_ARITH` ~( a = b /\ a < b ) `]);; + +let SUM_CHI_EQ_2DELTA = prove(` let chi11 = chi x12 x13 x14 x23 x24 x34 in + let chi22 = chi x12 x24 x23 x14 x13 x34 in + let chi33 = chi x34 x13 x23 x14 x24 x12 in + let chi44 = chi x34 x24 x14 x23 x13 x12 in + &2 * delta x12 x13 x14 x23 x24 x34 = chi11 + chi22 + chi33 + chi44`, LET_TR THEN +REWRITE_TAC[chi; delta] THEN REAL_ARITH_TAC);; + +let NOT_0_IMP_SUM_CHI_1 = prove(`~(delta x12 x13 x14 x23 x24 x34 = &0) + ==> chi x12 x13 x14 x23 x24 x34 / (&2 * delta x12 x13 x14 x23 x24 x34) + + chi x12 x24 x23 x14 x13 x34 / (&2 * delta x12 x13 x14 x23 x24 x34) + + chi x34 x13 x23 x14 x24 x12 / (&2 * delta x12 x13 x14 x23 x24 x34) + + chi x34 x24 x14 x23 x13 x12 / (&2 * delta x12 x13 x14 x23 x24 x34) = + &1`, MP_TAC SUM_CHI_EQ_2DELTA THEN +LET_TR THEN CONV_TAC REAL_FIELD);; + +(* MAY WORKS *) + +let PROVE_DIST_FROM_V1 = prove(` ~coplanar_alt {v1, v2, v3, v4} ==> +let x12 = dist (v1,v2) pow 2 in + let x13 = dist (v1,v3) pow 2 in + let x14 = dist (v1,v4) pow 2 in + let x23 = dist (v2,v3) pow 2 in + let x24 = dist (v2,v4) pow 2 in + let x34 = dist (v3,v4) pow 2 in + let chi11 = chi x12 x13 x14 x23 x24 x34 in + let chi22 = chi x12 x24 x23 x14 x13 x34 in + let chi33 = chi x34 x13 x23 x14 x24 x12 in + let chi44 = chi x34 x24 x14 x23 x13 x12 in + p = + &1 / (&2 * delta x12 x13 x14 x23 x24 x34) % + (chi11 % v1 + chi22 % v2 + chi33 % v3 + chi44 % v4) + ==> dist3 p v1 pow 2 = + ( &1 / &2 ) * rho_ij' x12 x13 x14 x23 x24 x34 / (&2 * delta x12 x13 x14 x23 x24 x34) `, +REWRITE_TAC[ GSYM POS_EQ_NOT_COPLANANR] THEN +NHANH (REAL_ARITH` a < b ==> ~( b = a ) `) THEN +NHANH NOT_0_IMP_SUM_CHI_1 THEN +LET_TR THEN REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; + REAL_ARITH` ( &1 / a ) * b = b / a `] THEN +ABBREV_TAC ` a1 = chi (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) + (dist (v2,v4) pow 2) + (dist (v3,v4) pow 2) / + (&2 * + delta (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) + (dist (v2,v4) pow 2) + (dist (v3,(v4:real^3)) pow 2))` THEN +ABBREV_TAC ` a2 = chi (dist (v1,v2) pow 2) (dist (v2,v4) pow 2) (dist (v2,v3) pow 2) + (dist (v1,v4) pow 2) + (dist (v1,v3) pow 2) + (dist (v3,v4) pow 2) / + (&2 * + delta (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) + (dist (v2,v4) pow 2) + (dist (v3,(v4:real^3)) pow 2)) ` THEN +REWRITE_TAC[ GSYM dist3] THEN +ABBREV_TAC ` a3 = chi (dist3 v3 v4 pow 2) (dist3 v1 v3 pow 2) (dist3 v2 v3 pow 2) (dist3 v1 v4 pow 2) + (dist3 v2 v4 pow 2) + (dist3 v1 v2 pow 2) / + (&2 * + delta (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) (dist3 v1 v4 pow 2) + (dist3 v2 v3 pow 2) + (dist3 v2 v4 pow 2) + (dist3 v3 v4 pow 2)) ` THEN +ABBREV_TAC ` a4 = chi (dist3 v3 v4 pow 2) (dist3 v2 v4 pow 2) (dist3 v1 v4 pow 2) (dist3 v2 v3 pow 2) + (dist3 v1 v3 pow 2) + (dist3 v1 v2 pow 2) / + (&2 * + delta (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) (dist3 v1 v4 pow 2) + (dist3 v2 v3 pow 2) + (dist3 v2 v4 pow 2) + (dist3 v3 v4 pow 2)) ` THEN +SIMP_TAC[REAL_ARITH` a + b = &1 <=> a = &1 - b `] THEN +REPEAT STRIP_TAC THEN +REWRITE_TAC[dist3; dist; NORM_POW_2; VECTOR_ARITH` + (((&1 - (a2 + a3 + a4)) % v1 + a2 % v2 + a3 % v3 + a4 % v4) - v1) = + a2 % ( v2 - v1 ) + a3 % (v3 - v1 ) + a4 % ( v4 - v1 ) `; + VECTOR_ARITH` ( a + b ) dot ( a + b ) = a dot a + &2 * ( a dot b ) + + b dot b `] THEN +REWRITE_TAC[DOT_RADD; DOT_LMUL; DOT_RMUL] THEN +REWRITE_TAC[X_DOT_X_EQ] THEN +REWRITE_TAC[DOT_NORM_NEG; VECTOR_ARITH` v2 - v1 - (v4 - v1) + = (v2:real^N) - v4 `] THEN +SIMP_TAC[GSYM dist; DIST_SYM; GSYM dist3; D3_SYM] THEN +EXPAND_TAC "a2" THEN +EXPAND_TAC "a3" THEN +EXPAND_TAC "a4" THEN +REWRITE_TAC[GSYM dist3 ] THEN +ABBREV_TAC ` x12 = dist3 v1 v2 pow 2 ` THEN +ABBREV_TAC ` x13 = dist3 v1 v3 pow 2 ` THEN +ABBREV_TAC ` x14 = dist3 v1 v4 pow 2 ` THEN +ABBREV_TAC ` x23 = dist3 v2 v3 pow 2 ` THEN +ABBREV_TAC ` x24 = dist3 v2 v4 pow 2 ` THEN +ABBREV_TAC ` x34 = dist3 v3 v4 pow 2 ` THEN +UNDISCH_TAC ` &0 < delta x12 x13 x14 x23 x24 x34 ` THEN +ONCE_REWRITE_TAC[REAL_FIELD` &0 < a ==> b = c <=> &0 < a + ==> b * ( &2 * a) pow 2 = c * ( &2 * a ) pow 2 `] THEN +ONCE_REWRITE_TAC[REAL_ARITH` &0 < a <=> &0 < &2 * a `] THEN +SIMP_TAC[REAL_FIELD` &0 < b ==> ( a / b ) * b pow 2 = a * b `; + REAL_RDISTRIB; REAL_FIELD` &0 < b ==> ( a / b ) * ( aa / b ) * c * +b pow 2 = a * aa * c `; REAL_ADD_LDISTRIB] THEN +SIMP_TAC[REAL_LDISTRIB; REAL_ARITH` (a*b)*c = a *b * c `; + REAL_FIELD` &0 < b ==> ( a / b ) * ( a / b ) * c * b pow 2 = a pow 2 * c `; + REAL_ARITH` &2 * a * b * c / &2 * d = a * b * d * c `] THEN +SIMP_TAC[REAL_FIELD` &0 < a ==> ( b / a ) * ( bb / a ) * a pow 2 + * d = b * bb * d `] THEN +SIMP_TAC[REAL_FIELD` &0 < a ==> b / a / &2 * a pow 2 = + a * b / &2 `] THEN +REWRITE_TAC[chi; rho_ij'; delta] THEN +REAL_ARITH_TAC);; + +let PROVE_EQ_DIST_FROM4 = prove(` ~coplanar_alt {v1, v2, v3, v4} ==> +let x12 = dist (v1,v2) pow 2 in + let x13 = dist (v1,v3) pow 2 in + let x14 = dist (v1,v4) pow 2 in + let x23 = dist (v2,v3) pow 2 in + let x24 = dist (v2,v4) pow 2 in + let x34 = dist (v3,v4) pow 2 in + let chi11 = chi x12 x13 x14 x23 x24 x34 in + let chi22 = chi x12 x24 x23 x14 x13 x34 in + let chi33 = chi x34 x13 x23 x14 x24 x12 in + let chi44 = chi x34 x24 x14 x23 x13 x12 in + p = + &1 / (&2 * delta x12 x13 x14 x23 x24 x34) % + (chi11 % v1 + chi22 % v2 + chi33 % v3 + chi44 % v4) +==> +dist3 p v2 pow 2 = ( &1 / &2 ) * rho_ij' x12 x13 x14 x23 x24 x34 / (&2 * delta x12 x13 x14 x23 x24 x34) /\ +dist3 p v3 pow 2 = ( &1 / &2 ) * rho_ij' x12 x13 x14 x23 x24 x34 / (&2 * delta x12 x13 x14 x23 x24 x34) /\ +dist3 p v4 pow 2 = + ( &1 / &2 ) * rho_ij' x12 x13 x14 x23 x24 x34 / (&2 * delta x12 x13 x14 x23 x24 x34) `, +REWRITE_TAC[ GSYM POS_EQ_NOT_COPLANANR] THEN +NHANH (REAL_ARITH` a < b ==> ~( b = a ) `) THEN +NHANH NOT_0_IMP_SUM_CHI_1 THEN +LET_TR THEN REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; + REAL_ARITH` ( &1 / a ) * b = b / a `] THEN +ABBREV_TAC ` a1 = chi (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) + (dist (v2,v4) pow 2) + (dist (v3,v4) pow 2) / + (&2 * + delta (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) + (dist (v2,v4) pow 2) + (dist (v3,(v4:real^3)) pow 2))` THEN +ABBREV_TAC ` a2 = chi (dist (v1,v2) pow 2) (dist (v2,v4) pow 2) (dist (v2,v3) pow 2) + (dist (v1,v4) pow 2) + (dist (v1,v3) pow 2) + (dist (v3,v4) pow 2) / + (&2 * + delta (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) + (dist (v2,v4) pow 2) + (dist (v3,(v4:real^3)) pow 2)) ` THEN +REWRITE_TAC[ GSYM dist3] THEN +ABBREV_TAC ` a3 = chi (dist3 v3 v4 pow 2) (dist3 v1 v3 pow 2) (dist3 v2 v3 pow 2) (dist3 v1 v4 pow 2) + (dist3 v2 v4 pow 2) + (dist3 v1 v2 pow 2) / + (&2 * + delta (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) (dist3 v1 v4 pow 2) + (dist3 v2 v3 pow 2) + (dist3 v2 v4 pow 2) + (dist3 v3 v4 pow 2)) ` THEN +ABBREV_TAC ` a4 = chi (dist3 v3 v4 pow 2) (dist3 v2 v4 pow 2) (dist3 v1 v4 pow 2) (dist3 v2 v3 pow 2) + (dist3 v1 v3 pow 2) + (dist3 v1 v2 pow 2) / + (&2 * + delta (dist3 v1 v2 pow 2) (dist3 v1 v3 pow 2) (dist3 v1 v4 pow 2) + (dist3 v2 v3 pow 2) + (dist3 v2 v4 pow 2) + (dist3 v3 v4 pow 2)) ` THEN +ONCE_REWRITE_TAC[MESON[VECTOR_ARITH` &1 % x = x `]` dist3 a b pow 2 = + aa <=> dist3 a ( &1 % b ) pow 2 = aa `] THEN +ONCE_REWRITE_TAC[MESON[]` a = &1 <=> &1 = a `] THEN +SIMP_TAC[] THEN +STRIP_TAC THEN STRIP_TAC THEN +REWRITE_TAC[dist3; dist] THEN +REWRITE_TAC[VECTOR_ARITH` (a1 % v1 + a2 % v2 + a3 % v3 + a4 % v4) - (a1 + a2 + a3 + a4) % v2 + = a1 % ( v1 - v2 ) + a3 % ( v3 - v2 ) + a4 % (v4 - v2 ) `; + VECTOR_ARITH` (a1 % v1 + a2 % v2 + a3 % v3 + a4 % v4) - (a1 + a2 + a3 + a4) % v3 + = a1 % ( v1 - v3 ) + a2 % ( v2 - v3 ) + a4 % (v4 - v3 )`; + VECTOR_ARITH` (a1 % v1 + a2 % v2 + a3 % v3 + a4 % v4) - (a1 + a2 + a3 + a4) % v4 = + a1 % ( v1 - v4 ) + a2 % ( v2 - v4 ) + a3 % (v3 - v4 )`] THEN +REWRITE_TAC[NORM_POW_2] THEN +REWRITE_TAC[DOT_LADD; DOT_RADD; DOT_LMUL; DOT_RMUL; GSYM NORM_POW_2] THEN +REWRITE_TAC[DOT_NORM_NEG; VECTOR_ARITH` v3 - v4 - (v2 - v4) = + (v3:real^N) - v2 `; GSYM dist; GSYM dist3 ] THEN +EXPAND_TAC "a1" THEN +EXPAND_TAC "a2" THEN +EXPAND_TAC "a3" THEN +EXPAND_TAC "a4" THEN +REWRITE_TAC[GSYM dist3 ] THEN +REWRITE_TAC[prove(` dist3 (v4 - v3) (v1 - v3) = dist3 v1 v4 `, +REWRITE_TAC[dist3] THEN CONV_TAC NORM_ARITH)] THEN +SIMP_TAC[D3_SYM] THEN +ABBREV_TAC ` x12 = dist3 v1 v2 pow 2 ` THEN +ABBREV_TAC ` x13 = dist3 v1 v3 pow 2 ` THEN +ABBREV_TAC ` x14 = dist3 v1 v4 pow 2 ` THEN +ABBREV_TAC ` x23 = dist3 v2 v3 pow 2 ` THEN +ABBREV_TAC ` x24 = dist3 v2 v4 pow 2 ` THEN +ABBREV_TAC ` x34 = dist3 v3 v4 pow 2 ` THEN +UNDISCH_TAC ` &0 < delta x12 x13 x14 x23 x24 x34 ` THEN +ONCE_REWRITE_TAC[REAL_FIELD` &0 < a ==> ( b = c ) /\ ( bb = cc ) /\ ( bbb = ccc ) +<=> &0 < a + ==> ( b * ( &2 * a) pow 2 = c * ( &2 * a ) pow 2 ) /\ +( bb * ( &2 * a) pow 2 = cc * ( &2 * a ) pow 2 ) /\ +( bbb * ( &2 * a) pow 2 = ccc * ( &2 * a ) pow 2 ) `] THEN +ONCE_REWRITE_TAC[REAL_ARITH` &0 < a <=> &0 < &2 * a `] THEN +SIMP_TAC[REAL_FIELD` &0 < b ==> ( a / b ) * b pow 2 = a * b `; + REAL_RDISTRIB; REAL_FIELD` &0 < b ==> ( a / b ) * ( aa / b ) * c * +b pow 2 = a * aa * c `; REAL_ADD_LDISTRIB] THEN +SIMP_TAC[REAL_LDISTRIB; REAL_ARITH` (a*b)*c = a *b * c `; + REAL_FIELD` &0 < b ==> ( a / b ) * ( a / b ) * c * b pow 2 = a pow 2 * c `; + REAL_ARITH` &2 * a * b * c / &2 * d = a * b * d * c `] THEN +SIMP_TAC[REAL_FIELD` &0 < a ==> ( b / a ) * ( bb / a ) * a pow 2 + * d = b * bb * d `] THEN +SIMP_TAC[REAL_FIELD` &0 < a ==> b / a / &2 * a pow 2 = + a * b / &2 `] THEN SIMP_TAC[REAL_FIELD` &0 < b ==> ( a / b ) * b pow 2 = a * b `; + REAL_RDISTRIB; REAL_FIELD` &0 < b ==> ( a / b ) * ( aa / b ) * c * +b pow 2 = a * aa * c `; REAL_ADD_LDISTRIB] THEN +SIMP_TAC[REAL_LDISTRIB; REAL_ARITH` (a*b)*c = a *b * c `; + REAL_FIELD` &0 < b ==> ( a / b ) * ( a / b ) * c * b pow 2 = a pow 2 * c `; + REAL_ARITH` &2 * a * b * c / &2 * d = a * b * d * c `] THEN +SIMP_TAC[REAL_FIELD` &0 < a ==> ( b / a ) * ( bb / a ) * a pow 2 + * d = b * bb * d `] THEN +SIMP_TAC[REAL_FIELD` &0 < a ==> b / a / &2 * a pow 2 = + a * b / &2 `] THEN +DISCH_TAC THEN REWRITE_TAC[chi; rho_ij'; delta] THEN +REAL_ARITH_TAC);; + +let AFFINE_HULL_3 = prove + (`affine hull {a,b,c} = + { u % a + v % b + w % c | u + v + w = &1}`, + SIMP_TAC[AFFINE_HULL_FINITE; FINITE_INSERT; FINITE_RULES] THEN + SIMP_TAC[AFFINE_HULL_FINITE_STEP; FINITE_INSERT; FINITE_RULES] THEN + REWRITE_TAC[REAL_ARITH `x - y = z:real <=> x = y + z`; + VECTOR_ARITH `x - y = z:real^N <=> x = y + z`] THEN + REWRITE_TAC[VECTOR_ADD_RID; REAL_ADD_RID] THEN SET_TAC[]);; + +let AFFINE_HULL_4 = prove + (`affine hull {a,b,c,d} = + { u % a + v % b + w % c + z % d | u + v + w + z = &1}`, + SIMP_TAC[AFFINE_HULL_FINITE; FINITE_INSERT; FINITE_RULES] THEN + SIMP_TAC[AFFINE_HULL_FINITE_STEP; FINITE_INSERT; FINITE_RULES] THEN + REWRITE_TAC[REAL_ARITH `x - y = z:real <=> x = y + z`; + VECTOR_ARITH `x - y = z:real^N <=> x = y + z`] THEN + REWRITE_TAC[VECTOR_ADD_RID; REAL_ADD_RID] THEN SET_TAC[]);; + + +let PROVE_EXISTS_CIR_OF_FOUR_POINTS = prove(`!(v1:real^3) v2 v3 v4. + CARD {v1, v2, v3, v4} = 4 /\ ~coplanar_alt {v1, v2, v3, v4} + ==> (? p. p IN affine hull {v1, v2, v3, v4} /\ + (?r. !v. v IN {v1, v2, v3, v4} + ==> r = dist (p, v))) `, +NHANH (REWRITE_RULE[RIGHT_FORALL_IMP_THM] (GEN `p:real^3` PROVE_DIST_FROM_V1)) THEN +NHANH (REWRITE_RULE[RIGHT_FORALL_IMP_THM] (GEN `p:real^3` PROVE_EQ_DIST_FROM4 )) THEN +REPEAT GEN_TAC THEN REPEAT LET_TAC THEN ABBREV_TAC `rr = &1 / &2 * + rho_ij' x12 x13 x14 x23 x24 x34 / (&2 * delta x12 x13 x14 x23 x24 x34) ` THEN +REWRITE_TAC[GSYM POS_EQ_NOT_COPLANANR] THEN +NHANH (SPEC_ALL REAL_POS_NZ) THEN ASM_SIMP_TAC[] THEN +NHANH (NOT_0_IMP_SUM_CHI_1 ) THEN ASM_SIMP_TAC[] THEN +REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; + REAL_ARITH ` &1 / a * b = b / a `] THEN +REWRITE_TAC[FORALL_IN_CLAUSES; MESON[]`(? r. (r:real) = a /\ + r = b /\ r = c /\ r = d ) <=> a = b /\ a = c /\ a = d `] THEN +REWRITE_TAC[MESON[]` (! x. x = a ==> P a ) <=> P a `] THEN DISCH_TAC THEN +EXISTS_TAC ` chi11 / (&2 * delta x12 x13 x14 x23 x24 x34) % (v1:real^3) + + chi22 / (&2 * delta x12 x13 x14 x23 x24 x34) % v2 + + chi33 / (&2 * delta x12 x13 x14 x23 x24 x34) % v3 + + chi44 / (&2 * delta x12 x13 x14 x23 x24 x34) % v4 ` THEN +CONJ_TAC THENL [REWRITE_TAC[AFFINE_HULL_4; IN_ELIM_THM] THEN +FIRST_X_ASSUM MP_TAC THEN MESON_TAC[NOT_0_IMP_SUM_CHI_1 ]; +FIRST_X_ASSUM MP_TAC THEN SIMP_TAC[dist3; DIST_POS_LE; EQ_POW2_COND]]);; + + + + + + + + + + + + +let IMP_PROPERTIES_OF_CIR4 = prove(`!(v1:real^3) v2 v3 v4. + CARD {v1, v2, v3, v4} = 4 /\ ~coplanar_alt {v1, v2, v3, v4} + ==> circumcenter {v1, v2, v3, v4} IN affine hull {v1, v2, v3, v4} /\ + (?r. !v. v IN {v1, v2, v3, v4} + ==> r = dist (circumcenter {v1, v2, v3, v4},v))`, +NHANH (SPEC_ALL PROVE_EXISTS_CIR_OF_FOUR_POINTS ) THEN REWRITE_TAC[circumcenter; IN] +THEN MESON_TAC[EXISTS_THM]);; + + + + +let DIST_EQ_IMP_ORTHOGONAL = prove(` dist (pp,v2) = dist (pp,v1) /\ + dist (p,v2) = dist (p,v1) ==> + (pp - p ) dot (v2 - v1 ) = &0 `, +REWRITE_TAC[MONG7_ROI; DOT_LSUB] THEN REAL_ARITH_TAC);; + + + +let IMP_OTHO4 = prove(` n dot (v2 - v1) = &0 /\ + n dot (v3 - v1) = &0 /\ + n dot (v4 - v1) = &0 /\ + x IN affine hull {v1,v2,v3,v4} /\ + y IN affine hull {v1,v2,v3,v4} ==> + n dot (x - y ) = &0 `, +REWRITE_TAC[AFFINE_HULL_4; IN_ELIM_THM] THEN STRIP_TAC THEN +DOWN_TAC THEN IMP_TAC THEN SIMP_TAC[REAL_ARITH`a + b = c <=> a = c - b `] THEN +PHA THEN REWRITE_TAC[VECTOR_ARITH` ((&1 - (v' + w' + z')) % v1 + v' % v2 + + w' % v3 + z' % v4) - ((&1 - (v + w + z)) % v1 + v % v2 + w % v3 + z % v4) = + ( v' - v ) % ( v2 - v1 ) + ( w' - w ) % ( v3 - v1 ) + + ( z' - z ) % ( v4 - v1 ) `] THEN +SIMP_TAC[DOT_RADD; DOT_RMUL; ZERO_NEUTRAL]);; + + + + + +let UNIQUE_EXISISTING_PROPERTY_C4 = prove(`!(v1:real^3) v2 v3 v4. + CARD {v1, v2, v3, v4} = 4 /\ ~coplanar_alt {v1, v2, v3, v4} + ==> (!p. p IN affine hull {v1, v2, v3, v4} /\ + (?r. !v. v IN {v1, v2, v3, v4} ==> r = dist (p,v)) + ==> p = circumcenter {v1, v2, v3, v4}) `, +NHANH (SPEC_ALL IMP_PROPERTIES_OF_CIR4 ) THEN +REPEAT GEN_TAC THEN +ABBREV_TAC ` pp = circumcenter {(v1:real^3), v2, v3, v4}` THEN +REPEAT STRIP_TAC THEN +DOWN_TAC THEN +REWRITE_TAC[FORALL_IN_CLAUSES] THEN +REWRITE_TAC[MESON[]` r = a /\ r = b /\ r = c /\ r = d <=> r = a /\ b = a /\ c = a + /\ d = a `] THEN +PHA THEN +NHANH (MESON[DIST_EQ_IMP_ORTHOGONAL ]`dist (pp,v2) = dist (pp,v1) /\ + dist (pp,v3) = dist (pp,v1) /\ + dist (pp,v4) = dist (pp,v1) /\a11/\a2/\ + dist (p,v2) = dist (p,v1) /\ + dist (p,v3) = dist (p,v1) /\ + dist (p,v4) = dist (p,v1) ==> + ( p - pp) dot ( v2 - v1 ) = &0 /\ + ( p - pp ) dot ( v3 - v1 ) = &0 /\ + ( p - pp ) dot ( v4 - v1 ) = &0 `) THEN +ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN +REWRITE_TAC[GSYM DOT_EQ_0] THEN MESON_TAC[IMP_OTHO4 ]);; + + + + +let PROVE_IN_AFFINE_HULL_4 = prove( +`~(delta x12 x13 x14 x23 x24 x34 = &0) + ==> &1 / (&2 * delta x12 x13 x14 x23 x24 x34) % + (chi x12 x13 x14 x23 x24 x34 % v1 + + chi x12 x24 x23 x14 x13 x34 % v2 + + chi x34 x13 x23 x14 x24 x12 % v3 + + chi x34 x24 x14 x23 x13 x12 % v4) IN + affine hull {(v1:real^3), v2, v3, v4}`, +REWRITE_TAC[AFFINE_HULL_4; IN_ELIM_THM; VECTOR_ADD_LDISTRIB; + VECTOR_MUL_ASSOC; REAL_ARITH ` ( &1 / a ) * b = b/a `] + THEN MESON_TAC[NOT_0_IMP_SUM_CHI_1]);; + + + +(* VBVYGGT , le 85 *) + + + +MESON[POW_2_SQRT; DIST_POS_LE]` dist (x,y) pow 2 = r ==> dist (x,y) = sqrt ( r ) `;; + +(* LEMMA 85 *) +let VBVYGGT = prove(`!(v1:real^3) v2 v3 v4. + CARD {v1, v2, v3, v4} = 4 /\ ~coplanar_alt {v1, v2, v3, v4} + ==> circumcenter {v1, v2, v3, v4} IN affine hull {v1, v2, v3, v4} /\ + (?r. !v. v IN {v1, v2, v3, v4} + ==> r = dist (circumcenter {v1, v2, v3, v4},v)) /\ + (!p. p IN affine hull {v1, v2, v3, v4} /\ + (?r. !v. v IN {v1, v2, v3, v4} ==> r = dist (p,v)) + ==> p = circumcenter {v1, v2, v3, v4}) /\ + (let x12 = dist (v1,v2) pow 2 in + let x13 = dist (v1,v3) pow 2 in + let x14 = dist (v1,v4) pow 2 in + let x23 = dist (v2,v3) pow 2 in + let x24 = dist (v2,v4) pow 2 in + let x34 = dist (v3,v4) pow 2 in + let chi11 = chi x12 x13 x14 x23 x24 x34 in + let chi22 = chi x12 x24 x23 x14 x13 x34 in + let chi33 = chi x34 x13 x23 x14 x24 x12 in + let chi44 = chi x34 x24 x14 x23 x13 x12 in + circumcenter {v1, v2, v3, v4} = + &1 / (&2 * delta x12 x13 x14 x23 x24 x34) % + (chi11 % v1 + chi22 % v2 + chi33 % v3 + chi44 % v4)) `, +NHANH (SPEC_ALL UNIQUE_EXISISTING_PROPERTY_C4 ) THEN +NHANH (SPEC_ALL IMP_PROPERTIES_OF_CIR4 ) THEN +REWRITE_TAC[MESON[]` (a /\ b1/\b2) /\ b ==> b1 /\b2/\ b/\ d <=> a /\ b1 /\b2/\b==>d `] THEN +NHANH (REWRITE_RULE[RIGHT_FORALL_IMP_THM] ( GEN `p: real^3 `PROVE_DIST_FROM_V1)) THEN +NHANH (REWRITE_RULE[RIGHT_FORALL_IMP_THM] ( GEN `p: real^3 ` PROVE_EQ_DIST_FROM4)) THEN +REPEAT GEN_TAC THEN REPEAT LET_TAC THEN ABBREV_TAC `rr = &1 / &2 * + rho_ij' x12 x13 x14 x23 x24 x34 / (&2 * delta x12 x13 x14 x23 x24 x34) ` THEN +REWRITE_TAC[MESON[]` (! x. x = a ==> P x ) <=> P a `] THEN +REWRITE_TAC[GSYM POS_EQ_NOT_COPLANANR] THEN +NHANH (REAL_ARITH` &0 < a ==> ~( a = &0 )`) THEN +NHANH (PROVE_IN_AFFINE_HULL_4 ) THEN +UNDISCH_TAC ` dist ((v1:real^3),v2) pow 2 = x12` THEN +UNDISCH_TAC ` dist ((v1:real^3),v3) pow 2 = x13` THEN +UNDISCH_TAC ` dist ((v1:real^3),v4) pow 2 = x14` THEN +UNDISCH_TAC ` dist ((v2:real^3),v3) pow 2 = x23` THEN +UNDISCH_TAC ` dist ((v2:real^3),v4) pow 2 = x24` THEN +UNDISCH_TAC ` dist ((v3:real^3),v4) pow 2 = x34` THEN +UNDISCH_TAC ` chi x12 x13 x14 x23 x24 x34 = chi11 ` THEN +UNDISCH_TAC ` chi x12 x24 x23 x14 x13 x34 = chi22 ` THEN +UNDISCH_TAC ` chi x34 x13 x23 x14 x24 x12 = chi33` THEN +UNDISCH_TAC ` chi x34 x24 x14 x23 x13 x12 = chi44` THEN +REWRITE_TAC[MESON[]` a = b ==> P a <=> a = b ==> P b `] THEN +ABBREV_TAC ` w = &1 / (&2 * delta x12 x13 x14 x23 x24 x34) % + (chi11 % (v1:real^3) + chi22 % v2 + chi33 % v3 + chi44 % v4)` THEN +REWRITE_TAC[MESON[]` a /\ b ==> c <=> a ==> b ==> c `] +THEN REPLICATE_TAC 13 DISCH_TAC THEN +REWRITE_TAC[FORALL_IN_CLAUSES;dist3] THEN PHA THEN +NHANH (MESON[POW_2_SQRT; DIST_POS_LE]` dist (x,y) pow 2 = r + ==> dist (x,y) = sqrt ( r ) `) THEN MESON_TAC[]);; + +let NOT_COPLANAR_IMP_EXISTS_CIR = prove(`! (v1:real^3) v2 v3 v4. + CARD {v1, v2, v3, v4} = 4 /\ ~coplanar_alt {v1, v2, v3, v4} + ==> circumcenter {v1, v2, v3, v4} IN affine hull {v1, v2, v3, v4} /\ + (?r. !v. v IN {v1, v2, v3, v4} + ==> r = dist (circumcenter {v1, v2, v3, v4},v)) `, +MESON_TAC[VBVYGGT]);; + +let THREE_POINTS_COP = prove(` ! v1 v2 (v3:real^3). coplanar_alt {v1,v2,v3} `, +MESON_TAC[DIMINDEX_3; ARITH_RULE` 2 <= 3 `; COPLANAR_3]);; + +let PER_SET4 = SET_RULE ` {a,b,c,d} = {b,a,c,d} /\ + {a,b,c,d} = {c,b,a,d} /\ + {a,b,c,d} = {d,b,c,a} `;; + +let NOT_COPLANAR_IMP_CARD4 = prove(` ~ coplanar_alt {(v1:real^3), v2, v3, v4} +==> CARD {v1, v2, v3, v4} = 4 `, REWRITE_TAC[CARD4; IN_SET3] THEN +MP_TAC (GEN_ALL THREE_POINTS_COP ) THEN +MESON_TAC[PER_SET4; SET_RULE` {a,a,b,c} = {a,b,c} `]);; + + +let NOT_COPLANAR_IMP_EXISTS_CIR2 = MESON[NOT_COPLANAR_IMP_EXISTS_CIR ; +NOT_COPLANAR_IMP_CARD4 ]` ! (v1:real^3) v2 v3 v4. ~ coplanar_alt {v1, v2, v3, v4} + ==> circumcenter {v1, v2, v3, v4} IN affine hull {v1, v2, v3, v4} /\ + (?r. !v. v IN {v1, v2, v3, v4} + ==> r = dist (circumcenter {v1, v2, v3, v4},v)) `;; + +let NOT_COPLANAR_IMP_RADV_PROPERTIES = prove(` ~coplanar_alt {(v1:real^3), v2, v3, v4} ==> + (! w. {v1, v2, v3, v4} w ==> radV {v1, v2, v3, v4} + = dist (circumcenter {v1,v2,v3,v4} ,w) ) `, +NHANH (SPEC_ALL NOT_COPLANAR_IMP_EXISTS_CIR2) THEN +REWRITE_TAC[IN; radV] THEN MESON_TAC[EXISTS_THM]);; + +let ZJEWPAP = ` ! v1 v2 v3 (v4:real^3). + let s = {v1, v2, v3, v4} in CARD s = 4 /\ ~ coplanar_alt s + ==> radV {v1,v2,v3} <= radV s `;; + +let PHA = REWRITE_TAC[MESON[]` ( a ==> b ==> c <=> a /\ b ==> c ) /\ + ( (a /\ b ) /\ c <=> a /\ b /\ c ) `];; + +let NOT_COL_EQ_UPS_X_POS = prove(`! v1 v2 v3. ~ collinear {(v1:real^3), v2, v3} <=> + &0 < ups_x (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) + (dist (v2,v3) pow 2) `, +MP_TAC (GEN_ALL ZERO_LE_UPS_X) THEN REWRITE_TAC[UPS_X_EQ_ZERO_COND] THEN +REWRITE_TAC[UPS_X_EQ_ZERO_COND; REAL_ARITH` a <= b <=> a = b \/ a < b `] THEN +REWRITE_TAC[dist3] THEN MESON_TAC[REAL_ARITH` ~( a = b /\ a < b ) `]);; + + +let ETA_Y_POW2_EQ = prove(`(dist (v1,v2) pow 2 * dist (v1,v3) pow 2 * dist (v2,v3) pow 2) / + ups_x (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v2,v3) pow 2) = +( eta_y (dist3 v2 v3) (dist3 v1 v3) (dist3 v1 v2)) pow 2 `, +REWRITE_TAC[eta_y;dist3; eta_x] THEN LET_TR THEN +REWRITE_TAC[GSYM REAL_POW_2; GSYM dist3 ] THEN +SIMP_TAC[MESON[UPS_X_SYM]` ups_x a b c = ups_x c b a `; +REAL_ARITH ` a * b * c = c * b * a `] THEN +MESON_TAC[SQRT_WORKS; REAL_LE_SQUARE_POW; REAL_LE_MUL; + REAL_LE_DIV; dist3 ; ZERO_LE_UPS_X; UPS_X_SYM]);; + + +let ETA_Y_POS_LE = prove(` &0 <= eta_y (dist3 v1 v2) (dist3 v1 v3) (dist3 v2 v3) `, +REWRITE_TAC[eta_y; eta_x] THEN LET_TR THEN REWRITE_TAC[GSYM REAL_POW_2] THEN +MESON_TAC[REAL_LE_POW_2; REAL_LE_MUL; ZERO_LE_UPS_X; REAL_LE_DIV; + SQRT_POS_LE]);; + + +(* lemma 87 *) +let ZJEWPAP = prove(` ! v1 v2 v3 (v4:real^3). + let s = {v1, v2, v3, v4} in CARD s = 4 /\ ~ coplanar_alt s + ==> radV {v1,v2,v3} <= radV s `, +LET_TR THEN +NHANH (MESON[COLLINEAR_IMP_COPLANAR ]`~coplanar_alt {v1, v2, v3, v4} + ==> ~ collinear {(v1:real^3),v2,v3} `) THEN +SIMP_TAC[NOT_COLL_IMP_RADV_EQ_ETA_Y] THEN +REWRITE_TAC[MESON[]` a /\ b /\ c <=> (a/\b)/\c`] THEN +NHANH (SPEC_ALL VBVYGGT) THEN +REPEAT GEN_TAC THEN +NHANH (NOT_COPLANAR_IMP_RADV_PROPERTIES) THEN +ABBREV_TAC ` pp = circumcenter {(v1:real^3), v2, v3, v4}` THEN +MP_TAC (SPECL [`pp :real^3`; ` v1: real^3`; `v2:real^3`; ` v3:real^3`] DELTA_POS_4POINTS ) THEN +REWRITE_TAC[REWRITE_RULE[IN] FORALL_IN_CLAUSES; + FORALL_IN_CLAUSES ] THEN +REWRITE_TAC[MESON[]` ( a ==> b ==> c <=> a /\ b ==> c ) /\ + ( (a /\ b ) /\ c <=> a /\ b /\ c ) `] THEN +REPEAT STRIP_TAC THEN +UNDISCH_TAC ` &0 <= + delta (dist ((pp:real^3),v1) pow 2) (dist (pp,v2) pow 2) (dist (pp,v3) pow 2) + (dist (v1,v2) pow 2) + (dist (v1,v3) pow 2) + (dist (v2,v3) pow 2)` THEN +ABBREV_TAC `p1 = dist ((pp:real^3),v1)` THEN +ABBREV_TAC `p2 = dist ((pp:real^3),v2)` THEN +ABBREV_TAC `p3 = dist ((pp:real^3),v3)` THEN + REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC THEN MATCH_MP_TAC +(MESON[]` a ==> b ==> a `)) THEN +EXPAND_TAC "p1" THEN +EXPAND_TAC "p2" THEN +EXPAND_TAC "p3" THEN +FIRST_X_ASSUM MP_TAC THEN +REWRITE_TAC[NOT_COL_EQ_UPS_X_POS ] THEN +REWRITE_TAC[NOT_COL_EQ_UPS_X_POS; DELTA_RRR_INTERPRETE] THEN +SIMP_TAC[REAL_FIELD` &0 < a ==> -- b * c + r * a = a * ( r - ( b * c ) / a ) `] THEN +SIMP_TAC[ETA_Y_POW2_EQ; REAL_LE_MUL_EQ] THEN +UNDISCH_TAC ` radV {(v1:real^3), v2, v3, v4} = p1 ` THEN +SIMP_TAC[] THEN +EXPAND_TAC "p1" THEN +UNDISCH_TAC `r = dist ((pp: real^3),v4)` THEN +SIMP_TAC[] THEN +REPLICATE_TAC 3 REMOVE_TAC THEN +SIMP_TAC[ETA_Y_SYYM; REAL_ARITH` &0 <= a - b <=> b <= a `] THEN +MESON_TAC[DIST_POS_LE; POW2_COND; ETA_Y_POS_LE ]);; + + + + + +let NOT_EQ_BASIS_IMP_OTHORGANAL = MESON[DOT_BASIS_BASIS_UNEQUAL] +` ! i j. ~( i = j ) ==> basis i dot basis j = &0 `;; + +let BASIS_DIS_OTHORGONAL = +MESON[ARITH_RULE` ~( 1 = 2 \/ 1 = 3 \/ 2 = 3 ) `; NOT_EQ_BASIS_IMP_OTHORGANAL] +` basis 1 dot basis 2 = &0 /\ + basis 1 dot basis 3 = &0 /\ + basis 2 dot basis 3 = &0 ` ;; + +let NORM_BASIS_VEC3 = prove(` ! i. i = 1 \/ i = 2 \/ i = 3 ==> +norm (( basis i ):real^3 ) = &1 `, +MESON_TAC[DIMINDEX_3; ARITH_RULE` i = 1 \/ i = 2 \/ i = 3 <=> + 1 <= i /\ i <= 3`; NORM_BASIS]);; + +let AAA_LEMMA = prove(` &0 < a /\ + a <= b /\ + b <= c /\ ll ==> &0 <= b pow 2 - a pow 2 /\ &0 <= c pow 2 - b pow 2 `, +REWRITE_TAC[REAL_ARITH` &0 <= a - b <=> b <= a `] THEN +MESON_TAC[REAL_LT_IMP_LE; POW2_COND; POS_IMP_POW2; REAL_LE_TRANS]);; + +let LLEEMAA = prove(` &0 < a /\ + a <= b /\ + b <= c /\ + &0 < a' /\ + a' <= b' /\ + b' <= c' /\ + a <= a' /\ + b <= b' /\ + c <= c' /\ l ==> &0 <= a' pow 2 - a pow 2 /\ + &0 <= b' pow 2 - b pow 2 /\ + &0 <= c' pow 2 - c pow 2 `, +REWRITE_TAC[REAL_ARITH` &0 <= a - b <=> b <= a `] THEN +MESON_TAC[POS_IMP_POW2; REAL_ARITH` a < b ==> a <= b `; + REAL_LE_TRANS]);; + +let TYUNJLA = prove(` !(e1:real^3) e2 e3 a b c a' b' c' t1 t2 t3. + e1 = basis 1 /\ + e2 = basis 2 /\ + e3 = basis 3 /\ + &0 < a /\ + a <= b /\ + b <= c /\ + &0 < a' /\ + a' <= b' /\ + b' <= c' /\ + a <= a' /\ + b <= b' /\ + c <= c' /\ + (!x. x IN {t1, t2, t3} ==> &0 < x) /\ + t1 + t2 + t3 < &1 /\ + v = + ((t1 + t2 + t3) * a) % e1 + + ((t2 + t3) * sqrt (b pow 2 - a pow 2)) % e2 + + (t3 * sqrt (c pow 2 - b pow 2)) % e3 /\ + v' = ((t1 + t2 + t3) * a') % e1 + + ((t2 + t3) * sqrt (b' pow 2 - a' pow 2)) % e2 + + (t3 * sqrt (c' pow 2 - b' pow 2)) % e3 ==> + norm v <= norm v' `, +REPEAT STRIP_TAC THEN FIRST_X_ASSUM MP_TAC THEN +FIRST_X_ASSUM MP_TAC THEN +SIMP_TAC[POW2_COND; NORM_POS_LE; NORM_POW_2; DOT_LADD; DOT_RADD; +DOT_LMUL; DOT_RMUL] THEN ASM_SIMP_TAC[] THEN +SIMP_TAC[GSYM NORM_POW_2; NORM_BASIS_VEC3 ] THEN +SIMP_TAC[BASIS_DIS_OTHORGONAL; MESON[DOT_SYM; BASIS_DIS_OTHORGONAL] + ` basis 2 dot basis 1 = &0 /\ basis 3 dot basis 1 = &0 /\ + basis 3 dot basis 2 = &0 `; ZERO_NEUTRAL] THEN +REWRITE_TAC[REAL_ARITH` (a * x ) * ( b * x ) * c = a * b * c * x pow 2 `] THEN +REPEAT STRIP_TAC THEN DOWN_TAC THEN +NHANH (AAA_LEMMA) THEN PHA THEN +NHANH (MESON[AAA_LEMMA]` &0 < a /\ a <= b /\ b <= c /\ aa <= a /\ l ==> + &0 <= b pow 2 - a pow 2 /\ &0 <= c pow 2 - b pow 2 `) THEN +SIMP_TAC[SQRT_WORKS] THEN +ONCE_REWRITE_TAC[REAL_ARITH` a <= b <=> &0 <= b - a `] THEN +REWRITE_TAC[REAL_ARITH` ((t1 + t2 + t3) * (t1 + t2 + t3) * &1 pow 2 * a' pow 2 + + (t2 + t3) * (t2 + t3) * &1 pow 2 * (b' pow 2 - a' pow 2) + + t3 * t3 * &1 pow 2 * (c' pow 2 - b' pow 2)) - + ((t1 + t2 + t3) * (t1 + t2 + t3) * &1 pow 2 * a pow 2 + + (t2 + t3) * (t2 + t3) * &1 pow 2 * (b pow 2 - a pow 2) + + t3 * t3 * &1 pow 2 * (c pow 2 - b pow 2)) = + t1 * ( t1 + &2 * t2 + &2 * t3 ) * ( a' pow 2 - a pow 2 ) + + t2 * (t2 + &2 * t3 ) * ( b' pow 2 - b pow 2 ) + + t3 pow 2 * ( c' pow 2 - c pow 2 ) `] THEN +REWRITE_TAC[REAL_ARITH` &0 <= a - b <=> b <= a `] THEN +PHA THEN NHANH (LLEEMAA) THEN STRIP_TAC THEN +UNDISCH_TAC ` (!x. x IN {t1, t2, t3} ==> &0 < x)` THEN +REPLICATE_TAC 3 ( FIRST_X_ASSUM MP_TAC) THEN +REWRITE_TAC[FORALL_IN_CLAUSES] THEN PHA THEN +NHANH (REAL_ARITH` &0 < t1 /\ &0 < t2 /\ &0 < t3 ==> + &0 <= t1 /\ &0 <= t2 /\ &0 <= t1 + &2 * t2 + &2 * t3 /\ + &0 <= t2 + &2 * t3 `) THEN +MESON_TAC[REAL_LE_ADD; REAL_LE_MUL; REAL_LE_POW_2]);; + +let LEMMA83 = TYUNJLA ;; + +let DELTA_TRIPLE_SUB_H_EXPAND = prove(` +delta (a01 - h) (a02 - h) (a03 - h) x12 x13 x23 = + delta a01 a02 a03 x12 x13 x23 - h * ups_x x12 x13 x23 `, +REWRITE_TAC[delta;ups_x] THEN REAL_ARITH_TAC);; + +let PROVE_EXISTS_H_DELTA_0 = prove(`&0 < ups_x x12 x13 x23 /\ &0 <= delta a01 a02 a03 x12 x13 x23 + ==> (?h. &0 <= h /\ h = ( delta a01 a02 a03 x12 x13 x23 ) / ups_x x12 x13 x23 /\ + delta (a01 - h) (a02 - h) (a03 - h) x12 x13 x23 = &0 )`, +REWRITE_TAC[DELTA_TRIPLE_SUB_H_EXPAND] THEN +DISCH_TAC THEN +EXISTS_TAC`( delta a01 a02 a03 x12 x13 x23 ) / ups_x x12 x13 x23` THEN +ASM_SIMP_TAC[REAL_LT_IMP_LE; REAL_LE_DIV] THEN +FIRST_X_ASSUM MP_TAC THEN CONV_TAC REAL_FIELD);; + +let FIRST_POINT_IN_AFF3 = prove(` ! w v1 v2. w IN aff {w,v1,v2} `, +REWRITE_TAC[aff; AFFINE_HULL_3; IN_ELIM_THM] THEN REPEAT GEN_TAC THEN +EXISTS_TAC ` &1 ` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0` THEN +REWRITE_TAC[ZERO_NEUTRAL] THEN CONV_TAC VECTOR_ARITH);; + +let THREE_GEN_POINTS_IN_AFF3 = MESON[PER_SET3; FIRST_POINT_IN_AFF3 ]` a IN aff {a,b,c} /\ + b IN aff {a,b,c} /\ c IN aff {a,b,c} `;; + +let PROVE_THE_HYPOTHESI_FOR_74 = prove(` (let s = {v1, v2, v3, v4} in + CARD s = 4 /\ + + ~coplanar_alt s /\ + eta_y (dist3 v1 v2 ) (dist3 v1 v3) (dist3 v2 v3) <= r ) +==> ( let x12 = dist3 v1 v2 pow 2 in + let x13 = dist3 v1 v3 pow 2 in + let x23 = dist3 v2 v3 pow 2 in + CARD {v1, v2, v3, v4} = 4 /\ + + ~coplanar_alt {v1, v2, v3, v4} /\ + &0 <= r pow 2 /\ + &0 <= r pow 2 /\ + &0 <= r pow 2 /\ + delta (r pow 2) (r pow 2) (r pow 2) x12 x13 x23 >= &0 ) `, +REPEAT LET_TAC THEN +SIMP_TAC[REAL_LE_POW_2] THEN +REWRITE_TAC[DELTA_RRR_INTERPRETE] THEN +EXPAND_TAC "s" THEN +NHANH (MESON[COLLINEAR_IMP_COPLANAR]` ~ coplanar_alt {v1, v2, v3, v} ==> + ~ collinear {v1, v2, (v3:real^3)} `) THEN +REWRITE_TAC[NOT_COL_EQ_UPS_X_POS] THEN +EXPAND_TAC "x12" THEN +EXPAND_TAC "x13" THEN +EXPAND_TAC "x23" THEN +REWRITE_TAC[dist3] THEN +SIMP_TAC[REAL_FIELD` &0 < a ==> -- x * y + r * a = a * ( r - (x * y ) / a )`] THEN +SIMP_TAC[ETA_Y_POW2_EQ;dist3; ETA_Y_SYYM] THEN +MP_TAC ETA_Y_POS_LE THEN +DAO THEN PHA THEN +REWRITE_TAC[dist3] THEN DAO THEN +NHANH (MESON[POS_IMP_POW2]` a <= b /\ &0 <= a ==> + a pow 2 <= b pow 2 `) THEN +ONCE_REWRITE_TAC[REAL_ARITH` a <= b <=> &0 <= b - a `] THEN +REWRITE_TAC[REAL_ARITH` a >= &0 <=> &0 <= a `] THEN +SIMP_TAC[REAL_LT_IMP_LE; REAL_LE_MUL]);; + + +let INSERT_SUBSET = SET_RULE` {} SUBSET s /\ + ( ( a INSERT s ) SUBSET ss <=> a IN ss /\ s SUBSET ss ) `;; + + +let IMP_TAC = REWRITE_TAC[MESON[]` a /\ b ==> c <=> a ==> b ==> c `];; + +let IMP_OTHORGONAL_AFF3 = prove(`!v1 v2 v3 u. + u dot (v1 - v2) = &0 /\ u dot (v1 - v3) = &0 + ==> (!x y. {x, y} SUBSET aff {v1, v2, v3} ==> u dot (x - y) = &0)`, +REWRITE_TAC[aff; AFFINE_HULL_3; INSERT_SUBSET; IN_ELIM_THM] THEN +REPEAT STRIP_TAC THEN DOWN_TAC THEN +REWRITE_TAC[MESON[]` a /\ b ==> c <=> a ==> b ==> c `] THEN +SIMP_TAC[REAL_ARITH` a + b = &1 <=> a = &1 - b `] THEN +REWRITE_TAC[VECTOR_ARITH` ((&1 - (v + w)) % v1 + v % v2 + w % v3) - + ((&1 - (v' + w')) % v1 + v' % v2 + w' % v3) = + ( v' - v ) % ( v1 - v2 ) + ( w' - w ) % ( v1 - v3 ) `] THEN REPEAT STRIP_TAC + THEN ASM_SIMP_TAC[DOT_RADD; DOT_RMUL; ZERO_NEUTRAL]);; + + +(* MONG7_ROI *) + +let DIST_EQ_IMP_OTHORGONAL = prove(` ! a b p q. dist (p,a) = dist (p,b) /\ dist (q,a) = dist(q,b) +==> ( p - q ) dot ( a - b ) = &0 `, +REWRITE_TAC[MONG7_ROI; DOT_LSUB] THEN REAL_ARITH_TAC);; + +let NOT_COPLANAR_IMP_NOT_COLLINEAR = + MATCH_MP (MESON[]` (a ==> b) ==> ~ b ==> ~ a `) (SPEC_ALL COLLINEAR_IMP_COPLANAR);; + +(* lemma 89 *) +let PVLJZLA = prove( `! (v1:real^3) v2 v3 v4. + let s = {v1, v2, v3, v4} in + ~coplanar_alt s + ==> (circumcenter s IN conv0 s <=> + orientation s v1 (\x. &0 < x) /\ + orientation s v2 (\x. &0 < x) /\ + orientation s v3 (\x. &0 < x) /\ + orientation s v4 (\x. &0 < x))`, +REWRITE_TAC[orientation; affsign] THEN +REPEAT GEN_TAC THEN +LET_TR THEN +REWRITE_TAC[lin_combo] THEN +REWRITE_TAC[SET_RULE` s DIFF {a} UNION {a} = s UNION {a} `; + SET_RULE` {a,b,c,d} UNION {a} = {a,b,c,d} /\ + {a,b,c,d} UNION {b} = {a,b,c,d} /\ + {a,b,c,d} UNION {c} = {a,b,c,d} /\ + {a,b,c,d} UNION {d} = {a,b,c,d}`] THEN +REWRITE_TAC[MESON[]`a = b /\ c /\ d <=> c /\ d /\ b = a `] THEN +REWRITE_TAC[SET_RULE` (!w. {v1} w ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ l + <=> (!w. w IN {v1,v2,v3,v4} ==> {v1} w ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ l `; + SET_RULE` (!w. {v2} w ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ l + <=> (!w. w IN {v1,v2,v3,v4} ==> {v2} w ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ l `; + SET_RULE` (!w. {v2} w ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ l + <=> (!w. w IN {v1,v2,v3,v4} ==> {v2} w ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ l `; + SET_RULE` (!w. {v3} w ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ l + <=> (!w. w IN {v1,v2,v3,v4} ==> {v3} w ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ l `; + SET_RULE` (!w. {v4} w ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ l + <=> (!w. w IN {v1,v2,v3,v4} ==> {v4} w ==> &0 < f w) /\ + sum {v1, v2, v3, v4} f = &1 /\ l `] THEN + SIMP_TAC[AFFINE_HULL_FINITE_STEP_GEN; + REAL_ARITH `&0 < x /\ &0 < y ==> &0 < x + y`; + REAL_ARITH ` &0 < x ==> &0 < x / &2`; + FINITE_INSERT; CONJUNCT1 FINITE_RULES +; RIGHT_EXISTS_AND_THM] THEN +NHANH (NOT_COPLANAR_IMP_CARD4) THEN +SIMP_TAC[IN_ACT_SING; CARD4; IN_SET3; DE_MORGAN_THM] THEN +REWRITE_TAC[REAL_ARITH` a - b = c <=> a = b + c `; ZERO_NEUTRAL; + VECTOR_ARITH`(a:real^N) - b = c <=> a = b + c `; VECTOR_ARITH` x + + vec 0 = x `] THEN +REWRITE_TAC[CONV0_4; IN_ELIM_THM] THEN +NHANH (SPEC ` circumcenter {(v1:real^3), v2, v3, v4} ` ( GEN `v:real^3` (SPEC_ALL COEFS_4))) THEN +STRIP_TAC THEN +EQ_TAC THENL [ +MESON_TAC[]; +UNDISCH_TAC ` !ta tb tc td. + circumcenter {v1, v2, v3, v4} = + ta % v1 + tb % v2 + tc % v3 + td % v4 /\ + ta + tb + tc + td = &1 + ==> ta = COEF4_1 v1 v2 v3 v4 (circumcenter {v1, v2, v3, v4}) /\ + tb = COEF4_2 v1 v2 v3 v4 (circumcenter {v1, v2, v3, v4}) /\ + tc = COEF4_3 v1 v2 v3 v4 (circumcenter {v1, v2, v3, v4}) /\ + td = COEF4_4 v1 v2 v3 v4 (circumcenter {v1, v2, v3, v4})` THEN +REWRITE_TAC[MESON[]`&0 < v /\ ( ? b . P v b ) <=> + (? b. &0 < v /\ P v b ) `] THEN +REWRITE_TAC[MESON[]` &1 = a /\ aa = b <=> a = &1 /\ b = aa `] THEN +ABBREV_TAC ` (vv:real^3) = circumcenter {v1, v2, v3, v4} ` THEN +ABBREV_TAC ` a1 = COEF4_1 v1 v2 v3 v4 vv ` THEN +ABBREV_TAC ` a2 = COEF4_2 v1 v2 v3 v4 vv ` THEN +ABBREV_TAC ` a3 = COEF4_3 v1 v2 v3 v4 vv ` THEN +ABBREV_TAC ` a4 = COEF4_4 v1 v2 v3 v4 vv ` THEN PHA THEN +IMP_TAC THEN STRIP_TAC THEN STRIP_TAC THEN +REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN PHA THEN +NHANH (MESON[]`(!ta tb tc td. + vv = ta % v1 + tb % v2 + tc % v3 + td % v4 /\ ta + tb + tc + td = &1 + ==> ta = a1 /\ tb = a2 /\ tc = a3 /\ td = a4) /\ + a111 /\ + v + v' + v'' + v''' = &1 /\ + v % v1 + v' % v2 + v'' % v3 + v''' % v4 = vv /\ + (?v v' v'' v'''. + &0 < v' /\ + v + v' + v'' + v''' = &1 /\ + v % v1 + v' % v2 + v'' % v3 + v''' % v4 = vv) /\ + (?v v' v'' v'''. + &0 < v'' /\ + v + v' + v'' + v''' = &1 /\ + v % v1 + v' % v2 + v'' % v3 + v''' % v4 = vv) /\ + (?v v' v'' v'''. + &0 < v''' /\ + v + v' + v'' + v''' = &1 /\ + v % v1 + v' % v2 + v'' % v3 + v''' % v4 = vv) ==> + &0 < v' /\ &0 < v'' /\ &0 < v''' `) THEN MESON_TAC[]]);; + + + + +let IMP_IN_AFF_LT = prove(`CARD {v1, v2, v3, v4} = 4 ==> ( (?v v' v'' v'''. + v < &0 /\ + &1 = v + v' + v'' + v''' /\ vv = + v % v1 + v' % v2 + v'' % v3 + v''' % v4) <=> + vv IN aff_lt {v2,v3,v4} {v1} ) `, +REWRITE_TAC[CARD4; IN_SET3; DE_MORGAN_THM] THEN SIMP_TAC[AFF_GES_GTS; IN_ELIM_THM] +THEN REMOVE_TAC THEN +MESON_TAC[REAL_ARITH` a + b + c + d = d + a + b + c `; + VECTOR_ARITH` a + b + c + d = d + a + b + (c:real^N)`]);; + + +let SQRT4_EQ2 = prove(` sqrt ( &4 ) = &2 `, +REWRITE_TAC[REAL_ARITH` &4 = &2 pow 2 `] THEN +MESON_TAC[POW_2_SQRT; REAL_ARITH` &0 <= &2 `]);; + + +let RHUFIIB = prove( ` !x12 x13 x14 x23 x24 x34. + rho_ij' x12 x13 x14 x23 x24 x34 * ups_x x34 x24 x23 = + chi x12 x13 x14 x23 x24 x34 pow 2 + + &4 * delta x12 x13 x14 x23 x24 x34 * x34 * x24 * x23 `, +REWRITE_TAC[rho_ij'; chi; delta; ups_x] THEN REAL_ARITH_TAC);; + + +(* lemma 84 *) +let SHOGYBS = prove(` ! x1 x2 x3 (x4:real^3). + ~coplanar_alt {x1,x2,x3,x4} ==> + let x12 = dist (x1,x2) pow 2 in + let x13 = dist (x1,x3) pow 2 in + let x14 = dist (x1,x4) pow 2 in + let x23 = dist (x2,x3) pow 2 in + let x24 = dist (x2,x4) pow 2 in + let x34 = dist (x3,x4) pow 2 in + &0 <= rho_ij' x12 x13 x14 x23 x24 x34 `, +ONCE_REWRITE_TAC[SET_RULE` {v1,v2,v3,v4} = {v2,v3,v4,v1} `] THEN +NHANH (NOT_COPLANAR_IMP_NOT_COLLINEAR) THEN +ONCE_REWRITE_TAC[GSYM (SET_RULE` {v1,v2,v3,v4} = {v2,v3,v4,v1} `)] THEN +REWRITE_TAC[NOT_COL_EQ_UPS_X_POS] THEN REPEAT GEN_TAC THEN +MP_TAC (SPEC_ALL DELTA_POS_4POINTS) THEN +REPEAT LET_TAC THEN MP_TAC (SPEC_ALL RHUFIIB) THEN DOWN_TAC THEN +NHANH (MESON[REAL_LE_POW_2]` a pow 2 = b ==> &0 <= b `) THEN DAO THEN +SIMP_TAC[UPS_X_SYM] THEN +REWRITE_TAC[MESON[REAL_FIELD` &0 < a ==> (b * a = c <=> b = c / a )`]` + &0 < a /\a1 /\a2/\ b * a = c /\l <=> &0 < a /\a1 /\a2/\ b = c / a /\ l `] THEN +MP_TAC (REAL_ARITH` &0 <= &4 `) THEN PHA THEN +NHANH (MESON[REAL_LT_IMP_LE; REAL_LE_DIV; + REAL_LE_MUL; REAL_LE_ADD; REAL_LE_POW_2]` &0 <= &4 /\ + &0 < ups_x x23 x24 x34 /\a1/\ + &0 <= delta x12 x13 x14 x23 x24 x34 /\ a2 /\ + &0 <= x34 /\a3 /\ &0 <= x24 /\a4 /\ &0 <= x23 /\a5/\ + &0 <= x14 /\a6 /\ &0 <= x13 /\a7 /\a8 /\ &0 <= x12 ==> + &0 <= &4 * delta x12 x13 x14 x23 x24 x34 * x34 * x24 * x23 `) THEN +ABBREV_TAC ` aaa = &4 * delta x12 x13 x14 x23 x24 x34 * x34 * x24 * x23 ` THEN STRIP_TAC THEN +FIRST_X_ASSUM MP_TAC THEN UNDISCH_TAC ` rho_ij' x12 x13 x14 x23 x24 x34 = + (chi x12 x13 x14 x23 x24 x34 pow 2 + aaa) / ups_x x23 x24 x34 ` THEN +UNDISCH_TAC`&0 < ups_x x23 x24 x34` THEN MESON_TAC[REAL_LT_IMP_LE; REAL_LE_DIV; + REAL_LE_MUL; REAL_LE_ADD; REAL_LE_POW_2]);; + + +(* le 86 . GDRQXLG *) + + +let GDRQXLG = prove(` ! v1 v2 v3 (v4:real^3). + let s = {v1, v2, v3, v4} in +let x12 = dist (v1,v2) pow 2 in + let x13 = dist (v1,v3) pow 2 in + let x14 = dist (v1,v4) pow 2 in + let x23 = dist (v2,v3) pow 2 in + let x24 = dist (v2,v4) pow 2 in + let x34 = dist (v3,v4) pow 2 in + CARD s = 4 /\ ~coplanar_alt s + ==> radV s = + sqrt ( rho_ij' x12 x13 x14 x23 x24 x34) / + (&2 * sqrt (delta x12 x13 x14 x23 x24 x34))`, +REPEAT GEN_TAC THEN REPEAT LET_TAC THEN EXPAND_TAC "s" THEN +NHANH (NOT_COPLANAR_IMP_RADV_PROPERTIES) THEN +NHANH (REWRITE_RULE[RIGHT_FORALL_IMP_THM] (GEN `p:real^3` PROVE_DIST_FROM_V1 )) THEN +NHANH (REWRITE_RULE[RIGHT_FORALL_IMP_THM] (GEN `p:real^3` PROVE_EQ_DIST_FROM4 ) ) THEN +REWRITE_TAC[GSYM POS_EQ_NOT_COPLANANR] THEN +NHANH (REAL_ARITH` &0 < a ==> ~( a = &0 )`) THEN +NHANH (PROVE_IN_AFFINE_HULL_4 ) THEN LET_TR THEN +REWRITE_TAC[MESON[]`(!x. x = a ==> p x) <=> p a `] THEN +ABBREV_TAC `taa = (&1 / (&2 * + delta (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) + (dist (v2,v4) pow 2) + (dist (v3,v4) pow 2)) % + (chi (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) + (dist (v2,v4) pow 2) + (dist (v3,v4) pow 2) % + (v1:real^3) + + chi (dist (v1,v2) pow 2) (dist (v2,v4) pow 2) (dist (v2,v3) pow 2) + (dist (v1,v4) pow 2) + (dist (v1,v3) pow 2) + (dist (v3,v4) pow 2) % + v2 + + chi (dist (v3,v4) pow 2) (dist (v1,v3) pow 2) (dist (v2,v3) pow 2) + (dist (v1,v4) pow 2) + (dist (v2,v4) pow 2) + (dist (v1,v2) pow 2) % + v3 + + chi (dist (v3,v4) pow 2) (dist (v2,v4) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) + (dist (v1,v3) pow 2) + (dist (v1,v2) pow 2) % + v4)) ` THEN +REWRITE_TAC[ POS_EQ_NOT_COPLANANR] THEN NGOAC THEN +NHANH (SPEC_ALL UNIQUE_EXISISTING_PROPERTY_C4 ) THEN +REWRITE_TAC[FORALL_IN_CLAUSES] THEN ABBREV_TAC ` abc = &1 / &2 * + rho_ij' (dist (v1,v2) pow 2) (dist (v1,v3) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) (dist (v2,v4) pow 2) (dist (v3,v4) pow 2) / + (&2 * + delta (dist ((v1:real^3),v2) pow 2) (dist (v1,v3) pow 2) (dist (v1,v4) pow 2) + (dist (v2,v3) pow 2) + (dist (v2,v4) pow 2) + (dist (v3,v4) pow 2)) ` THEN REWRITE_TAC[dist3] THEN +NHANH (MESON[POW_2_SQRT; DIST_POS_LE]` dist (taa,v2) pow 2 = a ==> + dist(taa,v2) = sqrt a `) THEN PHA THEN +NHANH (MESON[]`(!p. p IN affine hull {v1, v2, v3, v4} /\ + (?r. r = dist (p,v1) /\ + r = dist (p,v2) /\ + r = dist (p,v3) /\ + r = dist (p,v4)) + ==> p = circumcenter {v1, v2, v3, v4}) /\ a11 /\ + taa IN affine hull {v1, v2, v3, v4} /\ + dist (taa,v2) pow 2 = abc /\ + dist (taa,v2) = sqrt abc /\ + dist (taa,v3) pow 2 = abc /\ + dist (taa,v3) = sqrt abc /\ + dist (taa,v4) pow 2 = abc /\ + dist (taa,v4) = sqrt abc /\ + dist (taa,v1) pow 2 = abc /\ + dist (taa,v1) = sqrt abc /\ lll ==> taa = circumcenter {v1, v2, v3, v4} `) THEN +NHANH (SET_RULE ` (!w. {v1, v2, v3, v4} w ==> P w ) ==> P v1 `) THEN PHA THEN +REWRITE_TAC[MESON[]` a = dist (aa,b) /\ ta = aa <=> ta = aa /\ a = dist (ta,b) `] THEN +NHANH (MESON[]` a = b /\ a1 /\ a2 /\ c = a ==> c = b `) THEN NHANH (SPEC_ALL SHOGYBS) THEN +MP_TAC (SPECL [`v1:real^3`;` v2:real^3`;`v3:real^3`;`v4:real^3`] +DELTA_POS_4POINTS) THEN REPEAT LET_TAC THEN IMP_TAC THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN +REWRITE_TAC[MESON[]` a = b ==> P a <=> a = b ==> P b `] THEN +REWRITE_TAC[MESON[]` a = b ==> a = c <=> a = b ==> c = b `] THEN REPEAT STRIP_TAC THEN +UNDISCH_TAC ` &1 / &2 * rho_ij' x12 x13 x14 x23 x24 x34 / (&2 * delta x12 x13 x14 x23 x24 x34) = + abc ` THEN UNDISCH_TAC ` &0 <= rho_ij' x12 x13 x14 x23 x24 x34 ` THEN +ABBREV_TAC ` edl = delta x12 x13 x14 x23 x24 x34 ` THEN UNDISCH_TAC` &0 <= edl ` THEN +SIMP_TAC[REAL_ARITH` &0 <= &4 `; GSYM SQRT_MUL; GSYM SQRT4_EQ2] THEN +SIMP_TAC[REAL_ARITH` &0 <= &4 `; REAL_LE_MUL; GSYM SQRT_DIV] THEN +REWRITE_TAC[SQRT4_EQ2] THEN MESON_TAC[REAL_FIELD` &1 / &2 * x34 / (&2 * edl) = x34 / (&4 * edl)`]);; + + + +end;; (* end of module *) + diff --git a/text_formalization/leg/enclosed_def.hl b/text_formalization/leg/enclosed_def.hl new file mode 100644 index 0000000..6adbb80 --- /dev/null +++ b/text_formalization/leg/enclosed_def.hl @@ -0,0 +1,51 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Definition: enclosed *) +(* Chapter: LEG *) +(* Author: Thomas C. Hales *) +(* Date: 2010-02-07 *) +(* ========================================================================== *) + + + + +(* +The function of 9 variables defined on page 37 of the Kepler Conjecture, DCG vol 36(1), July 2006 +It is generally typeset as a calligraphic E. + +It is a quadratic with nonnegative leading coefficient. +*) + + + +module type Enclosed_def_type = sig + val enclosed : thm + val quad_cross_diag2_x : thm +end;; + + +flyspeck_needs "leg/muR_def.hl";; + +(* +flyspeck_needs "leg/abc_of_quadratic_def.hl";; +flyspeck_needs "leg/quadratic_root_plus_def.hl";; +*) + + +module Enclosed : Enclosed_def_type = struct + + let quadratic_root_plus = Sphere.quadratic_root_plus;; + let abc_of_quadratic = Sphere.abc_of_quadratic;; + let muR = Mur.muR;; + + let enclosed = + new_definition `enclosed y1 y2 y3 y4 y5 y6 y7 y8 y9 = sqrt + (quadratic_root_plus (abc_of_quadratic (muR y1 y2 y3 y4 y5 y6 y7 y8 y9)))`;; + + let quad_cross_diag2_x = new_definition + `quad_cross_diag2_x x1 x2 x3 x4 x5 x6 x7 x8 x9 = + enclosed (sqrt x1) (sqrt x5) (sqrt x6) (sqrt x4) (sqrt x2) (sqrt x3) (sqrt x7) (sqrt x8) (sqrt x9)`;; + +end;; + diff --git a/text_formalization/leg/geomdetail.hl b/text_formalization/leg/geomdetail.hl new file mode 100644 index 0000000..605806c --- /dev/null +++ b/text_formalization/leg/geomdetail.hl @@ -0,0 +1,1132 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Lemmas in Geometry *) +(* Author: NGUYEN QUANG TRUONG *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + +(* + +Note: 2010-02-07. This file was written for the pre-2009 version of the proof of the Kepler +conjecture. Various things from this file are no longer needed. For now, we load it, +because some proofs from collect_geom.hl rely on this file. + +Eventually this file should be pruned down to what is really needed. + +voronoi_trg -> voronoi_ +conv -> (hull) convex +aff -> (hull) affine +dist3 -> dist +convex_trg -> (hull) convex +simplex -> geomdetail'simplex renamed. +deprecated: t0, voronoi2, voro2, center_pac, centered_pac, quasi_tri, quasi_reg_tet, +quarter, diagonal, strict_qua, strict_qua2, quartered_oct, ... (many others.) + + +-THALES + +Feb 18, 2013 some lemmas were deleted that were not needed, svn1626. +*) + + +flyspeck_needs "general/sphere.hl";; + +module Geomdetail (* : Geomdetail_type *) = struct + + let packing = Sphere.packing;; + let voronoi_open = Sphere.voronoi_open;; + + +(* ================================ *) +(* ===== NGUYEN QUANG TRUONG ====== *) + + + +(* + +Note: I have split the file into 2 pieces: geomdetail.ml and geomdetail_08.ml. Not everything in geomdetail_08.ml loads with the Multivariate directory, but these are the parts that are least likely to be used in the revision of the proof in 2009. Everything in this file now loads with Multivariate. --tch July 14, 2009 + +*) +let near = new_definition ` near (v0:real^N) (r:real) s = { x | x IN s /\ + dist(x,v0) < r } `;; + +(* +let voronoi_trg = new_definition ` voronoi_trg v S = { x | !w. ((S w) /\ ~(w=v)) +==> (dist ( x , v ) < dist ( x , w )) }`;; +*) + +let conv0_2 = new_definition ` conv0_2 s = conv0 s `;; + +let convex = new_definition `convex s <=> !x y u v. x IN s /\ y IN s /\ &0 <= u /\ + &0 <= v /\ (u + v = &1) ==> (u % x + v % y) IN s`;; + +let aff = new_definition `aff = ( hull ) affine`;; + +let conv_trg = new_definition ` conv_trg s = convex hull s`;; + +let border = new_definition ` border s = { x | ! ep. ep > &0 /\ ( ? a b. ~ (b IN s ) /\ + dist (b, x) < ep /\ a IN s /\ dist (a, x) < ep ) }`;; + +let packing_trg = new_definition `packing_trg (s:real^3 -> bool) = (! x y. s x /\ s y /\ ( ~(x=y)) + ==> dist ( x, y) >= &2 ) `;; + +let center_pac = new_definition ` center_pac s v = ( packing_trg s /\ s v )`;; + +let centered_pac = new_definition ` centered_pac s v = ( packing s /\ v IN s )`;; + +let dist3 = new_definition ` dist3 (x:real^3) y = dist (x,y)`;; + +(* let voronoi2 = new_definition ` voronoi2 v S = {x| x IN voronoi_trg v S /\ dist3 x v < &2 }`;; *) + +(* let voro2 = new_definition ` voro2 v s = {x| x IN voronoi_open s v /\ dist3 x v < &2 }`;; *) + +(* +removed 2013-07-27: +let t0 = new_definition ` t0 = #1.255`;; + +let quasi_tri = new_definition ` quasi_tri tri s = ( packing s /\ + tri SUBSET s /\ + (? a b c. ~( a=b \/ b=c\/ c=a) /\ { a, b, c } = tri ) /\ + (! x y. ( x IN tri /\ y IN tri /\ (~(x=y)) ) ==> ( dist3 x y <= &2 * t0 )))`;; + +*) + +let simplex = new_definition ` geomdetail'simplex (d:real^3 -> bool) s = ( packing s /\ + d SUBSET s /\ +( ? v1 v2 v3 v4. ~( v1 = v2 \/ v3 = v4 ) /\ {v1, v2 } INTER {v3, v4 } = {}/\ {v1,v2,v3,v4} = d ) + )`;; + +(* +let quarter = new_definition ` quarter (q:real^3 -> bool) s = + ( packing s /\ + geomdetail'simplex q s /\ + (?v w. + v IN q /\ + w IN q /\ + &2 * t0 <= dist3 v w /\ + dist3 v w <= sqrt (&8) /\ + (!x y. + x IN q /\ y IN q /\ ~({x, y} = {v, w}) + ==> dist3 x y <= &2 * t0)))`;; +*) + +(* + +let quasi_reg_tet = new_definition ` quasi_reg_tet x s = ( geomdetail'simplex x s /\ + (! v w. ( v IN x /\ w IN x /\ + ( ~ ( v = w))) + ==> ( dist3 v w <= &2 * t0 )) )`;; + + +let diagonal = new_definition ` diagonal d1 d2 q s = ( quarter q s /\ + {d1, d2} SUBSET q /\ + (!x y. x IN q /\ y IN q ==> dist3 x y <= dist3 d1 d2))`;; + + + let strict_qua = new_definition ` strict_qua d s = ( quarter d s /\ + ( ? x y. x IN d /\ y IN d /\ &2 * t0 < dist3 x y /\ dist3 x y < sqrt( &8 ) ))`;; + +let strict_qua2 = new_definition ` strict_qua2 d (ch:real^3 -> bool ) s = ( quarter d s /\ ch SUBSET d + /\ ( ? x y. ~( x = y ) /\ ch = {x,y} /\ &2 * t0 < dist3 x y /\ dist3 x y < sqrt ( &8 ) ) )`;; + + + + +let quartered_oct = new_definition `quartered_oct (v:real^3) (w:real^3) (v1:real^3) (v2:real^3) (v3:real^3) (v4:real^3) s = + ( packing s /\ + ( &2 * t0 < dist (v,w) /\ dist (v,w) < sqrt (&8) ) /\ + (!x. x IN {v1, v2, v3, v4} + ==> dist (x,v) <= &2 * t0 /\ dist (x,w) <= &2 * t0) /\ + {v, w, v1, v2, v3, v4} SUBSET s /\ + (&2 <= dist (v1,v2) /\ dist (v1,v2) <= &2 * t0) /\ + (&2 <= dist (v2,v3) /\ dist (v2,v3) <= &2 * t0) /\ + (&2 <= dist (v3,v4) /\ dist (v3,v4) <= &2 * t0) /\ + &2 <= dist (v4,v1) /\ + dist (v4,v1) <= &2 * t0 ) `;; + +let adjacent_pai = new_definition ` adjacent_pai v v1 v3 v2 v4 s = ( strict_qua2 { v , v1 , v3 , v2 } { v1 , v3 } s + /\ strict_qua2 { v , v1 , v3 , v4 } { v1 , v3 } s /\ + ( conv0 { v , v1 , v3 , v2 } INTER conv0 { v , v1 , v3 , v4 } = {} ) )`;; + + +let conflicting_dia = new_definition ` conflicting_dia v v1 v3 v2 v4 s = ( adjacent_pai v v1 v3 v2 v4 s +/\ adjacent_pai v v2 v4 v1 v3 s )`;; + + + let interior_pos = new_definition `interior_pos v v1 v3 v2 v4 s = ( conflicting_dia v v1 v3 v2 v4 s + /\ ~( conv0 { v1, v3 } INTER conv0 { v , v2 , v4 } = {} ))`;; + +let isolated_qua = new_definition ` isolated_qua q s = ( quarter q s /\ ~( ? v v1 v2 v3 v4. q = + {v, v1, v2, v3} /\ adjacent_pai v v1 v2 v3 v4 s))`;; + +let isolated_pai = new_definition ` isolated_pai q1 q2 s = ( isolated_qua q1 s /\ isolated_qua q2 s /\ + ~ (conv0 q1 INTER conv0 q2 = {}))`;; + +let anchor = new_definition ` anchor (v:real^3) v1 v2 s = ( {v, v1, v2} SUBSET s /\ dist3 v1 v2 <= sqrt ( &8 ) /\ + dist3 v1 v2 >= &2 * t0 /\ dist3 v v1 <= &2 * t0 /\ dist3 v v2 <= &2 * t0 )`;; + + +let anchor_points = new_definition ` anchor_points v w s = { t | &2 * t0 <= dist3 v w /\ + anchor t v w s }`;; + + +let Q_SYS = new_definition ` Q_SYS s = {q | quasi_reg_tet q s \/ + strict_qua q s /\ + (?c d. + !qq. c IN q /\ + d IN q /\ + dist3 c d > &2 * t0 /\ + (quasi_reg_tet qq s \/ strict_qua qq s) /\ + conv0 {c, d} INTER conv0 qq = {}) \/ + strict_qua q s /\ + (CARD + {t | ?v w. + v IN q /\ w IN q /\ &2 * t0 < dist3 v w /\ anchor t v w s} > + 4 \/ + CARD + {t | ?v w. + v IN q /\ w IN q /\ &2 * t0 < dist3 v w /\ anchor t v w s} = + 4 /\ + ~(?v1 v2 v3 v4 v w. v IN q /\ + w IN q /\ + {v1, v2, v3, v4} SUBSET anchor_points v w s + /\ + + &2 * t0 < dist3 v w /\ + quartered_oct v w v1 v2 v3 v4 s)) + \/ (? v w v1 v2 v3 v4. q = { v, w, v1, v2} /\ quartered_oct v w v1 v2 v3 v4 s ) + \/ (? v v1 v3 v2 v4. ( q = {v, v1, v2, v3} \/ q = {v, v1, v3, v4} ) /\ + interior_pos v v1 v3 v2 v4 s /\ anchor_points v1 v3 s = { v, v2, v4} /\ + anchor_points v2 v4 s = { v, v1, v3 } )}`;; +*) + +(* deprecated - thales *) +let conv = new_definition `conv S:real^A->bool = affsign sgn_ge {} S`;; + + +(* +let barrier = new_definition ` barrier s = { { (v1 : real^3 ) , ( v2 :real^3 ) , (v3 :real^3) } | + quasi_tri { v1 , v2 , v3 } s \/ + (? v4. ( { v1 , v2 , v3 } UNION { v4 }) IN Q_SYS s ) } `;; + +let obstructed = new_definition ` obstructed x y s = ( ? bar. bar IN barrier s /\ + ( ~ (conv0_2 { x , y } INTER conv_trg bar = {})))`;; + +let obstruct = new_definition ` obstruct x y s = ( ? bar. bar IN barrier s /\ + ( ~ (conv0 { x , y } INTER conv bar = {})))`;; + +let unobstructed = new_definition ` unobstructed x y s = ( ~( obstructed x y s ))`;; + +let VC_trg = new_definition ` VC_trg x s = { z | dist3 x z < &2 /\ ~obstructed x z s /\ + (! y. y IN s /\ ~ ( x = y ) /\ ~(obstructed z y s) ==> dist3 x z < dist3 y z )} `;; + +let VC_INFI_trg = new_definition ` VC_INFI_trg s = { z | ( ! x. x IN s /\ + ~( z IN VC_trg x s ))}`;; + +let VC = new_definition `VC v s = { x | v IN lambda_x x s /\ +(!w. w IN lambda_x x s /\ ~(w = v) ==> dist3 x v < dist3 x w) }`;; + +let VC_INFI = new_definition ` VC_INFI s = { z | ( ! x. ~( z IN VC x s ))}`;; +*) + + +let SET_TAC = + let basicthms = + [NOT_IN_EMPTY; IN_UNIV; IN_UNION; IN_INTER; IN_DIFF; IN_INSERT; + IN_DELETE; IN_REST; IN_INTERS; IN_UNIONS; IN_IMAGE] in + let allthms = basicthms @ map (REWRITE_RULE[IN]) basicthms @ + [IN_ELIM_THM; IN] in + let PRESET_TAC = + TRY(POP_ASSUM_LIST(MP_TAC o end_itlist CONJ)) THEN + REPEAT COND_CASES_TAC THEN + REWRITE_TAC[EXTENSION; SUBSET; PSUBSET; DISJOINT; SING] THEN + REWRITE_TAC allthms in + fun ths -> + PRESET_TAC THEN + (if ths = [] then ALL_TAC else MP_TAC(end_itlist CONJ ths)) THEN + MESON_TAC[];; + + let SET_RULE tm = prove(tm,SET_TAC[]);; + +(* some TRUONG TACTICS *) + +let PHA = REWRITE_TAC[ MESON[] ` (a/\b)/\c <=> a/\ b /\ c `];; + +let NGOAC = REWRITE_TAC[ MESON[] ` a/\b/\c <=> (a/\b)/\c `];; + +let DAO = NGOAC THEN REWRITE_TAC[ MESON[]` a /\ b <=> b /\ a`];; + +let PHAT = REWRITE_TAC[ MESON[] ` (a\/b)\/c <=> a\/b\/c `];; + +let NGOACT = REWRITE_TAC[ GSYM (MESON[] ` (a\/b)\/c <=> a\/b\/c `)];; + +let KHANANG = PHA THEN REWRITE_TAC[ MESON[]` ( a\/ b ) /\ c <=> a /\ c \/ b /\ c `] THEN + REWRITE_TAC[ MESON[]` a /\ ( b \/ c ) <=> a /\ b \/ a /\ c `];; + +let ATTACH thm = MATCH_MP (MESON[]` ! a b. ( a ==> b ) ==> ( a <=> a /\ b )`) thm;; + +let CUTHE1 th = MATCH_MP (MESON[]` ( ! a. P a ) ==> P a `) th ;; + +let CUTHE2 th = MATCH_MP (MESON[]` ( ! a b. P a b ) ==> P a b`) th ;; + +let CUTHE3 th = MATCH_MP (MESON[]` ( ! a b c. P a b c ) ==> P a b c`) th ;; + +let CUTHE4 th = MATCH_MP (MESON[]` ( ! a b c d. P a b c d ) ==> P a b c d`) th ;; + +let CUTHE5 th = MATCH_MP (MESON[]` ( ! a b c d e. P a b c d e) ==> P a b c d e`) th ;; + +let CUTHE6 th = MATCH_MP (MESON[]` ( ! a b c d e f. P a b c d e f) ==> P a b c d e f`) th ;; + +let CUTHE7 th = MATCH_MP (MESON[]` ( ! a b c d e f h. P a b c d e f h) ==> P a b c d e f h`) th ;; + +let NHANH tm = ONCE_REWRITE_TAC[ ATTACH (tm)];; + + +let trg_sub_bo = prove ( `A SUBSET B <=> (!x. A x ==> B x)`, SET_TAC[] );; + +let trg_sub_se = prove ( `A SUBSET B <=> (!x. x IN A ==> x IN B )`, SET_TAC[] );; + +let trg_setbool = prove (`x IN A <=> A x `, SET_TAC[] );; + +let trg_boolset = prove (` A x <=> x IN A `, SET_TAC[] );; + +let trg_in_union = prove (` x IN ( A UNION B ) <=> x IN A \/ x IN B `, SET_TAC[]);; + +let not_in_set3 = prove ( `~ ( x IN { z | A z /\ B z /\ C z } ) <=> ~ A x \/ ~ B x \/ ~ C x `, + SET_TAC[]);; + +let trg_dist3_sym = prove ( `! x y. dist3 x y = dist3 y x `, SIMP_TAC[dist3; DIST_SYM]);; + +let affine_hull_e = prove (`affine hull {} = {}`, + REWRITE_TAC[AFFINE_EMPTY; AFFINE_HULL_EQ]);; + +let wlog = MESON[]` (! a b. ( P a b = P b a ) /\ ( Q a b \/ Q b a ) ) ==> ((? a b . P a b ) <=> ( ? a b. P a b + /\ Q a b ))`;; + +let wlog_real = MESON[REAL_ARITH `( ! a b:real. a <= b \/ b <= a )`] ` +(! a:real b:real . P a b = P b a ) ==> ((? a:real b . P a b ) <=> ( ? a b. P a b + /\ a <= b ))`;; + +let dkdx = MESON[REAL_ARITH ` ! a b:real. a <= b \/ b <= a `]`! P. (!a b u v m n p . P a b u v m n p <=> P b a v u m n p) + ==> ((?a b u v m n p. P a b u v m n p) <=> (?a b u v m n p. P a b u v m n p /\ a <= b))`;; + + +let AFFINE_HULL_SINGLE = prove(`!x. affine hull {x} = {x}`, + SIMP_TAC[AFFINE_SING; AFFINE_HULL_EQ]);; + +let usefull = MESON[] ` (!x. a x ==> b x ) ==>(?x. a x ) ==> c ==> d <=> + (!x. a x ==> b x) ==> (?x. a x /\ b x ) ==> c ==> d `;; + +let v1_in_convex3 = prove (` ! v1 v2 v3. v1 IN {t | ?a b c. + &0 <= a /\ &0 <= b /\ &0 <= c /\ a + b + c = &1 /\ + t = a % v1 + b % v2 + c % v3}`, REPEAT GEN_TAC THEN REWRITE_TAC[ IN_ELIM_THM] THEN +EXISTS_TAC ` &1 ` THEN EXISTS_TAC ` &0 ` THEN EXISTS_TAC ` &0 ` THEN +REWRITE_TAC[ VECTOR_ARITH ` &1 % v1 + &0 % v2 + &0 % v3 = v1 `] THEN REAL_ARITH_TAC);; + + +let v3_in_convex3 = prove( `! v1 v2 v3. v3 IN + {t | ?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + t = a % v1 + b % v2 + c % v3}`, REWRITE_TAC[IN_ELIM_THM] THEN REPEAT GEN_TAC +THEN REPLICATE_TAC 2 (EXISTS_TAC `&0`) THEN EXISTS_TAC ` &1` THEN REWRITE_TAC[VECTOR_MUL_LZERO; + VECTOR_ADD_LID; VECTOR_MUL_LID] THEN REAL_ARITH_TAC);; + + +let v1v2v3_in_convex3 = prove (` ! v1 v2 v3 . v1 IN {t | ?a b c. &0 <= a /\ &0 <= b /\ &0 <= c /\ +a + b + c = &1 /\ t = a % v1 + b % v2 + c % v3} + /\ v2 IN {t | ?a b c. &0 <= a /\ &0 <= b /\ &0 <= c /\ a + b + c = &1 /\ t = a % v1 + b % v2 + c % v3} + /\ v3 IN {t | ?a b c. &0 <= a /\ &0 <= b /\ &0 <= c /\ a + b + c = &1 /\ t = a % v1 + b % v2 + c % v3}`, +REWRITE_TAC[v1_in_convex3; v3_in_convex3] THEN REPEAT GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN +EXISTS_TAC ` &0` THEN EXISTS_TAC ` &1` THEN EXISTS_TAC ` &0` THEN +REWRITE_TAC[VECTOR_ARITH` v2 = &0 % v1 + &1 % v2 + &0 % v3`] THEN REAL_ARITH_TAC);; + + +let convex3 = prove( `!v1 v2 v3. + convex + {t | ?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + t = a % v1 + b % v2 + c % v3}`, +REWRITE_TAC[convex; IN_ELIM_THM] THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN +EXISTS_TAC ` u * a + v * a'` THEN +EXISTS_TAC ` u * b + v * b'` THEN +EXISTS_TAC ` u * c + v * c'` THEN +REPEAT (FIRST_X_ASSUM MP_TAC) THEN +REWRITE_TAC[MESON[] ` a==> b==> c <=> a /\ b==> c`] THEN PHA THEN +REWRITE_TAC[ MESON[]` &0 <= a /\ l <=> l /\ &0 <= a `] THEN PHA THEN +NHANH (MESON[REAL_LE_MUL; REAL_ARITH ` &0 <= a /\ &0 <= b ==> &0 <= a +b `]` &0 <= v /\ + &0 <= u /\ + &0 <= c' /\ + &0 <= b' /\ + &0 <= a' /\ + &0 <= c /\ + &0 <= b /\ + &0 <= a ==> &0 <= u * c + v * c' /\ + &0 <= u * b + v * b' /\ + &0 <= u * a + v * a'`) THEN +REWRITE_TAC[REAL_ARITH` ( a + y ) + ( b + x ) + c + z = ( a + b + c) + ( + y + x + z ) `] THEN +REWRITE_TAC[REAL_ARITH ` a * b + a * c = a * ( b + c) `] THEN +SIMP_TAC[] THEN +REWRITE_TAC[ REAL_ARITH ` a * &1 = a `] THEN SIMP_TAC[] THEN +REWRITE_TAC[VECTOR_ARITH` u % (a % v1 + b % v2 + c % v3) + v % (a' % v1 + b' % v2 + c' % v3) = + (u * a + v * a') % v1 + (u * b + v * b') % v2 + (u * c + v * c') % v3`]);; + +let INTERS_SUBSET = SET_RULE `! P t0. P t0 ==> INTERS { t| P t } SUBSET t0`;; + +let SET3_SUBSET = SET_RULE`! a b c. {a,b,c} SUBSET s <=> a IN s /\ b IN s /\ c IN s `;; + +let SUM_TWO_RATIO = REAL_FIELD ` ~(a + b = &0) <=> a / ( a + b) + b /(a+b) = &1`;; + +let minconvex3 = prove(`!t v1 v2 v3. + convex t /\ {v1, v2, v3} SUBSET t + ==> (!a b c. + &0 <= a /\ &0 <= b /\ &0 <= c /\ a + b + c = &1 + ==> a % v1 + b % v2 + c % v3 IN t)`, +REPEAT GEN_TAC THEN +REWRITE_TAC[convex; SET3_SUBSET] THEN +STRIP_TAC THEN +REPEAT GEN_TAC THEN +ONCE_REWRITE_TAC[ MESON[]` &0 <= a /\ &0 <= b /\ l<=> ( a + b = &0 \/ + ~( a + b = &0)) /\ &0 <= a /\ &0 <= b /\ l`] THEN +REWRITE_TAC[RIGHT_OR_DISTRIB] THEN +REWRITE_TAC[ MESON[]` a \/ b ==> c <=> ( a ==> c ) /\ ( b ==> c )`] THEN +REWRITE_TAC[REAL_ARITH` a + b = &0 /\ &0 <= a /\ &0 <= b /\ &0 <= c /\ a + b + c = &1 + <=> &0 = a /\ &0 = b /\ &1 = c `] THEN +ONCE_REWRITE_TAC[ EQ_SYM_EQ] THEN +SIMP_TAC[] THEN +ASM_REWRITE_TAC[ VECTOR_MUL_LZERO; VECTOR_MUL_LID; VECTOR_ADD_LID] THEN +REWRITE_TAC[MESON[]`&0 = a + b <=> a + b = &0`; SUM_TWO_RATIO] THEN +NHANH (MESON[REAL_ARITH ` &0 <= a /\ &0 <= b ==> &0 <= a + b `]` + dau /\ &0 <= a /\ &0 <= b /\ l ==> &0 <= a + b `) THEN +NHANH (MESON[REAL_LE_DIV]` (aa /\ &0 <= a /\ &0 <= b /\ bb) /\ &0 <= a + b + ==> &0 <= a / (a + b) /\ &0 <= b / (a + b)`) THEN +REWRITE_TAC[GSYM SUM_TWO_RATIO] THEN +PHA THEN +NHANH (MESON[REAL_DIV_LMUL]` ~(a + b = &0) ==> a = (a+b) *(a/(a+b)) /\ b = + (a+b) *(b/(a+b))`) THEN +REWRITE_TAC[MESON[VECTOR_MUL_RCANCEL]` ( dau /\ a = (a + b) * a / (a + b) /\ b = (a + b) * b / (a + b)) + /\ l ==> a % v1 + b % v2 + c % v3 IN t <=> + ( dau /\ a = (a + b) * a / (a + b) /\ b = (a + b) * b / (a + b)) + /\ l ==> ((a + b) * a / (a + b)) % v1 + ((a + b) * b / (a + b)) % v2 + c % v3 IN t`] THEN +REWRITE_TAC[ VECTOR_ARITH ` ((a + b) * a / (a + b)) % v1 + ((a + b) * b / (a + b)) % v2 + c % v3 + = (a + b) % ( (a / (a + b)) % v1 + (b / (a + b)) % v2) + c % v3 `] THEN +REWRITE_TAC[SUM_TWO_RATIO] THEN +ASM_MESON_TAC[ REAL_ARITH` a + b + c = (a + b ) + c`]);; + + +let EQ_EXPAND = MESON[] `(a <=> b) <=> ( a ==> b ) /\ ( b ==> a )` ;; + + + +let OTHER_CONVEX_CONDI = prove(` ! s. convex s <=> (! a b c v1 v2 v3. {v1, v2, v3} SUBSET s /\ + &0 <= a /\ &0 <= b /\ &0 <= c /\ a + b + c = &1 + ==> a % v1 + b % v2 + c % v3 IN s)`, +REWRITE_TAC[EQ_EXPAND; MESON[minconvex3]`!s. (convex s + ==> (!a b c v1 v2 v3. + {v1, v2, v3} SUBSET s /\ + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 + ==> a % v1 + b % v2 + c % v3 IN s))`; convex] THEN STRIP_TAC THEN +REWRITE_TAC[SET3_SUBSET] THEN DISCH_TAC THEN +REWRITE_TAC[REAL_ARITH`&0 <= u /\ &0 <= v /\ u + v = &1 <=> + &0 <= u /\ &0 <= v / &2 /\ u + v/ &2 + v / &2 = &1`] THEN +ONCE_REWRITE_TAC[MESON[REAL_ARITH` a = a / &2 + a / &2`]` u % x + v % y = + u % x + ( v/ &2 + v/ &2 ) % y `] THEN REWRITE_TAC[ VECTOR_ADD_RDISTRIB] THEN +ASM_MESON_TAC[]);; + + +(* ============== *) + + +let convex3_in_inters = prove (` ! v1 v2 v3. {t | ?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + t = a % v1 + b % v2 + c % v3} SUBSET + INTERS {t | convex t /\ {v1, v2, v3} SUBSET t} `, +REPEAT GEN_TAC THEN +MATCH_MP_TAC (SET_RULE ` ( ! x. x IN A ==> x IN B ) ==> A SUBSET B`) THEN +REWRITE_TAC[IN_ELIM_THM] THEN REWRITE_TAC[IN_INTERS] THEN +REWRITE_TAC[MESON[] `( !x. (?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + x = a % v1 + b % v2 + c % v3) + ==> (!t. convex t /\ {v1, v2, v3} SUBSET t ==> x IN t)) + <=>( !x. (?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + x = a % v1 + b % v2 + c % v3) + ==> (!t. convex t /\ {v1, v2, v3} SUBSET t /\ (?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + x = a % v1 + b % v2 + c % v3) ==> x IN t)) `] THEN +GEN_TAC THEN DISCH_TAC THEN GEN_TAC THEN FIRST_X_ASSUM MP_TAC THEN +REWRITE_TAC[ IN_ELIM_THM ; TAUT ` a ==> b ==> c <=> a /\ b ==> c `] THEN +MESON_TAC[minconvex3]);; + + +(* =========== *) + + + +let simpl_conv3 =prove(` ! v1 v2 v3. conv_trg {v1 , v2 ,v3} = {t | ?a b c. &0 <= a /\ &0 <= b /\ &0 <= c /\ a + b + c = &1 +/\ t = a % v1 + b % v2 + c % v3}`, REPEAT GEN_TAC THEN +REWRITE_TAC[conv; hull] THEN REPEAT GEN_TAC THEN +REWRITE_TAC[ SET_RULE` a = b <=> a SUBSET b /\ b SUBSET a `] THEN +REWRITE_TAC[conv_trg; hull] THEN +MATCH_MP_TAC (MATCH_MP ( MESON[] `(! a b. P a b) ==> P a b` ) (MESON[INTERS_SUBSET ]` + ! P t0 . ( P t0 /\ aa ) ==> INTERS {t | P t} SUBSET t0 /\ aa`)) THEN + REWRITE_TAC[convex3] THEN REWRITE_TAC[ SET_RULE `{v1 , v2, v3} SUBSET a <=> + v1 IN a /\ v2 IN a /\ v3 IN a`] THEN REWRITE_TAC [ v1v2v3_in_convex3] THEN +REWRITE_TAC[ SET_RULE` v1 IN t /\ v2 IN t /\ v3 IN t <=> {v1, v2, v3} SUBSET t`] THEN +REWRITE_TAC[convex3_in_inters]);; + + +(* =========== begining lemma 8.2 ========== *) + + +(* +let near2t0 = new_definition ` near2t0 v0 s = { x | x IN s /\ dist(v0,x) < &2 * t0 }`;; + +let e_plane = new_definition ` e_plane (a:real^N) (b:real^N) x = ( ~( a=b) /\ dist(a,x) = dist(b,x))`;; +*) + +let min_dist = new_definition ` min_dist (x:real^3) s = ((?u. u IN s /\ + (!w. w IN s /\ ~(u = w) ==> dist (u,x) < dist (w,x))) \/ + (?u v. + u IN s /\ + v IN s /\ + ~(u = v) /\ + dist (u,x) = dist (v,x) /\ + (!w. w IN s ==> dist (u,x) <= dist (w,x)))) `;; + +(* ========== simplize.ml ============ *) + +let SET3_SUBSET = SET_RULE`! a b c. {a,b,c} SUBSET s <=> a IN s /\ b IN s /\ c IN s `;; + +let FINITE6 = MESON[ FINITE_RULES ] `! a b c d e f. + FINITE {} /\ + FINITE {a} /\ + FINITE {a, b} /\ + FINITE {a, b, c} /\ + FINITE {a, b, c, d} /\ + FINITE {a, b, c, d, e} /\ + FINITE {a, b, c, d, e, f} `;; + +(* ========= new simplizing ========== *) + +let elimin = REWRITE_RULE[IN];; + +let CONV_EM = prove(`conv {} = {}:real^A->bool`, + REWRITE_TAC[conv;sgn_ge;affsign;UNION_EMPTY;FUN_EQ_THM;elimin +NOT_IN_EMPTY;lin_combo;SUM_CLAUSES] + THEN REAL_ARITH_TAC);; + +let CONV_SING = prove(`!u. conv {u:real^A} = {u}`, + REWRITE_TAC[conv;sgn_ge;affsign;FUN_EQ_THM;UNION_EMPTY;lin_combo;SUM_SING;VSUM_SING; + elimin IN_SING] THEN REPEAT GEN_TAC THEN + REWRITE_TAC[TAUT `(p <=> q) = ((p ==> q) /\ (q ==> p))`] THEN + REPEAT STRIP_TAC THENL [ASM_MESON_TAC[VECTOR_MUL_LID]; + ASM_REWRITE_TAC[]] THEN EXISTS_TAC `\ (v:real^A). &1` THEN + MESON_TAC[VECTOR_MUL_LID;REAL_ARITH `&0 <= &1`] );; + + +let NOV9 = prove(`!x y z.(x = y /\ y = z + ==> conv {y, z} = + {w | ?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + w = a % y + b % y + c % z})`, +SIMP_TAC[] THEN REWRITE_TAC[SET_RULE` {a,a} = {a}`] THEN +REWRITE_TAC[ CONV_SING; GSYM VECTOR_ADD_RDISTRIB] THEN +REWRITE_TAC[ MESON[]` a + b + c = &1 /\ w = (a + b + c) % z <=>a + b + c = &1 /\ + w = &1 % z `; VECTOR_MUL_LID] THEN REWRITE_TAC[ FUN_EQ_THM] THEN +REWRITE_TAC[ SET_RULE ` {a} x <=> a = x `; IN_ELIM_THM] THEN +REPEAT GEN_TAC THEN DISCH_TAC THEN GEN_TAC THEN +NGOAC THEN REWRITE_TAC[ LEFT_EXISTS_AND_THM] THEN +MATCH_MP_TAC (MESON[] ` a ==> ( z = x <=> a /\ x = z )`) THEN +REPLICATE_TAC 2 (EXISTS_TAC `&0`) THEN EXISTS_TAC ` &1` THEN REAL_ARITH_TAC);; + +let IN_ACT_SING = SET_RULE `! a x. ({a} x <=> a = x ) /\ ( x IN {a} <=> x = a) /\ {a} a`;; + +let NOV10 = prove(` ! x y. (x = y + ==> (!x. y = x <=> + (?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ x = a % y + b % y))) `, +REWRITE_TAC[GSYM VECTOR_ADD_RDISTRIB] THEN +REWRITE_TAC[ MESON[VECTOR_MUL_LID]` a + b = &1 /\ x = (a + b) % y <=> a + b = &1 /\ +x = y`]THEN REPEAT GEN_TAC THEN DISCH_TAC THEN GEN_TAC THEN NGOAC THEN +REWRITE_TAC[LEFT_EXISTS_AND_THM] THEN MATCH_MP_TAC (MESON[]` a ==> ( x = y <=> a /\ + y = x )`)THEN EXISTS_TAC `&0` THEN EXISTS_TAC ` &1` THEN REAL_ARITH_TAC);; + +let IN_SET2 = SET_RULE `!a b x. + (x IN {a, b} <=> x = a \/ x = b) /\ ({a, b} x <=> x = a \/ x = b)`;; + + +let VSUM_DIS2 = prove(` ! x y f. ~(x=y) ==> vsum {x,y} f = f x + f y`, REWRITE_TAC[ + SET_RULE ` ~( x = y) + <=> ~(x IN {y})`] THEN MESON_TAC[ FINITE_RULES; VSUM_CLAUSES; VSUM_SING]);; + +let SUM_DIS2 = prove(`! x y f. ~(x=y) ==> sum {x,y} f = f x + f y `,REWRITE_TAC[ + SET_RULE ` ~( x = y) + <=> ~(x IN {y})`] THEN MESON_TAC[ FINITE_RULES; SUM_CLAUSES; SUM_SING]);; + + +let TRUONG_LEMMA = prove + ( `!x y x':real^N. + (?f. x' = f x % x + f y % y /\ (&0 <= f x /\ &0 <= f y) /\ + f x + f y = &1) <=> + (?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ x' = a % x + b % y)` , + REPEAT GEN_TAC THEN EQ_TAC +THENL [MESON_TAC[]; STRIP_TAC] THEN + ASM_CASES_TAC `y:real^N = x` THENL + [EXISTS_TAC `\x:real^N. &1 / &2`; + EXISTS_TAC `\u:real^N. if u = x then (a:real) else b`] THEN + ASM_REWRITE_TAC[GSYM VECTOR_ADD_RDISTRIB] THEN + CONV_TAC REAL_RAT_REDUCE_CONV);; + + +let NOV11 = prove(`! z. {z} = + {w | ?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + w = a % z + b % z + c % z}`, +REWRITE_TAC[ FUN_EQ_THM; IN_ACT_SING; IN_ELIM_THM] THEN +REWRITE_TAC[GSYM VECTOR_ADD_RDISTRIB] THEN +REWRITE_TAC[ MESON[VECTOR_MUL_LID]`a + b + c = &1 /\ + x = (a + b + c) % z <=> a + b + c = &1 /\ x = z`] THEN +NGOAC THEN MATCH_MP_TAC (MESON[]` (? a b c. P a b c) ==> (! z x. z = x <=> + (? a b c. P a b c /\ x = z))`) THEN +REPLICATE_TAC 2 (EXISTS_TAC `&0`) THEN +EXISTS_TAC `&1` THEN REAL_ARITH_TAC);; + + + +let CONV2_CONV3 = prove(` !x' y z. + (?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ x' = a % y + b % z) + ==> (?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + x' = a % y + b % y + c % z)`, +REPEAT GEN_TAC THEN REWRITE_TAC[ VECTOR_ARITH` a % y + b % y + c % z = (a+b) %y + c%z`] THEN STRIP_TAC THEN +REPLICATE_TAC 2 (EXISTS_TAC `a/ &2`) THEN +EXISTS_TAC `b:real` THEN +REWRITE_TAC[ REAL_ARITH` a / &2 + a / &2 = a /\ a / &2 + a / &2 + b = a + b `] THEN +ASM_SIMP_TAC[] THEN +ASM_REAL_ARITH_TAC);; + + +let CONV3_CONV2 = prove(`! x' y z. (?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + x' = a % y + b % y + c % z) + ==> (?a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ x' = a % y + b % z)`, +REPEAT GEN_TAC THEN STRIP_TAC THEN EXISTS_TAC ` a + b:real` THEN +EXISTS_TAC `c:real` THEN +REWRITE_TAC[VECTOR_ADD_RDISTRIB] THEN +REWRITE_TAC[VECTOR_ARITH` (a % y + b % y) + c % z = a % y + b % y + c % z `] THEN +ASM_SIMP_TAC[REAL_ARITH ` a + b + c = (a + b) + c`] THEN +ASM_REAL_ARITH_TAC);; + +let CONV_SET2 = prove(` ! x y:real^A. conv {x,y} = {w | ? a b. &0 <= a /\ &0 <= b /\ a + b = &1 /\ + w = a%x + b%y}`, +ONCE_REWRITE_TAC[ MESON[] ` (! a b. P a b ) <=> ( ! a b. a = b \/ ~( a= b) + ==> P a b )`] THEN +REWRITE_TAC[ MESON[]` a \/ b ==> c <=> ( a==> c) /\ ( b==> c)`] THEN +SIMP_TAC[] THEN +REWRITE_TAC[ SET_RULE ` {a,a} = {a}`; CONV_SING; FUN_EQ_THM; IN_ELIM_THM] THEN +REWRITE_TAC[ IN_ACT_SING] THEN +REWRITE_TAC[NOV10] THEN +REWRITE_TAC[conv; sgn_ge; affsign; lin_combo] THEN +REWRITE_TAC[UNION_EMPTY; IN_SET2] THEN +ONCE_REWRITE_TAC[ MESON[]` ~(x = y) ==> (!x'. (?f. P f x') <=> l x') <=> + ~(x = y) ==> (!x'. (?f. ~(x=y) /\ P f x') <=> l x')`] THEN +REWRITE_TAC[ MESON[VSUM_DIS2; SUM_DIS2]` ~(x = y) /\ + x' = vsum {x, y} ff /\ l /\ sum {x, y} f = &1 <=> ~(x = y) /\ + x' = ff x + ff y /\ l /\ f x + f y = &1 `] THEN +REWRITE_TAC[ MESON[]` (!w. w = x \/ w = y ==> &0 <= f w) <=> &0 <= f x /\ &0 <= f y`] THEN +ONCE_REWRITE_TAC[ GSYM (MESON[]` ~(x = y) ==> (!x'. (?f. P f x') <=> l x') <=> + ~(x = y) ==> (!x'. (?f. ~(x=y) /\ P f x') <=> l x')`)] THEN +REPEAT GEN_TAC THEN DISCH_TAC THEN GEN_TAC THEN +REWRITE_TAC[ TRUONG_LEMMA]);; + +let CONV3_A_EQ = prove(`! x y z. (x = y \/ y = z \/ z = x + ==> conv {x, y, z} = + {w | ?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + w = a % x + b % y + c % z})`, +MATCH_MP_TAC (MESON[] `(! a b c. P a b c <=> P b a c) /\ (! a b c. a = b \/ b = c ==> P a b c) + ==> (! a b c. a = b \/ b = c \/ c = a ==> P a b c )`) THEN +SIMP_TAC[ MESON[ SET_RULE ` {a,b,c} = {b,a,c} `]`conv {x, y, z} = conv {y,x,z}`] THEN +SIMP_TAC[ MESON[ REAL_ARITH` a + b + c = b + a + c`; VECTOR_ARITH` a % x + b % y + c % z + = b % y + a % x + c % z `]` (?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + w = a % x + b % y + c % z) + <=> (?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + w = a % y + b % x + c % z)`] THEN +MATCH_MP_TAC (MESON[]` (! a b c. P a b c <=> P c b a ) /\ (! a b c. a = b ==> P a b c) + ==> (! a b c. a = b \/ b = c ==> P a b c)`) THEN +SIMP_TAC[ MESON[SET_RULE `{a,b,c} ={c,b,a} `]` conv {a,b,c} = conv {c,b,a}`] THEN +SIMP_TAC[ MESON[REAL_ARITH` a + b + c = c + b + a`; VECTOR_ARITH` a % x + b % y + c % z + = c % z + b % y + a % x `]`(?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + w = a % x + b % y + c % z) <=> + (?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + w = a % z + b % y + c % x)`] THEN +REWRITE_TAC[ SET_RULE`{a,a,b} = {a,b}`] THEN +ONCE_REWRITE_TAC[ MESON[]` x = y ==> conv {y,z} = s <=> x = y /\( y = z \/ + ~(y=z))==> conv {y,z} = s `] THEN +KHANANG THEN REWRITE_TAC[ MESON[]` a \/ b ==> c <=> (a==> c) /\ (b==> c)`] THEN +SIMP_TAC[] THEN REWRITE_TAC[SET_RULE`{a,a} ={a}`; CONV_SING] THEN +SIMP_TAC[NOV11] THEN REWRITE_TAC [ GSYM NOV11] THEN +REWRITE_TAC[CONV_SET2] THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN + REWRITE_TAC[ FUN_EQ_THM; IN_ELIM_THM] THEN +GEN_TAC THEN REWRITE_TAC[MESON[]` (a <=> b ) <=> ( a ==> b) /\ (b==> a)`] THEN +REWRITE_TAC[CONV2_CONV3; CONV3_CONV2]);; + + +let VSUM_DIS3 = prove( `! x y z f. ~(x=y\/y=z\/z=x) ==> vsum {x,y,z} f = f x + f y + f z `, +NHANH (SET_RULE` ~(x = y \/ y = z \/ z = x) ==> ({x} INTER {y,z} = {}) `) THEN +REWRITE_TAC[ GSYM DISJOINT; SET_RULE `{x, y, z} = {x} UNION {y,z}` ] THEN +REWRITE_TAC[MESON[FINITE6; VSUM_UNION]` aa /\ DISJOINT {x} {y, z} + ==> vsum ({x} UNION {y, z}) f = ab <=> aa /\ DISJOINT {x} {y, z} ==> + vsum {x} f + vsum {y,z} f = ab `] THEN + MESON_TAC[VSUM_SING; VSUM_DIS2]);; + + +let SUM_DIS3 = prove(` ! x y z f. ~(x = y \/ y = z \/ z = x) ==> sum {x, y, z} f = + f x + f y + f z `, +NHANH (SET_RULE` ~(x = y \/ y = z \/ z = x) ==> ({x} INTER {y,z} = {}) `) THEN +REWRITE_TAC[ GSYM DISJOINT; SET_RULE `{x, y, z} = {x} UNION {y,z}` ] THEN +REWRITE_TAC[MESON[FINITE6; SUM_UNION]` aa /\ DISJOINT {x} {y, z} + ==> sum ({x} UNION {y, z}) f = ab <=> aa /\ DISJOINT {x} {y, z} ==> + sum {x} f + sum {y,z} f = ab `] THEN MESON_TAC[ SUM_SING; SUM_DIS2]);; + +let EQ_EXPAND = MESON[] `(a <=> b) <=> ( a ==> b ) /\ ( b ==> a )` ;; + +let CONV_SET3 = prove(`! x y z:real^A. conv {x,y,z} = { w | ? a b c. &0 <= a /\ &0 <= b /\ &0 <= c /\ +a + b + c = &1 /\ w = a % x + b % y + c % z } `, +REPEAT GEN_TAC THEN +ONCE_REWRITE_TAC[ MESON[]` conv {x,y,z} = s <=> (x = y \/ y= z \/ z = x ) \/ + ~(x = y \/ y= z \/ z = x ) ==> conv {x,y,z} = s`] THEN +ONCE_REWRITE_TAC[ MESON[]` a \/ b ==> c <=> ( a ==> c ) /\(b==>c)`] THEN +REWRITE_TAC[CONV3_A_EQ] THEN +REWRITE_TAC[conv; FUN_EQ_THM; affsign; IN_ELIM_THM; sgn_ge; lin_combo; UNION_EMPTY] THEN +DISCH_TAC THEN GEN_TAC THEN FIRST_X_ASSUM MP_TAC THEN +ONCE_REWRITE_TAC[ MESON[]` a ==> ((?f. P f ) <=> la ) <=> + a ==> ((?f. a /\ P f ) <=> la ) `] THEN REWRITE_TAC[MESON[VSUM_DIS3]` ~(x = y \/ +y = z \/ z = x) /\ x' = vsum {x, y, z} f /\ l <=> ~(x = y \/ y = z \/ z = x) /\ +x' = f x + f y + f z /\ l `] THEN +REWRITE_TAC[ MESON[SUM_DIS3]` ~(x = y \/ y = z \/ z = x) /\ P /\ Q /\ sum {x,y,z} f = &1 + <=> ~(x = y \/ y = z \/ z = x) /\ P /\ Q /\ ( f x + f y + f z ) = &1`] THEN +REWRITE_TAC[SET_RULE ` (!w. {x, y, z} w ==> &0 <= f w) <=> &0 <= f x /\ + &0 <= f y /\ &0 <= f z `] THEN +ONCE_REWRITE_TAC[ GSYM (MESON[]` a ==> ((?f. P f ) <=> la ) <=> + a ==> ((?f. a /\ P f ) <=> la ) `)] THEN DISCH_TAC THEN +REWRITE_TAC[ EQ_EXPAND] THEN +REWRITE_TAC[ MESON[]` (?f. x' = f x % x + f y % y + f z % z /\ + (&0 <= f x /\ &0 <= f y /\ &0 <= f z) /\ + f x + f y + f z = &1) + ==> (?a b c. + &0 <= a /\ + &0 <= b /\ + &0 <= c /\ + a + b + c = &1 /\ + x' = a % x + b % y + c % z)`] THEN STRIP_TAC THEN +EXISTS_TAC ` (\d. if d = (x:real^A) then (a:real) else ( if d = (y:real^A) then + (b:real) else c ))` THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN +REWRITE_TAC[ MESON[]`~( a \/ b ) <=> ~a /\ ~b `] THEN SIMP_TAC[]);; + +(* ========== *) +let CONV3_EQ = prove(` ! x y z. conv_trg {x,y,z} = conv {x,y,z} `, REWRITE_TAC[simpl_conv3; +CONV_SET3]);; +(* ========= *) + +(* ==== CARD ASSERTION ==== *) + + +let CARD_CLAUSES_IMP = prove(` !a s. + FINITE s + ==> CARD (a INSERT s) <= SUC (CARD s) /\ + (a IN s ==> CARD (a INSERT s) = CARD s) /\ + (~(a IN s) ==> CARD (a INSERT s) = SUC (CARD s))`, +ONCE_REWRITE_TAC[ MESON[] ` ( a ==> b /\ c ) <=> ( a ==> b ) /\ ( a ==> c )`] THEN +REWRITE_TAC[ MESON[CARD_CLAUSES] ` FINITE s ==> ( a IN s ==> CARD (a INSERT s) = CARD s ) /\ + (~(a IN s) ==> CARD (a INSERT s) = SUC (CARD s))`] THEN +MESON_TAC[ CARD_CLAUSES; ARITH_RULE ` a <= SUC a /\ a <= a `]);; + +(* =================== *) + +let CARD_SING = prove( `! a: A. CARD {a} = 1`, REWRITE_TAC[ MESON[ FINITE6; CARD_EQ_NSUM ] +` CARD {a} = nsum {a} (\x. 1)`] THEN REWRITE_TAC[ NSUM_SING ]);; + +let CARD_SET2 = prove( ` ! a b . ( CARD {a, b} = 2 <=> ~(a = b)) /\ (CARD {a, b} = 1 <=> a = b ) `, +REWRITE_TAC[ MESON[ FINITE6; CARD_CLAUSES ] ` CARD {a,b} = (if a IN {b} then CARD {b} else SUC (CARD {b}))`] +THEN REWRITE_TAC[ MESON[ FINITE6; CARD_CLAUSES ] ` CARD {a} = (if a IN {} then CARD {} else SUC (CARD {}))`] +THEN REWRITE_TAC[ NOT_IN_EMPTY; IN_SING; CARD_CLAUSES; ADD1] THEN +MESON_TAC[ ARITH_RULE ` ~( 0+ 1 = 2 ) /\ (0 + 1) + 1 = 2 /\ ~((0 + 1) + 1 = 1 ) /\ 0 + 1 = 1 `]);; + +(* ============== *) + +let CARD_EQUATION = prove(`!(s: A -> bool) t. + FINITE s /\ FINITE t + ==> CARD (s UNION t) + CARD (s INTER t) = CARD s + CARD t `, +NHANH (MESON[FINITE_INTER; FINITE_UNION] `FINITE s /\ FINITE t ==> FINITE ( s UNION t ) /\ + FINITE ( s INTER t ) `) THEN MESON_TAC[ CARD_EQ_NSUM; NSUM_INCL_EXCL]);; + + +let CARD_DISJOINT = prove(` ! s: A -> bool t. FINITE s /\ FINITE t ==> + ( CARD s + CARD t = CARD ( s UNION t ) <=> s INTER t ={} )`, +MESON_TAC[CARD_EQUATION; ARITH_RULE ` a + b = a <=> b = 0 `; FINITE_INTER; CARD_EQ_0]);; + + +let CARD2 = prove(` ! a b . CARD {a,b} <= 2 /\ ( CARD {a,b} = 2 <=> ~(a = b ) )`, +REWRITE_TAC[ MESON[ CARD_SET2] ` CARD {a, b} = 2 <=> ~(a = b)`] THEN MP_TAC CARD_SET2 THEN +ONCE_REWRITE_TAC[ MESON[] ` CARD {a, b} <= 2 <=> + ( a = b \/ ~( a = b)) /\ CARD {a, b} <= 2`] THEN KHANANG THEN +REWRITE_TAC[ MESON[CARD_SET2] `a = b /\ CARD {a, b} <= 2 \/ ~(a = b) /\ CARD {a, b} <= 2 + <=> a = b /\ 1 <= 2 \/ ~(a = b) /\ 2 <= 2`] THEN +MESON_TAC[ARITH_RULE ` 1 <= 2 /\ 2 <= 2 `]);; + + +let CARD3 = prove(`! a b c . CARD {a,b,c} <= 3 /\ + ( CARD {a,b,c} = 3 <=> ~( a =b \/ b= c\/ c= a ))`, +REWRITE_TAC[ SET_RULE ` {a,b,c} = {a} UNION {b,c}`] THEN +REWRITE_TAC[ ARITH_RULE ` CARD ({a} UNION {b, c}) <= 3 <=> + CARD ({a} UNION {b, c}) + CARD ({a} INTER {b, c}) <= 3 + CARD ({a} INTER {b, c})`] THEN +REWRITE_TAC[ ARITH_RULE ` CARD ({a} UNION {b, c}) = 3 <=> + CARD ({a} UNION {b, c}) + CARD ({a} INTER {b, c}) = 3 + CARD ({a} INTER {b, c})`] THEN +REWRITE_TAC[ MESON[ FINITE_RULES; CARD_EQUATION] ` CARD ({a} UNION {b, c}) + CARD ({a} INTER {b, c}) + = CARD {a} + CARD {b,c} `] THEN REWRITE_TAC[ CARD_SING] THEN +REWRITE_TAC[ ARITH_RULE `! a b. (1 + a <= 3 + b <=> a <= 2 + b ) /\ + (1 + a = 3 + b <=> a = 2 + b )`] THEN +REWRITE_TAC[ MESON[CARD2; ARITH_RULE ` a <= b ==> a <= b + c: num`] ` CARD {b, c} <= 2 + CARD ({a} INTER {b, c})`] THEN +ONCE_REWRITE_TAC[ MESON[CARD2]` CARD {b, c} = P b c <=> CARD {b, c} <= 2 /\ CARD {b, c} = P b c`] THEN +REWRITE_TAC[ ARITH_RULE ` a <= 2 /\ a = 2 + b <=> a = 2 /\ b = 0`] THEN +REWRITE_TAC[ MESON[FINITE_RULES; CARD2; FINITE_INTER; CARD_EQ_0] ` CARD {b, c} = 2 /\ CARD ({a} INTER {b, c}) = 0 + <=> ~(b=c) /\ {a} INTER {b, c} = {}`] THEN SET_TAC[]);; + +(* ========= *) + + +let CARD4 = prove(`!a b c d. + CARD {a, b, c, d} <= 4 /\ + (CARD {a, b, c, d} = 4 <=> + ~(a IN {b, c, d}) /\ ~(b = c \/ c = d \/ d = b))`, +NHANH (MESON[FINITE6; CARD_CLAUSES_IMP]` CARD {a, b, c, d} <= 4 ==> CARD {a, b, c, d} + <= SUC (CARD {b,c,d})`) THEN +NHANH ( MESON[CARD3] ` aa <= SUC (CARD {b, c, d}) ==> CARD {b,c,d} <= 3 `) THEN +REWRITE_TAC[ ARITH_RULE ` CARD {a, b, c, d} <= 4 /\ + CARD {a, b, c, d} <= SUC (CARD {b, c, d}) /\ + CARD {b, c, d} <= 3 <=> + CARD {a, b, c, d} <= SUC (CARD {b, c, d}) /\ CARD {b, c, d} <= 3`] THEN +SIMP_TAC[MESON[FINITE_RULES; CARD_CLAUSES_IMP] ` CARD {a, b, c, d} <= SUC + (CARD {b, c, d})`; CARD3; CARD_CLAUSES_IMP] THEN +REWRITE_TAC[ ARITH_RULE ` CARD {a, b, c, d} = 4 <=> CARD {a, b, c, d} + CARD ( {a} + INTER {b,c,d} ) = 4 + CARD ({a} INTER {b,c,d})`] THEN +REWRITE_TAC[ SET_RULE ` {a,b,c,d} = {a} UNION {b,c,d} ` ] THEN +REWRITE_TAC[ MESON[FINITE_RULES; CARD_EQUATION; CARD_SING] ` CARD ({a} UNION {b, c, d}) + CARD ({a} INTER {b, c, d}) + = 1 + CARD {b,c,d} `] THEN +NHANH (MESON[CARD3] ` 1 + CARD {b, c, d} = aa ==> CARD {b,c,d} <= 3 `) THEN +REWRITE_TAC[ ARITH_RULE `1 + CARD {b, c, d} = 4 + CARD ({a} INTER {b, c, d}) /\ + CARD {b, c, d} <= 3 <=> + CARD {b, c, d} = 3 /\ CARD ({a} INTER {b, c, d}) = 0`] THEN +REWRITE_TAC[ CARD3] THEN +MESON_TAC[ FINITE_RULES; FINITE_INTER; CARD_EQ_0; SET_RULE ` + {a} INTER {b, c, d} = {} <=> ~(a IN {b, c, d})` ]);; + + +let CARD5 = prove(` ! a b c d e. CARD {a,b,c,d,e} <= 5 /\ + ( CARD {a,b,c,d,e} = 5 <=> ~( a IN {b,c,d,e}) /\ + ~(b IN {c, d, e}) /\ ~(c = d \/ d = e \/ e = c))`, +ONCE_REWRITE_TAC[ MESON[ FINITE_RULES; CARD_CLAUSES_IMP] ` CARD {a, b, c, d, e} <= 5 <=> + CARD {a, b, c, d, e} <= SUC ( CARD {b,c,d,e} ) ==> CARD {a, b, c, d, e} <= 5`] THEN +ONCE_REWRITE_TAC[ MESON[CARD4] ` aa ==> CARD {a, b, c, d, e} <= 5 <=> + aa /\ CARD {b,c,d,e} <= 4 ==> CARD {a, b, c, d, e} <= 5`] THEN +REWRITE_TAC[ ARITH_RULE ` a <= SUC b /\ b <= 4 ==> a <= 5 `] THEN +REWRITE_TAC[ ARITH_RULE ` CARD {a, b, c, d, e} = 5 <=> + CARD {a, b, c, d, e} + CARD ({a} INTER {b,c,d,e} ) = 5 + CARD ({a} INTER {b,c,d,e} )`] THEN +REWRITE_TAC[ SET_RULE ` {a,b,c,d,e} = {a} UNION {b,c,d,e} `] THEN +REWRITE_TAC[ MESON[FINITE_RULES; CARD_EQUATION; CARD_SING ]` CARD ({a} UNION {b, c, d, e}) + + CARD ({a} INTER {b, c, d, e}) = 1 + CARD {b,c,d,e} `] THEN +ONCE_REWRITE_TAC[ MESON[ CARD4] ` 1 + CARD {b, c, d, e} = aa <=> CARD {b,c,d,e} <= 4 /\ + 1 + CARD {b, c, d, e} = aa `] THEN +REWRITE_TAC[ ARITH_RULE ` a <= 4 /\ 1 + a = 5 + b <=> a = 4 /\ b = 0`] THEN +REWRITE_TAC[ CARD4; MESON[FINITE_RULES; FINITE_INTER; CARD_EQ_0] ` + CARD ({a} INTER {b, c, d, e}) = 0 <=> {a} INTER {b, c, d, e} ={} `] THEN SET_TAC[]);; +(* ============ *) + +let set_3elements = prove(`(?a b c. ~(a = b \/ b = c \/ c = a) /\ {a, b, c} = {v1, v2, v3}) <=> + ~(v1 = v2 \/ v2 = v3 \/ v3 = v1)`, REWRITE_TAC[GSYM CARD3] THEN +MESON_TAC[]);; + + +(* +let db_t0 = prove(`&2 * t0 = &2 * #1.255 /\ &2 * t0 = #2.51 /\ &2 * #1.255 = #2.51`, + REWRITE_TAC[t0] THEN REAL_ARITH_TAC);; +*) + +let without_lost = MESON[] ` ! P x. (!a b. P a b <=> P b a) /\ (?a b. P a b /\ x = a) + ==> (?a b. P a b /\ (x = a \/ x = b))`;; + +let condi_of_wlofg = MESON[]` (!a b. P a b <=> P b a) + ==> ((?a b. P a b /\ (x = a \/ x = b)) <=> (?a b. P a b /\ x = a))`;; + +(* ============ *) + let CARD_SET_OF_LIST_LE = prove + (`!l. CARD(set_of_list l) <= LENGTH l`, + LIST_INDUCT_TAC THEN + SIMP_TAC[LENGTH; set_of_list; CARD_CLAUSES; FINITE_SET_OF_LIST] THEN + ASM_ARITH_TAC);; + + let HAS_SIZE_SET_OF_LIST = prove + (`!l. (set_of_list l) HAS_SIZE (LENGTH l) <=> PAIRWISE (\x y. ~(x = y)) l`, + REWRITE_TAC[HAS_SIZE; FINITE_SET_OF_LIST] THEN LIST_INDUCT_TAC THEN + ASM_SIMP_TAC[CARD_CLAUSES; LENGTH; set_of_list; PAIRWISE; ALL; + FINITE_SET_OF_LIST; GSYM ALL_MEM; IN_SET_OF_LIST] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[SUC_INJ] THEN + ASM_MESON_TAC[CARD_SET_OF_LIST_LE; ARITH_RULE `~(SUC n <= n)`]);; + +(* ====================In your theorem we want the n=4 case, so we instantiate it: +=========================== *) + + let HAS_SIZE_SET_OF_LIST_4 = prove + (`!a b c d:A. {a,b,c,d} HAS_SIZE 4 <=> PAIRWISE (\x y. ~(x = y)) [a;b;c;d]`, + REPEAT GEN_TAC THEN MP_TAC(ISPEC `[a;b;c;d]:A list`HAS_SIZE_SET_OF_LIST) THEN + REWRITE_TAC[LENGTH; set_of_list; ARITH]) ;; + +(* ============================================================================ + Then finally, using this and a bit of straightforward rearrangement, +we can collapse the desired theorem to a lemma that MESON can prove +automatically: +===============================================================================*) + + let SET_OF_4 = prove + (`! a b c d. ( ? v1 v2 v3 v4:A. ~( v1 = v2 \/ v3 = v4 ) /\ + {v1, v2 } INTER {v3, v4 } = {} /\ + { a , b , c , d } = { v1 , v2, v3 ,v4}) <=> + ~ ( a = b \/ a = c \/ a = d \/ b = c \/ b = d \/ c = d )`, + REPEAT GEN_TAC THEN + REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; INTER_EMPTY; SET_RULE + `(a INSERT s) INTER t = {} <=> ~(a IN t) /\ s INTER t = {}`] THEN + MP_TAC(MESON[] + `(?v1 v2 v3 v4:A. {a,b,c,d} = {v1,v2,v3,v4} /\ {v1,v2,v3,v4} HAS_SIZE 4) <=> + {a,b,c,d} HAS_SIZE 4`) THEN + REWRITE_TAC[HAS_SIZE_SET_OF_LIST_4; PAIRWISE; ALL; DE_MORGAN_THM; CONJ_ACI]);; + + +let def_simplex = prove(`! s a b c d. geomdetail'simplex {a, b, c, d} s <=> + packing s /\ + {a, b, c, d} SUBSET s /\ + ~ ( a = b \/ a = c \/ a = d \/ b = c \/ b = d \/ c = d ) `, REWRITE_TAC[ simplex] +THEN REPEAT GEN_TAC THEN MATCH_MP_TAC (MESON[] ` ( x <=> y ) ==> ( a /\ b /\ x <=> +a /\ b /\ y ) `) THEN ONCE_REWRITE_TAC[MESON[]` {v1, v2, v3, v4} = {a, b, c, d} <=> + {a, b, c, d} = {v1, v2, v3, v4} ` ] THEN REWRITE_TAC[ SET_OF_4]);; + + +(* =========== *) + +let PAIR_D3 = prove(` ! i j u w. {u,w} = {i,j} ==> dist3 i j = dist3 u w `, +REWRITE_TAC[ SET_RULE ` {u, w} = {i, j} <=> u= i /\ w = j \/ u = j /\ w = i `] THEN +MESON_TAC[ trg_dist3_sym]);; + +let PAIR_DIST = prove(` ! i j u w. {u,w} = {i,j} ==> dist(i,j) = dist(u,w) `, +REWRITE_TAC[ SET_RULE ` {u, w} = {i, j} <=> u= i /\ w = j \/ u = j /\ w = i `] THEN +MESON_TAC[ DIST_SYM]);; + +(* ================== *) + +let DOT_SUB_ADD = VECTOR_ARITH `! a b. b dot b - a dot a = (b - a) dot (b + a)` ;; + +let DIST_LT_HALF_PLANE = prove(`!x:real^A a:real^A b:real^A. + dist(x,a) < dist(x,b) <=> &0 < (a - b) dot (&2 % x - (a + b))`, +ABBREV_TAC ` an a b x = ((a:real^A) - b) dot (&2 % x - (a + b))` THEN +REWRITE_TAC[dist; vector_norm] THEN +REWRITE_TAC[MESON[DOT_POS_LE; SQRT_MONO_LT_EQ]` sqrt ( x dot x) < sqrt (y dot y) <=> + x dot x < y dot y `] THEN +REWRITE_TAC[DOT_LSUB; DOT_RSUB] THEN +SIMP_TAC[DOT_SYM] THEN +ONCE_REWRITE_TAC[ GSYM REAL_SUB_LT] THEN +REWRITE_TAC[ REAL_ARITH ` x dot x - + b dot x - + (b dot x - b dot b) - + (x dot x - a dot x - (a dot x - a dot a)) = + &2 * (a dot x - b dot x) + b dot b - a dot a`] THEN +REWRITE_TAC[GSYM DOT_LSUB; GSYM DOT_RMUL] THEN +REWRITE_TAC[DOT_SUB_ADD; VECTOR_ARITH `(b - a) dot (b + a) = + ( -- ( a - b) ) dot ( a + b) `] THEN +REWRITE_TAC[VECTOR_ARITH ` (a - b) dot &2 % x + --(a - b) dot (a + b) = + (a-b) dot ( &2 % x - (a+b))`] THEN +ASM_REWRITE_TAC[REAL_ARITH ` a - &0 = a` ]);; + +let OR_IMP_EX = MESON[]` ! a b c. a \/ b ==> c <=> (a ==> c) /\ ( b ==> c)` ;; + +let HALF_PLANE_CONV = prove(`! a b:real^N. convex { x| x | dist(x,a) < dist (x,b) }`, +REWRITE_TAC[DIST_LT_HALF_PLANE; convex; IN_ELIM_THM] THEN +REWRITE_TAC[VECTOR_ARITH ` &2 % (u % x + v % y) - (a + b) + = u % ( &2 % x ) + v % ( &2 % y ) - &1 % (a + b )`] THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN SIMP_TAC[] THEN +REWRITE_TAC[VECTOR_ARITH ` (a - b) dot (u % &2 % x + + v % &2 % y - (u + v) % (a + b)) = u * (a - b) dot (&2 % x - (a + b)) + + v * (a - b) dot (&2 % y - (a + b))`] THEN +REWRITE_TAC[REAL_ARITH` &0 <= u /\ &0 <= v /\ &1 = u + v <=> + &0 = u /\ &1 = v \/ &0 < u /\ &0 <= v /\ &1 = u + v`] THEN +KHANANG THEN +REWRITE_TAC[OR_IMP_EX] THEN +ONCE_REWRITE_TAC[ EQ_SYM_EQ] THEN SIMP_TAC[] THEN +REWRITE_TAC[REAL_POLY_CLAUSES] THEN +SIMP_TAC[ REAL_ARITH ` a + &0 = a `] THEN +NHANH (MESON[REAL_LT_MUL]` &0 < (a - b) dot (&2 % x - (a + b)) /\ + &0 < (a - b) dot (&2 % y - (a + b)) /\ + &0 < u /\ l ==> &0 < u * ((a - b) dot (&2 % x - (a + b)))`) THEN +NHANH (MESON[REAL_ARITH` &0 < a ==> &0 <= a `; REAL_LE_MUL]` + &0 < (a - b) dot (&2 % y - (a + b)) /\ + &0 < u /\ + &0 <= v /\ l ==> &0 <= v * ((a - b) dot (&2 % y - (a + b)))`) + THEN REAL_ARITH_TAC);; + +let HALF_PLANE_CONV_EP = REWRITE_RULE[convex; IN_ELIM_THM] HALF_PLANE_CONV;; + +let VORONOI_CONV = prove( ` ! (s:real^A -> bool) v. convex (voronoi_open s v)`, +REWRITE_TAC[voronoi_open] THEN REPEAT GEN_TAC THEN +REWRITE_TAC[convex; IN_ELIM_THM] THEN MESON_TAC[HALF_PLANE_CONV_EP]);; + +let CONVEX_IM_CONV2_SU = prove(`! s u v. convex s /\ u IN s /\ v IN s ==> conv {u,v} SUBSET s `, +REWRITE_TAC[convex; CONV_SET2] THEN SET_TAC[]);; + +(* have not added *) + +let U_IN_CONV2 = prove(`! u v. u IN conv {u,v} `, +REWRITE_TAC[ CONV_SET2; IN_ELIM_THM] THEN REPEAT GEN_TAC +THEN EXISTS_TAC `&1` THEN EXISTS_TAC `&0 ` THEN +REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO; VECTOR_ADD_RID] THEN +REAL_ARITH_TAC);; + +let UV_IN_CONV2 = prove(` ! u v. u IN conv {u,v} /\ v IN conv {u,v} `, +MESON_TAC[U_IN_CONV2; SET_RULE ` {u,v} = {v,u} `]);; + +let CONVEX_AS_CONV2 = prove(` ! s. convex s ==> ( ! u v. u IN s /\ v IN s <=> + conv {u,v} SUBSET s )`, REWRITE_TAC[ EQ_EXPAND] THEN +SIMP_TAC[CONVEX_IM_CONV2_SU ] THEN MESON_TAC[SUBSET; UV_IN_CONV2]);; + +let CONV0_SING = prove(`! x:real^A . conv0 {x} = {x} `, +REWRITE_TAC[conv0; FUN_EQ_THM; affsign; lin_combo] THEN +REWRITE_TAC[UNION_EMPTY; VSUM_SING; SUM_SING; IN_ACT_SING; sgn_gt] THEN +REWRITE_TAC[MESON[REAL_ARITH` &0 < &1 `]` (!w. x = w ==> &0 < f w) /\ + f x = &1 <=> f x = &1 `] THEN +REWRITE_TAC[MESON[VECTOR_MUL_LID]` (?f. x' = f x % x /\ f x = &1) <=> + x' = x /\ (? f. f x = &1 ) `] THEN +MESON_TAC[prove(`!x:real^A. ? f. f x = &1`, GEN_TAC THEN EXISTS_TAC + `(\x:real^A. &1)` THEN MESON_TAC[])]);; + +let NOV10' = prove(`! x y. (x = y + ==> (!x. y = x <=> + (?a b. &0 < a /\ &0 < b /\ a + b = &1 /\ x = a % y + b % y)))`, +REWRITE_TAC[GSYM VECTOR_ADD_RDISTRIB] THEN +REWRITE_TAC[MESON[VECTOR_MUL_LID]` a + b = &1 /\ + x = (a + b) % y <=> a + b = &1 /\ x = y `] THEN +MESON_TAC[prove(` ?a b. &0 < a /\ &0 < b /\ a + b = &1`, REPEAT + (EXISTS_TAC ` &1 / &2 `) THEN REAL_ARITH_TAC)]);; + +let CONV0_SET2 = prove(` ! x y:real^A. conv0 {x,y} = {w | ? a b. &0 < a /\ &0 < b /\ a + b = &1 /\ + w = a%x + b%y}`, +ONCE_REWRITE_TAC[ MESON[] ` (! a b. P a b ) <=> ( ! a b. a = b \/ ~( a= b) + ==> P a b )`] THEN +REWRITE_TAC[ MESON[]` a \/ b ==> c <=> ( a==> c) /\ ( b==> c)`] THEN +SIMP_TAC[] THEN +REWRITE_TAC[ SET_RULE ` {a,a} = {a}`; CONV0_SING; FUN_EQ_THM; IN_ELIM_THM] THEN +REWRITE_TAC[ IN_ACT_SING; NOV10'] THEN +REWRITE_TAC[conv0 ; sgn_gt; affsign; lin_combo] THEN +REWRITE_TAC[UNION_EMPTY; IN_SET2] THEN +ONCE_REWRITE_TAC[ MESON[]` ~(x = y) ==> (!x'. (?f. P f x') <=> l x') <=> + ~(x = y) ==> (!x'. (?f. ~(x=y) /\ P f x') <=> l x')`] THEN +REWRITE_TAC[ MESON[VSUM_DIS2; SUM_DIS2]` ~(x = y) /\ + x' = vsum {x, y} ff /\ l /\ sum {x, y} f = &1 <=> ~(x = y) /\ + x' = ff x + ff y /\ l /\ f x + f y = &1 `] THEN +REWRITE_TAC[ MESON[]` (!w. w = x \/ w = y ==> &0 < f w) <=> &0 < f x /\ &0 < f y`] THEN +ONCE_REWRITE_TAC[ GSYM (MESON[]` ~(x = y) ==> (!x'. (?f. P f x') <=> l x') <=> + ~(x = y) ==> (!x'. (?f. ~(x=y) /\ P f x') <=> l x')`)] THEN +REPEAT GEN_TAC THEN DISCH_TAC THEN GEN_TAC THEN +REWRITE_TAC[ EQ_EXPAND] THEN +SIMP_TAC[ MESON[]` ((?f. x' = f x % x + f y % y /\ (&0 < f x /\ &0 < f y) /\ f x + f y = &1) + ==> (?a b. &0 < a /\ &0 < b /\ a + b = &1 /\ x' = a % x + b % y)) `] THEN +STRIP_TAC THEN EXISTS_TAC ` (\(d:real^A). if d = x then (a:real) else b )` THEN +ASM_SIMP_TAC[]);; + +let CONV02_SU_CONV2 = prove(` ! u v. conv0 {u,v} SUBSET conv {u,v} `, +REWRITE_TAC[ CONV_SET2; CONV0_SET2] THEN +MP_TAC (REAL_ARITH ` ! a . &0 < a ==> &0 <= a `) THEN SET_TAC[]);; + + +let CONVEX_IM_CONV02_SU = prove(`! s u v. convex s /\ u IN s /\ v IN s ==> +conv0 {u, v} SUBSET s`, +MESON_TAC[CONV02_SU_CONV2; CONVEX_IM_CONV2_SU; SUBSET_TRANS]);; + +let PAIR_EQ_EXPAND = + SET_RULE `{a,b} = {c,d} <=> a = c /\ b = d \/ a = d /\ b = c`;; + +let IN_SET3 = SET_RULE ` x IN {a,b,c} <=> x = a \/ x = b \/ x = c `;; + +let IN_SET4 = SET_RULE ` x IN {a,b,c,d} <=> x = a \/ x = b \/ x = c \/ x = d `;; + +let FOUR_IN = SET_RULE `!a b c d. a IN {a,b,c,d} /\ b IN {a,b,c,d} /\c IN {a,b,c,d} /\ d IN {a,b,c,d} ` ;; + +(* TAG 1 *) + +let D3_REFL = prove(` !x. dist3 x x = &0 ` , MESON_TAC[dist3; DIST_REFL]);; + +let db_t0_sq8 = MATCH_MP REAL_LT_RSQRT (REAL_ARITH ` #2.51 pow 2 < &8 `);; + +let SUB_PACKING = prove(`!sub s. + packing s /\ sub SUBSET s + ==> (!x y. x IN sub /\ y IN sub /\ ~(x = y) ==> &2 <= dist3 x y)`, +REWRITE_TAC[ packing; GSYM dist3] THEN SET_TAC[]);; + +let DIST_PAIR_LEMMA = prove + (`{a,b} = {c,d} ==> dist(a,b) = dist(c,d)`, + REWRITE_TAC[PAIR_EQ_EXPAND] THEN MESON_TAC[DIST_SYM]);; + +end;; diff --git a/text_formalization/leg/muR_def.hl b/text_formalization/leg/muR_def.hl new file mode 100644 index 0000000..11e2b54 --- /dev/null +++ b/text_formalization/leg/muR_def.hl @@ -0,0 +1,49 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Definition: muR *) +(* Chapter: LEG *) +(* Author: Thomas C. Hales *) +(* Date: 2010-02-07 *) +(* ========================================================================== *) + + + + +(* +This is the cayleyR function, expressed in terms of the unsquared variables +indexing: five vertices v1..v5, yij runs from vi to vj, +two tetrahedra, shared face v1,v2,v3. +v4 v5 in opposite half-planes. +enclosed = y45 = sqrt(x45) is the distance from v4 to v5. +[y1,y2,y3,y4,y5,y6,y7,y8,y9]=[y14,y24,y34,y23,y13,y12,y15,y25,y35]. +y1..y6 is the usual indexing of a simplex. +y4..y9 is mod 6 congruent to the usual indexing. +*) + + + +module type Mur_def_type = sig + val muR : thm + val muRa : thm +end;; + + +flyspeck_needs "leg/cayleyR_def.hl";; + + + +module Mur : Mur_def_type = struct + + let cayleyR = Cayleyr.cayleyR;; + + let muR = +new_definition `muR y1 y2 y3 y4 y5 y6 y7 y8 y9 x = cayleyR (y6*y6) (y5*y5) (y1*y1) (y7*y7) (y4*y4) (y2*y2) (y8*y8) (y3*y3) (y9*y9) x`;; + + let muRa = prove( + `muR y1 y2 y3 y4 y5 y6 y7 y8 y9 = + cayleyR (y6*y6) (y5*y5) (y1*y1) (y7*y7) (y4*y4) (y2*y2) (y8*y8) (y3*y3) (y9*y9)`, + ONCE_REWRITE_TAC[FUN_EQ_THM] THEN REWRITE_TAC[muR]);; + +end;; + diff --git a/text_formalization/leg/quadratic_root_plus_def.hl b/text_formalization/leg/quadratic_root_plus_def.hl new file mode 100644 index 0000000..70989b7 --- /dev/null +++ b/text_formalization/leg/quadratic_root_plus_def.hl @@ -0,0 +1,32 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Definition: quadratic_root_plus *) +(* Chapter: LEG *) +(* Author: Thomas C. Hales *) +(* Date: 2010-02-07 *) +(* ========================================================================== *) + + + + +(* +Lemmas Elementary Geometry (def:calE), RPFVZDI +*) + + +(* deprecated. Moved to sphere.hl *) + +module type Quadratic_root_plus_def_type = sig + val quadratic_root_plus : thm +end;; + + + +module Quadratic_root_plus : Quadratic_root_plus_def_type = struct + + let quadratic_root_plus = + new_definition `quadratic_root_plus (a, b, c) = ( -- b + sqrt(b pow 2 - &4 * a * c))/ (&2 * a)`;; + +end;; + diff --git a/text_formalization/local/ARDBZYE.hl b/text_formalization/local/ARDBZYE.hl new file mode 100644 index 0000000..bc64784 --- /dev/null +++ b/text_formalization/local/ARDBZYE.hl @@ -0,0 +1,2991 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Ardbzye = struct + + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +open Yxionxl2;; +open Eyypqdw;; +open Ocbicby;; +open Imjxphr;; +open Nuxcoea;; +open Aursipd;; +open Cuxvzoz;; +open Rrcwnsj;; +open Tfitskc;; +open Hexagons;; +open Otmtotj;; +open Hijqaha;; +open Cnicgsf;; + + +let GSXRFWM1= prove_by_refinement(`!s v. + is_scs_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s /\ + (!i. scs_b_v39 s i (i+1) <= cstab) ==> scs_generic v`, +[ +REWRITE_TAC[IN;GSYM ADD1] +THEN REPEAT GEN_TAC +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN ABBREV_TAC`V= IMAGE (v:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((v:num->real^3) i, v (SUC i))) (:num)` +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`3<4`) +THEN MRESAL_TAC MMS_IMP_BBPRIME[`s`;`v`][LET_DEF;LET_END_DEF;BBprime_v39] +THEN MRESAL_TAC JKQEWGV2[`s`;`v`][LET_DEF;LET_END_DEF;scs_generic] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`k:num`;`s`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MP_TAC Wrgcvdr_cizmrrh.CIZMRRH +THEN RESA_TAC +THEN MRESA_TAC LUNAR_IN_V[`E`;`v'`;`w`;`V`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC "V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN REPEAT RESA_TAC +; + +DICH_TAC(21-17) +THEN DICH_TAC(20-16) +THEN RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`3<6/\ ~(4<=3)`) +THEN MRESA_TAC Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME[`V`;`E`;`k`;`s`;`FF`;`v x`;`v`;`x`] +THEN MRESA_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`v:num->real^3`;`IMAGE (v:num->real^3) (:num)`;`k:num`] +THEN MRESA_TAC Local_lemmas.NEXT_OPOSITE_POINT_IS_NOT_IN_AFF_GT2[`E`;`v x'`;`V`;`FF`;`v x`] +THEN MP_TAC(ARITH_RULE`i+1<4/\ ~(i=0)/\ ~(i=1)==> i=2`) +THEN RESA_TAC; + + + + + + +MP_TAC Axjrpnc.DIST_LE2_BB_CASSE_4 +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC WL_IN_V[`x`;`v`] +THEN MRESA_TAC Localization.LOFA_IMP_LT_CARD_SET_V_ALT[`V`;`E`;`FF`;`v x`] +THEN MRESA_TAC WL_IN_V[`i'`;`v`] +THEN POP_ASSUM MP_TAC +THEN SYM_ASSUM_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC +THEN MRESA_TAC Nuxcoea.W_IN_BB_FUN_EQ[`v:num->real^3`;`i':num`;`n+x:num`;`s`] +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`i'`;`n+x:num`;`k`][ARITH_RULE`~(4=0)`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`SUC i':num`;`v:num->real^3`;`SUC (n+x)`] +THEN MP_TAC(ARITH_RULE`n<4==> n=0\/ n=1\/ n=2\/ n=3`) +THEN RESA_TAC; + + +POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th;ARITH_RULE`0+a=a`] +THEN REPEAT RESA_TAC) +THEN DICH_TAC (37-31) +THEN RESA_TAC +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`x`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC x`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC(SUC x)`] +THEN MRESA_TAC Axjrpnc.DIST_EDGE_IN_BB_LE_2[`s`;`v`;`x`] +THEN MRESA_TAC Axjrpnc.DIST_EDGE_IN_BB_LE_2[`s`;`v`;`SUC x`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v x`;`v (SUC x)`;`&2* h0`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;REAL_ARITH`&2 * #1.26 < &4`] +THEN REWRITE_TAC[GSYM h0] +THEN STRIP_TAC +THEN MP_TAC Axjrpnc.NORM_V_IN_BB_LE_CSTAB +THEN RESA_TAC +THEN THAYTHE_TAC 0[`SUC x`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (SUC x)`;`v (SUC(SUC x))`;`cstab`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[cstab;REAL_ARITH`#3.01 < &4`] +THEN REWRITE_TAC[GSYM cstab] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`arcV (vec 0) (v (x)) (v (SUC (x))) <= arclength (&2) (&2) (&2 * h0) +/\ arcV (vec 0) ((v:num->real^3) (SUC (x))) (v (SUC (SUC (x)))) <= + arclength (&2) (&2) (cstab) +/\ arclength (&2) (&2) (&2 * h0) + arclength (&2) (&2) (cstab) < pi +==>arcV (vec 0) (v ((x))) (v ((SUC (x))))+ arcV (vec 0) (v (SUC (x))) (v (SUC (SUC (x)))) + < pi`) +THEN ASM_SIMP_TAC[Axjrpnc.arclength_2h0_cstab] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_FF[`(x)`;`v`] +THEN MRESA_TAC WL_IN_FF[`SUC (x)`;`v`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (x), v (SUC (x))`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (SUC (x)), v (SUC (SUC (x)))`] +THEN MRESA_TAC Ppbtydq.PPBTYDQ[`v (x)`;`v (SUC(SUC (x)))`;`v (SUC (x))`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(SUC(i))= 2+i`] +THEN STRIP_TAC +THEN MRESA_TAC Local_lemmas.LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI[`E`;`V`;`FF`;`v x`;`v(x')`] +THEN MRESA_TAC Local_lemmas.CONV0_SUB_CONV[`vec 0:real^3`;`{v x, v (2+x)}`] +; + + + + +POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th;ARITH_RULE`1+a=SUC a`] +THEN REPEAT RESA_TAC) +THEN DICH_TAC (37-31) +THEN RESA_TAC +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`x`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC x`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC(SUC x)`] +THEN MRESA_TAC Axjrpnc.DIST_EDGE_IN_BB_LE_2[`s`;`v`;`x`] +THEN MRESA_TAC Axjrpnc.DIST_EDGE_IN_BB_LE_2[`s`;`v`;`SUC x`] +THEN MP_TAC Axjrpnc.NORM_V_IN_BB_LE_CSTAB +THEN RESA_TAC +THEN THAYTHE_TAC 0[`x`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v x`;`v (SUC x)`;`cstab`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[cstab;REAL_ARITH`#3.01 < &4`] +THEN REWRITE_TAC[GSYM cstab] +THEN STRIP_TAC +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (SUC x)`;`v (SUC(SUC x))`;`&2* h0`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;REAL_ARITH`&2 * #1.26 < &4`] +THEN REWRITE_TAC[GSYM h0] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`arcV (vec 0) (v (x)) (v (SUC (x))) <= arclength (&2) (&2) (cstab) +/\ arcV (vec 0) ((v:num->real^3) (SUC (x))) (v (SUC (SUC (x)))) <= + arclength (&2) (&2) (&2 * h0) +/\ arclength (&2) (&2) (&2 * h0) + arclength (&2) (&2) (cstab) < pi +==>arcV (vec 0) (v ((x))) (v ((SUC (x))))+ arcV (vec 0) (v (SUC (x))) (v (SUC (SUC (x)))) + < pi`) +THEN ASM_SIMP_TAC[Axjrpnc.arclength_2h0_cstab] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_FF[`(x)`;`v`] +THEN MRESA_TAC WL_IN_FF[`SUC (x)`;`v`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (x), v (SUC (x))`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (SUC (x)), v (SUC (SUC (x)))`] +THEN MRESA_TAC Ppbtydq.PPBTYDQ[`v (x)`;`v (SUC(SUC (x)))`;`v (SUC (x))`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(SUC(i))= 2+i`] +THEN STRIP_TAC +THEN MRESA_TAC Local_lemmas.LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI[`E`;`V`;`FF`;`v x`;`v(x')`] +THEN MRESA_TAC Local_lemmas.CONV0_SUB_CONV[`vec 0:real^3`;`{v x, v (2+x)}`] +; + + + + +POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th;ARITH_RULE`0+a=a`] +THEN REPEAT RESA_TAC) +THEN DICH_TAC (37-31) +THEN RESA_TAC +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`(2+x)`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC (2+x)`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC(SUC (2+x))`] +THEN MRESA_TAC Axjrpnc.DIST_EDGE_IN_BB_LE_2[`s`;`v`;`(2+x)`] +THEN MRESA_TAC Axjrpnc.DIST_EDGE_IN_BB_LE_2[`s`;`v`;`SUC (2+x)`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (2+x)`;`v (SUC (2+x))`;`&2* h0`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;REAL_ARITH`&2 * #1.26 < &4`] +THEN REWRITE_TAC[GSYM h0] +THEN STRIP_TAC +THEN MP_TAC Axjrpnc.NORM_V_IN_BB_LE_CSTAB +THEN RESA_TAC +THEN THAYTHE_TAC 0[`SUC (2+x)`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (SUC (2+x))`;`v (SUC(SUC (2+x)))`;`cstab`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[cstab;REAL_ARITH`#3.01 < &4`] +THEN REWRITE_TAC[GSYM cstab] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`arcV (vec 0) (v ((2+x))) (v (SUC ((2+x)))) <= arclength (&2) (&2) (&2 * h0) +/\ arcV (vec 0) ((v:num->real^3) (SUC ((2+x)))) (v (SUC (SUC ((2+x))))) <= + arclength (&2) (&2) (cstab) +/\ arclength (&2) (&2) (&2 * h0) + arclength (&2) (&2) (cstab) < pi +==>arcV (vec 0) (v (((2+x)))) (v ((SUC ((2+x)))))+ arcV (vec 0) (v (SUC ((2+x)))) (v (SUC (SUC ((2+x))))) + < pi`) +THEN ASM_SIMP_TAC[Axjrpnc.arclength_2h0_cstab] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_FF[`((2+x))`;`v`] +THEN MRESA_TAC WL_IN_FF[`SUC ((2+x))`;`v`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v ((2+x)), v (SUC ((2+x)))`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (SUC ((2+x))), v (SUC (SUC ((2+x))))`] +THEN MRESA_TAC Ppbtydq.PPBTYDQ[`v ((2+x))`;`v (SUC(SUC ((2+x))))`;`v (SUC ((2+x)))`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(SUC(i))= 2+i`] +THEN STRIP_TAC +THEN MRESA_TAC Local_lemmas.LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI[`E`;`V`;`FF`;`v x`;`v(x')`] +THEN MRESA_TAC Local_lemmas.CONV0_SUB_CONV[`vec 0:real^3`;`{v (2+x), v (2+(2+x))}`] +THEN DICH_TAC 0 +THEN ASM_REWRITE_TAC[ARITH_RULE`2+2+i= 1*4+i`] +THEN MRESAS_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(1*4+x):num`;`v:num->real^3`;`(1*4+x) MOD k`][MOD_REFL;ARITH_RULE`~(4=0)`;MOD_MULT_ADD] +THEN MRESAS_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(x MOD k):num`;`v:num->real^3`;`x`][MOD_REFL;ARITH_RULE`~(4=0)`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC; + + + +POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th;ARITH_RULE`3+a=SUC(2+a)`] +THEN REPEAT RESA_TAC) +THEN DICH_TAC (36-31) +THEN RESA_TAC +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`(2+x)`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC (2+x)`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC(SUC (2+x))`] +THEN MRESA_TAC Axjrpnc.DIST_EDGE_IN_BB_LE_2[`s`;`v`;`(2+x)`] +THEN MRESA_TAC Axjrpnc.DIST_EDGE_IN_BB_LE_2[`s`;`v`;`SUC (2+x)`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (SUC (2+x))`;`v (SUC(SUC (2+x)))`;`&2* h0`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;REAL_ARITH`&2 * #1.26 < &4`] +THEN REWRITE_TAC[GSYM h0] +THEN STRIP_TAC +THEN MP_TAC Axjrpnc.NORM_V_IN_BB_LE_CSTAB +THEN RESA_TAC +THEN THAYTHE_TAC 0[`(2+x)`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (2+x)`;`v (SUC (2+x))`;`cstab`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[cstab;REAL_ARITH`#3.01 < &4`] +THEN REWRITE_TAC[GSYM cstab] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`arcV (vec 0) (v ((2+x))) (v (SUC ((2+x)))) <= arclength (&2) (&2) (cstab) +/\ arcV (vec 0) ((v:num->real^3) (SUC ((2+x)))) (v (SUC (SUC ((2+x))))) <= + arclength (&2) (&2) (&2 * h0) +/\ arclength (&2) (&2) (&2 * h0) + arclength (&2) (&2) (cstab) < pi +==>arcV (vec 0) (v (((2+x)))) (v ((SUC ((2+x)))))+ arcV (vec 0) (v (SUC ((2+x)))) (v (SUC (SUC ((2+x))))) + < pi`) +THEN ASM_SIMP_TAC[Axjrpnc.arclength_2h0_cstab] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_FF[`((2+x))`;`v`] +THEN MRESA_TAC WL_IN_FF[`SUC ((2+x))`;`v`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v ((2+x)), v (SUC ((2+x)))`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (SUC ((2+x))), v (SUC (SUC ((2+x))))`] +THEN MRESA_TAC Ppbtydq.PPBTYDQ[`v ((2+x))`;`v (SUC(SUC ((2+x))))`;`v (SUC ((2+x)))`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(SUC(i))= 2+i`] +THEN STRIP_TAC +THEN MRESA_TAC Local_lemmas.LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI[`E`;`V`;`FF`;`v x`;`v(x')`] +THEN MRESA_TAC Local_lemmas.CONV0_SUB_CONV[`vec 0:real^3`;`{v (2+x), v (2+(2+x))}`] +THEN DICH_TAC 0 +THEN ASM_REWRITE_TAC[ARITH_RULE`2+2+i= 1*4+i`] +THEN MRESAS_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(1*4+x):num`;`v:num->real^3`;`(1*4+x) MOD k`][MOD_REFL;ARITH_RULE`~(4=0)`;MOD_MULT_ADD] +THEN MRESAS_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(x MOD k):num`;`v:num->real^3`;`x`][MOD_REFL;ARITH_RULE`~(4=0)`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC; + +]);; + + +let SCS_B_LE_CSTAB=prove(`!s v. + is_scs_v39 s /\ scs_k_v39 s = 4 +==> (!i. scs_b_v39 s i (i+1) <= cstab)`, +REPEAT RESA_TAC +THEN DICH_TAC 1 +THEN ASM_SIMP_TAC[is_scs_v39;LET_DEF;LET_END_DEF;ARITH_RULE`3<4`;ADD1]);; + + + + +let GSXRFWM= prove(`!s v. + is_scs_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s + ==> scs_generic v`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC GSXRFWM1 +THEN EXISTS_TAC`s:scs_v39` +THEN ASM_SIMP_TAC[GSXRFWM1;SCS_B_LE_CSTAB]);; + +(************************) + +let PSORT_5_EXPLICIT=prove(` +psort 5 (0,0)= (0,0)/\ +psort 5 (1,1)= (1,1)/\ +psort 5 (2,2)= (2,2)/\ +psort 5 (3,3)= (3,3)/\ +psort 5 (4,4)= (4,4)/\ +psort 5 (0,1)= (0,1)/\ +psort 5 (0,2)= (0,2)/\ +psort 5 (0,3)= (0,3)/\ +psort 5 (0,4)= (0,4)/\ +psort 5 (1,0)= (0,1)/\ +psort 5 (1,2)= (1,2)/\ +psort 5 (1,3)= (1,3)/\ +psort 5 (1,4)= (1,4)/\ +psort 5 (2,0)= (0,2)/\ +psort 5 (2,1)= (1,2)/\ +psort 5 (2,3)= (2,3)/\ +psort 5 (2,4)= (2,4)/\ +psort 5 (3,0)= (0,3)/\ +psort 5 (3,1)= (1,3)/\ +psort 5 (3,2)= (2,3)/\ +psort 5 (3,4)= (3,4)/\ +psort 5 (4,0)= (0,4)/\ +psort 5 (4,1)= (1,4)/\ +psort 5 (4,2)= (2,4)/\ +psort 5 (4,3)= (3,4)/\ +psort 5 (4,5)= (0,4)/\ +psort 5 (3,5)= (0,3)/\ +psort 5 (2,5)= (0,2)/\ +psort 5 (1,5)= (0,1)/\ +psort 5 (5,1)= (0,1)/\ +psort 5 (5,2)= (0,2)/\ +psort 5 (5,3)= (0,3)/\ +psort 5 (5,4)= (0,4)/\ +psort 5 (5,5)= (0,0)/\ +psort 5 (5,6)= (0,1)/\ +psort 5 (5,7)= (0,2)/\ +psort 5 (4,6)= (1,4)/\ +psort 5 (6,4)= (1,4)/\ +psort 5 (6,5)= (0,1)/\ +psort 5 (6,7)= (1,2)/\ +psort 5 (7,5)= (0,2)/\ +psort 5 (7,6)= (1,2)/\ +psort 5 (7,7)= (2,2)/\ +psort 5 (6,6)= (1,1)/\ +psort 4 (3,4)= (0,3)/\ +psort 3 (2,0)= (0,2)/\ +psort 3 (2,1)= (1,2)/\ +psort 3 (1,0)= (0,1)/\ +psort 4 (0,0)= (0,0)/\ +psort 4 (1,1)= (1,1)/\ +psort 4 (2,2)= (2,2)/\ +psort 4 (3,3)= (3,3)/\ +psort 4 (4,3)= (0,3)/\ +psort 4 (4,4)= (0,0)/\ +psort 4 (0,2)= (0,2)/\ +psort 4 (4,5)= (0,1)/\ +psort 4 (5,4)= (0,1)/\ +psort 4 (5,5)= (1,1) +`, +REWRITE_TAC[psort;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_5_TAC;Uxckfpe.ARITH_4_TAC;LET_DEF;LET_END_DEF;MOD_5_EXPLICIT;ARITH_RULE`0<=a/\ ~(1<= 0)/\ ~(2<=0)/\ ~(3<=0)/\ ~(4<=0)/\a<=a/\ ~(2<=1)/\ ~(3<=2)/\ ~(4<=3)/\ ~(3<=1)/\ ~(4<=1)/\ ~(4<=2)/\ 2<=3`]);; + + + + +let SCS_TAC= ASM_SIMP_TAC[scs_basic;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;d_tame;REAL_ARITH`#0.712 < #0.9`;periodic;SET_RULE`{} j <=> {} i`;periodic2;scs_basic;unadorned_v39;scs_prop_equ_v39;LET_DEF;LET_END_DEF;scs_stab_diag_v39;scs_half_slice_v39; +Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_5_TAC; +scs_5M1;scs_3M1;scs_6I1;scs_3T1;scs_4M2;scs_6M1;scs_6T1;scs_5I1;scs_5I2;scs_5I3;scs_5M2;scs_4M6;scs_3T4;scs_5M3;scs_3T4_prime;scs_4M6_prime;scs_4M7_prime;scs_4M7;scs_3T1_prime;scs_4M8;scs_4M8_prime;scs_5T1;scs_3T5;scs_4M3;scs_3T6;scs_4M4;scs_4M5;scs_4I2;scs_4T1;scs_4T2;scs_4I1;scs_4T4;scs_4I3;scs_3T3;scs_4T5; +Terminal.FUNLIST_EXPLICIT;Yrtafyh.PSORT_PERIODIC;PSORT_5_EXPLICIT; +ARITH_RULE`SUC 0=1/\ SUC 1=2/\ SUC 2=3/\ SUC 3=4/\ SUC 4=5/\ SUC 5=6/\ SUC 6=7/\ SUC 7=8`];; + + + + + + + + + +(***********************) + + + + +let SCS_4I2_IS_SCS=prove_by_refinement(`is_scs_v39 scs_4I2`, +[ +SIMP_TAC[scs_4I2;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<=4/\ 4<=6/\a<=a/\ ~(6=0)`;d_tame;REAL_ARITH`#0.467 < #0.9`;periodic;SET_RULE`{} (i + 4) <=> {} i`;periodic2;ARITH_RULE`~(4=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + + + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + + + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN REAL_ARITH_TAC; + + + + +ASM_SIMP_TAC[ARITH_RULE`1<4`;Qknvmlb.SUC_MOD_NOT_EQ;REAL_ARITH`~(&2 * #1.26 < &2)/\ ~(a {} i`;periodic2;ARITH_RULE`~(4=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + +ASM_SIMP_TAC[ARITH_RULE`1<4`;Qknvmlb.SUC_MOD_NOT_EQ;REAL_ARITH`~(&2 * #1.26 < &2)/\ ~(a {} i`;periodic2;ARITH_RULE`~(4=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + + + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + + + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN REAL_ARITH_TAC; + + + + +ASM_SIMP_TAC[ARITH_RULE`1<4`;Qknvmlb.SUC_MOD_NOT_EQ;REAL_ARITH`~(&2 * #1.26 < &2)/\ ~(a {} i`;periodic2;ARITH_RULE`~(4=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + + + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + + + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN REAL_ARITH_TAC; + + + + +ASM_SIMP_TAC[ARITH_RULE`1<4`;Qknvmlb.SUC_MOD_NOT_EQ;REAL_ARITH`~(&2 * #1.26 < &2)/\ ~(a {} i`;periodic2;ARITH_RULE`~(4=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC LT_sqrt8_2h0 +THEN MP_TAC sqrt8_LE_6 +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC; + + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN MP_TAC LE_sqrt8_2 +THEN REAL_ARITH_TAC; + + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<4`] +THEN SUBGOAL_THEN`{i | i < 4 /\ + (&2 * #1.26 < (if psort 4 (i,SUC i) = 0,1 then sqrt8 else &2 * #1.26) \/ + &2 < (if psort 4 (i,SUC i) = 0,1 then &2 * #1.26 else &2))} ={0}`ASSUME_TAC +; + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;ARITH_RULE`x<4<=> x=0\/ x=1\/x=2\/ x=3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[Terminal.FUNLIST_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;REAL_ARITH`~(a {} i`;periodic2;ARITH_RULE`~(4=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC LT_sqrt8_2h0 +THEN MP_TAC sqrt8_LE_6 +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC; + + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN MP_TAC LE_sqrt8_2 +THEN REAL_ARITH_TAC; + + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<4`] +THEN SUBGOAL_THEN`{i | i < 4 /\ + (&2 * #1.26 < (if psort 4 (i,SUC i) = 0,1 then #3.01 else &2 * #1.26) \/ + &2 < (if psort 4 (i,SUC i) = 0,1 then &2 * #1.26 else &2))} ={0}`ASSUME_TAC +; + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;ARITH_RULE`x<4<=> x=0\/ x=1\/x=2\/ x=3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[Terminal.FUNLIST_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;REAL_ARITH`~(a {} i`;periodic2;ARITH_RULE`~(4=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC LT_sqrt8_2h0 +THEN MP_TAC sqrt8_LE_6 +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC; + + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN MP_TAC LE_sqrt8_2 +THEN REAL_ARITH_TAC; + + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<4`] +THEN SUBGOAL_THEN`{i | i < 4 /\ + (&2 * #1.26 < (if psort 4 (i,SUC i) = 0,1 then sqrt8 else &2 * #1.26) \/ + &2 < (if psort 4 (i,SUC i) = 0,1 then &2 * #1.26 else &2))} ={0}`ASSUME_TAC +; + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;ARITH_RULE`x<4<=> x=0\/ x=1\/x=2\/ x=3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[Terminal.FUNLIST_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;REAL_ARITH`~(a {} i`;periodic2;ARITH_RULE`~(3=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + + +SCS_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;h0] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN REAL_ARITH_TAC; + + +MRESAS_TAC CARD_SUBSET[`{i | i < 3 /\ + (&2 * h0 < funlist_v39 [] cstab 3 i (SUC i) \/ + &2 < funlist_v39 [] (&2 * h0) 3 i (SUC i))}`;`0..2`][FINITE_NUMSEG;CARD_NUMSEG;ARITH_RULE`(2+1)-0=3/\ (a+3<=6 <=> a<=3)`] +THEN MATCH_DICH_TAC 0 +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + +]);; + + + +(*****************) + + +let SCS_4I2_BASIC=prove(`scs_basic_v39 scs_4I2`, +SCS_TAC);; + +let K_SCS_4I2=prove(`scs_k_v39 scs_4I2=4`, +SCS_TAC);; + +let J_SCS_4I2=prove(`scs_J_v39 (scs_prop_equ_v39 scs_4I2 i) i1 j= F`, +SCS_TAC );; + +let SCS_4I1_BASIC=prove(`scs_basic_v39 scs_4I1`, +SCS_TAC);; + +let K_SCS_4I1=prove(`scs_k_v39 scs_4I1=4`, +SCS_TAC);; + +let J_SCS_4I1=prove(`scs_J_v39 (scs_prop_equ_v39 scs_4I1 i) i1 j= F`, +SCS_TAC );; + + +let SCS_4T1_BASIC=prove(`scs_basic_v39 scs_4T1`, +SCS_TAC);; + +let K_SCS_4T1=prove(`scs_k_v39 scs_4T1=4`, +SCS_TAC);; + +let J_SCS_4T1=prove(`scs_J_v39 (scs_prop_equ_v39 scs_4T1 i) i1 j= F`, +SCS_TAC );; + + +let SCS_4T2_BASIC=prove(`scs_basic_v39 scs_4T2`, +SCS_TAC);; + +let K_SCS_4T2=prove(`scs_k_v39 scs_4T2=4`, +SCS_TAC);; + +let J_SCS_4T2=prove(`scs_J_v39 (scs_prop_equ_v39 scs_4T2 i) i1 j= F`, +SCS_TAC );; + +let SCS_4T4_BASIC=prove(`scs_basic_v39 scs_4T4`, +SCS_TAC);; + +let K_SCS_4T4=prove(`scs_k_v39 scs_4T4=4`, +SCS_TAC);; + +let J_SCS_4T4=prove(`scs_J_v39 (scs_prop_equ_v39 scs_4T4 i) i1 j= F`, +SCS_TAC );; + +let J_SCS_3T4_1=prove(`scs_J_v39 (scs_3T4 ) i1 j= F`, +SCS_TAC );; + + +let SCS_4I3_BASIC=prove(`scs_basic_v39 scs_4I3`, +SCS_TAC);; + +let K_SCS_4I3=prove(`scs_k_v39 scs_4I3=4`, +SCS_TAC);; + +let J_SCS_4I3=prove(`scs_J_v39 (scs_prop_equ_v39 scs_4I3 i) i1 j= F`, +SCS_TAC );; + + +let SCS_3T3_BASIC=prove(`scs_basic_v39 scs_3T3`, +SCS_TAC);; + +let K_SCS_3T3=prove(`scs_k_v39 scs_3T3=3`, +SCS_TAC);; + +let J_SCS_3T3=prove(`scs_J_v39 (scs_prop_equ_v39 scs_3T3 i) i1 j= F`, +SCS_TAC );; + +let J_SCS_3T3_1=prove(`scs_J_v39 (scs_3T3 ) i1 j= F`, +SCS_TAC );; + + + +let SCS_4T5_BASIC=prove(`scs_basic_v39 scs_4T5`, +SCS_TAC);; + +let K_SCS_4T5=prove(`scs_k_v39 scs_4T5=4`, +SCS_TAC);; + +let J_SCS_4T5=prove(`scs_J_v39 (scs_prop_equ_v39 scs_4T5 i) i1 j= F`, +SCS_TAC );; + + +let B_LE_CSTAB_SCS_4I2=prove(` (!i. scs_b_v39 scs_4I2 i (SUC i) <= cstab)/\ +(!i. scs_a_v39 scs_4I2 i (SUC i) = &2 /\ + scs_b_v39 scs_4I2 i (SUC i) <= &2 * h0)`, +SCS_TAC +THEN REWRITE_TAC[h0;scs_diag;cstab] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`1<4`;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN REAL_ARITH_TAC);; + +let B_LE_CSTAB_SCS_4I1=prove(` (!i. scs_b_v39 scs_4I1 i (SUC i) <= cstab)`, +SCS_TAC +THEN REWRITE_TAC[h0;scs_diag;cstab] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`1<4`;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN REAL_ARITH_TAC);; + + + +let h0_LT_B_SCS_4I2=prove( +` +(!i j. scs_diag 4 i j ==> &4 * h0 < scs_b_v39 scs_4I2 i j) +/\ (!i j. scs_diag 4 i j ==> scs_a_v39 scs_4I2 i j <= cstab)`, +SCS_TAC +THEN REWRITE_TAC[h0;scs_diag;cstab] +THEN REPEAT RESA_TAC +THEN REAL_ARITH_TAC);; + +let h0_LT_B_SCS_4I1=prove( +` +(!i j. scs_diag 4 i j ==> &4 * h0 < scs_b_v39 scs_4I1 i j) +/\ (!i j. scs_diag 4 i j ==> scs_a_v39 scs_4I1 i j <= cstab)`, +SCS_TAC +THEN REWRITE_TAC[h0;scs_diag;cstab] +THEN REPEAT RESA_TAC +THEN REAL_ARITH_TAC);; + + + + + + +let SCS_4I2_GENERIC=prove( `!v. + v IN MMs_v39 scs_4I2 ==> scs_generic v`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC GSXRFWM +THEN EXISTS_TAC`scs_4I2` +THEN ASM_SIMP_TAC[GSYM ADD1;SCS_4I2_IS_SCS;K_SCS_4I2;B_LE_CSTAB_SCS_4I2]);; + + +let A_LT_B_4I2=prove( +`(!i. &2 < scs_b_v39 scs_4I2 i (SUC i)) /\ + (!i. scs_a_v39 scs_4I2 i (SUC i) = &2)`, +SCS_TAC +THEN ASM_SIMP_TAC[h0;scs_diag;cstab;ARITH_RULE`1<4`;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN REPEAT RESA_TAC +THEN REAL_ARITH_TAC);; + +let A_LT_B_4I1=prove( +`(!i. &2 < scs_b_v39 scs_4I1 i (SUC i)) /\ + (!i. scs_a_v39 scs_4I1 i (SUC i) = &2)`, +SCS_TAC +THEN ASM_SIMP_TAC[h0;scs_diag;cstab;ARITH_RULE`1<4`;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN REPEAT RESA_TAC +THEN REAL_ARITH_TAC);; + + +let CARD_SCS_M_4I2=prove(`CARD (scs_M scs_4I2) <= 1`, +ASM_SIMP_TAC[ARITH_RULE`1<4`;Qknvmlb.SUC_MOD_NOT_EQ;REAL_ARITH`~(a(!v. + v IN MMs_v39 scs_4I2 /\ + (!i j. scs_diag 4 i j ==> cstab < dist(v i,v j)) ==> + ~(MMs_v39 (scs_4T1)={}))`, +[REWRITE_TAC[IN;SET_RULE`~(A={})<=> ?a. a IN A`] +THEN REPEAT STRIP_TAC +THEN MP_TAC SCS_4I2_IS_SCS +THEN STRIP_TAC +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I2`;`v`] +THEN ASSUME_TAC SCS_4I2_BASIC +THEN ASSUME_TAC K_SCS_4I2 +THEN ASSUME_TAC SCS_4T1_BASIC +THEN ASSUME_TAC K_SCS_4T1 +THEN ASSUME_TAC SCS_4T1_IS_SCS +THEN MP_TAC Rrcwnsj.RRCWNSJ +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4I2`;`v`][ARITH_RULE`3<4`;h0_LT_B_SCS_4I2;B_LE_CSTAB_SCS_4I2] +THEN MP_TAC JCYFMRP_V3 +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4I2`;`v`][ARITH_RULE`3<4`;h0_LT_B_SCS_4I2;B_LE_CSTAB_SCS_4I2;IN;CARD_SCS_M_4I2;GSYM ADD1;A_LT_B_4I2] +THEN MP_TAC Jlxfdmj.JLXFDMJ +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4I2`;`v`;`i`][ARITH_RULE`3<4`;h0_LT_B_SCS_4I2;B_LE_CSTAB_SCS_4I2;IN;CARD_SCS_M_4I2;GSYM ADD1;A_LT_B_4I2;SCS_M_4I2;SET_RULE`~{} (j MOD 4)<=> T`] +THEN MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN REWRITE_TAC[IN;SET_RULE`~(A={})<=> ?a. a IN A`] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_4I2` +THEN ASM_SIMP_TAC[SCS_M_4I2] +THEN STRIP_TAC; + +DICH_TAC(12-4) +THEN REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;scs_diag;ARITH_RULE`(~(5<=3))`;IN;K_SCS_4I2;K_SCS_4T1;scs_prop_equ_v39;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN SCS_TAC +THEN REWRITE_TAC[ARITH_RULE`~(4<=3)`] +THEN REPEAT STRIP_TAC; + +MP_TAC(SET_RULE`i' MOD 4 = j MOD 4\/ ~(i' MOD 4 = j MOD 4)`) +THEN RESA_TAC; + + + +THAYTHE_TAC 2[`i'`;`j`]; + + +MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I2`;`v`] +THEN MP_TAC(SET_RULE`SUC i' MOD 4 = j MOD 4\/ ~(SUC i' MOD 4 = j MOD 4)`) +THEN RESA_TAC; + + +MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_4I2`;`j:num`;`v`;` SUC i'`][SCS_4I2_IS_SCS;K_SCS_4I2;MOD_REFL;ARITH_RULE`~(4=0)`;] +THEN REAL_ARITH_TAC; + + +MP_TAC(SET_RULE`i' MOD 4 =SUC j MOD 4\/ ~(i' MOD 4 =SUC j MOD 4)`) +THEN RESA_TAC; + +MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_4I2`;`i':num`;`v`;` SUC j`][SCS_4I2_IS_SCS;K_SCS_4I2;MOD_REFL;ARITH_RULE`~(5=0)`;] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; + + +THAYTHEL_TAC (20-15)[`i'`;`j`][scs_diag] +THEN DICH_TAC 0 +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN REAL_ARITH_TAC]);; + + + + + + + + +let SCS_DIAG_4_CASES=prove(`scs_diag 4 i j<=> ((i MOD 4= 0 /\ j MOD 4=2)\/ (i MOD 4= 1 /\ j MOD 4=3)\/ +(j MOD 4= 0 /\ i MOD 4=2)\/ (j MOD 4= 1 /\ i MOD 4=3))`, +REWRITE_TAC[scs_diag] +THEN MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`j MOD 4<4==> j MOD 4=0\/ j MOD 4=1\/ j MOD 4=2\/ j MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`i`;`4`][ARITH_RULE`1<4`] +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`j`;`4`][ARITH_RULE`1<4`] +THEN SYM_ASSUM_TAC +THEN ARITH_TAC);; + + +let WLOG_4_BB_SCS=prove_by_refinement(` is_scs_v39 s/\ +v IN BBs_v39 s /\ + scs_k_v39 s=4/\ + scs_diag 4 i j /\ + (!i j. (P (v i) (v j)<=> P (v j) (v i)))/\ + P (v i) (v j) +==> P (v 0) (v 2)\/ P (v 1) (v 3)`, +[REWRITE_TAC[SCS_DIAG_4_CASES;IN] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC; + +MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`i`;`v`;`0`][ARITH_RULE`0 MOD 4=0`] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`j`;`v`;`2`][ARITH_RULE`2 MOD 4=2`] +THEN RESA_TAC; + +MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`i`;`v`;`1`][ARITH_RULE`1 MOD 4=1`] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`j`;`v`;`3`][ARITH_RULE`3 MOD 4=3`] +THEN RESA_TAC; + +MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`i`;`v`;`2`][ARITH_RULE`2 MOD 4=2`] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`j`;`v`;`0`][ARITH_RULE`0 MOD 4=0`] +THEN RESA_TAC; + +MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`j`;`v`;`1`][ARITH_RULE`1 MOD 4=1`] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`i`;`v`;`3`][ARITH_RULE`3 MOD 4=3`] +THEN RESA_TAC]);; + + +let DIST_DIAG_2_CASES=prove(`v IN MMs_v39 scs_4I2 /\ + scs_diag 4 i j /\ + dist(v i,v j)<= cstab +==> dist(v 0,v 2)<= cstab\/ dist(v 1,v 3)<= cstab`, +REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MRESA_TAC (INST[`scs_4I2`,`s:scs_v39`;`i:num`,`i:num`;`j:num`,`j:num`;`(\i:real^3. (\j:real^3. dist(i,j)<= cstab))`,`P:real^3->real^3->bool`;`v:num->real^3`,`v:num->real^3`]WLOG_4_BB_SCS +)[`i`;`j`;`v`] +THEN MATCH_DICH_TAC 0 +THEN SIMP_TAC[DIST_SYM;K_SCS_4I2;SCS_4I2_IS_SCS;IN] +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I2`;`v`]);; + + +let WLOG_4_BB_SCS_DIAG=prove_by_refinement(` is_scs_v39 s/\ +v IN BBs_v39 s /\ + scs_k_v39 s=4/\ + scs_diag 4 i j /\ + (!i j i1 j1. P i j i1 j1 <=> P j i i1 j1)/\ +(!i j i1 j1. P i j i1 j1 <=> P i j j1 i1)/\ + P (v i) (v j) (v (i+1)) (v (j+1)) +==> P (v 0) (v 2) (v 1) (v 3) \/ P (v 1) (v 3) (v 0) (v 2)`, +[REWRITE_TAC[SCS_DIAG_4_CASES;IN] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC; + +ASSUME_TAC(ARITH_RULE`~(4=0)/\ 0 MOD 4=0/\ 1 MOD 4=1/\ SUC 0=1/\ SUC 1=2/\ 2 MOD 4=2/\ SUC 2=3 /\3 MOD 4=3/\ SUC 3=4/\ 4 MOD 4=0`) +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`i`;`v`;`0`][ARITH_RULE`0 MOD 4=0`;GSYM ADD1] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`j`;`v`;`2`][ARITH_RULE`2 MOD 4=2`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`0`;`4`] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`SUC i`;`v`;`1`][ARITH_RULE`2 MOD 4=2`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j`;`2`;`4`] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`SUC j`;`v`;`3`][ARITH_RULE`2 MOD 4=2`] +THEN RESA_TAC; + +ASSUME_TAC(ARITH_RULE`~(4=0)/\ 0 MOD 4=0/\ 1 MOD 4=1/\ SUC 0=1/\ SUC 1=2/\ 2 MOD 4=2/\ SUC 2=3 /\3 MOD 4=3/\ SUC 3=4/\ 4 MOD 4=0`) +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`i`;`v`;`1`][ARITH_RULE`0 MOD 4=0`;GSYM ADD1] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`j`;`v`;`3`][ARITH_RULE`2 MOD 4=2`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`1`;`4`] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`SUC i`;`v`;`2`][ARITH_RULE`2 MOD 4=2`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j`;`3`;`4`] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`SUC j`;`v`;`4`][ARITH_RULE`2 MOD 4=2`] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHE_TAC 0[`4`;`0`] +THEN RESA_TAC; + +ASSUME_TAC(ARITH_RULE`~(4=0)/\ 0 MOD 4=0/\ 1 MOD 4=1/\ SUC 0=1/\ SUC 1=2/\ 2 MOD 4=2/\ SUC 2=3 /\3 MOD 4=3/\ SUC 3=4/\ 4 MOD 4=0`) +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`j`;`v`;`0`][ARITH_RULE`0 MOD 4=0`;GSYM ADD1] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`i`;`v`;`2`][ARITH_RULE`2 MOD 4=2`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j`;`0`;`4`] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`SUC j`;`v`;`1`][ARITH_RULE`2 MOD 4=2`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`2`;`4`] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`SUC i`;`v`;`3`][ARITH_RULE`2 MOD 4=2`] +THEN RESA_TAC; + +ASSUME_TAC(ARITH_RULE`~(4=0)/\ 0 MOD 4=0/\ 1 MOD 4=1/\ SUC 0=1/\ SUC 1=2/\ 2 MOD 4=2/\ SUC 2=3 /\3 MOD 4=3/\ SUC 3=4/\ 4 MOD 4=0`) +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`j`;`v`;`1`][ARITH_RULE`0 MOD 4=0`;GSYM ADD1] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`i`;`v`;`3`][ARITH_RULE`2 MOD 4=2`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j`;`1`;`4`] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`SUC j`;`v`;`2`][ARITH_RULE`2 MOD 4=2`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`3`;`4`] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`SUC i`;`v`;`4`][ARITH_RULE`2 MOD 4=2`] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHE_TAC 0[`4`;`0`] +THEN RESA_TAC;]);; + + + +let DIST_DIAG_2_CASES_EQ_3=prove( `v IN MMs_v39 scs_4I2 /\ + scs_diag 4 i j /\ + dist(v i,v j)= &3 /\ dist(v (i+1),v (j+1))= &3 +==> dist(v 0,v 2)= &3 /\ dist(v 1,v 3)= &3`, +REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MRESA_TAC (INST[`scs_4I2`,`s:scs_v39`;`i:num`,`i:num`;`j:num`,`j:num`;`(\i:real^3. (\j:real^3. (\i1:real^3. (\j1:real^3. dist(i,j)= &3/\ dist(i1,j1)= &3))))`,`P:real^3->real^3->real^3->real^3->bool`;`v:num->real^3`,`v:num->real^3`]WLOG_4_BB_SCS_DIAG +)[`i`;`j`;`v`] +THEN DICH_TAC 0 +THEN SIMP_TAC[DIST_SYM;K_SCS_4I2;SCS_4I2_IS_SCS;IN] +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I2`;`v`] +THEN RESA_TAC);; + + + + +let DIST_DIAG_2_CASES_3_LE=prove( `MMs_v39 scs_4I2 v /\ + scs_diag 4 i j /\ + &3<= dist(v i,v j) /\ &3<= dist(v (i+1),v (j+1)) +==> &3<= dist(v 0,v 2) /\ &3<= dist(v 1,v 3)`, +REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MRESA_TAC (INST[`scs_4I2`,`s:scs_v39`;`i:num`,`i:num`;`j:num`,`j:num`;`(\i:real^3. (\j:real^3. (\i1:real^3. (\j1:real^3. &3<= dist(i,j)/\ &3<= dist(i1,j1)))))`,`P:real^3->real^3->real^3->real^3->bool`;`v:num->real^3`,`v:num->real^3`]WLOG_4_BB_SCS_DIAG +)[`i`;`j`;`v`] +THEN DICH_TAC 0 +THEN SIMP_TAC[DIST_SYM;K_SCS_4I2;SCS_4I2_IS_SCS;IN] +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I2`;`v`] +THEN RESA_TAC);; + + +let DIST_DIAG_2_CASES_3_LT=prove( `MMs_v39 scs_4I2 v /\ + scs_diag 4 i j /\ + &3<= dist(v i,v j) /\ &3< dist(v (i+1),v (j+1)) +==> (&3<= dist(v 0,v 2) /\ &3< dist(v 1,v 3))\/ (&3<= dist(v 1,v 3) /\ &3< dist(v 0,v 2))`, +REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MRESA_TAC (INST[`scs_4I2`,`s:scs_v39`;`i:num`,`i:num`;`j:num`,`j:num`;`(\i:real^3. (\j:real^3. (\i1:real^3. (\j1:real^3. &3<= dist(i,j)/\ &3< dist(i1,j1)))))`,`P:real^3->real^3->real^3->real^3->bool`;`v:num->real^3`,`v:num->real^3`]WLOG_4_BB_SCS_DIAG +)[`i`;`j`;`v`] +THEN DICH_TAC 0 +THEN SIMP_TAC[DIST_SYM;K_SCS_4I2;SCS_4I2_IS_SCS;IN] +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I2`;`v`] +THEN RESA_TAC);; + + + + + + +let WLOG_ASSUME_MIN=prove(`((a<=c /\ a<=b)\/ (c<=a /\ c<=b) ==> Q) +==> (a<=b \/ c<=b ==> Q)`, +REPEAT STRIP_TAC +THEN MATCH_DICH_TAC 1 +THEN DICH_TAC 0 +THEN REAL_ARITH_TAC);; + + + +let ASSUME_MIN_DIAG= prove_by_refinement(` +(!i j. + MMs_v39 scs_4I2 v/\ + scs_diag 4 i j /\ + dist(v i,v j)<= cstab/\ + dist(v i,v j)<= dist(v (i+1),v (j+1)) + ==> + ~(MMs_v39 (scs_4T1)={})\/ ~(MMs_v39 (scs_4T2)={})) +==>(!i j. + MMs_v39 scs_4I2 v /\ + scs_diag 4 i j /\ + dist(v i,v j)<= cstab ==> + ~(MMs_v39 (scs_4T1)={})\/ ~(MMs_v39 (scs_4T2)={}))`, +[ +REPEAT RESA_TAC +THEN MP_TAC(SET_RULE` dist(v i,v j)<= dist(v (i+1),v (j+1)) +\/ ~( dist(v i,v j)<= dist(v (i+1),(v:num->real^3) (j+1))) +`) +THEN RESA_TAC; + +MATCH_DICH_TAC 4 +THEN EXISTS_TAC`i:num` +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[]; + +MATCH_DICH_TAC 4 +THEN EXISTS_TAC`i+1:num` +THEN EXISTS_TAC`j+1:num` +THEN ASM_REWRITE_TAC[] +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[SCS_DIAG_4_CASES] +THEN RESA_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`i`;`4`][ARITH_RULE`1<4`;GSYM ADD1] +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`j`;`4`][ARITH_RULE`1<4`] +THEN SYM_ASSUM_TAC +THEN STRIP_TAC +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I2`;`v`] +THEN ASSUME_TAC SCS_4I2_IS_SCS +THEN ASSUME_TAC K_SCS_4I2; + +ARITH_TAC; + +ASSUME_TAC(ARITH_RULE`~(4=0)/\ 0 MOD 4=0/\ 1 MOD 4=1/\ SUC 0=1/\ SUC 1=2/\ 2 MOD 4=2/\ SUC 2=3 /\3 MOD 4=3/\ SUC 3=4/\ 4 MOD 4=0`) +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`0`;`4`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`SUC i`;`1`;`4`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j`;`2`;`4`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`SUC j`;`3`;`4`] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`] +THEN THAYTHEL_ASM_TAC 0[`SUC i`;`1`][] +THEN THAYTHEL_ASM_TAC 0[`SUC j`;`3`][] +THEN THAYTHEL_ASM_TAC 0[`SUC(SUC j)`;`4`][] +THEN THAYTHEL_ASM_TAC 0[`SUC(SUC i)`;`2`][] +THEN THAYTHEL_ASM_TAC 0[`4`;`0`][] +THEN THAYTHEL_ASM_TAC 0[`i`;`0`][] +THEN THAYTHEL_ASM_TAC 0[`j`;`2`][] +THEN DICH_TAC(20-1) +THEN DICH_TAC(19-1) +THEN ASM_SIMP_TAC[GSYM ADD1] +THEN MRESA_TAC DIST_SYM[`v 2`;`v 0`] +THEN REAL_ARITH_TAC; + +ARITH_TAC; + +ASSUME_TAC(ARITH_RULE`~(4=0)/\ 0 MOD 4=0/\ 1 MOD 4=1/\ SUC 0=1/\ SUC 1=2/\ 2 MOD 4=2/\ SUC 2=3 /\3 MOD 4=3/\ SUC 3=4/\ 4 MOD 4=0/\ SUC 4=5/\ 5 MOD 4=1`) +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`1`;`4`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`SUC i`;`2`;`4`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j`;`3`;`4`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`SUC j`;`4`;`4`] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`] +THEN THAYTHEL_ASM_TAC 0[`SUC i`;`2`][] +THEN THAYTHEL_ASM_TAC 0[`SUC j`;`4`][] +THEN THAYTHEL_ASM_TAC 0[`SUC(SUC j)`;`1`][] +THEN THAYTHEL_ASM_TAC 0[`SUC(SUC i)`;`3`][] +THEN THAYTHEL_ASM_TAC 0[`4`;`0`][] +THEN THAYTHEL_ASM_TAC 0[`i`;`1`][] +THEN THAYTHEL_ASM_TAC 0[`j`;`3`][] +THEN DICH_TAC(20-1) +THEN DICH_TAC(19-1) +THEN ASM_SIMP_TAC[GSYM ADD1] +THEN MRESA_TAC DIST_SYM[`v 3`;`v 1`] +THEN REAL_ARITH_TAC; + +ARITH_TAC; + +ASSUME_TAC(ARITH_RULE`~(4=0)/\ 0 MOD 4=0/\ 1 MOD 4=1/\ SUC 0=1/\ SUC 1=2/\ 2 MOD 4=2/\ SUC 2=3 /\3 MOD 4=3/\ SUC 3=4/\ 4 MOD 4=0`) +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`2`;`4`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`SUC i`;`3`;`4`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j`;`0`;`4`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`SUC j`;`1`;`4`] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`] +THEN THAYTHEL_ASM_TAC 0[`SUC i`;`3`][] +THEN THAYTHEL_ASM_TAC 0[`SUC j`;`1`][] +THEN THAYTHEL_ASM_TAC 0[`SUC(SUC j)`;`2`][] +THEN THAYTHEL_ASM_TAC 0[`SUC(SUC i)`;`4`][] +THEN THAYTHEL_ASM_TAC 0[`4`;`0`][] +THEN THAYTHEL_ASM_TAC 0[`i`;`2`][] +THEN THAYTHEL_ASM_TAC 0[`j`;`0`][] +THEN DICH_TAC(20-1) +THEN DICH_TAC(19-1) +THEN ASM_SIMP_TAC[GSYM ADD1] +THEN MRESA_TAC DIST_SYM[`v 0`;`v 2`] +THEN REAL_ARITH_TAC; + +ARITH_TAC; + +ASSUME_TAC(ARITH_RULE`~(4=0)/\ 0 MOD 4=0/\ 1 MOD 4=1/\ SUC 0=1/\ SUC 1=2/\ 2 MOD 4=2/\ SUC 2=3 /\3 MOD 4=3/\ SUC 3=4/\ 4 MOD 4=0/\ SUC 4=5/\ 5 MOD 4=1`) +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`3`;`4`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`SUC i`;`4`;`4`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j`;`1`;`4`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`SUC j`;`2`;`4`] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`] +THEN THAYTHEL_ASM_TAC 0[`SUC i`;`4`][] +THEN THAYTHEL_ASM_TAC 0[`SUC j`;`2`][] +THEN THAYTHEL_ASM_TAC 0[`SUC(SUC j)`;`3`][] +THEN THAYTHEL_ASM_TAC 0[`SUC(SUC i)`;`1`][] +THEN THAYTHEL_ASM_TAC 0[`4`;`0`][] +THEN THAYTHEL_ASM_TAC 0[`i`;`3`][] +THEN THAYTHEL_ASM_TAC 0[`j`;`1`][] +THEN DICH_TAC(20-1) +THEN DICH_TAC(19-1) +THEN ASM_SIMP_TAC[GSYM ADD1] +THEN MRESA_TAC DIST_SYM[`v 1`;`v 3`] +THEN REAL_ARITH_TAC]);; + + +let SCS_4I2_3_LE_A=prove_by_refinement(` BBs_v39 scs_4I2 v/\ +scs_diag 4 i j +==> &3<= dist(v i,v j)`, +[ +REWRITE_TAC[IN] +THEN REPEAT RESA_TAC +THEN DICH_TAC 0 +THEN REWRITE_TAC[SCS_DIAG_4_CASES] +THEN RESA_TAC; + +ASSUME_TAC(ARITH_RULE`~(4=0)/\ 0 MOD 4=0/\ 1 MOD 4=1/\ SUC 0=1/\ SUC 1=2/\ 2 MOD 4=2/\ SUC 2=3 /\3 MOD 4=3/\ SUC 3=4/\ 4 MOD 4=0/\ ~(0=1)/\ ~(1=2)/\ ~(3=0)`) +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_4I2`;`i`;`v`;`0`][ARITH_RULE`0 MOD 4=0`;SCS_4I2_IS_SCS;K_SCS_4I2] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_4I2`;`j`;`v`;`2`][ARITH_RULE`2 MOD 4=2`;SCS_4I2_IS_SCS;K_SCS_4I2] +THEN DICH_TAC 5 +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;BBs_v39;mk_unadorned_v39;scs_v39_explicit;scs_4I2;CS_ADJ;ARITH_RULE`~(4<=3)`] +THEN RESA_TAC +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`0`;`4`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j`;`2`;`4`] +THEN THAYTHES_TAC 3[`i`;`j`][ARITH_RULE`~(0=2)`]; + + +ASSUME_TAC(ARITH_RULE`~(4=0)/\ 0 MOD 4=0/\ 1 MOD 4=1/\ SUC 0=1/\ SUC 1=2/\ 2 MOD 4=2/\ SUC 2=3 /\3 MOD 4=3/\ SUC 3=4/\ 4 MOD 4=0/\ ~(0=1)/\ ~(1=2)/\ ~(3=0)/\ ~(1=3)/\ ~(2=3)`) +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_4I2`;`i`;`v`;`1`][ARITH_RULE`0 MOD 4=0`;SCS_4I2_IS_SCS;K_SCS_4I2] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_4I2`;`j`;`v`;`3`][ARITH_RULE`2 MOD 4=2`;SCS_4I2_IS_SCS;K_SCS_4I2] +THEN DICH_TAC 5 +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;BBs_v39;mk_unadorned_v39;scs_v39_explicit;scs_4I2;CS_ADJ;ARITH_RULE`~(4<=3)`] +THEN RESA_TAC +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`1`;`4`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j`;`3`;`4`] +THEN THAYTHES_TAC 3[`i`;`j`][ARITH_RULE`~(0=2)`]; + +ASSUME_TAC(ARITH_RULE`~(4=0)/\ 0 MOD 4=0/\ 1 MOD 4=1/\ SUC 0=1/\ SUC 1=2/\ 2 MOD 4=2/\ SUC 2=3 /\3 MOD 4=3/\ SUC 3=4/\ 4 MOD 4=0/\ ~(0=1)/\ ~(1=2)/\ ~(3=0)`) +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_4I2`;`j`;`v`;`0`][ARITH_RULE`0 MOD 4=0`;SCS_4I2_IS_SCS;K_SCS_4I2] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_4I2`;`i`;`v`;`2`][ARITH_RULE`2 MOD 4=2`;SCS_4I2_IS_SCS;K_SCS_4I2] +THEN DICH_TAC 5 +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;BBs_v39;mk_unadorned_v39;scs_v39_explicit;scs_4I2;CS_ADJ;ARITH_RULE`~(4<=3)`] +THEN RESA_TAC +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j`;`0`;`4`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`2`;`4`] +THEN THAYTHES_TAC 3[`i`;`j`][ARITH_RULE`~(0=2)`]; + +ASSUME_TAC(ARITH_RULE`~(4=0)/\ 0 MOD 4=0/\ 1 MOD 4=1/\ SUC 0=1/\ SUC 1=2/\ 2 MOD 4=2/\ SUC 2=3 /\3 MOD 4=3/\ SUC 3=4/\ 4 MOD 4=0/\ ~(0=1)/\ ~(1=2)/\ ~(3=0)/\ ~(1=3)/\ ~(2=3)`) +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_4I2`;`j`;`v`;`1`][ARITH_RULE`0 MOD 4=0`;SCS_4I2_IS_SCS;K_SCS_4I2] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_4I2`;`i`;`v`;`3`][ARITH_RULE`2 MOD 4=2`;SCS_4I2_IS_SCS;K_SCS_4I2] +THEN DICH_TAC 5 +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;BBs_v39;mk_unadorned_v39;scs_v39_explicit;scs_4I2;CS_ADJ;ARITH_RULE`~(4<=3)`] +THEN RESA_TAC +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j`;`1`;`4`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`3`;`4`] +THEN THAYTHES_TAC 3[`i`;`j`][ARITH_RULE`~(0=2)`]]);; + + + + +let SCS_DIAG_ADD1=prove_by_refinement(`scs_diag 4 i j==> scs_diag 4 (i+1) (j+1)`, +[REWRITE_TAC[SCS_DIAG_4_CASES;GSYM ADD1] +THEN RESA_TAC; + +ASSUME_TAC(ARITH_RULE`~(4=0)/\ 0 MOD 4=0/\ 1 MOD 4=1/\ SUC 0=1/\ SUC 1=2/\ 2 MOD 4=2/\ SUC 2=3 /\3 MOD 4=3/\ SUC 3=4/\ 4 MOD 4=0/\ ~(0=1)/\ ~(1=2)/\ ~(3=0)/\ ~(1=3)/\ ~(2=3)`) +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`0`;`4`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j`;`2`;`4`]; + +ASSUME_TAC(ARITH_RULE`~(4=0)/\ 0 MOD 4=0/\ 1 MOD 4=1/\ SUC 0=1/\ SUC 1=2/\ 2 MOD 4=2/\ SUC 2=3 /\3 MOD 4=3/\ SUC 3=4/\ 4 MOD 4=0/\ ~(0=1)/\ ~(1=2)/\ ~(3=0)/\ ~(1=3)/\ ~(2=3)`) +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`1`;`4`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j`;`3`;`4`]; + +ASSUME_TAC(ARITH_RULE`~(4=0)/\ 0 MOD 4=0/\ 1 MOD 4=1/\ SUC 0=1/\ SUC 1=2/\ 2 MOD 4=2/\ SUC 2=3 /\3 MOD 4=3/\ SUC 3=4/\ 4 MOD 4=0/\ ~(0=1)/\ ~(1=2)/\ ~(3=0)/\ ~(1=3)/\ ~(2=3)`) +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j`;`0`;`4`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`2`;`4`]; + +ASSUME_TAC(ARITH_RULE`~(4=0)/\ 0 MOD 4=0/\ 1 MOD 4=1/\ SUC 0=1/\ SUC 1=2/\ 2 MOD 4=2/\ SUC 2=3 /\3 MOD 4=3/\ SUC 3=4/\ 4 MOD 4=0/\ ~(0=1)/\ ~(1=2)/\ ~(3=0)/\ ~(1=3)/\ ~(2=3)`) +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j`;`1`;`4`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`3`;`4`]]);; + + +let ear_acute = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6. + &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + &2 <= y4 /\ y4 <= &2 * h0 /\ + &2 <= y6 /\ y6 <= &2 * h0 /\ + &3 <= y5 /\ + &0 < ups_x (y1*y1) (y3*y3) (y5*y5) + ==> dih_y y1 y2 y3 y4 y5 y6 < pi / &2)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.h0;arith `&2 * #1.26 = #2.52`;Trigonometry.IHIQXLM]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (Terminal.get_main_nonlinear "2485876245a") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `#3.0 = &3`;]; + ANTS_TAC; + REWRITE_TAC[arith `x <= y <=> ~(y < x)`]; + DISCH_TAC; + FIRST_X_ASSUM_ST `&16` MP_TAC THEN REWRITE_TAC[arith `a * b * c = (a * b) * c`]; + REWRITE_TAC[arith `~(&0 < x * y) <=> &0 <= x * (-- y)`]; + REPEAT (GMATCH_SIMP_TAC REAL_LE_MUL_EQ); + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL_EQ); + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[Nonlinear_lemma.dih_x_alt;Sphere.dih_y;LET_THM;GSYM Sphere.delta_y]; + REWRITE_TAC[GSYM Sphere.delta4_y;GSYM Sphere.y_of_x]; + REWRITE_TAC[arith `pi2 + a < pi2 <=> a < &0`]; + DISCH_TAC; + GMATCH_SIMP_TAC Tskajxy.ATN2_Y_NEG; + CONJ_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[arith `p - a = p + -- a`;GSYM ATN_NEG;arith `-- p + a < &0 <=> a < p`;ATN_BOUNDS]) + ]);; + (* }}} *) + + +let SCS_DIAG_4_ADD2=prove(`scs_diag 4 (i+1) (i+3)`, +SIMP_TAC[scs_diag;ARITH_RULE`~(4=0)/\ SUC(i+1)= i+2/\ SUC (i+3)=i+4`;Ocbicby.MOD_EQ_MOD_SHIFT;] +THEN ARITH_TAC);; + + +let SCS_DIAG_4_ADD0=prove(`scs_diag 4 (i) (i+2)`, +SIMP_TAC[scs_diag;ARITH_RULE`~(4=0)/\ SUC(i)= i+1/\ SUC (i+2)=i+3`;Ocbicby.MOD_EQ_MOD_SHIFT;] +THEN MP_TAC(SET_RULE`i= i+0==> i MOD 4= (i+0) MOD 4`) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[ARITH_RULE`i+0=i`] +THEN RESA_TAC +THEN SIMP_TAC[scs_diag;ARITH_RULE`~(4=0)/\ SUC(i)= i+1/\ SUC (i+2)=i+3`;Ocbicby.MOD_EQ_MOD_SHIFT;] +THEN ARITH_TAC);; + + +let EDGE_4I2_LE_2H0=prove(`BBs_v39 scs_4I2 v +==> dist(v i, v (i+1))<= &2* h0/\ &2<= dist(v i, v (i+1))`, +REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;scs_diag;ARITH_RULE`(~(4<=3))`;IN;K_SCS_4I2;K_SCS_4T1;scs_prop_equ_v39;] +THEN STRIP_TAC +THEN THAYTHE_TAC 1[`i`;`i+1`] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN SCS_TAC +THEN ASM_SIMP_TAC[GSYM ADD1;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<4`]);; + + + +let SCS_4I2_STRAIGHT= prove_by_refinement(`main_nonlinear_terminal_v11 +==>(!i. MMs_v39 scs_4I2 v +==> azim (vec 0) (v i) (v (i+1)) (v (i+3))real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((v:num->real^3) i, v (SUC i)))(:num)` +THEN MRESAL_TAC SCS_4I2_GENERIC[`v`][IN;scs_generic] +THEN ASSUME_TAC(ARITH_RULE`3<4`) +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`4`;`scs_4I2`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC WL_IN_V[`(i+1)`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`i+3`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`i`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`i+2`;`v:num->real^3`] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`] +THEN MP_TAC(SET_RULE`i= i+0==> i MOD 4= (i+0) MOD 4`) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[ARITH_RULE`i+0=i`] +THEN RESA_TAC +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v i`;`v (i+2)`;`V`] +THEN THAYTHES_TAC 0[`v i`;`v (i+2)`][SET_RULE`a IN {a,b}`;ARITH_RULE`~(4=0)/\ ~(0 MOD 4 = 2 MOD 4)`;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v (i+1)`;`v (i+3)`;`V`] +THEN THAYTHES_TAC 0[`v (i+3)`;`v (i)`][SET_RULE`a IN {b,a}`;ARITH_RULE`~(4=0)/\ ~(0 MOD 4 = 3 MOD 4)`;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v (i+1)`;`v (i+3)`;`V`] +THEN THAYTHES_TAC 0[`v (i+1)`;`v (i)`][SET_RULE`a IN {a,b}`;ARITH_RULE`~(4=0)/\ ~(0 MOD 4 = 1 MOD 4)`;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MRESAL_TAC Collect_geom2.NOT_COL_EQ_UPS_X_POS[`vec 0:real^3`;`v (i)`;`v(i+2)`][dist;VECTOR_ARITH`vec 0-A= --A`;NORM_NEG] +THEN DICH_TAC 0 +THEN REWRITE_TAC[GSYM dist] +THEN RESA_TAC +THEN MRESA_TAC Rrcwnsj.BB_RHO_NODE_IVS[`V`;`E`;`scs_4I2`;`FF`;`v i`;`v`;`i`;`4`] +THEN MRESA_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v i`] +THEN THAYTHE_TAC 0[`v(i+2)`] +THEN MP_TAC ear_acute +THEN RESA_TAC +THEN THAYTHES_TAC 0[`norm (v (i))`;`norm (v (i+1))`;`norm (v (i+2))`;`dist(v (i+1),v (i+2))`;`dist(v (i),v(i+2))`;`dist(v i, v(i+1))`][REAL_ARITH`a*a= a pow 2`] +THEN DICH_TAC 0 +THEN MRESAL_TAC Iunbuig.azim_dih_y[`vec 0:real^3`;`v i`;`v (i+1)`;`v(i+2)`][dist;VECTOR_ARITH`vec 0-A= --A`;NORM_NEG] +THEN SYM_ASSUM_TAC +THEN MRESA_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v i`] +THEN THAYTHE_TAC 0[`v(i+3)`] +THEN MRESAL_TAC Terminal.vv_split_azim_generic[`v`;`4`;`i`;`2`;`3`][LET_DEF;LET_END_DEF;ARITH_RULE`3<=4/\0<2/\ 2<3`] +THEN DICH_TAC 0 +THEN SUBGOAL_THEN`(!i j. i < 4 /\ j < 4 /\ i MOD 4 = j MOD 4 ==> i = j)`ASSUME_TAC; + +REPEAT RESA_TAC +THEN DICH_TAC 0 +THEN ASM_SIMP_TAC[ARITH_RULE`~(4=0)`;MOD_LT]; + +ASM_REWRITE_TAC[] +THEN DICH_TAC(54-5) +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;BBs_v39;K_SCS_4I2;ARITH_RULE`~(4<=3)`;ADD1] +THEN RESA_TAC +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I2`;`v`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim (vec 0) (v i) (v (i + 1)) (v (i + 3)) <= pi/\ +azim (vec 0) (v i) (v (i + 1)) (v (i + 3)) = + azim (vec 0) (v i) (v (i + 1)) (v (i + 2)) + + azim (vec 0) (v i) (v (i + 2)) (v (i + 3)) +/\ &0<= azim (vec 0) (v i) (v (i + 1)) (v (i + 2)) +==> azim (vec 0) (v i) (v (i + 2)) (v (i + 3))<= pi + `) +THEN ASM_REWRITE_TAC[azim] +THEN STRIP_TAC +THEN MP_TAC ear_acute +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`norm (v (i))`;`norm (v (i+3))`;`norm (v (i+2))`;`dist(v (i+2),v (i+3))`;`dist(v (i),v(i+2))`;`dist(v i, v(i+3))`][REAL_ARITH`a*a= a pow 2`] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC(REAL_ARITH`a a+b< c`) +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC Iunbuig.azim_dih_y[`vec 0:real^3`;`v i`;`v (i+2)`;`v(i+3)`][dist;VECTOR_ARITH`vec 0-A= --A`;NORM_NEG] +THEN ONCE_REWRITE_TAC[Nonlinear_lemma.dih_y_sym] +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]]);; + + + +let SCS_4I2_STRAIGHT_ALL= prove_by_refinement(`main_nonlinear_terminal_v11 +==>( + MMs_v39 scs_4I2 v==> +azim (vec 0) (v 0) (v 1) (v 3) < pi +/\ azim (vec 0) (v 1) (v 2) (v 0) < pi +/\ azim (vec 0) (v 2) (v 3) (v 1) < pi +/\ azim (vec 0) (v 3) (v 0) (v 2) < pi )`, +[REPEAT STRIP_TAC +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I2`;`v`] +THEN ASSUME_TAC(SCS_4I2_IS_SCS) +THEN ASSUME_TAC(K_SCS_4I2) +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`] +THEN MP_TAC SCS_4I2_STRAIGHT +THEN RESA_TAC; + +THAYTHEL_TAC 0[`0`][ARITH_RULE`0+a=a`]; + +THAYTHEL_TAC 1[`4`;`0`][ARITH_RULE`4 MOD 4 = 0 MOD 4`] +THEN THAYTHEL_TAC 1[`1`][ARITH_RULE`1+1=2/\1+3=4`]; + +THAYTHEL_TAC 1[`5`;`1`][ARITH_RULE`5 MOD 4 = 1 MOD 4`] +THEN THAYTHEL_TAC 1[`2`][ARITH_RULE`2+1=3/\2+3=5`]; + +THAYTHEL_ASM_TAC 1[`4`;`0`][ARITH_RULE`4 MOD 4 = 0 MOD 4`] +THEN THAYTHEL_TAC 0[`6`;`2`][ARITH_RULE`6 MOD 4 = 2 MOD 4`] +THEN THAYTHEL_TAC 2[`3`][ARITH_RULE`3+1=4/\3+3=6`]]);; + + +let EXPAND_DIAG_4=prove_by_refinement(`scs_diag 4 i j ==> j MOD 4= (i+2) MOD 4`, +[REWRITE_TAC[SCS_DIAG_4_CASES;ARITH_RULE`i+2=SUC(SUC i)`] +THEN RESA_TAC; + +MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`0`;`4`][Uxckfpe.ARITH_4_TAC] +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`SUC i`;`1`;`4`][Uxckfpe.ARITH_4_TAC]; + +MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`1`;`4`][Uxckfpe.ARITH_4_TAC] +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`SUC i`;`2`;`4`][Uxckfpe.ARITH_4_TAC]; + +MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`2`;`4`][Uxckfpe.ARITH_4_TAC] +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`SUC i`;`3`;`4`][Uxckfpe.ARITH_4_TAC]; + +MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`3`;`4`][Uxckfpe.ARITH_4_TAC] +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`SUC i`;`4`;`4`][Uxckfpe.ARITH_4_TAC]]);; + + + +let EDGE_EQ_2_4I2=prove_by_refinement(`main_nonlinear_terminal_v11 +==>(!i j. MMs_v39 scs_4I2 v/\ +scs_diag 4 i j +/\ &3 <= dist (v i,v j) /\ +&3 < dist (v (i + 1),v (j + 1)) +==> dist(v (SUC i), v(SUC (SUC i)))= &2 )`, +[REPEAT RESA_TAC +THEN ABBREV_TAC`V= IMAGE (v:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((v:num->real^3) i, v (SUC i)))(:num)` +THEN ASSUME_TAC(ARITH_RULE`3<4/\ 0 + 4 - 1= 3/\ 0+1=1/\ SUC 0=1/\ SUC i + 4 - 1=i+4/\ ~(4=0)/\ 2 MOD 4=2/\ 0 MOD 4=0/\ (i + 1) + 2= i+3/\ 2+2=4/\ 3+2=5 +/\ 3+1=4/\ 3+3=6/\ 6 MOD 4=2/\ 1 MOD 4=1/\ 3 MOD 4=3 +/\ 2+1=3/\ 2+3=5`) +THEN ASSUME_TAC(ARITH_RULE`i+4= 1*4+i/\ SUC i+1=i+2/\ SUC i + 3= i+4`) +THEN ASSUME_TAC(SCS_4I2_IS_SCS) +THEN ASSUME_TAC(K_SCS_4I2) +THEN ASSUME_TAC(SCS_4I2_BASIC) +THEN ASSUME_TAC(h0_LT_B_SCS_4I2) +THEN MRESAL_TAC SCS_4I2_GENERIC[`v`][IN] +THEN MP_TAC CUXVZOZ +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`scs_4I2`;`FF`;`4`;`i+1`;`v`][GSYM ADD1;B_LE_CSTAB_SCS_4I2] +THEN MATCH_DICH_TAC 0 +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I2`;`v`] +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHEL_TAC 0[`i+4`;`i`][MOD_MULT_ADD;] +THEN DICH_TAC 1 +THEN REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;ARITH_RULE`(~(4<=3))`;IN;K_SCS_4M8_prime;K_SCS_4M8;scs_prop_equ_v39;K_SCS_4I2] +THEN STRIP_TAC +THEN THAYTHEL_TAC 1[`i`;`SUC i`][B_LE_CSTAB_SCS_4I2] +THEN MP_TAC(REAL_ARITH`scs_b_v39 scs_4I2 i (SUC i) <= cstab +/\ dist (v i,v (SUC i)) <= scs_b_v39 scs_4I2 i (SUC i) +==> dist (v i,(v:num->real^3) (SUC i)) <= cstab`) +THEN ASM_SIMP_TAC[B_LE_CSTAB_SCS_4I2] +THEN STRIP_TAC +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I2`;`v`] +THEN MRESAL_TAC SCS_4I2_3_LE_A[`i`;`v`;`i+2`][SCS_DIAG_4_ADD0] +THEN MP_TAC SCS_4I2_STRAIGHT +THEN RESA_TAC +THEN ASM_REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1] +THEN MRESA_TAC Rrcwnsj.BB_RHO_NODE_IVS[`V`;`E`;`scs_4I2`;`FF`;`v (SUC i)`;`v`;`SUC i`;`4`] +THEN THAYTHEL_ASM_TAC 2[`SUC i`][] +THEN MRESA_TAC Rrcwnsj.BB_RHO_NODE_IVS[`V`;`E`;`scs_4I2`;`FF`;`v (SUC(SUC i))`;`v`;`SUC (SUC i)`;`4`] +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHEL_TAC 0[`1 * 4 + SUC i`;`SUC i`][MOD_MULT_ADD;] +THEN THAYTHEL_ASM_TAC (29-26)[`SUC (SUC i)`][] +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(SUC i)=i+2`] +THEN REPEAT GEN_TAC +THEN REWRITE_TAC[SCS_DIAG_4_CASES;] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`i':num`;`j':num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN MRESAS_TAC Hexagons.PSORT_MOD[`4`;`1*4+i:num`;`i+2:num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1`;MOD_MULT_ADD] +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`i`;`2`;`4`] +THEN SYM_ASSUM_TAC +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHEL_TAC 0[`i'`;`i' MOD 4`][MOD_MULT_ADD;] +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHEL_TAC 0[`j'`;`j' MOD 4`][MOD_MULT_ADD;] +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHES_TAC 0[`i+1`;`(i+1) MOD 4`][MOD_REFL;] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC MOD_ADD_MOD[`i`;`1`;`4`] +THEN SYM_ASSUM_TAC +THEN STRIP_TAC +THEN MP_TAC SCS_DIAG_ADD1 +THEN RESA_TAC +THEN MRESA_TAC EXPAND_DIAG_4[`j+1`;`i+1`] +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHES_TAC 0[`j+1`;`(i+3) MOD 4`][MOD_REFL;] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC MOD_ADD_MOD[`i`;`3`;`4`] +THEN SYM_ASSUM_TAC +THEN STRIP_TAC +THEN DICH_TAC(39-4) +THEN ASM_REWRITE_TAC[]; + + +MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0+2=2`] +THEN SCS_TAC +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`i'`;`0`;`4`][Uxckfpe.ARITH_4_TAC] +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`j'`;`2`;`4`][Uxckfpe.ARITH_4_TAC] +THEN ASM_SIMP_TAC[DIST_SYM]; + + +MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0+2=2`] +THEN SCS_TAC +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`i'`;`1`;`4`][Uxckfpe.ARITH_4_TAC] +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`j'`;`3`;`4`][Uxckfpe.ARITH_4_TAC] +THEN ASM_SIMP_TAC[DIST_SYM]; + +MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0+2=2`] +THEN SCS_TAC +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`i'`;`2`;`4`][Uxckfpe.ARITH_4_TAC] +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`j'`;`0`;`4`][Uxckfpe.ARITH_4_TAC] +THEN ASM_SIMP_TAC[DIST_SYM]; + +MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0+2=2`] +THEN SCS_TAC +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`i'`;`3`;`4`][Uxckfpe.ARITH_4_TAC] +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`j'`;`1`;`4`][Uxckfpe.ARITH_4_TAC] +THEN ASM_SIMP_TAC[DIST_SYM]]);; + + + +let EXPAND_DIAG_4_DIST=prove_by_refinement(`main_nonlinear_terminal_v11 +==>(!i j. MMs_v39 scs_4I2 v/\ +scs_diag 4 i j +/\ &3 <= dist (v i,v j) /\ +&3 < dist (v (i + 1),v (j + 1)) +==> &3 <= dist (v i,v (i+2)) /\ +&3 < dist (v (i + 1),v (i + 3)))`, +[ +REPEAT RESA_TAC +THEN MP_TAC EXPAND_DIAG_4 +THEN RESA_TAC +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I2`;`v`]; + +MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHES_TAC 0[`i+2`;`j `][MOD_REFL;]; + +MP_TAC SCS_DIAG_ADD1 +THEN RESA_TAC +THEN MRESA_TAC EXPAND_DIAG_4[`j+1`;`i+1`] +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHES_TAC 0[`(i+3)`;`j+1`][MOD_REFL;ARITH_RULE`(i + 1) + 2= i+3`]]);; + + +let B_LE_CSTAB_SCS_4I2_prime=prove(`scs_a_v39 scs_4I2 (SUC i) (1 * 4 + i) = &2 /\ + scs_b_v39 scs_4I2 (SUC i) (1 * 4 + i) <= &2 * h0`, +SCS_TAC +THEN ASM_SIMP_TAC[MOD_MULT_ADD] +THEN REWRITE_TAC[h0;scs_diag;cstab] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`1<4`;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`SUC (1 * 4 + i)= 1 * 4 + SUC i`;MOD_MULT_ADD] +THEN REAL_ARITH_TAC);; + + + +let EDGE_EQ_2_4I2_1=prove_by_refinement(`main_nonlinear_terminal_v11 +==>(!i j. MMs_v39 scs_4I2 v/\ +scs_diag 4 i j +/\ &3 <= dist (v i,v j) /\ +&3 < dist (v (i + 1),v (j + 1)) +==> dist(v (i), v((SUC i)))= &2 )`, +[REPEAT RESA_TAC +THEN ABBREV_TAC`V= IMAGE (v:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((v:num->real^3) i, v (SUC i)))(:num)` +THEN ASSUME_TAC(ARITH_RULE`3<4/\ 0 + 4 - 1= 3/\ 0+1=1/\ SUC 0=1/\ SUC i + 4 - 1=i+4/\ ~(4=0)/\ 2 MOD 4=2/\ 0 MOD 4=0/\ (i + 1) + 2= i+3/\ 2+2=4/\ 3+2=5 +/\ 3+1=4/\ 3+3=6/\ 6 MOD 4=2/\ 1 MOD 4=1/\ 3 MOD 4=3 +/\ 2+1=3/\ 2+3=5`) +THEN ASSUME_TAC(ARITH_RULE`i+4= 1*4+i/\ SUC i+1=i+2/\ SUC i + 3= i+4`) +THEN ASSUME_TAC(SCS_4I2_IS_SCS) +THEN ASSUME_TAC(K_SCS_4I2) +THEN ASSUME_TAC(SCS_4I2_BASIC) +THEN ASSUME_TAC(h0_LT_B_SCS_4I2) +THEN MRESAL_TAC SCS_4I2_GENERIC[`v`][IN] +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I2`;`v`] +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHEL_TAC 0[`i+4`;`i`][MOD_MULT_ADD;] +THEN MP_TAC CJBDXXN +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`scs_4I2`;`FF`;`4`;`i+1`;`v`][GSYM ADD1;B_LE_CSTAB_SCS_4I2] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MATCH_DICH_TAC 0 +THEN DICH_TAC 1 +THEN REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;ARITH_RULE`(~(4<=3))`;IN;K_SCS_4M8_prime;K_SCS_4M8;scs_prop_equ_v39;K_SCS_4I2] +THEN STRIP_TAC +THEN THAYTHEL_TAC 1[`SUC i`;`SUC(SUC i)`;][B_LE_CSTAB_SCS_4I2] +THEN MP_TAC(REAL_ARITH`scs_b_v39 scs_4I2 (SUC i) (SUC(SUC i)) <= cstab +/\ dist (v (SUC i), v(SUC(SUC i))) <= scs_b_v39 scs_4I2 (SUC i) (SUC(SUC i)) +==> dist ((v:num->real^3) (SUC i),v(SUC(SUC i))) <= cstab`) +THEN ASM_SIMP_TAC[B_LE_CSTAB_SCS_4I2] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[B_LE_CSTAB_SCS_4I2_prime] +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I2`;`v`] +THEN MRESAL_TAC SCS_4I2_3_LE_A[`i`;`v`;`i+2`][SCS_DIAG_4_ADD0;ARITH_RULE`SUC(SUC i)=i+2`] +THEN MP_TAC SCS_4I2_STRAIGHT +THEN RESA_TAC +THEN ASM_REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1] +THEN MRESA_TAC Rrcwnsj.BB_RHO_NODE_IVS[`V`;`E`;`scs_4I2`;`FF`;`v (SUC i)`;`v`;`SUC i`;`4`] +THEN THAYTHEL_ASM_TAC 2[`SUC i`][] +THEN MRESAL_TAC Rrcwnsj.BB_RHO_NODE_IVS[`V`;`E`;`scs_4I2`;`FF`;`v i`;`v`;`i`;`4`][ARITH_RULE`i+4-1=i+3`] +THEN REPEAT GEN_TAC +THEN REWRITE_TAC[SCS_DIAG_4_CASES;] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`i':num`;`j':num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN MRESAS_TAC Hexagons.PSORT_MOD[`4`;`i+2:num`;`1*4+i:num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1`;MOD_MULT_ADD] +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`i`;`2`;`4`] +THEN SYM_ASSUM_TAC +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHEL_TAC 0[`i'`;`i' MOD 4`][MOD_MULT_ADD;] +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHEL_TAC 0[`j'`;`j' MOD 4`][MOD_MULT_ADD;] +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHES_TAC 0[`i+1`;`(i+1) MOD 4`][MOD_REFL;] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC MOD_ADD_MOD[`i`;`1`;`4`] +THEN SYM_ASSUM_TAC +THEN STRIP_TAC +THEN MP_TAC SCS_DIAG_ADD1 +THEN RESA_TAC +THEN MRESA_TAC EXPAND_DIAG_4[`j+1`;`i+1`] +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHES_TAC 0[`j+1`;`(i+3) MOD 4`][MOD_REFL;] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC MOD_ADD_MOD[`i`;`3`;`4`] +THEN SYM_ASSUM_TAC +THEN STRIP_TAC +THEN DICH_TAC(37-4) +THEN ASM_REWRITE_TAC[]; + + +MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0+2=2`] +THEN SCS_TAC +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`i'`;`0`;`4`][Uxckfpe.ARITH_4_TAC] +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`j'`;`2`;`4`][Uxckfpe.ARITH_4_TAC] +THEN ASM_SIMP_TAC[DIST_SYM]; + + +MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0+2=2`] +THEN SCS_TAC +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`i'`;`1`;`4`][Uxckfpe.ARITH_4_TAC] +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`j'`;`3`;`4`][Uxckfpe.ARITH_4_TAC] +THEN ASM_SIMP_TAC[DIST_SYM]; + +MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0+2=2`] +THEN SCS_TAC +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`i'`;`2`;`4`][Uxckfpe.ARITH_4_TAC] +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`j'`;`0`;`4`][Uxckfpe.ARITH_4_TAC] +THEN ASM_SIMP_TAC[DIST_SYM]; + + +MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0+2=2`] +THEN SCS_TAC +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`i'`;`3`;`4`][Uxckfpe.ARITH_4_TAC] +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`j'`;`1`;`4`][Uxckfpe.ARITH_4_TAC] +THEN ASM_SIMP_TAC[DIST_SYM]]);; + +let EDGE_EQ_2_4I2_2=prove(`main_nonlinear_terminal_v11 +==>(!i j. MMs_v39 scs_4I2 v/\ +scs_diag 4 i j +/\ &3 <= dist (v i,v j) /\ +&3 < dist (v (i + 1),v (j + 1)) +==> dist (v (i+2) ,v (i + 3))= &2)`, +REPEAT STRIP_TAC +THEN MP_TAC EXPAND_DIAG_4_DIST +THEN RESA_TAC +THEN THAYTHE_TAC 0[`i`;`j`] +THEN MP_TAC EDGE_EQ_2_4I2_1 +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`i+2`;`i`][ARITH_RULE`SUC(i+2)=i+3/\ (i+2)+1= i+3`] +THEN MATCH_DICH_TAC 0 +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN MP_TAC SCS_DIAG_4_ADD0 +THEN REWRITE_TAC[scs_diag] +THEN RESA_TAC);; + + +let EDGE_EQ_2_4I2_3=prove(`main_nonlinear_terminal_v11 +==>(!i j. MMs_v39 scs_4I2 v/\ +scs_diag 4 i j +/\ &3 <= dist (v i,v j) /\ +&3 < dist (v (i + 1),v (j + 1)) +==> dist (v (i) ,v (i + 3))= &2)`, +REPEAT STRIP_TAC +THEN MP_TAC EXPAND_DIAG_4_DIST +THEN RESA_TAC +THEN THAYTHE_TAC 0[`i`;`j`] +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I2`;`v`] +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHES_TAC 0[`1*4+i`;`i`][MOD_MULT_ADD] +THEN MP_TAC EDGE_EQ_2_4I2 +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`i+2`;`i`][ARITH_RULE`SUC(SUC(i+2))=1*4+i/\ SUC (i+2)= i+3/\ (i+2)+1=i+3`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MATCH_DICH_TAC 0 +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN MP_TAC SCS_DIAG_4_ADD0 +THEN REWRITE_TAC[scs_diag] +THEN RESA_TAC);; + + + +let EDGE_EQ_2_4I2_ALL=prove(`main_nonlinear_terminal_v11 +==>( MMs_v39 scs_4I2 v/\ +scs_diag 4 i j +/\ &3 <= dist (v i,v j) /\ +&3 < dist (v (i + 1),v (j + 1)) +==> (!i. dist (v (i) ,v (i+1))= &2))`, +REPEAT RESA_TAC +THEN MP_TAC EDGE_EQ_2_4I2_3 +THEN RESA_TAC +THEN THAYTHE_TAC 0[`i`;`j`] +THEN MP_TAC EDGE_EQ_2_4I2_2 +THEN RESA_TAC +THEN THAYTHE_TAC 0[`i`;`j`] +THEN MP_TAC EDGE_EQ_2_4I2_1 +THEN RESA_TAC +THEN THAYTHE_TAC 0[`i`;`j`] +THEN MP_TAC EDGE_EQ_2_4I2 +THEN RESA_TAC +THEN THAYTHE_TAC 0[`i`;`j`] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN REWRITE_TAC[ARITH_RULE`SUC i=i+1/\ (i + 1) + 1= i+2`] +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I2`;`v`] +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHES_TAC 0[`i`;`i MOD 4`][MOD_REFL;ARITH_RULE`~(4=0)`] +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHES_TAC 0[`i+1`;`(i+1) MOD 4`][MOD_REFL;ARITH_RULE`~(4=0)`] +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHES_TAC 0[`i+2`;`(i+2) MOD 4`][MOD_REFL;ARITH_RULE`~(4=0)`] +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHES_TAC 0[`i+3`;`(i+3) MOD 4`][MOD_REFL;ARITH_RULE`~(4=0)`] +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHES_TAC 0[`i'+1`;`(i'+1) MOD 4`][MOD_REFL;ARITH_RULE`~(4=0)`] +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHES_TAC 0[`i'`;`(i') MOD 4`][MOD_REFL;ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`i`;`1`;`4`][ARITH_RULE`~(4=0)`] +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC MOD_ADD_MOD[`i'`;`1`;`4`][ARITH_RULE`~(4=0)`] +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC MOD_ADD_MOD[`i`;`2`;`4`][ARITH_RULE`~(4=0)`] +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC MOD_ADD_MOD[`i`;`3`;`4`][ARITH_RULE`~(4=0)`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`i' MOD 4<4==> i' MOD 4=0\/ i' MOD 4=1\/ i' MOD 4=2\/ i' MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`2+1=3/\ 3+1=4/\ 2+3=5/\ 2+2=4/\ 3+3=6/\ 3+2=5/\ 6 MOD 4=2`) +THEN SCS_TAC +THEN ASM_SIMP_TAC[DIST_SYM]);; + + + +let MM_4I2_IMP_4T2_4T1=prove_by_refinement (`main_nonlinear_terminal_v11 +==>(!i j. + MMs_v39 scs_4I2 v/\ + scs_diag 4 i j /\ + dist(v i,v j)<= cstab ==> + ~(MMs_v39 (scs_4T1)={})\/ ~(MMs_v39 (scs_4T2)={}))`, +[STRIP_TAC +THEN MATCH_MP_TAC ASSUME_MIN_DIAG +THEN REPEAT RESA_TAC +THEN MP_TAC SCS_DIAG_ADD1 +THEN RESA_TAC +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I2`;`v`] +THEN MRESA_TAC SCS_4I2_3_LE_A[`i`;`v`;`j`] +THEN MRESA_TAC SCS_4I2_3_LE_A[`i+1`;`v`;`j+1`] +THEN MP_TAC SCS_4I2_STRAIGHT_ALL +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&3 <= dist ((v:num->real^3) (i + 1),v (j + 1)) +==> dist (v (i + 1),v (j + 1))= &3\/ &3< dist (v (i + 1),v (j + 1))`) +THEN RESA_TAC; + + +MP_TAC(REAL_ARITH`dist (v i,v j) <= dist (v (i + 1),v (j + 1))/\ +&3 <= dist ((v:num->real^3) i,v j)/\ dist (v (i + 1),v (j + 1)) = &3 +==> dist ((v:num->real^3) i,v j)= &3`) +THEN RESA_TAC +THEN MATCH_MP_TAC (SET_RULE`A==> B\/A`) +THEN MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN REWRITE_TAC[IN;SET_RULE`~(A={})<=> ?a. a IN A`] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_4I2` +THEN ASM_SIMP_TAC[SCS_4T2_IS_SCS;SCS_4I2_IS_SCS;SCS_4I2_BASIC;SCS_4T2_BASIC;K_SCS_4I2;K_SCS_4T2] +THEN STRIP_TAC +; + + + + +DICH_TAC(14-6) +THEN REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;scs_diag;ARITH_RULE`(~(4<=3))`;IN;K_SCS_4M8_prime;K_SCS_4M8;scs_prop_equ_v39;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN SCS_TAC +THEN REWRITE_TAC[ARITH_RULE`~(4<=3)`] +THEN REPEAT STRIP_TAC +THEN MP_TAC DIST_DIAG_2_CASES_EQ_3 +THEN ASM_REWRITE_TAC[IN] +THEN DISCH_TAC +THEN MP_TAC(SET_RULE`i' MOD 4 = j' MOD 4\/ ~(i' MOD 4 = j' MOD 4)`) +THEN RESA_TAC; + + +THAYTHE_TAC 3[`i':num`;`j':num`] +; + + +MP_TAC(SET_RULE`j' MOD 4 = SUC i' MOD 4\/ ~(j' MOD 4 = SUC i' MOD 4)`) +THEN RESA_TAC +; + +THAYTHE_TAC 4[`i':num`;`j':num`] +; + + + +MP_TAC(SET_RULE`SUC j' MOD 4 = i' MOD 4\/ ~(SUC j' MOD 4 = i' MOD 4)`) +THEN RESA_TAC +; + +THAYTHE_TAC 5[`i':num`;`j':num`] +; + +MRESAL_TAC SCS_DIAG_4_CASES[`i'`;`j'`][scs_diag] +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I2`;`v`] +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +; + + +THAYTHEL_ASM_TAC 0[`j'`;`0`][ARITH_RULE`0 MOD 4=0`] +THEN THAYTHEL_ASM_TAC 0[`i'`;`2`][ARITH_RULE`2 MOD 4=2`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[REAL_ARITH`a<=a`]; + + +THAYTHEL_ASM_TAC 0[`j'`;`1`][ARITH_RULE`1 MOD 4=1`] +THEN THAYTHEL_ASM_TAC 0[`i'`;`3`][ARITH_RULE`3 MOD 4=3`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[REAL_ARITH`a<=a`]; + + +THAYTHEL_ASM_TAC 0[`i'`;`0`][ARITH_RULE`0 MOD 4=0`] +THEN THAYTHEL_ASM_TAC 0[`j'`;`2`][ARITH_RULE`2 MOD 4=2`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[REAL_ARITH`a<=a`]; + + +THAYTHEL_ASM_TAC 0[`i'`;`1`][ARITH_RULE`1 MOD 4=1`] +THEN THAYTHEL_ASM_TAC 0[`j'`;`3`][ARITH_RULE`3 MOD 4=3`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[REAL_ARITH`a<=a`]; + + +SCS_TAC +THEN REAL_ARITH_TAC; + + +MATCH_MP_TAC(SET_RULE`A==> A\/ B`) +THEN MP_TAC EDGE_EQ_2_4I2_ALL +THEN RESA_TAC +THEN MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN REWRITE_TAC[IN;SET_RULE`~(A={})<=> ?a. a IN A`] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_4I2` +THEN ASM_SIMP_TAC[SCS_4T1_IS_SCS;SCS_4I2_IS_SCS;SCS_4I2_BASIC;SCS_4T1_BASIC;K_SCS_4I2;K_SCS_4T1] +THEN STRIP_TAC +; + + + + +DICH_TAC(14-6) +THEN REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;scs_diag;ARITH_RULE`(~(4<=3))`;IN;K_SCS_4M8_prime;K_SCS_4M8;scs_prop_equ_v39;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN SCS_TAC +THEN REWRITE_TAC[ARITH_RULE`~(4<=3)`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`i' MOD 4 = j' MOD 4\/ ~(i' MOD 4 = j' MOD 4)`) +THEN RESA_TAC; + + +THAYTHE_TAC 2[`i':num`;`j':num`] +; + + +MP_TAC(SET_RULE`j' MOD 4 = SUC i' MOD 4\/ ~(j' MOD 4 = SUC i' MOD 4)`) +THEN RESA_TAC +; + + +MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I2`;`v`] +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHES_TAC 0[`j'`;`SUC i'`][MOD_REFL;ARITH_RULE`~(4=0)`;ADD1;REAL_ARITH`a<=a`] +; + + + + +MP_TAC(SET_RULE`SUC j' MOD 4 = i' MOD 4\/ ~(SUC j' MOD 4 = i' MOD 4)`) +THEN RESA_TAC +; + + + +MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I2`;`v`] +THEN MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I2`][SCS_4I2_IS_SCS;K_SCS_4I2] +THEN THAYTHES_TAC 0[`i'`;`SUC j'`][MOD_REFL;ARITH_RULE`~(4=0)`;ADD1;REAL_ARITH`a<=a`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[REAL_ARITH`a<=a`] +; + +THAYTHE_TAC 4[`i'`;`j'`] +; + + + +SCS_TAC +THEN REAL_ARITH_TAC +; + +]);; + + + +let ARDBZYE=prove_by_refinement(`main_nonlinear_terminal_v11 +==> scs_arrow_v39 { scs_4I2 } { scs_4T1, scs_4T2 }`, +[ +STRIP_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;SET_RULE`a IN {b,c}<=> a=b\/ a=c`] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +ASM_SIMP_TAC[SCS_4T1_IS_SCS;SCS_4T2_IS_SCS]; + +ASM_SIMP_TAC[SCS_4T1_IS_SCS;SCS_4T2_IS_SCS]; + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_4I2 ==> MMs_v39 s = {}) \/ ~((!s. s = scs_4I2 ==> MMs_v39 s = {}))`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC; + +MP_TAC(SET_RULE`(!i j. scs_diag 4 i j ==> cstab < dist(v i,v j))\/ ~((!i j. scs_diag 4 i j ==> cstab < dist((v:num->real^3) i,v j)))`) +THEN RESA_TAC; + +EXISTS_TAC`scs_4T1` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC SCS_4I2_IMP_SCS_4T1 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;REAL_ARITH`~(a b<=a`] +THEN STRIP_TAC +THEN MP_TAC MM_4I2_IMP_4T2_4T1 +THEN RESA_TAC +THEN THAYTHE_TAC 0[`i`;`j`] +THEN DICH_TAC 0 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC; + +EXISTS_TAC`scs_4T1` +THEN REWRITE_TAC[] +THEN EXISTS_TAC`v':num->real^3` +THEN ASM_REWRITE_TAC[]; + +EXISTS_TAC`scs_4T2` +THEN REWRITE_TAC[] +THEN EXISTS_TAC`v':num->real^3` +THEN ASM_REWRITE_TAC[]]);; + + + +let SCS_4I1_IMP_SCS_4I2= prove_by_refinement +(`main_nonlinear_terminal_v11 +==>(!v. + v IN MMs_v39 scs_4I1 /\ + (!i j. scs_diag 4 i j ==> cstab < dist(v i,v j)) ==> + ~(MMs_v39 (scs_4I2)={}))`, +[ +REWRITE_TAC[IN;SET_RULE`~(A={})<=> ?a. a IN A`] +THEN REPEAT STRIP_TAC +THEN MP_TAC SCS_4I1_IS_SCS +THEN STRIP_TAC +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I1`;`v`] +THEN ASSUME_TAC SCS_4I1_BASIC +THEN ASSUME_TAC K_SCS_4I1 +THEN ASSUME_TAC SCS_4I2_BASIC +THEN ASSUME_TAC K_SCS_4I2 +THEN ASSUME_TAC SCS_4I2_IS_SCS +THEN MP_TAC Rrcwnsj.RRCWNSJ +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4I1`;`v`][ARITH_RULE`3<4`;h0_LT_B_SCS_4I1;B_LE_CSTAB_SCS_4I1] +THEN MP_TAC JCYFMRP_V3 +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4I1`;`v`][ARITH_RULE`3<4`;h0_LT_B_SCS_4I1;B_LE_CSTAB_SCS_4I1;IN;CARD_SCS_M_4I1;GSYM ADD1;A_LT_B_4I1] +THEN MP_TAC Jlxfdmj.JLXFDMJ +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4I1`;`v`;`i`][ARITH_RULE`3<4`;h0_LT_B_SCS_4I1;B_LE_CSTAB_SCS_4I1;IN;CARD_SCS_M_4I1;GSYM ADD1;A_LT_B_4I1;SCS_M_4I1;SET_RULE`~{} (j MOD 4)<=> T`] +THEN MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN REWRITE_TAC[IN;SET_RULE`~(A={})<=> ?a. a IN A`] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_4I1` +THEN ASM_SIMP_TAC[SCS_M_4I1] +THEN STRIP_TAC; + + +DICH_TAC(13-4) +THEN REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;scs_diag;ARITH_RULE`(~(4<=3))`;IN;K_SCS_4I1;K_SCS_4I2;scs_prop_equ_v39;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN SCS_TAC +THEN REWRITE_TAC[ARITH_RULE`~(4<=3)`] +THEN REPEAT STRIP_TAC; + +MP_TAC(SET_RULE`i' MOD 4 = j MOD 4\/ ~(i' MOD 4 = j MOD 4)`) +THEN RESA_TAC; + +THAYTHE_TAC 2[`i'`;`j`]; + +MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I1`;`v`] +THEN MP_TAC(SET_RULE`SUC i' MOD 4 = j MOD 4\/ ~(SUC i' MOD 4 = j MOD 4)`) +THEN RESA_TAC; + +THAYTHE_TAC (19-15)[`i'`;`j`]; + +MP_TAC(SET_RULE`i' MOD 4 =SUC j MOD 4\/ ~(i' MOD 4 =SUC j MOD 4)`) +THEN RESA_TAC; + +THAYTHE_TAC (20-15)[`i'`;`j`]; + +THAYTHEL_TAC (20-2)[`i'`;`j`][scs_diag;cstab] +THEN DICH_TAC 0 +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC]);; + + +let SCS_4I1_STAB_DIAG=prove_by_refinement(`!v i j. + BBs_v39 scs_4I1 v/\ + scs_diag 4 i j /\ + dist(v i,v j) <= cstab + ==> + BBs_v39 (scs_stab_diag_v39 scs_4I1 i j) v`, +[ +REWRITE_TAC[IN] +THEN REPEAT STRIP_TAC +THEN DICH_TAC 2 +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC th +THEN MP_TAC th) +THEN +REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4I1;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4I1;Terminal.FUNLIST_EXPLICIT;] +THEN ASM_SIMP_TAC[] +THEN REPEAT RESA_TAC +THEN SCS_TAC +THEN MP_TAC(SET_RULE`psort 4 (i,j) = psort 4 (i',j')\/ ~(psort 4 (i,j) = psort 4 (i',j'))`) +THEN RESA_TAC; + +MRESAL_TAC Uaghhbm.CASE_PSORT[`i'`;`j`;`j'`;`i`;`4`][PSORT_5_EXPLICIT]; + +MRESAL_TAC BB_VV_FUN_EQ[`v`;`scs_4I1`][SCS_4I1_IS_SCS;K_SCS_4I1] +THEN THAYTHE_TAC 0[`i'`;`i`] +THEN MRESAL_TAC BB_VV_FUN_EQ[`v`;`scs_4I1`][SCS_4I1_IS_SCS;K_SCS_4I1] +THEN THAYTHE_TAC 0[`j'`;`j`]; + +MRESAL_TAC BB_VV_FUN_EQ[`v`;`scs_4I1`][SCS_4I1_IS_SCS;K_SCS_4I1] +THEN THAYTHE_TAC 0[`j'`;`i`] +THEN MRESAL_TAC BB_VV_FUN_EQ[`v`;`scs_4I1`][SCS_4I1_IS_SCS;K_SCS_4I1] +THEN THAYTHE_TAC 0[`i'`;`j`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]]);; + + + +let STAB_4I1_SCS=prove(` scs_diag (scs_k_v39 scs_4I1) i j +==> is_scs_v39 (scs_stab_diag_v39 scs_4I1 i j)/\ scs_basic_v39 (scs_stab_diag_v39 scs_4I1 i j)`, +STRIP_TAC +THEN MATCH_MP_TAC Yrtafyh.YRTAFYH +THEN ASM_REWRITE_TAC[SCS_K_D_A_STAB_EQ;SCS_4I1_IS_SCS;SCS_4I1_BASIC;K_SCS_4I1; +ARITH_RULE`3<4`;LET_DEF;LET_END_DEF;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;h0;cstab] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC);; + +let MM_4I1_IMP_STAB_4I1=prove(` + MMs_v39 scs_4I1 v/\ + scs_diag 4 i j /\ + dist(v i,v j) <= cstab + ==> + ~(MMs_v39 (scs_stab_diag_v39 scs_4I1 i j) ={})`, + +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_4I1` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I1`;`v`] +THEN ASSUME_TAC SCS_4I1_BASIC +THEN ASSUME_TAC K_SCS_4I1 +THEN ASM_SIMP_TAC[SCS_4I1_IS_SCS;STAB_4I1_SCS;K_SCS_4I1;SCS_K_D_A_STAB_EQ;IN; ADD1;SCS_4I1_STAB_DIAG] +THEN REAL_ARITH_TAC);; + + +let SCS_4I1_ARROW_SCS_4I2_STAB_4I1=prove_by_refinement( +`main_nonlinear_terminal_v11 +==> scs_arrow_v39 { scs_4I1 } ({scs_4I2} UNION {scs_stab_diag_v39 scs_4I1 i j| scs_diag 4 i j})`, +[STRIP_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;UNION;IN_ELIM_THM] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +ASM_SIMP_TAC[SCS_4I2_IS_SCS]; + +ASM_SIMP_TAC[STAB_4I1_SCS;K_SCS_4I1]; + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_4I1 ==> MMs_v39 s = {}) \/ ~((!s. s = scs_4I1 ==> MMs_v39 s = {}))`); + +ASM_REWRITE_TAC[]; + + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC; + +MP_TAC(SET_RULE`(!i j. scs_diag 4 i j ==> cstab < dist(v i,v j))\/ ~((!i j. scs_diag 4 i j ==> cstab < dist((v:num->real^3) i,v j)))`) +THEN RESA_TAC; + +EXISTS_TAC`scs_4I2` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC SCS_4I1_IMP_SCS_4I2 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;REAL_ARITH`~(a b<=a`] +THEN STRIP_TAC +THEN MP_TAC MM_4I1_IMP_STAB_4I1 +THEN RESA_TAC +THEN DICH_TAC 0 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC +THEN EXISTS_TAC `scs_stab_diag_v39 scs_4I1 i j` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +MATCH_MP_TAC(SET_RULE`A==> B\/A`) +THEN EXISTS_TAC`i:num` +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[]; + +EXISTS_TAC`v':num->real^3` +THEN ASM_REWRITE_TAC[]]);; + + +let SET_STAB_4I1=prove(`{ scs_stab_diag_v39 scs_4I1 i j| scs_diag 4 i j }= { scs_stab_diag_v39 scs_4I1 (i MOD 4) (j MOD 4)| scs_diag 4 (i MOD 4) (j MOD 4) }`, + ASM_SIMP_TAC[STAB_MOD;DIAG_MOD;EXTENSION;IN_ELIM_THM;ARITH_RULE`~(4=0)`;] +THEN MRESAL_TAC STAB_MOD[`scs_4I1`][SCS_4I1_IS_SCS;K_SCS_4I1]);; + +let EXPAND_DIAG_4V=prove_by_refinement( +`scs_diag 4 i j <=> j MOD 4= (i+2) MOD 4`, +[ +EQ_TAC +THEN ASM_SIMP_TAC[EXPAND_DIAG_4;] +THEN REWRITE_TAC[SCS_DIAG_4_CASES;ARITH_RULE`i+2=SUC(SUC i)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC; + +MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`0`;`4`][Uxckfpe.ARITH_4_TAC] +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`SUC i`;`1`;`4`][Uxckfpe.ARITH_4_TAC]; + +MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`1`;`4`][Uxckfpe.ARITH_4_TAC] +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`SUC i`;`2`;`4`][Uxckfpe.ARITH_4_TAC]; + +MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`2`;`4`][Uxckfpe.ARITH_4_TAC] +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`SUC i`;`3`;`4`][Uxckfpe.ARITH_4_TAC]; + +MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`i`;`3`;`4`][Uxckfpe.ARITH_4_TAC] +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`SUC i`;`4`;`4`][Uxckfpe.ARITH_4_TAC]]);; + + +let EXPAND_STAB_DIAG_4=prove_by_refinement(`is_scs_v39 s /\scs_k_v39 s=4==> +{scs_stab_diag_v39 s (i MOD 4) (j MOD 4) | j MOD 4 = + (i MOD 4 + 2) MOD 4}= +{scs_stab_diag_v39 s (i+2) i| i<4} `, +[REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;UNION] +THEN STRIP_TAC +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MRESAS_TAC STAB_MOD[`s`;`i MOD 4`;`i MOD 4 + 2`][MOD_REFL;ARITH_RULE`~(4=0)`] +THEN EXISTS_TAC`i MOD 4` +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`;STAB_SYM]; + +EXISTS_TAC`i+2` +THEN EXISTS_TAC`i:num` +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`;MOD_LT] +THEN MRESAS_TAC STAB_MOD[`s`;`(i + 2)`;`i`][SCS_5I1_IS_SCS;K_SCS_5I1;MOD_REFL;ARITH_RULE`~(4=0)`;MOD_LT] +THEN MRESAS_TAC MOD_ADD_MOD[`i+2`;`2`;`4`][ARITH_RULE`~(4=0)/\ 2 MOD 4=2/\ (i + 2) + 2= 1*4+i`;MOD_MULT_ADD;MOD_LT]]);; + + + +let EXPAND_STAB_DIAG_4I1=prove(` +{scs_stab_diag_v39 scs_4I1 (i MOD 4) (j MOD 4) | j MOD 4 = + (i MOD 4 + 2) MOD 4}= +{scs_stab_diag_v39 scs_4I1 (i+2) i| i<4} `, +ASM_SIMP_TAC[EXPAND_STAB_DIAG_4;SCS_4I1_IS_SCS;K_SCS_4I1]);; + + + +let h0_EQ_B_SCS_4I1=prove( +`(!i j. scs_diag 4 i j ==> scs_b_v39 scs_4I1 i j= &6) +/\ (!i j. scs_diag 4 i j ==> scs_a_v39 scs_4I1 i j= &2 *h0)`, +SCS_TAC +THEN REWRITE_TAC[h0;scs_diag;cstab] +THEN REPEAT RESA_TAC);; + + + +let EQ_DIAG_STAB_4I1_02=prove(`scs_arrow_v39 + {scs_stab_diag_v39 scs_4I1 (i + 2) i } + {scs_stab_diag_v39 scs_4I1 0 2}`, +MRESA_TAC STAB_SYM[`scs_4I1`;`2`;`0`] +THEN MP_TAC (GEN_ALL Wkeidft.WKEIDFT) +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_SIMP_TAC[ARITH_RULE`2 + i = (i + 2) + 0/\ 3<6/\ i+1= SUC i`;K_SCS_4I1 +;h0_LT_B_SCS_4I1;h0_EQ_B_SCS_4I1;SCS_4I1_IS_SCS;SCS_4I1_BASIC] +THEN SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`1<4`;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&2` +THEN EXISTS_TAC`&2 *h0` +THEN EXISTS_TAC`&2 *h0` +THEN EXISTS_TAC`&6` +THEN ASM_SIMP_TAC[] +THEN MP_TAC SCS_DIAG_4_ADD0 +THEN ASM_REWRITE_TAC[scs_diag] +THEN RESA_TAC +THEN ARITH_TAC);; + + + +let SET_EQ_DIAG_STAB_4I1_02=prove(`scs_arrow_v39 + {scs_stab_diag_v39 scs_4I1 (i + 2) i |i<4} + {scs_stab_diag_v39 scs_4I1 0 2}`, +REWRITE_TAC[ARITH_RULE`i<4<=> i=0\/i=1\/i=2\/i=3`;SET_RULE`{scs_stab_diag_v39 scs_4I1 (i + 2) i |i=0\/i=1\/i=2\/i=3} += {scs_stab_diag_v39 scs_4I1 (0 + 2) 0} UNION +{scs_stab_diag_v39 scs_4I1 (1 + 2) 1} UNION +{scs_stab_diag_v39 scs_4I1 (2 + 2) 2} UNION +{scs_stab_diag_v39 scs_4I1 (3 + 2) 3} +`;] +THEN REPEAT (ONCE_REWRITE_TAC[SET_RULE`{scs_stab_diag_v39 scs_4I1 0 2}={scs_stab_diag_v39 scs_4I1 0 2} UNION {scs_stab_diag_v39 scs_4I1 0 2}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[EQ_DIAG_STAB_4I1_02]));; + + + +let SET_EQ_DIAG_STAB_4I1=prove(`scs_arrow_v39 + { scs_stab_diag_v39 scs_4I1 i j| scs_diag 4 i j } + {scs_stab_diag_v39 scs_4I1 0 2}`, +ASM_SIMP_TAC[SET_STAB_4I1] +THEN ASM_SIMP_TAC[EXPAND_DIAG_4V;MOD_REFL;ARITH_RULE`~(4=0)`;EXPAND_STAB_DIAG_4I1;SET_EQ_DIAG_STAB_4I1_02]);; + +let FYSSVEV= prove(` +main_nonlinear_terminal_v11 + ==> +scs_arrow_v39 { scs_4I1 } {scs_4I2, scs_stab_diag_v39 scs_4I1 0 2 }`, +STRIP_TAC +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`({scs_4I2} UNION {scs_stab_diag_v39 scs_4I1 i j| scs_diag 4 i j})` +THEN ASM_SIMP_TAC[SCS_4I1_ARROW_SCS_4I2_STAB_4I1;SET_RULE`{A,B}={A}UNION {B}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[SET_EQ_DIAG_STAB_4I1] +THEN MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[SCS_4I2_IS_SCS]);; + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/AUEAHEH.hl b/text_formalization/local/AUEAHEH.hl new file mode 100644 index 0000000..f74254e --- /dev/null +++ b/text_formalization/local/AUEAHEH.hl @@ -0,0 +1,2994 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Aueaheh = struct + + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +open Yxionxl2;; +open Eyypqdw;; +open Ocbicby;; +open Imjxphr;; +open Nuxcoea;; +open Aursipd;; +open Cuxvzoz;; +open Rrcwnsj;; +open Tfitskc;; +open Hexagons;; +open Otmtotj;; +open Hijqaha;; +open Cnicgsf;; +open Ardbzye;; + + + +let SCS_DIAG_SCS_4I1_02=prove(`scs_diag (scs_k_v39 scs_4I1) 0 2`, +REWRITE_TAC[K_SCS_4I1;scs_diag] +THEN ARITH_TAC);; + + + +let SCS_4I1_SLICE_02=prove_by_refinement( +`scs_arrow_v39 {scs_stab_diag_v39 scs_4I1 0 2 } { scs_prop_equ_v39 scs_3M1 1}`, +[ONCE_REWRITE_TAC[SET_RULE`{ scs_prop_equ_v39 scs_3M1 1}={ scs_prop_equ_v39 scs_3M1 1, scs_prop_equ_v39 scs_3M1 1}`] +THEN +MATCH_MP_TAC (GEN_ALL Lkgrqui.LKGRQUI) +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4I1_02;STAB_4I1_SCS;SCS_K_D_A_STAB_EQ;] +THEN EXISTS_TAC`0` +THEN EXISTS_TAC`2` +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4I1_02] +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ] +THEN REPEAT RESA_TAC; + + +REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ;scs_slice_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC scs_inj +THEN ASM_SIMP_TAC[SCS_3M1_BASIC;SCS_4I1_BASIC;J_SCS_4I1;BASIC_HALF_SLICE_STAB;J_SCS_3M1;D_HALF_SLICE;BAISC_PROP_EQU;K_SCS_PROP_EUQ;SCS_4I1_BASIC] +THEN STRIP_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3M1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4I1] +THEN ARITH_TAC; + + + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3M1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4I1;scs_3T4_prime;scs_5M3; +ARITH_RULE`(2 + 1 + 4 - 0) MOD 4= 3/\ 0 MOD 4=0/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`1+x:num`;`1+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3M1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4I1] +THEN ARITH_TAC; + + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3M1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4I1;scs_3T4_prime;scs_5M3; +ARITH_RULE`(0 + 1 + 4 - 2) MOD 4= 3/\ 2 MOD 4=2/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`1+x:num`;`1+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + + + +SCS_TAC +THEN REAL_ARITH_TAC; + + + +SCS_TAC +THEN REAL_ARITH_TAC; + + + +SCS_TAC +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[J_SCS_3M1]; + +]);; + + + +let AUEAHEH=prove(`scs_arrow_v39 {scs_stab_diag_v39 scs_4I1 0 2 } {scs_3M1}`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{ scs_prop_equ_v39 scs_3M1 1}` +THEN ASM_REWRITE_TAC[SCS_4I1_SLICE_02] +THEN MRESAS_TAC PRO_EQU_ID1[`scs_3M1`;`1`;`3`][SCS_3M1_IS_SCS;K_SCS_3M1;ARITH_RULE`(3 - 1 MOD 3)=2`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_3M1 1`;`2`][PROP_EQU_IS_SCS;SCS_3M1_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]);; + + +(*************************) + +let BB_4I3_IMP_4T4=prove(`!v. + BBs_v39 (scs_stab_diag_v39 scs_4I3 1 3) v + ==> + BBs_v39 (scs_4T4) v`, +SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4I3;scs_4T4;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4I3;Terminal.FUNLIST_EXPLICIT;] +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC 1[`i`;`j`] +THEN DICH_TAC 0 +THEN MP_TAC(SET_RULE`psort 4 (i,j) = 1,3\/ ~(psort 4 (i,j) = 1,3)`) +THEN RESA_TAC +THEN MRESAL_TAC Uaghhbm.CASE_PSORT[`i`;`3`;`j`;`1`;`4`][PSORT_5_EXPLICIT;Uxckfpe.ARITH_4_TAC;PAIR_EQ;cstab] +THEN DICH_TAC 0 +THEN SCS_TAC +THEN RESA_TAC +THEN SCS_TAC);; + +let STAB_4I3_SCS=prove(` scs_diag (scs_k_v39 scs_4I3) i j +==> is_scs_v39 (scs_stab_diag_v39 scs_4I3 i j)/\ scs_basic_v39 (scs_stab_diag_v39 scs_4I3 i j)`, +STRIP_TAC +THEN MATCH_MP_TAC Yrtafyh.YRTAFYH +THEN ASM_REWRITE_TAC[SCS_K_D_A_STAB_EQ;SCS_4I3_IS_SCS;SCS_4I3_BASIC;K_SCS_4I3; +ARITH_RULE`3<4`;LET_DEF;LET_END_DEF;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;h0;cstab] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC);; + +let STAB_4M2_SCS=prove(` scs_diag (scs_k_v39 scs_4M2) i j +==> is_scs_v39 (scs_stab_diag_v39 scs_4M2 i j)/\ scs_basic_v39 (scs_stab_diag_v39 scs_4M2 i j)`, +STRIP_TAC +THEN MATCH_MP_TAC Yrtafyh.YRTAFYH +THEN ASM_REWRITE_TAC[SCS_K_D_A_STAB_EQ;SCS_4M2_IS_SCS;SCS_4M2_BASIC;K_SCS_4M2; +ARITH_RULE`3<4`;LET_DEF;LET_END_DEF;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;h0;cstab] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC);; + + +let STAB_4M3_SCS=prove(` scs_diag (scs_k_v39 scs_4M3') i j +==> is_scs_v39 (scs_stab_diag_v39 scs_4M3' i j)/\ scs_basic_v39 (scs_stab_diag_v39 scs_4M3' i j)`, +STRIP_TAC +THEN MATCH_MP_TAC Yrtafyh.YRTAFYH +THEN ASM_REWRITE_TAC[SCS_K_D_A_STAB_EQ;SCS_4M3_IS_SCS;SCS_4M3_BASIC;K_SCS_4M3; +ARITH_RULE`3<4`;LET_DEF;LET_END_DEF;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;h0;cstab] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC sqrt8_LE_CSTAB +THEN MP_TAC LE_sqrt8_2h0 +THEN REAL_ARITH_TAC);; + +let STAB_4M4_SCS=prove(` scs_diag (scs_k_v39 scs_4M4') i j +==> is_scs_v39 (scs_stab_diag_v39 scs_4M4' i j)/\ scs_basic_v39 (scs_stab_diag_v39 scs_4M4' i j)`, +STRIP_TAC +THEN MATCH_MP_TAC Yrtafyh.YRTAFYH +THEN ASM_REWRITE_TAC[SCS_K_D_A_STAB_EQ;SCS_4M4_IS_SCS;SCS_4M4_BASIC;K_SCS_4M4; +ARITH_RULE`3<4`;LET_DEF;LET_END_DEF;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;h0;cstab] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC sqrt8_LE_CSTAB +THEN MP_TAC LE_sqrt8_2h0 +THEN REAL_ARITH_TAC);; + + + +let STAB_4M5_SCS=prove(` scs_diag (scs_k_v39 scs_4M5') i j +==> is_scs_v39 (scs_stab_diag_v39 scs_4M5' i j)/\ scs_basic_v39 (scs_stab_diag_v39 scs_4M5' i j)`, +STRIP_TAC +THEN MATCH_MP_TAC Yrtafyh.YRTAFYH +THEN ASM_REWRITE_TAC[SCS_K_D_A_STAB_EQ;SCS_4M5_IS_SCS;SCS_4M5_BASIC;K_SCS_4M5; +ARITH_RULE`3<4`;LET_DEF;LET_END_DEF;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;h0;cstab] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC sqrt8_LE_CSTAB +THEN MP_TAC LE_sqrt8_2h0 +THEN REAL_ARITH_TAC);; + + + +let STAB_4M6_SCS=prove(` scs_diag (scs_k_v39 scs_4M6') i j +==> is_scs_v39 (scs_stab_diag_v39 scs_4M6' i j)/\ scs_basic_v39 (scs_stab_diag_v39 scs_4M6' i j)`, +STRIP_TAC +THEN MATCH_MP_TAC Yrtafyh.YRTAFYH +THEN ASM_REWRITE_TAC[SCS_K_D_A_STAB_EQ;SCS_4M6_IS_SCS;SCS_4M6_BASIC;K_SCS_4M6; +ARITH_RULE`3<4`;LET_DEF;LET_END_DEF;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;h0;cstab] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC sqrt8_LE_CSTAB +THEN MP_TAC LE_sqrt8_2h0 +THEN REAL_ARITH_TAC);; + + +let STAB_4M7_SCS=prove(` scs_diag (scs_k_v39 scs_4M7) i j +==> is_scs_v39 (scs_stab_diag_v39 scs_4M7 i j)/\ scs_basic_v39 (scs_stab_diag_v39 scs_4M7 i j)`, +STRIP_TAC +THEN MATCH_MP_TAC Yrtafyh.YRTAFYH +THEN ASM_REWRITE_TAC[SCS_K_D_A_STAB_EQ;SCS_4M7_IS_SCS;SCS_4M7_BASIC;K_SCS_4M7; +ARITH_RULE`3<4`;LET_DEF;LET_END_DEF;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;h0;cstab] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC sqrt8_LE_CSTAB +THEN MP_TAC LE_sqrt8_2h0 +THEN REAL_ARITH_TAC);; + + +let STAB_4M8_SCS=prove(` scs_diag (scs_k_v39 scs_4M8) i j +==> is_scs_v39 (scs_stab_diag_v39 scs_4M8 i j)/\ scs_basic_v39 (scs_stab_diag_v39 scs_4M8 i j)`, +STRIP_TAC +THEN MATCH_MP_TAC Yrtafyh.YRTAFYH +THEN ASM_REWRITE_TAC[SCS_K_D_A_STAB_EQ;SCS_4M8_IS_SCS;SCS_4M8_BASIC;K_SCS_4M8; +ARITH_RULE`3<4`;LET_DEF;LET_END_DEF;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;h0;cstab] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC sqrt8_LE_CSTAB +THEN MP_TAC LE_sqrt8_2h0 +THEN REAL_ARITH_TAC);; + +let SCS_DIAG_SCS_4I3_02=prove(`scs_diag (scs_k_v39 scs_4I3) 0 2`, +REWRITE_TAC[K_SCS_4I3;scs_diag] +THEN ARITH_TAC);; + +let SCS_DIAG_SCS_4I3_13=prove(`scs_diag (scs_k_v39 scs_4I3) 1 3`, +REWRITE_TAC[K_SCS_4I3;scs_diag] +THEN ARITH_TAC);; + + +let SCS_DIAG_SCS_4M2_02=prove(`scs_diag (scs_k_v39 scs_4M2) 0 2`, +REWRITE_TAC[K_SCS_4M2;scs_diag] +THEN ARITH_TAC);; + +let SCS_DIAG_SCS_4M2_13=prove(`scs_diag (scs_k_v39 scs_4M2) 1 3`, +REWRITE_TAC[K_SCS_4M2;scs_diag] +THEN ARITH_TAC);; + + +let SCS_DIAG_SCS_4M3_02=prove(`scs_diag (scs_k_v39 scs_4M3') 0 2`, +REWRITE_TAC[K_SCS_4M3;scs_diag] +THEN ARITH_TAC);; + +let SCS_DIAG_SCS_4M3_13=prove(`scs_diag (scs_k_v39 scs_4M3') 1 3`, +REWRITE_TAC[K_SCS_4M3;scs_diag] +THEN ARITH_TAC);; + +let SCS_DIAG_SCS_4M4_02=prove(`scs_diag (scs_k_v39 scs_4M4') 0 2`, +REWRITE_TAC[K_SCS_4M4;scs_diag] +THEN ARITH_TAC);; + +let SCS_DIAG_SCS_4M4_13=prove(`scs_diag (scs_k_v39 scs_4M4') 1 3`, +REWRITE_TAC[K_SCS_4M4;scs_diag] +THEN ARITH_TAC);; + +let SCS_DIAG_SCS_4M5_02=prove(`scs_diag (scs_k_v39 scs_4M5') 0 2`, +REWRITE_TAC[K_SCS_4M5;scs_diag] +THEN ARITH_TAC);; + +let SCS_DIAG_SCS_4M5_13=prove(`scs_diag (scs_k_v39 scs_4M5') 1 3`, +REWRITE_TAC[K_SCS_4M5;scs_diag] +THEN ARITH_TAC);; + +let SCS_DIAG_SCS_4M6_02=prove(`scs_diag (scs_k_v39 scs_4M6') 0 2`, +REWRITE_TAC[K_SCS_4M6;scs_diag] +THEN ARITH_TAC);; + +let SCS_DIAG_SCS_4M6_13=prove(`scs_diag (scs_k_v39 scs_4M6') 1 3`, +REWRITE_TAC[K_SCS_4M6;scs_diag] +THEN ARITH_TAC);; + + +let SCS_DIAG_SCS_4M7_02=prove(`scs_diag (scs_k_v39 scs_4M7) 0 2`, +REWRITE_TAC[K_SCS_4M7;scs_diag] +THEN ARITH_TAC);; + +let SCS_DIAG_SCS_4M7_13=prove(`scs_diag (scs_k_v39 scs_4M7) 1 3`, +REWRITE_TAC[K_SCS_4M7;scs_diag] +THEN ARITH_TAC);; + +let SCS_DIAG_SCS_4M8_02=prove(`scs_diag (scs_k_v39 scs_4M8) 0 2`, +REWRITE_TAC[K_SCS_4M8;scs_diag] +THEN ARITH_TAC);; + +let SCS_DIAG_SCS_4M8_13=prove(`scs_diag (scs_k_v39 scs_4M8) 1 3`, +REWRITE_TAC[K_SCS_4M8;scs_diag] +THEN ARITH_TAC);; + + +let MM_4I3_IMP_4T4=prove(`MMs_v39 (scs_stab_diag_v39 scs_4I3 1 3) v + ==> + ~(MMs_v39 (scs_4T4) ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`(scs_stab_diag_v39 scs_4I3 1 3)` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`(scs_stab_diag_v39 scs_4I3 1 3)`;`v`] +THEN ASSUME_TAC SCS_4T4_BASIC +THEN ASSUME_TAC K_SCS_4T4 +THEN ASM_SIMP_TAC[SCS_4T4_IS_SCS;STAB_4I3_SCS;K_SCS_4I3;SCS_K_D_A_STAB_EQ;IN; ADD1;SCS_DIAG_SCS_4I3_13;BB_4I3_IMP_4T4] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + + + let SCS_4I3_ARROW_4T4 =prove_by_refinement(`scs_arrow_v39 { scs_stab_diag_v39 scs_4I3 1 3 } { scs_4T4 }`, +[ +REPEAT GEN_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;IN] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +ASM_SIMP_TAC[SCS_4T4_IS_SCS]; + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_stab_diag_v39 scs_4I3 1 3 ==> MMs_v39 s = {}) \/ ~((!s. s = scs_stab_diag_v39 scs_4I3 1 3 ==> MMs_v39 s = {}))`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`scs_4T4` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC (GEN_ALL MM_4I3_IMP_4T4) +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]);; + + + +let PROP_OPP_DIAG_4I3_13= prove_by_refinement(`scs_stab_diag_v39 scs_4I3 1 3= scs_prop_equ_v39(scs_opp_v39 (scs_stab_diag_v39 scs_4I3 0 2)) 2 `, +[REWRITE_TAC[scs_prop_equ_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39;SCS_K_D_A_STAB_EQ;scs_opp_v39] +THEN MATCH_MP_TAC scs_inj +THEN SIMP_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;SCS_4I3_BASIC;STAB_4I3_SCS;SCS_DIAG_SCS_4I3_13;scs_basic;unadorned_v39;peropp;peropp2] +THEN SCS_TAC +THEN STRIP_TAC; + +SET_TAC[]; + + +STRIP_TAC +THEN ASM_REWRITE_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_5M3;mk_unadorned_v39;peropp;peropp2;FUN_EQ_THM;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN REPEAT GEN_TAC +THEN ASSUME_TAC (ARITH_RULE`~(4=0)`) +THEN MRESA_TAC PSORT_MOD[`4`;`x`;`x'`] +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`2`;`x`;`4`] +THEN MRESA_TAC MOD_ADD_MOD[`2`;`x'`;`4`] +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`x MOD 4<4==> x MOD 4=0\/ x MOD 4=1\/ x MOD 4=2\/ x MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 4<4==> x' MOD 4=0\/ x' MOD 4=1\/ x' MOD 4=2\/ x' MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[Uxckfpe.ARITH_4_TAC;PSORT_5_EXPLICIT;ARITH_RULE`4-1=3/\ 4-2=2/\ 4-3=1/\ 4-4=0/\ 5-5=0/\ 2+0=2/\ 2+1=3/\ 2+2=4/\ 2+3=5/\2+4=6 +/\ 3+0=3/\ 3+1=4/\ 3+2=5/\ 3+3=6/\ 3+4=7/\ 7 MOD 5=2`;PAIR_EQ;Terminal.FUNLIST_EXPLICIT;]]);; + + + + + +let STAB_4I3_02_ARROW_4I3_13=prove(`scs_arrow_v39 {scs_stab_diag_v39 scs_4I3 0 2}{scs_stab_diag_v39 scs_4I3 1 3}`, +ASM_SIMP_TAC[PROP_OPP_DIAG_4I3_13] +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_opp_v39 (scs_stab_diag_v39 scs_4I3 0 2)}` +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC (GEN_ALL YXIONXL2) +THEN EXISTS_TAC`4` +THEN ASM_SIMP_TAC[SCS_K_D_A_STAB_EQ;ARITH_RULE`~(4<=3)`;K_SCS_4I3;STAB_4I3_SCS;SCS_DIAG_SCS_4I3_02] +; + +MATCH_MP_TAC(GEN_ALL YXIONXL3) +THEN MATCH_MP_TAC (GEN_ALL OPP_IS_SCS) +THEN EXISTS_TAC`scs_opp_v39 (scs_stab_diag_v39 scs_4I3 0 2)` +THEN ASM_SIMP_TAC[SCS_K_D_A_STAB_EQ;ARITH_RULE`~(4<=3)`;K_SCS_4I3;STAB_4I3_SCS;SCS_DIAG_SCS_4I3_02]]);; + + + +let ZNLLLDL=prove(`scs_arrow_v39 { scs_stab_diag_v39 scs_4I3 0 2 } { scs_4T4 }`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_stab_diag_v39 scs_4I3 1 3}` +THEN ASM_SIMP_TAC[STAB_4I3_02_ARROW_4I3_13;SCS_4I3_ARROW_4T4]);; + + +(******************) + +let h0_LT_B_SCS_4I3=prove(` +(!i j. scs_diag 4 i j ==> &4 * h0 < scs_b_v39 scs_4I3 i j) +/\ (!i j. scs_diag 4 i j ==> scs_a_v39 scs_4I3 i j <= cstab)`, +SCS_TAC +THEN REWRITE_TAC[h0;SCS_DIAG_4_CASES;cstab] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)`) +THEN MRESA_TAC PSORT_MOD[`4`;`i`;`j`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC);; + + +let B_LE_CSTAB_SCS_4I3=prove( +` (!i. scs_b_v39 scs_4I3 i (SUC i) <= cstab)`, +SCS_TAC +THEN REWRITE_TAC[h0;scs_diag;cstab] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`1<4`;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ 2+1=3/\ 3+1=4`) +THEN MRESA_TAC PSORT_MOD[`4`;`i`;`SUC i`] +THEN SYM_ASSUM_TAC +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_ADD_MOD[`i`;`1`;`4`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC);; + + + +let BB_4I3_IMP_BB_4M6= prove +(` + BBs_v39 scs_4I3 v /\ + (!i j. scs_diag 4 i j ==> cstab < dist(v i,v j)) ==> + BBs_v39 (scs_4M6') v`, +SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4I3;scs_4M6;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4I3;Terminal.FUNLIST_EXPLICIT;K_SCS_4M6] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ 2+1=3/\ 3+1=4`) +THEN SCS_TAC +THEN THAYTHE_TAC 1[`i`;`j`] +THEN DICH_TAC 0 +THEN THAYTHE_TAC 2[`i`;`j`] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN MRESA_TAC PSORT_MOD[`4`;`i`;`j`] +THEN SYM_ASSUM_TAC +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_ADD_MOD[`i`;`1`;`4`] +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`j`;`1`;`4`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`j MOD 4<4==> j MOD 4=0\/ j MOD 4=1\/ j MOD 4=2\/ j MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN MP_TAC sqrt8_LE_CSTAB +THEN REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC);; + + + +let MM_4I3_IMP_4M6=prove(` +MMs_v39 scs_4I3 v /\ + (!i j. scs_diag 4 i j ==> cstab < dist(v i,v j)) ==> + ~(MMs_v39 (scs_4M6') ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC` scs_4I3 ` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I3 `;`v`] +THEN ASSUME_TAC SCS_4M6_BASIC +THEN ASSUME_TAC K_SCS_4M6 +THEN ASM_SIMP_TAC[SCS_4M6_IS_SCS;SCS_4I3_IS_SCS;SCS_4I3_BASIC;K_SCS_4I3;SCS_K_D_A_STAB_EQ;IN; ADD1;SCS_DIAG_SCS_4I3_13;BB_4I3_IMP_BB_4M6] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + + +let BB_4I3_IMP_BB_STAN_4I3= prove(` + BBs_v39 scs_4I3 v /\ + scs_diag 4 i j /\ + dist(v i,v j)<= cstab ==> + BBs_v39 (scs_stab_diag_v39 scs_4I3 i j) v`, +SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4I3;scs_4M6;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4I3;Terminal.FUNLIST_EXPLICIT;K_SCS_4M6] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ 2+1=3/\ 3+1=4`) +THEN SCS_TAC +THEN MP_TAC(SET_RULE`psort 4 (i,j) = psort 4 (i',j')\/ ~(psort 4 (i,j) = psort 4 (i',j'))`) +THEN RESA_TAC +THEN MRESA_TAC Uaghhbm.CASE_PSORT[`i`;`j'`;`j`;`i'`;`4`] +THENL[ +MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I3`][scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4I3;scs_4M6;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4I3;Terminal.FUNLIST_EXPLICIT;K_SCS_4M6;SCS_4I3_IS_SCS] +THEN THAYTHEL_ASM_TAC 0[`i'`;`i`][] +THEN THAYTHEL_ASM_TAC 0[`j'`;`j`][]; + +MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4I3`][scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4I3;scs_4M6;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4I3;Terminal.FUNLIST_EXPLICIT;K_SCS_4M6;SCS_4I3_IS_SCS] +THEN THAYTHEL_ASM_TAC 0[`i'`;`j`][] +THEN THAYTHEL_ASM_TAC 0[`j'`;`i`][] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]]);; + + +let MM_4I3_IMP_STAB_4I3=prove(` + MMs_v39 scs_4I3 v /\ + scs_diag 4 i j /\ + dist(v i,v j)<= cstab ==> + ~(MMs_v39 (scs_stab_diag_v39 scs_4I3 i j) ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC` scs_4I3 ` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4I3 `;`v`] +THEN ASSUME_TAC SCS_4I3_BASIC +THEN ASSUME_TAC K_SCS_4I3 +THEN ASM_SIMP_TAC[SCS_4M6_IS_SCS;SCS_4I3_IS_SCS;SCS_4I3_BASIC;K_SCS_4I3;SCS_K_D_A_STAB_EQ;IN; ADD1;SCS_DIAG_SCS_4I3_13;BB_4I3_IMP_BB_STAN_4I3;STAB_4I3_SCS] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + +let SCS_4I3_ARROW_SCS_4M6_STAB_4I3=prove_by_refinement( +` scs_arrow_v39 { scs_4I3 } ({scs_4M6'} UNION {scs_stab_diag_v39 scs_4I3 i j| scs_diag 4 i j})`, +[ +REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;UNION;IN_ELIM_THM] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + + +ASM_SIMP_TAC[SCS_4M6_IS_SCS]; + + +ASM_SIMP_TAC[STAB_4I3_SCS;K_SCS_4I3]; + + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_4I3 ==> MMs_v39 s = {}) \/ ~((!s. s = scs_4I3 ==> MMs_v39 s = {}))`); + + +ASM_REWRITE_TAC[]; + + + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC; + + +MP_TAC(SET_RULE`(!i j. scs_diag 4 i j ==> cstab < dist(v i,v j))\/ ~((!i j. scs_diag 4 i j ==> cstab < dist((v:num->real^3) i,v j)))`) +THEN RESA_TAC; + + +EXISTS_TAC`scs_4M6'` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MM_4I3_IMP_4M6 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[]; + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;REAL_ARITH`~(a b<=a`] +THEN STRIP_TAC +THEN MP_TAC MM_4I3_IMP_STAB_4I3 +THEN RESA_TAC +THEN DICH_TAC 0 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC +THEN EXISTS_TAC `scs_stab_diag_v39 scs_4I3 i j` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +MATCH_MP_TAC(SET_RULE`A==> B\/A`) +THEN EXISTS_TAC`i:num` +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[]; + + +EXISTS_TAC`v':num->real^3` +THEN ASM_REWRITE_TAC[]]);; + + +let SET_STAB_4I3=prove(`{ scs_stab_diag_v39 scs_4I3 i j| scs_diag 4 i j }= { scs_stab_diag_v39 scs_4I3 (i MOD 4) (j MOD 4)| scs_diag 4 (i MOD 4) (j MOD 4) }`, + ASM_SIMP_TAC[STAB_MOD;DIAG_MOD;EXTENSION;IN_ELIM_THM;ARITH_RULE`~(4=0)`;] +THEN MRESAL_TAC STAB_MOD[`scs_4I3`][SCS_4I3_IS_SCS;K_SCS_4I3]);; + +let EXPAND_STAB_DIAG_4I3=prove(` +{scs_stab_diag_v39 scs_4I3 (i MOD 4) (j MOD 4) | j MOD 4 = + (i MOD 4 + 2) MOD 4}= +{scs_stab_diag_v39 scs_4I3 (i+2) i| i<4} `, +ASM_SIMP_TAC[EXPAND_STAB_DIAG_4;SCS_4I3_IS_SCS;K_SCS_4I3]);; + + +let SET_EQ_DIAG_STAB_4I3=prove_by_refinement( +`scs_arrow_v39 + { scs_stab_diag_v39 scs_4I3 i j| scs_diag 4 i j } + {scs_stab_diag_v39 scs_4I3 0 2,scs_stab_diag_v39 scs_4I3 1 3}`, +[ +ASM_SIMP_TAC[EXPAND_STAB_DIAG_4I3;SET_STAB_4I3;EXPAND_DIAG_4V;MOD_REFL;ARITH_RULE`~(4=0)`] +THEN +REWRITE_TAC[ARITH_RULE`i<4<=> i=0\/i=1\/i=2\/i=3`;SET_RULE`{scs_stab_diag_v39 scs_4I3 (i + 2) i |i=0\/i=1\/i=2\/i=3} += {scs_stab_diag_v39 scs_4I3 (0 + 2) 0} UNION +{scs_stab_diag_v39 scs_4I3 (1 + 2) 1} UNION +{scs_stab_diag_v39 scs_4I3 (2 + 2) 2} UNION +{scs_stab_diag_v39 scs_4I3 (3 + 2) 3} +`;] +THEN ONCE_REWRITE_TAC[SET_RULE`{scs_stab_diag_v39 scs_4I3 0 2,scs_stab_diag_v39 scs_4I3 1 3}={scs_stab_diag_v39 scs_4I3 0 2} UNION {scs_stab_diag_v39 scs_4I3 1 3}UNION {scs_stab_diag_v39 scs_4I3 0 2} UNION {scs_stab_diag_v39 scs_4I3 1 3}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN REWRITE_TAC[ARITH_RULE`0+2=2/\ 1+2=3/\2+2=4/\ 3+2=5`] +THEN MRESA_TAC STAB_SYM[`scs_4I3`;`0`;`2`] +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4I3_SCS;SCS_DIAG_SCS_4I3_02]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN MRESA_TAC STAB_SYM[`scs_4I3`;`1`;`3`] +THEN STRIP_TAC; + + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4I3_SCS;SCS_DIAG_SCS_4I3_13]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN MRESAL_TAC STAB_MOD[`scs_4I3`;`4`;`2`][SCS_4I3_IS_SCS;K_SCS_4I3;ARITH_RULE`4 MOD 4=0/\ 2 MOD 4=2`] +THEN SYM_ASSUM_TAC +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4I3_SCS;SCS_DIAG_SCS_4I3_02]; + +MRESAL_TAC STAB_MOD[`scs_4I3`;`5`;`3`][SCS_4I3_IS_SCS;K_SCS_4I3;ARITH_RULE`5 MOD 4=1/\ 3 MOD 4=3`] +THEN SYM_ASSUM_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4I3_SCS;SCS_DIAG_SCS_4I3_13]]);; + + +let VQFYMZY=prove(` scs_arrow_v39 { scs_4I3 } ({scs_4M6', scs_4T4})`, + +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`({scs_4M6'} UNION {scs_stab_diag_v39 scs_4I3 i j| scs_diag 4 i j})` +THEN ASM_SIMP_TAC[SCS_4I3_ARROW_SCS_4M6_STAB_4I3;SET_RULE`{a,b}={a}UNION {b}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC +THENL[ + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[SCS_4M6_IS_SCS]; + +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_stab_diag_v39 scs_4I3 0 2,scs_stab_diag_v39 scs_4I3 1 3}` +THEN ASM_SIMP_TAC[SET_EQ_DIAG_STAB_4I3;SET_RULE`{a,b}={a}UNION {b}`] +THEN ONCE_REWRITE_TAC[SET_RULE` {scs_4T4}={scs_4T4} UNION {scs_4T4}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[ZNLLLDL;SCS_4I3_ARROW_4T4]]);; + + + +(***********************) + + + + + +let BB_4M2_IMP_BB_4M6= prove +(` + BBs_v39 scs_4M2 v /\ + (!i j. scs_diag 4 i j ==> cstab < dist(v i,v j)) ==> + BBs_v39 (scs_4M6') v`, +SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M2;scs_4M6;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M2;Terminal.FUNLIST_EXPLICIT;K_SCS_4M6] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ 2+1=3/\ 3+1=4`) +THEN SCS_TAC +THEN THAYTHE_TAC 1[`i`;`j`] +THEN DICH_TAC 0 +THEN THAYTHE_TAC 2[`i`;`j`] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN MRESA_TAC PSORT_MOD[`4`;`i`;`j`] +THEN SYM_ASSUM_TAC +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_ADD_MOD[`i`;`1`;`4`] +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`j`;`1`;`4`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`j MOD 4<4==> j MOD 4=0\/ j MOD 4=1\/ j MOD 4=2\/ j MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN MP_TAC sqrt8_LE_CSTAB +THEN REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC);; + + + + +let MM_4M2_IMP_4M6=prove( +` +MMs_v39 scs_4M2 v /\ + (!i j. scs_diag 4 i j ==> cstab < dist(v i,v j)) ==> + ~(MMs_v39 (scs_4M6') ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC` scs_4M2 ` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4M2 `;`v`] +THEN ASSUME_TAC SCS_4M6_BASIC +THEN ASSUME_TAC K_SCS_4M6 +THEN ASM_SIMP_TAC[SCS_4M6_IS_SCS;SCS_4M2_IS_SCS;SCS_4M2_BASIC;K_SCS_4M2;SCS_K_D_A_STAB_EQ;IN; ADD1;BB_4M2_IMP_BB_4M6] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + + +let BB_4M2_IMP_BB_STAN_4M2= prove( +` + BBs_v39 scs_4M2 v /\ + scs_diag 4 i j /\ + dist(v i,v j)<= cstab ==> + BBs_v39 (scs_stab_diag_v39 scs_4M2 i j) v`, +SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M2;scs_4M6;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M2;Terminal.FUNLIST_EXPLICIT;K_SCS_4M6] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ 2+1=3/\ 3+1=4`) +THEN SCS_TAC +THEN MP_TAC(SET_RULE`psort 4 (i,j) = psort 4 (i',j')\/ ~(psort 4 (i,j) = psort 4 (i',j'))`) +THEN RESA_TAC +THEN MRESA_TAC Uaghhbm.CASE_PSORT[`i`;`j'`;`j`;`i'`;`4`] +THENL[ +MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4M2`][scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M2;scs_4M6;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M2;Terminal.FUNLIST_EXPLICIT;K_SCS_4M6;SCS_4M2_IS_SCS] +THEN THAYTHEL_ASM_TAC 0[`i'`;`i`][] +THEN THAYTHEL_ASM_TAC 0[`j'`;`j`][]; + +MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4M2`][scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M2;scs_4M6;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M2;Terminal.FUNLIST_EXPLICIT;K_SCS_4M6;SCS_4M2_IS_SCS] +THEN THAYTHEL_ASM_TAC 0[`i'`;`j`][] +THEN THAYTHEL_ASM_TAC 0[`j'`;`i`][] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]]);; + + +let MM_4M2_IMP_STAB_4M2=prove(` + MMs_v39 scs_4M2 v /\ + scs_diag 4 i j /\ + dist(v i,v j)<= cstab ==> + ~(MMs_v39 (scs_stab_diag_v39 scs_4M2 i j) ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC` scs_4M2 ` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4M2 `;`v`] +THEN ASSUME_TAC SCS_4M2_BASIC +THEN ASSUME_TAC K_SCS_4M2 +THEN ASM_SIMP_TAC[SCS_4M6_IS_SCS;SCS_4M2_IS_SCS;SCS_4M2_BASIC;K_SCS_4M2;SCS_K_D_A_STAB_EQ;IN; ADD1;SCS_DIAG_SCS_4M2_13;BB_4M2_IMP_BB_STAN_4M2;STAB_4M2_SCS] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + +let SCS_4M2_ARROW_SCS_4M6_STAB_4M2=prove_by_refinement( +` scs_arrow_v39 { scs_4M2 } ({scs_4M6'} UNION {scs_stab_diag_v39 scs_4M2 i j| scs_diag 4 i j})`, +[ +REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;UNION;IN_ELIM_THM] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + + +ASM_SIMP_TAC[SCS_4M6_IS_SCS]; + + +ASM_SIMP_TAC[STAB_4M2_SCS;K_SCS_4M2]; + + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_4M2 ==> MMs_v39 s = {}) \/ ~((!s. s = scs_4M2 ==> MMs_v39 s = {}))`); + + +ASM_REWRITE_TAC[]; + + + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC; + + +MP_TAC(SET_RULE`(!i j. scs_diag 4 i j ==> cstab < dist(v i,v j))\/ ~((!i j. scs_diag 4 i j ==> cstab < dist((v:num->real^3) i,v j)))`) +THEN RESA_TAC; + + +EXISTS_TAC`scs_4M6'` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MM_4M2_IMP_4M6 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[]; + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;REAL_ARITH`~(a b<=a`] +THEN STRIP_TAC +THEN MP_TAC MM_4M2_IMP_STAB_4M2 +THEN RESA_TAC +THEN DICH_TAC 0 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC +THEN EXISTS_TAC `scs_stab_diag_v39 scs_4M2 i j` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +MATCH_MP_TAC(SET_RULE`A==> B\/A`) +THEN EXISTS_TAC`i:num` +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[]; + + +EXISTS_TAC`v':num->real^3` +THEN ASM_REWRITE_TAC[]]);; + + + +let SET_STAB_4M2=prove(`{ scs_stab_diag_v39 scs_4M2 i j| scs_diag 4 i j }= { scs_stab_diag_v39 scs_4M2 (i MOD 4) (j MOD 4)| scs_diag 4 (i MOD 4) (j MOD 4) }`, + ASM_SIMP_TAC[STAB_MOD;DIAG_MOD;EXTENSION;IN_ELIM_THM;ARITH_RULE`~(4=0)`;] +THEN MRESAL_TAC STAB_MOD[`scs_4M2`][SCS_4M2_IS_SCS;K_SCS_4M2]);; + +let EXPAND_STAB_DIAG_4M2=prove(` +{scs_stab_diag_v39 scs_4M2 (i MOD 4) (j MOD 4) | j MOD 4 = + (i MOD 4 + 2) MOD 4}= +{scs_stab_diag_v39 scs_4M2 (i+2) i| i<4} `, +ASM_SIMP_TAC[EXPAND_STAB_DIAG_4;SCS_4M2_IS_SCS;K_SCS_4M2]);; + + +let SET_EQ_DIAG_STAB_4M2=prove_by_refinement( +`scs_arrow_v39 + { scs_stab_diag_v39 scs_4M2 i j| scs_diag 4 i j } + {scs_stab_diag_v39 scs_4M2 0 2,scs_stab_diag_v39 scs_4M2 1 3}`, +[ +ASM_SIMP_TAC[EXPAND_STAB_DIAG_4M2;SET_STAB_4M2;EXPAND_DIAG_4V;MOD_REFL;ARITH_RULE`~(4=0)`] +THEN +REWRITE_TAC[ARITH_RULE`i<4<=> i=0\/i=1\/i=2\/i=3`;SET_RULE`{scs_stab_diag_v39 scs_4M2 (i + 2) i |i=0\/i=1\/i=2\/i=3} += {scs_stab_diag_v39 scs_4M2 (0 + 2) 0} UNION +{scs_stab_diag_v39 scs_4M2 (1 + 2) 1} UNION +{scs_stab_diag_v39 scs_4M2 (2 + 2) 2} UNION +{scs_stab_diag_v39 scs_4M2 (3 + 2) 3} +`;] +THEN ONCE_REWRITE_TAC[SET_RULE`{scs_stab_diag_v39 scs_4M2 0 2,scs_stab_diag_v39 scs_4M2 1 3}={scs_stab_diag_v39 scs_4M2 0 2} UNION {scs_stab_diag_v39 scs_4M2 1 3}UNION {scs_stab_diag_v39 scs_4M2 0 2} UNION {scs_stab_diag_v39 scs_4M2 1 3}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN REWRITE_TAC[ARITH_RULE`0+2=2/\ 1+2=3/\2+2=4/\ 3+2=5`] +THEN MRESA_TAC STAB_SYM[`scs_4M2`;`0`;`2`] +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M2_SCS;SCS_DIAG_SCS_4M2_02]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN MRESA_TAC STAB_SYM[`scs_4M2`;`1`;`3`] +THEN STRIP_TAC; + + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M2_SCS;SCS_DIAG_SCS_4M2_13]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN MRESAL_TAC STAB_MOD[`scs_4M2`;`4`;`2`][SCS_4M2_IS_SCS;K_SCS_4M2;ARITH_RULE`4 MOD 4=0/\ 2 MOD 4=2`] +THEN SYM_ASSUM_TAC +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M2_SCS;SCS_DIAG_SCS_4M2_02]; + +MRESAL_TAC STAB_MOD[`scs_4M2`;`5`;`3`][SCS_4M2_IS_SCS;K_SCS_4M2;ARITH_RULE`5 MOD 4=1/\ 3 MOD 4=3`] +THEN SYM_ASSUM_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M2_SCS;SCS_DIAG_SCS_4M2_13]]);; + + + +let PROP_OPP_DIAG_4M2_13= prove_by_refinement(`scs_stab_diag_v39 scs_4M2 1 3= scs_prop_equ_v39(scs_opp_v39 (scs_stab_diag_v39 scs_4M2 0 2)) 2 `, +[REWRITE_TAC[scs_prop_equ_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39;SCS_K_D_A_STAB_EQ;scs_opp_v39] +THEN MATCH_MP_TAC scs_inj +THEN SIMP_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;SCS_4M2_BASIC;STAB_4M2_SCS;SCS_DIAG_SCS_4M2_13;scs_basic;unadorned_v39;peropp;peropp2] +THEN SCS_TAC +THEN STRIP_TAC; + +SET_TAC[]; + + +STRIP_TAC +THEN ASM_REWRITE_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_5M3;mk_unadorned_v39;peropp;peropp2;FUN_EQ_THM;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN REPEAT GEN_TAC +THEN ASSUME_TAC (ARITH_RULE`~(4=0)`) +THEN MRESA_TAC PSORT_MOD[`4`;`x`;`x'`] +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`2`;`x`;`4`] +THEN MRESA_TAC MOD_ADD_MOD[`2`;`x'`;`4`] +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`x MOD 4<4==> x MOD 4=0\/ x MOD 4=1\/ x MOD 4=2\/ x MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 4<4==> x' MOD 4=0\/ x' MOD 4=1\/ x' MOD 4=2\/ x' MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[Uxckfpe.ARITH_4_TAC;PSORT_5_EXPLICIT;ARITH_RULE`4-1=3/\ 4-2=2/\ 4-3=1/\ 4-4=0/\ 5-5=0/\ 2+0=2/\ 2+1=3/\ 2+2=4/\ 2+3=5/\2+4=6 +/\ 3+0=3/\ 3+1=4/\ 3+2=5/\ 3+3=6/\ 3+4=7/\ 7 MOD 5=2`;PAIR_EQ;Terminal.FUNLIST_EXPLICIT;]]);; + + +let STAB_4M2_02_ARROW_4M2_13=prove(`scs_arrow_v39 {scs_stab_diag_v39 scs_4M2 0 2}{scs_stab_diag_v39 scs_4M2 1 3}`, +ASM_SIMP_TAC[PROP_OPP_DIAG_4M2_13] +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_opp_v39 (scs_stab_diag_v39 scs_4M2 0 2)}` +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC (GEN_ALL YXIONXL2) +THEN EXISTS_TAC`4` +THEN ASM_SIMP_TAC[SCS_K_D_A_STAB_EQ;ARITH_RULE`~(4<=3)`;K_SCS_4M2;STAB_4M2_SCS;SCS_DIAG_SCS_4M2_02] +; + +MATCH_MP_TAC(GEN_ALL YXIONXL3) +THEN MATCH_MP_TAC (GEN_ALL OPP_IS_SCS) +THEN EXISTS_TAC`scs_opp_v39 (scs_stab_diag_v39 scs_4M2 0 2)` +THEN ASM_SIMP_TAC[SCS_K_D_A_STAB_EQ;ARITH_RULE`~(4<=3)`;K_SCS_4M2;STAB_4M2_SCS;SCS_DIAG_SCS_4M2_02]]);; + + +let SCS_4M2_SLICE_13=prove_by_refinement( +`scs_arrow_v39 {scs_stab_diag_v39 scs_4M2 1 3 } {scs_prop_equ_v39 scs_3M1 1, scs_3T4 }`, +[ +MATCH_MP_TAC (GEN_ALL Lkgrqui.LKGRQUI) +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4M2_13;STAB_4M2_SCS;SCS_K_D_A_STAB_EQ;] +THEN EXISTS_TAC`1` +THEN EXISTS_TAC`3` +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4M2_13] +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ] +THEN REPEAT RESA_TAC; + +REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ;scs_slice_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC scs_inj +THEN ASM_SIMP_TAC[SCS_3T4_BASIC;SCS_4M2_BASIC;J_SCS_4M2;BASIC_HALF_SLICE_STAB;J_SCS_3T4;D_HALF_SLICE;BAISC_PROP_EQU;K_SCS_PROP_EUQ;SCS_3M1_BASIC;J_SCS_3M1] +THEN STRIP_TAC; + + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3M1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M2] +THEN ARITH_TAC; + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3M1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M2; +ARITH_RULE`(3 + 1 + 4 - 1) MOD 4= 3/\ 1 MOD 4=1/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`1+x:num`;`1+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M2] +THEN ARITH_TAC; + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M2;scs_3T4_prime;scs_5M3; +ARITH_RULE`(1 + 1 + 4 - 3) MOD 4= 3/\ 3 MOD 4=3/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`0`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`x:num`;`x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[J_SCS_3M1]; + +]);; + +let BNAWVNH =prove_by_refinement(` scs_arrow_v39 { scs_4M2 } ({scs_4M6',scs_3M1, scs_3T4})`, +[ +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`({scs_4M6'} UNION {scs_stab_diag_v39 scs_4M2 i j| scs_diag 4 i j})` +THEN ASM_REWRITE_TAC[SCS_4M2_ARROW_SCS_4M6_STAB_4M2;SET_RULE`{A,B,C}={A}UNION{B,C}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[SCS_4M6_IS_SCS]; + +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_stab_diag_v39 scs_4M2 0 2,scs_stab_diag_v39 scs_4M2 1 3}` +THEN ASM_REWRITE_TAC[SET_EQ_DIAG_STAB_4M2] +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_stab_diag_v39 scs_4M2 1 3,scs_stab_diag_v39 scs_4M2 1 3}` +THEN STRIP_TAC; + +REWRITE_TAC[SET_RULE`{A,B}={A}UNION{B}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_REWRITE_TAC[STAB_4M2_02_ARROW_4M2_13]; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M2_SCS;SCS_DIAG_SCS_4M2_13]; + +REWRITE_TAC[SET_RULE`{A,A}={A}`] +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_prop_equ_v39 scs_3M1 1, scs_3T4 }` +THEN ASM_REWRITE_TAC[SCS_4M2_SLICE_13;SET_RULE`{A,B}={A}UNION {B}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + +MRESAS_TAC PRO_EQU_ID1[`scs_3M1`;`1`;`3`][SCS_3M1_IS_SCS;K_SCS_3M1;ARITH_RULE`(3 - 1 MOD 3)=2`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_3M1 1`;`2`][PROP_EQU_IS_SCS;SCS_3M1_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[SCS_3T4_IS_SCS]]);; + + + +(***************************) + + +let BB_4M3_IMP_BB_4M6= prove +(` + BBs_v39 scs_4M3' v /\ + (!i j. scs_diag 4 i j ==> cstab < dist(v i,v j)) ==> + BBs_v39 (scs_4M6') v`, +SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M3;scs_4M6;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M3;Terminal.FUNLIST_EXPLICIT;K_SCS_4M6] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ 2+1=3/\ 3+1=4`) +THEN SCS_TAC +THEN THAYTHE_TAC 1[`i`;`j`] +THEN DICH_TAC 0 +THEN THAYTHE_TAC 2[`i`;`j`] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN MRESA_TAC PSORT_MOD[`4`;`i`;`j`] +THEN SYM_ASSUM_TAC +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_ADD_MOD[`i`;`1`;`4`] +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`j`;`1`;`4`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`j MOD 4<4==> j MOD 4=0\/ j MOD 4=1\/ j MOD 4=2\/ j MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN MP_TAC sqrt8_LE_CSTAB +THEN MP_TAC LE_sqrt8_2h0 +THEN REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC);; + + + + +let MM_4M3_IMP_4M6=prove( +` +MMs_v39 scs_4M3' v /\ + (!i j. scs_diag 4 i j ==> cstab < dist(v i,v j)) ==> + ~(MMs_v39 (scs_4M6') ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC` scs_4M3' ` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4M3' `;`v`] +THEN ASSUME_TAC SCS_4M6_BASIC +THEN ASSUME_TAC K_SCS_4M6 +THEN ASM_SIMP_TAC[SCS_4M6_IS_SCS;SCS_4M3_IS_SCS;SCS_4M3_BASIC;K_SCS_4M3;SCS_K_D_A_STAB_EQ;IN; ADD1;BB_4M3_IMP_BB_4M6] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + + +let BB_4M3_IMP_BB_STAN_4M3= prove( +` + BBs_v39 scs_4M3' v /\ + scs_diag 4 i j /\ + dist(v i,v j)<= cstab ==> + BBs_v39 (scs_stab_diag_v39 scs_4M3' i j) v`, +SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M3;scs_4M6;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M3;Terminal.FUNLIST_EXPLICIT;K_SCS_4M6] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ 2+1=3/\ 3+1=4`) +THEN SCS_TAC +THEN MP_TAC(SET_RULE`psort 4 (i,j) = psort 4 (i',j')\/ ~(psort 4 (i,j) = psort 4 (i',j'))`) +THEN RESA_TAC +THEN MRESA_TAC Uaghhbm.CASE_PSORT[`i`;`j'`;`j`;`i'`;`4`] +THENL[ +MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4M3'`][scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M3;scs_4M6;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M3;Terminal.FUNLIST_EXPLICIT;K_SCS_4M6;SCS_4M3_IS_SCS] +THEN THAYTHEL_ASM_TAC 0[`i'`;`i`][] +THEN THAYTHEL_ASM_TAC 0[`j'`;`j`][]; + +MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4M3'`][scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M3;scs_4M6;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M3;Terminal.FUNLIST_EXPLICIT;K_SCS_4M6;SCS_4M3_IS_SCS] +THEN THAYTHEL_ASM_TAC 0[`i'`;`j`][] +THEN THAYTHEL_ASM_TAC 0[`j'`;`i`][] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]]);; + + + + +let MM_4M3_IMP_STAB_4M3=prove(` + MMs_v39 scs_4M3' v /\ + scs_diag 4 i j /\ + dist(v i,v j)<= cstab ==> + ~(MMs_v39 (scs_stab_diag_v39 scs_4M3' i j) ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC` scs_4M3' ` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4M3' `;`v`] +THEN ASSUME_TAC SCS_4M3_BASIC +THEN ASSUME_TAC K_SCS_4M3 +THEN ASM_SIMP_TAC[SCS_4M6_IS_SCS;SCS_4M3_IS_SCS;SCS_4M3_BASIC;K_SCS_4M3;SCS_K_D_A_STAB_EQ;IN; ADD1;SCS_DIAG_SCS_4M3_13;BB_4M3_IMP_BB_STAN_4M3;STAB_4M3_SCS] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + + +let SCS_4M3_ARROW_SCS_4M6_STAB_4M3=prove_by_refinement( +` scs_arrow_v39 { scs_4M3' } ({scs_4M6'} UNION {scs_stab_diag_v39 scs_4M3' i j| scs_diag 4 i j})`, +[ +REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;UNION;IN_ELIM_THM] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + + +ASM_SIMP_TAC[SCS_4M6_IS_SCS]; + + +ASM_SIMP_TAC[STAB_4M3_SCS;K_SCS_4M3]; + + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_4M3' ==> MMs_v39 s = {}) \/ ~((!s. s = scs_4M3' ==> MMs_v39 s = {}))`); + + +ASM_REWRITE_TAC[]; + + + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC; + + +MP_TAC(SET_RULE`(!i j. scs_diag 4 i j ==> cstab < dist(v i,v j))\/ ~((!i j. scs_diag 4 i j ==> cstab < dist((v:num->real^3) i,v j)))`) +THEN RESA_TAC; + + +EXISTS_TAC`scs_4M6'` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MM_4M3_IMP_4M6 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[]; + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;REAL_ARITH`~(a b<=a`] +THEN STRIP_TAC +THEN MP_TAC MM_4M3_IMP_STAB_4M3 +THEN RESA_TAC +THEN DICH_TAC 0 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC +THEN EXISTS_TAC `scs_stab_diag_v39 scs_4M3' i j` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +MATCH_MP_TAC(SET_RULE`A==> B\/A`) +THEN EXISTS_TAC`i:num` +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[]; + + +EXISTS_TAC`v':num->real^3` +THEN ASM_REWRITE_TAC[]]);; + + + + +let SET_STAB_4M3=prove(`{ scs_stab_diag_v39 scs_4M3' i j| scs_diag 4 i j }= { scs_stab_diag_v39 scs_4M3' (i MOD 4) (j MOD 4)| scs_diag 4 (i MOD 4) (j MOD 4) }`, + ASM_SIMP_TAC[STAB_MOD;DIAG_MOD;EXTENSION;IN_ELIM_THM;ARITH_RULE`~(4=0)`;] +THEN MRESAL_TAC STAB_MOD[`scs_4M3'`][SCS_4M3_IS_SCS;K_SCS_4M3]);; + +let EXPAND_STAB_DIAG_4M3=prove(` +{scs_stab_diag_v39 scs_4M3' (i MOD 4) (j MOD 4) | j MOD 4 = + (i MOD 4 + 2) MOD 4}= +{scs_stab_diag_v39 scs_4M3' (i+2) i| i<4} `, +ASM_SIMP_TAC[EXPAND_STAB_DIAG_4;SCS_4M3_IS_SCS;K_SCS_4M3]);; + + +let SET_EQ_DIAG_STAB_4M3=prove_by_refinement( +`scs_arrow_v39 + { scs_stab_diag_v39 scs_4M3' i j| scs_diag 4 i j } + {scs_stab_diag_v39 scs_4M3' 0 2,scs_stab_diag_v39 scs_4M3' 1 3}`, +[ +ASM_SIMP_TAC[EXPAND_STAB_DIAG_4M3;SET_STAB_4M3;EXPAND_DIAG_4V;MOD_REFL;ARITH_RULE`~(4=0)`] +THEN +REWRITE_TAC[ARITH_RULE`i<4<=> i=0\/i=1\/i=2\/i=3`;SET_RULE`{scs_stab_diag_v39 scs_4M3' (i + 2) i |i=0\/i=1\/i=2\/i=3} += {scs_stab_diag_v39 scs_4M3' (0 + 2) 0} UNION +{scs_stab_diag_v39 scs_4M3' (1 + 2) 1} UNION +{scs_stab_diag_v39 scs_4M3' (2 + 2) 2} UNION +{scs_stab_diag_v39 scs_4M3' (3 + 2) 3} +`;] +THEN ONCE_REWRITE_TAC[SET_RULE`{scs_stab_diag_v39 scs_4M3' 0 2,scs_stab_diag_v39 scs_4M3' 1 3}={scs_stab_diag_v39 scs_4M3' 0 2} UNION {scs_stab_diag_v39 scs_4M3' 1 3}UNION {scs_stab_diag_v39 scs_4M3' 0 2} UNION {scs_stab_diag_v39 scs_4M3' 1 3}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN REWRITE_TAC[ARITH_RULE`0+2=2/\ 1+2=3/\2+2=4/\ 3+2=5`] +THEN MRESA_TAC STAB_SYM[`scs_4M3'`;`0`;`2`] +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M3_SCS;SCS_DIAG_SCS_4M3_02]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN MRESA_TAC STAB_SYM[`scs_4M3'`;`1`;`3`] +THEN STRIP_TAC; + + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M3_SCS;SCS_DIAG_SCS_4M3_13]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN MRESAL_TAC STAB_MOD[`scs_4M3'`;`4`;`2`][SCS_4M3_IS_SCS;K_SCS_4M3;ARITH_RULE`4 MOD 4=0/\ 2 MOD 4=2`] +THEN SYM_ASSUM_TAC +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M3_SCS;SCS_DIAG_SCS_4M3_02]; + +MRESAL_TAC STAB_MOD[`scs_4M3'`;`5`;`3`][SCS_4M3_IS_SCS;K_SCS_4M3;ARITH_RULE`5 MOD 4=1/\ 3 MOD 4=3`] +THEN SYM_ASSUM_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M3_SCS;SCS_DIAG_SCS_4M3_13]]);; + +let PROP_OPP_DIAG_4M3_13= prove_by_refinement(`scs_stab_diag_v39 scs_4M3' 1 3= scs_prop_equ_v39(scs_opp_v39 (scs_stab_diag_v39 scs_4M3' 0 2)) 2 `, +[REWRITE_TAC[scs_prop_equ_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39;SCS_K_D_A_STAB_EQ;scs_opp_v39] +THEN MATCH_MP_TAC scs_inj +THEN SIMP_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;SCS_4M3_BASIC;STAB_4M3_SCS;SCS_DIAG_SCS_4M3_13;scs_basic;unadorned_v39;peropp;peropp2] +THEN SCS_TAC +THEN STRIP_TAC; + +SET_TAC[]; + + +STRIP_TAC +THEN ASM_REWRITE_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_5M3;mk_unadorned_v39;peropp;peropp2;FUN_EQ_THM;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN REPEAT GEN_TAC +THEN ASSUME_TAC (ARITH_RULE`~(4=0)`) +THEN MRESA_TAC PSORT_MOD[`4`;`x`;`x'`] +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`2`;`x`;`4`] +THEN MRESA_TAC MOD_ADD_MOD[`2`;`x'`;`4`] +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`x MOD 4<4==> x MOD 4=0\/ x MOD 4=1\/ x MOD 4=2\/ x MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 4<4==> x' MOD 4=0\/ x' MOD 4=1\/ x' MOD 4=2\/ x' MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[Uxckfpe.ARITH_4_TAC;PSORT_5_EXPLICIT;ARITH_RULE`4-1=3/\ 4-2=2/\ 4-3=1/\ 4-4=0/\ 5-5=0/\ 2+0=2/\ 2+1=3/\ 2+2=4/\ 2+3=5/\2+4=6 +/\ 3+0=3/\ 3+1=4/\ 3+2=5/\ 3+3=6/\ 3+4=7/\ 7 MOD 5=2`;PAIR_EQ;Terminal.FUNLIST_EXPLICIT;]]);; + + +let STAB_4M3_02_ARROW_4M3_13=prove(`scs_arrow_v39 {scs_stab_diag_v39 scs_4M3' 0 2}{scs_stab_diag_v39 scs_4M3' 1 3}`, +ASM_SIMP_TAC[PROP_OPP_DIAG_4M3_13] +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_opp_v39 (scs_stab_diag_v39 scs_4M3' 0 2)}` +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC (GEN_ALL YXIONXL2) +THEN EXISTS_TAC`4` +THEN ASM_SIMP_TAC[SCS_K_D_A_STAB_EQ;ARITH_RULE`~(4<=3)`;K_SCS_4M3;STAB_4M3_SCS;SCS_DIAG_SCS_4M3_02] +; + +MATCH_MP_TAC(GEN_ALL YXIONXL3) +THEN MATCH_MP_TAC (GEN_ALL OPP_IS_SCS) +THEN EXISTS_TAC`scs_opp_v39 (scs_stab_diag_v39 scs_4M3' 0 2)` +THEN ASM_SIMP_TAC[SCS_K_D_A_STAB_EQ;ARITH_RULE`~(4<=3)`;K_SCS_4M3;STAB_4M3_SCS;SCS_DIAG_SCS_4M3_02]]);; + + +let SCS_4M3_SLICE_13=prove_by_refinement( +`scs_arrow_v39 {scs_stab_diag_v39 scs_4M3' 1 3 } {scs_prop_equ_v39 scs_3T1 1, scs_prop_equ_v39 scs_3T6' 2}`, +[MATCH_MP_TAC (GEN_ALL Lkgrqui.LKGRQUI) +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4M3_13;STAB_4M3_SCS;SCS_K_D_A_STAB_EQ;] +THEN EXISTS_TAC`1` +THEN EXISTS_TAC`3` +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4M3_13] +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ] +THEN REPEAT RESA_TAC; + + +REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ;scs_slice_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC scs_inj +THEN ASM_SIMP_TAC[SCS_3T1_BASIC;SCS_4M3_BASIC;J_SCS_4M3;BASIC_HALF_SLICE_STAB;J_SCS_3T1;D_HALF_SLICE;BAISC_PROP_EQU;K_SCS_PROP_EUQ;SCS_3T6_BASIC;J_SCS_3T6] +THEN STRIP_TAC; + + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M3] +THEN ARITH_TAC; + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M3; +ARITH_RULE`(3 + 1 + 4 - 1) MOD 4= 3/\ 1 MOD 4=1/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`1+x:num`;`1+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T6;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M3] +THEN ARITH_TAC; + + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T6;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M3; +ARITH_RULE`(1 + 1 + 4 - 3) MOD 4= 3/\ 3 MOD 4=3/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`2`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`2+x:num`;`2+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[J_SCS_3T1]; + +]);; + + + +let RAWZDIB =prove_by_refinement( +` scs_arrow_v39 { scs_4M3' } ({scs_4M6',scs_3T1, scs_3T6'})`, +[ +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`({scs_4M6'} UNION {scs_stab_diag_v39 scs_4M3' i j| scs_diag 4 i j})` +THEN ASM_REWRITE_TAC[SCS_4M3_ARROW_SCS_4M6_STAB_4M3;SET_RULE`{A,B,C}={A}UNION{B,C}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[SCS_4M6_IS_SCS]; + +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_stab_diag_v39 scs_4M3' 0 2,scs_stab_diag_v39 scs_4M3' 1 3}` +THEN ASM_REWRITE_TAC[SET_EQ_DIAG_STAB_4M3] +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_stab_diag_v39 scs_4M3' 1 3,scs_stab_diag_v39 scs_4M3' 1 3}` +THEN STRIP_TAC; + +REWRITE_TAC[SET_RULE`{A,B}={A}UNION{B}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_REWRITE_TAC[STAB_4M3_02_ARROW_4M3_13]; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M3_SCS;SCS_DIAG_SCS_4M3_13]; + +REWRITE_TAC[SET_RULE`{A,A}={A}`] +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_prop_equ_v39 scs_3T1 1, scs_prop_equ_v39 scs_3T6' 2}` +THEN ASM_REWRITE_TAC[SCS_4M3_SLICE_13;SET_RULE`{A,B}={A}UNION {B}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + +MRESAS_TAC PRO_EQU_ID1[`scs_3T1`;`1`;`3`][SCS_3T1_IS_SCS;K_SCS_3T1;ARITH_RULE`(3 - 1 MOD 3)=2`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_3T1 1`;`2`][PROP_EQU_IS_SCS;SCS_3T1_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]; + +MRESAS_TAC PRO_EQU_ID1[`scs_3T6'`;`2`;`3`][SCS_3T6_IS_SCS;K_SCS_3T6;ARITH_RULE`(3 - 2 MOD 3)=1`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_3T6' 2`;`1`][PROP_EQU_IS_SCS;SCS_3T6_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]]);; + + +(************************************) + +let BB_4M4_IMP_BB_4M7= prove +(` + BBs_v39 scs_4M4' v /\ + (!i j. scs_diag 4 i j ==> cstab < dist(v i,v j)) ==> + BBs_v39 (scs_4M7) v`, +SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M4;scs_4M7;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M4;Terminal.FUNLIST_EXPLICIT;K_SCS_4M7] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ 2+1=3/\ 3+1=4`) +THEN SCS_TAC +THEN THAYTHE_TAC 1[`i`;`j`] +THEN DICH_TAC 0 +THEN THAYTHE_TAC 2[`i`;`j`] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN MRESA_TAC PSORT_MOD[`4`;`i`;`j`] +THEN SYM_ASSUM_TAC +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_ADD_MOD[`i`;`1`;`4`] +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`j`;`1`;`4`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`j MOD 4<4==> j MOD 4=0\/ j MOD 4=1\/ j MOD 4=2\/ j MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN MP_TAC sqrt8_LE_CSTAB +THEN MP_TAC LE_sqrt8_2h0 +THEN REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC);; + + +let MM_4M4_IMP_4M7=prove( +` +MMs_v39 scs_4M4' v /\ + (!i j. scs_diag 4 i j ==> cstab < dist(v i,v j)) ==> + ~(MMs_v39 (scs_4M7) ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC` scs_4M4' ` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4M4' `;`v`] +THEN ASSUME_TAC SCS_4M7_BASIC +THEN ASSUME_TAC K_SCS_4M7 +THEN ASM_SIMP_TAC[SCS_4M7_IS_SCS;SCS_4M4_IS_SCS;SCS_4M4_BASIC;K_SCS_4M4;SCS_K_D_A_STAB_EQ;IN; ADD1;BB_4M4_IMP_BB_4M7] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + +let BB_4M4_IMP_BB_STAN_4M4= prove( +` + BBs_v39 scs_4M4' v /\ + scs_diag 4 i j /\ + dist(v i,v j)<= cstab ==> + BBs_v39 (scs_stab_diag_v39 scs_4M4' i j) v`, +SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M4;scs_4M7;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M4;Terminal.FUNLIST_EXPLICIT;K_SCS_4M7] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ 2+1=3/\ 3+1=4`) +THEN SCS_TAC +THEN MP_TAC(SET_RULE`psort 4 (i,j) = psort 4 (i',j')\/ ~(psort 4 (i,j) = psort 4 (i',j'))`) +THEN RESA_TAC +THEN MRESA_TAC Uaghhbm.CASE_PSORT[`i`;`j'`;`j`;`i'`;`4`] +THENL[ +MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4M4'`][scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M4;scs_4M7;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M4;Terminal.FUNLIST_EXPLICIT;K_SCS_4M7;SCS_4M4_IS_SCS] +THEN THAYTHEL_ASM_TAC 0[`i'`;`i`][] +THEN THAYTHEL_ASM_TAC 0[`j'`;`j`][]; + +MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4M4'`][scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M4;scs_4M7;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M4;Terminal.FUNLIST_EXPLICIT;K_SCS_4M7;SCS_4M4_IS_SCS] +THEN THAYTHEL_ASM_TAC 0[`i'`;`j`][] +THEN THAYTHEL_ASM_TAC 0[`j'`;`i`][] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]]);; + + + +let MM_4M4_IMP_STAB_4M4=prove(` + MMs_v39 scs_4M4' v /\ + scs_diag 4 i j /\ + dist(v i,v j)<= cstab ==> + ~(MMs_v39 (scs_stab_diag_v39 scs_4M4' i j) ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC` scs_4M4' ` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4M4' `;`v`] +THEN ASSUME_TAC SCS_4M4_BASIC +THEN ASSUME_TAC K_SCS_4M4 +THEN ASM_SIMP_TAC[SCS_4M6_IS_SCS;SCS_4M4_IS_SCS;SCS_4M4_BASIC;K_SCS_4M4;SCS_K_D_A_STAB_EQ;IN; ADD1;SCS_DIAG_SCS_4M4_13;BB_4M4_IMP_BB_STAN_4M4;STAB_4M4_SCS] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + +let SCS_4M4_ARROW_SCS_4M7_STAB_4M4=prove_by_refinement( +` scs_arrow_v39 { scs_4M4' } ({scs_4M7} UNION {scs_stab_diag_v39 scs_4M4' i j| scs_diag 4 i j})`, +[ +REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;UNION;IN_ELIM_THM] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + + +ASM_SIMP_TAC[SCS_4M7_IS_SCS]; + + +ASM_SIMP_TAC[STAB_4M4_SCS;K_SCS_4M4]; + + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_4M4' ==> MMs_v39 s = {}) \/ ~((!s. s = scs_4M4' ==> MMs_v39 s = {}))`); + + +ASM_REWRITE_TAC[]; + + + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC; + + +MP_TAC(SET_RULE`(!i j. scs_diag 4 i j ==> cstab < dist(v i,v j))\/ ~((!i j. scs_diag 4 i j ==> cstab < dist((v:num->real^3) i,v j)))`) +THEN RESA_TAC; + + +EXISTS_TAC`scs_4M7` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MM_4M4_IMP_4M7 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[]; + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;REAL_ARITH`~(a b<=a`] +THEN STRIP_TAC +THEN MP_TAC MM_4M4_IMP_STAB_4M4 +THEN RESA_TAC +THEN DICH_TAC 0 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC +THEN EXISTS_TAC `scs_stab_diag_v39 scs_4M4' i j` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +MATCH_MP_TAC(SET_RULE`A==> B\/A`) +THEN EXISTS_TAC`i:num` +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[]; + + +EXISTS_TAC`v':num->real^3` +THEN ASM_REWRITE_TAC[]]);; + + + + +let SET_STAB_4M4=prove(`{ scs_stab_diag_v39 scs_4M4' i j| scs_diag 4 i j }= { scs_stab_diag_v39 scs_4M4' (i MOD 4) (j MOD 4)| scs_diag 4 (i MOD 4) (j MOD 4) }`, + ASM_SIMP_TAC[STAB_MOD;DIAG_MOD;EXTENSION;IN_ELIM_THM;ARITH_RULE`~(4=0)`;] +THEN MRESAL_TAC STAB_MOD[`scs_4M4'`][SCS_4M4_IS_SCS;K_SCS_4M4]);; + +let EXPAND_STAB_DIAG_4M4=prove(` +{scs_stab_diag_v39 scs_4M4' (i MOD 4) (j MOD 4) | j MOD 4 = + (i MOD 4 + 2) MOD 4}= +{scs_stab_diag_v39 scs_4M4' (i+2) i| i<4} `, +ASM_SIMP_TAC[EXPAND_STAB_DIAG_4;SCS_4M4_IS_SCS;K_SCS_4M4]);; + + +let SET_EQ_DIAG_STAB_4M4=prove_by_refinement( +`scs_arrow_v39 + { scs_stab_diag_v39 scs_4M4' i j| scs_diag 4 i j } + {scs_stab_diag_v39 scs_4M4' 0 2,scs_stab_diag_v39 scs_4M4' 1 3}`, +[ +ASM_SIMP_TAC[EXPAND_STAB_DIAG_4M4;SET_STAB_4M4;EXPAND_DIAG_4V;MOD_REFL;ARITH_RULE`~(4=0)`] +THEN +REWRITE_TAC[ARITH_RULE`i<4<=> i=0\/i=1\/i=2\/i=3`;SET_RULE`{scs_stab_diag_v39 scs_4M4' (i + 2) i |i=0\/i=1\/i=2\/i=3} += {scs_stab_diag_v39 scs_4M4' (0 + 2) 0} UNION +{scs_stab_diag_v39 scs_4M4' (1 + 2) 1} UNION +{scs_stab_diag_v39 scs_4M4' (2 + 2) 2} UNION +{scs_stab_diag_v39 scs_4M4' (3 + 2) 3} +`;] +THEN ONCE_REWRITE_TAC[SET_RULE`{scs_stab_diag_v39 scs_4M4' 0 2,scs_stab_diag_v39 scs_4M4' 1 3}={scs_stab_diag_v39 scs_4M4' 0 2} UNION {scs_stab_diag_v39 scs_4M4' 1 3}UNION {scs_stab_diag_v39 scs_4M4' 0 2} UNION {scs_stab_diag_v39 scs_4M4' 1 3}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN REWRITE_TAC[ARITH_RULE`0+2=2/\ 1+2=3/\2+2=4/\ 3+2=5`] +THEN MRESA_TAC STAB_SYM[`scs_4M4'`;`0`;`2`] +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M4_SCS;SCS_DIAG_SCS_4M4_02]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN MRESA_TAC STAB_SYM[`scs_4M4'`;`1`;`3`] +THEN STRIP_TAC; + + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M4_SCS;SCS_DIAG_SCS_4M4_13]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN MRESAL_TAC STAB_MOD[`scs_4M4'`;`4`;`2`][SCS_4M4_IS_SCS;K_SCS_4M4;ARITH_RULE`4 MOD 4=0/\ 2 MOD 4=2`] +THEN SYM_ASSUM_TAC +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M4_SCS;SCS_DIAG_SCS_4M4_02]; + +MRESAL_TAC STAB_MOD[`scs_4M4'`;`5`;`3`][SCS_4M4_IS_SCS;K_SCS_4M4;ARITH_RULE`5 MOD 4=1/\ 3 MOD 4=3`] +THEN SYM_ASSUM_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M4_SCS;SCS_DIAG_SCS_4M4_13]]);; + +let SCS_4M4_SLICE_13=prove_by_refinement( +`scs_arrow_v39 {scs_stab_diag_v39 scs_4M4' 1 3 } {scs_prop_equ_v39 scs_3T4 2, scs_3T4 }`, +[ +MATCH_MP_TAC (GEN_ALL Lkgrqui.LKGRQUI) +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4M4_13;STAB_4M4_SCS;SCS_K_D_A_STAB_EQ;] +THEN EXISTS_TAC`1` +THEN EXISTS_TAC`3` +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4M4_13] +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ] +THEN REPEAT RESA_TAC; + + +REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ;scs_slice_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC scs_inj +THEN ASM_SIMP_TAC[SCS_3T4_BASIC;SCS_4M4_BASIC;J_SCS_4M4;BASIC_HALF_SLICE_STAB;J_SCS_3T4;D_HALF_SLICE;BAISC_PROP_EQU;K_SCS_PROP_EUQ;SCS_3T6_BASIC;J_SCS_3T6] +THEN STRIP_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M4] +THEN ARITH_TAC; + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M4; +ARITH_RULE`(3 + 1 + 4 - 1) MOD 4= 3/\ 1 MOD 4=1/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`2`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`2+x:num`;`2+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M4] +THEN ARITH_TAC; + + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M4; +ARITH_RULE`(1 + 1 + 4 - 3) MOD 4= 3/\ 3 MOD 4=3/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`0`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`x:num`;`x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[J_SCS_3T4]; + +]);; + + +let SCS_4M4_SLICE_02=prove_by_refinement( +`scs_arrow_v39 {scs_stab_diag_v39 scs_4M4' 0 2 } { scs_3T3, scs_prop_equ_v39 scs_3M1 1 }`, +[ +MATCH_MP_TAC (GEN_ALL Lkgrqui.LKGRQUI) +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4M4_02;STAB_4M4_SCS;SCS_K_D_A_STAB_EQ;] +THEN EXISTS_TAC`0` +THEN EXISTS_TAC`2` +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4M4_02] +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ] +THEN REPEAT RESA_TAC; + + +REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ;scs_slice_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC scs_inj +THEN ASM_SIMP_TAC[SCS_3T3_BASIC;SCS_4M4_BASIC;J_SCS_4M4;BASIC_HALF_SLICE_STAB;J_SCS_3T3;D_HALF_SLICE;BAISC_PROP_EQU;K_SCS_PROP_EUQ;SCS_3M1_BASIC;J_SCS_3M1;J_SCS_3T3_1] +THEN STRIP_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T3;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M4] +THEN ARITH_TAC; + + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M4; +ARITH_RULE`(2 + 1 + 4 - 0) MOD 4= 3/\ 0 MOD 4=0/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`0`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`x:num`;`x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3M1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M4] +THEN ARITH_TAC; + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M4; +ARITH_RULE`(0 + 1 + 4 - 2) MOD 4= 3/\ 2 MOD 4=2/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`1+x:num`;`1+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[J_SCS_3T3_1]; + +]);; + + + +let MFKLVDK =prove_by_refinement( +` scs_arrow_v39 { scs_4M4' } ({scs_4M7,scs_3T3, scs_3M1, scs_3T4})`, +[ +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`({scs_4M7} UNION {scs_stab_diag_v39 scs_4M4' i j| scs_diag 4 i j})` +THEN ASM_REWRITE_TAC[SCS_4M4_ARROW_SCS_4M7_STAB_4M4;SET_RULE`{A,B,C,D}={A}UNION{B,C,D}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[SCS_4M7_IS_SCS]; + +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_stab_diag_v39 scs_4M4' 0 2,scs_stab_diag_v39 scs_4M4' 1 3}` +THEN ASM_REWRITE_TAC[SET_EQ_DIAG_STAB_4M4;SET_RULE`{A,B}={A} UNION {B}/\ {A,B,C}={A,B}UNION {C}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + +REWRITE_TAC[SET_RULE`{A}UNION {B}={A,B}`] +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_3T3, scs_prop_equ_v39 scs_3M1 1}` +THEN ASM_SIMP_TAC[SCS_4M4_SLICE_02] +THEN REWRITE_TAC[SET_RULE`{A,B}={A}UNION {B}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[SCS_3T3_IS_SCS]; + + +MRESAS_TAC PRO_EQU_ID1[`scs_3M1`;`1`;`3`][SCS_3M1_IS_SCS;K_SCS_3M1;ARITH_RULE`(3 - 1 MOD 3)=2`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_3M1 1`;`2`][PROP_EQU_IS_SCS;SCS_3M1_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]; + + + +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_prop_equ_v39 scs_3T4 2, scs_3T4 }` +THEN ASM_SIMP_TAC[SCS_4M4_SLICE_13;] +THEN ONCE_REWRITE_TAC[SET_RULE`{A}={A}UNION {A}/\ {A,B}={A} UNION {B}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + + +MRESAS_TAC PRO_EQU_ID1[`scs_3T4`;`2`;`3`][SCS_3T4_IS_SCS;K_SCS_3T4;ARITH_RULE`(3 - 2 MOD 3)=1`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_3T4 2`;`1`][PROP_EQU_IS_SCS;SCS_3T4_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]; + + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[SCS_3T4_IS_SCS]]);; + + + +(************************************) + + +let BB_4M5_IMP_BB_4M8= prove +(` + BBs_v39 scs_4M5' v /\ + (!i j. scs_diag 4 i j ==> cstab < dist(v i,v j)) ==> + BBs_v39 (scs_4M8) v`, +SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M5;scs_4M8;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M5;Terminal.FUNLIST_EXPLICIT;K_SCS_4M8] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ 2+1=3/\ 3+1=4`) +THEN SCS_TAC +THEN THAYTHE_TAC 1[`i`;`j`] +THEN DICH_TAC 0 +THEN THAYTHE_TAC 2[`i`;`j`] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN MRESA_TAC PSORT_MOD[`4`;`i`;`j`] +THEN SYM_ASSUM_TAC +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_ADD_MOD[`i`;`1`;`4`] +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`j`;`1`;`4`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`j MOD 4<4==> j MOD 4=0\/ j MOD 4=1\/ j MOD 4=2\/ j MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN MP_TAC sqrt8_LE_CSTAB +THEN MP_TAC LE_sqrt8_2h0 +THEN REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC);; + + + +let MM_4M5_IMP_4M8=prove( +` +MMs_v39 scs_4M5' v /\ + (!i j. scs_diag 4 i j ==> cstab < dist(v i,v j)) ==> + ~(MMs_v39 (scs_4M8) ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC` scs_4M5' ` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4M5' `;`v`] +THEN ASSUME_TAC SCS_4M8_BASIC +THEN ASSUME_TAC K_SCS_4M8 +THEN ASM_SIMP_TAC[SCS_4M8_IS_SCS;SCS_4M5_IS_SCS;SCS_4M5_BASIC;K_SCS_4M5;SCS_K_D_A_STAB_EQ;IN; ADD1;BB_4M5_IMP_BB_4M8] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + +let BB_4M5_IMP_BB_STAN_4M5= prove( +` + BBs_v39 scs_4M5' v /\ + scs_diag 4 i j /\ + dist(v i,v j)<= cstab ==> + BBs_v39 (scs_stab_diag_v39 scs_4M5' i j) v`, +SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M5;scs_4M8;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M5;Terminal.FUNLIST_EXPLICIT;K_SCS_4M8] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ 2+1=3/\ 3+1=4`) +THEN SCS_TAC +THEN MP_TAC(SET_RULE`psort 4 (i,j) = psort 4 (i',j')\/ ~(psort 4 (i,j) = psort 4 (i',j'))`) +THEN RESA_TAC +THEN MRESA_TAC Uaghhbm.CASE_PSORT[`i`;`j'`;`j`;`i'`;`4`] +THENL[ +MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4M5'`][scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M5;scs_4M8;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M5;Terminal.FUNLIST_EXPLICIT;K_SCS_4M8;SCS_4M5_IS_SCS] +THEN THAYTHEL_ASM_TAC 0[`i'`;`i`][] +THEN THAYTHEL_ASM_TAC 0[`j'`;`j`][]; + +MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4M5'`][scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M5;scs_4M8;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M5;Terminal.FUNLIST_EXPLICIT;K_SCS_4M8;SCS_4M5_IS_SCS] +THEN THAYTHEL_ASM_TAC 0[`i'`;`j`][] +THEN THAYTHEL_ASM_TAC 0[`j'`;`i`][] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]]);; + + + +let MM_4M5_IMP_STAB_4M5=prove(` + MMs_v39 scs_4M5' v /\ + scs_diag 4 i j /\ + dist(v i,v j)<= cstab ==> + ~(MMs_v39 (scs_stab_diag_v39 scs_4M5' i j) ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC` scs_4M5' ` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4M5' `;`v`] +THEN ASSUME_TAC SCS_4M5_BASIC +THEN ASSUME_TAC K_SCS_4M5 +THEN ASM_SIMP_TAC[SCS_4M6_IS_SCS;SCS_4M5_IS_SCS;SCS_4M5_BASIC;K_SCS_4M5;SCS_K_D_A_STAB_EQ;IN; ADD1;SCS_DIAG_SCS_4M5_13;BB_4M5_IMP_BB_STAN_4M5;STAB_4M5_SCS] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + +let SCS_4M5_ARROW_SCS_4M8_STAB_4M5=prove_by_refinement( +` scs_arrow_v39 { scs_4M5' } ({scs_4M8} UNION {scs_stab_diag_v39 scs_4M5' i j| scs_diag 4 i j})`, +[ +REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;UNION;IN_ELIM_THM] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + + +ASM_SIMP_TAC[SCS_4M8_IS_SCS]; + + +ASM_SIMP_TAC[STAB_4M5_SCS;K_SCS_4M5]; + + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_4M5' ==> MMs_v39 s = {}) \/ ~((!s. s = scs_4M5' ==> MMs_v39 s = {}))`); + + +ASM_REWRITE_TAC[]; + + + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC; + + +MP_TAC(SET_RULE`(!i j. scs_diag 4 i j ==> cstab < dist(v i,v j))\/ ~((!i j. scs_diag 4 i j ==> cstab < dist((v:num->real^3) i,v j)))`) +THEN RESA_TAC; + + +EXISTS_TAC`scs_4M8` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MM_4M5_IMP_4M8 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[]; + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;REAL_ARITH`~(a b<=a`] +THEN STRIP_TAC +THEN MP_TAC MM_4M5_IMP_STAB_4M5 +THEN RESA_TAC +THEN DICH_TAC 0 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC +THEN EXISTS_TAC `scs_stab_diag_v39 scs_4M5' i j` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +MATCH_MP_TAC(SET_RULE`A==> B\/A`) +THEN EXISTS_TAC`i:num` +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[]; + + +EXISTS_TAC`v':num->real^3` +THEN ASM_REWRITE_TAC[]]);; + + + + +let SET_STAB_4M5=prove(`{ scs_stab_diag_v39 scs_4M5' i j| scs_diag 4 i j }= { scs_stab_diag_v39 scs_4M5' (i MOD 4) (j MOD 4)| scs_diag 4 (i MOD 4) (j MOD 4) }`, + ASM_SIMP_TAC[STAB_MOD;DIAG_MOD;EXTENSION;IN_ELIM_THM;ARITH_RULE`~(4=0)`;] +THEN MRESAL_TAC STAB_MOD[`scs_4M5'`][SCS_4M5_IS_SCS;K_SCS_4M5]);; + +let EXPAND_STAB_DIAG_4M5=prove(` +{scs_stab_diag_v39 scs_4M5' (i MOD 4) (j MOD 4) | j MOD 4 = + (i MOD 4 + 2) MOD 4}= +{scs_stab_diag_v39 scs_4M5' (i+2) i| i<4} `, +ASM_SIMP_TAC[EXPAND_STAB_DIAG_4;SCS_4M5_IS_SCS;K_SCS_4M5]);; + + +let SET_EQ_DIAG_STAB_4M5=prove_by_refinement( +`scs_arrow_v39 + { scs_stab_diag_v39 scs_4M5' i j| scs_diag 4 i j } + {scs_stab_diag_v39 scs_4M5' 0 2,scs_stab_diag_v39 scs_4M5' 1 3}`, +[ +ASM_SIMP_TAC[EXPAND_STAB_DIAG_4M5;SET_STAB_4M5;EXPAND_DIAG_4V;MOD_REFL;ARITH_RULE`~(4=0)`] +THEN +REWRITE_TAC[ARITH_RULE`i<4<=> i=0\/i=1\/i=2\/i=3`;SET_RULE`{scs_stab_diag_v39 scs_4M5' (i + 2) i |i=0\/i=1\/i=2\/i=3} += {scs_stab_diag_v39 scs_4M5' (0 + 2) 0} UNION +{scs_stab_diag_v39 scs_4M5' (1 + 2) 1} UNION +{scs_stab_diag_v39 scs_4M5' (2 + 2) 2} UNION +{scs_stab_diag_v39 scs_4M5' (3 + 2) 3} +`;] +THEN ONCE_REWRITE_TAC[SET_RULE`{scs_stab_diag_v39 scs_4M5' 0 2,scs_stab_diag_v39 scs_4M5' 1 3}={scs_stab_diag_v39 scs_4M5' 0 2} UNION {scs_stab_diag_v39 scs_4M5' 1 3}UNION {scs_stab_diag_v39 scs_4M5' 0 2} UNION {scs_stab_diag_v39 scs_4M5' 1 3}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN REWRITE_TAC[ARITH_RULE`0+2=2/\ 1+2=3/\2+2=4/\ 3+2=5`] +THEN MRESA_TAC STAB_SYM[`scs_4M5'`;`0`;`2`] +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M5_SCS;SCS_DIAG_SCS_4M5_02]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN MRESA_TAC STAB_SYM[`scs_4M5'`;`1`;`3`] +THEN STRIP_TAC; + + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M5_SCS;SCS_DIAG_SCS_4M5_13]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN MRESAL_TAC STAB_MOD[`scs_4M5'`;`4`;`2`][SCS_4M5_IS_SCS;K_SCS_4M5;ARITH_RULE`4 MOD 4=0/\ 2 MOD 4=2`] +THEN SYM_ASSUM_TAC +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M5_SCS;SCS_DIAG_SCS_4M5_02]; + +MRESAL_TAC STAB_MOD[`scs_4M5'`;`5`;`3`][SCS_4M5_IS_SCS;K_SCS_4M5;ARITH_RULE`5 MOD 4=1/\ 3 MOD 4=3`] +THEN SYM_ASSUM_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M5_SCS;SCS_DIAG_SCS_4M5_13]]);; + + + +let PROP_OPP_DIAG_4M5_13= prove_by_refinement(`scs_stab_diag_v39 scs_4M5' 1 3= scs_prop_equ_v39(scs_opp_v39 (scs_stab_diag_v39 scs_4M5' 0 2)) 2 `, +[REWRITE_TAC[scs_prop_equ_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39;SCS_K_D_A_STAB_EQ;scs_opp_v39] +THEN MATCH_MP_TAC scs_inj +THEN SIMP_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;SCS_4M5_BASIC;STAB_4M5_SCS;SCS_DIAG_SCS_4M5_13;scs_basic;unadorned_v39;peropp;peropp2] +THEN SCS_TAC +THEN STRIP_TAC; + +SET_TAC[]; + + +STRIP_TAC +THEN ASM_REWRITE_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_5M3;mk_unadorned_v39;peropp;peropp2;FUN_EQ_THM;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN REPEAT GEN_TAC +THEN ASSUME_TAC (ARITH_RULE`~(4=0)`) +THEN MRESA_TAC PSORT_MOD[`4`;`x`;`x'`] +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`2`;`x`;`4`] +THEN MRESA_TAC MOD_ADD_MOD[`2`;`x'`;`4`] +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`x MOD 4<4==> x MOD 4=0\/ x MOD 4=1\/ x MOD 4=2\/ x MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 4<4==> x' MOD 4=0\/ x' MOD 4=1\/ x' MOD 4=2\/ x' MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[Uxckfpe.ARITH_4_TAC;PSORT_5_EXPLICIT;ARITH_RULE`4-1=3/\ 4-2=2/\ 4-3=1/\ 4-4=0/\ 5-5=0/\ 2+0=2/\ 2+1=3/\ 2+2=4/\ 2+3=5/\2+4=6 +/\ 3+0=3/\ 3+1=4/\ 3+2=5/\ 3+3=6/\ 3+4=7/\ 7 MOD 5=2`;PAIR_EQ;Terminal.FUNLIST_EXPLICIT;]]);; + + + +let STAB_4M5_02_ARROW_4M5_13=prove(`scs_arrow_v39 {scs_stab_diag_v39 scs_4M5' 0 2}{scs_stab_diag_v39 scs_4M5' 1 3}`, +ASM_SIMP_TAC[PROP_OPP_DIAG_4M5_13] +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_opp_v39 (scs_stab_diag_v39 scs_4M5' 0 2)}` +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC (GEN_ALL YXIONXL2) +THEN EXISTS_TAC`4` +THEN ASM_SIMP_TAC[SCS_K_D_A_STAB_EQ;ARITH_RULE`~(4<=3)`;K_SCS_4M5;STAB_4M5_SCS;SCS_DIAG_SCS_4M5_02] +; + +MATCH_MP_TAC(GEN_ALL YXIONXL3) +THEN MATCH_MP_TAC (GEN_ALL OPP_IS_SCS) +THEN EXISTS_TAC`scs_opp_v39 (scs_stab_diag_v39 scs_4M5' 0 2)` +THEN ASM_SIMP_TAC[SCS_K_D_A_STAB_EQ;ARITH_RULE`~(4<=3)`;K_SCS_4M5;STAB_4M5_SCS;SCS_DIAG_SCS_4M5_02]]);; + + +let SCS_4M5_SLICE_13=prove_by_refinement( +`scs_arrow_v39 {scs_stab_diag_v39 scs_4M5' 1 3 } {scs_3T4}`, +[ +ONCE_REWRITE_TAC[SET_RULE`{scs_3T4}={scs_3T4,scs_3T4}`] +THEN MATCH_MP_TAC (GEN_ALL Lkgrqui.LKGRQUI) +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4M5_13;STAB_4M5_SCS;SCS_K_D_A_STAB_EQ;] +THEN EXISTS_TAC`1` +THEN EXISTS_TAC`3` +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4M5_13] +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ] +THEN REPEAT RESA_TAC; + +REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ;scs_slice_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC scs_inj +THEN ASM_SIMP_TAC[SCS_3T4_BASIC;SCS_4M5_BASIC;J_SCS_4M5;BASIC_HALF_SLICE_STAB;J_SCS_3T4_1;D_HALF_SLICE;BAISC_PROP_EQU;K_SCS_PROP_EUQ;SCS_3T6_BASIC;J_SCS_3T6] +THEN STRIP_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M5] +THEN ARITH_TAC; + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M5; +ARITH_RULE`(3 + 1 + 4 - 1) MOD 4= 3/\ 1 MOD 4=1/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`0`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`x:num`;`x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M5] +THEN ARITH_TAC; + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T6;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M5; +ARITH_RULE`(1 + 1 + 4 - 3) MOD 4= 3/\ 3 MOD 4=3/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`0`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`x:num`;`x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[J_SCS_3T4_1]; + +]);; + + +let RYPDIXT =prove_by_refinement( +` scs_arrow_v39 { scs_4M5' } ({scs_4M8,scs_3T4})`, +[ +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`({scs_4M8} UNION {scs_stab_diag_v39 scs_4M5' i j| scs_diag 4 i j})` +THEN ASM_REWRITE_TAC[SCS_4M5_ARROW_SCS_4M8_STAB_4M5;SET_RULE`{A,B}={A}UNION{B}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[SCS_4M8_IS_SCS]; + +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_stab_diag_v39 scs_4M5' 0 2,scs_stab_diag_v39 scs_4M5' 1 3}` +THEN ASM_REWRITE_TAC[SET_EQ_DIAG_STAB_4M5] +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_stab_diag_v39 scs_4M5' 1 3,scs_stab_diag_v39 scs_4M5' 1 3}` +THEN STRIP_TAC; + +REWRITE_TAC[SET_RULE`{A,B}={A}UNION{B}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_REWRITE_TAC[STAB_4M5_02_ARROW_4M5_13]; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M5_SCS;SCS_DIAG_SCS_4M5_13]; + +REWRITE_TAC[SET_RULE`{A,A}={A}`;SCS_4M5_SLICE_13]; + +]);; + + +(******** NWDGKXH CASES EQ cstab*******************) + + +let BB_4M6_IMP_4T5=prove(`!v. + BBs_v39 (scs_stab_diag_v39 scs_4M6' 1 3) v + ==> + BBs_v39 (scs_4T5) v`, +SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M6;scs_4T5;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4I3;Terminal.FUNLIST_EXPLICIT;] +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC 1[`i`;`j`] +THEN DICH_TAC 0 +THEN MP_TAC(SET_RULE`psort 4 (i,j) = 1,3\/ ~(psort 4 (i,j) = 1,3)`) +THEN RESA_TAC +THEN MRESAL_TAC Uaghhbm.CASE_PSORT[`i`;`3`;`j`;`1`;`4`][PSORT_5_EXPLICIT;Uxckfpe.ARITH_4_TAC;PAIR_EQ;cstab] +THEN DICH_TAC 0 +THEN SCS_TAC +THEN RESA_TAC +THEN SCS_TAC);; + + +let MM_4M6_IMP_4T5=prove( +`MMs_v39 (scs_stab_diag_v39 scs_4M6' 1 3) v + ==> + ~(MMs_v39 (scs_4T5) ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`(scs_stab_diag_v39 scs_4M6' 1 3)` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`(scs_stab_diag_v39 scs_4M6' 1 3)`;`v`] +THEN ASSUME_TAC SCS_4T5_BASIC +THEN ASSUME_TAC K_SCS_4T5 +THEN ASM_SIMP_TAC[SCS_4T5_IS_SCS;STAB_4M6_SCS;K_SCS_4M6;SCS_K_D_A_STAB_EQ;IN; ADD1;SCS_DIAG_SCS_4M6_13;BB_4M6_IMP_4T5] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + +let STAB_4M6_13_ARROW_4T5=prove_by_refinement( +` scs_arrow_v39 { scs_stab_diag_v39 scs_4M6' 1 3 } {scs_4T5}`, +[ +REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;UNION;IN_ELIM_THM] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +ASM_SIMP_TAC[SCS_4T5_IS_SCS]; + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_stab_diag_v39 scs_4M6' 1 3 ==> MMs_v39 s = {}) \/ ~((!s. s = scs_stab_diag_v39 scs_4M6' 1 3 ==> MMs_v39 s = {}))`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`scs_4T5` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MM_4M6_IMP_4T5 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN RESA_TAC]);; + + +let PROP_OPP_DIAG_4M6_13= prove_by_refinement(`scs_stab_diag_v39 scs_4M6' 1 3= scs_prop_equ_v39(scs_opp_v39 (scs_stab_diag_v39 scs_4M6' 0 2)) 2 `, +[REWRITE_TAC[scs_prop_equ_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39;SCS_K_D_A_STAB_EQ;scs_opp_v39] +THEN MATCH_MP_TAC scs_inj +THEN SIMP_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;SCS_4M6_BASIC;STAB_4M6_SCS;SCS_DIAG_SCS_4M6_13;scs_basic;unadorned_v39;peropp;peropp2] +THEN SCS_TAC +THEN STRIP_TAC; + + +SET_TAC[]; + +STRIP_TAC +THEN ASM_REWRITE_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_5M3;mk_unadorned_v39;peropp;peropp2;FUN_EQ_THM;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN REPEAT GEN_TAC +THEN ASSUME_TAC (ARITH_RULE`~(4=0)`) +THEN MRESA_TAC PSORT_MOD[`4`;`x`;`x'`] +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`2`;`x`;`4`] +THEN MRESA_TAC MOD_ADD_MOD[`2`;`x'`;`4`] +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`x MOD 4<4==> x MOD 4=0\/ x MOD 4=1\/ x MOD 4=2\/ x MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 4<4==> x' MOD 4=0\/ x' MOD 4=1\/ x' MOD 4=2\/ x' MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[Uxckfpe.ARITH_4_TAC;PSORT_5_EXPLICIT;ARITH_RULE`4-1=3/\ 4-2=2/\ 4-3=1/\ 4-4=0/\ 5-5=0/\ 2+0=2/\ 2+1=3/\ 2+2=4/\ 2+3=5/\2+4=6 +/\ 3+0=3/\ 3+1=4/\ 3+2=5/\ 3+3=6/\ 3+4=7/\ 7 MOD 5=2`;PAIR_EQ;Terminal.FUNLIST_EXPLICIT;]]);; + + + + + +let STAB_4M6_02_ARROW_4M6_13=prove(`scs_arrow_v39 {scs_stab_diag_v39 scs_4M6' 0 2}{scs_stab_diag_v39 scs_4M6' 1 3}`, +ASM_SIMP_TAC[PROP_OPP_DIAG_4M6_13] +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_opp_v39 (scs_stab_diag_v39 scs_4M6' 0 2)}` +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC (GEN_ALL YXIONXL2) +THEN EXISTS_TAC`4` +THEN ASM_SIMP_TAC[SCS_K_D_A_STAB_EQ;ARITH_RULE`~(4<=3)`;K_SCS_4M6;STAB_4M6_SCS;SCS_DIAG_SCS_4M6_02] +; + +MATCH_MP_TAC(GEN_ALL YXIONXL3) +THEN MATCH_MP_TAC (GEN_ALL OPP_IS_SCS) +THEN EXISTS_TAC`scs_opp_v39 (scs_stab_diag_v39 scs_4M6' 0 2)` +THEN ASM_SIMP_TAC[SCS_K_D_A_STAB_EQ;ARITH_RULE`~(4<=3)`;K_SCS_4M6;STAB_4M6_SCS;SCS_DIAG_SCS_4M6_02]]);; + + +let STAB_4M6_02_ARROW_4T5 =prove(`scs_arrow_v39 { scs_stab_diag_v39 scs_4M6' 0 2 } { scs_4T5 }`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_stab_diag_v39 scs_4M6' 1 3}` +THEN ASM_SIMP_TAC[STAB_4M6_02_ARROW_4M6_13;STAB_4M6_13_ARROW_4T5]);; + + +let SET_STAB_4M6=prove(`{ scs_stab_diag_v39 scs_4M6' i j| scs_diag 4 i j }= { scs_stab_diag_v39 scs_4M6' (i MOD 4) (j MOD 4)| scs_diag 4 (i MOD 4) (j MOD 4) }`, + ASM_SIMP_TAC[STAB_MOD;DIAG_MOD;EXTENSION;IN_ELIM_THM;ARITH_RULE`~(4=0)`;] +THEN MRESAL_TAC STAB_MOD[`scs_4M6'`][SCS_4M6_IS_SCS;K_SCS_4M6]);; + +let EXPAND_STAB_DIAG_4M6=prove(` +{scs_stab_diag_v39 scs_4M6' (i MOD 4) (j MOD 4) | j MOD 4 = + (i MOD 4 + 2) MOD 4}= +{scs_stab_diag_v39 scs_4M6' (i+2) i| i<4} `, +ASM_SIMP_TAC[EXPAND_STAB_DIAG_4;SCS_4M6_IS_SCS;K_SCS_4M6]);; + + +let SET_EQ_DIAG_STAB_4M6=prove_by_refinement(`scs_arrow_v39 + { scs_stab_diag_v39 scs_4M6' i j| scs_diag 4 i j } {scs_stab_diag_v39 scs_4M6' 0 2,scs_stab_diag_v39 scs_4M6' 1 3}`, +[ +ASM_SIMP_TAC[EXPAND_STAB_DIAG_4M6;SET_STAB_4M6;EXPAND_DIAG_4V;MOD_REFL;ARITH_RULE`~(4=0)`] +THEN +REWRITE_TAC[ARITH_RULE`i<4<=> i=0\/i=1\/i=2\/i=3`;SET_RULE`{scs_stab_diag_v39 scs_4M6' (i + 2) i |i=0\/i=1\/i=2\/i=3} += {scs_stab_diag_v39 scs_4M6' (0 + 2) 0} UNION +{scs_stab_diag_v39 scs_4M6' (1 + 2) 1} UNION +{scs_stab_diag_v39 scs_4M6' (2 + 2) 2} UNION +{scs_stab_diag_v39 scs_4M6' (3 + 2) 3} +`;] +THEN ONCE_REWRITE_TAC[SET_RULE`{scs_stab_diag_v39 scs_4M6' 0 2,scs_stab_diag_v39 scs_4M6' 1 3}={scs_stab_diag_v39 scs_4M6' 0 2} UNION {scs_stab_diag_v39 scs_4M6' 1 3}UNION {scs_stab_diag_v39 scs_4M6' 0 2} UNION {scs_stab_diag_v39 scs_4M6' 1 3}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN REWRITE_TAC[ARITH_RULE`0+2=2/\ 1+2=3/\2+2=4/\ 3+2=5`] +THEN MRESA_TAC STAB_SYM[`scs_4M6'`;`0`;`2`] +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M6_SCS;SCS_DIAG_SCS_4M6_02]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN MRESA_TAC STAB_SYM[`scs_4M6'`;`1`;`3`] +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M6_SCS;SCS_DIAG_SCS_4M6_13]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN MRESAL_TAC STAB_MOD[`scs_4M6'`;`4`;`2`][SCS_4M6_IS_SCS;K_SCS_4M6;ARITH_RULE`4 MOD 4=0/\ 2 MOD 4=2`] +THEN SYM_ASSUM_TAC +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M6_SCS;SCS_DIAG_SCS_4M6_02]; + +MRESAL_TAC STAB_MOD[`scs_4M6'`;`5`;`3`][SCS_4M6_IS_SCS;K_SCS_4M6;ARITH_RULE`5 MOD 4=1/\ 3 MOD 4=3`] +THEN SYM_ASSUM_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M6_SCS;SCS_DIAG_SCS_4M6_13]]);; + + + + +let SET_STAB_4M6_ARROW_4T5=prove(`scs_arrow_v39 + { scs_stab_diag_v39 scs_4M6' i j| scs_diag 4 i j } {scs_4T5}`, +ONCE_REWRITE_TAC[SET_RULE`{A}={A,A}`] +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_stab_diag_v39 scs_4M6' 0 2,scs_stab_diag_v39 scs_4M6' 1 3}` +THEN ASM_REWRITE_TAC[SET_EQ_DIAG_STAB_4M6;] +THEN REWRITE_TAC[SET_RULE`{A,B}={A}UNION{B}`;] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[STAB_4M6_02_ARROW_4T5;STAB_4M6_13_ARROW_4T5]);; + + + +let BB_4M6_IMP_BB_STAN_4M6= prove(` + BBs_v39 scs_4M6' v /\ + scs_diag 4 i j /\ + dist(v i,v j)<= cstab ==> + BBs_v39 (scs_stab_diag_v39 scs_4M6' i j) v`, +SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M6;scs_4M6;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M6;Terminal.FUNLIST_EXPLICIT;K_SCS_4M6] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ 2+1=3/\ 3+1=4`) +THEN SCS_TAC +THEN MP_TAC(SET_RULE`psort 4 (i,j) = psort 4 (i',j')\/ ~(psort 4 (i,j) = psort 4 (i',j'))`) +THEN RESA_TAC +THEN MRESA_TAC Uaghhbm.CASE_PSORT[`i`;`j'`;`j`;`i'`;`4`] +THENL[ +MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4M6'`][scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M6;scs_4M6;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M6;Terminal.FUNLIST_EXPLICIT;K_SCS_4M6;SCS_4M6_IS_SCS] +THEN THAYTHEL_ASM_TAC 0[`i'`;`i`][] +THEN THAYTHEL_ASM_TAC 0[`j'`;`j`][]; + +MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4M6'`][scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M6;scs_4M6;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M6;Terminal.FUNLIST_EXPLICIT;K_SCS_4M6;SCS_4M6_IS_SCS] +THEN THAYTHEL_ASM_TAC 0[`i'`;`j`][] +THEN THAYTHEL_ASM_TAC 0[`j'`;`i`][] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]]);; + + +let MM_4M6_IMP_STAB_4M6=prove(` + MMs_v39 scs_4M6' v /\ + scs_diag 4 i j /\ + dist(v i,v j)<= cstab ==> + ~(MMs_v39 (scs_stab_diag_v39 scs_4M6' i j) ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC` scs_4M6' ` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4M6' `;`v`] +THEN ASSUME_TAC SCS_4M6_BASIC +THEN ASSUME_TAC K_SCS_4M6 +THEN ASM_SIMP_TAC[SCS_4M6_IS_SCS;SCS_4M6_IS_SCS;SCS_4M6_BASIC;K_SCS_4M6;SCS_K_D_A_STAB_EQ;IN; ADD1;SCS_DIAG_SCS_4M6_13;BB_4M6_IMP_BB_STAN_4M6;STAB_4M6_SCS] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/AURSIPD.hl b/text_formalization/local/AURSIPD.hl new file mode 100644 index 0000000..a4d1536 --- /dev/null +++ b/text_formalization/local/AURSIPD.hl @@ -0,0 +1,1850 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Aursipd = struct + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +open Yxionxl2;; +open Eyypqdw;; +open Ocbicby;; +open Imjxphr;; + +open Nuxcoea;; +open Fektyiy;; + + + + + +let REP_NUMSEG=prove(`~(k=0) ==> {i | i < k}= 0.. (k-1)`, +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC);; + + + +let SUM_AZIM_EQ_ANGLE_LE4_FUN=prove_by_refinement( +` ~(scs_k_v39 s<=3)/\ + BBs_v39 s vv /\ + is_scs_v39 s /\ +(vv:num->real^3) (p MOD (scs_k_v39 s))=u /\ +IMAGE (vv:num->real^3) (:num)=V/\ + IMAGE (\i. {vv i,(vv:num->real^3) (SUC i)}) (:num)=E/\ + IMAGE (\i. (vv i,(vv:num->real^3) (SUC i))) (:num)=FF +==> + sum {i | i < scs_k_v39 s} + (\i. ff((vv:num->real^3) (i+p MOD scs_k_v39 s)) * + interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) u)) +=sum FF (\e. ff(FST e) * azim_in_fan e E) +`, +[ +MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`p MOD scs_k_v39 s`;`vv:num->real^3`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[MMs_v39;BBprime_v39;BBprime2_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN REPEAT RESA_TAC; + +REPLICATE_TAC (30-2)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +MATCH_MP_TAC SUM_EQ_GENERAL +THEN EXISTS_TAC`(\i. (vv:num->real^3) (i+ p MOD k), vv (SUC i + p MOD k))` +THEN MP_TAC(ARITH_RULE`3<= k ==> ~(k=0) /\ 1(x MOD k+ k- p MOD k) + p MOD k = x MOD k+k /\ (x + p MOD k) + k- p MOD k= x+k`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x MOD k + k - p MOD k) MOD k + p MOD k:num` +THEN MRESA1_TAC th ` x:num`) +THEN MRESA_TAC MOD_ADD_MOD[`x:num`;`1`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`(x MOD k + k - p MOD k) MOD k + p MOD k`;`1`;`k:num`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;ARITH_RULE`SUC ((x MOD k + k - p MOD k) MOD k) + p MOD k = ((x MOD k + k - p MOD k) MOD k + p MOD k)+1`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `((x MOD k + k - p MOD k) MOD k + p MOD k)+1:num` +THEN MRESA1_TAC th ` x+1:num`) +THEN REWRITE_TAC[ADD1] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC DIVISION[`x:num`;`k:num`] +THEN MRESA_TAC DIVISION[`y' + p MOD k:num`;`k:num`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `y' + p MOD k:num`) +THEN MP_TAC VV_INJ +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;scs_half_slice_v39;PAIR_EQ;REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`;dist] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(y'+ p MOD k) MOD k:num`;`(x MOD k + k)MOD k`]) +THEN MRESA_TAC MOD_LT[`y':num`;`k:num`] +THEN MRESAL_TAC(GEN_ALL Hdplygy.MOD_EQ_MOD)[`y':num`;`x MOD k + k- p MOD k`;`p MOD k`;`k:num`][] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ADD_SYM] +THEN RESA_TAC; + +REWRITE_TAC[IN_ELIM_THM;] +THEN REPEAT STRIP_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`x+ p MOD k` +THEN REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ADD1;ARITH_RULE`(x + 1) + p MOD k= (x + p MOD k)+1`]; + +MRESAL_TAC(GEN_ALL VV_SUC_EQ_RHO_NODE_PRIME)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`k:num`;`s:scs_v39`;`FF:real^3#real^3->bool`;`u:real^3`;`vv:num->real^3`;`p:num MOD k`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN SUBGOAL_THEN`(vv:num->real^3) (x + p MOD k) IN V`ASSUME_TAC; + +EXPAND_TAC"V" +THEN REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`x+ p MOD k` +THEN REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +REPLICATE_TAC (35-6)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(vv:num->real^3) (x + p MOD k )`]) +THEN REPLICATE_TAC (3) REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC th +THEN MRESAL1_TAC th`SUC x`[ITER])]);; + + + + +let PERIODIC_IMAGE2=prove(`~(n = 0) /\ periodic f n ==> {f i | i < n} = IMAGE f (:num)`, +STRIP_TAC +THEN MRESA_TAC Oxlzlez.PERIODIC_IMAGE[`f`;`n`] +THEN SYM_ASSUM_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN SET_TAC[]);; + + + + + + +let AURSIPD_concl = `!s v. + 3< scs_k_v39 s /\ is_scs_v39 s /\ scs_generic v /\ v IN MMs_v39 s ==> + 3 + CARD { i | i < scs_k_v39 s /\ scs_is_str s v i} <= scs_k_v39 s`;; + +let AURSIPD= prove_by_refinement((AURSIPD_concl), +[REWRITE_TAC[IN;scs_is_str;scs_generic] +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN ABBREV_TAC`V= IMAGE (v:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((v:num->real^3) i, v (SUC i))) (:num)` +THEN MATCH_MP_TAC(ARITH_RULE`~(b-3< c) /\ 3 3+c <= b:num`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN SUBGOAL_THEN `CARD {i | i < k /\ azim (vec 0) (v i) (v (SUC i)) (v (i + k - 1)) = pi}<= CARD (0..(k-1))` ASSUME_TAC; + + +MATCH_MP_TAC CARD_SUBSET +THEN ASM_REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN DICH_TAC 8 +THEN ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[CARD_NUMSEG] +THEN MP_TAC(ARITH_RULE`3 (k-1+1)-0=k`) +THEN RESA_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`{i | i < k /\ azim (vec 0:real^3) (v i) (v (SUC i)) (v (i + k - 1)) = pi} SUBSET (0..(k-1))`ASSUME_TAC; + + + +ASM_REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN DICH_TAC 8 +THEN ARITH_TAC; + + + +ABBREV_TAC`a=CARD {i | i < k /\ azim (vec 0) (v i) ((v:num->real^3) (SUC i)) (v (i + k - 1)) = pi}` +THEN MP_TAC(ARITH_RULE`3 a=k \/ a =k-1\/ a=k-2`) +THEN RESA_TAC; + + + +MRESAL_TAC SUBSET_CARD_EQ[`{i | i < k /\ azim (vec 0) (v i) ((v:num->real^3) (SUC i)) (v (i + k - 1)) = pi}`;`0..(k-1)`][FINITE_NUMSEG;CARD_NUMSEG] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG] +THEN STRIP_TAC +THEN ABBREV_TAC`v0= (v:num->real^3) 0` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`s:scs_v39`;`v`] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`k:num`;`s`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC WL_IN_V[`0`;`v`] +THEN MRESA_TAC Odxlstcv2.CARD_V_EQ_SCS_K1[`s`;`v`;`V`;`k:num`] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC Nuxcoea.MMS_IMP_BBPRIME[`s:scs_v39`;`v`][LET_DEF;LET_END_DEF;BBprime_v39] +THEN MRESA_TAC JKQEWGV1[`s:scs_v39`;`v`] +THEN STRIP_TAC +THEN DICH_TAC 1 +THEN REWRITE_TAC[REAL_ARITH`~(a< b)<=> b<=a`;sol_local] +THEN MATCH_MP_TAC (REAL_ARITH`&0< a/\ b= &0==> a<= &2 *a +b`) +THEN REWRITE_TAC[PI_WORKS] +THEN MATCH_MP_TAC SUM_EQ_0 +THEN GEN_TAC +THEN STRIP_TAC +THEN MRESA_TAC Local_lemmas.LOFA_DETERMINE_AZIM_IN_FA[`V:real^3->bool`;`FF`;`E`;`x`] +THEN MRESA_TAC Local_lemmas.DETER_RHO_NODE[`V:real^3->bool`;`E`;`FF`;`FST x`;`SND x`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IMP_IN_V2[`E`;`FF`;`x`;`V`] +THEN MRESA_TAC Local_lemmas1.LF_AZIM_CYCLE_EQ_IVS_ND[`V`;`E`;`FF`;`FST x`] +THEN DICH_TAC (27-22) +THEN EXPAND_TAC "FF" +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[IMAGE;IN_ELIM_THM] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k<=3)/\ (k+1)-1=k/\ ~(k=0)/\ 1 x' MOD k <= k-1 +/\ 0<= x' MOD k `) +THEN RESA_TAC +THEN RESA_TAC +THEN THAYTHEL_TAC 0 [`x' MOD k`][ARITH_RULE`a+1= SUC a/\ a+2= SUC (SUC a)`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC Yxionxl2.MOD_SUC_MOD[`x'`;`k`] +THEN MRESA_TAC MOD_REFL[`SUC x' `;`k`] +THEN MRESA_TAC MOD_REFL[`x' `;`k`] +THEN MRESA_TAC +CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`SUC ((x') MOD k)`;`v:num->real^3`;`SUC ((x') MOD k) MOD k`] +THEN MRESA_TAC +CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`SUC (x') MOD k`;`v:num->real^3`;`SUC (x')`] +THEN MRESA_TAC WL_IN_V[`x' MOD k`;`v`] +THEN MP_TAC Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1 +THEN RESA_TAC +THEN THAYTHE_TAC 0[`v (x' MOD k)`] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME[`V`;`E`;`k`;`s`;`FF`;`v (x' MOD k)`;`v`;` x' MOD k`][ARITH_RULE`a+0=a`] +THEN MRESA_TAC +CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`x' MOD k`;`v:num->real^3`;`x'`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`a+k-1=k-1+a`] +THEN REAL_ARITH_TAC; + +MP_TAC(SET_RULE`(!i. i < k ==> azim (vec 0) (v i) (v (SUC i)) (v (i + k - 1)) = pi) \/ ~(!i. i < k ==> azim (vec 0:real^3) (v i) (v (SUC i)) (v (i + k - 1)) = pi)`) +THEN RESA_TAC; + + +MP_TAC(SET_RULE`(!i. i < k ==> azim (vec 0) (v i) (v (SUC i)) (v (i + k - 1)) = pi) +==> {i | i < k /\ azim (vec 0) (v i) (v (SUC i)) (v (i + k - 1)) = pi}= {i| i ~(k=0)/\ ~(k=k-1)`) +THEN RESA_TAC +THEN MRESAL_TAC REP_NUMSEG[`k:num`][CARD_NUMSEG] +; + +POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[NOT_FORALL_THM;NOT_IMP] +THEN REWRITE_TAC[NOT_IMP] +THEN STRIP_TAC + THEN SUBGOAL_THEN`{i | i < k /\ azim (vec 0:real^3) (v i) (v (SUC i)) (v (i + k - 1)) = pi} SUBSET (0..(k-1)) DELETE i` ASSUME_TAC; + + +MATCH_MP_TAC (SET_RULE`A SUBSET B /\ ~(a IN A) ==> A SUBSET B DELETE a`) +THEN ASM_REWRITE_TAC[IN_ELIM_THM]; + + + +MRESAL_TAC FINITE_SUBSET[`(0..k - 1) DELETE i`;`(0..k - 1)`][FINITE_NUMSEG;DELETE_SUBSET] +THEN SUBGOAL_THEN`i IN 0..(k-1)`ASSUME_TAC +; + +ASM_REWRITE_TAC[IN_NUMSEG] +THEN DICH_TAC 3 +THEN DICH_TAC 16 +THEN ARITH_TAC; + +MRESAL_TAC CARD_DELETE[`i`;`0..(k-1)`][FINITE_NUMSEG] +THEN MRESAL_TAC SUBSET_CARD_EQ[`{i | i < k /\ azim (vec 0) (v i) ((v:num->real^3) (SUC i)) (v (i + k - 1)) = pi}`;`(0..(k-1)) DELETE i`][FINITE_NUMSEG;CARD_NUMSEG] +; + + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG] +THEN STRIP_TAC +THEN ABBREV_TAC`v0= (v:num->real^3) 0` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`s:scs_v39`;`v`] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`k:num`;`s`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC WL_IN_V[`0`;`v`] +THEN MRESA_TAC Odxlstcv2.CARD_V_EQ_SCS_K1[`s`;`v`;`V`;`k:num`] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC Nuxcoea.MMS_IMP_BBPRIME[`s:scs_v39`;`v`][LET_DEF;LET_END_DEF;BBprime_v39] +THEN MRESA_TAC JKQEWGV1[`s:scs_v39`;`v`] +THEN STRIP_TAC +THEN DICH_TAC 1 +THEN REWRITE_TAC[REAL_ARITH`~(a< b)<=> b<=a`;sol_local] +THEN MP_TAC(ARITH_RULE`3 ~(k<=3)/\ 0 b=a+c`] +THEN SUBGOAL_THEN`sum ((0..k - 1) DELETE i) + (\i. interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) v0)-pi) = &0`ASSUME_TAC +; + + + +MATCH_MP_TAC SUM_EQ_0 +THEN GEN_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k<=3)/\ (k+1)-1=k/\ ~(k=0)/\ 1 a=b`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3 1<=k`) +THEN RESA_TAC +THEN MRESA_TAC REAL_OF_NUM_SUB[`1`;`k`] +THEN SYM_ASSUM_TAC +THEN MATCH_MP_TAC(REAL_ARITH` +&0<= interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) v0) +==> pi <= + &2 * pi + + ((&k - &1) * pi + interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) v0)) - + &k * pi`) +THEN REWRITE_TAC[interior_angle1;azim] +; + + + + +MP_TAC(SET_RULE`(!i. i < k ==> azim (vec 0) (v i) (v (SUC i)) (v (i + k - 1)) = pi) \/ ~(!i. i < k ==> azim (vec 0:real^3) (v i) (v (SUC i)) (v (i + k - 1)) = pi)`) +THEN RESA_TAC; + + +MP_TAC(SET_RULE`(!i. i < k ==> azim (vec 0) (v i) (v (SUC i)) (v (i + k - 1)) = pi) +==> {i | i < k /\ azim (vec 0) (v i) (v (SUC i)) (v (i + k - 1)) = pi}= {i| i ~(k=0)/\ ~(k=k-2)`) +THEN RESA_TAC +THEN MRESAL_TAC REP_NUMSEG[`k:num`][CARD_NUMSEG] +; + +POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[NOT_FORALL_THM;NOT_IMP] +THEN REWRITE_TAC[NOT_IMP] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(!j. j < k /\ ~(i=j) ==> azim (vec 0) (v j) (v (SUC j)) (v (j + k - 1)) = pi) \/ ~(!j. j < k /\ ~(i=j) ==> azim (vec 0:real^3) (v j) (v (SUC j)) (v (j + k - 1)) = pi)`) +THEN RESA_TAC; + + + +SUBGOAL_THEN`{i | i < k /\ azim (vec 0:real^3) (v i) (v (SUC i)) (v (i + k - 1)) = pi} = (0..(k-1)) DELETE i` ASSUME_TAC; + + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;DELETE;IN_NUMSEG] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + + +MP_TAC(ARITH_RULE`x 0<=x/\ x<= k-1`) +THEN RESA_TAC +THEN STRIP_TAC +THEN DICH_TAC 3 +THEN ASM_REWRITE_TAC[]; + +MP_TAC(ARITH_RULE`x<=k-1/\ 3 x< k`) +THEN RESA_TAC +THEN MATCH_DICH_TAC 4 +THEN ASM_REWRITE_TAC[]; + + +DICH_TAC (17-12) +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC FINITE_SUBSET[`(0..k - 1) DELETE i`;`(0..k - 1)`][FINITE_NUMSEG;DELETE_SUBSET] +THEN SUBGOAL_THEN`i IN 0..(k-1)`ASSUME_TAC +; + +ASM_REWRITE_TAC[IN_NUMSEG] +THEN DICH_TAC (17-13) +THEN DICH_TAC 16 +THEN ARITH_TAC; + +MRESAL_TAC CARD_DELETE[`i`;`0..(k-1)`][FINITE_NUMSEG;CARD_NUMSEG] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k-1=k-2)`) +THEN RESA_TAC +; + + + +POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[NOT_FORALL_THM;NOT_IMP] +THEN REWRITE_TAC[NOT_IMP] +THEN STRIP_TAC +THEN SUBGOAL_THEN`{i | i < k /\ azim (vec 0) (v i) ((v:num->real^3) (SUC i)) (v (i + k - 1)) = pi} SUBSET (0..(k-1)) DELETE i DELETE j`ASSUME_TAC; + + + + +REWRITE_TAC[SUBSET;DELETE;IN_ELIM_THM;IN_NUMSEG] +THEN GEN_TAC +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x 0<=x/\ x<=k-1`) +THEN REPEAT RESA_TAC +; + + +DICH_TAC (23-15) +THEN DICH_TAC(22-19) +THEN ASM_REWRITE_TAC[] +; + + +DICH_TAC (23-18) +THEN DICH_TAC(22-19) +THEN ASM_REWRITE_TAC[] +; + + + +SUBGOAL_THEN`i IN 0..(k-1)`ASSUME_TAC +; + +ASM_REWRITE_TAC[IN_NUMSEG] +THEN DICH_TAC (19-14) +THEN DICH_TAC 18 +THEN ARITH_TAC; + +SUBGOAL_THEN`j IN ((0..(k-1)) DELETE i)`ASSUME_TAC +; + +ASM_REWRITE_TAC[IN_NUMSEG;DELETE;IN_ELIM_THM] +THEN DICH_TAC (19-15) +THEN DICH_TAC 19 +THEN ARITH_TAC; + +MRESA_TAC FINITE_DELETE[`0..(k-1)`;`i`] +THEN MRESA_TAC FINITE_DELETE[`(0..(k-1)) DELETE i`;`j`] +THEN MRESAL_TAC CARD_DELETE[`i`;`0..(k-1)`][FINITE_NUMSEG] +THEN MRESAL_TAC CARD_DELETE[`j`;`(0..(k-1)) DELETE i`][FINITE_NUMSEG] +THEN MRESAL_TAC SUBSET_CARD_EQ[`{i | i < k /\ azim (vec 0) (v i) ((v:num->real^3) (SUC i)) (v (i + k - 1)) = pi}`;`(0..(k-1)) DELETE i DELETE j`][FINITE_NUMSEG;CARD_NUMSEG;ARITH_RULE`k-2=k-1-1`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN_ELIM_THM;EXTENSION;DELETE;IN_NUMSEG] +THEN RESA_TAC; + + + +MP_TAC(ARITH_RULE`~(i=j:num)==> i coplanar ({v (i+t1)| t1<=t} UNION {vec 0:real^3, (v:num->real^3) i})`ASSUME_TAC +; + + +INDUCT_TAC +; + + +REWRITE_TAC[ARITH_RULE`t<=0<=> t=0`;] +THEN SUBGOAL_THEN`{v (i + t1) | t1 = 0} = {(v:num->real^3) i}`ASSUME_TAC +; + + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN REWRITE_TAC[ARITH_RULE`a+0=a`] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[ARITH_RULE`a+0=a`] +; + + +ASM_REWRITE_TAC[SET_RULE`{a} UNION {b,a}={a,b}`;COPLANAR_2] +; + + +STRIP_TAC +THEN MP_TAC(ARITH_RULE`SUC t<= j-i==> t<= j-i`) +THEN RESA_TAC +THEN DICH_TAC 2 +THEN RESA_TAC +THEN SUBGOAL_THEN`{v (i + t1) | t1 <= SUC t}= {v (i + t1) | t1 <= t} UNION {(v:num->real^3) (i+ SUC t)}`ASSUME_TAC; + + + +REWRITE_TAC[UNION;IN_ELIM_THM;EXTENSION;IN_SING] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + + + +MP_TAC(ARITH_RULE`t1<= SUC t==> t1<=t\/ t1= SUC t`) +THEN RESA_TAC +; + + +MATCH_MP_TAC(SET_RULE`A==>A\/B`) +THEN EXISTS_TAC`t1:num` +THEN ASM_REWRITE_TAC[] +; + + +EXISTS_TAC`t1:num` +THEN DICH_TAC 1 +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + +EXISTS_TAC`SUC t` +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC +; + + +ASM_REWRITE_TAC[SET_RULE`(a UNION b) UNION c= a UNION b UNION c`] +THEN MP_TAC(ARITH_RULE`t=0 \/ 0 t=0`;] +THEN SUBGOAL_THEN`{v (i + t1) | t1 = 0} = {(v:num->real^3) i}`ASSUME_TAC +; + + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN REWRITE_TAC[ARITH_RULE`a+0=a`] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[ARITH_RULE`a+0=a`] +; + + +ASM_REWRITE_TAC[SET_RULE`{a} UNION {b} UNION {c,a}={a,b,c}`;Tskajxy_lemmas.KY_COPLANAR_3] +; + + + +MRESA_TAC Nuxcoea.MMS_IMP_BBS[`s:scs_v39`;`v`] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`k:num`;`s`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC WL_IN_V[`i+t-1`;`v`] +THEN MRESA_TAC WL_IN_V[`j`;`v`] +THEN MRESA_TAC WL_IN_V[`i+t:num`;`v`] +THEN MP_TAC(ARITH_RULE`0 ~(i+t-1=i+t) /\ i+t-1real^3`] +THEN THAYTHE_TAC 0[`i+t-1`;`i+t:num`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`(v:num->real^3) (i+t-1)`;`v j`;`V`] +THEN THAYTHEL_TAC 0[`(v:num->real^3) (i+t-1)`;`(v:num->real^3) (i+t)`][SET_RULE`a IN {a,b}`;coplanar] +THEN EXISTS_TAC`vec 0:real^3` +THEN EXISTS_TAC`(v:num->real^3) (i+t-1)` +THEN EXISTS_TAC`(v:num->real^3) (i+t)` +THEN ASM_REWRITE_TAC[UNION;SUBSET;IN_ELIM_THM;] +THEN REPEAT RESA_TAC; + + +SUBGOAL_THEN`{vec 0, v (i+t-1), v (i + t),v (i + t1)} SUBSET {v (i + t1) | t1 <= t} UNION {vec 0, (v:num->real^3) i}`ASSUME_TAC +; + + +MATCH_MP_TAC(SET_RULE`{b,c,d} SUBSET A==> {a,b,c,d} SUBSET A UNION {a,e}`) +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;SET_RULE`a IN {b,c,d}<=> a=b\/ a=c\/ a=d`] +THEN REPEAT RESA_TAC; + +EXISTS_TAC`t-1:num` +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + + +EXISTS_TAC`t:num` +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + +EXISTS_TAC`t1:num` +THEN ASM_REWRITE_TAC[] +; + + +MRESA_TAC COPLANAR_SUBSET[`{vec 0, v (i+t-1), v (i + t), v (i + t1:num)}`;`{v (i + t1) | t1 <= t:num} UNION {vec 0, v i}`] +THEN MATCH_MP_TAC Zlzthic.coplanar_in_affine_hull +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={B,C,D,A}`] +THEN ASM_REWRITE_TAC[]; + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN_SING] +THEN RESA_TAC +THEN MATCH_MP_TAC Zlzthic.coplanar_in_affine_hull +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={B,D,A,C}`] +THEN MATCH_MP_TAC AZIM_EQ_0_PI_IMP_COPLANAR +THEN MATCH_MP_TAC(SET_RULE`A==> B \/ A`); + + +MP_TAC(ARITH_RULE`0SUC (i + t)= i+ SUC t/\ 0<= i+t/\ +i+t<=k-1/\ ~(i + t = i)/\ ~(i+t=j)/\ (i + t) + k - 1= (i + t - 1)+k`) +THEN RESA_TAC +THEN THAYTHE_TAC (51-26)[`i+t:num`] +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;periodic] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN THAYTHE_TAC (53-33)[`i+t-1`]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`a IN {b,c}<=> a=b\/ a=c`] +THEN RESA_TAC; + + + +REWRITE_TAC[Collect_geom2.THREE_GEN_POINTS_IN_AFF3;GSYM aff] +; + + + +MATCH_MP_TAC Zlzthic.coplanar_in_affine_hull +THEN ASM_REWRITE_TAC[] +; + +SUBGOAL_THEN`{vec 0, v (i+t-1), v (i + t),v (i)} SUBSET {v (i + t1) | t1 <= t} UNION {vec 0, (v:num->real^3) i}`ASSUME_TAC +; + + +MATCH_MP_TAC(SET_RULE`{b,c,d} SUBSET A==> {a,b,c,d} SUBSET A UNION {a,e}`) +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;SET_RULE`a IN {b,c,d}<=> a=b\/ a=c\/ a=d`] +THEN REPEAT RESA_TAC; + +EXISTS_TAC`t-1:num` +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + + +EXISTS_TAC`t:num` +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + +EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0<=t/\ i+0=i`] +; + + +MRESA_TAC COPLANAR_SUBSET[`{vec 0, v (i+t-1), v (i + t), v (i:num)}`;`{v (i + t1) | t1 <= t:num} UNION {vec 0, v i}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={B,C,D,A}`] +THEN ASM_REWRITE_TAC[]; + + +SUBGOAL_THEN`!t. t <= i+k-j ==> coplanar ({v (i+k - t1) | t1 <= t} UNION {vec 0, (v:num->real^3) i})`ASSUME_TAC +; + +INDUCT_TAC +; + + + +REWRITE_TAC[ARITH_RULE`t<=0<=> t=0`;] +THEN SUBGOAL_THEN`{v (i+k - t1) | t1 = 0} = {(v:num->real^3) i}`ASSUME_TAC +; + + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN REWRITE_TAC[ARITH_RULE`a-0=a`] +; + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;BBprime_v39;BBprime2_v39;BBs_v39;LET_DEF;LET_END_DEF;periodic] +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC (41-4)[`i:num`] +; + +EXISTS_TAC`0` +THEN REWRITE_TAC[ARITH_RULE`a-0=a`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;BBprime_v39;BBprime2_v39;BBs_v39;LET_DEF;LET_END_DEF;periodic] +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC (40-4)[`i:num`] +; + + + +ASM_REWRITE_TAC[SET_RULE`{a} UNION {b,c}= {a,b,c}`;Tskajxy_lemmas.KY_COPLANAR_3] +; + + +STRIP_TAC +THEN MP_TAC(ARITH_RULE`SUC t<= i+k-j==> t<= i+k-j`) +THEN RESA_TAC +THEN DICH_TAC 2 +THEN RESA_TAC +; + + +MP_TAC(ARITH_RULE`t=0\/ 0real^3) (i + k - t1) | t1 <= SUC 0} ={v i, v(i+k-1)}`ASSUME_TAC +; + + +REWRITE_TAC[EXTENSION;ARITH_RULE`t<= SUC 0<=> t=0\/ t=1`;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;BBprime_v39;BBprime2_v39;BBs_v39;LET_DEF;LET_END_DEF;periodic;ARITH_RULE`a- 0=a`] +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC (45-4)[`i:num`] +THEN SET_TAC[]; + +SET_TAC[] +; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`a IN {b,c}<=> a=b\/ a=c`] +THEN RESA_TAC +; + + +EXISTS_TAC`0` +THEN REWRITE_TAC[ARITH_RULE`a-0=a`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;BBprime_v39;BBprime2_v39;BBs_v39;LET_DEF;LET_END_DEF;periodic;ARITH_RULE`a- 0=a`] +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC (44-4)[`i:num`] +; + +EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[] +; + + +ASM_REWRITE_TAC[SET_RULE`{a,b} UNION {c,a}={a,b,c}`;Tskajxy_lemmas.KY_COPLANAR_3] +; + +REWRITE_TAC[coplanar] +THEN EXISTS_TAC`vec 0:real^3` +THEN EXISTS_TAC`(v:num->real^3) (i+k-t+1)` +THEN EXISTS_TAC`(v:num->real^3) (i+k-t)` +THEN ASM_REWRITE_TAC[UNION;SUBSET;IN_ELIM_THM;] +THEN REPEAT RESA_TAC +; + + + + +MATCH_MP_TAC Zlzthic.coplanar_in_affine_hull +THEN ASM_REWRITE_TAC[] +; + + + + +MRESA_TAC Nuxcoea.MMS_IMP_BBS[`s:scs_v39`;`v`] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`k:num`;`s`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC WL_IN_V[`i+k-t+1`;`v`] +THEN MRESA_TAC WL_IN_V[`i+k-t:num`;`v`] +THEN MP_TAC(ARITH_RULE`3 1real^3`;`(i + k - t+1):num`] +THEN DICH_TAC 0 +THEN ASM_SIMP_TAC[MOD_REFL] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(i + k - t) MOD k`;`v:num->real^3`;`(i + k - t):num`] +THEN DICH_TAC 0 +THEN ASM_SIMP_TAC[MOD_REFL] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`v:num->real^3`] +THEN THAYTHE_TAC 0[`(i+k- t+1) MOD k`;`(i+k-t:num) MOD k`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`(v:num->real^3) (i+k- t+1)`;`v (i+k-t:num)`;`V`] +THEN THAYTHEL_TAC 0[`v(i+k- t+1)`;`v(i+k-t:num)`][SET_RULE`a IN {a,b}`;] +; + + + + + +MP_TAC(ARITH_RULE`t1<= SUC t==> t1<= t\/ t1= SUC t`) +THEN RESA_TAC +; + + +SUBGOAL_THEN`{vec 0, v (i+k-t+1), v (i+k-t),v (i+k-t1)} SUBSET {v (i+k- t1) | t1 <= t} UNION {vec 0, (v:num->real^3) i}`ASSUME_TAC +; + + +MATCH_MP_TAC(SET_RULE`{b,c,d} SUBSET A==> {a,b,c,d} SUBSET A UNION {a,e}`) +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;SET_RULE`a IN {b,c,d}<=> a=b\/ a=c\/ a=d`] +THEN REPEAT RESA_TAC; + +EXISTS_TAC`t-1:num` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +; + +DICH_TAC (53-32) +THEN ARITH_TAC; + +MP_TAC(ARITH_RULE`0 1<=t/\i+k-t+1=i+(k+1)-t`) +THEN RESA_TAC +THEN MRESA_TAC Ssrnat.subn_subA[`k:num`;`t:num`;`1`] +; + + +EXISTS_TAC`t:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`a<=a:num`] +; + + + +EXISTS_TAC`t1:num` +THEN ASM_REWRITE_TAC[] +; + + +MRESA_TAC COPLANAR_SUBSET[`{vec 0, v (i + k - t + 1), v (i + k - t), v (i + k - t1)}`;`{v (i + k-t1) | t1 <= t:num} UNION {vec 0, v i}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={B,C,D,A}`] +THEN ASM_REWRITE_TAC[]; + + +ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={B,D,C,A}`] +THEN MATCH_MP_TAC AZIM_EQ_0_PI_IMP_COPLANAR +THEN MATCH_MP_TAC(SET_RULE`A==> B \/ A`); + + +THAYTHEL_TAC (53-26)[`(i+k-t) MOD k`][ARITH_RULE`0<=a`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`(i + k - t) MOD k < k/\ 3 (i + k - t) MOD k <= k - 1/\ 0 (j + k - t) + t= j + k - t + t/\ t<=k/\ (j + k - t) + i + k - j= (i + k - t) + k - j+j/\ j<=k/\ treal^3`;`SUC ((i + k - t) MOD k) MOD k`] +THEN DICH_TAC 0 +THEN ASM_SIMP_TAC[MOD_REFL;Hypermap.lemma_suc_mod] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(i + k - t) MOD k + k - 1:num`;`v:num->real^3`;`((i + k - t) MOD k + k - 1) MOD k`] +THEN DICH_TAC 0 +THEN ASM_SIMP_TAC[MOD_REFL;Hypermap.lemma_suc_mod] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3 k-1real^3`;`(i + k - (t + 1))`] +THEN DICH_TAC 0 +THEN ASM_SIMP_TAC[MOD_REFL;Hypermap.lemma_suc_mod] +THEN RESA_TAC +; + + + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`a IN {b,c}<=> a=b\/ a=c`] +THEN RESA_TAC; + + + +REWRITE_TAC[Collect_geom2.THREE_GEN_POINTS_IN_AFF3;GSYM aff] +; + + + +MATCH_MP_TAC Zlzthic.coplanar_in_affine_hull +THEN ASM_REWRITE_TAC[] +; + + + +MRESA_TAC Nuxcoea.MMS_IMP_BBS[`s:scs_v39`;`v`] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`k:num`;`s`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC WL_IN_V[`i+k-t+1`;`v`] +THEN MRESA_TAC WL_IN_V[`i+k-t:num`;`v`] +THEN MP_TAC(ARITH_RULE`3 1real^3`;`(i + k - t+1):num`] +THEN DICH_TAC 0 +THEN ASM_SIMP_TAC[MOD_REFL] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(i + k - t) MOD k`;`v:num->real^3`;`(i + k - t):num`] +THEN DICH_TAC 0 +THEN ASM_SIMP_TAC[MOD_REFL] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`v:num->real^3`] +THEN THAYTHE_TAC 0[`(i+k- t+1) MOD k`;`(i+k-t:num) MOD k`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`(v:num->real^3) (i+k- t+1)`;`v (i+k-t:num)`;`V`] +THEN THAYTHEL_TAC 0[`v(i+k- t+1)`;`v(i+k-t:num)`][SET_RULE`a IN {a,b}`;] +; + + + + +SUBGOAL_THEN`{vec 0, v (i + k - t + 1), v (i + k - t),v (i)} SUBSET {v (i+k- t1) | t1 <= t} UNION {vec 0, (v:num->real^3) i}`ASSUME_TAC +; + + +MATCH_MP_TAC(SET_RULE`{b,c} SUBSET A==> {a,b,c,e} SUBSET A UNION {a,e}`) +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;SET_RULE`a IN {b,c}<=> a=b\/ a=c`] +THEN REPEAT RESA_TAC; + +EXISTS_TAC`t-1:num` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +; + +DICH_TAC (52-32) +THEN ARITH_TAC; + +MP_TAC(ARITH_RULE`0 1<=t/\i+k-t+1=i+(k+1)-t`) +THEN RESA_TAC +THEN MRESA_TAC Ssrnat.subn_subA[`k:num`;`t:num`;`1`] +; + + +EXISTS_TAC`t:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`a<=a:num`] +; + + + + +MRESA_TAC COPLANAR_SUBSET[`{vec 0:real^3, v (i + k - t + 1), v (i + k - t), v i}`;`{(v:num->real^3) (i + k - t1) | t1 <= t} UNION {vec 0:real^3, v i}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={B,C,D,A}`] +THEN ASM_REWRITE_TAC[]; + + + +MRESA_TAC Nuxcoea.MMS_IMP_BBS[`s:scs_v39`;`v`] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`k:num`;`s`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC WL_IN_V[`i`;`v`] +THEN MRESA_TAC WL_IN_V[`j:num`;`v`] +THEN MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`v:num->real^3`] +THEN THAYTHE_TAC 0[`i`;`j`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`(v:num->real^3) (i)`;`v (j:num)`;`V`] +THEN THAYTHEL_TAC 0[`v i`;`v j`][SET_RULE`a IN {a, b}`] +THEN SUBGOAL_THEN `coplanar ({vec 0} UNION {(v:num->real^3) (i+t)| treal^3) i` +THEN EXISTS_TAC`(v:num->real^3) j` +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;UNION;IN_SING] +THEN REPEAT RESA_TAC; + + +REWRITE_TAC[Collect_geom2.THREE_GEN_POINTS_IN_AFF3;GSYM aff] +; + + +MP_TAC(ARITH_RULE`t<=j-i\/ j-i<=t:num`) +THEN RESA_TAC +; + + + +MATCH_MP_TAC Zlzthic.coplanar_in_affine_hull +THEN ASM_REWRITE_TAC[] +THEN THAYTHEL_TAC (39-28)[`j-i:num`][ARITH_RULE`j-i<=j-i:num`] +THEN MATCH_MP_TAC COPLANAR_SUBSET +THEN EXISTS_TAC`({v (i + t1) | t1 | t1 <= j - i} UNION {vec 0, (v:num->real^3) i})` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(SET_RULE`a IN A/\ d IN A==>{a,b,c,d} SUBSET A UNION {b,c}`) +THEN STRIP_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +; + + +EXISTS_TAC`t:num` +THEN ASM_REWRITE_TAC[]; + + +EXISTS_TAC`j-i:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`j-i<=j-i:num/\ i+j-i=j-i+i`] +THEN MP_TAC(ARITH_RULE`i i<=j:num`) +THEN RESA_TAC +THEN MRESA_TAC SUB_ADD[`j`;`i`]; + + + + +MATCH_MP_TAC Zlzthic.coplanar_in_affine_hull +THEN ASM_REWRITE_TAC[] +THEN THAYTHEL_TAC (39-29)[`i+k-j:num`][ARITH_RULE`i+k-j<=i+k-j:num`] +THEN MATCH_MP_TAC COPLANAR_SUBSET +THEN EXISTS_TAC`({v (i + k - t1) | t1 | t1 <= i + k - j} UNION {vec 0, (v:num->real^3) i})` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(SET_RULE`a IN A/\ d IN A==>{a,b,c,d} SUBSET A UNION {b,c}`) +THEN STRIP_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +; + + +EXISTS_TAC`k-t:num` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`t t<=k:num/\ k-t<= i+k-j`) +THEN RESA_TAC +THEN MRESA_TAC Ssrnat.subKn[`t`;`k`] +; + + +EXISTS_TAC`i+k-j:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`i + k - j<=i + k - j:num/\ i+j-i=j-i+i`] +THEN MP_TAC(ARITH_RULE`i i<=j:num/\ (i+k)-j= i+k-j/\ j<=i+k +/\ (i + k) - (i + k - j)= i + k - (i + k - j)`) +THEN RESA_TAC +THEN MRESA_TAC Ssrnat.subKn[`j:num`;`i+k:num`] +; + + +POP_ASSUM MP_TAC +THEN MRESA_TAC BB_TRANS_SUBSET_BB[`s`;`v`;`i`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k<=3)/\ ~(k=0)`) +THEN RESA_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39] +THEN RESA_TAC +THEN ASM_SIMP_TAC[PERIODIC_IMAGE2] +THEN MRESA_TAC TRANS_V[`s`;`i`;`v`] +THEN MRESAL_TAC FEKTYIY[`s`;`v`][IN] +; + + +(****************j coplanar ({v (j+t1)| t1<=t} UNION {vec 0:real^3, (v:num->real^3) j})`ASSUME_TAC +; + + +INDUCT_TAC +; + + +REWRITE_TAC[ARITH_RULE`t<=0<=> t=0`;] +THEN SUBGOAL_THEN`{v (j + t1) | t1 = 0} = {(v:num->real^3) j}`ASSUME_TAC +; + + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN REWRITE_TAC[ARITH_RULE`a+0=a`] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[ARITH_RULE`a+0=a`] +; + + +ASM_REWRITE_TAC[SET_RULE`{a} UNION {b,a}={a,b}`;COPLANAR_2] +; + + +STRIP_TAC +THEN MP_TAC(ARITH_RULE`SUC t<= i-j==> t<= i-j`) +THEN RESA_TAC +THEN DICH_TAC 2 +THEN RESA_TAC +THEN SUBGOAL_THEN`{v (j + t1) | t1 <= SUC t}= {v (j + t1) | t1 <= t} UNION {(v:num->real^3) (j+ SUC t)}`ASSUME_TAC; + + + +REWRITE_TAC[UNION;IN_ELIM_THM;EXTENSION;IN_SING] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + + + +MP_TAC(ARITH_RULE`t1<= SUC t==> t1<=t\/ t1= SUC t`) +THEN RESA_TAC +; + + +MATCH_MP_TAC(SET_RULE`A==>A\/B`) +THEN EXISTS_TAC`t1:num` +THEN ASM_REWRITE_TAC[] +; + + +EXISTS_TAC`t1:num` +THEN DICH_TAC 1 +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + +EXISTS_TAC`SUC t` +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC +; + + +ASM_REWRITE_TAC[SET_RULE`(a UNION b) UNION c= a UNION b UNION c`] +THEN MP_TAC(ARITH_RULE`t=0 \/ 0 t=0`;] +THEN SUBGOAL_THEN`{v (j + t1) | t1 = 0} = {(v:num->real^3) j}`ASSUME_TAC +; + + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN REWRITE_TAC[ARITH_RULE`a+0=a`] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[ARITH_RULE`a+0=a`] +; + + +ASM_REWRITE_TAC[SET_RULE`{a} UNION {b} UNION {c,a}={a,b,c}`;Tskajxy_lemmas.KY_COPLANAR_3] +; + + + +MRESA_TAC Nuxcoea.MMS_IMP_BBS[`s:scs_v39`;`v`] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`k:num`;`s`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC WL_IN_V[`j+t-1`;`v`] +THEN MRESA_TAC WL_IN_V[`i`;`v`] +THEN MRESA_TAC WL_IN_V[`j+t:num`;`v`] +THEN MP_TAC(ARITH_RULE`0 ~(j+t-1=j+t) /\ j+t-1real^3`] +THEN THAYTHE_TAC 0[`j+t-1`;`j+t:num`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`(v:num->real^3) (j+t-1)`;`v i`;`V`] +THEN THAYTHEL_TAC 0[`(v:num->real^3) (j+t-1)`;`(v:num->real^3) (j+t)`][SET_RULE`a IN {a,b}`;coplanar] +THEN EXISTS_TAC`vec 0:real^3` +THEN EXISTS_TAC`(v:num->real^3) (j+t-1)` +THEN EXISTS_TAC`(v:num->real^3) (j+t)` +THEN ASM_REWRITE_TAC[UNION;SUBSET;IN_ELIM_THM;] +THEN REPEAT RESA_TAC; + + +SUBGOAL_THEN`{vec 0, v (j+t-1), v (j + t),v (j + t1)} SUBSET {v (j + t1) | t1 <= t} UNION {vec 0, (v:num->real^3) j}`ASSUME_TAC +; + + +MATCH_MP_TAC(SET_RULE`{b,c,d} SUBSET A==> {a,b,c,d} SUBSET A UNION {a,e}`) +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;SET_RULE`a IN {b,c,d}<=> a=b\/ a=c\/ a=d`] +THEN REPEAT RESA_TAC; + +EXISTS_TAC`t-1:num` +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + + +EXISTS_TAC`t:num` +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + +EXISTS_TAC`t1:num` +THEN ASM_REWRITE_TAC[] +; + + +MRESA_TAC COPLANAR_SUBSET[`{vec 0, v (j+t-1), v (j + t), v (j + t1:num)}`;`{v (j + t1) | t1 <= t:num} UNION {vec 0, v j}`] +THEN MATCH_MP_TAC Zlzthic.coplanar_in_affine_hull +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={B,C,D,A}`] +THEN ASM_REWRITE_TAC[]; + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN_SING] +THEN RESA_TAC +THEN MATCH_MP_TAC Zlzthic.coplanar_in_affine_hull +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={B,D,A,C}`] +THEN MATCH_MP_TAC AZIM_EQ_0_PI_IMP_COPLANAR +THEN MATCH_MP_TAC(SET_RULE`A==> B \/ A`); + + +MP_TAC(ARITH_RULE`0SUC (j + t)= j+ SUC t/\ 0<= j+t/\ +j+t<=k-1/\ ~(j + t = j)/\ ~(j+t=i)/\ (j + t) + k - 1= (j + t - 1)+k`) +THEN RESA_TAC +THEN THAYTHE_TAC (51-26)[`j+t:num`] +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;periodic] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN THAYTHE_TAC (53-33)[`j+t-1`]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`a IN {b,c}<=> a=b\/ a=c`] +THEN RESA_TAC; + + + +REWRITE_TAC[Collect_geom2.THREE_GEN_POINTS_IN_AFF3;GSYM aff] +; + + + +MATCH_MP_TAC Zlzthic.coplanar_in_affine_hull +THEN ASM_REWRITE_TAC[] +; + +SUBGOAL_THEN`{vec 0, v (j+t-1), v (j + t),v (j)} SUBSET {v (j + t1) | t1 <= t} UNION {vec 0, (v:num->real^3) j}`ASSUME_TAC +; + + +MATCH_MP_TAC(SET_RULE`{b,c,d} SUBSET A==> {a,b,c,d} SUBSET A UNION {a,e}`) +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;SET_RULE`a IN {b,c,d}<=> a=b\/ a=c\/ a=d`] +THEN REPEAT RESA_TAC; + +EXISTS_TAC`t-1:num` +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + + +EXISTS_TAC`t:num` +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + +EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0<=t/\ i+0=i`] +; + + +MRESA_TAC COPLANAR_SUBSET[`{vec 0, v (j+t-1), v (j + t), v (j:num)}`;`{v (j + t1) | t1 <= t:num} UNION {vec 0, v j}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={B,C,D,A}`] +THEN ASM_REWRITE_TAC[]; + + +SUBGOAL_THEN`!t. t <= j+k-i ==> coplanar ({v (j+k - t1) | t1 <= t} UNION {vec 0, (v:num->real^3) j})`ASSUME_TAC +; + +INDUCT_TAC +; + + + +REWRITE_TAC[ARITH_RULE`t<=0<=> t=0`;] +THEN SUBGOAL_THEN`{v (j+k - t1) | t1 = 0} = {(v:num->real^3) j}`ASSUME_TAC +; + + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN REWRITE_TAC[ARITH_RULE`a-0=a`] +; + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;BBprime_v39;BBprime2_v39;BBs_v39;LET_DEF;LET_END_DEF;periodic] +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC (41-4)[`j:num`] +; + +EXISTS_TAC`0` +THEN REWRITE_TAC[ARITH_RULE`a-0=a`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;BBprime_v39;BBprime2_v39;BBs_v39;LET_DEF;LET_END_DEF;periodic] +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC (40-4)[`j:num`] +; + + + +ASM_REWRITE_TAC[SET_RULE`{a} UNION {b,c}= {a,b,c}`;Tskajxy_lemmas.KY_COPLANAR_3] +; + + +STRIP_TAC +THEN MP_TAC(ARITH_RULE`SUC t<= j+k-i==> t<= j+k-i`) +THEN RESA_TAC +THEN DICH_TAC 2 +THEN RESA_TAC +; + + +MP_TAC(ARITH_RULE`t=0\/ 0real^3) (j + k - t1) | t1 <= SUC 0} ={v j, v(j+k-1)}`ASSUME_TAC +; + + +REWRITE_TAC[EXTENSION;ARITH_RULE`t<= SUC 0<=> t=0\/ t=1`;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;BBprime_v39;BBprime2_v39;BBs_v39;LET_DEF;LET_END_DEF;periodic;ARITH_RULE`a- 0=a`] +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC (45-4)[`j:num`] +THEN SET_TAC[]; + +SET_TAC[] +; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`a IN {b,c}<=> a=b\/ a=c`] +THEN RESA_TAC +; + + +EXISTS_TAC`0` +THEN REWRITE_TAC[ARITH_RULE`a-0=a`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;BBprime_v39;BBprime2_v39;BBs_v39;LET_DEF;LET_END_DEF;periodic;ARITH_RULE`a- 0=a`] +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC (44-4)[`j:num`] +; + +EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[] +; + + +ASM_REWRITE_TAC[SET_RULE`{a,b} UNION {c,a}={a,b,c}`;Tskajxy_lemmas.KY_COPLANAR_3] +; + +REWRITE_TAC[coplanar] +THEN EXISTS_TAC`vec 0:real^3` +THEN EXISTS_TAC`(v:num->real^3) (j+k-t+1)` +THEN EXISTS_TAC`(v:num->real^3) (j+k-t)` +THEN ASM_REWRITE_TAC[UNION;SUBSET;IN_ELIM_THM;] +THEN REPEAT RESA_TAC +; + + + + +MATCH_MP_TAC Zlzthic.coplanar_in_affine_hull +THEN ASM_REWRITE_TAC[] +; + + + + +MRESA_TAC Nuxcoea.MMS_IMP_BBS[`s:scs_v39`;`v`] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`k:num`;`s`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC WL_IN_V[`j+k-t+1`;`v`] +THEN MRESA_TAC WL_IN_V[`j+k-t:num`;`v`] +THEN MP_TAC(ARITH_RULE`3 1real^3`;`(j + k - t+1):num`] +THEN DICH_TAC 0 +THEN ASM_SIMP_TAC[MOD_REFL] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(j + k - t) MOD k`;`v:num->real^3`;`(j + k - t):num`] +THEN DICH_TAC 0 +THEN ASM_SIMP_TAC[MOD_REFL] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`v:num->real^3`] +THEN THAYTHE_TAC 0[`(j+k- t+1) MOD k`;`(j+k-t:num) MOD k`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`(v:num->real^3) (j+k- t+1)`;`v (j+k-t:num)`;`V`] +THEN THAYTHEL_TAC 0[`v(j+k- t+1)`;`v(j+k-t:num)`][SET_RULE`a IN {a,b}`;] +; + + + + + +MP_TAC(ARITH_RULE`t1<= SUC t==> t1<= t\/ t1= SUC t`) +THEN RESA_TAC +; + + +SUBGOAL_THEN`{vec 0, v (j+k-t+1), v (j+k-t),v (j+k-t1)} SUBSET {v (j+k- t1) | t1 <= t} UNION {vec 0, (v:num->real^3) j}`ASSUME_TAC +; + + +MATCH_MP_TAC(SET_RULE`{b,c,d} SUBSET A==> {a,b,c,d} SUBSET A UNION {a,e}`) +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;SET_RULE`a IN {b,c,d}<=> a=b\/ a=c\/ a=d`] +THEN REPEAT RESA_TAC; + +EXISTS_TAC`t-1:num` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +; + +DICH_TAC (53-32) +THEN ARITH_TAC; + +MP_TAC(ARITH_RULE`0 1<=t/\j+k-t+1=j+(k+1)-t`) +THEN RESA_TAC +THEN MRESA_TAC Ssrnat.subn_subA[`k:num`;`t:num`;`1`] +; + + +EXISTS_TAC`t:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`a<=a:num`] +; + + + +EXISTS_TAC`t1:num` +THEN ASM_REWRITE_TAC[] +; + + +MRESA_TAC COPLANAR_SUBSET[`{vec 0, v (j + k - t + 1), v (j + k - t), v (j + k - t1)}`;`{v (j + k-t1) | t1 <= t:num} UNION {vec 0, v j}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={B,C,D,A}`] +THEN ASM_REWRITE_TAC[]; + + +ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={B,D,C,A}`] +THEN MATCH_MP_TAC AZIM_EQ_0_PI_IMP_COPLANAR +THEN MATCH_MP_TAC(SET_RULE`A==> B \/ A`); + + +THAYTHEL_TAC (53-26)[`(j+k-t) MOD k`][ARITH_RULE`0<=a`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`(j + k - t) MOD k < k/\ 3 (j + k - t) MOD k <= k - 1/\ 0 (i + k - t) + t= i + k - t + t/\ t<=k/\ (i + k - t) + j + k - i= (j + k - t) + k - i+i/\ i<=k/\ treal^3`;`SUC ((j + k - t) MOD k) MOD k`] +THEN DICH_TAC 0 +THEN ASM_SIMP_TAC[MOD_REFL;Hypermap.lemma_suc_mod] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(j + k - t) MOD k + k - 1:num`;`v:num->real^3`;`((j + k - t) MOD k + k - 1) MOD k`] +THEN DICH_TAC 0 +THEN ASM_SIMP_TAC[MOD_REFL;Hypermap.lemma_suc_mod] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3 k-1real^3`;`(j + k - (t + 1))`] +THEN DICH_TAC 0 +THEN ASM_SIMP_TAC[MOD_REFL;Hypermap.lemma_suc_mod] +THEN RESA_TAC +; + + + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`a IN {b,c}<=> a=b\/ a=c`] +THEN RESA_TAC; + + + +REWRITE_TAC[Collect_geom2.THREE_GEN_POINTS_IN_AFF3;GSYM aff] +; + + + +MATCH_MP_TAC Zlzthic.coplanar_in_affine_hull +THEN ASM_REWRITE_TAC[] +; + + + +MRESA_TAC Nuxcoea.MMS_IMP_BBS[`s:scs_v39`;`v`] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`k:num`;`s`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC WL_IN_V[`j+k-t+1`;`v`] +THEN MRESA_TAC WL_IN_V[`j+k-t:num`;`v`] +THEN MP_TAC(ARITH_RULE`3 1real^3`;`(j + k - t+1):num`] +THEN DICH_TAC 0 +THEN ASM_SIMP_TAC[MOD_REFL] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(j + k - t) MOD k`;`v:num->real^3`;`(j + k - t):num`] +THEN DICH_TAC 0 +THEN ASM_SIMP_TAC[MOD_REFL] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`v:num->real^3`] +THEN THAYTHE_TAC 0[`(j+k- t+1) MOD k`;`(j+k-t:num) MOD k`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`(v:num->real^3) (j+k- t+1)`;`v (j+k-t:num)`;`V`] +THEN THAYTHEL_TAC 0[`v(j+k- t+1)`;`v(j+k-t:num)`][SET_RULE`a IN {a,b}`;] +; + + + + +SUBGOAL_THEN`{vec 0, v (j + k - t + 1), v (j + k - t),v (j)} SUBSET {v (j+k- t1) | t1 <= t} UNION {vec 0, (v:num->real^3) j}`ASSUME_TAC +; + + +MATCH_MP_TAC(SET_RULE`{b,c} SUBSET A==> {a,b,c,e} SUBSET A UNION {a,e}`) +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;SET_RULE`a IN {b,c}<=> a=b\/ a=c`] +THEN REPEAT RESA_TAC; + +EXISTS_TAC`t-1:num` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +; + +DICH_TAC (52-32) +THEN ARITH_TAC; + +MP_TAC(ARITH_RULE`0 1<=t/\j+k-t+1=j+(k+1)-t`) +THEN RESA_TAC +THEN MRESA_TAC Ssrnat.subn_subA[`k:num`;`t:num`;`1`] +; + + +EXISTS_TAC`t:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`a<=a:num`] +; + + + + +MRESA_TAC COPLANAR_SUBSET[`{vec 0:real^3, v (j + k - t + 1), v (j + k - t), v j}`;`{(v:num->real^3) (j + k - t1) | t1 <= t} UNION {vec 0:real^3, v j}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={B,C,D,A}`] +THEN ASM_REWRITE_TAC[]; + + + +MRESA_TAC Nuxcoea.MMS_IMP_BBS[`s:scs_v39`;`v`] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`k:num`;`s`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC WL_IN_V[`j`;`v`] +THEN MRESA_TAC WL_IN_V[`i:num`;`v`] +THEN MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`v:num->real^3`] +THEN THAYTHE_TAC 0[`j`;`i`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`(v:num->real^3) (j)`;`v (i:num)`;`V`] +THEN THAYTHEL_TAC 0[`v j`;`v i`][SET_RULE`a IN {a, b}`] +THEN SUBGOAL_THEN `coplanar ({vec 0} UNION {(v:num->real^3) (j+t)| treal^3) j` +THEN EXISTS_TAC`(v:num->real^3) i` +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;UNION;IN_SING] +THEN REPEAT RESA_TAC; + + +REWRITE_TAC[Collect_geom2.THREE_GEN_POINTS_IN_AFF3;GSYM aff] +; + + +MP_TAC(ARITH_RULE`t<=i-j\/ i-j<=t:num`) +THEN RESA_TAC +; + + + +MATCH_MP_TAC Zlzthic.coplanar_in_affine_hull +THEN ASM_REWRITE_TAC[] +THEN THAYTHEL_TAC (39-28)[`i-j:num`][ARITH_RULE`i-j<=i-j:num`] +THEN MATCH_MP_TAC COPLANAR_SUBSET +THEN EXISTS_TAC`({v (j + t1) | t1 | t1 <= i - j} UNION {vec 0, (v:num->real^3) j})` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(SET_RULE`a IN A/\ d IN A==>{a,b,c,d} SUBSET A UNION {b,c}`) +THEN STRIP_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +; + + +EXISTS_TAC`t:num` +THEN ASM_REWRITE_TAC[]; + + +EXISTS_TAC`i-j:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`j-i<=j-i:num/\ i+j-i=j-i+i`] +THEN MP_TAC(ARITH_RULE`j j<=i:num`) +THEN RESA_TAC +THEN MRESA_TAC SUB_ADD[`i`;`j`]; + + + + +MATCH_MP_TAC Zlzthic.coplanar_in_affine_hull +THEN ASM_REWRITE_TAC[] +THEN THAYTHEL_TAC (39-29)[`j+k-i:num`][ARITH_RULE`i+k-j<=i+k-j:num`] +THEN MATCH_MP_TAC COPLANAR_SUBSET +THEN EXISTS_TAC`({v (j + k - t1) | t1 | t1 <= j + k - i} UNION {vec 0, (v:num->real^3) j})` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(SET_RULE`a IN A/\ d IN A==>{a,b,c,d} SUBSET A UNION {b,c}`) +THEN STRIP_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +; + + +EXISTS_TAC`k-t:num` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`t t<=k:num/\ k-t<= j+k-i`) +THEN RESA_TAC +THEN MRESA_TAC Ssrnat.subKn[`t`;`k`] +; + + +EXISTS_TAC`j+k-i:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`i + k - j<=i + k - j:num/\ i+j-i=j-i+i`] +THEN MP_TAC(ARITH_RULE`j j<=i:num/\ (j+k)-i= j+k-i/\ i<=j+k +/\ (j + k) - (j + k - i)= j + k - (j + k - i)`) +THEN RESA_TAC +THEN MRESA_TAC Ssrnat.subKn[`i:num`;`j+k:num`] +; + + +POP_ASSUM MP_TAC +THEN MRESA_TAC BB_TRANS_SUBSET_BB[`s`;`v`;`j`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k<=3)/\ ~(k=0)`) +THEN RESA_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39] +THEN RESA_TAC +THEN ASM_SIMP_TAC[PERIODIC_IMAGE2] +THEN MRESA_TAC TRANS_V[`s`;`j`;`v`] +THEN MRESAL_TAC FEKTYIY[`s`;`v`][IN] +; +]);; + + + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/AXJRPNC.hl b/text_formalization/local/AXJRPNC.hl new file mode 100644 index 0000000..bcbb689 --- /dev/null +++ b/text_formalization/local/AXJRPNC.hl @@ -0,0 +1,1058 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Axjrpnc = struct + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +open Yxionxl2;; +open Eyypqdw;; +open Ocbicby;; +open Imjxphr;; + +open Nuxcoea;; +open Fektyiy;; + + + +let DIST_LE_2h0_IN_CASES_6=prove(`scs_k_v39 s=6 /\ BBs_v39 s v /\ is_scs_v39 s +==> !i. norm(v i- v (SUC i))<= &2 *h0`, +STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th +THEN ASSUME_TAC th) +THEN REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF;] +THEN RESA_TAC +THEN GEN_TAC +THEN DICH_TAC (0) +THEN REWRITE_TAC[ARITH_RULE`a+b<=b <=> a= 0`] +THEN SUBGOAL_THEN`FINITE + {i | i < 6 /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}` ASSUME_TAC +THENL[ + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..6` +THEN ASM_REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + +MRESA_TAC CARD_EQ_0[`{i | i < 6 /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}`] +THEN REWRITE_TAC[SET_RULE`A={}<=> !x. ~(x IN A)`;IN_ELIM_THM] +THEN MRESAL_TAC DIVISION[`i`;`6`][ARITH_RULE`~(6=0)`] +THEN STRIP_TAC +THEN THAYTHEL_TAC 0[`i MOD 6`][DE_MORGAN_THM;REAL_ARITH`~(a b<=a`] +THEN DICH_TAC (27-1) +THEN ASM_REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;ARITH_RULE`~(6<=3)`] +THEN STRIP_TAC +THEN THAYTHEL_TAC 1[`i`;`SUC i`][dist] +THEN POP_ASSUM MP_TAC +THEN DICH_TAC(29-24) +THEN MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`i:num`;`SUC(i MOD 6) MOD 6:num`;`s:scs_v39`;`i MOD 6:num`;`SUC(i MOD 6):num`][MOD_REFL;ARITH_RULE`~(6=0)`] +THEN SYM_ASSUM_TAC +THEN ASM_SIMP_TAC[Hypermap.lemma_suc_mod;ARITH_RULE`~(6=0)`] +THEN MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`i:num`;`SUC i MOD 6:num`;`s:scs_v39`;`i:num`;`SUC i:num`][MOD_REFL;ARITH_RULE`~(6=0)`] +THEN REAL_ARITH_TAC]);; + + +let DIST_EDGE_IN_BB_LE_2=prove(`BBs_v39 s v /\ is_scs_v39 s +==> &2<= norm(v i- v (SUC i))`, +DISCH_TAC +THEN POP_ASSUM(fun th-> MP_TAC th +THEN ASSUME_TAC th) +THEN REWRITE_TAC[BBs_v39;is_scs_v39;LET_DEF;LET_END_DEF;] +THEN STRIP_TAC +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN THAYTHE_TAC (24-2)[`i`;`SUC i`] +THEN THAYTHE_TAC (25-17)[`i MOD k`;`SUC i MOD k`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)/\ 1 y < &0`]; + ONCE_REWRITE_TAC[GSYM ATN_0]; + MATCH_MP_TAC ATN_MONO_LT; + REWRITE_TAC[arith `(x / y < &0 <=> &0 < (-- x)/ y)`]; + GMATCH_SIMP_TAC REAL_LT_DIV; + GMATCH_SIMP_TAC SQRT_POS_LT; + REWRITE_TAC[Sphere.h0]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + + + +let is_scs_k_le_3=prove(`is_scs_v39 s ==> 3<= scs_k_v39 s`, +REWRITE_TAC[BBs_v39;is_scs_v39;LET_DEF;LET_END_DEF;] +THEN RESA_TAC);; + + +let DIST_LE2_BB_CASSE_4= prove_by_refinement(`scs_k_v39 s=4 /\ BBs_v39 s v /\ is_scs_v39 s +==> ?i. norm(v i- v (SUC i))<= &2 *h0`, +[ +STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th +THEN ASSUME_TAC th) +THEN REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF;] +THEN RESA_TAC +THEN DICH_TAC (0) +THEN REWRITE_TAC[ARITH_RULE`a+b<=b <=> a= 0`] +THEN SUBGOAL_THEN`FINITE + {i | i < 6 /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}` ASSUME_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..6` +THEN ASM_REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + +REWRITE_TAC[ARITH_RULE`a+4<=6 <=> a<= 2`] +THEN SUBGOAL_THEN`{i | i < 4 /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}SUBSET 0..3` ASSUME_TAC; + +ASM_REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + +STRIP_TAC +THEN MRESAL_TAC CARD_DIFF[`0..3`;`{i | i < 4 /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}`][FINITE_NUMSEG;CARD_NUMSEG;] +THEN MP_TAC(ARITH_RULE`CARD + {i | i < 4 /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))} <= + 2 /\ CARD + ((0..3) DIFF + {i | i < 4 /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}) = + (3 + 1) - + 0 - + CARD + {i | i < 4 /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))} +==> 0 ?a. a IN A`;DIFF;IN_ELIM_THM;IN_ELIM_THM;IN_NUMSEG] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`a<=3==> a<4`) +THEN RESA_TAC +THEN REWRITE_TAC[DE_MORGAN_THM;REAL_ARITH`~(a b<=a`] +THEN REPEAT RESA_TAC +THEN DICH_TAC (30-1) +THEN ASM_REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;ARITH_RULE`~(6<=3)`] +THEN STRIP_TAC +THEN THAYTHEL_TAC 1[`a`;`SUC a`][dist] +THEN EXISTS_TAC`a:num` +THEN POP_ASSUM MP_TAC +THEN DICH_TAC (33-27) +THEN REAL_ARITH_TAC]);; + + + +let NORM_V_IN_BB_LE_CSTAB=prove(` (!i. scs_b_v39 s i (SUC i) <= cstab) /\ + BBs_v39 s v +==> !i. norm (v i- v (SUC i))<= cstab`, +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;dist] +THEN RESA_TAC +THEN GEN_TAC +THEN THAYTHE_TAC 1[`i`;`SUC i`] +THEN THAYTHE_TAC 5[`i`] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + + +let arclength_2h0_cstab = prove_by_refinement( + `arclength (&2) (&2) (&2 *h0) + arclength (&2) (&2) cstab < pi`, + (* {{{ proof *) + [ + REPEAT (GMATCH_SIMP_TAC Compute_2158872499.ATN_UPS_X_BREAKDOWN1); + REWRITE_TAC[GSYM CONJ_ASSOC]; + CONJ_TAC; + BY(REWRITE_TAC[Sphere.h0;Sphere.cstab] THEN REAL_ARITH_TAC); + CONJ_TAC; + BY(REWRITE_TAC[Sphere.h0;Sphere.cstab] THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `(pi/ &2 + b) + (pi / &2 + d) < pi <=> b + d < &0`]; + REWRITE_TAC[Sphere.h0;Sphere.cstab]; + MP_TAC (Flyspeck_constants.calc `atn (((&2 * #1.26) * &2 * #1.26 - +&2 * &2 - &2 * &2) / sqrt ((&2 + &2 + &2 * #1.26) * (&2 + &2 - &2 +* #1.26) * (&2 + &2 * #1.26 - &2) * (&2 * #1.26 + &2 - &2))) + +atn (( #3.01 * #3.01 - &2 * &2 - &2 * &2) / sqrt ((&2 + &2 + +#3.01) * (&2 + &2 - #3.01) * (&2 + #3.01 - &2) * ( #3.01 + &2 +- &2))) < &0`); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + + + + + +let DIST_LE2_BB_CASSE_5 = prove_by_refinement( +`scs_k_v39 s=5 /\ BBs_v39 s v /\ is_scs_v39 s +==> norm(v i- v (SUC i))<= &2 *h0 \/ norm(v (SUC i)- v (SUC (SUC i)))<= &2 *h0 `, +[ +STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th +THEN ASSUME_TAC th) +THEN REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF;] +THEN RESA_TAC +THEN DICH_TAC (0) +THEN REWRITE_TAC[ARITH_RULE`a+b<=b <=> a= 0`] +THEN SUBGOAL_THEN`FINITE + {i | i < 5 /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}` ASSUME_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..5` +THEN ASM_REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + +REWRITE_TAC[ARITH_RULE`a+5<=6 <=> a<= 1`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`norm (v i - v (SUC i)) <= &2 * h0 \/ + norm (v (SUC i) - (v:num->real^3) (SUC (SUC i))) <= &2 * h0 \/ ~(norm (v i - v (SUC i)) <= &2 * h0 \/ + norm (v (SUC i) - v (SUC (SUC i))) <= &2 * h0)`) +THEN RESA_TAC; + +DICH_TAC 1 +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[DE_MORGAN_THM;REAL_ARITH`~(a<=b) <=> b MRESAL_TAC th[`i`;`SUC i`][dist] THEN MRESAL_TAC th[`SUC i`;`SUC (SUC i)`][dist]) +THEN MP_TAC(REAL_ARITH`&2 * h0 < norm (v i - v (SUC i)) /\ norm (v i - v (SUC i))<= scs_b_v39 s i (SUC i) /\ &2 * h0 < norm (v (SUC i) - v (SUC (SUC i))) /\ norm ((v:num->real^3) (SUC i) - v (SUC (SUC i)))<= scs_b_v39 s (SUC i) (SUC (SUC i)) +==> &2 * h0< scs_b_v39 s (SUC i) (SUC (SUC i)) /\ &2 * h0< scs_b_v39 s (i) (SUC (i))`) +THEN RESA_TAC +THEN SUBGOAL_THEN`{i MOD 5,SUC i MOD 5} SUBSET {i | i < 5 /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}` ASSUME_TAC; + +REWRITE_TAC[SUBSET;IN_ELIM_THM;SET_RULE`a IN {c,b}<=> a= c\/ a= b`] +THEN REPEAT RESA_TAC; + +ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`]; + +MRESAL_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`i MOD 5:num`;`SUC (i MOD 5) `;`s:scs_v39`;`i:num`;`SUC (i MOD 5) MOD 5:num`][is_scs_v39] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[MOD_REFL;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN ASM_SIMP_TAC[Hypermap.lemma_suc_mod;ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`i:num`;`SUC i MOD 5 `;`s:scs_v39`;`i:num`;`SUC i:num`][is_scs_v39] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[MOD_REFL;ARITH_RULE`~(5=0)`] +THEN RESA_TAC; + +ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`]; + +MRESAL_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`(SUC i) MOD 5:num`;`SUC ((SUC i) MOD 5) `;`s:scs_v39`;`(SUC i):num`;`SUC ((SUC i) MOD 5) MOD 5:num`][is_scs_v39] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[MOD_REFL;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN ASM_SIMP_TAC[Hypermap.lemma_suc_mod;ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`(SUC i):num`;`SUC (SUC i) MOD 5 `;`s:scs_v39`;`(SUC i):num`;`SUC (SUC i):num`][is_scs_v39] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[MOD_REFL;ARITH_RULE`~(5=0)`] +THEN RESA_TAC; + +MRESA_TAC Hypermap.CARD_TWO_ELEMENTS[`i MOD 5`;`SUC i MOD 5`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<5`] +THEN STRIP_TAC +THEN MRESA_TAC CARD_SUBSET[`{i MOD 5, SUC i MOD 5}`;` + {i | i < 5 /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC]);; + + + +let AXJRPNC_concl = `!s (v:num->real^3) i j. + is_scs_v39 s /\ scs_basic_v39 s /\ + (!i. scs_b_v39 s i (SUC i) <= cstab) /\ + MMs_v39 s v /\ + (lunar (v i,v j) (IMAGE v (:num)) + (IMAGE (\i. {v i, v (SUC i)}) (:num)) ) ==> + (scs_k_v39 s = 6 /\ v j = v (i + 3))`;; + + + +let AXJRPNC = prove_by_refinement( + AXJRPNC_concl, +[ +REPEAT GEN_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN ABBREV_TAC`V=(IMAGE (v:num->real^3) (:num))` +THEN ABBREV_TAC`E=(IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num))` +THEN ABBREV_TAC`FF=IMAGE (\i. ((v:num->real^3) i, v (SUC i))) (:num)` +THEN STRIP_TAC +THEN MP_TAC Qknvmlb.SCS_K_LE_6 +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`k<=6==> k=6\/ k<6`) +THEN RESA_TAC; + + +MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MP_TAC DIST_LE_2h0_IN_CASES_6 +THEN RESA_TAC; + + +MRESAL_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`k`;`s`;`v`][ARITH_RULE`3<6`] +THEN ASSUME_TAC(ARITH_RULE`3<6/\ ~(6<=3)`) +THEN MRESA_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`v:num->real^3`;`IMAGE (v:num->real^3) (:num)`;`k:num`] +THEN MRESA_TAC Local_lemmas.NEXT_OPOSITE_POINT_IS_NOT_IN_AFF_GT2[`E`;`v j`;`V`;`FF`;`v i`] +THEN DICH_TAC(20-16) +THEN MRESA_TAC Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME[`V`;`E`;`k`;`s`;`FF`;`v i`;`v`;`i`] +THEN MP_TAC(ARITH_RULE`i'+1<6/\ ~(i'=0)/\ ~(i'=1)==> i'=2\/ i'=4\/ i'=3`) +THEN RESA_TAC; + + +STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN MP_TAC th +THEN REPEAT RESA_TAC) +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`i`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC i`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC(SUC i)`] +THEN MRESA_TAC DIST_EDGE_IN_BB_LE_2[`s`;`v`;`i`] +THEN MRESA_TAC DIST_EDGE_IN_BB_LE_2[`s`;`v`;`SUC i`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v i`;`v (SUC i)`;`&2* h0`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;REAL_ARITH`&2 * #1.26 < &4`] +THEN REWRITE_TAC[GSYM h0] +THEN STRIP_TAC +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (SUC i)`;`v (SUC(SUC i))`;`&2* h0`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;REAL_ARITH`&2 * #1.26 < &4`] +THEN REWRITE_TAC[GSYM h0] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`arcV (vec 0) (v i) (v (SUC i)) <= arclength (&2) (&2) (&2 * h0) +/\ arcV (vec 0) ((v:num->real^3) (SUC i)) (v (SUC (SUC i))) <= + arclength (&2) (&2) (&2 * h0) +/\ arclength (&2) (&2) (&2 * h0)< pi/ &2 +==>arcV (vec 0) (v (i)) (v ((SUC i)))+ arcV (vec 0) (v (SUC i)) (v (SUC (SUC i))) + < pi`) +THEN ASM_SIMP_TAC[arclength222h0] +THEN STRIP_TAC +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC WL_IN_FF[`i`;`v`] +THEN MRESA_TAC WL_IN_FF[`SUC i`;`v`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v i, v (SUC i)`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (SUC i), v (SUC (SUC i))`] +THEN MRESA_TAC Ppbtydq.PPBTYDQ[`v i`;`v (SUC(SUC i))`;`v (SUC i)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC Local_lemmas.LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI[`E`;`V`;`FF`;`v i`;`v(2+i)`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`2+i= SUC(SUC i)`;] +THEN STRIP_TAC +THEN MRESA_TAC Local_lemmas.CONV0_SUB_CONV[`vec 0:real^3`;`{v i, v (SUC (SUC i))}`]; + + + + +STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN MP_TAC th +THEN REPEAT RESA_TAC) +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`4+i`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC (4+i)`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC(SUC (4+i))`] +THEN MRESA_TAC DIST_EDGE_IN_BB_LE_2[`s`;`v`;`(4+i)`] +THEN MRESA_TAC DIST_EDGE_IN_BB_LE_2[`s`;`v`;`SUC (4+i)`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (4+i)`;`v (SUC (4+i))`;`&2* h0`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;REAL_ARITH`&2 * #1.26 < &4`] +THEN REWRITE_TAC[GSYM h0] +THEN STRIP_TAC +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (SUC (4+i))`;`v (SUC(SUC (4+i)))`;`&2* h0`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;REAL_ARITH`&2 * #1.26 < &4`] +THEN REWRITE_TAC[GSYM h0] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`arcV (vec 0) (v (4+i)) (v (SUC (4+i))) <= arclength (&2) (&2) (&2 * h0) +/\ arcV (vec 0) ((v:num->real^3) (SUC (4+i))) (v (SUC (SUC (4+i)))) <= + arclength (&2) (&2) (&2 * h0) +/\ arclength (&2) (&2) (&2 * h0)< pi/ &2 +==>arcV (vec 0) (v ((4+i))) (v ((SUC (4+i))))+ arcV (vec 0) (v (SUC (4+i))) (v (SUC (SUC (4+i)))) + < pi`) +THEN ASM_SIMP_TAC[arclength222h0] +THEN STRIP_TAC +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC WL_IN_FF[`(4+i)`;`v`] +THEN MRESA_TAC WL_IN_FF[`SUC (4+i)`;`v`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (4+i), v (SUC (4+i))`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (SUC (4+i)), v (SUC (SUC (4+i)))`] +THEN MRESA_TAC Ppbtydq.PPBTYDQ[`v (4+i)`;`v (SUC(SUC (4+i)))`;`v (SUC (4+i))`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(SUC(4+i))= 1*6+i`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(1*6+i):num`;`v:num->real^3`;`(1*6+i) MOD k`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[MOD_REFL;ARITH_RULE`~(6=0)`] +THEN RESA_TAC +THEN MRESA_TAC MOD_MULT_ADD[`1`;`6`;`i`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(i MOD k):num`;`v:num->real^3`;`i`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[MOD_REFL;ARITH_RULE`~(6=0)`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC Local_lemmas.LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI[`E`;`V`;`FF`;`v i`;`v(4+i)`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`2+i= SUC(SUC i)`;] +THEN STRIP_TAC +THEN MRESA_TAC Local_lemmas.CONV0_SUB_CONV[`vec 0:real^3`;`{v i, v (4+i)}`] +; + +ONCE_REWRITE_TAC[ARITH_RULE`3+i=i+3`] +THEN REWRITE_TAC[]; + + + +MP_TAC is_scs_k_le_3 +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k/\ k<6==> k=3\/ (3real^3`;`i MOD k`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[MOD_REFL;ARITH_RULE`~(3=0)`] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`j:num`;`v:num->real^3`;`j MOD k`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[MOD_REFL;ARITH_RULE`~(3=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`i MOD 3< 3==> i MOD 3= 0\/ i MOD 3= 1\/ i MOD 3=2`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(3=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`j MOD 3< 3==> j MOD 3= 0\/ j MOD 3= 1\/ j MOD 3=2`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(3=0)`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C} ={A,C,B}`] +THEN ASM_REWRITE_TAC[] +; + + + + + +MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MRESAL_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`k`;`s`;`v`][ARITH_RULE`3<6`] +THEN ASSUME_TAC(ARITH_RULE`3<4/\ ~(4<=3)`) +THEN MRESA_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`v:num->real^3`;`IMAGE (v:num->real^3) (:num)`;`k:num`] +THEN MRESA_TAC Local_lemmas.NEXT_OPOSITE_POINT_IS_NOT_IN_AFF_GT2[`E`;`v j`;`V`;`FF`;`v i`] +THEN DICH_TAC(22-18) +THEN MRESA_TAC Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME[`V`;`E`;`k`;`s`;`FF`;`v i`;`v`;`i`] +THEN MP_TAC(ARITH_RULE`i'+1<4/\ ~(i'=0)/\ ~(i'=1)==> i'=2`) +THEN RESA_TAC; + + + + +MP_TAC DIST_LE2_BB_CASSE_4 +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC WL_IN_V[`i`;`v`] +THEN MRESA_TAC Localization.LOFA_IMP_LT_CARD_SET_V_ALT[`V`;`E`;`FF`;`v i`] +THEN MRESA_TAC WL_IN_V[`i''`;`v`] +THEN POP_ASSUM MP_TAC +THEN SYM_ASSUM_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC +THEN MRESA_TAC Nuxcoea.W_IN_BB_FUN_EQ[`v:num->real^3`;`i'':num`;`n+i:num`;`s`] +THEN MRESAL_TAC Zithlqn.IMP_SUC_MOD_EQ[`i''`;`n+i:num`;`k`][ARITH_RULE`~(4=0)`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`SUC i'':num`;`v:num->real^3`;`SUC (n+i)`] +THEN MP_TAC(ARITH_RULE`n<4==> n=0\/ n=1\/ n=2\/ n=3`) +THEN RESA_TAC; + + + + + +REWRITE_TAC[ARITH_RULE`0+a=a`] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`i`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC i`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC(SUC i)`] +THEN MRESA_TAC DIST_EDGE_IN_BB_LE_2[`s`;`v`;`i`] +THEN MRESA_TAC DIST_EDGE_IN_BB_LE_2[`s`;`v`;`SUC i`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v i`;`v (SUC i)`;`&2* h0`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;REAL_ARITH`&2 * #1.26 < &4`] +THEN REWRITE_TAC[GSYM h0] +THEN STRIP_TAC +THEN MP_TAC NORM_V_IN_BB_LE_CSTAB +THEN RESA_TAC +THEN THAYTHE_TAC 0[`SUC i`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (SUC i)`;`v (SUC(SUC i))`;`cstab`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[cstab;REAL_ARITH`#3.01 < &4`] +THEN REWRITE_TAC[GSYM cstab] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`arcV (vec 0) (v (i)) (v (SUC (i))) <= arclength (&2) (&2) (&2 * h0) +/\ arcV (vec 0) ((v:num->real^3) (SUC (i))) (v (SUC (SUC (i)))) <= + arclength (&2) (&2) (cstab) +/\ arclength (&2) (&2) (&2 * h0) + arclength (&2) (&2) (cstab) < pi +==>arcV (vec 0) (v ((i))) (v ((SUC (i))))+ arcV (vec 0) (v (SUC (i))) (v (SUC (SUC (i)))) + < pi`) +THEN ASM_SIMP_TAC[arclength_2h0_cstab] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_FF[`(i)`;`v`] +THEN MRESA_TAC WL_IN_FF[`SUC (i)`;`v`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (i), v (SUC (i))`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (SUC (i)), v (SUC (SUC (i)))`] +THEN MRESA_TAC Ppbtydq.PPBTYDQ[`v (i)`;`v (SUC(SUC (i)))`;`v (SUC (i))`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(SUC(i))= 2+i`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC Local_lemmas.LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI[`E`;`V`;`FF`;`v i`;`v(j)`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC Local_lemmas.CONV0_SUB_CONV[`vec 0:real^3`;`{v i, v (2+i)}`] +; + + + + + +REWRITE_TAC[ARITH_RULE`1+a=SUC a`] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`i`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC i`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC(SUC i)`] +THEN MRESA_TAC DIST_EDGE_IN_BB_LE_2[`s`;`v`;`i`] +THEN MRESA_TAC DIST_EDGE_IN_BB_LE_2[`s`;`v`;`SUC i`] +THEN MP_TAC NORM_V_IN_BB_LE_CSTAB +THEN RESA_TAC +THEN THAYTHE_TAC 0[`i`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v i`;`v (SUC i)`;`cstab`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[cstab;REAL_ARITH`#3.01 < &4`] +THEN REWRITE_TAC[GSYM cstab] +THEN STRIP_TAC +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (SUC i)`;`v (SUC(SUC i))`;`&2* h0`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;REAL_ARITH`&2 * #1.26 < &4`] +THEN REWRITE_TAC[GSYM h0] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`arcV (vec 0) (v (i)) (v (SUC (i))) <= arclength (&2) (&2) (cstab) +/\ arcV (vec 0) ((v:num->real^3) (SUC (i))) (v (SUC (SUC (i)))) <= + arclength (&2) (&2) (&2 * h0) +/\ arclength (&2) (&2) (&2 * h0) + arclength (&2) (&2) (cstab) < pi +==>arcV (vec 0) (v ((i))) (v ((SUC (i))))+ arcV (vec 0) (v (SUC (i))) (v (SUC (SUC (i)))) + < pi`) +THEN ASM_SIMP_TAC[arclength_2h0_cstab] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_FF[`(i)`;`v`] +THEN MRESA_TAC WL_IN_FF[`SUC (i)`;`v`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (i), v (SUC (i))`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (SUC (i)), v (SUC (SUC (i)))`] +THEN MRESA_TAC Ppbtydq.PPBTYDQ[`v (i)`;`v (SUC(SUC (i)))`;`v (SUC (i))`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(SUC(i))= 2+i`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC Local_lemmas.LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI[`E`;`V`;`FF`;`v i`;`v(j)`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC Local_lemmas.CONV0_SUB_CONV[`vec 0:real^3`;`{v i, v (2+i)}`] +; + + + +REWRITE_TAC[ARITH_RULE`0+a=a`] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`(2+i)`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC (2+i)`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC(SUC (2+i))`] +THEN MRESA_TAC DIST_EDGE_IN_BB_LE_2[`s`;`v`;`(2+i)`] +THEN MRESA_TAC DIST_EDGE_IN_BB_LE_2[`s`;`v`;`SUC (2+i)`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (2+i)`;`v (SUC (2+i))`;`&2* h0`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;REAL_ARITH`&2 * #1.26 < &4`] +THEN REWRITE_TAC[GSYM h0] +THEN STRIP_TAC +THEN MP_TAC NORM_V_IN_BB_LE_CSTAB +THEN RESA_TAC +THEN THAYTHE_TAC 0[`SUC (2+i)`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (SUC (2+i))`;`v (SUC(SUC (2+i)))`;`cstab`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[cstab;REAL_ARITH`#3.01 < &4`] +THEN REWRITE_TAC[GSYM cstab] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`arcV (vec 0) (v (2+i)) (v (SUC (2+i))) <= arclength (&2) (&2) (&2 * h0) +/\ arcV (vec 0) ((v:num->real^3) (SUC (2+i))) (v (SUC (SUC (2+i)))) <= + arclength (&2) (&2) (cstab) +/\ arclength (&2) (&2) (&2 * h0) + arclength (&2) (&2) (cstab) < pi +==>arcV (vec 0) (v ((2+i))) (v ((SUC (2+i))))+ arcV (vec 0) (v (SUC (2+i))) (v (SUC (SUC (2+i)))) + < pi`) +THEN ASM_SIMP_TAC[arclength_2h0_cstab] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_FF[`(2+i)`;`v`] +THEN MRESA_TAC WL_IN_FF[`SUC (2+i)`;`v`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (2+i), v (SUC (2+i))`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (SUC (2+i)), v (SUC (SUC (2+i)))`] +THEN MRESA_TAC Ppbtydq.PPBTYDQ[`v (2+i)`;`v (SUC(SUC (2+i)))`;`v (SUC (2+i))`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(SUC(i))= 2+i`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC Local_lemmas.LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI[`E`;`V`;`FF`;`v i`;`v(j)`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC Local_lemmas.CONV0_SUB_CONV[`vec 0:real^3`;`{v i, v (2+i)}`] +THEN DICH_TAC 3 +THEN ASM_REWRITE_TAC[ARITH_RULE`2+2+i= 1*4+i`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(1*4+i):num`;`v:num->real^3`;`(1*4+i) MOD k`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[MOD_REFL;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MRESA_TAC MOD_MULT_ADD[`1`;`4`;`i`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(i MOD k):num`;`v:num->real^3`;`i`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[MOD_REFL;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC; + + + + +REWRITE_TAC[ARITH_RULE`3+i=SUC(2+i)`] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`(2+i)`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC (2+i)`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC(SUC (2+i))`] +THEN MRESA_TAC DIST_EDGE_IN_BB_LE_2[`s`;`v`;`(2+i)`] +THEN MRESA_TAC DIST_EDGE_IN_BB_LE_2[`s`;`v`;`SUC (2+i)`] +THEN MP_TAC NORM_V_IN_BB_LE_CSTAB +THEN RESA_TAC +THEN THAYTHE_TAC 0[`(2+i)`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (2+i)`;`v (SUC (2+i))`;`cstab`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[cstab;REAL_ARITH`#3.01 < &4`] +THEN REWRITE_TAC[GSYM cstab] +THEN STRIP_TAC +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (SUC (2+i))`;`v (SUC(SUC (2+i)))`;`&2* h0`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;REAL_ARITH`&2 * #1.26 < &4`] +THEN REWRITE_TAC[GSYM h0] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`arcV (vec 0) (v (2+i)) (v (SUC (2+i))) <= arclength (&2) (&2) (cstab) +/\ arcV (vec 0) ((v:num->real^3) (SUC (2+i))) (v (SUC (SUC (2+i)))) <= + arclength (&2) (&2) (&2 * h0) +/\ arclength (&2) (&2) (&2 * h0) + arclength (&2) (&2) (cstab) < pi +==>arcV (vec 0) (v ((2+i))) (v ((SUC (2+i))))+ arcV (vec 0) (v (SUC (2+i))) (v (SUC (SUC (2+i)))) + < pi`) +THEN ASM_SIMP_TAC[arclength_2h0_cstab] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_FF[`(2+i)`;`v`] +THEN MRESA_TAC WL_IN_FF[`SUC (2+i)`;`v`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (2+i), v (SUC (2+i))`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (SUC (2+i)), v (SUC (SUC (2+i)))`] +THEN MRESA_TAC Ppbtydq.PPBTYDQ[`v (2+i)`;`v (SUC(SUC (2+i)))`;`v (SUC (2+i))`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(SUC(i))= 2+i`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC Local_lemmas.LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI[`E`;`V`;`FF`;`v i`;`v(j)`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC Local_lemmas.CONV0_SUB_CONV[`vec 0:real^3`;`{v i, v (2+i)}`] +THEN DICH_TAC 3 +THEN ASM_REWRITE_TAC[ARITH_RULE`2+2+i= 1*4+i`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(1*4+i):num`;`v:num->real^3`;`(1*4+i) MOD k`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[MOD_REFL;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MRESA_TAC MOD_MULT_ADD[`1`;`4`;`i`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(i MOD k):num`;`v:num->real^3`;`i`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[MOD_REFL;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC; + + + + + + +MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MRESAL_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`k`;`s`;`v`][ARITH_RULE`3<5`] +THEN ASSUME_TAC(ARITH_RULE`3<5/\ ~(5<=3)`) +THEN MRESA_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`v:num->real^3`;`IMAGE (v:num->real^3) (:num)`;`k:num`] +THEN MRESA_TAC Local_lemmas.NEXT_OPOSITE_POINT_IS_NOT_IN_AFF_GT2[`E`;`v j`;`V`;`FF`;`v i`] +THEN DICH_TAC(22-18) +THEN MRESA_TAC Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME[`V`;`E`;`k`;`s`;`FF`;`v i`;`v`;`i`] +THEN MP_TAC(ARITH_RULE`i'+1<5/\ ~(i'=0)/\ ~(i'=1)==> i'=2\/ i'=3`) +THEN RESA_TAC; + + + + +MP_TAC DIST_LE2_BB_CASSE_5 +THEN RESA_TAC +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +; + + + + + + +REWRITE_TAC[ARITH_RULE`0+a=a`] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`i`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC i`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC(SUC i)`] +THEN MRESA_TAC DIST_EDGE_IN_BB_LE_2[`s`;`v`;`i`] +THEN MRESA_TAC DIST_EDGE_IN_BB_LE_2[`s`;`v`;`SUC i`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v i`;`v (SUC i)`;`&2* h0`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;REAL_ARITH`&2 * #1.26 < &4`] +THEN REWRITE_TAC[GSYM h0] +THEN STRIP_TAC +THEN MP_TAC NORM_V_IN_BB_LE_CSTAB +THEN RESA_TAC +THEN THAYTHE_TAC 0[`SUC i`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (SUC i)`;`v (SUC(SUC i))`;`cstab`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[cstab;REAL_ARITH`#3.01 < &4`] +THEN REWRITE_TAC[GSYM cstab] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`arcV (vec 0) (v (i)) (v (SUC (i))) <= arclength (&2) (&2) (&2 * h0) +/\ arcV (vec 0) ((v:num->real^3) (SUC (i))) (v (SUC (SUC (i)))) <= + arclength (&2) (&2) (cstab) +/\ arclength (&2) (&2) (&2 * h0) + arclength (&2) (&2) (cstab) < pi +==>arcV (vec 0) (v ((i))) (v ((SUC (i))))+ arcV (vec 0) (v (SUC (i))) (v (SUC (SUC (i)))) + < pi`) +THEN ASM_SIMP_TAC[arclength_2h0_cstab] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_FF[`(i)`;`v`] +THEN MRESA_TAC WL_IN_FF[`SUC (i)`;`v`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (i), v (SUC (i))`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (SUC (i)), v (SUC (SUC (i)))`] +THEN MRESA_TAC Ppbtydq.PPBTYDQ[`v (i)`;`v (SUC(SUC (i)))`;`v (SUC (i))`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(SUC(i))= 2+i`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC Local_lemmas.LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI[`E`;`V`;`FF`;`v i`;`v(j)`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC Local_lemmas.CONV0_SUB_CONV[`vec 0:real^3`;`{v i, v (2+i)}`] +; + + + + + + +REWRITE_TAC[ARITH_RULE`1+a=SUC a`] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`i`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC i`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC(SUC i)`] +THEN MRESA_TAC DIST_EDGE_IN_BB_LE_2[`s`;`v`;`i`] +THEN MRESA_TAC DIST_EDGE_IN_BB_LE_2[`s`;`v`;`SUC i`] +THEN MP_TAC NORM_V_IN_BB_LE_CSTAB +THEN RESA_TAC +THEN THAYTHE_TAC 0[`i`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v i`;`v (SUC i)`;`cstab`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[cstab;REAL_ARITH`#3.01 < &4`] +THEN REWRITE_TAC[GSYM cstab] +THEN STRIP_TAC +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (SUC i)`;`v (SUC(SUC i))`;`&2* h0`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;REAL_ARITH`&2 * #1.26 < &4`] +THEN REWRITE_TAC[GSYM h0] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`arcV (vec 0) (v (i)) (v (SUC (i))) <= arclength (&2) (&2) (cstab) +/\ arcV (vec 0) ((v:num->real^3) (SUC (i))) (v (SUC (SUC (i)))) <= + arclength (&2) (&2) (&2 * h0) +/\ arclength (&2) (&2) (&2 * h0) + arclength (&2) (&2) (cstab) < pi +==>arcV (vec 0) (v ((i))) (v ((SUC (i))))+ arcV (vec 0) (v (SUC (i))) (v (SUC (SUC (i)))) + < pi`) +THEN ASM_SIMP_TAC[arclength_2h0_cstab] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_FF[`(i)`;`v`] +THEN MRESA_TAC WL_IN_FF[`SUC (i)`;`v`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (i), v (SUC (i))`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (SUC (i)), v (SUC (SUC (i)))`] +THEN MRESA_TAC Ppbtydq.PPBTYDQ[`v (i)`;`v (SUC(SUC (i)))`;`v (SUC (i))`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(SUC(i))= 2+i`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC Local_lemmas.LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI[`E`;`V`;`FF`;`v i`;`v(j)`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC Local_lemmas.CONV0_SUB_CONV[`vec 0:real^3`;`{v i, v (2+i)}`] +; + + + + + + +MRESA_TAC DIST_LE2_BB_CASSE_5[`s`;`v`;`3+i`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +; + + + + + +REWRITE_TAC[ARITH_RULE`0+a=a`] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`(3+i)`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC (3+i)`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC(SUC (3+i))`] +THEN MRESA_TAC DIST_EDGE_IN_BB_LE_2[`s`;`v`;`(3+i)`] +THEN MRESA_TAC DIST_EDGE_IN_BB_LE_2[`s`;`v`;`SUC (3+i)`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (3+i)`;`v (SUC (3+i))`;`&2* h0`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;REAL_ARITH`&2 * #1.26 < &4`] +THEN REWRITE_TAC[GSYM h0] +THEN STRIP_TAC +THEN MP_TAC NORM_V_IN_BB_LE_CSTAB +THEN RESA_TAC +THEN THAYTHE_TAC 0[`SUC (3+i)`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (SUC (3+i))`;`v (SUC(SUC (3+i)))`;`cstab`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[cstab;REAL_ARITH`#3.01 < &4`] +THEN REWRITE_TAC[GSYM cstab] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`arcV (vec 0) (v (3+i)) (v (SUC (3+i))) <= arclength (&2) (&2) (&2 * h0) +/\ arcV (vec 0) ((v:num->real^3) (SUC (3+i))) (v (SUC (SUC (3+i)))) <= + arclength (&2) (&2) (cstab) +/\ arclength (&2) (&2) (&2 * h0) + arclength (&2) (&2) (cstab) < pi +==>arcV (vec 0) (v ((3+i))) (v ((SUC (3+i))))+ arcV (vec 0) (v (SUC (3+i))) (v (SUC (SUC (3+i)))) + < pi`) +THEN ASM_SIMP_TAC[arclength_2h0_cstab] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_FF[`(3+i)`;`v`] +THEN MRESA_TAC WL_IN_FF[`SUC (3+i)`;`v`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (3+i), v (SUC (3+i))`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (SUC (3+i)), v (SUC (SUC (3+i)))`] +THEN MRESA_TAC Ppbtydq.PPBTYDQ[`v (3+i)`;`v (SUC(SUC (3+i)))`;`v (SUC (3+i))`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(SUC(3+i))= 1*5+i`] +THEN STRIP_TAC +THEN MRESA_TAC Local_lemmas.LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI[`E`;`V`;`FF`;`v i`;`v(j)`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC Local_lemmas.CONV0_SUB_CONV[`vec 0:real^3`;`{v i, v (3+i)}`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(1*5+i):num`;`v:num->real^3`;`(1*5+i) MOD k`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[MOD_REFL;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN MRESA_TAC MOD_MULT_ADD[`1`;`5`;`i`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(i MOD k):num`;`v:num->real^3`;`i`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[MOD_REFL;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN DICH_TAC 5 +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC; + + + + +REWRITE_TAC[ARITH_RULE`0+a=a`] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`(3+i)`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC (3+i)`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC(SUC (3+i))`] +THEN MRESA_TAC DIST_EDGE_IN_BB_LE_2[`s`;`v`;`(3+i)`] +THEN MRESA_TAC DIST_EDGE_IN_BB_LE_2[`s`;`v`;`SUC (3+i)`] +THEN MP_TAC NORM_V_IN_BB_LE_CSTAB +THEN RESA_TAC +THEN THAYTHE_TAC 0[`(3+i)`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (3+i)`;`v (SUC (3+i))`;`cstab`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[cstab;REAL_ARITH`#3.01 < &4`] +THEN REWRITE_TAC[GSYM cstab] +THEN STRIP_TAC +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (SUC (3+i))`;`v (SUC(SUC (3+i)))`;`&2* h0`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;REAL_ARITH`&2 * #1.26 < &4`] +THEN REWRITE_TAC[GSYM h0] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`arcV (vec 0) (v (3+i)) (v (SUC (3+i))) <= arclength (&2) (&2) (cstab) +/\ arcV (vec 0) ((v:num->real^3) (SUC (3+i))) (v (SUC (SUC (3+i)))) <= + arclength (&2) (&2) (&2 * h0) +/\ arclength (&2) (&2) (&2 * h0) + arclength (&2) (&2) (cstab) < pi +==>arcV (vec 0) (v ((3+i))) (v ((SUC (3+i))))+ arcV (vec 0) (v (SUC (3+i))) (v (SUC (SUC (3+i)))) + < pi`) +THEN ASM_SIMP_TAC[arclength_2h0_cstab] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_FF[`(3+i)`;`v`] +THEN MRESA_TAC WL_IN_FF[`SUC (3+i)`;`v`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (3+i), v (SUC (3+i))`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR[`V`;`E`;`FF`;`v (SUC (3+i)), v (SUC (SUC (3+i)))`] +THEN MRESA_TAC Ppbtydq.PPBTYDQ[`v (3+i)`;`v (SUC(SUC (3+i)))`;`v (SUC (3+i))`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(SUC(3+i))= 1*5+i`] +THEN STRIP_TAC +THEN MRESA_TAC Local_lemmas.LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI[`E`;`V`;`FF`;`v i`;`v(j)`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC Local_lemmas.CONV0_SUB_CONV[`vec 0:real^3`;`{v i, v (3+i)}`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(1*5+i):num`;`v:num->real^3`;`(1*5+i) MOD k`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[MOD_REFL;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN MRESA_TAC MOD_MULT_ADD[`1`;`5`;`i`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(i MOD k):num`;`v:num->real^3`;`i`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[MOD_REFL;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN DICH_TAC 5 +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC; + + +]);; + + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/AYQJTMD.hl b/text_formalization/local/AYQJTMD.hl new file mode 100755 index 0000000..ad7001c --- /dev/null +++ b/text_formalization/local/AYQJTMD.hl @@ -0,0 +1,237 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Ayqjtmd = struct + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + + + + + +open Xwitccn;; + + + + +let XWITCCN2=prove_by_refinement( +` !s vv. MEM s s_init_list_v39 /\ vv IN BBs_v39 s +/\ taustar_v39 s vv < &0 + ==> ~(BBprime2_v39 s = {})`, + (* {{{ proof *) +[ +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MRESA_TAC XWITCCN[`s:scs_v39`;`vv:num->real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?vv1. vv1 IN A`;BBprime2_v39;IN;BBindex_min_v39;] +THEN STRIP_TAC +THEN SUBGOAL_THEN`?n. (?vv1. BBprime_v39 s vv1 /\ + BBindex_v39 s vv1=n)` ASSUME_TAC; + +EXISTS_TAC`BBindex_v39 s vv1` +THEN EXISTS_TAC`vv1:num->real^3` +THEN ASM_REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[MINIMAL] +THEN STRIP_TAC +THEN EXISTS_TAC`vv1':num->real^3` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th] THEN ASSUME_TAC (SYM th)) +THEN ASM_REWRITE_TAC[Misc_defs_and_lemmas.min_num;ARITH_RULE`(A=B:num)<=> (B=A)`] +THEN STRIP_TAC +THEN MATCH_MP_TAC SELECT_UNIQUE +THEN ASM_REWRITE_TAC[BETA_THM;IMAGE;IN_ELIM_THM;] +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN EQ_TAC; + +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`(?x. BBprime_v39 s x /\ BBindex_v39 s vv1' = BBindex_v39 s x)`ASSUME_TAC; + +EXISTS_TAC`vv1':num->real^3` +THEN ASM_REWRITE_TAC[]; + +STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`BBindex_v39 s vv1'`) +THEN MP_TAC(ARITH_RULE`BBindex_v39 s x <= BBindex_v39 s vv1' ==> +BBindex_v39 s x < BBindex_v39 s vv1' \/ BBindex_v39 s x = BBindex_v39 s vv1'`) +THEN RESA_TAC +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN +MRESA1_TAC th` BBindex_v39 s x`) +THEN SUBGOAL_THEN`(?vv1. BBprime_v39 s vv1 /\ BBindex_v39 s x = BBindex_v39 s vv1)`ASSUME_TAC; + +EXISTS_TAC`x:num->real^3` +THEN ASM_REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[]; + +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + + + +EXISTS_TAC`vv1':num->real^3` +THEN ASM_REWRITE_TAC[]; + + +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`BBindex_v39 s x REPEAT STRIP_TAC THEN +MRESA1_TAC th` BBindex_v39 s x`) +THEN SUBGOAL_THEN`(?vv1. BBprime_v39 s vv1 /\ BBindex_v39 s x = BBindex_v39 s vv1)`ASSUME_TAC; + +EXISTS_TAC`x:num->real^3` +THEN ASM_REWRITE_TAC[]; + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[]; +]);; + (* }}} *) + + +let unadorned_MMs=prove_by_refinement( +` unadorned_v39 s ==> (MMs_v39 s = BBprime2_v39 s)` +, + (* {{{ proof *) +[ +REWRITE_TAC[FUN_EQ_THM] +THEN REWRITE_TAC[unadorned_v39;MMs_v39;] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THEN RESA_TAC; + +STRIP_TAC; + +SET_TAC[]; + +STRIP_TAC; + +SET_TAC[]; + +STRIP_TAC; + +SET_TAC[]; + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;] +THEN RESA_TAC; +]);; + (* }}} *) + + + + +let S_INIT_IS_UNADORNED=prove( +`MEM s s_init_list_v39 +==> unadorned_v39 s`, +REWRITE_TAC[s_init_list_v39;JEJTVGB_assume_v39;GSYM IN_SET_OF_LIST;set_of_list;LET_DEF;LET_END_DEF +;SET_RULE`A IN {A1,A2,A3,A4,A5,A6,A7,A8} <=> A= A1 \/ A= A2 \/ A= A3 \/ A= A4 \/ A= A5 \/ A= A6 \/ A= A7 \/ A= A8`] +THEN REPEAT GEN_TAC +THEN RESA_TAC +THEN REWRITE_TAC[unadorned_v39] +THEN ASM_REWRITE_TAC[scs_lo_v39_explicit;scs_str_v39_explicit;scs_am_v39_explicit;scs_bm_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`~(4<=3)/\ 3-1=2`;mk_unadorned_v39;CS_ADJ;scs_J_v39_explicit;change_type_v2;d_tame ;change_type_v3;scs_hi_v39_explicit;]);; + + + +let AYQJTMD =prove( +`!s vv. MEM s s_init_list_v39 /\ vv IN BBs_v39 s /\ + taustar_v39 s vv < &0 + ==> ~(MMs_v39 s = {})`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC S_INIT_IS_UNADORNED +THEN RESA_TAC +THEN MP_TAC unadorned_MMs +THEN RESA_TAC +THEN MATCH_MP_TAC XWITCCN2 +THEN EXISTS_TAC`vv:num->real^3` +THEN ASM_REWRITE_TAC[]);; + + + +let EAPGLE =prove( `(!s. MEM s s_init_list_v39 ==> MMs_v39 s = {}) ==> JEJTVGB_assume_v39`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC ZITHLQN +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`taustar_v39 s vv< &0\/ &0 <= taustar_v39 s vv`) +THEN RESA_TAC +THEN MRESA_TAC AYQJTMD[`s:scs_v39`;`vv:num->real^3`] +THEN ASM_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`s:scs_v39`));; + + + + end;; + diff --git a/text_formalization/local/BKOSSGE.hl b/text_formalization/local/BKOSSGE.hl new file mode 100644 index 0000000..7933681 --- /dev/null +++ b/text_formalization/local/BKOSSGE.hl @@ -0,0 +1,396 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Section: Appendix, Main Estimate, check_completeness *) +(* Chapter: Local Fan *) +(* Lemma: BKOSSGE *) +(* Author: Thomas Hales *) +(* Date: 2013-08-07 *) +(* ========================================================================== *) + +module Bkossge = struct + + open Hales_tactic;; + +let cos_bounds_0_pi = prove_by_refinement( + `!z. &0 < z /\ z < pi ==> -- &1 < cos z /\ cos z < &1`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `(&0 < z /\ z < pi / &2) \/ z = pi / &2 \/ (&0 < pi - z /\ pi - z < pi / &2)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC); + BY(ASM_MESON_TAC[Counting_spheres.cos_bounds_0_Pi2;arith `&0 < x ==> -- &1 < x`]); + ASM_REWRITE_TAC[COS_PI2]; + BY(REAL_ARITH_TAC); + TYPIFY `-- &1 < --cos z /\ --cos z < &1` ENOUGH_TO_SHOW_TAC; + BY(REAL_ARITH_TAC); + ONCE_REWRITE_TAC[GSYM COS_NEG]; + REWRITE_TAC[GSYM COS_PERIODIC_PI;arith `--z + pi = pi - z`]; + BY(ASM_MESON_TAC[Counting_spheres.cos_bounds_0_Pi2;arith `&0 < x ==> -- &1 < x`]) + ]);; + (* }}} *) + +let ear_acute = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6. + &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + &2 <= y4 /\ y4 <= &2 * h0 /\ + &2 <= y6 /\ y6 <= &2 * h0 /\ + &3 <= y5 /\ + &0 < ups_x (y1*y1) (y3*y3) (y5*y5) + ==> dih_y y1 y2 y3 y4 y5 y6 < pi / &2) +`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.h0;arith `&2 * #1.26 = #2.52`;Trigonometry.IHIQXLM]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (Terminal.get_main_nonlinear "2485876245a") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `#3.0 = &3`;]; + ANTS_TAC; + REWRITE_TAC[arith `x <= y <=> ~(y < x)`]; + DISCH_TAC; + FIRST_X_ASSUM_ST `&16` MP_TAC THEN REWRITE_TAC[arith `a * b * c = (a * b) * c`]; + REWRITE_TAC[arith `~(&0 < x * y) <=> &0 <= x * (-- y)`]; + REPEAT (GMATCH_SIMP_TAC REAL_LE_MUL_EQ); + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL_EQ); + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[Nonlinear_lemma.dih_x_alt;Sphere.dih_y;LET_THM;GSYM Sphere.delta_y]; + REWRITE_TAC[GSYM Sphere.delta4_y;GSYM Sphere.y_of_x]; + REWRITE_TAC[arith `pi2 + a < pi2 <=> a < &0`]; + DISCH_TAC; + GMATCH_SIMP_TAC Tskajxy.ATN2_Y_NEG; + CONJ_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[arith `p - a = p + -- a`;GSYM ATN_NEG;arith `-- p + a < &0 <=> a < p`;ATN_BOUNDS]) + ]);; + (* }}} *) + +let quad_nonexist_849 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> ~(?(v1:real^3) v2 v3 v4. + dist(v1,v2) = &2 /\ dist(v2,v3) = &2 /\ dist(v3,v4) = &2 /\ dist(v1,v4)= &2 * h0 /\ + cstab <= dist(v1,v3) /\ cstab <= dist(v2,v4))`, + (* {{{ proof *) + [ + REWRITE_TAC[NOT_EXISTS_THM;Sphere.cstab]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (Terminal.get_main_nonlinear "8495326405") [`dist(v3,v4)`;`dist(v2,v3)`;`dist(v1,v3)`;`dist(v1,v2)`;`dist(v1,v4)`;`dist(v2,v4)`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + ASM_REWRITE_TAC[arith `x <= x`]; + TYPIFY `!w1 w3 w2. dist(w1,w2) = &2 /\ dist(w2,w3) = &2 ==> dist((w1:real^3),w3) <= &6` ENOUGH_TO_SHOW_TAC; + BY(DISCH_TAC THEN CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_MESON_TAC[DIST_SYM]); + REPEAT GEN_TAC THEN (INTRO_TAC DIST_TRIANGLE[`w1`;`w2`;`w3`]); + BY(REAL_ARITH_TAC); + REWRITE_TAC[arith `~(x < &0) <=> &0 <= x`]; + BY(INTRO_TAC Terminal.DELTA_Y_POS_4POINTS [`v3`;`v4`;`v2`;`v1`] THEN REWRITE_TAC[DIST_SYM]) + ]);; + (* }}} *) + +(* shortest diag < 3.62 *) + +let quad_diag_362 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!(v1:real^3) v2 v3 v4. + dist(v1,v2) = &2 /\ dist(v2,v3) = cstab /\ dist(v3,v4) = &2 /\ dist(v1,v4)= cstab ==> + (dist(v1,v3) <= #3.62 \/ dist(v2,v4) <= #3.62))`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.cstab;arith `x <= y <=> ~(y < x)`;GSYM DE_MORGAN_THM]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (Terminal.get_main_nonlinear "2171548893") [`dist(v3,v4)`;`dist(v2,v3)`;`dist(v1,v3)`;`dist(v1,v2)`;`dist(v1,v4)`;`dist(v2,v4)`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + ASM_REWRITE_TAC[arith `x <= x`]; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + TYPIFY `!w1 w3 w2. dist(w1,w2) = &2 /\ dist(w2,w3) = #3.01 ==> dist((w1:real^3),w3) <= &6` ENOUGH_TO_SHOW_TAC; + BY(DISCH_TAC THEN CONJ_TAC THENL [ALL_TAC;ONCE_REWRITE_TAC[DIST_SYM]] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_MESON_TAC[DIST_SYM]); + REPEAT GEN_TAC THEN (INTRO_TAC DIST_TRIANGLE[`w1`;`w2`;`w3`]); + BY(REAL_ARITH_TAC); + REWRITE_TAC[arith `~(x < &0) <=> &0 <= x`]; + BY(INTRO_TAC Terminal.DELTA_Y_POS_4POINTS [`v3`;`v4`;`v2`;`v1`] THEN REWRITE_TAC[DIST_SYM]) + ]);; + (* }}} *) + +let INV_ARCLENGTH = prove_by_refinement( + `!y1 y3 z. + &0 < z /\ z < pi /\ &0 < y1 /\ &0 < y3 ==> + &0 < y1 pow 2 + y3 pow 2 - &2 * y1 *y3 * cos z /\ + z = arclength y1 y3 (sqrt (y1 pow 2 + y3 pow 2 - &2 * y1 *y3 * cos z))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC cos_bounds_0_pi [`z`]; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + SUBCONJ_TAC; + REWRITE_TAC[arith `y1 pow 2 + y3 pow 2 - &2 * y1 * y3 * cos z = (y1 - y3) pow 2 + &2 * y1 *y3 * (&1 - cos z)`]; + MATCH_MP_TAC (arith `&0 <= a /\ &0 < b ==> &0 < a + b`); + REWRITE_TAC[ REAL_LE_POW_2]; + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL_EQ); + BY(ASM_TAC THEN REAL_ARITH_TAC); + DISCH_TAC; + TYPED_ABBREV_TAC `c = sqrt (y1 pow 2 + y3 pow 2 - &2 * y1 * y3 * cos z)`; + GMATCH_SIMP_TAC Trigonometry1.ACS_ARCLENGTH; + TYPIFY `c*c = y1 pow 2 + y3 pow 2 - &2 * y1 * y3 * cos z` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "c"; + GMATCH_SIMP_TAC Merge_ineq.sqrtpow2; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPED_ABBREV_TAC `r = (y1 * y1 + y3 * y3 - c * c) / (&2 * y1 * y3)`; + CONJ2_TAC; + TYPIFY `r = cos z` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + GMATCH_SIMP_TAC ACS_COS; + BY(ASM_TAC THEN REAL_ARITH_TAC); + EXPAND_TAC "r"; + FIRST_X_ASSUM_ST `c * c = s` (SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + SUBCONJ_TAC; + EXPAND_TAC "c"; + GMATCH_SIMP_TAC SQRT_POS_LE; + BY(ASM_TAC THEN REAL_ARITH_TAC); + DISCH_TAC; + TYPIFY `c pow 2 <= (y1 + y3) pow 2 /\ (abs(y1 - y3)) pow 2 <= c pow 2` ENOUGH_TO_SHOW_TAC; + GMATCH_SIMP_TAC (GSYM Trigonometry2.POW2_COND); + GMATCH_SIMP_TAC (GSYM Trigonometry2.POW2_COND); + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[REAL_POW2_ABS]; + ASM_REWRITE_TAC[arith `c pow 2 = c * c`]; + TYPIFY `-- &2 * y1 * y3 * cos z <= &2 * y1 * y3 /\ -- &2 * y1 * y3 <= -- &2 * y1 * y3 * cos z` ENOUGH_TO_SHOW_TAC; + BY(REAL_ARITH_TAC); + REWRITE_TAC[arith ` -- &2 * y1 * y3 * cos z <= &2 * y1 *y3 <=> &0 <= &2 * y1 * y3 * (&1 + cos z)`;arith `-- &2 * y1 * y3 <= -- &2 * y1 * y3 * cos z <=> &0 <= &2 * y1 * y3 * (&1 - cos z)`]; + GMATCH_SIMP_TAC REAL_LE_MUL; + REPEAT (GMATCH_SIMP_TAC REAL_LE_MUL); + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let taum_dih_y = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + taum y1 y2 y3 y4 y5 y6 = + rho y1 * dih_y y1 y2 y3 y4 y5 y6 + + rho y2 * dih_y y2 y3 y1 y5 y6 y4 + + rho y3 * dih_y y3 y1 y2 y6 y4 y5 - (pi + sol0)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.taum;Sphere.sol_y;Sphere.lnazim;Sphere.rho;Nonlinear_lemma.sol0_const1]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let real_continuous_dih_y_wrt4 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + &0 < delta_y y1 y2 y3 y4 y5 y6 /\ + &0 < y1 /\ + &0 < ups_x (y1 * y1) (y2 * y2) (y6 * y6) /\ + &0 < ups_x (y1 * y1) (y3 * y3) (y5 * y5) + ==> (\q. dih_y y1 y2 y3 q y5 y6) real_continuous atreal y4`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Ocbicby.derived_form_dih_x_wrt_x4 [`y1*y1`;`y2*y2`;`y3*y3`;`y4*y4`;`y5*y5`;`y6*y6`]; + REWRITE_TAC[Calc_derivative.derived_form;Sphere.dih_y;LET_THM]; + REWRITE_TAC[WITHINREAL_UNIV]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[GSYM Sphere.delta_y]); + DISCH_TAC; + TYPIFY `(\q. dih_x (y1 * y1) (y2 * y2) (y3 * y3) (q * q) (y5 * y5) (y6 * y6)) = (\q. dih_x (y1 * y1) (y2 * y2) (y3 * y3) (q) (y5 * y5) (y6 * y6)) o (\t. t pow 2)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[FUN_EQ_THM;o_THM;arith `x*x = x pow 2`]); + MATCH_MP_TAC REAL_CONTINUOUS_ATREAL_COMPOSE; + CONJ_TAC; + MATCH_MP_TAC REAL_CONTINUOUS_POW; + BY(REWRITE_TAC[REAL_CONTINUOUS_AT_ID]); + REWRITE_TAC[arith `y4 pow 2 = y4 * y4`]; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let real_continuous_dih_y_wrt5 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + &0 < delta_y y1 y2 y3 y4 y5 y6 /\ + &0 < y1 /\ + &0 < ups_x (y1 * y1) (y2 * y2) (y6 * y6) /\ + &0 < ups_x (y1 * y1) (y3 * y3) (y5 * y5) + ==> (\q. dih_y y1 y2 y3 y4 q y6) real_continuous atreal y5`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Ocbicby.derived_form_dih_x_wrt_x5 [`y1*y1`;`y2*y2`;`y3*y3`;`y4*y4`;`y5*y5`;`y6*y6`]; + REWRITE_TAC[Calc_derivative.derived_form;Sphere.dih_y;LET_THM]; + REWRITE_TAC[WITHINREAL_UNIV]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[GSYM Sphere.delta_y]); + DISCH_TAC; + TYPIFY `(\q. dih_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (q * q) (y6 * y6)) = (\q. dih_x (y1 * y1) (y2 * y2) (y3 * y3) (y4*y4) (q) (y6 * y6)) o (\t. t pow 2)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[FUN_EQ_THM;o_THM;arith `x*x = x pow 2`]); + MATCH_MP_TAC REAL_CONTINUOUS_ATREAL_COMPOSE; + CONJ_TAC; + MATCH_MP_TAC REAL_CONTINUOUS_POW; + BY(REWRITE_TAC[REAL_CONTINUOUS_AT_ID]); + REWRITE_TAC[arith `y5 pow 2 = y5 * y5`]; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let real_continuous_dih_y_wrt6 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + &0 < delta_y y1 y2 y3 y4 y5 y6 /\ + &0 < y1 /\ + &0 < ups_x (y1 * y1) (y2 * y2) (y6 * y6) /\ + &0 < ups_x (y1 * y1) (y3 * y3) (y5 * y5) + ==> (\q. dih_y y1 y2 y3 y4 y5 q) real_continuous atreal y6`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Ocbicby.derived_form_dih_x_wrt_x6 [`y1*y1`;`y2*y2`;`y3*y3`;`y4*y4`;`y5*y5`;`y6*y6`]; + REWRITE_TAC[Calc_derivative.derived_form;Sphere.dih_y;LET_THM]; + REWRITE_TAC[WITHINREAL_UNIV]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[GSYM Sphere.delta_y]); + DISCH_TAC; + TYPIFY `(\q. dih_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (q*q)) = (\q. dih_x (y1 * y1) (y2 * y2) (y3 * y3) (y4*y4) (y5 * y5) (q)) o (\t. t pow 2)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[FUN_EQ_THM;o_THM;arith `x*x = x pow 2`]); + MATCH_MP_TAC REAL_CONTINUOUS_ATREAL_COMPOSE; + CONJ_TAC; + MATCH_MP_TAC REAL_CONTINUOUS_POW; + BY(REWRITE_TAC[REAL_CONTINUOUS_AT_ID]); + REWRITE_TAC[arith `y6 pow 2 = y6 * y6`]; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let real_continuous_taum = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + &0 < delta_y y1 y2 y3 y4 y5 y6 /\ + &0 < y1 /\ &0 < y2 /\ &0 < y3 /\ + &0 < ups_x (y1 * y1) (y2 * y2) (y6 * y6) /\ + &0 < ups_x (y2 * y2) (y3 * y3) (y4 * y4) /\ + &0 < ups_x (y1 * y1) (y3 * y3) (y5 * y5) ==> + (\q. taum y1 y2 y3 q y5 y6) real_continuous atreal y4`, + (* {{{ proof *) + [ + REWRITE_TAC[taum_dih_y]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `delta_y y3 y1 y2 y6 y4 y5 = delta_y y1 y2 y3 y4 y5 y6 /\ delta_y y2 y3 y1 y5 y6 y4 = delta_y y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + TYPIFY `ups_x (y3 * y3) (y1 * y1) (y5 * y5) = ups_x (y1 * y1) (y3 * y3) (y5 * y5) /\ ups_x (y3 * y3) (y2 * y2) (y4 * y4) = ups_x (y2 * y2) (y3 * y3) (y4 * y4) /\ ups_x (y2 * y2) (y1 * y1) (y6 * y6) = ups_x (y1 * y1) (y2 * y2) (y6 * y6)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Merge_ineq.ups_x_sym]); + BY((REPEAT (REPEAT CONJ_TAC THEN (MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB ORELSE MATCH_MP_TAC real_continuous_dih_y_wrt6 ORELSE MATCH_MP_TAC real_continuous_dih_y_wrt5 ORELSE MATCH_MP_TAC real_continuous_dih_y_wrt4 THEN ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST])))) + ]);; + (* }}} *) + +let UPS_X_STD_POS = prove_by_refinement( + `!y1 y2 y3. &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 ==> &0 < ups_x (y1 * y1) (y2 * y2) (y3 * y3)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + BY(MATCH_MP_TAC Ysskqoy.TRI_UPS_X_STRICT_POS THEN ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + + + +let BKOSSGE = prove_by_refinement( + `scs_arrow_v39 {scs_3M1} {scs_3T1, scs_3T5}`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_arrow_v39;IN_SING;IN_INSERT;NOT_IN_EMPTY]; + CONJ_TAC; + BY(MESON_TAC[Ocbicby.is_scs_examples]); + REWRITE_TAC[TAUT `(a \/ b) <=> (~a ==> b)`;NOT_FORALL_THM]; + REWRITE_TAC[TAUT `~(a ==> b) <=> (a /\ ~b)`]; + REWRITE_TAC[IN;NOT_FORALL_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?v. MMs_v39 s v /\ dist(v 0,v 1) <= sqrt8` ASM_CASES_TAC; + FIRST_X_ASSUM MP_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `scs_3T5` EXISTS_TAC; + REWRITE_TAC[]; + MATCH_MP_TAC Ppbtydq.XWNHLMD_MM; + ASM_REWRITE_TAC[]; + REWRITE_TAC[Ocbicby.is_scs_examples;Ocbicby.basic_examples]; + nCONJ_TAC 1; + BY(ASM_MESON_TAC[IN]); + CONJ_TAC; + BY(REWRITE_TAC[Appendix.scs_3M1;Appendix.scs_3T5;Appendix.scs_k_v39_explicit;Appendix.mk_unadorned_v39]); + ASM_REWRITE_TAC[]; + CONJ2_TAC; + REWRITE_TAC[Appendix.scs_3M1;Appendix.scs_3T5;Appendix.scs_d_v39_explicit;Appendix.mk_unadorned_v39]; + BY(REAL_ARITH_TAC); + REWRITE_TAC[IN;Appendix.BBs_v39]; + REPEAT LET_TAC; + REWRITE_TAC[Appendix.scs_3T5;Appendix.scs_v39_explicit;Terminal.scs_unadorned_explicit]; + TYPIFY `BBs_v39 scs_3M1 v` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC Nuxcoea.MMS_IMP_BBS; + BY(ASM_MESON_TAC[IN]); + REWRITE_TAC[IN;Appendix.BBs_v39]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[LET_THM]; + REWRITE_TAC[Appendix.scs_3M1;Appendix.scs_v39_explicit;Terminal.scs_unadorned_explicit]; + REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC Terminal.periodic2_mod_reduce; + TYPIFY `3` EXISTS_TAC; + REWRITE_TAC[arith `~(3 =0)`]; + CONJ_TAC; + FIRST_X_ASSUM_ST `periodic` MP_TAC; + REWRITE_TAC[Appendix.periodic2;Oxl_def.periodic]; + DISCH_THEN (unlist REWRITE_TAC); + BY(MESON_TAC[Terminal.periodic2_funlist;Appendix.periodic2]); + REWRITE_TAC[arith `i < 3 <=> i = 0 \/ i = 1 \/ i = 2 `]; + REWRITE_TAC[TAUT ` ((a \/ b) /\ c) <=> ((a /\ c) \/ (b /\ c))`;TAUT `(a /\ (b \/ c)) <=> ((a /\ b) \/ (a /\ c))`]; + BY(REPEAT STRIP_TAC THEN (FIRST_X_ASSUM (C INTRO_TAC [`i`;`j`])) THEN ASM_REWRITE_TAC[] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] THEN NUM_REDUCE_TAC THEN REWRITE_TAC[Appendix.psort;LET_THM;Terminal.FUNLIST_EXPLICIT] THEN NUM_REDUCE_TAC THEN FIRST_X_ASSUM_ST `sqrt8` MP_TAC THEN REWRITE_TAC[DIST_SYM;PAIR_EQ] THEN NUM_REDUCE_TAC THEN TRY REAL_ARITH_TAC); + COMMENT "second half"; + TYPIFY `?v. MMs_v39 s v /\ sqrt8 <= dist(v 0,v 1)` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM_ST `{}` MP_TAC THEN REWRITE_TAC[EXTENSION;NOT_IN_EMPTY]; + BY(REWRITE_TAC[IN] THEN ASM_MESON_TAC[arith `~(x <= y) ==> (y <= x)`]); + POP_ASSUM kill; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `scs_3T1` EXISTS_TAC; + REWRITE_TAC[]; + MATCH_MP_TAC Ppbtydq.XWNHLMD_MM; + ASM_REWRITE_TAC[]; + REWRITE_TAC[Ocbicby.is_scs_examples;Ocbicby.basic_examples]; + nCONJ_TAC 1; + BY(ASM_MESON_TAC[IN]); + CONJ_TAC; + BY(REWRITE_TAC[Appendix.scs_3T1;Appendix.scs_3M1;Appendix.scs_k_v39_explicit;Appendix.mk_unadorned_v39]); + ASM_REWRITE_TAC[]; + CONJ2_TAC; + REWRITE_TAC[Appendix.scs_3M1;Appendix.scs_3T1;Appendix.scs_d_v39_explicit;Appendix.mk_unadorned_v39]; + BY(REAL_ARITH_TAC); + REWRITE_TAC[IN;Appendix.BBs_v39]; + REPEAT LET_TAC; + REWRITE_TAC[Appendix.scs_3T1;Appendix.scs_v39_explicit;Terminal.scs_unadorned_explicit]; + TYPIFY `BBs_v39 scs_3M1 v` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC Nuxcoea.MMS_IMP_BBS; + BY(ASM_MESON_TAC[IN]); + REWRITE_TAC[IN;Appendix.BBs_v39]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[LET_THM]; + REWRITE_TAC[Appendix.scs_3M1;Appendix.scs_v39_explicit;Terminal.scs_unadorned_explicit]; + REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC Terminal.periodic2_mod_reduce; + TYPIFY `3` EXISTS_TAC; + REWRITE_TAC[arith `~(3 =0)`]; + CONJ_TAC; + FIRST_X_ASSUM_ST `periodic` MP_TAC; + REWRITE_TAC[Appendix.periodic2;Oxl_def.periodic]; + DISCH_THEN (unlist REWRITE_TAC); + BY(MESON_TAC[Terminal.periodic2_funlist;Appendix.periodic2]); + REWRITE_TAC[arith `i < 3 <=> i = 0 \/ i = 1 \/ i = 2 `]; + REWRITE_TAC[TAUT ` ((a \/ b) /\ c) <=> ((a /\ c) \/ (b /\ c))`;TAUT `(a /\ (b \/ c)) <=> ((a /\ b) \/ (a /\ c))`]; + BY(REPEAT STRIP_TAC THEN (FIRST_X_ASSUM (C INTRO_TAC [`i`;`j`])) THEN ASM_REWRITE_TAC[] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] THEN NUM_REDUCE_TAC THEN REWRITE_TAC[Appendix.psort;LET_THM;Terminal.FUNLIST_EXPLICIT] THEN NUM_REDUCE_TAC THEN FIRST_X_ASSUM_ST `sqrt8` MP_TAC THEN REWRITE_TAC[DIST_SYM;PAIR_EQ] THEN NUM_REDUCE_TAC THEN TRY REAL_ARITH_TAC) + ]);; + (* }}} *) + +end;; diff --git a/text_formalization/local/CNICGSF.hl b/text_formalization/local/CNICGSF.hl new file mode 100644 index 0000000..0d0b092 --- /dev/null +++ b/text_formalization/local/CNICGSF.hl @@ -0,0 +1,930 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Cnicgsf = struct + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +open Yxionxl2;; +open Eyypqdw;; +open Ocbicby;; +open Imjxphr;; +open Nuxcoea;; +open Aursipd;; +open Cuxvzoz;; +open Rrcwnsj;; +open Tfitskc;; +open Hexagons;; +open Otmtotj;; +open Hijqaha;; + + + + +(*******************) + +let SCS_DIAG_SCS_5I1_02=prove(`scs_diag (scs_k_v39 scs_5I1) 0 2`, +REWRITE_TAC[K_SCS_5I1;scs_diag] +THEN ARITH_TAC);; + + + + + +let SCS_5I1_SLICE_02=prove_by_refinement( +`scs_arrow_v39 +{ scs_stab_diag_v39 scs_5I1 0 2} +{scs_prop_equ_v39 scs_3M1 1,scs_prop_equ_v39 scs_4M2 1}`, + +[MATCH_MP_TAC (GEN_ALL Lkgrqui.LKGRQUI) +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_5I1_02;STAB_5I1_SCS;SCS_K_D_A_STAB_EQ;] +THEN EXISTS_TAC`0` +THEN EXISTS_TAC`2` +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_5I1_02] +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ] +THEN REPEAT RESA_TAC; + +REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ;scs_slice_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC scs_inj +THEN ASM_SIMP_TAC[SCS_5I1_BASIC;SCS_3M1_BASIC;J_SCS_4M2;BASIC_HALF_SLICE_STAB;J_SCS_3M1;D_HALF_SLICE;BAISC_PROP_EQU;K_SCS_PROP_EUQ;SCS_4M2_BASIC] +THEN STRIP_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3M1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_5I1] +THEN ARITH_TAC; + +STRIP_TAC +THEN ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_5I1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_3M1;scs_3M1;scs_5M3; +ARITH_RULE`(2 + 1 + 5 - 0) MOD 5= 3/\ 0 MOD 5=0/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`1+x:num`;`1+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_4M2;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_5I1] +THEN ARITH_TAC; + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_5I1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M2;scs_3T4_prime;scs_5M3; +ARITH_RULE`(0+1 + 5 - 2) MOD 5= 4/\ 2 MOD 5=2/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 4<4==> x MOD 4=0\/ x MOD 4=1\/ x MOD 4=2\/ x MOD 4=3`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 4<4==> x' MOD 4=0\/ x' MOD 4=1\/ x' MOD 4=2\/x' MOD 4=3`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`0`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`1`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`2`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`3`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`0`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`1`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`2`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`3`;`1`][ARITH_RULE`~(4=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`1+x:num`;`1+x':num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[J_SCS_3M1]]);; + + +let CNICGSF1=prove(`scs_arrow_v39 +{ scs_stab_diag_v39 scs_5I1 0 2} +{scs_3M1, scs_4M2 }`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{ scs_prop_equ_v39 scs_3M1 1, scs_prop_equ_v39 scs_4M2 1}` +THEN ASM_REWRITE_TAC[SCS_5I1_SLICE_02;SET_RULE`{A,B}={A}UNION {B}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC +THENL[ +MRESAS_TAC PRO_EQU_ID1[`scs_3M1`;`1`;`3`][SCS_3M1_IS_SCS;K_SCS_3M1;ARITH_RULE`(3 - 1 MOD 3)=2`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_3M1 1`;`2`][PROP_EQU_IS_SCS;SCS_3M1_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]; + +MRESAS_TAC PRO_EQU_ID1[`scs_4M2`;`1`;`4`][SCS_4M2_IS_SCS;K_SCS_4M2;ARITH_RULE`(4 - 1 MOD 4)=3`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_4M2 1`;`3`][PROP_EQU_IS_SCS;SCS_4M2_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]]);; + + +(**************) + +let SCS_DIAG_SCS_5I2_02=prove(`scs_diag (scs_k_v39 scs_5I2) 0 2`, +REWRITE_TAC[K_SCS_5I2;scs_diag] +THEN ARITH_TAC);; + + + +let SCS_5I2_SLICE_02=prove_by_refinement(`scs_arrow_v39 +{ scs_stab_diag_v39 scs_5I2 0 2} +{scs_prop_equ_v39 scs_3T1 1,scs_prop_equ_v39 scs_4M3' 1}`, +[ + +MATCH_MP_TAC (GEN_ALL Lkgrqui.LKGRQUI) +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_5I2_02;STAB_5I2_SCS;SCS_K_D_A_STAB_EQ;] +THEN EXISTS_TAC`0` +THEN EXISTS_TAC`2` +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_5I2_02] +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ] +THEN REPEAT RESA_TAC; +REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ;scs_slice_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC scs_inj +THEN ASM_SIMP_TAC[SCS_5I2_BASIC;SCS_3T1_BASIC;J_SCS_4M3;BASIC_HALF_SLICE_STAB;J_SCS_3T1;D_HALF_SLICE;BAISC_PROP_EQU;K_SCS_PROP_EUQ;SCS_4M3_BASIC] +THEN STRIP_TAC; + + +ASM_SIMP_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_5I2] +THEN ARITH_TAC; +STRIP_TAC +THEN ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_5I2;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_3M1;scs_3M1;scs_5M3; +ARITH_RULE`(2 + 1 + 5 - 0) MOD 5= 3/\ 0 MOD 5=0/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`1+x:num`;`1+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_4M3;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_5I2] +THEN ARITH_TAC; + + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_5I2;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M3; +ARITH_RULE`(0+1 + 5 - 2) MOD 5= 4/\ 2 MOD 5=2/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 4<4==> x MOD 4=0\/ x MOD 4=1\/ x MOD 4=2\/ x MOD 4=3`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 4<4==> x' MOD 4=0\/ x' MOD 4=1\/ x' MOD 4=2\/x' MOD 4=3`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`0`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`1`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`2`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`3`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`0`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`1`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`2`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`3`;`1`][ARITH_RULE`~(4=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`1+x:num`;`1+x':num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[J_SCS_3T1]; + +]);; + + + +let CNICGSF2=prove(`scs_arrow_v39 +{ scs_stab_diag_v39 scs_5I2 0 2} +{scs_3T1, scs_4M3' }`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{ scs_prop_equ_v39 scs_3T1 1, scs_prop_equ_v39 scs_4M3' 1}` +THEN ASM_REWRITE_TAC[SCS_5I2_SLICE_02;SET_RULE`{A,B}={A}UNION {B}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC +THENL[ + +MRESAS_TAC PRO_EQU_ID1[`scs_3T1`;`1`;`3`][SCS_3T1_IS_SCS;K_SCS_3T1;ARITH_RULE`(3 - 1 MOD 3)=2`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_3T1 1`;`2`][PROP_EQU_IS_SCS;SCS_3T1_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]; + +MRESAS_TAC PRO_EQU_ID1[`scs_4M3'`;`1`;`4`][SCS_4M3_IS_SCS;K_SCS_4M3;ARITH_RULE`(4 - 1 MOD 4)=3`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_4M3' 1`;`3`][PROP_EQU_IS_SCS;SCS_4M3_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]]);; + + + +(*****************************) + +let SCS_DIAG_SCS_5M1_02=prove(`scs_diag (scs_k_v39 scs_5M1) 0 2`, +REWRITE_TAC[K_SCS_5M1;scs_diag] +THEN ARITH_TAC);; + +let SCS_DIAG_SCS_5M1_03=prove(`scs_diag (scs_k_v39 scs_5M1) 0 3`, +REWRITE_TAC[K_SCS_5M1;scs_diag] +THEN ARITH_TAC);; + +let SCS_DIAG_SCS_5M1_24=prove(`scs_diag (scs_k_v39 scs_5M1) 2 4`, +REWRITE_TAC[K_SCS_5M1;scs_diag] +THEN ARITH_TAC);; + + +let SCS_5M1_SLICE_02=prove_by_refinement( +`scs_arrow_v39 +{ scs_stab_diag_v39 scs_5M1 0 2} +{scs_prop_equ_v39 scs_3T4 2,scs_prop_equ_v39 scs_4M2 1}`, + +[ + + +MATCH_MP_TAC (GEN_ALL Lkgrqui.LKGRQUI) +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_5M1_02;STAB_5M1_SCS;SCS_K_D_A_STAB_EQ;] +THEN EXISTS_TAC`0` +THEN EXISTS_TAC`2` +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_5M1_02] +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ] +THEN REPEAT RESA_TAC; +REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ;scs_slice_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC scs_inj +THEN ASM_SIMP_TAC[SCS_5M1_BASIC;SCS_3T4_BASIC;J_SCS_4M2;BASIC_HALF_SLICE_STAB;J_SCS_3T4;D_HALF_SLICE;BAISC_PROP_EQU;K_SCS_PROP_EUQ;SCS_4M2_BASIC] +THEN STRIP_TAC; + + +ASM_SIMP_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_5M1] +THEN ARITH_TAC; +STRIP_TAC +THEN ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_5M1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_3T4;scs_3M1;scs_5M3; +ARITH_RULE`(2 + 1 + 5 - 0) MOD 5= 3/\ 0 MOD 5=0/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`2`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`2+x:num`;`2+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_4M2;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_5M1] +THEN ARITH_TAC; + + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_5M1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M2; +ARITH_RULE`(0+1 + 5 - 2) MOD 5= 4/\ 2 MOD 5=2/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 4<4==> x MOD 4=0\/ x MOD 4=1\/ x MOD 4=2\/ x MOD 4=3`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 4<4==> x' MOD 4=0\/ x' MOD 4=1\/ x' MOD 4=2\/x' MOD 4=3`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`0`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`1`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`2`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`3`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`0`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`1`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`2`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`3`;`1`][ARITH_RULE`~(4=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`1+x:num`;`1+x':num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[J_SCS_3T4]; +]);; + + + + +let CNICGSF3=prove(`scs_arrow_v39 +{ scs_stab_diag_v39 scs_5M1 0 2} +{scs_3T4, scs_4M2 }`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{ scs_prop_equ_v39 scs_3T4 2, scs_prop_equ_v39 scs_4M2 1}` +THEN ASM_REWRITE_TAC[SCS_5M1_SLICE_02;SET_RULE`{A,B}={A}UNION {B}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC +THENL[ + +MRESAS_TAC PRO_EQU_ID1[`scs_3T4`;`2`;`3`][SCS_3T4_IS_SCS;K_SCS_3T4;ARITH_RULE`(3 - 2 MOD 3)=1`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_3T4 2`;`1`][PROP_EQU_IS_SCS;SCS_3T4_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]; + +MRESAS_TAC PRO_EQU_ID1[`scs_4M2`;`1`;`4`][SCS_4M2_IS_SCS;K_SCS_4M2;ARITH_RULE`(4 - 1 MOD 4)=3`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_4M2 1`;`3`][PROP_EQU_IS_SCS;SCS_4M2_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]]);; + + +(********************) + +let SCS_5M1_SLICE_03=prove_by_refinement(`scs_arrow_v39 +{ scs_stab_diag_v39 scs_5M1 0 3} +{scs_prop_equ_v39 scs_4M4' 1,scs_prop_equ_v39 scs_3M1 1}`, +[ + +MATCH_MP_TAC (GEN_ALL Lkgrqui.LKGRQUI) +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_5M1_03;STAB_5M1_SCS;SCS_K_D_A_STAB_EQ;] +THEN EXISTS_TAC`0` +THEN EXISTS_TAC`3` +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_5M1_03] +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ] +THEN REPEAT RESA_TAC; + + +REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ;scs_slice_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC scs_inj +THEN ASM_SIMP_TAC[SCS_5M1_BASIC;SCS_3M1_BASIC;J_SCS_4M4;BASIC_HALF_SLICE_STAB;J_SCS_3M1;D_HALF_SLICE;BAISC_PROP_EQU;K_SCS_PROP_EUQ;SCS_4M4_BASIC] +THEN STRIP_TAC; + + + +ASM_SIMP_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_4M4;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_5M1] +THEN ARITH_TAC; + + + + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_5M1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M4; +ARITH_RULE`(3+1 + 5 - 0) MOD 5= 4/\ 0 MOD 5=0/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 4<4==> x MOD 4=0\/ x MOD 4=1\/ x MOD 4=2\/ x MOD 4=3`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 4<4==> x' MOD 4=0\/ x' MOD 4=1\/ x' MOD 4=2\/x' MOD 4=3`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`0`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`1`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`2`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`3`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`0`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`1`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`2`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`3`;`1`][ARITH_RULE`~(4=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`1+x:num`;`1+x':num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1/\ 3+1=4`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + + + +ASM_SIMP_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3M1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_5M1] +THEN ARITH_TAC; + + + + + +STRIP_TAC +THEN ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_5M1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_3M1;scs_3M1;scs_5M3; +ARITH_RULE`(0 + 1 + 5 - 3) MOD 5= 3/\ 3 MOD 5=3/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`1+x:num`;`1+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + + + + + +SCS_TAC +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[J_SCS_4M4]; + +]);; + + + + + +let CNICGSF4=prove(`scs_arrow_v39 +{ scs_stab_diag_v39 scs_5M1 0 3} +{scs_4M4', scs_3M1 }`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{ scs_prop_equ_v39 scs_4M4' 1, scs_prop_equ_v39 scs_3M1 1}` +THEN ASM_REWRITE_TAC[SCS_5M1_SLICE_03;SET_RULE`{A,B}={A}UNION {B}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC +THENL[ +MRESAS_TAC PRO_EQU_ID1[`scs_4M4'`;`1`;`4`][SCS_4M4_IS_SCS;K_SCS_4M4;ARITH_RULE`(4 - 1 MOD 4)=3`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_4M4' 1`;`3`][PROP_EQU_IS_SCS;SCS_4M4_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]; + +MRESAS_TAC PRO_EQU_ID1[`scs_3M1`;`1`;`3`][SCS_3M1_IS_SCS;K_SCS_3M1;ARITH_RULE`(3 - 1 MOD 3)=2`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_3M1 1`;`2`][PROP_EQU_IS_SCS;SCS_3M1_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]; +]);; + + + +(*****************************) + + + + + + + + +let SCS_5M1_SLICE_24=prove_by_refinement(`scs_arrow_v39 +{ scs_stab_diag_v39 scs_5M1 2 4} +{scs_prop_equ_v39 scs_3M1 1,scs_prop_equ_v39 scs_4M5' 1}`, +[ + +MATCH_MP_TAC (GEN_ALL Lkgrqui.LKGRQUI) +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_5M1_24;STAB_5M1_SCS;SCS_K_D_A_STAB_EQ;] +THEN EXISTS_TAC`2` +THEN EXISTS_TAC`4` +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_5M1_24] +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ] +THEN REPEAT RESA_TAC; + + + +REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ;scs_slice_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC scs_inj +THEN ASM_SIMP_TAC[SCS_5M1_BASIC;SCS_3M1_BASIC;J_SCS_4M5;BASIC_HALF_SLICE_STAB;J_SCS_3M1;D_HALF_SLICE;BAISC_PROP_EQU;K_SCS_PROP_EUQ;SCS_4M5_BASIC] +THEN STRIP_TAC; + + + + +ASM_SIMP_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3M1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_5M1] +THEN ARITH_TAC; + + + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_5M1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_3M1;scs_3M1;scs_5M3; +ARITH_RULE`(4 + 1 + 5 - 2) MOD 5= 3/\ 2 MOD 5=2/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`1+x:num`;`1+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + + +ASM_SIMP_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_4M5;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_5M1] +THEN ARITH_TAC; + + + + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_5M1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M4; +ARITH_RULE`(2+1 + 5 - 4) MOD 5= 4/\ 4 MOD 5=4/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 4<4==> x MOD 4=0\/ x MOD 4=1\/ x MOD 4=2\/ x MOD 4=3`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 4<4==> x' MOD 4=0\/ x' MOD 4=1\/ x' MOD 4=2\/x' MOD 4=3`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`0`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`1`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`2`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`3`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`0`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`1`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`2`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`3`;`1`][ARITH_RULE`~(4=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`1+x:num`;`1+x':num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1/\ 2+4=6/\ 3+4=7/\ 7 MOD 5=2`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + + + +SCS_TAC +THEN REAL_ARITH_TAC; + + + +SCS_TAC +THEN REAL_ARITH_TAC; + + + +SCS_TAC +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[J_SCS_3M1]; + +]);; + + + + + +let CNICGSF5=prove(`scs_arrow_v39 +{ scs_stab_diag_v39 scs_5M1 2 4} +{ scs_3M1, scs_4M5' }`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{ scs_prop_equ_v39 scs_3M1 1,scs_prop_equ_v39 scs_4M5' 1}` +THEN ASM_REWRITE_TAC[SCS_5M1_SLICE_24;SET_RULE`{A,B}={A}UNION {B}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC +THENL[ +MRESAS_TAC PRO_EQU_ID1[`scs_3M1`;`1`;`3`][SCS_3M1_IS_SCS;K_SCS_3M1;ARITH_RULE`(3 - 1 MOD 3)=2`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_3M1 1`;`2`][PROP_EQU_IS_SCS;SCS_3M1_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]; + +MRESAS_TAC PRO_EQU_ID1[`scs_4M5'`;`1`;`4`][SCS_4M5_IS_SCS;K_SCS_4M5;ARITH_RULE`(4 - 1 MOD 4)=3`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_4M5' 1`;`3`][PROP_EQU_IS_SCS;SCS_4M5_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[];]);; + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/CQAOQLR.hl b/text_formalization/local/CQAOQLR.hl new file mode 100644 index 0000000..d833e41 --- /dev/null +++ b/text_formalization/local/CQAOQLR.hl @@ -0,0 +1,335 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Cqaoqlr = struct + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +open Yxionxl2;; +open Eyypqdw;; +open Ocbicby;; +open Imjxphr;; + +open Nuxcoea;; +open Aursipd;; +open Cuxvzoz;; +open Rrcwnsj;; +open Tfitskc;; + + + +let K_SUC_2_MOD_SUB=prove(`1 (k - SUC ((i + 2) MOD k) + 1) MOD k= (k- SUC((i+1) MOD k)) MOD k`, +SIMP_TAC[GSYM ADD1;] +THEN STRIP_TAC +THEN ASM_SIMP_TAC [SUC_MOD_EQ_MOD_SUC;ARITH_RULE`1 SUC (k - SUC ((i + 2) MOD k)) = k- (i+2) MOD k`;ARITH_RULE`i+2=SUC(SUC i)`]);; + +let K_SUC_2_MOD_SUB_ID=prove(`1 (k - SUC ((i + 2) MOD k) + 2) MOD k= (k- SUC((i) MOD k)) MOD k`, +SIMP_TAC[GSYM ADD1;] +THEN STRIP_TAC +THEN ASM_SIMP_TAC [SUC_MOD_EQ_MOD_SUC;ARITH_RULE`1 SUC (k - SUC ((i + 2) MOD k)) = k- (i+2) MOD k`;ARITH_RULE`i+2=SUC(SUC i)` +] +THEN MRESA_TAC SUC_MOD_EQ_MOD_SUC[`SUC i`;`k`] +THEN MRESA_TAC MOD_SUC_MOD[`k - SUC (SUC i) MOD k`;`k`] +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_SUC_MOD[`k - SUC (SUC i MOD k)`;`k`] +THEN ASM_SIMP_TAC[ARITH_RULE`1SUC (k - SUC (SUC i MOD k))=k - SUC i MOD k`] +);; + +let A_B_J_SCS_OPP=prove(`scs_a_v39 (scs_opp_v39 s) i j = scs_a_v39 s (scs_k_v39 s- SUC(i MOD scs_k_v39 s)) (scs_k_v39 s- SUC(j MOD scs_k_v39 s)) +/\ scs_b_v39 (scs_opp_v39 s) i j = scs_b_v39 s (scs_k_v39 s- SUC(i MOD scs_k_v39 s)) (scs_k_v39 s- SUC(j MOD scs_k_v39 s)) +/\ scs_J_v39 (scs_opp_v39 s) i j = scs_J_v39 s (scs_k_v39 s- SUC(i MOD scs_k_v39 s)) (scs_k_v39 s- SUC(j MOD scs_k_v39 s))`, +REWRITE_TAC[scs_opp_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;peropp2]);; + +let SUC_OPP_ID=prove(`1 SUC (k - SUC i MOD k) MOD k= (k- i MOD k) MOD k`, +STRIP_TAC +THEN MRESA_TAC SUC_MOD_EQ_MOD_SUC[`(i)`;`k`] +THEN MRESA_TAC MOD_SUC_MOD[`k - SUC (i) MOD k`;`k`] +THEN MRESA_TAC MOD_SUC_MOD[`SUC(k - SUC ( i) MOD k)`;`k`] +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_SUC_MOD[`k - SUC (i MOD k)`;`k`] +THEN MRESA_TAC MOD_SUC_MOD[`SUC(k - SUC (i MOD k))`;`k`] +THEN ASM_SIMP_TAC[ARITH_RULE`1SUC (k - SUC (i MOD k))=k - i MOD k`]);; + + + + +let K_SUC_2_MOD_F_SUB_ID=prove(`1 (k - SUC ((i + 2) MOD k) + 3) MOD k= (k- SUC((i+k-1) MOD k)) MOD k`, +SIMP_TAC[GSYM ADD1;] +THEN STRIP_TAC +THEN ASM_SIMP_TAC [SUC_MOD_EQ_MOD_SUC;ARITH_RULE`1 SUC (k - SUC ((i + 2) MOD k)) = k- (i+2) MOD k`;ARITH_RULE`i+2=SUC(SUC i)/\ i+3=SUC(i+2)` +] +THEN MRESA_TAC SUC_MOD_EQ_MOD_SUC[`(SUC i)`;`k`] +THEN MRESA_TAC MOD_SUC_MOD[`k - SUC (SUC i) MOD k`;`k`] +THEN MRESA_TAC MOD_SUC_MOD[`SUC(k - SUC (SUC i) MOD k)`;`k`] +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_SUC_MOD[`k - SUC (SUC i MOD k)`;`k`] +THEN MRESA_TAC MOD_SUC_MOD[`SUC(k - SUC (SUC i MOD k))`;`k`] +THEN ASM_SIMP_TAC[ARITH_RULE`1SUC (k - SUC (SUC i MOD k))=k - SUC i MOD k/\ SUC (i + k - 1)= 1*k+i`;SUC_OPP_ID;MOD_MULT_ADD]);; + +let ELEMENT1_SYM_0=prove(`{--a}= IMAGE (\x:real^N. --x) {a}`, +REWRITE_TAC[IMAGE;IN_ELIM_THM;EXTENSION;IN_SING;SET_RULE`a IN{b,c} <=> a=b\/ a=c`] +THEN GEN_TAC +THEN EQ_TAC +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[VECTOR_ARITH`(--a= --b)<=> (a=b:real^N)`] +THEN SET_TAC[]);; + +let SCS_GENERIC_SYM_0=prove(`BBs_v39 s v/\ is_scs_v39 s/\ scs_generic v +==> scs_generic (\i. --v (scs_k_v39 s - SUC (i MOD scs_k_v39 s)))`, +REWRITE_TAC[scs_generic;BBs_v39;is_scs_v39;LET_DEF;LET_END_DEF;] +THEN REPEAT RESA_TAC +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN ABBREV_TAC`V=(IMAGE (v:num->real^3) (:num))` +THEN ABBREV_TAC`E=(IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num))` +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)/\ 1real^3) i) (:num)`][IMAGE_V_SYM_0;REFL_SYM_0] +THEN MRESAL_TAC IMAGE_E_SYM_0[`{v',w}`;`v:num->real^3`][GSYM ELEMENT2_SYM_0] +THEN THAYTHES_TAC (33-24)[`-- v':real^3`;`-- w:real^3`;`-- u:real^3`][ ELEMENT2_SYM_0;AFF_GE_VEC0_SYM_0;AFF_LT_VEC0_SYM_0;ELEMENT1_SYM_0;GSYM INTER_SYM_0] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC SET_EQ_SYM_0[`IMAGE (\x:real^3. --x) (aff_ge {vec 0:real^3} {v', w} INTER aff_lt {vec 0} {u})`;`{}:real^3->bool`][REFL_SYM_0;IMAGE_CLAUSES]);; + +let UNADORNED_OPP=prove(`is_scs_v39 s /\ unadorned_v39 s +==> unadorned_v39 (scs_opp_v39 s)`, +REWRITE_TAC[LET_DEF;LET_END_DEF;unadorned_v39;scs_opp_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;peropp;EXTENSION;IN] +THEN RESA_TAC +THEN SET_TAC[]);; + +let BASIC_OPP=prove(`is_scs_v39 s /\ scs_basic_v39 s +==> scs_basic_v39 (scs_opp_v39 s)`, +SIMP_TAC[scs_basic;UNADORNED_OPP;A_B_J_SCS_OPP]);; + + +let DIAG_OPP=prove_by_refinement(`3 scs_diag k (k - SUC (i MOD k)) (k - SUC (j MOD k))`, +[REWRITE_TAC[scs_diag] +THEN REPEAT RESA_TAC; + +DICH_TAC 3 +THEN REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC OPP_SUC_MOD[`i`;`k`] +THEN MRESA_TAC OPP_SUC_MOD[`j`;`k`]; + +DICH_TAC 1 +THEN REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1 ASSUME_TAC(SYM th)) +THEN REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1 (!s (v:num->real^3) i. + 3< scs_k_v39 s/\ + is_scs_v39 s /\ v IN MMs_v39 s /\ scs_generic v /\ scs_basic_v39 s /\ + (!i j. scs_diag (scs_k_v39 s) i j ==> (scs_a_v39 s i j <= cstab /\ cstab < dist(v i, v j)/\ &4 * h0 < scs_b_v39 s i j)) /\ + &2< scs_b_v39 s i (i+1) /\ &2< scs_b_v39 s (i+1) (i+2)/\ +scs_a_v39 s (i+2) (i+3)< scs_b_v39 s (i+2) (i+3) /\ +scs_a_v39 s (i+ scs_k_v39 s -1) i< scs_b_v39 s (i+scs_k_v39 s -1) i +==> + scs_a_v39 s (i) (i+1) = &2 /\ scs_b_v39 s (i) (i+1) <= &2 * h0 /\ + scs_a_v39 s (i+1) (i+2) = &2 /\ scs_b_v39 s (i+1) (i+2) <= &2 * h0 ==> + (dist(v i,v (i+1)) = &2 <=> dist(v(i+1),v(i+2)) = &2))`;; + +let CQAOQLR = prove_by_refinement( CQAOQLR_concl, +[ +REPEAT STRIP_TAC +THEN EQ_TAC; + +STRIP_TAC +THEN MP_TAC TFITSKC +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN EXISTS_TAC`s:scs_v39` +THEN ASM_REWRITE_TAC[]; + +ASM_TAC +THEN REWRITE_TAC[IN] +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN ABBREV_TAC`V=(IMAGE (v:num->real^3) (:num))` +THEN ABBREV_TAC`E=(IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num))` +THEN ABBREV_TAC`FF=IMAGE (\i. ((v:num->real^3) i, v (SUC i))) (:num)` +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k<=3)/\ 1real^3) k i)`;`k- SUC((i+2) MOD k)`][IN] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[peropp;OPP_SUC_MOD;K_SUC_2_MOD_SUB;K_SUC_2_MOD_SUB_ID;DIST_SYM_0;K_SCS_OPP;A_B_J_SCS_OPP;K_SUC_2_MOD_F_SUB_ID] +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MP_TAC SCS_GENERIC_SYM_0 +THEN RESA_TAC +THEN MP_TAC BASIC_OPP +THEN RESA_TAC +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`(i+1) MOD k`;`v:num->real^3`;`i+1`][MOD_REFL;] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`i MOD k`;`v:num->real^3`;`i`][MOD_REFL;] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`(i+2) MOD k`;`v:num->real^3`;`i+2`][MOD_REFL;] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`(i+1) MOD k`;`i MOD k `;`s:scs_v39`;`i+1`;`i`][MOD_REFL] +THEN MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`(i+1) MOD k`;`i MOD k `;`s:scs_v39`;`i+1`;`i`][MOD_REFL] +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`(i) MOD k`;`(i+k-1) MOD k `;`s:scs_v39`;`i`;`i+k-1`][MOD_REFL] +THEN MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`(i) MOD k`;`(i+k-1) MOD k `;`s:scs_v39`;`i`;`i+k-1`][MOD_REFL] +THEN MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`(i+2) MOD k`;`(i+1) MOD k `;`s:scs_v39`;`i+2`;`i+1`][MOD_REFL] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MATCH_DICH_TAC 0 +THEN STRIP_TAC; + +ASM_TAC +THEN REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF;] +THEN REPEAT RESA_TAC; + +STRIP_TAC; + +ASM_TAC +THEN REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF;] +THEN REPEAT RESA_TAC; + +STRIP_TAC; + +ASM_TAC +THEN REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF;] +THEN REPEAT RESA_TAC; + +STRIP_TAC; + +ASM_TAC +THEN REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF;] +THEN REPEAT RESA_TAC; + +REPEAT GEN_TAC +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MATCH_DICH_TAC(36-6) +THEN MATCH_MP_TAC DIAG_OPP +THEN ASM_REWRITE_TAC[]]);; + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/CUXVZOZ.hl b/text_formalization/local/CUXVZOZ.hl new file mode 100644 index 0000000..e6a6895 --- /dev/null +++ b/text_formalization/local/CUXVZOZ.hl @@ -0,0 +1,5105 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Section: Appendix, Main Estimate, check_completeness *) +(* Chapter: Local Fan *) +(* Lemma: CUXVZOZ *) +(* Author: Thomas Hales *) +(* Date: 2013-07-22 *) +(* ========================================================================== *) + + + +module Cuxvzoz = struct + + open Hales_tactic;; + +let LET_THM = CONJ LET_DEF LET_END_DEF;; + +let VV_SUC_EQ_IVS_RHO_NODE_PRIME = prove_by_refinement( + `!V E FF s vv u k p1. + scs_k_v39 s = k /\ + vv p1 = u /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF /\ + is_scs_v39 s /\ + ~(k <= 3) /\ + BBs_v39 s vv + ==> (ivs_rho_node1 FF u = vv (p1 + (k-1)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Appendix.BBs_v39 [`s`;`vv`]; + ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;Terminal.IMAGE_SUBSET_IN;IN_UNIV]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. vv i IN V` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + EXPAND_TAC "V"; + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + TYPIFY `ivs_rho_node1 FF u IN V` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas1.LOCAL_FAN_IVS_IN_V; + BY(ASM_MESON_TAC[]); + TYPIFY `rho_node1 FF (ivs_rho_node1 FF u) = rho_node1 FF (vv (p1 + k - 1))` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[Polar_fan.RHO_NODE1_INJECTIVE]); + GMATCH_SIMP_TAC Local_lemmas1.LOCAL_FAN_RHO_NODE_IVS; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + INTRO_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME) [`V`;`E`;`k`;`s`;`FF`;`vv (p1+(k-1))`;`vv`;`p1 + (k-1)`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (C INTRO_TAC [`1`]); + REWRITE_TAC[ITER_1]; + DISCH_THEN SUBST1_TAC; + ASM_SIMP_TAC[arith `~(k <= 3) ==> 1 + p1 + k - 1 = p1 + k`]; + BY(ASM_MESON_TAC[Oxl_def.periodic]) + ]);; + (* }}} *) + +let PQCSXWG1_SYM = prove_by_refinement( + `!v0 v1 v2 v3 x1 x2 x3 x4 x5 x6. + &0 < x1 /\ + &0 < x2 /\ + &0 < x3 /\ + &0 < x4 /\ + &0 < x5 /\ + &0 < x6 /\ + ~collinear {v0, v1, v2} /\ + x1 = dist (v1,v0) pow 2 /\ + x2 = dist (v2,v0) pow 2 /\ + x6 = dist (v1,v2) pow 2 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 /\ + v3 = mk_simplex1 v0 v2 v1 x2 x1 x3 x5 x4 x6 + ==> x3 = dist (v3,v0) pow 2 /\ + x5 = dist (v3,v1) pow 2 /\ + x4 = dist (v3,v2) pow 2 /\ + (v2 - v0) dot ((v1 - v0) cross (v3 - v0)) > &0`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Pqcsxwg.PQCSXWG1 [`v0`;`v2`;`v1`;`v3`;`x2`;`x1`;`x3`;`x5`;`x4`;`x6`]; + ASM_TAC THEN REWRITE_TAC[DIST_SYM] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + RULE_ASSUM_TAC(ONCE_REWRITE_RULE[EQ_SYM_EQ]); + ASM_REWRITE_TAC[]; + ANTS_TAC; + CONJ_TAC; + FIRST_X_ASSUM_ST `collinear` MP_TAC; + MATCH_MP_TAC (TAUT `(a = b) ==> (a ==> b)`); + REPEAT AP_TERM_TAC; + BY(SET_TAC[]); + FIRST_X_ASSUM_ST `delta_x` MP_TAC; + BY(MESON_TAC[Merge_ineq.delta_x_sym]); + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let homog_2x2 = prove_by_refinement( + `!a b c d x y. ~(a*d - b*c = &0) /\ a * x + b * y = &0 /\ c * x + d * y = &0 ==> (x = &0 /\ y = &0)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `d * (a * x + b * y) - b* (c * x + d*y) = &0 /\ a * (c * x + d *y) - c * (a * x + b* y) = &0` (C SUBGOAL_THEN MP_TAC); + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + TYPIFY_GOAL_THEN `d * (a * x + b * y) - b * (c * x + d * y) = (a*d-b*c)*x /\ a * (c * x + d *y) - c * (a * x + b* y) = (a*d-b*c)* y` (unlist REWRITE_TAC); + BY(REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[REAL_ENTIRE]) + ]);; + (* }}} *) + +let simplex_unique = prove_by_refinement( + `!v0 v1 v2 v3 v3'. + ~collinear {v0,v1,v2} /\ + dist(v0,v3) = dist(v0,v3') /\ + dist(v1,v3) = dist(v1,v3') /\ + dist(v2,v3) = dist(v2,v3') /\ + re_eqvl ((v3 - v0) dot ((v1 - v0) cross (v2 - v0))) ((v3' - v0) dot ((v1 - v0) cross (v2 - v0))) ==> + (v3 = v3')`, + (* {{{ proof *) + [ + GEOM_ORIGIN_TAC `v0:real^3` THEN REPEAT GEN_TAC; + REWRITE_TAC[VECTOR_SUB_RZERO]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GEN_ALL Local_lemmas.NOT_COLL_IMP_COPL) [`v1`;`v2`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC Trigonometry2.NONCOPLANAR_3_BASIS [`v1`;`v2`;`v1 cross v2`;`(vec 0):real^3`;`v3`]; + INTRO_TAC Trigonometry2.NONCOPLANAR_3_BASIS [`v1`;`v2`;`v1 cross v2`;`(vec 0):real^3`;`v3'`]; + ASM_REWRITE_TAC[VECTOR_SUB_RZERO]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(v1 cross v2 = vec 0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_REWRITE_TAC[CROSS_EQ_0]); + TYPIFY `~((v1 cross v2) dot (v1 cross v2) = &0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_REWRITE_TAC[DOT_EQ_0]); + TYPIFY `!a1 a2 a3. (a1 % v1 + a2 % v2 + a3 % (v1 cross v2)) dot (v1 cross v2) = a3 * ((v1 cross v2) dot (v1 cross v2))` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[DOT_LADD;DOT_LMUL;DOT_CROSS_SELF]; + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `re_eqvl` MP_TAC; + ASM_REWRITE_TAC[Trigonometry2.re_eqvl;REAL_ENTIRE;arith `t3' * u = t * t3 * u <=> (t3' - t * t3) * u = &0`;arith `t3' - t *t3 = &0 <=> t3' = t * t3`]; + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + TYPIFY `t1' = t1 /\ t2' = t2` ENOUGH_TO_SHOW_TAC; + DISCH_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + TYPIFY `norm v3 pow 2 = norm v3' pow 2` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[DIST_0]); + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `(a:real^3) + b + c = (a + b) + c`]; + TYPED_ABBREV_TAC `a = t1 % v1 + t2 % v2`; + REPEAT (GMATCH_SIMP_TAC NORM_ADD_PYTHAGOREAN ); + EXPAND_TAC "a"; + REWRITE_TAC[CONJ_ASSOC]; + CONJ_TAC; + BY(REWRITE_TAC[orthogonal] THEN VEC3_TAC); + REWRITE_TAC[arith `a +b = a + c <=> b = c`]; + REWRITE_TAC[NORM_MUL;arith `(a * b) pow 2 = a pow 2 * b pow 2`;arith `abs t pow 2 = t pow 2`]; + REWRITE_TAC[NORM_POW_2]; + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + ASM_REWRITE_TAC[REAL_ENTIRE;arith `t3' * u = (t * t3) * u <=> (t3' - t * t3) * u = &0`;arith `t3' - t *t3 = &0 <=> t3' = t * t3`]; + REWRITE_TAC[REAL_ENTIRE;arith `a = b * a <=> (b - &1) * (a) = &0`;arith `a - &1 = &0 <=> a = &1`;ABS_SQUARE_EQ_1;Trigonometry2.POW2_EQ_0]; + GMATCH_SIMP_TAC (arith `&0 < t ==> (abs t = &1 <=> t = &1)`); + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `t3' = t3` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM DISJ_CASES_TAC; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + BY(ASM_MESON_TAC[]); + COMMENT "down to t1 and t2"; + TYPED_ABBREV_TAC `x3 = dist(v3,vec 0) pow 2`; + TYPED_ABBREV_TAC `x5 = dist(v3,v1) pow 2`; + TYPED_ABBREV_TAC ` x4 = dist(v3,v2) pow 2`; + TYPIFY `!a1 a2 a3. (let u = a1 % v1 + a2 % v2 + a3 % (v1 cross v2) in (dist(vec 0,v3) = dist(vec 0,u) /\ dist(v1,v3) = dist(v1,u) /\ dist(v2,v3) = dist(v2,u) ==> ((v1 dot v1) * a1 + (v1 dot v2) * a2 = ((v1 dot v1) + x3 - x5) / &2 /\ ((v1 dot v2) * a1 + (v2 dot v2) * a2 = ((v2 dot v2) + x3 - x4) / &2))))` ENOUGH_TO_SHOW_TAC; + DISCH_TAC; + FIRST_ASSUM (C INTRO_TAC [`t1`;`t2`;`t3`]); + FIRST_X_ASSUM (C INTRO_TAC [`t1'`;`t2'`;`t3'`]); + REWRITE_TAC[LET_DEF;LET_END_DEF]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + TYPIFY `(v1 dot v1) * (t1-t1') + (v1 dot v2) * (t2-t2') = &0 /\ (v1 dot v2) * (t1-t1') + (v2 dot v2) * (t2-t2') = &0` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + ONCE_REWRITE_TAC[arith `a = b <=> b - a = &0`]; + MATCH_MP_TAC homog_2x2; + GEXISTL_TAC [ `(v1 dot v1)`;`(v1 dot v2)`;`(v1 dot v2)`;`(v2 dot v2)`]; + ASM_REWRITE_TAC[]; + TYPIFY `(v1 dot v1) * (v2 dot v2) - (v1 dot v2) * (v1 dot v2) = (v1 cross v2) dot (v1 cross v2)` (C SUBGOAL_THEN ASSUME_TAC); + ONCE_REWRITE_TAC[CROSS_TRIPLE]; + BY(VEC3_TAC); + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + MAP_EVERY EXPAND_TAC ["x3";"x4";"x5"]; + REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[DIST_SYM] THEN REPEAT (FIRST_X_ASSUM_ST `%` kill) THEN REPEAT (FIRST_X_ASSUM_ST `dist` kill) THEN REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[DIST_SYM]; + REWRITE_TAC[dist;VECTOR_SUB_RZERO]; + REWRITE_TAC[VECTOR_ARITH `(a + x % b + c) - b:real^N = a + (x - &1) % b + c`; VECTOR_ARITH `(x % a + b + c) - a:real^N = (x - &1) % a + b + c`]; + SUBGOAL_THEN `!a b c. norm(a % v1 + b % v2 + c % (v1 cross v2)) pow 2 = norm(a % v1 + b % v2) pow 2 + norm(c % (v1 cross v2)) pow 2` (unlist REWRITE_TAC); + REPEAT GEN_TAC THEN REWRITE_TAC[arith `(a:real^3) + b + c = (a + b) + c`]; + TYPED_ABBREV_TAC `u = a % v1 + b % v2`; + REPEAT (GMATCH_SIMP_TAC NORM_ADD_PYTHAGOREAN ); + EXPAND_TAC "u"; + BY(REWRITE_TAC[orthogonal] THEN VEC3_TAC); + REWRITE_TAC[GSYM DOT_SQUARE_NORM;DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL]; + REWRITE_TAC[DOT_SYM]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let re_eqvl_pos_pos = prove_by_refinement( + `!a b. &0 < a /\ &0 < b ==> re_eqvl a b`, + (* {{{ proof *) + [ + REWRITE_TAC[Trigonometry2.re_eqvl]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `a/b` EXISTS_TAC; + GMATCH_SIMP_TAC REAL_LT_DIV; + ASM_REWRITE_TAC[]; + Calc_derivative.CALC_ID_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let mk_simplex_uniq = prove_by_refinement( + `!v0 v1 v2 v3. + ~coplanar {v0,v1,v2,v3} /\ + (v1 - v0) dot ((v2 - v0) cross (v3 - v0)) > &0 ==> + mk_simplex1 v0 v1 v2 (dist(v0,v1) pow 2) (dist(v0,v2) pow 2) (dist(v0,v3) pow 2) + (dist(v2,v3) pow 2) (dist (v1,v3) pow 2) (dist (v1,v2) pow 2) = v3`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC simplex_unique; + GEXISTL_TAC [`v0`;`v1`;`v2`]; + TYPED_ABBREV_TAC `v3' = mk_simplex1 v0 v1 v2 (dist(v0,v1) pow 2) (dist(v0,v2) pow 2) (dist(v0,v3) pow 2) (dist(v2,v3) pow 2) (dist (v1,v3) pow 2) (dist (v1,v2) pow 2)`; + INTRO_TAC Pqcsxwg.PQCSXWG1 [`v0`;`v1`;`v2`;`v3'`;`(dist(v0,v1) pow 2)`;`(dist(v0,v2) pow 2)`;`(dist(v0,v3) pow 2)`;`(dist(v2,v3) pow 2) `;`(dist (v1,v3) pow 2)`;` (dist (v1,v2) pow 2)`]; + ASM_REWRITE_TAC[DIST_SYM]; + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + REWRITE_TAC[DIST_EQ_0]; + TYPIFY `~collinear {v0,v1,v2}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR; + BY(ASM_MESON_TAC[]); + TYPIFY_GOAL_THEN `~(v0 = v1) /\ ~(v0 = v2) /\ ~(v0 = v3) /\ ~(v2 = v3) /\ ~(v1 = v3) /\ ~(v1 = v2)` (unlist REWRITE_TAC); + BY(ASM_MESON_TAC[Planarity.notcoplanar_disjoint]); + ASM_REWRITE_TAC[]; + ANTS_TAC; + REWRITE_TAC[GSYM Sphere.delta_y;arith `x pow 2 = x*x`]; + BY(ASM_MESON_TAC[Oxlzlez.coplanar_delta_y]); + REPEAT (GMATCH_SIMP_TAC (GSYM Collect_geom.EQ_POW2_COND)); + REWRITE_TAC[DIST_POS_LE]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC re_eqvl_pos_pos; + REPEAT (FIRST_X_ASSUM_ST `cross` MP_TAC); + MATCH_MP_TAC (arith `a = b /\ c = d ==> (a > &0 ==> c > &0 ==> &0 < d /\ &0 < b)`); + BY(VEC3_TAC) + ]);; + (* }}} *) + +let continuous_nbd_pos = prove_by_refinement( + `!f t. f real_continuous atreal t /\ &0 < f t ==> + (?e. &0 < e /\ (!t'. abs (t' - t) < e ==> &0 < f t'))`, + (* {{{ proof *) + [ + REWRITE_TAC[real_continuous_atreal]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`f t`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `d` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t'`]); + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let epsilon_pair = prove_by_refinement( + `!e e'. &0 < e /\ &0 < e' ==> (?e''. &0 < e'' /\ (!t. abs t < e'' ==> abs t < e) /\ (!t. abs t < e'' ==> abs t < e'))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `if e <= e' then e else e'` EXISTS_TAC; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(CONJ_TAC THEN REPEAT WEAKER_STRIP_TAC THEN ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let epsilon_triple = prove_by_refinement( + `!e e' e''. &0 < e /\ &0 < e' /\ &0 < e'' ==> (?e'''. &0 < e''' /\ (!t. abs t < e''' ==> abs t < e) /\ (!t. abs t < e''' ==> abs t < e') /\ (!t. abs t < e''' ==> abs t < e''))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e`;`e'`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e''`;`e'''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''''` EXISTS_TAC; + BY(ASM_REWRITE_TAC[] THEN REPEAT CONJ_TAC THEN REPEAT WEAKER_STRIP_TAC THEN (REPEAT (FIRST_X_ASSUM MATCH_MP_TAC)) THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let epsilon_quad = prove_by_refinement( + `!e e' e'' e'''. &0 < e /\ &0 < e' /\ &0 < e'' /\ &0 < e''' ==> (?e''''. &0 < e'''' /\ (!t. abs t < e'''' ==> abs t < e) /\ (!t. abs t < e'''' ==> abs t < e') /\ (!t. abs t < e'''' ==> abs t < e'') /\ (!t. abs t < e'''' ==> abs t < e'''))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_triple [`e`;`e'`;`e''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e'''`;`e''''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e'''''` EXISTS_TAC; + BY(ASM_REWRITE_TAC[] THEN REPEAT CONJ_TAC THEN REPEAT WEAKER_STRIP_TAC THEN (REPEAT (FIRST_X_ASSUM MATCH_MP_TAC)) THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let deform_simplex_decrease_edge23 = prove_by_refinement( + `!V g01 g12 v0 v1 v2 e. + ( + let f = (\ w t. if w = v1 then + mk_simplex1 (vec 0) v2 v0 (norm v2 pow 2) (norm v0 pow 2) (norm v1 pow 2) + ((dist(v0,v1)+g01 t) pow 2) ((dist(v2,v1) + g12 t) pow 2) (dist(v0,v2) pow 2) else w) in + (~coplanar {vec 0,v0,v1,v2} /\ v1 dot (v2 cross v0) > &0 /\ &0 < e /\ + g01 real_continuous_on (real_interval (--e,e)) /\ + g12 real_continuous_on (real_interval (--e,e)) /\ + g01 (&0) = &0 /\ g12 (&0) = &0 + ==> + (?e'. &0 < e' /\ deformation f V (-- e', e') /\ + (!v t. ~(v = v1) ==> f v t = v) /\ + (!t. abs t < e' ==> + dist(v0,f v1 t) = dist(v0,v1) + g01 t /\ + dist(v2,f v1 t) = dist(v2,v1) + g12 t /\ + norm(f v1 t) = norm(v1)))))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REPEAT LET_TAC; + REWRITE_TAC[Localization.deformation]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `{vec 0,v2,v0,v1} = { vec 0,v0,v1,v2} /\ {vec 0, v0, v2, v1} = {vec 0,v0,v1,v2}` (C SUBGOAL_THEN ASSUME_TAC); + BY(SET_TAC[]); + COMMENT "easy continuity"; + TYPIFY `&0 IN real_interval( --e,e)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[IN_REAL_INTERVAL]; + BY(ASM_SIMP_TAC[arith `&0 < e ==> --e < &0`]); + TYPIFY `g01 real_continuous atreal (&0) /\ g12 real_continuous atreal (&0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT;Ocbicby.REAL_OPEN_REAL_INTERVAL]); + TYPIFY `(\t. delta_x (norm v2 pow 2) (norm v0 pow 2) (norm v1 pow 2) ((dist(v0,v1)+g01 t) pow 2) ((dist(v2,v1) + g12 t) pow 2) (dist(v0,v2) pow 2)) real_continuous atreal (&0)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[Sphere.delta_x]; + BY(REPEAT (ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST] THEN REPEAT CONJ_TAC THEN (MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB))); + TYPIFY `&0 < delta_x (norm v2 pow 2) (norm v0 pow 2) (norm v1 pow 2) ((dist (v0,v1)) pow 2) ((dist (v2,v1)) pow 2) (dist (v0,v2) pow 2)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM Sphere.delta_y;arith `x pow 2 = x*x`;GSYM DIST_0]; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,d,b,c}`]; + REWRITE_TAC[ Oxlzlez.coplanar_delta_y]; + BY(REWRITE_TAC[DIST_SYM]); + TYPIFY `?e1. &0 < e1 /\ (!t. abs t < e1 ==> &0 < delta_x (norm v2 pow 2) (norm v0 pow 2) (norm v1 pow 2) ((dist(v0,v1)+g01 t) pow 2) ((dist(v2,v1) + g12 t) pow 2) (dist(v0,v2) pow 2))` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `real_continuous` MP_TAC; + REWRITE_TAC[real_continuous_atreal]; + DISCH_THEN (C INTRO_TAC [`delta_x (norm v2 pow 2) (norm v0 pow 2) (norm v1 pow 2) ((dist (v0,v1)) pow 2) ((dist (v2,v1)) pow 2) (dist (v0,v2) pow 2)`]); + ASM_REWRITE_TAC[arith `abs(x - &0) = abs x`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `d` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[arith `x + &0 = x`]; + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM MP_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `?e2. &0 < e2 /\ (!t. abs t < e2 ==> &0 < (dist (v0,v1) + g01 t) /\ &0 < ((dist (v2,v1) + g12 t) ))` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `(\t. (dist (v0,v1) + g01 t) ) real_continuous atreal (&0) /\ (\t. ((dist (v2,v1) + g12 t) )) real_continuous atreal (&0)` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC continuous_nbd_pos [`(\t. (dist (v0,v1) + g01 t) )`;`&0`]; + INTRO_TAC continuous_nbd_pos [`(\t. (dist (v2,v1) + g12 t) )`;`&0`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `x + &0 = x`]; + REWRITE_TAC[DIST_POS_LT]; + REWRITE_TAC[GSYM DIST_POS_LT]; + REWRITE_TAC[GSYM DIST_NZ]; + TYPIFY_GOAL_THEN `~(v2 = v1) /\ ~(v0 = v1)` (unlist REWRITE_TAC); + BY(ASM_MESON_TAC[Planarity.notcoplanar_disjoint]); + REWRITE_TAC[arith `abs (t' - &0) = abs t'`]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e'`;`e''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e'''` EXISTS_TAC; + BY(ASM_MESON_TAC[]); + BY(CONJ_TAC THEN REPEAT (ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST] THEN REPEAT CONJ_TAC THEN (MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB))); + FIRST_X_ASSUM MP_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY ` (!t. abs t < e2 ==> &0 < (dist (v0,v1) + g01 t) pow 2 /\ &0 < ((dist (v2,v1) + g12 t) pow 2 ))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + BY(ASM_SIMP_TAC[arith `&0 < x ==> ~(x = &0)`]); + INTRO_TAC epsilon_pair [`e1`;`e2`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + COMMENT "distances"; + TYPIFY `!t. abs t < e'' ==> norm v1 pow 2 = dist (f v1 t,vec 0) pow 2 /\ (dist (v0,v1) + g01 t) pow 2 = dist (f v1 t,v0) pow 2 /\ (dist (v2,v1) + g12 t) pow 2 = dist (f v1 t,v2) pow 2 /\ v2 dot (v0 cross f v1 t) > &0` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC PQCSXWG1_SYM [`(vec 0):real^3`;` v0 `;`v2`;`f v1 t`;` (norm v0 pow 2)`;` (norm v2 pow 2)`;`(norm v1 pow 2)`;` ((dist (v2,v1) + g12 t) pow 2)`;` ((dist (v0,v1) + g01 t) pow 2)`;` (dist (v0,v2) pow 2)`]; + REWRITE_TAC[VECTOR_SUB_RZERO]; + DISCH_THEN MATCH_MP_TAC; + ASM_SIMP_TAC[]; + REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; + EXPAND_TAC "f"; + BY(REWRITE_TAC[]); + CONJ2_TAC; + FIRST_X_ASSUM_ST `delta_x` (C INTRO_TAC [`t`]); + ASM_SIMP_TAC[]; + BY(MESON_TAC[Merge_ineq.delta_x_sym]); + REWRITE_TAC[DIST_0]; + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + REWRITE_TAC[GSYM DIST_0]; + REWRITE_TAC[DIST_EQ_0]; + CONJ_TAC; + BY(ASM_MESON_TAC[Planarity.notcoplanar_disjoint]); + MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR; + TYPIFY `v1` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + COMMENT "continuity"; + INTRO_TAC epsilon_pair [`e`;`e''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `!t. abs t < e''' /\ ~coplanar{vec 0,v0,f v1 t,v2} ==> f v1 continuous atreal t` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `g01 real_continuous atreal t /\ g12 real_continuous atreal t` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT (FIRST_X_ASSUM_ST `real_continuous_on` MP_TAC); + REPEAT (GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT); + REWRITE_TAC[ Ocbicby.REAL_OPEN_REAL_INTERVAL;IN_REAL_INTERVAL;arith `-- e < t /\ t < e <=> abs t < e`]; + BY(ASM_MESON_TAC[]); + INTRO_TAC Pqcsxwg.PQCSXWG2_ATREAL [`(\ (t:real). (vec 0):real^3)`;`\ (t:real). v2`;`\ (t:real). v0`;`\ (t:real). (norm v2 pow 2)`;`\ (t:real). (norm v0 pow 2)`;`\ (t:real). (norm v1 pow 2)`;`\ (t:real). ((dist (v0,v1)+ g01 t) pow 2)`;`\ (t:real). ((dist (v2,v1)+ g12 t) pow 2)`;`\ (t:real). (dist (v0,v2) pow 2)`;`t`]; + REWRITE_TAC[CONTINUOUS_CONST;REAL_CONTINUOUS_CONST]; + EXPAND_TAC "f"; + REWRITE_TAC[]; + DISCH_THEN MATCH_MP_TAC; + ASM_SIMP_TAC[]; + REWRITE_TAC[DIST_0;DIST_SYM]; + CONJ_TAC; + MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR; + TYPIFY `v1` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY((CONJ_TAC THEN REPEAT (ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST] THEN REPEAT CONJ_TAC THEN (MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB)))); + COMMENT "coplanarity"; + TYPIFY `f v1 (&0) = v1` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "f"; + ASM_REWRITE_TAC[arith `x + &0 = x`]; + INTRO_TAC mk_simplex_uniq [`(vec 0):real^3`;`v2`;`v0`;`v1`]; + REWRITE_TAC[GSYM DIST_0;DIST_SYM]; + DISCH_THEN MATCH_MP_TAC; + REWRITE_TAC[VECTOR_SUB_RZERO]; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `cross` kill; + FIRST_X_ASSUM_ST `cross` MP_TAC; + MATCH_MP_TAC (arith `a = b ==> a > &0 ==> b > &0`); + BY(VEC3_TAC); + TYPIFY `f v1 continuous atreal (&0)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `abs(&0) = &0`]); + INTRO_TAC Zlzthic.NONPLANAR_OPEN [`\ (t:real). (vec 0):real^3`;`\ (t:real). v0`;`\ (t:real). v2`;`f v1`;`&0`]; + ASM_REWRITE_TAC[CONTINUOUS_CONST;arith `abs(&0 - t)= abs t`]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "final kill"; + INTRO_TAC epsilon_pair [`e'''`;`e'`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''''` EXISTS_TAC; + ASM_REWRITE_TAC[IN_REAL_INTERVAL;arith `-- e < t /\ t < e <=> abs t < e`;arith `abs(&0) = &0`;GSYM CONJ_ASSOC]; + REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `cross` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(ASM_SIMP_TAC[]); + REPEAT (GMATCH_SIMP_TAC (GSYM Collect_geom.EQ_POW2_COND)); + REWRITE_TAC[DIST_POS_LE]; + REWRITE_TAC[NORM_POS_LE]; + CONJ_TAC; + BY(ASM_MESON_TAC[arith `&0 < x ==> &0 <= x`]); + CONJ_TAC; + BY(ASM_MESON_TAC[arith `&0 < x ==> &0 <= x`]); + DISCH_THEN (unlist REWRITE_TAC); + BY(MESON_TAC[DIST_SYM;DIST_0]); + SUBCONJ2_TAC; + REPEAT WEAKER_STRIP_TAC; + EXPAND_TAC "f"; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + CONJ2_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `v = v1` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `v = v1` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_SIMP_TAC[]; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_SIMP_TAC[]); + TYPIFY `f v = (\t. v)` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[FUN_EQ_THM]; + GEN_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + BY(REWRITE_TAC[CONTINUOUS_CONST]) + ]);; + (* }}} *) + +let deform_simplex_edge_exists = prove_by_refinement( + `!V g01 g12 v0 v1 v2 e. ?f. + (~coplanar {vec 0,v0,v1,v2} /\ v1 dot (v2 cross v0) > &0 /\ &0 < e /\ + g01 real_continuous_on (real_interval (--e,e)) /\ + g12 real_continuous_on (real_interval (--e,e)) /\ + g01 (&0) = &0 /\ g12 (&0) = &0 + ==> + (?e'. &0 < e' /\ deformation f V (-- e', e') /\ + (!v t. ~(v = v1) ==> f v t = v) /\ + (!t. abs t < e' ==> + dist(v0,f v1 t) = dist(v0,v1) + g01 t /\ + dist(v2,f v1 t) = dist(v2,v1) + g12 t /\ + norm(f v1 t) = norm(v1))))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `f = (\w t. if w = v1 then mk_simplex1 (vec 0) v2 v0 (norm v2 pow 2) (norm v0 pow 2) (norm v1 pow 2) ((dist (v0,v1) + g01 t) pow 2) ((dist (v2,v1) + g12 t) pow 2) (dist (v0,v2) pow 2) else w)`; + TYPIFY `f` EXISTS_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC deform_simplex_decrease_edge23 [`V`;`g01`;`g12`;`v0`;`v1`;`v2`;`e`]; + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[LET_DEF;LET_END_DEF]) + ]);; + (* }}} *) + +let deform_simplex_684_pent = prove_by_refinement( + `!V g23 v0 v1 v2 v3 e. + ( + let f1 = (\ w t. if w = v2 then + mk_simplex1 (vec 0) v3 v0 (norm v3 pow 2) (norm v0 pow 2) (norm v2 pow 2) + ((dist(v0,v2)) pow 2) ((dist(v3,v2) + g23 t) pow 2) (dist(v0,v3) pow 2) else w) in + let f = (\ w t. if w = v2 then f1 v2 t + else if w = v1 then + mk_simplex1 (vec 0) (f1 v2 t) v0 (norm v2 pow 2) (norm v0 pow 2) (norm v1 pow 2) + ((dist(v0,v1)) pow 2) ((dist(v2,v1)) pow 2) (dist(v0,v2) pow 2) else w) in + (~coplanar {vec 0,v0,v2,v3} /\ ~coplanar {vec 0,v0,v1,v2} /\ + v2 dot (v3 cross v0) > &0 /\ + v1 dot (v2 cross v0) > &0 /\ &0 < e /\ + g23 real_continuous_on (real_interval (--e,e)) /\ + g23 (&0) = &0 + ==> + (?e'. &0 < e' /\ deformation f V (-- e', e') /\ + (!v t. ~(v = v1) /\ ~(v = v2) ==> f v t = v) /\ + (!t. abs t < e' ==> + dist(v0,f v1 t) = dist(v0,v1) /\ + dist(f v2 t,f v1 t) = dist(v2,v1) /\ + norm(f v1 t) = norm(v1) /\ + dist (f v2 t,v0) = dist(v2,v0) /\ + dist (f v2 t,v3) = dist(v2,v3)+ g23 t /\ + norm(f v2 t) = norm (v2) + ))))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REPEAT LET_TAC; + REWRITE_TAC[Localization.deformation]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "preliminaries"; + TYPIFY `{vec 0,v3,v0,v2} = { vec 0,v0,v2,v3} /\ {vec 0, v0, v3, v2} = {vec 0,v0,v2,v3}` (C SUBGOAL_THEN ASSUME_TAC); + BY(SET_TAC[]); + COMMENT "easy continuity"; + TYPIFY `&0 IN real_interval( --e,e)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[IN_REAL_INTERVAL]; + BY(ASM_SIMP_TAC[arith `&0 < e ==> --e < &0`]); + TYPIFY `g23 real_continuous atreal (&0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT;Ocbicby.REAL_OPEN_REAL_INTERVAL]); + TYPIFY `(\t. delta_x (norm v3 pow 2) (norm v0 pow 2) (norm v2 pow 2) ((dist(v0,v2)) pow 2) ((dist(v3,v2) + g23 t) pow 2) (dist(v0,v3) pow 2)) real_continuous atreal (&0)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[Sphere.delta_x]; + BY(REPEAT (ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST] THEN REPEAT CONJ_TAC THEN (MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB))); + TYPIFY `&0 < delta_x (norm v3 pow 2) (norm v0 pow 2) (norm v2 pow 2) ((dist (v0,v2)) pow 2) ((dist (v3,v2)) pow 2) (dist (v0,v3) pow 2)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM Sphere.delta_y;arith `x pow 2 = x*x`;GSYM DIST_0]; + FIRST_X_ASSUM_ST `coplanar` kill; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,d,b,c}`]; + REWRITE_TAC[ Oxlzlez.coplanar_delta_y]; + BY(REWRITE_TAC[DIST_SYM]); + TYPIFY `&0 < delta_x (norm v2 pow 2) (norm v0 pow 2) (norm v1 pow 2) ((dist (v0,v1)) pow 2) ((dist (v2,v1)) pow 2) (dist (v0,v2) pow 2)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM Sphere.delta_y;arith `x pow 2 = x*x`;GSYM DIST_0]; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,d,b,c}`]; + REWRITE_TAC[ Oxlzlez.coplanar_delta_y]; + BY(REWRITE_TAC[DIST_SYM]); + TYPIFY `?e1. &0 < e1 /\ (!t. abs t < e1 ==> &0 < delta_x (norm v3 pow 2) (norm v0 pow 2) (norm v2 pow 2) ((dist(v0,v2)) pow 2) ((dist(v3,v2) + g23 t) pow 2) (dist(v0,v3) pow 2))` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC continuous_nbd_pos [`(\t. delta_x (norm v3 pow 2) (norm v0 pow 2) (norm v2 pow 2) (dist (v0,v2) pow 2) ((dist (v3,v2) + g23 t) pow 2) (dist (v0,v3) pow 2))`;`&0`]; + BY(ASM_REWRITE_TAC[arith `x + &0 = x`;arith `abs (t' - &0) = abs t'`]); + FIRST_X_ASSUM MP_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `?e2. &0 < e2 /\ (!t. abs t < e2 ==> &0 < dist (v3,v2) + g23 t)` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `(\t. (dist (v3,v2) + g23 t) ) real_continuous atreal (&0)` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC continuous_nbd_pos [`(\t. (dist (v3,v2) + g23 t) )`;`&0`]; + ASM_REWRITE_TAC[arith `x + &0 = x`;GSYM DIST_NZ;arith `abs (t' - &0) = abs t'`]; + TYPIFY_GOAL_THEN `~(v3 = v2)` (unlist REWRITE_TAC); + BY(ASM_MESON_TAC[Planarity.notcoplanar_disjoint]); + BY(REPEAT (ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST] THEN REPEAT CONJ_TAC THEN (MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB))); + FIRST_X_ASSUM MP_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `!t. abs t < e2 ==> &0 < (dist (v3,v2) + g23 t) pow 2` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + BY(ASM_SIMP_TAC[arith `&0 < x ==> ~(x = &0)`]); + INTRO_TAC epsilon_pair [`e1`;`e2`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + COMMENT "distances on 023 triangle"; + TYPIFY `!t. abs t < e'' ==> norm v2 pow 2 = dist (f v2 t,vec 0) pow 2 /\ (dist (v0,v2)) pow 2 = dist (f v2 t,v0) pow 2 /\ (dist (v3,v2) + g23 t) pow 2 = dist (f v2 t,v3) pow 2 /\ v3 dot (v0 cross f v2 t) > &0` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC PQCSXWG1_SYM [`(vec 0):real^3`;` v0 `;`v3`;`f v2 t`;` (norm v0 pow 2)`;` (norm v3 pow 2)`;`(norm v2 pow 2)`;` ((dist (v3,v2) + g23 t) pow 2)`;` ((dist (v0,v2) ) pow 2)`;` (dist (v0,v3) pow 2)`]; + REWRITE_TAC[VECTOR_SUB_RZERO]; + DISCH_THEN MATCH_MP_TAC; + ASM_SIMP_TAC[]; + REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; + EXPAND_TAC "f"; + (REWRITE_TAC[]); + EXPAND_TAC "f1"; + BY(REWRITE_TAC[]); + CONJ2_TAC; + FIRST_X_ASSUM_ST `delta_x` (C INTRO_TAC [`t`]); + ASM_SIMP_TAC[]; + BY(MESON_TAC[Merge_ineq.delta_x_sym]); + REWRITE_TAC[DIST_0]; + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + REWRITE_TAC[GSYM DIST_0]; + REWRITE_TAC[DIST_EQ_0]; + CONJ_TAC; + BY(ASM_MESON_TAC[Planarity.notcoplanar_disjoint]); + MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR; + TYPIFY `v2` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + COMMENT "continuity at f v2 t"; + INTRO_TAC epsilon_pair [`e`;`e''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `!t. abs t < e''' /\ ~coplanar{vec 0,v0,f v2 t,v3} ==> f v2 continuous atreal t` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `g23 real_continuous atreal t` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT (FIRST_X_ASSUM_ST `real_continuous_on` MP_TAC); + REPEAT (GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT); + REWRITE_TAC[ Ocbicby.REAL_OPEN_REAL_INTERVAL;IN_REAL_INTERVAL;arith `-- e < t /\ t < e <=> abs t < e`]; + DISCH_THEN MATCH_MP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC Pqcsxwg.PQCSXWG2_ATREAL [`(\ (t:real). (vec 0):real^3)`;`\ (t:real). v3`;`\ (t:real). v0`;`\ (t:real). (norm v3 pow 2)`;`\ (t:real). (norm v0 pow 2)`;`\ (t:real). (norm v2 pow 2)`;`\ (t:real). ((dist (v0,v2)) pow 2)`;`\ (t:real). ((dist (v3,v2)+ g23 t) pow 2)`;`\ (t:real). (dist (v0,v3) pow 2)`;`t`]; + REWRITE_TAC[CONTINUOUS_CONST;REAL_CONTINUOUS_CONST]; + EXPAND_TAC "f"; + REWRITE_TAC[]; + EXPAND_TAC "f1"; + REWRITE_TAC[]; + DISCH_THEN MATCH_MP_TAC; + ASM_SIMP_TAC[]; + REWRITE_TAC[DIST_0;DIST_SYM]; + CONJ_TAC; + MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR; + TYPIFY `v2` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY((REPEAT (ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST] THEN REPEAT CONJ_TAC THEN (MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB)))); + COMMENT "coplanarity"; + TYPIFY `f v2 (&0) = v2` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "f"; + EXPAND_TAC "f1"; + ASM_REWRITE_TAC[arith `x + &0 = x`]; + INTRO_TAC mk_simplex_uniq [`(vec 0):real^3`;`v3`;`v0`;`v2`]; + REWRITE_TAC[GSYM DIST_0;DIST_SYM]; + DISCH_THEN MATCH_MP_TAC; + REWRITE_TAC[VECTOR_SUB_RZERO]; + ASM_REWRITE_TAC[]; + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `cross` kill); + FIRST_X_ASSUM_ST `cross` MP_TAC; + MATCH_MP_TAC (arith `a = b ==> a > &0 ==> b > &0`); + BY(VEC3_TAC); + TYPIFY `f v2 continuous atreal (&0)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `abs(&0) = &0`]); + INTRO_TAC Zlzthic.NONPLANAR_OPEN [`\ (t:real). (vec 0):real^3`;`\ (t:real). v0`;`\ (t:real). v3`;`f v2`;`&0`]; + ASM_REWRITE_TAC[CONTINUOUS_CONST;arith `abs(&0 - t)= abs t`]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "distances on 012 triangle"; + TYPIFY `f v2 = f1 v2` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "f"; + BY(REWRITE_TAC[FUN_EQ_THM]); + INTRO_TAC epsilon_pair [`e'`;`e'''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `!t. abs t < e'''' ==> norm v1 pow 2 = dist (f v1 t,vec 0) pow 2 /\ dist (v0,v1) pow 2 = dist (f v1 t,v0) pow 2 /\ dist (v2,v1) pow 2 = dist (f v1 t,f v2 t) pow 2 /\ f v2 t dot (v0 cross f v1 t) > &0` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC PQCSXWG1_SYM [`(vec 0):real^3`;` v0 `;`f v2 t`;`f v1 t`;` (norm v0 pow 2)`;` (norm v2 pow 2)`;`(norm v1 pow 2)`;` ((dist (v2,v1)) pow 2)`;` ((dist (v0,v1) ) pow 2)`;` (dist (v0,v2) pow 2)`]; + REWRITE_TAC[VECTOR_SUB_RZERO]; + DISCH_THEN MATCH_MP_TAC; + ASM_SIMP_TAC[]; + REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; + EXPAND_TAC "f"; + (REWRITE_TAC[]); + TYPIFY_GOAL_THEN `~(v1 = v2)` (unlist REWRITE_TAC); + BY(ASM_MESON_TAC[Planarity.notcoplanar_disjoint]); + BY(ASM_SIMP_TAC[]); + CONJ2_TAC; + TYPIFY `(dist (f1 v2 t,vec 0) pow 2) = norm v2 pow 2 /\ dist (f1 v2 t,v0) pow 2 = dist(v2,v0) pow 2` ENOUGH_TO_SHOW_TAC; + DISCH_THEN (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `delta_x` kill; + FIRST_X_ASSUM_ST `delta_x` MP_TAC; + MATCH_MP_TAC (arith `(a = b) ==> &0 < a ==> &0 < b`); + REWRITE_TAC[DIST_SYM]; + BY(MESON_TAC[Merge_ineq.delta_x_sym]); + FIRST_X_ASSUM_ST `(=)` (SUBST1_TAC o GSYM); + BY(REPLICATE_TAC 15 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIST_SYM]); + REWRITE_TAC[DIST_0]; + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + REWRITE_TAC[GSYM DIST_0;DIST_SYM]; + REWRITE_TAC[DIST_EQ_0]; + CONJ_TAC; + FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`t`]); + ASM_SIMP_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `coplanar` MP_TAC); + BY(MESON_TAC[Planarity.notcoplanar_disjoint]); + MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR; + TYPIFY `v3` EXISTS_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]; + FIRST_X_ASSUM_ST `=` (SUBST1_TAC o GSYM); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_SIMP_TAC[]); + COMMENT "continuity at f v1 t"; + TYPIFY `!t. abs t < e'''' ==> f v1 continuous atreal t` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Pqcsxwg.PQCSXWG2_ATREAL [`(\ (t:real). (vec 0):real^3)`;`f1 v2`;`\ (t:real). v0`;`\ (t:real). (norm v2 pow 2)`;`\ (t:real). (norm v0 pow 2)`;`\ (t:real). (norm v1 pow 2)`;`\ (t:real). ((dist (v0,v1)) pow 2)`;`\ (t:real). ((dist (v2,v1)) pow 2)`;`\ (t:real). (dist (v0,v2) pow 2)`;`t`]; + REWRITE_TAC[CONTINUOUS_CONST;REAL_CONTINUOUS_CONST]; + EXPAND_TAC "f"; + REWRITE_TAC[]; + TYPIFY_GOAL_THEN `~(v1 = v2)` (unlist REWRITE_TAC); + BY(ASM_MESON_TAC[Planarity.notcoplanar_disjoint]); + DISCH_THEN MATCH_MP_TAC; + ASM_SIMP_TAC[]; + REWRITE_TAC[DIST_0;DIST_SYM]; + CONJ_TAC; + MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR; + TYPIFY `v3` EXISTS_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,c,d,b}`]; + FIRST_X_ASSUM_ST `(v:real->real^3) = w` (SUBST1_TAC o GSYM); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_SIMP_TAC[]); + BY(ASM_MESON_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + COMMENT "final kill"; + TYPIFY `e''''` EXISTS_TAC; + ASM_REWRITE_TAC[IN_REAL_INTERVAL;arith `-- e < t /\ t < e <=> abs t < e`;arith `abs(&0) = &0`;GSYM CONJ_ASSOC]; + REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; + REPEAT WEAKER_STRIP_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `cross` (C INTRO_TAC [`t`])); + (ASM_SIMP_TAC[]); + REPEAT (GMATCH_SIMP_TAC (GSYM Collect_geom.EQ_POW2_COND)); + REWRITE_TAC[DIST_POS_LE;NORM_POS_LE]; + CONJ_TAC; + BY(ASM_MESON_TAC[arith `&0 < x ==> &0 <= x`]); + REWRITE_TAC[DIST_SYM]; + DISCH_THEN (unlist REWRITE_TAC); + DISCH_THEN (unlist REWRITE_TAC); + BY(MESON_TAC[DIST_SYM;DIST_0]); + SUBCONJ2_TAC; + REPEAT WEAKER_STRIP_TAC; + EXPAND_TAC "f"; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + COMMENT "insert"; + TYPIFY `~(v1 = v2)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Planarity.notcoplanar_disjoint]); + TYPIFY `f v1 (&0) = v1` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "f"; + ASM_REWRITE_TAC[]; + TYPIFY `f1 v2 (&0) = v2` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[]); + INTRO_TAC mk_simplex_uniq [`(vec 0):real^3`;`v2`;`v0`;`v1`]; + REWRITE_TAC[GSYM DIST_0;DIST_SYM]; + DISCH_THEN MATCH_MP_TAC; + REWRITE_TAC[VECTOR_SUB_RZERO]; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,c,d,b}`]; + ASM_REWRITE_TAC[]; + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `cross` kill); + FIRST_X_ASSUM_ST `cross` MP_TAC; + MATCH_MP_TAC (arith `a = b ==> a > &0 ==> b > &0`); + BY(VEC3_TAC); + COMMENT "end insert"; + CONJ2_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `v = v2` ASM_CASES_TAC; + BY(ASM_MESON_TAC[]); + TYPIFY `v = v1` ASM_CASES_TAC; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `v = v1` ASM_CASES_TAC; + BY(ASM_MESON_TAC[]); + TYPIFY `v = v2` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `f (v2:real^3) = f1 v2` kill; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]; + BY(ASM_MESON_TAC[]); + TYPIFY `f v = (\t. v)` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[FUN_EQ_THM]; + GEN_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + BY(REWRITE_TAC[CONTINUOUS_CONST]) + ]);; + (* }}} *) + +let deform_684_pent_exists = prove_by_refinement( + `!V g23 v0 v1 v2 v3 e. ?f. + ( + (~coplanar {vec 0,v0,v2,v3} /\ ~coplanar {vec 0,v0,v1,v2} /\ + v2 dot (v3 cross v0) > &0 /\ + v1 dot (v2 cross v0) > &0 /\ &0 < e /\ + g23 real_continuous_on (real_interval (--e,e)) /\ + g23 (&0) = &0 + ==> + (?e'. &0 < e' /\ deformation f V (-- e', e') /\ + (!v t. ~(v = v1) /\ ~(v = v2) ==> f v t = v) /\ + (!t. abs t < e' ==> + dist(v0,f v1 t) = dist(v0,v1) /\ + dist(f v2 t,f v1 t) = dist(v2,v1) /\ + norm(f v1 t) = norm(v1) /\ + dist (f v2 t,v0) = dist(v2,v0) /\ + dist (f v2 t,v3) = dist(v2,v3)+ g23 t /\ + norm(f v2 t) = norm (v2) + ))))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `f1 = (\ w t. if w = v2 then mk_simplex1 (vec 0) v3 v0 (norm v3 pow 2) (norm v0 pow 2) (norm v2 pow 2) ((dist(v0,v2)) pow 2) ((dist(v3,v2) + g23 t) pow 2) (dist(v0,v3) pow 2) else w)`; + TYPED_ABBREV_TAC `f = (\ w t. if w = v2 then f1 v2 t else if w = v1 then mk_simplex1 (vec 0) (f1 v2 t) v0 (norm v2 pow 2) (norm v0 pow 2) (norm v1 pow 2) ((dist(v0,v1)) pow 2) ((dist(v2,v1)) pow 2) (dist(v0,v2) pow 2) else w)`; + TYPIFY `f` EXISTS_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC deform_simplex_684_pent [`V`;`g23`;`v0`;`v1`;`v2`;`v3`;`e`]; + ASM_REWRITE_TAC[]; + LET_TAC; + ASM_REWRITE_TAC[]; + BY((ASM_REWRITE_TAC[LET_DEF;LET_END_DEF])) + ]);; + (* }}} *) + +let mk_planar_unique = prove_by_refinement( + `!v0 v1 v2 v3 v3'. + ~collinear {v0,v1,v2} /\ + dist(v0,v3) = dist(v0,v3') /\ + dist(v1,v3) = dist(v1,v3') /\ + coplanar {v0,v1,v2,v3} /\ + coplanar {v0,v1,v2,v3'} /\ + (?t. &0 < t /\ t % ((v3 - v0) cross (v1 - v0)) = ((v3' - v0) cross (v1 - v0))) ==> + (v3 = v3')`, + (* {{{ proof *) + [ + GEOM_ORIGIN_TAC `v0:real^3` THEN REPEAT GEN_TAC; + REWRITE_TAC[VECTOR_SUB_RZERO]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `n = v1 cross (v1 cross v2)`; + TYPIFY `n dot n = (v1 dot v1) * ((v1 cross v2) dot (v1 cross v2))` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "n"; + BY(VEC3_TAC); + TYPIFY `~(n = vec 0)` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[GSYM DOT_POS_LT]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REWRITE_TAC[DOT_POS_LT]; + CONJ_TAC; + BY(ASM_MESON_TAC[COLLINEAR_2;SET_RULE `{a,a,b} = {a,b}`]); + BY(ASM_MESON_TAC[CROSS_EQ_0]); + TYPIFY `~coplanar {vec 0,v1,v1 cross v2,n}` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "n"; + MATCH_MP_TAC Local_lemmas.NOT_COLL_IMP_COPL; + BY(ASM_MESON_TAC[Local_lemmas.COLL_IFF_COLL_CROSS]); + INTRO_TAC Trigonometry2.NONCOPLANAR_3_BASIS [`v1`;`v1 cross v2`;`n`;`(vec 0):real^3`]; + ASM_REWRITE_TAC[VECTOR_SUB_RZERO]; + DISCH_TAC; + TYPIFY `!u. coplanar {vec 0,v1,v2,u} ==> ?t1 tn. u = t1 % v1 + tn % n` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`u`]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + GEXISTL_TAC [`t1`;`t3`]; + INTRO_TAC Zlzthic.coplanar_in_affine_hull [`(vec 0):real^3`;`v1`;`v2`;`u`]; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {b,c,d,a}`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Ckqowsa_4_points.in_affine_hull_lemma [`v1`;`v2`;`u`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + TYPIFY `(t1' % v1 + t2' % v2) dot (v1 cross v2) = (t1 % v1 + t2 % (v1 cross v2) + t3 % n) dot (v1 cross v2)` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[]); + EXPAND_TAC "n"; + REWRITE_TAC[DOT_LADD;DOT_LMUL;DOT_CROSS_SELF]; + REWRITE_TAC[arith `a * &0 + b * &0 = c * &0 + e + f* &0 <=> e = &0`]; + REWRITE_TAC[REAL_ENTIRE]; + REWRITE_TAC[DOT_EQ_0]; + DISCH_TAC; + FIRST_X_ASSUM_ST `~` MP_TAC; + FIRST_X_ASSUM DISJ_CASES_TAC; + ASM_REWRITE_TAC[]; + BY(VECTOR_ARITH_TAC); + BY(ASM_MESON_TAC[CROSS_EQ_0]); + FIRST_ASSUM (C INTRO_TAC [`v3`]); + FIRST_X_ASSUM (C INTRO_TAC [`v3'`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `!a b. norm (a % v1 + b % n) pow 2 = a pow 2 * (v1 dot v1) + b pow 2 * (n dot n)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + (GMATCH_SIMP_TAC NORM_ADD_PYTHAGOREAN ); + CONJ_TAC; + BY(REWRITE_TAC[orthogonal] THEN EXPAND_TAC "n" THEN VEC3_TAC); + REWRITE_TAC[NORM_MUL]; + BY(REWRITE_TAC[arith `(a * b) pow 2 = a pow 2 * b pow 2`;GSYM Collect_geom.X_DOT_X_EQ;arith `abs a pow 2 = a pow 2`]); + TYPIFY `t1' = t1` ENOUGH_TO_SHOW_TAC; + DISCH_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + TYPIFY `norm v3 pow 2 = norm v3' pow 2` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[DIST_0;Collect_geom.X_DOT_X_EQ]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `tn pow 2 * (n dot n) = tn' pow 2 * (n dot n)` (C SUBGOAL_THEN MP_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[arith `a + b = a + c <=> b = c`]); + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[REAL_EQ_MUL_RCANCEL]; + REWRITE_TAC[DOT_EQ_0]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[GSYM REAL_EQ_SQUARE_ABS]; + DISCH_TAC; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `t % (v3 cross v1) = u` MP_TAC; + ASM_REWRITE_TAC[] THEN EXPAND_TAC "n" THEN REWRITE_TAC[CROSS_LADD;CROSS_LMUL;DOT_CROSS_SELF;CROSS_REFL]; + TYPIFY `((v1 cross v1 cross v2) cross v1) = (v1 dot v1) % (v1 cross v2)` (C SUBGOAL_THEN SUBST1_TAC); + BY(VEC3_TAC); + REWRITE_TAC[arith `t % vec 0 + b = b`]; + REWRITE_TAC[VECTOR_MUL_ASSOC]; + REWRITE_TAC[VECTOR_MUL_RCANCEL]; + REWRITE_TAC[REAL_EQ_MUL_RCANCEL]; + REWRITE_TAC[GSYM DISJ_ASSOC]; + DISCH_TAC; + FIRST_X_ASSUM_ST `~` MP_TAC; + REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[arith `abs a = abs b <=> (a = b \/ a = --b)`]); + FIRST_X_ASSUM DISJ_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `(t + &1) * tn' = &0` (C SUBGOAL_THEN MP_TAC); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REWRITE_TAC[REAL_ENTIRE]; + ASM_SIMP_TAC[arith `&0 ~(t + &1 = &0)`]; + DISCH_TAC THEN ASM_REWRITE_TAC[]; + BY(VECTOR_ARITH_TAC); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[DOT_EQ_0]; + BY(ASM_MESON_TAC[COLLINEAR_2;SET_RULE `{a,a,b} = {a,b}`]); + BY(ASM_MESON_TAC[CROSS_EQ_0]); + TYPIFY `!a b. dist(vec 0,a % v1 + b % n) pow 2 - dist(v1,a % v1 + b % n) pow 2 = dist(vec 0,v3) pow 2 - dist(v1,v3) pow 2 ==> a = t1'` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[]); + ONCE_REWRITE_TAC[DIST_SYM]; + REWRITE_TAC[dist]; + REWRITE_TAC[VECTOR_SUB_RZERO]; + FIRST_X_ASSUM_ST `(v3:real^3) = b` SUBST1_TAC; + REWRITE_TAC[arith `(a % v1 + b % n) - v1 = (a - &1) % v1 + b % n`]; + REPEAT GEN_TAC; + FIRST_X_ASSUM (unlist REWRITE_TAC); + REWRITE_TAC[arith `(u + v) - (w + v) = u - w`]; + REWRITE_TAC[arith `a pow 2 * b - (a - &1) pow 2 * b = (&2 * a - &1) *b`]; + REWRITE_TAC[REAL_EQ_MUL_RCANCEL]; + DISCH_THEN DISJ_CASES_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[DOT_EQ_0]; + BY(ASM_MESON_TAC[COLLINEAR_2;SET_RULE `{a,a,b} = {a,b}`]) + ]);; + (* }}} *) + +let mk_planar2_continuous = prove_by_refinement( + `!v0 v1 v2 x1 x2 x3 x5 x6 a s. + &0 < x1 a /\ + &0 < ups_x (x1 a) (x2 a) (x6 a) /\ + &0 < ups_x (x1 a) (x3 a) (x5 a) /\ + v0 continuous (atreal a) /\ + v1 continuous (atreal a) /\ + v2 continuous (atreal a) /\ + x1 real_continuous (atreal a) /\ + x2 real_continuous (atreal a) /\ + x3 real_continuous (atreal a) /\ + x5 real_continuous (atreal a) /\ + x6 real_continuous (atreal a) + ==> (\t. mk_planar2 (v0 t) (v1 t) (v2 t) + (x1 t) (x2 t) (x3 t) (x5 t) (x6 t) s) + continuous (atreal a)`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.mk_planar2;LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + REPEAT (REPEAT CONJ_TAC THEN (MATCH_MP_TAC CONTINUOUS_ADD ORELSE MATCH_MP_TAC CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_AT_SQRT ORELSE MATCH_MP_TAC (* Xbjrphc. *)CONTINUOUS_CROSS ORELSE MATCH_MP_TAC CONTINUOUS_SUB ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB ORELSE MATCH_MP_TAC REAL_CONTINUOUS_DIV_ATREAL ORELSE MATCH_MP_TAC Pqcsxwg.REAL_CONTINUOUS_ATREAL_SQRT_COMPOSE) THEN ASM_SIMP_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS1;REAL_ENTIRE;arith `&0 < x ==> ~(x = &0)`;arith `~(&2 = &0)`;REAL_CONTINUOUS_CONST]); + GMATCH_SIMP_TAC REAL_LT_DIV; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_CONTINUOUS_DIV_ATREAL; + ASM_SIMP_TAC[arith `&0 < x ==> ~(x = &0)`]; + REWRITE_TAC[Sphere.ups_x]; + BY(CONJ_TAC THEN REPEAT (REPEAT CONJ_TAC THEN (MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB ORELSE MATCH_MP_TAC REAL_CONTINUOUS_NEG) THEN ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST])) + ]);; + (* }}} *) + +let collinear_expand = prove_by_refinement( + `!(v1:real^A) v2 v3. ~collinear {vec 0,v1,v2} /\ coplanar {vec 0,v1,v2,v3} ==> (?t1 t2. v3 = t1 % v1 + t2 % v2)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP Counting_spheres.NOT_COLLINEAR_AFF_DIM_2)); + FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP Leaf_cell.COPLANAR_IMP_AFF_DIM)); + INTRO_TAC AFF_DIM_EQ_AFFINE_HULL [`{vec 0,v1,v2}`;`{vec 0,v1,v2,v3}`]; + ANTS_TAC; + CONJ_TAC; + BY(SET_TAC[]); + BY(ASM_TAC THEN INT_ARITH_TAC); + DISCH_TAC; + TYPIFY `v3 IN affine hull {vec 0,v1,v2}` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC Marchal_cells_2_new.IN_AFFINE_KY_LEMMA1; + BY(SET_TAC[]); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[AFFINE_HULL_3;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + GEXISTL_TAC [`v`;`w`]; + ASM_REWRITE_TAC[]; + BY(VECTOR_ARITH_TAC) + ]);; + (* }}} *) + +let deform_planar = prove_by_refinement( + `!V g01 g02 g23 v0 v1 v2 v3 e. + ( + let f1 = (\ w t. if w = v2 then + mk_simplex1 (vec 0) v3 v0 (norm v3 pow 2) (norm v0 pow 2) (norm v2 pow 2) + ((dist(v0,v2) + g02 t) pow 2) ((dist(v3,v2) + g23 t) pow 2) (dist(v0,v3) pow 2) else w) in + let f = (\ w t. if w = v2 then f1 v2 t + else if w = v1 then + mk_planar2 (vec 0) v0 (f1 v2 t) (norm v0 pow 2) (norm v2 pow 2) (norm v1 pow 2) // skip4 + ((dist(v0,v1) + g01 t) pow 2) ((dist(v0,v2) + g02 t) pow 2) (-- &1) else w) in + (~coplanar {vec 0,v0,v2,v3} /\ coplanar {vec 0,v0,v1,v2} /\ + v2 dot (v3 cross v0) > &0 /\ + (v1 cross v0) dot (v2 cross v0) > &0 /\ ~(v1 = v2) /\ + &0 < e /\ + g23 real_continuous_on (real_interval (--e,e)) /\ + g23 (&0) = &0 /\ + g01 real_continuous_on (real_interval (--e,e)) /\ + g01 (&0) = &0 /\ + g02 real_continuous_on (real_interval (--e,e)) /\ + g02 (&0) = &0 + ==> + (?e'. &0 < e' /\ deformation f V (-- e', e') /\ + (!v t. ~(v = v1) /\ ~(v = v2) ==> f v t = v) /\ + (!t. abs t < e' ==> + coplanar {vec 0,v0,f v1 t,f v2 t} /\ + dist(v0,f v1 t) = dist(v0,v1) + g01 t /\ + norm(f v1 t) = norm(v1) /\ + dist (f v2 t,v0) = dist(v2,v0) + g02 t /\ + dist (f v2 t,v3) = dist(v2,v3)+ g23 t /\ + norm(f v2 t) = norm (v2) + ))))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REPEAT LET_TAC; + REWRITE_TAC[Localization.deformation]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "preliminaries"; + TYPIFY `{vec 0,v3,v0,v2} = { vec 0,v0,v2,v3} /\ {vec 0, v0, v3, v2} = {vec 0,v0,v2,v3}` (C SUBGOAL_THEN ASSUME_TAC); + BY(SET_TAC[]); + TYPIFY `~(v1 = vec 0) /\ ~(v1 = v0)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM DE_MORGAN_THM] THEN DISCH_TAC THEN FIRST_X_ASSUM DISJ_CASES_TAC THEN FIRST_X_ASSUM_ST `(v1 cross v0) dot (v2 cross v0)` MP_TAC THEN ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[CROSS_LZERO;DOT_LZERO] THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[CROSS_REFL;DOT_LZERO] THEN REAL_ARITH_TAC); + TYPIFY `~(v0 = vec 0) /\ ~(v2 = vec 0) /\ ~(v3 = vec 0) /\ ~(v0 = v2) /\ ~(v0 = v3) /\ ~(v2 = v3)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Planarity.notcoplanar_disjoint]); + COMMENT "easy continuity"; + TYPIFY `&0 IN real_interval( --e,e)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[IN_REAL_INTERVAL]; + BY(ASM_SIMP_TAC[arith `&0 < e ==> --e < &0`]); + TYPIFY `g23 real_continuous atreal (&0) /\ g01 real_continuous atreal (&0) /\ g02 real_continuous atreal (&0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT;Ocbicby.REAL_OPEN_REAL_INTERVAL]); + TYPIFY `(\t. delta_x (norm v3 pow 2) (norm v0 pow 2) (norm v2 pow 2) ((dist(v0,v2)+g02 t) pow 2) ((dist(v3,v2) + g23 t) pow 2) (dist(v0,v3) pow 2)) real_continuous atreal (&0)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[Sphere.delta_x]; + BY(REPEAT (ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST] THEN REPEAT CONJ_TAC THEN (MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB))); + TYPIFY `&0 < delta_x (norm v3 pow 2) (norm v0 pow 2) (norm v2 pow 2) ((dist (v0,v2)) pow 2) ((dist (v3,v2)) pow 2) (dist (v0,v3) pow 2)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM Sphere.delta_y;arith `x pow 2 = x*x`;GSYM DIST_0]; + FIRST_X_ASSUM_ST `coplanar` kill; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,d,b,c}`]; + REWRITE_TAC[ Oxlzlez.coplanar_delta_y]; + BY(REWRITE_TAC[DIST_SYM]); + TYPIFY `~collinear {vec 0,v0,v2}` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Planarity.notcoplanar_imp_notcollinear_fan]); + TYPIFY `&0 < ups_x (norm v0 pow 2) (norm v2 pow 2) ((dist (v0,v2)) pow 2)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `collinear` MP_TAC; + BY(REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS;DIST_0]); + TYPIFY `~collinear {vec 0,v0,v1}` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM CROSS_EQ_0]; + ONCE_REWRITE_TAC[CROSS_SKEW]; + REWRITE_TAC[arith `-- v = vec 0 <=> v = vec 0`]; + DISCH_TAC; + FIRST_X_ASSUM_ST `(a cross b) dot (c cross d)` MP_TAC; + ASM_REWRITE_TAC[DOT_LZERO]; + BY(REAL_ARITH_TAC); + TYPIFY `&0 < ups_x (norm v0 pow 2) (norm v1 pow 2) ((dist (v0,v1)) pow 2)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `collinear` MP_TAC; + BY(REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS;DIST_0]); + TYPIFY `?e1. &0 < e1 /\ (!t. abs t < e1 ==> &0 < delta_x (norm v3 pow 2) (norm v0 pow 2) (norm v2 pow 2) ((dist(v0,v2) + g02 t) pow 2) ((dist(v3,v2) + g23 t) pow 2) (dist(v0,v3) pow 2))` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC continuous_nbd_pos [`(\t. delta_x (norm v3 pow 2) (norm v0 pow 2) (norm v2 pow 2) ((dist (v0,v2)+g02 t) pow 2) ((dist (v3,v2) + g23 t) pow 2) (dist (v0,v3) pow 2))`;`&0`]; + BY((ASM_REWRITE_TAC[arith `x + &0 = x`;arith `abs (t' - &0) = abs t'`])); + FIRST_X_ASSUM MP_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `?e2. &0 < e2 /\ (!t. abs t < e2 ==> &0 < dist (v3,v2) + g23 t /\ &0 < dist(v0,v2)+g02 t /\ &0 < dist(v0,v1)+g01 t)` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `(\t. (dist (v3,v2) + g23 t) ) real_continuous atreal (&0) /\ (\t. (dist (v0,v2) + g02 t) ) real_continuous atreal (&0) /\ (\t. (dist (v0,v1) + g01 t) ) real_continuous atreal (&0)` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC continuous_nbd_pos [`(\t. (dist (v3,v2) + g23 t) )`;`&0`]; + INTRO_TAC continuous_nbd_pos [`(\t. (dist (v0,v2) + g02 t) )`;`&0`]; + INTRO_TAC continuous_nbd_pos [`(\t. (dist (v0,v1) + g01 t) )`;`&0`]; + ASM_REWRITE_TAC[arith `x + &0 = x`;GSYM DIST_NZ;arith `abs (t' - &0) = abs t'`]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e'`;`e''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e''''`;`e'''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + BY(TYPIFY `e'''''` EXISTS_TAC THEN ASM_MESON_TAC[]); + BY(REPEAT CONJ_TAC THEN (REPEAT (ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST] THEN REPEAT CONJ_TAC THEN (MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB)))); + FIRST_X_ASSUM MP_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `!t. abs t < e2 ==> &0 < (dist (v3,v2) + g23 t) pow 2 /\ &0 < (dist (v0,v2) + g02 t) pow 2 /\ &0 < (dist (v0,v1) + g01 t) pow 2` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + BY(ASM_SIMP_TAC[arith `&0 < x ==> ~(x = &0)`]); + INTRO_TAC epsilon_pair [`e1`;`e2`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + COMMENT "distances on 023 triangle"; + TYPIFY `!t. abs t < e'' ==> norm v2 pow 2 = dist (f v2 t,vec 0) pow 2 /\ (dist (v0,v2)+g02 t) pow 2 = dist (f v2 t,v0) pow 2 /\ (dist (v3,v2) + g23 t) pow 2 = dist (f v2 t,v3) pow 2 /\ v3 dot (v0 cross f v2 t) > &0` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC PQCSXWG1_SYM [`(vec 0):real^3`;` v0 `;`v3`;`f v2 t`;` (norm v0 pow 2)`;` (norm v3 pow 2)`;`(norm v2 pow 2)`;` ((dist (v3,v2) + g23 t) pow 2)`;` ((dist (v0,v2)+ g02 t ) pow 2)`;` (dist (v0,v3) pow 2)`]; + REWRITE_TAC[VECTOR_SUB_RZERO]; + DISCH_THEN MATCH_MP_TAC; + ASM_SIMP_TAC[]; + REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; + EXPAND_TAC "f"; + (REWRITE_TAC[]); + EXPAND_TAC "f1"; + BY(REWRITE_TAC[]); + CONJ2_TAC; + FIRST_X_ASSUM_ST `delta_x` (C INTRO_TAC [`t`]); + ASM_SIMP_TAC[]; + BY(MESON_TAC[Merge_ineq.delta_x_sym]); + REWRITE_TAC[DIST_0]; + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + REWRITE_TAC[GSYM DIST_0]; + ASM_REWRITE_TAC[DIST_EQ_0]; + MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR; + TYPIFY `v2` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + COMMENT "continuity at f v2 t"; + INTRO_TAC epsilon_pair [`e`;`e''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `!t. abs t < e''' /\ ~coplanar{vec 0,v0,f v2 t,v3} ==> f v2 continuous atreal t` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `g23 real_continuous atreal t /\ g02 real_continuous atreal t` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT (FIRST_X_ASSUM_ST `real_continuous_on` MP_TAC); + REPEAT (GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT); + REWRITE_TAC[ Ocbicby.REAL_OPEN_REAL_INTERVAL;IN_REAL_INTERVAL;arith `-- e < t /\ t < e <=> abs t < e`]; + BY(REPEAT WEAKER_STRIP_TAC THEN CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + INTRO_TAC Pqcsxwg.PQCSXWG2_ATREAL [`(\ (t:real). (vec 0):real^3)`;`\ (t:real). v3`;`\ (t:real). v0`;`\ (t:real). (norm v3 pow 2)`;`\ (t:real). (norm v0 pow 2)`;`\ (t:real). (norm v2 pow 2)`;`\ (t:real). ((dist (v0,v2)+g02 t) pow 2)`;`\ (t:real). ((dist (v3,v2)+ g23 t) pow 2)`;`\ (t:real). (dist (v0,v3) pow 2)`;`t`]; + REWRITE_TAC[CONTINUOUS_CONST;REAL_CONTINUOUS_CONST]; + EXPAND_TAC "f"; + REWRITE_TAC[]; + EXPAND_TAC "f1"; + REWRITE_TAC[]; + DISCH_THEN MATCH_MP_TAC; + ASM_SIMP_TAC[]; + REWRITE_TAC[DIST_0;DIST_SYM]; + CONJ_TAC; + MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR; + TYPIFY `v2` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY(CONJ_TAC THEN ((REPEAT (ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST] THEN REPEAT CONJ_TAC THEN (MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB))))); + COMMENT "coplanarity"; + TYPIFY `f v2 (&0) = v2` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "f"; + EXPAND_TAC "f1"; + ASM_REWRITE_TAC[arith `x + &0 = x`]; + INTRO_TAC mk_simplex_uniq [`(vec 0):real^3`;`v3`;`v0`;`v2`]; + REWRITE_TAC[GSYM DIST_0;DIST_SYM]; + DISCH_THEN MATCH_MP_TAC; + REWRITE_TAC[VECTOR_SUB_RZERO]; + ASM_REWRITE_TAC[]; + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `cross` kill); + FIRST_X_ASSUM_ST `cross` MP_TAC; + MATCH_MP_TAC (arith `a = b ==> a > &0 ==> b > &0`); + BY(VEC3_TAC); + TYPIFY `f v2 continuous atreal (&0)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `abs(&0) = &0`]); + INTRO_TAC Zlzthic.NONPLANAR_OPEN [`\ (t:real). (vec 0):real^3`;`\ (t:real). v0`;`\ (t:real). v3`;`f v2`;`&0`]; + ASM_REWRITE_TAC[CONTINUOUS_CONST;arith `abs(&0 - t)= abs t`]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "non collinearity 0, v0, v1"; + TYPIFY `?e3. &0 < e3 /\ (!t. abs t < e3 ==> &0 < ups_x (norm v0 pow 2) (norm v1 pow 2) ((dist (v0,v1) + g01 t) pow 2) /\ &0 < ups_x (norm v0 pow 2) (norm v2 pow 2) ((dist (v0,v2) + g02 t) pow 2))` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `(\t. ups_x (norm v0 pow 2) (norm v1 pow 2) ((dist (v0,v1) + g01 t) pow 2)) real_continuous atreal (&0) /\ (\t. ups_x (norm v0 pow 2) (norm v2 pow 2) ((dist (v0,v2) + g02 t) pow 2)) real_continuous atreal (&0)` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC continuous_nbd_pos [`(\t. ups_x (norm v0 pow 2) (norm v1 pow 2) ((dist (v0,v1) + g01 t) pow 2))`;`&0`]; + INTRO_TAC continuous_nbd_pos [`(\t. ups_x (norm v0 pow 2) (norm v2 pow 2) ((dist (v0,v2) + g02 t) pow 2))`;`&0`]; + ASM_REWRITE_TAC[arith `x + &0 = x`;arith `abs (t - &0) = abs t`]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e''''`;`e'''''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''''''` EXISTS_TAC; + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + BY(REWRITE_TAC[Sphere.ups_x] THEN CONJ_TAC THEN ((REPEAT (ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST] THEN REPEAT CONJ_TAC THEN (MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB))))); + FIRST_X_ASSUM MP_TAC THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e3`;`e'`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e'''`;`e''''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `!t. abs t < e''''' ==> f v1 continuous atreal t` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `f v2 continuous atreal t /\ g01 real_continuous atreal t /\ g02 real_continuous atreal t` (C SUBGOAL_THEN ASSUME_TAC); + CONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]; + BY(CONJ_TAC THEN ASM_MESON_TAC[]); + REPEAT (FIRST_X_ASSUM_ST `real_continuous_on` MP_TAC); + REPEAT (GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT); + REWRITE_TAC[ Ocbicby.REAL_OPEN_REAL_INTERVAL;IN_REAL_INTERVAL;arith `-- e < t /\ t < e <=> abs t < e`]; + REPEAT WEAKER_STRIP_TAC THEN CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[]); + INTRO_TAC mk_planar2_continuous [`(\ (t:real). (vec 0):real^3)`;`\ (t:real). v0`;`f1 v2`;`\ (t:real). (norm v0 pow 2)`;`\ (t:real). (norm v2 pow 2)`;`\ (t:real). (norm v1 pow 2)`;`\ (t:real). ((dist (v0,v1)+g01 t) pow 2)`;`\ (t:real). ((dist (v0,v2)+ g02 t) pow 2)`;`t`;`-- &1`]; + REWRITE_TAC[CONTINUOUS_CONST;REAL_CONTINUOUS_CONST]; + EXPAND_TAC "f"; + ASM_REWRITE_TAC[]; + DISCH_THEN MATCH_MP_TAC; + ASM_SIMP_TAC[]; + REWRITE_TAC[DIST_0;DIST_SYM]; + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + REWRITE_TAC[NORM_EQ_0]; + ASM_REWRITE_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM MP_TAC; + EXPAND_TAC "f"; + ASM_REWRITE_TAC[]; + TYPIFY `(\t. f1 v2 t) = f1 v2` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[FUN_EQ_THM]); + BY(MESON_TAC[]); + BY(CONJ_TAC THEN REPEAT (REPEAT CONJ_TAC THEN (MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB) THEN (ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST] ))); + COMMENT "distances on 012 triangle"; + TYPIFY `f1 v2 = f v2` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "f"; + BY(REWRITE_TAC[FUN_EQ_THM]); + TYPIFY `!t. abs t < e''''' ==> coplanar {vec 0, v0, f v2 t, f v1 t} /\ norm v1 pow 2 = dist (f v1 t,vec 0) pow 2 /\ (dist (v0,v1) + g01 t) pow 2 = dist (f v1 t,v0) pow 2 /\ (?t'. &0 < t' /\ t' % (f v1 t cross v0) = -- &1 % (v0 cross f v2 t))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Eyypqdw.EYYPQDW [`(vec 0):real^3`;` v0 `;`f v2 t`;`f v1 t`;`(norm v0 pow 2)`;`(norm v2 pow 2)`;`(norm v1 pow 2)`;`((dist (v0,v1)+g01 t) pow 2)`;`((dist (v0,v2)+g02 t) pow 2)`;`-- &1`]; + REWRITE_TAC[VECTOR_SUB_RZERO]; + DISCH_THEN MATCH_MP_TAC; + ASM_SIMP_TAC[]; + REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; + EXPAND_TAC "f"; + (ASM_REWRITE_TAC[DIST_0]); + TYPIFY `norm (f v2 t) pow 2 = norm v2 pow 2 /\ dist(f v2 t,v0) pow 2 = (dist(v0,v2) + g02 t) pow 2` ENOUGH_TO_SHOW_TAC; + BY(DISCH_THEN (unlist REWRITE_TAC)); + BY(REPLICATE_TAC 20 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIST_0]); + ASM_SIMP_TAC[]; + REWRITE_TAC[DIST_0;DIST_SYM]; + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + REWRITE_TAC[NORM_EQ_0]; + REWRITE_TAC[DIST_EQ_0]; + ASM_REWRITE_TAC[]; + CONJ2_TAC; + BY(ASM_MESON_TAC[Planarity.notcoplanar_imp_notcollinear_fan]); + TYPIFY_GOAL_THEN `(~(f v2 t = vec 0) ) /\ ~(f v2 t = v0)` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[Planarity.notcoplanar_disjoint]); + MATCH_MP_TAC (arith `&0 < x ==> ~(x = &0)`); + BY(ASM_MESON_TAC[]); + COMMENT "final kill"; + TYPIFY `e'''''` EXISTS_TAC; + ASM_REWRITE_TAC[IN_REAL_INTERVAL;arith `-- e < t /\ t < e <=> abs t < e`;arith `abs(&0) = &0`;GSYM CONJ_ASSOC]; + REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; + REPEAT WEAKER_STRIP_TAC; + ASM_SIMP_TAC[]; + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `cross` (C INTRO_TAC [`t`])); + (ASM_SIMP_TAC[]); + REPEAT (GMATCH_SIMP_TAC (GSYM Collect_geom.EQ_POW2_COND)); + REWRITE_TAC[DIST_POS_LE;NORM_POS_LE]; + REPEAT (GMATCH_SIMP_TAC (arith `&0 < x ==> &0 <= x`)); + TYPIFY_GOAL_THEN ` &0 < dist (v3,v2) + g23 t /\ &0 < dist (v0,v2) + g02 t /\ &0 < dist (v0,v1) + g01 t` (unlist REWRITE_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[DIST_SYM]; + DISCH_THEN (unlist REWRITE_TAC); + DISCH_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]; + FIRST_X_ASSUM (unlist REWRITE_TAC); + BY(REWRITE_TAC[DIST_0]); + SUBCONJ2_TAC; + REPEAT WEAKER_STRIP_TAC; + EXPAND_TAC "f"; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + TYPIFY `f v1 (&0) = v1` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC mk_planar_unique [`(vec 0):real^3`;`v0`;`v2`;`f v1 (&0)`;`v1`]; + REWRITE_TAC[VECTOR_SUB_RZERO]; + DISCH_THEN MATCH_MP_TAC; + (TYPIFY `abs (&0) < e'''''` (C SUBGOAL_THEN ASSUME_TAC)); + BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY_GOAL_THEN `coplanar {vec 0, v0, v2, f v1 (&0)} /\ coplanar {vec 0, v0, v2, v1}` (unlist REWRITE_TAC); + CONJ_TAC; + FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`&0`]); + ASM_REWRITE_TAC[]; + BY(MESON_TAC[]); + BY(ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`] THEN ASM_REWRITE_TAC[]); + CONJ_TAC; + REPLICATE_TAC 4 (FIRST_X_ASSUM_ST `coplanar` kill); + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + BY(MESON_TAC[Planarity.notcoplanar_imp_notcollinear_fan]); + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`&0`]); + ASM_REWRITE_TAC[]; + REPEAT (GMATCH_SIMP_TAC (GSYM Collect_geom.EQ_POW2_COND)); + REWRITE_TAC[DIST_POS_LE;NORM_POS_LE;arith `x + &0 = x`]; + REWRITE_TAC[DIST_0;DIST_SYM]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC collinear_expand [`v0`;`v1`;`v2`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `cross` MP_TAC; + ASM_REWRITE_TAC[CROSS_RADD;CROSS_RMUL;CROSS_REFL]; + DISCH_TAC; + TYPIFY `t'/ t2` EXISTS_TAC; + GMATCH_SIMP_TAC REAL_LT_DIV; + FIRST_X_ASSUM_ST `(a cross b) dot (c cross d)` MP_TAC; + ASM_REWRITE_TAC[CROSS_LADD;CROSS_LMUL;DOT_RADD;DOT_RMUL;CROSS_REFL;DOT_RZERO]; + REWRITE_TAC[arith `t1 * &0 + x > &0 <=> &0 < x`]; + GMATCH_SIMP_TAC (CONJUNCT2 Real_ext.REAL_PROP_POS_LMUL); + REWRITE_TAC[DOT_POS_LT]; + CONJ_TAC; + REWRITE_TAC[CROSS_EQ_0]; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`]; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `t2 % ((t' / t2) % (f v1 (&0) cross v0)) = t2 % (v1 cross v0)` ENOUGH_TO_SHOW_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[VECTOR_MUL_LCANCEL_IMP;arith `&0 < t ==> ~(t = &0)`]); + REWRITE_TAC[VECTOR_MUL_ASSOC]; + TYPIFY `t2 * t' / t2 = t'` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `=` SUBST1_TAC; + BY(VEC3_TAC); + CONJ2_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `v = v2` ASM_CASES_TAC; + BY(ASM_MESON_TAC[]); + TYPIFY `v = v1` ASM_CASES_TAC; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `v = v1` ASM_CASES_TAC; + BY(ASM_MESON_TAC[]); + TYPIFY `v = v2` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `f (v2:real^3) = f1 v2` kill; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]; + BY(ASM_MESON_TAC[]); + TYPIFY `f v = (\t. v)` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[FUN_EQ_THM]; + GEN_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + BY(REWRITE_TAC[CONTINUOUS_CONST]) + ]);; + (* }}} *) + +let deform_planar_exists = prove_by_refinement( + `!V g01 g02 g23 v0 v1 v2 v3 e. ?f. + ( + (~coplanar {vec 0,v0,v2,v3} /\ coplanar {vec 0,v0,v1,v2} /\ + v2 dot (v3 cross v0) > &0 /\ + (v1 cross v0) dot (v2 cross v0) > &0 /\ ~(v1 = v2) /\ + &0 < e /\ + g23 real_continuous_on (real_interval (--e,e)) /\ + g23 (&0) = &0 /\ + g01 real_continuous_on (real_interval (--e,e)) /\ + g01 (&0) = &0 /\ + g02 real_continuous_on (real_interval (--e,e)) /\ + g02 (&0) = &0 + ==> + (?e'. &0 < e' /\ deformation f V (-- e', e') /\ + (!v t. ~(v = v1) /\ ~(v = v2) ==> f v t = v) /\ + (!t. abs t < e' ==> + coplanar {vec 0,v0,f v1 t,f v2 t} /\ + dist(v0,f v1 t) = dist(v0,v1) + g01 t /\ + norm(f v1 t) = norm(v1) /\ + dist (f v2 t,v0) = dist(v2,v0) + g02 t /\ + dist (f v2 t,v3) = dist(v2,v3)+ g23 t /\ + norm(f v2 t) = norm (v2) + ))))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC`f1 = (\ w t. if w = v2 then mk_simplex1 (vec 0) v3 v0 (norm v3 pow 2) (norm v0 pow 2) (norm v2 pow 2) ((dist(v0,v2) + g02 t) pow 2) ((dist(v3,v2) + g23 t) pow 2) (dist(v0,v3) pow 2) else w)`; + TYPED_ABBREV_TAC` f = (\ w t. if w = v2 then f1 v2 t else if w = v1 then mk_planar2 (vec 0) v0 (f1 v2 t) (norm v0 pow 2) (norm v2 pow 2) (norm v1 pow 2) ((dist(v0,v1) + g01 t) pow 2) ((dist(v0,v2) + g02 t) pow 2) (-- &1) else w) `; + TYPIFY `f` EXISTS_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC deform_planar [`V`;` g01`;` g02`;` g23`;` v0`;` v1`;` v2`;` v3`;` e`]; + ASM_REWRITE_TAC[]; + LET_TAC; + ASM_REWRITE_TAC[]; + LET_TAC; + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let deform_planar_second_version = prove_by_refinement( + `!V g12 g02 g23 v0 v1 v2 v3 e. + ( + let f1 = (\ w t. if w = v2 then + mk_simplex1 (vec 0) v3 v0 (norm v3 pow 2) (norm v0 pow 2) (norm v2 pow 2) + ((dist(v0,v2) + g02 t) pow 2) ((dist(v3,v2) + g23 t) pow 2) (dist(v0,v3) pow 2) else w) in + let f = (\ w t. if w = v2 then f1 v2 t + else if w = v1 then + mk_planar2 (vec 0) (f1 v2 t) v0 (norm v2 pow 2) (norm v0 pow 2) (norm v1 pow 2) // skip4 + ((dist(v1,v2)+ g12 t) pow 2) ((dist(v0,v2) + g02 t) pow 2) (-- &1) else w) in + (~coplanar {vec 0,v0,v2,v3} /\ coplanar {vec 0,v0,v1,v2} /\ + v2 dot (v3 cross v0) > &0 /\ + (v1 cross v2) dot (v0 cross v2) > &0 /\ ~(v1 = v0) /\ + &0 < e /\ + g23 real_continuous_on (real_interval (--e,e)) /\ + g23 (&0) = &0 /\ + g12 real_continuous_on (real_interval (--e,e)) /\ + g12 (&0) = &0 /\ + g02 real_continuous_on (real_interval (--e,e)) /\ + g02 (&0) = &0 + ==> + (?e'. &0 < e' /\ deformation f V (-- e', e') /\ + (!v t. ~(v = v1) /\ ~(v = v2) ==> f v t = v) /\ + (!t. abs t < e' ==> + coplanar {vec 0,v0,f v1 t,f v2 t} /\ + dist(f v1 t,f v2 t) = dist(v1,v2) + g12 t /\ + norm(f v1 t) = norm(v1) /\ + dist (f v2 t,v0) = dist(v2,v0) + g02 t /\ + dist (f v2 t,v3) = dist(v2,v3)+ g23 t /\ + norm(f v2 t) = norm (v2) + ))))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REPEAT LET_TAC; + REWRITE_TAC[Localization.deformation]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "preliminaries"; + TYPIFY `{vec 0,v3,v0,v2} = { vec 0,v0,v2,v3} /\ {vec 0, v0, v3, v2} = {vec 0,v0,v2,v3}` (C SUBGOAL_THEN ASSUME_TAC); + BY(SET_TAC[]); + TYPIFY `~(v1 = vec 0) /\ ~(v1 = v2)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM DE_MORGAN_THM] THEN DISCH_TAC THEN FIRST_X_ASSUM DISJ_CASES_TAC THEN FIRST_X_ASSUM_ST `(v1 cross v0) dot (v2 cross v0)` MP_TAC THEN ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[CROSS_LZERO;DOT_LZERO] THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[CROSS_REFL;DOT_LZERO] THEN REAL_ARITH_TAC); + TYPIFY `~(v0 = vec 0) /\ ~(v2 = vec 0) /\ ~(v3 = vec 0) /\ ~(v0 = v2) /\ ~(v0 = v3) /\ ~(v2 = v3)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Planarity.notcoplanar_disjoint]); + TYPIFY `~collinear {vec 0,v0,v3} /\ ~collinear {vec 0,v0,v2} /\ ~collinear {vec 0,v2,v3}` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Planarity.notcoplanar_imp_notcollinear_fan]); + COMMENT "easy continuity"; + TYPIFY `&0 IN real_interval( --e,e)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[IN_REAL_INTERVAL]; + BY(ASM_SIMP_TAC[arith `&0 < e ==> --e < &0`]); + TYPIFY `g23 real_continuous atreal (&0) /\ g12 real_continuous atreal (&0) /\ g02 real_continuous atreal (&0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT;Ocbicby.REAL_OPEN_REAL_INTERVAL]); + TYPIFY `(\t. delta_x (norm v3 pow 2) (norm v0 pow 2) (norm v2 pow 2) ((dist(v0,v2)+g02 t) pow 2) ((dist(v3,v2) + g23 t) pow 2) (dist(v0,v3) pow 2)) real_continuous atreal (&0)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[Sphere.delta_x]; + BY(REPEAT (ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST] THEN REPEAT CONJ_TAC THEN (MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB))); + TYPIFY `&0 < delta_x (norm v3 pow 2) (norm v0 pow 2) (norm v2 pow 2) ((dist (v0,v2)) pow 2) ((dist (v3,v2)) pow 2) (dist (v0,v3) pow 2)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM Sphere.delta_y;arith `x pow 2 = x*x`;GSYM DIST_0]; + FIRST_X_ASSUM_ST `coplanar` kill; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,d,b,c}`]; + REWRITE_TAC[ Oxlzlez.coplanar_delta_y]; + BY(REWRITE_TAC[DIST_SYM]); + TYPIFY `&0 < ups_x (norm v0 pow 2) (norm v2 pow 2) ((dist (v0,v2)) pow 2)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `collinear` MP_TAC; + (REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS;DIST_0]); + BY(DISCH_THEN (unlist REWRITE_TAC)); + TYPIFY `~collinear {vec 0,v1,v2}` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM CROSS_EQ_0]; + DISCH_TAC; + FIRST_X_ASSUM_ST `(a cross b) dot (c cross d)` MP_TAC; + ASM_REWRITE_TAC[DOT_LZERO]; + BY(REAL_ARITH_TAC); + TYPIFY `&0 < ups_x (norm v1 pow 2) (norm v2 pow 2) ((dist (v1,v2)) pow 2)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `collinear` MP_TAC; + BY(REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS;DIST_0]); + TYPIFY `?e1. &0 < e1 /\ (!t. abs t < e1 ==> &0 < delta_x (norm v3 pow 2) (norm v0 pow 2) (norm v2 pow 2) ((dist(v0,v2) + g02 t) pow 2) ((dist(v3,v2) + g23 t) pow 2) (dist(v0,v3) pow 2))` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC continuous_nbd_pos [`(\t. delta_x (norm v3 pow 2) (norm v0 pow 2) (norm v2 pow 2) ((dist (v0,v2)+g02 t) pow 2) ((dist (v3,v2) + g23 t) pow 2) (dist (v0,v3) pow 2))`;`&0`]; + BY((ASM_REWRITE_TAC[arith `x + &0 = x`;arith `abs (t' - &0) = abs t'`])); + FIRST_X_ASSUM MP_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `?e2. &0 < e2 /\ (!t. abs t < e2 ==> &0 < dist (v3,v2) + g23 t /\ &0 < dist(v0,v2)+g02 t /\ &0 < dist(v1,v2)+g12 t)` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `(\t. (dist (v3,v2) + g23 t) ) real_continuous atreal (&0) /\ (\t. (dist (v0,v2) + g02 t) ) real_continuous atreal (&0) /\ (\t. (dist (v1,v2) + g12 t) ) real_continuous atreal (&0)` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC continuous_nbd_pos [`(\t. (dist (v3,v2) + g23 t) )`;`&0`]; + INTRO_TAC continuous_nbd_pos [`(\t. (dist (v0,v2) + g02 t) )`;`&0`]; + INTRO_TAC continuous_nbd_pos [`(\t. (dist (v1,v2) + g12 t) )`;`&0`]; + ASM_REWRITE_TAC[arith `x + &0 = x`;GSYM DIST_NZ;arith `abs (t' - &0) = abs t'`]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e'`;`e''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e''''`;`e'''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + BY(TYPIFY `e'''''` EXISTS_TAC THEN ASM_MESON_TAC[]); + BY(REPEAT CONJ_TAC THEN (REPEAT (ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST] THEN REPEAT CONJ_TAC THEN (MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB)))); + FIRST_X_ASSUM MP_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `!t. abs t < e2 ==> &0 < (dist (v3,v2) + g23 t) pow 2 /\ &0 < (dist (v0,v2) + g02 t) pow 2 /\ &0 < (dist (v1,v2) + g12 t) pow 2` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + BY(ASM_SIMP_TAC[arith `&0 < x ==> ~(x = &0)`]); + INTRO_TAC epsilon_pair [`e1`;`e2`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + COMMENT "distances on 023 triangle"; + TYPIFY `!t. abs t < e'' ==> norm v2 pow 2 = dist (f v2 t,vec 0) pow 2 /\ (dist (v0,v2)+g02 t) pow 2 = dist (f v2 t,v0) pow 2 /\ (dist (v3,v2) + g23 t) pow 2 = dist (f v2 t,v3) pow 2 /\ v3 dot (v0 cross f v2 t) > &0` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC PQCSXWG1_SYM [`(vec 0):real^3`;` v0 `;`v3`;`f v2 t`;` (norm v0 pow 2)`;` (norm v3 pow 2)`;`(norm v2 pow 2)`;` ((dist (v3,v2) + g23 t) pow 2)`;` ((dist (v0,v2)+ g02 t ) pow 2)`;` (dist (v0,v3) pow 2)`]; + REWRITE_TAC[VECTOR_SUB_RZERO]; + DISCH_THEN MATCH_MP_TAC; + ASM_SIMP_TAC[]; + REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; + EXPAND_TAC "f"; + (REWRITE_TAC[]); + EXPAND_TAC "f1"; + BY(REWRITE_TAC[]); + CONJ2_TAC; + FIRST_X_ASSUM_ST `delta_x` (C INTRO_TAC [`t`]); + ASM_SIMP_TAC[]; + BY(MESON_TAC[Merge_ineq.delta_x_sym]); + REWRITE_TAC[DIST_0]; + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + REWRITE_TAC[GSYM DIST_0]; + BY(ASM_REWRITE_TAC[DIST_EQ_0]); + COMMENT "continuity at f v2 t"; + INTRO_TAC epsilon_pair [`e`;`e''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `!t. abs t < e''' /\ ~coplanar{vec 0,v0,f v2 t,v3} ==> f v2 continuous atreal t` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `g23 real_continuous atreal t /\ g02 real_continuous atreal t` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT (FIRST_X_ASSUM_ST `real_continuous_on` MP_TAC); + REPEAT (GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT); + REWRITE_TAC[ Ocbicby.REAL_OPEN_REAL_INTERVAL;IN_REAL_INTERVAL;arith `-- e < t /\ t < e <=> abs t < e`]; + BY(REPEAT WEAKER_STRIP_TAC THEN CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + INTRO_TAC Pqcsxwg.PQCSXWG2_ATREAL [`(\ (t:real). (vec 0):real^3)`;`\ (t:real). v3`;`\ (t:real). v0`;`\ (t:real). (norm v3 pow 2)`;`\ (t:real). (norm v0 pow 2)`;`\ (t:real). (norm v2 pow 2)`;`\ (t:real). ((dist (v0,v2)+g02 t) pow 2)`;`\ (t:real). ((dist (v3,v2)+ g23 t) pow 2)`;`\ (t:real). (dist (v0,v3) pow 2)`;`t`]; + REWRITE_TAC[CONTINUOUS_CONST;REAL_CONTINUOUS_CONST]; + EXPAND_TAC "f"; + REWRITE_TAC[]; + EXPAND_TAC "f1"; + REWRITE_TAC[]; + DISCH_THEN MATCH_MP_TAC; + ASM_SIMP_TAC[]; + REWRITE_TAC[DIST_0;DIST_SYM]; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`] THEN ASM_REWRITE_TAC[]; + BY(CONJ_TAC THEN ((REPEAT (ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST] THEN REPEAT CONJ_TAC THEN (MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB))))); + COMMENT "coplanarity"; + TYPIFY `f v2 (&0) = v2` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "f"; + EXPAND_TAC "f1"; + ASM_REWRITE_TAC[arith `x + &0 = x`]; + INTRO_TAC mk_simplex_uniq [`(vec 0):real^3`;`v3`;`v0`;`v2`]; + REWRITE_TAC[GSYM DIST_0;DIST_SYM]; + DISCH_THEN MATCH_MP_TAC; + REWRITE_TAC[VECTOR_SUB_RZERO]; + ASM_REWRITE_TAC[]; + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `cross` kill); + FIRST_X_ASSUM_ST `cross` MP_TAC; + MATCH_MP_TAC (arith `a = b ==> a > &0 ==> b > &0`); + BY(VEC3_TAC); + TYPIFY `f v2 continuous atreal (&0)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `abs(&0) = &0`]); + INTRO_TAC Zlzthic.NONPLANAR_OPEN [`\ (t:real). (vec 0):real^3`;`\ (t:real). v0`;`\ (t:real). v3`;`f v2`;`&0`]; + ASM_REWRITE_TAC[CONTINUOUS_CONST;arith `abs(&0 - t)= abs t`]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "non collinearity 0, v0, v1"; + TYPIFY `?e3. &0 < e3 /\ (!t. abs t < e3 ==> &0 < ups_x (norm v1 pow 2) (norm v2 pow 2) ((dist (v1,v2) + g12 t) pow 2) /\ &0 < ups_x (norm v0 pow 2) (norm v2 pow 2) ((dist (v0,v2) + g02 t) pow 2))` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `(\t. ups_x (norm v1 pow 2) (norm v2 pow 2) ((dist (v1,v2) + g12 t) pow 2)) real_continuous atreal (&0) /\ (\t. ups_x (norm v0 pow 2) (norm v2 pow 2) ((dist (v0,v2) + g02 t) pow 2)) real_continuous atreal (&0)` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC continuous_nbd_pos [`(\t. ups_x (norm v1 pow 2) (norm v2 pow 2) ((dist (v1,v2) + g12 t) pow 2))`;`&0`]; + INTRO_TAC continuous_nbd_pos [`(\t. ups_x (norm v0 pow 2) (norm v2 pow 2) ((dist (v0,v2) + g02 t) pow 2))`;`&0`]; + ASM_REWRITE_TAC[arith `x + &0 = x`;arith `abs (t - &0) = abs t`]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e''''`;`e'''''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''''''` EXISTS_TAC; + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + BY(REWRITE_TAC[Sphere.ups_x] THEN CONJ_TAC THEN ((REPEAT (ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST] THEN REPEAT CONJ_TAC THEN (MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB))))); + FIRST_X_ASSUM MP_TAC THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e3`;`e'`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e'''`;`e''''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + COMMENT "continuity of f v1"; + TYPIFY `!t. abs t < e''''' ==> f v1 continuous atreal t` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `f v2 continuous atreal t /\ g12 real_continuous atreal t /\ g02 real_continuous atreal t` (C SUBGOAL_THEN ASSUME_TAC); + CONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]; + BY(CONJ_TAC THEN ASM_MESON_TAC[]); + REPEAT (FIRST_X_ASSUM_ST `real_continuous_on` MP_TAC); + REPEAT (GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT); + REWRITE_TAC[ Ocbicby.REAL_OPEN_REAL_INTERVAL;IN_REAL_INTERVAL;arith `-- e < t /\ t < e <=> abs t < e`]; + REPEAT WEAKER_STRIP_TAC THEN CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[]); + INTRO_TAC mk_planar2_continuous [`(\ (t:real). (vec 0):real^3)`;`f1 v2`;`\ (t:real). v0`; `\ (t:real). (norm v2 pow 2)`;`\ (t:real). (norm v0 pow 2)`;`\ (t:real). (norm v1 pow 2)`; `\ (t:real). ((dist (v1,v2)+g12 t) pow 2)`;`\ (t:real). ((dist (v0,v2)+ g02 t) pow 2)`;`t`;`-- &1`]; + REWRITE_TAC[CONTINUOUS_CONST;REAL_CONTINUOUS_CONST]; + EXPAND_TAC "f"; + ASM_REWRITE_TAC[]; + DISCH_THEN MATCH_MP_TAC; + TYPIFY_GOAL_THEN `&0 < ups_x (norm v2 pow 2) (norm v0 pow 2) ((dist (v0,v2) + g02 t) pow 2) /\ &0 < ups_x (norm v2 pow 2) (norm v1 pow 2) ((dist (v1,v2) + g12 t) pow 2)` (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `ups_x` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[DIST_SYM]; + BY(MESON_TAC[Merge_ineq.ups_x_sym]); + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + REWRITE_TAC[NORM_EQ_0]; + ASM_REWRITE_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM MP_TAC; + EXPAND_TAC "f"; + ASM_REWRITE_TAC[]; + TYPIFY `(\t. f1 v2 t) = f1 v2` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[FUN_EQ_THM]); + BY(MESON_TAC[]); + BY(CONJ_TAC THEN REPEAT (REPEAT CONJ_TAC THEN (MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB) THEN (ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST] ))); + COMMENT "distances on 012 triangle"; + TYPIFY `f1 v2 = f v2` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "f"; + BY(REWRITE_TAC[FUN_EQ_THM]); + TYPIFY `!t. abs t < e''''' ==> coplanar {vec 0, f v2 t, v0, f v1 t} /\ norm v1 pow 2 = dist (f v1 t,vec 0) pow 2 /\ (dist (v1,v2) + g12 t) pow 2 = dist (f v1 t,f v2 t) pow 2 /\ (?t'. &0 < t' /\ t' % (f v1 t cross f v2 t) = -- &1 % (f v2 t cross v0))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Eyypqdw.EYYPQDW [`(vec 0):real^3`;`f v2 t`;` v0 `;`f v1 t`;`(norm v2 pow 2)`;`(norm v0 pow 2)`;`(norm v1 pow 2)`;`((dist (v1,v2)+g12 t) pow 2)`;`((dist (v0,v2)+g02 t) pow 2)`;`-- &1`]; + REWRITE_TAC[VECTOR_SUB_RZERO]; + DISCH_THEN MATCH_MP_TAC; + ASM_SIMP_TAC[]; + REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; + EXPAND_TAC "f"; + (ASM_REWRITE_TAC[DIST_0]); + TYPIFY `norm (f v2 t) pow 2 = norm v2 pow 2 /\ dist(f v2 t,v0) pow 2 = (dist(v0,v2) + g02 t) pow 2` ENOUGH_TO_SHOW_TAC; + BY(DISCH_THEN (unlist REWRITE_TAC)); + BY(REPLICATE_TAC 20 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIST_0]); + TYPIFY `dist(f v2 t,vec 0) pow 2 = norm v2 pow 2` (C SUBGOAL_THEN SUBST1_TAC); + BY(REPLICATE_TAC 20 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + CONJ2_TAC; + FIRST_X_ASSUM_ST `ups_x` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(ASM_MESON_TAC[]); + BY(MESON_TAC[Merge_ineq.ups_x_sym]); + REWRITE_TAC[DIST_0;DIST_SYM]; + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + REWRITE_TAC[NORM_EQ_0]; + REWRITE_TAC[DIST_EQ_0]; + ASM_REWRITE_TAC[]; + CONJ2_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`]; + BY(ASM_MESON_TAC[Planarity.notcoplanar_imp_notcollinear_fan]); + CONJ2_TAC; + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[Planarity.notcoplanar_disjoint]); + MATCH_MP_TAC (arith `&0 < x ==> ~(x = &0)`); + BY(ASM_MESON_TAC[]); + COMMENT "final kill"; + TYPIFY `e'''''` EXISTS_TAC; + ASM_REWRITE_TAC[IN_REAL_INTERVAL;arith `-- e < t /\ t < e <=> abs t < e`;arith `abs(&0) = &0`;GSYM CONJ_ASSOC]; + REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; + REPEAT WEAKER_STRIP_TAC; + ASM_SIMP_TAC[]; + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `cross` (C INTRO_TAC [`t`])); + (ASM_SIMP_TAC[]); + REPEAT (GMATCH_SIMP_TAC (GSYM Collect_geom.EQ_POW2_COND)); + REWRITE_TAC[DIST_POS_LE;NORM_POS_LE]; + REPEAT (GMATCH_SIMP_TAC (arith `&0 < x ==> &0 <= x`)); + TYPIFY_GOAL_THEN ` &0 < dist (v3,v2) + g23 t /\ &0 < dist (v0,v2) + g02 t /\ &0 < dist (v1,v2) + g12 t` (unlist REWRITE_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[DIST_SYM]; + DISCH_THEN (unlist REWRITE_TAC); + DISCH_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,d,b,c}`]; + FIRST_X_ASSUM (unlist REWRITE_TAC); + BY(REWRITE_TAC[DIST_0]); + SUBCONJ2_TAC; + REPEAT WEAKER_STRIP_TAC; + EXPAND_TAC "f"; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + TYPIFY `f v1 (&0) = v1` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC mk_planar_unique [`(vec 0):real^3`;`v2`;`v0`;`f v1 (&0)`;`v1`]; + REWRITE_TAC[VECTOR_SUB_RZERO]; + DISCH_THEN MATCH_MP_TAC; + (TYPIFY `abs (&0) < e'''''` (C SUBGOAL_THEN ASSUME_TAC)); + BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY_GOAL_THEN `coplanar {vec 0, v2, v0, f v1 (&0)} /\ coplanar {vec 0, v2, v0, v1}` (unlist REWRITE_TAC); + CONJ_TAC; + FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`&0`]); + ASM_REWRITE_TAC[]; + BY(MESON_TAC[]); + BY(ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,c,d,b}`] THEN ASM_REWRITE_TAC[]); + CONJ_TAC; + REPLICATE_TAC 4 (FIRST_X_ASSUM_ST `coplanar` kill); + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`]; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + BY(MESON_TAC[Planarity.notcoplanar_imp_notcollinear_fan]); + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`&0`]); + ASM_REWRITE_TAC[]; + REPEAT (GMATCH_SIMP_TAC (GSYM Collect_geom.EQ_POW2_COND)); + REWRITE_TAC[DIST_POS_LE;NORM_POS_LE;arith `x + &0 = x`]; + REWRITE_TAC[DIST_0;DIST_SYM]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC collinear_expand [`v1`;`v2`;`v0`]; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,d,b,c}`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `cross` MP_TAC; + ASM_REWRITE_TAC[CROSS_RADD;CROSS_RMUL;CROSS_REFL]; + DISCH_TAC; + TYPIFY `t'/ t1` EXISTS_TAC; + GMATCH_SIMP_TAC REAL_LT_DIV; + FIRST_X_ASSUM_ST `(a cross b) dot (c cross d)` MP_TAC; + ASM_REWRITE_TAC[CROSS_LADD;CROSS_LMUL;DOT_RADD;DOT_RMUL;CROSS_REFL;DOT_RZERO]; + REWRITE_TAC[arith `x + t2 * &0 > &0 <=> &0 < x`]; + GMATCH_SIMP_TAC (CONJUNCT2 Real_ext.REAL_PROP_POS_LMUL); + REWRITE_TAC[DOT_POS_LT]; + CONJ_TAC; + REWRITE_TAC[CROSS_EQ_0]; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `t1 % ((t' / t1) % (f v1 (&0) cross v2)) = t1 % (v1 cross v2)` ENOUGH_TO_SHOW_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[VECTOR_MUL_LCANCEL_IMP;arith `&0 < t ==> ~(t = &0)`]); + REWRITE_TAC[VECTOR_MUL_ASSOC]; + TYPIFY `t1 * t' / t1 = t'` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `=` SUBST1_TAC; + BY(VEC3_TAC); + CONJ2_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `v = v2` ASM_CASES_TAC; + BY(ASM_MESON_TAC[]); + TYPIFY `v = v1` ASM_CASES_TAC; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `v = v1` ASM_CASES_TAC; + BY(ASM_MESON_TAC[]); + TYPIFY `v = v2` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `f (v2:real^3) = f1 v2` kill; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]; + BY(ASM_MESON_TAC[]); + TYPIFY `f v = (\t. v)` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[FUN_EQ_THM]; + GEN_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + BY(REWRITE_TAC[CONTINUOUS_CONST]) + ]);; + (* }}} *) + +let deform_planar_exists_second_version = prove_by_refinement( + `!V g12 g02 g23 v0 v1 v2 v3 e. ?f. + ( + (~coplanar {vec 0,v0,v2,v3} /\ coplanar {vec 0,v0,v1,v2} /\ + v2 dot (v3 cross v0) > &0 /\ + (v1 cross v2) dot (v0 cross v2) > &0 /\ ~(v1 = v0) /\ + &0 < e /\ + g23 real_continuous_on (real_interval (--e,e)) /\ + g23 (&0) = &0 /\ + g12 real_continuous_on (real_interval (--e,e)) /\ + g12 (&0) = &0 /\ + g02 real_continuous_on (real_interval (--e,e)) /\ + g02 (&0) = &0 + ==> + (?e'. &0 < e' /\ deformation f V (-- e', e') /\ + (!v t. ~(v = v1) /\ ~(v = v2) ==> f v t = v) /\ + (!t. abs t < e' ==> + coplanar {vec 0,v0,f v1 t,f v2 t} /\ + dist(f v1 t,f v2 t) = dist(v1,v2) + g12 t /\ + norm(f v1 t) = norm(v1) /\ + dist (f v2 t,v0) = dist(v2,v0) + g02 t /\ + dist (f v2 t,v3) = dist(v2,v3)+ g23 t /\ + norm(f v2 t) = norm (v2) + ))))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `f1 = (\ w t. if w = v2 then mk_simplex1 (vec 0) v3 v0 (norm v3 pow 2) (norm v0 pow 2) (norm v2 pow 2) ((dist(v0,v2) + g02 t) pow 2) ((dist(v3,v2) + g23 t) pow 2) (dist(v0,v3) pow 2) else w)`; + TYPED_ABBREV_TAC `f = (\ w t. if w = v2 then f1 v2 t else if w = v1 then mk_planar2 (vec 0) (f1 v2 t) v0 (norm v2 pow 2) (norm v0 pow 2) (norm v1 pow 2) ((dist(v1,v2)+ g12 t) pow 2) ((dist(v0,v2) + g02 t) pow 2) (-- &1) else w)`; + TYPIFY `f` EXISTS_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC deform_planar_second_version [`V`;` g12`;` g02`;` g23`;` v0`;` v1`;` v2`;` v3`;` e`]; + ASM_REWRITE_TAC[]; + LET_TAC; + ASM_REWRITE_TAC[]; + LET_TAC; + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let SKOLEM_PERIODIC = prove_by_refinement( + `!P k. (periodic P k) /\ ~(k = 0) /\ (!i e e'. e <= e' /\ P i e' ==> P i e) ==> + ((!i. ?e. &0 < e /\ P i e) <=> (?e. &0 < e /\ (!i. P i e)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[TAUT `(a <=> b) <=> ((b ==> a) /\ (a ==> b))`]; + CONJ_TAC; + BY(MESON_TAC[]); + DISCH_TAC; + TYPIFY `?e1. !i. &0 < e1 /\ (i IN (0..(k-1)) ==> (P i e1))` (C SUBGOAL_THEN MP_TAC); + GMATCH_SIMP_TAC (GSYM Zlzthic.SKOLEM_EPSILON); + REWRITE_TAC[FINITE_NUMSEG]; + CONJ_TAC; + BY(ASM_MESON_TAC[arith `t < e1 /\ e1 <= e' ==> t < e'`]); + GEN_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC Terminal.periodic_mod_reduce; + TYPIFY `k` EXISTS_TAC; + ASM_REWRITE_TAC[]; + CONJ2_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[IN_NUMSEG;arith `!i. 0 <= i`]); + BY(ASM_SIMP_TAC[arith `!i. ~(k=0) ==> (i < k <=> i <= k-1)`]); + FIRST_X_ASSUM_ST `periodic` MP_TAC; + REWRITE_TAC[Oxl_def.periodic;FUN_EQ_THM]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let SKOLEM_PERIODIC2 = prove_by_refinement( + `!P k. (periodic2 P k) /\ ~(k = 0) /\ (!i j e e'. e <= e' /\ P i j e' ==> P i j e) ==> + ((!i j. ?e. &0 < e /\ P i j e) <=> (?e. &0 < e /\ (!i j. P i j e)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[TAUT `(a <=> b) <=> ((b ==> a) /\ (a ==> b))`]; + CONJ_TAC; + BY(MESON_TAC[]); + DISCH_TAC; + TYPIFY `?e1. !i. &0 < e1 /\ (i IN (0..(k-1)) ==> (!j. j IN (0..(k-1)) ==> P i j e1))` (C SUBGOAL_THEN MP_TAC); + GMATCH_SIMP_TAC (GSYM Zlzthic.SKOLEM_EPSILON); + REWRITE_TAC[FINITE_NUMSEG]; + CONJ_TAC; + BY(ASM_MESON_TAC[arith `t < e1 /\ e1 <= e' ==> t < e'`]); + GEN_TAC; + REWRITE_TAC[MESON[arith `&0 < &1`] `(?e1. &0 < e1 /\ (a ==> (!j. j IN s ==> b j e1))) <=> (a ==> (?e1. !j. &0 < e1 /\ (j IN s ==> b j e1)))`]; + DISCH_TAC; + GMATCH_SIMP_TAC (GSYM Zlzthic.SKOLEM_EPSILON); + REWRITE_TAC[FINITE_NUMSEG]; + CONJ_TAC; + BY(ASM_MESON_TAC[arith `t < e1 /\ e1 <= e' ==> t < e'`]); + GEN_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e1` EXISTS_TAC; + SUBCONJ_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + MATCH_MP_TAC Terminal.periodic2_mod_reduce; + TYPIFY `k` EXISTS_TAC; + ASM_REWRITE_TAC[]; + CONJ2_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[IN_NUMSEG;arith `!i. 0 <= i`]); + BY(ASM_SIMP_TAC[arith `!i. ~(k=0) ==> (i < k <=> i <= k-1)`]); + FIRST_X_ASSUM_ST `periodic2` MP_TAC; + REWRITE_TAC[Appendix.periodic2;FUN_EQ_THM]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let scs_k_bounds = prove_by_refinement( + `!s. is_scs_v39 s ==> 3 <= scs_k_v39 s /\ scs_k_v39 s <= 6`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Appendix.is_scs_v39] THEN REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let deformation_BBs = prove_by_refinement( + `!s k f v e. + is_scs_v39 s /\ + scs_k_v39 s = k /\ + BBs_v39 s v /\ + scs_generic v /\ + &0 < e /\ + deformation f (IMAGE v (:num)) (--e,e) /\ + (!i t. (let FF = IMAGE (\i. (v i, v (SUC i))) (:num) in + (t IN real_interval (-- e, e) /\ + interior_angle1 (vec 0) FF (v i) = pi + ==> interior_angle1 (vec 0) + (IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) + (f (v i) t) <= + pi))) /\ +// (!i. ?e0. azim (vec 0) (v i) (v (i+1)) (v (i + (k-1))) = pi ==> +// (!t. abs t < e0 ==> azim (vec 0) (f (v i) t) (f (v (i+1)) t) (f (v (i+(k-1))) t) <= pi)) /\ + (!i. (!t. abs t < e ==> norm (f (v i) t) = norm (v i))) /\ + (!i j. ?e1. &0 < e1 /\ (scs_a_v39 s i j = dist(v i,v j) ==> + (!t. abs t < e1 ==> scs_a_v39 s i j <= dist(f (v i) t,f (v j) t)))) /\ + (!i j. ?e2. &0 < e2 /\ (dist(v i,v j) = scs_b_v39 s i j ==> + (!t. abs t < e2 ==> dist(f (v i) t,f (v j) t) <= scs_b_v39 s i j))) ==> + (?e'. &0 < e' /\ (!t. abs t < e' ==> BBs_v39 s (\i. f (v i) t))) + `, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.BBs_v39;LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!t. periodic (\i. f (v i) t) (scs_k_v39 s)` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + FIRST_X_ASSUM_ST `periodic` MP_TAC; + REWRITE_TAC[Oxl_def.periodic]; + BY(MESON_TAC[]); + ASM_REWRITE_TAC[]; + COMMENT "skolem reduction"; + TYPIFY `(?e3. &0 < e3 /\ (~(k<= 3) ==> (!t. (abs t < e3 ==> convex_local_fan (IMAGE (\i. f (v i) t) (:num), IMAGE (\i. {f (v i) t, f (v (SUC i)) t}) (:num), IMAGE (\i. f (v i) t,f (v (SUC i)) t) (:num)))))) /\ (!i j. ?e1. &0 < e1 /\ (!t. abs t < e1 ==> scs_a_v39 s i j <= dist (f (v i) t,f (v j) t))) /\ (!i j. ?e2. &0 < e2 /\ (!t. abs t < e2 ==> dist (f (v i) t,f (v j) t) <= scs_b_v39 s i j))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `scs_a_v39` MP_TAC; + GMATCH_SIMP_TAC SKOLEM_PERIODIC2; + CONJ_TAC; + TYPIFY `k` EXISTS_TAC; + nCONJ_TAC 1; + BY(ASM_MESON_TAC[scs_k_bounds;arith `3 <= k ==> ~(k=0)`]); + CONJ_TAC; + REWRITE_TAC[Appendix.periodic2]; + FIRST_X_ASSUM_ST `periodic` MP_TAC; + ASM_REWRITE_TAC[Oxl_def.periodic;FUN_EQ_THM]; + DISCH_TAC THEN ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; + ASM_REWRITE_TAC[Appendix.is_scs_v39;Appendix.periodic2]; + BY(REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + COMMENT "skolem on b"; + FIRST_X_ASSUM_ST `scs_b_v39` MP_TAC; + GMATCH_SIMP_TAC SKOLEM_PERIODIC2; + CONJ_TAC; + TYPIFY `k` EXISTS_TAC; + nCONJ_TAC 1; + BY(ASM_MESON_TAC[scs_k_bounds;arith `3 <= k ==> ~(k=0)`]); + CONJ_TAC; + REWRITE_TAC[Appendix.periodic2]; + FIRST_X_ASSUM_ST `periodic` MP_TAC; + ASM_REWRITE_TAC[Oxl_def.periodic;FUN_EQ_THM]; + DISCH_TAC THEN ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; + ASM_REWRITE_TAC[Appendix.is_scs_v39;Appendix.periodic2]; + BY(REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_quad [`e1`;`e2`;`e3`;`e`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''''` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + FIRST_X_ASSUM_ST `ball_annulus` MP_TAC; + REWRITE_TAC[Terminal.IMAGE_SUBSET_IN;IN_UNIV;Fnjlbxs.in_ball_annulus]; + BY(ASM_SIMP_TAC[]); + CONJ_TAC; + REPEAT STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_SIMP_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_SIMP_TAC[]); + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + TYPIFY `!i. f (v i) (&0) = v i` (C SUBGOAL_THEN ASSUME_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[Localization.deformation;Terminal.IMAGE_SUBSET_IN;IN_UNIV]); + ASM_TAC THEN REPEAT WEAKER_STRIP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC; + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + TYPIFY `!i j. ( \ t. dist(f (v i) t,f (v j) t)) real_continuous atreal (&0)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + RULE_ASSUM_TAC (REWRITE_RULE[Localization.deformation]) THEN ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `!i. (f (v i)) continuous atreal (&0)` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + FIRST_X_ASSUM_ST `continuous` (C INTRO_TAC [`v i`;`&0`]); + DISCH_THEN MATCH_MP_TAC; + ASM_REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + (REPEAT (REPEAT CONJ_TAC THEN (MATCH_MP_TAC Local_lemmas1.CON_ATREAL_REAL_CON2_REDO ORELSE MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB) THEN (ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST] ))); + TYPIFY_GOAL_THEN `!i w. (\ t. f w t) = f w` (unlist ASM_REWRITE_TAC); + BY(REWRITE_TAC[FUN_EQ_THM]); + nCONJ_TAC 2; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `dist(v i,v j) = scs_b_v39 s i j` ASM_CASES_TAC; + BY(REPLICATE_TAC 6 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + INTRO_TAC continuous_nbd_pos [`(\t. scs_b_v39 s i j - dist(f (v i) t,f (v j) t))`;`&0`]; + ANTS_TAC; + CONJ2_TAC; + REWRITE_TAC[]; + BY(ASM_MESON_TAC[arith `d <= b /\ ~(d = b) ==> &0 < b - d`]); + BY((REPEAT (REPEAT CONJ_TAC THEN ( MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB) THEN (ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST] )))); + REWRITE_TAC[arith `abs (t - &0) = abs t`]; + BY(MESON_TAC[arith `&0 < b - d ==> d <= b`]); + ASM_REWRITE_TAC[]; + CONJ2_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `scs_a_v39 s i j = dist(v i,v j)` ASM_CASES_TAC; + BY(REPLICATE_TAC 9 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + INTRO_TAC continuous_nbd_pos [`(\t. dist(f (v i) t,f (v j) t) - scs_a_v39 s i j) `;`&0`]; + ANTS_TAC; + CONJ2_TAC; + REWRITE_TAC[]; + BY(ASM_MESON_TAC[arith `a <= d /\ ~(a =d) ==> &0 < d - a`]); + BY((REPEAT (REPEAT CONJ_TAC THEN ( MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB) THEN (ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST] )))); + REWRITE_TAC[arith `abs (t - &0) = abs t`]; + BY(MESON_TAC[arith `&0 < d - a ==> a <= d`]); + TYPED_ABBREV_TAC `V = IMAGE v (:num)`; + TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`; + TYPED_ABBREV_TAC `FF = IMAGE (\i. (v i, v (SUC i))) (:num)`; + ASM_CASES_TAC `(k <= 3)`; + ASM_REWRITE_TAC[]; + BY(MESON_TAC[arith `&0 < &1`]); + ASM_REWRITE_TAC[]; + INTRO_TAC Zlzthic.ZLZTHIC [`-- e`;`e`;`V`;`E`;`FF`;`f`]; + MATCH_MP_TAC (TAUT (`(b ==> c) /\ a ==> ((a ==> b) ==> c)`)); + CONJ_TAC; + REWRITE_TAC[arith `-- e < t /\ t < e <=> abs t < e`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e'` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `convex_local_fan` (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[]; + TYPIFY `IMAGE (\v. f v t) V = IMAGE (\i. f (v i) t) (:num) /\ IMAGE (IMAGE (\v. f v t)) E = IMAGE (\i. {f (v i) t, f (v (SUC i)) t}) (:num) /\ IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF = IMAGE (\i. f (v i) t,f (v (SUC i)) t) (:num)` ENOUGH_TO_SHOW_TAC; + DISCH_THEN (unlist REWRITE_TAC); + BY(DISCH_THEN (unlist REWRITE_TAC)); + MAP_EVERY EXPAND_TAC ["V";"E";"FF"]; + REWRITE_TAC[GSYM IMAGE_o]; + BY(REPEAT CONJ_TAC THEN AP_THM_TAC THEN AP_TERM_TAC THEN REWRITE_TAC[FUN_EQ_THM;o_THM;IMAGE_CLAUSES]); + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + BY(ASM_MESON_TAC[Appendix.scs_generic]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?i. v' = v i` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM_ST `(v':real^3) IN V` MP_TAC; + EXPAND_TAC "V"; + BY(REWRITE_TAC[IN_IMAGE;IN_UNIV]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]) + ]);; + (* }}} *) + +let vv_azim_le_alt = prove_by_refinement( + `!vv k i j. + (let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + let f = IMAGE (\i. vv i,vv (SUC i)) (:num) in + ( + periodic vv k /\ 3 <= k /\ + convex_local_fan (V,E,f) /\ + (!i j. i < k /\ j < k /\ vv i = vv j ==> (i = j)) + ==> azim (vec 0) (vv i) (vv (SUC i)) (vv j) <= azim (vec 0) (vv i) (vv (SUC i)) (vv (i + k - 1))))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(k=0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + INTRO_TAC Terminal.PRIOR_TO_LESS_THAN_PI_LEMMA_ALT [`IMAGE vv (:num)`; `IMAGE (\i. {vv i, vv (SUC i)}) (:num)`; `IMAGE (\i. vv i,vv (SUC i)) (:num)`;`vv i`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(SET_TAC[]); + DISCH_THEN (C INTRO_TAC [`vv j`]); + ANTS_TAC; + BY(SET_TAC[]); + INTRO_TAC Terminal.vv_rho_node1 [`vv`;`k`]; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN (unlist REWRITE_TAC); + GMATCH_SIMP_TAC Terminal.EE_vv; + TYPIFY `k` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]; + ]);; + (* }}} *) + +let vv_split_azim_alt = prove_by_refinement( + `!vv k i j. + (let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + let f = IMAGE (\i. vv i,vv (SUC i)) (:num) in + (periodic vv k /\ 3 <= k /\ + ~collinear {vec 0, vv i, vv j} /\ + ~collinear {vec 0, vv i, vv (i + k - 1)} /\ + ~collinear {vec 0, vv i, vv (SUC i)} /\ + convex_local_fan (V,E,f) /\ + (!i j. i < k /\ j < k /\ vv i = vv j ==> (i = j)) + ==> azim (vec 0) (vv i) (vv (SUC i)) (vv (i + k - 1)) = + azim (vec 0) (vv i) (vv (SUC i)) (vv j) + + azim (vec 0) (vv i) (vv j) (vv (i + k - 1))))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(k=0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + INTRO_TAC vv_azim_le_alt [`vv`;`k`;`i`;`j`]; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + MATCH_MP_TAC Fan.sum4_azim_fan; + ASM_REWRITE_TAC[]; + ]);; + (* }}} *) + +(* vv_split_azim_generic_alt -> Terminal.vv_split_azim_generic *) + +let interior_angle1_azim = prove_by_refinement( + `!V E FF v. + local_fan (V,E,FF) /\ v IN V ==> + interior_angle1 (vec 0) FF v = azim (vec 0) v (rho_node1 FF v) (ivs_rho_node1 FF v)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC Zlzthic.LOFA_IMP_INANGLE_EQ_AZIM; + TYPIFY `E` EXISTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[Local_lemmas1.AZIM_IN_FAN_RHOND_IVS_RHOND]) + ]);; + (* }}} *) + +(* Ocbicby.INTERIOR_ANGLE1_AZIM *) + +let LOFA_IMP_INANGLE_EQ_AZIM_IVS = prove_by_refinement( + `!V E FF v. local_fan (V,E,FF) /\ v IN V ==> + (interior_angle1 (vec 0) FF v = azim (vec 0) v (rho_node1 FF v) (ivs_rho_node1 FF v)) `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC Zlzthic.LOFA_IMP_INANGLE_EQ_AZIM; + TYPIFY `E` EXISTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[Local_lemmas1.AZIM_IN_FAN_RHOND_IVS_RHOND]) + ]);; + (* }}} *) + +let BBs_inj = prove_by_refinement( + `!s v k. + is_scs_v39 s /\ + scs_k_v39 s = k /\ + BBs_v39 s v ==> (!i j. i < k /\ j < k /\ v i = v j ==> i = j)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + INTRO_TAC Ocbicby.scs_lb_2 [`s`;`v`;`i`;`j`]; + ASM_REWRITE_TAC[DIST_REFL;arith `~(&2 <= &0)`]; + BY(ASM_SIMP_TAC[MOD_LT]) + ]);; + (* }}} *) + +let IMAGE_FF = prove_by_refinement( + `!FF f t. IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF = IMAGE (\ (u,v). f u t,f v t) FF`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + BY((REWRITE_TAC[EXTENSION;IN_IMAGE;EXISTS_PAIR_THM])) + ]);; + (* }}} *) + +let interior_angle1_azim_scs = prove_by_refinement( + `!s v k i f e. + (let V = IMAGE v (:num) in + let FF = IMAGE (\i. v i,v (SUC i)) (:num) in + ( + &0 < e /\ + deformation f V (-- e, e) /\ + is_scs_v39 s /\ + scs_k_v39 s = k /\ + 3 < k /\ + BBs_v39 s v ==> + (?e'. &0 < e' /\ + (!t. abs t < e' ==> + interior_angle1 (vec 0) (IMAGE (\ (u,v). (f u t, f v t)) FF) (f (v i) t) = + azim (vec 0) (f (v i) t) (f (v (i+1)) t) (f (v (i + (k-1))) t)))))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REPEAT (LET_TAC); + TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC; + ASM_REWRITE_TAC[Appendix.BBs_v39;LET_DEF;LET_END_DEF]; + BY(ASM_MESON_TAC[arith `3 < k ==> ~(k <= 3)`;Local_lemmas.CVX_LO_IMP_LO]); + INTRO_TAC (GEN_ALL Lunar_deform.XRECQNS_UPDATE) [`--e`;`e`;`V`;`E`;`f`;`FF`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `v i IN V` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "V"; + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + INTRO_TAC Zlzthic.deformation_rho_node1_equivariant1 [`f`;`V`;`E`;`FF`;`-- e`;`e`;`v i`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC Zlzthic.deformation_ivs_rho_node1_equivariant1 [`f`;`V`;`E`;`FF`;`-- e`;`e`;`v i`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!t. IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF = IMAGE (\ (u,v). f u t,f v t) FF` (C SUBGOAL_THEN ASSUME_TAC); + BY((REWRITE_TAC[EXTENSION;IN_IMAGE;EXISTS_PAIR_THM])); + TYPIFY `e'` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `local_fan` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC LOFA_IMP_INANGLE_EQ_AZIM_IVS [`IMAGE (\v. f v t) V`;` IMAGE (\s. IMAGE (\v. f v t) s) E`;` IMAGE (\(u,v). f u t,f v t) FF`;`f (v i) t`]; + ANTS_TAC; + ASM_SIMP_TAC[]; + EXPAND_TAC "V"; + REWRITE_TAC[GSYM IMAGE_o]; + REWRITE_TAC[IN_IMAGE;IN_UNIV;o_THM]; + BY(MESON_TAC[]); + DISCH_THEN SUBST1_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM (SUBST1_TAC o GSYM)); + INTRO_TAC BBs_inj [`s`;`v`;`k`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `periodic v k` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC; + REWRITE_TAC[Appendix.BBs_v39]; + ASM_REWRITE_TAC[LET_DEF;LET_END_DEF]; + BY((DISCH_THEN (unlist REWRITE_TAC))); + INTRO_TAC Terminal.vv_rho_node1 [`v`;`k`]; + ASM_REWRITE_TAC[LET_DEF;LET_END_DEF]; + ASM_SIMP_TAC[arith `3 < k==> 3 <= k`]; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC VV_SUC_EQ_IVS_RHO_NODE_PRIME [`V`;`E`;`FF`;`s`;`v`;`v i`;`k`;`i`]; + ASM_REWRITE_TAC[]; + BY(ASM_SIMP_TAC[arith `3 < k==> ~(k <= 3)`;arith `SUC i = i +1`]) + ]);; + (* }}} *) + +let deformation_BBs_ALT = prove_by_refinement( + `!s k f v e. + is_scs_v39 s /\ + scs_k_v39 s = k /\ + 3 < k /\ + BBs_v39 s v /\ + scs_generic v /\ + &0 < e /\ + deformation f (IMAGE v (:num)) (--e,e) /\ + (!i. ?e0. &0 < e0 /\ (azim (vec 0) (v i) (v (i+1)) (v (i + (k-1))) = pi ==> + (!t. abs t < e0 ==> azim (vec 0) (f (v i) t) (f (v (i+1)) t) (f (v (i+(k-1))) t) <= pi))) /\ + (!i. (!t. abs t < e ==> norm (f (v i) t) = norm (v i))) /\ + (!i j. ?e1. &0 < e1 /\ (scs_a_v39 s i j = dist(v i,v j) ==> + (!t. abs t < e1 ==> scs_a_v39 s i j <= dist(f (v i) t,f (v j) t)))) /\ + (!i j. ?e2. &0 < e2 /\ (dist(v i,v j) = scs_b_v39 s i j ==> + (!t. abs t < e2 ==> dist(f (v i) t,f (v j) t) <= scs_b_v39 s i j))) ==> + (?e'. &0 < e' /\ (!t. abs t < e' ==> BBs_v39 s (\i. f (v i) t))) + `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC deformation_BBs; + TYPIFY `k` EXISTS_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `azim` MP_TAC; + TYPIFY `periodic v k` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC; + ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;Appendix.BBs_v39]; + BY(MESON_TAC[]); + DISCH_TAC; + GMATCH_SIMP_TAC SKOLEM_PERIODIC; + CONJ_TAC; + TYPIFY `k` EXISTS_TAC; + ASM_SIMP_TAC[arith `3 < k ==> ~(k=0)`]; + CONJ_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Oxl_def.periodic;FUN_EQ_THM]; + BY(ASM_SIMP_TAC[arith `3 < k ==> ((i + k) + 1 = (i+1)+k /\ (i+k)+k-1 = (i+k-1) + k)`]); + BY(MESON_TAC[arith `e0 <= e' /\ t < e0 ==> t < e'`]); + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC ` FF = IMAGE (\i. (v i,v (SUC i))) (:num)`; + TYPIFY `!i. (?e'. &0 < e' /\ (!t. abs t < e' ==> interior_angle1 (vec 0) (IMAGE (\ (u,v). (f u t, f v t)) FF) (f (v i) t) = azim (vec 0) (f (v i) t) (f (v (i+1)) t) (f (v (i + (k-1))) t)))` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + EXPAND_TAC "FF"; + MATCH_MP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] interior_angle1_azim_scs); + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM MP_TAC; + GMATCH_SIMP_TAC SKOLEM_PERIODIC; + CONJ_TAC; + TYPIFY `k` EXISTS_TAC; + ASM_SIMP_TAC[arith `3 < k ==> ~(k=0)`]; + CONJ_TAC; + FIRST_X_ASSUM_ST `periodic` MP_TAC; + REWRITE_TAC[Oxl_def.periodic;FUN_EQ_THM]; + BY(ASM_SIMP_TAC[arith `3 < k ==> ((i + k) + 1 = (i+1)+k /\ (i+k)+k-1 = (i+k-1) + k)`]); + BY(MESON_TAC[arith `e0 <= e' /\ t < e0 ==> t < e'`]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_triple [`e'`;`e0`;`e`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''''` EXISTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM_ST `deformation` MP_TAC; + REWRITE_TAC[Localization.deformation]; + TYPIFY `!r. r IN real_interval (--e'''',e'''') ==> r IN real_interval (--e,e)` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + REWRITE_TAC[IN_REAL_INTERVAL]; + BY(ASM_SIMP_TAC[arith `&0 < e ==> -- e < &0`]); + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + BY(ASM_REWRITE_TAC[IN_REAL_INTERVAL;arith `-- e < r /\ r < e <=> abs r < e`]); + CONJ2_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[LET_DEF;LET_END_DEF]; + ASM_REWRITE_TAC[IN_REAL_INTERVAL;arith `-- e < r /\ r < e <=> abs r < e`]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[IMAGE_FF]; + FIRST_X_ASSUM GMATCH_SIMP_TAC; + ASM_SIMP_TAC[]; + TYPIFY `interior_angle1 (vec 0) FF (v i) = azim (vec 0) (v i) (v (i + 1)) (v (i + k - 1))` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[]); + EXPAND_TAC "FF"; + GMATCH_SIMP_TAC (GSYM (REWRITE_RULE[LET_DEF;LET_END_DEF] Ocbicby.INTERIOR_ANGLE1_AZIM)); + TYPIFY `s` EXISTS_TAC; + BY(ASM_REWRITE_TAC[arith `SUC i = i+1`;IN]) + ]);; + (* }}} *) + +let periodic2_MOD = prove_by_refinement( + `!(a:num->num->A) i j k. ~(k=0) /\ periodic2 a k ==> a i j = a (i MOD k) (j MOD k)`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.periodic2]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `periodic (a i) k` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[Oxl_def.periodic]; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC (Oxl_def.periodic_mod) [`a i`;`k`;`j`]; + DISCH_THEN GMATCH_SIMP_TAC; + TYPIFY `periodic (\i. a i (j MOD k)) k` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[Oxl_def.periodic]; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC (Oxl_def.periodic_mod) [`\i. a i (j MOD k)`;`k`;`i`]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let MOD_periodic2 = prove_by_refinement( + `!(a:num->num->A) k. ~(k=0) /\ (!i j. a i j = a (i MOD k) (j MOD k)) ==> periodic2 a k`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.periodic2]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (unlist ONCE_REWRITE_TAC); + ONCE_REWRITE_TAC[arith `i+k = 1*k + i`]; + BY(REWRITE_TAC[MOD_MULT_ADD]) + ]);; + (* }}} *) + +let azim_dominated_split = prove_by_refinement( + `!v0 v1 v2 v3 v4 v0' v1' v2' v3' v4'. + ~collinear {v0', v1', v3'} /\ + ~collinear {v0', v1', v4'} /\ + ~collinear {v0', v1', v2'} /\ + azim v0 v1 v2 v3 + azim v0 v1 v3 v4 = azim v0 v1 v2 v4 /\ + azim v0' v1' v2' v3' <= azim v0 v1 v2 v3 /\ + azim v0' v1' v3' v4' <= azim v0 v1 v3 v4 ==> + azim v0' v1' v2' v3' + azim v0' v1' v3' v4' = azim v0' v1' v2' v4'`, + + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC (GSYM Fan.sum3_azim_fan); + INTRO_TAC Local_lemmas.AZIM_RANGE [`v0`;`v1`;`v2`;`v4`]; + ASM_REWRITE_TAC[]; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let assumptions = `(!i. ?e0. &0 < e0 /\ (azim (vec 0) (v i) (v (i+1)) (v (i + (k-1))) = pi ==> + (!t. abs t < e0 ==> azim (vec 0) (f (v i) t) (f (v (i+1)) t) (f (v (i+(k-1))) t) <= pi))) /\ + (!i. (!t. abs t < e ==> norm (f (v i) t) = norm (v i))) /\ + (!i j. ?e1. &0 < e1 /\ (scs_a_v39 s i j = dist(v i,v j) ==> + (!t. abs t < e1 ==> scs_a_v39 s i j <= dist(f (v i) t,f (v j) t)))) /\ + (!i j. ?e2. &0 < e2 /\ (dist(v i,v j) = scs_b_v39 s i j ==> + (!t. abs t < e2 ==> dist(f (v i) t,f (v j) t) <= scs_b_v39 s i j)))`;; + +let I_IMP = prove_by_refinement( + `!(x:bool). I x ==> x`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[I_THM]) + ]);; + (* }}} *) + +let psort_inj = prove_by_refinement( + `!k a b c d. psort k (a,b) = psort k (c,d) ==> ((a MOD k = c MOD k) \/ (a MOD k = d MOD k))`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.psort;LET_THM]; + REPEAT GEN_TAC; + BY(REPEAT COND_CASES_TAC THEN REWRITE_TAC[PAIR_EQ] THEN DISCH_THEN (unlist ASM_REWRITE_TAC)) + ]);; + (* }}} *) + +let a_assumption_reduction = prove_by_refinement( + `!s k p1 f v e. + is_scs_v39 s /\ + scs_k_v39 s = k /\ + BBs_v39 s v /\ + 3 < k /\ + (!i j. scs_diag k i j /\ ~(psort k (i, j) = psort k (p1+1,p1+k-1)) ==> scs_a_v39 s i j < dist(v i,v j)) /\ + deformation f (IMAGE v (:num)) (--e,e) /\ + (!w t. ~(w = v p1) ==> (f w t = w)) /\ + (?e1. &0 < e1 /\ (scs_a_v39 s p1 (p1 + 1) = dist (v p1, v(p1+1)) ==> + (!t. abs t < e1 ==> scs_a_v39 s p1 (p1+1) <= dist(f (v p1) t,f (v (p1+1)) t)))) /\ + (?e1. &0 < e1 /\ (scs_a_v39 s p1 (p1 + k-1) = dist (v p1, v(p1+ k - 1)) ==> + (!t. abs t < e1 ==> scs_a_v39 s p1 (p1+k-1) <= dist(f (v p1) t,f (v (p1+k - 1)) t)))) + ==> + (!i j. ?e1. &0 < e1 /\ (scs_a_v39 s i j = dist(v i,v j) ==> + (!t. abs t < e1 ==> scs_a_v39 s i j <= dist(f (v i) t,f (v j) t)))) + `, + (* {{{ proof *) + [ + REPEAT GEN_TAC THEN DISCH_TAC THEN MATCH_MP_TAC I_IMP THEN ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(k=0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_SIMP_TAC[arith `3 < k ==> ~(k=0)`]); + TYPIFY `!i j.scs_a_v39 s (i MOD k) (j MOD k) = scs_a_v39 s i j /\ scs_b_v39 s (i MOD k) (j MOD k) = scs_b_v39 s i j ` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; + ASM_REWRITE_TAC[Appendix.is_scs_v39]; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[periodic2_MOD]); + TYPIFY `!i. i MOD k < k` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION]); + TYPIFY `periodic v k` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN MESON_TAC[]); + TYPIFY `!i. v (i MOD k) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[]); + INTRO_TAC BBs_inj [`s`;`v`;`k`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!j. j < k ==> (j MOD k = j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[MOD_LT]); + COMMENT "scs_a_v39"; + REWRITE_TAC[I_THM]; + MATCH_MP_TAC Terminal.periodic2_mod_reduce; + TYPIFY `k` EXISTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC MOD_periodic2; + BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[] THEN MESON_TAC[]); + TYPIFY `!j. j < k ==> (?e1. &0 < e1 /\ (scs_a_v39 s p1 j = dist (v p1,v j) ==> (!t. abs t < e1 ==> scs_a_v39 s p1 j <= dist (f (v p1) t,f (v j) t))))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `i = ( p1 MOD k)` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`j`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e1''` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `scs_a_v39 s (p1 MOD k) j = scs_a_v39 s p1 j ` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + TYPIFY `j = p1 MOD k` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`i`]); + ASM_REWRITE_TAC[DIST_SYM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e1''` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `scs_a_v39 s i (p1 MOD k) = scs_a_v39 s i p1 ` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN MESON_TAC[]); + TYPIFY `&1` EXISTS_TAC; + REWRITE_TAC[arith `&0 < &1`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!w t. ~(w = v p1) ==> f w t = w` ( (C FIRST_ASSUM_ST GMATCH_SIMP_TAC)); + TYPIFY `!w t. ~(w = v p1) ==> f w t = w` ( (C FIRST_X_ASSUM_ST GMATCH_SIMP_TAC)); + ASM_SIMP_TAC[arith `a = b ==> a <= b`]; + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(p1 MOD k = (p1+1) MOD k) /\ ~(p1 MOD k = (p1 + k-1) MOD k)` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `(p1 MOD k = (p1 +0) MOD k)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[arith `i+0=i`]); + REPEAT (GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT); + REPEAT (GMATCH_SIMP_TAC MOD_LT); + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + TYPIFY `~(psort k (p1,j) = psort k (p1+1,p1+k-1))` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[psort_inj]); + TYPIFY `scs_diag k p1 j` ASM_CASES_TAC; + TYPIFY `&1` EXISTS_TAC; + BY(REWRITE_TAC[arith `&0 < &1`] THEN ASM_MESON_TAC[arith `a < b ==> ~(a =b)`]); + FIRST_X_ASSUM_ST `scs_diag` MP_TAC; + REWRITE_TAC[Appendix.scs_diag;DE_MORGAN_THM]; + COMMENT "final cases"; + STRIP_TAC; + TYPIFY `&1` EXISTS_TAC; + REWRITE_TAC[arith `&0 < &1`]; + TYPIFY `dist (v p1, v j) = dist(v (p1 MOD k),v (p1 MOD k))` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[]); + REWRITE_TAC[DIST_REFL]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[DIST_POS_LE]); + TYPIFY `e1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `v j = v (p1 + 1)` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[arith `SUC p1 = (p1 + 1)`]); + TYPIFY `scs_a_v39 s p1 j = scs_a_v39 s p1 (p1+1)` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[arith `SUC p1 = (p1+1)`]); + BY(ASM_REWRITE_TAC[]); + TYPIFY `e1'` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `j MOD k = (p1 + k - 1) MOD k` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `j MOD k = (SUC j+ (k-1)) MOD k` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + ONCE_REWRITE_TAC[arith `(a:num) + b = b + a`]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + BY(ASM_REWRITE_TAC[]); + ASM_SIMP_TAC [arith `3< k ==> SUC j + k - 1 = 1 * k + j`]; + REWRITE_TAC[MOD_MULT_ADD]; + BY(ASM_MESON_TAC[]); + TYPIFY `v j = v (p1 + k - 1)` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[]); + TYPIFY `scs_a_v39 s p1 j = scs_a_v39 s p1 (p1+k-1)` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[]); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let b_assumption_reduction = prove_by_refinement( + `!s k p1 f v e. + is_scs_v39 s /\ + scs_k_v39 s = k /\ + BBs_v39 s v /\ + 3 < k /\ + (!i j. scs_diag k i j ==> &4 * h0 < scs_b_v39 s i j) /\ +// (!t. norm (f (v p1) t) = norm (v p1)) /\ + deformation f (IMAGE v (:num)) (--e,e) /\ + (!w t. ~(w = v p1) ==> (f w t = w)) /\ + (?e1. &0 < e1 /\ (dist (v p1, v(p1+1)) = scs_b_v39 s p1 (p1 + 1) ==> + (!t. abs t < e1 ==> dist(f (v p1) t,f (v (p1+1)) t) <= scs_b_v39 s p1 (p1+1)))) /\ + (?e1. &0 < e1 /\ (dist (v p1, v(p1+ k - 1)) = scs_b_v39 s p1 (p1 + k-1) ==> + (!t. abs t < e1 ==> dist(f (v p1) t,f (v (p1+k - 1)) t) <= scs_b_v39 s p1 (p1+k-1)))) + ==> + (!i j. ?e1. &0 < e1 /\ (dist(v i,v j) = scs_b_v39 s i j ==> + (!t. abs t < e1 ==> dist(f (v i) t,f (v j) t) <= scs_b_v39 s i j))) + `, + (* {{{ proof *) + [ + REPEAT GEN_TAC THEN DISCH_TAC THEN MATCH_MP_TAC I_IMP THEN ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(k=0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_SIMP_TAC[arith `3 < k ==> ~(k=0)`]); + TYPIFY `!i j.scs_b_v39 s (i MOD k) (j MOD k) = scs_b_v39 s i j /\ scs_b_v39 s (i MOD k) (j MOD k) = scs_b_v39 s i j ` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; + ASM_REWRITE_TAC[Appendix.is_scs_v39]; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[periodic2_MOD]); + TYPIFY `!i. i MOD k < k` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION]); + TYPIFY `periodic v k` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN MESON_TAC[]); + TYPIFY `!i. v (i MOD k) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[]); + INTRO_TAC BBs_inj [`s`;`v`;`k`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!j. j < k ==> (j MOD k = j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[MOD_LT]); + COMMENT "scs_b_v39"; + REWRITE_TAC[I_THM]; + MATCH_MP_TAC Terminal.periodic2_mod_reduce; + TYPIFY `k` EXISTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC MOD_periodic2; + BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[] THEN MESON_TAC[]); + TYPIFY `!j. j < k ==> (?e1. &0 < e1 /\ (dist (v p1,v j) = scs_b_v39 s p1 j ==> (!t. abs t < e1 ==> dist (f (v p1) t,f (v j) t) <= scs_b_v39 s p1 j)))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `i = ( p1 MOD k)` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`j`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e1''` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `scs_b_v39 s (p1 MOD k) j = scs_b_v39 s p1 j ` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + TYPIFY `j = p1 MOD k` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`i`]); + ASM_REWRITE_TAC[DIST_SYM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e1''` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `scs_b_v39 s i (p1 MOD k) = scs_b_v39 s i p1 ` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN MESON_TAC[]); + TYPIFY `&1` EXISTS_TAC; + REWRITE_TAC[arith `&0 < &1`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!w t. ~(w = v p1) ==> f w t = w` ( (C FIRST_ASSUM_ST GMATCH_SIMP_TAC)); + TYPIFY `!w t. ~(w = v p1) ==> f w t = w` ( (C FIRST_X_ASSUM_ST GMATCH_SIMP_TAC)); + ASM_SIMP_TAC[arith `a = b ==> a <= b`]; + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(p1 MOD k = (p1+1) MOD k) /\ ~(p1 MOD k = (p1 + k-1) MOD k)` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `(p1 MOD k = (p1 +0) MOD k)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[arith `i+0=i`]); + REPEAT (GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT); + REPEAT (GMATCH_SIMP_TAC MOD_LT); + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + TYPIFY `~(psort k (p1,j) = psort k (p1+1,p1+k-1))` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[psort_inj]); + TYPIFY `scs_diag k p1 j` ASM_CASES_TAC; + TYPIFY `&1` EXISTS_TAC; + (REWRITE_TAC[arith `&0 < &1`]); + TYPIFY `dist(v p1,v j) <= &4 * h0` ENOUGH_TO_SHOW_TAC; + FIRST_X_ASSUM_ST `&4 * h0` (C INTRO_TAC [`p1`;`j`]); + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + INTRO_TAC DIST_TRIANGLE [`v p1`;`(vec 0):real^3`;`v j`]; + REWRITE_TAC[DIST_0]; + TYPIFY `!i. norm (v i) <= &2 * h0` ENOUGH_TO_SHOW_TAC; + BY(DISCH_TAC THEN FIRST_ASSUM (C INTRO_TAC [`p1`]) THEN FIRST_X_ASSUM (C INTRO_TAC [`j`]) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + BY(FIRST_X_ASSUM_ST `ball_annulus` MP_TAC THEN REWRITE_TAC[Terminal.IMAGE_SUBSET_IN;IN_UNIV] THEN MESON_TAC[Fnjlbxs.in_ball_annulus]); + FIRST_X_ASSUM_ST `scs_diag` MP_TAC; + REWRITE_TAC[Appendix.scs_diag;DE_MORGAN_THM]; + COMMENT "final cases"; + STRIP_TAC; + TYPIFY `&1` EXISTS_TAC; + REWRITE_TAC[arith `&0 < &1`]; + TYPIFY `v j = v p1` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[]); + REWRITE_TAC[DIST_REFL]; + BY(MESON_TAC[arith `&0 <= &0`]); + TYPIFY `e1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `v j = v (p1 + 1)` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[arith `SUC p1 = (p1 + 1)`]); + TYPIFY `scs_b_v39 s p1 j = scs_b_v39 s p1 (p1+1)` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[arith `SUC p1 = (p1+1)`]); + BY(ASM_REWRITE_TAC[]); + TYPIFY `e1'` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `j MOD k = (p1 + k - 1) MOD k` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `j MOD k = (SUC j+ (k-1)) MOD k` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + ONCE_REWRITE_TAC[arith `(a:num) + b = b + a`]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + BY(ASM_REWRITE_TAC[]); + ASM_SIMP_TAC [arith `3< k ==> SUC j + k - 1 = 1 * k + j`]; + REWRITE_TAC[MOD_MULT_ADD]; + BY(ASM_MESON_TAC[]); + TYPIFY `v j = v (p1 + k - 1)` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[]); + TYPIFY `scs_b_v39 s p1 j = scs_b_v39 s p1 (p1+k-1)` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[]); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let MOD_SHIFT = prove_by_refinement( + `!k a b c. ~(k=0) /\ a MOD k = b MOD k ==> (a + c) MOD k = (b + c) MOD k`, + (* {{{ proof *) + [ + BY(MESON_TAC[MOD_ADD_MOD]) + ]);; + (* }}} *) + +let WNWSHJT_ALT = prove_by_refinement( + `!w0 w1 w2 f a b c. + deformation f {w0,w1,w2} (a,b) /\ + ~collinear {vec 0, w1,w2} /\ + ~collinear {vec 0, w1,w0} /\ + &0 < azim (vec 0) w1 w2 w0 /\ + azim (vec 0) w1 w2 w0 < c ==> + (?e. &0 < e /\ + (!t. abs t < e ==> + &0 < azim (vec 0) (f w1 t) (f w2 t) (f w0 t) /\ + azim (vec 0) (f w1 t) (f w2 t) (f w0 t) < c))`, + (* {{{ proof *) + [ + REWRITE_TAC[IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY;Localization.deformation]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `(?e. &0 < e /\ (!t. abs t < e ==> azim (vec 0) (f w1 t) (f w2 t) (f w0 t) < c)) /\ (?e. &0 < e /\ (!t. abs t < e ==> &0 < azim (vec 0) (f w1 t) (f w2 t) (f w0 t)))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e`;`e'`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''` EXISTS_TAC; + BY(ASM_MESON_TAC[]); + TYPIFY `(f w1) continuous atreal (&0) /\ (f w2) continuous atreal (&0) /\ (f w0) continuous atreal (&0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[]); + TYPIFY `!a b. (\t. a + b * azim ((\ t. (vec 0)) t) (f w1 t) (f w2 t) (f w0 t)) real_continuous atreal (&0)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT GEN_TAC; + REPEAT (MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC (* Xbjrphc. *)REAL_CONTINUOUS_ATREAL_AZIM_COMPOSE THEN ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST;CONTINUOUS_CONST]); + GMATCH_SIMP_TAC (GSYM Local_lemmas.AZIM_EQ_0_GE_ALT2); + FIRST_X_ASSUM_ST `f v (&0) = v` (REPEAT o GMATCH_SIMP_TAC); + TYPIFY_GOAL_THEN `!v. (\t . f v t) = f v` (unlist REWRITE_TAC); + BY(REWRITE_TAC[FUN_EQ_THM]); + ASM_REWRITE_TAC[]; + BY(ASM_REWRITE_TAC[GSYM Zlzthic.azim_pos_iff_nz]); + CONJ_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`c`;`-- &1`]); + DISCH_TAC; + INTRO_TAC continuous_nbd_pos [`(\t. c + -- &1 * azim ((\t. vec 0) t) (f w1 t) (f w2 t) (f w0 t))`;`&0`]; + ASM_REWRITE_TAC[arith `&0 < c + -- &1 * a <=> a < c`;arith `abs(t' - &0) = abs t'`]; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM (C INTRO_TAC [`&0`;`&1`]); + DISCH_TAC; + INTRO_TAC continuous_nbd_pos [`(\t. &0 + &1 * azim ((\t. vec 0) t) (f w1 t) (f w2 t) (f w0 t))`;`&0`]; + ASM_REWRITE_TAC[arith `&0 < &0 + &1 * a <=> &0 < a`;arith `abs(t' - &0) = abs t'`]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let azim_assumption_reduction = prove_by_refinement( +`!s k p1 f v e. + is_scs_v39 s /\ + scs_k_v39 s = k /\ + BBs_v39 s v /\ + scs_generic v /\ + 3 < k /\ + ~coplanar {vec 0,v p1,v (p1+1),v(p1 + k-1)} /\ + deformation f (IMAGE v (:num)) (--e,e) /\ + (!w t. ~(w = v p1) ==> f w t = w) /\ + azim (vec 0) (v p1) (v (p1 + 1)) (v (p1 + k - 1)) < pi /\ + (azim (vec 0) (v (p1 + k - 1)) (v p1) (v (p1 + k - 2)) < pi \/ + (?e1. &0 < e1 /\ + (!t. abs t < e1 + ==> azim (vec 0) (v (p1 + k - 1)) (f (v p1) t) (v (p1 + 1)) <= + azim (vec 0) (v (p1 + k - 1)) (v p1) (v (p1 + 1))))) /\ + (azim (vec 0) (v (p1 + 1)) (v (p1 + 2)) (v p1) < pi \/ + (?e1. &0 < e1 /\ + (!t. abs t < e1 + ==> azim (vec 0) (v (p1 + 1)) (v (p1 + k - 1)) (f (v p1) t) <= + azim (vec 0) (v (p1 + 1)) (v (p1 + k - 1)) ( (v p1))))) + ==> + ( azim (vec 0) (v (p1 + k - 1)) (v p1) (v (p1 + k - 2)) = + azim (vec 0) (v (p1 + k - 1)) (v p1) (v (p1 + 1)) + + azim (vec 0) (v (p1 + k - 1)) (v (p1 + 1)) (v (p1 + k - 2)) /\ + azim (vec 0) (v (p1 + 1)) (v (p1 + 2)) (v p1) = + azim (vec 0) (v (p1 + 1)) (v (p1 + 2)) (v (p1 + k - 1)) + + azim (vec 0) (v (p1 + 1)) (v (p1 + k - 1)) (v p1) /\ + (!i t. ~(p1 MOD k = i MOD k) /\ ~(p1 MOD k = (i+1) MOD k) /\ ~(p1 MOD k = (i+k-1) MOD k) ==> + azim (vec 0) (f(v i) t) (f (v(i+1)) t) (f(v(i+k-1))t) = azim (vec 0) (v i) (v (i+1)) (v(i+k-1))) /\ + (!i t. (p1 MOD k = (i) MOD k) ==> + azim (vec 0) (f(v i) t) (f (v(i+1)) t) (f(v(i+k-1))t) = azim (vec 0) (f(v p1)t) (v (p1+1)) (v(p1+k-1))) /\ + (!i t. (p1 MOD k = (i+1) MOD k) ==> + azim (vec 0) (f(v i) t) (f (v(i+1)) t) (f(v(i+k-1))t) = azim (vec 0) ((v (p1+k-1))) (f(v(p1))t) (v(p1+k-2))) /\ + (!i t. (p1 MOD k = (i+k-1) MOD k) ==> + azim (vec 0) (f(v i) t) (f (v(i+1)) t) (f(v(i+k-1))t) = azim (vec 0) ((v( p1+1))) (v (p1+2)) (f(v p1)t)) /\ +(!i. ?e0. &0 < e0 /\ + (azim (vec 0) (v i) (v (i + 1)) (v (i + k - 1)) = pi + ==> (!t. abs t < e0 + ==> azim (vec 0) (f (v i) t) (f (v (i + 1)) t) + (f (v (i + k - 1)) t) <= + pi))) /\ + (?e1. &0 < e1 /\ + (!t. abs t < e1 + ==> azim (vec 0) (v (p1 + k - 1)) (f (v p1) t) + (v (p1 + k - 2)) = + azim (vec 0) (v (p1 + k - 1)) (f (v p1) t) + (v (p1 + 1)) + + azim (vec 0) (v (p1 + k - 1)) (v (p1 + 1)) + (v (p1 + k - 2)) /\ + azim (vec 0) (v (p1 + 1)) (v (p1 + 2)) (f (v p1) t) = + azim (vec 0) (v (p1 + 1)) (v (p1 + 2)) + (v (p1 + k - 1)) + + azim (vec 0) (v (p1 + 1)) (v (p1 + k - 1)) + (f (v p1) t))) /\ + (!t. f (v (p1 + 1)) t = v (p1 + 1) /\ + f (v (p1 + k - 1)) t = v (p1 + k - 1) /\ + f (v (p1 + k - 2)) t = v (p1 + k - 2) /\ + f (v (p1 + 2)) t = v (p1 + 2)) +)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(k=0) /\ ~(k<= 3)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_SIMP_TAC[arith `3 < k ==> ~(k=0) /\ ~(k<= 3)`]); + TYPIFY `!i. i MOD k < k` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION]); + TYPIFY `periodic v k` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN MESON_TAC[]); + TYPIFY `!i. v (i MOD k) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[]); + INTRO_TAC BBs_inj [`s`;`v`;`k`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!j. j < k ==> (j MOD k = j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[MOD_LT]); + TYPIFY ` generic (IMAGE v (:num)) (IMAGE (\i. {v i, v (SUC i)}) (:num)) /\ convex_local_fan (IMAGE v (:num), IMAGE (\i. {v i, v (SUC i)}) (:num), IMAGE (\i. v i,v (SUC i)) (:num))` (C SUBGOAL_THEN ASSUME_TAC); + CONJ2_TAC; + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[LET_THM;Appendix.BBs_v39]; + BY(MESON_TAC[]); + BY(FIRST_X_ASSUM_ST `scs_generic` MP_TAC THEN MESON_TAC[Appendix.scs_generic]); + FIRST_X_ASSUM MP_TAC THEN BURY_MP_TAC; + COMMENT "first addition"; + SUBCONJ_TAC; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`k`;`p1 + k - 1`;`2`;`k-1`]; + TYPIFY_GOAL_THEN `v (SUC (p1+k-1)) = v p1 /\ v ((p1 + k - 1) + (k-1)) = v(p1 + k - 2) /\ v ((p1 + k - 1) + 2) = v (p1 + 1)` (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `3 (SUC (p1 + k - 1) = (1* k + p1) /\ (p1+k-1)+k-1 = (1*k + (p1 + k - 2)) /\ (p1+k-1)+2 = (1*k + (p1+1)))`]; + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[MOD_MULT_ADD]); + REWRITE_TAC[LET_THM] THEN DISCH_THEN MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM_ST `3 (SUC (p1 +1) = (p1+2) /\ (p1+1)+k-1 = (1*k + (p1)) /\ (p1+1)+k-2 = ((p1+k-1)))`]; + BY(REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[MOD_MULT_ADD;arith `SUC (p1+1)=p1+2`]); + REWRITE_TAC[LET_THM] THEN DISCH_THEN MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM_ST `3 ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[]); + TYPIFY `~(v i = v p1) /\ ~(v (i+1) = v p1) /\ ~(v (i+k-1) = v p1)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT CONJ_TAC THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + BY((FIRST_X_ASSUM MP_TAC) THEN FIRST_X_ASSUM_ST `!w t. ~(w = v p1) ==> f w t = w` MP_TAC THEN MESON_TAC[]); + ASM_REWRITE_TAC[]; + SUBCONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_ASSUM_ST `v (i MOD k) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); + INTRO_TAC MOD_SHIFT [`k`;`i`;`p1`]; + FIRST_X_ASSUM_ST `~(k=0)` MP_TAC THEN FIRST_X_ASSUM (MP_TAC o GSYM) THEN SIMP_TAC[]; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + SUBCONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `i MOD k = (p1 + k - 1) MOD k` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC MOD_SHIFT [`k`;`p1`;`i+1`;`k-1`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + BY(ASM_SIMP_TAC[arith `~(k=0) ==> ((i+1)+ k - 1 = 1*k+i)`;MOD_MULT_ADD]); + FIRST_ASSUM_ST `v (i MOD k) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); + INTRO_TAC MOD_SHIFT [`k`;`i`;`p1+k-1`]; + FIRST_X_ASSUM_ST `~(k=0)` MP_TAC THEN FIRST_X_ASSUM (MP_TAC) THEN SIMP_TAC[]; + SIMP_TAC[arith `~(k <= 3) ==> ((p1 +k-1)+1 = 1*k+p1 /\ (p1+k-1)+k-1 = 1*k + (p1+k-2))`;MOD_MULT_ADD]; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + SUBCONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `i MOD k = (p1 + 1) MOD k` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC MOD_SHIFT [`k`;`p1`;`i+k-1`;`1`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + BY(ASM_SIMP_TAC[arith `~(k=0) ==> ((i+k-1)+ 1 = 1*k+i)`;MOD_MULT_ADD]); + FIRST_ASSUM_ST `v (i MOD k) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); + INTRO_TAC MOD_SHIFT [`k`;`i`;`p1+1`]; + FIRST_X_ASSUM_ST `~(k=0)` MP_TAC THEN FIRST_X_ASSUM (MP_TAC) THEN SIMP_TAC[]; + SIMP_TAC[arith `(p1+1)+1 = p1+2 /\ (~(k <= 3) ==> (p1+1)+k-1 = 1*k + (p1))`;MOD_MULT_ADD]; + BY(ASM_REWRITE_TAC[]); + (DISCH_TAC); + COMMENT "restart here"; + TYPIFY `!i j. ~(v i = v j) ==> ~collinear {vec 0,v i, v j}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT GEN_TAC THEN DISCH_TAC; + MATCH_MP_TAC Zlzthic.PROPERTIES_GENERIC_LOCAL_FAN_ALT; + GEXISTL_TAC [`IMAGE v (:num)`;`IMAGE (\i. {v i, v (SUC i)}) (:num)`;`IMAGE (\i. (v i, v (SUC i))) (:num)`]; + ASM_REWRITE_TAC[IN_IMAGE;IN_UNIV]; + CONJ_TAC; + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM]); + BY(MESON_TAC[]); + TYPIFY `~collinear {vec 0,v (p1+k-1),v (p1+1)} /\ ~collinear {vec 0,v (p1+k-1),v p1} /\ ~collinear {vec 0,v(p1+k-2),v(p1+k-1)} /\ ~collinear {vec 0,v (p1+1),v p1} /\ ~collinear {vec 0,v (p1+1),v(p1+2)}` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `v p1 = v (p1 + 0)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[arith `p1 + 0 = p1`]); + TYPIFY `!i j. i < k /\ j < k /\ ~(i = j) ==> ~collinear {vec 0,v (p1 + i), v(p1 + (j:num))}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT GEN_TAC THEN DISCH_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN (FIRST_ASSUM_ST `v (i MOD k ) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM)); + TYPIFY_GOAL_THEN `!i j. i < k /\ j < (k:num) /\ ~(i = j) ==> ~(v i = v j)` MATCH_MP_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `(i< (k:num))` MP_TAC) THEN MESON_TAC[]); + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + ASM_REWRITE_TAC[]; + BY(ASM_SIMP_TAC[]); + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM_ST `~(k=0)` MP_TAC THEN TRY ARITH_TAC); + COMMENT "deform collinear"; + TYPIFY `!i. ~collinear {vec 0,v i,v p1} ==> (?e1. &0 < e1 /\ (!t. abs t < e1 ==> ~collinear {vec 0, v i, f (v p1) t}))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GEN_ALL Local_lemmas1.CONTINUOUS_PRESERVE_COLLINEAR) [`&0`;`(vec 0):real^3`;`( \ (t:real). v i)`;`f (v p1)`]; + ANTS_TAC; + ASM_REWRITE_TAC[CONTINUOUS_CONST]; + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation]; + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + BY(REWRITE_TAC[arith `abs(&0 - r') = abs r'`]); + COMMENT "insert"; + TYPIFY `!i. azim (vec 0) (v i) (v (i+1)) (v(i+k-1)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[arith `i+1 = SUC i`]; + GEN_TAC; + MATCH_MP_TAC (REWRITE_RULE[LET_THM] Terminal.convex_local_fan_azim_le_pi); + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC [arith `~(k <= 3) ==> 3 <= k`]; + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM]; + BY(DISCH_THEN (unlist REWRITE_TAC)); + COMMENT "do sums"; + TYPIFY `(?e1. &0 < e1 /\ (!t. abs t < e1 ==> azim (vec 0) (v (p1 + k - 1)) (f (v p1) t) (v (p1 + k - 2)) = azim (vec 0) (v (p1 + k - 1)) (f (v p1) t) (v (p1 + 1)) + azim (vec 0) (v (p1 + k - 1)) (v (p1 + 1)) (v (p1 + k - 2)) /\ azim (vec 0) (v (p1 + k - 1)) (f (v p1) t) (v (p1 + k - 2)) <= pi)) /\ (?e1. &0 < e1 /\ (!t. abs t < e1 ==> azim (vec 0) (v (p1 + 1)) (v (p1 + 2)) (f (v p1) t) = azim (vec 0) (v (p1 + 1)) (v (p1 + 2)) (v (p1 + k - 1)) + azim (vec 0) (v (p1 + 1)) (v (p1 + k - 1)) (f (v p1) t) /\ azim (vec 0) (v (p1 + 1)) (v (p1 + 2)) (f (v p1) t) <= pi))` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `&0 < azim (vec 0) (v (p1+k-1)) (v p1) (v (p1+1)) /\ &0 < azim (vec 0) (v (p1+1)) (v (p1+k-1)) (v p1)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[Zlzthic.azim_pos_iff_nz]; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + BY(MESON_TAC[Local_lemmas1.AZIM_COND_FOR_COPLANAR;SET_RULE `{a,b,c,d} = {a,d,b,c}`;SET_RULE `{a,b,c,d}={a,c,d,b}`]); + CONJ_TAC; + TYPIFY `azim (vec 0) (v (p1 + k - 1)) ( (v p1) ) (v (p1 + k - 2)) < pi` ASM_CASES_TAC; + INTRO_TAC WNWSHJT_ALT [`v(p1+1)`;`v (p1+k-1)`;`v p1`;`f`;`-- e`;`e`;`pi - azim (vec 0) (v (p1+k-1)) (v (p1+1)) (v (p1+k-2))`]; + ANTS_TAC; + ASM_REWRITE_TAC[arith `a < pi - b <=> a + b < pi`]; + CONJ_TAC; + MATCH_MP_TAC Zlzthic.deformation_subset; + TYPIFY `IMAGE v (:num)` EXISTS_TAC; + ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY;IN_UNIV]; + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `collinear` (C INTRO_TAC [`p1 +k-1`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e1`;`e'`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''` EXISTS_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + SUBCONJ_TAC; + MATCH_MP_TAC Fan.sum3_azim_fan; + ASM_REWRITE_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM_ST `( /\ )` (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + BY(MP_TAC PI_POS THEN REAL_ARITH_TAC); + CONJ_TAC; + BY(ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`] THEN ASM_REWRITE_TAC[]); + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + DISCH_THEN SUBST1_TAC; + FIRST_X_ASSUM_ST `( /\ )` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + BY(REAL_ARITH_TAC); + TYPIFY `(?e1. &0 < e1 /\ (!t. abs t < e1 ==> azim (vec 0) (v (p1 + k - 1)) (f (v p1) t) (v (p1 + 1)) <= azim (vec 0) (v (p1 + k - 1)) (v p1) (v (p1 + 1))))` (C SUBGOAL_THEN MP_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN REPEAT (FIRST_X_ASSUM_ST `( \/ )` MP_TAC) THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `collinear` (C INTRO_TAC [`(p1+k-1)`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e1`;`e1'`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''` EXISTS_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC azim_dominated_split [`(vec 0):real^3`;`v (p1+k-1)`;`v p1`;`v (p1+1)`;`v (p1+k-2)`;`(vec 0):real^3`;`v (p1+k-1)`;`f (v p1) t`;`v (p1+1)`;`v (p1+k-2)`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`] THEN ASM_REWRITE_TAC[]); + CONJ_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + REWRITE_TAC[arith `x <= x`]; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + DISCH_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (SUBST1_TAC o GSYM); + TYPIFY `azim (vec 0) (v (p1 + k - 1)) (v p1) (v (p1 + k - 2)) <= pi` ENOUGH_TO_SHOW_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `azim` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `x <= pi` (C INTRO_TAC [`p1 + k - 1`]); + FIRST_ASSUM_ST `v (i MOD k) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); + TYPIFY `((p1 + k - 1) + 1 ) MOD k = p1 MOD k /\ ((p1+k-1) + k-1) MOD k = (p1+k - 2) MOD k` ENOUGH_TO_SHOW_TAC; + BY(DISCH_THEN (unlist REWRITE_TAC)); + FIRST_X_ASSUM_ST `~(k=0)` MP_TAC; + BY(SIMP_TAC[arith `~(k <= 3) ==> (p1 + k - 1) + 1 = (1*k + p1) /\ ((p1+k-1)+k-1 = 1*k + (p1+k-2))`;MOD_MULT_ADD]); + COMMENT "second branch"; + TYPIFY `azim (vec 0) (v (p1 + 1)) (v (p1 + 2) ) (v (p1)) < pi` ASM_CASES_TAC; + INTRO_TAC WNWSHJT_ALT [`v(p1)`;`v (p1+1)`;`v (p1+k-1)`;`f`;`-- e`;`e`;`pi - azim (vec 0) (v (p1+1)) (v (p1+2)) (v (p1+k-1))`]; + ANTS_TAC; + ASM_REWRITE_TAC[arith `a < pi - b <=> b + a < pi`]; + CONJ_TAC; + MATCH_MP_TAC Zlzthic.deformation_subset; + TYPIFY `IMAGE v (:num)` EXISTS_TAC; + ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY;IN_UNIV;IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + CONJ_TAC; + BY(ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`] THEN ASM_REWRITE_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `collinear` (C INTRO_TAC [`p1 +1`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e1`;`e'`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''` EXISTS_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + SUBCONJ_TAC; + MATCH_MP_TAC Fan.sum3_azim_fan; + ASM_REWRITE_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM_ST `( /\ )` (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + BY(MP_TAC PI_POS THEN REAL_ARITH_TAC); + CONJ_TAC; + BY(ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`] THEN ASM_REWRITE_TAC[]); + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + DISCH_THEN SUBST1_TAC; + FIRST_X_ASSUM_ST `( /\ )` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + COMMENT "second asm"; + TYPIFY `(?e1. &0 < e1 /\ (!t. abs t < e1 ==> azim (vec 0) (v (p1 + 1)) (v (p1 + k - 1)) (f (v p1) t) <= azim (vec 0) (v (p1 + 1)) (v (p1 + k - 1)) ( (v p1) )))` (C SUBGOAL_THEN MP_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN REPEAT (FIRST_X_ASSUM_ST `( \/ )` MP_TAC) THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `collinear` (C INTRO_TAC [`(p1+1)`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e1`;`e1'`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''` EXISTS_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC azim_dominated_split [`(vec 0):real^3`;`v (p1+1)`;`v (p1+2)`;`v (p1+k-1)`;`v (p1)`;`(vec 0):real^3`;`v (p1+1)`;`v (p1+2)`;`v (p1+k-1)`;`f (v p1) t`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`] THEN ASM_REWRITE_TAC[]); + CONJ_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + REWRITE_TAC[arith `x <= x`]; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + DISCH_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (SUBST1_TAC o GSYM); + TYPIFY `azim (vec 0) (v (p1 + 1)) (v (p1+2)) (v (p1)) <= pi` ENOUGH_TO_SHOW_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `azim` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `x <= pi` (C INTRO_TAC [`p1 + 1`]); + FIRST_ASSUM_ST `v (i MOD k) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); + TYPIFY `((p1 + 1) + k - 1) MOD k = p1 MOD k` ENOUGH_TO_SHOW_TAC; + DISCH_THEN (unlist REWRITE_TAC); + BY(REWRITE_TAC[arith `(p1 + 1) + 1 = p1 + 2`]); + FIRST_X_ASSUM_ST `~(k=0)` MP_TAC; + BY(SIMP_TAC[arith `~(k <= 3) ==> ((p1 + 1) + k - 1 = 1*k + p1)`;MOD_MULT_ADD]); + COMMENT "final kill"; + TYPIFY `!i. (f (v i) (&0)) = v i` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation]; + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + COMMENT "final kill"; + FIRST_X_ASSUM_ST `azim` MP_TAC THEN REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + GEN_TAC; + TYPIFY `~(p1 MOD k = i MOD k) /\ ~(p1 MOD k = (i + 1) MOD k) /\ ~(p1 MOD k = (i + k - 1) MOD k)` ASM_CASES_TAC; + TYPIFY `&1` EXISTS_TAC; + REWRITE_TAC[arith `&0 < &1`]; + ASM_SIMP_TAC[]; + BY(REWRITE_TAC[arith `pi <= pi`]); + RULE_ASSUM_TAC (REWRITE_RULE[DE_MORGAN_THM]); + FIRST_X_ASSUM MP_TAC THEN REPEAT STRIP_TAC; + TYPIFY ` azim (vec 0) (v i) (v (i + 1)) (v (i + k - 1)) < pi` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[arith `x < pi ==> ~(x =pi)`;arith `&0 < &1`]); + TYPIFY `azim (vec 0) (v i) (v (i + 1)) (v (i + k - 1)) = azim (vec 0) (v p1) (v (p1 + 1)) (v (p1 + k - 1))` ENOUGH_TO_SHOW_TAC; + BY(DISCH_THEN SUBST1_TAC THEN ASM_REWRITE_TAC[]); + REPEAT (FIRST_X_ASSUM_ST `MOD` (C INTRO_TAC [`i`;`&0`])) THEN ASM_REWRITE_TAC[]; + BY(MESON_TAC[]); + TYPIFY `e1` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + ASM_SIMP_TAC[]; + FIRST_X_ASSUM_ST `p1+k-2` (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + TYPIFY `e1'` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + ASM_SIMP_TAC[]; + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + COMMENT "last one"; + INTRO_TAC epsilon_pair [`e1`;`e1'`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + BY(CONJ_TAC THEN FIRST_X_ASSUM MP_TAC THEN (REPLICATE_TAC 4 (FIRST_X_ASSUM (C INTRO_TAC [`t`]))) THEN TRY REAL_ARITH_TAC) + ]);; + (* }}} *) + +let sin_azim_pos = prove_by_refinement( + `!v1 v2 v3 v4. &0 < sin (azim v1 v2 v3 v4) <=> (&0 < azim v1 v2 v3 v4 /\ azim v1 v2 v3 v4 < pi)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + BY(MESON_TAC[SIN_POS_PI;SIN_POS_PI_REV;Local_lemmas.AZIM_RANGE;arith `x < y ==> x <= y`]) + ]);; + (* }}} *) + +let dih_x5_mono = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + &0 < x1 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 /\ + &0 < ups_x x1 x2 x6 /\ + &0 < ups_x x1 x3 x5 /\ + delta_x6 x1 x2 x3 x4 x5 x6 < &0 ==> + (?e. &0 < e /\ (!t. abs t < e /\ (t <= &0) ==> + dih_x x1 x2 x3 x4 (x5+t) x6 <= dih_x x1 x2 x3 x4 x5 x6))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY ` (?e1. &0 < e1 /\ (!t. abs t < e1 ==> &0 < delta_x x1 x2 x3 x4 (x5+t) x6)) /\ (?e2. &0 < e2 /\ (!t. abs t < e2 ==> &0 < ups_x x1 x3 (x5+t))) /\ (?e3. &0 < e3 /\ (!t. abs t < e3 ==> delta_x6 x1 x2 x3 x4 (x5+t) x6 < &0))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_triple [`e1`;`e2`;`e3`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e'''` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `!x. x IN real_interval [x5 + t,x5] ==> (?t1. t1 <= &0 /\ abs t1 < e''' /\ x = x5 + t1)` (C SUBGOAL_THEN ASSUME_TAC); + BY(GEN_TAC THEN REWRITE_TAC[IN_REAL_INTERVAL] THEN DISCH_TAC THEN TYPIFY `x - x5` EXISTS_TAC THEN REPLICATE_TAC 3(FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + INTRO_TAC REAL_MVT_VERY_SIMPLE [`\q. dih_x x1 x2 x3 x4 q x6`;`\ q. (--sqrt x1 * delta_x6 x1 x2 x3 x4 q x6 / (ups_x x1 x3 q * sqrt (delta_x x1 x2 x3 x4 q x6)))`;`x5+t`;`x5`]; + REWRITE_TAC[]; + ANTS_TAC; + ASM_SIMP_TAC[arith `t <= &0 ==> x5 + t <= x5`]; + X_GEN_TAC `x5':real`; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`x5'`]) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Ocbicby.derived_form_dih_x_wrt_x5 [`x1`;`x2`;`x3`;`x4`;`x5'`;`x6`]; + REWRITE_TAC[Calc_derivative.derived_form;WITHINREAL_UNIV]; + ASM_SIMP_TAC[]; + DISCH_TAC; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_ATREAL_WITHIN; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[arith `a <= b <=> &0 <= b - a`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `&0 <= (-- s * d / dn) * (x5 - (x5 + t)) <=> &0 <= s * (-- d) * (-- t) / dn`]; + REPEAT (GMATCH_SIMP_TAC REAL_LE_MUL); + GMATCH_SIMP_TAC REAL_LE_DIV; + GMATCH_SIMP_TAC REAL_LE_MUL; + GMATCH_SIMP_TAC SQRT_POS_LE; + GMATCH_SIMP_TAC SQRT_POS_LE; + FIRST_X_ASSUM (C INTRO_TAC [`x`]) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`;arith `t <= &0 ==> &0 <= --t`]; + BY(ASM_SIMP_TAC[arith `d < &0 ==> &0 <= -- d`]); + COMMENT "continuity"; + INTRO_TAC continuous_nbd_pos [`\t. delta_x x1 x2 x3 x4 (x5 + t) x6`;`&0`]; + INTRO_TAC continuous_nbd_pos [`\t. ups_x x1 x3 (x5 + t)`;`&0`]; + INTRO_TAC continuous_nbd_pos [`\t. -- delta_x6 x1 x2 x3 x4 (x5 + t) x6`;`&0`]; + ASM_SIMP_TAC[arith `d < &0 ==> &0 < --d`;arith `abs(t' - &0) = abs t'`;arith `x + &0 = x`]; + TYPIFY_GOAL_THEN `(\t. --delta_x6 x1 x2 x3 x4 (x5 + t) x6) real_continuous atreal (&0) /\ (\t. ups_x x1 x3 (x5 + t)) real_continuous atreal (&0) /\ (\t. delta_x x1 x2 x3 x4 (x5 + t) x6) real_continuous atreal (&0)` (unlist REWRITE_TAC); + REWRITE_TAC[Sphere.delta_x6;Sphere.ups_x;Sphere.delta_x]; + BY(REPEAT (REPEAT CONJ_TAC THEN ( MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_NEG ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB THEN ASM_REWRITE_TAC[REAL_CONTINUOUS_AT_ID;REAL_CONTINUOUS_CONST;CONTINUOUS_CONST]))); + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[arith `&0 < --d <=> d < &0`]) + ]);; + (* }}} *) + +let delta_x5_delta_x6 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. delta_x6 x1 x3 x2 x4 x6 x5 = delta_x5 x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_x6;Nonlin_def.delta_x5]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let dih_obtuse_mono = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + &0 < x1 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 /\ + &0 < ups_x x1 x2 x6 /\ + &0 < ups_x x1 x3 x5 /\ + delta_x5 x1 x2 x3 x4 x5 x6 < &0 ==> + (?e. &0 < e /\ (!t. abs t < e /\ t <= &0 ==> + dih_x x1 x2 x3 (x4+t) x5 (x6) <= dih_x x1 x2 x3 x4 x5 x6 /\ + dih_x x1 x2 x3 (x4) x5 (x6+t) <= dih_x x1 x2 x3 x4 x5 x6))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY ` (?e1. &0 < e1 /\ (!t. abs t < e1 ==> &0 < delta_x x1 x2 x3 (x4+t) (x5) x6))` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC continuous_nbd_pos [`\t. delta_x x1 x2 x3 (x4+t) x5 x6`;`&0`]; + ASM_SIMP_TAC[arith `d < &0 ==> &0 < --d`;arith `abs(t' - &0) = abs t'`;arith `x + &0 = x`]; + DISCH_THEN MATCH_MP_TAC; + REWRITE_TAC[Sphere.delta_x6;Sphere.ups_x;Sphere.delta_x]; + BY(REPEAT (REPEAT CONJ_TAC THEN ( MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_NEG ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB THEN ASM_REWRITE_TAC[REAL_CONTINUOUS_AT_ID;REAL_CONTINUOUS_CONST;CONTINUOUS_CONST]))); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC dih_x5_mono [`x1`;`x3`;`x2`;`x4`;`x6`;`x5`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + REPEAT (FIRST_X_ASSUM_ST `delta_x` MP_TAC); + BY(MESON_TAC[Merge_ineq.delta_x_sym]); + FIRST_X_ASSUM_ST `delta_x5` MP_TAC; + BY(REWRITE_TAC[delta_x5_delta_x6]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e1`;`e`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + CONJ2_TAC; + ONCE_REWRITE_TAC[Nonlinear_lemma.dih_x_sym]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_MESON_TAC[]); + TYPIFY `t = &0` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[arith `x + &0 = x`;arith `x <= x`]); + INTRO_TAC Tame_inequalities.DIH_X_MONO_LT_4 [`x1`;`x2`;`x3`;`x4+t`;`x5`;`x6`;`x4`]; + ANTS_TAC; + ASM_SIMP_TAC[]; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let dih_obtuse_mono_b = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + &0 < x1 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 /\ + &0 < ups_x x1 x2 x6 /\ + &0 < ups_x x1 x3 x5 ==> + (?e. &0 < e /\ (!t. abs t < e /\ t <= &0 ==> + dih_x x1 x2 x3 (x4+t) x5 (x6) <= dih_x x1 x2 x3 x4 x5 x6))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY ` (?e1. &0 < e1 /\ (!t. abs t < e1 ==> &0 < delta_x x1 x2 x3 (x4+t) (x5) x6))` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC continuous_nbd_pos [`\t. delta_x x1 x2 x3 (x4+t) x5 x6`;`&0`]; + ASM_SIMP_TAC[arith `d < &0 ==> &0 < --d`;arith `abs(t' - &0) = abs t'`;arith `x + &0 = x`]; + DISCH_THEN MATCH_MP_TAC; + REWRITE_TAC[Sphere.delta_x6;Sphere.ups_x;Sphere.delta_x]; + BY(REPEAT (REPEAT CONJ_TAC THEN ( MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_NEG ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB THEN ASM_REWRITE_TAC[REAL_CONTINUOUS_AT_ID;REAL_CONTINUOUS_CONST;CONTINUOUS_CONST]))); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e1` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `t = &0` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[arith `x + &0 = x`;arith `x <= x`]); + INTRO_TAC Tame_inequalities.DIH_X_MONO_LT_4 [`x1`;`x2`;`x3`;`x4+t`;`x5`;`x6`;`x4`]; + ANTS_TAC; + ASM_SIMP_TAC[]; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let square_add_neg_lemma = prove_by_refinement( + `!y t. t <= &0 /\ &0 <= t + &2 * y ==> &2 * y * t + t*t <= &0`, + (* {{{ proof *) + [ + REWRITE_TAC[arith `a <= &0 <=> &0 <= --a` ;arith `--(&2 * y * t + t*t) = (--t) * (t+ &2 * y)`]; + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC REAL_LE_MUL; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let dihV_obtuse_mono_a = prove_by_refinement( + `!(v0:real^3) v1 v2 v3. + ~coplanar {v0,v1,v2,v3} /\ + pi / &2 < dihV v0 v2 v3 v1 ==> + (?e. (!v2'. &0 < e /\ (!t. abs t < e /\ t <= &0 /\ dist (v0,v2') = dist(v0,v2) /\ + dist (v1,v2') = dist(v1,v2) /\ + dist(v2',v3)=dist(v2,v3) + t ==> + dihV v0 v3 v2' v1 <= dihV v0 v3 v2 v1)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Merge_ineq.DIHV_DIH_X [`v0`;`v2`;`v3`;`v1`]; + INTRO_TAC Merge_ineq.DIHV_DIH_X [`v0`;`v3`;`v2`;`v1`]; + REWRITE_TAC[LET_THM;GSYM Collect_geom2.NOT_COL_EQ_UPS_X_POS]; + TYPIFY `~collinear {v0, v3, v2} /\ ~collinear {v0, v3, v1} /\ ~collinear {v0, v2, v3} /\ ~collinear {v0, v2, v1} /\ ~collinear {v0, v1, v2} /\ ~collinear {v0, v1, v3}` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Planarity.notcoplanar_imp_notcollinear_fan;SET_RULE `{a,b,c} = {a,c,b}`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `pi` MP_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + ASM_TAC THEN REWRITE_TAC[DIST_SYM] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `&0 < dist (v0,v3) pow 2 /\ &0 < dist (v0,v2) pow 2 /\ &0 < dist(v2,v3) /\ &0 < delta_x (dist (v0,v2) pow 2) (dist (v0,v3) pow 2) (dist (v0,v1) pow 2) (dist (v1,v3) pow 2) (dist (v1,v2) pow 2) (dist (v2,v3) pow 2)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + REWRITE_TAC[GSYM DIST_NZ]; + REWRITE_TAC[DIST_EQ_0]; + REWRITE_TAC[CONJ_ASSOC]; + CONJ_TAC; + BY(ASM_MESON_TAC[ COPLANAR_3;SET_RULE `{a,b,a,c} = {a,b,c}`;SET_RULE `{a,b,c,a}={a,b,c}`;SET_RULE `{a,b,c,c} = {a,b,c}`]); + REWRITE_TAC[GSYM Sphere.delta_y;arith `x pow 2 = x*x`]; + FIRST_X_ASSUM_ST `coplanar` MP_TAC THEN REWRITE_TAC[Oxlzlez.coplanar_delta_y]; + REWRITE_TAC[DIST_SYM;Sphere.delta_y]; + BY(MESON_TAC[Merge_ineq.delta_x_sym]); + MP_TAC (ONCE_REWRITE_RULE[MESON[] `!a b c d. (a /\ b /\ c ==> d) <=> (c ==> (a /\ b ==> d))`] Merge_ineq.dih_gt_pi2); + DISCH_THEN (fun t -> FIRST_X_ASSUM (MP_TAC o (MATCH_MP t))); + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + INTRO_TAC continuous_nbd_pos [`\t. ups_x (dist(v0,v3) pow 2) (dist(v0,v2) pow 2) ( (dist(v2,v3)+t) pow 2)`;`&0`]; + ASM_SIMP_TAC[arith `d < &0 ==> &0 < --d`;arith `abs(t' - &0) = abs t'`;arith `x + &0 = x`]; + ANTS_TAC; + CONJ_TAC; + REWRITE_TAC[Sphere.delta_x6;Sphere.ups_x;Sphere.delta_x]; + BY(REPEAT (REPEAT CONJ_TAC THEN ( MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_NEG ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW THEN ASM_REWRITE_TAC[REAL_CONTINUOUS_AT_ID;REAL_CONTINUOUS_CONST;CONTINUOUS_CONST]))); + REPEAT (FIRST_X_ASSUM_ST `collinear` MP_TAC) THEN REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS;DIST_SYM]; + BY(DISCH_THEN (unlist REWRITE_TAC)); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC continuous_nbd_pos [`\t. delta_x (dist (v0,v2) pow 2) (dist (v0,v3) pow 2) (dist (v0,v1) pow 2) (dist (v1,v3) pow 2) (dist (v1,v2) pow 2) ((dist (v2,v3)+t) pow 2)`;`&0`]; + ASM_SIMP_TAC[arith `d < &0 ==> &0 < --d`;arith `abs(t' - &0) = abs t'`;arith `x + &0 = x`]; + ANTS_TAC; + REWRITE_TAC[Sphere.delta_x6;Sphere.ups_x;Sphere.delta_x]; + BY(REPEAT (REPEAT CONJ_TAC THEN ( MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_NEG ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW THEN ASM_REWRITE_TAC[REAL_CONTINUOUS_AT_ID;REAL_CONTINUOUS_CONST;CONTINUOUS_CONST]))); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC dih_obtuse_mono [`dist(v0,v3) pow 2`;`dist(v0,v2) pow 2`;`dist(v0,v1) pow 2`;`dist(v1,v2) pow 2`;`dist(v1,v3) pow 2`;`(dist(v2,v3)) pow 2`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `delta_x` MP_TAC) THEN REWRITE_TAC[DIST_SYM] THEN MESON_TAC[Merge_ineq.delta_x_sym]); + REWRITE_TAC[CONJ_ASSOC]; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `collinear` MP_TAC) THEN ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`] THEN REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS;DIST_SYM] THEN MESON_TAC[]); + BY(FIRST_X_ASSUM_ST `delta_x4` MP_TAC THEN REWRITE_TAC[Sphere.delta_x4;Nonlin_def.delta_x5;DIST_SYM] THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?e2. &0 < e2 /\ (!t. abs t < e2 /\ t <= &0 ==> &2 * dist(v2,v3) * t + t * t <= &0 /\ abs(&2 * dist(v2,v3)*t + t*t ) < e'')` (C SUBGOAL_THEN MP_TAC); + TYPIFY `(?e2. &0 < e2 /\ (!t. abs t < e2 /\ t <= &0 ==> &2 * dist(v2,v3) * t + t * t <= &0 )) /\ (?e2. &0 < e2 /\ (!t. abs t < e2 /\ t <= &0 ==> abs(&2 * dist(v2,v3)*t + t*t ) < e''))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e2`;`e2'`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e'''` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + BY(CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + CONJ_TAC; + TYPIFY `&2 * dist(v2,v3)` EXISTS_TAC; + REWRITE_TAC[arith `&0 < &2 * x <=> &0 < x`]; + REWRITE_TAC[GSYM DIST_NZ]; + CONJ_TAC; + BY(ASM_MESON_TAC[ COPLANAR_3;SET_RULE `{a,b,c,c} = {a,b,c}`]); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC square_add_neg_lemma; + ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM_ST `abs` MP_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC continuous_nbd_pos [`\t. e'' - abs(&2 * dist(v2,v3)*t + t*t)`;`&0`]; + ASM_SIMP_TAC[arith `d < &0 ==> &0 < --d`;arith `abs(t' - &0) = abs t'`;arith `x + &0 = x`]; + ANTS_TAC; + CONJ2_TAC; + BY(FIRST_X_ASSUM_ST `&0 < e''` MP_TAC THEN REAL_ARITH_TAC); + BY(REPEAT (REPEAT CONJ_TAC THEN ( MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_NEG ORELSE MATCH_MP_TAC REAL_CONTINUOUS_ABS ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW THEN ASM_REWRITE_TAC[REAL_CONTINUOUS_AT_ID;REAL_CONTINUOUS_CONST;CONTINUOUS_CONST]))); + BY(MESON_TAC[arith `&0 < e'' - a <=> a < e''`]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_quad [`e`;`e'`;`e2`;`e''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''''` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Merge_ineq.DIHV_DIH_X [`v0`;`v3`;`v2'`;`v1`]; + ASM_REWRITE_TAC[LET_THM]; + ANTS_TAC; + ASM_TAC THEN REWRITE_TAC[DIST_SYM] THEN REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + BY(FIRST_X_ASSUM_ST `collinear` MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`] THEN REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS;DIST_SYM]); + DISCH_THEN SUBST1_TAC; + ASM_REWRITE_TAC[arith `(x+y) pow 2 = x pow 2 + (&2 * x * y + y* y)`;DIST_SYM]; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`t`]) THEN ANTS_TAC THEN ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `dih_x` (C INTRO_TAC [`&2 * dist(v2,v3) *t + t*t`]); + ASM_REWRITE_TAC[]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +(* redo with dih_obtuse_mono_b w/o obtuse *) +(* +let dihV_obtuse_mono_b = prove_by_refinement( + `!(v0:real^3) v1 v2 v3. + ~coplanar {v0,v1,v2,v3} /\ + pi / &2 < dihV v0 v2 v3 v1 ==> + (?e. (!v2'. &0 < e /\ (!t. abs t < e /\ t <= &0 /\ dist (v0,v2') = dist(v0,v2) /\ + dist (v1,v2') = dist(v1,v2) /\ + dist(v2',v3)=dist(v2,v3) + t ==> + dihV v0 v1 v2' v3 <= dihV v0 v1 v2 v3)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Merge_ineq.DIHV_DIH_X [`v0`;`v2`;`v3`;`v1`]; + INTRO_TAC Merge_ineq.DIHV_DIH_X [`v0`;`v3`;`v2`;`v1`]; + INTRO_TAC Merge_ineq.DIHV_DIH_X [`v0`;`v1`;`v2`;`v3`]; + REWRITE_TAC[LET_THM;GSYM Collect_geom2.NOT_COL_EQ_UPS_X_POS]; + TYPIFY `~collinear {v0, v3, v2} /\ ~collinear {v0, v3, v1} /\ ~collinear {v0, v2, v3} /\ ~collinear {v0, v2, v1} /\ ~collinear {v0, v1, v2} /\ ~collinear {v0, v1, v3}` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Planarity.notcoplanar_imp_notcollinear_fan;SET_RULE `{a,b,c} = {a,c,b}`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `pi` MP_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + ASM_TAC THEN REWRITE_TAC[DIST_SYM] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `&0 < dist(v0,v1) pow 2 /\ &0 < dist (v0,v3) pow 2 /\ &0 < dist (v0,v2) pow 2 /\ &0 < dist(v2,v3) /\ &0 < delta_x (dist (v0,v2) pow 2) (dist (v0,v3) pow 2) (dist (v0,v1) pow 2) (dist (v1,v3) pow 2) (dist (v1,v2) pow 2) (dist (v2,v3) pow 2)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + REWRITE_TAC[GSYM DIST_NZ]; + REWRITE_TAC[DIST_EQ_0]; + REWRITE_TAC[CONJ_ASSOC]; + CONJ_TAC; + BY(ASM_MESON_TAC[ COPLANAR_3;SET_RULE `{a,a,b,c} = {a,b,c}`;SET_RULE `{a,b,a,c} = {a,b,c}`;SET_RULE `{a,b,c,a}={a,b,c}`;SET_RULE `{a,b,c,c} = {a,b,c}`]); + REWRITE_TAC[GSYM Sphere.delta_y;arith `x pow 2 = x*x`]; + FIRST_X_ASSUM_ST `coplanar` MP_TAC THEN REWRITE_TAC[Oxlzlez.coplanar_delta_y]; + REWRITE_TAC[DIST_SYM;Sphere.delta_y]; + BY(MESON_TAC[Merge_ineq.delta_x_sym]); + MP_TAC (ONCE_REWRITE_RULE[MESON[] `!a b c d. (a /\ b /\ c ==> d) <=> (c ==> (a /\ b ==> d))`] Merge_ineq.dih_gt_pi2); + DISCH_THEN (fun t -> FIRST_X_ASSUM (MP_TAC o (MATCH_MP t))); + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + INTRO_TAC continuous_nbd_pos [`\t. ups_x (dist(v0,v3) pow 2) (dist(v0,v2) pow 2) ( (dist(v2,v3)+t) pow 2)`;`&0`]; + ASM_SIMP_TAC[arith `d < &0 ==> &0 < --d`;arith `abs(t' - &0) = abs t'`;arith `x + &0 = x`]; + ANTS_TAC; + CONJ_TAC; + REWRITE_TAC[Sphere.delta_x6;Sphere.ups_x;Sphere.delta_x]; + BY(REPEAT (REPEAT CONJ_TAC THEN ( MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_NEG ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW THEN ASM_REWRITE_TAC[REAL_CONTINUOUS_AT_ID;REAL_CONTINUOUS_CONST;CONTINUOUS_CONST]))); + REPEAT (FIRST_X_ASSUM_ST `collinear` MP_TAC) THEN REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS;DIST_SYM]; + BY(DISCH_THEN (unlist REWRITE_TAC)); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC continuous_nbd_pos [`\t. delta_x (dist (v0,v2) pow 2) (dist (v0,v3) pow 2) (dist (v0,v1) pow 2) (dist (v1,v3) pow 2) (dist (v1,v2) pow 2) ((dist (v2,v3)+t) pow 2)`;`&0`]; + ASM_SIMP_TAC[arith `d < &0 ==> &0 < --d`;arith `abs(t' - &0) = abs t'`;arith `x + &0 = x`]; + ANTS_TAC; + REWRITE_TAC[Sphere.delta_x6;Sphere.ups_x;Sphere.delta_x]; + BY(REPEAT (REPEAT CONJ_TAC THEN ( MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_NEG ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW THEN ASM_REWRITE_TAC[REAL_CONTINUOUS_AT_ID;REAL_CONTINUOUS_CONST;CONTINUOUS_CONST]))); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC dih_obtuse_mono [`dist(v0,v1) pow 2`;`dist(v0,v2) pow 2`;`dist(v0,v3) pow 2`;`dist(v2,v3) pow 2`;`dist(v1,v3) pow 2`;`(dist(v1,v2)) pow 2`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `delta_x` MP_TAC) THEN REWRITE_TAC[DIST_SYM] THEN MESON_TAC[Merge_ineq.delta_x_sym]); + REWRITE_TAC[CONJ_ASSOC]; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `collinear` MP_TAC) THEN REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS;DIST_SYM] THEN MESON_TAC[]); + BY(FIRST_X_ASSUM_ST `delta_x4` MP_TAC THEN REWRITE_TAC[Sphere.delta_x4;Nonlin_def.delta_x5;DIST_SYM] THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?e2. &0 < e2 /\ (!t. abs t < e2 /\ t <= &0 ==> &2 * dist(v2,v3) * t + t * t <= &0 /\ abs(&2 * dist(v2,v3)*t + t*t ) < e'')` (C SUBGOAL_THEN MP_TAC); + TYPIFY `(?e2. &0 < e2 /\ (!t. abs t < e2 /\ t <= &0 ==> &2 * dist(v2,v3) * t + t * t <= &0 )) /\ (?e2. &0 < e2 /\ (!t. abs t < e2 /\ t <= &0 ==> abs(&2 * dist(v2,v3)*t + t*t ) < e''))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e2`;`e2'`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e'''` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + BY(CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + CONJ_TAC; + TYPIFY `&2 * dist(v2,v3)` EXISTS_TAC; + REWRITE_TAC[arith `&0 < &2 * x <=> &0 < x`]; + REWRITE_TAC[GSYM DIST_NZ]; + CONJ_TAC; + BY(ASM_MESON_TAC[ COPLANAR_3;SET_RULE `{a,b,c,c} = {a,b,c}`]); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC square_add_neg_lemma; + ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM_ST `abs` MP_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC continuous_nbd_pos [`\t. e'' - abs(&2 * dist(v2,v3)*t + t*t)`;`&0`]; + ASM_SIMP_TAC[arith `d < &0 ==> &0 < --d`;arith `abs(t' - &0) = abs t'`;arith `x + &0 = x`]; + ANTS_TAC; + CONJ2_TAC; + BY(FIRST_X_ASSUM_ST `&0 < e''` MP_TAC THEN REAL_ARITH_TAC); + BY(REPEAT (REPEAT CONJ_TAC THEN ( MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_NEG ORELSE MATCH_MP_TAC REAL_CONTINUOUS_ABS ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW THEN ASM_REWRITE_TAC[REAL_CONTINUOUS_AT_ID;REAL_CONTINUOUS_CONST;CONTINUOUS_CONST]))); + BY(MESON_TAC[arith `&0 < e'' - a <=> a < e''`]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_quad [`e`;`e'`;`e2`;`e''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''''` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Merge_ineq.DIHV_DIH_X [`v0`;`v1`;`v2'`;`v3`]; + ASM_REWRITE_TAC[LET_THM]; + ANTS_TAC; + ASM_TAC THEN REWRITE_TAC[DIST_SYM] THEN REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + (REPEAT (FIRST_X_ASSUM_ST `collinear` MP_TAC) THEN REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS;DIST_SYM]); + BY(MESON_TAC[]); + DISCH_THEN SUBST1_TAC; + ASM_REWRITE_TAC[arith `(x+y) pow 2 = x pow 2 + (&2 * x * y + y* y)`;DIST_SYM]; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`t`]) THEN ANTS_TAC THEN ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `dih_x` (C INTRO_TAC [`&2 * dist(v2,v3) *t + t*t`]); + ASM_REWRITE_TAC[]; + BY(MESON_TAC[]) + ]);; + (* }}} *) +*) + +let dihV_obtuse_mono_b = prove_by_refinement( + `!(v0:real^3) v1 v2 v3. + ~coplanar {v0,v1,v2,v3} ==> + (?e. (!v2'. &0 < e /\ (!t. abs t < e /\ t <= &0 /\ dist (v0,v2') = dist(v0,v2) /\ + dist (v1,v2') = dist(v1,v2) /\ + dist(v2',v3)=dist(v2,v3) + t ==> + dihV v0 v1 v2' v3 <= dihV v0 v1 v2 v3)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Merge_ineq.DIHV_DIH_X [`v0`;`v2`;`v3`;`v1`]; + INTRO_TAC Merge_ineq.DIHV_DIH_X [`v0`;`v3`;`v2`;`v1`]; + INTRO_TAC Merge_ineq.DIHV_DIH_X [`v0`;`v1`;`v2`;`v3`]; + REWRITE_TAC[LET_THM;GSYM Collect_geom2.NOT_COL_EQ_UPS_X_POS]; + TYPIFY `~collinear {v0, v3, v2} /\ ~collinear {v0, v3, v1} /\ ~collinear {v0, v2, v3} /\ ~collinear {v0, v2, v1} /\ ~collinear {v0, v1, v2} /\ ~collinear {v0, v1, v3}` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Planarity.notcoplanar_imp_notcollinear_fan;SET_RULE `{a,b,c} = {a,c,b}`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + ASM_TAC THEN REWRITE_TAC[DIST_SYM] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `&0 < dist(v0,v1) pow 2 /\ &0 < dist (v0,v3) pow 2 /\ &0 < dist (v0,v2) pow 2 /\ &0 < dist(v2,v3) /\ &0 < delta_x (dist (v0,v2) pow 2) (dist (v0,v3) pow 2) (dist (v0,v1) pow 2) (dist (v1,v3) pow 2) (dist (v1,v2) pow 2) (dist (v2,v3) pow 2)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + REWRITE_TAC[GSYM DIST_NZ]; + REWRITE_TAC[DIST_EQ_0]; + REWRITE_TAC[CONJ_ASSOC]; + CONJ_TAC; + BY(ASM_MESON_TAC[ COPLANAR_3;SET_RULE `{a,a,b,c} = {a,b,c}`;SET_RULE `{a,b,a,c} = {a,b,c}`;SET_RULE `{a,b,c,a}={a,b,c}`;SET_RULE `{a,b,c,c} = {a,b,c}`]); + REWRITE_TAC[GSYM Sphere.delta_y;arith `x pow 2 = x*x`]; + FIRST_X_ASSUM_ST `coplanar` MP_TAC THEN REWRITE_TAC[Oxlzlez.coplanar_delta_y]; + REWRITE_TAC[DIST_SYM;Sphere.delta_y]; + BY(MESON_TAC[Merge_ineq.delta_x_sym]); + INTRO_TAC continuous_nbd_pos [`\t. ups_x (dist(v0,v3) pow 2) (dist(v0,v2) pow 2) ( (dist(v2,v3)+t) pow 2)`;`&0`]; + ASM_SIMP_TAC[arith `d < &0 ==> &0 < --d`;arith `abs(t' - &0) = abs t'`;arith `x + &0 = x`]; + ANTS_TAC; + CONJ_TAC; + REWRITE_TAC[Sphere.delta_x6;Sphere.ups_x;Sphere.delta_x]; + BY(REPEAT (REPEAT CONJ_TAC THEN ( MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_NEG ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW THEN ASM_REWRITE_TAC[REAL_CONTINUOUS_AT_ID;REAL_CONTINUOUS_CONST;CONTINUOUS_CONST]))); + REPEAT (FIRST_X_ASSUM_ST `collinear` MP_TAC) THEN REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS;DIST_SYM]; + BY(DISCH_THEN (unlist REWRITE_TAC)); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC continuous_nbd_pos [`\t. delta_x (dist (v0,v2) pow 2) (dist (v0,v3) pow 2) (dist (v0,v1) pow 2) (dist (v1,v3) pow 2) (dist (v1,v2) pow 2) ((dist (v2,v3)+t) pow 2)`;`&0`]; + ASM_SIMP_TAC[arith `d < &0 ==> &0 < --d`;arith `abs(t' - &0) = abs t'`;arith `x + &0 = x`]; + ANTS_TAC; + REWRITE_TAC[Sphere.delta_x6;Sphere.ups_x;Sphere.delta_x]; + BY(REPEAT (REPEAT CONJ_TAC THEN ( MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_NEG ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW THEN ASM_REWRITE_TAC[REAL_CONTINUOUS_AT_ID;REAL_CONTINUOUS_CONST;CONTINUOUS_CONST]))); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC dih_obtuse_mono_b [`dist(v0,v1) pow 2`;`dist(v0,v2) pow 2`;`dist(v0,v3) pow 2`;`dist(v2,v3) pow 2`;`dist(v1,v3) pow 2`;`(dist(v1,v2)) pow 2`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `delta_x` MP_TAC) THEN REWRITE_TAC[DIST_SYM] THEN MESON_TAC[Merge_ineq.delta_x_sym]); + BY(REPEAT (FIRST_X_ASSUM_ST `collinear` MP_TAC) THEN REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS;DIST_SYM] THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?e2. &0 < e2 /\ (!t. abs t < e2 /\ t <= &0 ==> &2 * dist(v2,v3) * t + t * t <= &0 /\ abs(&2 * dist(v2,v3)*t + t*t ) < e'')` (C SUBGOAL_THEN MP_TAC); + TYPIFY `(?e2. &0 < e2 /\ (!t. abs t < e2 /\ t <= &0 ==> &2 * dist(v2,v3) * t + t * t <= &0 )) /\ (?e2. &0 < e2 /\ (!t. abs t < e2 /\ t <= &0 ==> abs(&2 * dist(v2,v3)*t + t*t ) < e''))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pair [`e2`;`e2'`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e'''` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + BY(CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + CONJ_TAC; + TYPIFY `&2 * dist(v2,v3)` EXISTS_TAC; + REWRITE_TAC[arith `&0 < &2 * x <=> &0 < x`]; + REWRITE_TAC[GSYM DIST_NZ]; + CONJ_TAC; + BY(ASM_MESON_TAC[ COPLANAR_3;SET_RULE `{a,b,c,c} = {a,b,c}`]); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC square_add_neg_lemma; + ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM_ST `abs` MP_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC continuous_nbd_pos [`\t. e'' - abs(&2 * dist(v2,v3)*t + t*t)`;`&0`]; + ASM_SIMP_TAC[arith `d < &0 ==> &0 < --d`;arith `abs(t' - &0) = abs t'`;arith `x + &0 = x`]; + ANTS_TAC; + CONJ2_TAC; + BY(FIRST_X_ASSUM_ST `&0 < e''` MP_TAC THEN REAL_ARITH_TAC); + BY(REPEAT (REPEAT CONJ_TAC THEN ( MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_NEG ORELSE MATCH_MP_TAC REAL_CONTINUOUS_ABS ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW THEN ASM_REWRITE_TAC[REAL_CONTINUOUS_AT_ID;REAL_CONTINUOUS_CONST;CONTINUOUS_CONST]))); + BY(MESON_TAC[arith `&0 < e'' - a <=> a < e''`]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_quad [`e`;`e'`;`e2`;`e''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''''` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Merge_ineq.DIHV_DIH_X [`v0`;`v1`;`v2'`;`v3`]; + ASM_REWRITE_TAC[LET_THM]; + ANTS_TAC; + ASM_TAC THEN REWRITE_TAC[DIST_SYM] THEN REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + (REPEAT (FIRST_X_ASSUM_ST `collinear` MP_TAC) THEN REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS;DIST_SYM]); + BY(MESON_TAC[]); + DISCH_THEN SUBST1_TAC; + ASM_REWRITE_TAC[arith `(x+y) pow 2 = x pow 2 + (&2 * x * y + y* y)`;DIST_SYM]; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`t`]) THEN ANTS_TAC THEN ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `dih_x` (C INTRO_TAC [`&2 * dist(v2,v3) *t + t*t`]); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let dihV_obtuse_mono = prove_by_refinement( + `!(v0:real^3) v1 v2 v3. + ~coplanar {v0, v1, v2, v3} + ==> (?e. &0 < e /\ (pi / &2 < dihV v0 v2 v3 v1 ==> + (!v2' t. abs t < e /\ + t <= &0 /\ + dist (v0,v2') = dist (v0,v2) /\ + dist (v1,v2') = dist (v1,v2) /\ + dist (v2',v3) = dist (v2,v3) + t + ==> + dihV v0 v3 v2' v1 <= dihV v0 v3 v2 v1)) /\ + (!v2' t. (abs t < e /\ + t <= &0 /\ + dist (v0,v2') = dist (v0,v2) /\ + dist (v1,v2') = dist (v1,v2) /\ + dist (v2',v3) = dist (v2,v3) + t + ==> dihV v0 v1 v2' v3 <= dihV v0 v1 v2 v3) ))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (REWRITE_RULE[MESON[] `(a ==> (?e. P e)) <=> (?e. a ==> P e)`] dihV_obtuse_mono_a) [`v0`;`v1`;`v2`;`v3`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC dihV_obtuse_mono_b [`v0`;`v1`;`v2`;`v3`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `b <=> pi / &2 < dihV v0 v2 v3 v1`; + TYPED_ABBREV_TAC `e1 = if b then e else &1`; + INTRO_TAC epsilon_pair [`e1`;`e'`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + EXPAND_TAC "e1"; + COND_CASES_TAC; + BY(ASM_MESON_TAC[]); + BY(REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''` EXISTS_TAC; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let real_continuous_abs = prove_by_refinement( + `!x. abs real_continuous atreal x`, + (* {{{ proof *) + [ + TYPIFY `abs = (\x. abs ((\ (u:real). u) x))` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[FUN_EQ_THM;I_THM]); + GEN_TAC; + MATCH_MP_TAC REAL_CONTINUOUS_ABS; + BY(REWRITE_TAC[REAL_CONTINUOUS_AT_ID]) + ]);; + (* }}} *) + +let deformation_restrict = prove_by_refinement( + `!e f (V:real^A->bool) e'. deformation f V (-- e,e) /\ &0 < e' /\ (!t. abs t < e' ==> abs t < e) ==> + deformation f V (-- e',e')`, + (* {{{ proof *) + [ + REWRITE_TAC[Localization.deformation;IN_REAL_INTERVAL;arith `-- e < t /\ t < e <=> abs t < e`;arith `abs(&0) = &0`]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let psort_mod = prove_by_refinement( + `!k a b. ~(k=0) ==> psort k (a MOD k,b MOD k) = psort k (a,b)`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.psort]; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_SIMP_TAC[MOD_MOD_REFL]) + ]);; + (* }}} *) + +let MMs_minimize_tau_fun = prove_by_refinement( + `!s k v w. + is_scs_v39 s /\ scs_basic_v39 s /\ (scs_k_v39 s = k) /\ (3 < k) /\ + BBprime_v39 s v /\ + BBs_v39 s w ==> + sum {i | i < k} (\i. rho_fun (norm (v i)) * azim (vec 0) (v i) (v (i + 1)) (v (i + k - 1))) <= + sum {i | i < k} (\i. rho_fun (norm (w i)) * azim (vec 0) (w i) (w (i + 1)) (w (i + k - 1)))`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.taustar_v39;Appendix.BBprime_v39;LET_THM]; + REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `COND` MP_TAC) THEN ASM_SIMP_TAC[arith `3 < k ==> ~(k <= 3)`] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`w`]); + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `tau_fun` MP_TAC) THEN REPEAT (GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Terminal.tau_fun_azim)); + TYPIFY `k` EXISTS_TAC; + CONJ_TAC; + ASM_SIMP_TAC[arith `3 < k ==> 3 <= k`]; + CONJ_TAC; + BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN MESON_TAC[]); + MATCH_MP_TAC BBs_inj; + BY(ASM_MESON_TAC[]); + TYPIFY `k` EXISTS_TAC; + CONJ_TAC; + ASM_SIMP_TAC[arith `3 < k ==> 3 <= k`]; + CONJ_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `BBs_v39` MP_TAC) THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN MESON_TAC[]); + MATCH_MP_TAC BBs_inj; + BY(ASM_MESON_TAC[]); + DISCH_THEN kill; + TYPIFY `dsv_v39 s v = dsv_v39 s w` ENOUGH_TO_SHOW_TAC; + TYPED_ABBREV_TAC `sv = sum {i | i < k} (\i. rho_fun (norm (v i)) * azim (vec 0) (v i) (v (i + 1)) (v (i + k - 1)))`; + TYPED_ABBREV_TAC `sw = sum {i | i < k} (\i. rho_fun (norm (w i)) * azim (vec 0) (w i) (w (i + 1)) (w (i + k - 1)))`; + BY(REAL_ARITH_TAC); + REPEAT (GMATCH_SIMP_TAC Appendix.dsv_J_empty); + REWRITE_TAC[FUN_EQ_THM]; + BY(ASM_MESON_TAC[Appendix.scs_basic]) + ]);; + (* }}} *) + +let solve_mod_k = prove_by_refinement( + `!k a b x. ~(k = 0) /\ b= (x + a) MOD k ==> (x MOD k = (b + k - (a MOD k)) MOD k)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MOD_SHIFT[`k`;`b`;`(x+(a:num))`;`k - a MOD k`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[MOD_MOD_REFL]); + DISCH_THEN SUBST1_TAC; + TYPIFY `((x+a) + k - a MOD k = x + (k + (a - a MOD k)))` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_TAC THEN ARITH_TAC); + TYPIFY `x + k + a - a MOD k = (a DIV k + 1) * k + x` (C SUBGOAL_THEN SUBST1_TAC); + INTRO_TAC DIVISION [`a`;`k`]; + BY(ASM_TAC THEN ARITH_TAC); + BY(REWRITE_TAC[MOD_MULT_ADD]) + ]);; + (* }}} *) + +let tau3_taum_nonplanar = prove_by_refinement( + `!(v0:real^3) v1 v2. + ~coplanar {vec 0,v0,v1,v2} ==> + tau3 v0 v1 v2 = taum (norm v0) (norm v1) (norm v2) (dist(v1,v2)) (dist(v0,v2)) (dist(v0,v1))`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.tau3;Nonlinear_lemma.taum_123;Sphere.rhazim2;Sphere.rhazim3;Sphere.node2_y;Sphere.node3_y]; + REWRITE_TAC[Sphere.rhazim;Nonlinear_lemma.sol0_const1]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `dihV (vec 0) v0 v1 v2 = dih_y (norm v0) (norm v1) (norm v2) (dist (v1,v2)) (dist (v0,v2)) (dist (v0,v1)) /\ dihV (vec 0) v1 v2 v0 = dih_y (norm v1) (norm v2) (norm v0) (dist (v0,v2)) (dist (v0,v1)) (dist (v1,v2)) /\ dihV (vec 0) v2 v0 v1 = dih_y (norm v2) (norm v0) (norm v1) (dist (v0,v1)) (dist (v1,v2)) (dist (v0,v2))` ENOUGH_TO_SHOW_TAC; + DISCH_THEN (unlist REWRITE_TAC); + BY(REAL_ARITH_TAC); + REPEAT (GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] Merge_ineq.DIHV_EQ_DIH_Y)); + REWRITE_TAC[DIST_0]; + REWRITE_TAC[DIST_SYM]; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `coplanar` (MP_TAC o MATCH_MP Planarity.notcoplanar_imp_notcollinear_fan); + BY(MESON_TAC[SET_RULE `{a,b,c} = {a,c,b}`]) + ]);; + (* }}} *) + +let tau3_azim = prove_by_refinement( + `!(v0:real^3) v1 v2. + ~coplanar {vec 0,v0,v1,v2} /\ + azim (vec 0) v0 v1 v2 <= pi ==> + tau3 v0 v1 v2 = rho (norm (v0)) * azim (vec 0) v0 v1 v2 + + rho (norm (v1)) * azim (vec 0) v1 v2 v0 + + rho (norm (v2)) * azim (vec 0) v2 v0 v1 - (pi + sol0) + `, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.tau3]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (arith `a = a' /\ b = b' /\ c = c' ==> r1 *a + r2*b + r3*c -x = r1*a' + r2*b' + r3*c' - x`); + REPEAT (GMATCH_SIMP_TAC (GSYM Polar_fan.AZIM_DIHV_SAME_STRONG)); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `coplanar` (MP_TAC o MATCH_MP Planarity.notcoplanar_imp_notcollinear_fan); + BY(ASM_MESON_TAC[Xivphks.FSQKWKK;SET_RULE `{a,b,c} = {a,c,b}`]) + ]);; + (* }}} *) + +(* +let general_482_deformation = prove_by_refinement( +`main_nonlinear_terminal_v11 ==> + (!s FF k p0 p1 p2 v. + {v p0,v p2} = {v (p1+1),v (p1 + (k-1))} /\ + FF = IMAGE (\i. (v i,v (SUC i))) (:num) /\ + is_scs_v39 s /\ + k = scs_k_v39 s /\ + 3 < k /\ + MMs_v39 s v /\ + scs_basic_v39 s /\ + scs_generic v /\ + &3 <= dist(v p0,v p2) /\ + (!i j. scs_diag k i j /\ ~(psort k (i, j) = psort k (p0,p2)) ==> scs_a_v39 s i j < dist(v i,v j)) /\ + (!i j. scs_diag k i j ==> &4 * h0 < scs_b_v39 s i j) /\ + interior_angle1 (vec 0) FF (v p1) < pi /\ + (pi/ &2 < interior_angle1 (vec 0) FF (v p1) \/ interior_angle1 (vec 0) FF (v p2) < pi) /\ + scs_a_v39 s p1 p2 = &2 /\ + scs_b_v39 s p1 p2 = &2 * h0 /\ + &2 <= dist(v p0,v p1) /\ + dist(v p0, v p1) <= cstab ==> + dist(v p1,v p2) = &2)`, + (* {{{ proof *) + [ + COMMENT "preliminaries"; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(k<=3)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC (arith `3 < k ==> ~(k <= 3)`); + BY(ASM_REWRITE_TAC[]); + RULE_ASSUM_TAC (ONCE_REWRITE_RULE[EQ_SYM_EQ]); + FIRST_X_ASSUM_ST `&2 = x` (ASSUME_TAC o (ONCE_REWRITE_RULE[EQ_SYM_EQ])); + FIRST_X_ASSUM_ST `&2 *h0 = x` (ASSUME_TAC o (ONCE_REWRITE_RULE[EQ_SYM_EQ])); + TYPIFY `unadorned_v39 s` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.scs_basic]); + TYPIFY `BBprime2_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.scs_basic;Ayqjtmd.unadorned_MMs]); + TYPIFY `BBprime_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime2_v39]); + TYPIFY `BBs_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime_v39]); + INTRO_TAC Appendix.BBs_v39 [`s`;`v`]; + ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;Terminal.IMAGE_SUBSET_IN;IN_UNIV]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `V = IMAGE v (:num)`; + TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + EXPAND_TAC "V"; + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + INTRO_TAC (GEN_ALL Local_lemmas.INTERIOR_ANGLE1_POS) [`E`;`V`;`FF`;`v p1`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC (GEN_ALL Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM_IVS ) [`E`;`V`;`FF`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!i m. ITER m (rho_node1 FF) (v i) = v (m + i)` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + INTRO_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME) [`V`;`E`;`k`;`s`;`FF`;`v i`;`v`;`i`]; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. v (i + (k:num)) = v i` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Oxl_def.periodic]); + TYPIFY `!i. ivs_rho_node1 FF (v i) = v ( i + (k-1))` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC VV_SUC_EQ_IVS_RHO_NODE_PRIME; + GEXISTL_TAC [`V`;`E`;`s`]; + BY(ASM_REWRITE_TAC[]); + TYPIFY `generic V E` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.scs_generic]); + COMMENT "collinearity"; + TYPIFY `~collinear {vec 0,v (p1 + (k-1)),v (p1 + 1)}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Zlzthic.PROPERTIES_GENERIC_LOCAL_FAN_ALT; + GEXISTL_TAC [`V`;`E`;`FF`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC Ocbicby.scs_lb_2 [`s`;`v`;`(p1+1)`;`(p1+(k-1))`]; + ASM_REWRITE_TAC[DIST_REFL;arith `~(&2 <= &0)`]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + ASM_SIMP_TAC[arith `3 < k ==> ~(k=0)`]; + REPEAT (GMATCH_SIMP_TAC MOD_LT); + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + COMMENT "coplanarity"; + TYPIFY `interior_angle1 (vec 0) FF (v p1) = azim (vec 0) (v p1) (v (p1+1)) (v (p1 + k -1))` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `interior_angle1` (C INTRO_TAC [`v p1`]); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `ITER` (C INTRO_TAC [`p1`;`1`]); + REWRITE_TAC[ITER_1]; + BY(MESON_TAC[arith `1 + p1 = p1 + 1`]); + TYPIFY `~coplanar {vec 0, v p1,v(p1+1),v(p1 + k- 1)}` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; + FIRST_X_ASSUM (SUBST1_TAC o GSYM); + BY(ASM_SIMP_TAC[DE_MORGAN_THM;arith `&0 ~(x = &0)`; arith `(x < pi ==> ~(x = pi))`]); + COMMENT "482"; + INTRO_TAC (UNDISCH Ocbicby.LEMMA_4828966562) [`norm (v p0)`;`norm (v p2)`;`norm (v p1)`;`dist(v p1,v p2)`;`dist (v p0,v p1)`;`dist(v p0,v p2)`]; + ANTS_TAC; + ASM_REWRITE_TAC[GSYM Sphere.cstab]; + TYPIFY_GOAL_THEN `&2 <= norm (v p0) /\ norm (v p0) <= &2 * h0 /\ &2 <= norm (v p2) /\ norm (v p2) <= &2 * h0 /\ &2 <= norm (v p1) /\ norm (v p1) <= &2 * h0 /\ &2 <= dist (v p1,v p2) /\ dist (v p1,v p2) <= &2 * h0 ` (unlist REWRITE_TAC); + BY(ASM_MESON_TAC[ ( Fnjlbxs.in_ball_annulus)]); + CONJ_TAC; + TYPIFY `dist(v p1, v p2) = dist(v p2,v p1)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[DIST_SYM]); + REWRITE_TAC[GSYM Trigonometry1.DIST_L_ZERO]; + REWRITE_TAC[GSYM Oxlzlez.coplanar_delta_y]; + FIRST_X_ASSUM MP_TAC; + MATCH_MP_TAC (TAUT `(a = b) ==> (a ==> b)`); + AP_TERM_TAC; + AP_TERM_TAC; + AP_TERM_TAC; + BY(FIRST_X_ASSUM_ST `{a,b} = y` MP_TAC THEN SET_TAC[]); + COMMENT "ups"; + REWRITE_TAC[GSYM Trigonometry1.DIST_L_ZERO;arith `x*x = x pow 2`]; + REWRITE_TAC[GSYM Collect_geom2.NOT_COL_EQ_UPS_X_POS]; + FIRST_X_ASSUM_ST `collinear` MP_TAC; + MATCH_MP_TAC (TAUT `(a = b) ==> (a ==> b)`); + REPEAT AP_TERM_TAC; + BY(FIRST_X_ASSUM_ST `{a,b} = y` MP_TAC THEN SET_TAC[]); + REPEAT WEAKER_STRIP_TAC; + (PROOF_BY_CONTR_TAC); + TYPIFY `v p1 dot (v (p1 + 1) cross v (p1 + k -1)) > &0` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `v p1 dot (v (p1 + 1) cross v (p1 + k -1)) = (v p1 cross (v (p1 + 1))) dot ( v (p1 + k -1))` (C SUBGOAL_THEN SUBST1_TAC); + BY(VEC3_TAC); + REWRITE_TAC[arith `a > &0 <=> &0 < a`;GSYM Zlzthic.azim_lt_pi_cross]; + BY(ASM_MESON_TAC[]); + COMMENT "fix abs"; + TYPIFY `(?f e'. &0 < e' /\ deformation f V (--e',e') /\ (!w t. ~(w = v p1) ==> f w t = w) /\ (!t. abs t < e' ==> dist (v p0,f (v p1) t) = dist (v p0,v p1) /\ dist (v p2,f (v p1) t) = dist (v p2,v p1) -abs t /\ norm (f (v p1) t) = norm (v p1)))` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM_ST `{a,b} = {c,d}` MP_TAC; + REWRITE_TAC[Collect_geom.PAIR_EQ_EXPAND] THEN DISCH_THEN DISJ_CASES_TAC; + INTRO_TAC deform_simplex_edge_exists [`V`;`(\t. -- abs t)`;`(\ (t:real). &0)`;`v (p1 + k -1)`;`v p1`;`v (p1 +1)`;`&1`]; + STRIP_TAC; + FIRST_X_ASSUM MP_TAC THEN ANTS_TAC; + REWRITE_TAC[arith `&0 < &1 /\ -- &0 = &0`;REAL_CONTINUOUS_CONST]; + REPEAT (GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT); + REWRITE_TAC[REAL_OPEN_REAL_INTERVAL;REAL_CONTINUOUS_CONST;arith `--abs (&0) = &0`]; + nCONJ_TAC 2; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC REAL_CONTINUOUS_NEG; + BY(REWRITE_TAC[real_continuous_abs]); + FIRST_X_ASSUM (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `cross` (unlist REWRITE_TAC); + BY(ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,c,d,b}`] THEN FIRST_X_ASSUM_ST `coplanar` (unlist REWRITE_TAC)); + ASM_REWRITE_TAC[arith `x + &0 = x`;arith `x + -- t = x - t`;DIST_SYM]; + REPEAT WEAKER_STRIP_TAC; + GEXISTL_TAC [`f`;`e'`]; + ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + INTRO_TAC deform_simplex_edge_exists [`V`;`(\ (t:real). &0)`;`(\t. --abs t)`;`v (p1 +k - 1)`;`v p1`;`v (p1 +1)`;`&1`]; + STRIP_TAC; + FIRST_X_ASSUM MP_TAC THEN ANTS_TAC; + REWRITE_TAC[arith `&0 < &1 /\ -- &0 = &0`;REAL_CONTINUOUS_CONST]; + REPEAT (GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT); + REWRITE_TAC[REAL_OPEN_REAL_INTERVAL;REAL_CONTINUOUS_CONST;arith `--abs(&0)= &0`]; + FIRST_X_ASSUM_ST `cross` (unlist REWRITE_TAC); + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,c,d,b}`] THEN FIRST_X_ASSUM_ST `coplanar` (unlist REWRITE_TAC); + REPEAT WEAKER_STRIP_TAC THEN MATCH_MP_TAC REAL_CONTINUOUS_NEG; + BY(REWRITE_TAC[real_continuous_abs]); + ASM_REWRITE_TAC[arith `x + &0 = x`;arith `x + -- t = x - t`;DIST_SYM]; + REPEAT WEAKER_STRIP_TAC; + GEXISTL_TAC [`f`;`e'`]; + BY(ASM_REWRITE_TAC[]); + (REPEAT WEAKER_STRIP_TAC); + TYPIFY `~(k=0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_SIMP_TAC[arith `3 < k ==> ~(k=0)`]); + TYPIFY `!i j.scs_a_v39 s (i MOD k) (j MOD k) = scs_a_v39 s i j /\ scs_b_v39 s (i MOD k) (j MOD k) = scs_b_v39 s i j ` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; + ASM_REWRITE_TAC[Appendix.is_scs_v39]; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[periodic2_MOD]); + TYPIFY `!i. i MOD k < k` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION]); + TYPIFY `!i. v (i MOD k) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[]); + INTRO_TAC BBs_inj [`s`;`v`;`k`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!j. j < k ==> (j MOD k = j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[MOD_LT]); + COMMENT "restart here"; + TYPIFY `~(v (p1+1) = v p1) /\ ~(v (p1 + k -1) = v p1)` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `v p1 = v (p1+0)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[arith `p1+0 = p1`]); + FIRST_ASSUM_ST `v(i MOD k) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); + TYPIFY_GOAL_THEN `!i j. i < k /\ j < k /\ ~(i = j) ==> ~(v i = v (j:num))` (REPEAT o GMATCH_SIMP_TAC); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + REPEAT (GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (REPEAT o GMATCH_SIMP_TAC); + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + TYPIFY `(!t. f (v (p1+1)) t = v(p1+1)) /\ (!t. f (v (p1+k-1)) t = v (p1+k-1))` (C SUBGOAL_THEN ASSUME_TAC); + BY(CONJ_TAC THEN GEN_TAC THEN FIRST_X_ASSUM_ST `(f w t = w)` MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `?e1. &0 < e1 /\ (!t. abs t < e1 ==> &0 < azim (vec 0) (f (v p1) t) (v (p1+1)) (v (p1+k-1)) /\ azim (vec 0) (f(v p1) t) (v (p1+1)) (v (p1+k-1)) < pi)` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC WNWSHJT_ALT [`v(p1+k-1)`;`v (p1)`;`v (p1+1)`;`f`;`-- e'`;`e'`;`pi`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + CONJ_TAC; + MATCH_MP_TAC Zlzthic.deformation_subset; + TYPIFY `V` EXISTS_TAC; + ASM_REWRITE_TAC[]; + EXPAND_TAC "V"; + BY(REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY;IN_IMAGE;IN_UNIV] THEN MESON_TAC[]); + TYPIFY_GOAL_THEN `~collinear {vec 0, v p1, v (p1 + 1)} /\ ~collinear {vec 0, v p1, v (p1 + k - 1)}` (unlist REWRITE_TAC); + BY(FIRST_X_ASSUM_ST `coplanar` MP_TAC THEN MESON_TAC[Planarity.notcoplanar_imp_notcollinear_fan]); + BY(ASM_MESON_TAC[]); + BY(MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!t. abs t < e1 ==> ((&0 < azim (vec 0) (v(p1+1)) (v(p1+k-1)) (f (v p1) t) /\ azim (vec 0) (v(p1+1)) (v(p1+k-1)) (f (v p1) t) < pi) /\ (&0 < azim (vec 0) (v(p1+k-1)) (f (v p1) t) (v(p1+1)) /\ azim (vec 0) (v(p1+k-1)) (f (v p1) t) (v(p1+1)) < pi))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `azim` (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[GSYM sin_azim_pos]; + INTRO_TAC Trigonometry.JBDNJJB [`f (v p1) t`;`v(p1 + 1)`;`v (p1+k-1)`]; + INTRO_TAC Trigonometry.JBDNJJB [`v(p1 + 1)`;`v (p1+k-1)`;`f (v p1) t`]; + INTRO_TAC Trigonometry.JBDNJJB [`v (p1+k-1)`;`f (v p1) t`;`v(p1 + 1)`]; + TYPIFY_GOAL_THEN `((v (p1 + k - 1) cross f (v p1) t) dot v (p1 + 1)) = ((f (v p1) t cross v (p1 + 1)) dot v (p1 + k - 1)) /\ ((v (p1 + 1) cross v (p1 + k - 1)) dot f (v p1) t) = ((f (v p1) t cross v (p1 + 1)) dot v (p1 + k - 1))` (unlist REWRITE_TAC); + BY(MESON_TAC[CROSS_TRIPLE]); + TYPIFY `!a b. re_eqvl a b ==> (&0 < a <=> &0 < b)` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[]); + REWRITE_TAC[Trigonometry2.re_eqvl]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!w. w IN V ==> f w (&0) = w` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation]; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + TYPIFY `?e2. &0 < e2 /\ (!t. abs t < e2 ==> ~coplanar {vec 0, (f (v p1) t),v (p1+k-1),v(p1+1)})` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC Zlzthic.NONPLANAR_OPEN [`( \ (t:real). (vec 0):real^3)`;`f (v p1)`;`\ (t:real). v (p1+k-1)`;`\ (t:real). v (p1+1)`;`&0`]; + ASM_REWRITE_TAC[CONTINUOUS_CONST]; + ANTS_TAC; + CONJ_TAC; + FIRST_X_ASSUM GMATCH_SIMP_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation]; + BY(REPEAT WEAKER_STRIP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + BY(REWRITE_TAC[arith `abs (&0 - t') = abs t'`] THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "insert"; + INTRO_TAC dihV_obtuse_mono [`(vec 0):real^3`;`v p0`;`v p1`;`v p2`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `{vec 0,v p0, v p1,v p2} = {vec 0,v p1,v (p1+1),v(p1+k-1)}` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM_ST `{a,b} ={c,d}` MP_TAC; + BY(SET_TAC[]); + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + REPLICATE_TAC 2(FIRST_X_ASSUM MP_TAC THEN BURY_MP_TAC); + COMMENT "end insert"; + INTRO_TAC epsilon_quad [`e1`;`e2`;`e'`;`e`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `!t. abs t < e'''' ==> azim (vec 0) (f(v p1) t) (v (p1+1)) (v (p1+k-1)) = dihV (vec 0) (f (v p1) t) (v (p1 + 1)) (v (p1 + k - 1)) /\ azim (vec 0) (v (p1 + 1)) (v (p1 + k - 1)) (f (v p1) t) = dihV (vec 0) (v (p1 + 1)) (v (p1 + k - 1)) (f (v p1) t) /\ azim (vec 0) (v (p1 + k - 1)) (f (v p1) t) (v (p1 + 1)) = dihV (vec 0) (v (p1 + k - 1)) (f (v p1) t) (v (p1 + 1))` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC; + REPEAT (GMATCH_SIMP_TAC (GSYM AZIM_DIHV_SAME)); + INTRO_TAC Planarity.notcoplanar_imp_notcollinear_fan [`(vec 0):real^3`;`f (v p1) t`;`v(p1+k-1)`;`v(p1+1)`]; + ANTS_TAC; + BY((FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[])); + REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`]; + DISCH_THEN (unlist REWRITE_TAC); + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + COMMENT "introduce azim"; + INTRO_TAC azim_assumption_reduction [`s`;`k`;`p1`;`f`;`v`;`e''''`]; + ASM_REWRITE_TAC[]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + CONJ_TAC; + FIRST_X_ASSUM_ST `deformation` MP_TAC; + REWRITE_TAC[Localization.deformation]; + REWRITE_TAC[IN_REAL_INTERVAL;arith `--e < t /\ t < e <=> abs t < e`]; + BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[arith `abs(&0) = &0`]); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + TYPIFY `(azim (vec 0) (v (p1 + k - 1)) (v p1) (v (p1 + k - 2)) < pi \/ ( (!t. abs t < e'''' ==> dihV (vec 0) (v (p1 + k - 1)) (f (v p1) t) (v (p1 + 1)) <= dihV (vec 0) (v (p1 + k - 1)) (v p1) (v (p1 + 1))))) /\ (azim (vec 0) (v (p1 + 1)) (v (p1 + 2)) (v p1) < pi \/ ( (!t. abs t < e'''' ==> dihV (vec 0) (v (p1 + 1)) (v (p1 + k - 1)) (f (v p1) t) <= dihV (vec 0) (v (p1 + 1)) (v (p1 + k - 1)) (v p1))))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[MESON [] `(a \/ (?e1. P e1)) <=> (?e1. (a \/ P e1))`;MESON[] `(a /\ (?e1. P e1)) <=> (?e1. a /\ P e1)`;MESON[] `((?e1. P e1) /\ b) <=> (?e1. P e1 /\ b)`]; + GEXISTL_TAC [`e''''`;`e''''`]; + FIRST_X_ASSUM_ST `w IN V ==> f w (&0) = (w:real^3)` (C INTRO_TAC [`v p1`]); + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[arith `abs(&0) = &0`]); + COMMENT "obtuse case"; + (TYPIFY `pi/ &2 < dihV (vec 0) (v p1) (v (p1+1)) (v (p1+k-1))` ASM_CASES_TAC); + TYPIFY `dihV (vec 0) (v p1) (v(p1+1)) (v (p1+k-1)) = dihV (vec 0) (v p1) (v p2) (v p0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `{a,b}={c,d}` MP_TAC THEN REWRITE_TAC[Collect_geom.PAIR_EQ_EXPAND] THEN MESON_TAC[DIHV_SYM]); + TYPIFY `!t. abs t < e'''' ==> dihV (vec 0) (v p0) (f (v p1) t) (v p2) <= dihV (vec 0) (v p0) (v p1) (v p2) /\ dihV (vec 0) (v p2) (f (v p1) t) (v p0) <= dihV (vec 0) (v p2) (v p1) (v p0)` ENOUGH_TO_SHOW_TAC; + BY(FIRST_X_ASSUM_ST `{a,b}={c,d}` MP_TAC THEN REWRITE_TAC[Collect_geom.PAIR_EQ_EXPAND] THEN DISCH_THEN DISJ_CASES_TAC THEN FIRST_X_ASSUM (unlist REWRITE_TAC) THEN MESON_TAC[DIHV_SYM]); + REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `dihV a b c d <= dihV a' b' c' d'` MP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (C INTRO_TAC [`f (v p1) t`;`-- abs t`])); + (FIRST_X_ASSUM_ST `dihV a b c d <= dihV a' b' c' d'` MP_TAC THEN ANTS_TAC THENL [REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[];ALL_TAC] THEN DISCH_THEN (C INTRO_TAC [`f (v p1) t`;`-- abs t`])); + REWRITE_TAC[DIST_SYM;arith `abs(-- abs t) = abs t`;arith `--abs t <= &0`]; + REPEAT (DISCH_THEN GMATCH_SIMP_TAC); + REWRITE_TAC[arith `a + -- b = a - b`]; + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [` t`]); + ANTS_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM (unlist REWRITE_TAC)); + TYPIFY_GOAL_THEN `abs t < e` (unlist REWRITE_TAC); + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM (unlist REWRITE_TAC)); + BY(REWRITE_TAC[DIST_SYM;DIST_0] THEN MESON_TAC[]); + COMMENT "nonobtuse case"; + FIRST_X_ASSUM_ST `pi / &2 < interior_angle1 (vec 0) FF (v p1)` MP_TAC; + DISCH_TAC; + TYPIFY `interior_angle1 (vec 0) FF (v p2) < pi` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `dihV (vec 0) (v p1) (v (p1+1)) (v (p1+k-1)) = interior_angle1 (vec 0) FF (v p1)` ENOUGH_TO_SHOW_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + FIRST_X_ASSUM_ST `azim` (C INTRO_TAC [`&0`]); + BY(ASM_SIMP_TAC[arith `abs(&0) = &0`]); + FIRST_X_ASSUM_ST `{a,b}={c,d}` (MP_TAC o GSYM) THEN REWRITE_TAC[Collect_geom.PAIR_EQ_EXPAND] THEN DISCH_THEN DISJ_CASES_TAC; + FIRST_X_ASSUM_ST `interior_angle1` MP_TAC THEN (FIRST_ASSUM (unlist REWRITE_TAC)); + INTRO_TAC Ocbicby.INTERIOR_ANGLE1_AZIM [`s`;`v`;`p1 + k - 1`]; + ASM_REWRITE_TAC[LET_THM;IN]; + DISCH_THEN (SUBST1_TAC o GSYM); + TYPIFY_GOAL_THEN `v (SUC (p1+k-1)) = v p1 /\ v ((p1+k-1)+(k-1)) = v (p1 + k - 2)` (unlist REWRITE_TAC); + FIRST_ASSUM_ST `v(i MOD k) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); + FIRST_X_ASSUM_ST `3 < k` MP_TAC; + BY(SIMP_TAC[arith `3 < k ==> SUC (p1+k-1) = 1*k + p1 /\ ((p1+k-1)+(k-1) = (1*k + (p1+k-2)))`;MOD_MULT_ADD]); + DISCH_THEN (unlist REWRITE_TAC); + DISJ2_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST ` /\ ` ((unlist REWRITE_TAC) o GSYM); + ONCE_REWRITE_TAC[DIHV_SYM]; + FIRST_X_ASSUM MATCH_MP_TAC; + TYPIFY `-- abs t` EXISTS_TAC; + REWRITE_TAC[arith `abs(-- abs t) = abs (t)`;arith `-- abs t <= &0`;arith `x + -- t = x - t`;DIST_0;DIST_SYM]; + CONJ_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM (unlist REWRITE_TAC)); + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM (unlist REWRITE_TAC)); + BY(REWRITE_TAC[DIST_SYM] THEN MESON_TAC[]); + COMMENT "second nonobtuse case"; + FIRST_X_ASSUM_ST `interior_angle1` MP_TAC THEN (FIRST_ASSUM (unlist REWRITE_TAC)); + INTRO_TAC Ocbicby.INTERIOR_ANGLE1_AZIM [`s`;`v`;`p1 +1`]; + ASM_REWRITE_TAC[LET_THM;IN]; + DISCH_THEN (SUBST1_TAC o GSYM); + REWRITE_TAC[arith `SUC (p1+1) = p1+2`]; + TYPIFY_GOAL_THEN `v ((p1+1)+k-1) = v p1` (unlist REWRITE_TAC); + FIRST_ASSUM_ST `v(i MOD k) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); + FIRST_X_ASSUM_ST `3 < k` MP_TAC; + BY(SIMP_TAC[arith `3 < k ==> (p1+1)+k-1 = 1*k + p1`;MOD_MULT_ADD]); + DISCH_THEN (unlist REWRITE_TAC); + DISJ2_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST ` /\ ` ((unlist REWRITE_TAC) o GSYM); + FIRST_X_ASSUM MATCH_MP_TAC; + TYPIFY `-- abs t` EXISTS_TAC; + REWRITE_TAC[arith `abs(-- abs t) = abs (t)`;arith `-- abs t <= &0`;arith `x + -- t = x - t`;DIST_0;DIST_SYM]; + CONJ_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM (unlist REWRITE_TAC)); + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM (unlist REWRITE_TAC)); + BY(REWRITE_TAC[DIST_SYM] THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "finally back to root goal"; + TYPIFY `!i j. (v i = v j) ==> (i MOD k = j MOD k)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_ASSUM_ST `v (i MOD k) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); + FIRST_X_ASSUM_ST `!i (j:num). i < k /\ j < k /\ v i = v j ==> i = j` MP_TAC; + FIRST_X_ASSUM_ST `!i. i MOD k < k` MP_TAC; + BY(MESON_TAC[]); + TYPIFY `psort k (p0,p2) = psort k (p1+1,p1+k-1)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `~(k=0)` MP_TAC; + DISCH_TAC; + INTRO_TAC psort_mod [`k`]; + FIRST_X_ASSUM (unlist REWRITE_TAC); + DISCH_THEN ((unlist ONCE_REWRITE_TAC) o GSYM); + FIRST_X_ASSUM_ST `{a,b}={c,d}` (MP_TAC) THEN REWRITE_TAC[Collect_geom.PAIR_EQ_EXPAND] THEN DISCH_THEN DISJ_CASES_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[Terminal.psort_sym]); + INTRO_TAC deformation_BBs_ALT [`s`;`k`;`f`;`v`;`e''''`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC deformation_restrict; + TYPIFY `e'` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN (FIRST_X_ASSUM (unlist REWRITE_TAC))); + TYPIFY `v i = v p1` ASM_CASES_TAC; + BY(FIRST_X_ASSUM (unlist REWRITE_TAC) THEN MESON_TAC[]); + FIRST_X_ASSUM_ST `!w t. ~(w = v p1) ==> f w t = w` (C INTRO_TAC [`v i`;`t`]); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + CONJ_TAC; + MATCH_MP_TAC a_assumption_reduction; + GEXISTL_TAC [`k`;`p1`;`e'`]; + ASM_REWRITE_TAC[]; + CONJ_TAC; + REPEAT (FIRST_X_ASSUM_ST `psort` MP_TAC); + BY(MESON_TAC[]); + TYPIFY `(?e1. &0 < e1 /\ (scs_a_v39 s p1 p2 = dist (v p1,v p2) ==> (!t. abs t < e1 ==> scs_a_v39 s p1 (p2) <= dist (f (v p1) t,v (p2))))) /\ (?e1. &0 < e1 /\ (scs_a_v39 s p1 (p0) = dist (v p1,v (p0)) ==> (!t. abs t < e1 ==> scs_a_v39 s p1 (p0) <= dist (f (v p1) t,v (p0)))))` (C SUBGOAL_THEN ASSUME_TAC); + CONJ2_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `e'` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]); + BY(FIRST_X_ASSUM (unlist REWRITE_TAC) THEN (REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC)) THEN REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); + TYPIFY `&1` EXISTS_TAC; + BY(ASM_REWRITE_TAC[arith `&0 < &1`]); + FIRST_X_ASSUM_ST `{a,b}={c,d}` (MP_TAC) THEN REWRITE_TAC[Collect_geom.PAIR_EQ_EXPAND] THEN DISCH_THEN DISJ_CASES_TAC; + TYPIFY `(p1 + 1) MOD k = p0 MOD k /\ (p1+k-1) MOD k = p2 MOD k` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + TYPIFY_GOAL_THEN `scs_a_v39 s p1 (p1+1) = scs_a_v39 s p1 p0 /\ scs_a_v39 s p1 (p1+k-1) = scs_a_v39 s p1 p2` (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `scs_k_v39 s = k` MP_TAC THEN MESON_TAC[Nuxcoea.CHANGE_A_SCS_MODR]); + FIRST_X_ASSUM kill THEN FIRST_X_ASSUM (unlist REWRITE_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + TYPIFY `(p1 + 1) MOD k = p2 MOD k /\ (p1+k-1) MOD k = p0 MOD k` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + TYPIFY_GOAL_THEN `scs_a_v39 s p1 (p1+1) = scs_a_v39 s p1 p2 /\ scs_a_v39 s p1 (p1+k-1) = scs_a_v39 s p1 p0` (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `scs_k_v39 s = k` MP_TAC THEN MESON_TAC[Nuxcoea.CHANGE_A_SCS_MODR]); + FIRST_X_ASSUM kill THEN FIRST_X_ASSUM (unlist REWRITE_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + COMMENT "b assumption"; + MATCH_MP_TAC b_assumption_reduction; + GEXISTL_TAC [`k`;`p1`;`e'`]; + ASM_REWRITE_TAC[]; + TYPIFY `(?e2. &0 < e2 /\ (dist (v p1,v (p2)) = scs_b_v39 s p1 (p2) ==> (!t. abs t < e2 ==> dist (f (v p1) t,v (p2)) <= scs_b_v39 s p1 (p2)))) /\ (?e2. &0 < e2 /\ (dist (v p1,v (p0)) = scs_b_v39 s p1 (p0) ==> (!t. abs t < e2 ==> dist (f (v p1) t,v (p0)) <= scs_b_v39 s p1 (p0))))` (C SUBGOAL_THEN ASSUME_TAC); + CONJ2_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `e'` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]); + BY(FIRST_X_ASSUM (unlist REWRITE_TAC) THEN (REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC)) THEN REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); + TYPIFY `e'` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]); + BY(FIRST_X_ASSUM (unlist REWRITE_TAC) THEN (REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC)) THEN REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `{a,b}={c,d}` (MP_TAC) THEN REWRITE_TAC[Collect_geom.PAIR_EQ_EXPAND] THEN DISCH_THEN DISJ_CASES_TAC; + TYPIFY `(p1 + 1) MOD k = p0 MOD k /\ (p1+k-1) MOD k = p2 MOD k` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + TYPIFY_GOAL_THEN `scs_b_v39 s p1 (p1+1) = scs_b_v39 s p1 p0 /\ scs_b_v39 s p1 (p1+k-1) = scs_b_v39 s p1 p2` (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `scs_k_v39 s = k` MP_TAC THEN MESON_TAC[Nuxcoea.CHANGE_B_SCS_MODR]); + FIRST_X_ASSUM kill THEN FIRST_X_ASSUM (unlist REWRITE_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + TYPIFY `(p1 + 1) MOD k = p2 MOD k /\ (p1+k-1) MOD k = p0 MOD k` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + TYPIFY_GOAL_THEN `scs_b_v39 s p1 (p1+1) = scs_b_v39 s p1 p2 /\ scs_b_v39 s p1 (p1+k-1) = scs_b_v39 s p1 p0` (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `scs_k_v39 s = k` MP_TAC THEN MESON_TAC[Nuxcoea.CHANGE_B_SCS_MODR]); + FIRST_X_ASSUM kill THEN FIRST_X_ASSUM (unlist REWRITE_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "back to root, next tau"; + TYPIFY `!t. abs t < e'' ==> sum {i | i < k} (\i. rho_fun (norm (v i)) * azim (vec 0) (v i) (v (i + 1)) (v (i + k - 1))) <= sum {i | i < k} (\i. rho_fun (norm (f (v i) t)) * azim (vec 0) (f (v i) t) (f(v(i+1)) t) (f (v (i + k - 1)) t))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC MMs_minimize_tau_fun; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM (unlist REWRITE_TAC)); + TYPIFY `!t. abs t < e'' ==> sum ({i | i < k} DIFF {p1 MOD k,(p1+1) MOD k, (p1+k-1) MOD k}) (\i. rho_fun (norm (f (v i) t)) * azim (vec 0) (f (v i) t) (f (v (i + 1)) t) (f (v (i + k - 1)) t)) = sum {i | i < k} (\i. rho_fun (norm (f (v i) t)) * azim (vec 0) (f (v i) t) (f (v (i + 1)) t) (f (v (i + k - 1)) t)) - sum {p1 MOD k,(p1+1) MOD k, (p1+k-1) MOD k} (\i. rho_fun (norm (f (v i) t)) * azim (vec 0) (f (v i) t) (f (v (i + 1)) t) (f (v (i + k - 1)) t))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC SUM_DIFF; + REWRITE_TAC[FINITE_NUMSEG_LT]; + ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY;IN_ELIM_THM]; + BY(REPEAT WEAKER_STRIP_TAC THEN REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[]); + TYPIFY `(\i. rho_fun (norm (f (v i) (&0))) * azim (vec 0) (f (v i) (&0)) (f (v (i + 1)) (&0)) (f (v (i + k - 1)) (&0))) = (\i. rho_fun (norm ((v i) )) * azim (vec 0) ( (v i) ) ( (v (i + 1)) ) ( (v (i + k - 1)) ))` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[FUN_EQ_THM]; + GEN_TAC; + BY(ASM_SIMP_TAC[]); + TYPIFY `?e3. &0 < e3 /\ (!t. abs t < e3 ==> dist(v p1,v p2) + t IN real_interval(a,b))` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC Zlzthic.real_interval_contains_0_ball [`a-dist(v p1,v p2)`;`b - dist(v p1,v p2)`;`&1`]; + REWRITE_TAC[arith `&0 < &1`;arith `a - d < &0 <=> a < d`;arith `&0 < b - d <=> d < b`]; + ANTS_TAC; + FIRST_X_ASSUM_ST `dist s IN real_interval (a,b)` MP_TAC; + BY(REWRITE_TAC[IN_REAL_INTERVAL]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e'''` EXISTS_TAC; + BY(ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC THEN (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN REPLICATE_TAC 6 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[IN_REAL_INTERVAL] THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + COMMENT "combine e'' e1' e'''' e3 "; + INTRO_TAC epsilon_quad [`e''`;`e1'`;`e''''`;`e3`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY ` ((p1+1) MOD k + k-1) MOD k = p1 MOD k /\ ((p1+k-1) MOD k + 1) MOD k = p1 MOD k` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC MOD_SHIFT; + TYPIFY `p1+1` EXISTS_TAC; + FIRST_X_ASSUM_ST `~(k=0)` MP_TAC THEN SIMP_TAC[arith `~(k=0) ==> (p1+1) + k -1 = 1 *k + p1`;MOD_MULT_ADD;MOD_MOD_REFL]; + DISCH_TAC; + GMATCH_SIMP_TAC MOD_SHIFT; + TYPIFY `p1+k-1` EXISTS_TAC; + BY(FIRST_X_ASSUM_ST `~(k=0)` MP_TAC THEN SIMP_TAC[arith `~(k=0) ==> (p1+k-1) +1 = 1 *k + p1`;MOD_MULT_ADD;MOD_MOD_REFL]); + TYPIFY `!t. abs t < e'''''' ==> sum {p1 MOD k, (p1 + 1) MOD k, (p1 + k - 1) MOD k} (\i. rho_fun (norm (v i)) * azim (vec 0) (v i) (v (i + 1)) (v (i + k - 1))) <= sum {p1 MOD k, (p1 + 1) MOD k, (p1 + k - 1) MOD k} (\i. rho_fun (norm (f (v i) t)) * azim (vec 0) (f (v i) t) (f (v (i + 1)) t) (f (v (i + k - 1)) t))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_ASSUM_ST `sum` (C INTRO_TAC [`&0`]); + FIRST_X_ASSUM_ST `sum` (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[arith `abs(&0) = &0`]; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN FIRST_X_ASSUM (unlist REWRITE_TAC)); + ONCE_REWRITE_TAC[arith `sdiff = sfull - s3 <=> s3 = sfull - sdiff`]; + DISCH_THEN SUBST1_TAC; + DISCH_THEN SUBST1_TAC; + FIRST_X_ASSUM_ST `sum` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN FIRST_X_ASSUM (unlist REWRITE_TAC)); + ASM_REWRITE_TAC[]; + TYPIFY `sum ({i | i < k} DIFF {p1 MOD k, (p1 + 1) MOD k, (p1 + k - 1) MOD k}) (\i. rho_fun (norm (v i)) * azim (vec 0) (v i) (v (i + 1)) (v (i + k - 1))) = sum ({i | i < k} DIFF {p1 MOD k, (p1 + 1) MOD k, (p1 + k - 1) MOD k}) (\i. rho_fun (norm (f (v i) t)) * azim (vec 0) (f (v i) t) (f (v (i + 1)) t) (f (v (i + k - 1)) t))` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[arith `(a <= b) ==> a - u <= b - u`]); + MATCH_MP_TAC SUM_EQ; + REWRITE_TAC[IN_DIFF;IN_INSERT;NOT_IN_EMPTY;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY ` ~(p1 MOD k = x MOD k) /\ ~(p1 MOD k = (x + 1) MOD k) /\ ~(p1 MOD k = (x + k - 1) MOD k)` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `x MOD k = (x + 0) MOD k` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[arith `x + 0 = x`]); + PROOF_BY_CONTR_TAC; + INTRO_TAC solve_mod_k [`k`] THEN ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[TAUT `!a b. (a ==> b) <=> (~b ==> ~a)`]; + DISCH_TAC; + FIRST_X_ASSUM_ST `x+k-1` MP_TAC THEN REWRITE_TAC[] THEN REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC; + GMATCH_SIMP_TAC MOD_0; + ASM_REWRITE_TAC[MOD_MOD_REFL;MOD_MULT_ADD;arith `a + k - 0 = 1*k + a`]; + GMATCH_SIMP_TAC MOD_MOD_REFL; + BY(ASM_REWRITE_TAC[] THEN REPLICATE_TAC 2(FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[MOD_LT]); + TYPIFY `x MOD k = x` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM_ST `x < (k:num)` MP_TAC THEN MESON_TAC[MOD_LT]); + DISCH_TAC; + FIRST_X_ASSUM_ST `~` MP_TAC; + ASM_REWRITE_TAC[]; + DISJ2_TAC; + DISJ2_TAC; + TYPIFY `1 MOD k = 1` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN MESON_TAC[MOD_LT;arith `3 < k ==> 1 < k`]); + MATCH_MP_TAC MOD_SHIFT; + BY(FIRST_X_ASSUM_ST `~(k = 0)` MP_TAC THEN MESON_TAC[MOD_MOD_REFL]); + TYPIFY `x MOD k = x` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM_ST `x < (k:num)` MP_TAC THEN MESON_TAC[MOD_LT]); + DISCH_TAC; + FIRST_X_ASSUM_ST `~` MP_TAC; + ASM_REWRITE_TAC[]; + DISJ2_TAC; + DISJ1_TAC; + TYPIFY `(k-1) MOD k = (k-1)` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM_ST `~(k=0)` MP_TAC THEN MESON_TAC[MOD_LT;arith `~(k=0) ==> k - 1 < k`]); + TYPIFY `k - (k-1) = 1` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM_ST `~(k=0)` MP_TAC THEN ARITH_TAC); + MATCH_MP_TAC MOD_SHIFT; + BY(FIRST_X_ASSUM_ST `~(k = 0)` MP_TAC THEN MESON_TAC[MOD_MOD_REFL]); + POP_ASSUM (fun t -> FIRST_X_ASSUM (MP_TAC o (C MATCH_MP t))); + (DISCH_THEN (unlist REWRITE_TAC)); + AP_THM_TAC; + AP_TERM_TAC; + AP_TERM_TAC; + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN (FIRST_X_ASSUM_ST `abs` (unlist REWRITE_TAC))); + TYPIFY `v x = v p1` ASM_CASES_TAC; + BY(FIRST_X_ASSUM (unlist REWRITE_TAC) THEN MESON_TAC[]); + POP_ASSUM (fun t -> FIRST_X_ASSUM (MP_TAC o (C MATCH_MP t))); + BY(DISCH_THEN (unlist REWRITE_TAC)); + COMMENT "back to root: relate sum to taum"; + TYPIFY `!i. f (v i) (&0) = (v i)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM_ST `IN` MP_TAC) THEN REPEAT (FIRST_X_ASSUM_ST `f w (&0) = w` MP_TAC) THEN MESON_TAC[]); + TYPIFY `?t'. abs t' < e'''''' /\ ~(t' = &0)` (C SUBGOAL_THEN MP_TAC); + BY(TYPIFY `e'''''' / &2` EXISTS_TAC THEN FIRST_X_ASSUM_ST `&0 < e''''''` MP_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + REPLICATE_TAC 5 (FIRST_X_ASSUM (C INTRO_TAC [`t'`]) THEN ANTS_TAC THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[arith `~(x <= y) <=> y < x`]; + TYPIFY_GOAL_THEN `!f. sum {p1 MOD k, (p1 + 1) MOD k, (p1 + k - 1) MOD k} f = f (p1 MOD k) + f ((p1 + 1) MOD k) + f ((p1+k-1) MOD k)` (unlist REWRITE_TAC); + GEN_TAC; + MATCH_MP_TAC Geomdetail.SUM_DIS3; + TYPIFY `p1 MOD k = (p1 + 0) MOD k` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[arith `p1 + 0 = p1`]); + REWRITE_TAC[DE_MORGAN_THM]; + REPEAT (GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT); + REPEAT (GMATCH_SIMP_TAC MOD_LT); + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + REWRITE_TAC[Appendix.rho_rho_fun]; + FIRST_X_ASSUM_ST `DIFF` kill; + REPEAT (FIRST_X_ASSUM_ST `sum` kill); + FIRST_X_ASSUM_ST `MOD` (MP_TAC o GSYM) THEN REPEAT WEAKER_STRIP_TAC; + POP_ASSUM (fun t -> FIRST_X_ASSUM (MP_TAC o (C MATCH_MP t))); + DISCH_TAC; + FIRST_ASSUM (C INTRO_TAC [`&0`]); + FIRST_X_ASSUM (C INTRO_TAC [`t'`]); + FIRST_X_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC; + DISCH_THEN (unlist REWRITE_TAC); + DISCH_THEN (unlist REWRITE_TAC); + POP_ASSUM (fun t -> FIRST_X_ASSUM (MP_TAC o (C MATCH_MP t))); + DISCH_TAC; + FIRST_ASSUM (C INTRO_TAC [`&0`]); + FIRST_X_ASSUM (C INTRO_TAC [`t'`]); + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist REWRITE_TAC); + DISCH_THEN (unlist REWRITE_TAC); + TYPIFY `p1 MOD k = (p1 MOD k) MOD k` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `~(k=0)` MP_TAC THEN MESON_TAC[MOD_MOD_REFL]); + POP_ASSUM (fun t -> FIRST_X_ASSUM (MP_TAC o (C MATCH_MP t))); + ASM_REWRITE_TAC[]; + DISCH_TAC; + FIRST_ASSUM (C INTRO_TAC [`&0`]); + FIRST_X_ASSUM (C INTRO_TAC [`t'`]); + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist REWRITE_TAC); + DISCH_THEN (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `azim` (C INTRO_TAC [`t'`]); + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist REWRITE_TAC); + MATCH_MP_TAC (arith `r1 * a1 + r2 * (a2) + r3 * (b2) - (pi + sol0) < r1' * a1' + r2 * (a2') + r3 * (b3') - (pi + sol0) ==> r1 * a1 + r2 * (a + a2) + r3 * (b2 + b) < r1' * a1' + r2 * (a + a2') + r3 * (b3' + b)`); + REPEAT (GMATCH_SIMP_TAC (GSYM tau3_azim)); + REPEAT (GMATCH_SIMP_TAC tau3_taum_nonplanar); + FIRST_X_ASSUM_ST `taum` MP_TAC; + DISCH_TAC; + REPEAT (FIRST_X_ASSUM_ST `coplanar` MP_TAC) THEN REPEAT DISCH_TAC; + REPEAT (FIRST_X_ASSUM_ST `azim a b c d <= pi` MP_TAC) THEN REPEAT DISCH_TAC; + REPEAT (FIRST_X_ASSUM_ST `azim a b c d < pi` MP_TAC) THEN REPEAT DISCH_TAC; + TYPIFY `abs t' < e1 /\ abs t' < e2` (C SUBGOAL_THEN ASSUME_TAC); + BY(CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); + REPEAT (FIRST_X_ASSUM_ST `&0 < e2` MP_TAC) THEN REPEAT DISCH_TAC; + TYPIFY_GOAL_THEN `azim (vec 0) (v p1) (v (p1 + 1)) (v (p1 + k - 1)) <= pi /\ azim (vec 0) (f (v p1) t') (v (p1 + 1)) (v (p1 + k - 1)) <= pi` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 25 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[arith `abs(&0) = &0`;arith `x < y ==> x <= y`]); + REPEAT (FIRST_X_ASSUM_ST `azim` kill); + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `~coplanar {vec 0, f (v p1) t', v p0, v p2} ` (unlist REWRITE_TAC); + TYPIFY `{vec 0,f(v p1) t',v p0,v p2} = {vec 0,f (v p1) t',v (p1+k-1),v(p1+1)}` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM_ST `{a,b}={c,d}` MP_TAC THEN SET_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); + TYPIFY_GOAL_THEN `!w. taum (norm w) (norm (v (p1 + 1))) (norm (v (p1 + k - 1))) (dist (v (p1 + 1),v (p1 + k - 1))) (dist (w,v (p1 + k - 1))) (dist (w,v (p1 + 1))) = taum (norm (v p0)) (norm (v p2)) (norm (w)) (dist(w,v p2)) (dist (v p0,w)) (dist (v p0,v p2))` (unlist REWRITE_TAC); + GEN_TAC; + FIRST_X_ASSUM_ST `{a,b}={c,d}` (MP_TAC) THEN REWRITE_TAC[Collect_geom.PAIR_EQ_EXPAND] THEN DISCH_THEN DISJ_CASES_TAC; + ASM_REWRITE_TAC[DIST_SYM]; + BY(MESON_TAC[Terminal.taum_sym]); + ASM_REWRITE_TAC[DIST_SYM]; + BY(MESON_TAC[Terminal.taum_sym]); + FIRST_X_ASSUM_ST `norm a = norm b` (C INTRO_TAC [`t'`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); + REWRITE_TAC[DIST_SYM] THEN (DISCH_THEN (unlist REWRITE_TAC)); + FIRST_X_ASSUM MATCH_MP_TAC; + CONJ_TAC; + REWRITE_TAC[arith `x - y = x + -- y`]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `abs(-- abs t') = abs t'`]); + ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM_ST `~(t' = &0)` MP_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) +*) + +let general_482_deformation = prove_by_refinement( +`main_nonlinear_terminal_v11 ==> + (!s FF k p0 p1 p2 v. + {v p0,v p2} = {v (p1+1),v (p1 + (k-1))} /\ + FF = IMAGE (\i. (v i,v (SUC i))) (:num) /\ + is_scs_v39 s /\ + k = scs_k_v39 s /\ + 3 < k /\ + MMs_v39 s v /\ + scs_basic_v39 s /\ + scs_generic v /\ + &3 <= dist(v p0,v p2) /\ + (!i j. scs_diag k i j /\ ~(psort k (i, j) = psort k (p0,p2)) ==> scs_a_v39 s i j < dist(v i,v j)) /\ + (!i j. scs_diag k i j ==> &4 * h0 < scs_b_v39 s i j) /\ + interior_angle1 (vec 0) FF (v p1) < pi /\ + (pi/ &2 < interior_angle1 (vec 0) FF (v p1) \/ interior_angle1 (vec 0) FF (v p2) < pi) /\ + scs_a_v39 s p1 p2 = &2 /\ + scs_b_v39 s p1 p2 <= &2 * h0 /\ + &2 <= dist(v p0,v p1) /\ + dist(v p0, v p1) <= cstab ==> + dist(v p1,v p2) = &2)`, + (* {{{ proof *) + [ + COMMENT "preliminaries"; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(k<=3)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC (arith `3 < k ==> ~(k <= 3)`); + BY(ASM_REWRITE_TAC[]); + RULE_ASSUM_TAC (ONCE_REWRITE_RULE[EQ_SYM_EQ]); + FIRST_X_ASSUM_ST `&2 = x` (ASSUME_TAC o (ONCE_REWRITE_RULE[EQ_SYM_EQ])); +(* FIRST_X_ASSUM_ST `&2 *h0 = x` (ASSUME_TAC o (ONCE_REWRITE_RULE[EQ_SYM_EQ])); *) + TYPIFY `unadorned_v39 s` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.scs_basic]); + TYPIFY `BBprime2_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.scs_basic;Ayqjtmd.unadorned_MMs]); + TYPIFY `BBprime_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime2_v39]); + TYPIFY `BBs_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime_v39]); + INTRO_TAC Appendix.BBs_v39 [`s`;`v`]; + ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;Terminal.IMAGE_SUBSET_IN;IN_UNIV]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `V = IMAGE v (:num)`; + TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + EXPAND_TAC "V"; + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + INTRO_TAC (GEN_ALL Local_lemmas.INTERIOR_ANGLE1_POS) [`E`;`V`;`FF`;`v p1`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC (GEN_ALL Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM_IVS ) [`E`;`V`;`FF`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!i m. ITER m (rho_node1 FF) (v i) = v (m + i)` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + INTRO_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME) [`V`;`E`;`k`;`s`;`FF`;`v i`;`v`;`i`]; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. v (i + (k:num)) = v i` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Oxl_def.periodic]); + TYPIFY `!i. ivs_rho_node1 FF (v i) = v ( i + (k-1))` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC VV_SUC_EQ_IVS_RHO_NODE_PRIME; + GEXISTL_TAC [`V`;`E`;`s`]; + BY(ASM_REWRITE_TAC[]); + TYPIFY `generic V E` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.scs_generic]); + COMMENT "collinearity"; + TYPIFY `~collinear {vec 0,v (p1 + (k-1)),v (p1 + 1)}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Zlzthic.PROPERTIES_GENERIC_LOCAL_FAN_ALT; + GEXISTL_TAC [`V`;`E`;`FF`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC Ocbicby.scs_lb_2 [`s`;`v`;`(p1+1)`;`(p1+(k-1))`]; + ASM_REWRITE_TAC[DIST_REFL;arith `~(&2 <= &0)`]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + ASM_SIMP_TAC[arith `3 < k ==> ~(k=0)`]; + REPEAT (GMATCH_SIMP_TAC MOD_LT); + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + COMMENT "coplanarity"; + TYPIFY `interior_angle1 (vec 0) FF (v p1) = azim (vec 0) (v p1) (v (p1+1)) (v (p1 + k -1))` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `interior_angle1` (C INTRO_TAC [`v p1`]); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `ITER` (C INTRO_TAC [`p1`;`1`]); + REWRITE_TAC[ITER_1]; + BY(MESON_TAC[arith `1 + p1 = p1 + 1`]); + TYPIFY `~coplanar {vec 0, v p1,v(p1+1),v(p1 + k- 1)}` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; + FIRST_X_ASSUM (SUBST1_TAC o GSYM); + BY(ASM_SIMP_TAC[DE_MORGAN_THM;arith `&0 ~(x = &0)`; arith `(x < pi ==> ~(x = pi))`]); + COMMENT "482"; + INTRO_TAC (UNDISCH Ocbicby.LEMMA_4828966562) [`norm (v p0)`;`norm (v p2)`;`norm (v p1)`;`dist(v p1,v p2)`;`dist (v p0,v p1)`;`dist(v p0,v p2)`]; + ANTS_TAC; + ASM_REWRITE_TAC[GSYM Sphere.cstab]; + TYPIFY_GOAL_THEN `&2 <= norm (v p0) /\ norm (v p0) <= &2 * h0 /\ &2 <= norm (v p2) /\ norm (v p2) <= &2 * h0 /\ &2 <= norm (v p1) /\ norm (v p1) <= &2 * h0 /\ &2 <= dist (v p1,v p2) /\ dist (v p1,v p2) <= &2 * h0 ` (unlist REWRITE_TAC); + BY(ASM_MESON_TAC[ ( Fnjlbxs.in_ball_annulus);REAL_LE_TRANS]); + CONJ_TAC; + TYPIFY `dist(v p1, v p2) = dist(v p2,v p1)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[DIST_SYM]); + REWRITE_TAC[GSYM Trigonometry1.DIST_L_ZERO]; + REWRITE_TAC[GSYM Oxlzlez.coplanar_delta_y]; + FIRST_X_ASSUM MP_TAC; + MATCH_MP_TAC (TAUT `(a = b) ==> (a ==> b)`); + AP_TERM_TAC; + AP_TERM_TAC; + AP_TERM_TAC; + BY(FIRST_X_ASSUM_ST `{a,b} = y` MP_TAC THEN SET_TAC[]); + COMMENT "ups"; + REWRITE_TAC[GSYM Trigonometry1.DIST_L_ZERO;arith `x*x = x pow 2`]; + REWRITE_TAC[GSYM Collect_geom2.NOT_COL_EQ_UPS_X_POS]; + FIRST_X_ASSUM_ST `collinear` MP_TAC; + MATCH_MP_TAC (TAUT `(a = b) ==> (a ==> b)`); + REPEAT AP_TERM_TAC; + BY(FIRST_X_ASSUM_ST `{a,b} = y` MP_TAC THEN SET_TAC[]); + REPEAT WEAKER_STRIP_TAC; + (PROOF_BY_CONTR_TAC); + TYPIFY `v p1 dot (v (p1 + 1) cross v (p1 + k -1)) > &0` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `v p1 dot (v (p1 + 1) cross v (p1 + k -1)) = (v p1 cross (v (p1 + 1))) dot ( v (p1 + k -1))` (C SUBGOAL_THEN SUBST1_TAC); + BY(VEC3_TAC); + REWRITE_TAC[arith `a > &0 <=> &0 < a`;GSYM Zlzthic.azim_lt_pi_cross]; + BY(ASM_MESON_TAC[]); + COMMENT "fix abs"; + TYPIFY `(?f e'. &0 < e' /\ deformation f V (--e',e') /\ (!w t. ~(w = v p1) ==> f w t = w) /\ (!t. abs t < e' ==> dist (v p0,f (v p1) t) = dist (v p0,v p1) /\ dist (v p2,f (v p1) t) = dist (v p2,v p1) -abs t /\ norm (f (v p1) t) = norm (v p1)))` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM_ST `{a,b} = {c,d}` MP_TAC; + REWRITE_TAC[Collect_geom.PAIR_EQ_EXPAND] THEN DISCH_THEN DISJ_CASES_TAC; + INTRO_TAC deform_simplex_edge_exists [`V`;`(\t. -- abs t)`;`(\ (t:real). &0)`;`v (p1 + k -1)`;`v p1`;`v (p1 +1)`;`&1`]; + STRIP_TAC; + FIRST_X_ASSUM MP_TAC THEN ANTS_TAC; + REWRITE_TAC[arith `&0 < &1 /\ -- &0 = &0`;REAL_CONTINUOUS_CONST]; + REPEAT (GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT); + REWRITE_TAC[REAL_OPEN_REAL_INTERVAL;REAL_CONTINUOUS_CONST;arith `--abs (&0) = &0`]; + nCONJ_TAC 2; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC REAL_CONTINUOUS_NEG; + BY(REWRITE_TAC[real_continuous_abs]); + FIRST_X_ASSUM (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `cross` (unlist REWRITE_TAC); + BY(ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,c,d,b}`] THEN FIRST_X_ASSUM_ST `coplanar` (unlist REWRITE_TAC)); + ASM_REWRITE_TAC[arith `x + &0 = x`;arith `x + -- t = x - t`;DIST_SYM]; + REPEAT WEAKER_STRIP_TAC; + GEXISTL_TAC [`f`;`e'`]; + ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + INTRO_TAC deform_simplex_edge_exists [`V`;`(\ (t:real). &0)`;`(\t. --abs t)`;`v (p1 +k - 1)`;`v p1`;`v (p1 +1)`;`&1`]; + STRIP_TAC; + FIRST_X_ASSUM MP_TAC THEN ANTS_TAC; + REWRITE_TAC[arith `&0 < &1 /\ -- &0 = &0`;REAL_CONTINUOUS_CONST]; + REPEAT (GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT); + REWRITE_TAC[REAL_OPEN_REAL_INTERVAL;REAL_CONTINUOUS_CONST;arith `--abs(&0)= &0`]; + FIRST_X_ASSUM_ST `cross` (unlist REWRITE_TAC); + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,c,d,b}`] THEN FIRST_X_ASSUM_ST `coplanar` (unlist REWRITE_TAC); + REPEAT WEAKER_STRIP_TAC THEN MATCH_MP_TAC REAL_CONTINUOUS_NEG; + BY(REWRITE_TAC[real_continuous_abs]); + ASM_REWRITE_TAC[arith `x + &0 = x`;arith `x + -- t = x - t`;DIST_SYM]; + REPEAT WEAKER_STRIP_TAC; + GEXISTL_TAC [`f`;`e'`]; + BY(ASM_REWRITE_TAC[]); + (REPEAT WEAKER_STRIP_TAC); + TYPIFY `~(k=0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_SIMP_TAC[arith `3 < k ==> ~(k=0)`]); + TYPIFY `!i j.scs_a_v39 s (i MOD k) (j MOD k) = scs_a_v39 s i j /\ scs_b_v39 s (i MOD k) (j MOD k) = scs_b_v39 s i j ` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; + ASM_REWRITE_TAC[Appendix.is_scs_v39]; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[periodic2_MOD]); + TYPIFY `!i. i MOD k < k` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION]); + TYPIFY `!i. v (i MOD k) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[]); + INTRO_TAC BBs_inj [`s`;`v`;`k`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!j. j < k ==> (j MOD k = j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[MOD_LT]); + COMMENT "restart here"; + TYPIFY `~(v (p1+1) = v p1) /\ ~(v (p1 + k -1) = v p1)` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `v p1 = v (p1+0)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[arith `p1+0 = p1`]); + FIRST_ASSUM_ST `v(i MOD k) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); + TYPIFY_GOAL_THEN `!i j. i < k /\ j < k /\ ~(i = j) ==> ~(v i = v (j:num))` (REPEAT o GMATCH_SIMP_TAC); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + REPEAT (GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (REPEAT o GMATCH_SIMP_TAC); + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + TYPIFY `(!t. f (v (p1+1)) t = v(p1+1)) /\ (!t. f (v (p1+k-1)) t = v (p1+k-1))` (C SUBGOAL_THEN ASSUME_TAC); + BY(CONJ_TAC THEN GEN_TAC THEN FIRST_X_ASSUM_ST `(f w t = w)` MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `?e1. &0 < e1 /\ (!t. abs t < e1 ==> &0 < azim (vec 0) (f (v p1) t) (v (p1+1)) (v (p1+k-1)) /\ azim (vec 0) (f(v p1) t) (v (p1+1)) (v (p1+k-1)) < pi)` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC WNWSHJT_ALT [`v(p1+k-1)`;`v (p1)`;`v (p1+1)`;`f`;`-- e'`;`e'`;`pi`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + CONJ_TAC; + MATCH_MP_TAC Zlzthic.deformation_subset; + TYPIFY `V` EXISTS_TAC; + ASM_REWRITE_TAC[]; + EXPAND_TAC "V"; + BY(REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY;IN_IMAGE;IN_UNIV] THEN MESON_TAC[]); + TYPIFY_GOAL_THEN `~collinear {vec 0, v p1, v (p1 + 1)} /\ ~collinear {vec 0, v p1, v (p1 + k - 1)}` (unlist REWRITE_TAC); + BY(FIRST_X_ASSUM_ST `coplanar` MP_TAC THEN MESON_TAC[Planarity.notcoplanar_imp_notcollinear_fan]); + BY(ASM_MESON_TAC[]); + BY(MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!t. abs t < e1 ==> ((&0 < azim (vec 0) (v(p1+1)) (v(p1+k-1)) (f (v p1) t) /\ azim (vec 0) (v(p1+1)) (v(p1+k-1)) (f (v p1) t) < pi) /\ (&0 < azim (vec 0) (v(p1+k-1)) (f (v p1) t) (v(p1+1)) /\ azim (vec 0) (v(p1+k-1)) (f (v p1) t) (v(p1+1)) < pi))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `azim` (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[GSYM sin_azim_pos]; + INTRO_TAC Trigonometry.JBDNJJB [`f (v p1) t`;`v(p1 + 1)`;`v (p1+k-1)`]; + INTRO_TAC Trigonometry.JBDNJJB [`v(p1 + 1)`;`v (p1+k-1)`;`f (v p1) t`]; + INTRO_TAC Trigonometry.JBDNJJB [`v (p1+k-1)`;`f (v p1) t`;`v(p1 + 1)`]; + TYPIFY_GOAL_THEN `((v (p1 + k - 1) cross f (v p1) t) dot v (p1 + 1)) = ((f (v p1) t cross v (p1 + 1)) dot v (p1 + k - 1)) /\ ((v (p1 + 1) cross v (p1 + k - 1)) dot f (v p1) t) = ((f (v p1) t cross v (p1 + 1)) dot v (p1 + k - 1))` (unlist REWRITE_TAC); + BY(MESON_TAC[CROSS_TRIPLE]); + TYPIFY `!a b. re_eqvl a b ==> (&0 < a <=> &0 < b)` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[]); + REWRITE_TAC[Trigonometry2.re_eqvl]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!w. w IN V ==> f w (&0) = w` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation]; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + TYPIFY `?e2. &0 < e2 /\ (!t. abs t < e2 ==> ~coplanar {vec 0, (f (v p1) t),v (p1+k-1),v(p1+1)})` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC Zlzthic.NONPLANAR_OPEN [`( \ (t:real). (vec 0):real^3)`;`f (v p1)`;`\ (t:real). v (p1+k-1)`;`\ (t:real). v (p1+1)`;`&0`]; + ASM_REWRITE_TAC[CONTINUOUS_CONST]; + ANTS_TAC; + CONJ_TAC; + FIRST_X_ASSUM GMATCH_SIMP_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation]; + BY(REPEAT WEAKER_STRIP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + BY(REWRITE_TAC[arith `abs (&0 - t') = abs t'`] THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "insert"; + INTRO_TAC dihV_obtuse_mono [`(vec 0):real^3`;`v p0`;`v p1`;`v p2`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `{vec 0,v p0, v p1,v p2} = {vec 0,v p1,v (p1+1),v(p1+k-1)}` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM_ST `{a,b} ={c,d}` MP_TAC; + BY(SET_TAC[]); + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + REPLICATE_TAC 2(FIRST_X_ASSUM MP_TAC THEN BURY_MP_TAC); + COMMENT "end insert"; + INTRO_TAC epsilon_quad [`e1`;`e2`;`e'`;`e`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `!t. abs t < e'''' ==> azim (vec 0) (f(v p1) t) (v (p1+1)) (v (p1+k-1)) = dihV (vec 0) (f (v p1) t) (v (p1 + 1)) (v (p1 + k - 1)) /\ azim (vec 0) (v (p1 + 1)) (v (p1 + k - 1)) (f (v p1) t) = dihV (vec 0) (v (p1 + 1)) (v (p1 + k - 1)) (f (v p1) t) /\ azim (vec 0) (v (p1 + k - 1)) (f (v p1) t) (v (p1 + 1)) = dihV (vec 0) (v (p1 + k - 1)) (f (v p1) t) (v (p1 + 1))` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC; + REPEAT (GMATCH_SIMP_TAC (GSYM AZIM_DIHV_SAME)); + INTRO_TAC Planarity.notcoplanar_imp_notcollinear_fan [`(vec 0):real^3`;`f (v p1) t`;`v(p1+k-1)`;`v(p1+1)`]; + ANTS_TAC; + BY((FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[])); + REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`]; + DISCH_THEN (unlist REWRITE_TAC); + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + COMMENT "introduce azim"; + INTRO_TAC azim_assumption_reduction [`s`;`k`;`p1`;`f`;`v`;`e''''`]; + ASM_REWRITE_TAC[]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + CONJ_TAC; + FIRST_X_ASSUM_ST `deformation` MP_TAC; + REWRITE_TAC[Localization.deformation]; + REWRITE_TAC[IN_REAL_INTERVAL;arith `--e < t /\ t < e <=> abs t < e`]; + BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[arith `abs(&0) = &0`]); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + TYPIFY `(azim (vec 0) (v (p1 + k - 1)) (v p1) (v (p1 + k - 2)) < pi \/ ( (!t. abs t < e'''' ==> dihV (vec 0) (v (p1 + k - 1)) (f (v p1) t) (v (p1 + 1)) <= dihV (vec 0) (v (p1 + k - 1)) (v p1) (v (p1 + 1))))) /\ (azim (vec 0) (v (p1 + 1)) (v (p1 + 2)) (v p1) < pi \/ ( (!t. abs t < e'''' ==> dihV (vec 0) (v (p1 + 1)) (v (p1 + k - 1)) (f (v p1) t) <= dihV (vec 0) (v (p1 + 1)) (v (p1 + k - 1)) (v p1))))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[MESON [] `(a \/ (?e1. P e1)) <=> (?e1. (a \/ P e1))`;MESON[] `(a /\ (?e1. P e1)) <=> (?e1. a /\ P e1)`;MESON[] `((?e1. P e1) /\ b) <=> (?e1. P e1 /\ b)`]; + GEXISTL_TAC [`e''''`;`e''''`]; + FIRST_X_ASSUM_ST `w IN V ==> f w (&0) = (w:real^3)` (C INTRO_TAC [`v p1`]); + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[arith `abs(&0) = &0`]); + COMMENT "obtuse case"; + (TYPIFY `pi/ &2 < dihV (vec 0) (v p1) (v (p1+1)) (v (p1+k-1))` ASM_CASES_TAC); + TYPIFY `dihV (vec 0) (v p1) (v(p1+1)) (v (p1+k-1)) = dihV (vec 0) (v p1) (v p2) (v p0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `{a,b}={c,d}` MP_TAC THEN REWRITE_TAC[Collect_geom.PAIR_EQ_EXPAND] THEN MESON_TAC[DIHV_SYM]); + TYPIFY `!t. abs t < e'''' ==> dihV (vec 0) (v p0) (f (v p1) t) (v p2) <= dihV (vec 0) (v p0) (v p1) (v p2) /\ dihV (vec 0) (v p2) (f (v p1) t) (v p0) <= dihV (vec 0) (v p2) (v p1) (v p0)` ENOUGH_TO_SHOW_TAC; + BY(FIRST_X_ASSUM_ST `{a,b}={c,d}` MP_TAC THEN REWRITE_TAC[Collect_geom.PAIR_EQ_EXPAND] THEN DISCH_THEN DISJ_CASES_TAC THEN FIRST_X_ASSUM (unlist REWRITE_TAC) THEN MESON_TAC[DIHV_SYM]); + REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `dihV a b c d <= dihV a' b' c' d'` MP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (C INTRO_TAC [`f (v p1) t`;`-- abs t`])); + (FIRST_X_ASSUM_ST `dihV a b c d <= dihV a' b' c' d'` MP_TAC THEN ANTS_TAC THENL [REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[];ALL_TAC] THEN DISCH_THEN (C INTRO_TAC [`f (v p1) t`;`-- abs t`])); + REWRITE_TAC[DIST_SYM;arith `abs(-- abs t) = abs t`;arith `--abs t <= &0`]; + REPEAT (DISCH_THEN GMATCH_SIMP_TAC); + REWRITE_TAC[arith `a + -- b = a - b`]; + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [` t`]); + ANTS_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM (unlist REWRITE_TAC)); + TYPIFY_GOAL_THEN `abs t < e` (unlist REWRITE_TAC); + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM (unlist REWRITE_TAC)); + BY(REWRITE_TAC[DIST_SYM;DIST_0] THEN MESON_TAC[]); + COMMENT "nonobtuse case"; + FIRST_X_ASSUM_ST `pi / &2 < interior_angle1 (vec 0) FF (v p1)` MP_TAC; + DISCH_TAC; + TYPIFY `interior_angle1 (vec 0) FF (v p2) < pi` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `dihV (vec 0) (v p1) (v (p1+1)) (v (p1+k-1)) = interior_angle1 (vec 0) FF (v p1)` ENOUGH_TO_SHOW_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + FIRST_X_ASSUM_ST `azim` (C INTRO_TAC [`&0`]); + BY(ASM_SIMP_TAC[arith `abs(&0) = &0`]); + FIRST_X_ASSUM_ST `{a,b}={c,d}` (MP_TAC o GSYM) THEN REWRITE_TAC[Collect_geom.PAIR_EQ_EXPAND] THEN DISCH_THEN DISJ_CASES_TAC; + FIRST_X_ASSUM_ST `interior_angle1` MP_TAC THEN (FIRST_ASSUM (unlist REWRITE_TAC)); + INTRO_TAC Ocbicby.INTERIOR_ANGLE1_AZIM [`s`;`v`;`p1 + k - 1`]; + ASM_REWRITE_TAC[LET_THM;IN]; + DISCH_THEN (SUBST1_TAC o GSYM); + TYPIFY_GOAL_THEN `v (SUC (p1+k-1)) = v p1 /\ v ((p1+k-1)+(k-1)) = v (p1 + k - 2)` (unlist REWRITE_TAC); + FIRST_ASSUM_ST `v(i MOD k) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); + FIRST_X_ASSUM_ST `3 < k` MP_TAC; + BY(SIMP_TAC[arith `3 < k ==> SUC (p1+k-1) = 1*k + p1 /\ ((p1+k-1)+(k-1) = (1*k + (p1+k-2)))`;MOD_MULT_ADD]); + DISCH_THEN (unlist REWRITE_TAC); + DISJ2_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST ` /\ ` ((unlist REWRITE_TAC) o GSYM); + ONCE_REWRITE_TAC[DIHV_SYM]; + FIRST_X_ASSUM MATCH_MP_TAC; + TYPIFY `-- abs t` EXISTS_TAC; + REWRITE_TAC[arith `abs(-- abs t) = abs (t)`;arith `-- abs t <= &0`;arith `x + -- t = x - t`;DIST_0;DIST_SYM]; + CONJ_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM (unlist REWRITE_TAC)); + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM (unlist REWRITE_TAC)); + BY(REWRITE_TAC[DIST_SYM] THEN MESON_TAC[]); + COMMENT "second nonobtuse case"; + FIRST_X_ASSUM_ST `interior_angle1` MP_TAC THEN (FIRST_ASSUM (unlist REWRITE_TAC)); + INTRO_TAC Ocbicby.INTERIOR_ANGLE1_AZIM [`s`;`v`;`p1 +1`]; + ASM_REWRITE_TAC[LET_THM;IN]; + DISCH_THEN (SUBST1_TAC o GSYM); + REWRITE_TAC[arith `SUC (p1+1) = p1+2`]; + TYPIFY_GOAL_THEN `v ((p1+1)+k-1) = v p1` (unlist REWRITE_TAC); + FIRST_ASSUM_ST `v(i MOD k) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); + FIRST_X_ASSUM_ST `3 < k` MP_TAC; + BY(SIMP_TAC[arith `3 < k ==> (p1+1)+k-1 = 1*k + p1`;MOD_MULT_ADD]); + DISCH_THEN (unlist REWRITE_TAC); + DISJ2_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST ` /\ ` ((unlist REWRITE_TAC) o GSYM); + FIRST_X_ASSUM MATCH_MP_TAC; + TYPIFY `-- abs t` EXISTS_TAC; + REWRITE_TAC[arith `abs(-- abs t) = abs (t)`;arith `-- abs t <= &0`;arith `x + -- t = x - t`;DIST_0;DIST_SYM]; + CONJ_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM (unlist REWRITE_TAC)); + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM (unlist REWRITE_TAC)); + BY(REWRITE_TAC[DIST_SYM] THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "finally back to root goal"; + TYPIFY `!i j. (v i = v j) ==> (i MOD k = j MOD k)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_ASSUM_ST `v (i MOD k) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); + FIRST_X_ASSUM_ST `!i (j:num). i < k /\ j < k /\ v i = v j ==> i = j` MP_TAC; + FIRST_X_ASSUM_ST `!i. i MOD k < k` MP_TAC; + BY(MESON_TAC[]); + TYPIFY `psort k (p0,p2) = psort k (p1+1,p1+k-1)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `~(k=0)` MP_TAC; + DISCH_TAC; + INTRO_TAC psort_mod [`k`]; + FIRST_X_ASSUM (unlist REWRITE_TAC); + DISCH_THEN ((unlist ONCE_REWRITE_TAC) o GSYM); + FIRST_X_ASSUM_ST `{a,b}={c,d}` (MP_TAC) THEN REWRITE_TAC[Collect_geom.PAIR_EQ_EXPAND] THEN DISCH_THEN DISJ_CASES_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[Terminal.psort_sym]); + INTRO_TAC deformation_BBs_ALT [`s`;`k`;`f`;`v`;`e''''`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC deformation_restrict; + TYPIFY `e'` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN (FIRST_X_ASSUM (unlist REWRITE_TAC))); + TYPIFY `v i = v p1` ASM_CASES_TAC; + BY(FIRST_X_ASSUM (unlist REWRITE_TAC) THEN MESON_TAC[]); + FIRST_X_ASSUM_ST `!w t. ~(w = v p1) ==> f w t = w` (C INTRO_TAC [`v i`;`t`]); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + CONJ_TAC; + MATCH_MP_TAC a_assumption_reduction; + GEXISTL_TAC [`k`;`p1`;`e'`]; + ASM_REWRITE_TAC[]; + CONJ_TAC; + REPEAT (FIRST_X_ASSUM_ST `psort` MP_TAC); + BY(MESON_TAC[]); + TYPIFY `(?e1. &0 < e1 /\ (scs_a_v39 s p1 p2 = dist (v p1,v p2) ==> (!t. abs t < e1 ==> scs_a_v39 s p1 (p2) <= dist (f (v p1) t,v (p2))))) /\ (?e1. &0 < e1 /\ (scs_a_v39 s p1 (p0) = dist (v p1,v (p0)) ==> (!t. abs t < e1 ==> scs_a_v39 s p1 (p0) <= dist (f (v p1) t,v (p0)))))` (C SUBGOAL_THEN ASSUME_TAC); + CONJ2_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `e'` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]); + BY(FIRST_X_ASSUM (unlist REWRITE_TAC) THEN (REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC)) THEN REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); + TYPIFY `&1` EXISTS_TAC; + BY(ASM_REWRITE_TAC[arith `&0 < &1`]); + FIRST_X_ASSUM_ST `{a,b}={c,d}` (MP_TAC) THEN REWRITE_TAC[Collect_geom.PAIR_EQ_EXPAND] THEN DISCH_THEN DISJ_CASES_TAC; + TYPIFY `(p1 + 1) MOD k = p0 MOD k /\ (p1+k-1) MOD k = p2 MOD k` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + TYPIFY_GOAL_THEN `scs_a_v39 s p1 (p1+1) = scs_a_v39 s p1 p0 /\ scs_a_v39 s p1 (p1+k-1) = scs_a_v39 s p1 p2` (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `scs_k_v39 s = k` MP_TAC THEN MESON_TAC[Nuxcoea.CHANGE_A_SCS_MODR]); + FIRST_X_ASSUM kill THEN FIRST_X_ASSUM (unlist REWRITE_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + TYPIFY `(p1 + 1) MOD k = p2 MOD k /\ (p1+k-1) MOD k = p0 MOD k` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + TYPIFY_GOAL_THEN `scs_a_v39 s p1 (p1+1) = scs_a_v39 s p1 p2 /\ scs_a_v39 s p1 (p1+k-1) = scs_a_v39 s p1 p0` (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `scs_k_v39 s = k` MP_TAC THEN MESON_TAC[Nuxcoea.CHANGE_A_SCS_MODR]); + FIRST_X_ASSUM kill THEN FIRST_X_ASSUM (unlist REWRITE_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + COMMENT "b assumption"; + MATCH_MP_TAC b_assumption_reduction; + GEXISTL_TAC [`k`;`p1`;`e'`]; + ASM_REWRITE_TAC[]; + TYPIFY `(?e2. &0 < e2 /\ (dist (v p1,v (p2)) = scs_b_v39 s p1 (p2) ==> (!t. abs t < e2 ==> dist (f (v p1) t,v (p2)) <= scs_b_v39 s p1 (p2)))) /\ (?e2. &0 < e2 /\ (dist (v p1,v (p0)) = scs_b_v39 s p1 (p0) ==> (!t. abs t < e2 ==> dist (f (v p1) t,v (p0)) <= scs_b_v39 s p1 (p0))))` (C SUBGOAL_THEN ASSUME_TAC); + CONJ2_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `e'` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]); + BY(FIRST_X_ASSUM (unlist REWRITE_TAC) THEN (REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC)) THEN REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); + TYPIFY `e'` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]); + BY(FIRST_X_ASSUM (unlist REWRITE_TAC) THEN (REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC)) THEN REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `{a,b}={c,d}` (MP_TAC) THEN REWRITE_TAC[Collect_geom.PAIR_EQ_EXPAND] THEN DISCH_THEN DISJ_CASES_TAC; + TYPIFY `(p1 + 1) MOD k = p0 MOD k /\ (p1+k-1) MOD k = p2 MOD k` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + TYPIFY_GOAL_THEN `scs_b_v39 s p1 (p1+1) = scs_b_v39 s p1 p0 /\ scs_b_v39 s p1 (p1+k-1) = scs_b_v39 s p1 p2` (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `scs_k_v39 s = k` MP_TAC THEN MESON_TAC[Nuxcoea.CHANGE_B_SCS_MODR]); + FIRST_X_ASSUM kill THEN FIRST_X_ASSUM (unlist REWRITE_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + TYPIFY `(p1 + 1) MOD k = p2 MOD k /\ (p1+k-1) MOD k = p0 MOD k` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + TYPIFY_GOAL_THEN `scs_b_v39 s p1 (p1+1) = scs_b_v39 s p1 p2 /\ scs_b_v39 s p1 (p1+k-1) = scs_b_v39 s p1 p0` (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `scs_k_v39 s = k` MP_TAC THEN MESON_TAC[Nuxcoea.CHANGE_B_SCS_MODR]); + FIRST_X_ASSUM kill THEN FIRST_X_ASSUM (unlist REWRITE_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "back to root, next tau"; + TYPIFY `!t. abs t < e'' ==> sum {i | i < k} (\i. rho_fun (norm (v i)) * azim (vec 0) (v i) (v (i + 1)) (v (i + k - 1))) <= sum {i | i < k} (\i. rho_fun (norm (f (v i) t)) * azim (vec 0) (f (v i) t) (f(v(i+1)) t) (f (v (i + k - 1)) t))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC MMs_minimize_tau_fun; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM (unlist REWRITE_TAC)); + TYPIFY `!t. abs t < e'' ==> sum ({i | i < k} DIFF {p1 MOD k,(p1+1) MOD k, (p1+k-1) MOD k}) (\i. rho_fun (norm (f (v i) t)) * azim (vec 0) (f (v i) t) (f (v (i + 1)) t) (f (v (i + k - 1)) t)) = sum {i | i < k} (\i. rho_fun (norm (f (v i) t)) * azim (vec 0) (f (v i) t) (f (v (i + 1)) t) (f (v (i + k - 1)) t)) - sum {p1 MOD k,(p1+1) MOD k, (p1+k-1) MOD k} (\i. rho_fun (norm (f (v i) t)) * azim (vec 0) (f (v i) t) (f (v (i + 1)) t) (f (v (i + k - 1)) t))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC SUM_DIFF; + REWRITE_TAC[FINITE_NUMSEG_LT]; + ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY;IN_ELIM_THM]; + BY(REPEAT WEAKER_STRIP_TAC THEN REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[]); + TYPIFY `(\i. rho_fun (norm (f (v i) (&0))) * azim (vec 0) (f (v i) (&0)) (f (v (i + 1)) (&0)) (f (v (i + k - 1)) (&0))) = (\i. rho_fun (norm ((v i) )) * azim (vec 0) ( (v i) ) ( (v (i + 1)) ) ( (v (i + k - 1)) ))` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[FUN_EQ_THM]; + GEN_TAC; + BY(ASM_SIMP_TAC[]); + TYPIFY `?e3. &0 < e3 /\ (!t. abs t < e3 ==> dist(v p1,v p2) + t IN real_interval(a,b))` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC Zlzthic.real_interval_contains_0_ball [`a-dist(v p1,v p2)`;`b - dist(v p1,v p2)`;`&1`]; + REWRITE_TAC[arith `&0 < &1`;arith `a - d < &0 <=> a < d`;arith `&0 < b - d <=> d < b`]; + ANTS_TAC; + FIRST_X_ASSUM_ST `dist s IN real_interval (a,b)` MP_TAC; + BY(REWRITE_TAC[IN_REAL_INTERVAL]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e'''` EXISTS_TAC; + BY(ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC THEN (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN REPLICATE_TAC 6 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[IN_REAL_INTERVAL] THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + COMMENT "combine e'' e1' e'''' e3 "; + INTRO_TAC epsilon_quad [`e''`;`e1'`;`e''''`;`e3`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY ` ((p1+1) MOD k + k-1) MOD k = p1 MOD k /\ ((p1+k-1) MOD k + 1) MOD k = p1 MOD k` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC MOD_SHIFT; + TYPIFY `p1+1` EXISTS_TAC; + FIRST_X_ASSUM_ST `~(k=0)` MP_TAC THEN SIMP_TAC[arith `~(k=0) ==> (p1+1) + k -1 = 1 *k + p1`;MOD_MULT_ADD;MOD_MOD_REFL]; + DISCH_TAC; + GMATCH_SIMP_TAC MOD_SHIFT; + TYPIFY `p1+k-1` EXISTS_TAC; + BY(FIRST_X_ASSUM_ST `~(k=0)` MP_TAC THEN SIMP_TAC[arith `~(k=0) ==> (p1+k-1) +1 = 1 *k + p1`;MOD_MULT_ADD;MOD_MOD_REFL]); + TYPIFY `!t. abs t < e'''''' ==> sum {p1 MOD k, (p1 + 1) MOD k, (p1 + k - 1) MOD k} (\i. rho_fun (norm (v i)) * azim (vec 0) (v i) (v (i + 1)) (v (i + k - 1))) <= sum {p1 MOD k, (p1 + 1) MOD k, (p1 + k - 1) MOD k} (\i. rho_fun (norm (f (v i) t)) * azim (vec 0) (f (v i) t) (f (v (i + 1)) t) (f (v (i + k - 1)) t))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_ASSUM_ST `sum` (C INTRO_TAC [`&0`]); + FIRST_X_ASSUM_ST `sum` (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[arith `abs(&0) = &0`]; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN FIRST_X_ASSUM (unlist REWRITE_TAC)); + ONCE_REWRITE_TAC[arith `sdiff = sfull - s3 <=> s3 = sfull - sdiff`]; + DISCH_THEN SUBST1_TAC; + DISCH_THEN SUBST1_TAC; + FIRST_X_ASSUM_ST `sum` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN FIRST_X_ASSUM (unlist REWRITE_TAC)); + ASM_REWRITE_TAC[]; + TYPIFY `sum ({i | i < k} DIFF {p1 MOD k, (p1 + 1) MOD k, (p1 + k - 1) MOD k}) (\i. rho_fun (norm (v i)) * azim (vec 0) (v i) (v (i + 1)) (v (i + k - 1))) = sum ({i | i < k} DIFF {p1 MOD k, (p1 + 1) MOD k, (p1 + k - 1) MOD k}) (\i. rho_fun (norm (f (v i) t)) * azim (vec 0) (f (v i) t) (f (v (i + 1)) t) (f (v (i + k - 1)) t))` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[arith `(a <= b) ==> a - u <= b - u`]); + MATCH_MP_TAC SUM_EQ; + REWRITE_TAC[IN_DIFF;IN_INSERT;NOT_IN_EMPTY;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY ` ~(p1 MOD k = x MOD k) /\ ~(p1 MOD k = (x + 1) MOD k) /\ ~(p1 MOD k = (x + k - 1) MOD k)` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `x MOD k = (x + 0) MOD k` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[arith `x + 0 = x`]); + PROOF_BY_CONTR_TAC; + INTRO_TAC solve_mod_k [`k`] THEN ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[TAUT `!a b. (a ==> b) <=> (~b ==> ~a)`]; + DISCH_TAC; + FIRST_X_ASSUM_ST `x+k-1` MP_TAC THEN REWRITE_TAC[] THEN REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC; + GMATCH_SIMP_TAC MOD_0; + ASM_REWRITE_TAC[MOD_MOD_REFL;MOD_MULT_ADD;arith `a + k - 0 = 1*k + a`]; + GMATCH_SIMP_TAC MOD_MOD_REFL; + BY(ASM_REWRITE_TAC[] THEN REPLICATE_TAC 2(FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[MOD_LT]); + TYPIFY `x MOD k = x` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM_ST `x < (k:num)` MP_TAC THEN MESON_TAC[MOD_LT]); + DISCH_TAC; + FIRST_X_ASSUM_ST `~` MP_TAC; + ASM_REWRITE_TAC[]; + DISJ2_TAC; + DISJ2_TAC; + TYPIFY `1 MOD k = 1` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN MESON_TAC[MOD_LT;arith `3 < k ==> 1 < k`]); + MATCH_MP_TAC MOD_SHIFT; + BY(FIRST_X_ASSUM_ST `~(k = 0)` MP_TAC THEN MESON_TAC[MOD_MOD_REFL]); + TYPIFY `x MOD k = x` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM_ST `x < (k:num)` MP_TAC THEN MESON_TAC[MOD_LT]); + DISCH_TAC; + FIRST_X_ASSUM_ST `~` MP_TAC; + ASM_REWRITE_TAC[]; + DISJ2_TAC; + DISJ1_TAC; + TYPIFY `(k-1) MOD k = (k-1)` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM_ST `~(k=0)` MP_TAC THEN MESON_TAC[MOD_LT;arith `~(k=0) ==> k - 1 < k`]); + TYPIFY `k - (k-1) = 1` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM_ST `~(k=0)` MP_TAC THEN ARITH_TAC); + MATCH_MP_TAC MOD_SHIFT; + BY(FIRST_X_ASSUM_ST `~(k = 0)` MP_TAC THEN MESON_TAC[MOD_MOD_REFL]); + POP_ASSUM (fun t -> FIRST_X_ASSUM (MP_TAC o (C MATCH_MP t))); + (DISCH_THEN (unlist REWRITE_TAC)); + AP_THM_TAC; + AP_TERM_TAC; + AP_TERM_TAC; + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN (FIRST_X_ASSUM_ST `abs` (unlist REWRITE_TAC))); + TYPIFY `v x = v p1` ASM_CASES_TAC; + BY(FIRST_X_ASSUM (unlist REWRITE_TAC) THEN MESON_TAC[]); + POP_ASSUM (fun t -> FIRST_X_ASSUM (MP_TAC o (C MATCH_MP t))); + BY(DISCH_THEN (unlist REWRITE_TAC)); + COMMENT "back to root: relate sum to taum"; + TYPIFY `!i. f (v i) (&0) = (v i)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM_ST `IN` MP_TAC) THEN REPEAT (FIRST_X_ASSUM_ST `f w (&0) = w` MP_TAC) THEN MESON_TAC[]); + TYPIFY `?t'. abs t' < e'''''' /\ ~(t' = &0)` (C SUBGOAL_THEN MP_TAC); + BY(TYPIFY `e'''''' / &2` EXISTS_TAC THEN FIRST_X_ASSUM_ST `&0 < e''''''` MP_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + REPLICATE_TAC 5 (FIRST_X_ASSUM (C INTRO_TAC [`t'`]) THEN ANTS_TAC THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[arith `~(x <= y) <=> y < x`]; + TYPIFY_GOAL_THEN `!f. sum {p1 MOD k, (p1 + 1) MOD k, (p1 + k - 1) MOD k} f = f (p1 MOD k) + f ((p1 + 1) MOD k) + f ((p1+k-1) MOD k)` (unlist REWRITE_TAC); + GEN_TAC; + MATCH_MP_TAC Geomdetail.SUM_DIS3; + TYPIFY `p1 MOD k = (p1 + 0) MOD k` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[arith `p1 + 0 = p1`]); + REWRITE_TAC[DE_MORGAN_THM]; + REPEAT (GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT); + REPEAT (GMATCH_SIMP_TAC MOD_LT); + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + REWRITE_TAC[Appendix.rho_rho_fun]; + FIRST_X_ASSUM_ST `DIFF` kill; + REPEAT (FIRST_X_ASSUM_ST `sum` kill); + FIRST_X_ASSUM_ST `MOD` (MP_TAC o GSYM) THEN REPEAT WEAKER_STRIP_TAC; + POP_ASSUM (fun t -> FIRST_X_ASSUM (MP_TAC o (C MATCH_MP t))); + DISCH_TAC; + FIRST_ASSUM (C INTRO_TAC [`&0`]); + FIRST_X_ASSUM (C INTRO_TAC [`t'`]); + FIRST_X_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC; + DISCH_THEN (unlist REWRITE_TAC); + DISCH_THEN (unlist REWRITE_TAC); + POP_ASSUM (fun t -> FIRST_X_ASSUM (MP_TAC o (C MATCH_MP t))); + DISCH_TAC; + FIRST_ASSUM (C INTRO_TAC [`&0`]); + FIRST_X_ASSUM (C INTRO_TAC [`t'`]); + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist REWRITE_TAC); + DISCH_THEN (unlist REWRITE_TAC); + TYPIFY `p1 MOD k = (p1 MOD k) MOD k` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `~(k=0)` MP_TAC THEN MESON_TAC[MOD_MOD_REFL]); + POP_ASSUM (fun t -> FIRST_X_ASSUM (MP_TAC o (C MATCH_MP t))); + ASM_REWRITE_TAC[]; + DISCH_TAC; + FIRST_ASSUM (C INTRO_TAC [`&0`]); + FIRST_X_ASSUM (C INTRO_TAC [`t'`]); + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist REWRITE_TAC); + DISCH_THEN (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `azim` (C INTRO_TAC [`t'`]); + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist REWRITE_TAC); + MATCH_MP_TAC (arith `r1 * a1 + r2 * (a2) + r3 * (b2) - (pi + sol0) < r1' * a1' + r2 * (a2') + r3 * (b3') - (pi + sol0) ==> r1 * a1 + r2 * (a + a2) + r3 * (b2 + b) < r1' * a1' + r2 * (a + a2') + r3 * (b3' + b)`); + REPEAT (GMATCH_SIMP_TAC (GSYM tau3_azim)); + REPEAT (GMATCH_SIMP_TAC tau3_taum_nonplanar); + FIRST_X_ASSUM_ST `taum` MP_TAC; + DISCH_TAC; + REPEAT (FIRST_X_ASSUM_ST `coplanar` MP_TAC) THEN REPEAT DISCH_TAC; + REPEAT (FIRST_X_ASSUM_ST `azim a b c d <= pi` MP_TAC) THEN REPEAT DISCH_TAC; + REPEAT (FIRST_X_ASSUM_ST `azim a b c d < pi` MP_TAC) THEN REPEAT DISCH_TAC; + TYPIFY `abs t' < e1 /\ abs t' < e2` (C SUBGOAL_THEN ASSUME_TAC); + BY(CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); + REPEAT (FIRST_X_ASSUM_ST `&0 < e2` MP_TAC) THEN REPEAT DISCH_TAC; + TYPIFY_GOAL_THEN `azim (vec 0) (v p1) (v (p1 + 1)) (v (p1 + k - 1)) <= pi /\ azim (vec 0) (f (v p1) t') (v (p1 + 1)) (v (p1 + k - 1)) <= pi` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 25 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[arith `abs(&0) = &0`;arith `x < y ==> x <= y`]); + REPEAT (FIRST_X_ASSUM_ST `azim` kill); + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `~coplanar {vec 0, f (v p1) t', v p0, v p2} ` (unlist REWRITE_TAC); + TYPIFY `{vec 0,f(v p1) t',v p0,v p2} = {vec 0,f (v p1) t',v (p1+k-1),v(p1+1)}` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM_ST `{a,b}={c,d}` MP_TAC THEN SET_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); + TYPIFY_GOAL_THEN `!w. taum (norm w) (norm (v (p1 + 1))) (norm (v (p1 + k - 1))) (dist (v (p1 + 1),v (p1 + k - 1))) (dist (w,v (p1 + k - 1))) (dist (w,v (p1 + 1))) = taum (norm (v p0)) (norm (v p2)) (norm (w)) (dist(w,v p2)) (dist (v p0,w)) (dist (v p0,v p2))` (unlist REWRITE_TAC); + GEN_TAC; + FIRST_X_ASSUM_ST `{a,b}={c,d}` (MP_TAC) THEN REWRITE_TAC[Collect_geom.PAIR_EQ_EXPAND] THEN DISCH_THEN DISJ_CASES_TAC; + ASM_REWRITE_TAC[DIST_SYM]; + BY(MESON_TAC[Terminal.taum_sym]); + ASM_REWRITE_TAC[DIST_SYM]; + BY(MESON_TAC[Terminal.taum_sym]); + FIRST_X_ASSUM_ST `norm a = norm b` (C INTRO_TAC [`t'`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); + REWRITE_TAC[DIST_SYM] THEN (DISCH_THEN (unlist REWRITE_TAC)); + FIRST_X_ASSUM MATCH_MP_TAC; + CONJ_TAC; + REWRITE_TAC[arith `x - y = x + -- y`]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `abs(-- abs t') = abs t'`]); + ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM_ST `~(t' = &0)` MP_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + + +let CUXVZOZ = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (!s FF k p1 v. + FF = IMAGE (\i. (v i,v (SUC i))) (:num) /\ + is_scs_v39 s /\ + k = scs_k_v39 s /\ + 3 < k /\ + MMs_v39 s v /\ + scs_basic_v39 s /\ + scs_generic v /\ + &3 <= dist(v (p1+k-1),v (p1+1)) /\ + (!i j. scs_diag k i j /\ ~(psort k (i, j) = psort k ((p1+k-1),(p1+1))) ==> scs_a_v39 s i j < dist(v i,v j)) /\ + (!i j. scs_diag k i j ==> &4 * h0 < scs_b_v39 s i j) /\ + interior_angle1 (vec 0) FF (v p1) < pi /\ + (pi/ &2 < interior_angle1 (vec 0) FF (v p1) \/ interior_angle1 (vec 0) FF (v (p1+1)) < pi) /\ + scs_a_v39 s p1 (p1+1) = &2 /\ + scs_b_v39 s p1 (p1+1) <= &2 * h0 /\ + &2 <= dist(v (p1+k-1),v p1) /\ + dist(v (p1+k-1), v p1) <= cstab ==> + dist(v p1,v (p1+1)) = &2)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (UNDISCH general_482_deformation) [`s`;`FF`;`k`;`p1 + k - 1`;`p1`;`p1+1`;`v`]; + DISCH_THEN MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let CJBDXXN = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (!s FF k p1 v. + FF = IMAGE (\i. (v i,v (SUC i))) (:num) /\ + is_scs_v39 s /\ + k = scs_k_v39 s /\ + 3 < k /\ + MMs_v39 s v /\ + scs_basic_v39 s /\ + scs_generic v /\ + &3 <= dist(v (p1+1),v (p1+k-1)) /\ + (!i j. scs_diag k i j /\ ~(psort k (i, j) = psort k ((p1+1),(p1+k-1))) ==> scs_a_v39 s i j < dist(v i,v j)) /\ + (!i j. scs_diag k i j ==> &4 * h0 < scs_b_v39 s i j) /\ + interior_angle1 (vec 0) FF (v p1) < pi /\ + (pi/ &2 < interior_angle1 (vec 0) FF (v p1) \/ interior_angle1 (vec 0) FF (v (p1+k-1)) < pi) /\ + scs_a_v39 s p1 (p1+k-1) = &2 /\ + scs_b_v39 s p1 (p1+k-1) <= &2 * h0 /\ + &2 <= dist(v (p1+1),v p1) /\ + dist(v (p1+1), v p1) <= cstab ==> + dist(v p1,v (p1+k-1)) = &2)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (UNDISCH general_482_deformation) [`s`;`FF`;`k`;`p1 + 1`;`p1`;`p1+k-1`;`v`]; + DISCH_THEN MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + ]);; + (* }}} *) + +end;; diff --git a/text_formalization/local/EYYPQDW.hl b/text_formalization/local/EYYPQDW.hl new file mode 100755 index 0000000..ec3e13a --- /dev/null +++ b/text_formalization/local/EYYPQDW.hl @@ -0,0 +1,517 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Eyypqdw = struct + + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Appendix;; + +let SGIN_POW_EQ=prove(`a IN {-- &1, &1} ==> a pow 2= &1`, +REWRITE_TAC[SET_RULE`a IN {b,c}<=> a=b\/ a=c`] +THEN RESA_TAC +THEN REAL_ARITH_TAC);; + + +let EYYPQDW_COPLANAR=prove_by_refinement(`&0< x1 /\ &0 + coplanar{vec 0, v1, v2, v3}`, +[STRIP_TAC; + +REWRITE_TAC[coplanar] +THEN EXISTS_TAC`vec 0:real^3` +THEN EXISTS_TAC`v1:real^3` +THEN EXISTS_TAC`v2:real^3` +THEN ASM_REWRITE_TAC[SET_RULE`{A,B,C,D} SUBSET E<=> A IN E/\ B IN E/\ C IN E/\ D IN E`;Collect_geom2.AFFINE_HULL_3;IN_ELIM_THM] +THEN REPEAT STRIP_TAC; + +EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1+ &0+ &0= &1`] +THEN VECTOR_ARITH_TAC; + +EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN EXISTS_TAC`&0` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0+ &1+ &0= &1`] +THEN VECTOR_ARITH_TAC; + +EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0+ &0+ &1= &1`] +THEN VECTOR_ARITH_TAC; + +EXPAND_TAC"v3" +THEN REWRITE_TAC[CROSS_LAGRANGE;VECTOR_ARITH`a%v+b%(c%v-d%w)=(a+ b*c)%v+(--b*d)%w`] +THEN EXISTS_TAC`&1- (inv (&2 * x1) * (x1 + x3 - x5) + + (inv x1 * a * sqrt (inv (ups_x x1 x2 x6) * ups_x x1 x3 x5)) * + (v1 dot (v2:real^3))) - (--(inv x1 * a * sqrt (inv (ups_x x1 x2 x6) * ups_x x1 x3 x5)) * + (v1 dot v1))` +THEN EXISTS_TAC`(inv (&2 * x1) * (x1 + x3 - x5) + + (inv x1 * a * sqrt (inv (ups_x x1 x2 x6) * ups_x x1 x3 x5)) * + (v1 dot (v2:real^3)))` +THEN EXISTS_TAC`(--(inv x1 * a * sqrt (inv (ups_x x1 x2 x6) * ups_x x1 x3 x5)) * + (v1 dot (v1:real^3)))` +THEN ASM_REWRITE_TAC[REAL_ARITH`(&1-A-B)+A+B= &1`] +THEN VECTOR_ARITH_TAC]);; + + + +let EYYPQDW_NORMV3=prove(`&0< x1 /\ &0 + norm(v3) pow 2= x3`, +STRIP_TAC +THEN ASM_REWRITE_TAC[GSYM DOT_SQUARE_NORM] +THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`v2:real^3`] +THEN MRESAL_TAC (GEN_ALL Trigonometry1.DIST_UPS_X_POS)[`vec 0:real^3`;`v1:real^3`;`v2:real^3`][dist;VECTOR_ARITH`vec 0- A= --A/\ A- vec 0=A:real^3`;GSYM DOT_SQUARE_NORM;NORM_NEG] +THEN MRESAL_TAC Collect_geom.FHFMKIY[`vec 0:real^3`;`v1:real^3`;`v2:real^3`;`x1:real`;`x2:real`;`x6:real`][dist;VECTOR_ARITH`vec 0- A= --A/\ A- vec 0=A:real^3`;GSYM DOT_SQUARE_NORM;NORM_NEG] +THEN MP_TAC(REAL_ARITH`&0< x3/\ &0< x1==> &0<= x3/\ ~(x1= &0)`) +THEN RESA_TAC +THEN EXPAND_TAC"v3" +THEN REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL; DOT_RMUL;DOT_CROSS_SELF;REAL_ARITH`A* &0= &0/\ A+ &0=A/\ &0 +A=A`;DOT_CROSS] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[GSYM DOT_SQUARE_NORM;DOT_RSUB;DOT_LSUB] +THEN REPEAT RESA_TAC +THEN MRESA_TAC DOT_SYM[`v2:real^3`;`v1:real^3`] +THEN REPLICATE_TAC (23-9)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[REAL_ARITH`x1 - v1 dot v2 - (v1 dot v2 - x2) = x6 +<=> v1 dot v2 = (x1 + x2 - x6)/ &2`;REAL_ARITH`a*a *b=a pow 2 *b/\ A- &0=A/\ (a*b) pow 2=a pow 2 * b pow 2`;REAL_INV_MUL] +THEN RESA_TAC +THEN ASM_SIMP_TAC[SGIN_POW_EQ] +THEN MRESA_TAC REAL_MUL_LINV[`x1:real`] +THEN ASM_REWRITE_TAC[REAL_ARITH`((inv (&2) pow 2 * inv x1 pow 2) * (x1 + x3 - x5) pow 2) * x1 = ((inv (&2) pow 2 * inv x1 ) * (x1 + x3 - x5) pow 2) * (inv x1 *x1) +/\ A * &1 =A `] +THEN ASM_SIMP_TAC[SGIN_POW_EQ] +THEN MP_TAC(REAL_ARITH`&0< ups_x x1 x3 x5==> &0<=ups_x x1 x3 x5/\ ~(ups_x x1 x3 x5 = &0)`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_INV[`ups_x x1 x2 x6`] +THEN MRESA_TAC REAL_LE_MUL[`inv(ups_x x1 x2 x6)`;`ups_x x1 x3 x5`] +THEN MRESA_TAC SQRT_POW2[`inv (ups_x x1 x2 x6) * ups_x x1 x3 x5`] +THEN ASM_REWRITE_TAC[REAL_ARITH`(inv x1 pow 2 * &1 * inv (ups_x x1 x2 x6) * ups_x x1 x3 x5) * + x1 * + (x1 * x2 - (x1 + x2 - x6) / &2 * (x1 + x2 - x6) / &2) += (inv x1 *x1) * inv x1 * inv (ups_x x1 x2 x6) * ups_x x1 x3 x5 * + (x1 * x2 - (x1 + x2 - x6) / &2 * (x1 + x2 - x6) / &2)`] +THEN MRESA_TAC REAL_EQ_MUL_LCANCEL[`ups_x x1 x2 x6`;`(inv (&2) pow 2 * inv x1) * (x1 + x3 - x5) pow 2 + + &1 * + inv x1 * + inv (ups_x x1 x2 x6) * + ups_x x1 x3 x5 * + (x1 * x2 - (x1 + x2 - x6) / &2 * (x1 + x2 - x6) / &2)`;`x3:real`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC REAL_MUL_LINV[`ups_x x1 x2 x6`] +THEN ASM_REWRITE_TAC[REAL_ARITH`ups_x x1 x2 x6 * + ((inv (&2) pow 2 * inv x1) * (x1 + x3 - x5) pow 2 + + &1 * + inv x1 * + inv (ups_x x1 x2 x6) * + ups_x x1 x3 x5 * + (x1 * x2 - (x1 + x2 - x6) / &2 * (x1 + x2 - x6) / &2)) += inv x1 *( ups_x x1 x2 x6 * (x1 + x3 - x5) pow 2/ &4 + + (inv (ups_x x1 x2 x6) * ups_x x1 x2 x6 ) * + ups_x x1 x3 x5 * + (x1 * x2 - (x1 + x2 - x6) / &2 * (x1 + x2 - x6) / &2))`] +THEN MRESA_TAC REAL_EQ_MUL_LCANCEL[`x1:real`;`inv x1 * + (ups_x x1 x2 x6 * (x1 + x3 - x5) pow 2 / &4 + + &1 * ups_x x1 x3 x5 * (x1 * x2 - (x1 + x2 - x6) / &2 * (x1 + x2 - x6) / &2))`;`ups_x x1 x2 x6 * x3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`x1 * + inv x1 * + (ups_x x1 x2 x6 * (x1 + x3 - x5) pow 2 / &4 + + &1 * ups_x x1 x3 x5 * (x1 * x2 - (x1 + x2 - x6) / &2 * (x1 + x2 - x6) / &2)) += (inv x1 *x1) * + (ups_x x1 x2 x6 * (x1 + x3 - x5) pow 2 / &4 + + ups_x x1 x3 x5 * (x1 * x2 - (x1 + x2 - x6) / &2 * (x1 + x2 - x6) / &2))/\ a pow 2=a*a`;ups_x] +THEN REAL_ARITH_TAC);; + + +let EYYPQDW_NORM_V3_V1=prove(`&0< x1 /\ &0 + norm (v3-v1) pow 2= x5`, +STRIP_TAC +THEN ASM_REWRITE_TAC[GSYM DOT_SQUARE_NORM;DOT_LSUB;DOT_RSUB] +THEN MP_TAC EYYPQDW_NORMV3 +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[GSYM DOT_SQUARE_NORM;] +THEN REPEAT RESA_TAC +THEN MRESA_TAC DOT_SYM[`v3:real^3`;`v1:real^3`] +THEN REWRITE_TAC[REAL_ARITH`x3 - v1 dot v3 - (v1 dot v3 - x1) = x5 +<=> v1 dot v3 = (x1+x3-x5)/ &2`] +THEN EXPAND_TAC"v3" +THEN REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL; DOT_RMUL;DOT_CROSS_SELF;REAL_ARITH`A* &0= &0/\ A+ &0=A/\ &0 +A=A`;DOT_CROSS;REAL_INV_MUL] +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0< x3/\ &0< x1==> &0<= x3/\ ~(x1= &0)`) +THEN RESA_TAC +THEN MRESA_TAC REAL_MUL_LINV[`x1:real`] +THEN ASM_REWRITE_TAC[REAL_ARITH`((inv (&2) * inv x1) * (x1 + x3 - x5)) * x1 += (inv x1 * x1) * (x1 + x3 - x5)/ &2 `] +THEN REAL_ARITH_TAC);; + + +let EYYPQDW_SCALAR_POS=prove(`&0< x1 /\ &0 + (?t. &0 &0<= x3/\ ~(x1= &0)`) +THEN RESA_TAC +THEN MRESAL_TAC REAL_MUL_LINV[`x1:real`][REAL_ARITH`&1*a=a`] +THEN EXISTS_TAC`sqrt (inv (ups_x x1 x2 x6) * ups_x x1 x3 x5)` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC SQRT_POS_LT +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_LT_INV_EQ] +THEN MATCH_MP_TAC (REAL_ARITH`&0<=a /\ ~(a= &0)==> &0< a`) +THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`v2:real^3`] +THEN MRESAL_TAC (GEN_ALL Trigonometry1.DIST_UPS_X_POS)[`vec 0:real^3`;`v1:real^3`;`v2:real^3`][dist;VECTOR_ARITH`vec 0- A= --A/\ A- vec 0=A:real^3`;GSYM DOT_SQUARE_NORM;NORM_NEG] +THEN MRESAL_TAC Collect_geom.FHFMKIY[`vec 0:real^3`;`v1:real^3`;`v2:real^3`;`x1:real`;`x2:real`;`x6:real`][dist;VECTOR_ARITH`vec 0- A= --A/\ A- vec 0=A:real^3`;GSYM DOT_SQUARE_NORM;NORM_NEG]);; + + + + + +let v3_defor_v1=new_definition`v3_defor_v1 a v1 v2 x1 x2 x5 x6 x3= (inv(&2 * x1) *(x1 + x3 - x5))% v1 + ((inv x1)* a * sqrt(inv(ups_x x1 x2 x6) * (ups_x x1 x3 x5)))%(v1 cross (v1 cross v2))`;; + +let v3_defor_v2=new_definition`v3_defor_v2 a x1 x2 x3 x5 x6 v1 v2= (inv(&2 * x1) *(x1 + x3 - x5))% v1 + ((inv x1)* a * sqrt(inv(ups_x x1 x2 x6) * (ups_x x1 x3 x5)))%(v1 cross (v1 cross v2))`;; + + +let LIFT_CONTINUOUS_ATREAL=prove(`!x. lift continuous atreal x`, +REWRITE_TAC[continuous_atreal;DIST_LIFT] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[]);; + + + +let LIFT_CONTINUOUS_ATREAL_I=prove(`!x. lift o(\x. x) continuous atreal x`, +REWRITE_TAC[continuous_atreal;DIST_LIFT;o_DEF] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[]);; + + + +let EYYPQDW_CONTINUOUS_AT_X=prove_by_refinement(`&0< x1 /\ &0 + (\x3. v3_defor_v1 a v1 v2 x1 x2 x5 x6 x3) continuous atreal (x3)`, +[ +STRIP_TAC +THEN REWRITE_TAC[v3_defor_v1;CROSS_LAGRANGE] +THEN ASM_REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL; DOT_RMUL;DOT_CROSS_SELF;REAL_ARITH`A* &0= &0/\ A+ &0=A/\ &0 +A=A`;DOT_CROSS;REAL_INV_MUL;CROSS_LAGRANGE;CROSS_LADD;VECTOR_ARITH`A-B=A+(--B):real^3/\ a % vec 0= vec 0 /\ vec 0 +A=A`;CROSS_LMUL;CROSS_REFL;CROSS_LADD;CROSS_LNEG;DOT_SQUARE_NORM;o_DEF] +THEN MATCH_MP_TAC CONTINUOUS_ADD +THEN STRIP_TAC; + +MATCH_MP_TAC CONTINUOUS_VMUL +THEN REWRITE_TAC[o_DEF;LIFT_CMUL] +THEN MATCH_MP_TAC CONTINUOUS_CMUL +THEN REWRITE_TAC[o_DEF;LIFT_ADD] +THEN MATCH_MP_TAC CONTINUOUS_ADD +THEN ASM_SIMP_TAC[CONTINUOUS_CONST] +THEN REWRITE_TAC[LIFT_SUB] +THEN MATCH_MP_TAC CONTINUOUS_SUB +THEN ASM_SIMP_TAC[CONTINUOUS_CONST;CONTINUOUS_LIFT_NORM_COMPOSE;LIFT_CONTINUOUS_ATREAL]; + +MATCH_MP_TAC CONTINUOUS_VMUL +THEN REWRITE_TAC[o_DEF;LIFT_CMUL] +THEN MATCH_MP_TAC CONTINUOUS_CMUL +THEN MATCH_MP_TAC CONTINUOUS_CMUL +THEN MRESAL_TAC CONTINUOUS_ATREAL_COMPOSE[`(\x. lift (inv (ups_x x1 x2 x6) * ups_x x1 x x5))`;`lift o sqrt o drop`;`x3:real`][o_DEF;LIFT_DROP] +THEN POP_ASSUM MATCH_MP_TAC +THEN STRIP_TAC; + +REWRITE_TAC[LIFT_CMUL] +THEN MATCH_MP_TAC CONTINUOUS_CMUL +THEN REWRITE_TAC[ups_x;LIFT_ADD;] +THEN MATCH_MP_TAC CONTINUOUS_ADD +THEN STRIP_TAC; + +REWRITE_TAC[LIFT_SUB] +THEN MATCH_MP_TAC CONTINUOUS_SUB +THEN ASM_SIMP_TAC[CONTINUOUS_CONST] +THEN MATCH_MP_TAC CONTINUOUS_SUB +THEN ASM_SIMP_TAC[CONTINUOUS_CONST] +THEN ONCE_REWRITE_TAC[GSYM o_DEF;] +THEN REWRITE_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS1;] +THEN MATCH_MP_TAC REAL_CONTINUOUS_MUL +THEN REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1;LIFT_CONTINUOUS_ATREAL_I]; + +MATCH_MP_TAC CONTINUOUS_ADD +THEN ASM_SIMP_TAC[CONTINUOUS_CONST] +THEN MATCH_MP_TAC CONTINUOUS_ADD +THEN ASM_SIMP_TAC[CONTINUOUS_CONST] +THEN STRIP_TAC; + +REWRITE_TAC[o_DEF;LIFT_CMUL] +THEN MATCH_MP_TAC CONTINUOUS_CMUL +THEN MATCH_MP_TAC CONTINUOUS_CMUL +THEN REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1;LIFT_CONTINUOUS_ATREAL]; + +ONCE_REWRITE_TAC[REAL_ARITH`&2 * x * x5= &2 * x5 * x`] +THEN REWRITE_TAC[o_DEF;LIFT_CMUL;] +THEN MATCH_MP_TAC CONTINUOUS_CMUL +THEN MATCH_MP_TAC CONTINUOUS_CMUL +THEN REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1;LIFT_CONTINUOUS_ATREAL]; + +ONCE_REWRITE_TAC[GSYM o_DEF] +THEN ONCE_REWRITE_TAC[GSYM o_DEF] +THEN MATCH_MP_TAC CONTINUOUS_AT_WITHIN +THEN MATCH_MP_TAC CONTINUOUS_AT_SQRT +THEN REWRITE_TAC[LIFT_DROP] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[REAL_LT_INV_EQ] +THEN MATCH_MP_TAC (REAL_ARITH`&0<=a /\ ~(a= &0)==> &0< a`) +THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`v2:real^3`] +THEN MRESAL_TAC (GEN_ALL Trigonometry1.DIST_UPS_X_POS)[`vec 0:real^3`;`v1:real^3`;`v2:real^3`][dist;VECTOR_ARITH`vec 0- A= --A/\ A- vec 0=A:real^3`;GSYM DOT_SQUARE_NORM;NORM_NEG] +THEN MRESAL_TAC Collect_geom.FHFMKIY[`vec 0:real^3`;`v1:real^3`;`v2:real^3`;`x1:real`;`x2:real`;`x6:real`][dist;VECTOR_ARITH`vec 0- A= --A/\ A- vec 0=A:real^3`;GSYM DOT_SQUARE_NORM;NORM_NEG]]);; + + +let EYYPQDW_CONTINUOUS_AT_V=prove(`&0< x1 /\ &0 (\v2. v3_defor_v2 a x1 x2 x3 x5 x6 v1 v2) continuous at (v2)`, +STRIP_TAC +THEN REWRITE_TAC[v3_defor_v2;CROSS_LAGRANGE] +THEN ASM_REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL; DOT_RMUL;DOT_CROSS_SELF;REAL_ARITH`A* &0= &0/\ A+ &0=A/\ &0 +A=A`;DOT_CROSS;REAL_INV_MUL;CROSS_LAGRANGE;CROSS_LADD;VECTOR_ARITH` a % vec 0= vec 0 /\ vec 0 +A=A`;CROSS_LMUL;CROSS_REFL;CROSS_LADD;CROSS_LNEG;DOT_SQUARE_NORM;o_DEF] +THEN MATCH_MP_TAC CONTINUOUS_ADD +THEN ASM_SIMP_TAC[CONTINUOUS_CONST;VECTOR_ARITH`a%(v-w)=a%v- a%w`] +THEN MATCH_MP_TAC CONTINUOUS_SUB +THEN STRIP_TAC +THENL[ + +MATCH_MP_TAC CONTINUOUS_CMUL +THEN MATCH_MP_TAC CONTINUOUS_VMUL +THEN ASM_SIMP_TAC[CONTINUOUS_AT_LIFT_DOT]; + +MATCH_MP_TAC CONTINUOUS_CMUL +THEN MATCH_MP_TAC CONTINUOUS_CMUL +THEN ASM_SIMP_TAC[CONTINUOUS_AT_ID]]);; + + +let V3_DEFOR_V1_EQV3_DEFOR_V2=prove(`v3_defor_v1 a v1 v2 x1 x2 x5 x6 x3=v3_defor_v2 a x1 x2 x3 x5 x6 v1 v2`, +REWRITE_TAC[v3_defor_v1;v3_defor_v2]);; + + +let LIFT_UPS_CONTINUOUS=prove_by_refinement(`~(collinear{vec 0,v1,v2:real^3}) /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 +==> lift o(\x2. ups_x x1 x2 x6) continuous atreal (x2)`, +[STRIP_TAC +THEN REWRITE_TAC[ups_x;LIFT_ADD;o_DEF] +THEN MATCH_MP_TAC CONTINUOUS_ADD +THEN STRIP_TAC; + +REWRITE_TAC[LIFT_SUB] +THEN MATCH_MP_TAC CONTINUOUS_SUB +THEN ASM_SIMP_TAC[CONTINUOUS_CONST] +THEN MATCH_MP_TAC CONTINUOUS_SUB +THEN ASM_SIMP_TAC[CONTINUOUS_CONST] +THEN ONCE_REWRITE_TAC[GSYM o_DEF;] +THEN REWRITE_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS1;] +THEN MATCH_MP_TAC REAL_CONTINUOUS_MUL +THEN REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1;LIFT_CONTINUOUS_ATREAL_I]; + +MATCH_MP_TAC CONTINUOUS_ADD +THEN ASM_SIMP_TAC[CONTINUOUS_CONST] +THEN MATCH_MP_TAC CONTINUOUS_ADD +THEN ASM_SIMP_TAC[CONTINUOUS_CONST] +THEN STRIP_TAC; + +REWRITE_TAC[o_DEF;LIFT_CMUL] +THEN MATCH_MP_TAC CONTINUOUS_CMUL +THEN MATCH_MP_TAC CONTINUOUS_CMUL +THEN REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1;LIFT_CONTINUOUS_ATREAL]; + +ONCE_REWRITE_TAC[REAL_ARITH`&2 * x * x5= &2 * x5 * x`] +THEN REWRITE_TAC[o_DEF;LIFT_CMUL;] +THEN MATCH_MP_TAC CONTINUOUS_CMUL +THEN MATCH_MP_TAC CONTINUOUS_CMUL +THEN REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1;LIFT_CONTINUOUS_ATREAL]]);; + + + +let MK_PLANAR_REP=prove(`mk_planar2 v0 v1 v2 x1 x2 x3 x5 x6 a - v0= (inv(&2 * x1) *(x1 + x3 - x5))% (v1-v0) + ((inv x1)* a * sqrt(inv(ups_x x1 x2 x6) * (ups_x x1 x3 x5)))%((v1-v0) cross ((v1-v0) cross (v2-v0:real^3)))`, +REWRITE_TAC[mk_planar2;LET_DEF;LET_END_DEF;real_div;VECTOR_ARITH`(a+b)-a=b:real^3`;] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[REAL_ARITH`a*b=b*a`] +THEN MATCH_MP_TAC(VECTOR_ARITH`a=b==> c+a=c+b:real^3`) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[REAL_ARITH`a*b=b*a`] +THEN MATCH_MP_TAC(SET_RULE`a=b:real ==> a%v=b %v:real^3`) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[REAL_ARITH`(a*b)*c=b*a*c`] +THEN MATCH_MP_TAC(SET_RULE`a=b:real ==> c*a=c*b:real`) +THEN MATCH_MP_TAC(SET_RULE`a=b:real ==> c*a=c*b:real`) +THEN MATCH_MP_TAC(SET_RULE`a=b:real ==> sqrt(a)=sqrt(b:real)`) +THEN REAL_ARITH_TAC);; + + + + + +let EYYPQDW = prove_by_refinement(`!v0 v1 v2 v3 x1 x2 x3 x5 x6 s. + &0 < x1 /\ &0 < x2 /\ &0 < x3 /\ &0 < x5 /\ &0 < x6 /\ + ~collinear {v0,v1,v2} /\ + x1 = dist(v1,v0) pow 2 /\ + x2 = dist(v2,v0) pow 2 /\ + x6 = dist(v1,v2) pow 2 /\ + &0 < ups_x x1 x3 x5 /\ + (s = &1 \/ s = -- &1) /\ + v3 = mk_planar2 v0 v1 v2 x1 x2 x3 x5 x6 s ==> + (coplanar {v0,v1,v2,v3} /\ + x3 = dist(v3,v0) pow 2 /\ + x5 = dist(v3,v1) pow 2 /\ + ?t. &0 < t /\ + t % ((v3- v0) cross (v1- v0)) = ( s % ((v1 - v0) cross (v2 - v0))))`, +[ +REWRITE_TAC[dist;SET_RULE`(s = &1 \/ s = -- &1)<=> s IN { -- &1, &1}`] +THEN REPEAT STRIP_TAC; + +MRESAL_TAC(GEN_ALL EYYPQDW_COPLANAR)[`x3:real`;`s:real`;`x2:real`;`x6:real` ;`x1:real`;`x3:real`;`x5:real`;`v1-v0:real^3`;`v2-v0:real^3`;`v3-v0:real^3`][VECTOR_ARITH`v1 - v0 - (v2 - v0)= v1-v2:real^3`;GSYM MK_PLANAR_REP;GSYM Trigonometry2.COLLINEAR_TRANSABLE] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[Local_lemmas.COPLANAR_IFF_CROSS_DOT] +THEN REDUCE_VECTOR_TAC; + +MRESAL_TAC(GEN_ALL EYYPQDW_NORMV3)[`x3:real`;`s:real`;`x2:real`;`x6:real` ;`x1:real`;`x5:real`;`v1-v0:real^3`;`v2-v0:real^3`;`v3-v0:real^3`;`x3:real`][VECTOR_ARITH`v1 - v0 - (v2 - v0)= v1-v2:real^3`;GSYM MK_PLANAR_REP;GSYM Trigonometry2.COLLINEAR_TRANSABLE]; + +MRESAL_TAC(GEN_ALL EYYPQDW_NORM_V3_V1)[`x3:real`;`s:real`;`x2:real`;`x6:real` ;`x1:real`;`x3:real`;`v2-v0:real^3`;`v3-v0:real^3`;`v1-v0:real^3`;`x5:real`][VECTOR_ARITH`v1 - v0 - (v2 - v0)= v1-v2:real^3`;GSYM MK_PLANAR_REP;GSYM Trigonometry2.COLLINEAR_TRANSABLE]; + +MRESAL_TAC(GEN_ALL EYYPQDW_SCALAR_POS)[`x3:real`;`x2:real`;`x6:real` ;`x1:real`;`x3:real`;`x5:real`;`v3-v0:real^3`;`s:real`;`v1-v0:real^3`;`v2-v0:real^3`][VECTOR_ARITH`v1 - v0 - (v2 - v0)= v1-v2:real^3`;GSYM MK_PLANAR_REP;GSYM Trigonometry2.COLLINEAR_TRANSABLE] +THEN EXISTS_TAC`inv t` +THEN STRIP_TAC; + +MATCH_MP_TAC REAL_LT_INV +THEN ASM_REWRITE_TAC[]; + +MP_TAC(REAL_ARITH`&0< t==> ~(t= &0)`) +THEN RESA_TAC +THEN MRESA_TAC REAL_MUL_LINV[`t:real`] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a%b%v=(a*b)%v`;REAL_ARITH`inv t * s * t= (inv t * t)*s`] +THEN VECTOR_ARITH_TAC]);; + + + + +let MK_PLANAR_V3_DEFOR_V1=prove(`mk_planar2 v0 v1 v2 x1 x2 x3 x5 x6 a - v0 += v3_defor_v1 a (v1-v0) (v2-v0) x1 x2 x5 x6 x3`, +REWRITE_TAC[v3_defor_v1;MK_PLANAR_REP]);; + +let MK_PLANAR_V3_DEFOR_V1_FUN=prove(`(\q. mk_planar2 v0 v1 v2 x1 x2 q x5 x6 s)= (\x3. v3_defor_v1 s (v1-v0) (v2-v0) x1 x2 x5 x6 x3+ v0)`, +REWRITE_TAC[FUN_EQ_THM;] +THEN GEN_TAC +THEN REWRITE_TAC[GSYM MK_PLANAR_V3_DEFOR_V1] +THEN VECTOR_ARITH_TAC);; + + + +let EYYPQDW2 = prove(`!(v0:real^3) v1 v2 x1 x2 x3 x5 x6 s. + &0 < x1 /\ &0 < x2 /\ &0 < x3 /\ &0 < x5 /\ &0 < x6 /\ + ~collinear {v0,v1,v2} /\ + x1 = dist(v1,v0) pow 2 /\ + x2 = dist(v2,v0) pow 2 /\ + x6 = dist(v1,v2) pow 2 /\ + (s = &1 \/ s = -- &1)/\ + &0 < ups_x x1 x3 x5 ==> + (\q. mk_planar2 v0 v1 v2 x1 x2 q x5 x6 s) continuous atreal x3`, +REWRITE_TAC[dist;SET_RULE`(s = &1 \/ s = -- &1)<=> s IN { -- &1, &1}`] +THEN REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[MK_PLANAR_V3_DEFOR_V1_FUN] +THEN MRESAL_TAC(GEN_ALL EYYPQDW_CONTINUOUS_AT_X)[`x3:real`;`s:real`;`v1-v0:real^3`;`v2-v0:real^3`;`x1:real`;`x2:real` ;`x5:real`;`x6:real`;`x3:real`][VECTOR_ARITH`v1 - v0 - (v2 - v0)= v1-v2:real^3`;GSYM MK_PLANAR_REP;GSYM Trigonometry2.COLLINEAR_TRANSABLE] +THEN MATCH_MP_TAC CONTINUOUS_ADD +THEN ASM_SIMP_TAC[CONTINUOUS_CONST]);; + + +let MK_PLANAR_V3_DEFOR_V2_FUN=prove(`(\q. mk_planar2 v0 v1 q x1 x2 x3 x5 x6 s)= (\v2. v3_defor_v2 s x1 x2 x3 x5 x6 (v1-v0) (v2-v0) + v0)`, +REWRITE_TAC[FUN_EQ_THM;] +THEN GEN_TAC +THEN REWRITE_TAC[v3_defor_v2;GSYM MK_PLANAR_REP] +THEN VECTOR_ARITH_TAC);; + +let lemma30000=prove(`(\v2'. v3_defor_v2 s (norm (v1 - v0) pow 2) (norm (v2 - v0) pow 2) x3 x5 + (norm (v1 - v2) pow 2) + (v1 - v0) + (v2' - v0)) += (\v2'. v3_defor_v2 s (norm (v1 - v0) pow 2) (norm (v2 - v0) pow 2) x3 x5 + (norm (v1 - v2) pow 2) + (v1 - v0) + (v2'))o(\v2. v2- v0)`, +REWRITE_TAC[o_DEF]) +;; + + +let EYYPQDW3 =prove(`!(v0:real^3) v1 v2 x1 x2 x3 x5 x6 s. + &0 < x1 /\ &0 < x2 /\ &0 < x3 /\ &0 < x5 /\ &0 < x6 /\ + ~collinear {v0,v1,v2} /\ + x1 = dist(v1,v0) pow 2 /\ + x2 = dist(v2,v0) pow 2 /\ + x6 = dist(v1,v2) pow 2 /\ + (s = &1 \/ s = -- &1)/\ + &0 < ups_x x1 x3 x5 ==> + (\q. mk_planar2 v0 v1 q x1 x2 x3 x5 x6 s) continuous at v2`, +REWRITE_TAC[dist;SET_RULE`(s = &1 \/ s = -- &1)<=> s IN { -- &1, &1}`] +THEN REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[MK_PLANAR_V3_DEFOR_V2_FUN] +THEN MRESAL_TAC(GEN_ALL EYYPQDW_CONTINUOUS_AT_V)[`x3:real`;`s:real`;`x1:real`;`x2:real` ;`x3:real`;`x5:real`;`x6:real`;`v1-v0:real^3`;`v2-v0:real^3`][VECTOR_ARITH`v1 - v0 - (v2 - v0)= v1-v2:real^3`;GSYM MK_PLANAR_REP;GSYM Trigonometry2.COLLINEAR_TRANSABLE] +THEN MATCH_MP_TAC CONTINUOUS_ADD +THEN ASM_SIMP_TAC[CONTINUOUS_CONST;lemma30000] +THEN MATCH_MP_TAC CONTINUOUS_AT_COMPOSE +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC CONTINUOUS_SUB +THEN ASM_SIMP_TAC[CONTINUOUS_CONST;CONTINUOUS_AT_ID]);; + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/FEKTYIY.hl b/text_formalization/local/FEKTYIY.hl new file mode 100644 index 0000000..9ef2d6c --- /dev/null +++ b/text_formalization/local/FEKTYIY.hl @@ -0,0 +1,212 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Fektyiy = struct + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +open Yxionxl2;; +open Eyypqdw;; +open Ocbicby;; +open Imjxphr;; + +open Nuxcoea;; + + +let FEKTYIY_concl = `!s v. + is_scs_v39 s /\ v IN MMs_v39 s /\ 3 < scs_k_v39 s ==> + ~coplanar ({vec 0} UNION IMAGE v (:num))`;; + +let FEKTYIY= prove_by_refinement((FEKTYIY_concl), +[ +REWRITE_TAC[Trigonometry2.coplanar1;IN] +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN ABBREV_TAC`V= IMAGE (v:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((v:num->real^3) i, v (SUC i))) (:num)` +THEN ABBREV_TAC`v0= (v:num->real^3) 0` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`s:scs_v39`;`v`] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`k:num`;`s`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC WL_IN_V[`0`;`v`] +THEN MRESA_TAC Odxlstcv2.CARD_V_EQ_SCS_K1[`s`;`v`;`V`;`k:num`] +THEN SUBGOAL_THEN`{ITER n (rho_node1 FF) v0 | n <= k+1} = V`ASSUME_TAC; + +MRESA_TAC Localization.LOFA_IMP_LT_CARD_SET_V_ALT[`V`;`E`;`FF`;`v0:real^3`] +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`A SUBSET B/\ B SUBSET C/\ A=C==> B=C`)) +THEN TYPIFY `{ITER n (rho_node1 FF) v0 | n < CARD V}` EXISTS_TAC +THEN STRIP_TAC; + +ASM_REWRITE_TAC[] +THEN SYM_ASSUM_TAC +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;] +THEN REPEAT RESA_TAC +THEN TYPIFY `n` EXISTS_TAC +THEN DICH_TAC 1 +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + +ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN EXPAND_TAC"V" +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;IMAGE;SET_RULE`(a:A) IN(:A)`] +THEN REPEAT RESA_TAC +THEN TYPIFY `n` EXISTS_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k<=3)`) +THEN RESA_TAC +THEN MRESAL_TAC Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME[`V`;`E`;`k`;`s`;`FF`;`v0`;`v`;` 0`][ARITH_RULE`a+0=a`]; + +POP_ASSUM MP_TAC +THEN MRESAL_TAC Nuxcoea.MMS_IMP_BBPRIME[`s:scs_v39`;`v`][LET_DEF;LET_END_DEF;BBprime_v39] +THEN MP_TAC (SET_RULE`{vec 0:real^3} UNION V SUBSET x ==> vec 0 IN x /\V SUBSET x`) +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC Lunar_deform.AZIM_PI_ITER_LOCAL_FAN[`E`;`V`;`V`;`x`;`k+1`;`FF`;`v0:real^3`] +THEN MRESA_TAC JKQEWGV1[`s:scs_v39`;`v`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`~(a< b)<=> b<=a`;sol_local] +THEN MATCH_MP_TAC (REAL_ARITH`&0< a/\ b= &0==> a<= &2 *a +b`) +THEN REWRITE_TAC[PI_WORKS] +THEN MATCH_MP_TAC SUM_EQ_0 +THEN GEN_TAC +THEN STRIP_TAC +THEN MRESA_TAC Local_lemmas.LOFA_DETERMINE_AZIM_IN_FA[`V:real^3->bool`;`FF`;`E`;`x'`] +THEN MRESA_TAC Local_lemmas.DETER_RHO_NODE[`V:real^3->bool`;`E`;`FF`;`FST x'`;`SND x'`] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_IMP_IN_V2[`E`;`FF`;`x'`;`V`] +THEN MRESA_TAC Local_lemmas1.LF_AZIM_CYCLE_EQ_IVS_ND[`V`;`E`;`FF`;`FST x'`] +THEN DICH_TAC (27-22) +THEN EXPAND_TAC "FF" +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[IMAGE;IN_ELIM_THM] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k<=3)/\ (k+1)-1=k/\ ~(k=0)/\ 1real^3`;`SUC ((x'' + k - 1) MOD k) MOD k`] +THEN MRESA_TAC +CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`x'' MOD k`;`v:num->real^3`;`x''`] +THEN MRESA_TAC Yxionxl2.MOD_SUC_MOD[`x''`;`k`] +THEN MRESA_TAC Yxionxl2.MOD_SUC_MOD[`SUC((x''+k-1) MOD k)`;`k`] +THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN MRESA_TAC MOD_REFL[`SUC x'' `;`k`] +THEN MRESA_TAC MOD_REFL[`x''+k-1 `;`k`] +THEN MRESA_TAC +CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`SUC (SUC ((x'' + k - 1) MOD k))`;`v:num->real^3`;`SUC(SUC ((x'' + k - 1) MOD k)) MOD k`] +THEN MRESA_TAC +CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`SUC x'' MOD k`;`v:num->real^3`;`SUC x''`] +THEN MRESA_TAC +CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`(x''+k-1) MOD k`;`v:num->real^3`;`x''+k-1`] +THEN MRESAL_TAC Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME[`V`;`E`;`k`;`s`;`FF`;`v x''`;`v`;` x''`][ARITH_RULE`a+0=a`] +THEN MRESA_TAC WL_IN_V[`x''`;`v`] +THEN MP_TAC Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1 +THEN RESA_TAC +THEN THAYTHE_TAC 0[`v x''`] +THEN REWRITE_TAC[ARITH_RULE`a+k-1=k-1+a`] +THEN SYM_ASSUM_TAC +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0< pi==> ~(pi= &0)`) +THEN ASM_REWRITE_TAC[PI_WORKS] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[Rogers.AZIM_COMPL_EXT] +THEN REAL_ARITH_TAC]);; + + + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/GBYCPXS.hl b/text_formalization/local/GBYCPXS.hl new file mode 100755 index 0000000..776441e --- /dev/null +++ b/text_formalization/local/GBYCPXS.hl @@ -0,0 +1,690 @@ + +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + + + +module Gbycpxs = struct + + +open Wjscpro;; +open Polyhedron;; +open Sphere;; +open Fan_defs;; +open Hypermap;; +open Vol1;; +open Fan;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Sphere;; +open Hypermap;; +open Fan;; +open Topology;; +open Prove_by_refinement;; +open Pack_defs;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; + + +let CARD_F_SY_IN_B_SY=prove(`!s:stable_sy l:real^(M,3)finite_product. +k_sy s =k /\ dimindex(:M) =k/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ 2 CARD (F_SY (vecmats l))=k`, +REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`2 1 1 <= i /\ i <= k /\ + 1 <= j /\ j <= k /\ + row i (vecmats x) = row j (vecmats x)`] +THEN MRESA1_TAC (GEN_ALL CARD_F_SY_EQ)`l:real^(M,3)finite_product`);; + + +let SOL0_POS=prove(`&0< sol0`, +REWRITE_TAC[sol0; REAL_ARITH`&0 < &3 * acs (&1 / &3) - pi +<=> pi/ &3 < acs (&1 / &3) `] +THEN MRESAL1_TAC Trigonometry2.ACS`&1/ &3`[REAL_ARITH`-- &1 <= &1 / &3 /\ &1 / &3 <= &1`] +THEN MP_TAC(REAL_ARITH`&0< pi==> &0 <= pi / &3 /\ pi / &3 <= pi`) +THEN ASM_REWRITE_TAC[PI_WORKS] +THEN STRIP_TAC +THEN MRESAL1_TAC COS_ACS`&1/ &3`[REAL_ARITH`-- &1 <= &1 / &3 /\ &1 / &3 <= &1`] +THEN MRESA_TAC COS_MONO_LT_EQ[`acs (&1 / &3)`;`pi/ &3`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[ARITH_RULE`pi/ &3= pi/ &2- pi/ &6`;Trigonometry.SCEZKRH2;SIN_PI6] +THEN REAL_ARITH_TAC);; + +let SIGMA_SY_LE1=prove(`!s:stable_sy. sigma_sy s<= &1`, +GEN_TAC +THEN REWRITE_TAC[sigma_sy] +THEN DISJ_CASES_TAC(SET_RULE`(ear_sy s) \/ ~(ear_sy (s:stable_sy))`) +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC);; + + +let B_SY_LE_CSTAB=prove(`!s:stable_sy l:real^(M,3)finite_product. +k_sy s =k /\ dimindex(:M) =k/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ 2 norm (row i (vecmats l) - row (SUC (i MOD k)) (vecmats l))<= cstab`, +REPEAT STRIP_TAC +THEN ASM_TAC +THEN DISCH_THEN(LABEL_TAC"THYGIANG") +THEN REPEAT STRIP_TAC +THEN POP_ASSUM( fun th-> ASSUME_TAC th THEN MP_TAC th THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;CONDITION1_SY] THEN STRIP_TAC) +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v:real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN DISCH_THEN(LABEL_TAC"THY2") +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th +THEN REWRITE_TAC[convex_local_fan] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th1-> MP_TAC th1 +THEN REWRITE_TAC[local_fan] +THEN LET_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th2-> ASSUME_TAC (SYM th2)) +THEN STRIP_TAC +THEN ASSUME_TAC th1) +THEN DISCH_THEN(LABEL_TAC"THY1") +THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN REMOVE_THEN"THY2"(fun th-> MRESA_TAC th[`i:num`;`SUC(i MOD k)`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`i<=k==> i<= k-1 \/ i=k`) +THEN RESA_TAC +THENL[ +MP_TAC(ARITH_RULE`2 1<=k /\ 1 MRESA1_TAC th`i:num`) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`i:num`;`i+1:num`][ARITH_RULE`A+0=A`]) +THEN ONCE_REWRITE_TAC[ARITH_RULE`1+A=A+1`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC(ARITH_RULE`i <= k-1 /\ 1<=i ==> i< k`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN REWRITE_TAC[ADD1] +THEN REAL_ARITH_TAC; +MRESAL_TAC MOD_MULT[`dimindex (:M)`;`1`][ARITH_RULE`k*1=k`;ARITH_RULE`SUC 0=1`;DIMINDEX_NONZERO] +THEN MP_TAC(ARITH_RULE`2 0<= k-1/\ 1 MRESAL1_TAC th`0:num`[ARITH_RULE`0+1=1`]) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`1:num`;`k:num`][ARITH_RULE`A+0=A`]) +THEN MP_TAC(ARITH_RULE`2 1<= k/\ 1 ?i. J_SY s={{i,f_sy s i}} /\ i IN I_SY s`, +GEN_TAC +THEN REWRITE_TAC[ear_sy] +THEN STRIP_TAC +THEN MRESA1_TAC FINITE_J_SY`s:stable_sy` +THEN MRESA1_TAC (GEN_ALL Local_lemmas.FINITE_CARD1_IMP_SINGLETON)`J_SY(s:stable_sy)` +THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[constraint_system;SUBSET;IN_SING;IN_ELIM_THM;] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[IN_SING] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x:(num->bool)`) +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]);; + + + + + +let SING_J1_SY=prove_by_refinement(`!s:stable_sy. ear_sy s /\ I_SY s=0.. k_sy s -1 /\ f_sy s=(\i. ((1+i):num MOD k))/\ k_sy s =k /\ 2 ?i. J1_SY s= {(i,SUC(i MOD k_sy s))} /\ J_SY s= {{i MOD k,f_sy s i}} /\ i<=k /\ 1<=i`, +[REPEAT STRIP_TAC +THEN MRESAL1_TAC PROPERTIES_EAR_SY`s:stable_sy`[IN_NUMSEG] +THEN DISJ_CASES_TAC(ARITH_RULE`i=0 \/ 1<= i`); +EXISTS_TAC`k_sy(s:stable_sy):num` +THEN MP_TAC(ARITH_RULE`2 ~(k=0)/\ 1 i' < k_sy s \/ i' = k_sy (s:stable_sy)`) +THEN RESA_TAC; +MRESA_TAC MOD_LT[`i':num`;`k_sy(s:stable_sy)`] +THEN POP_ASSUM(fun th-> ASM_TAC THEN ONCE_REWRITE_TAC[th]) +THEN REPEAT DISCH_TAC +THEN MP_TAC(ARITH_RULE`i' < k_sy s==> 1+i' < k_sy s \/ 1+i' = k_sy (s:stable_sy)`) +THEN RESA_TAC; +MRESA_TAC MOD_LT[`1+i':num`;`k_sy(s:stable_sy)`] +THEN POP_ASSUM(fun th-> ASM_TAC THEN ONCE_REWRITE_TAC[th]) +THEN REPEAT DISCH_TAC +THEN MP_TAC(ARITH_RULE`1<= i' ==> ~(i'= 0) /\ ~(1+i'=0)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(i'= 0) /\ ~(1+i'=0) ==> ~({i', 1+i'} = {0, (1+ 0) MOD k})`) +THEN ASM_REWRITE_TAC[]; +POP_ASSUM(fun th-> ASM_TAC THEN ONCE_REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN REPEAT DISCH_TAC +THEN MP_TAC(ARITH_RULE`2 ~(k=0)/\ 1 ASM_TAC THEN ONCE_REWRITE_TAC[th] THEN REWRITE_TAC[ARITH_RULE`1+0=1`] ) +THEN REPEAT DISCH_TAC +THEN MRESA_TAC MOD_LT[`1:num`;`k_sy(s:stable_sy)`] +THEN POP_ASSUM(fun th-> ASM_TAC THEN ONCE_REWRITE_TAC[th] THEN REWRITE_TAC[ARITH_RULE`1+0=1`]) +THEN REPEAT DISCH_TAC +THEN MP_TAC(SET_RULE`{i', 0} = {0, 1} /\ ~(0=1)==> i'=1`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN ONCE_REWRITE_TAC[th] THEN REWRITE_TAC[ARITH_RULE`1+0=1`] ) +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; +MP_TAC(ARITH_RULE`2 ~(k=0)/\ 1 ~(k=0)/\ 1<=k/\ ~(0=1) /\ ~(1+1=k)`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT[`k:num`;`1`][ARITH_RULE`k*1=k`;ARITH_RULE`SUC 0=1`;DIMINDEX_NONZERO] +THEN ARITH_TAC; +EXISTS_TAC`i:num` +THEN MP_TAC(ARITH_RULE`i<= k-1/\ 2 i i' = k_sy (s:stable_sy) \/ i' < k_sy s `) +THEN RESA_TAC; +POP_ASSUM(fun th-> ASM_TAC THEN ONCE_REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN REPEAT DISCH_TAC +THEN MP_TAC(ARITH_RULE`2 ~(k=0)/\ 1 ASM_TAC THEN ONCE_REWRITE_TAC[th] THEN REWRITE_TAC[ARITH_RULE`1+0=1`] ) +THEN REPEAT DISCH_TAC +THEN MRESA_TAC MOD_LT[`1:num`;`k_sy(s:stable_sy)`] +THEN POP_ASSUM(fun th-> ASM_TAC THEN ONCE_REWRITE_TAC[th] THEN REWRITE_TAC[ARITH_RULE`1+0=1`]) +THEN REPEAT DISCH_TAC +THEN MP_TAC(ARITH_RULE`1<= i==> ~(i=0)/\ ~(0=2)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{0, 1} = {i, (1+i ) MOD k} /\ ~(i=0)==> i=1`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN ONCE_REWRITE_TAC[th] THEN REWRITE_TAC[ARITH_RULE`1+1=2`] ) +THEN REPEAT DISCH_TAC +THEN MRESA_TAC MOD_LT[`2:num`;`k_sy(s:stable_sy)`] +THEN POP_ASSUM(fun th-> ASM_TAC THEN ONCE_REWRITE_TAC[th] THEN REWRITE_TAC[ARITH_RULE`1+1=2`] ) +THEN REPEAT DISCH_TAC +THEN SUBGOAL_THEN`~({0,1}={1,2})` MP_TAC; +REWRITE_TAC[EXTENSION;SET_RULE`x IN {A,B}<=> x= A \/ x=B`;] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; +RESA_TAC; +MRESA_TAC MOD_LT[`i':num`;`k_sy(s:stable_sy)`] +THEN POP_ASSUM(fun th-> ASM_TAC THEN ONCE_REWRITE_TAC[th]) +THEN REPEAT DISCH_TAC +THEN MP_TAC(ARITH_RULE`i' < k_sy s==> 1+i' = k_sy (s:stable_sy) \/ 1+ i' < k_sy s `) +THEN RESA_TAC; +POP_ASSUM(fun th-> ASM_TAC THEN ONCE_REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN REPEAT DISCH_TAC +THEN MP_TAC(ARITH_RULE`2 ~(k=0)/\ 1 ASM_TAC THEN ONCE_REWRITE_TAC[th] THEN REWRITE_TAC[ARITH_RULE`1+0=1`] ) +THEN REPEAT DISCH_TAC +THEN MP_TAC(ARITH_RULE`1<= i==> ~(i=0)/\ ~(0=2)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{i', 0} = {i, (1+i) MOD k} /\ ~(i=0)==> i=i'`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`i':num`;`k_sy(s:stable_sy)`]; +MP_TAC(ARITH_RULE`i <= k-1 /\ 2< k==> 1+i = k \/ 1+i < k `) +THEN RESA_TAC; +POP_ASSUM(fun th-> ASM_TAC THEN ONCE_REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN REPEAT DISCH_TAC +THEN MP_TAC(ARITH_RULE`2 ~(k=0)/\ 1 ASM_TAC THEN ONCE_REWRITE_TAC[th] THEN REWRITE_TAC[ARITH_RULE`1+0=1`] ) +THEN REPEAT DISCH_TAC +THEN MRESA_TAC MOD_LT[`1+i':num`;`k_sy(s:stable_sy)`] +THEN POP_ASSUM(fun th-> ASM_TAC THEN ONCE_REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN REPEAT DISCH_TAC +THEN MP_TAC(ARITH_RULE`1<= i' ==> ~(i'= 0) /\ ~(1+i'=0)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(i'= 0) /\ ~(1+i'=0) ==> ~({i', 1+i' } = {i, 0})`) +THEN RESA_TAC; +MRESA_TAC MOD_LT[`1+i':num`;`k_sy(s:stable_sy)`] +THEN POP_ASSUM(fun th-> ASM_TAC THEN ONCE_REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN REPEAT DISCH_TAC +THEN MRESA_TAC MOD_LT[`1+i:num`;`k_sy(s:stable_sy)`] +THEN POP_ASSUM(fun th-> ASM_TAC THEN ONCE_REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN REPEAT DISCH_TAC +THEN MP_TAC(SET_RULE`{i',1+ i'} = {i,1+ i} ==> i= 1+i' \/ i=i'`) +THEN RESA_TAC; +POP_ASSUM(fun th-> ASM_TAC THEN ONCE_REWRITE_TAC[th] THEN REWRITE_TAC[ARITH_RULE`1+(1+i)=2+i`] ) +THEN REPEAT DISCH_TAC +THEN MP_TAC(ARITH_RULE`~(i'= 2+i')`) +THEN RESA_TAC +THEN SUBGOAL_THEN`~({i', 1+i'} = {1+i', 2+i'})` MP_TAC; +POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`~(i'= 1+i') /\ ~(1+i'= 2+i')`) +THEN SET_TAC[]; +RESA_TAC; +MRESA_TAC MOD_LT[`i:num`;`k_sy(s:stable_sy)`]; +RESA_TAC +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`i<=k-1 /\ 2 i<= k/\ i d_fun (s,l) <= #0.92`, +[REPEAT STRIP_TAC +THEN SUBGOAL_THEN `d_fun(s:stable_sy,(l:real^(M,3)finite_product))<= d_sy s+ #0.1 *(cstab- sqrt(&8)) ` +ASSUME_TAC; +REWRITE_TAC[d_fun;sigma_sy] +THEN MATCH_MP_TAC(REAL_ARITH`b<=c==> a+ #0.1 * b<=a+ #0.1* c`) +THEN DISJ_CASES_TAC(SET_RULE`~(ear_sy s) \/ (ear_sy (s:stable_sy))`) +THEN ASM_REWRITE_TAC[]; +MATCH_MP_TAC(REAL_ARITH`&0<= a/\ &0<= b==> -- &1 *a<=b`); +STRIP_TAC; +MATCH_MP_TAC SUM_POS_LE +THEN REWRITE_TAC[FINITE_J1_SY] +THEN REWRITE_TAC[J1_SY;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_NUMSEG] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL B_SY_LE_CSTAB)[`i:num`;`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`;] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +REWRITE_TAC[REAL_ARITH`&0<= a-b<=> b<=a`;cstab] +THEN MATCH_MP_TAC REAL_LE_LSQRT +THEN REAL_ARITH_TAC; +MRESAL_TAC(GEN_ALL SING_J1_SY)[`k:num`;`s:stable_sy`][SUM_SING;REAL_ARITH`&1 *A=A`;REAL_ARITH`A-B<= A-C<=> C<=B`] +THEN MP_TAC(ARITH_RULE`i<=k==> i=k \/ i< k:num`) +THEN RESA_TAC; +MP_TAC(ARITH_RULE`2 ~(k=0)/\ 1 ASSUME_TAC(SYM th)) +THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num/\ 1+0=1`;IN_SING] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`0`;`1`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`1`;`k:num`][ARITH_RULE`A+0=A/\ k+k= k* 2`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN B_SY1 (a_sy s) (b_sy (s:stable_sy))` +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[VECMATS_MATVEC_ID] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`k:num`;`1:num`][ARITH_RULE`1<=1`]); +MRESA_TAC MOD_LT[`i:num`;`k_sy(s:stable_sy)`] +THEN MP_TAC(ARITH_RULE`2 ~(k=0)/\ 1 MRESA_TAC th[`i:num`;`(1+i) MOD k`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`i:num`;`1+i:num`][ARITH_RULE`A+0=A`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC(ARITH_RULE`i 1<= 1+i /\ 1+i<=k`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN B_SY1 (a_sy s) (b_sy (s:stable_sy))` +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[VECMATS_MATVEC_ID;ADD1] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`i:num`;`1+i:num`][ARITH_RULE`1<=1`]) +THEN ASM_REWRITE_TAC[ARITH_RULE`1<=1/\ 1+i= SUC i`;ADD1] +THEN ONCE_REWRITE_TAC[ARITH_RULE`i+1=1+i`] +THEN ASM_REWRITE_TAC[]; +MATCH_MP_TAC(REAL_ARITH`d_fun (s,l) <= d_sy s + #0.1 * (cstab - sqrt (&8)) +/\ d_sy s <= #0.9 /\ cstab - sqrt (&8)<= #0.2 +==> d_fun (s,l) <= #0.92`) +THEN ASM_REWRITE_TAC[cstab;REAL_ARITH`#3.01 - sqrt (&8) <= #0.2 <=> #2.81 <= sqrt (&8) `] +THEN MATCH_MP_TAC REAL_LE_RSQRT +THEN REAL_ARITH_TAC]);; + + +let TAU_FUN_LE=prove_by_refinement(`!s:stable_sy l:real^(M,3)finite_product. +k_sy s =k /\ dimindex(:M) =k/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ 2 #0.92< tau_fun (V_SY(vecmats l)) (E_SY(vecmats l)) (F_SY(vecmats l))`, +[REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[tau_fun;rho_fun] +THEN MRESA_TAC (GEN_ALL CARD_F_SY_IN_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`] +THEN MRESA1_TAC (GEN_ALL FINITE_F_SY)`l:real^(M,3)finite_product` +THEN ASM_SIMP_TAC[REAL_ARITH`(&1+B)*C=C+B*C`;SUM_ADD] +THEN SUBGOAL_THEN`&0<= sum (F_SY (vecmats l)) + (\x. (inv (&2 * h0 - &2) * inv pi * sol0 * (norm (FST x) - &2)) * + azim_in_fan x (E_SY (vecmats (l:real^(M,3)finite_product))))`ASSUME_TAC; +MATCH_MP_TAC SUM_POS_LE +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC REAL_LE_MUL +THEN STRIP_TAC; +MATCH_MP_TAC REAL_LE_MUL +THEN STRIP_TAC; +REWRITE_TAC[REAL_LE_INV_EQ;h0] +THEN REAL_ARITH_TAC; +MATCH_MP_TAC REAL_LE_MUL +THEN STRIP_TAC; +REWRITE_TAC[REAL_LE_INV_EQ;] +THEN MATCH_MP_TAC(REAL_ARITH`&0 &0 <= a`) +THEN REWRITE_TAC[PI_WORKS]; +MATCH_MP_TAC REAL_LE_MUL +THEN STRIP_TAC; +MATCH_MP_TAC(REAL_ARITH`&0 &0 <= a`) +THEN REWRITE_TAC[SOL0_POS]; +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM;F_SY] +THEN RESA_TAC +THEN REMOVE_THEN"THY"(fun th-> MRESAL1_TAC th `i:num`[VECMATS_MATVEC_ID;ball_annulus;IN_ELIM_THM;DIFF;ball;dist;VECTOR_ARITH`vec 0-A = --A`;NORM_NEG]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;convex_local_fan] +THEN STRIP_TAC +THEN STRIP_TAC +THEN ASM_SIMP_TAC[azim;VECMATS_MATVEC_ID] +THEN MRESAL_TAC (GEN_ALL Local_lemmas.LOFA_DETERMINE_AZIM_IN_FA)[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`x:real^3#real^3`][VECMATS_MATVEC_ID;azim]; +MATCH_MP_TAC(REAL_ARITH` +&0<= sum (F_SY (vecmats l)) + (\x. (inv (&2 * h0 - &2) * inv pi * sol0 * (norm (FST x) - &2)) * + azim_in_fan x (E_SY (vecmats (l:real^(M,3)finite_product)))) +/\ +#0.92 < +sum (F_SY (vecmats l)) (\x. azim_in_fan x (E_SY (vecmats l))) - + (pi + sol0) * &(k-2) +==> #0.92 < + (sum (F_SY (vecmats l)) (\x. azim_in_fan x (E_SY (vecmats l))) + + sum (F_SY (vecmats l)) + (\x. (inv (&2 * h0 - &2) * inv pi * sol0 * (norm (FST x) - &2)) * + azim_in_fan x (E_SY (vecmats l)))) - + (pi + sol0) * &(k-2)`) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[ARITH_RULE`azim_in_fan x (E_SY (vecmats l)) +=(azim_in_fan x (E_SY (vecmats l)) -pi)+pi`] +THEN ASM_SIMP_TAC[SUM_ADD;SUM_CONST;] +THEN MP_TAC(ARITH_RULE`2< k==> 2<=k `) +THEN RESA_TAC +THEN MRESA_TAC REAL_OF_NUM_SUB[`2`;`k:num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[REAL_ARITH`(sum (F_SY (vecmats l)) (\x. azim_in_fan x (E_SY (vecmats l)) - pi) + + &k * pi) - + (pi + sol0) * (&k - &2) +=(&2 *pi+ sum (F_SY (vecmats l)) (\x. azim_in_fan x (E_SY (vecmats l)) - pi)) + + sol0 * &2 - sol0 * &k`;GSYM sol_local] +THEN MATCH_MP_TAC(REAL_ARITH` +pi<= sol_local (E_SY (vecmats l)) (F_SY (vecmats (l:real^(M,3)finite_product))) +/\ +#0.92 < +pi + sol0 * &2 - sol0 * &k +==> +#0.92 < + sol_local (E_SY (vecmats l)) (F_SY (vecmats l)) + sol0 * &2 - sol0 * &k`) +THEN ASM_REWRITE_TAC[] +THEN MRESA1_TAC stable_sy_lemma`s:stable_sy` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[stable_system;constraint_system] +THEN STRIP_TAC +THEN MRESA_TAC REAL_OF_NUM_LE[`k:num`;`6:num`] +THEN MATCH_MP_TAC(REAL_ARITH` +sol0 * &k<= sol0 * &6 +/\ #0.92 < pi + sol0 * &2 - sol0 * &6 +==> #0.92 < pi + sol0 * &2 - sol0 * &k`) +THEN STRIP_TAC; +MATCH_MP_TAC REAL_LE_LMUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(REAL_ARITH`&0< a==> &0<= a`) +THEN REWRITE_TAC[SOL0_POS]; +REWRITE_TAC[REAL_ARITH`pi + sol0 * &2 - sol0 * &6= pi - sol0 * &4`;] +THEN MATCH_MP_TAC(REAL_ARITH`sol0 < #0.551286 /\ #3.14159 < pi ==> #0.92 < pi - sol0 * &4`) +THEN REWRITE_TAC[Flyspeck_constants.bounds]]);; + +let TAU_STAR_POS=prove(`!s:stable_sy l:real^(M,3)finite_product. +k_sy s =k /\ dimindex(:M) =k/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ 2 &0< tau_star s l`, +REWRITE_TAC[tau_star;] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL TAU_FUN_LE)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`] +THEN MRESA_TAC (GEN_ALL D_FUN_LE)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC);; + +let CIRCULAR_SOL_EQ_2PI=prove(`convex_local_fan (V,E,FF) /\ circular V E +==> sol_local E FF= &2 *pi`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[convex_local_fan] THEN STRIP_TAC THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN REWRITE_TAC[sol_local;REAL_ARITH`A+B=A<=> B= &0`] +THEN MATCH_MP_TAC SUM_EQ_0 +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[REAL_ARITH`A-B= &0<=> A=B`] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "THY") +THEN MRESA_TAC (GEN_ALL LOCAL_FAN_RHO_NODE_PROS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x:real^3#real^3`) +THEN REMOVE_THEN "THY"MP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL LOCAL_FAN_IMP_IN_V)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`FST (x:real^3#real^3)`;`rho_node1 (FF:real^3#real^3->bool) (FST (x:real^3#real^3))`;`V:real^3->bool`] +THEN MRESA_TAC (GEN_ALL Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM)[`V:real^3->bool`;`FF:real^3#real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`FST (x:real^3#real^3)`) +THEN MRESA_TAC (GEN_ALL Local_lemmas.KCHMAMG)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`FST (x:real^3#real^3)`));; + +let NOT_CIRCULAR_SY=prove(`!s:stable_sy l:real^(M,3)finite_product. +k_sy s =k /\ dimindex(:M) =k/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ 2 ~(circular (V_SY(vecmats l)) (E_SY(vecmats l)))`, +REPEAT STRIP_TAC +THEN ASM_TAC +THEN DISCH_THEN(LABEL_TAC"THYGIANG") +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM( fun th-> ASSUME_TAC th THEN MP_TAC th THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;CONDITION1_SY] THEN STRIP_TAC) +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v:real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN DISCH_THEN(LABEL_TAC"THY2") +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th +THEN REWRITE_TAC[convex_local_fan] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th1-> MP_TAC th1 +THEN REWRITE_TAC[local_fan] +THEN LET_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th2-> ASSUME_TAC (SYM th2)) +THEN STRIP_TAC +THEN ASSUME_TAC th1) +THEN DISCH_THEN(LABEL_TAC"THY1") +THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL CIRCULAR_SOL_EQ_2PI)[`V_SY(vecmats (l:real^(M,3)finite_product))`;`E_SY(vecmats (l:real^(M,3)finite_product))`;`F_SY(vecmats (l:real^(M,3)finite_product))`] +THEN MP_TAC(REAL_ARITH`&0< pi ==> pi <= &2 * pi`) +THEN REWRITE_TAC[PI_WORKS] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL TAU_STAR_POS)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`~(&0< A) <=> A <= &0`]);; + + +let GBYCPXS += prove(`!s:stable_sy l:real^(M,3)finite_product. +k_sy s =k /\ dimindex(:M) =k/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ 2 +(d_sy s<= #0.9 +/\ pi<= sol_local (E_SY(vecmats l)) (F_SY(vecmats l)) +/\ l IN B_SY1 (a_sy s) (b_sy s) +==> &0< tau_star s l) +/\ (d_sy s<= #0.9 +/\ tau_star s l <= &0 +==> ~(circular (V_SY(vecmats l)) (E_SY(vecmats l))))`, +REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL TAU_STAR_POS)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`] +THEN MRESA_TAC (GEN_ALL NOT_CIRCULAR_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`]);; + + + + + +end;; + + diff --git a/text_formalization/local/HDPLYGY.hl b/text_formalization/local/HDPLYGY.hl new file mode 100755 index 0000000..8d53c40 --- /dev/null +++ b/text_formalization/local/HDPLYGY.hl @@ -0,0 +1,1871 @@ + +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + + + +module Hdplygy = struct + + + + +open Wjscpro;; +open Polyhedron;; +open Sphere;; +open Fan_defs;; +open Hypermap;; +open Vol1;; +open Fan;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Sphere;; +open Hypermap;; +open Fan;; +open Topology;; +open Prove_by_refinement;; +open Pack_defs;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Tecoxbm;; + +let a_ear0=new_definition`a_ear0 J (i,j)=( if i MOD 3=j MOD 3 then &0 else + (if {i MOD 3,j MOD 3} IN J then sqrt(&8) else &2)) `;; + +let b_ear0=new_definition`b_ear0 J (i,j)=( if i MOD 3=j MOD 3 then &0 else + (if {i MOD 3,j MOD 3} IN J then cstab else &2* h0)) `;; + + +let MOD_EQ_MOD1=prove(`!x1 x2 y n. ~(n=0) /\ (y + x1) MOD n = (y + x2) MOD n /\ x2<= x1 + ==> x1 MOD n = x2 MOD n`, +REPEAT STRIP_TAC +THEN MRESA_TAC DIVISION[`y+x1:num`;`n:num`] +THEN MRESA_TAC DIVISION[`y+x2:num`;`n:num`] +THEN MP_TAC(ARITH_RULE`y + x2 = (y + x2) DIV n * n + (y + x2) MOD n +/\ y + x1 = (y + x1) DIV n * n + (y + x2) MOD n +==> x1- x2= (y + x1) DIV n *n- (y + x2) DIV n * n `) +THEN POP_ASSUM( fun th-> GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM( fun th-> GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[GSYM RIGHT_SUB_DISTRIB] +THEN STRIP_TAC +THEN MRESA_TAC MOD_MULT[`n:num`;`(y + x1) DIV n - (y + x2) DIV n`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ARITH_RULE`n * ((y + x1) DIV n - (y + x2) DIV n) = ((y + x1) DIV n - (y + x2) DIV n) *n`] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`x2<= x1 ==> x1= x2 + (x1- x2):num`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_ADD_MOD[`x2:num`;`x1-x2:num`;`n:num`][ARITH_RULE` A+0=A/\ (A+B)+C=A+B+C`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM th]) +THEN MRESAL_TAC MOD_MOD_REFL[`x2:num`;`n:num`][ARITH_RULE`3*1=3/\ ~(3=0)`] +THEN RESA_TAC);; + + + +let MOD_EQ_MOD=prove(`!x1 x2 y n. ~(n=0) /\ (y + x1) MOD n = (y + x2) MOD n + ==> x1 MOD n = x2 MOD n`, +REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`x2<= x1 \/ x1<= x2:num`) +THENL[MRESA_TAC MOD_EQ_MOD1[`x1:num`;`x2:num`;`y:num`;`n:num`]; +MRESA_TAC MOD_EQ_MOD1[`x2:num`;`x1:num`;`y:num`;`n:num`]]);; + + +let EAR_STABLE_SYSTEM=prove_by_refinement(`stable_system 3 ((#0.11)) (0..2) (a_ear0 {{1,2}}) (b_ear0 {{1,2}}) ({{1,2}}) (\i. (1 + i) MOD 3)`, +[ +MRESAL_TAC HAS_SIZE_NUMSEG[`0`;`2`][ARITH_RULE`(2+1)-0=3`] +THEN ASM_SIMP_TAC[stable_system;constraint_system;torsor;ARITH_RULE`3<= 3 /\3<=6/\ 1+3<=6/\ (2+1)-0=3`;CARD_NUMSEG;Hypermap.CARD_SINGLETON;] +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC; + +STRIP_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`3-1=2`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN MRESAL1_TAC Hypermap.LE_MOD_SUC`2`[ARITH_RULE`SUC 2=3`]; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`3-1=2`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL MOD_IMP_EQ)[`3`;`1+x1`;`1+x2`][ARITH_RULE`1<= 1+A /\ (1+A<=3<=> A<=2)`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`3-1=2`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`0 1<= i /\ 1<3`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`3:num`;`x:num`;`i:num`] +THEN MP_TAC(ARITH_RULE`0 i=1 \/ i=2`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x<= 2==> x=0 \/ x=1 \/ x=2`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +REWRITE_TAC[ARITH_RULE`3-1=2`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN ASSUME_TAC(ARITH_RULE`1<=3 /\1<3/\ 1<=2`) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`3:num`;`x:num`;`3:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`3`;`x:num`][ARITH_RULE`1*3=3`] +THEN MP_TAC(ARITH_RULE`x<= 2==> x=0 \/ x=1 \/ x=2`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[b_ear0;a_ear0] +THEN REPEAT GEN_TAC +THEN DISJ_CASES_TAC(SET_RULE`i MOD 3 =j MOD 3 \/ ~(i MOD 3 =j MOD 3:num)`); + +ASM_REWRITE_TAC[REAL_ARITH`&0<= &0`]; + +ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(SET_RULE`{i MOD 3,j MOD 3} IN {{1,2}} \/ ~({i MOD 3,j MOD 3} IN {{1,2}})`); + +ASM_REWRITE_TAC[IN_SING] +THEN ONCE_REWRITE_TAC[SET_RULE`{i MOD 3,j MOD 3} ={1,2} <=> {j MOD 3,i MOD 3}= {1,2}`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_SING;cstab] +THEN RESA_TAC +THEN MATCH_MP_TAC REAL_LE_LSQRT +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[IN_SING] +THEN ONCE_REWRITE_TAC[SET_RULE`{i MOD 3,j MOD 3} ={1,2} <=> {j MOD 3,i MOD 3}= {1,2}`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_SING;h0] +THEN RESA_TAC +THEN REAL_ARITH_TAC; + +STRIP_TAC; + +REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`1<= 3 /\ 1<3`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`3`;`j:num`][ARITH_RULE`1*3=3`] +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`3:num`;`j:num`;`3:num`] +THEN SIMP_TAC[b_ear0;a_ear0;ARITH_RULE`A+0=A`;MOD_MOD_REFL;ARITH_RULE`~(3=0)`]; + +REWRITE_TAC[SUBSET;IN_SING;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`0<=1 /\ 1<=2/\ (1 +1 ) MOD 3= 2`]; +STRIP_TAC; +REWRITE_TAC[a_ear0;IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`i<= 2/\ j<= 2==> i< 3 /\ j< 3`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`3`] +THEN MRESA_TAC MOD_LT[`j:num`;`3`] +THEN DISJ_CASES_TAC(SET_RULE`{i,j} IN {{1,2}} \/ ~({i,j} IN {{1,2}})`); +ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_RSQRT +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; +STRIP_TAC; +REWRITE_TAC[b_ear0;a_ear0;MOD_MOD_REFL] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`i MOD 3 =(1+i) MOD 3 MOD 3\/ ~(i MOD 3 =(1+i) MOD 3 MOD 3:num)`); +ASM_REWRITE_TAC[REAL_ARITH`&0<= &0`;cstab] +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(SET_RULE`{i MOD 3,(1+i) MOD 3 MOD 3} IN {{1,2}} \/ ~({i MOD 3,(1+i) MOD 3 MOD 3} IN {{1,2}})`); +ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; +REWRITE_TAC[IN_SING;a_ear0;b_ear0] +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`{i,j}={1,2} /\ ~(1=2) ==> ~(i=j) /\ (i =1\/ i=2) /\ (j=1\/ j=2)`) +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=2)`] +THEN DISCH_TAC +THEN MP_TAC(ARITH_RULE`(i =1\/ i=2) /\ (j=1\/ j=2)==> i< 3 /\ j< 3`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`3`] +THEN MRESA_TAC MOD_LT[`j:num`;`3`]]);; + + + + + + + + + + + +let exist_stable_system=prove_by_refinement(`?s:(num#real#(num->bool)#(num#num->real)#(num#num->real)#((num->bool)->bool)#(num->num)). stable_system (FST s) (FST (SND s)) (FST (SND (SND s))) (FST (SND (SND (SND s)))) (FST(SND (SND (SND (SND s))))) (FST (SND (SND (SND (SND (SND s)))))) +(SND(SND (SND (SND (SND (SND s))))))`, +[EXISTS_TAC`3, (#0.11), (0..2), (a_ear0 {{1,2}}), (b_ear0 {{1,2}}), ({{1,2}}),(\i. (1 + i) MOD 3)` +THEN REWRITE_TAC[EAR_STABLE_SYSTEM]]);; + + +let stable_sy_tybij = (new_type_definition "stable_sy" ("stable_sy", "tuple_stable_sy")exist_stable_system);; + + +let k_sy = new_definition `k_sy (s:stable_sy) = FST (tuple_stable_sy s)`;; + +let d_sy = new_definition `d_sy (s:stable_sy) = (FST (SND (tuple_stable_sy s)))`;; + +let I_SY = new_definition `I_SY (s:stable_sy) = (FST (SND (SND (tuple_stable_sy s))))`;; + +let a_sy = new_definition `a_sy (s:stable_sy) = (FST (SND (SND (SND (tuple_stable_sy s)))))`;; + +let b_sy = new_definition `b_sy (s:stable_sy) = (FST(SND (SND (SND (SND (tuple_stable_sy s)))))) `;; + + +let J_SY = new_definition `J_SY (s:stable_sy) = (FST (SND (SND (SND (SND (SND (tuple_stable_sy s))))))) `;; + +let f_sy = new_definition `f_sy (s:stable_sy) = (SND(SND (SND (SND (SND (SND (tuple_stable_sy s)))))))`;; + + + +let stable_sy_lemma=prove(`!s:stable_sy. stable_system (k_sy s) (d_sy s) (I_SY s) (a_sy s) (b_sy s) (J_SY s) (f_sy s)`, + ASM_REWRITE_TAC[stable_sy_tybij;k_sy;d_sy;I_SY; a_sy; b_sy; J_SY; f_sy]);; + + +let ear_sy=new_definition `ear_sy (s:stable_sy)<=> CARD(I_SY s)=3 /\ d_sy s= #0.11 /\ CARD (J_SY s)= 1 /\ a_sy (s)= a_ear0 (J_SY s) +/\ b_sy (s)= b_ear0 (J_SY s) `;; + + +let sigma_sy=new_definition `sigma_sy (s:stable_sy) = (if ear_sy s then &1 else -- &1) `;; + +let J1_SY=new_definition `J1_SY (s:stable_sy)= {x| ?i. {i MOD (k_sy s),f_sy s (i MOD (k_sy s))} IN J_SY s /\ i IN 1..(k_sy s) /\ x=i,SUC(i MOD (k_sy s))}`;; + +let d_fun=new_definition `d_fun (s:stable_sy,l:real^(M,3)finite_product) = (d_sy s) + #0.1 * sigma_sy s * sum (J1_SY s) (\x. cstab -norm (row (FST x) (vecmats l) - row (SND x) (vecmats l) ))`;; + +let tau_star=new_definition `tau_star (s:stable_sy) (l:real^(M,3)finite_product)= tau_fun (V_SY (vecmats l)) (E_SY (vecmats l)) (F_SY (vecmats l)) - d_fun (s,l)`;; + + +let FINITE_J_SY=prove(`!s:stable_sy . +FINITE (J_SY s)`, +GEN_TAC +THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system;torsor;HAS_SIZE] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC FINITE_SUBSET[`J_SY (s:stable_sy)`;`{{i, f_sy s i} | i | i IN I_SY (s:stable_sy)}`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESAL_TAC FINITE_IMAGE[`(\i. {i, f_sy (s:stable_sy) i})`;`I_SY (s:stable_sy)`][FINITE_NUMSEG;IMAGE] +THEN SUBGOAL_THEN`{y | ?x. x IN I_SY s /\ y = {x,f_sy s x}}={{i, f_sy s i} | i | i IN I_SY (s:stable_sy)}`ASSUME_TAC +THENL[REWRITE_TAC[EXTENSION;IN_ELIM_THM]; +POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])]);; + + +let FINITE_J1_SY=prove(`!s:stable_sy . +FINITE (J1_SY s)`, +GEN_TAC +THEN REWRITE_TAC[J1_SY] +THEN MRESAL_TAC FINITE_IMAGE[`(\i. i, SUC(i MOD (k_sy s)))`;`1..k_sy (s:stable_sy)`][FINITE_NUMSEG;IMAGE] +THEN MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`{y | ?x. x IN 1..(k_sy (s:stable_sy)) /\ y = x,SUC(x MOD (k_sy s))}` +THEN ASM_REWRITE_TAC[SUBSET;IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]);; + +let CONTINUOUS_ON_ROW=prove(`!i s:real^(M,N)finite_product->bool. 1<= i/\ i<= dimindex(:M) ==> (\x. row i (vecmats x)) continuous_on s`, +REWRITE_TAC[continuous_on;] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`e:real` +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= i/\ i<= dimindex(:M) ==> i-1< dimindex(:M)`) +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL VECMAT_ROW)[`i-1:num`;`vecmats(x':real^(M,N)finite_product)`][MATVEC_VECMATS_ID] +THEN MRESAL_TAC (GEN_ALL VECMAT_ROW)[`i-1:num`;`vecmats(x:real^(M,N)finite_product)`][MATVEC_VECMATS_ID] +THEN MRESA_TAC (GEN_ALL DIST_VECMAT)[`i-1:num`;`x':real^(M,N)finite_product`;`x:real^(M,N)finite_product`] +THEN MP_TAC(ARITH_RULE`1<= i/\ i<= dimindex(:M) ==> i= SUC(i-1)`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC);; + + +let INDEX_J1_SY=prove(`!s:stable_sy . +x IN J1_SY s ==> 1 <= FST x /\ FST x <= k_sy s`, +REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[]);; + + + +let CONTINUOUS_ON_D_FUN=prove(`!s:stable_sy . +k_sy s =k /\ dimindex(:M) =k/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) +==> lift o(\l:real^(M,3)finite_product. d_fun(s,l)) continuous_on (B_SY1 (a_sy s) (b_sy s))`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[d_fun;LIFT_ADD;o_DEF;] +THEN MATCH_MP_TAC CONTINUOUS_ON_ADD +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;] +THEN MATCH_MP_TAC CONTINUOUS_ON_CMUL +THEN MATCH_MP_TAC CONTINUOUS_ON_CMUL +THEN ASSUME_TAC FINITE_J1_SY +THEN POP_ASSUM(fun th -> MRESA1_TAC th`s:stable_sy`) +THEN ASM_SIMP_TAC[LIFT_SUM;o_DEF] +THEN MATCH_MP_TAC CONTINUOUS_ON_VSUM +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[LIFT_SUB] +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;] +THEN MATCH_MP_TAC CONTINUOUS_ON_LIFT_NORM_COMPOSE +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC CONTINUOUS_ON_ROW +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT RESA_TAC; +MATCH_MP_TAC CONTINUOUS_ON_ROW +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC]);; + +let INJ_B_SY=prove(`!s:stable_sy x:real^(M,3)finite_product. x IN (B_SY1 (a_sy s) (b_sy s)) /\ k_sy s =k /\ dimindex(:M) =k /\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ 2 +(!i j. + i IN 1..k /\ + j IN 1..k /\ + row i (vecmats x),row (SUC (i MOD k)) (vecmats x) = + row j (vecmats x),row (SUC (j MOD k)) (vecmats x) + ==> i = j)`, +REWRITE_TAC[PAIR_EQ;IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN MRESA1_TAC stable_sy_lemma`s:stable_sy` +THEN MRESA_TAC (GEN_ALL PROPERTIES_OF_FAN_IN_B_SY)[`d_sy (s:stable_sy)`;`J_SY (s:stable_sy)`;`k_sy (s:stable_sy)`;`i:num`;`j:num`;`a_sy (s:stable_sy)`;`b_sy (s:stable_sy)`;`row i (vecmats (x:real^(M,3)finite_product))`;`row j (vecmats (x:real^(M,3)finite_product))`;`x:real^(M,3)finite_product`] +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(i=j) \/ i=j:num`) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-A= vec 0`;NORM_0] +THEN REAL_ARITH_TAC);; + +let INJ_ROW_B_SY=prove(`!s:stable_sy x:real^(M,3)finite_product. x IN (B_SY1 (a_sy s) (b_sy s)) /\ k_sy s =k /\ dimindex(:M) =k /\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ 2 +(!i j. + i IN 1..k /\ + j IN 1..k /\ + row i (vecmats x) = + row j (vecmats x) + ==> i = j)`, +REWRITE_TAC[PAIR_EQ;IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN MRESA1_TAC stable_sy_lemma`s:stable_sy` +THEN MRESA_TAC (GEN_ALL PROPERTIES_OF_FAN_IN_B_SY)[`d_sy (s:stable_sy)`;`J_SY (s:stable_sy)`;`k_sy (s:stable_sy)`;`i:num`;`j:num`;`a_sy (s:stable_sy)`;`b_sy (s:stable_sy)`;`row i (vecmats (x:real^(M,3)finite_product))`;`row j (vecmats (x:real^(M,3)finite_product))`;`x:real^(M,3)finite_product`] +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(i=j) \/ i=j:num`) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A-A= vec 0`;NORM_0] +THEN REAL_ARITH_TAC);; + + + +let CHANGE_SUM_TAU_FUN=prove(`!s:stable_sy x:real^(M,3)finite_product. k_sy s =k /\ dimindex(:M) =k /\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ 2 +(\x. + sum (F_SY (vecmats x)) + (\e. rho_fun (norm (FST e)) * azim_in_fan e (E_SY (vecmats x)))) x += (\x. sum (1..k_sy s) + (\i. rho_fun (norm (row i (vecmats x))) * azim_in_fan (row i (vecmats x), row (SUC (i MOD (k_sy s))) (vecmats x)) (E_SY (vecmats x)))) x`, + REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[B_SY1;IN_ELIM_THM] +THEN STRIP_TAC +THEN MP_TAC th +THEN RESA_TAC) +THEN SUBGOAL_THEN`{y | ?x1. x1 IN 1..dimindex (:M) /\ + y = + row x1 (vecmats x), + row (SUC (x1 MOD dimindex (:M))) (vecmats x)} +={row i (vecmats x),row (SUC (i MOD dimindex (:M))) (vecmats (x:real^(M,3)finite_product)) | 1 <= i /\ + i <= + dimindex + (:M)}`ASSUME_TAC +THENL[ +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG]; +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[GSYM F_SY] +THEN STRIP_TAC +THEN MRESAL_TAC SUM_IMAGE[`(\i. (row i (vecmats x), row (SUC (i MOD (k_sy s))) (vecmats (x:real^(M,3)finite_product))))`;`(\e. rho_fun (norm (FST e)) * azim_in_fan e (E_SY (vecmats (x:real^(M,3)finite_product))))`;`1..(k_sy (s:stable_sy))`][o_DEF;IMAGE] +THEN POP_ASSUM MATCH_MP_TAC +THEN MATCH_MP_TAC INJ_B_SY +THEN EXISTS_TAC`s:stable_sy` +THEN ASM_REWRITE_TAC[]]);; + + + +let CONTINUOUS_ON_SAME_DOMAIN=prove(`!f g s:real^M->bool. (!x. x IN s==> f x= g x) /\ f continuous_on s ==> g continuous_on s`, +SIMP_TAC[continuous_on] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THYGIANG") +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THY"(fun th-> MRESA1_TAC th`x:real^M`) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`e:real`) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN EXISTS_TAC`d:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"THYGIANG"(fun th-> MRESA1_TAC th`x':real^M` THEN MRESA1_TAC th`x:real^M`) +THEN REMOVE_THEN"THY"(fun th-> MRESA1_TAC th`x':real^M`));; + + +let EDGE_IN_F_SY=prove(`!(l:real^(M,3)finite_product). 1<= i /\ i<= dimindex (:M) +/\ u = row i (vecmats l) +/\ v= row (SUC (i MOD dimindex (:M))) (vecmats l) +==> u,v IN F_SY (vecmats l)`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[F_SY;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]);; + + + +let JBDNJJB3=prove(`!u:real^3 v:real^3 w:real^3. +~collinear {vec 0, u, v} /\ ~collinear {vec 0, u, w} +==> +sin(azim (vec 0) u v w)=inv (sqrt(norm w pow 2 - (inv (norm u) * (u dot w)) pow 2) * norm (u cross v)) *(u cross v) dot w`, +REPEAT STRIP_TAC +THEN MRESA_TAC th3[`((vec 0):real^3)`;` (u:real^3)`;` (v:real^3)`] +THEN MRESA_TAC properties_coordinate[`((vec 0):real^3)`;` (u:real^3)`;` (v:real^3)`] +THEN MRESA_TAC azim[`((vec 0):real^3)`;` (u:real^3)`;` (v:real^3)`;`(w:real^3)`] +THEN POP_ASSUM (fun th->MRESA_TAC th [`e1_fan ((vec 0):real^3) (u:real^3) (v:real^3)`;`e2_fan ((vec 0):real^3) (u:real^3) (v:real^3)`;`e3_fan ((vec 0):real^3) (u:real^3) (v:real^3)`]) +THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN DISCH_THEN (LABEL_TAC"YEU EM") +THEN DISCH_TAC THEN DISCH_TAC +THEN SUBGOAL_THEN`sqrt(norm w pow 2 - (inv (norm u) * (u dot (w:real^3))) pow 2) =r2`ASSUME_TAC +THENL[ +MRESA1_TAC NORM_POW_2`w:real^3` +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[VECTOR_ARITH`a=a- vec 0`] +THEN ASM_REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;REAL_ARITH`A* &0= &0 /\ &0+ A=A`] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[REAL_ARITH`A* &0= &0 /\ &0+ A=A`] +THEN FIND_ASSUM MP_TAC`orthonormal (e1_fan (vec 0) u v) (e2_fan (vec 0) u v) + (e3_fan (vec 0) u (v:real^3))` +THEN REWRITE_TAC[orthonormal;] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[REAL_ARITH`A* &0= &0 /\ A+ &0=A/\ &0 +A=A +/\ (r2 * cos (psi + azim (vec 0) u v w)) * + (r2 * cos (psi + azim (vec 0) u v w)) * + &1 + + (r2 * sin (psi + azim (vec 0) u v w)) * + (r2 * sin (psi + azim (vec 0) u v w)) * + &1 + + h2 * h2 * ((u - vec 0) dot (u - vec 0)) += (r2 pow 2) * ( (sin (psi + azim (vec 0) u v w)) pow 2 +(cos (psi + azim (vec 0) u v w)) pow 2 ) + + h2 * h2 * ((u - vec 0) dot (u - vec 0))`;Trigonometry.WPMXVYZ] +THEN MP_TAC(VECTOR_ARITH`w dot u= (w- vec 0) dot (u- vec 0:real^3)`) +THEN ASM_REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;REAL_ARITH`A* &0= &0 /\ &0+ A=A`] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[REAL_ARITH`A* &0= &0 /\ &0+ A=A`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN MP_TAC(SYM th) THEN REWRITE_TAC[VECTOR_ARITH`A- vec 0=A`;GSYM NORM_POW_2]) +THEN ONCE_REWRITE_TAC[REAL_ARITH`A *B= B*A`] +THEN MP_TAC(ISPECL[`u:real^3`;`(vec 0) :real^3`]imp_norm_not_zero_fan) +THEN REDUCE_VECTOR_TAC +THEN RESA_TAC +THEN MP_TAC(ISPEC`(norm(u:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`norm u pow 2 * h2 = u dot w +==> inv (norm u) * inv (norm u) *(norm u pow 2 * h2) = inv (norm u) *inv (norm u) *(u dot (w:real^3))`) +THEN POP_ASSUM( fun th -> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH` inv (norm u) * inv (norm u) * norm u pow 2 * h2 =(inv (norm u) * norm u) pow 2 * h2/\ &1 pow 2 * h2= h2/\ &1 *A=A`] +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ARITH` +(u dot w) * inv (norm u) * inv (norm u) * (u dot w) = (inv (norm u) * (u dot w)) pow 2`] +THEN ONCE_REWRITE_TAC[REAL_ARITH` +norm w pow 2 = r2 pow 2 + (inv (norm u) * (u dot w)) pow 2 +<=> norm w pow 2 - (inv (norm u) * (u dot w)) pow 2= r2 pow 2 `] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B=B*A`] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC POW_2_SQRT +THEN MATCH_MP_TAC(REAL_ARITH`&0< A==> &0<= A`) +THEN ASM_REWRITE_TAC[]; +MRESA_TAC sincos1_of_u_fan[`((vec 0):real^3)`;` (u:real^3)`;` (v:real^3)`;`r1:real`; `psi:real`; `h1:real`] +THEN REMOVE_THEN "YEU EM" MP_TAC +THEN ASM_REWRITE_TAC[COS_ADD;SIN_ADD;] +THEN REDUCE_ARITH_TAC +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`w = + (r2 * cos (azim (vec 0) u v w)) % e1_fan (vec 0) u v + + (r2 * sin (azim (vec 0) u v w)) % e2_fan (vec 0) u v + + h2 % u ==> +(u cross v) dot w = +(u cross v) dot ((r2 * cos (azim (vec 0) u v w)) % e1_fan (vec 0) u v + + (r2 * sin (azim (vec 0) u v w)) % e2_fan (vec 0) u v + + h2 % u)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[DOT_LADD; DOT_RADD; DOT_LMUL; DOT_RMUL;DOT_CROSS_SELF; e2_fan;e1_fan;e3_fan; +VECTOR_ARITH`A- vec 0= A`;CROSS_LADD; CROSS_RADD; CROSS_LMUL; CROSS_RMUL;CROSS_REFL;CROSS_RNEG;CROSS_LNEG;] +THEN REDUCE_ARITH_TAC +THEN REWRITE_TAC[NORM_MUL;REAL_INV_MUL;REAL_ABS_INV;REAL_INV_INV;REAL_ABS_NORM;DOT_SQUARE_NORM +;REAL_ARITH`(r2 * sin (azim (vec 0) u v w)) * + (norm u * inv (norm (u cross v))) * + inv (norm u) * + norm (u cross v) pow 2 =(r2* norm(u cross v)) * sin (azim (vec 0) u v w) * + ( inv (norm u) * norm u)* +( inv (norm (u cross v))* norm (u cross (v:real^3)))` +] +THEN MP_TAC(ISPECL[`u:real^3`;`(vec 0) :real^3`]imp_norm_not_zero_fan) +THEN REDUCE_VECTOR_TAC +THEN RESA_TAC +THEN MP_TAC(ISPEC`(norm(u:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN ASSUME_TAC(ISPEC`u:real^3`NORM_POS_LE) +THEN MP_TAC(REAL_ARITH`~(&0 =norm(u:real^3)) /\ &0 <= norm(u:real^3)==> &0 &0 ~((r2:real)*norm(u cross v:real^3)= &0)`) +THEN REDUCE_VECTOR_TAC +THEN RESA_TAC +THEN MP_TAC(ISPEC`(r2 * norm(u cross v:real^3))`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(ISPEC`(r2 * norm(u cross v:real^3))`REAL_LT_INV) +THEN RESA_TAC +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(u cross v) dot w = (r2 * norm (u cross v)) * sin (azim (vec 0) u v w) ==> +inv (r2 * norm (u cross v))*(r2 * norm (u cross v)) * sin (azim (vec 0) u v w)= inv (r2 * norm (u cross v)) *((u cross v) dot w)`) +THEN POP_ASSUM (fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`inv (r2 * norm (u cross v)) * (r2 * norm (u cross v)) * + sin (azim (vec 0) u v w)=(inv (r2 * norm (u cross v)) * (r2 * norm (u cross v)))* + sin (azim (vec 0) u v w)`] +THEN REDUCE_ARITH_TAC +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[GSYM REAL_INV_MUL]]]);; + + + + +let CONTINUOUS_AT_SQRT = prove + (`!a. &0 < drop a ==> (lift o sqrt o drop) continuous (at a)`, + REPEAT STRIP_TAC THEN REWRITE_TAC[continuous_at; o_THM; DIST_LIFT] THEN + X_GEN_TAC `e:real` THEN DISCH_TAC THEN + EXISTS_TAC `min (drop a) (e * sqrt(drop a))` THEN + ASM_SIMP_TAC[REAL_LT_MIN; SQRT_POS_LT; REAL_LT_MUL; DIST_REAL] THEN + X_GEN_TAC `b:real^1` THEN REWRITE_TAC[GSYM drop] THEN STRIP_TAC THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP (REAL_ARITH + `abs(b - a) < a ==> &0 < b`)) THEN + SUBGOAL_THEN + `sqrt(drop b) - sqrt(drop a) = + (drop b - drop a) / (sqrt(drop a) + sqrt(drop b))` + SUBST1_TAC THENL + [MATCH_MP_TAC(REAL_FIELD + `sa pow 2 = a /\ sb pow 2 = b /\ &0 < sa /\ &0 < sb + ==> sb - sa = (b - a) / (sa + sb)`) THEN + ASM_SIMP_TAC[SQRT_POS_LT; SQRT_POW_2; REAL_LT_IMP_LE]; + ASM_SIMP_TAC[REAL_ABS_DIV; SQRT_POS_LT; REAL_LT_ADD; REAL_LT_LDIV_EQ; + REAL_ARITH `&0 < x ==> abs x = x`] THEN + FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (REWRITE_RULE[IMP_CONJ] + REAL_LTE_TRANS)) THEN + ASM_SIMP_TAC[REAL_LE_LMUL_EQ; REAL_LE_ADDR; SQRT_POS_LE; + REAL_LT_IMP_LE]]);; + + +let SEQUENTIALLY_DIVH=prove_by_refinement(`!f:num->real^3 g:num->real^3 h:num->real^3.((\n:num. f n) --> a) sequentially /\ ((\n:num. g n) --> b) sequentially /\ ((\n:num. h n) --> c) sequentially /\ ~(collinear {vec 0, a,b:real^3}) /\ ~(collinear {vec 0, a,c}) /\ (!n. ~(collinear {vec 0, f n, g n}) /\ ~(collinear {vec 0, f n, h n})) +==> ((lift o (\n:num. dihV (vec 0) (f(n)) (g(n)) (h n)))--> lift ( dihV (vec 0) a b c)) sequentially`, +[REPEAT STRIP_TAC +THEN MRESA_TAC Trigonometry2.FOR_LEMMA19[`vec 0:real^3`;`a:real^3`; `b:real^3`;`c:real^3`] +THEN POP_ASSUM MP_TAC +THEN REPEAT LET_TAC +THEN RESA_TAC +THEN ABBREV_TAC`v01n= (\n:num. dist (vec 0:real^3, f n) pow 2)` +THEN ABBREV_TAC`v02n= (\n:num. dist (vec 0:real^3, g n) pow 2)` +THEN ABBREV_TAC`v03n= (\n:num. dist (vec 0:real^3, h n) pow 2)` +THEN ABBREV_TAC`v12n= (\n:num. dist (f n, (g n):real^3) pow 2)` +THEN ABBREV_TAC`v13n= (\n:num. dist (f n, (h n):real^3) pow 2)` +THEN ABBREV_TAC`v23n= (\n:num. dist (g n, (h n):real^3) pow 2)` +THEN SUBGOAL_THEN`(\n. dihV (vec 0) ((f:num->real^3) n) (g n) (h n)) += (\n:num. acs + (delta_x4 (v01n n) (v02n n) (v03n n) (v23n n) (v13n n) (v12n n) / + sqrt (ups_x (v01n n) (v02n n) (v12n n) * ups_x (v01n n) (v03n n) (v13n n) +) +) +)`ASSUME_TAC; +REWRITE_TAC[FUN_EQ_THM] +THEN STRIP_TAC +THEN MRESA_TAC Trigonometry2.FOR_LEMMA19[`vec 0:real^3`;`(f (x:num)):real^3`; `(g (x:num)):real^3`;`(h (x:num)):real^3`] +THEN POP_ASSUM MP_TAC +THEN REPEAT LET_TAC +THEN RESA_TAC +THEN EXPAND_TAC"v01n" +THEN EXPAND_TAC"v02n" +THEN EXPAND_TAC"v03n" +THEN EXPAND_TAC"v12n" +THEN EXPAND_TAC"v23n" +THEN EXPAND_TAC"v13n" +THEN REWRITE_TAC[] +THEN ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[] +THEN MRESAL1_TAC REAL_CONTINUOUS_WITHIN_ACS_STRONG`delta_x4 v01 v02 v03 v23 v13 v12 / + sqrt (ups_x v01 v02 v12 * ups_x v01 v03 v13)`[REAL_CONTINUOUS_CONTINUOUS_WITHINREAL;CONTINUOUS_WITHIN_SEQUENTIALLY] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`lift o(\n:num. + (delta_x4 (v01n n) (v02n n) (v03n n) (v23n n) (v13n n) (v12n n) / + sqrt + (ups_x (v01n n) (v02n n) (v12n n) * ups_x (v01n n) (v03n n) (v13n n))))`[o_DEF;LIFT_DROP]) +THEN POP_ASSUM MATCH_MP_TAC +THEN STRIP_TAC; +REWRITE_TAC[ IN_ELIM_THM;IMAGE] +THEN GEN_TAC +THEN EXISTS_TAC`delta_x4 (v01n n) (v02n n) (v03n n) (v23n n) (v13n n) (v12n n) / + sqrt + (ups_x (v01n n) (v02n n) (v12n n) * ups_x (v01n n) (v03n n) (v13n (n:num)))` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC (GEN_ALL Trigonometry2.PROVE_DELTA_OVER_SQRT_2UPS)[`(f (n:num)):real^3`;`(h (n:num)):real^3`;`(g (n:num)):real^3`;`vec 0:real^3`;`(v23n (n:num)):real`;`(v02n (n:num)):real` ;`(v12n (n:num)):real`;`(v01n (n:num)):real`;`(v03n (n:num)):real`;`(v13n (n:num)):real`] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"v01n" +THEN EXPAND_TAC"v02n" +THEN EXPAND_TAC"v03n" +THEN EXPAND_TAC"v12n" +THEN EXPAND_TAC"v23n" +THEN EXPAND_TAC"v13n" +THEN REWRITE_TAC[] +THEN REPEAT LET_TAC +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th; NORM_CAUCHY_SCHWARZ_DIV]); +REWRITE_TAC[real_div;LIFT_CMUL] +THEN MATCH_MP_TAC LIM_MUL +THEN STRIP_TAC; +REWRITE_TAC[o_DEF;delta_x4;LIFT_SUB;LIFT_ADD;LIFT_CMUL] +THEN MATCH_MP_TAC LIM_ADD +THEN STRIP_TAC; +MATCH_MP_TAC LIM_SUB +THEN STRIP_TAC; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[o_DEF] +THEN EXPAND_TAC"v01n" +THEN EXPAND_TAC"v02n" +THEN EXPAND_TAC"v03n" +THEN EXPAND_TAC"v12n" +THEN EXPAND_TAC"v23n" +THEN EXPAND_TAC"v13n" +THEN EXPAND_TAC"v01" +THEN EXPAND_TAC"v02" +THEN EXPAND_TAC"v03" +THEN EXPAND_TAC"v12" +THEN EXPAND_TAC"v23" +THEN EXPAND_TAC"v13" +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG;LIFT_NEG;REAL_ARITH`A pow 2= A * A`;LIFT_CMUL] +THEN STRIP_TAC; +MATCH_MP_TAC LIM_NEG +THEN MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`b:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`c:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[o_DEF] +THEN EXPAND_TAC"v01n" +THEN EXPAND_TAC"v02n" +THEN EXPAND_TAC"v03n" +THEN EXPAND_TAC"v12n" +THEN EXPAND_TAC"v23n" +THEN EXPAND_TAC"v13n" +THEN EXPAND_TAC"v01" +THEN EXPAND_TAC"v02" +THEN EXPAND_TAC"v03" +THEN EXPAND_TAC"v12" +THEN EXPAND_TAC"v23" +THEN EXPAND_TAC"v13" +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG;LIFT_NEG;REAL_ARITH`A pow 2= A * A`;LIFT_CMUL] +THEN STRIP_TAC; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`b-c:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC LIM_SUB +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_ADD +THEN STRIP_TAC; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN EXPAND_TAC"v01n" +THEN EXPAND_TAC"v02n" +THEN EXPAND_TAC"v03n" +THEN EXPAND_TAC"v12n" +THEN EXPAND_TAC"v23n" +THEN EXPAND_TAC"v13n" +THEN EXPAND_TAC"v01" +THEN EXPAND_TAC"v02" +THEN EXPAND_TAC"v03" +THEN EXPAND_TAC"v12" +THEN EXPAND_TAC"v23" +THEN EXPAND_TAC"v13" +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG;LIFT_NEG;REAL_ARITH`A pow 2= A * A`;LIFT_CMUL] +THEN STRIP_TAC; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`b:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a-c:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC LIM_SUB +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_ADD +THEN STRIP_TAC; +MATCH_MP_TAC LIM_SUB +THEN STRIP_TAC; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN EXPAND_TAC"v01n" +THEN EXPAND_TAC"v02n" +THEN EXPAND_TAC"v03n" +THEN EXPAND_TAC"v12n" +THEN EXPAND_TAC"v23n" +THEN EXPAND_TAC"v13n" +THEN EXPAND_TAC"v01" +THEN EXPAND_TAC"v02" +THEN EXPAND_TAC"v03" +THEN EXPAND_TAC"v12" +THEN EXPAND_TAC"v23" +THEN EXPAND_TAC"v13" +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG;LIFT_NEG;REAL_ARITH`A pow 2= A * A`;LIFT_CMUL] +THEN STRIP_TAC; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`c:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a-b:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC LIM_SUB +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN EXPAND_TAC"v01n" +THEN EXPAND_TAC"v02n" +THEN EXPAND_TAC"v03n" +THEN EXPAND_TAC"v12n" +THEN EXPAND_TAC"v23n" +THEN EXPAND_TAC"v13n" +THEN EXPAND_TAC"v01" +THEN EXPAND_TAC"v02" +THEN EXPAND_TAC"v03" +THEN EXPAND_TAC"v12" +THEN EXPAND_TAC"v23" +THEN EXPAND_TAC"v13" +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG;LIFT_NEG;REAL_ARITH`A pow 2= A * A`;LIFT_CMUL] +THEN STRIP_TAC; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a-c:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC LIM_SUB +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a-b:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC LIM_SUB +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN EXPAND_TAC"v01n" +THEN EXPAND_TAC"v02n" +THEN EXPAND_TAC"v03n" +THEN EXPAND_TAC"v12n" +THEN EXPAND_TAC"v23n" +THEN EXPAND_TAC"v13n" +THEN EXPAND_TAC"v01" +THEN EXPAND_TAC"v02" +THEN EXPAND_TAC"v03" +THEN EXPAND_TAC"v12" +THEN EXPAND_TAC"v23" +THEN EXPAND_TAC"v13" +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG;LIFT_NEG;REAL_ARITH`A pow 2= A * A`;LIFT_CMUL] +THEN STRIP_TAC; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_ADD +THEN STRIP_TAC; +MATCH_MP_TAC LIM_NEG +THEN MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_ADD +THEN STRIP_TAC; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`b:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_ADD +THEN STRIP_TAC; +MATCH_MP_TAC LIM_SUB +THEN STRIP_TAC; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`c:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`b-c:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC LIM_SUB +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_ADD +THEN STRIP_TAC; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a-c:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC LIM_SUB +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a-b:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC LIM_SUB +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MRESAL_TAC LIM_INV [`sequentially`;`(\x:num. + (sqrt + (ups_x (v01n x) (v02n x) (v12n x) * ups_x (v01n x) (v03n x) (v13n x))))`;`sqrt (ups_x v01 v02 v12 * ups_x v01 v03 v13)`][o_DEF] +THEN POP_ASSUM MATCH_MP_TAC +THEN SUBGOAL_THEN `&0< ups_x v01 v02 v12 * ups_x v01 v03 v13` ASSUME_TAC; +MATCH_MP_TAC REAL_LT_MUL +THEN MRESA_TAC (GEN_ALL Trigonometry2.NOT_COLLINEAR_IMP_UPS_LT)[`b:real^3`;`vec 0 :real^3`;`a:real^3`] +THEN POP_ASSUM MP_TAC +THEN REPEAT LET_TAC +THEN MRESA_TAC (GEN_ALL Trigonometry2.NOT_COLLINEAR_IMP_UPS_LT)[`c:real^3`;`vec 0 :real^3`;`a:real^3`] +THEN POP_ASSUM MP_TAC +THEN REPEAT LET_TAC +THEN REAL_ARITH_TAC; +MRESA1_TAC SQRT_POS_LT`ups_x v01 v02 v12 * ups_x v01 v03 v13` +THEN MP_TAC(REAL_ARITH` +&0< sqrt (ups_x v01 v02 v12 * ups_x v01 v03 v13) +==> ~(sqrt (ups_x v01 v02 v12 * ups_x v01 v03 v13) = &0)`) +THEN RESA_TAC +THEN MRESAL1_TAC CONTINUOUS_AT_SQRT`lift(ups_x v01 v02 v12 * ups_x v01 v03 (v13:real))`[CONTINUOUS_AT_SEQUENTIALLY;o_DEF;LIFT_DROP] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(\x:num. lift + ( (ups_x (v01n x) (v02n x) (v12n x) * ups_x (v01n x) (v03n x) (v13n x))))`[LIFT_DROP]) +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[LIFT_CMUL] +THEN MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[ups_x;o_DEF;LIFT_ADD;LIFT_SUB;LIFT_CMUL] +THEN STRIP_TAC; +MATCH_MP_TAC LIM_ADD +THEN STRIP_TAC; +MATCH_MP_TAC LIM_SUB +THEN STRIP_TAC; +MATCH_MP_TAC LIM_SUB +THEN STRIP_TAC; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN EXPAND_TAC"v01n" +THEN EXPAND_TAC"v02n" +THEN EXPAND_TAC"v03n" +THEN EXPAND_TAC"v12n" +THEN EXPAND_TAC"v23n" +THEN EXPAND_TAC"v13n" +THEN EXPAND_TAC"v01" +THEN EXPAND_TAC"v02" +THEN EXPAND_TAC"v03" +THEN EXPAND_TAC"v12" +THEN EXPAND_TAC"v23" +THEN EXPAND_TAC"v13" +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG;LIFT_NEG;REAL_ARITH`A pow 2= A * A`;LIFT_CMUL] +THEN STRIP_TAC; +MATCH_MP_TAC LIM_NEG +THEN MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN EXPAND_TAC"v01n" +THEN EXPAND_TAC"v02n" +THEN EXPAND_TAC"v03n" +THEN EXPAND_TAC"v12n" +THEN EXPAND_TAC"v23n" +THEN EXPAND_TAC"v13n" +THEN EXPAND_TAC"v01" +THEN EXPAND_TAC"v02" +THEN EXPAND_TAC"v03" +THEN EXPAND_TAC"v12" +THEN EXPAND_TAC"v23" +THEN EXPAND_TAC"v13" +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG;LIFT_NEG;REAL_ARITH`A pow 2= A * A`;LIFT_CMUL] +THEN MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`b:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN EXPAND_TAC"v01n" +THEN EXPAND_TAC"v02n" +THEN EXPAND_TAC"v03n" +THEN EXPAND_TAC"v12n" +THEN EXPAND_TAC"v23n" +THEN EXPAND_TAC"v13n" +THEN EXPAND_TAC"v01" +THEN EXPAND_TAC"v02" +THEN EXPAND_TAC"v03" +THEN EXPAND_TAC"v12" +THEN EXPAND_TAC"v23" +THEN EXPAND_TAC"v13" +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG;LIFT_NEG;REAL_ARITH`A pow 2= A * A`;LIFT_CMUL] +THEN MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a-b:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC LIM_SUB +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_ADD +THEN STRIP_TAC; +MATCH_MP_TAC LIM_CMUL +THEN MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN EXPAND_TAC"v01n" +THEN EXPAND_TAC"v02n" +THEN EXPAND_TAC"v03n" +THEN EXPAND_TAC"v12n" +THEN EXPAND_TAC"v23n" +THEN EXPAND_TAC"v13n" +THEN EXPAND_TAC"v01" +THEN EXPAND_TAC"v02" +THEN EXPAND_TAC"v03" +THEN EXPAND_TAC"v12" +THEN EXPAND_TAC"v23" +THEN EXPAND_TAC"v13" +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG;LIFT_NEG;REAL_ARITH`A pow 2= A * A`;LIFT_CMUL] +THEN STRIP_TAC; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a-b:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC LIM_SUB +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_ADD +THEN STRIP_TAC; +MATCH_MP_TAC LIM_CMUL +THEN MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN EXPAND_TAC"v01n" +THEN EXPAND_TAC"v02n" +THEN EXPAND_TAC"v03n" +THEN EXPAND_TAC"v12n" +THEN EXPAND_TAC"v23n" +THEN EXPAND_TAC"v13n" +THEN EXPAND_TAC"v01" +THEN EXPAND_TAC"v02" +THEN EXPAND_TAC"v03" +THEN EXPAND_TAC"v12" +THEN EXPAND_TAC"v23" +THEN EXPAND_TAC"v13" +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG;LIFT_NEG;REAL_ARITH`A pow 2= A * A`;LIFT_CMUL] +THEN STRIP_TAC; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`b:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_CMUL +THEN MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN EXPAND_TAC"v01n" +THEN EXPAND_TAC"v02n" +THEN EXPAND_TAC"v03n" +THEN EXPAND_TAC"v12n" +THEN EXPAND_TAC"v23n" +THEN EXPAND_TAC"v13n" +THEN EXPAND_TAC"v01" +THEN EXPAND_TAC"v02" +THEN EXPAND_TAC"v03" +THEN EXPAND_TAC"v12" +THEN EXPAND_TAC"v23" +THEN EXPAND_TAC"v13" +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG;LIFT_NEG;REAL_ARITH`A pow 2= A * A`;LIFT_CMUL] +THEN STRIP_TAC; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`b:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a-b:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC LIM_SUB +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_ADD +THEN STRIP_TAC; +MATCH_MP_TAC LIM_SUB +THEN STRIP_TAC; +MATCH_MP_TAC LIM_SUB +THEN STRIP_TAC; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN EXPAND_TAC"v01n" +THEN EXPAND_TAC"v02n" +THEN EXPAND_TAC"v03n" +THEN EXPAND_TAC"v12n" +THEN EXPAND_TAC"v23n" +THEN EXPAND_TAC"v13n" +THEN EXPAND_TAC"v01" +THEN EXPAND_TAC"v02" +THEN EXPAND_TAC"v03" +THEN EXPAND_TAC"v12" +THEN EXPAND_TAC"v23" +THEN EXPAND_TAC"v13" +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG;LIFT_NEG;REAL_ARITH`A pow 2= A * A`;LIFT_CMUL] +THEN STRIP_TAC; +MATCH_MP_TAC LIM_NEG +THEN MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN EXPAND_TAC"v01n" +THEN EXPAND_TAC"v02n" +THEN EXPAND_TAC"v03n" +THEN EXPAND_TAC"v12n" +THEN EXPAND_TAC"v23n" +THEN EXPAND_TAC"v13n" +THEN EXPAND_TAC"v01" +THEN EXPAND_TAC"v02" +THEN EXPAND_TAC"v03" +THEN EXPAND_TAC"v12" +THEN EXPAND_TAC"v23" +THEN EXPAND_TAC"v13" +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG;LIFT_NEG;REAL_ARITH`A pow 2= A * A`;LIFT_CMUL] +THEN MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`c:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN EXPAND_TAC"v01n" +THEN EXPAND_TAC"v02n" +THEN EXPAND_TAC"v03n" +THEN EXPAND_TAC"v12n" +THEN EXPAND_TAC"v23n" +THEN EXPAND_TAC"v13n" +THEN EXPAND_TAC"v01" +THEN EXPAND_TAC"v02" +THEN EXPAND_TAC"v03" +THEN EXPAND_TAC"v12" +THEN EXPAND_TAC"v23" +THEN EXPAND_TAC"v13" +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG;LIFT_NEG;REAL_ARITH`A pow 2= A * A`;LIFT_CMUL] +THEN MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a-c:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC LIM_SUB +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_ADD +THEN STRIP_TAC; +MATCH_MP_TAC LIM_CMUL +THEN MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN EXPAND_TAC"v01n" +THEN EXPAND_TAC"v02n" +THEN EXPAND_TAC"v03n" +THEN EXPAND_TAC"v12n" +THEN EXPAND_TAC"v23n" +THEN EXPAND_TAC"v13n" +THEN EXPAND_TAC"v01" +THEN EXPAND_TAC"v02" +THEN EXPAND_TAC"v03" +THEN EXPAND_TAC"v12" +THEN EXPAND_TAC"v23" +THEN EXPAND_TAC"v13" +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG;LIFT_NEG;REAL_ARITH`A pow 2= A * A`;LIFT_CMUL] +THEN STRIP_TAC; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a-c:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC LIM_SUB +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_ADD +THEN STRIP_TAC; +MATCH_MP_TAC LIM_CMUL +THEN MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN EXPAND_TAC"v01n" +THEN EXPAND_TAC"v02n" +THEN EXPAND_TAC"v03n" +THEN EXPAND_TAC"v12n" +THEN EXPAND_TAC"v23n" +THEN EXPAND_TAC"v13n" +THEN EXPAND_TAC"v01" +THEN EXPAND_TAC"v02" +THEN EXPAND_TAC"v03" +THEN EXPAND_TAC"v12" +THEN EXPAND_TAC"v23" +THEN EXPAND_TAC"v13" +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG;LIFT_NEG;REAL_ARITH`A pow 2= A * A`;LIFT_CMUL] +THEN STRIP_TAC; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`c:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_CMUL +THEN MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN EXPAND_TAC"v01n" +THEN EXPAND_TAC"v02n" +THEN EXPAND_TAC"v03n" +THEN EXPAND_TAC"v12n" +THEN EXPAND_TAC"v23n" +THEN EXPAND_TAC"v13n" +THEN EXPAND_TAC"v01" +THEN EXPAND_TAC"v02" +THEN EXPAND_TAC"v03" +THEN EXPAND_TAC"v12" +THEN EXPAND_TAC"v23" +THEN EXPAND_TAC"v13" +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG;LIFT_NEG;REAL_ARITH`A pow 2= A * A`;LIFT_CMUL] +THEN STRIP_TAC; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`c:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]; +MATCH_MP_TAC LIM_MUL +THEN REWRITE_TAC[LIM_NULL_NORM;o_DEF] +THEN MRESA1_TAC CONTINUOUS_AT_LIFT_NORM`a-c:real^3` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[CONTINUOUS_AT_SEQUENTIALLY;o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC LIM_SUB +THEN ASM_TAC +THEN REWRITE_TAC[ETA_AX] +THEN SET_TAC[]]);; + +let COLLINEAR_B_SY=prove(`!s:stable_sy l:real^(M,3)finite_product. +k_sy s =k /\ dimindex(:M) =k/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ 2 ~collinear{vec 0, row i (vecmats l),row (SUC (i MOD k_sy s)) (vecmats l)}`, +REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;convex_local_fan;local_fan] +THEN LET_TAC +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`i:num`;`row i (vecmats (l:real^(M,3)finite_product))`;`row (SUC (i MOD k_sy s)) (vecmats (l:real^(M,3)finite_product))`;`(l:real^(M,3)finite_product)`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`row (SUC (i MOD k_sy s)) (vecmats (l:real^(M,3)finite_product))`;`row i (vecmats (l:real^(M,3)finite_product))`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECMATS_MATVEC_ID] +THEN RESA_TAC);; + + + +let COLLINEAR_AZIM_CYCLE_B_SY=prove(`!s:stable_sy l:real^(M,3)finite_product. +k_sy s =k /\ dimindex(:M) =k/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ 2 ~collinear{vec 0, row i (vecmats l), +azim_cycle (EE (row i (vecmats l)) (E_SY (vecmats l))) + (vec 0) + (row i (vecmats l)) + (row (SUC (i MOD k_sy s)) (vecmats l))}`, +REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;convex_local_fan;local_fan] +THEN LET_TAC +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`i:num`;`row i (vecmats (l:real^(M,3)finite_product))`;`row (SUC (i MOD k_sy s)) (vecmats (l:real^(M,3)finite_product))`;`(l:real^(M,3)finite_product)`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`row (SUC (i MOD k_sy s)) (vecmats (l:real^(M,3)finite_product))`;`row i (vecmats (l:real^(M,3)finite_product))`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECMATS_MATVEC_ID] +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL Wrgcvdr_cizmrrh.AZIM_CYCLE_EQ_SIGMA_FAN)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`row i (vecmats (l:real^(M,3)finite_product))`;`row (SUC (i MOD k_sy s)) (vecmats (l:real^(M,3)finite_product))`][VECMATS_MATVEC_ID] +THEN MRESAL_TAC Fan.sigma_fan_in_set_of_edge[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`row i (vecmats (l:real^(M,3)finite_product))`;`row (SUC (i MOD k_sy s)) (vecmats (l:real^(M,3)finite_product))`][VECMATS_MATVEC_ID] +THEN MRESAL_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY v') (E_SY v') (row i v') + (row (SUC (i MOD k)) (v':real^3^M))`;`row i (vecmats (l:real^(M,3)finite_product))`][VECMATS_MATVEC_ID] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC);; + + +let AZIM_EQ_DIHV_IN_B_SY=prove(`!s:stable_sy l:real^(M,3)finite_product i. +k_sy s =k /\ dimindex(:M) =k/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ 2 azim (vec 0) u v w= dihV (vec 0) u v w`, +REPEAT STRIP_TAC +THEN ASM_TAC +THEN DISCH_THEN(LABEL_TAC"THYGIANG") +THEN REPEAT STRIP_TAC +THEN POP_ASSUM( fun th-> ASSUME_TAC th THEN MP_TAC th THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;CONDITION1_SY] THEN STRIP_TAC) +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v':real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN DISCH_THEN(LABEL_TAC"THY2") +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th +THEN REWRITE_TAC[convex_local_fan] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th1-> MP_TAC th1 +THEN REWRITE_TAC[local_fan] +THEN LET_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th2-> ASSUME_TAC (SYM th2)) +THEN STRIP_TAC +THEN ASSUME_TAC th1) +THEN DISCH_THEN(LABEL_TAC"THY1") +THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN REMOVE_THEN"THYGIANG"(fun th-> SUBST_ALL_TAC(th) THEN ASSUME_TAC th) +THEN MRESA_TAC (GEN_ALL EDGE_IN_F_SY)[`i:num`;`u:real^3`;`v:real^3`;`l:real^(M,3)finite_product`] +THEN REMOVE_THEN"THY1"(fun th-> MRESA1_TAC th`u:real^3,v:real^3`) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_DETERMINE_AZIM_IN_FA)[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`((u,v):real^3#real^3)`] +THEN MRESA_TAC( GEN_ALL COLLINEAR_B_SY)[`k:num`;`i:num`;`s:stable_sy`;`l:real^(M,3)finite_product`] +THEN MRESA_TAC( GEN_ALL COLLINEAR_AZIM_CYCLE_B_SY)[`k:num`;`i:num`;`s:stable_sy`;`l:real^(M,3)finite_product`] +THEN MATCH_MP_TAC Local_lemmas.AZIM_LE_PI_EQ_DIHV +THEN ASM_REWRITE_TAC[]);; + + +let CONTINUOUS_ON_RHO_FUN_AND_AZIM=prove_by_refinement(`!s:stable_sy . +k_sy s =k /\ dimindex(:M) =k/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ 2 lift o(\x:real^(M,3)finite_product. sum (1..k_sy s) + (\i. rho_fun (norm (row i (vecmats x))) * azim_in_fan (row i (vecmats x), row (SUC (i MOD (k_sy s))) (vecmats x)) (E_SY (vecmats x)))) +continuous_on + B_SY1 (a_sy s) (b_sy s)`, +[REPEAT STRIP_TAC +THEN SIMP_TAC[o_DEF;LIFT_SUM;FINITE_NUMSEG] +THEN MATCH_MP_TAC CONTINUOUS_ON_VSUM +THEN SIMP_TAC[o_DEF;LIFT_CMUL;FINITE_NUMSEG] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC CONTINUOUS_ON_MUL +THEN STRIP_TAC; +REWRITE_TAC[rho_fun;o_DEF;LIFT_ADD] +THEN MATCH_MP_TAC CONTINUOUS_ON_ADD +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB] +THEN MATCH_MP_TAC CONTINUOUS_ON_CMUL +THEN MATCH_MP_TAC CONTINUOUS_ON_CMUL +THEN MATCH_MP_TAC CONTINUOUS_ON_CMUL +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;] +THEN MATCH_MP_TAC CONTINUOUS_ON_LIFT_NORM_COMPOSE +THEN MATCH_MP_TAC CONTINUOUS_ON_ROW +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_NUMSEG]; +MATCH_MP_TAC CONTINUOUS_ON_SAME_DOMAIN +THEN EXISTS_TAC`(\y:real^(M,3)finite_product. lift(azim (vec 0) (row x (vecmats y)) (row (SUC (x MOD k_sy s)) (vecmats y)) + (azim_cycle (EE (row x (vecmats y)) (E_SY(vecmats y))) (vec 0) (row x (vecmats y)) (row (SUC (x MOD k_sy s)) (vecmats y)))))` +THEN STRIP_TAC; +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_NUMSEG;IN_ELIM_THM;B_SY1;CONDITION2_SY;convex_local_fan] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL EDGE_IN_F_SY)[`x:num`;`row x (v:real^3^M)`;`row (SUC (x MOD k)) (v:real^3^M)`;`(matvec v):real^(M,3)finite_product`][VECMATS_MATVEC_ID] +THEN MRESAL_TAC (GEN_ALL Local_lemmas.LOFA_DETERMINE_AZIM_IN_FA)[`V_SY ((v:real^3^M) )`;`F_SY ((v:real^3^M))`;`E_SY ( (v:real^3^M))`;`row x (v:real^3^M), + row (SUC (x MOD dimindex (:M))) v`][VECMATS_MATVEC_ID;]; +REWRITE_TAC[CONTINUOUS_ON_SEQUENTIALLY;o_DEF] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THYGIANG1") +THEN DISCH_THEN(LABEL_TAC"THYGIANG") +THEN STRIP_TAC +THEN ABBREV_TAC`u=(azim_cycle (EE (row x (vecmats a)) (E_SY (vecmats a))) (vec 0) + (row x (vecmats a)) + (row (SUC (x MOD k_sy s)) (vecmats (a:real^(M,3)finite_product))))` +THEN ABBREV_TAC`v= row x (vecmats (a:real^(M,3)finite_product))` +THEN ABBREV_TAC`w=row (SUC (x MOD k_sy s)) (vecmats (a:real^(M,3)finite_product))` +THEN ABBREV_TAC`wn=(\n:num. row (SUC (x MOD k_sy s)) (vecmats ((x':num->real^(M,3)finite_product) n)))` +THEN ABBREV_TAC`vn=(\n. row x (vecmats ((x':num->real^(M,3)finite_product)n)))` +THEN ABBREV_TAC`un=(\n. azim_cycle (EE (row x (vecmats ((x':num->real^(M,3)finite_product)n)))(E_SY (vecmats ((x':num->real^(M,3)finite_product)n)))) (vec 0) (row x (vecmats ((x':num->real^(M,3)finite_product)n))) (row (SUC (x MOD k_sy s)) (vecmats ((x':num->real^(M,3)finite_product) n))))` +THEN SUBGOAL_THEN`!n:num. ~collinear{vec 0:real^3, vn n, wn n} /\ ~collinear{vec 0, vn n, un n}` ASSUME_TAC; +STRIP_TAC +THEN EXPAND_TAC"wn" +THEN EXPAND_TAC"vn" +THEN EXPAND_TAC"un" +THEN REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC`x IN 1..k_sy (s:stable_sy)` +THEN REWRITE_TAC[IN_NUMSEG] +THEN RESA_TAC +THEN MRESA_TAC( GEN_ALL COLLINEAR_B_SY)[`k:num`;`x:num`;`s:stable_sy`;`(x':num->real^(M,3)finite_product) n`] +THEN MRESA_TAC( GEN_ALL COLLINEAR_AZIM_CYCLE_B_SY)[`k:num`;`x:num`;`s:stable_sy`;`(x':num->real^(M,3)finite_product) n`]; +POP_ASSUM MP_TAC +THEN EXPAND_TAC"vn" +THEN EXPAND_TAC"wn" +THEN EXPAND_TAC"un" +THEN REWRITE_TAC[] +THEN +SUBGOAL_THEN`(\x1. lift + (azim (vec 0) (row x (vecmats (x' x1))) + (row (SUC (x MOD k_sy s)) (vecmats (x' x1))) + (azim_cycle (EE (row x (vecmats (x' x1))) (E_SY (vecmats (x' x1)))) + (vec 0) + (row x (vecmats (x' x1))) + (row (SUC (x MOD k_sy s)) (vecmats (x' x1)))))) += lift o(\x1. + (dihV (vec 0) (row x (vecmats (x' x1))) + (row (SUC (x MOD k_sy s)) (vecmats (x' x1))) + (azim_cycle (EE (row x (vecmats (x' x1))) (E_SY (vecmats (x' x1)))) + (vec 0) + (row x (vecmats (x' x1))) + (row (SUC (x MOD k_sy s)) (vecmats ((x':num->real^(M,3)finite_product) x1)))))) +`ASSUME_TAC; +REWRITE_TAC[FUN_EQ_THM;LIFT_EQ; o_DEF] +THEN GEN_TAC +THEN MATCH_MP_TAC AZIM_EQ_DIHV_IN_B_SY +THEN EXISTS_TAC`s:stable_sy` +THEN EXISTS_TAC`(x':num->real^(M,3)finite_product)x''` +THEN EXISTS_TAC`x:num` +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC`x IN 1..k_sy (s:stable_sy)` +THEN REWRITE_TAC[IN_NUMSEG] +THEN RESA_TAC; +POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`x IN 1..k_sy (s:stable_sy)` +THEN REWRITE_TAC[IN_NUMSEG] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL AZIM_EQ_DIHV_IN_B_SY)[`k:num`;`v:real^3`;`w:real^3`;`u:real^3`;`s:stable_sy`;`a:real^(M,3)finite_product`;`x:num`] +THEN RESA_TAC +THEN MATCH_MP_TAC SEQUENTIALLY_DIVH +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC( GEN_ALL COLLINEAR_B_SY)[`k:num`;`x:num`;`s:stable_sy`;`a:real^(M,3)finite_product`] +THEN MRESA_TAC( GEN_ALL COLLINEAR_AZIM_CYCLE_B_SY)[`k:num`;`x:num`;`s:stable_sy`;`a:real^(M,3)finite_product`] +THEN SUBGOAL_THEN`1 <= SUC (x MOD dimindex (:M)) /\ + SUC (x MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`x:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL LIM_VECMAT)[`(\n:num. vecmats ((x':num->real^(M,3)finite_product) n))`;`vecmats(a:real^(M,3)finite_product)`][MATVEC_VECMATS_ID;ETA_AX] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x:num` THEN MRESA1_TAC th`(SUC (x MOD k))` THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"THY")) +THEN EXPAND_TAC"w" +THEN FIND_ASSUM (fun th-> REWRITE_TAC[th])`k_sy (s:stable_sy)=k` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`1<= x ==> x=1 \/ 1real^(M,3)finite_product) x1)))` ASSUME_TAC; +REWRITE_TAC[FUN_EQ_THM] +THEN GEN_TAC +THEN MRESAL_TAC MOD_MULT[`dimindex (:M)`;`1`][ARITH_RULE`k*1=k`;ARITH_RULE`SUC 0=1`;DIMINDEX_NONZERO] +THEN MRESA_TAC MOD_LT[`1:num`;`dimindex (:M)`] +THEN MP_TAC(ARITH_RULE`2 1< k /\ 1<=k`) +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL AZIM_CYCLE_EQ1)[`k:num`;`(row 1 (vecmats ((x':num->real^(M,3)finite_product) x'')))`;`(row (SUC (1 MOD k)) (vecmats ((x':num->real^(M,3)finite_product) x'')))`;`row k (vecmats ((x':num->real^(M,3)finite_product) x''))`;`(x':num->real^(M,3)finite_product) x''`][ARITH_RULE`SUC 0=1`] +THEN POP_ASSUM MATCH_MP_TAC +THEN REMOVE_THEN "THYGIANG"(fun th-> MRESA1_TAC th`x'':num` ) +THEN POP_ASSUM (fun th-> MP_TAC th +THEN REWRITE_TAC[IN_ELIM_THM;B_SY1;CONDITION2_SY;convex_local_fan;local_fan] +THEN LET_TAC +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECMATS_MATVEC_ID] +THEN ASSUME_TAC th) +THEN STRIP_TAC; +ARITH_TAC; +MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`(x':num->real^(M,3)finite_product) x''`][IN_NUMSEG;VECMATS_MATVEC_ID] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; +POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN EXPAND_TAC"u" +THEN EXPAND_TAC"v" +THEN EXPAND_TAC"w" +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN SUBGOAL_THEN`azim_cycle (EE (row 1 (vecmats a)) (E_SY (vecmats a))) + (vec 0) + (row 1 (vecmats a)) + (row (SUC (1 MOD k)) (vecmats a)) += row k (vecmats ((a:real^(M,3)finite_product) ))` ASSUME_TAC; +MRESAL_TAC MOD_MULT[`dimindex (:M)`;`1`][ARITH_RULE`k*1=k`;ARITH_RULE`SUC 0=1`;DIMINDEX_NONZERO] +THEN MRESA_TAC MOD_LT[`1:num`;`dimindex (:M)`] +THEN MP_TAC(ARITH_RULE`2 1< k /\ 1<=k`) +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL AZIM_CYCLE_EQ1)[`k:num`;`(row 1 (vecmats ((a:real^(M,3)finite_product) )))`;`(row (SUC (1 MOD k)) (vecmats ((a:real^(M,3)finite_product))))`;`row k (vecmats ((a:real^(M,3)finite_product) ))`;`(a:real^(M,3)finite_product)`][ARITH_RULE`SUC 0=1`] +THEN POP_ASSUM MATCH_MP_TAC +THEN REMOVE_THEN "THYGIANG1"(fun th-> MP_TAC th +THEN REWRITE_TAC[IN_ELIM_THM;B_SY1;CONDITION2_SY;convex_local_fan;local_fan] +THEN LET_TAC +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECMATS_MATVEC_ID] +THEN ASSUME_TAC th) +THEN STRIP_TAC; +ARITH_TAC; +MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`(a:real^(M,3)finite_product) `][IN_NUMSEG;VECMATS_MATVEC_ID] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; +POP_ASSUM(fun th-> ASM_REWRITE_TAC[th]) +THEN REMOVE_THEN"THY"(fun th-> MRESA1_TAC th`k:num`) +THEN POP_ASSUM MATCH_MP_TAC +THEN MP_TAC(ARITH_RULE`2 1< k /\ 1<=k`) +THEN RESA_TAC +THEN ARITH_TAC; +SUBGOAL_THEN`(\x1. azim_cycle (EE (row x (vecmats (x' x1))) (E_SY (vecmats (x' x1)))) + (vec 0) + (row x (vecmats (x' x1))) + (row (SUC (x MOD k)) (vecmats (x' x1)))) += (\x1. row (x-1) (vecmats ((x':num->real^(M,3)finite_product) x1)))` ASSUME_TAC; +REWRITE_TAC[FUN_EQ_THM] +THEN GEN_TAC +THEN MRESAL_TAC (GEN_ALL AZIM_CYCLE_EQ1)[`x-1:num`;`(row x (vecmats ((x':num->real^(M,3)finite_product) x'')))`;`(row (SUC (x MOD k)) (vecmats ((x':num->real^(M,3)finite_product) x'')))`;`row (x-1) (vecmats ((x':num->real^(M,3)finite_product) x''))`;`(x':num->real^(M,3)finite_product) x''`][ARITH_RULE`SUC 0=1`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MP_TAC(ARITH_RULE`2 1< k /\ 1<=k /\ 1<= x-1 /\ x-1<= k/\ x-1< k`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_LT[`x-1:num`;`dimindex (:M):num`][ARITH_RULE`0<1`] +THEN MP_TAC(ARITH_RULE`1<= x /\ x<= dimindex (:M) ==> SUC (x-1)=x`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "THYGIANG"(fun th-> MRESA1_TAC th`x'':num` ) +THEN POP_ASSUM (fun th-> MP_TAC th +THEN REWRITE_TAC[IN_ELIM_THM;B_SY1;CONDITION2_SY;convex_local_fan;local_fan] +THEN LET_TAC +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECMATS_MATVEC_ID] +THEN ASSUME_TAC th) +THEN MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`(x':num->real^(M,3)finite_product) x''`][IN_NUMSEG;VECMATS_MATVEC_ID] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; +POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN EXPAND_TAC"u" +THEN EXPAND_TAC"v" +THEN EXPAND_TAC"w" +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN SUBGOAL_THEN`azim_cycle (EE (row x (vecmats a)) (E_SY (vecmats a))) + (vec 0) + (row x (vecmats a)) + (row (SUC (x MOD k)) (vecmats a)) += row (x-1) (vecmats ((a:real^(M,3)finite_product) ))` ASSUME_TAC; +MRESAL_TAC (GEN_ALL AZIM_CYCLE_EQ1)[`x-1:num`;`(row x (vecmats ((a:real^(M,3)finite_product) )))`;`(row (SUC (x MOD k)) (vecmats ((a:real^(M,3)finite_product))))`;`row (x-1) (vecmats ((a:real^(M,3)finite_product) ))`;`(a:real^(M,3)finite_product)`][ARITH_RULE`SUC 0=1`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MP_TAC(ARITH_RULE`2 1< k /\ 1<=k /\ 1<= x-1 /\ x-1<= k/\ x-1< k`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_LT[`x-1:num`;`dimindex (:M):num`][ARITH_RULE`0<1`] +THEN MP_TAC(ARITH_RULE`1<= x /\ x<= dimindex (:M) ==> SUC (x-1)=x`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "THYGIANG1"(fun th-> MP_TAC th +THEN REWRITE_TAC[IN_ELIM_THM;B_SY1;CONDITION2_SY;convex_local_fan;local_fan] +THEN LET_TAC +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECMATS_MATVEC_ID] +THEN ASSUME_TAC th) +THEN MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`(a:real^(M,3)finite_product) `][IN_NUMSEG;VECMATS_MATVEC_ID] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; +FIND_ASSUM(fun th-> REWRITE_TAC[th])`k_sy (s:stable_sy)= k` +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[th]) +THEN REMOVE_THEN"THY"(fun th-> MRESA1_TAC th`x-1:num`) +THEN POP_ASSUM MATCH_MP_TAC +THEN MP_TAC(ARITH_RULE`1< x /\ x<= dimindex (:M) ==> 1<= x-1 /\ x-1<=dimindex (:M)`) +THEN RESA_TAC]);; + +let CONTINUOUS_ON_TAU_FUN=prove(`!s:stable_sy . +k_sy s =k /\ dimindex(:M) =k/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ 2 lift o(\l:real^(M,3)finite_product. tau_fun (V_SY (vecmats l)) (E_SY (vecmats l)) (F_SY (vecmats l))) continuous_on (B_SY1 (a_sy s) (b_sy s))`, +REWRITE_TAC[tau_fun; o_DEF;LIFT_SUB] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN MRESAL_TAC (GEN_ALL CONTINUOUS_ON_RHO_FUN_AND_AZIM)[`k:num`;`s:stable_sy`][o_DEF] +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC CONTINUOUS_ON_SAME_DOMAIN +THEN EXISTS_TAC`(\x:real^(M,3)finite_product. lift + (sum (1..k) + (\i. rho_fun (norm (row i (vecmats x))) * + azim_in_fan + (row i (vecmats x),row (SUC (i MOD k)) (vecmats x)) + (E_SY (vecmats x)))))` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL CHANGE_SUM_TAU_FUN)[`k:num`;`s:stable_sy`;`x:real^(M,3)finite_product`]; +MATCH_MP_TAC CONTINUOUS_ON_SAME_DOMAIN +THEN EXISTS_TAC`(\x:real^(M,3)finite_product. lift ((pi + sol0) * &(k-2 )))` +THEN REWRITE_TAC[CONTINUOUS_ON_CONST] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`2 1 1 <= i /\ i <= k /\ + 1 <= j /\ j <= k /\ + row i (vecmats x) = row j (vecmats x)`] +THEN MRESA1_TAC (GEN_ALL CARD_F_SY_EQ)`x:real^(M,3)finite_product`]);; + + +let CONTINUOUS_ON_TAU_STAR=prove(`!s:stable_sy . +k_sy s =k /\ dimindex(:M) =k/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ 2 lift o(\l:real^(M,3)finite_product. tau_star s l) continuous_on (B_SY1 (a_sy s) (b_sy s))`, +REWRITE_TAC[tau_star;o_DEF;LIFT_SUB] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN MRESAL_TAC (GEN_ALL CONTINUOUS_ON_D_FUN)[`k:num`;`s:stable_sy`][o_DEF] +THEN MRESAL_TAC (GEN_ALL CONTINUOUS_ON_TAU_FUN)[`k:num`;`s:stable_sy`][o_DEF]);; + +let MINIMUM_IN_B_SY=prove(`!s:stable_sy . +k_sy s =k /\ dimindex(:M) =k/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ 2bool) +==> ?x:real^(M,3)finite_product. x IN (B_SY1 (a_sy s) (b_sy s)) +/\ (!y:real^(M,3)finite_product. y IN (B_SY1 (a_sy s) (b_sy s)) +==> tau_star s x <= tau_star s y)`, +REPEAT STRIP_TAC +THEN MRESA_TAC CONTINUOUS_ATTAINS_INF[`(\l:real^(M,3)finite_product. tau_star (s:stable_sy) l)`;`(B_SY1 (a_sy s) (b_sy (s:stable_sy))):real^(M,3)finite_product->bool`] +THEN POP_ASSUM MATCH_MP_TAC +THEN STRIP_TAC +THENL[ +REWRITE_TAC[B_SY1] +THEN MRESA_TAC(GEN_ALL WJSCPRO) [`d_sy (s:stable_sy)`;`J_SY(s:stable_sy)`;`k:num`;`a_sy(s:stable_sy)`;`b_sy(s:stable_sy)`;] +THEN MRESA1_TAC stable_sy_lemma`s:stable_sy`; +MRESA_TAC (GEN_ALL CONTINUOUS_ON_TAU_STAR)[`k:num`;`s:stable_sy`]]);; + + +let HDPLYGY=prove(`!s:stable_sy . +k_sy s =k /\ dimindex(:M) =k/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) /\ 2bool) +==> +lift o(\l:real^(M,3)finite_product. tau_star s l) continuous_on (B_SY1 (a_sy s) (b_sy s)) +/\(?x:real^(M,3)finite_product. x IN (B_SY1 (a_sy s) (b_sy s)) +/\ (!y:real^(M,3)finite_product. y IN (B_SY1 (a_sy s) (b_sy s)) +==> tau_star s x <= tau_star s y))`, +REPEAT STRIP_TAC +THENL[ +MRESA_TAC(GEN_ALL CONTINUOUS_ON_TAU_STAR)[`k:num`;`s:stable_sy`]; +MRESA_TAC (GEN_ALL MINIMUM_IN_B_SY)[`k:num`;`s:stable_sy`]]);; + + + + + + + + + +end;; + + diff --git a/text_formalization/local/HIJQAHA.hl b/text_formalization/local/HIJQAHA.hl new file mode 100644 index 0000000..27cb76d --- /dev/null +++ b/text_formalization/local/HIJQAHA.hl @@ -0,0 +1,4373 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Hijqaha = struct + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +open Yxionxl2;; +open Eyypqdw;; +open Ocbicby;; +open Imjxphr;; +open Nuxcoea;; +open Aursipd;; +open Cuxvzoz;; +open Rrcwnsj;; +open Tfitskc;; +open Hexagons;; +open Otmtotj;; + + + +let SCS_5I1_STAB_DIAG_2h0=prove_by_refinement(`!v i j. + BBs_v39 scs_5M2 v/\ + scs_diag 5 i j /\ + dist(v i,v j) <= cstab/\ + (!i. dist(v i, v(i+1))<= &2 * h0) + ==> + BBs_v39 (scs_stab_diag_v39 scs_5I2 i j) v`, +[ +REWRITE_TAC[IN] +THEN REPEAT STRIP_TAC +THEN DICH_TAC 3 +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC th +THEN MP_TAC th) +THEN +REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_5I2;scs_5M2;CS_ADJ;scs_diag;ARITH_RULE`~(5<=3)`;IN;K_SCS_5I2;Terminal.FUNLIST_EXPLICIT;] +THEN ASM_SIMP_TAC[] +THEN REPEAT RESA_TAC +THEN SCS_TAC +THEN MP_TAC(SET_RULE`i' MOD 5= j' MOD 5\/ ~(i' MOD 5= j' MOD 5)`) +THEN RESA_TAC; + + +THAYTHE_TAC (8-6)[`i'`;`j'`]; + +MP_TAC(SET_RULE`SUC i' MOD 5= j' MOD 5\/ ~(SUC i' MOD 5= j' MOD 5)`) +THEN RESA_TAC; + + +THAYTHE_TAC (9-6)[`i'`;`j'`] +THEN DICH_TAC 1 +THEN MRESAL_TAC Hexagons.PSORT_MOD[`5`;`i'`;`j'`][ARITH_RULE`~(5=0)`] +THEN SYM_ASSUM_TAC +THEN DICH_TAC 1 +THEN STRIP_TAC +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`i'`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i' MOD 5<5==> i' MOD 5=0\/ i' MOD 5=1\/ i' MOD 5=2\/ i' MOD 5=3\/i' MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN SCS_TAC; + +MP_TAC(SET_RULE`i' MOD 5= SUC j' MOD 5\/ ~(i' MOD 5= SUC j' MOD 5)`) +THEN RESA_TAC; + +THAYTHE_TAC (10-6)[`i'`;`j'`] +THEN DICH_TAC 1 +THEN MRESAL_TAC Hexagons.PSORT_MOD[`5`;`i'`;`j'`][ARITH_RULE`~(5=0)`] +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`j'`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`j' MOD 5<5==> j' MOD 5=0\/ j' MOD 5=1\/ j' MOD 5=2\/ j' MOD 5=3\/j' MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN SCS_TAC; + +MRESA_TAC DIAG_5_EQU_PSORT[`i'`;`j'`] +THEN THAYTHE_TAC(11-6)[`i'`;`j'`] +THEN DICH_TAC 1 +THEN REWRITE_TAC[PAIR_EQ;cstab] +THEN SCS_TAC +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC; + +THAYTHE_TAC (8-6)[`i'`;`j'`] +THEN DICH_TAC 0 +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +MP_TAC(SET_RULE`SUC i' MOD 5= j' MOD 5\/ ~(SUC i' MOD 5= j' MOD 5)`) +THEN RESA_TAC; + +MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`j'`;`v`;`SUC i'`][SCS_5M2_IS_SCS;K_SCS_5M2;] +THEN REWRITE_TAC[ADD1] +THEN THAYTHE_TAC (10-2)[`i'`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +MP_TAC(SET_RULE`i' MOD 5= SUC j' MOD 5\/ ~(i' MOD 5= SUC j' MOD 5)`) +THEN RESA_TAC; + +MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`i'`;`v`;`SUC j'`][SCS_5M2_IS_SCS;K_SCS_5M2;] +THEN REWRITE_TAC[ADD1] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN THAYTHE_TAC (11-2)[`j'`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +MP_TAC(SET_RULE`psort 5 (i,j) = psort 5 (i',j')\/ ~(psort 5 (i,j) = psort 5 (i',j'))`) +THEN RESA_TAC; + +MRESA_TAC Uaghhbm.CASE_PSORT[`i`;`j'`;`j`;`i'`;`5`]; + +MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`i'`;`v`;`i`][SCS_5M2_IS_SCS;K_SCS_5M2;] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`j'`;`v`;`j`][SCS_5M2_IS_SCS;K_SCS_5M2;]; + +MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`j'`;`v`;`i`][SCS_5M2_IS_SCS;K_SCS_5M2;] +THEN MRESAL_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`i'`;`v`;`j`][SCS_5M2_IS_SCS;K_SCS_5M2;] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]; + +MRESA_TAC DIAG_5_EQU_PSORT[`i'`;`j'`] +THEN THAYTHE_TAC(12-6)[`i'`;`j'`] +THEN DICH_TAC 0 +THEN REWRITE_TAC[PAIR_EQ;cstab] +THEN SCS_TAC]);; + + + +let MM_5M2_IMP_MM_STAB_5I2=prove(` + MMs_v39 scs_5M2 v /\ + scs_diag 5 i j /\ + dist(v i,v j) <= cstab/\ + (!i. dist(v i, v(i+1))<= &2 * h0) + ==> + ~(MMs_v39 (scs_stab_diag_v39 scs_5I2 i j)= {})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_5M2` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_5M2`;`v`] +THEN ASSUME_TAC SCS_5M2_BASIC +THEN ASSUME_TAC K_SCS_5M2 +THEN ASM_SIMP_TAC[SCS_5M2_IS_SCS;STAB_5I2_SCS;K_SCS_5I2;SCS_K_D_A_STAB_EQ;IN;SCS_5I1_STAB_DIAG_2h0] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + +let SCS_5I1_STAB_DIAG_2h0_sqrt8=prove_by_refinement( +`BBs_v39 scs_5M2 v/\ + scs_diag 5 i j /\ + dist(v i,v j) <= cstab/\ + &2* h0 <= dist(v 0, v(1)) /\ dist(v 0, v(1))<= sqrt8 + ==> + BBs_v39 ((scs_stab_diag_v39 scs_5I3 i j) ) v`, +[ +REWRITE_TAC[IN] +THEN REPEAT STRIP_TAC +THEN DICH_TAC 4 +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC th +THEN MP_TAC th) +THEN +REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_5I3;scs_5M2;CS_ADJ;scs_diag;ARITH_RULE`~(5<=3)`;IN;K_SCS_5I3;scs_prop_equ_v39;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN ASM_SIMP_TAC[] +THEN REPEAT RESA_TAC +THEN SCS_TAC +THEN MP_TAC(SET_RULE`i' MOD 5= j' MOD 5\/ ~(i' MOD 5= j' MOD 5)`) +THEN RESA_TAC; + +THAYTHES_TAC (8-6)[`i':num`;`j':num`][Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(5=0)`]; + +MP_TAC(SET_RULE`SUC i' MOD 5= j' MOD 5\/ ~(SUC i' MOD 5= j' MOD 5)`) +THEN RESA_TAC; + +THAYTHE_TAC (9-6)[`i'`;`j'`] +THEN DICH_TAC 1 +THEN MRESAL_TAC Hexagons.PSORT_MOD[`5`;`i':num`;`j':num`][ARITH_RULE`~(5=0)`] +THEN SYM_ASSUM_TAC +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`i':num`;`v`;` (i') MOD 5`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`j':num`;`v`;` (j') MOD 5`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN DICH_TAC 3 +THEN STRIP_TAC +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`i'`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i' MOD 5<5==> i' MOD 5=0\/ i' MOD 5=1\/ i' MOD 5=2\/ i' MOD 5=3\/i' MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`;] +THEN RESA_TAC +THEN SCS_TAC; + + +MP_TAC(SET_RULE`i' MOD 5=SUC j' MOD 5\/ ~(i' MOD 5=SUC j' MOD 5)`) +THEN RESA_TAC; + + +THAYTHE_TAC (10-6)[`i'`;`j'`] +THEN DICH_TAC 1 +THEN MRESAL_TAC Hexagons.PSORT_MOD[`5`;`i':num`;`j':num`][ARITH_RULE`~(5=0)`] +THEN SYM_ASSUM_TAC +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`i':num`;`v`;` (i') MOD 5`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`j':num`;`v`;` (j') MOD 5`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`j'`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`j' MOD 5<5==> j' MOD 5=0\/ j' MOD 5=1\/ j' MOD 5=2\/ j' MOD 5=3\/j' MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`;] +THEN RESA_TAC +THEN SCS_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN RESA_TAC; + +MRESA_TAC DIAG_5_EQU_PSORT[`i'`;`j'`] +THEN THAYTHE_TAC(11-6)[`i'`;`j'`] +THEN DICH_TAC 1 +THEN REWRITE_TAC[PAIR_EQ;cstab;h0] +THEN SCS_TAC +THEN REAL_ARITH_TAC; + +THAYTHES_TAC (8-6)[`i':num`;`j':num`][Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(5=0)`;cstab] +THEN DICH_TAC 0 +THEN REAL_ARITH_TAC; + +MP_TAC(SET_RULE`SUC i' MOD 5= j' MOD 5\/ ~(SUC i' MOD 5= j' MOD 5)`) +THEN RESA_TAC; + +THAYTHES_TAC (9-6)[`i':num`;`j':num`][Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(5=0)`;cstab] +THEN DICH_TAC 0 +THEN MP_TAC(SET_RULE`psort 5 (i,j) = psort 5 (i',j')\/ ~(psort 5 (i,j) = psort 5 (i',j'))`) +THEN RESA_TAC; + +MRESAL_TAC Hexagons.DIAD_PSORT_IMP_DIAD[`i`;`j`;`5`;`i'`;`j'`][ARITH_RULE`~(5=0)`] +THEN DICH_TAC 0 +THEN ASM_REWRITE_TAC[scs_diag]; + +SCS_TAC +THEN MP_TAC(SET_RULE`psort 5 (i',j') = 0,1\/ ~(psort 5 (i',j') = 0,1)`) +THEN RESA_TAC; + +MRESAL_TAC Uaghhbm.CASE_PSORT[`i'`;`1`;`j'`;`0`;`5`][PSORT_5_EXPLICIT]; + +MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`i':num`;`v`;` 0`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`j':num`;`v`;` 1`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`]; + +MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`i':num`;`v`;` 1`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`j':num`;`v`;` 0`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]; + +MP_TAC(SET_RULE`i' MOD 5= SUC j' MOD 5\/ ~(i' MOD 5= SUC j' MOD 5)`) +THEN RESA_TAC; + +THAYTHES_TAC (10-6)[`i':num`;`j':num`][Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(5=0)`;cstab] +THEN DICH_TAC 0 +THEN MP_TAC(SET_RULE`psort 5 (i,j) = psort 5 (i',j')\/ ~(psort 5 (i,j) = psort 5 (i',j'))`) +THEN RESA_TAC; + +MRESAL_TAC Hexagons.DIAD_PSORT_IMP_DIAD[`i`;`j`;`5`;`i'`;`j'`][ARITH_RULE`~(5=0)`] +THEN DICH_TAC 0 +THEN ASM_REWRITE_TAC[scs_diag]; + +SCS_TAC +THEN MP_TAC(SET_RULE`psort 5 (i',j') = 0,1\/ ~(psort 5 (i',j') = 0,1)`) +THEN RESA_TAC; + +MRESAL_TAC Uaghhbm.CASE_PSORT[`i'`;`1`;`j'`;`0`;`5`][PSORT_5_EXPLICIT]; + +MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`i':num`;`v`;` 0`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`j':num`;`v`;` 1`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`]; + +MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`i':num`;`v`;` 1`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`j':num`;`v`;` 0`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]; + +MP_TAC(SET_RULE`psort 5 (i,j) = psort 5 (i',j')\/ ~(psort 5 (i,j) = psort 5 (i',j'))`) +THEN RESA_TAC; + +MRESAL_TAC Uaghhbm.CASE_PSORT[`i'`;`j`;`j'`;`i`;`5`][PSORT_5_EXPLICIT]; + +MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`i':num`;`v`;` i`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`j':num`;`v`;` j`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`]; + +MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`i':num`;`v`;` j`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`j':num`;`v`;` i`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]; + + +MRESA_TAC DIAG_5_EQU_PSORT[`i'`;`j'`] +THEN THAYTHE_TAC(13-7)[`i'`;`j'`] +THEN DICH_TAC 0 +THEN REWRITE_TAC[PAIR_EQ;cstab] +THEN SCS_TAC]);; + + + + +let SCS_5M2_EDGE_LE_2H0=prove(`BBs_v39 scs_5M2 v/\ + scs_diag 5 i j /\ + dist(v i,v j) <= cstab/\ + &2* h0 < dist(v l, v (SUC l)) +/\ ~(l MOD 5=0) + ==> F`, +REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_5I3;scs_5M2;CS_ADJ;scs_diag;ARITH_RULE`~(5<=3)`;IN;K_SCS_5I3;scs_prop_equ_v39;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN REPEAT STRIP_TAC +THEN THAYTHE_TAC 7[`l`;`SUC l`] +THEN DICH_TAC 0 +THEN SCS_TAC +THEN ASM_SIMP_TAC[Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`5`;`l:num`;`SUC l:num`][ARITH_RULE`~(5=0)`] +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`l`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`l MOD 5<5==> l MOD 5=0\/ l MOD 5=1\/ l MOD 5=2\/ l MOD 5=3\/l MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`;] +THEN RESA_TAC +THEN SCS_TAC +THEN DICH_TAC (10-7) +THEN REAL_ARITH_TAC);; + + + + + + +let SCS_5M2_EDGE_LE_2H0_IMP_0=prove( `BBs_v39 scs_5M2 v/\ + scs_diag 5 i j /\ + dist(v i,v j) <= cstab/\ + &2* h0 < dist(v l, v (SUC l)) +==> l MOD 5=0`, +STRIP_TAC +THEN MP_TAC SCS_5M2_EDGE_LE_2H0 +THEN RESA_TAC);; + + + +let MM_5M2_IMP_MM_STAB_5I3=prove(` MMs_v39 scs_5M2 v /\ + scs_diag 5 i j /\ + dist(v i,v j) <= cstab/\ + &2 * h0< dist(v l, v(l+1)) /\ + dist(v l, v(l+1))<= sqrt8 + ==> + ~(MMs_v39 (scs_stab_diag_v39 scs_5I3 i j)= {})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_5M2` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_5M2`;`v`] +THEN ASSUME_TAC SCS_5M2_BASIC +THEN ASSUME_TAC K_SCS_5M2 +THEN ASM_SIMP_TAC[SCS_5M2_IS_SCS;STAB_5I3_SCS;K_SCS_5I3;SCS_K_D_A_STAB_EQ;IN; ADD1] +THEN MP_TAC SCS_5M2_EDGE_LE_2H0_IMP_0 +THEN REWRITE_TAC[ ADD1] +THEN RESA_TAC +THEN DICH_TAC 4 +THEN DICH_TAC 4 +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`l:num`;`v`;` l MOD 5`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)/\ 0 MOD 5=0`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`l+1:num`;`v`;` (l+1) MOD 5`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)/\ 0 MOD 5=0`] +THEN MRESAL_TAC MOD_ADD_MOD[`l`;`1`;`5`][ARITH_RULE`~(5=0)/\ 1 MOD 5=1/\ 0+a=a`] THEN SYM_ASSUM_TAC +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&2 * h0 < dist ((v:num->real^3) 0,v 1) ==> &2 * h0 <= dist (v 0,v 1)`) +THEN RESA_TAC +THEN MP_TAC SCS_5I1_STAB_DIAG_2h0_sqrt8 +THEN RESA_TAC +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + +let SCS_5I1_STAB_DIAG_sqrt8=prove_by_refinement(`BBs_v39 scs_5M2 v/\ + scs_diag 5 i j /\ + dist(v i,v j) <= cstab/\ + sqrt8 <= dist(v 0, v(1)) + ==> + BBs_v39 ((scs_stab_diag_v39 scs_5M2 i j) ) v`, +[ +REWRITE_TAC[IN] +THEN REPEAT STRIP_TAC +THEN DICH_TAC 3 +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC th +THEN MP_TAC th) +THEN +REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_5I3;scs_5M2;CS_ADJ;scs_diag;ARITH_RULE`~(5<=3)`;IN;K_SCS_5I3;scs_prop_equ_v39;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN ASM_SIMP_TAC[] +THEN REPEAT RESA_TAC +THEN SCS_TAC +THEN MP_TAC(SET_RULE`i' MOD 5= j' MOD 5\/ ~(i' MOD 5= j' MOD 5)`) +THEN RESA_TAC; + +THAYTHE_TAC (8-6)[`i'`;`j'`] +THEN DICH_TAC 0 +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +MP_TAC(SET_RULE`psort 5 (i,j) = psort 5 (i',j')\/ ~(psort 5 (i,j) = psort 5 (i',j'))`) +THEN RESA_TAC; + +MRESAL_TAC Uaghhbm.CASE_PSORT[`i'`;`j`;`j'`;`i`;`5`][PSORT_5_EXPLICIT]; + + +MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`i':num`;`v`;` i`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`j':num`;`v`;` j`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`]; + +MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`i':num`;`v`;` j`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`j':num`;`v`;` i`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]; + +THAYTHE_TAC(9-6)[`i'`;`j'`] +THEN DICH_TAC 0 +THEN SCS_TAC]);; + + + + +let MM_5M2_IMP_MM_STAB_5M2=prove(` MMs_v39 scs_5M2 v /\ + scs_diag 5 i j /\ + dist(v i,v j) <= cstab/\ + sqrt8<= dist(v l, v(l+1)) + ==> + ~(MMs_v39 (scs_stab_diag_v39 scs_5M2 i j)= {})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_5M2` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_5M2`;`v`] +THEN ASSUME_TAC SCS_5M2_BASIC +THEN ASSUME_TAC K_SCS_5M2 +THEN ASM_SIMP_TAC[SCS_5M2_IS_SCS;STAB_5M2_SCS;K_SCS_5I3;SCS_K_D_A_STAB_EQ;IN; ADD1] +THEN MP_TAC SCS_5M2_EDGE_LE_2H0_IMP_0 +THEN ASM_REWRITE_TAC[ ADD1;h0] +THEN MP_TAC LT_sqrt8_2h0 +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`sqrt8 <= dist ((v:num->real^3) l,v (l + 1))/\ &2 * #1.26 < sqrt8==> &2 * #1.26 < dist (v l,v (l + 1))`) +THEN RESA_TAC +THEN STRIP_TAC +THEN DICH_TAC (9-3) +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`l:num`;`v`;` l MOD 5`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)/\ 0 MOD 5=0`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`l+1:num`;`v`;` (l+1) MOD 5`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)/\ 0 MOD 5=0`] +THEN MRESAL_TAC MOD_ADD_MOD[`l`;`1`;`5`][ARITH_RULE`~(5=0)/\ 1 MOD 5=1/\ 0+a=a`] THEN SYM_ASSUM_TAC +THEN STRIP_TAC +THEN MP_TAC SCS_5I1_STAB_DIAG_sqrt8 +THEN RESA_TAC +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + +(************) +(*new definition scs*) +(*************************) + +let SCS_DIAG_SCS_5M2_02=prove(`scs_diag (scs_k_v39 scs_5M2) 0 2`, +REWRITE_TAC[K_SCS_5M2;scs_diag] +THEN ARITH_TAC);; + +let SCS_DIAG_SCS_5M2_03=prove(`scs_diag (scs_k_v39 scs_5M2) 0 3`, +REWRITE_TAC[K_SCS_5M2;scs_diag] +THEN ARITH_TAC);; + +let SCS_DIAG_SCS_5M2_24=prove(`scs_diag (scs_k_v39 scs_5M2) 2 4`, +REWRITE_TAC[K_SCS_5M2;scs_diag] +THEN ARITH_TAC);; + + + + +let scs_5M3 = new_definition`scs_5M3 = mk_unadorned_v39 5 (#0.616) + (funlist_v39 [(0,1),(&2*h0);(0,2),(cstab);(0,3),(cstab);(1,3),(cstab);(1,4),(cstab);(2,4),(cstab)] (&2) 5) + (funlist_v39 [(0,1),cstab;(0,2),(&6); (0,3),(&6); (1,3),(&6); (1,4),(&6); (2,4),(&6)] (&2*h0) 5)`;; + + + let scs_3T4_prime = (* terminal_tri_6833979866 = *) new_definition + `scs_3T4_prime = mk_unadorned_v39 3 + (#0.2759) + (funlist_v39 [(0,1),(&2);(1,2),cstab] (&2*h0) 3) + (funlist_v39 [(0,1),(&2 * h0)] (cstab) 3)`;; + + let scs_4M6_prime = new_definition + `scs_4M6_prime = mk_unadorned_v39 4 (#0.513) + (funlist_v39 [(0,1),cstab;(0,2),(cstab);(1,3),(cstab)] (&2) 4) + (funlist_v39 [(0,1),cstab;(0,2),(&6);(1,3),(&6)] (&2*h0) 4)`;; + + +let scs_4M7_prime = new_definition + `scs_4M7_prime = mk_unadorned_v39 4 (#0.513) + (funlist_v39 [(0,1),cstab;(1,2),(&2*h0);(0,2),(cstab);(1,3),(cstab)] (&2) 4) + (funlist_v39 [(0,1),cstab;(1,2),cstab;(0,2),(&6);(1,3),(&6);(1,3),(&6)] (&2*h0) 4)`;; + + +let scs_3T1_PRELIM_prime = (* ear_jnull = *) new_definition + `scs_3T1_prime = scs_v39 (3, #0.11, + funlist_v39 [(0,1),cstab] (&2) 3, + funlist_v39 [(0,1),cstab] (&2) 3, + funlist_v39 [(0,1),cstab] (&2*h0) 3, + funlist_v39 [(0,1),cstab] ((&2)*h0) 3, + (\i j. F),{},{},{})`;; + + let scs_3T1_prime = prove_by_refinement( + `scs_3T1_prime = mk_unadorned_v39 3 (#0.11) + (funlist_v39 [(0,1),(cstab)] (&2) 3) + (funlist_v39 [(0,1),(cstab)] (&2 * h0) 3)`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[mk_unadorned_v39;scs_3T1_PRELIM_prime]); + ]);; + (* }}} *) + let scs_4M8_prime = new_definition + `scs_4M8_prime = mk_unadorned_v39 4 (#0.513) + (funlist_v39 [(0,1),(&2*h0);(2,3),(cstab);(0,2),(cstab);(1,3),(cstab)] (&2) 4) + (funlist_v39 [(0,1),cstab;(2,3),cstab;(0,2),(&6);(1,3),(&6);(1,3),(&6)] (&2*h0) 4)`;; + + + +let PSORT_5_EXPLICIT=prove(` +psort 5 (0,0)= (0,0)/\ +psort 5 (1,1)= (1,1)/\ +psort 5 (2,2)= (2,2)/\ +psort 5 (3,3)= (3,3)/\ +psort 5 (4,4)= (4,4)/\ +psort 5 (0,1)= (0,1)/\ +psort 5 (0,2)= (0,2)/\ +psort 5 (0,3)= (0,3)/\ +psort 5 (0,4)= (0,4)/\ +psort 5 (1,0)= (0,1)/\ +psort 5 (1,2)= (1,2)/\ +psort 5 (1,3)= (1,3)/\ +psort 5 (1,4)= (1,4)/\ +psort 5 (2,0)= (0,2)/\ +psort 5 (2,1)= (1,2)/\ +psort 5 (2,3)= (2,3)/\ +psort 5 (2,4)= (2,4)/\ +psort 5 (3,0)= (0,3)/\ +psort 5 (3,1)= (1,3)/\ +psort 5 (3,2)= (2,3)/\ +psort 5 (3,4)= (3,4)/\ +psort 5 (4,0)= (0,4)/\ +psort 5 (4,1)= (1,4)/\ +psort 5 (4,2)= (2,4)/\ +psort 5 (4,3)= (3,4)/\ +psort 5 (4,5)= (0,4)/\ +psort 5 (3,5)= (0,3)/\ +psort 5 (2,5)= (0,2)/\ +psort 5 (1,5)= (0,1)/\ +psort 5 (5,1)= (0,1)/\ +psort 5 (5,2)= (0,2)/\ +psort 5 (5,3)= (0,3)/\ +psort 5 (5,4)= (0,4)/\ +psort 5 (5,5)= (0,0)/\ +psort 5 (5,6)= (0,1)/\ +psort 5 (5,7)= (0,2)/\ +psort 5 (4,6)= (1,4)/\ +psort 5 (6,4)= (1,4)/\ +psort 5 (6,5)= (0,1)/\ +psort 5 (6,7)= (1,2)/\ +psort 5 (7,5)= (0,2)/\ +psort 5 (7,6)= (1,2)/\ +psort 5 (7,7)= (2,2)/\ +psort 5 (6,6)= (1,1)/\ +psort 4 (3,4)= (0,3)/\ +psort 3 (2,0)= (0,2)/\ +psort 3 (2,1)= (1,2)/\ +psort 3 (1,0)= (0,1)`, +REWRITE_TAC[psort;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_5_TAC;Uxckfpe.ARITH_4_TAC;LET_DEF;LET_END_DEF;MOD_5_EXPLICIT;ARITH_RULE`0<=a/\ ~(1<= 0)/\ ~(2<=0)/\ ~(3<=0)/\ ~(4<=0)/\a<=a/\ ~(2<=1)/\ ~(3<=2)/\ ~(4<=3)/\ ~(3<=1)/\ ~(4<=1)/\ ~(4<=2)/\ 2<=3`]);; + + +let SCS_TAC= ASM_SIMP_TAC[scs_basic;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;d_tame;REAL_ARITH`#0.712 < #0.9`;periodic;SET_RULE`{} j <=> {} i`;periodic2;scs_basic;unadorned_v39;scs_prop_equ_v39;LET_DEF;LET_END_DEF;scs_stab_diag_v39;scs_half_slice_v39; +Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_5_TAC; +scs_5M1;scs_3M1;scs_6I1;scs_3T1;scs_4M2;scs_6M1;scs_6T1;scs_5I1;scs_5I2;scs_5I3;scs_5M2;scs_4M6;scs_3T4;scs_5M3;scs_3T4_prime;scs_4M6_prime;scs_4M7_prime;scs_4M7;scs_3T1_prime;scs_4M8;scs_4M8_prime;scs_5T1;scs_3T5;scs_4M3;scs_3T6;scs_4M4;scs_4M5; +Terminal.FUNLIST_EXPLICIT;Yrtafyh.PSORT_PERIODIC;PSORT_5_EXPLICIT; +ARITH_RULE`SUC 0=1/\ SUC 1=2/\ SUC 2=3/\ SUC 3=4/\ SUC 4=5/\ SUC 5=6/\ SUC 6=7/\ SUC 7=8`];; + + + + + + + + + + + +(****************) + + +let SCS_5T1_IS_SCS=prove_by_refinement(`is_scs_v39 scs_5T1`, +[ +REWRITE_TAC[scs_5T1;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(5=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<=5/\ 5<=6/\a<=a/\ ~(5=4)/\ ~(6=0)`;d_tame;REAL_ARITH`#0.616 < #0.9`;periodic;SET_RULE`{} (i + 5) <=> {} i`;periodic2;ARITH_RULE`~(3=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + +ASM_SIMP_TAC[ARITH_RULE`1<5`;Qknvmlb.SUC_MOD_NOT_EQ;REAL_ARITH`~(&2 * #1.26 < &2)/\ ~(a {} i`;periodic2;ARITH_RULE`~(3=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`3`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`4`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`2`;`4`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`3`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`4`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`2`;`4`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<5`] +THEN SUBGOAL_THEN`{i | i < 5 /\ + (&2 * #1.26 < (if psort 5 (i,SUC i) = 0,1 then #3.01 else &2 * #1.26) \/ + &2 < (if psort 5 (i,SUC i) = 0,1 then &2* #1.26 else &2))} ={0}`ASSUME_TAC; + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;ARITH_RULE`x<5<=> x=0\/ x=1\/x=2\/ x=3\/ x=4`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PSORT_5_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_5_TAC;REAL_ARITH`~(a {} i`;periodic2;ARITH_RULE`~(3=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;h0] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN REAL_ARITH_TAC; + +MRESAS_TAC CARD_SUBSET[`{i | i < 3 /\ + (&2 * h0 < funlist_v39 [(0,1),&2 * h0] cstab 3 i (SUC i) \/ + &2 < funlist_v39 [(0,1),&2] (&2 * h0) 3 i (SUC i))}`;`0..2`][FINITE_NUMSEG;CARD_NUMSEG;ARITH_RULE`(2+1)-0=3/\ (a+3<=6 <=> a<=3)`] +THEN MATCH_DICH_TAC 0 +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC]);; + + +let SCS_3T5_IS_SCS=prove_by_refinement(`is_scs_v39 scs_3T5`, +[ +SIMP_TAC[scs_3T5;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<6/\a<=a/\ 3<=3/\ ~(6=0)`;d_tame;REAL_ARITH`#0.103 < #0.9`;periodic;SET_RULE`{} (i + 3) <=> {} i`;periodic2;ARITH_RULE`~(3=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC LE_sqrt8_2h0 +THEN REAL_ARITH_TAC; + +SCS_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;h0] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC; + +DICH_TAC 0 +THEN ARITH_TAC; + +MRESAS_TAC CARD_SUBSET[`{i | i < 3 /\ + (&2 * h0 < funlist_v39 [(0,1),sqrt8] (&2 * h0) 3 i (SUC i) \/ + &2 < funlist_v39 [(0,1),&2 * h0] (&2) 3 i (SUC i))}`;`0..2`][FINITE_NUMSEG;CARD_NUMSEG;ARITH_RULE`(2+1)-0=3/\ (a+3<=6 <=> a<=3)`] +THEN MATCH_DICH_TAC 0 +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + +]);; + + +let SCS_3T6_IS_SCS=prove_by_refinement(`is_scs_v39 scs_3T6'`, +[ +SIMP_TAC[scs_3T6;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<6/\a<=a/\ 3<=3/\ ~(6=0)`;d_tame;REAL_ARITH`#0.4348 < #0.9`;periodic;SET_RULE`{} (i + 3) <=> {} i`;periodic2;ARITH_RULE`~(3=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC; +SCS_TAC; +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;h0] +THEN MP_TAC LE_sqrt8_2 +THEN REAL_ARITH_TAC; +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN REAL_ARITH_TAC; +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN REAL_ARITH_TAC; +MRESAS_TAC CARD_SUBSET[`{i | i < 3 /\ + (&2 * h0 < funlist_v39 [(0,1),cstab; (1,2),cstab] (&2 * h0) 3 i (SUC i) \/ + &2 < funlist_v39 [(0,1),sqrt8; (1,2),sqrt8] (&2) 3 i (SUC i))}`;`0..2`][FINITE_NUMSEG;CARD_NUMSEG;ARITH_RULE`(2+1)-0=3/\ (a+3<=6 <=> a<=3)`] +THEN MATCH_DICH_TAC 0 +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; +]);; + + +let SCS_3T1_prime_IS_SCS=prove_by_refinement(`is_scs_v39 scs_3T1_prime`, +[SIMP_TAC[scs_3T1_prime;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<6/\a<=a/\ 3<=3/\ ~(6=0)`;d_tame;REAL_ARITH`#0.11 < #0.9`;periodic;SET_RULE`{} (i + 3) <=> {} i`;periodic2;ARITH_RULE`~(3=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN REAL_ARITH_TAC; + +MRESAS_TAC CARD_SUBSET[`{i | i < 3 /\ + (&2 * h0 < funlist_v39 [(0,1),cstab] (&2 * h0) 3 i (SUC i) \/ + &2 < funlist_v39 [(0,1),cstab] (&2) 3 i (SUC i))}`;`0..2`][FINITE_NUMSEG;CARD_NUMSEG;ARITH_RULE`(2+1)-0=3/\ (a+3<=6 <=> a<=3)`] +THEN MATCH_DICH_TAC 0 +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; +]);; + + +let SCS_3T1_IS_SCS=prove_by_refinement(`is_scs_v39 scs_3T1`, +[ +SIMP_TAC[scs_3T1;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<6/\a<=a/\ 3<=3/\ ~(6=0)`;d_tame;REAL_ARITH`#0.11 < #0.9`;periodic;SET_RULE`{} (i + 3) <=> {} i`;periodic2;ARITH_RULE`~(3=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC; + +SCS_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;h0;cstab] +THEN MP_TAC LE_sqrt8_2 +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN REAL_ARITH_TAC; + +MRESAS_TAC CARD_SUBSET[`{i | i < 3 /\ + (&2 * h0 < funlist_v39 [(0,1),cstab] (&2 * h0) 3 i (SUC i) \/ + &2 < funlist_v39 [(0,1),sqrt8] (&2) 3 i (SUC i))}`;`0..2`][FINITE_NUMSEG;CARD_NUMSEG;ARITH_RULE`(2+1)-0=3/\ (a+3<=6 <=> a<=3)`] +THEN MATCH_DICH_TAC 0 +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + +]);; + + +let SCS_3T4_prime_IS_SCS=prove_by_refinement( `is_scs_v39 scs_3T4_prime`, +[SIMP_TAC[scs_3T4_prime;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<6/\a<=a/\ 3<=3/\ ~(6=0)`;d_tame;REAL_ARITH`#0.2759 < #0.9`;periodic;SET_RULE`{} (i + 3) <=> {} i`;periodic2;ARITH_RULE`~(3=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN REAL_ARITH_TAC; + +MRESAS_TAC CARD_SUBSET[`{i | i < 3 /\ + (&2 * h0 < funlist_v39 [(0,1),&2 * h0] cstab 3 i (SUC i) \/ + &2 < funlist_v39 [(0,1),&2; (1,2),cstab] (&2 * h0) 3 i (SUC i))}`;`0..2`][FINITE_NUMSEG;CARD_NUMSEG;ARITH_RULE`(2+1)-0=3/\ (a+3<=6 <=> a<=3)`] +THEN MATCH_DICH_TAC 0 +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC]);; + + +let SCS_4M6_IS_SCS=prove_by_refinement(`is_scs_v39 scs_4M6'`, +[ +SIMP_TAC[scs_4M6;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<=4/\ 4<=6/\a<=a/\ ~(6=0)`;d_tame;REAL_ARITH`#0.513 < #0.9`;periodic;SET_RULE`{} (i + 4) <=> {} i`;periodic2;ARITH_RULE`~(4=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<4`] +THEN SUBGOAL_THEN`{i | i < 4 /\ + (&2 * #1.26 < (if psort 4 (i,SUC i) = 0,1 then #3.01 else &2 * #1.26) \/ + &2 < (if psort 4 (i,SUC i) = 0,1 then &2 * #1.26 else &2))} ={0}`ASSUME_TAC +; + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;ARITH_RULE`x<4<=> x=0\/ x=1\/x=2\/ x=3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;REAL_ARITH`~(a {} i`;periodic2;ARITH_RULE`~(4=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN REAL_ARITH_TAC; + + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<4`] +THEN SUBGOAL_THEN`{i | i < 4 /\ + (&2 * #1.26 < + (if psort 4 (i,SUC i) = 0,1 + then #3.01 + else if psort 4 (i,SUC i) = 2,3 then #3.01 else &2 * #1.26) \/ + &2 < + (if psort 4 (i,SUC i) = 0,1 + then &2 * #1.26 + else if psort 4 (i,SUC i) = 2,3 then &2 * #1.26 else &2))} ={0,2}`ASSUME_TAC +; + + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;ARITH_RULE`x<4<=> x=0\/ x=1\/x=2\/ x=3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;REAL_ARITH`~(a (a=b\/ a=c)`] +THEN RESA_TAC +THEN SCS_TAC +THEN REAL_ARITH_TAC; + + +ASM_SIMP_TAC[Planarity.CARD_2_FAN;ARITH_RULE`~(0=2)`] +THEN ARITH_TAC; + +]);; + + +let SCS_4M6_prime_IS_SCS=prove_by_refinement(`is_scs_v39 scs_4M6_prime`, +[ +SIMP_TAC[scs_4M6_prime;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<=4/\ 4<=6/\a<=a/\ ~(6=0)`;d_tame;REAL_ARITH`#0.513 < #0.9`;periodic;SET_RULE`{} (i + 4) <=> {} i`;periodic2;ARITH_RULE`~(4=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<4`] +THEN SUBGOAL_THEN`{i | i < 4 /\ + (&2 * #1.26 < (if psort 4 (i,SUC i) = 0,1 then #3.01 else &2 * #1.26) \/ + &2 < (if psort 4 (i,SUC i) = 0,1 then #3.01 else &2))} ={0}`ASSUME_TAC +; + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;ARITH_RULE`x<4<=> x=0\/ x=1\/x=2\/ x=3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;REAL_ARITH`~(a {} i`;periodic2;ARITH_RULE`~(4=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<4`] +THEN SUBGOAL_THEN`{i | i < 4 /\ + (&2 * #1.26 < + (if psort 4 (i,SUC i) = 0,1 + then #3.01 + else if psort 4 (i,SUC i) = 1,2 then #3.01 else &2 * #1.26) \/ + &2 < + (if psort 4 (i,SUC i) = 0,1 + then &2 * #1.26 + else if psort 4 (i,SUC i) = 1,2 then &2 * #1.26 else &2))} ={0,1}`ASSUME_TAC +; + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;ARITH_RULE`x<4<=> x=0\/ x=1\/x=2\/ x=3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;REAL_ARITH`~(a (a=b\/ a=c)`] +THEN RESA_TAC +THEN SCS_TAC +THEN REAL_ARITH_TAC; + +ASM_SIMP_TAC[Planarity.CARD_2_FAN;ARITH_RULE`~(0=1)`] +THEN ARITH_TAC; +]);; + +let SCS_4M3_IS_SCS=prove_by_refinement(`is_scs_v39 scs_4M3'`, +[ + +SIMP_TAC[scs_4M3;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<=4/\ 4<=6/\a<=a/\ ~(6=0)`;d_tame;REAL_ARITH`#0.513 < #0.9`;periodic;SET_RULE`{} (i + 4) <=> {} i`;periodic2;ARITH_RULE`~(4=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC sqrt8_LE_6 +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN MP_TAC LE_sqrt8_2 +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<4`] +THEN SUBGOAL_THEN`{i | i < 4 /\ + (&2 * #1.26 < (if psort 4 (i,SUC i) = 0,1 then #3.01 else &2 * #1.26) \/ + &2 < (if psort 4 (i,SUC i) = 0,1 then sqrt8 else &2))} ={0}`ASSUME_TAC +; + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;ARITH_RULE`x<4<=> x=0\/ x=1\/x=2\/ x=3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;REAL_ARITH`~(a {} i`;periodic2;ARITH_RULE`~(4=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<4`] +THEN SUBGOAL_THEN`{i | i < 4 /\ + (&2 * #1.26 < + (if psort 4 (i,SUC i) = 0,1 + then #3.01 + else if psort 4 (i,SUC i) = 1,2 then #3.01 else &2 * #1.26) \/ + &2 < + (if psort 4 (i,SUC i) = 0,1 + then &2 * #1.26 + else if psort 4 (i,SUC i) = 1,2 then &2 * #1.26 else &2))} ={0,1}`ASSUME_TAC +; + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;ARITH_RULE`x<4<=> x=0\/ x=1\/x=2\/ x=3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;REAL_ARITH`~(a a=b\/ a=c`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;REAL_ARITH`~(a a=b\/ a=c`] +; + + +ASM_SIMP_TAC[Planarity.CARD_2_FAN;ARITH_RULE`~(0=1)`] +THEN ARITH_TAC; + +]);; + + + +let SCS_4M7_prime_IS_SCS=prove_by_refinement(`is_scs_v39 scs_4M7_prime`, +[ +SIMP_TAC[scs_4M7_prime;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<=4/\ 4<=6/\a<=a/\ ~(6=0)`;d_tame;REAL_ARITH`#0.513 < #0.9`;periodic;SET_RULE`{} (i + 4) <=> {} i`;periodic2;ARITH_RULE`~(4=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<4`] +THEN SUBGOAL_THEN`{i | i < 4 /\ + (&2 * #1.26 < + (if psort 4 (i,SUC i) = 0,1 + then #3.01 + else if psort 4 (i,SUC i) = 1,2 then #3.01 else &2 * #1.26) \/ + &2 < + (if psort 4 (i,SUC i) = 0,1 + then #3.01 + else if psort 4 (i,SUC i) = 1,2 then &2 * #1.26 else &2))} ={0,1}`ASSUME_TAC +; + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;ARITH_RULE`x<4<=> x=0\/ x=1\/x=2\/ x=3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;REAL_ARITH`~(a a=b\/ a=c`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;REAL_ARITH`~(a a=b\/ a=c`] +; + + +ASM_SIMP_TAC[Planarity.CARD_2_FAN;ARITH_RULE`~(0=1)`] +THEN ARITH_TAC; + +]);; + +let SCS_4M8_IS_SCS=prove_by_refinement(`is_scs_v39 scs_4M8`, +[ +SIMP_TAC[scs_4M8;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<=4/\ 4<=6/\a<=a/\ ~(6=0)`;d_tame;REAL_ARITH`#0.513 < #0.9`;periodic;SET_RULE`{} (i + 4) <=> {} i`;periodic2;ARITH_RULE`~(4=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<4`] +THEN SUBGOAL_THEN`{i | i < 4 /\ + (&2 * #1.26 < + (if psort 4 (i,SUC i) = 0,1 + then #3.01 + else if psort 4 (i,SUC i) = 2,3 then #3.01 else &2 * #1.26) \/ + &2 < + (if psort 4 (i,SUC i) = 0,1 + then &2 * #1.26 + else if psort 4 (i,SUC i) = 2,3 then &2 * #1.26 else &2))} ={0,2}`ASSUME_TAC +; + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;ARITH_RULE`x<4<=> x=0\/ x=1\/x=2\/ x=3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;REAL_ARITH`~(a a=b\/ a=c`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;REAL_ARITH`~(a a=b\/ a=c`] +; + + +ASM_SIMP_TAC[Planarity.CARD_2_FAN;ARITH_RULE`~(0=2)`] +THEN ARITH_TAC; + +]);; + + + +let SCS_4M8_prime_IS_SCS=prove_by_refinement(`is_scs_v39 scs_4M8_prime`, +[ + +SIMP_TAC[scs_4M8_prime;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<=4/\ 4<=6/\a<=a/\ ~(6=0)`;d_tame;REAL_ARITH`#0.513 < #0.9`;periodic;SET_RULE`{} (i + 4) <=> {} i`;periodic2;ARITH_RULE`~(4=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<4`] +THEN SUBGOAL_THEN`{i | i < 4 /\ + (&2 * #1.26 < + (if psort 4 (i,SUC i) = 0,1 + then #3.01 + else if psort 4 (i,SUC i) = 2,3 then #3.01 else &2 * #1.26) \/ + &2 < + (if psort 4 (i,SUC i) = 0,1 + then &2 * #1.26 + else if psort 4 (i,SUC i) = 2,3 then #3.01 else &2))} ={0,2}`ASSUME_TAC +; + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;ARITH_RULE`x<4<=> x=0\/ x=1\/x=2\/ x=3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;REAL_ARITH`~(a a=b\/ a=c`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;REAL_ARITH`~(a a=b\/ a=c`] +; + + +ASM_SIMP_TAC[Planarity.CARD_2_FAN;ARITH_RULE`~(0=2)`] +THEN ARITH_TAC; + + +]);; + + + + +(****************************) + +let SCS_5M3_BASIC=prove(`scs_basic_v39 scs_5M3`, +SCS_TAC);; + +let SCS_5T1_BASIC=prove(`scs_basic_v39 scs_5T1`, +SCS_TAC);; + + + +let SCS_4M6_prime_BASIC=prove(`scs_basic_v39 scs_4M6_prime`, +SCS_TAC);; + +let SCS_4M7_prime_BASIC=prove(`scs_basic_v39 scs_4M7_prime`, +SCS_TAC);; + +let SCS_4M4_BASIC=prove(`scs_basic_v39 scs_4M4'`, +SCS_TAC);; + + +let SCS_4M7_BASIC=prove(`scs_basic_v39 scs_4M7`, +SCS_TAC);; + +let SCS_4M3_BASIC=prove(`scs_basic_v39 scs_4M3'`, +SCS_TAC);; + +let SCS_4M5_BASIC=prove(`scs_basic_v39 scs_4M5'`, +SCS_TAC);; + +let SCS_3T4_prime_BASIC=prove(`scs_basic_v39 scs_3T4_prime`, +SCS_TAC);; + +let SCS_3T6_BASIC=prove(`scs_basic_v39 scs_3T6'`, +SCS_TAC);; + + +let SCS_3T1_prime_BASIC=prove(`scs_basic_v39 scs_3T1_prime`, +SCS_TAC);; + +let SCS_3T5_BASIC=prove(`scs_basic_v39 scs_3T5`, +SCS_TAC);; + + +let SCS_4M8_prime_BASIC=prove(`scs_basic_v39 scs_4M8_prime`, +SCS_TAC);; + + +let SCS_4M8_BASIC=prove(`scs_basic_v39 scs_4M8`, +SCS_TAC);; + + +let K_SCS_5M3=prove(`scs_k_v39 scs_5M3=5`, +SCS_TAC);; + +let K_SCS_5T1=prove(`scs_k_v39 scs_5T1=5`, +SCS_TAC);; + +let K_SCS_3T4_prime=prove(`scs_k_v39 scs_3T4_prime=3`, +SCS_TAC);; + +let K_SCS_3T5=prove(`scs_k_v39 scs_3T5=3`, +SCS_TAC);; + +let K_SCS_3T6=prove(`scs_k_v39 scs_3T6'=3`, +SCS_TAC);; + +let K_SCS_4M4=prove(`scs_k_v39 scs_4M4'=4`, +SCS_TAC);; + +let K_SCS_4M5=prove(`scs_k_v39 scs_4M5'=4`, +SCS_TAC);; + +let K_SCS_4M3=prove(`scs_k_v39 scs_4M3'=4`, +SCS_TAC);; + +let K_SCS_4M6_prime=prove(`scs_k_v39 scs_4M6_prime=4`, +SCS_TAC);; + +let K_SCS_3T1_prime=prove(`scs_k_v39 scs_3T1_prime=3`, +SCS_TAC);; + + +let K_SCS_4M7_prime=prove(`scs_k_v39 scs_4M7_prime=4`, +SCS_TAC);; + +let K_SCS_4M7=prove(`scs_k_v39 scs_4M7=4`, +SCS_TAC);; + + +let K_SCS_4M8_prime=prove(`scs_k_v39 scs_4M8_prime=4`, +SCS_TAC);; + +let K_SCS_4M8=prove(`scs_k_v39 scs_4M8=4`, +SCS_TAC);; + + +let J_SCS_5M3=prove(`scs_J_v39 (scs_prop_equ_v39 scs_5M3 i) i1 j= F`, +SCS_TAC );; + +let J_SCS_5T1=prove(`scs_J_v39 (scs_prop_equ_v39 scs_5T1 i) i1 j= F`, +SCS_TAC );; + + +let J_SCS_3T4_prime=prove(`scs_J_v39 (scs_prop_equ_v39 scs_3T4_prime i) i1 j= F`, +SCS_TAC );; + + +let J_SCS_4M4=prove(`scs_J_v39 (scs_prop_equ_v39 scs_4M4' i) i1 j= F`, +SCS_TAC );; + + +let J_SCS_4M3=prove(`scs_J_v39 (scs_prop_equ_v39 scs_4M3' i) i1 j= F`, +SCS_TAC );; + +let J_SCS_4M5=prove(`scs_J_v39 (scs_prop_equ_v39 scs_4M5' i) i1 j= F`, +SCS_TAC );; + +let J_SCS_4M6_prime=prove(`scs_J_v39 (scs_prop_equ_v39 scs_4M6_prime i) i1 j= F`, +SCS_TAC );; + +let J_SCS_5M2=prove(`scs_J_v39 (scs_prop_equ_v39 scs_5M2 i) i1 j= F`, +SCS_TAC );; + +let J_SCS_3T1_prime=prove(`scs_J_v39 (scs_prop_equ_v39 scs_3T1_prime i) i1 j= F`, +SCS_TAC );; + +let J_SCS_3T1=prove(`scs_J_v39 (scs_prop_equ_v39 scs_3T1 i) i1 j= F`, +SCS_TAC );; + +let J_SCS_3T6=prove(`scs_J_v39 (scs_prop_equ_v39 scs_3T6' i) i1 j= F`, +SCS_TAC );; + +let J_SCS_3T5=prove(`scs_J_v39 (scs_prop_equ_v39 scs_3T5 i) i1 j= F`, +SCS_TAC );; + + +let J_SCS_4M7_prime=prove(`scs_J_v39 (scs_prop_equ_v39 scs_4M7_prime i) i1 j= F`, +SCS_TAC );; + +let J_SCS_4M7=prove(`scs_J_v39 (scs_prop_equ_v39 scs_4M7 i) i1 j= F`, +SCS_TAC );; + +let J_SCS_4M8_prime=prove(`scs_J_v39 (scs_prop_equ_v39 scs_4M8_prime i) i1 j= F`, +SCS_TAC );; + +let J_SCS_4M8=prove(`scs_J_v39 (scs_prop_equ_v39 scs_4M8 i) i1 j= F`, +SCS_TAC );; + +let J_SCS_4M8_prime1=prove(`scs_J_v39 (scs_4M8_prime ) i1 j= F`, +SCS_TAC );; + + + + +let STAB_5I1_SCS=prove(` scs_diag (scs_k_v39 scs_5I1) i j +==> is_scs_v39 (scs_stab_diag_v39 scs_5I1 i j)/\ scs_basic_v39 (scs_stab_diag_v39 scs_5I1 i j)`, +STRIP_TAC +THEN MATCH_MP_TAC Yrtafyh.YRTAFYH +THEN ASM_REWRITE_TAC[SCS_K_D_A_STAB_EQ;SCS_5I1_IS_SCS;SCS_5I1_BASIC;K_SCS_5I1; +ARITH_RULE`3<5`;LET_DEF;LET_END_DEF;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;h0;cstab] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC);; + + +let STAB_5I2_SCS=prove(` scs_diag (scs_k_v39 scs_5I2) i j +==> is_scs_v39 (scs_stab_diag_v39 scs_5I2 i j)/\ scs_basic_v39 (scs_stab_diag_v39 scs_5I2 i j)`, +STRIP_TAC +THEN MATCH_MP_TAC Yrtafyh.YRTAFYH +THEN ASM_REWRITE_TAC[SCS_K_D_A_STAB_EQ;SCS_5I2_IS_SCS;SCS_5I2_BASIC;K_SCS_5I2; +ARITH_RULE`3<5`;LET_DEF;LET_END_DEF;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;h0;cstab] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC);; + + +let STAB_5M3_SCS=prove(` scs_diag (scs_k_v39 scs_5M3) i j +==> is_scs_v39 (scs_stab_diag_v39 scs_5M3 i j)/\ scs_basic_v39 (scs_stab_diag_v39 scs_5M3 i j)`, +STRIP_TAC +THEN MATCH_MP_TAC Yrtafyh.YRTAFYH +THEN ASM_REWRITE_TAC[SCS_K_D_A_STAB_EQ;SCS_5M3_IS_SCS;SCS_5M3_BASIC;K_SCS_5M3; +ARITH_RULE`3<5`;LET_DEF;LET_END_DEF;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;h0;cstab] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC);; + + +let STAB_5T1_SCS=prove(` scs_diag (scs_k_v39 scs_5T1) i j +==> is_scs_v39 (scs_stab_diag_v39 scs_5T1 i j)/\ scs_basic_v39 (scs_stab_diag_v39 scs_5T1 i j)`, +STRIP_TAC +THEN MATCH_MP_TAC Yrtafyh.YRTAFYH +THEN ASM_REWRITE_TAC[SCS_K_D_A_STAB_EQ;SCS_5T1_IS_SCS;SCS_5T1_BASIC;K_SCS_5T1; +ARITH_RULE`3<5`;LET_DEF;LET_END_DEF;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;h0;cstab] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC);; + + +(*****************************) + +let SCS_5M3_STAB_DIAG_sqrt8=prove_by_refinement(`BBs_v39 scs_5M2 v/\ + scs_diag 5 i j /\ + dist(v i,v j) <= cstab/\ + sqrt8 <= dist(v 0, v(1)) + ==> + BBs_v39 ((scs_stab_diag_v39 scs_5M3 i j) ) v`, +[REWRITE_TAC[IN] +THEN REPEAT STRIP_TAC +THEN DICH_TAC 3 +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC th +THEN MP_TAC th) +THEN +REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_5M3;scs_5M2;CS_ADJ;scs_diag;ARITH_RULE`~(5<=3)`;IN;K_SCS_5M3;scs_prop_equ_v39;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN ASM_SIMP_TAC[] +THEN REPEAT RESA_TAC +THEN SCS_TAC +THEN MP_TAC(SET_RULE`i' MOD 5= j' MOD 5\/ ~(i' MOD 5= j' MOD 5)`) +THEN RESA_TAC; + +THAYTHE_TAC (8-6)[`i'`;`j'`] +THEN DICH_TAC 0 +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +MP_TAC(SET_RULE`psort 5 (i',j') = 0,1\/ ~(psort 5 (i',j') = 0,1)`) +THEN RESA_TAC; + +MRESAL_TAC Uaghhbm.CASE_PSORT[`i'`;`1`;`j'`;`0`;`5`][PSORT_5_EXPLICIT]; + +MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`i':num`;`v`;` 0`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`j':num`;`v`;` 1`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN DICH_TAC(13-2) +THEN MP_TAC LE_sqrt8_2h0 +THEN REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; + +MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`i':num`;`v`;` 1`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`j':num`;`v`;` 0`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN DICH_TAC(13-2) +THEN MP_TAC LE_sqrt8_2h0 +THEN REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; + +THAYTHE_TAC (9-6)[`i'`;`j'`] +THEN DICH_TAC 1 +THEN SCS_TAC +THEN REWRITE_TAC[cstab;h0]; + +THAYTHE_TAC (8-6)[`i'`;`j'`] +THEN DICH_TAC 0 +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +MP_TAC(SET_RULE`psort 5 (i,j) = psort 5 (i',j')\/ ~(psort 5 (i,j) = psort 5 (i',j'))`) +THEN RESA_TAC; + +MRESAL_TAC Uaghhbm.CASE_PSORT[`i'`;`j`;`j'`;`i`;`5`][PSORT_5_EXPLICIT]; + +MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`i':num`;`v`;` i`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`j':num`;`v`;` j`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`]; + +MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`i':num`;`v`;` j`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`j':num`;`v`;` i`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]; + +THAYTHE_TAC(9-6)[`i'`;`j'`] +THEN DICH_TAC 0 +THEN SCS_TAC]);; + + +let SCS_DIAG_SCS_5M3_02=prove(`scs_diag (scs_k_v39 scs_5M3) 0 2`, +REWRITE_TAC[K_SCS_5M3;scs_diag] +THEN ARITH_TAC);; + +let SCS_DIAG_SCS_5M3_03=prove(`scs_diag (scs_k_v39 scs_5M3) 0 3`, +REWRITE_TAC[K_SCS_5M3;scs_diag] +THEN ARITH_TAC);; + +let SCS_DIAG_SCS_5M3_24=prove(`scs_diag (scs_k_v39 scs_5M3) 2 4`, +REWRITE_TAC[K_SCS_5M3;scs_diag] +THEN ARITH_TAC);; + + +let MM_5M2_IMP_MM_STAB_5M3=prove( +` MMs_v39 scs_5M2 v /\ + scs_diag 5 i j /\ + dist(v i,v j) <= cstab/\ + sqrt8<= dist(v l, v(l+1)) + ==> + ~(MMs_v39 (scs_stab_diag_v39 scs_5M3 i j)= {})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_5M2` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_5M2`;`v`] +THEN ASSUME_TAC SCS_5M2_BASIC +THEN ASSUME_TAC K_SCS_5M2 +THEN ASM_SIMP_TAC[SCS_5M2_IS_SCS;STAB_5M3_SCS;K_SCS_5M3;SCS_K_D_A_STAB_EQ;IN; ADD1] +THEN MP_TAC SCS_5M2_EDGE_LE_2H0_IMP_0 +THEN ASM_REWRITE_TAC[ ADD1;h0] +THEN MP_TAC LT_sqrt8_2h0 +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`sqrt8 <= dist ((v:num->real^3) l,v (l + 1))/\ &2 * #1.26 < sqrt8==> &2 * #1.26 < dist (v l,v (l + 1))`) +THEN RESA_TAC +THEN STRIP_TAC +THEN DICH_TAC (9-3) +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`l:num`;`v`;` l MOD 5`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)/\ 0 MOD 5=0`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`l+1:num`;`v`;` (l+1) MOD 5`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)/\ 0 MOD 5=0`] +THEN MRESAL_TAC MOD_ADD_MOD[`l`;`1`;`5`][ARITH_RULE`~(5=0)/\ 1 MOD 5=1/\ 0+a=a`] THEN SYM_ASSUM_TAC +THEN STRIP_TAC +THEN MP_TAC SCS_5M3_STAB_DIAG_sqrt8 +THEN RESA_TAC +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + + + +let STAB_5M3_SCS=prove(` scs_diag (scs_k_v39 scs_5M3) i j +==> is_scs_v39 (scs_stab_diag_v39 scs_5M3 i j)/\ scs_basic_v39 (scs_stab_diag_v39 scs_5M3 i j)`, +STRIP_TAC +THEN MATCH_MP_TAC Yrtafyh.YRTAFYH +THEN ASM_REWRITE_TAC[SCS_K_D_A_STAB_EQ;SCS_5M3_IS_SCS;SCS_5M3_BASIC;K_SCS_5M3; +ARITH_RULE`3<5`;LET_DEF;LET_END_DEF;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;h0;cstab] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC);; + + +let BB_3T4_prime_IMP_scs_3T4=prove(`BBs_v39 scs_3T4_prime v + ==> + BBs_v39 (scs_3T4 ) v`, +REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_5I3;scs_5M2;CS_ADJ;scs_diag;ARITH_RULE`(3<=3)`;IN;K_SCS_3T4;K_SCS_3T4_prime;scs_prop_equ_v39;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN SCS_TAC +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC 0[`i`;`j`] +THEN DICH_TAC 1 +THEN REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC);; + + +let MM_3T4_prime_IMP_MM_3T4=prove(`MMs_v39 scs_3T4_prime v ==> ~(MMs_v39 scs_3T4={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_3T4_prime` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_3T4_prime`;`v`] +THEN ASM_SIMP_TAC[SCS_3T4_BASIC;SCS_3T4_prime_BASIC;SCS_3T4_IS_SCS;SCS_3T4_IS_SCS; +SCS_3T4_prime_IS_SCS;K_SCS_3T4;K_SCS_3T4_prime;IN;BB_3T4_prime_IMP_scs_3T4] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + +let SCS_3T4_prime_ARROW_MM_3T4=prove_by_refinement(`scs_arrow_v39 {scs_3T4_prime } { scs_3T4}`, +[ REPEAT GEN_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;IN] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +ASM_SIMP_TAC[SCS_3T4_IS_SCS]; + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_3T4_prime ==> MMs_v39 s = {}) \/ ~((!s. s = scs_3T4_prime ==> MMs_v39 s = {}))`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`scs_3T4` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC (GEN_ALL MM_3T4_prime_IMP_MM_3T4) +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]);; + + +let BB_4M6_prime_IMP_scs_4M6=prove(`BBs_v39 scs_4M6_prime v + ==> + BBs_v39 (scs_4M6' ) v`, +REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;scs_diag;ARITH_RULE`(~(4<=3))`;IN;K_SCS_4M6_prime;K_SCS_4M6;scs_prop_equ_v39;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN SCS_TAC +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC 1[`i`;`j`] +THEN DICH_TAC 1 +THEN REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC);; + + + + + + + + + + +let MM_4M6_prime_IMP_MM_4M6=prove(`MMs_v39 scs_4M6_prime v ==> ~(MMs_v39 scs_4M6' ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_4M6_prime` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4M6_prime`;`v`] +THEN ASM_SIMP_TAC[SCS_4M6_BASIC;SCS_4M6_prime_BASIC;SCS_4M6_IS_SCS;SCS_4M6_IS_SCS; +SCS_4M6_prime_IS_SCS;K_SCS_4M6;K_SCS_4M6_prime;IN;BB_4M6_prime_IMP_scs_4M6] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + +let SCS_4M6_prime_ARROW_MM_4M6=prove_by_refinement(`scs_arrow_v39 {scs_4M6_prime } { scs_4M6'}`, +[ REPEAT GEN_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;IN] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +ASM_SIMP_TAC[SCS_4M6_IS_SCS]; + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_4M6_prime ==> MMs_v39 s = {}) \/ ~((!s. s = scs_4M6_prime ==> MMs_v39 s = {}))`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`scs_4M6'` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC (GEN_ALL MM_4M6_prime_IMP_MM_4M6) +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]);; + + + +let SCS_5M3_SLICE_02=prove_by_refinement(`scs_arrow_v39 {scs_stab_diag_v39 scs_5M3 0 2 } { scs_prop_equ_v39 scs_3T4_prime 2, scs_prop_equ_v39 scs_4M6_prime 1}`, +[ +MATCH_MP_TAC (GEN_ALL Lkgrqui.LKGRQUI) +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_5M3_02;STAB_5M3_SCS;SCS_K_D_A_STAB_EQ;] +THEN EXISTS_TAC`0` +THEN EXISTS_TAC`2` +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_5M3_02] +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ] +THEN REPEAT RESA_TAC; + +REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ;scs_slice_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC scs_inj +THEN ASM_SIMP_TAC[SCS_5M3_BASIC;SCS_3T4_prime_BASIC;J_SCS_4M6_prime;BASIC_HALF_SLICE_STAB;J_SCS_3T4_prime;D_HALF_SLICE;BAISC_PROP_EQU;K_SCS_PROP_EUQ;SCS_4M6_prime_BASIC] +THEN STRIP_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4_prime;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_5M3] +THEN ARITH_TAC; + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_5M3;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M2;scs_3T4_prime;scs_5M3; +ARITH_RULE`(2 + 1 + 5 - 0) MOD 5= 3/\ 0 MOD 5=0/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`2`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`2+x:num`;`2+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4_prime;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_5M3;K_SCS_4M6_prime] +THEN ARITH_TAC; + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_5M3;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M6_prime;scs_3T4_prime;scs_5M3; +ARITH_RULE`(0+1 + 5 - 2) MOD 5= 4/\ 2 MOD 5=2/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 4<4==> x MOD 4=0\/ x MOD 4=1\/ x MOD 4=2\/ x MOD 4=3`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 4<4==> x' MOD 4=0\/ x' MOD 4=1\/ x' MOD 4=2\/x' MOD 4=3`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`0`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`1`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`2`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`3`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`0`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`1`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`2`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`3`;`1`][ARITH_RULE`~(4=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`1+x:num`;`1+x':num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[J_SCS_3T4_prime]]);; + + +let SCS_5M3_02_ARROW_3T4_4M6=prove_by_refinement(`scs_arrow_v39 {scs_stab_diag_v39 scs_5M3 0 2 } {scs_3T4, scs_4M6'}`, +[MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{ scs_prop_equ_v39 scs_3T4_prime 2, scs_prop_equ_v39 scs_4M6_prime 1}` +THEN ASM_REWRITE_TAC[SCS_5M3_SLICE_02;SET_RULE`{A,B}={A}UNION {B}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_3T4_prime}` +THEN ASM_REWRITE_TAC[SCS_3T4_prime_ARROW_MM_3T4] +THEN MRESAS_TAC PRO_EQU_ID1[`scs_3T4_prime`;`2`;`3`][SCS_3T4_prime_IS_SCS;K_SCS_3T4_prime;ARITH_RULE`(3 - 2 MOD 3)=1`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_3T4_prime 2`;`1`][PROP_EQU_IS_SCS;SCS_3T4_prime_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]; + +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_4M6_prime}` +THEN ASM_REWRITE_TAC[SCS_4M6_prime_ARROW_MM_4M6] +THEN MRESAS_TAC PRO_EQU_ID1[`scs_4M6_prime`;`1`;`4`][SCS_4M6_prime_IS_SCS;K_SCS_4M6_prime;ARITH_RULE`(4 - 1 MOD 4)=3`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_4M6_prime 1`;`3`][PROP_EQU_IS_SCS;SCS_4M6_prime_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]]);; + +(************03***********) + + + +let SCS_5M3_SLICE_03=prove_by_refinement( +`scs_arrow_v39 {scs_stab_diag_v39 scs_5M3 0 3 } { scs_prop_equ_v39 scs_4M7_prime 1,scs_prop_equ_v39 scs_3T1_prime 1}`, +[ + +MATCH_MP_TAC (GEN_ALL Lkgrqui.LKGRQUI) +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_5M3_03;STAB_5M3_SCS;SCS_K_D_A_STAB_EQ;] +THEN EXISTS_TAC`0` +THEN EXISTS_TAC`3` +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_5M3_03] +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ] +THEN REPEAT RESA_TAC; + + +REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ;scs_slice_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC scs_inj +THEN ASM_SIMP_TAC[SCS_5M3_BASIC;SCS_3T1_prime_BASIC;J_SCS_4M7_prime;BASIC_HALF_SLICE_STAB;J_SCS_3T1_prime;D_HALF_SLICE;BAISC_PROP_EQU;K_SCS_PROP_EUQ;SCS_4M7_prime_BASIC] +THEN STRIP_TAC; + + +ASM_SIMP_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_4M7_prime;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_5M3] +THEN ARITH_TAC; + + +STRIP_TAC +THEN ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_5M3;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M7_prime;scs_3T1_prime;scs_5M3; +ARITH_RULE`(3+1 + 5 - 0) MOD 5= 4/\ 0 MOD 5=0/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 4<4==> x MOD 4=0\/ x MOD 4=1\/ x MOD 4=2\/ x MOD 4=3`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 4<4==> x' MOD 4=0\/ x' MOD 4=1\/ x' MOD 4=2\/x' MOD 4=3`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`0`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`1`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`2`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`3`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`0`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`1`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`2`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`3`;`1`][ARITH_RULE`~(4=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`1+x:num`;`1+x':num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + + +ASM_SIMP_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T1_prime;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_5M3;K_SCS_4M7_prime] +THEN ARITH_TAC; + + +STRIP_TAC +THEN ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_5M3;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M7;scs_3T1_prime;scs_5M3; +ARITH_RULE`(0 + 1 + 5 - 3) MOD 5= 3/\ 3 MOD 5=3/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`1+x:num`;`1+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + + + +SCS_TAC +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[J_SCS_4M7_prime]; + +]);; + + +let BB_3T1_prime_IMP_scs_3T1=prove( +`BBs_v39 scs_3T1_prime v + ==> + BBs_v39 (scs_3T1 ) v`, +REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;scs_diag;ARITH_RULE`((3<=3))`;IN;K_SCS_3T1_prime;K_SCS_3T1;scs_prop_equ_v39;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN SCS_TAC +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC 0[`i`;`j`] +THEN DICH_TAC 1 +THEN REWRITE_TAC[cstab;h0] +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC);; + + +let MM_3T1_prime_IMP_MM_3T1=prove( +`MMs_v39 scs_3T1_prime v ==> ~(MMs_v39 scs_3T1 ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_3T1_prime` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_3T1_prime`;`v`] +THEN ASM_SIMP_TAC[SCS_3T1_BASIC;SCS_3T1_prime_BASIC;SCS_3T1_IS_SCS;SCS_3T1_IS_SCS; +SCS_3T1_prime_IS_SCS;K_SCS_3T1;K_SCS_3T1_prime;IN;BB_3T1_prime_IMP_scs_3T1] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + + +let SCS_3T1_prime_ARROW_MM_3T1=prove_by_refinement(`scs_arrow_v39 {scs_3T1_prime } { scs_3T1}`, +[ REPEAT GEN_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;IN] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +ASM_SIMP_TAC[SCS_3T1_IS_SCS]; + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_3T1_prime ==> MMs_v39 s = {}) \/ ~((!s. s = scs_3T1_prime ==> MMs_v39 s = {}))`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`scs_3T1` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC (GEN_ALL MM_3T1_prime_IMP_MM_3T1) +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]);; + + + + +let BB_4M7_prime_IMP_scs_4M7=prove(`BBs_v39 scs_4M7_prime v + ==> + BBs_v39 (scs_4M7 ) v`, +REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;scs_diag;ARITH_RULE`(~(4<=3))`;IN;K_SCS_4M7_prime;K_SCS_4M7;scs_prop_equ_v39;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN SCS_TAC +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC 1[`i`;`j`] +THEN DICH_TAC 1 +THEN REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC);; + + + +let MM_4M7_prime_IMP_MM_4M7=prove( +`MMs_v39 scs_4M7_prime v ==> ~(MMs_v39 scs_4M7 ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_4M7_prime` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4M7_prime`;`v`] +THEN ASM_SIMP_TAC[SCS_4M7_BASIC;SCS_4M7_prime_BASIC;SCS_4M7_IS_SCS;SCS_4M7_IS_SCS; +SCS_4M7_prime_IS_SCS;K_SCS_4M7;K_SCS_4M7_prime;IN;BB_4M7_prime_IMP_scs_4M7] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + + +let SCS_4M7_prime_ARROW_MM_4M7=prove_by_refinement(`scs_arrow_v39 {scs_4M7_prime } { scs_4M7}`, +[ REPEAT GEN_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;IN] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +ASM_SIMP_TAC[SCS_4M7_IS_SCS]; + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_4M7_prime ==> MMs_v39 s = {}) \/ ~((!s. s = scs_4M7_prime ==> MMs_v39 s = {}))`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`scs_4M7` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC (GEN_ALL MM_4M7_prime_IMP_MM_4M7) +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]);; + + +let SCS_5M3_03_ARROW_3T1_4M7=prove_by_refinement(`scs_arrow_v39 {scs_stab_diag_v39 scs_5M3 0 3 } { scs_4M7,scs_3T1}`, +[ +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{ scs_prop_equ_v39 scs_4M7_prime 1, scs_prop_equ_v39 scs_3T1_prime 1}` +THEN ASM_REWRITE_TAC[SCS_5M3_SLICE_03;SET_RULE`{A,B}={A}UNION {B}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_4M7_prime}` +THEN ASM_REWRITE_TAC[SCS_4M7_prime_ARROW_MM_4M7] +THEN MRESAS_TAC PRO_EQU_ID1[`scs_4M7_prime`;`1`;`4`][SCS_4M7_prime_IS_SCS;K_SCS_4M7_prime;ARITH_RULE`(4 - 1 MOD 4)=3`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_4M7_prime 1`;`3`][PROP_EQU_IS_SCS;SCS_4M7_prime_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]; + +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_3T1_prime}` +THEN ASM_REWRITE_TAC[SCS_3T1_prime_ARROW_MM_3T1] +THEN MRESAS_TAC PRO_EQU_ID1[`scs_3T1_prime`;`1`;`3`][SCS_3T1_prime_IS_SCS;K_SCS_3T1_prime;ARITH_RULE`(3 - 1 MOD 3)=2`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_3T1_prime 1`;`2`][PROP_EQU_IS_SCS;SCS_3T1_prime_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]]);; + +(*************24**************) + + +let SCS_5M3_SLICE_24=prove_by_refinement( +`scs_arrow_v39 {scs_stab_diag_v39 scs_5M3 2 4 } {scs_prop_equ_v39 scs_3T1_prime 1,scs_prop_equ_v39 scs_4M8_prime 3}`, +[ +MATCH_MP_TAC (GEN_ALL Lkgrqui.LKGRQUI) +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_5M3_24;STAB_5M3_SCS;SCS_K_D_A_STAB_EQ;] +THEN EXISTS_TAC`2` +THEN EXISTS_TAC`4` +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_5M3_24] +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ] +THEN REPEAT RESA_TAC; + +REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ;scs_slice_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC scs_inj +THEN ASM_SIMP_TAC[SCS_5M3_BASIC;SCS_3T1_prime_BASIC;J_SCS_4M8_prime1;BASIC_HALF_SLICE_STAB;J_SCS_3T1_prime;D_HALF_SLICE;BAISC_PROP_EQU;K_SCS_PROP_EUQ;SCS_4M8_prime_BASIC] +THEN STRIP_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T1_prime;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_5M3] +THEN ARITH_TAC; + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_5M3;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M7;scs_3T1_prime;scs_5M3; +ARITH_RULE`(4 + 1 + 5 - 2) MOD 5= 3/\ 2 MOD 5=2/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`1+x:num`;`1+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_4M8_prime;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_5M3;K_SCS_4M8_prime] +THEN ARITH_TAC; + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_5M3;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M8_prime;scs_3T1_prime;scs_5M3; +ARITH_RULE`(2+1 + 5 - 4) MOD 5= 4/\ 4 MOD 5=4/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 4<4==> x MOD 4=0\/ x MOD 4=1\/ x MOD 4=2\/ x MOD 4=3`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 4<4==> x' MOD 4=0\/ x' MOD 4=1\/ x' MOD 4=2\/x' MOD 4=3`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`0`;`3`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`1`;`3`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`2`;`3`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`3`;`3`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`0`;`3`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`1`;`3`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`2`;`3`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`3`;`3`][ARITH_RULE`~(4=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`3+x:num`;`3+x':num`][ARITH_RULE`~(4=0)/\ 3+3=6/\ 3+1=4/\ 4 MOD 3=1/\ 2+4=6/\ 6 MOD 4=2/\ 3+4=7/\ 7 MOD 5=2`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[J_SCS_3T1_prime]; +]);; + + + +let BB_4M8_prime_IMP_scs_4M8=prove(`BBs_v39 scs_4M8_prime v + ==> + BBs_v39 (scs_4M8 ) v`, +REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;scs_diag;ARITH_RULE`(~(4<=3))`;IN;K_SCS_4M8_prime;K_SCS_4M8;scs_prop_equ_v39;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN SCS_TAC +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC 1[`i`;`j`] +THEN DICH_TAC 1 +THEN REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC);; + + + +let MM_4M8_prime_IMP_MM_4M8=prove( +`MMs_v39 scs_4M8_prime v ==> ~(MMs_v39 scs_4M8 ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_4M8_prime` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4M8_prime`;`v`] +THEN ASM_SIMP_TAC[SCS_4M8_BASIC;SCS_4M8_prime_BASIC;SCS_4M8_IS_SCS;SCS_4M8_IS_SCS; +SCS_4M8_prime_IS_SCS;K_SCS_4M8;K_SCS_4M8_prime;IN;BB_4M8_prime_IMP_scs_4M8] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + + +let SCS_4M8_prime_ARROW_MM_4M8=prove_by_refinement(`scs_arrow_v39 {scs_4M8_prime } { scs_4M8}`, +[ REPEAT GEN_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;IN] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +ASM_SIMP_TAC[SCS_4M8_IS_SCS]; + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_4M8_prime ==> MMs_v39 s = {}) \/ ~((!s. s = scs_4M8_prime ==> MMs_v39 s = {}))`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`scs_4M8` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC (GEN_ALL MM_4M8_prime_IMP_MM_4M8) +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]);; + + + +let SCS_5M3_24_ARROW_3T1_4M8=prove_by_refinement(`scs_arrow_v39 {scs_stab_diag_v39 scs_5M3 2 4 } { scs_3T1,scs_4M8}`, +[ +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{ scs_prop_equ_v39 scs_3T1_prime 1,scs_prop_equ_v39 scs_4M8_prime 3}` +THEN ASM_REWRITE_TAC[SCS_5M3_SLICE_24;SET_RULE`{A,B}={A}UNION {B}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_3T1_prime}` +THEN ASM_REWRITE_TAC[SCS_3T1_prime_ARROW_MM_3T1] +THEN MRESAS_TAC PRO_EQU_ID1[`scs_3T1_prime`;`1`;`3`][SCS_3T1_prime_IS_SCS;K_SCS_3T1_prime;ARITH_RULE`(3 - 1 MOD 3)=2`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_3T1_prime 1`;`2`][PROP_EQU_IS_SCS;SCS_3T1_prime_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]; + +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_4M8_prime}` +THEN ASM_REWRITE_TAC[SCS_4M8_prime_ARROW_MM_4M8] +THEN MRESAS_TAC PRO_EQU_ID1[`scs_4M8_prime`;`3`;`4`][SCS_4M8_prime_IS_SCS;K_SCS_4M8_prime;ARITH_RULE`(4 - 3 MOD 4)=1`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_4M8_prime 3`;`1`][PROP_EQU_IS_SCS;SCS_4M8_prime_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]]);; + + + +(************) + +let PROP_OPP_DIAG_5M3_03= prove_by_refinement(`scs_stab_diag_v39 scs_5M3 0 3= scs_prop_equ_v39(scs_opp_v39 (scs_stab_diag_v39 scs_5M3 1 3)) 3 `, + +[REWRITE_TAC[scs_prop_equ_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39; scs_basic;SCS_K_D_A_STAB_EQ;scs_opp_v39] +THEN MATCH_MP_TAC scs_inj +THEN SIMP_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;SCS_5M3_BASIC] +THEN STRIP_TAC; + +MRESAL_TAC STAB_5M3_SCS[`0`;`3`][K_SCS_5M3;scs_diag;ARITH_RULE`~(0 MOD 5 = 3 MOD 5) /\ + ~(SUC 0 MOD 5 = 3 MOD 5) /\ + ~(0 MOD 5 = SUC 3 MOD 5)`]; + +STRIP_TAC; + +ASM_REWRITE_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_5M3;mk_unadorned_v39;peropp;peropp2;FUN_EQ_THM] +THEN SET_TAC[]; + +STRIP_TAC +THEN ASM_REWRITE_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_5M3;mk_unadorned_v39;peropp;peropp2;FUN_EQ_THM;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN REPEAT GEN_TAC +THEN ASSUME_TAC (ARITH_RULE`~(5=0)`) +THEN MRESA_TAC PSORT_MOD[`5`;`x`;`x'`] +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`3`;`x`;`5`] +THEN MRESA_TAC MOD_ADD_MOD[`3`;`x'`;`5`] +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`x MOD 5<5==> x MOD 5=0\/ x MOD 5=1\/ x MOD 5=2\/ x MOD 5=3\/x MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 5<5==> x' MOD 5=0\/ x' MOD 5=1\/ x' MOD 5=2\/ x' MOD 5=3\/x' MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT;ARITH_RULE`5-1=4/\ 5-2=3/\ 5-3=2/\ 5-4=1/\ 5-5=0/\ 2+0=2/\ 2+1=3/\ 2+2=4/\ 2+3=5/\2+4=6 +/\ 3+0=3/\ 3+1=4/\ 3+2=5/\ 3+3=6/\ 3+4=7/\ 7 MOD 5=2`;PAIR_EQ]]);; + + + + +let PROP_OPP_DIAG_5M3_02= prove_by_refinement(`scs_stab_diag_v39 scs_5M3 0 2= scs_prop_equ_v39(scs_opp_v39 (scs_stab_diag_v39 scs_5M3 1 4)) 3 `, + +[REWRITE_TAC[scs_prop_equ_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39; scs_basic;SCS_K_D_A_STAB_EQ;scs_opp_v39] +THEN MATCH_MP_TAC scs_inj +THEN SIMP_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;SCS_5M3_BASIC] +THEN STRIP_TAC; + +MRESAL_TAC STAB_5M3_SCS[`0`;`2`][K_SCS_5M3;scs_diag;ARITH_RULE`~(0 MOD 5 = 2 MOD 5) /\ + ~(SUC 0 MOD 5 = 2 MOD 5) /\ + ~(0 MOD 5 = SUC 2 MOD 5)`]; + +STRIP_TAC; + +ASM_REWRITE_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_5M3;mk_unadorned_v39;peropp;peropp2;FUN_EQ_THM] +THEN SET_TAC[]; + +STRIP_TAC +THEN ASM_REWRITE_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_5M3;mk_unadorned_v39;peropp;peropp2;FUN_EQ_THM;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN REPEAT GEN_TAC +THEN ASSUME_TAC (ARITH_RULE`~(5=0)`) +THEN MRESA_TAC PSORT_MOD[`5`;`x`;`x'`] +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`3`;`x`;`5`] +THEN MRESA_TAC MOD_ADD_MOD[`3`;`x'`;`5`] +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`x MOD 5<5==> x MOD 5=0\/ x MOD 5=1\/ x MOD 5=2\/ x MOD 5=3\/x MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 5<5==> x' MOD 5=0\/ x' MOD 5=1\/ x' MOD 5=2\/ x' MOD 5=3\/x' MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT;ARITH_RULE`5-1=4/\ 5-2=3/\ 5-3=2/\ 5-4=1/\ 5-5=0/\ 2+0=2/\ 2+1=3/\ 2+2=4/\ 2+3=5/\2+4=6 +/\ 3+0=3/\ 3+1=4/\ 3+2=5/\ 3+3=6/\ 3+4=7/\ 7 MOD 5=2`;PAIR_EQ]]);; + + +let SET_STAB_5M3=prove(`{ scs_stab_diag_v39 scs_5M3 i j| scs_diag 5 i j }= { scs_stab_diag_v39 scs_5M3 (i MOD 5) (j MOD 5)| scs_diag 5 (i MOD 5) (j MOD 5) }`, + ASM_SIMP_TAC[STAB_MOD;DIAG_MOD;EXTENSION;IN_ELIM_THM;ARITH_RULE`~(5=0)`;] +THEN MRESAL_TAC STAB_MOD[`scs_5M3`][SCS_5M3_IS_SCS;K_SCS_5M3]);; + + +let EXPAND_STAB_DIAG_5M3=prove(`{scs_stab_diag_v39 scs_5M3 (i MOD 5) (j MOD 5) | i MOD 5 = + (j MOD 5 + 2) MOD 5 \/ + j MOD 5 = + (i MOD 5 + 2) MOD 5}= +{scs_stab_diag_v39 scs_5M3 (i+2) i| i<5} `, +ASM_SIMP_TAC[EXPAND_STAB_DIAG_5;SCS_5M3_IS_SCS;K_SCS_5M3]);; + + +let SET_EQ_DIAG_STAB_5M3= prove_by_refinement(`scs_arrow_v39 {scs_stab_diag_v39 scs_5M3 i j | scs_diag 5 i j} + {scs_stab_diag_v39 scs_5M3 0 2, scs_stab_diag_v39 scs_5M3 0 3, scs_stab_diag_v39 + scs_5M3 + 2 + 4}`, +[ +ONCE_REWRITE_TAC[SET_STAB_5M3] +THEN REWRITE_TAC[DIAG_EQ_ADD5;EXPAND_STAB_DIAG_5I3;EXPAND_STAB_DIAG_5M3] +THEN REWRITE_TAC[ARITH_RULE`i<5<=> i=0\/i=1\/i=2\/i=3\/i=4`; +SET_RULE`{A,B,C} += +{A}UNION +{B}UNION +{C}UNION +{B}UNION +{A} +`;SET_RULE`{scs_stab_diag_v39 scs_5M3 (i + 2) i |i=0\/i=1\/i=2\/i=3\/i=4} += +{scs_stab_diag_v39 scs_5M3 (0 + 2) 0} UNION +{scs_stab_diag_v39 scs_5M3 (1 + 2) 1} UNION +{scs_stab_diag_v39 scs_5M3 (2 + 2) 2} UNION +{scs_stab_diag_v39 scs_5M3 (3 + 2) 3} UNION +{scs_stab_diag_v39 scs_5M3 (4 + 2) 4} +`;] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`0+2=2`;STAB_SYM] +THEN MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC STAB_5M3_SCS[`2`;`0`][scs_diag;K_SCS_5M3;ARITH_RULE`~(2 MOD 5 = 0 MOD 5) /\ + ~(SUC 2 MOD 5 = 0 MOD 5) /\ + ~(2 MOD 5 = SUC 0 MOD 5)`]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`1+2=3`;STAB_SYM;PROP_OPP_DIAG_5M3_03] +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_opp_v39 (scs_stab_diag_v39 scs_5M3 1 3)}` +THEN STRIP_TAC; + +MATCH_MP_TAC (GEN_ALL YXIONXL2) +THEN EXISTS_TAC`5` +THEN ASM_SIMP_TAC[SCS_K_D_A_STAB_EQ;ARITH_RULE`~(5<=3)`;K_SCS_5M3] +THEN MRESAL_TAC STAB_5M3_SCS[`1`;`3`][scs_diag;K_SCS_5M3;ARITH_RULE`~(1 MOD 5 = 3 MOD 5) /\ + ~(SUC 1 MOD 5 = 3 MOD 5) /\ + ~(1 MOD 5 = SUC 3 MOD 5)`]; + +MATCH_MP_TAC(GEN_ALL YXIONXL3) +THEN MATCH_MP_TAC (GEN_ALL OPP_IS_SCS) +THEN EXISTS_TAC`scs_opp_v39 (scs_stab_diag_v39 scs_5M3 1 3)` +THEN MRESAL_TAC STAB_5M3_SCS[`1`;`3`][scs_diag;K_SCS_5M3;ARITH_RULE`~(1 MOD 5 = 3 MOD 5) /\ + ~(SUC 1 MOD 5 = 3 MOD 5) /\ + ~(1 MOD 5 = SUC 3 MOD 5)`]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`2+2=4`;STAB_SYM] +THEN MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC STAB_5M3_SCS[`2`;`4`][scs_diag;K_SCS_5M3;ARITH_RULE`~(2 MOD 5 = 4 MOD 5) /\ + ~(SUC 2 MOD 5 = 4 MOD 5) /\ + ~(2 MOD 5 = SUC 4 MOD 5)`]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`3+2=5`;STAB_SYM] +THEN MRESAL_TAC STAB_MOD[`scs_5M3`;`5`;`3`][SCS_5M3_IS_SCS;K_SCS_5M3;ARITH_RULE`5 MOD 5=0/\ 3 MOD 5=3`] +THEN SYM_ASSUM_TAC +THEN REWRITE_TAC[ARITH_RULE`3+2=5`;STAB_SYM] +THEN MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC STAB_5M3_SCS[`3`;`0`][scs_diag;K_SCS_5M3;ARITH_RULE`~(3 MOD 5 = 0 MOD 5) /\ + ~(SUC 3 MOD 5 = 0 MOD 5) /\ + ~(3 MOD 5 = SUC 0 MOD 5)`]; + +REWRITE_TAC[ARITH_RULE`4+2=6`;] +THEN MRESAL_TAC STAB_MOD[`scs_5M3`;`6`;`4`][SCS_5M3_IS_SCS;K_SCS_5M3;ARITH_RULE`6 MOD 5=1/\ 4 MOD 5=4`] +THEN SYM_ASSUM_TAC +THEN REWRITE_TAC[PROP_OPP_DIAG_5M3_02]; + +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_opp_v39 (scs_stab_diag_v39 scs_5M3 1 4)}` +THEN STRIP_TAC; + +MATCH_MP_TAC (GEN_ALL YXIONXL2) +THEN EXISTS_TAC`5` +THEN ASM_SIMP_TAC[SCS_K_D_A_STAB_EQ;ARITH_RULE`~(5<=3)`;K_SCS_5M3] +THEN MRESAL_TAC STAB_5M3_SCS[`1`;`4`][scs_diag;K_SCS_5M3;ARITH_RULE`~(1 MOD 5 = 4 MOD 5) /\ + ~(SUC 1 MOD 5 = 4 MOD 5) /\ + ~(1 MOD 5 = SUC 4 MOD 5)`]; + +MATCH_MP_TAC(GEN_ALL YXIONXL3) +THEN MATCH_MP_TAC (GEN_ALL OPP_IS_SCS) +THEN EXISTS_TAC`scs_opp_v39 (scs_stab_diag_v39 scs_5M3 1 4)` +THEN MRESAL_TAC STAB_5M3_SCS[`1`;`4`][scs_diag;K_SCS_5M3;ARITH_RULE`~(1 MOD 5 = 4 MOD 5) /\ + ~(SUC 1 MOD 5 = 4 MOD 5) /\ + ~(1 MOD 5 = SUC 4 MOD 5)`]]);; + + + +let SET_EQ_DIAG_STAB_5M3_IMP_SCS_3_4=prove(`scs_arrow_v39 {scs_stab_diag_v39 scs_5M3 i j | scs_diag 5 i j} +{scs_4M6',scs_4M7,scs_4M8,scs_3T1,scs_3T4}`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_stab_diag_v39 scs_5M3 0 2, scs_stab_diag_v39 scs_5M3 0 3, scs_stab_diag_v39 + scs_5M3 + 2 + 4}` +THEN ASM_REWRITE_TAC[SET_EQ_DIAG_STAB_5M3;SET_RULE`{scs_4M6', scs_4M7, scs_4M8, scs_3T1, scs_3T4}= {scs_3T4, scs_4M6'}UNION{scs_4M7,scs_3T1}UNION{ scs_3T1,scs_4M8}`] +THEN REWRITE_TAC[SET_RULE`{A,B,C}={A}UNION{B}UNION{C}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN REWRITE_TAC[SCS_5M3_02_ARROW_3T4_4M6] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN REWRITE_TAC[SCS_5M3_03_ARROW_3T1_4M7;SCS_5M3_24_ARROW_3T1_4M8]);; + +(**************) + +let h0_LT_B_SCS_5M2=prove(` +(!i j. scs_diag 5 i j ==> &4 * h0 < scs_b_v39 scs_5M2 i j) +/\ (!i j. scs_diag 5 i j ==> scs_a_v39 scs_5M2 i j <= cstab)`, +SCS_TAC +THEN REWRITE_TAC[h0;scs_diag;cstab] +THEN REPEAT RESA_TAC +THEN MP_TAC DIAG_5_EQU_PSORT +THEN RESA_TAC +THEN REWRITE_TAC[PAIR_EQ;] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + +let B_LE_CSTAB_5M2=prove(` +(!i. scs_b_v39 scs_5M2 i (SUC i) <= cstab)/\ +(!i. scs_a_v39 scs_5M2 i (SUC i) = &2) +`, +SCS_TAC +THEN SIMP_TAC[ARITH_RULE`1<5`;Qknvmlb.SUC_MOD_NOT_EQ;h0;cstab] +THEN REPEAT RESA_TAC +THEN MRESAS_TAC PSORT_MOD[`5`;`i`;`SUC i`][ARITH_RULE`~(5=0)`] +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`i`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 5<5==> i MOD 5=0\/ i MOD 5=1\/ i MOD 5=2\/ i MOD 5=3\/i MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + +let B_LE_CSTAB_5M2_A_LT_B=prove(` +(!i. &2 < scs_b_v39 scs_5M2 i (SUC i)) +`, +SCS_TAC +THEN SIMP_TAC[ARITH_RULE`1<5`;Qknvmlb.SUC_MOD_NOT_EQ;h0;cstab] +THEN REPEAT RESA_TAC +THEN MRESAS_TAC PSORT_MOD[`5`;`i`;`SUC i`][ARITH_RULE`~(5=0)`] +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`i`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 5<5==> i MOD 5=0\/ i MOD 5=1\/ i MOD 5=2\/ i MOD 5=3\/i MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + + + + + +let CARD_SCS_M_5M2=prove(`CARD (scs_M scs_5M2) <= 1`, +ASM_SIMP_TAC[ARITH_RULE`1<5`;Qknvmlb.SUC_MOD_NOT_EQ;REAL_ARITH`~(a x=0\/ x=1\/x=2\/ x=3\/ x=4`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PSORT_5_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_5_TAC;REAL_ARITH`~(a x=0\/ x=1\/x=2\/ x=3\/ x=4`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PSORT_5_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_5_TAC;REAL_ARITH`~(a(!s (v:num->real^3) i. + 3< scs_k_v39 s/\ + is_scs_v39 s /\ v IN MMs_v39 s /\ scs_generic v /\ scs_basic_v39 s /\ + ( dist(v i,v (i+1)) = &2) /\ + CARD (scs_M s) <= 1 /\ + (!i j. scs_diag (scs_k_v39 s) i j ==> (scs_a_v39 s i j <= cstab /\ cstab < dist(v i, v j) /\ &4 * h0 < scs_b_v39 s i j)) /\ +(!i. scs_a_v39 s i (i+1)< scs_b_v39 s i (i+1)) +==> + (?i1. ~(i1 MOD scs_k_v39 s IN scs_M s)/\ dist(v i1, v (i1+1)) = &2))`, +[STRIP_TAC +THEN REPEAT GEN_TAC +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN ABBREV_TAC`V= IMAGE (v:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((v:num->real^3) i, v (SUC i))) (:num)` +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`i MOD k IN scs_M s\/ ~(i MOD k IN scs_M s)`) +THEN RESA_TAC; + +SUBGOAL_THEN`scs_M s={i MOD k}`ASSUME_TAC; + +MRESAS_TAC CARD_SUBSET_LE[`{i MOD k}`;`scs_M s`][Jlxfdmj.FINITE_SCS_M;SET_RULE`a IN A==> {a} SUBSET A`;Geomdetail.CARD_SING]; + +MRESA_TAC Jlxfdmj.SCS_M_EQ_1[`i MOD k`;`s`] +THEN THAYTHES_TAC 0[`SUC i`][SET_RULE`(SUC i MOD k = i MOD k)<=> (i MOD k = SUC i MOD k)`;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`3 1 &2 < scs_b_v39 s i (i + 1)`) +THEN RESA_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`SUC i` +THEN ASM_SIMP_TAC[Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`3 1 ~(b=a)`;ARITH_RULE`SUC i= i+1/\ (i + 1) + 1= i+2`]; + +EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]]);; + + + + +let JCYFMRP_V2 = prove_by_refinement( +`main_nonlinear_terminal_v11 +==>(!s (v:num->real^3) i. + 3< scs_k_v39 s/\ + is_scs_v39 s /\ v IN MMs_v39 s /\ scs_generic v /\ scs_basic_v39 s /\ + ( dist(v i,v (i+1)) = &2) /\ + CARD (scs_M s) <= 1 /\ + (!i j. scs_diag (scs_k_v39 s) i j ==> (scs_a_v39 s i j <= cstab /\ cstab < dist(v i, v j) /\ &4 * h0 < scs_b_v39 s i j)) /\ +(!i. scs_a_v39 s i (i+1)< scs_b_v39 s i (i+1)) +==> + (?i1. scs_b_v39 s i1 (SUC i1) <= &2 * h0/\ scs_a_v39 s i1 (SUC i1) = &2/\ dist(v i1, v (i1+1)) = &2))`, +[STRIP_TAC +THEN REPEAT GEN_TAC +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN ABBREV_TAC`V= IMAGE (v:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((v:num->real^3) i, v (SUC i))) (:num)` +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`i MOD k IN scs_M s\/ ~(i MOD k IN scs_M s)`) +THEN RESA_TAC; + +SUBGOAL_THEN`scs_M s={i MOD k}`ASSUME_TAC; + +MRESAS_TAC CARD_SUBSET_LE[`{i MOD k}`;`scs_M s`][Jlxfdmj.FINITE_SCS_M;SET_RULE`a IN A==> {a} SUBSET A`;Geomdetail.CARD_SING]; + +MRESA_TAC Jlxfdmj.SCS_M_EQ_1[`i MOD k`;`s`] +THEN THAYTHES_TAC 0[`SUC i`][SET_RULE`(SUC i MOD k = i MOD k)<=> (i MOD k = SUC i MOD k)`;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`3 1 &2 < scs_b_v39 s i (i + 1)`) +THEN RESA_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`SUC i` +THEN ASM_SIMP_TAC[Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`3 1 ~(b=a)`;ARITH_RULE`SUC i= i+1/\ (i + 1) + 1= i+2`]; + +EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`CARD (scs_M s)<= 1==> CARD (scs_M s)= 0\/ CARD (scs_M s)=1`) +THEN RESA_TAC; + +MP_TAC Jlxfdmj.SCS_M_EQ_0 +THEN RESA_TAC; + +MRESAS_TAC Local_lemmas.FINITE_CARD1_IMP_SINGLETON[`scs_M s`][Jlxfdmj.FINITE_SCS_M;SET_RULE`~(a IN {x})<=> ~(a=x)`] +THEN STRIP_TAC +THEN MP_TAC Jlxfdmj.SCS_M_EQ_1 +THEN RESA_TAC +THEN THAYTHE_TAC 0[`i`]]);; + + + + + +let JCYFMRP_V3=prove(`main_nonlinear_terminal_v11 +==>(!s (v:num->real^3). + 3< scs_k_v39 s/\ + is_scs_v39 s /\ v IN MMs_v39 s /\ scs_generic v /\ scs_basic_v39 s /\ + CARD (scs_M s) <= 1 /\ + (!i j. scs_diag (scs_k_v39 s) i j ==> (scs_a_v39 s i j <= cstab /\ cstab < dist(v i, v j) /\ &4 * h0 < scs_b_v39 s i j)) /\ +(!i. scs_a_v39 s i (i+1)< scs_b_v39 s i (i+1)) /\ +(!i. scs_a_v39 s i (SUC i) = &2) +==> + (?i. scs_b_v39 s i (SUC i) <= &2 * h0/\ scs_a_v39 s i (SUC i) = &2/\ dist(v i, v (i+1)) = &2))`, +REPEAT RESA_TAC +THEN MP_TAC Jcyfmrp.JCYFMRP +THEN RESA_TAC +THEN THAYTHE_TAC 0[`s`;`v`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[] +THEN STRIP_TAC +THEN MP_TAC JCYFMRP_V2 +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN THAYTHE_TAC 0[`s`;`v`;`i`]);; + + +(*********************) + +let ARC_222=prove(`arclength (&2) (&2) (&2)= pi/ &3`, +MRESAS_TAC Trigonometry.PQQDENV[`&2`;`&2`;`&2`][REAL_ARITH`&0 < &2 /\ &0 < &2 /\ &0 <= &2 /\ &2 <= &2 + &2/\ (&2 * &2 + &2 * &2 - &2 * &2) / (&2 * &2 * &2)= &1/ &2`;Nonlinear_lemma.ACS_2]);; + + + +let xrr_le_1553=prove(` v IN ball_annulus/\ u IN ball_annulus/\ w IN ball_annulus +/\ ~collinear {vec 0, v, u} +/\ dist(v,w)= &2/\ dist(w,u)= &2 +==> +xrr (norm v) (norm u) (norm(v-u))<= #15.53`, +REPEAT RESA_TAC +THEN MRESA_TAC Counting_spheres.ckq_in_ball_annulus[`v`] +THEN MRESA_TAC Counting_spheres.ckq_in_ball_annulus[`u`] +THEN MRESA_TAC Counting_spheres.ckq_in_ball_annulus[`w`] +THEN MRESA_TAC Trigonometry2.ARCV_INEQUALTY[`vec 0:real^3`;`v`;`u`;`w`] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v`;`w`;`&2`][REAL_ARITH`&2 < &4 /\ &2 <= &2 `;ARC_222] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`w`;`u`;`&2`][REAL_ARITH`&2 < &4 /\ &2 <= &2 `;ARC_222] +THEN MP_TAC(REAL_ARITH`arcV (vec 0) v u <= arcV (vec 0) v w + arcV (vec 0) w u +/\ arcV (vec 0) v w <= pi / &3/\ arcV (vec 0) w u <= pi / &3 +==> arcV (vec 0:real^3) v u<= &2 * pi/ &3`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC Trigonometry1.arcVarc[`vec 0:real^3`;`v`;`u`] +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- a= --a:real^3`;NORM_NEG] +THEN MRESAL_TAC th3[`v`;`vec 0:real^3`;`u:real^3`][GSYM dist;VECTOR_ARITH`v - u = vec 0 +<=> v=u:real^3`] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`v`;`vec 0:real^3`][VECTOR_ARITH`A- vec 0=A:real^3`] +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`u`;`vec 0:real^3`][VECTOR_ARITH`A- vec 0=A:real^3`] +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`v`;`u:real^3`][VECTOR_ARITH`A- vec 0=A:real^3`] +THEN MRESAL_TAC Collect_geom2.NOT_COL_EQ_UPS_X_POS[`vec 0:real^3`;`v`;`u`][dist;VECTOR_ARITH`vec 0- a= --a:real^3`;NORM_NEG] +THEN MRESAL_TAC arclength_xrr[`norm v`;`norm u`;`norm (v- u)`][REAL_ARITH`a*a= a pow 2`] +THEN STRIP_TAC +THEN MRESAL_TAC ACS_NEG[`&1/ &2`][REAL_ARITH`-- &1 <= &1 / &2 /\ &1 / &2 <= &1/\ pi - pi / &3= &2* pi/ &3`;Nonlinear_lemma.ACS_2] +THEN MRESAL_TAC Ocbicby.xrr_bounds_2[`norm v`;`norm u`;`norm (v-u)`][REAL_ARITH`a*a= a pow 2`] +THEN MP_TAC(REAL_ARITH`&0 < xrr (norm v) (norm u) (norm (v - u))/\ +xrr (norm v) (norm u) (norm (v - u)) < &16 +==> abs (&1 - xrr (norm v) (norm u) (norm (v - u:real^3)) / &8) <= &1`) +THEN RESA_TAC +THEN MRESAL_TAC ACS_MONO_LE_EQ[`&1 - xrr (norm v) (norm u) (norm (v - u)) / &8`;`--( &1/ &2)`][REAL_ARITH`abs (--(&1 / &2)) <= &1`] +THEN DICH_TAC 0 +THEN REAL_ARITH_TAC);; + + + +let xrr_le_1553_BB=prove(`BBs_v39 s v /\ dist(v i, v (i+1))= &2/\ dist( v (i+1), v(i+2))= &2 /\ ~(collinear{vec 0 , v i, v (i+2)}) +==> xrr (norm (v i)) (norm (v (i+2))) (norm(v i- v (i+2)))<= #15.53 `, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL xrr_le_1553) +THEN EXISTS_TAC`(v:num->real^3) (i+1)` +THEN ASM_SIMP_TAC[] +THEN MRESA_TAC Nuxcoea.WL_IN_BALL_ANNULUS[`s`;`v`;`i`] +THEN MRESA_TAC Nuxcoea.WL_IN_BALL_ANNULUS[`s`;`v`;`i+1`] +THEN MRESA_TAC Nuxcoea.WL_IN_BALL_ANNULUS[`s`;`v`;`i+2`]);; + + + +(******************************) + + +let J_SCS_5M2_0=prove(`(!i j. ~scs_J_v39 scs_5M2 j i)`, +SCS_TAC);; + + + +let SCS_5M2_IMP_SCS_5T1= prove_by_refinement(`main_nonlinear_terminal_v11 +==>(!v. + v IN MMs_v39 scs_5M2 /\ + (!i j. scs_diag 5 i j ==> cstab < dist(v i,v j)) ==> + ~(MMs_v39 (scs_5T1)={}))`, +[ +REWRITE_TAC[IN;SET_RULE`~(A={})<=> ?a. a IN A`] +THEN REPEAT STRIP_TAC +THEN MP_TAC SCS_5M2_IS_SCS +THEN STRIP_TAC +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_5M2`;`v`] +THEN ASSUME_TAC SCS_5M2_BASIC +THEN ASSUME_TAC K_SCS_5M2 +THEN ASSUME_TAC SCS_5T1_BASIC +THEN ASSUME_TAC K_SCS_5T1 +THEN ASSUME_TAC SCS_5T1_IS_SCS +THEN MP_TAC Rrcwnsj.RRCWNSJ +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_5M2`;`v`][ARITH_RULE`3<5`;h0_LT_B_SCS_5M2;B_LE_CSTAB_5M2] +THEN MP_TAC JCYFMRP_V3 +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_5M2`;`v`][ARITH_RULE`3<5`;h0_LT_B_SCS_5M2;B_LE_CSTAB_5M2;IN;CARD_SCS_M_5M2;GSYM ADD1;B_LE_CSTAB_5M2_A_LT_B] +THEN MP_TAC Jlxfdmj.JLXFDMJ +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_5M2`;`v`;`i`][ARITH_RULE`3<5`;h0_LT_B_SCS_5M2;B_LE_CSTAB_5M2;CARD_SCS_M_5M2;SCS_M_5M2;IN_SING;] +THEN DICH_TAC 0 +THEN ASM_REWRITE_TAC[IN;GSYM ADD1;B_LE_CSTAB_5M2;B_LE_CSTAB_5M2_A_LT_B] +THEN STRIP_TAC +THEN ABBREV_TAC`V=(IMAGE (v:num->real^3) (:num))` +THEN ABBREV_TAC`E=(IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num))` +THEN ABBREV_TAC`FF=IMAGE (\i. ((v:num->real^3) i, v (SUC i))) (:num)` +THEN SUBGOAL_THEN`dist((v:num->real^3) 0, v 1)= &2`ASSUME_TAC; + + + +ASSUME_TAC(ARITH_RULE`3<5/\ 0+1=1/\ 0+5-1=4`) +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`5`;`scs_5M2`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC WL_IN_V[`0`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`1`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`2`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`3`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`4`;`v:num->real^3`] +THEN MRESAL_TAC Rrcwnsj.BB_RHO_NODE_IVS[`V`;`E`;`scs_5M2`;`FF`;`v (0)`;`v`;`0`;`5`][] +THEN MRESA_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v 0`] +THEN THAYTHE_TAC 0[`v 4`] +THEN MP_TAC(REAL_ARITH`azim (vec 0) (v 0) (v 1) (v 4) <= pi +==> azim (vec 0) ((v:num->real^3) 0) (v 1) (v 4) = pi\/ azim (vec 0) (v 0) (v 1) (v 4) < pi`) +THEN RESA_TAC; + + + + + + +DICH_TAC(29-10) +THEN REWRITE_TAC[scs_generic] +THEN RESA_TAC +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`scs_5M2`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v 1`;`v 4`;`V`] +THEN THAYTHEL_ASM_TAC 0[`v 1`;`v 4`][SET_RULE`a IN {a,b}`;BB_VV_FUN_EQ;Uxckfpe.ARITH_5_TAC] +THEN SUBGOAL_THEN`(!j. ~(j MOD 5 = 4 MOD 5) ==> ~collinear {vec 0, v 4, (v:num->real^3)j})`ASSUME_TAC +; + + +REPEAT RESA_TAC +THEN DICH_TAC 0 +THEN THAYTHE_TAC 1[`v 4`;`v j`] +THEN MATCH_DICH_TAC 0 +THEN REWRITE_TAC[SET_RULE`a IN {b,a}`] +THEN MRESA_TAC WL_IN_V[`j`;`v:num->real^3`] +; + +THAYTHEL_ASM_TAC (33-30)[`4+1`;`0`][ARITH_RULE`( 4+1) MOD 5 = 0 MOD 5`] +THEN THAYTHEL_ASM_TAC 0[`4+2`;`1`][ARITH_RULE`( 4+2) MOD 5 = 1 MOD 5`] +THEN MRESA_TAC Local_lemmas1.AZIM_COND_FOR_COPLANAR[`vec 0:real^3`;`v 0`;`v 1`;`(v:num->real^3) 4`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN STRIP_TAC +THEN MRESA_TAC Iunbuig.coplanar_aff_gt_simple[`scs_5M2`;`5`;`v`;`4`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`(!i. scs_diag 5 0 i ==> scs_a_v39 scs_5M2 0 i < dist ((v:num->real^3) 0,v i))`ASSUME_TAC; + + +REPEAT RESA_TAC +THEN THAYTHE_TAC(38-2)[`0`;`i'`] +THEN MP_TAC h0_LT_B_SCS_5M2 +THEN STRIP_TAC +THEN THAYTHE_TAC 0[`0`;`i'`] +THEN DICH_TAC 0 +THEN DICH_TAC 1 +THEN REAL_ARITH_TAC; + +MRESAL_TAC MMS_IMP_BBPRIME[`scs_5M2`;`v`][LET_DEF;LET_END_DEF;BBprime_v39] +THEN MRESAL_TAC JKQEWGV2[`scs_5M2`;`v`][LET_DEF;LET_END_DEF;scs_generic] +THEN MP_TAC Wrgcvdr_cizmrrh.CIZMRRH +THEN RESA_TAC +THEN SUBGOAL_THEN`(!V' E' v1. V' = V /\ E' = E ==> ~lunar (v1,(v:num->real^3) 0) V E)`ASSUME_TAC +; + +REPEAT RESA_TAC +THEN DICH_TAC 3 +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v1:real^3` +THEN EXISTS_TAC`(v:num->real^3)0` +THEN ASM_REWRITE_TAC[] +; + + + +MRESAS_TAC NUXCOEAv2[`scs_5M2`;`5`;`v`;`0`;`4`][ARITH_RULE`SUC 0=1/\ SUC 4 MOD 5 = 0 MOD 5`;h0_LT_B_SCS_5M2;B_LE_CSTAB_5M2;J_SCS_5M2_0] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN MATCH_MP_TAC(SET_RULE`(A==> (B/\A1==>C)==>D)==> (A==>(B/\ A1/\A==>C)==>D)`) +THEN STRIP_TAC +THEN SCS_TAC +THEN THAYTHES_TAC(43-12)[`4`][ARITH_RULE`~(4 MOD 5=0)/\ SUC A= A+1`;h0] +THEN REAL_ARITH_TAC; + + + + + +ASSUME_TAC(ARITH_RULE`1+1=2/\ 1+5-1=5`) +THEN MRESAL_TAC Rrcwnsj.BB_RHO_NODE_IVS[`V`;`E`;`scs_5M2`;`FF`;`v (1)`;`v`;`1`;`5`][] +THEN MRESA_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v 1`] +THEN THAYTHE_TAC 0[`v 0`] +THEN MP_TAC(REAL_ARITH`azim (vec 0) (v 1) (v 2) (v 0) <= pi +==> azim (vec 0) ((v:num->real^3) 1) (v 2) (v 0) = pi\/ azim (vec 0) (v 1) (v 2) (v 0) < pi`) +THEN RESA_TAC; + + + + + + +DICH_TAC(34-10) +THEN REWRITE_TAC[scs_generic] +THEN RESA_TAC +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`scs_5M2`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v 2`;`v 0`;`V`] +THEN THAYTHEL_ASM_TAC 0[`v 2`;`v 0`][SET_RULE`a IN {a,b}`;BB_VV_FUN_EQ;Uxckfpe.ARITH_5_TAC] +THEN SUBGOAL_THEN`(!j. ~(j MOD 5 = 0 MOD 5) ==> ~collinear {vec 0, v 0, (v:num->real^3)j})`ASSUME_TAC +; + + +REPEAT RESA_TAC +THEN DICH_TAC 0 +THEN THAYTHE_TAC 1[`v 0`;`v j`] +THEN MATCH_DICH_TAC 0 +THEN REWRITE_TAC[SET_RULE`a IN {b,a}`] +THEN MRESA_TAC WL_IN_V[`j`;`v:num->real^3`] +; + +MRESA_TAC Local_lemmas1.AZIM_COND_FOR_COPLANAR[`vec 0:real^3`;`v 1`;`v 2`;`(v:num->real^3) 0`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN STRIP_TAC +THEN MRESAL_TAC Iunbuig.coplanar_aff_gt_simple[`scs_5M2`;`5`;`v`;`0`][ARITH_RULE`0+2=2`]THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`(!i. scs_diag 5 1 i ==> scs_a_v39 scs_5M2 1 i < dist ((v:num->real^3) 1,v i))`ASSUME_TAC; + + +REPEAT RESA_TAC +THEN THAYTHE_TAC(41-2)[`1`;`i'`] +THEN MP_TAC h0_LT_B_SCS_5M2 +THEN STRIP_TAC +THEN THAYTHE_TAC 0[`1`;`i'`] +THEN DICH_TAC 0 +THEN DICH_TAC 1 +THEN REAL_ARITH_TAC; + +MRESAL_TAC MMS_IMP_BBPRIME[`scs_5M2`;`v`][LET_DEF;LET_END_DEF;BBprime_v39] +THEN MRESAL_TAC JKQEWGV2[`scs_5M2`;`v`][LET_DEF;LET_END_DEF;scs_generic] +THEN MP_TAC Wrgcvdr_cizmrrh.CIZMRRH +THEN RESA_TAC +THEN SUBGOAL_THEN`(!V' E' v1. V' = V /\ E' = E ==> ~lunar (v1,(v:num->real^3) 1) V E)`ASSUME_TAC +; + +REPEAT RESA_TAC +THEN DICH_TAC 3 +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v1:real^3` +THEN EXISTS_TAC`(v:num->real^3)1` +THEN ASM_REWRITE_TAC[] +; + + + +MRESAS_TAC NUXCOEAv2[`scs_5M2`;`5`;`v`;`1`;`2`][ARITH_RULE`SUC 1=2/\ SUC 4 MOD 5 = 0 MOD 5`;h0_LT_B_SCS_5M2;B_LE_CSTAB_5M2;J_SCS_5M2_0] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN THAYTHEL_TAC(45-35)[`5`;`0`][ARITH_RULE`5 MOD 5 = 0 MOD 5`] +THEN MATCH_MP_TAC(SET_RULE`(A==> (B/\A1==>C)==>D)==> (A==>(B/\ A1/\A==>C)==>D)`) +THEN STRIP_TAC +THEN SCS_TAC +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN THAYTHES_TAC(46-12)[`1`][ARITH_RULE`~(1 MOD 5=0)/\ SUC A= A+1`;h0] +THEN REAL_ARITH_TAC; + + +MP_TAC Iunbuig.IUNBUIG +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN EXISTS_TAC`scs_5M2` +THEN EXISTS_TAC`FF:real^3#real^3->bool` +THEN ASM_SIMP_TAC[h0_LT_B_SCS_5M2;B_LE_CSTAB_5M2;GSYM ADD1] +THEN SCS_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`a<=a`;interior_angle1;GSYM ivs_rho_node1] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`scs_5M2`] +THEN THAYTHEL_TAC 0[`5`;`0`][ARITH_RULE`5 MOD 5 = 0 MOD 5`] +THEN THAYTHEL_ASM_TAC (35-13)[`3`][ARITH_RULE`~(3 MOD 5= 0)/\ SUC 3=4`] +THEN THAYTHEL_ASM_TAC (0)[`4`][ARITH_RULE`~(4 MOD 5= 0)/\ SUC 4=5`] +THEN THAYTHEL_ASM_TAC (0)[`1`][ARITH_RULE`~(1 MOD 5= 0)/\ SUC 1=2`] +THEN THAYTHEL_ASM_TAC (0)[`2`][ARITH_RULE`~(2 MOD 5= 0)/\ SUC 2=3`] +THEN DICH_TAC (39-10) +THEN REWRITE_TAC[scs_generic] +THEN RESA_TAC +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`scs_5M2`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v 0`;`v 3`;`V`] +THEN THAYTHEL_ASM_TAC 0[`v 3`;`v 0`][SET_RULE`a IN {b,a}`;BB_VV_FUN_EQ;Uxckfpe.ARITH_5_TAC] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v 1`;`v 3`;`V`] +THEN THAYTHEL_ASM_TAC 0[`v 1`;`v 3`][SET_RULE`a IN {a,b}`;BB_VV_FUN_EQ;Uxckfpe.ARITH_5_TAC] +THEN MRESAL_TAC xrr_le_1553_BB[`scs_5M2`;`v`;`3`][ARITH_RULE`3+1=4/\ 3+2=5`] +THEN MRESAL_TAC xrr_le_1553_BB[`scs_5M2`;`v`;`1`][ARITH_RULE`1+1=2/\ 1+2=3`;GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN DICH_TAC 1 +THEN REWRITE_TAC[xrr;dist] +THEN REAL_ARITH_TAC +; + + +SUBGOAL_THEN`!j. dist ((v:num->real^3) j,v (SUC j)) = &2`ASSUME_TAC +; + +GEN_TAC +THEN MP_TAC(SET_RULE`~(j MOD 5 = 0) \/ (j MOD 5 = 0)`) +THEN RESA_TAC; + + +MATCH_DICH_TAC (18-13) +THEN ASM_REWRITE_TAC[]; + + +MRESA_TAC BB_VV_FUN_EQ[`v`;`scs_5M2`] +THEN THAYTHEL_ASM_TAC 0[`j`;`0`][ARITH_RULE`0 MOD 5=0`] +THEN THAYTHES_TAC 0[`SUC j`;`SUC 0`][ARITH_RULE`~(5=0)/\ SUC i= 1+i/\ 0 MOD 5=0`;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN ASM_REWRITE_TAC[ARITH_RULE`1+0=1`]; + + + + +MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN REWRITE_TAC[IN;SET_RULE`~(A={})<=> ?a. a IN A`] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_5M2` +THEN ASM_SIMP_TAC[SCS_M_5M2] +THEN STRIP_TAC +; + + + +DICH_TAC(18-4) +THEN REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;scs_diag;ARITH_RULE`(~(5<=3))`;IN;K_SCS_4M8_prime;K_SCS_4M8;scs_prop_equ_v39;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN SCS_TAC +THEN REWRITE_TAC[ARITH_RULE`~(5<=3)`]; + +REPEAT STRIP_TAC +; + + +MP_TAC(SET_RULE`i' MOD 5 = j MOD 5\/ ~(i' MOD 5 = j MOD 5)`) +THEN RESA_TAC; + +THAYTHE_TAC 2[`i'`;`j`] +; + +MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_5M2`;`v`] +THEN MP_TAC(SET_RULE`SUC i' MOD 5 = j MOD 5\/ ~(SUC i' MOD 5 = j MOD 5)`) +THEN RESA_TAC; + + +MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`j:num`;`v`;` SUC i'`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`;] +THEN REAL_ARITH_TAC; + + +MP_TAC(SET_RULE`i' MOD 5 =SUC j MOD 5\/ ~(i' MOD 5 =SUC j MOD 5)`) +THEN RESA_TAC; + + +MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`i':num`;`v`;` SUC j`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`;] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; + + +THAYTHEL_TAC (25-2)[`i'`;`j`][scs_diag] +THEN DICH_TAC 0 +THEN REAL_ARITH_TAC; + + + +MP_TAC(SET_RULE`i' MOD 5 = j MOD 5\/ ~(i' MOD 5 = j MOD 5)`) +THEN RESA_TAC; + +THAYTHE_TAC 2[`i'`;`j`] +; + + + +MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_5M2`;`v`] +THEN MP_TAC(SET_RULE`SUC i' MOD 5 = j MOD 5\/ ~(SUC i' MOD 5 = j MOD 5)`) +THEN RESA_TAC; + + +MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`j:num`;`v`;` SUC i'`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`;] +THEN REAL_ARITH_TAC; + + + +MP_TAC(SET_RULE`i' MOD 5 =SUC j MOD 5\/ ~(i' MOD 5 =SUC j MOD 5)`) +THEN RESA_TAC; + + +MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_5M2`;`i':num`;`v`;` SUC j`][SCS_5M2_IS_SCS;K_SCS_5M2;MOD_REFL;ARITH_RULE`~(5=0)`;] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; + +THAYTHE_TAC (25-20)[`i'`;`j`] +THEN DICH_TAC 0 +THEN MP_TAC(SET_RULE`psort 5 (i',j) = 0,1\/ ~(psort 5 (i',j) = 0,1)`) +THEN RESA_TAC; + + +MRESAL_TAC Uaghhbm.CASE_PSORT[`i'`;`1`;`j`;`0`;`5`][PSORT_5_EXPLICIT]; + + +DICH_TAC (28-23) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[ARITH_RULE`1= 1+0`] +THEN ASM_SIMP_TAC[ARITH_RULE`SUC i= 1+i`;ARITH_RULE`~(5=0)/\ SUC i= 1+i/\ 0 MOD 5=0`;Ocbicby.MOD_EQ_MOD_SHIFT]; + + +DICH_TAC (28-24) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[ARITH_RULE`1= 1+0`] +THEN ASM_SIMP_TAC[ARITH_RULE`SUC i= 1+i`;ARITH_RULE`~(5=0)/\ SUC i= 1+i/\ 0 MOD 5=0`;Ocbicby.MOD_EQ_MOD_SHIFT]; + +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN REAL_ARITH_TAC; + +]);; + + + +let HIJ_STEP_1=prove_by_refinement(`main_nonlinear_terminal_v11 + ==> +(scs_arrow_v39 + {scs_5M2 } +({ scs_5T1} UNION { scs_stab_diag_v39 scs_5I2 i j| scs_diag 5 i j } +UNION { scs_stab_diag_v39 scs_5I3 i j| scs_diag 5 i j } +UNION { scs_stab_diag_v39 scs_5M3 i j| scs_diag 5 i j }))`, +[ +REPEAT GEN_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;IN_ELIM_THM;UNION] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + + +REWRITE_TAC[SCS_5T1_IS_SCS]; + +ASM_SIMP_TAC[ STAB_5I2_SCS;K_SCS_5I2] +; + +ASM_SIMP_TAC[ STAB_5I3_SCS;K_SCS_5I3] +; + + +ASM_SIMP_TAC[ STAB_5M3_SCS;K_SCS_5M3] +; + + + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_5M2 ==> MMs_v39 s = {}) \/ ~((!s. s = scs_5M2 ==> MMs_v39 s = {}))`); + + +ASM_REWRITE_TAC[]; + + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC; + + + +MP_TAC(SET_RULE`(!i j. scs_diag 5 i j ==> cstab < dist(v i,v j))\/ ~((!i j. scs_diag 5 i j ==> cstab < dist((v:num->real^3) i,v j)))`) +THEN RESA_TAC; + + +EXISTS_TAC`scs_5T1` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC SCS_5M2_IMP_SCS_5T1 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[] +; + + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;REAL_ARITH`~(a b<=a`] +THEN STRIP_TAC +; + +MP_TAC(SET_RULE` (!i. dist(v i, v(i+1))<= &2 * h0) +\/ ~ (!l. dist((v:num->real^3) l, v(l+1))<= &2 * h0) +`) +THEN RESA_TAC; + + + + +EXISTS_TAC`scs_stab_diag_v39 scs_5I2 i j` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +MATCH_MP_TAC(SET_RULE`A==> B\/A\/C\/D`) +THEN EXISTS_TAC`i:num` +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[] +; + +MP_TAC MM_5M2_IMP_MM_STAB_5I2 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_REWRITE_TAC[] +; + + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;REAL_ARITH`~(a<=b)<=> breal^3) l, v(l+1))<= sqrt8\/ sqrt8<= dist(v l, v(l+1))`) +THEN RESA_TAC; + + + +EXISTS_TAC`scs_stab_diag_v39 scs_5I3 i j` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +MATCH_MP_TAC(SET_RULE`A==> B\/C\/A\/D`) +THEN EXISTS_TAC`i:num` +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[] +; + +MP_TAC MM_5M2_IMP_MM_STAB_5I3 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_REWRITE_TAC[] +; + + + + +EXISTS_TAC`scs_stab_diag_v39 scs_5M3 i j` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +MATCH_MP_TAC(SET_RULE`A==> B\/C\/D\/A`) +THEN EXISTS_TAC`i:num` +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[] +; + +MP_TAC MM_5M2_IMP_MM_STAB_5M3 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_REWRITE_TAC[] +; +]);; + + + +let HIJQAHA=prove_by_refinement(`main_nonlinear_terminal_v11 + ==> +(scs_arrow_v39 + {scs_5M2 } +({ scs_5T1, scs_stab_diag_v39 scs_5I2 0 2, +scs_stab_diag_v39 scs_5M1 0 2, scs_stab_diag_v39 scs_5M1 0 3, + scs_stab_diag_v39 scs_5M1 2 + 4,scs_4M6',scs_4M7,scs_4M8,scs_3T1,scs_3T4 +}))`, +[ +STRIP_TAC +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`({ scs_5T1} UNION { scs_stab_diag_v39 scs_5I2 i j| scs_diag 5 i j } +UNION { scs_stab_diag_v39 scs_5I3 i j| scs_diag 5 i j } +UNION { scs_stab_diag_v39 scs_5M3 i j| scs_diag 5 i j })` +THEN ASM_SIMP_TAC[HIJ_STEP_1;SET_RULE`{scs_5T1, scs_stab_diag_v39 scs_5I2 0 2, scs_stab_diag_v39 scs_5M1 0 2, scs_stab_diag_v39 scs_5M1 0 3, + scs_stab_diag_v39 scs_5M1 2 + 4, scs_4M6', scs_4M7, scs_4M8, scs_3T1, scs_3T4} +={scs_5T1}UNION{ scs_stab_diag_v39 scs_5I2 0 2}UNION{ scs_stab_diag_v39 scs_5M1 0 2, scs_stab_diag_v39 scs_5M1 0 3, + scs_stab_diag_v39 scs_5M1 2 + 4}UNION{ scs_4M6', scs_4M7, scs_4M8, scs_3T1, scs_3T4}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[SCS_5T1_IS_SCS]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[SET_EQ_DIAG_STAB_5I2]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[SET_EQ_DIAG_STAB_5M3_IMP_SCS_3_4] +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_stab_diag_v39 scs_5M1 i j | scs_diag 5 i j}` +THEN ASM_REWRITE_TAC[Otmtotj.STAB_5I3_ARROW_STAB_5M1_DIAG;Otmtotj.SET_EQ_DIAG_STAB_5M1]]);; + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/HXHYTIJ.hl b/text_formalization/local/HXHYTIJ.hl new file mode 100755 index 0000000..312082f --- /dev/null +++ b/text_formalization/local/HXHYTIJ.hl @@ -0,0 +1,131 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Hxhytij = struct + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + +open Uxckfpe;; +open Sgtrnaf;; + + + + +let HXHYTIJ= prove_by_refinement(`!s vv ww. + is_scs_v39 s /\ + BBprime2_v39 s vv /\ + BBs_v39 s ww ==> + (taustar_v39 s vv < taustar_v39 s ww \/ + BBindex_v39 s vv <= BBindex_v39 s ww)`, +[REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`(taustar_v39 s vv < taustar_v39 s ww)\/ taustar_v39 s ww <= taustar_v39 s vv`) +THEN RESA_TAC +THEN SUBGOAL_THEN`BBprime_v39 s ww` ASSUME_TAC; + +ASM_TAC +THEN ASM_REWRITE_TAC[IN;BBprime_v39;BBprime2_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;restriction_cs1_v39] +THEN REPEAT RESA_TAC; + +REPLICATE_TAC (7-2)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th`ww':num->real^3`) +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +REPLICATE_TAC (6-2)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th`ww:num->real^3`) +THEN ASM_TAC +THEN REAL_ARITH_TAC; + +ASM_TAC +THEN ASM_REWRITE_TAC[IN;BBprime2_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;restriction_cs1_v39;BBindex_min_v39] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`(BBindex_v39 s ww) IN IMAGE (BBindex_v39 s) (BBprime_v39 s)` ASSUME_TAC; + +REWRITE_TAC[IMAGE;IN_ELIM_THM;IN] +THEN EXISTS_TAC`ww:num->real^3` +THEN ASM_REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MRESA_TAC Misc_defs_and_lemmas.min_least[`(IMAGE (BBindex_v39 s) (BBprime_v39 s))`;`BBindex_v39 s ww`]]);; + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/IMJXPHR.hl b/text_formalization/local/IMJXPHR.hl new file mode 100755 index 0000000..d2525e9 --- /dev/null +++ b/text_formalization/local/IMJXPHR.hl @@ -0,0 +1,11657 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Imjxphr = struct + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +open Yxionxl2;; +open Eyypqdw;; +open Ocbicby;; + + +let v3_defor_v4=new_definition`v3_defor_v4 a x1 x2 x6 v1 w v t= +if v= w then (v3_defor_v1 a v1 w x1 x2 x6 x6 (x2-t)) else v`;; + + +let FUN_V3_DEFOR=prove(`v3_defor_v4 a x1 x2 x6 v1 w v = (\t. v3_defor_v4 a x1 x2 x6 v1 w v t)`,REWRITE_TAC[FUN_EQ_THM]);; + + + + + +let BBS_IMP_CONVEX_LOCAL_FAN=prove(` 3 convex_local_fan (IMAGE w (:num),IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num),IMAGE (\i. w i,w (SUC i)) (:num))`, +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0 ~((l+k-1) MOD k= l MOD k)`, +STRIP_TAC +THEN MP_TAC(ARITH_RULE`1 ~(k=0)/\ 1 + l + k - 1=1*k+l/\ 1+l= SUC(l)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`l:num`] +THEN MRESA_TAC (Ocbicby.MOD_EQ_MOD_SHIFT)[`k:num`;`l+k-1`;`l:num`;`1`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[Qknvmlb.SUC_MOD_NOT_EQ]);; + + + + +let UPS_X_POS_SEG=prove(`~(collinear{vec 0,v1,v2:real^3}) /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ &0< x2 +==> ?e. &0< e/\ (!t. -- e< t/\ t< e ==> &0< ups_x x1 (x2-t) x6/\ &0< x2-t)`, +STRIP_TAC +THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`v2:real^3`] +THEN MRESAL_TAC (GEN_ALL Trigonometry1.DIST_UPS_X_POS)[`vec 0:real^3`;`v1:real^3`;`v2:real^3`][dist;VECTOR_ARITH`vec 0- A= --A/\ A- vec 0=A:real^3`;GSYM DOT_SQUARE_NORM;NORM_NEG] +THEN MRESAL_TAC Collect_geom.FHFMKIY[`vec 0:real^3`;`v1:real^3`;`v2:real^3`;`x1:real`;`x2:real`;`x6:real`][dist;VECTOR_ARITH`vec 0- A= --A/\ A- vec 0=A:real^3`;GSYM DOT_SQUARE_NORM;NORM_NEG] +THEN MP_TAC LIFT_UPS_CONTINUOUS +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[continuous_atreal;o_DEF;DIST_LIFT] +THEN ABBREV_TAC`a=ups_x x1 x2 x6` +THEN ABBREV_TAC`b= min a x2` +THEN MP_TAC(REAL_ARITH`&0<= a/\ ~(a= &0)/\ &0 &0 MRESA_TAC th[`b/ &2`]) +THEN EXISTS_TAC`min d x2:real` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0 &0< min d x2`) +THEN RESA_TAC +THEN GEN_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC THEN STRIP_TAC THEN MRESA_TAC th[`x2-t:real`]) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[GSYM REAL_ABS_BETWEEN;REAL_ARITH`x2 - d < x2 - t<=> t --d t < d /\ --d < t/\ &0< x2-t`) +THEN RESA_TAC +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + + + +let UPS_X_POS_SEG_C=prove(`~(collinear{vec 0,v1,v2:real^3}) /\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ &0< x2/\ &0 ?e. &0< e/\ (!t. -- e< t/\ t< e ==> &0< ups_x x1 (x2-t) x6/\ &0< x2-t/\ t &0 MRESA_TAC th[`b/ &2`]) +THEN ABBREV_TAC`e1=min (min d x2) c/ &2` +THEN EXISTS_TAC`e1:real` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0 &0 REPEAT DISCH_TAC THEN MRESA_TAC th[`x2-t:real`]) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[GSYM REAL_ABS_BETWEEN;REAL_ARITH`x2 - d < x2 - t<=> t --d t < d /\ --d < t/\ &0< x2-t/\ t v3_defor_v1 a v1 w x1 x2 x6 x6 (x2 - &0) = w`, +STRIP_TAC +THEN ASM_REWRITE_TAC[v3_defor_v1;CROSS_LAGRANGE;REAL_ARITH`A- &0=A`] +THEN ASM_REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL; DOT_RMUL;DOT_CROSS_SELF;REAL_ARITH`A* &0= &0/\ A+ &0=A/\ &0 +A=A`;DOT_CROSS;REAL_INV_MUL;CROSS_LAGRANGE;CROSS_LADD;VECTOR_ARITH`A-B=A+(--B):real^3/\ a % vec 0= vec 0 /\ vec 0 +A=A`;CROSS_LMUL;CROSS_REFL;CROSS_LADD;CROSS_LNEG;DOT_SQUARE_NORM;o_DEF] +THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`w:real^3`] +THEN MRESAL_TAC (GEN_ALL Trigonometry1.DIST_UPS_X_POS)[`vec 0:real^3`;`v1:real^3`;`w:real^3`][dist;VECTOR_ARITH`vec 0- A= --A/\ A- vec 0=A:real^3`;GSYM DOT_SQUARE_NORM;NORM_NEG] +THEN MRESAL_TAC Collect_geom.FHFMKIY[`vec 0:real^3`;`v1:real^3`;`w:real^3`;`x1:real`;`x2:real`;`x6:real`][dist;VECTOR_ARITH`vec 0- A= --A/\ A- vec 0=A:real^3`;GSYM DOT_SQUARE_NORM;NORM_NEG] +THEN ASM_TAC +THEN REWRITE_TAC[GSYM DOT_SQUARE_NORM] +THEN ASM_REWRITE_TAC[DOT_LSUB;DOT_RSUB;DOT_LMUL; DOT_RMUL;DOT_CROSS_SELF;REAL_ARITH`A* &0= &0/\ A+ &0=A/\ &0 +A=A`;DOT_CROSS;REAL_INV_MUL;] +THEN REPEAT RESA_TAC +THEN MRESA_TAC DOT_SYM[`w:real^3`;`v1:real^3`] +THEN REPLICATE_TAC (13-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[REAL_ARITH`x1 - v1 dot v2 - (v1 dot v2 - x2) = x6 +<=> v1 dot v2 = (x1 + x2 - x6)/ &2`;REAL_ARITH`a*a *b=a pow 2 *b/\ A- &0=A/\ (a*b) pow 2=a pow 2 * b pow 2`;REAL_INV_MUL] +THEN RESA_TAC +THEN MRESA_TAC REAL_MUL_LINV[`ups_x x1 x2 x6`] +THEN MRESAL_TAC SQRT_UNIQUE[`&1`;`&1`][REAL_ARITH`&0<= &1/\ &1 pow 2= &1`] +THEN REWRITE_TAC[VECTOR_ARITH`((inv (&2) * inv x1) * (x1 + x2 - x6)) % v1 + + (inv x1 * -- &1 * &1) % ((x1 + x2 - x6) / &2 % v1 + --(x1 % w)) += + (inv x1 *x1) % w`] +THEN MP_TAC(REAL_ARITH`&0< x1==> ~(x1= &0)`) +THEN RESA_TAC +THEN MRESA_TAC REAL_MUL_LINV[`x1:real`] +THEN VECTOR_ARITH_TAC);; + + +let V3_DEFOR_DEFORMATION=prove_by_refinement(` +&0< x1 /\ &0 +(?e. &0 -- e< &0`) +THEN RESA_TAC +THEN STRIP_TAC; + +REPEAT STRIP_TAC +THEN ONCE_REWRITE_TAC[FUN_V3_DEFOR] +THEN REWRITE_TAC[v3_defor_v4] +THEN MP_TAC(SET_RULE`v=w:real^3\/ ~(v=w)`) +THEN RESA_TAC; + +REWRITE_TAC[V3_DEFOR_V1_O_DEF] +THEN MATCH_MP_TAC CONTINUOUS_REAL_CONTINUOUS_ATREAL_COMPOSE +THEN STRIP_TAC; + +MATCH_MP_TAC REAL_CONTINUOUS_SUB +THEN ASM_SIMP_TAC[REAL_CONTINUOUS_CONST;REAL_CONTINUOUS_AT_ID]; + +MATCH_MP_TAC CONTINUOUS_ATREAL_WITHINREAL +THEN REWRITE_TAC[] +THEN MATCH_MP_TAC EYYPQDW_CONTINUOUS_AT_X +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (16-11) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`r:real`]) +THEN REWRITE_TAC[SET_RULE`a IN{a,b}`]; + +ASM_SIMP_TAC[CONTINUOUS_CONST;REAL_CONTINUOUS_AT_ID]; + +REPEAT STRIP_TAC +THEN ONCE_REWRITE_TAC[FUN_V3_DEFOR] +THEN REWRITE_TAC[v3_defor_v4] +THEN MP_TAC(SET_RULE`v=w:real^3\/ ~(v=w)`) +THEN RESA_TAC; + +MATCH_MP_TAC V3_DEFOR_ID +THEN ASM_REWRITE_TAC[]]);; + + + + +let V3_DEFOR_IN_BALL_ANNULUS_DEFORMATION=prove_by_refinement(`&0< x1 /\ &0 ?e. &0< e/\ (!t. &0 v3_defor_v4 a x1 x2 x6 v1 v2 v2 t IN ball_annulus)`, +[ +REWRITE_TAC[ball_annulus;cball;DIFF;ball;IN_ELIM_THM;dist; VECTOR_ARITH`vec 0 -A= --A`;NORM_NEG;NORM_MUL;REAL_ARITH`~(a b<= a`] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL NORM_GE_SQUARE)[`&2`;`v2:real^3`][REAL_ARITH`~(&2<= &0)/\ (a>=b<=> b<=a)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DOT_SQUARE_NORM] +THEN MRESAL_TAC (GEN_ALL NORM_EQ_SQUARE)[`&2`;`v2:real^3`][REAL_ARITH`(&0<= &2)/\ (a>=b<=> b<=a)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DOT_SQUARE_NORM] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&2 pow 2 <= x2 /\ ~(x2= &2 pow 2)==> &0 < (x2- &4)/ &2 `) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL UPS_X_POS_SEG_C)[`v1:real^3`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`(x2- &4)/ &2`] +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[v3_defor_v4] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0< e/\ &0 --e b>=a)`;NORM_GE_SQUARE] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[DOT_SQUARE_NORM] +THEN ASM_TAC +THEN REAL_ARITH_TAC]);; + + +let NORM_POS_COLLINEAR=prove(`~(collinear{vec 0,v1,v2:real^3})/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6 +==> &0< x1 /\ &0 norm v1 pow 2 = &0 \/ &0 norm v2 pow 2 = &0 \/ &0 norm (v1-v2) pow 2 = &0 \/ &0 a=b`] +THENL[ +MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[DOT_SQUARE_NORM] +THEN RESA_TAC]);; + + + +let HYPER_MM_COLLINEAR=prove_by_refinement(`scs_k_v39 s =k/\is_scs_v39 s /\ + MMs_v39 s w /\ + 3 +&0< x1 /\ &0real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` +THEN ASM_TAC +THEN RESA_TAC +THEN REPEAT DISCH_TAC; + +ASM_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`((v2,v1):real^3#real^3) IN FF`ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`]; + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,v1):real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MP_TAC NORM_POS_COLLINEAR +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[]]);; + + + + + +let EYYPQDW_CONTINUOUS_LIFT_DIST=prove(`&0< x1 /\ &0 +lift o (\x3. dist(v3_defor_v1 a v1 v2 x1 x2 x5 x6 x3,v)) continuous atreal (x3)`, +REPEAT STRIP_TAC +THEN SUBGOAL_THEN`lift o(\x3. dist(v3_defor_v1 a v1 v2 x1 x2 x5 x6 x3,v))= (lift o (\x. dist(x,v))) o(\x3. v3_defor_v1 a v1 v2 x1 x2 x5 x6 x3)`ASSUME_TAC +THENL[ +REWRITE_TAC[o_DEF]; +ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC CONTINUOUS_ATREAL_COMPOSE +THEN MP_TAC EYYPQDW_CONTINUOUS_AT_X +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN MATCH_MP_TAC CONTINUOUS_AT_WITHIN +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_SIMP_TAC[CONTINUOUS_AT_LIFT_DIST]]);; + + + + + +let EXISTS_SMALL_LE_CONST=prove(`&0< x1 /\ &0 +?e. &0< e /\ (!t. &0 c MRESAL_TAC th[`&0`][REAL_ARITH`(--a< &0<=> &0 &0 &0< (dist(v2,w:real^3)- c )/ &2/\ c< dist (v2,w) - (dist (v2,w) - c) / &2`) +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL EYYPQDW_CONTINUOUS_LIFT_DIST)[`x2:real`;`a:real`;`v1:real^3`;`v2:real^3`;`x1:real`;`x2:real`;`x6:real`;`x6:real`;`w:real^3`;`x2:real`][SET_RULE`A IN {A, B}`;continuous_atreal;DIST_LIFT;o_DEF;GSYM REAL_ABS_BETWEEN] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`(dist(v2,w:real^3)- c )/ &2`]) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`d:real` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MP_TAC(REAL_ARITH` &0< d/\ &0 --d --d +?e. &0< e /\ (!t. --e c MRESAL_TAC th[`&0`][REAL_ARITH`(--a< &0<=> &0 &0 &0< (dist(v2,w:real^3)- c )/ &2/\ c< dist (v2,w) - (dist (v2,w) - c) / &2`) +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL EYYPQDW_CONTINUOUS_LIFT_DIST)[`x2:real`;`a:real`;`v1:real^3`;`v2:real^3`;`x1:real`;`x2:real`;`x6:real`;`x6:real`;`w:real^3`;`x2:real`][SET_RULE`A IN {A, B}`;continuous_atreal;DIST_LIFT;o_DEF;GSYM REAL_ABS_BETWEEN] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`(dist(v2,w:real^3)- c )/ &2`]) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`d:real` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESAL_TAC th[`x2-t:real`][REAL_ARITH`x2 - d < x2 - t /\ x2 - t < x2 + d <=> --d scs_a_v39 s l i < dist (v2,w i)) +==> (!i. ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k) ==> ?e. &0< e/\ +(!t. &0< t/\ t< e ==> scs_a_v39 s l i < dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i)))`, +STRIP_TAC +THEN MP_TAC HYPER_MM_COLLINEAR +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC EXISTS_SMALL_LE_CONST +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (16-10)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`i:num`]));; + + + +let DEFORMATION_DIST_LE_V3_DEFOR_A_COM=prove_by_refinement(`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3 scs_a_v39 s l i < dist (v2,w i)) +==> ?e. &0< e/\ +(!t i. &0< t/\ t< e /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k) ==> scs_a_v39 s l i < dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i))`, +[ +REPEAT STRIP_TAC +THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] +THEN REWRITE_TAC[SKOLEM_THM] +THEN STRIP_TAC +THEN ABBREV_TAC`e1= inf {(e:num->real) i| i < k /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}` +THEN EXISTS_TAC`e1:real` +THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}`ASSUME_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` +THEN STRIP_TAC; + +MATCH_MP_TAC FINITE_IMAGE +THEN REWRITE_TAC[FINITE_NUMSEG]; + +REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_ELIM_THM] +THEN GEN_TAC +THEN RESA_TAC +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[IN_NUMSEG] +THEN REPLICATE_TAC (16-12)(POP_ASSUM MP_TAC) +THEN ARITH_TAC; + +SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)} = {})`ASSUME_TAC; + +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] +THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(l MOD k =0)`) +THEN RESA_TAC; + +EXISTS_TAC`(e:num->real)1` +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 1real)2` +THEN EXISTS_TAC`2` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 1real)0` +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}`;`&0`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN REPLICATE_TAC (20-11) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`]); + +REPEAT STRIP_TAC +THEN MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}`;`t:real`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}`ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`i MOD k` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1 MRESA1_TAC th`(e:num->real) (i MOD k)`) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1 REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num MOD k`]) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`])]);; + + + +let DEFORMATION_DIST_LE_V3_DEFOR_A_SUC=prove(`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3 scs_a_v39 s l i < dist (v2,w i)) +==> (!i. ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k) ==> ?e. &0< e/\ +(!t. &0< t/\ t< e ==> scs_a_v39 s l i < dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i)))`, +STRIP_TAC +THEN MP_TAC HYPER_MM_COLLINEAR +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC EXISTS_SMALL_LE_CONST +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (16-10)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`i:num`]));; + + + +let DEFORMATION_DIST_LE_V3_DEFOR_A_COM_SUC=prove_by_refinement( +`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3 scs_a_v39 s l i < dist (v2,w i)) +==> ?e. &0< e/\ +(!t i. &0< t/\ t< e /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k) ==> scs_a_v39 s l i < dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i))`, +[ +REPEAT STRIP_TAC +THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_SUC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] +THEN REWRITE_TAC[SKOLEM_THM] +THEN STRIP_TAC +THEN ABBREV_TAC`e1= inf {(e:num->real) i| i < k /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}` +THEN EXISTS_TAC`e1:real` +THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}`ASSUME_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` +THEN STRIP_TAC; + +MATCH_MP_TAC FINITE_IMAGE +THEN REWRITE_TAC[FINITE_NUMSEG]; + +REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_ELIM_THM] +THEN GEN_TAC +THEN RESA_TAC +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[IN_NUMSEG] +THEN REPLICATE_TAC (16-12)(POP_ASSUM MP_TAC) +THEN ARITH_TAC; + +SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)} = {})`ASSUME_TAC; + +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] +THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(l MOD k =0)`) +THEN RESA_TAC; + + +EXISTS_TAC`(e:num->real)2` +THEN EXISTS_TAC`2` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real)3` +THEN EXISTS_TAC`3` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real)1` +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}`;`&0`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN REPLICATE_TAC (20-11) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`]); + +REPEAT STRIP_TAC +THEN MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}`;`t:real`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}`ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`i MOD k` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1 MRESA1_TAC th`(e:num->real) (i MOD k)`) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1 REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num MOD k`]) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`])]);; + + +(***SCS_B***) + +let EXISTS_SMALL_LT_CONST=prove(`&0< x1 /\ &0 +?e. &0< e /\ (!t. &0 dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w) MRESAL_TAC th[`&0`][REAL_ARITH`(--a< &0<=> &0 &0 &0< (c-dist(v2,w:real^3))/ &2/\ dist (v2,w) + (c-dist (v2,w) ) / &2 MRESA_TAC th[`(c-dist(v2,w:real^3))/ &2`]) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`d:real` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MP_TAC(REAL_ARITH` &0< d/\ &0 --d --d +?e. &0< e /\ (!t. --e dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w) MRESAL_TAC th[`&0`][REAL_ARITH`(--a< &0<=> &0 &0 &0< (c-dist(v2,w:real^3))/ &2/\ dist (v2,w) + (c-dist (v2,w) ) / &2 MRESA_TAC th[`(c-dist(v2,w:real^3))/ &2`]) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`d:real` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESAL_TAC th[`x2-t:real`][REAL_ARITH`x2 - d < x2 - t /\ x2 - t < x2 + d <=> --d &4 * h0 < scs_b_v39 s l i) +==> (!i. scs_diag k l i ==> ?e. &0< e/\ +(!t. &0< t/\ t< e ==> dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i) ~(k<=3)`) +THEN RESA_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`v2 IN IMAGE (w:num->real^3) (:num)`ASSUME_TAC; + + REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +SUBGOAL_THEN`w i IN IMAGE (w:num->real^3) (:num)`ASSUME_TAC; + + REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +MP_TAC(SET_RULE`v2 IN IMAGE w (:num)/\ w i IN IMAGE w (:num)/\ IMAGE w (:num) SUBSET ball_annulus ==> v2 IN ball_annulus/\ w i IN ball_annulus`) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[IN_ELIM_THM;DIFF;ball_annulus;cball;] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC DIST_TRIANGLE[`v2:real^3`;`vec 0:real^3`;`(w:num->real^3) i`] +THEN MP_TAC(REAL_ARITH`dist (v2,vec 0) <= &2 * h0/\ dist (vec 0,w i) <= &2 * h0/\ dist (v2,w i) <= dist (v2,vec 0) + dist (vec 0,w i) +==> dist (v2,(w:num->real^3) i)<= &4 *h0`) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REPLICATE_TAC (53-41)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`i:num`]) +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC]);; + + + + + +let xrr_decreasing_lt = prove_by_refinement( +`!y1 y1' y2 y6. &2 <= y1 /\ &2 <= y1' /\ &2 <= y2 /\ &2 <= y6 /\ y2 <= &2 * h0 /\ y1 < y1' ==> + xrr y1' y2 y6 < xrr y1 y2 y6`, + (* {{{ proof *) +[ REPEAT WEAKER_STRIP_TAC; + INTRO_TAC REAL_MVT_SIMPLE [`(\q. xrr q y2 y6)`;`\q. ( -- &4 * ((q*q + y6*y6 - y2*y2)/ (q pow 2 * y2)))`;`y1`;`y1'`]; + REWRITE_TAC[IN_REAL_INTERVAL]; + ANTS_TAC; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_ATREAL_WITHIN; + INTRO_TAC derived_form_xrr_wrt_y1 [`x`;`y2`;`y6`]; + REWRITE_TAC[Calc_derivative.derived_form;WITHINREAL_UNIV]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC [arith `x < y <=> &0 < y - x`]; + RULE_ASSUM_TAC(ONCE_REWRITE_RULE[arith `x' - x = (-- &4 * u/v) * z <=> x - x' = &4 * u/ v * z`]); + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_MUL; + GMATCH_SIMP_TAC REAL_LT_MUL; + GMATCH_SIMP_TAC REAL_LT_DIV; + GMATCH_SIMP_TAC REAL_LT_MUL; + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + ENOUGH_TO_SHOW_TAC ` &0 < x * x + y6 * y6 - y2 * y2`; + BY(ASM_TAC THEN REAL_ARITH_TAC); + MATCH_MP_TAC REAL_LT_TRANS; + TYPIFY `&2 * &2 + &2 * &2 - (&2 * h0) * (&2 * h0)` EXISTS_TAC; + CONJ_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + MATCH_MP_TAC (arith `x < x' /\ y <= y' /\ z' <= z ==> x + y - z < x' + y' - z'`); + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + + + + + +let exp_aff_gt_by_dot=prove_by_refinement(`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u} +==> aff_gt {x,v} {u}={w:real^3| (w-x) dot (e2_fan x v u)= &0 /\ &0 < (w-x) dot (e1_fan x v u) }`, +let CROSS_LAGRANGE1 = prove + (`!x y z. (x cross y) cross z = (x dot z) % y - (z dot y) % x`, + VEC3_TAC) in +[REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]th3) THEN RES_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]AFF_GT_2_1) THEN RESA_TAC + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]properties_coordinate) THEN RESA_TAC + THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC; + +STRIP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`(a % x + b +c) -x= (a- &1)% x + b + c `] THEN +REMOVE_ASSUM_TAC THEN SYM_ASSUM_TAC THEN REWRITE_TAC[VECTOR_ARITH`((a-(a+b+c)) % x + b % v +c % u)= b % (v-x) + c % (u-x)`] +THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL] + THEN REDUCE_ARITH_TAC + THEN ASM_MESON_TAC[REAL_LT_MUL] ; +STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") + THEN DISCH_THEN(LABEL_TAC"b") +THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3)( v:real^3) (u:real^3)`; +`e3_fan (x:real^3) (v:real^3) (u:real^3)`;]ORTHONORMAL_IMP_SPANNING) THEN ASM_REWRITE_TAC[SPAN_3;EXTENSION] + THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(x':real^3)-(x:real^3)`th)) THEN REWRITE_TAC[SET_RULE`(a:real^3) IN (:real^3)`;IN_ELIM_THM] THEN RES_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL] + THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"c") + THEN FIND_ASSUM(MP_TAC)`orthonormal (e1_fan (x:real^3) (v:real^3) (u:real^3)) (e2_fan x v u) (e3_fan x v u)` + THEN REWRITE_TAC[orthonormal] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN ASM_REWRITE_TAC[DOT_SYM] + THEN REDUCE_ARITH_TAC + THEN DISCH_TAC THEN REMOVE_THEN "c" MP_TAC THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC THEN DISCH_THEN (LABEL_TAC"a") + THEN REMOVE_THEN "b" MP_TAC THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL;] THEN REWRITE_TAC[DOT_SYM] THEN ASM_REWRITE_TAC[] + THEN REDUCE_ARITH_TAC + THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC + THEN ASM_REWRITE_TAC[e1_fan;e2_fan;CROSS_LMUL;VECTOR_ARITH`a% b% v=(a*b)%v`;CROSS_LAGRANGE1] + THEN REDUCE_VECTOR_TAC THEN REWRITE_TAC[VECTOR_ARITH`a%(x- b % v)+ c % v=(c- a* b) % v+ a % x `; +e3_fan;VECTOR_ARITH`a% b% v=(a*b)%v`] + THEN STRIP_TAC THEN +EXISTS_TAC +`&1 - ((((w:real) - + ((u':real) * inv (norm (inv (norm ((v:real^3) - (x:real^3))) % (v - x) cross ((u:real^3) - x)))) * + (inv (norm (v - x)) % (v - x) dot (u - x))) * + inv (norm (v - x)))+ +((u':real) * inv (norm (e3_fan (x:real^3) (v:real^3) (u:real^3) cross (u - x)))))` + THEN EXISTS_TAC +`(((w:real) - + ((u':real) * inv (norm (inv (norm ((v:real^3) - (x:real^3))) % (v - x) cross ((u:real^3) - x)))) * + (inv (norm (v - x)) % (v - x) dot (u - x))) * + inv (norm (v - x)))` + THEN EXISTS_TAC +` ((u':real) * inv (norm (e3_fan (x:real^3) (v:real^3) (u:real^3) cross (u - x))))` +THEN +STRIP_TAC; + +SUBGOAL_THEN `~(collinear {vec 0, v-x, u-x})==> ~((e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3))= vec 0)` ASSUME_TAC; + + MATCH_MP_TAC MONO_NOT THEN REWRITE_TAC[e3_fan;CROSS_LMUL] +THEN DISCH_TAC THEN MP_TAC(ISPECL [`v:real^3`; `x:real^3`] imp_inv_norm_not_zero_fan) +THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +MP_TAC(ISPECL [`inv(norm((v:real^3)-(x:real^3)))`; `((v:real^3) -(x:real^3)) cross ((u:real^3)-(x:real^3))`; `(vec 0):real^3`] VECTOR_MUL_LCANCEL_IMP) +THEN ASM_REWRITE_TAC[VECTOR_MUL_RZERO;CROSS_EQ_0 ]; + +POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM COLLINEAR_3] +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{a,b,c}={b,a,c}`] THEN RED_TAC +THEN +MP_TAC(ISPECL [`(e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3))`; `((vec 0):real^3)`] imp_norm_gl_zero_fan) + THEN REDUCE_VECTOR_TAC THEN RES_TAC THEN +MP_TAC(ISPECL[`u':real`;`inv (norm ((e3_fan (x:real^3) (v:real^3) (u:real^3)) cross ((u:real^3)-(x:real^3))))`] +REAL_LT_MUL) THEN RES_TAC THEN POP_ASSUM MATCH_MP_TAC THEN POP_ASSUM MP_TAC + THEN REAL_ARITH_TAC; + +STRIP_TAC THENL[REAL_ARITH_TAC; +REWRITE_TAC[e3_fan] THEN POP_ASSUM MP_TAC THEN VECTOR_ARITH_TAC] +]);; + + +let exp_aff_by_dot=prove_by_refinement( +`!x:real^3 v:real^3 u:real^3. +~collinear {x,v,u} +==> aff {x,v,u}={w:real^3| (w-x) dot (e2_fan x v u)= &0 }`, +let CROSS_LAGRANGE1 = prove + (`!x y z. (x cross y) cross z = (x dot z) % y - (z dot y) % x`, + VEC3_TAC) in +[ +REPEAT STRIP_TAC THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]th3) THEN RES_TAC + THEN ASM_SIMP_TAC[aff;aff;Collect_geom2.AFFINE_HULL_3] + THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]properties_coordinate) THEN RESA_TAC + THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM] THEN GEN_TAC THEN EQ_TAC; + +STRIP_TAC THEN ASM_REWRITE_TAC[VECTOR_ARITH`(a % x + b +c) -x= (a- &1)% x + b + c `] THEN +REMOVE_ASSUM_TAC THEN SYM_ASSUM_TAC THEN REWRITE_TAC[VECTOR_ARITH`((a-(a+b+c)) % x + b % v +c % u)= b % (v-x) + c % (u-x)`] +THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL] + THEN REDUCE_ARITH_TAC + THEN ASM_MESON_TAC[REAL_LT_MUL] ; + +STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"a") + THEN DISCH_THEN(LABEL_TAC"b") +THEN MP_TAC(ISPECL[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3)( v:real^3) (u:real^3)`; +`e3_fan (x:real^3) (v:real^3) (u:real^3)`;]ORTHONORMAL_IMP_SPANNING) THEN ASM_REWRITE_TAC[SPAN_3;EXTENSION] + THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(x':real^3)-(x:real^3)`th)) THEN REWRITE_TAC[SET_RULE`(a:real^3) IN (:real^3)`;IN_ELIM_THM] THEN RES_TAC THEN REMOVE_THEN "a" MP_TAC THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL] + THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"c") + THEN FIND_ASSUM(MP_TAC)`orthonormal (e1_fan (x:real^3) (v:real^3) (u:real^3)) (e2_fan x v u) (e3_fan x v u)` + THEN REWRITE_TAC[orthonormal] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN ASM_REWRITE_TAC[DOT_SYM] + THEN REDUCE_ARITH_TAC + THEN DISCH_TAC THEN REMOVE_THEN "c" MP_TAC THEN ASM_REWRITE_TAC[] THEN REDUCE_VECTOR_TAC +THEN DISCH_THEN (LABEL_TAC"a") + THEN REMOVE_THEN "b" MP_TAC THEN ASM_REWRITE_TAC[DOT_LADD;DOT_LMUL;] THEN REWRITE_TAC[DOT_SYM] THEN ASM_REWRITE_TAC[] + THEN REDUCE_ARITH_TAC + THEN DISCH_TAC THEN REMOVE_THEN "a" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC + THEN ASM_REWRITE_TAC[e1_fan;e2_fan;CROSS_LMUL;VECTOR_ARITH`a% b% v=(a*b)%v`;CROSS_LAGRANGE1] + THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[VECTOR_ARITH`a%(x- b % v)+ c % v=(c- a* b) % v+ a % x `; +e3_fan;VECTOR_ARITH`a% b% v=(a*b)%v`] + THEN STRIP_TAC +THEN +EXISTS_TAC +`&1 - ((((w:real) - + ((u':real) * inv (norm (inv (norm ((v:real^3) - (x:real^3))) % (v - x) cross ((u:real^3) - x)))) * + (inv (norm (v - x)) % (v - x) dot (u - x))) * + inv (norm (v - x)))+ +((u':real) * inv (norm (e3_fan (x:real^3) (v:real^3) (u:real^3) cross (u - x)))))` + THEN EXISTS_TAC +`(((w:real) - + ((u':real) * inv (norm (inv (norm ((v:real^3) - (x:real^3))) % (v - x) cross ((u:real^3) - x)))) * + (inv (norm (v - x)) % (v - x) dot (u - x))) * + inv (norm (v - x)))` + THEN EXISTS_TAC +` ((u':real) * inv (norm (e3_fan (x:real^3) (v:real^3) (u:real^3) cross (u - x))))`; + + + +STRIP_TAC ; +REAL_ARITH_TAC; +REWRITE_TAC[e3_fan] +THEN POP_ASSUM MP_TAC +THEN VECTOR_ARITH_TAC; +]);; + + + + + +let IN_AFF_EQ_DOT_E2_FAN=prove(` ~collinear {vec 0,x,y} +==>( +e2_fan (vec 0) x y dot z = &0 <=> z IN aff {vec 0, x, y}) `, +STRIP_TAC +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_SIMP_TAC[exp_aff_by_dot;IN_ELIM_THM] +THEN REDUCE_VECTOR_TAC);; + + + + +let OPEN_RELA_AFF_GT=prove_by_refinement(` ~collinear {vec 0,z,x}/\ ~collinear {vec 0,x,y} /\ z IN aff_gt {vec 0} {x,y:real^3} ==> ?e. &0< e/\ ball(z,e) INTER aff{vec 0, x,z} SUBSET aff_gt {vec 0} {x,y}`, +[ +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[Planarity.aff_gt_inter_aff_gt;exp_aff_gt_by_dot;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN ASM_SIMP_TAC[Planarity.aff_gt_inter_aff_gt;exp_aff_gt_by_dot;Conforming.aff_3_rep_cross_dot;INTER;IN_ELIM_THM;VECTOR_ARITH`a- vec 0=a`;exp_aff_by_dot] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0< e1_fan (vec 0:real^3) y x dot z ==> &0<(e1_fan (vec 0) y x dot z)/ &2/\ &0< e1_fan (vec 0) y x dot z - (e1_fan (vec 0) y x dot z) / &2`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0< e1_fan (vec 0:real^3) x y dot z ==> &0<(e1_fan (vec 0) x y dot z)/ &2/\ &0< e1_fan (vec 0) x y dot z - (e1_fan (vec 0) x y dot z) / &2`) +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL CONTINUOUS_AT_LIFT_DOT)[`e1_fan (vec 0:real^3) y x`;`z:real^3`][CONTINUOUS_AT_LIFT_RANGE;GSYM REAL_ABS_BETWEEN] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(e1_fan (vec 0) y x dot z) / &2`]) +THEN MRESAL_TAC (GEN_ALL CONTINUOUS_AT_LIFT_DOT)[`e1_fan (vec 0:real^3) x y`;`z:real^3`][CONTINUOUS_AT_LIFT_RANGE;GSYM REAL_ABS_BETWEEN;SUBSET;IN_ELIM_THM;ball;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(e1_fan (vec 0) x y dot z) / &2`]) +THEN EXISTS_TAC`min d d'` +THEN MP_TAC(REAL_ARITH`&0< d/\ &0< d' ==> &0< min d d'`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN GEN_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th1-> STRIP_TAC THEN STRIP_TAC THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`norm (x' - z) < min d d' /\ &0 norm(x'-z)< d/\ norm(x'-z:real^3)< d'`) +THEN RESA_TAC +THEN MRESA_TAC th1[`x':real^3`]) +THEN MRESA_TAC th[`x':real^3`]) +THEN MP_TAC(REAL_ARITH`e1_fan (vec 0) x y dot z - (e1_fan (vec 0) x y dot z) / &2 < + e1_fan (vec 0) x y dot x' +/\ &0 < e1_fan (vec 0) x y dot z - (e1_fan (vec 0) x y dot z) / &2 +==> &0< e1_fan (vec 0:real^3) x y dot x' +`) +THEN MP_TAC(REAL_ARITH`e1_fan (vec 0) y x dot z - (e1_fan (vec 0) y x dot z) / &2 < + e1_fan (vec 0) y x dot x' +/\ &0 < e1_fan (vec 0) y x dot z - (e1_fan (vec 0) y x dot z) / &2 +==> &0< e1_fan (vec 0:real^3) y x dot x' +`) +THEN RESA_TAC +THEN RESA_TAC +THEN REPLICATE_TAC (22-14) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (21-2) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN REDUCE_VECTOR_TAC +THEN ASM_SIMP_TAC[IN_AFF_EQ_DOT_E2_FAN] +THEN ASM_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (2) (POP_ASSUM MP_TAC) +THEN ASM_SIMP_TAC[IN_AFF_EQ_DOT_E2_FAN;aff;IN_ELIM_THM;Collect_geom2.AFFINE_HULL_3] +THEN RESA_TAC +THEN RESA_TAC +THEN REDUCE_VECTOR_TAC +THEN EXISTS_TAC`&1 - v - w * v' - w* w'` +THEN EXISTS_TAC`v +w*v':real` +THEN EXISTS_TAC`w*w':real` +THEN STRIP_TAC; +REAL_ARITH_TAC ; +VECTOR_ARITH_TAC; +REAL_ARITH_TAC ; +VECTOR_ARITH_TAC]);; + + + + +let V3_DEFOR_IN_AFF_GT=prove(`&0< x1 /\ &0 ?e. &0< e/\ (!t. &0< t/\ t< e ==> v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t) IN aff_gt {vec 0} {v1,w})`, +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC UPS_X_POS_SEG +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`&0`][REAL_ARITH`(-- e< &0<=> &0< e)/\ a- &0=a`] +THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL OPEN_RELA_AFF_GT)[`v2:real^3`;`v1:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL EXISTS_SMALL_LT_CONST)[`a:real`;`v1:real^3`;`v2:real^3`;` x1:real`;`x6:real`;`x2:real`;`v2:real^3`;`e':real`][DIST_REFL] +THEN ABBREV_TAC`e1=(min (min e e') e'')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min (min e e') e'')/ &2/\ &0< e/\ &0< e' /\ &0< e'' +==> &0< e1/\ e1< e /\ e1< e'/\ e1< e''`) +THEN RESA_TAC +THEN EXISTS_TAC`e1:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`A SUBSET B/\ a IN A==> a IN B`)) +THEN EXISTS_TAC`ball (v2,e') INTER aff {vec 0, v2, v1:real^3}` +THEN ASM_REWRITE_TAC[INTER;ball;IN_ELIM_THM] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REPLICATE_TAC (23-16) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''==> t< e''`) +THEN RESA_TAC +THEN MRESA_TAC th[`t:real`]) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_SIMP_TAC[exp_aff_by_dot;IN_ELIM_THM] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[e2_fan;e3_fan] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[DOT_RMUL;CROSS_LMUL] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN REPLICATE_TAC (24-11) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e/\ &0 t< e/\ -- e< t`) +THEN RESA_TAC +THEN MRESA_TAC th[`t:real`]) +THEN MRESAL_TAC (GEN_ALL EYYPQDW_SCALAR_POS)[`x2:real`;`x2:real`;`x6:real`;`x1:real`;`x2-t:real`;`x6:real`;`v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t)`;`a:real`;`v1:real^3`;`v2:real^3`][SET_RULE`a IN {a,b}`;GSYM v3_defor_v1;DOT_CROSS_SELF;DOT_LMUL] +THEN REAL_ARITH_TAC);; + + +let V3_DEFOR_IN_AFF_GT_V1=prove(`&0< x1 /\ &0 ?e. &0< e/\ (!t. --e< t/\ t< e ==> v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t) IN aff_gt {vec 0} {v1,w})`, +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC UPS_X_POS_SEG +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`&0`][REAL_ARITH`(-- e< &0<=> &0< e)/\ a- &0=a`] +THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL OPEN_RELA_AFF_GT)[`v2:real^3`;`v1:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL EXISTS_SMALL_LT_CONST_V1)[`a:real`;`v1:real^3`;`v2:real^3`;` x1:real`;`x6:real`;`x2:real`;`v2:real^3`;`e':real`][DIST_REFL] +THEN ABBREV_TAC`e1=(min (min e e') e'')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min (min e e') e'')/ &2/\ &0< e/\ &0< e' /\ &0< e'' +==> &0< e1/\ e1< e /\ e1< e'/\ e1< e''`) +THEN RESA_TAC +THEN EXISTS_TAC`e1:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`A SUBSET B/\ a IN A==> a IN B`)) +THEN EXISTS_TAC`ball (v2,e') INTER aff {vec 0, v2, v1:real^3}` +THEN ASM_REWRITE_TAC[INTER;ball;IN_ELIM_THM] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REPLICATE_TAC (23-16) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC(REAL_ARITH`-- e1 t< e''/\ --e'' REPEAT DISCH_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e/\ --e1 t< e/\ -- e< t`) +THEN RESA_TAC +THEN MRESA_TAC th[`t:real`]) +THEN MRESAL_TAC (GEN_ALL EYYPQDW_SCALAR_POS)[`x2:real`;`x2:real`;`x6:real`;`x1:real`;`x2-t:real`;`x6:real`;`v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t)`;`a:real`;`v1:real^3`;`v2:real^3`][SET_RULE`a IN {a,b}`;GSYM v3_defor_v1;DOT_CROSS_SELF;DOT_LMUL] +THEN REAL_ARITH_TAC);; + + + + + + + + +let xrr_increasing_le = prove_by_refinement( + `!y1 y2 y6 y6'. &0 < y1 /\ &0 < y2 /\ &0 <= y6 /\ y6 <= y6' ==> xrr y1 y2 y6 <= xrr y1 y2 y6'`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; +TYPIFY `y6 = y6'` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); +MATCH_MP_TAC(REAL_ARITH`a a<=b`) +THEN MATCH_MP_TAC xrr_increasing +THEN ASM_TAC THEN REAL_ARITH_TAC; + ]);; + (* }}} *) + + + + +let EDGE_DOT_LE_NORM=prove_by_refinement(`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3 +(w i ) dot (w l)< norm (w l) pow 2 `, +[ +REPEAT STRIP_TAC +THEN REWRITE_TAC[dist;VECTOR_ARITH`(&1 - t) % w - w1 = --(t % w-(w-w1))`;NORM_NEG] +THEN SUBGOAL_THEN`((w:num->real^3) l- w i) dot -- (w:num->real^3) l< &0` ASSUME_TAC; + +MRESAL_TAC DOT_NORM[`(w:num->real^3) l- w i`;`-- (w:num->real^3) l`][VECTOR_ARITH`wl - wi + (-- wl)= --wi:real^3`;NORM_NEG] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;IMAGE;SUBSET;IN_ELIM_THM;ball_annulus;cball;DIFF;ball] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) l = w x) `ASSUME_TAC; + +EXISTS_TAC `l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) i = w x) `ASSUME_TAC; + +EXISTS_TAC `i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +REPLICATE_TAC (37-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`(w:num->real^3) i`] +THEN MRESA_TAC th[`(w:num->real^3) l`]) +THEN REPLICATE_TAC (4) (POP_ASSUM MP_TAC) +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (40-21) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num`;`i:num`][dist]) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1< k`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`SUC i`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`i:num`) +THEN REPLICATE_TAC (48-14) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num MOD k`;`i MOD k:num`][dist]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&2 <= scs_a_v39 s i l +/\ scs_a_v39 s i l <= norm (w l - (w:num->real^3)i)/\ ~(norm (w l) < &2) +==> &2<= norm (w l - (w:num->real^3)i) /\ &2<= norm (w l)`) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm ((w:num->real^3) l)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm (w l - (w:num->real^3)i)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN ASM_TAC +THEN REWRITE_TAC[h0] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`norm ((w:num->real^3) i)`;`&2* h0`;][ARITH_RULE`abs (&2 * #1.26)= &2 * #1.26`;REAL_ABS_NORM;h0] +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +EXISTS_TAC `l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) i = w x) `ASSUME_TAC; + +EXISTS_TAC `i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +REPLICATE_TAC (37-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`(w:num->real^3) i`] +THEN MRESA_TAC th[`(w:num->real^3) l`]) +THEN REPLICATE_TAC (4) (POP_ASSUM MP_TAC) +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (40-21) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num`;`i:num`][dist]) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1< k`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`SUC i`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`i:num`) +THEN REPLICATE_TAC (48-14) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num MOD k`;`i MOD k:num`][dist]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&2 <= scs_a_v39 s i l +/\ scs_a_v39 s i l <= norm (w l - (w:num->real^3)i)/\ ~(norm (w l) < &2) +==> &2<= norm (w l - (w:num->real^3)i) /\ &2<= norm (w l)`) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm ((w:num->real^3) l)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm (w l - (w:num->real^3)i)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN ASM_TAC +THEN REWRITE_TAC[h0] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`norm ((w:num->real^3) i)`;`&2* h0`;][ARITH_RULE`abs (&2 * #1.26)= &2 * #1.26`;REAL_ABS_NORM;h0] +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[DOT_RNEG;REAL_ARITH`-- a< &0 <=> a> &0`;] +THEN REWRITE_TAC[DOT_LSUB;DOT_SQUARE_NORM] +THEN REAL_ARITH_TAC]);; + + + + +let DEFORMATION_DIST_LE_2=prove(` 3 +?e. &0< e/\ +(!t. &0< t/\ t< e ==> &2 ~(k<=3)/\ ~(k=0)/\ 1 MRESA1_TAC th`i:num`) +THEN REPLICATE_TAC (56-18) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num MOD k`;`l MOD k` ]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REPLICATE_TAC (59-42) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC);; + + +let DEFORMATION_V3_DEFOR_EDGE=prove_by_refinement(` 3 +?e. &0< e/\ +(!t. &0< t/\ t< e ==> dist (v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i) ~(k=0)/\ ~(k=1)/\ 0real^3) (:num)` +THEN SUBGOAL_THEN`(w:num->real^3) l IN V` ASSUME_TAC; + + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + + +SUBGOAL_THEN`(w:num->real^3) (SUC l) IN V` ASSUME_TAC; + + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`SUC l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +SUBGOAL_THEN`(w:num->real^3) l IN ball_annulus` ASSUME_TAC; + + + MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`V:real^3->bool` +THEN ASM_REWRITE_TAC[]; + + + +SUBGOAL_THEN`(w:num->real^3) (SUC l) IN ball_annulus` ASSUME_TAC; + + +MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`V:real^3->bool` +THEN ASM_REWRITE_TAC[]; + +REPLICATE_TAC (4) (POP_ASSUM MP_TAC) +THEN REPEAT RESA_TAC +THEN MP_TAC V3_DEFOR_IN_BALL_ANNULUS_DEFORMATION +THEN RESA_TAC +THEN REPLICATE_TAC (68-41) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (67-41) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l+k-1:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESA_TAC th[`i:num`]) +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) i`] +THEN ABBREV_TAC`e1= (min (min (min e e') e'') e''')/ &2` +THEN MP_TAC(REAL_ARITH`e1= (min (min (min e e') e'') e''')/ &2 /\ &0< e /\ &0< e'/\ &0< e''/\ &0< e''' ==> &0< e1/\ e1<= e/\ e1<=e'/\ e1< e''/\ e1< e'''`) +THEN RESA_TAC +THEN EXISTS_TAC`e1:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`e1=(min (min (min e e') e'') e''')/ &2 /\ &0< e /\ &0< e'/\ &0< e''/\ t --e' < t/\ t< e'/\ t REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`]) +THEN REPLICATE_TAC (88-65) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[v3_defor_v4] +THEN REPLICATE_TAC (87-72) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th[`t:real`]) +THEN ABBREV_TAC`v3=v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) ` +THEN ASM_REWRITE_TAC[ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0-A= -- A`;NORM_NEG;REAL_ARITH`~(a b<=a`] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORMV3)[`x2:real`;`-- &1`;`x2:real`;`x6:real`;`x1:real`;`x6:real`;`v1:real^3`;`v2:real^3`;`v3_defor_v1 (-- &1) v1 (v2:real^3) x1 x2 x6 x6 (x2 - t)`;`x2-t:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1] +THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORM_V3_V1)[`x2:real`;`-- &1`;`x2:real`;`x6:real`;`x1:real`;`x2-t:real`;`v2:real^3`;`v3_defor_v1 (-- &1) v1 (v2:real^3) x1 x2 x6 x6 (x2 - t)`;`v1:real^3`;`x6:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1] +THEN MRESA_TAC DOT_NORM_SUB[`v1:real^3`;`v3:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[dist] +THEN ABBREV_TAC`v4= (w:num->real^3) i` +THEN MRESA_TAC DOT_NORM_SUB[`v4:real^3`;`v2:real^3`] +THEN MRESA_TAC DOT_NORM_SUB[`v4:real^3`;`v3:real^3`] +THEN MRESA_TAC DOT_NORM_SUB[`v1:real^3`;`v2:real^3`] +THEN STRIP_TAC +; + + + + +REPLICATE_TAC (97-63) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +POP_ASSUM(fun th1-> REPEAT STRIP_TAC +THEN MP_TAC th1) +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0-A= -- A`;NORM_NEG;REAL_ARITH`~(a b<=a`] +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`&2 <= norm (v1 - v2:real^3) ` ASSUME_TAC +; + +REPLICATE_TAC (99-30) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`SUC l:num`;`l:num`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[dist] +THEN MRESA_TAC DIVISION[`SUC l`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN MRESA_TAC (GEN_ALL Qknvmlb.SUC_MOD_NOT_EQ)[`k:num`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`l:num`]) +THEN REPLICATE_TAC (103-22) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`SUC l MOD k:num`;`l MOD k:num`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC l MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REAL_ARITH_TAC; + + + + + +MRESAL_TAC xrr_decreasing_lt[`norm (v3:real^3)`;`norm (v2:real^3)`;`norm(v1:real^3)`;`norm (v1-v2:real^3)`][xrr;REAL_ARITH`a*a= a pow 2`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[Pack1.norm_abs] +THEN ASM_REWRITE_TAC[REAL_LT_SQUARE_ABS] +THEN ASM_REWRITE_TAC[REAL_ABS_NORM;REAL_ARITH`a-b &0 B REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`~(v3 = vec 0:real^3)` ASSUME_TAC +; + +STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th;NORM_0;REAL_ARITH`~(&2<= &0)`]) +; + + + +MRESAL_TAC COS_ANGLE[`v1:real^3`;`vec 0:real^3`;`v3:real^3`][VECTOR_ARITH`A- vec 0=A`;real_div;REAL_INV_MUL;REAL_ARITH`(x1 + x2) - x6= x2+x1-x6/\ (a*b)*c*d=a*b*d*c`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESAL_TAC COS_MONO_LT_EQ[`angle (v1,vec 0,v3:real^3)`;`angle (v1,vec 0,v2:real^3)`][ANGLE_RANGE] +THEN MP_TAC(SET_RULE`v2 IN aff_gt {vec 0} {v1, v4}/\ v3 IN aff_gt {vec 0} {v1, v4} /\ aff_gt {vec 0} {v1,v4} SUBSET aff_ge {vec 0} {v1,v4}==> v2 IN aff_ge {vec 0} {v1, v4}/\ v3 IN aff_ge {vec 0} {v1, v4:real^3}`) +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN RESA_TAC +THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`v4:real^3`] +THEN MRESA_TAC Polar_fan.ANGLES_ADD_AFF_GE [`vec 0:real^3`;`v1:real^3`;`v4:real^3`;`v2:real^3`] +THEN MRESA_TAC Polar_fan.ANGLES_ADD_AFF_GE [`vec 0:real^3`;`v1:real^3`;`v4:real^3`;`v3:real^3`] +THEN MP_TAC(REAL_ARITH`angle (v1,vec 0,v2) < angle (v1,vec 0,v3) +/\ angle (v1,vec 0,v2) + angle (v2,vec 0,v4) = angle (v1,vec 0,v4) +/\ angle (v1,vec 0,v3) + angle (v3,vec 0,v4) = angle (v1,vec 0,v4) +==> angle (v3,vec 0,v4) +POP_ASSUM(fun th1-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th1) +THEN MP_TAC th) +THEN REWRITE_TAC[REAL_ARITH`(norm v4 pow 2 + x2) - norm (v4 - v2) pow 2 +=x2+norm v4 pow 2 - norm (v4 - v2) pow 2`;real_div;REAL_ARITH`a*b*c*d=(a*b)*c*d`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] +THEN POP_ASSUM(fun th1-> REWRITE_TAC[SYM th1] THEN ASSUME_TAC (SYM th) + THEN ASSUME_TAC (SYM th))) +THEN SUBGOAL_THEN`(w:num->real^3) (l+k-1) IN V` ASSUME_TAC; + + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +SUBGOAL_THEN`(w:num->real^3) (l+k-1) IN ball_annulus` ASSUME_TAC; + + + MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`V:real^3->bool` +THEN ASM_REWRITE_TAC[]; + + + + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0-A= -- A`;NORM_NEG;REAL_ARITH`~(a b<=a`;real_div] +THEN STRIP_TAC +THEN ABBREV_TAC`a1=(norm (v4:real^3) pow 2)` +THEN ABBREV_TAC`a2=(norm (v4-v2:real^3) pow 2)` +THEN ABBREV_TAC`a3= x2+a1- &2 *((v4:real^3) dot v3) * (inv (norm v3)) * (inv (norm v4)) * norm v4 * norm(v2:real^3)` +THEN ABBREV_TAC`x= v4- v3_defor_v1 a (vec 0- v4) (v2- v4:real^3) a1 a2 x2 x2 (a3)` +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&2<=norm (v4:real^3)/\ &2<=norm (v2:real^3)==> &0< norm v4/\ &0< norm v2`) +THEN RESA_TAC +; + +MP_TAC(REAL_ARITH`norm (v4 - v2) pow 2 <= a3\/ a3< norm(v4-v2:real^3) pow 2`) +THEN RESA_TAC +; + + +MRESA_TAC REAL_LE_RSQRT[`norm(v4-v2:real^3)`;`a3:real`] +THEN MP_TAC(REAL_ARITH`norm (v4 - v2) pow 2 <= a3/\ &0<= norm(v4-v2:real^3) pow 2 +==> &0<= a3`) +THEN ASM_REWRITE_TAC[NORM_POS_LE;REAL_LE_POW_2] +THEN RESA_TAC +THEN MRESA_TAC SQRT_POW_2[`a3:real`] +THEN MRESAL_TAC xrr_increasing_le[`norm(v4:real^3)`;`norm(v2:real^3)`;`norm(v4-v2:real^3)`;`sqrt(a3)`][NORM_POS_LE;xrr;REAL_ARITH`(&8 *( &1-a)<= &8 *( &1-b)<=> b<=a)/\ a*a= a pow 2`;real_div] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN EXPAND_TAC"a3" +THEN REWRITE_TAC[REAL_ARITH`x+y-(y+x-a)=a`;REAL_INV_MUL] +THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v4:real^3`;`vec 0:real^3`] +THEN ASM_TAC +THEN REDUCE_VECTOR_TAC +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v2:real^3`;`vec 0:real^3`] +THEN ASM_TAC +THEN REDUCE_VECTOR_TAC +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH` + (&2 *a * inv (b) * inv (c) * c * d) * + inv (&2) * +inv (c) * + inv (d) += (a * inv (b) * inv (c)) * + (inv (c) * c )* + (inv (d) * d)`;REAL_ARITH`a * &1=a`] +THEN ASM_REWRITE_TAC[REAL_ARITH`a*b*c*d=(a*b)*d*c`] +THEN ONCE_REWRITE_TAC[REAL_ARITH` a1 + x2 - a2= x2+a1-a2`] +THEN ASM_REWRITE_TAC[REAL_ARITH`a<=b<=> ~(b c= a1+x2-t - &2 *a`] +THEN RESA_TAC +THEN EXPAND_TAC"a3" +THEN REWRITE_TAC[REAL_ARITH`a1 + x2 - t - &2 * (v4 dot v3) < + x2 + + a1 - &2 * (v4 dot v3) * inv (norm v3) * inv (norm v4) * norm v4 * norm v2 +<=> (v4 dot v3) * inv (norm v3) * (inv (norm v4) * norm v4) * norm v2 +< (v4 dot v3)+ t/ &2 `] +THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v4:real^3`;`vec 0:real^3`] +THEN ASM_TAC +THEN REDUCE_VECTOR_TAC +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ABBREV_TAC`g=(v4:real^3) dot v3` +THEN MRESAL_TAC SQRT_UNIQUE[`x2:real`;`norm(v2:real^3)`][NORM_POS_LE] +THEN MRESAL_TAC SQRT_UNIQUE[`x2-t:real`;`norm(v3:real^3)`][NORM_POS_LE] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;REAL_ARITH`&1*a=a`]) +THEN MP_TAC(REAL_ARITH`&0< x2-t/\ &0< x2/\ &0 &0<= x2-t/\ &0<= x2/\ x2-t REWRITE_TAC[SYM th;]) +THEN MRESA_TAC REAL_LE_INV[`x2-t:real`] +THEN MRESA_TAC REAL_LT_INV[`x2-t:real`] +THEN MRESA_TAC SQRT_MUL[`inv(x2-t):real`;`x2:real`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) +THEN MRESA_TAC REAL_MUL_LINV[`x2-t:real`] +THEN MRESA_TAC REAL_LT_LMUL[`inv(x2-t)`;`x2-t:real`;`x2:real`] +THEN MRESAL_TAC SQRT_MONO_LT[`&1:real`;`inv(x2-t) *x2`][REAL_ARITH`&0<= &1`;SQRT_1] +THEN MP_TAC(REAL_ARITH`(v4:real^3) dot v3 = &0\/ &0< --((v4:real^3) dot v3)\/ &0< (v4:real^3) dot v3 `) +THEN RESA_TAC; + +ASM_REWRITE_TAC[REAL_ARITH`&0 *a< &0 + t/ &2<=> &0< t`] +; + + + +MRESA_TAC REAL_LT_LMUL[`-- g`;`&1:real`;`sqrt (inv (x2 - t) * x2):real`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0< t==> &0< t/ &2`) +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC +; + + +MP_TAC(REAL_ARITH`&0< g/\ &1 < inv (x2 - t) * x2 ==> ~(g= &0)/\ &0 <= inv (x2 - t) * x2`) +THEN RESA_TAC +THEN MRESA_TAC REAL_MUL_LINV[`g:real`] +THEN MRESAL_TAC REAL_LT_LMUL[`g:real`;`sqrt (inv (x2 - t) * x2):real`;`(inv g)*(g+t/ &2)`][REAL_ARITH`a*b*c=(b*a)*c/\ &1*x=x`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MATCH_MP_TAC REAL_LT_LSQRT +THEN ASM_REWRITE_TAC[REAL_ARITH`a*(b+c)=a*b+a*c`] +THEN STRIP_TAC +; + + +MATCH_MP_TAC(REAL_ARITH`&0< a*b ==> &0<= &1+a *b/ &2`) +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_INV +THEN ASM_REWRITE_TAC[] +; + +REWRITE_TAC[REAL_ARITH`(&1+b) pow 2= &1+ &2*b+ b pow 2/\ &2 * inv g * t / &2= inv g * t `] +THEN MATCH_MP_TAC(REAL_ARITH`&0<=d /\ a< b+c==> a< b+c+d`) +THEN ASM_REWRITE_TAC[REAL_LE_POW_2] +THEN MRESAL_TAC REAL_LT_LMUL[`inv(x2-t):real`;`x2:real`;`(x2-t)*(&1+ inv g *t)`][REAL_ARITH`a*b*c=(a*b)*c/\ &1*x=x`] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[REAL_ARITH`x2 < (x2 - t) * (&1 + inv g * t) +<=> t< t*(x2-t) * inv g`] +THEN MRESAL_TAC REAL_LT_LMUL[`t:real`;`&1:real`;`(x2-t)*inv g `][REAL_ARITH`a*b*c=a*b*c/\ x* &1=x`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESAL_TAC REAL_LT_LMUL[`inv g:real`;`g:real`;`(x2-t) `][REAL_ARITH`a*b*c=a*b*c/\ x* &1=x`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`a*b=b*a`] +THEN POP_ASSUM MATCH_MP_TAC +THEN STRIP_TAC +; + +MATCH_MP_TAC REAL_LT_INV +THEN ASM_REWRITE_TAC[] +; + + + + +EXPAND_TAC"g" +THEN REPLICATE_TAC (151-55) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`t:real`][dist]) +THEN MP_TAC(REAL_ARITH`&2 &2<=norm(v3-v4:real^3)`) +THEN RESA_TAC +THEN MRESAL_TAC DOT_NORM[`v3 - v4:real^3`;`-- v3:real^3`][VECTOR_ARITH`wl - wi + (-- wl)= --wi:real^3`;NORM_NEG] +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm (v3:real^3)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm (v3 - v4:real^3)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`norm ((w:num->real^3) i)`;`&2* h0`;][ARITH_RULE`abs (&2 * #1.26)= &2 * #1.26`;REAL_ABS_NORM;h0] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[GSYM h0] +THEN ASM_REWRITE_TAC[h0] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`(v3 - v4) dot --v3 = (a1 - norm (v3 - v4) pow 2 - (x2 - t)) / &2 /\ &2 pow 2 <= x2 - t +/\ &2 pow 2 <= norm (v3 - v4) pow 2 /\ +a1 <= (&2 * #1.26) pow 2 +==> (v3 - v4:real^3) dot --v3< &0`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;DOT_RNEG;DOT_LSUB;DOT_SQUARE_NORM]) +THEN REAL_ARITH_TAC; + + +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +]);; + + + + +let DEFORMATION_DIST_LE_BLL_V3_DEFOR_COM=prove_by_refinement(` 3 &4 * h0 < scs_b_v39 s l i) +==> +(!i. ~(i MOD k = l MOD k) ==> +?e. &0< e/\ +(!t. &0< t/\ t< e ==> dist (v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i)<=scs_b_v39 s l i ))`, +[ +REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`l MOD k = SUC i MOD k \/ ~(SUC i MOD k= l MOD k)`) +THEN RESA_TAC; + +MP_TAC DEFORMATION_V3_DEFOR_EDGE +THEN RESA_TAC +THEN ASM_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0 REPEAT DISCH_TAC +THEN MP_TAC th) +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`l+k-1`;`i:num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`l+k-1:num`] THEN MRESA_TAC th[`i:num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`l+k-1:num`] THEN MRESA_TAC th[`i:num`]) +THEN REPLICATE_TAC (59-53) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM (fun th-> STRIP_TAC THEN MRESA_TAC th[`t:real`]) +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC (62-30) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num`;`i:num`][]) +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +MP_TAC(SET_RULE`i MOD k= SUC l MOD k \/ ~(i MOD k= SUC l MOD k )`) +THEN RESA_TAC; + +MP_TAC HYPER_MM_COLLINEAR +THEN RESA_TAC +THEN MP_TAC UPS_X_POS_SEG +THEN RESA_TAC +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM (fun th-> STRIP_TAC +THEN MP_TAC(REAL_ARITH`t --e ~(k=0)/\ ~(k=1)/\ 0real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`] THEN MRESA_TAC th[` SUC l:num`]) +THEN REWRITE_TAC[dist] +THEN REPLICATE_TAC (68-30) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num`;`SUC l:num`][]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC REAL_EQ_SQUARE_ABS[`norm (v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) - v1:real^3)`;`norm(v1-v2:real^3)`][REAL_ABS_NORM;GSYM dist] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`] THEN MRESA_TAC th[`SUC l:num`]); + +MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_B_SUC +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`i:num`][scs_diag]) +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM (fun th-> STRIP_TAC +THEN MP_TAC(REAL_ARITH`t --e &4 * h0 < scs_b_v39 s l i) +==> +?e. &0< e/\ +(!t i. &0< t/\ t< e/\ ~(i MOD k = l MOD k) ==> dist (v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i)<=scs_b_v39 s l i )`, +[ + + +REPEAT STRIP_TAC +THEN MP_TAC DEFORMATION_DIST_LE_BLL_V3_DEFOR_COM +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] +THEN REWRITE_TAC[SKOLEM_THM] +THEN STRIP_TAC +THEN ABBREV_TAC`e1= inf {(e:num->real) i| i < k/\ ~(i= l MOD k)}` +THEN EXISTS_TAC`e1:real` +THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` +THEN STRIP_TAC; + + +MATCH_MP_TAC FINITE_IMAGE +THEN REWRITE_TAC[FINITE_NUMSEG]; + + +REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`i:num` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + + +SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(i = l MOD k)} = {})`ASSUME_TAC; + + +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] +THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(0=l MOD k )`) +THEN RESA_TAC; + + + +EXISTS_TAC`(e:num->real)1` +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 1real)0` +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real) i| i < k/\ ~(i= l MOD k)}`;`&0`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN REPLICATE_TAC (13-5) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`]); + + +REPEAT STRIP_TAC +THEN MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(i= l MOD k)}`;`t:real`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`i MOD k` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`]; + + +STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_REFL[`i:num`;`k:num`] +THEN REPLICATE_TAC (15-5) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num MOD k`]) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]); +]);; + + + +(**************************) + +(***********BBs_V39********) + +(**************************) + + +let DEFORMATION_SMALL_INTERVAL=prove(`deformation ff V (a,b) /\ a<= c/\ c< &0 /\ &0 deformation ff V (c,d)`, +REWRITE_TAC[deformation;IN_REAL_INTERVAL] +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`c < r /\ r < d /\ a <= c/\d <= b +==> a < r /\ r < b`) +THEN RESA_TAC +THEN REPLICATE_TAC (12-2)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]);; + + + + +let DEFORMATION_V3_DEFOR_NOT_IN_V=prove_by_refinement(` 3 (!i. ?e. &0< e /\ (!t. &0 &0 ~(k=0)/\ ~(k=1)/\ 0 MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESA_TAC th[`l:num`]) +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN REPLICATE_TAC (54-51) (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`t --e t= &0`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC +THEN REWRITE_TAC[th;REAL_ARITH`~(&0< &0)`]); + +STRIP_TAC +THEN MATCH_MP_TAC(REAL_ARITH`&0<= a/\ ~(a= &0)==> &0 < a`) +THEN ASM_REWRITE_TAC[dist;NORM_POS_LE] +THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t):real^3`;`v2:real^3`]; + +MATCH_MP_TAC EXISTS_SMALL_LE_CONST +THEN ASM_REWRITE_TAC[] +THEN MP_TAC HYPER_MM_COLLINEAR +THEN RESA_TAC +THEN MATCH_MP_TAC(REAL_ARITH`&0<= a/\ ~(a= &0)==> &0 < a`) +THEN ASM_REWRITE_TAC[dist;NORM_POS_LE] +THEN MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0 +MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN MRESA_TAC th[`i MOD k`;`l MOD k`]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESA_TAC th[`l:num`]) +THEN STRIP_TAC +THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v2:real^3`;`(w:num->real^3) i`;]]);; + + + +let DEFORMATION_V3_DEFOR_NOT_IN_V_V1=prove_by_refinement(` 3 (!i. ~(i MOD k= l MOD k) ==> (?e. &0< e /\ (!t. --e &0 &0 < a`) +THEN ASM_REWRITE_TAC[dist;NORM_POS_LE] +THEN MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0 +MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN MRESA_TAC th[`i MOD k`;`l MOD k`]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESA_TAC th[`l:num`]) +THEN STRIP_TAC +THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v2:real^3`;`(w:num->real^3) i`;] +]);; + + + + + +let DEFORMATION_V3_DEFOR_NOT_IN_V_COM=prove_by_refinement(` 3 ?e. &0< e /\ (!t i. &0 &0real) i| i < k}` +THEN EXISTS_TAC`e1:real` +THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k }`ASSUME_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` +THEN STRIP_TAC; + +MATCH_MP_TAC FINITE_IMAGE +THEN REWRITE_TAC[FINITE_NUMSEG]; + +REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`i:num` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`~({(e:num->real) i | i < k } = {})`ASSUME_TAC; + + +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] +THEN EXISTS_TAC`(e:num->real)1` +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 1real) i| i < k}`;`&0`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC; + +MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k}`;`t:real`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k }`ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`i MOD k` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`]; + +STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) +THEN REPLICATE_TAC (18-10) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num MOD k`]) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) +THEN ASM_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]);]);; + + + +let DEFORMATION_V3_DEFOR_NOT_IN_V_COM_V1=prove_by_refinement(` 3 ?e. &0< e /\ (!t i. --e &0real) i| i < k/\ ~(i= l MOD k)}` +THEN EXISTS_TAC`e1:real` +THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` +THEN STRIP_TAC; + +MATCH_MP_TAC FINITE_IMAGE +THEN REWRITE_TAC[FINITE_NUMSEG]; + +REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`i:num` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(i = l MOD k)} = {})`ASSUME_TAC; + +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] +THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(0=l MOD k )`) +THEN RESA_TAC; + +EXISTS_TAC`(e:num->real)1` +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 1real)0` +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real) i| i < k/\ ~(i= l MOD k)}`;`&0`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN REPLICATE_TAC (13-5) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`]); + +REPEAT STRIP_TAC +THEN MRESAL_TAC REAL_LE_INF_FINITE[`{(e:num->real) i| i < k/\ ~(i= l MOD k)}`;`e1:real`][REAL_ARITH`a<=a`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`i MOD k` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`]; + +STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_REFL[`i:num`;`k:num`] +THEN MP_TAC(REAL_ARITH`-- e1 -- e(i MOD k)< t/\ t< e(i MOD k)`) +THEN RESA_TAC +THEN REPLICATE_TAC (12) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num MOD k`]) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]);]);; + + + + +let DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ=prove(` 3 ?e. &0< e /\ (!t i. &0 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i))`, +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM +THEN RESA_TAC +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA_TAC th[`t:real`;`i:num`]) +THEN POP_ASSUM (fun th-> STRIP_TAC +THEN MP_TAC th +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[DIST_REFL]) +THEN REAL_ARITH_TAC);; + + +let DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1=prove(` 3 ?e. &0< e /\ (!t i. -- e ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i))`, +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_V1 +THEN RESA_TAC +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA_TAC th[`t:real`;`i:num`]) +THEN POP_ASSUM (fun th-> STRIP_TAC +THEN MP_TAC th +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[DIST_REFL]) +THEN REAL_ARITH_TAC);; + + + +let V3_DEFOR_EQ_IN_FF=prove_by_refinement( +` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> (!w. v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t),w IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF <=> v2,w IN FF)`, +[STRIP_TAC +THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (47-44)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN STRIP_TAC +THEN REPLICATE_TAC (48-18)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`x':num`]); + +EXISTS_TAC`v2:real^3,w':real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,w'):real^3#real^3`]]);; + + + +let V3_DEFOR_EQ_IN_FF_V1=prove_by_refinement(` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> (!w. v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t),w IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF <=> v2,w IN FF)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (47-44)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN STRIP_TAC +THEN REPLICATE_TAC (48-18)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`x':num`]) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESA_TAC th[`l:num`]) +THEN REPLICATE_TAC (68-61)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +EXISTS_TAC`v2:real^3,w':real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,w'):real^3#real^3`]]);; + + + + + + + + +let V3_DEFOR_RHO_NODE=prove(` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> (rho_node1 + (IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF) + (v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t))) = (rho_node1 FF v2)`, +REWRITE_TAC[rho_node1] +THEN STRIP_TAC +THEN MP_TAC V3_DEFOR_EQ_IN_FF +THEN RESA_TAC);; + + +let V3_DEFOR_RHO_NODE_V1=prove(` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> (rho_node1 + (IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF) + (v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t))) = (rho_node1 FF v2)`, +REWRITE_TAC[rho_node1] +THEN STRIP_TAC +THEN MP_TAC V3_DEFOR_EQ_IN_FF_V1 +THEN RESA_TAC);; + + + + + +let V3_DEFOR_EQ_IN_FF_SYM=prove_by_refinement(` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> (!w. w,v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF <=> w,v2 IN FF)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + + +REPLICATE_TAC (40-23)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (47-44)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN STRIP_TAC +THEN REPLICATE_TAC (48-18)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`SUC x':num`]); + +EXISTS_TAC`w':real^3,v2:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w',v2):real^3#real^3`]]);; + + + + + +let V3_DEFOR_EQ_IN_FF_SYM_V1=prove_by_refinement(` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> (!w. w,v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF <=> w,v2 IN FF)`, +[STRIP_TAC +THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (40-23)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (47-44)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN STRIP_TAC +THEN REPLICATE_TAC (48-18)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`SUC x':num`]) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC x':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESA_TAC th[`l:num`]) +THEN REPLICATE_TAC (68-61)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +EXISTS_TAC`w':real^3,v2:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w',v2):real^3#real^3`]]);; + + + + + + + +let DEFORMATION_AZIM_V3_DEFOR_V1=prove_by_refinement(` 3real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!t. &0< t/\ t< e ==> +azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t)) + (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t IN + IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) = + azim (vec 0) v2 (rho_node1 FF v2) (@a. a,v2 IN FF)))`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ +THEN RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (l + k - 1)`] +THEN ABBREV_TAC`e1=(min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1< e/\ e1 t< e`) +THEN RESA_TAC +THEN MP_TAC V3_DEFOR_EQ_IN_FF_SYM +THEN RESA_TAC +THEN ASM_SIMP_TAC[v3_defor_v4;] +THEN MP_TAC V3_DEFOR_RHO_NODE +THEN RESA_TAC +THEN ASM_REWRITE_TAC[GSYM ivs_rho_node1] +THEN ASM_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0 REPEAT STRIP_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN SUBGOAL_THEN`(w:num->real^3) (l) IN V` ASSUME_TAC; + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +MRESA_TAC (GEN_ALL Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1)[`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(w:num->real^3) (l)`]) +THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME)[`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l)`;`w:num->real^3`;`l:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;is_scs_v39;periodic2] +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`SUC 0`][ITER] THEN MRESA_TAC th[`k-1`]) +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0+l= SUC(l)/\ k-1+l= l+k-1`] +THEN REPLICATE_TAC (75-57) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`t t< e'`) +THEN RESA_TAC +THEN MRESA_TAC th[`t:real`]) +THEN MATCH_MP_TAC Planarity.aff_gt2_subset_aff_ge +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`(w:num->real^3)(l+k-1)`] +THEN STRIP_TAC; + +MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan +THEN EXISTS_TAC`v1:real^3` +THEN ASM_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[]; + +MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan +THEN EXISTS_TAC`(w:num->real^3)(l+k-1)` +THEN ASM_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[]]);; + + + +let DEFORMATION_AZIM_V3_DEFOR_V1_V1=prove_by_refinement(` 3real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!t. --e< t/\ t< e ==> +azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t)) + (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t IN + IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) = + azim (vec 0) v2 (rho_node1 FF v2) (@a. a,v2 IN FF)))`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1 +THEN RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (l + k - 1)`] +THEN ABBREV_TAC`e1=(min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1< e/\ e1 t< e/\ --e ~(k=0)/\ ~(k=1)/\ 0 REPEAT STRIP_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN SUBGOAL_THEN`(w:num->real^3) (l) IN V` ASSUME_TAC; + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +MRESA_TAC (GEN_ALL Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1)[`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(w:num->real^3) (l)`]) +THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME)[`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l)`;`w:num->real^3`;`l:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;is_scs_v39;periodic2] +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`SUC 0`][ITER] THEN MRESA_TAC th[`k-1`]) +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0+l= SUC(l)/\ k-1+l= l+k-1`]; + +REPLICATE_TAC (76-57) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`t t< e'/\ --e'real^3)(l+k-1)`] +THEN STRIP_TAC; + +MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan +THEN EXISTS_TAC`v1:real^3` +THEN ASM_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[]; + +MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan +THEN EXISTS_TAC`(w:num->real^3)(l+k-1)` +THEN ASM_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[]]);; + + + + + + + +let V3_DEFOR_EQ_IN_FF_AT_V1=prove_by_refinement(` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(!w. v1,w IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF<=> +v1,w IN FF)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (44-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`SUC l:num`]) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`v2= SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +SUBGOAL_THEN`v1,v2 IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + + +SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v1:real^3`;`(w:num->real^3) (l+k-1)`] +THEN REPLICATE_TAC (49-8)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`(w:num->real^3) (l+k-1)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[]; + +EXISTS_TAC`v1:real^3,w':real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`v2= w':real^3\/ ~(v2=w')`) +THEN RESA_TAC; + +SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v1:real^3`;`(w:num->real^3) (l+k-1)`] +THEN REPLICATE_TAC (51-8)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`(w:num->real^3) (l+k-1)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[]]);; + + + + +let V3_DEFOR_EQ_IN_FF_AT_V1_V1=prove_by_refinement(` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(!w. v1,w IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF<=> +v1,w IN FF)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (44-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`SUC l:num`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th [`l:num`]) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`v2= SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +SUBGOAL_THEN`v1,v2 IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v1:real^3`;`(w:num->real^3) (l+k-1)`] +THEN REPLICATE_TAC (49-8)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`(w:num->real^3) (l+k-1)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[]; + +EXISTS_TAC`v1:real^3,w':real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`v2= w':real^3\/ ~(v2=w')`) +THEN RESA_TAC; + +SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v1:real^3`;`(w:num->real^3) (l+k-1)`] +THEN REPLICATE_TAC (51-8)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`(w:num->real^3) (l+k-1)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[]]);; + + +let V3_DEFOR_RHO_NODE_AT_V1=prove(` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(rho_node1 + (IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF) + v1) +=(rho_node1 FF v1)`, +REWRITE_TAC[rho_node1] +THEN STRIP_TAC +THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_V1 +THEN RESA_TAC);; + + + +let V3_DEFOR_RHO_NODE_AT_V1_V1=prove(` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(rho_node1 + (IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF) + v1) +=(rho_node1 FF v1)`, +REWRITE_TAC[rho_node1] +THEN STRIP_TAC +THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_V1_V1 +THEN RESA_TAC);; + + + + + + + +let V3_DEFOR_EQ_IN_FF_AT_V1_SYM=prove_by_refinement(` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(@w. w,v1 IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF)= +v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA +THEN STRIP_TAC; + +EXISTS_TAC`v3_defor_v1 (-- &1) (v1) (v2) x1 x2 x6 x6 (x2 - t)` +THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`v2:real^3,v1:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (45-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`SUC l:num`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC; + +SUBGOAL_THEN`w',v1 IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`v2,v1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v1:real^3`;`FF:real^3#real^3->bool`;`v2:real^3`;`(w':real^3) `]]);; + + + +let V3_DEFOR_EQ_IN_FF_AT_V1_SYM_V1=prove_by_refinement( +` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(@w. w,v1 IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF)= +v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA +THEN STRIP_TAC; + +EXISTS_TAC`v3_defor_v1 (-- &1) (v1) (v2) x1 x2 x6 x6 (x2 - t)` +THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`v2:real^3,v1:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (45-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`SUC l:num`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th [`l:num`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC; + +SUBGOAL_THEN`w',v1 IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`v2,v1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v1:real^3`;`FF:real^3#real^3->bool`;`v2:real^3`;`(w':real^3) `]]);; + + + + +let DEFORMATION_AZIM_V3_DEFOR_V1_AT_V1=prove_by_refinement(` 3real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!t. &0< t/\ t< e ==> +azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v1 t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v1 t)) + (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v1 t IN + IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) = + azim (vec 0) v1 (rho_node1 FF v1) (@a. a,v1 IN FF)))`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ +THEN RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (l + k - 1)`] +THEN ABBREV_TAC`e1=(min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1< e/\ e1 t< e`) +THEN RESA_TAC +THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_V1_SYM +THEN RESA_TAC +THEN ASM_SIMP_TAC[v3_defor_v4;] +THEN MP_TAC V3_DEFOR_RHO_NODE_AT_V1 +THEN RESA_TAC +THEN ASM_REWRITE_TAC[GSYM ivs_rho_node1] +THEN ASM_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0 REPEAT STRIP_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN SUBGOAL_THEN`v2,v1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v1:real^3`;`v2:real^3`] +THEN MP_TAC(SET_RULE`v2 IN aff_gt {vec 0} {v1, w (l + k - 1)}/\ + aff_gt {vec 0} {v1, w (l + k - 1)} SUBSET aff_ge {vec 0} {v1, w (l + k - 1)} +==> v2 IN aff_ge {vec 0} {v1:real^3, w (l + k - 1)}`) +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN RESA_TAC +THEN MRESA_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT[`vec 0:real^3`;`v1:real^3`;`v2:real^3`;`(w:num->real^3)(l+k-1)`;`(rho_node1 FF v1)`;] +THEN MATCH_MP_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT +THEN STRIP_TAC; + +MATCH_MP_TAC(GEN_ALL (SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff_gt{vec 0:real^3} {v1,w(l+k-1)}` +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN REPLICATE_TAC (81-57) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(REAL_ARITH`t t< e'`) +THEN ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan +THEN EXISTS_TAC`(w:num->real^3) (l+k-1)` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (81-57) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(REAL_ARITH`t t< e'`) +THEN ASM_REWRITE_TAC[]]);; + + +let DEFORMATION_AZIM_V3_DEFOR_V1_AT_V1_V1=prove_by_refinement( +` 3real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!t. --e< t/\ t< e ==> +azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v1 t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v1 t)) + (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v1 t IN + IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) = + azim (vec 0) v1 (rho_node1 FF v1) (@a. a,v1 IN FF)))`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1 +THEN RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (l + k - 1)`] +THEN ABBREV_TAC`e1=(min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1< e/\ e1 t< e/\ --e ~(k=0)/\ ~(k=1)/\ 0 REPEAT STRIP_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN SUBGOAL_THEN`v2,v1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v1:real^3`;`v2:real^3`] +THEN MP_TAC(SET_RULE`v2 IN aff_gt {vec 0} {v1, w (l + k - 1)}/\ + aff_gt {vec 0} {v1, w (l + k - 1)} SUBSET aff_ge {vec 0} {v1, w (l + k - 1)} +==> v2 IN aff_ge {vec 0} {v1:real^3, w (l + k - 1)}`) +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN RESA_TAC +THEN MRESA_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT[`vec 0:real^3`;`v1:real^3`;`v2:real^3`;`(w:num->real^3)(l+k-1)`;`(rho_node1 FF v1)`;] +THEN MATCH_MP_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT +THEN STRIP_TAC; + +MATCH_MP_TAC(GEN_ALL (SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff_gt{vec 0:real^3} {v1,w(l+k-1)}` +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]; + +REPLICATE_TAC (82-57) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`t t< e'/\ --e'real^3) (l+k-1)` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (82-57) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`t t< e'/\ --e' ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(!v. v,w (l + (scs_k_v39 s - 1)) IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF<=> +v,w (l + (scs_k_v39 s - 1)) IN FF)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (44-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`l+k-1:num`]) +THEN POP_ASSUM MP_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +SUBGOAL_THEN`v2, w(l+k-1) IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v2:real^3,(w:num->real^3)(l+k-1)`;`V:real^3->bool`;] +THEN MP_TAC Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`SND(x:real^3#real^3)`]); + +EXISTS_TAC`v:real^3,(w:num->real^3) (l + k - 1)` +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3)(l+k-1),v2:real^3`;]; + +MP_TAC(SET_RULE`v2=v:real^3\/ ~(v=v2)`) +THEN RESA_TAC; + +SUBGOAL_THEN`v2, w(l+k-1) IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v2:real^3,(w:num->real^3)(l+k-1)`;`V:real^3->bool`;] +THEN MP_TAC Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(w:num->real^3)(l+k-1)`]);]);; + + + +let V3_DEFOR_EQ_IN_FF_AT_W_V1=prove_by_refinement(` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(!v. v,w (l + (scs_k_v39 s - 1)) IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF<=> +v,w (l + (scs_k_v39 s - 1)) IN FF)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (44-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`l+k-1:num`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC MOD_ADD_SUB_1 +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +SUBGOAL_THEN`v2, w(l+k-1) IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v2:real^3,(w:num->real^3)(l+k-1)`;`V:real^3->bool`;] +THEN MP_TAC Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`SND(x:real^3#real^3)`]); + +EXISTS_TAC`v:real^3,(w:num->real^3) (l + k - 1)` +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3)(l+k-1),v2:real^3`;]; + +MP_TAC(SET_RULE`v2=v:real^3\/ ~(v=v2)`) +THEN RESA_TAC; + +SUBGOAL_THEN`v2, w(l+k-1) IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v2:real^3,(w:num->real^3)(l+k-1)`;`V:real^3->bool`;] +THEN MP_TAC Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(w:num->real^3)(l+k-1)`])]);; + + + + +let V3_DEFOR_EQ_IN_FF_AT_W_SYM=prove_by_refinement( +` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(@v. w(l+k-1),v IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF)= +v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA +THEN STRIP_TAC; + +EXISTS_TAC`v3_defor_v1 (-- &1) (v1) (v2) x1 x2 x6 x6 (x2 - t)` +THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`(w:num->real^3) (l + k - 1),v2:real^3` +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3)(l+k-1),v2:real^3`;]; + +REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (46-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`l+k-1:num`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC; + +SUBGOAL_THEN`(w:num->real^3)(l+k-1),v IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v:real^3`;]]);; + + + + +let V3_DEFOR_EQ_IN_FF_AT_W_SYM_V1=prove_by_refinement(` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(@v. w(l+k-1),v IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF)= +v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA +THEN STRIP_TAC; + +EXISTS_TAC`v3_defor_v1 (-- &1) (v1) (v2) x1 x2 x6 x6 (x2 - t)` +THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`(w:num->real^3) (l + k - 1),v2:real^3` +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3)(l+k-1),v2:real^3`;]; + +REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (46-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`l+k-1:num`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC MOD_ADD_SUB_1 +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC; + +SUBGOAL_THEN`(w:num->real^3)(l+k-1),v IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v:real^3`;] +]);; + + + + + + + + + + + +let DEFORMATION_AZIM_V3_DEFOR_V1_AT_W=prove_by_refinement( +` 3real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!t. &0< t/\ t< e ==> +azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l + k - 1)) t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l + k - 1)) t)) + (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l + k - 1)) t IN + IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) = + azim (vec 0) (w (l + k - 1)) (rho_node1 FF (w (l + k - 1))) + (@a. a,w (l + k - 1) IN FF)))`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ +THEN RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (l + k - 1)`] +THEN ABBREV_TAC`e1=(min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1< e/\ e1 t< e`) +THEN RESA_TAC +THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic;BBprime_v39;] +THEN REPEAT RESA_TAC; + +ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3)(l+k-1),v2:real^3`;] +THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_W_SYM +THEN RESA_TAC +THEN ASM_SIMP_TAC[v3_defor_v4;] +THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_W +THEN RESA_TAC +THEN ASM_REWRITE_TAC[rho_node1] +THEN ASM_REWRITE_TAC[GSYM rho_node1;GSYM ivs_rho_node1] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] +THEN ONCE_REWRITE_TAC[Rogers.AZIM_EQ_SYM]; + +MP_TAC(SET_RULE`v2 IN aff_gt {vec 0} {v1, w (l + k - 1)}/\ + aff_gt {vec 0} {v1, w (l + k - 1)} SUBSET aff_ge {vec 0} {v1, w (l + k - 1)} +==> v2 IN aff_ge {vec 0} {v1:real^3, w (l + k - 1)}`) +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC(GEN_ALL Planarity.properties_of_collinear4_points_fan) +[`vec 0:real^3`;`(w:num->real^3)(l+k-1)`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT[`vec 0:real^3`;`(w:num->real^3)(l+k-1)`;`v2:real^3`;`v1:real^3`;`(ivs_rho_node1 FF (w(l+k-1)))`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN MATCH_MP_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT +THEN STRIP_TAC; + +ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN MATCH_MP_TAC(GEN_ALL (SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff_gt{vec 0:real^3} {v1,w(l+k-1)}` +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN REPLICATE_TAC (47-22) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(REAL_ARITH`t t< e'`) +THEN ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan +THEN EXISTS_TAC`v1:real^3` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (47-22) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(REAL_ARITH`t t< e'`) +THEN ASM_REWRITE_TAC[]]);; + + + +let DEFORMATION_AZIM_V3_DEFOR_V1_AT_W_V1=prove_by_refinement( +` 3real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!t. --e< t/\ t< e ==> +azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l + k - 1)) t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l + k - 1)) t)) + (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l + k - 1)) t IN + IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) = + azim (vec 0) (w (l + k - 1)) (rho_node1 FF (w (l + k - 1))) + (@a. a,w (l + k - 1) IN FF)))`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1 +THEN RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (l + k - 1)`] +THEN ABBREV_TAC`e1=(min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1< e/\ e1 t< e/\ --ebool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic;BBprime_v39;] +THEN REPEAT RESA_TAC; + +ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (38-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3)(l+k-1),v2:real^3`;] +THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_W_SYM_V1 +THEN RESA_TAC +THEN ASM_SIMP_TAC[v3_defor_v4;] +THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_W_V1 +THEN RESA_TAC +THEN ASM_REWRITE_TAC[rho_node1] +THEN ASM_REWRITE_TAC[GSYM rho_node1;GSYM ivs_rho_node1] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] +THEN ONCE_REWRITE_TAC[Rogers.AZIM_EQ_SYM]; + +MP_TAC(SET_RULE`v2 IN aff_gt {vec 0} {v1, w (l + k - 1)}/\ + aff_gt {vec 0} {v1, w (l + k - 1)} SUBSET aff_ge {vec 0} {v1, w (l + k - 1)} +==> v2 IN aff_ge {vec 0} {v1:real^3, w (l + k - 1)}`) +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC(GEN_ALL Planarity.properties_of_collinear4_points_fan) +[`vec 0:real^3`;`(w:num->real^3)(l+k-1)`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT[`vec 0:real^3`;`(w:num->real^3)(l+k-1)`;`v2:real^3`;`v1:real^3`;`(ivs_rho_node1 FF (w(l+k-1)))`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN MATCH_MP_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT +THEN STRIP_TAC; + +ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN MATCH_MP_TAC(GEN_ALL (SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff_gt{vec 0:real^3} {v1,w(l+k-1)}` +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN REPLICATE_TAC (48-22) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`t t< e'/\ --e' REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`t t< e'/\ --e' ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +/\ ~(v=v1)/\ ~(v=v2)/\ ~(v= w(l+k-1)) +/\ v IN V +==> +(!w. v,w IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF<=> +v,w IN FF)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (24-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (42-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (49-23)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN STRIP_TAC +THEN REPLICATE_TAC (50-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`x':num`]) +THEN REPLICATE_TAC (50-46)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`v2= SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +SUBGOAL_THEN`v,v2 IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`(w:num->real^3) (l+k-1)`]; + +EXISTS_TAC`v:real^3,w':real^3` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`v2= w':real^3\/ ~(v2=w')`) +THEN RESA_TAC; + +SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`(w:num->real^3) (l+k-1)`]]);; + + + +let V3_DEFOR_EQ_IN_FF_AT_V_ANY_V1=prove_by_refinement( +` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +/\ ~(v=v1)/\ ~(v=v2)/\ ~(v= w(l+k-1)) +/\ v IN V +==> +(!w. v,w IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF<=> +v,w IN FF)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (24-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + + +REPLICATE_TAC (42-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (49-23)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN STRIP_TAC +THEN REPLICATE_TAC (50-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`x':num`]) +THEN REPLICATE_TAC (50-46)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC DIVISION[`x':num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN MP_TAC(SET_RULE`x' MOD k = l MOD k \/ ~(x' MOD k = l MOD k)`) +THEN RESA_TAC; + + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESA_TAC th[`l:num`]) +THEN REPLICATE_TAC (77-39)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + + +RESA_TAC; + + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`v2= SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +SUBGOAL_THEN`v,v2 IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + + +MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`(w:num->real^3) (l+k-1)`]; + +EXISTS_TAC`v:real^3,w':real^3` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`v2= w':real^3\/ ~(v2=w')`) +THEN RESA_TAC; + +SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`(w:num->real^3) (l+k-1)`]]);; + + + + + + + +let V3_DEFOR_EQ_IN_FF_AT_V_ANY_SYM=prove_by_refinement(` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +/\ ~(v=v1)/\ ~(v=v2)/\ ~(v= w(l+k-1)) +/\ v IN V +==> +(!w. w,v IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF<=> +w,v IN FF)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (24-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (42-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (49-23)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN STRIP_TAC +THEN REPLICATE_TAC (50-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`x':num`]) +THEN REPLICATE_TAC (50-47)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +SUBGOAL_THEN`v2,v IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`v2,v1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(v2:real^3)`;`v1:real^3`;] +THEN REPLICATE_TAC (54-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +EXISTS_TAC`w':real^3,v:real^3` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`v2= w':real^3\/ ~(v2=w')`) +THEN RESA_TAC; + +SUBGOAL_THEN`v2,v1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(v2:real^3)`;`v1:real^3`;] +THEN REPLICATE_TAC (54-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]]);; + + +let V3_DEFOR_EQ_IN_FF_AT_V_ANY_SYM_V1=prove_by_refinement( +` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +/\ ~(v=v1)/\ ~(v=v2)/\ ~(v= w(l+k-1)) +/\ v IN V +==> +(!w. w,v IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF<=> +w,v IN FF)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (24-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + + +REPLICATE_TAC (42-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (49-23)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN STRIP_TAC +THEN REPLICATE_TAC (50-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`x':num`]) +THEN REPLICATE_TAC (50-47)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC DIVISION[`x':num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN MP_TAC(SET_RULE`x' MOD k = l MOD k \/ ~(x' MOD k = l MOD k)`) +THEN RESA_TAC; + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESA_TAC th[`l:num`]) +THEN REPLICATE_TAC (77-39)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +SUBGOAL_THEN`v2,v IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`v2,v1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(v2:real^3)`;`v1:real^3`;] +THEN REPLICATE_TAC (54-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +EXISTS_TAC`w':real^3,v:real^3` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`v2= w':real^3\/ ~(v2=w')`) +THEN RESA_TAC; + +SUBGOAL_THEN`v2,v1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(v2:real^3)`;`v1:real^3`;] +THEN REPLICATE_TAC (54-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]]);; + + + +let DEFORMATION_AZIM_V3_DEFOR_V1_AT_V_ANY=prove( +` 3real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!t v. &0< t/\ t< e /\ ~(v=v1)/\ ~(v=v2)/\ ~(v= w(l+k-1)) +/\ v IN V + ==> +azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t)) + (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t IN + IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) = + azim (vec 0) v (rho_node1 FF v) (@a. a,v IN FF)))`, +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ +THEN RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (l + k - 1)`] +THEN ABBREV_TAC`e1=(min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1< e/\ e1 t< e`) +THEN RESA_TAC +THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_V_ANY_SYM +THEN RESA_TAC +THEN ASM_SIMP_TAC[v3_defor_v4;] +THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_V_ANY +THEN RESA_TAC +THEN ASM_SIMP_TAC[rho_node1;]);; + + + + +let DEFORMATION_AZIM_V3_DEFOR_V1_AT_V_ANY_V1=prove(` 3real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!t v. --e< t/\ t< e /\ ~(v=v1)/\ ~(v=v2)/\ ~(v= w(l+k-1)) +/\ v IN V + ==> +azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t)) + (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t IN + IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) = + azim (vec 0) v (rho_node1 FF v) (@a. a,v IN FF)))`, +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1 +THEN RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (l + k - 1)`] +THEN ABBREV_TAC`e1=(min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1< e/\ e1 t< e/\ --ereal^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!t v. &0< t/\ t< e /\ v IN V ==> +azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (v) t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (v) t)) + (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (v) t IN + IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) = + azim (vec 0) (v) (rho_node1 FF (v)) + (@a. a,v IN FF)))`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_W +THEN RESA_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_V1 +THEN RESA_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1 +THEN RESA_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_V_ANY +THEN RESA_TAC +THEN ABBREV_TAC`e1=(min (min (min e e') e'')e''')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min (min (min e e') e'')e''')/ &2/\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''==> &0< e1/\ e1 treal^3)(l+k-1))\/ ~(v=(w:num->real^3)(l+k-1))`) +THEN RESA_TAC; + +REPLICATE_TAC (40-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +MP_TAC(SET_RULE`(v=(v1:real^3))\/ ~(v=v1)`) +THEN RESA_TAC; + +REPLICATE_TAC (41-22) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +MP_TAC(SET_RULE`(v=(v2:real^3))\/ ~(v=v2)`) +THEN RESA_TAC; + +REPLICATE_TAC (42-24) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +REPLICATE_TAC (42-26) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]]);; + + +let DEFORMATION_AZIM_V3_DEFOR_V1_AT_ALL_V1=prove_by_refinement(` 3real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!t v. --e< t/\ t< e /\ v IN V ==> +azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (v) t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (v) t)) + (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (v) t IN + IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) = + azim (vec 0) (v) (rho_node1 FF (v)) + (@a. a,v IN FF)))`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_W_V1 +THEN RESA_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_V1_V1 +THEN RESA_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_V1 +THEN RESA_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_V_ANY_V1 +THEN RESA_TAC +THEN ABBREV_TAC`e1=(min (min (min e e') e'')e''')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min (min (min e e') e'')e''')/ &2/\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''==> &0< e1/\ e1 treal^3)(l+k-1))\/ ~(v=(w:num->real^3)(l+k-1))`) +THEN RESA_TAC; + +REPLICATE_TAC (44-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +MP_TAC(SET_RULE`(v=(v1:real^3))\/ ~(v=v1)`) +THEN RESA_TAC; + +REPLICATE_TAC (45-22) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +MP_TAC(SET_RULE`(v=(v2:real^3))\/ ~(v=v2)`) +THEN RESA_TAC; + +REPLICATE_TAC (46-24) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +REPLICATE_TAC (46-26) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]]);; + + + + + + + + + + + +let DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR=prove(` 3real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!v t. + v IN V /\ + &0< t /\ t< e /\ + interior_angle1 (vec 0) FF v = pi + ==> interior_angle1 (vec 0) + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) <= + pi))`, +REPEAT STRIP_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_ALL +THEN RESA_TAC +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[interior_angle1] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (24-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`;`v:real^3`]) +THEN REAL_ARITH_TAC);; + + + +let DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1=prove(` 3real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!v t. + v IN V /\ + --e< t /\ t< e /\ + interior_angle1 (vec 0) FF v = pi + ==> interior_angle1 (vec 0) + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) <= + pi))`, +REPEAT STRIP_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_ALL_V1 +THEN RESA_TAC +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[interior_angle1] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (24-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`;`v:real^3`]) +THEN REAL_ARITH_TAC);; + + +let V_DEFORMATION_V3_DEFOR=prove(` +IMAGE (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w i) t) (:num) =IMAGE (\v. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) (IMAGE w (:num))`, +REWRITE_TAC[IMAGE;IN_ELIM_THM;EXTENSION] +THEN SET_TAC[]);; + + +let E_DEFORMATION_V3_DEFOR=prove_by_refinement(`IMAGE + (\i. {v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w i) t, v3_defor_v4 + (-- &1) + x1 + x2 + x6 + v1 + v2 + (w (SUC i)) + t}) + (:num) = IMAGE (IMAGE (\v. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t)) (IMAGE (\i. {w i, w (SUC i)}) (:num))`, +[REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; +RESA_TAC +THEN EXISTS_TAC`{(w:num->real^3) x', w (SUC x')}` +THEN STRIP_TAC; +EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[]; +SET_TAC[]; +RESA_TAC +THEN EXISTS_TAC`x'':num` +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]]);; + + + + + +let F_DEFORMATION_V3_DEFOR=prove(`IMAGE + (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w i) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (SUC i)) t) + (:num) += IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) (IMAGE (\i. w i,w (SUC i)) (:num))`, +REWRITE_TAC[EXTENSION;IMAGE;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +RESA_TAC +THEN EXISTS_TAC`(w:num->real^3) x',w (SUC x')` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[]; +RESA_TAC +THEN EXISTS_TAC`x'':num` +THEN ASM_REWRITE_TAC[]]);; + + + +let DEFORMATION_LUNAR_AFFINE_HULL=prove_by_refinement( +`3real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +/\ IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)=E +/\ lunar (v,w1) V E +==> +?e. &0 v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t IN + affine hull {vec 0, v, w1, v2})`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ +THEN RESA_TAC +THEN MP_TAC HYPER_MM_COLLINEAR +THEN RESA_TAC +THEN REPLICATE_TAC (25-6)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +POP_ASSUM(fun th1-> +REPEAT DISCH_TAC +THEN MP_TAC th THEN MP_TAC th1)) +THEN REPEAT RESA_TAC +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (l + k - 1)`] +THEN REPLICATE_TAC (27-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;] +THEN MP_TAC th +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +SUBGOAL_THEN`v2,v1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(v2:real^3)`;`v1:real^3`;] +THEN MRESAL_TAC (GEN_ALL LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI) +[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`w1:real^3`;][DIFF;IN_ELIM_THM;SET_RULE`~(a IN {b,c}) <=> (~(a=b)/\ ~(a=c))`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v2:real^3`]) +THEN MRESA_TAC (GEN_ALL Collect_geom2.THREE_GEN_POINTS_IN_AFF3)[`v2:real^3`;`v:real^3`;`w1:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.CONV02_SUBSET_AFF2)[`v:real^3`;`w1:real^3`] +THEN MP_TAC(SET_RULE`v IN aff {v2, v, w1}/\ w1 IN aff {v2, v, w1} +==> {v, w1} SUBSET aff {v2, v, w1:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.S_SUBSET_IMP_AFF_S_TOO)[`{v, w1:real^3}`;` {v2, v, w1:real^3}`] +THEN MP_TAC(SET_RULE`v1 IN aff {v2, v, w1}/\ w (l + k - 1) IN aff {v2, v, w1} +/\ vec 0 IN conv0 {v, w1} /\ conv0 {v, w1} SUBSET aff {v, w1} +/\ aff {v, w1} SUBSET aff {v2, v, w1} +==> {vec 0, v1, w (l + k - 1)} SUBSET aff {v2, v, w1:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.S_SUBSET_IMP_AFF_S_TOO)[`{vec 0, v1, w (l + k - 1):real^3}`;` {v2, v, w1:real^3}`] +THEN MRESAL_TAC (GEN_ALL Local_lemmas.AFF_GT_SUB_AFF_UNION)[`{vec 0:real^3}`;`{ v1, w (l + k - 1):real^3}`][SET_RULE`{A}UNION {B,C}={A,B,C}`] +THEN EXISTS_TAC`e':real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (66-27)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`]) +THEN REWRITE_TAC[GSYM aff] +THEN MRESAL_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA[`{v2, v, w1:real^3}`;`{vec 0,v, w1,v2:real^3}`][SET_RULE`{A,B,C} SUBSET {D,B,C,A}`;GSYM aff] +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff {v2, v, w1:real^3}` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff {vec 0, v1, w (l + k - 1):real^3}` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff_gt {vec 0} {v1, w (l + k - 1):real^3}` +THEN ASM_REWRITE_TAC[v3_defor_v4]]);; + + +let DEFORMATION_LUNAR_AFFINE_HULL_V1=prove_by_refinement(`3real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +/\ IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)=E +/\ lunar (v,w1) V E +==> +?e. &0 v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t IN + affine hull {vec 0, v, w1, v2})`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1 +THEN RESA_TAC +THEN MP_TAC HYPER_MM_COLLINEAR +THEN RESA_TAC +THEN REPLICATE_TAC (25-6)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +POP_ASSUM(fun th1-> +REPEAT DISCH_TAC +THEN MP_TAC th THEN MP_TAC th1)) +THEN REPEAT RESA_TAC +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (l + k - 1)`] +THEN REPLICATE_TAC (27-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;IN_REAL_INTERVAL] +THEN MP_TAC th +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +SUBGOAL_THEN`v2,v1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(v2:real^3)`;`v1:real^3`;] +THEN MRESAL_TAC (GEN_ALL LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI) +[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`w1:real^3`;][DIFF;IN_ELIM_THM;SET_RULE`~(a IN {b,c}) <=> (~(a=b)/\ ~(a=c))`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v2:real^3`]) +THEN MRESA_TAC (GEN_ALL Collect_geom2.THREE_GEN_POINTS_IN_AFF3)[`v2:real^3`;`v:real^3`;`w1:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.CONV02_SUBSET_AFF2)[`v:real^3`;`w1:real^3`] +THEN MP_TAC(SET_RULE`v IN aff {v2, v, w1}/\ w1 IN aff {v2, v, w1} +==> {v, w1} SUBSET aff {v2, v, w1:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.S_SUBSET_IMP_AFF_S_TOO)[`{v, w1:real^3}`;` {v2, v, w1:real^3}`] +THEN MP_TAC(SET_RULE`v1 IN aff {v2, v, w1}/\ w (l + k - 1) IN aff {v2, v, w1} +/\ vec 0 IN conv0 {v, w1} /\ conv0 {v, w1} SUBSET aff {v, w1} +/\ aff {v, w1} SUBSET aff {v2, v, w1} +==> {vec 0, v1, w (l + k - 1)} SUBSET aff {v2, v, w1:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.S_SUBSET_IMP_AFF_S_TOO)[`{vec 0, v1, w (l + k - 1):real^3}`;` {v2, v, w1:real^3}`] +THEN MRESAL_TAC (GEN_ALL Local_lemmas.AFF_GT_SUB_AFF_UNION)[`{vec 0:real^3}`;`{ v1, w (l + k - 1):real^3}`][SET_RULE`{A}UNION {B,C}={A,B,C}`] +THEN EXISTS_TAC`e':real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (66-27)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`]) +THEN REWRITE_TAC[GSYM aff] +THEN MRESAL_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA[`{v2, v, w1:real^3}`;`{vec 0,v, w1,v2:real^3}`][SET_RULE`{A,B,C} SUBSET {D,B,C,A}`;GSYM aff] +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff {v2, v, w1:real^3}` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff {vec 0, v1, w (l + k - 1):real^3}` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff_gt {vec 0} {v1, w (l + k - 1):real^3}` +THEN ASM_REWRITE_TAC[v3_defor_v4];]);; + + + + + + + + + + +(******************************) + + + +let MHAEYJNv1_concl = +`!a b V E FF f v w u. + convex_local_fan (V,E,FF) /\ + lunar (v,w) V E /\ + deformation f V (a,b) /\ + interior_angle1 (vec 0) FF v < pi /\ + u IN V /\ + ~(u = v) /\ + ~(u = w) /\ + (!u' t. u' IN V /\ ~(u = u') /\ t IN real_interval (a,b) ==> f u' t = u') /\ + (!t. &0< t/\ t f u t IN affine hull {vec 0, v, w, u}) + ==> (?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> convex_local_fan + (IMAGE (\v. f v t) V, + IMAGE (IMAGE (\v. f v t)) E, + IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) /\ + lunar (v,w) (IMAGE (\v. f v t) V) + (IMAGE (IMAGE (\v. f v t)) E)))`;; +let ZLZTHICv1_concl = +`!a b V E FF f. + convex_local_fan (V,E,FF) /\ + generic V E /\ + deformation f V (a,b) /\ + (!v t. v IN V /\ &0 interior_angle1 (vec 0) ( IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) (f v t) <= pi) + ==> (?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> convex_local_fan + (IMAGE (\v. f v t) V, + IMAGE (IMAGE (\v. f v t)) E, + IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) /\ + generic (IMAGE (\v. f v t) V) + (IMAGE (IMAGE (\v. f v t)) E)))`;; + + + +let V3_DEFOR_CONVEX_LOCAL_FAN_concl =`!s k w l. + scs_k_v39 s=k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ + 3 < k /\ + ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ + (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ + (&10= &10) /\ + ~(&2 = norm (v2)) /\ + (&1= &1) /\ + (!i. ~(scs_J_v39 s l i)) /\ + w l=v2/\ w (SUC l) =v1/\ + norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1/\ + (!V E v. + V = IMAGE w (:num) /\ + E = IMAGE (\i. {w i, w (SUC i)}) (:num) ==> + ~(lunar (v,(w l)) V E )) +==> +(?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> +convex_local_fan + (IMAGE (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t) (:num), + IMAGE + (\i. {v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t, v3_defor_v4 a x1 x2 x6 v1 v2 + (w (SUC i)) + t}) + (:num), + IMAGE + (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t, + v3_defor_v4 a x1 x2 x6 v1 v2 (w (SUC i)) t) + (:num))))`;; + + + +let V3_DEFOR_DEFORMATION_CONVEX_LOCAL_FAN=prove_by_refinement((mk_imp(ZLZTHICv1_concl, mk_imp (MHAEYJNv1_concl, V3_DEFOR_CONVEX_LOCAL_FAN_concl))), +[ +REPEAT STRIP_TAC +; + +REPLICATE_TAC (19-4)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + + +REPLICATE_TAC (38-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC) +; + +SUBGOAL_THEN`(v2:real^3) IN V` ASSUME_TAC; + + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + + +SUBGOAL_THEN`(v1:real^3) IN V` ASSUME_TAC; + + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`SUC l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +SUBGOAL_THEN`(v2:real^3) IN ball_annulus` ASSUME_TAC; + + +REPLICATE_TAC (41-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC) +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`V:real^3->bool` +THEN ASM_REWRITE_TAC[]; + + + +SUBGOAL_THEN`(v1:real^3) IN ball_annulus` ASSUME_TAC; + + +REPLICATE_TAC (42-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC) +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`V:real^3->bool` +THEN ASM_REWRITE_TAC[]; + + + +SUBGOAL_THEN`((v2,v1):real^3#real^3) IN FF`ASSUME_TAC +; + + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`]; + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,v1):real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MP_TAC NORM_POS_COLLINEAR +THEN RESA_TAC +THEN MP_TAC V3_DEFOR_IN_BALL_ANNULUS_DEFORMATION +THEN RESA_TAC +THEN MP_TAC UPS_X_POS_SEG +THEN RESA_TAC +; + + + +MRESA_TAC Deformation.XRECQNS[`-- &1`;`&1`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`ww_defor ((w:num->real^3) l)`] +THEN MRESAL_TAC (GEN_ALL V3_DEFOR_DEFORMATION)[`x2:real`;`x6:real`;`a:real`;`x1:real`;`x2:real`;`x6:real`;`v1:real^3`;`v2:real^3`;`V:real^3->bool`][REAL_ARITH`&0< &1`] +THEN MP_TAC Wrgcvdr_cizmrrh.CIZMRRH +THEN RESA_TAC; + + +MP_TAC DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR +THEN RESA_TAC +; + + +ABBREV_TAC`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2` +THEN MP_TAC(REAL_ARITH`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''/\ &0< e'''' ==> &0< e1/\ e1< &1/\ e1< e /\ e1< e' /\ e1< e'' /\ e1<= e'''/\ -- e'''<= --e1/\ --e1< &0/\ e1< e''''`) +THEN RESA_TAC +; + + +MRESA_TAC (GEN_ALL DEFORMATION_SMALL_INTERVAL)[`-- e''':real`;`e''':real`;`v3_defor_v4 (-- &1) x1 x2 x6 v1 v2`;`V:real^3->bool`;`--e1:real`;`e1:real`] +THEN REPLICATE_TAC (73-0) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th[`-- e1`;`e1:real`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v3_defor_v4 (-- &1) x1 x2 x6 v1 v2`]) +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`(!v t. + v IN V /\ + &0< t /\ t< e1 /\ + interior_angle1 (vec 0) FF v = pi + ==> interior_angle1 (vec 0) + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) <= + pi)`ASSUME_TAC; + + +REPEAT RESA_TAC +THEN REPLICATE_TAC (76-61)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''''==> t STRIP_TAC +THEN MRESA_TAC th[`t:real`]); + + + +(***********lunar**********) + + +MRESAL_TAC JKQEWGV3[`s:scs_v39`;`w:num->real^3`;`v:real^3`;`w':real^3`][LET_DEF;LET_END_DEF;] +THEN MP_TAC(REAL_ARITH`interior_angle1 (vec 0) FF v < pi / &2/\ &0< pi +==> interior_angle1 (vec 0) FF v < pi`) +THEN ASM_REWRITE_TAC[PI_WORKS] +THEN RESA_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`~(v2=v:real^3)`ASSUME_TAC; + + +POP_ASSUM(fun th-> MRESA_TAC th[`V:real^3->bool`;`E:(real^3->bool)->bool`;`w':real^3`]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT RESA_TAC) +THEN ASM_REWRITE_TAC[Local_lemmas.LUNAR_COMM]; + + +SUBGOAL_THEN`~(v2=w':real^3)`ASSUME_TAC; + + +REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT RESA_TAC); + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ABBREV_TAC`w1=w':real^3` +THEN MP_TAC DEFORMATION_LUNAR_AFFINE_HULL +THEN RESA_TAC +THEN ABBREV_TAC`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2` +THEN MP_TAC(REAL_ARITH`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''/\ &0< e'''' ==> &0< e1/\ e1< &1/\ e1< e /\ e1< e' /\ e1< e'' /\ e1<= e'''/\ -- e'''<= --e1/\ --e1< &0/\ e1< e''''`) +THEN RESA_TAC +THEN SUBGOAL_THEN`(!u' t. + u' IN V /\ ~(v2 = u':real^3) /\ t IN real_interval (--e1,e1) + ==> v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 u' t = u')`ASSUME_TAC; + + +REPEAT STRIP_TAC +THEN REWRITE_TAC[v3_defor_v4] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]); + + + +SUBGOAL_THEN`(!t. &0< t/\ t< e1 + ==> v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t IN + affine hull {vec 0, v, w1, v2})`ASSUME_TAC +; + + +REPEAT RESA_TAC +THEN REPLICATE_TAC (80-67)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''''==> tbool`;`--e1:real`;`e1:real`] +THEN REPLICATE_TAC (80-1) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th[`-- e1`;`e1:real`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v3_defor_v4 (-- &1) x1 x2 x6 v1 v2`;`v:real^3`;`w':real^3`;`v2:real^3`]) +THEN POP_ASSUM MP_TAC +; + + +RESA_TAC +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN EXISTS_TAC`e''''':real` +THEN ASM_REWRITE_TAC[V_DEFORMATION_V3_DEFOR;E_DEFORMATION_V3_DEFOR;F_DEFORMATION_V3_DEFOR] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA_TAC th[`t:real`]); + + + + + + +]);; + + + + +let V3_DEFOR_DEFORMATION_CONVEX_LOCAL_FAN_V1=prove_by_refinement((mk_imp(ZLZTHIC_concl, mk_imp (MHAEYJN_concl, V3_DEFOR_CONVEX_LOCAL_FAN_concl))), +[ + +REPEAT STRIP_TAC; + + +REPLICATE_TAC (19-4)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + + + +REPLICATE_TAC (38-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + + +SUBGOAL_THEN`(v2:real^3) IN V` ASSUME_TAC; + + + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + + + +SUBGOAL_THEN`(v1:real^3) IN V` ASSUME_TAC; + + + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`SUC l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + + +SUBGOAL_THEN`(v2:real^3) IN ball_annulus` ASSUME_TAC; + + + +REPLICATE_TAC (41-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC) +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`V:real^3->bool` +THEN ASM_REWRITE_TAC[]; + + + + +SUBGOAL_THEN`(v1:real^3) IN ball_annulus` ASSUME_TAC; + + + +REPLICATE_TAC (42-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC) +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`V:real^3->bool` +THEN ASM_REWRITE_TAC[]; + + + + +SUBGOAL_THEN`((v2,v1):real^3#real^3) IN FF`ASSUME_TAC; + + + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`]; + + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,v1):real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MP_TAC NORM_POS_COLLINEAR +THEN RESA_TAC +THEN MP_TAC V3_DEFOR_IN_BALL_ANNULUS_DEFORMATION +THEN RESA_TAC +THEN MP_TAC UPS_X_POS_SEG +THEN RESA_TAC; + + + + +MRESA_TAC Deformation.XRECQNS[`-- &1`;`&1`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`ww_defor ((w:num->real^3) l)`] +THEN MRESAL_TAC (GEN_ALL V3_DEFOR_DEFORMATION)[`x2:real`;`x6:real`;`a:real`;`x1:real`;`x2:real`;`x6:real`;`v1:real^3`;`v2:real^3`;`V:real^3->bool`][REAL_ARITH`&0< &1`] +THEN MP_TAC Wrgcvdr_cizmrrh.CIZMRRH +THEN RESA_TAC; + + + +MP_TAC DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1 +THEN RESA_TAC; + + + +ABBREV_TAC`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2` +THEN MP_TAC(REAL_ARITH`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''/\ &0< e'''' ==> &0< e1/\ e1< &1/\ e1< e /\ e1< e' /\ e1< e'' /\ e1<= e'''/\ -- e'''<= --e1/\ --e1< &0/\ e1< e''''`) +THEN RESA_TAC; + + + +MRESA_TAC (GEN_ALL DEFORMATION_SMALL_INTERVAL)[`-- e''':real`;`e''':real`;`v3_defor_v4 (-- &1) x1 x2 x6 v1 v2`;`V:real^3->bool`;`--e1:real`;`e1:real`] +THEN REPLICATE_TAC (73-0) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th[`-- e1`;`e1:real`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v3_defor_v4 (-- &1) x1 x2 x6 v1 v2`]) +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`(!v t. + v IN V /\ + t IN real_interval (--e1,e1) /\ + interior_angle1 (vec 0) FF v = pi + ==> interior_angle1 (vec 0) + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) <= + pi)`ASSUME_TAC; + + +ASM_REWRITE_TAC[IN_REAL_INTERVAL] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (76-61)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[IN_REAL_INTERVAL] +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''''/\ --e1 t STRIP_TAC +THEN MRESA_TAC th[`t:real`]); + + + + +(***********lunar**********) + + +MRESAL_TAC JKQEWGV3[`s:scs_v39`;`w:num->real^3`;`v:real^3`;`w':real^3`][LET_DEF;LET_END_DEF;] +THEN MP_TAC(REAL_ARITH`interior_angle1 (vec 0) FF v < pi / &2/\ &0< pi +==> interior_angle1 (vec 0) FF v < pi`) +THEN ASM_REWRITE_TAC[PI_WORKS] +THEN RESA_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`~(v2=v:real^3)`ASSUME_TAC; + + + +POP_ASSUM(fun th-> MRESA_TAC th[`V:real^3->bool`;`E:(real^3->bool)->bool`;`w':real^3`]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT RESA_TAC) +THEN ASM_REWRITE_TAC[Local_lemmas.LUNAR_COMM]; + + + +SUBGOAL_THEN`~(v2=w':real^3)`ASSUME_TAC; + + + +REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT RESA_TAC); + + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ABBREV_TAC`w1=w':real^3` +THEN MP_TAC DEFORMATION_LUNAR_AFFINE_HULL_V1 +THEN RESA_TAC +THEN ABBREV_TAC`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2` +THEN MP_TAC(REAL_ARITH`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''/\ &0< e'''' ==> &0< e1/\ e1< &1/\ e1< e /\ e1< e' /\ e1< e'' /\ e1<= e'''/\ -- e'''<= --e1/\ --e1< &0/\ e1< e''''`) +THEN RESA_TAC +THEN SUBGOAL_THEN`(!u' t. + u' IN V /\ ~(v2 = u':real^3) /\ t IN real_interval (--e1,e1) + ==> v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 u' t = u')`ASSUME_TAC; + + + +REPEAT STRIP_TAC +THEN REWRITE_TAC[v3_defor_v4] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]); + + + + +SUBGOAL_THEN`(!t. t IN real_interval (--e1,e1) + ==> v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t IN + affine hull {vec 0, v, w1, v2})`ASSUME_TAC; + +ASM_REWRITE_TAC[IN_REAL_INTERVAL] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (80-67)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[IN_REAL_INTERVAL] +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''''/\ --e1 tbool`;`--e1:real`;`e1:real`] +THEN REPLICATE_TAC (80-1) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th[`-- e1`;`e1:real`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v3_defor_v4 (-- &1) x1 x2 x6 v1 v2`;`v:real^3`;`w':real^3`;`v2:real^3`]) +THEN POP_ASSUM MP_TAC +; + + +RESA_TAC +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN EXISTS_TAC`e''''':real` +THEN ASM_REWRITE_TAC[V_DEFORMATION_V3_DEFOR;E_DEFORMATION_V3_DEFOR;F_DEFORMATION_V3_DEFOR] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA_TAC th[`t:real`]); + + + + + +]);; + + + + + + +let CARD_FF_EQ_V3_DEFOR_DEFORMATION=prove(`scs_k_v39 s =k /\ + IMAGE (w:num->real^3) (:num)=V/\ + is_scs_v39 s /\ +3< k/\ + BBs_v39 s w /\(!t. &0 < t /\ t < e1 ==> BBs_v39 s (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t)) +==> (!t. &0< t/\ t< e1==> +CARD (IMAGE + (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t, + v3_defor_v4 a x1 x2 x6 v1 v2 (w (SUC i)) t) + (:num)) +=CARD(IMAGE (\i. w i,w (SUC i)) (:num)))`, +STRIP_TAC +THEN GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA_TAC th[`t:real`]) +THEN MRESA_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`] +THEN MRESA_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`(\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t)`;`IMAGE ((\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t)) (:num)`;`k:num`] +THEN MP_TAC(ARITH_RULE`3 ~(k<= 3)`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN ASSUME_TAC(th) +THEN REPEAT RESA_TAC) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;convex_local_fan] +THEN REPEAT RESA_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ) +[`IMAGE (\i. { v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t, v3_defor_v4 a x1 x2 x6 v1 v2 (w (SUC i)) t}) + (:num)`;`IMAGE (\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t,v3_defor_v4 a x1 x2 x6 v1 v2 (w (SUC i)) t) (:num)`;`IMAGE (\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t) (:num)`] +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ) +[`IMAGE (\i. {w i, (w:num->real^3) (SUC i)}) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`V:real^3->bool`]);; + + + + +let DSV_V3_DEFOR_EQ=prove_by_refinement( +`scs_k_v39 s=k/\ + is_scs_v39 s /\ + BBs_v39 s w /\ +(!i. ~(scs_J_v39 s l i)) +==> +dsv_v39 s (\i. v3_defor_v4 a x1 x2 x6 v1 (w l) (w i) t) = dsv_v39 s w`, +[ +REWRITE_TAC[dsv_v39] +THEN STRIP_TAC +THEN MATCH_MP_TAC(REAL_ARITH`a=b==> c+a=c+b`) +THEN MP_TAC(SET_RULE`is_ear_v39 s\/ ~(is_ear_v39 s)`) +THEN RESA_TAC +THEN MATCH_MP_TAC(REAL_ARITH`a=b==> #0.1*a= #0.1*b`); + +REWRITE_TAC[REAL_ARITH`&1 *a=a`] +THEN MATCH_MP_TAC SUM_EQ +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`(w:num->real^3) l= w x\/ ~(w l =w x)`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`l:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (4) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`l MOD k:num`;`x:num`]) +THEN REPLICATE_TAC (34-25) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`SUC x:num`;]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (SUC x)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]); + +MP_TAC(SET_RULE`(w:num->real^3) l= w (SUC x)\/ ~(w l =w (SUC x))`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN POP_ASSUM MP_TAC +THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC DIVISION[`l:num`;`scs_k_v39 s`] +THEN MRESA_TAC DIVISION[`SUC x:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (6) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`l MOD k:num`;`SUC x MOD k:num`]) +THEN REPLICATE_TAC (37-25) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`x:num`;]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (x)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> +MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]); + +ASM_REWRITE_TAC[v3_defor_v4]; + +REWRITE_TAC[REAL_ARITH`-- &1 *a= -- &1 * b<=> a=b`] +THEN MATCH_MP_TAC SUM_EQ +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`(w:num->real^3) l= w x\/ ~(w l =w x)`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`l:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (4) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`l MOD k:num`;`x:num`]) +THEN REPLICATE_TAC (34-25) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`SUC x:num`;]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (SUC x)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]); + +MP_TAC(SET_RULE`(w:num->real^3) l= w (SUC x)\/ ~(w l =w (SUC x))`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN POP_ASSUM MP_TAC +THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC DIVISION[`l:num`;`scs_k_v39 s`] +THEN MRESA_TAC DIVISION[`SUC x:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (6) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`l MOD k:num`;`SUC x MOD k:num`]) +THEN REPLICATE_TAC (37-25) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`x:num`;]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (x)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> +MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]); + +ASM_REWRITE_TAC[v3_defor_v4]]);; + + + +let DEFORMATION_INTERIOR_ANGLE1_EQ_V3_DEFOR_V1=prove(` 3real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!v t. + v IN V /\ + --e< t /\ t< e + ==> interior_angle1 (vec 0) + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) = + interior_angle1 (vec 0) FF v))`, +REPEAT STRIP_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_ALL_V1 +THEN RESA_TAC +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[interior_angle1] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (23-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`;`v:real^3`]) +THEN REAL_ARITH_TAC);; + + + +let RHO_FUN_DEFORMATION_V3_DEFOR=prove_by_refinement(` &0< x1 /\ &0 ?e. &0< e /\ (!t. &0 rho_fun (norm(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t))) +< rho_fun (norm (v2)))`, +[ +STRIP_TAC +THEN MP_TAC UPS_X_POS_SEG +THEN RESA_TAC +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC THEN +MP_TAC(REAL_ARITH`&0 --e c+a a-c &0<= &1- t`) +THEN RESA_TAC +THEN MRESA_TAC REAL_ABS_REFL[`&1-t`] +THEN ASM_REWRITE_TAC[NORM_LT;DOT_SQUARE_NORM;REAL_ARITH`a-b &0 BBs_v39 s (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t))/\ +&0< e1 +/\ + IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!t i. + &0< t /\ t< e +==> +interior_angle1 (vec 0) + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (ITER i + (rho_node1 + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF)) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l MOD k)) t)) + = +interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) (w (l MOD k)))))`, +STRIP_TAC +THEN MP_TAC DEFORMATION_INTERIOR_ANGLE1_EQ_V3_DEFOR_V1 +THEN RESA_TAC +THEN ABBREV_TAC`e2=(min e e1)/ &2` +THEN MP_TAC(REAL_ARITH`e2=(min e e1)/ &2 /\ &0< e/\ &0 &0 ~(k=0)/\ ~(k=1)/\ 0real^3) (:num)`;`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`;`w:num->real^3`;`l MOD k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;] +THEN REPLICATE_TAC (43-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC(REAL_ARITH`t treal^3) i) t) (:num)`;`IMAGE (\i. { v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t, v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) (SUC i)) t}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t, v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) (SUC i)) t) (:num)`;`(\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t) (l MOD k)`;`(\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t)`;`l MOD k`] +[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;F_DEFORMATION_V3_DEFOR] +THEN REPLICATE_TAC (45-29)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`t t BBs_v39 s (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t))/\ +&0< e1 + ==> +(?e. &0 < e /\ + (!t. &0 < t /\ t < e + ==> taustar_v39 s (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t)< taustar_v39 s w +))`;; + + + +let TAUSTAR_V3_DEFOR=prove_by_refinement( TAUSTAR_V3_DEFOR_concl, +[ +REPEAT STRIP_TAC; + +REPLICATE_TAC (22-5)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (41-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +ASM_REWRITE_TAC[taustar_v39;LET_DEF;LET_END_DEF;tau_fun] +THEN STRIP_TAC +THEN MP_TAC INTERIOR_ANGLE_SAME_V3_DEFOR1 +THEN RESA_TAC +THEN MP_TAC RHO_FUN_DEFORMATION_V3_DEFOR +THEN RESA_TAC +THEN ABBREV_TAC`e2=(min (min e1 e) e')/ &2` +THEN MP_TAC(REAL_ARITH`e2=(min(min e1 e) e')/ &2/\ &0< e1/\ &0< e/\ &0 &0< e2/\ e2< e1/\ e2 t< e1/\ tMRESA1_TAC th`t:real`) +THEN MP_TAC DSV_V3_DEFOR_EQ +THEN RESA_TAC +THEN MATCH_MP_TAC(REAL_ARITH`a a-c< b-c`) +THEN MATCH_MP_TAC(REAL_ARITH`a a-c< b-c`) +THEN MRESA_TAC(GEN_ALL Qknvmlb.SUM_AZIM_EQ_ANGLE_LE4)[`V:real^3->bool`;`w:num->real^3`;`l:num`;`s:scs_v39`;`(w:num->real^3) (l MOD scs_k_v39 s)`;`FF:real^3#real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPLICATE_TAC (59-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`]) +THEN MRESA_TAC(GEN_ALL Qknvmlb.SUM_AZIM_EQ_ANGLE_LE4)[`IMAGE (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 ((w:num->real^3) i) t) (:num)`;` (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 ((w:num->real^3) i) t)`;`l:num`;`s:scs_v39`;` (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 ((w:num->real^3) i) t) (l MOD scs_k_v39 s)`;`IMAGE (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 ((w:num->real^3) i) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (SUC i)) t) (:num)`;`IMAGE (\i. { v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w i) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 ((w:num->real^3) (SUC i)) t}) (:num)`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`{i|i REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ARITH_TAC; + +ASM_REWRITE_TAC[] +THEN MRESAL_TAC SUM_ADD_SPLIT[`(\i. rho_fun (norm (w (i + l MOD k))) * + interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) (w (l MOD k))))`;`0`;`0`;`k-1`][ARITH_RULE`0<=0+1/\ 0+A=A`] +THEN MRESAL_TAC SUM_ADD_SPLIT[`(\i. rho_fun (norm (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (i + l MOD k)) t)) * + interior_angle1 (vec 0) + (IMAGE (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w i) t,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (SUC i)) t) + (:num)) + (ITER i + (rho_node1 + (IMAGE (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (i)) t,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (SUC i )) t) + (:num))) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w ( l MOD k)) t)))`;`0`;`0`;`k-1`][ARITH_RULE`0<=0+1/\ 0+A=A`] +THEN MATCH_MP_TAC(REAL_ARITH`a a+c ASM_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39;convex_local_fan] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN SUBGOAL_THEN`(v2:real^3) IN V`ASSUME_TAC; + +EXPAND_TAC"V" +THEN REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(l:num)IN(:num)`]; + +REPLICATE_TAC (91-67)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC(REAL_ARITH`t --e MRESA_TAC th[`(w:num->real^3) l`]) +THEN MATCH_MP_TAC REAL_LT_RMUL +THEN STRIP_TAC; + +REPLICATE_TAC (93-68)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC(REAL_ARITH`t --e'bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3) (l MOD scs_k_v39 s)`]; + +MATCH_MP_TAC SUM_EQ +THEN REWRITE_TAC[IN_NUMSEG;F_DEFORMATION_V3_DEFOR] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`x<=k-1/\ 3< k==> x< k`) +THEN RESA_TAC +THEN REPLICATE_TAC (65-44)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC(REAL_ARITH`t --e A\/ B`) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39;convex_local_fan] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN SUBGOAL_THEN`(v2:real^3) IN V`ASSUME_TAC; + +EXPAND_TAC"V" +THEN REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(l:num)IN(:num)`]; + +MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;convex_local_fan;is_scs_v39;periodic2] +THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME)[`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`;`w:num->real^3`;`l MOD k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;convex_local_fan;is_scs_v39;periodic2] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`x:num`] ) +THEN MP_TAC(ARITH_RULE`1<=x==> 0real^3) i, w (SUC i)}) (:num)`;`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`] +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`0:num`;`x:num`][ITER;v3_defor_v4] )]);; + + + + + + +(**********TWO ***************) + + +let EQ_W_L_IN_BBS=prove(`3 w (SUC(l+k-1))= w l`, +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF] +THEN REPEAT STRIP_TAC +THEN ASM_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`1*k+l:num`[ARITH_RULE`4 MOD 4=0`]));; + + + + + +let HYPER_MM_COLLINEAR_TWO_CASES=prove_by_refinement(`scs_k_v39 s =k/\is_scs_v39 s /\ + MMs_v39 s w /\ + 3 +&0< x1 /\ &0real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` +THEN ASM_TAC +THEN RESA_TAC +THEN REPEAT DISCH_TAC; + +ASM_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`((v1,v2):real^3#real^3) IN FF`ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`] +THEN MP_TAC EQ_W_L_IN_BBS +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF] +THEN RESA_TAC; + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v1,v2):real^3#real^3`] +THEN MP_TAC NORM_POS_COLLINEAR +THEN RESA_TAC]);; + + + +let DEFORMATION_DIST_LE_V3_DEFOR_A_TWO_CASES=prove(`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3 scs_a_v39 s l i < dist (v2,w i)) +==> (!i. ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k) ==> ?e. &0< e/\ +(!t. &0< t/\ t< e ==> scs_a_v39 s l i < dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i)))`, +STRIP_TAC +THEN MP_TAC HYPER_MM_COLLINEAR_TWO_CASES +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC EXISTS_SMALL_LE_CONST +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (16-10)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`i:num`]));; + + + + +let DEFORMATION_DIST_LE_V3_DEFOR_A_COM_TWO_CASES=prove_by_refinement( +`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3 scs_a_v39 s l i < dist (v2,w i)) +==> ?e. &0< e/\ +(!t i. &0< t/\ t< e /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k) ==> scs_a_v39 s l i < dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i))`, +[ +REPEAT STRIP_TAC +THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_TWO_CASES +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] +THEN REWRITE_TAC[SKOLEM_THM] +THEN STRIP_TAC +THEN ABBREV_TAC`e1= inf {(e:num->real) i| i < k /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}` +THEN EXISTS_TAC`e1:real` +THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}`ASSUME_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` +THEN STRIP_TAC; + +MATCH_MP_TAC FINITE_IMAGE +THEN REWRITE_TAC[FINITE_NUMSEG]; + +REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_ELIM_THM] +THEN GEN_TAC +THEN RESA_TAC +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[IN_NUMSEG] +THEN REPLICATE_TAC (16-12)(POP_ASSUM MP_TAC) +THEN ARITH_TAC; + +SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)} = {})`ASSUME_TAC; + +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] +THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(l MOD k =0)`) +THEN RESA_TAC; + +EXISTS_TAC`(e:num->real)2` +THEN EXISTS_TAC`2` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real)3` +THEN EXISTS_TAC`3` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real)1` +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}`;`&0`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN REPLICATE_TAC (20-11) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`]); + +REPEAT STRIP_TAC +THEN MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}`;`t:real`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}`ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`i MOD k` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1 MRESA1_TAC th`(e:num->real) (i MOD k)`) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1 REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num MOD k`]) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`])]);; + + + + +let DEFORMATION_DIST_LE_V3_DEFOR_A_SUC_TWO_CASES=prove(`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3 scs_a_v39 s l i < dist (v2,w i)) +==> (!i. ~(l MOD k = i MOD k) /\ ~(l MOD k =SUC i MOD k) ==> ?e. &0< e/\ +(!t. &0< t/\ t< e ==> scs_a_v39 s l i < dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i)))`, +STRIP_TAC +THEN MP_TAC HYPER_MM_COLLINEAR_TWO_CASES +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC EXISTS_SMALL_LE_CONST +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (16-10)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`i:num`]));; + + +let DEFORMATION_DIST_LE_V3_DEFOR_A_COM_SUC_TWO_CASES=prove_by_refinement(`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3 scs_a_v39 s l i < dist (v2,w i)) +==> ?e. &0< e/\ +(!t i. &0< t/\ t< e /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k) ==> scs_a_v39 s l i < dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i))`, +[ +REPEAT STRIP_TAC +THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_SUC_TWO_CASES +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] +THEN REWRITE_TAC[SKOLEM_THM] +THEN STRIP_TAC +THEN ABBREV_TAC`e1= inf {(e:num->real) i| i < k /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}` +THEN EXISTS_TAC`e1:real` +THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}`ASSUME_TAC; + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` +THEN STRIP_TAC; + +MATCH_MP_TAC FINITE_IMAGE +THEN REWRITE_TAC[FINITE_NUMSEG]; + +REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_ELIM_THM] +THEN GEN_TAC +THEN RESA_TAC +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[IN_NUMSEG] +THEN REPLICATE_TAC (16-12)(POP_ASSUM MP_TAC) +THEN ARITH_TAC; + +SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)} = {})`ASSUME_TAC; + +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] +THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(l MOD k =0)`) +THEN RESA_TAC; + +EXISTS_TAC`(e:num->real)1` +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 1real)2` +THEN EXISTS_TAC`2` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 1real)0` +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}`;`&0`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN REPLICATE_TAC (20-11) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`]); + +REPEAT STRIP_TAC +THEN MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}`;`t:real`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}`ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`i MOD k` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1 MRESA1_TAC th`(e:num->real) (i MOD k)`) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1 REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num MOD k`]) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`])]);; + + + +let DEFORMATION_DIST_LE_V3_DEFOR_B_SUC_TWO_CASES=prove_by_refinement(` scs_k_v39 s =k/\ + 3 &4 * h0 < scs_b_v39 s l i) +==> (!i. scs_diag k l i ==> ?e. &0< e/\ +(!t. &0< t/\ t< e ==> dist(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i) ~(k<=3)`) +THEN RESA_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`v2 IN IMAGE (w:num->real^3) (:num)`ASSUME_TAC; + + REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +SUBGOAL_THEN`w i IN IMAGE (w:num->real^3) (:num)`ASSUME_TAC; + + REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +MP_TAC(SET_RULE`v2 IN IMAGE w (:num)/\ w i IN IMAGE w (:num)/\ IMAGE w (:num) SUBSET ball_annulus ==> v2 IN ball_annulus/\ w i IN ball_annulus`) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[IN_ELIM_THM;DIFF;ball_annulus;cball;] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC DIST_TRIANGLE[`v2:real^3`;`vec 0:real^3`;`(w:num->real^3) i`] +THEN MP_TAC(REAL_ARITH`dist (v2,vec 0) <= &2 * h0/\ dist (vec 0,w i) <= &2 * h0/\ dist (v2,w i) <= dist (v2,vec 0) + dist (vec 0,w i) +==> dist (v2,(w:num->real^3) i)<= &4 *h0`) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REPLICATE_TAC (53-41)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`i:num`]) +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC]);; + + +let DEFORMATION_DIST_LE_2_TWO_CASES=prove(` 3 +?e. &0< e/\ +(!t. &0< t/\ t< e ==> &2 ~(k<=3)/\ ~(k=0)/\ 1 MRESA1_TAC th`l:num`) +THEN REPLICATE_TAC (56-18) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num MOD k`;`l MOD k` ]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REPLICATE_TAC (59-42) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC);; + + + + + +let DEFORMATION_V3_DEFOR_EDGE_TWO_CASES=prove_by_refinement(` 3 +?e. &0< e/\ +(!t. &0< t/\ t< e ==> dist (v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i) ~(k=0)/\ ~(k=1)/\ 0real^3) (:num)` +THEN SUBGOAL_THEN`(w:num->real^3) l IN V` ASSUME_TAC; + + + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + + + +SUBGOAL_THEN`(w:num->real^3) (l+k-1) IN V` ASSUME_TAC; + + + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + + +SUBGOAL_THEN`(w:num->real^3) l IN ball_annulus` ASSUME_TAC; + + + + MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`V:real^3->bool` +THEN ASM_REWRITE_TAC[]; + + + + +SUBGOAL_THEN`(w:num->real^3) (l+k-1) IN ball_annulus` ASSUME_TAC; + + + +MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`V:real^3->bool` +THEN ASM_REWRITE_TAC[]; + + +REPLICATE_TAC (4) (POP_ASSUM MP_TAC) +THEN REPEAT RESA_TAC +THEN MP_TAC V3_DEFOR_IN_BALL_ANNULUS_DEFORMATION +THEN RESA_TAC +THEN REPLICATE_TAC (68-41) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (67-41) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC l:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESA_TAC th[`i:num`]) +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) i`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN RESA_TAC +THEN ABBREV_TAC`e1= (min (min (min e e') e'') e''')/ &2` +THEN MP_TAC(REAL_ARITH`e1= (min (min (min e e') e'') e''')/ &2 /\ &0< e /\ &0< e'/\ &0< e''/\ &0< e''' ==> &0< e1/\ e1<= e/\ e1<=e'/\ e1< e''/\ e1< e'''`) +THEN RESA_TAC +THEN EXISTS_TAC`e1:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`e1=(min (min (min e e') e'') e''')/ &2 /\ &0< e /\ &0< e'/\ &0< e''/\ t --e' < t/\ t< e'/\ t REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`]) +THEN REPLICATE_TAC (88-65) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[v3_defor_v4] +THEN REPLICATE_TAC (87-72) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th[`t:real`]) +THEN ABBREV_TAC`v3=v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) ` +THEN ASM_REWRITE_TAC[ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0-A= -- A`;NORM_NEG;REAL_ARITH`~(a b<=a`] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORMV3)[`x2:real`;`-- &1`;`x2:real`;`x6:real`;`x1:real`;`x6:real`;`v1:real^3`;`v2:real^3`;`v3_defor_v1 (-- &1) v1 (v2:real^3) x1 x2 x6 x6 (x2 - t)`;`x2-t:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1] +THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORM_V3_V1)[`x2:real`;`-- &1`;`x2:real`;`x6:real`;`x1:real`;`x2-t:real`;`v2:real^3`;`v3_defor_v1 (-- &1) v1 (v2:real^3) x1 x2 x6 x6 (x2 - t)`;`v1:real^3`;`x6:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1] +THEN MRESA_TAC DOT_NORM_SUB[`v1:real^3`;`v3:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[dist] +THEN ABBREV_TAC`v4= (w:num->real^3) i` +THEN MRESA_TAC DOT_NORM_SUB[`v4:real^3`;`v2:real^3`] +THEN MRESA_TAC DOT_NORM_SUB[`v4:real^3`;`v3:real^3`] +THEN MRESA_TAC DOT_NORM_SUB[`v1:real^3`;`v2:real^3`] +THEN STRIP_TAC; + + + + + +REPLICATE_TAC (97-63) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +POP_ASSUM(fun th1-> REPEAT STRIP_TAC +THEN MP_TAC th1) +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0-A= -- A`;NORM_NEG;REAL_ARITH`~(a b<=a`] +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`&2 <= norm (v1 - v2:real^3) ` ASSUME_TAC; + +REPLICATE_TAC (99-30) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`l+k-1:num`;`l:num`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[dist] +THEN MRESA_TAC DIVISION[`l+k-1`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN MRESA_TAC (GEN_ALL Qknvmlb.SUC_MOD_NOT_EQ)[`k:num`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`]) +THEN REPLICATE_TAC (103-22) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(l+k-1) MOD k:num`;`l MOD k:num`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(l+k-1):num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((l+k-1) MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MP_TAC MOD_ADD_SUB_1 +THEN RESA_TAC +THEN REAL_ARITH_TAC; + + + + +MRESAL_TAC xrr_decreasing_lt[`norm (v3:real^3)`;`norm (v2:real^3)`;`norm(v1:real^3)`;`norm (v1-v2:real^3)`][xrr;REAL_ARITH`a*a= a pow 2`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[Pack1.norm_abs] +THEN ASM_REWRITE_TAC[REAL_LT_SQUARE_ABS] +THEN ASM_REWRITE_TAC[REAL_ABS_NORM;REAL_ARITH`a-b &0 B REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`~(v3 = vec 0:real^3)` ASSUME_TAC; + + +STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th;NORM_0;REAL_ARITH`~(&2<= &0)`]); + + + +MRESAL_TAC COS_ANGLE[`v1:real^3`;`vec 0:real^3`;`v3:real^3`][VECTOR_ARITH`A- vec 0=A`;real_div;REAL_INV_MUL;REAL_ARITH`(x1 + x2) - x6= x2+x1-x6/\ (a*b)*c*d=a*b*d*c`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESAL_TAC COS_MONO_LT_EQ[`angle (v1,vec 0,v3:real^3)`;`angle (v1,vec 0,v2:real^3)`][ANGLE_RANGE] +THEN MP_TAC(SET_RULE`v2 IN aff_gt {vec 0} {v1, v4}/\ v3 IN aff_gt {vec 0} {v1, v4} /\ aff_gt {vec 0} {v1,v4} SUBSET aff_ge {vec 0} {v1,v4}==> v2 IN aff_ge {vec 0} {v1, v4}/\ v3 IN aff_ge {vec 0} {v1, v4:real^3}`) +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN RESA_TAC +THEN MRESA_TAC th3[`vec 0:real^3`;`v4:real^3`;`v1:real^3`] +THEN MRESA_TAC Polar_fan.ANGLES_ADD_AFF_GE [`vec 0:real^3`;`v1:real^3`;`v4:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN RESA_TAC +THEN MRESA_TAC Polar_fan.ANGLES_ADD_AFF_GE [`vec 0:real^3`;`v1:real^3`;`v4:real^3`;`v3:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`angle (v1,vec 0,v2) < angle (v1,vec 0,v3) +/\ angle (v1,vec 0,v2) + angle (v2,vec 0,v4) = angle (v1,vec 0,v4) +/\ angle (v1,vec 0,v3) + angle (v3,vec 0,v4) = angle (v1,vec 0,v4) +==> angle (v3,vec 0,v4) +POP_ASSUM(fun th1-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th1) +THEN MP_TAC th) +THEN REWRITE_TAC[REAL_ARITH`(norm v4 pow 2 + x2) - norm (v4 - v2) pow 2 +=x2+norm v4 pow 2 - norm (v4 - v2) pow 2`;real_div;REAL_ARITH`a*b*c*d=(a*b)*c*d`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] +THEN POP_ASSUM(fun th1-> REWRITE_TAC[SYM th1] THEN ASSUME_TAC (SYM th) + THEN ASSUME_TAC (SYM th))) +THEN SUBGOAL_THEN`(w:num->real^3) (SUC l) IN V` ASSUME_TAC; + + + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`SUC l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + + +SUBGOAL_THEN`(w:num->real^3) (SUC l) IN ball_annulus` ASSUME_TAC; + + + + MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`V:real^3->bool` +THEN ASM_REWRITE_TAC[]; + + + + + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0-A= -- A`;NORM_NEG;REAL_ARITH`~(a b<=a`;real_div] +THEN STRIP_TAC +THEN ABBREV_TAC`a1=(norm (v4:real^3) pow 2)` +THEN ABBREV_TAC`a2=(norm (v4-v2:real^3) pow 2)` +THEN ABBREV_TAC`a3= x2+a1- &2 *((v4:real^3) dot v3) * (inv (norm v3)) * (inv (norm v4)) * norm v4 * norm(v2:real^3)` +THEN ABBREV_TAC`x= v4- v3_defor_v1 a (vec 0- v4) (v2- v4:real^3) a1 a2 x2 x2 (a3)` +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&2<=norm (v4:real^3)/\ &2<=norm (v2:real^3)==> &0< norm v4/\ &0< norm v2`) +THEN RESA_TAC +; + +MP_TAC(REAL_ARITH`norm (v4 - v2) pow 2 <= a3\/ a3< norm(v4-v2:real^3) pow 2`) +THEN RESA_TAC +; + + +MRESA_TAC REAL_LE_RSQRT[`norm(v4-v2:real^3)`;`a3:real`] +THEN MP_TAC(REAL_ARITH`norm (v4 - v2) pow 2 <= a3/\ &0<= norm(v4-v2:real^3) pow 2 +==> &0<= a3`) +THEN ASM_REWRITE_TAC[NORM_POS_LE;REAL_LE_POW_2] +THEN RESA_TAC +THEN MRESA_TAC SQRT_POW_2[`a3:real`] +THEN MRESAL_TAC xrr_increasing_le[`norm(v4:real^3)`;`norm(v2:real^3)`;`norm(v4-v2:real^3)`;`sqrt(a3)`][NORM_POS_LE;xrr;REAL_ARITH`(&8 *( &1-a)<= &8 *( &1-b)<=> b<=a)/\ a*a= a pow 2`;real_div] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN EXPAND_TAC"a3" +THEN REWRITE_TAC[REAL_ARITH`x+y-(y+x-a)=a`;REAL_INV_MUL] +THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v4:real^3`;`vec 0:real^3`] +THEN ASM_TAC +THEN REDUCE_VECTOR_TAC +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v2:real^3`;`vec 0:real^3`] +THEN ASM_TAC +THEN REDUCE_VECTOR_TAC +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH` + (&2 *a * inv (b) * inv (c) * c * d) * + inv (&2) * +inv (c) * + inv (d) += (a * inv (b) * inv (c)) * + (inv (c) * c )* + (inv (d) * d)`;REAL_ARITH`a * &1=a`] +THEN ASM_REWRITE_TAC[REAL_ARITH`a*b*c*d=(a*b)*d*c`] +THEN ONCE_REWRITE_TAC[REAL_ARITH` a1 + x2 - a2= x2+a1-a2`] +THEN ASM_REWRITE_TAC[REAL_ARITH`a<=b<=> ~(b c= a1+x2-t - &2 *a`] +THEN RESA_TAC +THEN EXPAND_TAC"a3" +THEN REWRITE_TAC[REAL_ARITH`a1 + x2 - t - &2 * (v4 dot v3) < + x2 + + a1 - &2 * (v4 dot v3) * inv (norm v3) * inv (norm v4) * norm v4 * norm v2 +<=> (v4 dot v3) * inv (norm v3) * (inv (norm v4) * norm v4) * norm v2 +< (v4 dot v3)+ t/ &2 `] +THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v4:real^3`;`vec 0:real^3`] +THEN ASM_TAC +THEN REDUCE_VECTOR_TAC +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ABBREV_TAC`g=(v4:real^3) dot v3` +THEN MRESAL_TAC SQRT_UNIQUE[`x2:real`;`norm(v2:real^3)`][NORM_POS_LE] +THEN MRESAL_TAC SQRT_UNIQUE[`x2-t:real`;`norm(v3:real^3)`][NORM_POS_LE] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;REAL_ARITH`&1*a=a`]) +THEN MP_TAC(REAL_ARITH`&0< x2-t/\ &0< x2/\ &0 &0<= x2-t/\ &0<= x2/\ x2-t REWRITE_TAC[SYM th;]) +THEN MRESA_TAC REAL_LE_INV[`x2-t:real`] +THEN MRESA_TAC REAL_LT_INV[`x2-t:real`] +THEN MRESA_TAC SQRT_MUL[`inv(x2-t):real`;`x2:real`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;]) +THEN MRESA_TAC REAL_MUL_LINV[`x2-t:real`] +THEN MRESA_TAC REAL_LT_LMUL[`inv(x2-t)`;`x2-t:real`;`x2:real`] +THEN MRESAL_TAC SQRT_MONO_LT[`&1:real`;`inv(x2-t) *x2`][REAL_ARITH`&0<= &1`;SQRT_1] +THEN MP_TAC(REAL_ARITH`(v4:real^3) dot v3 = &0\/ &0< --((v4:real^3) dot v3)\/ &0< (v4:real^3) dot v3 `) +THEN RESA_TAC; + + +ASM_REWRITE_TAC[REAL_ARITH`&0 *a< &0 + t/ &2<=> &0< t`]; + + + + +MRESA_TAC REAL_LT_LMUL[`-- g`;`&1:real`;`sqrt (inv (x2 - t) * x2):real`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0< t==> &0< t/ &2`) +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; + + + +MP_TAC(REAL_ARITH`&0< g/\ &1 < inv (x2 - t) * x2 ==> ~(g= &0)/\ &0 <= inv (x2 - t) * x2`) +THEN RESA_TAC +THEN MRESA_TAC REAL_MUL_LINV[`g:real`] +THEN MRESAL_TAC REAL_LT_LMUL[`g:real`;`sqrt (inv (x2 - t) * x2):real`;`(inv g)*(g+t/ &2)`][REAL_ARITH`a*b*c=(b*a)*c/\ &1*x=x`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MATCH_MP_TAC REAL_LT_LSQRT +THEN ASM_REWRITE_TAC[REAL_ARITH`a*(b+c)=a*b+a*c`] +THEN STRIP_TAC; + + + +MATCH_MP_TAC(REAL_ARITH`&0< a*b ==> &0<= &1+a *b/ &2`) +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_INV +THEN ASM_REWRITE_TAC[]; + + +REWRITE_TAC[REAL_ARITH`(&1+b) pow 2= &1+ &2*b+ b pow 2/\ &2 * inv g * t / &2= inv g * t `] +THEN MATCH_MP_TAC(REAL_ARITH`&0<=d /\ a< b+c==> a< b+c+d`) +THEN ASM_REWRITE_TAC[REAL_LE_POW_2] +THEN MRESAL_TAC REAL_LT_LMUL[`inv(x2-t):real`;`x2:real`;`(x2-t)*(&1+ inv g *t)`][REAL_ARITH`a*b*c=(a*b)*c/\ &1*x=x`] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[REAL_ARITH`x2 < (x2 - t) * (&1 + inv g * t) +<=> t< t*(x2-t) * inv g`] +THEN MRESAL_TAC REAL_LT_LMUL[`t:real`;`&1:real`;`(x2-t)*inv g `][REAL_ARITH`a*b*c=a*b*c/\ x* &1=x`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESAL_TAC REAL_LT_LMUL[`inv g:real`;`g:real`;`(x2-t) `][REAL_ARITH`a*b*c=a*b*c/\ x* &1=x`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`a*b=b*a`] +THEN POP_ASSUM MATCH_MP_TAC +THEN STRIP_TAC; + + +MATCH_MP_TAC REAL_LT_INV +THEN ASM_REWRITE_TAC[]; + + + + + +EXPAND_TAC"g" +THEN REPLICATE_TAC (151-55) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`t:real`][dist]) +THEN MP_TAC(REAL_ARITH`&2 &2<=norm(v3-v4:real^3)`) +THEN RESA_TAC +THEN MRESAL_TAC DOT_NORM[`v3 - v4:real^3`;`-- v3:real^3`][VECTOR_ARITH`wl - wi + (-- wl)= --wi:real^3`;NORM_NEG] +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm (v3:real^3)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm (v3 - v4:real^3)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`norm ((w:num->real^3) i)`;`&2* h0`;][ARITH_RULE`abs (&2 * #1.26)= &2 * #1.26`;REAL_ABS_NORM;h0] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[GSYM h0] +THEN ASM_REWRITE_TAC[h0] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`(v3 - v4) dot --v3 = (a1 - norm (v3 - v4) pow 2 - (x2 - t)) / &2 /\ &2 pow 2 <= x2 - t +/\ &2 pow 2 <= norm (v3 - v4) pow 2 /\ +a1 <= (&2 * #1.26) pow 2 +==> (v3 - v4:real^3) dot --v3< &0`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;DOT_RNEG;DOT_LSUB;DOT_SQUARE_NORM]) +THEN REAL_ARITH_TAC; + + + +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +]);; + + + +let DEFORMATION_DIST_LE_BLL_V3_DEFOR_COM_TWO_CASES=prove_by_refinement( +` 3 &4 * h0 < scs_b_v39 s l i) +==> +(!i. ~(i MOD k = l MOD k) ==> +?e. &0< e/\ +(!t. &0< t/\ t< e ==> dist (v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i)<=scs_b_v39 s l i ))`, +[ +REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`SUC l MOD k = i MOD k \/ ~(i MOD k= SUC l MOD k)`) +THEN RESA_TAC; + +MP_TAC DEFORMATION_V3_DEFOR_EDGE_TWO_CASES +THEN RESA_TAC +THEN ASM_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0 REPEAT DISCH_TAC +THEN MP_TAC th) +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`l+k-1`;`i:num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`SUC l:num`] THEN MRESA_TAC th[`i:num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`SUC l:num`] THEN MRESA_TAC th[`i:num`]) +THEN REPLICATE_TAC (59-53) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM (fun th-> STRIP_TAC THEN MRESA_TAC th[`t:real`]) +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC (62-30) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num`;`i:num`][]) +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +MP_TAC(SET_RULE`SUC i MOD k= l MOD k \/ ~(SUC i MOD k= l MOD k )`) +THEN RESA_TAC; + +MP_TAC HYPER_MM_COLLINEAR_TWO_CASES +THEN RESA_TAC +THEN MP_TAC UPS_X_POS_SEG +THEN RESA_TAC +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM (fun th-> STRIP_TAC +THEN MP_TAC(REAL_ARITH`t --e ~(k=0)/\ ~(k=1)/\ 0real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`] THEN MRESA_TAC th[` l+k-1:num`]) +THEN REWRITE_TAC[dist] +THEN REPLICATE_TAC (68-30) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num`;`l+k-1:num`][]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC REAL_EQ_SQUARE_ABS[`norm (v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) - v1:real^3)`;`norm(v1-v2:real^3)`][REAL_ABS_NORM;GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`l:num`] +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`l+k-1`;`i:num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`] +THEN REPEAT RESA_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`] THEN MRESA_TAC th[`l+k-1:num`]); + +MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_B_SUC_TWO_CASES +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`i:num`][scs_diag]) +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM (fun th-> STRIP_TAC +THEN MP_TAC(REAL_ARITH`t --e &4 * h0 < scs_b_v39 s l i) +==> +?e. &0< e/\ +(!t i. &0< t/\ t< e/\ ~(i MOD k = l MOD k) ==> dist (v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t),w i)<=scs_b_v39 s l i )`, +[ + + +REPEAT STRIP_TAC +THEN MP_TAC DEFORMATION_DIST_LE_BLL_V3_DEFOR_COM_TWO_CASES +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] +THEN REWRITE_TAC[SKOLEM_THM] +THEN STRIP_TAC +THEN ABBREV_TAC`e1= inf {(e:num->real) i| i < k/\ ~(i= l MOD k)}` +THEN EXISTS_TAC`e1:real` +THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` +THEN STRIP_TAC; + + +MATCH_MP_TAC FINITE_IMAGE +THEN REWRITE_TAC[FINITE_NUMSEG]; + + +REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`i:num` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + + +SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(i = l MOD k)} = {})`ASSUME_TAC; + + +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] +THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(0=l MOD k )`) +THEN RESA_TAC; + + + +EXISTS_TAC`(e:num->real)1` +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 1real)0` +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real) i| i < k/\ ~(i= l MOD k)}`;`&0`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN REPLICATE_TAC (13-5) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`]); + + +REPEAT STRIP_TAC +THEN MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(i= l MOD k)}`;`t:real`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`i MOD k` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`]; + + +STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_REFL[`i:num`;`k:num`] +THEN REPLICATE_TAC (15-5) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num MOD k`]) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]); +]);; + + + + +let DEFORMATION_V3_DEFOR_NOT_IN_V_V1_TWO_CASES=prove_by_refinement(` 3 (!i. ~(i MOD k= l MOD k) ==> (?e. &0< e /\ (!t. --e &0 &0 < a`) +THEN ASM_REWRITE_TAC[dist;NORM_POS_LE] +THEN MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0 +MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN MRESA_TAC th[`i MOD k`;`l MOD k`]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESA_TAC th[`l:num`]) +THEN STRIP_TAC +THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v2:real^3`;`(w:num->real^3) i`;]]);; + + + + +let DEFORMATION_V3_DEFOR_NOT_IN_V_COM_V1_TWO_CASES=prove_by_refinement(` 3 ?e. &0< e /\ (!t i. --e &0real) i| i < k/\ ~(i= l MOD k)}` +THEN EXISTS_TAC`e1:real` +THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` +THEN STRIP_TAC; + +MATCH_MP_TAC FINITE_IMAGE +THEN REWRITE_TAC[FINITE_NUMSEG]; + +REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`i:num` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(i = l MOD k)} = {})`ASSUME_TAC; + +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] +THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(0=l MOD k )`) +THEN RESA_TAC; + +EXISTS_TAC`(e:num->real)1` +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 1real)0` +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real) i| i < k/\ ~(i= l MOD k)}`;`&0`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN REPLICATE_TAC (13-5) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`]); + +REPEAT STRIP_TAC +THEN MRESAL_TAC REAL_LE_INF_FINITE[`{(e:num->real) i| i < k/\ ~(i= l MOD k)}`;`e1:real`][REAL_ARITH`a<=a`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`i MOD k` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`]; + +STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_REFL[`i:num`;`k:num`] +THEN MP_TAC(REAL_ARITH`-- e1 -- e(i MOD k)< t/\ t< e(i MOD k)`) +THEN RESA_TAC +THEN REPLICATE_TAC (12) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num MOD k`]) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]);]);; + + + + +let DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1_TWO_CASES=prove(` 3 ?e. &0< e /\ (!t i. -- e ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i))`, +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_V1_TWO_CASES +THEN RESA_TAC +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA_TAC th[`t:real`;`i:num`]) +THEN POP_ASSUM (fun th-> STRIP_TAC +THEN MP_TAC th +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[DIST_REFL]) +THEN REAL_ARITH_TAC);; + + + + +let V3_DEFOR_EQ_IN_FF_V1_TWO_CASES=prove_by_refinement(` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> (!w. v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t),w IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF <=> v2,w IN FF)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (47-44)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN STRIP_TAC +THEN REPLICATE_TAC (48-18)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`x':num`]) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESA_TAC th[`l:num`]) +THEN REPLICATE_TAC (68-61)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +EXISTS_TAC`v2:real^3,w':real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,w'):real^3#real^3`];]);; + + +let V3_DEFOR_RHO_NODE_V1_TWO_CASES=prove(` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> (rho_node1 + (IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF) + (v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t))) = (rho_node1 FF v2)`, +REWRITE_TAC[rho_node1] +THEN STRIP_TAC +THEN MP_TAC V3_DEFOR_EQ_IN_FF_V1_TWO_CASES +THEN RESA_TAC);; + + + + +let V3_DEFOR_EQ_IN_FF_SYM_V1_TWO_CASES=prove_by_refinement(` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> (!w. w,v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF <=> w,v2 IN FF)`, +[STRIP_TAC +THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (40-23)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (47-44)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN STRIP_TAC +THEN REPLICATE_TAC (48-18)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`SUC x':num`]) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC x':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESA_TAC th[`l:num`]) +THEN REPLICATE_TAC (68-61)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +EXISTS_TAC`w':real^3,v2:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w',v2):real^3#real^3`]]);; + + + + +let DEFORMATION_AZIM_V3_DEFOR_V1_V1_TWO_CASES=prove_by_refinement(` 3real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!t. --e< t/\ t< e ==> +azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t)) + (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t IN + IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) = + azim (vec 0) v2 (rho_node1 FF v2) (@a. a,v2 IN FF)))`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1_TWO_CASES +THEN RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (SUC l)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN RESA_TAC +THEN ABBREV_TAC`e1=(min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1< e/\ e1 t< e/\ --e ~(k=0)/\ ~(k=1)/\ 0 REPEAT STRIP_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN SUBGOAL_THEN`(w:num->real^3) (l) IN V` ASSUME_TAC; + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +MRESA_TAC (GEN_ALL Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1)[`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(w:num->real^3) (l)`]) +THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME)[`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l)`;`w:num->real^3`;`l:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;is_scs_v39;periodic2] +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`SUC 0`][ITER] THEN MRESA_TAC th[`k-1`]) +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0+l= SUC(l)/\ k-1+l= l+k-1`]; + +REPLICATE_TAC (76-57) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`t t< e'/\ --e'real^3)(SUC l)`;`v1:real^3`] +THEN STRIP_TAC; + +MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan +THEN EXISTS_TAC`(w:num->real^3) (SUC l)` +THEN ASM_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[]; + +MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan +THEN EXISTS_TAC`(w:num->real^3)(l+k-1)` +THEN ASM_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[]]);; + + + +let V3_DEFOR_EQ_IN_FF_AT_V1_V1_TWO_CASES=prove_by_refinement( +` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(!a. w(SUC l),a IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF<=> +w(SUC l),a IN FF)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (44-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`SUC l:num`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th [`l:num`]) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`v2= SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +SUBGOAL_THEN`(w:num->real^3) (SUC l),v2 IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`v1,v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v1:real^3`;`(w:num->real^3) (SUC l)`] +THEN REPLICATE_TAC (49-8)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`(w:num->real^3) (l+k-1)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[]; + +EXISTS_TAC`(w:num->real^3)(SUC l),a':real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`v2= a':real^3\/ ~(v2=a')`) +THEN RESA_TAC; + +SUBGOAL_THEN`v1,v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v1:real^3`;`(w:num->real^3) (SUC l)`] +THEN REPLICATE_TAC (51-8)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN MRESA_TAC th3[`v1:real^3`;`vec 0:real^3`;`(w:num->real^3) (l+k-1)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`v2,(w:num->real^3) (SUC l) IN (FF:real^3#real^3->bool)` ASSUME_TAC; + + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,w (SUC l)):real^3#real^3`] +THEN MRESA_TAC th3[`v2:real^3`;`vec 0:real^3`;`(w:num->real^3) (SUC l)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC]);; + + + +let V3_DEFOR_RHO_NODE_AT_V1_V1_TWO_CASES=prove(` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(rho_node1 + (IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF) + (w (SUC l))) +=(rho_node1 FF (w (SUC l)))`, +REWRITE_TAC[rho_node1] +THEN STRIP_TAC +THEN MP_TAC V3_DEFOR_EQ_IN_FF_AT_V1_V1_TWO_CASES +THEN RESA_TAC);; + + + + +let V3_DEFOR_EQ_IN_FF_AT_V1_SYM_V1_TWO_CASES=prove_by_refinement( +` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(@a. a,w(SUC l) IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF)= +v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA +THEN STRIP_TAC; + +EXISTS_TAC`v3_defor_v1 (-- &1) (v1) (v2) x1 x2 x6 x6 (x2 - t)` +THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`v2:real^3,(w:num->real^3)(SUC l)` +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`v2,(w:num->real^3) (SUC l) IN (FF:real^3#real^3->bool)` ASSUME_TAC; + + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,w (SUC l)):real^3#real^3`] +THEN MRESA_TAC th3[`v2:real^3`;`vec 0:real^3`;`(w:num->real^3) (SUC l)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC; + +REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (45-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`SUC l:num`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th [`l:num`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC; + +SUBGOAL_THEN`a',w(SUC l) IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`v2,w(SUC l) IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(w:num->real^3)(SUC l)`;`FF:real^3#real^3->bool`;`v2:real^3`;`(a':real^3) `]]);; + + + + +let DEFORMATION_AZIM_V3_DEFOR_V1_AT_V1_V1_TWO_CASES=prove_by_refinement( +` 3real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!t. --e< t/\ t< e ==> +azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (SUC l)) t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (SUC l)) t)) + (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (SUC l)) t IN + IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) = + azim (vec 0) (w (SUC l)) (rho_node1 FF (w (SUC l))) (@a. a,(w (SUC l)) IN FF)))`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1_TWO_CASES +THEN RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (SUC l )`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN RESA_TAC +THEN ABBREV_TAC`e1=(min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1< e/\ e1 t< e/\ --e ~(k=0)/\ ~(k=1)/\ 0 REPEAT STRIP_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN SUBGOAL_THEN`v2,(w:num->real^3) (SUC l) IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,w (SUC l)):real^3#real^3`] +THEN MRESA_TAC th3[`v2:real^3`;`vec 0:real^3`;`(w:num->real^3) (SUC l)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[GSYM ivs_rho_node1]; + +MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(SUC l)`;`v2:real^3`] +THEN MP_TAC(SET_RULE`v2 IN aff_gt {vec 0} {v1, w (SUC l)}/\ + aff_gt {vec 0} {v1, w (SUC l)} SUBSET aff_ge {vec 0} {v1, w (SUC l)} +==> v2 IN aff_ge {vec 0} {v1:real^3, w (SUC l)}`) +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN RESA_TAC +THEN MRESA_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT[`vec 0:real^3`;`(w:num->real^3)(SUC l)`;`v2:real^3`;`v1:real^3`;`(rho_node1 FF (w (SUC l)))`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN RESA_TAC +THEN MATCH_MP_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT +THEN STRIP_TAC; + +MATCH_MP_TAC(GEN_ALL (SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff_gt{vec 0:real^3} {w(SUC l),v1}` +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]; + +REPLICATE_TAC (89-57) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`t t< e'/\ --e'real^3) (l+k-1)` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (89-57) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`t t< e'/\ --e' ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(!v. v,w (l + (scs_k_v39 s - 1)) IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF<=> +v,w (l + (scs_k_v39 s - 1)) IN FF)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (44-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`l+k-1:num`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC MOD_ADD_SUB_1 +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +SUBGOAL_THEN`v2, w(l+k-1) IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v2:real^3,(w:num->real^3)(l+k-1)`;`V:real^3->bool`;] +THEN MP_TAC Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`SND(x:real^3#real^3)`]); + +EXISTS_TAC`v:real^3,(w:num->real^3) (l + k - 1)` +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3)(l+k-1),v2:real^3`;]; + +MP_TAC(SET_RULE`v2=v:real^3\/ ~(v=v2)`) +THEN RESA_TAC; + +SUBGOAL_THEN`v2, w(l+k-1) IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v2:real^3,(w:num->real^3)(l+k-1)`;`V:real^3->bool`;] +THEN MP_TAC Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(w:num->real^3)(l+k-1)`])]);; + + + + +let V3_DEFOR_EQ_IN_FF_AT_W_SYM_V1_TWO_CASES=prove_by_refinement( +` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(@v. w(l+k-1),v IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF)= +v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA +THEN STRIP_TAC; + +EXISTS_TAC`v3_defor_v1 (-- &1) (v1) (v2) x1 x2 x6 x6 (x2 - t)` +THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`(w:num->real^3) (l + k - 1),v2:real^3` +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`v1,v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3)(l+k-1),v2:real^3`;]; + +REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN RESA_TAC; + + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (46-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`l+k-1:num`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC MOD_ADD_SUB_1 +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC; + +SUBGOAL_THEN`v1,v IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`v1,v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v1:real^3`;`v2:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v:real^3`;]]);; + + + + +let DEFORMATION_AZIM_V3_DEFOR_V1_AT_W_V1_TWO_CASES=prove_by_refinement( +` 3real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!t. --e< t/\ t< e ==> +azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l + k - 1)) t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l + k - 1)) t)) + (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l + k - 1)) t IN + IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) = + azim (vec 0) (w (l + k - 1)) (rho_node1 FF (w (l + k - 1))) + (@a. a,w (l + k - 1) IN FF)))`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1_TWO_CASES +THEN RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (SUC l)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN RESA_TAC +THEN ABBREV_TAC`e1=(min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1< e/\ e1 t< e/\ --ebool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic;BBprime_v39;] +THEN REPEAT RESA_TAC; + +ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (38-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] +THEN ONCE_REWRITE_TAC[Rogers.AZIM_EQ_SYM]; + +MP_TAC(SET_RULE`v2 IN aff_gt {vec 0} {v1, w (SUC l)}/\ + aff_gt {vec 0} {v1, w (SUC l)} SUBSET aff_ge {vec 0} {v1, w (SUC l)} +==> v2 IN aff_ge {vec 0} {v1:real^3, w (SUC l )}`) +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC(GEN_ALL Planarity.properties_of_collinear4_points_fan) +[`vec 0:real^3`;`(w:num->real^3)(SUC l)`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT[`vec 0:real^3`;`(w:num->real^3)(l+k-1)`;`v2:real^3`;`(w:num->real^3)(SUC l)`;`(ivs_rho_node1 FF (w(l+k-1)))`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN MATCH_MP_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT +THEN STRIP_TAC; + +ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN MATCH_MP_TAC(GEN_ALL (SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff_gt{vec 0:real^3} {w(SUC l),v1}` +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN REPLICATE_TAC (47-22) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`t t< e'/\ --e'real^3)(SUC l)` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (47-22) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`t t< e'/\ --e' ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +/\ ~(v=v1)/\ ~(v=v2)/\ ~(v= w(SUC l)) +/\ v IN V +==> +(!w. v,w IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF<=> +v,w IN FF)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (24-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + + +REPLICATE_TAC (42-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + + +MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (49-23)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN STRIP_TAC +THEN REPLICATE_TAC (50-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`x':num`]) +THEN REPLICATE_TAC (50-46)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC DIVISION[`x':num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN MP_TAC(SET_RULE`x' MOD k = l MOD k \/ ~(x' MOD k = l MOD k)`) +THEN RESA_TAC; + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESA_TAC th[`l:num`]) +THEN REPLICATE_TAC (77-39)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + + +RESA_TAC; + + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`v2= SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +SUBGOAL_THEN`v,v2 IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`v1,v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`v1:real^3`]; + +EXISTS_TAC`v:real^3,w':real^3` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`v2= w':real^3\/ ~(v2=w')`) +THEN RESA_TAC; + +SUBGOAL_THEN`w (l+k-1),v2 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`(w:num->real^3) (l+k-1)`]]);; + + + + + + + + +let V3_DEFOR_EQ_IN_FF_AT_V_ANY_SYM_V1_TWO_CASES=prove_by_refinement( +` 3 ~(v3_defor_v1 a v1 v2 x1 x2 x6 x6 (x2 - t)=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +/\ ~(v=v1)/\ ~(v=v2)/\ ~(v= w(SUC l)) +/\ v IN V +==> +(!w. w,v IN + IMAGE + (\uv. (if FST uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else FST uv), + (if SND uv = v2 + then v3_defor_v1 (-- &1) v1 v2 x1 x2 x6 x6 (x2 - t) + else SND uv)) + FF<=> +w,v IN FF)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (24-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (42-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (49-23)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN STRIP_TAC +THEN REPLICATE_TAC (50-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`;`x':num`]) +THEN REPLICATE_TAC (50-47)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC DIVISION[`x':num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN MP_TAC(SET_RULE`x' MOD k = l MOD k \/ ~(x' MOD k = l MOD k)`) +THEN RESA_TAC; + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESA_TAC th[`l:num`]) +THEN REPLICATE_TAC (77-39)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +RESA_TAC; + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`v2= FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +SUBGOAL_THEN`v2,v IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`v2,w(SUC l) IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(v2:real^3)`;`(w:num->real^3)(SUC l)`;] +THEN REPLICATE_TAC (54-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +EXISTS_TAC`w':real^3,v:real^3` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`v2= w':real^3\/ ~(v2=w')`) +THEN RESA_TAC; + +SUBGOAL_THEN`v2,w(SUC l) IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(v2:real^3)`;`(w:num->real^3)(SUC l)`;] +THEN REPLICATE_TAC (54-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]]);; + +let DEFORMATION_AZIM_V3_DEFOR_V1_AT_V_ANY_V1_TWO_CASES=prove(` 3real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!t v. --e< t/\ t< e /\ ~(v=v1)/\ ~(v=v2)/\ ~(v= w(SUC l)) +/\ v IN V + ==> +azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t)) + (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t IN + IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) = + azim (vec 0) v (rho_node1 FF v) (@a. a,v IN FF)))`, +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1_TWO_CASES +THEN RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (SUC l)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN RESA_TAC +THEN ABBREV_TAC`e1=(min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1< e/\ e1 t< e/\ --ereal^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!t v. --e< t/\ t< e /\ v IN V ==> +azim (vec 0) (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (v) t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (v) t)) + (@a. a,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (v) t IN + IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) = + azim (vec 0) (v) (rho_node1 FF (v)) + (@a. a,v IN FF)))`, +[STRIP_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_W_V1_TWO_CASES +THEN RESA_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_V1_V1_TWO_CASES +THEN RESA_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_V1_TWO_CASES +THEN RESA_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_V_ANY_V1_TWO_CASES +THEN RESA_TAC +THEN ABBREV_TAC`e1=(min (min (min e e') e'')e''')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min (min (min e e') e'')e''')/ &2/\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''==> &0< e1/\ e1 treal^3)(l+k-1))\/ ~(v=(w:num->real^3)(l+k-1))`) +THEN RESA_TAC; + +REPLICATE_TAC (44-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +MP_TAC(SET_RULE`(v=(w:num->real^3) (SUC l))\/ ~(v=(w:num->real^3) (SUC l))`) +THEN RESA_TAC; + +REPLICATE_TAC (45-22) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + + +MP_TAC(SET_RULE`(v=(v2:real^3))\/ ~(v=v2)`) +THEN RESA_TAC; + +REPLICATE_TAC (46-24) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +REPLICATE_TAC (46-26) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]]);; + + + +let DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_TWO_CASES=prove(` 3real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!v t. + v IN V /\ + --e< t /\ t< e /\ + interior_angle1 (vec 0) FF v = pi + ==> interior_angle1 (vec 0) + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) <= + pi))`, +REPEAT STRIP_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_ALL_V1_TWO_CASES +THEN RESA_TAC +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[interior_angle1] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (24-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`;`v:real^3`]) +THEN REAL_ARITH_TAC);; + + + + +let DEFORMATION_LUNAR_AFFINE_HULL_V1_TWO_CASES=prove_by_refinement( +`3real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +/\ IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)=E +/\ lunar (v,w1) V E +==> +?e. &0 v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t IN + affine hull {vec 0, v, w1, v2})`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_V1_TWO_CASES +THEN RESA_TAC +THEN MP_TAC HYPER_MM_COLLINEAR_TWO_CASES +THEN RESA_TAC +THEN REPLICATE_TAC (25-6)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +POP_ASSUM(fun th1-> +REPEAT DISCH_TAC +THEN MP_TAC th THEN MP_TAC th1)) +THEN REPEAT RESA_TAC +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1)[`a:real`;`v2:real^3`;`x1:real`;`x6:real`;`x2:real`;`v1:real^3`;`(w:num->real^3) (SUC l)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN RESA_TAC +THEN REPLICATE_TAC (27-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;IN_REAL_INTERVAL] +THEN MP_TAC th +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool)` ASSUME_TAC; + + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +SUBGOAL_THEN`v2,w (SUC l) IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`3 SUC(l+k-1)= l+k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic] +THEN REPEAT RESA_TAC; + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v1:real^3`;] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(v2:real^3)`;`(w:num->real^3)(SUC l)`] +THEN MRESAL_TAC (GEN_ALL LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI) +[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`w1:real^3`;][DIFF;IN_ELIM_THM;SET_RULE`~(a IN {b,c}) <=> (~(a=b)/\ ~(a=c))`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v2:real^3`]) +THEN MRESA_TAC (GEN_ALL Collect_geom2.THREE_GEN_POINTS_IN_AFF3)[`v2:real^3`;`v:real^3`;`w1:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.CONV02_SUBSET_AFF2)[`v:real^3`;`w1:real^3`] +THEN MP_TAC(SET_RULE`v IN aff {v2, v, w1}/\ w1 IN aff {v2, v, w1} +==> {v, w1} SUBSET aff {v2, v, w1:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.S_SUBSET_IMP_AFF_S_TOO)[`{v, w1:real^3}`;` {v2, v, w1:real^3}`] +THEN MP_TAC(SET_RULE`v1 IN aff {v2, v, w1}/\ w (SUC l) IN aff {v2, v, w1} +/\ vec 0 IN conv0 {v, w1} /\ conv0 {v, w1} SUBSET aff {v, w1} +/\ aff {v, w1} SUBSET aff {v2, v, w1} +==> {vec 0, v1, w (SUC l)} SUBSET aff {v2, v, w1:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.S_SUBSET_IMP_AFF_S_TOO)[`{vec 0, v1, w (SUC l):real^3}`;` {v2, v, w1:real^3}`] +THEN MRESAL_TAC (GEN_ALL Local_lemmas.AFF_GT_SUB_AFF_UNION)[`{vec 0:real^3}`;`{ v1, w (SUC l):real^3}`][SET_RULE`{A}UNION {B,C}={A,B,C}`] +THEN EXISTS_TAC`e':real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (66-27)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`]) +THEN REWRITE_TAC[GSYM aff] +THEN MRESAL_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA[`{v2, v, w1:real^3}`;`{vec 0,v, w1,v2:real^3}`][SET_RULE`{A,B,C} SUBSET {D,B,C,A}`;GSYM aff] +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff {v2, v, w1:real^3}` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff {vec 0, v1, w (SUC l):real^3}` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff_gt {vec 0} {v1, w (SUC l):real^3}` +THEN ASM_REWRITE_TAC[v3_defor_v4] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[];]);; + + + + + + +let V3_DEFOR_CONVEX_LOCAL_FAN_TWO_CASES_concl =`!s k w l. + scs_k_v39 s=k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ + 3 < k /\ + ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ + (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ + (&10= &10) /\ + ~(&2 = norm (v2)) /\ + (&1= &1) /\ + (!i. ~(scs_J_v39 s l i)) /\ + w l=v2/\ w (l+k-1) =v1/\ + norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v1-v2) pow 2=x6/\ a= -- &1/\ + (!V E v. + V = IMAGE w (:num) /\ + E = IMAGE (\i. {w i, w (SUC i)}) (:num) ==> + ~(lunar (v,(w l)) V E )) +==> +(?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> +convex_local_fan + (IMAGE (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t) (:num), + IMAGE + (\i. {v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t, v3_defor_v4 a x1 x2 x6 v1 v2 + (w (SUC i)) + t}) + (:num), + IMAGE + (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t, + v3_defor_v4 a x1 x2 x6 v1 v2 (w (SUC i)) t) + (:num))))`;; + + + +let V3_DEFOR_DEFORMATION_CONVEX_LOCAL_FAN_V1_TWO_CASES=prove_by_refinement( +(mk_imp(ZLZTHIC_concl, mk_imp (MHAEYJN_concl, V3_DEFOR_CONVEX_LOCAL_FAN_TWO_CASES_concl))), +[ + +REPEAT STRIP_TAC; + +REPLICATE_TAC (19-4)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + + +REPLICATE_TAC (38-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +SUBGOAL_THEN`(v2:real^3) IN V` ASSUME_TAC; + + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + + +SUBGOAL_THEN`(v1:real^3) IN V` ASSUME_TAC; + + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +SUBGOAL_THEN`(v2:real^3) IN ball_annulus` ASSUME_TAC; + +REPLICATE_TAC (41-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC) +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`V:real^3->bool` +THEN ASM_REWRITE_TAC[]; + + + +SUBGOAL_THEN`(v1:real^3) IN ball_annulus` ASSUME_TAC; + +REPLICATE_TAC (42-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC) +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`V:real^3->bool` +THEN ASM_REWRITE_TAC[]; + + + +SUBGOAL_THEN`((v1,v2):real^3#real^3) IN FF`ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`] +THEN MP_TAC EQ_W_L_IN_BBS +THEN RESA_TAC; + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v1,v2):real^3#real^3`] +THEN MP_TAC NORM_POS_COLLINEAR +THEN RESA_TAC +THEN MP_TAC V3_DEFOR_IN_BALL_ANNULUS_DEFORMATION +THEN RESA_TAC +THEN MP_TAC UPS_X_POS_SEG +THEN RESA_TAC; + + +MRESA_TAC Deformation.XRECQNS[`-- &1`;`&1`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`ww_defor ((w:num->real^3) l)`] +THEN MRESAL_TAC (GEN_ALL V3_DEFOR_DEFORMATION)[`x2:real`;`x6:real`;`a:real`;`x1:real`;`x2:real`;`x6:real`;`v1:real^3`;`v2:real^3`;`V:real^3->bool`][REAL_ARITH`&0< &1`] +THEN MP_TAC Wrgcvdr_cizmrrh.CIZMRRH +THEN RESA_TAC; + +MP_TAC DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_TWO_CASES +THEN RESA_TAC; + +ABBREV_TAC`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2` +THEN MP_TAC(REAL_ARITH`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''/\ &0< e'''' ==> &0< e1/\ e1< &1/\ e1< e /\ e1< e' /\ e1< e'' /\ e1<= e'''/\ -- e'''<= --e1/\ --e1< &0/\ e1< e''''`) +THEN RESA_TAC; + + +MRESA_TAC (GEN_ALL DEFORMATION_SMALL_INTERVAL)[`-- e''':real`;`e''':real`;`v3_defor_v4 (-- &1) x1 x2 x6 v1 v2`;`V:real^3->bool`;`--e1:real`;`e1:real`] +THEN REPLICATE_TAC (73-0) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th[`-- e1`;`e1:real`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v3_defor_v4 (-- &1) x1 x2 x6 v1 v2`]) +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`(!v t. + v IN V /\ + t IN real_interval (--e1,e1) /\ + interior_angle1 (vec 0) FF v = pi + ==> interior_angle1 (vec 0) + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) <= + pi)`ASSUME_TAC; + +ASM_REWRITE_TAC[IN_REAL_INTERVAL] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (76-61)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[IN_REAL_INTERVAL] +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''''/\ --e1 t STRIP_TAC +THEN MRESA_TAC th[`t:real`]); + + + +(***********lunar**********) + + +MRESAL_TAC JKQEWGV3[`s:scs_v39`;`w:num->real^3`;`v:real^3`;`w':real^3`][LET_DEF;LET_END_DEF;] +THEN MP_TAC(REAL_ARITH`interior_angle1 (vec 0) FF v < pi / &2/\ &0< pi +==> interior_angle1 (vec 0) FF v < pi`) +THEN ASM_REWRITE_TAC[PI_WORKS] +THEN RESA_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`~(v2=v:real^3)`ASSUME_TAC; + +POP_ASSUM(fun th-> MRESA_TAC th[`V:real^3->bool`;`E:(real^3->bool)->bool`;`w':real^3`]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT RESA_TAC) +THEN ASM_REWRITE_TAC[Local_lemmas.LUNAR_COMM]; + + +SUBGOAL_THEN`~(v2=w':real^3)`ASSUME_TAC; + +REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT RESA_TAC); + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ABBREV_TAC`w1=w':real^3` +THEN MP_TAC DEFORMATION_LUNAR_AFFINE_HULL_V1_TWO_CASES +THEN RESA_TAC +THEN ABBREV_TAC`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2` +THEN MP_TAC(REAL_ARITH`e1= (min (min(min(min (min e (&1)) e') e'') e''')e'''')/ &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''/\ &0< e'''' ==> &0< e1/\ e1< &1/\ e1< e /\ e1< e' /\ e1< e'' /\ e1<= e'''/\ -- e'''<= --e1/\ --e1< &0/\ e1< e''''`) +THEN RESA_TAC +THEN SUBGOAL_THEN`(!u' t. + u' IN V /\ ~(v2 = u':real^3) /\ t IN real_interval (--e1,e1) + ==> v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 u' t = u')`ASSUME_TAC; + +REPEAT STRIP_TAC +THEN REWRITE_TAC[v3_defor_v4] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]); + +SUBGOAL_THEN`(!t. t IN real_interval (--e1,e1) + ==> v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v2 t IN + affine hull {vec 0, v, w1, v2})`ASSUME_TAC; + +ASM_REWRITE_TAC[IN_REAL_INTERVAL] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (80-67)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[IN_REAL_INTERVAL] +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''''/\ --e1 tbool`;`--e1:real`;`e1:real`] +THEN REPLICATE_TAC (80-1) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th[`-- e1`;`e1:real`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v3_defor_v4 (-- &1) x1 x2 x6 v1 v2`;`v:real^3`;`w':real^3`;`v2:real^3`]) +THEN POP_ASSUM MP_TAC; + +RESA_TAC +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN EXISTS_TAC`e''''':real` +THEN ASM_REWRITE_TAC[V_DEFORMATION_V3_DEFOR;E_DEFORMATION_V3_DEFOR;F_DEFORMATION_V3_DEFOR] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA_TAC th[`t:real`]);]);; + + + + + +let DEFORMATION_INTERIOR_ANGLE1_EQ_V3_DEFOR_V1_TWO_CASES=prove(` 3real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!v t. + v IN V /\ + --e< t /\ t< e + ==> interior_angle1 (vec 0) + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 v t) = + interior_angle1 (vec 0) FF v))`, +REPEAT STRIP_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_AT_ALL_V1_TWO_CASES +THEN RESA_TAC +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[interior_angle1] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (23-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`;`v:real^3`]) +THEN REAL_ARITH_TAC);; + + + +let INTERIOR_ANGLE_SAME_V3_DEFOR1_TWO_CASES=prove(` 3 BBs_v39 s (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t))/\ +&0< e1 +/\ + IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> +(?e. &0< e/\ (!t i. + &0< t /\ t< e +==> +interior_angle1 (vec 0) + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF) + (ITER i + (rho_node1 + (IMAGE + (\uv. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (FST uv) t, + v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (SND uv) t) + FF)) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (l MOD k)) t)) + = +interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) (w (l MOD k)))))`, +STRIP_TAC +THEN MP_TAC DEFORMATION_INTERIOR_ANGLE1_EQ_V3_DEFOR_V1_TWO_CASES +THEN RESA_TAC +THEN ABBREV_TAC`e2=(min e e1)/ &2` +THEN MP_TAC(REAL_ARITH`e2=(min e e1)/ &2 /\ &0< e/\ &0 &0 ~(k=0)/\ ~(k=1)/\ 0real^3) (:num)`;`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`;`w:num->real^3`;`l MOD k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;] +THEN REPLICATE_TAC (43-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC(REAL_ARITH`t treal^3) i) t) (:num)`;`IMAGE (\i. { v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t, v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) (SUC i)) t}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t, v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) (SUC i)) t) (:num)`;`(\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t) (l MOD k)`;`(\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) t)`;`l MOD k`] +[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;F_DEFORMATION_V3_DEFOR] +THEN REPLICATE_TAC (45-29)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`t t BBs_v39 s (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t))/\ +&0< e1 + ==> +(?e. &0 < e /\ + (!t. &0 < t /\ t < e + ==> taustar_v39 s (\i. v3_defor_v4 a x1 x2 x6 v1 v2 (w i) t)< taustar_v39 s w +))`;; + + + + + +let TAUSTAR_V3_DEFOR_TWO_CASES=prove_by_refinement(( TAUSTAR_V3_DEFOR_TWO_CASES_concl), +[ +REPEAT STRIP_TAC; + +REPLICATE_TAC (22-5)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (41-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +ASM_REWRITE_TAC[taustar_v39;LET_DEF;LET_END_DEF;tau_fun] +THEN STRIP_TAC +THEN MP_TAC INTERIOR_ANGLE_SAME_V3_DEFOR1_TWO_CASES +THEN RESA_TAC +THEN MP_TAC RHO_FUN_DEFORMATION_V3_DEFOR +THEN RESA_TAC +THEN ABBREV_TAC`e2=(min (min e1 e) e')/ &2` +THEN MP_TAC(REAL_ARITH`e2=(min(min e1 e) e')/ &2/\ &0< e1/\ &0< e/\ &0 &0< e2/\ e2< e1/\ e2 t< e1/\ tMRESA1_TAC th`t:real`) +THEN MP_TAC DSV_V3_DEFOR_EQ +THEN RESA_TAC +THEN MATCH_MP_TAC(REAL_ARITH`a a-c< b-c`) +THEN MATCH_MP_TAC(REAL_ARITH`a a-c< b-c`) +THEN MRESA_TAC(GEN_ALL Qknvmlb.SUM_AZIM_EQ_ANGLE_LE4)[`V:real^3->bool`;`w:num->real^3`;`l:num`;`s:scs_v39`;`(w:num->real^3) (l MOD scs_k_v39 s)`;`FF:real^3#real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPLICATE_TAC (59-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`]) +THEN MRESA_TAC(GEN_ALL Qknvmlb.SUM_AZIM_EQ_ANGLE_LE4)[`IMAGE (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 ((w:num->real^3) i) t) (:num)`;` (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 ((w:num->real^3) i) t)`;`l:num`;`s:scs_v39`;` (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 ((w:num->real^3) i) t) (l MOD scs_k_v39 s)`;`IMAGE (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 ((w:num->real^3) i) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (SUC i)) t) (:num)`;`IMAGE (\i. { v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w i) t, v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 ((w:num->real^3) (SUC i)) t}) (:num)`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`{i|i REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ARITH_TAC; + +ASM_REWRITE_TAC[] +THEN MRESAL_TAC SUM_ADD_SPLIT[`(\i. rho_fun (norm (w (i + l MOD k))) * + interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) (w (l MOD k))))`;`0`;`0`;`k-1`][ARITH_RULE`0<=0+1/\ 0+A=A`] +THEN MRESAL_TAC SUM_ADD_SPLIT[`(\i. rho_fun (norm (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (i + l MOD k)) t)) * + interior_angle1 (vec 0) + (IMAGE (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w i) t,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (SUC i)) t) + (:num)) + (ITER i + (rho_node1 + (IMAGE (\i. v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (i)) t,v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w (SUC i )) t) + (:num))) + (v3_defor_v4 (-- &1) x1 x2 x6 v1 v2 (w ( l MOD k)) t)))`;`0`;`0`;`k-1`][ARITH_RULE`0<=0+1/\ 0+A=A`] +THEN MATCH_MP_TAC(REAL_ARITH`a a+c ASM_TAC +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39;convex_local_fan] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN SUBGOAL_THEN`(v2:real^3) IN V`ASSUME_TAC; + +EXPAND_TAC"V" +THEN REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(l:num)IN(:num)`]; + +REPLICATE_TAC (91-67)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC(REAL_ARITH`t --e MRESA_TAC th[`(w:num->real^3) l`]) +THEN MATCH_MP_TAC REAL_LT_RMUL +THEN STRIP_TAC; + +REPLICATE_TAC (93-68)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC(REAL_ARITH`t --e'bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3) (l MOD scs_k_v39 s)`]; + +MATCH_MP_TAC SUM_EQ +THEN REWRITE_TAC[IN_NUMSEG;F_DEFORMATION_V3_DEFOR] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`x<=k-1/\ 3< k==> x< k`) +THEN RESA_TAC +THEN REPLICATE_TAC (65-44)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC(REAL_ARITH`t --e A\/ B`) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39;convex_local_fan] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN SUBGOAL_THEN`(v2:real^3) IN V`ASSUME_TAC; + +EXPAND_TAC"V" +THEN REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(l:num)IN(:num)`]; + +MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;convex_local_fan;is_scs_v39;periodic2] +THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME)[`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`;`w:num->real^3`;`l MOD k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;convex_local_fan;is_scs_v39;periodic2] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`x:num`] ) +THEN MP_TAC(ARITH_RULE`1<=x==> 0real^3) i, w (SUC i)}) (:num)`;`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`] +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`0:num`;`x:num`][ITER;v3_defor_v4] )]);; + + + + + +let IMJXPHR_concl = `!s k w l. + scs_k_v39 s=k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ + 3 < k /\ + ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ + (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + ~(&2 = norm (w l)) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist(w l,w i)) /\ + (!i. ~(scs_J_v39 s l i)) /\ + (!V E v. + V = IMAGE w (:num) /\ + E = IMAGE (\i. {w i, w (SUC i)}) (:num) ==> + ~(lunar (v,(w l)) V E )) ==> + (scs_a_v39 s l (SUC l) = dist (w l, w (SUC l)) /\ + (scs_a_v39 s l (l + (k-1)) = dist (w l, w (l + (k-1)))))`;; + + + +let IMJXPHR=prove_by_refinement((mk_imp(ZLZTHIC_concl, mk_imp (MHAEYJN_concl, IMJXPHR_concl))), + +[ + +REPEAT DISCH_TAC +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC ODXLSTCv2 +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`]) +THEN POP_ASSUM (fun th-> STRIP_TAC +THEN MP_TAC th +THEN POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[SET_RULE`(A==> ~(B/\ A)==>C)<=> A==> ~B==>C`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC THEN MP_TAC th) +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN REWRITE_TAC[scs_diag] +THEN REPLICATE_TAC (2)STRIP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN STRIP_TAC +; + +MP_TAC(SET_RULE`~(SUC l MOD k = i MOD k) /\ + ~(l MOD k = SUC i MOD k) \/ + (SUC l MOD k = i MOD k)\/ (l MOD k = SUC i MOD k)`) +THEN RESA_TAC; + + + +REPLICATE_TAC (14-9)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th[`i:num`]) +; + +MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0 ASM_TAC +THEN MP_TAC th +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC) +THEN MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`l:num`] +THEN SUBGOAL_THEN`scs_a_v39 s l (SUC l) = dist (w l,(w:num->real^3) (SUC l))` +ASSUME_TAC +; + + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +; + +REPLICATE_TAC (54-26) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`l:num`;`i:num`]) +; + +REPLICATE_TAC (55-44) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (2) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC +; + +ASM_REWRITE_TAC[] +; + +REPLICATE_TAC (23-5)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + + +REPLICATE_TAC (35-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC) +; + +SUBGOAL_THEN`(w:num->real^3) l IN V` ASSUME_TAC; + + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + + +SUBGOAL_THEN`(w:num->real^3) (SUC l) IN V` ASSUME_TAC; + + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`SUC l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +SUBGOAL_THEN`(w:num->real^3) l IN ball_annulus` ASSUME_TAC; + + +REPLICATE_TAC (38-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC) +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`V:real^3->bool` +THEN ASM_REWRITE_TAC[]; + + + +SUBGOAL_THEN`(w:num->real^3) (SUC l) IN ball_annulus` ASSUME_TAC; + + +REPLICATE_TAC (39-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC) +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`V:real^3->bool` +THEN ASM_REWRITE_TAC[]; + + +MP_TAC(REAL_ARITH`scs_a_v39 s l (l + k - 1) < dist ((w:num->real^3) l,w (l + k - 1))\/ scs_a_v39 s l (l + k - 1) >= dist (w l,w (l + k - 1))`) +THEN RESA_TAC; + + +SUBGOAL_THEN(`!i. ~(l MOD k = i MOD k) /\ + ~(SUC l MOD k = i MOD k) + ==> scs_a_v39 s l i < dist ((w:num->real^3) l,(w:num->real^3) i)`)ASSUME_TAC; + +GEN_TAC +THEN MP_TAC(SET_RULE`(l MOD k = SUC i' MOD k)\/ ~(l MOD k = SUC i' MOD k)`) +THEN RESA_TAC; + +MRESAL_TAC Hdplygy.MOD_EQ_MOD[`l+k-1`;`i':num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`] +THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l+k-1:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l+k-1:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[] +; + + +REPLICATE_TAC (42-9)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`i':num`]) +; + + + + + + +ABBREV_TAC`v2= (w:num->real^3) l` +THEN ABBREV_TAC`v1= (w:num->real^3) (SUC l)` +THEN ABBREV_TAC`x1=norm (v1:real^3) pow 2` +THEN ABBREV_TAC`x2=norm (v2:real^3) pow 2` +THEN ABBREV_TAC`x6=norm (v1-v2:real^3) pow 2` +THEN ABBREV_TAC`a= -- &1` +THEN SUBGOAL_THEN`((v2,v1):real^3#real^3) IN FF`ASSUME_TAC +; + + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`]; + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,v1):real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MP_TAC NORM_POS_COLLINEAR +THEN RESA_TAC +THEN MP_TAC V3_DEFOR_IN_BALL_ANNULUS_DEFORMATION +THEN RESA_TAC +THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_COM_SUC +THEN RESA_TAC +THEN MP_TAC UPS_X_POS_SEG +THEN RESA_TAC +THEN ASM_TAC +THEN REPLICATE_TAC (4)(STRIP_TAC) +THEN ASM_REWRITE_TAC[] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC DEFORMATION_DIST_LE_BLL_V3_DEFOR_COM +THEN RESA_TAC +THEN MP_TAC V3_DEFOR_DEFORMATION_CONVEX_LOCAL_FAN_V1 +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`]) +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC(SET_RULE`(B==> A==>C)==>((A==>B)==> A==>C)`) +THEN STRIP_TAC +THEN ABBREV_TAC`e1=(min (min (min (min e e') e'') e''')e'''') / &2` +THEN MP_TAC(REAL_ARITH`e1=(min (min (min (min e e') e'') e''')e'''') / &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''/\ &0< e''''==> &0 BBs_v39 s (\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) (t) )` ASSUME_TAC; + + +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT STRIP_TAC; + + +ASM_REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;ww_defor] +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`((w:num->real^3) x' = v2)\/ ~(w x' = v2)`) +THEN RESA_TAC; + + +MP_TAC(REAL_ARITH`t< e1/\ e1< e==> t< e`) +THEN RESA_TAC +; + +REPLICATE_TAC (80-59)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`]) +; + + + +ASM_REWRITE_TAC[v3_defor_v4] +; + +REPLICATE_TAC (79-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC) +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`V:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +; + + +ASM_TAC +THEN REPLICATE_TAC 5 (STRIP_TAC) +THEN MP_TAC(ARITH_RULE`3< k==> ~(k<=3)`) +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;periodic;ww_defor] +THEN REPEAT RESA_TAC; + + +(****scs_a *****) + +ASM_REWRITE_TAC[v3_defor_v4] +THEN MP_TAC(SET_RULE`(w:num->real^3) i' =w l \/ ~(w i' = w l)`) +THEN RESA_TAC; + + +MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`) +THEN RESA_TAC; + + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i':num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i' MOD k`;`j MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]); + + + + + + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i':num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i' MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`j MOD k = l MOD k==> (w:num->real^3)(j MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'==> t< e'`) +THEN RESA_TAC +; + +REPLICATE_TAC (111-41) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN MP_TAC(SET_RULE`j MOD k=SUC l MOD k\/ ~(SUC l MOD k = j MOD k)`) +THEN RESA_TAC +; + + +REPLICATE_TAC (108-97) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (l MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC l:num` +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC l)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +; + +REPLICATE_TAC (111-66) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN RESA_TAC +; + +REPLICATE_TAC (113-82) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`e1< e''/\ t< e1/\ &0 --e'' b>=a`;NORM_GE_SQUARE] +THEN REWRITE_TAC[DOT_SQUARE_NORM;GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ARITH`x6>=x6`] +; + +REPLICATE_TAC (111-81) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`;`j:num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`l:num`) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +(****scs_a SYM*****) + +MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`) +THEN RESA_TAC; + + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i':num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`j MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`i' MOD k = l MOD k==> (w:num->real^3)(i' MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'==> t< e'`) +THEN RESA_TAC +; + +REPLICATE_TAC (111-41) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN MP_TAC(SET_RULE`i' MOD k=SUC l MOD k\/ ~(SUC l MOD k = i' MOD k)`) +THEN RESA_TAC +; + + +REPLICATE_TAC (108-96) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (l MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC l:num` +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC l)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +; + +REPLICATE_TAC (111-66) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN RESA_TAC +; + + +REPLICATE_TAC (114-82) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`e1< e''/\ t< e1/\ &0 --e'' b>=a`;NORM_GE_SQUARE] +THEN REWRITE_TAC[DOT_SQUARE_NORM;GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[DOT_SQUARE_NORM;GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[dist] +THEN REWRITE_TAC[REAL_ARITH`x6>=x6`] +; + +REPLICATE_TAC (111-81) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`;`i':num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i')`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`l:num`) +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +; + +(***LE scs_b**) + + + +ASM_REWRITE_TAC[v3_defor_v4] +THEN MP_TAC(SET_RULE`(w:num->real^3) i' =w l \/ ~(w i' = w l)`) +THEN RESA_TAC; + + +MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`) +THEN RESA_TAC; + + + +REWRITE_TAC[DIST_REFL] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +; + +REPLICATE_TAC (99-44) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i':num`;`j:num`][DIST_REFL]); + + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i':num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i' MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s j`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`j MOD k = l MOD k==> (w:num->real^3)(j MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'''==> t< e'''`) +THEN RESA_TAC +; + + +REPLICATE_TAC (111-86) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`t:real`;`j:num`][DIST_REFL]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s j`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +; + + + + +(***********scs_b SYM**********) + + +MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`) +THEN RESA_TAC; + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i':num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`j MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`i' MOD k = l MOD k==> (w:num->real^3)(i' MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'''==> t< e'''`) +THEN RESA_TAC +; + + +REPLICATE_TAC (111-86) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`t:real`;`i':num`][DIST_REFL]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +; + + + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +; + + +(*************convex_local_fan**************) + + + +ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''''/\ &0< t/\ &0< e''''==> t< e''''/\ --e''''< t`) +THEN RESA_TAC +THEN REPLICATE_TAC (78-67) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`;]) +; + + + + +MP_TAC TAUSTAR_V3_DEFOR +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`]) +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC`e2= (min e1 e''''')/ &2` +THEN MP_TAC(REAL_ARITH`e2= (min e1 e''''')/ &2 /\ &0< e1/\ &0< e''''' +==> &0< e2/\ e2< e1/\ e2< e'''''`) +THEN RESA_TAC +THEN REPLICATE_TAC (80-75)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`e2:real`]) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`e2:real`]) +THEN REPLICATE_TAC (81-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`(\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) e2)`]) +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC +; + +(*********************) + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (65-44)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`l:num`;`l+k-1`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC ; + + + +(*************CASE TWO****************) + +MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0 ASM_TAC +THEN MP_TAC th +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC) +THEN MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`l:num`] +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`l+k-1`;`i:num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`] +THEN SUBGOAL_THEN`scs_a_v39 s l (l+k-1) = dist (w l,(w:num->real^3) (l+k-1))` +ASSUME_TAC +; + + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l+k-1:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l+k-1:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +; + +REPLICATE_TAC (55-26) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`l:num`;`i:num`]) +; + + +REPLICATE_TAC (56-44) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (2) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC +; + +ASM_REWRITE_TAC[] +; + + +REPLICATE_TAC (24-5)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + + +REPLICATE_TAC (35-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC) +; + +SUBGOAL_THEN`(w:num->real^3) l IN V` ASSUME_TAC; + + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + + +SUBGOAL_THEN`(w:num->real^3) (l+k-1) IN V` ASSUME_TAC; + + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +SUBGOAL_THEN`(w:num->real^3) l IN ball_annulus` ASSUME_TAC; + + +REPLICATE_TAC (38-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC) +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`V:real^3->bool` +THEN ASM_REWRITE_TAC[]; + + + +SUBGOAL_THEN`(w:num->real^3) (l+k-1) IN ball_annulus` ASSUME_TAC; + + +REPLICATE_TAC (39-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC) +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`V:real^3->bool` +THEN ASM_REWRITE_TAC[]; + + +MP_TAC(REAL_ARITH`scs_a_v39 s l (SUC l) < dist ((w:num->real^3) l,w (SUC l))\/ scs_a_v39 s l (SUC l) >= dist (w l,w (SUC l))`) +THEN RESA_TAC; + + + + +SUBGOAL_THEN(`!i. ~(l MOD k = i MOD k) /\ + ~(l MOD k = SUC i MOD k) + ==> scs_a_v39 s l i < dist ((w:num->real^3) l,(w:num->real^3) i)`)ASSUME_TAC; + +GEN_TAC +THEN MP_TAC(SET_RULE`(SUC l MOD k = i' MOD k)\/ ~(SUC l MOD k = i' MOD k)`) +THEN RESA_TAC; + + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC l:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC l:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[] +; + + + + +REPLICATE_TAC (45-11)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`i':num`]) +; + + + + +ASM_TAC +THEN REPLICATE_TAC (45)(RESA_TAC) +THEN STRIP_TAC; + + +ABBREV_TAC`v2= (w:num->real^3) l` +THEN ABBREV_TAC`v1= (w:num->real^3) (l+k-1)` +THEN ABBREV_TAC`x1=norm (v1:real^3) pow 2` +THEN ABBREV_TAC`x2=norm (v2:real^3) pow 2` +THEN ABBREV_TAC`x6=norm (v1-v2:real^3) pow 2` +THEN ABBREV_TAC`a= -- &1` +THEN SUBGOAL_THEN`((v1,v2):real^3#real^3) IN FF`ASSUME_TAC +; + + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l+k-1:num` +THEN ASM_SIMP_TAC[SET_RULE`(a:num) IN (:num)`;EQ_W_L_IN_BBS] +THEN MP_TAC EQ_W_L_IN_BBS +THEN RESA_TAC; + + + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v1,v2):real^3#real^3`] +THEN MP_TAC NORM_POS_COLLINEAR +THEN RESA_TAC +THEN MP_TAC V3_DEFOR_IN_BALL_ANNULUS_DEFORMATION +THEN RESA_TAC +THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_COM_SUC_TWO_CASES +THEN RESA_TAC +THEN MP_TAC UPS_X_POS_SEG +THEN RESA_TAC +THEN ASM_TAC +THEN REPLICATE_TAC (4)(STRIP_TAC) +THEN ASM_REWRITE_TAC[] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC DEFORMATION_DIST_LE_BLL_V3_DEFOR_COM_TWO_CASES +THEN RESA_TAC +THEN MP_TAC V3_DEFOR_DEFORMATION_CONVEX_LOCAL_FAN_V1_TWO_CASES +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`]) +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC(SET_RULE`(B==> A==>C)==>((A==>B)==> A==>C)`) +THEN STRIP_TAC +THEN ABBREV_TAC`e1=(min (min (min (min e e') e'') e''')e'''') / &2` +THEN MP_TAC(REAL_ARITH`e1=(min (min (min (min e e') e'') e''')e'''') / &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''/\ &0< e''''==> &0 BBs_v39 s (\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) (t) )` ASSUME_TAC; + + + + + +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT STRIP_TAC; + + +ASM_REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;ww_defor] +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`((w:num->real^3) x' = v2)\/ ~(w x' = v2)`) +THEN RESA_TAC; + + +MP_TAC(REAL_ARITH`t< e1/\ e1< e==> t< e`) +THEN RESA_TAC +; + +REPLICATE_TAC (80-59)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`]) +; + + + +ASM_REWRITE_TAC[v3_defor_v4] +; + +REPLICATE_TAC (79-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC) +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`V:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +; + + +ASM_TAC +THEN REPLICATE_TAC 5 (STRIP_TAC) +THEN MP_TAC(ARITH_RULE`3< k==> ~(k<=3)`) +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;periodic;ww_defor] +THEN REPEAT RESA_TAC; + + +(****scs_a *****) + +ASM_REWRITE_TAC[v3_defor_v4] +THEN MP_TAC(SET_RULE`(w:num->real^3) i' =w l \/ ~(w i' = w l)`) +THEN RESA_TAC; + + +MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`) +THEN RESA_TAC; + + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i':num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i' MOD k`;`j MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]); + + + + + + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i':num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i' MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`j MOD k = l MOD k==> (w:num->real^3)(j MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'==> t< e'`) +THEN RESA_TAC +; + +REPLICATE_TAC (111-41) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN MP_TAC(SET_RULE`SUC j MOD k= l MOD k\/ ~(l MOD k = SUC j MOD k)`) +THEN RESA_TAC +; + + +MRESAL_TAC Hdplygy.MOD_EQ_MOD[`j:num`;`i:num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`] +; + + +REPLICATE_TAC (109-97) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (l MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`l+k-1:num` +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (l+k-1)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`] THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC; + +REPLICATE_TAC (112-66) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l+k-1:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN RESA_TAC +; + +REPLICATE_TAC (114-82) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`e1< e''/\ t< e1/\ &0 --e'' b>=a`;NORM_GE_SQUARE] +THEN REWRITE_TAC[DOT_SQUARE_NORM;GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ARITH`x6>=x6`] +; + + +REPLICATE_TAC (111-81) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`;`j:num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC i:num` THEN MRESA1_TAC th`l:num`) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +(****scs_a SYM*****) + +MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`) +THEN RESA_TAC; + + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i':num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`j MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`i' MOD k = l MOD k==> (w:num->real^3)(i' MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'==> t< e'`) +THEN RESA_TAC +; + +REPLICATE_TAC (111-41) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN MP_TAC(SET_RULE`SUC i' MOD k= l MOD k\/ ~(l MOD k = SUC i' MOD k)`) +THEN RESA_TAC +; + +MRESAL_TAC Hdplygy.MOD_EQ_MOD[`i':num`;`i:num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`] +; + + +REPLICATE_TAC (109-96) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (l MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`l+k-1:num` +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (l+k-1)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`] THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC; + +REPLICATE_TAC (112-66) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l+k-1:num`[ARITH_RULE`4 MOD 4=0`]) +THEN RESA_TAC +; + + +REPLICATE_TAC (115-82) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`e1< e''/\ t< e1/\ &0 --e'' b>=a`;NORM_GE_SQUARE] +THEN REWRITE_TAC[DOT_SQUARE_NORM;GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[DOT_SQUARE_NORM;GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[dist] +THEN REWRITE_TAC[REAL_ARITH`x6>=x6`] +; + +REPLICATE_TAC (111-81) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`;`i':num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i')`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC i:num` THEN MRESA1_TAC th`l:num`) +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +; + +(***LE scs_b**) + + + +ASM_REWRITE_TAC[v3_defor_v4] +THEN MP_TAC(SET_RULE`(w:num->real^3) i' =w l \/ ~(w i' = w l)`) +THEN RESA_TAC; + + +MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`) +THEN RESA_TAC; + + + +REWRITE_TAC[DIST_REFL] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +; + +REPLICATE_TAC (99-44) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i':num`;`j:num`][DIST_REFL]); + + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i':num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i' MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s j`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`j MOD k = l MOD k==> (w:num->real^3)(j MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'''==> t< e'''`) +THEN RESA_TAC +; + + +REPLICATE_TAC (111-86) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`t:real`;`j:num`][DIST_REFL]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s j`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`SUC i`] THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +; + + + + +(***********scs_b SYM**********) + + +MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`) +THEN RESA_TAC; + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i':num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`j MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`i' MOD k = l MOD k==> (w:num->real^3)(i' MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'''==> t< e'''`) +THEN RESA_TAC +; + + +REPLICATE_TAC (111-86) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`t:real`;`i':num`][DIST_REFL]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`SUC i`] THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +; + + + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +; + + +(*************convex_local_fan**************) + + + +ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''''/\ &0< t/\ &0< e''''==> t< e''''/\ --e''''< t`) +THEN RESA_TAC +THEN REPLICATE_TAC (78-67) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`;]) +; + + + + +MP_TAC TAUSTAR_V3_DEFOR_TWO_CASES +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`]) +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC`e2= (min e1 e''''')/ &2` +THEN MP_TAC(REAL_ARITH`e2= (min e1 e''''')/ &2 /\ &0< e1/\ &0< e''''' +==> &0< e2/\ e2< e1/\ e2< e'''''`) +THEN RESA_TAC +THEN REPLICATE_TAC (80-75)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`e2:real`]) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`e2:real`]) +THEN REPLICATE_TAC (81-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`(\i. v3_defor_v4 a x1 x2 x6 v1 v2 ((w:num->real^3) i) e2)`]) +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC +; + + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (65-44)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`l:num`;`SUC l`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC ; + + + + + + + + +]);; + + + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/IUNBUIG.hl b/text_formalization/local/IUNBUIG.hl new file mode 100644 index 0000000..3a7844a --- /dev/null +++ b/text_formalization/local/IUNBUIG.hl @@ -0,0 +1,2597 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Section: Appendix, Main Estimate, check_completeness *) +(* Chapter: Local Fan *) +(* Lemma: IUNBUIG *) +(* Author: Thomas Hales *) +(* Date: 2013-07-29 *) +(* ========================================================================== *) + +module Iunbuig = struct + + +open Hales_tactic;; + + +let LET_THM = CONJ LET_DEF LET_END_DEF;; + + +let quadratic_at_most_2_roots = prove_by_refinement( + `!a b c. ?x1 x2. !x. + ~(a = &0) /\ a * x pow 2 + b * x + c = &0 ==> x = x1 \/ x = x2`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + ASM_CASES_TAC `~(?x1. a * x1 pow 2 + b * x1 + c = &0)`; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[] THEN REPEAT STRIP_TAC; + ASM_CASES_TAC `!x2. a * x2 pow 2 + b * x2 + c = &0 ==> x2 = x1`; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[NOT_FORALL_THM] THEN REPEAT STRIP_TAC; + GEXISTL_TAC [`x1`;`x2`]; + BY(GEN_TAC THEN ASM_TAC THEN CONV_TAC REAL_RING) +(* String.length above = 414. String.length below = 233. 56% the length. *) +(* +g/r +asmcs `~(?x1. a * x1 pow 2 + b * x1 + c = &0)` +amt[] +fx mp then rt[] then str/r +asmcs `!x2. a * x2 pow 2 + b * x2 + c = &0 ==> x2 = x1` +amt[] +fx mp then rt[NOT_FORALL_THM] then str/r +exl [`x1`;`x2`] +g then asm then cvc REAL_RING +*) +(* +If there are no roots, it is obvious. Otherwise, let x1 be a root. +If every root is x1 it is obvious. Otherwise, let x2 be a second root. +Instantiate the existential quantifiers with these two roots, and solve the resulting +problem by Groebner basis algorithm. +*) +]);; + (* }}} *) + +let ARCV_ADD_AFF_GE = prove_by_refinement( + `!(u:real^N) v w x. ~(v = u) /\ ~(w = u) /\ ~(x = u) /\ x IN aff_ge {u} {v, w} ==> + arcV u v x + arcV u x w = arcV u v w`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[ARCV_ANGLE;ANGLES_ADD_AFF_GE]) + ]);; + (* }}} *) + +let SUM_NUMSEG4 = prove_by_refinement( + `!t. sum (0..4) t = t 0 + t 1 + t 2 + t 3 + t 4`, + (* {{{ proof *) + [ + REWRITE_TAC[arith `4 = SUC 3`;SUM_CLAUSES_NUMSEG;Qknvmlb.SUM_NUMSEG3;arith `0 <= SUC 3`]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let epsilon_pent = prove_by_refinement( + `!e e' e'' e''' e''''. &0 < e /\ &0 < e' /\ &0 < e'' /\ &0 < e''' /\ &0 < e'''' ==> (?e'''''. &0 < e''''' /\ (!t. abs t < e''''' ==> abs t < e) /\ (!t. abs t < e''''' ==> abs t < e') /\ (!t. abs t < e''''' ==> abs t < e'') /\ (!t. abs t < e''''' ==> abs t < e''') /\ (!t. abs t < e''''' ==> abs t < e''''))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Cuxvzoz.epsilon_quad [`e`;`e'`;`e''`;`e'''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Cuxvzoz.epsilon_pair [`e''''`;`e'''''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''''''` EXISTS_TAC; + BY(ASM_REWRITE_TAC[] THEN REPEAT CONJ_TAC THEN REPEAT WEAKER_STRIP_TAC THEN (REPEAT (FIRST_X_ASSUM MATCH_MP_TAC)) THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let epsilon_hex = prove_by_refinement( + `!e e' e'' e''' e'''' e5. &0 < e /\ &0 < e' /\ &0 < e'' /\ &0 < e''' /\ &0 < e'''' /\ &0 < e5 ==> (?e6. &0 < e6 /\ (!t. abs t < e6 ==> abs t < e) /\ (!t. abs t < e6 ==> abs t < e') /\ (!t. abs t < e6 ==> abs t < e'') /\ (!t. abs t < e6 ==> abs t < e''') /\ (!t. abs t < e6 ==> abs t < e'''') /\ (!t. abs t < e6 ==> abs t < e5))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_pent [`e`;`e'`;`e''`;`e'''`;`e''''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Cuxvzoz.epsilon_pair [`e'''''`;`e5`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''''''` EXISTS_TAC; + BY(ASM_REWRITE_TAC[] THEN REPEAT CONJ_TAC THEN REPEAT WEAKER_STRIP_TAC THEN (REPEAT (FIRST_X_ASSUM MATCH_MP_TAC)) THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let epsilon_hept = prove_by_refinement( + `!e e' e'' e''' e'''' e5 e6. &0 < e /\ &0 < e' /\ &0 < e'' /\ &0 < e''' /\ &0 < e'''' /\ &0 < e5 /\ &0 < e6 ==> (?e7. &0 < e7 /\ (!t. abs t < e7 ==> abs t < e) /\ (!t. abs t < e7 ==> abs t < e') /\ (!t. abs t < e7 ==> abs t < e'') /\ (!t. abs t < e7 ==> abs t < e''') /\ (!t. abs t < e7 ==> abs t < e'''') /\ (!t. abs t < e7 ==> abs t < e5) /\ (!t. abs t < e7 ==> abs t < e6))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC epsilon_hex [`e`;`e'`;`e''`;`e'''`;`e''''`;`e5`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Cuxvzoz.epsilon_pair [`e6`;`e6'`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e'''''` EXISTS_TAC; + BY(ASM_REWRITE_TAC[] THEN REPEAT CONJ_TAC THEN REPEAT WEAKER_STRIP_TAC THEN (REPEAT (FIRST_X_ASSUM MATCH_MP_TAC)) THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let re_eqvl_imp_le = prove_by_refinement( + `!a b. re_eqvl a b ==> (&0 <= a <=> &0 <= b)`, + (* {{{ proof *) + [ + TYPIFY `!a b. re_eqvl a b /\ &0 <= b ==> &0 <= a` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[Leaf_cell.RE_EQVL_SYM]); + REWRITE_TAC[Trigonometry2.re_eqvl]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LE_MUL; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let re_eqvl_real_sgn = prove_by_refinement( + `!x y. re_eqvl x y <=> real_sgn x = real_sgn y`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (TAUT `((a ==>b) /\ (b ==> a)) ==> (a = b)`); + REWRITE_TAC[Trigonometry2.re_eqvl]; + CONJ_TAC THEN REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[REAL_SGN_MUL;GSYM REAL_SGN_EQ;arith `&0 < t <=> t > &0`]; + BY(DISCH_THEN (unlist REWRITE_TAC) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[REAL_SGN]; + TYPIFY `x = &0` ASM_CASES_TAC; + ASM_REWRITE_TAC[arith `abs(&0) = &0`;arith `&0 / &0 = &0`;arith `&0 = x <=> x = &0`;REAL_DIV_EQ_0;REAL_ENTIRE;arith `abs y = &0 <=> y = &0`]; + BY(MESON_TAC[arith `&0 < &1`]); + DISCH_TAC; + TYPIFY `~(y = &0)` (C SUBGOAL_THEN ASSUME_TAC); + DISCH_TAC; + FIRST_X_ASSUM_ST `abs` MP_TAC; + BY(ASM_REWRITE_TAC[arith `&0 / t = &0`;REAL_DIV_EQ_0] THEN ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `x / y` EXISTS_TAC; + CONJ2_TAC; + Calc_derivative.CALC_ID_TAC; + BY(ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + REWRITE_TAC[Calc_derivative.invert_den_lt]; + REWRITE_TAC[REAL_MUL_POS_LT]; + FIRST_X_ASSUM_ST `abs` MP_TAC THEN REWRITE_TAC[GSYM REAL_SGN;real_sgn]; + RULE_ASSUM_TAC (REWRITE_RULE[arith `~(x = &0) <=> (&0 < x \/ x < &0) /\ ~(&0 < x /\ x < &0)`]); + ASSUME_TAC (arith ` ~(&1 = -- &1)`); + BY(REPEAT COND_CASES_TAC THEN ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let coplanar_delta_y_zero = prove_by_refinement( + `!(u0:real^3) u1 u2 u3. coplanar {u0, u1, u2, u3} <=> + delta_y (dist (u0,u1)) (dist (u0,u2)) (dist (u0,u3)) + (dist (u2,u3)) + (dist (u1,u3)) + (dist (u1,u2)) = &0`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[Terminal.DELTA_Y_POS_4POINTS;Oxlzlez.coplanar_delta_y;arith `&0 <= x ==> (~(&0 < x) <=> (x = &0))`]) + ]);; + (* }}} *) + +let real_continuous_finite_range_constant = prove_by_refinement( + `!f a b. f real_continuous_on (real_interval (a,b)) /\ FINITE (IMAGE f (real_interval (a,b))) ==> + (?c. !x. x IN real_interval (a,b) ==> f x = c)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `(?c. !x. x IN IMAGE lift (real_interval(a,b)) ==> ((lift o f o drop) x = c))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `drop c` EXISTS_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `IMAGE` (C INTRO_TAC [`lift x`]); + REWRITE_TAC[o_THM;LIFT_DROP]; + ANTS_TAC; + MATCH_MP_TAC FUN_IN_IMAGE; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN (SUBST1_TAC o GSYM); + BY(REWRITE_TAC[LIFT_DROP]); + MATCH_MP_TAC CONTINUOUS_FINITE_RANGE_CONSTANT; + CONJ_TAC; + ONCE_REWRITE_TAC[GSYM LIFT_DROP]; + REWRITE_TAC[GSYM INTERVAL_REAL_INTERVAL]; + BY(REWRITE_TAC[CONNECTED_INTERVAL]); + CONJ_TAC; + REWRITE_TAC[ETA_AX]; + BY(ASM_REWRITE_TAC[GSYM REAL_CONTINUOUS_ON]); + REWRITE_TAC[GSYM IMAGE_o;ETA_AX;GSYM o_ASSOC]; + TYPIFY_GOAL_THEN `!X. IMAGE (lift o f o drop o lift) X = IMAGE lift (IMAGE f (IMAGE (drop o lift) X))` (unlist REWRITE_TAC); + BY(REWRITE_TAC[GSYM IMAGE_o;GSYM o_ASSOC]); + REWRITE_TAC[IMAGE_LIFT_DROP]; + MATCH_MP_TAC FINITE_IMAGE; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let planar_deform_dist = prove_by_refinement( + `!(v0:real^3) v1 v2 f V e'. + v1 IN V /\ v2 IN V /\ ~(v0 = vec 0) /\ + &0 < e' /\ deformation f V (--e',e') /\ (!v t. ~(v =v1) /\ ~(v = v2) ==> f v t = v) /\ +(!t. abs t < e' + ==> coplanar {vec 0, v0, f v1 t, f v2 t} /\ + dist (v0,f v1 t) = dist (v0,v1) /\ + norm (f v1 t) = norm v1 /\ + dist (f v2 t,v0) = dist (v2,v0) /\ + norm (f v2 t) = norm v2) ==> + (!t. abs t < e' ==> dist(f v1 t,f v2 t) = dist(v1,v2)) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `f v1 (&0) = v1 /\ f v2 (&0) = v2` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation]; + BY(ASM_MESON_TAC[]); + TYPED_ABBREV_TAC `b = ((norm v0 * norm v0) * norm v0 * norm v0 + (norm v2 * norm v2 - dist (v0,v2) * dist (v0,v2)) * (norm v1 * norm v1 - dist (v0,v1) * dist (v0,v1)) - (norm v0 * norm v0) * (norm v1 * norm v1 + norm v2 * norm v2 + dist (v0,v2) * dist (v0,v2) + dist (v0,v1) * dist (v0,v1)))`; + TYPED_ABBREV_TAC `c = (norm v0 * norm v0) * (norm v2 * norm v2) * dist (v0,v2) * dist (v0,v2) + (norm v0 * norm v0) * (norm v1 * norm v1) * dist (v0,v1) * dist (v0,v1) - (norm v2 * norm v2) * (norm v0 * norm v0 + norm v1 * norm v1 - norm v2 * norm v2 + dist (v0,v2) * dist (v0,v2) - dist (v0,v1) * dist (v0,v1)) * dist (v0,v1) * dist (v0,v1) - (norm v1 * norm v1) * (dist (v0,v2) * dist (v0,v2)) * (norm v0 * norm v0 - norm v1 * norm v1 + norm v2 * norm v2 - dist (v0,v2) * dist (v0,v2) + dist (v0,v1) * dist (v0,v1))`; + TYPED_ABBREV_TAC `a = (norm v0 * norm v0)`; + INTRO_TAC quadratic_at_most_2_roots [`a`;`b`;`c`]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC real_continuous_finite_range_constant [`(\t. dist(f v1 t, f v2 t))`;`-- e'`;`e'`]; + ANTS_TAC; + CONJ_TAC; + GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT; + REWRITE_TAC[Ocbicby.REAL_OPEN_REAL_INTERVAL]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Local_lemmas1.CON_ATREAL_REAL_CON2_REDO; + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation;ETA_AX]; + BY(ASM_MESON_TAC[]); + TYPIFY `IMAGE (\t. dist (f v1 t,f v2 t) pow 2) (real_interval (--e',e')) SUBSET {x1,x2}` ENOUGH_TO_SHOW_TAC; + TYPIFY `FINITE {x1,x2}` ENOUGH_TO_SHOW_TAC; + TYPIFY_GOAL_THEN `!X. IMAGE (\t. dist (f v1 t,f v2 t) pow 2) X = IMAGE (\t. t pow 2) (IMAGE (\t. dist (f v1 t,f v2 t)) X)` (unlist REWRITE_TAC); + REWRITE_TAC[GSYM IMAGE_o]; + BY(GEN_TAC THEN AP_THM_TAC THEN AP_TERM_TAC THEN REWRITE_TAC[FUN_EQ_THM;o_THM]); + TYPED_ABBREV_TAC `s = (IMAGE (\t. dist (f v1 t,f v2 t)) (real_interval (--e',e')))`; + INTRO_TAC HAS_SIZE_IMAGE_INJ_EQ [`(\t. t pow 2)`;`s`;`CARD (IMAGE (\t. t pow 2) s)`]; + ANTS_TAC; + EXPAND_TAC "s"; + REWRITE_TAC[IN_IMAGE] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[GSYM REAL_EQ_SQUARE_ABS]; + REPEAT (GMATCH_SIMP_TAC (arith `&0 <= x ==> abs x = x`)); + BY(REWRITE_TAC[DIST_POS_LE]); + REWRITE_TAC[HAS_SIZE]; + BY(MESON_TAC[FINITE_SUBSET;FINITE_IMAGE]); + BY(REWRITE_TAC[FINITE_INSERT;FINITE_EMPTY]); + REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY;IN_IMAGE]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + CONJ_TAC; + EXPAND_TAC "a"; + REWRITE_TAC[REAL_ENTIRE]; + REWRITE_TAC[NORM_EQ_0]; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`x'`]); + ANTS_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[IN_REAL_INTERVAL;arith `-- e < t /\ t < e <=> abs t < e`]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `coplanar` MP_TAC THEN REWRITE_TAC[coplanar_delta_y_zero]; + REPEAT (FIRST_X_ASSUM_ST `dist` MP_TAC) THEN REWRITE_TAC[DIST_SYM;DIST_0] THEN REPEAT WEAKER_STRIP_TAC THEN (FIRST_X_ASSUM MP_TAC) THEN ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[arith `x = &0 <=> -- x = &0`]; + ASM_REWRITE_TAC[Sphere.delta_y;Nonlinear_lemma.delta_quadratic]; + BY(REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_ASSUM (C INTRO_TAC [`&0`]); + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + REWRITE_TAC[]; + REPEAT (DISCH_THEN GMATCH_SIMP_TAC); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN ASM_REWRITE_TAC[Localization.deformation;IN_REAL_INTERVAL;arith `--e < t /\ t < e <=> abs t < e`;arith `abs(&0) = &0`]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +(* +let deform_pent_exists = prove_by_refinement( + `!V g23 v0 v1 v2 v3 e. ?f. + ( + ( v1 IN V /\ v2 IN V /\ + (coplanar {vec 0,v0,v1,v2} ==> (v1 cross v0) dot (v2 cross v0) > &0) /\ + ~coplanar {vec 0,v0,v2,v3} /\ ~(collinear {vec 0,v1,v2}) /\ + &0 < azim (vec 0) v1 v2 v0 /\ azim (vec 0) v1 v2 v0 <= pi /\ + v2 dot (v3 cross v0) > &0 /\ + &0 < e /\ + g23 real_continuous_on (real_interval (--e,e)) /\ + g23 (&0) = &0 + ==> + (?e'. &0 < e' /\ deformation f V (-- e', e') /\ + (!v t. ~(v = v1) /\ ~(v = v2) ==> f v t = v) /\ + (!t. abs t < e' ==> + dist(v0,f v1 t) = dist(v0,v1) /\ + dist(f v2 t,f v1 t) = dist(v2,v1) /\ + norm(f v1 t) = norm(v1) /\ + dist (f v2 t,v0) = dist(v2,v0) /\ + dist (f v2 t,v3) = dist(v2,v3)+ g23 t /\ + norm(f v2 t) = norm (v2) + ))))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[MESON [] `(?f. a ==> P f) <=> (a ==> (?f. P f))`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~coplanar {vec 0,v0,v1,v2}` ASM_CASES_TAC; + INTRO_TAC Cuxvzoz.deform_684_pent_exists [`V`;`g23`;`v0`;`v1`;`v2`;`v3`;`e`]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `x > &0 <=> &0 <= x /\ ~(x = &0)`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ2_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `coplanar` MP_TAC) THEN REWRITE_TAC[GSYM Local_lemmas.CROSS_DOT_COPLANAR] THEN VEC3_TAC); + INTRO_TAC Trigonometry2.JBDNJJB [`v1`;`v2`;`v0`]; + TYPIFY `((v1 cross v2) dot v0) = v1 dot (v2 cross v0)` (C SUBGOAL_THEN SUBST1_TAC); + BY(VEC3_TAC); + ONCE_REWRITE_TAC[Leaf_cell.RE_EQVL_SYM]; + DISCH_THEN ((unlist REWRITE_TAC) o (MATCH_MP re_eqvl_imp_le)); + BY(ASM_MESON_TAC[Local_lemmas.SIN_AZIM_POS_PI_LT]); + REPEAT WEAKER_STRIP_TAC; + BY(GEXISTL_TAC [`f`;`e'`] THEN ASM_MESON_TAC[]); + COMMENT "planar case"; + INTRO_TAC Cuxvzoz.deform_planar_exists [`V`;`(\ (t:real). &0)`;`(\ (t:real). &0)`;`g23`;`v0`;`v1`;`v2`;`v3`;`e`]; + RULE_ASSUM_TAC(REWRITE_RULE[]); + REPEAT WEAKER_STRIP_TAC THEN FIRST_X_ASSUM MP_TAC THEN ASM_REWRITE_TAC[arith `x + &0 = x`]; + GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT THEN REWRITE_TAC[REAL_CONTINUOUS_CONST;Ocbicby.REAL_OPEN_REAL_INTERVAL]; + ANTS_TAC; + CONJ_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + BY(FIRST_X_ASSUM_ST `collinear` MP_TAC THEN MESON_TAC[COLLINEAR_2;SET_RULE `{a,b,b} = {a,b}`]); + REPEAT WEAKER_STRIP_TAC; + GEXISTL_TAC [`f`;`e'`] THEN ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(v0 = vec 0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[COPLANAR_3;SET_RULE `{a,a,b,c} = {a,b,c}`]); + INTRO_TAC planar_deform_dist [`v0`;`v1`;`v2`;`f`;`V`;`e'`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[DIST_SYM] THEN REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) +*) + +(* +let deform_pent_exists = prove_by_refinement( + `!V g23 v0 v1 v2 v3 e. ?f. + ( + ( v1 IN V /\ v2 IN V /\ + (coplanar {vec 0,v0,v1,v2} ==> (v1 cross v0) dot (v2 cross v0) > &0) /\ + ~coplanar {vec 0,v0,v2,v3} /\ ~(collinear {vec 0,v1,v2}) /\ + azim (vec 0) v1 v2 v0 <= pi /\ + v2 dot (v3 cross v0) > &0 /\ + &0 < e /\ + g23 real_continuous_on (real_interval (--e,e)) /\ + g23 (&0) = &0 + ==> + (?e'. &0 < e' /\ deformation f V (-- e', e') /\ + (!v t. ~(v = v1) /\ ~(v = v2) ==> f v t = v) /\ + (!t. abs t < e' ==> + dist(v0,f v1 t) = dist(v0,v1) /\ + dist(f v2 t,f v1 t) = dist(v2,v1) /\ + norm(f v1 t) = norm(v1) /\ + dist (f v2 t,v0) = dist(v2,v0) /\ + dist (f v2 t,v3) = dist(v2,v3)+ g23 t /\ + norm(f v2 t) = norm (v2) + ))))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[MESON [] `(?f. a ==> P f) <=> (a ==> (?f. P f))`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~coplanar {vec 0,v0,v1,v2}` ASM_CASES_TAC; + INTRO_TAC Cuxvzoz.deform_684_pent_exists [`V`;`g23`;`v0`;`v1`;`v2`;`v3`;`e`]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `x > &0 <=> &0 <= x /\ ~(x = &0)`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ2_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `coplanar` MP_TAC) THEN REWRITE_TAC[GSYM Local_lemmas.CROSS_DOT_COPLANAR] THEN VEC3_TAC); + INTRO_TAC Trigonometry2.JBDNJJB [`v1`;`v2`;`v0`]; + TYPIFY `((v1 cross v2) dot v0) = v1 dot (v2 cross v0)` (C SUBGOAL_THEN SUBST1_TAC); + BY(VEC3_TAC); + ONCE_REWRITE_TAC[Leaf_cell.RE_EQVL_SYM]; + DISCH_THEN ((unlist REWRITE_TAC) o (MATCH_MP re_eqvl_imp_le)); + BY(ASM_MESON_TAC[Local_lemmas.SIN_AZIM_POS_PI_LT]); + REPEAT WEAKER_STRIP_TAC; + BY(GEXISTL_TAC [`f`;`e'`] THEN ASM_MESON_TAC[]); + COMMENT "planar case"; + INTRO_TAC Cuxvzoz.deform_planar_exists [`V`;`(\ (t:real). &0)`;`(\ (t:real). &0)`;`g23`;`v0`;`v1`;`v2`;`v3`;`e`]; + RULE_ASSUM_TAC(REWRITE_RULE[]); + REPEAT WEAKER_STRIP_TAC THEN FIRST_X_ASSUM MP_TAC THEN ASM_REWRITE_TAC[arith `x + &0 = x`]; + GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT THEN REWRITE_TAC[REAL_CONTINUOUS_CONST;Ocbicby.REAL_OPEN_REAL_INTERVAL]; + ANTS_TAC; + CONJ_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + BY(FIRST_X_ASSUM_ST `collinear` MP_TAC THEN MESON_TAC[COLLINEAR_2;SET_RULE `{a,b,b} = {a,b}`]); + REPEAT WEAKER_STRIP_TAC; + GEXISTL_TAC [`f`;`e'`] THEN ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(v0 = vec 0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[COPLANAR_3;SET_RULE `{a,a,b,c} = {a,b,c}`]); + INTRO_TAC planar_deform_dist [`v0`;`v1`;`v2`;`f`;`V`;`e'`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[DIST_SYM] THEN REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) +*) + +let deform_pent_exists = prove_by_refinement( + `!V g23 v0 v1 v2 v3 e. ?f. + v1 IN V /\ v2 IN V /\ + (coplanar {vec 0,v0,v1,v2} ==> (v1 cross v0) dot (v2 cross v0) > &0) /\ + ~coplanar {vec 0,v0,v2,v3} /\ ~(collinear {vec 0,v1,v2}) /\ + azim (vec 0) v1 v2 v0 <= pi /\ + v2 dot (v3 cross v0) > &0 /\ + &0 < e /\ + g23 real_continuous_on (real_interval (--e,e)) /\ + g23 (&0) = &0 + ==> + (?e'. &0 < e' /\ deformation f V (-- e', e') /\ + (!v t. ~(v = v1) /\ ~(v = v2) ==> f v t = v) /\ + (!t. abs t < e' ==> + dist(v0,f v1 t) = dist(v0,v1) /\ + dist(f v2 t,f v1 t) = dist(v2,v1) /\ + norm(f v1 t) = norm(v1) /\ + dist (f v2 t,v0) = dist(v2,v0) /\ + dist (f v2 t,v3) = dist(v2,v3)+ g23 t /\ + norm(f v2 t) = norm (v2) /\ + (coplanar {vec 0,v0,v1,v2} ==> coplanar {vec 0,v0,f v1 t,f v2 t}) + ))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[MESON [] `(?f. a ==> P f) <=> (a ==> (?f. P f))`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~coplanar {vec 0,v0,v1,v2}` ASM_CASES_TAC; + INTRO_TAC Cuxvzoz.deform_684_pent_exists [`V`;`g23`;`v0`;`v1`;`v2`;`v3`;`e`]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `x > &0 <=> &0 <= x /\ ~(x = &0)`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ2_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `coplanar` MP_TAC) THEN REWRITE_TAC[GSYM Local_lemmas.CROSS_DOT_COPLANAR] THEN VEC3_TAC); + INTRO_TAC Trigonometry2.JBDNJJB [`v1`;`v2`;`v0`]; + TYPIFY `((v1 cross v2) dot v0) = v1 dot (v2 cross v0)` (C SUBGOAL_THEN SUBST1_TAC); + BY(VEC3_TAC); + ONCE_REWRITE_TAC[Leaf_cell.RE_EQVL_SYM]; + DISCH_THEN ((unlist REWRITE_TAC) o (MATCH_MP re_eqvl_imp_le)); + BY(ASM_MESON_TAC[Local_lemmas.SIN_AZIM_POS_PI_LT]); + REPEAT WEAKER_STRIP_TAC; + BY(GEXISTL_TAC [`f`;`e'`] THEN ASM_MESON_TAC[]); + COMMENT "planar case"; + INTRO_TAC Cuxvzoz.deform_planar_exists [`V`;`(\ (t:real). &0)`;`(\ (t:real). &0)`;`g23`;`v0`;`v1`;`v2`;`v3`;`e`]; + RULE_ASSUM_TAC(REWRITE_RULE[]); + REPEAT WEAKER_STRIP_TAC THEN FIRST_X_ASSUM MP_TAC THEN ASM_REWRITE_TAC[arith `x + &0 = x`]; + GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT THEN REWRITE_TAC[REAL_CONTINUOUS_CONST;Ocbicby.REAL_OPEN_REAL_INTERVAL]; + ANTS_TAC; + CONJ_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + BY(FIRST_X_ASSUM_ST `collinear` MP_TAC THEN MESON_TAC[COLLINEAR_2;SET_RULE `{a,b,b} = {a,b}`]); + REPEAT WEAKER_STRIP_TAC; + GEXISTL_TAC [`f`;`e'`] THEN ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(v0 = vec 0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[COPLANAR_3;SET_RULE `{a,a,b,c} = {a,b,c}`]); + INTRO_TAC planar_deform_dist [`v0`;`v1`;`v2`;`f`;`V`;`e'`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[DIST_SYM] THEN REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +(* +let EGHNAVX_SCS = prove_by_refinement( + `!s k v p. + (let bta = (\j. azim (vec 0) (v p) (v (p+1)) (v (p+j))) in + ( is_scs_v39 s /\ scs_k_v39 s = k /\ + 3 < k /\ + BBs_v39 s v /\ + scs_basic_v39 s /\ + scs_generic v ==> + bta 1 = &0 /\ + bta (k - 1) <= pi /\ + (!i j. i < j /\ j < k ==> bta i <= bta j) /\ + (!q j. bta q = &0 /\ 0 < j /\ j <= q /\ q < k + ==> (j azim (vec 0) (v (p+j)) (v (p+j+1)) (v (p+j+k-1)) = pi) /\ + v (p+j) IN aff_gt {vec 0,v p} {v (p+1)}) /\ + (!q j. bta q = bta (k - 1) /\ 0 < q /\ q < k - 1 /\ q <= j /\ j < k + ==> (q < j ==> azim (vec 0) (v (p+j)) (v (p+j+1)) (v(p+j+k-1)) = pi) /\ + v(p+j) IN aff_gt {vec 0, v p} {v (p + k - 1)})))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + LET_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `FF = IMAGE (\i. (v i,v (SUC i))) (:num)`; + TYPED_ABBREV_TAC `V = IMAGE v (:num)`; + TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`; + INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`k`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `periodic v k /\ convex_local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN ASM_MESON_TAC[arith `3 < k ==> ~(k<= 3)`]); + INTRO_TAC Terminal.ITER_vv_rho_node1 [`v`;`k`]; + ASM_REWRITE_TAC[LET_THM]; + TYPIFY_GOAL_THEN `3 <= k` (unlist REWRITE_TAC); + BY(ASM_MESON_TAC[arith `3 < k ==> 3 <= k`]); + DISCH_TAC; + INTRO_TAC (GEN_ALL Odxlstcv2.CARD_V_EQ_SCS_K1) [`s`;`v`;`V`;`k`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + EXPAND_TAC "V"; + MATCH_MP_TAC FUN_IN_IMAGE; + BY(REWRITE_TAC[IN_UNIV]); + TYPIFY `!i j. ~(v i = v j) ==> ~collinear {vec 0, v i, v j}` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC Nkezbfc_local.PROPERTIES_GENERIC_LOCAL_FAN [`V`;`E`;`FF`]; + BY(ASM_MESON_TAC[Appendix.scs_generic]); + INTRO_TAC (GENL [`v0:real^3`;`vv:num->real^3`;`i:num`] Local_lemmas.EGHNAVX) [`v p`;`\ (i:num). v (p + i)`]; + REWRITE_TAC[RIGHT_FORALL_IMP_THM;GSYM RIGHT_AND_FORALL_THM]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?i'. v' = v i'` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM_ST `IN` MP_TAC; + EXPAND_TAC "V"; + BY(REWRITE_TAC[IN_IMAGE;IN_UNIV]); + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[]); + EXPAND_TAC "bta"; + BY(REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC (GSYM Ocbicby.INTERIOR_ANGLE1_AZIM) [`s`;`v`]; + ASM_REWRITE_TAC[LET_THM]; + TYPIFY_GOAL_THEN `v IN BBs_v39 s` (unlist REWRITE_TAC); + BY(ASM_REWRITE_TAC[IN]); + DISCH_TAC; + COMMENT "first conjunct"; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `SUBSET` (C INTRO_TAC [`q`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + DISCH_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`j`]); + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[arith `SUC (p+j) = p+j+1 /\ ((p+j) + k - 1 = p+j+k-1)`]); + FIRST_X_ASSUM kill; + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[SUBSET;IN_ELIM_THM]; + DISCH_THEN (C INTRO_TAC [`v (p+(j:num))`]); + DISCH_THEN MATCH_MP_TAC; + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `SUBSET` (C INTRO_TAC [`q`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + DISCH_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`j`]); + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[arith `SUC (p+j) = p+j+1 /\ ((p+j) + k - 1 = p+j+k-1)`]); + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[SUBSET;IN_ELIM_THM]; + DISCH_THEN (C INTRO_TAC [`v (p+(j:num))`]); + DISCH_THEN MATCH_MP_TAC; + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]) + ]);; + (* }}} *) +*) + +let EGHNAVX_COLL_SCS = prove_by_refinement( + `!s k v p. + (let bta = (\j. azim (vec 0) (v p) (v (p+1)) (v (p+j))) in + ( is_scs_v39 s /\ scs_k_v39 s = k /\ + 3 < k /\ + BBs_v39 s v /\ + scs_basic_v39 s /\ + (!i. ~(v i = v p) ==> ~collinear {vec 0,v p,v i}) + ==> + bta 1 = &0 /\ + bta (k - 1) <= pi /\ + (!i j. i < j /\ j < k ==> bta i <= bta j) /\ + (!q j. bta q = &0 /\ 0 < j /\ j <= q /\ q < k + ==> (j azim (vec 0) (v (p+j)) (v (p+j+1)) (v (p+j+k-1)) = pi) /\ + v (p+j) IN aff_gt {vec 0,v p} {v (p+1)}) /\ + (!q j. bta q = bta (k - 1) /\ 0 < q /\ q < k - 1 /\ q <= j /\ j < k + ==> (q < j ==> azim (vec 0) (v (p+j)) (v (p+j+1)) (v(p+j+k-1)) = pi) /\ + v(p+j) IN aff_gt {vec 0, v p} {v (p + k - 1)})))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + LET_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `FF = IMAGE (\i. (v i,v (SUC i))) (:num)`; + TYPED_ABBREV_TAC `V = IMAGE v (:num)`; + TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`; + INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`k`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `periodic v k /\ convex_local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN ASM_MESON_TAC[arith `3 < k ==> ~(k<= 3)`]); + INTRO_TAC Terminal.ITER_vv_rho_node1 [`v`;`k`]; + ASM_REWRITE_TAC[LET_THM]; + TYPIFY_GOAL_THEN `3 <= k` (unlist REWRITE_TAC); + BY(ASM_MESON_TAC[arith `3 < k ==> 3 <= k`]); + DISCH_TAC; + INTRO_TAC (GEN_ALL Odxlstcv2.CARD_V_EQ_SCS_K1) [`s`;`v`;`V`;`k`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + EXPAND_TAC "V"; + MATCH_MP_TAC FUN_IN_IMAGE; + BY(REWRITE_TAC[IN_UNIV]); + INTRO_TAC (GENL [`v0:real^3`;`vv:num->real^3`;`i:num`] Local_lemmas.EGHNAVX) [`v p`;`\ (i:num). v (p + i)`]; + REWRITE_TAC[RIGHT_FORALL_IMP_THM;GSYM RIGHT_AND_FORALL_THM]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + CONJ_TAC; + EXPAND_TAC "V"; + (REWRITE_TAC[IN_IMAGE;IN_UNIV]); + BY(ASM_MESON_TAC[]); + EXPAND_TAC "bta"; + BY(REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC (GSYM Ocbicby.INTERIOR_ANGLE1_AZIM) [`s`;`v`]; + ASM_REWRITE_TAC[LET_THM]; + TYPIFY_GOAL_THEN `v IN BBs_v39 s` (unlist REWRITE_TAC); + BY(ASM_REWRITE_TAC[IN]); + DISCH_TAC; + COMMENT "first conjunct"; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `SUBSET` (C INTRO_TAC [`q`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + DISCH_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`j`]); + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[arith `SUC (p+j) = p+j+1 /\ ((p+j) + k - 1 = p+j+k-1)`]); + FIRST_X_ASSUM kill; + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[SUBSET;IN_ELIM_THM]; + DISCH_THEN (C INTRO_TAC [`v (p+(j:num))`]); + DISCH_THEN MATCH_MP_TAC; + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `SUBSET` (C INTRO_TAC [`q`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + DISCH_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`j`]); + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[arith `SUC (p+j) = p+j+1 /\ ((p+j) + k - 1 = p+j+k-1)`]); + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[SUBSET;IN_ELIM_THM]; + DISCH_THEN (C INTRO_TAC [`v (p+(j:num))`]); + DISCH_THEN MATCH_MP_TAC; + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]) + ]);; + (* }}} *) + +let EGHNAVX_SCS = prove_by_refinement( + `!s k v p. + (let bta = (\j. azim (vec 0) (v p) (v (p+1)) (v (p+j))) in + ( is_scs_v39 s /\ scs_k_v39 s = k /\ + 3 < k /\ + BBs_v39 s v /\ + scs_basic_v39 s /\ + scs_generic v ==> + bta 1 = &0 /\ + bta (k - 1) <= pi /\ + (!i j. i < j /\ j < k ==> bta i <= bta j) /\ + (!q j. bta q = &0 /\ 0 < j /\ j <= q /\ q < k + ==> (j azim (vec 0) (v (p+j)) (v (p+j+1)) (v (p+j+k-1)) = pi) /\ + v (p+j) IN aff_gt {vec 0,v p} {v (p+1)}) /\ + (!q j. bta q = bta (k - 1) /\ 0 < q /\ q < k - 1 /\ q <= j /\ j < k + ==> (q < j ==> azim (vec 0) (v (p+j)) (v (p+j+1)) (v(p+j+k-1)) = pi) /\ + v(p+j) IN aff_gt {vec 0, v p} {v (p + k - 1)})))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_THM]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (REWRITE_RULE[LET_THM] EGHNAVX_COLL_SCS); + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `scs_generic` MP_TAC; + REWRITE_TAC[Appendix.scs_generic]; + DISCH_TAC; + TYPED_ABBREV_TAC `FF = IMAGE (\i. (v i,v (SUC i))) (:num)`; + TYPED_ABBREV_TAC `V = IMAGE v (:num)`; + TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`; + TYPIFY `convex_local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN ASM_MESON_TAC[arith `3 < k ==> ~(k<= 3)`]); + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + EXPAND_TAC "V"; + MATCH_MP_TAC FUN_IN_IMAGE; + BY(REWRITE_TAC[IN_UNIV]); + BY(ASM_MESON_TAC[Nkezbfc_local.PROPERTIES_GENERIC_LOCAL_FAN]) + ]);; + (* }}} *) + +let coplanar_cross_reduction = prove_by_refinement( + `!s k v i. + is_scs_v39 s /\ scs_k_v39 s = k /\ + 3 < k /\ + MMs_v39 s v /\ + scs_basic_v39 s /\ + scs_generic v /\ + coplanar {vec 0,v i, v(i+1),v(i+2)} ==> + (v(i+1) cross v i) dot (v(i+2) cross v i) > &0`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(k=0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + TYPED_ABBREV_TAC `FF = IMAGE (\i. (v i,v (SUC i))) (:num)`; + TYPED_ABBREV_TAC `V = IMAGE v (:num)`; + TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`; + FIRST_ASSUM_ST `coplanar` MP_TAC; + REWRITE_TAC[GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; + DISCH_TAC; + TYPIFY `~coplanar ({vec 0} UNION V)` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "V"; + MATCH_MP_TAC Fektyiy.FEKTYIY; + TYPIFY `s` EXISTS_TAC; + BY(ASM_REWRITE_TAC[IN]); + TYPIFY `BBprime2_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.scs_basic;Ayqjtmd.unadorned_MMs]); + TYPIFY `BBprime_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime2_v39]); + TYPIFY `BBs_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime_v39]); + INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`k`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `periodic v k /\ convex_local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN ASM_MESON_TAC[arith `3 < k ==> ~(k<= 3)`]); + INTRO_TAC Terminal.ITER_vv_rho_node1 [`v`;`k`]; + ASM_REWRITE_TAC[LET_THM]; + ASM_SIMP_TAC[arith `3 < k ==> 3 <= k`]; + DISCH_TAC; + INTRO_TAC (GEN_ALL Odxlstcv2.CARD_V_EQ_SCS_K1) [`s`;`v`;`V`;`k`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + EXPAND_TAC "V"; + MATCH_MP_TAC FUN_IN_IMAGE; + BY(REWRITE_TAC[IN_UNIV]); + TYPIFY `!i j. ~(v i = v j) ==> ~collinear {vec 0, v i, v j}` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC Nkezbfc_local.PROPERTIES_GENERIC_LOCAL_FAN [`V`;`E`;`FF`]; + BY(ASM_MESON_TAC[Appendix.scs_generic]); + INTRO_TAC EGHNAVX_SCS [`s`;`k`;`v`;`i`]; + REWRITE_TAC[LET_THM]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "insert here"; + TYPIFY `!a. 0 < a /\ (a:num) < k ==> ~(v i = v (i+a))` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `!i. v (i MOD k) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_MESON_TAC[arith `3 < k ==> ~(0=k)`]); + FIRST_X_ASSUM ((unlist ONCE_REWRITE_TAC) o GSYM); + GEN_TAC THEN DISCH_TAC; + TYPIFY_GOAL_THEN `!i j. i < k /\ j < (k:num) /\ ~(i = j) ==> ~(v i = v j)` MATCH_MP_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[CONJ_ASSOC] THEN CONJ_TAC; + BY(ASM_MESON_TAC[DIVISION]); + TYPIFY `i MOD k = (i+0) MOD k` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[arith `i + 0 = i`]); + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + REPEAT (GMATCH_SIMP_TAC MOD_LT); + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN FIRST_X_ASSUM MP_TAC THEN ARITH_TAC); + FIRST_X_ASSUM DISJ_CASES_TAC; + FIRST_X_ASSUM_ST `&0` (C INTRO_TAC [`2`;`2`]); + ASM_REWRITE_TAC[arith `0 < 2 /\ 2 <= 2 /\ ~(2 < 2)`]; + ANTS_TAC; + BY(MATCH_MP_TAC (arith `3 < k ==> 2 < k`) THEN ASM_REWRITE_TAC[]); + GMATCH_SIMP_TAC Local_lemmas1.COLL_AFF_GT_2_1; + SUBCONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + DISCH_TAC; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[CROSS_LMUL;CROSS_LADD;DOT_RMUL;DOT_RADD;CROSS_LZERO;DOT_RZERO;CROSS_REFL]; + REWRITE_TAC[arith `t1 * &0 + x = x`;arith `x > &0 <=> &0 < x`]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_REWRITE_TAC[]; + REWRITE_TAC[DOT_POS_LT]; + REWRITE_TAC[CROSS_EQ_0]; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`]; + BY(ASM_REWRITE_TAC[]); + COMMENT "second conj"; + FIRST_X_ASSUM_ST `azim` (C INTRO_TAC [`2`]); + FIRST_X_ASSUM_ST `aff_gt` kill; + FIRST_X_ASSUM_ST `0 < a` MP_TAC THEN BURY_MP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`2`;`k-1`]); + ANTS_TAC; + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + DISCH_TAC; + TYPIFY_GOAL_THEN `azim (vec 0) (v i) (v (i + 1)) (v (i + 2)) = azim (vec 0) (v i) (v (i + 1)) (v (i + k - 1))` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + DISCH_TAC; + PROOF_BY_CONTR_TAC; + TYPIFY `V SUBSET affine hull {vec 0,v i,v (i+k-1)}` ENOUGH_TO_SHOW_TAC; + DISCH_TAC THEN FIRST_X_ASSUM_ST `coplanar` MP_TAC THEN REWRITE_TAC[coplanar]; + GEXISTL_TAC [`(vec 0):real^3`;`v i`;`v (i+k-1)`]; + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[SUBSET;IN_UNION;IN_SING]; + TYPIFY `vec 0 IN affine hull {vec 0,v i ,v(i+k-1)}` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[]); + MATCH_MP_TAC Marchal_cells_2_new.IN_AFFINE_KY_LEMMA1; + BY(SET_TAC[]); + TYPIFY `!w. w IN IMAGE v (i..i + k - 1) ==> w IN affine hull {vec 0,v i , v(i+k-1)}` ENOUGH_TO_SHOW_TAC; + GMATCH_SIMP_TAC (GSYM Oxl_2012.PERIODIC_IMAGE_EQUAL); + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC Oxl_def.periodic_numseg [`(\j. v j IN affine hull {vec 0,v i,v (i+k-1)})`;`k`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + CONJ_TAC; + FIRST_X_ASSUM_ST `periodic` MP_TAC THEN REWRITE_TAC[Oxl_def.periodic]; + BY(MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + MATCH_MP_TAC FUN_IN_IMAGE; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + EXPAND_TAC "V"; + REWRITE_TAC[IMAGE;IN_UNIV;SUBSET;IN_ELIM_THM]; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + REWRITE_TAC[IN_IMAGE;IN_NUMSEG]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `?j. 0 <= j /\ j < k /\ x = i + j` (C SUBGOAL_THEN MP_TAC); + TYPIFY `x - (i:num)` EXISTS_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `!j. 2 <= j /\ j < k==> v (i + j) IN affine hull {vec 0,v i, v(i+k-1)}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`j'`]); + ANTS_TAC; + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + TYPIFY `aff_gt {vec 0,v i} {v (i+k-1)} SUBSET affine hull {vec 0,v i,v (i+k-1)}` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + TYPIFY `{vec 0,v i,v (i+k-1)} = {vec 0,v i} UNION {v (i+k-1)}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(REWRITE_TAC[ AFF_GT_SUBSET_AFFINE_HULL]); + TYPIFY `{vec 0,v i, v (i+2)} SUBSET affine hull {vec 0, v i, v (i+k-1)}` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC Marchal_cells_2_new.IN_AFFINE_KY_LEMMA1; + BY(SET_TAC[]); + MATCH_MP_TAC Marchal_cells_2_new.IN_AFFINE_KY_LEMMA1; + BY(SET_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + INTRO_TAC AFFINE_HULL_3_GENERATED [`{vec 0, v i, v (i + 2)}`;`(vec 0):real^3`;`v i`;`v (i+k-1)`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + DISCH_TAC; + ASSUME_TAC (arith ` 2 <= j \/ j = 0 \/ j = 1` ); + REPEAT (POP_ASSUM DISJ_CASES_TAC); + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[arith `i + 0 = i`] THEN MATCH_MP_TAC Marchal_cells_2_new.IN_AFFINE_KY_LEMMA1; + BY(SET_TAC[]); + ASM_REWRITE_TAC[]; + (FIRST_X_ASSUM_ST `coplanar (a INSERT X)` MP_TAC); + REWRITE_TAC[coplanar] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC AFFINE_HULL_3_GENERATED [`{vec 0, v i, v (i + 2)}`;`u`;`v'`;`w'`]; + ANTS_TAC; + CONJ_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN SET_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN SET_TAC[]) + ]);; + (* }}} *) + +let coplanar_aff_gt_simple = prove_by_refinement( + `!s k v i. + is_scs_v39 s /\ scs_k_v39 s = k /\ + 3 < k /\ + MMs_v39 s v /\ + scs_basic_v39 s /\ + (!j. ~(v j = v i) ==> ~collinear {vec 0,v i,v j}) /\ + coplanar {vec 0,v i, v(i+1),v(i+2)} ==> + v (i+1) IN aff_gt {vec 0} {v i, v(i+2)}`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(k=0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + TYPED_ABBREV_TAC `FF = IMAGE (\i. (v i,v (SUC i))) (:num)`; + TYPED_ABBREV_TAC `V = IMAGE v (:num)`; + TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`; + FIRST_ASSUM_ST `coplanar` MP_TAC; + REWRITE_TAC[GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; + DISCH_TAC; + TYPIFY `~coplanar ({vec 0} UNION V)` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "V"; + MATCH_MP_TAC Fektyiy.FEKTYIY; + TYPIFY `s` EXISTS_TAC; + BY(ASM_REWRITE_TAC[IN]); + TYPIFY `BBprime2_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.scs_basic;Ayqjtmd.unadorned_MMs]); + TYPIFY `BBprime_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime2_v39]); + TYPIFY `BBs_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime_v39]); + INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`k`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `periodic v k /\ convex_local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN ASM_MESON_TAC[arith `3 < k ==> ~(k<= 3)`]); + INTRO_TAC Terminal.ITER_vv_rho_node1 [`v`;`k`]; + ASM_REWRITE_TAC[LET_THM]; + ASM_SIMP_TAC[arith `3 < k ==> 3 <= k`]; + DISCH_TAC; + INTRO_TAC (GEN_ALL Odxlstcv2.CARD_V_EQ_SCS_K1) [`s`;`v`;`V`;`k`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + EXPAND_TAC "V"; + MATCH_MP_TAC FUN_IN_IMAGE; + BY(REWRITE_TAC[IN_UNIV]); + INTRO_TAC EGHNAVX_COLL_SCS [`s`;`k`;`v`;`i`]; + REWRITE_TAC[LET_THM]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!a. 0 < a /\ (a:num) < k ==> ~(v i = v (i+a))` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `!i. v (i MOD k) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_MESON_TAC[arith `3 < k ==> ~(0=k)`]); + FIRST_X_ASSUM ((unlist ONCE_REWRITE_TAC) o GSYM); + GEN_TAC THEN DISCH_TAC; + TYPIFY_GOAL_THEN `!i j. i < k /\ j < (k:num) /\ ~(i = j) ==> ~(v i = v j)` MATCH_MP_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[CONJ_ASSOC] THEN CONJ_TAC; + BY(ASM_MESON_TAC[DIVISION]); + TYPIFY `i MOD k = (i+0) MOD k` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[arith `i + 0 = i`]); + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + REPEAT (GMATCH_SIMP_TAC MOD_LT); + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN FIRST_X_ASSUM MP_TAC THEN ARITH_TAC); + FIRST_X_ASSUM DISJ_CASES_TAC; + FIRST_X_ASSUM_ST `&0` (C INTRO_TAC [`2`;`2`]); + NUM_REDUCE_TAC; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(MATCH_MP_TAC (arith `3 < k ==> 2 < k`) THEN ASM_REWRITE_TAC[]); + GMATCH_SIMP_TAC Local_lemmas1.COLL_AFF_GT_2_1; + GMATCH_SIMP_TAC AFF_GT_1_2; + REWRITE_TAC[IN_ELIM_THM;arith `t % vec 0 + a = a`]; + SUBCONJ_TAC; + ONCE_REWRITE_TAC[DISJOINT_SYM]; + MATCH_MP_TAC Fan.th3a; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {c,a,b}`] THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC); + ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + DISCH_TAC; + CONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + GEXISTL_TAC [`&1 + t2 / t3 - &1 / t3`;`-- t2 / t3`;`&1 / t3`]; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_DIV; + GMATCH_SIMP_TAC REAL_LT_DIV; + ASM_REWRITE_TAC[arith `&0 < &1`]; + nCONJ_TAC 2; + TYPIFY `--t2 / t3 % v i + &1 / t3 % (t2 % v i + t3 % v (i + 1)) = (-- t2 / t3 + (&1 / t3) * t2) % v i + ((&1 / t3)*t3) % v (i+1) ` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + TYPIFY_GOAL_THEN `(--t2 / t3 + &1 / t3 * t2) = &0 /\ (&1 / t3 * t3 = &1)` (unlist REWRITE_TAC); + BY(CONJ_TAC THEN Calc_derivative.CALC_ID_TAC THEN (REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC)) THEN REAL_ARITH_TAC); + BY(VECTOR_ARITH_TAC); + nCONJ_TAC 1; + BY(Calc_derivative.CALC_ID_TAC THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `~(&0 <= t2)` ENOUGH_TO_SHOW_TAC; + BY(REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN MESON_TAC[arith `~(&0 <= t2) ==> &0 < -- t2`]); + DISCH_TAC; + INTRO_TAC (GEN_ALL Local_lemmas.FAN_IN_AFF_GE_IMP_EQ) [`V`;`E`;`(vec 0):real^3`;`v i`;`v (i+2)`;`v (i+1)`]; + ANTS_TAC; + CONJ_TAC; + MATCH_MP_TAC Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN; + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + EXPAND_TAC "V"; + MATCH_MP_TAC FUN_IN_IMAGE; + BY(REWRITE_TAC[IN_UNIV]); + CONJ_TAC; + EXPAND_TAC "E"; + BY(REWRITE_TAC[arith `i+1 = SUC i`;IN_IMAGE;IN_UNIV] THEN MESON_TAC[]); + GMATCH_SIMP_TAC AFF_GE_1_2; + REWRITE_TAC[IN_ELIM_THM]; + CONJ_TAC; + ONCE_REWRITE_TAC[DISJOINT_SYM]; + MATCH_MP_TAC Fan.th3a; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {c,a,b}`] THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC); + ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + GEXISTL_TAC [`t1`;`t2`;`t3`]; + FIRST_X_ASSUM_ST `i+2` SUBST1_TAC; + REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; + BY(VECTOR_ARITH_TAC); + BY(REPLICATE_TAC 6 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REWRITE_TAC[DE_MORGAN_THM]; + CONJ_TAC; + ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + MATCH_MP_TAC Hypermap_iso.fan_in_e_imp_neq; + GEXISTL_TAC [`V`;`E`]; + CONJ_TAC; + MATCH_MP_TAC Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN; + BY(ASM_REWRITE_TAC[]); + EXPAND_TAC "E"; + BY(REWRITE_TAC[arith `i+2 = SUC (i+1)`;IN_IMAGE;IN_UNIV] THEN MESON_TAC[]); + COMMENT "second disj"; + FIRST_X_ASSUM_ST `azim` (C INTRO_TAC [`2`]); + FIRST_X_ASSUM_ST `aff_gt` kill; + FIRST_X_ASSUM_ST `0 < a` MP_TAC THEN BURY_MP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`2`;`k-1`]); + ANTS_TAC; + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + DISCH_TAC; + TYPIFY_GOAL_THEN `azim (vec 0) (v i) (v (i + 1)) (v (i + 2)) = azim (vec 0) (v i) (v (i + 1)) (v (i + k - 1))` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + DISCH_TAC; + PROOF_BY_CONTR_TAC; + TYPIFY `V SUBSET affine hull {vec 0,v i,v (i+k-1)}` ENOUGH_TO_SHOW_TAC; + DISCH_TAC THEN FIRST_X_ASSUM_ST `coplanar` MP_TAC THEN REWRITE_TAC[coplanar]; + GEXISTL_TAC [`(vec 0):real^3`;`v i`;`v (i+k-1)`]; + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[SUBSET;IN_UNION;IN_SING]; + TYPIFY `vec 0 IN affine hull {vec 0,v i ,v(i+k-1)}` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[]); + MATCH_MP_TAC Marchal_cells_2_new.IN_AFFINE_KY_LEMMA1; + BY(SET_TAC[]); + TYPIFY `!w. w IN IMAGE v (i..i + k - 1) ==> w IN affine hull {vec 0,v i , v(i+k-1)}` ENOUGH_TO_SHOW_TAC; + GMATCH_SIMP_TAC (GSYM Oxl_2012.PERIODIC_IMAGE_EQUAL); + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC Oxl_def.periodic_numseg [`(\j. v j IN affine hull {vec 0,v i,v (i+k-1)})`;`k`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + CONJ_TAC; + FIRST_X_ASSUM_ST `periodic` MP_TAC THEN REWRITE_TAC[Oxl_def.periodic]; + BY(MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + MATCH_MP_TAC FUN_IN_IMAGE; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + EXPAND_TAC "V"; + REWRITE_TAC[IMAGE;IN_UNIV;SUBSET;IN_ELIM_THM]; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + REWRITE_TAC[IN_IMAGE;IN_NUMSEG]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `?j. 0 <= j /\ j < k /\ x = i + j` (C SUBGOAL_THEN MP_TAC); + TYPIFY `x - (i:num)` EXISTS_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `!j. 2 <= j /\ j < k==> v (i + j) IN affine hull {vec 0,v i, v(i+k-1)}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`j'`]); + ANTS_TAC; + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + TYPIFY `aff_gt {vec 0,v i} {v (i+k-1)} SUBSET affine hull {vec 0,v i,v (i+k-1)}` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + TYPIFY `{vec 0,v i,v (i+k-1)} = {vec 0,v i} UNION {v (i+k-1)}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(REWRITE_TAC[ AFF_GT_SUBSET_AFFINE_HULL]); + TYPIFY `{vec 0,v i, v (i+2)} SUBSET affine hull {vec 0, v i, v (i+k-1)}` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC Marchal_cells_2_new.IN_AFFINE_KY_LEMMA1; + BY(SET_TAC[]); + MATCH_MP_TAC Marchal_cells_2_new.IN_AFFINE_KY_LEMMA1; + BY(SET_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + INTRO_TAC AFFINE_HULL_3_GENERATED [`{vec 0, v i, v (i + 2)}`;`(vec 0):real^3`;`v i`;`v (i+k-1)`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + INTRO_TAC AFFINE_HULL_3_GENERATED [`{vec 0, v i, v (i + 2)}`;`(vec 0):real^3`;`v i`;`v (i+k-1)`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + DISCH_TAC; + ASSUME_TAC (arith ` 2 <= j \/ j = 0 \/ j = 1` ); + REPEAT (POP_ASSUM DISJ_CASES_TAC); + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[arith `i + 0 = i`] THEN MATCH_MP_TAC Marchal_cells_2_new.IN_AFFINE_KY_LEMMA1; + BY(SET_TAC[]); + ASM_REWRITE_TAC[]; + (FIRST_X_ASSUM_ST `coplanar (a INSERT X)` MP_TAC); + REWRITE_TAC[coplanar] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC AFFINE_HULL_3_GENERATED [`{vec 0, v i, v (i + 2)}`;`u`;`v'`;`w'`]; + ANTS_TAC; + CONJ_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN SET_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN SET_TAC[]) + ]);; + (* }}} *) + +(* +let a5_assumption_reduction = prove_by_refinement( + `!s f v e. + is_scs_v39 s /\ + scs_k_v39 s = 5 /\ + BBs_v39 s v /\ + (!i j. scs_diag 5 i j ==> scs_a_v39 s i j < dist(v i,v j)) /\ + deformation f (IMAGE v (:num)) (--e,e) /\ + (!w t. ~(w = v 0) /\ ~(w = v 1) ==> (f w t = w)) /\ + (?e1. &0 < e1 /\ (!t. abs t < e1 ==> dist(f (v 1) t,v 2) = dist(v 1,v 2) /\ dist(f (v 0) t,v 4) = dist(v 0,v 4))) /\ + (?e1. &0 < e1 /\ (!t. abs t < e1 ==> scs_a_v39 s 0 1 <= dist(f (v 0) t,f (v 1) t))) + ==> + (!i j. ?e1. &0 < e1 /\ (scs_a_v39 s i j = dist(v i,v j) ==> + (!t. abs t < e1 ==> scs_a_v39 s i j <= dist(f (v i) t,f (v j) t)))) + `, + (* {{{ proof *) + [ + REPEAT GEN_TAC THEN DISCH_TAC THEN MATCH_MP_TAC Cuxvzoz.I_IMP THEN ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `!i j.scs_a_v39 s (i MOD 5) (j MOD 5) = scs_a_v39 s i j /\ scs_b_v39 s (i MOD 5) (j MOD 5) = scs_b_v39 s i j ` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; + ASM_REWRITE_TAC[Appendix.is_scs_v39]; + REPEAT WEAKER_STRIP_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `periodic2` MP_TAC) THEN MESON_TAC[Cuxvzoz.periodic2_MOD;arith `~(5 = 0)`]); + TYPIFY `periodic v 5` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN MESON_TAC[]); + TYPIFY `!i. v (i MOD 5) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[arith `~(0=5)`]); + INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`5`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!j. j < 5 ==> (j MOD 5 = j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[MOD_LT]); + COMMENT "scs_a_v39"; + REWRITE_TAC[I_THM]; + MATCH_MP_TAC Terminal.periodic2_mod_reduce; + TYPIFY `5` EXISTS_TAC; + ASM_REWRITE_TAC[arith `~(5=0)`]; + CONJ_TAC; + MATCH_MP_TAC Cuxvzoz.MOD_periodic2; + BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[] THEN MESON_TAC[arith `~(5=0)`]); + TYPIFY_GOAL_THEN `!P. (!i j. P i j ==> P j i) /\ (!i j. (i <= (j:num)) ==> P i j) ==> (!i j. P i j)` MATCH_MP_TAC; + BY(MESON_TAC[arith `i <= j \/ j <= (i:num)`]); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[DIST_SYM]; + TYPIFY `scs_a_v39 s j i = scs_a_v39 s i j` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!t. f (v 2) t = v 2 /\ f (v 3) t = v 3 /\ f (v 4) t = v 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[arith `0 < 5 /\ 1 < 5 /\ 2 < 5 /\ 3 < 5 /\ 4 < 5 /\ ~(2 = 0) /\ ~(2 = 1) /\ ~(3 = 0) /\ ~(3 = 1) /\ ~(4 =0) /\ ~(4=1)`]); + REWRITE_TAC[arith `i < 5 <=> (i = 0) \/ (i = 1) \/ (i=2) \/ (i =3) \/ (i=4)`]; + TYPIFY `scs_diag 5 0 2 /\ scs_diag 5 0 3 /\ scs_diag 5 1 3 /\ scs_diag 5 1 4 /\ scs_diag 5 2 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Appendix.scs_diag;Uxckfpe.ARITH_5_TAC]); + ONCE_REWRITE_TAC[TAUT `(a ==> b ==> c) <=> (b ==> a ==> c)`]; + TYPIFY `!i j. scs_diag 5 i j ==> (?e1. &0 < e1 /\ (scs_a_v39 s i j = dist (v i,v j) ==> (!t. abs t < e1 ==> scs_a_v39 s i j <= dist (f (v i) t,f (v j) t))))` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[arith `x < y ==> ~(x = y)`]); + TYPIFY `!i. T ==> (?e1. &0 < e1 /\ (scs_a_v39 s i i = dist (v i,v i) ==> (!t. abs t < e1 ==> scs_a_v39 s i i <= dist (f (v i) t,f (v i) t))))` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[DIST_REFL]; + BY(MESON_TAC[arith `x = &0 ==> x <= &0`;arith `&0 < &1`]); + REPEAT GEN_TAC; + TYPIFY `(?e1. &0 < e1 /\ (scs_a_v39 s 0 1 = dist (v 0,v 1) ==> (!t. abs t < e1 ==> scs_a_v39 s 0 1 <= dist (f (v 0) t,f (v 1) t)))) /\ (?e1. &0 < e1 /\ (scs_a_v39 s 1 2 = dist (v 1,v 2) ==> (!t. abs t < e1 ==> scs_a_v39 s 1 2 <= dist (f (v 1) t,f (v 2) t)))) /\ (?e1. &0 < e1 /\ (scs_a_v39 s 2 3 = dist (v 2,v 3) ==> (!t. abs t < e1 ==> scs_a_v39 s 2 3 <= dist (f (v 2) t,f (v 3) t)))) /\ (?e1. &0 < e1 /\ (scs_a_v39 s 3 4 = dist (v 3,v 4) ==> (!t. abs t < e1 ==> scs_a_v39 s 3 4 <= dist (f (v 3) t,f (v 4) t)))) /\ (?e1. &0 < e1 /\ (scs_a_v39 s 0 4 = dist (v 0,v 4) ==> (!t. abs t < e1 ==> scs_a_v39 s 0 4 <= dist (f (v 0) t,f (v 4) t))))` (C SUBGOAL_THEN MP_TAC); + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `!a b. (?e1. &0 < e1 /\ (a = b ==> (!t. abs t < e1 ==> a <= b)))` (unlist REWRITE_TAC); + BY(MESON_TAC[arith `&0 < &1`;arith `(a = b) ==> (a <= b)`]); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[arith `x = y ==> x <= y`]); + REWRITE_TAC[LEFT_OR_DISTRIB;RIGHT_OR_DISTRIB;GSYM DISJ_ASSOC]; + ONCE_REWRITE_TAC[TAUT `(a1 /\ a2 /\ a3 /\ a4 /\ a5) <=> ((T ==> a1) /\ (T ==> a2) /\ (T ==> a3) /\ (T ==> a4) /\ (T ==> a5))`]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + BY(REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN FIRST_X_ASSUM (unlist REWRITE_TAC) THEN NUM_REDUCE_TAC THEN TRY (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) +*) + +let a5_assumption_reduction = prove_by_refinement( + `!s f v e. + is_scs_v39 s /\ + scs_k_v39 s = 5 /\ + BBs_v39 s v /\ + (!i j. scs_diag 5 i j ==> scs_a_v39 s i j < dist(v i,v j)) /\ + deformation f (IMAGE v (:num)) (--e,e) /\ + (!w t. ~(w = v 4) /\ ~(w = v 0) ==> (f w t = w)) /\ + (?e1. &0 < e1 /\ (!t. abs t < e1 ==> dist(f (v 4) t,f (v 0) t) = dist(v 4,v 0) /\ dist(f (v 4) t,v 3) = dist(v 4,v 3))) /\ + (?e1. &0 < e1 /\ (!t. abs t < e1 ==> scs_a_v39 s 0 1 <= dist(f (v 0) t,v 1))) + ==> + (!i j. ?e1. &0 < e1 /\ (scs_a_v39 s i j = dist(v i,v j) ==> + (!t. abs t < e1 ==> scs_a_v39 s i j <= dist(f (v i) t,f (v j) t)))) + `, + (* {{{ proof *) + [ + REPEAT GEN_TAC THEN DISCH_TAC THEN MATCH_MP_TAC Cuxvzoz.I_IMP THEN ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `!i j.scs_a_v39 s (i MOD 5) (j MOD 5) = scs_a_v39 s i j /\ scs_b_v39 s (i MOD 5) (j MOD 5) = scs_b_v39 s i j ` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; + ASM_REWRITE_TAC[Appendix.is_scs_v39]; + REPEAT WEAKER_STRIP_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `periodic2` MP_TAC) THEN MESON_TAC[Cuxvzoz.periodic2_MOD;arith `~(5 = 0)`]); + TYPIFY `periodic v 5` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN MESON_TAC[]); + TYPIFY `!i. v (i MOD 5) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[arith `~(0=5)`]); + INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`5`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!j. j < 5 ==> (j MOD 5 = j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[MOD_LT]); + COMMENT "scs_a_v39"; + REWRITE_TAC[I_THM]; + MATCH_MP_TAC Terminal.periodic2_mod_reduce; + TYPIFY `5` EXISTS_TAC; + ASM_REWRITE_TAC[arith `~(5=0)`]; + CONJ_TAC; + MATCH_MP_TAC Cuxvzoz.MOD_periodic2; + BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[] THEN MESON_TAC[arith `~(5=0)`]); + TYPIFY_GOAL_THEN `!P. (!i j. P i j ==> P j i) /\ (!i j. (i <= (j:num)) ==> P i j) ==> (!i j. P i j)` MATCH_MP_TAC; + BY(MESON_TAC[arith `i <= j \/ j <= (i:num)`]); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[DIST_SYM]; + TYPIFY `scs_a_v39 s j i = scs_a_v39 s i j` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i j. i < 5 /\ j < 5 /\ ~(i=j) ==> ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[]); + TYPIFY `!t. f (v 2) t = v 2 /\ f (v 3) t = v 3 /\ f (v 1) t = v 1` (C SUBGOAL_THEN ASSUME_TAC); + BY(GEN_TAC THEN REPEAT CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC THEN REPEAT CONJ_TAC) THEN NUM_REDUCE_TAC); + REWRITE_TAC[arith `i < 5 <=> (i = 0) \/ (i = 1) \/ (i=2) \/ (i =3) \/ (i=4)`]; + TYPIFY `scs_diag 5 0 2 /\ scs_diag 5 0 3 /\ scs_diag 5 1 3 /\ scs_diag 5 1 4 /\ scs_diag 5 2 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Appendix.scs_diag;Uxckfpe.ARITH_5_TAC]); + ONCE_REWRITE_TAC[TAUT `(a ==> b ==> c) <=> (b ==> a ==> c)`]; + TYPIFY `!i j. scs_diag 5 i j ==> (?e1. &0 < e1 /\ (scs_a_v39 s i j = dist (v i,v j) ==> (!t. abs t < e1 ==> scs_a_v39 s i j <= dist (f (v i) t,f (v j) t))))` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[arith `x < y ==> ~(x = y)`]); + TYPIFY `!i. T ==> (?e1. &0 < e1 /\ (scs_a_v39 s i i = dist (v i,v i) ==> (!t. abs t < e1 ==> scs_a_v39 s i i <= dist (f (v i) t,f (v i) t))))` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[DIST_REFL]; + BY(MESON_TAC[arith `x = &0 ==> x <= &0`;arith `&0 < &1`]); + REPEAT GEN_TAC; + TYPIFY `(?e1. &0 < e1 /\ (scs_a_v39 s 0 1 = dist (v 0,v 1) ==> (!t. abs t < e1 ==> scs_a_v39 s 0 1 <= dist (f (v 0) t,f (v 1) t)))) /\ (?e1. &0 < e1 /\ (scs_a_v39 s 1 2 = dist (v 1,v 2) ==> (!t. abs t < e1 ==> scs_a_v39 s 1 2 <= dist (f (v 1) t,f (v 2) t)))) /\ (?e1. &0 < e1 /\ (scs_a_v39 s 2 3 = dist (v 2,v 3) ==> (!t. abs t < e1 ==> scs_a_v39 s 2 3 <= dist (f (v 2) t,f (v 3) t)))) /\ (?e1. &0 < e1 /\ (scs_a_v39 s 3 4 = dist (v 3,v 4) ==> (!t. abs t < e1 ==> scs_a_v39 s 3 4 <= dist (f (v 3) t,f (v 4) t)))) /\ (?e1. &0 < e1 /\ (scs_a_v39 s 0 4 = dist (v 0,v 4) ==> (!t. abs t < e1 ==> scs_a_v39 s 0 4 <= dist (f (v 0) t,f (v 4) t))))` (C SUBGOAL_THEN MP_TAC); + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `!a b. (?e1. &0 < e1 /\ (a = b ==> (!t. abs t < e1 ==> a <= b)))` (unlist REWRITE_TAC); + BY(MESON_TAC[arith `&0 < &1`;arith `(a = b) ==> (a <= b)`]); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + ONCE_REWRITE_TAC[DIST_SYM]; + BY(ASM_MESON_TAC[arith `x = y ==> x <= y`]); + REWRITE_TAC[LEFT_OR_DISTRIB;RIGHT_OR_DISTRIB;GSYM DISJ_ASSOC]; + ONCE_REWRITE_TAC[TAUT `(a1 /\ a2 /\ a3 /\ a4 /\ a5) <=> ((T ==> a1) /\ (T ==> a2) /\ (T ==> a3) /\ (T ==> a4) /\ (T ==> a5))`]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + BY(REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN FIRST_X_ASSUM (unlist REWRITE_TAC) THEN NUM_REDUCE_TAC THEN TRY (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +(* +let b5_assumption_reduction = prove_by_refinement( + `!s f v e. + is_scs_v39 s /\ + scs_k_v39 s = 5 /\ + BBs_v39 s v /\ + (!i j. scs_diag 5 i j ==> &4 * h0 < scs_b_v39 s i j) /\ + deformation f (IMAGE v (:num)) (--e,e) /\ + (!w t. ~(w = v 0) /\ ~(w = v 1) ==> (f w t = w)) /\ + (?e1. &0 < e1 /\ (!t. abs t < e1 ==> dist(f (v 1) t,v 2) = dist(v 1,v 2) /\ dist(f (v 0) t,v 4) = dist(v 0,v 4))) /\ + (?e1. &0 < e1 /\ (!t. abs t < e1 ==> dist(f (v 0) t,f (v 1) t) <= dist(v 0, v 1))) + ==> + (!i j. ?e1. &0 < e1 /\ (dist(v i,v j) = scs_b_v39 s i j ==> + (!t. abs t < e1 ==> dist(f (v i) t,f (v j) t) <= scs_b_v39 s i j))) + `, + (* {{{ proof *) + [ + REPEAT GEN_TAC THEN DISCH_TAC THEN MATCH_MP_TAC Cuxvzoz.I_IMP THEN ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `!i j.scs_a_v39 s (i MOD 5) (j MOD 5) = scs_a_v39 s i j /\ scs_b_v39 s (i MOD 5) (j MOD 5) = scs_b_v39 s i j ` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; + ASM_REWRITE_TAC[Appendix.is_scs_v39]; + REPEAT WEAKER_STRIP_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `periodic2` MP_TAC) THEN MESON_TAC[Cuxvzoz.periodic2_MOD;arith `~(5 = 0)`]); + TYPIFY `periodic v 5` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN MESON_TAC[]); + TYPIFY `!i. v (i MOD 5) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[arith `~(0=5)`]); + INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`5`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!j. j < 5 ==> (j MOD 5 = j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[MOD_LT]); + COMMENT "scs_b_v39"; + REWRITE_TAC[I_THM]; + MATCH_MP_TAC Terminal.periodic2_mod_reduce; + TYPIFY `5` EXISTS_TAC; + ASM_REWRITE_TAC[arith `~(5=0)`]; + CONJ_TAC; + MATCH_MP_TAC Cuxvzoz.MOD_periodic2; + BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[] THEN MESON_TAC[arith `~(5=0)`]); + TYPIFY_GOAL_THEN `!P. (!i j. P i j ==> P j i) /\ (!i j. (i <= (j:num)) ==> P i j) ==> (!i j. P i j)` MATCH_MP_TAC; + BY(MESON_TAC[arith `i <= j \/ j <= (i:num)`]); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[DIST_SYM]; + TYPIFY `scs_b_v39 s j i = scs_b_v39 s i j` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!t. f (v 2) t = v 2 /\ f (v 3) t = v 3 /\ f (v 4) t = v 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[arith `0 < 5 /\ 1 < 5 /\ 2 < 5 /\ 3 < 5 /\ 4 < 5 /\ ~(2 = 0) /\ ~(2 = 1) /\ ~(3 = 0) /\ ~(3 = 1) /\ ~(4 =0) /\ ~(4=1)`]); + TYPIFY `scs_diag 5 0 2 /\ scs_diag 5 0 3 /\ scs_diag 5 1 3 /\ scs_diag 5 1 4 /\ scs_diag 5 2 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Appendix.scs_diag;Uxckfpe.ARITH_5_TAC]); + TYPIFY `!i j. scs_diag 5 i j ==> (?e1. &0 < e1 /\ (dist (v i,v j) = scs_b_v39 s i j ==> (!t. abs t < e1 ==> dist (f (v i) t,f (v j) t) <= scs_b_v39 s i j)))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `&1` EXISTS_TAC; + (REWRITE_TAC[arith `&0 < &1`]); + TYPIFY `dist(v i,v j) <= &4 * h0` ENOUGH_TO_SHOW_TAC; + FIRST_X_ASSUM_ST `&4 * h0` (C INTRO_TAC [`i`;`j`]); + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + INTRO_TAC DIST_TRIANGLE [`v i`;`(vec 0):real^3`;`v j`]; + REWRITE_TAC[DIST_0]; + TYPIFY `!i. norm (v i) <= &2 * h0` ENOUGH_TO_SHOW_TAC; + BY(DISCH_TAC THEN FIRST_ASSUM (C INTRO_TAC [`i`]) THEN FIRST_X_ASSUM (C INTRO_TAC [`j`]) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + BY(FIRST_X_ASSUM_ST `ball_annulus` MP_TAC THEN REWRITE_TAC[Terminal.IMAGE_SUBSET_IN;IN_UNIV] THEN MESON_TAC[Fnjlbxs.in_ball_annulus]); + TYPIFY `!i. T ==> (?e1. &0 < e1 /\ (dist (v i,v i) = scs_b_v39 s i i ==> (!t. abs t < e1 ==> dist (f (v i) t,f (v i) t) <= scs_b_v39 s i i)))` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[DIST_REFL]; + BY(MESON_TAC[arith `x = &0 ==> x <= &0`;arith `&0 < &1`]); + REPEAT GEN_TAC; + TYPIFY `(?e1. &0 < e1 /\ (dist (v 0,v 1) = scs_b_v39 s 0 1 ==> (!t. abs t < e1 ==> dist (f (v 0) t,f (v 1) t) <= scs_b_v39 s 0 1))) /\(?e1. &0 < e1 /\ (dist (v 1,v 2) = scs_b_v39 s 1 2 ==> (!t. abs t < e1 ==> dist (f (v 1) t,f (v 2) t) <= scs_b_v39 s 1 2))) /\(?e1. &0 < e1 /\ (dist (v 2,v 3) = scs_b_v39 s 2 3 ==> (!t. abs t < e1 ==> dist (f (v 2) t,f (v 3) t) <= scs_b_v39 s 2 3))) /\(?e1. &0 < e1 /\ (dist (v 3,v 4) = scs_b_v39 s 3 4 ==> (!t. abs t < e1 ==> dist (f (v 3) t,f (v 4) t) <= scs_b_v39 s 3 4))) /\(?e1. &0 < e1 /\ (dist (v 0,v 4) = scs_b_v39 s 0 4 ==> (!t. abs t < e1 ==> dist (f (v 0) t,f (v 4) t) <= scs_b_v39 s 0 4)))` (C SUBGOAL_THEN MP_TAC); + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `!a b. (?e1. &0 < e1 /\ (a = b ==> (!t. abs t < e1 ==> a <= b)))` (unlist REWRITE_TAC); + BY(MESON_TAC[arith `&0 < &1`;arith `(a = b) ==> (a <= b)`]); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[arith `x = y ==> x <= y`]); + DISCH_TAC; + REWRITE_TAC[arith `i < 5 <=> (i = 0) \/ (i = 1) \/ (i=2) \/ (i =3) \/ (i=4)`]; + ONCE_REWRITE_TAC[TAUT `(a ==> b ==> c) <=> (b ==> a ==> c)`]; + REWRITE_TAC[LEFT_OR_DISTRIB;RIGHT_OR_DISTRIB;GSYM DISJ_ASSOC]; + FIRST_X_ASSUM MP_TAC; + ONCE_REWRITE_TAC[TAUT `(a1 /\ a2 /\ a3 /\ a4 /\ a5) <=> ((T ==> a1) /\ (T ==> a2) /\ (T ==> a3) /\ (T ==> a4) /\ (T ==> a5))`]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + BY(REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN FIRST_X_ASSUM (unlist REWRITE_TAC) THEN NUM_REDUCE_TAC THEN TRY (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) +*) + +let b5_assumption_reduction = prove_by_refinement( + `!s f v e. + is_scs_v39 s /\ + scs_k_v39 s = 5 /\ + BBs_v39 s v /\ + (!i j. scs_diag 5 i j ==> &4 * h0 < scs_b_v39 s i j) /\ + deformation f (IMAGE v (:num)) (--e,e) /\ + (!w t. ~(w = v 4) /\ ~(w = v 0) ==> (f w t = w)) /\ + (?e1. &0 < e1 /\ (!t. abs t < e1 ==> dist(f (v 4) t,f (v 0) t) = dist(v 4,v 0) /\ dist(f (v 4) t,v 3) = dist(v 4,v 3))) /\ + (?e1. &0 < e1 /\ (!t. abs t < e1 ==> dist(f (v 0) t, (v 1)) <= dist(v 0, v 1))) + ==> + (!i j. ?e1. &0 < e1 /\ (dist(v i,v j) = scs_b_v39 s i j ==> + (!t. abs t < e1 ==> dist(f (v i) t,f (v j) t) <= scs_b_v39 s i j))) + `, + (* {{{ proof *) + [ + REPEAT GEN_TAC THEN DISCH_TAC THEN MATCH_MP_TAC Cuxvzoz.I_IMP THEN ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `!i j.scs_a_v39 s (i MOD 5) (j MOD 5) = scs_a_v39 s i j /\ scs_b_v39 s (i MOD 5) (j MOD 5) = scs_b_v39 s i j ` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; + ASM_REWRITE_TAC[Appendix.is_scs_v39]; + REPEAT WEAKER_STRIP_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `periodic2` MP_TAC) THEN MESON_TAC[Cuxvzoz.periodic2_MOD;arith `~(5 = 0)`]); + TYPIFY `periodic v 5` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN MESON_TAC[]); + TYPIFY `!i. v (i MOD 5) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[arith `~(0=5)`]); + INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`5`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!j. j < 5 ==> (j MOD 5 = j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[MOD_LT]); + COMMENT "scs_b_v39"; + REWRITE_TAC[I_THM]; + MATCH_MP_TAC Terminal.periodic2_mod_reduce; + TYPIFY `5` EXISTS_TAC; + ASM_REWRITE_TAC[arith `~(5=0)`]; + CONJ_TAC; + MATCH_MP_TAC Cuxvzoz.MOD_periodic2; + BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[] THEN MESON_TAC[arith `~(5=0)`]); + TYPIFY_GOAL_THEN `!P. (!i j. P i j ==> P j i) /\ (!i j. (i <= (j:num)) ==> P i j) ==> (!i j. P i j)` MATCH_MP_TAC; + BY(MESON_TAC[arith `i <= j \/ j <= (i:num)`]); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[DIST_SYM]; + TYPIFY `scs_b_v39 s j i = scs_b_v39 s i j` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i j. i < 5 /\ j < 5 /\ ~(i=j) ==> ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[]); + TYPIFY `!t. f (v 2) t = v 2 /\ f (v 3) t = v 3 /\ f (v 1) t = v 1` (C SUBGOAL_THEN ASSUME_TAC); + BY(GEN_TAC THEN REPEAT CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC THEN REPEAT CONJ_TAC) THEN NUM_REDUCE_TAC); + TYPIFY `scs_diag 5 0 2 /\ scs_diag 5 0 3 /\ scs_diag 5 1 3 /\ scs_diag 5 1 4 /\ scs_diag 5 2 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Appendix.scs_diag;Uxckfpe.ARITH_5_TAC]); + TYPIFY `!i j. scs_diag 5 i j ==> (?e1. &0 < e1 /\ (dist (v i,v j) = scs_b_v39 s i j ==> (!t. abs t < e1 ==> dist (f (v i) t,f (v j) t) <= scs_b_v39 s i j)))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `&1` EXISTS_TAC; + (REWRITE_TAC[arith `&0 < &1`]); + TYPIFY `dist(v i,v j) <= &4 * h0` ENOUGH_TO_SHOW_TAC; + FIRST_X_ASSUM_ST `&4 * h0` (C INTRO_TAC [`i`;`j`]); + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + INTRO_TAC DIST_TRIANGLE [`v i`;`(vec 0):real^3`;`v j`]; + REWRITE_TAC[DIST_0]; + TYPIFY `!i. norm (v i) <= &2 * h0` ENOUGH_TO_SHOW_TAC; + BY(DISCH_TAC THEN FIRST_ASSUM (C INTRO_TAC [`i`]) THEN FIRST_X_ASSUM (C INTRO_TAC [`j`]) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + BY(FIRST_X_ASSUM_ST `ball_annulus` MP_TAC THEN REWRITE_TAC[Terminal.IMAGE_SUBSET_IN;IN_UNIV] THEN MESON_TAC[Fnjlbxs.in_ball_annulus]); + TYPIFY `!i. T ==> (?e1. &0 < e1 /\ (dist (v i,v i) = scs_b_v39 s i i ==> (!t. abs t < e1 ==> dist (f (v i) t,f (v i) t) <= scs_b_v39 s i i)))` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[DIST_REFL]; + BY(MESON_TAC[arith `x = &0 ==> x <= &0`;arith `&0 < &1`]); + REPEAT GEN_TAC; + TYPIFY `(?e1. &0 < e1 /\ (dist (v 0,v 1) = scs_b_v39 s 0 1 ==> (!t. abs t < e1 ==> dist (f (v 0) t,f (v 1) t) <= scs_b_v39 s 0 1))) /\(?e1. &0 < e1 /\ (dist (v 1,v 2) = scs_b_v39 s 1 2 ==> (!t. abs t < e1 ==> dist (f (v 1) t,f (v 2) t) <= scs_b_v39 s 1 2))) /\(?e1. &0 < e1 /\ (dist (v 2,v 3) = scs_b_v39 s 2 3 ==> (!t. abs t < e1 ==> dist (f (v 2) t,f (v 3) t) <= scs_b_v39 s 2 3))) /\(?e1. &0 < e1 /\ (dist (v 3,v 4) = scs_b_v39 s 3 4 ==> (!t. abs t < e1 ==> dist (f (v 3) t,f (v 4) t) <= scs_b_v39 s 3 4))) /\(?e1. &0 < e1 /\ (dist (v 0,v 4) = scs_b_v39 s 0 4 ==> (!t. abs t < e1 ==> dist (f (v 0) t,f (v 4) t) <= scs_b_v39 s 0 4)))` (C SUBGOAL_THEN MP_TAC); + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `!a b. (?e1. &0 < e1 /\ (a = b ==> (!t. abs t < e1 ==> a <= b)))` (unlist REWRITE_TAC); + BY(MESON_TAC[arith `&0 < &1`;arith `(a = b) ==> (a <= b)`]); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REPEAT (FIRST_X_ASSUM_ST `dist(v 4,v 0)` MP_TAC); + REWRITE_TAC[DIST_SYM]; + BY(ASM_MESON_TAC[arith `x = y ==> x <= y`]); + DISCH_TAC; + REWRITE_TAC[arith `i < 5 <=> (i = 0) \/ (i = 1) \/ (i=2) \/ (i =3) \/ (i=4)`]; + ONCE_REWRITE_TAC[TAUT `(a ==> b ==> c) <=> (b ==> a ==> c)`]; + REWRITE_TAC[LEFT_OR_DISTRIB;RIGHT_OR_DISTRIB;GSYM DISJ_ASSOC]; + FIRST_X_ASSUM MP_TAC; + ONCE_REWRITE_TAC[TAUT `(a1 /\ a2 /\ a3 /\ a4 /\ a5) <=> ((T ==> a1) /\ (T ==> a2) /\ (T ==> a3) /\ (T ==> a4) /\ (T ==> a5))`]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + BY(REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN FIRST_X_ASSUM (unlist REWRITE_TAC) THEN NUM_REDUCE_TAC THEN TRY (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +(* was dihV_dih_y *) + +let azim_dih_y = prove_by_refinement( + `!v0 v1 v2 v3. ~collinear {v0,v1,v2} /\ ~collinear{v0,v1,v3} /\ azim v0 v1 v2 v3 <= pi ==> + azim v0 v1 v2 v3 = dih_y (dist(v0,v1)) (dist(v0,v2)) (dist(v0,v3)) + (dist(v2,v3)) (dist(v1,v3)) (dist(v1,v2))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC AZIM_DIHV_SAME_STRONG [`v0`;`v1`;`v2`;`v3`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Merge_ineq.DIHV_DIH_X); + REWRITE_TAC[Sphere.dih_y;LET_THM;arith `x*x = x pow 2`]; + BY(ASM_REWRITE_TAC[GSYM Collect_geom2.NOT_COL_EQ_UPS_X_POS]) + ]);; + (* }}} *) + +(* next azim reduction *) + +(* +let azm5_reduction = prove_by_refinement( + `!s f v e. + is_scs_v39 s /\ + scs_k_v39 s = 5 /\ + BBs_v39 s v /\ + scs_generic v /\ + deformation f (IMAGE v (:num)) (--e,e) /\ + (!w t. ~(w = v 0) /\ ~(w = v 4) ==> f w t = w) /\ + azim (vec 0) (v 0) (v 1) (v 4) < pi /\ + azim (vec 0) (v 1) (v 2) (v 0) < pi /\ + &0 < azim (vec 0) (v 0) (v 1) (v 3) /\ + (?e1. &0 < e1 /\ + (!t. abs t < e1 + ==> azim (vec 0) (v 3) (f (v 0) t) (v 1) <= + azim (vec 0) (v 3) (v 0) (v 1))) /\ + (?e1. &0 < e1 /\ + (!t. abs t < e1 + // make this a dih_y condition?? + ==> azim (vec 0) (v 3) (f (v 4) t) (f (v 0) t) = + azim (vec 0) (v 3) (v 4) (v 0) /\ + azim (vec 0) (f (v 4) t) (f (v 0) t) (v 3) = + azim (vec 0) (v 4) (v 0) (v 3) /\ + azim (vec 0) (f (v 0) t) (v 3) (f (v 4) t) = + azim (vec 0) (v 0) (v 3) (v 4))) + ==> azim (vec 0) (v 3) (v 4) (v 2) = + azim (vec 0) (v 3) (v 4) (v 0) + + azim (vec 0) (v 3) (v 0) (v 1) + + azim (vec 0) (v 3) (v 1) (v 2) /\ + azim (vec 0) (v 0) (v 1) (v 4) = + azim (vec 0) (v 0) (v 1) (v 3) + azim (vec 0) (v 0) (v 3) (v 4) /\ + azim (vec 0) (v 1) (v 2) (v 0) = + azim (vec 0) (v 1) (v 2) (v 3) + azim (vec 0) (v 1) (v 3) (v 0) /\ + (?e1. &0 < e1 /\ + (!t. abs t < e1 + ==> azim (vec 0) (v 3) (f (v 4) t) (v 2) = + azim (vec 0) (v 3) (f (v 4) t) (f (v 0) t) + + azim (vec 0) (v 3) (f (v 0) t) (v 1) + + azim (vec 0) (v 3) (v 1) (v 2) /\ + azim (vec 0) (f (v 0) t) (v 1) (f (v 4) t) = + azim (vec 0) (f (v 0) t) (v 1) (v 3) + + azim (vec 0) (f (v 0) t) (v 3) (f (v 4) t) /\ + azim (vec 0) (v 1) (v 2) (f (v 0) t) = + azim (vec 0) (v 1) (v 2) (v 3) + + azim (vec 0) (v 1) (v 3) (f (v 0) t) /\ + &0 < azim (vec 0) (f (v 0) t) (v 1) (v 3) /\ + azim (vec 0) (f (v 0) t) (v 1) (v 3) < pi)) /\ + (!i. ?e0. &0 < e0 /\ + (azim (vec 0) (v i) (v (i + 1)) (v (i + 4)) = pi + ==> (!t. abs t < e0 + ==> azim (vec 0) (f (v i) t) (f (v (i + 1)) t) + (f (v (i + 4)) t) <= + pi)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASSUME_TAC (arith `~(0 = 5)`); + TYPIFY `!i. i MOD 5 < 5` (C SUBGOAL_THEN ASSUME_TAC); + BY((FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION]); + TYPIFY `periodic v 5` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN MESON_TAC[]); + TYPIFY `!i. v (i MOD 5) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[arith `~(0=5)`]); + TYPIFY `v 5 = v 0 /\ v 6 = v 1 /\ v 7 = v 2 /\ v 8 = v 3 /\ v 9 = v 4` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM ((unlist ONCE_REWRITE_TAC) o GSYM); + BY(REWRITE_TAC[Ocbicby.MOD_5_EXPLICIT;arith `8 = 1*5 + 3`;arith `9 = 1*5 + 4`;MOD_MULT_ADD]); + INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`5`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY ` generic (IMAGE v (:num)) (IMAGE (\i. {v i, v (SUC i)}) (:num)) /\ convex_local_fan (IMAGE v (:num), IMAGE (\i. {v i, v (SUC i)}) (:num), IMAGE (\i. v i,v (SUC i)) (:num))` (C SUBGOAL_THEN ASSUME_TAC); + CONJ2_TAC; + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[LET_THM;Appendix.BBs_v39]; + BY(MESON_TAC[arith `~(5 <= 3)`]); + BY(FIRST_X_ASSUM_ST `scs_generic` MP_TAC THEN MESON_TAC[Appendix.scs_generic]); + FIRST_X_ASSUM MP_TAC THEN BURY_MP_TAC; + COMMENT "first addition"; + SUBCONJ_TAC; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`5`;`3`;`3`;`4`]; + ASM_REWRITE_TAC[LET_THM;arith `SUC 3 = 4 /\ 3 + 4 = 7 /\ 3 + 3 = 6 /\ 3 <= 5 /\ 0 < 3 /\ 3 < 4 /\ 4 < 5`]; + DISCH_THEN SUBST1_TAC; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`5`;`3`;`2`;`3`]; + ASM_REWRITE_TAC[LET_THM;arith `SUC 3 = 4 /\ 3 + 3 = 6 /\ 3 + 2 = 5 /\ 3 <= 5 /\ 0 < 2 /\ 2 < 3 /\ 3 < 5`]; + DISCH_THEN SUBST1_TAC; + BY(REAL_ARITH_TAC); + DISCH_TAC; + COMMENT "second addition"; + SUBCONJ_TAC; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`5`;`0`;`3`;`4`]; + NUM_REDUCE_TAC; + BY(ASM_REWRITE_TAC[LET_THM]); + COMMENT "third addition"; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`5`;`0`;`3`;`4`]; + NUM_REDUCE_TAC; + ASM_REWRITE_TAC[LET_THM]; + DISCH_TAC; + DISCH_TAC; + SUBCONJ_TAC; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`5`;`1`;`2`;`4`]; + NUM_REDUCE_TAC; + BY(ASM_REWRITE_TAC[LET_THM]); + DISCH_TAC; + TYPIFY `!i j. i < 5 /\ j < 5 /\ ~(i = j) ==> ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[]); + TYPIFY `!t. f (v 1) t = v 1 /\ f (v 2) t = v 2 /\ f (v 3) t = v 3` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + COMMENT "colinearity"; + TYPIFY `!i j. ~(v i = v j) ==> ~collinear {vec 0,v i, v j}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT GEN_TAC THEN DISCH_TAC; + MATCH_MP_TAC Zlzthic.PROPERTIES_GENERIC_LOCAL_FAN_ALT; + GEXISTL_TAC [`IMAGE v (:num)`;`IMAGE (\i. {v i, v (SUC i)}) (:num)`;`IMAGE (\i. (v i, v (SUC i))) (:num)`]; + ASM_REWRITE_TAC[IN_IMAGE;IN_UNIV]; + CONJ_TAC; + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + BY(MESON_TAC[]); + COMMENT "deform collinear"; + TYPIFY `!i j. ~collinear {vec 0,v i,v j} ==> (?e1. &0 < e1 /\ (!t. abs t < e1 ==> ~collinear {vec 0, f (v i) t, f (v j) t}))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GEN_ALL Local_lemmas1.CONTINUOUS_PRESERVE_COLLINEAR) [`&0`;`(vec 0):real^3`;`f (v i)`;`f (v j)`]; + ANTS_TAC; + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation;arith `abs(&0 - x) = abs x`]; + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + BY(REWRITE_TAC[arith `abs(&0 - r') = abs r'`]); + TYPIFY `!i. azim (vec 0) (v i) (v (i+1)) (v(i+4)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[arith `i+1 = SUC i`;arith `4 = 5 - 1`]; + GEN_TAC; + MATCH_MP_TAC (REWRITE_RULE[LET_THM] Terminal.convex_local_fan_azim_le_pi); + ASM_REWRITE_TAC[arith `3 <= 5`]; + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM]; + BY(DISCH_THEN (unlist REWRITE_TAC)); + COMMENT "merge e"; + TYPIFY_GOAL_THEN `(?e1. &0 < e1 /\ (!t. abs t < e1 ==> azim (vec 0) (v 3) (f (v 4) t) (v 2) = azim (vec 0) (v 3) (f (v 4) t) (f (v 0) t) + azim (vec 0) (v 3) (f (v 0) t) (v 1) + azim (vec 0) (v 3) (v 1) (v 2) )) /\(?e1. &0 < e1 /\ (!t. abs t < e1 ==> azim (vec 0) (f (v 0) t) (v 1) (f (v 4) t) = azim (vec 0) (f (v 0) t) (v 1) (v 3) + azim (vec 0) (f (v 0) t) (v 3) (f (v 4) t) )) /\ (?e1. &0 < e1 /\ (!t. abs t < e1 ==> azim (vec 0) (v 1) (v 2) (f (v 0) t) = azim (vec 0) (v 1) (v 2) (v 3) + azim (vec 0) (v 1) (v 3) (f (v 0) t))) /\ (?e1. &0 < e1 /\ (!t. abs t < e1 ==> &0 < azim (vec 0) (f (v 0) t) (v 1) (v 3) /\ azim (vec 0) (f (v 0) t) (v 1) (v 3) < pi)) ==> (?e1. &0 < e1 /\ (!t. abs t < e1 ==> azim (vec 0) (v 3) (f (v 4) t) (v 2) = azim (vec 0) (v 3) (f (v 4) t) (f (v 0) t) + azim (vec 0) (v 3) (f (v 0) t) (v 1) + azim (vec 0) (v 3) (v 1) (v 2) /\ azim (vec 0) (f (v 0) t) (v 1) (f (v 4) t) = azim (vec 0) (f (v 0) t) (v 1) (v 3) + azim (vec 0) (f (v 0) t) (v 3) (f (v 4) t) /\ azim (vec 0) (v 1) (v 2) (f (v 0) t) = azim (vec 0) (v 1) (v 2) (v 3) + azim (vec 0) (v 1) (v 3) (f (v 0) t) /\ &0 < azim (vec 0) (f (v 0) t) (v 1) (v 3) /\ azim (vec 0) (f (v 0) t) (v 1) (v 3) < pi))` (GMATCH_SIMP_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Cuxvzoz.epsilon_quad [`e1''`;`e1'''`;`e1''''`;`e1'''''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''''` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC THEN REPEAT CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[]); + REWRITE_TAC[GSYM CONJ_ASSOC]; + COMMENT "azim bounds"; + TYPIFY `azim (vec 0) (v 0) (v 1) (v 3) < pi` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `azim (vec 0) (v 0) (v 1) (v 4) < pi` MP_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `&0 <= y ==> (x + y < pi ==> x < pi)`); + BY(REWRITE_TAC[Counting_spheres.AZIM_NN]); + TYPIFY `~coplanar {vec 0,v 0,v 1,v 3}` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; + BY(REPEAT (FIRST_X_ASSUM_ST `azim (vec 0) (v 0) (v 1) (v 3)` MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `&0 < azim (vec 0) (v 3) (v 0) (v 1) /\ &0 < azim (vec 0) (v 1) (v 3) (v 0)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[Zlzthic.azim_pos_iff_nz]; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + BY(MESON_TAC[Local_lemmas1.AZIM_COND_FOR_COPLANAR;SET_RULE `{a,b,c,d} = {a,d,b,c}`;SET_RULE `{a,b,c,d}={a,c,d,b}`]); + INTRO_TAC Cuxvzoz.WNWSHJT_ALT [`v 3`;`v 0`;`v 1`;`f`;`-- e`;`e`;`pi - azim (vec 0) (v 0) (v 3) (v 4)`]; + ANTS_TAC; + ASM_REWRITE_TAC[arith `a < pi - b <=> a + b < pi`]; + CONJ_TAC; + MATCH_MP_TAC Zlzthic.deformation_subset; + TYPIFY `IMAGE v (:num)` EXISTS_TAC; + ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY;IN_UNIV]; + BY(MESON_TAC[FUN_IN_IMAGE;IN_UNIV]); + REWRITE_TAC[CONJ_ASSOC]; + CONJ_TAC; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + BY(MESON_TAC[Planarity.notcoplanar_imp_notcollinear_fan;SET_RULE `{a,b,c} = {a,c,b}`]); + BY(REPEAT (FIRST_X_ASSUM_ST `x < pi` MP_TAC) THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Cuxvzoz.WNWSHJT_ALT [`v 0`;`v 1`;`v 3`;`f`;`-- e`;`e`;`pi - azim (vec 0) (v 1) (v 2) (v 3)`]; + ANTS_TAC; + ASM_REWRITE_TAC[arith `a < pi - b <=> a + b < pi`]; + CONJ_TAC; + MATCH_MP_TAC Zlzthic.deformation_subset; + TYPIFY `IMAGE v (:num)` EXISTS_TAC; + ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY;IN_UNIV]; + BY(MESON_TAC[FUN_IN_IMAGE;IN_UNIV]); + REWRITE_TAC[CONJ_ASSOC]; + CONJ_TAC; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + BY(MESON_TAC[Planarity.notcoplanar_imp_notcollinear_fan;SET_RULE `{a,b,c} = {a,c,b}`]); + BY(REPEAT (FIRST_X_ASSUM_ST `x < pi` MP_TAC) THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + COMMENT "azim additivity"; + TYPIFY `?e3. &0 < e3 /\ (!t. abs t < e3 ==> ~collinear {vec 0,f (v 0) t,f (v 4) t} /\ ~collinear {vec 0,f (v 0) t,f (v 3) t} /\ ~collinear {vec 0,f (v 0) t,f (v 1) t} /\ ~collinear {vec 0,f (v 4) t,f (v 3) t})` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_ASSUM_ST `collinear` (C INTRO_TAC [`0`;`4`]) THEN ANTS_TAC THENL [REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN NUM_REDUCE_TAC;REPEAT WEAKER_STRIP_TAC]; + FIRST_ASSUM_ST `collinear` (C INTRO_TAC [`0`;`3`]) THEN ANTS_TAC THENL [REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN NUM_REDUCE_TAC;REPEAT WEAKER_STRIP_TAC]; + FIRST_ASSUM_ST `collinear` (C INTRO_TAC [`0`;`1`]) THEN ANTS_TAC THENL [REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN NUM_REDUCE_TAC;REPEAT WEAKER_STRIP_TAC]; + FIRST_X_ASSUM_ST `collinear` (C INTRO_TAC [`4`;`3`]) THEN ANTS_TAC THENL [REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN NUM_REDUCE_TAC;REPEAT WEAKER_STRIP_TAC]; + INTRO_TAC Cuxvzoz.epsilon_quad [`e1''`;`e1'''`;`e1''''`;`e1'''''`] THEN ANTS_TAC THENL [ASM_REWRITE_TAC[];REPEAT WEAKER_STRIP_TAC]; + TYPIFY `e''''` EXISTS_TAC THEN CONJ_TAC THENL [ASM_REWRITE_TAC[];REPEAT WEAKER_STRIP_TAC]; + BY(REPEAT CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); + FIRST_X_ASSUM MP_TAC THEN REPEAT WEAKER_STRIP_TAC; + SUBCONJ_TAC; + INTRO_TAC Cuxvzoz.epsilon_triple [`e1`;`e1'`;`e3`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e'''` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + REPLICATE_TAC 3 (FIRST_X_ASSUM_ST `abs t < e` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `abs t < e` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Cuxvzoz.azim_dominated_split [`(vec 0):real^3`;`v 3`;`v 4`;`v 1`;`v 2`;`(vec 0):real^3`;`v 3`;`f (v 4) t`;`v 1`;`v 2`]; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`5`;`3`;`3`;`4`]; + ASM_REWRITE_TAC[LET_THM;arith `SUC 3 = 4 /\ 3 + 4 = 7 /\ 3 + 3 = 6 /\ 3 <= 5 /\ 0 < 3 /\ 3 < 4 /\ 4 < 5`]; + DISCH_THEN (SUBST1_TAC o GSYM) THEN ASM_REWRITE_TAC[arith `x <= x`]; + INTRO_TAC Cuxvzoz.azim_dominated_split [`(vec 0):real^3`;`v 3`;`v 4`;`v 0`;`v 1`;`(vec 0):real^3`;`v 3`;`f (v 4) t`;`f (v 0) t`;`v 1`]; + ASM_REWRITE_TAC[arith `x <= x`]; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`5`;`3`;`2`;`3`]; + NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[LET_THM]; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`] THEN ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `~collinear {vec 0, v 1, v 3} /\ ~collinear {vec 0, v 1, v 3} /\ ~collinear {vec 0, v 2, v 3}` (unlist REWRITE_TAC); + BY(REPEAT CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN NUM_REDUCE_TAC); + BY(REPLICATE_TAC 15 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + (DISCH_TAC); + COMMENT "azim 0 additive"; + FIRST_X_ASSUM MP_TAC THEN REPEAT WEAKER_STRIP_TAC; + SUBCONJ_TAC; + INTRO_TAC Cuxvzoz.epsilon_triple [`e'`;`e1'`;`e3`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''''` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `abs t < e` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `abs t < e` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Fan.sum3_azim_fan; + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN MP_TAC PI_POS THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + COMMENT "azim 1 additive"; + SUBCONJ_TAC; + INTRO_TAC Cuxvzoz.epsilon_pair [`e''`;`e3`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e'''` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `abs t < e` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `abs t < e` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Fan.sum3_azim_fan; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN MP_TAC PI_POS THEN REAL_ARITH_TAC); + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`]; + ASM_REWRITE_TAC[]; + BY(CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN NUM_REDUCE_TAC); + REPEAT WEAKER_STRIP_TAC; + COMMENT "pi bounds"; + CONJ_TAC; + TYPIFY `e'` EXISTS_TAC; + CONJ_TAC THENL [ASM_REWRITE_TAC[];REPEAT WEAKER_STRIP_TAC]; + TYPIFY ` &0 < azim (vec 0) (f (v 0) t) (f (v 1) t) (f (v 3) t) /\ azim (vec 0) (f (v 0) t) (f (v 1) t) (f (v 3) t) < pi - azim (vec 0) (v 0) (v 3) (v 4)` ENOUGH_TO_SHOW_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `&0 <= b ==> (&0 < a /\ a < pi - b ==> &0 < a /\ a < pi)`); + BY(REWRITE_TAC[Counting_spheres.AZIM_NN]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + MATCH_MP_TAC Oxl_def.periodic_numseg; + TYPIFY `5` EXISTS_TAC; + REWRITE_TAC[arith `~(5 = 0)`]; + CONJ_TAC; + FIRST_X_ASSUM_ST `periodic` MP_TAC; + REWRITE_TAC[Oxl_def.periodic]; + REWRITE_TAC[arith `(i+5)+j = (i+j)+5`]; + BY(DISCH_THEN (unlist REWRITE_TAC)); + REWRITE_TAC[IN_NUMSEG;arith `(0 <= i /\ i <= 5-1) <=> (i = 0 \/ i = 1 \/ i = 2 \/ i = 3 \/ i = 4)`]; + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN NUM_REDUCE_TAC; + EXISTS_TAC `&1` THEN REPEAT (FIRST_X_ASSUM_ST `azim (vec 0) (v 0) (v 1) (v 4) < pi` MP_TAC); + BY(MESON_TAC[arith `&0 < &1`;arith `x < pi ==> ~(x=pi)`]); + REPEAT (FIRST_X_ASSUM_ST `+` kill); + ASM_REWRITE_TAC[] THEN EXISTS_TAC `&1` THEN REPEAT (FIRST_X_ASSUM_ST `azim (vec 0) (v 1) (v 2) (v 0) < pi` MP_TAC); + BY(MESON_TAC[arith `&0 < &1`;arith `x < pi ==> ~(x=pi)`]); + BY(ASM_REWRITE_TAC[] THEN EXISTS_TAC `&1` THEN MESON_TAC[arith `&0 < &1`;arith `x <= x`]); + INTRO_TAC Cuxvzoz.epsilon_triple [`e1''`;`e1'`;`e1`] THEN ANTS_TAC THENL [ASM_REWRITE_TAC[];REPEAT WEAKER_STRIP_TAC]; + TYPIFY `e'''` EXISTS_TAC THEN CONJ_TAC THENL [ASM_REWRITE_TAC[];REPEAT WEAKER_STRIP_TAC]; + REPLICATE_TAC 3(FIRST_X_ASSUM (C INTRO_TAC [`t`]) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC); + REPEAT (FIRST_X_ASSUM_ST `azim` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `a = pi` (SUBST1_TAC o GSYM); + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + TYPIFY `e1'` EXISTS_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `4` (C INTRO_TAC [`t`])); + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) +*) + +let azim5_reduction = prove_by_refinement( + `!s f v e. + is_scs_v39 s /\ + scs_k_v39 s = 5 /\ + BBs_v39 s v /\ + scs_generic v /\ + deformation f (IMAGE v (:num)) (--e,e) /\ + (!w t. ~(w = v 4) /\ ~(w = v 0) ==> f w t = w) /\ + azim (vec 0) (v 0) (v 1) (v 4) < pi /\ + azim (vec 0) (v 1) (v 2) (v 0) < pi /\ + &0 < azim (vec 0) (v 0) (v 1) (v 3) /\ + (?e1. &0 < e1 /\ + (!t. abs t < e1 + ==> azim (vec 0) (v 3) (f (v 0) t) (v 1) <= + azim (vec 0) (v 3) (v 0) (v 1))) /\ + (?e1. &0 < e1 /\ + (!t. abs t < e1 + ==> dist (v 3,f (v 4) t) = dist (v 3,v 4) /\ + dist (f (v 0) t,f (v 4) t) = dist (v 0,v 4) /\ + norm (f (v 4) t) = norm (v 4) /\ + dist (f (v 0) t,v 3) = dist (v 0,v 3) /\ + dist (f (v 0) t,v 1) = dist (v 0,v 1) - abs t /\ + norm (f (v 0) t) = norm (v 0) /\ + (coplanar {vec 0, v 3, v 4, v 0} + ==> coplanar {vec 0, v 3, f (v 4) t, f (v 0) t}))) + ==> azim (vec 0) (v 3) (v 4) (v 2) = + azim (vec 0) (v 3) (v 4) (v 0) + + azim (vec 0) (v 3) (v 0) (v 1) + + azim (vec 0) (v 3) (v 1) (v 2) /\ + azim (vec 0) (v 0) (v 1) (v 4) = + azim (vec 0) (v 0) (v 1) (v 3) + azim (vec 0) (v 0) (v 3) (v 4) /\ + azim (vec 0) (v 1) (v 2) (v 0) = + azim (vec 0) (v 1) (v 2) (v 3) + azim (vec 0) (v 1) (v 3) (v 0) /\ + (?e1. &0 < e1 /\ + (!t. abs t < e1 + ==> azim (vec 0) (v 3) (f (v 4) t) (v 2) = + azim (vec 0) (v 3) (f (v 4) t) (f (v 0) t) + + azim (vec 0) (v 3) (f (v 0) t) (v 1) + + azim (vec 0) (v 3) (v 1) (v 2) /\ + azim (vec 0) (f (v 0) t) (v 1) (f (v 4) t) = + azim (vec 0) (f (v 0) t) (v 1) (v 3) + + azim (vec 0) (f (v 0) t) (v 3) (f (v 4) t) /\ + azim (vec 0) (v 1) (v 2) (f (v 0) t) = + azim (vec 0) (v 1) (v 2) (v 3) + + azim (vec 0) (v 1) (v 3) (f (v 0) t) /\ + &0 < azim (vec 0) (f (v 0) t) (v 1) (v 3) /\ + azim (vec 0) (f (v 0) t) (v 1) (v 3) < pi)) /\ + (!i. ?e0. &0 < e0 /\ + (azim (vec 0) (v i) (v (i + 1)) (v (i + 4)) = pi + ==> (!t. abs t < e0 + ==> azim (vec 0) (f (v i) t) (f (v (i + 1)) t) + (f (v (i + 4)) t) <= + pi))) /\ + (?e1. &0 < e1 /\ + (!t. abs t < e1 + ==> azim (vec 0) (v 3) (f (v 4) t) (f (v 0) t) = + azim (vec 0) (v 3) (v 4) (v 0) /\ + azim (vec 0) (f (v 4) t) (f (v 0) t) (v 3) = + azim (vec 0) (v 4) (v 0) (v 3) /\ + azim (vec 0) (f (v 0) t) (v 3) (f (v 4) t) = + azim (vec 0) (v 0) (v 3) (v 4)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASSUME_TAC (arith `~(0 = 5)`); + TYPIFY `!i. i MOD 5 < 5` (C SUBGOAL_THEN ASSUME_TAC); + BY((FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION]); + TYPIFY `periodic v 5` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN MESON_TAC[]); + TYPIFY `!i. v (i MOD 5) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[arith `~(0=5)`]); + TYPIFY `v 5 = v 0 /\ v 6 = v 1 /\ v 7 = v 2 /\ v 8 = v 3 /\ v 9 = v 4` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM ((unlist ONCE_REWRITE_TAC) o GSYM); + BY(REWRITE_TAC[Ocbicby.MOD_5_EXPLICIT;arith `8 = 1*5 + 3`;arith `9 = 1*5 + 4`;MOD_MULT_ADD]); + INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`5`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY ` generic (IMAGE v (:num)) (IMAGE (\i. {v i, v (SUC i)}) (:num)) /\ convex_local_fan (IMAGE v (:num), IMAGE (\i. {v i, v (SUC i)}) (:num), IMAGE (\i. v i,v (SUC i)) (:num))` (C SUBGOAL_THEN ASSUME_TAC); + CONJ2_TAC; + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[LET_THM;Appendix.BBs_v39]; + BY(MESON_TAC[arith `~(5 <= 3)`]); + BY(FIRST_X_ASSUM_ST `scs_generic` MP_TAC THEN MESON_TAC[Appendix.scs_generic]); + FIRST_X_ASSUM MP_TAC THEN BURY_MP_TAC; + COMMENT "first addition"; + SUBCONJ_TAC; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`5`;`3`;`3`;`4`]; + ASM_REWRITE_TAC[LET_THM;arith `SUC 3 = 4 /\ 3 + 4 = 7 /\ 3 + 3 = 6 /\ 3 <= 5 /\ 0 < 3 /\ 3 < 4 /\ 4 < 5`]; + DISCH_THEN SUBST1_TAC; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`5`;`3`;`2`;`3`]; + ASM_REWRITE_TAC[LET_THM;arith `SUC 3 = 4 /\ 3 + 3 = 6 /\ 3 + 2 = 5 /\ 3 <= 5 /\ 0 < 2 /\ 2 < 3 /\ 3 < 5`]; + DISCH_THEN SUBST1_TAC; + BY(REAL_ARITH_TAC); + DISCH_TAC; + COMMENT "second addition"; + SUBCONJ_TAC; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`5`;`0`;`3`;`4`]; + NUM_REDUCE_TAC; + BY(ASM_REWRITE_TAC[LET_THM]); + COMMENT "third addition"; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`5`;`0`;`3`;`4`]; + NUM_REDUCE_TAC; + ASM_REWRITE_TAC[LET_THM]; + DISCH_TAC; + DISCH_TAC; + SUBCONJ_TAC; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`5`;`1`;`2`;`4`]; + NUM_REDUCE_TAC; + BY(ASM_REWRITE_TAC[LET_THM]); + DISCH_TAC; + TYPIFY `!i j. i < 5 /\ j < 5 /\ ~(i = j) ==> ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[]); + TYPIFY `!t. f (v 1) t = v 1 /\ f (v 2) t = v 2 /\ f (v 3) t = v 3` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + COMMENT "colinearity"; + TYPIFY `!i j. ~(v i = v j) ==> ~collinear {vec 0,v i, v j}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT GEN_TAC THEN DISCH_TAC; + MATCH_MP_TAC Zlzthic.PROPERTIES_GENERIC_LOCAL_FAN_ALT; + GEXISTL_TAC [`IMAGE v (:num)`;`IMAGE (\i. {v i, v (SUC i)}) (:num)`;`IMAGE (\i. (v i, v (SUC i))) (:num)`]; + ASM_REWRITE_TAC[IN_IMAGE;IN_UNIV]; + CONJ_TAC; + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + BY(MESON_TAC[]); + COMMENT "deform collinear"; + TYPIFY `!i j. ~collinear {vec 0,v i,v j} ==> (?e1. &0 < e1 /\ (!t. abs t < e1 ==> ~collinear {vec 0, f (v i) t, f (v j) t}))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GEN_ALL Local_lemmas1.CONTINUOUS_PRESERVE_COLLINEAR) [`&0`;`(vec 0):real^3`;`f (v i)`;`f (v j)`]; + ANTS_TAC; + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation;arith `abs(&0 - x) = abs x`]; + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + BY(REWRITE_TAC[arith `abs(&0 - r') = abs r'`]); + TYPIFY `!i. azim (vec 0) (v i) (v (i+1)) (v(i+4)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[arith `i+1 = SUC i`;arith `4 = 5 - 1`]; + GEN_TAC; + MATCH_MP_TAC (REWRITE_RULE[LET_THM] Terminal.convex_local_fan_azim_le_pi); + ASM_REWRITE_TAC[arith `3 <= 5`]; + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM]; + BY(DISCH_THEN (unlist REWRITE_TAC)); + COMMENT "merge e"; + TYPIFY_GOAL_THEN `(?e1. &0 < e1 /\ (!t. abs t < e1 ==> azim (vec 0) (v 3) (f (v 4) t) (v 2) = azim (vec 0) (v 3) (f (v 4) t) (f (v 0) t) + azim (vec 0) (v 3) (f (v 0) t) (v 1) + azim (vec 0) (v 3) (v 1) (v 2) )) /\(?e1. &0 < e1 /\ (!t. abs t < e1 ==> azim (vec 0) (f (v 0) t) (v 1) (f (v 4) t) = azim (vec 0) (f (v 0) t) (v 1) (v 3) + azim (vec 0) (f (v 0) t) (v 3) (f (v 4) t) )) /\ (?e1. &0 < e1 /\ (!t. abs t < e1 ==> azim (vec 0) (v 1) (v 2) (f (v 0) t) = azim (vec 0) (v 1) (v 2) (v 3) + azim (vec 0) (v 1) (v 3) (f (v 0) t))) /\ (?e1. &0 < e1 /\ (!t. abs t < e1 ==> &0 < azim (vec 0) (f (v 0) t) (v 1) (v 3) /\ azim (vec 0) (f (v 0) t) (v 1) (v 3) < pi)) ==> (?e1. &0 < e1 /\ (!t. abs t < e1 ==> azim (vec 0) (v 3) (f (v 4) t) (v 2) = azim (vec 0) (v 3) (f (v 4) t) (f (v 0) t) + azim (vec 0) (v 3) (f (v 0) t) (v 1) + azim (vec 0) (v 3) (v 1) (v 2) /\ azim (vec 0) (f (v 0) t) (v 1) (f (v 4) t) = azim (vec 0) (f (v 0) t) (v 1) (v 3) + azim (vec 0) (f (v 0) t) (v 3) (f (v 4) t) /\ azim (vec 0) (v 1) (v 2) (f (v 0) t) = azim (vec 0) (v 1) (v 2) (v 3) + azim (vec 0) (v 1) (v 3) (f (v 0) t) /\ &0 < azim (vec 0) (f (v 0) t) (v 1) (v 3) /\ azim (vec 0) (f (v 0) t) (v 1) (v 3) < pi))` (GMATCH_SIMP_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Cuxvzoz.epsilon_quad [`e1''`;`e1'''`;`e1''''`;`e1'''''`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''''` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC THEN REPEAT CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[]); + REWRITE_TAC[GSYM CONJ_ASSOC]; + COMMENT "azim bounds"; + TYPIFY `azim (vec 0) (v 0) (v 1) (v 3) < pi` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `azim (vec 0) (v 0) (v 1) (v 4) < pi` MP_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `&0 <= y ==> (x + y < pi ==> x < pi)`); + BY(REWRITE_TAC[Counting_spheres.AZIM_NN]); + TYPIFY `~coplanar {vec 0,v 0,v 1,v 3}` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; + BY(REPEAT (FIRST_X_ASSUM_ST `azim (vec 0) (v 0) (v 1) (v 3)` MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `&0 < azim (vec 0) (v 3) (v 0) (v 1) /\ &0 < azim (vec 0) (v 1) (v 3) (v 0)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[Zlzthic.azim_pos_iff_nz]; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + BY(MESON_TAC[Local_lemmas1.AZIM_COND_FOR_COPLANAR;SET_RULE `{a,b,c,d} = {a,d,b,c}`;SET_RULE `{a,b,c,d}={a,c,d,b}`]); + INTRO_TAC Cuxvzoz.WNWSHJT_ALT [`v 3`;`v 0`;`v 1`;`f`;`-- e`;`e`;`pi - azim (vec 0) (v 0) (v 3) (v 4)`]; + ANTS_TAC; + ASM_REWRITE_TAC[arith `a < pi - b <=> a + b < pi`]; + CONJ_TAC; + MATCH_MP_TAC Zlzthic.deformation_subset; + TYPIFY `IMAGE v (:num)` EXISTS_TAC; + ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY;IN_UNIV]; + BY(MESON_TAC[FUN_IN_IMAGE;IN_UNIV]); + REWRITE_TAC[CONJ_ASSOC]; + CONJ_TAC; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + BY(MESON_TAC[Planarity.notcoplanar_imp_notcollinear_fan;SET_RULE `{a,b,c} = {a,c,b}`]); + BY(REPEAT (FIRST_X_ASSUM_ST `x < pi` MP_TAC) THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Cuxvzoz.WNWSHJT_ALT [`v 0`;`v 1`;`v 3`;`f`;`-- e`;`e`;`pi - azim (vec 0) (v 1) (v 2) (v 3)`]; + ANTS_TAC; + ASM_REWRITE_TAC[arith `a < pi - b <=> a + b < pi`]; + CONJ_TAC; + MATCH_MP_TAC Zlzthic.deformation_subset; + TYPIFY `IMAGE v (:num)` EXISTS_TAC; + ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY;IN_UNIV]; + BY(MESON_TAC[FUN_IN_IMAGE;IN_UNIV]); + REWRITE_TAC[CONJ_ASSOC]; + CONJ_TAC; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + BY(MESON_TAC[Planarity.notcoplanar_imp_notcollinear_fan;SET_RULE `{a,b,c} = {a,c,b}`]); + BY(REPEAT (FIRST_X_ASSUM_ST `x < pi` MP_TAC) THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + COMMENT "034 triangle"; + TYPIFY `?e3. &0 < e3 /\ (!t. abs t < e3 ==> ~collinear {vec 0,f (v 0) t,f (v 4) t} /\ ~collinear {vec 0,f (v 0) t,f (v 3) t} /\ ~collinear {vec 0,f (v 0) t,f (v 1) t} /\ ~collinear {vec 0,f (v 4) t,f (v 3) t})` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_ASSUM_ST `collinear` (C INTRO_TAC [`0`;`4`]) THEN ANTS_TAC THENL [REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN NUM_REDUCE_TAC;REPEAT WEAKER_STRIP_TAC]; + FIRST_ASSUM_ST `collinear` (C INTRO_TAC [`0`;`3`]) THEN ANTS_TAC THENL [REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN NUM_REDUCE_TAC;REPEAT WEAKER_STRIP_TAC]; + FIRST_ASSUM_ST `collinear` (C INTRO_TAC [`0`;`1`]) THEN ANTS_TAC THENL [REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN NUM_REDUCE_TAC;REPEAT WEAKER_STRIP_TAC]; + FIRST_X_ASSUM_ST `collinear` (C INTRO_TAC [`4`;`3`]) THEN ANTS_TAC THENL [REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN NUM_REDUCE_TAC;REPEAT WEAKER_STRIP_TAC]; + INTRO_TAC Cuxvzoz.epsilon_quad [`e1''`;`e1'''`;`e1''''`;`e1'''''`] THEN ANTS_TAC THENL [ASM_REWRITE_TAC[];REPEAT WEAKER_STRIP_TAC]; + TYPIFY `e''''` EXISTS_TAC THEN CONJ_TAC THENL [ASM_REWRITE_TAC[];REPEAT WEAKER_STRIP_TAC]; + BY(REPEAT CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); + FIRST_X_ASSUM MP_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `!i. f (v i) (&0) = v i` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation]; + REPEAT WEAKER_STRIP_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN MATCH_MP_TAC FUN_IN_IMAGE THEN REWRITE_TAC[IN_UNIV]); + REWRITE_TAC[CONJ_ASSOC] THEN SUBCONJ2_TAC; + TYPIFY `?e2. &0 < e2 /\ (!t. abs t < e2 ==> azim (vec 0) (f (v 4) t) (f (v 0) t) (v 3) <= pi)` ASM_CASES_TAC; + FIRST_X_ASSUM MP_TAC THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Cuxvzoz.epsilon_triple [`e1'`;`e3`;`e2`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e'''` EXISTS_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + REPLICATE_TAC 3 (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `abs t < e` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `azim (vec 0) (f (v 0) t) (v 3) (f (v 4) t) <= pi /\ azim (vec 0) (v 3) (f (v 4) t) (f (v 0) t) <= pi /\ azim (vec 0) (v 0) (v 3) (v 4) <= pi /\ azim (vec 0) (v 3) (v 4) (v 0) <= pi /\ azim (vec 0) (v 4) (v 0) (v 3) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM MP_TAC THEN (FIRST_X_ASSUM_ST `x <= pi` (C INTRO_TAC [`4`])); + NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[]; + BY(MESON_TAC[Xivphks.FSQKWKK]); + FIRST_X_ASSUM MP_TAC THEN REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `a <= pi` (ASSUME_TAC o (MATCH_MP (REWRITE_RULE[TAUT `(a /\ b /\ c ==> d) <=> (c ==> (a /\ b ==> d))`] azim_dih_y)))); + REPLICATE_TAC 6 (POP_ASSUM GMATCH_SIMP_TAC); + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`] THEN ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `(~collinear {vec 0, v 0, v 4} /\ ~collinear {vec 0, v 3, v 4}) /\ (~collinear {vec 0, v 4, v 3} /\ ~collinear {vec 0, v 0, v 3}) /\ (~collinear {vec 0, v 3, v 0} /\ ~collinear {vec 0, v 4, v 0})` (unlist REWRITE_TAC); + BY(REPEAT CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN NUM_REDUCE_TAC); + ASM_REWRITE_TAC[DIST_SYM]; + BY(REPEAT (FIRST_X_ASSUM_ST `dist` MP_TAC) THEN REWRITE_TAC[DIST_SYM;DIST_0] THEN REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]); + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM kill; + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[]; + COMMENT "second half of assumption. All angles 034 <=pi"; + TYPIFY `coplanar {vec 0, v 3, v 4, v 0}` ASM_CASES_TAC; + TYPIFY `e1'` EXISTS_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`t`]) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + TYPIFY `{vec 0, v 3, f (v 4) t, f (v 0) t} = {vec 0, f (v 4) t, f (v 0) t, v 3}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + REWRITE_TAC[GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; + BY(MP_TAC PI_POS THEN REAL_ARITH_TAC); + POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,c,d,b}`] THEN REWRITE_TAC[GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR;DE_MORGAN_THM] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `&0 < azim (vec 0) (v 4) (v 0) (v 3) /\ azim (vec 0) (v 4) (v 0) (v 3) < pi` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[arith `&0 < x <=> &0 <= x /\ ~(x = &0) `;arith `x < pi <=> x <= pi /\ ~(x = pi)`]; + REWRITE_TAC[Counting_spheres.AZIM_NN]; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `a <= pi` (C INTRO_TAC [`4`]) THEN NUM_REDUCE_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `&0 < e` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation;IN_REAL_INTERVAL]; + BY(MESON_TAC[]); + INTRO_TAC Cuxvzoz.epsilon_pair [`e3`;`e`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Zlzthic.WNWSHJT [`v 3`;`v 4`;`v 0`;`f`;`-- e'''`;`e'''`] THEN ASM_REWRITE_TAC[]; + ANTS_TAC; + TYPIFY_GOAL_THEN `~collinear {vec 0, v 4, v 0} /\ ~collinear {vec 0, v 4, v 3}` (unlist REWRITE_TAC); + BY(REPEAT CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN NUM_REDUCE_TAC); + MATCH_MP_TAC Cuxvzoz.deformation_restrict; + TYPIFY `e` EXISTS_TAC THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC Zlzthic.deformation_subset; + TYPIFY `(IMAGE v (:num))` EXISTS_TAC; + ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + BY(GEN_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC FUN_IN_IMAGE THEN REWRITE_TAC[IN_UNIV]); + BY(MESON_TAC[arith `x < pi ==> x <= pi`]); + (REPEAT WEAKER_STRIP_TAC THEN REWRITE_TAC[GSYM CONJ_ASSOC]); + COMMENT "azim additivity"; + SUBCONJ_TAC; + INTRO_TAC Cuxvzoz.epsilon_triple [`e1`;`e1''`;`e3`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e'''` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + REPLICATE_TAC 3 (FIRST_X_ASSUM_ST `abs t < e` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `abs t < e` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Cuxvzoz.azim_dominated_split [`(vec 0):real^3`;`v 3`;`v 4`;`v 1`;`v 2`;`(vec 0):real^3`;`v 3`;`f (v 4) t`;`v 1`;`v 2`]; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`5`;`3`;`3`;`4`]; + ASM_REWRITE_TAC[LET_THM;arith `SUC 3 = 4 /\ 3 + 4 = 7 /\ 3 + 3 = 6 /\ 3 <= 5 /\ 0 < 3 /\ 3 < 4 /\ 4 < 5`]; + DISCH_THEN (SUBST1_TAC o GSYM) THEN ASM_REWRITE_TAC[arith `x <= x`]; + INTRO_TAC Cuxvzoz.azim_dominated_split [`(vec 0):real^3`;`v 3`;`v 4`;`v 0`;`v 1`;`(vec 0):real^3`;`v 3`;`f (v 4) t`;`f (v 0) t`;`v 1`]; + ASM_REWRITE_TAC[arith `x <= x`]; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`5`;`3`;`2`;`3`]; + NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[LET_THM]; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`] THEN ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `~collinear {vec 0, v 1, v 3} /\ ~collinear {vec 0, v 1, v 3} /\ ~collinear {vec 0, v 2, v 3}` (unlist REWRITE_TAC); + BY(REPEAT CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN NUM_REDUCE_TAC); + BY(REPLICATE_TAC 15 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT "azim 0 additive"; + REPEAT WEAKER_STRIP_TAC; + SUBCONJ_TAC; + INTRO_TAC Cuxvzoz.epsilon_triple [`e'`;`e1''`;`e3`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''''` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `abs t < e` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `abs t < e` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Fan.sum3_azim_fan; + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 15 (FIRST_X_ASSUM MP_TAC) THEN MP_TAC PI_POS THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + COMMENT "azim 1 additive"; + SUBCONJ_TAC; + INTRO_TAC Cuxvzoz.epsilon_pair [`e''`;`e3`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e'''` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `abs t < e` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `abs t < e` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Fan.sum3_azim_fan; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN MP_TAC PI_POS THEN REAL_ARITH_TAC); + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`]; + ASM_REWRITE_TAC[]; + BY(CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN NUM_REDUCE_TAC); + REPEAT WEAKER_STRIP_TAC; + COMMENT "pi bounds"; + CONJ_TAC; + TYPIFY `e'` EXISTS_TAC; + CONJ_TAC THENL [ASM_REWRITE_TAC[];REPEAT WEAKER_STRIP_TAC]; + TYPIFY ` &0 < azim (vec 0) (f (v 0) t) (f (v 1) t) (f (v 3) t) /\ azim (vec 0) (f (v 0) t) (f (v 1) t) (f (v 3) t) < pi - azim (vec 0) (v 0) (v 3) (v 4)` ENOUGH_TO_SHOW_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `&0 <= b ==> (&0 < a /\ a < pi - b ==> &0 < a /\ a < pi)`); + BY(REWRITE_TAC[Counting_spheres.AZIM_NN]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + MATCH_MP_TAC Oxl_def.periodic_numseg; + TYPIFY `5` EXISTS_TAC; + REWRITE_TAC[arith `~(5 = 0)`]; + CONJ_TAC; + FIRST_X_ASSUM_ST `periodic` MP_TAC; + REWRITE_TAC[Oxl_def.periodic]; + REWRITE_TAC[arith `(i+5)+j = (i+j)+5`]; + BY(DISCH_THEN (unlist REWRITE_TAC)); + REWRITE_TAC[IN_NUMSEG;arith `(0 <= i /\ i <= 5-1) <=> (i = 0 \/ i = 1 \/ i = 2 \/ i = 3 \/ i = 4)`]; + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN NUM_REDUCE_TAC; + EXISTS_TAC `&1` THEN REPEAT (FIRST_X_ASSUM_ST `azim (vec 0) (v 0) (v 1) (v 4) < pi` MP_TAC); + BY(MESON_TAC[arith `&0 < &1`;arith `x < pi ==> ~(x=pi)`]); + REPEAT (FIRST_X_ASSUM_ST `+` kill); + ASM_REWRITE_TAC[] THEN EXISTS_TAC `&1` THEN REPEAT (FIRST_X_ASSUM_ST `azim (vec 0) (v 1) (v 2) (v 0) < pi` MP_TAC); + BY(MESON_TAC[arith `&0 < &1`;arith `x < pi ==> ~(x=pi)`]); + BY(ASM_REWRITE_TAC[] THEN EXISTS_TAC `&1` THEN MESON_TAC[arith `&0 < &1`;arith `x <= x`]); + INTRO_TAC Cuxvzoz.epsilon_triple [`e1'''`;`e1''`;`e1`] THEN ANTS_TAC THENL [ASM_REWRITE_TAC[];REPEAT WEAKER_STRIP_TAC]; + TYPIFY `e'''` EXISTS_TAC THEN CONJ_TAC THENL [ASM_REWRITE_TAC[];REPEAT WEAKER_STRIP_TAC]; + REPLICATE_TAC 3(FIRST_X_ASSUM (C INTRO_TAC [`t`]) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC); + REPEAT (FIRST_X_ASSUM_ST `azim` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `a = pi` (SUBST1_TAC o GSYM); + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 15 (FIRST_X_ASSUM MP_TAC) THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + TYPIFY `e1''` EXISTS_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `azim a b c d = azim a' b' c' d'` (C INTRO_TAC [`t`]); + BY(ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[arith `x <= x`]) + ]);; + (* }}} *) + +let L13_LEMMA = prove_by_refinement( + `main_nonlinear_terminal_v11 + ==> + (!V E FF s v. IMAGE (\i. v i,v (SUC i)) (:num) = FF + /\ is_scs_v39 s + /\ scs_k_v39 s = 5 + /\ scs_basic_v39 s + /\ scs_generic v + /\ BBs_v39 s v + /\ IMAGE v (:num) = V + /\ IMAGE (\i. {v i, v (SUC i)}) (:num) = E + /\ ~coplanar {vec 0, v 1, v 2, v 0} + ==> &0 < azim (vec 0) (v 0) (v 1) (v 3) )`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `&0 < a <=> ~(a = &0) /\ (&0 <= a)`]; + REWRITE_TAC[Counting_spheres.AZIM_NN]; + DISCH_TAC; + FIRST_X_ASSUM_ST `coplanar {vec 0,v 1 ,v 2,v 0}` MP_TAC; + REWRITE_TAC[]; + INTRO_TAC EGHNAVX_SCS [`s`;`5`;`v`;`0`]; + ASM_REWRITE_TAC[LET_THM]; + NUM_REDUCE_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM kill; + FIRST_X_ASSUM (C INTRO_TAC [`3`;`2`]); + NUM_REDUCE_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[coplanar]; + GEXISTL_TAC [`(vec 0):real^3`;`v 0`;`v 1`]; + TYPIFY `{vec 0, v 0, v 1} SUBSET affine hull {vec 0, v 0, v 1} /\ v 2 IN affine hull {vec 0, v 0, v 1}` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + REWRITE_TAC[HULL_SUBSET]; + INTRO_TAC AFF_GT_SUBSET_AFFINE_HULL [`{vec 0,v 0}`;`{v 1}`]; + TYPIFY `{vec 0, v 0} UNION {v 1} = {vec 0, v 0, v 1}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN SET_TAC[]) + ]);; + (* }}} *) + +let IUNBUIG = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (!s FF v. + IMAGE (\i. (v i,v (SUC i))) (:num) = FF /\ + is_scs_v39 s /\ + scs_k_v39 s = 5 /\ + MMs_v39 s v /\ + scs_basic_v39 s /\ + scs_generic v /\ + (!i j. scs_diag 5 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4 * h0 < scs_b_v39 s i j) /\ + scs_a_v39 s 0 1 = &2 /\ + scs_b_v39 s 0 1 <= cstab /\ + interior_angle1 (vec 0) FF (v 0) < pi /\ interior_angle1 (vec 0) FF (v 1) < pi /\ + (!i. ~(i MOD 5 = 0) ==> dist(v i,v (i+1)) = &2) /\ + xrr (norm (v 0)) (norm (v 3)) (dist(v 0,v 3)) <= #15.53 /\ + xrr (norm (v 1)) (norm (v 3)) (dist(v 1,v 3)) <= #15.53 ==> + dist(v 0,v 1) = &2)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `BBprime2_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.scs_basic;Ayqjtmd.unadorned_MMs]); + TYPIFY `BBprime_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime2_v39]); + TYPIFY `BBs_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime_v39]); + INTRO_TAC Appendix.BBs_v39 [`s`;`v`]; + ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;Terminal.IMAGE_SUBSET_IN;IN_UNIV;arith `~(5 <= 3)`]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `V = IMAGE v (:num)`; + TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + EXPAND_TAC "V"; + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`5`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!i. interior_angle1 (vec 0) FF (v i) = azim (vec 0) (v i) (v (i+1)) (v (i+4))` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + EXPAND_TAC "FF"; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] (GSYM Ocbicby.INTERIOR_ANGLE1_AZIM)); + TYPIFY `s` EXISTS_TAC; + BY(ASM_REWRITE_TAC[IN;arith `5 - 1 = 4`;arith `3 < 5`;arith `SUC i = i+1`]); + INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`]; + ASM_REWRITE_TAC[LET_THM;IN;arith `5-1 = 4`;arith `SUC i = i+1`]; + DISCH_TAC; + TYPIFY `!i. v (i MOD 5) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[arith `~(0=5)`]); + TYPIFY `v 5 = v 0 /\ v 6 = v 1 /\ v 7 = v 2 /\ v 8 = v 3 /\ v 9 = v 4` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM ((unlist ONCE_REWRITE_TAC) o GSYM); + BY(REWRITE_TAC[Ocbicby.MOD_5_EXPLICIT;arith `8 = 1*5 + 3`;arith `9 = 1*5 + 4`;MOD_MULT_ADD]); + TYPIFY `~coplanar {vec 0, v 0,v 1,v 4} /\ ~coplanar {vec 0,v 1,v 2,v 0}` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; + BY(ASM_MESON_TAC[arith `x < pi ==> ~(x = pi)`;arith `&0 < a ==> ~(a = &0)`;arith `0+i=i`;arith `1+1=2 /\ 1+4=5`]); + TYPIFY `generic V E` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `scs_generic` MP_TAC THEN ASM_REWRITE_TAC[Appendix.scs_generic]); + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`5`;`0`;`3`;`4`]; + NUM_REDUCE_TAC; + ASM_REWRITE_TAC[LET_THM]; + DISCH_TAC; + COMMENT "collinearity"; + TYPIFY `!i j. ~(v i = v j) ==> ~collinear {vec 0,v i, v j}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT GEN_TAC THEN DISCH_TAC; + MATCH_MP_TAC Zlzthic.PROPERTIES_GENERIC_LOCAL_FAN_ALT; + GEXISTL_TAC [`IMAGE v (:num)`;`IMAGE (\i. {v i, v (SUC i)}) (:num)`;`IMAGE (\i. (v i, v (SUC i))) (:num)`]; + ASM_REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + TYPIFY `!i j. i < 5 /\ j < 5 /\ ~(i = j) ==> ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + COMMENT "non coplanar 013 digression"; + INTRO_TAC (UNDISCH L13_LEMMA) [`V`;`E`;`FF`;`s`;`v`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + REPEAT (FIRST_X_ASSUM_ST `interior_angle1 a b c < pi` MP_TAC) THEN ASM_REWRITE_TAC[] THEN NUM_REDUCE_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `azim (vec 0) (v 0) (v 1) (v 3) < pi` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `+` MP_TAC; + MATCH_MP_TAC (arith `&0 <= a2 /\ a < pi ==> (a = a1 + a2 ==> a1 < pi)`); + REWRITE_TAC[Counting_spheres.AZIM_NN]; + BY(ASM_REWRITE_TAC[]); + TYPIFY `~coplanar {vec 0,v 0, v 1,v 3}` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; + BY(REPLICATE_TAC 4 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT "introduce deformation"; + INTRO_TAC deform_pent_exists [`V`;`(\t. -- abs t)`;`v 3`;`v 4`;`v 0`;`v 1`;`&1`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ANTS_TAC; + REWRITE_TAC[arith `&0 < &1`;arith `--abs (&0) = &0`]; + CONJ_TAC; + DISCH_TAC; + INTRO_TAC coplanar_cross_reduction [`s`;`5`;`v`;`3`]; + NUM_REDUCE_TAC; + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + FIRST_X_ASSUM MP_TAC; + BY(MESON_TAC[SET_RULE `{a,b,c,d} = {a,d,b,c}`]); + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN NUM_REDUCE_TAC); + CONJ_TAC; + INTRO_TAC (GEN_ALL Local_lemmas.CONVEX_LOFA_IMP_INANGLE_LE_PI) [`E`;`V`;`FF`;`v 4`]; + ASM_REWRITE_TAC[]; + NUM_REDUCE_TAC; + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + INTRO_TAC Trigonometry.JBDNJJB [`v 0`;`v 1`;`v 3`]; + TYPIFY `v 0 dot (v 1 cross v 3) = ((v 0 cross v 1) dot v 3)` (C SUBGOAL_THEN SUBST1_TAC); + BY(VEC3_TAC); + REWRITE_TAC[arith `x > &0 <=> &0 < x`]; + ONCE_REWRITE_TAC[Leaf_cell.RE_EQVL_SYM]; + REWRITE_TAC[Trigonometry2.re_eqvl]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[Cuxvzoz.sin_azim_pos]); + GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT; + REWRITE_TAC[Ocbicby.REAL_OPEN_REAL_INTERVAL]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC REAL_CONTINUOUS_NEG; + BY(REWRITE_TAC[Cuxvzoz.real_continuous_abs]); + REPEAT WEAKER_STRIP_TAC; + (COMMENT "reduction lemmas"); + PROOF_BY_CONTR_TAC; + TYPIFY `&2 < dist(v 0,v 1)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `scs_a_v39` (C INTRO_TAC [`0`;`1`]); + BY(ASM_REWRITE_TAC[] THEN FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `~` MP_TAC THEN REWRITE_TAC[]; + TYPIFY `!i. f (v i) (&0) = v i` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation]; + BY(ASM_MESON_TAC[]); + INTRO_TAC a5_assumption_reduction [`s`;`f`;`v`;`e'`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `scs_diag` (C INTRO_TAC [`i`;`j`]); + BY(ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + CONJ_TAC; + TYPIFY `e'` EXISTS_TAC THEN CONJ_TAC THENL [ASM_REWRITE_TAC[];REPEAT WEAKER_STRIP_TAC]; + FIRST_X_ASSUM (C INTRO_TAC [`t`]) THEN ASM_REWRITE_TAC[DIST_SYM]; + BY(MESON_TAC[]); + INTRO_TAC Cuxvzoz.continuous_nbd_pos [`\ t. dist(f (v 0) t,v 1) - &2`;`&0`]; + ASM_REWRITE_TAC[arith `abs (t' - &0) = abs t'`;arith `&0 < a - b <=> b < a`]; + ANTS_TAC; + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `atreal` (C INTRO_TAC [`v 0`;`&0`]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + BY((REPEAT (REPEAT CONJ_TAC THEN (MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC Local_lemmas1.CON_ATREAL_REAL_CON ORELSE MATCH_MP_TAC Local_lemmas1.CON_ATREAL_REAL_CON2 ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_POW ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB THEN ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST;ETA_AX])))); + BY(MESON_TAC[arith `x < y ==> x <= y`]); + DISCH_TAC; + (COMMENT "b5 reduction"); + INTRO_TAC b5_assumption_reduction [`s`;`f`;`v`;`e'`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + TYPIFY `e'` EXISTS_TAC; + FIRST_X_ASSUM_ST `norm` MP_TAC THEN ASM_REWRITE_TAC[DIST_SYM]; + BY(MESON_TAC[]); + TYPIFY `e'` EXISTS_TAC; + CONJ_TAC THENL [ASM_REWRITE_TAC[];REPEAT WEAKER_STRIP_TAC]; + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]) THEN ASM_REWRITE_TAC[DIST_SYM]; + DISCH_THEN (unlist REWRITE_TAC); + BY(REAL_ARITH_TAC); + DISCH_TAC; + COMMENT "deform collinear"; + TYPIFY `!t. f (v 1) t = v 1 /\ f (v 2) t = v 2 /\ f (v 3) t = v 3` (C SUBGOAL_THEN ASSUME_TAC); + BY(GEN_TAC THEN REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + TYPIFY `!i j. i < 5 /\ j < 5 /\ ~(v i = v j) ==> (?e. &0 < e /\ (!t. abs t < e==> ~collinear {vec 0, f (v i) t, f (v j) t}))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GEN_ALL Local_lemmas1.CONTINUOUS_PRESERVE_COLLINEAR) [`&0`;`(vec 0):real^3`;`f (v i)`;`f (v j)`]; + REWRITE_TAC[arith `abs(&0 - r') = abs r'`] THEN DISCH_THEN MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[CONJ_ASSOC] THEN CONJ_TAC; + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_MESON_TAC[]); + TYPIFY `!i. azim (vec 0) (v i) (v (i+1)) (v(i+4)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[arith `i+1 = SUC i`;arith `4 = 5 - 1`]; + GEN_TAC; + MATCH_MP_TAC (REWRITE_RULE[LET_THM] Terminal.convex_local_fan_azim_le_pi); + ASM_REWRITE_TAC[arith `3 <= 5`]; + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM]; + BY(ASM_REWRITE_TAC[]); + COMMENT "coplanar"; + INTRO_TAC Zlzthic.NONPLANAR_OPEN [`(\ (t:real). (vec 0):real^3)`;`f (v 0)`;`\ (t:real). v 1`;`\ (t:real). v 3`;`&0`]; + ASM_REWRITE_TAC[CONTINUOUS_CONST]; + ANTS_TAC; + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation] THEN REPEAT WEAKER_STRIP_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + REWRITE_TAC[arith `abs (&0 - t') = abs t'`] THEN REPEAT WEAKER_STRIP_TAC; + COMMENT "azim reduction"; + INTRO_TAC azim5_reduction [`s`;`f`;`v`;`e'`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + CONJ_TAC; + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM_ST `a < pi` MP_TAC) THEN ASM_REWRITE_TAC[] THEN MESON_TAC[]); + CONJ2_TAC; + TYPIFY `e'` EXISTS_TAC; + BY(ASM_REWRITE_TAC[arith `x - abs t = x + --abs t`]); + INTRO_TAC Zlzthic.WNWSHJT [`v 1`;`v 3`;`v 0`;`f`;`-- e'`;`e'`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + CONJ_TAC; + MATCH_MP_TAC Zlzthic.deformation_subset; + TYPIFY `V` EXISTS_TAC; + ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + BY(EXPAND_TAC "V" THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC FUN_IN_IMAGE THEN REWRITE_TAC[IN_UNIV]); + TYPIFY_GOAL_THEN `~collinear {vec 0, v 3, v 0} /\ ~collinear {vec 0, v 3, v 1}` (unlist REWRITE_TAC); + BY(CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN NUM_REDUCE_TAC); + FIRST_X_ASSUM_ST `coplanar` kill; + FIRST_X_ASSUM_ST `~coplanar s` MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,d,b,c}`] THEN REWRITE_TAC[GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; + REWRITE_TAC[arith `&0 < a <=> &0 <= a /\ ~(a = &0)`]; + REWRITE_TAC[Counting_spheres.AZIM_NN]; + REWRITE_TAC[arith `a < pi <=> a <= pi /\ ~(a = pi)`;DE_MORGAN_THM]; + DISCH_THEN (unlist REWRITE_TAC); + REPLICATE_TAC 2(MATCH_MP_TAC Xivphks.FSQKWKK); + FIRST_X_ASSUM_ST `azim` (C INTRO_TAC [`0`]) THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `&0 <= a2 ==> (a1 + a2 <= pi ==> a1 <= pi)`); + BY(REWRITE_TAC[Counting_spheres.AZIM_NN]); + (REPEAT WEAKER_STRIP_TAC); + INTRO_TAC Cuxvzoz.epsilon_triple [`e`;`e''`;`e'`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''''` EXISTS_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + REPLICATE_TAC 3 (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC azim_dih_y [`(vec 0):real^3`;`v 3`;`f (v 0) t`;`v 1`]; + INTRO_TAC azim_dih_y [`(vec 0):real^3`;`v 3`;`(v 0)`;`v 1`]; + DISCH_THEN GMATCH_SIMP_TAC; + CONJ_TAC; + FIRST_X_ASSUM_ST `x < pi` (C INTRO_TAC [`&0`]) THEN ASM_REWRITE_TAC[arith `abs(&0) = &0`]; + SIMP_TAC[arith `x < pi ==> x <= pi`]; + DISCH_TAC; + BY(CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN NUM_REDUCE_TAC); + DISCH_THEN GMATCH_SIMP_TAC; + CONJ_TAC; + REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; + MATCH_MP_TAC (arith `x < pi ==> x <= pi`); + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + CONJ_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`]; + BY(FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`t`]) THEN ASM_REWRITE_TAC[] THEN MESON_TAC[Planarity.notcoplanar_imp_notcollinear_fan]); + BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN NUM_REDUCE_TAC); + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[DIST_SYM;DIST_0]; + REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC Ocbicby.dih_y_mono; + FIRST_X_ASSUM_ST `~coplanar s` (C INTRO_TAC [`t`]) THEN ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `~coplanar s` MP_TAC; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `d + -- abs t <= d`]; + CONJ_TAC; + REWRITE_TAC[NORM_POS_LT]; + POP_ASSUM (MP_TAC o (MATCH_MP Planarity.notcoplanar_disjoint)); + BY(MESON_TAC[]); + CONJ_TAC; + FIRST_X_ASSUM_ST `abs` (SUBST1_TAC o GSYM); + REWRITE_TAC[GSYM DIST_NZ]; + POP_ASSUM (MP_TAC o (MATCH_MP Planarity.notcoplanar_disjoint)); + BY(MESON_TAC[]); + CONJ_TAC; + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[Oxlzlez.coplanar_delta_y;DIST_SYM;DIST_0]; + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + INTRO_TAC Terminal.DELTA_Y_POS_4POINTS [`(vec 0):real^3`;`v 3`;`v 0`;`v 1`]; + BY(REWRITE_TAC[DIST_0;DIST_SYM]); + REPEAT WEAKER_STRIP_TAC; + (COMMENT "end of azim reduction"); + COMMENT "deformation in BBs"; + INTRO_TAC Cuxvzoz.deformation_BBs_ALT [`s`;`5`;`f`;`v`;`e'`]; + NUM_REDUCE_TAC; + ASM_REWRITE_TAC[]; + ANTS_TAC; + MATCH_MP_TAC Terminal.periodic_mod_reduce; + TYPIFY `5` EXISTS_TAC THEN REWRITE_TAC[arith `~(5 = 0)`]; + CONJ_TAC; + FIRST_X_ASSUM_ST `periodic` MP_TAC THEN REWRITE_TAC[Oxl_def.periodic]; + BY(MESON_TAC[]); + REWRITE_TAC[arith `i < 5 <=> i = 0 \/ i = 1 \/ i = 2 \/ i = 3 \/ i = 4`]; + REPEAT WEAKER_STRIP_TAC THEN (FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + BY(FIRST_X_ASSUM_ST ` \/ ` MP_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "back to root, next tau"; + TYPIFY `!t. abs t < e'' ==> sum {i | i < 5} (\i. rho_fun (norm (v i)) * azim (vec 0) (v i) (v (i + 1)) (v (i + 5 - 1))) <= sum {i | i < 5} (\i. rho_fun (norm (f (v i) t)) * azim (vec 0) (f (v i) t) (f(v(i+1)) t) (f (v (i + 5 - 1)) t))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Cuxvzoz.MMs_minimize_tau_fun; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[arith `3 < 5`]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM (unlist REWRITE_TAC)); + POP_ASSUM MP_TAC; + TYPIFY `{i | i < 5} = 0..4` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG] THEN ARITH_TAC); + REWRITE_TAC[SUM_NUMSEG4]; + NUM_REDUCE_TAC; + DISCH_TAC; + COMMENT "introduce nonlinear 684"; + TYPIFY `scs_diag 5 0 2 /\ scs_diag 5 0 3 /\ scs_diag 5 1 3 /\ scs_diag 5 1 4 /\ scs_diag 5 2 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Appendix.scs_diag;Uxckfpe.ARITH_5_TAC]); + INTRO_TAC (UNDISCH Ocbicby.LEMMA_6843920790) [`norm (v 3)`;`norm (v 0)`;`norm (v 1)`;`dist(v 0,v 1)`;`dist (v 1,v 3)`;`dist(v 0,v 3)`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + ONCE_REWRITE_TAC[Ocbicby.xrr_sym]; + ASM_REWRITE_TAC[GSYM Sphere.cstab]; + TYPIFY_GOAL_THEN `(&2 <= norm (v 3) /\ norm (v 3) <= &2 * h0) /\ (&2 <= norm (v 0) /\ norm (v 0) <= &2 * h0) /\ (&2 <= norm (v 1) /\ norm (v 1) <= &2 * h0)` (unlist REWRITE_TAC); + REWRITE_TAC[GSYM Fnjlbxs.in_ball_annulus]; + FIRST_X_ASSUM_ST `BBs_v39` kill THEN FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN EXPAND_TAC "V" THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `ball_annulus` MP_TAC; + REWRITE_TAC[SUBSET;IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + REWRITE_TAC[ CONJ_ASSOC] THEN CONJ2_TAC; + INTRO_TAC Oxlzlez.coplanar_delta_y [`(vec 0):real^3`;`v 3`;`v 0`;`v 1`]; + REWRITE_TAC[DIST_0;DIST_SYM] THEN DISCH_THEN (SUBST1_TAC o GSYM); + BY(ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,c,d,b}`] THEN ASM_REWRITE_TAC[]); + TYPIFY_GOAL_THEN `(&2 <= dist (v 0,v 1) /\ dist (v 0,v 1) <= cstab)` (unlist REWRITE_TAC); + REPEAT (FIRST_X_ASSUM_ST `scs_a_v39` (C INTRO_TAC [`0`;`1`])) THEN FIRST_X_ASSUM_ST `scs_a_v39 s 0 1 = &2` MP_TAC THEN FIRST_X_ASSUM_ST `scs_b_v39 s 0 1 <= cstab` MP_TAC; + BY(REAL_ARITH_TAC); + CONJ_TAC; + REPEAT (FIRST_X_ASSUM_ST `scs_a_v39` (C INTRO_TAC [`1`;`3`]) ); + BY(ASM_REWRITE_TAC[Sphere.cstab] THEN REAL_ARITH_TAC); + REPEAT (FIRST_X_ASSUM_ST `scs_a_v39` (C INTRO_TAC [`0`;`3`]) ); + BY(ASM_REWRITE_TAC[Sphere.cstab] THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `IN` MP_TAC THEN REWRITE_TAC[NOT_FORALL_THM;TAUT `~(a ==> b) <=> (a /\ ~b)`;arith `~(a < b) <=> b <= a`]; + TYPIFY `?e2. &0 < e2 /\ (!t. abs t < e2 ==> dist(v 0,v 1) + t IN real_interval(a,b))` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC Zlzthic.real_interval_contains_0_ball [`a-dist(v 0,v 1)`;`b - dist(v 0,v 1)`;`&1`]; + REWRITE_TAC[arith `&0 < &1`;arith `a - d < &0 <=> a < d`;arith `&0 < b - d <=> d < b`]; + ANTS_TAC; + FIRST_X_ASSUM_ST `dist s IN real_interval (a,b)` MP_TAC; + BY(REWRITE_TAC[IN_REAL_INTERVAL]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e'''` EXISTS_TAC; + (ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC THEN (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[IN_REAL_INTERVAL]); + BY(REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?t. (t < &0) /\ abs t < e2 /\ taum (norm (v 3)) (norm (v 0)) (norm (v 1)) (dist(v 0, v 1)) (dist (v 1,v 3)) (dist (v 0,v 3)) <= taum (norm (v 3)) (norm (v 0)) (norm (v 1)) (dist (v 0,v 1) + t) (dist (v 1,v 3)) (dist (v 0,v 3))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + GEXISTL_TAC [`dist(v 0,v 1) + t`;`dist(v 0,v 1)`]; + ASM_REWRITE_TAC[]; + CONJ2_TAC; + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + COMMENT "choose epsilon and t"; + INTRO_TAC epsilon_hex [`e`;`e'`;`e''`;`e1`;`e1'`;`e2`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `?t. t < &0 /\ abs t < e6` (C SUBGOAL_THEN MP_TAC); + TYPIFY `-- e6 / &2` EXISTS_TAC; + BY(FIRST_X_ASSUM_ST `&0 < e6` MP_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + REPLICATE_TAC 6 (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `t` EXISTS_TAC THEN ASM_REWRITE_TAC[]; + REPLICATE_TAC 8 (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `rho_fun` MP_TAC THEN ASM_REWRITE_TAC[Appendix.rho_rho_fun]; + REWRITE_TAC[arith `r0 * (a013 + a034) + r1 * (a123 + a130) + r2 * a231 + r3 * (a340 + a301+a312) + r4 * a403 <= r0 * (f013 + a034) + r1 * (a123 + f130) + r2 * a231 + r3 *(a340+f301 +a312) + r4*a403 <=> r0 * a013 + r1*a130 + r3* a301 <= r0 * f013 + r1 * f130 + r3 * f301`]; + MATCH_MP_TAC (arith `a - (pi+sol0) = a' /\ b - (pi+sol0) = b' ==> (a <= b ==> a' <= b')`); + REWRITE_TAC[arith `(a + b+c) - (pi + sol0) = a + b + c - (pi + sol0)`]; + CONJ_TAC; + GMATCH_SIMP_TAC (GSYM Cuxvzoz.tau3_azim); + GMATCH_SIMP_TAC Cuxvzoz.tau3_taum_nonplanar; + ASM_REWRITE_TAC[]; + REWRITE_TAC[DIST_SYM]; + CONJ2_TAC; + BY(MESON_TAC[Terminal.taum_sym]); + BY(REPEAT (FIRST_X_ASSUM_ST `a < pi` MP_TAC) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `norm a = norm b` (SUBST1_TAC o GSYM); + TYPIFY `dist(v 0,v 1) + t = dist(v 0,v 1) + -- abs t` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM_ST `t < &0` MP_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `d = d' + -- abs t` (SUBST1_TAC o GSYM); + GMATCH_SIMP_TAC (GSYM Cuxvzoz.tau3_azim); + GMATCH_SIMP_TAC Cuxvzoz.tau3_taum_nonplanar; + REWRITE_TAC[DIST_SYM]; + REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; + ASM_REWRITE_TAC[DIST_SYM]; + BY(MESON_TAC[Terminal.taum_sym]); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `a < pi` MP_TAC; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +end;; diff --git a/text_formalization/local/JCYFMRP.hl b/text_formalization/local/JCYFMRP.hl new file mode 100644 index 0000000..8bac9b4 --- /dev/null +++ b/text_formalization/local/JCYFMRP.hl @@ -0,0 +1,625 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Jcyfmrp = struct + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +open Yxionxl2;; +open Eyypqdw;; +open Ocbicby;; +open Imjxphr;; + +open Nuxcoea;; +open Fektyiy;; + + + + +let J_EMPY_CASES_A_EQ_2=prove(`(!i. scs_a_v39 s i (SUC i) = &2) + /\ is_scs_v39 s +==> scs_J_v39 s i= {}`, +STRIP_TAC +THEN MP_TAC(SET_RULE`(?x. scs_J_v39 s i x) \/ (scs_J_v39 s i= {})`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC +THEN THAYTHEL_ASM_TAC(21-19)[`i`;`x`][] +THEN THAYTHEL_ASM_TAC (23-18)[`i`;`x`][] +THENL[ +DICH_TAC 4 +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`i`;`x`;`s`;`i`;`SUC i`][is_scs_v39] +THEN POP_ASSUM MP_TAC +THEN MP_TAC Geomdetail.db_t0_sq8 +THEN REWRITE_TAC[sqrt8] +THEN REAL_ARITH_TAC; + +DICH_TAC 4 +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`i`;`x`;`s`;`SUC x`;`x`][is_scs_v39] +THEN POP_ASSUM MP_TAC +THEN MP_TAC Geomdetail.db_t0_sq8 +THEN REWRITE_TAC[sqrt8] +THEN REAL_ARITH_TAC]);; + +let DIST_EDGE_LE_CSTAB_CASE_LE3=prove(`3< scs_k_v39 s /\ BBs_v39 s v /\ is_scs_v39 s ==> dist(v i, v (SUC i))<= cstab`, +REWRITE_TAC[LET_DEF;LET_END_DEF;BBs_v39;is_scs_v39] +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC (24-21)[`i`] +THEN THAYTHE_TAC (24-3)[`i`;`SUC i`] +THEN DICH_TAC 0 +THEN DICH_TAC 1 +THEN REAL_ARITH_TAC);; + + +let J_EMPY_CASES_A_EQ_2_V1=prove( +`scs_a_v39 s i (SUC i) = &2/\ scs_a_v39 s (SUC i) (SUC(SUC i)) = &2 + /\ is_scs_v39 s +==> scs_J_v39 s (SUC i)= {}`, +STRIP_TAC +THEN MP_TAC(SET_RULE`(?x. scs_J_v39 s (SUC i) x) \/ (scs_J_v39 s (SUC i)= {})`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC +THEN THAYTHEL_ASM_TAC(21-19)[`SUC i`;`x`][] +THEN THAYTHEL_ASM_TAC (23-18)[`SUC i`;`x`][] +THENL[ +DICH_TAC 4 +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`SUC i`;`x`;`s`;`SUC i`;`SUC (SUC i)`][is_scs_v39] +THEN POP_ASSUM MP_TAC +THEN MP_TAC Geomdetail.db_t0_sq8 +THEN REWRITE_TAC[sqrt8] +THEN REAL_ARITH_TAC; + +DICH_TAC 4 +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s==> ~(scs_k_v39 s= 0)`) +THEN RESA_TAC +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`scs_k_v39 s`;`i`;`x`;`1`][ARITH_RULE`1+x= SUC x`] +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`(SUC i)`;`x`;`s`;`SUC i`;`i`][is_scs_v39] +THEN POP_ASSUM MP_TAC +THEN MP_TAC Geomdetail.db_t0_sq8 +THEN REWRITE_TAC[sqrt8] +THEN REAL_ARITH_TAC]);; + + + + +let SCS_M_LE_1= prove_by_refinement(` CARD (scs_M s) <= 1 /\ is_scs_v39 s +==> ?p. (!i. ~(i MOD scs_k_v39 s=p MOD scs_k_v39 s)==> scs_b_v39 s i (SUC i)<= &2 *h0/\ scs_a_v39 s i (SUC i)= &2 )`, +[ +STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th +THEN ASSUME_TAC th) +THEN REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF;] +THEN RESA_TAC +THEN DICH_TAC (21) +THEN REWRITE_TAC[scs_M] +THEN REWRITE_TAC[ARITH_RULE`a<=1 <=> a= 0\/ a=1`] +THEN SUBGOAL_THEN`FINITE + {i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}` ASSUME_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..6` +THEN ASM_REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN GEN_TAC +THEN DICH_TAC(20-3) +THEN ARITH_TAC; + + +ABBREV_TAC`k=scs_k_v39 s` +THEN RESA_TAC; + +MRESA_TAC CARD_EQ_0[`{i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`A={}<=> !x. ~(x IN A)`;IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC `0` +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)/\ 1 b<=a`;DIVISION] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`i MOD k:num`;`SUC(i MOD k) :num`;`s:scs_v39`;`i:num`;`SUC(i MOD k) MOD k:num`][MOD_REFL;ARITH_RULE`~(6=0)`;Hypermap.lemma_suc_mod] +THEN MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`i :num`;`SUC i MOD k :num`;`s:scs_v39`;`i:num`;`SUC i:num`][MOD_REFL;ARITH_RULE`~(6=0)`;Hypermap.lemma_suc_mod] +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`i MOD k:num`;`SUC(i MOD k) :num`;`s:scs_v39`;`i:num`;`SUC(i MOD k) MOD k:num`][MOD_REFL;ARITH_RULE`~(6=0)`;Hypermap.lemma_suc_mod] +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`i :num`;`SUC i MOD k :num`;`s:scs_v39`;`i:num`;`SUC i:num`][MOD_REFL;ARITH_RULE`~(6=0)`;Hypermap.lemma_suc_mod] +THEN THAYTHES_TAC (30-15)[`i MOD k`;`SUC i MOD k`][DIVISION;Hypermap.lemma_suc_mod;ARITH_RULE`~(6=0)/\ 1<6`;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN POP_ASSUM MP_TAC +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`i MOD k:num`;`SUC i MOD k :num`;`s:scs_v39`;`i:num`;`SUC i:num`][MOD_REFL;ARITH_RULE`~(6=0)`;Hypermap.lemma_suc_mod] +THEN REAL_ARITH_TAC; + + +MRESA_TAC Local_lemmas.FINITE_CARD1_IMP_SINGLETON[`{i | i < k /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING] +THEN STRIP_TAC +THEN EXISTS_TAC`x:num` +THEN GEN_TAC +THEN STRIP_TAC +THEN THAYTHEL_ASM_TAC 1[`x`][] +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)/\ 1 b<=a`;DIVISION] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`i MOD k:num`;`SUC(i MOD k) :num`;`s:scs_v39`;`i:num`;`SUC(i MOD k) MOD k:num`][MOD_REFL;ARITH_RULE`~(6=0)`;Hypermap.lemma_suc_mod] +THEN MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`i :num`;`SUC i MOD k :num`;`s:scs_v39`;`i:num`;`SUC i:num`][MOD_REFL;ARITH_RULE`~(6=0)`;Hypermap.lemma_suc_mod] +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`i MOD k:num`;`SUC(i MOD k) :num`;`s:scs_v39`;`i:num`;`SUC(i MOD k) MOD k:num`][MOD_REFL;ARITH_RULE`~(6=0)`;Hypermap.lemma_suc_mod] +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`i :num`;`SUC i MOD k :num`;`s:scs_v39`;`i:num`;`SUC i:num`][MOD_REFL;ARITH_RULE`~(6=0)`;Hypermap.lemma_suc_mod] +THEN THAYTHES_TAC (32-15)[`i MOD k`;`SUC i MOD k`][DIVISION;Hypermap.lemma_suc_mod;ARITH_RULE`~(6=0)/\ 1<6`;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN POP_ASSUM MP_TAC +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`i MOD k:num`;`SUC i MOD k :num`;`s:scs_v39`;`i:num`;`SUC i:num`][MOD_REFL;ARITH_RULE`~(6=0)`;Hypermap.lemma_suc_mod] +THEN REAL_ARITH_TAC]);; + + + + +let JCYFMRP_concl = ` +main_nonlinear_terminal_v11 +==> +(!s (v:num->real^3). + 3< scs_k_v39 s/\ + is_scs_v39 s /\ v IN MMs_v39 s /\ scs_generic v /\ scs_basic_v39 s /\ + (!i j. scs_diag (scs_k_v39 s) i j ==> &4 * h0 < scs_b_v39 s i j) /\ + CARD (scs_M s) <= 1 /\ + (!i. scs_a_v39 s i (SUC i) = &2) /\ + (!i j. scs_diag (scs_k_v39 s) i j ==> (scs_a_v39 s i j <= cstab /\ cstab < dist(v i, v j))) ==> + (?i. dist(v i, v (i+1)) = &2))`;; + + + + + +let JCYFMRP=prove_by_refinement( JCYFMRP_concl, +[ +MP_TAC Cuxvzoz.CUXVZOZ +THEN STRIP_TAC +THEN STRIP_TAC +THEN REWRITE_TAC[IN;scs_generic] +THEN REPEAT GEN_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN ABBREV_TAC`V=(IMAGE (v:num->real^3) (:num))` +THEN ABBREV_TAC`E=(IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num))` +THEN ABBREV_TAC`FF=IMAGE (\i. ((v:num->real^3) i, v (SUC i))) (:num)` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`?i. dist (v i,v (i + 1)) = &2\/ ~(?i. dist ((v:num->real^3) i,v (i + 1)) = &2)`) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +; + + +EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +; + +DICH_TAC 1 +THEN DICH_TAC 0 +THEN REWRITE_TAC[NOT_EXISTS_THM] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN SUBGOAL_THEN`!i. &2< dist((v:num->real^3) i, v (SUC i))`ASSUME_TAC +; + + +GEN_TAC +THEN MATCH_MP_TAC(REAL_ARITH`a<=b /\ ~(b= a)==> areal^3) i)= &2` ASSUME_TAC +; + + + +GEN_TAC +THEN MP_TAC(REAL_ARITH`norm ((v:num->real^3) i)= &2\/ ~(norm ((v:num->real^3) i)= &2)`) +THEN RESA_TAC +THEN DICH_TAC 2 +THEN MRESA_TAC J_EMPY_CASES_A_EQ_2[`s`;`i`] +THEN DICH_TAC 0 +THEN REWRITE_TAC[SET_RULE`(a = {})<=> !i. ~ (a i)`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`k:num`;`s`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN DICH_TAC 0 +THEN MRESAL_TAC MMS_IMP_BBPRIME[`s`;`v`][LET_DEF;LET_END_DEF;BBprime_v39] +THEN MRESAL_TAC JKQEWGV2[`s`;`v`][LET_DEF;LET_END_DEF;scs_generic] +THEN MP_TAC Wrgcvdr_cizmrrh.CIZMRRH +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_EXISTS_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN`(!V' E' v1. V' = V /\ E' = E ==> ~lunar (v1,(v:num->real^3) i) V' E')` ASSUME_TAC; + + + +REPEAT RESA_TAC +; + +SUBGOAL_THEN`!i'. ~(i' MOD k = i MOD k) ==> scs_a_v39 s i i' < dist ((v:num->real^3) i,v i')`ASSUME_TAC; + + + +REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`i' MOD k= SUC i MOD k\/ ~(i' MOD k= SUC i MOD k)`) +THEN RESA_TAC +; + + +MRESA_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`i'`;`v:num->real^3`;`SUC i:num`] +THEN MRESAL_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`i`;`i' `;`s:scs_v39`;`i`;`SUC i`][] +; + + + +MP_TAC(SET_RULE`SUC i' MOD k= i MOD k\/ ~(SUC i' MOD k= i MOD k)`) +THEN RESA_TAC +; + + +MRESA_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`i`;`v:num->real^3`;`SUC i':num`] +THEN MRESAL_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`i`;`i' `;`s:scs_v39`;`SUC i'`;`i'`][] +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF] +THEN REPEAT RESA_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]; + + + +THAYTHEL_TAC (27-13)[`i`;`i'`][scs_diag] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN REAL_ARITH_TAC; + + + +MRESAL_TAC ODXLSTCv2[`s`;`k`;`v`;`i:num`][] +; + + + +MP_TAC SCS_M_LE_1 +THEN RESA_TAC +THEN SUBGOAL_THEN`!i. ~(i MOD k= p MOD k )/\ ~(i MOD k= SUC p MOD k ) +==> pi / &2 < azim (vec 0) (v i) (v (SUC i)) ((v:num->real^3) (i + k - 1))` +ASSUME_TAC +; + + +GEN_TAC +THEN STRIP_TAC +THEN MP_TAC SYNQIWN +THEN RESA_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN EXISTS_TAC`s:scs_v39` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC; + + + +MATCH_MP_TAC(GEN_ALL(REAL_ARITH`a<=b/\ b<=c ==> a<=c`)) +THEN EXISTS_TAC`scs_b_v39 s i (SUC i)` +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;BBs_v39] +THEN REPEAT RESA_TAC +THEN MATCH_DICH_TAC 2 +THEN ASM_REWRITE_TAC[]; + + + +MATCH_MP_TAC(GEN_ALL(REAL_ARITH`a<=b/\ b<=c ==> a<=c`)) +THEN EXISTS_TAC`scs_b_v39 s (i+k-1) (SUC (i+k-1))` +THEN MP_TAC(ARITH_RULE`3 SUC (i + k - 1)= 1*k+i/\ ~(k<=3)/\ ~(k=0)`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;BBs_v39] +THEN REPEAT RESA_TAC +; + + + +MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`i+k-1`;`1*k+i `;`s:scs_v39`;`i+k-1`;`(1*k+i)MOD k`][MOD_REFL;MOD_MULT_ADD] +THEN MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`i+k-1`;`i MOD k `;`s:scs_v39`;`i+k-1`;`i`][MOD_REFL;MOD_MULT_ADD] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]; + + + +MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`i+k-1`;`1*k+i `;`s:scs_v39`;`i+k-1`;`(1*k+i)MOD k`][MOD_REFL;MOD_MULT_ADD] +THEN MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`i+k-1`;`i MOD k `;`s:scs_v39`;`i+k-1`;`i`][MOD_REFL;MOD_MULT_ADD] +THEN THAYTHE_TAC (28-21)[`i+k-1`] +THEN MATCH_DICH_TAC 0 +THEN DICH_TAC (27-22) +THEN ASM_REWRITE_TAC[CONTRAPOS_THM] +THEN STRIP_TAC +THEN MRESAS_TAC Zithlqn.IMP_SUC_MOD_EQ[`i+k-1`;`p`;`k`][MOD_MULT_ADD]; + + + +MP_TAC(ARITH_RULE`3 SUC (i + k - 1)= i+ 1*k+0/\ ~(k<=3)/\ ~(k=0)/\ k-1 pi<= azim (vec 0) (v i) ((v:num->real^3) (SUC i)) (v (i + k - 1))) \/ ~(!i. ~(i MOD k = p MOD k) /\ ~(i MOD k = SUC p MOD k) + ==> pi<= azim (vec 0) (v i) (v (SUC i)) (v (i + k - 1))) `) +THEN RESA_TAC +; + + + + + +SUBGOAL_THEN`!i. ~(i MOD k = p MOD k) /\ ~(i MOD k = SUC p MOD k) + ==> azim (vec 0) (v i) (v (SUC i)) ((v:num->real^3) (i + k - 1))= pi`ASSUME_TAC +; + + + +REPEAT STRIP_TAC +THEN THAYTHE_TAC 2[`i`] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`k`;`s`;`v`] +THEN MRESA_TAC WL_IN_V[`i`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`i+k-1`;`v:num->real^3`] +THEN MRESA_TAC Rrcwnsj.BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v (i)`;`v`;`i`;`k`] +THEN MRESA_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v i`] +THEN THAYTHE_TAC 0[`v (i+k-1)`] +THEN DICH_TAC 0 +THEN DICH_TAC (27-22) +THEN REWRITE_TAC[ADD1] +THEN REAL_ARITH_TAC; + + +SUBGOAL_THEN`(0..(k-1)) DELETE p MOD k DELETE SUC p MOD k SUBSET{i | i < k /\ azim (vec 0) (v i) (v (SUC i)) ((v:num->real^3) (i + k - 1)) = pi}` +ASSUME_TAC +; + + +REWRITE_TAC[SUBSET;IN_ELIM_THM;DELETE;IN_NUMSEG;] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3 (x<=k-1<=> x ~(k=0 )/\ 1 p MOD k<=k-1/\ (k-1+1)-0=k`) +THEN RESA_TAC +THEN MRESAS_TAC Hypermap.CARD_MINUS_ONE[`0..(k-1)`;`p MOD k`][FINITE_NUMSEG;IN_NUMSEG;ARITH_RULE`0<=a`;CARD_NUMSEG] +THEN MP_TAC(ARITH_RULE`3 CARD ((0..k - 1) DELETE p MOD k) =k-1`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o DEPTH_CONV)[th]) +THEN RESA_TAC +THEN SUBGOAL_THEN`SUC p MOD k IN (0..k - 1) DELETE p MOD k`ASSUME_TAC +; + + +ASM_REWRITE_TAC[DELETE;IN_ELIM_THM;IN_NUMSEG] +THEN MRESA_TAC DIVISION[`SUC p`;`k`] +THEN MP_TAC(ARITH_RULE`3 SUC p MOD k<=k-1/\ 0<= SUC p MOD k/\ 1 CARD ((0..k - 1) DELETE p MOD k DELETE SUC p MOD k) =k-2`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o DEPTH_CONV)[th]) +THEN RESA_TAC +; + + +SUBGOAL_THEN`FINITE + {i | i < k /\ azim (vec 0) ((v:num->real^3) i) (v (SUC i)) (v (i + k - 1)) = pi}`ASSUME_TAC +; + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN ASM_REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + +MRESA_TAC CARD_SUBSET[`(0..k - 1) DELETE p MOD k DELETE SUC p MOD k`;`{i | i < k /\ azim (vec 0) (v i) ((v:num->real^3) (SUC i)) (v (i + k - 1)) = pi}`] +THEN MRESAL_TAC Aursipd.AURSIPD[`s`;`v`][scs_generic;IN;scs_is_str] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DICH_TAC (32-5) +THEN ABBREV_TAC`a= CARD {i | i < k /\ azim (vec 0) (v i) (v (SUC i)) (v (i + k - 1)) = pi}` +THEN ARITH_TAC; + + + +DICH_TAC 5 +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;REAL_ARITH`~(a<=b)<=> b scs_arrow_v39 {x} {}) ==> scs_arrow_v39 {a} {}`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_arrow_v39;NOT_IN_EMPTY;IN_SING]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let JEJTVGB_case_breakdown = prove_by_refinement( + (* main_work4 ==> *) ` main_nonlinear_terminal_v11 ==> ( + scs_arrow_v39 { scs_6I1 } { scs_6T1, scs_5M1, scs_4M2, scs_3M1 } /\ // OEHDBEN + scs_arrow_v39 { scs_5I1 } { scs_stab_diag_v39 scs_5I1 0 2 , scs_5M2 } /\ // OTMTOTJ1 +scs_arrow_v39 { scs_5I2 } { scs_stab_diag_v39 scs_5I2 0 2 , scs_5M2 } /\ // + +scs_arrow_v39 { scs_5I3 } { scs_stab_diag_v39 scs_5M1 0 2 , + scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4, scs_5M2 } /\ // OTMTOTJ3 + +scs_arrow_v39 { scs_5M1 } { scs_stab_diag_v39 scs_5M1 0 2 , scs_stab_diag_v39 scs_5M1 0 3, + scs_stab_diag_v39 scs_5M1 2 4, scs_5M2 } /\ // OTMTOTJ4 +scs_arrow_v39 { scs_5M2 } {scs_5T1, scs_stab_diag_v39 scs_5I2 0 2, scs_stab_diag_v39 scs_5M1 0 2, + scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4, + scs_4M6', scs_4M7, scs_4M8, scs_3T1, scs_3T4} /\ // HIJQAHA +//{ scs_3T1,scs_3T4,scs_4M6',scs_4M7,scs_4M8, +// scs_5T1, scs_stab_diag_v39 scs_5I2 0 2 , +// scs_stab_diag_v39 scs_5M1 0 2 , scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4 } /\ // HIJQAHA + +scs_arrow_v39 { scs_stab_diag_v39 scs_5I1 0 2 } + {scs_3M1, scs_4M2 } /\ // CNICGSF1 .. + +scs_arrow_v39 { scs_stab_diag_v39 scs_5I2 0 2 } + {scs_3T1, scs_4M3' } /\ // CNICGSF2 + +scs_arrow_v39 { scs_stab_diag_v39 scs_5M1 0 2 } + {scs_3T4, scs_4M2 } /\ // CNICGSF3 + +scs_arrow_v39 { scs_stab_diag_v39 scs_5M1 0 3 } + {scs_4M4', scs_3M1 } /\ // CNICGSF4 + +scs_arrow_v39 { scs_stab_diag_v39 scs_5M1 2 4 } + {scs_3M1, scs_4M5' } /\ // CNICGSF5 .. + + scs_arrow_v39 { scs_4I1 } {scs_4I2, scs_stab_diag_v39 scs_4I1 0 2 } /\ // FYSSVEV + + + scs_arrow_v39 { scs_4I2 } { scs_4T1, scs_4T2 } /\ // ARDBZYE + + + scs_arrow_v39 { scs_stab_diag_v39 scs_4I1 0 2 } { scs_3M1 } /\ // AUEAHEH + + // scs_arrow_v39 { scs_stab_diag_v39 scs_4I3 0 2 } { scs_4T4 } /\ // ZNLLLDL (internal) + + scs_arrow_v39 { scs_4I3 } {scs_4M6', scs_4T4} /\ // VQFYMZY .. + +// scs_arrow_v39 { scs_4M1 } { scs_4M2, scs_4M6' } /\ // unused. + + scs_arrow_v39 { scs_4M2 } {scs_4M6', scs_3M1, scs_3T4} /\ // BNAWVNH + + scs_arrow_v39 { scs_4M3' } {scs_4M6', scs_3T1, scs_3T6'} /\ // RAWZDIB + + scs_arrow_v39 { scs_4M4' } {scs_4M7, scs_3T3, scs_3M1, scs_3T4} /\ // MFKLVDK + + scs_arrow_v39 { scs_4M5' } {scs_4M8, scs_3T4} /\ // RYPDIXT + +scs_arrow_v39 {scs_4M6'} {scs_4T3,scs_4T5} /\ // NWDGKXH + +scs_arrow_v39 {scs_4M7} {scs_4M6', scs_3T3, scs_3M1, scs_3T4} /\ // YOBIMPP + +scs_arrow_v39 {scs_4M8} {scs_4M6',scs_3T7,scs_3T4} /\ // MIQMCSN + + scs_arrow_v39 {scs_3M1} {scs_3T1,scs_3T5} // BKOSSGE + +==> +JEJTVGB_assume_v39) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (UNDISCH Ocbicby.OCBICBY) []; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `scs_arrow_v39 {scs_3M1} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_3T1, scs_3T5}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_4M6'} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_4T3,scs_4T5}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_4M7} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_4M6', scs_3T3, scs_3M1, scs_3T4}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_4M8} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_4M6', scs_3T7, scs_3T4}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_4M5'} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_4M8, scs_3T4}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_4M4'} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_4M7, scs_3T3, scs_3M1, scs_3T4}` EXISTS_TAC; (* revised *) + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_4M3'} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_4M6', scs_3T1, scs_3T6'}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_4M2} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_4M6', scs_3M1, scs_3T4}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_4I3} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_4M6', scs_4T4}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_stab_diag_v39 scs_4I1 0 2} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_3M1}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_4I2} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_4T1, scs_4T2}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_4I1} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_4I2, scs_stab_diag_v39 scs_4I1 0 2}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_stab_diag_v39 scs_5M1 2 4} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_3M1, scs_4M5'}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_stab_diag_v39 scs_5M1 0 3} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_4M4', scs_3M1}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_stab_diag_v39 scs_5M1 0 2} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_3T4, scs_4M2}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_stab_diag_v39 scs_5I2 0 2} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_3T1, scs_4M3'}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_stab_diag_v39 scs_5I1 0 2} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_3M1, scs_4M2}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_5M2} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_5T1, scs_stab_diag_v39 scs_5I2 0 2, scs_stab_diag_v39 scs_5M1 0 2, scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4, scs_4M6', scs_4M7, scs_4M8, scs_3T1, scs_3T4}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_5M1} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_stab_diag_v39 scs_5M1 0 2, scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4, scs_5M2}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_5I3} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_stab_diag_v39 scs_5M1 0 2, scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4, scs_5M2}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_5I2} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_stab_diag_v39 scs_5I2 0 2, scs_5M2}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_5I1} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY ` {scs_stab_diag_v39 scs_5I1 0 2, scs_5M2}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_6I1} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_6T1, scs_5M1, scs_4M2, scs_3M1}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + COMMENT "final kill"; + MATCH_MP_TAC Ayqjtmd.EAPGLE; + REWRITE_TAC[GSYM Ocbicby.scs_arrow_sing_empty]; + REWRITE_TAC[Jotswix.s_init_list_alt;MEM]; + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[UNDISCH2 Jotswix.LFLACKU]) + ]);; + (* }}} *) + +let JEJTVGB = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> JEJTVGB_assume_v39`, + (* {{{ proof *) + [ + DISCH_TAC; + MATCH_MP_TAC (UNDISCH JEJTVGB_case_breakdown); + REWRITE_TAC (map UNDISCH2 [Hexagons.OEHDBEN;Otmtotj.OTMTOTJ1;Otmtotj.OTMTOTJ2;Otmtotj.OTMTOTJ3;Otmtotj.OTMTOTJ4]); + REWRITE_TAC (map UNDISCH2 [Hijqaha.HIJQAHA;Cnicgsf.CNICGSF1;Cnicgsf.CNICGSF2;Cnicgsf.CNICGSF3;Cnicgsf.CNICGSF4;Cnicgsf.CNICGSF5]); + REWRITE_TAC (map UNDISCH2 [Ardbzye.FYSSVEV;Ardbzye.ARDBZYE;Aueaheh.AUEAHEH;Aueaheh.VQFYMZY]); + REWRITE_TAC (map UNDISCH2 [Aueaheh.BNAWVNH;Aueaheh.RAWZDIB;Aueaheh.MFKLVDK;Aueaheh.RYPDIXT]); + BY(REWRITE_TAC (map UNDISCH2 [Miqmcsn.NWDGKXH;Miqmcsn.YOBIMPP;Miqmcsn.MIQMCSN;Bkossge.BKOSSGE])) + ]);; + (* }}} *) + + +end;; diff --git a/text_formalization/local/JKQEWGV.hl b/text_formalization/local/JKQEWGV.hl new file mode 100755 index 0000000..51b261a --- /dev/null +++ b/text_formalization/local/JKQEWGV.hl @@ -0,0 +1,3307 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Jkqewgv = struct + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + + +let IS_SCS_STABLE_SYSTEM=prove_by_refinement( +`is_scs_v39 s /\ 3< scs_k_v39 s +==> +stable_system (scs_k_v39 s) (scs_d_v39 s) (0..(scs_k_v39 s)-1) +(change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) +(change_type_v2 (scs_J_v39 s) (scs_k_v39 s)) (\i. ((1+i):num MOD (scs_k_v39 s))) +`, + (* {{{ proof *) +[ +REWRITE_TAC[is_scs_v39;stable_system;constraint_system;torsor;change_type_v2;change_type_v3] +THEN RESA_TAC +THEN RESA_TAC +THEN MP_TAC (ARITH_RULE`3<= scs_k_v39 s==> (scs_k_v39 s - 1 +1)-0= scs_k_v39 s +/\ (scs_k_v39 s - 1 +1)= scs_k_v39 s/\ 1< scs_k_v39 s /\ 1<= scs_k_v39 s /\ 1<= scs_k_v39 s -1/\ ~(scs_k_v39 s=0)`) +THEN RESA_TAC +THEN MRESA_TAC HAS_SIZE_NUMSEG[`0`;`scs_k_v39 s -1`] +THEN REPLICATE_TAC 23 (POP_ASSUM MP_TAC) +THEN REMOVE_ASSUM_TAC +THEN REPEAT DISCH_TAC +THEN STRIP_TAC; + +STRIP_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN MRESAL1_TAC Hypermap.LE_MOD_SUC`scs_k_v39 s -1`[ADD1]; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`x1 <= scs_k_v39 s - 1 /\ +x2 <= scs_k_v39 s - 1 +==> 1+ x1 <= scs_k_v39 s -1 +1 /\ 1+ x2 <= scs_k_v39 s - 1+1`) +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL MOD_IMP_EQ)[`scs_k_v39 s`;`1+x1`;`1+x2`][ARITH_RULE`1<= 1+A /\ (1+A<=4<=> A<=3)`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`0 1<= i`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`scs_k_v39 s:num`;`x:num`;`i:num`] +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s/\ scs_k_v39 s<=6 +==> scs_k_v39 s=3 \/ scs_k_v39 s=4 \/ scs_k_v39 s=5 \/ scs_k_v39 s= 6`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC); + +MP_TAC(ARITH_RULE`0 i=1 \/ i=2 `) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x<= 3-1==> x=0 \/ x=1 \/ x=2 `) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +MP_TAC(ARITH_RULE`0 i=1 \/ i=2 \/ i=3`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x<= 4-1==> x=0 \/ x=1 \/ x=2 \/ x=3`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +MP_TAC(ARITH_RULE`0 i=1 \/ i=2 \/ i=3\/ i=4`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x<= 5-1==> x=0 \/ x=1 \/ x=2 \/ x=3\/ x=4`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +MP_TAC(ARITH_RULE`0 i=1 \/ i=2 \/ i=3\/ i=4\/ i=5`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x<= 6-1==> x=0 \/ x=1 \/ x=2 \/ x=3\/ x=4\/ x=5`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`scs_k_v39 s:num`;`x:num`;`scs_k_v39 s:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`scs_k_v39 s`;`x:num`][ARITH_RULE`1*A=A`] +THEN MP_TAC(ARITH_RULE`x<=scs_k_v39 s -1 /\ 3<= scs_k_v39 s ==> x< scs_k_v39 s`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`x:num`;`scs_k_v39 s`]; + +STRIP_TAC; + +REPLICATE_TAC 15 (REMOVE_ASSUM_TAC) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`j:num`]) +THEN REPLICATE_TAC 3 (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +STRIP_TAC; + +REPEAT GEN_TAC +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`scs_k_v39 s`;`j:num`;`scs_k_v39 s`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`scs_k_v39 s`;`j:num`][ARITH_RULE`1*A=A`] +THEN MRESAL_TAC MOD_MOD_REFL[`j:num`;`scs_k_v39 s`][ARITH_RULE`~(5=0)`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A=B <=> B=A`] +THEN STRIP_TAC; + +MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s i`][periodic]; + +MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s i`][periodic]; + +STRIP_TAC; + +ASM_TAC +THEN REWRITE_TAC[periodic2;SUBSET;IN_ELIM_THM] +THEN REPEAT DISCH_TAC +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC 12 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i:num`;`j:num`][ADD1;ARITH_RULE`1+i=i+1`]); + +EXISTS_TAC`i MOD scs_k_v39 s` +THEN REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN MRESA_TAC DIVISION[`i:num`;`scs_k_v39 s`] +THEN MP_TAC(ARITH_RULE`i MOD scs_k_v39 s < scs_k_v39 s +/\ 3<= scs_k_v39 s +==> i MOD scs_k_v39 s <= scs_k_v39 s-1`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`1:num`;`scs_k_v39 s`] +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`1:num`;`scs_k_v39 s`][ARITH_RULE`~(4=0) /\ 1 MOD 4=1`;ADD1]; + +EXISTS_TAC`j MOD scs_k_v39 s` +THEN REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN MRESA_TAC DIVISION[`j:num`;`scs_k_v39 s`] +THEN MP_TAC(ARITH_RULE`j MOD scs_k_v39 s < scs_k_v39 s +/\ 3<= scs_k_v39 s +==> j MOD scs_k_v39 s <= scs_k_v39 s-1`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`1:num`;`scs_k_v39 s`] +THEN MRESAL_TAC MOD_ADD_MOD[`j:num`;`1:num`;`scs_k_v39 s`][ARITH_RULE`~(4=0) /\ 1 MOD 4=1`;ADD1] +THEN SET_TAC[]; + +SUBGOAL_THEN`{{i MOD scs_k_v39 s, j MOD scs_k_v39 s} | i,j | scs_J_v39 s i j} +SUBSET {{i MOD scs_k_v39 s, SUC i MOD scs_k_v39 s} |i| i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}` +ASSUME_TAC; + +REWRITE_TAC[SUBSET;IN_ELIM_THM] +THEN GEN_TAC +THEN RESA_TAC +THEN REPLICATE_TAC 12 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i:num`;`j:num`][ADD1;ARITH_RULE`1+i=i+1`]); + +EXISTS_TAC`i:num MOD scs_k_v39 s` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC MOD_LT[`1:num`;`scs_k_v39 s`] +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`1:num`;`scs_k_v39 s`][ARITH_RULE`~(4=0) /\ 1 MOD 4=1`;ADD1] +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`scs_k_v39 s`][ARITH_RULE`~(4=0)`] +THEN MRESA_TAC DIVISION[`i:num`;`scs_k_v39 s`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic;periodic2] +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`j:num`) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (i MOD scs_k_v39 s)`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(i MOD scs_k_v39 s) +1:num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD scs_k_v39 s)`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(i MOD scs_k_v39 s) +1:num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i + 1) MOD scs_k_v39 s)`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`i:num`) +THEN REPLICATE_TAC 19 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`(i MOD scs_k_v39 s)`; `((i + 1) MOD scs_k_v39 s)`]) +THEN REWRITE_TAC[h0;cstab;sqrt8] +THEN REAL_ARITH_TAC; + +EXISTS_TAC`j:num MOD scs_k_v39 s` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC MOD_LT[`1:num`;`scs_k_v39 s`] +THEN MRESAL_TAC MOD_ADD_MOD[`j:num`;`1:num`;`scs_k_v39 s`][ARITH_RULE`~(4=0) /\ 1 MOD 4=1`;ADD1] +THEN MRESAL_TAC MOD_MOD_REFL[`j:num`;`scs_k_v39 s`][ARITH_RULE`~(4=0)`] +THEN MRESA_TAC DIVISION[`j:num`;`scs_k_v39 s`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic;periodic2;SET_RULE`{A,B}={B,A}`] +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s j`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`i:num`) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (j MOD scs_k_v39 s)`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(j MOD scs_k_v39 s) +1:num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j MOD scs_k_v39 s)`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(j MOD scs_k_v39 s) +1:num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((j + 1) MOD scs_k_v39 s)`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`j:num`) +THEN REPLICATE_TAC 19 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`(j MOD scs_k_v39 s)`; `((j + 1) MOD scs_k_v39 s)`]) +THEN REWRITE_TAC[h0;cstab;sqrt8] +THEN REAL_ARITH_TAC; + +SUBGOAL_THEN`{{i MOD scs_k_v39 s, SUC i MOD scs_k_v39 s} |i| i < scs_k_v39 s /\ + (&2 * h0 < + scs_b_v39 s i (SUC i) \/ + &2 < + scs_a_v39 s i (SUC i))} +SUBSET IMAGE (\i. {i MOD scs_k_v39 s, SUC i MOD scs_k_v39 s}) {i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}` + ASSUME_TAC; + + REWRITE_TAC[IN_ELIM_THM;IMAGE;SUBSET]; + +SUBGOAL_THEN` {i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))} +SUBSET 0.. scs_k_v39 s` + ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;SUBSET;IN_NUMSEG] +THEN ARITH_TAC; + +MRESAL_TAC CARD_SUBSET[`{i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}`; +`0.. scs_k_v39 s`][FINITE_NUMSEG] +THEN MRESAL_TAC FINITE_SUBSET[`{i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}`; +`0.. scs_k_v39 s`][FINITE_NUMSEG] +THEN MRESAL_TAC CARD_SUBSET_IMAGE +[`(\i. {i MOD scs_k_v39 s, SUC i MOD scs_k_v39 s})`;`{{i MOD scs_k_v39 s, SUC i MOD scs_k_v39 s} |i| i < scs_k_v39 s /\ + (&2 * h0 < + scs_b_v39 s i (SUC i) \/ + &2 < + scs_a_v39 s i (SUC i))}`;`{i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}`; +][FINITE_NUMSEG] +THEN MRESAL_TAC FINITE_IMAGE +[`(\i. {i MOD scs_k_v39 s, SUC i MOD scs_k_v39 s})`;`{i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}`; +][FINITE_NUMSEG] +THEN MRESAL_TAC FINITE_SUBSET[`{{i MOD scs_k_v39 s, SUC i MOD scs_k_v39 s} |i| i < scs_k_v39 s /\ + (&2 * h0 < + scs_b_v39 s i (SUC i) \/ + &2 < + scs_a_v39 s i (SUC i))}`; +`IMAGE (\i. {i MOD scs_k_v39 s, SUC i MOD scs_k_v39 s}) {i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}`][FINITE_NUMSEG] +THEN MRESAL_TAC CARD_SUBSET[`{{i MOD scs_k_v39 s, j MOD scs_k_v39 s} | i,j | scs_J_v39 s i j}`; +`{{i MOD scs_k_v39 s, SUC i MOD scs_k_v39 s} |i| i < scs_k_v39 s /\ + (&2 * h0 < + scs_b_v39 s i (SUC i) \/ + &2 < + scs_a_v39 s i (SUC i))}`][FINITE_NUMSEG] +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 2 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 13(REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC 16 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 24 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`;] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC 12 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th`i:num`[ADD1]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`i:num`) +THEN ASM_REWRITE_TAC[ARITH_RULE`1+i=i+1`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`{i, j} = {i' MOD scs_k_v39 s, j' MOD scs_k_v39 s} +==> (i = i' MOD scs_k_v39 s /\ j= j' MOD scs_k_v39 s)\/ +(j = i' MOD scs_k_v39 s /\ i= j' MOD scs_k_v39 s)`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i'`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`j':num`) +THEN REPLICATE_TAC 21 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i':num`;`(j' MOD scs_k_v39 s)`] +THEN MRESA_TAC th[`i' MOD scs_k_v39 s:num`;`(j' MOD scs_k_v39 s)`]) +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (j' MOD scs_k_v39 s)`][periodic;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`i':num`) +THEN REPLICATE_TAC 15 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(i' MOD scs_k_v39 s)`;`(j' MOD scs_k_v39 s)`]) +THEN REWRITE_TAC[sqrt8] +]);; + + + + + + + + + + + + + + + + + + + + + + + +let IS_SCS_TRI_STABLE_SYSTEM=prove_by_refinement( +`is_scs_v39 s /\ scs_k_v39 s=3 +==> +tri_stable (scs_k_v39 s) (scs_d_v39 s) (0..(scs_k_v39 s)-1) +(change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) +(change_type_v2 (scs_J_v39 s) (scs_k_v39 s)) (\i. ((1+i):num MOD (scs_k_v39 s))) +`, +[ +REWRITE_TAC[is_scs_v39;tri_stable;constraint_system;torsor;change_type_v2;change_type_v3] +THEN RESA_TAC +THEN RESA_TAC +THEN MP_TAC (ARITH_RULE`3<= scs_k_v39 s==> (scs_k_v39 s - 1 +1)-0= scs_k_v39 s +/\ (scs_k_v39 s - 1 +1)= scs_k_v39 s/\ 1< scs_k_v39 s /\ 1<= scs_k_v39 s /\ 1<= scs_k_v39 s -1/\ ~(scs_k_v39 s=0)/\ 3-0=3`) +THEN RESA_TAC +THEN MRESA_TAC HAS_SIZE_NUMSEG[`0`;`scs_k_v39 s -1`] +THEN REPLICATE_TAC 23 (POP_ASSUM MP_TAC) +THEN REMOVE_ASSUM_TAC +THEN REPEAT DISCH_TAC +THEN STRIP_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN MRESAL1_TAC Hypermap.LE_MOD_SUC`scs_k_v39 s -1`[ADD1]; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`x1 <= scs_k_v39 s - 1 /\ +x2 <= scs_k_v39 s - 1 +==> 1+ x1 <= scs_k_v39 s -1 +1 /\ 1+ x2 <= scs_k_v39 s - 1+1`) +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL MOD_IMP_EQ)[`scs_k_v39 s`;`1+x1`;`1+x2`][ARITH_RULE`1<= 1+A /\ (1+A<=4<=> A<=3)`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`0 1<= i`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`scs_k_v39 s:num`;`x:num`;`i:num`] +THEN MP_TAC(ARITH_RULE`0 i=1 \/ i=2 `) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x<= 3-1==> x=0 \/ x=1 \/ x=2 `) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`scs_k_v39 s:num`;`x:num`;`scs_k_v39 s:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`scs_k_v39 s`;`x:num`][ARITH_RULE`1*A=A`] +THEN MP_TAC(ARITH_RULE`x<=scs_k_v39 s -1 /\ 3<= scs_k_v39 s ==> x< scs_k_v39 s`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`x:num`;`scs_k_v39 s`]; + +STRIP_TAC; + +REPLICATE_TAC 16 (REMOVE_ASSUM_TAC) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`j:num`]) +THEN REPLICATE_TAC 3 (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +STRIP_TAC; + +REPEAT GEN_TAC +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`scs_k_v39 s`;`j:num`;`scs_k_v39 s`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`scs_k_v39 s`;`j:num`][ARITH_RULE`1*A=A`] +THEN MRESAL_TAC MOD_MOD_REFL[`j:num`;`scs_k_v39 s`][ARITH_RULE`~(5=0)`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A=B <=> B=A`] +THEN STRIP_TAC; + +MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s i`][periodic]; + +MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s i`][periodic]; + +STRIP_TAC; + +ASM_TAC +THEN REWRITE_TAC[periodic2;SUBSET;IN_ELIM_THM] +THEN REPEAT DISCH_TAC +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC 13 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i:num`;`j:num`][ADD1;ARITH_RULE`1+i=i+1`]); + +EXISTS_TAC`i MOD scs_k_v39 s` +THEN REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN MRESA_TAC DIVISION[`i:num`;`scs_k_v39 s`] +THEN MP_TAC(ARITH_RULE`i MOD scs_k_v39 s < scs_k_v39 s +/\ 3<= scs_k_v39 s +==> i MOD scs_k_v39 s <= scs_k_v39 s-1`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`1:num`;`scs_k_v39 s`] +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`1:num`;`scs_k_v39 s`][ARITH_RULE`~(4=0) /\ 1 MOD 4=1`;ADD1]; + +EXISTS_TAC`j MOD scs_k_v39 s` +THEN REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN MRESA_TAC DIVISION[`j:num`;`scs_k_v39 s`] +THEN MP_TAC(ARITH_RULE`j MOD scs_k_v39 s < scs_k_v39 s +/\ 3<= scs_k_v39 s +==> j MOD scs_k_v39 s <= scs_k_v39 s-1`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`1:num`;`scs_k_v39 s`] +THEN MRESAL_TAC MOD_ADD_MOD[`j:num`;`1:num`;`scs_k_v39 s`][ARITH_RULE`~(4=0) /\ 1 MOD 4=1`;ADD1] +THEN SET_TAC[]; + +SUBGOAL_THEN`{{i MOD scs_k_v39 s, j MOD scs_k_v39 s} | i,j | scs_J_v39 s i j} +SUBSET {{i MOD scs_k_v39 s, SUC i MOD scs_k_v39 s} |i| i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}` +ASSUME_TAC; + +REWRITE_TAC[SUBSET;IN_ELIM_THM] +THEN GEN_TAC +THEN RESA_TAC +THEN REPLICATE_TAC 13 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i:num`;`j:num`][ADD1;ARITH_RULE`1+i=i+1`]); + +EXISTS_TAC`i:num MOD scs_k_v39 s` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC MOD_LT[`1:num`;`scs_k_v39 s`] +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`1:num`;`scs_k_v39 s`][ARITH_RULE`~(4=0) /\ 1 MOD 4=1`;ADD1] +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`scs_k_v39 s`][ARITH_RULE`~(4=0)`] +THEN MRESA_TAC DIVISION[`i:num`;`scs_k_v39 s`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic;periodic2] +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`j:num`) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (i MOD scs_k_v39 s)`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(i MOD scs_k_v39 s) +1:num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD scs_k_v39 s)`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(i MOD scs_k_v39 s) +1:num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i + 1) MOD scs_k_v39 s)`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`i:num`) +THEN REPLICATE_TAC 20 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`(i MOD scs_k_v39 s)`; `((i + 1) MOD scs_k_v39 s)`]) +THEN REWRITE_TAC[h0;cstab;sqrt8] +THEN REAL_ARITH_TAC; + +EXISTS_TAC`j:num MOD scs_k_v39 s` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC MOD_LT[`1:num`;`scs_k_v39 s`] +THEN MRESAL_TAC MOD_ADD_MOD[`j:num`;`1:num`;`scs_k_v39 s`][ARITH_RULE`~(4=0) /\ 1 MOD 4=1`;ADD1] +THEN MRESAL_TAC MOD_MOD_REFL[`j:num`;`scs_k_v39 s`][ARITH_RULE`~(4=0)`] +THEN MRESA_TAC DIVISION[`j:num`;`scs_k_v39 s`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic;periodic2;SET_RULE`{A,B}={B,A}`] +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s j`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`i:num`) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (j MOD scs_k_v39 s)`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(j MOD scs_k_v39 s) +1:num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j MOD scs_k_v39 s)`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(j MOD scs_k_v39 s) +1:num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((j + 1) MOD scs_k_v39 s)`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`j:num`) +THEN REPLICATE_TAC 20 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`(j MOD scs_k_v39 s)`; `((j + 1) MOD scs_k_v39 s)`]) +THEN REWRITE_TAC[h0;cstab;sqrt8] +THEN REAL_ARITH_TAC; + +SUBGOAL_THEN`{{i MOD scs_k_v39 s, SUC i MOD scs_k_v39 s} |i| i < scs_k_v39 s /\ + (&2 * h0 < + scs_b_v39 s i (SUC i) \/ + &2 < + scs_a_v39 s i (SUC i))} +SUBSET IMAGE (\i. {i MOD scs_k_v39 s, SUC i MOD scs_k_v39 s}) {i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}` + ASSUME_TAC; + + REWRITE_TAC[IN_ELIM_THM;IMAGE;SUBSET]; + +SUBGOAL_THEN` {i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))} +SUBSET 0.. scs_k_v39 s` + ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;SUBSET;IN_NUMSEG] +THEN ARITH_TAC; + + + +MRESAL_TAC CARD_SUBSET[`{i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}`; +`0.. scs_k_v39 s`][FINITE_NUMSEG] +THEN MRESAL_TAC FINITE_SUBSET[`{i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}`; +`0.. scs_k_v39 s`][FINITE_NUMSEG] +THEN MRESAL_TAC CARD_SUBSET_IMAGE +[`(\i. {i MOD scs_k_v39 s, SUC i MOD scs_k_v39 s})`;`{{i MOD scs_k_v39 s, SUC i MOD scs_k_v39 s} |i| i < scs_k_v39 s /\ + (&2 * h0 < + scs_b_v39 s i (SUC i) \/ + &2 < + scs_a_v39 s i (SUC i))}`;`{i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}`; +][FINITE_NUMSEG] +THEN MRESAL_TAC FINITE_IMAGE +[`(\i. {i MOD scs_k_v39 s, SUC i MOD scs_k_v39 s})`;`{i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}`; +][FINITE_NUMSEG] +THEN MRESAL_TAC FINITE_SUBSET[`{{i MOD scs_k_v39 s, SUC i MOD scs_k_v39 s} |i| i < scs_k_v39 s /\ + (&2 * h0 < + scs_b_v39 s i (SUC i) \/ + &2 < + scs_a_v39 s i (SUC i))}`; +`IMAGE (\i. {i MOD scs_k_v39 s, SUC i MOD scs_k_v39 s}) {i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}`][FINITE_NUMSEG] +THEN MRESAL_TAC CARD_SUBSET[`{{i MOD scs_k_v39 s, j MOD scs_k_v39 s} | i,j | scs_J_v39 s i j}`; +`{{i MOD scs_k_v39 s, SUC i MOD scs_k_v39 s} |i| i < scs_k_v39 s /\ + (&2 * h0 < + scs_b_v39 s i (SUC i) \/ + &2 < + scs_a_v39 s i (SUC i))}`][FINITE_NUMSEG] +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 2 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 13(REMOVE_ASSUM_TAC) +THEN POP_ASSUM (fun th-> +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[th]) +THEN ARITH_TAC; + + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC 17 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 25 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`;] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC 14 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th`i:num`[ADD1]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`i:num`) +THEN ASM_REWRITE_TAC[ARITH_RULE`1+i=i+1`] +THEN POP_ASSUM MP_TAC; + +REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`{i, j} = {i' MOD scs_k_v39 s, j' MOD scs_k_v39 s} +==> (i = i' MOD scs_k_v39 s /\ j= j' MOD scs_k_v39 s)\/ +(j = i' MOD scs_k_v39 s /\ i= j' MOD scs_k_v39 s)`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i'`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`j':num`) +THEN REPLICATE_TAC 22 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i':num`;`(j' MOD scs_k_v39 s)`] +THEN MRESA_TAC th[`i' MOD scs_k_v39 s:num`;`(j' MOD scs_k_v39 s)`]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (j' MOD scs_k_v39 s)`][periodic;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`i':num`) +THEN REPLICATE_TAC (42 -16) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(i' MOD scs_k_v39 s)`;`(j' MOD scs_k_v39 s)`]) +THEN REWRITE_TAC[sqrt8]; +]);; + + + + + +let IS_SCS_IN_BALL_ANNULUS_4= +fun (so:term)-> +REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th THEN REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM]) +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN EXISTS_TAC so +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 4 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)`;SET_RULE`(a:num) IN (:num)`] +;; + + + +let IS_SCS_IN_V_SY_4= +fun (so:term)-> + EXISTS_TAC so +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 4 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)/\ 1<=1/\ 1<=2 /\ 1<=3/\ SUC 1=2/\ SUC 2=3 /\ SUC 3=4/\ SUC 0=1`;SET_RULE`(a:num) IN (:num)`] +;; + + +let PROVE_E_SY_INV_TAC_4= +fun (th:term)-> +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`x':num`;th;`4`][ARITH_RULE`~(4=0)/\ 4 MOD 4=0/\ SUC 0 MOD 4=1/\ 1 MOD 4=1 /\ 2 MOD 4=2 /\ 3 MOD 4=3`] +THEN EXISTS_TAC th +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 4 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)/\ SUC 1=2/\ SUC 0=1 /\ SUC 2= 3/\ SUC 3=4/\ 1<=1 /\ 1<=2 /\ 1<=3`];; + + + + +let V_E_FF_IS_SCS_CASES_4=prove_by_refinement( +` is_scs_v39 s /\ scs_k_v39 s=4 /\ vv IN BBs_v39 s +/\ dimindex(:M)=scs_k_v39 s +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +==> +V_SY (v:real^3^M)=IMAGE vv (:num)/\ + E_SY (v:real^3^M)=IMAGE (\i. {vv i, vv (SUC i)}) (:num)/\ +F_SY (v:real^3^M)=IMAGE (\i. vv i,vv (SUC i)) (:num)` +, + (* {{{ proof *) +[ +STRIP_TAC +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39] +THEN REPEAT STRIP_TAC; + +REWRITE_TAC[V_SY;rows] +THEN REWRITE_TAC[ARITH_RULE`(1<= i /\ i<= 4)<=> (i=1\/ i=2\/ i=3 \/ i=4)`] +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN REWRITE_TAC[ARITH_RULE`(1<= i /\ i<= 4)<=> (i=1\/ i=2\/ i=3 \/ i=4)`] +THEN GEN_TAC +THEN EQ_TAC; + +REPEAT STRIP_TAC +THENL[ +IS_SCS_IN_V_SY_4`1`; +IS_SCS_IN_V_SY_4`2`; +IS_SCS_IN_V_SY_4`3`; +IS_SCS_IN_V_SY_4`0`]; + +REPEAT STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4)<=> (1<= i /\ i<= 4)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`4`;`vv:num-> real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 4 < 4==> x' MOD 4 =0 \/ x' MOD 4 = 1\/ x' MOD 4 = 2 \/ x' MOD 4 =3`) +THEN RESA_TAC +THENL[ +IS_SCS_IN_V_SY_4`4`; +IS_SCS_IN_V_SY_4`1`; +IS_SCS_IN_V_SY_4`2`; +IS_SCS_IN_V_SY_4`3`]; + +REWRITE_TAC[E_SY;rows] +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN REWRITE_TAC[ARITH_RULE`(1<= i /\ i<= 4)<=> (i=1\/ i=2\/ i=3 \/ i=4)`] +THEN GEN_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + +RESA_TAC +THENL[ +IS_SCS_IN_V_SY_4`1`; +IS_SCS_IN_V_SY_4`2`; +IS_SCS_IN_V_SY_4`3` +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`4`;`vv:num-> real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`SUC 3`[ARITH_RULE`SUC 3 MOD 4=0/\ SUC 3=4`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]); +IS_SCS_IN_V_SY_4`0`]; + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4)<=> (1<= i /\ i<= 4)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`4`;`vv:num-> real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num` THEN MRESA1_TAC th`SUC x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 4 < 4==> x' MOD 4 =0 \/ x' MOD 4 = 1\/ x' MOD 4 = 2 \/ x' MOD 4 =3`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_INV_TAC_4 `4`; +PROVE_E_SY_INV_TAC_4 `1`; +PROVE_E_SY_INV_TAC_4 `2`; +PROVE_E_SY_INV_TAC_4 `3`]; + +REWRITE_TAC[F_SY;rows] +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN REWRITE_TAC[ARITH_RULE`(1<= i /\ i<= 4)<=> (i=1\/ i=2\/ i=3 \/ i=4)`] +THEN GEN_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + +RESA_TAC +THENL[ +IS_SCS_IN_V_SY_4`1`; +IS_SCS_IN_V_SY_4`2`; +IS_SCS_IN_V_SY_4`3` +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`4`;`vv:num-> real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`SUC 3`[ARITH_RULE`SUC 3 MOD 4=0/\ SUC 3=4`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]); +IS_SCS_IN_V_SY_4`0`]; + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4)<=> (1<= i /\ i<= 4)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`4`;`vv:num-> real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num` THEN MRESA1_TAC th`SUC x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 4 < 4==> x' MOD 4 =0 \/ x' MOD 4 = 1\/ x' MOD 4 = 2 \/ x' MOD 4 =3`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_INV_TAC_4 `4`; +PROVE_E_SY_INV_TAC_4 `1`; +PROVE_E_SY_INV_TAC_4 `2`; +PROVE_E_SY_INV_TAC_4 `3`]]);; + + + + +let IN_IS_SCS_CASE_4=prove_by_refinement( +` is_scs_v39 s /\ scs_k_v39 s=4 /\ BBs_v39 s vv +/\ dimindex(:M)= scs_k_v39 s +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +==> +a IN {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ CONDITION2_SY v }` +, + (* {{{ proof *) +[ +REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;IN_ELIM_THM;CONDITION1_SY;CONDITION2_SY;BBs_v39;LET_DEF;LET_END_DEF;change_type_v3;dist] +THEN STRIP_TAC; + +REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + +EXISTS_TAC`v:real^3^M` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`(1<= i /\ i<= 4)<=> (i=1\/ i=2\/ i=3 \/ i=4)`] +THEN REPEAT STRIP_TAC +THENL[ +IS_SCS_IN_BALL_ANNULUS_4 `1`; +IS_SCS_IN_BALL_ANNULUS_4 `2`; +IS_SCS_IN_BALL_ANNULUS_4 `3`; +IS_SCS_IN_BALL_ANNULUS_4 `0`]; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`(1<= i /\ i<= 4)<=> (i=1\/ i=2\/ i=3 \/ i=4)`] +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`1<=i /\ i<= 4==> (i=1\/ i=2\/ i=3 \/ i=4)`) +THEN RESA_TAC +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 4 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)`;SET_RULE`(a:num) IN (:num)`] +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;periodic2] +THEN STRIP_TAC +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 1`][periodic;ARITH_RULE`~(4=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`4`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 1`][periodic;ARITH_RULE`~(4=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`4`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 2`][periodic;ARITH_RULE`~(4=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`4`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 2`][periodic;ARITH_RULE`~(4=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`4`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 3`][periodic;ARITH_RULE`~(4=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`4`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 3`][periodic;ARITH_RULE`~(4=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`4`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 4`][periodic;ARITH_RULE`~(4=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`4`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 4`][periodic;ARITH_RULE`~(4=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`4`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 0`][periodic;ARITH_RULE`~(4=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`4`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 0`][periodic;ARITH_RULE`~(4=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`4`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;]) +THEN REPLICATE_TAC 12 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESA_TAC th[`0`;`0`]); + +MP_TAC V_E_FF_IS_SCS_CASES_4 +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;IN_ELIM_THM;CONDITION1_SY;CONDITION2_SY;BBs_v39;LET_DEF;LET_END_DEF;change_type_v3;dist;IN] +THEN RESA_TAC]);; + + + + + +let IS_EAR_V25_EQ_EAR_SY=prove(`is_scs_v39 s /\ 3< scs_k_v39 s +/\ stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))=s1 +==> +(is_ear_v39 s <=> ear_sy s1)`, +REPEAT STRIP_TAC +THEN MP_TAC IS_SCS_STABLE_SYSTEM +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REWRITE_TAC[is_ear_v39;ear_sy] +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN MP_TAC (ARITH_RULE`3< scs_k_v39 s==> (scs_k_v39 s - 1 +1)-0= scs_k_v39 s +/\ ~(scs_k_v39 s=3)`) +THEN RESA_TAC +THEN MRESAL_TAC HAS_SIZE_NUMSEG[`0`;`scs_k_v39 s -1`][HAS_SIZE]);; + + + + + + +let INJ_H_FUN_TAC= +fun (so:term)-> +STRIP_TAC +THENL[ +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;ARITH_RULE`1 MOD 4=1 /\ SUC 1=2/\ 1+1=2 /\ 2 MOD 4=2/\ 1+2=3 /\ 3 MOD 4=3/\ 1+3=4 /\ 4 MOD 4=0/\ 1+0=1`] +THEN REPEAT STRIP_TAC) +THEN EXISTS_TAC so +THEN EXPAND_TAC"h" +THEN REWRITE_TAC[ARITH_RULE`1 MOD 4=1 /\ SUC 1=2/\ 1<4/\ ~(1=0)/\ 2<4 /\ 2 MOD 4=2 /\ ~(2=0)/\ SUC 2=3/\ 3<4/\ 3 MOD 4=3 /\ ~(3=0)/\ SUC 3=4/\ 0 MOD 4=0/\ 0<4/\ SUC 0=1`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic;periodic2;is_scs_v39] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i'`][periodic;ARITH_RULE`1 MOD 4=1 /\ SUC 1=2/\ 1<4/\ ~(4=0)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`j:num`) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (j MOD 4)`][periodic;ARITH_RULE`1 MOD 4=1 /\ SUC 1=2/\ 1<4/\ ~(4=0)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`i':num`) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`{1, 2} = {i' MOD 4, j MOD 4} +==> (1 =i' MOD 4 /\ 2= j MOD 4)\/ (2 =i' MOD 4 /\ 1= j MOD 4)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{2, 3} = {i' MOD 4, j MOD 4} +==> (2 =i' MOD 4 /\ 3= j MOD 4)\/ (3 =i' MOD 4 /\ 2= j MOD 4)`) +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s 3`][periodic;ARITH_RULE`1 MOD 4=1 /\ SUC 1=2/\ 1<4/\ ~(4=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`4:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`{3,0} = {i' MOD 4, j MOD 4} +==> (3 =i' MOD 4 /\ 0= j MOD 4)\/ (0 =i' MOD 4 /\ 3= j MOD 4)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{0,1} = {i' MOD 4, j MOD 4} +==> (i' MOD 4=1 /\ j MOD 4=0)\/ (i' MOD 4=0 /\ j MOD 4=1)`) +THEN RESA_TAC; +REPEAT STRIP_TAC +THEN REPLICATE_TAC 12 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]];; + + +let EXISTS_SCS_J_TAC= +fun (so:term) (so1:term) (so2:term)-> +EXPAND_TAC "h" +THEN REWRITE_TAC[ARITH_RULE`0 MOD 4=0/\SUC 0=1/\ SUC 1=2/\ SUC 2=3/\ SUC 3=4`] +THEN STRIP_TAC +THEN EXISTS_TAC so +THEN ASM_REWRITE_TAC[ARITH_RULE`4 MOD 4=0/\ SUC 0=1/\ 1<=4/\ 4<=4/\ 1+0=1/\ 1 MOD 4=1/\ 1<=1/\ 1<=4/\ 1 MOD 4=1/\ 1+1=2/\ ~(1=0)/\ 2 MOD 4=2/\ SUC 2=3/\ ~(2=0)/\ 1<=2/\ 2<=4/\ 1+2=3/\ 3 MOD 4=3/\ 1<=3/\ 3<=4/\ 1+3=4/\ SUC 3=4/\ ~(3=0)`] +THEN EXISTS_TAC so1 +THEN EXISTS_TAC so2 +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 4=0/\ 1 MOD 4=1/\ 2 MOD 4=2/\ 3 MOD 4=3/\ 4 MOD 4=0`] +;; + + + + +let TAUSTAR_EQ_TAU_STAR_IS_SCS_CASE_4=prove_by_refinement( +`is_scs_v39 s /\ scs_k_v39 s=4 +/\ vv IN BBs_v39 s +/\ dimindex(:M)=scs_k_v39 s +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +/\ stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))=s1 +==> taustar_v39 s vv = tau_star s1 a` +, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC V_E_FF_IS_SCS_CASES_4 +THEN ASM_REWRITE_TAC[IN] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC IS_SCS_STABLE_SYSTEM +THEN ASM_REWRITE_TAC[ARITH_RULE`3<4`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[taustar_v39;tau_star] +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;] +THEN ASM_SIMP_TAC[dsv_J_empty] +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[Dih2k_hypermap.VECMATS_MATVEC_ID] +THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=>B=C`;dsv_v39;d_fun] +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN ASM_REWRITE_TAC[REAL_ARITH`A+B=A+C<=>B=C`;sigma_sy] +THEN MP_TAC IS_EAR_V25_EQ_EAR_SY +THEN ASM_REWRITE_TAC[ARITH_RULE`3<4`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[REAL_EQ_MUL_LCANCEL;REAL_ARITH`~(#0.1 = &0)`] +THEN SUBGOAL_THEN`~((if ear_sy s1 then &1 else -- &1) = &0)` ASSUME_TAC; + +MP_TAC(SET_RULE`(ear_sy s1)\/ ~(ear_sy s1)`) +THEN RESA_TAC +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[J1_SY ] +THEN MATCH_MP_TAC SUM_EQ_GENERAL +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN ABBREV_TAC`h =(\i. if (i MOD 4 = 0) then (4,1) +else (i MOD 4, SUC(i MOD 4)))` +THEN SUBGOAL_THEN`(!x x'. + (x < 4 /\ scs_J_v39 s x (SUC x)) /\ + (x' < 4 /\ scs_J_v39 s x' (SUC x')) /\ + h x' = (h:num->num #num) x + ==> x = x')` ASSUME_TAC; + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE` x< 4 ==> x=0\/ x=1\/ x=2 \/ x=3 `) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE` x'< 4 ==> x'=0\/ x'=1\/ x'=2 \/ x'=3 `) +THEN RESA_TAC +THEN EXPAND_TAC"h" +THEN REWRITE_TAC[ARITH_RULE`1 MOD 4=1 /\ 0 MOD 4=0/\ 2 MOD 4=2/\ 3 MOD 4=3 /\ ~(1=0)/\ ~(2=0)/\ ~(3=0)/\ SUC 1=2/\ ~(1=4)/\ ~(2=4)/\ ~(3=4)`;ARITH_RULE`A=B <=> B=A:num`;PAIR_EQ;DE_MORGAN_THM] +THEN RESA_TAC; + +EXISTS_TAC`h:num->(num#num)` +THEN ASM_REWRITE_TAC[change_type_v2;IN_ELIM_THM;IN_NUMSEG] +THEN STRIP_TAC +THEN REPEAT STRIP_TAC; + +ASM_REWRITE_TAC[EXISTS_UNIQUE_THM] +THEN MP_TAC(ARITH_RULE`1<= i/\ i<=4 ==> i=1\/ i=2 \/ i=3 \/ i=4`) +THEN RESA_TAC +THENL[ +INJ_H_FUN_TAC `1`; +INJ_H_FUN_TAC `2`; +INJ_H_FUN_TAC `3`; +INJ_H_FUN_TAC `0`]; + +POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`x<4 ==> x=0 \/ x=1 \/ x=2 \/ x=3`) +THEN RESA_TAC +THENL[ +EXISTS_SCS_J_TAC `4` `0` `1`; +EXISTS_SCS_J_TAC `1` `1` `2`; +EXISTS_SCS_J_TAC `2` `2` `3`; +EXISTS_SCS_J_TAC `3` `3` `4`]; + +POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`x<4 ==> x=0 \/ x=1 \/ x=2 \/ x=3`) +THEN RESA_TAC +THEN EXPAND_TAC"h" +THEN REWRITE_TAC[ARITH_RULE`0 MOD 4=0/\ SUC 0=1`] +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[Dih2k_hypermap.VECMATS_MATVEC_ID] +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 4 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1)/\ ~(2=0) +/\ ~(3=0)/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)/\ SUC 1=2/\ SUC 0=1 /\ SUC 2= 3/\ SUC 3=4 /\ SUC 4=5`;SET_RULE`(a:num)IN (:num)`;dist] +THEN REPLICATE_TAC 25 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[IN;BBs_v39;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`4`[ARITH_RULE`4 MOD 4=0`])]);; + + + + +let JKQEWGV1_CASE_4=prove( +`!s vv. is_scs_v39 s /\ scs_k_v39 s=4 /\ BBs_v39 s vv /\ taustar_v39 s vv < &0 +/\ dimindex(:M)=scs_k_v39 s + ==> + (sol_local (IMAGE (\i. {vv i, vv (SUC i)}) (:num)) + (IMAGE (\i. (vv i,vv (SUC i))) (:num)) < pi)`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC IS_SCS_STABLE_SYSTEM +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;ARITH_RULE`3<4`] +THEN STRIP_TAC +THEN ABBREV_TAC`s1 =stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))` +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 0]:real^3^M` +THEN ABBREV_TAC`a=matvec (v:real^3^M)` +THEN MP_TAC TAUSTAR_EQ_TAU_STAR_IS_SCS_CASE_4 +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN;REAL_ARITH`(a=b)<=> (b=a:real)`] +THEN STRIP_TAC +THEN MP_TAC IN_IS_SCS_CASE_4 +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL GBYCPXS)[`(scs_k_v39 s)`;`s1:stable_sy`;`a:real^(M,3)finite_product`][k_sy;B_SY1;ARITH_RULE`2<4`;] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[Dih2k_hypermap.VECMATS_MATVEC_ID] +THEN MP_TAC V_E_FF_IS_SCS_CASES_4 +THEN ASM_REWRITE_TAC[IN] +THEN RESA_TAC +THEN ASM_TAC +THEN ASM_REWRITE_TAC[is_scs_v39;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`scs_d_v39 s < #0.9==> scs_d_v39 s <= #0.9`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`pi <= + sol_local (IMAGE (\i. {vv i, vv (SUC i)}) (:num)) + (IMAGE (\i. vv i,vv (SUC i)) (:num)) \/ + sol_local (IMAGE (\i. {vv i, vv (SUC i)}) (:num)) + (IMAGE (\i. vv i,vv (SUC i)) (:num))< pi`) +THEN RESA_TAC +THEN REPLICATE_TAC 19 REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC);; + + + +let IS_SCS_IN_V_SY_5= +fun (so:term)-> + EXISTS_TAC so +THEN MRESAL_TAC VECTOR_3_5[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 4 MOD 5= 4/\ 5 MOD 5=0 /\ 1 MOD 5= 1 /\ 2 MOD 5= 2/\ 3 MOD 5= 3 /\ ~(2=1)/\ SUC 5 MOD 5=1 +/\ SUC 4 MOD 5= 0 /\ SUC 1 MOD 5= 2 /\ SUC 2 MOD 5= 3/\ SUC 3 MOD 5= 4/\ ~(3=1)/\ ~(1=0)/\ 5<=5/\ 1<=1 /\ 1<=2 /\ 1<= 3 /\ 1<=4 /\ 1<=5 +/\ SUC 1=2 /\ SUC 0 =1/\ SUC 2=3/\ SUC 3=4/\ SUC 4=5 `; SET_RULE`(a:num) IN (:num)`] +;; + + +let PROVE_E_SY_INV_TAC_5= +fun (th:term)-> +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`x':num`;th;`5`][ARITH_RULE`~(5=0)/\ 4 MOD 5=4/\ SUC 0 MOD 5=1/\ 1 MOD 5=1 /\ 2 MOD 5=2 /\ 3 MOD 5=3/\ 5 MOD 5=0`] +THEN EXISTS_TAC th +THEN MRESAL_TAC VECTOR_3_5[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 4 MOD 5= 4/\ 5 MOD 5=0 /\ 1 MOD 5= 1 /\ 2 MOD 5= 2/\ 3 MOD 5= 3 /\ ~(2=1)/\ SUC 5 MOD 5=1 +/\ SUC 4 MOD 5= 0 /\ SUC 1 MOD 5= 2 /\ SUC 2 MOD 5= 3/\ SUC 3 MOD 5= 4/\ ~(3=1)/\ ~(1=0)/\ 5<=5/\ 1<=1 /\ 1<=2 /\ 1<= 3 /\ 1<=4 /\ 1<=5 +/\ SUC 1=2 /\ SUC 0 =1/\ SUC 2=3/\ SUC 3=4/\ SUC 4=5 `; SET_RULE`(a:num) IN (:num)`] +;; + + + + + + + + +let V_E_FF_IS_SCS_CASES_5=prove_by_refinement( +` is_scs_v39 s /\ scs_k_v39 s=5 /\ vv IN BBs_v39 s +/\ dimindex(:M)=scs_k_v39 s +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +==> +V_SY (v:real^3^M)=IMAGE vv (:num)/\ + E_SY (v:real^3^M)=IMAGE (\i. {vv i, vv (SUC i)}) (:num)/\ +F_SY (v:real^3^M)=IMAGE (\i. vv i,vv (SUC i)) (:num)`, + (* {{{ proof *) +[ + +STRIP_TAC +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39] +THEN REPEAT STRIP_TAC; + +REWRITE_TAC[V_SY;rows] +THEN REWRITE_TAC[ARITH_RULE`(1<= i /\ i<= 5)<=> (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)`] +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN REWRITE_TAC[ARITH_RULE`(1<= i /\ i<= 5)<=> (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)`] +THEN GEN_TAC +THEN EQ_TAC; + +REPEAT STRIP_TAC +THENL[ +IS_SCS_IN_V_SY_5`1`; +IS_SCS_IN_V_SY_5`2`; +IS_SCS_IN_V_SY_5`3`; +IS_SCS_IN_V_SY_5`4`; +IS_SCS_IN_V_SY_5`0`]; + +REPEAT STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4\/ i=5)<=> (1<= i /\ i<= 5)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`5`;`vv:num-> real^3`][ARITH_RULE`~(5=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 5 < 5==> x' MOD 5 =0 \/ x' MOD 5 = 1\/ x' MOD 5 = 2 \/ x' MOD 5 =3\/ x' MOD 5 =4`) +THEN RESA_TAC +THENL[ +IS_SCS_IN_V_SY_5`5`; +IS_SCS_IN_V_SY_5`1`; +IS_SCS_IN_V_SY_5`2`; +IS_SCS_IN_V_SY_5`3`; +IS_SCS_IN_V_SY_5`4`]; + +REWRITE_TAC[E_SY;rows] +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN REWRITE_TAC[ARITH_RULE`(1<= i /\ i<= 5)<=> (i=1\/ i=2\/ i=3 \/ i=4\/ i=5)`] +THEN GEN_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + +RESA_TAC +THENL[ +IS_SCS_IN_V_SY_5`1`; +IS_SCS_IN_V_SY_5`2`; +IS_SCS_IN_V_SY_5`3`; +IS_SCS_IN_V_SY_5`4` +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`5`;`vv:num-> real^3`][ARITH_RULE`~(5=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`SUC 4`[ARITH_RULE`SUC 4 MOD 5=0/\ SUC 4=5`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]); +IS_SCS_IN_V_SY_5`0`]; + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)<=> (1<= i /\ i<= 5)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`5`;`vv:num-> real^3`][ARITH_RULE`~(5=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num` THEN MRESA1_TAC th`SUC x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 5 < 5==> x' MOD 5 =0 \/ x' MOD 5 = 1\/ x' MOD 5 = 2 \/ x' MOD 5 =3 \/ x' MOD 5 =4`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_INV_TAC_5 `5`; +PROVE_E_SY_INV_TAC_5 `1`; +PROVE_E_SY_INV_TAC_5 `2`; +PROVE_E_SY_INV_TAC_5 `3`; +PROVE_E_SY_INV_TAC_5 `4`]; + +REWRITE_TAC[F_SY;rows] +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN REWRITE_TAC[ARITH_RULE`(1<= i /\ i<= 5)<=> (i=1\/ i=2\/ i=3 \/ i=4\/ i=5)`] +THEN GEN_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + +RESA_TAC +THENL[ +IS_SCS_IN_V_SY_5`1`; +IS_SCS_IN_V_SY_5`2`; +IS_SCS_IN_V_SY_5`3`; +IS_SCS_IN_V_SY_5`4` +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`5`;`vv:num-> real^3`][ARITH_RULE`~(5=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`SUC 4`[ARITH_RULE`SUC 4 MOD 5=0/\ SUC 4=5`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]); +IS_SCS_IN_V_SY_5`0`]; + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)<=> (1<= i /\ i<= 5)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`5`;`vv:num-> real^3`][ARITH_RULE`~(5=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num` THEN MRESA1_TAC th`SUC x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 5 < 5==> x' MOD 5 =0 \/ x' MOD 5 = 1\/ x' MOD 5 = 2 \/ x' MOD 5 =3 \/ x' MOD 5 =4`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_INV_TAC_5 `5`; +PROVE_E_SY_INV_TAC_5 `1`; +PROVE_E_SY_INV_TAC_5 `2`; +PROVE_E_SY_INV_TAC_5 `3`; +PROVE_E_SY_INV_TAC_5 `4`]; +]);; + + + +let IS_SCS_IN_BALL_ANNULUS_5= +fun (so:term)-> +REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th THEN REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM]) +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN EXISTS_TAC so +THEN MRESAL_TAC VECTOR_3_5[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 4 MOD 5= 4/\ 5 MOD 5=0 /\ 1 MOD 5= 1 /\ 2 MOD 5= 2/\ 3 MOD 5= 3 /\ ~(2=1)/\ SUC 5 MOD 5=1 +/\ SUC 4 MOD 5= 0 /\ SUC 1 MOD 5= 2 /\ SUC 2 MOD 5= 3/\ SUC 3 MOD 5= 4/\ ~(3=1)/\ ~(1=0)/\ 5<=5/\ 1<=1 /\ 1<=2 /\ 1<= 3 /\ 1<=4 /\ 1<=5 +/\ SUC 1=2 /\ SUC 0 =1/\ SUC 2=3/\ SUC 3=4/\ SUC 4=5 `; SET_RULE`(a:num) IN (:num)`] +;; + + + + +let IN_IS_SCS_CASE_5=prove_by_refinement( +` is_scs_v39 s /\ scs_k_v39 s=5 /\ BBs_v39 s vv +/\ dimindex(:M)= scs_k_v39 s +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +==> +a IN {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ CONDITION2_SY v }`, + (* {{{ proof *) +[ + +REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;IN_ELIM_THM;CONDITION1_SY;CONDITION2_SY;BBs_v39;LET_DEF;LET_END_DEF;change_type_v3;dist] +THEN STRIP_TAC; + +REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + +EXISTS_TAC`v:real^3^M` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`(1<= i /\ i<= 5)<=> (i=1\/ i=2\/ i=3 \/ i=4\/ i=5)`] +THEN REPEAT STRIP_TAC +THENL[ +IS_SCS_IN_BALL_ANNULUS_5 `1`; +IS_SCS_IN_BALL_ANNULUS_5 `2`; +IS_SCS_IN_BALL_ANNULUS_5 `3`; +IS_SCS_IN_BALL_ANNULUS_5 `4`; +IS_SCS_IN_BALL_ANNULUS_5 `0`]; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`(1<=i /\ i<= 5)<=> (i=1\/ i=2\/ i=3 \/ i=4\/ i=5)`] +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`1<=i /\ i<= 5==> (i=1\/ i=2\/ i=3 \/ i=4\/ i=5)`) +THEN RESA_TAC +THEN MRESAL_TAC VECTOR_3_5[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 4 MOD 5= 4/\ 5 MOD 5=0 /\ 1 MOD 5= 1 /\ 2 MOD 5= 2/\ 3 MOD 5= 3 /\ ~(2=1)/\ SUC 5 MOD 5=1 +/\ SUC 4 MOD 5= 0 /\ SUC 1 MOD 5= 2 /\ SUC 2 MOD 5= 3/\ SUC 3 MOD 5= 4/\ ~(3=1)/\ ~(1=0)/\ 5<=5/\ 1<=1 /\ 1<=2 /\ 1<= 3 /\ 1<=4 /\ 1<=5 +/\ SUC 1=2 /\ SUC 0 =1/\ SUC 2=3/\ SUC 3=4/\ SUC 4=5 `; SET_RULE`(a:num) IN (:num)`] +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;periodic2] +THEN STRIP_TAC +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 1`][periodic;ARITH_RULE`~(5=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`5`[ARITH_RULE`5 MOD 5=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 1`][periodic;ARITH_RULE`~(5=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`5`[ARITH_RULE`5 MOD 5=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 2`][periodic;ARITH_RULE`~(5=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`5`[ARITH_RULE`5 MOD 5=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 2`][periodic;ARITH_RULE`~(5=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`5`[ARITH_RULE`5 MOD 5=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 3`][periodic;ARITH_RULE`~(5=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`5`[ARITH_RULE`5 MOD 5=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 3`][periodic;ARITH_RULE`~(5=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`5`[ARITH_RULE`5 MOD 5=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 4`][periodic;ARITH_RULE`~(5=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`5`[ARITH_RULE`5 MOD 5=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 4`][periodic;ARITH_RULE`~(5=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`5`[ARITH_RULE`5 MOD 5=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 5`][periodic;ARITH_RULE`~(5=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`5`[ARITH_RULE`5 MOD 5=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 5`][periodic;ARITH_RULE`~(5=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`5`[ARITH_RULE`5 MOD 5=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 0`][periodic;ARITH_RULE`~(5=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`5`[ARITH_RULE`5 MOD 5=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 0`][periodic;ARITH_RULE`~(5=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`5`[ARITH_RULE`5 MOD 5=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;]) +THEN REPLICATE_TAC 13 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESA_TAC th[`0`;`0`]); + +MP_TAC V_E_FF_IS_SCS_CASES_5 +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;IN_ELIM_THM;CONDITION1_SY;CONDITION2_SY;BBs_v39;LET_DEF;LET_END_DEF;change_type_v3;dist;IN] +THEN RESA_TAC]);; + + + + +let INJ_H_FUN_TAC= +fun (so:term)-> +STRIP_TAC +THENL[ +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;ARITH_RULE`1 MOD 5=1 /\ SUC 1=2/\ 1+1=2 /\ 2 MOD 5=2/\ 1+2=3 /\ 3 MOD 5=3/\ 1+3=4 /\ 5 MOD 5=0/\ 1+0=1/\ 1+4=5 /\ 4 MOD 5=4`] +THEN REPEAT STRIP_TAC) +THEN EXISTS_TAC so +THEN EXPAND_TAC"h" +THEN REWRITE_TAC[ARITH_RULE`1 MOD 5=1 /\ SUC 1=2/\ 1<5/\ ~(1=0)/\ 2<5 /\ 2 MOD 5=2 /\ ~(2=0)/\ SUC 2=3/\ 3<5/\ 3 MOD 5=3 /\ ~(3=0)/\ SUC 3=4/\ 0 MOD 5=0/\ 0<5/\ SUC 0=1/\4<5 /\ SUC 4=5/\ ~(4=0)/\ 4 MOD 5=4`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic;periodic2;is_scs_v39] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i'`][periodic;ARITH_RULE`1 MOD 5=1 /\ SUC 1=2/\ 1<5/\ ~(5=0)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`j:num`) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (j MOD 5)`][periodic;ARITH_RULE`1 MOD 5=1 /\ SUC 1=2/\ 1<5/\ ~(5=0)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`i':num`) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`{1, 2} = {i' MOD 5, j MOD 5} +==> (1 =i' MOD 5 /\ 2= j MOD 5)\/ (2 =i' MOD 5 /\ 1= j MOD 5)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{2, 3} = {i' MOD 5, j MOD 5} +==> (2 =i' MOD 5 /\ 3= j MOD 5)\/ (3 =i' MOD 5 /\ 2= j MOD 5)`) +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s 4`][periodic;ARITH_RULE`1 MOD 5=1 /\ SUC 1=2/\ 1<5/\ ~(5=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`5:num`[ARITH_RULE`5 MOD 5=0`]) +THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`{3,4} = {i' MOD 5, j MOD 5} +==> (3 =i' MOD 5 /\ 4= j MOD 5)\/ (4 =i' MOD 5 /\ 3= j MOD 5)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{4,0} = {i' MOD 5, j MOD 5} +==> (4=i' MOD 5 /\ 0=j MOD 5)\/ (0=i' MOD 5 /\ 4=j MOD 5)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{0,1} = {i' MOD 5, j MOD 5} +==> (i' MOD 5=1 /\ j MOD 5=0)\/ (i' MOD 5=0 /\ j MOD 5=1)`) +THEN RESA_TAC; +REPEAT STRIP_TAC +THEN REPLICATE_TAC 12 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]];; + + + + + +let EXISTS_SCS_J_TAC= +fun (so:term) (so1:term) (so2:term)-> +EXPAND_TAC "h" +THEN REWRITE_TAC[ARITH_RULE`0 MOD 5=0/\SUC 0=1/\ SUC 1=2/\ SUC 2=3/\ SUC 3=4/\ SUC 4=5`] +THEN STRIP_TAC +THEN EXISTS_TAC so +THEN ASM_REWRITE_TAC[ARITH_RULE`5 MOD 5=0/\ SUC 0=1/\ 1<=5/\ 5<=5/\ 1+0=1/\ 1 MOD 5=1/\ 1<=1/\ 1<=5/\ 1 MOD 5=1/\ 1+1=2/\ ~(1=0)/\ 2 MOD 5=2/\ SUC 2=3/\ ~(2=0)/\ 1<=2/\ 2<=5/\ 1+2=3/\ 3 MOD 5=3/\ 1<=3/\ 3<=5/\ 1+3=4/\ SUC 3=4/\ ~(3=0)/\ ~(4=0)/\ 1<=4/\ 4<=5/\ SUC 4=5/\ 4 MOD 5=4/\ 1+4=5`] +THEN EXISTS_TAC so1 +THEN EXISTS_TAC so2 +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 5=0/\ 1 MOD 5=1/\ 2 MOD 5=2/\ 3 MOD 5=3/\ 5 MOD 5=0/\ 4 MOD 5=4`] +;; + + + + + +let TAUSTAR_EQ_TAU_STAR_IS_SCS_CASE_5=prove_by_refinement( +`is_scs_v39 s /\ scs_k_v39 s=5 +/\ vv IN BBs_v39 s +/\ dimindex(:M)=scs_k_v39 s +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +/\ stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))=s1 +==> taustar_v39 s vv = tau_star s1 a`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC V_E_FF_IS_SCS_CASES_5 +THEN ASM_REWRITE_TAC[IN] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC IS_SCS_STABLE_SYSTEM +THEN ASM_REWRITE_TAC[ARITH_RULE`3<5`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[taustar_v39;tau_star] +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39;] +THEN ASM_SIMP_TAC[dsv_J_empty] +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[Dih2k_hypermap.VECMATS_MATVEC_ID] +THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=>B=C`;dsv_v39;d_fun] +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN ASM_REWRITE_TAC[REAL_ARITH`A+B=A+C<=>B=C`;sigma_sy] +THEN MP_TAC IS_EAR_V25_EQ_EAR_SY +THEN ASM_REWRITE_TAC[ARITH_RULE`3<5`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[REAL_EQ_MUL_LCANCEL;REAL_ARITH`~(#0.1 = &0)`] +THEN SUBGOAL_THEN`~((if ear_sy s1 then &1 else -- &1) = &0)` ASSUME_TAC; + +MP_TAC(SET_RULE`(ear_sy s1)\/ ~(ear_sy s1)`) +THEN RESA_TAC +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[J1_SY ] +THEN MATCH_MP_TAC SUM_EQ_GENERAL +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN ABBREV_TAC`h =(\i. if (i MOD 5 = 0) then (5,1) +else (i MOD 5, SUC(i MOD 5)))` +THEN SUBGOAL_THEN`(!x x'. + (x < 5 /\ scs_J_v39 s x (SUC x)) /\ + (x' < 5 /\ scs_J_v39 s x' (SUC x')) /\ + h x' = (h:num->num #num) x + ==> x = x')` ASSUME_TAC; + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE` x< 5 ==> x=0\/ x=1\/ x=2 \/ x=3\/ x=4 `) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE` x'< 5 ==> x'=0\/ x'=1\/ x'=2 \/ x'=3 \/ x'=4`) +THEN RESA_TAC +THEN EXPAND_TAC"h" +THEN REWRITE_TAC[ARITH_RULE`1 MOD 5=1 /\ 0 MOD 5=0/\ 2 MOD 5=2/\ 3 MOD 5=3 /\ 4 MOD 5=4/\ ~(1=0)/\ ~(2=0)/\ ~(3=0)/\ ~(4=0)/\ SUC 1=2/\ ~(1=5)/\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`;ARITH_RULE`A=B <=> B=A:num`;PAIR_EQ;DE_MORGAN_THM] +THEN RESA_TAC; + +EXISTS_TAC`h:num->(num#num)` +THEN ASM_REWRITE_TAC[change_type_v2;IN_ELIM_THM;IN_NUMSEG] +THEN STRIP_TAC +THEN REPEAT STRIP_TAC; + +ASM_REWRITE_TAC[EXISTS_UNIQUE_THM] +THEN MP_TAC(ARITH_RULE`1<= i/\ i<=5 ==> i=1\/ i=2 \/ i=3 \/ i=4 \/i=5 `) +THEN RESA_TAC +THENL[ +INJ_H_FUN_TAC `1`; +INJ_H_FUN_TAC `2`; +INJ_H_FUN_TAC `3`; +INJ_H_FUN_TAC `4`; +INJ_H_FUN_TAC `0`]; + +POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`x<5 ==> x=0 \/ x=1 \/ x=2 \/ x=3\/ x=4`) +THEN RESA_TAC +THENL[ +EXISTS_SCS_J_TAC `5` `0` `1`; +EXISTS_SCS_J_TAC `1` `1` `2`; +EXISTS_SCS_J_TAC `2` `2` `3`; +EXISTS_SCS_J_TAC `3` `3` `4`; +EXISTS_SCS_J_TAC `4` `4` `5`]; + +POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`x<5 ==> x=0 \/ x=1 \/ x=2 \/ x=3\/ x=4`) +THEN RESA_TAC +THEN EXPAND_TAC"h" +THEN REWRITE_TAC[ARITH_RULE`0 MOD 5=0/\ SUC 0=1`] +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[Dih2k_hypermap.VECMATS_MATVEC_ID] +THEN MRESAL_TAC VECTOR_3_5[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 4 MOD 5= 4/\ 5 MOD 5=0 /\ 1 MOD 5= 1 /\ 2 MOD 5= 2/\ 3 MOD 5= 3 /\ ~(2=1)/\ SUC 5 MOD 5=1/\ ~(2=0) /\ ~(3=0)/\ ~(4=0) +/\ SUC 4 MOD 5= 0 /\ SUC 1 MOD 5= 2 /\ SUC 2 MOD 5= 3/\ SUC 3 MOD 5= 4/\ ~(3=1)/\ ~(1=0)/\ 5<=5/\ 1<=1 /\ 1<=2 /\ 1<= 3 /\ 1<=4 /\ 1<=5 +/\ SUC 1=2 /\ SUC 0 =1/\ SUC 2=3/\ SUC 3=4/\ SUC 4=5 `; SET_RULE`(a:num) IN (:num)`;dist] +THEN REPLICATE_TAC 26 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[IN;BBs_v39;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(5=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`5`[ARITH_RULE`5 MOD 5=0`]);]);; + + + + +let JKQEWGV1_CASE_5=prove(`!s vv. is_scs_v39 s /\ scs_k_v39 s=5 /\ BBs_v39 s vv /\ taustar_v39 s vv < &0 +/\ dimindex(:M)=scs_k_v39 s + ==> + (sol_local (IMAGE (\i. {vv i, vv (SUC i)}) (:num)) + (IMAGE (\i. (vv i,vv (SUC i))) (:num)) < pi)`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC IS_SCS_STABLE_SYSTEM +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;ARITH_RULE`3<5`] +THEN STRIP_TAC +THEN ABBREV_TAC`s1 =stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))` +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 0]:real^3^M` +THEN ABBREV_TAC`a=matvec (v:real^3^M)` +THEN MP_TAC TAUSTAR_EQ_TAU_STAR_IS_SCS_CASE_5 +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN;REAL_ARITH`(a=b)<=> (b=a:real)`] +THEN STRIP_TAC +THEN MP_TAC IN_IS_SCS_CASE_5 +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL GBYCPXS)[`(scs_k_v39 s)`;`s1:stable_sy`;`a:real^(M,3)finite_product`][k_sy;B_SY1;ARITH_RULE`2<5`;] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[Dih2k_hypermap.VECMATS_MATVEC_ID] +THEN MP_TAC V_E_FF_IS_SCS_CASES_5 +THEN ASM_REWRITE_TAC[IN] +THEN RESA_TAC +THEN ASM_TAC +THEN ASM_REWRITE_TAC[is_scs_v39;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`scs_d_v39 s < #0.9==> scs_d_v39 s <= #0.9`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`pi <= + sol_local (IMAGE (\i. {vv i, vv (SUC i)}) (:num)) + (IMAGE (\i. vv i,vv (SUC i)) (:num)) \/ + sol_local (IMAGE (\i. {vv i, vv (SUC i)}) (:num)) + (IMAGE (\i. vv i,vv (SUC i)) (:num))< pi`) +THEN RESA_TAC +THEN REPLICATE_TAC 19 REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC);; + + + + +let IS_SCS_IN_V_SY_6= +fun (so:term)-> + EXISTS_TAC so +THEN MRESAL_TAC VECTOR_3_6[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 5`;`(vv:num->real^3) 0`][ARITH_RULE`1<=6/\ 2<=6/\ 3<=6/\ 4<=6/\ 5<=6 /\ 6<=6 /\ 0 MOD 6= 0 /\ 1 MOD 6= 1 /\ 2 MOD 6= 2/\ 3 MOD 6= 3 /\ 4 MOD 6= 4 /\ 5 MOD 6=5 /\ 6 MOD 6=0 /\ ~(2=1) +/\ SUC 0 MOD 6= 1 /\ SUC 1 MOD 6= 2 /\ SUC 2 MOD 6= 3/\ SUC 3 MOD 6= 4 +/\ SUC 4 MOD 6= 5 /\ SUC 5 MOD 6 = 0 /\ SUC 6 MOD 6 =1 /\ ~(3=1)/\ ~(1=0) +/\ 1<=1 /\1<=2/\ 1<=3/\ 1<=4/\1<=5 +/\ SUC 0=1/\ SUC 1=2/\ SUC 2=3/\ SUC 3=4/\ SUC 4=5/\ SUC 5=6`; SET_RULE`(a:num) IN (:num)`] +;; + + +let PROVE_E_SY_INV_TAC_6= +fun (th:term)-> +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`x':num`;th;`6`][ARITH_RULE`~(6=0)/\ 4 MOD 6=4/\ SUC 0 MOD 6=1/\ 1 MOD 6=1 /\ 2 MOD 6=2 /\ 3 MOD 6=3/\ 6 MOD 6=0/\ 5 MOD 6=5`] +THEN EXISTS_TAC th +THEN MRESAL_TAC VECTOR_3_6[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 5`;`(vv:num->real^3) 0`][ARITH_RULE`1<=6/\ 2<=6/\ 3<=6/\ 4<=6/\ 5<=6 /\ 6<=6 /\ 0 MOD 6= 0 /\ 1 MOD 6= 1 /\ 2 MOD 6= 2/\ 3 MOD 6= 3 /\ 4 MOD 6= 4 /\ 5 MOD 6=5 /\ 6 MOD 6=0 /\ ~(2=1) +/\ SUC 0 MOD 6= 1 /\ SUC 1 MOD 6= 2 /\ SUC 2 MOD 6= 3/\ SUC 3 MOD 6= 4 +/\ SUC 4 MOD 6= 5 /\ SUC 5 MOD 6 = 0 /\ SUC 6 MOD 6 =1 /\ ~(3=1)/\ ~(1=0) +/\ 1<=1 /\1<=2/\ 1<=3/\ 1<=4/\1<=5 +/\ SUC 0=1/\ SUC 1=2/\ SUC 2=3/\ SUC 3=4/\ SUC 4=5/\ SUC 5=6`; SET_RULE`(a:num) IN (:num)`] +;; + + + + + + + + +let V_E_FF_IS_SCS_CASES_6=prove_by_refinement( +` is_scs_v39 s /\ scs_k_v39 s=6 /\ vv IN BBs_v39 s +/\ dimindex(:M)=scs_k_v39 s +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 5;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +==> +V_SY (v:real^3^M)=IMAGE vv (:num)/\ + E_SY (v:real^3^M)=IMAGE (\i. {vv i, vv (SUC i)}) (:num)/\ +F_SY (v:real^3^M)=IMAGE (\i. vv i,vv (SUC i)) (:num)`, + (* {{{ proof *) +[ +STRIP_TAC +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(6<=3)`;IN;mk_unadorned_v39] +THEN REPEAT STRIP_TAC; + +REWRITE_TAC[V_SY;rows] +THEN REWRITE_TAC[ARITH_RULE`(1<= i /\ i<= 6)<=> (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5\/ i=6)`] +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN REWRITE_TAC[ARITH_RULE`(1<= i /\ i<= 6)<=> (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5\/ i=6)`] +THEN GEN_TAC +THEN EQ_TAC; + +REPEAT STRIP_TAC +THENL[ +IS_SCS_IN_V_SY_6`1`; +IS_SCS_IN_V_SY_6`2`; +IS_SCS_IN_V_SY_6`3`; +IS_SCS_IN_V_SY_6`4`; +IS_SCS_IN_V_SY_6`5`; +IS_SCS_IN_V_SY_6`0`]; + +REPEAT STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4\/ i=5\/ i=6)<=> (1<= i /\ i<= 6)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`6`;`vv:num-> real^3`][ARITH_RULE`~(6=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`6`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 6 < 6==> x' MOD 6 =0 \/ x' MOD 6 = 1\/ x' MOD 6 = 2 \/ x' MOD 6 =3\/ x' MOD 6 =4\/ x' MOD 6=5`) +THEN RESA_TAC +THENL[ +IS_SCS_IN_V_SY_6`6`; +IS_SCS_IN_V_SY_6`1`; +IS_SCS_IN_V_SY_6`2`; +IS_SCS_IN_V_SY_6`3`; +IS_SCS_IN_V_SY_6`4`; +IS_SCS_IN_V_SY_6`5`]; + +REWRITE_TAC[E_SY;rows] +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN REWRITE_TAC[ARITH_RULE`(1<= i /\ i<= 6)<=> (i=1\/ i=2\/ i=3 \/ i=4\/ i=5\/ i=6)`] +THEN GEN_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + +RESA_TAC +THENL[ +IS_SCS_IN_V_SY_6`1`; +IS_SCS_IN_V_SY_6`2`; +IS_SCS_IN_V_SY_6`3`; +IS_SCS_IN_V_SY_6`4`; +IS_SCS_IN_V_SY_6`5` +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`6`;`vv:num-> real^3`][ARITH_RULE`~(6=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`SUC 5`[ARITH_RULE`SUC 5 MOD 6=0/\ SUC 5=6`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]); +IS_SCS_IN_V_SY_6`0`]; + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5\/ i=6)<=> (1<= i /\ i<= 6)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`6`;`vv:num-> real^3`][ARITH_RULE`~(6=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num` THEN MRESA1_TAC th`SUC x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`6`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 6 < 6==> x' MOD 6 =0 \/ x' MOD 6 = 1\/ x' MOD 6 = 2 \/ x' MOD 6 =3 \/ x' MOD 6 =4\/ x' MOD 6=5`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_INV_TAC_6 `6`; +PROVE_E_SY_INV_TAC_6 `1`; +PROVE_E_SY_INV_TAC_6 `2`; +PROVE_E_SY_INV_TAC_6 `3`; +PROVE_E_SY_INV_TAC_6 `4`; +PROVE_E_SY_INV_TAC_6 `5`;]; + +REWRITE_TAC[F_SY;rows] +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN REWRITE_TAC[ARITH_RULE`(1<= i /\ i<= 6)<=> (i=1\/ i=2\/ i=3 \/ i=4\/ i=5\/ i=6)`] +THEN GEN_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + +RESA_TAC +THENL[ +IS_SCS_IN_V_SY_6`1`; +IS_SCS_IN_V_SY_6`2`; +IS_SCS_IN_V_SY_6`3`; +IS_SCS_IN_V_SY_6`4`; +IS_SCS_IN_V_SY_6`5` +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`6`;`vv:num-> real^3`][ARITH_RULE`~(6=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`SUC 5`[ARITH_RULE`SUC 5 MOD 6=0/\ SUC 5=6`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]); +IS_SCS_IN_V_SY_6`0`]; + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5\/ i=6)<=> (1<= i /\ i<= 6)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`6`;`vv:num-> real^3`][ARITH_RULE`~(6=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num` THEN MRESA1_TAC th`SUC x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`6`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 6 < 6==> x' MOD 6 =0 \/ x' MOD 6 = 1\/ x' MOD 6 = 2 \/ x' MOD 6 =3 \/ x' MOD 6 =4\/ x' MOD 6=5`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_INV_TAC_6 `6`; +PROVE_E_SY_INV_TAC_6 `1`; +PROVE_E_SY_INV_TAC_6 `2`; +PROVE_E_SY_INV_TAC_6 `3`; +PROVE_E_SY_INV_TAC_6 `4`; +PROVE_E_SY_INV_TAC_6 `5`;]]);; + + + + + + +let IS_SCS_IN_BALL_ANNULUS_6= +fun (so:term)-> +REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th THEN REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM]) +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN EXISTS_TAC so +THEN MRESAL_TAC VECTOR_3_6[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 5`;`(vv:num->real^3) 0`][ARITH_RULE`1<=6/\ 2<=6/\ 3<=6/\ 4<=6/\ 5<=6 /\ 6<=6 /\ 0 MOD 6= 0 /\ 1 MOD 6= 1 /\ 2 MOD 6= 2/\ 3 MOD 6= 3 /\ 4 MOD 6= 4 /\ 5 MOD 6=5 /\ 6 MOD 6=0 /\ ~(2=1) +/\ SUC 0 MOD 6= 1 /\ SUC 1 MOD 6= 2 /\ SUC 2 MOD 6= 3/\ SUC 3 MOD 6= 4 +/\ SUC 4 MOD 6= 5 /\ SUC 5 MOD 6 = 0 /\ SUC 6 MOD 6 =1 /\ ~(3=1)/\ ~(1=0) +/\ 1<=1 /\1<=2/\ 1<=3/\ 1<=4/\1<=5 +/\ SUC 0=1/\ SUC 1=2/\ SUC 2=3/\ SUC 3=4/\ SUC 4=5/\ SUC 5=6`; SET_RULE`(a:num) IN (:num)`] +;; + + + + +let IN_IS_SCS_CASE_6=prove_by_refinement( +` is_scs_v39 s /\ scs_k_v39 s=6 /\ BBs_v39 s vv +/\ dimindex(:M)= scs_k_v39 s +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 5;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +==> +a IN {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ CONDITION2_SY v }`, + (* {{{ proof *) +[ +REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;IN_ELIM_THM;CONDITION1_SY;CONDITION2_SY;BBs_v39;LET_DEF;LET_END_DEF;change_type_v3;dist] +THEN STRIP_TAC; + +REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + +EXISTS_TAC`v:real^3^M` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`(1<= i /\ i<= 6)<=> (i=1\/ i=2\/ i=3 \/ i=4\/ i=5\/ i=6)`] +THEN REPEAT STRIP_TAC +THENL[ +IS_SCS_IN_BALL_ANNULUS_6 `1`; +IS_SCS_IN_BALL_ANNULUS_6 `2`; +IS_SCS_IN_BALL_ANNULUS_6 `3`; +IS_SCS_IN_BALL_ANNULUS_6 `4`; +IS_SCS_IN_BALL_ANNULUS_6 `5`; +IS_SCS_IN_BALL_ANNULUS_6 `0`]; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`(1<=i /\ i<= 6)<=> (i=1\/ i=2\/ i=3 \/ i=4\/ i=5\/ i=6)`] +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`1<=i /\ i<= 6==> (i=1\/ i=2\/ i=3 \/ i=4\/ i=5\/ i=6)`) +THEN RESA_TAC +THEN MRESAL_TAC VECTOR_3_6[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 5`;`(vv:num->real^3) 0`][ARITH_RULE`1<=6/\ 2<=6/\ 3<=6/\ 4<=6/\ 5<=6 /\ 6<=6 /\ 0 MOD 6= 0 /\ 1 MOD 6= 1 /\ 2 MOD 6= 2/\ 3 MOD 6= 3 /\ 4 MOD 6= 4 /\ 5 MOD 6=5 /\ 6 MOD 6=0 /\ ~(2=1) +/\ SUC 0 MOD 6= 1 /\ SUC 1 MOD 6= 2 /\ SUC 2 MOD 6= 3/\ SUC 3 MOD 6= 4 +/\ SUC 4 MOD 6= 5 /\ SUC 5 MOD 6 = 0 /\ SUC 6 MOD 6 =1 /\ ~(3=1)/\ ~(1=0) +/\ 1<=1 /\1<=2/\ 1<=3/\ 1<=4/\1<=5 +/\ SUC 0=1/\ SUC 1=2/\ SUC 2=3/\ SUC 3=4/\ SUC 4=5/\ SUC 5=6`; SET_RULE`(a:num) IN (:num)`] +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;periodic2] +THEN STRIP_TAC +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 1`][periodic;ARITH_RULE`~(6=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`6`[ARITH_RULE`6 MOD 6=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 1`][periodic;ARITH_RULE`~(6=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`6`[ARITH_RULE`6 MOD 6=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 2`][periodic;ARITH_RULE`~(6=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`6`[ARITH_RULE`6 MOD 6=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 2`][periodic;ARITH_RULE`~(6=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`6`[ARITH_RULE`6 MOD 6=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 3`][periodic;ARITH_RULE`~(6=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`6`[ARITH_RULE`6 MOD 6=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 3`][periodic;ARITH_RULE`~(6=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`6`[ARITH_RULE`6 MOD 6=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 4`][periodic;ARITH_RULE`~(6=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`6`[ARITH_RULE`6 MOD 6=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 4`][periodic;ARITH_RULE`~(6=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`6`[ARITH_RULE`6 MOD 6=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 5`][periodic;ARITH_RULE`~(6=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`6`[ARITH_RULE`6 MOD 6=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 5`][periodic;ARITH_RULE`~(6=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`6`[ARITH_RULE`6 MOD 6=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 6`][periodic;ARITH_RULE`~(6=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`6`[ARITH_RULE`6 MOD 6=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 6`][periodic;ARITH_RULE`~(6=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`6`[ARITH_RULE`6 MOD 6=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 0`][periodic;ARITH_RULE`~(6=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`6`[ARITH_RULE`6 MOD 6=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 0`][periodic;ARITH_RULE`~(6=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`6`[ARITH_RULE`6 MOD 6=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;]) +THEN REPLICATE_TAC 14 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESA_TAC th[`0`;`0`]); + +MP_TAC V_E_FF_IS_SCS_CASES_6 +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;IN_ELIM_THM;CONDITION1_SY;CONDITION2_SY;BBs_v39;LET_DEF;LET_END_DEF;change_type_v3;dist;IN] +THEN RESA_TAC]);; + + + + +let INJ_H_FUN_TAC= +fun (so:term)-> +STRIP_TAC +THENL[ +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;ARITH_RULE`1 MOD 6=1 /\ SUC 1=2/\ 1+1=2 /\ 2 MOD 6=2/\ 1+2=3 /\ 3 MOD 6=3/\ 1+3=4 /\ 6 MOD 6=0/\ 1+0=1/\ 1+4=5 /\ 4 MOD 6=4/\ 1+5=6/\ 5 MOD 6=5`] +THEN REPEAT STRIP_TAC) +THEN EXISTS_TAC so +THEN EXPAND_TAC"h" +THEN REWRITE_TAC[ARITH_RULE`1 MOD 6=1 /\ SUC 1=2/\ 1<6/\ ~(1=0)/\ 2<6 /\ 2 MOD 6=2 /\ ~(2=0)/\ SUC 2=3/\ 3<6/\ 3 MOD 6=3 /\ ~(3=0)/\ SUC 3=4/\ 0 MOD 6=0/\ 0<6/\ SUC 0=1/\4<6 /\ SUC 4=5/\ ~(4=0)/\ 4 MOD 6=4/\ SUC 5=6/\ ~(5=0)/\ 5 MOD 6=5/\ 5<6`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic;periodic2;is_scs_v39] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i'`][periodic;ARITH_RULE`1 MOD 6=1 /\ SUC 1=2/\ 1<6/\ ~(6=0)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`j:num`) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (j MOD 6)`][periodic;ARITH_RULE`1 MOD 6=1 /\ SUC 1=2/\ 1<6/\ ~(6=0)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`i':num`) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`{1, 2} = {i' MOD 6, j MOD 6} +==> (1 =i' MOD 6 /\ 2= j MOD 6)\/ (2 =i' MOD 6 /\ 1= j MOD 6)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{2, 3} = {i' MOD 6, j MOD 6} +==> (2 =i' MOD 6 /\ 3= j MOD 6)\/ (3 =i' MOD 6 /\ 2= j MOD 6)`) +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s 5`][periodic;ARITH_RULE`1 MOD 6=1 /\ SUC 1=2/\ 1<6/\ ~(6=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`6:num`[ARITH_RULE`6 MOD 6=0`]) +THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`{3,4} = {i' MOD 6, j MOD 6} +==> (3 =i' MOD 6 /\ 4= j MOD 6)\/ (4 =i' MOD 6 /\ 3= j MOD 6)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{4,5} = {i' MOD 6, j MOD 6} +==> (4=i' MOD 6 /\ 5=j MOD 6)\/ (5=i' MOD 6 /\ 4=j MOD 6)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{5,0} = {i' MOD 6, j MOD 6} +==> (5=i' MOD 6 /\ 0=j MOD 6)\/ (0=i' MOD 6 /\ 5=j MOD 6)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{0,1} = {i' MOD 6, j MOD 6} +==> (i' MOD 6=1 /\ j MOD 6=0)\/ (i' MOD 6=0 /\ j MOD 6=1)`) +THEN RESA_TAC; +REPEAT STRIP_TAC +THEN REPLICATE_TAC 12 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]];; + + + + + + + + + + +let EXISTS_SCS_J_TAC= +fun (so:term) (so1:term) (so2:term)-> +EXPAND_TAC "h" +THEN REWRITE_TAC[ARITH_RULE`0 MOD 6=0/\SUC 0=1/\ SUC 1=2/\ SUC 2=3/\ SUC 3=4/\ SUC 4=5/\ SUC 5=6`] +THEN STRIP_TAC +THEN EXISTS_TAC so +THEN ASM_REWRITE_TAC[ARITH_RULE`6 MOD 6=0/\ SUC 0=1/\ 1<=6/\ 6<=6/\ 1+0=1/\ 1 MOD 6=1/\ 1<=1/\ 1<=6/\ 1 MOD 6=1/\ 1+1=2/\ ~(1=0)/\ 2 MOD 6=2/\ SUC 2=3/\ ~(2=0)/\ 1<=2/\ 2<=6/\ 1+2=3/\ 3 MOD 6=3/\ 1<=3/\ 3<=6/\ 1+3=4/\ SUC 3=4/\ ~(3=0)/\ ~(4=0)/\ 1<=4/\ 4<=6/\ SUC 4=5/\ 4 MOD 6=4/\ 1+4=5 +/\ ~(5=0)/\ 1<=5/\ 5<=6/\ SUC 5=6/\ 5 MOD 6=5/\ 1+5=6`] +THEN EXISTS_TAC so1 +THEN EXISTS_TAC so2 +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 6=0/\ 1 MOD 6=1/\ 2 MOD 6=2/\ 3 MOD 6=3/\ 6 MOD 6=0/\ 4 MOD 6=4/\ 5 MOD 6=5`] +;; + + + + + + + + + + + +let TAUSTAR_EQ_TAU_STAR_IS_SCS_CASE_6=prove_by_refinement( +`is_scs_v39 s /\ scs_k_v39 s=6 +/\ vv IN BBs_v39 s +/\ dimindex(:M)=scs_k_v39 s +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 5;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +/\ stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))=s1 +==> taustar_v39 s vv = tau_star s1 a`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC V_E_FF_IS_SCS_CASES_6 +THEN ASM_REWRITE_TAC[IN] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC IS_SCS_STABLE_SYSTEM +THEN ASM_REWRITE_TAC[ARITH_RULE`3<6`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[taustar_v39;tau_star] +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(6<=3)`;IN;mk_unadorned_v39;] +THEN ASM_SIMP_TAC[dsv_J_empty] +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[Dih2k_hypermap.VECMATS_MATVEC_ID] +THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=>B=C`;dsv_v39;d_fun] +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN ASM_REWRITE_TAC[REAL_ARITH`A+B=A+C<=>B=C`;sigma_sy] +THEN MP_TAC IS_EAR_V25_EQ_EAR_SY +THEN ASM_REWRITE_TAC[ARITH_RULE`3<6`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[REAL_EQ_MUL_LCANCEL;REAL_ARITH`~(#0.1 = &0)`] +THEN SUBGOAL_THEN`~((if ear_sy s1 then &1 else -- &1) = &0)` ASSUME_TAC; + +MP_TAC(SET_RULE`(ear_sy s1)\/ ~(ear_sy s1)`) +THEN RESA_TAC +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[J1_SY ] +THEN MATCH_MP_TAC SUM_EQ_GENERAL +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN ABBREV_TAC`h =(\i. if (i MOD 6 = 0) then (6,1) +else (i MOD 6, SUC(i MOD 6)))` +THEN SUBGOAL_THEN`(!x x'. + (x < 6 /\ scs_J_v39 s x (SUC x)) /\ + (x' < 6 /\ scs_J_v39 s x' (SUC x')) /\ + h x' = (h:num->num #num) x + ==> x = x')` ASSUME_TAC; + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE` x< 6 ==> x=0\/ x=1\/ x=2 \/ x=3\/ x=4\/ x=5 `) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE` x'< 6 ==> x'=0\/ x'=1\/ x'=2 \/ x'=3 \/ x'=4\/ x'=5`) +THEN RESA_TAC +THEN EXPAND_TAC"h" +THEN REWRITE_TAC[ARITH_RULE`1 MOD 6=1 /\ 0 MOD 6=0/\ 2 MOD 6=2/\ 3 MOD 6=3 /\ 4 MOD 6=4/\ ~(1=0)/\ ~(2=0)/\ ~(3=0)/\ ~(4=0)/\ SUC 1=2/\ ~(1=6)/\ ~(2=6)/\ ~(3=6)/\ ~(4=6)/\ ~(5=0)/\ 5 MOD 6=5 /\ SUC 5=6`;ARITH_RULE`A=B <=> B=A:num`;PAIR_EQ;DE_MORGAN_THM] +THEN RESA_TAC; + +EXISTS_TAC`h:num->(num#num)` +THEN ASM_REWRITE_TAC[change_type_v2;IN_ELIM_THM;IN_NUMSEG] +THEN STRIP_TAC +THEN REPEAT STRIP_TAC; + +ASM_REWRITE_TAC[EXISTS_UNIQUE_THM] +THEN MP_TAC(ARITH_RULE`1<= i/\ i<=6 ==> i=1\/ i=2 \/ i=3 \/ i=4 \/i=5 \/ i=6`) +THEN RESA_TAC +THENL[ +INJ_H_FUN_TAC `1`; +INJ_H_FUN_TAC `2`; +INJ_H_FUN_TAC `3`; +INJ_H_FUN_TAC `4`; +INJ_H_FUN_TAC `5`; +INJ_H_FUN_TAC `0`]; + +POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`x<6 ==> x=0 \/ x=1 \/ x=2 \/ x=3\/ x=4\/ x=5`) +THEN RESA_TAC +THENL[ +EXISTS_SCS_J_TAC `6` `0` `1`; +EXISTS_SCS_J_TAC `1` `1` `2`; +EXISTS_SCS_J_TAC `2` `2` `3`; +EXISTS_SCS_J_TAC `3` `3` `4`; +EXISTS_SCS_J_TAC `4` `4` `5`; +EXISTS_SCS_J_TAC `5` `5` `6`]; + +POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`x<6 ==> x=0 \/ x=1 \/ x=2 \/ x=3\/ x=4\/ x=5`) +THEN RESA_TAC +THEN EXPAND_TAC"h" +THEN REWRITE_TAC[ARITH_RULE`0 MOD 6=0/\ SUC 0=1`] +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[Dih2k_hypermap.VECMATS_MATVEC_ID] +THEN MRESAL_TAC VECTOR_3_6[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 5`;`(vv:num->real^3) 0`][ARITH_RULE`1<=6/\ 2<=6/\ 3<=6/\ 4<=6/\ 5<=6 /\ 6<=6 /\ 0 MOD 6= 0 /\ 1 MOD 6= 1 /\ 2 MOD 6= 2/\ 3 MOD 6= 3 /\ 4 MOD 6= 4 /\ 5 MOD 6=5 /\ 6 MOD 6=0 /\ ~(2=1)/\ ~(2=0)/\ ~(3=0)/\ ~(4=0)/\ ~(5=0) +/\ SUC 0 MOD 6= 1 /\ SUC 1 MOD 6= 2 /\ SUC 2 MOD 6= 3/\ SUC 3 MOD 6= 4 +/\ SUC 4 MOD 6= 5 /\ SUC 5 MOD 6 = 0 /\ SUC 6 MOD 6 =1 /\ ~(3=1)/\ ~(1=0) +/\ 1<=1 /\1<=2/\ 1<=3/\ 1<=4/\1<=5 +/\ SUC 0=1/\ SUC 1=2/\ SUC 2=3/\ SUC 3=4/\ SUC 4=5/\ SUC 5=6`; SET_RULE`(a:num) IN (:num)`;dist] +THEN REPLICATE_TAC 27 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[IN;BBs_v39;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(6=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`6`[ARITH_RULE`6 MOD 6=0`])]);; + + + + +let JKQEWGV1_CASE_6=prove( +`!s vv. is_scs_v39 s /\ scs_k_v39 s=6 /\ BBs_v39 s vv /\ taustar_v39 s vv < &0 +/\ dimindex(:M)=scs_k_v39 s + ==> + (sol_local (IMAGE (\i. {vv i, vv (SUC i)}) (:num)) + (IMAGE (\i. (vv i,vv (SUC i))) (:num)) < pi)`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC IS_SCS_STABLE_SYSTEM +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;ARITH_RULE`3<6`] +THEN STRIP_TAC +THEN ABBREV_TAC`s1 =stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))` +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 5;(vv:num->real^3) 0]:real^3^M` +THEN ABBREV_TAC`a=matvec (v:real^3^M)` +THEN MP_TAC TAUSTAR_EQ_TAU_STAR_IS_SCS_CASE_6 +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN;REAL_ARITH`(a=b)<=> (b=a:real)`] +THEN STRIP_TAC +THEN MP_TAC IN_IS_SCS_CASE_6 +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL GBYCPXS)[`(scs_k_v39 s)`;`s1:stable_sy`;`a:real^(M,3)finite_product`][k_sy;B_SY1;ARITH_RULE`2<6`;] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[Dih2k_hypermap.VECMATS_MATVEC_ID] +THEN MP_TAC V_E_FF_IS_SCS_CASES_6 +THEN ASM_REWRITE_TAC[IN] +THEN RESA_TAC +THEN ASM_TAC +THEN ASM_REWRITE_TAC[is_scs_v39;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(6<=3)`;IN;mk_unadorned_v39] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`scs_d_v39 s < #0.9==> scs_d_v39 s <= #0.9`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`pi <= + sol_local (IMAGE (\i. {vv i, vv (SUC i)}) (:num)) + (IMAGE (\i. vv i,vv (SUC i)) (:num)) \/ + sol_local (IMAGE (\i. {vv i, vv (SUC i)}) (:num)) + (IMAGE (\i. vv i,vv (SUC i)) (:num))< pi`) +THEN RESA_TAC +THEN REPLICATE_TAC 19 REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC);; + + + + +let IN_IMAGE_VV_EQ_3 = +fun (th:term)-> + MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`x':num`;th;`3`][ARITH_RULE`~(3=0)/\ 0 MOD 3=0/\ SUC 0 MOD 3=1/\ 1 MOD 3=1/\ SUC 1=2 /\ 2 MOD 3=2 /\ 3 MOD 3=0/\ SUC 2=3`] +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(3=0)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x':num` THEN MRESA1_TAC th`SUC x'`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;SET_RULE`A IN {A,B,C} /\ B IN {A,B,C}/\ C IN {A,B,C} `]) +;; + + + + +let V_E_FF_IS_SCS_CASES_3=prove_by_refinement( +` scs_k_v39 s=3/\ is_scs_v39 s /\ BBs_v39 s vv +/\ dimindex(:M)=scs_k_v39 s + ==> + ((IMAGE (\i. {vv i, vv (SUC i)}) (:num) ={{vv 0,vv 1},{vv 1, vv 2},{vv 2, vv 0}}) +/\ (IMAGE (\i. (vv i,vv (SUC i))) (:num)= {(vv 0,vv 1),(vv 1, vv 2),(vv 2, vv 0)}) )`, + (* {{{ proof *) +[ +STRIP_TAC +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39] +THEN RESA_TAC +THEN REWRITE_TAC[ARITH_RULE`3<=3`] +THEN REPEAT STRIP_TAC; + + + + +ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;] +THEN GEN_TAC +THEN EQ_TAC; + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`3`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 3 < 3==> x' MOD 3 =0 \/ x' MOD 3 =1\/ x' MOD 3 =2`) +THEN RESA_TAC +THENL[ +IN_IMAGE_VV_EQ_3 `0`; +IN_IMAGE_VV_EQ_3 `1`; +IN_IMAGE_VV_EQ_3 `2`]; + + +REWRITE_TAC[SET_RULE`X IN {A,B,C}<=> X=A \/ X=B\/ X=C`] +THEN RESA_TAC; + +EXISTS_TAC`0` +THEN REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ARITH_RULE`SUC 0=1`]; + +EXISTS_TAC`1` +THEN REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ARITH_RULE`SUC 1=2`]; + +EXISTS_TAC`2` +THEN REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ARITH_RULE`SUC 2=3`] +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(3=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3:num`[ARITH_RULE`3 MOD 3=0`]) +; + + +ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;] +THEN GEN_TAC +THEN EQ_TAC; + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`3`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 3 < 3==> x' MOD 3 =0 \/ x' MOD 3 =1\/ x' MOD 3 =2`) +THEN RESA_TAC +THENL[ +IN_IMAGE_VV_EQ_3 `0`; +IN_IMAGE_VV_EQ_3 `1`; +IN_IMAGE_VV_EQ_3 `2`]; + + +REWRITE_TAC[SET_RULE`X IN {A,B,C}<=> X=A \/ X=B\/ X=C`] +THEN RESA_TAC +; + +EXISTS_TAC`0` +THEN REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ARITH_RULE`SUC 0=1`]; + +EXISTS_TAC`1` +THEN REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ARITH_RULE`SUC 1=2`]; + +EXISTS_TAC`2` +THEN REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ARITH_RULE`SUC 2=3`] +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(3=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3:num`[ARITH_RULE`3 MOD 3=0`]); +]);; + + + +let IS_SCS_POINT_IN_BBS_IS_NOT_0_3=prove_by_refinement( +`scs_k_v39 s=3/\ is_scs_v39 s +/\ vv IN BBs_v39 s +==> ~(vv 1= vec 0)/\ ~(vv 2= vec 0) /\ ~(vv 0= vec 0)`, + (* {{{ proof *) +[ +REWRITE_TAC[IN] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ;IMAGE;SUBSET;IN_ELIM_THM;is_scs_v39] +THEN STRIP_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ vv 0 = (vv:num->real^3) x)`ASSUME_TAC; +EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; +SUBGOAL_THEN`(?x. x IN (:num) /\ vv 1 = (vv:num->real^3) x)`ASSUME_TAC; +EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; +SUBGOAL_THEN`(?x. x IN (:num) /\ vv 2 = (vv:num->real^3) x)`ASSUME_TAC; +EXISTS_TAC`2` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; +REPLICATE_TAC 5(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL1_TAC th`(vv:num->real^3) 0`[ball_annulus;IN_ELIM_THM;DIFF;ball] +THEN MRESAL1_TAC th`(vv:num->real^3) 1`[ball_annulus;IN_ELIM_THM;DIFF;ball] +THEN MRESAL1_TAC th`(vv:num->real^3) 2`[ball_annulus;IN_ELIM_THM;DIFF;ball;]) +THEN STRIP_TAC; +STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th;DIST_REFL;REAL_ARITH`(&0< &2)`]); +STRIP_TAC; +STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th;DIST_REFL;REAL_ARITH`(&0< &2)`]); +STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th;DIST_REFL;REAL_ARITH`(&0< &2)`]) +]);; + (* }}} *) + + + +let IS_SCS_NOT_COLLINEAR_BBs_CASE_3=prove_by_refinement( +`scs_k_v39 s=3/\ is_scs_v39 s +/\ vv IN BBs_v39 s +==> ~collinear{vec 0, vv 1 ,vv 2}/\ + ~collinear{vec 0, vv 1 ,vv 0}/\ + ~collinear{vec 0, vv 2 ,vv 0}`, + (* {{{ proof *) +[ + + +REWRITE_TAC[Local_lemmas.collinear_fan22;aff;AFFINE_HULL_2;IN_ELIM_THM;VECTOR_ARITH`A % vec 0+B=B`] +THEN STRIP_TAC +THEN MP_TAC IS_SCS_POINT_IN_BBS_IS_NOT_0_3 +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ;is_scs_v39] +THEN POP_ASSUM(fun th-> +STRIP_TAC +THEN ASSUME_TAC th) +THEN REPEAT STRIP_TAC; + +REPLICATE_TAC 14 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`1`;`2`][scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ; +ARITH_RULE`1 MOD 3 =1 /\ 2 MOD 3=2/\ ~(1=2) /\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ 1<3/\ 2<3`;dist;VECTOR_ARITH`A- B%A=(&1-B)%A`;NORM_MUL]) +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`1`;`2`][scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ; +ARITH_RULE`1 MOD 3 =1 /\ 2 MOD 3=2/\ ~(1=2) /\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0`;dist;VECTOR_ARITH`A- B%A=(&1-B)%A`;NORM_MUL]) +THEN REPLICATE_TAC 9(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ vv 1 = (vv:num->real^3) x)`ASSUME_TAC; + + +EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +SUBGOAL_THEN`(?x. x IN (:num) /\ vv 2 = (vv:num->real^3) x)`ASSUME_TAC; + + +EXISTS_TAC`2` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + + +REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(vv:num->real^3) 2`[ball_annulus;IN_ELIM_THM;DIFF;cball;ball;dist;VECTOR_ARITH`vec 0- B= --B`;NORM_NEG;NORM_MUL;REAL_ARITH`~(a b<=a`] +THEN MRESAL1_TAC th`(vv:num->real^3) 1`[ball_annulus;IN_ELIM_THM;DIFF;cball;ball;dist;VECTOR_ARITH`vec 0- B= --B`;NORM_NEG;NORM_MUL;REAL_ARITH`~(a b<=a`]) +THEN MP_TAC(REAL_ARITH`&0<= &1-v\/ &0<= --( &1-v)`) +THEN STRIP_TAC +; + + + MP_TAC(REAL_ARITH`&0<= v\/ &0<= --( v)`) +THEN STRIP_TAC +; + + +MRESA1_TAC Trigonometry2.ABS_REFL `v:real` +THEN MRESA1_TAC Trigonometry2.ABS_REFL `&1- v:real` +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <=scs_a_v39 s 2 1/\ scs_a_v39 s 2 1<= (&1 - v) * norm (vv 1) +/\ &2 <= v * norm (vv 1) ==> &4<= norm ((vv:num->real^3) 1)`) +THEN REPLICATE_TAC 4(POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC +; + + + + +MRESAL1_TAC Trigonometry2.ABS_REFL `-- v:real`[REAL_ABS_NEG] +THEN MRESA1_TAC Trigonometry2.ABS_REFL `&1- v:real` +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= --v * norm (vv 1) +/\ &2 <= norm (vv 1) ==> &4<=(&1- v) *norm ((vv:num->real^3) 1)`) +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 8(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SYM th]) +THEN REPLICATE_TAC 23(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th`1`[ARITH_RULE`SUC 1=2`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 9(REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + + + + + MP_TAC(REAL_ARITH`&0<= v\/ &0<= --( v)`) +THEN STRIP_TAC +; + + + + + + + +MRESAL1_TAC Trigonometry2.ABS_REFL ` v:real`[REAL_ABS_NEG] +THEN MRESAL1_TAC Trigonometry2.ABS_REFL `--(&1- v):real` [REAL_ABS_NEG] +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= norm (vv 1) +/\ &2 <= scs_a_v39 s 2 1/\ scs_a_v39 s 2 1<= --(&1 - v) * norm (vv 1) ==> &4<= v *norm ((vv:num->real^3) 1)`) +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 5(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC +; + + +MRESAL1_TAC Trigonometry2.ABS_REFL ` --v:real`[REAL_ABS_NEG] +THEN MRESAL1_TAC Trigonometry2.ABS_REFL `--(&1- v):real` [REAL_ABS_NEG] +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= norm (vv 1) +/\ &2 <= --v * norm (vv 1) ==> &4<= (&1-v) *norm ((vv:num->real^3) 1)`) +THEN ASM_REWRITE_TAC[REAL_ARITH`~(a<= b) <=> b REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC 11(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; + + + + + +REPLICATE_TAC 14 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`0`;`1`][scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ; +ARITH_RULE`1 MOD 3 =1 /\ 2 MOD 3=2/\ ~(1=2) /\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ 1<3/\ 2<3/\ 0<3 /\ ~(0=1)`;dist;VECTOR_ARITH`A- B%A=(&1-B)%A`;NORM_MUL]) +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`0`;`1`][scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ; +ARITH_RULE`1 MOD 3 =1 /\ 2 MOD 3=2/\ ~(1=2) /\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0`;dist;VECTOR_ARITH`B%A - A= --((&1-B)%A)`;NORM_MUL;NORM_NEG]) +THEN REPLICATE_TAC 9(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ vv 1 = (vv:num->real^3) x)`ASSUME_TAC; + + +EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +SUBGOAL_THEN`(?x. x IN (:num) /\ vv 0 = (vv:num->real^3) x)`ASSUME_TAC; + + +EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + + +REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(vv:num->real^3) 0`[ball_annulus;IN_ELIM_THM;DIFF;cball;ball;dist;VECTOR_ARITH`vec 0- B= --B`;NORM_NEG;NORM_MUL;REAL_ARITH`~(a b<=a`] +THEN MRESAL1_TAC th`(vv:num->real^3) 1`[ball_annulus;IN_ELIM_THM;DIFF;cball;ball;dist;VECTOR_ARITH`vec 0- B= --B`;NORM_NEG;NORM_MUL;REAL_ARITH`~(a b<=a`]) +THEN MP_TAC(REAL_ARITH`&0<= &1-v\/ &0<= --( &1-v)`) +THEN STRIP_TAC +; + + + MP_TAC(REAL_ARITH`&0<= v\/ &0<= --( v)`) +THEN STRIP_TAC +; + + +MRESA1_TAC Trigonometry2.ABS_REFL `v:real` +THEN MRESA1_TAC Trigonometry2.ABS_REFL `&1- v:real` +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <=scs_a_v39 s 1 0/\ scs_a_v39 s 1 0<= (&1 - v) * norm (vv 1) +/\ &2 <= v * norm (vv 1) ==> &4<= norm ((vv:num->real^3) 1)`) +THEN REPLICATE_TAC 4(POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; + +MRESAL1_TAC Trigonometry2.ABS_REFL `-- v:real`[REAL_ABS_NEG] +THEN MRESA1_TAC Trigonometry2.ABS_REFL `&1- v:real` +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= --v * norm (vv 1) +/\ &2 <= norm (vv 1) ==> &4<=(&1- v) *norm ((vv:num->real^3) 1)`) +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 8(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SYM th]) +THEN REPLICATE_TAC 23(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th`0`[ARITH_RULE`SUC 0=1`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 9(REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + + MP_TAC(REAL_ARITH`&0<= v\/ &0<= --( v)`) +THEN STRIP_TAC; + + +MRESAL1_TAC Trigonometry2.ABS_REFL ` v:real`[REAL_ABS_NEG] +THEN MRESAL1_TAC Trigonometry2.ABS_REFL `--(&1- v):real` [REAL_ABS_NEG] +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= norm (vv 1) +/\ &2 <= scs_a_v39 s 1 0/\ scs_a_v39 s 1 0<= --(&1 - v) * norm (vv 1) ==> &4<= v *norm ((vv:num->real^3) 1)`) +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 5(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC +; + + +MRESAL1_TAC Trigonometry2.ABS_REFL ` --v:real`[REAL_ABS_NEG] +THEN MRESAL1_TAC Trigonometry2.ABS_REFL `--(&1- v):real` [REAL_ABS_NEG] +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= norm (vv 1) +/\ &2 <= --v * norm (vv 1) ==> &4<= (&1-v) *norm ((vv:num->real^3) 1)`) +THEN ASM_REWRITE_TAC[REAL_ARITH`~(a<= b) <=> b REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC 11(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; + + + +REPLICATE_TAC 14 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`0`;`2`][scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ; +ARITH_RULE`1 MOD 3 =1 /\ 2 MOD 3=2/\ ~(1=2) /\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ 1<3/\ 2<3/\ 0<3 /\ ~(0=1)/\ ~(0=2)`;dist;VECTOR_ARITH`A- B%A=(&1-B)%A`;NORM_MUL]) +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`0`;`2`][scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ; +ARITH_RULE`1 MOD 3 =1 /\ 2 MOD 3=2/\ ~(1=2) /\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0`;dist;VECTOR_ARITH`B%A - A= --((&1-B)%A)`;NORM_MUL;NORM_NEG]) +THEN REPLICATE_TAC 9(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ vv 2 = (vv:num->real^3) x)`ASSUME_TAC; + + +EXISTS_TAC`2` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +SUBGOAL_THEN`(?x. x IN (:num) /\ vv 0 = (vv:num->real^3) x)`ASSUME_TAC; + + +EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + + +REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(vv:num->real^3) 0`[ball_annulus;IN_ELIM_THM;DIFF;cball;ball;dist;VECTOR_ARITH`vec 0- B= --B`;NORM_NEG;NORM_MUL;REAL_ARITH`~(a b<=a`] +THEN MRESAL1_TAC th`(vv:num->real^3) 2`[ball_annulus;IN_ELIM_THM;DIFF;cball;ball;dist;VECTOR_ARITH`vec 0- B= --B`;NORM_NEG;NORM_MUL;REAL_ARITH`~(a b<=a`]) +THEN MP_TAC(REAL_ARITH`&0<= &1-v\/ &0<= --( &1-v)`) +THEN STRIP_TAC +; + + + MP_TAC(REAL_ARITH`&0<= v\/ &0<= --( v)`) +THEN STRIP_TAC +; + + +MRESA1_TAC Trigonometry2.ABS_REFL `v:real` +THEN MRESA1_TAC Trigonometry2.ABS_REFL `&1- v:real` +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <=scs_a_v39 s 2 0/\ scs_a_v39 s 2 0<= (&1 - v) * norm (vv 2) +/\ &2 <= v * norm (vv 2) ==> &4<= norm ((vv:num->real^3) 2)`) +THEN REPLICATE_TAC 4(POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC +; + + + + +MRESAL1_TAC Trigonometry2.ABS_REFL `-- v:real`[REAL_ABS_NEG] +THEN MRESA1_TAC Trigonometry2.ABS_REFL `&1- v:real` +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= --v * norm (vv 2) +/\ &2 <= norm (vv 2) ==> &4<=(&1- v) *norm ((vv:num->real^3) 2)`) +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 8(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SYM th]) +THEN REPLICATE_TAC 23(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th`2`[ARITH_RULE`SUC 2=3`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 9(REMOVE_ASSUM_TAC) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s 2`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3:num`[ARITH_RULE`3 MOD 3=0`]) +THEN REAL_ARITH_TAC; + + + + + MP_TAC(REAL_ARITH`&0<= v\/ &0<= --( v)`) +THEN STRIP_TAC +; + + + + + + + +MRESAL1_TAC Trigonometry2.ABS_REFL ` v:real`[REAL_ABS_NEG] +THEN MRESAL1_TAC Trigonometry2.ABS_REFL `--(&1- v):real` [REAL_ABS_NEG] +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= norm (vv 2) +/\ &2 <= scs_a_v39 s 2 0/\ scs_a_v39 s 2 0<= --(&1 - v) * norm (vv 2) ==> &4<= v *norm ((vv:num->real^3) 2)`) +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 5(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC +; + + +MRESAL1_TAC Trigonometry2.ABS_REFL ` --v:real`[REAL_ABS_NEG] +THEN MRESAL1_TAC Trigonometry2.ABS_REFL `--(&1- v):real` [REAL_ABS_NEG] +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= norm (vv 2) +/\ &2 <= --v * norm (vv 2) ==> &4<= (&1-v) *norm ((vv:num->real^3) 2)`) +THEN ASM_REWRITE_TAC[REAL_ARITH`~(a<= b) <=> b REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC 11(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; +]);; + (* }}} *) + + + + +let IS_SCS_POINT_IN_BBS_IS_NOT_0_LE_3=prove_by_refinement( +`3 ~(vv i= vec 0)`, +[REWRITE_TAC[IN] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(scs_k_v39 s<=3)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;CS_ADJ;IMAGE;SUBSET;IN_ELIM_THM;is_scs_v39] +THEN STRIP_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ vv i= (vv:num->real^3) x)`ASSUME_TAC; +EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; +REPLICATE_TAC 4(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL1_TAC th`(vv:num->real^3) i`[ball_annulus;IN_ELIM_THM;DIFF;ball]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[DIST_REFL;REAL_ARITH`(&0< &2)`] +]);; + (* }}} *) + + + + +let IS_SCS_NOT_COLLINEAR_BBs_CASE_LE_3=prove_by_refinement( +`3< scs_k_v39 s/\ is_scs_v39 s +/\ vv IN BBs_v39 s +/\ ~(i MOD (scs_k_v39 s)=j MOD (scs_k_v39 s)) +/\ dist(vv (i MOD (scs_k_v39 s)) ,vv (j MOD (scs_k_v39 s))) <= cstab +==> ~collinear{vec 0, vv (i MOD (scs_k_v39 s)) ,vv (j MOD (scs_k_v39 s))}`, +[ +REWRITE_TAC[Local_lemmas.collinear_fan22;aff;AFFINE_HULL_2;IN_ELIM_THM;VECTOR_ARITH`A % vec 0+B=B`;cstab] +THEN STRIP_TAC +THEN MRESA_TAC( GEN_ALL IS_SCS_POINT_IN_BBS_IS_NOT_0_LE_3)[`s:scs_v39`;`vv:num->real^3`;`i MOD scs_k_v39 s`] +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ;is_scs_v39] +THEN POP_ASSUM(fun th-> +STRIP_TAC +THEN ASSUME_TAC th) +THEN REPEAT STRIP_TAC; + +MP_TAC(ARITH_RULE`3 < scs_k_v39 s==> ~(scs_k_v39 s <= 3)`) +THEN RESA_TAC; + + +ABBREV_TAC`k=scs_k_v39 s` +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN REPLICATE_TAC (35-14) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i MOD k`;`j MOD k`][scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ; +ARITH_RULE`1 MOD 3 =1 /\ 2 MOD 3=2/\ ~(1=2) /\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ 1<3/\ 2<3`;dist;VECTOR_ARITH`A- B%A=(&1-B)%A`;NORM_MUL]) +THEN REPLICATE_TAC (35-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (34-22) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC th[`i MOD k`;`j MOD k`][scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ; +ARITH_RULE`1 MOD 3 =1 /\ 2 MOD 3=2/\ ~(1=2) /\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0`;dist;VECTOR_ARITH`A- B%A=(&1-B)%A`;NORM_MUL]) +THEN REPLICATE_TAC (35-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ vv (i MOD k) = (vv:num->real^3) x)`ASSUME_TAC; + +EXISTS_TAC`i MOD k` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +SUBGOAL_THEN`(?x. x IN (:num) /\ vv (j MOD k) = (vv:num->real^3) x)`ASSUME_TAC; + +EXISTS_TAC`j MOD k` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(vv:num->real^3) (i MOD k)`[ball_annulus;IN_ELIM_THM;DIFF;cball;ball;dist;VECTOR_ARITH`vec 0- B= --B`;NORM_NEG;NORM_MUL;REAL_ARITH`~(a b<=a`] +THEN MRESAL1_TAC th`(vv:num->real^3) (j MOD k)`[ball_annulus;IN_ELIM_THM;DIFF;cball;ball;dist;VECTOR_ARITH`vec 0- B= --B`;NORM_NEG;NORM_MUL;REAL_ARITH`~(a b<=a`]) +THEN MP_TAC(REAL_ARITH`&0<= &1-v\/ &0<= --( &1-v)`) +THEN STRIP_TAC; + + MP_TAC(REAL_ARITH`&0<= v\/ &0<= --( v)`) +THEN STRIP_TAC; + +MRESA1_TAC Trigonometry2.ABS_REFL `v:real` +THEN MRESA1_TAC Trigonometry2.ABS_REFL `&1- v:real` +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <=scs_a_v39 s (i MOD k) (j MOD k)/\ scs_a_v39 s (i MOD k) (j MOD k)<= (&1 - v) * norm (vv (i MOD k)) +/\ &2 <= v * norm (vv (i MOD k)) ==> &4<= norm ((vv:num->real^3) (i MOD k))`) +THEN REPLICATE_TAC 6(POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; + + +MRESAL1_TAC Trigonometry2.ABS_REFL `-- v:real`[REAL_ABS_NEG] +THEN MRESA1_TAC Trigonometry2.ABS_REFL `&1- v:real` +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= --v * norm (vv (i MOD k)) +/\ &2 <= norm (vv (i MOD k)) ==> &4<=(&1- v) *norm ((vv:num->real^3) (i MOD k) )`) +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (45-35)(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[]) +THEN REAL_ARITH_TAC; + +MP_TAC(REAL_ARITH`&0<= v\/ &0<= --( v)`) +THEN STRIP_TAC; + + +MRESAL1_TAC Trigonometry2.ABS_REFL ` v:real`[REAL_ABS_NEG] +THEN MRESAL1_TAC Trigonometry2.ABS_REFL `--(&1- v):real` [REAL_ABS_NEG] +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= norm (vv (i MOD k)) +/\ &2 <= scs_a_v39 s (i MOD k) (j MOD k)/\ scs_a_v39 s (i MOD k) (j MOD k)<= --(&1 - v) * norm (vv (i MOD k)) ==> &4<= v *norm ((vv:num->real^3) (i MOD k))`) +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 3(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; + +MRESAL1_TAC Trigonometry2.ABS_REFL ` --v:real`[REAL_ABS_NEG] +THEN MRESAL1_TAC Trigonometry2.ABS_REFL `--(&1- v):real` [REAL_ABS_NEG] +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= norm (vv (i MOD k)) +/\ &2 <= --v * norm (vv (i MOD k)) ==> &4<= (&1-v) *norm ((vv:num->real^3) (i MOD k))`) +THEN ASM_REWRITE_TAC[REAL_ARITH`~(a<= b) <=> b REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (44-32)(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; +]);; + (* }}} *) + + + + + + + + + + + + +let JKQEWGV1=prove( +`!s vv. is_scs_v39 s /\ 3< scs_k_v39 s /\ BBs_v39 s vv /\ taustar_v39 s vv < &0 + ==> + (sol_local (IMAGE (\i. {vv i, vv (SUC i)}) (:num)) + (IMAGE (\i. (vv i,vv (SUC i))) (:num)) < pi)`, +REPEAT STRIP_TAC +THEN ASM_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[is_scs_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN MP_TAC(ARITH_RULE`3< scs_k_v39 s /\ scs_k_v39 s<=6 ==> scs_k_v39 s = 4\/ scs_k_v39 s = 5 \/ scs_k_v39 s =6`) +THEN RESA_TAC +THENL[ +MP_TAC(INST_TYPE [`:2+2`,`:M`]JKQEWGV1_CASE_4) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_4] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`vv:num->real^3`]); + +MP_TAC(INST_TYPE [`:2+3`,`:M`]JKQEWGV1_CASE_5) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_5] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`vv:num->real^3`]); + +MP_TAC(INST_TYPE [`:3+3`,`:M`]JKQEWGV1_CASE_6) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_6] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`vv:num->real^3`])]);; + + + + +let JKQEWGV2_CASE_4=prove(`!s vv. is_scs_v39 s /\ scs_k_v39 s=4 /\ BBs_v39 s vv /\ taustar_v39 s vv < &0 +/\ dimindex(:M)=scs_k_v39 s +==> + ( + let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + ~circular V E)`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC IS_SCS_STABLE_SYSTEM +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;ARITH_RULE`3<4`] +THEN STRIP_TAC +THEN ABBREV_TAC`s1 =stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))` +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 0]:real^3^M` +THEN ABBREV_TAC`a=matvec (v:real^3^M)` +THEN MP_TAC TAUSTAR_EQ_TAU_STAR_IS_SCS_CASE_4 +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN;REAL_ARITH`(a=b)<=> (b=a:real)`] +THEN STRIP_TAC +THEN MP_TAC IN_IS_SCS_CASE_4 +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL GBYCPXS)[`(scs_k_v39 s)`;`s1:stable_sy`;`a:real^(M,3)finite_product`][k_sy;B_SY1;ARITH_RULE`2<4`;] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[Dih2k_hypermap.VECMATS_MATVEC_ID] +THEN MP_TAC V_E_FF_IS_SCS_CASES_4 +THEN ASM_REWRITE_TAC[IN] +THEN RESA_TAC +THEN ASM_TAC +THEN ASM_REWRITE_TAC[is_scs_v39;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN POP_ASSUM MATCH_MP_TAC +THEN MP_TAC(REAL_ARITH`taustar_v39 s vv < &0 ==> taustar_v39 s vv <= &0`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`scs_d_v39 s < #0.9==> scs_d_v39 s <= #0.9`) +THEN RESA_TAC);; + + + +let JKQEWGV2_CASE_5=prove(`!s vv. is_scs_v39 s /\ scs_k_v39 s=5 /\ BBs_v39 s vv /\ taustar_v39 s vv < &0 +/\ dimindex(:M)=scs_k_v39 s +==> + ( + let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + ~circular V E)`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC IS_SCS_STABLE_SYSTEM +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;ARITH_RULE`3<5`] +THEN STRIP_TAC +THEN ABBREV_TAC`s1 =stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))` +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 0]:real^3^M` +THEN ABBREV_TAC`a=matvec (v:real^3^M)` +THEN MP_TAC TAUSTAR_EQ_TAU_STAR_IS_SCS_CASE_5 +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN;REAL_ARITH`(a=b)<=> (b=a:real)`] +THEN STRIP_TAC +THEN MP_TAC IN_IS_SCS_CASE_5 +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL GBYCPXS)[`(scs_k_v39 s)`;`s1:stable_sy`;`a:real^(M,3)finite_product`][k_sy;B_SY1;ARITH_RULE`2<5`;] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[Dih2k_hypermap.VECMATS_MATVEC_ID] +THEN MP_TAC V_E_FF_IS_SCS_CASES_5 +THEN ASM_REWRITE_TAC[IN] +THEN RESA_TAC +THEN ASM_TAC +THEN ASM_REWRITE_TAC[is_scs_v39;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN POP_ASSUM MATCH_MP_TAC +THEN MP_TAC(REAL_ARITH`taustar_v39 s vv < &0 ==> taustar_v39 s vv <= &0`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`scs_d_v39 s < #0.9==> scs_d_v39 s <= #0.9`) +THEN RESA_TAC);; + + + + + +let JKQEWGV2_CASE_6=prove(`!s vv. is_scs_v39 s /\ scs_k_v39 s=6 /\ BBs_v39 s vv /\ taustar_v39 s vv < &0 +/\ dimindex(:M)=scs_k_v39 s +==> + ( + let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + ~circular V E)`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC IS_SCS_STABLE_SYSTEM +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;ARITH_RULE`3<6`] +THEN STRIP_TAC +THEN ABBREV_TAC`s1 =stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))` +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 5;(vv:num->real^3) 0]:real^3^M` +THEN ABBREV_TAC`a=matvec (v:real^3^M)` +THEN MP_TAC TAUSTAR_EQ_TAU_STAR_IS_SCS_CASE_6 +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN;REAL_ARITH`(a=b)<=> (b=a:real)`] +THEN STRIP_TAC +THEN MP_TAC IN_IS_SCS_CASE_6 +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL GBYCPXS)[`(scs_k_v39 s)`;`s1:stable_sy`;`a:real^(M,3)finite_product`][k_sy;B_SY1;ARITH_RULE`2<6`;] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[Dih2k_hypermap.VECMATS_MATVEC_ID] +THEN MP_TAC V_E_FF_IS_SCS_CASES_6 +THEN ASM_REWRITE_TAC[IN] +THEN RESA_TAC +THEN ASM_TAC +THEN ASM_REWRITE_TAC[is_scs_v39;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(6<=3)`;IN;mk_unadorned_v39] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN POP_ASSUM MATCH_MP_TAC +THEN MP_TAC(REAL_ARITH`taustar_v39 s vv < &0 ==> taustar_v39 s vv <= &0`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`scs_d_v39 s < #0.9==> scs_d_v39 s <= #0.9`) +THEN RESA_TAC);; + + + + +let JKQEWGV2=prove( +`!s vv. is_scs_v39 s /\ 3< scs_k_v39 s /\ BBs_v39 s vv /\ taustar_v39 s vv < &0 + ==> + ( + let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + ~circular V E)`, +REPEAT STRIP_TAC +THEN ASM_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[is_scs_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN MP_TAC(ARITH_RULE`3< scs_k_v39 s /\ scs_k_v39 s<=6 ==> scs_k_v39 s = 4\/ scs_k_v39 s = 5 \/ scs_k_v39 s =6`) +THEN RESA_TAC +THENL[ +MP_TAC(INST_TYPE [`:2+2`,`:M`]JKQEWGV2_CASE_4) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_4] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`vv:num->real^3`]); + +MP_TAC(INST_TYPE [`:2+3`,`:M`]JKQEWGV2_CASE_5) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_5] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`vv:num->real^3`]); + +MP_TAC(INST_TYPE [`:3+3`,`:M`]JKQEWGV2_CASE_6) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_6] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`vv:num->real^3`])]);; + + + + + +let JKQEWGV3 = prove_by_refinement( +`!s vv v w. + (let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + let FF = IMAGE (\i. (vv i,vv (SUC i))) (:num) in + (is_scs_v39 s /\ BBs_v39 s vv /\ 3< scs_k_v39 s /\ taustar_v39 s vv < &0 /\ lunar (v,w) V E ==> + (interior_angle1 (vec 0) FF v < pi / &2 )))`, + (* {{{ proof *) +[ +REWRITE_TAC[LET_DEF;LET_END_DEF;] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th +THEN REWRITE_TAC[lunar] +THEN ASSUME_TAC th) +THEN ABBREV_TAC`V= IMAGE (vv:num->real^3) (:num)` +THEN ABBREV_TAC`E= IMAGE (\i. {vv i,(vv:num->real^3) (SUC i)}) (:num)` +THEN ABBREV_TAC`FF= IMAGE (\i. (vv i,(vv:num->real^3) (SUC i))) (:num)` +THEN MRESA_TAC (GEN_ALL HKIRPEP)[`E:(real^3->bool)->bool`;`w:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`V:real^3->bool`] +THEN ASM_TAC +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th +THEN MP_TAC(ARITH_RULE`3< scs_k_v39 s==> ~( scs_k_v39 s<= 3)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN MP_TAC(SET_RULE`{v, w:real^3} SUBSET V ==> v IN V /\ w IN V`) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM_IVS) +[`IMAGE (\i. {vv i, (vv:num->real^3) (SUC i)}) (:num)`;`IMAGE ((vv:num->real^3)) (:num)`;`IMAGE (\i. ((vv:num->real^3) i,vv (SUC i))) (:num)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`) +THEN MRESA_TAC JKQEWGV1[`s:scs_v39`;`vv:num->real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[sol_local] +THEN REPLICATE_TAC 8 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC 3 STRIP_TAC +THEN MP_TAC Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM +THEN REWRITE_TAC[th] +THEN ASSUME_TAC th +THEN MP_TAC th +THEN REWRITE_TAC[convex_local_fan] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN MP_TAC Wrgcvdr_cizmrrh.LOCAL_FAN_FINITE_FF +THEN RESA_TAC +THEN MP_TAC Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2 +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3` +THEN MRESA1_TAC th`w:real^3`) +THEN MP_TAC(SET_RULE`v,rho_node1 FF v IN FF/\ +w,rho_node1 FF w IN FF ==> +{(v,rho_node1 FF v ),(w,rho_node1 FF w)} SUBSET FF`) +THEN RESA_TAC +THEN MRESA_TAC SUM_DIFF[`(\e:real^3#real^3. azim_in_fan e E - pi)`;`FF:real^3#real^3->bool`;`{(v,rho_node1 FF v),(w,rho_node1 FF w)}`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A=B-C<=> B=A+C`] +THEN RESA_TAC +THEN MRESAL_TAC Geomdetail.SUM_DIS2[`(v,rho_node1 FF v)`;`(w,rho_node1 FF w)`;`(\e:real^3#real^3. azim_in_fan e E - pi)`][PAIR_EQ] +THEN SUBGOAL_THEN`sum (FF DIFF {(v,rho_node1 FF v), (w,rho_node1 FF w)}) + (\e. azim_in_fan e E - pi)= &0` ASSUME_TAC; + +MATCH_MP_TAC SUM_EQ_0 +THEN REWRITE_TAC[DIFF;IN_ELIM_THM;SET_RULE`~(a IN {b,c}) <=> ~(a=b) /\ ~(a=c)`] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC 8 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC 8 STRIP_TAC +THEN MRESA1_TAC th`x:real^3#real^3`) +THEN POP_ASSUM(fun th-> REPLICATE_TAC 3 (POP_ASSUM MP_TAC) +THEN ONCE_REWRITE_TAC[th] +THEN REWRITE_TAC[PAIR_EQ]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V) +[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`FST (x:real^3#real^3)`;`rho_node1 FF (FST (x:real^3#real^3))`;`V:real^3->bool`] +THEN REPLICATE_TAC 13 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC 13 STRIP_TAC +THEN MRESA1_TAC th`FST (x:real^3#real^3)`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`FST (x:real^3#real^3) IN V DIFF {v,w}`ASSUME_TAC; + +ASM_REWRITE_TAC[DIFF;IN_ELIM_THM;SET_RULE`~(a IN {b,c}) <=> ~(a=b) /\ ~(a=c)`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + +REPLICATE_TAC (34-7) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC (34-7) STRIP_TAC +THEN MP_TAC th +THEN RESA_TAC) +THEN REPLICATE_TAC (47-34) (REMOVE_ASSUM_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`FST (x:real^3#real^3)`) +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 10 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC 10 STRIP_TAC +THEN MRESA1_TAC th`v:real^3` +THEN MRESA1_TAC th`w:real^3`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPLICATE_TAC (30-7) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC (30-7) STRIP_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (12) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC (12) STRIP_TAC +THEN REWRITE_TAC[th]) +THEN STRIP_TAC +THEN REPLICATE_TAC (10) (REMOVE_ASSUM_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC]);; + + + + + + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/JLXFDMJ.hl b/text_formalization/local/JLXFDMJ.hl new file mode 100644 index 0000000..3a174e7 --- /dev/null +++ b/text_formalization/local/JLXFDMJ.hl @@ -0,0 +1,825 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Jlxfdmj = struct + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +open Yxionxl2;; +open Eyypqdw;; +open Ocbicby;; +open Imjxphr;; + +open Nuxcoea;; +open Fektyiy;; + + + +let SCS_M_EQ_0= prove_by_refinement( +` CARD (scs_M s) = 0 /\ is_scs_v39 s +==> (!i. scs_b_v39 s i (SUC i)<= &2 *h0/\ scs_a_v39 s i (SUC i)= &2 )`, +[ +STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th +THEN ASSUME_TAC th) +THEN REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF;] +THEN RESA_TAC +THEN DICH_TAC (21) +THEN REWRITE_TAC[scs_M] +THEN REWRITE_TAC[ARITH_RULE`a<=1 <=> a= 0\/ a=1`] +THEN SUBGOAL_THEN`FINITE + {i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}` ASSUME_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..6` +THEN ASM_REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN GEN_TAC +THEN DICH_TAC(20-3) +THEN ARITH_TAC; + +ABBREV_TAC`k=scs_k_v39 s` +THEN RESA_TAC; + +MRESA_TAC CARD_EQ_0[`{i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`A={}<=> !x. ~(x IN A)`;IN_ELIM_THM] +THEN STRIP_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)/\ 1 b<=a`;DIVISION] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`i MOD k:num`;`SUC(i MOD k) :num`;`s:scs_v39`;`i:num`;`SUC(i MOD k) MOD k:num`][MOD_REFL;ARITH_RULE`~(6=0)`;Hypermap.lemma_suc_mod] +THEN MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`i :num`;`SUC i MOD k :num`;`s:scs_v39`;`i:num`;`SUC i:num`][MOD_REFL;ARITH_RULE`~(6=0)`;Hypermap.lemma_suc_mod] +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`i MOD k:num`;`SUC(i MOD k) :num`;`s:scs_v39`;`i:num`;`SUC(i MOD k) MOD k:num`][MOD_REFL;ARITH_RULE`~(6=0)`;Hypermap.lemma_suc_mod] +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`i :num`;`SUC i MOD k :num`;`s:scs_v39`;`i:num`;`SUC i:num`][MOD_REFL;ARITH_RULE`~(6=0)`;Hypermap.lemma_suc_mod] +THEN THAYTHES_TAC (29-15)[`i MOD k`;`SUC i MOD k`][DIVISION;Hypermap.lemma_suc_mod;ARITH_RULE`~(6=0)/\ 1<6`;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN POP_ASSUM MP_TAC +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`i MOD k:num`;`SUC i MOD k :num`;`s:scs_v39`;`i:num`;`SUC i:num`][MOD_REFL;ARITH_RULE`~(6=0)`;Hypermap.lemma_suc_mod] +THEN REAL_ARITH_TAC]);; + + +let FINITE_SCS_M=prove(`is_scs_v39 s ==> FINITE (scs_M s)`, +REWRITE_TAC[LET_DEF;LET_END_DEF;is_scs_v39;scs_M] +THEN STRIP_TAC +THEN MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..(scs_k_v39 s)` +THEN ASM_REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN DICH_TAC(19-1) +THEN ARITH_TAC);; + +let SCS_A_2=prove(`is_scs_v39 s +==> !i. &2<= scs_a_v39 s i (i+1)`, +REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF;GSYM ADD1] +THEN RESA_TAC +THEN STRIP_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`i MOD k:num`;`SUC i MOD k :num`;`s:scs_v39`;`i:num`;`SUC i:num`][MOD_REFL;ARITH_RULE`3<=k==> ~(k=0)/\ 1 ~(k=0)/\ 1 ~(k=0)/\ 1 (!i. ~(i MOD scs_k_v39 s=x )==> scs_b_v39 s i (SUC i)<= &2 *h0/\ scs_a_v39 s i (SUC i)= &2 )`, +[ +STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th +THEN ASSUME_TAC th) +THEN REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF;] +THEN RESA_TAC +THEN DICH_TAC (21) +THEN REWRITE_TAC[scs_M] +THEN REWRITE_TAC[ARITH_RULE`a<=1 <=> a= 0\/ a=1`] +THEN SUBGOAL_THEN`FINITE + {i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}` ASSUME_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..6` +THEN ASM_REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN GEN_TAC +THEN DICH_TAC(20-3) +THEN ARITH_TAC; + +ABBREV_TAC`k=scs_k_v39 s` +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING] +THEN STRIP_TAC +THEN GEN_TAC +THEN STRIP_TAC +THEN THAYTHEL_ASM_TAC 1[`x:num`][] +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)/\ 1 b<=a`;DIVISION] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`i MOD k:num`;`SUC(i MOD k) :num`;`s:scs_v39`;`i:num`;`SUC(i MOD k) MOD k:num`][MOD_REFL;ARITH_RULE`~(6=0)`;Hypermap.lemma_suc_mod] +THEN MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`i :num`;`SUC i MOD k :num`;`s:scs_v39`;`i:num`;`SUC i:num`][MOD_REFL;ARITH_RULE`~(6=0)`;Hypermap.lemma_suc_mod] +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`i MOD k:num`;`SUC(i MOD k) :num`;`s:scs_v39`;`i:num`;`SUC(i MOD k) MOD k:num`][MOD_REFL;ARITH_RULE`~(6=0)`;Hypermap.lemma_suc_mod] +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`i :num`;`SUC i MOD k :num`;`s:scs_v39`;`i:num`;`SUC i:num`][MOD_REFL;ARITH_RULE`~(6=0)`;Hypermap.lemma_suc_mod] +THEN THAYTHES_TAC (31-15)[`i MOD k`;`SUC i MOD k`][DIVISION;Hypermap.lemma_suc_mod;ARITH_RULE`~(6=0)/\ 1<6`;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN POP_ASSUM MP_TAC +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`i MOD k:num`;`SUC i MOD k :num`;`s:scs_v39`;`i:num`;`SUC i:num`][MOD_REFL;ARITH_RULE`~(6=0)`;Hypermap.lemma_suc_mod] +THEN REAL_ARITH_TAC]);; + +let SCS_M_LE_K=prove(` scs_M s={x} +==> x(!s (v:num->real^3) i. + 3< scs_k_v39 s/\ + is_scs_v39 s /\ v IN MMs_v39 s /\ scs_generic v /\ scs_basic_v39 s /\ + ( dist(v i,v (i+1)) = &2) /\ + CARD (scs_M s) <= 1 /\ + (!i j. scs_diag (scs_k_v39 s) i j ==> (scs_a_v39 s i j <= cstab /\ cstab < dist(v i, v j) /\ &4 * h0 < scs_b_v39 s i j)) /\ +(!i. scs_a_v39 s i (i+1)< scs_b_v39 s i (i+1)) /\ + scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1) <= &2 * h0 ==> + (!j. ~(j MOD scs_k_v39 s IN scs_M s)==> dist(v j , v(j+1)) = &2))`;; + + +let JLXFDMJ = prove_by_refinement( + JLXFDMJ_concl, + +[ + +STRIP_TAC +THEN REPEAT GEN_TAC +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN ABBREV_TAC`V= IMAGE (v:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((v:num->real^3) i, v (SUC i))) (:num)` +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC SCS_A_2 +THEN RESA_TAC +THEN SUBGOAL_THEN`!i. &2< scs_b_v39 s i (i + 1)`ASSUME_TAC; + + +GEN_TAC +THEN THAYTHE_TAC 0[`i'`] +THEN THAYTHE_TAC 3[`i'`] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN REAL_ARITH_TAC; + +MP_TAC(ARITH_RULE`CARD (scs_M s)<=1==> CARD (scs_M s) =0 \/ CARD (scs_M s) =1`) +THEN RESA_TAC; + + + +MP_TAC FINITE_SCS_M +THEN RESA_TAC +THEN MRESA_TAC CARD_EQ_0[`scs_M s`] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i<=j \/ j<=i:num`) +THEN RESA_TAC +; + + +POP_ASSUM MP_TAC +THEN SPEC_TAC (`j:num`,`j:num`) +THEN INDUCT_TAC +; + +REWRITE_TAC[ARITH_RULE`i<= 0<=> i=0`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] +THEN REPEAT RESA_TAC) +; + + +STRIP_TAC +THEN MP_TAC(ARITH_RULE`i<= SUC j==> SUC j=i \/ i<=j`) +THEN RESA_TAC +THEN DICH_TAC 2 +THEN RESA_TAC +THEN MP_TAC SCS_M_EQ_0 +THEN RESA_TAC +THEN THAYTHEL_ASM_TAC(24-17)[`j+1`][ARITH_RULE`(i+1)+1=i+2`] +THEN THAYTHEL_ASM_TAC(25-13)[`j+2`][ARITH_RULE`(i+2)+1=i+3`] +THEN MP_TAC(ARITH_RULE`3 (j+k-1)+1= 1*k+j`) +THEN RESA_TAC +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`j+k-1`;`1*k+j`;`s:scs_v39`;`j+k-1`;`(1*k+j) MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1 ~(k=0)/\ 1 ~(k=0)/\ 1 ~(k=0)/\ 1 j=i:num`) +THEN RESA_TAC; + + +REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`i-j= SUC t/\ j<=i ==> i- SUC j=t/\ SUC j<= i:num`) +THEN RESA_TAC +THEN THAYTHEL_TAC 4 [`SUC j`][ARITH_RULE`SUC i= i+1/\ (i+1)+1=i+2`] +THEN MP_TAC SCS_M_EQ_0 +THEN RESA_TAC +THEN THAYTHEL_ASM_TAC(26-17)[`j+1`][ARITH_RULE`(i+1)+1=i+2`] +THEN THAYTHEL_ASM_TAC(27-13)[`j+2`][ARITH_RULE`(i+2)+1=i+3`] +THEN MP_TAC(ARITH_RULE`3 (j+k-1)+1= 1*k+j`) +THEN RESA_TAC +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`j+k-1`;`1*k+j`;`s:scs_v39`;`j+k-1`;`(1*k+j) MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1 ~(k=0)/\ 1 ~(k=0)/\ 1 ~(k=0)/\ 1 ~(k=0)`] +THEN MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`x`;`SUC x`;`s:scs_v39`;`i`;`SUC i`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1 ~(k=0)/\ 1 b<=a`;REAL_ARITH`a<=a`] +; + + + + + +MP_TAC(ARITH_RULE`~(i MOD k= x)==> i MOD k< x\/ x< i MOD k`) +THEN RESA_TAC +; + + + + +SUBGOAL_THEN `!t. t< i MOD k + k - x ==> dist ((v:num->real^3) (i MOD k+k - t),v ( (i MOD k+k -t) + 1)) = &2` +ASSUME_TAC +; + + + +INDUCT_TAC +; + + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE`a-0=a/\ (1 * k + i MOD k) + 1= 1*k+SUC(i MOD k)/\ i MOD k +k=1*k+ i MOD k`] +THEN DICH_TAC(24-7) +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`1*k+i MOD k`;`v:num->real^3`;`(1*k+i MOD k) MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)`; MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`1*k+SUC(i MOD k)`;`v:num->real^3`;`(1*k+SUC(i MOD k)) MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1real^3`;`SUC i`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1real^3`;` i`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1 t< i MOD k+k-x`) +THEN RESA_TAC +THEN DICH_TAC 3 +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC`j1= i MOD k + k - (t+1)` +THEN MRESA_TAC Ssrnat.subn_sub[`t`;`k`;`1`] +THEN MP_TAC(ARITH_RULE`SUC t < i MOD k + k - x /\ x i MOD k+ k-t=(i MOD k +k-t-1)+1 `) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[ADD1;ARITH_RULE`(i+1)+1=i+2`] +THEN STRIP_TAC +THEN THAYTHEL_ASM_TAC(30-17)[`j1+1`][ARITH_RULE`(i+1)+1=i+2`] +THEN THAYTHEL_ASM_TAC(31-13)[`j1+2`][ARITH_RULE`(i+2)+1=i+3`] +THEN MP_TAC(ARITH_RULE`3 (j1+k-1)+1= 1*k+j1`) +THEN RESA_TAC +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`j1+k-1`;`1*k+j1`;`s:scs_v39`;`j1+k-1`;`(1*k+j1) MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1 ~(k=0)/\ 1 ~(k=0)/\ 1 ~(k=0)/\ 1 ~(i MOD k +k-(t+1) =x) /\ ~((i MOD k +k-(t+1)) +1 =x)`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[MOD_LT;ARITH_RULE`3 ~(k=0)`]; + + +MP_TAC(ARITH_RULE`SUC t < i MOD k + k - x /\ x i MOD k +k-(t+1) = 1*k+ i MOD k-(t+1)/\ i MOD k-(t+1) ~(k=0)`; MOD_MULT_ADD]; + + + + + +SUBGOAL_THEN`~((j1+1) MOD k= x)`ASSUME_TAC; + +MP_TAC (ARITH_RULE`j1+1 ~(i MOD k +k-(t+1) =x) /\ ~((i MOD k +k-(t+1)) +1 =x)`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[MOD_LT;ARITH_RULE`3 ~(k=0)`]; + + +MP_TAC(ARITH_RULE`SUC t < i MOD k + k - x /\ x (SUC(i MOD k) +k-(t+1)) =(i MOD k +k-(t+1)) +1`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`SUC t < i MOD k + k - x /\ x (i MOD k +k-(t+1))+1 = 1*k+ SUC(i MOD k)-(t+1)/\ (i MOD k +k-(t+1)) +1=(SUC(i MOD k) +k-(t+1)) /\ SUC(i MOD k)-(t+1) ~(k=0)`; MOD_MULT_ADD] +THEN ASM_REWRITE_TAC[ADD1;SUB_ADD_RCANCEL]; + + +THAYTHEL_ASM_TAC (40-19)[`j1`][ARITH_RULE`SUC i= i+1`;MOD_LT] +THEN THAYTHEL_ASM_TAC (0)[`j1+1`][ARITH_RULE`SUC (i+1)= i+2`;MOD_LT] +; + + + + +SUBGOAL_THEN `!t. t< x-i MOD k ==> dist ((v:num->real^3) (i MOD k+t),v ( (i MOD k+ t) + 1)) = &2` +ASSUME_TAC +; + + +REMOVE_ASSUM_TAC +THEN INDUCT_TAC +; + + + + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE`a+0=a`;GSYM ADD1] +THEN DICH_TAC(24-7) +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`i MOD k`;`v:num->real^3`;`i`][MOD_REFL;ARITH_RULE`3 ~(k=0)`; MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`SUC(i MOD k)`;`v:num->real^3`;`(SUC(i MOD k)) MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1real^3`;`SUC i`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1 t< x - i MOD k`) +THEN RESA_TAC +THEN DICH_TAC 2 +THEN RESA_TAC +THEN ABBREV_TAC`j1=i MOD k+t` +THEN ASM_REWRITE_TAC[ARITH_RULE`i MOD k + SUC t= (i MOD k + t)+1/\ (j1 + 1) + 1= j1+2`] +THEN THAYTHEL_ASM_TAC(27-17)[`j1+1`][ARITH_RULE`(i+1)+1=i+2`] +THEN THAYTHEL_ASM_TAC(28-13)[`j1+2`][ARITH_RULE`(i+2)+1=i+3`] +THEN MP_TAC(ARITH_RULE`3 (j1+k-1)+1= 1*k+j1`) +THEN RESA_TAC +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`j1+k-1`;`1*k+j1`;`s:scs_v39`;`j1+k-1`;`(1*k+j1) MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1 ~(k=0)/\ 1 ~(k=0)/\ 1 ~(k=0)/\ 1 i MOD k + t (i MOD k- j MOD k) < i MOD k + k - x /\ i MOD k + k - (i MOD k - j MOD k)= 1*k+ j MOD k/\ (1 * k + j MOD k) + 1= 1 * k + SUC(j MOD k) `) +THEN RESA_TAC +THEN THAYTHE_TAC 6[`i MOD k - j MOD k`] +THEN DICH_TAC 0 +THEN DICH_TAC(29-7) +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`1*k+j MOD k`;`v:num->real^3`;`(1*k+j MOD k) MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1real^3`;`j`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1real^3`;`(1*k+ SUC(j MOD k)) MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1real^3`;`SUC j`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1 j MOD k< x \/ x< j MOD k`) +THEN RESA_TAC +; + + +MP_TAC(ARITH_RULE`j MOD k< x/\ i MOD k<= j MOD k==> j MOD k- i MOD k< x- i MOD k /\ i MOD k+(j MOD k- i MOD k)= j MOD k`) +THEN RESA_TAC +THEN THAYTHE_TAC (30-25)[`j MOD k- i MOD k`] +THEN DICH_TAC 0 +THEN DICH_TAC(29-7) +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`j MOD k`;`v:num->real^3`;`j`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1real^3`;`SUC(j MOD k) MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1real^3`;`SUC j`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1 i MOD k+k- j MOD k< i MOD k+ k- x +/\ i MOD k +k -(i MOD k+k- j MOD k)= j MOD k`) +THEN ASM_SIMP_TAC[ARITH_RULE`3 ~(k=0)/\ 1real^3`;`j`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1real^3`;`SUC(j MOD k) MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1real^3`;`SUC j`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1 dist ((v:num->real^3) (i MOD k+t),v ( (i MOD k+t) + 1)) = &2` +ASSUME_TAC +; + + + +INDUCT_TAC +; + + + + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE`a+0=a`;GSYM ADD1] +THEN DICH_TAC(24-7) +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`i MOD k`;`v:num->real^3`;`i`][MOD_REFL;ARITH_RULE`3 ~(k=0)`; MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`SUC(i MOD k)`;`v:num->real^3`;`(SUC(i MOD k)) MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1real^3`;`SUC i`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1 t< x +k - i MOD k`) +THEN RESA_TAC +THEN DICH_TAC 2 +THEN RESA_TAC +THEN ABBREV_TAC`j1=i MOD k+t` +THEN ASM_REWRITE_TAC[ARITH_RULE`i MOD k + SUC t= (i MOD k + t)+1/\ (j1 + 1) + 1= j1+2`] +THEN THAYTHEL_ASM_TAC(27-17)[`j1+1`][ARITH_RULE`(i+1)+1=i+2`] +THEN THAYTHEL_ASM_TAC(28-13)[`j1+2`][ARITH_RULE`(i+2)+1=i+3`] +THEN MP_TAC(ARITH_RULE`3 (j1+k-1)+1= 1*k+j1`) +THEN RESA_TAC +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`j1+k-1`;`1*k+j1`;`s:scs_v39`;`j1+k-1`;`(1*k+j1) MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1 ~(k=0)/\ 1 ~(k=0)/\ 1 ~(k=0)/\ 1 ~(i MOD k +t =x) `) +THEN RESA_TAC +THEN ASM_SIMP_TAC[MOD_LT;ARITH_RULE`3 ~(k=0)`]; + + +MP_TAC(ARITH_RULE`SUC t < x + k - i MOD k /\ x (i MOD k+t) -k ONCE_REWRITE_TAC[th]) +THEN ASM_SIMP_TAC[MOD_LT;ARITH_RULE`3 ~(k=0)`; MOD_MULT_ADD]; + + + + + +SUBGOAL_THEN`~((j1+1) MOD k= x)`ASSUME_TAC; + +MP_TAC (ARITH_RULE`j1+1 ~((i MOD k +t) +1=x) `) +THEN RESA_TAC +THEN ASM_SIMP_TAC[MOD_LT;ARITH_RULE`3 ~(k=0)`]; + + +MP_TAC(ARITH_RULE`SUC t < x + k - i MOD k /\ x ((i MOD k+t)+1) -k ONCE_REWRITE_TAC[th]) +THEN ASM_SIMP_TAC[MOD_LT;ARITH_RULE`3 ~(k=0)`; MOD_MULT_ADD]; + + +THAYTHEL_ASM_TAC (38-19)[`j1`][ADD1] +THEN THAYTHEL_ASM_TAC (0)[`j1+1`][ADD1;ARITH_RULE`(j1 + 1) + 1= j1+2`] +; + + + + + +SUBGOAL_THEN `!t. t< i MOD k- x ==> dist ((v:num->real^3) (i MOD k-t),v ( (i MOD k-t) + 1)) = &2` +ASSUME_TAC +; + + +REMOVE_ASSUM_TAC +THEN INDUCT_TAC +; + + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE`a-0=a`;GSYM ADD1] +THEN DICH_TAC(24-7) +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`i MOD k`;`v:num->real^3`;`i`][MOD_REFL;ARITH_RULE`3 ~(k=0)`; MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`SUC(i MOD k)`;`v:num->real^3`;`(SUC(i MOD k)) MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1real^3`;`SUC i`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1 t< i MOD k- x`) +THEN RESA_TAC +THEN DICH_TAC 2 +THEN RESA_TAC +THEN ABBREV_TAC`j1=i MOD k-(t+1)` +THEN ASM_REWRITE_TAC[ARITH_RULE`i MOD k + SUC t= (i MOD k + t)+1/\ (j1 + 1) + 1= j1+2`] +THEN THAYTHEL_ASM_TAC(27-17)[`j1+1`][ARITH_RULE`(i+1)+1=i+2`] +THEN THAYTHEL_ASM_TAC(28-13)[`j1+2`][ARITH_RULE`(i+2)+1=i+3`] +THEN MP_TAC(ARITH_RULE`3 (j1+k-1)+1= 1*k+j1`) +THEN RESA_TAC +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`j1+k-1`;`1*k+j1`;`s:scs_v39`;`j1+k-1`;`(1*k+j1) MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1 ~(k=0)/\ 1 ~(k=0)/\ 1 ~(k=0)/\ 1 i MOD k - t=(i MOD k - (t+1)) + 1/\ i MOD k - t +1=(i MOD k - (t+1)) + 2/\ i MOD k - (t+1) ~(k=0)`;DIVISION] +THEN RESA_TAC +THEN RESA_TAC +THEN MP_TAC Cqaoqlr.CQAOQLR +THEN RESA_TAC +THEN THAYTHES_TAC 0[`s`;`v`;`j1`][ARITH_RULE`SUC j= j+1/\ SUC j+1= j+2`;IN] +THEN MATCH_DICH_TAC 0 +; + + + +THAYTHEL_ASM_TAC (41-19)[`j1`][ADD1;ARITH_RULE`3 ~(k=0)`; MOD_LT] +THEN THAYTHES_TAC (0)[`j1+1`][ADD1;ARITH_RULE`(j1 + 1) + 1= j1+2`;ARITH_RULE`3 ~(k=0)`; MOD_LT] +; + + + + + +STRIP_TAC +THEN MP_TAC(ARITH_RULE`~(j MOD k = x)==> j MOD k< x\/ x< j MOD k`) +THEN RESA_TAC; + + + +MP_TAC(ARITH_RULE`j MOD k< x/\ x< i MOD k/\ i MOD k j MOD k+ k- i MOD k< x+k- i MOD k/\ i MOD k+(j MOD k+ k- i MOD k)= 1*k+ j MOD k/\ (1 * k + j MOD k) + 1= 1 * k + SUC(j MOD k) `) +THEN ASM_SIMP_TAC[ARITH_RULE`3 ~(k=0)`;DIVISION] +THEN RESA_TAC +THEN THAYTHE_TAC 6[`j MOD k+ k- i MOD k`] +THEN DICH_TAC 0 +THEN DICH_TAC(29-7) +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`1 * k + j MOD k`;`v:num->real^3`;`(1 * k + j MOD k)MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1real^3`;`j`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1real^3`;`(1 * k + SUC(j MOD k))MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1real^3`;`SUC j`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1 i MOD k- j MOD k< i MOD k - x/\ i MOD k- (i MOD k- j MOD k)= j MOD k`) +THEN RESA_TAC +THEN THAYTHE_TAC (30-25)[`i MOD k- j MOD k`] +THEN DICH_TAC 0 +THEN DICH_TAC(29-7) +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`j MOD k`;`v:num->real^3`;`j`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1real^3`;`SUC(j MOD k) MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1real^3`;`SUC j`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1 j MOD k- i MOD k< x+k-i MOD k/\ i MOD k+(j MOD k- i MOD k)= j MOD k`) +THEN ASM_SIMP_TAC[ARITH_RULE`3 ~(k=0)`;DIVISION] +THEN RESA_TAC +THEN THAYTHE_TAC (30-24)[`j MOD k- i MOD k`] +THEN DICH_TAC 0 +THEN DICH_TAC(29-7) +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`j MOD k`;`v:num->real^3`;`j`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1real^3`;`SUC(j MOD k) MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1real^3`;`SUC j`][MOD_REFL;ARITH_RULE`3 ~(k=0)/\ 1 true + | _ -> false in + let has_main ind = + exists (is_main) ind.tags in + let main_ineq_data1 = + filter has_main (!Ineq.ineqs) in + let id = map (fun t-> t.idv) main_ineq_data1 in + (* debug + let id = nonlinear_ineq_terminal in *) + let main_ineq_data = map (fun t -> hd(Ineq.getexact t)) id in + let ineql = map (fun ind -> ind.ineq) main_ineq_data in + let sl = map (fun ind -> ind.idv) main_ineq_data in + let main_ineq_conj = end_itlist (curry mk_conj) ineql in + let th = new_definition (mk_eq (`main_work4:bool`,main_ineq_conj)) in + let th1 = UNDISCH (MATCH_MP (TAUT `(a <=> b) ==> (a ==> b)`) th) in + let co1 thm = if (is_conj (concl thm)) then CONJUNCT1 thm else thm in + let tryindex s sl = try index s sl with _ -> report s; failwith s in + fun s -> + let i = tryindex s sl in + let th2 = funpow i CONJUNCT2 th1 in + co1 th2;; + +*) + +let taum_attains_inf = prove_by_refinement( + (* main_work4 ==> *) `main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6. &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + &2 <= y4 /\ y4 <= &2 * h0 /\ + &2 <= y5 /\ y5 <= &2 * h0 /\ + &2 <= y6 /\ y6 <= &2 * h0 + ==> + (?y4'. &2 <= y4' /\ y4' <= &2 * h0 /\ (!y4. &2 <= y4 /\ y4 <= &2 * h0 ==> + taum y1 y2 y3 y4' y5 y6 <= taum y1 y2 y3 y4 y5 y6)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC REAL_CONTINUOUS_ATTAINS_INF [`\q. taum y1 y2 y3 q y5 y6`;`real_interval [&2, &2 * h0]`]; + ANTS_TAC; + REWRITE_TAC[REAL_COMPACT_INTERVAL]; + CONJ_TAC; + REWRITE_TAC[EXTENSION;NOT_IN_EMPTY;IN_REAL_INTERVAL;NOT_FORALL_THM;Sphere.h0]; + TYPIFY `&2` EXISTS_TAC; + BY(REAL_ARITH_TAC); + REWRITE_TAC[REAL_CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN]; + REWRITE_TAC[IN_REAL_INTERVAL]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC REAL_CONTINUOUS_ATREAL_WITHINREAL; + MATCH_MP_TAC Bkossge.real_continuous_taum; + ASM_SIMP_TAC[arith `&2 <= y ==> &0 < y`]; + CONJ_TAC; + INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "4717061266") [`y1`;`y2`;`y3`;`x`;`y5`;`y6`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + REWRITE_TAC[arith `x > &0 <=> &0 < x`] THEN DISCH_THEN MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + BY(REPEAT CONJ_TAC THEN MATCH_MP_TAC Ysskqoy.TRI_UPS_X_STRICT_POS THEN ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + REWRITE_TAC[IN_REAL_INTERVAL]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `x` EXISTS_TAC; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let TAUM_EXTREMAL = prove_by_refinement( + (* main_work4 ==> *) ` main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6. + &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + &2 <= y4 /\ y4 <= &2 * h0 /\ + &2 <= y5 /\ y5 <= &2 * h0 /\ + &2 <= y6 /\ y6 <= &2 * h0 + ==> + (?y4'. (y4' = &2 * h0 \/ y4' = &2) /\ + taum y1 y2 y3 y4' y5 y6 <= taum y1 y2 y3 y4 y5 y6) + )`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (UNDISCH2 taum_attains_inf) [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `y4'` EXISTS_TAC; + CONJ2_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + PROOF_BY_CONTR_TAC; + TYPIFY `&2 < y4' /\ y4' < &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + INTRO_TAC (UNDISCH Ocbicby.LEMMA_1834976363) [`y1`;`y2`;`y3`;`y4'`;`y5`;`y6`;`&2`;`&2 * h0`]; + ANTS_TAC; + ASM_REWRITE_TAC[SUBSET;IN_REAL_INTERVAL;IN_ELIM_THM]; + ASM_SIMP_TAC [arith `&2 <= y ==> &0 < y`]; + INTRO_TAC Ocbicby.xrr_simple_lower_bound [`y2`;`y3`;`y4'`;`&2`]; + INTRO_TAC Ocbicby.xrr_simple_lower_bound [`y1`;`y3`;`y5`;`&2`]; + INTRO_TAC Ocbicby.xrr_simple_lower_bound [`y1`;`y2`;`y6`;`&2`]; + ASM_REWRITE_TAC[arith `x <= x`]; + REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]; + CONJ_TAC; + INTRO_TAC Ocbicby.xrr_simple_upper_bound [`y2`;`y3`;`y4'`;`&2 * h0`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[] THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + CONJ2_TAC; + BY(CONJ_TAC THEN MATCH_MP_TAC Bkossge.UPS_X_STD_POS THEN ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_SIMP_TAC[arith `&2 < x ==> &0 < x`]; + CONJ2_TAC; + MATCH_MP_TAC Bkossge.UPS_X_STD_POS THEN ASM_REWRITE_TAC[]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "4717061266") [`y1`;`y2`;`y3`;`x`;`y5`;`y6`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + REWRITE_TAC[arith `x > &0 <=> &0 < x`] THEN DISCH_THEN MATCH_MP_TAC; + (ASM_REWRITE_TAC[]); + BY(REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REWRITE_TAC[IN_REAL_INTERVAL]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`y4''`]); + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[arith `~(x <= y) <=> (y < x)`]) + ]);; + (* }}} *) + +let TAUM_STD_POS = prove_by_refinement( + (* main_work4 ==> *) ` main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6. + &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + &2 <= y4 /\ y4 <= &2 * h0 /\ + &2 <= y5 /\ y5 <= &2 * h0 /\ + &2 <= y6 /\ y6 <= &2 * h0 + ==> + (&0 <= taum y1 y2 y3 y4 y5 y6))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `x <= y <=> ~(y < x)`]; + DISCH_TAC; + TYPIFY `&2 * h0 <= sqrt8 /\ #2.52 = &2 * h0 /\ &2 <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Sphere.h0] THEN MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC); + COMMENT "y4"; + INTRO_TAC (UNDISCH2 TAUM_EXTREMAL) [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (DISJ_CASES_TAC); + REPEAT (FIRST_X_ASSUM_ST `taum` MP_TAC) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ( Terminal.get_main_nonlinear "5541487347") [`y2`;`y3`;`y1`;`y5`;`y6`;`y4'`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + TYPIFY `taum y2 y3 y1 y5 y6 y4' = taum y1 y2 y3 y4' y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[Terminal.taum_sym]); + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `taum y1 y2 y3 (&2) y5 y6 < &0` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `taum` MP_TAC THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM MP_TAC; + POP_ASSUM kill; + REPEAT (FIRST_X_ASSUM_ST `taum` kill); + DISCH_TAC; + COMMENT "y5"; + INTRO_TAC (UNDISCH2 TAUM_EXTREMAL) [`y2`;`y3`;`y1`;`y5`;`y6`;`(&2)`]; + ASM_REWRITE_TAC[arith `x <= x`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `taum y1 y2 y3 (&2) y5 y6 = taum y2 y3 y1 y5 y6 (&2) /\ taum y3 y1 y2 y6 (&2) y4' = taum y2 y3 y1 y4' y6 (&2)` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[Terminal.taum_sym]); + FIRST_X_ASSUM (DISJ_CASES_TAC); + REPEAT (FIRST_X_ASSUM_ST `taum` MP_TAC) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ( Terminal.get_main_nonlinear "5541487347") [`y3`;`y1`;`y2`;`y6`;`&2`;`y4'`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `taum y1 y2 y3 (&2) (&2) y6 < &0` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `taum y1 y2 y3 (&2) (&2) y6 = taum y2 y3 y1 (&2) y6 (&2)` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[Terminal.taum_sym]); + BY(REPEAT (FIRST_X_ASSUM_ST `taum` MP_TAC) THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM MP_TAC; + POP_ASSUM kill; + REPEAT (FIRST_X_ASSUM_ST `taum` kill); + DISCH_TAC; + COMMENT "y6"; + INTRO_TAC (UNDISCH2 TAUM_EXTREMAL) [`y3`;`y1`;`y2`;`y6`;`(&2)`;`(&2)`]; + ASM_REWRITE_TAC[arith `x <= x`]; + REPEAT WEAKER_STRIP_TAC; + POP_ASSUM MP_TAC; + TYPIFY_GOAL_THEN `!z1 z2 z3. taum y3 y1 y2 z3 z1 z2 = taum y1 y2 y3 z1 z2 z3` (unlist REWRITE_TAC); + BY(MESON_TAC[Terminal.taum_sym]); + DISCH_TAC; + FIRST_X_ASSUM (DISJ_CASES_TAC); + REPEAT (FIRST_X_ASSUM_ST `taum` MP_TAC) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ( Terminal.get_main_nonlinear "5541487347") [`y1`;`y2`;`y3`;`&2`;`&2`;`&2 * h0`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + BY(REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `taum y1 y2 y3 (&2) (&2) (&2) < &0` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM_ST `taum` MP_TAC) THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC); + INTRO_TAC ( Terminal.get_main_nonlinear "OMKYNLT 3336871894") [`y1`;`y2`;`y3`;`&2`;`&2`;`&2`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + ASM_REWRITE_TAC[arith `#2.0 = &2`]; + BY(POP_ASSUM MP_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let LFLACKU = prove_by_refinement( + (* main_work4 ==> *) ` main_nonlinear_terminal_v11 ==> + scs_arrow_v39 {scs_3I1} {}`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REPEAT (GMATCH_SIMP_TAC Ocbicby.pos_imp_scs_arrow_empty); + REWRITE_TAC[Appendix.scs_3I1;Appendix.mk_unadorned_v39]; + MATCH_MP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] Terminal.taustar_taum_dfun); + REWRITE_TAC[Terminal.FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.is_ear_v39;Appendix.scs_v39_explicit;EMPTY_GSPEC;NOT_INSERT_EMPTY]; + REWRITE_TAC[Appendix.d_tame]; + REWRITE_TAC[Appendix.cs_adj;Terminal.FUNLIST_EXPLICIT]; + NUM_REDUCE_TAC; + REWRITE_TAC[arith `x <= x`]; + TYPIFY_GOAL_THEN `&2 * h0 <= #3.62` (unlist REWRITE_TAC); + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `&0 + #0.1 * -- &1 * (&0 + &0 + &0 + &0) = &0`]; + MATCH_MP_TAC (UNDISCH2 TAUM_STD_POS); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + + +let s_init_list_alt = prove_by_refinement( + `s_init_list_v39 = [scs_6I1;scs_5I1;scs_4I1;scs_3I1;scs_5I2;scs_4I2;scs_5I3;scs_4I3]`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.s_init_list_v39]; + REPEAT LET_TAC; + ASM_REWRITE_TAC[CONS_11;Appendix.scs_6I1;Appendix.scs_5I1;Appendix.scs_4I1;Appendix.scs_3T1;Appendix.scs_5I2;Appendix.scs_5I3;Appendix.scs_4I3;Appendix.scs_3I1;Appendix.scs_4I2]; + TYPIFY `(!a1 a2 a3. (a_pro 5 a1 a2 a3 = (funlist_v39 [(0,1),a1; (0,2),a3; (0,3),a3; (1,3),a3; (1,4),a3; (2,4), a3] a2 5))) /\ (!a1 a2 a3. a_pro 4 a1 a2 a3 = (funlist_v39 [(0,1),a1; (0,2),a3; (1,3),a3] a2 4))` ENOUGH_TO_SHOW_TAC; + BY(DISCH_THEN (unlist REWRITE_TAC)); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[FUN_EQ_THM]; + MATCH_MP_TAC Terminal.periodic2_mod_reduce; + TYPIFY `5` EXISTS_TAC; + REWRITE_TAC[arith `~(5 =0)`]; + CONJ_TAC; + REWRITE_TAC[Appendix.periodic2]; + EXPAND_TAC "a_pro"; + ASM_REWRITE_TAC[Oxl_2012.MOD_ADD_CANCEL;arith `SUC (j+5) = (SUC j) + 5`]; + BY(MESON_TAC[Terminal.periodic2_funlist;Appendix.periodic2]); + REWRITE_TAC[arith `x < 5 <=> x = 0 \/ x = 1 \/ x = 2 \/ x = 3 \/ x = 4`]; + REWRITE_TAC[TAUT ` ((a \/ b) /\ c) <=> ((a /\ c) \/ (b /\ c))`;TAUT `(a /\ (b \/ c)) <=> ((a /\ b) \/ (a /\ c))`]; + EXPAND_TAC "a_pro"; + REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Hexagons.PSORT_5_EXPLICIT] THEN NUM_REDUCE_TAC); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[FUN_EQ_THM]; + MATCH_MP_TAC Terminal.periodic2_mod_reduce; + TYPIFY `4` EXISTS_TAC; + REWRITE_TAC[arith `~(4 =0)`]; + CONJ_TAC; + REWRITE_TAC[Appendix.periodic2]; + EXPAND_TAC "a_pro"; + ASM_REWRITE_TAC[Oxl_2012.MOD_ADD_CANCEL;arith `SUC (j+4) = (SUC j) + 4`]; + BY(MESON_TAC[Terminal.periodic2_funlist;Appendix.periodic2]); + REWRITE_TAC[arith `x < 4 <=> x = 0 \/ x = 1 \/ x = 2 \/ x = 3`]; + REWRITE_TAC[TAUT ` ((a \/ b) /\ c) <=> ((a /\ c) \/ (b /\ c))`;TAUT `(a /\ (b \/ c)) <=> ((a /\ b) \/ (a /\ c))`]; + EXPAND_TAC "a_pro"; + REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] THEN NUM_REDUCE_TAC) + ]);; + (* }}} *) + +(* moved to JEJTVGB.hl +let JEJTVGB_case_breakdown = prove_by_refinement( + (* main_work4 ==> *) ` main_nonlinear_terminal_v11 ==> ( + scs_arrow_v39 { scs_6I1 } { scs_6T1, scs_5M1, scs_4M2, scs_3T1 } /\ // OEHDBEN + scs_arrow_v39 { scs_5I1 } { scs_stab_diag_v39 scs_5I1 0 2 , scs_5M2 } /\ // OTMTOTJ1 +scs_arrow_v39 { scs_5I2 } { scs_stab_diag_v39 scs_5I2 0 2 , scs_5M2 } /\ // + +scs_arrow_v39 { scs_5I3 } { scs_stab_diag_v39 scs_5M1 0 2 , + scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4, scs_5M2 } /\ // OTMTOTJ3 + +scs_arrow_v39 { scs_5M1 } { scs_stab_diag_v39 scs_5M1 0 2 , + scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4, scs_5M2 } /\ // OTMTOTJ4 + +scs_arrow_v39 { scs_5M2 } { scs_3T1,scs_3T4,scs_4M6',scs_4M7,scs_4M8, + scs_5T1, scs_stab_diag_v39 scs_5I2 0 2 , + scs_stab_diag_v39 scs_5M1 0 2 , scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4 } /\ // HIJQAHA + +scs_arrow_v39 { scs_stab_diag_v39 scs_5I1 0 2 } + {scs_4M2, scs_3M1 } /\ // CNICGSF1 .. + +scs_arrow_v39 { scs_stab_diag_v39 scs_5I2 0 2 } + {scs_4M3', scs_3T1 } /\ // CNICGSF2 + +scs_arrow_v39 { scs_stab_diag_v39 scs_5M1 0 2 } + {scs_4M2, scs_3T4 } /\ // CNICGSF3 + +scs_arrow_v39 { scs_stab_diag_v39 scs_5M1 0 3 } + {scs_4M4', scs_3M1 } /\ // CNICGSF4 + +scs_arrow_v39 { scs_stab_diag_v39 scs_5M1 2 4 } + {scs_4M5', scs_3M1 } /\ // CNICGSF5 .. + + scs_arrow_v39 { scs_4I1 } {scs_4I2, scs_stab_diag_v39 scs_4I1 0 2 } /\ // FYSSVEV + + + scs_arrow_v39 { scs_4I2 } { scs_4T1, scs_4T2 } /\ // ARDBZYE + + + scs_arrow_v39 { scs_stab_diag_v39 scs_4I1 0 2 } { scs_3M1 } /\ // AUEAHEH + + // scs_arrow_v39 { scs_stab_diag_v39 scs_4I3 0 2 } { scs_4T4 } /\ // ZNLLLDL (internal) + + scs_arrow_v39 { scs_4I3 } { scs_4T4, scs_4M6' } /\ // VQFYMZY .. + +// scs_arrow_v39 { scs_4M1 } { scs_4M2, scs_4M6' } /\ // unused. + + scs_arrow_v39 { scs_4M2 } { scs_3M1, scs_3T4, scs_4M6' } /\ // BNAWVNH + + scs_arrow_v39 { scs_4M3' } { scs_3T1, scs_3T6', scs_4M6' } /\ // RAWZDIB + + scs_arrow_v39 { scs_4M4' } { scs_3M1, scs_3T4, scs_3T3, scs_4M7 } /\ // MFKLVDK + + scs_arrow_v39 { scs_4M5' } { scs_3T4, scs_4M8 } /\ // RYPDIXT + +scs_arrow_v39 {scs_4M6'} {scs_4T3,scs_4T5} /\ // NWDGKXH + +scs_arrow_v39 {scs_4M7} {scs_3M1,scs_3T3,scs_3T4} /\ // YOBIMPP + +scs_arrow_v39 {scs_4M8} {scs_4M6',scs_3T7,scs_3T4} /\ // MIQMCSN + + scs_arrow_v39 {scs_3M1} {scs_3T1,scs_3T5} // BKOSSGE + +==> +JEJTVGB_assume_v39) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (UNDISCH Ocbicby.OCBICBY) []; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `scs_arrow_v39 {scs_3M1} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_3T1, scs_3T5}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_4M6'} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_4T3, scs_4T5}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_4M7} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_3M1, scs_3T3, scs_3T4}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_4M8} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_4M6', scs_3T7, scs_3T4}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_4M5'} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_3T4, scs_4M8}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_4M4'} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{ scs_3M1, scs_3T4, scs_3T3, scs_4M7 }` EXISTS_TAC; (* revised *) + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_4M3'} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_3T1, scs_3T6', scs_4M6'}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_4M2} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{ scs_3M1, scs_3T4, scs_4M6' }` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_4I3} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_4T4, scs_4M6'}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_stab_diag_v39 scs_4I1 0 2} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_3M1}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_4I2} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_4T1, scs_4T2}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_4I1} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_4I2, scs_stab_diag_v39 scs_4I1 0 2}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_stab_diag_v39 scs_5M1 2 4} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_4M5', scs_3M1}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_stab_diag_v39 scs_5M1 0 3} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_4M4', scs_3M1}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_stab_diag_v39 scs_5M1 0 2} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY ` {scs_4M2, scs_3T4}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_stab_diag_v39 scs_5I2 0 2} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_4M3', scs_3T1}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_stab_diag_v39 scs_5I1 0 2} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY ` {scs_4M2, scs_3M1}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_5M2} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY ` {scs_3T1, scs_3T4, scs_4M6', scs_4M7, scs_4M8, scs_5T1, scs_stab_diag_v39 scs_5I2 0 2, scs_stab_diag_v39 scs_5M1 0 2, scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_5M1} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_stab_diag_v39 scs_5M1 0 2, scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4, scs_5M2}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_5I3} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_stab_diag_v39 scs_5M1 0 2, scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4, scs_5M2}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_5I2} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_stab_diag_v39 scs_5I2 0 2, scs_5M2}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_5I1} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY ` {scs_stab_diag_v39 scs_5I1 0 2, scs_5M2}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `scs_arrow_v39 {scs_6I1} {}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SCS_ARROW_TRANS_SING; + TYPIFY `{scs_6T1, scs_5M1, scs_4M2, scs_3T1}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + COMMENT "final kill"; + MATCH_MP_TAC Ayqjtmd.EAPGLE; + REWRITE_TAC[GSYM Ocbicby.scs_arrow_sing_empty]; + REWRITE_TAC[s_init_list_alt;MEM]; + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[UNDISCH2 LFLACKU]) + ]);; + (* }}} *) +*) + +let MOD_4_CASES = prove_by_refinement( + `!j p. j < 4 ==> j = (p+0) MOD 4 \/ j = (p+1) MOD 4 \/ j = (p+2) MOD 4 \/ j = (p+3) MOD 4`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `p MOD 4 < 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[DIVISION;arith `~(4 = 0)`]); + TYPED_ABBREV_TAC `i = p MOD 4`; + TYPIFY `(j = 0 \/ j = 1 \/ j = 2 \/ j = 3) /\ (i = 0 \/ i = 1 \/ i = 2 \/ i = 3)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_TAC THEN ARITH_TAC); + TYPIFY_GOAL_THEN `!k. (p + k) MOD 4 = (i + k) MOD 4` (unlist REWRITE_TAC); + GEN_TAC; + ONCE_REWRITE_TAC[arith `(i:num) + j = j + i`]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + EXPAND_TAC "i"; + GMATCH_SIMP_TAC MOD_MOD_REFL; + BY(ARITH_TAC); + POP_ASSUM MP_TAC THEN REWRITE_TAC[TAUT ` ((a \/ b) /\ c) <=> ((a /\ c) \/ (b /\ c))`;TAUT `(a /\ (b \/ c)) <=> ((a /\ b) \/ (a /\ c))`]; + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[Terminal.MOD_4_EXPLICIT]) + ]);; + (* }}} *) + +let ab4_assumption_reduction = prove_by_refinement( + `!s p f v e. + is_scs_v39 s /\ + scs_k_v39 s = 4 /\ + BBs_v39 s v /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j < dist(v i,v j) /\ &4 * h0 < scs_b_v39 s i j) /\ + deformation f (IMAGE v (:num)) (--e,e) /\ + &0 < e /\ + (!w t. ~(w = v p) ==> (f w t = w)) /\ + (!t. abs t < e ==> dist (v (p + 3),f (v p) t) = dist (v (p + 3),v p)) /\ + scs_a_v39 s p (p + 1) < dist (v p,v (p + 1)) /\ dist (v p,v (p + 1)) < scs_b_v39 s p (p + 1) + ==> + (!i j. ?e1. &0 < e1 /\ (scs_a_v39 s i j = dist(v i,v j) ==> + (!t. abs t < e1 ==> scs_a_v39 s i j <= dist(f (v i) t,f (v j) t)))) /\ + (!i j. + ?e2. &0 < e2 /\ + (dist (v i,v j) = scs_b_v39 s i j + ==> (!t. abs t < e2 + ==> dist (f (v i) t,f (v j) t) <= scs_b_v39 s i j))) + `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASSUME_TAC (arith `~(4 = 0)`); + TYPIFY `!i j.scs_a_v39 s (i MOD 4) (j MOD 4) = scs_a_v39 s i j /\ scs_b_v39 s (i MOD 4) (j MOD 4) = scs_b_v39 s i j ` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; + ASM_REWRITE_TAC[Appendix.is_scs_v39]; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[Cuxvzoz.periodic2_MOD]); + TYPIFY `!i. i MOD 4 < 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION]); + TYPIFY `periodic v 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN MESON_TAC[]); + TYPIFY `!i. v (i MOD 4) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[]); + INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`4`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!j. j < 4 ==> (j MOD 4 = j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[MOD_LT]); + COMMENT "scs_a_v39"; + CONJ_TAC; + MATCH_MP_TAC Terminal.periodic2_mod_reduce; + TYPIFY `4` EXISTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC Cuxvzoz.MOD_periodic2; + BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[] THEN MESON_TAC[]); + TYPIFY `!j. j < 4 ==> (?e1. &0 < e1 /\ (scs_a_v39 s p j = dist (v p,v j) ==> (!t. abs t < e1 ==> scs_a_v39 s p j <= dist (f (v p) t,f (v j) t))))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `i = ( p MOD 4)` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`j`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `scs_a_v39 s (p MOD 4) j = scs_a_v39 s p j ` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + TYPIFY `j = p MOD 4` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`i`]); + ASM_REWRITE_TAC[DIST_SYM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `scs_a_v39 s i (p MOD 4) = scs_a_v39 s i p ` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN MESON_TAC[]); + TYPIFY `&1` EXISTS_TAC; + REWRITE_TAC[arith `&0 < &1`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!w t. ~(w = v p) ==> f w t = w` ( (C FIRST_ASSUM_ST GMATCH_SIMP_TAC)); + TYPIFY `!w t. ~(w = v p) ==> f w t = w` ( (C FIRST_X_ASSUM_ST GMATCH_SIMP_TAC)); + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + nCONJ_TAC 2; + BY(FIRST_X_ASSUM (C INTRO_TAC [`i`;`j`]) THEN MESON_TAC[]); + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 20 (POP_ASSUM MP_TAC) THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MOD_4_CASES [`j`;`p`]; + ASM_REWRITE_TAC[arith `p + 0 = p`] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[DIST_REFL]; + BY(TYPIFY `&1` EXISTS_TAC THEN MESON_TAC[arith `&0 <= &0 /\ &0 < &1`]); + TYPIFY `&1` EXISTS_TAC THEN REWRITE_TAC[arith `&0 < &1`]; + BY(ASM_MESON_TAC[arith `x < y ==> ~(x = y)`]); + FIRST_X_ASSUM_ST `scs_diag` (C INTRO_TAC [`p`;`p+2`]); + TYPIFY `scs_diag 4 p (p+2)` ENOUGH_TO_SHOW_TAC; + DISCH_THEN (unlist REWRITE_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `&1` EXISTS_TAC THEN REWRITE_TAC[arith `&0 < &1`]; + BY(ASM_MESON_TAC[arith `x < y ==> ~(x = y)`]); + REWRITE_TAC[arith `p+2 = SUC(SUC p)`]; + MATCH_MP_TAC Tfitskc.SCS_DIAG_2; + BY(NUM_REDUCE_TAC); + TYPIFY `e` EXISTS_TAC; + ASM_REWRITE_TAC[]; + DISCH_TAC; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `abs` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[DIST_SYM]; + DISCH_THEN (SUBST1_TAC o GSYM); + MATCH_MP_TAC (arith `(x = y) ==> x <= y`); + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM_ST `v (i MOD 4) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); + TYPIFY_GOAL_THEN `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` MATCH_MP_TAC; + BY(ASM_MESON_TAC[]); + nCONJ_TAC 2; + TYPIFY `~((p + 3) MOD 4 = (p+0) MOD 4)` ENOUGH_TO_SHOW_TAC; + BY(REWRITE_TAC[arith `p+0=p`]); + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + BY(NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[Terminal.MOD_4_EXPLICIT]); + BY(ASM_REWRITE_TAC[]); + COMMENT "now the b end"; + MATCH_MP_TAC Terminal.periodic2_mod_reduce; + TYPIFY `4` EXISTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC Cuxvzoz.MOD_periodic2; + BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[] THEN MESON_TAC[]); + TYPIFY `!j. j < 4 ==> (?e1. &0 < e1 /\ (dist (v p,v j) = scs_b_v39 s p j ==> (!t. abs t < e1 ==> dist (f (v p) t,f (v j) t) <= scs_b_v39 s p j)))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `i = ( p MOD 4)` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`j`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `scs_b_v39 s (p MOD 4) j = scs_b_v39 s p j ` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + TYPIFY `j = p MOD 4` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`i`]); + ASM_REWRITE_TAC[DIST_SYM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `scs_b_v39 s i (p MOD 4) = scs_b_v39 s i p ` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN MESON_TAC[]); + TYPIFY `&1` EXISTS_TAC; + REWRITE_TAC[arith `&0 < &1`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!w t. ~(w = v p) ==> f w t = w` ( (C FIRST_ASSUM_ST GMATCH_SIMP_TAC)); + TYPIFY `!w t. ~(w = v p) ==> f w t = w` ( (C FIRST_X_ASSUM_ST GMATCH_SIMP_TAC)); + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + nCONJ_TAC 2; + BY(FIRST_X_ASSUM (C INTRO_TAC [`i`;`j`]) THEN MESON_TAC[]); + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 20 (POP_ASSUM MP_TAC) THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MOD_4_CASES [`j`;`p`]; + ASM_REWRITE_TAC[arith `p + 0 = p`] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[DIST_REFL]; + BY(TYPIFY `&1` EXISTS_TAC THEN MESON_TAC[arith `&0 <= &0 /\ &0 < &1`]); + TYPIFY `&1` EXISTS_TAC THEN REWRITE_TAC[arith `&0 < &1`]; + BY(ASM_MESON_TAC[arith `x < y ==> ~(x = y)`]); + FIRST_X_ASSUM_ST `scs_diag` (C INTRO_TAC [`p`;`p+2`]); + TYPIFY_GOAL_THEN `scs_diag 4 p (p+2)` (unlist REWRITE_TAC); + REWRITE_TAC[arith `p+2 = SUC(SUC p)`]; + MATCH_MP_TAC Tfitskc.SCS_DIAG_2; + BY(NUM_REDUCE_TAC); + TYPIFY `dist(v p,v (p+2)) <= &4 * h0` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[arith `x <= y /\ y < z ==> ~(x = z)`]); + INTRO_TAC DIST_TRIANGLE [`v p`;`(vec 0):real^3`;`v (p+2)`]; + REWRITE_TAC[DIST_0]; + TYPIFY `!i. norm (v i) <= &2 * h0` ENOUGH_TO_SHOW_TAC; + BY(DISCH_TAC THEN FIRST_ASSUM (C INTRO_TAC [`p`]) THEN FIRST_X_ASSUM (C INTRO_TAC [`p+2`]) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + BY(FIRST_X_ASSUM_ST `ball_annulus` MP_TAC THEN REWRITE_TAC[Terminal.IMAGE_SUBSET_IN;IN_UNIV] THEN MESON_TAC[Fnjlbxs.in_ball_annulus]); + TYPIFY `e` EXISTS_TAC; + ASM_REWRITE_TAC[]; + DISCH_TAC; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `abs` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[DIST_SYM]; + DISCH_THEN (SUBST1_TAC o GSYM); + MATCH_MP_TAC (arith `(x = y) ==> x <= y`); + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM_ST `v (i MOD 4) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); + TYPIFY_GOAL_THEN `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` MATCH_MP_TAC; + BY(ASM_MESON_TAC[]); + nCONJ_TAC 2; + TYPIFY `~((p + 3) MOD 4 = (p+0) MOD 4)` ENOUGH_TO_SHOW_TAC; + BY(REWRITE_TAC[arith `p+0=p`]); + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + BY(NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[Terminal.MOD_4_EXPLICIT]); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let PERIODIC_INJ_MOD = prove_by_refinement( + `!v k i j. ~(k= 0) /\ periodic (v:num->A) k /\ + (!i j. i < k /\ j < k /\ v i = v j ==> i = j) + ==> + ((v i = v j) <=> (i MOD k = j MOD k))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!i. v (i MOD k) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[]); + TYPIFY ` (!i j. i < (k:num) /\ j < k /\ ~(i = j) ==> ~(v i = v j))` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC (TAUT `((~b ==> ~a ) /\ (b ==> a)) ==> (a = b)`); + CONJ_TAC; + DISCH_TAC; + FIRST_X_ASSUM_ST `v (i MOD k) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[DIVISION]); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let ab4_assumption_reduction2 = prove_by_refinement( + `!s p f v e. + is_scs_v39 s /\ + scs_k_v39 s = 4 /\ + BBs_v39 s v /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j < dist(v i,v j) /\ &4 * h0 < scs_b_v39 s i j) /\ + deformation f (IMAGE v (:num)) (--e,e) /\ + &0 < e /\ + (!w t. ~(w = v p) ==> (f w t = w)) /\ + (!t. abs t < e ==> dist (v (p + 3),f (v p) t) = dist (v (p + 3),v p)) /\ + scs_a_v39 s p (p + 1) < dist (v p,v (p + 1)) /\ + (?e3. &0 < e3 /\ (!t. abs t < e3 ==> dist (f (v p) t,v (p + 1)) <= scs_b_v39 s p (p + 1))) + ==> + (!i j. ?e1. &0 < e1 /\ (scs_a_v39 s i j = dist(v i,v j) ==> + (!t. abs t < e1 ==> scs_a_v39 s i j <= dist(f (v i) t,f (v j) t)))) /\ + (!i j. + ?e2. &0 < e2 /\ + (dist (v i,v j) = scs_b_v39 s i j + ==> (!t. abs t < e2 + ==> dist (f (v i) t,f (v j) t) <= scs_b_v39 s i j))) + `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC THEN BURY_MP_TAC; + ASSUME_TAC (arith `~(4 = 0)`); + TYPIFY `!i j.scs_a_v39 s (i MOD 4) (j MOD 4) = scs_a_v39 s i j /\ scs_b_v39 s (i MOD 4) (j MOD 4) = scs_b_v39 s i j ` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; + ASM_REWRITE_TAC[Appendix.is_scs_v39]; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[Cuxvzoz.periodic2_MOD]); + TYPIFY `!i. i MOD 4 < 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION]); + TYPIFY `periodic v 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN MESON_TAC[]); + TYPIFY `!i. v (i MOD 4) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[]); + INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`4`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!j. j < 4 ==> (j MOD 4 = j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[MOD_LT]); + COMMENT "scs_a_v39"; + CONJ_TAC; + MATCH_MP_TAC Terminal.periodic2_mod_reduce; + TYPIFY `4` EXISTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC Cuxvzoz.MOD_periodic2; + BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[] THEN MESON_TAC[]); + TYPIFY `!j. j < 4 ==> (?e1. &0 < e1 /\ (scs_a_v39 s p j = dist (v p,v j) ==> (!t. abs t < e1 ==> scs_a_v39 s p j <= dist (f (v p) t,f (v j) t))))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `i = ( p MOD 4)` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`j`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `scs_a_v39 s (p MOD 4) j = scs_a_v39 s p j ` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + TYPIFY `j = p MOD 4` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`i`]); + ASM_REWRITE_TAC[DIST_SYM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `scs_a_v39 s i (p MOD 4) = scs_a_v39 s i p ` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN MESON_TAC[]); + TYPIFY `&1` EXISTS_TAC; + REWRITE_TAC[arith `&0 < &1`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!w t. ~(w = v p) ==> f w t = w` ( (C FIRST_ASSUM_ST GMATCH_SIMP_TAC)); + TYPIFY `!w t. ~(w = v p) ==> f w t = w` ( (C FIRST_X_ASSUM_ST GMATCH_SIMP_TAC)); + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + nCONJ_TAC 2; + BY(FIRST_X_ASSUM (C INTRO_TAC [`i`;`j`]) THEN MESON_TAC[]); + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 20 (POP_ASSUM MP_TAC) THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MOD_4_CASES [`j`;`p`]; + ASM_REWRITE_TAC[arith `p + 0 = p`] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[DIST_REFL]; + BY(TYPIFY `&1` EXISTS_TAC THEN MESON_TAC[arith `&0 <= &0 /\ &0 < &1`]); + TYPIFY `&1` EXISTS_TAC THEN REWRITE_TAC[arith `&0 < &1`]; + BY(ASM_MESON_TAC[arith `x < y ==> ~(x = y)`]); + FIRST_X_ASSUM_ST `scs_diag` (C INTRO_TAC [`p`;`p+2`]); + TYPIFY `scs_diag 4 p (p+2)` ENOUGH_TO_SHOW_TAC; + DISCH_THEN (unlist REWRITE_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `&1` EXISTS_TAC THEN REWRITE_TAC[arith `&0 < &1`]; + BY(ASM_MESON_TAC[arith `x < y ==> ~(x = y)`]); + REWRITE_TAC[arith `p+2 = SUC(SUC p)`]; + MATCH_MP_TAC Tfitskc.SCS_DIAG_2; + BY(NUM_REDUCE_TAC); + TYPIFY `e` EXISTS_TAC; + ASM_REWRITE_TAC[]; + DISCH_TAC; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `abs` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[DIST_SYM]; + DISCH_TAC; + DISCH_THEN (SUBST1_TAC o GSYM); + MATCH_MP_TAC (arith `(x = y) ==> x <= y`); + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM_ST `v (i MOD 4) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); + TYPIFY_GOAL_THEN `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` MATCH_MP_TAC; + BY(ASM_MESON_TAC[]); + nCONJ_TAC 2; + TYPIFY `~((p + 3) MOD 4 = (p+0) MOD 4)` ENOUGH_TO_SHOW_TAC; + BY(REWRITE_TAC[arith `p+0=p`]); + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + BY(NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[Terminal.MOD_4_EXPLICIT]); + BY(ASM_REWRITE_TAC[]); + COMMENT "now the b end"; + MATCH_MP_TAC Terminal.periodic2_mod_reduce; + TYPIFY `4` EXISTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC Cuxvzoz.MOD_periodic2; + BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[] THEN MESON_TAC[]); + TYPIFY `!j. j < 4 ==> (?e1. &0 < e1 /\ (dist (v p,v j) = scs_b_v39 s p j ==> (!t. abs t < e1 ==> dist (f (v p) t,f (v j) t) <= scs_b_v39 s p j)))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `i = ( p MOD 4)` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`j`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `scs_b_v39 s (p MOD 4) j = scs_b_v39 s p j ` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + TYPIFY `j = p MOD 4` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`i`]); + ASM_REWRITE_TAC[DIST_SYM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `scs_b_v39 s i (p MOD 4) = scs_b_v39 s i p ` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN MESON_TAC[]); + TYPIFY `&1` EXISTS_TAC; + REWRITE_TAC[arith `&0 < &1`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!w t. ~(w = v p) ==> f w t = w` ( (C FIRST_ASSUM_ST GMATCH_SIMP_TAC)); + TYPIFY `!w t. ~(w = v p) ==> f w t = w` ( (C FIRST_X_ASSUM_ST GMATCH_SIMP_TAC)); + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + nCONJ_TAC 2; + BY(FIRST_X_ASSUM (C INTRO_TAC [`i`;`j`]) THEN MESON_TAC[]); + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 20 (POP_ASSUM MP_TAC) THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MOD_4_CASES [`j`;`p`]; + ASM_REWRITE_TAC[arith `p + 0 = p`] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[DIST_REFL]; + BY(TYPIFY `&1` EXISTS_TAC THEN MESON_TAC[arith `&0 <= &0 /\ &0 < &1`]); + TYPIFY `e3` EXISTS_TAC THEN REWRITE_TAC[arith `&0 < &1`]; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY_GOAL_THEN `scs_b_v39 s p ((p + 1) MOD 4) = scs_b_v39 s p ((p + 1))` (unlist REWRITE_TAC); + BY(ASM_MESON_TAC[]); + TYPIFY `f (v(p+1)) t = v (p+1)` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + GMATCH_SIMP_TAC PERIODIC_INJ_MOD; + TYPIFY `4` EXISTS_TAC THEN ASM_REWRITE_TAC[]; + GEN_REWRITE_TAC (RAND_CONV o RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p + 0`]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + BY(NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[Terminal.MOD_4_EXPLICIT]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM_ST `scs_diag` (C INTRO_TAC [`p`;`p+2`]); + TYPIFY_GOAL_THEN `scs_diag 4 p (p+2)` (unlist REWRITE_TAC); + REWRITE_TAC[arith `p+2 = SUC(SUC p)`]; + MATCH_MP_TAC Tfitskc.SCS_DIAG_2; + BY(NUM_REDUCE_TAC); + TYPIFY `dist(v p,v (p+2)) <= &4 * h0` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[arith `x <= y /\ y < z ==> ~(x = z)`]); + INTRO_TAC DIST_TRIANGLE [`v p`;`(vec 0):real^3`;`v (p+2)`]; + REWRITE_TAC[DIST_0]; + TYPIFY `!i. norm (v i) <= &2 * h0` ENOUGH_TO_SHOW_TAC; + BY(DISCH_TAC THEN FIRST_ASSUM (C INTRO_TAC [`p`]) THEN FIRST_X_ASSUM (C INTRO_TAC [`p+2`]) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + BY(FIRST_X_ASSUM_ST `ball_annulus` MP_TAC THEN REWRITE_TAC[Terminal.IMAGE_SUBSET_IN;IN_UNIV] THEN MESON_TAC[Fnjlbxs.in_ball_annulus]); + TYPIFY `e` EXISTS_TAC; + ASM_REWRITE_TAC[]; + DISCH_TAC; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `abs` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[DIST_SYM]; + DISCH_TAC; + DISCH_THEN (SUBST1_TAC o GSYM); + MATCH_MP_TAC (arith `(x = y) ==> x <= y`); + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM_ST `v (i MOD 4) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); + TYPIFY_GOAL_THEN `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` MATCH_MP_TAC; + BY(ASM_MESON_TAC[]); + nCONJ_TAC 2; + TYPIFY `~((p + 3) MOD 4 = (p+0) MOD 4)` ENOUGH_TO_SHOW_TAC; + BY(REWRITE_TAC[arith `p+0=p`]); + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + BY(NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[Terminal.MOD_4_EXPLICIT]); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let ab4_assumption_reduction_sym = prove_by_refinement( + `!s p f v e. + is_scs_v39 s /\ + scs_k_v39 s = 4 /\ + BBs_v39 s v /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j < dist(v i,v j) /\ &4 * h0 < scs_b_v39 s i j) /\ + deformation f (IMAGE v (:num)) (--e,e) /\ + &0 < e /\ + (!w t. ~(w = v (p+1)) ==> (f w t = w)) /\ + (!t. abs t < e ==> dist (f (v (p + 1)) t ,(v (p+2))) = dist (v (p + 1),v (p+2))) /\ + scs_a_v39 s p (p + 1) < dist (v p,v (p + 1)) /\ dist (v p,v (p + 1)) < scs_b_v39 s p (p + 1) + ==> + (!i j. ?e1. &0 < e1 /\ (scs_a_v39 s i j = dist(v i,v j) ==> + (!t. abs t < e1 ==> scs_a_v39 s i j <= dist(f (v i) t,f (v j) t)))) /\ + (!i j. + ?e2. &0 < e2 /\ + (dist (v i,v j) = scs_b_v39 s i j + ==> (!t. abs t < e2 + ==> dist (f (v i) t,f (v j) t) <= scs_b_v39 s i j))) + `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASSUME_TAC (arith `~(4 = 0)`); + TYPIFY `!i j.scs_a_v39 s (i MOD 4) (j MOD 4) = scs_a_v39 s i j /\ scs_b_v39 s (i MOD 4) (j MOD 4) = scs_b_v39 s i j ` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC; + ASM_REWRITE_TAC[Appendix.is_scs_v39]; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[Cuxvzoz.periodic2_MOD]); + TYPIFY `!i. i MOD 4 < 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION]); + TYPIFY `periodic v 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN ASM_REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN MESON_TAC[]); + TYPIFY `!i. v (i MOD 4) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[]); + INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`4`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[]); + TYPIFY `!j. j < 4 ==> (j MOD 4 = j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[MOD_LT]); + TYPIFY `!t. f (v (p+0)) t = v(p+0) /\ f (v (p+2)) t = v(p+2) /\ f (v (p+3)) t = v(p+3)` (C SUBGOAL_THEN MP_TAC); + GEN_TAC THEN (FIRST_X_ASSUM_ST `~(w = v (p+1)) ==> a` (REPEAT o GMATCH_SIMP_TAC)); + INTRO_TAC PERIODIC_INJ_MOD [`v`;`4`]; + ASM_REWRITE_TAC[arith `~(4=0)`]; + DISCH_TAC THEN ASM_REWRITE_TAC[]; + REPEAT ( GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT); + BY(NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[Terminal.MOD_4_EXPLICIT]); + DISCH_TAC; + COMMENT "scs_a_v39"; + CONJ_TAC; + MATCH_MP_TAC Terminal.periodic2_mod_reduce; + TYPIFY `4` EXISTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC Cuxvzoz.MOD_periodic2; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!j. j < 4 ==> (?e1. &0 < e1 /\ (scs_a_v39 s (p+1) j = dist (v (p+1),v j) ==> (!t. abs t < e1 ==> scs_a_v39 s (p+1) j <= dist (f (v (p+1)) t,f (v j) t))))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `i = ( (p+1) MOD 4)` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`j`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `scs_a_v39 s ((p+1) MOD 4) j = scs_a_v39 s (p+1) j ` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 14 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + TYPIFY `j = (p+1) MOD 4` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`i`]); + ASM_REWRITE_TAC[DIST_SYM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `scs_a_v39 s i ((p+1) MOD 4) = scs_a_v39 s i (p+1) ` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 14 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN MESON_TAC[]); + TYPIFY `&1` EXISTS_TAC; + REWRITE_TAC[arith `&0 < &1`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!w t. ~(w = v (p+1)) ==> f w t = w` ( (C FIRST_ASSUM_ST GMATCH_SIMP_TAC)); + TYPIFY `!w t. ~(w = v (p+1)) ==> f w t = w` ( (C FIRST_X_ASSUM_ST GMATCH_SIMP_TAC)); + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + nCONJ_TAC 2; + BY(FIRST_X_ASSUM (C INTRO_TAC [`i`;`j`]) THEN MESON_TAC[]); + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 20 (POP_ASSUM MP_TAC) THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MOD_4_CASES [`j`;`(p+1)`]; + ASM_REWRITE_TAC[arith `p + 0 = p /\ (p+1)+j = p+(1+j)`] THEN NUM_REDUCE_TAC; + TYPIFY `(p+4) MOD 4 = p MOD 4` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[Oxl_2012.MOD_ADD_CANCEL]); + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[DIST_REFL]; + BY(TYPIFY `&1` EXISTS_TAC THEN MESON_TAC[arith `&0 <= &0 /\ &0 < &1`]); + TYPIFY `e` EXISTS_TAC THEN REWRITE_TAC[]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`t`]); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `scs_diag` (C INTRO_TAC [`p+1`;`p+3`]); + TYPIFY `scs_diag 4 (p+1) (p+3)` ENOUGH_TO_SHOW_TAC; + DISCH_THEN (unlist REWRITE_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `&1` EXISTS_TAC THEN REWRITE_TAC[arith `&0 < &1`]; + BY(ASM_MESON_TAC[arith `x < y ==> ~(x = y)`]); + REWRITE_TAC[arith `p+3 = SUC(SUC (p+1))`]; + MATCH_MP_TAC Tfitskc.SCS_DIAG_2; + BY(NUM_REDUCE_TAC); + TYPIFY `&1` EXISTS_TAC; + TYPIFY `scs_a_v39 s (p+1) (p MOD 4) = scs_a_v39 s p (p+1)` ENOUGH_TO_SHOW_TAC; + DISCH_THEN (unlist REWRITE_TAC); + REWRITE_TAC[arith `&0 < &1`]; + BY(FIRST_X_ASSUM_ST `scs_a_v39 s p (p+1) < d` MP_TAC THEN REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); + BY(FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN ASM_MESON_TAC[]); + COMMENT "now the b end"; + MATCH_MP_TAC Terminal.periodic2_mod_reduce; + TYPIFY `4` EXISTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC Cuxvzoz.MOD_periodic2; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!j. j < 4 ==> (?e1. &0 < e1 /\ (dist (v (p+1),v j) = scs_b_v39 s (p+1) j ==> (!t. abs t < e1 ==> dist (f (v (p+1)) t,f (v j) t) <= scs_b_v39 s (p+1) j)))` ENOUGH_TO_SHOW_TAC; + (REPEAT WEAKER_STRIP_TAC); + TYPIFY `i = ( (p+1) MOD 4)` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`j`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `scs_b_v39 s ((p+1) MOD 4) j = scs_b_v39 s (p+1) j ` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 14 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + TYPIFY `j = (p+1) MOD 4` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`i`]); + ASM_REWRITE_TAC[DIST_SYM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `scs_b_v39 s i ((p+1) MOD 4) = scs_b_v39 s i (p+1) ` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 14 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN MESON_TAC[]); + TYPIFY `&1` EXISTS_TAC; + REWRITE_TAC[arith `&0 < &1`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!w t. ~(w = v (p+1)) ==> f w t = w` ( (C FIRST_ASSUM_ST GMATCH_SIMP_TAC)); + TYPIFY `!w t. ~(w = v (p+1)) ==> f w t = w` ( (C FIRST_X_ASSUM_ST GMATCH_SIMP_TAC)); + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + nCONJ_TAC 2; + BY(FIRST_X_ASSUM (C INTRO_TAC [`i`;`j`]) THEN MESON_TAC[]); + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 20 (POP_ASSUM MP_TAC) THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MOD_4_CASES [`j`;`p+1`]; + ASM_REWRITE_TAC[arith `p + 0 = p /\ (p+1)+j = p+(1+j)`] THEN NUM_REDUCE_TAC; + TYPIFY `(p+4) MOD 4 = p MOD 4` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[Oxl_2012.MOD_ADD_CANCEL]); + ASM_REWRITE_TAC[arith `p + 0 = p`] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[DIST_REFL]; + BY(TYPIFY `&1` EXISTS_TAC THEN MESON_TAC[arith `&0 <= &0 /\ &0 < &1`]); + TYPIFY `e` EXISTS_TAC THEN ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[arith `x = y ==> x <= y`]); + FIRST_X_ASSUM_ST `scs_diag` (C INTRO_TAC [`p+1`;`p+3`]); + TYPIFY_GOAL_THEN `scs_diag 4 (p+1) (p+3)` (unlist REWRITE_TAC); + REWRITE_TAC[arith `p+3 = SUC(SUC (p+1))`]; + MATCH_MP_TAC Tfitskc.SCS_DIAG_2; + BY(NUM_REDUCE_TAC); + TYPIFY `dist(v (p+1),v (p+3)) <= &4 * h0` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[arith `x <= y /\ y < z ==> ~(x = z)`]); + INTRO_TAC DIST_TRIANGLE [`v (p+1)`;`(vec 0):real^3`;`v (p+3)`]; + REWRITE_TAC[DIST_0]; + TYPIFY `!i. norm (v i) <= &2 * h0` ENOUGH_TO_SHOW_TAC; + BY(DISCH_TAC THEN FIRST_ASSUM (C INTRO_TAC [`p+1`]) THEN FIRST_X_ASSUM (C INTRO_TAC [`p+3`]) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + BY(FIRST_X_ASSUM_ST `ball_annulus` MP_TAC THEN REWRITE_TAC[Terminal.IMAGE_SUBSET_IN;IN_UNIV] THEN MESON_TAC[Fnjlbxs.in_ball_annulus]); + TYPIFY `&1` EXISTS_TAC THEN REWRITE_TAC[arith `&0 < &1`]; + FIRST_X_ASSUM_ST `dist (v p,v (p + 1)) < scs_b_v39 s p (p + 1)` MP_TAC THEN REWRITE_TAC[DIST_SYM]; + TYPIFY `scs_b_v39 s (p + 1) (p MOD 4) = scs_b_v39 s p (p+1)` ENOUGH_TO_SHOW_TAC; + BY(REAL_ARITH_TAC); + BY(FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39] THEN ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let deform_azim_sum = prove_by_refinement( + `!v1 v2 v3 v4 f e. deformation f {v1,v2,v3,v4} (--e,e) /\ + &0 < azim (vec 0) v1 v2 v4 /\ azim (vec 0) v1 v2 v4 < pi /\ + ~collinear {vec 0,v1,v2} /\ ~collinear {vec 0,v1,v3} /\ ~collinear {vec 0,v1,v4} /\ + azim (vec 0) v1 v2 v3 + azim (vec 0) v1 v3 v4 = azim (vec 0) v1 v2 v4 /\ + (((!t. (azim (vec 0) (f v1 t) (f v2 t) (f v3 t) = azim (vec 0) v1 v2 v3)) /\ + (&0 < azim (vec 0) v1 v3 v4 /\ azim (vec 0) v1 v3 v4 < pi)) \/ + ((!t. (azim (vec 0) (f v1 t) (f v3 t) (f v4 t) = azim (vec 0) v1 v3 v4)) /\ + (&0 < azim (vec 0) v1 v2 v3 /\ azim (vec 0) v1 v2 v3 < pi))) ==> + (?e1. &0 < e1 /\ + (!t. abs t < e1 ==> + ~collinear {vec 0,(f v1 t),(f v2 t)} /\ + ~collinear {vec 0,(f v1 t),(f v3 t)} /\ + ~collinear {vec 0,(f v1 t),(f v4 t)} /\ + azim (vec 0) (f v1 t) (f v2 t) (f v3 t) + + azim (vec 0) (f v1 t) (f v3 t) (f v4 t) = azim (vec 0) (f v1 t) (f v2 t) (f v4 t))) + `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GEN_ALL Local_lemmas1.CONTINUOUS_PRESERVE_COLLINEAR) [`&0`;`(vec 0):real^3`;`f v1`]; + DISCH_TAC; + FIRST_ASSUM (C INTRO_TAC [`f v2`]); + FIRST_ASSUM (C INTRO_TAC [`f v3`]); + FIRST_X_ASSUM (C INTRO_TAC [`f v4`]); + FIRST_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation;IN_INSERT;NOT_IN_EMPTY]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `f v1 continuous atreal (&0) /\ f v2 continuous atreal (&0) /\ f v3 continuous atreal (&0) /\ f v4 continuous atreal (&0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[]); + TYPIFY `f v1 (&0) = v1 /\ f v2 (&0) = v2 /\ f v4 (&0) = v4 /\ f v3 (&0) = v3` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[]); + REPLICATE_TAC 3 (FIRST_X_ASSUM_ST `collinear` MP_TAC) THEN ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `abs(&0 - r) = abs r`]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Cuxvzoz.epsilon_triple [`e'`;`e''`;`e'''`]; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Cuxvzoz.WNWSHJT_ALT [`v4`;`v1`;`v2`;`f`;`-- e`;`e`;`pi`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + MATCH_MP_TAC Zlzthic.deformation_subset; + BY(TYPIFY `{v1,v2,v3,v4}` EXISTS_TAC THEN ASM_REWRITE_TAC[] THEN SET_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?e1. &0 < e1 /\ (!t. abs t < e1 ==> azim (vec 0) (f v1 t) (f v2 t) (f v3 t) + azim (vec 0) (f v1 t) (f v3 t) (f v4 t) < &2 * pi)` (C SUBGOAL_THEN MP_TAC); + TYPIFY `(!t. azim (vec 0) (f v1 t) (f v2 t) (f v3 t) = azim (vec 0) v1 v2 v3) /\ &0 < azim (vec 0) v1 v3 v4 /\ azim (vec 0) v1 v3 v4 < pi` ASM_CASES_TAC; + INTRO_TAC Cuxvzoz.WNWSHJT_ALT [`v4`;`v1`;`v3`;`f`;`-- e`;`e`;`pi - azim (vec 0) v1 v2 v3`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + CONJ_TAC; + MATCH_MP_TAC Zlzthic.deformation_subset; + BY(TYPIFY `{v1,v2,v3,v4}` EXISTS_TAC THEN ASM_REWRITE_TAC[] THEN SET_TAC[]); + BY(ASM_REWRITE_TAC[arith `a < p - b <=> b + a < p`]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''''''` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[]; + BY(MP_TAC PI_POS THEN REAL_ARITH_TAC); + TYPIFY `(!t. azim (vec 0) (f v1 t) (f v3 t) (f v4 t) = azim (vec 0) v1 v3 v4) /\ &0 < azim (vec 0) v1 v2 v3 /\ azim (vec 0) v1 v2 v3 < pi` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Cuxvzoz.WNWSHJT_ALT [`v3`;`v1`;`v2`;`f`;`-- e`;`e`;`pi - azim (vec 0) v1 v3 v4`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + CONJ_TAC; + MATCH_MP_TAC Zlzthic.deformation_subset; + BY(TYPIFY `{v1,v2,v3,v4}` EXISTS_TAC THEN ASM_REWRITE_TAC[] THEN SET_TAC[]); + BY(ASM_REWRITE_TAC[arith `a < p - b <=> a + b < p`]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''''''` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[]; + BY(MP_TAC PI_POS THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Cuxvzoz.epsilon_triple [`e''''`;`e'''''`;`e1`]; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''''''` EXISTS_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + REWRITE_TAC[CONJ_ASSOC] THEN CONJ_TAC; + BY(REPEAT CONJ_TAC THEN (REPEAT (FIRST_X_ASSUM MATCH_MP_TAC)) THEN ASM_REWRITE_TAC[]); + MATCH_MP_TAC Fan.sum3_azim_fan; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); + BY(REPEAT CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let NEHXMWH = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (!s FF v p. + IMAGE (\i. (v i,v (SUC i))) (:num) = FF /\ + is_scs_v39 s /\ + scs_k_v39 s = 4 /\ + MMs_v39 s v /\ + scs_basic_v39 s /\ + scs_generic v /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4 * h0 < scs_b_v39 s i j) /\ + (!i. ~(i MOD 4 = (p+2) MOD 4) ==> interior_angle1 (vec 0) FF (v i) < pi) + ==> (dist(v p,v(p+1)) = scs_a_v39 s p (p+1) \/ dist(v p,v(p+1)) = scs_b_v39 s p (p+1)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `BBprime2_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.scs_basic;Ayqjtmd.unadorned_MMs]); + TYPIFY `BBprime_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime2_v39]); + TYPIFY `BBs_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime_v39]); + INTRO_TAC Appendix.BBs_v39 [`s`;`v`]; + ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;Terminal.IMAGE_SUBSET_IN;IN_UNIV;arith `~(4 <= 3)`]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `V = IMAGE v (:num)`; + TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + EXPAND_TAC "V"; + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`4`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!i. interior_angle1 (vec 0) FF (v i) = azim (vec 0) (v i) (v (i+1)) (v (i+3))` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + EXPAND_TAC "FF"; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] (GSYM Ocbicby.INTERIOR_ANGLE1_AZIM)); + TYPIFY `s` EXISTS_TAC; + BY(ASM_REWRITE_TAC[IN;arith `4 - 1 = 3`;arith `3 < 4`;arith `SUC i = i+1`]); + INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`]; + ASM_REWRITE_TAC[LET_THM;IN;arith `4-1 = 3`;arith `SUC i = i+1`]; + DISCH_TAC; + TYPIFY `!i. v (i MOD 4) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[arith `~(0=4)`]); + TYPIFY `v 4 = v 0 /\ v 5 = v 1 /\ v 6 = v 2 /\ v 7 = v 3 /\ v 8 = v 4` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM ((unlist ONCE_REWRITE_TAC) o GSYM); + BY(REWRITE_TAC[Terminal.MOD_4_EXPLICIT;arith `7 = 1*4 + 3`;arith `8 = 2*4 + 0`;MOD_MULT_ADD]); + TYPIFY `generic V E` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `scs_generic` MP_TAC THEN ASM_REWRITE_TAC[Appendix.scs_generic]); + TYPIFY `v (p+4) = v p /\ v (p+5) = v (p+1) /\ v (p+6) = v (p+2) /\ v (p+7) = v (p+3) /\ v (p+8) = v (p)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `MOD` ((unlist ONCE_REWRITE_TAC) o GSYM); + BY(REWRITE_TAC[arith `p+4 = 1*4 + p /\ p+5 = 1*4+(p+1) /\ p+6=1*4+(p+2) /\ p+7 = 1*4 + (p+3) /\ p+8 = 2*4 + p`;MOD_MULT_ADD]); + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`4`;`p+3`;`2`;`3`]; + REWRITE_TAC[arith `SUC (x+k) = (x+k)+1`;arith `((p:num)+i)+j = p+(i+j)`]; + NUM_REDUCE_TAC; + ASM_REWRITE_TAC[LET_THM]; + DISCH_TAC; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`4`;`p+1`;`2`;`3`]; + REWRITE_TAC[arith `SUC (x+k) = (x+k)+1`;arith `((p:num)+i)+j = p+(i+j)`]; + NUM_REDUCE_TAC; + ASM_REWRITE_TAC[LET_THM]; + DISCH_TAC; + COMMENT "collinearity"; + TYPIFY `!i j. ~(v i = v j) ==> ~collinear {vec 0,v i, v j}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT GEN_TAC THEN DISCH_TAC; + MATCH_MP_TAC Zlzthic.PROPERTIES_GENERIC_LOCAL_FAN_ALT; + GEXISTL_TAC [`V`;`E`;`FF`]; + BY(ASM_REWRITE_TAC[IN_IMAGE;IN_UNIV]); + TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + INTRO_TAC PERIODIC_INJ_MOD [`v`;`4`]; + ASM_REWRITE_TAC[arith `~(4 = 0)`]; + DISCH_TAC; + TYPIFY `azim (vec 0) (v p) (v (p+1)) (v (p+3)) < pi` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); + FIRST_X_ASSUM MATCH_MP_TAC; + GEN_REWRITE_TAC(RAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[arith`p = p+0`]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + BY(NUM_REDUCE_TAC); + TYPIFY `~coplanar {vec 0,v p,v (p+1),v (p+3)}` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; + MATCH_MP_TAC (arith `&0 < x /\ x < pi ==> ~ ((x = &0) \/ (x = pi))`); + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i a b. a < 4 /\ b < 4 /\ ~(a = b) ==> ~collinear {vec 0,v(i+a),v(i+b)}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[]; + FIRST_X_ASSUM_ST `v (i MOD 4) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); + REPEAT (FIRST_X_ASSUM MATCH_MP_TAC); + nCONJ_TAC 2; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + NUM_REDUCE_TAC; + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION;MOD_LT;arith `~(4=0)`]); + ASM_REWRITE_TAC[]; + BY(MESON_TAC[DIVISION;arith `~(4=0)`]); + COMMENT "introduce deformation"; + INTRO_TAC Cuxvzoz.deform_simplex_edge_exists [`V`;`(\ (t:real). &0)`;`(\(t:real). t)`;`v (p +3)`;`v p`;`v (p +1)`;`&1`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ANTS_TAC; + REWRITE_TAC[arith `&0 < &1`]; + SUBCONJ_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d}={a,c,d,b}`]; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + CONJ_TAC; + INTRO_TAC Planarity.cross_dot_fully_surrounded_fan [`(vec 0):real^3`;`v p`;`v (p+3)`;`v(p+1)`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + INTRO_TAC Planarity.notcoplanar_imp_notcollinear_fan [`(vec 0):real^3`;`v p`;`v (p+1)`;`v(p+3)`]; + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + MATCH_MP_TAC (arith `x = y ==> (&0 < x ==> y > &0)`); + BY(VEC3_TAC); + REPEAT ( GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT); + REWRITE_TAC[Ocbicby.REAL_OPEN_REAL_INTERVAL]; + BY(REWRITE_TAC[REAL_CONTINUOUS_CONST;REAL_CONTINUOUS_AT_ID]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(scs_a_v39 s p (p+1) < dist(v p,v (p+1)) /\ dist(v p,v (p+1)) < scs_b_v39 s p (p+1))` ENOUGH_TO_SHOW_TAC; + FIRST_X_ASSUM_ST `scs_a_v39` (C INTRO_TAC [`p`;`(p+1)`]); + BY(REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `(!i t. abs t < e' ==> norm (f (v i) t) = norm (v i))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `v i = v p` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]); + BY(ASM_REWRITE_TAC[] THEN MESON_TAC[]); + FIRST_X_ASSUM GMATCH_SIMP_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. 0 < i /\ i < 4 ==> ~(v (p + i) = v p)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[]; + GEN_REWRITE_TAC (RAND_CONV o RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + NUM_REDUCE_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION;MOD_LT;arith `~(4=0)`;arith `0 < i ==> ~(i=0)`]); + TYPIFY `!i j (k:num). v i = v j ==> v (i+k) = v (j+k)` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[arith `(i:num) + k = k + i`]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + BY(ASM_REWRITE_TAC[arith `~(4 = 0)`]); + TYPIFY `!t. azim (vec 0) (f (v (p+2)) t) (f (v (p+3)) t) (f (v (p+1)) t) = azim(vec 0) (v(p+2)) (v(p+3)) (v(p+1))` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + FIRST_X_ASSUM_ST `~(w = v p) ==> a` (REPEAT o GMATCH_SIMP_TAC); + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + TYPIFY `!i. azim (vec 0) (v i) (v (i+1)) (v (i+3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); + MATCH_MP_TAC Local_lemmas.CONVEX_LOFA_IMP_INANGLE_LE_PI; + BY(ASM_REWRITE_TAC[]); + TYPIFY `(!i. ?e0. &0 < e0 /\ (azim (vec 0) (v i) (v (i + 1)) (v (i + 3)) = pi ==> (!t. abs t < e0 ==> azim (vec 0) (f (v i) t) (f (v (i + 1)) t) (f (v (i + 3)) t) <= pi)))` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + TYPIFY `v i = v (p+2)` ASM_CASES_TAC; + FIRST_ASSUM (fun t -> FIRST_X_ASSUM (ASSUME_TAC o (C MATCH_MP t))); + TYPIFY `&1` EXISTS_TAC; + ASM_REWRITE_TAC[arith `&0 < &1`;arith `(p+2)+k = p + (2+k)`]; + NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + TYPIFY `azim (vec 0) (v i) (v (i + 1)) (v (i + 3)) < pi` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[arith `x < pi ==> ~(x = pi)`;arith `&0 < &1`]); + BY(ASM_MESON_TAC[]); + (COMMENT "deformation in BBs"); + INTRO_TAC Cuxvzoz.deformation_BBs_ALT [`s`;`4`;`f`;`v`;`e'`]; + ANTS_TAC; + NUM_REDUCE_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC ab4_assumption_reduction; + GEXISTL_TAC [`p`;`e'`]; + ASM_REWRITE_TAC[]; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `scs_diag` (C INTRO_TAC [`i`;`j`]); + BY(ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + (FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`])); + BY(ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + (REPEAT WEAKER_STRIP_TAC); + COMMENT "azim sums"; + INTRO_TAC deform_azim_sum [`v (p+3)`;`v p`;`v (p+1)`;`v(p+2)`;`f`;`e'`]; + ANTS_TAC; + REPEAT (FIRST_X_ASSUM_ST `c = a + b` MP_TAC) THEN ASM_REWRITE_TAC[]; + REPLICATE_TAC 3 DISCH_TAC; + CONJ_TAC; + MATCH_MP_TAC Zlzthic.deformation_subset; + (TYPIFY `V` EXISTS_TAC THEN ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]); + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `~collinear {vec 0, v (p + 3), v (p+0)} /\ ~collinear {vec 0, v (p + 3), v (p + 1)} /\ ~collinear {vec 0, v (p + 3), v (p + 2)}` (C SUBGOAL_THEN MP_TAC); + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN (unlist REWRITE_TAC); + nCONJ_TAC 2; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM (SUBST1_TAC) THEN REWRITE_TAC[]; + REPLICATE_TAC 4 (FIRST_X_ASSUM kill); + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `&0 < azim (vec 0) (v (p + 3)) (v p) (v (p + 2)) /\ azim (vec 0) (v (p + 3)) (v p) (v (p + 2)) < pi` (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `&0 < azim a b c d` (C INTRO_TAC [`p+3`]); + TYPIFY `azim (vec 0) (v (p+3)) (v p) (v (p+2)) = azim (vec 0) (v (p + 3)) (v ((p + 3) + 1)) (v ((p + 3) + 3))` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[arith `((p:num) + i) + j = p + i+j`] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + BY(NUM_REDUCE_TAC); + DISJ2_TAC; + CONJ_TAC; + GEN_TAC; + FIRST_X_ASSUM_ST `~(w = v p) ==> a` (REPEAT o GMATCH_SIMP_TAC); + ASM_REWRITE_TAC[]; + BY(REPEAT CONJ_TAC THEN GEN_REWRITE_TAC (RAND_CONV o RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`] THEN GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC); + REWRITE_TAC[Zlzthic.azim_lt_pi_cross]; + TYPIFY `(v (p + 3) cross v p) dot v (p + 1) = (v (p) cross (v (p+1))) dot v (p + 3)` (C SUBGOAL_THEN SUBST1_TAC); + BY(VEC3_TAC); + REWRITE_TAC[GSYM Zlzthic.azim_lt_pi_cross]; + BY(ASM_REWRITE_TAC[]); + (REPEAT WEAKER_STRIP_TAC); + COMMENT "second azim sum"; + INTRO_TAC deform_azim_sum [`v (p+1)`;`v (p+2)`;`v (p+3)`;`v(p)`;`f`;`e'`]; + ANTS_TAC; + REPEAT (FIRST_X_ASSUM_ST `c = a + b` MP_TAC) THEN ASM_REWRITE_TAC[]; + REPLICATE_TAC 3 DISCH_TAC; + CONJ_TAC; + MATCH_MP_TAC Zlzthic.deformation_subset; + (TYPIFY `V` EXISTS_TAC THEN ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]); + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `~collinear {vec 0, v (p + 1), v (p + 2)} /\ ~collinear {vec 0, v (p + 1), v (p + 3)} /\ ~collinear {vec 0, v (p + 1), v (p + 0)}` (C SUBGOAL_THEN MP_TAC); + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN (unlist REWRITE_TAC); + nCONJ_TAC 2; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM (SUBST1_TAC) THEN REWRITE_TAC[]; + REPLICATE_TAC 4 (FIRST_X_ASSUM kill); + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `&0 < azim (vec 0) (v (p + 1)) (v (p + 2)) (v p) /\ azim (vec 0) (v (p + 1)) (v (p + 2)) (v p) < pi` (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `&0 < azim a b c d` (C INTRO_TAC [`p+1`]); + TYPIFY `azim (vec 0) (v (p+1)) (v (p+2)) (v (p)) = azim (vec 0) (v (p + 1)) (v ((p + 1) + 1)) (v ((p + 1) + 3))` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[arith `((p:num) + i) + j = p + i+j`] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + BY(NUM_REDUCE_TAC); + DISJ1_TAC; + CONJ_TAC; + GEN_TAC; + FIRST_X_ASSUM_ST `~(w = v p) ==> a` (REPEAT o GMATCH_SIMP_TAC); + ASM_REWRITE_TAC[]; + BY(REPEAT CONJ_TAC THEN GEN_REWRITE_TAC (RAND_CONV o RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`] THEN GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC); + REWRITE_TAC[Zlzthic.azim_lt_pi_cross]; + TYPIFY `(v (p + 1) cross v (p+3)) dot v (p) = (v (p) cross (v (p+1))) dot v (p + 3)` (C SUBGOAL_THEN SUBST1_TAC); + BY(VEC3_TAC); + REWRITE_TAC[GSYM Zlzthic.azim_lt_pi_cross]; + BY(ASM_REWRITE_TAC[]); + (REPEAT WEAKER_STRIP_TAC); + TYPIFY `?e3. &0 < e3 /\ (!t. abs t < e3 ==> dist(v p,v (p+1)) + t IN real_interval(scs_a_v39 s p (p+1),scs_b_v39 s p (p+1)))` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC Zlzthic.real_interval_contains_0_ball [`scs_a_v39 s p (p+1)-dist(v p,v (p+1))`;`scs_b_v39 s p (p+1) - dist(v p,v (p+1))`;`&1`]; + ASM_REWRITE_TAC[arith `&0 < &1`;arith `a - d < &0 <=> a < d`;arith `&0 < b - d <=> d < b`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[IN_REAL_INTERVAL]; + BY(REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + COMMENT "coplanar"; + INTRO_TAC Zlzthic.NONPLANAR_OPEN [`(\ (t:real). (vec 0):real^3)`;`f (v p)`;`\ (t:real). v (p+1)`;`\ (t:real). v (p+3)`;`&0`]; + ASM_REWRITE_TAC[CONTINUOUS_CONST]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation] THEN REPEAT WEAKER_STRIP_TAC; + CONJ2_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + POP_ASSUM GMATCH_SIMP_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[arith `abs (&0 - t') = abs t'`] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Zlzthic.WNWSHJT [`v(p+3)`;`v p`;`v (p+1)`;`f`;`-- e'`;`e'`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC Zlzthic.deformation_subset; + (TYPIFY `V` EXISTS_TAC THEN ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]); + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (REPEAT o GMATCH_SIMP_TAC) THEN ASM_REWRITE_TAC[]; + TYPIFY `!i. ~(i=0) /\ i < 4 ==> ~collinear {vec 0,v (p+0),v(p+i)}` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[arith `p+0=p` ;arith `~(1=0) /\ 1 < 4 /\ ~(3=0) /\ 3 < 4`]); + GEN_TAC THEN DISCH_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `0 < 4`]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "introduce 1834"; + INTRO_TAC Iunbuig.epsilon_hept [`e`;`e'`;`e''`;`e'''`;`e3`;`e1`;`e1'`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_ASSUM_ST `!i. 0 < i /\ i < 4 ==> ~(v (p + i) = v p)` MP_TAC; + FIRST_ASSUM_ST `i MOD 4 = j MOD 4` (unlist REWRITE_TAC); + DISCH_TAC; + INTRO_TAC (UNDISCH Ocbicby.LEMMA_1834976363) [`norm (v (p+3))`;`norm (v p)`;`norm (v (p+1))`;`dist(v p,v(p+1))`;`dist (v(p+1),v(p+3))`;`dist(v p,v (p+3))`;`dist(v p,v (p+1)) - e7`;`dist(v p,v(p+1)) + e7`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + (COMMENT "1834 ants"); + COMMENT "restart"; + TYPIFY `!i. &2 <= norm (v i) /\ norm (v i) <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + REWRITE_TAC[GSYM Fnjlbxs.in_ball_annulus]; + FIRST_X_ASSUM_ST `BBs_v39` kill THEN FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN EXPAND_TAC "V" THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `ball_annulus` MP_TAC; + REWRITE_TAC[SUBSET;IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + ASM_REWRITE_TAC[]; + FIRST_ASSUM_ST `collinear` (C INTRO_TAC [`p`;`3`;`0`]); + FIRST_X_ASSUM_ST `collinear` (C INTRO_TAC [`p`;`3`;`1`]); + NUM_REDUCE_TAC; + REWRITE_TAC[arith `p + 0 = p`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY_GOAL_THEN `&0 < ups_x (norm (v (p + 3)) * norm (v (p + 3))) (norm (v p) * norm (v p)) (dist (v p,v (p + 3)) * dist (v p,v (p + 3))) /\ &0 < ups_x (norm (v (p + 3)) * norm (v (p + 3))) (norm (v (p + 1)) * norm (v (p + 1))) (dist (v (p + 1),v (p + 3)) * dist (v (p + 1),v (p + 3)))` (unlist REWRITE_TAC); + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS;DIST_0;DIST_SYM;arith`x pow 2 = x*x`]; + BY(MESON_TAC[]); + TYPIFY `!i j. &2 <= dist(v i,v j) ==> (&2 / h0) pow 2 <= xrr (norm(v i)) (norm(v (j))) (dist (v i,v j))` ((C SUBGOAL_THEN ASSUME_TAC)); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Ocbicby.xrr_simple_lower_bound; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + CONJ_TAC; + POP_ASSUM MATCH_MP_TAC; + MATCH_MP_TAC Ocbicby.scs_lb_2; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(NUM_REDUCE_TAC); + CONJ_TAC; + TYPIFY `#15.53 = sqrt(#15.53) pow 2` (C SUBGOAL_THEN SUBST1_TAC); + GMATCH_SIMP_TAC SQRT_POW_2; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC Ocbicby.xrr_simple_upper_bound; + ASM_REWRITE_TAC[]; + TYPIFY `&4 = sqrt(&16)` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[arith `&16 = &4 pow 2`]; + REWRITE_TAC[POW_2_SQRT_ABS]; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC SQRT_MONO_LT_EQ; + TYPIFY_GOAL_THEN `&0 <= #15.53 /\ &0 < &16 /\ #15.53 < &16` (unlist REWRITE_TAC); + BY(REAL_ARITH_TAC); + CONJ_TAC; + BY(REAL_ARITH_TAC); + CONJ_TAC; + MATCH_MP_TAC Ocbicby.scs_lb_2; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(NUM_REDUCE_TAC); + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `cstab` EXISTS_TAC; + CONJ_TAC; + MATCH_MP_TAC (arith `d <= scs_b_v39 s p (p+1) /\ scs_b_v39 s p (p+1) <= cstab ==> d <= cstab`); + CONJ_TAC; + FIRST_X_ASSUM_ST `BBs_v39` kill; + (FIRST_X_ASSUM_ST `BBs_v39` MP_TAC) THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM]; + BY(MESON_TAC[]); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39]; + ASM_REWRITE_TAC[arith `3 < 4`;arith `SUC i = i+1`]; + BY(MESON_TAC[]); + REWRITE_TAC[Sphere.cstab]; + MATCH_MP_TAC REAL_LE_RSQRT; + BY(REAL_ARITH_TAC); + CONJ_TAC; + ONCE_REWRITE_TAC[DIST_SYM]; + FIRST_X_ASSUM MATCH_MP_TAC; + MATCH_MP_TAC Ocbicby.scs_lb_2; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[]; + BY(GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC); + CONJ_TAC; + ONCE_REWRITE_TAC[DIST_SYM]; + FIRST_X_ASSUM MATCH_MP_TAC; + MATCH_MP_TAC Ocbicby.scs_lb_2; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + CONJ_TAC; + REWRITE_TAC[IN_REAL_INTERVAL]; + BY(FIRST_X_ASSUM_ST `&0 < e` MP_TAC THEN REAL_ARITH_TAC); + CONJ_TAC; + REWRITE_TAC[SUBSET;IN_REAL_INTERVAL;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?t. abs t < e7 /\ x = dist(v p,v(p+1)) + t` (C SUBGOAL_THEN MP_TAC); + TYPIFY `x - dist(v p,v(p+1))` EXISTS_TAC; + CONJ2_TAC; + BY(REAL_ARITH_TAC); + BY(REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `norm (f (v p) t) = norm (v p)` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); + REWRITE_TAC[DIST_SYM] THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); + DISCH_TAC; + FIRST_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,d,b,c}`] THEN REWRITE_TAC[Oxlzlez.coplanar_delta_y;DIST_0;DIST_SYM]; + RULE_ASSUM_TAC (REWRITE_RULE[arith `d + &0 = d`]); + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist REWRITE_TAC); + REWRITE_TAC[GSYM DIST_NZ]; + CONJ_TAC; + DISCH_TAC; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + BY(ASM_REWRITE_TAC[SET_RULE `{a,b,b,c} = {a,b,c}`;COPLANAR_3]); + TYPIFY `~collinear {vec 0,f (v p) t,v (p+1)}` (C SUBGOAL_THEN MP_TAC); + BY(POP_ASSUM MP_TAC THEN MESON_TAC[Planarity.notcoplanar_imp_notcollinear_fan]); + REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS]; + BY(REWRITE_TAC[DIST_0;arith `x pow 2 = x*x`;DIST_SYM]); + TYPIFY `!i. i < 3 ==> &0 < dist (v (p+i), v (p+3))` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[arith `p + 0 = (p:num)`;arith `0 < 3`;arith `1 < 3`]); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (arith `&2 <= x ==> &0 < x`); + MATCH_MP_TAC Ocbicby.scs_lb_2; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[arith `i < 3 <=> i = 0 \/ i = 1 \/ i = 2`] THEN DISCH_TAC THEN REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[] THEN NUM_REDUCE_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?t. abs t < e7 /\ y4' = dist(v p,v(p+1)) + t` (C SUBGOAL_THEN MP_TAC); + TYPIFY `y4' - dist(v p,v(p+1))` EXISTS_TAC; + CONJ2_TAC; + BY(REAL_ARITH_TAC); + BY(REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN REWRITE_TAC[IN_REAL_INTERVAL] THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `taum` MP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `~(x < y) <=> (y <= x)`]; + FIRST_X_ASSUM_ST `norm (f (v p) t) = norm (v p)` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[DIST_SYM;arith `d + &0 = d`] THEN REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]); + COMMENT "back to root, next tau"; + TYPIFY `sum {i | i < 4} (\i. rho_fun (norm (v i)) * azim (vec 0) (v i) (v (i + 1)) (v (i + 4 - 1))) <= sum {i | i < 4} (\i. rho_fun (norm (f (v i) t)) * azim (vec 0) (f (v i) t) (f(v(i+1)) t) (f (v (i + 4 - 1)) t))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Cuxvzoz.MMs_minimize_tau_fun; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[arith `3 < 4`]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + POP_ASSUM MP_TAC; + TYPIFY `{i | i < 4} = 0..(4-1)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG] THEN ARITH_TAC); + REPEAT ( GMATCH_SIMP_TAC (GSYM Oxl_def.periodic_sum)); + TYPIFY `p` EXISTS_TAC; + CONJ_TAC; + NUM_REDUCE_TAC; + FIRST_ASSUM_ST `periodic` MP_TAC THEN REWRITE_TAC[Oxl_def.periodic]; + REWRITE_TAC[arith `(i+4)+k = (i+k)+4`]; + BY(DISCH_THEN (unlist REWRITE_TAC)); + TYPIFY `p` EXISTS_TAC; + CONJ_TAC; + NUM_REDUCE_TAC; + FIRST_ASSUM_ST `periodic` MP_TAC THEN REWRITE_TAC[Oxl_def.periodic]; + REWRITE_TAC[arith `(i+4)+k = (i+k)+4`]; + BY(DISCH_THEN (unlist REWRITE_TAC)); + NUM_REDUCE_TAC; + REWRITE_TAC[arith `3+p = SUC(SUC(SUC p))`;SUM_CLAUSES_NUMSEG;SUM_SING_NUMSEG;arith `p <= SUC p /\ p <= SUC (SUC p) /\ p <= SUC(SUC(SUC p))`]; + REWRITE_TAC[arith `SUC i = i+1`;arith `(i + j) + (k:num) = i+(j+k)`]; + NUM_REDUCE_TAC; + ASM_REWRITE_TAC[]; + REPLICATE_TAC 7 (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `rho_fun` MP_TAC THEN ASM_REWRITE_TAC[Appendix.rho_rho_fun]; + TYPIFY `f (v(p+1)) t = v(p+1) /\ f (v (p+2)) t = v(p+2) /\ f(v (p+3)) t = v(p+3)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `~(w = v p) ==> a` (REPEAT o GMATCH_SIMP_TAC); + BY(ASM_REWRITE_TAC[] THEN REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + POP_ASSUM (fun t -> ASM_TAC THEN unlist REWRITE_TAC t THEN REPEAT DISCH_TAC THEN ASSUME_TAC t); + FIRST_X_ASSUM_ST `azim` MP_TAC; + FIRST_X_ASSUM_ST `azim` MP_TAC THEN BURY_MP_TAC; + FIRST_ASSUM_ST `azim` ((unlist REWRITE_TAC) o GSYM); + FIRST_ASSUM_ST `azim (vec 0) (v (p + 3)) (f (v p) t) (v (p + 2))` ((unlist REWRITE_TAC) o GSYM); + REWRITE_TAC[arith `(a+b)+c = a + b + c`]; + REWRITE_TAC[arith `r0 * (a013) + r1 * (a123 + a130) + r2 * a231 + r3 * (a301+a312) <= r0 * (f013) + r1 * (a123 + f130) + r2 * a231 + r3 *(f301 +a312) <=> r0 * a013 + r1*a130 + r3* a301 <= r0 * f013 + r1 * f130 + r3 * f301`]; + MATCH_MP_TAC (arith `a - (pi+sol0) = a' /\ b - (pi+sol0) = b' ==> (a <= b ==> a' <= b')`); + REWRITE_TAC[arith `(a + b+c) - (pi + sol0) = a + b + c - (pi + sol0)`]; + CONJ_TAC; + GMATCH_SIMP_TAC (GSYM Cuxvzoz.tau3_azim); + GMATCH_SIMP_TAC Cuxvzoz.tau3_taum_nonplanar; + ASM_REWRITE_TAC[]; + REWRITE_TAC[DIST_SYM]; + BY(MESON_TAC[Terminal.taum_sym]); + FIRST_X_ASSUM_ST `norm a = norm b` (SUBST1_TAC o GSYM); + FIRST_X_ASSUM_ST `dist s + t` (SUBST1_TAC o GSYM); + GMATCH_SIMP_TAC (GSYM Cuxvzoz.tau3_azim); + GMATCH_SIMP_TAC Cuxvzoz.tau3_taum_nonplanar; + REWRITE_TAC[DIST_SYM]; + REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; + ASM_REWRITE_TAC[DIST_SYM]; + BY(MESON_TAC[Terminal.taum_sym]); + ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM_ST `azim (vec 0) (f (v p) t) (v (p + 1)) (v (p + 3)) < pi` MP_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let BZQNDMN = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (!s FF v p. + IMAGE (\i. (v i,v (SUC i))) (:num) = FF /\ + is_scs_v39 s /\ + scs_k_v39 s = 4 /\ + MMs_v39 s v /\ + scs_basic_v39 s /\ + scs_generic v /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4 * h0 < scs_b_v39 s i j) /\ + (!i. ~(i MOD 4 = (p+3) MOD 4) ==> interior_angle1 (vec 0) FF (v i) < pi) + ==> (dist(v p,v(p+1)) = scs_a_v39 s p (p+1) \/ dist(v p,v(p+1)) = scs_b_v39 s p (p+1)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `BBprime2_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.scs_basic;Ayqjtmd.unadorned_MMs]); + TYPIFY `BBprime_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime2_v39]); + TYPIFY `BBs_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime_v39]); + INTRO_TAC Appendix.BBs_v39 [`s`;`v`]; + ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;Terminal.IMAGE_SUBSET_IN;IN_UNIV;arith `~(4 <= 3)`]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `V = IMAGE v (:num)`; + TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + EXPAND_TAC "V"; + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`4`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!i. interior_angle1 (vec 0) FF (v i) = azim (vec 0) (v i) (v (i+1)) (v (i+3))` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + EXPAND_TAC "FF"; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] (GSYM Ocbicby.INTERIOR_ANGLE1_AZIM)); + TYPIFY `s` EXISTS_TAC; + BY(ASM_REWRITE_TAC[IN;arith `4 - 1 = 3`;arith `3 < 4`;arith `SUC i = i+1`]); + INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`]; + ASM_REWRITE_TAC[LET_THM;IN;arith `4-1 = 3`;arith `SUC i = i+1`]; + DISCH_TAC; + TYPIFY `!i. v (i MOD 4) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[arith `~(0=4)`]); + TYPIFY `v 4 = v 0 /\ v 5 = v 1 /\ v 6 = v 2 /\ v 7 = v 3 /\ v 8 = v 4` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM ((unlist ONCE_REWRITE_TAC) o GSYM); + BY(REWRITE_TAC[Terminal.MOD_4_EXPLICIT;arith `7 = 1*4 + 3`;arith `8 = 2*4 + 0`;MOD_MULT_ADD]); + TYPIFY `generic V E` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `scs_generic` MP_TAC THEN ASM_REWRITE_TAC[Appendix.scs_generic]); + TYPIFY `v (p+4) = v p /\ v (p+5) = v (p+1) /\ v (p+6) = v (p+2) /\ v (p+7) = v (p+3) /\ v (p+8) = v (p)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `MOD` ((unlist ONCE_REWRITE_TAC) o GSYM); + BY(REWRITE_TAC[arith `p+4 = 1*4 + p /\ p+5 = 1*4+(p+1) /\ p+6=1*4+(p+2) /\ p+7 = 1*4 + (p+3) /\ p+8 = 2*4 + p`;MOD_MULT_ADD]); + COMMENT "change here"; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`4`;`p`;`2`;`3`]; + REWRITE_TAC[arith `SUC (x+k) = (x+k)+1`;arith `((p:num)+i)+j = p+(i+j)`]; + NUM_REDUCE_TAC; + ASM_REWRITE_TAC[LET_THM]; + DISCH_TAC; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`4`;`p+2`;`2`;`3`]; + REWRITE_TAC[arith `SUC (x+k) = (x+k)+1`;arith `((p:num)+i)+j = p+(i+j)`]; + NUM_REDUCE_TAC; + ASM_REWRITE_TAC[LET_THM]; + DISCH_TAC; + COMMENT "collinearity"; + TYPIFY `!i j. ~(v i = v j) ==> ~collinear {vec 0,v i, v j}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT GEN_TAC THEN DISCH_TAC; + MATCH_MP_TAC Zlzthic.PROPERTIES_GENERIC_LOCAL_FAN_ALT; + GEXISTL_TAC [`V`;`E`;`FF`]; + BY(ASM_REWRITE_TAC[IN_IMAGE;IN_UNIV]); + TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + INTRO_TAC PERIODIC_INJ_MOD [`v`;`4`]; + ASM_REWRITE_TAC[arith `~(4 = 0)`]; + DISCH_TAC; + TYPIFY `azim (vec 0) (v (p+1)) (v((p+1)+1)) (v ((p+1)+3)) = azim (vec 0) (v (p+1)) (v (p+2)) (v p)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[arith `(p+1)+i = p+(1+i)`] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC); + TYPIFY `azim (vec 0) (v (p+1)) (v ((p+1)+1)) (v ((p+1)+3)) < pi` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); + FIRST_X_ASSUM MATCH_MP_TAC; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + BY(NUM_REDUCE_TAC); + ASM_REWRITE_TAC[] THEN DISCH_TAC; + TYPIFY `&0 < azim (vec 0) (v (p+1)) (v ((p+1)+1)) (v ((p+1)+3))` (C SUBGOAL_THEN MP_TAC); + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM SUBST1_TAC THEN DISCH_TAC; + TYPIFY `~coplanar {vec 0,v p,v (p+1),v (p+2)}` (C SUBGOAL_THEN ASSUME_TAC); + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,c,d,b}`]; + REWRITE_TAC[GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; + MATCH_MP_TAC (arith `&0 < x /\ x < pi ==> ~ ((x = &0) \/ (x = pi))`); + BY((ASM_REWRITE_TAC[])); + TYPIFY `!i a b. a < 4 /\ b < 4 /\ ~(a = b) ==> ~collinear {vec 0,v(i+a),v(i+b)}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[]; + FIRST_X_ASSUM_ST `v (i MOD 4) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); + REPEAT (FIRST_X_ASSUM MATCH_MP_TAC); + nCONJ_TAC 2; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + NUM_REDUCE_TAC; + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION;MOD_LT;arith `~(4=0)`]); + ASM_REWRITE_TAC[]; + BY(MESON_TAC[DIVISION;arith `~(4=0)`]); + COMMENT "introduce deformation"; + INTRO_TAC Cuxvzoz.deform_simplex_edge_exists [`V`;`(\ (t:real). t)`;`(\(t:real). &0)`;`v (p)`;`v (p+1)`;`v (p +2)`;`&1`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ANTS_TAC; + REWRITE_TAC[arith `&0 < &1`]; + CONJ_TAC; + INTRO_TAC Planarity.cross_dot_fully_surrounded_fan [`(vec 0):real^3`;`v (p+1)`;`v (p)`;`v(p+2)`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + INTRO_TAC Planarity.notcoplanar_imp_notcollinear_fan [`(vec 0):real^3`;`v p`;`v (p+1)`;`v(p+2)`]; + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[SET_RULE `{a,b,c}={a,c,b}`]); + MATCH_MP_TAC (arith `x = y ==> (&0 < x ==> y > &0)`); + BY(VEC3_TAC); + REPEAT ( GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT); + REWRITE_TAC[Ocbicby.REAL_OPEN_REAL_INTERVAL]; + BY(REWRITE_TAC[REAL_CONTINUOUS_CONST;REAL_CONTINUOUS_AT_ID]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "A"; + TYPIFY `~(scs_a_v39 s p (p+1) < dist(v p,v (p+1)) /\ dist(v p,v (p+1)) < scs_b_v39 s p (p+1))` ENOUGH_TO_SHOW_TAC; + FIRST_X_ASSUM_ST `scs_a_v39` (C INTRO_TAC [`p`;`(p+1)`]); + BY(REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `(!i t. abs t < e' ==> norm (f (v i) t) = norm (v i))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `v i = v (p+1)` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]); + BY(ASM_REWRITE_TAC[] THEN MESON_TAC[]); + FIRST_X_ASSUM GMATCH_SIMP_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. 0 < i /\ i < 4 ==> ~(v (p + i) = v p)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[]; + GEN_REWRITE_TAC (RAND_CONV o RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + NUM_REDUCE_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION;MOD_LT;arith `~(4=0)`;arith `0 < i ==> ~(i=0)`]); + TYPIFY `!i. i=0 \/ i = 2 \/ i = 3 ==> ~(v (p + i) = v (p+1))` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT STRIP_TAC THEN FIRST_X_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC); + TYPIFY `!i j (k:num). v i = v j ==> v (i+k) = v (j+k)` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[arith `(i:num) + k = k + i`]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + BY(ASM_REWRITE_TAC[arith `~(4 = 0)`]); + TYPIFY `!t. azim (vec 0) (f (v (p+3)) t) (f (v (p)) t) (f (v (p+2)) t) = azim(vec 0) (v(p+3)) (v(p)) (v(p+2))` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + FIRST_X_ASSUM_ST `~(w = v (p+1)) ==> a` (REPEAT o GMATCH_SIMP_TAC); + ONCE_REWRITE_TAC[arith `(v p = (v:num->real^3) (p+1)) <=> (v(p+1) = v p)`]; + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + TYPIFY `!i. azim (vec 0) (v i) (v (i+1)) (v (i+3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); + MATCH_MP_TAC Local_lemmas.CONVEX_LOFA_IMP_INANGLE_LE_PI; + BY(ASM_REWRITE_TAC[]); + TYPIFY `(!i. ?e0. &0 < e0 /\ (azim (vec 0) (v i) (v (i + 1)) (v (i + 3)) = pi ==> (!t. abs t < e0 ==> azim (vec 0) (f (v i) t) (f (v (i + 1)) t) (f (v (i + 3)) t) <= pi)))` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + TYPIFY `v i = v (p+3)` ASM_CASES_TAC; + FIRST_ASSUM (fun t -> FIRST_X_ASSUM (ASSUME_TAC o (C MATCH_MP t))); + TYPIFY `&1` EXISTS_TAC; + ASM_REWRITE_TAC[arith `&0 < &1`;arith `(p+3)+k = p + (3+k)`]; + NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + TYPIFY `azim (vec 0) (v i) (v (i + 1)) (v (i + 3)) < pi` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[arith `x < pi ==> ~(x = pi)`;arith `&0 < &1`]); + BY(ASM_MESON_TAC[]); + (COMMENT "deformation in BBs"); + INTRO_TAC Cuxvzoz.deformation_BBs_ALT [`s`;`4`;`f`;`v`;`e'`]; + ANTS_TAC; + NUM_REDUCE_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC ab4_assumption_reduction_sym; + GEXISTL_TAC [`p`;`e'`]; + ASM_REWRITE_TAC[]; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `scs_diag` (C INTRO_TAC [`i`;`j`]); + BY(ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + (FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`])); + BY(ASM_REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); + (REPEAT WEAKER_STRIP_TAC); + COMMENT "azim sums"; + INTRO_TAC deform_azim_sum [`v (p)`;`v (p+1)`;`v (p+2)`;`v(p+3)`;`f`;`e'`]; + ANTS_TAC; + REPEAT (FIRST_X_ASSUM_ST `c = a + b` MP_TAC) THEN ASM_REWRITE_TAC[]; + REPLICATE_TAC 3 DISCH_TAC; + CONJ_TAC; + MATCH_MP_TAC Zlzthic.deformation_subset; + (TYPIFY `V` EXISTS_TAC THEN ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]); + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `~collinear {vec 0, v (p + 0), v (p+1)} /\ ~collinear {vec 0, v (p + 0), v (p + 2)} /\ ~collinear {vec 0, v (p + 0), v (p + 3)}` (C SUBGOAL_THEN MP_TAC); + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN (unlist REWRITE_TAC); + nCONJ_TAC 1; + BY(FIRST_X_ASSUM_ST `SUC` MP_TAC THEN REWRITE_TAC[arith `SUC p = p+1`] THEN DISCH_THEN (unlist REWRITE_TAC)); + FIRST_X_ASSUM (SUBST1_TAC) THEN REWRITE_TAC[]; + REPLICATE_TAC 3 (FIRST_X_ASSUM kill); + ASM_REWRITE_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + GEN_REWRITE_TAC (RAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + BY(NUM_REDUCE_TAC); + DISJ2_TAC; + CONJ_TAC; + GEN_TAC; + FIRST_X_ASSUM_ST `~(w = v p) ==> a` (REPEAT o GMATCH_SIMP_TAC); + ASM_REWRITE_TAC[]; + TYPIFY `p MOD 4 = (p+0) MOD 4` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[arith `p+0 = p`]); + BY(REPEAT CONJ_TAC THEN GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC); + REWRITE_TAC[Zlzthic.azim_lt_pi_cross]; + TYPIFY `(v (p) cross v (p+1)) dot v (p + 2) = (v (p+1) cross (v (p+2))) dot v (p)` (C SUBGOAL_THEN SUBST1_TAC); + BY(VEC3_TAC); + REWRITE_TAC[GSYM Zlzthic.azim_lt_pi_cross]; + BY(ASM_REWRITE_TAC[]); + (REPEAT WEAKER_STRIP_TAC); + INTRO_TAC deform_azim_sum [`v (p+2)`;`v (p+3)`;`v (p)`;`v(p+1)`;`f`;`e'`]; + ANTS_TAC; + REPEAT (FIRST_X_ASSUM_ST `c = a + b` MP_TAC) THEN ASM_REWRITE_TAC[]; + REPLICATE_TAC 3 DISCH_TAC; + CONJ_TAC; + MATCH_MP_TAC Zlzthic.deformation_subset; + (TYPIFY `V` EXISTS_TAC THEN ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]); + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `~collinear {vec 0, v (p + 2), v (p + 3)} /\ ~collinear {vec 0, v (p + 2), v (p + 0)} /\ ~collinear {vec 0, v (p + 2), v (p + 1)}` (C SUBGOAL_THEN MP_TAC); + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN (unlist REWRITE_TAC); + nCONJ_TAC 2; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM (SUBST1_TAC) THEN REWRITE_TAC[]; + REPLICATE_TAC 4 (FIRST_X_ASSUM kill); + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `&0 < azim (vec 0) (v (p + 2)) (v (p + 3)) (v (p+1)) /\ azim (vec 0) (v (p + 2)) (v (p + 3)) (v (p+1)) < pi` (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `&0 < azim a b c d` (C INTRO_TAC [`p+2`]); + TYPIFY `azim (vec 0) (v (p+2)) (v (p+3)) (v (p+1)) = azim (vec 0) (v (p + 2)) (v ((p + 2) + 1)) (v ((p + 2) + 3))` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[arith `((p:num) + i) + j = p + i+j`] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + BY(NUM_REDUCE_TAC); + DISJ1_TAC; + CONJ_TAC; + GEN_TAC; + FIRST_X_ASSUM_ST `~(w = v (p+1)) ==> a` (REPEAT o GMATCH_SIMP_TAC); + ASM_REWRITE_TAC[]; + TYPIFY `p MOD 4 = (p+0) MOD 4` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[arith `p + 0 = p`]); + BY(REPEAT CONJ_TAC THEN GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC); + REWRITE_TAC[Zlzthic.azim_lt_pi_cross]; + TYPIFY `(v (p + 2) cross v (p)) dot v (p+1) = (v (p+1) cross (v (p+2))) dot v (p)` (C SUBGOAL_THEN SUBST1_TAC); + BY(VEC3_TAC); + REWRITE_TAC[GSYM Zlzthic.azim_lt_pi_cross]; + BY(ASM_REWRITE_TAC[]); + (REPEAT WEAKER_STRIP_TAC); + TYPIFY `?e3. &0 < e3 /\ (!t. abs t < e3 ==> dist(v p,v (p+1)) + t IN real_interval(scs_a_v39 s p (p+1),scs_b_v39 s p (p+1)))` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC Zlzthic.real_interval_contains_0_ball [`scs_a_v39 s p (p+1)-dist(v p,v (p+1))`;`scs_b_v39 s p (p+1) - dist(v p,v (p+1))`;`&1`]; + ASM_REWRITE_TAC[arith `&0 < &1`;arith `a - d < &0 <=> a < d`;arith `&0 < b - d <=> d < b`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[IN_REAL_INTERVAL]; + BY(REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + (COMMENT "coplanar"); + INTRO_TAC Zlzthic.NONPLANAR_OPEN [`(\ (t:real). (vec 0):real^3)`;`\ (t:real). (v p)`;`f( v (p+1))`;`\ (t:real). v (p+2)`;`&0`]; + ASM_REWRITE_TAC[CONTINUOUS_CONST]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation] THEN REPEAT WEAKER_STRIP_TAC; + CONJ2_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + POP_ASSUM GMATCH_SIMP_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[arith `abs (&0 - t') = abs t'`] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Zlzthic.WNWSHJT [`v(p)`;`v (p+1)`;`v (p+2)`;`f`;`-- e'`;`e'`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC Zlzthic.deformation_subset; + (TYPIFY `V` EXISTS_TAC THEN ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]); + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (REPEAT o GMATCH_SIMP_TAC) THEN ASM_REWRITE_TAC[]; + TYPIFY `!i. ~(i=1) /\ i < 3 ==> ~collinear {vec 0,v (p+1),v(p+i)}` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[arith `p+0=p` ;arith `~(0=1) /\ 0 < 3 /\ ~(2=1) /\ 2 < 3`]); + GEN_TAC THEN DISCH_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(POP_ASSUM MP_TAC THEN ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + COMMENT "introduce 1834"; + INTRO_TAC Iunbuig.epsilon_hept [`e`;`e'`;`e''`;`e'''`;`e3`;`e1`;`e1'`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_ASSUM_ST `i = 0 \/ i = 2 \/ i = 3` MP_TAC; + FIRST_ASSUM_ST `i MOD 4 = j MOD 4` (unlist REWRITE_TAC); + DISCH_TAC; + INTRO_TAC (UNDISCH Ocbicby.LEMMA_1834976363) [`norm (v (p+2))`;`norm (v (p))`;`norm (v (p+1))`;`dist(v (p),v(p+1))`;`dist (v(p+2),v(p+1))`;`dist(v (p+2),v (p))`;`dist(v (p),v (p+1)) - e7`;`dist(v (p),v(p+1)) + e7`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + (COMMENT "1834 ants"); + TYPIFY `!i. &2 <= norm (v i) /\ norm (v i) <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + REWRITE_TAC[GSYM Fnjlbxs.in_ball_annulus]; + FIRST_X_ASSUM_ST `BBs_v39` kill THEN FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN EXPAND_TAC "V" THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `ball_annulus` MP_TAC; + REWRITE_TAC[SUBSET;IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + ASM_REWRITE_TAC[]; + FIRST_ASSUM_ST `collinear` (C INTRO_TAC [`p`;`2`;`0`]); + FIRST_X_ASSUM_ST `collinear` (C INTRO_TAC [`p`;`2`;`1`]); + NUM_REDUCE_TAC; + REWRITE_TAC[arith `p + 0 = p`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY_GOAL_THEN `&0 < ups_x (norm (v (p + 2)) * norm (v (p + 2))) (norm (v p) * norm (v p)) (dist (v (p + 2),v p) * dist (v (p + 2),v p)) /\ &0 < ups_x (norm (v (p + 2)) * norm (v (p + 2))) (norm (v (p + 1)) * norm (v (p + 1))) (dist (v (p + 2),v (p + 1)) * dist (v (p + 2),v (p + 1)))` (unlist REWRITE_TAC); + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS;DIST_0;DIST_SYM;arith`x pow 2 = x*x`]; + BY(MESON_TAC[]); + TYPIFY `!i j. &2 <= dist(v i,v j) ==> (&2 / h0) pow 2 <= xrr (norm(v i)) (norm(v (j))) (dist (v i,v j))` ((C SUBGOAL_THEN ASSUME_TAC)); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Ocbicby.xrr_simple_lower_bound; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + CONJ_TAC; + POP_ASSUM MATCH_MP_TAC; + MATCH_MP_TAC Ocbicby.scs_lb_2; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[]; + GEN_REWRITE_TAC (RAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(NUM_REDUCE_TAC); + CONJ_TAC; + TYPIFY `#15.53 = sqrt(#15.53) pow 2` (C SUBGOAL_THEN SUBST1_TAC); + GMATCH_SIMP_TAC SQRT_POW_2; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC Ocbicby.xrr_simple_upper_bound; + ASM_REWRITE_TAC[]; + TYPIFY `&4 = sqrt(&16)` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[arith `&16 = &4 pow 2`]; + REWRITE_TAC[POW_2_SQRT_ABS]; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC SQRT_MONO_LT_EQ; + TYPIFY_GOAL_THEN `&0 <= #15.53 /\ &0 < &16 /\ #15.53 < &16` (unlist REWRITE_TAC); + BY(REAL_ARITH_TAC); + CONJ_TAC; + BY(REAL_ARITH_TAC); + CONJ_TAC; + MATCH_MP_TAC Ocbicby.scs_lb_2; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[]; + GEN_REWRITE_TAC (RAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(NUM_REDUCE_TAC); + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `cstab` EXISTS_TAC; + CONJ_TAC; + MATCH_MP_TAC (arith `d <= scs_b_v39 s p (p+1) /\ scs_b_v39 s p (p+1) <= cstab ==> d <= cstab`); + CONJ_TAC; + FIRST_X_ASSUM_ST `BBs_v39` kill; + (FIRST_X_ASSUM_ST `BBs_v39` MP_TAC) THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM]; + BY(MESON_TAC[]); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39]; + ASM_REWRITE_TAC[arith `3 < 4`;arith `SUC i = i+1`]; + BY(MESON_TAC[]); + REWRITE_TAC[Sphere.cstab]; + MATCH_MP_TAC REAL_LE_RSQRT; + BY(REAL_ARITH_TAC); + CONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + MATCH_MP_TAC Ocbicby.scs_lb_2; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[]; + BY(GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC); + CONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + MATCH_MP_TAC Ocbicby.scs_lb_2; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[]; + GEN_REWRITE_TAC (RAND_CONV o RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`]; + BY(GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC); + CONJ_TAC; + REWRITE_TAC[IN_REAL_INTERVAL]; + BY(FIRST_X_ASSUM_ST `&0 < e` MP_TAC THEN REAL_ARITH_TAC); + COMMENT "subset constraints"; + CONJ_TAC; + REWRITE_TAC[SUBSET;IN_REAL_INTERVAL;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?t. abs t < e7 /\ x = dist(v p,v(p+1)) + t` (C SUBGOAL_THEN MP_TAC); + TYPIFY `x - dist(v p,v(p+1))` EXISTS_TAC; + CONJ2_TAC; + BY(REAL_ARITH_TAC); + BY(REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `norm (f (v (p+1)) t) = norm (v (p+1))` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); + REWRITE_TAC[DIST_SYM] THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); + DISCH_TAC; + FIRST_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,d,b,c}`] THEN REWRITE_TAC[Oxlzlez.coplanar_delta_y;DIST_0;DIST_SYM]; + RULE_ASSUM_TAC (REWRITE_RULE[arith `d + &0 = d`]); + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist REWRITE_TAC); + REWRITE_TAC[GSYM DIST_NZ]; + CONJ_TAC; + DISCH_TAC; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + BY(ASM_REWRITE_TAC[SET_RULE `{a,b,b,c} = {a,b,c}`;COPLANAR_3]); + TYPIFY `~collinear {vec 0, (v p) ,f (v (p+1)) t}` (C SUBGOAL_THEN MP_TAC); + BY(POP_ASSUM MP_TAC THEN MESON_TAC[Planarity.notcoplanar_imp_notcollinear_fan]); + REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS]; + BY(REWRITE_TAC[DIST_0;arith `x pow 2 = x*x`;DIST_SYM]); + TYPIFY `!i. i < 2 ==> &0 < dist ( v (p+2),v (p+i))` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[arith `p + 0 = (p:num)`;arith `0 < 2`;arith `1 < 2`]); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (arith `&2 <= x ==> &0 < x`); + MATCH_MP_TAC Ocbicby.scs_lb_2; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[arith `i < 2 <=> i = 0 \/ i = 1`] THEN DISCH_TAC THEN REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[] THEN NUM_REDUCE_TAC); + REPEAT WEAKER_STRIP_TAC; + COMMENT "root"; + TYPIFY `?t. abs t < e7 /\ y4' = dist(v p,v(p+1)) + t` (C SUBGOAL_THEN MP_TAC); + TYPIFY `y4' - dist(v p,v(p+1))` EXISTS_TAC; + CONJ2_TAC; + BY(REAL_ARITH_TAC); + BY(REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN REWRITE_TAC[IN_REAL_INTERVAL] THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `taum` MP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `~(x < y) <=> (y <= x)`]; + FIRST_X_ASSUM_ST `norm (f (v p) t) = norm (v p)` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[DIST_SYM;arith `d + &0 = d`] THEN REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]); + COMMENT "back to root, next tau"; + TYPIFY `sum {i | i < 4} (\i. rho_fun (norm (v i)) * azim (vec 0) (v i) (v (i + 1)) (v (i + 4 - 1))) <= sum {i | i < 4} (\i. rho_fun (norm (f (v i) t)) * azim (vec 0) (f (v i) t) (f(v(i+1)) t) (f (v (i + 4 - 1)) t))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Cuxvzoz.MMs_minimize_tau_fun; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[arith `3 < 4`]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + POP_ASSUM MP_TAC; + TYPIFY `{i | i < 4} = 0..(4-1)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG] THEN ARITH_TAC); + REPEAT ( GMATCH_SIMP_TAC (GSYM Oxl_def.periodic_sum)); + TYPIFY `p` EXISTS_TAC; + CONJ_TAC; + NUM_REDUCE_TAC; + FIRST_ASSUM_ST `periodic` MP_TAC THEN REWRITE_TAC[Oxl_def.periodic]; + REWRITE_TAC[arith `(i+4)+k = (i+k)+4`]; + BY(DISCH_THEN (unlist REWRITE_TAC)); + TYPIFY `p` EXISTS_TAC; + CONJ_TAC; + NUM_REDUCE_TAC; + FIRST_ASSUM_ST `periodic` MP_TAC THEN REWRITE_TAC[Oxl_def.periodic]; + REWRITE_TAC[arith `(i+4)+k = (i+k)+4`]; + BY(DISCH_THEN (unlist REWRITE_TAC)); + NUM_REDUCE_TAC; + REWRITE_TAC[arith `3+p = SUC(SUC(SUC p))`;SUM_CLAUSES_NUMSEG;SUM_SING_NUMSEG;arith `p <= SUC p /\ p <= SUC (SUC p) /\ p <= SUC(SUC(SUC p))`]; + REWRITE_TAC[arith `SUC i = i+1`;arith `(i + j) + (k:num) = i+(j+k)`]; + NUM_REDUCE_TAC; + ASM_REWRITE_TAC[]; + REPLICATE_TAC 7 (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `rho_fun` MP_TAC THEN ASM_REWRITE_TAC[Appendix.rho_rho_fun]; + TYPIFY `f (v(p+0)) t = v(p+0) /\ f (v (p+2)) t = v(p+2) /\ f(v (p+3)) t = v(p+3)` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM_ST `~(w = v p) ==> a` (REPEAT o GMATCH_SIMP_TAC); + BY(ASM_REWRITE_TAC[] THEN REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + REWRITE_TAC[arith `p + 0 = p`] THEN DISCH_TAC; + POP_ASSUM (fun t -> ASM_TAC THEN unlist REWRITE_TAC t THEN REPEAT DISCH_TAC THEN ASSUME_TAC t); + FIRST_X_ASSUM_ST `azim` MP_TAC; + FIRST_X_ASSUM_ST `azim` MP_TAC THEN BURY_MP_TAC; + FIRST_ASSUM_ST `azim` ((unlist REWRITE_TAC) o GSYM); + FIRST_ASSUM_ST ` azim (vec 0) (v p) (f (v (p + 1)) t) (v (p + 3))` ((unlist REWRITE_TAC) o GSYM); + REWRITE_TAC[arith `(a+b)+c = a + b + c`]; + FIRST_X_ASSUM_ST `SUC` MP_TAC THEN REWRITE_TAC[arith `SUC p = p+1`]; + DISCH_THEN (SUBST1_TAC ); + REWRITE_TAC[arith `r0 * (a012+a023) + r1 * (a120) + r2 * (a230+a201) + r3 * (a302) <= r0 * (f012+a023) + r1 * (f120) + r2 * (a230+f201) + r3 *(a302) <=> r0 * a012 + r1*a120 + r2* a201 <= r0 * f012 + r1 * f120 + r2 * f201`]; + MATCH_MP_TAC (arith `a - (pi+sol0) = a' /\ b - (pi+sol0) = b' ==> (a <= b ==> a' <= b')`); + REWRITE_TAC[arith `(a + b+c) - (pi + sol0) = a + b + c - (pi + sol0)`]; + CONJ_TAC; + ONCE_REWRITE_TAC[arith `a + b + c - p = b + c + a - p`]; + GMATCH_SIMP_TAC (GSYM Cuxvzoz.tau3_azim); + GMATCH_SIMP_TAC Cuxvzoz.tau3_taum_nonplanar; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,d,b,c}`]; + ASM_REWRITE_TAC[]; + CONJ2_TAC; + REWRITE_TAC[DIST_SYM]; + BY(MESON_TAC[Terminal.taum_sym]); + FIRST_X_ASSUM_ST `a <= pi` kill; + FIRST_X_ASSUM_ST `a <= pi` (C INTRO_TAC [`p+1`]); + BY(REWRITE_TAC[arith `(p+1)+k = p + (1 +k)`] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[]); + FIRST_X_ASSUM_ST `norm a = norm b` (SUBST1_TAC o GSYM); + FIRST_X_ASSUM_ST `dist s + t` (SUBST1_TAC o GSYM); + ONCE_REWRITE_TAC[arith `a + b + c - p = b + c + a - p`]; + GMATCH_SIMP_TAC (GSYM Cuxvzoz.tau3_azim); + GMATCH_SIMP_TAC Cuxvzoz.tau3_taum_nonplanar; + REWRITE_TAC[DIST_SYM]; + REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; + ASM_REWRITE_TAC[DIST_SYM]; + BY(MESON_TAC[Terminal.taum_sym]); + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,d,b,c}`]; + ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM_ST `azim (vec 0) (f (v (p+1)) t) (v (p + 2)) (v (p)) < pi` MP_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let JOTSWIX = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (!s FF v p. + IMAGE (\i. (v i,v (SUC i))) (:num) = FF /\ + is_scs_v39 s /\ + scs_k_v39 s = 4 /\ + MMs_v39 s v /\ + scs_basic_v39 s /\ + scs_generic v /\ + scs_a_v39 s p (p+1) < cstab /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4 * h0 < scs_b_v39 s i j) /\ + (!i. ~(i MOD 4 = (p+2) MOD 4) ==> interior_angle1 (vec 0) FF (v i) < pi) /\ + (xrr (norm (v (p+3))) (norm (v (p+1))) (dist(v (p+3),v(p+1))) <= #15.53) + ==> (dist(v p,v(p+1)) < cstab \/ dist(v p,v(p+3)) < cstab))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (arith `~((cstab <= d) /\ (cstab <= d')) ==> (d < cstab \/ d' < cstab)`); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `BBprime2_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.scs_basic;Ayqjtmd.unadorned_MMs]); + TYPIFY `BBprime_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime2_v39]); + TYPIFY `BBs_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime_v39]); + INTRO_TAC Appendix.BBs_v39 [`s`;`v`]; + ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;Terminal.IMAGE_SUBSET_IN;IN_UNIV;arith `~(4 <= 3)`]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `V = IMAGE v (:num)`; + TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + EXPAND_TAC "V"; + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`4`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!i. interior_angle1 (vec 0) FF (v i) = azim (vec 0) (v i) (v (i+1)) (v (i+3))` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + EXPAND_TAC "FF"; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] (GSYM Ocbicby.INTERIOR_ANGLE1_AZIM)); + TYPIFY `s` EXISTS_TAC; + BY(ASM_REWRITE_TAC[IN;arith `4 - 1 = 3`;arith `3 < 4`;arith `SUC i = i+1`]); + INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`]; + ASM_REWRITE_TAC[LET_THM;IN;arith `4-1 = 3`;arith `SUC i = i+1`]; + DISCH_TAC; + TYPIFY `!i. v (i MOD 4) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[arith `~(0=4)`]); + TYPIFY `v 4 = v 0 /\ v 5 = v 1 /\ v 6 = v 2 /\ v 7 = v 3 /\ v 8 = v 4` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM ((unlist ONCE_REWRITE_TAC) o GSYM); + BY(REWRITE_TAC[Terminal.MOD_4_EXPLICIT;arith `7 = 1*4 + 3`;arith `8 = 2*4 + 0`;MOD_MULT_ADD]); + TYPIFY `generic V E` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `scs_generic` MP_TAC THEN ASM_REWRITE_TAC[Appendix.scs_generic]); + TYPIFY `v (p+4) = v p /\ v (p+5) = v (p+1) /\ v (p+6) = v (p+2) /\ v (p+7) = v (p+3) /\ v (p+8) = v (p)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `MOD` ((unlist ONCE_REWRITE_TAC) o GSYM); + BY(REWRITE_TAC[arith `p+4 = 1*4 + p /\ p+5 = 1*4+(p+1) /\ p+6=1*4+(p+2) /\ p+7 = 1*4 + (p+3) /\ p+8 = 2*4 + p`;MOD_MULT_ADD]); + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`4`;`p+3`;`2`;`3`]; + REWRITE_TAC[arith `SUC (x+k) = (x+k)+1`;arith `((p:num)+i)+j = p+(i+j)`]; + NUM_REDUCE_TAC; + ASM_REWRITE_TAC[LET_THM]; + DISCH_TAC; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`4`;`p+1`;`2`;`3`]; + REWRITE_TAC[arith `SUC (x+k) = (x+k)+1`;arith `((p:num)+i)+j = p+(i+j)`]; + NUM_REDUCE_TAC; + ASM_REWRITE_TAC[LET_THM]; + DISCH_TAC; + COMMENT "collinearity"; + TYPIFY `!i j. ~(v i = v j) ==> ~collinear {vec 0,v i, v j}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT GEN_TAC THEN DISCH_TAC; + MATCH_MP_TAC Zlzthic.PROPERTIES_GENERIC_LOCAL_FAN_ALT; + GEXISTL_TAC [`V`;`E`;`FF`]; + BY(ASM_REWRITE_TAC[IN_IMAGE;IN_UNIV]); + TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + INTRO_TAC PERIODIC_INJ_MOD [`v`;`4`]; + ASM_REWRITE_TAC[arith `~(4 = 0)`]; + DISCH_TAC; + TYPIFY `azim (vec 0) (v p) (v (p+1)) (v (p+3)) < pi` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); + FIRST_X_ASSUM MATCH_MP_TAC; + GEN_REWRITE_TAC(RAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[arith`p = p+0`]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + BY(NUM_REDUCE_TAC); + TYPIFY `~coplanar {vec 0,v p,v (p+1),v (p+3)}` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; + MATCH_MP_TAC (arith `&0 < x /\ x < pi ==> ~ ((x = &0) \/ (x = pi))`); + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i a b. a < 4 /\ b < 4 /\ ~(a = b) ==> ~collinear {vec 0,v(i+a),v(i+b)}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[]; + FIRST_X_ASSUM_ST `v (i MOD 4) = v i` ((unlist ONCE_REWRITE_TAC) o GSYM); + REPEAT (FIRST_X_ASSUM MATCH_MP_TAC); + nCONJ_TAC 2; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + NUM_REDUCE_TAC; + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION;MOD_LT;arith `~(4=0)`]); + ASM_REWRITE_TAC[]; + BY(MESON_TAC[DIVISION;arith `~(4=0)`]); + COMMENT "introduce deformation"; + INTRO_TAC Cuxvzoz.deform_simplex_edge_exists [`V`;`(\ (t:real). &0)`;`(\(t:real). -- abs t)`;`v (p +3)`;`v p`;`v (p +1)`;`&1`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ANTS_TAC; + REWRITE_TAC[arith `&0 < &1`]; + SUBCONJ_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d}={a,c,d,b}`]; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + CONJ_TAC; + INTRO_TAC Planarity.cross_dot_fully_surrounded_fan [`(vec 0):real^3`;`v p`;`v (p+3)`;`v(p+1)`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + INTRO_TAC Planarity.notcoplanar_imp_notcollinear_fan [`(vec 0):real^3`;`v p`;`v (p+1)`;`v(p+3)`]; + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + MATCH_MP_TAC (arith `x = y ==> (&0 < x ==> y > &0)`); + BY(VEC3_TAC); + REPEAT ( GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT); + REWRITE_TAC[Ocbicby.REAL_OPEN_REAL_INTERVAL]; + (REWRITE_TAC[REAL_CONTINUOUS_CONST;REAL_CONTINUOUS_AT_ID;arith `-- abs(&0) = &0`]); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC REAL_CONTINUOUS_NEG; + BY(REWRITE_TAC[Cuxvzoz.real_continuous_abs]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "A"; + TYPIFY `!i. dist (v i,v (i+1)) <= cstab` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `scs_b_v39 s i (i+1)` EXISTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `scs_b_v39 s i j <= cstab` (C INTRO_TAC [`i`]); + BY(ASM_REWRITE_TAC[arith `3 < 4`;arith `SUC i = i+1`]); + TYPIFY `(!i t. abs t < e' ==> norm (f (v i) t) = norm (v i))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `v i = v p` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`]); + BY(ASM_REWRITE_TAC[] THEN MESON_TAC[]); + FIRST_X_ASSUM GMATCH_SIMP_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. 0 < i /\ i < 4 ==> ~(v (p + i) = v p)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[]; + GEN_REWRITE_TAC (RAND_CONV o RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + NUM_REDUCE_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[DIVISION;MOD_LT;arith `~(4=0)`;arith `0 < i ==> ~(i=0)`]); + TYPIFY `!i j (k:num). v i = v j ==> v (i+k) = v (j+k)` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[arith `(i:num) + k = k + i`]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + BY(ASM_REWRITE_TAC[arith `~(4 = 0)`]); + TYPIFY `!t. azim (vec 0) (f (v (p+2)) t) (f (v (p+3)) t) (f (v (p+1)) t) = azim(vec 0) (v(p+2)) (v(p+3)) (v(p+1))` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + FIRST_X_ASSUM_ST `~(w = v p) ==> a` (REPEAT o GMATCH_SIMP_TAC); + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + TYPIFY `!i. azim (vec 0) (v i) (v (i+1)) (v (i+3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); + MATCH_MP_TAC Local_lemmas.CONVEX_LOFA_IMP_INANGLE_LE_PI; + BY(ASM_REWRITE_TAC[]); + TYPIFY `(!i. ?e0. &0 < e0 /\ (azim (vec 0) (v i) (v (i + 1)) (v (i + 3)) = pi ==> (!t. abs t < e0 ==> azim (vec 0) (f (v i) t) (f (v (i + 1)) t) (f (v (i + 3)) t) <= pi)))` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + TYPIFY `v i = v (p+2)` ASM_CASES_TAC; + FIRST_ASSUM (fun t -> FIRST_X_ASSUM (ASSUME_TAC o (C MATCH_MP t))); + TYPIFY `&1` EXISTS_TAC; + ASM_REWRITE_TAC[arith `&0 < &1`;arith `(p+2)+k = p + (2+k)`]; + NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + TYPIFY `azim (vec 0) (v i) (v (i + 1)) (v (i + 3)) < pi` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[arith `x < pi ==> ~(x = pi)`;arith `&0 < &1`]); + BY(ASM_MESON_TAC[]); + (COMMENT "deformation in BBs"); + INTRO_TAC Cuxvzoz.deformation_BBs_ALT [`s`;`4`;`f`;`v`;`e'`]; + ANTS_TAC; + NUM_REDUCE_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC ab4_assumption_reduction2; + GEXISTL_TAC [`p`;`e'`]; + ASM_REWRITE_TAC[]; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `scs_diag` (C INTRO_TAC [`i`;`j`]); + BY(ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; + TYPIFY `e'` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + (FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`])); + TYPIFY `dist (v p,v (p+1)) <= scs_b_v39 s p (p+1)` ENOUGH_TO_SHOW_TAC; + BY(POP_ASSUM (unlist REWRITE_TAC) THEN REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + (FIRST_X_ASSUM_ST `norm` (C INTRO_TAC [`t`])); + BY(ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + MATCH_MP_TAC REAL_LTE_TRANS; + TYPIFY `cstab` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + (REPEAT WEAKER_STRIP_TAC); + (COMMENT "azim sums"); + INTRO_TAC deform_azim_sum [`v (p+3)`;`v p`;`v (p+1)`;`v(p+2)`;`f`;`e'`]; + ANTS_TAC; + REPEAT (FIRST_X_ASSUM_ST `c = a + b` MP_TAC) THEN ASM_REWRITE_TAC[]; + REPLICATE_TAC 3 DISCH_TAC; + CONJ_TAC; + MATCH_MP_TAC Zlzthic.deformation_subset; + (TYPIFY `V` EXISTS_TAC THEN ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]); + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `~collinear {vec 0, v (p + 3), v (p+0)} /\ ~collinear {vec 0, v (p + 3), v (p + 1)} /\ ~collinear {vec 0, v (p + 3), v (p + 2)}` (C SUBGOAL_THEN MP_TAC); + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN (unlist REWRITE_TAC); + nCONJ_TAC 2; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM (SUBST1_TAC) THEN REWRITE_TAC[]; + REPLICATE_TAC 4 (FIRST_X_ASSUM kill); + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `&0 < azim (vec 0) (v (p + 3)) (v p) (v (p + 2)) /\ azim (vec 0) (v (p + 3)) (v p) (v (p + 2)) < pi` (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `&0 < azim a b c d` (C INTRO_TAC [`p+3`]); + TYPIFY `azim (vec 0) (v (p+3)) (v p) (v (p+2)) = azim (vec 0) (v (p + 3)) (v ((p + 3) + 1)) (v ((p + 3) + 3))` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[arith `((p:num) + i) + j = p + i+j`] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + BY(NUM_REDUCE_TAC); + DISJ2_TAC; + CONJ_TAC; + GEN_TAC; + FIRST_X_ASSUM_ST `~(w = v p) ==> a` (REPEAT o GMATCH_SIMP_TAC); + ASM_REWRITE_TAC[]; + BY(REPEAT CONJ_TAC THEN GEN_REWRITE_TAC (RAND_CONV o RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`] THEN GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC); + REWRITE_TAC[Zlzthic.azim_lt_pi_cross]; + TYPIFY `(v (p + 3) cross v p) dot v (p + 1) = (v (p) cross (v (p+1))) dot v (p + 3)` (C SUBGOAL_THEN SUBST1_TAC); + BY(VEC3_TAC); + REWRITE_TAC[GSYM Zlzthic.azim_lt_pi_cross]; + BY(ASM_REWRITE_TAC[]); + (REPEAT WEAKER_STRIP_TAC); + COMMENT "second azim sum"; + INTRO_TAC deform_azim_sum [`v (p+1)`;`v (p+2)`;`v (p+3)`;`v(p)`;`f`;`e'`]; + ANTS_TAC; + REPEAT (FIRST_X_ASSUM_ST `c = a + b` MP_TAC) THEN ASM_REWRITE_TAC[]; + REPLICATE_TAC 3 DISCH_TAC; + CONJ_TAC; + MATCH_MP_TAC Zlzthic.deformation_subset; + (TYPIFY `V` EXISTS_TAC THEN ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]); + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `~collinear {vec 0, v (p + 1), v (p + 2)} /\ ~collinear {vec 0, v (p + 1), v (p + 3)} /\ ~collinear {vec 0, v (p + 1), v (p + 0)}` (C SUBGOAL_THEN MP_TAC); + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN (unlist REWRITE_TAC); + nCONJ_TAC 2; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM (SUBST1_TAC) THEN REWRITE_TAC[]; + REPLICATE_TAC 4 (FIRST_X_ASSUM kill); + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `&0 < azim (vec 0) (v (p + 1)) (v (p + 2)) (v p) /\ azim (vec 0) (v (p + 1)) (v (p + 2)) (v p) < pi` (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `&0 < azim a b c d` (C INTRO_TAC [`p+1`]); + TYPIFY `azim (vec 0) (v (p+1)) (v (p+2)) (v (p)) = azim (vec 0) (v (p + 1)) (v ((p + 1) + 1)) (v ((p + 1) + 3))` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[arith `((p:num) + i) + j = p + i+j`] THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + BY(NUM_REDUCE_TAC); + DISJ1_TAC; + CONJ_TAC; + GEN_TAC; + FIRST_X_ASSUM_ST `~(w = v p) ==> a` (REPEAT o GMATCH_SIMP_TAC); + ASM_REWRITE_TAC[]; + BY(REPEAT CONJ_TAC THEN GEN_REWRITE_TAC (RAND_CONV o RAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [arith `p = p+0`] THEN GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT THEN NUM_REDUCE_TAC); + REWRITE_TAC[Zlzthic.azim_lt_pi_cross]; + TYPIFY `(v (p + 1) cross v (p+3)) dot v (p) = (v (p) cross (v (p+1))) dot v (p + 3)` (C SUBGOAL_THEN SUBST1_TAC); + BY(VEC3_TAC); + REWRITE_TAC[GSYM Zlzthic.azim_lt_pi_cross]; + BY(ASM_REWRITE_TAC[]); + (REPEAT WEAKER_STRIP_TAC); + TYPIFY `?e3. &0 < e3 /\ (!t. abs t < e3 /\ t < &0 ==> dist(v p,v (p+1)) + t IN real_interval(scs_a_v39 s p (p+1),scs_b_v39 s p (p+1)))` (C SUBGOAL_THEN MP_TAC); + TYPIFY `dist(v p,v(p+1)) - scs_a_v39 s p (p+1)` EXISTS_TAC; + ASM_REWRITE_TAC[arith `&0 < &1`;arith `a - d < &0 <=> a < d`;arith `&0 < b - d <=> d < b`]; + SUBCONJ_TAC; + MATCH_MP_TAC REAL_LTE_TRANS; + TYPIFY `cstab` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[IN_REAL_INTERVAL]; + CONJ_TAC; + BY(REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + MATCH_MP_TAC (arith `t < &0 /\ d <= b ==> d + t < b`); + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "coplanar"; + INTRO_TAC Zlzthic.NONPLANAR_OPEN [`(\ (t:real). (vec 0):real^3)`;`f (v p)`;`\ (t:real). v (p+1)`;`\ (t:real). v (p+3)`;`&0`]; + ASM_REWRITE_TAC[CONTINUOUS_CONST]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation] THEN REPEAT WEAKER_STRIP_TAC; + CONJ2_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + POP_ASSUM GMATCH_SIMP_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[arith `abs (&0 - t') = abs t'`] THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Zlzthic.WNWSHJT [`v(p+3)`;`v p`;`v (p+1)`;`f`;`-- e'`;`e'`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC Zlzthic.deformation_subset; + (TYPIFY `V` EXISTS_TAC THEN ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]); + BY(REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + FIRST_X_ASSUM_ST `deformation` MP_TAC THEN REWRITE_TAC[Localization.deformation]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (REPEAT o GMATCH_SIMP_TAC) THEN ASM_REWRITE_TAC[]; + TYPIFY `!i. ~(i=0) /\ i < 4 ==> ~collinear {vec 0,v (p+0),v(p+i)}` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[arith `p+0=p` ;arith `~(1=0) /\ 1 < 4 /\ ~(3=0) /\ 3 < 4`]); + GEN_TAC THEN DISCH_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `0 < 4`]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Iunbuig.epsilon_hept [`e`;`e'`;`e''`;`e'''`;`e3`;`e1`;`e1'`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_ASSUM_ST `!i. 0 < i /\ i < 4 ==> ~(v (p + i) = v p)` MP_TAC; + FIRST_ASSUM_ST `i MOD 4 = j MOD 4` (unlist REWRITE_TAC); + DISCH_TAC; + COMMENT "introduce 684"; + INTRO_TAC (UNDISCH Ocbicby.LEMMA_6843920790) [`norm (v (p+3))`;`norm (v p)`;`norm (v (p+1))`;`dist(v p,v(p+1))`;`dist (v(p+1),v(p+3))`;`dist(v p,v (p+3))`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + (COMMENT "684 ants"); + TYPIFY `!i. &2 <= norm (v i) /\ norm (v i) <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + REWRITE_TAC[GSYM Fnjlbxs.in_ball_annulus]; + FIRST_X_ASSUM_ST `BBs_v39` kill THEN FIRST_X_ASSUM_ST `BBs_v39` MP_TAC THEN REWRITE_TAC[Appendix.BBs_v39;LET_THM] THEN EXPAND_TAC "V" THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `ball_annulus` MP_TAC; + REWRITE_TAC[SUBSET;IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + ASM_REWRITE_TAC[]; + REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; + FIRST_X_ASSUM_ST `coplanar` kill; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d}= {a,d,b,c}`]; + BY(REWRITE_TAC[Oxlzlez.coplanar_delta_y;DIST_0;DIST_SYM]); + ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]; + TYPIFY `!i j. &2 <= dist(v i,v j) /\ dist(v i,v j) <= cstab ==> xrr (norm (v i)) (norm (v j)) (dist (v i,v j)) <= #15.53` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `#15.53 = sqrt(#15.53) pow 2` (C SUBGOAL_THEN SUBST1_TAC); + GMATCH_SIMP_TAC SQRT_POW_2; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC Ocbicby.xrr_simple_upper_bound; + ASM_REWRITE_TAC[]; + TYPIFY `&4 = sqrt(&16)` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[arith `&16 = &4 pow 2`]; + REWRITE_TAC[POW_2_SQRT_ABS]; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC SQRT_MONO_LT_EQ; + TYPIFY_GOAL_THEN `&0 <= #15.53 /\ &0 <= &16 /\ #15.53 < &16` (unlist REWRITE_TAC); + BY(REAL_ARITH_TAC); + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `cstab` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[Sphere.cstab]; + MATCH_MP_TAC REAL_LE_RSQRT; + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM ( GMATCH_SIMP_TAC); + TYPIFY ` &2 <= dist(v p,v(p+1)) /\ dist(v p,v (p+3)) <= cstab /\ cstab <= dist(v p,v(p+3)) /\ dist(v p,v(p+1)) <= cstab /\ cstab <= dist (v (p+1),v(p+3))` ENOUGH_TO_SHOW_TAC; + BY(REWRITE_TAC[Sphere.cstab;DIST_SYM] THEN REAL_ARITH_TAC); + CONJ_TAC; + MATCH_MP_TAC Ocbicby.scs_lb_2; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(NUM_REDUCE_TAC); + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `scs_b_v39 s (p+3) (SUC (p+3))` EXISTS_TAC; + CONJ2_TAC; + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[] THEN NUM_REDUCE_TAC); + ONCE_REWRITE_TAC[DIST_SYM]; + TYPIFY `v p = v (SUC (p+3))` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + FIRST_X_ASSUM_ST `d <= scs_b_v39 s i j` MP_TAC; + BY(MESON_TAC[]); + BY(ASM_REWRITE_TAC[arith `SUC (p+3) = p+4`;Oxl_2012.MOD_ADD_CANCEL]); + MATCH_MP_TAC (arith `c < d ==> c <= d`); + FIRST_X_ASSUM_ST `cstab < d` (C INTRO_TAC [`p+1`;`p+3`]); + ANTS_TAC; + REWRITE_TAC[arith `p+3 = SUC(SUC (p+1))`]; + MATCH_MP_TAC Tfitskc.SCS_DIAG_2; + BY(NUM_REDUCE_TAC); + BY(DISCH_THEN (unlist REWRITE_TAC)); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?e4. &0 < e4 /\ (!t. abs t < e4 ==> dist(v p,v (p+1)) + t IN real_interval(a,b))` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC Zlzthic.real_interval_contains_0_ball [`a-dist(v p,v (p+1))`;`b - dist(v p,v (p+1))`;`&1`]; + ASM_REWRITE_TAC[arith `&0 < &1`;arith `a - d < &0 <=> a < d`;arith `&0 < b - d <=> d < b`]; + ANTS_TAC; + BY(FIRST_X_ASSUM_ST `dist s IN real_interval(a,b)` MP_TAC THEN REWRITE_TAC[IN_REAL_INTERVAL]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''''` EXISTS_TAC; + ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[IN_REAL_INTERVAL]; + BY(REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Cuxvzoz.epsilon_pair [`e4`;`e7`] THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `?t. abs t < e'''' /\ t < &0` (C SUBGOAL_THEN MP_TAC); + TYPIFY `-- e'''' / &2` EXISTS_TAC; + BY(REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + REPLICATE_TAC 7 (FIRST_X_ASSUM_ST `abs t < e ==> a` (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`dist(v p,v(p+1)) + t`;`dist(v p,v (p+1))`]); + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM_ST `t < &0` MP_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `~(x < y) <=> y <= x`]; + FIRST_X_ASSUM_ST `norm (f (v p) t) = norm (v p)` (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!d. t < &0 ==> d + -- abs t = d + t` (C SUBGOAL_THEN MP_TAC); + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist REWRITE_TAC); + (REWRITE_TAC[DIST_SYM;arith `d + &0 = d`] THEN REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]); + (COMMENT "back to root, next tau"); + TYPIFY `sum {i | i < 4} (\i. rho_fun (norm (v i)) * azim (vec 0) (v i) (v (i + 1)) (v (i + 4 - 1))) <= sum {i | i < 4} (\i. rho_fun (norm (f (v i) t)) * azim (vec 0) (f (v i) t) (f(v(i+1)) t) (f (v (i + 4 - 1)) t))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Cuxvzoz.MMs_minimize_tau_fun; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[arith `3 < 4`]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + POP_ASSUM MP_TAC; + TYPIFY `{i | i < 4} = 0..(4-1)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG] THEN ARITH_TAC); + REPEAT ( GMATCH_SIMP_TAC (GSYM Oxl_def.periodic_sum)); + TYPIFY `p` EXISTS_TAC; + CONJ_TAC; + NUM_REDUCE_TAC; + FIRST_ASSUM_ST `periodic` MP_TAC THEN REWRITE_TAC[Oxl_def.periodic]; + REWRITE_TAC[arith `(i+4)+k = (i+k)+4`]; + BY(DISCH_THEN (unlist REWRITE_TAC)); + TYPIFY `p` EXISTS_TAC; + CONJ_TAC; + NUM_REDUCE_TAC; + FIRST_ASSUM_ST `periodic` MP_TAC THEN REWRITE_TAC[Oxl_def.periodic]; + REWRITE_TAC[arith `(i+4)+k = (i+k)+4`]; + BY(DISCH_THEN (unlist REWRITE_TAC)); + NUM_REDUCE_TAC; + REWRITE_TAC[arith `3+p = SUC(SUC(SUC p))`;SUM_CLAUSES_NUMSEG;SUM_SING_NUMSEG;arith `p <= SUC p /\ p <= SUC (SUC p) /\ p <= SUC(SUC(SUC p))`]; + REWRITE_TAC[arith `SUC i = i+1`;arith `(i + j) + (k:num) = i+(j+k)`]; + NUM_REDUCE_TAC; + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM (C INTRO_TAC [`t`])) THEN ASM_REWRITE_TAC[] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `rho_fun` MP_TAC THEN ASM_REWRITE_TAC[Appendix.rho_rho_fun]; + TYPIFY `f (v(p+1)) t = v(p+1) /\ f (v (p+2)) t = v(p+2) /\ f(v (p+3)) t = v(p+3)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `~(w = v p) ==> a` (REPEAT o GMATCH_SIMP_TAC); + BY(ASM_REWRITE_TAC[] THEN REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + POP_ASSUM (fun t -> ASM_TAC THEN unlist REWRITE_TAC t THEN REPEAT DISCH_TAC THEN ASSUME_TAC t); + FIRST_X_ASSUM_ST `azim` MP_TAC; + FIRST_X_ASSUM_ST `azim` MP_TAC THEN BURY_MP_TAC; + FIRST_ASSUM_ST `azim` ((unlist REWRITE_TAC) o GSYM); + FIRST_ASSUM_ST `azim (vec 0) (v (p + 3)) (f (v p) t) (v (p + 2))` ((unlist REWRITE_TAC) o GSYM); + REWRITE_TAC[arith `(a+b)+c = a + b + c`]; + REWRITE_TAC[arith `r0 * (a013) + r1 * (a123 + a130) + r2 * a231 + r3 * (a301+a312) <= r0 * (f013) + r1 * (a123 + f130) + r2 * a231 + r3 *(f301 +a312) <=> r0 * a013 + r1*a130 + r3* a301 <= r0 * f013 + r1 * f130 + r3 * f301`]; + MATCH_MP_TAC (arith `a - (pi+sol0) = a' /\ b - (pi+sol0) = b' ==> (a <= b ==> a' <= b')`); + REWRITE_TAC[arith `(a + b+c) - (pi + sol0) = a + b + c - (pi + sol0)`]; + CONJ_TAC; + GMATCH_SIMP_TAC (GSYM Cuxvzoz.tau3_azim); + GMATCH_SIMP_TAC Cuxvzoz.tau3_taum_nonplanar; + ASM_REWRITE_TAC[]; + REWRITE_TAC[DIST_SYM]; + BY(MESON_TAC[Terminal.taum_sym]); + FIRST_X_ASSUM_ST `norm a = norm b` (SUBST1_TAC o GSYM); + FIRST_X_ASSUM_ST `dist s + t` (SUBST1_TAC o GSYM); + GMATCH_SIMP_TAC (GSYM Cuxvzoz.tau3_azim); + GMATCH_SIMP_TAC Cuxvzoz.tau3_taum_nonplanar; + REWRITE_TAC[DIST_SYM]; + REWRITE_TAC[CONJ_ASSOC] THEN CONJ2_TAC; + ASM_REWRITE_TAC[DIST_SYM]; + BY(MESON_TAC[Terminal.taum_sym]); + ASM_REWRITE_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + BY(FIRST_X_ASSUM_ST `azim (vec 0) (f (v p) t) (v (p + 1)) (v (p + 3)) < pi` MP_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let LEMMA_PWE1 = prove_by_refinement( +(* main_work4 ==> *) ` main_nonlinear_terminal_v11 ==> (!s v p. + is_scs_v39 s /\ scs_basic_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4*h0 < scs_b_v39 s i j) /\ + (!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/ + (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) /\ + scs_generic v /\ + ~scs_is_str s v (p+1) /\ ~scs_is_str s v (p+3) /\ + scs_is_str s v p /\ norm (v p) = &2 /\ + scs_a_v39 s p (p+1) = &2 /\ + scs_a_v39 s (p+3) (p) = &2 /\ + dist(v (p+1),v(p+2)) <= &2 * h0 ==> + pi / &2 < dihV (vec 0) (v (p+1)) (v (p+2)) (v p))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `x < y <=> ~(y <= x)`] THEN DISCH_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `BBprime2_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.scs_basic;Ayqjtmd.unadorned_MMs;IN]); + TYPIFY `BBprime_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime2_v39]); + TYPIFY `BBs_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime_v39]); + INTRO_TAC Appendix.BBs_v39 [`s`;`v`]; + ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;Terminal.IMAGE_SUBSET_IN;IN_UNIV;arith `~(4 <= 3)`]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `V = IMAGE v (:num)`; + TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`; + TYPED_ABBREV_TAC `FF = IMAGE (\i. (v i,v (SUC i))) (:num)`; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + EXPAND_TAC "V"; + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`4`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!i. interior_angle1 (vec 0) FF (v i) = azim (vec 0) (v i) (v (i+1)) (v (i+3))` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + EXPAND_TAC "FF"; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] (GSYM Ocbicby.INTERIOR_ANGLE1_AZIM)); + TYPIFY `s` EXISTS_TAC; + BY(ASM_REWRITE_TAC[IN;arith `4 - 1 = 3`;arith `3 < 4`;arith `SUC i = i+1`]); + INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`]; + ASM_REWRITE_TAC[LET_THM;IN;arith `4-1 = 3`;arith `SUC i = i+1`]; + DISCH_TAC; + TYPIFY `!i. v (i MOD 4) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[arith `~(0=4)`]); + TYPIFY `v 4 = v 0 /\ v 5 = v 1 /\ v 6 = v 2 /\ v 7 = v 3 /\ v 8 = v 4` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM ((unlist ONCE_REWRITE_TAC) o GSYM); + BY(REWRITE_TAC[Terminal.MOD_4_EXPLICIT;arith `7 = 1*4 + 3`;arith `8 = 2*4 + 0`;MOD_MULT_ADD]); + TYPIFY `generic V E` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `scs_generic` MP_TAC THEN ASM_REWRITE_TAC[Appendix.scs_generic]); + TYPIFY `v (p+4) = v p /\ v (p+5) = v (p+1) /\ v (p+6) = v (p+2) /\ v (p+7) = v (p+3) /\ v (p+8) = v (p)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `MOD` ((unlist ONCE_REWRITE_TAC) o GSYM); + BY(REWRITE_TAC[arith `p+4 = 1*4 + p /\ p+5 = 1*4+(p+1) /\ p+6=1*4+(p+2) /\ p+7 = 1*4 + (p+3) /\ p+8 = 2*4 + p`;MOD_MULT_ADD]); + TYPIFY `!i. &2 <= norm (v i) /\ norm (v i) <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + REWRITE_TAC[GSYM Fnjlbxs.in_ball_annulus]; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> &2 <= dist(v (p + i),v (p+j))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Ocbicby.scs_lb_2; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + (NUM_REDUCE_TAC); + REPEAT (GMATCH_SIMP_TAC MOD_LT); + BY(ASM_REWRITE_TAC[]); + TYPIFY `scs_b_v39 s (p+2) ((p+2)+1) <= cstab /\ scs_b_v39 s p (p+1) = &2 * h0 /\ scs_b_v39 s (p+3) ((p+3)+1) = &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); + CONJ2_TAC; + TYPIFY `~(&2 = &2 * h0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + TYPIFY `scs_a_v39 s (p+3) p = scs_a_v39 s (p+3) ((p+3)+1)` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[arith `((p+3)+1) = p+4`]; + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[Appendix.periodic2;Oxl_def.periodic]); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `x <= cstab` (C INTRO_TAC [`p+2`]) THEN ASM_REWRITE_TAC[arith `3 < 4`]; + BY(REWRITE_TAC[arith `SUC (p+2) = (p+2)+1`]); + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[arith `((p:num) + i ) + j = p + (i+j)`] THEN NUM_REDUCE_TAC; + DISCH_TAC; + TYPIFY `dist(v (p+2),v(p+3)) <= cstab /\ dist(v p,v(p+1)) <= &2 * h0 /\ dist(v(p+3),v(p+4)) <= &2 * h0` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM MP_TAC; + FIRST_X_ASSUM_ST `scs_b_v39` MP_TAC; + BY(MESON_TAC[REAL_LE_TRANS]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "collinear"; + TYPIFY `!i j. ~(v i = v j) ==> ~collinear {vec 0,v i, v j}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT GEN_TAC THEN DISCH_TAC; + MATCH_MP_TAC Zlzthic.PROPERTIES_GENERIC_LOCAL_FAN_ALT; + GEXISTL_TAC [`V`;`E`;`FF`]; + BY(ASM_REWRITE_TAC[IN_IMAGE;IN_UNIV]); + TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 20 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + INTRO_TAC PERIODIC_INJ_MOD [`v`;`4`]; + ASM_REWRITE_TAC[arith `~(4 = 0)`]; + DISCH_TAC; + TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i=j) ==> ~(v (p +i) = v (p+j))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + (NUM_REDUCE_TAC); + REPEAT (GMATCH_SIMP_TAC MOD_LT); + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. 0 < i /\ i < 4 ==> ~(v (p+i) = v p)` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[arith `p+0 = p`;arith `0< 4`;arith `0 < i ==> ~(i=0)`]); + TYPIFY `#3.3 <= dist(v (p+2),v p)` ASM_CASES_TAC; + COMMENT "long diag"; + INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "6184614449") [`norm (v (p+1))`;`norm(v (p+2))`;`norm(v p)`;`dist(v(p+2),v p)`;`dist(v(p+1),v p)`;`dist(v(p+1),v(p+2))`]; + FIRST_X_ASSUM_ST `norm x = &2` kill; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + ASM_REWRITE_TAC[]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + CONJ_TAC; + INTRO_TAC DIST_TRIANGLE [`v (p+2)`;`(vec 0):real^3`;`v (p)`]; + REWRITE_TAC[DIST_0]; + MATCH_MP_TAC (arith `x <= &2 * h0 /\ y <= &2 * h0 ==> (d <= x + y ==> d <= &4 * h0)`); + BY(ASM_REWRITE_TAC[]); + nCONJ_TAC 1; + BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + TYPIFY `v p = v (p+0)` (C SUBGOAL_THEN SUBST1_TAC); + ONCE_REWRITE_TAC[arith `p+0=p`]; + BY(REWRITE_TAC[]); + BY(CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + DISCH_TAC; + FIRST_X_ASSUM_ST `dihV` MP_TAC; + REWRITE_TAC[arith `~(x <= y) <=> y < x`]; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Merge_ineq.DIHV_EQ_DIH_Y); + ASM_REWRITE_TAC[DIST_0]; + CONJ_TAC; + BY(CONJ_TAC THEN (REPEAT (FIRST_X_ASSUM MATCH_MP_TAC)) THEN NUM_REDUCE_TAC); + MATCH_MP_TAC Ocbicby.delta4_y_imp_obtuse; + CONJ_TAC; + BY(ASM_MESON_TAC[arith `&2 <= x==> &0 < x`]); + CONJ_TAC; + BY(REWRITE_TAC[REWRITE_RULE[LET_THM] Tame_lemmas.delta_y_pos]); + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. ~scs_is_str s v i ==> ~coplanar {vec 0, v i, v(i+1), v(i+3)}` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC THEN ASM_REWRITE_TAC[Appendix.scs_is_str;arith `SUC i = i+1`;GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; + NUM_REDUCE_TAC; + DISCH_THEN (unlist REWRITE_TAC); + MATCH_MP_TAC (arith `&0 < a ==> ~(a = &0)`); + INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`;`i`]; + BY(ASM_REWRITE_TAC[LET_THM;IN;arith `SUC i = i+1`;arith `4 - 1 = 3`]); + FIRST_X_ASSUM MP_TAC THEN BURY_MP_TAC; + COMMENT "short diag"; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`4`;`p`;`2`;`3`]; + ASM_REWRITE_TAC[arith `SUC p = p+1`;LET_THM]; + NUM_REDUCE_TAC; + DISCH_TAC; + TYPIFY `azim (vec 0) (v p) (v (p+1)) (v (p+3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); + MATCH_MP_TAC Local_lemmas.CONVEX_LOFA_IMP_INANGLE_LE_PI; + BY(ASM_REWRITE_TAC[]); + TYPIFY `azim (vec 0) (v p) (v (p + 1)) (v (p + 2)) <= pi /\ azim (vec 0) (v p) (v (p + 2)) (v (p + 3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC (arith `&0 < pi /\ &0 <= a /\ &0 <= b /\ a + b <= pi ==> a <= pi /\ b <= pi`); + REWRITE_TAC[PI_POS]; + REWRITE_TAC[Counting_spheres.AZIM_NN]; + BY(REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `scs_is_str` MP_TAC; + REWRITE_TAC[Appendix.scs_is_str]; + ASM_REWRITE_TAC[]; + NUM_REDUCE_TAC; + REWRITE_TAC[arith `SUC p = p+1`]; + DISCH_THEN (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + INTRO_TAC AZIM_DIHV_SAME_STRONG [`(vec 0):real^3`;`v p`;`v (p+2)`;`v (p+3)`]; + INTRO_TAC AZIM_DIHV_SAME_STRONG [`(vec 0):real^3`;`v p`;`v (p+1)`;`v (p+2)`]; + FIRST_X_ASSUM_ST `pi = a` (MP_TAC o SYM) THEN DISCH_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `~collinear {vec 0, v p, v (p + 1)} /\ ~collinear {vec 0, v p, v (p + 2)} /\ ~collinear {vec 0, v p, v (p + 3)}` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `dihV` MP_TAC) THEN REWRITE_TAC[] THEN REPEAT (GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Merge_ineq.DIHV_EQ_DIH_Y)); + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `+` MP_TAC THEN ASM_REWRITE_TAC[]; + (DISCH_TAC); + TYPIFY `cstab <= dist(v p,v(p+2))` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `cstab < d` (C INTRO_TAC [`p`;`p+2`]); + ANTS_TAC; + REWRITE_TAC[arith `p+2 = SUC(SUC (p))`]; + MATCH_MP_TAC Tfitskc.SCS_DIAG_2; + BY(NUM_REDUCE_TAC); + BY(REAL_ARITH_TAC); + INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "1348932091 delta") [`norm (v (p))`;`norm(v (p+1))`;`norm(v (p+2))`;`&2 * h0`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+1))`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + TYPIFY `(&2 <= norm (v p) /\ norm (v p) <= &2) /\ (&2 <= norm (v (p + 1)) /\ norm (v (p + 1)) <= #2.52) /\ (&2 <= norm (v (p + 2)) /\ norm (v (p + 2)) <= #2.52) /\ ( #2.52 <= &2 * h0 /\ &2 * h0 <= #2.52) /\ ( #3.01 <= dist (v p,v (p + 2)) /\ dist (v p,v (p + 2)) <= #3.3) /\ &2 <= dist (v p,v (p + 1)) /\ dist (v p,v (p + 1)) <= #2.52` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `#2.52 = &2 * h0` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[arith `(x <= y /\ y <= x) <=> y = x`]; + CONJ2_TAC; + FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`0`;`1`]); + BY(REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN MATCH_MP_TAC THEN NUM_REDUCE_TAC); + CONJ2_TAC; + BY(FIRST_X_ASSUM_ST `#3.3` MP_TAC THEN REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[GSYM Sphere.cstab]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "1348932091") [`norm (v (p))`;`norm(v (p+1))`;`norm(v (p+2))`;`&2 * h0`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+1))`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + FIRST_X_ASSUM_ST `#3.01` (unlist REWRITE_TAC); + DISCH_TAC; + INTRO_TAC Ocbicby.dih_y_mono [`norm (v (p))`;`norm(v (p+1))`;`norm(v (p+2))`;`dist(v (p+1),v(p+2))`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+1))`;`&2 * h0`]; + ANTS_TAC; + ASM_REWRITE_TAC[arith `&0 < &2`]; + CONJ_TAC; + FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`1`;`2`]); + BY(NUM_REDUCE_TAC THEN REAL_ARITH_TAC); + CONJ2_TAC; + BY(FIRST_X_ASSUM_ST `delta_y` MP_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `norm (v p) = &2` (SUBST1_TAC o GSYM); + FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`p+1`]); + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[arith `(p+1) +i = p+(1+i)`] THEN NUM_REDUCE_TAC; + REWRITE_TAC[Oxlzlez.coplanar_delta_y]; + ASM_REWRITE_TAC[DIST_SYM;DIST_0]; + MATCH_MP_TAC (arith `a = b ==> &0 < a ==> &0 < b`); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + (DISCH_TAC); + COMMENT "5557"; + INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "5557288534 delta") [`norm (v (p))`;`norm(v (p+3))`;`norm(v (p+2))`;`cstab`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+3))`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + TYPIFY `(&2 <= norm (v p) /\ norm (v p) <= &2) /\ (&2 <= norm (v (p + 3)) /\ norm (v (p + 3)) <= #2.52) /\ (&2 <= norm (v (p + 2)) /\ norm (v (p + 2)) <= #2.52) /\ ( #3.01 <= cstab /\ cstab <= #3.01) /\ ( #3.01 <= dist (v p,v (p + 2)) /\ dist (v p,v (p + 2)) <= #3.3) /\ &2 <= dist (v p,v (p + 3)) /\ dist (v p,v (p + 3)) <= #2.52` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `#2.52 = &2 * h0` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[arith `(x <= y /\ y <= x) <=> y = x`;Sphere.cstab]; + CONJ2_TAC; + CONJ_TAC; + FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`0`;`3`]); + BY(REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN MATCH_MP_TAC THEN NUM_REDUCE_TAC); + BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); + CONJ2_TAC; + BY(FIRST_X_ASSUM_ST `#3.3` MP_TAC THEN REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[GSYM Sphere.cstab]); + FIRST_ASSUM (unlist REWRITE_TAC); + DISCH_TAC; + INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "5557288534") [`norm (v (p))`;`norm(v (p+3))`;`norm(v (p+2))`;`cstab`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+3))`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + FIRST_X_ASSUM_ST `#3.01` (unlist REWRITE_TAC); + DISCH_TAC; + INTRO_TAC Ocbicby.dih_y_mono [`norm (v (p))`;`norm(v (p+3))`;`norm(v (p+2))`;`dist(v (p+3),v(p+2))`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+3))`;`cstab`]; + ANTS_TAC; + TYPIFY_GOAL_THEN `&0 < norm (v p)` (unlist REWRITE_TAC); + BY(ASM_REWRITE_TAC[arith `&0 < &2`]); + FIRST_X_ASSUM_ST `norm (v p) = &2` kill; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); + CONJ_TAC; + FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`3`;`2`]); + BY(NUM_REDUCE_TAC THEN REAL_ARITH_TAC); + CONJ2_TAC; + BY(FIRST_X_ASSUM_ST `delta_y` MP_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`p+3`]); + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[arith `(p+3) +i = p+(3+i)`] THEN NUM_REDUCE_TAC; + REWRITE_TAC[Oxlzlez.coplanar_delta_y]; + ASM_REWRITE_TAC[DIST_SYM;DIST_0]; + MATCH_MP_TAC (arith `a = b ==> &0 < a ==> &0 < b`); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + (DISCH_TAC); + TYPIFY `dih_y (norm (v p)) (norm (v (p + 3))) (norm (v (p + 2))) (dist (v (p + 3),v (p + 2))) (dist (v p,v (p + 2))) (dist (v p,v (p + 3))) + dih_y (norm (v p)) (norm (v (p + 1))) (norm (v (p + 2))) (dist (v (p + 1),v (p + 2))) (dist (v p,v (p + 2))) (dist (v p,v (p + 1))) <= #3.1` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `#3.1 < pi` (C SUBGOAL_THEN ASSUME_TAC); + BY(MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `a = pi` MP_TAC THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC); + REWRITE_TAC[DIST_0;DIST_SYM]; + TYPIFY `dih_y (norm (v p)) (norm (v (p + 2))) (norm (v (p + 3))) (dist (v (p + 2),v (p + 3))) (dist (v p,v (p + 3))) (dist (v p,v (p + 2))) = dih_y (norm (v p)) (norm (v (p + 3))) (norm (v (p + 2))) (dist (v (p + 2),v (p + 3))) (dist (v p,v (p + 2))) (dist (v p,v (p + 3)))` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[Nonlinear_lemma.dih_y_sym]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let LEMMA_PWE2 = prove_by_refinement( +(* main_work4 ==> *) ` main_nonlinear_terminal_v11 ==> (!s v p. + is_scs_v39 s /\ scs_basic_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4*h0 < scs_b_v39 s i j) /\ + (!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/ + (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) /\ + scs_generic v /\ + ~scs_is_str s v (p+1) /\ ~scs_is_str s v (p+3) /\ + scs_is_str s v p /\ norm (v p) = &2 /\ + scs_a_v39 s p (p+1) = &2 /\ + scs_a_v39 s (p+3) (p) = &2 /\ + dist(v (p+2),v(p+3)) <= &2 * h0 ==> + pi / &2 < dihV (vec 0) (v (p+3)) (v (p)) (v (p+2)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `x < y <=> ~(y <= x)`] THEN DISCH_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `BBprime2_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.scs_basic;Ayqjtmd.unadorned_MMs;IN]); + TYPIFY `BBprime_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime2_v39]); + TYPIFY `BBs_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime_v39]); + INTRO_TAC Appendix.BBs_v39 [`s`;`v`]; + ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;Terminal.IMAGE_SUBSET_IN;IN_UNIV;arith `~(4 <= 3)`]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `V = IMAGE v (:num)`; + TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`; + TYPED_ABBREV_TAC `FF = IMAGE (\i. (v i,v (SUC i))) (:num)`; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + EXPAND_TAC "V"; + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`4`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!i. interior_angle1 (vec 0) FF (v i) = azim (vec 0) (v i) (v (i+1)) (v (i+3))` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + EXPAND_TAC "FF"; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] (GSYM Ocbicby.INTERIOR_ANGLE1_AZIM)); + TYPIFY `s` EXISTS_TAC; + BY(ASM_REWRITE_TAC[IN;arith `4 - 1 = 3`;arith `3 < 4`;arith `SUC i = i+1`]); + INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`]; + ASM_REWRITE_TAC[LET_THM;IN;arith `4-1 = 3`;arith `SUC i = i+1`]; + DISCH_TAC; + TYPIFY `!i. v (i MOD 4) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[arith `~(0=4)`]); + TYPIFY `v 4 = v 0 /\ v 5 = v 1 /\ v 6 = v 2 /\ v 7 = v 3 /\ v 8 = v 4` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM ((unlist ONCE_REWRITE_TAC) o GSYM); + BY(REWRITE_TAC[Terminal.MOD_4_EXPLICIT;arith `7 = 1*4 + 3`;arith `8 = 2*4 + 0`;MOD_MULT_ADD]); + TYPIFY `generic V E` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `scs_generic` MP_TAC THEN ASM_REWRITE_TAC[Appendix.scs_generic]); + TYPIFY `v (p+4) = v p /\ v (p+5) = v (p+1) /\ v (p+6) = v (p+2) /\ v (p+7) = v (p+3) /\ v (p+8) = v (p)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `MOD` ((unlist ONCE_REWRITE_TAC) o GSYM); + BY(REWRITE_TAC[arith `p+4 = 1*4 + p /\ p+5 = 1*4+(p+1) /\ p+6=1*4+(p+2) /\ p+7 = 1*4 + (p+3) /\ p+8 = 2*4 + p`;MOD_MULT_ADD]); + TYPIFY `!i. &2 <= norm (v i) /\ norm (v i) <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + REWRITE_TAC[GSYM Fnjlbxs.in_ball_annulus]; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> &2 <= dist(v (p + i),v (p+j))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Ocbicby.scs_lb_2; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + (NUM_REDUCE_TAC); + REPEAT (GMATCH_SIMP_TAC MOD_LT); + BY(ASM_REWRITE_TAC[]); + COMMENT "edge lengths"; + TYPIFY `scs_b_v39 s (p+1) ((p+1)+1) <= cstab /\ scs_b_v39 s p (p+1) = &2 * h0 /\ scs_b_v39 s (p+3) ((p+3)+1) = &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); + CONJ2_TAC; + TYPIFY `~(&2 = &2 * h0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + TYPIFY `scs_a_v39 s (p+3) p = scs_a_v39 s (p+3) ((p+3)+1)` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[arith `((p+3)+1) = p+4`]; + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[Appendix.periodic2;Oxl_def.periodic]); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `x <= cstab` (C INTRO_TAC [`p+1`]) THEN ASM_REWRITE_TAC[arith `3 < 4`]; + BY(REWRITE_TAC[arith `SUC (p+1) = (p+1)+1`]); + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[arith `((p:num) + i ) + j = p + (i+j)`] THEN NUM_REDUCE_TAC; + DISCH_TAC; + TYPIFY `dist(v (p+1),v(p+2)) <= cstab /\ dist(v p,v(p+1)) <= &2 * h0 /\ dist(v(p+3),v(p+4)) <= &2 * h0` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM MP_TAC; + FIRST_X_ASSUM_ST `scs_b_v39` MP_TAC; + BY(MESON_TAC[REAL_LE_TRANS]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "collinear"; + TYPIFY `!i j. ~(v i = v j) ==> ~collinear {vec 0,v i, v j}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT GEN_TAC THEN DISCH_TAC; + MATCH_MP_TAC Zlzthic.PROPERTIES_GENERIC_LOCAL_FAN_ALT; + GEXISTL_TAC [`V`;`E`;`FF`]; + BY(ASM_REWRITE_TAC[IN_IMAGE;IN_UNIV]); + TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 20 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + INTRO_TAC PERIODIC_INJ_MOD [`v`;`4`]; + ASM_REWRITE_TAC[arith `~(4 = 0)`]; + DISCH_TAC; + TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i=j) ==> ~(v (p +i) = v (p+j))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + (NUM_REDUCE_TAC); + REPEAT (GMATCH_SIMP_TAC MOD_LT); + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. 0 < i /\ i < 4 ==> ~(v (p+i) = v p)` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[arith `p+0 = p`;arith `0< 4`;arith `0 < i ==> ~(i=0)`]); + COMMENT "long diag"; + TYPIFY `#3.3 <= dist(v (p+2),v p)` ASM_CASES_TAC; + COMMENT "long diag"; + INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "6184614449") [`norm (v (p+3))`;`norm(v (p+2))`;`norm(v p)`;`dist(v(p+2),v p)`;`dist(v(p+3),v p)`;`dist(v(p+3),v(p+2))`]; + FIRST_X_ASSUM_ST `norm x = &2` kill; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + ASM_REWRITE_TAC[]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + CONJ_TAC; + INTRO_TAC DIST_TRIANGLE [`v (p+2)`;`(vec 0):real^3`;`v (p)`]; + REWRITE_TAC[DIST_0]; + MATCH_MP_TAC (arith `x <= &2 * h0 /\ y <= &2 * h0 ==> (d <= x + y ==> d <= &4 * h0)`); + BY(ASM_REWRITE_TAC[]); + nCONJ_TAC 2; + BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + TYPIFY `v p = v (p+0)` (C SUBGOAL_THEN SUBST1_TAC); + ONCE_REWRITE_TAC[arith `p+0=p`]; + BY(REWRITE_TAC[]); + BY(CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + DISCH_TAC; + FIRST_X_ASSUM_ST `dihV` MP_TAC; + REWRITE_TAC[arith `~(x <= y) <=> y < x`]; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Merge_ineq.DIHV_EQ_DIH_Y); + ASM_REWRITE_TAC[DIST_0]; + CONJ_TAC; + BY(CONJ_TAC THEN (REPEAT (FIRST_X_ASSUM MATCH_MP_TAC)) THEN NUM_REDUCE_TAC); + ONCE_REWRITE_TAC[Nonlinear_lemma.dih_y_sym]; + MATCH_MP_TAC Ocbicby.delta4_y_imp_obtuse; + CONJ_TAC; + BY(ASM_MESON_TAC[arith `&2 <= x==> &0 < x`]); + INTRO_TAC DIST_SYM [`v p`;`v (p+2)`]; + DISCH_THEN SUBST1_TAC; + CONJ_TAC; + BY(REWRITE_TAC[REWRITE_RULE[LET_THM] Tame_lemmas.delta_y_pos]); + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. ~scs_is_str s v i ==> ~coplanar {vec 0, v i, v(i+1), v(i+3)}` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC THEN ASM_REWRITE_TAC[Appendix.scs_is_str;arith `SUC i = i+1`;GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; + NUM_REDUCE_TAC; + DISCH_THEN (unlist REWRITE_TAC); + MATCH_MP_TAC (arith `&0 < a ==> ~(a = &0)`); + INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`;`i`]; + BY(ASM_REWRITE_TAC[LET_THM;IN;arith `SUC i = i+1`;arith `4 - 1 = 3`]); + FIRST_X_ASSUM MP_TAC THEN BURY_MP_TAC; + COMMENT "short diag"; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`4`;`p`;`2`;`3`]; + ASM_REWRITE_TAC[arith `SUC p = p+1`;LET_THM]; + NUM_REDUCE_TAC; + DISCH_TAC; + TYPIFY `azim (vec 0) (v p) (v (p+1)) (v (p+3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); + MATCH_MP_TAC Local_lemmas.CONVEX_LOFA_IMP_INANGLE_LE_PI; + BY(ASM_REWRITE_TAC[]); + TYPIFY `azim (vec 0) (v p) (v (p + 1)) (v (p + 2)) <= pi /\ azim (vec 0) (v p) (v (p + 2)) (v (p + 3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC (arith `&0 < pi /\ &0 <= a /\ &0 <= b /\ a + b <= pi ==> a <= pi /\ b <= pi`); + REWRITE_TAC[PI_POS]; + REWRITE_TAC[Counting_spheres.AZIM_NN]; + BY(REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `scs_is_str` MP_TAC; + REWRITE_TAC[Appendix.scs_is_str]; + ASM_REWRITE_TAC[]; + NUM_REDUCE_TAC; + REWRITE_TAC[arith `SUC p = p+1`]; + DISCH_THEN (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + INTRO_TAC AZIM_DIHV_SAME_STRONG [`(vec 0):real^3`;`v p`;`v (p+2)`;`v (p+3)`]; + INTRO_TAC AZIM_DIHV_SAME_STRONG [`(vec 0):real^3`;`v p`;`v (p+1)`;`v (p+2)`]; + FIRST_X_ASSUM_ST `pi = a` (MP_TAC o SYM) THEN DISCH_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `~collinear {vec 0, v p, v (p + 1)} /\ ~collinear {vec 0, v p, v (p + 2)} /\ ~collinear {vec 0, v p, v (p + 3)}` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `dihV` MP_TAC) THEN REWRITE_TAC[] THEN REPEAT (GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Merge_ineq.DIHV_EQ_DIH_Y)); + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `+` MP_TAC THEN ASM_REWRITE_TAC[]; + (DISCH_TAC); + TYPIFY `cstab <= dist(v p,v(p+2))` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `cstab < d` (C INTRO_TAC [`p`;`p+2`]); + ANTS_TAC; + REWRITE_TAC[arith `p+2 = SUC(SUC (p))`]; + MATCH_MP_TAC Tfitskc.SCS_DIAG_2; + BY(NUM_REDUCE_TAC); + BY(REAL_ARITH_TAC); + INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "1348932091 delta") [`norm (v (p))`;`norm(v (p+3))`;`norm(v (p+2))`;`&2 * h0`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+3))`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + TYPIFY `(&2 <= norm (v p) /\ norm (v p) <= &2) /\ (&2 <= norm (v (p + 3)) /\ norm (v (p + 3)) <= #2.52) /\ (&2 <= norm (v (p + 2)) /\ norm (v (p + 2)) <= #2.52) /\ ( #2.52 <= &2 * h0 /\ &2 * h0 <= #2.52) /\ ( #3.01 <= dist (v p,v (p + 2)) /\ dist (v p,v (p + 2)) <= #3.3) /\ &2 <= dist (v p,v (p + 3)) /\ dist (v p,v (p + 3)) <= #2.52` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `#2.52 = &2 * h0` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[arith `(x <= y /\ y <= x) <=> y = x`]; + nCONJ_TAC 3; + BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + CONJ2_TAC; + FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`0`;`3`]); + BY(REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN MATCH_MP_TAC THEN NUM_REDUCE_TAC); + CONJ2_TAC; + BY(FIRST_X_ASSUM_ST `#3.3` MP_TAC THEN REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[GSYM Sphere.cstab]); + FIRST_X_ASSUM_ST `norm x = &2` MP_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "1348932091") [`norm (v (p))`;`norm(v (p+3))`;`norm(v (p+2))`;`&2 * h0`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+3))`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + FIRST_X_ASSUM_ST `#3.01` (unlist REWRITE_TAC); + DISCH_TAC; + INTRO_TAC Ocbicby.dih_y_mono [`norm (v (p))`;`norm(v (p+3))`;`norm(v (p+2))`;`dist(v (p+3),v(p+2))`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+3))`;`&2 * h0`]; + ANTS_TAC; + nCONJ_TAC 1; + BY(FIRST_X_ASSUM_ST `norm x = &2` MP_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `norm x = &2` kill; + ASM_REWRITE_TAC[arith `&0 < &2`]; + CONJ_TAC; + BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); + CONJ_TAC; + FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`3`;`2`]); + BY(NUM_REDUCE_TAC THEN REAL_ARITH_TAC); + CONJ2_TAC; + BY(FIRST_X_ASSUM_ST `delta_y` MP_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`p+3`]); + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[arith `(p+3) +i = p+(3+i)`] THEN NUM_REDUCE_TAC; + REWRITE_TAC[Oxlzlez.coplanar_delta_y]; + ASM_REWRITE_TAC[DIST_SYM;DIST_0]; + MATCH_MP_TAC (arith `a = b ==> &0 < a ==> &0 < b`); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + (DISCH_TAC); + COMMENT "5557"; + INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "5557288534 delta") [`norm (v (p))`;`norm(v (p+1))`;`norm(v (p+2))`;`cstab`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+1))`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + TYPIFY `(&2 <= norm (v p) /\ norm (v p) <= &2) /\ (&2 <= norm (v (p + 1)) /\ norm (v (p + 1)) <= #2.52) /\ (&2 <= norm (v (p + 2)) /\ norm (v (p + 2)) <= #2.52) /\ ( #3.01 <= cstab /\ cstab <= #3.01) /\ ( #3.01 <= dist (v p,v (p + 2)) /\ dist (v p,v (p + 2)) <= #3.3) /\ &2 <= dist (v p,v (p + 1)) /\ dist (v p,v (p + 1)) <= #2.52` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `#2.52 = &2 * h0` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[arith `(x <= y /\ y <= x) <=> y = x`;Sphere.cstab]; + CONJ2_TAC; + FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`0`;`1`]); + BY(REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN MATCH_MP_TAC THEN NUM_REDUCE_TAC); + CONJ2_TAC; + BY(FIRST_X_ASSUM_ST `#3.3` MP_TAC THEN REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[GSYM Sphere.cstab]); + FIRST_ASSUM (unlist REWRITE_TAC); + DISCH_TAC; + INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "5557288534") [`norm (v (p))`;`norm(v (p+1))`;`norm(v (p+2))`;`cstab`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+1))`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + FIRST_X_ASSUM_ST `#3.01` (unlist REWRITE_TAC); + DISCH_TAC; + INTRO_TAC Ocbicby.dih_y_mono [`norm (v (p))`;`norm(v (p+1))`;`norm(v (p+2))`;`dist(v (p+1),v(p+2))`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+1))`;`cstab`]; + ANTS_TAC; + TYPIFY_GOAL_THEN `&0 < norm (v p)` (unlist REWRITE_TAC); + BY(ASM_REWRITE_TAC[arith `&0 < &2`]); + FIRST_X_ASSUM_ST `norm (v p) = &2` kill; + ASM_REWRITE_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`1`;`2`]); + BY(NUM_REDUCE_TAC THEN REAL_ARITH_TAC); + CONJ2_TAC; + BY(FIRST_X_ASSUM_ST `delta_y` MP_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`p+1`]); + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[arith `(p+1) +i = p+(1+i)`] THEN NUM_REDUCE_TAC; + REWRITE_TAC[Oxlzlez.coplanar_delta_y]; + ASM_REWRITE_TAC[DIST_SYM;DIST_0]; + MATCH_MP_TAC (arith `a = b ==> &0 < a ==> &0 < b`); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + (DISCH_TAC); + TYPIFY `dih_y (norm (v p)) (norm (v (p + 3))) (norm (v (p + 2))) (dist (v (p + 3),v (p + 2))) (dist (v p,v (p + 2))) (dist (v p,v (p + 3))) + dih_y (norm (v p)) (norm (v (p + 1))) (norm (v (p + 2))) (dist (v (p + 1),v (p + 2))) (dist (v p,v (p + 2))) (dist (v p,v (p + 1))) < #3.1` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `#3.1 < pi` (C SUBGOAL_THEN ASSUME_TAC); + BY(MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `a = pi` MP_TAC THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC); + REWRITE_TAC[DIST_0;DIST_SYM]; + TYPIFY `dih_y (norm (v p)) (norm (v (p + 2))) (norm (v (p + 3))) (dist (v (p + 2),v (p + 3))) (dist (v p,v (p + 3))) (dist (v p,v (p + 2))) = dih_y (norm (v p)) (norm (v (p + 3))) (norm (v (p + 2))) (dist (v (p + 2),v (p + 3))) (dist (v p,v (p + 2))) (dist (v p,v (p + 3)))` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[Nonlinear_lemma.dih_y_sym]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let LINDIH_11 = prove_by_refinement( + (* main_work4 ==> *) `main_nonlinear_terminal_v11 ==> + (!y1 y2 y3 y4 y5 y6. + ineq + [ + (&2,y1,&2); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.55); + (&2 * h0,y6,#3.01)] + ((dih_y y1 y2 y3 y4 y5 y6 < #1.1) \/ delta_y y1 y2 y3 y4 y5 y6 < &0))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `delta_y y1 y2 y3 y4 y5 y6 < &0` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + REWRITE_TAC[Sphere.dih_y;LET_THM]; + GMATCH_SIMP_TAC Merge_ineq.lindih_lt; + REWRITE_TAC[GSYM CONJ_ASSOC]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + CONJ_TAC; + BY(MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC); + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "9368433105") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;LET_THM]; + REWRITE_TAC[Sphere.delta4_y;Sphere.y_of_x]; + DISCH_TAC; + INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "8405387449") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;LET_THM]; + ASM_SIMP_TAC [arith `d > &0 ==> &0 < d`]; + DISCH_TAC; + TYPIFY `&0 <= (&4 * (y1 * y1) * delta_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT (GMATCH_SIMP_TAC REAL_LE_MUL); + FIRST_X_ASSUM_ST `delta_y` MP_TAC THEN REWRITE_TAC[Sphere.delta_y]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC Pack1.bp_bdt; + GMATCH_SIMP_TAC SQRT_POS_LE; + ASM_REWRITE_TAC[]; + CONJ_TAC; + GMATCH_SIMP_TAC REAL_LE_MUL; + GMATCH_SIMP_TAC TAN_POS_PI2_LE; + ASM_SIMP_TAC[arith `x > &0 ==> &0 <= x`]; + BY(MP_TAC Flyspeck_constants.bounds THEN ASM_TAC THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC SQRT_POW_2; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LT_TRANS; + TYPIFY `#3.86 * delta4_squared_y y1 y2 y3 y4 y5 y6` EXISTS_TAC; + CONJ_TAC; + FIRST_X_ASSUM_ST `x1_delta_y` MP_TAC; + BY(REWRITE_TAC[Sphere.x1_delta_y;Sphere.delta4_squared_y;Sphere.y_of_x;Sphere.x1_delta_x]); + REWRITE_TAC[Sphere.delta4_squared_y;Sphere.y_of_x;Sphere.delta4_squared_x]; + REWRITE_TAC[arith `(x * y) pow 2 = x pow 2 * y pow 2`]; + GMATCH_SIMP_TAC REAL_LT_RMUL_EQ; + CONJ_TAC; + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `#3.86 = sqrt(#3.86) pow 2` (C SUBGOAL_THEN SUBST1_TAC); + GMATCH_SIMP_TAC SQRT_POW_2; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC Tame_inequalities.REAL_LT_SQUARE_POS; + GMATCH_SIMP_TAC SQRT_POS_LT; + CONJ_TAC; + BY(REAL_ARITH_TAC); + TYPIFY `atn(sqrt #3.86) < atn(tan #1.1)` ENOUGH_TO_SHOW_TAC; + BY(REWRITE_TAC[ATN_MONO_LT_EQ]); + GMATCH_SIMP_TAC TAN_ATN; + CONJ_TAC; + BY(MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[Flyspeck_constants.calc `atn (sqrt #3.86) < #1.1`]) + ]);; + (* }}} *) + +let LEMMA_PWE3 = prove_by_refinement( +(* main_work4 ==> *) ` main_nonlinear_terminal_v11 ==> (!s v p. + is_scs_v39 s /\ scs_basic_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4*h0 < scs_b_v39 s i j) /\ + (!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/ + (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) /\ + scs_generic v /\ + ~scs_is_str s v (p+1) /\ ~scs_is_str s v (p+3) /\ + scs_is_str s v p /\ norm (v p) = &2 /\ + scs_a_v39 s p (p+1) = &2 /\ + scs_a_v39 s (p+3) (p) = &2 * h0 /\ + dist(v (p+2),v(p+3)) = &2 /\ + &2 * h0 <= dist(v(p+1),v(p+2)) ==> + pi / &2 < dihV (vec 0) (v (p+1)) (v (p)) (v (p+2)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `x < y <=> ~(y <= x)`] THEN DISCH_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `BBprime2_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.scs_basic;Ayqjtmd.unadorned_MMs;IN]); + TYPIFY `BBprime_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime2_v39]); + TYPIFY `BBs_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime_v39]); + INTRO_TAC Appendix.BBs_v39 [`s`;`v`]; + ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;Terminal.IMAGE_SUBSET_IN;IN_UNIV;arith `~(4 <= 3)`]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `V = IMAGE v (:num)`; + TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`; + TYPED_ABBREV_TAC `FF = IMAGE (\i. (v i,v (SUC i))) (:num)`; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + EXPAND_TAC "V"; + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`4`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!i. interior_angle1 (vec 0) FF (v i) = azim (vec 0) (v i) (v (i+1)) (v (i+3))` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + EXPAND_TAC "FF"; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] (GSYM Ocbicby.INTERIOR_ANGLE1_AZIM)); + TYPIFY `s` EXISTS_TAC; + BY(ASM_REWRITE_TAC[IN;arith `4 - 1 = 3`;arith `3 < 4`;arith `SUC i = i+1`]); + INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`]; + ASM_REWRITE_TAC[LET_THM;IN;arith `4-1 = 3`;arith `SUC i = i+1`]; + DISCH_TAC; + TYPIFY `!i. v (i MOD 4) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[arith `~(0=4)`]); + TYPIFY `v 4 = v 0 /\ v 5 = v 1 /\ v 6 = v 2 /\ v 7 = v 3 /\ v 8 = v 4` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM ((unlist ONCE_REWRITE_TAC) o GSYM); + BY(REWRITE_TAC[Terminal.MOD_4_EXPLICIT;arith `7 = 1*4 + 3`;arith `8 = 2*4 + 0`;MOD_MULT_ADD]); + TYPIFY `generic V E` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `scs_generic` MP_TAC THEN ASM_REWRITE_TAC[Appendix.scs_generic]); + TYPIFY `v (p+4) = v p /\ v (p+5) = v (p+1) /\ v (p+6) = v (p+2) /\ v (p+7) = v (p+3) /\ v (p+8) = v (p)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `MOD` ((unlist ONCE_REWRITE_TAC) o GSYM); + BY(REWRITE_TAC[arith `p+4 = 1*4 + p /\ p+5 = 1*4+(p+1) /\ p+6=1*4+(p+2) /\ p+7 = 1*4 + (p+3) /\ p+8 = 2*4 + p`;MOD_MULT_ADD]); + TYPIFY `!i. &2 <= norm (v i) /\ norm (v i) <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + REWRITE_TAC[GSYM Fnjlbxs.in_ball_annulus]; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> &2 <= dist(v (p + i),v (p+j))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Ocbicby.scs_lb_2; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + (NUM_REDUCE_TAC); + REPEAT (GMATCH_SIMP_TAC MOD_LT); + BY(ASM_REWRITE_TAC[]); + COMMENT "edge lengths"; + TYPIFY `scs_b_v39 s (p+1) ((p+1)+1) <= cstab /\ scs_b_v39 s p (p+1) = &2 * h0 /\ scs_b_v39 s (p+3) ((p+3)+1) = cstab` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `~(&2 = &2 * h0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + CONJ2_TAC; + TYPIFY `scs_a_v39 s (p+3) p = scs_a_v39 s (p+3) ((p+3)+1)` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[arith `((p+3)+1) = p+4`]; + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[Appendix.periodic2;Oxl_def.periodic]); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `x <= cstab` (C INTRO_TAC [`p+1`]) THEN ASM_REWRITE_TAC[arith `3 < 4`]; + BY(REWRITE_TAC[arith `SUC (p+1) = (p+1)+1`]); + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[arith `((p:num) + i ) + j = p + (i+j)`] THEN NUM_REDUCE_TAC; + DISCH_TAC; + TYPIFY `dist(v (p+1),v(p+2)) <= cstab /\ dist(v p,v(p+1)) <= &2 * h0 /\ dist(v(p+3),v(p+4)) <= cstab` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM MP_TAC; + FIRST_X_ASSUM_ST `scs_b_v39` MP_TAC; + BY(MESON_TAC[REAL_LE_TRANS]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "collinear"; + TYPIFY `!i j. ~(v i = v j) ==> ~collinear {vec 0,v i, v j}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT GEN_TAC THEN DISCH_TAC; + MATCH_MP_TAC Zlzthic.PROPERTIES_GENERIC_LOCAL_FAN_ALT; + GEXISTL_TAC [`V`;`E`;`FF`]; + BY(ASM_REWRITE_TAC[IN_IMAGE;IN_UNIV]); + TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 20 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + INTRO_TAC PERIODIC_INJ_MOD [`v`;`4`]; + ASM_REWRITE_TAC[arith `~(4 = 0)`]; + DISCH_TAC; + TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i=j) ==> ~(v (p +i) = v (p+j))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + (NUM_REDUCE_TAC); + REPEAT (GMATCH_SIMP_TAC MOD_LT); + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. 0 < i /\ i < 4 ==> ~(v (p+i) = v p)` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[arith `p+0 = p`;arith `0< 4`;arith `0 < i ==> ~(i=0)`]); + COMMENT "long diag"; + TYPIFY `#2.52 = &2 * h0 /\ #3.01 = cstab` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Sphere.h0;Sphere.cstab] THEN REAL_ARITH_TAC); + TYPIFY `#3.55 <= dist(v (p+2),v p)` ASM_CASES_TAC; + INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "2073661826") [`norm (v (p+1))`;`norm(v (p+2))`;`norm(v p)`;`dist(v(p+2),v p)`;`dist(v(p+1),v p)`;`dist(v(p+1),v(p+2))`]; + FIRST_X_ASSUM_ST `norm x = &2` kill; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + ASM_REWRITE_TAC[]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + CONJ_TAC; + INTRO_TAC DIST_TRIANGLE [`v (p+2)`;`(vec 0):real^3`;`v (p)`]; + REWRITE_TAC[DIST_0]; + MATCH_MP_TAC (arith `x <= &2 * h0 /\ y <= &2 * h0 ==> (d <= x + y ==> d <= &4 * h0)`); + BY(ASM_REWRITE_TAC[]); + CONJ2_TAC; + BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); + TYPIFY `v p = v (p+0)` (C SUBGOAL_THEN SUBST1_TAC); + ONCE_REWRITE_TAC[arith `p+0=p`]; + BY(REWRITE_TAC[]); + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + DISCH_TAC; + FIRST_X_ASSUM_ST `dihV` MP_TAC; + REWRITE_TAC[arith `~(x <= y) <=> y < x`]; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Merge_ineq.DIHV_EQ_DIH_Y); + ASM_REWRITE_TAC[DIST_0]; + CONJ_TAC; + BY(CONJ_TAC THEN (REPEAT (FIRST_X_ASSUM MATCH_MP_TAC)) THEN NUM_REDUCE_TAC); + ONCE_REWRITE_TAC[Nonlinear_lemma.dih_y_sym]; + MATCH_MP_TAC Ocbicby.delta4_y_imp_obtuse; + CONJ_TAC; + BY(ASM_MESON_TAC[arith `&2 <= x==> &0 < x`]); + INTRO_TAC DIST_SYM [`v p`;`v (p+2)`]; + DISCH_THEN SUBST1_TAC; + CONJ_TAC; + BY(REWRITE_TAC[REWRITE_RULE[LET_THM] Tame_lemmas.delta_y_pos]); + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. ~scs_is_str s v i ==> ~coplanar {vec 0, v i, v(i+1), v(i+3)}` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC THEN ASM_REWRITE_TAC[Appendix.scs_is_str;arith `SUC i = i+1`;GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; + NUM_REDUCE_TAC; + DISCH_THEN (unlist REWRITE_TAC); + MATCH_MP_TAC (arith `&0 < a ==> ~(a = &0)`); + INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`;`i`]; + BY(ASM_REWRITE_TAC[LET_THM;IN;arith `SUC i = i+1`;arith `4 - 1 = 3`]); + FIRST_X_ASSUM MP_TAC THEN BURY_MP_TAC; + COMMENT "short diag"; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`4`;`p`;`2`;`3`]; + ASM_REWRITE_TAC[arith `SUC p = p+1`;LET_THM]; + NUM_REDUCE_TAC; + DISCH_TAC; + TYPIFY `azim (vec 0) (v p) (v (p+1)) (v (p+3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); + MATCH_MP_TAC Local_lemmas.CONVEX_LOFA_IMP_INANGLE_LE_PI; + BY(ASM_REWRITE_TAC[]); + TYPIFY `azim (vec 0) (v p) (v (p + 1)) (v (p + 2)) <= pi /\ azim (vec 0) (v p) (v (p + 2)) (v (p + 3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC (arith `&0 < pi /\ &0 <= a /\ &0 <= b /\ a + b <= pi ==> a <= pi /\ b <= pi`); + REWRITE_TAC[PI_POS]; + REWRITE_TAC[Counting_spheres.AZIM_NN]; + BY(REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `scs_is_str` MP_TAC; + REWRITE_TAC[Appendix.scs_is_str]; + ASM_REWRITE_TAC[]; + NUM_REDUCE_TAC; + REWRITE_TAC[arith `SUC p = p+1`]; + DISCH_THEN (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + INTRO_TAC AZIM_DIHV_SAME_STRONG [`(vec 0):real^3`;`v p`;`v (p+2)`;`v (p+3)`]; + INTRO_TAC AZIM_DIHV_SAME_STRONG [`(vec 0):real^3`;`v p`;`v (p+1)`;`v (p+2)`]; + FIRST_X_ASSUM_ST `pi = a` (MP_TAC o SYM) THEN DISCH_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `~collinear {vec 0, v p, v (p + 1)} /\ ~collinear {vec 0, v p, v (p + 2)} /\ ~collinear {vec 0, v p, v (p + 3)}` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `dihV` MP_TAC) THEN REWRITE_TAC[] THEN REPEAT (GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Merge_ineq.DIHV_EQ_DIH_Y)); + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `+` MP_TAC THEN ASM_REWRITE_TAC[]; + (DISCH_TAC); + TYPIFY `cstab <= dist(v p,v(p+2))` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `cstab < d` (C INTRO_TAC [`p`;`p+2`]); + ANTS_TAC; + REWRITE_TAC[arith `p+2 = SUC(SUC (p))`]; + MATCH_MP_TAC Tfitskc.SCS_DIAG_2; + BY(NUM_REDUCE_TAC); + BY(REAL_ARITH_TAC); + INTRO_TAC (UNDISCH2 LINDIH_11) [`norm (v (p))`;`norm(v (p+3))`;`norm(v (p+2))`;`dist(v(p+3),v(p+2))`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+3))`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + TYPIFY `(&2 <= norm (v p) /\ norm (v p) <= &2) /\ (&2 <= norm (v (p + 3)) /\ norm (v (p + 3)) <= #2.52) /\ (&2 <= norm (v (p + 2)) /\ norm (v (p + 2)) <= #2.52) /\ (&2 <= dist (v (p + 3),v (p + 2)) /\ dist (v (p + 3),v (p + 2)) <= &2) /\ ( #3.01 <= dist (v p,v (p + 2)) /\ dist (v p,v (p + 2)) <= #3.55) /\ &2 * h0 <= dist (v p,v (p + 3)) /\ dist (v p,v (p + 3)) <= #3.01` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[arith `(x <= y /\ y <= x) <=> y = x`]; + nCONJ_TAC 3; + BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); + CONJ_TAC; + BY(FIRST_X_ASSUM_ST `#3.55` MP_TAC THEN REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC); + TYPIFY `scs_a_v39 s (p+3) p <= dist(v(p+3),v p) ` ENOUGH_TO_SHOW_TAC; + REWRITE_TAC[DIST_SYM] THEN MATCH_MP_TAC (arith `a = b ==> (a <= d ==> b <= d)`); + BY(ASM_REWRITE_TAC[]); + BY(ASM_REWRITE_TAC[]); + FIRST_ASSUM (unlist REWRITE_TAC); + REWRITE_TAC[DE_MORGAN_THM]; + CONJ2_TAC; + REWRITE_TAC[arith `~(d < &0) <=> &0 <= d`]; + FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`p+3`]); + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[arith `(p+3) +i = p+(3+i)`] THEN NUM_REDUCE_TAC; + REWRITE_TAC[Oxlzlez.coplanar_delta_y]; + ASM_REWRITE_TAC[DIST_SYM;DIST_0]; + MATCH_MP_TAC (arith `a = b ==> &0 < a ==> &0 <= b`); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + (DISCH_TAC); + COMMENT "5550"; + INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "5550839403 delta") [`norm (v (p))`;`norm(v (p+1))`;`norm(v (p+2))`;`cstab`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+1))`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + TYPIFY `(&2 <= norm (v p) /\ norm (v p) <= &2) /\ (&2 <= norm (v (p + 1)) /\ norm (v (p + 1)) <= #2.52) /\ (&2 <= norm (v (p + 2)) /\ norm (v (p + 2)) <= #2.52) /\ ( #3.01 <= cstab /\ cstab <= #3.01) /\ ( #3.01 <= dist (v p,v (p + 2)) /\ dist (v p,v (p + 2)) <= #3.55) /\ &2 <= dist (v p,v (p + 1)) /\ dist (v p,v (p + 1)) <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[arith `(x <= y /\ y <= x) <=> y = x`]; + FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`0`;`1`]); + BY(REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN MATCH_MP_TAC THEN NUM_REDUCE_TAC); + FIRST_ASSUM (unlist REWRITE_TAC); + DISCH_TAC; + INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "5550839403") [`norm (v (p))`;`norm(v (p+1))`;`norm(v (p+2))`;`cstab`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+1))`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + FIRST_X_ASSUM_ST `#3.01` (unlist REWRITE_TAC); + DISCH_TAC; + INTRO_TAC Ocbicby.dih_y_mono [`norm (v (p))`;`norm(v (p+1))`;`norm(v (p+2))`;`dist(v (p+1),v(p+2))`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+1))`;`cstab`]; + ANTS_TAC; + TYPIFY_GOAL_THEN `&0 < norm (v p)` (unlist REWRITE_TAC); + BY(ASM_REWRITE_TAC[arith `&0 < &2`]); + FIRST_X_ASSUM_ST `norm (v p) = &2` kill; + ASM_REWRITE_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`1`;`2`]); + BY(NUM_REDUCE_TAC THEN REAL_ARITH_TAC); + CONJ2_TAC; + BY(FIRST_X_ASSUM_ST `delta_y` MP_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`p+1`]); + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[arith `(p+1) +i = p+(1+i)`] THEN NUM_REDUCE_TAC; + REWRITE_TAC[Oxlzlez.coplanar_delta_y]; + ASM_REWRITE_TAC[DIST_SYM;DIST_0]; + MATCH_MP_TAC (arith `a = b ==> &0 < a ==> &0 < b`); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + (DISCH_TAC); + TYPIFY `dih_y (norm (v p)) (norm (v (p + 3))) (norm (v (p + 2))) (dist (v (p + 3),v (p + 2))) (dist (v p,v (p + 2))) (dist (v p,v (p + 3))) + dih_y (norm (v p)) (norm (v (p + 1))) (norm (v (p + 2))) (dist (v (p + 1),v (p + 2))) (dist (v p,v (p + 2))) (dist (v p,v (p + 1))) < #3.1` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `#3.1 < pi` (C SUBGOAL_THEN ASSUME_TAC); + BY(MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `a = pi` MP_TAC THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC); + REWRITE_TAC[DIST_0;DIST_SYM]; + FIRST_X_ASSUM_ST `dist s = &2` MP_TAC; + DISCH_THEN ((unlist REWRITE_TAC) o GSYM); + TYPIFY `dih_y (norm (v p)) (norm (v (p + 2))) (norm (v (p + 3))) (dist (v (p + 2),v (p + 3))) (dist (v p,v (p + 3))) (dist (v p,v (p + 2))) = dih_y (norm (v p)) (norm (v (p + 3))) (norm (v (p + 2))) (dist (v (p + 2),v (p + 3))) (dist (v p,v (p + 2))) (dist (v p,v (p + 3)))` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[Nonlinear_lemma.dih_y_sym]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let LEMMA_PWE4 = prove_by_refinement( +(* main_work4 ==> *) ` main_nonlinear_terminal_v11 ==> (!s v p. + is_scs_v39 s /\ scs_basic_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4*h0 < scs_b_v39 s i j) /\ + (!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/ + (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) /\ + scs_generic v /\ + ~scs_is_str s v (p+1) /\ ~scs_is_str s v (p+3) /\ + scs_is_str s v p /\ norm (v p) = &2 /\ + scs_a_v39 s (p+3) p = &2 /\ + scs_a_v39 s p (p+1) = &2 * h0 /\ + dist(v (p+2),v(p+1)) = &2 /\ + &2 * h0 <= dist(v(p+3),v(p+2)) ==> + pi / &2 < dihV (vec 0) (v (p+3)) (v (p)) (v (p+2)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `x < y <=> ~(y <= x)`] THEN DISCH_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `BBprime2_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.scs_basic;Ayqjtmd.unadorned_MMs;IN]); + TYPIFY `BBprime_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime2_v39]); + TYPIFY `BBs_v39 s v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Appendix.BBprime_v39]); + INTRO_TAC Appendix.BBs_v39 [`s`;`v`]; + ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;Terminal.IMAGE_SUBSET_IN;IN_UNIV;arith `~(4 <= 3)`]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `V = IMAGE v (:num)`; + TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num)`; + TYPED_ABBREV_TAC `FF = IMAGE (\i. (v i,v (SUC i))) (:num)`; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. v i IN V` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + EXPAND_TAC "V"; + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + INTRO_TAC Cuxvzoz.BBs_inj [`s`;`v`;`4`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!i. interior_angle1 (vec 0) FF (v i) = azim (vec 0) (v i) (v (i+1)) (v (i+3))` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + EXPAND_TAC "FF"; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] (GSYM Ocbicby.INTERIOR_ANGLE1_AZIM)); + TYPIFY `s` EXISTS_TAC; + BY(ASM_REWRITE_TAC[IN;arith `4 - 1 = 3`;arith `3 < 4`;arith `SUC i = i+1`]); + INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`]; + ASM_REWRITE_TAC[LET_THM;IN;arith `4-1 = 3`;arith `SUC i = i+1`]; + DISCH_TAC; + TYPIFY `!i. v (i MOD 4) = v i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC (GSYM Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[arith `~(0=4)`]); + TYPIFY `v 4 = v 0 /\ v 5 = v 1 /\ v 6 = v 2 /\ v 7 = v 3 /\ v 8 = v 4` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM ((unlist ONCE_REWRITE_TAC) o GSYM); + BY(REWRITE_TAC[Terminal.MOD_4_EXPLICIT;arith `7 = 1*4 + 3`;arith `8 = 2*4 + 0`;MOD_MULT_ADD]); + TYPIFY `generic V E` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `scs_generic` MP_TAC THEN ASM_REWRITE_TAC[Appendix.scs_generic]); + TYPIFY `v (p+4) = v p /\ v (p+5) = v (p+1) /\ v (p+6) = v (p+2) /\ v (p+7) = v (p+3) /\ v (p+8) = v (p)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `MOD` ((unlist ONCE_REWRITE_TAC) o GSYM); + BY(REWRITE_TAC[arith `p+4 = 1*4 + p /\ p+5 = 1*4+(p+1) /\ p+6=1*4+(p+2) /\ p+7 = 1*4 + (p+3) /\ p+8 = 2*4 + p`;MOD_MULT_ADD]); + TYPIFY `!i. &2 <= norm (v i) /\ norm (v i) <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + REWRITE_TAC[GSYM Fnjlbxs.in_ball_annulus]; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> &2 <= dist(v (p + i),v (p+j))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Ocbicby.scs_lb_2; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + (NUM_REDUCE_TAC); + REPEAT (GMATCH_SIMP_TAC MOD_LT); + BY(ASM_REWRITE_TAC[]); + COMMENT "edge lengths"; + TYPIFY `scs_b_v39 s (p+3) ((p+3)+1) = &2 * h0 /\ scs_b_v39 s p (p+1) = cstab /\ scs_b_v39 s (p+2) ((p+2)+1) <= cstab` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `~(&2 = &2 * h0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + CONJ2_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `scs_b_v39 s i j <= cstab` (C INTRO_TAC [`p+2`]); + ASM_REWRITE_TAC[arith `SUC (p+2) = (p+2)+1`]; + BY(DISCH_THEN MATCH_MP_TAC THEN NUM_REDUCE_TAC); + TYPIFY `scs_a_v39 s (p+3) p = scs_a_v39 s (p+3) ((p+3)+1)` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[arith `((p+3)+1) = p+4`]; + FIRST_X_ASSUM_ST `is_scs_v39` MP_TAC THEN REWRITE_TAC[Appendix.is_scs_v39;LET_THM] THEN REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[Appendix.periodic2;Oxl_def.periodic]); + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[arith `((p:num) + i ) + j = p + (i+j)`] THEN NUM_REDUCE_TAC; + DISCH_TAC; + TYPIFY `dist(v (p+3),v(p+4)) <= &2 *h0 /\ dist(v p,v(p+1)) <= cstab /\ dist(v(p+2),v(p+3)) <= cstab` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM MP_TAC; + FIRST_X_ASSUM_ST `scs_b_v39` MP_TAC; + BY(MESON_TAC[REAL_LE_TRANS]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "collinear"; + TYPIFY `!i j. ~(v i = v j) ==> ~collinear {vec 0,v i, v j}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT GEN_TAC THEN DISCH_TAC; + MATCH_MP_TAC Zlzthic.PROPERTIES_GENERIC_LOCAL_FAN_ALT; + GEXISTL_TAC [`V`;`E`;`FF`]; + BY(ASM_REWRITE_TAC[IN_IMAGE;IN_UNIV]); + TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(v i = v j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 20 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + INTRO_TAC PERIODIC_INJ_MOD [`v`;`4`]; + ASM_REWRITE_TAC[arith `~(4 = 0)`]; + DISCH_TAC; + TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i=j) ==> ~(v (p +i) = v (p+j))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Ocbicby.MOD_EQ_MOD_SHIFT; + (NUM_REDUCE_TAC); + REPEAT (GMATCH_SIMP_TAC MOD_LT); + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. 0 < i /\ i < 4 ==> ~(v (p+i) = v p)` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[arith `p+0 = p`;arith `0< 4`;arith `0 < i ==> ~(i=0)`]); + COMMENT "long diag"; + TYPIFY `#2.52 = &2 * h0 /\ #3.01 = cstab` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Sphere.h0;Sphere.cstab] THEN REAL_ARITH_TAC); + TYPIFY `#3.55 <= dist(v (p+2),v p)` ASM_CASES_TAC; + INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "2073661826") [`norm (v (p+3))`;`norm(v (p+2))`;`norm(v p)`;`dist(v(p+2),v p)`;`dist(v(p+3),v p)`;`dist(v(p+3),v(p+2))`]; + FIRST_X_ASSUM_ST `norm x = &2` kill; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + ASM_REWRITE_TAC[]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + CONJ_TAC; + INTRO_TAC DIST_TRIANGLE [`v (p+2)`;`(vec 0):real^3`;`v (p)`]; + REWRITE_TAC[DIST_0]; + MATCH_MP_TAC (arith `x <= &2 * h0 /\ y <= &2 * h0 ==> (d <= x + y ==> d <= &4 * h0)`); + BY(ASM_REWRITE_TAC[]); + CONJ2_TAC; + BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); + TYPIFY `v p = v (p+0)` (C SUBGOAL_THEN SUBST1_TAC); + ONCE_REWRITE_TAC[arith `p+0=p`]; + BY(REWRITE_TAC[]); + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + DISCH_TAC; + FIRST_X_ASSUM_ST `dihV` MP_TAC; + REWRITE_TAC[arith `~(x <= y) <=> y < x`]; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Merge_ineq.DIHV_EQ_DIH_Y); + ASM_REWRITE_TAC[DIST_0]; + CONJ_TAC; + BY(CONJ_TAC THEN (REPEAT (FIRST_X_ASSUM MATCH_MP_TAC)) THEN NUM_REDUCE_TAC); + ONCE_REWRITE_TAC[Nonlinear_lemma.dih_y_sym]; + MATCH_MP_TAC Ocbicby.delta4_y_imp_obtuse; + CONJ_TAC; + BY(ASM_MESON_TAC[arith `&2 <= x==> &0 < x`]); + INTRO_TAC DIST_SYM [`v p`;`v (p+2)`]; + DISCH_THEN SUBST1_TAC; + CONJ_TAC; + BY(REWRITE_TAC[REWRITE_RULE[LET_THM] Tame_lemmas.delta_y_pos]); + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. ~scs_is_str s v i ==> ~coplanar {vec 0, v i, v(i+1), v(i+3)}` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC THEN ASM_REWRITE_TAC[Appendix.scs_is_str;arith `SUC i = i+1`;GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; + NUM_REDUCE_TAC; + DISCH_THEN (unlist REWRITE_TAC); + MATCH_MP_TAC (arith `&0 < a ==> ~(a = &0)`); + INTRO_TAC Ocbicby.LOCAL_FAN_AZIM_POS [`s`;`v`;`i`]; + BY(ASM_REWRITE_TAC[LET_THM;IN;arith `SUC i = i+1`;arith `4 - 1 = 3`]); + FIRST_X_ASSUM MP_TAC THEN BURY_MP_TAC; + COMMENT "short diag"; + INTRO_TAC Terminal.vv_split_azim_generic [`v`;`4`;`p`;`2`;`3`]; + ASM_REWRITE_TAC[arith `SUC p = p+1`;LET_THM]; + NUM_REDUCE_TAC; + DISCH_TAC; + TYPIFY `azim (vec 0) (v p) (v (p+1)) (v (p+3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `interior_angle1` ((unlist REWRITE_TAC) o GSYM); + MATCH_MP_TAC Local_lemmas.CONVEX_LOFA_IMP_INANGLE_LE_PI; + BY(ASM_REWRITE_TAC[]); + TYPIFY `azim (vec 0) (v p) (v (p + 1)) (v (p + 2)) <= pi /\ azim (vec 0) (v p) (v (p + 2)) (v (p + 3)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC (arith `&0 < pi /\ &0 <= a /\ &0 <= b /\ a + b <= pi ==> a <= pi /\ b <= pi`); + REWRITE_TAC[PI_POS]; + REWRITE_TAC[Counting_spheres.AZIM_NN]; + BY(REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `scs_is_str` MP_TAC; + REWRITE_TAC[Appendix.scs_is_str]; + ASM_REWRITE_TAC[]; + NUM_REDUCE_TAC; + REWRITE_TAC[arith `SUC p = p+1`]; + DISCH_THEN (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + INTRO_TAC AZIM_DIHV_SAME_STRONG [`(vec 0):real^3`;`v p`;`v (p+2)`;`v (p+3)`]; + INTRO_TAC AZIM_DIHV_SAME_STRONG [`(vec 0):real^3`;`v p`;`v (p+1)`;`v (p+2)`]; + FIRST_X_ASSUM_ST `pi = a` (MP_TAC o SYM) THEN DISCH_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `~collinear {vec 0, v p, v (p + 1)} /\ ~collinear {vec 0, v p, v (p + 2)} /\ ~collinear {vec 0, v p, v (p + 3)}` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `dihV` MP_TAC) THEN REWRITE_TAC[] THEN REPEAT (GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Merge_ineq.DIHV_EQ_DIH_Y)); + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN NUM_REDUCE_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `+` MP_TAC THEN ASM_REWRITE_TAC[]; + (DISCH_TAC); + TYPIFY `cstab <= dist(v p,v(p+2))` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `cstab < d` (C INTRO_TAC [`p`;`p+2`]); + ANTS_TAC; + REWRITE_TAC[arith `p+2 = SUC(SUC (p))`]; + MATCH_MP_TAC Tfitskc.SCS_DIAG_2; + BY(NUM_REDUCE_TAC); + BY(REAL_ARITH_TAC); + INTRO_TAC (UNDISCH2 LINDIH_11) [`norm (v (p))`;`norm(v (p+1))`;`norm(v (p+2))`;`dist(v(p+1),v(p+2))`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+1))`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + TYPIFY `(&2 <= norm (v p) /\ norm (v p) <= &2) /\ (&2 <= norm (v (p + 1)) /\ norm (v (p + 1)) <= #2.52) /\ (&2 <= norm (v (p + 2)) /\ norm (v (p + 2)) <= #2.52) /\ (&2 <= dist (v (p + 1),v (p + 2)) /\ dist (v (p + 1),v (p + 2)) <= &2) /\ ( #3.01 <= dist (v p,v (p + 2)) /\ dist (v p,v (p + 2)) <= #3.55) /\ &2 * h0 <= dist (v p,v (p + 1)) /\ dist (v p,v (p + 1)) <= #3.01` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[arith `(x <= y /\ y <= x) <=> y = x`]; + nCONJ_TAC 2; + TYPIFY `scs_a_v39 s p (p+1) <= dist(v p,v(p+1)) ` ENOUGH_TO_SHOW_TAC; + MATCH_MP_TAC (arith `a = b ==> (a <= d ==> b <= d)`); + BY(ASM_REWRITE_TAC[]); + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[DIST_SYM]; + ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM_ST `#3.55` MP_TAC THEN REAL_ARITH_TAC); + FIRST_ASSUM (unlist REWRITE_TAC); + REWRITE_TAC[DE_MORGAN_THM]; + CONJ2_TAC; + REWRITE_TAC[arith `~(d < &0) <=> &0 <= d`]; + BY(REWRITE_TAC[REWRITE_RULE[LET_THM] Tame_lemmas.delta_y_pos]); + (DISCH_TAC); + COMMENT "5550"; + INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "5550839403 delta") [`norm (v (p))`;`norm(v (p+3))`;`norm(v (p+2))`;`cstab`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+3))`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + TYPIFY `(&2 <= norm (v p) /\ norm (v p) <= &2) /\ (&2 <= norm (v (p + 3)) /\ norm (v (p + 3)) <= #2.52) /\ (&2 <= norm (v (p + 2)) /\ norm (v (p + 2)) <= #2.52) /\ ( #3.01 <= cstab /\ cstab <= #3.01) /\ ( #3.01 <= dist (v p,v (p + 2)) /\ dist (v p,v (p + 2)) <= #3.55) /\ &2 <= dist (v p,v (p + 3)) /\ dist (v p,v (p + 3)) <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[arith `(x <= y /\ y <= x) <=> y = x`]; + CONJ_TAC; + FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`0`;`3`]); + BY(REWRITE_TAC[arith `p+0=p`] THEN DISCH_THEN MATCH_MP_TAC THEN NUM_REDUCE_TAC); + BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); + FIRST_ASSUM (unlist REWRITE_TAC); + DISCH_TAC; + INTRO_TAC ((* get_work *) Terminal.get_main_nonlinear "5550839403") [`norm (v (p))`;`norm(v (p+3))`;`norm(v (p+2))`;`cstab`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+3))`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;arith `x <= x`]; + FIRST_X_ASSUM_ST `#3.01` (unlist REWRITE_TAC); + DISCH_TAC; + INTRO_TAC Ocbicby.dih_y_mono [`norm (v (p))`;`norm(v (p+3))`;`norm(v (p+2))`;`dist(v (p+3),v(p+2))`;`dist(v(p),v (p+2))`;`dist(v(p),v(p+3))`;`cstab`]; + ANTS_TAC; + TYPIFY_GOAL_THEN `&0 < norm (v p)` (unlist REWRITE_TAC); + BY(ASM_REWRITE_TAC[arith `&0 < &2`]); + FIRST_X_ASSUM_ST `norm (v p) = &2` kill; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); + CONJ_TAC; + FIRST_X_ASSUM_ST `&2 <= dist s` (C INTRO_TAC [`3`;`2`]); + BY(NUM_REDUCE_TAC THEN REAL_ARITH_TAC); + CONJ2_TAC; + BY(FIRST_X_ASSUM_ST `delta_y` MP_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `coplanar` (C INTRO_TAC [`p+3`]); + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[arith `(p+3) +i = p+(3+i)`] THEN NUM_REDUCE_TAC; + REWRITE_TAC[Oxlzlez.coplanar_delta_y]; + ASM_REWRITE_TAC[DIST_SYM;DIST_0]; + MATCH_MP_TAC (arith `a = b ==> &0 < a ==> &0 < b`); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + (DISCH_TAC); + TYPIFY `dih_y (norm (v p)) (norm (v (p + 3))) (norm (v (p + 2))) (dist (v (p + 3),v (p + 2))) (dist (v p,v (p + 2))) (dist (v p,v (p + 3))) + dih_y (norm (v p)) (norm (v (p + 1))) (norm (v (p + 2))) (dist (v (p + 1),v (p + 2))) (dist (v p,v (p + 2))) (dist (v p,v (p + 1))) < #3.1` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `#3.1 < pi` (C SUBGOAL_THEN ASSUME_TAC); + BY(MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `a = pi` MP_TAC THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC); + REWRITE_TAC[DIST_0;DIST_SYM]; + TYPIFY `dih_y (norm (v p)) (norm (v (p + 2))) (norm (v (p + 3))) (dist (v (p + 2),v (p + 3))) (dist (v p,v (p + 3))) (dist (v p,v (p + 2))) = dih_y (norm (v p)) (norm (v (p + 3))) (norm (v (p + 2))) (dist (v (p + 2),v (p + 3))) (dist (v p,v (p + 2))) (dist (v p,v (p + 3)))` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[Nonlinear_lemma.dih_y_sym]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +end;; diff --git a/text_formalization/local/LDURDPN.hl b/text_formalization/local/LDURDPN.hl new file mode 100644 index 0000000..b225ec0 --- /dev/null +++ b/text_formalization/local/LDURDPN.hl @@ -0,0 +1,133 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Nguyen Quang Truong *) +(* Date: 2010-05-09 *) +(* ========================================================================== *) + +(* ========== snapshot 1631 ============= *) +flyspeck_needs "local/LVDUCXU.hl";; + + +module type Ldurdpn_type = sig + +end;; + + +module Ldurdpn = struct + +open Lvducxu;; +open Sphere;; +open Trigonometry1;; +open Trigonometry2;; +open Hypermap;; +open Fan;; +open Prove_by_refinement;; +open Wrgcvdr_cizmrrh;; + + +let SUBSET_P_HULL = prove(` (S:A -> bool) SUBSET P hull S`, +REWRITE_TAC[HULL_SUBSET]);; + +let IN_HULL_INSERT = prove(`!x:A. x IN P hull ( x INSERT S ) `, +GEN_TAC THEN +MATCH_MP_TAC (SET_RULE` x IN S /\ S SUBSET P hull S ==> x IN P hull S `) THEN +REWRITE_TAC[IN_INSERT; SUBSET_P_HULL]);; + + + +let VECTOR_SCALE_CHANGE = prove(` ~( a = &0 ) ==> +( a % x = y <=> x = &1 / a % y ) `, +DISCH_TAC THEN EQ_TAC THENL [ +DISCH_THEN (SUBST1_TAC o SYM) THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN +ASM_SIMP_TAC[REAL_FIELD` ~( a = &0) ==> &1 / a * a = &1 `; VECTOR_MUL_LID]; +SIMP_TAC[VECTOR_MUL_ASSOC] THEN +ASM_SIMP_TAC[REAL_FIELD` ~( a = &0) ==> a * &1 / a = &1 `; VECTOR_MUL_LID]]);; + + + +let AFF_CONV0_IN_AFF_LT = prove_by_refinement( +` ~collinear {vec 0, u, v} ==> +~(aff {vec 0, u} INTER conv0 {v, w} = {}) + ==> w IN aff_lt {vec 0, u} {v} `, +[NHANH th3a; +SIMP_TAC[AFF_LT_2_1; Geomdetail.CONV0_SET2; AFF2]; +REWRITE_TAC[SET_RULE` ~( a INTER b = {}) <=> ? x. x IN a /\ x IN b`; +IN_ELIM_THM]; +REPEAT STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +PAT_ONCE_REWRITE_TAC `\x. x ==> y` +[VECTOR_ARITH` x = a + (b:real^N) <=> b = x + -- a `]; +ASSUME_TAC2 (REAL_ARITH` &0 < b ==> ~( b = &0 ) `); +DOWN; +SIMP_TAC[VECTOR_SCALE_CHANGE]; +REPEAT STRIP_TAC; +REWRITE_TAC[VECTOR_MUL_ASSOC; VECTOR_ADD_LDISTRIB; GSYM VECTOR_MUL_LNEG]; +SUBGOAL_THEN ` (&1 / b * --a) < &0 ` MP_TAC; +REWRITE_TAC[REAL_ARITH` &1 / b * --a < &0 <=> &0 < a / b `]; +MATCH_MP_TAC REAL_LT_DIV; +ASM_REWRITE_TAC[]; +MESON_TAC[REAL_ARITH` (&1 - a - b ) + a + b = &1 `]]);; + + +let LDURDPN = prove_by_refinement +(` ~ collinear {vec 0, (u:real^3), v} /\ ~ collinear {vec 0, u, w} +==> ( azim (vec 0) u v w = pi <=> (? A. plane A /\ +{vec 0, u, v, w} SUBSET A) /\ ~( aff {vec 0, u} INTER conv0 {v, w} = {}) )`, +[SIMP_TAC[AZIM_EQ_PI_ALT]; +STRIP_TAC; +EQ_TAC; +UNDISCH_TAC ` ~collinear {vec 0, (u:real^3), v}`; +NHANH th3; +SIMP_TAC[AFF_LT_2_1; plane]; +STRIP_TAC THEN STRIP_TAC; +DOWN; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +CONJ_TAC; +EXISTS_TAC ` affine hull {vec 0, (u:real^3), v}`; +REWRITE_TAC[AFFINE_HULL_3; INSERT_SUBSET; EMPTY_SUBSET]; +CONJ_TAC; +EXISTS_TAC `(vec 0):real^3 `; +EXISTS_TAC ` u:real^3 `; +EXISTS_TAC `v:real^3 `; +ASM_REWRITE_TAC[]; +REWRITE_TAC[GSYM AFFINE_HULL_3]; +NGOAC; +CONJ_TAC; +MESON_TAC[INSERT_COMM; IN_HULL_INSERT]; +REWRITE_TAC[AFFINE_HULL_3; IN_ELIM_THM]; +DOWN THEN DOWN THEN PHA; +MESON_TAC[]; +REWRITE_TAC[SET_RULE` ~( x INTER y = {}) <=> ?a. a IN x /\ a IN y`]; +EXISTS_TAC ` ( &1 / (&1 - t3)) % ((w:real^3) - t3 % v ) `; +REWRITE_TAC[AFF2; Geomdetail.CONV0_SET2; IN_ELIM_THM]; +CONJ_TAC; +EXISTS_TAC ` ( &1 / (&1 - t3)) * t1 `; +REWRITE_TAC[GSYM VECTOR_MUL_ASSOC]; +ASM_SIMP_TAC[ +REAL_FIELD` t3 < &0 ==> &1 - &1 / (&1 - t3) * t1 = +&1 / (&1 - t3) * (&1 - t3 - t1 ) `]; +REWRITE_TAC[GSYM VECTOR_ADD_LDISTRIB; GSYM VECTOR_MUL_ASSOC]; +MATCH_MP_TAC (MESON[]` x = y ==> f x = f y`); +ASM_SIMP_TAC[REAL_RING` t1 + t2 + t3 = &1 ==> &1 - t3 - t1 = t2 `]; +VECTOR_ARITH_TAC; +EXISTS_TAC ` ( &1 / (&1 - t3)) * ( -- t3) `; +EXISTS_TAC ` ( &1 / (&1 - t3)) `; +CONJ_TAC; +MATCH_MP_TAC REAL_LT_MUL; +ASM_REWRITE_TAC[GSYM (REAL_FIELD` t3 < &0 <=> &0 < -- t3 `)]; +MATCH_MP_TAC REAL_LT_DIV; +ASM_REAL_ARITH_TAC; +CONJ_TAC; +MATCH_MP_TAC REAL_LT_DIV; +ASM_REAL_ARITH_TAC; +ASM_SIMP_TAC[ +REAL_FIELD` t3 < &0 ==> &1 / (&1 - t3) * --t3 + &1 / (&1 - t3) = &1 `]; +VECTOR_ARITH_TAC; +ASM_SIMP_TAC[AFF_CONV0_IN_AFF_LT]]);; + +end;; diff --git a/text_formalization/local/LFJCIXP.hl b/text_formalization/local/LFJCIXP.hl new file mode 100644 index 0000000..556cc1a --- /dev/null +++ b/text_formalization/local/LFJCIXP.hl @@ -0,0 +1,64 @@ + +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + + + +module Lfjcixp = struct + +open Sphere;; +open Fan_defs;; +open Hypermap;; +open Vol1;; +open Fan;; +open Prove_by_refinement;; +open Pack_defs;; +open Collect_geom;; + + +let LFJCIXP =prove(`(!y1 y2 y3 y4 y5 y6. +&2 <= y1 /\ y1<= #2.52 +/\ &2 <= y2 /\ y2<= #2.52 +/\ &2 <= y3 /\ y3<= #2.52 +/\ &2 <= y4 /\ y4<= #4.52 +/\ y5= &2 +/\ y6= &2 +==> (y4 <= #3.915 \/ delta (y1 pow 2) (y2 pow 2) (y3 pow 2) (y4 pow 2) (y5 pow 2) (y6 pow 2)< &0)) +/\ {v,u,w} SUBSET ball_annulus +/\ packing {v,u,w} +/\ ~(u=w) +/\ norm(v-u)= &2 +/\ norm(v-w)= &2 +/\ norm (u - w) <= #4.52 +==> norm(u-w)<= #3.915 +`, +REPEAT STRIP_TAC +THEN MRESAL_TAC Trigonometry.LBEVAKV[`vec 0:real^3`;`w:real^3`;`u:real^3`;`v:real^3`][dist;VECTOR_ARITH`a - vec 0= a`;NORM_NEG;NORM_SUB] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= a <=> ~(a< &0)`] +THEN MP_TAC(SET_RULE`{v, u, w} SUBSET ball_annulus +==> v IN ball_annulus /\ u IN ball_annulus /\ w IN ball_annulus`) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[IN_ELIM_THM;DIFF;ball_annulus;ball;cball;REAL_ARITH`~(a< &2)<=> &2<= a`;REAL_ARITH`&2 * #1.26= #2.52`;h0;dist;VECTOR_ARITH`a - vec 0= a`;NORM_NEG;NORM_SUB] +THEN ASM_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN REPEAT STRIP_TAC +THEN FIND_ASSUM MP_TAC `packing {v,u,w:real^3}` +THEN REWRITE_TAC[packing] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`u:real^3`;`w:real^3`][SET_RULE`{v, u, w} u /\ {v, u, w} w`;dist]) +THEN REMOVE_THEN"YEU"(fun th-> MRESA_TAC th[`norm(w:real^3)`;`norm(u:real^3)`;`norm (v:real^3)`;`norm(u-w:real^3)`;`&2`;`&2`]));; + + + + +end;; + + diff --git a/text_formalization/local/LKGRQUI.hl b/text_formalization/local/LKGRQUI.hl new file mode 100755 index 0000000..ce92c93 --- /dev/null +++ b/text_formalization/local/LKGRQUI.hl @@ -0,0 +1,269 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Lkgrqui = struct + + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; +open Qknvmlb;; + + +let SLICE_IS_UNADORNED=prove(`unadorned_v39 (scs_half_slice_v39 s p q d' mkj)`, +ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;scs_half_slice_v39;is_scs_v39;scs_diag;scs_v39_explicit;unadorned_v39] +);; + + +let LKGRQUI= prove_by_refinement( +` is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q /\ + is_scs_slice_v39 s s' s'' p q + ==> scs_arrow_v39 {s} {s',s''}`, +[REWRITE_TAC[scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39;PAIR_EQ] +THEN REPEAT STRIP_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`a IN {b,c}<=> a=b\/a=c`] +THEN RESA_TAC; + +MP_TAC SCS_HALF_SLICE_IS_A_SCS +THEN RESA_TAC; + +MP_TAC SCS_SLICE_SYM +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL SCS_HALF_SLICE_IS_A_SCS)[`s:scs_v39`;`s':scs_v39`;`q:num`;`p:num`;`s'':scs_v39`] +THEN ASM_TAC +THEN REWRITE_TAC[scs_diag] +THEN REPEAT RESA_TAC; + +DISJ_CASES_TAC(SET_RULE`(!s'. s' = s ==> MMs_v39 s' = {}) \/ ~((!s'. s' = s ==> MMs_v39 s' = {}))`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[SET_RULE`~(A={})<=> ?vv. A vv`;] +THEN RESA_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASSUME_TAC th) +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF] +THEN ABBREV_TAC`mkj=scs_J_v39 s' 0 (scs_k_v39 s' - 1)` +THEN ABBREV_TAC`d'=scs_d_v39 s'` +THEN ABBREV_TAC`d''=scs_d_v39 s''` +THEN REWRITE_TAC[scs_slice_v39;PAIR_EQ] +THEN DISCH_TAC +THEN ABBREV_TAC`vv' = (\i. (vv:num->real^3) (i MOD (scs_k_v39 s')+ p MOD (scs_k_v39 s)))` +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MP_TAC QKNVMLB1 +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN STRIP_TAC +THEN SUBGOAL_THEN`scs_bm_v39 s q p < &4 /\ + (scs_k_v39 s = 4 \/ scs_bm_v39 s q p <= cstab) /\ + scs_diag (scs_k_v39 s) q p` ASSUME_TAC; + +ASM_TAC +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;scs_diag;is_scs_v39] +THEN REPEAT RESA_TAC; + +MRESAL_TAC (GEN_ALL QKNVMLB1)[`vv:num->real^3`;`s:scs_v39`;`q:num`;`p:num`;`d'':real`;`mkj:bool`] +[LET_DEF;LET_END_DEF] +THEN ABBREV_TAC`vv''=(\i. (vv:num->real^3) + (i MOD scs_k_v39 (scs_half_slice_v39 s q p d'' mkj) + + q MOD scs_k_v39 s))` +THEN MP_TAC QKNVMLB3 +THEN RESA_TAC +THEN REPLICATE_TAC (14-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASSUME_TAC th) +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[MMs_v39;BBprime_v39;BBprime2_v39;LET_DEF;LET_END_DEF] +THEN REWRITE_TAC[BBprime_v39;BBprime2_v39] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`taustar_v39 (scs_half_slice_v39 s p q d' mkj) vv' + + taustar_v39 (scs_half_slice_v39 s q p d'' mkj) vv'' <= + taustar_v39 s vv +/\ taustar_v39 s vv< &0 +==> taustar_v39 (scs_half_slice_v39 s p q d' mkj) vv' < &0 \/ taustar_v39 (scs_half_slice_v39 s q p d'' mkj) vv''< &0`) +THEN RESA_TAC; + + +EXISTS_TAC`s':scs_v39` +THEN ASM_REWRITE_TAC[SET_RULE`a IN {a,b}`;] +THEN MATCH_MP_TAC SGTRNAF +THEN EXISTS_TAC`vv':num->real^3` +THEN ASM_REWRITE_TAC[IN] +THEN MP_TAC SCS_HALF_SLICE_IS_A_SCS +THEN RESA_TAC +THEN REWRITE_TAC[SLICE_IS_UNADORNED]; + + +EXISTS_TAC`s'':scs_v39` +THEN ASM_REWRITE_TAC[SET_RULE`b IN {a,b}`;] +THEN MATCH_MP_TAC SGTRNAF +THEN EXISTS_TAC`vv'':num->real^3` +THEN ASM_REWRITE_TAC[IN] +THEN MP_TAC SCS_HALF_SLICE_IS_A_SCS +THEN RESA_TAC +THEN REWRITE_TAC[SLICE_IS_UNADORNED] +THEN MP_TAC SCS_SLICE_SYM +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL SCS_HALF_SLICE_IS_A_SCS)[`s:scs_v39`;`s':scs_v39`;`q:num`;`p:num`;`s'':scs_v39`]; + + + +EXISTS_TAC`s':scs_v39` +THEN ASM_REWRITE_TAC[SET_RULE`a IN {a,b}`;] +THEN MATCH_MP_TAC SGTRNAF +THEN EXISTS_TAC`vv':num->real^3` +THEN ASM_REWRITE_TAC[IN] +THEN MP_TAC SCS_HALF_SLICE_IS_A_SCS +THEN RESA_TAC +THEN REWRITE_TAC[SLICE_IS_UNADORNED]; + +EXISTS_TAC`s'':scs_v39` +THEN ASM_REWRITE_TAC[SET_RULE`b IN {a,b}`;] +THEN MATCH_MP_TAC SGTRNAF +THEN EXISTS_TAC`vv'':num->real^3` +THEN ASM_REWRITE_TAC[IN] +THEN MP_TAC SCS_HALF_SLICE_IS_A_SCS +THEN RESA_TAC +THEN REWRITE_TAC[SLICE_IS_UNADORNED] +THEN MP_TAC SCS_SLICE_SYM +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL SCS_HALF_SLICE_IS_A_SCS)[`s:scs_v39`;`s':scs_v39`;`q:num`;`p:num`;`s'':scs_v39`]; + +EXISTS_TAC`s':scs_v39` +THEN ASM_REWRITE_TAC[SET_RULE`a IN {a,b}`;] +THEN MATCH_MP_TAC SGTRNAF +THEN EXISTS_TAC`vv':num->real^3` +THEN ASM_REWRITE_TAC[IN] +THEN MP_TAC SCS_HALF_SLICE_IS_A_SCS +THEN RESA_TAC +THEN REWRITE_TAC[SLICE_IS_UNADORNED]; + +EXISTS_TAC`s'':scs_v39` +THEN ASM_REWRITE_TAC[SET_RULE`b IN {a,b}`;] +THEN MATCH_MP_TAC SGTRNAF +THEN EXISTS_TAC`vv'':num->real^3` +THEN ASM_REWRITE_TAC[IN] +THEN MP_TAC SCS_HALF_SLICE_IS_A_SCS +THEN RESA_TAC +THEN REWRITE_TAC[SLICE_IS_UNADORNED] +THEN MP_TAC SCS_SLICE_SYM +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL SCS_HALF_SLICE_IS_A_SCS)[`s:scs_v39`;`s':scs_v39`;`q:num`;`p:num`;`s'':scs_v39`] +; + +EXISTS_TAC`s':scs_v39` +THEN ASM_REWRITE_TAC[SET_RULE`a IN {a,b}`;] +THEN MATCH_MP_TAC SGTRNAF +THEN EXISTS_TAC`vv':num->real^3` +THEN ASM_REWRITE_TAC[IN] +THEN MP_TAC SCS_HALF_SLICE_IS_A_SCS +THEN RESA_TAC +THEN REWRITE_TAC[SLICE_IS_UNADORNED]; + +EXISTS_TAC`s'':scs_v39` +THEN ASM_REWRITE_TAC[SET_RULE`b IN {a,b}`;] +THEN MATCH_MP_TAC SGTRNAF +THEN EXISTS_TAC`vv'':num->real^3` +THEN ASM_REWRITE_TAC[IN] +THEN MP_TAC SCS_HALF_SLICE_IS_A_SCS +THEN RESA_TAC +THEN REWRITE_TAC[SLICE_IS_UNADORNED] +THEN MP_TAC SCS_SLICE_SYM +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL SCS_HALF_SLICE_IS_A_SCS)[`s:scs_v39`;`s':scs_v39`;`q:num`;`p:num`;`s'':scs_v39`] +]);; + + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/LOCAL_LEMMAS.hl b/text_formalization/local/LOCAL_LEMMAS.hl new file mode 100644 index 0000000..0d44ffa --- /dev/null +++ b/text_formalization/local/LOCAL_LEMMAS.hl @@ -0,0 +1,7811 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Nguyen Quang Truong *) +(* Date: 2010-05-09 *) +(* ========================================================================== *) + +(* rho_fan interior_angle *) + +flyspeck_needs "local/LDURDPN.hl";; + + +module type Local_lemmas_type = sig + +end;; + +(* ================================================================ *) +(* lemma 6.13 - KOMWBWC *) + +module Local_lemmas = struct + +parse_as_infix("has_orders",(12,"right"));; +parse_as_infix("cyclic_on",(13,"right"));; + +open Ldurdpn;; +open Lvducxu;; +open Sphere;; +open Trigonometry1;; +open Trigonometry2;; +open Hypermap;; +open Fan;; +open Prove_by_refinement;; +open Wrgcvdr_cizmrrh;; +open Aff_sgn_tac;; + + +let rho_node1 = new_definition ` rho_node1 (FF:real^3 # real^3 -> bool) v = (@w. (v,w) IN FF)`;; + +let ivs_rho_node1 = new_definition ` ivs_rho_node1 (FF:real^3 # real^3 -> bool) v = (@a. a,v IN FF )`;; + +let SWITCH_TAC t = UNDISCH_TAC t THEN DISCH_THEN (ASSUME_TAC o GSYM);; + + + + + + + +let LOCAL_FAN_IMP_IN_V = prove_by_refinement +(` local_fan (V,E,FF) /\ x,y IN FF ==> x IN V /\ y IN V `, +[REWRITE_TAC[local_fan]; +NHANH lemma_face_subset; +NHANH ELMS_OF_HYPERMAP_HYP; +LET_TAC THEN STRIP_TAC; +DOWN; +UNDISCH_TAC ` face H (x':real^3 # real^3) SUBSET dart H`; +ASM_REWRITE_TAC[SUBSET]; +DISCH_THEN NHANH; +DOWN_TAC; +REWRITE_TAC[FAN; darts_of_hyp; IN_UNION; Wrgcvdr_cizmrrh.IN_ORD_E_EQ_IN_E]; +STRIP_TAC; +DOWN; +UNDISCH_TAC ` UNIONS E SUBSET (V:real^3 -> bool) `; +NHANH lemma_sub_support; +REWRITE_TAC[INSERT_SUBSET; SUBSET]; +MESON_TAC[]; +DOWN; +REWRITE_TAC[self_pairs; IN_ELIM_THM; PAIR_EQ]; +MESON_TAC[]]);; + + +let LOCAL_FAN_RHO_NODE_PROS = prove_by_refinement +(`local_fan (V,E,FF) + ==> (!x. x IN V ==> x, (rho_node1 FF x) IN FF) /\ + (!x. x IN FF ==> x = FST x,rho_node1 FF (FST x))`, +[ABBREV_TAC `k = (\x. FST (x:real^3 # real^3)) `; +SWITCH_TAC `(\x. FST (x:real^3 # real^3)) = k`; +STRIP_TAC; +MP_TAC2 Wrgcvdr_cizmrrh.BIJ_BETWEEN_FF_AND_V; +REWRITE_TAC[BIJ]; +STRIP_TAC; +SUBGOAL_THEN ` (!x. x IN V ==> x,rho_node1 FF x IN (FF:real^3 # real^3 -> bool))` ASSUME_TAC; +REPEAT STRIP_TAC; +REWRITE_TAC[rho_node1]; +CONV_TAC SELECT_CONV; +DOWN THEN DOWN; +REWRITE_TAC[SURJ]; +STRIP_TAC; +FIRST_ASSUM NHANH; +ASM_REWRITE_TAC[]; +STRIP_TAC; +EXISTS_TAC ` SND (y:real^3 # real^3) `; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[]; +DOWN THEN SIMP_TAC[]; +DOWN; +REWRITE_TAC[SURJ]; +STRIP_TAC THEN STRIP_TAC; +UNDISCH_TAC ` !x. x IN (FF:real^3 # real^3 -> bool) ==> k x IN (V:real^3 -> bool) ` ; +DISCH_THEN NHANH; +FIRST_X_ASSUM NHANH; +DOWN THEN DOWN; +ASM_REWRITE_TAC[INJ]; +MESON_TAC[FST]]);; + + + + +let ORTHONORMAL_CYCLIC = prove_by_refinement +(`~( x:real^N = y ) /\ FINITE U /\ (! u1 u2. u1 IN U /\ u2 IN U +==> (u1 - u2) dot (x - y ) = &0) /\ +U INTER affine hull {x,y} = {} ==> +cyclic_set U x y `, +[SIMP_TAC[cyclic_set]; +STRIP_TAC; +REWRITE_TAC[VECTOR_ARITH` p = q + h % x <=> p - q = h % x `]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC o (SPECL [`p:real^N`;` q:real^N`])); +FIRST_X_ASSUM MP_TAC2; +ASM_REWRITE_TAC[IN]; +ASM_REWRITE_TAC[DOT_LMUL; REAL_ENTIRE; DOT_EQ_0]; +DISCH_THEN DISJ_CASES_TAC; +ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID]; +ASM_REWRITE_TAC[VECTOR_ADD_RID; VECTOR_MUL_RZERO]]);; + + + + +let FAN_SINGLETON_V_DARTS = prove_by_refinement +(` FAN (x:real^N,V,E) /\ V = {v} ==> darts_of_hyp E V = {(v,v)}`, +[REWRITE_TAC[FAN; darts_of_hyp; EXTENSION; IN_INSERT; NOT_IN_EMPTY; SUBSET; IN_UNION; ord_pairs; self_pairs; IN_ELIM_THM]; +NHANH lemma_sub_support; +REWRITE_TAC[INSERT_SUBSET]; +REPEAT STRIP_TAC; +EQ_TAC; +ASM_MESON_TAC[]; +STRIP_TAC; +DISJ2_TAC; +EXISTS_TAC ` v:real^N`; +ASM_REWRITE_TAC[EE; IN_ELIM_THM]; +DOWN_TAC THEN REWRITE_TAC[graph; IN]; +STRIP_TAC; +FIRST_ASSUM NHANH; +REWRITE_TAC[HAS_SIZE; Geomdetail.CARD2]; +REPEAT STRIP_TAC; +UNDISCH_TAC ` (E:(real^N -> bool) -> bool) {v,x'':real^N}`; +PAT_ONCE_REWRITE_TAC `\x. x ==> i ` [GSYM IN ]; +PHA; +NHANH lemma_sub_support; +REWRITE_TAC[INSERT_SUBSET; IN]; +ASM_MESON_TAC[]]);; + + + + + +let FAN_IN_DARTS_FST_EQ_SND_SELF_PAIRS = prove_by_refinement +(` FAN (x:real^N,V,E) /\ y IN darts_of_hyp E V +==> ( FST y = SND y <=> y IN self_pairs E V )`, +[REWRITE_TAC[FAN; graph; darts_of_hyp; IN_UNION; ord_pairs; self_pairs; IN_ELIM_THM]; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC2 o (SPEC `{a,b:real^N}`)); +ONCE_REWRITE_TAC[GSYM IN]; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[HAS_SIZE; Geomdetail.CARD2; PAIR_EQ]; +MESON_TAC[]; +ASM_REWRITE_TAC[]; +EXISTS_TAC ` v:real^N`; +ASM_REWRITE_TAC[]]);; + + + + +let FAN_FST_EQ_SND_SUPPER_EQ = prove_by_refinement +(` FAN (x,V,E) /\ FST y = SND y ==> +ee_of_hyp (x,V,E) y = y /\ +nn_of_hyp (x,V,E) y = y /\ +ff_of_hyp (x,V,E) y = y `, +[STRIP_TAC; +ASM_CASES_TAC ` y IN darts_of_hyp E (V:real^3 -> bool) `; +ASM_SIMP_TAC[Lvducxu.EE_OF_HYP_IDE_FST_SND_EQ]; +UNDISCH_TAC ` FST y = SND (y:real^3 # real^3) `; +ASSUME_TAC2 ( +ISPEC `x:real^3 ` (GEN `x:real^N `FAN_IN_DARTS_FST_EQ_SND_SELF_PAIRS)); +ASM_SIMP_TAC[nn_of_hyp3; ff_of_hyp3]; +ASM_REWRITE_TAC[nn_of_hyp2; ee_of_hyp2; ff_of_hyp2]]);; + + + + + + +let COLLINEAR_CROSS_0 = prove( +` collinear {x,y,z} <=> (y - x ) cross ( z - x ) = vec 0 `, +ONCE_REWRITE_TAC[Trigonometry2.COLLINEAR_TRANSABLE] THEN +REWRITE_TAC[CROSS_EQ_0]);; + + + + +let DET_CROSS = prove(` det (vector [x;y;z]) = (x cross y ) dot z `, +REWRITE_TAC[Trigonometry2.DET_VEC3_EXPAND; Trigonometry2.DET_VEC3_AS_CROSS_DOT]);; + + + +let COPLANAR_IFF_CROSS_DOT = prove( +` coplanar {x,y,z,t} <=> (( y - x ) cross ( z - x ) ) dot ( t - x ) = &0`, +REWRITE_TAC[COPLANAR_DET_EQ_0; DET_CROSS]);; + + + + + +let CROSS_DOT_COPLANAR = prove( + ` (x cross y) dot z = &0 <=> coplanar {vec 0, x, y, z}`, +REWRITE_TAC[COPLANAR_IFF_CROSS_DOT; VECTOR_SUB_RZERO]);; + + + + + +let SUBSET_NOT_COLLINEAR_AFFINE_HULL_EQ = prove_by_refinement +(` {a:real^3,b,c} SUBSET affine hull {x,y,z} /\ ~( collinear {a,b,c}) +==> affine hull {x,y,z} = affine hull {a,b,c} `, +[REWRITE_TAC[COLLINEAR_CROSS_0]; +REWRITE_TAC[GSYM DOT_EQ_0]; +REWRITE_TAC[CROSS_DOT_COPLANAR]; +STRIP_TAC; +REWRITE_TAC[EXTENSION]; +GEN_TAC; +EQ_TAC; +DOWN THEN NHANH (SMOOTH_GEN_ALL Trigonometry2.NONCOPLANAR_3_BASIS); +REWRITE_TAC[VECTOR_SUB_RZERO]; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC ` x':real^3 - a`)); +REPEAT STRIP_TAC; +SUBGOAL_THEN ` coplanar {a,b,c,x':real^3}` MP_TAC; +DOWN_TAC; +REWRITE_TAC[coplanar; INSERT_SUBSET; EMPTY_SUBSET]; +MESON_TAC[]; +ASM_REWRITE_TAC[COPLANAR_IFF_CROSS_DOT; DOT_RADD; DOT_RMUL; DOT_CROSS_SELF; + Collect_geom.ZERO_NEUTRAL; REAL_ENTIRE; DOT_EQ_0; GSYM COLLINEAR_CROSS_0]; +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +UNDISCH_TAC ` x' - (a:real^3) = t1 % (b - a) + t2 % (c - a) + &0 % ((b - a) cross (c - a)) `; +REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID; VECTOR_ARITH` x' - a = t1 % (b - a) + t2 % (c - a) <=> x' = (&1 - t1 - t2) % a + t1 % b + t2 % c `; AFFINE_HULL_3; IN_ELIM_THM]; +MESON_TAC[REAL_ARITH` (&1 - a - b ) + a + b = &1 `]; +DOWN_TAC; +NHANH NOT_COPLANAR_NOT_COLLINEAR; +ONCE_REWRITE_TAC[Trigonometry2.COLLINEAR_TRANSABLE]; +REWRITE_TAC[VECTOR_SUB_RZERO]; +MESON_TAC[]; +DOWN_TAC; +NHANH (ISPEC ` affine ` HULL_MONO); +REWRITE_TAC[HULL_HULL; SUBSET]; +MESON_TAC[]]);; + + + + +let THREE_NOT_COLL_DETER_PLANE = prove( +`plane P /\ {a:real^3,b,c} SUBSET P /\ ~collinear {a,b,c} +==> affine hull {a,b,c} = P `, REWRITE_TAC[plane] THEN +MESON_TAC [SUBSET_NOT_COLLINEAR_AFFINE_HULL_EQ ]);; + + + + +let LOCAL_FAN_NOT_V_SING = prove_by_refinement +(` local_fan (V,E,FF) ==> ~(?v. V = {v}) `, +[REWRITE_TAC[local_fan; dih2k]; +LET_TAC; +NHANH ELMS_OF_HYPERMAP_HYP; +REPEAT STRIP_TAC; +UNDISCH_TAC ` V = {v:real^3}`; +UNDISCH_TAC `FAN (vec 0:real^3,V,E) `; +PHA; +NHANH FAN_SINGLETON_V_DARTS; +NHANH (MESON[CARD_SINGLETON]` S = {c} ==> CARD S = 1 `); +STRIP_TAC; +UNDISCH_TAC ` CARD (dart (H:(real^3 # real^3) hypermap)) = 2 * CARD (FF:real^3 # real^3 -> bool)` ; +DOWN; +EXPAND_TAC "H"; +ASM_SIMP_TAC[]; +MESON_TAC[FACE_NOT_EMPTY; ARITH_RULE` 1 <= a ==> ~( 1 = 2 * a ) `]]);; + + + + + +let LOCAL_FAN_NOT_SING_FF = prove_by_refinement +(` local_fan (V,E,FF) ==> ~(? x. FF = {x})`, +[STRIP_TAC; +ABBREV_TAC ` k = (\x. FST (x:real^3 # real^3)) `; +SWITCH_TAC ` (\x. FST (x:real^3 # real^3)) = k `; +ASSUME_TAC2 Wrgcvdr_cizmrrh.BIJ_BETWEEN_FF_AND_V; +DOWN; +REWRITE_TAC[BIJ]; +NHANH Wrgcvdr_cizmrrh.SURJ_IMP_S2_EQ_IMAGE_S1; +REPEAT STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN; +REWRITE_TAC[IMAGE; IN_INSERT; NOT_IN_EMPTY; SET_RULE` {y | ?x'. x' = x /\ y = k x'} = {k x }`]; +DOWN_TAC THEN NHANH LOCAL_FAN_NOT_V_SING; +MESON_TAC[]]);; + + + + + + +let LOCAL_FAN_IN_FF_DISTINCT = prove_by_refinement +(` local_fan (V,E,FF) /\ x IN FF ==> ~( FST x = SND x ) `, +[NHANH LOCAL_FAN_NOT_SING_FF; +REWRITE_TAC[local_fan]; +LET_TAC; +STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[]; +NHANH lemma_face_identity; +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +STRIP_TAC; +SUBGOAL_THEN ` face_map (H:(real^3 # real^3) hypermap) x = x ` ASSUME_TAC; +DOWN_TAC; +NHANH ELMS_OF_HYPERMAP_HYP; +IMP_TAC THEN SIMP_TAC[]; +STRIP_TAC; +STRIP_TAC; +DOWN; +UNDISCH_TAC ` FAN (vec 0:real^3,V,E) `; +PHA; +SIMP_TAC[FAN_FST_EQ_SND_SUPPER_EQ]; +DOWN THEN PHA THEN ONCE_REWRITE_TAC[orbit_one_point]; +REWRITE_TAC[GSYM face; ETA_AX]; +ASM_MESON_TAC[]]);; + + + + +let LOCAL_FAN_IN_FF_IN_ORD_PAIRS = prove_by_refinement +(` local_fan (V,E,FF) /\ x IN FF ==> x IN ord_pairs E `, +[NHANH LOCAL_FAN_IN_FF_DISTINCT; +REWRITE_TAC[local_fan]; +NHANH ELMS_OF_HYPERMAP_HYP; +LET_TAC; +NHANH lemma_face_subset; +ASM_REWRITE_TAC[SUBSET]; +STRIP_TAC; +UNDISCH_TAC ` (x:real^3 # real^3) IN FF `; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM NHANH; +ASM_REWRITE_TAC[darts_of_hyp; IN_UNION]; +STRIP_TAC; +DOWN; +REWRITE_TAC[self_pairs; IN_ELIM_THM]; +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +REPLICATE_TAC 4 DOWN; +REWRITE_TAC[]]);; + + + + + + +let LOCAL_FAN_IN_FF_NOT_COLLINEAR = prove( +` local_fan (V,E,FF) /\ x IN FF ==> ~( collinear {vec 0, FST x, SND x }) `, +NHANH LOCAL_FAN_IN_FF_IN_ORD_PAIRS THEN +REWRITE_TAC[Wrgcvdr_cizmrrh.IN_ORD_E_EQ_IN_E; local_fan; FAN; fan6; IN] THEN +LET_TAC THEN STRIP_TAC THEN DOWN THEN FIRST_X_ASSUM NHANH THEN +SIMP_TAC[SET_RULE` {a} UNION S = a INSERT S `]);; + + + + + + + +let LOCAL_FAN_CHARACTER_OF_RHO_NODE = prove_by_refinement +(` local_fan (V,E,FF) ==> (! v. v IN V ==> ~( rho_node1 FF v = v ) /\ +v, rho_node1 FF v IN ord_pairs E /\ +~ (collinear {vec 0, v, rho_node1 FF v})) `, +[NHANH LOCAL_FAN_RHO_NODE_PROS; +STRIP_TAC; +FIRST_X_ASSUM NHANH; +FIRST_X_ASSUM NHANH; +GEN_TAC THEN IMP_TAC THEN REMOVE_TAC; +DOWN THEN PHA; +NHANH LOCAL_FAN_IN_FF_DISTINCT; +NHANH LOCAL_FAN_IN_FF_NOT_COLLINEAR; +NHANH LOCAL_FAN_IN_FF_IN_ORD_PAIRS; +SIMP_TAC[]]);; + + +let graph2 = prove(`graph E <=> (!e. e IN E ==> FINITE e /\ CARD e = 2)`, +REWRITE_TAC[graph; IN; HAS_SIZE]);; + +let GRAPH_WITH_SET2 = prove( +` graph E ==> (! a b. {a,b} IN E ==> ~( a = b )) `, +REWRITE_TAC[graph2] THEN DISCH_THEN NHANH THEN +SIMP_TAC[Geomdetail.CARD2]);; + + + +let FAN_V_TWO_ELMS_IN_E_DARTS2 = prove_by_refinement +(` FAN (x:real^N,V,E) /\ V = {v1,v2} /\ {v1,v2} IN E ==> +darts_of_hyp E V = {(v1,v2), (v2,v1)}`, +[REWRITE_TAC[darts_of_hyp; FAN; EXTENSION; IN_UNION; ord_pairs; self_pairs; + IN_ELIM_THM; SUBSET; graph2; IN_INSERT; NOT_IN_EMPTY]; +STRIP_TAC THEN GEN_TAC; +EQ_TAC; +STRIP_TAC; +UNDISCH_TAC ` {a:real^N, b} IN E `; +NHANH lemma_sub_support; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +FIRST_X_ASSUM NHANH; +FIRST_X_ASSUM NHANH; +ASM_REWRITE_TAC[Geomdetail.CARD2; PAIR_EQ]; +MESON_TAC[]; +UNDISCH_TAC ` v:real^N IN V `; +UNDISCH_TAC ` !x. ~(x IN EE (v:real^N) E)`; +UNDISCH_TAC ` {v1, v2:real^N} IN E`; +ASM_REWRITE_TAC[EE; IN_ELIM_THM]; +PHA; +MESON_TAC[INSERT_COMM]; +STRIP_TAC; +DISJ1_TAC; +DOWN THEN DOWN; +MESON_TAC[]; +DISJ1_TAC; +DOWN THEN DOWN THEN PHA; +MESON_TAC[INSERT_COMM]]);; + + + +let FAN_IN_E_DIFF = prove( +` FAN (x,V,E) ==> (! x y. {x,y} IN E ==> ~( x,y = y,x)) `, +REWRITE_TAC[PAIR_EQ; FAN] THEN NHANH GRAPH_WITH_SET2 THEN MESON_TAC[]);; + + + + +let LOCAL_FAN_NOT_TWO_V_IN_E = prove_by_refinement +(` local_fan (V,E,FF) ==> ~(? v1 v2. V = {v1,v2} /\ {v1,v2} IN E )`, +[NHANH Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN; +STRIP_TAC THEN STRIP_TAC; +DOWN_TAC; +NHANH FAN_V_TWO_ELMS_IN_E_DARTS2; +NHANH FAN_IN_E_DIFF; +NHANH LOCAL_FAN_NOT_SING_FF; +REWRITE_TAC[GSYM Geomdetail.CARD2; local_fan; dih2k]; +LET_TAC; +NHANH ELMS_OF_HYPERMAP_HYP; +ASM_REWRITE_TAC[]; +STRIP_TAC; +UNDISCH_TAC` CARD (dart (H:(real^3 # real^3) hypermap)) = 2 * CARD (FF:real^3 # real^3 -> bool) `; +ASM_SIMP_TAC[ARITH_RULE` 2 = 2 * x <=> x = 1 `]; +STRIP_TAC; +SUBGOAL_THEN ` face H (x:real^3 # real^3) = {x} ` ASSUME_TAC; +MATCH_MP_TAC set_one_point; +ASM_REWRITE_TAC[FACE_FINITE; face_refl]; +UNDISCH_TAC ` ~(?x. FF = {x:real^3 # real^3})`; +ASM_REWRITE_TAC[]; +MESON_TAC[]]);; + + + + + + +let LOCAL_FAN_ORBIT_MAP_V = prove( +` local_fan (V,E,FF) ==> (! v. v IN V ==> orbit_map (rho_node1 FF) v = V) `, +NHANH LOCAL_FAN_RHO_NODE_PROS THEN +STRIP_TAC THEN +ABBREV_TAC ` k = (\x. FST (x:real^3 # real^3)) ` THEN +SWITCH_TAC `(\x. FST (x:real^3 # real^3)) = k ` THEN +ASSUME_TAC2 (SMOOTH_GEN_ALL Wrgcvdr_cizmrrh.WRGCVDR) THEN +FIRST_X_ASSUM (MP_TAC o (SPEC ` rho_node1 (FF:real^3 # real^3 -> bool) `)) THEN +STRIP_TAC THEN +FIRST_X_ASSUM MP_TAC2 THEN +DISCH_THEN MP_TAC2 THEN +SIMP_TAC[EQ_SYM_EQ]);; + + + + + +let LOCAL_FAN_RHO_NODE_PROS2 = ONCE_REWRITE_RULE[TAUT` a /\ b <=> b /\ a `] LOCAL_FAN_RHO_NODE_PROS;; + + + +let FINTE_OF_N_FIRST_ELMS2 = prove(`FINITE {ITER n f x | n < i}`, +REWRITE_TAC[SET_RULE` {ITER n f x | n < i} = {y | ?n. n < i /\ y = ITER n f x}`] +THEN REWRITE_TAC[Wrgcvdr_cizmrrh.FINITE_OF_N_FIRST_ELMS]);; + + + + +let PLANE_AFFINE_HUL_INTER_P = prove_by_refinement +(` plane P /\ {x,y,z} SUBSET P +==> affine hull {x, x + ( y - x ) cross ( z - x )} INTER P = {x} `, +[REWRITE_TAC[AFFINE_HULL_2; EXTENSION; IN_INSERT; NOT_IN_EMPTY; IN_INTER]; +STRIP_TAC; +GEN_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EQ_TAC; +STRIP_TAC; +SUBGOAL_THEN ` coplanar {x,y,z,x':real^3} ` ASSUME_TAC; +DOWN_TAC; +REWRITE_TAC[coplanar; plane; INSERT_SUBSET]; +MESON_TAC[]; +DOWN; +ASM_REWRITE_TAC[COPLANAR_IFF_CROSS_DOT; VECTOR_ARITH` u % x + v % ( x + y ) = + ( u + v ) % x + v % y `; VECTOR_MUL_LID; VECTOR_ARITH ` (a + b:real^N) - a = +b `; VECTOR_ARITH` a + b = a <=> b = vec 0 `; DOT_RMUL; REAL_ENTIRE; DOT_EQ_0; + VECTOR_MUL_EQ_0]; +DOWN THEN PHA; +SIMP_TAC[INSERT_SUBSET]; +STRIP_TAC; +EXISTS_TAC` &1 `; +EXISTS_TAC ` &0 `; +REWRITE_TAC[REAL_ADD_RID; VECTOR_MUL_LZERO; VECTOR_MUL_LID; VECTOR_ADD_RID]]);; + + + + + +let FAN_IMP_V_DIFF = prove( ` FAN (x,V,E) ==> (! v. v IN V ==> ~( v = x )) `, +REWRITE_TAC[FAN; fan2] THEN MESON_TAC[]);; + + + + + + +let LOCAL_FAN_IMP_CYCLIC_SET = prove_by_refinement +(` local_fan (V,E,FF) /\ v IN V /\ +{ITER n (rho_node1 FF) v | n <= l } = U /\ +plane P /\ vec 0 IN P /\ +U SUBSET P /\ v cross (rho_node1 FF v ) = e +==> cyclic_set U (vec 0 ) e `, +[NHANH LOCAL_FAN_RHO_NODE_PROS; +STRIP_TAC; +MATCH_MP_TAC ORTHONORMAL_CYCLIC; +UNDISCH_TAC ` v:real^3 IN V `; +UNDISCH_TAC ` !x. x IN V ==> x,rho_node1 FF x IN (FF:real^3 # real^3 -> bool) `; +STRIP_TAC; +FIRST_ASSUM NHANH; +STRIP_TAC; +DOWN; +UNDISCH_TAC ` local_fan (V,E,FF) `; +PHA; +NHANH LOCAL_FAN_IN_FF_NOT_COLLINEAR; +REWRITE_TAC[ GSYM CROSS_EQ_0]; +ASM_SIMP_TAC[]; +EXPAND_TAC "U"; +REWRITE_TAC[ARITH_RULE` a <= b <=> a < b + 1 `]; +REWRITE_TAC[FINTE_OF_N_FIRST_ELMS2]; +STRIP_TAC; +ASM_CASES_TAC ` l = 0 `; +ASM_REWRITE_TAC[ARITH_RULE ` x < 0 + 1 <=> x = 0`; IN_ELIM_THM]; +CONJ_TAC; +REPEAT STRIP_TAC; +ASM_REWRITE_TAC[VECTOR_SUB_REFL; DOT_LZERO]; +REWRITE_TAC[EXTENSION; NOT_IN_EMPTY; IN_INTER; IN_ELIM_THM]; +STRIP_TAC; +STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[ITER; AFFINE_HULL_2; IN_ELIM_THM; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +STRIP_TAC; +SUBGOAL_THEN ` v dot (e:real^3) = &0` ASSUME_TAC; +EXPAND_TAC "e"; +REWRITE_TAC[DOT_CROSS_SELF]; +DOWN; +ASM_REWRITE_TAC[DOT_LMUL; REAL_ENTIRE; DOT_EQ_0]; +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN; +REWRITE_TAC[VECTOR_MUL_LZERO]; +MP_TAC2 Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN; +REWRITE_TAC[FAN; fan2]; +UNDISCH_TAC ` v:real^3 IN V `; +MESON_TAC[]; +SUBGOAL_THEN ` {vec 0, v, rho_node1 (FF:real^3 # real^3 -> bool) v} SUBSET P ` ASSUME_TAC; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +UNDISCH_TAC ` U SUBSET (P:real^3 -> bool) `; +MATCH_MP_TAC (SET_RULE` a IN S /\ b IN S ==> S SUBSET A ==> a IN A /\ b IN A `); +EXPAND_TAC "U"; +REWRITE_TAC[IN_ELIM_THM]; +CONJ_TAC; +EXISTS_TAC ` 0`; +DOWN; +REWRITE_TAC[ITER]; +ARITH_TAC; +EXISTS_TAC ` 1 `; +DOWN; +REWRITE_TAC[ITER1]; +ARITH_TAC; +DOWN; +UNDISCH_TAC ` plane (P:real^3 -> bool) `; +PHA; +NHANH PLANE_AFFINE_HUL_INTER_P; +ASM_REWRITE_TAC[VECTOR_SUB_RZERO; VECTOR_ADD_LID]; +ASSUME_TAC2 LOCAL_FAN_ORBIT_MAP_V; +UNDISCH_TAC ` v:real^3 IN V `; +FIRST_ASSUM NHANH; +ASM_REWRITE_TAC[ARITH_RULE` a < b + 1 <=> a <= b `]; +REPEAT STRIP_TAC; +SUBGOAL_THEN ` ! u. u IN U ==> (u:real^3) dot --e = &0 ` ASSUME_TAC; +REPEAT STRIP_TAC; +SUBGOAL_THEN ` {vec 0, v, rho_node1 FF v, u:real^3} SUBSET P` MP_TAC; +DOWN_TAC; +SIMP_TAC[INSERT_SUBSET]; +STRIP_TAC; +DOWN; +UNDISCH_TAC ` U SUBSET (P:real^3 -> bool) `; +SET_TAC[]; +UNDISCH_TAC `plane (P:real^3 -> bool) `; +REWRITE_TAC[plane]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN ` coplanar {vec 0, v, rho_node1 FF v, u:real^3} ` MP_TAC; +REWRITE_TAC[coplanar]; +DOWN THEN MESON_TAC[]; +ASM_REWRITE_TAC[COPLANAR_IFF_CROSS_DOT; VECTOR_SUB_RZERO; DOT_RNEG]; +SIMP_TAC[DOT_SYM]; +REAL_ARITH_TAC; +ASM_SIMP_TAC[DOT_LSUB; VECTOR_SUB_LZERO]; +REAL_ARITH_TAC; +REWRITE_TAC[EXTENSION; NOT_IN_EMPTY; IN_INTER]; +REPEAT STRIP_TAC; +SUBGOAL_THEN ` x IN affine hull {vec 0, e:real^3} INTER P` MP_TAC; +ASM_REWRITE_TAC[IN_INTER]; +UNDISCH_TAC ` x IN U:real ^3 -> bool `; +UNDISCH_TAC ` U SUBSET P:real^3 -> bool `; +SET_TAC[]; +ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY]; +SUBGOAL_THEN ` U SUBSET (V:real^3 -> bool) ` MP_TAC; +EXPAND_TAC "U"; +EXPAND_TAC "V"; +REWRITE_TAC[GSYM POWER_TO_ITER; lemma_subset_orbit]; +REWRITE_TAC[SUBSET]; +STRIP_TAC; +UNDISCH_TAC ` x:real^3 IN U `; +FIRST_X_ASSUM NHANH; +MP_TAC2 Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN; +REWRITE_TAC[FAN; fan2]; +MESON_TAC[]]);; + + + + +let LOCAL_FAN_ITER_RHO_NODE_IN_V = prove( +` local_fan (V,E,FF) /\ v IN V ==> +(! i. ITER i (rho_node1 FF ) v IN V )`, +NHANH LOCAL_FAN_ORBIT_MAP_V THEN STRIP_TAC THEN +DOWN THEN FIRST_X_ASSUM (NHANH_PAT `\x. x ==> y `) THEN +STRIP_TAC THEN EXPAND_TAC "V" THEN +REWRITE_TAC[orbit_map; POWER_TO_ITER; IN_ELIM_THM; ARITH_RULE` a >= 0 `] THEN +MESON_TAC[]);; + + + +let ORD2_ORBIT_MAP = prove(` f ( f x ) = (x:A) ==> orbit_map f x = {x, f x} `, +STRIP_TAC THEN SUBGOAL_THEN ` 0 < 2 /\ ITER 2 f (x:A) = x ` MP_TAC THENL +[ASM_REWRITE_TAC[ARITH_RULE ` 0 < 2 `; ITER12]; +NHANH Lvducxu.ITER_CYCLIC_ORBIT] THEN SIMP_TAC[] THEN STRIP_TAC THEN +REWRITE_TAC[EXTENSION; IN_INSERT; NOT_IN_EMPTY; IN_ELIM_THM; ARITH_RULE ` +x < 2 <=> x = 0 \/ x = 1 `] THEN MESON_TAC[ITER; ITER1]);; + + +let LOCAL_FAN_IMP_NOT_SEMI_IDE = prove( +` local_fan (V,E,FF) ==> (!v. v IN V ==> ~( rho_node1 FF ( rho_node1 FF v ) = v ))`, +NHANH LOCAL_FAN_CHARACTER_OF_RHO_NODE THEN +NHANH LOCAL_FAN_ORBIT_MAP_V THEN +NHANH LOCAL_FAN_NOT_TWO_V_IN_E THEN +REWRITE_TAC[Wrgcvdr_cizmrrh.IN_ORD_E_EQ_IN_E] THEN +MESON_TAC[ORD2_ORBIT_MAP]);; + + + +open Fan_misc;; +open Fan_defs;; +open Planarity;; +open Topology;; + + + + +let RHO_NODE_SET_IN_A_PLANE_IMP_POS_DIRECT = prove_by_refinement +(`local_fan (V,E,FF) /\ + v IN V /\ + {ITER n (rho_node1 FF) v | n <= l} = U /\ + plane P /\ + vec 0 IN P /\ + U SUBSET P /\ + v cross rho_node1 FF v = e + ==> (!i. i < l + ==> &0 < + (ITER i (rho_node1 FF) v cross ITER (i + 1) (rho_node1 FF) v) dot + e)`, +[STRIP_TAC; +INDUCT_TAC; +REWRITE_TAC[ITER; ITER1; ARITH_RULE` 0 + 1 = 1 `]; +MP_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE; +DISCH_THEN (MP_TAC2 o (SPEC `v:real^3`)); +REWRITE_TAC[COLLINEAR_CROSS_0]; +REWRITE_TAC[VECTOR_SUB_RZERO]; +ASM_SIMP_TAC[DOT_POS_LT]; +NHANH (ARITH_RULE` SUC a < b ==> a < b `); +FIRST_X_ASSUM NHANH; +STRIP_TAC; +MP_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE; + + + + + +DISCH_THEN (MP_TAC2 o (SPEC ` ITER i (rho_node1 (FF:real^3 # real^3 -> bool)) v:real^3`)); +MP_TAC2 LOCAL_FAN_ITER_RHO_NODE_IN_V; +STRIP_TAC; +ABBREV_TAC` px = ITER i (rho_node1 FF) v:real^3 `; +ABBREV_TAC` py = ITER (i + 1) (rho_node1 FF) v:real^3 `; +ABBREV_TAC` pz = ITER (SUC i + 1) (rho_node1 FF) v:real^3 `; +ASM_REWRITE_TAC[ADD1]; +SUBGOAL_THEN ` {px,py,pz} SUBSET (U:real^3 -> bool) ` MP_TAC; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +EXPAND_TAC "U"; +REWRITE_TAC[IN_ELIM_THM]; +EXPAND_TAC "px"; +EXPAND_TAC "py"; +EXPAND_TAC "pz"; + +MP_TAC2 (ARITH_RULE` SUC i < l ==> SUC i + 1 <= l /\ i <= l /\ i + 1 <= l`); +MESON_TAC[]; + +STRIP_TAC; +SUBGOAL_THEN ` {px, py, pz} SUBSET (P:real^3 -> bool) ` ASSUME_TAC; +UNDISCH_TAC ` U SUBSET (P:real^3 -> bool) `; +DOWN; +PHA; +REWRITE_TAC[SUBSET_TRANS]; +SUBGOAL_THEN ` rho_node1 (FF:real^3 # real^3 -> bool) px = py /\ +rho_node1 (FF:real^3 # real^3 -> bool) py = pz` MP_TAC; +EXPAND_TAC "px"; +EXPAND_TAC "py"; +EXPAND_TAC "pz"; +REWRITE_TAC[GSYM ITER; ADD1]; +STRIP_TAC; +SUBGOAL_THEN ` {vec 0, px, rho_node1 FF px} SUBSET (P:real^3 -> bool) ` MP_TAC; +UNDISCH_TAC ` {px,py,pz:real^3} SUBSET P `; + +ASM_SIMP_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +STRIP_TAC; +SUBGOAL_THEN ` affine hull {vec 0, px, py:real^3} = P ` MP_TAC; +MATCH_MP_TAC THREE_NOT_COLL_DETER_PLANE; +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` ~collinear {vec 0, px, rho_node1 FF (px:real^3)}`; +UNDISCH_TAC ` {vec 0, px, rho_node1 FF px} SUBSET (P:real^3 -> bool) `; +PHA; +ASM_SIMP_TAC[]; + +REWRITE_TAC[AFFINE_HULL_3]; +STRIP_TAC; +UNDISCH_TAC ` {px, py, pz} SUBSET (P:real^3 -> bool) `; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +STRIP_TAC; +DOWN; +EXPAND_TAC "P"; +REWRITE_TAC[IN_ELIM_THM; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +STRIP_TAC; +ASM_CASES_TAC` v' < &0 `; +ASM_REWRITE_TAC[CROSS_RADD; CROSS_RMUL; CROSS_REFL; VECTOR_MUL_RZERO; VECTOR_ADD_RID]; +ONCE_REWRITE_TAC[CROSS_SKEW]; +REWRITE_TAC[ DOT_LMUL; DOT_LNEG; REAL_ARITH` a * -- b = (-- a ) * b `]; +MATCH_MP_TAC REAL_LT_MUL; +ASM_SIMP_TAC[REAL_ARITH` &0 < -- a <=> a < &0 `]; +DOWN; +REWRITE_TAC[REAL_ARITH` ~( a < &0 ) <=> &0 <= a `]; +STRIP_TAC; +ASM_CASES_TAC ` &0 <= w `; +ASSUME_TAC2 LOCAL_FAN_ORBIT_MAP_V; +UNDISCH_TAC `v:real^3 IN V `; +FIRST_ASSUM NHANH; +STRIP_TAC; +SUBGOAL_THEN ` px:real^3 IN V ` MP_TAC; +EXPAND_TAC "V"; +EXPAND_TAC "px"; +REWRITE_TAC[lemma_in_orbit; GSYM POWER_TO_ITER]; +MP_TAC2 LOCAL_FAN_IMP_NOT_SEMI_IDE; +DISCH_THEN NHANH; +SWITCH_TAC ` pz = v' % px + w % (py:real^3) `; +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC2 Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN; +REWRITE_TAC[FAN; fan7]; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC2 o (SPECL [` {px, py:real^3}`;` {pz:real^3 }`])); +UNDISCH_TAC ` (px:real^3),rho_node1 FF px IN ord_pairs E`; +ASM_SIMP_TAC[Wrgcvdr_cizmrrh.IN_ORD_E_EQ_IN_E; IN_UNION]; +STRIP_TAC; +DISJ2_TAC; +REWRITE_TAC[IN_ELIM_THM; EXTENSION; IN_INSERT; NOT_IN_EMPTY]; + +EXISTS_TAC ` pz:real^3 `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` ITER (SUC i + 1) (rho_node1 FF) v:real^3 = pz:real^3`; +STRIP_TAC; +EXPAND_TAC "pz"; +EXPAND_TAC "V"; +REWRITE_TAC[GSYM POWER_TO_ITER; lemma_in_orbit]; +SUBGOAL_THEN ` {px,py} INTER {pz:real^3} = {} ` SUBST1_TAC; +ASM_REWRITE_TAC[SET_RULE ` {a,b} INTER {x} = {} <=> ~( x = a ) /\ ~( x = b )`]; +ASSUME_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE; +SUBGOAL_THEN ` py:real^3 IN V ` MP_TAC; +EXPAND_TAC "py"; +EXPAND_TAC "V"; +EXPAND_TAC "px"; +REWRITE_TAC[GSYM ITER]; +REWRITE_TAC[GSYM POWER_TO_ITER; lemma_in_orbit]; +FIRST_X_ASSUM NHANH; +ASM_SIMP_TAC[AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING]; +SUBGOAL_THEN ` pz:real^3 IN V /\ py IN V` MP_TAC; +SWITCH_TAC ` ITER (SUC i + 1) (rho_node1 FF) v = pz:real^3 `; +ASM_REWRITE_TAC[GSYM ITER]; +EXPAND_TAC "V"; +EXPAND_TAC "py"; +EXPAND_TAC "px"; +REWRITE_TAC[GSYM ITER]; +REWRITE_TAC[GSYM POWER_TO_ITER; lemma_in_orbit]; +STRIP_TAC; +SUBGOAL_THEN ` DISJOINT {vec 0} {px, py:real^3} /\ ~( vec 0 = pz:real^3)` MP_TAC; +UNDISCH_TAC ` fan2 (vec 0:real^3, V:real^3 -> bool, E: (real^3 -> bool) -> bool) `; +REWRITE_TAC[fan2; SET_RULE `DISJOINT {x} {a,b} <=> ~( x = a ) /\ ~( x = b ) `]; +ASM_MESON_TAC[]; + + + +REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING]; +STRIP_TAC; +SUBGOAL_THEN ` pz:real^3 IN aff_ge {vec 0} {px, py} INTER aff_ge {vec 0} {pz} ` ASSUME_TAC; +ASM_SIMP_TAC[IN_INTER; Fan.AFF_GE_1_2; Fan.AFF_GE_1_1]; +CONJ_TAC; +REWRITE_TAC[IN_ELIM_THM; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +EXPAND_TAC "pz"; +UNDISCH_TAC ` &0 <= v' `; +UNDISCH_TAC ` &0 <= w `; +MESON_TAC[REAL_ARITH` (&1 - a - b ) + a + b = &1 `]; +REWRITE_TAC[IN_ELIM_THM]; +REWRITE_TAC[ENDS_IN_HALFLINE]; +DISCH_THEN SUBST_ALL_TAC; +DOWN; +REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY]; +DOWN; +MESON_TAC[]; +ASM_CASES_TAC ` v' = &0 `; +UNDISCH_TAC` pz = v' % px + w % (py:real^3) `; +ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID]; +NHANH (MESON[COLLINEAR_LEMMA]` x = a % y ==> collinear {vec 0,y,x}`); +ASSUME_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE; +ASSUME_TAC2 LOCAL_FAN_ITER_RHO_NODE_IN_V; +FIRST_ASSUM (MP_TAC o (SPEC ` i + 1 `)); +FIRST_ASSUM NHANH; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; + +ASSUME_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE; +ASSUME_TAC2 LOCAL_FAN_IMP_NOT_SEMI_IDE; +ASSUME_TAC2 LOCAL_FAN_ITER_RHO_NODE_IN_V; +FIRST_ASSUM (MP_TAC o (SPEC ` i: num`)); +FIRST_X_ASSUM NHANH; +FIRST_ASSUM (MP_TAC o (SPEC ` i + 1`)); +FIRST_ASSUM NHANH; + +SWITCH_TAC ` pz = v' % px + w % (py:real^3) `; +ASM_REWRITE_TAC[Wrgcvdr_cizmrrh.IN_ORD_E_EQ_IN_E]; +STRIP_TAC THEN STRIP_TAC; + +MP_TAC2 Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN; +REWRITE_TAC[FAN; fan7]; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC2 o (SPECL [` {py, pz:real^3}`;` {px:real^3}`])); +ASM_REWRITE_TAC[IN_UNION; IN_ELIM_THM; EXTENSION; IN_INSERT; NOT_IN_EMPTY]; +DISJ2_TAC; +EXISTS_TAC ` px:real^3`; +UNDISCH_TAC ` ITER (i) (rho_node1 FF) v = (px:real^3)`; +DISCH_THEN (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[]; +SUBGOAL_THEN ` {py, pz} INTER {px:real^3} = {} ` SUBST1_TAC; +ASM_REWRITE_TAC[SET_RULE` {a,b} INTER {x} = {} <=> ~( a = x ) /\ ~( b = x )`; AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING]; +SUBGOAL_THEN ` DISJOINT {vec 0} {py, pz:real^3} /\ ~( vec 0 = px:real^3)` MP_TAC; +REWRITE_TAC[SET_RULE` DISJOINT {x} {a,b} <=> ~( x = a ) /\ ~( x = b )`]; +DOWN_TAC; +NHANH Collect_geom.NOT_COL3_IMP_DIFF; +SIMP_TAC[DE_MORGAN_THM]; + +STRIP_TAC; +SUBGOAL_THEN ` v' % (px:real^3) IN aff_ge {vec 0} {py, pz} INTER aff_ge {vec 0} {px} ` MP_TAC; +ASM_SIMP_TAC[Fan.AFF_GE_1_2; Fan.AFF_GE_1_1; IN_INTER; IN_ELIM_THM]; +CONJ_TAC; +UNDISCH_TAC ` v' % px + w % py = (pz:real^3 )`; +UNDISCH_TAC` ~( &0 <= w ) `; +NHANH (REAL_ARITH` ~( &0 <= x ) ==> &0 <= -- x `); +PHA; +SIMP_TAC[VECTOR_ARITH` a + b % y = z <=> a = ( -- b ) % y + z `; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +MESON_TAC[REAL_ARITH` &0 <= &1 /\ a + -- a + &1 = &1 `; VECTOR_MUL_LID]; +REWRITE_TAC[HALFLINE; IN_ELIM_THM]; +EXISTS_TAC ` v':real` ; +ASM_REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +DISCH_TAC; +DISCH_THEN SUBST_ALL_TAC; +DOWN; +ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; VECTOR_MUL_EQ_0; +AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING]]);; + + + + +let AZIM_RANGE = prove(`! v w w1 w2. &0 <= azim v w w1 w2 /\ + azim v w w1 w2 < &2 * pi `, +REWRITE_TAC[azim]);; + + + +let PI_TO_TWO_PI_NEG_SIN = prove_by_refinement +(`! x. pi < x /\ x < &2 * pi ==> sin x < &0 `, [GEN_TAC; +ONCE_REWRITE_TAC[MESON[REAL_ARITH` x = x - pi + pi `]` sin x = sin ( x - pi + pi )`]; +ONCE_REWRITE_TAC[REAL_ARITH` x = x - pi + pi `]; +REWRITE_TAC[SIN_PERIODIC_PI]; +ABBREV_TAC ` xx = x - pi `; +REWRITE_TAC[REAL_ARITH` a + b < c + b <=> a < c `; +REAL_ARITH` a - b < c - b <=> a < c `; REAL_SUB_REFL; +REAL_ARITH` &2 * x - x = x `; REAL_ARITH` -- x < &0 <=> &0 < x `]; +REWRITE_TAC[SIN_POS_PI]]);; + + + +let MIXED_PROD_POS_IMP_RANGE_AZIM = prove_by_refinement +(`~collinear {vec 0, u, v} /\ ~collinear {vec 0, u, w} /\ +&0 < (u cross v) dot w ==> &0 < azim (vec 0) u v w /\ +azim (vec 0) u v w < pi `, +[STRIP_TAC; +MP_TAC2 (SPEC_ALL Planarity.JBDNJJB); +STRIP_TAC; +SUBGOAL_THEN` &0 < sin (azim (vec 0) u v w) ` ASSUME_TAC; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC REAL_LT_MUL; +ASM_REWRITE_TAC[]; +MP_TAC (SPECL [`vec 0:real^3 `;` u:real^3`;` v:real^3 `;` w:real^3 `] + AZIM_RANGE); +ASM_CASES_TAC ` azim (vec 0) u v w <= pi `; +MP_TAC PI_POS; +REWRITE_TAC[REAL_ARITH` &0 < x <=> -- x < &0 `]; +PHA; +NGOAC; +NHANH (REAL_ARITH` a < b /\ b <= c ==> a < c `); +STRIP_TAC; +MP_TAC2 (SPEC ` azim (vec 0) u v w ` Trigonometry1.SIN_NEGPOS_PI); +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +ASM_REWRITE_TAC[REAL_ARITH` -- x < &0 <=> &0 < x `]; +STRIP_TAC; +UNDISCH_TAC` &0 < sin (azim (vec 0) u v w) `; +MP_TAC2 (SPEC ` azim (vec 0) u v w ` PI_TO_TWO_PI_NEG_SIN); +ASM_REWRITE_TAC[REAL_ARITH` a < b <=> ~( b <= a ) `]; +PHA; +REWRITE_TAC[REAL_ARITH` ~( a < b /\ b < a ) `]]);; + + + + + + +let COLLINEAR_ONCE_VEC_0 = prove( +` ~ ( x = vec 0 ) ==> (! y. collinear {vec 0, x, y} <=> ? t. y = t % x )`, +SIMP_TAC[COLLINEAR_LEMMA] THEN MESON_TAC[VECTOR_MUL_LZERO]);; + + + + + + + +let AFF_SGN_TRULE tm = prove (tm, AFF_SGN_TAC);; +let AFF_GE11 = AFF_SGN_TRULE`!x v:real^N. + ~(x = v) + ==> aff_ge {x} {v} = + {y | ?t1 t2. &0 <= t2 /\ t1 + t2 = &1 /\ y = t1 % x + t2 % v} `;; + + +let X_IN_AFF_GE11 = prove(`! x:real^N. ~( c = x ) ==> x IN aff_ge {c} {x}`, +SIMP_TAC[AFF_GE11; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN +EXISTS_TAC `&0 ` THEN EXISTS_TAC ` &1 ` THEN +REWRITE_TAC[REAL_ARITH` &0 <= &1 /\ &0 + &1 = &1 `] THEN VECTOR_ARITH_TAC);; + + +let FAN_IN_AFF_GE_IMP_EQ = prove_by_refinement +(` FAN (x:real^N,V,E) /\ v IN V /\ {a,b} IN E /\ v IN aff_ge {x} {a,b} ==> v = a \/ v = b `, +[REWRITE_TAC[fan7;FAN; fan2]; +STRIP_TAC; +ASM_CASES_TAC ` v = a \/ v = (b:real^N) `; +FIRST_ASSUM ACCEPT_TAC; +DOWN; +REWRITE_TAC[SET_RULE` ~( x = a \/ x = b ) <=> {a,b} INTER {x} = {}`]; +FIRST_X_ASSUM (MP_TAC2 o (SPECL [`{a,b:real^N} `;` {v:real^N}`])); +ASM_REWRITE_TAC[IN_UNION; IN_ELIM_THM]; +DISJ2_TAC; +EXISTS_TAC `v:real^N`; +ASM_REWRITE_TAC[]; +STRIP_TAC; +DISCH_THEN SUBST_ALL_TAC; +ASM_CASES_TAC ` v = x:real^N `; +FIRST_X_ASSUM SUBST_ALL_TAC; +ASM_MESON_TAC[]; +DOWN; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +NHANH X_IN_AFF_GE11; +STRIP_TAC; +UNDISCH_TAC ` aff_ge {x} {a, b} INTER aff_ge {x} {v} = aff_ge {x:real^N} {}`; +REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING; EXTENSION; IN_INTER; IN_INSERT; NOT_IN_EMPTY]; +ASM_MESON_TAC[]]);; + + + + + + + + +let AFF_GE22 = +AFF_SGN_TRULE`! a b x (y:real^N). DISJOINT {a,b} {x,y} ==> aff_ge {a,b} {x,y} = + {z | ? aa bb xx yy. &0 <= xx /\ &0 <= yy +/\ aa + bb + xx + yy = &1 /\ z = aa % a + bb % b + xx % x + yy % y }`;; + +let RHO_NODE_IS_SUCCESEOR_AZIM = prove_by_refinement +(`local_fan (V,E,FF) /\ + v IN V /\ + {ITER n (rho_node1 FF) v | n <= l} = U /\ + plane P /\ + vec 0 IN P /\ + U SUBSET P /\ + v cross rho_node1 FF v = e + ==> (!x n. x = ITER n ( rho_node1 FF) v /\ n < l + ==> (!y. y IN U /\ ~(y = x) /\ ~(y = rho_node1 FF x) + ==> azim (vec 0) e x (rho_node1 FF x) < azim (vec 0) e x y))`, +[NHANH RHO_NODE_SET_IN_A_PLANE_IMP_POS_DIRECT; +REPEAT STRIP_TAC; +UNDISCH_TAC` n < l:num `; +FIRST_ASSUM NHANH; +SWITCH_TAC ` x = ITER n (rho_node1 FF) (v:real^3)`; +ASSUME_TAC2 LOCAL_FAN_ITER_RHO_NODE_IN_V; +NHANH_PAT `\x. x ==> y ` REAL_LT_IMP_NE; +SIMP_TAC[EQ_SYM_EQ; CROSS_DOT_COPLANAR]; +ONCE_REWRITE_TAC[Collect_geom.PER_SET2]; +NHANH NOT_COPLANAR_NOT_COLLINEAR; +ONCE_REWRITE_TAC[SET_RULE` {a,b,c} = {c,b,a}`]; +NHANH NOT_COPLANAR_NOT_COLLINEAR; +SIMP_TAC[INSERT_COMM]; +ONCE_REWRITE_TAC[GSYM CROSS_TRIPLE]; +STRIP_TAC; +UNDISCH_TAC ` &0 < (e cross ITER n (rho_node1 FF) v) dot ITER (n + 1) (rho_node1 FF) (v:real^3) `; +UNDISCH_TAC ` ~collinear {e, ITER (n + 1) (rho_node1 FF) (v:real^3), vec 0} `; +UNDISCH_TAC` ~collinear {e, ITER n (rho_node1 FF) v:real^3, vec 0}`; +PHA; +NHANH (SIMP_RULE[INSERT_COMM] MIXED_PROD_POS_IMP_RANGE_AZIM); +ASM_REWRITE_TAC[]; +STRIP_TAC; +ABBREV_TAC ` sx = ITER (n + 1 ) (rho_node1 FF) v:real^3 `; +EXPAND_TAC "x"; +REWRITE_TAC[GSYM ITER; ADD1]; +ASM_REWRITE_TAC[]; +ASM_CASES_TAC ` y IN aff_ge {vec 0} {x , sx:real^3}`; +SUBGOAL_THEN ` {x,sx:real^3} IN E ` ASSUME_TAC; +REWRITE_TAC[Wrgcvdr_cizmrrh.IN_E_IFF_IN_ORD_E]; +MATCH_MP_TAC LOCAL_FAN_IN_FF_IN_ORD_PAIRS; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN ` x IN (V:real^3 -> bool) ` MP_TAC; +EXPAND_TAC "x"; +ASM_REWRITE_TAC[]; + +MP_TAC2 LOCAL_FAN_RHO_NODE_PROS2; +STRIP_TAC; +FIRST_ASSUM NHANH; +EXPAND_TAC "x"; +REWRITE_TAC[GSYM ITER; ADD1]; +ASM_SIMP_TAC[]; + +SUBGOAL_THEN ` y:real^3 IN V ` ASSUME_TAC; +UNDISCH_TAC ` y IN U:real^3 -> bool ` ; +EXPAND_TAC "U"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +MP_TAC2 (ISPECL [`V:real^3 -> bool`;` E: (real^3 -> bool) -> bool`; + ` vec 0:real^3 `;` x:real^3 `;` y:real^3 `;` sx: real^3 `] (GEN_ALL + FAN_IN_AFF_GE_IMP_EQ)); +ASSUME_TAC2 Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN; +FIRST_X_ASSUM ACCEPT_TAC; + +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` ~(y:real^3 = rho_node1 FF (x:real^3)) `; +EXPAND_TAC "x"; +REWRITE_TAC[ADD1; GSYM ITER]; +ASM_SIMP_TAC[]; +SUBGOAL_THEN ` rho_node1 (FF:real^3 # real^3 -> bool) x = sx ` ASSUME_TAC; +EXPAND_TAC "x"; +REWRITE_TAC[ADD1; GSYM ITER]; +FIRST_ASSUM ACCEPT_TAC; + +SUBGOAL_THEN ` wedge (vec 0) e x sx = aff_gt {vec 0, e} {x,sx} ` ASSUME_TAC; +MATCH_MP_TAC WEDGE_LUNE; +ASM_REWRITE_TAC[GSYM CROSS_DOT_COPLANAR]; +ASM_SIMP_TAC[REAL_ARITH` &0 < x ==> ~( x = &0) `]; + +UNDISCH_TAC` &0 < (e cross x) dot sx `; +NHANH_PAT `\x. x ==> y ` REAL_LT_IMP_NE; +SIMP_TAC[EQ_SYM_EQ; CROSS_DOT_COPLANAR]; +NHANH (SMOOTH_GEN_ALL Trigonometry2.NONCOPLANAR_3_BASIS); +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPEC ` y: real^3 `)); +REWRITE_TAC[VECTOR_SUB_RZERO]; +STRIP_TAC; +UNDISCH_TAC ` ~(y IN aff_ge {vec 0} {x, sx:real^3}) `; +UNDISCH_TAC ` ~coplanar {vec 0, e, x, sx:real^3} `; +ONCE_REWRITE_TAC[SET_RULE` {a,b,c} = {b,c,a}`]; +NHANH NOT_COPLANAR_NOT_COLLINEAR; +NHANH th3; +SIMP_TAC[Fan.AFF_GE_1_2]; +STRIP_TAC; +REWRITE_TAC[IN_ELIM_THM; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +REWRITE_TAC[MESON[REAL_ARITH` (&1 - a - b) + a + b = &1`]` (?t1 t2 t3. + &0 <= t2 /\ &0 <= t3 /\ t1 + t2 + t3 = &1 /\ y = t2 % x + t3 % sx) +<=> (? t2 t3. &0 <= t2 /\ &0 <= t3 /\ y = t2 % x + t3 % sx) `]; +STRIP_TAC; +SUBGOAL_THEN ` ~( y:real^3 IN aff_ge {vec 0, e} {x, sx} )` ASSUME_TAC; +SUBGOAL_THEN ` DISJOINT {vec 0, e} {x, sx:real^3} ` MP_TAC; +REWRITE_TAC[DISJOINT; SET_RULE` (a INSERT A ) INTER ( b INSERT B) = {} <=> +~( a = b ) /\ ~ ( a IN B ) /\ ~( b IN A ) /\ A INTER B = {} `; NOT_IN_EMPTY; +IN_INSERT; INTER_EMPTY]; +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` ~coplanar {vec 0, x, sx, e:real^3}`; +SIMP_TAC[INSERT_COMM]; +NHANH NOT_COPLANAR_NOT_COLLINEAR; +NHANH th3; +SIMP_TAC[EQ_SYM_EQ]; + + +SIMP_TAC[AFF_GE22; IN_ELIM_THM; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +STRIP_TAC; +UNDISCH_TAC ` ~(?t2 t3. &0 <= t2 /\ &0 <= t3 /\ y = t2 % x + t3 % sx:real^3)`; +UNDISCH_TAC` !ta tb tc. + (y:real^3) = ta % e + tb % x + tc % sx ==> ta = t1 /\ tb = t2 /\ tc = t3 `; +REWRITE_TAC[TAUT` ~ a ==> ~ b <=> b ==> a `]; + +SUBGOAL_THEN ` {vec 0,x,sx:real^3} SUBSET P ` ASSUME_TAC; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +UNDISCH_TAC ` U SUBSET (P:real^3 -> bool) `; +MATCH_MP_TAC (SET_RULE` x IN U /\ y IN U ==> U SUBSET P ==> x IN P /\ y IN P `); +EXPAND_TAC "U"; +EXPAND_TAC "sx"; +EXPAND_TAC "x"; +REWRITE_TAC[IN_ELIM_THM; GSYM ITER; ADD1]; +UNDISCH_TAC ` n < l:num `; +MESON_TAC[ARITH_RULE ` a < b:num ==> a <= b /\ a + 1 <= b `]; +SUBGOAL_THEN ` affine hull {vec 0,x, sx:real^3} = P ` ASSUME_TAC; +MATCH_MP_TAC THREE_NOT_COLL_DETER_PLANE; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (SET_RULE` y:real^3 IN U /\ U SUBSET P ==> y IN P `); +DOWN; +EXPAND_TAC "P"; +REWRITE_TAC[AFFINE_HULL_3; IN_ELIM_THM; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; + +REPEAT STRIP_TAC; +EXISTS_TAC ` xx:real ` ; +EXISTS_TAC `yy:real `; +ASM_REWRITE_TAC[]; +FIRST_ASSUM (MP_TAC o (SPECL [`&0 `;` v': real`;` w:real `])); +ANTS_TAC; +DOWN THEN REMOVE_TAC; +UNDISCH_TAC ` y = t1 % e + t2 % x + t3 % (sx:real^3) `; +REMOVE_TAC; +ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID]; +DOWN; +FIRST_ASSUM NHANH; +SIMP_TAC[]; +STRIP_TAC; +STRIP_TAC; +UNDISCH_TAC ` &0 = t1 `; +DISCH_THEN (SUBST1_TAC o SYM); +VECTOR_ARITH_TAC; +ASSUME_TAC2 (SIMP_RULE[INSERT_COMM] (SPECL [`vec 0:real^3 `;` e:real^3 `; +` x:real^3 `;` sx: real^3 `] WEDGE_LUNE_GE)); +UNDISCH_TAC ` ~(y IN aff_ge {vec 0, e} {x, sx:real^3})`; +SIMP_TAC[INSERT_COMM]; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +REWRITE_TAC[IN_ELIM_THM]; +MP_TAC (SPECL [`vec 0:real^3 `;` e:real^3 `;` x:real^3 `;` y:real^3 `] + AZIM_RANGE); +REAL_ARITH_TAC]);; + + + + + +let FIRST_AZIM_CYCLE_EQ_RHO_NODE = prove_by_refinement +(`local_fan (V,E,FF) /\ + v IN V /\ + {ITER n (rho_node1 FF) v | n <= l} = U /\ + plane P /\ + vec 0 IN P /\ + U SUBSET P /\ + v cross rho_node1 FF v = e + ==> (!x n. + x = ITER n (rho_node1 FF) v /\ n < l + ==> azim_cycle U (vec 0) e x = rho_node1 FF x ) `, +[NHANH RHO_NODE_IS_SUCCESEOR_AZIM; +NHANH LOCAL_FAN_IMP_CYCLIC_SET; +REPEAT STRIP_TAC; +MATCH_MP_TAC Wrgcvdr_cizmrrh.IDENTIFY_AZIM_CYCLE; +ASSUME_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE; +ASSUME_TAC2 LOCAL_FAN_ITER_RHO_NODE_IN_V; +SUBGOAL_THEN ` x IN (V:real^3 -> bool) ` MP_TAC; +ASM_REWRITE_TAC[]; +FIRST_ASSUM NHANH; +SIMP_TAC[]; +STRIP_TAC; +SUBGOAL_THEN ` rho_node1 (FF:real^3 # real^3 -> bool) x IN U ` MP_TAC; +ASM_REWRITE_TAC[GSYM ITER; ADD1]; +EXPAND_TAC "U"; +REWRITE_TAC[IN_ELIM_THM]; +UNDISCH_TAC ` n < l:num `; +MESON_TAC[ARITH_RULE` a < l:num ==> a + 1 <= l `]; +UNDISCH_TAC ` cyclic_set U (vec 0) (e:real^3) `; +PHA; +SIMP_TAC[IN]; +REPEAT STRIP_TAC; +DOWN THEN DOWN; +UNDISCH_TAC ` ~(rho_node1 FF x = (x:real^3)) `; +SET_TAC[]; + +ASSUME_TAC2 RHO_NODE_SET_IN_A_PLANE_IMP_POS_DIRECT; +UNDISCH_TAC ` n < l:num `; +PHA; +FIRST_X_ASSUM NHANH; +NHANH REAL_LT_IMP_NE; +DOWN; +ASM_SIMP_TAC[CROSS_DOT_COPLANAR; EQ_SYM_EQ; INSERT_COMM]; +ONCE_REWRITE_TAC[Collect_geom.PER_SET2]; +NHANH NOT_COPLANAR_NOT_COLLINEAR; +SIMP_TAC[INSERT_COMM]; + +UNDISCH_TAC ` !(x:real^3) n. + x = ITER n (rho_node1 FF) v /\ n < l + ==> (!y. y IN U /\ ~(y = x) /\ ~(y = rho_node1 FF x) + ==> azim (vec 0) e x (rho_node1 FF x) < azim (vec 0) e x y)`; +DISCH_THEN ASSUME_TAC2; +ASM_CASES_TAC ` q:real^3 = rho_node1 FF (x:real^3) `; +DISJ2_TAC; +FIRST_X_ASSUM SUBST1_TAC; +REWRITE_TAC[REAL_LE_REFL]; +DISJ1_TAC; +REPLICATE_TAC 4 DOWN THEN PHA; +REWRITE_TAC[IN]; +MESON_TAC[]]);; + + + + + + +let SEQUENCE_OF_RHO_NODE_IS_SUC = prove_by_refinement +(`local_fan (V,E,FF) /\ + v IN V /\ + {ITER n (rho_node1 FF) v | n <= l} = U /\ + plane P /\ + vec 0 IN P /\ + U SUBSET P /\ + v cross rho_node1 FF v = e + ==> (!x n. + x = ITER n (rho_node1 FF) v /\ n < l + ==> (!y. y IN U /\ ~(y = x) /\ ~(y = rho_node1 FF x) + ==> azim (vec 0) e y x < + azim (vec 0) e y ( rho_node1 FF x)))`, +[NHANH RHO_NODE_IS_SUCCESEOR_AZIM; +NHANH LOCAL_FAN_IMP_CYCLIC_SET; +STRIP_TAC; +FIRST_X_ASSUM NHANH; +REPEAT GEN_TAC THEN STRIP_TAC; +FIRST_X_ASSUM NHANH; +GEN_TAC THEN STRIP_TAC; +DOWN; +SUBGOAL_THEN` cyclic_set {x, rho_node1 FF (x:real^3), y} (vec 0) e` MP_TAC; +MATCH_MP_TAC (SPEC ` U:real^3 -> bool` (GEN `W: real^3 -> bool` + (SPEC_ALL Fan.subset_cyclic_set_fan))); +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; GSYM ITER; ADD1]; +EXPAND_TAC "U"; +REWRITE_TAC[IN_ELIM_THM]; +UNDISCH_TAC ` n < l:num `; +MESON_TAC[ARITH_RULE` n < l:num ==> n <= l /\ n + 1 <= l `]; +PHA; +NHANH_PAT `\x. x ==> y ` REAL_LT_IMP_LE; +ONCE_REWRITE_TAC[TAUT` a /\ b /\ c <=> (a /\c) /\ b`]; +NHANH Fan.sum2_azim_fan; +STRIP_TAC; +ASM_CASES_TAC ` azim (vec 0) e x (rho_node1 FF x) = &0 `; +DOWN; +NHANH (MESON[AZIM_EQ_0_PI_IMP_COPLANAR]` azim v0 v1 w1 w2 = &0 + ==> coplanar {v0, v1, w1, w2} `); +REWRITE_TAC[GSYM CROSS_DOT_COPLANAR]; +STRIP_TAC; +ASSUME_TAC2 RHO_NODE_SET_IN_A_PLANE_IMP_POS_DIRECT; +UNDISCH_TAC ` n < l:num `; +FIRST_X_ASSUM NHANH; +DOWN; +ASM_REWRITE_TAC[GSYM ITER; ADD1]; +PAT_ONCE_REWRITE_TAC `\x. x ==> ll ` [CROSS_TRIPLE]; +SIMP_TAC[REAL_ARITH` a = &0 ==> ~( &0 < a ) `]; +SUBGOAL_THEN ` azim (vec 0) e (rho_node1 FF x) y < azim (vec 0) e x y ` MP_TAC; +DOWN; +ASM_REWRITE_TAC[REAL_ARITH ` a < b + a <=> &0 < b `]; +MESON_TAC[REWRITE_RULE[REAL_ARITH` a <= b <=> b = a \/ a < b `] AZIM_RANGE]; +UNDISCH_TAC ` cyclic_set U (vec 0) (e:real^3) `; +NHANH Wrgcvdr_cizmrrh.CYCLIC_SET_IMP_NOT_COLLINEAR; +STRIP_TAC; +SUBGOAL_THEN` x IN (U:real^3 -> bool) /\ rho_node1 FF x IN U /\ y IN U ` MP_TAC; +ASM_REWRITE_TAC[GSYM ITER; ADD1]; +EXPAND_TAC "U"; +REWRITE_TAC[IN_ELIM_THM]; +UNDISCH_TAC ` n < l:num `; +MESON_TAC[ARITH_RULE` a < n:num ==> a <= n /\ a + 1 <= n `]; +FIRST_ASSUM NHANH; +STRIP_TAC; +ASM_CASES_TAC` azim (vec 0) e (rho_node1 (FF:real^3 # real^3 -> bool) x:real^3) y = &0 `; +REPLICATE_TAC 3 DOWN; +ONCE_REWRITE_TAC[SET_RULE` {a,b,c} = {b,c,a}`]; +ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> a /\ b ==> c `]; +NHANH AZIM_EQ_0_ALT; +SIMP_TAC[]; +STRIP_TAC; +UNDISCH_TAC ` ~collinear {vec 0, (e:real^3), rho_node1 (FF:real^3 # real^3 -> bool) x}`; +NHANH th3a; +SIMP_TAC[AFF_GT_2_1; IN_ELIM_THM; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +REPEAT STRIP_TAC; +SUBGOAL_THEN ` {vec 0, x, rho_node1 FF (x:real^3)} SUBSET P ` ASSUME_TAC; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +UNDISCH_TAC ` U SUBSET (P:real^3 -> bool) `; +MATCH_MP_TAC (SET_RULE` a IN U /\ b IN U ==> U SUBSET P ==> a IN P /\ b IN P `); +UNDISCH_TAC ` x:real^3 IN U `; +UNDISCH_TAC ` rho_node1 (FF: real^3 # real^3 -> bool) x IN U `; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +ASSUME_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE; +SUBGOAL_THEN ` x IN (V:real^3 -> bool) ` ASSUME_TAC; +ASM_SIMP_TAC[]; +MP_TAC2 LOCAL_FAN_ITER_RHO_NODE_IN_V; +DOWN; +FIRST_X_ASSUM NHANH; +STRIP_TAC; +SUBGOAL_THEN ` affine hull {vec 0, x, rho_node1 (FF:real^3 # real^3 -> bool) x} = P` MP_TAC; +MATCH_MP_TAC THREE_NOT_COLL_DETER_PLANE; +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC2 (SET_RULE` y IN U /\ U SUBSET (P:real^3 -> bool) ==> y IN P`); +EXPAND_TAC "P"; +REWRITE_TAC[AFFINE_HULL_3; IN_ELIM_THM; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +STRIP_TAC; +ASSUME_TAC2 RHO_NODE_SET_IN_A_PLANE_IMP_POS_DIRECT; +UNDISCH_TAC ` n < l:num`; +FIRST_X_ASSUM NHANH; +SWITCH_TAC ` x = ITER n (rho_node1 FF) (v:real^3) `; +ASM_REWRITE_TAC[GSYM ADD1; ITER]; +NHANH_PAT `\x. x ==> y ` REAL_LT_IMP_NE; +SIMP_TAC[EQ_SYM_EQ; CROSS_DOT_COPLANAR]; +NHANH (SMOOTH_GEN_ALL Trigonometry2.NONCOPLANAR_3_BASIS); +REWRITE_TAC[VECTOR_SUB_RZERO]; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC ` y:real^3 `)); +STRIP_TAC; +UNDISCH_TAC ` y = v' % x + w % rho_node1 (FF:real^3 # real^3 -> bool) x`; +PAT_ONCE_REWRITE_TAC`\x. x ==> y ` [VECTOR_ARITH` a + b % x = a + b % x + &0 % e `]; +FIRST_ASSUM NHANH; +STRIP_TAC; +UNDISCH_TAC ` y = t2 % e + t3 % rho_node1 (FF:real^3 # real^3 -> bool) x`; +PAT_ONCE_REWRITE_TAC`\x. x ==> y ` [VECTOR_ARITH` a + b % xx = &0 % x + b % xx + a `]; +FIRST_ASSUM NHANH; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +UNDISCH_TAC ` y = &0 % x + t3 % rho_node1 FF x + &0 % (e:real^3)`; +REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID; VECTOR_ADD_RID]; +MP_TAC2 Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN; +REWRITE_TAC[FAN; fan7]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPECL [`{y:real^3}`;` {rho_node1 (FF:real^3 # real^3 -> bool) x }`])); +ANTS_TAC; +ASSUME_TAC2 LOCAL_FAN_ITER_RHO_NODE_IN_V; +REWRITE_TAC[IN_UNION; IN_ELIM_THM]; +CONJ_TAC; +DISJ2_TAC; +EXISTS_TAC `y:real^3 `; +UNDISCH_TAC ` y IN U:real^3 -> bool`; +EXPAND_TAC "U"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +REPLICATE_TAC 3 DOWN THEN PHA; +SIMP_TAC[]; +DISJ2_TAC; +EXISTS_TAC ` rho_node1 (FF:real^3 # real^3 -> bool) x `; +EXPAND_TAC "x"; +REWRITE_TAC[GSYM ITER]; +DOWN THEN SIMP_TAC[]; +UNDISCH_TAC ` ~( y:real^3 = rho_node1 FF (x:real^3) ) `; +SIMP_TAC[SET_RULE` ~( a = b ) ==> {a} INTER {b} = {} `; AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING]; +SUBGOAL_THEN `! y. y:real^3 IN U ==> ~( vec 0 = y:real^3) ` MP_TAC; +UNDISCH_TAC ` !v. v IN U ==> ~collinear {v, vec 0, e:real^3} `; +DISCH_THEN NHANH; +NHANH th3b; +SIMP_TAC[EQ_SYM_EQ]; +STRIP_TAC; +UNDISCH_TAC `y:real^3 IN U `; +UNDISCH_TAC ` rho_node1 FF (x:real^3) IN (U:real^3 -> bool) `; +FIRST_X_ASSUM NHANH; +STRIP_TAC THEN STRIP_TAC; +SUBGOAL_THEN ` y:real^3 IN aff_ge {vec 0} {y} INTER aff_ge {vec 0} {rho_node1 FF (x:real^3)} ` ASSUME_TAC; +DOWN THEN DOWN THEN DOWN; +PHA; +SIMP_TAC[IN_INTER; X_IN_AFF_GE11]; +SIMP_TAC[AFF_GE11; IN_ELIM_THM; VECTOR_ARITH` t % vec 0 + x = x `]; +STRIP_TAC; +EXISTS_TAC ` &1 - t3 `; +EXISTS_TAC ` t3:real `; +UNDISCH_TAC ` y = t3 % rho_node1 (FF:real^3 # real^3 -> bool) x`; +SIMP_TAC[]; +REMOVE_TAC; +UNDISCH_TAC` &0 < t3`; +REAL_ARITH_TAC; +REMOVE_TAC; +DISCH_THEN SUBST_ALL_TAC; +DOWN THEN DOWN; +REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY]; +MESON_TAC[]; +MP_TAC (MESON[AZIM_RANGE]` &0 <= azim (vec 0) e (rho_node1 FF (x:real^3)) y`); +PHA; +NHANH (REAL_ARITH` &0 <= a /\ a < b ==> ~( b = &0 ) `); +STRIP_TAC; +SWITCH_TAC ` x = ITER n (rho_node1 FF) (v:real^3) `; +ASM_REWRITE_TAC[]; +DOWN_TAC; +ONCE_REWRITE_TAC[SET_RULE` {a,b,c} = {b,c,a}`]; +STRIP_TAC; +UNDISCH_TAC ` ~collinear {vec 0, e, (y:real^3) }`; +UNDISCH_TAC ` ~collinear {vec 0, e, x:real^3}`; +PHA; +NHANH AZIM_COMPL; +ASM_REWRITE_TAC[]; +STRIP_TAC; +UNDISCH_TAC ` ~collinear {vec 0, e, y:real^3}`; +UNDISCH_TAC ` ~collinear {vec 0, e, rho_node1 (FF:real^3 # real^3 -> bool) x}`; +PHA; +NHANH AZIM_COMPL; +SWITCH_TAC ` azim (vec 0) e x y = + azim (vec 0) e x (rho_node1 (FF:real^3 # real^3 -> bool) x) + azim (vec 0) e (rho_node1 FF x) y `; +ASM_SIMP_TAC[REAL_ARITH` a - b < a - c <=> c < b `]]);; + + + + + + +let V_AZIM_SMALLEST_ELMS = prove_by_refinement +(`local_fan (V,E,FF) /\ + v IN V /\ + {ITER n (rho_node1 FF) v | n <= l} = U /\ + plane P /\ + vec 0 IN P /\ + U SUBSET P /\ + v cross rho_node1 FF v = e + ==> ITER l (rho_node1 FF) v = ls /\ + (!i. i < l ==> ~(ls = ITER i (rho_node1 FF) v)) + ==> (!y. y IN U /\ ~(y = v) /\ ~(y = ls) + ==> azim (vec 0) e ls v < azim (vec 0) e ls y)`, +[NHANH SEQUENCE_OF_RHO_NODE_IS_SUC; +STRIP_TAC THEN STRIP_TAC; +GEN_TAC; +EXPAND_TAC "U"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +UNDISCH_TAC ` n <= l:num `; +SWITCH_TAC ` y = ITER n (rho_node1 FF) v:real^3 `; +ASM_REWRITE_TAC[]; +EXPAND_TAC "y"; +ASM_CASES_TAC ` n = 0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN; +ASM_REWRITE_TAC[ITER]; +ASM_CASES_TAC` n = l:num `; +FIRST_X_ASSUM SUBST_ALL_TAC; +UNDISCH_TAC ` ITER l (rho_node1 FF) v = ls:real^3 `; +ASM_REWRITE_TAC[]; +DOWN THEN DOWN; +SPEC_TAC (`n:num`,` n:num`); +INDUCT_TAC; +REWRITE_TAC[]; +REPEAT STRIP_TAC; +ASM_CASES_TAC ` n' = 0 `; +ASM_REWRITE_TAC[ADD; ITER1]; +UNDISCH_TAC ` !x n. + x = ITER n (rho_node1 FF) (v:real^3) /\ n < l + ==> (!y. y IN U /\ ~(y = x) /\ ~(y = rho_node1 FF x) + ==> azim (vec 0) e y x < azim (vec 0) e y (rho_node1 FF x))`; +DISCH_THEN (MP_TAC o (SPECL [`v:real^3 `;`0`])); +SIMP_TAC[ITER]; +ANTS_TAC; +DOWN THEN DOWN THEN ARITH_TAC; +DISCH_THEN MATCH_MP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +SUBST_ALL_TAC (SYM ONE); +DOWN THEN DOWN; +PHA; +REWRITE_TAC[ARITH_RULE` ~( 1 = z ) /\ 1 <= z <=> 0 < z /\ 1 < z `]; +UNDISCH_TAC ` !i. i < l ==> ~(ls = ITER i (rho_node1 FF) (v:real^3)) `; +DISCH_THEN NHANH; +SIMP_TAC[ITER1; ITER]; +EXPAND_TAC "ls"; +EXPAND_TAC "U"; +STRIP_TAC; +REWRITE_TAC[IN_ELIM_THM]; +MESON_TAC[LE_REFL]; +UNDISCH_TAC ` ~(n' = 0) + ==> ~(n' = l) + ==> n' <= l + ==> azim (vec 0) e ls v < azim (vec 0) e ls (ITER n' (rho_node1 FF) v)`; +PHA; +ANTS_TAC; +REPLICATE_TAC 3 DOWN THEN PHA; +ARITH_TAC; +STRIP_TAC; +UNDISCH_TAC ` !x n. + x = ITER n (rho_node1 FF) v /\ n < l + ==> (!y. y IN U /\ ~(y = x) /\ ~(y = rho_node1 FF x) + ==> azim (vec 0) e y x < azim (vec 0) e y (rho_node1 FF x))`; +DISCH_THEN (MP_TAC o (SPECL [`ITER n' (rho_node1 FF) v:real^3 `;` n':num`])); +ANTS_TAC; +UNDISCH_TAC` SUC n' <= l `; +REWRITE_TAC[ARITH_RULE` SUC n <= m <=> n < m `]; +DISCH_THEN (MP_TAC o (SPEC ` ls:real^3 `)); +ANTS_TAC; +UNDISCH_TAC ` SUC n' <= l `; +UNDISCH_TAC ` ~( SUC n' = l ) `; +PHA; +REWRITE_TAC[ARITH_RULE` ~(SUC n' = l) /\ SUC n' <= l <=> n' < l /\ SUC n' < l`]; +FIRST_ASSUM NHANH; +SIMP_TAC[ITER]; +STRIP_TAC; +EXPAND_TAC "ls"; +EXPAND_TAC "U"; +REWRITE_TAC[IN_ELIM_THM]; +MESON_TAC[LE_REFL]; +DOWN THEN PHA; +REWRITE_TAC[ITER]; +REAL_ARITH_TAC]);; + + + + + +let AZIM_LAST_POINT_IN_RHO_SET = prove_by_refinement +(`local_fan (V,E,FF) /\ + v IN V /\ + {ITER n (rho_node1 FF) v | n <= l} = U /\ + plane P /\ + vec 0 IN P /\ + U SUBSET P /\ + v cross rho_node1 FF v = e + ==> ITER l (rho_node1 FF) v = ls /\ + (!i. i < l ==> ~(ls = ITER i (rho_node1 FF) v)) + ==> azim_cycle U (vec 0) e ls = v`, +[NHANH V_AZIM_SMALLEST_ELMS; +STRIP_TAC; +FIRST_X_ASSUM NHANH; +STRIP_TAC; +ASM_CASES_TAC ` l = 0 `; +UNDISCH_TAC ` {ITER n (rho_node1 FF) (v:real^3) | n <= l} = U`; +MP_TAC2 (ARITH_RULE` l = 0 ==> (!n. n <=l <=> n = 0 ) `); +REMOVE_TAC; +REWRITE_TAC[SET_RULE` {p n | n = 0 } = {p (0) }`; ITER]; +DISCH_THEN (SUBST1_TAC o SYM); +EXPAND_TAC "ls"; +FIRST_X_ASSUM SUBST1_TAC; +REWRITE_TAC[ITER]; +MESON_TAC[Lvducxu.W_SUBSET_SINGLETON_IMP_IDE; SUBSET_REFL]; + + +MATCH_MP_TAC Wrgcvdr_cizmrrh.IDENTIFY_AZIM_CYCLE; +ASSUME_TAC2 LOCAL_FAN_IMP_CYCLIC_SET; +UNDISCH_TAC ` ~( l = 0 ) `; +REWRITE_TAC[ARITH_RULE` ~( l = 0) <=> 0 < l `]; +USE_FIRST ` !i. i < l ==> ~(ls = ITER i (rho_node1 FF) v:real^3) ` NHANH; +SUBGOAL_THEN ` ls:real^3 IN U /\ v IN U` ASSUME_TAC; +EXPAND_TAC "ls"; +EXPAND_TAC "U"; +REWRITE_TAC[IN_ELIM_THM]; +MESON_TAC[LE_REFL; LE_0; ITER]; + +ASM_SIMP_TAC[ITER; LE_0]; +STRIP_TAC; +CONJ_TAC; +DOWN THEN DOWN THEN DOWN THEN PHA; +SET_TAC[]; +CONJ_TAC; +UNDISCH_TAC ` cyclic_set U (vec 0) (e:real^3) `; +NHANH Wrgcvdr_cizmrrh.CYCLIC_SET_IMP_NOT_COLLINEAR; +ASM_MESON_TAC[]; +CONJ_TAC; +ONCE_REWRITE_TAC[GSYM IN]; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +ASM_CASES_TAC ` q = v:real^3 `; +ASM_SIMP_TAC[REAL_LE_REFL]; +DISJ1_TAC; +ASM_MESON_TAC[IN]]);; + + + + +let LOOP_MAP_IMP_DIFF_FIRST_ELMS = prove_by_refinement +(` (! v:A. v IN V ==> orbit_map f v = V) /\ v IN V /\ k < CARD V /\ +l < k ==> ~( ITER k f v = ITER l f v ) `, +[REPEAT STRIP_TAC; +UNDISCH_TAC ` v:A IN V `; +REWRITE_TAC[]; +FIRST_ASSUM NHANH; +STRIP_TAC; +SUBGOAL_THEN ` ITER l f (v:A) IN V ` ASSUME_TAC; +EXPAND_TAC "V"; +REWRITE_TAC[orbit_map; IN_ELIM_THM; POWER_TO_ITER]; +EXISTS_TAC `l:num`; +REWRITE_TAC[ARITH_RULE` x >= 0 `]; +DOWN; +PHA; +FIRST_ASSUM NHANH; +SUBGOAL_THEN ` ITER ( k - l ) f ( ITER l f v ) = ITER l f (v:A) ` ASSUME_TAC; +ASM_SIMP_TAC[ITER_ADD; ARITH_RULE`l < k ==> ( k - l ) + l:num = k `]; +DOWN; +UNDISCH_TAC ` l < k:num`; +PHA; +ONCE_REWRITE_TAC[ARITH_RULE` a < b <=> 0 < b - a `]; +NHANH Lvducxu.ITER_CYCLIC_ORBIT; +SIMP_TAC[]; +ASM_MESON_TAC[ +ARITH_RULE` a < b:num /\ aa <= a - i ==> ~( aa = b ) `; +ISPECL [`f:A -> A `;` ITER l f (v:A) `; ` k - l:num` ] (GEN_ALL Wrgcvdr_cizmrrh.CARD_LE_K_OF_SET_K_FIRST_ELMS)]]);; + + + + +let CARD_IMAGE_INJ2 = prove( +` INJ f A B /\ FINITE A ==> CARD (IMAGE f A ) = CARD A `, +REWRITE_TAC[INJ] THEN STRIP_TAC THEN +MATCH_MP_TAC CARD_IMAGE_INJ THEN ASM_REWRITE_TAC[]);; + + + +let BIJ_IMP_CARD_EQ = prove(` BIJ f A B /\ FINITE A ==> CARD A = CARD B `, +REWRITE_TAC[BIJ] THEN +NHANH Wrgcvdr_cizmrrh.SURJ_IMP_S2_EQ_IMAGE_S1 THEN MESON_TAC[CARD_IMAGE_INJ2]);; + + + +let LOFA_IMP_DIS_ELMS = prove( +` local_fan (V,E,FF) /\ v IN V /\ l < CARD FF +==> (!i. i < l ==> ~(ITER l (rho_node1 FF) v = ITER i (rho_node1 FF) v))`, +STRIP_TAC THEN GEN_TAC THEN STRIP_TAC THEN MATCH_MP_TAC LOOP_MAP_IMP_DIFF_FIRST_ELMS THEN +MP_TAC2 LOCAL_FAN_ORBIT_MAP_V THEN ASM_REWRITE_TAC[] THEN +ABBREV_TAC ` k = (\x. FST (x:real^3 # real^3 )) ` THEN STRIP_TAC THEN +MP_TAC2 Wrgcvdr_cizmrrh.BIJ_BETWEEN_FF_AND_V THEN +ASSUME_TAC2 Wrgcvdr_cizmrrh.LOCAL_FAN_FINITE_FF THEN +DOWN THEN REWRITE_TAC[TAUT` a ==> b ==> c <=> b /\ a ==> c `] THEN +NHANH BIJ_IMP_CARD_EQ THEN PURE_ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +ASM_SIMP_TAC[]);; + + + + +let AZIM_LAST_POINT_IN_RHO_SET2 = prove( +` local_fan (V,E,FF) /\ + v IN V /\ + {ITER n (rho_node1 FF) v | n <= l} = U /\ + plane P /\ + vec 0 IN P /\ + U SUBSET P /\ + v cross rho_node1 FF v = e + ==> ITER l (rho_node1 FF) v = ls /\ + l < CARD FF + ==> azim_cycle U (vec 0) e ls = v `, +NHANH AZIM_LAST_POINT_IN_RHO_SET THEN STRIP_TAC THEN STRIP_TAC THEN +FIRST_X_ASSUM MATCH_MP_TAC THEN EXPAND_TAC "ls" THEN +REWRITE_TAC[] THEN MATCH_MP_TAC LOFA_IMP_DIS_ELMS THEN +ASM_REWRITE_TAC[]);; + + + + +let KOMWBWC = prove_by_refinement(`!E V P l FF U e ls v. + local_fan (V,E,FF) /\ + v IN V /\ + {ITER n (rho_node1 FF) v | n <= l} = U /\ + plane P /\ + vec 0 IN P /\ + U SUBSET P /\ + v cross rho_node1 FF v = e + ==> cyclic_set U (vec 0) e /\ + (!i. i < l + ==> &0 < + (ITER i (rho_node1 FF) v cross ITER (i + 1) (rho_node1 FF) v) dot + e) /\ + (!x n. + x = ITER n (rho_node1 FF) v /\ n < l + ==> azim_cycle U (vec 0) e x = rho_node1 FF x) /\ + (ITER l (rho_node1 FF) v = ls /\ +l < CARD FF + ==> azim_cycle U (vec 0) e ls = v)`, +[REPEAT GEN_TAC THEN STRIP_TAC; MP_TAC2 LOCAL_FAN_IMP_CYCLIC_SET; +STRIP_TAC; MP_TAC2 RHO_NODE_SET_IN_A_PLANE_IMP_POS_DIRECT; +REMOVE_TAC; MP_TAC2 AZIM_LAST_POINT_IN_RHO_SET2; +REMOVE_TAC; MP_TAC2 FIRST_AZIM_CYCLE_EQ_RHO_NODE]);; + + + + +(* -------------------------------- *) +(* ================================ *) +(* -------------------------------- *) +(* lemma OZQVSFF *) +(* ================================ *) + +let interior_angle1 = new_definition +` interior_angle1 x FF v = azim x v (rho_node1 FF v) (@a. a,v IN FF)`;; + + + +let WEDGE_GE_AZIM_LE = prove( +`! x v0 v1 w1 w2. x IN wedge_ge v0 v1 w1 w2 <=> azim v0 v1 w1 x <= azim v0 v1 w1 w2 `, +REWRITE_TAC[wedge_ge; IN_ELIM_THM; AZIM_RANGE]);; + + + +let IN_WEDGE_IMP_AZIM_LE = prove(`! x y. y IN wedge_ge v0 v1 w1 w2 /\ + azim v0 v1 w1 x <= azim v0 v1 w1 y /\ + ~collinear {v0, v1, x} /\ + ~collinear {v0, v1, y} /\ + ~collinear {v0, v1, w1} + ==> azim v0 v1 x y <= azim v0 v1 w1 w2`, +NHANH Fan.sum4_azim_fan THEN +REWRITE_TAC[WEDGE_GE_AZIM_LE] THEN +REPEAT GEN_TAC THEN +MP_TAC (SPECL [`v0:real^3`;` v1:real^3`;`w1:real^3`;` x:real^3`] AZIM_RANGE) THEN +REAL_ARITH_TAC);; + + + + +let LOFA_IMAGE_RHO_NODE_IDE = prove( +`local_fan (V,E,FF) ==> IMAGE (rho_node1 FF) V = V`, +STRIP_TAC THEN ASSUME_TAC2 LOCAL_FAN_ORBIT_MAP_V THEN +ASM_SIMP_TAC[EQ_SYM_EQ; Lvducxu.W_EQ_ITS_ORBIT_IMP_EQ_ITS_IMAGE]);; + + + +let EXISTS_INVERSE_OF_V = prove( +` local_fan (V,E,FF) /\ v IN V ==> ? vv. vv IN V /\ rho_node1 FF vv = v `, +NHANH LOFA_IMAGE_RHO_NODE_IDE THEN +REWRITE_TAC[IMAGE] THEN SET_TAC[]);; + + + +let LOFA_IN_V_SO_DO_RHO_NODE_V = prove( +` local_fan (V,E,FF) /\ v IN V ==> rho_node1 FF v IN V `, +NHANH LOCAL_FAN_ORBIT_MAP_V THEN STRIP_TAC THEN +DOWN THEN FIRST_X_ASSUM (NHANH_PAT `\x. x ==> y `) THEN +STRIP_TAC THEN EXPAND_TAC "V" THEN +REWRITE_TAC[in_orbit_map1]);; + + +let HYP_MAPS_INVERSABLE = +MESON[hypermap_lemma; PERMUTES_INVERSES_o]`! H:(A) hypermap. +inverse (face_map H) o (face_map H ) = I /\ +inverse (node_map H) o (node_map H ) = I /\ +inverse (edge_map H) o (edge_map H ) = I /\ +(face_map H ) o inverse (face_map H) = I /\ +(node_map H ) o inverse (node_map H) = I/\ +(edge_map H ) o inverse (edge_map H) = I`;; + + + +let LOFA_DARTS_FF_UNION_SWITCH_FF = prove_by_refinement +(` local_fan (V,E,FF) ==> darts_of_hyp E V = FF UNION {v,w | w,v IN FF }`, +[REWRITE_TAC[local_fan]; +LET_TAC; +REWRITE_TAC[dih2k; Lvducxu.HAS_ORD2_INTERPRET; Lvducxu.EDGE_MAP_RESO_INVERSE]; +LET_TAC; +STRIP_TAC; +UNDISCH_TAC ` x':real^3 # real^3 IN dart H `; +FIRST_X_ASSUM NHANH; +ONCE_REWRITE_TAC[inverse2_hypermap_maps]; +REWRITE_TAC[IMAGE_o]; +ONCE_REWRITE_TAC[Lvducxu.ENF_IMAGE_ITSELF]; +ASM_REWRITE_TAC[GSYM IMAGE_o; GSYM o_ASSOC; HYP_MAPS_INVERSABLE; I_O_ID; +GSYM Lvducxu.ENF_IMAGE_ITSELF]; +UNDISCH_TAC ` FAN (vec 0:real^3, V, E) `; +NHANH ELMS_OF_HYPERMAP_HYP; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC (MESON[]` x = y ==> f x = f y`); +REWRITE_TAC[IMAGE; EXTENSION; IN_ELIM_THM; ee_of_hyp2]; +SUBGOAL_THEN ` x' IN dart (H:(real^3 # real^3) hypermap) ` MP_TAC; +FIRST_X_ASSUM MP_TAC; +ASM_REWRITE_TAC[]; +NHANH lemma_face_subset; +REWRITE_TAC[SUBSET]; +STRIP_TAC; +GEN_TAC THEN EQ_TAC; +STRIP_TAC; +DOWN THEN DOWN; +FIRST_X_ASSUM NHANH; +ASM_SIMP_TAC[]; +REPEAT STRIP_TAC; +EXISTS_TAC ` SND (x''':real^3 #real^3 ) `; +EXISTS_TAC ` FST (x''':real^3 #real^3 ) `; +ASM_REWRITE_TAC[]; +STRIP_TAC; +EXISTS_TAC `w:real^3, v:real^3 `; +DOWN THEN DOWN THEN PHA; +FIRST_X_ASSUM NHANH; +ASM_SIMP_TAC[]]);; + + + + + +let SELF_CYCLIC_IMP_FINITE = prove_by_refinement +(`(! x:A. x IN V ==> V = orbit_map f x ) ==> FINITE V `, +[ASM_CASES_TAC `V:A -> bool = {} `; +ASM_REWRITE_TAC[FINITE_EMPTY]; +DOWN; +REWRITE_TAC[SET_RULE` ~( x = {}) <=> ? a. a IN x `]; +REPEAT STRIP_TAC; +UNDISCH_TAC` a:A IN V `; +FIRST_ASSUM NHANH; +STRIP_TAC; +MP_TAC (ISPECL [`f:A -> A `;` a:A `] in_orbit_map1); +FIRST_X_ASSUM (SUBST1_TAC o SYM); +FIRST_ASSUM NHANH; +STRIP_TAC; +SUBGOAL_THEN ` a:A IN V ` MP_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +FIRST_ASSUM SUBST1_TAC; +REWRITE_TAC[orbit_map; IN_ELIM_THM; POWER_TO_ITER; GSYM ITER_ALT]; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o SYM); +MP_TAC (ARITH_RULE` 0 < SUC n `); +PHA; +NHANH Lvducxu.ITER_CYCLIC_ORBIT; +UNDISCH_TAC ` a:A IN V `; +FIRST_X_ASSUM NHANH; +ASM_SIMP_TAC[orbit_map; POWER_TO_ITER; GSYM ITER_ALT]; +REPEAT STRIP_TAC; +REWRITE_TAC[ +SET_RULE` {ITER n' f a | n' < n} = {y | ? n' . n' < n /\ y = ITER n' f a }`; +Wrgcvdr_cizmrrh.FINITE_OF_N_FIRST_ELMS]]);; + + + + + + +let SELF_CYCLIC_IMP_BIJ = prove( +` (!x. x IN S ==> S = orbit_map f x) ==> BIJ f S S `, +NHANH SELF_CYCLIC_IMP_FINITE THEN +MESON_TAC[Lvducxu.FIN_LOOP_IMP_BIJ_ITSELF]);; + + + + +let LOFA_IN_E_IMP_IN_FF = prove( +` local_fan (V,E,FF) /\ {a,b} IN E ==> a,b IN FF \/ b,a IN FF `, +REWRITE_TAC[Wrgcvdr_cizmrrh.IN_E_IFF_IN_ORD_E] THEN +NHANH LOFA_DARTS_FF_UNION_SWITCH_FF THEN +REWRITE_TAC[darts_of_hyp] THEN PHA THEN +NHANH (SET_RULE` a UNION b = x /\ xx IN a ==> xx IN x `) THEN +REWRITE_TAC[IN_UNION; IN_ELIM_THM; PAIR_EQ] THEN +STRIP_TAC THENL [ASM_REWRITE_TAC[];ASM_REWRITE_TAC[]]);; + + + + +let LOFA_IMP_EE_TWO_ELMS = prove_by_refinement +(` local_fan (V,E,FF) /\ vv IN V /\ rho_node1 FF vv = v +==> EE v E = {rho_node1 FF v, vv }`, +[NHANH LOCAL_FAN_RHO_NODE_PROS2; +IMP_TAC THEN STRIP_TAC; +STRIP_TAC; +SUBGOAL_THEN ` v:real^3 IN V ` ASSUME_TAC; +ASM_MESON_TAC[LOFA_IN_V_SO_DO_RHO_NODE_V]; +DOWN; +UNDISCH_TAC ` vv:real^3 IN V `; +FIRST_ASSUM NHANH; +ASSUME_TAC2 ( +REWRITE_RULE[TAUT` a /\ b ==> c <=> a ==> b ==> c `; +RIGHT_FORALL_IMP_THM] (GEN `x:real^3 # real^3 ` LOCAL_FAN_IN_FF_IN_ORD_PAIRS)); +FIRST_ASSUM NHANH; +REPEAT STRIP_TAC; +REWRITE_TAC[EXTENSION; EE; IN_ELIM_THM]; +GEN_TAC THEN EQ_TAC; +UNDISCH_TAC ` local_fan (V,E,FF) `; +PHA; +NHANH LOFA_IN_E_IMP_IN_FF; +UNDISCH_TAC ` !x. x IN FF ==> x = FST x,rho_node1 FF (FST (x:real^3 # real^3))`; +DISCH_THEN NHANH; +STRIP_TAC; +DOWN; +SIMP_TAC[PAIR_EQ; IN_INSERT]; +DOWN; +SIMP_TAC[PAIR_EQ]; +ASSUME_TAC2 (SPEC `v:real^3 ` (GEN `y:real^3 ` LOCAL_FAN_IMP_IN_V)); +MP_TAC2 LOCAL_FAN_ORBIT_MAP_V; +SIMP_TAC[EQ_SYM_EQ]; +NHANH SELF_CYCLIC_IMP_BIJ; +REWRITE_TAC[BIJ; INJ]; +STRIP_TAC; +UNDISCH_TAC ` x IN V /\ v:real^3 IN V`; +PHA; +EXPAND_TAC "v"; +STRIP_TAC; +DOWN; +UNDISCH_TAC ` x:real^3 IN V `; +UNDISCH_TAC ` vv:real^3 IN V `; +PHA; +FIRST_X_ASSUM NHANH; +SIMP_TAC[IN_INSERT]; +REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY]; +STRIP_TAC; +UNDISCH_TAC `v, rho_node1 FF v IN FF `; +UNDISCH_TAC ` local_fan (V,E,FF) `; +PHA; +NHANH LOCAL_FAN_IN_FF_IN_ORD_PAIRS; +ASM_SIMP_TAC[Wrgcvdr_cizmrrh.IN_E_IFF_IN_ORD_E]; +UNDISCH_TAC ` vv,rho_node1 FF vv IN FF `; +FIRST_X_ASSUM NHANH; +ASM_REWRITE_TAC[]; +UNDISCH_TAC `local_fan (V,E,FF) `; +PHA; +NHANH LOCAL_FAN_IN_FF_IN_ORD_PAIRS; +SIMP_TAC[Wrgcvdr_cizmrrh.IN_ORD_E_EQ_IN_E; INSERT_COMM]]);; + + +let LOFA_CARD_EE_V_2 = prove( +`local_fan (V,E,FF) /\ vv IN V /\ rho_node1 FF vv = v +==> CARD (EE v E ) = 2 `, NHANH LOFA_IMP_EE_TWO_ELMS THEN +SIMP_TAC[Geomdetail.CARD_SET2] THEN NHANH LOCAL_FAN_IMP_NOT_SEMI_IDE THEN +MESON_TAC[]);; + + + +let LOFA_CARD_EE_V_1 = prove( +`local_fan (V,E,FF) /\ v IN V ==> CARD (EE v E) = 2 `, +NHANH EXISTS_INVERSE_OF_V THEN +MESON_TAC[ LOFA_CARD_EE_V_2]);; + + + + + +let RHO_NODE_INVERSE_POINT = MESON[]` + w,v IN FF /\ (! ww. ww,v IN FF ==> ww = w ) +==> (@a. a,v IN FF ) = w `;; + + + +let AZIM_CYCLE_TWO_POINT_SET = prove_by_refinement +(`azim_cycle {a,b} v w a = b `, +[ASM_CASES_TAC ` a = b:real^3`; +ASM_REWRITE_TAC[INSERT_INSERT]; +REWRITE_TAC[ MATCH_MP Lvducxu.W_SUBSET_SINGLETON_IMP_IDE (SET_RULE` {p:real^3} SUBSET {p}`)]; +ABBREV_TAC ` W = {a,b:real^3} `; +ABBREV_TAC ` u = azim_cycle W v w a `; +ABBREV_TAC ` p = a:real^3`; +SUBGOAL_THEN ` ~(u = p) /\ + W u /\ + (!q. ~(q = p) /\ W q + ==> azim v w p u < azim v w p q \/ + azim v w p u = azim v w p q /\ + norm (projection (w - v) (u - v)) <= + norm (projection (w - v) (q - v))) ` ASSUME_TAC; +EXPAND_TAC "u"; +SUBGOAL_THEN ` ~(W SUBSET {p:real^3}) ` MP_TAC; +ASM SET_TAC[]; +REWRITE_TAC[azim_cycle]; +SIMP_TAC[]; +DISCH_TAC; +CONV_TAC SELECT_CONV; +EXISTS_TAC `b:real^3 `; +ASM_REWRITE_TAC[]; +EXPAND_TAC "W"; +CONJ_TAC; +SET_TAC[]; +REWRITE_TAC[SET_RULE` ~(q = p) /\ {p, b} q <=> q = b /\ ~( q = p)`]; +SIMP_TAC[REAL_LE_REFL]; +ASM SET_TAC[]]);; + + + + +let LOFA_IMP_BIJ_VV = prove( +` local_fan (V,E,FF) ==> BIJ (rho_node1 FF ) V V `, +NHANH LOCAL_FAN_ORBIT_MAP_V THEN STRIP_TAC THEN +MATCH_MP_TAC SELF_CYCLIC_IMP_BIJ THEN DOWN THEN +SIMP_TAC[EQ_SYM_EQ]);; + + + + + + +let MOST_EXPAND_IN_WEDGE_GE = prove_by_refinement +(` ~collinear {v0,v1, w1} /\ + ~collinear {v0,v1, w2} /\ + ~collinear {v0,v1, x} /\ ~ collinear {v0, v1, y} /\ +y IN wedge_ge v0 v1 w1 w2 /\ +azim v0 v1 w1 x <= azim v0 v1 w1 y /\ +azim v0 v1 x y = azim v0 v1 w1 w2 ==> +azim v0 v1 w1 x = &0 /\ +azim v0 v1 y w2 = &0 `, +[REWRITE_TAC[wedge_ge; IN_ELIM_THM]; +STRIP_TAC; +SUBGOAL_THEN ` azim v0 v1 w1 w2 = azim v0 v1 w1 y + azim v0 v1 y w2` ASSUME_TAC; +MATCH_MP_TAC Fan.sum4_azim_fan; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN ` azim v0 v1 w1 y = azim v0 v1 w1 x + azim v0 v1 x y` ASSUME_TAC; +MATCH_MP_TAC Fan.sum4_azim_fan; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` azim v0 v1 w1 w2 = azim v0 v1 w1 y + azim v0 v1 y w2 `; +ASM_REWRITE_TAC[]; +MP_TAC ( +SPECL [`v0:real^3`; ` v1:real^3 `;`w1:real^3 `;` x:real^3 `] AZIM_RANGE); +MP_TAC ( +SPECL [`v0:real^3`; ` v1:real^3 `;`y:real^3 `;` w2:real^3 `] AZIM_RANGE); +REAL_ARITH_TAC]);; + + + + + +let OZQVSFF = prove_by_refinement +(`! u w. convex_local_fan (V,E,FF) /\ +{u,v,w} SUBSET V /\ +plane P /\ +{vec 0, u, v, w} SUBSET P /\ +{u,w} INTER aff {vec 0, v} = {} /\ +~( aff {v, vec 0} INTER conv0 {w,u} = {} ) ==> +interior_angle1 (vec 0) FF v = pi /\ +rho_node1 FF v IN P /\ ivs_rho_node1 FF v IN P`, +[MATCH_MP_TAC (MESON[REAL_ARITH` a <= b \/ b <= a `]` +(! x y. P x y ==> P y x ) /\ (! x y. azim (vec 0) v (rho_node1 FF v) y <= +azim (vec 0) v (rho_node1 FF v) x ==> P x y ) ==> +(! x y. P x y ) `); +CONJ_TAC; +SIMP_TAC[INSERT_COMM]; +REWRITE_TAC[convex_local_fan; INSERT_SUBSET; EMPTY_SUBSET; Trigonometry2.INSERT_INTER_EMPTY]; +NHANH Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN; +NHANH FAN_IMP_V_DIFF; +REPLICATE_TAC 4 STRIP_TAC; +UNDISCH_TAC ` !v:real^3. v IN V ==> ~(v = vec 0)`; +DISCH_TAC; +UNDISCH_TAC` v:real^3 IN V `; +FIRST_ASSUM NHANH; +STRIP_TAC; +UNDISCH_TAC ` ~( u IN aff {vec 0, v:real^3})`; +UNDISCH_TAC ` ~( w:real^3 IN aff {vec 0, v})`; +ASM_SIMP_TAC[INSERT_COMM; Trigonometry2.NOT_EQ_IMP_AFF_AND_COLL3]; +REPEAT DISCH_TAC; +SUBGOAL_THEN ` azim (vec 0) v w u = pi ` ASSUME_TAC; +DOWN THEN DOWN THEN PHA; +PAT_ONCE_REWRITE_TAC `\x. y /\ x ==> k ` [INSERT_COMM]; +NHANH (SIMP_RULE[INSERT_COMM] Ldurdpn.LDURDPN); +STRIP_TAC; +FIRST_X_ASSUM SUBST1_TAC; +CONJ_TAC; +EXISTS_TAC `P:real^3 -> bool`; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +FIRST_ASSUM ACCEPT_TAC; +UNDISCH_TAC ` v:real^3 IN V `; +ASSUME_TAC2 LOCAL_FAN_RHO_NODE_PROS2; +DOWN THEN IMP_TAC; +REMOVE_TAC; +DISCH_THEN NHANH; +UNDISCH_TAC ` !x:real^3 #real^3. x IN FF ==> azim_in_fan x E <= pi /\ V SUBSET wedge_in_fan_ge x E`; +DISCH_TAC; +FIRST_ASSUM NHANH; +REWRITE_TAC[SUBSET]; +STRIP_TAC; +UNDISCH_TAC` w:real^3 IN V `; +UNDISCH_TAC ` u:real^3 IN V `; +FIRST_ASSUM NHANH; +REWRITE_TAC[wedge_in_fan_ge]; +SUBGOAL_THEN ` CARD (EE (v:real^3) E ) = 2 ` MP_TAC; +MATCH_MP_TAC LOFA_CARD_EE_V_1; +ASM_REWRITE_TAC[]; +NHANH (ARITH_RULE ` a = 2 ==> a > 1 `); +SIMP_TAC[]; +REPLICATE_TAC 3 STRIP_TAC; +UNDISCH_TAC ` v:real^3 IN V `; +UNDISCH_TAC ` local_fan (V,E,FF) `; +PHA; +NHANH EXISTS_INVERSE_OF_V; +STRIP_TAC; +ASSUME_TAC2 LOFA_IMP_EE_TWO_ELMS; +UNDISCH_TAC ` azim_in_fan (v,rho_node1 FF v) E <= pi `; +REWRITE_TAC[azim_in_fan]; +LET_TAC; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` azim (vec 0) v w u <= azim (vec 0) v (rho_node1 FF v) d ` ASSUME_TAC; +MATCH_MP_TAC IN_WEDGE_IMP_AZIM_LE; +ASM_SIMP_TAC[INSERT_COMM]; +UNDISCH_TAC ` v,rho_node1 FF v IN FF `; +UNDISCH_TAC ` local_fan (V,E,FF) `; +PHA; +NHANH LOCAL_FAN_IN_FF_NOT_COLLINEAR; +SIMP_TAC[INSERT_COMM]; +DOWN; +UNDISCH_TAC ` azim (vec 0) v w u = pi `; +PHA; +DISCH_TAC; +REWRITE_TAC[interior_angle1]; +SUBGOAL_THEN `(@a. a,v IN (FF:real^3 # real^3 -> bool)) = vv ` ASSUME_TAC; +MATCH_MP_TAC RHO_NODE_INVERSE_POINT; +MP_TAC2 LOCAL_FAN_RHO_NODE_PROS2; +STRIP_TAC; +UNDISCH_TAC ` vv:real^3 IN V `; +FIRST_X_ASSUM NHANH; +ASM_SIMP_TAC[]; +REPEAT STRIP_TAC; +DOWN; +FIRST_ASSUM NHANH; +REWRITE_TAC[PAIR_EQ]; +UNDISCH_TAC `local_fan (V,E,FF) `; +PHA; +NGOAC; +NHANH LOCAL_FAN_IMP_IN_V; +UNDISCH_TAC ` vv:real^3 IN V `; +NHANH LOFA_IMP_BIJ_VV; +REWRITE_TAC[BIJ; INJ]; +EXPAND_TAC "v"; +MESON_TAC[]; +SUBGOAL_THEN ` azim_cycle (EE v E) (vec 0) v (rho_node1 FF v) = vv ` ASSUME_TAC; +UNDISCH_TAC ` EE v E = {rho_node1 FF v, vv} `; +EXPAND_TAC "d"; +SIMP_TAC[AZIM_CYCLE_TWO_POINT_SET]; +FIRST_X_ASSUM SUBST_ALL_TAC; +ONCE_REWRITE_TAC[TAUT` a/\ b <=> a /\ (a ==> b ) `]; +CONJ_TAC; +FIRST_X_ASSUM SUBST1_TAC; +DOWN; +ASM_REWRITE_TAC[]; +REAL_ARITH_TAC; +FIRST_ASSUM SUBST1_TAC; +STRIP_TAC; + +SUBGOAL_THEN ` ~collinear {v, rho_node1 FF v, vec 0} /\ ~collinear {d, v, vec 0} ` ASSUME_TAC; + + +ASSUME_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE; +UNDISCH_TAC ` v:real^3 IN V `; +UNDISCH_TAC ` vv:real^3 IN V `; + +FIRST_X_ASSUM NHANH; +ASM_SIMP_TAC[INSERT_COMM]; + + + +SUBGOAL_THEN ` azim (vec 0) v (rho_node1 FF v) w = &0 /\ +azim (vec 0) v u vv = &0 ` MP_TAC; +MATCH_MP_TAC MOST_EXPAND_IN_WEDGE_GE; +ASM_SIMP_TAC[INSERT_COMM]; + + + +DOWN THEN STRIP_TAC; +UNDISCH_TAC `~ collinear {v, w, vec 0:real^3 }`; +UNDISCH_TAC `~ collinear {v, rho_node1 FF v, vec 0:real^3 }`; +ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> b /\a ==> c `]; +ONCE_REWRITE_TAC[SET_RULE` {a,b,c} = {c,a,b} `]; +NHANH AZIM_EQ_0_ALT; +NHANH AZIM_EQ_0_SYM; +STRIP_TAC; +ASSUME_TAC2 (SIMP_RULE[INSERT_COMM] (SPECL [` vec 0:real^3`;` v:real^3 `;`u:real^3 `;` d:real^3 `] AZIM_EQ_0_ALT)); +DOWN; +ASM_SIMP_TAC[]; +DOWN; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ASM_SIMP_TAC[ivs_rho_node1]; +REMOVE_TAC THEN REMOVE_TAC; +MATCH_MP_TAC ( +SET_RULE` A SUBSET S /\ B SUBSET S ==> a IN A /\ b IN B ==> a IN S /\ b IN S `); +CONJ_TAC; +SUBGOAL_THEN ` affine hull {vec 0,v,w:real^3} = P ` MP_TAC; +MATCH_MP_TAC THREE_NOT_COLL_DETER_PLANE; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +DISCH_THEN (SUBST1_TAC o SYM); +REWRITE_TAC[SET_RULE` {a,b,c} = {a,b} UNION {c}`]; +REWRITE_TAC[INSERT_UNION;AFF_GT_SUBSET_AFFINE_HULL; UNION_EMPTY]; +SUBGOAL_THEN ` affine hull {u,v,vec 0:real^3} = P ` MP_TAC; +MATCH_MP_TAC THREE_NOT_COLL_DETER_PLANE; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +DISCH_THEN (SUBST1_TAC o SYM); +REWRITE_TAC[SET_RULE` {c,a,b} = {a,b} UNION {c}`]; +REWRITE_TAC[INSERT_UNION;AFF_GT_SUBSET_AFFINE_HULL; UNION_EMPTY]]);; + + + +(* ============================================= *) +(* ============================================= *) +(* ============================================= *) +(* ============================================= *) +(* lemma KCHMAMG *) + + +let REAL_LT_DIV_NEG = prove(` a < &0 /\ b < &0 ==> &0 < a /b `, +SIMP_TAC [REAL_FIELD` b < &0 ==> a / b = ( -- a) / ( -- b ) `; REAL_ARITH ` +b < &0 <=> &0 < -- b `; REAL_LT_DIV]);; + + +let IN_CONV0 = prove_by_refinement +(` &0 < a /\ &0 < b ==> &1 / ( a + b ) % ( a % x + b % (y:real^N)) IN conv0 {x,y}`, +[REWRITE_TAC[Geomdetail.CONV0_SET2; IN_ELIM_THM]; +DISCH_TAC; +EXISTS_TAC ` a / ( a + b ) `; +EXISTS_TAC ` b / ( a + b ) `; +CONJ_TAC; +MATCH_MP_TAC REAL_LT_DIV; +DOWN; +REAL_ARITH_TAC; +CONJ_TAC; +MATCH_MP_TAC REAL_LT_DIV; +DOWN; +REAL_ARITH_TAC; +CONJ_TAC; +DOWN; +CONV_TAC REAL_FIELD; +REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; +REAL_ARITH` &1 / x * y = y / x `]]);; + + +(* lemma about intersection between conv0 {x,y} and +aff {w,v} in affine hull {a,b,c} *) + + + +let INTERSECTION_LEMMA = prove_by_refinement +(` ~ ( z = x ) /\ DISJOINT {x:real^N} {v,w} /\ ~( x = u ) /\ + ~(aff_gt {x} {v, w} INTER aff_lt {x} {u} = {}) /\ +z IN affine hull {x,v,w} ==> +(? a b t. {a,b} SUBSET {u,v,w} /\ t IN aff {x,z} INTER conv0 {a,b})`, +[REWRITE_TAC[AFFINE_HULL_3; IN_ELIM_THM; REAL_ARITH` a + b = &1 <=> &1 - b = a `]; +STRIP_TAC; +DOWN; +ASM_CASES_TAC ` &0 < v' /\ &0 < w' `; +ASM_REWRITE_TAC[VECTOR_ARITH` a = x % b + c + d <=> a - x % b = c + d`]; +STRIP_TAC; +EXISTS_TAC ` v:real^N `; +EXISTS_TAC `w:real^N `; +EXISTS_TAC ` (&1 / (v' + w') ) % ( z - u' % x:real^N ) `; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_INSERT; AFF2; + Geomdetail.CONV0_SET2; IN_INTER; IN_ELIM_THM]; +CONJ_TAC; +EXISTS_TAC ` ( -- u') / (v' + w' ) `; +REWRITE_TAC[VECTOR_SUB_LDISTRIB; VECTOR_MUL_ASSOC; REAL_ARITH` (&1 / a ) * b = b / a `]; +ASM_SIMP_TAC [REAL_FIELD` &0 < v' /\ &0 < w' ==> &1 - --u' / (v' + w') = (u' + v' + w' ) / (v' + w') `]; +EXPAND_TAC "u'"; +REWRITE_TAC[REAL_ARITH` &1 - ( a + b) + a + b = &1 `]; +VECTOR_ARITH_TAC; +EXISTS_TAC ` v' / ( v' + w') `; +EXISTS_TAC ` w' / ( v' + w') `; +CONJ_TAC; +MATCH_MP_TAC REAL_LT_DIV; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC REAL_LT_ADD; +FIRST_X_ASSUM ACCEPT_TAC; +CONJ_TAC; +MATCH_MP_TAC REAL_LT_DIV; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC REAL_LT_ADD; +FIRST_X_ASSUM ACCEPT_TAC; +ASM_SIMP_TAC[REAL_FIELD` &0 < v' /\ &0 < w' ==> v' / (v' + w') + w' / (v' + w') = &1`]; +REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC]; +ASM_SIMP_TAC[REAL_FIELD` &0 < v' /\ &0 < w' ==> &1 / (v' + w') * v' = v' / ( v' + w') /\ (&1 / (v' + w') * w') = w' / ( v' + w') `]; + +(* CASES v' < &0 and w' < &0 *) +ASM_CASES_TAC ` v' < &0 /\ w' < &0 `; +ASM_REWRITE_TAC[VECTOR_ARITH` a = x % b + c + d <=> a - x % b = c + d`]; +STRIP_TAC; +EXISTS_TAC ` v:real^N `; +EXISTS_TAC `w:real^N `; +EXISTS_TAC ` (&1 / (v' + w') ) % ( z - u' % x:real^N ) `; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_INSERT; AFF2; + Geomdetail.CONV0_SET2; IN_INTER; IN_ELIM_THM]; +CONJ_TAC; +EXISTS_TAC ` ( -- u') / (v' + w' ) `; +REWRITE_TAC[VECTOR_SUB_LDISTRIB; VECTOR_MUL_ASSOC; REAL_ARITH` (&1 / a ) * b = b / a `]; +ASM_SIMP_TAC [REAL_FIELD` v' < &0 /\ w' < &0 ==> &1 - --u' / (v' + w') = (u' + v' + w' ) / (v' + w') `]; +EXPAND_TAC "u'"; +REWRITE_TAC[REAL_ARITH` &1 - ( a + b) + a + b = &1 `]; +VECTOR_ARITH_TAC; +EXISTS_TAC ` v' / ( v' + w') `; +EXISTS_TAC ` w' / ( v' + w') `; +CONJ_TAC; +MATCH_MP_TAC REAL_LT_DIV_NEG; +ASM_SIMP_TAC[REAL_ARITH` a < &0 /\ b < &0 ==> a + b < &0`]; + + +CONJ_TAC; +MATCH_MP_TAC REAL_LT_DIV_NEG; +ASM_SIMP_TAC[REAL_ARITH` a < &0 /\ b < &0 ==> a + b < &0`]; + +ASM_SIMP_TAC[REAL_FIELD` v' < &0 /\ w' < &0 ==> v' / (v' + w') + w' / (v' + w') = &1`]; +REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC]; +ASM_SIMP_TAC[REAL_FIELD` v' < &0 /\ w' < &0 ==> &1 / (v' + w') * v' = v' / ( v' + w') /\ (&1 / (v' + w') * w') = w' / ( v' + w') `]; + + +UNDISCH_TAC ` ~(aff_gt {x} {v, w} INTER aff_lt {x} {u:real^N} = {})`; +UNDISCH_TAC ` ~ ( x = u:real^N) `; + +ASM_SIMP_TAC[Planarity.AFF_GT_1_2; AFF_LT_1_1; SET_RULE` ~( a INTER b = {} ) <=> ? x. x IN a /\ x IN b `; IN_ELIM_THM; SET_RULE` ~( a = b ) <=> DISJOINT {a} {b} `]; +REPEAT STRIP_TAC; +FIRST_ASSUM (SUBST1_TAC o SYM); +DOWN_TAC; + +ASM_CASES_TAC ` v' = &0 \/ w' = &0`; +DOWN; +SPEC_TAC (`v:real^N`,`v:real^N `); +SPEC_TAC (`w:real^N`,`w:real^N `); + +SPEC_TAC (`v':real`,`v':real `); +SPEC_TAC (`w':real`,`w':real `); +SPEC_TAC (`t2:real`,`t2:real `); +SPEC_TAC (`t3:real`,`t3:real `); +MATCH_MP_TAC (MESON[]` (! t3 t2 x y a b. P x y a b t3 t2 ==> P y x b a t2 t3 ) /\ (! x y a b t3 t2 . y = &0 ==> P x y a b t3 t2) +==> (! t3 t2 x y a b. (y = &0 \/ x = &0 ) ==> P x y a b t3 t2) `); + +CONJ_TAC; +ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> b ==> a ==> c `]; +REPEAT GEN_TAC; +DISCH_TAC; +ANTS_TAC; +DOWN; +SIMP_TAC[INSERT_COMM; REAL_ADD_SYM; CONJ_SYM; VECTOR_ADD_SYM]; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[]; +SIMP_TAC[INSERT_COMM]; + +REPEAT GEN_TAC; + + +DISCH_THEN SUBST_ALL_TAC; +STRIP_TAC; +DOWN; +EXPAND_TAC "u'"; +REWRITE_TAC[VECTOR_ARITH` z = (&1 - (&0 + w')) % x + &0 % v + w' % w <=> +z - x = w' % ( w - x ) `]; +DOWN; +ASM_REWRITE_TAC[]; +ONCE_REWRITE_TAC[VECTOR_ARITH ` t1 % x + t2 % v + t3 % w = t1' % x + t2' % u +<=> (t1 + t2 + t3 ) % x + t2 % ( v - x ) + t3 % ( w - x ) = ( t1' + t2' ) % x + t2' % (u - x ) `]; +ASM_REWRITE_TAC[VECTOR_ARITH` x + a = x + b <=> a = b:real^N `; VECTOR_ARITH ` +a % z + b % x = y <=> b % x = y + -- a % z `]; + + + +ASM_CASES_TAC ` w' = &0 `; +ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_SUB_EQ]; +MP_TAC2 (REAL_ARITH ` &0 < t3 ==> ~( t3 = &0 ) `); +SIMP_TAC[Ldurdpn.VECTOR_SCALE_CHANGE]; +REWRITE_TAC[VECTOR_MUL_ASSOC; VECTOR_ADD_LDISTRIB; +VECTOR_SUB_LDISTRIB; VECTOR_ARITH` a = x - y + b % d - t <=> a + y + t = x + b % d `]; +REPEAT STRIP_TAC; +EXISTS_TAC `u:real^N`; +EXISTS_TAC `v:real^N `; + +EXISTS_TAC ` (t3 / (w' * (t2' - t2 ))) % ( z - x + ((w' * &1 / t3) * t2') % x + ((w' * &1 / t3) * --t2) % (x:real^N) ) `; +REWRITE_TAC[INSERT_SUBSET; IN_INSERT; EMPTY_SUBSET; IN_INTER;AFF2; IN_ELIM_THM]; + +CONJ_TAC; +EXISTS_TAC ` &1 - t3 / (w' * (t2' - t2)) `; +DOWN THEN DOWN; +REWRITE_TAC[REAL_ARITH` (w' * &1 / t3) * t2' = t2' * w' / t3 `; GSYM VECTOR_ADD_RDISTRIB; VECTOR_ADD_LDISTRIB; VECTOR_SUB_LDISTRIB]; +REWRITE_TAC[REAL_ARITH` a - ( a - b ) = b `]; + +REWRITE_TAC[VECTOR_SUB_RDISTRIB; +VECTOR_ARITH` x - t + z = zz - t + x:real^N <=> z = zz `]; +STRIP_TAC THEN STRIP_TAC; +REWRITE_TAC[VECTOR_MUL_ASSOC; GSYM VECTOR_ADD_RDISTRIB]; +MATCH_MP_TAC (MESON[]` a = b ==> a % x = b % x `); +UNDISCH_TAC ` &0 < t3 `; +UNDISCH_TAC ` ~ ( w' = &0) `; +UNDISCH_TAC ` t2' < &0 `; +UNDISCH_TAC ` &0 < t2 `; +CONV_TAC REAL_FIELD; + +ASM_REWRITE_TAC[]; +REWRITE_TAC[Geomdetail.CONV0_SET2; IN_ELIM_THM; VECTOR_ADD_LDISTRIB; +VECTOR_MUL_ASSOC]; +EXISTS_TAC ` t3 / (w' * (t2' - t2)) * (w' * &1 / t3) * t2' `; +EXISTS_TAC` t3 / (w' * (t2' - t2)) * (w' * &1 / t3) * --t2 `; + +CONJ_TAC; +ASM_SIMP_TAC[REAL_FIELD` ~(t3 = &0) ==> ~( w' = &0 ) +==> t3 / (w' * (t2' - t2)) * (w' * &1 / t3) * t2' = t2' / ( t2' - t2) `]; +MATCH_MP_TAC REAL_LT_DIV_NEG; +ASM_REAL_ARITH_TAC; +ASSUME_TAC2 ( +REAL_FIELD` ~(t3 = &0) /\ ~( w' = &0 ) /\ t2' < &0 /\ &0 < t2 +==> t3 / (w' * (t2' - t2)) * (w' * &1 / t3) * --t2 = ( -- t2 ) / ( t2' - t2 ) /\ +t3 / (w' * (t2' - t2)) * (w' * &1 / t3) * t2' + + t3 / (w' * (t2' - t2)) * (w' * &1 / t3) * --t2 = + &1 `); +ASM_REWRITE_TAC[]; + +MATCH_MP_TAC REAL_LT_DIV_NEG; +UNDISCH_TAC ` &0 < t2 `; +UNDISCH_TAC ` t2' < &0 `; +REAL_ARITH_TAC; +DOWN; +SIMP_TAC[DE_MORGAN_THM; REAL_ARITH` ~( a < b ) <=> a = b \/ b < a `]; +REWRITE_TAC[TAUT` (a \/ b) /\ c /\ d <=> ((a \/ b) /\ c ) /\ d`; REAL_ARITH` (v' < &0 \/ w' < &0) /\ + (&0 < v' \/ &0 < w') <=> v' < &0 /\ &0 < w' \/ w' < &0 /\ &0 < v' `]; +STRIP_TAC; +PHA; +REWRITE_TAC[TAUT` a /\ ( b \/ c ) /\ d <=> ( b \/ c) /\ a /\ d `]; +SPEC_TAC (`v':real`,`v':real`); +SPEC_TAC (`t2:real`,`t2:real`); +SPEC_TAC (`v:real^N`,`v:real^N`); +SPEC_TAC (`w':real`,`w':real`); +SPEC_TAC (`t3:real`,`t3:real`); +SPEC_TAC (`w:real^N`,`w:real^N`); +IMP_TAC; +MATCH_MP_TAC (MESON[]`(! a b c x y z. P a b c x y z ==> P x y z a b c ) /\ +(! a b c x y z. R c z ==> P a b c x y z ) ==> (! a b c x y z. R c z \/ R z c +==> P a b c x y z ) `); +CONJ_TAC; +ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> b ==> a ==> c `]; +REPEAT GEN_TAC THEN STRIP_TAC; +ANTS_TAC; +DOWN_TAC; +SIMP_TAC[INSERT_COMM; REAL_ADD_SYM; VECTOR_ADD_SYM]; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[]; +SIMP_TAC[VECTOR_ADD_SYM; INSERT_COMM]; +REPEAT STRIP_TAC; +SWITCH_TAC ` x' = t1 % x + t2 % v + t3 % w:real^N`; +SWITCH_TAC `z = u' % x + v'' % v + w'' % w:real^N `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` x' = t1' % x + t2' % u:real^N `; + + +EXPAND_TAC "x'"; +REWRITE_TAC[VECTOR_ARITH` a + b % x + c = d <=> b % x = d - a - c `]; +MP_TAC2 (REAL_ARITH` &0 < t2 ==> ~( t2 = &0 ) `); +ABBREV_TAC ` set = {v,w:real^N} `; + +SIMP_TAC[Ldurdpn.VECTOR_SCALE_CHANGE]; +REPEAT STRIP_TAC; +UNDISCH_TAC ` u' % x + v'' % v + w'' % w = z:real^N `; +ASM_REWRITE_TAC[VECTOR_MUL_ASSOC; VECTOR_SUB_LDISTRIB; VECTOR_ADD_LDISTRIB]; +REWRITE_TAC[REAL_ARITH` a * &1 / b * c = ( a * c ) / b `; +VECTOR_ARITH ` u' % x + + (tt % x + vv % u) - + t22 % x - + ww % w + + w'' % w = + z <=> z + ( t22 - u' - tt ) % x = vv % u + (w'' - ww) % w `]; + +SUBGOAL_THEN ` &1 + ((v'' * t1) / t2 - u' - (v'' * t1') / t2) = +(v'' * t2') / t2 + (w'' - (v'' * t3) / t2) ` ASSUME_TAC; +ASM_SIMP_TAC[ +REAL_FIELD` ~ ( m = &0 ) ==> a / m - b - c / m = ( a - m * b - c ) / m /\ +&1 + a / m = ( m + a ) / m /\ a / m + b - c / m = (a + m * b - c ) / m`]; +MATCH_MP_TAC (MESON[]` a = b ==> a / x = b / x`); +UNDISCH_TAC ` t1' + t2' = &1 `; +UNDISCH_TAC ` t1 + t2 + t3 = &1 `; +EXPAND_TAC "u'"; +SIMP_TAC[REAL_ARITH` a + b = c <=> a = c - b `]; +REAL_ARITH_TAC; +ABBREV_TAC ` tu = (v'' * t2') / t2 `; +ABBREV_TAC ` tw = (w'' - (v'' * t3) / t2) `; +STRIP_TAC; +EXISTS_TAC `u:real^N `; +EXISTS_TAC ` w:real^N `; +EXISTS_TAC ` ( &1 / (tu + tw) ) % ( tu % u + tw % w:real^N ) `; +EXPAND_TAC "set"; +REWRITE_TAC[INSERT_SUBSET; IN_INSERT; EMPTY_SUBSET; IN_INTER]; +SUBGOAL_THEN ` &0 < tu /\ &0 < tw ` ASSUME_TAC; +CONJ_TAC; +EXPAND_TAC "tu"; +MATCH_MP_TAC REAL_LT_DIV; +ASM_REWRITE_TAC[REAL_MUL_POS_LT]; +EXPAND_TAC "tw"; +MATCH_MP_TAC (REAL_ARITH` &0 < a /\ b < &0 ==> &0 < a - b `); +ASM_REWRITE_TAC[ REAL_ARITH` a / b < &0 <=> &0 < ( -- a ) / b `]; +MATCH_MP_TAC REAL_LT_DIV; +ASM_REWRITE_TAC[REAL_ARITH` -- ( a * b ) = ( -- a ) * b `; REAL_MUL_POS_LT]; +ASM_REWRITE_TAC[REAL_ARITH ` &0 < -- a <=> a < &0 `]; +CONJ_TAC; +REWRITE_TAC[AFF2; IN_ELIM_THM]; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +EXISTS_TAC ` (&1 / (tu + tw)) * (((v'' * t1) / t2 - u' - (v'' * t1') / t2) ) `; +REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; + VECTOR_ARITH` a + z % x = z % x + b <=> a = b `]; +MATCH_MP_TAC (MESON[]` a = b ==> a % x = b % x `); +UNDISCH_TAC` &1 + (v'' * t1) / t2 - u' - (v'' * t1') / t2 = tu + tw `; +DOWN; +NHANH (REAL_ARITH` &0 < a /\ &0 < b ==> ~( a + b = &0) `); +CONV_TAC REAL_FIELD; +DOWN; +REWRITE_TAC[IN_CONV0]]);; + + + + +let CVX_LO_IMP_LO = prove(` convex_local_fan (V,E,FF) ==> local_fan (V,E,FF)`, +SIMP_TAC[convex_local_fan]);; + + + +let S_SUBSET_IMP_AFF_S_TOO = prove( +` S SUBSET aff SS ==> aff S SUBSET aff SS `, +NHANH_PAT `\x. x ==> y ` (ISPEC ` affine ` HULL_MONO) +THEN SIMP_TAC[aff; HULL_HULL]);; + + +let AFF2_DET_BY_TWO_POINTS = prove_by_refinement +(` {x:real^N,y} SUBSET aff {a,b} /\ ~( x = y ) ==> +aff {a,b} = aff {x,y} `, +[STRIP_TAC; +MATCH_MP_TAC Collect_geom.RCEABUJ; +ASM_REWRITE_TAC[line]; +EXISTS_TAC ` a:real^N`; +EXISTS_TAC `b:real^N`; +REWRITE_TAC[aff]; +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN; +PHA; +DOWN; +REWRITE_TAC[INSERT_INSERT; AFFINE_HULL_SING; aff; INSERT_SUBSET; IN_INSERT; +NOT_IN_EMPTY]; +SIMP_TAC[]]);; + +let IN_CONV0_EQ_EQ = prove( +`! x:real^N. x IN conv0 {a,b} ==> ( x = a <=> a = b ) `, +REWRITE_TAC[Geomdetail.CONV0_SET2; IN_ELIM_THM] THEN +REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN +UNDISCH_TAC` a' + b' = &1 ` THEN +SIMP_TAC[REAL_ARITH` a + b = &1 <=> a = &1 - b `] THEN +DISCH_TAC THEN +REWRITE_TAC[VECTOR_ARITH` (&1 - b') % a + b' % b = a + b' % (b - a ) `; +VECTOR_ARITH` a + x = a <=> x = vec 0`; VECTOR_MUL_EQ_0] THEN +ASM_SIMP_TAC[REAL_ARITH` &0 < a ==> ~( a = &0 ) `; VECTOR_SUB_EQ; EQ_SYM_EQ]);; + + + + +let CONV02_SUBSET_AFF2 = prove(` conv0 {a,b} SUBSET aff {a,b} `, +REWRITE_TAC[Geomdetail.CONV0_SET2; AFF2; SUBSET; IN_ELIM_THM] THEN +MESON_TAC[REAL_ARITH` a + b = &1 ==> b = &1 - a `]);; + + + +let IN_CONV0_IMP_AFF_EQ = prove_by_refinement +(` a:real^N IN conv0 {x,y} ==> aff {x,y} = aff {x,a} `, +[NHANH IN_CONV0_EQ_EQ; +STRIP_TAC; +ASM_CASES_TAC` a = x :real^N `; +ASM_REWRITE_TAC[]; +DOWN; +ASM_REWRITE_TAC[]; +DISCH_THEN (SUBST1_TAC o SYM); +REWRITE_TAC[]; +MATCH_MP_TAC AFF2_DET_BY_TWO_POINTS; +DOWN; +SIMP_TAC[INSERT_SUBSET; EMPTY_SUBSET; EQ_SYM_EQ; aff; Ldurdpn.IN_HULL_INSERT]; +ASM_SIMP_TAC[REWRITE_RULE[SUBSET; aff] CONV02_SUBSET_AFF2]]);; + + + + + + +let IN_CONV0_AFF_SUBSET = prove(`! t:real^N. t IN aff {a,b} INTER conv0 {x,y} /\ +x IN aff {a,b} ==> aff {x,y} SUBSET aff {a,b} `, +REWRITE_TAC[IN_INTER] THEN NHANH IN_CONV0_EQ_EQ THEN +NHANH IN_CONV0_IMP_AFF_EQ THEN GEN_TAC THEN STRIP_TAC THEN +ASM_REWRITE_TAC[] THEN +MATCH_MP_TAC Collect_geom.AFFINE_CONTAIN_LINE THEN +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; aff; AFFINE_AFFINE_HULL]);; + + + + +let CONDS_FOR_INTER_AFF_CONV0 = prove_by_refinement +(`&0 < t2 /\ + &0 < t3 /\ + t1 + t2 + t3 = ss /\ + t = t1 % x + t2 % v + t3 % (w:real^N) /\ + t1' + t2' = ss /\ + t = t1' % x + t2' % u + ==> (?tt. tt IN aff {x, u} /\ tt IN conv0 {v, w})`, +[STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[VECTOR_ARITH` a % x + y = z <=> z - a % x = y `]; +REWRITE_TAC[ VECTOR_ARITH ` (t1' % x + u) - t1 % x = (t1' - t1 ) % x + u `]; +STRIP_TAC; +EXISTS_TAC` &1 / (t2 + t3 ) % ( (t1' - t1) % x + t2' % (u:real^N) )`; +CONJ_TAC; +REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; REAL_ARITH` &1 / a * b = b / a `; +AFF2; IN_ELIM_THM]; +EXISTS_TAC ` (t1' - t1) / (t2 + t3) `; +MATCH_MP_TAC (MESON[]` a = b ==> f a = f b `); +MATCH_MP_TAC (MESON[]` a = b ==> a % u = b % u `); +DOWN; +REMOVE_TAC; +DOWN; +DOWN THEN REMOVE_TAC; +DOWN_TAC; +CONV_TAC REAL_FIELD; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC IN_CONV0; +ASM_REWRITE_TAC[]]);; + + + + +let INTER_AFF_GT_LT_IMP_INTER_AFF_CONV0 = prove_by_refinement +(`DISJOINT {x} {v,w} /\ ~(u = x ) ==> +t IN aff_gt {x} {v,w} INTER aff_lt {x} {u} ==> +(? tt. tt IN aff {x,u} INTER conv0 {v,w}) `, +[SIMP_TAC[Planarity.AFF_GT_1_2; AFF_LT_1_1; SET_RULE` ~(x = y) <=> DISJOINT {y} {x}`]; +REWRITE_TAC[IN_INTER; IN_ELIM_THM]; +REPEAT STRIP_TAC; +ABBREV_TAC ` ss = &1 `; +MATCH_MP_TAC CONDS_FOR_INTER_AFF_CONV0; +DOWN THEN DOWN; +ASM_SIMP_TAC[]]);; + + +let SUBSET_AFF2_IMP_COLL = prove_by_refinement +(` S SUBSET aff {a:real^N, b} ==> collinear S `, +[REWRITE_TAC[collinear; SUBSET; AFF2; IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC ` a - b:real^N `; +FIRST_X_ASSUM NHANH; +REPEAT STRIP_TAC; +EXISTS_TAC ` t - t':real `; +ASM_REWRITE_TAC[]; +CONV_TAC VECTOR_ARITH]);; + + + +let COLLINEAR_SUBSET_AFF2 = prove_by_refinement +(` a:real^N IN S /\ b IN S /\ ~( a = b ) /\ collinear S +==> S SUBSET aff {a,b} `, +[REWRITE_TAC[collinear]; +STRIP_TAC; +SUBGOAL_THEN ` ? c. a - b:real^N = c % u ` ASSUME_TAC; +ASM_SIMP_TAC[]; + +REWRITE_TAC[SUBSET]; +GEN_TAC; +UNDISCH_TAC ` b:real^N IN S `; +PHA; +ONCE_REWRITE_TAC[CONJ_SYM]; +FIRST_X_ASSUM NHANH; +FIRST_X_ASSUM CHOOSE_TAC; +ASM_CASES_TAC ` c = &0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN THEN DOWN; +SIMP_TAC[VECTOR_MUL_LZERO; VECTOR_SUB_EQ]; +UNDISCH_TAC ` a - b = c % u:real^N `; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +ASM_SIMP_TAC[Ldurdpn.VECTOR_SCALE_CHANGE]; +REWRITE_TAC[VECTOR_ARITH` a = x - b:real^N <=> x = a + b `]; +STRIP_TAC THEN STRIP_TAC; +ASM_REWRITE_TAC[AFF2; IN_ELIM_THM; VECTOR_MUL_ASSOC; VECTOR_ARITH` a % ( x - y ) + y = a % x + ( &1 - a ) % y `]; +MESON_TAC[]]);; + + + + +let AFF_CONV0_COLL4 = prove_by_refinement +(` t:real^N IN aff {a, b} INTER conv0 {x, y} /\ x IN aff {a, b} +==> collinear {a,b,x,y} `, +[NHANH IN_CONV0_AFF_SUBSET; +STRIP_TAC; +MATCH_MP_TAC (GEN_ALL SUBSET_AFF2_IMP_COLL); +EXISTS_TAC ` a:real^N `; +EXISTS_TAC `b:real^N `; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; Planarity.POINT_IN_LINE]; +DOWN; +ONCE_REWRITE_TAC[INSERT_COMM]; +REWRITE_TAC[SUBSET; Planarity.POINT_IN_LINE]; +DISCH_TAC; +CONJ_TAC; +FIRST_ASSUM MATCH_MP_TAC; +PURE_ONCE_REWRITE_TAC[INSERT_COMM]; +PURE_REWRITE_TAC[Planarity.POINT_IN_LINE]; +FIRST_ASSUM MATCH_MP_TAC; +PURE_REWRITE_TAC[Planarity.POINT_IN_LINE]]);; + + + + +let CONDS_IN_HAFL_LINE = prove( + `&0 <= t /\ a - x = t % (b - x) ==> a IN aff_ge {x} {b} `, +REWRITE_TAC[HALFLINE; IN_ELIM_THM] THEN STRIP_TAC THEN +EXISTS_TAC ` t:real ` THEN ASM_REWRITE_TAC[] THEN DOWN +THEN CONV_TAC VECTOR_ARITH);; + +let PRESERABLE_AFF_GE_SUBSET = prove( +` a IN aff_ge {x} {b} ==> aff_ge {x} {a} SUBSET aff_ge {x} {b} `, +REWRITE_TAC[HALFLINE; SUBSET; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN +EXISTS_TAC ` t * t':real ` THEN ASM_REWRITE_TAC[] THEN CONJ_TAC THENL [ +MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; VECTOR_ARITH_TAC]);; + + + + + +let AFF_GE_EQ = prove_by_refinement +(`&0 < t /\ a - x:real^N = t % (b - x) ==> +aff_ge {x} {a} = aff_ge {x} {b} `, +[STRIP_TAC; +SUBGOAL_THEN ` a:real^N IN aff_ge {x} {b} ` ASSUME_TAC; +MATCH_MP_TAC CONDS_IN_HAFL_LINE; +ASM_REWRITE_TAC[]; +ASM_REAL_ARITH_TAC; +SUBGOAL_THEN ` b:real^N IN aff_ge {x} {a} ` ASSUME_TAC; +MATCH_MP_TAC (GEN_ALL CONDS_IN_HAFL_LINE); +EXISTS_TAC ` &1 / t `; +ASSUME_TAC2 (REAL_ARITH` &0 < t ==> ~( t = &0 ) `); +SWITCH_TAC `a - x = t % (b - x:real^N)`; +DOWN; +ASM_SIMP_TAC[Ldurdpn.VECTOR_SCALE_CHANGE]; +STRIP_TAC; +MATCH_MP_TAC REAL_LE_DIV; +UNDISCH_TAC ` &0 < t `; +REAL_ARITH_TAC; +DOWN THEN DOWN; +NHANH PRESERABLE_AFF_GE_SUBSET; +SET_TAC[]]);; + + + + +let FAN_INTERSECTION_PRO_EXPRESS = prove_by_refinement +(` FAN (x:real^N,V,E) /\ a IN V /\ b IN V /\ ~( a = b ) +==> ~( ? t. &0 < t /\ +a - x = t % ( b - x ) )`, +[NHANH FAN_IMP_V_DIFF; +REWRITE_TAC[FAN; fan7]; +STRIP_TAC; +SUBGOAL_THEN ` aff_ge {x} {a:real^N} INTER aff_ge {x} {b} = aff_ge {x} ({a} INTER {b})` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +REWRITE_TAC[IN_UNION; IN_ELIM_THM; SET_RULE` {a} = {b} <=> a = b `]; +ASM_MESON_TAC[]; +DOWN THEN DOWN; +SIMP_TAC[SET_RULE` ~(a = b) <=> {a} INTER {b} = {} `; AFF_GE_EQ_AFFINE_HULL]; +REWRITE_TAC[AFFINE_HULL_SING]; +NHANH AFF_GE_EQ; +REPEAT STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +SUBGOAL_THEN ` b IN aff_ge {x} {b} INTER aff_ge {x} {b:real^N} ` ASSUME_TAC; +REWRITE_TAC[ENDS_IN_HALFLINE; IN_INTER]; +DOWN; +ASM_SIMP_TAC[IN_INSERT; NOT_IN_EMPTY]]);; + + + + + +let FAN_INTERSECTION_PRO_EXPRESS2 = +MESON[FAN_INTERSECTION_PRO_EXPRESS]`FAN (x:real^N,V,E) /\ a IN V /\ b IN V +/\ ~(a = b) /\ &0 < t ==> ~( a - x = t % (b - x))`;; + + + + + +let FAN_AFF2_INTER_CONV0_IMP_NO_IN_AF = prove_by_refinement +(` FAN (x:real^N,V,E) /\ {u,v,w} SUBSET V /\ t IN aff {x,v} INTER conv0 {u,w} +/\ CARD {u,v,w} = 3 ==> ~( u IN aff {x,v} )`, +[NHANH FAN_IMP_V_DIFF; +STRIP_TAC; +STRIP_TAC; +ASSUME_TAC2 ( +ISPECL [` t:real^N `;` x:real^N`;` v:real^N `;`u:real^N `;` w:real^N `] (GEN_ALL AFF_CONV0_COLL4)); +SUBGOAL_THEN ` {x, v, u, w} SUBSET aff { x,v:real^N } ` ASSUME_TAC; +MATCH_MP_TAC COLLINEAR_SUBSET_AFF2; +ASM_REWRITE_TAC[IN_INSERT]; +DOWN_TAC; +SIMP_TAC[EQ_SYM_EQ; INSERT_SUBSET]; +DOWN; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; Planarity.POINT_IN_LINE]; +ONCE_REWRITE_TAC[INSERT_COMM]; +REWRITE_TAC[Planarity.POINT_IN_LINE]; +REWRITE_TAC[AFF2; IN_ELIM_THM]; +STRIP_TAC; +ASM_CASES_TAC ` &0 < t' \/ &0 < t'' `; + +(* very smart way *) + +REPLICATE_TAC 5 DOWN; +REMOVE_TAC; +DOWN_TAC; +DAO; +SPEC_TAC (`t':real`,`t':real`); +SPEC_TAC (`u:real^N `,`u:real^N `); +SPEC_TAC (`t'':real`,`t'':real`); +SPEC_TAC (`w:real^N `,`w:real^N`); +MATCH_MP_TAC ( +MESON[]` (! x a y b. P x a y b ==> P y b x a ) /\ (! x a y b. ~( Q b /\ P x a y b )) ==> (! x a y b. ~(( Q b \/ Q a ) /\ P x a y b )) `); +CONJ_TAC; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[INSERT_COMM]; + +REWRITE_TAC[Geomdetail.CARD3]; +REPEAT STRIP_TAC; +UNDISCH_TAC` u = t' % v + (&1 - t') % x:real^N `; +REWRITE_TAC[VECTOR_ARITH` u = t' % v + (&1 - t') % x <=> u - x = t' % (v - x )`]; + +MATCH_MP_TAC ( +MESON[FAN_INTERSECTION_PRO_EXPRESS]`FAN (x,V,E) /\ a IN V /\ b IN V /\ ~(a = b) + /\ &0 < t ==> ~( a - x = t % (b - x))`); +DOWN_TAC; +SIMP_TAC[INSERT_SUBSET; DE_MORGAN_THM]; + +ASM_CASES_TAC` t' = &0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +UNDISCH_TAC ` u = &0 % v + (&1 - &0) % x:real^N `; +REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_SUB_RDISTRIB; VECTOR_ADD_LID; VECTOR_SUB_RZERO; VECTOR_MUL_LID]; +UNDISCH_TAC ` {u, v, w} SUBSET V:real^N -> bool `; +ASM_SIMP_TAC[INSERT_SUBSET]; + +ASM_CASES_TAC ` t'' = &0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +UNDISCH_TAC ` w = &0 % v + (&1 - &0) % x:real^N `; +REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_SUB_RDISTRIB; VECTOR_ADD_LID; VECTOR_SUB_RZERO; VECTOR_MUL_LID]; +UNDISCH_TAC ` {u, v, w} SUBSET V:real^N -> bool `; +ASM_SIMP_TAC[INSERT_SUBSET]; +DOWN THEN DOWN THEN DOWN THEN PHA; +REWRITE_TAC[REAL_ARITH` ~(&0 < t' \/ &0 < t'') /\ ~(t' = &0) /\ ~(t'' = &0) +<=> t' < &0 /\ t'' < &0 `]; +DOWN THEN DOWN; +REWRITE_TAC[VECTOR_ARITH` u = t' % v + (&1 - t') % x <=> +u - x = t'% ( v - x ) `]; +REPEAT STRIP_TAC; +ASSUME_TAC2 (REAL_ARITH` t' < &0 ==> ~( t' = &0) `); +SWITCH_TAC ` u - x = t' % (v - x:real^N)`; +DOWN; +ASM_SIMP_TAC[Ldurdpn.VECTOR_SCALE_CHANGE]; +STRIP_TAC; +UNDISCH_TAC ` w - x = t'' % (v - x:real^N)`; +ASM_REWRITE_TAC[VECTOR_MUL_ASSOC]; +MATCH_MP_TAC FAN_INTERSECTION_PRO_EXPRESS2; +DOWN_TAC; +SIMP_TAC[INSERT_SUBSET; Geomdetail.CARD3; DE_MORGAN_THM; REAL_ARITH ` a * &1 / b = a / b `]; +STRIP_TAC; +MATCH_MP_TAC REAL_LT_DIV_NEG; +ASM_REWRITE_TAC[]]);; + + + + +let AFF2_ITR_CONV0_IMP_SAME_ENDS = prove( +`! a b. t IN aff {x,y} INTER conv0 {a,b} ==> +(a IN aff {x,y} <=> b IN aff {x,y} ) `, +MATCH_MP_TAC ( +MESON[]` (! a b. P a b ==> P b a ) /\ (! a b. P a b /\ Q a ==> Q b ) +==> (! a b. P a b ==> (Q a <=> Q b )) `) THEN +SIMP_TAC[INSERT_COMM; INTER_COMM] THEN +NHANH IN_CONV0_AFF_SUBSET THEN REWRITE_TAC[SUBSET] THEN +REPEAT STRIP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN +REWRITE_TAC[Planarity.POINT_IN_LINE1]);; + + + + + + +let AFF_XX_CASES = prove_by_refinement +(`!x: real^N. aff_lt {x} {x} = {} /\ aff_le {x} {x} = {} /\ +aff_gt {x} {x} = {x}`, +[REWRITE_TAC[aff_le_def; sgn_le; aff_lt_def; aff_gt_def; affsign; FUN_EQ_THM; UNION_IDEMPOT; SET_RULE`~( {} x)`; sgn_gt; lin_combo; VSUM_SING; SUM_SING; sgn_lt] THEN +REWRITE_TAC[SET_RULE` {x} a <=> x = a `]; +GEN_TAC; +CONJ_TAC; +MESON_TAC[REAL_ARITH` ~( &1 < &0 ) `]; +CONJ_TAC; +MESON_TAC[REAL_ARITH` ~( &1 <= &0 ) `]; +GEN_TAC; +EQ_TAC; +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN_TAC; +SIMP_TAC[VECTOR_MUL_LID]; +STRIP_TAC; +EXISTS_TAC `(\x:real^N. &1 ) `; +ASM_REWRITE_TAC[VECTOR_MUL_LID]; +GEN_TAC THEN DISCH_TAC; +REAL_ARITH_TAC]);; + + + + +let NOT_X_IN_AFF_X_A = prove_by_refinement +(` ~ ( x:real^N IN aff_lt {x} {a} )`, +[ASM_CASES_TAC ` x = a:real^N `; +ASM_REWRITE_TAC[AFF_XX_CASES; NOT_IN_EMPTY]; +DOWN; +SIMP_TAC[SET_RULE` ~( a = x ) <=> DISJOINT {a} {x} `; AFF_LT_1_1]; +REWRITE_TAC[GSYM (SET_RULE` ~( a = x ) <=> DISJOINT {a} {x} `); IN_ELIM_THM; +VECTOR_ARITH` x = t1 % x + t2 % a <=> t2 % ( a - x ) = x - (t1 + t2 ) % x `]; +REPEAT STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[VECTOR_ARITH` x - &1 % x = vec 0 `; VECTOR_MUL_EQ_0; VECTOR_SUB_EQ]; +ASM_REAL_ARITH_TAC]);; + + + + +let INTER_EQ_EM_EXPAND = SET_RULE` A INTER B = {} <=> ~( ?x. x IN A /\ x IN B )`;; + + + + + +let NOT_INTER_EQ_EM_IMP_AFF_SUBSET = prove_by_refinement +(` x' IN aff_gt {x:real^N} {v, w} INTER aff_lt {x} {u} +==> aff {x,u} SUBSET affine hull {x,v,w} `, [REWRITE_TAC[IN_INTER]; +STRIP_TAC; SUBGOAL_THEN ` ~ (x' = x:real^N) ` ASSUME_TAC; +ASM_MESON_TAC[NOT_X_IN_AFF_X_A]; +SUBGOAL_THEN ` {x,x':real^N} SUBSET aff {x,u} ` ASSUME_TAC; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; Planarity.POINT_IN_LINE]; +MP_TAC (ISPECL [`{x:real^N }`;` {u:real^N }`] AFF_LT_SUBSET_AFFINE_HULL); +REWRITE_TAC[GSYM aff; SET_RULE` {x} UNION S = x INSERT S `; SUBSET]; +ASM_SIMP_TAC[]; +SUBGOAL_THEN ` aff {x,u:real^N} = aff {x,x'} ` ASSUME_TAC; +MATCH_MP_TAC AFF2_DET_BY_TWO_POINTS; +ASM_SIMP_TAC[]; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC Collect_geom.AFFINE_CONTAIN_LINE; +REWRITE_TAC[AFFINE_AFFINE_HULL]; +MP_TAC (ISPECL [`{x:real^N }`;` {v,w:real^N }`] AFF_GT_SUBSET_AFFINE_HULL); +REWRITE_TAC[aff; SET_RULE` {x} UNION S = x INSERT S `; INSERT_SUBSET; +EMPTY_SUBSET; Ldurdpn.IN_HULL_INSERT]; +REWRITE_TAC[SUBSET]; +DISCH_THEN MATCH_MP_TAC; +FIRST_ASSUM ACCEPT_TAC]);; + + +let IN_AFF_HULL_3 = prove(` x' IN aff_gt {x} {v, w} INTER aff_lt {x} {u} +==> u IN affine hull {x, v, w} `, +NHANH NOT_INTER_EQ_EM_IMP_AFF_SUBSET THEN +REWRITE_TAC[AFF2; SUBSET; IN_ELIM_THM] THEN +STRIP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN +EXISTS_TAC ` &0 ` THEN VECTOR_ARITH_TAC);; + + + + +let LOCAL_FAN_ORBIT_MAP_VITER = prove( +` local_fan (V,E,FF) ==> (! v n. v IN V ==> ITER n (rho_node1 FF) v IN V ) `, +NHANH LOCAL_FAN_ORBIT_MAP_V THEN STRIP_TAC THEN REPEAT GEN_TAC THEN +FIRST_X_ASSUM (NHANH_PAT `\x. x ==> y `) THEN STRIP_TAC THEN EXPAND_TAC "V" +THEN REWRITE_TAC[REWRITE_RULE[POWER_TO_ITER] Hypermap.lemma_in_orbit]);; + + + + + +let INTER_AFF_GT_LT_IMP_INTER_AFF_CONV0 = REWRITE_RULE[TAUT` a ==> b ==> c +<=> a /\ b ==> c `] (ISPEC ` t:real^N ` (GEN_ALL + INTER_AFF_GT_LT_IMP_INTER_AFF_CONV0));; + + +let AFF_GT_AFF_LT_INTERPRET = prove_by_refinement +( `! x:real^N. DISJOINT {x} {v, w} /\ DISJOINT {x} {u} + ==> ((?a b c. + a < &0 /\ + &0 < b /\ + &0 < c /\ + a % (u - x) = b % (v - x) + c % (w - x)) <=> + (?tt. tt IN aff_gt {x} {v, w} INTER aff_lt {x} {u})) `, +[GEN_TAC THEN STRIP_TAC; +EQ_TAC; +ASM_SIMP_TAC[Planarity.AFF_GT_1_2; AFF_LT_1_1; IN_INTER; IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC ` (x:real^N) + a % (u - x) `; +CONJ_TAC; +ASM_REWRITE_TAC[]; +EXISTS_TAC ` &1 - b - c `; +EXISTS_TAC `b:real `; +EXISTS_TAC `c:real `; +ASM_REWRITE_TAC[]; +CONJ_TAC; +REAL_ARITH_TAC; +VECTOR_ARITH_TAC; +EXISTS_TAC ` &1 - a `; +EXISTS_TAC `a:real `; +ASM_REWRITE_TAC[]; +CONJ_TAC; +REAL_ARITH_TAC; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +VECTOR_ARITH_TAC; +ASM_SIMP_TAC[Planarity.AFF_GT_1_2; AFF_LT_1_1; IN_INTER; IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC ` t2':real `; +EXISTS_TAC ` t2:real ` ; +EXISTS_TAC ` t3:real `; +ASM_REWRITE_TAC[]; +DOWN; +DOWN; +SIMP_TAC[REAL_ARITH` a + b = &1 <=> a = &1 - b `]; +REMOVE_TAC; +DOWN; +REMOVE_TAC; +DOWN; +DOWN; +SIMP_TAC[REAL_ARITH` a + b = &1 <=> a = &1 - b `]; +REMOVE_TAC; +REMOVE_TAC; +VECTOR_ARITH_TAC]);; + + + + +let AFF_GT_AFF_LT_INTERPRET2 = REWRITE_RULE[SET_RULE`DISJOINT {x} {v, w} /\ + DISJOINT {x} {u} <=> DISJOINT {x} {u,v,w} `] AFF_GT_AFF_LT_INTERPRET;; +let EXISTS_IN = SET_RULE` ~( a = {} ) <=> ? x. x IN a `;; + + +let AFF_GT_LT_INTER_SYM = prove_by_refinement +(`! x:real^N. DISJOINT {x} {u, v, w} ==> +~( aff_gt {x} {v,w} INTER aff_lt {x} {u} = {} ) ==> +~( aff_gt {x} {u,v} INTER aff_lt {x} {w} = {} )`, +[REWRITE_TAC[EXISTS_IN]; +SIMP_TAC[GSYM AFF_GT_AFF_LT_INTERPRET2]; +ONCE_REWRITE_TAC[SET_RULE` {a,b,c} = {c,a,b} `]; +SIMP_TAC[GSYM AFF_GT_AFF_LT_INTERPRET2]; +REPEAT STRIP_TAC; +EXISTS_TAC ` -- c:real `; +EXISTS_TAC ` -- a :real `; +EXISTS_TAC ` b:real `; +ASM_SIMP_TAC[VECTOR_ARITH` a % (u - x) = b % (v - x) + c % (w - x) +==> --c % (w - x) = --a % (u - x) + b % (v - x) `]; +ASM_REAL_ARITH_TAC]);; + + + + + +let EXISTS_INTERSECTION_PROPERPLY = prove_by_refinement +(` (~(z:real^N = x) /\ + DISJOINT {x} {v, w} /\ + ~(x = u) /\ + ~(aff_gt {x} {v, w} INTER aff_lt {x} {u} = {}) /\ + z IN affine hull {x, v, w}) /\ + ~ collinear {x,v,w} + ==> (?a b t. + {a, b} SUBSET {u, v, w} /\ + t IN aff {x, z} INTER conv0 {a, b} /\ + ~(a IN aff {x,z}))`, +[NHANH INTERSECTION_LEMMA; +STRIP_TAC; +ASM_CASES_TAC` ~( a:real^N IN aff {x,z}) `; +EXISTS_TAC ` a:real^N `; +EXISTS_TAC ` b:real^N `; +EXISTS_TAC ` t:real^N `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` {a, b} SUBSET {u, v, w:real^N } `; +ONCE_REWRITE_TAC[INSERT_SUBSET]; +ONCE_REWRITE_TAC[IN_INSERT]; +STRIP_TAC; +EXISTS_TAC` v:real^N `; +EXISTS_TAC `w:real^N `; +REWRITE_TAC[IN_INSERT; INSERT_SUBSET; EMPTY_SUBSET]; +SUBGOAL_THEN` (?tt. tt IN aff {x, u} INTER conv0 {v, w:real^N})` MP_TAC; +MATCH_MP_TAC (GEN_ALL INTER_AFF_GT_LT_IMP_INTER_AFF_CONV0); +ASM_SIMP_TAC[]; +UNDISCH_TAC ` ~(aff_gt {x} {v, w} INTER aff_lt {x} {u:real^N} = {}) `; +SET_TAC[]; +STRIP_TAC; +EXISTS_TAC `tt:real^N `; +SUBGOAL_THEN` aff {x,z} = aff {x,u:real^N} ` SUBST_ALL_TAC; +MATCH_MP_TAC Planarity.sym_line_fan1; +UNDISCH_TAC ` ~ ~(a IN aff {x, z:real^N}) `; +ASM_SIMP_TAC[SET_RULE` DISJOINT {x} {u,z} <=> ~( z = x ) /\ ~ (x = u )`]; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN ` w IN aff {x, u:real^N} ` MP_TAC; +DOWN THEN DOWN; +NHANH AFF2_ITR_CONV0_IMP_SAME_ENDS; +SIMP_TAC[]; +STRIP_TAC; +SUBGOAL_THEN ` {x,v,w:real^N} SUBSET aff {x,u} ` MP_TAC; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; Planarity.POINT_IN_LINE]; +REWRITE_TAC[]; +NHANH SUBSET_AFF2_IMP_COLL; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` a IN {v,w:real^N} ` ; +REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY]; +DOWN_TAC; +DAO; +SPEC_TAC (`v:real^N`,`v:real^N`); +SPEC_TAC (`w:real^N`,`w:real^N`); +MATCH_MP_TAC (MESON[]` (! x y. (P x y ==> P y x) /\ ( L x y ==> L y x )) /\ +(! x y. a = x /\ P x y ==> L x y ) ==> + (! y x. (a = x \/ a = y) /\ P x y ==> L x y ) `); +CONJ_TAC; +SIMP_TAC[INSERT_COMM; DISJ_SYM]; +REPEAT STRIP_TAC; +EXISTS_TAC ` w:real^N`; +EXISTS_TAC `u:real^N`; +REWRITE_TAC[INSERT_SUBSET; IN_INSERT; EMPTY_SUBSET; RIGHT_EXISTS_AND_THM]; +CONJ_TAC; +STRIP_TAC; +SUBGOAL_THEN ` {x:real^N,v,w} SUBSET aff {x,z} ` MP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; Planarity.POINT_IN_LINE]; +UNDISCH_TAC` ~collinear {x, v, w:real^N}`; +MESON_TAC[SUBSET_AFF2_IMP_COLL]; +SUBGOAL_THEN ` aff {x, z} = aff {x,v:real^N}` SUBST1_TAC; +MATCH_MP_TAC AFF2_DET_BY_TWO_POINTS; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; Planarity.POINT_IN_LINE]; +FIRST_X_ASSUM SUBST_ALL_TAC; +ASM_SIMP_TAC[EQ_SYM_EQ]; +UNDISCH_TAC` DISJOINT {x} {v, w:real^N}` ; +SET_TAC[]; +MATCH_MP_TAC (GEN_ALL INTER_AFF_GT_LT_IMP_INTER_AFF_CONV0); +ASM_SIMP_TAC[INSERT_COMM; RIGHT_EXISTS_AND_THM]; +CONJ_TAC; +DOWN THEN DOWN THEN DOWN; +SET_TAC[]; +REWRITE_TAC[GSYM EXISTS_IN]; +MATCH_MP_TAC ( +REWRITE_RULE[TAUT` a ==> b ==> c <=> a /\ b ==> c `] AFF_GT_LT_INTER_SYM); +ASM_SIMP_TAC[INSERT_COMM]; +DOWN THEN DOWN THEN SET_TAC[]]);; + + + + + + +let LOFA_V_SUBSET_AFF_HULL = prove_by_refinement +(`!w v. + v,w IN FF /\ + convex_local_fan (V,E,FF) /\ + u IN V /\ + ~(aff_gt {vec 0} {v, w} INTER aff_lt {vec 0} {u} = {}) +==> V SUBSET affine hull {v,w,vec 0} /\ +~ collinear {vec 0,v,w} `, +[NHANH CVX_LO_IMP_LO; +PURE_ONCE_REWRITE_TAC[TAUT` a /\ (b /\c)/\d <=>(c/\a)/\b/\d `]; +NHANH LOCAL_FAN_IN_FF_NOT_COLLINEAR; +SIMP_TAC[]; +NHANH LOCAL_FAN_ORBIT_MAP_V; +PHA; +ONCE_REWRITE_TAC[TAUT` a /\b/\c/\d <=> (a/\c)/\b/\d`]; +NHANH LOCAL_FAN_IMP_IN_V; +REPEAT STRIP_TAC; +UNDISCH_TAC ` v:real^3 IN V`; +FIRST_ASSUM NHANH; +STRIP_TAC; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +REWRITE_TAC[orbit_map; SUBSET; IN_ELIM_THM; ARITH_RULE` a >= 0`]; +REPEAT STRIP_TAC; +ASM_REWRITE_TAC[]; +SPEC_TAC (`n:num`,`n:num`); +INDUCT_TAC; +REWRITE_TAC[POWER_0; I_THM; Trigonometry2.IN_P_HULL_INSERT]; +MP_TAC (ISPECL [`u:real^3 `;`v:real^3`;`w:real^3 `;` vec 0: real^3 `; +` (rho_node1 FF POWER n') v `] (GEN_ALL EXISTS_INTERSECTION_PROPERPLY)); +ANTS_TAC; +ASM_SIMP_TAC[INSERT_COMM; DISJOINT_INSERT; DISJOINT_EMPTY; IN_INSERT; DE_MORGAN_THM; NOT_IN_EMPTY]; +SUBGOAL_THEN ` (rho_node1 FF POWER n') v IN V ` ASSUME_TAC; +ABBREV_TAC `conjl <=> (rho_node1 FF POWER n') v IN V `; +UNDISCH_TAC ` v:real^3 IN V `; +FIRST_X_ASSUM NHANH; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +STRIP_TAC; +EXPAND_TAC "V"; +REWRITE_TAC[orbit_map; IN_ELIM_THM; ARITH_RULE` a >= 0`]; +MESON_TAC[]; +MP_TAC2 Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN; +NHANH FAN_IMP_V_DIFF; +ASM_SIMP_TAC[EQ_SYM_EQ]; +STRIP_TAC; +SUBGOAL_THEN ` ~(b IN aff {vec 0, (rho_node1 FF POWER n') v})` MP_TAC; +DOWN; +DOWN; +NHANH AFF2_ITR_CONV0_IMP_SAME_ENDS; +SIMP_TAC[]; +DOWN THEN PHA; +REWRITE_TAC[SET_RULE` ~( x IN S ) /\ ~(y IN S ) <=> {x,y} INTER S = {} `]; +STRIP_TAC; +SUBGOAL_THEN ` interior_angle1 (vec 0) FF ((rho_node1 FF POWER n') v) = pi /\ + rho_node1 FF ((rho_node1 FF POWER n') v) IN (affine hull {v, w, vec 0}) /\ + ivs_rho_node1 FF ((rho_node1 FF POWER n') v) IN ( affine hull {v, w, vec 0})` ASSUME_TAC; +MATCH_MP_TAC (GEN_ALL OZQVSFF); +EXISTS_TAC `E:(real^3 -> bool) -> bool `; +EXISTS_TAC `V:real^3 -> bool `; +EXISTS_TAC ` a:real^3 `; +EXISTS_TAC ` b:real^3 `; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +SUBGOAL_THEN ` {a,b:real^3} SUBSET V` MP_TAC; +UNDISCH_TAC `{a, b} SUBSET {u, v, w:real^3}`; +MATCH_MP_TAC (SET_RULE` A SUBSET B ==> c SUBSET A ==> c SUBSET B `); +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +SIMP_TAC[INSERT_SUBSET]; +SUBGOAL_THEN ` {u, v, w} SUBSET affine hull {v,w,vec 0:real^3}` ASSUME_TAC; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; Ldurdpn.IN_HULL_INSERT]; +ONCE_REWRITE_TAC[INSERT_COMM]; +REWRITE_TAC[Ldurdpn.IN_HULL_INSERT]; +ONCE_REWRITE_TAC[SET_RULE` {a,b,c} = {c,b,a} `]; +MATCH_MP_TAC (GEN_ALL IN_AFF_HULL_3); +UNDISCH_TAC` ~(aff_gt {vec 0} {v:real^3, w} INTER aff_lt {vec 0} {u} = {}) `; +SET_TAC[]; +ASSUME_TAC2 (ISPECL [`{a,b:real^3}`;` {u,v,w:real^3}`; +`affine hull {v,w, vec 0:real^3 }` ] SUBSET_TRANS); +DOWN; +SIMP_TAC[INSERT_SUBSET]; +STRIP_TAC THEN STRIP_TAC; +ONCE_REWRITE_TAC[SET_RULE`{a,b,c} = {c,a,b} `]; +REWRITE_TAC[Ldurdpn.IN_HULL_INSERT; POWER_TO_ITER]; +ASSUME_TAC2 LOCAL_FAN_ORBIT_MAP_VITER; +UNDISCH_TAC `v:real^3 IN V `; +FIRST_X_ASSUM (MP_TAC o (SPECL [`v:real^3`;` n': num `])); +DISCH_THEN NHANH; +SIMP_TAC[]; +STRIP_TAC; +CONJ_TAC; +REWRITE_TAC[plane]; +EXISTS_TAC ` vec 0:real^3 `; +EXISTS_TAC `v:real^3 `; +EXISTS_TAC `w:real^3 `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` t IN aff {vec 0, (rho_node1 FF POWER n') v} INTER conv0 {a, b:real^3}`; +SIMP_TAC[INSERT_COMM; POWER_TO_ITER]; +SET_TAC[]; +DOWN; +SIMP_TAC[COM_POWER; o_THM]]);; + + + + + +let DETER_RHO_NODE = prove(` local_fan (V,E,FF) /\ v,w IN FF +==> rho_node1 FF v = w `, NHANH LOCAL_FAN_RHO_NODE_PROS THEN +STRIP_TAC THEN DOWN THEN FIRST_X_ASSUM NHANH THEN +SIMP_TAC[PAIR_EQ]);; + + + + +let CARD_RECUSIVE_EQ = prove_by_refinement +(` !k f. 0 < k ==> + (CARD {ITER n f x:A | n < k} = k + <=> CARD {ITER n f x | n < k - 1} = k - 1 /\ + (!i. i < k - 1 ==> ~(ITER i f x = ITER (k - 1) f x))) `, +[REPEAT GEN_TAC; +STRIP_TAC; +EQ_TAC; +REWRITE_TAC[Wrgcvdr_cizmrrh.CARD_K_FIRST_ELMS_EQ_K]; +SUBGOAL_THEN ` {ITER n f x:A | n < k} = ITER (k - 1) f x INSERT {ITER n f x | n < k - 1} ` SUBST1_TAC; +REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_INSERT]; +ASM_SIMP_TAC[ARITH_RULE`0 < b ==> ( a < b <=> a = b - 1 \/ a < b - 1 )`]; +MESON_TAC[]; +STRIP_TAC; +SUBGOAL_THEN ` FINITE {ITER n f x:A | n < k - 1} /\ +~( ITER (k - 1) f x IN {ITER n f x | n < k - 1}) ` ASSUME_TAC; +REWRITE_TAC[IN_ELIM_THM; SET_RULE` {ITER n f x | n < k } = {y | ?n. n < k /\ +y = ITER n f x}`; Wrgcvdr_cizmrrh.FINITE_OF_N_FIRST_ELMS]; +DOWN THEN MESON_TAC[]; +DOWN THEN STRIP_TAC; +ASM_SIMP_TAC[Geomdetail.CARD_CLAUSES_IMP]; +UNDISCH_TAC ` 0 < k `; +ARITH_TAC]);; + + + + + +let LE_CARDV_IMP_CARD_DETERED = prove_by_refinement +(`(! v. v:A IN V ==> orbit_map f v = V ) /\ v IN V ==> +(! l. l <= CARD V ==> CARD {ITER n f v | n < l} = l)`, +[STRIP_TAC; +INDUCT_TAC; +REWRITE_TAC[LT; SET_RULE` {ITER n f v | n | F} = {} `; CARD_CLAUSES]; +NHANH (ARITH_RULE` SUC n <= c ==> n <= c `); +FIRST_X_ASSUM NHANH; +STRIP_TAC; +MP_TAC (ARITH_RULE` 0 < SUC l `); +ASM_SIMP_TAC[ CARD_RECUSIVE_EQ; ARITH_RULE` SUC l - 1 = l `]; +REPEAT STRIP_TAC; +DOWN THEN PHA; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +MATCH_MP_TAC LOOP_MAP_IMP_DIFF_FIRST_ELMS; +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` SUC l <= CARD (V:A -> bool) `; +ARITH_TAC]);; + + +let LEMMA_SUBSET_ORBIT_MAP = REWRITE_RULE[POWER_TO_ITER] Hypermap.lemma_subset_orbit;; + + + +let LEMMA_SUBSET_ORBIT_MAP_LT = prove( +` {ITER i p x | i < n} SUBSET orbit_map p x`, +ASM_CASES_TAC ` n = 0 ` THENL [ASM_REWRITE_TAC[LT] THEN SET_TAC[]; +ASM_SIMP_TAC[ARITH_RULE`~( b = 0 ) ==> ( a < b <=> a <= b - 1) `; +LEMMA_SUBSET_ORBIT_MAP]]);; + + + +let LOOP_SET_DETER_FIRTS_ELMS = prove_by_refinement +(` (!v. v:A IN V ==> orbit_map f v = V) ==> +(! v. v IN V ==> {ITER n f v | n < CARD V } = V ) `, +[REPEAT STRIP_TAC; +SUBGOAL_THEN ` CARD {ITER n f v:A | n < CARD V} = CARD (V:A -> bool) ` MP_TAC; +ASSUME_TAC2 LE_CARDV_IMP_CARD_DETERED; +FIRST_X_ASSUM MATCH_MP_TAC; +ARITH_TAC; +SUBGOAL_THEN ` {ITER n f v:A | n < CARD V} SUBSET V ` ASSUME_TAC; +DOWN; +FIRST_X_ASSUM NHANH; +STRIP_TAC; +ABBREV_TAC ` nn = CARD (V:A -> bool) `; +EXPAND_TAC "V"; +REWRITE_TAC[ARITH_RULE ` a < b ==> a <= b - 1 `; LEMMA_SUBSET_ORBIT_MAP_LT]; +DOWN_TAC; +SIMP_TAC[EQ_SYM_EQ]; +NHANH SELF_CYCLIC_IMP_FINITE; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +STRIP_TAC; +ASM_SIMP_TAC[GSYM SUBSET_CARD_EQ]]);; + + + + +let lemma_in_orbit_iter = REWRITE_RULE[POWER_TO_ITER] Hypermap.lemma_in_orbit;; + + + + +let SIN_SUB_PERIODIC = prove(` sin x = -- ( sin ( x - pi )) `, +REWRITE_TAC[GSYM SIN_PERIODIC_PI; REAL_ARITH` a - b + b = a `]);; + + +(* ==================================== *) + +let KCHMAMG = prove_by_refinement +(`convex_local_fan (V,E,FF) /\ circular V E + ==> (!v. v IN V ==> interior_angle1 (vec 0) FF v = pi) /\ + (?A. plane A /\ + vec 0 IN A /\ + V SUBSET A /\ + (?e. (!x. x IN A ==> e dot x = &0) /\ + cyclic_set V (vec 0) e /\ + (!v. v IN V + ==> azim_cycle V (vec 0) e v = rho_node1 FF v /\ + azim (vec 0) e v (rho_node1 FF v) = + dihV (vec 0) e v (rho_node1 FF v) /\ + azim (vec 0) e v (rho_node1 FF v) = + arcV (vec 0) v (rho_node1 FF v) /\ +azim (vec 0) e v (rho_node1 FF v) < pi)))`, +[REWRITE_TAC[circular]; +STRIP_TAC; +DOWN_TAC; +NGOAC; +NHANH CVX_LO_IMP_LO; +ONCE_REWRITE_TAC[TAUT` ((a/\b)/\c)/\ x IN S <=>a /\(b/\c)/\x IN S`]; +NHANH LOFA_IN_E_IMP_IN_FF; +PHA; +SPEC_TAC (`v:real^3`,`v:real^3`); +SPEC_TAC (`w:real^3`,`w:real^3 `); +ONCE_REWRITE_TAC[TAUT` a /\a1 /\a2 /\a3/\a4 <=> a3 /\ a/\a1/\a2/\a4`]; +MATCH_MP_TAC ( +MESON[]`(! x y. P x y ==> P y x) /\ (! x y. Q x y /\ P x y ==> L) +==> (! x y. (Q x y \/ Q y x) /\ P x y ==> L)`); +CONJ_TAC; +SIMP_TAC[INSERT_COMM]; +REPEAT GEN_TAC THEN STRIP_TAC; +ONCE_REWRITE_TAC[TAUT` a /\ b <=> b /\ ( b ==> a ) `]; +CONJ_TAC; +EXISTS_TAC ` affine hull {vec 0, v, w:real^3}`; +REWRITE_TAC[plane]; +UNDISCH_TAC ` v,w IN FF:real^3 # real^3 -> bool `; +UNDISCH_TAC ` local_fan (V,E,FF) `; +PHA; +NHANH LOCAL_FAN_IN_FF_NOT_COLLINEAR; +STRIP_TAC; +CONJ_TAC; +EXISTS_TAC ` vec 0:real^3 `; +EXISTS_TAC ` v:real^3 `; +EXISTS_TAC ` w:real^3 `; +DOWN; +SIMP_TAC[]; + +REWRITE_TAC[Ldurdpn.IN_HULL_INSERT]; +ASSUME_TAC2 LOFA_V_SUBSET_AFF_HULL; +ASM_SIMP_TAC[INSERT_COMM]; +ABBREV_TAC ` e = v cross (rho_node1 FF v ) `; +EXISTS_TAC ` e:real^3 `; +SUBGOAL_THEN ` v:real^3 IN V /\ w IN V ` MP_TAC; +MATCH_MP_TAC LOCAL_FAN_IMP_IN_V; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASSUME_TAC2 LOFA_IN_V_SO_DO_RHO_NODE_V; +DOWN THEN DOWN; +UNDISCH_TAC ` V SUBSET affine hull {v, w, vec 0} /\ ~collinear {vec 0, v, w:real^3}`; +REWRITE_TAC[SUBSET]; +STRIP_TAC; +PHA; +FIRST_ASSUM (NHANH_PAT`\x. x ==> y ` ); +STRIP_TAC; +ASSUME_TAC2 DETER_RHO_NODE; +CONJ_TAC; +REWRITE_TAC[AFFINE_HULL_3; IN_ELIM_THM]; +REPEAT STRIP_TAC; +ASM_REWRITE_TAC[]; +EXPAND_TAC "e"; +UNDISCH_TAC ` rho_node1 FF v = w `; +SIMP_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_RID; DOT_RADD; DOT_RMUL; DOT_CROSS_SELF; + Collect_geom.ZERO_NEUTRAL]; +REWRITE_TAC[DOT_RZERO; Collect_geom.ZERO_NEUTRAL]; + +ASSUME_TAC2 LOCAL_FAN_ORBIT_MAP_V; +DOWN THEN NHANH LOOP_SET_DETER_FIRTS_ELMS; +STRIP_TAC; +UNDISCH_TAC` v:real^3 IN V `; +FIRST_X_ASSUM (NHANH_PAT`\x. x ==> y`); + +FIRST_ASSUM (NHANH_PAT`\x. x ==> y`); +STRIP_TAC; +SUBGOAL_THEN` ITER (CARD (V:real^3 -> bool)) (rho_node1 FF) v IN V ` ASSUME_TAC; +DOWN; +EXPAND_TAC "V"; +REWRITE_TAC[lemma_in_orbit_iter]; +SUBGOAL_THEN`ITER (CARD (V:real^3 -> bool)) (rho_node1 FF) v INSERT {ITER n (rho_node1 FF) v | n < CARD V} = {ITER n (rho_node1 FF) v | n <= CARD V} ` ASSUME_TAC; +REWRITE_TAC[EXTENSION; IN_INSERT; IN_ELIM_THM]; +MESON_TAC[ARITH_RULE` a <= b <=> a = b \/ a < b:num `]; +REPLICATE_TAC 3 DOWN THEN PHA; +NHANH (SET_RULE` a = b /\ x IN b /\ x INSERT a = h ==> h = b `); +STRIP_TAC; + +MP_TAC2 ( +SPECL [`V:real^3 -> bool`;`affine hull {v, w, vec 0:real^3} `;` CARD (V:real^3 +-> bool)`] (GENL [`U:real^3 -> bool`;` P:real^3 -> bool `;`l:num`] +(SPEC_ALL KOMWBWC))); +ASSUME_TAC2 LOFA_V_SUBSET_AFF_HULL; +ASM_REWRITE_TAC[plane]; +CONJ_TAC; +EXISTS_TAC` vec 0:real^3 `; +EXISTS_TAC `v:real^3 `; +EXISTS_TAC ` w:real^3 `; +ASM_REWRITE_TAC[]; +SIMP_TAC[INSERT_COMM]; +ONCE_REWRITE_TAC[SET_RULE` {a,b,c} = {c,a,b}`]; +REWRITE_TAC[Ldurdpn.IN_HULL_INSERT]; +STRIP_TAC; + + + + +GEN_TAC THEN STRIP_TAC; +CONJ_TAC; +DOWN; +UNDISCH_TAC` {ITER n (rho_node1 FF) v | n < CARD V} = V`; +STRIP_TAC; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +ONCE_REWRITE_TAC[CONJ_SYM]; +STRIP_TAC; +DOWN THEN DOWN THEN PHA; +ASM_SIMP_TAC[]; +UNDISCH_TAC `!x n. + x = ITER n (rho_node1 FF) v /\ n < CARD V + ==> azim_cycle V (vec 0) e (ITER n (rho_node1 FF) v) = + rho_node1 FF (ITER n (rho_node1 FF) v) `; +MESON_TAC[]; +SUBGOAL_THEN` &0 < sin (azim (vec 0) e v' (rho_node1 FF v')) ` ASSUME_TAC; +MP_TAC (SPECL [`e:real^3 `;` v':real^3 `;` rho_node1 FF v' `] + Trigonometry2.JBDNJJB); +REWRITE_TAC[re_eqvl]; +STRIP_TAC; +FIRST_X_ASSUM SUBST1_TAC; +MATCH_MP_TAC REAL_LT_MUL; +UNDISCH_TAC ` v':real^3 IN V `; +UNDISCH_TAC `{ITER n (rho_node1 FF) v | n < CARD V} = V `; +DISCH_THEN (SUBST1_TAC o SYM); +REWRITE_TAC[IN_ELIM_THM]; +UNDISCH_TAC ` !i. i < CARD (V:real^3 -> bool) + ==> &0 < + (ITER i (rho_node1 FF) v cross ITER (i + 1) (rho_node1 FF) v) dot + e `; +DISCH_THEN NHANH; +STRIP_TAC; +DOWN; +ASM_SIMP_TAC[GSYM ITER; ADD1]; +ONCE_REWRITE_TAC[CROSS_TRIPLE]; +ASM_REWRITE_TAC[]; +MP_TAC (SPECL [`vec 0:real^3 `;` e:real^3 `;` v':real^3 `; +`rho_node1 FF v' `] AZIM_RANGE); + +ASM_CASES_TAC ` pi <= azim (vec 0) e v' (rho_node1 FF v') `; +STRIP_TAC; +ABBREV_TAC ` a = azim (vec 0) e v' (rho_node1 FF v') `; +SUBGOAL_THEN ` sin a <= &0 ` MP_TAC; +ONCE_REWRITE_TAC[SIN_SUB_PERIODIC]; +REWRITE_TAC[REAL_ARITH` -- a <= &0 <=> &0 <= a `]; +MATCH_MP_TAC SIN_POS_PI_LE; +UNDISCH_TAC ` pi <= a `; +UNDISCH_TAC ` a < &2 * pi `; +REAL_ARITH_TAC; +UNDISCH_TAC ` &0 < sin a `; +MESON_TAC[REAL_ARITH` &0 < a ==> ~(a <= &0 ) `]; +DOWN; +REWRITE_TAC[REAL_ARITH` ~( a <= b ) <=> b < a `]; +SUBGOAL_THEN `~ collinear {vec 0, e, v'} /\ ~ collinear {vec 0, e, rho_node1 FF v'}` ASSUME_TAC; +SUBGOAL_THEN ` rho_node1 FF v' IN V ` ASSUME_TAC; +MATCH_MP_TAC LOFA_IN_V_SO_DO_RHO_NODE_V; +ASM_REWRITE_TAC[]; + +ONCE_REWRITE_TAC[SET_RULE`{a,b,c} = {c,a,b}`]; +UNDISCH_TAC` cyclic_set V (vec 0) (e:real^3) `; +NHANH Wrgcvdr_cizmrrh.CYCLIC_SET_IMP_NOT_COLLINEAR; +ASM_SIMP_TAC[]; +DOWN; + +SIMP_TAC[AZIM_DIHV_SAME]; + +REPEAT STRIP_TAC; +REWRITE_TAC[Trigonometry2.DIHV_FORMULAR; VECTOR_SUB_RZERO]; + +SUBGOAL_THEN` v' dot e = &0 /\ rho_node1 FF v' dot (e:real^3) = &0 ` MP_TAC; + +SUBGOAL_THEN ` rho_node1 FF v' IN V ` ASSUME_TAC; +MATCH_MP_TAC LOFA_IN_V_SO_DO_RHO_NODE_V; +ASM_REWRITE_TAC[]; +DOWN; +UNDISCH_TAC ` v':real^3 IN V `; +UNDISCH_TAC` !x. x IN V ==> x IN affine hull {v, w, vec 0:real^3}`; +DISCH_THEN NHANH; +REWRITE_TAC[AFFINE_HULL_3; IN_ELIM_THM]; +STRIP_TAC THEN STRIP_TAC; +ASM_REWRITE_TAC[]; +EXPAND_TAC "e"; +USE_FIRST ` rho_node1 FF v = w ` SUBST1_TAC; +REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_RID]; +REWRITE_TAC[DOT_LADD; DOT_LMUL; DOT_CROSS_SELF]; +REAL_ARITH_TAC; +SIMP_TAC[VECTOR_MUL_LZERO; VECTOR_SUB_RZERO]; +SUBGOAL_THEN` &0 < e dot (e:real^3)` ASSUME_TAC; +UNDISCH_TAC `cyclic_set V (vec 0) (e:real^3) `; +SIMP_TAC[DOT_POS_LT; cyclic_set; EQ_SYM_EQ]; +REMOVE_TAC; +DOWN; +MESON_TAC[Trigonometry2.WHEN_A_B_POS_ARCV_STABLE]; +STRIP_TAC; + +REPEAT STRIP_TAC; +ASSUME_TAC2 (SPEC `v:real^3,w:real^3 ` (GEN `x:real^3# real^3 ` + LOCAL_FAN_IN_FF_NOT_COLLINEAR)); +SUBGOAL_THEN` affine hull {vec 0, v, w:real^3} = A ` ASSUME_TAC; +MATCH_MP_TAC THREE_NOT_COLL_DETER_PLANE; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +UNDISCH_TAC` V:real^3 -> bool SUBSET A `; +MATCH_MP_TAC (SET_RULE` x IN A /\ y IN A ==> A SUBSET B ==> x IN B /\ y IN B`); +MATCH_MP_TAC LOCAL_FAN_IMP_IN_V; +ASM_REWRITE_TAC[]; +MP_TAC (ISPECL [` vec 0:real^3 `;` v':real^3 ` ] (GENL [` x:real^N `; +` z:real^N `] EXISTS_INTERSECTION_PROPERPLY)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +MP_TAC2 (SET_RULE` v' :real^3 IN V /\ V SUBSET A ==> v' IN A`); +SIMP_TAC[]; +DISCH_TAC; +SUBGOAL_THEN ` v IN V /\ w:real^3 IN V ` MP_TAC; +MATCH_MP_TAC LOCAL_FAN_IMP_IN_V; +ASM_REWRITE_TAC[]; +MP_TAC2 Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN; +NHANH FAN_IMP_V_DIFF; +STRIP_TAC; +UNDISCH_TAC ` v':real^3 IN V `; +UNDISCH_TAC ` u:real^3 IN V `; +FIRST_X_ASSUM NHANH; +SET_TAC[]; + + + +STRIP_TAC; +SUBGOAL_THEN ` ~(b IN aff {vec 0, v':real^3}) ` MP_TAC; +DOWN THEN DOWN; +NHANH AFF2_ITR_CONV0_IMP_SAME_ENDS; +SIMP_TAC[]; + + + +DOWN THEN PHA; +REWRITE_TAC[SET_RULE` ~( a IN X) /\ ~( b IN X ) <=> {a,b} INTER X = {}`]; +STRIP_TAC; +MP_TAC (SPECL [`E:(real^3 -> bool) -> bool `;` V:real^3 -> bool`; +` FF: real^3 #real^3 -> bool `;` v':real^3 ` ;`A:real^3 -> bool`;` a:real^3 `; +` b:real^3 `] (GEN_ALL OZQVSFF)); +ANTS_TAC; +SUBGOAL_THEN` {a,b} SUBSET (V:real^3 -> bool) ` MP_TAC; + + + +UNDISCH_TAC` {a, b} SUBSET {u, v, w:real^3}`; +MATCH_MP_TAC (SET_RULE` B SUBSET C ==> A SUBSET B ==> A SUBSET C `); +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +MATCH_MP_TAC LOCAL_FAN_IMP_IN_V; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` v':real^3 IN V `; +UNDISCH_TAC ` (V:real^3 -> bool) SUBSET A `; +SIMP_TAC[INSERT_SUBSET]; +REWRITE_TAC[SUBSET]; +DISCH_THEN NHANH; +ASM_SIMP_TAC[]; +DOWN THEN PHA THEN REMOVE_TAC; +DOWN THEN SIMP_TAC[INSERT_COMM]; +SET_TAC[]; +SIMP_TAC[]]);; + + +(* ========================================================= *) +(* JULY *) + +let CONVEX_SOME_WEDGE = prove(`~collinear {v0, v1, w1} /\ + ~collinear {v0, v1, w2} /\ + &0 < azim v0 v1 w1 w2 /\ + azim v0 v1 w1 w2 < pi +==> convex ( wedge v0 v1 w1 w2 ) `, +SIMP_TAC[WEDGE_LUNE_GT; CONVEX_AFF_GT]);; + + + + +let AZIM_EQ_0_GE_ALT2 = prove_by_refinement +(` !v0 v1 w x. + ~collinear {v0, v1, w} + ==> (azim v0 v1 w x = &0 <=> x IN aff_ge {v0, v1} {w}) `, +[REPEAT STRIP_TAC; +ASM_CASES_TAC` ~ collinear {v0,v1,x:real^3} `; +DOWN_TAC; +REWRITE_TAC[AZIM_EQ_0_GE_ALT]; +DOWN; +SIMP_TAC[AZIM_DEGENERATE]; +DOWN; +NHANH Fan.th3a; +NHANH Topology.aff_subset_aff_ge; +NHANH Fan.th3b; +SIMP_TAC[GSYM Trigonometry2.NOT_EQ_IMP_AFF_AND_COLL3]; +SET_TAC[]]);; + + + + + +let WEDGE_GE_EQ_AFF_GE = prove_by_refinement +(` azim v0 v1 w1 w2 < pi /\ ~ collinear {v0,v1,w1} /\ ~ collinear {v0,v1,w2} + ==> wedge_ge v0 v1 w1 w2 = aff_ge {v0, v1} {w1,w2} `, +[ASM_SIMP_TAC[wedge_ge]; +NHANH Fan.th3b1; +ONCE_REWRITE_TAC[INSERT_COMM]; +NHANH Fan.th3b1; +STRIP_TAC; +SUBGOAL_THEN` DISJOINT {v1,v0} {w2,w1:real^3}` ASSUME_TAC; +ASM SET_TAC[]; +SUBGOAL_THEN ` aff_ge {v0,v1} {w1} SUBSET aff_ge {v0,v1} {w1,w2:real^3}` ASSUME_TAC; +MATCH_MP_TAC AFF_GE_MONO_RIGHT; +DOWN THEN SET_TAC[]; + + + +ASM_CASES_TAC` azim v0 v1 w1 w2 = &0 `; + +ASM_SIMP_TAC[IN_ELIM_THM; REAL_LE_ANTISYM; REAL_ARITH` &0 = a <=> a = &0`]; +DOWN; +UNDISCH_TAC` ~ collinear {v1,v0,w1:real^3 }`; +ONCE_REWRITE_TAC[INSERT_COMM]; +ASM_SIMP_TAC[AZIM_EQ_0_GE_ALT2; GSYM SUBSET_ANTISYM_EQ; SET_RULE` {x| x IN S } = S `]; + + +(* *) +SUBGOAL_THEN` DISJOINT {v0,v1} {w1: real^3}` MP_TAC; +DOWN THEN SET_TAC[]; +DOWN THEN DOWN; +SIMP_TAC[Collect_geom.simp_def2; AFF_GE22; INSERT_COMM]; +REWRITE_TAC[IN_ELIM_THM; SUBSET]; +REPEAT STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +STRIP_TAC; +EXISTS_TAC ` aa + yy * ta `; +EXISTS_TAC ` bb + yy * tb `; +EXISTS_TAC ` xx + yy * t `; +ASM_REWRITE_TAC[REAL_ARITH` (aa + yy * ta) + (bb + yy * tb) + xx + yy * t = +aa + bb + xx + yy * ( ta + tb + t ) `; REAL_MUL_RID]; + + +CONJ_TAC; +MATCH_MP_TAC REAL_LE_ADD; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC REAL_LE_MUL; +ASM_REWRITE_TAC[]; +CONV_TAC VECTOR_ARITH; +MP_TAC (SPECL [`v0:real^3 `;` v1:real^3 `;`w1:real^3 `;` w2:real^3 `] AZIM_RANGE); +ASM_REWRITE_TAC[REAL_ARITH` &0 <= a <=> a = &0 \/ &0 < a `]; +STRIP_TAC; +DOWN_TAC THEN SIMP_TAC[INSERT_COMM]; +STRIP_TAC; +ASSUME_TAC2 WEDGE_LUNE_GT; + + + +REWRITE_TAC[EXTENSION; IN_ELIM_THM]; +GEN_TAC; +EQ_TAC; +ASM_SIMP_TAC[AZIM_EQ_0_GE_ALT2]; +STRIP_TAC; +UNDISCH_TAC ` x IN aff_ge {v0, v1} {w1:real^3}`; +UNDISCH_TAC ` aff_ge {v0, v1} {w1} SUBSET aff_ge {v0, v1} {w1, w2:real^3}`; +REWRITE_TAC[SUBSET]; +DISCH_THEN NHANH; +SIMP_TAC[]; + +DOWN; +REWRITE_TAC[REAL_ARITH` a <= b <=> a = b \/ a < b `]; +SUBGOAL_THEN` ~ collinear {v0,v1,x:real^3} ` ASSUME_TAC; +STRIP_TAC; +UNDISCH_TAC ` &0 < azim v0 v1 w1 x `; +DOWN; +SIMP_TAC[AZIM_DEGENERATE]; +DISCH_TAC; +REAL_ARITH_TAC; + + + +STRIP_TAC; +DOWN; +ASM_SIMP_TAC[AZIM_EQ_ALT]; +STRIP_TAC; + +SUBGOAL_THEN ` aff_ge {v0,v1} {w2} SUBSET aff_ge {v0,v1} {w1,w2:real^3} ` ASSUME_TAC; +MATCH_MP_TAC AFF_GE_MONO_RIGHT; +ASM_REWRITE_TAC[]; +SET_TAC[]; +DOWN; +REWRITE_TAC[SUBSET]; +DISCH_THEN MATCH_MP_TAC; +MP_TAC (ISPECL [`{v0,v1:real^3} `;` {w2:real^3} `] AFF_GT_SUBSET_AFF_GE); +REWRITE_TAC[SUBSET]; +DISCH_THEN MATCH_MP_TAC; +DOWN THEN SIMP_TAC[]; + +SUBGOAL_THEN` x IN wedge v0 v1 w1 w2 ` ASSUME_TAC; +REWRITE_TAC[wedge; IN_ELIM_THM]; +DOWN THEN DOWN THEN DOWN THEN PHA; +SIMP_TAC[]; +DOWN; +MATCH_MP_TAC (SET_RULE` a SUBSET b ==> x IN a ==> x IN b `); +ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]; + +ASM_SIMP_TAC[AFF_GE22; IN_ELIM_THM]; +STRIP_TAC; +ASM_CASES_TAC ` yy = &0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; + +UNDISCH_TAC` ~collinear {v0, v1, w1:real^3}`; +NHANH AZIM_EQ_0_GE_ALT2; +STRIP_TAC; +SUBGOAL_THEN ` azim v0 v1 w1 x = &0 ` ASSUME_TAC; +FIRST_X_ASSUM SUBST1_TAC; +ASSUME_TAC2 (SET_RULE` DISJOINT {v0, v1} {w1, w2} ==> DISJOINT {v0,v1} {w1:real^3} `); +DOWN; +SIMP_TAC[Collect_geom.simp_def2]; +ASM_REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC` aa:real `; +EXISTS_TAC ` bb:real `; +EXISTS_TAC ` xx:real `; +ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID]; +UNDISCH_TAC ` aa + bb + xx + &0 = &1 `; +REAL_ARITH_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +REWRITE_TAC[AZIM_RANGE]; + + + +ASM_CASES_TAC` collinear {v0,v1,x:real^3} `; +DOWN; +SIMP_TAC[AZIM_DEGENERATE; AZIM_RANGE]; + + +ASM_CASES_TAC ` xx = &0 `; +SUBGOAL_THEN ` azim v0 v1 w1 x = azim v0 v1 w1 w2 ` ASSUME_TAC; +SUBGOAL_THEN ` azim v0 v1 w1 x = azim v0 v1 w1 w2 <=> x IN aff_gt {v0,v1} {w2}` SUBST1_TAC; +MATCH_MP_TAC AZIM_EQ_ALT; +ASM_REWRITE_TAC[]; +MP_TAC2 (SET_RULE` DISJOINT {v0,v1} {w1,w2} ==> DISJOINT {v0,v1} {w2:real^3}`); +SIMP_TAC[AFF_GT_2_1; IN_ELIM_THM]; +REMOVE_TAC; +EXISTS_TAC ` aa: real`; +EXISTS_TAC` bb:real `; +EXISTS_TAC ` yy:real `; +ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID]; +FIRST_X_ASSUM SUBST_ALL_TAC; +UNDISCH_TAC ` &0 <= yy `; +UNDISCH_TAC ` ~( yy = &0 ) `; +UNDISCH_TAC ` aa + bb + &0 + yy = &1 `; +REAL_ARITH_TAC; +ASM_REWRITE_TAC[REAL_LE_REFL]; +SUBGOAL_THEN` x IN wedge v0 v1 w1 w2 ` ASSUME_TAC; +ASM_SIMP_TAC[Planarity.AFF_GT_2_2; IN_ELIM_THM]; +EXISTS_TAC ` aa:real ` ; +EXISTS_TAC ` bb:real`; +EXISTS_TAC ` xx:real ` ; +EXISTS_TAC` yy:real`; +ASM_REWRITE_TAC[REAL_ARITH` a < b <=> ~( b = a ) /\ a <= b `]; +DOWN; +REWRITE_TAC[wedge; IN_ELIM_THM]; +IMP_TAC; +REMOVE_TAC; +REAL_ARITH_TAC]);; + + + + + + + +let AZIM_PI_WEDGE_GE_SIN = prove_by_refinement(` azim u v w ww = pi ==> +wedge_ge u v w ww = {x| &0 <= sin (azim u v w x ) } `, +[REWRITE_TAC[wedge_ge; EXTENSION; IN_ELIM_THM]; + +ONCE_REWRITE_TAC[GSYM (SPEC ` -- (u:real^3) ` AZIM_TRANSLATION)]; + +REWRITE_TAC[VECTOR_ARITH` -- a + (a:real^N) = vec 0`;VECTOR_ARITH` -- a + b = b - a:real^N `; re_eqvl]; +REPEAT STRIP_TAC; +ASM_REWRITE_TAC[]; +EQ_TAC; +REWRITE_TAC[SIN_POS_PI_LE]; +MP_TAC (SPECL [`u - u:real^3 `;` v - u:real^3 `;` w - u:real^3 `; +` x - u:real^3 `] AZIM_RANGE); +STRIP_TAC; +ASM_CASES_TAC ` azim (u - u) (v - u) (w - u) (x - u) <= pi `; +ASM_REWRITE_TAC[]; +ABBREV_TAC ` goc = azim (u - u) (v - u) (w - u) (x - u) `; +STRIP_TAC; +SUBGOAL_THEN` sin goc < &0 ` MP_TAC; +ONCE_REWRITE_TAC[SIN_SUB_PERIODIC]; +REWRITE_TAC[REAL_ARITH` -- a < &0 <=> &0 < a `]; +MATCH_MP_TAC SIN_POS_PI; +ASM_REWRITE_TAC[REAL_ARITH` a - b < b <=> a < &2 * b `;REAL_ARITH` &0 < a - pi <=> ~( a <= pi ) `]; +DOWN; +REAL_ARITH_TAC]);; + + + + + +let AZIM_PI_WEDGE_GE_CROSS_DOT = prove_by_refinement(` azim u v w ww = pi ==> +wedge_ge u v w ww = {x | &0 <= ((v - u) cross ( w - u )) dot ( x - u )}`, +[SIMP_TAC[AZIM_PI_WEDGE_GE_SIN; EXTENSION; IN_ELIM_THM]; +REPEAT STRIP_TAC; +ONCE_REWRITE_TAC[GSYM (SPEC ` -- (u:real^3) ` AZIM_TRANSLATION)]; +REWRITE_TAC[VECTOR_ARITH` -- a + a:real^N = vec 0 `; VECTOR_ARITH` -- a + x = x - a:real^N `]; +MP_TAC (SPECL [` v - u:real^3 `;` w - u:real^3 `;` x - u:real^3 `] Trigonometry2.JBDNJJB); +REWRITE_TAC[re_eqvl]; +STRIP_TAC; +ASM_REWRITE_TAC[VECTOR_SUB_REFL]; +ASM_SIMP_TAC[REAL_LE_MUL_EQ]]);; + + + + +let AZIM_PI_CONVEX_WEDGE = prove_by_refinement(` azim u v w ww = pi + ==> convex (wedge_ge u v w ww) `, +[SIMP_TAC[AZIM_PI_WEDGE_GE_CROSS_DOT; convex; IN_ELIM_THM]; +REPEAT STRIP_TAC; +ONCE_REWRITE_TAC[VECTOR_ARITH` (u' % x + v' % y) = u' % ( x - u ) + +v' % (y - u ) + (u' + v') % u `]; +ASM_REWRITE_TAC[VECTOR_MUL_LID; VECTOR_ARITH ` ( a + c + b ) - b = (a:real^N) + c `; DOT_RADD; DOT_RMUL]; +MATCH_MP_TAC REAL_LE_ADD; +CONJ_TAC; +MATCH_MP_TAC REAL_LE_MUL; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC REAL_LE_MUL; +ASM_REWRITE_TAC[]]);; + + + + + +let CONVEX_WEDGE_LE_PI = prove(` azim v0 v1 w1 w2 <= pi /\ + ~collinear {v0, v1, w1} /\ + ~collinear {v0, v1, w2} + ==> convex ( wedge_ge v0 v1 w1 w2 )`, +ASM_CASES_TAC ` azim v0 v1 w1 w2 = pi ` THENL [ +ASM_SIMP_TAC[AZIM_PI_CONVEX_WEDGE]; +ASM_SIMP_TAC[REAL_ARITH` ~( a = b ) ==> ( a <= b <=> a < b )`]] THEN +NHANH WEDGE_GE_EQ_AFF_GE THEN SIMP_TAC[CONVEX_AFF_GE]);; + + + + + + +let wedge_in_fan_ge2 = prove(` wedge_in_fan_ge x E = + (if CARD (EE (FST x) E) > 1 + then wedge_ge (vec 0) (FST x ) (SND x ) (azim_cycle (EE (FST x) E) (vec 0) (FST x ) (SND x ) ) + else {x | T}) `, +PAT_ONCE_REWRITE_TAC `\x. x = y ` [GSYM PAIR] +THEN REWRITE_TAC[wedge_in_fan_ge]);; + + + + + +let azim_in_fan2 = prove(` azim_in_fan x E = + (let d = azim_cycle (EE ( FST x ) E) (vec 0) (FST x ) (SND x ) in + if CARD (EE (FST x ) E) > 1 then azim (vec 0) (FST x ) (SND x) d else &2 * pi) `, +PAT_ONCE_REWRITE_TAC `\x. x = y ` [GSYM PAIR] +THEN REWRITE_TAC[azim_in_fan]);; + + + + +let LOFA_IMP_NOT_INCLUDE_VEC0 = prove( +` local_fan (V,E,FF) ==> ~( vec 0 IN V ) `, +NHANH Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN THEN NHANH FAN_IMP_V_DIFF +THEN STRIP_TAC THEN DOWN THEN SET_TAC[]);; + + + + + +let AZIM_SPEC_DEGENERATE = prove( +` azim v0 v1 w1 v0 = &0 /\ azim v0 v1 w1 v1 = &0 `, +SUBGOAL_THEN ` collinear {v0, v1, v0} /\ collinear {v0,v1,v1:real^3} ` MP_TAC +THENL [SIMP_TAC[INSERT_INSERT; INSERT_COMM; COLLINEAR_2]; +SIMP_TAC[AZIM_DEGENERATE]]);; + + + + + + +let CONDS_IN_CONV2 = prove_by_refinement +(` &0 <= t2 /\ &0 <= t3 /\ ~( t2 = &0 /\ t3 = &0) +==> t2 / (t2 + t3) % v + t3 / (t2 + t3) % w IN conv {v, w} `, +[STRIP_TAC; +SUBGOAL_THEN ` ~( t2 + t3 = &0 ) ` ASSUME_TAC; +DOWN_TAC; +REAL_ARITH_TAC; +REWRITE_TAC[Collect_geom.CONV_SET2; IN_ELIM_THM]; +EXISTS_TAC ` t2 / (t2 + t3 ) `; +EXISTS_TAC ` t3 / (t2 + t3 ) `; +CONJ_TAC; +MATCH_MP_TAC REAL_LE_DIV; +DOWN_TAC THEN REAL_ARITH_TAC; +CONJ_TAC; +MATCH_MP_TAC REAL_LE_DIV; +DOWN_TAC THEN REAL_ARITH_TAC; +ASM_SIMP_TAC[GSYM Geomdetail.SUM_TWO_RATIO]]);; + + + + + + + + + +let PGSQVBL = prove_by_refinement +(` convex_local_fan (V,E,FF) /\ {v,w} SUBSET V /\ x IN FF ==> +aff_ge {vec 0} {v,w} SUBSET wedge_in_fan_ge x E `, +[REWRITE_TAC[convex_local_fan]; +STRIP_TAC; +DOWN; +FIRST_X_ASSUM NHANH; +REWRITE_TAC[azim_in_fan2; wedge_in_fan_ge2]; +LET_TAC; +STRIP_TAC; +SUBGOAL_THEN ` FST (x:real^3 # real^3) IN V /\ SND x IN V ` MP_TAC; +MATCH_MP_TAC LOCAL_FAN_IMP_IN_V; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASSUME_TAC2 (SPEC `FST (x:real^3 # real^3 ) ` (GEN `v:real^3 ` LOFA_CARD_EE_V_1)); +UNDISCH_TAC` (if CARD (EE (FST x) E) > 1 + then azim (vec 0) (FST x) (SND x) d + else &2 * pi) <= + pi `; +UNDISCH_TAC` V SUBSET + (if CARD (EE (FST x) E) > 1 + then wedge_ge (vec 0) (FST x) (SND x) d + else {x | T}) `; +PHA; +ASM_SIMP_TAC[ARITH_RULE` a = 2 ==> a > 1 `]; +ASSUME_TAC2 (SPEC ` FST (x:real^3 #real^3 ) ` (GEN `v:real^3 ` EXISTS_INVERSE_OF_V)); +DOWN THEN STRIP_TAC; +MP_TAC2 (SPEC ` FST (x:real^3 # real^3) ` (GEN `v:real^3 ` LOFA_IMP_EE_TWO_ELMS)); +DISCH_THEN SUBST_ALL_TAC; +SUBGOAL_THEN ` rho_node1 FF (FST x) = SND (x:real^3 # real^3) ` ASSUME_TAC; +MATCH_MP_TAC DETER_RHO_NODE; +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` azim_cycle {rho_node1 FF (FST x), vv} (vec 0) (FST x) (SND x) = d `; +ASM_REWRITE_TAC[AZIM_CYCLE_TWO_POINT_SET]; +MP_TAC2 LOCAL_FAN_RHO_NODE_PROS2; +REPEAT STRIP_TAC; +UNDISCH_TAC` vv:real^3 IN V `; +FIRST_X_ASSUM NHANH; +STRIP_TAC; +DOWN; +UNDISCH_TAC ` local_fan (V,E,FF) `; +PHA; +NHANH LOCAL_FAN_IN_FF_NOT_COLLINEAR; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASSUME_TAC2 LOCAL_FAN_IN_FF_NOT_COLLINEAR; +SUBGOAL_THEN ` conv {v,w:real^3} SUBSET wedge_ge (vec 0) (FST x) (SND x) d ` ASSUME_TAC; +SUBGOAL_THEN ` convex (wedge_ge (vec 0) (FST x ) (SND x ) d) ` ASSUME_TAC; +MATCH_MP_TAC CONVEX_WEDGE_LE_PI; +ASM_SIMP_TAC[]; +UNDISCH_TAC` ~ collinear {vec 0, d, FST (x:real^3 # real^3)}`; +SIMP_TAC[INSERT_COMM]; +MATCH_MP_TAC Geomdetail.CONVEX_IM_CONV2_SU; +ASM_REWRITE_TAC[SET_RULE` a IN S /\ b IN S <=> {a,b} SUBSET S `]; +MATCH_MP_TAC SUBSET_TRANS; +EXISTS_TAC` V:real^3 -> bool `; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN ` DISJOINT {vec 0} {v,w:real^3} ` MP_TAC; +MP_TAC2 LOFA_IMP_NOT_INCLUDE_VEC0; +UNDISCH_TAC` {v,w:real^3} SUBSET V `; +SET_TAC[]; + +SIMP_TAC[Fan.AFF_GE_1_2; SUBSET; IN_ELIM_THM]; +REPEAT STRIP_TAC; +ASM_CASES_TAC ` t2 = &0 /\ t3 = &0 `; +ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_MUL_RZERO; VECTOR_ADD_LID; wedge_ge; IN_ELIM_THM]; +REWRITE_TAC[AZIM_SPEC_DEGENERATE; AZIM_RANGE; REAL_LE_REFL]; +SUBGOAL_THEN ` (t2 / ( t2 + t3)) % v + ( t3 / ( t2 + t3 )) % w IN conv {v,w:real^3}` ASSUME_TAC; +MATCH_MP_TAC CONDS_IN_CONV2; +ASM_REWRITE_TAC[]; +DOWN; +UNDISCH_TAC ` conv {v, w} SUBSET wedge_ge (vec 0) (FST x) (SND x) d `; +REWRITE_TAC[SUBSET]; +DISCH_THEN NHANH; +ABBREV_TAC `p = t2 / (t2 + t3) % v + t3 / (t2 + t3) % (w:real^3) `; +SUBGOAL_THEN ` x' = t1 % (vec 0) + (&0) % (FST (x:real^3 # real^3)) + (t2 + t3 ) % (p:real^3) ` ASSUME_TAC; +ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +EXPAND_TAC "p"; +REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC]; +MP_TAC2 (REAL_ARITH` &0 <= t2 /\ &0 <= t3 /\ ~( t2 = &0 /\ t3 = &0) +==> ~( t2 + t3 = &0) `); +SIMP_TAC[REAL_FIELD` ~( t = &0 ) ==> t * a / t = a `]; +ASM_CASES_TAC ` collinear {vec 0, FST (x:real^3 # real^3), p}`; +DOWN; +ASSUME_TAC2 LOFA_IMP_NOT_INCLUDE_VEC0; +SUBGOAL_THEN` ~( FST (x:real^3 # real^3 ) = vec 0 ) ` ASSUME_TAC; +UNDISCH_TAC ` FST (x:real^3 # real^3 ) IN V `; +DOWN; +SET_TAC[]; +ASM_SIMP_TAC[COLLINEAR_LEMMA_ALT]; +STRIP_TAC; +SUBGOAL_THEN ` collinear {vec 0, FST (x:real^3 # real^3), x'}` MP_TAC; +SIMP_TAC[COLLINEAR_LEMMA_ALT]; +DISJ2_TAC; +EXISTS_TAC ` (t2 + t3) * c `; +UNDISCH_TAC` x' = t1 % vec 0 + &0 % FST (x:real^3 # real^3) + (t2 + t3) % (p:real^3)`; +SIMP_TAC[]; +ASM_REWRITE_TAC[]; +DISCH_TAC; +VECTOR_ARITH_TAC; + +UNDISCH_TAC` x' = t1 % vec 0 + t2 % v + t3 % (w:real^3) `; +DISCH_THEN (SUBST1_TAC o SYM); +SIMP_TAC[AZIM_DEGENERATE; wedge_ge; IN_ELIM_THM; AZIM_RANGE; REAL_LE_REFL]; + +REWRITE_TAC[wedge_ge; IN_ELIM_THM]; +SUBGOAL_THEN` azim (vec 0) (FST x) (SND x) p = azim (vec 0) (FST x) (SND x) x'` SUBST1_TAC; +UNDISCH_TAC` x' = t1 % vec 0 + &0 % FST (x:real^3 # real^3) + (t2 + t3) % p`; +SIMP_TAC[]; +DISCH_TAC; +MATCH_MP_TAC Topology.th1; +ASSUME_TAC2 (REAL_ARITH` &0 <= t2 /\ &0 <= t3 /\ ~( t2 = &0 /\ t3 = &0 ) ==> t2 + t3 > &0 `); + +ASM_REWRITE_TAC[REAL_ADD_LID]; +ASM_SIMP_TAC[Fan.th3a]; +SIMP_TAC[]]);; + +(* begin new lemma *) +(* =============== *) +(* =============== *) + + + + +let FST_EQ_IF_SAME_SND = prove_by_refinement +(` local_fan (V,E,FF) /\ (w1,v) IN FF /\ (w2,v) IN FF +==> w1 = w2`, +[NHANH LOFA_IMP_BIJ_VV; +STRIP_TAC; +SUBGOAL_THEN` {w1,w2,v} SUBSET (V:real^3 -> bool) ` ASSUME_TAC; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +ASM_MESON_TAC[LOCAL_FAN_IMP_IN_V]; + +SUBGOAL_THEN` rho_node1 FF w1 = v /\ rho_node1 FF w2 = v ` ASSUME_TAC; +ASM_MESON_TAC[DETER_RHO_NODE]; +DOWN_TAC; +REWRITE_TAC[BIJ; INJ; INSERT_SUBSET]; +MESON_TAC[]]);; + + + + + +let PRE_IVS_RHO_NODE1_DETE = prove_by_refinement +(` local_fan (V,E,FF) /\ (vv,v) IN FF +==> (@a. a,v IN FF) = vv `, +[STRIP_TAC; MATCH_MP_TAC RHO_NODE_INVERSE_POINT; +ASM_REWRITE_TAC[]; REPEAT STRIP_TAC; +MATCH_MP_TAC FST_EQ_IF_SAME_SND; ASM_REWRITE_TAC[]]);; + + +let IVS_RHO_NODE1_DETE = prove(` local_fan (V,E,FF) /\ (vv,v) IN FF +==> ivs_rho_node1 FF v = vv`, +REWRITE_TAC[PRE_IVS_RHO_NODE1_DETE; ivs_rho_node1]);; + + + + +let AZIM_EQ_0_SYM2 = prove(`! w1 w2. azim v0 v1 w1 w2 = &0 <=> azim v0 v1 w2 w1 = &0 `, +REWRITE_TAC[MESON[]` (! x y. P x y <=> P y x ) <=> (! x y. P x y ==> P y x )`] THEN +MESON_TAC[AZIM_EQ_0_SYM; AZIM_DEGENERATE]);; + + + +let LOCAL_FAN_IN_FF_IN_ORD_PAIRS2 = +prove(`local_fan (V,E,FF) /\ x,y IN FF ==> {x,y} IN E `, +NHANH LOCAL_FAN_IN_FF_IN_ORD_PAIRS THEN +SIMP_TAC[Wrgcvdr_cizmrrh.IN_E_IFF_IN_ORD_E]);; + + + + + + +let INTERIOR_ANGLE1_POS = prove_by_refinement +(` local_fan (V,E,FF) /\ v IN V ==> &0 < interior_angle1 (vec 0) FF v `, +[ASM_CASES_TAC` interior_angle1 (vec 0) FF v = &0 `; +DOWN; +REWRITE_TAC[interior_angle1]; +NHANH EXISTS_INVERSE_OF_V; +REPEAT STRIP_TAC; +MP_TAC2 LOCAL_FAN_RHO_NODE_PROS2; +STRIP_TAC; +UNDISCH_TAC` vv:real^3 IN V `; +UNDISCH_TAC ` v:real^3 IN V `; +FIRST_X_ASSUM NHANH; +STRIP_TAC THEN STRIP_TAC; +SUBGOAL_THEN` (@a. a,v IN (FF:real^3 # real^3 -> bool)) = vv ` ASSUME_TAC; +MATCH_MP_TAC PRE_IVS_RHO_NODE1_DETE; +DOWN; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM SUBST_ALL_TAC; +ABBREV_TAC ` vc = rho_node1 FF v `; +SUBGOAL_THEN ` vv = vc:real^3 ` ASSUME_TAC; +MATCH_MP_TAC Fan.UNIQUE_AZIM_POINT_FAN; +EXISTS_TAC ` vec 0:real^3 `; +EXISTS_TAC `V:real^3 -> bool` ; +EXISTS_TAC ` E: (real^3 -> bool) -> bool `; +EXISTS_TAC ` v:real^3 `; +EXISTS_TAC `vv:real^3 `; +UNDISCH_TAC` azim (vec 0) v vc vv = &0 `; +ONCE_REWRITE_TAC[AZIM_EQ_0_SYM2]; +SIMP_TAC[AZIM_REFL]; + +MP_TAC2 Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN; +STRIP_TAC THEN STRIP_TAC; + +ASM_MESON_TAC[LOCAL_FAN_IN_FF_IN_ORD_PAIRS2; INSERT_COMM]; +ASM_MESON_TAC[LOCAL_FAN_IMP_NOT_SEMI_IDE]; +REMOVE_TAC; +DOWN; +REWRITE_TAC[interior_angle1]; +MP_TAC (SPECL [`vec 0:real^3 `;` v:real^3 `;` rho_node1 FF v `; +` (@a. a,v IN (FF:real^3 # real^3 -> bool))`] AZIM_RANGE); +REAL_ARITH_TAC]);; + +(* ======================================================================== *) + + +let FAN_IMP_NOT_IN_AFF_GE = prove_by_refinement +(` FAN (x:real^N,V,E) /\ {v, w} SUBSET V /\ ~( v = w) +==> ~ ( v IN aff_ge {x} {w} ) `, +[NHANH FAN_IMP_V_DIFF; +REWRITE_TAC[FAN; fan7]; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPECL [`{v:real^N}`;`{w:real^N}`])); +ANTS_TAC; +REWRITE_TAC[IN_UNION; IN_ELIM_THM]; +UNDISCH_TAC` {v, w:real^N} SUBSET V`; +SET_TAC[]; +ASM_SIMP_TAC[SET_RULE` ~( a = b ) ==> {a} INTER {b} = {} `; +AFFINE_HULL_SING; AFF_GE_EQ_AFFINE_HULL]; +STRIP_TAC; +MP_TAC (ISPECL [`x:real^N`;` v:real^N`] (CONJUNCT2 ENDS_IN_HALFLINE)); +DOWN THEN DOWN; +REMOVE_TAC; +DOWN; +REWRITE_TAC[INSERT_SUBSET]; +FIRST_ASSUM NHANH; +SET_TAC[]]);; + + + + + + +let IN_AFF_LT_IMP_IN_CONV = prove_by_refinement +(`DISJOINT {x:real^N} {b} /\ a IN aff_lt {x} {b} ==> x IN conv0 {a,b} `, +[IMP_TAC; +SIMP_TAC[AFF_LT_1_1; IN_ELIM_THM]; +REPEAT STRIP_TAC; +DOWN; +ONCE_REWRITE_TAC[VECTOR_ARITH` a = x % b + y % c <=> x % b = a + (-- y) % c`]; +ASSUME_TAC2 (REAL_ARITH` t2 < &0 /\ t1 + t2 = &1 ==> ~(t1 = &0 )`); +ASM_SIMP_TAC[Ldurdpn.VECTOR_SCALE_CHANGE]; +ASSUME_TAC2 (REAL_ARITH` t2 < &0 /\ t1 + t2 = &1 ==> &0 < t1`); +REWRITE_TAC[VECTOR_ADD_LDISTRIB;REAL_ARITH` &1 / a * b = b / a `; + VECTOR_MUL_ASSOC; Collect_geom.CONV0_SET2; IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC` &1 / t1 `; +EXISTS_TAC ` ( -- t2 ) / t1 `; +CONJ_TAC; +MATCH_MP_TAC REAL_LT_DIV; +ASM_REWRITE_TAC[]; +REAL_ARITH_TAC; +CONJ_TAC; +MATCH_MP_TAC REAL_LT_DIV; +ASM_REWRITE_TAC[REAL_ARITH` &0 < -- a <=> a < &0 `]; +REWRITE_TAC[]; +UNDISCH_TAC` t1 + t2 = &1 `; +UNDISCH_TAC ` ~( t1 = &0 ) `; +CONV_TAC REAL_FIELD]);; + + + +let FAN_SUB_NOT_EQ_COLL_IN_CONV0 = prove_by_refinement +(` FAN (x,V,E) /\ {v:real^N, w} SUBSET V /\ ~(v = w) /\ + collinear {x, v, w} ==> x IN (conv0 {v,w}) `, +[REWRITE_TAC[COLLINEAR_3_EXPAND]; +NHANH FAN_IMP_V_DIFF; +STRIP_TAC; +UNDISCH_TAC ` {v, w:real^N} SUBSET V`; +REWRITE_TAC[INSERT_SUBSET]; +ASM_MESON_TAC[]; +ASM_CASES_TAC ` &0 <= &1 - u `; +SUBGOAL_THEN` v IN aff_ge {x} {w:real^N}` ASSUME_TAC; +REWRITE_TAC[HALFLINE; IN_ELIM_THM]; +EXISTS_TAC ` &1 - u `; +ASM_REWRITE_TAC[REAL_ARITH` a - ( a - b ) = b `]; +MP_TAC2 FAN_IMP_NOT_IN_AFF_GE; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC IN_AFF_LT_IMP_IN_CONV; +SUBGOAL_THEN` DISJOINT {x} {w:real^N}` ASSUME_TAC; +ASM SET_TAC[]; + +ASM_SIMP_TAC[AFF_LT_1_1; IN_ELIM_THM]; +EXISTS_TAC` u:real`; +EXISTS_TAC` &1 - u `; +ASM_REWRITE_TAC[REAL_ARITH` a + b - a = b `;REAL_ARITH`b < a <=> ~( a <= b ) `]]);; + + + + + +let IN_CONV_LINE_SEPERATABLE = prove_by_refinement +(` x IN conv0 {a,b:real^N} ==> aff {a,b} = aff_ge {x} {a} UNION aff_ge {x} {b} `, +[REWRITE_TAC[Collect_geom.CONV0_SET2; IN_ELIM_THM; EXTENSION]; +STRIP_TAC THEN GEN_TAC; +EQ_TAC; +REWRITE_TAC[Collect_geom.AFF_2POINTS_INTERPRET; IN_ELIM_THM]; +STRIP_TAC; +ASSUME_TAC2 (REAL_ARITH` ta + tb = &1 /\ a' + b' = &1 ==> ta <= a' \/ tb <= b' `); +DOWN_TAC; +DAO; +SPEC_TAC (`ta:real`,`ta:real`); +SPEC_TAC (`tb:real`,`tb:real`); +SPEC_TAC (`a':real`,`a':real`); +SPEC_TAC (`b':real`,`b':real`); +SPEC_TAC (`a:real^N`,`a:real^N`); +SPEC_TAC (`b:real^N`,`b:real^N`); +MATCH_MP_TAC (MESON[]`(! x y a b aa bb. P x y a b aa bb ==> P y x b a bb aa) /\ +(! x y. L x y ==> L y x ) /\ (! x y a b aa bb. bb <= b /\ P x y a b aa bb ==> L x y ) ==> (! x y a b aa bb. (bb <= b \/ aa <= a ) /\ P x y a b aa bb ==> L x y ) `); + +SIMP_TAC[UNION_COMM; VECTOR_ADD_SYM; REAL_ADD_SYM]; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[]; +REPEAT STRIP_TAC; + + +REWRITE_TAC[IN_UNION; IN_ELIM_THM; HALFLINE]; +DISJ2_TAC; +EXISTS_TAC` tb - ( ta / a' ) * b' `; +CONJ_TAC; +SUBGOAL_THEN` ta / a' <= &1 ` ASSUME_TAC; +MATCH_MP_TAC Trigonometry2.REAL_LE_LDIV; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` ta / a' * b' <= b' ` ASSUME_TAC; +REWRITE_TAC[REAL_ARITH` a * b <= b <=> &0 <= ( &1 - a ) * b `]; +MATCH_MP_TAC REAL_LE_MUL; +DOWN THEN DOWN THEN REAL_ARITH_TAC; +ASM_REAL_ARITH_TAC; +EXPAND_TAC "x"; +EXPAND_TAC "x'"; +REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; VECTOR_ARITH` ( a + b % x ) + c % x = a + ( b + c ) % x `]; +MATCH_MP_TAC (MESON[]` a = aa /\ b = bb ==> a % x + b % y = aa % x + bb % y `); +CONJ_TAC; +REPLICATE_TAC 4 DOWN; +REMOVE_TAC; +DOWN THEN DOWN; +REMOVE_TAC; +DOWN; +PHA; +CONV_TAC REAL_FIELD; + + +REPLICATE_TAC 4 DOWN; +REMOVE_TAC; +DOWN THEN DOWN; +REMOVE_TAC; +DOWN; +PHA; +CONV_TAC REAL_FIELD; + +SPEC_TAC (`x':real^N`,`x':real^N`); +REWRITE_TAC[GSYM SUBSET; UNION_SUBSET]; +SUBGOAL_THEN ` x:real^N IN aff {a,b}` ASSUME_TAC; +REWRITE_TAC[Collect_geom.AFF_2POINTS_INTERPRET; IN_ELIM_THM]; +EXISTS_TAC` a':real`; +EXISTS_TAC `b':real`; +ASM_REWRITE_TAC[]; +ASSUME_TAC (ISPECL [` a:real^N`;`b:real^N`] Planarity.POINT_IN_LINE); +ASSUME_TAC (ISPECL [` b:real^N`;`a:real^N`] Planarity.POINT_IN_LINE); +MP_TAC (ISPECL [`x:real^N`;` a:real^N`] HALFLINE_SUBSET_AFFINE_HULL); +MP_TAC (ISPECL [`x:real^N`;` b:real^N`] HALFLINE_SUBSET_AFFINE_HULL); +SUBGOAL_THEN ` aff {x,a:real^N} SUBSET aff {a,b} ` MP_TAC; +MATCH_MP_TAC S_SUBSET_IMP_AFF_S_TOO; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +SUBGOAL_THEN ` aff {x,b:real^N} SUBSET aff {a,b} ` MP_TAC; +MATCH_MP_TAC S_SUBSET_IMP_AFF_S_TOO; +DOWN; +ASM_SIMP_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +ONCE_REWRITE_TAC[INSERT_COMM]; +ASM_REWRITE_TAC[]; + +REWRITE_TAC[GSYM aff]; +PHA; +SET_TAC[]]);; + + + + + + + + +let CVLF_LF_F = prove( +` convex_local_fan (V,E,FF) ==> local_fan (V,E,FF) /\ FAN (vec 0,V,E)`, +SIMP_TAC[convex_local_fan] THEN NHANH Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN THEN +SIMP_TAC[]);; + + + +let EMPTY_NOT_EXISTS_IN = SET_RULE` a = {} <=> ~(? x. x IN a ) `;; + + + + +let LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI = prove_by_refinement +(`convex_local_fan (V,E,FF) /\ lunar (v,w) V E + ==> vec 0 IN conv0 {v,w} /\ +(!u. u IN V DIFF {v, w} ==> interior_angle1 (vec 0) FF u = pi /\ + rho_node1 FF u IN aff {u,v,w} /\ + ivs_rho_node1 FF u IN aff {u,v,w})`, +[REWRITE_TAC[lunar]; +STRIP_TAC; +SUBGOAL_THEN` vec 0 IN conv0 {v,w:real^3} ` ASSUME_TAC; +MATCH_MP_TAC FAN_SUB_NOT_EQ_COLL_IN_CONV0; +ASSUME_TAC2 CVLF_LF_F; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[]; +GEN_TAC THEN DISCH_TAC; +ABBREV_TAC` conclusion <=> interior_angle1 (vec 0) FF u = pi /\ + rho_node1 FF u IN aff {u, v, w} /\ + ivs_rho_node1 FF u IN aff {u, v, w} `; +SUBGOAL_THEN` vec 0 IN aff {u:real^3, vec 0} ` ASSUME_TAC; +ONCE_REWRITE_TAC[INSERT_COMM]; +ASM_REWRITE_TAC[Planarity.POINT_IN_LINE]; +SUBGOAL_THEN` ~(aff {u, vec 0} INTER conv0 {v,w:real^3} = {})` ASSUME_TAC; +REWRITE_TAC[INTER_EQ_EM_EXPAND]; +EXISTS_TAC` vec 0:real^3 `; +ASM_REWRITE_TAC[]; +ASM_CASES_TAC ` v IN aff {u, vec 0:real^3} `; +SUBGOAL_THEN`aff {u, vec 0} = aff {v,w:real^3} ` ASSUME_TAC; +MATCH_MP_TAC AFF2_DET_BY_TWO_POINTS; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +DOWN THEN DOWN; +SIMP_TAC[INTER_EQ_EM_EXPAND; GSYM IN_INTER]; +MESON_TAC[AFF2_ITR_CONV0_IMP_SAME_ENDS]; +SUBGOAL_THEN` u IN aff {u:real^3, vec 0} ` MP_TAC; +REWRITE_TAC[Planarity.POINT_IN_LINE]; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` vec 0 IN conv0 {v, w:real^3}`; +NHANH IN_CONV_LINE_SEPERATABLE; +SIMP_TAC[IN_UNION]; +REPEAT STRIP_TAC; +SUBGOAL_THEN` ~( u:real^3 IN aff_ge {vec 0} {v} )` MP_TAC; +MATCH_MP_TAC FAN_IMP_NOT_IN_AFF_GE; +ASSUME_TAC2 CVLF_LF_F; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` {v,w:real^3} SUBSET V `; +UNDISCH_TAC `u:real^3 IN V DIFF {v,w} `; +SET_TAC[]; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` ~( u IN aff_ge {vec 0} {w:real^3}) ` MP_TAC; +MATCH_MP_TAC FAN_IMP_NOT_IN_AFF_GE; +ASSUME_TAC2 CVLF_LF_F; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` {v,w:real^3} SUBSET V `; +UNDISCH_TAC `u:real^3 IN V DIFF {v,w} `; +SET_TAC[]; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` {v,w:real^3} INTER aff {u, vec 0} = {} ` ASSUME_TAC; +ASM_REWRITE_TAC[Trigonometry2.INSERT_INTER_EMPTY]; +DOWN THEN DOWN; +REWRITE_TAC[EMPTY_NOT_EXISTS_IN]; +MESON_TAC[AFF2_ITR_CONV0_IMP_SAME_ENDS]; +EXPAND_TAC "conclusion"; +MATCH_MP_TAC OZQVSFF; +EXISTS_TAC ` v:real^3 `; +EXISTS_TAC ` w:real^3 `; +UNDISCH_TAC` {v,w:real^3} SUBSET V `; +UNDISCH_TAC` u IN V DIFF {v,w:real^3}`; +ASM_REWRITE_TAC[INSERT_SUBSET; IN_DIFF]; +SIMP_TAC[]; +STRIP_TAC THEN STRIP_TAC; +CONJ_TAC; +REWRITE_TAC[plane]; +SUBGOAL_THEN` ~ collinear {u,v,w:real^3} ` ASSUME_TAC; +ASM_SIMP_TAC[Collect_geom.NOT_TWO_EQ_IMP_COL_EQUAVALENT]; +UNDISCH_TAC` vec 0 IN conv0 {v, w:real^3}`; +NHANH IN_CONV_LINE_SEPERATABLE; +SIMP_TAC[]; +STRIP_TAC; +REWRITE_TAC[IN_UNION; DE_MORGAN_THM]; +CONJ_TAC; +MATCH_MP_TAC FAN_IMP_NOT_IN_AFF_GE; +ASSUME_TAC2 CVLF_LF_F; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` ~( u:real^3 IN {v,w})`; +ASM_REWRITE_TAC[INSERT_SUBSET; IN_INSERT]; +MESON_TAC[]; +MATCH_MP_TAC FAN_IMP_NOT_IN_AFF_GE; +ASSUME_TAC2 CVLF_LF_F; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` ~( u:real^3 IN {v,w})`; +ASM_REWRITE_TAC[INSERT_SUBSET; IN_INSERT]; +MESON_TAC[]; +DOWN; +REWRITE_TAC[aff]; +MESON_TAC[]; +CONJ_TAC; +MP_TAC (ISPECL [` v:real^3`;` w:real^3`] (GEN_ALL CONV02_SUBSET_AFF2)); +SUBGOAL_THEN` aff {v,w} SUBSET aff {u,v,w:real^3}` ASSUME_TAC; +REWRITE_TAC[aff]; +MATCH_MP_TAC HULL_MONO; +REWRITE_TAC[INSERT_SUBSET; IN_INSERT; EMPTY_SUBSET]; +REWRITE_TAC[EMPTY_SUBSET]; +STRIP_TAC; +CONJ_TAC; +UNDISCH_TAC` aff {v, w} SUBSET aff {u, v, w:real^3}`; +REWRITE_TAC[SUBSET]; +DISCH_THEN MATCH_MP_TAC; +DOWN; +REWRITE_TAC[SUBSET]; +DISCH_THEN MATCH_MP_TAC; +FIRST_ASSUM ACCEPT_TAC; +REWRITE_TAC[aff]; +MESON_TAC[INSERT_COMM; Trigonometry2.IN_P_HULL_INSERT]; +ASM_SIMP_TAC[INSERT_COMM]]);; + + +let AFF_GE_MONO_TRANS = prove( +` S SUBSET X ==> aff_ge (X DIFF S ) ( Y UNION S) SUBSET aff_ge X Y `, +STRIP_TAC THEN REWRITE_TAC[aff_ge_def; SUBSET; IN; affsign] THEN +ASM_SIMP_TAC[SET_RULE` S SUBSET X ==> (X DIFF S UNION Y UNION S) = X UNION Y `] +THEN SET_TAC[]);; + + +let AFF_GT_MONO_TRANS = prove( +` S SUBSET X ==> aff_gt (X DIFF S ) ( Y UNION S) SUBSET aff_gt X Y `, +STRIP_TAC THEN REWRITE_TAC[aff_gt_def; SUBSET; IN; affsign] THEN +ASM_SIMP_TAC[SET_RULE` S SUBSET X ==> (X DIFF S UNION Y UNION S) = X UNION Y `] +THEN SET_TAC[]);; + +let CONV_UNION_SUB_AFF_GE = prove( +` conv (X:(real^N -> bool) UNION Y) SUBSET aff_ge X Y `, +REWRITE_TAC[Collect_geom.conv; GSYM aff_ge_def] THEN +MP_TAC (ISPECL [`X:real^N -> bool`;`X:real^N -> bool`] (GEN_ALL AFF_GE_MONO_TRANS)) +THEN SIMP_TAC[SUBSET_REFL; DIFF_EQ_EMPTY; UNION_COMM]);; + + + +let CONV_MONO = prove(` S SUBSET SS ==> conv S SUBSET conv SS `, +REWRITE_TAC[Geomdetail.conv; GSYM aff_ge_def] THEN +STRIP_TAC THEN MATCH_MP_TAC AFF_GE_MONO_RIGHT THEN +ASM_REWRITE_TAC[DISJOINT_EMPTY]);; + + + + +let CONV3_SUBSET_AFF_GE_3S = prove(` conv {a,b,c:real^N} SUBSET aff_ge {a,b,c} S `, +MP_TAC (ISPECL [` {a,b,c:real^N}`;` S:real^N -> bool`] (GEN_ALL CONV_UNION_SUB_AFF_GE)) THEN +MATCH_MP_TAC (SET_RULE` a SUBSET b ==> b SUBSET c ==> a SUBSET c `) THEN +MATCH_MP_TAC CONV_MONO THEN SET_TAC[]);; + + +let P_SET3_IMP_SET2 = +MESON[INSERT_INSERT]` (! (a:A) b c. P ({a,b,c}) ) ==> (! (a:A) b. (P {a,b})) `;; + + +let CONV2_SUBSET_AFF_GE_2S = +MATCH_MP P_SET3_IMP_SET2 (GEN_ALL CONV3_SUBSET_AFF_GE_3S);; + + + + + + + + +(* ------------------------------------------------------------------------- *) +(* Search (automatically updates) *) +(* ------------------------------------------------------------------------- *) + +let full t = mk_comb(mk_var("",W mk_fun_ty (type_of t)),t);; + +(* very rough measure of the size of a printed term *) +let rec term_length tm = match tm with + | Abs(s,x) -> 1 + term_length x + | Comb(s,x) -> if ((s = `NUMERAL`) or (s = `DECIMAL`)) then 2 + else ( (term_length s) + term_length x) + | _ -> 1;; + +let sortlength_thml thml = + let ltml = map + (function (s,t) as r -> (term_length (concl t),r)) thml in + let stml = sort (fun (a,_) (b,_) -> (a < b)) ltml in + map snd stml;; + +let search_thml = + let rec immediatesublist l1 l2 = + match (l1,l2) with + [],_ -> true + | _,[] -> false + | (h1::t1,h2::t2) -> h1 = h2 & immediatesublist t1 t2 in + let rec sublist l1 l2 = + match (l1,l2) with + [],_ -> true + | _,[] -> false + | (h1::t1,h2::t2) -> immediatesublist l1 l2 or sublist l1 t2 in + let exists_subterm_satisfying p (n,th) = can (find_term p) (concl th) in + let exists_fullterm_satisfying p (n,th) = p (concl th) in + let name_contains s (n,th) = sublist (explode s) (explode n) in + let rec filterpred tm = + match tm with + Comb(Var("",_),t) -> not o filterpred t + | Comb(Var("",_),Var(pat,_)) -> name_contains pat + | Comb(Var("",_),pat) -> exists_subterm_satisfying (aconv pat) + | Comb(Var("",_),pat) -> exists_fullterm_satisfying (can (term_match [] pat)) + | pat -> exists_subterm_satisfying (can (term_match [] pat)) in + fun pats thml -> update_database (); + if (pats = []) then failwith "keywords: omit, name, exactly, full" else + (itlist (filter o filterpred) pats thml);; + + + +let (PAT_TAC:term list -> (string * thm) -> tactic) = + fun pat sth -> if (search_thml pat [sth] = []) then NO_TAC else ALL_TAC;; + +let (FIRST_PAT_ASSUM: term list -> thm_tactic -> tactic) = + fun pat ttac gl -> tryfind (fun sth -> (PAT_TAC pat sth THEN ttac (snd sth)) gl) (goal_asms gl);; + +let (FIRST_PAT_X_ASSUM:term list -> thm_tactic -> tactic) = + fun pat ttac -> + FIRST_PAT_ASSUM pat (fun th -> UNDISCH_THEN (concl th) ttac);; +(* ================================================================== *) + + + + + + +let X_IN_AFF_GE = prove_by_refinement +(` x IN aff_ge S {x:real^N} `, +[REWRITE_TAC[aff_ge_def; IN; affsign; sgn_ge; lin_combo]; +EXISTS_TAC` (\a. if a = (x:real^N) then &1 else &0 ) `; +CONJ_TAC; +REWRITE_TAC[]; +SUBGOAL_THEN` vsum (S UNION {x:real^N}) (\v. (if v = x then &1 else &0) % v) += vsum ({x}) (\v. (if v = x then &1 else &0) % v) ` ASSUME_TAC; +MATCH_MP_TAC VSUM_UNION_LZERO; +REWRITE_TAC[FINITE_SINGLETON; IN_INSERT; NOT_IN_EMPTY]; +SIMP_TAC[VECTOR_MUL_LZERO]; +ASM_REWRITE_TAC[VSUM_SING; VECTOR_MUL_LID]; + +SIMP_TAC[SET_RULE` {a} x <=> x = a `; REAL_ARITH` &0 <= &1 `]; +SUBGOAL_THEN` sum (S UNION {x:real^N}) (\a. if a = x then &1 else &0) += sum ({x}) (\a. if a = x then &1 else &0) ` ASSUME_TAC; +MATCH_MP_TAC SUM_UNION_LZERO; +SIMP_TAC[FINITE_SING; IN_INSERT; DE_MORGAN_THM]; +ASM_REWRITE_TAC[SUM_SING]]);; + + + + + + + +let LOFA_IMP_BIJ_FF_V = MESON[Wrgcvdr_cizmrrh.BIJ_BETWEEN_FF_AND_V] +` local_fan (V,E,FF) ==> BIJ (\x. FST x) FF V `;; + +let LOFA_IMP_CARD_FF_V_EQ = prove( +` local_fan (V,E,FF) ==> CARD FF = CARD V `, +NHANH Wrgcvdr_cizmrrh.LOCAL_FAN_FINITE_FF THEN +NHANH LOFA_IMP_BIJ_FF_V THEN PHA THEN +NHANH BIJ_IMP_CARD_EQ THEN SIMP_TAC[]);; + + + +let FIRST_IN_AFF = prove(` a IN aff ( a INSERT S ) `, +REWRITE_TAC[aff; Trigonometry2.IN_P_HULL_INSERT]);; + + + + + + +let HALF_CIRCULAR_IN_PLANE = prove_by_refinement +(` (convex_local_fan (V,E,FF) /\ lunar (v,w) V E ) /\ +n < CARD V /\ w = ITER n (rho_node1 FF) v + ==> { ITER l (rho_node1 FF) v | l <= n } SUBSET aff {vec 0, v, rho_node1 FF v}`, +[NHANH LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI; +REWRITE_TAC[SUBSET; IN_ELIM_THM; lunar]; +REPEAT STRIP_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` l <= n:num`; +SPEC_TAC (`l:num`,`l:num`); +INDUCT_TAC; +REWRITE_TAC[ITER]; +DISCH_TAC; +MP_TAC (ISPECL [`affine: (real^3 -> bool) -> bool `; +` {vec 0, v, rho_node1 FF v } `] HULL_SUBSET); +REWRITE_TAC[aff; SUBSET]; +DISCH_THEN MATCH_MP_TAC; +REWRITE_TAC[IN_INSERT]; +NHANH (ARITH_RULE` SUC a <= b ==> a <= b `); +FIRST_X_ASSUM NHANH; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` ITER l' (rho_node1 FF) v `)); +ASM_CASES_TAC` l' = 0 `; +ASM_REWRITE_TAC[ITER]; +REPEAT STRIP_TAC; +MP_TAC (ISPECL [`affine: (real^3 -> bool) -> bool `; +` {vec 0, v, rho_node1 FF v } `] HULL_SUBSET); +REWRITE_TAC[aff; SUBSET]; +DISCH_THEN MATCH_MP_TAC; +REWRITE_TAC[IN_INSERT]; +ANTS_TAC; +ASSUME_TAC2 CVX_LO_IMP_LO; +ASSUME_TAC2 LOFA_IMP_CARD_FF_V_EQ; +MP_TAC2 (SPEC `n:num` (GEN `l:num` LOFA_IMP_DIS_ELMS)); +UNDISCH_TAC` !x. x IN {v, w} ==> x IN (V:real^3 -> bool) `; +SIMP_TAC[IN_INSERT]; +DISCH_THEN (MP_TAC o (SPEC`l': num`)); +ANTS_TAC; +UNDISCH_TAC` SUC l' <= n `; +ARITH_TAC; + + +MP_TAC2 (SPEC `l':num` (GEN `l:num` LOFA_IMP_DIS_ELMS)); +CONJ_TAC; +UNDISCH_TAC` !x. x IN {v, w} ==> x IN (V:real^3 -> bool) `; +SIMP_TAC[IN_INSERT]; +UNDISCH_TAC` n < CARD (V:real^3 -> bool) `; +UNDISCH_TAC` l' <= n:num `; +ARITH_TAC; +DISCH_THEN (MP_TAC o (SPEC`0`)); +ANTS_TAC; +UNDISCH_TAC` ~( l' = 0)`; +ARITH_TAC; +ASM_SIMP_TAC[IN_DIFF; IN_INSERT; NOT_IN_EMPTY; DE_MORGAN_THM; ITER]; +REPEAT STRIP_TAC; + +MP_TAC2 LOCAL_FAN_ORBIT_MAP_VITER; +DISCH_THEN MATCH_MP_TAC; +UNDISCH_TAC ` !x. x IN {v:real^3, w} ==> x IN V`; +SIMP_TAC[IN_INSERT]; + +SUBGOAL_THEN` aff {ITER l' (rho_node1 FF) v, v, w} SUBSET aff {vec 0, v, rho_node1 FF v}` MP_TAC; +MATCH_MP_TAC S_SUBSET_IMP_AFF_S_TOO; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +CONJ_TAC; +MESON_TAC[FIRST_IN_AFF; INSERT_COMM]; + +SUBGOAL_THEN` aff {vec 0, v:real^3} SUBSET aff {vec 0, v, rho_node1 FF v }` MP_TAC; +REWRITE_TAC[aff]; +MATCH_MP_TAC HULL_MONO; +SET_TAC[]; +REWRITE_TAC[SUBSET]; +DISCH_THEN MATCH_MP_TAC; +UNDISCH_TAC ` vec 0 IN conv0 {v,w:real^3}`; +NHANH IN_CONV0_IMP_AFF_EQ; +SIMP_TAC[INSERT_COMM]; +STRIP_TAC; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[Planarity.POINT_IN_LINE1]; +SIMP_TAC[SUBSET; ITER]]);; + + + + + + +let LOFA_IMP_AZIM_RHO_NODE_ST = prove_by_refinement +(` local_fan (V,E,FF) /\ v IN V /\ v cross rho_node1 FF v = e ==> +~(azim ( vec 0 ) e v (rho_node1 FF v ) = &0 \/ azim (vec 0) e v (rho_node1 FF v ) = pi ) `, +[NHANH (MESON[Trigonometry.YIXJNJQ1; SIN_PI]` a = &0 \/ a = pi ==> sin a = &0 `); +MP_TAC (SPECL [`e:real^3`;` v:real^3`;` rho_node1 FF v `] Trigonometry2.JBDNJJB); +REWRITE_TAC[re_eqvl]; +STRIP_TAC; +STRIP_TAC; +ASM_SIMP_TAC[REAL_ENTIRE; DE_MORGAN_THM]; +DISJ2_TAC; +CONJ_TAC; +UNDISCH_TAC` &0 < t `; +REAL_ARITH_TAC; +ONCE_REWRITE_TAC[CROSS_TRIPLE]; +ASM_REWRITE_TAC[DOT_EQ_0]; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +REWRITE_TAC[CROSS_EQ_0]; +UNDISCH_TAC `v:real^3 IN V `; +ASSUME_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE; +FIRST_X_ASSUM NHANH; +SIMP_TAC[]]);; + + + + + + + + +let LOFA_IMP_DIS_ELMS2 = +MESON[LOFA_IMP_DIS_ELMS]` local_fan (V,E,FF) /\ v IN V + ==> (!i l. i < l /\ l < CARD FF + ==> ~(ITER l (rho_node1 FF) v = ITER i (rho_node1 FF) v))`;; + + + + + + + +let RHO_NODE1_MONO_WITH_AZIM = prove_by_refinement +(` local_fan (V,E,FF) /\ + v IN V /\ + {ITER n (rho_node1 FF) v | n <= l} = U /\ + plane P /\ + vec 0 IN P /\ + U SUBSET P /\ + v cross rho_node1 FF v = e +==> (! n m. n < m /\ m < CARD V /\ m <= l + ==> azim (vec 0) e v ( ITER n (rho_node1 FF) v) < + azim (vec 0) e v ( ITER m (rho_node1 FF) v) )`, +[STRIP_TAC; +GEN_TAC; +INDUCT_TAC; +REWRITE_TAC[LT]; +ASM_CASES_TAC ` m = n:num`; +FIRST_X_ASSUM (SUBST_ALL_TAC); +ASSUME_TAC2 SEQUENCE_OF_RHO_NODE_IS_SUC; +FIRST_X_ASSUM (MP_TAC o (SPECL [` ITER n (rho_node1 FF) v`;`n:num`])); +PHA; +NHANH (ARITH_RULE` SUC a <= b ==> a < b `); +IMP_TAC; +DISCH_THEN NHANH; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC`v:real^3 `)); +REWRITE_TAC[ITER]; +ASM_CASES_TAC` n = 0 `; +ASM_REWRITE_TAC[ITER; AZIM_REFL]; +ASSUME_TAC2 LOFA_IMP_AZIM_RHO_NODE_ST; +MP_TAC (SPECL [`vec 0:real^3 `;` e:real^3 `;` v:real^3 `;` rho_node1 FF v `] AZIM_RANGE); +DOWN; +REAL_ARITH_TAC; + + + + + +(* 7777777 *) +DISCH_THEN MATCH_MP_TAC; +ASSUME_TAC2 LOFA_IMP_DIS_ELMS2; +EXPAND_TAC "U"; +REWRITE_TAC[IN_ELIM_THM]; +CONJ_TAC; +EXISTS_TAC ` 0`; +REWRITE_TAC[ITER; LE_0]; + +FIRST_ASSUM (MP_TAC o (SPECL [`0`;` n:num`])); +FIRST_ASSUM (MP_TAC o (SPECL [`0`;` n + 1`])); +PHA; +ASM_REWRITE_TAC[GSYM ADD1]; + +IMP_TAC; +ANTS_TAC; +REWRITE_TAC[LT_0]; +ASSUME_TAC2 LOFA_IMP_CARD_FF_V_EQ; +ASM_REWRITE_TAC[]; +SIMP_TAC[ITER]; + +ASSUME_TAC2 LOFA_IMP_CARD_FF_V_EQ; +STRIP_TAC; +ANTS_TAC; +UNDISCH_TAC` ~( n = 0 ) `; +UNDISCH_TAC` SUC n < CARD (V:real^3 -> bool) `; +ASM_REWRITE_TAC[]; +ARITH_TAC; +SIMP_TAC[]; + +STRIP_TAC; +UNDISCH_TAC` n < m /\ m < CARD (V:real^3 -> bool) /\ m <= l + ==> azim (vec 0) e v (ITER n (rho_node1 FF) v) < + azim (vec 0) e v (ITER m (rho_node1 FF) v) ` ; +ANTS_TAC; +REPLICATE_TAC 4 DOWN THEN PHA; +ARITH_TAC; +ASSUME_TAC2 SEQUENCE_OF_RHO_NODE_IS_SUC; + +FIRST_X_ASSUM (MP_TAC o (SPECL [` ITER m (rho_node1 FF) v`;` m:num`])); +REWRITE_TAC[]; +ANTS_TAC; +DOWN; +ARITH_TAC; + +DISCH_THEN (MP_TAC o (SPEC ` v:real^3 `)); +ANTS_TAC; +EXPAND_TAC "U"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC `0`; +REWRITE_TAC[ITER; LE_0]; +ASM_CASES_TAC ` m = 0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +REWRITE_TAC[ITER; AZIM_REFL]; +MP_TAC (SPECL [` vec 0:real^3`;` e:real^3 `;` v:real^3 `;` rho_node1 FF v `] AZIM_RANGE); +REAL_ARITH_TAC; + +ASSUME_TAC2 LOFA_IMP_DIS_ELMS2; +ANTS_TAC; +FIRST_X_ASSUM (MP_TAC o (SPECL [`0` ;` m:num `])); +PHA; +ANTS_TAC; +REPLICATE_TAC 3 DOWN THEN PHA; +ASSUME_TAC2 LOFA_IMP_CARD_FF_V_EQ; +ASM_REWRITE_TAC[]; +ARITH_TAC; +SIMP_TAC[ITER]; +ANTS_TAC; + +FIRST_X_ASSUM (MP_TAC o (SPECL [`0` ;`SUC m`])); +PHA; +ANTS_TAC; + +ASSUME_TAC2 LOFA_IMP_CARD_FF_V_EQ; +ASM_REWRITE_TAC[]; +ARITH_TAC; +SIMP_TAC[ITER]; + +REWRITE_TAC[ITER]; +REAL_ARITH_TAC]);; + + + + + + + + +let DISJOINT_IMP_Z_IN_AFF_GT = +prove(` DISJOINT {x,y} {z} ==> z IN aff_gt {x,y} {z} `, +SIMP_TAC[AFF_GT_2_1; IN_ELIM_THM] THEN DISCH_TAC THEN EXISTS_TAC` &0` THEN +EXISTS_TAC ` &0 ` THEN EXISTS_TAC ` &1 ` THEN +REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID; VECTOR_MUL_LID] THEN +REAL_ARITH_TAC);; + + + +let LOFA_IMP_DIS_ELMS23 = MESON[LOFA_IMP_CARD_FF_V_EQ; LOFA_IMP_DIS_ELMS2] +` local_fan (V,E,FF) /\ v IN V + ==> (!i l. + i < l /\ l < CARD V + ==> ~(ITER l (rho_node1 FF) v = ITER i (rho_node1 FF) v))`;; + + + + + +let NOT_COLL_IMP_COPL = prove( +` ~ collinear {vec 0,v,w} ==> ~ coplanar {vec 0, v,w, v cross w } `, +REWRITE_TAC[GSYM CROSS_DOT_COPLANAR; GSYM CROSS_EQ_0; DOT_EQ_0]);; + + + +let COLL_IFF_COLL_CROSS = prove_by_refinement +(` collinear {vec 0, v, w} <=> collinear {vec 0, v, v cross w} `, +[EQ_TAC; SIMP_TAC[GSYM CROSS_EQ_0; CROSS_0]; +ASM_CASES_TAC` collinear {vec 0,v,w:real^3}`; +ASM_REWRITE_TAC[]; MP_TAC2 NOT_COLL_IMP_COPL; +MESON_TAC[NOT_COPLANAR_NOT_COLLINEAR; INSERT_COMM]]);; + + + + + + +let LOCAL_FAN_CHARACTER_OF_RHO_NODE2 = +prove(` local_fan (V,E,FF) /\ v IN V ==> ~collinear {vec 0, v, rho_node1 FF v} `, +NHANH LOCAL_FAN_CHARACTER_OF_RHO_NODE THEN SIMP_TAC[]);; + + + + +let LUNAR_IMP_HALF_CIRCLE_SUBSET_AFF_GT = prove_by_refinement +(`convex_local_fan (V,E,FF) /\ lunar (v,w) V E + ==> (?i. i < CARD V /\ + w = ITER i (rho_node1 FF) v /\ + {ITER l (rho_node1 FF) v | 0 < l /\ l < i} SUBSET + aff_gt {vec 0, v} {rho_node1 FF v})`, +[NHANH LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI; + +REWRITE_TAC[convex_local_fan; lunar; INSERT_SUBSET]; +NHANH LOCAL_FAN_ORBIT_MAP_V; +NHANH LOOP_SET_DETER_FIRTS_ELMS; +STRIP_TAC; +SUBGOAL_THEN` orbit_map (rho_node1 FF) v = (V:real^3 -> bool) `ASSUME_TAC; +ASM_SIMP_TAC[]; +SUBGOAL_THEN` {ITER n (rho_node1 FF) v | n < CARD V} = V `ASSUME_TAC; +ASM_SIMP_TAC[]; +UNDISCH_TAC` w:real^3 IN V `; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC` n:num`; +ASM_REWRITE_TAC[SUBSET; IN_ELIM_THM]; +REPEAT STRIP_TAC; + +ASM_REWRITE_TAC[]; +MP_TAC2 HALF_CIRCULAR_IN_PLANE; +SWITCH_TAC ` w = ITER n (rho_node1 FF) v `; +ASM_SIMP_TAC[convex_local_fan; lunar]; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +EXPAND_TAC "w"; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` n:num`; +ASM_REWRITE_TAC[]; +ABBREV_TAC` U = {ITER l (rho_node1 FF) v | l <= n} `; +ABBREV_TAC` P = aff {vec 0, v, rho_node1 FF v} `; +ABBREV_TAC` e = v cross rho_node1 FF v `; +STRIP_TAC; +MP_TAC2 (SPEC `n:num` (GEN `l:num` FIRST_AZIM_CYCLE_EQ_RHO_NODE)); +EXPAND_TAC "P"; +REWRITE_TAC[plane; FIRST_IN_AFF; aff]; +EXISTS_TAC` vec 0:real^3 `; +EXISTS_TAC` v:real^3`; +EXISTS_TAC` rho_node1 FF v `; +ASSUME_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE; +UNDISCH_TAC` v:real^3 IN V`; +FIRST_X_ASSUM NHANH; +SIMP_TAC[]; +MP_TAC2 (SPEC `n:num ` (GEN ` l:num` RHO_NODE1_MONO_WITH_AZIM)); +EXPAND_TAC "P"; +REWRITE_TAC[plane; FIRST_IN_AFF]; +EXISTS_TAC` vec 0:real^3 `; +EXISTS_TAC` v:real^3 `; +EXISTS_TAC ` rho_node1 FF v `; +REWRITE_TAC[aff]; +ASSUME_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE; +ASM_SIMP_TAC[]; +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC o (SPECL [`0`;` l:num`])); +DOWN; +ANTS_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` l < n:num`; +UNDISCH_TAC` n < CARD (V:real^3 -> bool) `; +ARITH_TAC; + + +FIRST_ASSUM (ASSUME_TAC o (SPECL [` l:num`;`n:num`])); +DOWN; +ANTS_TAC; +ASM_REWRITE_TAC[LE_REFL]; + + +REWRITE_TAC[ITER; AZIM_REFL]; +SUBGOAL_THEN` azim (vec 0) e v (ITER n (rho_node1 FF) v) = pi <=> +v IN aff_lt {vec 0, e:real^3} {ITER n (rho_node1 FF) v}` ASSUME_TAC; +MATCH_MP_TAC AZIM_EQ_PI; + +UNDISCH_TAC` vec 0 IN conv0 {v,w:real^3}`; +REWRITE_TAC[Geomdetail.CONV0_SET2; IN_ELIM_THM]; +NHANH (REAL_ARITH` &0 < a ==> ~( a = &0 ) `); +REWRITE_TAC[VECTOR_ARITH` vec 0 = a + b <=> b = -- a `]; +STRIP_TAC; +SWITCH_TAC` w = ITER n (rho_node1 FF) v`; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` collinear {vec 0, &1 % e, b % w} <=> collinear {vec 0, e, w:real^3}` ASSUME_TAC; +MATCH_MP_TAC COLLINEAR_SCALE_ALL; +ASM_REWRITE_TAC[]; +REAL_ARITH_TAC; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[GSYM VECTOR_MUL_LNEG]; + +SUBGOAL_THEN` collinear {vec 0, &1 % e, ( -- a ) % v} <=> collinear {vec 0, e, v:real^3}` SUBST1_TAC; +MATCH_MP_TAC COLLINEAR_SCALE_ALL; +UNDISCH_TAC` ~( a = &0 )`; +REAL_ARITH_TAC; +REWRITE_TAC[]; +EXPAND_TAC "e"; +ONCE_REWRITE_TAC[SET_RULE` {a,b} = {b,a} `]; +ONCE_REWRITE_TAC[GSYM COLL_IFF_COLL_CROSS]; +ASSUME_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE; +UNDISCH_TAC` v:real^3 IN V`; +FIRST_X_ASSUM NHANH; +SIMP_TAC[]; + + +SUBGOAL_THEN ` azim (vec 0) e v (ITER n (rho_node1 FF) v) = pi ` ASSUME_TAC; +FIRST_X_ASSUM SUBST1_TAC; +SUBGOAL_THEN` ~( aff {vec 0, e:real^3} INTER conv0 {w,v} = {} ) ` MP_TAC; +REWRITE_TAC[EMPTY_NOT_EXISTS_IN]; +EXISTS_TAC` vec 0:real^3 `; +SWITCH_TAC` w = ITER n (rho_node1 FF) v `; +ASM_SIMP_TAC[IN_INTER; Planarity.POINT_IN_LINE; INSERT_COMM]; + +ASM_REWRITE_TAC[]; +MATCH_MP_TAC Ldurdpn.AFF_CONV0_IN_AFF_LT; +SWITCH_TAC` w = ITER n (rho_node1 FF ) v `; + + + + + +UNDISCH_TAC` vec 0 IN conv0 {v,w:real^3}`; +REWRITE_TAC[Geomdetail.CONV0_SET2; IN_ELIM_THM]; +NHANH (REAL_ARITH` &0 < a ==> ~( a = &0 ) `); +REWRITE_TAC[VECTOR_ARITH` vec 0 = a + b <=> b = -- a `]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` collinear {vec 0, &1 % e, b % w} <=> collinear {vec 0, e, w:real^3}` ASSUME_TAC; +MATCH_MP_TAC COLLINEAR_SCALE_ALL; +ASM_REWRITE_TAC[]; +REAL_ARITH_TAC; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[GSYM VECTOR_MUL_LNEG]; + +SUBGOAL_THEN` collinear {vec 0, &1 % e, ( -- a ) % v} <=> collinear {vec 0, e, v:real^3}` SUBST1_TAC; +MATCH_MP_TAC COLLINEAR_SCALE_ALL; +UNDISCH_TAC` ~( a = &0 )`; +REAL_ARITH_TAC; +REWRITE_TAC[]; +EXPAND_TAC "e"; +ONCE_REWRITE_TAC[SET_RULE` {a,b} = {b,a} `]; +ONCE_REWRITE_TAC[GSYM COLL_IFF_COLL_CROSS]; +ASSUME_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE; +UNDISCH_TAC` v:real^3 IN V`; +FIRST_X_ASSUM NHANH; +SIMP_TAC[]; + +ASM_REWRITE_TAC[]; +SWITCH_TAC` w = ITER n (rho_node1 FF) v `; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +MP_TAC2 (SPEC ` azim (vec 0) e v (ITER l (rho_node1 FF) v) ` SIN_POS_PI); +MP_TAC (SPECL [`e:real^3`;`v:real^3`;` ITER l (rho_node1 FF) v `] Trigonometry2.JBDNJJB); +REWRITE_TAC[re_eqvl]; +STRIP_TAC; + + +SUBGOAL_THEN` ITER l (rho_node1 FF) v IN aff {vec 0, v, rho_node1 FF v}` MP_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` U SUBSET (P:real^3 -> bool) `; +REWRITE_TAC[SUBSET]; +DISCH_THEN MATCH_MP_TAC; +EXPAND_TAC "U"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC `l:num`; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` l < n:num`; +ARITH_TAC; + + +REWRITE_TAC[aff; AFFINE_HULL_3; IN_ELIM_THM]; +STRIP_TAC; +ASM_REWRITE_TAC[]; + +ONCE_REWRITE_TAC[CROSS_TRIPLE]; +REWRITE_TAC[CROSS_RADD; CROSS_RMUL; CROSS_0; CROSS_REFL; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +ASM_REWRITE_TAC[DOT_LMUL]; + + +SUBGOAL_THEN` &0 < e dot (e:real^3)` ASSUME_TAC; +REWRITE_TAC[DOT_POS_LT]; +EXPAND_TAC "e"; +REWRITE_TAC[CROSS_EQ_0]; +MATCH_MP_TAC LOCAL_FAN_CHARACTER_OF_RHO_NODE2; +ASM_REWRITE_TAC[]; + +ASM_SIMP_TAC[REAL_LT_MUL_EQ]; +MP_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE2; +NHANH Fan.th3a; +SIMP_TAC[AFF_GT_2_1; IN_ELIM_THM]; +REPEAT STRIP_TAC; +EXISTS_TAC` u:real `; +EXISTS_TAC` v':real `; +EXISTS_TAC` w':real`; +ASM_REWRITE_TAC[]; +VECTOR_ARITH_TAC]);; + + + + + + + +let LOOP_SET_ITER_CARD_ID = prove_by_refinement +(` (!v:A. v IN V ==> orbit_map f v = V) ==> +(! v. v IN V ==> ITER (CARD V) f v = v )`, +[NHANH LOOP_SET_DETER_FIRTS_ELMS; +NHANH (ONCE_REWRITE_RULE[EQ_SYM_EQ] SELF_CYCLIC_IMP_BIJ); + +STRIP_TAC; +FIRST_ASSUM NHANH; +GEN_TAC THEN STRIP_TAC; +SUBGOAL_THEN` ITER (CARD (V:A -> bool)) (f:A -> A) (v:A) IN V` MP_TAC; +DOWN; +REMOVE_TAC; +DOWN; +DOWN; +REMOVE_TAC; +FIRST_X_ASSUM (NHANH_PAT`\x. x ==> y`); +STRIP_TAC; +EXPAND_TAC "V"; +REWRITE_TAC[lemma_in_orbit_iter]; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +DOWN; +ASM_CASES_TAC` n = 0 `; +ASM_REWRITE_TAC[ITER]; + +ASM_REWRITE_TAC[]; +ABBREV_TAC` cc = CARD (V:A -> bool) `; +ASSUME_TAC2 (ARITH_RULE` n < cc ==> cc = (cc - n ) + (n:num) `); +ABBREV_TAC ` m = cc - (n:num)`; +ASM_REWRITE_TAC[GSYM ITER_ADD]; + +SUBGOAL_THEN` 0 < m ` MP_TAC; +UNDISCH_TAC` n < cc:num`; +EXPAND_TAC "m"; +ARITH_TAC; + +PHA; +NHANH Lvducxu.ITER_CYCLIC_ORBIT; + +SUBGOAL_THEN` ITER n f (v:A) IN V ` MP_TAC; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC `n:num`; +ASM_REWRITE_TAC[]; + +ASM_SIMP_TAC[]; + +REPEAT STRIP_TAC; +SUBGOAL_THEN` CARD (V:A -> bool) <= m ` MP_TAC; +FIRST_X_ASSUM SUBST1_TAC; +REWRITE_TAC[Wrgcvdr_cizmrrh.CARD_LE_K_OF_SET_K_FIRST_ELMS]; +ASM_REWRITE_TAC[]; + +UNDISCH_TAC` ~ ( n = 0 ) `; +ARITH_TAC]);; + + + + + +let LOFA_IMP_ITER_RHO_NODE_ID = prove( +`local_fan (V,E,FF) ==> (! v. v IN V ==> ITER (CARD V) (rho_node1 FF) v = v )`, +NHANH LOCAL_FAN_ORBIT_MAP_V THEN +SIMP_TAC[LOOP_SET_ITER_CARD_ID]);; + + + + +let CONV_SUBSET_AFF_GE = prove(` conv SS SUBSET aff_ge S SS`, +REWRITE_TAC[Collect_geom.conv; GSYM aff_ge_def] THEN +MATCH_MP_TAC AFF_GE_MONO_LEFT THEN SET_TAC[]);; + +let CONV0_SUBSET_AFF_GT = prove(` conv0 SS SUBSET aff_gt S SS`, +REWRITE_TAC[conv0; GSYM aff_gt_def] THEN +MATCH_MP_TAC AFF_GT_MONO_LEFT THEN SET_TAC[]);; + + + + + +let collinear_fan22 = +MESON[Fan.collinear_fan]`collinear {x, v,u} <=> u IN aff {x, v} \/ (x = v)`;; + +let IN_CONV0_IMP_COLL_IFF = prove( + ` x IN conv0 {a,b} ==> (collinear {a,x,v} <=> collinear {a,b,v} )`, +NHANH IN_CONV0_IMP_AFF_EQ THEN NHANH IN_CONV0_EQ_EQ THEN +SIMP_TAC[collinear_fan22; EQ_SYM_EQ]);; + +let IN_CONV0_IMP_COLL_ENDS_AFF = prove( +` x IN conv0 {a:real^N,b} ==> (collinear {a,x,v} <=> collinear {b,x,v})`, +NHANH IN_CONV0_IMP_COLL_IFF THEN ONCE_REWRITE_TAC[INSERT_COMM] THEN +NHANH IN_CONV0_IMP_COLL_IFF THEN SIMP_TAC[INSERT_COMM]);; + + + + + + + + +let IN_CONV0_IMP_AZIM_PI = prove_by_refinement +(` ~ collinear {x,a,e} /\ x IN conv0 {a,b} +==> azim x e a b = pi `, +[STRIP_TAC; +SUBGOAL_THEN` azim x e a b = pi <=> b IN aff_lt {x,e} {a}` MP_TAC; +MATCH_MP_TAC AZIM_EQ_PI_ALT; +DOWN; +NHANH (SPEC `e:real^N` (GEN `v:real^N` IN_CONV0_IMP_COLL_ENDS_AFF)); +DOWN; +ASM_SIMP_TAC[INSERT_COMM]; +SIMP_TAC[]; +DISCH_TAC; +DOWN_TAC; +SPEC_TAC (`x:real^3`,`x:real^3`); +GEOM_ORIGIN_TAC `x:real^3`; +REPEAT STRIP_TAC; +SUBGOAL_THEN` ~(aff {vec 0, e} INTER conv0 {a,b:real^3} = {})` MP_TAC; +REWRITE_TAC[INTER_EQ_EM_EXPAND]; +EXISTS_TAC` vec 0:real^3 `; +ASM_REWRITE_TAC[Planarity.POINT_IN_LINE]; + +MATCH_MP_TAC Ldurdpn.AFF_CONV0_IN_AFF_LT; +DOWN_TAC; +SIMP_TAC[INSERT_COMM]]);; + + + + + + + + + +let AFF_GT_MONO = prove(`!S. (S:real^N -> bool) SUBSET Y ==> aff_gt X Y SUBSET aff_gt (X UNION S) ( Y DIFF S)`, GEN_TAC THEN +DISCH_TAC THEN REWRITE_TAC[SUBSET; IN; aff_gt_def; affsign] THEN +ASM_SIMP_TAC[SET_RULE`S SUBSET Y ==> (X UNION S) UNION Y DIFF S = X UNION Y`] THEN +SET_TAC[]);; + + + + + + +(* aff_gt X Y SUBSET aff (X UNION Y) *) +(* ================================= *) +let AFF_GT_SUB_AFF_UNION = +REWRITE_RULE[SUBSET_REFL; DIFF_EQ_EMPTY; AFF_GT_EQ_AFFINE_HULL; GSYM aff] + (SPEC `Y:real^N -> bool` AFF_GT_MONO);; + + + + + + +let SIN_AZIM_NEG_PI_LT = prove_by_refinement +(` sin ( azim x y u v ) < &0 <=> pi < azim x y u v `, +[MP_TAC (SPECL [`x:real^3`;`y:real^3`;`u:real^3`;` v:real^3 `] AZIM_RANGE); +STRIP_TAC; +EQ_TAC; +ASM_CASES_TAC` azim x y u v <= pi `; +SUBGOAL_THEN` &0 <= sin ( azim x y u v )` MP_TAC; +ASM_SIMP_TAC[Trigonometry.WIBGJRR]; +REAL_ARITH_TAC; +DOWN; +REAL_ARITH_TAC; +ASM_SIMP_TAC [ PI_TO_TWO_PI_NEG_SIN]]);; + + + + + + + + +let NEXT_OPOSITE_POINT_IS_NOT_IN_AFF_GT = prove_by_refinement +(`( convex_local_fan (V,E,FF) /\ lunar (v,w) V E) +==> ? i. w = ITER i (rho_node1 FF) v /\ + i + 1 < CARD V /\ + ~(ITER ( i + 1 ) (rho_node1 FF) v IN aff_gt {vec 0, v} {rho_node1 FF v})`, +[NHANH LUNAR_IMP_HALF_CIRCLE_SUBSET_AFF_GT; +STRIP_TAC; +SUBGOAL_THEN` ~ collinear {vec 0, v, rho_node1 FF v}` ASSUME_TAC; +MATCH_MP_TAC LOCAL_FAN_CHARACTER_OF_RHO_NODE2; +UNDISCH_TAC `lunar (v:real^3,w) V E `; +ASM_SIMP_TAC[lunar; INSERT_SUBSET; CVX_LO_IMP_LO]; + +EXISTS_TAC `i:num`; +ASSUME_TAC2 (SPEC `i:num` (GEN `n:num` HALF_CIRCULAR_IN_PLANE)); +ASM_REWRITE_TAC[]; +ASM_CASES_TAC` i + 1 = CARD (V:real^3 -> bool) `; +SUBGOAL_THEN` rho_node1 FF w = v ` ASSUME_TAC; +ASM_REWRITE_TAC[GSYM ITER; ADD1]; +ASSUME_TAC2 CVX_LO_IMP_LO; +MP_TAC2 LOFA_IMP_ITER_RHO_NODE_ID; +UNDISCH_TAC` lunar (v:real^3 ,w) V E `; +REWRITE_TAC[lunar; INSERT_SUBSET]; +SIMP_TAC[]; + +UNDISCH_TAC` lunar (v:real^3,w) V E `; +REWRITE_TAC[lunar; INSERT_SUBSET]; +STRIP_TAC; +ASSUME_TAC2 CVX_LO_IMP_LO; +SUBGOAL_THEN` ~collinear {vec 0, w, rho_node1 FF w}` MP_TAC; +MATCH_MP_TAC LOCAL_FAN_CHARACTER_OF_RHO_NODE2; +ASM_REWRITE_TAC[]; + +DOWN THEN DOWN; +EXPAND_TAC "v"; +ASM_SIMP_TAC[INSERT_COMM]; +ASM_REWRITE_TAC[ARITH_RULE` a + 1 < b <=> a < b /\ ~(a + 1 = b )`]; +STRIP_TAC; +SUBGOAL_THEN` {ITER l (rho_node1 FF) v | l <= i + 1} SUBSET + aff {vec 0, v, rho_node1 FF v}` ASSUME_TAC; +REWRITE_TAC[ARITH_RULE` a <= b + 1 <=> a = b + 1 \/ a <= b `; + SET_RULE` { f x | x = a \/ Q x } = f a INSERT { f x | Q x }`; INSERT_SUBSET]; +ASM_REWRITE_TAC[]; +MP_TAC (ISPECL [`{vec 0,v:real^3}`;`{rho_node1 FF v}`] +(GEN_ALL AFF_GT_SUB_AFF_UNION)); +REWRITE_TAC[SET_RULE` {a,b} UNION {c} = {a,b,c}`; SUBSET]; +DISCH_THEN MATCH_MP_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +ABBREV_TAC` P = aff {vec 0, v, rho_node1 FF v} `; +ABBREV_TAC` U = {ITER l (rho_node1 FF) v | l <= i + 1} `; +ABBREV_TAC` l = i + 1 `; +ABBREV_TAC ` e = v cross rho_node1 FF v `; +MP_TAC2 RHO_NODE1_MONO_WITH_AZIM; +UNDISCH_TAC` lunar (v:real^3,w) V E `; +REWRITE_TAC[lunar; INSERT_SUBSET]; +STRIP_TAC; +ASSUME_TAC2 CVX_LO_IMP_LO; +ASM_REWRITE_TAC[plane]; +EXPAND_TAC "P"; +REWRITE_TAC[FIRST_IN_AFF]; +EXISTS_TAC `vec 0:real^3 `; +EXISTS_TAC` v:real^3 `; +EXISTS_TAC ` rho_node1 FF v `; +REWRITE_TAC[aff]; +MP_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE2; + + + +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC o (SPECL [`i:num`;` i + 1`])); +DOWN; +ANTS_TAC; +EXPAND_TAC "l"; +REWRITE_TAC[ARITH_RULE` a < a + 1`; LE_REFL; ARITH_RULE` a + 1 < b <=> a < b /\ ~( a + 1 = b )`]; +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN` azim (vec 0) e v (ITER i (rho_node1 FF) v) = pi` SUBST1_TAC; +MATCH_MP_TAC IN_CONV0_IMP_AZIM_PI; +MP_TAC2 LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI; +ASM_SIMP_TAC[]; +EXPAND_TAC "e"; +STRIP_TAC; + +REWRITE_TAC[GSYM COLL_IFF_COLL_CROSS]; +MP_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE2; +UNDISCH_TAC `lunar (v:real^3,w) V E `; +ASM_SIMP_TAC[lunar; INSERT_SUBSET; CVX_LO_IMP_LO]; + +REWRITE_TAC[GSYM SIN_AZIM_NEG_PI_LT]; +UNDISCH_TAC` ~collinear {vec 0, v, rho_node1 FF v} `; +NHANH Fan.th3a; +NHANH AFF_GT_2_1; +STRIP_TAC; +UNDISCH_TAC` ITER l (rho_node1 FF) v IN aff_gt {vec 0, v} {rho_node1 FF v} `; +ASM_REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +MP_TAC ( +SPECL [`e:real^3`;` v:real^3`;` ITER l (rho_node1 FF) v`] Trigonometry2.JBDNJJB); +REWRITE_TAC[re_eqvl]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +ONCE_REWRITE_TAC[CROSS_TRIPLE]; +ASM_REWRITE_TAC[CROSS_RADD; CROSS_RMUL; CROSS_REFL; CROSS_0; VECTOR_MUL_RZERO; VECTOR_ADD_LID; DOT_LMUL]; +SUBGOAL_THEN ` &0 < e dot (e:real^3) ` ASSUME_TAC; +REWRITE_TAC[DOT_POS_LT]; +UNDISCH_TAC` ~collinear {vec 0, v, rho_node1 FF v} `; + +ASM_SIMP_TAC[GSYM CROSS_EQ_0]; + +ASM_SIMP_TAC[REAL_ARITH` a * b * c < &0 <=> &0 < a * ( --b ) * c `; REAL_LT_MUL_EQ]; +UNDISCH_TAC` &0 < t3 `; +REAL_ARITH_TAC]);; + + + + + + + + + + +let FOR_AFF_GT_NOT_INTERSECTION = prove_by_refinement +(`a1 % (x:real^N) + b1 % y + t % u = a2 % x + b2 % y + tt % v /\ + &0 < t /\ + &0 < tt /\ + a1 + b1 + t = &1 /\ + a2 + b2 + tt = &1 + ==> u = (a2 - a1) / t % x + (b2 - b1) / t % y + tt / t % v /\ + (a2 - a1) / t + (b2 - b1) / t + tt / t = &1 /\ + &0 < tt / t`, +[REWRITE_TAC[VECTOR_ARITH`a + (b:real^N) = c <=> b = c - a `; +REAL_ARITH` a / t + b / t = ( a + b ) / t`]; +NHANH_PAT`\x. x ==> y` REAL_POS_NZ; +STRIP_TAC; +UNDISCH_TAC` t % u = (a2 % x + b2 % y + tt % v) - a1 % x - b1 % (y:real^N)`; +ASM_SIMP_TAC[Ldurdpn.VECTOR_SCALE_CHANGE; REAL_ARITH` ( a - b ) / c = a / c - b / c`; +VECTOR_SUB_LDISTRIB; VECTOR_ADD_LDISTRIB; VECTOR_SUB_RDISTRIB]; +STRIP_TAC; +CONJ_TAC; +VECTOR_ARITH_TAC; +CONJ_TAC; +UNDISCH_TAC` a1 + b1 + t = &1 `; +UNDISCH_TAC` a2 + b2 + tt = &1 `; +SIMP_TAC[ARITH_RULE` a + b = c <=> a = c - b `]; +REWRITE_TAC[REAL_POLY_CONV`&1 - (b2 + tt) - (&1 - (b1 + t)) + b2 - b1 + tt`]; +REPEAT STRIP_TAC; +UNDISCH_TAC` &0 < t `; +CONV_TAC REAL_FIELD; +MATCH_MP_TAC REAL_LT_DIV; +ASM_REWRITE_TAC[]]);; + + + + + + + + + + +let NOT_COLL_RHONODE_SND_POINT = prove_by_refinement +(` convex_local_fan (V,E,FF) /\ lunar (v,w) V E +==> ~ collinear {vec 0, v, rho_node1 FF w }`, +[NHANH LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI; +REWRITE_TAC[collinear_fan22; DE_MORGAN_THM]; +STRIP_TAC; +UNDISCH_TAC` vec 0 IN conv0 {v,w:real^3}`; + +NHANH IN_CONV0_IMP_AFF_EQ; +NHANH IN_CONV0_EQ_EQ; +ONCE_REWRITE_TAC[INSERT_COMM]; +NHANH IN_CONV0_IMP_AFF_EQ; + +NHANH IN_CONV0_EQ_EQ; +SIMP_TAC[INSERT_COMM]; +STRIP_TAC; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[]; +UNDISCH_TAC` vec 0 = w <=> w = (v:real^3)`; +SIMP_TAC[EQ_SYM_EQ; GSYM collinear_fan22; GSYM DE_MORGAN_THM]; + +ONCE_REWRITE_TAC[INSERT_COMM]; +STRIP_TAC; +MATCH_MP_TAC LOCAL_FAN_CHARACTER_OF_RHO_NODE2; +DOWN_TAC; +SIMP_TAC[convex_local_fan; lunar; INSERT_SUBSET]]);; + + + + +let NOT_INTERSECTION_BWT_AFF_GTS = prove_by_refinement +(` convex_local_fan (V,E,FF) /\ lunar (v,w) V E +==> aff_gt {vec 0, v} {rho_node1 FF w} INTER aff_gt {vec 0, v} {rho_node1 FF v} = {}`, +[NHANH NOT_COLL_RHONODE_SND_POINT; +NHANH NEXT_OPOSITE_POINT_IS_NOT_IN_AFF_GT; + +REWRITE_TAC[convex_local_fan; lunar; INSERT_SUBSET]; +STRIP_TAC; +ASSUME_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE2; +DOWN THEN DOWN THEN PHA; +NHANH Fan.th3a; +SIMP_TAC[AFF_GT_2_1; INTER_EQ_EM_EXPAND; IN_ELIM_THM]; +REPEAT STRIP_TAC; +DOWN THEN ASM_REWRITE_TAC[GSYM ITER; ADD1]; +STRIP_TAC; +ASSUME_TAC2 (ISPECL [` ITER (i + 1) (rho_node1 FF) v `;` vec 0:real^3`;` v:real^3`;`rho_node1 FF v`;` t1':real` ;` t1:real`;` t2':real`;` t2:real`;`t3':real`;` t3:real`] (GEN_ALL FOR_AFF_GT_NOT_INTERSECTION)); +DOWN THEN STRIP_TAC; + + +UNDISCH_TAC` ~(ITER (i + 1) (rho_node1 FF) v IN aff_gt {vec 0, v} {rho_node1 FF v}) `; +ASM_SIMP_TAC[AFF_GT_2_1; IN_ELIM_THM]; +EXISTS_TAC` (t1' - t1) / t3 `; +EXISTS_TAC` (t2' - t2) / t3 `; +EXISTS_TAC` t3' / t3 `; +ASM_REWRITE_TAC[]]);; + + +let LUNAR_COMM = prove(` lunar (v,w) V E <=> lunar (w,v) V E `, +SIMP_TAC[EQ_SYM_EQ; lunar; INSERT_COMM]);; + + + + +let CONV0_AFF_GT_EQ = prove_by_refinement +(` x:real^N IN conv0 {a,b} /\ ~( collinear {a,x,v}) +==> aff_gt {x,a} {v} = aff_gt {x,a,b} {v}`, +[NHANH IN_CONV0_IMP_COLL_ENDS_AFF; +NHANH IN_CONV0_IMP_AFF_EQ; +REWRITE_TAC[IN_ELIM_THM]; +NHANH Fan.th3a; +REPEAT STRIP_TAC; +REWRITE_TAC[GSYM SUBSET_ANTISYM_EQ]; +CONJ_TAC; +MATCH_MP_TAC AFF_GT_MONO_LEFT; +SET_TAC[]; +SUBGOAL_THEN` b IN aff {a,b:real^N}` MP_TAC; +REWRITE_TAC[Planarity.POINT_IN_LINE1]; +SUBGOAL_THEN` ~ collinear {b,x,v:real^N}` MP_TAC; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[]; +NHANH Fan.th3a; +STRIP_TAC; +ASSUME_TAC2 (SET_RULE` DISJOINT {a, x} {v} /\ DISJOINT {b,x} {v:real^N} +==> DISJOINT {x,a,b} {v}`); +DOWN; +UNDISCH_TAC` DISJOINT {a, x} {v:real^N}`; +SIMP_TAC[AFF_GT_2_1; INSERT_COMM; AFF_GT_3_1; SUBSET; IN_ELIM_THM]; +REPEAT STRIP_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` b IN aff {a,b:real^N}`; +ASM_REWRITE_TAC[]; +REWRITE_TAC[AFF2; IN_ELIM_THM]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +EXISTS_TAC` t1 + t3 * ( &1 - t ) `; +EXISTS_TAC` t2 + t3 * t `; +EXISTS_TAC` t4:real`; +ASM_REWRITE_TAC[]; +CONJ_TAC; +UNDISCH_TAC` t1 + t2 + t3 + t4 = &1 `; +REAL_ARITH_TAC; +VECTOR_ARITH_TAC]);; + + + + + + + + +let AFF_GT_SAME_WITH_ENDS = prove_by_refinement +(` convex_local_fan (V,E,FF) /\ lunar (v,w) V E +==> aff_gt {vec 0, v} {rho_node1 FF w} = aff_gt {vec 0, w} {rho_node1 FF w }`, +[NHANH LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI; +NHANH NOT_COLL_RHONODE_SND_POINT; +REWRITE_TAC[lunar; INSERT_SUBSET; convex_local_fan]; +STRIP_TAC; +SUBGOAL_THEN` ~ collinear {vec 0, w, rho_node1 FF w }` ASSUME_TAC; +MATCH_MP_TAC LOCAL_FAN_CHARACTER_OF_RHO_NODE2; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` aff_gt {vec 0, v} {rho_node1 FF w} = aff_gt {vec 0, v, w} {rho_node1 FF w}` SUBST1_TAC; +MATCH_MP_TAC CONV0_AFF_GT_EQ; +UNDISCH_TAC` ~collinear {vec 0, v, rho_node1 FF w} `; +ASM_SIMP_TAC[INSERT_COMM]; +SUBGOAL_THEN` aff_gt {vec 0, w} {rho_node1 FF w} = aff_gt {vec 0, w, v} {rho_node1 FF w}` SUBST1_TAC; +MATCH_MP_TAC CONV0_AFF_GT_EQ; +UNDISCH_TAC` ~collinear {vec 0, w, rho_node1 FF w} `; +ASM_SIMP_TAC[INSERT_COMM]; +SIMP_TAC[INSERT_COMM]]);; + + + + +let CRAZY_THMMM = prove_by_refinement +(` w:real^N IN aff {b,c} /\ z IN aff_gt {b,c} {w} +==> z IN aff {b,c} `, +[ASM_CASES_TAC` DISJOINT {b,c} {w:real^N}`; +ASM_SIMP_TAC[AFF_GT_2_1; IN_ELIM_THM; AFF2]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +EXISTS_TAC` t1 + t3 * t `; +UNDISCH_TAC` t1 + t2 + t3 = &1 `; +SIMP_TAC[REAL_ARITH` a + b = &1 <=> a = &1 - b `]; +DISCH_TAC; +VECTOR_ARITH_TAC; +DOWN; +REWRITE_TAC[SET_RULE`~DISJOINT {b, c} {w} <=> w = b \/ w = c`]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +MP_TAC (SPECL [`{b,c:real^N}`;` {b:real^N}`] (GEN_ALL (REWRITE_RULE[SUBSET_REFL; + DIFF_EQ_EMPTY; AFF_GT_EQ_AFFINE_HULL] (SPEC `Y:real^N -> bool` AFF_GT_MONO)))); +REWRITE_TAC[aff; SET_RULE` {a,b} UNION {a} = {a,b}`]; +SET_TAC[]; +ASM_REWRITE_TAC[]; +MP_TAC (SPECL [`{b,c:real^N}`;` {c:real^N}`] (GEN_ALL (REWRITE_RULE[SUBSET_REFL; + DIFF_EQ_EMPTY; AFF_GT_EQ_AFFINE_HULL] (SPEC `Y:real^N -> bool` AFF_GT_MONO)))); +REWRITE_TAC[aff; SET_RULE` {a,b} UNION {b} = {a,b}`]; +SET_TAC[]]);; + + + + +let USEFULL_THHM = prove_by_refinement +(`(z:real^N) IN aff {b, c} /\ z IN aff_gt {b, c} {w} ==> w IN aff {b, c}`, +[ASM_CASES_TAC` DISJOINT {b,c} {w:real^N}`; +ASM_SIMP_TAC[AFF_GT_2_1; IN_ELIM_THM; AFF2]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +DOWN; +ASM_REWRITE_TAC[VECTOR_ARITH` a = x + y + c % z <=> c % z = a - x - y`]; +ASSUME_TAC2 (REAL_ARITH` &0 < t3 ==> ~(t3 = &0) `); +ASM_SIMP_TAC[Ldurdpn.VECTOR_SCALE_CHANGE; VECTOR_ADD_LDISTRIB; VECTOR_SUB_LDISTRIB; VECTOR_MUL_ASSOC; REAL_ARITH` &1 / a * b = b / a `]; +STRIP_TAC; +EXISTS_TAC` t / t3 - t1 / t3 `; +UNDISCH_TAC` t1 + t2 + t3 = &1 `; +SIMP_TAC[REAL_ARITH` a + b = &1 <=> a = &1 - b `; REAL_ARITH` (a - ( b + c )) / t = a / t - b / t - c / t `]; +ASM_SIMP_TAC[REAL_FIELD` ~( a = &0 ) ==> a / a = &1 `]; +DISCH_TAC; +VECTOR_ARITH_TAC; +DOWN; +REWRITE_TAC[SET_RULE` ~ DISJOINT {a,b} {x} <=> x = a \/ x = b `]; +MESON_TAC[Planarity.POINT_IN_LINE; Planarity.POINT_IN_LINE1]]);; + + + + + +let COLL_IN_AFF_GT_TOO = prove(` ~ collinear {x,y,z} /\ a IN aff_gt {x,y} {z} +==> ~ collinear {x,y,a}`, +REWRITE_TAC[collinear_fan22; DE_MORGAN_THM] THEN +SIMP_TAC[] THEN MESON_TAC[USEFULL_THHM]);; + + + + +let AFF_GT_IN_IMP_SUBSET = prove_by_refinement +(`~collinear {x, y, z:real^N} /\ a IN aff_gt {x, y} {z} +==> aff_gt {x,y} {a} SUBSET aff_gt {x,y} {z}`, +[NHANH COLL_IN_AFF_GT_TOO; +NHANH Fan.th3a; +STRIP_TAC; +UNDISCH_TAC` a IN aff_gt {x,y} {z:real^N} `; +ASM_SIMP_TAC[AFF_GT_2_1; IN_ELIM_THM; SUBSET]; +REPEAT STRIP_TAC; +ASM_REWRITE_TAC[]; +EXISTS_TAC`t1' + t3' * t1 `; +EXISTS_TAC` t2' + t3' * t2 `; +EXISTS_TAC` t3' * t3 `; +CONJ_TAC; +MATCH_MP_TAC REAL_LT_MUL; +ASM_REWRITE_TAC[]; +CONJ_TAC; +ASM_REWRITE_TAC[REAL_ARITH` (t1' + t3' * t1) + (t2' + t3' * t2) + t3' * t3 += t1' + t2' + t3' * ( t1 + t2 + t3 ) `; REAL_MUL_RID]; +VECTOR_ARITH_TAC]);; + + + + +let FOR_AFF_GT_NOT_INTERSECTION2 = +let t = SPECL [` &0:real`;` &0`;`&1 `] (GENL [`a2:real`;` b2:real`;`tt:real`] + FOR_AFF_GT_NOT_INTERSECTION) in REWRITE_RULE[VECTOR_MUL_LZERO; VECTOR_ADD_LID; + VECTOR_MUL_LID; REAL_ADD_LID; REAL_ARITH` &0 < &1 /\ a - &0 = a`] t;; + + + + +let INVS_IN_AFF_GT = prove_by_refinement +(` ~collinear {x:real^N, y, z} /\ a IN aff_gt {x, y} {z} +==> z IN aff_gt {x,y} {a} `, +[NHANH COLL_IN_AFF_GT_TOO; +PHA THEN IMP_TAC; +NHANH Fan.th3a; +SIMP_TAC[AFF_GT_2_1; IN_ELIM_THM]; +REPEAT STRIP_TAC; +UNDISCH_TAC` t1 + t2 + t3 = &1 `; +UNDISCH_TAC` &0 < t3 `; +SWITCH_TAC` a = t1 % x + t2 % y + t3 % (z:real^N)`; +DOWN; +PHA; +NHANH FOR_AFF_GT_NOT_INTERSECTION2; +MESON_TAC[]]);; + + + + + + +let COLL_IN_AFF_GT_AFF_GT_EQ = prove( +` ~collinear {x:real^N, y, z} /\ a IN aff_gt {x, y} {z} +==> aff_gt {x,y} {z} = aff_gt {x,y} {a} `, +NHANH INVS_IN_AFF_GT THEN NHANH COLL_IN_AFF_GT_TOO THEN +NHANH AFF_GT_IN_IMP_SUBSET THEN PHA THEN +NHANH AFF_GT_IN_IMP_SUBSET THEN SIMP_TAC[GSYM SUBSET_ANTISYM_EQ]);; + + + + + + + + +let NEXT_OPOSITE_POINT_IS_NOT_IN_AFF_GT2 = prove_by_refinement +(`convex_local_fan (V,E,FF) /\ lunar (v,w) V E +==> (?i. w = ITER i (rho_node1 FF) v /\ + i + 1 < CARD V /\ + ~( i = 0 ) /\ ~( i = 1 ) /\ + ~(ITER (i + 1) (rho_node1 FF) v IN + aff_gt {vec 0, v} {rho_node1 FF v}))`, +[NHANH NEXT_OPOSITE_POINT_IS_NOT_IN_AFF_GT; +STRIP_TAC; +EXISTS_TAC` i:num`; +ASM_REWRITE_TAC[]; +CONJ_TAC; +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN_TAC; +REWRITE_TAC[lunar; ITER]; +STRIP_TAC; +UNDISCH_TAC` ~( v = w:real^3)`; +ASM_REWRITE_TAC[]; +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN_TAC; +REWRITE_TAC[lunar; ITER12; INSERT_SUBSET; convex_local_fan]; +STRIP_TAC; +UNDISCH_TAC` collinear {vec 0, v, w:real^3}`; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC LOCAL_FAN_CHARACTER_OF_RHO_NODE2; +ASM_REWRITE_TAC[]]);; + + + + +let LUNAR_IMP_HALF_CIRCLE_SUBSET_AFF_GT100 = prove_by_refinement +(`convex_local_fan (V,E,FF) /\ lunar (v,w) V E + ==> (?i. i < CARD V /\ ~( i = 0 ) /\ ~ ( i = 1 ) /\ + w = ITER i (rho_node1 FF) v /\ + {ITER l (rho_node1 FF) v | 0 < l /\ l < i} SUBSET + aff_gt {vec 0, v} {rho_node1 FF v})`, +[NHANH LUNAR_IMP_HALF_CIRCLE_SUBSET_AFF_GT; +STRIP_TAC; +EXISTS_TAC` i:num`; +ASM_REWRITE_TAC[]; +CONJ_TAC; +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN_TAC; +REWRITE_TAC[lunar; ITER]; +STRIP_TAC; +UNDISCH_TAC` ~( v = w:real^3)`; +ASM_REWRITE_TAC[]; +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN_TAC; +REWRITE_TAC[lunar; ITER12; INSERT_SUBSET; convex_local_fan]; +STRIP_TAC; +UNDISCH_TAC` collinear {vec 0, v, w:real^3}`; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC LOCAL_FAN_CHARACTER_OF_RHO_NODE2; +ASM_REWRITE_TAC[]]);; + + + + + + + +let IVS_RHO_IDD = prove(` local_fan (V,E,FF) /\ v IN V +==> ivs_rho_node1 FF ( rho_node1 FF v ) = v `, +NHANH LOCAL_FAN_RHO_NODE_PROS2 THEN STRIP_TAC THEN +DOWN THEN FIRST_X_ASSUM NHANH THEN REWRITE_TAC[ivs_rho_node1] THEN +ASM_MESON_TAC[PRE_IVS_RHO_NODE1_DETE]);; + + + + + +let AFF_IVS_RHO_NODE_EQQ = prove_by_refinement +(`convex_local_fan (V,E,FF) /\ lunar (v,w) V E +==> aff_gt {vec 0, w} {rho_node1 FF w} = aff_gt {vec 0, v} {ivs_rho_node1 FF v}`, +[NHANH AFF_GT_SAME_WITH_ENDS; +ONCE_REWRITE_TAC[LUNAR_COMM]; +NHANH LUNAR_IMP_HALF_CIRCLE_SUBSET_AFF_GT100; +STRIP_TAC; +FIRST_ASSUM (SUBST1_TAC o SYM); +MATCH_MP_TAC COLL_IN_AFF_GT_AFF_GT_EQ; + +ASSUME_TAC2 (ONCE_REWRITE_RULE[LUNAR_COMM] NOT_COLL_RHONODE_SND_POINT); +DOWN; +SIMP_TAC[]; +STRIP_TAC; +UNDISCH_TAC` {ITER l (rho_node1 FF) w | 0 < l /\ l < i} SUBSET + aff_gt {vec 0, w} {rho_node1 FF w}`; +ASM_REWRITE_TAC[SUBSET]; +DISCH_THEN MATCH_MP_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` i - 1 `; +MP_TAC2 (ARITH_RULE` ~( i = 0 ) /\ ~( i = 1 ) ==> 0 < i - 1 /\ i - 1 < i /\ +i = SUC ( i - 1 ) `); +SIMP_TAC[]; +STRIP_TAC; +FIRST_ASSUM SUBST1_TAC; +REWRITE_TAC[ITER; ARITH_RULE` SUC a - 1 = a `]; +MATCH_MP_TAC IVS_RHO_IDD; +UNDISCH_TAC` convex_local_fan (V,E,FF) `; +SIMP_TAC[convex_local_fan]; +NHANH LOCAL_FAN_ORBIT_MAP_V; +STRIP_TAC; +UNDISCH_TAC` lunar (w,v:real^3) V E `; +REWRITE_TAC[lunar; INSERT_SUBSET]; +STRIP_TAC; +UNDISCH_TAC` w:real^3 IN V `; +FIRST_X_ASSUM NHANH; +FIRST_X_ASSUM (NHANH_PAT`\x. x ==> y `); +STRIP_TAC; +EXPAND_TAC "V"; +REWRITE_TAC[lemma_in_orbit_iter]]);; + + + + + + + + + +let LOFA_IMP_LT_CARD_SET_V = prove( +`! v. local_fan (V,E,FF) /\ v IN V ==> {ITER n (rho_node1 FF) v | n < CARD V} = V`, +NHANH LOCAL_FAN_ORBIT_MAP_V THEN NHANH LOOP_SET_DETER_FIRTS_ELMS THEN +SIMP_TAC[]);; + + + + + + + + + +let NOT_COLL_IMP_NOT_AFF_SUB = prove( +`!v:real^N. ~ collinear {x,y,z} /\ v IN aff {x,y} ==> ~( v IN aff_gt {x,y} {z})`, +REPEAT STRIP_TAC THEN +ASSUME_TAC2 (ISPECL [`z:real^N`;`x:real^N`;`y:real^N`;` v:real^N`] (GEN_ALL +COLL_IN_AFF_GT_TOO)) THEN DOWN THEN +ASM_REWRITE_TAC[collinear_fan22]);; + + + + + + + +let HALP_CIRCLE_IS_INTERSECTION = prove_by_refinement +(` convex_local_fan (V,E,FF) /\ lunar (v,w) V E + ==> (?i. i < CARD V /\ + ~(i = 0) /\ + ~(i = 1) /\ + w = ITER i (rho_node1 FF) v /\ + {ITER l (rho_node1 FF) v | 0 < l /\ l < i} = + aff_gt {vec 0, v} {rho_node1 FF v} INTER V)`, +[NHANH LUNAR_IMP_HALF_CIRCLE_SUBSET_AFF_GT100; +ONCE_REWRITE_TAC[LUNAR_COMM]; +NHANH LUNAR_IMP_HALF_CIRCLE_SUBSET_AFF_GT100; +NHANH AFF_GT_SAME_WITH_ENDS; +REWRITE_TAC[convex_local_fan]; +NHANH LOFA_IMP_ITER_RHO_NODE_ID; +STRIP_TAC; +EXISTS_TAC` i':num`; +CONJ_TAC; +ASM_REWRITE_TAC[]; +CONJ_TAC; +ASM_REWRITE_TAC[]; +CONJ_TAC; +ASM_REWRITE_TAC[]; +CONJ_TAC; +FIRST_ASSUM ACCEPT_TAC; +REWRITE_TAC[GSYM SUBSET_ANTISYM_EQ; SUBSET_INTER]; +CONJ_TAC; +DOWN THEN SIMP_TAC[]; +SIMP_TAC[SUBSET; IN_ELIM_THM]; +REPEAT STRIP_TAC; +DOWN THEN SIMP_TAC[]; +ASSUME_TAC2 LOCAL_FAN_ORBIT_MAP_V; +UNDISCH_TAC` lunar (w,v:real^3) V E `; +REWRITE_TAC[lunar; IN_ELIM_THM; INSERT_SUBSET]; +FIRST_X_ASSUM (NHANH_PAT`\x. x ==> y`); +STRIP_TAC THEN DISCH_TAC; +EXPAND_TAC "V"; +REWRITE_TAC[lemma_in_orbit_iter]; +MP_TAC NOT_INTERSECTION_BWT_AFF_GTS; +ANTS_TAC; +REWRITE_TAC[convex_local_fan]; +CONJ_TAC; +CONJ_TAC; +FIRST_ASSUM ACCEPT_TAC; +FIRST_ASSUM ACCEPT_TAC; +ONCE_REWRITE_TAC[LUNAR_COMM]; +FIRST_ASSUM ACCEPT_TAC; +STRIP_TAC; + +SUBGOAL_THEN` v IN V /\ w:real^3 IN V ` MP_TAC; +UNDISCH_TAC` lunar (w,v:real^3) V E `; +SIMP_TAC[lunar; INSERT_SUBSET]; +STRIP_TAC; + +ASSUME_TAC2 LOFA_IMP_LT_CARD_SET_V; +REWRITE_TAC[SUBSET; IN_INTER]; +GEN_TAC THEN STRIP_TAC; +DOWN; +EXPAND_TAC "V"; +SIMP_TAC[IN_ELIM_THM]; +ASSUME_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE2; + +SUBGOAL_THEN` ~( v IN aff_gt {vec 0, v} {rho_node1 FF v})` ASSUME_TAC; +MATCH_MP_TAC NOT_COLL_IMP_NOT_AFF_SUB; + +DOWN; +SIMP_TAC[Planarity.POINT_IN_LINE1]; + +SUBGOAL_THEN ` convex_local_fan (V,E,FF) ` ASSUME_TAC; +REWRITE_TAC[convex_local_fan]; +CONJ_TAC; +FIRST_ASSUM ACCEPT_TAC; +FIRST_ASSUM ACCEPT_TAC; + + +SUBGOAL_THEN` ~collinear {vec 0, w, rho_node1 FF v}` ASSUME_TAC; +MATCH_MP_TAC NOT_COLL_RHONODE_SND_POINT; +ASM_REWRITE_TAC[]; + + +SUBGOAL_THEN` ~( w IN aff_gt {vec 0, w:real^3} {rho_node1 FF v})` ASSUME_TAC; +MATCH_MP_TAC NOT_COLL_IMP_NOT_AFF_SUB; +DOWN THEN SIMP_TAC[Planarity.POINT_IN_LINE1]; + +STRIP_TAC; +ASM_CASES_TAC` n = 0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN; +REWRITE_TAC[ITER]; +DISCH_THEN SUBST_ALL_TAC; + +UNDISCH_TAC` ~(v IN aff_gt {vec 0, v} {rho_node1 FF v})`; +UNDISCH_TAC` (v IN aff_gt {vec 0, v} {rho_node1 FF v})`; +SIMP_TAC[]; + + +ASM_CASES_TAC` n = i':num`; +FIRST_X_ASSUM SUBST_ALL_TAC; +SWITCH_TAC` x = ITER i' (rho_node1 FF) v `; +SWITCH_TAC` w = ITER i' (rho_node1 FF) v `; +SWITCH_TAC` v = ITER i (rho_node1 FF) w `; +UNDISCH_TAC` ~(w IN aff_gt {vec 0, w} {rho_node1 FF v}) `; + +ASM_REWRITE_TAC[]; +EXPAND_TAC "w"; +ASM_REWRITE_TAC[]; + + + +SWITCH_TAC` w = ITER i' (rho_node1 FF) v `; +SWITCH_TAC` v = ITER i (rho_node1 FF) w `; +UNDISCH_TAC` ~( n = i':num)`; +REWRITE_TAC[ARITH_RULE` ~( a = n:num) <=> a < n \/ n < a `]; +STRIP_TAC; +EXISTS_TAC` n:num`; +ASM_REWRITE_TAC[ARITH_RULE` 0 < n <=> ~( n = 0 ) `]; +SUBGOAL_THEN` x IN aff_gt {vec 0, v} {rho_node1 FF w}` ASSUME_TAC; +UNDISCH_TAC` {ITER l (rho_node1 FF) w | 0 < l /\ l < i} SUBSET + aff_gt {vec 0, w} {rho_node1 FF w} `; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (ONCE_REWRITE_RULE[LUNAR_COMM] AFF_GT_SAME_WITH_ENDS); +ASM_REWRITE_TAC[SUBSET]; +DISCH_THEN MATCH_MP_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` n:num - i'`; +CONJ_TAC; +CONJ_TAC; +UNDISCH_TAC` i' < n:num`; +ARITH_TAC; +ASM_CASES_TAC` n - i' < i:num`; +DOWN THEN REWRITE_TAC[]; +DOWN; +ASM_SIMP_TAC[ARITH_RULE` c < a ==> ( ~( a - c < b:num ) <=> b + c <= a )`]; +UNDISCH_TAC` n < CARD (V:real^3 -> bool) `; +PHA; +NHANH (ARITH_RULE` a < b /\ c <= a:num ==> c < b `); + +STRIP_TAC; +MP_TAC2 LOFA_IMP_DIS_ELMS23; +DISCH_THEN (MP_TAC o (SPECL [`0`;` (i:num) + i' `])); +ANTS_TAC; +ASM_SIMP_TAC[ARITH_RULE` ~ (a = 0 ) ==> 0 < a + b `]; + +ASM_REWRITE_TAC[ITER; GSYM ITER_ADD]; +ASSUME_TAC2 (ARITH_RULE` i' < n:num ==> n = n - i' + i'`); +ABBREV_TAC` ll = n - i':num`; +ASM_REWRITE_TAC[GSYM ITER_ADD]; + +UNDISCH_TAC` aff_gt {vec 0, v} {rho_node1 FF w} INTER + aff_gt {vec 0, v} {rho_node1 FF v} = + {} `; +REWRITE_TAC[INTER_EQ_EM_EXPAND; NOT_EXISTS_THM]; +DISCH_THEN (MP_TAC o (SPEC `x:real^3`)); +ASM_REWRITE_TAC[]]);; + + + + + + + + + + + + +let CONVEX_LOFA_IMP_INANGLE_LE_PI = prove_by_refinement +(`convex_local_fan (V,E,FF) /\ v IN V ==> interior_angle1 (vec 0) FF v <= pi `, +[REWRITE_TAC[convex_local_fan; azim_in_fan2]; +STRIP_TAC; +ASSUME_TAC2 EXISTS_INVERSE_OF_V; +DOWN THEN STRIP_TAC; +ASSUME_TAC2 LOFA_IMP_EE_TWO_ELMS; +ASSUME_TAC2 LOFA_CARD_EE_V_1; +ASSUME_TAC2 LOCAL_FAN_RHO_NODE_PROS2; +DOWN THEN STRIP_TAC; +UNDISCH_TAC` v:real^3 IN V `; +FIRST_ASSUM NHANH; +UNDISCH_TAC` !x. x IN FF + ==> (let d = azim_cycle (EE (FST x) E) (vec 0) (FST x) (SND x) in + if CARD (EE (FST x) E) > 1 + then azim (vec 0) (FST x) (SND x) d + else &2 * pi) <= + pi /\ + V SUBSET wedge_in_fan_ge x E`; +DISCH_THEN NHANH; +LET_TAC; +SWITCH_TAC` EE v E = {rho_node1 FF v, vv} `; +ASM_SIMP_TAC[ARITH_RULE` a = 2 ==> a > 1 `]; +STRIP_TAC; +DOWN THEN DOWN THEN PHA; + +ASSUME_TAC2 (SPEC `vv:real^3 ` (GEN` v:real^3 ` IVS_RHO_IDD)); +EXPAND_TAC "d"; +SIMP_TAC[]; +UNDISCH_TAC` {rho_node1 FF v, vv} = EE v E `; +DISCH_THEN (SUBST1_TAC o SYM); +EXPAND_TAC "v"; +DOWN; +SIMP_TAC[interior_angle1; GSYM ivs_rho_node1; AZIM_CYCLE_TWO_POINT_SET]]);; + + + + + + + +(* x IN aff_gt S {x} *) +let X_IN_AFF_GT_X = +let t = ISPECL [`S:real^N -> bool`;` {x:real^N}`] (GEN_ALL CONV0_SUBSET_AFF_GT) +in REWRITE_RULE[Geomdetail.CONV0_SING; INSERT_SUBSET; EMPTY_SUBSET] t;; + + + + + +let IVS_RNODE_IN_AFF_V = prove(`convex_local_fan (V,E,FF) /\ lunar (v,w) V E +==> ivs_rho_node1 FF w IN aff_gt {vec 0, v} {rho_node1 FF v}`, +ONCE_REWRITE_TAC[LUNAR_COMM] THEN NHANH AFF_IVS_RHO_NODE_EQQ THEN +MESON_TAC[X_IN_AFF_GT_X]);; + + + + + + + + +let AZIM_LE_PI_EQ_DIHV = prove(`~( collinear {a,b,x}) /\ ~ (collinear {a,b,y}) +==> azim a b x y <= pi ==> azim a b x y = dihV a b x y `, +DISCH_TAC THEN REWRITE_TAC[REAL_ARITH` a <= b <=> a = b \/ a < b `] THEN +STRIP_TAC THENL [DOWN THEN ASM_SIMP_TAC[AZIM_DIHV_EQ_PI]; +ASM_SIMP_TAC[AZIM_DIHV_SAME]]);; + + + + + +let LOFA_IMP_NOT_COLL_IVS = prove( +`!v. local_fan (V,E,FF) /\ v IN V ==> ~ collinear {vec 0,v,ivs_rho_node1 FF v}`, +NHANH EXISTS_INVERSE_OF_V THEN REPEAT STRIP_TAC THEN +DOWN THEN ASSUME_TAC2 (SPEC`vv:real^3 ` (GEN`v:real^3` LOCAL_FAN_CHARACTER_OF_RHO_NODE2)) THEN EXPAND_TAC "v" THEN +ASSUME_TAC2 (SPEC`vv:real^3 ` (GEN`v:real^3` IVS_RHO_IDD)) THEN +DOWN THEN DOWN THEN ASM_SIMP_TAC[INSERT_COMM]);; + + + + + + + +let DIHV_NOT_CHANGE = prove( +` &0 < c /\ a + b + c = &1 ==> dihV x y ( a % x + b % y + c % v ) w = dihV x y v w `, +SIMP_TAC[Trigonometry2.DIHV_FORMULAR; REAL_ARITH` a + b = &1 <=> a = &1 - b`; +VECTOR_ARITH` ((&1 - (b + c)) % x + b % y + c % v) - x = b % ( y - x ) + c % (v - x )`] THEN +SIMP_TAC[VECTOR_ADD_RDISTRIB; DOT_LADD; DOT_LMUL; VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; REAL_MUL_SYM] THEN +REWRITE_TAC[VECTOR_ARITH` (a + b ) - ( a + c ) = b - (c:real^N)`; GSYM VECTOR_MUL_ASSOC; GSYM VECTOR_SUB_LDISTRIB] THEN +ONCE_REWRITE_TAC[Trigonometry2.ARC_SYM] THEN +SIMP_TAC [GSYM Trigonometry2.WHEN_K_POS_ARCV_STABLE]);; + + + + +let LUNAR_IMP_INTERIOR_ANGLE_EQQ = prove_by_refinement +(`convex_local_fan (V,E,FF) /\ lunar (v,w) V E + ==> interior_angle1 (vec 0) FF v = interior_angle1 (vec 0) FF w `, +[NHANH IVS_RNODE_IN_AFF_V; +NHANH NOT_COLL_RHONODE_SND_POINT; +ONCE_REWRITE_TAC[LUNAR_COMM]; +NHANH IVS_RNODE_IN_AFF_V; +NHANH NOT_COLL_RHONODE_SND_POINT; + + +NHANH LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI; +REWRITE_TAC[lunar; INSERT_SUBSET]; +STRIP_TAC; +MP_TAC2 CONVEX_LOFA_IMP_INANGLE_LE_PI; +MP_TAC2 ( +SPEC `w:real^3 ` (GEN`v:real^3 ` CONVEX_LOFA_IMP_INANGLE_LE_PI)); + +REWRITE_TAC[interior_angle1; GSYM ivs_rho_node1]; + + +ASSUME_TAC2 CVX_LO_IMP_LO; +ASSUME_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE2; +ASSUME_TAC2 (SPEC `w:real^3 ` (GEN`v:real^3 ` LOCAL_FAN_CHARACTER_OF_RHO_NODE2)); +REPEAT DISCH_TAC; +SUBGOAL_THEN` azim (vec 0) v (rho_node1 FF v) (ivs_rho_node1 FF v) = +dihV (vec 0) v (rho_node1 FF v) (ivs_rho_node1 FF v)` MP_TAC; +DOWN; +MATCH_MP_TAC AZIM_LE_PI_EQ_DIHV; +ASM_SIMP_TAC[]; +MATCH_MP_TAC LOFA_IMP_NOT_COLL_IVS; +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN` azim (vec 0) w (rho_node1 FF w) (ivs_rho_node1 FF w) = +dihV (vec 0) w (rho_node1 FF w) (ivs_rho_node1 FF w)` MP_TAC; +DOWN; +REMOVE_TAC THEN DOWN; +MATCH_MP_TAC AZIM_LE_PI_EQ_DIHV; +ASM_SIMP_TAC[]; +MATCH_MP_TAC LOFA_IMP_NOT_COLL_IVS; +ASM_REWRITE_TAC[]; +DISCH_THEN SUBST1_TAC; +DISCH_THEN SUBST1_TAC; +UNDISCH_TAC` ~collinear {vec 0, v, rho_node1 FF v} `; +UNDISCH_TAC` ~collinear {vec 0, w, rho_node1 FF w} `; +PHA; +NHANH Fan.th3a; +NHANH AFF_GT_2_1; +STRIP_TAC; +UNDISCH_TAC` ivs_rho_node1 FF w IN aff_gt {vec 0, v} {rho_node1 FF v} `; +UNDISCH_TAC` ivs_rho_node1 FF v IN aff_gt {vec 0, w} {rho_node1 FF w} `; +ASM_REWRITE_TAC[IN_ELIM_THM]; +PHA THEN STRIP_TAC; +UNDISCH_TAC` vec 0 IN conv0 {w,v:real^3}`; +REWRITE_TAC[Collect_geom.CONV0_SET2; IN_ELIM_THM; VECTOR_ARITH` vec 0 = a + b % y <=> a = ( -- b ) % y `]; +STRIP_TAC; + +ONCE_REWRITE_TAC[Trigonometry2.DIHV_SYM]; + + + +SUBGOAL_THEN` dihV (vec 0) ( -- b % v ) (ivs_rho_node1 FF v) (rho_node1 FF v) = +dihV (vec 0) ( v ) (ivs_rho_node1 FF v) (rho_node1 FF v)` MP_TAC; +MATCH_MP_TAC DIHV_SPECIAL_SCALE; +ASM_SIMP_TAC[REAL_ARITH` &0 < b ==> ~( -- b = &0)`]; + + +SUBGOAL_THEN` dihV (vec 0) ( a % w ) (ivs_rho_node1 FF w) (rho_node1 FF w) = +dihV (vec 0) w (ivs_rho_node1 FF w) (rho_node1 FF w)` MP_TAC; +MATCH_MP_TAC DIHV_SPECIAL_SCALE; +ASM_SIMP_TAC[REAL_ARITH` &0 < b ==> ~(b = &0)`]; + +DISCH_THEN (SUBST1_TAC o SYM); +FIRST_ASSUM SUBST1_TAC; + +SUBGOAL_THEN` dihV (vec 0) ( -- b % v ) (ivs_rho_node1 FF w) (rho_node1 FF w) = +dihV (vec 0) ( v ) (ivs_rho_node1 FF w) (rho_node1 FF w)` MP_TAC; +MATCH_MP_TAC DIHV_SPECIAL_SCALE; +ASM_SIMP_TAC[REAL_ARITH` &0 < b ==> ~( -- b = &0)`]; +SIMP_TAC[]; +REMOVE_TAC; + + +DISCH_THEN (SUBST1_TAC o SYM); +FIRST_ASSUM (SUBST1_TAC o SYM); + +SUBGOAL_THEN` dihV (vec 0) ( a % w ) (ivs_rho_node1 FF v) (rho_node1 FF v) = +dihV (vec 0) ( w ) (ivs_rho_node1 FF v) (rho_node1 FF v)` MP_TAC; +MATCH_MP_TAC DIHV_SPECIAL_SCALE; +ASM_SIMP_TAC[REAL_ARITH` &0 < b ==> ~( b = &0)`]; + +SIMP_TAC[]; + + +ASM_SIMP_TAC[REWRITE_RULE[TAUT` a /\ b ==> c <=> a ==> b ==> c`] DIHV_NOT_CHANGE]; + +REMOVE_TAC; + + +SUBGOAL_THEN` dihV (vec 0) (a % w ) (rho_node1 FF w) (rho_node1 FF v) = +dihV (vec 0) w (rho_node1 FF w) (rho_node1 FF v)` MP_TAC; +MATCH_MP_TAC DIHV_SPECIAL_SCALE; +ASM_SIMP_TAC[REAL_ARITH` &0 < b ==> ~(b = &0)`]; +DISCH_THEN (SUBST1_TAC o SYM); +FIRST_X_ASSUM SUBST1_TAC; + +MP_TAC2 (REAL_ARITH` &0 < b ==> ~( -- b = &0 ) `); +SIMP_TAC[DIHV_SPECIAL_SCALE; Trigonometry2.DIHV_SYM]]);; + + + + + +let HKIRPEP = prove_by_refinement +(`convex_local_fan (V,E,FF) /\ lunar (v,w) V E + ==> (!u. u IN V DIFF {v, w} ==> interior_angle1 (vec 0) FF u = pi) /\ + &0 < interior_angle1 (vec 0) FF v /\ + interior_angle1 (vec 0) FF v <= pi /\ + interior_angle1 (vec 0) FF v = interior_angle1 (vec 0) FF w /\ + (?i. i < CARD V /\ + ~(i = 0) /\ + ~(i = 1) /\ + w = ITER i (rho_node1 FF) v /\ + {ITER l (rho_node1 FF) v | 0 < l /\ l < i} = + aff_gt {vec 0, v} {rho_node1 FF v} INTER V)/\ + (?j. j < CARD V /\ + ~(j = 0) /\ + ~(j = 1) /\ + v = ITER j (rho_node1 FF) w /\ + {ITER l (rho_node1 FF) w | 0 < l /\ l < j} = + aff_gt {vec 0, v} {ivs_rho_node1 FF v} INTER V)`, +[NHANH HALP_CIRCLE_IS_INTERSECTION; +NHANH LUNAR_IMP_INTERIOR_ANGLE_EQQ; +NHANH (GSYM AFF_IVS_RHO_NODE_EQQ); +ONCE_REWRITE_TAC[LUNAR_COMM]; +NHANH HALP_CIRCLE_IS_INTERSECTION; +NHANH LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI; +SIMP_TAC[INSERT_COMM; LUNAR_IMP_INTERIOR_ANGLE_EQQ]; +REWRITE_TAC[lunar; INSERT_SUBSET; INSERT_COMM]; +STRIP_TAC; +ASSUME_TAC2 CONVEX_LOFA_IMP_INANGLE_LE_PI; +ASSUME_TAC2 CVX_LO_IMP_LO; +MP_TAC2 INTERIOR_ANGLE1_POS; +STRIP_TAC; +UNDISCH_TAC` interior_angle1 (vec 0) FF v = interior_angle1 (vec 0) FF w `; +DISCH_THEN (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[]]);; + + + + +(* ============================ END ========================== *) +(* begin lemma EGHNAVX *) + + +let NEXT_PRO_IMP_ALLS = prove_by_refinement( +`!(le: A -> A -> bool). (! i. le (f i) ( f (i + 1) ))/\ +(! a b c. le a b /\ le b c ==> le a c ) +==> (! i j. i < j ==> le (f i ) ( f j )) `, +[GEN_TAC THEN STRIP_TAC; +GEN_TAC THEN INDUCT_TAC; +REWRITE_TAC[LT]; +REWRITE_TAC[ARITH_RULE` a < SUC b <=> a = b \/ a < b `]; +STRIP_TAC; +ASM_REWRITE_TAC[ADD1]; +DOWN; +FIRST_X_ASSUM NHANH; +REWRITE_TAC[ADD1]; +ASM_MESON_TAC[]]);; + + + +let FINITE_CARD1_IMP_SINGLETON = prove +(` FINITE (S:A -> bool) /\ CARD S = 1 ==> (? x. S = {x}) `, +ASM_CASES_TAC` S:A -> bool = {} ` THENL [ +ASM_REWRITE_TAC[CARD_CLAUSES; ARITH_RULE`~( 0 = 1 )`]; DOWN THEN +REWRITE_TAC[EMPTY_NOT_EXISTS_IN] THEN REPEAT STRIP_TAC THEN +EXISTS_TAC`x:A` THEN MATCH_MP_TAC Hypermap.set_one_point THEN +ASM_REWRITE_TAC[]]);; + + + + + + + + +let SURJ_IMP_FINITE = prove(` SURJ (f:A -> B) A B /\ FINITE A ==> FINITE B `, +NHANH_PAT`\x. x ==> y` FINITE_IMAGE THEN +NHANH Wrgcvdr_cizmrrh.SURJ_IMP_S2_EQ_IMAGE_S1 THEN +STRIP_TAC THEN DOWN THEN ASM_REWRITE_TAC[]);; + + + +let BIJ_FINITE_TOO = prove(` BIJ (f:A -> B) X Y /\ FINITE X ==> FINITE Y `, +REWRITE_TAC[BIJ] THEN PHA THEN NHANH SURJ_IMP_FINITE THEN SIMP_TAC[]);; + + + + +let EQ_IFF_IMP = MESON[]`(! a b. P a b <=> P b a ) <=> (! a b. P a b ==> P b a)`;; + + + + +let NOT_EMP_INJ_IMP_SURJ = prove_by_refinement +(`let f1 = (\y. if ?x. x IN X /\ f x = y then (@x. x IN X /\ f x = y ) + else (@x. x IN X)) +in + ~( X = {} ) /\ INJ (f:A -> B) X Y ==> SURJ f1 Y X`, +[LET_TAC; +REWRITE_TAC[INJ; SURJ; EXISTS_IN]; +STRIP_TAC; +CONJ_TAC; +REPEAT STRIP_TAC; +EXPAND_TAC "f1"; +ASM_CASES_TAC` ?x. x IN X /\ (f: A -> B) x = x' `; +ASM_REWRITE_TAC[]; +DOWN; +MESON_TAC[]; +ASM_MESON_TAC[]; +REPEAT STRIP_TAC; +EXISTS_TAC `(f: A -> B) x' `; +EXPAND_TAC "f1"; +ASM_MESON_TAC[]]);; + + + + + +let LOFA_V_NOT_EMP = prove(`local_fan (V,E, FF) ==> ~( V = {} )`, +REWRITE_TAC[local_fan; FAN; fan1] THEN LET_TAC THEN SET_TAC[]);; + + + + +let LOCAL_FAN_FINITE_V = prove(`local_fan (V,E,FF) ==> FINITE V`, +NHANH Wrgcvdr_cizmrrh.LOCAL_FAN_FINITE_FF THEN +NHANH LOFA_IMP_BIJ_FF_V THEN REWRITE_TAC[BIJ] THEN +PHA THEN NHANH SURJ_IMP_FINITE THEN SIMP_TAC[]);; + + + + + + +let ITER_CARD_MINUS1_EQ_IVS_RN1 = prove_by_refinement +(` local_fan (V,E,FF) ==> +(! v. v IN V ==> ITER (CARD V - 1) (rho_node1 FF) v = ivs_rho_node1 FF v)`, +[NHANH LOFA_IMP_ITER_RHO_NODE_ID; +STRIP_TAC; +FIRST_X_ASSUM NHANH; +REPEAT STRIP_TAC; +EXPAND_TAC "v"; +ASSUME_TAC2 LOFA_V_NOT_EMP; +ASSUME_TAC2 LOCAL_FAN_FINITE_V; +DOWN THEN NHANH CARD_EQ_0; +STRIP_TAC; +UNDISCH_TAC` ~(V:real^3 -> bool = {} )`; +FIRST_ASSUM (SUBST1_TAC o SYM); + +NHANH (ARITH_RULE`~( x = 0 ) ==> x = x - 1 + 1 `); +ABBREV_TAC` u = CARD (V:real^3 -> bool) -1`; +SIMP_TAC[GSYM ADD1; ITER]; +ASSUME_TAC2 LOCAL_FAN_ORBIT_MAP_VITER; +SUBGOAL_THEN` ITER u (rho_node1 FF) v IN V ` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +FIRST_ASSUM ACCEPT_TAC; +STRIP_TAC; +UNDISCH_TAC` ITER u (rho_node1 FF) v IN V`; +UNDISCH_TAC` local_fan (V,E,FF)`; +PHA; +NHANH IVS_RHO_IDD; +SIMP_TAC[]; +REWRITE_TAC[GSYM ITER]; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[]]);; + + + + + + + + +let FIRST_EQ0_LAST_LT_PI = prove_by_refinement +(`convex_local_fan (V,E,FF) /\ + v0 IN V /\ + CARD V = k /\ + (!i. ITER i (rho_node1 FF) v0 = vv i) /\ + (!i. azim (vec 0) v0 (vv 1) (vv i) = bta i) + ==> bta 1 = &0 /\ + bta (k - 1) <= pi `, +[REWRITE_TAC[convex_local_fan]; +NHANH ITER_CARD_MINUS1_EQ_IVS_RN1; +STRIP_TAC; +DOWN; +DOWN; +ONCE_REWRITE_TAC[GSYM EQ_SYM_EQ]; +SIMP_TAC[]; +REPEAT STRIP_TAC; +REWRITE_TAC[ITER12; AZIM_REFL]; +REWRITE_TAC[ITER12]; +EXPAND_TAC "k"; +ASM_SIMP_TAC[]; +ASSUME_TAC2 (REWRITE_RULE[convex_local_fan] (SPEC `v0:real^3 ` +(GEN `v:real^3 ` CONVEX_LOFA_IMP_INANGLE_LE_PI))); +DOWN; +REWRITE_TAC[interior_angle1; ivs_rho_node1]]);; + + + + + + + +let PROJEC_EQ_0_IFF_COLL = prove_by_refinement +(` projection e (x:real^N) = vec 0 <=> (?t. x = t % e ) `, +[EQ_TAC; +REWRITE_TAC[Wrgcvdr_cizmrrh.PROJECT_EQ_VEC0_IMP_PARALLED]; +STRIP_TAC; +ASM_REWRITE_TAC[projection]; +ASM_CASES_TAC`(e:real^N) = vec 0 `; +ASM_REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_SUB_REFL]; +DOWN; +SIMP_TAC[GSYM DOT_EQ_0; DOT_LMUL; REAL_FIELD` ~( x = &0) ==> (a * x ) / x = a `; VECTOR_SUB_REFL; DOT_LZERO]]);; + + + + + + + +let DETERMINE_WEDGE_IN_FAN = prove(` local_fan (V,E,FF) /\ x IN FF +==> wedge_in_fan_ge x E = wedge_ge (vec 0) (FST x) (SND x) + (azim_cycle (EE (FST x) E) (vec 0) (FST x) (SND x)) `, +REWRITE_TAC[wedge_in_fan_ge2] THEN COND_CASES_TAC THENL [ +REWRITE_TAC[]; PAT_ONCE_REWRITE_TAC`\x. y /\ x ==> z ` [GSYM PAIR] THEN +NHANH LOCAL_FAN_IMP_IN_V THEN ONCE_REWRITE_TAC[TAUT`(a/\b)/\c/\d <=> (a/\c)/\b/\d`] THEN +NHANH LOFA_CARD_EE_V_1 THEN +NHANH (ARITH_RULE` a = 2 ==> a > 1 `) THEN ASM_MESON_TAC[]]);; + + + + + +let LOCAL_FAN_IMP_IN_V2 = prove( +`local_fan (V,E,FF) /\ x IN FF ==> FST x IN V /\ SND x IN V`, +PAT_ONCE_REWRITE_TAC`\x. y /\ x ==> l` [GSYM PAIR] +THEN PURE_REWRITE_TAC[LOCAL_FAN_IMP_IN_V]);; + + + + + + + + + +let LOFA_DETERMINE_AZIM_IN_FA = prove(` local_fan (V,E,FF) /\ x IN FF +==> azim_in_fan x E = azim (vec 0) (FST x) (SND x) ( azim_cycle (EE (FST x) E) + (vec 0) (FST x) (SND x) ) `, +NHANH LOCAL_FAN_IMP_IN_V2 THEN STRIP_TAC THEN +UNDISCH_TAC` FST (x:real^3 # real^3) IN V` THEN +UNDISCH_TAC` local_fan (V,E,FF)` THEN PHA THEN +NHANH LOFA_CARD_EE_V_1 THEN +NHANH (ARITH_RULE` a = 2 ==> a > 1 `) THEN +REWRITE_TAC[azim_in_fan2] THEN LET_TAC THEN SIMP_TAC[]);; + + + + + + + + +let PRIOR_TO_LESS_THAN_PI_LEMMA = prove_by_refinement +(` convex_local_fan (V,E,FF) /\ v IN V +==> (! w. w IN V ==> azim (vec 0) v (rho_node1 FF v ) w <= +azim (vec 0) v (rho_node1 FF v) + (azim_cycle (EE v E) (vec 0) v (rho_node1 FF v)) ) `, +[REWRITE_TAC[convex_local_fan]; +NHANH LOCAL_FAN_RHO_NODE_PROS2; +STRIP_TAC; +SUBGOAL_THEN` v, rho_node1 FF v IN FF` ASSUME_TAC; +DOWN; +ASM_REWRITE_TAC[]; +DOWN; +UNDISCH_TAC` local_fan (V,E,FF)`; +PHA; +NHANH DETERMINE_WEDGE_IN_FAN; +FIRST_X_ASSUM NHANH; +STRIP_TAC; +UNDISCH_TAC` V SUBSET wedge_in_fan_ge (v,rho_node1 FF v) E `; +REWRITE_TAC[SUBSET]; +STRIP_TAC; +FIRST_ASSUM NHANH; +ASM_REWRITE_TAC[wedge_ge; IN_ELIM_THM]; +SIMP_TAC[]]);; + + + + + + + + +let IN_V_IMP_AZIM_LESS_PI = prove_by_refinement +(` convex_local_fan (V,E,FF) /\ v IN V +==> (! w. w IN V ==> azim (vec 0) v (rho_node1 FF v ) w <= pi ) `, +[NHANH PRIOR_TO_LESS_THAN_PI_LEMMA; +REWRITE_TAC[convex_local_fan]; +NHANH LOCAL_FAN_RHO_NODE_PROS2; +STRIP_TAC; +SUBGOAL_THEN` v, rho_node1 FF v IN FF` ASSUME_TAC; +DOWN; +REMOVE_TAC; +DOWN; +ASM_REWRITE_TAC[]; +DOWN; +UNDISCH_TAC` local_fan (V,E,FF)`; +PHA; +NHANH LOFA_DETERMINE_AZIM_IN_FA; +FIRST_X_ASSUM NHANH; +DOWN; +FIRST_X_ASSUM NHANH; +REPEAT STRIP_TAC; +ASM_REAL_ARITH_TAC]);; + + + + + + + +let NEXT_PRO_IMP_ALLS_STRICT = prove +(`! le. (! i. i + 1 < k ==> le ((f: num -> A) i) (f (i + 1))) /\ (! a b c. le a b /\ le b c ==> le a c ) +==> (! i j. i < j /\ j < k ==> le ( f i ) ( f j )) `, +GEN_TAC THEN STRIP_TAC THEN GEN_TAC THEN INDUCT_TAC THENL [ +REWRITE_TAC[LT]; REWRITE_TAC[ADD1]] THEN +UNDISCH_TAC` !i. i + 1 < k ==> le ((f:num -> A) i) (f (i + 1)) ` THEN +DISCH_THEN NHANH THEN REWRITE_TAC[ARITH_RULE` a < b + 1 <=> a < b \/ a = b `] +THEN NHANH (ARITH_RULE` a + 1 < b ==> a < b `) THEN ASM_MESON_TAC[]);; + + + + + + +let LOFA_IMP_V_DIFF = prove(` local_fan (V,E,FF) ==> +(! v. v IN V ==> ~( v = vec 0 )) `, +NHANH Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN THEN +NHANH FAN_IMP_V_DIFF THEN SIMP_TAC[]);; + + + + + +let SIN_AZIM_POS_PI_LT = prove( +` &0 <= sin (azim x y u v) <=> azim x y u v <= pi `, +REWRITE_TAC[REAL_ARITH` a <= b <=> ~( b < a )`; SIN_AZIM_NEG_PI_LT]);; + + + + + + + + + + +let SIN_AZIM_MUTUAL_SROSS = prove( +` ( sin (azim (vec 0) u v w) < &0 <=> (u cross v) dot w < &0 ) /\ +( &0 < sin (azim (vec 0) u v w) <=> &0 < (u cross v) dot w )`, +MP_TAC (SPEC_ALL Trigonometry2.JBDNJJB) THEN REWRITE_TAC[re_eqvl] THEN +STRIP_TAC THEN DOWN_TAC THEN +SIMP_TAC[REAL_LT_MUL_EQ; REAL_ARITH` a * b < &0 <=> &0 < a * --b `] THEN +REWRITE_TAC[REAL_ARITH` &0 < -- a <=> a < &0 `]);; + + + +let VECTOR_ADD_LDISTRIB1 = CONJ VECTOR_ADD_LDISTRIB VECTOR_MUL_ASSOC;; + + +let OPPOSITE_SIDES_IMP_INTER = prove_by_refinement ( +` (a:real^N) IN aff_gt {va, vb} {vc} /\ b IN aff_lt {va, vb} {vc} +/\ DISJOINT {va, vb} {vc} ==> ~(conv0 {a,b} INTER aff {va, vb} = {})`, +[NHANH Planarity.AFF_LT_2_1; +NHANH AFF_GT_2_1; +STRIP_TAC; +UNDISCH_TAC` a IN aff_gt {va, vb} {vc: real^N}`; +UNDISCH_TAC` b IN aff_lt {va, vb} {vc: real^N}`; +ASM_REWRITE_TAC[IN_ELIM_THM; Geomdetail.CONV0_SET2; + Collect_geom.AFF_2POINTS_INTERPRET; INTER_EQ_EM_EXPAND]; +REPEAT STRIP_TAC; +EXISTS_TAC` ( -- t3 ) / ( -- t3 + t3') % (a:real^N) + t3' / ( --t3 + t3') % b `; +CONJ_TAC; +EXISTS_TAC` --t3 / (--t3 + t3') `; +EXISTS_TAC` t3' / ( -- t3 + t3' )`; +REWRITE_TAC[ GSYM Geomdetail.SUM_TWO_RATIO]; +CONJ_TAC; +MATCH_MP_TAC REAL_LT_DIV; +UNDISCH_TAC` t3 < &0 `; +UNDISCH_TAC` &0 < t3' `; +PHA; +REAL_ARITH_TAC; + +CONJ_TAC; +MATCH_MP_TAC REAL_LT_DIV; +UNDISCH_TAC` t3 < &0 `; +UNDISCH_TAC` &0 < t3' `; +PHA; +REAL_ARITH_TAC; + + +UNDISCH_TAC` t3 < &0 `; +UNDISCH_TAC` &0 < t3' `; +PHA; +REAL_ARITH_TAC; + + +ASM_REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; GSYM (REAL_ARITH` +( x * a ) / b = ( a / b ) * x `); REAL_ARITH` -- a * b = -- (a * b)`; +VECTOR_ARITH` ( -- a / b ) % x = -- ((a / b ) % x ) `]; +SIMP_TAC[REAL_MUL_SYM]; +REWRITE_TAC[VECTOR_ARITH` -- (( a % va) + (b % vb) + x ) + +( aa % va + bb % vb + x ) = (-- a + aa ) % va + (-- b + bb ) % vb `]; + + + +EXISTS_TAC` (--((t1' * t3) / (--t3 + t3')) + (t1 * t3') / (--t3 + t3'))`; +EXISTS_TAC` (--((t2' * t3) / (--t3 + t3')) + (t2 * t3') / (--t3 + t3')) `; +REWRITE_TAC[]; + + +REWRITE_TAC[REAL_POLY_CONV `(--((t1' * t3) / (--t3 + t3')) + +(t1 * t3') / (--t3 + t3')) + --((t2' * t3) / (--t3 + t3')) + + (t2 * t3') / (--t3 + t3')`]; +REWRITE_TAC[ REAL_ARITH` -- &1 * x * y = ( -- x ) * y `; +REAL_ARITH` a * b * c = ( a * b ) * c `; +REAL_ARITH` a * x + b * x = (a + b) * x`]; +UNDISCH_TAC` t1 + t2 + t3 = &1 `; +UNDISCH_TAC` t1' + t2' + t3' = &1 `; +SIMP_TAC[ REAL_ARITH` a + b = &1 <=> a = &1 - b `; REAL_POLY_CONV` (&1 - (t2 + t3)) * t3' + + --(&1 - (t2' + t3')) * t3 + + t2 * t3' + + --t2' * t3 `]; +REPEAT STRIP_TAC; +MATCH_MP_TAC REAL_MUL_RINV; +ASM_REAL_ARITH_TAC]);; + + + + +let DISJOINT_DOUBLE_SING = SET_RULE` DISJOINT {a} {b} <=> ~( a = b ) `;; + + + +let AFF_IN_TWO_PARTS = prove_by_refinement ( +` aff {x,y:real^N} = aff_ge {x} {y} UNION aff_lt {x} {y}`, +[REWRITE_TAC[HALFLINE]; +ASM_CASES_TAC` x = y:real^N`; +ASM_REWRITE_TAC[AFF_XX_CASES; AFF2; UNION_EMPTY; FUN_EQ_THM; IN_ELIM_THM]; +GEN_TAC THEN EQ_TAC; +STRIP_TAC; +EXISTS_TAC `&1 `; +ASM_REWRITE_TAC[REAL_ARITH` &0 <= &1 `]; +CONV_TAC VECTOR_ARITH; +STRIP_TAC; +EXISTS_TAC` t:real`; +ASM_REWRITE_TAC[VECTOR_ADD_SYM]; +DOWN; +REWRITE_TAC[ GSYM DISJOINT_DOUBLE_SING]; +SIMP_TAC[AFF_LT_1_1; AFF2; EXTENSION; IN_UNION; IN_ELIM_THM]; +STRIP_TAC THEN GEN_TAC; +EQ_TAC; +STRIP_TAC; +ASM_CASES_TAC` &0 <= &1 - t`; +DISJ1_TAC; +EXISTS_TAC` &1 - t `; +ASM_REWRITE_TAC[REAL_ARITH` a - ( a - b ) = b `]; +DISJ2_TAC; +EXISTS_TAC` t:real`; +EXISTS_TAC` &1 - t `; +ASM_REWRITE_TAC[]; +ASM_REAL_ARITH_TAC; +MESON_TAC[REAL_ARITH` t = a - ( a - t ) `;REAL_ARITH` a + b = c <=> b = c - a `]]);; + + + + + + +let INTER_UNION_EMPTY = SET_RULE` X INTER (A UNION B) = {} <=> +X INTER A = {} /\ X INTER B = {}` + + + + +let CONV0_SUB_CONV = prove ( +` x IN conv0 S ==> x IN conv S`, +REWRITE_TAC[conv0; Collect_geom.conv; affsign; IN; sgn_gt; sgn_ge] +THEN MESON_TAC[REAL_ARITH` a < b ==> a <= b `]);; + + + + + +let MONO_AZIM_AS_BTA_I = prove_by_refinement +(`convex_local_fan (V,E,FF) /\ + v0 IN V /\ + CARD V = k /\ + (!v. v IN V /\ ~(v = v0) ==> ~collinear {vec 0, v0, v}) /\ + (!i. ITER i (rho_node1 FF) v0 = vv i) /\ + (!i. azim (vec 0) v0 (vv 1) (vv i) = bta i) +==> (!i j. i < j /\ j < k ==> bta i <= bta j) `, +[STRIP_TAC; +MATCH_MP_TAC NEXT_PRO_IMP_ALLS_STRICT; +REWRITE_TAC[REAL_LE_TRANS]; +DOWN_TAC THEN REWRITE_TAC[convex_local_fan]; +REPEAT STRIP_TAC; +ASSUME_TAC2 LOFA_IMP_V_DIFF; +UNDISCH_TAC` v0:real^3 IN V `; +FIRST_ASSUM NHANH; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +NHANH Trigonometry2.NOT_EQ_IMP_EXISTS_BASIC; +STRIP_TAC; +MP_TAC (SPECL [` vec 0:real^3 `;` v0:real^3 `;` (vv 1):real^3 `; +`(vv: num -> real^3) i `] azim); +STRIP_TAC; +FIRST_X_ASSUM MP_TAC; +SWITCH_TAC` ~( vec 0 = v0:real^3 )`; +DISCH_THEN ASSUME_TAC2; +DOWN; +STRIP_TAC; +MP_TAC (SPECL [` vec 0:real^3 `;` v0:real^3 `;` (vv 1):real^3 `; +`(vv: num -> real^3) (i +1) `] azim); +STRIP_TAC; +FIRST_X_ASSUM ASSUME_TAC2; +DOWN THEN STRIP_TAC; +DOWN_TAC; +REWRITE_TAC[VECTOR_SUB_RZERO]; +STRIP_TAC; + + +UNDISCH_TAC` vv 1 = (r1' * cos psi') % e1 + (r1' * sin psi') % e2 + h1' % (v0:real^3)`; +UNDISCH_TAC` vv 1 = (r1 * cos psi) % e1 + (r1 * sin psi) % e2 + h1 % v0:real^3`; +UNDISCH_TAC` orthonormal e1 e2 e3`; +PHA; +EXPAND_TAC "v0"; +REWRITE_TAC[VECTOR_MUL_ASSOC]; +NHANH (MESON[Trigonometry2.th]` orthonormal e1 e2 e3 /\ + x = t1 % e1 + t2 % e2 + t3 % e3 /\ + x = tt1 % e1 + tt2 % e2 + tt3 % e3 + ==> tt1 = t1 /\ tt2 = t2 /\ tt3 = t3`); +STRIP_TAC; + + + +SUBGOAL_THEN` ~collinear {vec 0, v0, vv 1:real^3}` ASSUME_TAC; +UNDISCH_TAC` !v. v IN V /\ ~(v = v0) ==> ~collinear {vec 0, v0, v:real^3} `; +DISCH_THEN MATCH_MP_TAC; +SWITCH_TAC` !i. ITER i (rho_node1 FF) v0 = vv i`; +FIRST_ASSUM (fun x -> REWRITE_TAC[x]); +ASSUME_TAC2 LOCAL_FAN_ORBIT_MAP_VITER; +CONJ_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +FIRST_ASSUM ACCEPT_TAC; + +ASSUME_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE; +REWRITE_TAC[ITER12]; +UNDISCH_TAC` v0 IN (V:real^3 -> bool)`; +FIRST_X_ASSUM NHANH; +SIMP_TAC[]; + +USE_FIRST` ~collinear {vec 0, v0, vv 1:real^3} ==> &0 < r1 ` ASSUME_TAC2; +USE_FIRST` ~collinear {vec 0, v0, vv 1:real^3} ==> &0 < r1' ` ASSUME_TAC2; + +ASSUME_TAC2 (SPECL [` r1': real`;` r1: real`;` psi': real`; `psi:real` ] + Trigonometry2.R_POS_SIN_COS_IDENT); +DOWN; +REWRITE_TAC[Trigonometry2.SIN_COS_IDEN_IFF_DIFFER_PERS]; +STRIP_TAC; + + + +SUBGOAL_THEN `vv (i:num) IN (V:real^3 -> bool) ` ASSUME_TAC; +SWITCH_TAC` !i. ITER i (rho_node1 FF) v0 = vv i `; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 LOCAL_FAN_ORBIT_MAP_VITER; +FIRST_X_ASSUM MATCH_MP_TAC; +FIRST_ASSUM ACCEPT_TAC; + +DOWN; +SUBGOAL_THEN` convex_local_fan (V,E,FF) ` MP_TAC; +ASM_REWRITE_TAC[convex_local_fan]; + + + + + +PHA; +NHANH IN_V_IMP_AZIM_LESS_PI; +STRIP_TAC; +UNDISCH_TAC` v0:real^3 IN V`; +FIRST_ASSUM NHANH; + + + +SUBGOAL_THEN` rho_node1 FF (vv (i:num)) = vv ( i + 1 ) ` ASSUME_TAC; +USE_FIRST` !i. ITER i (rho_node1 FF) v0 = vv i ` (fun x -> REWRITE_TAC[GSYM x]); +REWRITE_TAC[GSYM ADD1; ITER]; +FIRST_ASSUM SUBST1_TAC; +REWRITE_TAC[SYM SIN_AZIM_POS_PI_LT]; +REWRITE_TAC[REAL_ARITH` &0 <= a <=> ~( a < &0 ) `;SIN_AZIM_MUTUAL_SROSS ]; + +ABBREV_TAC` va = azim (vec 0) v0 (vv 1) (vv i) `; +ABBREV_TAC` vb = azim (vec 0) v0 (vv 1) (vv (i + 1 )) `; +ASM_REWRITE_TAC[]; + +ONCE_REWRITE_TAC[REAL_ADD_SYM]; +REWRITE_TAC[Trigonometry2.SIN_COS_PERIODIC_IN_WHOLE; REAL_ARITH` a + b + c = (a + b ) + c `]; +EXPAND_TAC "v0"; +REWRITE_TAC[CROSS_LADD; CROSS_RADD; VECTOR_MUL_ASSOC; CROSS_LMUL; CROSS_RMUL; + CROSS_REFL; VECTOR_MUL_RZERO; VECTOR_ADD_RID; DOT_LADD; DOT_LMUL; + DOT_RMUL;DOT_CROSS_SELF; Collect_geom.ZERO_NEUTRAL]; +STRIP_TAC; +DOWN; +REWRITE_TAC[DOT_LZERO; Collect_geom.ZERO_NEUTRAL]; +ASSUME_TAC2 ORTHONORMAL_CROSS; +ASM_REWRITE_TAC[]; +ONCE_REWRITE_TAC[CROSS_SKEW]; +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN` e3 dot (e3: real^3) = &1 ` ASSUME_TAC; +UNDISCH_TAC` orthonormal e1 e2 e3 `; +SIMP_TAC[orthonormal]; + + +ASM_REWRITE_TAC[DOT_LNEG; REAL_RING` (r2 * a) * (r2' * b) * &1 + + (r2 * aa) * (r2' * bb) * -- &1 += r2 * r2' * (b * a - bb * aa ) `; GSYM SIN_SUB]; +REWRITE_TAC[REAL_ARITH` (a + b ) - ( c + b ) = a - c `]; + + + + + +SUBGOAL_THEN` &0 < dist (v0, vec 0:real^3)` ASSUME_TAC; +ASM_REWRITE_TAC[GSYM DIST_NZ]; +ASM_CASES_TAC` i = 0 `; +USE_FIRST` !i. azim (vec 0) v0 (vv 1) (vv i) = bta (i:num)` +(fun x -> REWRITE_TAC[GSYM x]); + +USE_FIRST` i = 0 ` SUBST1_TAC; +USE_FIRST` !i. ITER i (rho_node1 FF) v0 = vv i` (fun x -> REWRITE_TAC[GSYM x]); +REWRITE_TAC[ITER; ITER12; GSYM ADD1; AZIM_SPEC_DEGENERATE; AZIM_REFL; REAL_LE_REFL]; + + + +SWITCH_TAC` vv (i:num) = + (r2 * cos (psi + va)) % e1 + (r2 * sin (psi + va)) % e2 + h2 % (v0:real^3)`; +SWITCH_TAC` vv (i + 1) = + (r2' * cos (psi' + vb)) % e1 + (r2' * sin (psi' + vb)) % e2 + h2' % (v0:real^3)`; +SWITCH_TAC` psi' = psi + real_of_int k' * &2 * pi `; + + +SUBGOAL_THEN` ~( vv i = v0:real^3 ) /\ ~(vv (i + 1 ) = v0 ) ` ASSUME_TAC; +UNDISCH_TAC` dist (v0:real^3,vec 0) % e3 IN (V:real^3 -> bool)`; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASSUME_TAC2 (SPEC `v0: real^3 ` (GEN `v:real^3 ` LOFA_IMP_DIS_ELMS23)); + +FIRST_ASSUM (MP_TAC o (SPECL [`0`;` i:num`])); + +PHA; +ANTS_TAC; +ASM_REWRITE_TAC[ARITH_RULE` 0 < i <=> ~( i = 0 ) `]; +UNDISCH_TAC` i + 1 < k `; +ARITH_TAC; + + + +FIRST_ASSUM (MP_TAC o (SPECL [`0`;` i + 1`])); +REWRITE_TAC[ARITH_RULE` 0 < i + 1 `]; +ASM_REWRITE_TAC[]; +USE_FIRST` !i. ITER i (rho_node1 FF) v0 = vv i ` (fun x -> REWRITE_TAC[GSYM x]); +SIMP_TAC[ITER]; + + +STRIP_TAC; +UNDISCH_TAC` (vv:num -> real^3) i IN V `; +UNDISCH_TAC` local_fan (V,E,FF) `; +PHA; +NHANH LOFA_IN_V_SO_DO_RHO_NODE_V; +ASM_REWRITE_TAC[]; +DOWN THEN DOWN THEN PHA THEN STRIP_TAC; +USE_FIRST` !v. v IN V /\ ~(v = v0) ==> ~collinear {vec 0, v0, v:real^3}` +(ASSUME_TAC2 o (SPEC` (vv:num -> real^3) i `)); + +USE_FIRST` !v. v IN V /\ ~(v = v0) ==> ~collinear {vec 0, v0, v:real^3}` +(ASSUME_TAC2 o (SPEC` (vv:num -> real^3) (i + 1) `)); +USE_FIRST` ~collinear {vec 0, v0, (vv: num -> real^3) i} ==> &0 < r2 ` ASSUME_TAC2; +USE_FIRST` ~collinear {vec 0, v0, (vv: num -> real^3) (i + 1 )} ==> &0 < r2' ` ASSUME_TAC2; + +UNDISCH_TAC` ~(dist (v0:real^3,vec 0) * r2 * r2' * sin (vb - va) < &0) `; +ASM_SIMP_TAC[REAL_LE_MUL_EQ; REAL_ARITH` ~( a < b ) <=> b <= a `]; + + + +MP_TAC (SPEC` v0:real^3 ` (GEN` v:real^3 ` IN_V_IMP_AZIM_LESS_PI)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` dist (v0:real^3,vec 0) % (e3:real^3) IN V`; +ASM_REWRITE_TAC[]; +DISCH_TAC; +FIRST_ASSUM (MP_TAC2 o (SPEC` (vv:num -> real^3) i `)); +FIRST_ASSUM (MP_TAC2 o (SPEC` (vv:num -> real^3) (i + 1 ) `)); +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN` rho_node1 FF v0 = vv 1` ASSUME_TAC; +SWITCH_TAC ` !i. ITER i (rho_node1 FF) v0 = vv i `; +DOWN; +SIMP_TAC[ITER12]; + + +FIRST_ASSUM (fun x -> REWRITE_TAC[x]); +USE_FIRST` !i. azim (vec 0) v0 (vv 1) (vv i) = bta i ` (fun x -> REWRITE_TAC[GSYM x]); +MP_TAC (SPECL [`vec 0:real^3 `;` v0:real^3 `;` (vv:num -> real^3) 1`; +` (vv:num -> real^3) i `] AZIM_RANGE); + +MP_TAC (SPECL [`vec 0:real^3 `;` v0:real^3 `;` (vv:num -> real^3) 1`; +` (vv:num -> real^3) (i + 1) `] AZIM_RANGE); +REWRITE_TAC[ASSUME` azim (vec 0) v0 (vv 1) (vv (i + 1)) = vb `; ASSUME` azim (vec 0) v0 (vv 1) (vv i) = va `]; + +PHA; +NHANH (REAL_ARITH` &0 <= vb /\ + vb < &2 * pi /\ + &0 <= va /\ + va < &2 * pi /\ + vb <= pi /\ + va <= pi /\ + &0 <= sin (vb - va) ==> vb - va <= pi /\ -- pi <= vb - va `); +STRIP_TAC; + + + +ASM_CASES_TAC ` ~(vb - va = -- pi) `; +ASM_CASES_TAC` vb - va < &0 `; +REPLICATE_TAC 3 DOWN THEN PHA; +REWRITE_TAC[REAL_ARITH` a <= b /\ ~( b = a ) /\ x < &0 <=> a < b /\ x < &0`]; +STRIP_TAC; +ASSUME_TAC2 (SPEC ` vb - (va:real)` Trigonometry1.SIN_NEGPOS_PI); +SUBGOAL_THEN` sin (vb - va ) < &0 ` ASSUME_TAC; +ASM_REWRITE_TAC[]; +ABBREV_TAC` xx = vb - va:real`; +UNDISCH_TAC` sin xx < &0 `; +UNDISCH_TAC` &0 <= sin xx `; +REAL_ARITH_TAC; + +DOWN; +REAL_ARITH_TAC; + +UNDISCH_TAC` &0 <= vb `; +UNDISCH_TAC` va <= pi `; +DOWN THEN PHA; +REWRITE_TAC[REAL_ARITH` vb - va = --pi /\ va <= pi /\ &0 <= vb <=> +vb = &0 /\ va = pi`]; +STRIP_TAC; + +UNDISCH_TAC` ~ collinear {vec 0, v0, vv (i + 1):real^3}`; +UNDISCH_TAC` ~ collinear {vec 0, v0, vv 1:real^3}`; +PHA; +NHANH AZIM_EQ_0_ALT; +STRIP_TAC; +UNDISCH_TAC` ~ collinear {vec 0, v0, vv (i: num) :real^3}`; +UNDISCH_TAC` ~ collinear {vec 0, v0, vv 1:real^3}`; +PHA; +NHANH AZIM_EQ_PI_ALT; +STRIP_TAC; +SWITCH_TAC` vv 1:real^3 = + (r1 * cos psi) % e1 + (r1 * sin psi) % e2 + (h1 * dist (v0:real^3,vec 0)) % e3`; +SWITCH_TAC`vv 1: real^3 = + (r1' * cos psi') % e1 + + (r1' * sin psi') % e2 + + (h1' * dist (v0: real^3,vec 0)) % e3`; +UNDISCH_TAC` va = pi `; +UNDISCH_TAC` vb = &0 `; +UNDISCH_TAC` azim (vec 0) v0 (vv 1) (vv (i + 1)) = &0 <=> + vv (i + 1) IN aff_gt {vec 0, v0} {vv 1}`; +UNDISCH_TAC`azim (vec 0) v0 (vv 1) (vv i) = pi <=> + vv i IN aff_lt {vec 0, v0} {vv 1} `; +ASM_SIMP_TAC[]; +ASSUME_TAC2 ( +ISPECL [` vec 0: real^3`;` v0: real^3`;` (vv:num -> real^3) 1` ] Fan.th3a) ; + +REPEAT STRIP_TAC; +ASSUME_TAC2 ( +ISPECL [` (vv:num -> real^3) 1 `;` (vv:num -> real^3) (i + 1)`; +` (vv:num -> real^3) i`;`vec 0: real^3`; ` v0: real^3`] (GEN_ALL OPPOSITE_SIDES_IMP_INTER)); +DOWN; +REWRITE_TAC[AFF_IN_TWO_PARTS; INTER_UNION_EMPTY; DE_MORGAN_THM]; +STRIP_TAC; +ASSUME_TAC (ISPECL [`{vec 0:real^3}`;`{(vv: num -> real^3) (i + 1), vv i }`] + + (GEN_ALL CONV_SUBSET_AFF_GE)); +(* ****************** *) + +ASSUME_TAC ( +ISPECL [`(vv: num -> real^3) (i + 1)`;` (vv:num -> real^3) i `] +Geomdetail.CONV02_SU_CONV2); +ASSUME_TAC2 LOCAL_FAN_RHO_NODE_PROS2; +DOWN THEN STRIP_TAC; +UNDISCH_TAC` (vv:num -> real^3) i IN V`; +FIRST_ASSUM NHANH; +STRIP_TAC; +DOWN; +UNDISCH_TAC ` local_fan (V,E,FF)`; +PHA; +NHANH LOCAL_FAN_IN_FF_IN_ORD_PAIRS2; +ASM_REWRITE_TAC[]; +NHANH Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN; +REWRITE_TAC[FAN; fan7]; +STRIP_TAC; +DOWN THEN DOWN; +FIRST_ASSUM (ASSUME_TAC o (ISPECL [`{v0:real^3}`;`{(vv: num -> real^3) i, +vv (i + 1)}`])); +STRIP_TAC; +SUBGOAL_THEN `{v0: real^3} IN E UNION {{v} | v IN V}` MP_TAC; + +UNDISCH_TAC`dist (v0: real^3,vec 0) % (e3:real^3) IN V`; +ASM_REWRITE_TAC[IN_UNION; IN_ELIM_THM]; +MESON_TAC[]; + + +REPEAT STRIP_TAC; +UNDISCH_TAC` {v0:real^3} IN E UNION {{v} | v IN V} /\ + {vv i, vv (i + 1)} IN E UNION {{v} | v IN V} + ==> aff_ge {vec 0} {v0} INTER aff_ge {vec 0} {vv i, vv (i + 1)} = + aff_ge {vec 0} ({v0} INTER {vv i, vv (i + 1)}) `; +ANTS_TAC; +DOWN THEN DOWN; +PHA; +SIMP_TAC[IN_UNION]; + +SUBGOAL_THEN `{v0: real^3} INTER {vv i, vv (i + 1)} = {}` SUBST1_TAC; +UNDISCH_TAC` ~(vv (i:num) = v0:real^3)`; +UNDISCH_TAC` ~(vv (i + 1) = v0:real^3)`; +REWRITE_TAC[Trigonometry2.INSERT_INTER_EMPTY; IN_INSERT; NOT_IN_EMPTY]; +MESON_TAC[]; + +REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING]; +UNDISCH_TAC` conv {vv (i + 1), (vv: num -> real^3) i} SUBSET +aff_ge {vec 0} {vv (i + 1), vv i}`; +UNDISCH_TAC` conv0 {vv (i + 1), (vv: num -> real^3) i} SUBSET +conv {vv (i + 1), (vv: num -> real^3) i}`; +PHA; +SIMP_TAC[INSERT_COMM]; +NHANH ( +SET_RULE`a SUBSET b /\ b SUBSET c /\ x INTER c = S ==> x INTER a SUBSET S`); +STRIP_TAC; +DOWN; +UNDISCH_TAC` ~(conv0 {vv (i + 1), vv i} INTER aff_ge {vec 0} {v0:real^3} = {})`; +PHA; +SIMP_TAC[INSERT_COMM; INTER_COMM; SET_RULE` ~( s = {}) /\ s SUBSET {x} <=> +s = {x}`]; + +NHANH (SET_RULE` A INTER B = {x} ==> x IN B`); +NHANH CONV0_SUB_CONV; +STRIP_TAC; +SUBGOAL_THEN` collinear {vec 0, (vv:num -> real^3) i, vv (i + 1)}` ASSUME_TAC; +ASM_REWRITE_TAC[Collect_geom.COLLINEAR_AS_IN_CONV2]; +ASSUME_TAC2 (SPEC `(vv:num -> real^3 ) i ` (GEN `v: real^3` + LOCAL_FAN_CHARACTER_OF_RHO_NODE2)); +DOWN; +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN` circular (V:real^3 -> bool) E ` MP_TAC; +REWRITE_TAC[circular]; +EXISTS_TAC` (vv: num -> real^3) (i + 1) `; +EXISTS_TAC` (vv: num -> real^3) i`; +EXISTS_TAC` v0: real^3`; + + + +ASSUME_TAC (ISPECL [`{vec 0:real^3}`;` {(vv:num -> real^3) (i + 1), vv i}`] + (GEN_ALL CONV0_SUBSET_AFF_GT)); +ASSUME_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE; +UNDISCH_TAC` (vv: num -> real^3) i IN V `; +FIRST_ASSUM (NHANH_PAT`\x. x ==> l`); +ASM_SIMP_TAC[ GSYM Wrgcvdr_cizmrrh.IN_E_IFF_IN_ORD_E; INSERT_COMM]; +STRIP_TAC; +UNDISCH_TAC` dist (v0:real^3,vec 0) % (e3:real^3) IN V`; +ASM_SIMP_TAC[]; +STRIP_TAC; +UNDISCH_TAC` conv0 {vv (i + 1), (vv i):real^3} SUBSET aff_gt {vec 0} {vv (i + 1), vv i}`; +UNDISCH_TAC` ~(conv0 {vv (i + 1), vv i} INTER aff_lt {vec 0} {v0:real^3} = {})`; +PHA; +SIMP_TAC[INSERT_COMM]; +CONV_TAC SET_RULE; + +STRIP_TAC; +ASSUME_TAC2 KCHMAMG; +DOWN THEN STRIP_TAC; + + + +ABBREV_TAC `U = {ITER n (rho_node1 FF) v0 | n <= i + 1} `; +ABBREV_TAC` ee = v0 cross rho_node1 FF v0`; +MP_TAC (SPECL [`v0: real^3`;`A:real^3 -> bool`;` ee:real^3`;`i + 1`] + (GENL [` v:real^3 `;`P:real^3 -> bool`;`e:real^3`;`l: num`] + SEQUENCE_OF_RHO_NODE_IS_SUC)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` dist (v0:real^3,vec 0) % (e3:real^3) IN V`; +ASM_SIMP_TAC[]; +STRIP_TAC; +MATCH_MP_TAC SUBSET_TRANS; +EXISTS_TAC`V:real^3 -> bool`; +ASM_REWRITE_TAC[]; +EXPAND_TAC "U"; +REWRITE_TAC[SUBSET; IN_ELIM_THM]; +ASSUME_TAC2 LOCAL_FAN_ORBIT_MAP_VITER; +DOWN THEN DOWN; +MESON_TAC[]; + + + +DISCH_THEN (MP_TAC o (SPECL [`ITER i (rho_node1 FF) v0`;` i:num`])); +ANTS_TAC; +REWRITE_TAC[ARITH_RULE` a < a + 1 `]; +DISCH_THEN (MP_TAC o (SPEC` v0:real^3`)); +ANTS_TAC; +EXPAND_TAC "U"; +ASM_REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC`0`; +UNDISCH_TAC` ! i. ITER i (rho_node1 FF) v0 = vv i`; +PAT_ONCE_REWRITE_TAC`\x. x ==> y ` [EQ_SYM_EQ]; +SIMP_TAC[ITER; LE_0]; + +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` &0 < sin ( azim (vec 0) ee v0 (vv (i + 1)))` ASSUME_TAC; +REWRITE_TAC[SIN_AZIM_MUTUAL_SROSS]; +UNDISCH_TAC` vv (i + 1) IN aff_gt {vec 0, v0: real^3} {vv 1}`; +ASM_SIMP_TAC[AFF_GT_2_1; IN_ELIM_THM]; +STRIP_TAC; +ONCE_REWRITE_TAC[CROSS_TRIPLE]; +ASM_REWRITE_TAC[CROSS_RADD; CROSS_RMUL; CROSS_REFL; CROSS_0; VECTOR_MUL_RZERO; + VECTOR_ADD_LID]; +UNDISCH_TAC` v0 cross rho_node1 FF v0 = ee`; +ASM_SIMP_TAC[DOT_LMUL]; +STRIP_TAC; +MATCH_MP_TAC REAL_LT_MUL; +ASM_REWRITE_TAC[DOT_POS_LT]; +EXPAND_TAC "ee"; +ASM_REWRITE_TAC[CROSS_EQ_0]; +DOWN; +NHANH (REAL_ARITH` &0 < x ==> &0 <= x `); +REWRITE_TAC[SIN_AZIM_POS_PI_LT]; +PHA; +NHANH (REAL_ARITH` a <= h /\ b < a ==> b <= h `); +REWRITE_TAC[GSYM SIN_AZIM_POS_PI_LT]; +REWRITE_TAC[REAL_ARITH` a <= b <=> ~( b < a)`; SIN_AZIM_MUTUAL_SROSS]; +STRIP_TAC; +DOWN; +UNDISCH_TAC` (vv:num -> real^3) i IN aff_lt {vec 0, v0} {vv 1}`; +ASM_SIMP_TAC[Planarity.AFF_LT_2_1; IN_ELIM_THM]; +STRIP_TAC; +ONCE_REWRITE_TAC[CROSS_TRIPLE]; +ASM_REWRITE_TAC[CROSS_RADD; CROSS_RMUL; CROSS_0; CROSS_REFL; VECTOR_MUL_RZERO; + VECTOR_ADD_LID; DOT_LMUL]; +UNDISCH_TAC` v0 cross rho_node1 FF v0 = ee`; +ASM_SIMP_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` &0 < ee dot (ee:real^3)` MP_TAC; +REWRITE_TAC[DOT_POS_LT]; +EXPAND_TAC "ee"; +REWRITE_TAC[CROSS_EQ_0]; +FIRST_X_ASSUM ACCEPT_TAC; +SIMP_TAC[REAL_LE_MUL_EQ; REAL_ARITH` ~( a < b) <=> b <= a`]; +ASM_SIMP_TAC[REAL_ARITH` a <= b <=> ~(b < a )`]]);; + + + + + + + +let SUCCESSIVE_RHO_NODE1_AFF_LT = prove_by_refinement +(` local_fan (V,E,FF) /\ + v IN V /\ + {ITER n (rho_node1 FF) v | n <= l} = U /\ + plane P /\ + vec 0 IN P /\ + U SUBSET P +==> ! i. 0 < i /\ i < l + ==> ITER (i - 1) (rho_node1 FF) v IN aff_lt {vec 0, ITER i (rho_node1 FF) v} {ITER (i + 1 ) (rho_node1 FF) v }`, +[STRIP_TAC; +ABBREV_TAC` e = v cross rho_node1 FF v `; +ASSUME_TAC2 RHO_NODE_SET_IN_A_PLANE_IMP_POS_DIRECT; +GEN_TAC; +FIRST_ASSUM (MP_TAC o (SPEC`i - 1 `)); +FIRST_ASSUM (MP_TAC o (SPEC`i:num `)); +REPEAT STRIP_TAC; +ASSUME_TAC2 LOCAL_FAN_ORBIT_MAP_VITER; +FIRST_ASSUM (MP_TAC o (SPECL [`v:real^3`;` i:num`])); +ANTS_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +STRIP_TAC; +ASSUME_TAC2 +(SPEC` ITER i (rho_node1 FF) v ` +(GEN` v: real^3` LOCAL_FAN_CHARACTER_OF_RHO_NODE2)); +DOWN; +SUBGOAL_THEN` {vec 0, ITER i (rho_node1 FF) v, rho_node1 FF (ITER i (rho_node1 FF) v)} SUBSET P` MP_TAC; +ASM_REWRITE_TAC[INSERT_SUBSET]; +REWRITE_TAC[GSYM INSERT_SUBSET]; +MATCH_MP_TAC SUBSET_TRANS; +EXISTS_TAC` U:real^3 -> bool`; +ASM_REWRITE_TAC[]; +EXPAND_TAC "U"; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_ELIM_THM; GSYM ITER]; +UNDISCH_TAC` i < l:num`; +MESON_TAC[ARITH_RULE` a < b:num ==> a <= b /\ SUC a <= b `]; +UNDISCH_TAC` plane (P:real^3 -> bool)`; +PHA; +NHANH THREE_NOT_COLL_DETER_PLANE; +STRIP_TAC; +SUBGOAL_THEN` ITER (i - 1) (rho_node1 FF) v IN P` ASSUME_TAC; +UNDISCH_TAC` U SUBSET (P:real^3 -> bool)`; +REWRITE_TAC[SUBSET]; +DISCH_THEN MATCH_MP_TAC; +EXPAND_TAC "U"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` i - 1 `; +UNDISCH_TAC` i < l:num`; +REWRITE_TAC[]; +CONV_TAC ARITH_RULE; + +DOWN; +EXPAND_TAC "P"; +REWRITE_TAC[AFFINE_HULL_3; IN_ELIM_THM]; +STRIP_TAC; +SUBGOAL_THEN` w < &0 ` ASSUME_TAC; +UNDISCH_TAC` i < l:num`; +NHANH (ARITH_RULE` a < b ==> a - 1 < b `); +UNDISCH_TAC` i < l + ==> &0 < + (ITER i (rho_node1 FF) v cross ITER (i + 1) (rho_node1 FF) v) dot e`; +DISCH_THEN NHANH; +UNDISCH_TAC` i - 1 < l + ==> &0 < + (ITER (i - 1) (rho_node1 FF) v cross + ITER (i - 1 + 1) (rho_node1 FF) v) dot + e`; +DISCH_THEN NHANH; +ASM_SIMP_TAC[ARITH_RULE` 0 < a ==> a - 1 + 1 = a `; GSYM ITER; ADD1; + CROSS_LADD; CROSS_LMUL; CROSS_0; CROSS_REFL]; +REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +STRIP_TAC; +DOWN; +ONCE_REWRITE_TAC[CROSS_SKEW]; +REWRITE_TAC[VECTOR_MUL_RNEG]; +REWRITE_TAC[GSYM VECTOR_MUL_LNEG; DOT_LMUL]; +ASM_SIMP_TAC[REAL_LT_MUL_EQ]; +REAL_ARITH_TAC; +UNDISCH_TAC`~collinear + {vec 0, ITER i (rho_node1 FF) v, rho_node1 FF + (ITER i (rho_node1 FF) v )}`; +NHANH Fan.th3a; +NHANH AFF_LT_2_1; +SIMP_TAC[ITER; GSYM ADD1; IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC` u:real`; +EXISTS_TAC` v': real`; +EXISTS_TAC`w:real`; +ASM_REWRITE_TAC[]]);; + + + + + + + +let IN_OPOSITE_SIDE_IMP_INTER = prove( +` b IN aff_lt {va, vb} {vc} /\ + DISJOINT {va, vb} {vc} + ==> ~(conv0 {vc, b} INTER aff {va, vb} = {})`, +NHANH DISJOINT_IMP_Z_IN_AFF_GT THEN STRIP_TAC THEN +MATCH_MP_TAC OPPOSITE_SIDES_IMP_INTER THEN ASM_REWRITE_TAC[]);; + + + + + + + +let TWO_SIDES_SUCESSIVE = prove_by_refinement +(` local_fan (V,E,FF) /\ + v IN V /\ + {ITER n (rho_node1 FF) v | n <= l} = U /\ + plane P /\ + vec 0 IN P /\ + U SUBSET P +==> ! i. 0 < i /\ i < l + ==> ~( conv0 { ITER (i - 1) (rho_node1 FF) v, ITER (i + 1 ) (rho_node1 FF) v } INTER aff {vec 0, ITER i (rho_node1 FF) v} = {} )`, +[NHANH SUCCESSIVE_RHO_NODE1_AFF_LT; +STRIP_TAC; +FIRST_ASSUM NHANH; +ASSUME_TAC2 LOCAL_FAN_ORBIT_MAP_VITER; +GEN_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPECL[`v:real^3`;`i:num`])); +ASSUME_TAC2 (SPEC`ITER i (rho_node1 FF) v ` (GEN `v:real^3 ` + LOCAL_FAN_CHARACTER_OF_RHO_NODE2)); +DOWN THEN NHANH Fan.th3a; +STRIP_TAC THEN STRIP_TAC; +ONCE_REWRITE_TAC[INSERT_COMM]; +MATCH_MP_TAC IN_OPOSITE_SIDE_IMP_INTER; +ONCE_REWRITE_TAC[INSERT_COMM]; +ASM_REWRITE_TAC[GSYM ADD1; ITER]]);; + + + + + + +let LOCAL_FAN_CHARACTER_OF_RHO_NODE3 = prove( +`local_fan (V,E,FF) /\ v IN V ==> +! i. ~ collinear {vec 0, ITER i (rho_node1 FF) v, ITER (i + 1) (rho_node1 FF) v}`, +NHANH LOCAL_FAN_ORBIT_MAP_VITER THEN STRIP_TAC THEN GEN_TAC THEN +FIRST_X_ASSUM (ASSUME_TAC2 o (SPECL [`v:real^3`;` i:num`])) THEN +REWRITE_TAC[GSYM ADD1; ITER] THEN +MATCH_MP_TAC LOCAL_FAN_CHARACTER_OF_RHO_NODE2 THEN +ASM_REWRITE_TAC[]);; + + + + + + + +let CNVX_IMP_INTERIOR_ANGLE_PI = prove_by_refinement +(` convex_local_fan (V,E,FF) /\ + v IN V /\ + {ITER n (rho_node1 FF) v | n <= l} = U /\ + plane P /\ + vec 0 IN P /\ + U SUBSET P +==> ! i. 0 < i /\ i < l + ==> interior_angle1 (vec 0) FF ( ITER i (rho_node1 FF) v) = pi `, +[STRIP_TAC; +ABBREV_TAC` e = v cross rho_node1 FF v `; +ASSUME_TAC2 CVX_LO_IMP_LO; +ASSUME_TAC2 TWO_SIDES_SUCESSIVE; +GEN_TAC; +DOWN THEN PHA; +STRIP_TAC; +DOWN THEN DOWN THEN PHA; +FIRST_ASSUM NHANH; +ONCE_REWRITE_TAC[INTER_COMM]; +STRIP_TAC; +SUBGOAL_THEN` {ITER (i + 1) (rho_node1 FF) v, ITER (i - 1) (rho_node1 FF) v} + INTER aff {vec 0, ITER i (rho_node1 FF) v} = {} ` ASSUME_TAC; +ASSUME_TAC2 LOCAL_FAN_ORBIT_MAP_VITER; +FIRST_ASSUM (MP_TAC o (SPECL [`v:real^3`;`i - 1 `])); +FIRST_ASSUM (MP_TAC o (SPECL [`v:real^3`;`i:num `])); +REPLICATE_TAC 2 (DISCH_THEN ASSUME_TAC2); +ASSUME_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE3; +FIRST_ASSUM (MP_TAC o (SPEC`i - 1 `)); +FIRST_ASSUM (MP_TAC o (SPEC`i:num`)); +STRIP_TAC; +ASSUME_TAC2 (ARITH_RULE`0 < i ==> i - 1 + 1 = i`); +DOWN; +SIMP_TAC[Collect_geom.PER_SET2]; +DOWN; +NHANH Fan.th3c; +SIMP_TAC[Collect_geom.PER_SET2]; +REPEAT STRIP_TAC; +ABBREV_TAC` a1 = ITER (i - 1) (rho_node1 FF) v`; +ABBREV_TAC` a2 = ITER i (rho_node1 FF) v`; +ABBREV_TAC` a3 = ITER (i + 1) (rho_node1 FF) v`; +UNDISCH_TAC` ~(a3 IN aff {a2, vec 0:real^3})`; +UNDISCH_TAC` ~(a1 IN aff {a2, vec 0: real^3})`; +SET_TAC[]; + +ABBREV_TAC` w = ITER (i - 1) (rho_node1 FF) v`; +ABBREV_TAC` vv = ITER i (rho_node1 FF) v`; +ABBREV_TAC` u = ITER (i + 1) (rho_node1 FF) v`; +SUBGOAL_THEN` interior_angle1 (vec 0) FF vv = pi /\ + rho_node1 FF vv IN P /\ + ivs_rho_node1 FF vv IN P ` MP_TAC; +MATCH_MP_TAC OZQVSFF; +EXISTS_TAC` u: real^3`; +EXISTS_TAC` w:real^3`; +DOWN_TAC; +SIMP_TAC[Collect_geom.PER_SET2]; +STRIP_TAC; +ASSUME_TAC2 LOCAL_FAN_ORBIT_MAP_VITER; +CONJ_TAC; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +FIRST_ASSUM (ASSUME_TAC2 o (SPECL [`v:real^3`;` i - 1 `])); +FIRST_ASSUM (ASSUME_TAC2 o (SPECL [`v:real^3`;` i: num `])); +FIRST_ASSUM (ASSUME_TAC2 o (SPECL [`v:real^3`;` i + 1 `])); +REPLICATE_TAC 3 DOWN THEN PHA; +EXPAND_TAC "u"; +EXPAND_TAC "vv"; +EXPAND_TAC "w"; +SIMP_TAC[]; + +ONCE_REWRITE_TAC[INSERT_SUBSET]; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC SUBSET_TRANS; +EXISTS_TAC`U:real^3 -> bool`; +ASM_REWRITE_TAC[]; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +EXPAND_TAC "U"; +EXPAND_TAC "u"; +EXPAND_TAC "vv"; +EXPAND_TAC "w"; +REWRITE_TAC[IN_ELIM_THM]; +UNDISCH_TAC` i < l:num`; +NHANH (ARITH_RULE` a < b:num ==> a <= b /\ a - 1 <= b /\ a + 1 <= b`); +MESON_TAC[]; +SIMP_TAC[]]);; + + +let INSERT_UNION2 = SET_RULE` (x INSERT S) UNION U = S UNION (x INSERT U)`;; + + + + +let EGHNAVX = prove_by_refinement +(`convex_local_fan (V,E,FF) /\ + v0 IN V /\ + CARD V = k /\ + (!v. v IN V /\ ~(v = v0) ==> ~collinear {vec 0, v0, v}) /\ + (!i. ITER i (rho_node1 FF) v0 = vv i) /\ + (!i. azim (vec 0) v0 (vv 1) (vv i) = bta i) + ==> bta 1 = &0 /\ + bta (k - 1) <= pi /\ + (!i j. i < j /\ j < k ==> bta i <= bta j) /\ + (bta i = &0 /\ i < k + ==> (!j. 0 < j /\ j < i ==> interior_angle1 (vec 0) FF (vv j) = pi) /\ + {vv k | 0 < k /\ k <= i} SUBSET aff_gt {vec 0, v0} {vv 1}) /\ + (bta i = bta (k - 1) /\ 0 < i /\ i < k - 1 + ==> (!j. i < j /\ j < k ==> interior_angle1 (vec 0) FF (vv j) = pi) /\ + {vv n | i <= n /\ n < k} SUBSET aff_gt {vec 0, v0} {vv (k - 1)})`, +[NHANH MONO_AZIM_AS_BTA_I; +STRIP_TAC; +ASSUME_TAC2 FIRST_EQ0_LAST_LT_PI; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 CVX_LO_IMP_LO; +ASSUME_TAC2 LOCAL_FAN_ORBIT_MAP_VITER; +ASSUME_TAC2 (SPEC` v0:real^3` (GEN`v:real^3` LOFA_IMP_DIS_ELMS23)); + +CONJ_TAC; +STRIP_TAC; +SUBGOAL_THEN` {vv k | 0 < k /\ k <= i} SUBSET aff_gt {vec 0, v0:real^3} {vv 1}` ASSUME_TAC; +REWRITE_TAC[SUBSET; IN_ELIM_THM]; +REPEAT STRIP_TAC; +SUBGOAL_THEN` azim (vec 0) v0 (vv 1) (vv k') = &0` ASSUME_TAC; +ASM_CASES_TAC` k' = i:num`; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` !i j. i < j /\ j < k ==> bta i <= (bta:num -> real) j`; + +DISCH_THEN (MP_TAC o (SPECL [`k': num`;` i: num`])); +ANTS_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` k' <= i:num`; +UNDISCH_TAC` ~( k' = i:num)`; +PHA; +ARITH_TAC; + +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` &0 <= azim (vec 0) v0 (vv 1) (vv k')` MP_TAC; +REWRITE_TAC[AZIM_RANGE]; + +ASM_REWRITE_TAC[]; +REAL_ARITH_TAC; + + + + +ASSUME_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` v0:real^3`)); +FIRST_ASSUM (MP_TAC o (SPECL [`0`;`k': num`])); +PHA; +ANTS_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` k' <= i:num`; +UNDISCH_TAC` i < k:num`; +ARITH_TAC; + +REWRITE_TAC[ITER]; +DOWN; +SUBGOAL_THEN` rho_node1 FF v0 = ITER 1 (rho_node1 FF) v0` MP_TAC; +REWRITE_TAC[ITER12]; +ASM_SIMP_TAC[]; + + +FIRST_ASSUM (ASSUME_TAC2 o (SPECL [`v0:real^3`;`1`])); +FIRST_ASSUM (ASSUME_TAC2 o (SPECL [`v0:real^3`;`k':num`])); +DOWN THEN DOWN; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +UNDISCH_TAC` !v. v IN V /\ ~(v = v0) ==> ~collinear {vec 0, v0, v:real^3}`; +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC`(vv:num -> real^3) 1 `)); +FIRST_ASSUM (ASSUME_TAC2 o (SPEC`(vv:num -> real^3) k' `)); +DOWN THEN DOWN THEN PHA; + +NHANH (GSYM AZIM_EQ_0_ALT); +SIMP_TAC[]; +ASM_REWRITE_TAC[]; + +ASSUME_TAC (ISPECL [`{vec 0, v0:real^3}`;` {(vv:num -> real^3) 1}`] + AFF_GT_SUBSET_AFFINE_HULL); +ASM_REWRITE_TAC[]; +UNDISCH_TAC` !i. ITER i (rho_node1 FF) v0 = vv i`; +STRIP_TAC; +FIRST_ASSUM (fun x -> REWRITE_TAC[GSYM x]); +MATCH_MP_TAC (GEN_ALL CNVX_IMP_INTERIOR_ANGLE_PI); +EXISTS_TAC`E:(real^3 -> bool) -> bool`; +EXISTS_TAC` V:real^3 -> bool`; +EXISTS_TAC`{ITER n (rho_node1 FF) v0 | n <= i}`; +EXISTS_TAC` affine hull ({vec 0, v0:real^3} UNION {vv 1})`; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (SPEC` v0:real^3` (GEN `v:real^3` + LOCAL_FAN_CHARACTER_OF_RHO_NODE2)); +CONJ_TAC; +REWRITE_TAC[INSERT_UNION2; UNION_EMPTY]; + +DOWN; +SUBGOAL_THEN` rho_node1 FF v0 = ITER 1 (rho_node1 FF) v0` ASSUME_TAC; +REWRITE_TAC[ITER12]; +ASM_REWRITE_TAC[plane]; +MESON_TAC[INSERT_COMM]; + +CONJ_TAC; +REWRITE_TAC[INSERT_UNION2; UNION_EMPTY]; +MESON_TAC[Trigonometry2.IN_P_HULL_INSERT; INSERT_COMM]; + + +REWRITE_TAC[SUBSET; IN_ELIM_THM]; +REPEAT STRIP_TAC; +ASM_CASES_TAC` n = 0 `; +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN` vv 0 = ITER 0 (rho_node1 FF) v0` MP_TAC; +ASM_REWRITE_TAC[]; +SIMP_TAC[ITER; Trigonometry2.IN_P_HULL_INSERT; INSERT_UNION2; UNION_EMPTY]; + + +SUBGOAL_THEN` x IN {(vv:num ->real^3) k | 0 < k /\ k <= i}` MP_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC`n:num`; +ASM_REWRITE_TAC[]; +DOWN; +ARITH_TAC; +UNDISCH_TAC` {vv k | 0 < k /\ k <= i} SUBSET aff_gt {vec 0, v0:real^3} {vv 1}`; +REWRITE_TAC[SUBSET]; +DISCH_THEN NHANH; +UNDISCH_TAC` aff_gt {vec 0, v0:real^3} {vv 1} SUBSET affine hull ({vec 0, v0} UNION {vv 1})`; +REWRITE_TAC[SUBSET]; +DISCH_THEN NHANH; +SIMP_TAC[INSERT_UNION2; UNION_EMPTY]; + + + + + + + +STRIP_TAC; +SUBGOAL_THEN` {vv n | i <= n /\ n < k} SUBSET aff_gt {vec 0, v0:real^3} {vv (k - 1)}` ASSUME_TAC; +REWRITE_TAC[SUBSET; IN_ELIM_THM]; +REPEAT STRIP_TAC; +SUBGOAL_THEN` azim (vec 0) v0 (vv 1) x = azim (vec 0) v0 (vv 1) (vv (k - 1))` ASSUME_TAC; +ASM_CASES_TAC` n = i:num`; +ASM_REWRITE_TAC[]; +ASM_CASES_TAC` n = k - 1 `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` !i j. i < j /\ j < k ==> bta i <= (bta:num -> real) j`; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPECL [`i:num`;` n:num`])); +ANTS_TAC; +ASM_ARITH_TAC; +FIRST_ASSUM (MP_TAC o (SPECL [`n:num`;`k - 1`])); +ANTS_TAC; +ASM_ARITH_TAC; +ASM_REWRITE_TAC[]; +REAL_ARITH_TAC; + +FIRST_ASSUM (ASSUME_TAC2 o (SPECL [`v0:real^3`;`1`])); +FIRST_ASSUM (ASSUME_TAC2 o (SPECL [`v0:real^3`;`n:num`])); +FIRST_ASSUM (ASSUME_TAC2 o (SPECL [`v0:real^3`;`k - 1`])); +FIRST_ASSUM (MP_TAC o (SPECL [`0`;`n:num`])); +PHA; +ANTS_TAC; +ASM_REWRITE_TAC[]; +ASM_ARITH_TAC; +FIRST_ASSUM (MP_TAC o (SPECL [`0`;` k - 1`])); +ANTS_TAC; +ASM_REWRITE_TAC[]; +ASM_ARITH_TAC; +ANTS_TAC; +ASM_REWRITE_TAC[]; +ASM_ARITH_TAC; +REWRITE_TAC[ITER]; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 LOCAL_FAN_CHARACTER_OF_RHO_NODE; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC`v0: real^3`)); +SUBGOAL_THEN` rho_node1 FF v0 = ITER 1 (rho_node1 FF) v0` MP_TAC; +REWRITE_TAC[ITER12]; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +UNDISCH_TAC` ITER 1 (rho_node1 FF) v0 IN V `; +UNDISCH_TAC` ITER n (rho_node1 FF) v0 IN V `; +UNDISCH_TAC` ITER (k - 1) (rho_node1 FF) v0 IN V `; +UNDISCH_TAC` ~(rho_node1 FF v0 = v0) /\ + v0,rho_node1 FF v0 IN ord_pairs E /\ + ~collinear {vec 0, v0, rho_node1 FF v0}`; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +UNDISCH_TAC` !v. v IN V /\ ~(v = v0) ==> ~collinear {vec 0, v0, v:real^3}`; +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC`(vv:num -> real^3) 1 `)); +FIRST_ASSUM (ASSUME_TAC2 o (SPEC`(vv:num -> real^3) n `)); +FIRST_ASSUM (ASSUME_TAC2 o (SPEC`(vv:num -> real^3) (k - 1) `)); +REPLICATE_TAC 3 DOWN THEN PHA; +NHANH AZIM_EQ_ALT; + + +UNDISCH_TAC` azim (vec 0) v0 (vv 1) x = azim (vec 0) v0 (vv 1) (vv (k - 1))`; +ASM_SIMP_TAC[]; + + + + + +ASM_REWRITE_TAC[]; +ABBREV_TAC` v00 = ITER i (rho_node1 FF) v0`; +MP_TAC (SPECL [`E:(real^3 -> bool) -> bool`;` V:real^3 -> bool`; +` {ITER n (rho_node1 FF) v00 | n <= k - i}`;` affine hull {vec 0, v0:real^3, vv (k - 1)}`; +` k - i:num`;` FF:real^3 # real^3 -> bool`;` v00: real^3`] +(GEN_ALL CNVX_IMP_INTERIOR_ANGLE_PI)); +ANTS_TAC; +ASM_REWRITE_TAC[]; + +FIRST_ASSUM (ASSUME_TAC2 o (SPECL [`v0:real^3`;`i:num`])); +DOWN; +FIRST_ASSUM SUBST1_TAC; +SIMP_TAC[Trigonometry2.IN_P_HULL_INSERT]; + +FIRST_ASSUM (ASSUME_TAC2 o (SPECL [`v0:real^3`;`k - 1`])); +FIRST_ASSUM (MP_TAC o (SPECL [`0`;`k - 1`])); +ANTS_TAC; +MATCH_MP_TAC LT_TRANS; +EXISTS_TAC `i:num`; +ASM_REWRITE_TAC[]; +ANTS_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` i < k - 1`; +ARITH_TAC; +REWRITE_TAC[ITER]; +DOWN; +ASM_REWRITE_TAC[]; +STRIP_TAC THEN STRIP_TAC; +SUBGOAL_THEN` ~ collinear {vec 0, v0:real^3, vv (k - 1)}` ASSUME_TAC; +DOWN THEN DOWN THEN PHA; +ASM_REWRITE_TAC[]; +STRIP_TAC THEN CONJ_TAC; +REWRITE_TAC[plane]; +DOWN THEN DOWN; +MESON_TAC[]; +ASSUME_TAC (ISPECL [`{vec 0, v0:real^3}`;`{(vv:num -> real^3) (k - 1)}`] +AFF_GT_SUBSET_AFFINE_HULL); +REWRITE_TAC[SUBSET; IN_ELIM_THM]; +REPEAT STRIP_TAC; +ASM_CASES_TAC` n = k - (i:num)`; +ASM_REWRITE_TAC[]; +EXPAND_TAC "v00"; +ASSUME_TAC2 (ARITH_RULE` i < k - 1 ==> k - i + i = (k:num) `); +ASM_REWRITE_TAC[ITER_ADD]; +ASSUME_TAC2 LOFA_IMP_ITER_RHO_NODE_ID; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC`v0:real^3`)); +DOWN; +ONCE_REWRITE_TAC[INSERT_COMM]; +ASM_REWRITE_TAC[]; +ASM_SIMP_TAC[Trigonometry2.IN_P_HULL_INSERT]; +UNDISCH_TAC` aff_gt {vec 0, v0:real^3} {vv (k - 1)} SUBSET + affine hull ({vec 0, v0} UNION {vv (k - 1)})`; +REWRITE_TAC[INSERT_UNION2; UNION_EMPTY; INSERT_COMM; SUBSET]; +DISCH_THEN MATCH_MP_TAC; +UNDISCH_TAC` {vv n | i <= n /\ n < k} SUBSET aff_gt {vec 0, v0:real^3} {vv (k - 1)}`; +REWRITE_TAC[SUBSET; IN_ELIM_THM; INSERT_COMM]; +DISCH_THEN MATCH_MP_TAC; +EXISTS_TAC `n + i:num`; +ASM_REWRITE_TAC[]; +EXPAND_TAC "v00"; +REWRITE_TAC[ITER_ADD]; +ASM_REWRITE_TAC[]; +DOWN; +UNDISCH_TAC` n <= k - (i:num)`; +ARITH_TAC; +STRIP_TAC THEN GEN_TAC; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` j - (i:num)`)); +ANTS_TAC; +DOWN THEN DOWN; +ARITH_TAC; +EXPAND_TAC "v00"; +REWRITE_TAC[ITER_ADD]; +UNDISCH_TAC` i < j:num`; +NHANH (ARITH_RULE` a < b:num ==> b - a + a = b `); +ASM_SIMP_TAC[]]);; + + + + + + + + +end;; diff --git a/text_formalization/local/LVDUCXU.hl b/text_formalization/local/LVDUCXU.hl new file mode 100644 index 0000000..36dabc7 --- /dev/null +++ b/text_formalization/local/LVDUCXU.hl @@ -0,0 +1,2455 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Nguyen Quang Truong *) +(* Date: 2010-05-09 *) +(* ========================================================================== *) + +(* needs "/home/user1/flyspeck/working/flyspeck_needs.hl";; *) +(* =========== snapshot 1631 ===================== *) + +flyspeck_needs "fan/planarity.hl";; +flyspeck_needs "local/WRGCVDR_CIZMRRH.hl";; + + +module type Lvducxu_type = sig + +end;; + + +module Lvducxu = struct + +parse_as_infix("has_orders",(12,"right"));; + + + +open Sphere;; +open Trigonometry1;; +open Trigonometry2;; +open Hypermap;; +open Fan;; +open Planarity;; +open Prove_by_refinement;; +open Wrgcvdr_cizmrrh;; + +let PROPERTIES_OF_IVS_AZIM_CYCLE2 = IVS_AZIM_PROPERTIES;; + + + +let IN_FF_IMP_FST_SND_IN_V = prove_by_refinement +(` UNIONS E SUBSET (V:A -> bool) /\ FF SUBSET darts_of_hyp E V +/\ x IN FF ==> FST x IN V /\ SND x IN V `, +[REWRITE_TAC[darts_of_hyp; SUBSET]; +STRIP_TAC; +DOWN; +FIRST_ASSUM NHANH; +REWRITE_TAC[ord_pairs; IN_UNION; self_pairs; IN_ELIM_THM]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` (a:A) IN UNIONS E /\ b IN UNIONS E ` ASSUME_TAC; +REWRITE_TAC[IN_UNIONS]; +ASM_MESON_TAC[SET_RULE` a IN {a,b} /\ b IN {a,b} `]; +ASM_MESON_TAC[]; +ASM_SIMP_TAC[]]);; + + + + + + + + + + +let W_EQ_ITS_ORBIT_IMP_EQ_ITS_IMAGE = +prove_by_refinement( +`(!(x:A). x IN W ==> W = orbit_map f x) +==> W = IMAGE f W `, +[STRIP_TAC; +REWRITE_TAC[FUN_EQ_THM]; +GEN_TAC THEN EQ_TAC; +PAT_ONCE_REWRITE_TAC `\x. x ==> x ` [GSYM IN]; +DOWN THEN PHA; +NHANH CYCLIC_MAP_IMP_CIRCLE_ITSELF; +REWRITE_TAC[IMAGE; IN_ELIM_THM]; +SIMP_TAC[]; +REWRITE_TAC[IMAGE; IN_ELIM_THM]; +FIRST_ASSUM NHANH; +ASSUME_TAC in_orbit_map1; +DOWN THEN REWRITE_TAC[IN]; +MESON_TAC[]]);; + + + + + + + + + +let FINITE_AND_LOOP_IMP_BIJ_S_IM_S = +prove_by_refinement( +`! S:A -> bool. FINITE S /\ (! x. x IN S ==> S = orbit_map f x ) +==> BIJ f S (IMAGE f S ) `, +[NHANH W_EQ_ITS_ORBIT_IMP_EQ_ITS_IMAGE; +REWRITE_TAC[BIJ; INJ; SURJ]; +REPEAT GEN_TAC THEN STRIP_TAC; +REWRITE_TAC[FUN_IN_IMAGE; IN_IMAGE]; +SIMP_TAC[CONJ_SYM; EQ_SYM_EQ]; +ASM_MESON_TAC[IMAGE_IMP_INJECTIVE_GEN]]);; + + + + +let CYCLIC_SET_IMP_SELF_LOPP2 = prove_by_refinement +(`FAN (x,V,E) /\ {v, u} IN E + ==> (!a. a IN EE v E + ==> EE v E = orbit_map (azim_cycle (EE v E) x v) a)`, +[NHANH CYCLIC_SET_IMP_STABLE_SET2; +STRIP_TAC; +FIRST_X_ASSUM NHANH; +REPEAT STRIP_TAC; +ABBREV_TAC ` f = azim_cycle (EE v E) x v `; +ASM_REWRITE_TAC[orbit_map; FUN_EQ_THM; IN_ELIM_THM; POWER_TO_ITER]; +REWRITE_TAC[ARITH_RULE` x >= 0 `]]);; + + +let FIN_LOOP_IMP_BIJ_ITSELF = prove_by_refinement( +`! S: A -> bool. FINITE S /\ (! x. x IN S ==> S = orbit_map f x ) +==> BIJ f S S `, +[NHANH FINITE_AND_LOOP_IMP_BIJ_S_IM_S; +NHANH W_EQ_ITS_ORBIT_IMP_EQ_ITS_IMAGE; +MESON_TAC[]]);; + + + + + +(* +++++++++++++++++++++++++++ +let CYCLIC_SET_IMP_BIJ_AZIM_CYCLE = +prove_by_refinement(` cyclic_set W v w ==> +BIJ (azim_cycle W v w) W W `, +[NHANH CYCLIC_SET_IMP_SELF_LOPP; +REWRITE_TAC[cyclic_set]; +STRIP_TAC; +DOWN; +UNDISCH_TAC `FINITE (W:real^3 -> bool) `; +PHA; +NHANH FIN_LOOP_IMP_BIJ_ITSELF; +SIMP_TAC[]]);; + ++++++++++++++++++++++++++++++++ *) + +(* a very important lemma for proving + second lemma in local fan chapter *) +(* ================================== *) + + + + +let IN_DARTS_FF_IMP_DARTS_E_PRIME_V_PRIME = prove_by_refinement +(` (x:A#A) IN darts_of_hyp E V /\ x IN FF ==> +x IN darts_of_hyp (e_prime E FF) (v_prime V FF) `, +[REWRITE_TAC[IN_ELIM_THM; darts_of_hyp; IN_UNION; ord_pairs; self_pairs]; +REWRITE_TAC[e_prime; v_prime; IN_ELIM_THM]; +STRIP_TAC; +DISJ1_TAC; +ASM_MESON_TAC[]; +DISJ2_TAC; +EXISTS_TAC `v:A`; +ASM_REWRITE_TAC[]; +CONJ_TAC; +ASM_MESON_TAC[]; +DOWN_TAC THEN REWRITE_TAC[EE]; +SET_TAC[]]);; + + + + + +let PROPERTIES_OF_IVS_AZIM_CYCLE2 = +prove_by_refinement(` FAN (x,V,E) /\ w IN EE v E ==> +ivs_azim_cycle (EE v E) x v w IN EE v E /\ +azim_cycle (EE v E ) x v ( ivs_azim_cycle (EE v E) x v w ) = w `, +[IMP_TAC; +NHANH FAN_IMP_EE_EQ_SET_OF_EDGE; +STRIP_TAC; +UNDISCH_TAC` FAN ((x:real^3),V,E) `; +PHA; +ASM_REWRITE_TAC[]; +NHANH IVS_AZIM_PROPERTIES; +SIMP_TAC[]; +STRIP_TAC; +UNDISCH_TAC `ivs_azim_cycle (set_of_edge v V E) x v w IN +set_of_edge v V E `; +UNDISCH_TAC ` FAN (x:real^3,V,E) `; +PHA; +NHANH AZIM_CYCLE_EQ_SIGMA_FAN; +ASM_SIMP_TAC[]]);; + + + +let IN_EE_IFF_IN_E = prove(` x IN EE v E <=> {v,x} IN E `, +REWRITE_TAC[EE; IN_ELIM_THM]);; + + +let CYCLIC_SET_IMP_SELF_LOPP3 = prove(`FAN (x,V,E) + ==> (!a. a IN EE v E + ==> EE v E = orbit_map (azim_cycle (EE v E) x v) a)`, +MESON_TAC[CYCLIC_SET_IMP_SELF_LOPP2;IN_EE_IFF_IN_E]);; + + + +let BIJ_AZIM_CYCLE_EE = prove( +` FAN (x,V,E) ==> BIJ (azim_cycle (EE v E) x v) (EE v E) (EE v E) `, +NHANH CYCLIC_SET_IMP_SELF_LOPP3 THEN +NHANH FAN_IMP_FINITE_EE THEN +MESON_TAC[FIN_LOOP_IMP_BIJ_ITSELF]);; + + + + + + + +(* ++++++++++++++++++ *) + + + +let IN_FF_FACE_MAP_IDE = prove_by_refinement +(` FAN (v,V,E) /\ + (?x. x IN dart (hypermap (HYP (v,V,E))) /\ + FF = face (hypermap (HYP (v,V,E))) x) +==> (! x. x IN FF ==> face_map (hypermap (HYP (v,V,E))) x = +face_map (hypermap (HYP (v,v_prime V FF,e_prime E FF))) x ) `, +[NHANH IMP_FAN_V_PRIME_E_PRIME; +NHANH ELMS_OF_HYPERMAP_HYP; +STRIP_TAC; +STRIP_TAC THEN STRIP_TAC; +UNDISCH_TAC`FF = face (hypermap (HYP (v,V,E))) x`; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[ff_of_hyp]; +PAT_ONCE_REWRITE_TAC `\x. P x = Q x ` [GSYM PAIR]; + + +SUBGOAL_THEN `x IN dart (hypermap (HYP ((v:real^3),V,E))) ` MP_TAC; +ASM_REWRITE_TAC[]; +NHANH lemma_face_subset; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` (x':real^3 # real^3) IN darts_of_hyp E V ` MP_TAC; +DOWN THEN DOWN THEN DOWN THEN SET_TAC[]; +SUBGOAL_THEN ` x':real^3 # real^3 IN +darts_of_hyp (e_prime E FF) (v_prime V FF) ` MP_TAC; +SUBGOAL_THEN` (x':real^3 # real^3) IN darts_of_hyp E V ` MP_TAC; +DOWN THEN DOWN THEN DOWN THEN SET_TAC[]; +ASM_SIMP_TAC[IN_DARTS_FF_IMP_DARTS_E_PRIME_V_PRIME]; +PHA; +SIMP_TAC[ff_of_hyp2]; +REMOVE_TAC THEN DOWN THEN REMOVE_TAC; + + + +REWRITE_TAC[ff_of_hyp]; +UNDISCH_TAC `(x': real^3 #real^3 ) IN FF `; +EXPAND_TAC "FF"; +REWRITE_TAC[face]; +NHANH IN_ORBIT_MAP_IMP_F_Y; +REWRITE_TAC[GSYM face]; + + +ASM_REWRITE_TAC[]; +IMP_TAC THEN DISCH_TAC; + + +SUBGOAL_THEN `x IN dart (hypermap (HYP ((v:real^3),V,E))) ` MP_TAC; +ASM_REWRITE_TAC[]; +NHANH lemma_face_subset; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` (x':real^3 # real^3) IN darts_of_hyp E V ` MP_TAC; +DOWN THEN DOWN THEN SET_TAC[]; +SIMP_TAC[ff_of_hyp2]; +REMOVE_TAC; +DOWN THEN REMOVE_TAC; +DOWN THEN PHA; + + +IMP_TAC THEN DISCH_TAC; +PAT_ONCE_REWRITE_TAC `\x. P h x IN FF ==> y ` +[ISPEC `x': real^3 # real^3 ` (GSYM PAIR)]; + + +ABBREV_TAC ` fx = FST (x':real^3 # real^3 ) `; +ABBREV_TAC `snx = SND (x':real^3 # real^3 ) `; +MP_TAC (ISPEC `x': real^3 # real^3 ` (GSYM PAIR)); +DISCH_TAC; + + +UNDISCH_TAC `x IN dart (hypermap (HYP (v,V,E))) `; +NHANH lemma_face_subset; +STRIP_TAC; +UNDISCH_TAC` (x':real^3#real^3) IN FF `; +DOWN; +PHA; +ASM_REWRITE_TAC[]; +NHANH (SET_RULE` a SUBSET b /\ x IN a /\ l ==> x IN b `); +STRIP_TAC; +DOWN; +REWRITE_TAC[darts_of_hyp; IN_UNION]; +ONCE_REWRITE_TAC[DISJ_SYM]; +STRIP_TAC; +(* 2 goals araise here *) +(* sub 1 *) +DOWN; +REWRITE_TAC[self_pairs]; +UNDISCH_TAC `(x':real^3 # real^3) = FST x',SND x'`; +DISCH_TAC; +FIRST_X_ASSUM (fun x -> ONCE_REWRITE_TAC[x]); +PURE_REWRITE_TAC[IN_ELIM_THM; BETA_THM; PAIR_EQ]; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +ASSUME_TAC (let tm = +MATCH_MP (SPECL [`{}:real^3 -> bool `;` v:real^3 `;` v':real^3 `] (GEN_ALL (MESON[W_SUBSET_SINGLETON_IMP_IDE]` W SUBSET {p} ==> azim_cycle W v w p = p`))) (SET_RULE` {} SUBSET {(q:real^3)} `) in +GEN `q:real^3 ` tm); + + +ASSUME_TAC2 ( +ISPECL [`FF:real^3 # real^3 -> bool `] (GEN_ALL E_PRIME_SUBSET_E)); +DOWN; +NHANH ( +let ge = +GEN_ALL SUBSET_IMP_SO_DO_EE in +ISPECL [`W1:(A -> bool ) -> bool`;`v':A `] ge); +ASM_SIMP_TAC[SUBSET_EMPTY]; +(* SUB 2 *) +REWRITE_TAC[PAIR_EQ]; +DOWN_TAC THEN NHANH ( +MESON[FAN]` FAN (x,V,E) ==> UNIONS E SUBSET V `); +STRIP_TAC; +ASSUME_TAC2 ( +ISPEC `x': real^3 # real ^3 ` (GEN `x:A#A` IN_FF_IMP_FST_SND_IN_V)); +DOWN THEN ASM_SIMP_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` snx:real^3 IN v_prime V (FF:real^3 # real^3 -> bool)` ASSUME_TAC; +REWRITE_TAC[v_prime; IN_ELIM_THM]; +ASM_SIMP_TAC[]; +EXISTS_TAC `ivs_azim_cycle (EE snx E) v snx (fx:real^3)`; +FIRST_ASSUM ACCEPT_TAC; +DOWN; +ASSUME_TAC2 ( +SPECL [`v:real^3 `;`V:real^3 -> bool`;` E:(real^3 -> bool) -> bool`;` snx:real^3`] XOHLED); +UNDISCH_TAC`FAN ((v:real^3),v_prime V FF,e_prime E FF)`; +PHA; +NHANH XOHLED; +DOWN; +ASM_SIMP_TAC[GSYM UNI_E_IMP_EE_EQ_SET_OF_EDGE]; +SUBGOAL_THEN `{FST (x':real^3 # real^3), SND x'} IN e_prime E FF ` ASSUME_TAC; +ASM_REWRITE_TAC[e_prime; IN_ELIM_THM]; +EXISTS_TAC`(fx:real^3 )`; +EXISTS_TAC `snx:real^3 `; +REPLICATE_TAC 5 DOWN; +PHA; +REWRITE_TAC[ord_pairs; IN_ELIM_THM]; +STRIP_TAC; +EXPAND_TAC "fx"; +EXPAND_TAC "snx"; +REPLICATE_TAC 6 DOWN; +SIMP_TAC[]; +MESON_TAC[]; +SUBGOAL_THEN ` fx:real^3 IN EE snx E /\ fx IN EE snx (e_prime E FF) ` ASSUME_TAC; +REWRITE_TAC[EE; IN_ELIM_THM]; +REPLICATE_TAC 4 DOWN THEN PHA; +ASM_SIMP_TAC[INSERT_COMM; ord_pairs; IN_ELIM_THM]; +IMP_TAC THEN STRIP_TAC; +DOWN THEN DOWN; +EXPAND_TAC "fx"; +EXPAND_TAC "snx"; +SIMP_TAC[]; +DOWN; +REPEAT STRIP_TAC; +UNDISCH_TAC ` fx:real^3 IN EE snx E `; +UNDISCH_TAC ` cyclic_set (EE snx E) (v:real^3) snx`; +PHA; +IMP_TAC THEN STRIP_TAC; +SUBGOAL_THEN ` FAN (v:real^3,V,E)` MP_TAC; +ASM_REWRITE_TAC[]; +PHA; +NHANH PROPERTIES_OF_IVS_AZIM_CYCLE2; +PHA THEN IMP_TAC THEN REMOVE_TAC; +STRIP_TAC; + +UNDISCH_TAC `(fx:real^3) IN EE snx (e_prime E FF)`; +UNDISCH_TAC `cyclic_set (EE snx (e_prime E FF)) (v:real^3) snx`; +PHA; + + + +IMP_TAC THEN STRIP_TAC; +SUBGOAL_THEN ` FAN (v:real^3,v_prime V FF, e_prime E FF)` MP_TAC; +ASM_REWRITE_TAC[]; +PHA; +NHANH PROPERTIES_OF_IVS_AZIM_CYCLE2; +PHA THEN IMP_TAC THEN REMOVE_TAC; +STRIP_TAC; +ASSUME_TAC2 ( +ISPECL [`FF:real^3 # real^3 -> bool`;`snx:real^3 `] (GEN_ALL (MATCH_MP SUBSET_IMP_SO_DO_EE E_PRIME_SUBSET_E))); + +SUBGOAL_THEN `ivs_azim_cycle (EE snx E) v snx fx IN EE snx (e_prime E FF) ` ASSUME_TAC; +PAT_REWRITE_TAC`\x. y IN x ` [EE]; +REWRITE_TAC[IN_ELIM_THM; e_prime]; +UNDISCH_TAC` ivs_azim_cycle (EE snx E) (v:real^3) snx fx IN EE snx E`; +ABBREV_TAC `t = ivs_azim_cycle (EE snx E) v snx (fx:real^3)`; +REWRITE_TAC[EE; IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC `snx:real^3 `; +EXISTS_TAC `t:real^3 `; +ASM_REWRITE_TAC[]; +(* new subgoal *) + +ABBREV_TAC `t = ivs_azim_cycle (EE snx E) v snx (fx:real^3)`; +ABBREV_TAC `tt = ivs_azim_cycle (EE snx (e_prime E FF)) v snx (fx:real^3)`; +ABBREV_TAC `smalset = EE snx (e_prime (E:(real^3 -> bool) -> bool) FF)`; +ABBREV_TAC `lset = EE (snx:real^3) E `; +ASM_CASES_TAC ` lset SUBSET {t:real^3} `; +DOWN; +UNDISCH_TAC` smalset SUBSET (lset:real^3 -> bool) `; +PHA; +NHANH SUBSET_TRANS; +UNDISCH_TAC `(tt:real^3) IN smalset `; +SET_TAC[]; +DOWN; +ASM_CASES_TAC `t = (tt:real^3) `; +STRIP_TAC THEN FIRST_ASSUM ACCEPT_TAC; +ASSUME_TAC2 ( +SET_RULE` ~(t = tt) /\ t IN smalset /\ (tt:real^3) IN smalset ==> +~( smalset SUBSET {tt}) `); +USE_FIRST ` cyclic_set lset (v:real^3) snx` MP_TAC; +USE_FIRST ` cyclic_set smalset (v:real^3) snx` MP_TAC; +REWRITE_TAC[cyclic_set]; +REPEAT STRIP_TAC; +UNDISCH_TAC `FINITE (lset:real^3 -> bool) `; +DOWN THEN PHA; +NHANH ( +SPECL [`lset:real^3 -> bool `;` t:real^3`;` snx:real^3 `;` v:real^3 ` ] (GEN_ALL AZIM_CYCLE_PROPERTIES)); +ASSUME_TAC2 (SPECL [`smalset:real^3 -> bool `;` tt:real^3`;` snx:real^3 `;` v:real^3 ` ] (GEN_ALL AZIM_CYCLE_PROPERTIES)); +DOWN; +ASM_REWRITE_TAC[]; +STRIP_TAC; +STRIP_TAC; +MP_TAC ( +SPECL [`smalset:real^3 -> bool`;`v:real^3 `;`snx:real^3`;`t:real^3 `;` fx:real^3 `] (GEN_ALL IDENTIFY_AZIM_CYCLE)); +SUBGOAL_THEN ` ~(smalset SUBSET {t:real^3}) /\ + ~collinear {(t:real^3), v, snx} /\ + cyclic_set smalset v snx /\ + (~(fx = t) /\ smalset fx) /\ + (!q. ~(q = t) /\ smalset q + ==> azim v snx t fx < azim v snx t q \/ + azim v snx t fx = azim v snx t q /\ + norm (projection (snx - v) (fx - v)) <= + norm (projection (snx - v) (q - v)))` ASSUME_TAC; +ASM_REWRITE_TAC[]; +CONJ_TAC; +UNDISCH_TAC `~( t = (tt:real^3)) `; +UNDISCH_TAC ` (tt:real^3) IN smalset`; +SET_TAC[]; +CONJ_TAC; +UNDISCH_TAC` cyclic_set lset (v:real^3) snx `; +NHANH CYCLIC_SET_IMP_NOT_COLLINEAR; +STRIP_TAC; +UNDISCH_TAC ` (t:real^3) IN lset `; +FIRST_X_ASSUM NHANH; +SIMP_TAC[]; +UNDISCH_TAC ` smalset SUBSET (lset:real^3 -> bool) `; +REWRITE_TAC[SUBSET]; +DOWN; +MESON_TAC[IN]; +ANTS_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +UNDISCH_TAC ` cyclic_set smalset (v:real^3) snx `; +STRIP_TAC; +SUBGOAL_THEN ` (FAN (v:real^3,v_prime V FF,e_prime E FF)) ` MP_TAC; +FIRST_ASSUM ACCEPT_TAC; +NHANH (SPEC `snx:real^3 ` (GEN `v:real^3 ` BIJ_AZIM_CYCLE_EE)); +IMP_TAC THEN REMOVE_TAC; + + + +REWRITE_TAC[BIJ; INJ]; +STRIP_TAC; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPECL [`t:real^3 `;` tt:real^3 `])); +REWRITE_TAC[TAUT` ~( a ==> b) <=> a /\ ~ b `]; +ASM_REWRITE_TAC[]]);; + + + +let LOCALIZE_PRESERVE_FACE = prove_by_refinement +(` FAN (v,V,E) /\ + x IN dart (hypermap (HYP (v,V,E))) /\ + FF = face (hypermap (HYP (v,V,E))) x +==> FF = face (hypermap (HYP (v,v_prime V FF,e_prime E FF))) x`, +[STRIP_TAC; +MP_TAC IN_FF_FACE_MAP_IDE; +ANTS_TAC; +ASM_SIMP_TAC[]; +EXISTS_TAC`x: real^3 # real^3 `; +ASM_REWRITE_TAC[]; +DOWN; +NHANH (MESON[face_refl]` D = face H x ==> x IN D `); +DISCH_TAC THEN DISCH_TAC; +ABBREV_TAC ` hy2 = hypermap (HYP (v,v_prime V FF,e_prime E FF)) `; +ASM_REWRITE_TAC[face; orbit_map]; +MATCH_MP_TAC ( +SET_RULE`(! n. Q n x = P n x ) ==> { Q n x | n >= 0 } = { P n x | n >= 0 } `); +ASSUME_TAC ( +ISPECL [`face_map ((hypermap (HYP (v,V,E))) )` ] lemma_in_orbit); +DOWN_TAC THEN ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[GSYM face]; +STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[]; +STRIP_TAC; +INDUCT_TAC; +REWRITE_TAC[POWER]; +DOWN; +FIRST_X_ASSUM (MP_TAC o (SPEC_ALL)); +ASM_REWRITE_TAC[]; +DISCH_TAC; +DISCH_TAC; +REWRITE_TAC[GSYM COM_POWER_FUNCTION]; +DOWN THEN DOWN; +FIRST_ASSUM NHANH; +ASM_REWRITE_TAC[]; +MESON_TAC[]]);; + + + + + + +let FAN_IN_SEFL_PAIRS_IMP_PROGORIOUS_DEGENERATE = +prove_by_refinement(` FAN (x,V,E) /\ v IN self_pairs E V +==> edge_map (hypermap (HYP(x,V,E))) v = v /\ +face_map (hypermap (HYP(x,V,E))) v = v /\ +node_map (hypermap (HYP(x,V,E))) v = v `, +[NHANH ELMS_OF_HYPERMAP_HYP; +SIMP_TAC[]; +STRIP_TAC; +DOWN; +SIMP_TAC[nn_of_hyp3; ff_of_hyp3]; +SIMP_TAC[ee_of_hyp2;darts_of_hyp; IN_UNION]; +REWRITE_TAC[self_pairs; IN_ELIM_THM]; +STRIP_TAC; +ASM_SIMP_TAC[]]);; + + + +let FAN_FACE_IMP_IVS_F_IN_F = +prove_by_refinement (` FAN (x,V,E) /\ +xx IN dart (hypermap (HYP (x,V,E))) /\ + FF = face (hypermap (HYP (x,V,E))) xx /\ y IN FF +==> inverse ( face_map (hypermap (HYP (x,V,E))) ) y IN FF /\ +( face_map (hypermap (HYP (x,V,E))) ) o (inverse ( face_map (hypermap (HYP (x,V,E))) )) = I /\ +(inverse ( face_map (hypermap (HYP (x,V,E))) )) o ( face_map (hypermap (HYP (x,V,E))) ) = I `, +[NHANH HYP_LEMMA; +REWRITE_TAC[GSYM hypermap_tybij; HYP]; +STRIP_TAC; +REPLICATE_TAC 3 DOWN THEN PHA; +REWRITE_TAC[GSYM HYP]; +ASSUME_TAC2 ELMS_OF_HYPERMAP_HYP; +NHANH lemma_face_subset; +ASM_SIMP_TAC[SUBSET]; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[face]; +UNDISCH_TAC ` ff_of_hyp (x,V,E) permutes darts_of_hyp E V `; +UNDISCH_TAC ` FINITE (darts_of_hyp E (V:real^3 -> bool))`; +EXPAND_TAC "FF"; +PHA; +DISCH_TAC THEN CONJ_TAC; +DOWN; +REWRITE_TAC[face]; +ASM_REWRITE_TAC[]; +MESON_TAC[lemma_orbit_identity; lemma_inverse_in_orbit]; +DOWN; +NHANH PERMUTES_INVERSES_o; +SIMP_TAC[]]);; + + +let FAN_FACE_IMP_IVS_F_IN_F = +prove_by_refinement +(` FAN (x,V,E) /\ + FF = face (hypermap (HYP (x,V,E))) xx /\ + y IN FF + ==> inverse (face_map (hypermap (HYP (x,V,E)))) y IN FF /\ + face_map (hypermap (HYP (x,V,E))) o + inverse (face_map (hypermap (HYP (x,V,E)))) = + I /\ + inverse (face_map (hypermap (HYP (x,V,E)))) o + face_map (hypermap (HYP (x,V,E))) = + I`, +[STRIP_TAC; +ASM_CASES_TAC` xx IN dart (hypermap (HYP ((x:real^3),V,E)))`; +ASSUME_TAC2 FAN_FACE_IMP_IVS_F_IN_F; +FIRST_X_ASSUM ACCEPT_TAC; +DOWN_TAC THEN NHANH HYP_LEMMA; +REWRITE_TAC[GSYM hypermap_tybij; HYP]; +NHANH ELMS_OF_HYPERMAP_HYP; +STRIP_TAC; +REWRITE_TAC[GSYM HYP]; +CONJ_TAC; +REPLICATE_TAC 4 DOWN THEN PHA; +REWRITE_TAC[GSYM HYP]; +NHANH lemma_face_exception; +SIMP_TAC[]; +STRIP_TAC; +UNDISCH_TAC ` (y:real^3 # real^3 ) IN FF `; +ASM_REWRITE_TAC[SET_RULE` x IN {c} <=> x = c `]; +SIMP_TAC[]; +USE_FIRST ` ff_of_hyp (x,V,E) permutes darts_of_hyp E V` MP_TAC; +REWRITE_TAC[permutes]; +DOWN THEN DOWN THEN DOWN THEN ASM_REWRITE_TAC[]; +REWRITE_TAC[GSYM HYP]; +REPEAT STRIP_TAC; +UNDISCH_TAC `~((xx:real^3 # real^3 ) IN darts_of_hyp E V) `; +FIRST_X_ASSUM NHANH; +STRIP_TAC; +PAT_ONCE_REWRITE_TAC `\x. y = x ` [GSYM I_THM]; +UNDISCH_TAC `ff_of_hyp (x,V,E) permutes darts_of_hyp E V `; +NHANH PERMUTES_INVERSES_o; +STRIP_TAC; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +REWRITE_TAC[o_THM]; +ASM_REWRITE_TAC[]; +UNDISCH_TAC `ff_of_hyp (x,V,E) permutes darts_of_hyp E V`; +NHANH PERMUTES_INVERSES_o; +ASM_MESON_TAC[]]);; + + + + +let INVERSE_FACE_EQ_INV_FACE_LOCALLIZED = +prove_by_refinement +(`FAN (v,V,E) /\ + x IN dart (hypermap (HYP (v,V,E))) /\ + FF = face (hypermap (HYP (v,V,E))) x +==> (!x. x IN FF + ==> inverse ( face_map (hypermap (HYP (v,V,E))) ) x = + inverse ( face_map (hypermap (HYP (v,v_prime V FF,e_prime E FF)))) x)`, +[STRIP_TAC; +GEN_TAC; +DOWN_TAC; +NHANH FAN_FACE_IMP_IVS_F_IN_F; +STRIP_TAC; +MP_TAC ( +SPECL [` x:real^3 # real^3 `;` x':real^3 # real^3`;` FF:real^3#real^3->bool `;` v:real^3 `;` v_prime (V:real^3 -> bool) (FF:real^3 # real^3 -> bool) ` ;` e_prime E (FF:real^3 # real^3 -> bool)`] (GEN_ALL FAN_FACE_IMP_IVS_F_IN_F)); +ANTS_TAC; +CONJ_TAC; +MP_TAC IMP_FAN_V_PRIME_E_PRIME; +ANTS_TAC; +ASM_REWRITE_TAC[]; +EXISTS_TAC `x: real^3 # real^3 `; +ASM_REWRITE_TAC[]; +REWRITE_TAC[]; +ASSUME_TAC2 LOCALIZE_PRESERVE_FACE; +ASM_REWRITE_TAC[]; +REWRITE_TAC[GSYM HYP]; +UNDISCH_TAC `FF = face (hypermap (HYP (v,V,E))) x `; +DOWN; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[]; +STRIP_TAC; +DOWN; +REMOVE_TAC; +DOWN; +REWRITE_TAC[FUN_EQ_THM]; +DISCH_THEN (MP_TAC o (SPEC `x': real^3 # real^3` )); +ASSUME_TAC2 (SPECL [`x:real^3 # real^3 `;`x':real^3 # real^3 `;` FF: real^3 # real^3 -> bool` ;` v:real^3 `] (GEN_ALL FAN_FACE_IMP_IVS_F_IN_F)); +REPEAT (FIRST_X_ASSUM (CONJUNCTS_THEN ASSUME_TAC)); +DOWN THEN REMOVE_TAC; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +REWRITE_TAC[o_THM]; +MP_TAC IN_FF_FACE_MAP_IDE; +ANTS_TAC; +ASM_REWRITE_TAC[]; +EXISTS_TAC `x:real^3# real^3 `; +ASM_REWRITE_TAC[]; +DISCH_TAC; +UNDISCH_TAC ` inverse (face_map (hypermap (HYP (v,v_prime V FF,e_prime E FF)))) x' IN FF `; +FIRST_X_ASSUM NHANH; +STRIP_TAC; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +UNDISCH_TAC ` FAN ((v:real^3),V,E) `; +NHANH HYP_LEMMA; +REWRITE_TAC[GSYM hypermap_tybij; HYP]; +STRIP_TAC; +REWRITE_TAC[GSYM HYP]; +DOWN_TAC THEN NHANH ELMS_OF_HYPERMAP_HYP; +STRIP_TAC; +DOWN; +UNDISCH_TAC `ff_of_hyp (v,V,E) permutes darts_of_hyp E V `; +ASM_REWRITE_TAC[permutes]; +MESON_TAC[]]);; + + + + + + + +let ED_MA_O_NO_MA_EQ_INV_FA = +prove_by_refinement +(`!(H:(A) hypermap ). edge_map H o node_map H = inverse ( face_map H ) `, +[GEN_TAC; +MP_TAC (SPEC_ALL hypermap_lemma); +NHANH (MESON[]` x o y o z = b ==> (x o y o z ) o ( inverse z ) = b o ( inverse z ) `); +REWRITE_TAC[GSYM o_ASSOC; I_O_ID]; +NHANH PERMUTES_INVERSES_o; +STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[I_O_ID]]);; + + + + + + + +let IN_FF_IMP_AZIM_CYCLE_EQ = +prove_by_refinement ( +` FAN (v,V,E) /\ + x IN dart (hypermap (HYP (v,V,E))) /\ + FF = face (hypermap (HYP (v,V,E))) x + ==> (!x. x IN FF ==> +azim_cycle (EE (FST x ) E ) v (FST x ) (SND x ), FST x = + azim_cycle (EE (FST x ) (e_prime E FF ) ) v (FST x ) (SND x ), FST x)`, +[NHANH ( +prove(`FAN (v,V,E) /\ + x IN dart (hypermap (HYP (v,V,E))) /\ + FF = face (hypermap (HYP (v,V,E))) x + ==> (!x. x IN FF ==> +(edge_map (hypermap (HYP (v,V,E))) o node_map (hypermap (HYP (v,V,E))) ) x = +(edge_map (hypermap (HYP (v,v_prime V FF,e_prime E FF))) o node_map ( hypermap (HYP (v,v_prime V FF,e_prime E FF))) ) x ) `, +REWRITE_TAC[ED_MA_O_NO_MA_EQ_INV_FA; +INVERSE_FACE_EQ_INV_FACE_LOCALLIZED])); +STRIP_TAC; +GEN_TAC THEN FIRST_X_ASSUM NHANH; +MP_TAC IMP_FAN_V_PRIME_E_PRIME; +ANTS_TAC; +ASM_MESON_TAC[]; +DOWN_TAC THEN NHANH ELMS_OF_HYPERMAP_HYP; +STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[]; +USE_FIRST ` FF = face (hypermap (HYP (v,V,E))) x ` (SUBST1_TAC o SYM); +REWRITE_TAC[o_THM]; +PAT_ONCE_REWRITE_TAC `\x. h ( d x ) = h ( i x ) ==> y ` [GSYM PAIR]; +SUBGOAL_THEN` (x':real^3 # real^3) IN darts_of_hyp (e_prime E FF) (v_prime V FF) ` MP_TAC; +MATCH_MP_TAC IN_DARTS_FF_IMP_DARTS_E_PRIME_V_PRIME; +ASM_SIMP_TAC[]; +UNDISCH_TAC ` x IN dart (hypermap (HYP (v,V,E))) `; +NHANH lemma_face_subset; +DOWN THEN DOWN THEN PHA THEN SET_TAC[]; +SUBGOAL_THEN ` x' IN darts_of_hyp E (V:real^3 -> bool) ` MP_TAC; +UNDISCH_TAC ` x IN dart (hypermap (HYP (v,V,E))) `; +NHANH lemma_face_subset; +ASM_REWRITE_TAC[]; +DOWN THEN DOWN THEN MESON_TAC[SUBSET]; +FIRST_X_ASSUM (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +ASSUME_TAC2 ( +MESON[IN_DARTS_IFF_NN_OF_HYP_TOO]` FAN (v:real^3,V,E) ==> (! y. +y IN darts_of_hyp E V ==> nn_of_hyp (v,V,E) y IN darts_of_hyp E V )`); +FIRST_ASSUM NHANH; +ASSUME_TAC2 ( +SPECL [`v_prime (V:real^3 -> bool) (FF:real^3 # real^3 -> bool) `; +` e_prime (E:(real^3 -> bool) -> bool) FF`] +(MESON[IN_DARTS_IFF_NN_OF_HYP_TOO]`! V E. FAN (v:real^3,V,E) ==> (! y. +y IN darts_of_hyp E V ==> nn_of_hyp (v,V,E) y IN darts_of_hyp E V )`)); +FIRST_ASSUM NHANH; +SIMP_TAC[ee_of_hyp2]; +SIMP_TAC[nn_of_hyp2]]);; + + + + + +let IN_DARTS_IMP_NN_OF_HYP_TOO = + MESON[IN_DARTS_IFF_NN_OF_HYP_TOO]`! x V E. FAN (x,V,E) ==> +(! y. y IN darts_of_hyp E V +==> nn_of_hyp (x,V,E) y IN darts_of_hyp E V )`;; + + + + + + + + +let CARD_E_GT1_EQ_CARD_E_PRIME = prove_by_refinement +(` FAN (x,V,E) /\ v IN dart (hypermap (HYP (x,V,E)) ) /\ + FF = face (hypermap (HYP (x,V,E))) v /\ y IN FF +==> ( CARD (EE (FST y) E) > 1 <=> CARD (EE (FST y) (e_prime E FF)) > 1 ) `, +[ONCE_REWRITE_TAC[TAUT` a /\ b /\ c <=> b /\ a /\ c `]; +NHANH FAN_FACE_IMP_IVS_F_IN_F; +ONCE_REWRITE_TAC[TAUT` a /\ ( b /\ c /\ d ) /\ p <=> (b /\ a /\ c ) /\ d /\ p`]; +NHANH INVERSE_FACE_EQ_INV_FACE_LOCALLIZED; +REWRITE_TAC[GSYM ED_MA_O_NO_MA_EQ_INV_FA]; +IMP_TAC; +STRIP_TAC; +FIRST_X_ASSUM (NHANH_PAT`\x. x /\ y ==> k `); +STRIP_TAC; +MP_TAC (SPEC `x:real^3 ` (GEN `v:real^3 ` IMP_FAN_V_PRIME_E_PRIME)); +ANTS_TAC; +ASM_MESON_TAC[]; +UNDISCH_TAC ` FAN ((x:real^3),V,E)`; +NHANH ELMS_OF_HYPERMAP_HYP; +PHA THEN STRIP_TAC; +UNDISCH_TAC ` (edge_map (hypermap (HYP (x,V,E))) o node_map (hypermap (HYP (x,V,E)))) + y = + (edge_map (hypermap (HYP (x,v_prime V FF,e_prime E FF))) o + node_map (hypermap (HYP (x,v_prime V FF,e_prime E FF)))) + y `; +UNDISCH_TAC `(edge_map (hypermap (HYP (x,V,E))) o node_map (hypermap (HYP (x,V,E)))) + y IN + FF `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` FF = face (hypermap (HYP (x,V,E))) v `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +PAT_ONCE_REWRITE_TAC `\x. P x IN FF ==> Q x = Y x ==> l ` [GSYM PAIR]; + + +PURE_REWRITE_TAC[o_THM]; +SUBGOAL_THEN ` v IN dart (hypermap (HYP (x,V,E))) ` MP_TAC; +ASM_REWRITE_TAC[]; +NHANH lemma_face_subset; +IMP_TAC THEN REMOVE_TAC; +SUBGOAL_THEN ` (y:real^3 # real^3) IN FF ` MP_TAC; +FIRST_ASSUM ACCEPT_TAC; +DISCH_TAC; +ASM_REWRITE_TAC[]; +DOWN; +ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> b /\ a ==> c `]; +NHANH (SET_RULE` a SUBSET b /\ x IN a ==> x IN b `); +IMP_TAC THEN IMP_TAC; +REMOVE_TAC; +DISCH_TAC; +ASM_REWRITE_TAC[]; +DOWN; +ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> b /\ a ==> c `]; +NHANH IN_DARTS_FF_IMP_DARTS_E_PRIME_V_PRIME; +ASSUME_TAC2 IN_DARTS_IMP_NN_OF_HYP_TOO; +FIRST_X_ASSUM NHANH; +ASSUME_TAC2 ( +SPECL [`x:real^3 `;` v_prime V (FF:real^3 # real^3 -> bool)`; +` e_prime (E:(real^3 -> bool) -> bool) FF `] IN_DARTS_IMP_NN_OF_HYP_TOO); +FIRST_X_ASSUM NHANH; +SIMP_TAC[ee_of_hyp2]; +SIMP_TAC[nn_of_hyp2]; +REMOVE_TAC; + +UNDISCH_TAC ` v IN dart (hypermap (HYP (x,V,E))) `; +NHANH lemma_face_subset; +ASM_REWRITE_TAC[SUBSET]; +STRIP_TAC; +UNDISCH_TAC ` (y:real^3 # real^3 ) IN FF`; +FIRST_ASSUM (NHANH_PAT` \x. x ==> y `); +REWRITE_TAC[darts_of_hyp; IN_UNION; ord_pairs; self_pairs]; +STRIP_TAC; +DOWN; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +REWRITE_TAC[]; +SUBGOAL_THEN ` FINITE (EE (a:real^3) E ) ` ASSUME_TAC; +ASM_MESON_TAC[FAN_IMP_FINITE_EE]; +STRIP_TAC; +STRIP_TAC; +EQ_TAC; +DISCH_TAC; +SUBGOAL_THEN` ~( EE (a:real^3) E SUBSET {b} ) ` ASSUME_TAC; +REWRITE_TAC[SET_RULE` a SUBSET {b} <=> a = {} \/ a = {b} `]; +DOWN; +MESON_TAC[ARITH_RULE` ~( 0 > 1 \/ 1 > 1 )`; CARD_CLAUSES; CARD_SINGLETON]; +UNDISCH_TAC ` FINITE (EE (a:real^3) E ) `; +DOWN THEN PHA; + + + +NHANH (SPECL [`x:real^3 `; `a:real^3 `] (GENL [`v:real^3`;` w:real^3 `] AZIM_CYCLE_PROPERTIES)); +STRIP_TAC; +SUBGOAL_THEN ` b IN EE (a:real^3) (e_prime E FF) /\ +azim_cycle (EE a E) x a b IN EE (a:real^3) (e_prime E FF) ` ASSUME_TAC; +UNDISCH_TAC ` {(a:real^3), b} IN E `; +UNDISCH_TAC ` (a:real^3),(b:real^3) IN FF `; +UNDISCH_TAC `azim_cycle (EE a E) x a b,a IN FF `; +UNDISCH_TAC `EE a E (azim_cycle (EE a E) x a b) `; +PHA; +REWRITE_TAC[EE; e_prime; IN_ELIM_THM]; +DISCH_TAC; +CONJ_TAC; +DOWN THEN MESON_TAC[]; +EXISTS_TAC `azim_cycle {(w:real^3) | {a, w} IN E} x a b`; +EXISTS_TAC `a:real^3 `; +ASM_SIMP_TAC[INSERT_COMM]; +UNDISCH_TAC ` FAN ((x:real^3),v_prime V FF,e_prime E FF) `; +NHANH (SPEC ` a:real^3` (GEN `v:real^3 ` FAN_IMP_FINITE_EE)); +DOWN; +REWRITE_TAC[SET_RULE` a IN x /\ b IN x <=> {a,b} SUBSET x `]; +ONCE_REWRITE_TAC[TAUT` a ==> b /\ c ==> d <=> b /\ a /\ c ==> d `]; +NHANH CARD_SUBSET; +UNDISCH_TAC ` ~(azim_cycle (EE a E) x a b = b) `; +NHANH CARD_2_FAN; +SIMP_TAC[INSERT_COMM]; +STRIP_TAC; +STRIP_TAC THEN DOWN; +ARITH_TAC; +MP_TAC ( +ISPECL [`FF:real^3 # real^3 -> bool`;` E: (real^3 -> bool) -> bool`] (GEN_ALL E_PRIME_SUBSET_E)); +NHANH ( +ISPECL [`S: (A -> bool) -> bool`;` a:A`] (GEN_ALL SUBSET_IMP_SO_DO_EE)); +ASSUME_TAC2 ( +SPEC `a:real^3 ` (GEN `v:real^3 ` FAN_IMP_FINITE_EE)); +DOWN; +ONCE_REWRITE_TAC[TAUT` a ==> b /\ c ==> d <=> b /\ c /\ a ==> d `]; +NHANH CARD_SUBSET; +ARITH_TAC; +DOWN; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +REMOVE_TAC THEN REMOVE_TAC; +MP_TAC ( +ISPECL [`FF:real^3 # real^3 -> bool`;` E: (real^3 -> bool) -> bool`] (GEN_ALL E_PRIME_SUBSET_E)); +NHANH ( +ISPECL [`S: (A -> bool) -> bool`;` v':A`] (GEN_ALL SUBSET_IMP_SO_DO_EE)); +ASM_SIMP_TAC[SUBSET_EMPTY]]);; + + + + + +(* OOOOOOOOOOOOOOOOOO *) +(* working here *) + + + + + + + + +let AZIM_IN_FAN_EQ_IZIM_E_PRIME = prove_by_refinement +(` FAN (vec 0,V,E) /\ v IN dart (hypermap (HYP (vec 0,V,E)) ) /\ + FF = face (hypermap (HYP (vec 0,V,E))) v /\ y IN FF +==> azim_in_fan y E = azim_in_fan y ( e_prime E FF ) `, +[ONCE_REWRITE_TAC[TAUT` a /\ b /\ c /\ d <=> (a /\ b /\ c ) /\ d `]; +NHANH IN_FF_IMP_AZIM_CYCLE_EQ; +STRIP_TAC; +ONCE_REWRITE_TAC[GSYM PAIR]; +REWRITE_TAC[azim_in_fan]; +LET_TAC; +LET_TAC; +ASSUME_TAC2 ( +SPEC` vec 0 : real^3 ` (GEN `x:real^3 ` CARD_E_GT1_EQ_CARD_E_PRIME)); +ASM_SIMP_TAC[]; +ASM_SIMP_TAC[]; +UNDISCH_TAC ` (y:real^3 # real^3 ) IN FF`; +FIRST_X_ASSUM NHANH; +ASM_CASES_TAC ` CARD (EE (FST (y:real^3 # real^3)) (E: (real^3->bool)->bool )) > 1 `; +ASM_SIMP_TAC[PAIR_EQ]; +ASM_SIMP_TAC[]; +DOWN; +ASM_SIMP_TAC[]]);; + + + + + +let AZIM_CY_FST_Y_IN_FF = +prove_by_refinement( +` xx IN dart (hypermap (HYP (x,V,E))) /\ + FAN (x,V,E) /\ FF = face (hypermap (HYP (x,V,E))) xx /\ y IN FF + ==> azim_cycle (EE (FST y) E) x (FST y) (SND y),FST y IN FF /\ +(inverse (face_map (hypermap (HYP (x,V,E))))) y = +azim_cycle (EE (FST y) E) x (FST y) (SND y),FST y `, +[NHANH FAN_FACE_IMP_IVS_F_IN_F; +REWRITE_TAC[GSYM ED_MA_O_NO_MA_EQ_INV_FA; o_THM]; +NHANH ELMS_OF_HYPERMAP_HYP; +IMP_TAC THEN IMP_TAC; STRIP_TAC ; +SIMP_TAC[]; +STRIP_TAC; +PAT_ONCE_REWRITE_TAC ` \x. f ( g x ) IN HH /\ hh ==> l ` [GSYM PAIR]; +SUBGOAL_THEN ` (y:real^3 # real^3) IN darts_of_hyp E V ` MP_TAC; +UNDISCH_TAC ` xx IN dart (hypermap (HYP (x,V,E))) `; +NHANH lemma_face_subset; +DOWN; +PHA; +ASM_REWRITE_TAC[]; +SET_TAC[]; +ASSUME_TAC2 IN_DARTS_IMP_NN_OF_HYP_TOO; +FIRST_X_ASSUM NHANH; +SIMP_TAC[ee_of_hyp2]; +SIMP_TAC[nn_of_hyp2]]);; + + + + + + + +let EE_FST_Y_EQ_SET_SET_SNDY = prove_by_refinement +(` FAN (x,V,E) /\ + v IN dart (hypermap (HYP (x,V,E))) /\ + FF = face (hypermap (HYP (x,V,E))) v /\ + y IN FF +==> ( EE (FST y) E = {SND y} <=> EE (FST y) (e_prime E FF) = {SND y} ) `, +[ONCE_REWRITE_TAC[TAUT` a /\ b /\ c /\ d <=> (a/\b/\c) /\d `]; +NHANH IN_FF_IMP_AZIM_CYCLE_EQ; +PHA; +ONCE_REWRITE_TAC[TAUT`a1/\a2/\a3/\a4/\a5 <=> a2 /\ a4 /\ a1/\a3/\a5 `]; +ONCE_REWRITE_TAC[TAUT` a /\ b /\ c <=> b /\ a /\ c `]; +NHANH AZIM_CY_FST_Y_IN_FF; +STRIP_TAC; +MP_TAC ( +SPEC ` x:real^3 ` (GEN `v:real^3 ` IMP_FAN_V_PRIME_E_PRIME)); +ANTS_TAC; +ASM_MESON_TAC[]; +DOWN_TAC; +NHANH (SPEC ` FST (y:real^3#real^3) ` (GEN `v:real^3 ` FAN_IMP_FINITE_EE)); +STRIP_TAC; +EQ_TAC; +NHANH_PAT `\x. x ==> y ` (SET_RULE` a = b ==> a SUBSET b `); +NHANH ( +SPECL [` x:real^3 `;` FST (y:real^3 # real^3)`] (GENL [` v:real^3 `;` w:real^3 `] (MESON[W_SUBSET_SINGLETON_IMP_IDE]`W SUBSET {p} ==> azim_cycle W v w p = p`) )); + +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` (y:real^3 # real^3 ) IN FF `; +FIRST_ASSUM NHANH; +SIMP_TAC[PAIR_EQ]; +STRIP_TAC; +STRIP_TAC; +UNDISCH_TAC ` FINITE (EE (FST (y:real^3 # real^3 )) (e_prime E FF)) `; +DOWN; +PHA; +NHANH (MESON[AZIM_CYCLE_PROPERTIES]` azim_cycle W v w p = p /\ FINITE W ==> W SUBSET {p}`); +UNDISCH_TAC ` EE (FST y) E = {SND (y:real^3 # real^3 )} `; +NHANH_PAT `\x. x ==> y ` (SET_RULE` a = {b} ==> b IN a `); +IMP_TAC; +STRIP_TAC; +STRIP_TAC; +SUBGOAL_THEN ` SND (y:real^3 # real^3 ) IN EE (FST y) (e_prime E FF) ` ASSUME_TAC; +DOWN; +UNDISCH_TAC ` (y:real^3 # real^3 ) IN FF `; +REWRITE_TAC[e_prime; EE; IN_ELIM_THM]; +MESON_TAC[PAIR]; +DOWN THEN PHA; +ASM_REWRITE_TAC[]; +MESON_TAC[SET_RULE` a IN b /\ b SUBSET {a} ==> b = {a} `]; + + +NHANH_PAT `\x. x ==> y ` (SET_RULE` a = b ==> a SUBSET b `); +NHANH ( +SPECL [` x:real^3 `;` FST (y:real^3 # real^3)`] (GENL [` v:real^3 `;` w:real^3 `] (MESON[W_SUBSET_SINGLETON_IMP_IDE]`W SUBSET {p} ==> azim_cycle W v w p = p`))); +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` (y:real^3 # real^3 ) IN FF `; +FIRST_ASSUM NHANH; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +ASM_SIMP_TAC[PAIR_EQ]; + +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +STRIP_TAC; +STRIP_TAC; +UNDISCH_TAC ` FINITE (EE (FST (y:real^3 # real^3 )) E) `; +ASM_REWRITE_TAC[]; +DOWN; +PHA; +NHANH (MESON[AZIM_CYCLE_PROPERTIES]` azim_cycle W v w p = p /\ FINITE W ==> W SUBSET {p}`); +UNDISCH_TAC ` EE (FST y) (e_prime E (face (hypermap (HYP (x,V,E))) v)) = {SND (y:real^3 # real^3 )} `; +NHANH_PAT `\x. x ==> y ` (SET_RULE` a = {b} ==> b IN a `); +IMP_TAC; +STRIP_TAC; +STRIP_TAC; +SUBGOAL_THEN ` SND (y:real^3 # real^3 ) IN EE (FST y) E ` ASSUME_TAC; +DOWN; +REWRITE_TAC[e_prime; EE; IN_ELIM_THM]; +MESON_TAC[PAIR]; +DOWN THEN PHA; +MESON_TAC[SET_RULE` a IN b /\ b SUBSET {a} ==> b = {a} `]]);; + + +let W_SUBSET_SINGLETON_IMP_IDE = +(MESON[W_SUBSET_SINGLETON_IMP_IDE]`W SUBSET {p} + ==> azim_cycle W v w p = p`);; + + +let EE_FST_Y_EQ_SET_SET_SNDY = prove_by_refinement +(` FAN (x,V,E) /\ + v IN dart (hypermap (HYP (x,V,E))) /\ + FF = face (hypermap (HYP (x,V,E))) v /\ + y IN FF +==> ( EE (FST y) E = {SND y} <=> EE (FST y) (e_prime E FF) = {SND y} ) `, +[ONCE_REWRITE_TAC[TAUT` a /\ b /\ c /\ d <=> (a/\b/\c) /\d `]; +NHANH IN_FF_IMP_AZIM_CYCLE_EQ; +PHA; +ONCE_REWRITE_TAC[TAUT`a1/\a2/\a3/\a4/\a5 <=> a4 /\ a2/\ a1/\a3/\a5 `]; +NHANH AZIM_CY_FST_Y_IN_FF; +STRIP_TAC; +MP_TAC ( +SPEC ` x:real^3 ` (GEN `v:real^3 ` IMP_FAN_V_PRIME_E_PRIME)); +ANTS_TAC; +ASM_MESON_TAC[]; +DOWN_TAC; +NHANH (SPEC ` FST (y:real^3#real^3) ` (GEN `v:real^3 ` FAN_IMP_FINITE_EE)); +STRIP_TAC; +EQ_TAC; +NHANH_PAT `\x. x ==> y ` (SET_RULE` a = b ==> a SUBSET b `); +NHANH ( +SPECL [` x:real^3 `;` FST (y:real^3 # real^3)`] (GENL [` v:real^3 `;` w:real^3 `] (MESON[W_SUBSET_SINGLETON_IMP_IDE]`W SUBSET {p} ==> azim_cycle W v w p = p`))); +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` (y:real^3 # real^3 ) IN FF `; +FIRST_ASSUM NHANH; +SIMP_TAC[PAIR_EQ]; +STRIP_TAC; +STRIP_TAC; +UNDISCH_TAC ` FINITE (EE (FST (y:real^3 # real^3 )) (e_prime E FF)) `; +DOWN; +PHA; +NHANH (MESON[AZIM_CYCLE_PROPERTIES]` azim_cycle W v w p = p /\ FINITE W ==> W SUBSET {p}`); +UNDISCH_TAC ` EE (FST y) E = {SND (y:real^3 # real^3 )} `; +NHANH_PAT `\x. x ==> y ` (SET_RULE` a = {b} ==> b IN a `); +IMP_TAC; +STRIP_TAC; +STRIP_TAC; +SUBGOAL_THEN ` SND (y:real^3 # real^3 ) IN EE (FST y) (e_prime E FF) ` ASSUME_TAC; +DOWN; +UNDISCH_TAC ` (y:real^3 # real^3 ) IN FF `; +REWRITE_TAC[e_prime; EE; IN_ELIM_THM]; +MESON_TAC[PAIR]; +DOWN THEN PHA; +ASM_REWRITE_TAC[]; +MESON_TAC[SET_RULE` a IN b /\ b SUBSET {a} ==> b = {a} `]; + + +NHANH_PAT `\x. x ==> y ` (SET_RULE` a = b ==> a SUBSET b `); +NHANH ( +SPECL [` x:real^3 `;` FST (y:real^3 # real^3)`] (GENL [` v:real^3 `;` w:real^3 `] W_SUBSET_SINGLETON_IMP_IDE)); +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` (y:real^3 # real^3 ) IN FF `; +FIRST_ASSUM NHANH; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +ASM_SIMP_TAC[PAIR_EQ]; + +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +STRIP_TAC; +STRIP_TAC; +UNDISCH_TAC ` FINITE (EE (FST (y:real^3 # real^3 )) E) `; +ASM_REWRITE_TAC[]; +DOWN; +PHA; +NHANH (MESON[AZIM_CYCLE_PROPERTIES]` azim_cycle W v w p = p /\ FINITE W ==> W SUBSET {p}`); +UNDISCH_TAC ` EE (FST y) (e_prime E (face (hypermap (HYP (x,V,E))) v)) = {SND (y:real^3 # real^3 )} `; +NHANH_PAT `\x. x ==> y ` (SET_RULE` a = {b} ==> b IN a `); +IMP_TAC; +STRIP_TAC; +STRIP_TAC; +SUBGOAL_THEN ` SND (y:real^3 # real^3 ) IN EE (FST y) E ` ASSUME_TAC; +DOWN; +REWRITE_TAC[e_prime; EE; IN_ELIM_THM]; +MESON_TAC[PAIR]; +DOWN THEN PHA; +MESON_TAC[SET_RULE` a IN b /\ b SUBSET {a} ==> b = {a} `]]);; + + + + +let WEDGE_IN_FAN_EQ_WITH_E_PRIME = +prove_by_refinement (` FAN (vec 0,V,E) /\ + v IN dart (hypermap (HYP (vec 0,V,E))) /\ + FF = face (hypermap (HYP (vec 0,V,E))) v /\ + y IN FF + ==> wedge_in_fan_ge y E = wedge_in_fan_ge y (e_prime E FF ) /\ +wedge_in_fan_gt y E = wedge_in_fan_gt y ( e_prime E FF ) `, +[ONCE_REWRITE_TAC[TAUT` a /\ b /\c /\ d <=> (a /\ b /\ c ) /\ d `]; +NHANH IN_FF_IMP_AZIM_CYCLE_EQ; +STRIP_TAC; +ASSUME_TAC2 ( +SPEC `vec 0: real^3 ` (GEN `x:real^3 ` CARD_E_GT1_EQ_CARD_E_PRIME)); +DOWN THEN DOWN; +FIRST_X_ASSUM NHANH; +PAT_ONCE_REWRITE_TAC`\x. a ==> b ==> x ` [GSYM PAIR]; +SIMP_TAC[wedge_in_fan_ge; wedge_in_fan_gt]; +STRIP_TAC; +DISCH_TAC; +ASM_CASES_TAC `CARD (EE (FST (y:real^3 # real^3)) E) > 1 `; +DOWN; +ASM_SIMP_TAC[]; +ABBREV_TAC ` FD = face (hypermap (HYP (vec 0,V,E))) v `; +DOWN_TAC; +REWRITE_TAC[PAIR_EQ]; +SIMP_TAC[]; +DOWN; +ASM_SIMP_TAC[]; +DOWN_TAC; +STRIP_TAC; +ABBREV_TAC ` FD = face (hypermap (HYP (vec 0,V,E))) v `; +SUBGOAL_THEN ` EE (FST y) E = {SND (y:real^3 # real^3)} <=> +EE (FST y) ( e_prime E FD ) = {SND y }` ASSUME_TAC; +MATCH_MP_TAC (SPEC ` vec 0:real^3 ` (GEN `x:real^3 ` EE_FST_Y_EQ_SET_SET_SNDY)); +ASM_REWRITE_TAC[]; +DOWN; +EXPAND_TAC "FD"; +ASM_SIMP_TAC[EQ_SYM_EQ]; +DOWN THEN MESON_TAC[]]);; + + + + + +let FACE_NODE_EDGE_ORBIT_INVERSE = prove( +` face (H:(A) hypermap) x = orbit_map ( inverse (face_map H )) x /\ +node H x = orbit_map (inverse ( node_map H)) x /\ +edge H x = orbit_map (inverse ( edge_map H )) x `, +MP_TAC (SPEC_ALL hypermap_lemma) THEN +SIMP_TAC[face;node;edge] THEN +MESON_TAC[lemma_card_inverse_map_eq]);; + + + + + + + +let DARTS_E_PRIME_EQ_FF_UNION_SWITCH = +prove_by_refinement(` (! x. x IN FF ==> {FST x, SND x } IN E ) +==> darts_of_hyp (e_prime E FF) (v_prime V FF) = +FF UNION { ((v:A),w) | (w,v) IN FF }`, +[REWRITE_TAC[darts_of_hyp;EXTENSION; IN_UNION]; +REWRITE_TAC[ord_pairs; self_pairs; IN_ELIM_THM; e_prime; v_prime]; +STRIP_TAC THEN GEN_TAC; +EQ_TAC; +STRIP_TAC; +DOWN_TAC THEN REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; +MESON_TAC[]; +DOWN THEN DOWN THEN REWRITE_TAC[EE]; +REWRITE_TAC[SET_RULE` x = {} <=> (! a. ~ ( a IN x ))`]; +REWRITE_TAC[IN_ELIM_THM; NOT_EXISTS_THM]; +ASM_MESON_TAC[FST;SND]; +STRIP_TAC; +DISJ1_TAC; +EXISTS_TAC ` FST (x:A#A) `; +EXISTS_TAC ` SND (x:A#A) `; +REWRITE_TAC[]; +EXISTS_TAC ` FST (x:A#A) `; +EXISTS_TAC ` SND (x:A#A) `; +ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[]; +DISJ1_TAC; +EXISTS_TAC ` v:A`; +EXISTS_TAC `w:A`; +ASM_REWRITE_TAC[]; +EXISTS_TAC `w:A`; +EXISTS_TAC ` v:A`; +ASM_SIMP_TAC[INSERT_COMM;PAIR; FST; SND]; +ASM_MESON_TAC[INSERT_COMM;PAIR; FST; SND]]);; + + + + + + + +let CARD_FF_GT1_FF_SUBSET = +prove_by_refinement(` FAN ((v:real^3),V,E) /\ + FF = face (hypermap (HYP (v,V,E))) x /\ + 1 < CARD (FF) + ==> (! y. y IN FF ==> {FST y, SND y} IN E ) `, +[NHANH ELMS_OF_HYPERMAP_HYP; +ASM_CASES_TAC ` ~( x IN darts_of_hyp E (V:real^3 -> bool) ) \/ +x IN self_pairs E V `; +STRIP_TAC; +SUBGOAL_THEN ` face_map (hypermap (HYP (v,V,E))) x = x ` MP_TAC; +ASM_SIMP_TAC[ff_of_hyp3]; +ABBREV_TAC ` tt = face_map (hypermap (HYP (v,V,E))) `; +ONCE_REWRITE_TAC[orbit_one_point]; +REWRITE_TAC[BETA_THM]; +EXPAND_TAC "tt"; +REWRITE_TAC[GSYM face]; +UNDISCH_TAC ` 1 < CARD (FF: real^3 # real^3 -> bool) `; +ASM_REWRITE_TAC[]; +MESON_TAC[CARD_SINGLETON; ARITH_RULE ` ~( 1 < 1 ) `]; +DOWN; +REWRITE_TAC[DE_MORGAN_THM]; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +STRIP_TAC THEN STRIP_TAC; +UNDISCH_TAC ` x IN darts_of_hyp E (V:real^3 -> bool) `; +ASM_REWRITE_TAC[]; +NHANH lemma_face_subset; +DOWN_TAC; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +REWRITE_TAC[SUBSET]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM NHANH; +ASM_REWRITE_TAC[darts_of_hyp; IN_UNION]; +REPEAT STRIP_TAC; +DOWN; +REWRITE_TAC[IN_ORD_E_EQ_IN_E]; +SUBGOAL_THEN ` face_map (hypermap (HYP (v,V,E))) y = y ` MP_TAC; +ASM_REWRITE_TAC[]; +ASM_SIMP_TAC[ff_of_hyp3]; +ABBREV_TAC ` tt = face_map (hypermap (HYP (v,V,E))) `; +ONCE_REWRITE_TAC[orbit_one_point]; +REPLICATE_TAC 3 DOWN; +NHANH lemma_face_identity; +REPEAT STRIP_TAC THEN DOWN; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +UNDISCH_TAC ` 1 < CARD (FF: real^3 # real^3 -> bool) `; +ASM_REWRITE_TAC[GSYM face]; +MESON_TAC[CARD_SINGLETON; ARITH_RULE ` ~( 1 < 1 ) `]]);; + + + + + + + + + +let DARTS_E_PRIME_GT1_SWITCH = prove( +` FAN (v,V,E) /\ FF = face (hypermap (HYP (v,V,E))) x /\ 1 < CARD FF +==> darts_of_hyp (e_prime E FF) (v_prime V FF) = + FF UNION {v,w | w,v IN FF}`, +NHANH CARD_FF_GT1_FF_SUBSET THEN +NHANH DARTS_E_PRIME_EQ_FF_UNION_SWITCH THEN SIMP_TAC[]);; + + + + + + +let FAN_FACE_GT1_IMAGE_EE_OF_HYP = prove_by_refinement +(` x IN darts_of_hyp E V /\ +FAN (v,V,E) /\ FF = face (hypermap (HYP (v,V,E))) x /\ 1 < CARD FF + ==> darts_of_hyp (e_prime E FF) (v_prime V FF) = + FF UNION IMAGE (ee_of_hyp (v,V,E)) FF `, +[NHANH DARTS_E_PRIME_GT1_SWITCH; +NHANH ELMS_OF_HYPERMAP_HYP; +SIMP_TAC[]; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +STRIP_TAC; +UNDISCH_TAC ` x IN darts_of_hyp E (V:real^3 -> bool) `; +ASM_REWRITE_TAC[]; +NHANH lemma_face_subset; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +STRIP_TAC; +MATCH_MP_TAC (MESON[]` x = y ==> f x = f y `); +REWRITE_TAC[IMAGE; EXTENSION; IN_ELIM_THM]; +UNDISCH_TAC ` ee_of_hyp (v,V,E) = edge_map (hypermap (HYP (v,V,E))) `; +DISCH_THEN (SUBST1_TAC o SYM); +DOWN; +REWRITE_TAC[SUBSET]; +USE_FIRST ` darts_of_hyp E V = dart (hypermap (HYP (v,V,E))) ` (SUBST1_TAC +o SYM); +REWRITE_TAC[ee_of_hyp2]; +MESON_TAC[FST; SND; PAIR]]);; + + + + + +let IN_ORD_PAIRS_E_PRIME = prove(` x IN ord_pairs (e_prime E FF) ==> +x IN ord_pairs E /\ x IN darts_of_hyp E V`, +REWRITE_TAC[darts_of_hyp; IN_UNION; e_prime; ord_pairs; IN_ELIM_THM] +THEN MESON_TAC[]);; + + + + +let CARD_GT1_EE_OF_HYP_E_PRIME_EQ = prove_by_refinement +(` FAN (v,V,E) /\ x IN dart (hypermap (HYP (v,V,E))) /\ + FF = face (hypermap (HYP (v,V,E))) x /\ +1 < CARD FF +==> (! x. x IN FF ==> ee_of_hyp (v,V,E) x = +ee_of_hyp (v,v_prime V FF,e_prime E FF) x ) `, +[NHANH lemma_face_subset; +NHANH ELMS_OF_HYPERMAP_HYP; +ONCE_REWRITE_TAC[TAUT` (a1/\a2)/\a3/\a4 <=> a2 /\a3/\a1/\a4`]; +NHANH DARTS_E_PRIME_GT1_SWITCH; +REPEAT STRIP_TAC; +REWRITE_TAC[ee_of_hyp2]; +SUBGOAL_THEN ` x' IN darts_of_hyp E (V:real^3 -> bool) ` MP_TAC; +UNDISCH_TAC ` face (hypermap (HYP (v,V,E))) x SUBSET +dart (hypermap (HYP (v,V,E))) `; +ASM_REWRITE_TAC[SUBSET]; +DISCH_THEN MATCH_MP_TAC; +UNDISCH_TAC ` x':real^3 # real^3 IN FF `; +MATCH_MP_TAC (MESON[]` x = y ==> f x ==> f y `); +FIRST_X_ASSUM ACCEPT_TAC; +UNDISCH_TAC ` x':real^3 # real^3 IN FF `; +REWRITE_TAC[TAUT` a ==> b ==> c <=> b /\ a ==> c `]; +NHANH IN_DARTS_FF_IMP_DARTS_E_PRIME_V_PRIME; +SIMP_TAC[]]);; + + + + +let FF_IMAGE_EE_OF_HYP_EQ_E_PRIME = prove_by_refinement +(` FAN (v,V,E) /\ x IN dart (hypermap (HYP (v,V,E))) /\ + FF = face (hypermap (HYP (v,V,E))) x /\ +1 < CARD FF +==> IMAGE (ee_of_hyp (v,V,E)) FF = + IMAGE (ee_of_hyp (v,v_prime V FF,e_prime E FF)) FF `, +[NHANH lemma_face_subset; +NHANH ELMS_OF_HYPERMAP_HYP; +ONCE_REWRITE_TAC[TAUT` (a1/\a2)/\a3/\a4 <=> a2 /\a3/\a1/\a4`]; +NHANH DARTS_E_PRIME_GT1_SWITCH; +STRIP_TAC; +REWRITE_TAC[IMAGE; EXTENSION; IN_ELIM_THM]; +GEN_TAC THEN EQ_TAC; +STRIP_TAC; +EXISTS_TAC ` x'': real^3 # real^3 `; +ASM_REWRITE_TAC[]; +REWRITE_TAC[ee_of_hyp2]; +SUBGOAL_THEN ` x'' IN darts_of_hyp E (V:real^3 -> bool) ` MP_TAC; +UNDISCH_TAC ` face (hypermap (HYP (v,V,E))) x SUBSET +dart (hypermap (HYP (v,V,E))) `; +ASM_REWRITE_TAC[SUBSET]; +DISCH_THEN MATCH_MP_TAC; +UNDISCH_TAC ` x'':real^3 # real^3 IN FF `; +MATCH_MP_TAC (MESON[]` x = y ==> f x ==> f y `); +FIRST_X_ASSUM ACCEPT_TAC; +UNDISCH_TAC ` x'':real^3 # real^3 IN FF `; +REWRITE_TAC[TAUT` a ==> b ==> c <=> b /\ a ==> c `]; +NHANH IN_DARTS_FF_IMP_DARTS_E_PRIME_V_PRIME; +USE_FIRST ` FF = face (hypermap (HYP (v,V,E))) x ` (SUBST1_TAC o SYM); +SIMP_TAC[]; +STRIP_TAC; +SUBGOAL_THEN ` x'' IN darts_of_hyp E (V:real^3 -> bool) ` MP_TAC; +UNDISCH_TAC ` face (hypermap (HYP (v,V,E))) x SUBSET +dart (hypermap (HYP (v,V,E))) `; +ASM_REWRITE_TAC[SUBSET]; +DISCH_THEN MATCH_MP_TAC; +UNDISCH_TAC ` x'':real^3 # real^3 IN FF `; +MATCH_MP_TAC (MESON[]` x = y ==> f x ==> f y `); +FIRST_X_ASSUM ACCEPT_TAC; +SUBGOAL_THEN ` x'':real^3 # real^3 IN darts_of_hyp (e_prime E FF) (v_prime V FF) ` MP_TAC; +UNDISCH_TAC ` x'':real^3 # real^3 IN FF `; +ASM_REWRITE_TAC[IN_UNION]; +CONV_TAC TAUT; +REPEAT STRIP_TAC; +EXISTS_TAC `x'':real^3 # real^3 `; +ASM_REWRITE_TAC[]; +DOWN THEN DOWN; +SIMP_TAC[ee_of_hyp2]; +USE_FIRST` FF = face (hypermap (HYP (v,V,E))) x ` (SUBST1_TAC o SYM); +SIMP_TAC[]]);; + + + + +let FIRST_AAUHTVE2 = prove(` FAN (x,V,E) ==> + FINITE (darts_of_hyp E V) /\ + ee_of_hyp (x,V,E) permutes darts_of_hyp E V /\ + nn_of_hyp (x,V,E) permutes darts_of_hyp E V /\ + ff_of_hyp (x,V,E) permutes darts_of_hyp E V /\ + ee_of_hyp (x,V,E) o nn_of_hyp (x,V,E) o ff_of_hyp (x,V,E) = I /\ + ee_of_hyp (x,V,E) o ee_of_hyp (x,V,E) = I `, +NHANH (SMOOTH_GEN_ALL (REWRITE_RULE[TAUT` a/\b ==> c <=> +a ==> b ==> c `] FIRST_AAUHTVE)) THEN +REWRITE_TAC[HYP; PAIR_EQ] THEN MESON_TAC[]);; + + + + + + + +let NOT_IN_DART_IMP_IDE = prove( +` ~( x IN dart H ) ==> +edge_map H x = x /\ +node_map H x = x /\ +face_map H x = x:A `, +MP_TAC (SPEC `H:(A) hypermap ` hypermap_lemma) +THEN REWRITE_TAC[permutes] THEN SIMP_TAC[]);; + + + + + +let SIMPLE_IMP_DISTINCT_FF_NODE_IMAGE = +prove_by_refinement(` simple_hypermap H /\ FF = face H x /\ +(! x. (x:A) IN FF ==> ~( node_map H x = x )) +==> FF INTER IMAGE (node_map H ) FF = {} `, +[REWRITE_TAC[simple_hypermap; INTER; IMAGE]; +STRIP_TAC; +REWRITE_TAC[ EXTENSION; NOT_IN_EMPTY]; +GEN_TAC; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +UNDISCH_TAC ` x'':A IN FF `; +REWRITE_TAC[]; +FIRST_X_ASSUM NHANH; +ASM_CASES_TAC ` x'':A IN dart H `; +DOWN; +FIRST_X_ASSUM NHANH; +REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM; SET_RULE` {x} a <=> x = a `]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +NHANH lemma_face_identity; +STRIP_TAC; +SUBGOAL_THEN ` x':A IN node H x'' /\ x'' IN node H x'' ` (fun x -> +ASM_MESON_TAC[x]); +ASM_REWRITE_TAC[node_refl; node; in_orbit_map1]; +DOWN; +NHANH NOT_IN_DART_IMP_IDE; +SIMP_TAC[]]);; + + + + + +let FX_IN_S_IMP_F_POWER_TOO = +prove(` (! (x:A). x IN S ==> f x IN S ) /\ x IN S ==> +(!n. (f POWER n ) x IN S ) `, DISCH_TAC THEN INDUCT_TAC THENL +[ASM_REWRITE_TAC[POWER; I_THM]; +REWRITE_TAC[COM_POWER; o_THM] THEN +ASM_MESON_TAC[]]);; + +let FX_IN_S_IMP_ORBIT_SUBSET = prove( +` (!(x:A). x IN S ==> f x IN S) /\ x IN S +==> orbit_map f x SUBSET S `, +NHANH FX_IN_S_IMP_F_POWER_TOO THEN +REWRITE_TAC[orbit_map; SUBSET; IN_ELIM_THM; ARITH_RULE` n >= 0`] +THEN MESON_TAC[]);; + + + + + +let FAN_DARTS_OF_IN_D = prove_by_refinement( +` FAN (v,V,E) /\ x IN darts_of_hyp E V /\ +FF = face (hypermap (HYP (v,V,E))) x /\ +x' IN FF ==> x' IN darts_of_hyp E V`, +[NHANH ELMS_OF_HYPERMAP_HYP; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +IMP_TAC THEN STRIP_TAC; +ASM_REWRITE_TAC[]; +NHANH_PAT `\x. x ==> y ` lemma_face_subset; +REWRITE_TAC[SUBSET]; MESON_TAC[]]);; + + + + + +let FAN_DART_DARTS = prove(` FAN (x,V,E) ==> +dart (hypermap (HYP (x,V,E))) = darts_of_hyp E V `, +NHANH ELMS_OF_HYPERMAP_HYP THEN SIMP_TAC[]);; + + + + +let FACE_SUBSET_DARTS = prove(` FAN (v,V,E) /\ x IN darts_of_hyp E V ==> +face (hypermap (HYP (v,V,E))) x SUBSET darts_of_hyp E V`, +IMP_TAC THEN NHANH ELMS_OF_HYPERMAP_HYP THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +SIMP_TAC[lemma_face_subset]);; + + + + + +let FF_DISJOINT_ITS_IMAGE_CARD_EQ = prove_by_refinement +(` FAN (v,V,E) /\ + x IN darts_of_hyp E V /\ + FF = face (hypermap (HYP (v,V,E))) x /\ + simple_hypermap (hypermap (HYP (v,v_prime V FF,e_prime E FF))) /\ + 2 < CARD (FF) ==> + FF INTER IMAGE (nn_of_hyp (v,v_prime V FF, e_prime E FF)) FF = {} /\ + CARD FF = CARD (IMAGE (nn_of_hyp (v,v_prime V FF, e_prime E FF)) FF)`, +[ONCE_REWRITE_TAC[TAUT` a1/\a2/\a3/\a4/\a5 <=> (a2/\a1/\a3/\a5)/\a4`]; +NHANH FAN_FACE_GT1_IMAGE_EE_OF_HYP; +STRIP_TAC; +SUBGOAL_THEN ` FAN (v,v_prime V (FF:real^3 # real^3 -> bool),e_prime E FF) ` + MP_TAC; +DOWN_TAC; +NHANH_PAT `\x. x ==> i ` ELMS_OF_HYPERMAP_HYP; +ASM_MESON_TAC[IMP_FAN_V_PRIME_E_PRIME]; +NHANH ELMS_OF_HYPERMAP_HYP; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[]; +STRIP_TAC; +CONJ_TAC; +SUBGOAL_THEN ` (! x. (x:real^3 # real^3) IN FF ==> +~( node_map (hypermap (HYP (v,v_prime V FF,e_prime E FF))) x = x )) ` MP_TAC; +ONCE_REWRITE_TAC[inverse2_hypermap_maps]; +REPEAT STRIP_TAC; +DOWN; +REWRITE_TAC[o_THM]; +NHANH (MESON[]` ( inverse f) x = y ==> f (( inverse f) x ) = f y `); + +MP_TAC (ISPEC ` +(hypermap (HYP (v,v_prime V FF,e_prime E FF))) ` edge_map_and_darts); +NHANH PERMUTES_INVERSES; +SIMP_TAC[]; +STRIP_TAC; +STRIP_TAC; +ABBREV_TAC ` f = face_map (hypermap (HYP (v,v_prime V FF,e_prime E FF))) `; +ABBREV_TAC ` e = edge_map (hypermap (HYP (v,v_prime V FF,e_prime E FF))) `; +ABBREV_TAC ` n = node_map (hypermap (HYP (v,v_prime V FF,e_prime E FF))) `; +ASM_CASES_TAC ` (f:real^3 # real^3 -> real^3 # real^3) x' = e x' `; +UNDISCH_TAC` FAN ((v:real^3),v_prime V FF,e_prime E FF) `; +REWRITE_TAC[]; +NHANH FIRST_AAUHTVE2; +UNDISCH_TAC `FF = face (hypermap (HYP (v,V,E))) x`; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +STRIP_TAC; +UNDISCH_TAC ` inverse (e:real^3#real^3->real^3#real^3) (inverse + (f:real^3#real^3->real^3#real^3) x') = (x':real^3 # real^3 ) `; +REWRITE_TAC[]; +NHANH (MESON[]` inverse e ( f x ) = y ==> e (inverse e ( f x )) = e y `); +NHANH (MESON[]` e (inverse e ((inverse f ) x )) = y ==>f ( e (inverse e ( (inverse f ) x ))) = f y `); +UNDISCH_TAC `e permutes dart +(hypermap (HYP (v,v_prime V FF,e_prime E FF)))`; +UNDISCH_TAC ` f permutes dart +(hypermap (HYP (v,v_prime V FF,e_prime E FF))) `; +PHA; +NHANH PERMUTES_INVERSES; +SIMP_TAC[]; +REPEAT STRIP_TAC; +UNDISCH_TAC ` x':real^3 # real^3 IN FF `; +EXPAND_TAC "FF"; +PHA; +NHANH lemma_face_identity; +SUBGOAL_THEN ` orbit_map f (x':real^3 # real^3) = {x', e x'} ` ASSUME_TAC; +REWRITE_TAC[GSYM SUBSET_ANTISYM_EQ]; +CONJ_TAC; +MATCH_MP_TAC FX_IN_S_IMP_ORBIT_SUBSET; +REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY]; +GEN_TAC THEN DISCH_THEN DISJ_CASES_TAC; +DISJ2_TAC; +FIRST_X_ASSUM SUBST1_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +DISJ1_TAC; +FIRST_X_ASSUM SUBST1_TAC; +FIRST_X_ASSUM (ACCEPT_TAC o SYM); +REWRITE_TAC[SUBSET; IN_INSERT; NOT_IN_EMPTY]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM SUBST1_TAC; +REWRITE_TAC[orbit_reflect]; +FIRST_X_ASSUM SUBST1_TAC; +REWRITE_TAC[orbit_reflect]; +EXPAND_TAC "f"; +REWRITE_TAC[GSYM face]; +ASM_MESON_TAC[lemma_inverse_in_face; face_refl]; +DOWN; +ASM_REWRITE_TAC[face]; +MP_TAC LOCALIZE_PRESERVE_FACE; +ANTS_TAC; +ASM_REWRITE_TAC[]; +DOWN_TAC; +NHANH ELMS_OF_HYPERMAP_HYP; +SIMP_TAC[]; +ASM_SIMP_TAC[face]; +REPEAT STRIP_TAC; +DOWN; +PHA; +NHANH (MESON[orbit_reflect]` S = orbit_map f x ==> x IN S `); +EXPAND_TAC "f"; +REWRITE_TAC[GSYM face]; +NHANH lemma_face_identity; +ASM_SIMP_TAC[]; +REPLICATE_TAC 3 DOWN; +UNDISCH_TAC ` 2 < CARD (FF:real^3 # real^3 -> bool) `; +EXPAND_TAC "f"; +REWRITE_TAC[GSYM face]; +SIMP_TAC[]; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[]; +DISCH_TAC; +REMOVE_TAC; +DISCH_THEN (SUBST1_TAC o SYM); +REMOVE_TAC; +DOWN; +MESON_TAC[Geomdetail.CARD2; ARITH_RULE` a <= 2 ==> ~(2 < a ) `]; +MP_TAC (ISPEC `hypermap (HYP (v,v_prime V FF,e_prime E FF)) ` + hypermap_lemma); +UNDISCH_TAC `FF = face (hypermap (HYP (v,V,E))) (x:real^3 # real^3) `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM]; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPEC `x':real^3 # real^3 `)); +PHA; +NHANH (MESON[]` f x = y ==> f ( f x ) = f y `); +UNDISCH_TAC ` FAN (v:real^3,v_prime V FF,e_prime E FF) `; +NHANH FIRST_AAUHTVE2; +DOWN THEN REMOVE_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +DOWN; +SIMP_TAC[FUN_EQ_THM; o_THM; I_THM]; +REPEAT STRIP_TAC; +UNDISCH_TAC `simple_hypermap (hypermap (HYP (v,v_prime V FF,e_prime E FF))) + `; +REWRITE_TAC[simple_hypermap]; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC ` +(f:real^3 # real^3 -> real^3 # real^3) x' `)); +ANTS_TAC; +UNDISCH_TAC ` FAN (v:real^3,v_prime V FF,e_prime E FF) `; +NHANH (SMOOTH_GEN_ALL (GEN `y:real^3 # real^3 ` + FAN_IMP_IN_DARTS_IFF_FF_TOO)); +ASM_REWRITE_TAC[]; +STRIP_TAC; +FIRST_ASSUM (fun x -> ONCE_REWRITE_TAC[GSYM x]); +UNDISCH_TAC `darts_of_hyp (e_prime E FF) (v_prime V FF) = + dart (hypermap (HYP (v,v_prime V FF,e_prime E FF))) `; +DISCH_THEN (ASSUME_TAC o SYM); +FIRST_ASSUM SUBST1_TAC; +MATCH_MP_TAC IN_DARTS_FF_IMP_DARTS_E_PRIME_V_PRIME; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC FAN_DARTS_OF_IN_D; +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC ( +ISPECL [`hypermap (HYP (v,v_prime V FF,e_prime E FF)) `; +` (f:real^3 # real^3 -> real^3 # real^3) x' ` ] face_refl); +PHA; +NHANH lemma_inverse_in_face; +NHANH lemma_inverse_in_face; +ASM_SIMP_TAC[PERMUTES_INVERSES]; +UNDISCH_TAC `f permutes dart (hypermap (HYP (v,v_prime V FF,e_prime E FF))) `; +NHANH PERMUTES_INVERSES; +SIMP_TAC[]; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +SUBGOAL_THEN ` n (f (x':real^3 # real^3)) IN node (hypermap (HYP (v,v_prime V FF,e_prime E + FF))) (f x') ` MP_TAC; +EXPAND_TAC "n"; +REWRITE_TAC[node; in_orbit_map1]; +ASM_REWRITE_TAC[]; +DOWN; +MATCH_MP_TAC (SET_RULE` ~( a IN B INTER A ) ==> a IN A ==> ~( a IN B ) `); +ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY]; +STRIP_TAC; +REWRITE_TAC[EXTENSION; NOT_IN_EMPTY; IN_INTER; IMAGE; IN_ELIM_THM]; +REPEAT STRIP_TAC; +UNDISCH_TAC ` simple_hypermap (hypermap (HYP +(v,v_prime V FF,e_prime E FF))) `; +REWRITE_TAC[simple_hypermap]; +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC o (SPEC ` x'':real^3 # real^3 `)); +DOWN; +ANTS_TAC; +UNDISCH_TAC ` FAN (v:real^3,v_prime V FF,e_prime E FF)`; + +SIMP_TAC[FAN_DART_DARTS]; +STRIP_TAC; +MATCH_MP_TAC IN_DARTS_FF_IMP_DARTS_E_PRIME_V_PRIME; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC FAN_DARTS_OF_IN_D; +ASM_REWRITE_TAC[]; +MP_TAC (SPEC ` x'': real^3 # real^3 ` (GEN `x:real^3 # real^3 ` + LOCALIZE_PRESERVE_FACE)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +CONJ_TAC; +MATCH_MP_TAC (SET_RULE` x IN FF /\ FF SUBSET A ==> x IN A `); +ASM_REWRITE_TAC[]; +MATCH_MP_TAC lemma_face_subset; +UNDISCH_TAC ` FAN (v:real^3,V,E)`; +NHANH ELMS_OF_HYPERMAP_HYP; +ASM_SIMP_TAC[]; +MATCH_MP_TAC lemma_face_identity; +UNDISCH_TAC ` x'':real^3 # real^3 IN FF `; +ASM_SIMP_TAC[]; +DISCH_TAC; +REWRITE_TAC[EXTENSION; IN_INTER; IN_INSERT; NOT_IN_EMPTY]; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC ` x':real^3 # real^3 `)); +FIRST_X_ASSUM (MP_TAC o (SPEC ` x'': real^3 # real^3 `)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN ` x' IN node (hypermap (HYP (v,v_prime V FF,e_prime E FF))) x''` +MP_TAC; +ASM_REWRITE_TAC[node; in_orbit_map1]; + +REPLICATE_TAC 4 DOWN THEN PHA; +MESON_TAC[]; +MATCH_MP_TAC CARD_IMAGE_INJ; +MP_TAC (ISPEC ` hypermap (HYP (v,v_prime V FF,e_prime E FF)) ` + node_map_and_darts); +REWRITE_TAC[permutes; EXISTS_UNIQUE]; +STRIP_TAC; +CONJ_TAC; +DOWN; +MESON_TAC[]; +UNDISCH_TAC ` FAN (v:real^3,V,E) `; +NHANH FAN_IMP_FIMITE_DARTS; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC (MESON[FINITE_SUBSET]` (a ==> A SUBSET B) ==> +a /\ FINITE B ==> FINITE A `); +STRIP_TAC; +MATCH_MP_TAC FACE_SUBSET_DARTS; +ASM_REWRITE_TAC[]]);; + + + + + +let HYP_MAPS_INJ = prove( +`(! (x:A) y. edge_map H x = edge_map H y <=> x = y ) /\ +(! x y. node_map H x = node_map H y <=> x = y ) /\ +(! x y. face_map H x = face_map H y <=> x = y ) `, +MP_TAC (SPEC_ALL hypermap_lemma) THEN +REWRITE_TAC[permutes] THEN MESON_TAC[]);; + + + + + +let SIMPLE_FACE_DISJOINT_NODE_MAP_2 = prove_by_refinement +(` (x:A) IN dart H /\ +face H x SUBSET dart H /\ +simple_hypermap H /\ +face H x INTER IMAGE (node_map H) (face H x) = {} /\ +dart H = face H x UNION IMAGE (node_map H) (face H x) +==> !x. x IN dart H + ==> ~(node_map H x = x) /\ node_map H (node_map H x) = x `, +[STRIP_TAC; +ASM_REWRITE_TAC[IN_UNION]; +GEN_TAC; +DISCH_TAC; +SUBGOAL_THEN ` ~( node_map H x':A = x') ` ASSUME_TAC; +STRIP_TAC; +FIRST_X_ASSUM DISJ_CASES_TAC; +UNDISCH_TAC ` face H (x:A) INTER IMAGE (node_map H) (face H x) = {}`; +PHA; +REWRITE_TAC[SET_RULE `~( a INTER b = {} ) <=> ? x. x IN a /\ x IN b `]; +REPEAT (EXISTS_TAC ` x':A` THEN +ASM_REWRITE_TAC[IN_IMAGE]); +DOWN; +REWRITE_TAC[IN_IMAGE]; +EXPAND_TAC "x'"; +REWRITE_TAC[HYP_MAPS_INJ]; +STRIP_TAC; + +ASM SET_TAC[]; + +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` x' IN face H x \/ x' IN IMAGE (node_map H) (face H (x:A)) `; +SPEC_TAC (`x':A`,` x':A `); +REWRITE_TAC[MESON[]` a \/ b ==> c <=> (a ==> c ) /\ ( b ==> c ) `; +MESON[]` (! x. P x /\ Q x ) <=> (! x. P x ) /\ (! x. Q x ) `]; +MATCH_MP_TAC (TAUT` a /\ ( a ==> b ) ==> a /\ b `); +CONJ_TAC; +DOWN THEN REMOVE_TAC; +REPEAT STRIP_TAC; +ASM_CASES_TAC ` node_map H (x':A) = x' `; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 lemma_face_subset; +SUBGOAL_THEN` x':A IN dart H ` MP_TAC; +DOWN; +REWRITE_TAC[SUBSET]; +DISCH_THEN MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +NHANH lemma_dart_invariant; +STRIP_TAC; +UNDISCH_TAC `node_map H x':A IN dart H `; +NHANH lemma_dart_invariant; +STRIP_TAC; +UNDISCH_TAC `node_map H (node_map H x':A) IN dart H `; +ASM_REWRITE_TAC[IN_UNION]; +STRIP_TAC; +UNDISCH_TAC ` simple_hypermap (H:(A)hypermap) `; +REWRITE_TAC[simple_hypermap]; +DISCH_THEN (MP_TAC o (SPEC `x': A `)); +ANTS_TAC; +FIRST_ASSUM ACCEPT_TAC; +REWRITE_TAC[EXTENSION; IN_INTER; IN_INSERT; NOT_IN_EMPTY]; +DISCH_THEN (fun x -> REWRITE_TAC[GSYM x]); +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` x':A IN face H x `; +NHANH_PAT`\x. x ==> i ` lemma_face_identity; +STRIP_TAC; +CONJ_TAC; +REWRITE_TAC[node]; +MESON_TAC[orbit_reflect;IN_ORBIT_MAP_IMP_F_Y]; +ASM_MESON_TAC[]; +DOWN; +REWRITE_TAC[IN_IMAGE; HYP_MAPS_INJ]; +STRIP_TAC; +UNDISCH_TAC ` face H (x:A) INTER IMAGE (node_map H) (face H x) = {}`; +REWRITE_TAC[SET_RULE` A INTER B = {} <=> ! x. x IN A ==> ~( x IN B ) `]; +DISCH_THEN (MP_TAC o (SPEC` x'':A`)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +EXPAND_TAC "x''"; +REWRITE_TAC[IN_IMAGE]; +UNDISCH_TAC ` (x':A) IN face H x `; +MESON_TAC[]; +STRIP_TAC; +REWRITE_TAC[IN_IMAGE]; +REPEAT STRIP_TAC; +DOWN; +FIRST_X_ASSUM NHANH; +ASM_SIMP_TAC[]]);; + + + + +let ITER12 = prove(` ! f x. ITER 1 f x = f x /\ ITER 2 f x = f ( f x )`, +REWRITE_TAC[ARITH_RULE` 2 = SUC 1 /\ 1 = SUC 0`; ITER]);; + + + + +let ENF_RULE t = +prove(t, MESON_TAC[edge_map_and_darts;hypermap_lemma; convolution_rep]);; + +let EDGE_MAP_RESO_INVERSE = ENF_RULE +` (edge_map H ) o (edge_map H ) = I <=> inverse (edge_map H ) = edge_map H `;; + + +let EDGE_MAP_RESO_INVERSE = CONJ EDGE_MAP_RESO_INVERSE ( +ENF_RULE `node_map H o node_map H = I <=> inverse (node_map H) = node_map H `);; + + + +let HAS_ORD2_INTERPRET = prove(` f has_orders 2 <=> f o f = I /\ ~( f = I ) `, +SIMP_TAC[has_orders; ITER12; FUN_EQ_THM; o_THM; ARITH_RULE ` 0 < c /\ c < 2 +<=> c = 1 `] THEN MESON_TAC[]);; + + + + +let HYP_MAPS_INVS = prove(` edge_map H (inverse ( edge_map H ) x ) = x /\ + inverse (edge_map H) ( edge_map H x ) = x /\ +face_map H (inverse ( face_map H ) x ) = x /\ + inverse (face_map H) ( face_map H x ) = x /\ +node_map H (inverse ( node_map H ) x ) = x /\ + inverse (node_map H) ( node_map H x ) = x `, +MESON_TAC[PERMUTES_INVERSES; hypermap_lemma]);; + + + +let ITER_CYCLIC_ORBIT = prove(` 0 < i /\ ITER i f x = x ==> orbit_map f x = +{ITER n f x | n < i } `, +REWRITE_TAC[ARITH_RULE` 0 < i <=> ~( i = 0 ) `; GSYM POWER_TO_ITER] THEN +NHANH orbit_cyclic THEN SIMP_TAC[]);; + + + +let FACE_CYCLE_CARD = prove( +`! x y H. y IN face H x ==> (face_map H POWER CARD (face H x )) y = y`, +NHANH lemma_face_identity THEN SIMP_TAC[lemma_face_cycle]);; + + + + +let INVERSE_FACE_CYCLE = prove( +`! (x:A) H. (inverse (face_map H) POWER (CARD (face H x)) ) x = x `, +REWRITE_TAC[FACE_NODE_EDGE_ORBIT_INVERSE] THEN +REPEAT GEN_TAC THEN +MP_TAC (SPEC_ALL face_map_and_darts) THEN +NHANH PERMUTES_INVERSE THEN +MESON_TAC[lemma_cycle_orbit]);; + + + +let INVERSE_FACE_CYCLE_ALL = prove(` ! x y H. y IN face H x ==> +(inverse (face_map H) POWER (CARD (face H x)) ) y = y `, +NHANH lemma_face_identity THEN +SIMP_TAC[INVERSE_FACE_CYCLE]);; + + + +let DIH2K_IMP_SIMPLE_HYPERMAP2 = prove( +` dih2k (H:(A)hypermap) k /\ ~( k = 0) ==> simple_hypermap H `, +MP_TAC face_map_and_darts THEN +MESON_TAC[DIH2K_IMP_SIMPLE_HYPERMAP]);; + + + + + +let DIH2K_FACE_SIMPLIZED = prove_by_refinement +(` edge_map H has_orders 2 /\ +(x:A) IN dart H /\ simple_hypermap H /\ +(face H x ) INTER IMAGE (node_map H ) (face H x ) = {} /\ + dart H = (face H x ) UNION IMAGE (node_map H) (face H x ) +<=> dih2k H (CARD (face H x )) /\ x IN dart H`, +[EQ_TAC; +SIMP_TAC[]; +NHANH lemma_face_subset; +REWRITE_TAC[dih2k]; +STRIP_TAC; +CONJ_TAC; +MP_TAC (SPEC_ALL FACE_FINITE); +NHANH (ISPEC ` node_map (H:(A)hypermap) ` FINITE_IMAGE); +UNDISCH_TAC ` face H (x:A) INTER IMAGE (node_map H) (face H x) = {}`; +ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> b /\ a ==> c `]; +PHA; +NHANH CARD_UNION; +STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC (ARITH_RULE` b = a ==> x = a + b ==> x = 2 * a `); +MATCH_MP_TAC CARD_IMAGE_INJ; +ASM_REWRITE_TAC[]; +SIMP_TAC[HYP_MAPS_INJ]; +SUBGOAL_THEN `(! (x:A). x IN dart H ==> ~( node_map H x = x ) /\ +(node_map H (node_map H x )) = x )` ASSUME_TAC; +DOWN_TAC; +MESON_TAC[SIMPLE_FACE_DISJOINT_NODE_MAP_2]; + +ASM_SIMP_TAC[]; +SUBGOAL_THEN ` node_map (H:(A)hypermap) has_orders 2 ` MP_TAC; +REWRITE_TAC[has_orders]; +REWRITE_TAC[FUN_EQ_THM]; +CONJ_TAC; +REWRITE_TAC[ARITH_RULE` 0 < x /\ x < 2 <=> x = 1 `]; +SIMP_TAC[ITER12; I_THM]; +GEN_TAC THEN STRIP_TAC; +REWRITE_TAC[NOT_FORALL_THM]; +EXISTS_TAC `x:A`; +ASM_MESON_TAC[]; +REWRITE_TAC[ITER12; I_THM]; +GEN_TAC; +ASM_CASES_TAC ` (x':A) IN dart H `; +ASM_MESON_TAC[]; +DOWN; +MP_TAC (REWRITE_RULE[permutes] hypermap_lemma); +SIMP_TAC[]; +SIMP_TAC[]; + +STRIP_TAC; +SUBGOAL_THEN ` ! y. y IN face H (x:A) ==> face_map H (node_map H y) = +node_map H ( (inverse (face_map H )) y )` MP_TAC; +REPEAT STRIP_TAC; +PAT_ONCE_REWRITE_TAC `\x. f x = y ` [inverse2_hypermap_maps]; +DOWN_TAC; +REWRITE_TAC[HAS_ORD2_INTERPRET; EDGE_MAP_RESO_INVERSE]; +SIMP_TAC[o_THM]; +STRIP_TAC; +REWRITE_TAC[ +MESON[inverse2_hypermap_maps]` face_map H = inverse (node_map H) o +inverse (edge_map H) `]; + +REWRITE_TAC[o_THM; HYP_MAPS_INVS]; +ASM_REWRITE_TAC[]; +STRIP_TAC; + + +(* hhhhhhh *) +SUBGOAL_THEN` !y. y IN face H (x:A) + ==> ( ! n. ITER n (face_map H) (node_map H y) = +node_map H (ITER n (inverse (face_map H)) y))` MP_TAC; +GEN_TAC THEN STRIP_TAC; +INDUCT_TAC; +REWRITE_TAC[ITER]; +SUBGOAL_THEN ` ITER n (inverse (face_map H)) (y:A) IN face H (x:A) ` ASSUME_TAC; +DOWN THEN DOWN; +NHANH_PAT `\x. x ==> y ` lemma_face_identity; +SIMP_TAC[]; +REPEAT STRIP_TAC; +REWRITE_TAC[FACE_NODE_EDGE_ORBIT_INVERSE; orbit_map; IN_ELIM_THM]; +EXISTS_TAC `n:num `; +REWRITE_TAC[POWER_TO_ITER; ARITH_RULE ` x >= 0`]; +REWRITE_TAC[ITER]; +DOWN; +FIRST_ASSUM NHANH; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; + + + +(* ,,,,,,,,,,,,,, *) +STRIP_TAC; +MATCH_MP_TAC (TAUT` a /\ ( a ==> b ) ==> a /\ b `); +CONJ_TAC; + +GEN_TAC; +REWRITE_TAC[IN_UNION]; +STRIP_TAC; +LET_TAC; +DOWN THEN DOWN; +NHANH lemma_face_identity; +SIMP_TAC[]; +LET_TAC; +DOWN THEN DOWN; +REWRITE_TAC[IN_IMAGE]; +STRIP_TAC; + + + +REPEAT STRIP_TAC; +MATCH_MP_TAC (SET_RULE` a = y /\ b = x ==> a UNION b = x UNION y `); +SUBGOAL_THEN ` IMAGE (node_map H) (face H (x:A)) = S` ASSUME_TAC; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` x'':A IN face H x `; +NHANH lemma_face_identity; +SIMP_TAC[]; +STRIP_TAC; +PAT_ONCE_REWRITE_TAC `\x. x = y ` [FACE_NODE_EDGE_ORBIT_INVERSE]; +REWRITE_TAC[IMAGE; face; orbit_map; EXTENSION; IN_ELIM_THM; POWER_TO_ITER; ARITH_RULE ` x >= 0 `]; +GEN_TAC; +DOWN THEN DOWN; +FIRST_X_ASSUM NHANH; +SIMP_TAC[]; +STRIP_TAC THEN STRIP_TAC; +MESON_TAC[]; +ASM_SIMP_TAC[]; +EXPAND_TAC "S"; +REWRITE_TAC[GSYM IMAGE_o]; +UNDISCH_TAC ` node_map (H:(A)hypermap) has_orders 2`; +SIMP_TAC[HAS_ORD2_INTERPRET; IMAGE_I]; + +REWRITE_TAC[has_orders; FUN_EQ_THM; I_THM]; +STRIP_TAC; +CONJ_TAC; +GEN_TAC; +STRIP_TAC; +REWRITE_TAC[NOT_FORALL_THM]; +EXISTS_TAC`x:A `; +STRIP_TAC; +ASSUME_TAC2 ( +ISPECL [`i:num`;`(face_map H): A -> A `] (GEN_ALL ITER_CYCLIC_ORBIT)); +DOWN THEN PHA; +REWRITE_TAC[GSYM face]; +NHANH (MESON[CARD_LE_K_OF_SET_K_FIRST_ELMS]` +S = { ITER n f x | n < i } ==> CARD S <= i`); +DOWN THEN DOWN; +MESON_TAC[ARITH_RULE` a < (b:num) ==> ~( b <= a ) `]; +REWRITE_TAC[GSYM POWER_TO_ITER; lemma_face_cycle]; +GEN_TAC; +ASM_CASES_TAC `x':A IN dart H `; +DOWN; +ASM_REWRITE_TAC[IN_UNION]; +STRIP_TAC; +DOWN; +REWRITE_TAC[FACE_CYCLE_CARD]; +DOWN; +REWRITE_TAC[IN_IMAGE]; +DOWN THEN FIRST_ASSUM NHANH; +REPEAT STRIP_TAC; +ASM_REWRITE_TAC[POWER_TO_ITER]; +REWRITE_TAC[GSYM POWER_TO_ITER]; +ASM_SIMP_TAC[INVERSE_FACE_CYCLE_ALL]; +DOWN THEN NHANH NOT_IN_DART_IMP_IDE; +SIMP_TAC[POWER_TO_ITER; ITER_FIXPOINT2]; + + + +MP_TAC (SPEC_ALL face_map_and_darts); +NHANH_PAT `\x. a ==> x ==> y ` lemma_face_subset; +STRIP_TAC THEN STRIP_TAC; +UNDISCH_TAC ` face H (x:A) SUBSET dart H`; +UNDISCH_TAC ` FINITE (dart (H:(A) hypermap)) `; +PHA; +NHANH FINITE_SUBSET; +IMP_TAC THEN STRIP_TAC; +MP_TAC (SPEC_ALL face_refl); +PHA; +REWRITE_TAC[SET_RULE` x IN A <=> {x} SUBSET A `]; +NHANH CARD_SUBSET; +REWRITE_TAC[CARD_SINGLETON]; +NHANH (ARITH_RULE` 1 <= a ==> ~( a = 0 ) `); +STRIP_TAC; +DOWN; +UNDISCH_TAC ` dih2k H (CARD (face H (x:A)))`; +PHA; +NHANH DIH2K_IMP_SIMPLE_HYPERMAP2; +ASM_SIMP_TAC[dih2k; INSERT_SUBSET; EMPTY_SUBSET]; +STRIP_TAC; +CONJ_TAC; +UNDISCH_TAC ` (x:A) IN dart H `; +FIRST_X_ASSUM NHANH; +LET_TAC; +STRIP_TAC; +MATCH_MP_TAC (MESON[CARD_UNION_OVERLAP_EQ]` +FINITE s /\ FINITE t /\ CARD (s UNION t) = CARD s + CARD t +==> s INTER t = {}`); +FIRST_X_ASSUM (SUBST_ALL_TAC o SYM); +ASM_REWRITE_TAC[ARITH_RULE` 2 * x = x + v <=> x = v `]; +CONJ_TAC; +MATCH_MP_TAC FINITE_IMAGE; +ASM_REWRITE_TAC[]; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +MATCH_MP_TAC CARD_IMAGE_INJ; +ASM_REWRITE_TAC[HYP_MAPS_INJ]; +SIMP_TAC[]; + + +UNDISCH_TAC ` (x:A) IN dart H `; +FIRST_X_ASSUM NHANH; +LET_TAC; +SIMP_TAC[]]);; + + + +let EE_OF_HYP_IDE_FST_SND_EQ = prove(`z IN darts_of_hyp E V ==> +( ee_of_hyp (x,V,E) z = z <=> FST z = SND z )`, +REWRITE_TAC[ee_of_hyp2] THEN SIMP_TAC[] THEN +ONCE_REWRITE_TAC[PAIR_EQ2] THEN +SIMP_TAC[EQ_SYM_EQ]);; + + + +let MP_TAC2 th = MP_TAC th THEN ANTS_TAC THENL [ +ASM_SIMP_TAC[]; SIMP_TAC[]] ;; + + + +let TR_ENF_TAC = MATCH_MP_TAC W_EQ_ITS_ORBIT_IMP_EQ_ITS_IMAGE THEN +REWRITE_TAC[GSYM face; GSYM node; GSYM edge; lemma_face_identity; +lemma_node_identity; lemma_edge_identity];; + + +let ENF_IMAGE_ITSELF = let t1 = CONJ ( prove( +` face H x = IMAGE (face_map H ) (face H x )`, TR_ENF_TAC)) + (prove( +` node H x = IMAGE (node_map H ) (node H x )`, TR_ENF_TAC)) in +CONJ (prove( +` edge H x = IMAGE (edge_map H ) (edge H x )`, TR_ENF_TAC)) t1;; + + + +let IDE_ON_S_IMP_SAME_IMAGE = prove(` (! x. x IN S ==> f x = g x ) ==> +IMAGE f S = IMAGE g S `, +REWRITE_TAC[EXTENSION; IMAGE; IN_ELIM_THM] THEN +MESON_TAC[]);; + + + +let DIH_K_HYP_E_PRIME = prove_by_refinement +(` FAN (v,V,E) /\ + x IN darts_of_hyp E V /\ + FF = face (hypermap (HYP (v,V,E))) x /\ + simple_hypermap (hypermap (HYP (v,v_prime V FF,e_prime E FF))) /\ + 2 < CARD (FF) ==> + dih2k (hypermap (HYP (v,v_prime V FF,e_prime E FF))) (CARD FF ) `, +[ONCE_REWRITE_TAC[TAUT` a1/\a2/\a3/\a4/\a5 <=> (a2/\a1/\a3/\a5)/\a4`]; +NHANH FAN_FACE_GT1_IMAGE_EE_OF_HYP; +STRIP_TAC; +MP_TAC LOCALIZE_PRESERVE_FACE THEN ANTS_TAC; +ASM_REWRITE_TAC[]; +DOWN_TAC THEN NHANH FAN_DART_DARTS; +SIMP_TAC[]; +ABBREV_TAC ` hy = HYP (v,v_prime V FF,e_prime E FF) `; +SIMP_TAC[]; +STRIP_TAC; +MATCH_MP_TAC (MESON[]` dih2k H k /\ (x:A) IN dart H ==> dih2k H k `); +REWRITE_TAC[GSYM DIH2K_FACE_SIMPLIZED]; +CONJ_TAC; +REWRITE_TAC[HAS_ORD2_INTERPRET]; +CONJ_TAC; +MP_TAC IMP_FAN_V_PRIME_E_PRIME; +ANTS_TAC; +ASM_REWRITE_TAC[]; +DOWN_TAC THEN NHANH FAN_DART_DARTS; +ASM_SIMP_TAC[]; +MESON_TAC[]; +NHANH FIRST_AAUHTVE2; +NHANH ELMS_OF_HYPERMAP_HYP; +ASM_MESON_TAC[]; + + + +MP_TAC IMP_FAN_V_PRIME_E_PRIME; +ANTS_TAC; +ASM_REWRITE_TAC[]; +DOWN_TAC THEN NHANH FAN_DART_DARTS; +ASM_SIMP_TAC[]; +MESON_TAC[]; +STRIP_TAC; +REWRITE_TAC[FUN_EQ_THM; NOT_FORALL_THM]; +EXISTS_TAC `x:real^3 # real^3 `; +REWRITE_TAC[I_THM]; +EXPAND_TAC "hy"; +DOWN; +SIMP_TAC[ELMS_OF_HYPERMAP_HYP]; +STRIP_TAC; +SUBGOAL_THEN ` (x:real^3 # real^3) IN +darts_of_hyp (e_prime E FF) (v_prime V FF) ` MP_TAC; + + +MATCH_MP_TAC IN_DARTS_FF_IMP_DARTS_E_PRIME_V_PRIME; +ASM_SIMP_TAC[face_refl]; +SIMP_TAC[EE_OF_HYP_IDE_FST_SND_EQ]; + + +REWRITE_TAC[darts_of_hyp; IN_UNION; IN_ORD_E_EQ_IN_E]; +STRIP_TAC; +DOWN; +REWRITE_TAC[e_prime; IN_ELIM_THM]; +UNDISCH_TAC `FAN (v:real^3, V,E) `; +REWRITE_TAC[FAN; graph; HAS_SIZE]; +STRIP_TAC THEN STRIP_TAC; +UNDISCH_TAC ` {v',w:real^3} IN E `; +REWRITE_TAC[IN]; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +FIRST_X_ASSUM NHANH; +REWRITE_TAC[Geomdetail.CARD2]; +SIMP_TAC[]; +SUBGOAL_THEN ` ff_of_hyp (v:real^3,v_prime V FF,e_prime E FF) x = x ` MP_TAC; +DOWN; +SIMP_TAC[ff_of_hyp3]; +PAT_ONCE_REWRITE_TAC `\x. x ==> i ` [orbit_one_point]; +REWRITE_TAC[ETA_AX]; +UNDISCH_TAC ` FF = face (hypermap hy) (x:real^3 # real^3 )`; +UNDISCH_TAC ` FAN (v:real^3,v_prime V FF,e_prime E FF)`; +EXPAND_TAC "hy"; +REWRITE_TAC[face]; +SIMP_TAC[GSYM ELMS_OF_HYPERMAP_HYP]; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[]; +NHANH (MESON[CARD_SINGLETON]` {p} = FF ==> CARD FF = 1 `); +REPEAT STRIP_TAC; +UNDISCH_TAC ` CARD (FF:real^3#real^3->bool) = 1 `; +UNDISCH_TAC ` 2 < CARD (FF:real^3#real^3->bool) `; +ARITH_TAC; + +EXPAND_TAC "hy"; +MP_TAC2 IMP_FAN_V_PRIME_E_PRIME; +ASM_MESON_TAC[ELMS_OF_HYPERMAP_HYP]; + +NHANH FAN_DART_DARTS; +SIMP_TAC[]; +STRIP_TAC; +CONJ_TAC; +MATCH_MP_TAC IN_DARTS_FF_IMP_DARTS_E_PRIME_V_PRIME; +ASM_REWRITE_TAC[face_refl]; +DOWN THEN DOWN; + + + +FIRST_X_ASSUM (ASSUME_TAC o SYM); +UNDISCH_TAC ` FF = face (hypermap (HYP ((v:real^3),V,E))) x`; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +MP_TAC2 FF_DISJOINT_ITS_IMAGE_CARD_EQ; +MP_TAC2 IMP_FAN_V_PRIME_E_PRIME; + + +ASM_MESON_TAC[ELMS_OF_HYPERMAP_HYP; face_refl]; +NHANH ELMS_OF_HYPERMAP_HYP; + +ASM_SIMP_TAC[]; +EXPAND_TAC "hy"; +SIMP_TAC[]; +REPEAT STRIP_TAC; +ABBREV_TAC ` nn = nn_of_hyp (v,v_prime V FF, e_prime E FF)`; +MP_TAC2 LOCALIZE_PRESERVE_FACE; +ASM_SIMP_TAC[FAN_DART_DARTS]; +DISCH_THEN (ASSUME_TAC o SYM); +FIRST_ASSUM ( fun x -> PAT_ONCE_REWRITE_TAC `\x. c = a UNION x ` [GSYM x]); +PAT_ONCE_REWRITE_TAC `\x. c = a UNION x ` [ENF_IMAGE_ITSELF]; +ASM_REWRITE_TAC[GSYM IMAGE_o]; + + + +MP_TAC2 FAN_FACE_GT1_IMAGE_EE_OF_HYP; +DOWN THEN DOWN; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ASM_SIMP_TAC[ARITH_RULE` 2 < a ==> 1 < a `]; + +STRIP_TAC; +MP_TAC2 CARD_GT1_EE_OF_HYP_E_PRIME_EQ; +ASM_SIMP_TAC[FAN_DART_DARTS]; +DOWN THEN DOWN THEN DOWN THEN PHA THEN REMOVE_TAC; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ASM_SIMP_TAC[ARITH_RULE` 2 < c ==> 1 < c`]; +NHANH IDE_ON_S_IMP_SAME_IMAGE; +SIMP_TAC[ETA_AX]; +STRIP_TAC; + +MATCH_MP_TAC (MESON[]` a = x ==> f a = f x `); +MATCH_MP_TAC (MESON[]` a = x ==> IMAGE a S = IMAGE x S `); +UNDISCH_TAC `FAN (v:real^3,v_prime V FF,e_prime E FF) `; +NHANH FIRST_AAUHTVE2; +ASM_REWRITE_TAC[]; +ABBREV_TAC ` e = ee_of_hyp (v:real^3,v_prime V FF,e_prime E FF) `; +ABBREV_TAC ` f = ff_of_hyp (v:real^3,v_prime V FF,e_prime E FF) `; +ASM_REWRITE_TAC[]; +NHANH (MESON[]` e o x = I /\ e o e = I ==> e o e o x = e o I `); +REWRITE_TAC[I_O_ID; o_ASSOC]; +PHA; +REWRITE_TAC[MESON[]` x = y /\ (x o t ) o i = p <=> +x = y /\ (y o t ) o i = p`; I_O_ID]; +SIMP_TAC[EQ_SYM_EQ]]);; + + + + + +let LVDUCXU = prove_by_refinement +(` FAN ((vec 0):real^3,V,E) /\ +x IN darts_of_hyp E V /\ +FF = face (hypermap (HYP (vec 0,V,E))) x +==> FF = face (hypermap (HYP (vec 0,v_prime V FF,e_prime E FF))) x /\ +(! x. x IN FF ==> azim_in_fan x E = azim_in_fan x (e_prime E FF ) /\ +wedge_in_fan_ge x E = wedge_in_fan_ge x (e_prime E FF) /\ +wedge_in_fan_gt x E = wedge_in_fan_gt x (e_prime E FF)) /\ +( 2 < CARD FF /\ +simple_hypermap (hypermap (HYP (vec 0,v_prime V FF,e_prime E FF))) ==> +local_fan (v_prime V FF,e_prime E FF,FF) ) `, +[STRIP_TAC; +CONJ_TAC; +MATCH_MP_TAC LOCALIZE_PRESERVE_FACE; +ASM_REWRITE_TAC[]; +ASM_SIMP_TAC[FAN_DART_DARTS]; +CONJ_TAC; +GEN_TAC THEN STRIP_TAC; +CONJ_TAC; +MATCH_MP_TAC (SPEC `x:real^3 # real^3 ` (GEN `v:real^3 # real^3 ` AZIM_IN_FAN_EQ_IZIM_E_PRIME)); +ASM_REWRITE_TAC[]; +ASM_SIMP_TAC[FAN_DART_DARTS]; +MATCH_MP_TAC (SPEC `x:real^3 # real^3 ` (GEN `v:real^3 # real^3 ` + WEDGE_IN_FAN_EQ_WITH_E_PRIME)); +ASM_REWRITE_TAC[]; +ASM_SIMP_TAC[FAN_DART_DARTS]; +REWRITE_TAC[local_fan]; +STRIP_TAC; +LET_TAC; +MP_TAC2 ( +SPEC `(vec 0): real^3 ` (GEN `v:real^3` IMP_FAN_V_PRIME_E_PRIME)); +EXISTS_TAC `x:real^3 # real^3 `; +REWRITE_TAC[]; +ASM_SIMP_TAC[FAN_DART_DARTS]; + + + + +STRIP_TAC; +CONJ_TAC; +EXISTS_TAC ` x:real^3 # real^3 `; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +DOWN THEN SIMP_TAC[FAN_DART_DARTS]; +STRIP_TAC; +MP_TAC2 ( +ISPEC `x:real^3 # real^3 ` (GEN `x:A#A` + IN_DARTS_FF_IMP_DARTS_E_PRIME_V_PRIME)); +ASM_SIMP_TAC[GSYM FAN_DART_DARTS; face_refl]; +DISCH_TAC THEN MATCH_MP_TAC LOCALIZE_PRESERVE_FACE; +ASM_SIMP_TAC[FAN_DART_DARTS]; +EXPAND_TAC "H"; +MATCH_MP_TAC DIH_K_HYP_E_PRIME; +ASM_REWRITE_TAC[]]);; + + +end;; + +(* ______________________________________________________________ +_________________________________________________________________ +flyspeck_needs "general/update_database_310.ml";; + + +*) diff --git a/text_formalization/local/MIQMCSN.hl b/text_formalization/local/MIQMCSN.hl new file mode 100644 index 0000000..09eb184 --- /dev/null +++ b/text_formalization/local/MIQMCSN.hl @@ -0,0 +1,3484 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Miqmcsn = struct + + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +open Yxionxl2;; +open Eyypqdw;; +open Ocbicby;; +open Imjxphr;; +open Nuxcoea;; +open Aursipd;; +open Cuxvzoz;; +open Rrcwnsj;; +open Tfitskc;; +open Hexagons;; +open Otmtotj;; +open Hijqaha;; +open Cnicgsf;; +open Ardbzye;; +open Aueaheh;; +open Vasyyau;; + + + +(**************************************************) + + let scs_3T4_prime2 = (* terminal_tri_6833979866 = *) new_definition + `scs_3T4_prime2 = mk_unadorned_v39 3 + (#0.2759) + (funlist_v39 [(0,1),(&2);(0,2),cstab] (&2*h0) 3) + (funlist_v39 [(0,1),(&2 * h0)] (cstab) 3)`;; + + + + + let scs_3T3_prime = (* terminal_tri_6833979866 = *) new_definition + `scs_3T3_prime = mk_unadorned_v39 3 + (#0.476) + (funlist_v39 [(0,1),cstab] (&2*h0) 3) + (funlist_v39 [] (cstab) 3)`;; + + + + +let scs_3M1_prime = new_definition + `scs_3M1_prime = mk_unadorned_v39 3 (#0.103) + (funlist_v39 [(0,1),(cstab)] (&2) 3) + (funlist_v39 [(0,1),(cstab)] (&2 * h0) 3)`;; + + + + let scs_4M8_02 = new_definition + `scs_4M8_02 = mk_unadorned_v39 4 (#0.513) + (funlist_v39 [(0,1),cstab;(2,3),cstab;(0,2),(cstab);(1,3),(cstab)] (&2) 4) + (funlist_v39 [(0,1),cstab;(2,3),cstab;(0,2),(#3.62);(1,3),(&6)] (&2) 4)`;; + + + let scs_4M8_13 = new_definition + `scs_4M8_13 = mk_unadorned_v39 4 (#0.513) + (funlist_v39 [(0,1),cstab;(2,3),cstab;(0,2),(cstab);(1,3),(cstab)] (&2) 4) + (funlist_v39 [(0,1),cstab;(2,3),cstab;(0,2),(&6);(1,3),(#3.62)] (&2) 4)`;; + + + +let PSORT_5_EXPLICIT=prove(` +psort 5 (0,0)= (0,0)/\ +psort 5 (1,1)= (1,1)/\ +psort 5 (2,2)= (2,2)/\ +psort 5 (3,3)= (3,3)/\ +psort 5 (4,4)= (4,4)/\ +psort 5 (0,1)= (0,1)/\ +psort 5 (0,2)= (0,2)/\ +psort 5 (0,3)= (0,3)/\ +psort 5 (0,4)= (0,4)/\ +psort 5 (1,0)= (0,1)/\ +psort 5 (1,2)= (1,2)/\ +psort 5 (1,3)= (1,3)/\ +psort 5 (1,4)= (1,4)/\ +psort 5 (2,0)= (0,2)/\ +psort 5 (2,1)= (1,2)/\ +psort 5 (2,3)= (2,3)/\ +psort 5 (2,4)= (2,4)/\ +psort 5 (3,0)= (0,3)/\ +psort 5 (3,1)= (1,3)/\ +psort 5 (3,2)= (2,3)/\ +psort 5 (3,4)= (3,4)/\ +psort 5 (4,0)= (0,4)/\ +psort 5 (4,1)= (1,4)/\ +psort 5 (4,2)= (2,4)/\ +psort 5 (4,3)= (3,4)/\ +psort 5 (4,5)= (0,4)/\ +psort 5 (3,5)= (0,3)/\ +psort 5 (2,5)= (0,2)/\ +psort 5 (1,5)= (0,1)/\ +psort 5 (5,1)= (0,1)/\ +psort 5 (5,2)= (0,2)/\ +psort 5 (5,3)= (0,3)/\ +psort 5 (5,4)= (0,4)/\ +psort 5 (5,5)= (0,0)/\ +psort 5 (5,6)= (0,1)/\ +psort 5 (5,7)= (0,2)/\ +psort 5 (4,6)= (1,4)/\ +psort 5 (6,4)= (1,4)/\ +psort 5 (6,5)= (0,1)/\ +psort 5 (6,7)= (1,2)/\ +psort 5 (7,5)= (0,2)/\ +psort 5 (7,6)= (1,2)/\ +psort 5 (7,7)= (2,2)/\ +psort 5 (6,6)= (1,1)/\ +psort 4 (3,4)= (0,3)/\ +psort 3 (2,0)= (0,2)/\ +psort 3 (2,1)= (1,2)/\ +psort 3 (1,0)= (0,1)/\ +psort 4 (0,0)= (0,0)/\ +psort 4 (1,1)= (1,1)/\ +psort 4 (2,2)= (2,2)/\ +psort 4 (3,3)= (3,3)/\ +psort 4 (4,3)= (0,3)/\ +psort 4 (4,4)= (0,0)/\ +psort 4 (0,2)= (0,2)/\ +psort 4 (4,5)= (0,1)/\ +psort 4 (5,4)= (0,1)/\ +psort 4 (5,5)= (1,1)/\ +psort 4 (1,4)= (0,1)/\ +psort 4 (2,5)= (1,2)/\ +psort 4 (3,6)= (2,3) +`, +REWRITE_TAC[psort;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_5_TAC;Uxckfpe.ARITH_4_TAC;LET_DEF;LET_END_DEF;MOD_5_EXPLICIT;ARITH_RULE`0<=a/\ ~(1<= 0)/\ ~(2<=0)/\ ~(3<=0)/\ ~(4<=0)/\a<=a/\ ~(2<=1)/\ ~(3<=2)/\ ~(4<=3)/\ ~(3<=1)/\ ~(4<=1)/\ ~(4<=2)/\ 2<=3/\ 6 MOD 4=2`]);; + + + + + + + +let SCS_TAC= ASM_SIMP_TAC[scs_basic;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;d_tame;REAL_ARITH`#0.712 < #0.9`;periodic;SET_RULE`{} j <=> {} i`;periodic2;scs_basic;unadorned_v39;scs_prop_equ_v39;LET_DEF;LET_END_DEF;scs_stab_diag_v39;scs_half_slice_v39; +Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_5_TAC; +scs_5M1;scs_3M1;scs_6I1;scs_3T1;scs_4M2;scs_6M1;scs_6T1;scs_5I1;scs_5I2;scs_5I3;scs_5M2;scs_4M6;scs_3T4;scs_5M3;scs_3T4_prime;scs_4M6_prime;scs_4M7_prime;scs_4M7;scs_3T1_prime;scs_4M8;scs_4M8_prime;scs_5T1;scs_3T5;scs_4M3;scs_3T6;scs_4M4;scs_4M5;scs_4I2;scs_4T1;scs_4T2;scs_4I1;scs_4T4;scs_4I3;scs_3T3;scs_4T5;scs_3T4_prime2;scs_3T3_prime;scs_3M1_prime;scs_4T3;scs_4M8_02;scs_4M8_13;scs_3T7; +Terminal.FUNLIST_EXPLICIT;Yrtafyh.PSORT_PERIODIC;PSORT_5_EXPLICIT; +ARITH_RULE`SUC 0=1/\ SUC 1=2/\ SUC 2=3/\ SUC 3=4/\ SUC 4=5/\ SUC 5=6/\ SUC 6=7/\ SUC 7=8/\ 6 MOD 4=2`];; + + +(********************) + +let SCS_4T3_IS_SCS=prove_by_refinement(`is_scs_v39 scs_4T3`, +[SIMP_TAC[scs_4T3;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<=4/\ 4<=6/\a<=a/\ ~(6=0)`;d_tame;REAL_ARITH`#0.513 < #0.9`;periodic;SET_RULE`{} (i + 4) <=> {} i`;periodic2;ARITH_RULE`~(4=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + + + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + + + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN REAL_ARITH_TAC; + + + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<4`] +THEN SUBGOAL_THEN`{i | i < 4 /\ + (&2 * #1.26 < (if psort 4 (i,SUC i) = 0,1 then #3.01 else &2 ) \/ + &2 < (if psort 4 (i,SUC i) = 0,1 then #3.01 else &2))} ={0}`ASSUME_TAC +; + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;ARITH_RULE`x<4<=> x=0\/ x=1\/x=2\/ x=3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[Terminal.FUNLIST_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;REAL_ARITH`~(a {} i`;periodic2;ARITH_RULE`~(4=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + + + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + + + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN REAL_ARITH_TAC; + + + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<4`] +THEN SUBGOAL_THEN`{i | i < 4 /\ + (&2 * #1.26 < + (if psort 4 (i,SUC i) = 0,1 + then #3.01 + else if psort 4 (i,SUC i) = 2,3 then #3.01 else &2) \/ + &2 < + (if psort 4 (i,SUC i) = 0,1 + then #3.01 + else if psort 4 (i,SUC i) = 2,3 then #3.01 else &2))} ={0,2}`ASSUME_TAC +; + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;ARITH_RULE`x<4<=> x=0\/ x=1\/x=2\/ x=3`;SET_RULE`a IN {b,c}<=>a=b\/ a=c`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[Terminal.FUNLIST_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;REAL_ARITH`~(a {} i`;periodic2;ARITH_RULE`~(4=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + + + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + + + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN REAL_ARITH_TAC; + + + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<4`] +THEN SUBGOAL_THEN`{i | i < 4 /\ + (&2 * #1.26 < + (if psort 4 (i,SUC i) = 0,1 + then #3.01 + else if psort 4 (i,SUC i) = 2,3 then #3.01 else &2) \/ + &2 < + (if psort 4 (i,SUC i) = 0,1 + then #3.01 + else if psort 4 (i,SUC i) = 2,3 then #3.01 else &2))} ={0,2}`ASSUME_TAC +; + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;ARITH_RULE`x<4<=> x=0\/ x=1\/x=2\/ x=3`;SET_RULE`a IN {b,c}<=>a=b\/ a=c`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[Terminal.FUNLIST_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;REAL_ARITH`~(a {} i`;periodic2;ARITH_RULE`~(3=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN REAL_ARITH_TAC; + +MRESAS_TAC CARD_SUBSET[`{i | i < 3 /\ + (&2 * h0 < funlist_v39 [(0,1),&2 * h0] cstab 3 i (SUC i) \/ + &2 < funlist_v39 [(0,1),&2; (0,2),cstab] (&2 * h0) 3 i (SUC i))}`;`0..2`][FINITE_NUMSEG;CARD_NUMSEG;ARITH_RULE`(2+1)-0=3/\ (a+3<=6 <=> a<=3)`] +THEN MATCH_DICH_TAC 0 +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC]);; + + +let SCS_3T3_prime_IS_SCS=prove_by_refinement( `is_scs_v39 scs_3T3_prime`, +[SIMP_TAC[scs_3T3_prime;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<6/\a<=a/\ 3<=3/\ ~(6=0)`;d_tame;REAL_ARITH`#0.476 < #0.9`;periodic;SET_RULE`{} (i + 3) <=> {} i`;periodic2;ARITH_RULE`~(3=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN REAL_ARITH_TAC; + +MRESAS_TAC CARD_SUBSET[`{i | i < 3 /\ + (&2 * h0 < funlist_v39 [] cstab 3 i (SUC i) \/ + &2 < funlist_v39 [(0,1),cstab] (&2 * h0) 3 i (SUC i))}`;`0..2`][FINITE_NUMSEG;CARD_NUMSEG;ARITH_RULE`(2+1)-0=3/\ (a+3<=6 <=> a<=3)`] +THEN MATCH_DICH_TAC 0 +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; +]);; + + +let SCS_3M1_prime_IS_SCS=prove_by_refinement( `is_scs_v39 scs_3M1_prime`, +[SIMP_TAC[scs_3M1_prime;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<6/\a<=a/\ 3<=3/\ ~(6=0)`;d_tame;REAL_ARITH`#0.103 < #0.9`;periodic;SET_RULE`{} (i + 3) <=> {} i`;periodic2;ARITH_RULE`~(3=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN REAL_ARITH_TAC; + +MRESAS_TAC CARD_SUBSET[`{i | i < 3 /\ + (&2 * h0 < funlist_v39 [(0,1),cstab] (&2 * h0) 3 i (SUC i) \/ + &2 < funlist_v39 [(0,1),cstab] (&2) 3 i (SUC i))}`;`0..2`][FINITE_NUMSEG;CARD_NUMSEG;ARITH_RULE`(2+1)-0=3/\ (a+3<=6 <=> a<=3)`] +THEN MATCH_DICH_TAC 0 +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; +]);; + +let SCS_3T7_IS_SCS=prove_by_refinement( `is_scs_v39 scs_3T7`, +[SIMP_TAC[scs_3T7;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<6/\a<=a/\ 3<=3/\ ~(6=0)`;d_tame;REAL_ARITH`#0.2565 < #0.9`;periodic;SET_RULE`{} (i + 3) <=> {} i`;periodic2;ARITH_RULE`~(3=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN REAL_ARITH_TAC; + +DICH_TAC 0 +THEN ARITH_TAC; + +MRESAS_TAC CARD_SUBSET[`{i | i < 3 /\ + (&2 * h0 < + funlist_v39 [(0,1),#3.62; (0,2),cstab; (1,2),&2] (&2) 3 i (SUC i) \/ + &2 < funlist_v39 [(0,1),cstab; (0,2),cstab; (1,2),&2] (&2) 3 i (SUC i))}`;`0..2`][FINITE_NUMSEG;CARD_NUMSEG;ARITH_RULE`(2+1)-0=3/\ (a+3<=6 <=> a<=3)`] +THEN MATCH_DICH_TAC 0 +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; +]);; + +(*********************) + + +let SCS_3T4_prime2_BASIC=prove(`scs_basic_v39 scs_3T4_prime2`, +SCS_TAC);; + +let K_SCS_3T4_prime2=prove(`scs_k_v39 scs_3T4_prime2=3`, +SCS_TAC);; + +let J_SCS_3T4_prime2=prove(`scs_J_v39 (scs_prop_equ_v39 scs_3T4_prime2 i) i1 j= F`, +SCS_TAC );; + +let J_SCS_3T4_prime2_1=prove(`scs_J_v39 (scs_3T4_prime2 ) i1 j= F`, +SCS_TAC );; + +let SCS_3T7_BASIC=prove(`scs_basic_v39 scs_3T7`, +SCS_TAC);; + +let K_SCS_3T7=prove(`scs_k_v39 scs_3T7=3`, +SCS_TAC);; + +let J_SCS_3T7=prove(`scs_J_v39 (scs_prop_equ_v39 scs_3T7 i) i1 j= F`, +SCS_TAC );; + + + +let J_SCS_3T7_1=prove(`scs_J_v39 (scs_3T7 ) i1 j= F`, +SCS_TAC );; + +let SCS_3T3_prime_BASIC=prove(`scs_basic_v39 scs_3T3_prime`, +SCS_TAC);; + +let K_SCS_3T3_prime=prove(`scs_k_v39 scs_3T3_prime=3`, +SCS_TAC);; + +let J_SCS_3T3_prime=prove(`scs_J_v39 (scs_prop_equ_v39 scs_3T3_prime i) i1 j= F`, +SCS_TAC );; + + +let SCS_3M1_prime_BASIC=prove(`scs_basic_v39 scs_3M1_prime`, +SCS_TAC);; + +let K_SCS_3M1_prime=prove(`scs_k_v39 scs_3M1_prime=3`, +SCS_TAC);; + +let J_SCS_3M1_prime=prove(`scs_J_v39 (scs_prop_equ_v39 scs_3M1_prime i) i1 j= F`, +SCS_TAC );; + + +let SCS_4T3_BASIC=prove(`scs_basic_v39 scs_4T3`, +SCS_TAC);; + +let K_SCS_4T3=prove(`scs_k_v39 scs_4T3=4`, +SCS_TAC);; + +let J_SCS_4T3=prove(`scs_J_v39 (scs_prop_equ_v39 scs_4T3 i) i1 j= F`, +SCS_TAC );; + + +let SCS_4M8_02_BASIC=prove(`scs_basic_v39 scs_4M8_02`, +SCS_TAC);; + +let K_SCS_4M8_02=prove(`scs_k_v39 scs_4M8_02=4`, +SCS_TAC);; + +let J_SCS_4M8_02=prove(`scs_J_v39 (scs_prop_equ_v39 scs_4M8_02 i) i1 j= F`, +SCS_TAC );; + + +let SCS_4M8_13_BASIC=prove(`scs_basic_v39 scs_4M8_13`, +SCS_TAC);; + +let K_SCS_4M8_13=prove(`scs_k_v39 scs_4M8_13=4`, +SCS_TAC);; + +let J_SCS_4M8_13=prove(`scs_J_v39 (scs_prop_equ_v39 scs_4M8_13 i) i1 j= F`, +SCS_TAC );; + +(***********************) + +let BB_3T4_prime2_IMP_scs_3T4=prove(`BBs_v39 scs_3T4_prime2 v + ==> + BBs_v39 (scs_3T4 ) v`, +REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_5I3;scs_5M2;CS_ADJ;scs_diag;ARITH_RULE`(3<=3)`;IN;K_SCS_3T4;K_SCS_3T4_prime2;scs_prop_equ_v39;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN SCS_TAC +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC 0[`i`;`j`] +THEN DICH_TAC 1 +THEN REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC);; + + +let MM_3T4_prime2_IMP_MM_3T4=prove(`MMs_v39 scs_3T4_prime2 v ==> ~(MMs_v39 scs_3T4={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_3T4_prime2` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_3T4_prime2`;`v`] +THEN ASM_SIMP_TAC[SCS_3T4_BASIC;SCS_3T4_prime2_BASIC;SCS_3T4_IS_SCS;SCS_3T4_IS_SCS; +SCS_3T4_prime2_IS_SCS;K_SCS_3T4;K_SCS_3T4_prime2;IN;BB_3T4_prime2_IMP_scs_3T4] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + +let SCS_3T4_prime2_ARROW_MM_3T4=prove_by_refinement(`scs_arrow_v39 {scs_3T4_prime2 } { scs_3T4}`, +[ REPEAT GEN_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;IN] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +ASM_SIMP_TAC[SCS_3T4_IS_SCS]; + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_3T4_prime2 ==> MMs_v39 s = {}) \/ ~((!s. s = scs_3T4_prime2 ==> MMs_v39 s = {}))`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`scs_3T4` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC (GEN_ALL MM_3T4_prime2_IMP_MM_3T4) +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]);; + +(************************************) + + + + + +let BB_3T3_prime_IMP_scs_3T3=prove(`BBs_v39 scs_3T3_prime v + ==> + BBs_v39 (scs_3T3 ) v`, +REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_5I3;scs_5M2;CS_ADJ;scs_diag;ARITH_RULE`(3<=3)`;IN;K_SCS_3T4;K_SCS_3T3_prime;scs_prop_equ_v39;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN SCS_TAC +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC 0[`i`;`j`] +THEN DICH_TAC 1 +THEN REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC);; + +let MM_3T3_prime_IMP_MM_3T3=prove(`MMs_v39 scs_3T3_prime v ==> ~(MMs_v39 scs_3T3={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_3T3_prime` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_3T3_prime`;`v`] +THEN ASM_SIMP_TAC[SCS_3T3_BASIC;SCS_3T3_prime_BASIC;SCS_3T3_IS_SCS;SCS_3T3_IS_SCS; +SCS_3T3_prime_IS_SCS;K_SCS_3T3;K_SCS_3T3_prime;IN;BB_3T3_prime_IMP_scs_3T3] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + +let SCS_3T3_prime_ARROW_MM_3T3=prove_by_refinement(`scs_arrow_v39 {scs_3T3_prime } { scs_3T3}`, +[ REPEAT GEN_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;IN] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +ASM_SIMP_TAC[SCS_3T3_IS_SCS]; + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_3T3_prime ==> MMs_v39 s = {}) \/ ~((!s. s = scs_3T3_prime ==> MMs_v39 s = {}))`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`scs_3T3` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC (GEN_ALL MM_3T3_prime_IMP_MM_3T3) +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]);; + +(************************) + + + +let BB_3M1_prime_IMP_scs_3M1=prove(`BBs_v39 scs_3M1_prime v + ==> + BBs_v39 (scs_3M1 ) v`, +REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_5I3;scs_5M2;CS_ADJ;scs_diag;ARITH_RULE`(3<=3)`;IN;K_SCS_3T4;K_SCS_3M1_prime;scs_prop_equ_v39;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN SCS_TAC +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC 0[`i`;`j`] +THEN DICH_TAC 1 +THEN REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC);; + +let MM_3M1_prime_IMP_MM_3M1=prove(`MMs_v39 scs_3M1_prime v ==> ~(MMs_v39 scs_3M1={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_3M1_prime` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_3M1_prime`;`v`] +THEN ASM_SIMP_TAC[SCS_3M1_BASIC;SCS_3M1_prime_BASIC;SCS_3M1_IS_SCS;SCS_3M1_IS_SCS; +SCS_3M1_prime_IS_SCS;K_SCS_3M1;K_SCS_3M1_prime;IN;BB_3M1_prime_IMP_scs_3M1] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + +let SCS_3M1_prime_ARROW_MM_3M1=prove_by_refinement(`scs_arrow_v39 {scs_3M1_prime } { scs_3M1}`, +[ REPEAT GEN_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;IN] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +ASM_SIMP_TAC[SCS_3M1_IS_SCS]; + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_3M1_prime ==> MMs_v39 s = {}) \/ ~((!s. s = scs_3M1_prime ==> MMs_v39 s = {}))`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`scs_3M1` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC (GEN_ALL MM_3M1_prime_IMP_MM_3M1) +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]);; + + +(*************************) + + + + +let BB_4M7_IMP_BB_STAN_4M7= prove(` + BBs_v39 scs_4M7 v /\ + scs_diag 4 i j /\ + dist(v i,v j)<= cstab ==> + BBs_v39 (scs_stab_diag_v39 scs_4M7 i j) v`, +SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M7;scs_4M7;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M7;Terminal.FUNLIST_EXPLICIT;K_SCS_4M7] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ 2+1=3/\ 3+1=4`) +THEN SCS_TAC +THEN MP_TAC(SET_RULE`psort 4 (i,j) = psort 4 (i',j')\/ ~(psort 4 (i,j) = psort 4 (i',j'))`) +THEN RESA_TAC +THEN MRESA_TAC Uaghhbm.CASE_PSORT[`i`;`j'`;`j`;`i'`;`4`] +THENL[ +MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4M7`][scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M7;scs_4M7;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M7;Terminal.FUNLIST_EXPLICIT;K_SCS_4M7;SCS_4M7_IS_SCS] +THEN THAYTHEL_ASM_TAC 0[`i'`;`i`][] +THEN THAYTHEL_ASM_TAC 0[`j'`;`j`][]; + +MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4M7`][scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M7;scs_4M7;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M7;Terminal.FUNLIST_EXPLICIT;K_SCS_4M7;SCS_4M7_IS_SCS] +THEN THAYTHEL_ASM_TAC 0[`i'`;`j`][] +THEN THAYTHEL_ASM_TAC 0[`j'`;`i`][] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]]);; + + +let MM_4M7_IMP_STAB_4M7=prove(` + MMs_v39 scs_4M7 v /\ + scs_diag 4 i j /\ + dist(v i,v j)<= cstab ==> + ~(MMs_v39 (scs_stab_diag_v39 scs_4M7 i j) ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC` scs_4M7 ` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4M7 `;`v`] +THEN ASSUME_TAC SCS_4M7_BASIC +THEN ASSUME_TAC K_SCS_4M7 +THEN ASM_SIMP_TAC[SCS_4M7_IS_SCS;SCS_4M7_IS_SCS;SCS_4M7_BASIC;K_SCS_4M7;SCS_K_D_A_STAB_EQ;IN; ADD1;SCS_DIAG_SCS_4M7_13;BB_4M7_IMP_BB_STAN_4M7;STAB_4M7_SCS] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + + +let SET_STAB_4M7=prove(`{ scs_stab_diag_v39 scs_4M7 i j| scs_diag 4 i j }= { scs_stab_diag_v39 scs_4M7 (i MOD 4) (j MOD 4)| scs_diag 4 (i MOD 4) (j MOD 4) }`, + ASM_SIMP_TAC[STAB_MOD;DIAG_MOD;EXTENSION;IN_ELIM_THM;ARITH_RULE`~(4=0)`;] +THEN MRESAL_TAC STAB_MOD[`scs_4M7`][SCS_4M7_IS_SCS;K_SCS_4M7]);; + +let EXPAND_STAB_DIAG_4M7=prove(` +{scs_stab_diag_v39 scs_4M7 (i MOD 4) (j MOD 4) | j MOD 4 = + (i MOD 4 + 2) MOD 4}= +{scs_stab_diag_v39 scs_4M7 (i+2) i| i<4} `, +ASM_SIMP_TAC[EXPAND_STAB_DIAG_4;SCS_4M7_IS_SCS;K_SCS_4M7]);; + + +let SET_EQ_DIAG_STAB_4M7=prove_by_refinement(`scs_arrow_v39 + { scs_stab_diag_v39 scs_4M7 i j| scs_diag 4 i j } {scs_stab_diag_v39 scs_4M7 0 2,scs_stab_diag_v39 scs_4M7 1 3}`, +[ +ASM_SIMP_TAC[EXPAND_STAB_DIAG_4M7;SET_STAB_4M7;EXPAND_DIAG_4V;MOD_REFL;ARITH_RULE`~(4=0)`] +THEN +REWRITE_TAC[ARITH_RULE`i<4<=> i=0\/i=1\/i=2\/i=3`;SET_RULE`{scs_stab_diag_v39 scs_4M7 (i + 2) i |i=0\/i=1\/i=2\/i=3} += {scs_stab_diag_v39 scs_4M7 (0 + 2) 0} UNION +{scs_stab_diag_v39 scs_4M7 (1 + 2) 1} UNION +{scs_stab_diag_v39 scs_4M7 (2 + 2) 2} UNION +{scs_stab_diag_v39 scs_4M7 (3 + 2) 3} +`;] +THEN ONCE_REWRITE_TAC[SET_RULE`{scs_stab_diag_v39 scs_4M7 0 2,scs_stab_diag_v39 scs_4M7 1 3}={scs_stab_diag_v39 scs_4M7 0 2} UNION {scs_stab_diag_v39 scs_4M7 1 3}UNION {scs_stab_diag_v39 scs_4M7 0 2} UNION {scs_stab_diag_v39 scs_4M7 1 3}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN REWRITE_TAC[ARITH_RULE`0+2=2/\ 1+2=3/\2+2=4/\ 3+2=5`] +THEN MRESA_TAC STAB_SYM[`scs_4M7`;`0`;`2`] +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M7_SCS;SCS_DIAG_SCS_4M7_02]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN MRESA_TAC STAB_SYM[`scs_4M7`;`1`;`3`] +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M7_SCS;SCS_DIAG_SCS_4M7_13]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN MRESAL_TAC STAB_MOD[`scs_4M7`;`4`;`2`][SCS_4M7_IS_SCS;K_SCS_4M7;ARITH_RULE`4 MOD 4=0/\ 2 MOD 4=2`] +THEN SYM_ASSUM_TAC +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M7_SCS;SCS_DIAG_SCS_4M7_02]; + +MRESAL_TAC STAB_MOD[`scs_4M7`;`5`;`3`][SCS_4M7_IS_SCS;K_SCS_4M7;ARITH_RULE`5 MOD 4=1/\ 3 MOD 4=3`] +THEN SYM_ASSUM_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M7_SCS;SCS_DIAG_SCS_4M7_13]]);; + + + +let SCS_4M7_SLICE_13=prove_by_refinement( +`scs_arrow_v39 {scs_stab_diag_v39 scs_4M7 1 3 } {scs_prop_equ_v39 scs_3T4_prime 2, scs_3T4_prime2 }`, +[ + +MATCH_MP_TAC (GEN_ALL Lkgrqui.LKGRQUI) +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4M7_13;STAB_4M7_SCS;SCS_K_D_A_STAB_EQ;] +THEN EXISTS_TAC`1` +THEN EXISTS_TAC`3` +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4M7_13] +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ] +THEN REPEAT RESA_TAC; + +REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ;scs_slice_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC scs_inj +THEN ASM_SIMP_TAC[SCS_3T4_prime_BASIC;SCS_4M7_BASIC;J_SCS_4M7;BASIC_HALF_SLICE_STAB;J_SCS_3T4_prime;D_HALF_SLICE;BAISC_PROP_EQU;K_SCS_PROP_EUQ;SCS_3T4_prime2_BASIC;J_SCS_3T4_prime2] +THEN STRIP_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4_prime;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M7] +THEN ARITH_TAC; + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4_prime;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M7; +ARITH_RULE`(3 + 1 + 4 - 1) MOD 4= 3/\ 1 MOD 4=1/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`2`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`2+x:num`;`2+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4_prime2;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M7] +THEN ARITH_TAC; + + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4_prime2;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M7; +ARITH_RULE`(1 + 1 + 4 - 3) MOD 4= 3/\ 3 MOD 4=3/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`0`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`x:num`;`x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[J_SCS_3T4_prime]; + +]);; + + +let SCS_4M7_SLICE_13_ARROW_3T4=prove(`scs_arrow_v39 {scs_stab_diag_v39 scs_4M7 1 3 } { scs_3T4}`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_prop_equ_v39 scs_3T4_prime 2, scs_3T4_prime2 }` +THEN ASM_REWRITE_TAC[SCS_4M7_SLICE_13] +THEN REWRITE_TAC[SET_RULE`{A,B}={A}UNION{B}/\ {scs_3T4}= {scs_3T4}UNION {scs_3T4}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={A}UNION{B}/\ {scs_3T4}= {scs_3T4}UNION {scs_3T4}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_REWRITE_TAC[SCS_3T4_prime2_ARROW_MM_3T4;SCS_3T4_prime_ARROW_MM_3T4] +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_3T4_prime}` +THEN ASM_REWRITE_TAC[SCS_3T4_prime2_ARROW_MM_3T4;SCS_3T4_prime_ARROW_MM_3T4] +THEN MRESAS_TAC PRO_EQU_ID1[`scs_3T4_prime`;`2`;`3`][SCS_3T4_prime_IS_SCS;K_SCS_3T4_prime;ARITH_RULE`(3 - 2 MOD 3)=1`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_3T4_prime 2`;`1`][PROP_EQU_IS_SCS;SCS_3T4_prime_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]);; + + +let SCS_4M7_SLICE_02=prove_by_refinement( +`scs_arrow_v39 {scs_stab_diag_v39 scs_4M7 0 2 } {scs_prop_equ_v39 scs_3T3_prime 1, scs_prop_equ_v39 scs_3M1_prime 1 }`, +[ +MATCH_MP_TAC (GEN_ALL Lkgrqui.LKGRQUI) +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4M7_02;STAB_4M7_SCS;SCS_K_D_A_STAB_EQ;] +THEN EXISTS_TAC`0` +THEN EXISTS_TAC`2` +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4M7_02] +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ] +THEN REPEAT RESA_TAC; + + +REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ;scs_slice_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC scs_inj +THEN ASM_SIMP_TAC[SCS_3T3_prime_BASIC;SCS_4M7_BASIC;J_SCS_4M7;BASIC_HALF_SLICE_STAB;J_SCS_3T3_prime;D_HALF_SLICE;BAISC_PROP_EQU;K_SCS_PROP_EUQ;SCS_3M1_prime_BASIC;J_SCS_3M1_prime] +THEN STRIP_TAC; + + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T3_prime;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M7] +THEN ARITH_TAC; + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4_prime;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M7; +ARITH_RULE`(2 + 1 + 4 - 0) MOD 4= 3/\ 0 MOD 4=0/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`1+x:num`;`1+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3M1_prime;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M7] +THEN ARITH_TAC; + + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3M1_prime;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M7; +ARITH_RULE`(0 + 1 + 4 - 2) MOD 4= 3/\ 2 MOD 4=2/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`1+x:num`;`1+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + + +SCS_TAC +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[J_SCS_3T3_prime]; + +]);; + + + +let SCS_4M7_SLICE_02_ARROW_3T3_3M1=prove( +`scs_arrow_v39 {scs_stab_diag_v39 scs_4M7 0 2 } { scs_3T3,scs_3M1}`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_prop_equ_v39 scs_3T3_prime 1, scs_prop_equ_v39 scs_3M1_prime 1}` +THEN ASM_REWRITE_TAC[SCS_4M7_SLICE_02] +THEN REWRITE_TAC[SET_RULE`{A,B}={A}UNION{B}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC +THENL[ + +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_3T3_prime}` +THEN ASM_REWRITE_TAC[SCS_3T3_prime_ARROW_MM_3T3] +THEN MRESAS_TAC PRO_EQU_ID1[`scs_3T3_prime`;`1`;`3`][SCS_3T3_prime_IS_SCS;K_SCS_3T3_prime;ARITH_RULE`(3 - 1 MOD 3)=2`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_3T3_prime 1`;`2`][PROP_EQU_IS_SCS;SCS_3T3_prime_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]; + +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_3M1_prime}` +THEN ASM_REWRITE_TAC[SCS_3M1_prime_ARROW_MM_3M1] +THEN MRESAS_TAC PRO_EQU_ID1[`scs_3M1_prime`;`1`;`3`][SCS_3M1_prime_IS_SCS;K_SCS_3M1_prime;ARITH_RULE`(3 - 1 MOD 3)=2`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_3M1_prime 1`;`2`][PROP_EQU_IS_SCS;SCS_3M1_prime_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]]);; + + + +let STAB_SCS_4M7_ARROW_3T3_3M1_3T4=prove( +`scs_arrow_v39 + { scs_stab_diag_v39 scs_4M7 i j| scs_diag 4 i j } {scs_3T3,scs_3M1,scs_3T4}`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_stab_diag_v39 scs_4M7 0 2,scs_stab_diag_v39 scs_4M7 1 3}` +THEN ASM_SIMP_TAC[SET_EQ_DIAG_STAB_4M7;SET_RULE`{A,B}={A}UNION {B}`;SET_RULE`{scs_3T3,scs_3M1,scs_3T4}={scs_3T3,scs_3M1} UNION{scs_3T4}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_REWRITE_TAC[SCS_4M7_SLICE_13_ARROW_3T4;SET_RULE`{A}UNION{B}={A,B}`;SCS_4M7_SLICE_02_ARROW_3T3_3M1]);; + + + +(***************************) + +let BB_4M8_IMP_BB_STAN_4M8= prove(` + BBs_v39 scs_4M8 v /\ + scs_diag 4 i j /\ + dist(v i,v j)<= cstab ==> + BBs_v39 (scs_stab_diag_v39 scs_4M8 i j) v`, +SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M8;scs_4M8;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M8;Terminal.FUNLIST_EXPLICIT;K_SCS_4M8] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ 2+1=3/\ 3+1=4`) +THEN SCS_TAC +THEN MP_TAC(SET_RULE`psort 4 (i,j) = psort 4 (i',j')\/ ~(psort 4 (i,j) = psort 4 (i',j'))`) +THEN RESA_TAC +THEN MRESA_TAC Uaghhbm.CASE_PSORT[`i`;`j'`;`j`;`i'`;`4`] +THENL[ +MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4M8`][scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M8;scs_4M8;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M8;Terminal.FUNLIST_EXPLICIT;K_SCS_4M8;SCS_4M8_IS_SCS] +THEN THAYTHEL_ASM_TAC 0[`i'`;`i`][] +THEN THAYTHEL_ASM_TAC 0[`j'`;`j`][]; + +MRESAS_TAC BB_VV_FUN_EQ[`v`;`scs_4M8`][scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M8;scs_4M8;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M8;Terminal.FUNLIST_EXPLICIT;K_SCS_4M8;SCS_4M8_IS_SCS] +THEN THAYTHEL_ASM_TAC 0[`i'`;`j`][] +THEN THAYTHEL_ASM_TAC 0[`j'`;`i`][] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]]);; + + +let MM_4M8_IMP_STAB_4M8=prove(` + MMs_v39 scs_4M8 v /\ + scs_diag 4 i j /\ + dist(v i,v j)<= cstab ==> + ~(MMs_v39 (scs_stab_diag_v39 scs_4M8 i j) ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC` scs_4M8 ` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4M8 `;`v`] +THEN ASSUME_TAC SCS_4M8_BASIC +THEN ASSUME_TAC K_SCS_4M8 +THEN ASM_SIMP_TAC[SCS_4M8_IS_SCS;SCS_4M8_IS_SCS;SCS_4M8_BASIC;K_SCS_4M8;SCS_K_D_A_STAB_EQ;IN; ADD1;SCS_DIAG_SCS_4M8_13;BB_4M8_IMP_BB_STAN_4M8;STAB_4M8_SCS] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + +let SET_STAB_4M8=prove(`{ scs_stab_diag_v39 scs_4M8 i j| scs_diag 4 i j }= { scs_stab_diag_v39 scs_4M8 (i MOD 4) (j MOD 4)| scs_diag 4 (i MOD 4) (j MOD 4) }`, + ASM_SIMP_TAC[STAB_MOD;DIAG_MOD;EXTENSION;IN_ELIM_THM;ARITH_RULE`~(4=0)`;] +THEN MRESAL_TAC STAB_MOD[`scs_4M8`][SCS_4M8_IS_SCS;K_SCS_4M8]);; + +let EXPAND_STAB_DIAG_4M8=prove(` +{scs_stab_diag_v39 scs_4M8 (i MOD 4) (j MOD 4) | j MOD 4 = + (i MOD 4 + 2) MOD 4}= +{scs_stab_diag_v39 scs_4M8 (i+2) i| i<4} `, +ASM_SIMP_TAC[EXPAND_STAB_DIAG_4;SCS_4M8_IS_SCS;K_SCS_4M8]);; + + +let SET_EQ_DIAG_STAB_4M8=prove_by_refinement(`scs_arrow_v39 + { scs_stab_diag_v39 scs_4M8 i j| scs_diag 4 i j } {scs_stab_diag_v39 scs_4M8 0 2,scs_stab_diag_v39 scs_4M8 1 3}`, +[ +ASM_SIMP_TAC[EXPAND_STAB_DIAG_4M8;SET_STAB_4M8;EXPAND_DIAG_4V;MOD_REFL;ARITH_RULE`~(4=0)`] +THEN +REWRITE_TAC[ARITH_RULE`i<4<=> i=0\/i=1\/i=2\/i=3`;SET_RULE`{scs_stab_diag_v39 scs_4M8 (i + 2) i |i=0\/i=1\/i=2\/i=3} += {scs_stab_diag_v39 scs_4M8 (0 + 2) 0} UNION +{scs_stab_diag_v39 scs_4M8 (1 + 2) 1} UNION +{scs_stab_diag_v39 scs_4M8 (2 + 2) 2} UNION +{scs_stab_diag_v39 scs_4M8 (3 + 2) 3} +`;] +THEN ONCE_REWRITE_TAC[SET_RULE`{scs_stab_diag_v39 scs_4M8 0 2,scs_stab_diag_v39 scs_4M8 1 3}={scs_stab_diag_v39 scs_4M8 0 2} UNION {scs_stab_diag_v39 scs_4M8 1 3}UNION {scs_stab_diag_v39 scs_4M8 0 2} UNION {scs_stab_diag_v39 scs_4M8 1 3}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN REWRITE_TAC[ARITH_RULE`0+2=2/\ 1+2=3/\2+2=4/\ 3+2=5`] +THEN MRESA_TAC STAB_SYM[`scs_4M8`;`0`;`2`] +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M8_SCS;SCS_DIAG_SCS_4M8_02]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN MRESA_TAC STAB_SYM[`scs_4M8`;`1`;`3`] +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M8_SCS;SCS_DIAG_SCS_4M8_13]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN MRESAL_TAC STAB_MOD[`scs_4M8`;`4`;`2`][SCS_4M8_IS_SCS;K_SCS_4M8;ARITH_RULE`4 MOD 4=0/\ 2 MOD 4=2`] +THEN SYM_ASSUM_TAC +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M8_SCS;SCS_DIAG_SCS_4M8_02]; + +MRESAL_TAC STAB_MOD[`scs_4M8`;`5`;`3`][SCS_4M8_IS_SCS;K_SCS_4M8;ARITH_RULE`5 MOD 4=1/\ 3 MOD 4=3`] +THEN SYM_ASSUM_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[STAB_4M8_SCS;SCS_DIAG_SCS_4M8_13]]);; + + + + + +let PROP_OPP_DIAG_4M8_13= prove_by_refinement(`scs_stab_diag_v39 scs_4M8 1 3= scs_prop_equ_v39(scs_opp_v39 (scs_stab_diag_v39 scs_4M8 0 2)) 2 `, +[REWRITE_TAC[scs_prop_equ_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39;SCS_K_D_A_STAB_EQ;scs_opp_v39] +THEN MATCH_MP_TAC scs_inj +THEN SIMP_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;SCS_4M8_BASIC;STAB_4M8_SCS;SCS_DIAG_SCS_4M8_13;scs_basic;unadorned_v39;peropp;peropp2] +THEN SCS_TAC +THEN STRIP_TAC; + + +SET_TAC[]; + +STRIP_TAC +THEN ASM_REWRITE_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_5M3;mk_unadorned_v39;peropp;peropp2;FUN_EQ_THM;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN REPEAT GEN_TAC +THEN ASSUME_TAC (ARITH_RULE`~(4=0)`) +THEN MRESA_TAC PSORT_MOD[`4`;`x`;`x'`] +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`2`;`x`;`4`] +THEN MRESA_TAC MOD_ADD_MOD[`2`;`x'`;`4`] +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`x MOD 4<4==> x MOD 4=0\/ x MOD 4=1\/ x MOD 4=2\/ x MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 4<4==> x' MOD 4=0\/ x' MOD 4=1\/ x' MOD 4=2\/ x' MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[Uxckfpe.ARITH_4_TAC;PSORT_5_EXPLICIT;ARITH_RULE`4-1=3/\ 4-2=2/\ 4-3=1/\ 4-4=0/\ 5-5=0/\ 2+0=2/\ 2+1=3/\ 2+2=4/\ 2+3=5/\2+4=6 +/\ 3+0=3/\ 3+1=4/\ 3+2=5/\ 3+3=6/\ 3+4=7/\ 7 MOD 5=2`;PAIR_EQ;Terminal.FUNLIST_EXPLICIT;]]);; + + + + + +let STAB_4M8_02_ARROW_4M8_13=prove(`scs_arrow_v39 {scs_stab_diag_v39 scs_4M8 0 2}{scs_stab_diag_v39 scs_4M8 1 3}`, +ASM_SIMP_TAC[PROP_OPP_DIAG_4M8_13] +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_opp_v39 (scs_stab_diag_v39 scs_4M8 0 2)}` +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC (GEN_ALL YXIONXL2) +THEN EXISTS_TAC`4` +THEN ASM_SIMP_TAC[SCS_K_D_A_STAB_EQ;ARITH_RULE`~(4<=3)`;K_SCS_4M8;STAB_4M8_SCS;SCS_DIAG_SCS_4M8_02] +; + +MATCH_MP_TAC(GEN_ALL YXIONXL3) +THEN MATCH_MP_TAC (GEN_ALL OPP_IS_SCS) +THEN EXISTS_TAC`scs_opp_v39 (scs_stab_diag_v39 scs_4M8 0 2)` +THEN ASM_SIMP_TAC[SCS_K_D_A_STAB_EQ;ARITH_RULE`~(4<=3)`;K_SCS_4M8;STAB_4M8_SCS;SCS_DIAG_SCS_4M8_02]]);; + + + +let SCS_4M8_SLICE_13=prove_by_refinement( +`scs_arrow_v39 {scs_stab_diag_v39 scs_4M8 1 3 } {scs_3T4_prime2 }`, +[ +ONCE_REWRITE_TAC[SET_RULE`{scs_3T4_prime2}={scs_3T4_prime2, scs_3T4_prime2}`] +THEN MATCH_MP_TAC (GEN_ALL Lkgrqui.LKGRQUI) +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4M8_13;STAB_4M8_SCS;SCS_K_D_A_STAB_EQ;] +THEN EXISTS_TAC`1` +THEN EXISTS_TAC`3` +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4M8_13] +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ] +THEN REPEAT RESA_TAC; + +REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ;scs_slice_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC scs_inj +THEN ASM_SIMP_TAC[SCS_3T4_prime_BASIC;SCS_4M8_BASIC;J_SCS_4M8;BASIC_HALF_SLICE_STAB;J_SCS_3T4_prime;D_HALF_SLICE;BAISC_PROP_EQU;K_SCS_PROP_EUQ;SCS_3T4_prime2_BASIC;J_SCS_3T4_prime2_1] +THEN STRIP_TAC; + + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4_prime2;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M8] +THEN ARITH_TAC; + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4_prime;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M8; +ARITH_RULE`(3 + 1 + 4 - 1) MOD 4= 3/\ 1 MOD 4=1/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`0`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`x:num`;`x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4_prime2;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M8] +THEN ARITH_TAC; + + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T4_prime2;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M8; +ARITH_RULE`(1 + 1 + 4 - 3) MOD 4= 3/\ 3 MOD 4=3/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`0`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`0`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`x:num`;`x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[J_SCS_3T4_prime2_1]; + +]);; + + + + +let SCS_4M8_SLICE_13_ARROW_3T4=prove( +`scs_arrow_v39 {scs_stab_diag_v39 scs_4M8 1 3 } { scs_3T4}`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{ scs_3T4_prime2 }` +THEN ASM_REWRITE_TAC[SCS_4M8_SLICE_13] +THEN ASM_REWRITE_TAC[SCS_3T4_prime2_ARROW_MM_3T4;SCS_3T4_prime_ARROW_MM_3T4]);; + + +let SCS_4M8_SLICE_02_ARROW_3T4 =prove(`scs_arrow_v39 { scs_stab_diag_v39 scs_4M8 0 2 } { scs_3T4 }`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_stab_diag_v39 scs_4M8 1 3}` +THEN ASM_SIMP_TAC[STAB_4M8_02_ARROW_4M8_13;SCS_4M8_SLICE_13_ARROW_3T4]);; + + + +let SET_STAB_4M8_ARROW_3T4=prove(`scs_arrow_v39 + { scs_stab_diag_v39 scs_4M8 i j| scs_diag 4 i j } {scs_3T4}`, +ONCE_REWRITE_TAC[SET_RULE`{A}={A,A}`] +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_stab_diag_v39 scs_4M8 0 2,scs_stab_diag_v39 scs_4M8 1 3}` +THEN ASM_REWRITE_TAC[SET_EQ_DIAG_STAB_4M8;] +THEN REWRITE_TAC[SET_RULE`{A,B}={A}UNION{B}`;] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[SCS_4M8_SLICE_02_ARROW_3T4;SCS_4M8_SLICE_13_ARROW_3T4]);; + + +(*****************) + +let h0_LT_B_SCS_4M6=prove(` +(!i j. scs_diag 4 i j ==> &4 * h0 < scs_b_v39 scs_4M6' i j) +/\ (!i j. scs_diag 4 i j ==> scs_a_v39 scs_4M6' i j <= cstab)`, +SCS_TAC +THEN REWRITE_TAC[h0;SCS_DIAG_4_CASES;cstab] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)`) +THEN MRESA_TAC PSORT_MOD[`4`;`i`;`j`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC);; + +let SCS_4M6_STAND_OR_PRO=prove(`!i. scs_a_v39 scs_4M6' i (i + 1) = &2 /\ + scs_b_v39 scs_4M6' i (i + 1) = &2 * h0 \/ + scs_a_v39 scs_4M6' i (i + 1) = &2 * h0 /\ + scs_b_v39 scs_4M6' i (i + 1) = cstab`, +GEN_TAC +THEN SCS_TAC +THEN SIMP_TAC[GSYM ADD1;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<4`] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`i:num`;`SUC i:num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`i`;`4`][ARITH_RULE`1<4`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN SCS_TAC);; + + + + +let SCS_4M6_STAND=prove(`scs_a_v39 scs_4M6' 1 2 = &2/\ scs_a_v39 scs_4M6' 2 3 = &2/\ scs_a_v39 scs_4M6' 3 4 = &2/\ scs_a_v39 scs_4M6' 0 1= &2 * h0 +/\ scs_a_v39 scs_4M6' 1 4= &2 * h0 +/\ scs_b_v39 scs_4M6' 0 1= cstab`, +SCS_TAC);; + + +let h0_CSTAB_LT_4=prove(`&2< &2*h0 /\ cstab< &4/\ &2<= &2*h0 /\ cstab<= &4 +/\ &2*h0< &4/\ &2< &4 /\ ~(&2 * h0 = &2)`, +REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC);; + +let EXTREMAL_SCS_4M6=prove_by_refinement(`main_nonlinear_terminal_v11 ==> +(!v. + MMs_v39 scs_4M6' v /\ + (!i j. scs_diag 4 i j ==> cstab < dist(v i,v j)) ==> + dist (v 1,v 2) = &2 /\ dist (v 2,v 3) = &2/\dist (v 3,v 0) = &2 +/\ dist (v 0,v 1) = cstab)`, +[ +STRIP_TAC +THEN GEN_TAC +THEN STRIP_TAC +THEN ASSUME_TAC(SCS_4M6_IS_SCS) +THEN MRESA_TAC MMS_IMP_BBS[`scs_4M6'`;`v`] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`scs_4M6'`] +THEN THAYTHES_TAC 0[`4`;`0`][ARITH_RULE`4 MOD 4 = 0 MOD 4`;MOD_MULT_ADD;K_SCS_4M6] +THEN MP_TAC PWEIWBZ +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M6'`;`v`;`1`][SCS_4M6_IS_SCS;SCS_4M6_BASIC;K_SCS_4M6;h0_LT_B_SCS_4M6;SCS_4M6_STAND_OR_PRO;ARITH_RULE`1+1=2`;SCS_4M6_STAND] +THEN MP_TAC PWEIWBZ +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M6'`;`v`;`2`][SCS_4M6_IS_SCS;SCS_4M6_BASIC;K_SCS_4M6;h0_LT_B_SCS_4M6;SCS_4M6_STAND_OR_PRO;ARITH_RULE`2+1=3`;SCS_4M6_STAND] +THEN MP_TAC PWEIWBZ +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M6'`;`v`;`3`][SCS_4M6_IS_SCS;SCS_4M6_BASIC;K_SCS_4M6;h0_LT_B_SCS_4M6;SCS_4M6_STAND_OR_PRO;ARITH_RULE`3+1=4`;SCS_4M6_STAND] +THEN ASSUME_TAC SCS_4M6_BASIC +THEN ASSUME_TAC K_SCS_4M6 +THEN ASSUME_TAC h0_LT_B_SCS_4M6 +THEN ASSUME_TAC SCS_4M6_STAND_OR_PRO +THEN ASSUME_TAC SCS_4M6_STAND +THEN ASSUME_TAC h0_CSTAB_LT_4 +THEN MP_TAC (SET_RULE`scs_is_str scs_4M6' v 0\/ ~(scs_is_str scs_4M6' v 0 )`) +THEN RESA_TAC; + +MP_TAC VASYYAU +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M6'`;`v`;`0`][ARITH_RULE`0+1=1`] +THEN MP_TAC Bkossge.quad_nonexist_849 +THEN ASM_REWRITE_TAC[NOT_EXISTS_THM] +THEN STRIP_TAC +THEN THAYTHE_TAC 0[`v 1`;`v 2`;`v 3`;`v 0`;] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[DE_MORGAN_THM;REAL_ARITH`~(a<=b)<=> b b b (!v. MMs_v39 scs_4M6' v /\ + (!i j. scs_diag 4 i j ==> cstab < dist (v i,v j)) + ==> BBs_v39 scs_4T3 v)`, +REPEAT STRIP_TAC +THEN MP_TAC EXTREMAL_SCS_4M6 +THEN RESA_TAC +THEN THAYTHE_TAC 0[`v`] +THEN MRESA_TAC MMS_IMP_BBS[`scs_4M6'`;`v`] +THEN DICH_TAC 0 +THEN SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4T3;scs_4M6;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M6;Terminal.FUNLIST_EXPLICIT;K_SCS_4T3] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ 2+1=3/\ 3+1=4`) +THEN SCS_TAC +THEN THAYTHE_TAC 2[`i`;`j`] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN MRESA_TAC MMS_IMP_BBS[`scs_4M6'`;`v`] +THEN MRESAL_TAC BB_VV_FUN_EQ[`v`;`scs_4M6'`][SCS_4M6_IS_SCS] +THEN THAYTHES_TAC 0[`i`;`i MOD 4`][ARITH_RULE`4 MOD 4 = 0 MOD 4`;MOD_MULT_ADD;K_SCS_4M6;MOD_REFL] +THEN MRESAL_TAC BB_VV_FUN_EQ[`v`;`scs_4M6'`][SCS_4M6_IS_SCS] +THEN THAYTHES_TAC 0[`j`;`j MOD 4`][ARITH_RULE`4 MOD 4 = 0 MOD 4`;MOD_MULT_ADD;K_SCS_4M6;MOD_REFL] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`i:num`;`j:num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`j MOD 4<4==> j MOD 4=0\/ j MOD 4=1\/ j MOD 4=2\/ j MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC);; + +(**************) + + +let MM_4M6_IMP_MM_4T3=prove(`main_nonlinear_terminal_v11 + ==> (!v. MMs_v39 scs_4M6' v /\ + (!i j. scs_diag 4 i j ==> cstab < dist (v i,v j)) +==> ~(MMs_v39 scs_4T3={}))`, +STRIP_TAC +THEN GEN_TAC +THEN STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_4M6'` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4M6'`;`v`] +THEN ASM_SIMP_TAC[SCS_4T3_BASIC;SCS_4M6_BASIC;SCS_4T3_IS_SCS;SCS_4T3_IS_SCS; +SCS_4M6_IS_SCS;K_SCS_4T3;K_SCS_4M6;IN;BB_4M6_IMP_scs_4T3] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + +let SCS_4M6_ARROW_SCS_4T3_STAB_4M6=prove_by_refinement( +`main_nonlinear_terminal_v11 +==> scs_arrow_v39 { scs_4M6' } ({scs_4T3} UNION {scs_stab_diag_v39 scs_4M6' i j| scs_diag 4 i j})`, +[ +STRIP_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;UNION;IN_ELIM_THM] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +ASM_SIMP_TAC[SCS_4T3_IS_SCS]; + +ASM_SIMP_TAC[STAB_4M6_SCS;K_SCS_4M6]; + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_4M6' ==> MMs_v39 s = {}) \/ ~((!s. s = scs_4M6' ==> MMs_v39 s = {}))`); + +ASM_REWRITE_TAC[]; + + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC; + +MP_TAC(SET_RULE`(!i j. scs_diag 4 i j ==> cstab < dist(v i,v j))\/ ~((!i j. scs_diag 4 i j ==> cstab < dist((v:num->real^3) i,v j)))`) +THEN RESA_TAC; + +EXISTS_TAC`scs_4T3` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MM_4M6_IMP_MM_4T3 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;REAL_ARITH`~(a b<=a`] +THEN STRIP_TAC +THEN MP_TAC MM_4M6_IMP_STAB_4M6 +THEN RESA_TAC +THEN DICH_TAC 0 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC +THEN EXISTS_TAC `scs_stab_diag_v39 scs_4M6' i j` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +MATCH_MP_TAC(SET_RULE`A==> B\/A`) +THEN EXISTS_TAC`i:num` +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[]; + +EXISTS_TAC`v':num->real^3` +THEN ASM_REWRITE_TAC[]]);; + + +let NWDGKXH=prove(`main_nonlinear_terminal_v11 +==> scs_arrow_v39 { scs_4M6' } ({scs_4T3, scs_4T5})`, +STRIP_TAC +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`({scs_4T3} UNION {scs_stab_diag_v39 scs_4M6' i j| scs_diag 4 i j})` +THEN ASM_SIMP_TAC[SCS_4M6_ARROW_SCS_4T3_STAB_4M6] +THEN REWRITE_TAC[SET_RULE`{A,B}={A}UNION{B}`;] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[SET_STAB_4M6_ARROW_4T5] +THEN MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[SCS_4T3_IS_SCS]);; + + + + +(*****************) + + +let h0_LT_B_SCS_4M7=prove(` +(!i j. scs_diag 4 i j ==> &4 * h0 < scs_b_v39 scs_4M7 i j) +/\ (!i j. scs_diag 4 i j ==> scs_a_v39 scs_4M7 i j <= cstab)`, +SCS_TAC +THEN REWRITE_TAC[h0;SCS_DIAG_4_CASES;cstab] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)`) +THEN MRESA_TAC PSORT_MOD[`4`;`i`;`j`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC);; + +let SCS_4M7_STAND_OR_PRO=prove(`!i. scs_a_v39 scs_4M7 i (i + 1) = &2 /\ + scs_b_v39 scs_4M7 i (i + 1) = &2 * h0 \/ + scs_a_v39 scs_4M7 i (i + 1) = &2 * h0 /\ + scs_b_v39 scs_4M7 i (i + 1) = cstab`, +GEN_TAC +THEN SCS_TAC +THEN SIMP_TAC[GSYM ADD1;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<4`] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`i:num`;`SUC i:num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`i`;`4`][ARITH_RULE`1<4`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN SCS_TAC);; + + +let SCS_4M7_STAND=prove( +`scs_a_v39 scs_4M7 0 1= &2*h0/\ scs_a_v39 scs_4M7 1 2 = &2 * h0 /\ scs_a_v39 scs_4M7 2 5= &2*h0 /\scs_b_v39 scs_4M7 1 2= cstab /\scs_b_v39 scs_4M7 0 1 = cstab`, +SCS_TAC);; + + + +let MIN_NOT_STAND_4M7=prove_by_refinement(`main_nonlinear_terminal_v11 ==> +(!v. + MMs_v39 scs_4M7 v /\ + (!i j. scs_diag 4 i j ==> cstab < dist(v i,v j)) ==> + dist (v 1,v 2) = &2 * h0 \/ dist (v 0,v 1) = &2*h0)`, +[STRIP_TAC +THEN GEN_TAC +THEN STRIP_TAC +THEN ASSUME_TAC(SCS_4M7_IS_SCS) +THEN MRESA_TAC MMS_IMP_BBS[`scs_4M7`;`v`] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`scs_4M7`] +THEN THAYTHES_TAC 0[`4`;`0`][ARITH_RULE`4 MOD 4 = 0 MOD 4`;MOD_MULT_ADD;K_SCS_4M7] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`scs_4M7`] +THEN THAYTHES_TAC 0[`5`;`1`][ARITH_RULE`5 MOD 4 = 1 MOD 4`;MOD_MULT_ADD;K_SCS_4M7] +THEN ASSUME_TAC h0_LT_B_SCS_4M7 +THEN ASSUME_TAC SCS_4M7_STAND_OR_PRO +THEN ASSUME_TAC SCS_4M7_BASIC +THEN ASSUME_TAC K_SCS_4M7 +THEN ASSUME_TAC SCS_4M7_STAND +THEN MP_TAC (SET_RULE`scs_is_str scs_4M7 v 0\/ ~(scs_is_str scs_4M7 v 0 )`) +THEN RESA_TAC; + +MP_TAC VASYYAU +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M7`;`v`;`0`][ARITH_RULE`0+1=1`]; + +MP_TAC (SET_RULE`scs_is_str scs_4M7 v 1\/ ~(scs_is_str scs_4M7 v 1 )`) +THEN RESA_TAC; + +MP_TAC VASYYAU +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M7`;`v`;`1`][ARITH_RULE`1+1=2`]; + +MP_TAC (SET_RULE`scs_is_str scs_4M7 v 2\/ ~(scs_is_str scs_4M7 v 2 )`) +THEN RESA_TAC; + +MP_TAC VASYYAU +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M7`;`v`;`2`][ARITH_RULE`2+3=5`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]; + +MP_TAC TUAPYYU +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M7`;`v`;`1`][IN;ARITH_RULE`1+1=2`] +THEN MP_TAC TUAPYYU +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M7`;`v`;`0`][IN;ARITH_RULE`0+1=1`] +THEN MRESAL_TAC STR_MOD_EQ[`4`;`scs_4M7`;`v`;`4`][IN;ARITH_RULE`4 MOD 4=0`] +THEN MP_TAC WKZZEEH +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M7`;`v`;`1`][ARITH_RULE`1+1=2/\ 1+3=4`] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]]);; + + + + + +let BB_4M7_IMP_4M6_12=prove(`main_nonlinear_terminal_v11 ==> +(!v. + MMs_v39 scs_4M7 v /\ + (!i j. scs_diag 4 i j ==> cstab < dist(v i,v j)) /\ + dist (v 1,v 2) = &2*h0 +==> BBs_v39 scs_4M6' v)`, +REPEAT STRIP_TAC +THEN MRESA_TAC MMS_IMP_BBS[`scs_4M7`;`v`] +THEN DICH_TAC 0 +THEN SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M7;scs_4M6;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M6;Terminal.FUNLIST_EXPLICIT;K_SCS_4M6] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ 2+1=3/\ 3+1=4`) +THEN SCS_TAC +THEN THAYTHE_TAC 2[`i`;`j`] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN MRESA_TAC MMS_IMP_BBS[`scs_4M7`;`v`] +THEN MRESAL_TAC BB_VV_FUN_EQ[`v`;`scs_4M7`][SCS_4M7_IS_SCS] +THEN THAYTHES_TAC 0[`i`;`i MOD 4`][ARITH_RULE`4 MOD 4 = 0 MOD 4`;MOD_MULT_ADD;K_SCS_4M7;MOD_REFL] +THEN MRESAL_TAC BB_VV_FUN_EQ[`v`;`scs_4M7`][SCS_4M7_IS_SCS] +THEN THAYTHES_TAC 0[`j`;`j MOD 4`][ARITH_RULE`4 MOD 4 = 0 MOD 4`;MOD_MULT_ADD;K_SCS_4M7;MOD_REFL] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`i:num`;`j:num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`j MOD 4<4==> j MOD 4=0\/ j MOD 4=1\/ j MOD 4=2\/ j MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC);; + + + +let MM_4M7_IMP_MM_4M6_12=prove(`main_nonlinear_terminal_v11 + ==> (!v. MMs_v39 scs_4M7 v /\ + (!i j. scs_diag 4 i j ==> cstab < dist (v i,v j))/\ + dist (v 1,v 2) = &2 * h0 +==> ~(MMs_v39 scs_4M6'={}))`, +STRIP_TAC +THEN GEN_TAC +THEN STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_4M7` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4M7`;`v`] +THEN ASM_SIMP_TAC[SCS_4M6_BASIC;SCS_4M7_BASIC;SCS_4M6_IS_SCS;SCS_4M6_IS_SCS; +SCS_4M7_IS_SCS;K_SCS_4M6;K_SCS_4M7;IN;BB_4M7_IMP_4M6_12] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + + + +let BB_4M7_IMP_4M6_01=prove( +`main_nonlinear_terminal_v11 ==> +(!v. + MMs_v39 scs_4M7 v /\ + (!i j. scs_diag 4 i j ==> cstab < dist(v i,v j)) /\ + dist (v 0,v 1) = &2*h0 +==> BBs_v39 (scs_prop_equ_v39(scs_opp_v39 scs_4M6' ) 1) v)`, +REPEAT STRIP_TAC +THEN MRESA_TAC MMS_IMP_BBS[`scs_4M7`;`v`] +THEN DICH_TAC 0 +THEN SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M7;scs_4M6;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M6;Terminal.FUNLIST_EXPLICIT;K_SCS_4M6;scs_prop_equ_v39;scs_opp_v39;peropp2] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ 2+1=3/\ 3+1=4`) +THEN SCS_TAC +THEN THAYTHE_TAC 2[`i`;`j`] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN MRESA_TAC MMS_IMP_BBS[`scs_4M7`;`v`] +THEN MRESAL_TAC BB_VV_FUN_EQ[`v`;`scs_4M7`][SCS_4M7_IS_SCS] +THEN THAYTHES_TAC 0[`i`;`i MOD 4`][ARITH_RULE`4 MOD 4 = 0 MOD 4`;MOD_MULT_ADD;K_SCS_4M7;MOD_REFL] +THEN MRESAL_TAC BB_VV_FUN_EQ[`v`;`scs_4M7`][SCS_4M7_IS_SCS] +THEN THAYTHES_TAC 0[`j`;`j MOD 4`][ARITH_RULE`4 MOD 4 = 0 MOD 4`;MOD_MULT_ADD;K_SCS_4M7;MOD_REFL] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`1+i:num`;`1+j:num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`i:num`;`j:num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`1`;`i`;`4`] +THEN MRESA_TAC MOD_ADD_MOD[`1`;`j`;`4`] +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN ASSUME_TAC(ARITH_RULE`4-1=3/\ 4-0=4/\ 4-2=2/\ 4-3=1/\ 4-4=0/\ 3+2=5 /\3+3=6/\ 5 MOD 4=1/\ 6 MOD 4=2`) +THEN MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`j MOD 4<4==> j MOD 4=0\/ j MOD 4=1\/ j MOD 4=2\/ j MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[h0;REAL_ARITH`a<=a`] +THEN REAL_ARITH_TAC);; + + + +let MM_4M7_IMP_MM_4M6_01=prove_by_refinement(`main_nonlinear_terminal_v11 + ==> (!v. MMs_v39 scs_4M7 v /\ + (!i j. scs_diag 4 i j ==> cstab < dist (v i,v j))/\ + dist (v 0,v 1) = &2 * h0 +==> ~(MMs_v39 (scs_prop_equ_v39(scs_opp_v39 scs_4M6' ) 1)={}))`, +[STRIP_TAC +THEN GEN_TAC +THEN STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_4M7` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4M7`;`v`] +THEN ASM_SIMP_TAC[SCS_4M6_BASIC;SCS_4M7_BASIC;SCS_4M6_IS_SCS;SCS_4M6_IS_SCS; +SCS_4M7_IS_SCS;K_SCS_4M6;K_SCS_4M7;IN;BB_4M7_IMP_4M6_01] +THEN STRIP_TAC; + +MATCH_MP_TAC PROP_EQU_IS_SCS +THEN MATCH_MP_TAC(GEN_ALL OPP_IS_SCS) +THEN EXISTS_TAC`scs_opp_v39 scs_4M6'` +THEN ASM_REWRITE_TAC[SCS_4M6_IS_SCS]; + +STRIP_TAC; + +MATCH_MP_TAC Hexagons.BAISC_PROP_EQU +THEN MATCH_MP_TAC Cqaoqlr.BASIC_OPP +THEN ASM_SIMP_TAC[SCS_4M6_IS_SCS;SCS_4M6_BASIC]; + +ASM_REWRITE_TAC[Hexagons.K_SCS_PROP_EUQ] +THEN ASM_REWRITE_TAC[scs_opp_v39;scs_prop_equ_v39] +THEN SCS_TAC +THEN REAL_ARITH_TAC]);; + + + +let SCS_4M7_ARROW_STAB_4M7_4M6=prove_by_refinement( +`main_nonlinear_terminal_v11 +==> scs_arrow_v39 { scs_4M7 } ({scs_4M6', scs_prop_equ_v39(scs_opp_v39 scs_4M6' ) 1} UNION {scs_stab_diag_v39 scs_4M7 i j| scs_diag 4 i j})`, +[ +STRIP_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;UNION;IN_ELIM_THM;SET_RULE`a IN {b,c}<=> a= b\/ a=c`] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +ASM_SIMP_TAC[SCS_4M6_IS_SCS]; + +MATCH_MP_TAC PROP_EQU_IS_SCS +THEN MATCH_MP_TAC(GEN_ALL OPP_IS_SCS) +THEN EXISTS_TAC`scs_opp_v39 scs_4M6'` +THEN ASM_REWRITE_TAC[SCS_4M6_IS_SCS]; + +ASM_SIMP_TAC[STAB_4M7_SCS;K_SCS_4M7]; + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_4M7 ==> MMs_v39 s = {}) \/ ~((!s. s = scs_4M7 ==> MMs_v39 s = {}))`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC; + +MP_TAC(SET_RULE`(!i j. scs_diag 4 i j ==> cstab < dist(v i,v j))\/ ~((!i j. scs_diag 4 i j ==> cstab < dist((v:num->real^3) i,v j)))`) +THEN RESA_TAC; + +MP_TAC MIN_NOT_STAND_4M7 +THEN RESA_TAC +THEN THAYTHE_TAC 0[`v`]; + +EXISTS_TAC`scs_4M6'` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MM_4M7_IMP_MM_4M6_12 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[]; + +EXISTS_TAC`scs_prop_equ_v39 (scs_opp_v39 scs_4M6') 1` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MM_4M7_IMP_MM_4M6_01 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;REAL_ARITH`~(a b<=a`] +THEN STRIP_TAC +THEN MP_TAC MM_4M7_IMP_STAB_4M7 +THEN RESA_TAC +THEN DICH_TAC 0 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC +THEN EXISTS_TAC `scs_stab_diag_v39 scs_4M7 i j` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +MATCH_MP_TAC(SET_RULE`A==> B\/A`) +THEN EXISTS_TAC`i:num` +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[]; + +EXISTS_TAC`v':num->real^3` +THEN ASM_REWRITE_TAC[]]);; + + +(*************) + +let K_SCS_OPP_4M6=prove(`scs_k_v39 (scs_opp_v39 scs_4M6') = 4`, +ASM_REWRITE_TAC[scs_opp_v39;scs_prop_equ_v39] +THEN SCS_TAC);; + +let SCS_4M6_OPP_IS_SCS=prove(`is_scs_v39 (scs_opp_v39 scs_4M6')`, +MATCH_MP_TAC(GEN_ALL OPP_IS_SCS) +THEN EXISTS_TAC`scs_opp_v39 scs_4M6'` +THEN ASM_REWRITE_TAC[SCS_4M6_IS_SCS]);; + + +let YOBIMPP=prove(`main_nonlinear_terminal_v11 +==> scs_arrow_v39 { scs_4M7 } {scs_4M6',scs_3T3,scs_3M1,scs_3T4}`, + +STRIP_TAC +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`({scs_4M6', scs_prop_equ_v39(scs_opp_v39 scs_4M6' ) 1} UNION {scs_stab_diag_v39 scs_4M7 i j| scs_diag 4 i j})` +THEN ASM_SIMP_TAC[SCS_4M7_ARROW_STAB_4M7_4M6; +SET_RULE`{scs_4M6',scs_3T3,scs_3M1,scs_3T4}={scs_4M6',scs_4M6'} UNION{scs_3T3,scs_3M1,scs_3T4}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[STAB_SCS_4M7_ARROW_3T3_3M1_3T4;SET_RULE`{A,B}={A} UNION {B}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC +THENL[ + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[SCS_4M6_IS_SCS]; + + +MRESAS_TAC PRO_EQU_ID1[`scs_opp_v39 scs_4M6'`;`1`;`4`][SCS_4M6_IS_SCS;K_SCS_4M6;ARITH_RULE`(4 - 1 MOD 4)=3`;K_SCS_OPP_4M6;SCS_4M6_OPP_IS_SCS] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 (scs_opp_v39 scs_4M6') 1`;`3`][PROP_EQU_IS_SCS;SCS_4M6_IS_SCS;K_SCS_OPP_4M6;SCS_4M6_OPP_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[] +THEN STRIP_TAC +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_opp_v39 scs_4M6'}` +THEN ASM_REWRITE_TAC[] +THEN ASSUME_TAC SCS_4M6_IS_SCS +THEN MRESA_TAC Yxionxl2.SCS_OPP_REFL[`scs_4M6'`] +THEN MRESAS_TAC YXIONXL2[`4`;`scs_opp_v39 scs_4M6'`][K_SCS_OPP_4M6;SCS_4M6_OPP_IS_SCS;ARITH_RULE`~(4<=3)`]]);; + + +(**************************) + + + +let BB_4M8_IMP_4M6_23=prove(`main_nonlinear_terminal_v11 ==> +(!v. + MMs_v39 scs_4M8 v /\ + (!i j. scs_diag 4 i j ==> cstab < dist(v i,v j)) /\ + dist (v 2,v 3) = &2*h0 +==> BBs_v39 scs_4M6' v)`, +REPEAT STRIP_TAC +THEN MRESA_TAC MMS_IMP_BBS[`scs_4M8`;`v`] +THEN DICH_TAC 0 +THEN SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M8;scs_4M6;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M6;Terminal.FUNLIST_EXPLICIT;K_SCS_4M6] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ 2+1=3/\ 3+1=4`) +THEN SCS_TAC +THEN THAYTHE_TAC 2[`i`;`j`] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN MRESA_TAC MMS_IMP_BBS[`scs_4M8`;`v`] +THEN MRESAL_TAC BB_VV_FUN_EQ[`v`;`scs_4M8`][SCS_4M8_IS_SCS] +THEN THAYTHES_TAC 0[`i`;`i MOD 4`][ARITH_RULE`4 MOD 4 = 0 MOD 4`;MOD_MULT_ADD;K_SCS_4M8;MOD_REFL] +THEN MRESAL_TAC BB_VV_FUN_EQ[`v`;`scs_4M8`][SCS_4M8_IS_SCS] +THEN THAYTHES_TAC 0[`j`;`j MOD 4`][ARITH_RULE`4 MOD 4 = 0 MOD 4`;MOD_MULT_ADD;K_SCS_4M8;MOD_REFL] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`i:num`;`j:num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`j MOD 4<4==> j MOD 4=0\/ j MOD 4=1\/ j MOD 4=2\/ j MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC);; + + + +let MM_4M8_IMP_MM_4M6_23=prove( +`main_nonlinear_terminal_v11 + ==> (!v. MMs_v39 scs_4M8 v /\ + (!i j. scs_diag 4 i j ==> cstab < dist (v i,v j))/\ + dist (v 2,v 3) = &2 * h0 +==> ~(MMs_v39 scs_4M6'={}))`, +STRIP_TAC +THEN GEN_TAC +THEN STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_4M8` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4M8`;`v`] +THEN ASM_SIMP_TAC[SCS_4M6_BASIC;SCS_4M8_BASIC;SCS_4M6_IS_SCS;SCS_4M6_IS_SCS; +SCS_4M8_IS_SCS;K_SCS_4M6;K_SCS_4M8;IN;BB_4M8_IMP_4M6_23] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + + +let BB_4M8_IMP_4M6_01=prove( +`main_nonlinear_terminal_v11 ==> +(!v. + MMs_v39 scs_4M8 v /\ + (!i j. scs_diag 4 i j ==> cstab < dist(v i,v j)) /\ + dist (v 0,v 1) = &2*h0 +==> BBs_v39 ((scs_opp_v39 scs_4M6' ) ) v)`, +REPEAT STRIP_TAC +THEN MRESA_TAC MMS_IMP_BBS[`scs_4M8`;`v`] +THEN DICH_TAC 0 +THEN SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M8;scs_4M6;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M6;Terminal.FUNLIST_EXPLICIT;K_SCS_4M6;scs_prop_equ_v39;scs_opp_v39;peropp2] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ 2+1=3/\ 3+1=4`) +THEN SCS_TAC +THEN THAYTHE_TAC 2[`i`;`j`] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN MRESA_TAC MMS_IMP_BBS[`scs_4M8`;`v`] +THEN MRESAL_TAC BB_VV_FUN_EQ[`v`;`scs_4M8`][SCS_4M8_IS_SCS] +THEN THAYTHES_TAC 0[`i`;`i MOD 4`][ARITH_RULE`4 MOD 4 = 0 MOD 4`;MOD_MULT_ADD;K_SCS_4M8;MOD_REFL] +THEN MRESAL_TAC BB_VV_FUN_EQ[`v`;`scs_4M8`][SCS_4M8_IS_SCS] +THEN THAYTHES_TAC 0[`j`;`j MOD 4`][ARITH_RULE`4 MOD 4 = 0 MOD 4`;MOD_MULT_ADD;K_SCS_4M8;MOD_REFL] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`1+i:num`;`1+j:num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`i:num`;`j:num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`1`;`i`;`4`] +THEN MRESA_TAC MOD_ADD_MOD[`1`;`j`;`4`] +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN ASSUME_TAC(ARITH_RULE`4-1=3/\ 4-0=4/\ 4-2=2/\ 4-3=1/\ 4-4=0/\ 3+2=5 /\3+3=6/\ 5 MOD 4=1/\ 6 MOD 4=2`) +THEN MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`j MOD 4<4==> j MOD 4=0\/ j MOD 4=1\/ j MOD 4=2\/ j MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[h0;REAL_ARITH`a<=a`] +THEN REAL_ARITH_TAC);; + + + + + +let MM_4M8_IMP_MM_4M6_01=prove_by_refinement(`main_nonlinear_terminal_v11 + ==> (!v. MMs_v39 scs_4M8 v /\ + (!i j. scs_diag 4 i j ==> cstab < dist (v i,v j))/\ + dist (v 0,v 1) = &2 * h0 +==> ~(MMs_v39 ((scs_opp_v39 scs_4M6' ) )={}))`, +[ +STRIP_TAC +THEN GEN_TAC +THEN STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_4M8` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4M8`;`v`] +THEN ASM_SIMP_TAC[SCS_4M6_BASIC;SCS_4M8_BASIC;SCS_4M6_IS_SCS;SCS_4M6_IS_SCS; +SCS_4M8_IS_SCS;K_SCS_4M6;K_SCS_4M8;IN;BB_4M8_IMP_4M6_01] +THEN STRIP_TAC; + +MATCH_MP_TAC(GEN_ALL OPP_IS_SCS) +THEN EXISTS_TAC`scs_opp_v39 scs_4M6'` +THEN ASM_REWRITE_TAC[SCS_4M6_IS_SCS]; + +STRIP_TAC; + +MATCH_MP_TAC Cqaoqlr.BASIC_OPP +THEN ASM_SIMP_TAC[SCS_4M6_IS_SCS;SCS_4M6_BASIC]; + +ASM_REWRITE_TAC[Hexagons.K_SCS_PROP_EUQ] +THEN ASM_REWRITE_TAC[scs_opp_v39;scs_prop_equ_v39] +THEN SCS_TAC +THEN REAL_ARITH_TAC]);; + + + +let h0_LT_B_SCS_4M8=prove(` +(!i j. scs_diag 4 i j ==> &4 * h0 < scs_b_v39 scs_4M8 i j) +/\ (!i j. scs_diag 4 i j ==> scs_a_v39 scs_4M8 i j <= cstab)`, +SCS_TAC +THEN REWRITE_TAC[h0;SCS_DIAG_4_CASES;cstab] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)`) +THEN MRESA_TAC PSORT_MOD[`4`;`i`;`j`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC);; + +let SCS_4M8_STAND_OR_PRO=prove(`!i. scs_a_v39 scs_4M8 i (i + 1) = &2 /\ + scs_b_v39 scs_4M8 i (i + 1) = &2 * h0 \/ + scs_a_v39 scs_4M8 i (i + 1) = &2 * h0 /\ + scs_b_v39 scs_4M8 i (i + 1) = cstab`, +GEN_TAC +THEN SCS_TAC +THEN SIMP_TAC[GSYM ADD1;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<4`] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`i:num`;`SUC i:num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`i`;`4`][ARITH_RULE`1<4`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN SCS_TAC);; + + + + +let SCS_4M8_STAND=prove( +`scs_a_v39 scs_4M8 0 1= &2*h0/\ scs_a_v39 scs_4M8 1 2 = &2 /\ scs_a_v39 scs_4M8 2 5= &2 /\scs_b_v39 scs_4M8 1 2= &2 *h0 /\scs_b_v39 scs_4M8 0 1 = cstab +/\scs_a_v39 scs_4M8 2 3 = &2 * h0/\ scs_a_v39 scs_4M8 3 4 = &2/\ scs_b_v39 scs_4M8 2 3= cstab/\ scs_a_v39 scs_4M8 1 4= &2* h0/\ scs_a_v39 scs_4M8 3 6= &2 * h0`, +SCS_TAC);; + + + + + + +let MIN_NOT_STAND_4M8=prove_by_refinement( +`main_nonlinear_terminal_v11 ==> +(!v. + MMs_v39 scs_4M8 v /\ + (!i j. scs_diag 4 i j ==> cstab < dist(v i,v j)) ==> + dist (v 2,v 3) = &2 * h0 \/ dist (v 0,v 1) = &2*h0 +\/ (dist (v 0,v 1) = cstab/\ dist (v 1,v 2) = &2 /\ dist (v 2,v 3) = cstab/\ +dist (v 3,v 0) = &2))`, +[ +STRIP_TAC +THEN GEN_TAC +THEN STRIP_TAC +THEN ASSUME_TAC(SCS_4M8_IS_SCS) +THEN MRESA_TAC MMS_IMP_BBS[`scs_4M8`;`v`] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`scs_4M8`] +THEN THAYTHES_TAC 0[`4`;`0`][ARITH_RULE`4 MOD 4 = 0 MOD 4`;MOD_MULT_ADD;K_SCS_4M8] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`scs_4M8`] +THEN THAYTHES_TAC 0[`5`;`1`][ARITH_RULE`5 MOD 4 = 1 MOD 4`;MOD_MULT_ADD;K_SCS_4M8] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`scs_4M8`] +THEN THAYTHES_TAC 0[`6`;`2`][ARITH_RULE`6 MOD 4 = 2 MOD 4`;MOD_MULT_ADD;K_SCS_4M8] +THEN ASSUME_TAC h0_LT_B_SCS_4M8 +THEN ASSUME_TAC SCS_4M8_STAND_OR_PRO +THEN ASSUME_TAC SCS_4M8_BASIC +THEN ASSUME_TAC K_SCS_4M8 +THEN ASSUME_TAC SCS_4M8_STAND +THEN MP_TAC (SET_RULE`scs_is_str scs_4M8 v 0\/ ~(scs_is_str scs_4M8 v 0 )`) +THEN RESA_TAC; + +MP_TAC VASYYAU +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M8`;`v`;`0`][ARITH_RULE`0+1=1`]; + +MP_TAC (SET_RULE`scs_is_str scs_4M8 v 2\/ ~(scs_is_str scs_4M8 v 2 )`) +THEN RESA_TAC; + +MP_TAC VASYYAU +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M8`;`v`;`2`][ARITH_RULE`2+3=5/\ 2+1=3`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]; + + +MP_TAC (SET_RULE`scs_is_str scs_4M8 v 1\/ ~(scs_is_str scs_4M8 v 1 )`) +THEN RESA_TAC; + +MP_TAC VASYYAU +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M8`;`v`;`1`][ARITH_RULE`1+1=2/\ 1+3=4`] +THEN MP_TAC PWEIWBZ +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M8`;`v`;`3`][ARITH_RULE`1+1=2/\ 3+1=4`] +THEN MRESAS_TAC NOT_STR_IN_CASES_4_1[`0`;`scs_4M8`;`v`][ARITH_RULE`0+a=a`;IN] +THEN MP_TAC TUAPYYU +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M8`;`v`;`2`][ARITH_RULE`1+1=2/\ 3+1=4/\ 2+1=3`;IN] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]; + +MP_TAC (SET_RULE`scs_is_str scs_4M8 v 3\/ ~(scs_is_str scs_4M8 v 3 )`) +THEN RESA_TAC; + +MP_TAC VASYYAU +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M8`;`v`;`3`][ARITH_RULE`3+1=4/\ 3+3=6`] +THEN MP_TAC PWEIWBZ +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M8`;`v`;`1`][ARITH_RULE`1+1=2/\ 3+1=4`] +THEN MP_TAC TUAPYYU +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M8`;`v`;`0`][ARITH_RULE`0+1=1/\ 3+1=4/\ 2+1=3`;IN] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]; + +MP_TAC TUAPYYU +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M8`;`v`;`0`][ARITH_RULE`0+1=1/\ 3+1=4/\ 2+1=3`;IN] +THEN MP_TAC TUAPYYU +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M8`;`v`;`2`][ARITH_RULE`0+1=1/\ 3+1=4/\ 2+1=3`;IN] +THEN MP_TAC YEBWJNG +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M8`;`v`;`1`][ARITH_RULE`1+1=2/\ 3+1=4/\ 2+1=3`;IN] +THEN MRESAL_TAC STR_MOD_EQ[`4`;`scs_4M8`;`v`;`4`][SCS_4M8_IS_SCS;IN;ARITH_RULE`4 MOD 4=0`] +THEN MP_TAC YEBWJNG +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_4M8`;`v`;`3`][ARITH_RULE`1+1=2/\ 3+1=4/\ 2+1=3`;IN]]);; + + +let BB_4M8_IMP_scs_4M8_02=prove( +`main_nonlinear_terminal_v11 + ==> (!v. MMs_v39 scs_4M8 v /\ + (!i j. scs_diag 4 i j ==> cstab < dist (v i,v j))/\ + dist (v 0,v 1) = cstab/\ dist (v 1,v 2) = &2 /\ dist (v 2,v 3) = cstab/\ +dist (v 3,v 0) = &2 /\ dist(v 0, v 2)<= #3.62 +==> BBs_v39 scs_4M8_02 v)`, +STRIP_TAC +THEN GEN_TAC +THEN STRIP_TAC +THEN MRESA_TAC MMS_IMP_BBS[`scs_4M8`;`v`] +THEN DICH_TAC 0 +THEN SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M8_02;scs_4M8;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M8_02;Terminal.FUNLIST_EXPLICIT;K_SCS_4M8] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ 2+1=3/\ 3+1=4`) +THEN SCS_TAC +THEN THAYTHE_TAC 2[`i`;`j`] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN MRESA_TAC MMS_IMP_BBS[`scs_4M8`;`v`] +THEN MRESAL_TAC BB_VV_FUN_EQ[`v`;`scs_4M8`][SCS_4M8_IS_SCS] +THEN THAYTHES_TAC 0[`i`;`i MOD 4`][ARITH_RULE`4 MOD 4 = 0 MOD 4`;MOD_MULT_ADD;K_SCS_4M8;MOD_REFL] +THEN MRESAL_TAC BB_VV_FUN_EQ[`v`;`scs_4M8`][SCS_4M8_IS_SCS] +THEN THAYTHES_TAC 0[`j`;`j MOD 4`][ARITH_RULE`4 MOD 4 = 0 MOD 4`;MOD_MULT_ADD;K_SCS_4M8;MOD_REFL] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`i:num`;`j:num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`j MOD 4<4==> j MOD 4=0\/ j MOD 4=1\/ j MOD 4=2\/ j MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC);; + + + +let MM_4M8_IMP_MM_4M8_02=prove(`main_nonlinear_terminal_v11 + ==> (!v. MMs_v39 scs_4M8 v /\ + (!i j. scs_diag 4 i j ==> cstab < dist (v i,v j))/\ + dist (v 0,v 1) = cstab/\ dist (v 1,v 2) = &2 /\ dist (v 2,v 3) = cstab/\ +dist (v 3,v 0) = &2 /\ dist(v 0, v 2)<= #3.62 +==> ~(MMs_v39 scs_4M8_02={}))`, +STRIP_TAC +THEN GEN_TAC +THEN STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_4M8` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4M8`;`v`] +THEN ASM_SIMP_TAC[SCS_4M8_02_BASIC;SCS_4M8_BASIC;SCS_4M8_02_IS_SCS;SCS_4M8_02_IS_SCS; +SCS_4M8_IS_SCS;K_SCS_4M8_02;K_SCS_4M8;IN;BB_4M8_IMP_scs_4M8_02] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + +let BB_4M8_IMP_scs_4M8_13=prove( +`main_nonlinear_terminal_v11 + ==> (!v. MMs_v39 scs_4M8 v /\ + (!i j. scs_diag 4 i j ==> cstab < dist (v i,v j))/\ + dist (v 0,v 1) = cstab/\ dist (v 1,v 2) = &2 /\ dist (v 2,v 3) = cstab/\ +dist (v 3,v 0) = &2 /\ dist(v 1, v 3)<= #3.62 +==> BBs_v39 scs_4M8_13 v)`, +STRIP_TAC +THEN GEN_TAC +THEN STRIP_TAC +THEN MRESA_TAC MMS_IMP_BBS[`scs_4M8`;`v`] +THEN DICH_TAC 0 +THEN SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_4M8_13;scs_4M8;CS_ADJ;scs_diag;ARITH_RULE`~(4<=3)`;IN;K_SCS_4M8_13;Terminal.FUNLIST_EXPLICIT;K_SCS_4M8] +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ 2+1=3/\ 3+1=4`) +THEN SCS_TAC +THEN THAYTHE_TAC 2[`i`;`j`] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN MRESA_TAC MMS_IMP_BBS[`scs_4M8`;`v`] +THEN MRESAL_TAC BB_VV_FUN_EQ[`v`;`scs_4M8`][SCS_4M8_IS_SCS] +THEN THAYTHES_TAC 0[`i`;`i MOD 4`][ARITH_RULE`4 MOD 4 = 0 MOD 4`;MOD_MULT_ADD;K_SCS_4M8;MOD_REFL] +THEN MRESAL_TAC BB_VV_FUN_EQ[`v`;`scs_4M8`][SCS_4M8_IS_SCS] +THEN THAYTHES_TAC 0[`j`;`j MOD 4`][ARITH_RULE`4 MOD 4 = 0 MOD 4`;MOD_MULT_ADD;K_SCS_4M8;MOD_REFL] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`4`;`i:num`;`j:num`][ARITH_RULE`~(4=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`j MOD 4<4==> j MOD 4=0\/ j MOD 4=1\/ j MOD 4=2\/ j MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC);; + + + +let MM_4M8_IMP_MM_4M8_13=prove(`main_nonlinear_terminal_v11 + ==> (!v. MMs_v39 scs_4M8 v /\ + (!i j. scs_diag 4 i j ==> cstab < dist (v i,v j))/\ + dist (v 0,v 1) = cstab/\ dist (v 1,v 2) = &2 /\ dist (v 2,v 3) = cstab/\ +dist (v 3,v 0) = &2 /\ dist(v 1, v 3)<= #3.62 +==> ~(MMs_v39 scs_4M8_13={}))`, +STRIP_TAC +THEN GEN_TAC +THEN STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_4M8` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_4M8`;`v`] +THEN ASM_SIMP_TAC[SCS_4M8_13_BASIC;SCS_4M8_BASIC;SCS_4M8_13_IS_SCS;SCS_4M8_13_IS_SCS; +SCS_4M8_IS_SCS;K_SCS_4M8_13;K_SCS_4M8;IN;BB_4M8_IMP_scs_4M8_13] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + + +let SCS_4M8_ARROW_STEP_ONE=prove_by_refinement( +`main_nonlinear_terminal_v11 +==> scs_arrow_v39 { scs_4M8 } ({scs_4M6',scs_opp_v39 scs_4M6', scs_4M8_02,scs_4M8_13} UNION {scs_stab_diag_v39 scs_4M8 i j| scs_diag 4 i j})`, +[STRIP_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;UNION;IN_ELIM_THM;SET_RULE`a IN {b,c,d,e}<=> a= b\/ a=c\/ a=d\/ a=e`] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + + +ASM_SIMP_TAC[SCS_4M6_IS_SCS]; + +MATCH_MP_TAC(GEN_ALL OPP_IS_SCS) +THEN EXISTS_TAC`scs_opp_v39 scs_4M6'` +THEN ASM_REWRITE_TAC[SCS_4M6_IS_SCS]; + + + +ASM_SIMP_TAC[SCS_4M8_02_IS_SCS]; + +ASM_SIMP_TAC[SCS_4M8_13_IS_SCS]; + + +ASM_SIMP_TAC[STAB_4M8_SCS;K_SCS_4M8]; + + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_4M8 ==> MMs_v39 s = {}) \/ ~((!s. s = scs_4M8 ==> MMs_v39 s = {}))`); + + +ASM_REWRITE_TAC[]; + + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC; + + +MP_TAC(SET_RULE`(!i j. scs_diag 4 i j ==> cstab < dist(v i,v j))\/ ~((!i j. scs_diag 4 i j ==> cstab < dist((v:num->real^3) i,v j)))`) +THEN RESA_TAC; + + +MP_TAC MIN_NOT_STAND_4M8 +THEN RESA_TAC +THEN THAYTHE_TAC 0[`v`]; + + +EXISTS_TAC`scs_4M6'` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MM_4M8_IMP_MM_4M6_23 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[]; + + +EXISTS_TAC`(scs_opp_v39 scs_4M6') ` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MM_4M8_IMP_MM_4M6_01 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[]; + +MP_TAC Bkossge.quad_diag_362 +THEN RESA_TAC +THEN THAYTHE_TAC 0[`v 1`;`v 2`;`v 3`;`v 0`] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN STRIP_TAC; + + +EXISTS_TAC`(scs_4M8_13) ` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MM_4M8_IMP_MM_4M8_13 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[]; + +DICH_TAC 0 +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN STRIP_TAC +THEN EXISTS_TAC`(scs_4M8_02) ` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MM_4M8_IMP_MM_4M8_02 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[]; + + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;REAL_ARITH`~(a b<=a`] +THEN STRIP_TAC +THEN MP_TAC MM_4M8_IMP_STAB_4M8 +THEN RESA_TAC +THEN DICH_TAC 0 +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC +THEN EXISTS_TAC `scs_stab_diag_v39 scs_4M8 i j` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + + +MATCH_MP_TAC(SET_RULE`A==> B\/A`) +THEN EXISTS_TAC`i:num` +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[]; + + +EXISTS_TAC`v':num->real^3` +THEN ASM_REWRITE_TAC[]; + + + +]);; + + + +(****************************) + + + + + + +let SCS_DIAG_SCS_4M8_02_02=prove(`scs_diag (scs_k_v39 scs_4M8_02) 0 2`, +REWRITE_TAC[K_SCS_4M8_02;scs_diag] +THEN ARITH_TAC);; + +let SCS_DIAG_SCS_4M8_02_13=prove(`scs_diag (scs_k_v39 scs_4M8_02) 1 3`, +REWRITE_TAC[K_SCS_4M8_02;scs_diag] +THEN ARITH_TAC);; + +let SCS_DIAG_SCS_4M8_13_13=prove(`scs_diag (scs_k_v39 scs_4M8_13) 1 3`, +REWRITE_TAC[K_SCS_4M8_13;scs_diag] +THEN ARITH_TAC);; + + +let STAB_4M8_02_SCS=prove(` scs_diag (scs_k_v39 scs_4M8_02) i j +==> is_scs_v39 (scs_stab_diag_v39 scs_4M8_02 i j)/\ scs_basic_v39 (scs_stab_diag_v39 scs_4M8_02 i j)`, +STRIP_TAC +THEN MATCH_MP_TAC Yrtafyh.YRTAFYH +THEN ASM_REWRITE_TAC[SCS_K_D_A_STAB_EQ;SCS_4M8_02_IS_SCS;SCS_4M8_02_BASIC;K_SCS_4M8_02; +ARITH_RULE`3<4`;LET_DEF;LET_END_DEF;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;h0;cstab] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC sqrt8_LE_CSTAB +THEN MP_TAC LE_sqrt8_2h0 +THEN REAL_ARITH_TAC);; + + +let STAB_4M8_13_SCS=prove(` scs_diag (scs_k_v39 scs_4M8_13) i j +==> is_scs_v39 (scs_stab_diag_v39 scs_4M8_13 i j)/\ scs_basic_v39 (scs_stab_diag_v39 scs_4M8_13 i j)`, +STRIP_TAC +THEN MATCH_MP_TAC Yrtafyh.YRTAFYH +THEN ASM_REWRITE_TAC[SCS_K_D_A_STAB_EQ;SCS_4M8_13_IS_SCS;SCS_4M8_13_BASIC;K_SCS_4M8_13; +ARITH_RULE`3<4`;LET_DEF;LET_END_DEF;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;h0;cstab] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC sqrt8_LE_CSTAB +THEN MP_TAC LE_sqrt8_2h0 +THEN REAL_ARITH_TAC);; + +let BASIC_HALF_SLICE=prove(`scs_basic_v39 s +==> scs_basic_v39 (scs_half_slice_v39 (s) p q d' F)`, +ASM_SIMP_TAC[scs_half_slice_v39;scs_5M1;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_6I1;scs_basic;unadorned_v39;scs_stab_diag_v39] +THEN SET_TAC[]);; + +let D_HALF_SLICE1=prove(`scs_d_v39 (scs_half_slice_v39 (s) p q d' mkj)=d'`, +SCS_TAC);; + +let J_SCS_3T7_OPP_PROP=prove(`scs_J_v39 (scs_prop_equ_v39 (scs_opp_v39 scs_3T7) i) i1 j= F`, +REWRITE_TAC[scs_opp_v39;peropp2] +THEN SCS_TAC +THEN REWRITE_TAC[scs_opp_v39;peropp2]);; + + +let J_SCS_3T7_OPP=prove(`scs_J_v39 ((scs_opp_v39 scs_3T7) ) i1 j= F`, +REWRITE_TAC[scs_opp_v39;peropp2] +THEN SCS_TAC +THEN REWRITE_TAC[scs_opp_v39;peropp2]);; + + + +let SCS_4M8_02_SLICE_02=prove_by_refinement(`scs_arrow_v39 {scs_4M8_02 } {scs_prop_equ_v39 +( scs_opp_v39 scs_3T7) 2 }`, +[ + +ONCE_REWRITE_TAC[SET_RULE`{scs_prop_equ_v39 +( scs_opp_v39 scs_3T7) 2}={scs_prop_equ_v39 +( scs_opp_v39 scs_3T7) 2, scs_prop_equ_v39 +( scs_opp_v39 scs_3T7) 2 }`] +THEN MATCH_MP_TAC (GEN_ALL Lkgrqui.LKGRQUI) +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4M8_02_13;STAB_4M8_02_SCS;SCS_K_D_A_STAB_EQ;SCS_4M8_02_IS_SCS] +THEN EXISTS_TAC`0` +THEN EXISTS_TAC`2` +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4M8_02_02] +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ] +THEN REPEAT RESA_TAC; + +REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ;scs_slice_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC scs_inj +THEN ASM_SIMP_TAC[SCS_3T7_BASIC;SCS_4M8_02_BASIC;J_SCS_4M8_02;BASIC_HALF_SLICE_STAB;J_SCS_3T7;D_HALF_SLICE;BAISC_PROP_EQU;K_SCS_PROP_EUQ;SCS_3T7_BASIC;J_SCS_3T7_OPP_PROP;BASIC_HALF_SLICE;D_HALF_SLICE1;Cqaoqlr.BASIC_OPP;SCS_3T7_IS_SCS] +THEN STRIP_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T7;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M8_02;scs_opp_v39] +THEN ARITH_TAC; + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T7;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M8_02;scs_opp_v39;peropp2; +ARITH_RULE`(2 + 1 + 4 - 0) MOD 4= 3/\ 0 MOD 4=0/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION;peropp2;] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`2`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`2+x:num`;`2+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T7;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M8_02;scs_opp_v39] +THEN ARITH_TAC; + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T7;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M8_02;peropp2;scs_opp_v39; +ARITH_RULE`(0 + 1 + 4 - 2) MOD 4= 3/\ 2 MOD 4=2/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION;peropp2] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`2`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`2`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`2+x:num`;`2+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +REWRITE_TAC[scs_opp_v39] +THEN SCS_TAC +THEN REAL_ARITH_TAC; + +REWRITE_TAC[scs_opp_v39] +THEN SCS_TAC +THEN REAL_ARITH_TAC; + +REWRITE_TAC[scs_opp_v39] +THEN SCS_TAC +THEN REAL_ARITH_TAC; + +REWRITE_TAC[scs_opp_v39] +THEN SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[J_SCS_3T7_OPP_PROP]; +]);; + + + + + +let SCS_4M8_13_SLICE_13=prove_by_refinement(`scs_arrow_v39 {scs_4M8_13 } {scs_prop_equ_v39 scs_3T7 1}`, +[ +ONCE_REWRITE_TAC[SET_RULE`{scs_prop_equ_v39 +( scs_3T7) 1}={scs_prop_equ_v39 +( scs_3T7) 1, scs_prop_equ_v39 +( scs_3T7) 1 }`] +THEN MATCH_MP_TAC (GEN_ALL Lkgrqui.LKGRQUI) +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4M8_13_13;STAB_4M8_13_SCS;SCS_K_D_A_STAB_EQ;SCS_4M8_13_IS_SCS] +THEN EXISTS_TAC`1` +THEN EXISTS_TAC`3` +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_4M8_13_13] +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ] +THEN REPEAT RESA_TAC; + +REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ;scs_slice_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC scs_inj +THEN ASM_SIMP_TAC[SCS_3T7_BASIC;SCS_4M8_13_BASIC;J_SCS_4M8_13;BASIC_HALF_SLICE_STAB;J_SCS_3T7;D_HALF_SLICE;BAISC_PROP_EQU;K_SCS_PROP_EUQ;SCS_3T7_BASIC;J_SCS_3T7_1;BASIC_HALF_SLICE;D_HALF_SLICE1;Cqaoqlr.BASIC_OPP;SCS_3T7_IS_SCS] +THEN STRIP_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T7;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M8_13;scs_opp_v39] +THEN ARITH_TAC; + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T7;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M8_13;scs_opp_v39;peropp2; +ARITH_RULE`(3 + 1 + 4 - 1) MOD 4= 3/\ 1 MOD 4=1/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION;peropp2;] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`1+x:num`;`1+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M6;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T7;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M8_13;scs_opp_v39] +THEN ARITH_TAC; + +STRIP_TAC +THEN +ASM_REWRITE_TAC[scs_half_slice_v39;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_3T7;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M8_13;peropp2;scs_opp_v39; +ARITH_RULE`(1 + 1 + 4 - 3) MOD 4= 3/\ 3 MOD 4=3/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN SCS_TAC +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION;peropp2] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;PSORT_5_EXPLICIT;Terminal.FUNLIST_EXPLICIT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`1`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`1`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) /\ 2+1=3 +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ ~(0=2)/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Hexagons.PSORT_MOD[`3`;`1+x:num`;`1+x':num`][ARITH_RULE`~(3=0)/\ 2+1=3/\ 4 MOD 3=1`] +THEN SYM_ASSUM_TAC +THEN SCS_TAC; + +REWRITE_TAC[scs_opp_v39] +THEN SCS_TAC +THEN REAL_ARITH_TAC; + +REWRITE_TAC[scs_opp_v39] +THEN SCS_TAC +THEN REAL_ARITH_TAC; + +REWRITE_TAC[scs_opp_v39] +THEN SCS_TAC +THEN REAL_ARITH_TAC; + +REWRITE_TAC[scs_opp_v39] +THEN SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[J_SCS_3T7]; +]);; + + + + + +let SCS_4M8_13_ARROW_3T7=prove(`scs_arrow_v39 {scs_4M8_13 } {scs_3T7 }`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_prop_equ_v39 scs_3T7 1}` +THEN ASM_REWRITE_TAC[SCS_4M8_13_SLICE_13] +THEN MRESAS_TAC PRO_EQU_ID1[`scs_3T7`;`1`;`3`][SCS_3T7_IS_SCS;K_SCS_3T7;ARITH_RULE`(3 - 1 MOD 3)=2`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_3T7 1`;`2`][PROP_EQU_IS_SCS;SCS_3T7_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[]);; + +let K_SCS_OPP_3T7=prove(`scs_k_v39 (scs_opp_v39 scs_3T7) = 3`, +ASM_REWRITE_TAC[scs_opp_v39;scs_prop_equ_v39] +THEN SCS_TAC);; + +let SCS_3T7_OPP_IS_SCS=prove(`is_scs_v39 (scs_opp_v39 scs_3T7)`, +MATCH_MP_TAC(GEN_ALL OPP_IS_SCS) +THEN EXISTS_TAC`scs_opp_v39 scs_3T7` +THEN ASM_REWRITE_TAC[SCS_3T7_IS_SCS]);; + + + +let SCS_4M8_13_ARROW_3T7_OPP=prove(`scs_arrow_v39 {scs_4M8_02 } {scs_opp_v39 scs_3T7}`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_prop_equ_v39 +( scs_opp_v39 scs_3T7) 2}` +THEN ASM_REWRITE_TAC[SCS_4M8_02_SLICE_02] +THEN MRESAS_TAC PRO_EQU_ID1[`scs_opp_v39 scs_3T7`;`2`;`3`][SCS_3T7_IS_SCS;K_SCS_3T7;ARITH_RULE`(3 - 2 MOD 3)=1`;K_SCS_OPP_3T7;SCS_3T7_OPP_IS_SCS] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 (scs_opp_v39 scs_3T7) 2`;`1`][PROP_EQU_IS_SCS;SCS_3T7_IS_SCS;K_SCS_OPP_3T7;SCS_3T7_OPP_IS_SCS] +THEN DICH_TAC 0 +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[] +THEN STRIP_TAC +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_opp_v39 scs_3T7}` +THEN ASM_REWRITE_TAC[] +THEN ASSUME_TAC SCS_3T7_IS_SCS +THEN MRESA_TAC Yxionxl2.SCS_OPP_REFL[`scs_3T7`] +THEN MRESAS_TAC YXIONXL2[`3`;`scs_opp_v39 scs_3T7`][K_SCS_OPP_3T7;SCS_3T7_OPP_IS_SCS;ARITH_RULE`~(4<=3)`]);; + + + +let PROP_OPP_4M8_13= prove_by_refinement( +`scs_4M8_13= scs_prop_equ_v39(scs_opp_v39 (scs_4M8_02)) 2 `, +[REWRITE_TAC[scs_prop_equ_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39;SCS_K_D_A_STAB_EQ;scs_opp_v39;scs_4M8_13;scs_4M8_02] +THEN MATCH_MP_TAC scs_inj +THEN SIMP_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;SCS_4M8_BASIC;STAB_4M8_SCS;SCS_DIAG_SCS_4M8_13;scs_basic;unadorned_v39;peropp;peropp2] +THEN SCS_TAC +THEN STRIP_TAC; + +SET_TAC[]; + +STRIP_TAC +THEN ASM_REWRITE_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_5M3;mk_unadorned_v39;peropp;peropp2;FUN_EQ_THM;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN REPEAT GEN_TAC +THEN ASSUME_TAC (ARITH_RULE`~(4=0)`) +THEN MRESA_TAC PSORT_MOD[`4`;`x`;`x'`] +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`2`;`x`;`4`] +THEN MRESA_TAC MOD_ADD_MOD[`2`;`x'`;`4`] +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`x MOD 4<4==> x MOD 4=0\/ x MOD 4=1\/ x MOD 4=2\/ x MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 4<4==> x' MOD 4=0\/ x' MOD 4=1\/ x' MOD 4=2\/ x' MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[Uxckfpe.ARITH_4_TAC;PSORT_5_EXPLICIT;ARITH_RULE`4-1=3/\ 4-2=2/\ 4-3=1/\ 4-4=0/\ 5-5=0/\ 2+0=2/\ 2+1=3/\ 2+2=4/\ 2+3=5/\2+4=6 +/\ 3+0=3/\ 3+1=4/\ 3+2=5/\ 3+3=6/\ 3+4=7/\ 7 MOD 5=2`;PAIR_EQ;Terminal.FUNLIST_EXPLICIT;]]);; + + + + +let SCS_4M8_02_ARROW_4M8_13=prove( +`scs_arrow_v39 {scs_4M8_02}{scs_4M8_13}`, +ASM_SIMP_TAC[PROP_OPP_4M8_13] +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_opp_v39 (scs_4M8_02)}` +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC (GEN_ALL YXIONXL2) +THEN EXISTS_TAC`4` +THEN ASM_SIMP_TAC[SCS_K_D_A_STAB_EQ;ARITH_RULE`~(4<=3)`;K_SCS_4M8_02;STAB_4M8_SCS;SCS_DIAG_SCS_4M8_02;SCS_4M8_02_IS_SCS]; + +MATCH_MP_TAC(GEN_ALL YXIONXL3) +THEN MATCH_MP_TAC (GEN_ALL OPP_IS_SCS) +THEN EXISTS_TAC`scs_opp_v39 ( scs_4M8_02)` +THEN ASM_SIMP_TAC[SCS_K_D_A_STAB_EQ;ARITH_RULE`~(4<=3)`;K_SCS_4M8;STAB_4M8_SCS;SCS_DIAG_SCS_4M8_02;SCS_4M8_02_IS_SCS];]);; + + + +let SCS_4M8_02_ARROW_3T7 =prove(`scs_arrow_v39 { scs_4M8_02 } { scs_3T7 }`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_4M8_13}` +THEN ASM_SIMP_TAC[SCS_4M8_02_ARROW_4M8_13;SCS_4M8_13_ARROW_3T7]);; + + +(************************************) + +let MIQMCSN=prove(`main_nonlinear_terminal_v11 +==> scs_arrow_v39 { scs_4M8 } ({scs_4M6',scs_3T7,scs_3T4})`, +STRIP_TAC +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`({scs_4M6',scs_opp_v39 scs_4M6', scs_4M8_02,scs_4M8_13} UNION {scs_stab_diag_v39 scs_4M8 i j| scs_diag 4 i j})` +THEN ASM_SIMP_TAC[SCS_4M8_ARROW_STEP_ONE;SET_RULE`{scs_4M6', scs_3T7, scs_3T4}={scs_4M6', scs_3T7}UNION{ scs_3T4}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_REWRITE_TAC[SET_STAB_4M8_ARROW_3T4;] +THEN ONCE_REWRITE_TAC[SET_RULE`{scs_4M6', scs_3T7}={scs_4M6',scs_4M6', scs_3T7,scs_3T7}`] +THEN ASM_REWRITE_TAC[SET_RULE` {A,B,C,D}=({A,B,C}) UNION {D}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_REWRITE_TAC[SCS_4M8_13_ARROW_3T7;SET_RULE` {A,B,D}=({A,B}) UNION {D}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_REWRITE_TAC[SCS_4M8_02_ARROW_3T7;SET_RULE` {A,D}=({A}) UNION {D}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[SCS_4M6_IS_SCS]; + +ASSUME_TAC(SCS_4M6_IS_SCS) +THEN ASSUME_TAC K_SCS_OPP_4M6 +THEN ASSUME_TAC SCS_4M6_OPP_IS_SCS +THEN MRESA_TAC Yxionxl2.SCS_OPP_REFL[`scs_4M6'`] +THEN MRESAL_TAC YXIONXL2[`4`;`scs_opp_v39 scs_4M6'`][ARITH_RULE`~(4<=3)`]]);; + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/MTUWLUN.hl b/text_formalization/local/MTUWLUN.hl new file mode 100755 index 0000000..812f6c9 --- /dev/null +++ b/text_formalization/local/MTUWLUN.hl @@ -0,0 +1,4909 @@ + +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + + + +module Mtuwlun = struct + + + +open Polyhedron;; +open Sphere;; +open Fan_defs;; +open Hypermap;; +open Vol1;; +open Fan;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Sphere;; +open Hypermap;; +open Fan;; +open Topology;; +open Prove_by_refinement;; +open Pack_defs;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; + + +let IS_SY = new_definition`IS_SY (s:stable_sy) p q={x| ?n m. n I_SY s1= IS_SY s p q /\ I_SY s2= IS_SY s q p +/\ f_sy s1= fl_sy s p q /\ f_sy s2= fl_sy s q p`;; + +let COVER2_SY=new_definition`COVER2_SY (s:stable_sy) (s1:stable_sy) (s2:stable_sy) <=> d_sy s <= d_sy s1 + d_sy s2 `;; + + +let COVER3_SY=new_definition`COVER3_SY p q (s:stable_sy) (s1:stable_sy) (s2:stable_sy) <=> J_SY s1 SUBSET J_SY s UNION {{p,q}}/\ +J_SY s2 SUBSET J_SY s UNION {{p,q}}`;; + +let COVER4_SY=new_definition`COVER4_SY p q (s:stable_sy) (s1:stable_sy) (s2:stable_sy) <=> +(!i j. ~({i,j }={p,q}) /\ i IN I_SY s1 /\ j IN I_SY s1 +==> a_sy s1 (i,j)=a_sy s (i,j)/\ b_sy s1 (i,j)=b_sy s (i,j)) +/\ +(!i j. ~({i,j }={p,q}) /\ i IN I_SY s2 /\ j IN I_SY s2 +==> a_sy s2 (i,j)=a_sy s (i,j)/\ b_sy s2 (i,j)=b_sy s (i,j))`;; + + +let COVER5_SY=new_definition`COVER5_SY p q (s:stable_sy) (s1:stable_sy) (s2:stable_sy) <=> +a_sy s1 (p,q)<= a_sy s (p,q)/\ a_sy s2 (p,q)<= a_sy s (p,q)/\ a_sy s (p,q)<=b_sy s1 (p,q) +/\ a_sy s (p,q)<=b_sy s2 (p,q)`;; + +let COVER6_SY=new_definition`COVER6_SY p q (s:stable_sy) (s1:stable_sy) (s2:stable_sy) <=> +(({p,q} IN J_SY s1 <=> {p,q} IN J_SY s2 ) +/\ ({p,q} IN J_SY s1 <=> ear_sy s1 \/ ear_sy s2))`;; + +let COVER_SY=new_definition`COVER_SY p q (s:stable_sy) (s1:stable_sy) (s2:stable_sy) <=> COVER1_SY p q (s:stable_sy) (s1:stable_sy) (s2:stable_sy) +/\ COVER2_SY (s:stable_sy) (s1:stable_sy) (s2:stable_sy) +/\ COVER3_SY p q (s:stable_sy) (s1:stable_sy) (s2:stable_sy) +/\ COVER4_SY p q (s:stable_sy) (s1:stable_sy) (s2:stable_sy) +/\ COVER5_SY p q (s:stable_sy) (s1:stable_sy) (s2:stable_sy) +/\ COVER6_SY p q (s:stable_sy) (s1:stable_sy) (s2:stable_sy)`;; + + + +let pmat1=new_definition`pmat1 (A:real^N^M)= (lambda i j. if i< dimindex(:P) then A$i$j else A$ dimindex(:M)$j):real^N^P`;; + + +let pmat2=new_definition`pmat2 (A:real^N^M)= (lambda i j. A$(dimindex(:M)- dimindex(:P)+i)$j):real^N^P`;; + + +let DIA_SY=new_definition`DIA_SY p q (s:stable_sy) <=> ~(p=q) /\ p IN I_SY(s) /\ q IN I_SY s /\ ~(?i. i IN I_SY s /\ {p,q}= {i, f_sy s i})`;; + + + + + + +let CARD_I_SY_LT_3=prove(` +DIA_SY p q s +==> 3< CARD (I_SY s)`, +MRESA1_TAC stable_sy_lemma`s:stable_sy` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[stable_system;constraint_system;torsor; +HAS_SIZE;] +THEN REWRITE_TAC[DIA_SY] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(ARITH_RULE`3<= A /\ ~(A=3) ==> 3< A`) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC MONO_NOT +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;ARITH_RULE`~(3<3)`]) +THEN STRIP_TAC +THEN STRIP_TAC +THEN DISCH_THEN(LABEL_TAC"THY1") +THEN DISCH_THEN(LABEL_TAC"THY2") +THEN DISCH_THEN(LABEL_TAC"THY3") +THEN DISCH_THEN(LABEL_TAC"THY4") +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN"THY1" (fun th-> MRESA1_TAC th`p:num` THEN MRESA1_TAC th`f_sy (s:stable_sy) (p:num)`) +THEN REMOVE_THEN"THY3" (fun th-> MRESAL_TAC th[`SUC 0`;`p:num`][ARITH_RULE`0 {p, f_sy s p, f_sy s (f_sy s p)} SUBSET I_SY s `) +THEN RESA_TAC +THEN MRESA_TAC CARD_SUBSET_EQ[`{p, f_sy (s:stable_sy) p, f_sy s (f_sy s p)}`;`I_SY (s:stable_sy)`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[SET_RULE`A IN{B,C,D}<=> A= B \/ A=C\/ A=D`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THENL[EXISTS_TAC`p:num` +THEN ASM_REWRITE_TAC[]; +EXISTS_TAC`f_sy s (f_sy (s:stable_sy)p)` +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN"THY4" (fun th-> MRESA1_TAC th`p:num`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`3=SUC(SUC(SUC 0))`;POWER;o_DEF;I_DEF] +THEN RESA_TAC +THEN SET_TAC[]]);; + +let COVER_NOT_EAR_SY=prove(`!(s:stable_sy). +DIA_SY p q s +==> ~(ear_sy s)`, +REWRITE_TAC[ear_sy;] +THEN GEN_TAC THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL CARD_I_SY_LT_3)[`p:num`;`q:num`;`s:stable_sy`] +THEN REWRITE_TAC[DE_MORGAN_THM] +THEN MP_TAC(ARITH_RULE`3 < CARD (I_SY s) ==> ~(CARD (I_SY (s:stable_sy))= 3)`) +THEN RESA_TAC);; + +let DIAGONAL_SY=prove(`DIA_SY p q s +==> ~({p,q} IN J_SY s) `, +MRESA1_TAC stable_sy_lemma`s:stable_sy` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[stable_system;constraint_system;DIA_SY] +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`J_SY s SUBSET {{i, f_sy s i} | i | i IN I_SY (s:stable_sy)} +/\ {p, q} IN J_SY s +==> {p, q} IN {{i, f_sy s i} | i | i IN I_SY (s:stable_sy)}`) +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC);; + +let SCHANGE= new_definition`SCHANGE (f:num->num) (s:stable_sy) (s1:stable_sy)<=> +k_sy s= k_sy s1 +/\ d_sy s= d_sy s1 +/\ (I_SY s)=IMAGE f (I_SY s1) +/\ (!p q. {f p, f q} IN J_SY s<=> {p,q} IN J_SY s1) +/\ (!p q. a_sy s (f p, f q)=a_sy s1 (p,q)) +/\ (!p q. b_sy s (f p, f q)=b_sy s1 (p,q)) +/\ f_sy s1 =(f_sy s) o f +`;; + + + +let IK_SY=prove(`1<= p/\ I_SY s= 0..(p-1) ==> k_sy (s:stable_sy)= p`, +STRIP_TAC +THEN MP_TAC(ARITH_RULE`1<= p ==> (p - 1 + 1)-0 = p`) +THEN RESA_TAC +THEN MRESA1_TAC stable_sy_lemma`s:stable_sy` +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[stable_system;constraint_system;torsor;HAS_SIZE;CARD_NUMSEG;] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[]);; + + +let K_SY_LE2=prove(`2< k_sy (s:stable_sy)`, +MRESA1_TAC stable_sy_lemma`s:stable_sy` +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[stable_system;constraint_system;torsor;HAS_SIZE;CARD_NUMSEG;] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN STRIP_TAC +THEN REPEAT(STRIP_TAC THEN REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC);; + +let IN_J_IMP_IN_J1_SY=prove(` k_sy s1=p +/\ I_SY s1= 0..p-1 +/\ f_sy s1=(\i. ((1+i):num MOD p)) +/\ {0, p - 1} IN J_SY s1 +==> p-1,p IN J1_SY (s1:stable_sy)`, +REPEAT STRIP_TAC +THEN MRESA1_TAC (GEN_ALL K_SY_LE2)`s1:stable_sy` +THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM] +THEN MP_TAC(ARITH_RULE`2

SUC(p-1)= p/\1<= p-1 /\ p-1<=p /\ p-1< p /\ ~(p=0) /\ 1+p-1=p`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`] +THEN MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p`] +THEN EXISTS_TAC`p-1:num` +THEN ASM_REWRITE_TAC[IN_NUMSEG] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]);; + + + +let D_FUN_COVER_SY=prove_by_refinement(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) +(l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). +dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p +/\ 1<= k-p +/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) +/\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) +/\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) +/\ (ear_sy s2 <=> ear_sy s3) +/\ DIA_SY 0 (p-1) s +/\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 +/\ COVER_SY 0 (p-1) s s1 s2 +/\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) +/\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} +==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) +/\ matvec(pmat1(vecmats l))= l1 +/\ matvec(pmat2(vecmats l))= l2 +==> d_fun(s,l) <= d_fun(s1,l1) + d_fun(s3,l2)`, +[REPEAT STRIP_TAC +THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` +THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) +/\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p `) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL IK_SY)[`s:stable_sy`;`k:num`] +THEN MRESA_TAC (GEN_ALL IK_SY)[`s1:stable_sy`;`p:num`] +THEN MRESA_TAC (GEN_ALL IK_SY)[`s3:stable_sy`;`k-p+2:num`] +THEN MRESA1_TAC (GEN_ALL K_SY_LE2)`s:stable_sy` +THEN MRESA1_TAC (GEN_ALL K_SY_LE2)`s1:stable_sy` +THEN MRESA_TAC (GEN_ALL COVER_NOT_EAR_SY)[`0`;`p-1`;`s:stable_sy`] +THEN MRESA1_TAC sigma_sy`s:stable_sy` +THEN MRESA_TAC (GEN_ALL DIAGONAL_SY)[`0:num`;`p-1`;`s:stable_sy`] +THEN DISJ_CASES_TAC(SET_RULE`{0,p-1} IN J_SY (s1:stable_sy)\/ ~({0,p-1} IN J_SY (s1:stable_sy))`); +FIND_ASSUM MP_TAC `COVER_SY 0 (p - 1) s s1 (s2:stable_sy)` +THEN REWRITE_TAC[COVER_SY;COVER3_SY;COVER6_SY] +THEN RESA_TAC; +ASM_REWRITE_TAC[d_fun] +THEN MRESA1_TAC sigma_sy`s1:stable_sy` +THEN FIND_ASSUM MP_TAC`SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 (s3:stable_sy)` +THEN REWRITE_TAC[SCHANGE] +THEN RESA_TAC +THEN SUBGOAL_THEN`{0,1} IN J_SY (s3:stable_sy)`ASSUME_TAC; +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`0`;`1`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`A+0=A/\ ~(1=0)`]) +THEN MP_TAC(ARITH_RULE`2

p-2+1 =p-1`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`]; +MRESA_TAC (GEN_ALL IN_J_IMP_IN_J1_SY)[`p:num`;`s1:stable_sy`] +THEN SUBGOAL_THEN`(k-p+2,1) IN J1_SY (s3:stable_sy)`ASSUME_TAC; +REWRITE_TAC[J1_SY;IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN ASM_REWRITE_TAC[IN_NUMSEG] +THEN STRIP_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`k-p+2` +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p/\1+0=1/\ SUC 0=1 /\ k - p + 2 <= k - p + 2`] +THEN MRESA_TAC MOD_LT[`1:num`;`k-p+2:num`]; +MRESAL_TAC SUM_DELETE[`(\x. cstab - norm (row (FST x) (vecmats l1) - row (SND x) (vecmats (l1:real^(P,3)finite_product))))`;`J1_SY (s1:stable_sy)`;`p-1,p`][FINITE_J1_SY;REAL_ARITH`A=B-C<=> B=A+C`] +THEN MRESAL_TAC SUM_DELETE[`(\x. cstab - norm (row (FST x) (vecmats l2) - row (SND x) (vecmats (l2:real^(N,3)finite_product))))`;`J1_SY (s3:stable_sy)`;`k-p+2,1`][FINITE_J1_SY;REAL_ARITH`A=B-C<=> B=A+C`] +THEN SUBGOAL_THEN`J1_SY s1 DELETE (p-1,p) DELETE (p,1) SUBSET J1_SY (s:stable_sy)` ASSUME_TAC; +ASM_REWRITE_TAC[SUBSET;J1_SY;IN_ELIM_THM;DELETE;IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PAIR_EQ;] +THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i< p:num`) +THEN RESA_TAC; +MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p /\ SUC 0=1`]; +MP_TAC(ARITH_RULE`i

i=p-1 \/ i< p-1:num`) +THEN RESA_TAC; +MP_TAC(ARITH_RULE`2

SUC(p-1)=p /\ p-1 i< k /\ i<=k:num /\ 1+i ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN MRESA_TAC MOD_LT[`1+i:num`;`k:num`] +THEN MRESA_TAC MOD_LT[`1+i:num`;`p:num`] +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[SYM th] ) +THEN FIND_ASSUM MP_TAC`J_SY s1 SUBSET J_SY (s:stable_sy) UNION {{0, p - 1}}` +THEN REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`{i,(1+i) MOD p}`) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC MOD_LT[`1+i:num`;`p:num`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`{i, 1 + i} = {0, p - 1} /\ ~(i=1+i) /\ ~(i=p-1) ==> i=0 /\ 1+i= p-1`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+0=p-1<=> p=2`]; +SUBGOAL_THEN`IMAGE (\(x,y). (p - 2 + x), (p - 2 + y)) (J1_SY s3 DELETE (k-p+2,1)) SUBSET J1_SY (s:stable_sy)` ASSUME_TAC; +ASM_REWRITE_TAC[J1_SY;IMAGE;DELETE;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PAIR_EQ;] +THEN MP_TAC(ARITH_RULE`i<=k-p+2 ==> i=k-p+2 \/ i< k-p+2:num`) +THEN RESA_TAC; +MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p /\ SUC 0=1`]; +MP_TAC(ARITH_RULE`i i=k-p+1 \/ i< k-p+1:num`) +THEN RESA_TAC; +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN RESA_TAC +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`2

p-2+k-p+1=k-1/\ SUC(k-p+1)=k-p+2 /\ k-p+1 REWRITE_TAC[SYM th])`(\i. (1 + i) MOD (k - p + 2)) = + f_sy (s2:stable_sy) o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)` +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p /\ SUC 0=1`] +THEN STRIP_TAC +THEN FIND_ASSUM (fun th-> MP_TAC( ISPECL [`k-p+1`;`0`]th))`!p' q. + {(if p' = 0 then 0 else (p - 2 + p') MOD k), (if q = 0 + then 0 + else (p - 2 + q) MOD + k)} IN + J_SY s2 <=> + {p', q} IN J_SY (s3:stable_sy)` +THEN POP_ASSUM (fun th-> REWRITE_TAC[th;ARITH_RULE`0=0`]) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`J_SY s2 SUBSET J_SY (s:stable_sy) UNION {{0, p - 1}}` +THEN REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`{k-1,0}`); +POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<=k-p /\2 ~(k-1=p-1) /\ ~(0= p-1)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(k-1=p-1) /\ ~(0= p-1)==> ~(p-1 IN {k-1,0})`) +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]; +STRIP_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`p-2+i:num` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`i p-2+i< k/\ p-2+i<=k /\ 1<=p-2+i/\ 1+p-2+i ~(i=0)/\ ~(1+i=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`1+i:num`;`k-p+2:num`] +THEN MRESA_TAC MOD_LT[`i:num`;`k-p+2:num`] +THEN REWRITE_TAC[ARITH_RULE`SUC (p - 2 + i)= p - 2 + SUC i`] +THEN MRESA_TAC MOD_LT[`1+p-2+i:num`;`k:num`] +THEN FIND_ASSUM (fun th-> MP_TAC( ISPECL [`i MOD (k - p + 2)`;`(f_sy (s2:stable_sy) o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)) + (i MOD (k - p + 2))`] th))`!p' q. + {(if p' = 0 then 0 else (p - 2 + p') MOD k), (if q = 0 + then 0 + else (p - 2 + q) MOD + k)} IN + J_SY s2 <=> + {p', q} IN J_SY (s3:stable_sy)` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`{i MOD (k - p + 2), (f_sy s2 o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)) + (i MOD (k - p + 2))} IN + J_SY (s3:stable_sy)` +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`(\i. (1 + i) MOD (k - p + 2)) = + f_sy (s2:stable_sy) o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`J_SY s2 SUBSET J_SY (s:stable_sy) UNION {{0, p - 1}}` +THEN REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`{p-2+i,p-2+1+i}`); +ASM_REWRITE_TAC[ARITH_RULE`1+p-2+i= p-2+1+i`]; +MP_TAC(SET_RULE`{p - 2 + i, p - 2 + 1 + i} = {0, p - 1} ==> (p-2+i=0) \/ (p-2+1+i=0)`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`1<=i /\ 2< p==> ~(p-2+i=0) /\ ~(p-2+1+i=0)`) +THEN ASM_REWRITE_TAC[]; +MRESAL_TAC FINITE_DELETE_IMP[`J1_SY (s1:stable_sy)`;`p-1,p`][FINITE_J1_SY] +THEN MRESAL_TAC FINITE_DELETE_IMP[`J1_SY (s3:stable_sy)`;`k-p+2,1`][FINITE_J1_SY] +THEN DISJ_CASES_TAC(SET_RULE`ear_sy s3 \/ ~(ear_sy (s3:stable_sy))`); +ASM_REWRITE_TAC[sigma_sy] +THEN MATCH_MP_TAC(REAL_ARITH` +d_sy s <= + d_sy s1 + + d_sy s3 +/\ +&0<= sum (J1_SY s) + (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats l))) +/\ +&0<= sum (J1_SY s1 DELETE (p - 1,p)) + (\x. cstab - norm (row (FST x) (vecmats l1) - row (SND x) (vecmats l1))) +/\ &0<= cstab - norm (row (p - 1) (vecmats l1) - row p (vecmats l1)) +/\ +&0<= + sum (J1_SY s3 DELETE (k - p + 2,1)) + (\x. cstab - norm (row (FST x) (vecmats l2) - row (SND x) (vecmats l2))) +/\ &0<= cstab - norm (row (k - p + 2) (vecmats l2) - row 1 (vecmats l2)) +==> +d_sy s + + #0.1 * + -- &1 * + sum (J1_SY s) + (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats l))) <= + (d_sy s1 + + #0.1 * + &1 * + (sum (J1_SY s1 DELETE (p - 1,p)) + (\x. cstab - norm (row (FST x) (vecmats l1) - row (SND x) (vecmats l1))) + + cstab - norm (row (p - 1) (vecmats l1) - row p (vecmats l1)))) + + d_sy s3 + + #0.1 * + &1 * + (sum (J1_SY (s3:stable_sy) DELETE (k - p + 2,1)) + (\x. cstab - norm (row (FST x) (vecmats l2) - row (SND x) (vecmats l2))) + + cstab - norm (row (k - p + 2) (vecmats l2) - row 1 (vecmats l2)))`) +THEN RESA_TAC; +FIND_ASSUM MP_TAC `COVER2_SY s s1 (s2:stable_sy)` +THEN REWRITE_TAC[COVER2_SY] +THEN RESA_TAC; +STRIP_TAC; +MATCH_MP_TAC SUM_POS_LE +THEN REWRITE_TAC[FINITE_J1_SY] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL B_SY_LE_CSTAB)[`i:num`;`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`;] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC; +MATCH_MP_TAC SUM_POS_LE +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`x=p:num,1 \/ ~(x=p:num,1 )`); +ASM_REWRITE_TAC[] +THEN EXPAND_TAC"l1" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN SUBGOAL_THEN`1<= p/\ p<= dimindex(:P)==> row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p 1<=1 /\ 1

x IN J1_SY (s:stable_sy)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN DISCH_THEN(LABEL_TAC"THY1") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"THY" MP_TAC +THEN REWRITE_TAC[J1_SY;DELETE;IN_ELIM_THM;IN_NUMSEG] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN"THY1" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`i<=p==> i=p \/ i i=p -1 \/ SUC i p-1< p /\ SUC (p-1)=p`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`]; +RESA_TAC +THEN RESA_TAC +THEN EXPAND_TAC"l1" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN MRESA_TAC MOD_LT[`i:num`;`p:num`] +THEN SUBGOAL_THEN`row i ((pmat1 (vecmats l)):real^3^P) = row i (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (SUC i) ((pmat1 (vecmats l)):real^3^P) = row (SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`SUC i < p==> 1<= SUC i /\ SUC i <= p`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`SUC i < p /\ 1<=k-p ==> i <= k/\ i row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p p-1 <= p /\ 1<= p-1/\ p-1 MP_TAC(ISPECL [`p-1`;`k:num`] th) )`!i j. + {i MOD k, j MOD k} IN J_SY s UNION {{0, p - 1}} + ==> norm (row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))) <= cstab` +THEN REWRITE_TAC[IN_ELIM_THM;UNION;IN_SING] +THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`;SET_RULE`{p-1,0}={0,p-1}`] +THEN REAL_ARITH_TAC; +STRIP_TAC; +MATCH_MP_TAC SUM_POS_LE +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`x=k-p+1,k-p+2 \/ ~(x=k-p+1,k-p+2 )`); +ASM_REWRITE_TAC[] +THEN EXPAND_TAC"l2" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN SUBGOAL_THEN`row (k-p+1) ((pmat2 (vecmats l)):real^3^N) = row (k-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+1<=k-p+2 /\ 1<= k-p+1 /\ k - (k - p + 2) + k - p + 1= k-1`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (k-p+2) ((pmat2 (vecmats l)):real^3^N) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+2<=k-p+2 /\ 1<= k-p+2 /\ k - (k - p + 2) + k - p + 2= k`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE` 2 1<=k-1 /\ k-1<= k /\ SUC (k - 1)= k /\ k-1 i=k-p+2 \/ i i=k-p +1 \/ i< k-p+1:num`) +THEN RESA_TAC; +MP_TAC(ARITH_RULE`2

k-p+1< k-p+2 /\ SUC (k-p+1)=k-p+2`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`k-p+1:num`;`k-p+2:num`]; +RESA_TAC +THEN RESA_TAC +THEN EXPAND_TAC"l2" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN MRESA_TAC MOD_LT[`i:num`;`k-p+2:num`] +THEN SUBGOAL_THEN`row i ((pmat2 (vecmats l)):real^3^N) = row (p-2+i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + i= p-2+i`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (SUC i) ((pmat2 (vecmats l)):real^3^N) = row (p-2+ SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + SUC i= p-2+SUC i/\ 1<= SUC i /\ SUC i<= k-p+2`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE` i< k-p+1 /\ 2< p /\ 1<= k-p ==> 1<=p-2+i /\ p-2+i <= k /\ SUC (p-2+i)= p-2+ SUC i /\ p-2+i k-p+2<=k-p+2 /\ 1<= k-p+2 /\ k - (k - p + 2) + k - p + 2= k`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row 1 ((pmat2 (vecmats l)):real^3^N) = row (p-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + 1= p-1/\ 1<=1 /\ 1<=k-p+2`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +EXPAND_TAC"l2" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM (fun th-> MP_TAC(ISPECL [`k:num`;`p-1:num`] th) )`!i j. + {i MOD k, j MOD k} IN J_SY s UNION {{0, p - 1}} + ==> norm (row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))) <= cstab` +THEN REWRITE_TAC[IN_ELIM_THM;UNION;IN_SING] +THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`;SET_RULE`{p-1,0}={0,p-1}`] +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[sigma_sy] +THEN SUBGOAL_THEN `cstab - norm (row (p - 1) (vecmats (l1:real^(P,3)finite_product)) - row p (vecmats l1)) =cstab - norm (row (k-p + 2) (vecmats (l2:real^(N,3)finite_product)) - row 1 (vecmats l2))` ASSUME_TAC; +REWRITE_TAC[REAL_ARITH`A-B=A-C<=> B=C`] +THEN EXPAND_TAC"l1" +THEN EXPAND_TAC"l2" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN SUBGOAL_THEN`row 1 ((pmat2 (vecmats l)):real^3^N) = row (p-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + 1= p-1/\ 1<=1 /\ 1<=k-p+2`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (k-p+2) ((pmat2 (vecmats l)):real^3^N) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+2<=k-p+2 /\ 1<= k-p+2 /\ k - (k - p + 2) + k - p + 2= k`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (p-1) ((pmat1 (vecmats l)):real^3^P) = row (p-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`2< p ==> p-1 <= p /\ 1<= p-1/\ p-1 row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p x = y)`ASSUME_TAC; +REWRITE_TAC[J1_SY;DELETE;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PAIR_EQ;ARITH_RULE`p-2+B=p-2+C<=> B=C`]; +SUBGOAL_THEN`!x. x IN (J1_SY (s3:stable_sy) DELETE (k - p + 2,1)) +==> + ((\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l))) o + (\(x,y). p - 2 + x,p - 2 + y)) x += (\x. cstab - norm (row (FST x) (vecmats (l2:real^(N,3)finite_product)) - row (SND x) (vecmats l2))) x` +ASSUME_TAC; +ASM_REWRITE_TAC[J1_SY;DELETE;IN_ELIM_THM;o_DEF;IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=> B=C`] +THEN EXPAND_TAC"l2" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`i<=k-p+2==> i=k-p+2 \/ i k - (k - p + 2) + i= p-2+i`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (SUC i) ((pmat2 (vecmats l)):real^3^N) = row (p-2+ SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + SUC i= p-2+SUC i/\ 1<= SUC i /\ SUC i<= k-p+2`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[]; +MRESA_TAC SUM_EQ[` ((\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l))) o + (\(x,y). p - 2 + x,p - 2 + y))`;`(\x. cstab - norm (row (FST x) (vecmats (l2:real^(N,3)finite_product)) - row (SND x) (vecmats l2)))`;`(J1_SY (s3:stable_sy) DELETE (k - p + 2,1))`] +THEN +MRESA_TAC SUM_IMAGE[`(\(x,y). p - 2 + x,p - 2 + y)`;`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`J1_SY (s3:stable_sy) DELETE (k - p + 2,1)`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC SUM_DIFF[`(\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l)))`;`J1_SY(s:stable_sy)`;`(IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY (s3:stable_sy) DELETE (k - p + 2,1)))`][FINITE_J1_SY] +THEN MATCH_MP_TAC(REAL_ARITH` +d_sy s <= d_sy s1+ d_sy s3 +/\ &0<= sum (J1_SY s1 DELETE (p - 1,p)) + (\x. cstab - norm (row (FST x) (vecmats l1) - row (SND x) (vecmats l1))) +/\ &0<= +sum (J1_SY s) + (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats l))) +- sum (IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1))) + (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats l))) +==> +d_sy s + + #0.1 * + -- &1 * + sum (J1_SY (s:stable_sy)) + (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats l))) <= + (d_sy s1 + + #0.1 * + &1 * + (sum (J1_SY s1 DELETE (p - 1,p)) + (\x. cstab - norm (row (FST x) (vecmats (l1:real^(P,3)finite_product)) - row (SND x) (vecmats l1))) + + cstab - norm (row (k - p + 2) (vecmats l2) - row 1 (vecmats l2)))) + + d_sy s3 + + #0.1 * + -- &1 * + (sum (IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1))) + (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product)))) + + cstab - norm (row (k - p + 2) (vecmats (l2:real^(N,3)finite_product)) - row 1 (vecmats l2)))`) +THEN RESA_TAC; +FIND_ASSUM MP_TAC `COVER2_SY s s1 (s2:stable_sy)` +THEN REWRITE_TAC[COVER2_SY] +THEN RESA_TAC; +STRIP_TAC; +MATCH_MP_TAC SUM_POS_LE +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`x=p:num,1 \/ ~(x=p:num,1 )`); +ASM_REWRITE_TAC[] +THEN EXPAND_TAC"l1" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN SUBGOAL_THEN`1<= p/\ p<= dimindex(:P)==> row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p 1<=1 /\ 1

x IN J1_SY (s:stable_sy)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN DISCH_THEN(LABEL_TAC"THY1") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"THY" MP_TAC +THEN REWRITE_TAC[J1_SY;DELETE;IN_ELIM_THM;IN_NUMSEG] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN"THY1" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`i<=p==> i=p \/ i i=p -1 \/ SUC i p-1< p /\ SUC (p-1)=p`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`]; +RESA_TAC +THEN RESA_TAC +THEN EXPAND_TAC"l1" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN MRESA_TAC MOD_LT[`i:num`;`p:num`] +THEN SUBGOAL_THEN`row i ((pmat1 (vecmats l)):real^3^P) = row i (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (SUC i) ((pmat1 (vecmats l)):real^3^P) = row (SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`SUC i < p==> 1<= SUC i /\ SUC i <= p`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`SUC i < p /\ 1<=k-p ==> i <= k/\ i REWRITE_TAC[SYM th]) +THEN MATCH_MP_TAC SUM_POS_LE +THEN STRIP_TAC; +MATCH_MP_TAC FINITE_DIFF +THEN REWRITE_TAC[FINITE_J1_SY]; +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG;DIFF] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC (GEN_ALL B_SY_LE_CSTAB)[`i:num`;`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`;] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[d_fun] +THEN MRESA1_TAC sigma_sy`s3:stable_sy` +THEN FIND_ASSUM MP_TAC`SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 (s3:stable_sy)` +THEN REWRITE_TAC[SCHANGE] +THEN RESA_TAC +THEN SUBGOAL_THEN`{0,1} IN J_SY (s3:stable_sy)`ASSUME_TAC; +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`0`;`1`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`A+0=A/\ ~(1=0)`]) +THEN MP_TAC(ARITH_RULE`2

p-2+1 =p-1`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`]; +MRESA_TAC (GEN_ALL IN_J_IMP_IN_J1_SY)[`p:num`;`s1:stable_sy`] +THEN SUBGOAL_THEN`(k-p+2,1) IN J1_SY (s3:stable_sy)`ASSUME_TAC; +REWRITE_TAC[J1_SY;IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN ASM_REWRITE_TAC[IN_NUMSEG] +THEN STRIP_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`k-p+2` +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p/\1+0=1/\ SUC 0=1 /\ k - p + 2 <= k - p + 2`] +THEN MRESA_TAC MOD_LT[`1:num`;`k-p+2:num`]; +MRESAL_TAC SUM_DELETE[`(\x. cstab - norm (row (FST x) (vecmats l1) - row (SND x) (vecmats (l1:real^(P,3)finite_product))))`;`J1_SY (s1:stable_sy)`;`p-1,p`][FINITE_J1_SY;REAL_ARITH`A=B-C<=> B=A+C`] +THEN MRESAL_TAC SUM_DELETE[`(\x. cstab - norm (row (FST x) (vecmats l2) - row (SND x) (vecmats (l2:real^(N,3)finite_product))))`;`J1_SY (s3:stable_sy)`;`k-p+2,1`][FINITE_J1_SY;REAL_ARITH`A=B-C<=> B=A+C`] +THEN SUBGOAL_THEN`J1_SY s1 DELETE (p-1,p) DELETE (p,1) SUBSET J1_SY (s:stable_sy)` ASSUME_TAC; +ASM_REWRITE_TAC[SUBSET;J1_SY;IN_ELIM_THM;DELETE;IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PAIR_EQ;] +THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i< p:num`) +THEN RESA_TAC; +MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p /\ SUC 0=1`]; +MP_TAC(ARITH_RULE`i

i=p-1 \/ i< p-1:num`) +THEN RESA_TAC; +MP_TAC(ARITH_RULE`2

SUC(p-1)=p /\ p-1 i< k /\ i<=k:num /\ 1+i ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN MRESA_TAC MOD_LT[`1+i:num`;`k:num`] +THEN MRESA_TAC MOD_LT[`1+i:num`;`p:num`] +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[SYM th] ) +THEN FIND_ASSUM MP_TAC`J_SY s1 SUBSET J_SY (s:stable_sy) UNION {{0, p - 1}}` +THEN REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`{i,(1+i) MOD p}`) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC MOD_LT[`1+i:num`;`p:num`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`{i, 1 + i} = {0, p - 1} /\ ~(i=1+i) /\ ~(i=p-1) ==> i=0 /\ 1+i= p-1`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+0=p-1<=> p=2`]; +SUBGOAL_THEN`IMAGE (\(x,y). (p - 2 + x), (p - 2 + y)) (J1_SY s3 DELETE (k-p+2,1)) SUBSET J1_SY (s:stable_sy)` ASSUME_TAC; +ASM_REWRITE_TAC[J1_SY;IMAGE;DELETE;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PAIR_EQ;] +THEN MP_TAC(ARITH_RULE`i<=k-p+2 ==> i=k-p+2 \/ i< k-p+2:num`) +THEN RESA_TAC; +MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p /\ SUC 0=1`]; +MP_TAC(ARITH_RULE`i i=k-p+1 \/ i< k-p+1:num`) +THEN RESA_TAC; +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN RESA_TAC +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`2

p-2+k-p+1=k-1/\ SUC(k-p+1)=k-p+2 /\ k-p+1 REWRITE_TAC[SYM th])`(\i. (1 + i) MOD (k - p + 2)) = + f_sy (s2:stable_sy) o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)` +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p /\ SUC 0=1`] +THEN STRIP_TAC +THEN FIND_ASSUM (fun th-> MP_TAC( ISPECL [`k-p+1`;`0`]th))`!p' q. + {(if p' = 0 then 0 else (p - 2 + p') MOD k), (if q = 0 + then 0 + else (p - 2 + q) MOD + k)} IN + J_SY s2 <=> + {p', q} IN J_SY (s3:stable_sy)` +THEN POP_ASSUM (fun th-> REWRITE_TAC[th;ARITH_RULE`0=0`]) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`J_SY s2 SUBSET J_SY (s:stable_sy) UNION {{0, p - 1}}` +THEN REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`{k-1,0}`); +POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<=k-p /\2 ~(k-1=p-1) /\ ~(0= p-1)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(k-1=p-1) /\ ~(0= p-1)==> ~(p-1 IN {k-1,0})`) +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]; +STRIP_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`p-2+i:num` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`i p-2+i< k/\ p-2+i<=k /\ 1<=p-2+i/\ 1+p-2+i ~(i=0)/\ ~(1+i=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`1+i:num`;`k-p+2:num`] +THEN MRESA_TAC MOD_LT[`i:num`;`k-p+2:num`] +THEN REWRITE_TAC[ARITH_RULE`SUC (p - 2 + i)= p - 2 + SUC i`] +THEN MRESA_TAC MOD_LT[`1+p-2+i:num`;`k:num`] +THEN FIND_ASSUM (fun th-> MP_TAC( ISPECL [`i MOD (k - p + 2)`;`(f_sy (s2:stable_sy) o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)) + (i MOD (k - p + 2))`] th))`!p' q. + {(if p' = 0 then 0 else (p - 2 + p') MOD k), (if q = 0 + then 0 + else (p - 2 + q) MOD + k)} IN + J_SY s2 <=> + {p', q} IN J_SY (s3:stable_sy)` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`{i MOD (k - p + 2), (f_sy s2 o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)) + (i MOD (k - p + 2))} IN + J_SY (s3:stable_sy)` +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`(\i. (1 + i) MOD (k - p + 2)) = + f_sy (s2:stable_sy) o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`J_SY s2 SUBSET J_SY (s:stable_sy) UNION {{0, p - 1}}` +THEN REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`{p-2+i,p-2+1+i}`); +ASM_REWRITE_TAC[ARITH_RULE`1+p-2+i= p-2+1+i`]; +MP_TAC(SET_RULE`{p - 2 + i, p - 2 + 1 + i} = {0, p - 1} ==> (p-2+i=0) \/ (p-2+1+i=0)`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`1<=i /\ 2< p==> ~(p-2+i=0) /\ ~(p-2+1+i=0)`) +THEN ASM_REWRITE_TAC[]; +MRESAL_TAC FINITE_DELETE_IMP[`J1_SY (s1:stable_sy)`;`p-1,p`][FINITE_J1_SY] +THEN MRESAL_TAC FINITE_DELETE_IMP[`J1_SY (s3:stable_sy)`;`k-p+2,1`][FINITE_J1_SY] +THEN DISJ_CASES_TAC(SET_RULE`ear_sy s1 \/ ~(ear_sy (s1:stable_sy))`); +ASM_REWRITE_TAC[sigma_sy] +THEN MATCH_MP_TAC(REAL_ARITH` +d_sy s <= + d_sy s1 + + d_sy s3 +/\ +&0<= sum (J1_SY s) + (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats l))) +/\ +&0<= sum (J1_SY s1 DELETE (p - 1,p)) + (\x. cstab - norm (row (FST x) (vecmats l1) - row (SND x) (vecmats l1))) +/\ &0<= cstab - norm (row (p - 1) (vecmats l1) - row p (vecmats l1)) +/\ +&0<= + sum (J1_SY s3 DELETE (k - p + 2,1)) + (\x. cstab - norm (row (FST x) (vecmats l2) - row (SND x) (vecmats l2))) +/\ &0<= cstab - norm (row (k - p + 2) (vecmats l2) - row 1 (vecmats l2)) +==> +d_sy s + + #0.1 * + -- &1 * + sum (J1_SY s) + (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats l))) <= + (d_sy s1 + + #0.1 * + &1 * + (sum (J1_SY s1 DELETE (p - 1,p)) + (\x. cstab - norm (row (FST x) (vecmats l1) - row (SND x) (vecmats l1))) + + cstab - norm (row (p - 1) (vecmats l1) - row p (vecmats l1)))) + + d_sy s3 + + #0.1 * + &1 * + (sum (J1_SY (s3:stable_sy) DELETE (k - p + 2,1)) + (\x. cstab - norm (row (FST x) (vecmats l2) - row (SND x) (vecmats l2))) + + cstab - norm (row (k - p + 2) (vecmats l2) - row 1 (vecmats l2)))`) +THEN RESA_TAC; +FIND_ASSUM MP_TAC `COVER2_SY s s1 (s2:stable_sy)` +THEN REWRITE_TAC[COVER2_SY] +THEN RESA_TAC; +STRIP_TAC; +MATCH_MP_TAC SUM_POS_LE +THEN REWRITE_TAC[FINITE_J1_SY] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL B_SY_LE_CSTAB)[`i:num`;`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`;] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC; +MATCH_MP_TAC SUM_POS_LE +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`x=p:num,1 \/ ~(x=p:num,1 )`); +ASM_REWRITE_TAC[] +THEN EXPAND_TAC"l1" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN SUBGOAL_THEN`1<= p/\ p<= dimindex(:P)==> row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p 1<=1 /\ 1

x IN J1_SY (s:stable_sy)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN DISCH_THEN(LABEL_TAC"THY1") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"THY" MP_TAC +THEN REWRITE_TAC[J1_SY;DELETE;IN_ELIM_THM;IN_NUMSEG] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN"THY1" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`i<=p==> i=p \/ i i=p -1 \/ SUC i p-1< p /\ SUC (p-1)=p`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`]; +RESA_TAC +THEN RESA_TAC +THEN EXPAND_TAC"l1" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN MRESA_TAC MOD_LT[`i:num`;`p:num`] +THEN SUBGOAL_THEN`row i ((pmat1 (vecmats l)):real^3^P) = row i (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (SUC i) ((pmat1 (vecmats l)):real^3^P) = row (SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`SUC i < p==> 1<= SUC i /\ SUC i <= p`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`SUC i < p /\ 1<=k-p ==> i <= k/\ i row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p p-1 <= p /\ 1<= p-1/\ p-1 MP_TAC(ISPECL [`p-1`;`k:num`] th) )`!i j. + {i MOD k, j MOD k} IN J_SY s UNION {{0, p - 1}} + ==> norm (row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))) <= cstab` +THEN REWRITE_TAC[IN_ELIM_THM;UNION;IN_SING] +THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`;SET_RULE`{p-1,0}={0,p-1}`] +THEN REAL_ARITH_TAC; +STRIP_TAC; +MATCH_MP_TAC SUM_POS_LE +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`x=k-p+1,k-p+2 \/ ~(x=k-p+1,k-p+2 )`); +ASM_REWRITE_TAC[] +THEN EXPAND_TAC"l2" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN SUBGOAL_THEN`row (k-p+1) ((pmat2 (vecmats l)):real^3^N) = row (k-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+1<=k-p+2 /\ 1<= k-p+1 /\ k - (k - p + 2) + k - p + 1= k-1`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (k-p+2) ((pmat2 (vecmats l)):real^3^N) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+2<=k-p+2 /\ 1<= k-p+2 /\ k - (k - p + 2) + k - p + 2= k`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE` 2 1<=k-1 /\ k-1<= k /\ SUC (k - 1)= k /\ k-1 i=k-p+2 \/ i i=k-p +1 \/ i< k-p+1:num`) +THEN RESA_TAC; +MP_TAC(ARITH_RULE`2

k-p+1< k-p+2 /\ SUC (k-p+1)=k-p+2`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`k-p+1:num`;`k-p+2:num`]; +RESA_TAC +THEN RESA_TAC +THEN EXPAND_TAC"l2" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN MRESA_TAC MOD_LT[`i:num`;`k-p+2:num`] +THEN SUBGOAL_THEN`row i ((pmat2 (vecmats l)):real^3^N) = row (p-2+i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + i= p-2+i`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (SUC i) ((pmat2 (vecmats l)):real^3^N) = row (p-2+ SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + SUC i= p-2+SUC i/\ 1<= SUC i /\ SUC i<= k-p+2`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE` i< k-p+1 /\ 2< p /\ 1<= k-p ==> 1<=p-2+i /\ p-2+i <= k /\ SUC (p-2+i)= p-2+ SUC i /\ p-2+i k-p+2<=k-p+2 /\ 1<= k-p+2 /\ k - (k - p + 2) + k - p + 2= k`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row 1 ((pmat2 (vecmats l)):real^3^N) = row (p-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + 1= p-1/\ 1<=1 /\ 1<=k-p+2`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +EXPAND_TAC"l2" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM (fun th-> MP_TAC(ISPECL [`k:num`;`p-1:num`] th) )`!i j. + {i MOD k, j MOD k} IN J_SY s UNION {{0, p - 1}} + ==> norm (row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))) <= cstab` +THEN REWRITE_TAC[IN_ELIM_THM;UNION;IN_SING] +THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`;SET_RULE`{p-1,0}={0,p-1}`] +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[sigma_sy] +THEN SUBGOAL_THEN `cstab - norm (row (p - 1) (vecmats (l1:real^(P,3)finite_product)) - row p (vecmats l1)) =cstab - norm (row (k-p + 2) (vecmats (l2:real^(N,3)finite_product)) - row 1 (vecmats l2))` ASSUME_TAC; +REWRITE_TAC[REAL_ARITH`A-B=A-C<=> B=C`] +THEN EXPAND_TAC"l1" +THEN EXPAND_TAC"l2" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN SUBGOAL_THEN`row 1 ((pmat2 (vecmats l)):real^3^N) = row (p-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + 1= p-1/\ 1<=1 /\ 1<=k-p+2`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (k-p+2) ((pmat2 (vecmats l)):real^3^N) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+2<=k-p+2 /\ 1<= k-p+2 /\ k - (k - p + 2) + k - p + 2= k`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (p-1) ((pmat1 (vecmats l)):real^3^P) = row (p-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`2< p ==> p-1 <= p /\ 1<= p-1/\ p-1 row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p SUBST_ALL_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p /\ 1+0=1`] +THEN MP_TAC(ARITH_RULE`2

1

MRESA1_TAC th`{0,1}`); +MP_TAC(ARITH_RULE`2

~(p-1=0) /\ ~(p-1=1)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(p-1=0) /\ ~(p-1=1) ==> ~(p-1 IN {0,1})`) +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; +MRESAL_TAC SUM_DELETE[`(\x. cstab - norm (row (FST x) (vecmats l1) - row (SND x) (vecmats (l1:real^(P,3)finite_product))))`;`J1_SY (s1:stable_sy) DELETE (p-1,p)`;`p:num,1`][FINITE_J1_SY;REAL_ARITH`A=B-C<=> B=A+C`] +THEN MRESAL_TAC SUM_DELETE[`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`J1_SY (s:stable_sy)`;`k:num,1`][FINITE_J1_SY;REAL_ARITH`A=B-C<=> B=A+C`] +THEN EXPAND_TAC"l1" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN SUBGOAL_THEN`1<= p/\ p<= dimindex(:P)==> row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p 1<=1 /\ 1

A SUBSET B DELETE x`) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(SET_RULE`~(x IN A) ==> ~(x IN A DELETE y)`) +THEN MATCH_MP_TAC(SET_RULE`~(x IN A) ==> ~(x IN A DELETE y)`) +THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;PAIR_EQ;IN_NUMSEG] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= k-p ==> ~(k<=p)`) +THEN RESA_TAC; +ASM_REWRITE_TAC[REAL_ARITH`(A+ #0.1 * -- &1 *(C+B)) + D+ #0.1 * &1* (E+B)= (A+ #0.1 * -- &1 * C) + D+ #0.1 * &1 * E`] +THEN MRESAL_TAC FINITE_DELETE_IMP[`J1_SY (s:stable_sy)`;`k:num,1`][FINITE_J1_SY] +THEN MRESAL_TAC SUM_DIFF[`(\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l)))`;`J1_SY(s:stable_sy) DELETE (k,1)`;`J1_SY (s1:stable_sy) DELETE (p-1,p:num) DELETE (p:num,1)`][FINITE_J1_SY;] +THEN MATCH_MP_TAC(REAL_ARITH` +A1<= A+D /\ &0<= C1 -C /\ &0<= E +==> A1+ #0.1 * -- &1 * (C1+B) <=(A+ #0.1 * -- &1 *(C+B)) + D+ #0.1 * &1* E`) +THEN STRIP_TAC; +FIND_ASSUM MP_TAC `COVER2_SY s s1 (s2:stable_sy)` +THEN REWRITE_TAC[COVER2_SY] +THEN RESA_TAC; +STRIP_TAC; +SUBGOAL_THEN`!x. x IN (J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1)) +==> (\x. cstab - + norm + (row (FST x) ((pmat1 (vecmats (l:real^(M,3)finite_product)):real^3^P)) - row (SND x) ((pmat1 (vecmats l)):real^3^P))) x += (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product)))) x` ASSUME_TAC; +ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;DELETE;IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=> B=C`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i< p:num`) +THEN RESA_TAC; +MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`]; +MP_TAC(ARITH_RULE`i< p /\ 2

i=p -1 \/ SUC i p-1< p /\ SUC (p-1)=p`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`]; +RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`p:num`] +THEN SUBGOAL_THEN`row i ((pmat1 (vecmats l)):real^3^P) = row i (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (SUC i) ((pmat1 (vecmats l)):real^3^P) = row (SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`SUC i < p==> 1<= SUC i /\ SUC i <= p`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[]; +MRESA_TAC SUM_EQ[`(\x. cstab - + norm + (row (FST x) ((pmat1 (vecmats (l:real^(M,3)finite_product)):real^3^P)) - row (SND x) ((pmat1 (vecmats l)):real^3^P)))`;`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`(J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1))`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MATCH_MP_TAC SUM_POS_LE +THEN STRIP_TAC; +MATCH_MP_TAC FINITE_DIFF +THEN REWRITE_TAC[FINITE_J1_SY; FINITE_DELETE]; +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG;DIFF;DELETE] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC (GEN_ALL B_SY_LE_CSTAB)[`i:num`;`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`;] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +MATCH_MP_TAC SUM_POS_LE +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`x=k-p+1,k-p+2 \/ ~(x=k-p+1,k-p+2 )`); +ASM_REWRITE_TAC[] +THEN EXPAND_TAC"l2" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN SUBGOAL_THEN`row (k-p+1) ((pmat2 (vecmats l)):real^3^N) = row (k-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+1<=k-p+2 /\ 1<= k-p+1 /\ k - (k - p + 2) + k - p + 1= k-1`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (k-p+2) ((pmat2 (vecmats l)):real^3^N) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+2<=k-p+2 /\ 1<= k-p+2 /\ k - (k - p + 2) + k - p + 2= k`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE` 2 1<=k-1 /\ k-1<= k /\ SUC (k - 1)= k /\ k-1 i=k-p+2 \/ i i=k-p +1 \/ i< k-p+1:num`) +THEN RESA_TAC; +MP_TAC(ARITH_RULE`2

k-p+1< k-p+2 /\ SUC (k-p+1)=k-p+2`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`k-p+1:num`;`k-p+2:num`]; +RESA_TAC +THEN RESA_TAC +THEN EXPAND_TAC"l2" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN MRESA_TAC MOD_LT[`i:num`;`k-p+2:num`] +THEN SUBGOAL_THEN`row i ((pmat2 (vecmats l)):real^3^N) = row (p-2+i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + i= p-2+i`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (SUC i) ((pmat2 (vecmats l)):real^3^N) = row (p-2+ SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + SUC i= p-2+SUC i/\ 1<= SUC i /\ SUC i<= k-p+2`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE` i< k-p+1 /\ 2< p /\ 1<= k-p ==> 1<=p-2+i /\ p-2+i <= k /\ SUC (p-2+i)= p-2+ SUC i /\ p-2+i J1_SY (s1:stable_sy) DELETE (p - 1,p) = J1_SY s1 DELETE (p - 1,p) DELETE (p,1)`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN MATCH_MP_TAC(REAL_ARITH` +A1<= A+D /\ &0<= C1 -C /\ &0<= E +==> A1+ #0.1 * -- &1 * C1 <=(A+ #0.1 * -- &1 *(C+B)) + D+ #0.1 * &1* (E+B)`) +THEN STRIP_TAC; +FIND_ASSUM MP_TAC `COVER2_SY s s1 (s2:stable_sy)` +THEN REWRITE_TAC[COVER2_SY] +THEN RESA_TAC; +STRIP_TAC; +SUBGOAL_THEN`!x. x IN (J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1)) +==> (\x. cstab - + norm + (row (FST x) ((pmat1 (vecmats (l:real^(M,3)finite_product)):real^3^P)) - row (SND x) ((pmat1 (vecmats l)):real^3^P))) x += (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product)))) x` ASSUME_TAC; +ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;DELETE;IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=> B=C`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i< p:num`) +THEN RESA_TAC; +MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`]; +MP_TAC(ARITH_RULE`i< p /\ 2

i=p -1 \/ SUC i p-1< p /\ SUC (p-1)=p`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`]; +RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`p:num`] +THEN SUBGOAL_THEN`row i ((pmat1 (vecmats l)):real^3^P) = row i (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (SUC i) ((pmat1 (vecmats l)):real^3^P) = row (SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`SUC i < p==> 1<= SUC i /\ SUC i <= p`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[]; +MRESA_TAC SUM_EQ[`(\x. cstab - + norm + (row (FST x) ((pmat1 (vecmats (l:real^(M,3)finite_product)):real^3^P)) - row (SND x) ((pmat1 (vecmats l)):real^3^P)))`;`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`(J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1))`] +THEN EXPAND_TAC"l1" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN MRESAL_TAC SUM_DIFF[`(\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l)))`;`J1_SY(s:stable_sy) `;`J1_SY (s1:stable_sy) DELETE (p-1,p:num) DELETE (p:num,1)`][FINITE_J1_SY;] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MATCH_MP_TAC SUM_POS_LE +THEN STRIP_TAC; +MATCH_MP_TAC FINITE_DIFF +THEN REWRITE_TAC[FINITE_J1_SY; FINITE_DELETE]; +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG;DIFF;DELETE] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC (GEN_ALL B_SY_LE_CSTAB)[`i:num`;`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`;] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +MATCH_MP_TAC SUM_POS_LE +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`x=k-p+1,k-p+2 \/ ~(x=k-p+1,k-p+2 )`); +ASM_REWRITE_TAC[] +THEN EXPAND_TAC"l2" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN SUBGOAL_THEN`row (k-p+1) ((pmat2 (vecmats l)):real^3^N) = row (k-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+1<=k-p+2 /\ 1<= k-p+1 /\ k - (k - p + 2) + k - p + 1= k-1`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (k-p+2) ((pmat2 (vecmats l)):real^3^N) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+2<=k-p+2 /\ 1<= k-p+2 /\ k - (k - p + 2) + k - p + 2= k`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE` 2 1<=k-1 /\ k-1<= k /\ SUC (k - 1)= k /\ k-1 i=k-p+2 \/ i i=k-p +1 \/ i< k-p+1:num`) +THEN RESA_TAC; +MP_TAC(ARITH_RULE`2

k-p+1< k-p+2 /\ SUC (k-p+1)=k-p+2`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`k-p+1:num`;`k-p+2:num`]; +RESA_TAC +THEN RESA_TAC +THEN EXPAND_TAC"l2" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN MRESA_TAC MOD_LT[`i:num`;`k-p+2:num`] +THEN SUBGOAL_THEN`row i ((pmat2 (vecmats l)):real^3^N) = row (p-2+i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + i= p-2+i`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (SUC i) ((pmat2 (vecmats l)):real^3^N) = row (p-2+ SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + SUC i= p-2+SUC i/\ 1<= SUC i /\ SUC i<= k-p+2`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE` i< k-p+1 /\ 2< p /\ 1<= k-p ==> 1<=p-2+i /\ p-2+i <= k /\ SUC (p-2+i)= p-2+ SUC i /\ p-2+i MP_TAC(ISPECL [`0`;`1`]th))`!p' q. + {(if p' = 0 then 0 else (p - 2 + p') MOD k), (if q = 0 + then 0 + else (p - 2 + q) MOD + k)} IN + J_SY s2 <=> + {p', q} IN J_SY (s3:stable_sy)` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;ARITH_RULE`(0=0) /\ ~(1=0)`]) +THEN MP_TAC(ARITH_RULE`2

p-2+1=p-1 /\ p-1 SUBST_ALL_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`2

p-2+1=p-1 /\ p-1

SUBST_ALL_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p/\ 1+0=1`] +THEN MRESA_TAC MOD_LT[`1:num`;`k-p+2:num`]; +SUBGOAL_THEN`J1_SY s1 DELETE (p-1,p) DELETE (p,1) SUBSET J1_SY (s:stable_sy)` ASSUME_TAC; +ASM_REWRITE_TAC[SUBSET;J1_SY;IN_ELIM_THM;DELETE;IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PAIR_EQ;] +THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i< p:num`) +THEN RESA_TAC; +MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p /\ SUC 0=1`]; +MP_TAC(ARITH_RULE`i

i=p-1 \/ i< p-1:num`) +THEN RESA_TAC; +MP_TAC(ARITH_RULE`2

SUC(p-1)=p /\ p-1 i< k /\ i<=k:num /\ 1+i ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN MRESA_TAC MOD_LT[`1+i:num`;`k:num`] +THEN MRESA_TAC MOD_LT[`1+i:num`;`p:num`] +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[SYM th] ) +THEN FIND_ASSUM MP_TAC`J_SY s1 SUBSET J_SY (s:stable_sy) UNION {{0, p - 1}}` +THEN REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`{i,(1+i) MOD p}`) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC MOD_LT[`1+i:num`;`p:num`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`{i, 1 + i} = {0, p - 1} /\ ~(i=1+i) /\ ~(i=p-1) ==> i=0 /\ 1+i= p-1`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+0=p-1<=> p=2`]; +SUBGOAL_THEN`IMAGE (\(x,y). (p - 2 + x), (p - 2 + y)) (J1_SY s3 DELETE (k-p+2,1)) SUBSET J1_SY (s:stable_sy)` ASSUME_TAC; +ASM_REWRITE_TAC[J1_SY;IMAGE;DELETE;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PAIR_EQ;] +THEN MP_TAC(ARITH_RULE`i<=k-p+2 ==> i=k-p+2 \/ i< k-p+2:num`) +THEN RESA_TAC; +MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p /\ SUC 0=1`]; +MP_TAC(ARITH_RULE`i i=k-p+1 \/ i< k-p+1:num`) +THEN RESA_TAC; +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN RESA_TAC +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`2

p-2+k-p+1=k-1/\ SUC(k-p+1)=k-p+2 /\ k-p+1 REWRITE_TAC[SYM th])`(\i. (1 + i) MOD (k - p + 2)) = + f_sy (s2:stable_sy) o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)` +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p /\ SUC 0=1`] +THEN STRIP_TAC +THEN FIND_ASSUM (fun th-> MP_TAC( ISPECL [`k-p+1`;`0`]th))`!p' q. + {(if p' = 0 then 0 else (p - 2 + p') MOD k), (if q = 0 + then 0 + else (p - 2 + q) MOD + k)} IN + J_SY s2 <=> + {p', q} IN J_SY (s3:stable_sy)` +THEN POP_ASSUM (fun th-> REWRITE_TAC[th;ARITH_RULE`0=0`]) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`J_SY s2 SUBSET J_SY (s:stable_sy) UNION {{0, p - 1}}` +THEN REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`{k-1,0}`); +POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<=k-p /\2 ~(k-1=p-1) /\ ~(0= p-1)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(k-1=p-1) /\ ~(0= p-1)==> ~(p-1 IN {k-1,0})`) +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]; +STRIP_TAC +THEN STRIP_TAC +THEN EXISTS_TAC`p-2+i:num` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`i p-2+i< k/\ p-2+i<=k /\ 1<=p-2+i/\ 1+p-2+i ~(i=0)/\ ~(1+i=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`1+i:num`;`k-p+2:num`] +THEN MRESA_TAC MOD_LT[`i:num`;`k-p+2:num`] +THEN REWRITE_TAC[ARITH_RULE`SUC (p - 2 + i)= p - 2 + SUC i`] +THEN MRESA_TAC MOD_LT[`1+p-2+i:num`;`k:num`] +THEN FIND_ASSUM (fun th-> MP_TAC( ISPECL [`i MOD (k - p + 2)`;`(f_sy (s2:stable_sy) o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)) + (i MOD (k - p + 2))`] th))`!p' q. + {(if p' = 0 then 0 else (p - 2 + p') MOD k), (if q = 0 + then 0 + else (p - 2 + q) MOD + k)} IN + J_SY s2 <=> + {p', q} IN J_SY (s3:stable_sy)` +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`{i MOD (k - p + 2), (f_sy s2 o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)) + (i MOD (k - p + 2))} IN + J_SY (s3:stable_sy)` +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`(\i. (1 + i) MOD (k - p + 2)) = + f_sy (s2:stable_sy) o (\x. if x = 0 then 0 else (p - 2 + x) MOD k)` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`J_SY s2 SUBSET J_SY (s:stable_sy) UNION {{0, p - 1}}` +THEN REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`{p-2+i,p-2+1+i}`); +ASM_REWRITE_TAC[ARITH_RULE`1+p-2+i= p-2+1+i`]; +MP_TAC(SET_RULE`{p - 2 + i, p - 2 + 1 + i} = {0, p - 1} ==> (p-2+i=0) \/ (p-2+1+i=0)`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`1<=i /\ 2< p==> ~(p-2+i=0) /\ ~(p-2+1+i=0)`) +THEN ASM_REWRITE_TAC[]; +MP_TAC(SET_RULE`~(k - p + 2,1 IN J1_SY s3) ==> J1_SY (s3:stable_sy) =J1_SY s3 DELETE (k - p + 2,1)`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN MP_TAC(SET_RULE`~(p -1,p IN J1_SY s1) ==> J1_SY (s1:stable_sy) =J1_SY s1 DELETE (p -1,p)`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]); +DISJ_CASES_TAC(SET_RULE`(p,1) IN J1_SY s1 DELETE (p - 1,p) \/ ~((p,1) IN J1_SY (s1:stable_sy) DELETE (p - 1,p))`); +SUBGOAL_THEN`k,1 IN J1_SY (s:stable_sy)`ASSUME_TAC; +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;DELETE;PAIR_EQ;IN_NUMSEG] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p /\ 1+0=1`] +THEN MP_TAC(ARITH_RULE`2

1

MRESA1_TAC th`{0,1}`); +MP_TAC(ARITH_RULE`2

~(p-1=0) /\ ~(p-1=1)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(p-1=0) /\ ~(p-1=1) ==> ~(p-1 IN {0,1})`) +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; +MRESAL_TAC FINITE_DELETE_IMP[`J1_SY (s1:stable_sy)`;`p-1,p`][FINITE_J1_SY] +THEN MRESAL_TAC FINITE_DELETE_IMP[`J1_SY (s3:stable_sy)`;`k-p+2,1`][FINITE_J1_SY] +THEN MRESAL_TAC SUM_DELETE[`(\x. cstab - norm (row (FST x) (vecmats l1) - row (SND x) (vecmats (l1:real^(P,3)finite_product))))`;`J1_SY (s1:stable_sy) DELETE (p-1,p)`;`p:num,1`][FINITE_J1_SY;REAL_ARITH`A=B-C<=> B=A+C`] +THEN MRESAL_TAC SUM_DELETE[`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`J1_SY (s:stable_sy)`;`k:num,1`][FINITE_J1_SY;REAL_ARITH`A=B-C<=> B=A+C`] +THEN EXPAND_TAC"l1" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN SUBGOAL_THEN`1<= p/\ p<= dimindex(:P)==> row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p 1<=1 /\ 1

A SUBSET B DELETE x`) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(SET_RULE`~(x IN A) ==> ~(x IN A DELETE y)`) +THEN MATCH_MP_TAC(SET_RULE`~(x IN A) ==> ~(x IN A DELETE y)`) +THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;PAIR_EQ;IN_NUMSEG] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= k-p ==> ~(k<=p)`) +THEN RESA_TAC; +ASM_REWRITE_TAC[REAL_ARITH` +A1+ #0.1 * -- &1 * (C1+B) <=(A+ #0.1 * -- &1 *(C+B)) + D+ #0.1 * -- &1* E +<=> A1+ #0.1 * -- &1 * (C1) <=(A+ #0.1 * -- &1 *(C)) + D+ #0.1 * -- &1* E +`] +THEN EXPAND_TAC"l1" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN MATCH_MP_TAC(REAL_ARITH` +A1<= A+D /\ &0<=C1-(C+E) +==> +A1+ #0.1 * -- &1 * (C1) <=(A+ #0.1 * -- &1 *(C)) + D+ #0.1 * -- &1* E`) +THEN STRIP_TAC; +FIND_ASSUM MP_TAC `COVER2_SY s s1 (s2:stable_sy)` +THEN REWRITE_TAC[COVER2_SY] +THEN RESA_TAC; +SUBGOAL_THEN`!x. x IN (J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1)) +==> (\x. cstab - + norm + (row (FST x) ((pmat1 (vecmats (l:real^(M,3)finite_product)):real^3^P)) - row (SND x) ((pmat1 (vecmats l)):real^3^P))) x += (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product)))) x` ASSUME_TAC; +ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;DELETE;IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=> B=C`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i< p:num`) +THEN RESA_TAC; +MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`]; +MP_TAC(ARITH_RULE`i< p /\ 2

i=p -1 \/ SUC i p-1< p /\ SUC (p-1)=p`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`]; +RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`p:num`] +THEN SUBGOAL_THEN`row i ((pmat1 (vecmats l)):real^3^P) = row i (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (SUC i) ((pmat1 (vecmats l)):real^3^P) = row (SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`SUC i < p==> 1<= SUC i /\ SUC i <= p`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[]; +MRESA_TAC SUM_EQ[`(\x. cstab - + norm + (row (FST x) ((pmat1 (vecmats (l:real^(M,3)finite_product)):real^3^P)) - row (SND x) ((pmat1 (vecmats l)):real^3^P)))`;`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`(J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1))`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN SUBGOAL_THEN`!x. x IN (J1_SY (s3:stable_sy) DELETE (k - p + 2,1)) +==> + ((\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l))) o + (\(x,y). p - 2 + x,p - 2 + y)) x += (\x. cstab - norm (row (FST x) (vecmats (l2:real^(N,3)finite_product)) - row (SND x) (vecmats l2))) x` +ASSUME_TAC; +ASM_REWRITE_TAC[J1_SY;DELETE;IN_ELIM_THM;o_DEF;IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=> B=C`] +THEN EXPAND_TAC"l2" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`i<=k-p+2==> i=k-p+2 \/ i k - (k - p + 2) + i= p-2+i`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (SUC i) ((pmat2 (vecmats l)):real^3^N) = row (p-2+ SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + SUC i= p-2+SUC i/\ 1<= SUC i /\ SUC i<= k-p+2`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[]; +MRESA_TAC SUM_EQ[` ((\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l))) o + (\(x,y). p - 2 + x,p - 2 + y))`;`(\x. cstab - norm (row (FST x) (vecmats (l2:real^(N,3)finite_product)) - row (SND x) (vecmats l2)))`;`(J1_SY (s3:stable_sy) DELETE (k - p + 2,1))`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`(!x y. + x IN J1_SY s3 DELETE (k - p + 2,1) /\ + y IN J1_SY (s3:stable_sy) DELETE (k - p + 2,1) /\ + (\(x,y). p - 2 + x,p - 2 + y) x = (\(x,y). p - 2 + x,p - 2 + y) y + ==> x = y)`ASSUME_TAC; +REWRITE_TAC[J1_SY;DELETE;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PAIR_EQ;ARITH_RULE`p-2+B=p-2+C<=> B=C`]; +MRESA_TAC SUM_IMAGE[`(\(x,y). p - 2 + x,p - 2 + y)`;`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`J1_SY (s3:stable_sy) DELETE (k - p + 2,1)`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1) INTER (IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1)))={}` ASSUME_TAC; +ASM_REWRITE_TAC[SET_RULE`A ={} <=> ~(?a. a IN A)`; INTER;IN_ELIM_THM;J1_SY;DELETE;IMAGE;IN_NUMSEG] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PAIR_EQ] +THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i< p:num`) +THEN RESA_TAC; +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`]; +MP_TAC(ARITH_RULE`i

i=p-1 \/ i< p-1:num`) +THEN RESA_TAC; +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE` 2< p ==> p-1< p:num/\ SUC (p-1)=p`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`]; +MP_TAC(ARITH_RULE`1<= i /\ i< p-1 /\ 1<= i' ==> ~(i= p-2+i')`) +THEN RESA_TAC; +MRESA_TAC FINITE_IMAGE[`(\(x,y). p - 2 + x,p - 2 + y)`;`(J1_SY (s3:stable_sy) DELETE (k - p + 2,1))`] +THEN MRESAL_TAC (GEN_ALL SUM_UNION_EQ)[`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1)`;`(IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY (s3:stable_sy) DELETE (k - p + 2,1)))`;`J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1) UNION (IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY (s3:stable_sy) DELETE (k - p + 2,1)))`][FINITE_UNION;FINITE_DELETE] +THEN SUBGOAL_THEN`IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1)) SUBSET + J1_SY s DELETE (k,1)` ASSUME_TAC; +MATCH_MP_TAC(SET_RULE`~(x IN A) /\ A SUBSET B ==> A SUBSET B DELETE x`) +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM;DELETE;J1_SY;IN_NUMSEG] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PAIR_EQ] +THEN MP_TAC(ARITH_RULE`i<= k-p+2 ==> i=k-p+2 \/ i< k-p+2`) +THEN RESA_TAC; +MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`]; +MP_TAC(ARITH_RULE`i< k-p+2 /\ 1<= k-p /\ 2< p ==> ~(k=p-2 +i)`) +THEN RESA_TAC; +MP_TAC(SET_RULE`IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1)) SUBSET + J1_SY s DELETE (k,1) +/\ J1_SY s1 DELETE (p - 1,p) DELETE (p,1) SUBSET J1_SY s DELETE (k,1) +==> J1_SY s1 DELETE (p - 1,p) DELETE (p,1) UNION (IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1))) SUBSET J1_SY (s:stable_sy) DELETE (k,1)`) +THEN RESA_TAC +THEN MRESAL_TAC SUM_DIFF[`(\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l)))`;`J1_SY(s:stable_sy) DELETE (k,1)`;`J1_SY (s1:stable_sy) DELETE (p-1,p:num) DELETE (p:num,1) UNION (IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1)))`][FINITE_J1_SY;FINITE_DELETE] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MATCH_MP_TAC SUM_POS_LE +THEN STRIP_TAC; +MATCH_MP_TAC FINITE_DIFF +THEN REWRITE_TAC[FINITE_J1_SY; FINITE_DELETE]; +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG;DIFF;DELETE] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC (GEN_ALL B_SY_LE_CSTAB)[`i:num`;`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`;] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +MP_TAC(SET_RULE`~(p,1 IN J1_SY s1 DELETE (p - 1,p)) +==> J1_SY (s1:stable_sy) DELETE (p - 1,p) = J1_SY s1 DELETE (p - 1,p) DELETE (p,1)`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN SUBGOAL_THEN`J1_SY s1 DELETE (p - 1,p) DELETE (p,1) SUBSET J1_SY (s:stable_sy) DELETE (k,1)`ASSUME_TAC; +MATCH_MP_TAC(SET_RULE`~(x IN A) /\ A SUBSET B==> A SUBSET B DELETE x`) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(SET_RULE`~(x IN A) ==> ~(x IN A DELETE y)`) +THEN MATCH_MP_TAC(SET_RULE`~(x IN A) ==> ~(x IN A DELETE y)`) +THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;PAIR_EQ;IN_NUMSEG] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= k-p ==> ~(k<=p)`) +THEN RESA_TAC; +ASM_REWRITE_TAC[REAL_ARITH` +A1+ #0.1 * -- &1 * (C1+B) <=(A+ #0.1 * -- &1 *(C+B)) + D+ #0.1 * -- &1* E +<=> A1+ #0.1 * -- &1 * (C1) <=(A+ #0.1 * -- &1 *(C)) + D+ #0.1 * -- &1* E +`] +THEN MATCH_MP_TAC(REAL_ARITH` +A1<= A+D /\ &0<=C1-(C+E) +==> +A1+ #0.1 * -- &1 * (C1) <=(A+ #0.1 * -- &1 *(C)) + D+ #0.1 * -- &1* E`) +THEN STRIP_TAC; +FIND_ASSUM MP_TAC `COVER2_SY s s1 (s2:stable_sy)` +THEN REWRITE_TAC[COVER2_SY] +THEN RESA_TAC; +SUBGOAL_THEN`!x. x IN (J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1)) +==> (\x. cstab - + norm + (row (FST x) ((pmat1 (vecmats (l:real^(M,3)finite_product)):real^3^P)) - row (SND x) ((pmat1 (vecmats l)):real^3^P))) x += (\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product)))) x` ASSUME_TAC; +ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;DELETE;IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=> B=C`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i< p:num`) +THEN RESA_TAC; +MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`]; +MP_TAC(ARITH_RULE`i< p /\ 2

i=p -1 \/ SUC i p-1< p /\ SUC (p-1)=p`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`]; +RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`p:num`] +THEN SUBGOAL_THEN`row i ((pmat1 (vecmats l)):real^3^P) = row i (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (SUC i) ((pmat1 (vecmats l)):real^3^P) = row (SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`SUC i < p==> 1<= SUC i /\ SUC i <= p`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[]; +MRESA_TAC SUM_EQ[`(\x. cstab - + norm + (row (FST x) ((pmat1 (vecmats (l:real^(M,3)finite_product)):real^3^P)) - row (SND x) ((pmat1 (vecmats l)):real^3^P)))`;`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`(J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1))`] +THEN EXPAND_TAC"l1" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN SUBGOAL_THEN`!x. x IN (J1_SY (s3:stable_sy) DELETE (k - p + 2,1)) +==> + ((\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l))) o + (\(x,y). p - 2 + x,p - 2 + y)) x += (\x. cstab - norm (row (FST x) (vecmats (l2:real^(N,3)finite_product)) - row (SND x) (vecmats l2))) x` +ASSUME_TAC; +ASM_REWRITE_TAC[J1_SY;DELETE;IN_ELIM_THM;o_DEF;IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=> B=C`] +THEN EXPAND_TAC"l2" +THEN REWRITE_TAC[VECMATS_MATVEC_ID;] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`i<=k-p+2==> i=k-p+2 \/ i k - (k - p + 2) + i= p-2+i`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (SUC i) ((pmat2 (vecmats l)):real^3^N) = row (p-2+ SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + SUC i= p-2+SUC i/\ 1<= SUC i /\ SUC i<= k-p+2`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[]; +MRESA_TAC SUM_EQ[` ((\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l))) o + (\(x,y). p - 2 + x,p - 2 + y))`;`(\x. cstab - norm (row (FST x) (vecmats (l2:real^(N,3)finite_product)) - row (SND x) (vecmats l2)))`;`(J1_SY (s3:stable_sy) DELETE (k - p + 2,1))`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`(!x y. + x IN J1_SY s3 DELETE (k - p + 2,1) /\ + y IN J1_SY (s3:stable_sy) DELETE (k - p + 2,1) /\ + (\(x,y). p - 2 + x,p - 2 + y) x = (\(x,y). p - 2 + x,p - 2 + y) y + ==> x = y)`ASSUME_TAC; +REWRITE_TAC[J1_SY;DELETE;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PAIR_EQ;ARITH_RULE`p-2+B=p-2+C<=> B=C`]; +MRESA_TAC SUM_IMAGE[`(\(x,y). p - 2 + x,p - 2 + y)`;`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`J1_SY (s3:stable_sy) DELETE (k - p + 2,1)`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1) INTER (IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1)))={}` ASSUME_TAC; +ASM_REWRITE_TAC[SET_RULE`A ={} <=> ~(?a. a IN A)`; INTER;IN_ELIM_THM;J1_SY;DELETE;IMAGE;IN_NUMSEG] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PAIR_EQ] +THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i< p:num`) +THEN RESA_TAC; +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`]; +MP_TAC(ARITH_RULE`i

i=p-1 \/ i< p-1:num`) +THEN RESA_TAC; +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE` 2< p ==> p-1< p:num/\ SUC (p-1)=p`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`]; +MP_TAC(ARITH_RULE`1<= i /\ i< p-1 /\ 1<= i' ==> ~(i= p-2+i')`) +THEN RESA_TAC; +MRESAL_TAC FINITE_IMAGE[`(\(x,y). p - 2 + x,p - 2 + y)`;`(J1_SY (s3:stable_sy) DELETE (k - p + 2,1))`][FINITE_J1_SY;FINITE_DELETE] +THEN MRESAL_TAC (GEN_ALL SUM_UNION_EQ)[`(\x. cstab - norm (row (FST x) (vecmats l) - row (SND x) (vecmats (l:real^(M,3)finite_product))))`;`J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1)`;`(IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY (s3:stable_sy) DELETE (k - p + 2,1)))`;`J1_SY (s1:stable_sy) DELETE (p - 1,p) DELETE (p,1) UNION (IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY (s3:stable_sy) DELETE (k - p + 2,1)))`][FINITE_UNION;FINITE_DELETE;FINITE_J1_SY] +THEN MP_TAC(SET_RULE`IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1)) SUBSET + J1_SY s +/\ J1_SY s1 DELETE (p - 1,p) DELETE (p,1) SUBSET J1_SY s +==> J1_SY s1 DELETE (p - 1,p) DELETE (p,1) UNION (IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1))) SUBSET J1_SY (s:stable_sy) `) +THEN RESA_TAC +THEN MRESAL_TAC SUM_DIFF[`(\x. cstab - norm (row (FST x) (vecmats (l:real^(M,3)finite_product)) - row (SND x) (vecmats l)))`;`J1_SY(s:stable_sy) `;`J1_SY (s1:stable_sy) DELETE (p-1,p:num) DELETE (p:num,1) UNION (IMAGE (\(x,y). p - 2 + x,p - 2 + y) (J1_SY s3 DELETE (k - p + 2,1)))`][FINITE_J1_SY;FINITE_DELETE] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MATCH_MP_TAC SUM_POS_LE +THEN STRIP_TAC; +MATCH_MP_TAC FINITE_DIFF +THEN REWRITE_TAC[FINITE_J1_SY; FINITE_DELETE]; +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[J1_SY;IN_ELIM_THM;IN_NUMSEG;DIFF;DELETE] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC (GEN_ALL B_SY_LE_CSTAB)[`i:num`;`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`;] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]);; + + + +let F_SY_COVER_EQ=prove_by_refinement(`!(l:real^(M,3)finite_product) +(l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). +dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p +/\ 1<= k-p +/\ 2

i=j) +==> (F_SY(vecmats l1) DELETE (row (p-1) (vecmats l1), row p (vecmats l1))) UNION (F_SY(vecmats l2) DELETE (row (k-p+2) (vecmats l2), row 1 (vecmats l2))) = F_SY(vecmats l)`, +[REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REWRITE_TAC[F_SY;UNION;EXTENSION;IN_ELIM_THM;DELETE] +THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` +THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) +/\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p `) +THEN RESA_TAC +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; +EXPAND_TAC"l1" +THEN REWRITE_TAC[VECMATS_MATVEC_ID] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p 1<=1 /\ 1

i= p-1 \/ SUC i< p`) +THEN RESA_TAC; +MP_TAC(ARITH_RULE` 2< p ==> p-1< p:num /\ SUC(p-1)=p`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`p-1:num`;`p:num`]; +MP_TAC(ARITH_RULE` i< p /\ 1<= k-p ==> i< k:num /\ i<=k`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`p:num`] +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN STRIP_TAC +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +THEN REMOVE_THEN "THY" MP_TAC +THEN SUBGOAL_THEN`row i ((pmat1 (vecmats l)):real^3^P) = row i (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (SUC i) ((pmat1 (vecmats l)):real^3^P) = row (SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`SUC i < p==> 1<= SUC i /\ SUC i <= p`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`i <= k-p+2 ==> i=k-p+2 \/ i k - (k - p + 2) + i= p-2+i`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (SUC i) ((pmat2 (vecmats l)):real^3^N) = row (p-2+ SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + SUC i= p-2+SUC i/\ 1<= SUC i /\ SUC i<= k-p+2`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +MP_TAC(ARITH_RULE` i< k-p+2 /\ 1<= k-p /\ 2 p-2+ i< k:num /\ p-2+i <=k/\ 1<= p-2+i/\ p-2+ SUC i= SUC(p-2+i)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k-p+2:num`] +THEN MRESA_TAC MOD_LT[`p-2+i:num`;`k:num`] +THEN DISCH_THEN(LABEL_TAC"THY") +THEN STRIP_TAC +THEN EXISTS_TAC`p-2+i` +THEN ASM_REWRITE_TAC[]; +DISJ_CASES_TAC(ARITH_RULE`i< p-1\/ p-1<= i`); +MATCH_MP_TAC(SET_RULE`A==> A\/B`) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`i i< k /\ i<= p /\ i

1<= SUC i /\ SUC i <= p`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[] +THEN MRESA_TAC MOD_LT[`i:num`;`p:num`] +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN DISCH_THEN(LABEL_TAC"THY") +THEN STRIP_TAC; +EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; +REMOVE_THEN "THY" MP_TAC +THEN SUBGOAL_THEN`row (p-1) ((pmat1 (vecmats l)):real^3^P) = row (p-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`2< p ==> p-1 <= p /\ 1<= p-1/\ p-1 row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p 1<= p-1 /\ p-1<= k /\ ~(i=p-1)`) +THEN RESA_TAC +THEN REMOVE_THEN"THY"(fun th-> MRESA_TAC th[`i:num`;`p-1`]); +MP_TAC(ARITH_RULE`i<= k ==> i=k \/ i< k:num`) +THEN RESA_TAC; +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN MATCH_MP_TAC(SET_RULE`A==> A\/B`) +THEN STRIP_TAC; +EXISTS_TAC`p:num` +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"l1" +THEN REWRITE_TAC[VECMATS_MATVEC_ID] +THEN REMOVE_THEN "THY" MP_TAC +THEN SUBGOAL_THEN`1<= p/\ p<= dimindex(:P)==> row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p 1<=1 /\ 1

p-1 <= p /\ 1<= p-1/\ p-1 MRESA_TAC th[`k:num`;`p-1`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`2< p /\ 1<= k-p ==> 1<= p-1 /\ ~(k=p-1)`) +THEN RESA_TAC; +MATCH_MP_TAC(SET_RULE`A==> B\/A`) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`p-1<= i /\ 2< p/\ i< k /\ 1<= k-p ==> 1<= i- (p-2) /\ i-(p-2)<= k-p+2/\ k - (k - p + 2) = p-2 /\ i-(p-2)< k- p+2/\ SUC (i - (p - 2))= SUC i - (p - 2)/\ k<=k`) +THEN RESA_TAC +THEN EXPAND_TAC"l2" +THEN REWRITE_TAC[VECMATS_MATVEC_ID] +THEN REMOVE_THEN "THY" MP_TAC +THEN SUBGOAL_THEN`row (i-(p-2)) ((pmat2 (vecmats l)):real^3^N) = row i (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE` 2

+p-2 + i-(p-2) =i`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row (SUC i -(p-2)) ((pmat2 (vecmats l)):real^3^N) = row (SUC i) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

p-2 + SUC i -(p-2)= SUC i/\ 1<= SUC i -(p-2) /\ SUC i - (p-2)<= k-p+2`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +DISCH_THEN(LABEL_TAC"THY") +THEN STRIP_TAC; +EXISTS_TAC`i-(p-2)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN MRESA_TAC MOD_LT[`i-(p-2):num`;`k-p+2:num`]; +POP_ASSUM MP_TAC +THEN EXPAND_TAC"l2" +THEN REWRITE_TAC[VECMATS_MATVEC_ID] +THEN SUBGOAL_THEN`row (k-p+2) ((pmat2 (vecmats l)):real^3^N) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k-p+2<=k-p+2 /\ 1<= k-p+2 /\ k - (k - p + 2) + k - p + 2= k`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +DISCH_THEN(LABEL_TAC"THY") +THEN ASM_REWRITE_TAC[PAIR_EQ] +THEN STRIP_TAC +THEN REMOVE_THEN"THY"(fun th->MRESA_TAC th[`i:num`;`k:num`]) +THEN MP_TAC(ARITH_RULE`i ~(i=k:num)`) +THEN RESA_TAC]);; + + +let F_SY_COVER_INTER=prove_by_refinement(`!(l:real^(M,3)finite_product) +(l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). +dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p +/\ 1<= k-p +/\ 2

i=j) +==> (F_SY(vecmats l1) DELETE (row (p-1) (vecmats l1), row p (vecmats l1))) INTER (F_SY(vecmats l2) DELETE (row (k-p+2) (vecmats l2), row 1 (vecmats l2))) = {} `, +[REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REWRITE_TAC[F_SY;INTER;IN_ELIM_THM;DELETE;SET_RULE`A={}<=> ~(?a. a IN A)`] +THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` +THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) +/\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p `) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY1") +THEN STRIP_TAC +THEN REMOVE_THEN "THY1"MP_TAC +THEN ASM_REWRITE_TAC[PAIR_EQ] +THEN EXPAND_TAC"l1" +THEN EXPAND_TAC"l2" +THEN REWRITE_TAC[VECMATS_MATVEC_ID] +THEN REMOVE_THEN "THY" MP_TAC +THEN SUBGOAL_THEN`1<= p/\ p<= dimindex(:P)==> row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p k - (k - p + 2) + i'= p-2+i'`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i k<=k /\ 1<= p-2+i' /\ p-2+i'<=k/\ ~(i'=0)`) +THEN RESA_TAC +THEN REMOVE_THEN "THY"(fun th-> MRESA_TAC th[`k:num`;`p-2+i'`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN DISCH_THEN(LABEL_TAC"THY")) +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`k = p - 2 + i'/\ 2

i'= k-p+2`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] +THEN MRESAL_TAC MOD_MULT[`i':num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] +THEN REMOVE_THEN"THY1"MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0=1`] +THEN REMOVE_THEN"THY" MP_TAC +THEN SUBGOAL_THEN`row 1 ((pmat2 (vecmats l)):real^3^N) = row (p-1) (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=k-p/\ 2

k - (k - p + 2) + 1= p-1/\ 1<=1 /\ 1<=k-p+2`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]; +SUBGOAL_THEN`row 1 ((pmat1 (vecmats l)):real^3^P) = row 1 (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +MP_TAC(ARITH_RULE`2 1<=1 /\ 1

MRESA_TAC th[`1:num`;`p-1`] ) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`2< p /\ 1<= k-p ==> 1<=1 /\ 1<= p-1 /\ p-1<=k /\ ~(1=p-1)`) +THEN RESA_TAC; +SUBGOAL_THEN`row i ((pmat1 (vecmats l)):real^3^P) = row i (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; +ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]; +ASM_REWRITE_TAC[] +THEN DISCH_THEN(LABEL_TAC"THY") +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY1") +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN STRIP_TAC +THEN STRIP_TAC +THEN REMOVE_THEN "THY"(fun th-> MRESA_TAC th[`i:num`;`p-2+i'`] ) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`i

i <= k /\ 1 <= p - 2 + i' /\ p - 2 + i' <= k /\ p-1<= p-2+i'`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`i

(i=p-1 /\ i'=1) \/ i< p-2+i'`) +THEN RESA_TAC; +REMOVE_THEN"THY1"MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`i

p-1

(row (p - 1) (vecmats l1),row p (vecmats l1)) IN F_SY (vecmats l1)`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[F_SY;IN_ELIM_THM] +THEN EXISTS_TAC`p-1` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`2 p-1

ear_sy s3) +/\ DIA_SY 0 (p-1) s +/\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 +/\ COVER_SY 0 (p-1) s s1 s2 +/\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) +/\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} +==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) +/\ matvec(pmat1(vecmats l))= l1 +/\ matvec(pmat2(vecmats l))= l2 +/\ 1<= i /\ i<= k-p+2 +==> row i (vecmats l2) = row (p-2+i ) (vecmats l)`, +REPEAT STRIP_TAC +THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` +THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) +/\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 k - (k - p + 2) + i= p-2+i`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat2;LAMBDA_BETA;CART_EQ]);; + +let PMAT1_EQ_SY=prove(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) +(l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). +dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p +/\ 1<= k-p +/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) +/\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) +/\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) +/\ (ear_sy s2 <=> ear_sy s3) +/\ DIA_SY 0 (p-1) s +/\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 +/\ COVER_SY 0 (p-1) s s1 s2 +/\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) +/\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} +==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) +/\ matvec(pmat1(vecmats l))= l1 +/\ matvec(pmat2(vecmats l))= l2 +/\ 1<= i /\ i<= p-1 +==> row i (vecmats l1) = row i (vecmats l)`, +REPEAT STRIP_TAC +THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` +THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) +/\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 i<= p /\ i< p`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[row;pmat1;LAMBDA_BETA;CART_EQ]);; + + +let PMAT1_EQ_SY_P=prove(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) +(l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). +dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p +/\ 1<= k-p +/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) +/\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) +/\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) +/\ (ear_sy s2 <=> ear_sy s3) +/\ DIA_SY 0 (p-1) s +/\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 +/\ COVER_SY 0 (p-1) s s1 s2 +/\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) +/\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} +==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) +/\ matvec(pmat1(vecmats l))= l1 +/\ matvec(pmat2(vecmats l))= l2 +==> row p (vecmats l1) = row k (vecmats l)`, +REPEAT STRIP_TAC +THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` +THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) +/\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 row p ((pmat1 (vecmats l)):real^3^P) = row k (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC +THENL[ASSUME_TAC(ARITH_RULE`p<=p /\ ~(p ITER (i-1) (rho_node1 (F_SY (vecmats l))) v=u`, +[INDUCT_TAC; +ARITH_TAC; +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REPEAT GEN_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`i=0 \/ 1<=i`); +ASM_REWRITE_TAC[ARITH_RULE`1-1=0/\ SUC 0=1`;ITER] +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); +STRIP_TAC +THEN MP_TAC(ARITH_RULE`1<=i /\ SUC i <= dimindex(:M) ==> SUC i- 1= SUC(i-1) /\ i<= dimindex(:M) /\ i< dimindex(:M)`) +THEN RESA_TAC +THEN REMOVE_THEN "THY"(fun th-> MRESA_TAC th[`row i (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`]) +THEN ASM_REWRITE_TAC[ITER] +THEN MATCH_MP_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE) +THEN EXISTS_TAC`V_SY (vecmats (l:real^(M,3)finite_product))` +THEN EXISTS_TAC`E_SY (vecmats (l:real^(M,3)finite_product))` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC EDGE_IN_F_SY +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC MOD_LT[`i:num`;`dimindex(:M)`]]);; + +let RHO_NODE_K_SY=prove(`!(l:real^(M,3)finite_product). local_fan (V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l),F_SY (vecmats l)) +/\ dimindex(:M)=k +/\ row k (vecmats l)=u +/\ row 1 (vecmats l)=v +==> (rho_node1 (F_SY (vecmats l))) u=v`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE) +THEN EXISTS_TAC`V_SY (vecmats (l:real^(M,3)finite_product))` +THEN EXISTS_TAC`E_SY (vecmats (l:real^(M,3)finite_product))` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC (GEN_ALL EDGE_IN_F_SY) +THEN EXISTS_TAC`k:num` +THEN ASM_REWRITE_TAC[] +THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` +THEN MP_TAC(ARITH_RULE`1<=k==> k<=k /\ ~(k=0)/\ SUC 0=1`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`]);; + + +let RHO_NODE_SY=prove(`!i (l:real^(M,3)finite_product). local_fan (V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l),F_SY (vecmats l)) +/\ 1<= i /\ i<= dimindex (:M) +==> (rho_node1 (F_SY (vecmats l))) (row i (vecmats l))=row (SUC (i MOD dimindex (:M))) (vecmats l)`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE) +THEN EXISTS_TAC`V_SY (vecmats (l:real^(M,3)finite_product))` +THEN EXISTS_TAC`E_SY (vecmats (l:real^(M,3)finite_product))` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC (GEN_ALL EDGE_IN_F_SY) +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` +THEN MP_TAC(ARITH_RULE`1<=k==> k<=k /\ ~(k=0)/\ SUC 0=1`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`]);; + + +let ORDER_COVER1_SY=prove(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) +(l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). +dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p +/\ 1<= k-p +/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) +/\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) +/\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) +/\ (ear_sy s2 <=> ear_sy s3) +/\ DIA_SY 0 (p-1) s +/\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 +/\ COVER_SY 0 (p-1) s s1 s2 +/\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) +/\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} +==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) +/\ matvec(pmat1(vecmats l))= l1 +/\ matvec(pmat2(vecmats l))= l2 +/\ row k (vecmats l)= v +/\ row (p-1) (vecmats l)= w +==> order (rho_node1 (F_SY (vecmats l))) v w = p-1`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` +THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) +/\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN MP_TAC(ARITH_RULE`2

1<= p-1 /\ p-1<=k/\ p-1= SUC(p-1-1)`) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`p-1`;`w:real^3`;`l:real^(M,3)finite_product`] +THEN STRIP_TAC +THENL[ +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN STRIP_TAC +THEN REMOVE_THEN"THY"(fun th-> ONCE_REWRITE_TAC[th;]) +THEN REWRITE_TAC[POWER;o_DEF] +THEN MRESA_TAC (GEN_ALL RHO_NODE_K_SY)[`k:num`;`v:real^3`;`row 1 (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`]; +STRIP_TAC +THENL[ +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`0 1<=i /\ i<=k/\ i= SUC(i-1)`) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`i:num`;`row i (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN STRIP_TAC +THEN REMOVE_THEN"THY"(fun th-> ONCE_REWRITE_TAC[th;]) +THEN REWRITE_TAC[POWER;o_DEF] +THEN MRESA_TAC (GEN_ALL RHO_NODE_K_SY)[`k:num`;`v:real^3`;`row 1 (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] +THEN STRIP_TAC +THEN MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ + (1 <= j /\ j <= k) /\ + row i (vecmats l) = row j (vecmats l) +<=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ + row i (vecmats l) = row j (vecmats l)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`p-1:num`]) +THEN MP_TAC(ARITH_RULE`i< p-1 ==> ~(i=p-1)`) +THEN RESA_TAC; +STRIP_TAC +THEN MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ + (1 <= j /\ j <= k) /\ + row i (vecmats l) = row j (vecmats l) +<=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ + row i (vecmats l) = row j (vecmats l)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-1:num`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= k-p ==> k<=k/\ ~(k=p-1)`) +THEN RESA_TAC]]);; + + +let SLICEV_EQ_V_SY=prove_by_refinement(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) +(l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). +dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p +/\ 1<= k-p +/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) +/\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) +/\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) +/\ (ear_sy s2 <=> ear_sy s3) +/\ DIA_SY 0 (p-1) s +/\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 +/\ COVER_SY 0 (p-1) s s1 s2 +/\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) +/\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} +==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) +/\ matvec(pmat1(vecmats l))= l1 +/\ matvec(pmat2(vecmats l))= l2 +/\ row k (vecmats l)= v +/\ row (p-1) (vecmats l)= w +==> slicev (E_SY (vecmats l)) (F_SY (vecmats l)) v w = V_SY(vecmats l1)`, +[REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` +THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) +/\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN MP_TAC(ARITH_RULE`0 1<=n /\ n<=k/\ n<=p/\ n= SUC(n-1)`) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`n:num`;`row n (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN STRIP_TAC +THEN REMOVE_THEN"THY"(fun th-> ONCE_REWRITE_TAC[th;]) +THEN REWRITE_TAC[POWER;o_DEF] +THEN MRESA_TAC (GEN_ALL RHO_NODE_K_SY)[`k:num`;`v:real^3`;`row 1 (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] +THEN EXISTS_TAC`n:num` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`n:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]; +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`i<= p ==> i=p \/ i< p:num`) +THEN RESA_TAC; +ASM_REWRITE_TAC[ITER] +THEN EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[ITER;ARITH_RULE`0<=0`] +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MP_TAC(ARITH_RULE`2 0<= p-1`) +THEN RESA_TAC; +FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;convex_local_fan;] +THEN STRIP_TAC +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v':real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`1<=i /\ i< p /\ 1<= k-p ==> 0<=i/\ 1<=i /\ i<=p-1/\ i<=k/\ i= SUC(i-1)`) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`i:num`;`row i (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN STRIP_TAC +THEN REMOVE_THEN"THY"(fun th-> ONCE_REWRITE_TAC[th;]) +THEN REWRITE_TAC[POWER;o_DEF] +THEN MRESA_TAC (GEN_ALL RHO_NODE_K_SY)[`k:num`;`v:real^3`;`row 1 (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] +THEN MP_TAC(ARITH_RULE`1<=i /\ i< p /\ 1<= k-p ==> SUC(i-1)=i`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`i:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]]);; + + +let SLICEE_EQ_E_SY=prove_by_refinement(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) +(l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). +dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p +/\ 1<= k-p +/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) +/\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) +/\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) +/\ (ear_sy s2 <=> ear_sy s3) +/\ DIA_SY 0 (p-1) s +/\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 +/\ COVER_SY 0 (p-1) s s1 s2 +/\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) +/\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} +==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) +/\ matvec(pmat1(vecmats l))= l1 +/\ matvec(pmat2(vecmats l))= l2 +/\ row k (vecmats l)= v +/\ row (p-1) (vecmats l)= w +==> slicee (E_SY (vecmats l)) (F_SY (vecmats l)) v w = E_SY(vecmats l1)`, +[REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` +THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) +/\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN MP_TAC(ARITH_RULE`2

i<= k/\ 1<=1/\ 1<= p-1 `) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL RHO_NODE_SY)[`i:num`;`l:real^(M,3)finite_product`] +THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i SUBST_ALL_TAC(th)) +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN EXISTS_TAC`p:num` +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] +THEN MRESA_TAC (GEN_ALL RHO_NODE_K_SY)[`k:num`;`v:real^3`;`row 1 (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`1:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]; +MP_TAC(ARITH_RULE`1<=i /\ i< p /\ 1<= k-p ==> 0<=i/\ 1<=i /\ i<=p-1/\ i i= p-1 \/ SUC i<= p-1`) +THEN RESA_TAC; +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN ASM_TAC +THEN REPEAT RESA_TAC; +MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`SUC(i):num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]; +EXISTS_TAC`p-1` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`2

p-1<= p/\ 1<=p-1/\ p-1

REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN MP_TAC(ARITH_RULE`2

i<= k/\ 1<=1/\ 1<= p-1 `) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`i<=p ==> i= p \/ i< p:num`) +THEN RESA_TAC; +MATCH_MP_TAC (SET_RULE`A==> A\/B`) +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] +THEN MRESA_TAC (GEN_ALL RHO_NODE_K_SY)[`k:num`;`v:real^3`;`row 1 (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`1:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN STRIP_TAC; +EXISTS_TAC`p:num` +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THEN MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ + (1 <= j /\ j <= k) /\ + row i (vecmats l) = row j (vecmats l) +<=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ + row i (vecmats l) = row j (vecmats l)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-1:num`;`k:num`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= k-p /\ 2< p==> p-1<=k /\ k<=k /\ ~(p-1=k)`) +THEN RESA_TAC; +MP_TAC(ARITH_RULE`i

i= p-1 \/ SUC i<= p-1`) +THEN RESA_TAC; +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN MATCH_MP_TAC(SET_RULE`A==> B\/A`) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`2

p-1<= p/\ 1<=p-1/\ p-1

A\/B`) +THEN MP_TAC(ARITH_RULE`1<=i /\ i< p /\ 1<= k-p ==> 0<=i/\ 1<=i /\ i<=p-1/\ i 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ + row i (vecmats l) = row j (vecmats l)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-1:num`;`i:num`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= k-p /\ 2< p /\ SUC i<= p-1 ==> p-1<=k /\ ~(p-1=i)`) +THEN RESA_TAC]);; + +let SLICEF_EQ_F_SY=prove_by_refinement(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) +(l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). +dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p +/\ 1<= k-p +/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) +/\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) +/\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) +/\ (ear_sy s2 <=> ear_sy s3) +/\ DIA_SY 0 (p-1) s +/\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 +/\ COVER_SY 0 (p-1) s s1 s2 +/\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) +/\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} +==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) +/\ matvec(pmat1(vecmats l))= l1 +/\ matvec(pmat2(vecmats l))= l2 +/\ row k (vecmats l)= v +/\ row (p-1) (vecmats l)= w +==> slicef (E_SY (vecmats l)) (F_SY (vecmats l)) v w = F_SY(vecmats l1)`, +[REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` +THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) +/\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN MP_TAC(ARITH_RULE`2

i<= k/\ 1<=1/\ 1<= p-1 `) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL RHO_NODE_SY)[`i:num`;`l:real^(M,3)finite_product`] +THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i SUBST_ALL_TAC(th)) +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN EXISTS_TAC`p:num` +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] +THEN MRESA_TAC (GEN_ALL RHO_NODE_K_SY)[`k:num`;`v:real^3`;`row 1 (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`1:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]; +MP_TAC(ARITH_RULE`1<=i /\ i< p /\ 1<= k-p ==> 0<=i/\ 1<=i /\ i<=p-1/\ i i= p-1 \/ SUC i<= p-1`) +THEN RESA_TAC; +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN ASM_TAC +THEN REPEAT RESA_TAC; +MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`SUC(i):num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]; +REWRITE_TAC[F_SY;IN_ELIM_THM] +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`p-1` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`2

p-1<= p/\ 1<=p-1/\ p-1

REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN MP_TAC(ARITH_RULE`2

i<= k/\ 1<=1/\ 1<= p-1 `) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`i<=p ==> i= p \/ i< p:num`) +THEN RESA_TAC; +MATCH_MP_TAC (SET_RULE`A==> A\/B`) +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC MOD_MULT[`p:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] +THEN MRESA_TAC (GEN_ALL RHO_NODE_K_SY)[`k:num`;`v:real^3`;`row 1 (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`1:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN STRIP_TAC; +EXISTS_TAC`p:num` +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THEN MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ + (1 <= j /\ j <= k) /\ + row i (vecmats l) = row j (vecmats l) +<=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ + row i (vecmats l) = row j (vecmats l)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-1:num`;`k:num`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= k-p /\ 2< p==> p-1<=k /\ k<=k /\ ~(p-1=k)`) +THEN RESA_TAC; +MP_TAC(ARITH_RULE`i

i= p-1 \/ SUC i<= p-1`) +THEN RESA_TAC; +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN MATCH_MP_TAC(SET_RULE`A==> B\/A`) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`2

p-1<= p/\ 1<=p-1/\ p-1

A\/B`) +THEN MP_TAC(ARITH_RULE`1<=i /\ i< p /\ 1<= k-p ==> 0<=i/\ 1<=i /\ i<=p-1/\ i 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ + row i (vecmats l) = row j (vecmats l)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-1:num`;`i:num`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= k-p /\ 2< p /\ SUC i<= p-1 ==> p-1<=k /\ ~(p-1=i)`) +THEN RESA_TAC]);; + +let ORDER_COVER2_SY=prove(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) +(l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). +dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p +/\ 1<= k-p +/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) +/\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) +/\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) +/\ (ear_sy s2 <=> ear_sy s3) +/\ DIA_SY 0 (p-1) s +/\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 +/\ COVER_SY 0 (p-1) s s1 s2 +/\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) +/\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} +==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) +/\ matvec(pmat1(vecmats l))= l1 +/\ matvec(pmat2(vecmats l))= l2 +/\ row k (vecmats l)= v +/\ row (p-1) (vecmats l)= w +==> order (rho_node1 (F_SY (vecmats l))) w v = k-p+1`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` +THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) +/\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN MP_TAC(ARITH_RULE`2

1<= p-1 /\ p-1<=k/\ p-1= SUC(p-1-1) /\ (k - p + 1) + p - 1 - 1 =k-1`) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`p-1`;`w:real^3`;`l:real^(M,3)finite_product`] +THEN STRIP_TAC +THENL[POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN STRIP_TAC +THEN REWRITE_TAC[POWER;o_DEF] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;GSYM Hypermap.lemma_add_exponent_function]) +THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`k:num`;`v:real^3`;`l:real^(M,3)finite_product`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ARITH_TAC; +STRIP_TAC +THENL[ +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`0 1<=i+p-1 /\ i+p-1<=k/\ i= SUC(i-1)/\ (i + p - 1) - 1 =i + p - 1 - 1`) +THEN RESA_TAC +THEN REMOVE_THEN"THY"(fun th-> ASM_REWRITE_TAC[SYM th;GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER;GSYM Hypermap.lemma_add_exponent_function]) +THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`i+p-1:num`;`row (i+p-1) (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ + (1 <= j /\ j <= k) /\ + row i (vecmats l) = row j (vecmats l) +<=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ + row i (vecmats l) = row j (vecmats l)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i+p-1:num`;`k:num`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`i< k-p+1 /\2

~(i+p-1=k) /\ k<=k`) +THEN RESA_TAC; +STRIP_TAC +THEN MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ + (1 <= j /\ j <= k) /\ + row i (vecmats l) = row j (vecmats l) +<=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ + row i (vecmats l) = row j (vecmats l)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-1:num`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= k-p ==> k<=k/\ ~(k=p-1)`) +THEN RESA_TAC]]);; + +let SLICEV_EQ_V2_SY=prove(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) +(l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). +dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p +/\ 1<= k-p +/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) +/\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) +/\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) +/\ (ear_sy s2 <=> ear_sy s3) +/\ DIA_SY 0 (p-1) s +/\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 +/\ COVER_SY 0 (p-1) s s1 s2 +/\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) +/\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} +==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) +/\ matvec(pmat1(vecmats l))= l1 +/\ matvec(pmat2(vecmats l))= l2 +/\ row k (vecmats l)= v +/\ row (p-1) (vecmats l)= w +==> slicev (E_SY (vecmats l)) (F_SY (vecmats l)) w v = V_SY(vecmats l2)`, +REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` +THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) +/\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN MP_TAC(ARITH_RULE`2

1<= p-1 /\ p-1<=k/\ p-1= SUC(p-1-1) /\ (k - p + 1) + p - 1 - 1 =k-1/\ 1<= n+p-1 /\ n+p-1<=k +/\ (n+p-1)-1=n+p-1-1 /\ 1<= n+1 /\ n+1<= k-p+2/\ p-2+n+1=n+p-1`) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`p-1`;`w:real^3`;`l:real^(M,3)finite_product`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER;GSYM Hypermap.lemma_add_exponent_function]) +THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`n+p-1:num`;`row (n+p-1) (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN RESA_TAC +THEN EXISTS_TAC`n+1` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`n+1`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]; +RESA_TAC +THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`i:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;convex_local_fan;] +THEN STRIP_TAC +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v':real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN EXISTS_TAC`i-1` +THEN MP_TAC(ARITH_RULE`2

0<= i-1 /\ i-1<=k-p+1/\ 1<= p-1 /\ p-1<=k/\ 1<=p-2+i /\ p-2+i<=k /\ (p - 2 + i) - 1=i - 1 + p - 1 - 1`) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`p-1`;`w:real^3`;`l:real^(M,3)finite_product`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER;GSYM Hypermap.lemma_add_exponent_function]) +THEN MRESA_TAC(GEN_ALL POWER_RHO_NODE_SY)[`row 1 (vecmats (l:real^(M,3)finite_product))`;`p-2+i:num`;`row (p-2+i) (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN RESA_TAC]);; + + + +let SLICEE_EQ_E2_SY=prove_by_refinement(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) +(l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). +dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p +/\ 1<= k-p +/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) +/\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) +/\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) +/\ (ear_sy s2 <=> ear_sy s3) +/\ DIA_SY 0 (p-1) s +/\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 +/\ COVER_SY 0 (p-1) s s1 s2 +/\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) +/\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} +==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) +/\ matvec(pmat1(vecmats l))= l1 +/\ matvec(pmat2(vecmats l))= l2 +/\ row k (vecmats l)= v +/\ row (p-1) (vecmats l)= w +==> slicee (E_SY (vecmats l)) (F_SY (vecmats l)) w v = E_SY(vecmats l2)`, +[REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` +THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) +/\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN MP_TAC(ARITH_RULE`2

1<=p-2+i /\ p-2+i<=k `) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL RHO_NODE_SY)[`p-2+i:num`;`l:real^(M,3)finite_product`] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`i<= k-p+2==> i= k-p+2 \/ i< k-p+2`) +THEN RESA_TAC; +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`2

p-2+k-p+2=k`) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; +MP_TAC(ARITH_RULE`2

p-2+i p-2+k-p+2=k/\ k-p+2<=k-p+2/\ 1<=1/\ p-2+1=p-1`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`k-p+2`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] +THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`1`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]; +RESA_TAC +THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`i:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MP_TAC(ARITH_RULE`i<=k-p+2==> i= k-p+2 \/ i< k-p+2`) +THEN RESA_TAC; +MATCH_MP_TAC(SET_RULE`A==> B\/A`) +THEN MP_TAC(ARITH_RULE`1<=k-p /\ 2 p-2+k-p+2=k/\ k-p+2<=k-p+2/\ 1<=1/\ p-2+1=p-1`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] +THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`1`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]; +MATCH_MP_TAC(SET_RULE`A==> A\/B`) +THEN MP_TAC(ARITH_RULE`2

p-2+i REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN MP_TAC(ARITH_RULE`2

1<=p-2+i /\ p-2+i<=k `) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL RHO_NODE_SY)[`p-2+i:num`;`l:real^(M,3)finite_product`] +THEN STRIP_TAC; +EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THEN MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ + (1 <= j /\ j <= k) /\ + row i (vecmats l) = row j (vecmats l) +<=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ + row i (vecmats l) = row j (vecmats l)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-2+i:num`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= k-p/\ i< k-p+2 /\ 2

k<=k/\ ~(k=p-2+i)`) +THEN RESA_TAC]);; + +let SLICEF_EQ_F2_SY=prove_by_refinement(`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) +(l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). +dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p +/\ 1<= k-p +/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) +/\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) +/\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) +/\ (ear_sy s2 <=> ear_sy s3) +/\ DIA_SY 0 (p-1) s +/\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 +/\ COVER_SY 0 (p-1) s s1 s2 +/\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) +/\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} +==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) +/\ matvec(pmat1(vecmats l))= l1 +/\ matvec(pmat2(vecmats l))= l2 +/\ row k (vecmats l)= v +/\ row (p-1) (vecmats l)= w +==> slicef (E_SY (vecmats l)) (F_SY (vecmats l)) w v = F_SY(vecmats l2)`, +[REPEAT GEN_TAC THEN STRIP_TAC +THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` +THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) +/\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN MP_TAC(ARITH_RULE`2

1<=p-2+i /\ p-2+i<=k `) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL RHO_NODE_SY)[`p-2+i:num`;`l:real^(M,3)finite_product`] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`i<= k-p+2==> i= k-p+2 \/ i< k-p+2`) +THEN RESA_TAC; +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`2

p-2+k-p+2=k`) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; +MP_TAC(ARITH_RULE`2

p-2+i p-2+k-p+2=k/\ k-p+2<=k-p+2/\ 1<=1/\ p-2+1=p-1`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`k-p+2`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] +THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`1`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]; +GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[F_SY;IN_ELIM_THM] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`i:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MP_TAC(ARITH_RULE`i<=k-p+2==> i= k-p+2 \/ i< k-p+2`) +THEN RESA_TAC; +MATCH_MP_TAC(SET_RULE`A==> B\/A`) +THEN MP_TAC(ARITH_RULE`1<=k-p /\ 2 p-2+k-p+2=k/\ k-p+2<=k-p+2/\ 1<=1/\ p-2+1=p-1`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT[`k-p+2:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] +THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`1`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`]; +MATCH_MP_TAC(SET_RULE`A==> A\/B`) +THEN MP_TAC(ARITH_RULE`2

p-2+i REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN MP_TAC(ARITH_RULE`2

1<=p-2+i /\ p-2+i<=k `) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL RHO_NODE_SY)[`p-2+i:num`;`l:real^(M,3)finite_product`] +THEN STRIP_TAC; +EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THEN MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ + (1 <= j /\ j <= k) /\ + row i (vecmats l) = row j (vecmats l) +<=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ + row i (vecmats l) = row j (vecmats l)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-2+i:num`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= k-p/\ i< k-p+2 /\ 2

k<=k/\ ~(k=p-2+i)`) +THEN RESA_TAC]);; + + + + +let TAU_STAR_COVER_concl=`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) +(l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). +dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p +/\ 1<= k-p +/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) +/\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) +/\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) +/\ (ear_sy s2 <=> ear_sy s3) +/\ DIA_SY 0 (p-1) s +/\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 +/\ COVER_SY 0 (p-1) s s1 s2 +/\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) +/\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} +==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) +/\ matvec(pmat1(vecmats l))= l1 +/\ matvec(pmat2(vecmats l))= l2 +/\ row k (vecmats l)= v +/\ row (p-1) (vecmats l)= w +/\ (!u u1. + u IN {v, w} /\ u1 IN V_SY(vecmats l) /\ ~(u = u1) + ==> ~collinear {vec 0, u, u1}) +==> tau_star s1 l1 + tau_star s3 l2 <= tau_star s l` +;; + +let TAU_STAR_COVER_concl2 = mk_imp (EJRCFJD_concl, TAU_STAR_COVER_concl);; + + + + + + + +let TAU_STAR_COVER=prove_by_refinement(TAU_STAR_COVER_concl2, +[DISCH_THEN(LABEL_TAC"THY") +THEN REPEAT STRIP_TAC +THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` +THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) +/\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 p - 2 + k - p + 2= k/\ p-2+1=p-1 /\ 1<=p-1 /\ p-1<=k /\ p-1 {A,B}SUBSET C`) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM;V_SY;rows]; +EXISTS_TAC`k:num` +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; +EXISTS_TAC`p-1` +THEN ASM_REWRITE_TAC[]; +SUBGOAL_THEN`norm (v - w:real^3) <= cstab`ASSUME_TAC; +MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] +THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] +THEN FIND_ASSUM (fun th-> MP_TAC(ISPECL [`k:num`;`p-1`]th))`!i j. + {i MOD k, j MOD k} IN J_SY s UNION {{0, p - 1}} + ==> norm (row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))) <= cstab` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th; SET_RULE`{0,p-1} IN J_SY s UNION {{0,p-1}}`]) +THEN ASM_REWRITE_TAC[]; +SUBGOAL_THEN`~({v, w} IN E_SY (vecmats (l:real^(M,3)finite_product)))`ASSUME_TAC; +ASM_REWRITE_TAC[E_SY;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;convex_local_fan;local_fan] +THEN LET_TAC +THEN STRIP_TAC +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v':real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`i:num`;`row (i) (vecmats(l:real^(M,3)finite_product))`;` + (row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(l:real^(M,3)finite_product)`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;` + (row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`row i (vecmats(l:real^(M,3)finite_product))`] +THEN DISJ_CASES_TAC(SET_RULE`row k (vecmats l)= row (p - 1) (vecmats l) +\/ ~(row k (vecmats l)= row (p - 1) (vecmats (l:real^(M,3)finite_product)))`); +MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ + (1 <= j /\ j <= k) /\ + row i (vecmats l) = row j (vecmats l) +<=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ + row i (vecmats l) = row j (vecmats l)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-1`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`1 <= SUC (i' MOD dimindex (:M)) /\ + SUC (i' MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i':num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{row k (vecmats l), row (p - 1) (vecmats l)} = + {row i (vecmats l), row (SUC (i MOD k)) (vecmats l)} +/\ ~(row k (vecmats l) = row (p - 1) (vecmats l)) +/\ ~(row i (vecmats l) = row (SUC (i MOD k)) (vecmats l)) +==> (row i (vecmats l) = row (k) (vecmats l) +/\ row (p-1) (vecmats l) = row (SUC (i MOD k)) (vecmats l)) +\/ (row i (vecmats l) = row (p-1) (vecmats l) +/\ row (k) (vecmats l) = row (SUC (i MOD k)) (vecmats (l:real^(M,3)finite_product)))`) +THEN RESA_TAC; +MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ + (1 <= j /\ j <= k) /\ + row i (vecmats l) = row j (vecmats l) +<=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ + row i (vecmats l) = row j (vecmats l)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`k:num`] THEN MRESA_TAC th[`p-1:num`;`SUC(i MOD k):num`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] +THEN MP_TAC(ARITH_RULE`2 ~(p-1=1)/\ 1<=1`) +THEN RESA_TAC; +MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ + (1 <= j /\ j <= k) /\ + row i (vecmats l) = row j (vecmats l) +<=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ + row i (vecmats l) = row j (vecmats l)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`p-1:num`] THEN MRESA_TAC th[`k:num`;`SUC(i MOD k):num`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`2

~(k= SUC (p-1))/\ 1<= SUC(p-1)/\ SUC(p-1)<=k`) +THEN RESA_TAC; +MRESA_TAC (GEN_ALL PROPERTIES_OF_FAN_IN_B_SY)[`d_sy (s:stable_sy)`;`J_SY (s:stable_sy)`;`k_sy (s:stable_sy)`;`k:num`;`p-1:num`;`a_sy (s:stable_sy)`;`b_sy (s:stable_sy)`;`row k (vecmats (l:real^(M,3)finite_product))`;`row (p-1) (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] +THEN MRESAL_TAC(GEN_ALL TECOXBM1)[`d_sy (s:stable_sy)`;`J_SY(s:stable_sy)`;`k:num`;`a_sy(s:stable_sy)`;`b_sy(s:stable_sy)`;`row k (vecmats (l:real^(M,3)finite_product))`;`row (p-1) (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`][SET_RULE`{A} UNION {B,C}={A,B,C}`] +THEN MP_TAC(SET_RULE`{v, w} SUBSET V_SY (vecmats l)==> v IN V_SY (vecmats l) +/\ w IN V_SY (vecmats (l:real^(M,3)finite_product))`) +THEN RESA_TAC +THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;] +THEN STRIP_TAC +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v':real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN MRESA_TAC (GEN_ALL SLICEV_EQ_V_SY)[`k:num`;`p:num`;`v:real^3`;`w:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL SLICEE_EQ_E_SY)[`k:num`;`p:num`;`v:real^3`;`w:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL SLICEF_EQ_F_SY)[`k:num`;`p:num`;`v:real^3`;`w:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL SLICEF_EQ_F2_SY)[`k:num`;`p:num`;`w:real^3`;`v:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL SLICEE_EQ_E2_SY)[`k:num`;`p:num`;`w:real^3`;`v:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL SLICEV_EQ_V2_SY)[`k:num`;`p:num`;`w:real^3`;`v:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN REMOVE_THEN"THY"(fun th-> MRESA_TAC th[`V_SY(vecmats (l:real^(M,3)finite_product))`;`E_SY(vecmats (l:real^(M,3)finite_product))`;`F_SY(vecmats (l:real^(M,3)finite_product))`; +`v:real^3`;`w:real^3`]) +THEN MRESA_TAC(GEN_ALL D_FUN_COVER_SY)[`k:num`;`p:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]);; + + + +let IN_B_SY_COVER_concl=`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) +(l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). +dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p +/\ 1<= k-p +/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) +/\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) +/\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) +/\ (ear_sy s2 <=> ear_sy s3) +/\ DIA_SY 0 (p-1) s +/\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 +/\ COVER_SY 0 (p-1) s s1 s2 +/\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) +/\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} +==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) +/\ matvec(pmat1(vecmats l))= l1 +/\ matvec(pmat2(vecmats l))= l2 +/\ row k (vecmats l)= v +/\ row (p-1) (vecmats l)= w +/\ (!u u1. + u IN {v, w} /\ u1 IN V_SY(vecmats l) /\ ~(u = u1) + ==> ~collinear {vec 0, u, u1}) +/\ norm(v-w)<= min (b_sy s1 (p-1,0)) (b_sy s2 (p-1,0)) +==> l1 IN (B_SY1 (a_sy s1) (b_sy s1))`;; + + +let IN_B_SY_COVER_concl2 = mk_imp (EJRCFJD_concl, IN_B_SY_COVER_concl);; + + + + + +let IN_B_SY_COVER=prove_by_refinement(IN_B_SY_COVER_concl2, +[DISCH_THEN(LABEL_TAC"THY") +THEN REPEAT STRIP_TAC +THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` +THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) +/\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 p - 2 + k - p + 2= k/\ p-2+1=p-1 /\ 1<=p-1 /\ p-1<=k /\ p-1 {A,B}SUBSET C`) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM;V_SY;rows]; +EXISTS_TAC`k:num` +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; +EXISTS_TAC`p-1` +THEN ASM_REWRITE_TAC[]; +SUBGOAL_THEN`norm (v - w:real^3) <= cstab`ASSUME_TAC; +MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] +THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] +THEN FIND_ASSUM (fun th-> MP_TAC(ISPECL [`k:num`;`p-1`]th))`!i j. + {i MOD k, j MOD k} IN J_SY s UNION {{0, p - 1}} + ==> norm (row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))) <= cstab` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th; SET_RULE`{0,p-1} IN J_SY s UNION {{0,p-1}}`]) +THEN ASM_REWRITE_TAC[]; +SUBGOAL_THEN`~({v, w} IN E_SY (vecmats (l:real^(M,3)finite_product)))`ASSUME_TAC; +ASM_REWRITE_TAC[E_SY;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;convex_local_fan;local_fan] +THEN LET_TAC +THEN STRIP_TAC +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v':real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`i:num`;`row (i) (vecmats(l:real^(M,3)finite_product))`;` + (row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(l:real^(M,3)finite_product)`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;` + (row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`row i (vecmats(l:real^(M,3)finite_product))`] +THEN DISJ_CASES_TAC(SET_RULE`row k (vecmats l)= row (p - 1) (vecmats l) +\/ ~(row k (vecmats l)= row (p - 1) (vecmats (l:real^(M,3)finite_product)))`); +MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ + (1 <= j /\ j <= k) /\ + row i (vecmats l) = row j (vecmats l) +<=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ + row i (vecmats l) = row j (vecmats l)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-1`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`1 <= SUC (i' MOD dimindex (:M)) /\ + SUC (i' MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i':num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{row k (vecmats l), row (p - 1) (vecmats l)} = + {row i (vecmats l), row (SUC (i MOD k)) (vecmats l)} +/\ ~(row k (vecmats l) = row (p - 1) (vecmats l)) +/\ ~(row i (vecmats l) = row (SUC (i MOD k)) (vecmats l)) +==> (row i (vecmats l) = row (k) (vecmats l) +/\ row (p-1) (vecmats l) = row (SUC (i MOD k)) (vecmats l)) +\/ (row i (vecmats l) = row (p-1) (vecmats l) +/\ row (k) (vecmats l) = row (SUC (i MOD k)) (vecmats (l:real^(M,3)finite_product)))`) +THEN RESA_TAC; +MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ + (1 <= j /\ j <= k) /\ + row i (vecmats l) = row j (vecmats l) +<=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ + row i (vecmats l) = row j (vecmats l)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`k:num`] THEN MRESA_TAC th[`p-1:num`;`SUC(i MOD k):num`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] +THEN MP_TAC(ARITH_RULE`2 ~(p-1=1)/\ 1<=1`) +THEN RESA_TAC; +MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ + (1 <= j /\ j <= k) /\ + row i (vecmats l) = row j (vecmats l) +<=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ + row i (vecmats l) = row j (vecmats l)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`p-1:num`] THEN MRESA_TAC th[`k:num`;`SUC(i MOD k):num`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`2

~(k= SUC (p-1))/\ 1<= SUC(p-1)/\ SUC(p-1)<=k`) +THEN RESA_TAC; +MRESA_TAC (GEN_ALL PROPERTIES_OF_FAN_IN_B_SY)[`d_sy (s:stable_sy)`;`J_SY (s:stable_sy)`;`k_sy (s:stable_sy)`;`k:num`;`p-1:num`;`a_sy (s:stable_sy)`;`b_sy (s:stable_sy)`;`row k (vecmats (l:real^(M,3)finite_product))`;`row (p-1) (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] +THEN MRESAL_TAC(GEN_ALL TECOXBM1)[`d_sy (s:stable_sy)`;`J_SY(s:stable_sy)`;`k:num`;`a_sy(s:stable_sy)`;`b_sy(s:stable_sy)`;`row k (vecmats (l:real^(M,3)finite_product))`;`row (p-1) (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`][SET_RULE`{A} UNION {B,C}={A,B,C}`] +THEN MP_TAC(SET_RULE`{v, w} SUBSET V_SY (vecmats l)==> v IN V_SY (vecmats l) +/\ w IN V_SY (vecmats (l:real^(M,3)finite_product))`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL SLICEV_EQ_V_SY)[`k:num`;`p:num`;`v:real^3`;`w:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL SLICEE_EQ_E_SY)[`k:num`;`p:num`;`v:real^3`;`w:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL SLICEF_EQ_F_SY)[`k:num`;`p:num`;`v:real^3`;`w:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL SLICEF_EQ_F2_SY)[`k:num`;`p:num`;`w:real^3`;`v:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL SLICEE_EQ_E2_SY)[`k:num`;`p:num`;`w:real^3`;`v:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL SLICEV_EQ_V2_SY)[`k:num`;`p:num`;`w:real^3`;`v:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;] +THEN STRIP_TAC +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v':real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN REMOVE_THEN"THY"(fun th-> MRESA_TAC th[`V_SY(vecmats (l:real^(M,3)finite_product))`;`E_SY(vecmats (l:real^(M,3)finite_product))`;`F_SY(vecmats (l:real^(M,3)finite_product))`; +`v:real^3`;`w:real^3`]) +THEN EXISTS_TAC`vecmats(l1:real^(P,3)finite_product)` +THEN ASM_REWRITE_TAC[MATVEC_VECMATS_ID] +THEN STRIP_TAC; +REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`i<=p ==> i=p \/ i<= p-1:num`) +THEN RESA_TAC; +MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`k:num`); +MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`i:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i:num`) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MA") +THEN STRIP_TAC +THEN STRIP_TAC +THEN REMOVE_THEN"MA" MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`i<=p /\1<=k-p ==> i<=k`) +THEN RESA_TAC; +ASM_REWRITE_TAC[CONDITION1_SY] +THEN FIND_ASSUM MP_TAC`COVER_SY 0 (p - 1) s s1 (s2:stable_sy)` +THEN REWRITE_TAC[COVER_SY;COVER5_SY;COVER4_SY;] +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THYGIANG") +THEN DISCH_THEN(LABEL_TAC"THYGIANG1") +THEN DISCH_THEN(LABEL_TAC"THYGIANG2") +THEN DISCH_THEN(LABEL_TAC"THYGIANG3") +THEN DISCH_THEN(LABEL_TAC"THYGIANG4") +THEN DISCH_THEN(LABEL_TAC"THYGIANG5") +THEN REPEAT GEN_TAC +THEN STRIP_TAC; +MP_TAC(ARITH_RULE`i<=p==> i=p \/ i

j=p \/ j

~(0= p-1)/\ 0<=0 /\ 0<= p-1/\ 1

~({0,0}= {0,p-1})`) +THEN RESA_TAC +THEN REMOVE_THEN"THYGIANG"(fun th-> MRESAL_TAC th[`0:num`;`0:num`][IN_NUMSEG]) +THEN MRESAL1_TAC stable_sy_lemma`s1:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`0:num`;`p:num`] THEN MRESA_TAC th[`p:num`;`p:num`]) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`p:num`;`p:num`;`p:num`] +THEN MRESAL_TAC MOD_MULT[`p:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`0`) +THEN REWRITE_TAC[VECTOR_ARITH`A-A= vec 0`;NORM_0;REAL_ARITH`&0<= &0`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`0`;`0`]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th]); +MP_TAC(ARITH_RULE`j

j=p-1 \/ j ~(0= p-1)/\ 0<=0 /\ 0<= p-1/\ 1

~({0,0}= {0,p-1})`) +THEN RESA_TAC +THEN MRESAL1_TAC stable_sy_lemma`s1:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`p-1:num`;`p:num`] ) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`p:num`;`p:num`;`p:num`] +THEN MRESAL_TAC MOD_MULT[`p:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`p-1:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] +THEN STRIP_TAC +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-1`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`p-1:num`;`k:num`] ) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] +THEN REMOVE_THEN"THYGIANG2"MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC; +REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +FIND_ASSUM MP_TAC`norm (v - w:real^3) <= min (b_sy s1 (p - 1,0)) (b_sy s2 (p - 1,0))` +THEN REAL_ARITH_TAC; +MP_TAC(ARITH_RULE`2

~(0= p-1)/\ 0<=0 /\ 0<= p-1/\ 1

~({0,j}= {0,p-1})`) +THEN RESA_TAC +THEN REMOVE_THEN"THYGIANG"(fun th-> MRESAL_TAC th[`0:num`;`j:num`][IN_NUMSEG]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL1_TAC stable_sy_lemma`s1:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`j:num`;`p:num`] THEN MRESA_TAC th[`p:num`;`p:num`]) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`p:num`;`p:num`;`p:num`] +THEN MRESAL_TAC MOD_MULT[`p:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`j:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] +THEN STRIP_TAC +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`j:num`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`j:num`;`k:num`] ) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] +THEN RESA_TAC +THEN RESA_TAC; +MP_TAC(ARITH_RULE`i

i=p-1 \/ i j=p \/ j

~(0= p-1)/\ 0<=0 /\ 0<= p-1/\ 1

~({0,0}= {0,p-1})`) +THEN RESA_TAC +THEN MRESAL1_TAC stable_sy_lemma`s1:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`p-1:num`;`p:num`] ) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`p:num`;`p:num`;`p:num`] +THEN MRESAL_TAC MOD_MULT[`p:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`p-1:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] +THEN STRIP_TAC +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-1`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`p-1:num`;`k:num`] ) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] +THEN REMOVE_THEN"THYGIANG2"MP_TAC +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM MP_TAC`norm (v - w:real^3) <= min (b_sy s1 (p - 1,0)) (b_sy s2 (p - 1,0))` +THEN REAL_ARITH_TAC; +MP_TAC(ARITH_RULE`j

j=p-1 \/ j p-1<=p-1 `) +THEN RESA_TAC +THEN MRESAL1_TAC stable_sy_lemma`s1:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`p-1` ) +THEN REWRITE_TAC[VECTOR_ARITH`A-A:real^3= vec 0`;NORM_0] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`p-1`;`p-1`]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th]) +THEN REAL_ARITH_TAC; +MP_TAC(ARITH_RULE`2

~(0= p-1)/\ 0<=0 /\ 0<= p-1/\ 1

~({p-1,j}= {0,p-1})`) +THEN RESA_TAC +THEN REMOVE_THEN"THYGIANG"(fun th-> MRESAL_TAC th[`p-1:num`;`j:num`][IN_NUMSEG]) +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`p-1:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`j:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] +THEN STRIP_TAC +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-1:num`;`j:num`]); +MP_TAC(ARITH_RULE`j<=p ==> j=p \/ j

~(0= p-1)/\ 0<=0 /\ 0<= p-1/\ 1

~({0,i}= {0,p-1})`) +THEN RESA_TAC +THEN REMOVE_THEN"THYGIANG"(fun th-> MRESAL_TAC th[`0:num`;`i:num`][IN_NUMSEG]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL1_TAC stable_sy_lemma`s1:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`;`p:num`] THEN MRESA_TAC th[`p:num`;`p:num`]) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`p:num`;`p:num`;`p:num`] +THEN MRESAL_TAC MOD_MULT[`p:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY_P)[`p:num`;`k:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`i:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] +THEN STRIP_TAC +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`k:num`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`;`k:num`] ) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] +THEN RESA_TAC +THEN RESA_TAC; +MP_TAC(ARITH_RULE`j

j=p-1 \/ j ~(0= p-1)/\ 0<=0 /\ 0<= p-1/\ 1

~({p-1,i}= {0,p-1})`) +THEN RESA_TAC +THEN REMOVE_THEN"THYGIANG"(fun th-> MRESAL_TAC th[`p-1:num`;`i:num`][IN_NUMSEG]) +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`p-1:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`i:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] +THEN STRIP_TAC +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`p-1:num`]) +THEN MRESAL1_TAC stable_sy_lemma`s1:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[]; +MP_TAC(ARITH_RULE`2

~(0= p-1)/\ 0<=0 /\ 0<= p-1/\ 1

~({i,j}= {0,p-1})`) +THEN RESA_TAC +THEN REMOVE_THEN"THYGIANG"(fun th-> MRESAL_TAC th[`i:num`;`j:num`][IN_NUMSEG]) +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`i:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL PMAT1_EQ_SY)[`k:num`;`p:num`;`j:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] +THEN STRIP_TAC +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`j:num`])]);; + + + + + + + + + + + + + + + + + + + +let IN_B_SY2_COVER_concl=`!(s:stable_sy) (s1:stable_sy) (s2:stable_sy) (s3:stable_sy) (l:real^(M,3)finite_product) +(l1:real^(P,3)finite_product) (l2:real^(N,3)finite_product). +dimindex(:M) =k /\ dimindex(:N) =k-p+2 /\ dimindex(:P) =p +/\ 1<= k-p +/\ I_SY s= 0..k-1 /\ f_sy s=(\i. ((1+i):num MOD k)) +/\ I_SY s1= 0..p-1 /\ f_sy s1=(\i. ((1+i):num MOD p)) +/\ I_SY s3= 0..(k-p+1) /\ f_sy s3=(\i. ((1+i):num MOD (k-p+2))) +/\ (ear_sy s2 <=> ear_sy s3) +/\ DIA_SY 0 (p-1) s +/\ SCHANGE (\x. if x=0 then 0 else (p-2+x) MOD k) s2 s3 +/\ COVER_SY 0 (p-1) s s1 s2 +/\ (l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s)) +/\ (!i j. {i MOD k ,j MOD k} IN J_SY s UNION {{0,p-1}} +==> norm (row i (vecmats l) -row j (vecmats l))<= cstab) +/\ matvec(pmat1(vecmats l))= l1 +/\ matvec(pmat2(vecmats l))= l2 +/\ row k (vecmats l)= v +/\ row (p-1) (vecmats l)= w +/\ (!u u1. + u IN {v, w} /\ u1 IN V_SY(vecmats l) /\ ~(u = u1) + ==> ~collinear {vec 0, u, u1}) +/\ norm(v-w)<= min (b_sy s1 (p-1,0)) (b_sy s2 (p-1,0)) +==> l2 IN (B_SY1 (a_sy s3) (b_sy s3))`;; + + +let IN_B_SY2_COVER_concl2 = mk_imp (EJRCFJD_concl, IN_B_SY2_COVER_concl);; + + + + + + + +let IN_B_SY2_COVER=prove_by_refinement(IN_B_SY2_COVER_concl2, +[DISCH_THEN(LABEL_TAC"THY") +THEN REPEAT STRIP_TAC +THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:P)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` +THEN MP_TAC(ARITH_RULE`1<= k-p /\ 1<=p /\ 1<=k ==> 2< k-p+2 /\ 1<= k-p+2 /\ (k - p + 2) - 1=k - p + 1 /\ ~(k=0)/\ p-1< k/\ p< k /\ ~(p=0) +/\ ~(k-p+2=0)/\ 1< k-p+2/\ p<= k /\ p<=p /\ k-p+1 p - 2 + k - p + 2= k/\ p-2+1=p-1 /\ 1<=p-1 /\ p-1<=k /\ p-1 {A,B}SUBSET C`) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM;V_SY;rows]; +EXISTS_TAC`k:num` +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; +EXISTS_TAC`p-1` +THEN ASM_REWRITE_TAC[]; +SUBGOAL_THEN`norm (v - w:real^3) <= cstab`ASSUME_TAC; +MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] +THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] +THEN FIND_ASSUM (fun th-> MP_TAC(ISPECL [`k:num`;`p-1`]th))`!i j. + {i MOD k, j MOD k} IN J_SY s UNION {{0, p - 1}} + ==> norm (row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))) <= cstab` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th; SET_RULE`{0,p-1} IN J_SY s UNION {{0,p-1}}`]) +THEN ASM_REWRITE_TAC[]; +SUBGOAL_THEN`~({v, w} IN E_SY (vecmats (l:real^(M,3)finite_product)))`ASSUME_TAC; +ASM_REWRITE_TAC[E_SY;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;convex_local_fan;local_fan] +THEN LET_TAC +THEN STRIP_TAC +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v':real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`i:num`;`row (i) (vecmats(l:real^(M,3)finite_product))`;` + (row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(l:real^(M,3)finite_product)`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;` + (row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`row i (vecmats(l:real^(M,3)finite_product))`] +THEN DISJ_CASES_TAC(SET_RULE`row k (vecmats l)= row (p - 1) (vecmats l) +\/ ~(row k (vecmats l)= row (p - 1) (vecmats (l:real^(M,3)finite_product)))`); +MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ + (1 <= j /\ j <= k) /\ + row i (vecmats l) = row j (vecmats l) +<=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ + row i (vecmats l) = row j (vecmats l)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-1`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`1 <= SUC (i' MOD dimindex (:M)) /\ + SUC (i' MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i':num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{row k (vecmats l), row (p - 1) (vecmats l)} = + {row i (vecmats l), row (SUC (i MOD k)) (vecmats l)} +/\ ~(row k (vecmats l) = row (p - 1) (vecmats l)) +/\ ~(row i (vecmats l) = row (SUC (i MOD k)) (vecmats l)) +==> (row i (vecmats l) = row (k) (vecmats l) +/\ row (p-1) (vecmats l) = row (SUC (i MOD k)) (vecmats l)) +\/ (row i (vecmats l) = row (p-1) (vecmats l) +/\ row (k) (vecmats l) = row (SUC (i MOD k)) (vecmats (l:real^(M,3)finite_product)))`) +THEN RESA_TAC; +MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ + (1 <= j /\ j <= k) /\ + row i (vecmats l) = row j (vecmats l) +<=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ + row i (vecmats l) = row j (vecmats l)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`k:num`] THEN MRESA_TAC th[`p-1:num`;`SUC(i MOD k):num`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`p*1=p/\ SUC 0=1`] +THEN MP_TAC(ARITH_RULE`2 ~(p-1=1)/\ 1<=1`) +THEN RESA_TAC; +MRESAL_TAC(GEN_ALL INJ_ROW_B_SY)[`k:num`;`s:stable_sy`;`l:real^(M,3)finite_product`][IN_NUMSEG;SET_RULE`(1 <= i /\ i <= k) /\ + (1 <= j /\ j <= k) /\ + row i (vecmats l) = row j (vecmats l) +<=> 1 <= i /\ i <= k /\ 1 <= j /\ j <= k /\ + row i (vecmats l) = row j (vecmats l)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`p-1:num`] THEN MRESA_TAC th[`k:num`;`SUC(i MOD k):num`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`2

~(k= SUC (p-1))/\ 1<= SUC(p-1)/\ SUC(p-1)<=k`) +THEN RESA_TAC; +MRESA_TAC (GEN_ALL PROPERTIES_OF_FAN_IN_B_SY)[`d_sy (s:stable_sy)`;`J_SY (s:stable_sy)`;`k_sy (s:stable_sy)`;`k:num`;`p-1:num`;`a_sy (s:stable_sy)`;`b_sy (s:stable_sy)`;`row k (vecmats (l:real^(M,3)finite_product))`;`row (p-1) (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`] +THEN MRESAL_TAC(GEN_ALL TECOXBM1)[`d_sy (s:stable_sy)`;`J_SY(s:stable_sy)`;`k:num`;`a_sy(s:stable_sy)`;`b_sy(s:stable_sy)`;`row k (vecmats (l:real^(M,3)finite_product))`;`row (p-1) (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`][SET_RULE`{A} UNION {B,C}={A,B,C}`] +THEN MP_TAC(SET_RULE`{v, w} SUBSET V_SY (vecmats l)==> v IN V_SY (vecmats l) +/\ w IN V_SY (vecmats (l:real^(M,3)finite_product))`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL SLICEV_EQ_V_SY)[`k:num`;`p:num`;`v:real^3`;`w:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL SLICEE_EQ_E_SY)[`k:num`;`p:num`;`v:real^3`;`w:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL SLICEF_EQ_F_SY)[`k:num`;`p:num`;`v:real^3`;`w:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL SLICEF_EQ_F2_SY)[`k:num`;`p:num`;`w:real^3`;`v:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL SLICEE_EQ_E2_SY)[`k:num`;`p:num`;`w:real^3`;`v:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL SLICEV_EQ_V2_SY)[`k:num`;`p:num`;`w:real^3`;`v:real^3`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;] +THEN STRIP_TAC +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v':real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN REMOVE_THEN"THY"(fun th-> MRESA_TAC th[`V_SY(vecmats (l:real^(M,3)finite_product))`;`E_SY(vecmats (l:real^(M,3)finite_product))`;`F_SY(vecmats (l:real^(M,3)finite_product))`; +`v:real^3`;`w:real^3`]) +THEN EXISTS_TAC`vecmats(l2:real^(N,3)finite_product)` +THEN ASM_REWRITE_TAC[MATVEC_VECMATS_ID] +THEN STRIP_TAC; +REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`i:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN FIND_ASSUM (fun th-> MATCH_MP_TAC(ISPEC `p-2+i`th))`!i. 1 <= i /\ i <= dimindex (:M) ==> row i (vecmats (l:real^(M,3)finite_product)) IN ball_annulus` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`1<=i /\ i<= k-p+2 /\ 2

1<= p-2+i /\ p-2+i<=k`) +THEN RESA_TAC; +ASM_REWRITE_TAC[CONDITION1_SY] +THEN FIND_ASSUM MP_TAC`COVER_SY 0 (p - 1) s s1 (s2:stable_sy)` +THEN REWRITE_TAC[COVER_SY;COVER5_SY;COVER4_SY;] +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THYGIANG") +THEN DISCH_THEN(LABEL_TAC"THYGIANG1") +THEN DISCH_THEN(LABEL_TAC"THYGIANG2") +THEN DISCH_THEN(LABEL_TAC"THYGIANG3") +THEN DISCH_THEN(LABEL_TAC"THYGIANG4") +THEN DISCH_THEN(LABEL_TAC"THYGIANG5") +THEN REPEAT GEN_TAC +THEN STRIP_TAC; +MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`i:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL PMAT2_EQ_SY)[`k:num`;`p:num`;`j:num`;`(s:stable_sy)`;` (s1:stable_sy)`;` (s2:stable_sy)`;` (s3:stable_sy)`;` (l:real^(M,3)finite_product)`;` +(l1:real^(P,3)finite_product) `;`(l2:real^(N,3)finite_product)`] +THEN REMOVE_THEN "THYGIANG1"MP_TAC +THEN REMOVE_THEN "THYGIANG3"MP_TAC +THEN FIND_ASSUM MP_TAC`SCHANGE (\x. if x = 0 then 0 else (p - 2 + x) MOD k) s2 (s3:stable_sy)` +THEN REWRITE_TAC[SCHANGE] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`;`j:num`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`;`j:num`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`i<=k-p+2 ==> i=k-p+2 \/ i< k-p+2`) +THEN RESA_TAC; +MP_TAC(ARITH_RULE`j<=k-p+2 ==> j=k-p+2 \/ j< k-p+2`) +THEN RESA_TAC; +STRIP_TAC +THEN STRIP_TAC +THEN MRESAL_TAC MOD_MULT[`k:num`;`1`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] +THEN SUBGOAL_THEN`0 IN IMAGE (\x. if x = 0 then 0 else (p - 2 + x) MOD k) (0..k - p + 1)` ASSUME_TAC; +REWRITE_TAC[IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`0=0 /\ 0<= 0/\ 0<= k-p+1`]; +MRESAL1_TAC stable_sy_lemma`s2:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`0`) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`0:num`;`0:num`] ) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th;VECTOR_ARITH`A-A= vec 0 `;NORM_0;]) +THEN REAL_ARITH_TAC; +MRESAL_TAC MOD_MULT[`k:num`;`1`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] +THEN MP_TAC(ARITH_RULE`1<=j==> j=1 \/ 1 1 REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-1:num`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`p-1:num`;`k:num`] THEN MRESA_TAC th[`p:num`;`p:num`]) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] +THEN MRESAL1_TAC stable_sy_lemma`s2:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN FIND_ASSUM MP_TAC`norm (v - w:real^3) <= min (b_sy s1 (p - 1,0)) (b_sy (s2:stable_sy) (p - 1,0))` +THEN REAL_ARITH_TAC; +MP_TAC(ARITH_RULE`1 ~(j=0) /\ p-2+j ~({0,p-2+j}={0,p-1})`) +THEN RESA_TAC +THEN SUBGOAL_THEN`0 IN IMAGE (\x. if x = 0 then 0 else (p - 2 + x) MOD k) (0..k - p + 1)` ASSUME_TAC; +REWRITE_TAC[IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`0=0 /\ 0<= 0/\ 0<= k-p+1`]; +SUBGOAL_THEN`p-2+j IN IMAGE (\x. if x = 0 then 0 else (p - 2 + x) MOD k) (0..k - p + 1)` ASSUME_TAC; +REWRITE_TAC[IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0=0 /\ 0<= 0/\ 0<= k-p+1`]; +STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`0`;`p-2+j`]) +THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] +THEN STRIP_TAC +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`;`p-2+j:num`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`p-2+j:num`;`k:num`] THEN MRESA_TAC th[`p:num`;`p:num`]) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] +THEN RESA_TAC +THEN RESA_TAC; +MRESAL_TAC MOD_MULT[`k:num`;`1`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] +THEN MP_TAC(ARITH_RULE`1<=i==> i=1 \/ 1 j=1 \/ 1 MRESA1_TAC th`p-1`) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`p-1:num`;`p-1:num`] ) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th;VECTOR_ARITH`A-A= vec 0 `;NORM_0;]) +THEN REAL_ARITH_TAC; +MP_TAC(ARITH_RULE`j<=k-p+2 ==> j=k-p+2 \/ j< k-p+2`) +THEN RESA_TAC; +REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MRESA_TAC MOD_LT[`p-1:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`2 1 REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-1:num`;`k:num`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`p-1:num`;`k:num`] THEN MRESA_TAC th[`p:num`;`p:num`]) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] +THEN REWRITE_TAC[NORM_SUB] +THEN DISCH_THEN(LABEL_TAC"THY21") +THEN DISCH_THEN(LABEL_TAC"THY22") +THEN MRESAL1_TAC stable_sy_lemma`s2:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN FIND_ASSUM MP_TAC`norm (v - w:real^3) <= min (b_sy s1 (p - 1,0)) (b_sy (s2:stable_sy) (p - 1,0))` +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REMOVE_THEN"THY21"MP_TAC +THEN REMOVE_THEN"THY22"MP_TAC +THEN REAL_ARITH_TAC; +MP_TAC(ARITH_RULE`1 ~(j=0) /\ p-2+j ~({p-1,p-2+j}={0,p-1})`) +THEN RESA_TAC +THEN SUBGOAL_THEN`p-1 IN IMAGE (\x. if x = 0 then 0 else (p - 2 + x) MOD k) (0..k - p + 1)` ASSUME_TAC; +REWRITE_TAC[IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`0=0 /\ 0<= 1/\ 1<= k-p+1`]; +SUBGOAL_THEN`p-2+j IN IMAGE (\x. if x = 0 then 0 else (p - 2 + x) MOD k) (0..k - p + 1)` ASSUME_TAC; +REWRITE_TAC[IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0=0 /\ 0<= 0/\ 0<= k-p+1`]; +STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-1`;`p-2+j`]) +THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] +THEN STRIP_TAC +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-1:num`;`p-2+j:num`]); +MP_TAC(ARITH_RULE`1 ~(i=0) /\ p-2+i j=k-p+2 \/ j< k-p+2`) +THEN RESA_TAC; +MP_TAC(SET_RULE`~(p-2+i=p-1) /\ ~(0=p-1)==> ~({p-2+i,0}={0,p-1})`) +THEN RESA_TAC +THEN SUBGOAL_THEN`0 IN IMAGE (\x. if x = 0 then 0 else (p - 2 + x) MOD k) (0..k - p + 1)` ASSUME_TAC; +REWRITE_TAC[IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`0=0 /\ 0<= 0/\ 0<= k-p+1`]; +SUBGOAL_THEN`p-2+i IN IMAGE (\x. if x = 0 then 0 else (p - 2 + x) MOD k) (0..k - p + 1)` ASSUME_TAC; +REWRITE_TAC[IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0=0 /\ 0<= 0/\ 0<= k-p+1`]; +STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-2+i`;`0`]) +THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] +THEN STRIP_TAC +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-2+i:num`;`k:num`;]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL1_TAC stable_sy_lemma`s:stable_sy`[stable_system;IN_NUMSEG;ARITH_RULE`0<= i:num`;] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`p-2+i:num`;`k:num`] THEN MRESA_TAC th[`p:num`;`p:num`]) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ p+p= p* 2`] +THEN RESA_TAC +THEN RESA_TAC; +MP_TAC(ARITH_RULE`j ~(j=0) /\ p-2+j ~({p-2+i,p-2+j}={0,p-1})`) +THEN RESA_TAC +THEN SUBGOAL_THEN`p-2+j IN IMAGE (\x. if x = 0 then 0 else (p - 2 + x) MOD k) (0..k - p + 1)` ASSUME_TAC; +REWRITE_TAC[IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0=0 /\ 0<= 0/\ 0<= k-p+1`]; +SUBGOAL_THEN`p-2+i IN IMAGE (\x. if x = 0 then 0 else (p - 2 + x) MOD k) (0..k - p + 1)` ASSUME_TAC; +REWRITE_TAC[IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0=0 /\ 0<= 0/\ 0<= k-p+1`]; +STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-2+i`;`p-2+j`]) +THEN FIND_ASSUM MP_TAC`(l:real^(M,3)finite_product) IN (B_SY1 (a_sy s) (b_sy s))` +THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION1_SY] +THEN STRIP_TAC +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v'':real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`p-2+i:num`;`p-2+j:num`;])]);; + + + + +let MTUWLUN1 = D_FUN_COVER_SY;; + +let MTUWLUN2 = TAU_STAR_COVER;; + +let MTUWLUN3 = IN_B_SY_COVER;; + +let MTUWLUN4 = IN_B_SY2_COVER;; + + + + + + + +end;; + + diff --git a/text_formalization/local/NKEZBFC.hl b/text_formalization/local/NKEZBFC.hl new file mode 100644 index 0000000..059a1d3 --- /dev/null +++ b/text_formalization/local/NKEZBFC.hl @@ -0,0 +1,2618 @@ +module Nkezbfc_local = struct + + +open Sphere;; +open Fan_defs;; +open Hypermap;; +open Vol1;; +open Fan;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Sphere;; +open Trigonometry1;; +open Trigonometry2;; +open Hypermap;; +open Fan;; +open Topology;; +open Prove_by_refinement;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; + + + +open Ldurdpn;; +open Lvducxu;; +open Aff_sgn_tac;; +open Local_lemmas1;; + + + +(* deprecated 2013-02-22 +let sol_local_fan = new_definition ` sol_local_fan V E f= &2 * pi+ sum f (\e. azim_in_fan e E- pi)`;; +*) + +let sol_local = new_definition ` sol_local E f= &2 * pi+ sum f (\e. azim_in_fan e E- pi)`;; + + +let CONVEX_LOFA_IMP_INANGLE_EQ_AZIM = prove_by_refinement +(`convex_local_fan (V,E,FF) ==>(!v. v IN V ==> interior_angle1 (vec 0) FF v = azim_in_fan (v, rho_node1 FF v) E) `, +[REWRITE_TAC[convex_local_fan; azim_in_fan2]; +REPEAT STRIP_TAC; +ASSUME_TAC2 EXISTS_INVERSE_OF_V; +DOWN THEN STRIP_TAC; +ASSUME_TAC2 LOFA_IMP_EE_TWO_ELMS; +ASSUME_TAC2 LOFA_CARD_EE_V_1; +ASSUME_TAC2 LOCAL_FAN_RHO_NODE_PROS2; +DOWN THEN STRIP_TAC; +UNDISCH_TAC` v:real^3 IN V `; +FIRST_ASSUM NHANH; +UNDISCH_TAC` !x. x IN FF +==> (let d = azim_cycle (EE (FST x) E) (vec 0) (FST x) (SND x) in +if CARD (EE (FST x) E) > 1 +then azim (vec 0) (FST x) (SND x) d +else &2 * pi) <= +pi /\ +V SUBSET wedge_in_fan_ge x E`; +DISCH_THEN NHANH; +LET_TAC; +SWITCH_TAC` EE v E = {rho_node1 FF v, vv} `; +ASM_SIMP_TAC[ARITH_RULE` a = 2 ==> a > 1 `]; +STRIP_TAC; +DOWN THEN DOWN THEN PHA; +ASSUME_TAC2 (SPEC `vv:real^3 ` (GEN` v:real^3 ` IVS_RHO_IDD)); +EXPAND_TAC "d"; +SIMP_TAC[]; +UNDISCH_TAC` {rho_node1 FF v, vv} = EE v E `; +DISCH_THEN (SUBST1_TAC o SYM); +EXPAND_TAC "v"; +DOWN; +SIMP_TAC[interior_angle1; GSYM ivs_rho_node1; AZIM_CYCLE_TWO_POINT_SET]]);; + + + +let SOL_LOFA_EQ_SUM_INANGLE=prove_by_refinement(` convex_local_fan(V,E,FF) +==> sol_local E FF= &2 * pi + sum V (\v. interior_angle1 (vec 0) FF v -pi)`, +[REWRITE_TAC[sol_local;] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th THEN +REWRITE_TAC[convex_local_fan] THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN MRESAL_TAC (GEN_ALL WRGCVDR)[`E:(real^3->bool)->bool`;`(\x:real^3#real^3. FST x)`;`FF:(real^3#real^3)->bool`;`V:real^3->bool`;`hro:real^3->real^3`][REAL_ARITH`&2 * pi + A= &2 * pi + B<=> A=B`;BIJ;INJ;SURJ] +THEN MATCH_MP_TAC SUM_EQ_GENERAL +THEN EXISTS_TAC`(\x:real^3#real^3. FST x)` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; +ASM_TAC +THEN MESON_TAC[]; +REPEAT STRIP_TAC; +ASM_TAC +THEN MESON_TAC[]; +ASSUME_TAC2 LOCAL_FAN_RHO_NODE_PROS +THEN POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `x:real^3#real^3`) +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th;]) +THEN ASSUME_TAC2 Local_lemmas.LOCAL_FAN_IMP_IN_V2 +THEN ASSUME_TAC2 CONVEX_LOFA_IMP_INANGLE_EQ_AZIM +THEN POP_ASSUM(fun th-> MRESA1_TAC th `FST (x:real^3#real^3)`)]);; + + + +let CARD_VERTEX_GE_3_LOCAL_FAN=prove_by_refinement(`!V E FF. convex_local_fan(V,E,FF) +==> 3 <= CARD V`, + +[REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th THEN +REWRITE_TAC[convex_local_fan] THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN SUBGOAL_THEN`?v:real^3. v IN V`ASSUME_TAC; +ASM_TAC +THEN SIMP_TAC[convex_local_fan;local_fan;FAN;fan1;SET_RULE`~(V SUBSET {}) <=> ~(V= {})`;SET_RULE`~(V={}) <=> ?v. v IN V`] +THEN LET_TAC +THEN SET_TAC[]; + +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_RHO_NODE_PROS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V) +[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`rho_node1 FF v` ;`V:real^3->bool`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_RHO_NODE_PROS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `rho_node1 FF v:real^3`) +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V) +[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`rho_node1 FF v:real^3`;`rho_node1 FF (rho_node1 FF v)` ;`V:real^3->bool`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2) +[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;` v:real^3`;] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2) +[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;` rho_node1 FF v:real^3`;] +THEN MRESA_TAC th3[`vec 0:real^3`;`v:real^3`;`rho_node1 FF v:real^3`] +THEN MP_TAC(SET_RULE`DISJOINT {vec 0, v:real^3} {rho_node1 FF v}==> ~(v=rho_node1 FF v)`) +THEN RESA_TAC +THEN MRESA_TAC th3[`vec 0:real^3`;`rho_node1 FF v:real^3`;`rho_node1 FF (rho_node1 FF v):real^3`] +THEN MP_TAC(SET_RULE`DISJOINT {vec 0, rho_node1 FF v:real^3} {rho_node1 FF (rho_node1 FF v)}==> ~(rho_node1 FF v=rho_node1 FF(rho_node1 FF v))`) +THEN RESA_TAC +THEN ASSUME_TAC2 Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN SUBGOAL_THEN(`CARD {v,rho_node1 FF v,rho_node1 FF (rho_node1 FF v):real^3}=3`)ASSUME_TAC; + +SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; +IN_INSERT; NOT_IN_EMPTY] +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; +MP_TAC(SET_RULE`rho_node1 FF v IN V /\ v IN V /\ rho_node1 FF (rho_node1 FF v) IN V==> {v,rho_node1 FF v,rho_node1 FF (rho_node1 FF v):real^3} SUBSET V`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[local_fan;FAN;fan1] +THEN LET_TAC +THEN REPEAT STRIP_TAC +THEN MRESA_TAC CARD_SUBSET[`{v,rho_node1 FF v,rho_node1 FF (rho_node1 FF v):real^3}`;`V:real^3->bool`]]);; + + + + +let REP_VERTEX_3_LOCAL_FAN=prove_by_refinement(` CARD V=3 /\ convex_local_fan(V,E,FF) +==> ?v. V= {v,rho_node1 FF v,rho_node1 FF (rho_node1 FF v)} +/\ ~(v=rho_node1 FF v) /\ ~(rho_node1 FF v=rho_node1 FF (rho_node1 FF v))/\ +~(rho_node1 FF (rho_node1 FF v)=v)`, +[ +REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th THEN +REWRITE_TAC[convex_local_fan] THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN SUBGOAL_THEN`?v:real^3. v IN V`ASSUME_TAC; +ASM_TAC +THEN SIMP_TAC[convex_local_fan;local_fan;FAN;fan1;SET_RULE`~(V SUBSET {}) <=> ~(V= {})`;SET_RULE`~(V={}) <=> ?v. v IN V`] +THEN LET_TAC +THEN SET_TAC[]; +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_RHO_NODE_PROS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V) +[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`rho_node1 FF v` ;`V:real^3->bool`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_RHO_NODE_PROS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `rho_node1 FF v:real^3`) +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V) +[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`rho_node1 FF v:real^3`;`rho_node1 FF (rho_node1 FF v)` ;`V:real^3->bool`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2) +[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;` v:real^3`;] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2) +[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;` rho_node1 FF v:real^3`;] +THEN MRESA_TAC th3[`vec 0:real^3`;`v:real^3`;`rho_node1 FF v:real^3`] +THEN MP_TAC(SET_RULE`DISJOINT {vec 0, v:real^3} {rho_node1 FF v}==> ~(v=rho_node1 FF v)`) +THEN RESA_TAC +THEN MRESA_TAC th3[`vec 0:real^3`;`rho_node1 FF v:real^3`;`rho_node1 FF (rho_node1 FF v):real^3`] +THEN MP_TAC(SET_RULE`DISJOINT {vec 0, rho_node1 FF v:real^3} {rho_node1 FF (rho_node1 FF v)}==> ~(rho_node1 FF v=rho_node1 FF(rho_node1 FF v))`) +THEN RESA_TAC +THEN ASSUME_TAC2 Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE +THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`) +THEN SUBGOAL_THEN(`CARD {v,rho_node1 FF v,rho_node1 FF (rho_node1 FF v):real^3}=3`)ASSUME_TAC; +SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; +IN_INSERT; NOT_IN_EMPTY] +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + +MP_TAC(SET_RULE`rho_node1 FF v IN V /\ v IN V /\ rho_node1 FF (rho_node1 FF v) IN V==> {v,rho_node1 FF v,rho_node1 FF (rho_node1 FF v):real^3} SUBSET V`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[local_fan;FAN;fan1] +THEN LET_TAC +THEN REPEAT STRIP_TAC +THEN MRESA_TAC CARD_SUBSET_EQ[`{v,rho_node1 FF v,rho_node1 FF (rho_node1 FF v):real^3}`;`V:real^3->bool`] +THEN EXISTS_TAC`v:real^3` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REPEAT RESA_TAC]);; + + +let CONVEX_LOFA_IMP_INANGLE_EQ_AZIM_IVS = prove(`convex_local_fan (V,E,FF) ==>(!v. v IN V ==> interior_angle1 (vec 0) FF v = azim (vec 0) v (rho_node1 FF v) (ivs_rho_node1 FF v)) `, + +REWRITE_TAC[convex_local_fan; azim_in_fan2] +THEN REPEAT STRIP_TAC +THEN ASSUME_TAC2 EXISTS_INVERSE_OF_V +THEN DOWN THEN STRIP_TAC +THEN ASSUME_TAC2 LOFA_IMP_EE_TWO_ELMS +THEN ASSUME_TAC2 LOFA_CARD_EE_V_1 +THEN ASSUME_TAC2 LOCAL_FAN_RHO_NODE_PROS2 +THEN DOWN THEN STRIP_TAC +THEN UNDISCH_TAC` v:real^3 IN V ` +THEN FIRST_ASSUM NHANH +THEN UNDISCH_TAC` !x. x IN FF +==> (let d = azim_cycle (EE (FST x) E) (vec 0) (FST x) (SND x) in +if CARD (EE (FST x) E) > 1 +then azim (vec 0) (FST x) (SND x) d +else &2 * pi) <= +pi /\ +V SUBSET wedge_in_fan_ge x E` +THEN DISCH_THEN NHANH +THEN LET_TAC +THEN SWITCH_TAC` EE v E = {rho_node1 FF v, vv} ` +THEN ASM_SIMP_TAC[ARITH_RULE` a = 2 ==> a > 1 `] +THEN STRIP_TAC +THEN DOWN THEN DOWN THEN PHA +THEN ASSUME_TAC2 (SPEC `vv:real^3 ` (GEN` v:real^3 ` IVS_RHO_IDD)) +THEN EXPAND_TAC "d" +THEN SIMP_TAC[] +THEN UNDISCH_TAC` {rho_node1 FF v, vv} = EE v E ` +THEN DISCH_THEN (SUBST1_TAC o SYM) +THEN EXPAND_TAC "v" +THEN DOWN +THEN SIMP_TAC[interior_angle1; GSYM ivs_rho_node1; AZIM_CYCLE_TWO_POINT_SET]);; + +let SOL_LOCAL_FAN_POS_CASE3=prove(`!V E FF. convex_local_fan(V,E,FF) +/\ CARD V=3 +==> &0 <= sol_local E FF`, +REPEAT STRIP_TAC +THEN ASSUME_TAC2 SOL_LOFA_EQ_SUM_INANGLE +THEN ASM_REWRITE_TAC[] +THEN ASSUME_TAC2 REP_VERTEX_3_LOCAL_FAN +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN SIMP_TAC[HAS_SIZE; SUM_CLAUSES; FINITE_INSERT; FINITE_EMPTY; +IN_INSERT; NOT_IN_EMPTY] +THEN ASM_REWRITE_TAC[] +THEN UNDISCH_TAC`convex_local_fan (V:real^3->bool,E,FF)` +THEN STRIP_TAC +THEN POP_ASSUM( fun th-> MP_TAC th +THEN REWRITE_TAC[convex_local_fan ] THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN MRESAL_TAC(GEN_ALL Local_lemmas.INTERIOR_ANGLE1_POS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`v:real^3`;][SET_RULE`A IN {A,B,C}`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.INTERIOR_ANGLE1_POS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;` rho_node1 FF v:real^3`;][SET_RULE`B IN {A,B,C}`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.INTERIOR_ANGLE1_POS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;` rho_node1 FF (rho_node1 FF v):real^3`;][SET_RULE`C IN {A,B,C}`] +THEN DISJ_CASES_TAC(SET_RULE`(?v. v IN V /\ pi <= interior_angle1 (vec 0) FF v)\/ ~(?v. v IN V /\ pi <= interior_angle1 (vec 0) FF v)`) +THENL[ + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[SET_RULE`A IN {B,C,D}<=> A=B \/ A=C\/ A=D`] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[NOT_EXISTS_THM;DE_MORGAN_THM; REAL_ARITH`~(a<= b) <=> b MRESAL1_TAC th`v:real^3`[SET_RULE`A IN {A,B,C}`] +THEN MRESAL1_TAC th`rho_node1 FF v:real^3`[SET_RULE`B IN {A,B,C}`] +THEN MRESAL1_TAC th`rho_node1 FF (rho_node1 FF v:real^3)`[SET_RULE`C IN {A,B,C}`]) +THEN MRESAL_TAC( GEN_ALL Local_lemmas.IVS_RHO_IDD)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`v:real^3`;][SET_RULE`A IN {A,B,C}`] +THEN MRESAL_TAC( GEN_ALL Local_lemmas.IVS_RHO_IDD)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`rho_node1 FF v:real^3`;][SET_RULE`B IN {A,B,C}`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_RHO_NODE_PROS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th `rho_node1 FF (rho_node1 FF v):real^3`[SET_RULE`C IN {A,B,C}`]) +THEN MRESAL_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2) +[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;` rho_node1 FF (rho_node1 FF v):real^3`;][SET_RULE`C IN {A,B,C}`] +THEN MRESA_TAC th3[`vec 0:real^3`;`rho_node1 FF (rho_node1 FF v):real^3`;`rho_node1 FF (rho_node1 FF (rho_node1 FF v)):real^3`] +THEN MP_TAC(SET_RULE`DISJOINT {vec 0, rho_node1 FF (rho_node1 FF v):real^3} {rho_node1 FF (rho_node1 FF (rho_node1 FF v))}==> ~(rho_node1 FF (rho_node1 FF v)=rho_node1 FF (rho_node1 FF (rho_node1 FF v)))`) +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V) +[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`rho_node1 FF (rho_node1 FF v):real^3`;`rho_node1 FF (rho_node1 FF (rho_node1 FF v))` ;`V:real^3->bool`][SET_RULE`C IN {A,B,C}`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th `rho_node1 FF v:real^3`[SET_RULE`B IN {A,B,C}`]) +THEN MP_TAC(SET_RULE`~(rho_node1 FF (rho_node1 FF v) = +rho_node1 FF (rho_node1 FF (rho_node1 FF v:real^3))) +/\ rho_node1 FF (rho_node1 FF (rho_node1 FF v)) IN +{v, rho_node1 FF v, rho_node1 FF (rho_node1 FF v)} +/\ ~(rho_node1 FF (rho_node1 FF (rho_node1 FF v)) = rho_node1 FF v) +==> rho_node1 FF (rho_node1 FF (rho_node1 FF v))=v +`) +THEN RESA_TAC +THEN MRESAL_TAC( GEN_ALL Local_lemmas.IVS_RHO_IDD)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`rho_node1 FF (rho_node1 FF v):real^3`;][SET_RULE`C IN {A,B,C}`] +THEN ABBREV_TAC`u=rho_node1 FF v` +THEN ABBREV_TAC`w=rho_node1 FF u` +THEN REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`v:real^3`[SET_RULE`A IN {A,B,C}`] +THEN MRESAL1_TAC th`u:real^3`[SET_RULE`B IN {A,B,C}`] +THEN MRESAL1_TAC th`w:real^3`[SET_RULE`C IN {A,B,C}`;]) +THEN REWRITE_TAC[REAL_ARITH`&0 <= +&2 * pi + A - pi + B - pi + C - pi + &0 <=> &0 <= A+B+C - pi `] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_RHO_NODE_PROS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th `v:real^3`[SET_RULE`A IN {A,B,C}`] +THEN MRESAL1_TAC th `u:real^3`[SET_RULE`B IN {A,B,C}`]) +THEN MRESAL_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2) +[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;` v:real^3`;][SET_RULE`A IN {A,B,C}`] +THEN UNDISCH_TAC`~collinear {vec 0, w:real^3, rho_node1 FF w}` +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0< azim (vec 0) v u w /\ azim (vec 0) v u w < pi ==> ~(azim (vec 0) v u w = &0 \/ azim (vec 0) v u (w:real^3) = pi)`) +THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`vec 0:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> +MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN STRIP_TAC +THEN MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN STRIP_TAC +THEN MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN STRIP_TAC +THEN MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`vec 0:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`vec 0:real^3`;`u:real^3`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`vec 0:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`vec 0:real^3`;`w:real^3`;`u:real^3`;`v:real^3`] +THEN MRESA_TAC AZIM_DIVH [`vec 0:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC AZIM_DIVH [`vec 0:real^3`;`u:real^3`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC AZIM_DIVH [`vec 0:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN MRESAL_TAC VOLUME_SOLID_TRIANGLE[`&1:real`;`vec 0:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][REAL_ARITH`&0< &1`] +THEN POP_ASSUM MP_TAC +THEN REPEAT LET_TAC +THEN MRESA_TAC MEASURABLE_BALL_AFF_GT[`vec 0:real^3`;`&1`;`{vec 0:real^3}`;`{v,u,w:real^3}`] +THEN STRIP_TAC +THEN MP_TAC(MESON[volume_props]`measurable (ball (vec 0,&1) INTER aff_gt {vec 0} {v, u, w})==> vol (ball (vec 0,&1) INTER aff_gt {vec 0} {v, u, w}) >= &0`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]);; + + +let AFF_LT_1_1 = prove +(`!x w. +~(x=w) +==> aff_lt {x} {w} = +{y | ?t1 t2. +t2 < &0 /\ +t1 + t2 = &1 /\ +y = t1 % x + t2 % w}`, +REWRITE_TAC[SET_RULE`~(x=w) <=> DISJOINT {x} {w}`] THEN AFF_TAC);; + +let PROPERTIES_GENERIC_LOCAL_FAN=prove_by_refinement(`!V E FF v0. local_fan(V,E,FF) /\ v0 IN V /\ generic V E +==> (!v. v IN V /\ ~(v = v0) ==> ~collinear {vec 0, v0, v})`, +[REPEAT GEN_TAC +THEN REWRITE_TAC[generic;] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN REPEAT STRIP_TAC +THEN MRESA_TAC(GEN_ALL LOCAL_FAN_RHO_NODE_PROS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v0:real^3`) +THEN MRESAL_TAC(GEN_ALL LOCAL_FAN_IN_FF_IN_ORD_PAIRS)[`V:real^3->bool`;`FF:real^3#real^3->bool`;`v0,rho_node1 FF v0`;`E:(real^3->bool)->bool`;][GSYM IN_E_IFF_IN_ORD_E] +THEN REMOVE_THEN "LINH"(fun th-> MRESA_TAC th[`v0:real^3`;`rho_node1 FF v0`;`v:real^3`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?w. w IN A`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN REWRITE_TAC[COLLINEAR_3_EXPAND;VECTOR_ARITH`u % vec 0+ a=a`] +THEN REPEAT STRIP_TAC; +ASM_TAC +THEN REWRITE_TAC[local_fan;FAN;fan2] +THEN LET_TAC +THEN SET_TAC[]; +ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(REAL_ARITH`&0<= &1-u \/ &1 -u< &0`); +SUBGOAL_THEN`~(vec 0= v0:real^3)`ASSUME_TAC; +ASM_TAC +THEN REWRITE_TAC[local_fan;FAN;fan2] +THEN LET_TAC +THEN SET_TAC[]; +SUBGOAL_THEN`~(vec 0= v:real^3)`ASSUME_TAC; +ASM_TAC +THEN REWRITE_TAC[local_fan;FAN;fan2] +THEN LET_TAC +THEN SET_TAC[]; +SUBGOAL_THEN`v IN aff_ge {vec 0} {v0:real^3}` ASSUME_TAC; +MRESAL_TAC AFF_GE_1_1[`vec 0:real^3`;`v0:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC `u:real` +THEN EXISTS_TAC `&1-u:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`u+ &1- u= &1`] +THEN VECTOR_ARITH_TAC; +SUBGOAL_THEN`v IN aff_ge {vec 0} {v:real^3}` ASSUME_TAC; +MRESAL_TAC AFF_GE_1_1[`vec 0:real^3`;`v:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC `&0:real` +THEN EXISTS_TAC `&1:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0 + &1= &1 /\ &0<= &1`] +THEN VECTOR_ARITH_TAC; +UNDISCH_TAC`local_fan (V:real^3->bool,E,FF)` +THEN REWRITE_TAC[local_fan;FAN;fan7] +THEN LET_TAC +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN UNDISCH_TAC `v=(&1 - u) % v0:real^3` +THEN MP_TAC(SET_RULE`~(v = (v0:real^3))==> {v} INTER {v0}= {}`) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`{v:real^3}`;`{v0:real^3}`][UNION;IN_ELIM_THM;SET_RULE`(?v. v IN V /\ {v0} = {v})<=> v0 IN V`]) +THEN STRIP_TAC +THEN UNDISCH_TAC`aff_ge {vec 0} {v} INTER aff_ge {vec 0} {v0} = +aff_ge {vec 0} ({v} INTER {v0:real^3})` +THEN ASM_REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`v IN aff_ge {vec 0} {v0}/\ v IN aff_ge {vec 0} {v:real^3} +/\ aff_ge {vec 0} {v} INTER aff_ge {vec 0} {v0} = {vec 0} ==> vec 0= v`) +THEN ASM_REWRITE_TAC[]; +MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;` v0:real^3`;] +THEN MRESA_TAC Planarity.point_in_aff_ge[`vec 0:real^3`;`v0:real^3`;`rho_node1 FF v0`] +THEN EXISTS_TAC`v0:real^3` +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM] +THEN SUBGOAL_THEN`~(vec 0= v:real^3)`ASSUME_TAC; +ASM_TAC +THEN REWRITE_TAC[local_fan;FAN;fan2] +THEN LET_TAC +THEN SET_TAC[]; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESAL_TAC AFF_LT_1_1[`vec 0:real^3`;`(&1 - u) % v0:real^3`][IN_ELIM_THM] +THEN EXISTS_TAC `&1- inv(&1-u):real` +THEN EXISTS_TAC `inv(&1-u):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1-a+a= &1`; VECTOR_ARITH`a %b%v=(a*b)%v`] +THEN MP_TAC(REAL_ARITH`&1- u< &0 ==> ~(&1- u = &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`&1- u:real` +THEN REWRITE_TAC[VECTOR_ARITH`v0 = (&1 - inv (&1 - u)) % vec 0 + &1 % v0`;REAL_ARITH`a< &0<=> &0< -- a`;GSYM REAL_INV_NEG;REAL_LT_INV_EQ] +THEN ASM_TAC +THEN REAL_ARITH_TAC]);; + +let PROPERTIES_GENERIC= prove(` local_fan(V,E,FF) /\ generic V E /\ v IN V /\ w IN V +==> (!u u1. u IN {v,w} /\ u1 IN V /\ ~(u=u1) ==> ~(collinear {vec 0, u, u1}))`, +REWRITE_TAC[SET_RULE`u IN {v,w} <=> u=v \/ u=w`] +THEN REPEAT STRIP_TAC +THEN ASM_MESON_TAC[PROPERTIES_GENERIC_LOCAL_FAN]);; + +let PROPERTIES_GENERIC1= prove(` convex_local_fan(V,E,FF) /\ generic V E /\ v IN V /\ w IN V +==> (!u u1. u IN {v,w} /\ u1 IN V /\ ~(u=u1) ==> ~(collinear {vec 0, u, u1}))`, +REWRITE_TAC[SET_RULE`u IN {v,w} <=> u=v \/ u=w`;convex_local_fan] +THEN REPEAT STRIP_TAC +THEN ASM_MESON_TAC[PROPERTIES_GENERIC_LOCAL_FAN;]);; + + +let AZIM_PI_WEDGE_SIN = prove_by_refinement(` azim u v w ww = pi ==> +wedge u v w ww = {x| &0 < sin (azim u v w x ) } `, +[REWRITE_TAC[wedge; EXTENSION; IN_ELIM_THM] +THEN ONCE_REWRITE_TAC[GSYM (SPEC ` -- (u:real^3) ` AZIM_TRANSLATION)] +THEN REWRITE_TAC[VECTOR_ARITH` -- a + (a:real^N) = vec 0`;VECTOR_ARITH` -- a + b = b - a:real^N `; re_eqvl] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EQ_TAC; +SIMP_TAC[SIN_POS_PI]; +MP_TAC (SPECL [`u - u:real^3 `;` v - u:real^3 `;` w - u:real^3 `; +` x - u:real^3 `] AZIM_RANGE) +THEN STRIP_TAC +THEN ABBREV_TAC ` goc = azim (u - u) (v - u) (w - u) (x - u) ` +THEN MP_TAC(REAL_ARITH`&0 <= goc==> goc= &0 \/ &0< goc `) +THEN RESA_TAC; +ASM_REWRITE_TAC[SIN_0] +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[] +THEN ASM_CASES_TAC `collinear {u, v, x:real^3}`; +MRESA_TAC azim_def[`w:real^3`;`x:real^3`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[GSYM (SPEC ` -- (u:real^3) ` AZIM_TRANSLATION)] +THEN REWRITE_TAC[VECTOR_ARITH` -- a + (a:real^N) = vec 0`;VECTOR_ARITH` -- a + b = b - a:real^N `; re_eqvl] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SIN_0] +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ASM_CASES_TAC ` goc < pi ` +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN` sin goc < &0 ` MP_TAC; +ONCE_REWRITE_TAC[SIN_SUB_PERIODIC] +THEN REWRITE_TAC[REAL_ARITH` -- a < &0 <=> &0 < a `] +THEN MATCH_MP_TAC SIN_POS_PI +THEN +ASM_REWRITE_TAC[REAL_ARITH` a - b < b <=> a < &2 * b `;REAL_ARITH` &0 < a - pi <=> ~( a < pi ) /\ ~(a= pi) `] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th; SIN_PI]) +THEN REAL_ARITH_TAC; +ASM_TAC THEN REAL_ARITH_TAC]);; + + + + +let AZIM_PI_WEDGE_CROSS_DOT = prove_by_refinement(` azim u v w ww = pi ==> +wedge u v w ww = {x | &0 < ((v - u) cross ( w - u )) dot ( x - u )}`, +[SIMP_TAC[AZIM_PI_WEDGE_SIN; EXTENSION; IN_ELIM_THM]; +REPEAT STRIP_TAC; +ONCE_REWRITE_TAC[GSYM (SPEC ` -- (u:real^3) ` AZIM_TRANSLATION)]; +REWRITE_TAC[VECTOR_ARITH` -- a + a:real^N = vec 0 `; VECTOR_ARITH` -- a + x = x - a:real^N `]; +MP_TAC (SPECL [` v - u:real^3 `;` w - u:real^3 `;` x - u:real^3 `] Trigonometry2.JBDNJJB); +REWRITE_TAC[re_eqvl]; +STRIP_TAC; +ASM_REWRITE_TAC[VECTOR_SUB_REFL]; +ASM_SIMP_TAC[REAL_LT_MUL_EQ]]);; + + +let AFF_GT_SUBSET_WEDGE_IMP_VERTEX=prove(`!x v w y z. ~collinear{x,v,w} +/\ ~collinear{x,v,y} +/\ ~collinear{x,v,z} +/\ aff_gt {x} {v,w} SUBSET wedge x v y z +==> w IN wedge x v y z`, +REPEAT STRIP_TAC +THEN MRESA_TAC Planarity.exists_in_aff_gt[`x:real^3`;`v:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE`y' IN aff_gt {x} {v, w} /\ aff_gt {x:real^3} {v, w} SUBSET wedge x v y z ==> y' IN wedge x v y z`) +THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`] +THEN REWRITE_TAC[wedge;IN_ELIM_THM] +THEN MRESA_TAC Planarity.aff_gt_inter_aff_gt[`x:real^3`;`v:real^3`;`w:real^3`] +THEN UNDISCH_TAC`y' IN aff_gt {x} {v, w:real^3}` +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC Planarity.aff_gt_imp_not_collinear[`x:real^3`;`w:real^3`;`v:real^3`;`y':real^3`] +THEN MRESA_TAC AZIM_EQ[`x:real^3`;`v:real^3`;`y:real^3`;`w:real^3`;`y':real^3`] +THEN RESA_TAC);; + +let CONDITION_INANGLE_CROSS_DOT=prove(` aff_gt {x} {v,w} SUBSET wedge x v y z +/\ ~collinear{x,v,w} +/\ ~collinear{x,v,y} +/\ ~collinear{x,v,z} +/\ u= (v-x) cross (w-x) +/\ azim x v y z &0 < ((v - x) cross (y - x)) dot (w - x)/\ +&0 < ((v - x) cross (w - x)) dot (z - x)`, +REPEAT STRIP_TAC +THEN MRESA_TAC (AFF_GT_SUBSET_WEDGE_IMP_VERTEX)[`x:real^3`;`v:real^3`;`w:real^3`;`y:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[wedge;IN_ELIM_THM] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim x v y w < azim x v y z /\ azim x v y z < pi +==> azim x v y w < pi /\ azim x v y w <= azim x v y z`) +THEN RESA_TAC +THEN MRESA1_TAC SIN_POS_PI`azim x v y w` +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC Fan.sum4_azim_fan[`x:real^3`;`v:real^3`;`y:real^3`;`w:real^3`;`z:real^3`] +THEN MP_TAC(REAL_ARITH`azim x v y w < azim x v y z /\ &0< azim x v y w +/\ azim x v y z < pi /\ azim x v y z = azim x v y w + azim x v w z +==> &0< azim x v w z /\ azim x v w z< pi`) +THEN RESA_TAC +THEN MRESA1_TAC SIN_POS_PI`azim x v w z` +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[GSYM (SPEC ` -- (x:real^3) ` AZIM_TRANSLATION)] +THEN REWRITE_TAC[VECTOR_ARITH` -- a + (a:real^N) = vec 0`;VECTOR_ARITH` -- a + b = b - a:real^N `; re_eqvl] +THEN MP_TAC (SPECL [` v - x:real^3 `;` w - x:real^3 `;` z - x:real^3 `] Trigonometry2.JBDNJJB) +THEN REWRITE_TAC[re_eqvl;VECTOR_ARITH`a-a= vec 0`] +THEN MP_TAC (SPECL [` v - x:real^3 `;` y - x:real^3 `;` w - x:real^3 `] Trigonometry2.JBDNJJB) +THEN REWRITE_TAC[re_eqvl;] +THEN RESA_TAC +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MP_TAC REAL_LT_MUL_EQ +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`t:real`;`((v - x) cross (y - x)) dot (w - x:real^3)`] THEN MRESA_TAC th[`t':real`;`(((v - x) cross (w - x)) dot (z - x:real^3))`]));; + +let AFF_GE_3_1 = prove +(`!x v u w. +DISJOINT {x,v,u} {w} +==> aff_ge {x,v,u} {w} = +{y | ?t1 t2 t3 t4. +&0 <= t4 /\ +t1 + t2 +t3 +t4 = &1 /\ +y = t1 % x + t2 % v + t3 % u +t4 % w }`, +AFF_TAC);; + + +let AFF_GE_2_2=prove(`!x u v w. +DISJOINT {x, u} {v, w} +==> aff_ge {x, u} {v, w} = +{y | ?t1 t2 t3 t4. +&0 <= t3 /\ +&0 <= t4 /\ +t1 + t2 + t3 +t4= &1 /\ +y = t1 % x + t2 %u + t3 % v + t4 % w}`, +AFF_TAC);; + + + +let inter_aff_ge_3_1_is_aff_ge_2_2=prove(`!x v u w:real^3. +~coplanar {x,v,u,w} +==> +aff_ge {x,v,u} {w} INTER aff_ge {x,u,w} {v} =aff_ge {x,u} {v,w}`, +GEOM_ORIGIN_TAC `x:real^3` +THEN REPEAT STRIP_TAC +THEN MRESA_TAC notcoplanar_disjoints[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_disjoint[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC AFF_GE_3_1[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC AFF_GE_3_1[`(vec 0):real^3`;`u:real^3`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC AFF_GE_2_2[`(vec 0):real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC NOT_COPLANAR_0_4_IMP_INDEPENDENT[`v:real^3`;`u:real^3`;`w:real^3`] +THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM;INTER] +THEN REDUCE_VECTOR_TAC +THEN GEN_TAC +THEN EQ_TAC +THENL[ +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t2 % v + t3 % u + t4 % w = t2' % u + t3' % w + t4' % v <=> (t2-t4') % v + (t3-t2') % u + (t4-t3') % w= vec 0`] +THEN STRIP_TAC +THEN MRESAL_TAC INDEPENDENT_3[`v:real^3`;`u:real^3`;`w:real^3`;`t2-t4':real`; `t3-t2':real`; `t4 -t3':real`][REAL_ARITH`A-B= &0<=> A=B`] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`t1':real` +THEN EXISTS_TAC`t2':real` +THEN EXISTS_TAC`t4':real` +THEN EXISTS_TAC`t3':real` +THEN ASM_REWRITE_TAC[REAL_ARITH`t1+t2+t3+t4=t1+t2+t4+t3:real`;VECTOR_ARITH`t4' % v + t2' % u + t3' % w = t2' % u + t4' % v + t3' % w:real^3`] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THEN STRIP_TAC +THENL[ +EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t3:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t4:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t2 % u + t3 % v + t4 % w = t3 % v + t2 % u + t4 % w:real^3`;REAL_ARITH`t1 + t3 + t2 + t4=t1 + t2 + t3 + t4`]; +EXISTS_TAC`t1:real` +THEN EXISTS_TAC`t2:real` +THEN EXISTS_TAC`t4:real` +THEN EXISTS_TAC`t3:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`t1 + t2 + t4+ t3:real=t1 + t2 + t3 + t4`] +THEN VECTOR_ARITH_TAC]]);; + + +let aff_ge_3_1_rep_cross_dot=prove( +`!x:real^3 v:real^3 u:real^3 w:real^3. +~coplanar {x,v,u,w} +/\ &0< ((v-x) cross (u-x)) dot (w-x) +==> aff_ge {x,v,u} {w} ={y:real^3| &0<= (((v-x) cross (u-x)) dot (y-x)) }`, + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC notcoplanar_disjoints[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN MRESA_TAC AFF_GE_3_1[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL[STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`((t1 % x + t2 % v + t3 % u + t4 % w) - x)=((t1+t2+t3+t4) - &1) % x + t2 % (v-x) + t3 % (u-x) + t4 % (w - x)`; REAL_ARITH`&1- &1= &0`] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[CROSS_LNEG;CROSS_LMUL;CROSS_LADD;CROSS_REFL;DOT_RMUL;DOT_RADD;DOT_CROSS_SELF;] +THEN REDUCE_ARITH_TAC +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC THEN REAL_ARITH_TAC; +DISCH_THEN(LABEL_TAC"ME") +THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]properties_coordinate) THEN RESA_TAC +THEN MRESA_TAC ORTHONORMAL_IMP_SPANNING[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3)( v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[SPAN_3;EXTENSION] +THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(x':real^3)-(x:real^3)`th) THEN ASSUME_TAC(th)) +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(w:real^3)-(x:real^3)`th)THEN ASSUME_TAC(th)) +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(u:real^3)-(x:real^3)`th)THEN ASSUME_TAC(th)) +THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(v:real^3)-(x:real^3)`th)) +THEN REWRITE_TAC[SET_RULE`(a:real^3) IN (:real^3)`;IN_ELIM_THM;VECTOR_ARITH`A-B=C<=>A=C+B:real^3`] +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`e1=e1_fan x v u:real^3` +THEN ABBREV_TAC`e2=e2_fan x v u:real^3` +THEN ABBREV_TAC`e3=e3_fan x v u:real^3` +THEN REMOVE_THEN"YEU" MP_TAC +THEN MRESA_TAC ORTHONORMAL_CROSS[`e1:real^3`;`e2:real^3`;`e3:real^3`;] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + +t2 % ((u' % e1 + v' % e2 + w' % e3) + x) + +t3 % ((u'' % e1 + v'' % e2 + w'' % e3) + x) + +t4 % ((u''' % e1 + v''' % e2 + w''' % e3) + x) += (t2 * u' + t3 * u'' +t4 * u''') % e1 + (t2 * v'+t3*v''+ t4 * v''') % e2 + (t2 * w'+ t3 * w''+ t4 * w''') % e3 +(t1+t2+t3+t4) % x :real^3`;VECTOR_ARITH`((u' % e1 + v' % e2 + w' % e3) + x) - x=u' % e1 + v' % e2 + w' % e3`;CROSS_LMUL;CROSS_RMUL;CROSS_LADD;CROSS_RADD;CROSS_REFL;] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN FIND_ASSUM MP_TAC`orthonormal e1 e2 (e3:real^3)` +THEN REWRITE_TAC[orthonormal] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;DOT_LNEG] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN ABBREV_TAC`a1=vector[u':real;u'':real;u''':real]:real^3` +THEN ABBREV_TAC`a2=vector[v':real;v'':real;v''':real]:real^3` +THEN ABBREV_TAC`a3=vector[w':real;w'':real;w''':real]:real^3` +THEN ABBREV_TAC`A=vector[a1;a2;a3:real^3]:real^3^3` +THEN ABBREV_TAC`b=vector[u'''':real;v'''':real;w'''':real]:real^3` +THEN STRIP_TAC +THEN SUBGOAL_THEN`&0< det(A:real^3^3)`ASSUME_TAC +THENL[ +EXPAND_TAC"A" +THEN EXPAND_TAC "a1" +THEN EXPAND_TAC "a2" +THEN EXPAND_TAC "a3" +THEN REWRITE_TAC[DET_3;VECTOR_3] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +MP_TAC(REAL_ARITH`&0< det (A:real^3^3)==> ~(det A= &0) /\ &0<= det (A:real^3^3)`) THEN RESA_TAC +THEN MRESA_TAC CRAMER[`A:real^3^3`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SWAP_FORALL_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`b:real^3`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[MESON[] +` (!x. p(x) <=> x = a) <=> (?x. p(x)) /\ (!x. p(x) ==> x = a)`] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "LINH1") +THEN DISCH_THEN(LABEL_TAC "LINH2") +THEN REMOVE_THEN "LINH1" MP_TAC +THEN MRESAL_TAC MATRIX_VECTOR_MUL_COMPONENT[`A:real^3^3`;`x'':real^3`][DIMINDEX_3] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`1:num`[ARITH_RULE`1<=1/\ 1<=3`;LAMBDA_BETA;VECTOR_3] THEN ASSUME_TAC th) +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`2:num`[ARITH_RULE`1<=2/\ 2<=3`;VECTOR_3] THEN ASSUME_TAC th) +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3:num`[ARITH_RULE`1<=3/\ 3<=3`;VECTOR_3;]) +THEN DISCH_TAC +THEN POP_ASSUM(fun th -> MP_TAC th THEN ASSUME_TAC th) +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[VECTOR_3;CART_EQ;] +THEN REWRITE_TAC[DIMINDEX_3] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`1:num`[ARITH_RULE`1<=1/\ 1<=3`;DOT_SYM;] THEN ASSUME_TAC th) +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`2:num`[ARITH_RULE`1<=2/\ 2<=3`;DOT_SYM;] THEN ASSUME_TAC th) +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3:num`[ARITH_RULE`1<=3/\ 3<=3`;DOT_SYM;]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"A" +THEN EXPAND_TAC "a1" +THEN EXPAND_TAC "a2" +THEN EXPAND_TAC "a3" +THEN EXPAND_TAC "b" +THEN REWRITE_TAC[VECTOR_3;DOT_3] +THEN DISCH_THEN(LABEL_TAC"MA") +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`&1- (x'':real^3)$1 - x''$2 -x''$3` +THEN EXISTS_TAC`(x'':real^3)$1` +THEN EXISTS_TAC`(x'':real^3)$2` +THEN EXISTS_TAC`(x'':real^3)$3` +THEN ASM_REWRITE_TAC[REAL_ARITH` &1 - x''$1 - x''$2 - x''$3 + x''$1 + x''$2 + x''$3= &1`;VECTOR_ARITH`(u'''' % e1 + v'''' % e2 + w'''' % e3) + x = +u'''' % e1 + v'''' % e2 + w'''' % e3 + &1 % x`] +THEN REMOVE_THEN "MA" MP_TAC +THEN RESA_TAC +THEN MRESAL_TAC CRAMER_LEMMA1[`A:real^3^3`;`x'':real^3`;`3`][ARITH_RULE`1<=3/\ 3<=3`;DIMINDEX_3;] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN DISCH_THEN(LABEL_TAC"LINH3") +THEN ABBREV_TAC`b1=vector[u':real;u'':real;u'''':real]:real^3` +THEN ABBREV_TAC`b2=vector[v':real;v'':real;v'''':real]:real^3` +THEN ABBREV_TAC`b3=vector[w':real;w'':real;w'''':real]:real^3` +THEN ABBREV_TAC`B=vector[b1;b2;b3:real^3]:real^3^3` +THEN SUBGOAL_THEN`(lambda i j. if j = 3 then (b:real^3)$i else (A:real^3^3)$i$j):real^3^3=B` ASSUME_TAC + +THENL[ +ONCE_ASM_SIMP_TAC[CART_EQ;] +THEN ONCE_ASM_SIMP_TAC[CART_EQ;] +THEN ASM_SIMP_TAC[LAMBDA_BETA;DIMINDEX_3] +THEN REPEAT STRIP_TAC +THEN COND_CASES_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`1<=i /\ i<= 3==> i=1 \/ i=2 \/ i=3`) +THEN RESA_TAC +THEN EXPAND_TAC"B" +THEN EXPAND_TAC "b1" +THEN EXPAND_TAC "b2" +THEN EXPAND_TAC "b3" +THEN EXPAND_TAC "b" +THEN MP_TAC(ARITH_RULE`1<=i' /\ i'<= 3/\ ~(i'=3)==> i'=1 \/ i'=2`) +THEN EXPAND_TAC "A" +THEN REWRITE_TAC[VECTOR_3] +THEN RESA_TAC +THEN EXPAND_TAC "b1" +THEN EXPAND_TAC "b2" +THEN EXPAND_TAC "b3" +THEN EXPAND_TAC "a3" +THEN EXPAND_TAC "a1" +THEN EXPAND_TAC "a2" +THEN REWRITE_TAC[VECTOR_3]; +REMOVE_THEN"LINH3" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`&0<= det(B:real^3^3)`ASSUME_TAC +THENL[REMOVE_ASSUM_TAC +THEN EXPAND_TAC"B" +THEN EXPAND_TAC "b1" +THEN EXPAND_TAC "b2" +THEN EXPAND_TAC "b3" +THEN REWRITE_TAC[DET_3;VECTOR_3] +THEN REMOVE_THEN "ME" MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`((u' % e1 + v' % e2 + w' % e3) + x) - x=u' % e1 + v' % e2 + w' % e3`;CROSS_LMUL;CROSS_RMUL;CROSS_LADD;CROSS_RADD;CROSS_REFL;] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_VECTOR_TAC +THEN ASM_REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;DOT_LNEG] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[] +THEN REDUCE_ARITH_TAC +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA1_TAC REAL_LE_INV`det (A:real^3^3)` +THEN MRESA1_TAC REAL_MUL_LINV`det (A:real^3^3)` +THEN MRESAL_TAC REAL_LE_MUL[`inv(det(A:real^3^3))`;`(x'':real^3)$3 * det(A:real^3^3)`][REAL_ARITH`A*(B*C)=(A*C)*B`;REAL_ARITH`&1*A=A`]]]]]);; + + + +let PROPERTIES_AFF_GT_SUBSET_WEDGE=prove_by_refinement(`convex_local_fan (V,E,FF) /\ v IN V /\ w IN V /\ ~(v=w)/\ generic V E +/\ azim_in_fan (v, rho_node1 FF v) E < pi +/\ aff_gt {vec 0} {v,w} SUBSET wedge_in_fan_gt (v, rho_node1 FF v) E +==> +(!x. x IN FF ==> +aff_gt {vec 0} {v,w} SUBSET wedge_in_fan_gt x E)`, +let lemma=prove(`!A. A \/ ~A`, SET_TAC[]) +in +[ +REWRITE_TAC[convex_local_fan;wedge_in_fan_gt] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN NHANH (ARITH_RULE` a = 2 ==> a > 1 `) +THEN MRESAL_TAC (GEN_ALL LOFA_CARD_EE_V_1)[`FF:real^3#real^3->bool`;`V:real^3->bool`;`v:real^3`;`E:(real^3->bool)->bool`;][ARITH_RULE`2>1`] +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN ` FST (x:real^3 # real^3) IN V /\ SND x IN V ` MP_TAC; +MATCH_MP_TAC LOCAL_FAN_IMP_IN_V +THEN ASM_REWRITE_TAC[]; +STRIP_TAC +THEN ONCE_REWRITE_TAC[GSYM PAIR] +THEN REWRITE_TAC[wedge_in_fan_gt;] +THEN MRESAL_TAC (GEN_ALL LOFA_CARD_EE_V_1)[`FF:real^3#real^3->bool`;`V:real^3->bool`;`FST (x:real^3#real^3)`;`E:(real^3->bool)->bool`;][ARITH_RULE`2>1`] +THEN MRESAL_TAC (GEN_ALL PGSQVBL)[`V:real^3->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`w:real^3`;`x:real^3#real^3`;`E:(real^3->bool)->bool`][convex_local_fan;SET_RULE`{a,b} SUBSET V<=> a IN V /\ b IN V`] +THEN POP_ASSUM MP_TAC +THEN UNDISCH_TAC`!x:real^3#real^3. x IN FF ==> azim_in_fan x E <= pi /\ V SUBSET wedge_in_fan_ge x E` +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `x:real^3#real^3` THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC THEN ASSUME_TAC th) +THEN ONCE_REWRITE_TAC[GSYM PAIR] +THEN REWRITE_TAC[wedge_in_fan_ge;azim_in_fan] +THEN ASM_REWRITE_TAC[ARITH_RULE`2>1`] +THEN LET_TAC +THEN STRIP_TAC +THEN MRESA_TAC PROPERTIES_GENERIC_LOCAL_FAN[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v:real^3`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`) +THEN MP_TAC(REAL_ARITH`azim (vec 0) (FST x) (SND x) d <= pi==> azim (vec 0) (FST x) (SND x) d = pi \/ azim (vec 0) (FST x) (SND x) d < pi`) +THEN RESA_TAC; +MRESA_TAC (GEN_ALL AZIM_PI_WEDGE_GE_CROSS_DOT)[`d:real^3`;`FST (x:real^3#real^3)`;`SND (x:real^3#real^3)`;`vec 0:real^3`] +THEN MRESA_TAC (GEN_ALL AZIM_PI_WEDGE_CROSS_DOT)[`d:real^3`;`FST (x:real^3#real^3)`;`SND (x:real^3#real^3)`;`vec 0:real^3`] +THEN REWRITE_TAC[VECTOR_ARITH`a- vec 0=a`] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC th3[`vec 0:real^3`;`v:real^3`;`w:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`vec 0:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t % vec 0 +a=a`;DOT_RADD;DOT_RMUL] +THEN MATCH_MP_TAC(REAL_ARITH`!A B. (&0< A /\ &0<= B)\/(&0<= A/\ &0< B)==> &0< A+B`) +THEN MP_TAC REAL_LT_MUL_EQ +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`t2:real`;`((FST x cross SND x) dot v:real^3)`] THEN MRESA_TAC th[`t3:real`;`((FST x cross SND x) dot w:real^3)`]) +THEN MP_TAC REAL_LE_MUL_EQ +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`t2:real`;`((FST x cross SND x) dot v:real^3)`] THEN MRESA_TAC th[`t3:real`;`((FST x cross SND x) dot w:real^3)`]) +THEN MP_TAC(SET_RULE`V SUBSET {x' | &0 <= (FST x cross SND x) dot (x':real^3)} /\ v IN V +/\ w IN V +==> &0<= (FST x cross SND x) dot w /\ &0<= (FST x cross SND x) dot v`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A\/ B<=> ~(~A /\ ~ B)`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 <= (FST x cross SND x) dot w /\ &0 <= (FST x cross SND x) dot v /\ ~(&0 < (FST x cross SND x) dot v) /\ ~(&0 < (FST x cross SND x) dot w) +==> (FST x cross SND x) dot v= &0 /\ +(FST x cross SND x) dot w = &0`) +THEN RESA_TAC +THEN ASSUME_TAC2 Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2 +THEN ASSUME_TAC2 EXISTS_INVERSE_OF_V +THEN DOWN THEN STRIP_TAC +THEN ASSUME_TAC2 LOFA_IMP_EE_TWO_ELMS +THEN ASSUME_TAC2 LOFA_CARD_EE_V_1 +THEN UNDISCH_TAC ` azim_in_fan (v:real^3, rho_node1 FF v) E < pi` +THEN UNDISCH_TAC`aff_gt {vec 0} {v, w:real^3} SUBSET +wedge (vec 0) v (rho_node1 FF v) +(azim_cycle (EE v E) (vec 0) v (rho_node1 FF v))` +THEN ASM_REWRITE_TAC[azim_in_fan;ARITH_RULE`2>1`;Local_lemmas.AZIM_CYCLE_TWO_POINT_SET] +THEN LET_TAC +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`d':real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL CONDITION_INANGLE_CROSS_DOT)[`v cross w:real^3`;`(rho_node1 FF v:real^3)`;`v:real^3`;`w:real^3`;`d':real^3`;`vec 0:real^3`][VECTOR_ARITH`a- vec 0=a`] +THEN UNDISCH_TAC`&0 < (v cross rho_node1 FF v) dot w` +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN REPEAT STRIP_TAC +THEN ASSUME_TAC2 Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V +THEN MP_TAC(SET_RULE`V SUBSET {x':real^3 | &0 <= (FST x cross SND x) dot x'} +/\ d' IN V /\ rho_node1 FF v IN V==> &0 <= (FST x cross SND x) dot d' +/\ &0 <= (FST x cross SND x) dot (rho_node1 FF v)`) +THEN RESA_TAC +THEN MRESAL_TAC DOT_CROSS[`(FST x cross (SND x):real^3)`;`v cross w:real^3`;`(rho_node1 FF v)`;`d':real^3`][CROSS_LAGRANGE; +VECTOR_ARITH`&0 % v - &0 % w= vec 0`;DOT_LZERO; REAL_ARITH`&0=A-B<=> A=B`] +THEN MP_TAC(REAL_ARITH`&0 < (v cross w) dot (d':real^3)==> &0 <= (v cross w) dot d'`) +THEN RESA_TAC +THEN MRESAL_TAC CROSS_CROSS_DET[`FST (x:real^3#real^3)`;`(SND (x:real^3#real^3)):real^3`;`v:real^3`;`w:real^3`][DET_CROSS;VECTOR_ARITH`&0 % v - &0 % w= vec 0`] +THEN MP_TAC(REAL_ARITH`&0 <= (FST x cross SND x) dot rho_node1 FF v +==> (FST x cross SND x) dot rho_node1 FF v= &0 \/ &0 < (FST x cross SND x) dot rho_node1 FF v`) +THEN RESA_TAC; +MRESAL_TAC CROSS_CROSS_DET[`FST (x:real^3#real^3)`;`(SND (x:real^3#real^3)):real^3`;`v:real^3`;`rho_node1 FF v:real^3`][DET_CROSS;VECTOR_ARITH`&0 % v - &0 % w= vec 0`] +THEN MRESAL_TAC DOT_CROSS[`(FST x cross (SND x):real^3)`;`v cross (rho_node1 FF v)`;`(FST x cross SND x):real^3`;`w:real^3`][CROSS_LAGRANGE;DOT_LZERO; REAL_ARITH`&0=B- &0*A<=> B= &0`; REAL_ENTIRE;DOT_EQ_0]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[CROSS_EQ_0] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;` (x:real^3#real^3)`]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +MP_TAC(REAL_ARITH`&0 <= (FST x cross SND x) dot (d':real^3) +==> (FST x cross SND x) dot (d':real^3)= &0 \/ &0 < (FST x cross SND x) dot (d':real^3)`) +THEN RESA_TAC; +MRESAL_TAC CROSS_CROSS_DET[`FST (x:real^3#real^3)`;`(SND (x:real^3#real^3)):real^3`;`v:real^3`;`d':real^3`][DET_CROSS;VECTOR_ARITH`&0 % v - &0 % w= vec 0`] +THEN MRESAL_TAC DOT_CROSS[`(FST x cross (SND x):real^3)`;`v cross (d':real^3)`;`(FST x cross SND x):real^3`;`w:real^3`][CROSS_LAGRANGE;DOT_LZERO; REAL_ARITH`&0=B- &0*A<=> B= &0`; REAL_ENTIRE;DOT_EQ_0]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[CROSS_EQ_0] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;` (x:real^3#real^3)`]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[ DOT_LNEG] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +MRESA_TAC REAL_LT_MUL[`(FST x cross SND x) dot rho_node1 FF v`;`((v cross w) dot (d':real^3))`] +THEN MP_TAC REAL_LT_MUL_EQ +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(FST x cross SND x) dot (d':real^3)`;`(v cross w) dot (rho_node1 FF v:real^3)`] ) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[ DOT_LNEG] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;` (x:real^3#real^3)`] +THEN MRESA_TAC(GEN_ALL EXISTS_INVERSE_OF_V)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`FST (x:real^3#real^3)`] +THEN MRESA_TAC (GEN_ALL LOFA_IMP_EE_TWO_ELMS)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;` FST(x:real^3#real^3)`;`vv:real^3`] +THEN UNDISCH_TAC`azim_cycle (EE (FST x) E) (vec 0) (FST x) (SND x) = d:real^3` +THEN ASSUME_TAC2 Local_lemmas.LOCAL_FAN_RHO_NODE_PROS +THEN POP_ASSUM MP_TAC THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x:real^3#real^3`) +THEN SUBGOAL_THEN`rho_node1 FF (FST x)= SND x` ASSUME_TAC; +POP_ASSUM (fun th-> ONCE_REWRITE_TAC[th]) +THEN SET_TAC[]; +ASM_REWRITE_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET] +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`vv:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.WEDGE_GE_EQ_AFF_GE)[`vec 0:real^3`;`FST (x:real^3#real^3)`;`SND (x:real^3#real^3)`;`d:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.INTERIOR_ANGLE1_POS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`FST (x:real^3#real^3)`] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC( GEN_ALL CONVEX_LOFA_IMP_INANGLE_EQ_AZIM) [`V:real^3->bool`;`FF:real^3#real^3->bool`;`E:(real^3->bool)->bool`][convex_local_fan] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th `FST (x:real^3#real^3)`[azim_in_fan;Local_lemmas.AZIM_CYCLE_TWO_POINT_SET; ARITH_RULE`2>1`]) +THEN LET_TAC +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 < azim (vec 0) (FST x) (SND x) d /\ azim (vec 0) (FST x) (SND x) d< pi ==> ~( azim (vec 0) (FST x) (SND x) d= &0 \/ azim (vec 0) (FST x) (SND x) d= pi)`) +THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`vec 0:real^3`;`FST (x:real^3#real^3)`;`SND (x:real^3#real^3)`;`d:real^3`] +THEN MRESA_TAC WEDGE_LUNE[`vec 0:real^3`;`FST (x:real^3#real^3)`;`SND (x:real^3#real^3)`;`d:real^3`] +THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_2_2[`vec 0:real^3`;`SND (x:real^3#real^3)`; `FST (x:real^3#real^3)`;`d:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN RESA_TAC +THEN MRESA_TAC inter_aff_ge_3_1_is_aff_ge_2_2[`vec 0:real^3`;`SND (x:real^3#real^3)`; `FST (x:real^3#real^3)`;`d:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;SET_RULE`A SUBSET B INTER C<=> A SUBSET B /\ A SUBSET C`]) +THEN MRESA1_TAC SIN_POS_PI`azim (vec 0) (FST x) (SND x) d` +THEN POP_ASSUM MP_TAC +THEN MP_TAC (SPECL [` FST(x:real^3#real^3) `;` SND (x:real^3#real^3) `;` d:real^3 `] Trigonometry2.JBDNJJB) +THEN REWRITE_TAC[re_eqvl;] +THEN RESA_TAC +THEN MP_TAC REAL_LT_MUL_EQ +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`t:real`;`((FST x cross SND (x:real^3#real^3)) dot d)`] ) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN MRESAL_TAC aff_ge_3_1_rep_cross_dot[`vec 0:real^3`;`FST (x:real^3#real^3)`;`SND (x:real^3#real^3)`;`d:real^3`][VECTOR_ARITH`a- vec 0=a`] +THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`vec 0:real^3`;`FST (x:real^3#real^3)`;`SND (x:real^3#real^3)`;`d:real^3`][VECTOR_ARITH`a- vec 0=a`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC aff_ge_3_1_rep_cross_dot[`vec 0:real^3`;`d:real^3`;`FST (x:real^3#real^3)`;`SND (x:real^3#real^3)`][VECTOR_ARITH`a- vec 0=a`] +THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`vec 0:real^3`;`d:real^3`;`FST (x:real^3#real^3)`;`SND (x:real^3#real^3)`][VECTOR_ARITH`a- vec 0=a`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN RESA_TAC +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[GSYM CROSS_TRIPLE] +THEN REPEAT STRIP_TAC; +MRESA_TAC th3[`vec 0:real^3`;`v:real^3`;`w:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`vec 0:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t % vec 0 +a=a`;DOT_RADD;DOT_RMUL] +THEN MATCH_MP_TAC(REAL_ARITH`!A B. (&0< A /\ &0<= B)\/(&0<= A/\ &0< B)==> &0< A+B`) +THEN MP_TAC REAL_LT_MUL_EQ +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`t2:real`;`((FST x cross SND x) dot v:real^3)`] THEN MRESA_TAC th[`t3:real`;`((FST x cross SND x) dot w:real^3)`]) +THEN MP_TAC REAL_LE_MUL_EQ +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`t2:real`;`((FST x cross SND x) dot v:real^3)`] THEN MRESA_TAC th[`t3:real`;`((FST x cross SND x) dot w:real^3)`]) +THEN MP_TAC(SET_RULE`V SUBSET {x' | &0 <= (FST x cross SND x) dot (x':real^3)} /\ v IN V +/\ w IN V +==> &0<= (FST x cross SND x) dot w /\ &0<= (FST x cross SND x) dot v`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A\/ B<=> ~(~A /\ ~ B)`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 <= (FST x cross SND x) dot w /\ &0 <= (FST x cross SND x) dot v /\ ~(&0 < (FST x cross SND x) dot v) /\ ~(&0 < (FST x cross SND x) dot w) +==> (FST x cross SND x) dot v= &0 /\ +(FST x cross SND x) dot w = &0`) +THEN RESA_TAC +THEN ASSUME_TAC2 Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2 +THEN ASSUME_TAC2 EXISTS_INVERSE_OF_V +THEN DOWN THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL LOFA_IMP_EE_TWO_ELMS)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`vv':real^3`] +THEN ASSUME_TAC2 LOFA_CARD_EE_V_1 +THEN UNDISCH_TAC ` azim_in_fan (v:real^3, rho_node1 FF v) E < pi` +THEN UNDISCH_TAC`aff_gt {vec 0} {v, w:real^3} SUBSET +wedge (vec 0) v (rho_node1 FF v) +(azim_cycle (EE v E) (vec 0) v (rho_node1 FF v))` +THEN ASM_REWRITE_TAC[azim_in_fan;ARITH_RULE`2>1`;Local_lemmas.AZIM_CYCLE_TWO_POINT_SET] +THEN LET_TAC +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`d':real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL CONDITION_INANGLE_CROSS_DOT)[`v cross w:real^3`;`(rho_node1 FF v:real^3)`;`v:real^3`;`w:real^3`;`d':real^3`;`vec 0:real^3`][VECTOR_ARITH`a- vec 0=a`] +THEN UNDISCH_TAC`&0 < (v cross rho_node1 FF v) dot w` +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN REPEAT STRIP_TAC +THEN ASSUME_TAC2 Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V +THEN MP_TAC(SET_RULE`V SUBSET {x':real^3 | &0 <= (FST x cross SND x) dot x'} +/\ d' IN V /\ rho_node1 FF v IN V==> &0 <= (FST x cross SND x) dot d' +/\ &0 <= (FST x cross SND x) dot (rho_node1 FF v)`) +THEN RESA_TAC +THEN MRESAL_TAC DOT_CROSS[`(FST x cross (SND x):real^3)`;`v cross w:real^3`;`(rho_node1 FF v)`;`d':real^3`][CROSS_LAGRANGE; +VECTOR_ARITH`&0 % v - &0 % w= vec 0`;DOT_LZERO; REAL_ARITH`&0=A-B<=> A=B`] +THEN MP_TAC(REAL_ARITH`&0 < (v cross w) dot (d':real^3)==> &0 <= (v cross w) dot d'`) +THEN RESA_TAC +THEN MRESAL_TAC CROSS_CROSS_DET[`FST (x:real^3#real^3)`;`(SND (x:real^3#real^3)):real^3`;`v:real^3`;`w:real^3`][DET_CROSS;VECTOR_ARITH`&0 % v - &0 % w= vec 0`] +THEN MP_TAC(REAL_ARITH`&0 <= (FST x cross SND x) dot rho_node1 FF v +==> (FST x cross SND x) dot rho_node1 FF v= &0 \/ &0 < (FST x cross SND x) dot rho_node1 FF v`) +THEN RESA_TAC; +MRESAL_TAC CROSS_CROSS_DET[`FST (x:real^3#real^3)`;`(SND (x:real^3#real^3)):real^3`;`v:real^3`;`rho_node1 FF v:real^3`][DET_CROSS;VECTOR_ARITH`&0 % v - &0 % w= vec 0`] +THEN MRESAL_TAC DOT_CROSS[`(FST x cross (SND x):real^3)`;`v cross (rho_node1 FF v)`;`(FST x cross SND x):real^3`;`w:real^3`][CROSS_LAGRANGE;DOT_LZERO; REAL_ARITH`&0=B- &0*A<=> B= &0`; REAL_ENTIRE;DOT_EQ_0]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[CROSS_EQ_0] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;` (x:real^3#real^3)`]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +MP_TAC(REAL_ARITH`&0 <= (FST x cross SND x) dot (d':real^3) +==> (FST x cross SND x) dot (d':real^3)= &0 \/ &0 < (FST x cross SND x) dot (d':real^3)`) +THEN RESA_TAC; +MRESAL_TAC CROSS_CROSS_DET[`FST (x:real^3#real^3)`;`(SND (x:real^3#real^3)):real^3`;`v:real^3`;`d':real^3`][DET_CROSS;VECTOR_ARITH`&0 % v - &0 % w= vec 0`] +THEN MRESAL_TAC DOT_CROSS[`(FST x cross (SND x):real^3)`;`v cross (d':real^3)`;`(FST x cross SND x):real^3`;`w:real^3`][CROSS_LAGRANGE;DOT_LZERO; REAL_ARITH`&0=B- &0*A<=> B= &0`; REAL_ENTIRE;DOT_EQ_0]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[CROSS_EQ_0] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;` (x:real^3#real^3)`]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[ DOT_LNEG] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +MRESA_TAC REAL_LT_MUL[`(FST x cross SND x) dot rho_node1 FF v`;`((v cross w) dot (d':real^3))`] +THEN MP_TAC REAL_LT_MUL_EQ +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(FST x cross SND x) dot (d':real^3)`;`(v cross w) dot (rho_node1 FF v:real^3)`] ) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[ DOT_LNEG] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +MRESA_TAC th3[`vec 0:real^3`;`v:real^3`;`w:real^3`] +THEN MRESAL_TAC AFF_GT_1_2[`vec 0:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t % vec 0 +a=a`;DOT_RADD;DOT_RMUL] +THEN MATCH_MP_TAC(REAL_ARITH`!A B. (&0< A /\ &0<= B)\/(&0<= A/\ &0< B)==> &0< A+B`) +THEN MP_TAC REAL_LT_MUL_EQ +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`t2:real`;`((d cross FST (x:real^3#real^3)) dot v:real^3)`] THEN MRESA_TAC th[`t3:real`;`((d cross FST (x:real^3#real^3)) dot w:real^3)`]) +THEN MP_TAC REAL_LE_MUL_EQ +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`t2:real`;`((d cross FST (x:real^3#real^3)) dot v:real^3)`] THEN MRESA_TAC th[`t3:real`;`((d cross FST (x:real^3#real^3)) dot w:real^3)`]) +THEN MP_TAC(SET_RULE`V SUBSET {y | &0 <= (d cross FST (x:real^3#real^3)) dot (y:real^3)} /\ v IN V +/\ w IN V +==> &0<= (d cross FST x) dot w /\ &0<= (d cross FST x) dot v`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A\/ B<=> ~(~A /\ ~ B)`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 <= (d cross FST x) dot w /\ &0 <= (d cross FST x) dot v /\ ~(&0 < (d cross FST x) dot v) /\ ~(&0 < (d cross FST x) dot w) +==> (d cross FST (x:real^3#real^3)) dot v= &0 /\ +(d cross FST x) dot w = &0`) +THEN RESA_TAC +THEN ASSUME_TAC2 Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2 +THEN ASSUME_TAC2 EXISTS_INVERSE_OF_V +THEN DOWN THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL LOFA_IMP_EE_TWO_ELMS)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`vv':real^3`] +THEN ASSUME_TAC2 LOFA_CARD_EE_V_1 +THEN UNDISCH_TAC ` azim_in_fan (v:real^3, rho_node1 FF v) E < pi` +THEN UNDISCH_TAC`aff_gt {vec 0} {v, w:real^3} SUBSET +wedge (vec 0) v (rho_node1 FF v) +(azim_cycle (EE v E) (vec 0) v (rho_node1 FF v))` +THEN ASM_REWRITE_TAC[azim_in_fan;ARITH_RULE`2>1`;Local_lemmas.AZIM_CYCLE_TWO_POINT_SET] +THEN LET_TAC +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`d':real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL CONDITION_INANGLE_CROSS_DOT)[`v cross w:real^3`;`(rho_node1 FF v:real^3)`;`v:real^3`;`w:real^3`;`d':real^3`;`vec 0:real^3`][VECTOR_ARITH`a- vec 0=a`] +THEN UNDISCH_TAC`&0 < (v cross rho_node1 FF v) dot w` +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN REPEAT STRIP_TAC +THEN ASSUME_TAC2 Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V +THEN MP_TAC(SET_RULE`V SUBSET {x':real^3 | &0 <= (d cross FST (x:real^3#real^3)) dot x'} +/\ d' IN V /\ rho_node1 FF v IN V==> &0 <= (d cross FST (x:real^3#real^3)) dot d' +/\ &0 <= (d cross FST (x:real^3#real^3)) dot (rho_node1 FF v)`) +THEN RESA_TAC +THEN MRESAL_TAC DOT_CROSS[`(d cross FST (x:real^3#real^3):real^3)`;`v cross w:real^3`;`(rho_node1 FF v)`;`d':real^3`][CROSS_LAGRANGE; +VECTOR_ARITH`&0 % v - &0 % w= vec 0`;DOT_LZERO; REAL_ARITH`&0=A-B<=> A=B`] +THEN MP_TAC(REAL_ARITH`&0 < (v cross w) dot (d':real^3)==> &0 <= (v cross w) dot d'`) +THEN RESA_TAC +THEN MRESAL_TAC CROSS_CROSS_DET[`d:real^3`;`FST (x:real^3#real^3)`;`v:real^3`;`w:real^3`][DET_CROSS;VECTOR_ARITH`&0 % v - &0 % w= vec 0`] +THEN MP_TAC(REAL_ARITH`&0 <= (d cross FST (x:real^3#real^3)) dot rho_node1 FF v +==> (d cross FST (x:real^3#real^3)) dot rho_node1 FF v= &0 \/ &0 < (d cross FST (x:real^3#real^3)) dot rho_node1 FF v`) +THEN RESA_TAC; +MRESAL_TAC CROSS_CROSS_DET[`d:real^3`;`FST (x:real^3#real^3)`;`v:real^3`;`rho_node1 FF v:real^3`][DET_CROSS;VECTOR_ARITH`&0 % v - &0 % w= vec 0`] +THEN MRESAL_TAC DOT_CROSS[`(d cross FST (x:real^3#real^3))`;`v cross (rho_node1 FF v)`;`d cross FST (x:real^3#real^3):real^3`;`w:real^3`][CROSS_LAGRANGE;DOT_LZERO; REAL_ARITH`&0=B- &0*A<=> B= &0`; REAL_ENTIRE;DOT_EQ_0]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[CROSS_EQ_0] +THEN UNDISCH_TAC `!x:real^3. x IN V ==> x,rho_node1 FF x IN FF` +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`vv:real^3`) +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;` (d:real^3,FST (x:real^3#real^3))`]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +MP_TAC(REAL_ARITH`&0 <= ((d cross FST (x:real^3#real^3))) dot (d':real^3) +==> ((d cross FST (x:real^3#real^3))) dot (d':real^3)= &0 \/ &0 < ((d cross FST (x:real^3#real^3))) dot (d':real^3)`) +THEN RESA_TAC; +MRESAL_TAC CROSS_CROSS_DET[`d:real^3`;`FST (x:real^3#real^3)`;`v:real^3`;`d':real^3`][DET_CROSS;VECTOR_ARITH`&0 % v - &0 % w= vec 0`] +THEN MRESAL_TAC DOT_CROSS[`(d cross FST (x:real^3#real^3))`;`v cross (d':real^3)`;`(d cross FST (x:real^3#real^3)):real^3`;`w:real^3`][CROSS_LAGRANGE;DOT_LZERO; REAL_ARITH`&0=B- &0*A<=> B= &0`; REAL_ENTIRE;DOT_EQ_0]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[CROSS_EQ_0] +THEN UNDISCH_TAC `!x:real^3. x IN V ==> x,rho_node1 FF x IN FF` +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`vv:real^3`) +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;` (d:real^3,FST (x:real^3#real^3))`]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[ DOT_LNEG] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +MRESA_TAC REAL_LT_MUL[`(d cross FST (x:real^3#real^3)) dot rho_node1 FF v`;`((v cross w) dot (d':real^3))`] +THEN MP_TAC REAL_LT_MUL_EQ +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(d cross FST (x:real^3#real^3)) dot (d':real^3)`;`(v cross w) dot (rho_node1 FF v:real^3)`] ) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[ DOT_LNEG] +THEN ASM_TAC +THEN REAL_ARITH_TAC]);; + +let AFF_GE_SUBSET_AFF_GE_UNION=prove(`!x v u v1:real^3. +DISJOINT {x} {v, u} /\ +DISJOINT {x} {v, v1} /\ +DISJOINT {x} {v1, u} /\ +v1 IN aff_gt {x} {v, u} +==> aff_ge {x} {v, u} SUBSET aff_ge {x} {v, v1} UNION aff_ge {x} {v1,u}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`v1:real^3`] +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v1:real^3`;`u:real^3`][SUBSET;IN_ELIM_THM;UNION] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1'' % x + t2'' % v + t3'' % (t1 % x + t2 % v + t3 % u)= (t1''+t3'' *t1) % x + (t2''+ t3''* t2) % v + (t3''*t3) % u` +;VECTOR_ARITH`t1'' % x + t2'' % (t1 % x + t2 % v + t3 % u) + t3'' % u= +(t1''+ t2''* t1) % x + (t2'' * t2) % v + (t3'' + t2''*t3) % u`] +THEN DISJ_CASES_TAC(REAL_ARITH`inv t3 * t3' <= inv t2 * t2' \/ inv t2 * t2' <= inv t3 * t3'`) +THENL[ +MATCH_MP_TAC(SET_RULE`A==> A\/B`) +THEN MP_TAC(REAL_ARITH`&0< t3==> ~(t3= &0) /\ &0<= t3`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t3:real` +THEN MP_TAC(REAL_ARITH`&0< t2==> ~(t2= &0)/\ &0<= t2`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2:real` +THEN EXISTS_TAC`&1-(t2'- inv t3 * t3' * t2)- inv t3 * t3'` +THEN EXISTS_TAC`(t2'- inv t3 * t3' * t2)` +THEN EXISTS_TAC`inv t3 * t3'` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1- A-B+A+B= &1`;REAL_ARITH`&0<= a-b<=>b<=a`; REAL_ARITH`t2' - inv t3 * t3' * t2 + (inv t3 * t3') * t2= t2'`; REAL_ARITH`(A*B)*C=B*(A*C)`; REAL_ARITH`&1 - (t2' - inv t3 * t3' * t2) - inv t3 * t3' + t3' * inv t3 * t1= +&1 - t2' -inv t3 * t3' *(t3-(t1+t2+t3)+ &1)`; REAL_ARITH`a- &1+ &1=a`; REAL_ARITH`a* &1=a`] +THEN ASM_REWRITE_TAC[REAL_ARITH`a*b*c= (a*c) *b`; REAL_ARITH`(&1 - t2' - &1 * t3')= t1' + &1- (t1'+t2'+t3')`; REAL_ARITH`a+ &1- &1=a`;] +THEN MRESA_TAC REAL_LE_LMUL[`t2:real`;`inv t3 * t3'`;`inv t2 * t2'`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A*B*C=(B*A)*C/\ &1* a=a`] +THEN RESA_TAC +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_INV +THEN ASM_REWRITE_TAC[]; +MATCH_MP_TAC(SET_RULE`B==> A\/B`) +THEN MP_TAC(REAL_ARITH`&0< t3==> ~(t3= &0) /\ &0<= t3`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t3:real` +THEN MP_TAC(REAL_ARITH`&0< t2==> ~(t2= &0)/\ &0<= t2`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2:real` +THEN EXISTS_TAC`&1- inv t2 * t2' -( t3'- inv t2 * t2'* t3)` +THEN EXISTS_TAC`inv t2 * t2'` +THEN EXISTS_TAC`( t3'- inv t2 * t2'* t3)` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1- A-B+A+B= &1`;REAL_ARITH`&0<= a-b<=>b<=a`; REAL_ARITH`t2' - inv t3 * t3' * t2 + (inv t3 * t3') * t2= t2'`; REAL_ARITH`(A*B)*C=B*(A*C)`;] +THEN ASM_REWRITE_TAC[ REAL_ARITH`(&1 - inv t2 * t2' - (t3' - (inv t2 * t3) * t2') + (t2' * t1) * inv t2) += &1 - t3' - inv t2 * t2'* ( t2 -(t1+t2+t3)+ &1)`; REAL_ARITH`a- &1+ &1=a`; REAL_ARITH`a* &1=a`;REAL_ARITH`a*b*c= (a*c) *b`; REAL_ARITH`(&1 - t2' - &1 * t3')= t1' + &1- (t1'+t3'+t2')`; REAL_ARITH`a+ &1- &1=a`;] +THEN MRESA_TAC REAL_LE_LMUL[`t3:real`;`inv t2 * t2'`;`inv t3 * t3'`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`A*B*C=(B*A)*C/\ &1* a=a`] +THEN RESA_TAC +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_INV +THEN ASM_REWRITE_TAC[]]);; + + +let aff_ge_subset3_aff_ge=prove(`!x:real^3 v:real^3 u:real^3 v1:real^3. +DISJOINT {x} {v,u} /\ DISJOINT {x} {v,v1} +/\ v1 IN aff_gt {x} {v,u} +==> +aff_ge {x} {v,v1} SUBSET aff_ge {x} {v,u}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`][IN_ELIM_THM] +THEN MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`v1:real^3`][IN_ELIM_THM;SUBSET] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1' % x + t2' % v + t3' % (t1 % x + t2 % v + t3 % u) +=(t1'+ t3'*t1) % x + (t2'+ t3' * t2) % v + (t3' * t3) % u:real^3`] +THEN STRIP_TAC +THEN EXISTS_TAC`t1' + t3' * t1:real` +THEN EXISTS_TAC`t2' + t3' * t2:real` +THEN EXISTS_TAC`t3' * t3:real` +THEN MP_TAC(REAL_ARITH`&0< t2 /\ &0< t3==> &0<= t2 /\ &0<= t3`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_MUL[`t3':real`;`t2:real`] +THEN MRESA_TAC REAL_LE_MUL[`t3':real`;`t3:real`] +THEN ASM_REWRITE_TAC[REAL_ARITH`(t1' + t3' * t1) + (t2' + t3' * t2) + t3' * t3= +t1'+ t2' + t3'*(t1+t2+t3)`; REAL_ARITH`A* &1=A`] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + +let AFF_GE_EQ_AFF_GE_UNION=prove(`!x v u v1:real^3. +DISJOINT {x} {v, u} /\ +DISJOINT {x} {v, v1} /\ +DISJOINT {x} {v1, u} /\ +v1 IN aff_gt {x} {v, u} +==> aff_ge {x} {v, u} = aff_ge {x} {v, v1} UNION aff_ge {x} {v1,u}`, +REPEAT STRIP_TAC +THEN ASSUME_TAC2 AFF_GE_SUBSET_AFF_GE_UNION +THEN MRESA_TAC aff_ge_subset3_aff_ge[`x:real^3`;`v:real^3`;`u:real^3`;`v1:real^3`] +THEN MRESA_TAC aff_ge_subset3_aff_ge[`x:real^3`;`u:real^3`;`v:real^3`;`v1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + + + +let order = new_definition ` order f x y = (@n. ITER n f x =y /\ (!i. 0< i /\ i< n ==> ~(ITER i f x= y)))`;; +let slicev = new_definition ` slicev E FF v w = {u| ?n. 0<= n /\ n<= order (rho_node1 FF) v w /\ u= ITER n (rho_node1 FF) v}`;; + +let slicee = new_definition ` slicee E FF v w = {e| ?u. u IN (slicev E FF v w) DELETE w /\ e={u,rho_node1 FF u} } UNION {{w,v}}`;; + +let slicef = new_definition ` slicef E FF v w = {f| ?u. u IN (slicev E FF v w) DELETE w /\ f=(u,rho_node1 FF u) } UNION {(w,v)}`;; + + +let rho_fun = new_definition `rho_fun y = &1 + (inv (&2 * h0 - &2)) * (inv pi) * sol0 * (y - &2)`;; + + +let tau_fun = new_definition `tau_fun V E f = sum (f) (\e. rho_fun(norm(FST e)) * (azim_in_fan e E)) - (pi + sol0) * &(CARD f -2)`;; + + + +let ORDER=prove(`(ITER n f x = y /\ (!i. 0 < i /\ i < n ==> ~(ITER i f x = y))) +==> +ITER (order f x y) f x= y /\ (!i. 0 < i /\ i < order f x y ==> ~(ITER i f x = y))`, +STRIP_TAC +THEN ONCE_REWRITE_TAC[order] +THEN SELECT_ELIM_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]);; + +let UNIQUE_ORDER=prove_by_refinement(`!f:A->A. ITER n f x = y /\ (!i. 0 < i /\ i < n ==> ~(ITER i f x = y)) /\ ~(x=y) +==> +order f x y= n`, +[REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL ORDER)[`n:num`;`f:A->A`;`x:A`;`y:A`] +THEN MP_TAC(ARITH_RULE`order (f:A->A) x y =0 \/ 0< order (f:A->A) x y `) +THEN RESA_TAC; +POP_ASSUM(fun th -> ASM_TAC THEN REWRITE_TAC[th;ITER]) +THEN SET_TAC[]; +MP_TAC(ARITH_RULE`order (f:A->A) x y A) x y `) +THEN RESA_TAC; +ASM_TAC +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `order (f:A->A) x y`) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "THY") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THY" MP_TAC +THEN RESA_TAC; +MP_TAC(ARITH_RULE`n<= order (f:A->A) x y ==> n< order (f:A->A) x y \/ order (f:A->A) x y =n`) +THEN RESA_TAC; +MP_TAC(ARITH_RULE`n =0 \/ 0< n`) +THEN RESA_TAC; +POP_ASSUM(fun th -> ASM_TAC THEN REWRITE_TAC[th;ITER]) +THEN SET_TAC[]; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC "THY") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THY" (fun th-> MRESA1_TAC th`n:num`)]);; + + + + + +let COMPATIBLE_BW_TWO_LEMMAS = prove_by_refinement +(`convex_local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E) /\ + HS = hypermap (HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v,rho_node1 FF v) +==> (v_prime V fv = slicev E FF v w ) /\ + e_prime (E UNION {{v, w}}) fv = slicee E FF v w /\ +fv = slicef E FF v w `, +[STRIP_TAC; +ASSUME_TAC2 PROVE_THE_SLICE_ASSUMPTION; +MP_TAC POINTS_IN_HAFL_CIRCLE; +ANTS_TAC; +DOWN_TAC; +SIMP_TAC[convex_local_fan]; + +ASSUME_TAC2 Local_lemmas.CVX_LO_IMP_LO; +ASSUME_TAC2 POINT_PRESENTED_IN_RHOND1; +DOWN THEN STRIP_TAC; +DISCH_TAC; +MP_TAC DETERMINE_FV2; +PHA; +ANTS_TAC; +ASM_REWRITE_TAC[TAUT` a /\ b ==> c <=> a ==> b ==> c `]; + + +DISCH_TAC; +SUBGOAL_THEN` v_prime (V:real^3 -> bool) (fv:real^3#real^3 -> bool) = +slicev (E:(real^3 -> bool) -> bool) FF v w ` MP_TAC; +ASM_REWRITE_TAC[slicev; EXTENSION; IN_ELIM_THM]; +GEN_TAC; +EQ_TAC; +STRIP_TAC; +EXISTS_TAC` n':num`; +ASM_REWRITE_TAC[LE_0]; +MP_TAC (ISPECL [` v:real^3 `;` w:real^3 `;` n:num `; ` rho_node1 FF `] (GEN_ALL UNIQUE_ORDER)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +GEN_TAC; +ASM_CASES_TAC` i = 0`; +ASM_REWRITE_TAC[ITER]; +ASSUME_TAC2 (ARITH_RULE` ~( i =0) ==> 0 < i `); +ASM_REWRITE_TAC[]; +SIMP_TAC[]; + +STRIP_TAC; + +ASM_CASES_TAC` n < (n': num) `; +DOWN; +FIRST_X_ASSUM NHANH; +ASM_REWRITE_TAC[]; +DOWN; +ARITH_TAC; + + + +STRIP_TAC; +EXISTS_TAC `n':num `; +ASM_REWRITE_TAC[]; +MP_TAC (ISPECL [` v:real^3 `;` w:real^3 `;` n:num `; ` rho_node1 FF `] (GEN_ALL UNIQUE_ORDER)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +GEN_TAC; +ASM_CASES_TAC` i = 0 `; +ASM_REWRITE_TAC[ITER]; +ASSUME_TAC2 (ARITH_RULE` ~( i = 0) ==> 0 < i `); +ASM_REWRITE_TAC[]; +DISCH_THEN SUBST_ALL_TAC; +GEN_TAC THEN DISCH_TAC; +ASSUME_TAC2 (ARITH_RULE` m < n' /\ n' <= n ==> m < n:num `); +DOWN; +ASM_REWRITE_TAC[]; + + +SIMP_TAC[]; +REWRITE_TAC[slicee; slicef]; +DISCH_THEN (SUBST_ALL_TAC o SYM); +REWRITE_TAC[e_prime]; + + +CONJ_TAC; +REWRITE_TAC[EXTENSION; IN_UNION]; +GEN_TAC; +EQ_TAC; +ONCE_REWRITE_TAC[IN_ELIM_THM]; +REWRITE_TAC[]; +FIRST_ASSUM SUBST1_TAC; +REWRITE_TAC[IN_INSERT]; +FIRST_ASSUM (SUBST1_TAC o SYM); +STRIP_TAC; + +DOWN THEN DOWN; +SIMP_TAC[PAIR_EQ]; + + +DISJ1_TAC; +DOWN THEN DOWN; +REWRITE_TAC[IN_ELIM_THM; PAIR_EQ]; +STRIP_TAC; +STRIP_TAC; +EXISTS_TAC` ITER m (rho_node1 FF) v `; +REWRITE_TAC[GSYM IN_INSERT; GSYM EXTENSION]; +DOWN; +ASM_REWRITE_TAC[]; +SIMP_TAC[GSYM ITER; ADD1]; +STRIP_TAC; +REWRITE_TAC[IN_DELETE; IN_ELIM_THM]; +CONJ_TAC; +EXISTS_TAC `m:num `; +REWRITE_TAC[]; +ASM_REWRITE_TAC[]; +GEN_TAC THEN STRIP_TAC; +ASSUME_TAC2 (ARITH_RULE` m' < m /\ m < (n:num) ==> m' < n`); +DOWN; +ASM_REWRITE_TAC[]; + +UNDISCH_TAC` m < (n:num) `; +ASM_REWRITE_TAC[]; + +DISJ2_TAC THEN DISJ1_TAC; +DOWN THEN DOWN; +SIMP_TAC[PAIR_EQ]; + + +ASM_REWRITE_TAC[]; + + +REWRITE_TAC[INSERT_COMM]; +REPLICATE_TAC 3 DOWN; +REWRITE_TAC[NOT_IN_EMPTY]; + +REPLICATE_TAC 3 DOWN; +REWRITE_TAC[NOT_IN_EMPTY]; + +(* ==================== *) + +REWRITE_TAC[GSYM EXTENSION; GSYM IN_INSERT]; +DOWN; +FIRST_ASSUM SUBST1_TAC; +SIMP_TAC[]; +STRIP_TAC; +REWRITE_TAC[IN_ELIM_THM; IN_DELETE]; +STRIP_TAC; +EXISTS_TAC` u: real^3`; +EXISTS_TAC` rho_node1 FF u `; +REWRITE_TAC[IN_INSERT; IN_ELIM_THM]; +ASM_REWRITE_TAC[]; + + +CONJ_TAC; +DISJ1_TAC; +MATCH_MP_TAC LOCAL_RHO_NODE_PAIR_E; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` (v:real^3) IN V `; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ORBIT_MAP_VITER; +DOWN THEN SIMP_TAC[]; +DISJ2_TAC; +EXISTS_TAC` n': num `; +REWRITE_TAC[GSYM ITER; ADD1]; +ASM_CASES_TAC` (n:num) < n' `; +DOWN; +FIRST_X_ASSUM NHANH; +ASM_REWRITE_TAC[]; + +DOWN; +ASM_CASES_TAC` n = (n': num) `; +UNDISCH_TAC` ~(u = (w:real^3)) `; +FIRST_X_ASSUM SUBST_ALL_TAC; +ASM_REWRITE_TAC[]; +DOWN THEN ARITH_TAC; + + + + + +DOWN; +REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC` w:real^3 `; +EXISTS_TAC` v:real^3 `; +DOWN THEN SIMP_TAC[]; + + +SIMP_TAC[INSERT_COMM]; +DOWN; +FIRST_ASSUM SUBST1_TAC; +SIMP_TAC[]; +STRIP_TAC; + + + +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ASSUME_TAC2 DETERMINE_FV; +FIRST_X_ASSUM SUBST1_TAC; +REWRITE_TAC[EXTENSION; IN_INSERT; IN_UNION; IN_ELIM_THM]; +GEN_TAC; +EQ_TAC; +STRIP_TAC; +FIRST_X_ASSUM (fun x -> REWRITE_TAC[x]); +DISJ1_TAC; +EXISTS_TAC` ITER n' (rho_node1 FF) v `; +ASM_REWRITE_TAC[IN_DELETE; IN_ELIM_THM;GSYM ITER; ADD1]; +CONJ_TAC; +EXISTS_TAC `n': num `; +REWRITE_TAC[]; +GEN_TAC; +NHANH (ARITH_RULE` a < (b:num) ==> a < b + 1 `); +FIRST_X_ASSUM NHANH; +SIMP_TAC[]; +MP_TAC (ARITH_RULE` n' < n' + 1 `); +ASM_REWRITE_TAC[]; + + +REWRITE_TAC[NOT_IN_EMPTY]; +STRIP_TAC; +DISJ2_TAC; +DOWN THEN DOWN; +REWRITE_TAC[IN_ELIM_THM; IN_DELETE]; +STRIP_TAC; +STRIP_TAC; +EXISTS_TAC` n':num `; +ASM_REWRITE_TAC[ADD1;GSYM ITER]; +GEN_TAC; +ASM_CASES_TAC` m = (n': num) `; +STRIP_TAC; +UNDISCH_TAC` ~( u = (w:real^3)) `; +ASM_REWRITE_TAC[]; +DOWN THEN PHA; +REWRITE_TAC[ARITH_RULE` ~(m = n') /\ m < n' + 1 <=> m < (n':num) `]; +ASM_REWRITE_TAC[]; +DOWN THEN SIMP_TAC[]]);; + + + + + +let COMPATIBLE_BW_TWO_LEMMAS2 = prove_by_refinement +(`(convex_local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E) /\ + HS = hypermap (HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v,rho_node1 FF v))/\ +fw = face HS (w, rho_node1 FF w) +==> ( (v_prime V fv = slicev E FF v w ) /\ + e_prime (E UNION {{v, w}}) fv = slicee E FF v w /\ +fv = slicef E FF v w ) /\ +( (v_prime V fw = slicev E FF w v ) /\ + e_prime (E UNION {{w, v}}) fw = slicee E FF w v /\ +fw = slicef E FF w v )`, +[NHANH COMPATIBLE_BW_TWO_LEMMAS; +STRIP_TAC; +CONJ_TAC; +CONJ_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +CONJ_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +FIRST_X_ASSUM ACCEPT_TAC; + + +MATCH_MP_TAC COMPATIBLE_BW_TWO_LEMMAS; +ASM_REWRITE_TAC[]; +REWRITE_TAC[INSERT_COMM]; +ASM_REWRITE_TAC[]]);; + + + + + +let EJRCFJD_concl=`!V E FF v w. convex_local_fan(V,E,FF) +/\ +v IN V /\ w IN V +/\ (!u u1. u IN {v,w} /\ u1 IN V /\ ~(u=u1) ==> ~(collinear {vec 0, u, u1})) +/\ (!e. e IN FF ==> aff_gt {vec 0} {v,w} SUBSET wedge_in_fan_gt e E) +==> convex_local_fan(slicev E FF v w, slicee E FF v w, slicef E FF v w) +/\ convex_local_fan(slicev E FF w v, slicee E FF w v, slicef E FF w v) +/\ tau_fun V E FF >= tau_fun (slicev E FF v w) (slicee E FF v w) (slicef E FF v w) + tau_fun (slicev E FF w v) (slicee E FF w v) (slicef E FF w v) +/\ sol_local E FF= sol_local (slicee E FF v w) (slicef E FF v w) + sol_local (slicee E FF w v) (slicef E FF w v) +/\ CARD (slicev E FF v w) < CARD V +/\ CARD (slicev E FF w v) < CARD V +/\(generic V E ==> generic (slicev E FF v w) (slicee E FF v w) +/\ generic (slicev E FF w v) (slicee E FF w v))` +;; + +let NKEZBFC_concl=`!V E FF. convex_local_fan(V,E,FF) /\ generic V E +==> &0 <= sol_local E FF` +;; + +let NKEZBFC_concl2 = mk_imp (EJRCFJD_concl, NKEZBFC_concl);; + + +let lemma=prove(`!A. A \/ ~A`, SET_TAC[]);; +let lemma1=prove(`!A. ~A \/ A`, SET_TAC[]);; + + + + + + + +g(NKEZBFC_concl2);; + +let NKEZBFC_PREP =prove_by_refinement(NKEZBFC_concl2, +[REPEAT STRIP_TAC +THEN ABBREV_TAC`n= CARD (V:real^3->bool)-3` +THEN ASM_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN SPEC_TAC(`V:real^3->bool`,`V:real^3->bool`) +THEN SPEC_TAC(`E:(real^3->bool)->bool`,`E:(real^3->bool)->bool`) +THEN SPEC_TAC(`FF:real^3#real^3->bool`,`FF:real^3#real^3->bool`) +THEN SPEC_TAC(`n:num`,`n:num`) +THEN MATCH_MP_TAC num_WF +THEN INDUCT_TAC; +REPEAT STRIP_TAC +THEN MRESA_TAC CARD_VERTEX_GE_3_LOCAL_FAN[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`] +THEN MP_TAC(ARITH_RULE`3<= CARD (V:real^3->bool) /\ CARD V -3 =0 <=> CARD V=3`) +THEN RESA_TAC +THEN ASM_MESON_TAC[SOL_LOCAL_FAN_POS_CASE3]; +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN DISCH_THEN(LABEL_TAC"LIN21") +THEN REPEAT STRIP_TAC +THEN MRESA_TAC CARD_VERTEX_GE_3_LOCAL_FAN[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`] +THEN MRESA1_TAC lemma `(?v w:real^3. v IN V /\ w IN V +/\ (!e. e IN FF ==> aff_gt {vec 0} {v,w} SUBSET wedge_in_fan_gt e E) +):bool`; +MRESA_TAC (GEN_ALL PROPERTIES_GENERIC1)[`FF:real^3#real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`;`V:real^3->bool`;] +THEN REMOVE_THEN "LINH"(fun th-> MRESA_TAC th[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`w:real^3`]) +THEN MRESA_TAC CARD_VERTEX_GE_3_LOCAL_FAN[`(slicev (E:(real^3->bool)->bool) FF v w):real^3->bool`;`(slicee (E:(real^3->bool)->bool) FF v w):(real^3->bool)->bool`;`(slicef (E:(real^3->bool)->bool) FF v w):real^3#real^3->bool`] +THEN MRESA_TAC CARD_VERTEX_GE_3_LOCAL_FAN[`(slicev (E:(real^3->bool)->bool) FF w v):real^3->bool`;`(slicee (E:(real^3->bool)->bool) FF w v ):(real^3->bool)->bool`;`(slicef (E:(real^3->bool)->bool) FF w v ):real^3#real^3->bool`] +THEN MP_TAC(ARITH_RULE`CARD (slicev E FF v w)< CARD V +/\ CARD (slicev E FF w v)< CARD V +/\ 3<= CARD V /\ 3<= CARD (slicev E FF v w) +/\ 3<= CARD (slicev E FF w v)==> CARD (slicev (E:(real^3->bool)->bool) FF v w) -3 < CARD V -3 +/\ CARD (slicev E FF w v) -3 < CARD (V:real^3->bool) -3`) +THEN RESA_TAC +THEN REMOVE_THEN "LIN21"(fun th-> MRESA1_TAC th`CARD (slicev (E:(real^3->bool)->bool) FF v w) -3` +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(slicef (E:(real^3->bool)->bool) FF v w)`;`(slicee (E:(real^3->bool)->bool) FF v w)`;`(slicev (E:(real^3->bool)->bool) FF v w):real^3->bool`]) +THEN MRESA1_TAC th`CARD (slicev (E:(real^3->bool)->bool) FF w v) -3` +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(slicef (E:(real^3->bool)->bool) FF w v)`;`(slicee (E:(real^3->bool)->bool) FF w v)`;`(slicev (E:(real^3->bool)->bool) FF w v)`])) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_EXISTS_THM;DE_MORGAN_THM] +THEN DISCH_THEN(LABEL_TAC"LINH2") +THEN ASSUME_TAC2 SOL_LOFA_EQ_SUM_INANGLE +THEN MRESA1_TAC lemma`(!v. v IN V==> pi <= interior_angle1 (vec 0) FF v )`; +MATCH_MP_TAC(REAL_ARITH`&0< pi /\ &0<= A==> &0<= &2 * pi+A`) +THEN REWRITE_TAC[PI_WORKS] +THEN MATCH_MP_TAC SUM_POS_LE +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= A-B<=> B<= A`] +THEN ASM_TAC +THEN REWRITE_TAC[convex_local_fan;local_fan;FAN;fan1] +THEN LET_TAC +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_IMP;NOT_FORALL_THM;REAL_ARITH`~(a<=b) <=> bbool,E,FF)` +THEN STRIP_TAC +THEN POP_ASSUM(fun th -> MP_TAC th THEN REWRITE_TAC[convex_local_fan] THEN ASSUME_TAC th THEN STRIP_TAC) +THEN MRESA_TAC PROPERTIES_GENERIC_LOCAL_FAN[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v:real^3`;] +THEN ABBREV_TAC`vv=(\i. ITER i (rho_node1 FF) v)` +THEN ABBREV_TAC`bta=(\i. azim (vec 0) v (vv 1) (vv i))` +THEN ABBREV_TAC`k=CARD (V:real^3->bool)` +THEN MRESA1_TAC lemma1`(!i. i bta i= &0 \/ bta i= bta (k-1)):bool`; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;DE_MORGAN_THM] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE` k-1<= i \/ (i< k-1)`); +MP_TAC(ARITH_RULE`k-1<= i /\ i< k /\ 3<= k==> i= k-1`) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN SET_TAC[]; +MP_TAC(ARITH_RULE` 3<= k==> k-1bool)->bool`;`V:real^3->bool`;`bta:num->real`; +`FF:real^3#real^3->bool`; `i:num`;`v:real^3`;`vv:num->real^3`;`CARD (V:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC "bta" +THEN REWRITE_TAC[] +THEN EXPAND_TAC "vv" +THEN REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`;`k-1:num`]) +THEN MP_TAC(REAL_ARITH`~(bta i = &0) /\ ~(bta i = bta (k - 1)) +/\ &0<= bta i /\ bta i<= bta(k-1)==> &0< bta i /\ bta i< bta(k-1)`) +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC "bta" +THEN REWRITE_TAC[] +THEN EXPAND_TAC "vv" +THEN REWRITE_TAC[] +THEN ASM_REWRITE_TAC[azim;ITER1] +THEN ABBREV_TAC`w=(ITER i (rho_node1 FF) v)` +THEN ASSUME_TAC2 Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1 +THEN POP_ASSUM (fun th-> MRESA1_TAC th`v:real^3`) +THEN STRIP_TAC +THEN ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V +THEN POP_ASSUM (fun th-> MRESA1_TAC th `i:num`) +THEN REMOVE_THEN "LINH2"(fun th-> MRESA_TAC th [`v:real^3`;`w:real^3`] ) +THEN SUBGOAL_THEN`0< i` ASSUME_TAC; +ONCE_REWRITE_TAC[ARITH_RULE`0 ~(i=0)`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN UNDISCH_TAC`~(bta 0 = &0)` +THEN EXPAND_TAC"bta" +THEN EXPAND_TAC"vv" +THEN REWRITE_TAC[ITER;Local_lemmas.AZIM_SPEC_DEGENERATE]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_DIS_ELMS23 +THEN POP_ASSUM(fun th->MRESAL_TAC th[`0:num`;`i:num`][ITER]) +THEN SUBGOAL_THEN`azim_in_fan (v,rho_node1 FF v) E < pi`ASSUME_TAC; +ASSUME_TAC2 CONVEX_LOFA_IMP_INANGLE_EQ_AZIM +THEN POP_ASSUM (fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); +SUBGOAL_THEN`aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt (v,rho_node1 FF v) E` +ASSUME_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2 +THEN ASSUME_TAC2 EXISTS_INVERSE_OF_V +THEN DOWN THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL LOFA_IMP_EE_TWO_ELMS)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`vv':real^3`] +THEN ASSUME_TAC2 LOFA_CARD_EE_V_1 +THEN UNDISCH_TAC ` azim_in_fan (v:real^3, rho_node1 FF v) E < pi` +THEN ASM_REWRITE_TAC[azim_in_fan;wedge_in_fan_gt;ARITH_RULE`2>1`;Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;] +THEN LET_TAC +THEN STRIP_TAC +THEN UNDISCH_TAC `!v'. v' IN V /\ ~(v' = v) ==> ~collinear {vec 0, v, v':real^3}` +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`) +THEN MRESA_TAC Planarity.aff_gt_inter_aff_gt[`vec 0:real^3`;`v:real^3`;`w:real^3`] +THEN MATCH_MP_TAC(SET_RULE`A SUBSET B==> A INTER C SUBSET B`) +THEN REWRITE_TAC[SUBSET] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC Planarity.aff_gt_imp_not_collinear[`vec 0:real^3`;`w:real^3`;`v:real^3`;`x:real^3`] +THEN MRESA_TAC AZIM_EQ[`vec 0:real^3`;`v:real^3`;`(rho_node1 FF v)`;`w:real^3`;`x:real^3`] +THEN REWRITE_TAC[wedge;IN_ELIM_THM] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN ASSUME_TAC2 Local_lemmas.LOCAL_FAN_RHO_NODE_PROS +THEN POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`vv':real^3`) +THEN MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`d:real^3`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); +MRESA_TAC (GEN_ALL PROPERTIES_AFF_GT_SUBSET_WEDGE) +[`V:real^3->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`w:real^3`;`E:(real^3->bool)->bool`;]; +POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`interior_angle1 (vec 0) FF v= bta (k-1)` ASSUME_TAC; +ASSUME_TAC2 Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1 +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`) +THEN EXPAND_TAC"bta" +THEN EXPAND_TAC"vv" +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[ITER1] +THEN ASSUME_TAC2 CONVEX_LOFA_IMP_INANGLE_EQ_AZIM_IVS +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`); +ASSUME_TAC2 Local_lemmas.INTERIOR_ANGLE1_POS +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`?i. i< k-1/\ bta i= &0 /\ bta (i+1)= bta (k-1)` ASSUME_TAC; +ONCE_REWRITE_TAC[SET_RULE`A= ~(~A)`] +THEN STRIP_TAC +THEN UNDISCH_TAC`CARD (V:real^3->bool) = k` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_EXISTS_THM;DE_MORGAN_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN`!i:num. i< k ==> bta i = &0` ASSUME_TAC; +INDUCT_TAC; +STRIP_TAC +THEN EXPAND_TAC "bta" +THEN EXPAND_TAC "vv" +THEN REWRITE_TAC[ITER;Local_lemmas.AZIM_SPEC_DEGENERATE]; +REWRITE_TAC[ARITH_RULE`SUC i= i+1`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN DISCH_THEN(LABEL_TAC"LINH2") +THEN DISCH_THEN(LABEL_TAC"LINH3") +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`i+1< k /\ 3<= k ==> i< k /\ (i< k-1)`) +THEN RESA_TAC +THEN REMOVE_THEN "LINH3" MP_TAC +THEN RESA_TAC +THEN REMOVE_THEN "LINH2"(fun th-> MRESA1_TAC th `i:num`) +THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th `i+1:num`); +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH1") +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= k==> k-1< k/\ 0< k`) +THEN RESA_TAC +THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th`k-1:num`) +THEN MP_TAC(REAL_ARITH`&0< bta(k-1)==> ~(bta(k-1)= &0)`) +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`i< k-1 ==> i< k`) +THEN RESA_TAC +THEN SUBGOAL_THEN`!j. 0 < j /\ j < k /\ ~(j=i) /\ ~(j=i+1) +==> interior_angle1 (vec 0) FF (ITER j (rho_node1 FF) v) = pi` ASSUME_TAC; +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ARITH_RULE`~(j=i+1)<=> (j< i+1\/ i+1< j)`] +THEN MP_TAC(ARITH_RULE`~(j=i:num)<=> (j< i\/ i< j)`) +THEN ASM_REWRITE_TAC[ARITH_RULE`((j < i \/ i < j) +/\(j < i + 1 \/ i + 1 < j)) <=> (j < i \/ i + 1 < j:num)`; SET_RULE`A==>B==>C <=> A/\B ==>C`] +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC; +MRESA_TAC (GEN_ALL EGHNAVX)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`bta:num->real`; +`FF:real^3#real^3->bool`; `i:num`;`v:real^3`;`vv:num->real^3`;`CARD (V:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC "bta" +THEN REWRITE_TAC[] +THEN EXPAND_TAC "vv" +THEN REWRITE_TAC[] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num`); +MP_TAC(ARITH_RULE` i i+1=k-1\/ (i+1< k-1 /\ 0< i+1)`) +THEN RESA_TAC; +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN UNDISCH_TAC`3<= (k:num)` +THEN ARITH_TAC; +MRESA_TAC (GEN_ALL EGHNAVX)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`bta:num->real`; +`FF:real^3#real^3->bool`; `i+1:num`;`v:real^3`;`vv:num->real^3`;`CARD (V:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC "bta" +THEN REWRITE_TAC[] +THEN EXPAND_TAC "vv" +THEN REWRITE_TAC[] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num`); +ASSUME_TAC2 Local_lemmas.LOFA_IMP_LT_CARD_SET_V +THEN ABBREV_TAC`u=(ITER i (rho_node1 FF) v)` +THEN ABBREV_TAC`w=(ITER (i+1) (rho_node1 FF) v)` +THEN ABBREV_TAC`s={v,u,w:real^3}` +THEN SUBGOAL_THEN`s SUBSET V:real^3->bool` ASSUME_TAC; +EXPAND_TAC"s" +THEN EXPAND_TAC"V" +THEN REWRITE_TAC[SET_RULE`{A,B,C} SUBSET V<=> A IN V /\ B IN V /\ C IN V`;IN_ELIM_THM] +THEN STRIP_TAC; +EXISTS_TAC`0:num` +THEN REWRITE_TAC[ITER;] +THEN ASM_REWRITE_TAC[] +THEN UNDISCH_TAC`3<=k` +THEN ARITH_TAC; +STRIP_TAC; +EXISTS_TAC `i:num` +THEN ASM_REWRITE_TAC[]; +EXISTS_TAC `i+1:num` +THEN ASM_REWRITE_TAC[] +THEN UNDISCH_TAC`i < k - 1:num` +THEN ARITH_TAC; +SUBGOAL_THEN`(!x. x IN V /\ ~(x IN s) ==> (\v. interior_angle1 (vec 0) FF v - pi) x = &0)` ASSUME_TAC; +EXPAND_TAC"V" +THEN REWRITE_TAC[IN_ELIM_THM] +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`n' = 0 \/ 0< (n':num)`); +ASM_REWRITE_TAC[ITER] +THEN RESA_TAC +THEN EXPAND_TAC"s" +THEN SET_TAC[]; +DISJ_CASES_TAC(ARITH_RULE`n' = i \/ ~(n':num=i)`); +ASM_REWRITE_TAC[ITER] +THEN RESA_TAC +THEN EXPAND_TAC"s" +THEN SET_TAC[]; +DISJ_CASES_TAC(ARITH_RULE`n' = i+1 \/ ~(n':num=i+1)`); +ASM_REWRITE_TAC[ITER] +THEN RESA_TAC +THEN EXPAND_TAC"s" +THEN SET_TAC[]; +REPEAT STRIP_TAC +THEN UNDISCH_TAC`!j. 0 < j /\ j < k /\ ~(j = i) /\ ~(j = i + 1) +==> interior_angle1 (vec 0) FF (ITER j (rho_node1 FF) v) = pi` +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`n':num`) +THEN REAL_ARITH_TAC; +MRESA_TAC SUM_SUPERSET[`(\v:real^3. interior_angle1 (vec 0) FF v - pi)`;`s:real^3->bool`;`V:real^3->bool`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th; ]) +THEN REWRITE_TAC[SET_RULE`{A,B,C} SUBSET V <=> A IN V /\ B IN V /\ C IN V`] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`i = 0 \/ 0< (i:num)`); +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th; ARITH_RULE`0+1=1`] +THEN REPEAT STRIP_TAC) +THEN UNDISCH_TAC`bta 1 = bta (k - 1):real` +THEN UNDISCH_TAC `&0 < bta (k - 1):real` +THEN MRESA_TAC( GEN_ALL Local_lemmas.FIRST_EQ0_LAST_LT_PI) +[`E:(real^3->bool)->bool`;`V:real^3->bool`; +`FF:real^3#real^3->bool`;`v:real^3`;`vv:num->real^3`; `bta:num->real`;`CARD (V:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC "bta" +THEN REWRITE_TAC[] +THEN EXPAND_TAC "vv" +THEN REWRITE_TAC[] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; +MP_TAC(ARITH_RULE`i< k-1==> i+1< k`) +THEN RESA_TAC +THEN ASSUME_TAC2 Local_lemmas.LOFA_IMP_DIS_ELMS23 +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`0`;`i:num`][ITER] THEN MRESAL_TAC th[`0`;`i+1:num`][ITER;ARITH_RULE`0< i+1`] THEN MRESAL_TAC th[`i:num`;`i+1:num`][ARITH_RULE`ibool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`v:real^3`;][SET_RULE`A IN {A,B,C}`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.INTERIOR_ANGLE1_POS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;` u:real^3`;][SET_RULE`B IN {A,B,C}`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.INTERIOR_ANGLE1_POS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;` w:real^3`;][SET_RULE`C IN {A,B,C}`] +THEN DISJ_CASES_TAC(SET_RULE`(?v1. v1 IN {v,u,w} /\ pi <= interior_angle1 (vec 0) FF v1)\/ ~(?v1. v1 IN {v,u,w} /\ pi <= interior_angle1 (vec 0) FF v1)`); +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[SET_RULE`A IN {B,C,D}<=> A=B \/ A=C\/ A=D`] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[NOT_EXISTS_THM;DE_MORGAN_THM; REAL_ARITH`~(a<= b) <=> b MRESAL1_TAC th`v:real^3`[SET_RULE`A IN {A,B,C}`] +THEN MRESAL1_TAC th`u:real^3`[SET_RULE`B IN {A,B,C}`] +THEN MRESAL1_TAC th`w:real^3`[SET_RULE`C IN {A,B,C}`]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`u:real^3`[SET_RULE`B IN {A,B,C}`] +THEN MRESAL1_TAC th`w:real^3`[SET_RULE`C IN {A,B,C}`]) +THEN UNDISCH_TAC`interior_angle1 (vec 0) FF v < pi` +THEN RESA_TAC +THEN SUBGOAL_THEN`u IN aff_gt {vec 0, v} {rho_node1 FF v}` ASSUME_TAC; +MRESA_TAC (GEN_ALL EGHNAVX)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`bta:num->real`; +`FF:real^3#real^3->bool`; `i:num`;`v:real^3`;`vv:num->real^3`;`CARD (V:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC "bta" +THEN REWRITE_TAC[] +THEN EXPAND_TAC "vv" +THEN REWRITE_TAC[] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN SUBGOAL_THEN`u IN {ITER k (rho_node1 FF) v | 0 < k /\ k <= i}` ASSUME_TAC; +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; +MP_TAC(SET_RULE`{ITER k (rho_node1 FF) v | 0 < k /\ k <= i} SUBSET +aff_gt {vec 0, v} {ITER 1 (rho_node1 FF) v} /\ u IN {ITER k (rho_node1 FF) v | 0 < k /\ k <= i} ==> u IN aff_gt {vec 0, v} {ITER 1 (rho_node1 FF) v}`) +THEN ASM_REWRITE_TAC[ITER1]; +SUBGOAL_THEN`w IN aff_gt {vec 0, v} {ivs_rho_node1 FF v}` ASSUME_TAC; +ASSUME_TAC2 Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1 +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC(ARITH_RULE` i i+1=k-1\/ (i+1< k-1 /\ 0< i+1)`) +THEN RESA_TAC; +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC Local_lemmas.DISJOINT_IMP_Z_IN_AFF_GT +THEN ASM_REWRITE_TAC[SET_RULE`DISJOINT {A,B}{C}<=> ~(A=C) /\ ~(B=C)`] +THEN UNDISCH_TAC`!v':real^3. v' IN V /\ ~(v' = v) ==> ~collinear {vec 0, v, v'}` +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`w:real^3`) +THEN MRESA_TAC th3[`vec 0:real^3`;`v:real^3`;`w:real^3`]; +MRESA_TAC (GEN_ALL EGHNAVX)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`bta:num->real`; +`FF:real^3#real^3->bool`; `i+1:num`;`v:real^3`;`vv:num->real^3`;`CARD (V:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC "bta" +THEN REWRITE_TAC[] +THEN EXPAND_TAC "vv" +THEN REWRITE_TAC[] +THEN STRIP_TAC +THEN SUBGOAL_THEN`w IN {ITER n (rho_node1 FF) v | i + 1 <= n /\ n < k}` ASSUME_TAC; +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`i+1:num` +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; +UNDISCH_TAC`!v':real^3. v' IN V /\ ~(v' = v) ==> ~collinear {vec 0, v, v'}` +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`w:real^3` THEN MRESA1_TAC th`u:real^3` THEN ASSUME_TAC th) +THEN ASSUME_TAC2 Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2 +THEN ASSUME_TAC Local_lemmas.LOFA_IMP_NOT_COLL_IVS +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`) +THEN MRESA_TAC AZIM_EQ[`vec 0:real^3`;`v:real^3`;`rho_node1 FF v`;`ivs_rho_node1 FF v`;`w:real^3`] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC AZIM_EQ[`vec 0:real^3`;`v:real^3`;`w:real^3`;`rho_node1 FF v`;`u:real^3`;] +THEN MP_TAC(REAL_ARITH`&0 < azim (vec 0) v (rho_node1 FF v) w ==> ~(azim (vec 0) v (rho_node1 FF v) w= &0)`) +THEN RESA_TAC +THEN MRESA_TAC AZIM_COMPL[`vec 0:real^3`;`v:real^3`;`rho_node1 FF v`;`w:real^3`] +THEN MP_TAC(REAL_ARITH` azim (vec 0) v (rho_node1 FF v) w < &2 * pi==> ~(&2 * pi - azim (vec 0) v (rho_node1 FF v) w = &0)`) +THEN ASM_REWRITE_TAC[azim] +THEN STRIP_TAC +THEN MRESAL_TAC AZIM_COMPL[`vec 0:real^3`;`v:real^3`;`w:real^3`;`u:real^3`][REAL_ARITH`a-(a- B)=B`] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN SUBGOAL_THEN`rho_node1 FF u= w` ASSUME_TAC; +EXPAND_TAC"w" +THEN REWRITE_TAC[ARITH_RULE`i+1= SUC i`;ITER] +THEN ASM_REWRITE_TAC[]; +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN SUBGOAL_THEN`ivs_rho_node1 FF w=u` ASSUME_TAC; +EXPAND_TAC"w" +THEN REWRITE_TAC[ARITH_RULE`i+1= SUC i`;ITER] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC( GEN_ALL Local_lemmas.IVS_RHO_IDD)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;` u:real^3`;]; +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN SUBGOAL_THEN`!j. j< i==> aff_ge {vec 0:real^3} {v, vv (j+1)}= UNIONS {aff_ge {vec 0} {vv j1, vv (j1+1)}| j1 <= j}`ASSUME_TAC; +INDUCT_TAC; +STRIP_TAC +THEN EXPAND_TAC"vv" +THEN REWRITE_TAC[ARITH_RULE`j1<= 0<=> j1= 0`;ARITH_RULE`0+1=1`;ITER1;ITER; +SET_RULE`UNIONS +{aff_ge {vec 0} {ITER j1 (rho_node1 FF) v, ITER (j1 + 1) (rho_node1 FF) v} | +j1 = +0}= aff_ge {vec 0} {ITER 0 (rho_node1 FF) v, ITER (0 + 1) (rho_node1 FF) v}`]; +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`SUC j SUC j+1< k/\ j< i /\ j+1 j1<= j \/ j1= SUC j` +;SET_RULE`UNIONS {aff_ge {vec 0} {vv j1, vv (j1 + 1)} | j1 <= j \/ j1 = SUC j} += UNIONS {aff_ge {vec 0} {vv j1, vv (j1 + 1)} | j1 <= j } UNION aff_ge {vec 0} {vv (SUC j), vv (SUC j + 1)}`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`SUC i= i+1`] THEN ASSUME_TAC (SYM th)) +THEN MATCH_MP_TAC AFF_GE_EQ_AFF_GE_UNION +THEN ASSUME_TAC2 Local_lemmas.LOFA_IMP_CARD_FF_V_EQ +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_DIS_ELMS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`SUC j+1:num`;`FF:real^3#real^3->bool`;` v:real^3`;] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`0:num`[ARITH_RULE`0< SUC j+1`;ITER]) +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_DIS_ELMS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`j+1:num`;`FF:real^3#real^3->bool`;` v:real^3`;] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`0:num`[ARITH_RULE`0< j+1`;ITER]) +THEN ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V +THEN EXPAND_TAC"vv" +THEN UNDISCH_TAC`!v'. v' IN V /\ ~(v' = v) ==> ~collinear {vec 0, v, v':real^3}` +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`ITER (SUC j + 1) (rho_node1 FF) v` THEN ASSUME_TAC th) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`ITER (j + 1) (rho_node1 FF) v` THEN ASSUME_TAC th) +THEN MRESA_TAC th3[`vec 0:real^3`;`v:real^3`;`ITER (j + 1) (rho_node1 FF) v`] +THEN MRESAL_TAC th3[`vec 0:real^3`;`v:real^3`;`ITER (SUC j + 1) (rho_node1 FF) v`][ARITH_RULE`SUC i=i+1`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2) [`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;` ITER (j + 1) (rho_node1 FF) v:real^3`;] +THEN MRESA_TAC th3[`vec 0:real^3`;`ITER (j + 1) (rho_node1 FF) v:real^3`;`rho_node1 FF +(ITER (j + 1) (rho_node1 FF) v)`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`j+1= SUC j`;ITER] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL EGHNAVX)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`bta:num->real`; +`FF:real^3#real^3->bool`; `i:num`;`v:real^3`;`vv:num->real^3`;`CARD (V:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC "bta" +THEN REWRITE_TAC[] +THEN EXPAND_TAC "vv" +THEN REWRITE_TAC[] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN ABBREV_TAC`g=rho_node1 FF (ITER j (rho_node1 FF) v)` +THEN SUBGOAL_THEN`g IN {ITER k (rho_node1 FF) v | 0 < k /\ k <= i}` ASSUME_TAC; +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`SUC j` +THEN ASM_REWRITE_TAC[ARITH_RULE`0< SUC j`;ITER]; +MP_TAC(SET_RULE` g IN {ITER k (rho_node1 FF) v | 0 < k /\ k <= i} +/\ {ITER k (rho_node1 FF) v | 0 < k /\ k <= i} SUBSET +aff_gt {vec 0, v} {ITER 1 (rho_node1 FF) v} +==> g IN +aff_gt {vec 0, v} {ITER 1 (rho_node1 FF) v}`) +THEN RESA_TAC +THEN UNDISCH_TAC `~collinear {vec 0, v, ITER (j + 1) (rho_node1 FF) v}` +THEN REWRITE_TAC[ARITH_RULE`j+1= SUC j`;ITER] +THEN RESA_TAC +THEN MRESAL_TAC AZIM_EQ[`vec 0:real^3`;`v:real^3`;`ivs_rho_node1 FF v`;`ITER 1 (rho_node1 FF) v`;`g:real^3`][ITER1] +THEN SUBGOAL_THEN`rho_node1 FF g IN {ITER k (rho_node1 FF) v | 0 < k /\ k <= i}` ASSUME_TAC; +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`SUC (SUC j)` +THEN ASM_REWRITE_TAC[ARITH_RULE`0< SUC j`;ITER]; +MP_TAC(SET_RULE` rho_node1 FF g IN {ITER k (rho_node1 FF) v | 0 < k /\ k <= i} +/\ {ITER k (rho_node1 FF) v | 0 < k /\ k <= i} SUBSET +aff_gt {vec 0, v} {ITER 1 (rho_node1 FF) v} +==> rho_node1 FF g IN +aff_gt {vec 0, v} {ITER 1 (rho_node1 FF) v}`) +THEN RESA_TAC +THEN UNDISCH_TAC `~collinear {vec 0, v, ITER (SUC j + 1) (rho_node1 FF) v}` +THEN REWRITE_TAC[ARITH_RULE`j+1= SUC j`;ITER] +THEN RESA_TAC +THEN MRESAL_TAC AZIM_EQ[`vec 0:real^3`;`v:real^3`;`ivs_rho_node1 FF v`;`ITER 1 (rho_node1 FF) v`;`rho_node1 FF g:real^3`][ITER1] +THEN MRESAL_TAC AZIM_EQ[`vec 0:real^3`;`v:real^3`;`ivs_rho_node1 FF v`;`g:real^3`;`rho_node1 FF g:real^3`][ITER1] +THEN MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{vec 0, v:real^3}`;`{g:real^3}`] +THEN MP_TAC(SET_RULE`rho_node1 FF g IN aff_gt {vec 0, v} { g} +/\ aff_gt {vec 0, v} {g} SUBSET +aff_ge {vec 0, v} {g} +==> rho_node1 FF g IN +aff_ge {vec 0, v} {g}`) +THEN RESA_TAC +THEN MRESA_TAC Planarity.decomposition_planar_by_angle_fan[`vec 0:real^3`;`v:real^3`;`g:real^3`;` rho_node1 FF g:real^3`] +THEN POP_ASSUM MP_TAC +THEN UNDISCH_TAC`UNIONS {aff_ge {vec 0} {vv j1, vv (j1 + 1)} | j1 <= j} = +aff_ge {vec 0:real^3} {v, vv (j + 1)}` +THEN EXPAND_TAC "vv" +THEN REWRITE_TAC[ARITH_RULE`j+1= SUC j`;ITER] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;UNIONS;IN_ELIM_THM]) +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN UNDISCH_TAC`local_fan (V:real^3->bool,E,FF)` +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th +THEN REWRITE_TAC[local_fan;] +THEN LET_TAC +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN ASSUME_TAC th) +THEN UNDISCH_TAC`!i. ITER i (rho_node1 FF) v IN V` +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`SUC(SUC j)`[ITER] THEN MRESA1_TAC th`j1:num` ) +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_EE_TWO_ELMS +)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`rho_node1 FF (ITER j1 (rho_node1 FF) v)`;`ITER j1 (rho_node1 FF) v`] +THEN MP_TAC(SET_RULE`EE (rho_node1 FF (ITER j1 (rho_node1 FF) v)) E = +{rho_node1 FF (rho_node1 FF (ITER j1 (rho_node1 FF) v)), ITER j1 +(rho_node1 FF) +v} +==> ITER j1 +(rho_node1 FF) +v IN EE (rho_node1 FF (ITER j1 (rho_node1 FF) v)) E `) +THEN REWRITE_TAC[EE;IN_ELIM_THM] +THEN REWRITE_TAC[GSYM EE] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`j1<= j==> j1< SUC(SUC j) /\ SUC j1< SUC(SUC j)`) +THEN RESA_TAC +THEN ASSUME_TAC2 Local_lemmas.LOFA_IMP_DIS_ELMS23 +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`j1:num`;`SUC(SUC j)`;][ITER] +THEN MRESAL_TAC th[`SUC j1:num`;`SUC(SUC j)`;][ITER]) +THEN MRESA_TAC (GEN_ALL Local_lemmas.FAN_IN_AFF_GE_IMP_EQ)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`vec 0:real^3`;`ITER j1 (rho_node1 FF) v`;`rho_node1 FF g`;`rho_node1 FF (ITER j1 (rho_node1 FF) v)`]; +POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`0< i==> i-1< i/\ i-1+1=i`) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i-1`) +THEN SUBGOAL_THEN`ivs_rho_node1 FF u IN aff_ge {vec 0} {v,u}` ASSUME_TAC; +POP_ASSUM MP_TAC +THEN EXPAND_TAC"vv" +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN REWRITE_TAC[IN_ELIM_THM;UNIONS] +THEN EXISTS_TAC`aff_ge {vec 0} +{ITER (i-1) (rho_node1 FF) v, ITER (i-1 + 1) (rho_node1 FF) v}` +THEN STRIP_TAC; +EXISTS_TAC`i-1:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`A-1<=A-1`]; +ASM_REWRITE_TAC[] +THEN MRESA_TAC( GEN_ALL Local_lemmas.LOFA_IMP_NOT_COLL_IVS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASSUME_TAC2 Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1 +THEN POP_ASSUM(fun th-> MRESA1_TAC th`u:real^3`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN EXPAND_TAC"u" +THEN REWRITE_TAC[ITER_ADD; ] +THEN MP_TAC(ARITH_RULE`0k -1 + i = k + (i-1)`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[GSYM ITER_ADD; ] +THEN ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V +THEN POP_ASSUM(fun th-> MRESA1_TAC th`i-1:num`) +THEN ASSUME_TAC2 Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID +THEN POP_ASSUM(fun th-> MRESA1_TAC th`ITER (i - 1) (rho_node1 FF) v`) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC Planarity.point_in_aff_ge[`vec 0:real^3`;`ITER (i - 1) (rho_node1 FF) v`;`u:real^3`]; +ASSUME_TAC2 Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1 +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`) +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`u:real^3`;`V:real^3->bool`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`k-1:num`) +THEN SUBGOAL_THEN`azim (vec 0) u w (ivs_rho_node1 FF u)= azim (vec 0) u w v` ASSUME_TAC; +DISJ_CASES_TAC(SET_RULE`v= ivs_rho_node1 FF u \/ ~(ivs_rho_node1 FF u= v)`); +ASM_REWRITE_TAC[]; +UNDISCH_TAC`!v':real^3. v' IN V /\ ~(v' = v) ==> ~collinear {vec 0, v, v'}` +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`ivs_rho_node1 FF u`) +THEN MRESA_TAC Topology.aff_ge_inter_aff_ge[`vec 0:real^3`;`v:real^3`;`u:real^3`] +THEN MP_TAC(SET_RULE`ivs_rho_node1 FF u IN aff_ge {vec 0} {v, u} +/\ aff_ge {vec 0} {v, u} = +aff_ge {vec 0, v} {u} INTER aff_ge {vec 0, u} {v} +==> ivs_rho_node1 FF u IN aff_ge {vec 0,u} { v}`) +THEN RESA_TAC +THEN MRESA_TAC( GEN_ALL Local_lemmas.LOFA_IMP_NOT_COLL_IVS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`u:real^3`] +THEN MRESA_TAC AZIM_EQ_0_GE[`vec 0:real^3`;`u:real^3`;`ivs_rho_node1 FF u`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESAL_TAC Fan.sum5_azim_fan[`vec 0:real^3`;`u:real^3`;`w:real^3`;`(ivs_rho_node1 FF u)`;`v:real^3`][azim] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2) [`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;` u:real^3`;] +THEN POP_ASSUM MP_TAC +THEN UNDISCH_TAC`ITER (i + 1) (rho_node1 FF) v = w` +THEN REWRITE_TAC[ARITH_RULE`i+1=SUC i`;ITER] +THEN RESA_TAC +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN SUBGOAL_THEN`!j. j< k-i-1==> aff_ge {vec 0:real^3} {v, vv (k-j-1)}= UNIONS {aff_ge {vec 0} {vv (k-j1-1), vv (k-j1)}| j1 <= j}`ASSUME_TAC; +INDUCT_TAC; +STRIP_TAC +THEN EXPAND_TAC"vv" +THEN ASSUME_TAC2 Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID +THEN REWRITE_TAC[ARITH_RULE`j1<= 0<=> j1= 0`;ARITH_RULE`k-0=k`;ITER1;ITER; +SET_RULE`UNIONS +{aff_ge {vec 0} +{ITER (k - j1 - 1) (rho_node1 FF) v, ITER (k - j1) (rho_node1 FF) v} | +j1 = +0}= aff_ge {vec 0} +{ITER (k - 0 - 1) (rho_node1 FF) v, ITER (k - 0) (rho_node1 FF) v}`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"LINH") +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`SUC j i+1< k-SUC j/\ j< k-i-1/\ k-j-1-1 j1<= j \/ j1= SUC j` +;SET_RULE`UNIONS +{aff_ge {vec 0} {vv (k - j1 - 1), vv (k - j1)} | j1 <= j \/ j1 = SUC j } += UNIONS +{aff_ge {vec 0} {vv (k - j1 - 1), vv (k - j1)} | j1 <= j} UNION aff_ge {vec 0} {vv (k-SUC j-1), vv (k-SUC j)}`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`SUC i= i+1`] THEN ASSUME_TAC (SYM th)) +THEN GEN_REWRITE_TAC(RAND_CONV o RAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN REWRITE_TAC[ARITH_RULE`k-(j+1)=k-j-1`] +THEN MATCH_MP_TAC AFF_GE_EQ_AFF_GE_UNION +THEN ASSUME_TAC2 Local_lemmas.LOFA_IMP_CARD_FF_V_EQ +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_DIS_ELMS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`k-j-1-1:num`;`FF:real^3#real^3->bool`;` v:real^3`;] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`0:num`[ITER]) +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_DIS_ELMS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`k-j-1:num`;`FF:real^3#real^3->bool`;` v:real^3`;] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`0:num`[ARITH_RULE`0< j+1`;ITER]) +THEN ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V +THEN EXPAND_TAC"vv" +THEN UNDISCH_TAC`!v'. v' IN V /\ ~(v' = v) ==> ~collinear {vec 0, v, v':real^3}` +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`ITER (k-j - 1-1) (rho_node1 FF) v` THEN ASSUME_TAC th) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`ITER (k-j-1) (rho_node1 FF) v` THEN ASSUME_TAC th) +THEN MRESA_TAC th3[`vec 0:real^3`;`v:real^3`;`ITER (k-j-1 - 1) (rho_node1 FF) v`] +THEN MRESAL_TAC th3[`vec 0:real^3`;`v:real^3`;`ITER (k-j-1) (rho_node1 FF) v`][ARITH_RULE`SUC i=i+1`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2) [`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;` ITER (k-j-1- 1) (rho_node1 FF) v:real^3`;] +THEN MRESA_TAC th3[`vec 0:real^3`;`ITER (k-j -1- 1) (rho_node1 FF) v:real^3`;`rho_node1 FF +(ITER (k-j - 1-1) (rho_node1 FF) v)`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`0< k - j - 1 - 1 ==> SUC (k - j - 1 - 1)= k-j-1`) +THEN RESA_TAC +THEN REWRITE_TAC[GSYM ITER] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE` i i+1=k-1\/ (i+1< k-1 /\ 0< i+1)`) +THEN RESA_TAC; +UNDISCH_TAC`SUC j < k - i -1` +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +ASSUME_TAC2 Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1 +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`) +THEN MRESA_TAC (GEN_ALL EGHNAVX)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`bta:num->real`; +`FF:real^3#real^3->bool`; `i+1:num`;`v:real^3`;`vv:num->real^3`;`CARD (V:real^3->bool)`] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC "bta" +THEN REWRITE_TAC[] +THEN EXPAND_TAC "vv" +THEN REWRITE_TAC[] +THEN STRIP_TAC +THEN ABBREV_TAC`g=ITER (k-j-1-1) (rho_node1 FF) v` +THEN SUBGOAL_THEN`ITER (k - j - 1) (rho_node1 FF) v= rho_node1 FF g` ASSUME_TAC; +EXPAND_TAC"g" +THEN REWRITE_TAC[GSYM ITER] +THEN ASM_REWRITE_TAC[]; +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC THEN ASSUME_TAC th) +THEN SUBGOAL_THEN`g IN {ITER n (rho_node1 FF) v | i+1 <= n /\ n < k}` ASSUME_TAC; +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`k-j-1-1` +THEN ASM_REWRITE_TAC[ARITH_RULE`0< SUC j`;ITER] +THEN MP_TAC(ARITH_RULE`SUC j < k - i - 1 /\ 0 i+1<= k-j-1-1`) +THEN RESA_TAC; +MP_TAC(SET_RULE` g IN {ITER n (rho_node1 FF) v | i+1<=n /\ n < k} +/\ {ITER n (rho_node1 FF) v | i+1<=n /\ n < k} SUBSET +aff_gt {vec 0, v} {ITER (k-1) (rho_node1 FF) v} +==> g IN +aff_gt {vec 0, v} {ITER (k-1) (rho_node1 FF) v}`) +THEN RESA_TAC +THEN MRESAL_TAC AZIM_EQ[`vec 0:real^3`;`v:real^3`;`rho_node1 FF v`;`ITER (k-1) (rho_node1 FF) v`;`g:real^3`][ITER1] +THEN SUBGOAL_THEN`rho_node1 FF g IN {ITER n (rho_node1 FF) v | i+1 <= n /\ n < k}` ASSUME_TAC; +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`k-j-1` +THEN ASM_REWRITE_TAC[ARITH_RULE`0< SUC j`;ITER] +THEN MP_TAC(ARITH_RULE`SUC j < k - i - 1 /\ 0 i+1<= k-j-1`) +THEN RESA_TAC; +MP_TAC(SET_RULE` rho_node1 FF g IN {ITER n (rho_node1 FF) v | i+1 <= n /\ n < k} +/\ {ITER n (rho_node1 FF) v | i+1 <= n /\ n < k} SUBSET +aff_gt {vec 0, v} {ITER (k-1) (rho_node1 FF) v} +==> rho_node1 FF g IN +aff_gt {vec 0, v} {ITER(k-1) (rho_node1 FF) v}`) +THEN RESA_TAC +THEN MRESAL_TAC AZIM_EQ[`vec 0:real^3`;`v:real^3`;`rho_node1 FF v`;`ITER (k-1) (rho_node1 FF) v`;`rho_node1 FF g:real^3`][ITER1] +THEN MRESAL_TAC AZIM_EQ[`vec 0:real^3`;`v:real^3`;`rho_node1 FF v`;`rho_node1 FF g:real^3`;`g:real^3`][ITER1] +THEN MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{vec 0, v:real^3}`;`{rho_node1 FF g:real^3}`] +THEN MP_TAC(SET_RULE`g IN aff_gt {vec 0, v} {rho_node1 FF g} +/\ aff_gt {vec 0, v} {rho_node1 FF g} SUBSET +aff_ge {vec 0, v} {rho_node1 FF g} +==> g IN +aff_ge {vec 0, v} {rho_node1 FF g}`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC Planarity.decomposition_planar_by_angle_fan[`vec 0:real^3`;`v:real^3`;` rho_node1 FF g:real^3`;` g:real^3`] +THEN POP_ASSUM MP_TAC +THEN UNDISCH_TAC`UNIONS {aff_ge {vec 0} {vv (k - j1 - 1), vv (k - j1)} | j1 <= j} = +aff_ge {vec 0:real^3} {v, vv (k - j - 1)}` +THEN EXPAND_TAC "vv" +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;UNIONS;IN_ELIM_THM]) +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN UNDISCH_TAC`local_fan (V:real^3->bool,E,FF)` +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th +THEN REWRITE_TAC[local_fan;] +THEN LET_TAC +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN ASSUME_TAC th) +THEN UNDISCH_TAC`!i. ITER i (rho_node1 FF) v IN V` +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`k-j-1-1`[ITER] THEN MRESA1_TAC th`k-j1-1:num` ) +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_EE_TWO_ELMS +)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`rho_node1 FF (ITER (k-j1-1) (rho_node1 FF) v)`;`ITER (k-j1-1) (rho_node1 FF) v`] +THEN MP_TAC(SET_RULE`EE (rho_node1 FF (ITER (k-j1-1) (rho_node1 FF) v)) E = +{rho_node1 FF (rho_node1 FF (ITER (k-j1-1) (rho_node1 FF) v)), ITER (k-j1-1) +(rho_node1 FF) +v} +==> ITER (k-j1-1) +(rho_node1 FF) +v IN EE (rho_node1 FF (ITER (k-j1-1) (rho_node1 FF) v)) E `) +THEN REWRITE_TAC[EE;IN_ELIM_THM] +THEN REWRITE_TAC[GSYM EE] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[GSYM ITER] +THEN MP_TAC(ARITH_RULE`j1<=j /\ SUC j< k-i-1 /\ 0 SUC (k-j1-1)= k-j1 /\ k-j-1-1< k-j1 /\ k-j-1-1< k-j1-1 /\ k-j1-1 MRESAL_TAC th[`k-j-1-1:num`;`k-j1-1`;][ITER] THEN ASSUME_TAC th) +THEN SUBGOAL_THEN`~(ITER (k - j1) (rho_node1 FF) v = g)` ASSUME_TAC; +MP_TAC(ARITH_RULE`j < k - i - 1 /\ j1<=j /\ 0< i==> k-j1=k \/ k- j1< k`) +THEN RESA_TAC; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`); +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`k-j-1-1:num`;`k-j1:num`;][ITER] THEN ASSUME_TAC th) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"linh") +THEN STRIP_TAC +THEN REMOVE_THEN"linh" MP_TAC +THEN RESA_TAC; +MRESA_TAC (GEN_ALL Local_lemmas.FAN_IN_AFF_GE_IMP_EQ)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`vec 0:real^3`;`ITER (k-j1-1) (rho_node1 FF) v`;`g:real^3`;`ITER (k-j1) (rho_node1 FF) v`]; +POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`i< k-1/\ 0< i ==> k-i-1-1< k-i-1 /\ k - (k - i - 1 - 1) - 1= SUC(i) /\ k - (k - i - 1 - 1) = SUC(SUC i)`) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`k-i-1-1`[ARITH_RULE`SUC i=i+1`]) +THEN SUBGOAL_THEN`rho_node1 FF w IN aff_ge {vec 0} {v,w}` ASSUME_TAC ; +POP_ASSUM MP_TAC +THEN EXPAND_TAC"vv" +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN REWRITE_TAC[IN_ELIM_THM;UNIONS] +THEN EXISTS_TAC`aff_ge {vec 0} +{ITER (k-(k - i - 1 - 1)-1) (rho_node1 FF) v, ITER (k-(k - i - 1 - 1)) (rho_node1 FF) v}` +THEN STRIP_TAC; +EXISTS_TAC`k - i - 1 - 1:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`A-1<=A-1`]; +ASM_REWRITE_TAC[ARITH_RULE`SUC i=i+1`] +THEN ONCE_REWRITE_TAC[ARITH_RULE`i+1= SUC i`] +THEN ASM_REWRITE_TAC[ITER] +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`w:real^3`] +THEN MRESA_TAC Planarity.point_in_aff_ge[`vec 0:real^3`;`w:real^3`;`rho_node1 FF w:real^3`]; +SUBGOAL_THEN`azim (vec 0) w (rho_node1 FF w) u= azim (vec 0) w v u` ASSUME_TAC; +DISJ_CASES_TAC(SET_RULE`v= rho_node1 FF w \/ ~(rho_node1 FF w= v)`); +ASM_REWRITE_TAC[]; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ORBIT_MAP_VITER +THEN POP_ASSUM(fun th-> MRESA1_TAC th`w:real^3`) +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`1`[ITER1]) +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`w:real^3`] +THEN UNDISCH_TAC`!v':real^3. v' IN V /\ ~(v' = v) ==> ~collinear {vec 0, v, v'}` +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`rho_node1 FF w`) +THEN MRESA_TAC Topology.aff_ge_inter_aff_ge[`vec 0:real^3`;`v:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE`rho_node1 FF w IN aff_ge {vec 0} {v, w} +/\ aff_ge {vec 0} {v, w} = +aff_ge {vec 0, v} {w} INTER aff_ge {vec 0, w} {v} +==> rho_node1 FF w IN aff_ge {vec 0,w} { v}`) +THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_GE[`vec 0:real^3`;`w:real^3`;`rho_node1 FF w`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESAL_TAC Fan.sum5_azim_fan[`vec 0:real^3`;`w:real^3`;`u:real^3`;`(rho_node1 FF w)`;`v:real^3`][azim] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2) +[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;` u:real^3`;] +THEN POP_ASSUM MP_TAC +THEN UNDISCH_TAC`ITER (i + 1) (rho_node1 FF) v = w` +THEN REWRITE_TAC[ARITH_RULE`i+1=SUC i`;ITER] +THEN RESA_TAC +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`a+ &0=a`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0< azim (vec 0) w (rho_node1 FF w) u ==> ~(azim (vec 0) w (rho_node1 FF w) u = &0)`) +THEN RESA_TAC +THEN MRESAL_TAC AZIM_COMPL[`vec 0:real^3`;`w:real^3`;`rho_node1 FF w:real^3`;`u:real^3`][REAL_ARITH`a-(a- B)=B`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH` azim (vec 0) w (rho_node1 FF w) u < &2 * pi ==> ~(&2 * pi - azim (vec 0) w (rho_node1 FF w) u = &0)`) +THEN ASM_REWRITE_TAC[azim] +THEN STRIP_TAC +THEN MRESAL_TAC AZIM_COMPL[`vec 0:real^3`;`w:real^3`;`u:real^3`;`v:real^3`][REAL_ARITH`a-(a- B)=B`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC; +ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&0< azim (vec 0) v u w /\ azim (vec 0) v u w < pi ==> ~(azim (vec 0) v u w = &0 \/ azim (vec 0) v u (w:real^3) = pi)`) +THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`vec 0:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM (fun th-> +MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN STRIP_TAC +THEN MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN STRIP_TAC +THEN MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] +THEN STRIP_TAC +THEN MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`vec 0:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`vec 0:real^3`;`u:real^3`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`vec 0:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`vec 0:real^3`;`w:real^3`;`u:real^3`;`v:real^3`] +THEN MRESA_TAC AZIM_DIVH [`vec 0:real^3`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC AZIM_DIVH [`vec 0:real^3`;`u:real^3`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC AZIM_DIVH [`vec 0:real^3`;`w:real^3`;`v:real^3`;`u:real^3`] +THEN MRESAL_TAC VOLUME_SOLID_TRIANGLE[`&1:real`;`vec 0:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][REAL_ARITH`&0< &1`] +THEN POP_ASSUM MP_TAC +THEN REPEAT LET_TAC +THEN MRESA_TAC MEASURABLE_BALL_AFF_GT[`vec 0:real^3`;`&1`;`{vec 0:real^3}`;`{v,u,w:real^3}`] +THEN STRIP_TAC +THEN MP_TAC(MESON[volume_props]`measurable (ball (vec 0,&1) INTER aff_gt {vec 0} {v, u, w})==> vol (ball (vec 0,&1) INTER aff_gt {vec 0} {v, u, w}) >= &0`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]);; + + + +end;; diff --git a/text_formalization/local/NUXCOEA.hl b/text_formalization/local/NUXCOEA.hl new file mode 100644 index 0000000..e470416 --- /dev/null +++ b/text_formalization/local/NUXCOEA.hl @@ -0,0 +1,7755 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Nuxcoea = struct + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +open Yxionxl2;; +open Eyypqdw;; +open Ocbicby;; +open Imjxphr;; + +(**TATIC CHANGE (need Hales_tactics)**) + +let MRESA_TAC th1 (th: term list) = INTRO_TAC (GEN_ALL th1) th THEN RESA_TAC;; + +let MRESAL_TAC th1 (th: term list) (th2: thm list) =INTRO_TAC (GEN_ALL th1) th THEN ASM_REWRITE_TAC th2 THEN STRIP_TAC THEN ASM_REWRITE_TAC th2;; + + +let MRESAS_TAC th1 (th: term list) (th2: thm list) =INTRO_TAC (GEN_ALL th1) th THEN ASM_REWRITE_TAC th2 THEN STRIP_TAC THEN ASM_REWRITE_TAC th2 +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC th2 +THEN STRIP_TAC +THEN ASM_SIMP_TAC th2 +;; + + +let THAYTHE_TAC n (th1: term list) = +REPLICATE_TAC n (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC n DISCH_TAC +THEN MRESA_TAC th th1 );; + + +let THAYTHEL_TAC n (th1: term list) (th2: thm list) = +REPLICATE_TAC n (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC n DISCH_TAC +THEN MRESAL_TAC th th1 th2);; + + +let THAYTHES_TAC n (th1: term list) (th2: thm list) = +REPLICATE_TAC n (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC n DISCH_TAC +THEN MRESAS_TAC th th1 th2);; + + +let THAYTHE_ASM_TAC n (th1: term list) = +REPLICATE_TAC n (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC n DISCH_TAC +THEN MRESA_TAC th th1 +THEN ASSUME_TAC th);; + + + + +let THAYTHEL_ASM_TAC n (th1: term list) (th2: thm list) = +REPLICATE_TAC n (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC n DISCH_TAC +THEN MRESAL_TAC th th1 th2 +THEN ASSUME_TAC th);; + + +let DICH_TAC n = +REPLICATE_TAC n (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC n DISCH_TAC +THEN MP_TAC th );; + + +let MATCH_DICH_TAC n = +REPLICATE_TAC n (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC n DISCH_TAC +THEN MATCH_MP_TAC th );; + + + + +(*************) + +let v3_defor_v5=new_definition` v3_defor_v5 a x1 x5 x2 v1 v2 v t= v3_defor_v4 a x1 x5 x2 (--v1) (v2 - v1) (v - v1) t + v1`;; + + + +let EQ_SUC_K_SUB=prove(`l MOD k = SUC i MOD k /\ 1 (l + k - 1) MOD k = i MOD k`, +STRIP_TAC +THEN MP_TAC(ARITH_RULE`1 ~(k=0)/\ ~(k=1)/\ 0 (l + k - 1) MOD k = i MOD k`, +STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0real^3) l IN IMAGE w (:num)`, +REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]);; + + + +let WL_IN_FF=prove(`((w:num->real^3) l,w (SUC l)) IN IMAGE (\i. w i,w (SUC i)) (:num)`, +REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]);; + + +let WL_IN_BALL_ANNULUS=prove(`BBs_v39 s w ==> w l IN ball_annulus`, +REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN STRIP_TAC +THEN ASM_TAC +THEN STRIP_TAC +THEN REPEAT (STRIP_TAC THEN REMOVE_ASSUM_TAC) +THEN MP_TAC WL_IN_V +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`IMAGE w (:num) SUBSET ball_annulus /\ w l IN IMAGE w (:num) +==> w l IN ball_annulus`) +THEN RESA_TAC);; + + +let NORM_LE_2_IN_BBS=prove(`BBs_v39 s w ==> &2<= norm (w l)`, +STRIP_TAC +THEN MP_TAC WL_IN_BALL_ANNULUS +THEN ASM_REWRITE_TAC[IN_ELIM_THM;ball_annulus;DIFF;ball;] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist;VECTOR_ARITH`A- vec 0= A`] +THEN REAL_ARITH_TAC);; + +let MMS_IMP_BBS=prove(`MMs_v39 s w==> BBs_v39 s w`, +REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN RESA_TAC);; + +let MMS_IMP_BBPRIME=prove(`MMs_v39 s w==> BBprime_v39 s w`, +REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN RESA_TAC);; + +let MMS_IMP_BBPRIME2=prove(`MMs_v39 s w==> BBprime2_v39 s w`, +REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN RESA_TAC);; + +let NORM_LE_2_IN_MMS=prove(`MMs_v39 s w ==> &2<= norm (w l)`, +STRIP_TAC +THEN MP_TAC MMS_IMP_BBS +THEN ASM_REWRITE_TAC[NORM_LE_2_IN_BBS]) +;; + +let CHANGE_A_SCS_MODL=prove(`is_scs_v39 s +/\ j MOD (scs_k_v39 s) = j1 MOD (scs_k_v39 s) +==> +scs_a_v39 s j l =scs_a_v39 s j1 l`, +REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s= 0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`j:num`] THEN MRESA_TAC th[`j1:num`]));; + + +let CHANGE_A_SCS_MODR=prove(`is_scs_v39 s +/\ j MOD (scs_k_v39 s) = j1 MOD (scs_k_v39 s) +==> +scs_a_v39 s l j =scs_a_v39 s l j1`, +REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s= 0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`j:num`] THEN MRESA_TAC th[`j1:num`]));; + + +let CHANGE_A_SCS_MOD=prove(`is_scs_v39 s +/\ j MOD (scs_k_v39 s) = j1 MOD (scs_k_v39 s) +/\ l MOD (scs_k_v39 s) = l1 MOD (scs_k_v39 s) +==> +scs_a_v39 s l j =scs_a_v39 s l1 j1`, +STRIP_TAC +THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MODR)[`j:num`;`s:scs_v39`;`l:num`;`j1:num`] +THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MODL)[`l1:num`;`s:scs_v39`;`l:num`;`j1:num`]) +;; + + + +let CHANGE_B_SCS_MODL=prove(`is_scs_v39 s +/\ j MOD (scs_k_v39 s) = j1 MOD (scs_k_v39 s) +==> +scs_b_v39 s j l =scs_b_v39 s j1 l`, +REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s= 0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`j:num`] THEN MRESA_TAC th[`j1:num`]));; + + +let CHANGE_B_SCS_MODR=prove(`is_scs_v39 s +/\ j MOD (scs_k_v39 s) = j1 MOD (scs_k_v39 s) +==> +scs_b_v39 s l j =scs_b_v39 s l j1`, +REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s= 0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`j:num`] THEN MRESA_TAC th[`j1:num`]));; + + +let CHANGE_B_SCS_MOD=prove(`is_scs_v39 s +/\ j MOD (scs_k_v39 s) = j1 MOD (scs_k_v39 s) +/\ l MOD (scs_k_v39 s) = l1 MOD (scs_k_v39 s) +==> +scs_b_v39 s l j =scs_b_v39 s l1 j1`, +STRIP_TAC +THEN MRESA_TAC( GEN_ALL CHANGE_B_SCS_MODR)[`j:num`;`s:scs_v39`;`l:num`;`j1:num`] +THEN MRESA_TAC( GEN_ALL CHANGE_B_SCS_MODL)[`l1:num`;`s:scs_v39`;`l:num`;`j1:num`]) +;; + + + +let CHANGE_W_IN_BBS_MOD_LE3=prove(`3<= scs_k_v39 s /\ +BBs_v39 s w +/\ j MOD (scs_k_v39 s) = j1 MOD (scs_k_v39 s) +==> (w:num->real^3) j= (w:num->real^3) j1`, +REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s= 0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`j:num`] THEN MRESA_TAC th[`j1:num`]));; + + +let CHANGE_W_IN_BBS_MOD_IS_SCS=prove(`is_scs_v39 s /\ +BBs_v39 s w +/\ j MOD (scs_k_v39 s) = j1 MOD (scs_k_v39 s) +==> (w:num->real^3) j= (w:num->real^3) j1`, +REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s= 0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`j:num`] THEN MRESA_TAC th[`j1:num`]));; + + + + +let EXPAND_PERIODIC=prove( `BBs_v39 s w ==> w (l + scs_k_v39 s)= w l`, +REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic] +THEN RESA_TAC);; + + + + + + + +let COLLINEAR_EQ_SUB=prove(`collinear {vec 0, v1, v1 - v2:real^3} <=> collinear {vec 0, v1, v2}`, +ASM_REWRITE_TAC[GSYM CROSS_EQ_0;VECTOR_ARITH`A-B=A+(--B):real^3`;CROSS_RADD;CROSS_RNEG;CROSS_REFL] +THEN VECTOR_ARITH_TAC);; + +let COLLINEAR_EQ_SUB_NEG=prove(`collinear {vec 0, -- v1, v2 - v1:real^3} <=> collinear {vec 0, v1, v2}`, +ASM_REWRITE_TAC[GSYM CROSS_EQ_0;VECTOR_ARITH`A-B=A+(--B):real^3`;CROSS_RADD;CROSS_RNEG;CROSS_REFL;CROSS_LNEG] +THEN VECTOR_ARITH_TAC);; + + + + +let DEFORMATION_MK_DEFOR_IN_BALL_ANNULUS=prove(`&0< x1 /\ &0 ?e. &0< e/\ (!t. --e (v3_defor_v4 a x1 x5 x2 (-- v1) (v2-v1) (v2-v1) t) +v1 IN ball_annulus)`, +REWRITE_TAC[ball_annulus;cball;DIFF;ball;IN_ELIM_THM;dist; VECTOR_ARITH`vec 0 -A= --A`;NORM_NEG;NORM_MUL;REAL_ARITH`~(a b<= a`] +THEN STRIP_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`v2:real^3`] +THEN MRESAL_TAC(GEN_ALL UPS_X_POS_SEG)[`-- v1:real^3`;`v2-v1:real^3`;`x1:real`;`x2:real`;`x5:real`][COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[v3_defor_v4;] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA_TAC th[`t:real`]) +THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORM_V3_V1)[`x2:real`;`-- &1`;`x5:real`;`x2:real`;`x1:real`;`x5-t:real`;`v2-v1:real^3`;`v3_defor_v1 (-- &1) (-- v1) (v2-v1:real^3) x1 x5 x2 x2 (x5 - t)`;`-- v1:real^3`;`x2:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3/\ a- -- b=a+b`;NORM_NEG] +THEN ASM_REWRITE_TAC[NORM_LE_SQUARE;DOT_SQUARE_NORM] +THEN REWRITE_TAC[REAL_ARITH`a<=b<=> b>=a`] +THEN ASM_REWRITE_TAC[NORM_GE_SQUARE;DOT_SQUARE_NORM;REAL_ARITH`(&2 <= &0 \/ x2 >= x2)`;h0] +THEN REMOVE_ASSUM_TAC +THEN EXPAND_TAC"x2" +THEN REAL_ARITH_TAC);; + + + + + + +let EYYPQDW_CONTINUOUS_LIFT_DIST_ADD=prove(`&0< x1 /\ &0 +lift o (\x3. dist(v3_defor_v1 a v1 v2 x1 x2 x5 x6 x3+w,v)) continuous atreal (x3)`, +REPEAT STRIP_TAC +THEN SUBGOAL_THEN`lift o(\x3. dist(v3_defor_v1 a v1 v2 x1 x2 x5 x6 x3 +w,v))= (lift o (\x. dist(x,v))) o(\x3. v3_defor_v1 a v1 v2 x1 x2 x5 x6 x3+w)`ASSUME_TAC +THENL[ +REWRITE_TAC[o_DEF]; +ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC CONTINUOUS_ATREAL_COMPOSE +THEN MP_TAC EYYPQDW_CONTINUOUS_AT_X +THEN RESA_TAC +THEN RESA_TAC +THENL[ +MATCH_MP_TAC CONTINUOUS_ADD +THEN ASM_SIMP_TAC[CONTINUOUS_CONST;lemma30000]; +MATCH_MP_TAC CONTINUOUS_AT_WITHIN +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_SIMP_TAC[CONTINUOUS_AT_LIFT_DIST]]]);; + + + +let EXISTS_SMALL_LE_CONST_ADD=prove(`&0< x1 /\ &0 +?e. &0< e /\ (!t. --e c MRESAL_TAC th[`&0`][REAL_ARITH`(--a< &0<=> &0 &0 &0< (dist(v2,w:real^3)- c )/ &2/\ c< dist (v2,w) - (dist (v2,w) - c) / &2`) +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL EYYPQDW_CONTINUOUS_LIFT_DIST_ADD)[`x2:real`;`a:real`;`-- v1:real^3`;`v2-v1:real^3`;`x1:real`;`x5:real`;`x2:real`;`x2:real`;`v1:real^3`;`w:real^3`;`x5:real`][SET_RULE`A IN {A, B}`;continuous_atreal;DIST_LIFT;o_DEF;GSYM REAL_ABS_BETWEEN;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`(dist(v2,w:real^3)- c )/ &2`]) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`d:real` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESAL_TAC th[`x5-t:real`][REAL_ARITH`x2 - d < x2 - t /\ x2 - t < x2 + d <=> --d scs_a_v39 s l i < dist (v2,w i)) +==> (!i. ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k) ==> ?e. &0< e/\ +(!t. --e < t/\ t< e ==> scs_a_v39 s l i < dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i)))`, +STRIP_TAC +THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR_TWO_CASES)[`s:scs_v39`;`w:num->real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC EXISTS_SMALL_LE_CONST_ADD +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (16-10)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`i:num`]));; + + +let DEFORMATION_DIST_LE_V3_DEFOR_A_COM_MK=prove_by_refinement(`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3 scs_a_v39 s l i < dist (v2,w i)) +==> ?e. &0< e/\ +(!t i. --e< t/\ t< e /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k) ==> scs_a_v39 s l i < dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i))`, +[ +REPEAT STRIP_TAC +THEN MP_TAC DEFORMATION_DIST_LE_MK_A +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] +THEN REWRITE_TAC[SKOLEM_THM] +THEN STRIP_TAC +THEN ABBREV_TAC`e1= inf {(e:num->real) i| i < k /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}` +THEN EXISTS_TAC`e1:real` +THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}`ASSUME_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` +THEN STRIP_TAC; + +MATCH_MP_TAC FINITE_IMAGE +THEN REWRITE_TAC[FINITE_NUMSEG]; + +REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_ELIM_THM] +THEN GEN_TAC +THEN RESA_TAC +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[IN_NUMSEG] +THEN REPLICATE_TAC (16-12)(POP_ASSUM MP_TAC) +THEN ARITH_TAC; + +SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)} = {})`ASSUME_TAC; + +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] +THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(l MOD k =0)`) +THEN RESA_TAC; + +EXISTS_TAC`(e:num->real)2` +THEN EXISTS_TAC`2` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real)3` +THEN EXISTS_TAC`3` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real)1` +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}`;`&0`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN REPLICATE_TAC (20-11) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`]); + +REPEAT STRIP_TAC +THEN MRESAL_TAC REAL_LE_INF_FINITE[`{(e:num->real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}`;`e1:real`][REAL_ARITH`a<=a`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(SUC l MOD k = i MOD k)}`ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`i MOD k` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1 MRESA1_TAC th`(e:num->real) (i MOD k)`) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1 REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num MOD k`]) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`t < e1/\ e1<= e (i MOD k)/\ &0 < e (i MOD k)/\ --e1 t < e (i MOD k)/\ -- e (i MOD k)< t`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`])]);; + + + +let EXISTS_SMALL_LT_CONST_ADD=prove(`&0< x1 /\ &0 +?e. &0< e /\ (!t. --e dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w) MRESAL_TAC th[`&0`][REAL_ARITH`(--a< &0<=> &0 &0 &0< (c-dist(v2,w:real^3))/ &2/\ dist (v2,w) + (c-dist (v2,w) ) / &2 MRESA_TAC th[`(c-dist(v2,w:real^3))/ &2`]) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`d:real` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESAL_TAC th[`x5-t:real`][REAL_ARITH`x2 - d < x2 - t /\ x2 - t < x2 + d <=> --d &4 * h0 < scs_b_v39 s l i) +==> (!i. scs_diag k l i ==> ?e. &0< e/\ +(!t. --e< t/\ t< e ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i)real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC EXISTS_SMALL_LT_CONST_ADD +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k<=3)`) +THEN RESA_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`v2 IN IMAGE (w:num->real^3) (:num)`ASSUME_TAC; + + REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +SUBGOAL_THEN`w i IN IMAGE (w:num->real^3) (:num)`ASSUME_TAC; + + REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +MP_TAC(SET_RULE`v2 IN IMAGE w (:num)/\ w i IN IMAGE w (:num)/\ IMAGE w (:num) SUBSET ball_annulus ==> v2 IN ball_annulus/\ w i IN ball_annulus`) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[IN_ELIM_THM;DIFF;ball_annulus;cball;] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC DIST_TRIANGLE[`v2:real^3`;`vec 0:real^3`;`(w:num->real^3) i`] +THEN MP_TAC(REAL_ARITH`dist (v2,vec 0) <= &2 * h0/\ dist (vec 0,w i) <= &2 * h0/\ dist (v2,w i) <= dist (v2,vec 0) + dist (vec 0,w i) +==> dist (v2,(w:num->real^3) i)<= &4 *h0`) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REPLICATE_TAC (53-41)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`i:num`]) +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC]);; + + + + + +let V3_DEFOR_IN_AFF_GT_V1_MK=prove(`&0< x1 /\ &0 ?e. &0< e/\ (!t. --e< t/\ t< e ==> v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1 IN aff_gt {vec 0} {v1,w})`, +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL UPS_X_POS_SEG)[`-- v1:real^3`;`v2-v1:real^3`;`x1:real`;`x2:real`;`x5:real`][COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`&0`][REAL_ARITH`(--a< &0<=> &0 &0< e1/\ e1< e /\ e1< e'/\ e1< e''`) +THEN RESA_TAC +THEN EXISTS_TAC`e1:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`A SUBSET B/\ a IN A==> a IN B`)) +THEN EXISTS_TAC`ball (v2,e') INTER aff {vec 0, v2, v1:real^3}` +THEN ASM_REWRITE_TAC[INTER;ball;IN_ELIM_THM] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REPLICATE_TAC (23-16) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC(REAL_ARITH`-- e1 t< e''/\ --e'' REPEAT DISCH_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e/\ --e1 t< e/\ -- e< t`) +THEN RESA_TAC +THEN MRESA_TAC th[`t:real`]) +THEN MRESAL_TAC (GEN_ALL EYYPQDW_SCALAR_POS)[`x2:real`;`x5:real`;`x2:real`;`x1:real`;`x5-t:real`;`x2:real`;`v3_defor_v1 (-- &1) (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t)`;`a:real`;`--v1:real^3`;`v2-v1:real^3`][SET_RULE`a IN {a,b}`;GSYM v3_defor_v1;DOT_CROSS_SELF;DOT_LMUL;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG;CROSS_LADD;CROSS_LNEG;CROSS_RNEG;VECTOR_ARITH`--A=B<=> A= --B:real^3`;CROSS_REFL] +THEN REDUCE_VECTOR_TAC +THEN REWRITE_TAC[VECTOR_ARITH`A-B=A+ --B:real^3`;CROSS_RADD;CROSS_RNEG;CROSS_REFL;VECTOR_ARITH`A+ -- vec 0=A`;DOT_CROSS_SELF;DOT_LMUL;DOT_LNEG] +THEN REAL_ARITH_TAC);; + + +let V3_DEFOR_INCREASING_IN_ANGLE=prove(`&0< x1 /\ &0 +?e. &0< e /\ (!t. &0 dist(v2,w) MRESAL_TAC th[`&0`][REAL_ARITH`(--a< &0<=> &0 &0 &0< e1/\ e1 REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 --e REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 --e' ~(v1=v2:real^3)`) +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORM_V3_V1)[`x2:real`;`-- &1`;`x5:real`;`x2:real`;`x1:real`;`x5-t:real`;`v2-v1:real^3`;`v3_defor_v1 (-- &1) (-- v1) (v2-v1:real^3) x1 x5 x2 x2 (x5 - t)`;`-- v1:real^3`;`x2:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3/\ a- -- b=a+b`;NORM_NEG] +THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORMV3)[`x2:real`;`-- &1`;`x5:real`;`x2:real`;`x1:real`;`x2:real`;`--v1:real^3`;`v2-v1:real^3`;`v3_defor_v1 (-- &1) (-- v1) (v2-v1:real^3) x1 x5 x2 x2 (x5 - t)`;`x5-t:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3/\ a- -- b=a+b`;NORM_NEG] +THEN MRESAL_TAC xrr_increasing[`norm(v1:real^3)`;`norm(v2:real^3)`;`norm(v:real^3)`;`norm(v2-v1:real^3)`][NORM_POS_LT;NORM_POS_LE;NORM_LT_SQUARE;DOT_SQUARE_NORM;REAL_ARITH`a-b &0 a=b:real^3`;xrr;REAL_ARITH`a*a= a pow 2`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[Pack1.norm_abs] +THEN ASM_REWRITE_TAC[REAL_LT_SQUARE_ABS] +THEN ASM_REWRITE_TAC[REAL_ABS_NORM;REAL_ARITH`a-b &0 B REWRITE_TAC[SYM th]) +THEN MRESA_TAC (GEN_ALL Planarity.properties_of_collinear4_points_fan) +[`vec 0:real^3`;`v1:real^3`;`w:real^3`;`v+v1:real^3`] +THEN MRESA_TAC th3[`vec 0:real^3`;`v+v1:real^3`;`v1:real^3`] +THEN MRESAL_TAC DOT_NORM_SUB[`v+v1:real^3`;`v1:real^3`][VECTOR_ARITH`(a+b)-b=a:real^3`] +THEN MRESAL_TAC COS_ANGLE[`v1:real^3`;`vec 0:real^3`;`v+v1:real^3`][VECTOR_ARITH`A- vec 0=A`;real_div;REAL_INV_MUL;REAL_ARITH`(x1 + x2) - x6= x2+x1-x6/\ (a*b)*c*d=a*b*d*c`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A- vec 0=A`;real_div;REAL_INV_MUL;REAL_ARITH`(x1 + x2) - x6= x2+x1-x6/\ (a*b)*c=a*b*c`] +THEN SUBGOAL_THEN`norm(v+v1:real^3)= norm (v2:real^3)`ASSUME_TAC +THENL[ + +ASM_REWRITE_TAC[NORM_EQ_SQUARE;NORM_POS_LE;NORM_LT_SQUARE;DOT_SQUARE_NORM] +; + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC COS_MONO_LT_EQ[`angle (v1,vec 0,v2:real^3)`;`angle (v1,vec 0,v+v1:real^3)`][ANGLE_RANGE] +THEN MP_TAC(SET_RULE`v2 IN aff_gt {vec 0} {v1, w}/\ v+v1 IN aff_gt {vec 0} {v1, w} /\ aff_gt {vec 0} {v1,w} SUBSET aff_ge {vec 0} {v1,w}==> v2 IN aff_ge {vec 0} {v1, w}/\ v+v1 IN aff_ge {vec 0} {v1, w:real^3}`) +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN RESA_TAC +THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`w:real^3`] +THEN MRESA_TAC Polar_fan.ANGLES_ADD_AFF_GE [`vec 0:real^3`;`v1:real^3`;`w:real^3`;`v2:real^3`] +THEN MRESA_TAC Polar_fan.ANGLES_ADD_AFF_GE [`vec 0:real^3`;`v1:real^3`;`w:real^3`;`v+v1:real^3`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`angle (v1,vec 0,v+v1) < angle (v1,vec 0,v2) +/\ angle (v1,vec 0,v2) + angle (v2,vec 0,w) = angle (v1,vec 0,w) +/\ angle (v1,vec 0,v+v1) + angle (v+v1,vec 0,w) = angle (v1,vec 0,w) +==> angle (v2,vec 0,w) c ?e. &0< e/\ +(!t. &0 < t/\ t< e ==> scs_a_v39 s l j < dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w j))`, +STRIP_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR_TWO_CASES)[`s:scs_v39`;`w:num->real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MATCH_MP_TAC V3_DEFOR_INCREASING_IN_ANGLE +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MMS_IMP_BBS +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`j:num`;`w:num->real^3`;`SUC l`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[]);; + + + + +let DEFORMATION_DIST_LE_V3_DEFOR_AA_COM_MK=prove(`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3 scs_a_v39 s l i < dist (v2,w i)) +==> ?e. &0< e/\ +(!t i. &0< t/\ t< e /\ ~(l MOD k = i MOD k) ==> scs_a_v39 s l i < dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i))`, +STRIP_TAC +THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_COM_MK +THEN RESA_TAC +THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_COM_MK1 +THEN RESA_TAC +THEN ABBREV_TAC`e1= (min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1= (min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1 t< e'`) +THEN RESA_TAC +THEN MP_TAC MMS_IMP_BBS +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`j:num`;`w:num->real^3`;`i:num`] +THEN THAYTHE_TAC (29-18) [`t:real`] +THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`l:num`;`j:num`;`s:scs_v39`;`l:num`;`i:num`] +THEN SYM_ASSUM_TAC +THEN ASM_REWRITE_TAC[]; + +MP_TAC(REAL_ARITH`t t< e/\ --e< t`) +THEN RESA_TAC +THEN THAYTHE_TAC (28-16) [`t:real`;`i:num`]]);; + + +let EYYPQDW_V3_DEFOR_INCREASING_IN_ANGLE=prove(`&0< x1 /\ &0 +?e. &0< e /\ (!t. &0 dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,v1)< dist(v2,v1))`, +STRIP_TAC +THEN MRESAL_TAC(GEN_ALL UPS_X_POS_SEG)[`-- v1:real^3`;`v2-v1:real^3`;`x1:real`;`x2:real`;`x5:real`][COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`&0`][REAL_ARITH`(--a< &0<=> &0 &0 &0< e1/\ e1 REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 --e REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 --e' ~(v1=v2:real^3)`) +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORM_V3_V1)[`x2:real`;`-- &1`;`x5:real`;`x2:real`;`x1:real`;`x5-t:real`;`v2-v1:real^3`;`v3_defor_v1 (-- &1) (-- v1) (v2-v1:real^3) x1 x5 x2 x2 (x5 - t)`;`-- v1:real^3`;`x2:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3/\ a- -- b=a+b`;NORM_NEG] +THEN MRESAL_TAC (GEN_ALL EYYPQDW_NORMV3)[`x2:real`;`-- &1`;`x5:real`;`x2:real`;`x1:real`;`x2:real`;`--v1:real^3`;`v2-v1:real^3`;`v3_defor_v1 (-- &1) (-- v1) (v2-v1:real^3) x1 x5 x2 x2 (x5 - t)`;`x5-t:real`][SET_RULE`a IN{a,b}`;GSYM v3_defor_v1;COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3/\ a- -- b=a+b`;NORM_NEG;dist;VECTOR_ARITH`(a+b)-b=a:real^3`;NORM_POS_LE;NORM_LT_SQUARE;DOT_SQUARE_NORM;REAL_ARITH`a-b &0 (!j. (l MOD k = SUC j MOD k) +==> ?e. &0< e/\ +(!t. &0 < t/\ t< e ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w j)real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM]THEN MRESA_TAC (GEN_ALL EYYPQDW_V3_DEFOR_INCREASING_IN_ANGLE) +[`(w:num->real^3)(SUC l)`;`a:real`;`x1:real`;`x2:real`;`x5:real`;`v2:real^3`;`v1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN THAYTHE_TAC (20-18)[`t:real`] +THEN MP_TAC MMS_IMP_BBS +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL EQ_SUC_K_SUB3)[`l:num`;`j:num`;`k:num`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`j:num`;`w:num->real^3`;`l+k-1:num`] +THEN MRESA_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`l:num`;`j:num`;`s:scs_v39`;`l:num`;`l+k-1:num`] +THEN ASM_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0 ?e. &0< e/\ +(!t. --e< t/\ t< e ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w j)real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REPEAT STRIP_TAC);; + + + +let DEFORMATION_DIST_LE_V3_DEFOR_B_COM_MK1=prove(` 3 &4 * h0 < scs_b_v39 s l i) +==> (!i. ~(l MOD k = i MOD k)==> ?e. &0< e/\ +(!t. &0< t/\ t< e ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i) --e< t`) +THEN RESA_TAC +THEN THAYTHE_TAC (23-16)[`t:real`] +THEN MP_TAC MMS_IMP_BBS +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`i:num`;`w:num->real^3`;`j:num`] +THEN MRESA_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`l:num`;`i:num`;`s:scs_v39`;`l:num`;`j:num`]; + +MP_TAC(SET_RULE`(l MOD k = SUC i MOD k)\/ ~(l MOD k =SUC i MOD k)`) +THEN RESA_TAC +THENL[ + +THAYTHE_TAC (21-17)[`i:num`] +THEN EXISTS_TAC`(e':num->real) i` +THEN ASM_REWRITE_TAC[]; + +THAYTHEL_TAC (21-18)[`i:num`] [scs_diag] +THEN EXISTS_TAC`(e'':num->real) i` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MATCH_DICH_TAC 2 +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]);; + + + +let DEFORMATION_DIST_LE_V3_DEFOR_B_COM_MK=prove_by_refinement(` 3 &4 * h0 < scs_b_v39 s l i) +==> ?e. &0< e/\ +(!t i. &0< t/\ t< e /\ ~(l MOD k = i MOD k) ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i)real) i| i < k/\ ~(i= l MOD k)}` +THEN EXISTS_TAC`e1:real` +THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` +THEN STRIP_TAC; + + +MATCH_MP_TAC FINITE_IMAGE +THEN REWRITE_TAC[FINITE_NUMSEG]; + + +REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`i:num` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + + +SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(i = l MOD k)} = {})`ASSUME_TAC; + + +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] +THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(0=l MOD k )`) +THEN RESA_TAC; + + + +EXISTS_TAC`(e:num->real)1` +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 1real)0` +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real) i| i < k/\ ~(i= l MOD k)}`;`&0`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN REPLICATE_TAC (13-5) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`]); + + +REPEAT STRIP_TAC +THEN MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(i= l MOD k)}`;`t:real`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`i MOD k` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`]; + + +STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_REFL[`i:num`;`k:num`] +THEN REPLICATE_TAC (15-5) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num MOD k`]) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]); +]);; + + + + +(**************************) + +(***********BBs_V39********) + +(**************************) + + +let DEFORMATION_V3_DEFOR_NOT_IN_V_MK=prove( +` 3 (!i. ~(i MOD k= l MOD k) ==> (?e. &0< e /\ (!t. --e &0real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC EXISTS_SMALL_LE_CONST_ADD +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(REAL_ARITH`&0<= a/\ ~(a= &0)==> &0 < a`) +THEN ASM_REWRITE_TAC[dist;NORM_POS_LE] +THEN MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0 +MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN MRESA_TAC th[`i MOD k`;`l MOD k`]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESA_TAC th[`l:num`]) +THEN STRIP_TAC +THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v2:real^3`;`(w:num->real^3) i`;]);; + + + +let DEFORMATION_V3_DEFOR_NOT_IN_V_COM_MK=prove_by_refinement( +` 3 ?e. &0< e /\ (!t i. --e &0real) i| i < k/\ ~(i= l MOD k)}` +THEN EXISTS_TAC`e1:real` +THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` +THEN STRIP_TAC; + +MATCH_MP_TAC FINITE_IMAGE +THEN REWRITE_TAC[FINITE_NUMSEG]; + +REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`i:num` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(i = l MOD k)} = {})`ASSUME_TAC; + +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] +THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(0=l MOD k )`) +THEN RESA_TAC; + +EXISTS_TAC`(e:num->real)1` +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 1real)0` +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real) i| i < k/\ ~(i= l MOD k)}`;`&0`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN REPLICATE_TAC (13-5) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`]); + +REPEAT STRIP_TAC +THEN MRESAL_TAC REAL_LE_INF_FINITE[`{(e:num->real) i| i < k/\ ~(i= l MOD k)}`;`e1:real`][REAL_ARITH`a<=a`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`i MOD k` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`]; + +STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_REFL[`i:num`;`k:num`] +THEN MP_TAC(REAL_ARITH`-- e1 -- e(i MOD k)< t/\ t< e(i MOD k)`) +THEN RESA_TAC +THEN REPLICATE_TAC (12) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num MOD k`]) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]);]);; + + + + +let DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_MK=prove(` 3 ?e. &0< e /\ (!t i. -- e ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i))`, +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_MK +THEN RESA_TAC +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA_TAC th[`t:real`;`i:num`]) +THEN POP_ASSUM (fun th-> STRIP_TAC +THEN MP_TAC th +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[DIST_REFL]) +THEN REAL_ARITH_TAC);; + + + +let V3_DEFOR_EQ_IN_FF_MK=prove_by_refinement( +` 3 ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> (!a. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t,a IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF + <=> v2,a IN FF)`, +[STRIP_TAC +THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;v3_defor_v5;v3_defor_v4] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;VECTOR_ARITH`a-b+b=a:real^3`]); + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`] +THEN REPEAT RESA_TAC +THEN DICH_TAC 3 +THEN EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESA_TAC th[`l:num`]) +THEN DICH_TAC (69-62) +THEN RESA_TAC +THEN REPLICATE_TAC 3 (POP_ASSUM MP_TAC) +THEN MP_TAC(SET_RULE`x' MOD k= l MOD k\/ ~(x' MOD k= l MOD k)`) +THEN RESA_TAC; + +REPEAT RESA_TAC; + +REPEAT RESA_TAC +THEN THAYTHE_TAC (70-34)[`t:real`;`x':num`] +THEN DICH_TAC (70-61) +THEN RESA_TAC +THEN DICH_TAC 1 +THEN ASM_REWRITE_TAC[]; + +EXISTS_TAC`v2:real^3,a':real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,a'):real^3#real^3`] +THEN VECTOR_ARITH_TAC;]);; + + + + + +let V3_DEFOR_EQ_IN_FF_MK_SYM=prove_by_refinement( +` 3 ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> (!a. a, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF + <=> a, v2 IN FF)`, +[ STRIP_TAC +THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;v3_defor_v5;v3_defor_v4] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;VECTOR_ARITH`a-b+b=a:real^3`]); + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`] +THEN REPEAT RESA_TAC +THEN DICH_TAC 3 +THEN EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC x':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESA_TAC th[`l:num`]) +THEN DICH_TAC (69-62) +THEN RESA_TAC +THEN REPLICATE_TAC 3 (POP_ASSUM MP_TAC) +THEN MP_TAC(SET_RULE`SUC x' MOD k= l MOD k\/ ~(SUC x' MOD k= l MOD k)`) +THEN RESA_TAC; + +REPEAT RESA_TAC; + +REPEAT RESA_TAC +THEN THAYTHE_TAC (70-34)[`t:real`;`SUC x':num`]; + +EXISTS_TAC`a':real^3,v2:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(a',v2):real^3#real^3`] +THEN VECTOR_ARITH_TAC]);; + + + + + + + +let DEFORMATION_AZIM_V3_DEFOR_V1_MK=prove_by_refinement(`scs_k_v39 s = k /\ + 3 < k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + scs_k_v39 s - 1)) = pi /\ + ~collinear {vec 0, w (SUC l), w (l + scs_k_v39 s - 1)} /\ + w l IN aff_gt {vec 0} {w (SUC l), w (l + scs_k_v39 s - 1)} /\ + j MOD k = SUC l MOD k /\ + scs_a_v39 s j l = dist (w j,w l) /\ + dist (w j,w l) < scs_b_v39 s j l /\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ + (!i. ~scs_J_v39 s l i) /\ + w l = v2 /\ + w (l + k - 1) = v1 /\ + norm v1 pow 2 = x1 /\ + norm v2 pow 2 = x2 /\ + norm (v2 - v1) pow 2 = x5 /\ + a = -- &1 /\ + IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ + IMAGE w (:num) = V + ==> (?e. &0 < e /\ + (!t. + --e < t /\ t < e + ==> azim (vec 0) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) + (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t)) + (@a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) = + azim (vec 0) v2 (rho_node1 FF v2) (@a. a,v2 IN FF)))`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_MK +THEN RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN DICH_TAC (22-5) +THEN RESA_TAC +THEN DICH_TAC (22-5) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR_TWO_CASES)[`s:scs_v39`;`w:num->real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1_MK)[`a:real`;`v2:real^3`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`(w:num->real^3) (SUC l)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ABBREV_TAC`e1=(min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1< e/\ e1 t< e/\ --e ~(k=0)/\ ~(k=1)/\ 0real^3`] +THEN MP_TAC WL_IN_FF +THEN RESA_TAC; + +ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (50-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic;BBprime_v39;] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[GSYM rho_node1;GSYM ivs_rho_node1] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(SUC l)`] +THEN MRESA_TAC(GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`] +THEN DICH_TAC (55-4) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t t< e'/\ --e'real^3) (SUC l)`;`(w:num->real^3)(l+k-1)`] +THEN STRIP_TAC; + +MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan +THEN EXISTS_TAC`(w:num->real^3) (SUC l)` +THEN ASM_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[]; + +MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan +THEN EXISTS_TAC`(w:num->real^3)(l+k-1)` +THEN ASM_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[]]);; + + + + + +let V3_DEFOR_EQ_IN_FF_SUB_MK=prove_by_refinement(` 3 ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> (@a. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v1 t,a IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) + = v3_defor_v1 (-- &1) (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1`, +[STRIP_TAC +THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;v3_defor_v5;v3_defor_v4] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] +THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA +THEN STRIP_TAC; + +EXISTS_TAC`v3_defor_v1 (-- &1) (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1` +THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`v1:real^3,v2:real^3` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`]; + + GEN_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +DICH_TAC (45-42) +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v1,v2):real^3#real^3`][VECTOR_ARITH`a-a+a=a:real^3`] +THEN MP_TAC Imjxphr.MOD_ADD_SUB_1 +THEN RESA_TAC +THEN THAYTHE_TAC(48-15)[`t:real`;`l+k-1`]; + +DICH_TAC 2 +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`] +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v1,v2):real^3#real^3`][VECTOR_ARITH`a-a+a=a:real^3`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`v1,a' IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v1:real^3`;`v2:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`a':real^3`;]]);; + + + +let V3_DEFOR_EQ_IN_FF_SUB_MK_SYM=prove_by_refinement( +` 3 ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> (!a. a, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v1 t IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF + <=> a, v1 IN FF)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;v3_defor_v5;v3_defor_v4] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT +THEN RESA_TAC +THEN DICH_TAC 2 +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v1,v2):real^3#real^3`][VECTOR_ARITH`a-a+a=a:real^3`] +THEN MP_TAC Imjxphr.MOD_ADD_SUB_1 +THEN RESA_TAC +THEN THAYTHE_TAC(48-15)[`t:real`;`l+k-1`]; + +MP_TAC(SET_RULE`v2=FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + + DICH_TAC (2) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v1,v2):real^3#real^3`][VECTOR_ARITH`a-a+a=a:real^3`] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`v2,v1 IN FF:real^3#real^3->bool`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v1:real^3`;`FST (x:real^3#real^3)`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v1:real^3`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v2:real^3,(w:num->real^3)(l+k-1)`;`V:real^3->bool`;] +THEN MP_TAC Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`SND(x:real^3#real^3)`]); + +DICH_TAC 2 +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[] +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v1,v2):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] +THEN REPEAT RESA_TAC; + +EXISTS_TAC`a':real^3,v1:real^3` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`a'=v2\/ ~(a'=v2:real^3)`) +THEN RESA_TAC; + +STRIP_TAC +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`]; + + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v1:real^3`;`v2:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v1:real^3`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v2:real^3,(w:num->real^3)(l+k-1)`;`V:real^3->bool`;] +THEN MP_TAC Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v1:real^3`]); + +REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`]]);; + + + + + +let DEFORMATION_AZIM_V3_DEFOR_SUB_MK=prove_by_refinement(`scs_k_v39 s = k /\ + 3 < k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + scs_k_v39 s - 1)) = pi /\ + ~collinear {vec 0, w (SUC l), w (l + scs_k_v39 s - 1)} /\ + w l IN aff_gt {vec 0} {w (SUC l), w (l + scs_k_v39 s - 1)} /\ + j MOD k = SUC l MOD k /\ + scs_a_v39 s j l = dist (w j,w l) /\ + dist (w j,w l) < scs_b_v39 s j l /\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ + (!i. ~scs_J_v39 s l i) /\ + w l = v2 /\ + w (l + k - 1) = v1 /\ + norm v1 pow 2 = x1 /\ + norm v2 pow 2 = x2 /\ + norm (v2 - v1) pow 2 = x5 /\ + a = -- &1 /\ + IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ + IMAGE w (:num) = V + ==> (?e. &0 < e /\ + (!t. + --e < t /\ t < e + ==> azim (vec 0) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v1 t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) + (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v1 t)) + (@a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v1 t IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) = + azim (vec 0) v1 (rho_node1 FF v1) (@a. a,v1 IN FF)))`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_MK +THEN RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN DICH_TAC (22-5) +THEN RESA_TAC +THEN DICH_TAC (22-5) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR_TWO_CASES)[`s:scs_v39`;`w:num->real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1_MK)[`a:real`;`v2:real^3`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`(w:num->real^3) (SUC l)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ABBREV_TAC`e1=(min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1< e/\ e1 t< e/\ --e ~(k=0)/\ ~(k=1)/\ 0real^3`] +THEN MP_TAC WL_IN_FF +THEN RESA_TAC; + +ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (50-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic;BBprime_v39;] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v1,v2):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] +THEN ASM_REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;VECTOR_ARITH`a-b+b=a:real^3`] +THEN REWRITE_TAC[GSYM rho_node1;GSYM ivs_rho_node1] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(SUC l)`] +THEN MRESA_TAC(GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`] +THEN MP_TAC(REAL_ARITH`t t< e'/\ --e' v2 IN aff_ge {vec 0} {v1:real^3, w (SUC l )}`) +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT[`vec 0:real^3`;`(w:num->real^3)(l+k-1)`;`v2:real^3`;`(w:num->real^3)(SUC l)`;`(ivs_rho_node1 FF (w(l+k-1)))`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{C,A,B}={C,B,A}`] +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v1:real^3`;`v2:real^3`] +THEN MATCH_MP_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[]; + +ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN MATCH_MP_TAC(GEN_ALL (SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff_gt{vec 0:real^3} {w(SUC l),v1}` +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]; + +ONCE_REWRITE_TAC[SET_RULE`{C,A,B}={C,B,A}`] +THEN ASM_REWRITE_TAC[]; + +MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan +THEN EXISTS_TAC`(w:num->real^3)(SUC l)` +THEN ASM_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[]]);; + + + + +let V3_DEFOR_EQ_IN_FF_SUC_MK=prove_by_refinement( +` 3 ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> (!a. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (SUC l)) t,a IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF +<=> w(SUC l),a IN FF)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;v3_defor_v5;v3_defor_v4] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`v2=SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT +THEN RESA_TAC +THEN DICH_TAC 2 +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,w(SUC l)):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`w(SUC l),v2 IN FF:real^3#real^3->bool`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`SND (x:real^3#real^3)`;`(w:num->real^3)(SUC l)`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(SUC l)`;`v2:real^3`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`SND (x:real^3#real^3),(w:num->real^3)(SUC l)`;`V:real^3->bool`;] +THEN MP_TAC Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`SND(x:real^3#real^3)`]); + +MP_TAC(SET_RULE`v2=FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +DICH_TAC 2 +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,w(SUC l)):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] +THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`l:num`]) +THEN THAYTHE_TAC (46-15)[`t:real`;`SUC l`]; + +DICH_TAC 2 +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,w(SUC l)):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] +THEN STRIP_TAC +THEN DICH_TAC 1 +THEN ASM_REWRITE_TAC[]; + +EXISTS_TAC`w (SUC l):real^3,a':real^3` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`a'=v2\/ ~(a'=v2:real^3)`) +THEN RESA_TAC; + +STRIP_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`]; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(SUC l)`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(SUC l)`;`v2:real^3`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v2:real^3,(w:num->real^3)(SUC l)`;`V:real^3->bool`;] +THEN MP_TAC Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v2:real^3`]); + +REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`]]);; + + + +let V3_DEFOR_EQ_IN_FF_SUC_MK_SYM=prove_by_refinement( +` 3 ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> (@a. a, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (SUC l)) t IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF +) = v3_defor_v1 (-- &1) (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1`, +[ STRIP_TAC +THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;v3_defor_v5;v3_defor_v4] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + + + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] +THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA +THEN STRIP_TAC; + +EXISTS_TAC`v3_defor_v1 (-- &1) (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1` +THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`v2:real^3,(w:num->real^3) (SUC l)` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`]; + + GEN_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + + +DICH_TAC (45-43) +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,w(SUC l)):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] +THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`l:num`]) +THEN THAYTHE_TAC (47-15)[`t:real`;`SUC l`]; + +DICH_TAC 2 +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`] +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,w(SUC l)):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`a',w(SUC l) IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(SUC l)`;`v2:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(SUC l)`;`a':real^3`]]);; + + + +let DEFORMATION_AZIM_V3_DEFOR_SUC_MK=prove_by_refinement(`scs_k_v39 s = k /\ + 3 < k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + scs_k_v39 s - 1)) = pi /\ + ~collinear {vec 0, w (SUC l), w (l + scs_k_v39 s - 1)} /\ + w l IN aff_gt {vec 0} {w (SUC l), w (l + scs_k_v39 s - 1)} /\ + j MOD k = SUC l MOD k /\ + scs_a_v39 s j l = dist (w j,w l) /\ + dist (w j,w l) < scs_b_v39 s j l /\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ + (!i. ~scs_J_v39 s l i) /\ + w l = v2 /\ + w (l + k - 1) = v1 /\ + norm v1 pow 2 = x1 /\ + norm v2 pow 2 = x2 /\ + norm (v2 - v1) pow 2 = x5 /\ + a = -- &1 /\ + IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ + IMAGE w (:num) = V + ==> (?e. &0 < e /\ + (!t. + --e < t /\ t < e + ==> azim (vec 0) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (SUC l)) t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) + (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (SUC l)) t)) + (@a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (SUC l)) t IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) = + azim (vec 0) (w (SUC l)) (rho_node1 FF (w (SUC l))) (@a. a,w (SUC l) IN FF)))`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_MK +THEN RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN DICH_TAC (22-5) +THEN RESA_TAC +THEN DICH_TAC (22-5) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR_TWO_CASES)[`s:scs_v39`;`w:num->real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1_MK)[`a:real`;`v2:real^3`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`(w:num->real^3) (SUC l)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ABBREV_TAC`e1=(min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1< e/\ e1 t< e/\ --e ~(k=0)/\ ~(k=1)/\ 0real^3`] +THEN MP_TAC WL_IN_FF +THEN RESA_TAC; + +ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (50-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic;BBprime_v39;] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,w(SUC l)):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] +THEN ASM_REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;VECTOR_ARITH`a-b+b=a:real^3`] +THEN REWRITE_TAC[GSYM rho_node1;GSYM ivs_rho_node1] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(SUC l)`] +THEN MRESA_TAC(GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`] +THEN MP_TAC(REAL_ARITH`t t< e'/\ --e' v2 IN aff_ge {vec 0} {v1:real^3, w (SUC l )}`) +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,w(SUC l)):real^3#real^3`] +THEN MRESA_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT[`vec 0:real^3`;`(w:num->real^3)(SUC l)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`;`(rho_node1 FF (w(SUC l)))`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{C,A,B}={C,B,A}`] +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(SUC l)`;`v2:real^3`] +THEN MATCH_MP_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[]; + +ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN MATCH_MP_TAC(GEN_ALL (SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff_gt{vec 0:real^3} {v1,w(SUC l)}` +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[]; + +ONCE_REWRITE_TAC[SET_RULE`{C,A,B}={C,B,A}`] +THEN ASM_REWRITE_TAC[]; + +MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan +THEN EXISTS_TAC`(w:num->real^3)(l+k-1)` +THEN ASM_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[]]);; + + + +let V3_DEFOR_EQ_IN_FF_NOT_MK=prove_by_refinement( +` 3 ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +/\ ~(v=v1)/\ ~(v=v2)/\ ~(v= w(SUC l)) +/\ v IN V +==> (!a. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t,a IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF +<=> v,a IN FF)`, +[STRIP_TAC +THEN REPLICATE_TAC (23-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;v3_defor_v5;v3_defor_v4] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`v2=SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT +THEN RESA_TAC +THEN DICH_TAC 2 +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`v,v2 IN FF:real^3#real^3->bool`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] +THEN MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`(w:num->real^3) (l+k-1)`] +THEN DICH_TAC (52-19) +THEN RESA_TAC; + +MP_TAC(SET_RULE`v2=FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +DICH_TAC 2 +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] +THEN DICH_TAC(47-22) +THEN EXPAND_TAC "V" +THEN REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN STRIP_TAC +THEN THAYTHE_TAC (48-15)[`t:real`;`x':num`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`x' MOD k = l MOD k\/ ~(x' MOD k = l MOD k)`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`x':num`;`w:num->real^3`;`l:num`]; + +SET_TAC[]; + +DICH_TAC 2 +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] +THEN RESA_TAC; + +EXISTS_TAC`v:real^3,a':real^3` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`a'=v2\/ ~(a'=v2:real^3)`) +THEN RESA_TAC; + +STRIP_TAC +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] +THEN MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`(w:num->real^3) (l+k-1)`] +THEN DICH_TAC (52-19) +THEN RESA_TAC; + +REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`]]);; + + + + +let V3_DEFOR_EQ_IN_FF_NOT_MK_SYM=prove_by_refinement(` 3 ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +/\ ~(v=v1)/\ ~(v=v2)/\ ~(v= w(SUC l)) +/\ v IN V +==> (!a. a, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF +<=> a,v IN FF)`, +[STRIP_TAC +THEN REPLICATE_TAC (23-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;v3_defor_v5;v3_defor_v4] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`v2=FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v2:real^3,(w:num->real^3) (SUC l)`] +THEN DICH_TAC 3 +THEN DICH_TAC 3 +THEN MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`v2,v IN FF:real^3#real^3->bool`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(SUC l)`] +THEN DICH_TAC (54-21) +THEN RESA_TAC; + +MP_TAC(SET_RULE`v2=SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + + +DICH_TAC 2 +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] +THEN DICH_TAC(47-22) +THEN EXPAND_TAC "V" +THEN REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN STRIP_TAC +THEN THAYTHE_TAC (48-15)[`t:real`;`x':num`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`x' MOD k = l MOD k\/ ~(x' MOD k = l MOD k)`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`x':num`;`w:num->real^3`;`l:num`]; + +SET_TAC[]; + +DICH_TAC 2 +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] +THEN REPEAT RESA_TAC; + +EXISTS_TAC`a':real^3,v:real^3` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`a'=v2\/ ~(a'=v2:real^3)`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(SUC l)`]; + +REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`]]);; + + + + + + +let DEFORMATION_AZIM_V3_DEFOR_NOT_MK=prove_by_refinement(`scs_k_v39 s = k /\ + 3 < k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + scs_k_v39 s - 1)) = pi /\ + ~collinear {vec 0, w (SUC l), w (l + scs_k_v39 s - 1)} /\ + w l IN aff_gt {vec 0} {w (SUC l), w (l + scs_k_v39 s - 1)} /\ + j MOD k = SUC l MOD k /\ + scs_a_v39 s j l = dist (w j,w l) /\ + dist (w j,w l) < scs_b_v39 s j l /\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ + (!i. ~scs_J_v39 s l i) /\ + w l = v2 /\ + w (l + k - 1) = v1 /\ + norm v1 pow 2 = x1 /\ + norm v2 pow 2 = x2 /\ + norm (v2 - v1) pow 2 = x5 /\ + a = -- &1 /\ + IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ + IMAGE w (:num) = V + ==> (?e. &0 < e /\ + (!t v. + --e < t /\ t < e /\ ~(v=v1)/\ ~(v=v2)/\ ~(v= w(SUC l)) +/\ v IN V + ==> azim (vec 0) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) + (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t)) + (@a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) = + azim (vec 0) (v) (rho_node1 FF (v)) (@a. a,v IN FF)))`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_MK +THEN RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN DICH_TAC (22-5) +THEN RESA_TAC +THEN DICH_TAC (22-5) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR_TWO_CASES)[`s:scs_v39`;`w:num->real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1_MK)[`a:real`;`v2:real^3`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`(w:num->real^3) (SUC l)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ABBREV_TAC`e1=(min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1< e/\ e1 t< e/\ --e ~(k=0)/\ ~(k=1)/\ 0real^3`] +THEN MP_TAC WL_IN_FF +THEN RESA_TAC; + +ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + + +REPLICATE_TAC (54-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic;BBprime_v39;] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,w(SUC l)):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] +THEN ASM_REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;VECTOR_ARITH`a-b+b=a:real^3`]]);; + + + +let DEFORMATION_AZIM_V3_DEFOR_V1_AT_ALL_MK=prove_by_refinement(`scs_k_v39 s = k /\ + 3 < k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + scs_k_v39 s - 1)) = pi /\ + ~collinear {vec 0, w (SUC l), w (l + scs_k_v39 s - 1)} /\ + w l IN aff_gt {vec 0} {w (SUC l), w (l + scs_k_v39 s - 1)} /\ + j MOD k = SUC l MOD k /\ + scs_a_v39 s j l = dist (w j,w l) /\ + dist (w j,w l) < scs_b_v39 s j l /\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ + (!i. ~scs_J_v39 s l i) /\ + w l = v2 /\ + w (l + k - 1) = v1 /\ + norm v1 pow 2 = x1 /\ + norm v2 pow 2 = x2 /\ + norm (v2 - v1) pow 2 = x5 /\ + a = -- &1 /\ + IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ + IMAGE w (:num) = V + ==> (?e. &0 < e /\ + (!t v. + --e < t /\ t < e /\ v IN V + ==> azim (vec 0) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) + (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t)) + (@a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) = + azim (vec 0) (v) (rho_node1 FF (v)) (@a. a,v IN FF)))`, +[STRIP_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_MK +THEN RESA_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_SUB_MK +THEN RESA_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_SUC_MK +THEN RESA_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_NOT_MK +THEN RESA_TAC +THEN ABBREV_TAC`e1=(min (min (min e e') e'')e''')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min (min (min e e') e'')e''')/ &2/\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''==> &0< e1/\ e1 treal^3)(l+k-1))\/ ~(v=(w:num->real^3)(l+k-1))`) +THEN RESA_TAC; + +MATCH_DICH_TAC (46-24) +THEN ASM_REWRITE_TAC[]; + +MP_TAC(SET_RULE`(v=(w:num->real^3)(SUC l))\/ ~(v=(w:num->real^3)(SUC l))`) +THEN RESA_TAC; + +MATCH_DICH_TAC (47-26) +THEN ASM_REWRITE_TAC[]; + +MP_TAC(SET_RULE`(v=(w:num->real^3)(l))\/ ~(v=(w:num->real^3)( l))`) +THEN RESA_TAC; + +MATCH_DICH_TAC (48-22) +THEN ASM_REWRITE_TAC[]; + +MATCH_DICH_TAC (48-28) +THEN ASM_REWRITE_TAC[]]);; + + +let DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_AT_ALL_MK=prove(`scs_k_v39 s = k /\ + 3 < k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + scs_k_v39 s - 1)) = pi /\ + ~collinear {vec 0, w (SUC l), w (l + scs_k_v39 s - 1)} /\ + w l IN aff_gt {vec 0} {w (SUC l), w (l + scs_k_v39 s - 1)} /\ + j MOD k = SUC l MOD k /\ + scs_a_v39 s j l = dist (w j,w l) /\ + dist (w j,w l) < scs_b_v39 s j l /\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ + (!i. ~scs_J_v39 s l i) /\ + w l = v2 /\ + w (l + k - 1) = v1 /\ + norm v1 pow 2 = x1 /\ + norm v2 pow 2 = x2 /\ + norm (v2 - v1) pow 2 = x5 /\ + a = -- &1 /\ + IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ + IMAGE w (:num) = V + ==> (?e. &0 < e /\ + (!t v. + --e < t /\ t < e /\ v IN V + ==> interior_angle1 (vec 0) + (IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) + (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v t) = + interior_angle1 (vec 0) FF v))`, +REWRITE_TAC[interior_angle1;DEFORMATION_AZIM_V3_DEFOR_V1_AT_ALL_MK]);; + + + +let DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_LE_PI_AT_ALL_MK=prove(`scs_k_v39 s = k /\ + 3 < k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + scs_k_v39 s - 1)) = pi /\ + ~collinear {vec 0, w (SUC l), w (l + scs_k_v39 s - 1)} /\ + w l IN aff_gt {vec 0} {w (SUC l), w (l + scs_k_v39 s - 1)} /\ + j MOD k = SUC l MOD k /\ + scs_a_v39 s j l = dist (w j,w l) /\ + dist (w j,w l) < scs_b_v39 s j l /\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ + (!i. ~scs_J_v39 s l i) /\ + w l = v2 /\ + w (l + k - 1) = v1 /\ + norm v1 pow 2 = x1 /\ + norm v2 pow 2 = x2 /\ + norm (v2 - v1) pow 2 = x5 /\ + a = -- &1 /\ + IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ + IMAGE w (:num) = V + ==> (?e. &0 < e /\ + (!t v. + --e < t /\ t < e /\ v IN V /\ interior_angle1 (vec 0) FF v= pi + ==> interior_angle1 (vec 0) + (IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) + (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v t) <= pi + ))`, +STRIP_TAC +THEN MP_TAC DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_AT_ALL_MK +THEN RESA_TAC +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC (26-22)[`t:real`;`v:real^3`] +THEN REAL_ARITH_TAC);; + + +let FUN_V3_DEFOR_V5=prove(`v3_defor_v5 a x1 x2 x6 v1 w v = (\t. v3_defor_v5 a x1 x2 x6 v1 w v t)`,REWRITE_TAC[FUN_EQ_THM]);; + + +let V3_DEFOR_DEFORMATION_V5=prove_by_refinement(`&0< x1 /\ &0 ?e. &0< e /\ deformation (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2) V (--e,e)`, +[ +REWRITE_TAC[deformation;real_interval;IN_ELIM_THM;REAL_ARITH`(-- &1 < &0 /\ &0 < &1)`] +THEN STRIP_TAC +THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`v2:real^3`] +THEN MRESAL_TAC(GEN_ALL UPS_X_POS_SEG)[`-- v1:real^3`;`v2-v1:real^3`;`x1:real`;`x2:real`;`x5:real`][COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0< e==> -- e< &0`) +THEN RESA_TAC +THEN STRIP_TAC; + +REPEAT STRIP_TAC +THEN ONCE_REWRITE_TAC[FUN_V3_DEFOR_V5] +THEN REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] +THEN MP_TAC(SET_RULE`(v=v2:real^3)\/ ~(v=v2)`) +THEN RESA_TAC; + +MATCH_MP_TAC CONTINUOUS_ADD +THEN ASM_SIMP_TAC[CONTINUOUS_CONST;] +THEN REWRITE_TAC[V3_DEFOR_V1_O_DEF] +THEN MATCH_MP_TAC CONTINUOUS_REAL_CONTINUOUS_ATREAL_COMPOSE +THEN STRIP_TAC; + +MATCH_MP_TAC REAL_CONTINUOUS_SUB +THEN ASM_SIMP_TAC[REAL_CONTINUOUS_CONST;REAL_CONTINUOUS_AT_ID]; + + +MATCH_MP_TAC CONTINUOUS_ATREAL_WITHINREAL +THEN REWRITE_TAC[] +THEN MATCH_MP_TAC (GEN_ALL EYYPQDW_CONTINUOUS_AT_X) +THEN ASM_REWRITE_TAC[] +THEN THAYTHE_TAC (20-15)[`r:real`] +THEN EXISTS_TAC`x2:real` +THEN ASM_REWRITE_TAC[COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] +THEN SET_TAC[]; + +REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`;CONTINUOUS_CONST]; + +REPEAT RESA_TAC +THEN REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;] +THEN MRESAL_TAC (GEN_ALL V3_DEFOR_ID)[`a:real`;`-- v1:real^3`;`x1:real`;`x2:real`;`x5:real`;`v2-v1:real^3`][REAL_ARITH`(--a< &0<=> &0real^3) x', w (SUC x')}` +THEN STRIP_TAC; +EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[]; +SET_TAC[]; +RESA_TAC +THEN EXISTS_TAC`x'':num` +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]]);; + + + +let F_DEFORMATION_V3_DEFOR_V5=prove(`IMAGE + (\i. v3_defor_v4 (-- &1) x1 x5 x2 (--v1) (v2 - v1) (w i - v1) t + + v1, v3_defor_v4 (-- &1) x1 x5 x2 (--v1) (v2 - v1) + (w (SUC i) - v1) + t + + v1) + (:num) = IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) (IMAGE (\i. w i, w (SUC i)) (:num))`, +REWRITE_TAC[EXTENSION;IMAGE;IN_ELIM_THM;v3_defor_v5] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +RESA_TAC +THEN EXISTS_TAC`(w:num->real^3) x',w (SUC x')` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[]; +RESA_TAC +THEN EXISTS_TAC`x'':num` +THEN ASM_REWRITE_TAC[]]);; + + + +let DEFORMATION_LUNAR_AFFINE_HULL_MK=prove_by_refinement( +`scs_k_v39 s = k /\ + 3 < k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + scs_k_v39 s - 1)) = pi /\ + ~collinear {vec 0, w (SUC l), w (l + scs_k_v39 s - 1)} /\ + w l IN aff_gt {vec 0} {w (SUC l), w (l + scs_k_v39 s - 1)} /\ + j MOD k = SUC l MOD k /\ + scs_a_v39 s j l = dist (w j,w l) /\ + dist (w j,w l) < scs_b_v39 s j l /\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ + (!i. ~scs_J_v39 s l i) /\ + w l = v2 /\ + w (l + k - 1) = v1 /\ + norm v1 pow 2 = x1 /\ + norm v2 pow 2 = x2 /\ + norm (v2 - v1) pow 2 = x5 /\ + a = -- &1 /\ + IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ + IMAGE w (:num) = V /\ + ~(v=v2)/\ ~(w1=v2) +/\ IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)=E +/\ lunar (v,w1) V E +==> +?e. &0 v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t IN + affine hull {vec 0, v, w1, v2})`, +[STRIP_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_MK +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR_TWO_CASES)[`s:scs_v39`;`w:num->real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN DICH_TAC (30-4) +THEN RESA_TAC +THEN DICH_TAC (30-4) +THEN RESA_TAC +THEN DICH_TAC (30-4) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1_MK)[`a:real`;`v2:real^3`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`(w:num->real^3) (SUC l)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REPLICATE_TAC (32-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;IN_REAL_INTERVAL] +THEN MP_TAC th +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0real^3`] +THEN MP_TAC WL_IN_FF +THEN RESA_TAC; + + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v1:real^3`;] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(v2:real^3)`;`(w:num->real^3)(SUC l)`] +THEN MRESAL_TAC (GEN_ALL LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI) +[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`w1:real^3`;][DIFF;IN_ELIM_THM;SET_RULE`~(a IN {b,c}) <=> (~(a=b)/\ ~(a=c))`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v2:real^3`]) +THEN MRESA_TAC (GEN_ALL Collect_geom2.THREE_GEN_POINTS_IN_AFF3)[`v2:real^3`;`v:real^3`;`w1:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.CONV02_SUBSET_AFF2)[`v:real^3`;`w1:real^3`] +THEN MP_TAC(SET_RULE`v IN aff {v2, v, w1}/\ w1 IN aff {v2, v, w1} +==> {v, w1} SUBSET aff {v2, v, w1:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.S_SUBSET_IMP_AFF_S_TOO)[`{v, w1:real^3}`;` {v2, v, w1:real^3}`] +THEN MP_TAC(SET_RULE`v1 IN aff {v2, v, w1}/\ w (SUC l) IN aff {v2, v, w1} +/\ vec 0 IN conv0 {v, w1} /\ conv0 {v, w1} SUBSET aff {v, w1} +/\ aff {v, w1} SUBSET aff {v2, v, w1} +==> {vec 0, v1, w (SUC l)} SUBSET aff {v2, v, w1:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.S_SUBSET_IMP_AFF_S_TOO)[`{vec 0, v1, w (SUC l):real^3}`;` {v2, v, w1:real^3}`] +THEN MRESAL_TAC (GEN_ALL Local_lemmas.AFF_GT_SUB_AFF_UNION)[`{vec 0:real^3}`;`{ v1, w (SUC l):real^3}`][SET_RULE`{A}UNION {B,C}={A,B,C}`] +THEN EXISTS_TAC`e':real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT RESA_TAC; + +THAYTHE_TAC (71-31)[`t:real`] +THEN REWRITE_TAC[GSYM aff] +THEN MRESAL_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA[`{v2, v, w1:real^3}`;`{vec 0,v, w1,v2:real^3}`][SET_RULE`{A,B,C} SUBSET {D,B,C,A}`;GSYM aff] +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff {v2, v, w1:real^3}` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff {vec 0, v1, w (SUC l):real^3}` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff_gt {vec 0} {v1, w (SUC l):real^3}` +THEN ASM_REWRITE_TAC[v3_defor_v4] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[v3_defor_v5;v3_defor_v4] +]);; + + + + + + +let V3_DEFOR_CONVEX_LOCAL_FAN_MK_concl =`!s k w l j. + scs_k_v39 s=k /\ + 3 < k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ +~collinear {vec 0, w (SUC l), w (l + scs_k_v39 s - 1)} /\ + w l IN aff_gt {vec 0} {w (SUC l), w (l + scs_k_v39 s - 1)} /\ + (j MOD k = SUC l MOD k ) /\ + (scs_a_v39 s j l = dist(w j,w l)) /\ +(dist(w j,w l) &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist(w l,w i)) /\ + (!i. ~(scs_J_v39 s l i)) /\ + w l=v2/\ w (l+k-1) =v1 +/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5/\ a= -- &1 +/\ norm v2 = &2 +/\ (!V E v. + V = IMAGE w (:num) /\ + E = IMAGE (\i. {w i, w (SUC i)}) (:num) ==> + ~(lunar (v,(w l)) V E )) ==> +(?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> +convex_local_fan + (IMAGE (\i. v3_defor_v4 a x1 x5 x2 (--v1) (v2 - v1) (w i - v1) t + v1) + (:num), + IMAGE + (\i. {v3_defor_v4 a x1 x5 x2 (--v1) (v2 - v1) (w i - v1) t + v1, v3_defor_v4 + a + x1 + x5 + x2 + (--v1) + (v2 - v1) + (w (SUC i) - + v1) + t + + v1}) + (:num), + IMAGE + (\i. v3_defor_v4 a x1 x5 x2 (--v1) (v2 - v1) (w i - v1) t + v1, + v3_defor_v4 a x1 x5 x2 (--v1) (v2 - v1) (w (SUC i) - v1) t + v1) + (:num))))`;; + +let V3_DEFOR_CONVEX_LOCAL_FAN_MK=prove_by_refinement( +(mk_imp(ZLZTHIC_concl, mk_imp (MHAEYJN_concl, V3_DEFOR_CONVEX_LOCAL_FAN_MK_concl))), +[ +REPEAT STRIP_TAC; + +REPLICATE_TAC (22-5)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + + +REPLICATE_TAC (40-21)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC WL_IN_V +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL WL_IN_V)[`l+k-1`;`w:num->real^3`] +THEN MRESA_TAC(GEN_ALL WL_IN_V)[`SUC l`;`w:num->real^3`] +THEN MP_TAC WL_IN_BALL_ANNULUS +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_BALL_ANNULUS)[`s:scs_v39`;`w:num->real^3`;`l+k-1`] +THEN MRESA_TAC (GEN_ALL WL_IN_BALL_ANNULUS)[`s:scs_v39`;`w:num->real^3`;`SUC l`] +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`]; + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v1,v2):real^3#real^3`] +THEN MRESA_TAC(GEN_ALL NORM_POS_COLLINEAR)[`v2:real^3`;`v1:real^3`;`x2:real`;`x1:real`;`x5:real`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MP_TAC DEFORMATION_MK_DEFOR_IN_BALL_ANNULUS +THEN RESA_TAC; + +MRESA_TAC Deformation.XRECQNS[`-- &1`;`&1`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`ww_defor ((w:num->real^3) l)`] +THEN MP_TAC Wrgcvdr_cizmrrh.CIZMRRH +THEN RESA_TAC; + +MP_TAC DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_LE_PI_AT_ALL_MK +THEN RESA_TAC +THEN MP_TAC V3_DEFOR_DEFORMATION_V5 +THEN RESA_TAC; + +ABBREV_TAC`e1= (min(min(min (min e (&1)) e') e'')e''')/ &2` +THEN MP_TAC(REAL_ARITH`e1= (min(min(min (min e (&1)) e') e'')e''')/ &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e''' ==> &0< e1/\ e1< &1/\ e1< e /\ e1< e' /\ e1< e'' /\ --e1< &0/\ e1<= e'''/\ --e'''<= --e1`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL DEFORMATION_SMALL_INTERVAL)[`-- e''':real`;`e''':real`;`v3_defor_v5 (-- &1) x1 x5 x2 v1 v2`;`V:real^3->bool`;`--e1:real`;`e1:real`] +THEN THAYTHE_TAC (76-0) [`-- e1`;`e1:real`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v3_defor_v5 (-- &1) x1 x5 x2 v1 v2`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`(!v t. + v IN V /\ + t IN real_interval (--e1,e1) /\ + interior_angle1 (vec 0) FF v = pi + ==> interior_angle1 (vec 0) + (IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) + (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v t) <= + pi)`ASSUME_TAC; + +ASM_REWRITE_TAC[IN_REAL_INTERVAL] +THEN REPEAT RESA_TAC +THEN MATCH_DICH_TAC (79-63) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''/\ --e1 t STRIP_TAC +THEN MRESA_TAC th[`t:real`]); + + +(*********LUNAR*******) + + +MRESAL_TAC JKQEWGV3[`s:scs_v39`;`w:num->real^3`;`v:real^3`;`w':real^3`][LET_DEF;LET_END_DEF;] +THEN MP_TAC(REAL_ARITH`interior_angle1 (vec 0) FF v < pi / &2/\ &0< pi +==> interior_angle1 (vec 0) FF v < pi`) +THEN ASM_REWRITE_TAC[PI_WORKS] +THEN RESA_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`~(v2=v:real^3)`ASSUME_TAC; + +POP_ASSUM(fun th-> MRESA_TAC th[`V:real^3->bool`;`E:(real^3->bool)->bool`;`w':real^3`]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT RESA_TAC) +THEN ASM_REWRITE_TAC[Local_lemmas.LUNAR_COMM]; + + +SUBGOAL_THEN`~(v2=w':real^3)`ASSUME_TAC; + +REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT RESA_TAC); + + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ABBREV_TAC`w1=w':real^3` +THEN MP_TAC DEFORMATION_LUNAR_AFFINE_HULL_MK +THEN RESA_TAC +THEN MP_TAC V3_DEFOR_DEFORMATION_V5 +THEN RESA_TAC; + +ABBREV_TAC`e1= (min(min(min (min e (&1)) e') e'') e''')/ &2` +THEN MP_TAC(REAL_ARITH`e1= (min(min(min (min e (&1)) e') e'') e''')/ &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e''' ==> &0< e1/\ e1< &1/\ e1< e /\ e1< e' /\ e1< e'' /\ e1<= e'''/\ -- e'''<= --e1/\ --e1< &0`) +THEN RESA_TAC +THEN SUBGOAL_THEN`(!u' t. + u' IN V /\ ~(v2 = u':real^3) /\ t IN real_interval (--e1,e1) + ==> v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 u' t = u')`ASSUME_TAC; + +REPEAT STRIP_TAC +THEN REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-c=b-c<=>a=b:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;]) +THEN VECTOR_ARITH_TAC; + +SUBGOAL_THEN`(!t. t IN real_interval (--e1,e1) + ==> v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t IN + affine hull {vec 0, v, w1, v2})`ASSUME_TAC; + +ASM_REWRITE_TAC[IN_REAL_INTERVAL] +THEN REPEAT RESA_TAC +THEN MATCH_DICH_TAC (83-69) +THEN ASM_REWRITE_TAC[IN_REAL_INTERVAL] +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''/\ --e1 tbool`;`--e1:real`;`e1:real`] +THEN REPLICATE_TAC (83-1) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th[`-- e1`;`e1:real`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v3_defor_v5 (-- &1) x1 x5 x2 v1 v2`;`v:real^3`;`w':real^3`;`v2:real^3`]) +THEN POP_ASSUM MP_TAC; + +RESA_TAC +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN EXISTS_TAC`e'''':real` +THEN ASM_REWRITE_TAC[V_DEFORMATION_V3_DEFOR_V5;E_DEFORMATION_V3_DEFOR_V5;F_DEFORMATION_V3_DEFOR_V5] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA_TAC th[`t:real`])]);; + + + + +let CARD_FF_EQ_V3_DEFOR_DEFORMATION_MK=prove(`scs_k_v39 s =k /\ + IMAGE (w:num->real^3) (:num)=V/\ + is_scs_v39 s /\ +3< k/\ + BBs_v39 s w /\(!t. &0 < t /\ t < e1 ==> BBs_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t)) +==> (!t. &0< t/\ t< e1==> +CARD (IMAGE + (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t, + v3_defor_v5 a x1 x5 x2 v1 v2 (w (SUC i)) t) + (:num)) +=CARD(IMAGE (\i. w i,w (SUC i)) (:num)))`, +STRIP_TAC +THEN GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA_TAC th[`t:real`]) +THEN MRESA_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`] +THEN MRESA_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`(\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t)`;`IMAGE ((\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t)) (:num)`;`k:num`] +THEN MP_TAC(ARITH_RULE`3 ~(k<= 3)`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN ASSUME_TAC(th) +THEN REPEAT RESA_TAC) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;convex_local_fan] +THEN REPEAT RESA_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ) +[`IMAGE (\i. { v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t, v3_defor_v5 a x1 x5 x2 v1 v2 (w (SUC i)) t}) + (:num)`;`IMAGE (\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t,v3_defor_v5 a x1 x5 x2 v1 v2 (w (SUC i)) t) (:num)`;`IMAGE (\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t) (:num)`] +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ) +[`IMAGE (\i. {w i, (w:num->real^3) (SUC i)}) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`V:real^3->bool`]);; + + + + + +let DSV_V3_DEFOR_EQ_MK=prove_by_refinement( +`scs_k_v39 s=k/\ + is_scs_v39 s /\ + BBs_v39 s w /\ +(!i. ~(scs_J_v39 s l i)) +==> +dsv_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 (w l) (w i) t) = dsv_v39 s w`, +[ +REWRITE_TAC[dsv_v39] +THEN STRIP_TAC +THEN MATCH_MP_TAC(REAL_ARITH`a=b==> c+a=c+b`) +THEN MP_TAC(SET_RULE`is_ear_v39 s\/ ~(is_ear_v39 s)`) +THEN RESA_TAC +THEN MATCH_MP_TAC(REAL_ARITH`a=b==> #0.1*a= #0.1*b`); + +REWRITE_TAC[REAL_ARITH`&1 *a=a`] +THEN MATCH_MP_TAC SUM_EQ +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`(w:num->real^3) l= w x\/ ~(w l =w x)`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`l:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (4) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`l MOD k:num`;`x:num`]) +THEN REPLICATE_TAC (34-25) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`SUC x:num`;]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (SUC x)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]); + +MP_TAC(SET_RULE`(w:num->real^3) l= w (SUC x)\/ ~(w l =w (SUC x))`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN POP_ASSUM MP_TAC +THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC DIVISION[`l:num`;`scs_k_v39 s`] +THEN MRESA_TAC DIVISION[`SUC x:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (6) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`l MOD k:num`;`SUC x MOD k:num`]) +THEN REPLICATE_TAC (37-25) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`x:num`;]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (x)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> +MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]); + +ASM_REWRITE_TAC[v3_defor_v4;v3_defor_v5;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;VECTOR_ARITH`a-b+b=a:real^3`]; + +REWRITE_TAC[REAL_ARITH`-- &1 *a= -- &1 * b<=> a=b`] +THEN MATCH_MP_TAC SUM_EQ +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`(w:num->real^3) l= w x\/ ~(w l =w x)`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`l:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (4) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`l MOD k:num`;`x:num`]) +THEN REPLICATE_TAC (34-25) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`SUC x:num`;]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (SUC x)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]); + +MP_TAC(SET_RULE`(w:num->real^3) l= w (SUC x)\/ ~(w l =w (SUC x))`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN POP_ASSUM MP_TAC +THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC DIVISION[`l:num`;`scs_k_v39 s`] +THEN MRESA_TAC DIVISION[`SUC x:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (6) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`l MOD k:num`;`SUC x MOD k:num`]) +THEN REPLICATE_TAC (37-25) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`x:num`;]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (x)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> +MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]); + +ASM_REWRITE_TAC[v3_defor_v4;v3_defor_v5;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;VECTOR_ARITH`a-b+b=a:real^3`]]);; + + + + +let INTERIOR_ANGLE_SAME_V3_DEFOR1_MK=prove(`scs_k_v39 s = k /\ + 3 < k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + scs_k_v39 s - 1)) = pi /\ + ~collinear {vec 0, w (SUC l), w (l + scs_k_v39 s - 1)} /\ + w l IN aff_gt {vec 0} {w (SUC l), w (l + scs_k_v39 s - 1)} /\ + j MOD k = SUC l MOD k /\ + scs_a_v39 s j l = dist (w j,w l) /\ + dist (w j,w l) < scs_b_v39 s j l /\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ + (!i. ~scs_J_v39 s l i) /\ + w l = v2 /\ + w (l + k - 1) = v1 /\ + norm v1 pow 2 = x1 /\ + norm v2 pow 2 = x2 /\ + norm (v2 - v1) pow 2 = x5 /\ + a = -- &1 /\ + IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ + IMAGE w (:num) = V +/\(!t. &0 < t /\ t < e1 ==> BBs_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t))/\ +&0< e1 +==> +(?e. &0< e/\ (!t i. + &0< t /\ t< e +==> +interior_angle1 (vec 0) + (IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) + (ITER i + (rho_node1 + (IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF)) + (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (l MOD k)) t)) + = +interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) (w (l MOD k)))))`, +STRIP_TAC +THEN MP_TAC DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_AT_ALL_MK +THEN RESA_TAC +THEN ABBREV_TAC`e2=(min e e1)/ &2` +THEN MP_TAC(REAL_ARITH`e2=(min e e1)/ &2 /\ &0< e/\ &0 &0 ~(k=0)/\ ~(k=1)/\ 0real^3) (:num)`;`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`;`w:num->real^3`;`l MOD k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;] +THEN REPLICATE_TAC (45-29)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC(REAL_ARITH`t treal^3) i) t) (:num)`;`IMAGE (\i. { v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t, v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) (SUC i)) t}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t, v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) (SUC i)) t) (:num)`;`(\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t) (l MOD k)`;`(\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t)`;`l MOD k`] +[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[v3_defor_v5; F_DEFORMATION_V3_DEFOR_V5] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM v3_defor_v5] +THEN MATCH_DICH_TAC (47-31) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`t t &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ + (!i. ~scs_J_v39 s l i) /\ + w l = v2 /\ + w (l + k - 1) = v1 /\ + norm v1 pow 2 = x1 /\ + norm v2 pow 2 = x2 /\ + norm (v2 - v1) pow 2 = x5 /\ + a = -- &1 +/\(!t. &0 < t /\ t < e1 ==> BBs_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t))/\ +&0< e1 + ==> +(?e. &0 < e /\ + (!t. &0 < t /\ t < e + ==> taustar_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t)= taustar_v39 s w +))`;; + + + + + +let TAUSTAR_V3_DEFOR_MK=prove_by_refinement(( TAUSTAR_V3_DEFOR_MK_concl), +[ +REPEAT STRIP_TAC; + +REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (41-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +ASM_REWRITE_TAC[taustar_v39;LET_DEF;LET_END_DEF;tau_fun] +THEN STRIP_TAC +THEN MP_TAC INTERIOR_ANGLE_SAME_V3_DEFOR1_MK +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR_TWO_CASES)[`s:scs_v39`;`w:num->real^3`;`l:num`;`k:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN MRESAL_TAC(GEN_ALL UPS_X_POS_SEG)[`-- v1:real^3`;`v2-v1:real^3`;`x1:real`;`x2:real`;`x5:real`][COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] +THEN ABBREV_TAC`e2=(min (min e1 e)e')/ &2` +THEN MP_TAC(REAL_ARITH`e2=(min (min e1 e)e' )/ &2/\ &0< e1/\ &0< e /\ &0< e' +==> &0< e2/\ e2< e1/\ e2 t< e1/\ tMRESA1_TAC th`t:real`) +THEN MP_TAC DSV_V3_DEFOR_EQ_MK +THEN RESA_TAC +THEN MATCH_MP_TAC(REAL_ARITH`a=b==> a-c= b-c`) +THEN MATCH_MP_TAC(REAL_ARITH`a=b==> a-c= b-c`) +THEN MRESA_TAC(GEN_ALL Qknvmlb.SUM_AZIM_EQ_ANGLE_LE4)[`V:real^3->bool`;`w:num->real^3`;`l:num`;`s:scs_v39`;`(w:num->real^3) (l MOD scs_k_v39 s)`;`FF:real^3#real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]); + +THAYTHE_TAC (60-18)[`t:real`] +THEN MRESA_TAC(GEN_ALL Qknvmlb.SUM_AZIM_EQ_ANGLE_LE4)[`IMAGE (\i. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 ((w:num->real^3) i) t) (:num)`;` (\i. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 ((w:num->real^3) i) t)`;`l:num`;`s:scs_v39`;` (\i. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 ((w:num->real^3) i) t) (l MOD scs_k_v39 s)`;`IMAGE (\i. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 ((w:num->real^3) i) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (SUC i)) t) (:num)`;`IMAGE (\i. { v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w i) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 ((w:num->real^3) (SUC i)) t}) (:num)`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]); + +MATCH_MP_TAC SUM_EQ +THEN REWRITE_TAC[IN_ELIM_THM;F_DEFORMATION_V3_DEFOR_V5] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`t --e A\/ B`) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39;convex_local_fan] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MATCH_MP_TAC(SET_RULE`x=y==> rho_fun x= rho_fun y`) +THEN REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=>a=c:real^3`] +THEN MP_TAC(SET_RULE`(w:num->real^3) (x + l MOD k) = v2 \/ ~(w (x + l MOD k) = v2)`) +THEN RESA_TAC; + +ASM_REWRITE_TAC[NORM_EQ_SQUARE;NORM_POS_LE;DOT_SQUARE_NORM] +THEN MP_TAC(REAL_ARITH`&0< t/\ t< e'==> --e' x MOD (scs_k_v39 s)= y MOD (scs_k_v39 s)`, +REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`scs_k_v39 s`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN ABBREV_TAC `k= scs_k_v39 s` +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`x:num`;`k:num`] +THEN MRESA_TAC DIVISION[`y:num`;`k:num`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESA_TAC th[`y:num`]) +THEN THAYTHE_TAC (33-25)[`x MOD k`;`y MOD k`]);; + + +let MIN_LEAST=prove(`!X c. c IN X ==> (min_num X) IN X /\ min_num X <= c`, +REWRITE_TAC[IN;Misc_defs_and_lemmas.min_least]);; + + + + +(***************************) + +(**********TWO CASES********) + +(***************************) + + +let DEFORMATION_DIST_LE_MK_A_TWO_CASES=prove(`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3 scs_a_v39 s l i < dist (v2,w i)) +==> (!i. ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k) ==> ?e. &0< e/\ +(!t. --e < t/\ t< e ==> scs_a_v39 s l i < dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i)))`, +STRIP_TAC +THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR)[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC EXISTS_SMALL_LE_CONST_ADD +THEN ASM_REWRITE_TAC[] +THEN THAYTHE_TAC (16-10) [`i:num`]);; + + + + +let DEFORMATION_DIST_LE_V3_DEFOR_A_COM_MK_TWO_CASES=prove_by_refinement( +`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3 scs_a_v39 s l i < dist (v2,w i)) +==> ?e. &0< e/\ +(!t i. --e< t/\ t< e /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k) ==> scs_a_v39 s l i < dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i))`, +[REPEAT STRIP_TAC +THEN MP_TAC DEFORMATION_DIST_LE_MK_A_TWO_CASES +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] +THEN REWRITE_TAC[SKOLEM_THM] +THEN STRIP_TAC +THEN ABBREV_TAC`e1= inf {(e:num->real) i| i < k /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}` +THEN EXISTS_TAC`e1:real` +THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}`ASSUME_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` +THEN STRIP_TAC; + +MATCH_MP_TAC FINITE_IMAGE +THEN REWRITE_TAC[FINITE_NUMSEG]; + +REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_ELIM_THM] +THEN GEN_TAC +THEN RESA_TAC +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[IN_NUMSEG] +THEN REPLICATE_TAC (16-12)(POP_ASSUM MP_TAC) +THEN ARITH_TAC; + +SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)} = {})`ASSUME_TAC; + +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] +THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(l MOD k =0)`) +THEN RESA_TAC; + +EXISTS_TAC`(e:num->real)1` +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real)2` +THEN EXISTS_TAC`2` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real)0` +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}`;`&0`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN THAYTHE_TAC (20-11)[`i:num`]; + +REPEAT STRIP_TAC +THEN MRESAL_TAC REAL_LE_INF_FINITE[`{(e:num->real) i| i < k/\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}`;`e1:real`][REAL_ARITH`a<=a`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(l MOD k = i MOD k) /\ ~(l MOD k = SUC i MOD k)}`ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`i MOD k` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1 MRESA1_TAC th`(e:num->real) (i MOD k)`) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1 MRESA1_TAC th`t:real`) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`t < e1/\ e1<= e (i MOD k)/\ &0 < e (i MOD k)/\ --e1 t < e (i MOD k)/\ -- e (i MOD k)< t`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`])]);; + + + + +let DEFORMATION_DIST_LE_V3_DEFOR_B_MK_TWO_CASES=prove_by_refinement(` scs_k_v39 s =k/\ + 3 &4 * h0 < scs_b_v39 s l i) +==> (!i. scs_diag k l i ==> ?e. &0< e/\ +(!t. --e< t/\ t< e ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i)real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC EXISTS_SMALL_LT_CONST_ADD +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k<=3)`) +THEN RESA_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`v2 IN IMAGE (w:num->real^3) (:num)`ASSUME_TAC; + + REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +SUBGOAL_THEN`w i IN IMAGE (w:num->real^3) (:num)`ASSUME_TAC; + + REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +MP_TAC(SET_RULE`v2 IN IMAGE w (:num)/\ w i IN IMAGE w (:num)/\ IMAGE w (:num) SUBSET ball_annulus ==> v2 IN ball_annulus/\ w i IN ball_annulus`) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[IN_ELIM_THM;DIFF;ball_annulus;cball;] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC DIST_TRIANGLE[`v2:real^3`;`vec 0:real^3`;`(w:num->real^3) i`] +THEN MP_TAC(REAL_ARITH`dist (v2,vec 0) <= &2 * h0/\ dist (vec 0,w i) <= &2 * h0/\ dist (v2,w i) <= dist (v2,vec 0) + dist (vec 0,w i) +==> dist (v2,(w:num->real^3) i)<= &4 *h0`) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REPLICATE_TAC (53-41)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`i:num`]) +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC]);; + + + + + +let DEFORMATION_DIST_LE_V3_DEFOR_A_COM_MK1_TWO_CASES=prove(`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3 ?e. &0< e/\ +(!t. &0 < t/\ t< e ==> scs_a_v39 s l j < dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w j))`, +STRIP_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR)[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MATCH_MP_TAC V3_DEFOR_INCREASING_IN_ANGLE +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MMS_IMP_BBS +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL EQ_SUC_K_SUB3)[`l:num`;`j:num`;`k:num`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`j:num`;`w:num->real^3`;`l+k-1:num`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[]);; + + + + + + + +let DEFORMATION_DIST_LE_V3_DEFOR_AA_COM_MK_TWO_CASES=prove(`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3 scs_a_v39 s l i < dist (v2,w i)) +==> ?e. &0< e/\ +(!t i. &0< t/\ t< e /\ ~(l MOD k = i MOD k) ==> scs_a_v39 s l i < dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i))`, +STRIP_TAC +THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_COM_MK_TWO_CASES +THEN RESA_TAC +THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_COM_MK1_TWO_CASES +THEN RESA_TAC +THEN ABBREV_TAC`e1= (min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1= (min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1 t< e'`) +THEN RESA_TAC +THEN MP_TAC MMS_IMP_BBS +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`j:num`;`i:num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`j:num`;`w:num->real^3`;`i:num`] +THEN THAYTHE_TAC (31-18) [`t:real`] +THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`l:num`;`j:num`;`s:scs_v39`;`l:num`;`i:num`] +THEN SYM_ASSUM_TAC +THEN ASM_REWRITE_TAC[]; + +MP_TAC(REAL_ARITH`t t< e/\ --e< t`) +THEN RESA_TAC +THEN THAYTHE_TAC (28-16) [`t:real`;`i:num`]]);; + + + + + +let DEFORMATION_DIST_LE_V3_DEFOR_EDGE_SUB_TWO_CASES=prove(` 3 (!j. (SUC l MOD k = j MOD k) +==> ?e. &0< e/\ +(!t. &0 < t/\ t< e ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w j)real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM]THEN MRESA_TAC (GEN_ALL EYYPQDW_V3_DEFOR_INCREASING_IN_ANGLE) +[`(w:num->real^3)(l+k-1)`;`a:real`;`x1:real`;`x2:real`;`x5:real`;`v2:real^3`;`v1:real^3`] +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN THAYTHE_TAC (20-18)[`t:real`] +THEN MP_TAC MMS_IMP_BBS +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`j:num`;`w:num->real^3`;`SUC l:num`] +THEN MRESA_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`l:num`;`j:num`;`s:scs_v39`;`l:num`;`SUC l:num`] +THEN ASM_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0 ?e. &0< e/\ +(!t. --e< t/\ t< e ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w j)real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REPEAT STRIP_TAC);; + + + + +let DEFORMATION_DIST_LE_V3_DEFOR_B_COM_MK1_TWO_CASES=prove( +` 3 &4 * h0 < scs_b_v39 s l i) +==> (!i. ~(l MOD k = i MOD k)==> ?e. &0< e/\ +(!t. &0< t/\ t< e ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i) --e< t`) +THEN RESA_TAC +THEN THAYTHE_TAC (23-16)[`t:real`] +THEN MP_TAC MMS_IMP_BBS +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`j:num`;`i:num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`i:num`;`w:num->real^3`;`j:num`] +THEN MRESA_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`l:num`;`i:num`;`s:scs_v39`;`l:num`;`j:num`]; + + +MP_TAC(SET_RULE`(SUC l MOD k = i MOD k)\/ ~(SUC l MOD k = i MOD k)`) +THEN RESA_TAC +THENL[ + +THAYTHE_TAC (21-17)[`i:num`] +THEN EXISTS_TAC`(e':num->real) i` +THEN ASM_REWRITE_TAC[]; + +THAYTHEL_TAC (21-18)[`i:num`] [scs_diag] +THEN EXISTS_TAC`(e'':num->real) i` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MATCH_DICH_TAC 2 +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]]);; + + + +let DEFORMATION_DIST_LE_V3_DEFOR_B_COM_MK_TWO_CASES=prove_by_refinement(` 3 &4 * h0 < scs_b_v39 s l i) +==> ?e. &0< e/\ +(!t i. &0< t/\ t< e /\ ~(l MOD k = i MOD k) ==> dist(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1,w i)real) i| i < k/\ ~(i= l MOD k)}` +THEN EXISTS_TAC`e1:real` +THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` +THEN STRIP_TAC; + + +MATCH_MP_TAC FINITE_IMAGE +THEN REWRITE_TAC[FINITE_NUMSEG]; + + +REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`i:num` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + + +SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(i = l MOD k)} = {})`ASSUME_TAC; + + +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] +THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(0=l MOD k )`) +THEN RESA_TAC; + + + +EXISTS_TAC`(e:num->real)1` +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 1real)0` +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real) i| i < k/\ ~(i= l MOD k)}`;`&0`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN REPLICATE_TAC (13-5) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`]); + + +REPEAT STRIP_TAC +THEN MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(i= l MOD k)}`;`t:real`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`i MOD k` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`]; + + +STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_REFL[`i:num`;`k:num`] +THEN REPLICATE_TAC (15-5) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num MOD k`]) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]); +]);; + + + +let DEFORMATION_V3_DEFOR_NOT_IN_V_MK_TWO_CASES=prove( +` 3 (!i. ~(i MOD k= l MOD k) ==> (?e. &0< e /\ (!t. --e &0real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC EXISTS_SMALL_LE_CONST_ADD +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(REAL_ARITH`&0<= a/\ ~(a= &0)==> &0 < a`) +THEN ASM_REWRITE_TAC[dist;NORM_POS_LE] +THEN MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0 +MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN MRESA_TAC th[`i MOD k`;`l MOD k`]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESA_TAC th[`l:num`]) +THEN STRIP_TAC +THEN MRESA_TAC(Planarity.IMP_NORM_FAN)[`v2:real^3`;`(w:num->real^3) i`;]);; + + + + +let DEFORMATION_V3_DEFOR_NOT_IN_V_COM_MK_TWO_CASES=prove_by_refinement( +` 3 ?e. &0< e /\ (!t i. --e &0real) i| i < k/\ ~(i= l MOD k)}` +THEN EXISTS_TAC`e1:real` +THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` +THEN STRIP_TAC; + +MATCH_MP_TAC FINITE_IMAGE +THEN REWRITE_TAC[FINITE_NUMSEG]; + +REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`i:num` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(i = l MOD k)} = {})`ASSUME_TAC; + +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] +THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(0=l MOD k )`) +THEN RESA_TAC; + +EXISTS_TAC`(e:num->real)1` +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 1real)0` +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real) i| i < k/\ ~(i= l MOD k)}`;`&0`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN REPLICATE_TAC (13-5) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`]); + +REPEAT STRIP_TAC +THEN MRESAL_TAC REAL_LE_INF_FINITE[`{(e:num->real) i| i < k/\ ~(i= l MOD k)}`;`e1:real`][REAL_ARITH`a<=a`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`i MOD k` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`]; + +STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_REFL[`i:num`;`k:num`] +THEN MP_TAC(REAL_ARITH`-- e1 -- e(i MOD k)< t/\ t< e(i MOD k)`) +THEN RESA_TAC +THEN REPLICATE_TAC (12) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num MOD k`]) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]);]);; + + + + + + + + + +let DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_MK_TWO_CASES=prove(` 3 ?e. &0< e /\ (!t i. -- e ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i))`, +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_MK_TWO_CASES +THEN RESA_TAC +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA_TAC th[`t:real`;`i:num`]) +THEN POP_ASSUM (fun th-> STRIP_TAC +THEN MP_TAC th +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[DIST_REFL]) +THEN REAL_ARITH_TAC);; + + + +let V3_DEFOR_EQ_IN_FF_MK_TWO_CASES=prove_by_refinement(` 3 ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> (!a. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t,a IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF + <=> v2,a IN FF)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;v3_defor_v5;v3_defor_v4] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;VECTOR_ARITH`a-b+b=a:real^3`]); + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`] +THEN REPEAT RESA_TAC +THEN DICH_TAC 3 +THEN EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESA_TAC th[`l:num`]) +THEN DICH_TAC (69-62) +THEN RESA_TAC +THEN REPLICATE_TAC 3 (POP_ASSUM MP_TAC) +THEN MP_TAC(SET_RULE`x' MOD k= l MOD k\/ ~(x' MOD k= l MOD k)`) +THEN RESA_TAC; + +REPEAT RESA_TAC; + +REPEAT RESA_TAC +THEN THAYTHE_TAC (70-34)[`t:real`;`x':num`] +THEN DICH_TAC (70-61) +THEN RESA_TAC +THEN DICH_TAC 1 +THEN ASM_REWRITE_TAC[]; + +EXISTS_TAC`v2:real^3,a':real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,a'):real^3#real^3`] +THEN VECTOR_ARITH_TAC]);; + + + + +let V3_DEFOR_EQ_IN_FF_MK_SYM_TWO_CASES=prove_by_refinement( +` 3 ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> (!a. a, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF + <=> a, v2 IN FF)`, +[ STRIP_TAC +THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;v3_defor_v5;v3_defor_v4] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;VECTOR_ARITH`a-b+b=a:real^3`]); + +POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`] +THEN REPEAT RESA_TAC +THEN DICH_TAC 3 +THEN EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC x':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESA_TAC th[`l:num`]) +THEN DICH_TAC (69-62) +THEN RESA_TAC +THEN REPLICATE_TAC 3 (POP_ASSUM MP_TAC) +THEN MP_TAC(SET_RULE`SUC x' MOD k= l MOD k\/ ~(SUC x' MOD k= l MOD k)`) +THEN RESA_TAC; + +REPEAT RESA_TAC; + +REPEAT RESA_TAC +THEN THAYTHE_TAC (70-34)[`t:real`;`SUC x':num`]; + +EXISTS_TAC`a':real^3,v2:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(a',v2):real^3#real^3`] +THEN VECTOR_ARITH_TAC]);; + + + + + +let DEFORMATION_AZIM_V3_DEFOR_V1_MK_TWO_CASES=prove_by_refinement( +`scs_k_v39 s = k /\ + 3 < k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + scs_k_v39 s - 1)) = pi /\ + ~collinear {vec 0, w (SUC l), w (l + scs_k_v39 s - 1)} /\ + w l IN aff_gt {vec 0} {w (SUC l), w (l + scs_k_v39 s - 1)} /\ + SUC j MOD k = l MOD k /\ + scs_a_v39 s j l = dist (w j,w l) /\ + dist (w j,w l) < scs_b_v39 s j l /\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ + (!i. ~scs_J_v39 s l i) /\ + w l = v2 /\ + w (SUC l) = v1 /\ + norm v1 pow 2 = x1 /\ + norm v2 pow 2 = x2 /\ + norm (v2 - v1) pow 2 = x5 /\ + a = -- &1 /\ + IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ + IMAGE w (:num) = V + ==> (?e. &0 < e /\ + (!t. + --e < t /\ t < e + ==> azim (vec 0) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) + (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t)) + (@a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) = + azim (vec 0) v2 (rho_node1 FF v2) (@a. a,v2 IN FF)))`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_MK_TWO_CASES +THEN RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN DICH_TAC (22-5) +THEN RESA_TAC +THEN DICH_TAC (22-5) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR)[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1_MK)[`a:real`;`v2:real^3`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`(w:num->real^3) (l+k-1)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ABBREV_TAC`e1=(min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1< e/\ e1 t< e/\ --e ~(k=0)/\ ~(k=1)/\ 0real^3`] +THEN MP_TAC WL_IN_FF +THEN RESA_TAC; + +ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (50-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic;BBprime_v39;] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[GSYM rho_node1;GSYM ivs_rho_node1] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(SUC l)`] +THEN MRESA_TAC(GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`] +THEN DICH_TAC (55-4) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t t< e'/\ --e'real^3) (SUC l)`;`(w:num->real^3)(l+k-1)`] +THEN STRIP_TAC; + +MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan +THEN EXISTS_TAC`(w:num->real^3) (SUC l)` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[]; + +ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan +THEN EXISTS_TAC`(w:num->real^3)(l+k-1)` +THEN ASM_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[];]);; + + + + + + +let V3_DEFOR_EQ_IN_FF_SUB_MK_TWO_CASES=prove_by_refinement( +` 3 ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> (@a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v1 t IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) + = v3_defor_v1 (-- &1) (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1`, +[ +STRIP_TAC +THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;v3_defor_v5;v3_defor_v4] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] +THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA +THEN STRIP_TAC; + +EXISTS_TAC`v3_defor_v1 (-- &1) (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1` +THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`v2:real^3,v1:real^3` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`]; + +GEN_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +DICH_TAC (45-43) +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,v1):real^3#real^3`][VECTOR_ARITH`a-a+a=a:real^3`] +THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ +THEN RESA_TAC +THEN THAYTHE_TAC 0[`l:num`] +THEN THAYTHE_TAC(48-15)[`t:real`;`SUC l`]; + +DICH_TAC 2 +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`] +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,v1):real^3#real^3`][VECTOR_ARITH`a-a+a=a:real^3`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`a',v1 IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v1:real^3`;`v2:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(SUC l)`;`a':real^3`;]]);; + + + + +let V3_DEFOR_EQ_IN_FF_SUB_MK_SYM_TWO_CASES=prove_by_refinement( +` 3 ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> (!a. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v1 t,a IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF + <=> v1,a IN FF)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;v3_defor_v5;v3_defor_v4] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT +THEN RESA_TAC +THEN DICH_TAC 3 +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,v1):real^3#real^3`][VECTOR_ARITH`a-a+a=a:real^3`] +THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ +THEN RESA_TAC +THEN THAYTHE_TAC 0[`l:num`] +THEN THAYTHE_TAC(48-15)[`t:real`;`SUC l`]; + +MP_TAC(SET_RULE`v2=SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +DICH_TAC 3 +THEN ASM_REWRITE_TAC[] +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,v1):real^3#real^3`][VECTOR_ARITH`a-a+a=a:real^3`] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`v1,v2 IN FF:real^3#real^3->bool`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`SND (x:real^3#real^3)`;`v1:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v1:real^3`;`v2:real^3`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3)(SUC l),v2:real^3`;`V:real^3->bool`;] +THEN MP_TAC Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`SND(x:real^3#real^3)`]); + +DICH_TAC 2 +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[] +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,v1):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] +THEN REPEAT RESA_TAC; + +EXISTS_TAC`v1:real^3,a':real^3` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`a'=v2\/ ~(a'=v2:real^3)`) +THEN RESA_TAC; + +STRIP_TAC +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`]; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v1:real^3`;`v2:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v1:real^3`;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3)(SUC l),v2:real^3`;`V:real^3->bool`;] +THEN MP_TAC Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v1:real^3`]); + +REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`]]);; + + + + +let DEFORMATION_AZIM_V3_DEFOR_SUB_MK_TWO_CASES=prove_by_refinement( +`scs_k_v39 s = k /\ + 3 < k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + scs_k_v39 s - 1)) = pi /\ + ~collinear {vec 0, w (SUC l), w (l + scs_k_v39 s - 1)} /\ + w l IN aff_gt {vec 0} {w (SUC l), w (l + scs_k_v39 s - 1)} /\ + SUC j MOD k = l MOD k /\ + scs_a_v39 s j l = dist (w j,w l) /\ + dist (w j,w l) < scs_b_v39 s j l /\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ + (!i. ~scs_J_v39 s l i) /\ + w l = v2 /\ + w (SUC l) = v1 /\ + norm v1 pow 2 = x1 /\ + norm v2 pow 2 = x2 /\ + norm (v2 - v1) pow 2 = x5 /\ + a = -- &1 /\ + IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ + IMAGE w (:num) = V + ==> (?e. &0 < e /\ + (!t. + --e < t /\ t < e + ==> azim (vec 0) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v1 t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) + (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v1 t)) + (@a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v1 t IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) = + azim (vec 0) v1 (rho_node1 FF v1) (@a. a,v1 IN FF)))`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_MK_TWO_CASES +THEN RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN DICH_TAC (22-5) +THEN RESA_TAC +THEN DICH_TAC (22-5) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR)[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1_MK)[`a:real`;`v2:real^3`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`(w:num->real^3) (l+k-1)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ABBREV_TAC`e1=(min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1< e/\ e1 t< e/\ --e ~(k=0)/\ ~(k=1)/\ 0real^3`] +THEN MP_TAC WL_IN_FF +THEN RESA_TAC; + +ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + + +REPLICATE_TAC (50-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic;BBprime_v39;] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,v1):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] +THEN ASM_REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;VECTOR_ARITH`a-b+b=a:real^3`] +THEN REWRITE_TAC[GSYM rho_node1;GSYM ivs_rho_node1] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(SUC l)`] +THEN MRESA_TAC(GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`] +THEN MP_TAC(REAL_ARITH`t t< e'/\ --e' v2 IN aff_ge {vec 0} {v1:real^3, w (l+k-1 )}`) +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT[`vec 0:real^3`;`(w:num->real^3)(SUC l)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`;`(rho_node1 FF (w(SUC l)))`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{C,A,B}={C,B,A}`] +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v1:real^3`;`v2:real^3`] +THEN MATCH_MP_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[]; + +ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN MATCH_MP_TAC(GEN_ALL (SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff_gt{vec 0:real^3} {w(l+k-1),v1}` +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]; + +ONCE_REWRITE_TAC[SET_RULE`{C,A,B}={C,B,A}`] +THEN ASM_REWRITE_TAC[]; + +MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan +THEN EXISTS_TAC`(w:num->real^3)(l+k-1)` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[]]);; + + + + + +let V3_DEFOR_EQ_IN_FF_SUC_MK_TWO_CASES=prove_by_refinement(` 3 ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> (!a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (l+k-1)) t IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF +<=> a, w(l+k-1) IN FF)`, +[ +STRIP_TAC +THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;v3_defor_v5;v3_defor_v4] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`v2=SND(x:real^3#real^3)\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT +THEN RESA_TAC +THEN DICH_TAC 2 +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[] +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1:num`;`w:num->real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w(l+k-1),v2):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] +THEN STRIP_TAC +THEN MP_TAC Imjxphr.MOD_ADD_SUB_1 +THEN RESA_TAC +THEN THAYTHE_TAC (48-15)[`t:real`;`l+k-1`]; + + +MP_TAC(SET_RULE`v2=FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +DICH_TAC 2 +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[] +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1:num`;`w:num->real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w(l+k-1),v2):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`v2,w(l+k-1) IN FF:real^3#real^3->bool`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v1:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`w(l+k-1):real^3`;] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`w(l+k-1):real^3`;`FST(x:real^3#real^3)`] +THEN DICH_TAC 2 +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v2:real^3,(w:num->real^3)(l+k-1)`;`V:real^3->bool`;] +THEN MP_TAC Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(w:num->real^3)(l+k-1)`]); + +DICH_TAC 2 +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[] +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1:num`;`w:num->real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w(l+k-1),v2):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] +THEN REPEAT RESA_TAC; + + +EXISTS_TAC`a':real^3,w(l+k-1):real^3` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`a'=v2\/ ~(a'=v2:real^3)`) +THEN RESA_TAC; + +STRIP_TAC +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1:num`;`w:num->real^3`]; + +MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v1:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`w(l+k-1):real^3`;] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`w(l+k-1):real^3`;`v2:real^3`] +THEN DICH_TAC 2 +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v2:real^3,(w:num->real^3)(l+k-1)`;`V:real^3->bool`;] +THEN MP_TAC Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(w:num->real^3)(l+k-1)`]); + + +REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`]]);; + + + + +let V3_DEFOR_EQ_IN_FF_SUC_MK_SYM_TWO_CASES=prove_by_refinement( +` 3 ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +==> (@a. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (l+k-1)) t,a IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF +) = v3_defor_v1 (-- &1) (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1`, +[ +STRIP_TAC +THEN REPLICATE_TAC (19-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;v3_defor_v5;v3_defor_v4] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] +THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA +THEN STRIP_TAC; + +EXISTS_TAC`v3_defor_v1 (-- &1) (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1` +THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`(w:num->real^3) (l+k-1),v2:real^3` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1:num`;`w:num->real^3`]; + +GEN_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`SND (x:real^3#real^3)=v2\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +MP_TAC(SET_RULE`FST (x:real^3#real^3)=v2\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +DICH_TAC (45-42) +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1:num`;`w:num->real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w(l+k-1),v2):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] +THEN MP_TAC Imjxphr.MOD_ADD_SUB_1 +THEN RESA_TAC +THEN THAYTHE_TAC (48-15)[`t:real`;`l+k-1`]; + +DICH_TAC 2 +THEN DICH_TAC 2 +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1:num`;`w:num->real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w(l+k-1),v2):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`w(l+k-1),a' IN (FF:real^3#real^3->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`a':real^3`;]]);; + + + + +let DEFORMATION_AZIM_V3_DEFOR_SUC_MK_TWO_CASES=prove_by_refinement( +`scs_k_v39 s = k /\ + 3 < k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + scs_k_v39 s - 1)) = pi /\ + ~collinear {vec 0, w (SUC l), w (l + scs_k_v39 s - 1)} /\ + w l IN aff_gt {vec 0} {w (SUC l), w (l + scs_k_v39 s - 1)} /\ + SUC j MOD k = l MOD k /\ + scs_a_v39 s j l = dist (w j,w l) /\ + dist (w j,w l) < scs_b_v39 s j l /\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ + (!i. ~scs_J_v39 s l i) /\ + w l = v2 /\ + w (SUC l) = v1 /\ + norm v1 pow 2 = x1 /\ + norm v2 pow 2 = x2 /\ + norm (v2 - v1) pow 2 = x5 /\ + a = -- &1 /\ + IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ + IMAGE w (:num) = V + ==> (?e. &0 < e /\ + (!t. + --e < t /\ t < e + ==> azim (vec 0) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (l+k-1)) t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) + (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (l+k-1)) t)) + (@a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (l+k-1)) t IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) = + azim (vec 0) (w (l+k-1)) (rho_node1 FF (w (l+k-1))) (@a. a,w (l+k-1) IN FF)))`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_MK_TWO_CASES +THEN RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN DICH_TAC (22-5) +THEN RESA_TAC +THEN DICH_TAC (22-5) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR)[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1_MK)[`a:real`;`v2:real^3`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`(w:num->real^3) (l+k-1)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ABBREV_TAC`e1=(min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1< e/\ e1 t< e/\ --e ~(k=0)/\ ~(k=1)/\ 0real^3`] +THEN MP_TAC WL_IN_FF +THEN RESA_TAC; + +ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (50-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic;BBprime_v39;] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w(l+k-1),v2):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] +THEN ASM_REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;VECTOR_ARITH`a-b+b=a:real^3`] +THEN REWRITE_TAC[GSYM rho_node1;GSYM ivs_rho_node1] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(SUC l)`] +THEN MRESA_TAC(GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`] +THEN MP_TAC(REAL_ARITH`t t< e'/\ --e' v2 IN aff_ge {vec 0} {v1:real^3, w (l+k-1 )}`) +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w(l+k-1),v2):real^3#real^3`] +THEN MRESA_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT[`vec 0:real^3`;`(w:num->real^3)(l+k-1)`;`v2:real^3`;`(w:num->real^3)(SUC l)`;`(ivs_rho_node1 FF (w(l+k-1)))`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{C,A,B}={C,B,A}`] +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(w:num->real^3)(l+k-1)`;`v2:real^3`] +THEN ONCE_REWRITE_TAC[Rogers.AZIM_EQ_SYM] +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC Polar_fan.AZIM_SAME_WITHIN_AFF_GE_ALT +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[]; + +MATCH_MP_TAC(GEN_ALL (SET_RULE`a IN A/\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff_gt{vec 0:real^3} {w(l+k-1),v1}` +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]; + +ONCE_REWRITE_TAC[SET_RULE`{C,A,B}={C,B,A}`] +THEN ASM_REWRITE_TAC[]; + +MATCH_MP_TAC Planarity.properties_of_collinear4_points_fan +THEN EXISTS_TAC`(w:num->real^3)(SUC l)` +THEN ASM_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]]);; + + + +let V3_DEFOR_EQ_IN_FF_NOT_MK_TWO_CASES=prove_by_refinement(` 3 ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +/\ ~(v= w(l+k-1))/\ ~(v=v2) /\ ~(v=v1) +/\ v IN V +==> (!a. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t,a IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF +<=> v,a IN FF)`, +[STRIP_TAC +THEN REPLICATE_TAC (23-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;v3_defor_v5;v3_defor_v4] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`v2=SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + +MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT +THEN RESA_TAC +THEN DICH_TAC 2 +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`v,v2 IN FF:real^3#real^3->bool`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] +THEN MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`(w:num->real^3) (l+k-1)`] +THEN DICH_TAC (52-19) +THEN RESA_TAC; + +MP_TAC(SET_RULE`v2=FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +DICH_TAC 2 +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] +THEN DICH_TAC(47-22) +THEN EXPAND_TAC "V" +THEN REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN STRIP_TAC +THEN THAYTHE_TAC (48-15)[`t:real`;`x':num`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`x' MOD k = l MOD k\/ ~(x' MOD k = l MOD k)`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`x':num`;`w:num->real^3`;`l:num`]; + +SET_TAC[]; + +DICH_TAC 2 +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] +THEN RESA_TAC; + +EXISTS_TAC`v:real^3,a':real^3` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`a'=v2\/ ~(a'=v2:real^3)`) +THEN RESA_TAC; + +STRIP_TAC +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] +THEN MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v2:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`(w:num->real^3) (l+k-1)`] +THEN DICH_TAC (52-19) +THEN RESA_TAC; + +REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`]]);; + + + + + + +let V3_DEFOR_EQ_IN_FF_NOT_MK_SYM_TWO_CASES=prove_by_refinement(` 3 ~(v3_defor_v1 a (--v1) (v2 - v1) x1 x5 x2 x2 (x5 - t) + v1=w i)) +/\ t real^3) i, w (SUC i))) (:num)=FF +/\ IMAGE (w:num->real^3) (:num)=V +/\ ~(v= w(l+k-1))/\ ~(v=v2)/\ ~(v=v1) +/\ v IN V +==> (!a. a, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF +<=> a,v IN FF)`, +[STRIP_TAC +THEN REPLICATE_TAC (23-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;v3_defor_v5;v3_defor_v4] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (37-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MP_TAC(SET_RULE`v2=FST (x:real^3#real^3)\/ ~(FST x = v2:real^3)`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v2:real^3,(w:num->real^3) (SUC l)`] +THEN DICH_TAC 3 +THEN DICH_TAC 3 +THEN MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`v2,v IN FF:real^3#real^3->bool`ASSUME_TAC; + +ASM_REWRITE_TAC[]; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(SUC l)`] +THEN DICH_TAC (54-21) +THEN RESA_TAC; + +MP_TAC(SET_RULE`v2=SND (x:real^3#real^3)\/ ~(SND x = v2:real^3)`) +THEN RESA_TAC; + + +DICH_TAC 2 +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] +THEN DICH_TAC(47-22) +THEN EXPAND_TAC "V" +THEN REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN STRIP_TAC +THEN THAYTHE_TAC (48-15)[`t:real`;`x':num`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`x' MOD k = l MOD k\/ ~(x' MOD k = l MOD k)`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`x':num`;`w:num->real^3`;`l:num`]; + +SET_TAC[]; + +DICH_TAC 2 +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] +THEN REPEAT RESA_TAC; + +EXISTS_TAC`a':real^3,v:real^3` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`b-a+a=b:real^3`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`a'=v2\/ ~(a'=v2:real^3)`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(SUC l)`]; + +REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`]]);; + + + + + +let DEFORMATION_AZIM_V3_DEFOR_NOT_MK_TWO_CASES=prove_by_refinement(`scs_k_v39 s = k /\ + 3 < k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + scs_k_v39 s - 1)) = pi /\ + ~collinear {vec 0, w (SUC l), w (l + scs_k_v39 s - 1)} /\ + w l IN aff_gt {vec 0} {w (SUC l), w (l + scs_k_v39 s - 1)} /\ + SUC j MOD k = l MOD k /\ + scs_a_v39 s j l = dist (w j,w l) /\ + dist (w j,w l) < scs_b_v39 s j l /\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ + (!i. ~scs_J_v39 s l i) /\ + w l = v2 /\ + w (SUC l) = v1 /\ + norm v1 pow 2 = x1 /\ + norm v2 pow 2 = x2 /\ + norm (v2 - v1) pow 2 = x5 /\ + a = -- &1 /\ + IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ + IMAGE w (:num) = V + ==> (?e. &0 < e /\ + (!t v. + --e < t /\ t < e /\ ~(v= w(l+k-1))/\ ~(v=v2)/\ ~(v=v1) +/\ v IN V + ==> azim (vec 0) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) + (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t)) + (@a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) = + azim (vec 0) (v) (rho_node1 FF (v)) (@a. a,v IN FF)))`, +[ +STRIP_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_MK_TWO_CASES +THEN RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN DICH_TAC (22-5) +THEN RESA_TAC +THEN DICH_TAC (22-5) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR)[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1_MK)[`a:real`;`v2:real^3`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`(w:num->real^3) (l+k-1)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ABBREV_TAC`e1=(min e e')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min e e')/ &2 /\ &0< e/\ &0< e' +==> &0< e1/\ e1< e/\ e1 t< e/\ --e ~(k=0)/\ ~(k=1)/\ 0real^3`] +THEN MP_TAC WL_IN_FF +THEN RESA_TAC; + +ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + + +REPLICATE_TAC (54-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;periodic;BBprime_v39;] +THEN REPEAT RESA_TAC); + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(w(l+k-1),v2):real^3#real^3`][VECTOR_ARITH`b-a+a=b:real^3`] +THEN ASM_REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;VECTOR_ARITH`a-b+b=a:real^3`]]);; + + + + + +let DEFORMATION_AZIM_V3_DEFOR_V1_AT_ALL_MK_TWO_CASES=prove_by_refinement(`scs_k_v39 s = k /\ + 3 < k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + scs_k_v39 s - 1)) = pi /\ + ~collinear {vec 0, w (SUC l), w (l + scs_k_v39 s - 1)} /\ + w l IN aff_gt {vec 0} {w (SUC l), w (l + scs_k_v39 s - 1)} /\ + SUC j MOD k = l MOD k /\ + scs_a_v39 s j l = dist (w j,w l) /\ + dist (w j,w l) < scs_b_v39 s j l /\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ + (!i. ~scs_J_v39 s l i) /\ + w l = v2 /\ + w (SUC l ) = v1 /\ + norm v1 pow 2 = x1 /\ + norm v2 pow 2 = x2 /\ + norm (v2 - v1) pow 2 = x5 /\ + a = -- &1 /\ + IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ + IMAGE w (:num) = V + ==> (?e. &0 < e /\ + (!t v. + --e < t /\ t < e /\ v IN V + ==> azim (vec 0) (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t) + (rho_node1 + (IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) + (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t)) + (@a. a,v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (v) t IN + IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) = + azim (vec 0) (v) (rho_node1 FF (v)) (@a. a,v IN FF)))`, +[STRIP_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_V1_MK_TWO_CASES +THEN RESA_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_SUC_MK_TWO_CASES +THEN RESA_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_SUB_MK_TWO_CASES +THEN RESA_TAC +THEN MP_TAC DEFORMATION_AZIM_V3_DEFOR_NOT_MK_TWO_CASES +THEN RESA_TAC +THEN ABBREV_TAC`e1=(min (min (min e e') e'')e''')/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min (min (min e e') e'')e''')/ &2/\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''==> &0< e1/\ e1 treal^3)(l+k-1))\/ ~(v=(w:num->real^3)(l+k-1))`) +THEN RESA_TAC; + +MATCH_DICH_TAC (46-24) +THEN ASM_REWRITE_TAC[]; + +MP_TAC(SET_RULE`(v=(w:num->real^3)(SUC l))\/ ~(v=(w:num->real^3)(SUC l))`) +THEN RESA_TAC; + +MATCH_DICH_TAC (47-26) +THEN ASM_REWRITE_TAC[]; + +MP_TAC(SET_RULE`(v=(w:num->real^3)(l))\/ ~(v=(w:num->real^3)( l))`) +THEN RESA_TAC; + +MATCH_DICH_TAC (48-22) +THEN ASM_REWRITE_TAC[]; + +MATCH_DICH_TAC (48-28) +THEN ASM_REWRITE_TAC[]]);; + + +let DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_AT_ALL_MK_TWO_CASES=prove( +`scs_k_v39 s = k /\ + 3 < k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + scs_k_v39 s - 1)) = pi /\ + ~collinear {vec 0, w (SUC l), w (l + scs_k_v39 s - 1)} /\ + w l IN aff_gt {vec 0} {w (SUC l), w (l + scs_k_v39 s - 1)} /\ + SUC j MOD k = l MOD k /\ + scs_a_v39 s j l = dist (w j,w l) /\ + dist (w j,w l) < scs_b_v39 s j l /\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ + (!i. ~scs_J_v39 s l i) /\ + w l = v2 /\ + w (SUC l) = v1 /\ + norm v1 pow 2 = x1 /\ + norm v2 pow 2 = x2 /\ + norm (v2 - v1) pow 2 = x5 /\ + a = -- &1 /\ + IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ + IMAGE w (:num) = V + ==> (?e. &0 < e /\ + (!t v. + --e < t /\ t < e /\ v IN V + ==> interior_angle1 (vec 0) + (IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) + (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v t) = + interior_angle1 (vec 0) FF v))`, +REWRITE_TAC[interior_angle1;DEFORMATION_AZIM_V3_DEFOR_V1_AT_ALL_MK_TWO_CASES]);; + + + + + + + + +let DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_LE_PI_AT_ALL_MK_TWO_CASES=prove(`scs_k_v39 s = k /\ + 3 < k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + scs_k_v39 s - 1)) = pi /\ + ~collinear {vec 0, w (SUC l), w (l + scs_k_v39 s - 1)} /\ + w l IN aff_gt {vec 0} {w (SUC l), w (l + scs_k_v39 s - 1)} /\ + SUC j MOD k = l MOD k /\ + scs_a_v39 s j l = dist (w j,w l) /\ + dist (w j,w l) < scs_b_v39 s j l /\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ + (!i. ~scs_J_v39 s l i) /\ + w l = v2 /\ + w (SUC l) = v1 /\ + norm v1 pow 2 = x1 /\ + norm v2 pow 2 = x2 /\ + norm (v2 - v1) pow 2 = x5 /\ + a = -- &1 /\ + IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ + IMAGE w (:num) = V + ==> (?e. &0 < e /\ + (!t v. + --e < t /\ t < e /\ v IN V /\ interior_angle1 (vec 0) FF v= pi + ==> interior_angle1 (vec 0) + (IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) + (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v t) <= pi + ))`, +STRIP_TAC +THEN MP_TAC DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_AT_ALL_MK_TWO_CASES +THEN RESA_TAC +THEN EXISTS_TAC`e:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC (26-22)[`t:real`;`v:real^3`] +THEN REAL_ARITH_TAC);; + + + + +let DEFORMATION_LUNAR_AFFINE_HULL_MK_TWO_CASES=prove_by_refinement(`scs_k_v39 s = k /\ + 3 < k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + scs_k_v39 s - 1)) = pi /\ + ~collinear {vec 0, w (SUC l), w (l + scs_k_v39 s - 1)} /\ + w l IN aff_gt {vec 0} {w (SUC l), w (l + scs_k_v39 s - 1)} /\ + SUC j MOD k = l MOD k /\ + scs_a_v39 s j l = dist (w j,w l) /\ + dist (w j,w l) < scs_b_v39 s j l /\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ + (!i. ~scs_J_v39 s l i) /\ + w l = v2 /\ + w (SUC l) = v1 /\ + norm v1 pow 2 = x1 /\ + norm v2 pow 2 = x2 /\ + norm (v2 - v1) pow 2 = x5 /\ + a = -- &1 /\ + IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ + IMAGE w (:num) = V /\ + ~(v=v2)/\ ~(w1=v2) +/\ IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)=E +/\ lunar (v,w1) V E +==> +?e. &0 v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t IN + affine hull {vec 0, v, w1, v2})`, +[STRIP_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC DEFORMATION_V3_DEFOR_NOT_IN_V_COM_EQ_MK_TWO_CASES +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR)[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN DICH_TAC (30-4) +THEN RESA_TAC +THEN DICH_TAC (30-4) +THEN RESA_TAC +THEN DICH_TAC (30-4) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL V3_DEFOR_IN_AFF_GT_V1_MK)[`a:real`;`v2:real^3`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`(w:num->real^3) (l+k-1)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REPLICATE_TAC (32-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;IN_REAL_INTERVAL] +THEN MP_TAC th +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0real^3`] +THEN MP_TAC WL_IN_FF +THEN RESA_TAC; + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v2:real^3`;`(w:num->real^3)(l+k-1)`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`(v2:real^3)`;`v1:real^3`;] +THEN MRESAL_TAC (GEN_ALL LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI) +[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`w1:real^3`;][DIFF;IN_ELIM_THM;SET_RULE`~(a IN {b,c}) <=> (~(a=b)/\ ~(a=c))`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v2:real^3`]) +THEN MRESA_TAC (GEN_ALL Collect_geom2.THREE_GEN_POINTS_IN_AFF3)[`v2:real^3`;`v:real^3`;`w1:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.CONV02_SUBSET_AFF2)[`v:real^3`;`w1:real^3`] +THEN MP_TAC(SET_RULE`v IN aff {v2, v, w1}/\ w1 IN aff {v2, v, w1} +==> {v, w1} SUBSET aff {v2, v, w1:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.S_SUBSET_IMP_AFF_S_TOO)[`{v, w1:real^3}`;` {v2, v, w1:real^3}`] +THEN MP_TAC(SET_RULE`v1 IN aff {v2, v, w1}/\ w (l+k-1) IN aff {v2, v, w1} +/\ vec 0 IN conv0 {v, w1} /\ conv0 {v, w1} SUBSET aff {v, w1} +/\ aff {v, w1} SUBSET aff {v2, v, w1} +==> {vec 0, v1, w (l+k-1)} SUBSET aff {v2, v, w1:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.S_SUBSET_IMP_AFF_S_TOO)[`{vec 0, v1, w ( l+k-1):real^3}`;` {v2, v, w1:real^3}`] +THEN MRESAL_TAC (GEN_ALL Local_lemmas.AFF_GT_SUB_AFF_UNION)[`{vec 0:real^3}`;`{ v1, w (l+k-1):real^3}`][SET_RULE`{A}UNION {B,C}={A,B,C}`] +THEN EXISTS_TAC`e':real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT RESA_TAC; + +THAYTHE_TAC (71-31)[`t:real`] +THEN REWRITE_TAC[GSYM aff] +THEN MRESAL_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA[`{v2, v, w1:real^3}`;`{vec 0,v, w1,v2:real^3}`][SET_RULE`{A,B,C} SUBSET {D,B,C,A}`;GSYM aff] +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff {v2, v, w1:real^3}` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff {vec 0, v1, w (l+k-1):real^3}` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(GEN_ALL(SET_RULE`a IN A /\ A SUBSET B==> a IN B`)) +THEN EXISTS_TAC`aff_gt {vec 0} {v1, w (l+k-1):real^3}` +THEN ASM_REWRITE_TAC[v3_defor_v4] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[v3_defor_v5;v3_defor_v4]]);; + + + + + + +let V3_DEFOR_CONVEX_LOCAL_FAN_MK_TWO_CASES_concl =`!s k w l j. + scs_k_v39 s=k /\ + 3 < k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ +~collinear {vec 0, w (SUC l), w (l + scs_k_v39 s - 1)} /\ + w l IN aff_gt {vec 0} {w (SUC l), w (l + scs_k_v39 s - 1)} /\ + (SUC j MOD k = l MOD k ) /\ + (scs_a_v39 s j l = dist(w j,w l)) /\ +(dist(w j,w l) &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist(w l,w i)) /\ + (!i. ~(scs_J_v39 s l i)) /\ + w l=v2/\ w (SUC l) =v1 +/\ norm v1 pow 2 = x1/\ norm v2 pow 2 =x2/\ norm(v2-v1) pow 2=x5/\ a= -- &1 +/\ norm v2 = &2 +/\ (!V E v. + V = IMAGE w (:num) /\ + E = IMAGE (\i. {w i, w (SUC i)}) (:num) ==> + ~(lunar (v,(w l)) V E )) ==> +(?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> +convex_local_fan + (IMAGE (\i. v3_defor_v4 a x1 x5 x2 (--v1) (v2 - v1) (w i - v1) t + v1) + (:num), + IMAGE + (\i. {v3_defor_v4 a x1 x5 x2 (--v1) (v2 - v1) (w i - v1) t + v1, v3_defor_v4 + a + x1 + x5 + x2 + (--v1) + (v2 - v1) + (w (SUC i) - + v1) + t + + v1}) + (:num), + IMAGE + (\i. v3_defor_v4 a x1 x5 x2 (--v1) (v2 - v1) (w i - v1) t + v1, + v3_defor_v4 a x1 x5 x2 (--v1) (v2 - v1) (w (SUC i) - v1) t + v1) + (:num))))`;; + +let V3_DEFOR_CONVEX_LOCAL_FAN_MK_TWO_CASES=prove_by_refinement( +(mk_imp(ZLZTHIC_concl, mk_imp (MHAEYJN_concl, V3_DEFOR_CONVEX_LOCAL_FAN_MK_TWO_CASES_concl))), +[ +REPEAT STRIP_TAC; + + +REPLICATE_TAC (22-5)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (40-21)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +MP_TAC WL_IN_V +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL WL_IN_V)[`l+k-1`;`w:num->real^3`] +THEN MRESA_TAC(GEN_ALL WL_IN_V)[`SUC l`;`w:num->real^3`] +THEN MP_TAC WL_IN_BALL_ANNULUS +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_BALL_ANNULUS)[`s:scs_v39`;`w:num->real^3`;`l+k-1`] +THEN MRESA_TAC (GEN_ALL WL_IN_BALL_ANNULUS)[`s:scs_v39`;`w:num->real^3`;`SUC l`] +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l:num`;`w:num->real^3`]; + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,v1):real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL NORM_POS_COLLINEAR)[`v2:real^3`;`v1:real^3`;`x2:real`;`x1:real`;`x5:real`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MP_TAC DEFORMATION_MK_DEFOR_IN_BALL_ANNULUS +THEN RESA_TAC; + +MRESA_TAC Deformation.XRECQNS[`-- &1`;`&1`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`ww_defor ((w:num->real^3) l)`] +THEN MP_TAC Wrgcvdr_cizmrrh.CIZMRRH +THEN RESA_TAC; + + +MP_TAC DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_LE_PI_AT_ALL_MK_TWO_CASES +THEN RESA_TAC +THEN MP_TAC V3_DEFOR_DEFORMATION_V5 +THEN RESA_TAC; + +ABBREV_TAC`e1= (min(min(min (min e (&1)) e') e'')e''')/ &2` +THEN MP_TAC(REAL_ARITH`e1= (min(min(min (min e (&1)) e') e'')e''')/ &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e''' ==> &0< e1/\ e1< &1/\ e1< e /\ e1< e' /\ e1< e'' /\ --e1< &0/\ e1<= e'''/\ --e'''<= --e1`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL DEFORMATION_SMALL_INTERVAL)[`-- e''':real`;`e''':real`;`v3_defor_v5 (-- &1) x1 x5 x2 v1 v2`;`V:real^3->bool`;`--e1:real`;`e1:real`] +THEN THAYTHE_TAC (76-0) [`-- e1`;`e1:real`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v3_defor_v5 (-- &1) x1 x5 x2 v1 v2`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`(!v t. + v IN V /\ + t IN real_interval (--e1,e1) /\ + interior_angle1 (vec 0) FF v = pi + ==> interior_angle1 (vec 0) + (IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) + (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v t) <= + pi)`ASSUME_TAC; + +ASM_REWRITE_TAC[IN_REAL_INTERVAL] +THEN REPEAT RESA_TAC +THEN MATCH_DICH_TAC (79-63) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''/\ --e1 t STRIP_TAC +THEN MRESA_TAC th[`t:real`]); + + +(*********LUNAR*******) + + +MRESAL_TAC JKQEWGV3[`s:scs_v39`;`w:num->real^3`;`v:real^3`;`w':real^3`][LET_DEF;LET_END_DEF;] +THEN MP_TAC(REAL_ARITH`interior_angle1 (vec 0) FF v < pi / &2/\ &0< pi +==> interior_angle1 (vec 0) FF v < pi`) +THEN ASM_REWRITE_TAC[PI_WORKS] +THEN RESA_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`~(v2=v:real^3)`ASSUME_TAC; + +POP_ASSUM(fun th-> MRESA_TAC th[`V:real^3->bool`;`E:(real^3->bool)->bool`;`w':real^3`]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT RESA_TAC) +THEN ASM_REWRITE_TAC[Local_lemmas.LUNAR_COMM]; + +SUBGOAL_THEN`~(v2=w':real^3)`ASSUME_TAC; + +REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT RESA_TAC); + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ABBREV_TAC`w1=w':real^3` +THEN MP_TAC DEFORMATION_LUNAR_AFFINE_HULL_MK_TWO_CASES +THEN RESA_TAC +THEN MP_TAC V3_DEFOR_DEFORMATION_V5 +THEN RESA_TAC; + +ABBREV_TAC`e1= (min(min(min (min e (&1)) e') e'') e''')/ &2` +THEN MP_TAC(REAL_ARITH`e1= (min(min(min (min e (&1)) e') e'') e''')/ &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e''' ==> &0< e1/\ e1< &1/\ e1< e /\ e1< e' /\ e1< e'' /\ e1<= e'''/\ -- e'''<= --e1/\ --e1< &0`) +THEN RESA_TAC +THEN SUBGOAL_THEN`(!u' t. + u' IN V /\ ~(v2 = u':real^3) /\ t IN real_interval (--e1,e1) + ==> v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 u' t = u')`ASSUME_TAC; + +REPEAT STRIP_TAC +THEN REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-c=b-c<=>a=b:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;]) +THEN VECTOR_ARITH_TAC; + +SUBGOAL_THEN`(!t. t IN real_interval (--e1,e1) + ==> v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 v2 t IN + affine hull {vec 0, v, w1, v2})`ASSUME_TAC; + +ASM_REWRITE_TAC[IN_REAL_INTERVAL] +THEN REPEAT RESA_TAC +THEN MATCH_DICH_TAC (83-69) +THEN ASM_REWRITE_TAC[IN_REAL_INTERVAL] +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''/\ --e1 tbool`;`--e1:real`;`e1:real`] +THEN REPLICATE_TAC (83-1) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th[`-- e1`;`e1:real`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v3_defor_v5 (-- &1) x1 x5 x2 v1 v2`;`v:real^3`;`w':real^3`;`v2:real^3`]) +THEN POP_ASSUM MP_TAC; + +RESA_TAC +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN EXISTS_TAC`e'''':real` +THEN ASM_REWRITE_TAC[V_DEFORMATION_V3_DEFOR_V5;E_DEFORMATION_V3_DEFOR_V5;F_DEFORMATION_V3_DEFOR_V5] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA_TAC th[`t:real`])]);; + + + + +let INTERIOR_ANGLE_SAME_V3_DEFOR1_MK_TWO_CASES=prove( +`scs_k_v39 s = k /\ + 3 < k /\ + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + scs_k_v39 s - 1)) = pi /\ + ~collinear {vec 0, w (SUC l), w (l + scs_k_v39 s - 1)} /\ + w l IN aff_gt {vec 0} {w (SUC l), w (l + scs_k_v39 s - 1)} /\ + SUC j MOD k = l MOD k /\ + scs_a_v39 s j l = dist (w j,w l) /\ + dist (w j,w l) < scs_b_v39 s j l /\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ + (!i. ~scs_J_v39 s l i) /\ + w l = v2 /\ + w (SUC l) = v1 /\ + norm v1 pow 2 = x1 /\ + norm v2 pow 2 = x2 /\ + norm (v2 - v1) pow 2 = x5 /\ + a = -- &1 /\ + IMAGE (\i. w i,w (SUC i)) (:num) = FF /\ + IMAGE w (:num) = V +/\(!t. &0 < t /\ t < e1 ==> BBs_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t))/\ +&0< e1 +==> +(?e. &0< e/\ (!t i. + &0< t /\ t< e +==> +interior_angle1 (vec 0) + (IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF) + (ITER i + (rho_node1 + (IMAGE + (\uv. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (FST uv) t, + v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (SND uv) t) + FF)) + (v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (l MOD k)) t)) + = +interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) (w (l MOD k)))))`, + +STRIP_TAC +THEN MP_TAC DEFORMATION_INTERIOR_ANGLE1_V3_DEFOR_V1_AT_ALL_MK_TWO_CASES +THEN RESA_TAC +THEN ABBREV_TAC`e2=(min e e1)/ &2` +THEN MP_TAC(REAL_ARITH`e2=(min e e1)/ &2 /\ &0< e/\ &0 &0 ~(k=0)/\ ~(k=1)/\ 0real^3) (:num)`;`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`;`w:num->real^3`;`l MOD k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;] +THEN REPLICATE_TAC (45-29)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC(REAL_ARITH`t treal^3) i) t) (:num)`;`IMAGE (\i. { v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t, v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) (SUC i)) t}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t, v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) (SUC i)) t) (:num)`;`(\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t) (l MOD k)`;`(\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) t)`;`l MOD k`] +[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[v3_defor_v5; F_DEFORMATION_V3_DEFOR_V5] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM v3_defor_v5] +THEN MATCH_DICH_TAC (47-31) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`t t &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist (w l,w i)) /\ + (!i. ~scs_J_v39 s l i) /\ + w l = v2 /\ + w (SUC l) = v1 /\ + norm v1 pow 2 = x1 /\ + norm v2 pow 2 = x2 /\ + norm (v2 - v1) pow 2 = x5 /\ + a = -- &1 +/\(!t. &0 < t /\ t < e1 ==> BBs_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t))/\ +&0< e1 + ==> +(?e. &0 < e /\ + (!t. &0 < t /\ t < e + ==> taustar_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t)= taustar_v39 s w +))`;; + + + + + +let TAUSTAR_V3_DEFOR_MK_TWO_CASES=prove_by_refinement( +( TAUSTAR_V3_DEFOR_MK_TWO_CASES_concl), +[ +REPEAT STRIP_TAC; + +REPLICATE_TAC (20-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +REPLICATE_TAC (41-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC); + +ASM_REWRITE_TAC[taustar_v39;LET_DEF;LET_END_DEF;tau_fun] +THEN STRIP_TAC +THEN MP_TAC INTERIOR_ANGLE_SAME_V3_DEFOR1_MK_TWO_CASES +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL HYPER_MM_COLLINEAR)[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`x1:real`;`x2:real`;`x5:real`;`v1:real^3`;`v2:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN MRESAL_TAC(GEN_ALL UPS_X_POS_SEG)[`-- v1:real^3`;`v2-v1:real^3`;`x1:real`;`x2:real`;`x5:real`][COLLINEAR_EQ_SUB_NEG;VECTOR_ARITH`--a-(b-a)= -- b:real^3`;NORM_NEG] +THEN ABBREV_TAC`e2=(min (min e1 e)e')/ &2` +THEN MP_TAC(REAL_ARITH`e2=(min (min e1 e)e' )/ &2/\ &0< e1/\ &0< e /\ &0< e' +==> &0< e2/\ e2< e1/\ e2 t< e1/\ tMRESA1_TAC th`t:real`) +THEN MP_TAC DSV_V3_DEFOR_EQ_MK +THEN RESA_TAC +THEN MATCH_MP_TAC(REAL_ARITH`a=b==> a-c= b-c`) +THEN MATCH_MP_TAC(REAL_ARITH`a=b==> a-c= b-c`) +THEN MRESA_TAC(GEN_ALL Qknvmlb.SUM_AZIM_EQ_ANGLE_LE4)[`V:real^3->bool`;`w:num->real^3`;`l:num`;`s:scs_v39`;`(w:num->real^3) (l MOD scs_k_v39 s)`;`FF:real^3#real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]); + +THAYTHE_TAC (60-18)[`t:real`] +THEN MRESA_TAC(GEN_ALL Qknvmlb.SUM_AZIM_EQ_ANGLE_LE4)[`IMAGE (\i. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 ((w:num->real^3) i) t) (:num)`;` (\i. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 ((w:num->real^3) i) t)`;`l:num`;`s:scs_v39`;` (\i. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 ((w:num->real^3) i) t) (l MOD scs_k_v39 s)`;`IMAGE (\i. v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 ((w:num->real^3) i) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w (SUC i)) t) (:num)`;`IMAGE (\i. { v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 (w i) t, v3_defor_v5 (-- &1) x1 x5 x2 v1 v2 ((w:num->real^3) (SUC i)) t}) (:num)`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]); + +MATCH_MP_TAC SUM_EQ +THEN REWRITE_TAC[IN_ELIM_THM;F_DEFORMATION_V3_DEFOR_V5] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`t --e A\/ B`) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39;convex_local_fan] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MATCH_MP_TAC(SET_RULE`x=y==> rho_fun x= rho_fun y`) +THEN REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=>a=c:real^3`] +THEN MP_TAC(SET_RULE`(w:num->real^3) (x + l MOD k) = v2 \/ ~(w (x + l MOD k) = v2)`) +THEN RESA_TAC; + +ASM_REWRITE_TAC[NORM_EQ_SQUARE;NORM_POS_LE;DOT_SQUARE_NORM] +THEN MP_TAC(REAL_ARITH`&0< t/\ t< e'==> --e' &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist(w l,w i)) /\ + (!i. ~(scs_J_v39 s l i)) /\ + (!V E v. + V = IMAGE w (:num) /\ + E = IMAGE (\i. {w i, w (SUC i)}) (:num) ==> + ~(lunar (v,(w l)) V E )) ==> + (scs_a_v39 s l (SUC l) = dist (w l, w (SUC l)) /\ + (scs_a_v39 s l (l + (k-1)) = dist (w l, w (l + (k-1)))))`;; + + + + + + +let NUXCOEA=prove_by_refinement( (mk_imp(ZLZTHIC_concl, mk_imp (MHAEYJN_concl, NUXCOEA_concl))), +[ + +REPEAT DISCH_TAC +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC IMJXPHR +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC NORM_LE_2_IN_MMS +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&2 <= norm ((w:num->real^3) l) ==> ~(&2 = norm (w l)) \/ &2= norm (w l) `) +THEN RESA_TAC +THEN ASM_TAC +THEN REPLICATE_TAC (16) (RESA_TAC) +THEN REPLICATE_TAC (15-10)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN REPLICATE_TAC (1)(POP_ASSUM MP_TAC) +THEN MP_TAC th) +; + +MP_TAC MMS_IMP_BBS +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`j:num`;`w:num->real^3`;`SUC l`] +THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MODL)[`j:num`;`s:scs_v39`;`SUC l:num`;`l:num`] +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (18-4)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[is_scs_v39;periodic2] +THEN ASSUME_TAC th +THEN RESA_TAC) +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DIST_SYM] +; + + +REPLICATE_TAC (39-4)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + + + +REPLICATE_TAC (59-14)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC) +; + + +MP_TAC WL_IN_BALL_ANNULUS +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL WL_IN_BALL_ANNULUS)[`s:scs_v39`;`w:num->real^3`;`SUC l`] +THEN MRESA_TAC(GEN_ALL WL_IN_BALL_ANNULUS)[`s:scs_v39`;`w:num->real^3`;`l+k-1`] +THEN MP_TAC WL_IN_V +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL WL_IN_V)[`SUC l`;`w:num->real^3`] +THEN MRESA_TAC(GEN_ALL WL_IN_V)[`l+k-1`;`w:num->real^3`] +THEN MP_TAC WL_IN_FF +THEN RESA_TAC +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] +; + + + + +MP_TAC(REAL_ARITH`scs_a_v39 s l (l + k - 1) < dist ((w:num->real^3) l,w (l + k - 1))\/ scs_a_v39 s l (l + k - 1) >= dist (w l,w (l + k - 1))`) +THEN RESA_TAC; + + +SUBGOAL_THEN(`!i. ~(l MOD k = i MOD k) /\ + ~(SUC l MOD k = i MOD k) + ==> scs_a_v39 s l i < dist ((w:num->real^3) l,(w:num->real^3) i)`)ASSUME_TAC; + + + +GEN_TAC +THEN MP_TAC(SET_RULE`(l MOD k = SUC i MOD k)\/ ~(l MOD k = SUC i MOD k)`) +THEN RESA_TAC; + + +MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`l:num`] +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`l+k-1`;`i:num`;`1`;`k:num`][ARITH_RULE`1+i=SUC i`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_LE3)[`s:scs_v39`;`i:num`;`w:num->real^3`;`l+k-1:num`] +THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MODL)[`i:num`;`s:scs_v39`;`l+k-1:num`;`l:num`]; + + + +REPLICATE_TAC (71-10)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`i:num`][scs_diag]); + + + +ABBREV_TAC`v2= (w:num->real^3) l` +THEN ABBREV_TAC`v3= (w:num->real^3) (SUC l)` +THEN ABBREV_TAC`v1= (w:num->real^3) (l+k-1)` +THEN ABBREV_TAC`x1=norm (v1:real^3) pow 2` +THEN ABBREV_TAC`x2=norm (v2:real^3) pow 2` +THEN ABBREV_TAC`x3=norm (v3:real^3) pow 2` +THEN ABBREV_TAC`x5=norm (v2-v1:real^3) pow 2` +THEN ABBREV_TAC`x6=norm (v2-v3:real^3) pow 2` +THEN ABBREV_TAC`a= -- &1` +; + + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v1,v2):real^3#real^3`] +THEN MRESA_TAC(GEN_ALL NORM_POS_COLLINEAR)[`v2:real^3`;`v1:real^3`;`x2:real`;`x1:real`;`x5:real`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,v3):real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL NORM_POS_COLLINEAR)[`v2:real^3`;`v3:real^3`;`x2:real`;`x3:real`;`x6:real`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MP_TAC DEFORMATION_MK_DEFOR_IN_BALL_ANNULUS +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC DIST_SYM[`v3:real^3`;`v2:real^3`] +THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_AA_COM_MK +THEN RESA_TAC +THEN DICH_TAC (94-8) +THEN RESA_TAC +THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_B_COM_MK +THEN RESA_TAC +THEN MP_TAC V3_DEFOR_CONVEX_LOCAL_FAN_MK +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`j:num`]) +THEN POP_ASSUM MP_TAC +THEN DICH_TAC (96-9) +THEN RESA_TAC +THEN MATCH_MP_TAC(SET_RULE`(B==> A==>C)==>((A==>B)==> A==>C)`) +THEN STRIP_TAC +THEN ABBREV_TAC`e1=((min (min (min e e') e'') e''')) / &2` +THEN MP_TAC(REAL_ARITH`e1=((min (min (min e e') e'') e''')) / &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''==> &0 BBs_v39 s (\i. (v3_defor_v4 a x1 x5 x2 (--v1) (v2-v1) ((w:num->real^3) i-v1) t)+v1 )` ASSUME_TAC +; + + + + +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT STRIP_TAC; + + + +ASM_REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;] +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`((w:num->real^3) x' -v1 =v2- v1)\/ ~(w x' -v1 = v2-v1)`) +THEN RESA_TAC; + + +MP_TAC(REAL_ARITH`t< e1/\ e1< e/\ &0 t< e/\ --e a IN B`)) +THEN EXISTS_TAC`V:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + + +ASM_TAC +THEN REPLICATE_TAC 5 (STRIP_TAC) +THEN MP_TAC(ARITH_RULE`3< k==> ~(k<=3)`) +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;periodic;ww_defor] +THEN REPEAT RESA_TAC; + + + + + + + +(****scs_a *****) + +ASM_REWRITE_TAC[v3_defor_v4] +THEN MP_TAC(SET_RULE`(w:num->real^3) i =w l \/ ~(w i = w l)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b=c-b<=> a=c:real^3`]; + + + +MP_TAC(SET_RULE`(w:num->real^3) j' =w l \/ ~(w j' = w l)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b=c-b<=> a=c:real^3`]; + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j':num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i MOD k`;`j' MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]); + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j':num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`j' MOD k = l MOD k==> (w:num->real^3)(j' MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'==> t< e'`) +THEN RESA_TAC; + + + + +THAYTHEL_TAC (121-93) [`t:real`;`j':num`][DIST_REFL] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`;VECTOR_ARITH`a-b+b=a:real^3`]) +THEN DICH_TAC 1 +THEN REAL_ARITH_TAC +; + + + + +MP_TAC(SET_RULE`(w:num->real^3) j' =w l \/ ~(w j' = w l)`) +THEN RESA_TAC; + + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j':num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`j' MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`i MOD k = l MOD k==> (w:num->real^3)(i MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'==> t< e'`) +THEN RESA_TAC; + + + + +THAYTHEL_TAC (121-93) [`t:real`;`i:num`][] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`;VECTOR_ARITH`a-b+b=a:real^3`]) +THEN DICH_TAC 1 +THEN REAL_ARITH_TAC +; + + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;VECTOR_ARITH`a-b+b=a:real^3`] +THEN REPEAT RESA_TAC; + + + +(**************scs_b_v39************) + + +ASM_REWRITE_TAC[v3_defor_v4] +THEN MP_TAC(SET_RULE`(w:num->real^3) i =w l \/ ~(w i = w l)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b=c-b<=> a=c:real^3`]; + + + +MP_TAC(SET_RULE`(w:num->real^3) j' =w l \/ ~(w j' = w l)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b=c-b<=> a=c:real^3`]; + + + +REWRITE_TAC[DIST_REFL] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC; + + +THAYTHEL_TAC (109-14) [`i:num`;`j':num`][DIST_REFL]; + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j':num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s j'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`j' MOD k = l MOD k==> (w:num->real^3)(j' MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''==> t< e''`) +THEN RESA_TAC; + + + + +THAYTHEL_TAC (121-96) [`t:real`;`j':num`][DIST_REFL] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s j'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`;VECTOR_ARITH`a-b+b=a:real^3`]) +THEN DICH_TAC 1 +THEN REAL_ARITH_TAC +; + + + + +MP_TAC(SET_RULE`(w:num->real^3) j' =w l \/ ~(w j' = w l)`) +THEN RESA_TAC; + + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j':num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`j' MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`i MOD k = l MOD k==> (w:num->real^3)(i MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''==> t< e''`) +THEN RESA_TAC; + + + + +THAYTHEL_TAC (121-96) [`t:real`;`i:num`][] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`;VECTOR_ARITH`a-b+b=a:real^3`]) +THEN DICH_TAC 1 +THEN REAL_ARITH_TAC +; + + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;VECTOR_ARITH`a-b+b=a:real^3`] +THEN REPEAT RESA_TAC; + + + + +(*************convex_local_fan**************) + + + +ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'''/\ &0< t/\ &0< e'''==> t< e'''/\ --e'''< t`) +THEN RESA_TAC +THEN THAYTHE_TAC (108-98)[`t:real`;] +; + + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM v3_defor_v5] +THEN STRIP_TAC +THEN MP_TAC TAUSTAR_V3_DEFOR_MK +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`]) +THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_COM_MK1 +THEN RESA_TAC +THEN ABBREV_TAC`e3=e''''':real`; + + +ABBREV_TAC`e2= (min (min (min e1 e'''')e') e3)/ &2` +THEN MP_TAC(REAL_ARITH`e2=(min (min (min e1 e'''')e') e3)/ &2 /\ &0< e1/\ &0< e'''' +/\ &0< e' /\ &0< e3 +==> &0< e2/\ e2< e1/\ e2< e''''/\ e2< e'/\ e2< e3`) +THEN RESA_TAC +THEN SUBGOAL_THEN`!t. &0 < t /\ t < e2 + ==> BBprime_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t)`ASSUME_TAC +; + + +REPEAT RESA_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN MP_TAC(REAL_ARITH`e2=(min (min (min e1 e'''')e') e3)/ &2 /\ &0< e1/\ &0< e'''' +/\ &0< e' /\ &0< e3 +/\ &0 t< e1/\ t< e''''`) +THEN RESA_TAC +THEN THAYTHE_TAC (120-105)[`t:real`] +THEN THAYTHE_TAC (120-106)[`t:real`]; + + + + + +SUBGOAL_THEN`!t. &0 < t /\ t < e2 + ==> BBindex_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t)< BBindex_v39 s w`ASSUME_TAC +; + + + +REWRITE_TAC[BBindex_v39] +THEN REPEAT RESA_TAC +THEN MATCH_MP_TAC CARD_PSUBSET +THEN STRIP_TAC; + + +REWRITE_TAC[PSUBSET_ALT] +THEN STRIP_TAC; + + + +REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;SUBSET;IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`(w:num->real^3) x=v2 \/ ~(w x= v2)`) +THEN RESA_TAC; + + +MRESA_TAC (GEN_ALL W_IN_BB_FUN_EQ)[`w:num->real^3`;`x:num`;`l:num`;`s:scs_v39`] +THEN MP_TAC(SET_RULE`(w:num->real^3) (SUC x)=v2 \/ ~(w (SUC x)= v2)`) +THEN RESA_TAC; + + + +REWRITE_TAC[DIST_REFL]; + + +MRESA_TAC (GEN_ALL Zithlqn.IMP_SUC_MOD_EQ)[`x:num`;`l:num`;`k:num`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`SUC x:num`;`w:num->real^3`;`SUC l`] +THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`x:num`;`SUC x:num`;`s:scs_v39`;`l:num`;`SUC l:num`] +THEN RESA_TAC +; + + +MP_TAC(SET_RULE`(w:num->real^3) (SUC x)=v2 \/ ~(w (SUC x)= v2)`) +THEN RESA_TAC; + + +MRESA_TAC (GEN_ALL W_IN_BB_FUN_EQ)[`w:num->real^3`;`SUC x:num`;`l:num`;`s:scs_v39`] +THEN MRESA_TAC (GEN_ALL EQ_SUC_K_SUB)[`l:num`;`x:num`;`k:num`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`x:num`;`w:num->real^3`;`l+k-1`] +THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`x:num`;`SUC x:num`;`s:scs_v39`;`l+k-1:num`;`l:num`] +THEN MP_TAC(REAL_ARITH`e2=(min (min (min e1 e'''')e') e3)/ &2 /\ &0< e1/\ &0< e'''' +/\ &0< e' /\ &0< e3 +/\ &0 t< e'`) +THEN RESA_TAC +THEN MP_TAC Imjxphr.MOD_ADD_SUB_1 +THEN RESA_TAC +THEN THAYTHEL_TAC (128-92)[`t:real`;`l+k-1`][VECTOR_ARITH`a-b+b=a:real^3`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC +; + + +REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`] +; + +EXISTS_TAC`l MOD k` +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN MRESA_TAC MOD_LT[`l MOD k`;`k:num`] +THEN MRESA_TAC MOD_REFL[`SUC l`;`k:num`] +THEN MRESA_TAC Hypermap.lemma_suc_mod[`l:num`;`k:num`] +THEN MRESAL_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`l MOD k:num`;`SUC(l MOD k):num`;`s:scs_v39`;`l:num`;`SUC (l MOD k) MOD k:num`][MOD_REFL] +THEN MRESAL_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`l:num`;`SUC l MOD k:num`;`s:scs_v39`;`l:num`;`SUC l:num`][MOD_REFL] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`l MOD k :num`;`w:num->real^3`;`l:num`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`SUC(l MOD k) :num`;`w:num->real^3`;`SUC(l MOD k) MOD k:num`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`SUC l MOD k :num`;`w:num->real^3`;`SUC l :num`] +THEN REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,v3):real^3#real^3`][VECTOR_ARITH`a-b+b=a:real^3`] +THEN MP_TAC(REAL_ARITH`e2=(min (min (min e1 e'''')e') e3)/ &2 /\ &0< e1/\ &0< e'''' +/\ &0< e' /\ &0< e3 +/\ &0 t< e3`) +THEN RESA_TAC +THEN THAYTHE_TAC (131-109)[`t:real`] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN ASM_REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + +STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN DICH_TAC (118-40) +THEN STRIP_TAC +THEN SUBGOAL_THEN`BBindex_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) (e2 / &3)) IN + IMAGE (BBindex_v39 s) (BBprime_v39 s)`ASSUME_TAC +; + +REWRITE_TAC[IMAGE;IN_ELIM_THM;] +THEN EXISTS_TAC`(\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) (e2 / &3))` +THEN ASM_REWRITE_TAC[IN] +THEN MATCH_DICH_TAC 2 +THEN DICH_TAC (117-111) +THEN REAL_ARITH_TAC; + + +MRESAL_TAC MIN_LEAST[`(IMAGE (BBindex_v39 s) (BBprime_v39 s))`;`BBindex_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) (e2/ &3))`][GSYM BBindex_min_v39] +THEN MP_TAC(REAL_ARITH`&0< e2==> &0 < e2 / &3 /\ e2 / &3 < e2`) +THEN RESA_TAC +THEN THAYTHE_TAC (123-117)[`e2/ &3`] +THEN POP_ASSUM MP_TAC +THEN DICH_TAC 2 +THEN ARITH_TAC; + + + + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN THAYTHE_TAC (71-16)[`l:num`;`l+k-1`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +(*************************************) + +(*************TWO_CASES***************) + +(*************************************) + +MP_TAC MMS_IMP_BBS +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`j:num`;`w:num->real^3`;`SUC l`] +THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MODL)[`j:num`;`s:scs_v39`;`SUC l:num`;`l:num`] +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (18-4)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[is_scs_v39;periodic2] +THEN ASSUME_TAC th +THEN RESA_TAC) +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DIST_SYM] +; + + +REPLICATE_TAC (39-4)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ ~(k=1)/\ 0real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + + + +REPLICATE_TAC (59-14)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC) +; + + +MP_TAC WL_IN_BALL_ANNULUS +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL WL_IN_BALL_ANNULUS)[`s:scs_v39`;`w:num->real^3`;`SUC l`] +THEN MRESA_TAC(GEN_ALL WL_IN_BALL_ANNULUS)[`s:scs_v39`;`w:num->real^3`;`l+k-1`] +THEN MP_TAC WL_IN_V +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL WL_IN_V)[`SUC l`;`w:num->real^3`] +THEN MRESA_TAC(GEN_ALL WL_IN_V)[`l+k-1`;`w:num->real^3`] +THEN MP_TAC WL_IN_FF +THEN RESA_TAC +THEN MP_TAC EXPAND_PERIODIC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL WL_IN_FF)[`l+k-1`;`w:num->real^3`] +; + + + + +MP_TAC(REAL_ARITH`scs_a_v39 s l (SUC l ) < dist ((w:num->real^3) l,w (SUC l))\/ scs_a_v39 s l (SUC l) >= dist (w l,w (SUC l ))`) +THEN RESA_TAC; + + +SUBGOAL_THEN(`!i. ~(l MOD k = i MOD k) /\ + ~(l MOD k = SUC i MOD k) + ==> scs_a_v39 s l i < dist ((w:num->real^3) l,(w:num->real^3) i)`)ASSUME_TAC; + + + +GEN_TAC +THEN MP_TAC(SET_RULE`(SUC l MOD k = i MOD k)\/ ~(SUC l MOD k = i MOD k)`) +THEN RESA_TAC; + + +MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_LE3)[`s:scs_v39`;`i:num`;`w:num->real^3`;`SUC l:num`] +THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MODL)[`i:num`;`s:scs_v39`;`SUC l:num`;`l:num`]; + + + +REPLICATE_TAC (71-10)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`i:num`][scs_diag]); + + + +ABBREV_TAC`v2= (w:num->real^3) l` +THEN ABBREV_TAC`v1= (w:num->real^3) (SUC l)` +THEN ABBREV_TAC`v3= (w:num->real^3) (l+k-1)` +THEN ABBREV_TAC`x1=norm (v1:real^3) pow 2` +THEN ABBREV_TAC`x2=norm (v2:real^3) pow 2` +THEN ABBREV_TAC`x3=norm (v3:real^3) pow 2` +THEN ABBREV_TAC`x5=norm (v2-v1:real^3) pow 2` +THEN ABBREV_TAC`x6=norm (v2-v3:real^3) pow 2` +THEN ABBREV_TAC`a= -- &1` +; + + +MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v2,v1):real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL NORM_POS_COLLINEAR)[`v2:real^3`;`v1:real^3`;`x2:real`;`x1:real`;`x5:real`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v3,v2):real^3#real^3`] +THEN MRESA_TAC(GEN_ALL NORM_POS_COLLINEAR)[`v2:real^3`;`v3:real^3`;`x2:real`;`x3:real`;`x6:real`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MP_TAC DEFORMATION_MK_DEFOR_IN_BALL_ANNULUS +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC DIST_SYM[`(w:num->real^3)j`;`v2:real^3`] +THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_AA_COM_MK_TWO_CASES +THEN RESA_TAC +THEN DICH_TAC (94-8) +THEN RESA_TAC +THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_B_COM_MK_TWO_CASES +THEN RESA_TAC +THEN MP_TAC V3_DEFOR_CONVEX_LOCAL_FAN_MK_TWO_CASES +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`;`j:num`]) +THEN POP_ASSUM MP_TAC +THEN DICH_TAC (96-9) +THEN RESA_TAC +THEN MATCH_MP_TAC(SET_RULE`(B==> A==>C)==>((A==>B)==> A==>C)`) +THEN STRIP_TAC +THEN ABBREV_TAC`e1=((min (min (min e e') e'') e''')) / &2` +THEN MP_TAC(REAL_ARITH`e1=((min (min (min e e') e'') e''')) / &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0< e'''==> &0 BBs_v39 s (\i. (v3_defor_v4 a x1 x5 x2 (--v1) (v2-v1) ((w:num->real^3) i-v1) t)+v1 )` ASSUME_TAC +; + + + + +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT STRIP_TAC; + + + +ASM_REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;] +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`((w:num->real^3) x' -v1 =v2- v1)\/ ~(w x' -v1 = v2-v1)`) +THEN RESA_TAC; + + +MP_TAC(REAL_ARITH`t< e1/\ e1< e/\ &0 t< e/\ --e a IN B`)) +THEN EXISTS_TAC`V:real^3->bool` +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + + +ASM_TAC +THEN REPLICATE_TAC 5 (STRIP_TAC) +THEN MP_TAC(ARITH_RULE`3< k==> ~(k<=3)`) +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;periodic;ww_defor] +THEN REPEAT RESA_TAC; + + + + + + + +(****scs_a *****) + +ASM_REWRITE_TAC[v3_defor_v4] +THEN MP_TAC(SET_RULE`(w:num->real^3) i =w l \/ ~(w i = w l)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b=c-b<=> a=c:real^3`]; + + + +MP_TAC(SET_RULE`(w:num->real^3) j' =w l \/ ~(w j' = w l)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b=c-b<=> a=c:real^3`]; + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j':num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i MOD k`;`j' MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]); + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j':num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`j' MOD k = l MOD k==> (w:num->real^3)(j' MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'==> t< e'`) +THEN RESA_TAC; + + + + +THAYTHEL_TAC (121-93) [`t:real`;`j':num`][DIST_REFL] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`;VECTOR_ARITH`a-b+b=a:real^3`]) +THEN DICH_TAC 1 +THEN REAL_ARITH_TAC +; + + + + +MP_TAC(SET_RULE`(w:num->real^3) j' =w l \/ ~(w j' = w l)`) +THEN RESA_TAC; + + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j':num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`j' MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`i MOD k = l MOD k==> (w:num->real^3)(i MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'==> t< e'`) +THEN RESA_TAC; + + + + +THAYTHEL_TAC (121-93) [`t:real`;`i:num`][] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`;VECTOR_ARITH`a-b+b=a:real^3`]) +THEN DICH_TAC 1 +THEN REAL_ARITH_TAC +; + + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;VECTOR_ARITH`a-b+b=a:real^3`] +THEN REPEAT RESA_TAC; + + + +(**************scs_b_v39************) + + +ASM_REWRITE_TAC[v3_defor_v4] +THEN MP_TAC(SET_RULE`(w:num->real^3) i =w l \/ ~(w i = w l)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b=c-b<=> a=c:real^3`]; + + + +MP_TAC(SET_RULE`(w:num->real^3) j' =w l \/ ~(w j' = w l)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a-b=c-b<=> a=c:real^3`]; + + + +REWRITE_TAC[DIST_REFL] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC; + + +THAYTHEL_TAC (109-14) [`i:num`;`j':num`][DIST_REFL]; + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j':num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s j'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`j' MOD k = l MOD k==> (w:num->real^3)(j' MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''==> t< e''`) +THEN RESA_TAC; + + + + +THAYTHEL_TAC (121-96) [`t:real`;`j':num`][DIST_REFL] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s j'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`;VECTOR_ARITH`a-b+b=a:real^3`]) +THEN DICH_TAC 1 +THEN REAL_ARITH_TAC +; + + + + +MP_TAC(SET_RULE`(w:num->real^3) j' =w l \/ ~(w j' = w l)`) +THEN RESA_TAC; + + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j':num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`j' MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`i MOD k = l MOD k==> (w:num->real^3)(i MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''==> t< e''`) +THEN RESA_TAC; + + + + +THAYTHEL_TAC (121-96) [`t:real`;`i:num`][] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`;VECTOR_ARITH`a-b+b=a:real^3`]) +THEN DICH_TAC 1 +THEN REAL_ARITH_TAC +; + + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;VECTOR_ARITH`a-b+b=a:real^3`] +THEN REPEAT RESA_TAC; + + + + +(*************convex_local_fan**************) + + + +ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'''/\ &0< t/\ &0< e'''==> t< e'''/\ --e'''< t`) +THEN RESA_TAC +THEN THAYTHE_TAC (108-98)[`t:real`;] +; + + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM v3_defor_v5] +THEN STRIP_TAC +THEN MP_TAC TAUSTAR_V3_DEFOR_MK_TWO_CASES +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`]) +THEN MP_TAC DEFORMATION_DIST_LE_V3_DEFOR_A_COM_MK1_TWO_CASES +THEN RESA_TAC +THEN ABBREV_TAC`e3=e''''':real`; + + +ABBREV_TAC`e2= (min (min (min e1 e'''')e') e3)/ &2` +THEN MP_TAC(REAL_ARITH`e2=(min (min (min e1 e'''')e') e3)/ &2 /\ &0< e1/\ &0< e'''' +/\ &0< e' /\ &0< e3 +==> &0< e2/\ e2< e1/\ e2< e''''/\ e2< e'/\ e2< e3`) +THEN RESA_TAC +THEN SUBGOAL_THEN`!t. &0 < t /\ t < e2 + ==> BBprime_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t)`ASSUME_TAC +; + + +REPEAT RESA_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN MP_TAC(REAL_ARITH`e2=(min (min (min e1 e'''')e') e3)/ &2 /\ &0< e1/\ &0< e'''' +/\ &0< e' /\ &0< e3 +/\ &0 t< e1/\ t< e''''`) +THEN RESA_TAC +THEN THAYTHE_TAC (120-105)[`t:real`] +THEN THAYTHE_TAC (120-106)[`t:real`]; + + + + + +SUBGOAL_THEN`!t. &0 < t /\ t < e2 + ==> BBindex_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) t)< BBindex_v39 s w`ASSUME_TAC +; + + + +REWRITE_TAC[BBindex_v39] +THEN REPEAT RESA_TAC +THEN MATCH_MP_TAC CARD_PSUBSET +THEN STRIP_TAC; + + +REWRITE_TAC[PSUBSET_ALT] +THEN STRIP_TAC; + + + +REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`;SUBSET;IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`(w:num->real^3) x=v2 \/ ~(w x= v2)`) +THEN RESA_TAC; + + +MRESA_TAC (GEN_ALL W_IN_BB_FUN_EQ)[`w:num->real^3`;`x:num`;`l:num`;`s:scs_v39`] +THEN MP_TAC(SET_RULE`(w:num->real^3) (SUC x)=v2 \/ ~(w (SUC x)= v2)`) +THEN RESA_TAC; + + + +REWRITE_TAC[DIST_REFL]; + + + + +MRESAL_TAC (GEN_ALL Zithlqn.IMP_SUC_MOD_EQ)[`l:num`;`x:num`;`k:num`][ARITH_RULE`1+i=SUC i`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`SUC x:num`;`w:num->real^3`;`SUC l:num`] +THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`x:num`;`SUC x:num`;`s:scs_v39`;`l:num`;`SUC l:num`] +THEN MP_TAC(REAL_ARITH`e2=(min (min (min e1 e'''')e') e3)/ &2 /\ &0< e1/\ &0< e'''' +/\ &0< e' /\ &0< e3 +/\ &0 t< e'`) +THEN RESA_TAC +THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ +THEN RESA_TAC +THEN THAYTHE_TAC 0[`l:num`] +THEN THAYTHEL_TAC (128-92)[`t:real`;`SUC l`][VECTOR_ARITH`a-b+b=a:real^3`] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC +; + + +MP_TAC(SET_RULE`(w:num->real^3) (SUC x)=v2 \/ ~(w (SUC x)= v2)`) +THEN RESA_TAC; + + +MRESA_TAC(GEN_ALL W_IN_BB_FUN_EQ)[`w:num->real^3`;`SUC x`;`l:num`;`s:scs_v39`] +THEN MRESA_TAC (GEN_ALL EQ_SUC_K_SUB3)[`l:num`;`x:num`;`k:num`] +THEN MRESA_TAC (GEN_ALL EQ_SUC_K_SUB3)[`l:num`;`j:num`;`k:num`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`x:num`;`w:num->real^3`;`j:num`] +THEN MRESA_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`x:num`;`SUC x:num`;`s:scs_v39`;`j:num`;`l:num`] +THEN RESA_TAC; + + + + +REWRITE_TAC[VECTOR_ARITH`a-b+b=a:real^3`] +; + +EXISTS_TAC`(l+k-1) MOD k` +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN MRESA_TAC DIVISION[`l+k-1:num`;`k:num`] +THEN MRESA_TAC MOD_REFL[`l+k:num`;`k:num`] +THEN MRESA_TAC MOD_REFL[`l+k-1:num`;`k:num`] +THEN MRESA_TAC MOD_REFL[`l:num`;`k:num`] +THEN MRESA_TAC Hypermap.lemma_suc_mod[`l+k-1:num`;`k:num`] +THEN MRESAL_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`(l+k-1) MOD k:num`;`SUC((l+k-1) MOD k):num`;`s:scs_v39`;`l+k-1:num`;`SUC ((l+k-1) MOD k) MOD k:num`][MOD_REFL] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`l:num`][ARITH_RULE`1 * k + l= l+k`] +THEN MRESAL_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`l+k-1:num`;`l MOD k:num`;`s:scs_v39`;`l+k-1:num`;`l:num`][MOD_REFL] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`(l+k-1) MOD k :num`;`w:num->real^3`;`l+k-1:num`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`SUC((l+k-1) MOD k) :num`;`w:num->real^3`;`SUC((l+k-1) MOD k) MOD k:num`] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`l MOD k :num`;`w:num->real^3`;`l :num`] +THEN MRESA_TAC (GEN_ALL EQ_SUC_K_SUB3)[`l:num`;`j:num`;`k:num`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MRESAL_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`l:num`;`l+k-1:num`;`s:scs_v39`;`l:num`;`j:num`][MOD_REFL] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`j :num`;`w:num->real^3`;`l+k-1 :num`] +THEN REWRITE_TAC[v3_defor_v5;v3_defor_v4;VECTOR_ARITH`a-b=c-b<=> a=c:real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(v3,v2):real^3#real^3`][VECTOR_ARITH`a-b+b=a:real^3`] +THEN MP_TAC(REAL_ARITH`e2=(min (min (min e1 e'''')e') e3)/ &2 /\ &0< e1/\ &0< e'''' +/\ &0< e' /\ &0< e3 +/\ &0 t< e3`) +THEN RESA_TAC +THEN THAYTHE_TAC (136-109)[`t:real`] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN ASM_REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + +STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN DICH_TAC (118-40) +THEN STRIP_TAC +THEN SUBGOAL_THEN`BBindex_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 (w i) (e2 / &3)) IN + IMAGE (BBindex_v39 s) (BBprime_v39 s)`ASSUME_TAC +; + +REWRITE_TAC[IMAGE;IN_ELIM_THM;] +THEN EXISTS_TAC`(\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) (e2 / &3))` +THEN ASM_REWRITE_TAC[IN] +THEN MATCH_DICH_TAC 2 +THEN DICH_TAC (117-111) +THEN REAL_ARITH_TAC; + + +MRESAL_TAC MIN_LEAST[`(IMAGE (BBindex_v39 s) (BBprime_v39 s))`;`BBindex_v39 s (\i. v3_defor_v5 a x1 x5 x2 v1 v2 ((w:num->real^3) i) (e2/ &3))`][GSYM BBindex_min_v39] +THEN MP_TAC(REAL_ARITH`&0< e2==> &0 < e2 / &3 /\ e2 / &3 < e2`) +THEN RESA_TAC +THEN THAYTHE_TAC (123-117)[`e2/ &3`] +THEN POP_ASSUM MP_TAC +THEN DICH_TAC 2 +THEN ARITH_TAC; + + +ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC (GEN_ALL EQ_SUC_K_SUB3)[`l:num`;`j:num`;`k:num`] +THEN MRESAL_TAC( GEN_ALL CHANGE_A_SCS_MOD)[`l:num`;`l+k-1:num`;`s:scs_v39`;`l:num`;`j:num`][MOD_REFL] +THEN MRESA_TAC (GEN_ALL CHANGE_W_IN_BBS_MOD_IS_SCS)[`s:scs_v39`;`j :num`;`w:num->real^3`;`l+k-1 :num`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +; + + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN THAYTHE_TAC (71-16)[`l:num`;`SUC l`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +]);; + + + +let NUXCOEAv2=prove((NUXCOEA_concl), +MP_TAC NUXCOEA +THEN ASM_REWRITE_TAC[Lunar_deform.MHAEYJN;Zlzthic.ZLZTHIC] +THEN MESON_TAC[]);; + + +let IMJXPHRv2=prove((IMJXPHR_concl), +MP_TAC IMJXPHR +THEN ASM_REWRITE_TAC[Lunar_deform.MHAEYJN;Zlzthic.ZLZTHIC] +THEN MESON_TAC[]);; + + +let ODXLSTCv2=prove((ODXLSTCv2_concl), +MP_TAC ODXLSTCv2 +THEN ASM_REWRITE_TAC[Lunar_deform.MHAEYJN;Zlzthic.ZLZTHIC] +THEN MESON_TAC[]);; + + + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/OCBICBY.hl b/text_formalization/local/OCBICBY.hl new file mode 100644 index 0000000..5e490a0 --- /dev/null +++ b/text_formalization/local/OCBICBY.hl @@ -0,0 +1,4960 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Section: Conclusions *) +(* Chapter: Local Fan *) +(* Lemma: OCBICBY *) +(* Author: Thomas C. Hales *) +(* Date: 2013-06-27 *) +(* ========================================================================== *) + + + +module Ocbicby = struct + + open Hales_tactic;; + +let LET_THM = CONJ LET_DEF LET_END_DEF;; + +let diff = Pent_hex.diff;; +let DERIVED_TAC = Pent_hex.DERIVED_TAC;; +(* +Functional_equation.functional_overload();; +*) + +let sqrt8_flyspeck = prove_by_refinement( + `#2.828427 < sqrt8 /\ + sqrt8 < #2.828428`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Flyspeck_constants.bounds]) + ]);; + (* }}} *) + +let DOT_LSUB = prove_by_refinement( + `!x y (z:real^A). (x - y) dot z = x dot z - y dot z`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + BY(VECTOR_ARITH_TAC) + ]);; + (* }}} *) + +let DOT_RSUB = prove_by_refinement( + `!x y (z:real^A). x dot (y - z) = x dot y - x dot z `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + BY(VECTOR_ARITH_TAC) + ]);; + (* }}} *) + +let euler_p_eulerA_x = prove_by_refinement( + `!(v0:real^A) v1 v2 v3. + (let x1 = dist(v0,v1) pow 2 in + let x2 = dist(v0,v2) pow 2 in + let x3 = dist(v0,v3) pow 2 in + let x4 = dist(v2,v3) pow 2 in + let x5 = dist(v1,v3) pow 2 in + let x6 = dist(v1,v2) pow 2 in + (euler_p v0 v1 v2 v3 = eulerA_x x1 x2 x3 x4 x5 x6))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF;Sphere.euler_p;Sphere.eulerA_x;Sphere.ylist]; + REPEAT WEAKER_STRIP_TAC; + REPEAT (GMATCH_SIMP_TAC POW_2_SQRT); + REWRITE_TAC[DIST_POS_LE]; + MATCH_MP_TAC (arith `b = b' ==> a + b = a + b'`); + MATCH_MP_TAC (arith `a = a' /\ b = b' /\ c = c' ==> ra * a + rb * b + rc * c = ra * a' + rb * b' + rc * c'`); + REWRITE_TAC[Collect_geom2.DIST_POW2_DOT]; + REWRITE_TAC[DOT_LSUB;DOT_RSUB]; + REWRITE_TAC[DOT_SYM]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* was DELTA_IMP_DIH_PI *) + +let COPLANAR_IMP_DIH_PI = prove_by_refinement( + `!(v0:real^3) v1 v2 v3. (let y1 = dist(v0,v1) in + let y2 = dist(v0,v2) in + let y3 = dist(v0,v3) in + let y4 = dist(v2,v3) in + let y5 = dist(v1,v3) in + let y6 = dist(v1,v2) in + (~collinear {v0, v1, v2} /\ ~collinear {v0, v1, v3} /\ coplanar {v0,v1,v2,v3} /\ + y_of_x delta_x4 y1 y2 y3 y4 y5 y6 < &0 ==> + dihV v0 v1 v2 v3 = pi))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + GMATCH_SIMP_TAC (GSYM DIHV_EQ_0_PI_EQ_COPLANAR); + ASM_REWRITE_TAC[]; + TYPIFY `(&0 < dihV v0 v1 v2 v3 )` ENOUGH_TO_SHOW_TAC; + BY(REAL_ARITH_TAC); + INTRO_TAC Euler_complement.OJEKOJF2 [`v0`;`v1`;`v2`;`v3`]; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Sphere.y_of_x;arith `x*x = x pow 2`]; + TYPED_ABBREV_TAC `d4 = delta_x4 (dist (v0,v1) pow 2) (dist (v0,v2) pow 2) (dist (v0,v3) pow 2) (dist (v2,v3) pow 2) (dist (v1,v3) pow 2) (dist (v1,v2) pow 2)` ; + DISCH_TAC; + TYPIFY `!x y. (y < &0 ==> atn2 (x,y) = --(pi / &2) - atn (x / y))` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[Trigonometry1.ATN2_BREAKDOWN]); + FIRST_X_ASSUM (unlist ASM_SIMP_TAC); + MATCH_MP_TAC (arith `&0 < pi /\ -- (pi / &2) < a ==> &0 < pi/ &2 - ( -- (pi/ &2) - a)`); + REWRITE_TAC[PI_POS]; + BY(REWRITE_TAC[ATN_BOUNDS]) + ]);; + (* }}} *) + +let DIH_IMP_EULER_A_POS = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!(v0:real^3) v1 v2 v3. (let y1 = dist(v0,v1) in + let y2 = dist(v0,v2) in + let y3 = dist(v0,v3) in + let y4 = dist(v2,v3) in + let y5 = dist(v1,v3) in + let y6 = dist(v1,v2) in + (~collinear {v0,v1,v2} /\ ~collinear {v0,v2,v3} /\ ~collinear{v0,v1,v3} /\ + dihV v0 v1 v2 v3 + dihV v0 v2 v3 v1 + dihV v0 v3 v1 v2 < &2 * pi /\ + &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + #3.01 <= y4 /\ y4 <= #3.915 /\ + #3.01 <= y5 /\ y5 <= #3.915 /\ + #3.01 <= y6 /\ y6 <= #3.915 ==> + y_of_x eulerA_x y1 y2 y3 y4 y5 y6 > &0)))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `&0 < delta_y (dist(v0,v1)) (dist(v0,v2)) (dist(v0,v3)) (dist(v2,v3)) (dist(v1,v3)) (dist(v1,v2))` ASM_CASES_TAC; + INTRO_TAC Euler_main_theorem.EULER_TRIANGLE [`v0`;`v1`;`v2`;`v3`]; + REWRITE_TAC[LET_DEF;LET_END_DEF;Sphere.xlist;Sphere.ylist]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[arith `x pow 2 = x * x`;GSYM Sphere.delta_y]); + DISCH_TAC; + FIRST_X_ASSUM_ST `&2 * pi` MP_TAC; + REWRITE_TAC[arith `dd < &2 * pi <=> dd - pi < pi`]; + ASM_REWRITE_TAC[arith `(a + b+c) -pi = a + b + c - pi`]; + ASM_REWRITE_TAC[arith `x pow 2 = x * x`;GSYM Sphere.delta_y;arith `pi - u < pi <=> &0 < u`]; + REWRITE_TAC[ (REWRITE_RULE[LET_DEF;LET_END_DEF] euler_p_eulerA_x)]; + REWRITE_TAC[arith `x pow 2 = x * x`;GSYM Sphere.y_of_x]; + TYPED_ABBREV_TAC `p = y_of_x eulerA_x (dist (v0,v1)) (dist (v0,v2)) (dist (v0,v3)) (dist (v2,v3)) (dist (v1,v3)) (dist (v1,v2))` ; + REWRITE_TAC[arith `&0 < &2 * x <=> &0 < x`]; + GMATCH_SIMP_TAC Merge_ineq.ATN2_POS; + CONJ_TAC; + GMATCH_SIMP_TAC REAL_LT_RSQRT; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(REAL_ARITH_TAC); + COMMENT "case delta=0"; + TYPIFY `delta_y (dist (v0,v1)) (dist (v0,v2)) (dist (v0,v3)) (dist (v2,v3)) (dist (v1,v3)) (dist (v1,v2)) = &0` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC Terminal.DELTA_Y_POS_4POINTS [`v0`;`v1`;`v2`;`v3`]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + PROOF_BY_CONTR_TAC; + TYPIFY `coplanar {v0,v1,v2,v3}` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[ONCE_REWRITE_RULE[TAUT `(~a <=> b) <=> (a <=> ~b)`] Oxlzlez.coplanar_delta_y]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `{v0,v2,v3,v1} = {v0,v1,v2,v3} /\ {v0,v3,v1,v2} = {v0,v1,v2,v3}` (C SUBGOAL_THEN ASSUME_TAC); + BY(SET_TAC[]); + TYPIFY `{v0,v2,v1} = {v0,v1,v2} /\ {v0,v3,v2} = {v0,v2,v3} /\ {v0,v3,v1} = {v0,v1,v3}` (C SUBGOAL_THEN ASSUME_TAC); + BY(SET_TAC[]); + INTRO_TAC (Terminal.get_main_nonlinear "7439076204") [`dist(v0,v1)`;`dist(v0,v2)`;`dist(v0,v3)`;`dist(v2,v3)`;`dist(v1,v3)`;`dist(v1,v2)`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + DISCH_TAC; + TYPIFY `dihV v0 v1 v2 v3 = pi` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC (REWRITE_RULE[LET_THM] COPLANAR_IMP_DIH_PI); + BY(ASM_REWRITE_TAC[]); + INTRO_TAC (Terminal.get_main_nonlinear "7439076204") [`dist(v0,v2)`;`dist(v0,v3)`;`dist(v0,v1)`;`dist(v3,v1)`;`dist(v2,v1)`;`dist(v2,v3)`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0;DIST_SYM] THEN REAL_ARITH_TAC); + TYPIFY_GOAL_THEN `y_of_x eulerA_x (dist (v0,v2)) (dist (v0,v3)) (dist (v0,v1)) (dist (v3,v1)) (dist (v2,v1)) (dist (v2,v3)) = y_of_x eulerA_x (dist (v0,v1)) (dist (v0,v2)) (dist (v0,v3)) (dist (v2,v3)) (dist (v1,v3)) (dist (v1,v2))` (unlist ASM_REWRITE_TAC); + REWRITE_TAC[DIST_SYM;Sphere.y_of_x]; + BY(MESON_TAC[Merge_ineq.eulerA_x_sym]); + DISCH_TAC; + TYPIFY `dihV v0 v2 v3 v1 = pi` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC (REWRITE_RULE[LET_THM] COPLANAR_IMP_DIH_PI); + BY(ASM_REWRITE_TAC[]); + INTRO_TAC (Terminal.get_main_nonlinear "7439076204") [`dist(v0,v3)`;`dist(v0,v1)`;`dist(v0,v2)`;`dist(v1,v2)`;`dist(v3,v2)`;`dist(v3,v1)`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0;DIST_SYM] THEN REAL_ARITH_TAC); + TYPIFY_GOAL_THEN `y_of_x eulerA_x (dist (v0,v3)) (dist (v0,v1)) (dist (v0,v2)) (dist (v1,v2)) (dist (v3,v2)) (dist (v3,v1)) = y_of_x eulerA_x (dist (v0,v1)) (dist (v0,v2)) (dist (v0,v3)) (dist (v2,v3)) (dist (v1,v3)) (dist (v1,v2))` (unlist ASM_REWRITE_TAC); + REWRITE_TAC[DIST_SYM;Sphere.y_of_x]; + BY(MESON_TAC[Merge_ineq.eulerA_x_sym]); + DISCH_TAC; + TYPIFY `dihV v0 v3 v1 v2 = pi` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC (REWRITE_RULE[LET_THM] COPLANAR_IMP_DIH_PI); + BY(ASM_REWRITE_TAC[]); + REPEAT (FIRST_X_ASSUM_ST `dihV` MP_TAC); + MP_TAC PI_POS; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let ups_x_delta_x = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + delta_x4 x1 x2 x3 x4 x5 x6 pow 2 + &4 * x1 * delta_x x1 x2 x3 x4 x5 x6 = ups_x x1 x3 x5 * ups_x x1 x2 x6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_x4;Sphere.delta_x;Sphere.ups_x]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* DERIVATIVES *) + +let derived_form_b = prove_by_refinement( + `!b f f' x s. derived_form b f f' x s <=> (b ==> derived_form T f f' x s)`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Calc_derivative.derived_form]) + ]);; + (* }}} *) + +let derived_form_delta_x_wrt_x4 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + derived_form T (\q. delta_x x1 x2 x3 q x5 x6) (delta_x4 x1 x2 x3 x4 x5 x6) (x4) (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Sphere.delta_x4;Sphere.delta_x]; + DERIVED_TAC (MP_TAC); + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let derived_form_delta_x_wrt_x5 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + derived_form T (\q. delta_x x1 x2 x3 x4 q x6) (delta_x5 x1 x2 x3 x4 x5 x6) (x5) (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Nonlin_def.delta_x5;Sphere.delta_x]; + DERIVED_TAC (MP_TAC); + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let derived_form_delta_x_wrt_x6 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + derived_form T (\q. delta_x x1 x2 x3 x4 x5 q) (delta_x6 x1 x2 x3 x4 x5 x6) (x6) (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Nonlin_def.delta_x6;Sphere.delta_x]; + DERIVED_TAC (MP_TAC); + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let derived_form_delta_x4_wrt_x4 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + derived_form T (\q. delta_x4 x1 x2 x3 q x5 x6) (-- &2 * x1) (x4) (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Sphere.delta_x4]; + DERIVED_TAC (MP_TAC); + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let derived_form_delta_x4_wrt_x5 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + derived_form T (\q. delta_x4 x1 x2 x3 x4 q x6) (x1 + x2 - x6) (x5) (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Sphere.delta_x4]; + DERIVED_TAC (MP_TAC); + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let derived_form_delta_x4_wrt_x6 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + derived_form T (\q. delta_x4 x1 x2 x3 x4 x5 q) (x1 + x3 - x5) (x6) (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Sphere.delta_x4]; + DERIVED_TAC (MP_TAC); + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let derived_form_dih_x_wrt_x4 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + &0 < x1 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 /\ + &0 < ups_x x1 x2 x6 /\ + &0 < ups_x x1 x3 x5 ==> + derived_form T (\q. dih_x x1 x2 x3 q x5 x6) (sqrt x1 / sqrt (delta_x x1 x2 x3 x4 x5 x6)) (x4) (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `w = (sqrt x1 / sqrt (delta_x x1 x2 x3 x4 x5 x6))`; + REWRITE_TAC[Sphere.dih_x;LET_THM]; + DERIVED_TAC (MP_TAC o GEN_ALL o (GENL [`x1:real`;`x2:real`;`x3:real`;`x4:real`;`x5:real`;`x6:real`])); + DISCH_THEN (C INTRO_TAC [`(-- &2 * x1)`;`(delta_x4 x1 x2 x3 x4 x5 x6)`;`x1`;`x2`;`x3`;`x4`;`x5`;`x6`]); + TYPIFY `&0 < &4 * x1 * delta_x x1 x2 x3 x4 x5 x6` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REWRITE_TAC[arith `&0 < &4`]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[]); + TYPIFY `&0 < sqrt(&4 * x1 * delta_x x1 x2 x3 x4 x5 x6)` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC REAL_LT_RSQRT; + BY(ASM_TAC THEN REAL_ARITH_TAC); + ONCE_REWRITE_TAC[derived_form_b]; + ANTS_TAC; + ASM_REWRITE_TAC[derived_form_delta_x4_wrt_x4;derived_form_delta_x_wrt_x4;IN_UNIV;DE_MORGAN_THM]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[]; + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + TYPIFY `(sqrt (&4 * x1 * delta_x x1 x2 x3 x4 x5 x6) pow 2 + --delta_x4 x1 x2 x3 x4 x5 x6 pow 2) = ups_x x1 x3 x5 * ups_x x1 x2 x6 ` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC SQRT_POW_2; + ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`]; + REWRITE_TAC[arith `(-- x) pow 2 = x pow 2`;GSYM ups_x_delta_x]; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + TYPIFY `(((-- &2 * x1) * -- &1) * sqrt (&4 * x1 * delta_x x1 x2 x3 x4 x5 x6) - --delta_x4 x1 x2 x3 x4 x5 x6 * (&4 * x1 * delta_x4 x1 x2 x3 x4 x5 x6) * inv (&2 * sqrt (&4 * x1 * delta_x x1 x2 x3 x4 x5 x6))) = (&2 * x1) * (ups_x x1 x3 x5 * ups_x x1 x2 x6) / sqrt(&4 * x1 * delta_x x1 x2 x3 x4 x5 x6)` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_ASSUM ( SUBST1_TAC o GSYM); + Calc_derivative.CALC_ID_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `((&2 * x1) * (ups_x x1 x3 x5 * ups_x x1 x2 x6) / sqrt (&4 * x1 * delta_x x1 x2 x3 x4 x5 x6)) / (ups_x x1 x3 x5 * ups_x x1 x2 x6) = sqrt(x1) / sqrt(delta_x x1 x2 x3 x4 x5 x6)` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + TYPIFY `&0 < sqrt(delta_x x1 x2 x3 x4 x5 x6)` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC REAL_LT_RSQRT; + BY(ASM_TAC THEN REAL_ARITH_TAC); + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `sqrt(&4 * x1 * delta_x x1 x2 x3 x4 x5 x6) = &2 * sqrt(x1) * sqrt(delta_x x1 x2 x3 x4 x5 x6)` (C SUBGOAL_THEN SUBST1_TAC); + GMATCH_SIMP_TAC (GSYM SQRT_MUL); + TYPIFY `&2 = sqrt(&4)` (C SUBGOAL_THEN SUBST1_TAC); + MATCH_MP_TAC Upfzbzm_support_lemmas.SQRT_RULE_Euler_lemma; + BY(REAL_ARITH_TAC); + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC (GSYM SQRT_MUL); + REWRITE_TAC[arith `&0 <= &4`]; + GMATCH_SIMP_TAC REAL_LE_MUL; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `sqrt x1 * sqrt x1 = x1` (C SUBGOAL_THEN MP_TAC); + GMATCH_SIMP_TAC (GSYM SQRT_MUL); + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPED_ABBREV_TAC `s = sqrt(delta_x x1 x2 x3 x4 x5 x6)` ; + REWRITE_TAC[arith `((&2 * sx * s) * u) * sx = &2 * (sx * sx) * s * u`]; + DISCH_THEN SUBST1_TAC; + BY(REAL_ARITH_TAC); + EXPAND_TAC "w"; + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let derived_form_dih_x_wrt_x5 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + &0 < x1 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 /\ + &0 < ups_x x1 x2 x6 /\ + &0 < ups_x x1 x3 x5 ==> + derived_form T (\q. dih_x x1 x2 x3 x4 q x6) (--sqrt x1 * + delta_x6 x1 x2 x3 x4 x5 x6 / + (ups_x x1 x3 x5 * sqrt (delta_x x1 x2 x3 x4 x5 x6))) (x5) (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `w = (--sqrt x1 * delta_x6 x1 x2 x3 x4 x5 x6 / (ups_x x1 x3 x5 * sqrt (delta_x x1 x2 x3 x4 x5 x6)))`; + REWRITE_TAC[Sphere.dih_x;LET_THM]; + DERIVED_TAC (MP_TAC o GEN_ALL o (GENL [`x1:real`;`x2:real`;`x3:real`;`x4:real`;`x5:real`;`x6:real`])); + DISCH_THEN (C INTRO_TAC [`x1 + x2 - x6`;`(delta_x5 x1 x2 x3 x4 x5 x6)`;`x1`;`x2`;`x3`;`x4`;`x5`;`x6`]); + TYPIFY `&0 < &4 * x1 * delta_x x1 x2 x3 x4 x5 x6` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REWRITE_TAC[arith `&0 < &4`]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[]); + TYPIFY `&0 < sqrt(&4 * x1 * delta_x x1 x2 x3 x4 x5 x6)` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC REAL_LT_RSQRT; + BY(ASM_TAC THEN REAL_ARITH_TAC); + ONCE_REWRITE_TAC[derived_form_b]; + ANTS_TAC; + ASM_REWRITE_TAC[derived_form_delta_x4_wrt_x5;derived_form_delta_x_wrt_x5;IN_UNIV;DE_MORGAN_THM]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[]; + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + TYPIFY `(sqrt (&4 * x1 * delta_x x1 x2 x3 x4 x5 x6) pow 2 + --delta_x4 x1 x2 x3 x4 x5 x6 pow 2) = ups_x x1 x3 x5 * ups_x x1 x2 x6 ` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC SQRT_POW_2; + ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`]; + REWRITE_TAC[arith `(-- x) pow 2 = x pow 2`;GSYM ups_x_delta_x]; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + TYPIFY `(((x1 + x2 - x6) * -- &1) * sqrt (&4 * x1 * delta_x x1 x2 x3 x4 x5 x6) - --delta_x4 x1 x2 x3 x4 x5 x6 * (&4 * x1 * delta_x5 x1 x2 x3 x4 x5 x6) * inv (&2 * sqrt (&4 * x1 * delta_x x1 x2 x3 x4 x5 x6))) = (-- &4 * x1 * ups_x x1 x2 x6 * delta_x6 x1 x2 x3 x4 x5 x6) / (&2 * sqrt(&4 * x1 * delta_x x1 x2 x3 x4 x5 x6))` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `(xx * s) * &2 * s = (s * s) * xx * &2`]; + GMATCH_SIMP_TAC (GSYM SQRT_MUL); + ASM_SIMP_TAC[arith `&0 &0 <= x`]; + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + ASM_SIMP_TAC[arith `&0 &0 <= x`]; + TYPED_ABBREV_TAC `sq = sqrt (&4 * x1 * delta_x x1 x2 x3 x4 x5 x6)`; + REWRITE_TAC[Sphere.delta_x;Nonlin_def.delta_x4;Nonlin_def.delta_x5;Nonlin_def.delta_x6;Sphere.ups_x]; + BY(REAL_ARITH_TAC); + TYPIFY `(-- &4 * x1 * ups_x x1 x2 x6 * delta_x6 x1 x2 x3 x4 x5 x6) / (&2 * sqrt (&4 * x1 * delta_x x1 x2 x3 x4 x5 x6)) / (ups_x x1 x3 x5 * ups_x x1 x2 x6) = -- sqrt x1 * delta_x6 x1 x2 x3 x4 x5 x6 / (ups_x x1 x3 x5 * sqrt(delta_x x1 x2 x3 x4 x5 x6))` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + TYPIFY `&0 < sqrt(delta_x x1 x2 x3 x4 x5 x6)` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC REAL_LT_RSQRT; + BY(ASM_TAC THEN REAL_ARITH_TAC); + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `sqrt(&4 * x1 * delta_x x1 x2 x3 x4 x5 x6) = &2 * sqrt(x1) * sqrt(delta_x x1 x2 x3 x4 x5 x6)` (C SUBGOAL_THEN SUBST1_TAC); + GMATCH_SIMP_TAC (GSYM SQRT_MUL); + TYPIFY `&2 = sqrt(&4)` (C SUBGOAL_THEN SUBST1_TAC); + MATCH_MP_TAC Upfzbzm_support_lemmas.SQRT_RULE_Euler_lemma; + BY(REAL_ARITH_TAC); + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC (GSYM SQRT_MUL); + REWRITE_TAC[arith `&0 <= &4`]; + GMATCH_SIMP_TAC REAL_LE_MUL; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `sqrt x1 * sqrt x1 = x1` (C SUBGOAL_THEN MP_TAC); + GMATCH_SIMP_TAC (GSYM SQRT_MUL); + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPED_ABBREV_TAC `s = sqrt(delta_x x1 x2 x3 x4 x5 x6)` ; + REWRITE_TAC[arith `((&2 * sx * s) * u) * sx = &2 * (sx * sx) * s * u`]; + BY(CONV_TAC REAL_RING); + EXPAND_TAC "w"; + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let derived_form_dih_x_wrt_x6 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + &0 < x1 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 /\ + &0 < ups_x x1 x2 x6 /\ + &0 < ups_x x1 x3 x5 ==> + derived_form T (\q. dih_x x1 x2 x3 x4 x5 q) (--sqrt x1 * + delta_x5 x1 x2 x3 x4 x5 x6 / + (ups_x x1 x2 x6 * sqrt (delta_x x1 x2 x3 x4 x5 x6))) (x6) (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY_GOAL_THEN `!q. dih_x x1 x2 x3 x4 x5 q = dih_x x1 x3 x2 x4 q x5` (unlist REWRITE_TAC); + BY(REWRITE_TAC[Nonlinear_lemma.dih_x_sym]); + INTRO_TAC derived_form_dih_x_wrt_x5 [`x1`;`x3`;`x2`;`x4`;`x6`;`x5`]; + TYPIFY `delta_x x1 x3 x2 x4 x6 x5 = delta_x x1 x2 x3 x4 x5 x6` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_TAC THEN MESON_TAC[Merge_ineq.delta_x_sym]); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + REWRITE_TAC[Nonlin_def.delta_x6;Nonlin_def.delta_x5]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let derived_form_num1 = prove_by_refinement( + `!x4 x5 x6 e1 e2 e3. + derived_form T (\q. num1 e1 e2 e3 q x5 x6) (&4 * ((&16 - &2 * x4) * e1 + (x5 - &8) * e2 + (x6 - &8) * e3)) + (x4) (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Sphere.num1]; + DERIVED_TAC MP_TAC; + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let derived_form_dnum1 = prove_by_refinement( + `!x4 x5 x6 e1 e2 e3. + derived_form T (\q. num1 e1 e2 e3 q x5 x6) (&4 * dnum1 e1 e2 e3 x4 x5 x6) + (x4) (:real)`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Nonlin_def.dnum1;derived_form_num1]) + ]);; + (* }}} *) + +let derived_form_sum_dih = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6 e1 e2 e3. + &0 < x1 /\ &0 < x2 /\ &0 < x3 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 /\ + &0 < ups_x x1 x2 x6 /\ + &0 < ups_x x1 x3 x5 /\ + &0 < ups_x x2 x3 x4 ==> + derived_form T (\q. e1 * dih_x x1 x2 x3 q x5 x6 + + e2 * dih_x x2 x3 x1 x5 x6 q + + e3 * dih_x x3 x1 x2 x6 q x5) ((e1 * sqrt x1 * ups_x x2 x3 x4 - + e2 * sqrt x2 * delta_x6 x1 x2 x3 x4 x5 x6 - + e3 * sqrt x3 * delta_x5 x1 x2 x3 x4 x5 x6) / + (ups_x x2 x3 x4 * sqrt (delta_x x1 x2 x3 x4 x5 x6))) (x4) (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `w = (e1 * sqrt x1 * ups_x x2 x3 x4 - e2 * sqrt x2 * delta_x6 x1 x2 x3 x4 x5 x6 - e3 * sqrt x3 * delta_x5 x1 x2 x3 x4 x5 x6) / (ups_x x2 x3 x4 * sqrt (delta_x x1 x2 x3 x4 x5 x6))`; + TYPIFY_GOAL_THEN `!q. e1 * dih_x x1 x2 x3 q x5 x6 + e2 * dih_x x2 x3 x1 x5 x6 q + e3 * dih_x x3 x1 x2 x6 q x5 = e1 * (\q. dih_x x1 x2 x3 q x5 x6) q + e2 * (\q. dih_x x2 x3 x1 x5 x6 q) q + e3 * (\q. dih_x x3 x1 x2 x6 q x5) q` (unlist PURE_REWRITE_TAC); + BY(REWRITE_TAC[]); + TYPED_ABBREV_TAC `f1 = (\q. dih_x x1 x2 x3 q x5 x6)` ; + TYPED_ABBREV_TAC `f2 = (\q. dih_x x2 x3 x1 x5 x6 q)` ; + TYPED_ABBREV_TAC `f3 = (\q. dih_x x3 x1 x2 x6 q x5)` ; + DERIVED_TAC (MP_TAC o GEN_ALL o (GENL [`x1:real`;`x2:real`;`x3:real`;`x4:real`;`x5:real`;`x6:real`;`e1:real`;`e2:real`;`e3:real`])); + DISCH_THEN (C INTRO_TAC [`f1`;`f2`;`f3`]); + EXPAND_TAC "f1"; + DISCH_THEN (C INTRO_TAC [`(sqrt x1 / sqrt (delta_x x1 x2 x3 x4 x5 x6))`;`(--sqrt x2 * delta_x5 x2 x3 x1 x5 x6 x4 / (ups_x x2 x3 x4 * sqrt (delta_x x2 x3 x1 x5 x6 x4)))`;` (--sqrt x3 * delta_x6 x3 x1 x2 x6 x4 x5 / (ups_x x3 x2 x4 * sqrt (delta_x x3 x1 x2 x6 x4 x5)))`;`x1`;`x2`;`x3`;`x4`;`x5`;`x6`;`e1`;`e2`;`e3`]); + ASM_SIMP_TAC[derived_form_dih_x_wrt_x4]; + TYPIFY `delta_x x2 x3 x1 x5 x6 x4 = delta_x x1 x2 x3 x4 x5 x6 /\ delta_x x3 x1 x2 x6 x4 x5 = delta_x x1 x2 x3 x4 x5 x6` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Merge_ineq.delta_x_sym]); + TYPIFY `ups_x x2 x1 x6 = ups_x x1 x2 x6 /\ ups_x x3 x1 x5 = ups_x x1 x3 x5 /\ ups_x x3 x2 x4 = ups_x x2 x3 x4` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Merge_ineq.ups_x_sym]); + ONCE_REWRITE_TAC[derived_form_b]; + ANTS_TAC; + EXPAND_TAC "f2"; + EXPAND_TAC "f3"; + CONJ_TAC; + MATCH_MP_TAC derived_form_dih_x_wrt_x6; + BY(ASM_REWRITE_TAC[]); + MATCH_MP_TAC derived_form_dih_x_wrt_x5; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[]; + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + ASM_REWRITE_TAC[]; + TYPIFY `delta_x5 x2 x3 x1 x5 x6 x4 = delta_x6 x1 x2 x3 x4 x5 x6` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[Nonlin_def.delta_x5;Nonlin_def.delta_x6]; + BY(REAL_ARITH_TAC); + TYPIFY `delta_x6 x3 x1 x2 x6 x4 x5 = delta_x5 x1 x2 x3 x4 x5 x6` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[Nonlin_def.delta_x5;Nonlin_def.delta_x6]; + BY(REAL_ARITH_TAC); + TYPIFY `&0 < sqrt(delta_x x1 x2 x3 x4 x5 x6)` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC REAL_LT_RSQRT; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `e1 * sqrt x1 / sqrt (delta_x x1 x2 x3 x4 x5 x6) + e2 * --sqrt x2 * delta_x6 x1 x2 x3 x4 x5 x6 / (ups_x x2 x3 x4 * sqrt (delta_x x1 x2 x3 x4 x5 x6)) + e3 * --sqrt x3 * delta_x5 x1 x2 x3 x4 x5 x6 / (ups_x x2 x3 x4 * sqrt (delta_x x1 x2 x3 x4 x5 x6)) = (e1 * sqrt x1 * ups_x x2 x3 x4 - e2 * sqrt x2 * delta_x6 x1 x2 x3 x4 x5 x6 - e3 * sqrt x3 * delta_x5 x1 x2 x3 x4 x5 x6) / (ups_x x2 x3 x4 * sqrt(delta_x x1 x2 x3 x4 x5 x6))` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + EXPAND_TAC "w"; + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let derived_form_sum_dih444 = prove_by_refinement( + `!x4 x5 x6 e1 e2 e3. + &0 < x4 /\ x4 < &16 /\ + &0 < x5 /\ x5 < &16 /\ + &0 < x6 /\ x6 < &16 /\ + &0 < delta_x (&4) (&4) (&4) x4 x5 x6 ==> + derived_form T (\q. e1 * dih_x (&4) (&4) (&4) q x5 x6 + + e2 * dih_x (&4) (&4) (&4) x5 x6 q + + e3 * dih_x (&4) (&4) (&4) x6 q x5) + (( num1 e1 e2 e3 x4 x5 x6 ) / (&2 * x4 * (&16 - x4) * sqrt(delta_x (&4) (&4) (&4) x4 x5 x6))) (x4) (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[arith `a / (&2 * b) = (a/ &2) / b`]; + INTRO_TAC derived_form_sum_dih [`&4`;`&4`;`&4`;`x4`;`x5`;`x6`;`e1`;`e2`;`e3`]; + TYPIFY_GOAL_THEN `!x. ups_x (&4) (&4) (x) = x * (&16 - x)` (unlist REWRITE_TAC); + ASM_REWRITE_TAC[Sphere.ups_x;arith `&0 < &4`]; + TYPIFY_GOAL_THEN `!x6. -- &4 * &4 - &4 * &4 - x6 * x6 + &2 * &4 * x6 + &2 * &4 * &4 + &2 * &4 * x6 = x6 * (&16- x6)` (unlist REWRITE_TAC); + BY(REAL_ARITH_TAC); + ANTS_TAC; + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL_EQ); + BY(ASM_TAC THEN REAL_ARITH_TAC); + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REWRITE_TAC[REAL_MUL_AC;Collect_geom2.SQRT4_EQ2]; + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + REWRITE_TAC[Sphere.num1;Nonlin_def.delta_x6;Nonlin_def.delta_x5]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let derived_form_sum_dih444sub = prove_by_refinement( + `!x4 x5 x6 e1 e2 e3. + &0 < x4 /\ x4 < &16 /\ + &0 < x5 /\ x5 < &16 /\ + &0 < x6 /\ x6 < &16 /\ + &0 < delta_x (&4) (&4) (&4) x4 x5 x6 ==> + derived_form T (\q. e1 * dih_x (&4) (&4) (&4) q x5 x6 + + e2 * dih_x (&4) (&4) (&4) x5 x6 q + + e3 * dih_x (&4) (&4) (&4) x6 q x5 - (&1 + const1) * pi) + (( num1 e1 e2 e3 x4 x5 x6 ) / (&2 * x4 * (&16 - x4) * sqrt(delta_x (&4) (&4) (&4) x4 x5 x6))) (x4) (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `f' = (num1 e1 e2 e3 x4 x5 x6 / (&2 * x4 * (&16 - x4) * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)))`; + INTRO_TAC (GEN_ALL Calc_derivative.derived_form_sub) [`T`;`T`;`(\q. e1 * dih_x (&4) (&4) (&4) q x5 x6 + e2 * dih_x (&4) (&4) (&4) x5 x6 q + e3 * dih_x (&4) (&4) (&4) x6 q x5)`;`\ (q:real). (&1 + const1)*pi`;`f'`;`&0`;`x4`;`(:real)`]; + ASM_REWRITE_TAC[arith `f' - &0 = f'`;arith `(a + b) - c = a + b - c`]; + DISCH_THEN MATCH_MP_TAC; + EXPAND_TAC "f'"; + ASM_SIMP_TAC[derived_form_sum_dih444]; + DERIVED_TAC MP_TAC; + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let derived_form_tau2D = prove_by_refinement( + `!x4 x5 x6 e1 e2 e3. + &0 < x4 /\ x4 < &16 /\ + &0 < x5 /\ x5 < &16 /\ + &0 < x6 /\ x6 < &16 /\ + &0 < delta_x (&4) (&4) (&4) x4 x5 x6 /\ + num1 e1 e2 e3 x4 x5 x6 = &0 ==> + derived_form T + (\q. ( num1 e1 e2 e3 q x5 x6) / (&2 * q * (&16 - q) * sqrt(delta_x (&4) (&4) (&4) q x5 x6))) + ((&4 * dnum1 e1 e2 e3 x4 x5 x6) / + (&2 * x4 * (&16 - x4) * sqrt(delta_x (&4) (&4) (&4) x4 x5 x6))) + (x4) (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY ` (\q. ( num1 e1 e2 e3 q x5 x6) / (&2 * q * (&16 - q) * sqrt(delta_x (&4) (&4) (&4) q x5 x6))) = (\q. (\q. num1 e1 e2 e3 q x5 x6) q / (\q. &2 * q * (&16 - q) * sqrt(delta_x (&4) (&4) (&4) q x5 x6)) q) ` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[FUN_EQ_THM]); + TYPED_ABBREV_TAC `(f:real->real) = (\q. num1 e1 e2 e3 q x5 x6 )` ; + TYPED_ABBREV_TAC `(g:real->real) = (\q. &2 * q * (&16 - q) * sqrt (delta_x (&4) (&4) (&4) q x5 x6))` ; + DERIVED_TAC (MP_TAC o GEN_ALL); + MP_TAC (diff `(\q. &2 * q * (&16 - q) * sqrt (delta_x (&4) (&4) (&4) q x5 x6))` [Sphere.delta_x] `x4:real` `(:real)`); + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPED_ABBREV_TAC `(g':real) = (&2 * (x4 * ((&16 - x4) * (&4 * (x4 * -- &1 + -- &4 + &4 + &4 - x4 + x5 + x6) + &4 * x5 + &4 * x6 - &4 * &4 - x5 * x6) * inv (&2 * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)) + -- &1 * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)) + (&16 - x4) * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)))` ; + DISCH_THEN (C INTRO_TAC [`&4 * dnum1 e1 e2 e3 x4 x5 x6`;`f`;`g'`;`g`;`x4`]); + ASM_REWRITE_TAC[]; + EXPAND_TAC "f"; + REWRITE_TAC[derived_form_dnum1]; + EXPAND_TAC "g"; + ASM_REWRITE_TAC[arith `&0 * x = &0 /\ &0 / x = &0 /\ x - &0 = x`]; + ONCE_REWRITE_TAC[derived_form_b]; + TYPIFY `~(&2 * x4 * (&16 - x4) * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6) = &0)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[REAL_ENTIRE;DE_MORGAN_THM]; + TYPIFY_GOAL_THEN `~(sqrt(delta_x (&4) (&4) (&4) x4 x5 x6) = &0)` (unlist REWRITE_TAC); + GMATCH_SIMP_TAC SQRT_EQ_0; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + TYPED_ABBREV_TAC `d = (&2 * x4 * (&16 - x4) * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6))` ; + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + Calc_derivative.CALC_ID_TAC; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let derived_form_taum_d3_exists = prove_by_refinement( + `!x4 x5 x6 e1 e2 e3. ?f'' f'''. + &0 < x4 /\ x4 < &16 /\ + &0 < x5 /\ x5 < &16 /\ + &0 < x6 /\ x6 < &16 /\ + &0 < delta_x (&4) (&4) (&4) x4 x5 x6 ==> + (!x4. &0 < x4 /\ x4 < &16 /\ &0 < delta_x (&4) (&4) (&4) x4 x5 x6 ==> + derived_form T + (\q. ( num1 e1 e2 e3 q x5 x6 ) / (&2 * q * (&16 - q) * sqrt(delta_x (&4) (&4) (&4) q x5 x6))) (f'' x4) (x4) (:real)) /\ + (derived_form T f'' f''' x4 (:real))`, + (* {{{ proof *) + [ + + REPEAT WEAKER_STRIP_TAC; + TYPIFY `\q. (((&4 * dnum1 e1 e2 e3 q x5 x6) * &2 * q * (&16 - q) * sqrt (delta_x (&4) (&4) (&4) q x5 x6) - num1 e1 e2 e3 q x5 x6 * &2 * (q * ((&16 - q) * delta_x4 (&4) (&4) (&4) q x5 x6 * inv (&2 * sqrt (delta_x (&4) (&4) (&4) q x5 x6)) + -- &1 * sqrt (delta_x (&4) (&4) (&4) q x5 x6)) + (&16 - q) * sqrt (delta_x (&4) (&4) (&4) q x5 x6))) / (&2 * q * (&16 - q) * sqrt (delta_x (&4) (&4) (&4) q x5 x6)) pow 2)` EXISTS_TAC; + TYPIFY `(((((&4 * ((&16 - &2 * x4) * e1 + (x5 - &8) * e2 + (x6 - &8) * e3)) * &2 * (x4 * ((&16 - x4) * delta_x4 (&4) (&4) (&4) x4 x5 x6 * inv (&2 * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)) + -- &1 * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)) + (&16 - x4) * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)) + (&4 * -- &2 * e1) * &2 * x4 * (&16 - x4) * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)) - (num1 e1 e2 e3 x4 x5 x6 * &2 * ((x4 * (((&16 - x4) * (delta_x4 (&4) (&4) (&4) x4 x5 x6 * (&2 * delta_x4 (&4) (&4) (&4) x4 x5 x6 * inv (&2 * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6))) * --inv ((&2 * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)) pow 2) + (-- &2 * &4) * inv (&2 * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6))) + -- &1 * delta_x4 (&4) (&4) (&4) x4 x5 x6 * inv (&2 * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6))) + -- &1 * delta_x4 (&4) (&4) (&4) x4 x5 x6 * inv (&2 * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6))) + (&16 - x4) * delta_x4 (&4) (&4) (&4) x4 x5 x6 * inv (&2 * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)) + -- &1 * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)) + (&16 - x4) * delta_x4 (&4) (&4) (&4) x4 x5 x6 * inv (&2 * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)) + -- &1 * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)) + (&4 * dnum1 e1 e2 e3 x4 x5 x6) * &2 * (x4 * ((&16 - x4) * delta_x4 (&4) (&4) (&4) x4 x5 x6 * inv (&2 * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)) + -- &1 * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)) + (&16 - x4) * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)))) * (&2 * x4 * (&16 - x4) * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)) pow 2 - ((&4 * ((&16 - &2 * x4) * e1 + (x5 - &8) * e2 + (x6 - &8) * e3)) * &2 * x4 * (&16 - x4) * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6) - num1 e1 e2 e3 x4 x5 x6 * &2 * (x4 * ((&16 - x4) * delta_x4 (&4) (&4) (&4) x4 x5 x6 * inv (&2 * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)) + -- &1 * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)) + (&16 - x4) * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6))) * &2 * (&2 * x4 * (&16 - x4) * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)) pow 1 * &2 * (x4 * ((&16 - x4) * delta_x4 (&4) (&4) (&4) x4 x5 x6 * inv (&2 * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)) + -- &1 * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)) + (&16 - x4) * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6))) / (&2 * x4 * (&16 - x4) * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)) pow 4)` EXISTS_TAC; + REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[]; + DERIVED_TAC (MP_TAC o GEN_ALL); + DISCH_THEN (C INTRO_TAC [`(&4 * dnum1 e1 e2 e3 x4' x5 x6)`;`e1`;`e2`;`e3`;`delta_x4 (&4) (&4) (&4) x4' x5 x6`;`x5`;`x6`;`x4'`]); + REWRITE_TAC[derived_form_dnum1;derived_form_delta_x_wrt_x4]; + ONCE_REWRITE_TAC[derived_form_b]; + ANTS_TAC; + GMATCH_SIMP_TAC SQRT_EQ_0; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[]); + REWRITE_TAC[Nonlin_def.dnum1]; + DERIVED_TAC (MP_TAC o GEN_ALL); + DISCH_THEN (C INTRO_TAC [`delta_x4 (&4) (&4) (&4) x4 x5 x6`;`delta_x4 (&4) (&4) (&4) x4 x5 x6`;`-- &2 * &4`;`delta_x4 (&4) (&4) (&4) x4 x5 x6`;`delta_x4 (&4) (&4) (&4) x4 x5 x6`;`(&4 * dnum1 e1 e2 e3 x4 x5 x6)`;`e1`;`e2`;`e3`;`delta_x4 (&4) (&4) (&4) x4 x5 x6`;`x5`;`x6`;`x4`]); + REWRITE_TAC[derived_form_dnum1;derived_form_delta_x_wrt_x4;derived_form_delta_x4_wrt_x4]; + ONCE_REWRITE_TAC[derived_form_b]; + ANTS_TAC; + GMATCH_SIMP_TAC SQRT_EQ_0; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[]; + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + BY(REWRITE_TAC[Nonlin_def.dnum1]) + ]);; + (* }}} *) + +let delta_y_dim_reduction = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + (let x6' = &8 * (&1 - (y1 * y1 + y2*y2 - y6*y6)/(&2* y1 * y2)) in + let x5' = &8 * (&1 - (y1*y1 + y3*y3 - y5*y5)/(&2 * y1 * y3)) in + let x4' = &8 * (&1 - (y2*y2 + y3*y3 - y4*y4)/(&2*y2*y3)) in + (~(y1 = &0) /\ ~(y2 = &0) /\ ~(y3 = &0) ==> + delta_x (&4) (&4) (&4) x4' x5' x6' = &64 * delta_y y1 y2 y3 y4 y5 y6 / ((y1 * y2 * y3) pow 2))) +`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_THM]; + REWRITE_TAC[Sphere.delta_x;Sphere.delta_y]; + BY(CONV_TAC REAL_FIELD) + ]);; + (* }}} *) + +let delta_x_xrr = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + (~(y1 = &0) /\ ~(y2 = &0) /\ ~(y3 = &0) ==> + delta_x (&4) (&4) (&4) (xrr y2 y3 y4) (xrr y1 y3 y5) (xrr y1 y2 y6) = + &64 * delta_y y1 y2 y3 y4 y5 y6 / ((y1 *y2 * y3) pow 2))`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.xrr]; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_SIMP_TAC[GSYM (REWRITE_RULE[LET_THM] delta_y_dim_reduction)]) + ]);; + (* }}} *) + +let delta_x4_dim_reduction = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + (let x6' = &8 * (&1 - (y1 * y1 + y2*y2 - y6*y6)/(&2* y1 * y2)) in + let x5' = &8 * (&1 - (y1*y1 + y3*y3 - y5*y5)/(&2 * y1 * y3)) in + let x4' = &8 * (&1 - (y2*y2 + y3*y3 - y4*y4)/(&2*y2*y3)) in + (~(y1 = &0) /\ ~(y2 = &0) /\ ~(y3 = &0) ==> + delta_x4 (&4) (&4) (&4) x4' x5' x6' = &16 * y_of_x delta_x4 y1 y2 y3 y4 y5 y6 / (y1 * y1 * y2 * y3))) + `, + (* {{{ proof *) + [ + REWRITE_TAC[LET_THM]; + REWRITE_TAC[Sphere.delta_x4;Sphere.y_of_x]; + BY(CONV_TAC REAL_FIELD) + ]);; + (* }}} *) + +let dih_x_dim_reduction = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + (let x6' = &8 * (&1 - (y1 * y1 + y2*y2 - y6*y6)/(&2* y1 * y2)) in + let x5' = &8 * (&1 - (y1*y1 + y3*y3 - y5*y5)/(&2 * y1 * y3)) in + let x4' = &8 * (&1 - (y2*y2 + y3*y3 - y4*y4)/(&2*y2*y3)) in + ((&0 < y1) /\ (&0 < y2) /\ (&0 < y3) /\ &0 < delta_y y1 y2 y3 y4 y5 y6 ==> + dih_x (&4) (&4) (&4) x4' x5' x6' = dih_y y1 y2 y3 y4 y5 y6)) +`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.dih_x;Sphere.dih_y;LET_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(y1 = &0) /\ ~(y2 = &0) /\ ~(y3 = &0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + ASM_SIMP_TAC[REWRITE_RULE[LET_THM] delta_x4_dim_reduction;REWRITE_RULE[LET_THM] delta_y_dim_reduction]; + REWRITE_TAC[GSYM Sphere.y_of_x]; + TYPIFY `sqrt (&4 * &4 * &64 * delta_y y1 y2 y3 y4 y5 y6 / (y1 * y2 * y3) pow 2) = &16 * sqrt (&4 * (y1 * y1) * y_of_x delta_x y1 y2 y3 y4 y5 y6) / (y1 * y1 * y2 * y3)` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `&0 < y1 * y1 * y2 * y3` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL); + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `y1 * y1 * y2 * y3 = sqrt((y1 * y1 * y2 * y3) pow 2)` (C SUBGOAL_THEN SUBST1_TAC); + GMATCH_SIMP_TAC POW_2_SQRT; + BY(ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`]); + GMATCH_SIMP_TAC (GSYM SQRT_MUL); + REWRITE_TAC[ REAL_LE_POW_2]; + GMATCH_SIMP_TAC (arith `&0 <= d/ y ==> &0 <= &4 * &4 * &64 * d / y`); + GMATCH_SIMP_TAC REAL_LE_RDIV_EQ; + CONJ_TAC; + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL); + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + REWRITE_TAC[REAL_ENTIRE]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `&16 * sqrt (&4 * (y1 * y1) * y_of_x delta_x y1 y2 y3 y4 y5 y6) = sqrt (&16 pow 2 * &4 * (y1 * y1) * y_of_x delta_x y1 y2 y3 y4 y5 y6)` (C SUBGOAL_THEN SUBST1_TAC); + TYPIFY `&16 = sqrt(&16 pow 2)` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[POW_2_SQRT_ABS]; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC (GSYM SQRT_MUL); + CONJ_TAC; + CONJ_TAC; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC (arith `&0 <= x ==> &0 <= &4 * x`); + GMATCH_SIMP_TAC REAL_LE_MUL; + REWRITE_TAC[ REAL_LE_SQUARE]; + REWRITE_TAC[Sphere.y_of_x;Sphere.delta_x;GSYM Sphere.delta_y]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + AP_TERM_TAC; + REWRITE_TAC[POW_2_SQRT_ABS]; + BY(REAL_ARITH_TAC); + REWRITE_TAC[arith `s - s' = &0 <=> s = s'`]; + AP_TERM_TAC; + REWRITE_TAC[Sphere.y_of_x;Sphere.delta_x;GSYM Sphere.delta_y]; + Calc_derivative.CALC_ID_TAC; + BY(ASM_REWRITE_TAC[]); + TYPED_ABBREV_TAC `dx = y_of_x delta_x y1 y2 y3 y4 y5 y6` ; + TYPED_ABBREV_TAC `d4 = y_of_x delta_x4 y1 y2 y3 y4 y5 y6 ` ; + TYPED_ABBREV_TAC `s = sqrt(&4 * (y1 * y1) * dx)` ; + REWRITE_TAC[arith `&16 * s / y = (&16 / y) * s`]; + REWRITE_TAC[arith `-- (a * d4) = a * -- d4`]; + GMATCH_SIMP_TAC Trigonometry1.ATN2_LMUL_EQ; + GMATCH_SIMP_TAC REAL_LT_DIV; + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL); + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let KPIDBQH = dih_x_dim_reduction;; + +let derived_form_xrr = prove_by_refinement( + `!y1 y2 y6. + derived_form (&0 < y1 /\ &0 < y2) + (\q. xrr y1 y2 q) ((&8 * y6) / (y1 * y2)) y6 (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_CASES_TAC `~(&0 < y1 /\ &0 < y2)`; + BY(ASM_REWRITE_TAC[Pent_hex.derived_form_F]); + RULE_ASSUM_TAC (REWRITE_RULE[]); + ASM_REWRITE_TAC[Appendix.xrr]; + DERIVED_TAC MP_TAC; + TYPIFY `~(y1 = &0) /\ ~(y2 = &0) /\ ~(&2 = &0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + Calc_derivative.CALC_ID_TAC; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let derived_form_xrr_wrt_y1 = prove_by_refinement( + `!y1 y2 y6. + derived_form (&0 < y1 /\ &0 < y2) + (\q. xrr q y2 y6) ( -- &4 * ((y1*y1 + y6*y6 - y2*y2)/ (y1 pow 2 * y2))) y1 (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_CASES_TAC `~(&0 < y1 /\ &0 < y2)`; + BY(ASM_REWRITE_TAC[Pent_hex.derived_form_F]); + RULE_ASSUM_TAC (REWRITE_RULE[]); + ASM_REWRITE_TAC[Appendix.xrr]; + DERIVED_TAC MP_TAC; + TYPIFY `~(y1 = &0) /\ ~(y2 = &0) /\ ~(&2 = &0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + Calc_derivative.CALC_ID_TAC; + (ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let derived_form_xrr_D2 = prove_by_refinement( + `!y1 y2 y6. + derived_form (&0 < y1 /\ &0 < y2) + (\q. (&8* q) / (y1 *y2)) (&8 / (y1 * y2)) y6 (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_CASES_TAC `~(&0 < y1 /\ &0 < y2)`; + BY(ASM_REWRITE_TAC[Pent_hex.derived_form_F]); + RULE_ASSUM_TAC (REWRITE_RULE[]); + ASM_REWRITE_TAC[]; + DERIVED_TAC MP_TAC; + ONCE_REWRITE_TAC[derived_form_b]; + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + Calc_derivative.CALC_ID_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let derived_form_xrr_D3 = prove_by_refinement( + `!y1 y2 y6. + derived_form (&0 < y1 /\ &0 < y2) + (\q. (&8) / (y1 *y2)) (&0) y6 (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_CASES_TAC `~(&0 < y1 /\ &0 < y2)`; + BY(ASM_REWRITE_TAC[Pent_hex.derived_form_F]); + RULE_ASSUM_TAC (REWRITE_RULE[]); + ASM_REWRITE_TAC[]; + DERIVED_TAC MP_TAC; + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let DRNDRDV = derived_form_xrr;; + +let derived_form_unique = prove_by_refinement( + `!f f' f'' x. + derived_form T f f' x (:real) /\ derived_form T f f'' x (:real) ==> + (f' = f'')`, + (* {{{ proof *) + [ + REWRITE_TAC[Calc_derivative.derived_form;WITHINREAL_UNIV]; + BY(MESON_TAC[REAL_DERIVATIVE_UNIQUE_ATREAL]) + ]);; + (* }}} *) + +let derived_form_chain = prove_by_refinement( + `!f f' g g' x y. + f x = y /\ + derived_form T f f' x (:real) /\ + derived_form T g g' y (:real) ==> + derived_form T (g o f) (g' * f') x (:real) +`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + TYPIFY `g o f = \q. g(f(q))` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[FUN_EQ_THM;o_THM]); + REPEAT WEAKER_STRIP_TAC; + MP_TAC (GEN_ALL (Calc_derivative.differentiate `(\(q:real). (g:real->real) (f q))` `x:real` `(:real)`)); + DISCH_THEN (C INTRO_TAC [`g`;`f`;`f'`;`g'`;`x`]); + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[REAL_MUL_AC]) + ]);; + (* }}} *) + +let derived_form_chain_old = prove_by_refinement( + `!f f' g g' h' x y. + f x = y /\ + derived_form T f f' x (:real) /\ + derived_form T g g' y (:real) /\ + derived_form T (g o f) h' x (:real) ==> + h' = g' * f' +`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + TYPIFY `g o f = \q. g(f(q))` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[FUN_EQ_THM;o_THM]); + REPEAT WEAKER_STRIP_TAC; + MP_TAC (GEN_ALL (Calc_derivative.differentiate `(\(q:real). (g:real->real) (f q))` `x:real` `(:real)`)); + DISCH_THEN (C INTRO_TAC [`g`;`f`;`f'`;`g'`;`x`]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `h' = f' * g'` (C SUBGOAL_THEN SUBST1_TAC); + INTRO_TAC derived_form_unique [`(\q. g (f q))`;`h'`;`f'*g'`;`x`]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let xrr_sym = prove_by_refinement( + `!y1 y2 y6. xrr y1 y2 y6 = xrr y2 y1 y6`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.xrr]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[REAL_MUL_AC]; + BY(REWRITE_TAC[arith `x + y -z = (x + y) -z`;REAL_ADD_AC]) + ]);; + (* }}} *) + +let taum_compose_xrr = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + (let e1 = rho y1 in + let e2 = rho y2 in + let e3 = rho y3 in + let x5 = xrr y1 y3 y5 in + let x6 = xrr y1 y2 y6 in + ( &0 < y1 /\ &0 < y2 /\ &0 < y3 /\ &0 < delta_y y1 y2 y3 y4 y5 y6 ==> + (\q. taum y1 y2 y3 q y5 y6) y4 = + ((\q. e1 * dih_x (&4) (&4) (&4) q x5 x6 + + e2 * dih_x (&4) (&4) (&4) x5 x6 q + + e3 * dih_x (&4) (&4) (&4) x6 q x5 - (&1 + const1) * pi) o + (\q. xrr y2 y3 q)) y4))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REWRITE_TAC[o_THM;Nonlinear_lemma.taum_123]; + REWRITE_TAC[Sphere.rhazim;Sphere.rhazim2;Sphere.rhazim3;Sphere.node2_y;Sphere.node3_y]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `dih_x (&4) (&4) (&4) (xrr y1 y3 y5) (xrr y1 y2 y6) (xrr y2 y3 y4) = dih_x (&4) (&4) (&4) (xrr y1 y3 y5) (xrr y2 y3 y4) (xrr y2 y1 y6)` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[xrr_sym;Nonlinear_lemma.dih_x_sym]); + TYPIFY `dih_x (&4) (&4) (&4) (xrr y1 y2 y6) (xrr y2 y3 y4) (xrr y1 y3 y5) = dih_x (&4) (&4) (&4) (xrr y1 y2 y6) (xrr y3 y2 y4) (xrr y3 y1 y5)` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[xrr_sym]); + REWRITE_TAC[Appendix.xrr]; + REPEAT (GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] dih_x_dim_reduction)); + ASM_REWRITE_TAC[]; + REWRITE_TAC[Nonlinear_lemma.dih_y_sym]; + FIRST_X_ASSUM MP_TAC; + BY(REWRITE_TAC[Merge_ineq.delta_y_sym;]) + ]);; + (* }}} *) + +let real_open_univ = prove_by_refinement( + `real_open (:real)`, + (* {{{ proof *) + [ + REWRITE_TAC[real_open;IN_UNIV]; + TYPIFY `&1` EXISTS_TAC; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let real_open_empty = prove_by_refinement( + `real_open ({})`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[real_open;NOT_IN_EMPTY]) + ]);; + (* }}} *) + +let real_open_delta_y = prove_by_refinement( + `!y1 y2 y3 y5 y6. real_open {y4 | &0 < y4 /\ &0 < delta_y y1 y2 y3 y4 y5 y6}`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Pent_hex.continuous_preimage_open [`(\q. delta_y y1 y2 y3 q y5 y6)`; `{y4 | &0 < y4}`;`{y | &0 < y}`]; + REWRITE_TAC[IN_ELIM_THM;]; + DISCH_THEN MATCH_MP_TAC; + TYPIFY_GOAL_THEN `real_open {u | &0 < u}` (unlist REWRITE_TAC); + BY(REWRITE_TAC[arith `a < b <=> b > a`;REAL_OPEN_HALFSPACE_GT]); + REWRITE_TAC[REAL_CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC REAL_CONTINUOUS_ATREAL_WITHINREAL; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL; + TYPIFY `?f. derived_form T (\q. delta_y y1 y2 y3 q y5 y6) f x (:real)` (C SUBGOAL_THEN MP_TAC); + REWRITE_TAC[Sphere.delta_y;Sphere.delta_x]; + TYPIFY `((y1 * y1) * ((x * x) * --(x + x) + (x + x) * (--(y1 * y1) + y2 * y2 + y3 * y3 - x * x + y5 * y5 + y6 * y6)) + (y2 * y2) * (y5 * y5) * (x + x) + (y3 * y3) * (y6 * y6) * (x + x) - (y2 * y2) * (y3 * y3) * (x + x) - (x + x) * (y5 * y5) * y6 * y6)` EXISTS_TAC; + DERIVED_TAC MP_TAC; + BY(REWRITE_TAC[]); + BY(REWRITE_TAC[Calc_derivative.derived_form;WITHINREAL_UNIV]) + ]);; + (* }}} *) + +let real_open_ups_y = prove_by_refinement( + `!y1 y2. real_open {y6 | &0 < ups_x (y1*y1) (y2*y2) (y6*y6) }`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Pent_hex.continuous_preimage_open [`(\q. ups_x (y1*y1) (y2*y2) (q*q))`; `(:real)`;`{y | &0 < y}`]; + REWRITE_TAC[IN_ELIM_THM;IN_UNIV]; + DISCH_THEN MATCH_MP_TAC; + TYPIFY_GOAL_THEN `real_open {u | &0 < u}` (unlist REWRITE_TAC); + BY(REWRITE_TAC[arith `a < b <=> b > a`;REAL_OPEN_HALFSPACE_GT]); + REWRITE_TAC[real_open_univ]; + REWRITE_TAC[REAL_CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC REAL_CONTINUOUS_ATREAL_WITHINREAL; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL; + TYPIFY `derived_form T ((\q. ups_x (y1 * y1) (y2 * y2) (q * q))) ((--((x * x) * (x + x) + (x + x) * x * x) + &2 * (y1 * y1) * (x + x) + &2 * (y2 * y2) * (x + x))) x (:real)` (C SUBGOAL_THEN MP_TAC); + REWRITE_TAC[Sphere.ups_x]; + DERIVED_TAC (MP_TAC); + BY(REWRITE_TAC[]); + (REWRITE_TAC[Calc_derivative.derived_form;WITHINREAL_UNIV]); + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let derived_form_local = prove_by_refinement( + `!f g g' s x b. + derived_form b g g' x (:real) /\ + real_open s /\ x IN s /\ + (!y. y IN s ==> f y = g y) ==> + derived_form b f g' x (:real) + `, + (* {{{ proof *) + [ + REWRITE_TAC[Calc_derivative.derived_form;WITHINREAL_UNIV]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Arc_properties.HAS_REAL_DERIVATIVE_LOCAL; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let xrr_factor = prove_by_refinement( + `!y1 y2 y6. + &0 < y1 /\ &0 < y2 ==> (xrr y1 y2 y6 = &4 * ((y6 + y2 - y1) * (y6 - y2 + y1))/(y1 * y2))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Appendix.xrr]; + Calc_derivative.CALC_ID_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let xrr_factor_8 = prove_by_refinement( + `!y1 y2 y6. + &0 < y1 /\ &0 < y2 ==> (&16 - xrr y1 y2 y6 = &4* ((y6 + y2 + y1) * ( y2 + y1- y6))/(y1 * y2))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Appendix.xrr]; + Calc_derivative.CALC_ID_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let xrr_pos = prove_by_refinement( + `!y1 y2 y6. + &0 < y1 /\ &0 < y2 /\ y1 < y2 + y6 /\ y2 < y1 + y6 ==> &0 < xrr y1 y2 y6`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Appendix.xrr]; + MATCH_MP_TAC (arith `&0 < x ==> &0 < &8 * x`); + TYPIFY `&1 - (y1 * y1 + y2 * y2 - y6 * y6) / (&2 * y1 * y2) = ((y6 + y2 - y1) * (y6 - y2 + y1))/(&2 * y1 * y2)` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LT_RDIV_EQ; + REWRITE_TAC[arith `&0 * x = &0`]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL_EQ); + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let xrr_lt_16 = prove_by_refinement( + `!y1 y2 y6. &0 < y1 /\ &0 < y2 /\ y6 < y1 + y2 /\ &0 < y6 ==> xrr y1 y2 y6 < &16`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Appendix.xrr]; + MATCH_MP_TAC (arith `&0 < &1 + u ==> &8 * (&1 - u) < &16`); + TYPIFY `&1 + (y1 * y1 + y2 * y2 - y6 * y6) / (&2 * y1 * y2) = ((y6 + y2 + y1) * ( y2 + y1- y6))/(&2 * y1 * y2)` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LT_RDIV_EQ; + REWRITE_TAC[arith `&0 * x = &0`]; + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL_EQ); + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let ups_x_triangle_ineq = prove_by_refinement( + `!y1 y2 y6. &0 < y1 /\ &0 < y2 /\ &0 < y6 ==> (&0 < ups_x (y1*y1) (y2*y2) (y6*y6) <=> + (y1 < y2 + y6 /\ y2 < y1 + y6 /\ y6 < y1 + y2))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `ups_x (y1*y1) (y2*y2) (y6*y6) = (y1 - y2 + y6) * (y1 + y2 - y6) * (-- y1 + y2 + y6) * (y1 + y2 + y6) ` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[Sphere.ups_x]; + BY(REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[REAL_MUL_POS_LT;arith `x * y < &0 <=> &0 < (--x ) * y`]; + ASM_CASES_TAC `y2 < y1 + y6`; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let xrr_bounds = prove_by_refinement( + `!y1 y2 y6. &0 < y1 /\ &0 < y2 /\ &0 < y6 /\ &0 < ups_x (y1*y1) (y2*y2) (y6*y6) ==> + (&0 < xrr y1 y2 y6 /\ xrr y1 y2 y6 < &16)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ups_x_triangle_ineq [`y1`;`y2`;`y6`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + CONJ_TAC; + MATCH_MP_TAC xrr_pos; + BY(ASM_REWRITE_TAC[]); + MATCH_MP_TAC xrr_lt_16; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let xrr_bounds_2 = prove_by_refinement( + `!y1 y2 y6. &0 < y1 /\ &0 < y2 /\ &0 < y6 ==> (&0 < ups_x (y1*y1) (y2*y2) (y6*y6) <=> + &0 < xrr y1 y2 y6 /\ xrr y1 y2 y6 < &16)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[ (TAUT `(a <=>b) <=> ((a ==> b) /\ (b ==> a) )`)]; + CONJ_TAC; + BY(ASM_MESON_TAC[xrr_bounds]); + ASM_SIMP_TAC[ups_x_triangle_ineq]; + ONCE_REWRITE_TAC[arith `x < &16 <=> &0 < &16- x`]; + ASM_SIMP_TAC[xrr_factor_8]; + ASM_SIMP_TAC[xrr_factor]; + ONCE_REWRITE_TAC[arith `&0 < &4 * x <=> &0 < x`]; + REPEAT (GMATCH_SIMP_TAC Trigonometry2.REAL_LT_DIV_0); + TYPIFY_GOAL_THEN `&0 < y1 * y2` (unlist REWRITE_TAC); + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[REAL_MUL_POS_LT]; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let xrr_le_16 = prove_by_refinement( + `!y1 y2 y6. &0 < y1 /\ &0 < y2 /\ &0 < y6 /\ &0 < ups_x (y1*y1) (y2*y2) (y6*y6) ==> + xrr y1 y2 y6 <= &16`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (arith `x < y ==> x <= y`); + BY(ASM_MESON_TAC[xrr_bounds_2]) + ]);; + (* }}} *) + +let arclength_xrr = prove_by_refinement( + `!y1 y2 y6. &0 < y1 /\ &0 < y2 /\ &0 < y6 /\ &0 < ups_x (y1*y1) (y2*y2) (y6*y6) ==> + arclength y1 y2 y6 = acs(&1 - xrr y1 y2 y6 / &8)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ups_x_triangle_ineq [`y1`;`y2`;`y6`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + REWRITE_TAC[Appendix.xrr]; + GMATCH_SIMP_TAC Trigonometry.PQQDENV; + ASM_SIMP_TAC[arith `a < b ==> a <= b`]; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + AP_TERM_TAC; + Calc_derivative.CALC_ID_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let TBRMXRZ1 = prove_by_refinement( +`!f f' g g' h' x y. + derived_form T f f' x (:real) /\ + derived_form T g g' y (:real) /\ + derived_form T (g o f) h' x (:real) /\ + &0 < f' /\ + f x = y ==> re_eqvl h' g'`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC derived_form_chain_old [`f`;`f'`;`g`;`g'`;`h'`;`x`;`y`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[Trigonometry2.re_eqvl]; + EXISTS_TAC `f':real`; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let TBRMXRZ2 = prove_by_refinement( +`!P Q f f' f'' g g' g'' h' h'' x y. + (P x) /\ (Q (f x)) /\ (y = f x) /\ &0 < f' x /\ h' x = &0 /\ + real_open {x | P x /\ Q (f x) } /\ + (!x. derived_form (P x) f (f' x) x (:real)) /\ + (!y. derived_form (Q( y)) g (g' y) y (:real)) /\ + (!x. derived_form (P x /\ Q (f x)) (g o f) (h' x) x (:real)) /\ + derived_form T f' f'' x (:real) /\ + derived_form T g' g'' y (:real) /\ + derived_form T h' h'' x (:real) ==> + re_eqvl h'' g''`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!x. P x /\ Q (f x) ==> h' x = g' (f x) * f' x` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC derived_form_chain_old [`f`;`f' x'`;`g`;`g' (f x')`;`h' x'`;`x'`;`f x'`]; + DISCH_THEN MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + RULE_ASSUM_TAC(ONCE_REWRITE_RULE[derived_form_b]); + BY(ASM_SIMP_TAC[]); + TYPIFY `derived_form T (\q. g' (f q) * f' q) h'' x (:real)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[Calc_derivative.derived_form;WITHINREAL_UNIV]; + MATCH_MP_TAC Arc_properties.HAS_REAL_DERIVATIVE_LOCAL; + TYPIFY `h'` EXISTS_TAC; + CONJ_TAC; + FIRST_X_ASSUM_ST `derived_form` MP_TAC; + BY(REWRITE_TAC[Calc_derivative.derived_form;WITHINREAL_UNIV]); + TYPIFY `{ x | P x /\ Q (f x)}` EXISTS_TAC; + ASM_REWRITE_TAC[IN_ELIM_THM]; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + MP_TAC (GEN_ALL (Calc_derivative.differentiate `(\(q:real). (g':real->real) (f q) * f' q)` `x:real` `(:real)`)); + DISCH_THEN (C INTRO_TAC [`g'`;`f`;`f''`;`f' x`;`g''`;`f'`;`x`]); + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `(derived_form T g' g'' (f x) (:real) /\ derived_form T f (f' x) x (:real))` (unlist REWRITE_TAC); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + RULE_ASSUM_TAC (ONCE_REWRITE_RULE[derived_form_b]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + INTRO_TAC derived_form_unique [`(\q. g' (f q) * f' q)`;`h''`;`(g' (f x) * f'' + (f' x * g'') * f' x)`;`x`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + INTRO_TAC TBRMXRZ1 [`f`;`f' x`;`g`;`g' y`;`h' x`;`x`;`y`]; + ANTS_TAC; + RULE_ASSUM_TAC (ONCE_REWRITE_RULE[derived_form_b]); + BY(ASM_MESON_TAC[]); + DISCH_TAC; + RULE_ASSUM_TAC(ONCE_REWRITE_RULE[Leaf_cell.RE_EQVL_SYM]); + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[Trigonometry2.re_eqvl]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `f' x * f' x` EXISTS_TAC; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let SECOND_CHAIN_GENERAL = prove_by_refinement( +`!P Q f f' f'' g g' g'' x y. + (P x) /\ (Q (f x)) /\ (f x = y) /\ + real_open {x | P x /\ Q (f x) } /\ + (!x. derived_form (P x) f (f' x) x (:real)) /\ + (!y. derived_form (Q( y)) g (g' y) y (:real)) /\ + derived_form T f' f'' x (:real) /\ + derived_form T g' g'' y (:real) ==> + derived_form T (\q. g' (f q) * f' q) (g' y * f'' + g'' * f' x pow 2 ) x (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MP_TAC (GEN_ALL (Calc_derivative.differentiate `(\(q:real). (g':real->real) (f q) * f' q)` `x:real` `(:real)`)); + DISCH_THEN (C INTRO_TAC [`g'`;`f`;`f''`;`f' x`;`g''`;`f'`;`x`]); + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[derived_form_b]; + ANTS_TAC; + RULE_ASSUM_TAC (ONCE_REWRITE_RULE[derived_form_b]); + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let SECOND_CHAIN_CRITICAL = prove_by_refinement( +`!P Q f f' f'' g g' g'' x y. + (P x) /\ (Q (f x)) /\ (f x = y) /\ g' y = &0 /\ + real_open {x | P x /\ Q (f x) } /\ + (!x. derived_form (P x) f (f' x) x (:real)) /\ + (!y. derived_form (Q( y)) g (g' y) y (:real)) /\ + derived_form T f' f'' x (:real) /\ + derived_form T g' g'' y (:real) ==> + derived_form T (\q. g' (f q) * f' q) (g'' * (f' x) pow 2) x (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MP_TAC (GEN_ALL (Calc_derivative.differentiate `(\(q:real). (g':real->real) (f q) * f' q)` `x:real` `(:real)`)); + DISCH_THEN (C INTRO_TAC [`g'`;`f`;`f''`;`f' x`;`g''`;`f'`;`x`]); + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[derived_form_b]; + ANTS_TAC; + RULE_ASSUM_TAC (ONCE_REWRITE_RULE[derived_form_b]); + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let THIRD_CHAIN_GENERAL = prove_by_refinement( +`!P Q f f' f'' f''' g g' g'' g''' x y. + (P x) /\ (Q (f x)) /\ (f x = y) /\ + real_open {x | P x /\ Q (f x) } /\ + (!x. derived_form (P x) f (f' x) x (:real)) /\ + (!y. derived_form (Q( y)) g (g' y) y (:real)) /\ + (!x. derived_form (P x) f' (f'' x) x (:real)) /\ + (!y. derived_form (Q y) g' (g'' y) y (:real)) /\ + derived_form (P x) f'' f''' x (:real) /\ + derived_form (Q y) g'' g''' y (:real) + ==> + (?h'''. derived_form T (\ (q:real). (g' (f q) * f'' q + g'' (f q) * f' q pow 2 )) h''' x (:real))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `(g' y * f''' + (f' x * g'' y) * f'' x) + g'' y * &2 * f' x pow 1 * f'' x + (f' x * g''') * f' x pow 2` EXISTS_TAC; + MP_TAC (GEN_ALL (Calc_derivative.differentiate `(\ (q:real). (g' ((f:real->real) q) * f'' q + g'' (f q) * f' q pow 2 ))` `x:real` `(:real)`)); + DISCH_THEN (C INTRO_TAC [`g'`; `f'''`;`f' x`;`g'' y`; `f''`;`g''`;`f`; `f'' x`;`f' x`;`g'''`;`f'`;`x`]); + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[derived_form_b]; + ANTS_TAC; + RULE_ASSUM_TAC (ONCE_REWRITE_RULE[derived_form_b]); + BY(ASM_MESON_TAC[]); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let SECOND_CHAIN_CONTINUOUS = prove_by_refinement( +`!P Q f f' f'' f''' g g' g'' g''' x y. + (P x) /\ (Q (f x)) /\ (f x = y) /\ + real_open {x | P x /\ Q (f x) } /\ + (!x. derived_form (P x) f (f' x) x (:real)) /\ + (!y. derived_form (Q( y)) g (g' y) y (:real)) /\ + (!x. derived_form (P x) f' (f'' x) x (:real)) /\ + (!y. derived_form (Q y) g' (g'' y) y (:real)) /\ + derived_form (P x) f'' f''' x (:real) /\ + derived_form (Q y) g'' g''' y (:real) + ==> + (\ (q:real). (g' (f q) * f'' q + g'' (f q) * f' q pow 2 )) real_continuous atreal x`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL; + INTRO_TAC THIRD_CHAIN_GENERAL [`P`;`Q`;`f`;`f'`;`f''`;`f'''`;`g`;`g'`;`g''`;`g'''`;`x`;`y`]; + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[Calc_derivative.derived_form;WITHINREAL_UNIV]) + ]);; + (* }}} *) + +let SECOND_DERIVATIVE_TEST_COMPOSE = prove_by_refinement( + `!P Q x y s f f' f'' f''' g g' g'' g'''. + P x /\ Q (f x) /\ (f x = y) /\ &0 < f' x /\ + s SUBSET {x | P x /\ Q (f x)} /\ + real_open {x | P x /\ Q (f x) } /\ + real_open s /\ x IN s /\ + (!x'. x' IN s ==> g(f x) <= g(f x') ) /\ + (!x. derived_form (P x) f (f' x) x (:real)) /\ + (!x. derived_form (P x) f' (f'' x) x (:real)) /\ + derived_form (P x) f'' f''' x (:real) /\ + (!y. derived_form (Q( y)) g (g' y) y (:real)) /\ + (!y. derived_form (Q y) g' (g'' y) y (:real)) /\ + derived_form (Q y) g'' g''' y (:real) ==> + (g' y = &0 /\ &0 <= g'' y) + `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Pent_hex.SECOND_DERIVATIVE_TEST [`g o f`;`(\q. g' (f q) * f' q)`;`(\ (q:real). (g' (f q) * f'' q + g'' (f q) * f' q pow 2 ))`;`x`;`s`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `(\q. g' (f q) * f'' q + g'' (f q) * f' q pow 2) real_continuous atreal x` (unlist REWRITE_TAC); + MATCH_MP_TAC SECOND_CHAIN_CONTINUOUS; + BY(ASM_MESON_TAC[]); + TYPIFY_GOAL_THEN `(!x'. x' IN s ==> (g o f) x <= (g o f) x')` (unlist REWRITE_TAC); + BY(ASM_MESON_TAC[o_THM]); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC derived_form_chain [`f`;`f' x'`;`g`;`g' (f x')`;`x'`;`f x'`]; + RULE_ASSUM_TAC (ONCE_REWRITE_RULE[derived_form_b]); + ANTS_TAC; + TYPIFY `P x' /\ Q(f x')` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_TAC THEN SET_TAC[]); + BY(ASM_MESON_TAC[]); + BY(REWRITE_TAC[Calc_derivative.derived_form;WITHINREAL_UNIV]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `P x' /\ Q(f x')` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_TAC THEN SET_TAC[]); + INTRO_TAC SECOND_CHAIN_GENERAL [`P`;`Q`;`f`;`f'`;`f'' x'`;`g`;`g'`;`g'' (f x')`;`x'`;`f x'`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + RULE_ASSUM_TAC(ONCE_REWRITE_RULE[derived_form_b]); + BY(ASM_MESON_TAC[]); + BY(ASM_REWRITE_TAC[Calc_derivative.derived_form;WITHINREAL_UNIV]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + SUBCONJ_TAC; + FIRST_X_ASSUM_ST `gf = &0` MP_TAC; + REWRITE_TAC[REAL_ENTIRE]; + BY(ASM_SIMP_TAC[arith `&0 < f' ==> ~(f' = &0)`]); + DISCH_TAC; + FIRST_X_ASSUM_ST `&0 <= stuff` MP_TAC; + ASM_REWRITE_TAC[]; + ASM_REWRITE_TAC[arith `&0 * x + u = u`]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Real_ext.REAL_PROP_NN_RCANCEL; + TYPIFY `f' x pow 2` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `x pow 2 = x * x`]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let REAL_OPEN_REAL_INTERVAL = prove_by_refinement( + `!a b. real_open(real_interval(a,b))`, + (* {{{ proof *) + [ + REWRITE_TAC[real_open;IN_REAL_INTERVAL]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `real_min (x - a) (b - x)` EXISTS_TAC; + REWRITE_TAC[real_min]; + COND_CASES_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let delta_y_pos_xrr = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. &0 < y1 /\ &0 < y2 /\ &0 < y3 ==> + (&0 < delta_y y1 y2 y3 y4 y5 y6 <=> + &0 < delta_x (&4) (&4) (&4) (xrr y2 y3 y4) (xrr y1 y3 y5) (xrr y1 y2 y6)) `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC delta_x_xrr; + ASM_SIMP_TAC[arith `&0 < y ==> ~(y= &0)`]; + REWRITE_TAC[arith `&0 < &64 * x <=> &0 < x`]; + GMATCH_SIMP_TAC Trigonometry2.REAL_LT_DIV_0; + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + REWRITE_TAC[REAL_ENTIRE]; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let xrr_convert = prove_by_refinement( + `!y1 y2 y3 y5 y6. &0 < y1 /\ &0 < y2 /\ &0 < y3 /\ &0 < y5 /\ &0 < y6 /\ + &0 < ups_x (y1*y1) (y3*y3) (y5*y5) /\ &0 < ups_x (y1*y1) (y2*y2) (y6*y6) ==> + { y | &0 < y /\ &0 < xrr y2 y3 y /\ xrr y2 y3 y < &16 /\ + &0 < delta_x (&4) (&4) (&4) (xrr y2 y3 y) (xrr y1 y3 y5) (xrr y1 y2 y6)} = + { y | &0 < y /\ &0 < ups_x (y2*y2) (y3*y3) (y*y) /\ &0 < delta_y y1 y2 y3 y y5 y6 }`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[FUN_EQ_THM;IN_ELIM_THM]; + GEN_TAC; + ASM_CASES_TAC `~(&0 + dnum1 (rho y1) (rho y2) (rho y3) (xrr y2 y3 y4) (xrr y1 y3 y5) (xrr y1 y2 y6) < &0) ==> + (?y4'. y4' IN real_interval(a,b) /\ taum y1 y2 y3 y4' y5 y6 < taum y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + RULE_ASSUM_TAC (REWRITE_RULE[NOT_EXISTS_THM;TAUT `~(a /\ b) <=> (a ==> ~b)`]); + RULE_ASSUM_TAC (REWRITE_RULE[arith `~(x < y) <=> y <= x`]); + COMMENT "set up second derivative"; + TYPED_ABBREV_TAC `x4 = xrr y2 y3 y4` ; + TYPED_ABBREV_TAC `x5 = xrr y1 y3 y5` ; + TYPED_ABBREV_TAC `x6 = xrr y1 y2 y6` ; + TYPED_ABBREV_TAC `e1 = rho y1` ; + TYPED_ABBREV_TAC `e2 = rho y2` ; + TYPED_ABBREV_TAC `e3 = rho y3` ; + TYPIFY `&0 < y4 /\ &0 < ups_x (y2 * y2) (y3*y3) (y4*y4) /\ &0 < delta_y y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN ASSUME_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[SUBSET;IN_ELIM_THM]); + BY(ASM_MESON_TAC[]); + TYPIFY `&0 < x5 /\ x5 < &16 /\ &0 < x4 /\ x4 < &16 /\ &0 < x6 /\ x6 < &16` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[xrr_bounds]); + TYPIFY `&0 < delta_x (&4) (&4) (&4) x4 x5 x6` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "x4"; + EXPAND_TAC "x5"; + EXPAND_TAC "x6"; + GMATCH_SIMP_TAC delta_x_xrr; + ASM_SIMP_TAC[arith `&0 < y ==> ~(y = &0)`]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_DIV; + ASM_REWRITE_TAC[arith `&0 < &64`]; + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + REWRITE_TAC[REAL_ENTIRE]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + INTRO_TAC derived_form_taum_d3_exists [`x4`;`x5`;`x6`;`e1`;`e2`;`e3`]; + DISCH_THEN (X_CHOOSE_TAC `g'':real->real`); + FIRST_X_ASSUM (X_CHOOSE_TAC `g''':real`); + FIRST_X_ASSUM MP_TAC THEN ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "introduce second derivative test"; + INTRO_TAC SECOND_DERIVATIVE_TEST_COMPOSE [`\ (y4:real). &0 < y4` ;`\ (x:real). &0 < x /\ x < &16 /\ &0 < delta_x (&4) (&4) (&4) x x5 x6` ;`y4`;`xrr y2 y3 y4`;`real_interval(a,b)`;`(\q. xrr y2 y3 q)`;`\q. (&8 * q) / (y2*y3)`;`\ (q:real). (&8) / (y2 * y3)`;`&0`;`(\q. e1 * dih_x (&4) (&4) (&4) q x5 x6 + e2 * dih_x (&4) (&4) (&4) x5 x6 q + e3 * dih_x (&4) (&4) (&4) x6 q x5 - (&1 + const1) * pi) `;`(\q. ( num1 e1 e2 e3 q x5 x6) / (&2 * q * (&16 - q) * sqrt(delta_x (&4) (&4) (&4) q x5 x6))) `;`g''`;`g'''`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[ONCE_REWRITE_RULE[derived_form_b] derived_form_xrr_D3]; + ASM_SIMP_TAC[ONCE_REWRITE_RULE[derived_form_b] derived_form_xrr_D2]; + ASM_SIMP_TAC[ONCE_REWRITE_RULE[derived_form_b] derived_form_xrr]; + CONJ_TAC; + GMATCH_SIMP_TAC REAL_LT_DIV; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + REWRITE_TAC[REAL_OPEN_REAL_INTERVAL]; + SUBCONJ_TAC; + EXPAND_TAC "x5"; + EXPAND_TAC "x6"; + ASM_SIMP_TAC[xrr_convert]; + FIRST_X_ASSUM_ST `SUBSET` MP_TAC; + BY(SET_TAC[]); + DISCH_TAC; + CONJ_TAC; + EXPAND_TAC "x5"; + EXPAND_TAC "x6"; + ASM_SIMP_TAC[xrr_convert]; + TYPIFY `{x | &0 < x /\ &0 < ups_x (y2 * y2) (y3 * y3) (x * x) /\ &0 < delta_y y1 y2 y3 x y5 y6} = {x | &0 < x /\ &0 < delta_y y1 y2 y3 x y5 y6} INTER {x | &0 < ups_x (y2 * y2) (y3 * y3) (x * x) }` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + MATCH_MP_TAC REAL_OPEN_INTER; + REWRITE_TAC[real_open_ups_y]; + BY(REWRITE_TAC[real_open_delta_y]); + COMMENT "continue working on ants"; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `taum` (C INTRO_TAC [`x'`]); + ASM_REWRITE_TAC[]; + REPEAT (GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] taum_compose_xrr)); + ASM_REWRITE_TAC[o_THM]; + BY(ASM_TAC THEN SET_TAC[]); + COMMENT "next ants"; + CONJ_TAC; + ONCE_REWRITE_TAC[derived_form_b]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC derived_form_xrr [`y2`;`y3`;`x`]; + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + ONCE_REWRITE_TAC[derived_form_b]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC derived_form_xrr_D2 [`y2`;`y3`;`x`]; + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + ONCE_REWRITE_TAC[derived_form_b]; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_SIMP_TAC[derived_form_sum_dih444sub]); + COMMENT "last conj of ants"; + ONCE_REWRITE_TAC[derived_form_b]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + COMMENT "clear denominators"; + ASM_REWRITE_TAC[]; + REWRITE_TAC[REAL_DIV_EQ_0]; + TYPIFY_GOAL_THEN `~(&2 * x4 * (&16 - x4) * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6) = &0)` (unlist REWRITE_TAC); + REWRITE_TAC[REAL_ENTIRE]; + GMATCH_SIMP_TAC SQRT_EQ_0; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `dnum1` MP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `~(x < &0) <=> &0 <= x`]; + INTRO_TAC derived_form_tau2D [`x4`;`x5`;`x6`;`e1`;`e2`;`e3`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`x4`]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC derived_form_unique [`(\q. num1 e1 e2 e3 q x5 x6 / (&2 * q * (&16 - q) * sqrt (delta_x (&4) (&4) (&4) q x5 x6)))`;`g'' x4`;`((&4 * dnum1 e1 e2 e3 x4 x5 x6) / (&2 * x4 * (&16 - x4) * sqrt (delta_x (&4) (&4) (&4) x4 x5 x6)))`;`x4`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + FIRST_X_ASSUM_ST `&0 <= g'' x4` MP_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Trigonometry2.REAL_LE_RDIV_0; + REWRITE_TAC[arith `&0 <= &4 * x <=> &0 <= x`]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC SQRT_POS_LT; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let FIRST_DERIV_POS_OPEN_COMPOSE = prove_by_refinement( + `!P Q x y f f' f'' g g' g''. + P x /\ Q (f x) /\ (f x = y) /\ + real_open {x | P x /\ Q (f x)} /\ + (!x. derived_form (P x) f (f' x) x (:real)) /\ + (!x. derived_form (P x) f' (f'' x) x (:real)) /\ + (!y. derived_form (Q( y)) g (g' y) y (:real)) /\ + (!y. derived_form (Q y) g' (g'' y) y (:real)) + ==> + real_open { x | (P x /\ Q (f x)) /\ &0 < g' (f x) * f' x } +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Pent_hex.continuous_preimage_open [`(\q. g' (f q) * f' q)`; `{x | P x /\ Q(f x)}`;`{y | &0 < y}`]; + ASM_REWRITE_TAC[IN_ELIM_THM]; + DISCH_THEN MATCH_MP_TAC; + TYPIFY_GOAL_THEN `real_open {u | &0 < u}` (unlist REWRITE_TAC); + BY(REWRITE_TAC[arith `a < b <=> b > a`;REAL_OPEN_HALFSPACE_GT]); + GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT; + ASM_REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL; + INTRO_TAC SECOND_CHAIN_GENERAL [`P`;`Q`;`f`;`f'`;`f'' x'`;`g`;`g'`;`g'' (f x')`;`x'`;`f x'`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + RULE_ASSUM_TAC (ONCE_REWRITE_RULE[derived_form_b]); + BY(ASM_MESON_TAC[]); + REWRITE_TAC[Calc_derivative.derived_form;WITHINREAL_UNIV]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let real_open_contains_real_interval = prove_by_refinement( + `!x s. x IN s /\ real_open s ==> ?a b. x IN real_interval (a,b) /\ real_interval(a,b) SUBSET s`, + (* {{{ proof *) + [ + REWRITE_TAC[real_open]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`x`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + GEXISTL_TAC [`x - e`;`x + e`]; + REWRITE_TAC[IN_REAL_INTERVAL;SUBSET]; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let FIRST_DERIVATIVE_TEST_TAUM = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + &0 < delta_y y1 y2 y3 y4 y5 y6 /\ + &0 < y1 /\ + &0 < y2 /\ + &0 < y3 /\ + &0 < y5 /\ + &0 < y6 /\ + &0 < y4 /\ + &0 < ups_x (y1 * y1) (y2 * y2) (y6 * y6) /\ + &0 < ups_x (y1 * y1) (y3 * y3) (y5 * y5) /\ + &0 < ups_x (y2 * y2) (y3 * y3) (y4* y4) /\ + &0 < num1 (rho y1) (rho y2) (rho y3) (xrr y2 y3 y4) (xrr y1 y3 y5) (xrr y1 y2 y6) ==> + (?a b. y4 IN real_interval (a,b) /\ + (!y4' y4''. (y4' IN real_interval(a,b) /\ y4'' IN real_interval(a,b) /\ y4' < y4'' ==> + taum y1 y2 y3 y4' y5 y6 < taum y1 y2 y3 y4'' y5 y6))) + `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + RULE_ASSUM_TAC (REWRITE_RULE[NOT_EXISTS_THM;TAUT `!a b. ~(a ==> b) <=> (a /\ ~b)`]); + COMMENT "set up first derivative"; + TYPED_ABBREV_TAC `x4 = xrr y2 y3 y4` ; + TYPED_ABBREV_TAC `x5 = xrr y1 y3 y5` ; + TYPED_ABBREV_TAC `x6 = xrr y1 y2 y6` ; + TYPED_ABBREV_TAC `e1 = rho y1` ; + TYPED_ABBREV_TAC `e2 = rho y2` ; + TYPED_ABBREV_TAC `e3 = rho y3` ; + TYPIFY `&0 < x5 /\ x5 < &16 /\ &0 < x4 /\ x4 < &16 /\ &0 < x6 /\ x6 < &16` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[xrr_bounds]); + TYPIFY `&0 < delta_x (&4) (&4) (&4) x4 x5 x6` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "x4"; + EXPAND_TAC "x5"; + EXPAND_TAC "x6"; + GMATCH_SIMP_TAC (GSYM delta_y_pos_xrr); + BY(ASM_REWRITE_TAC[]); + COMMENT "introduce positivity"; + INTRO_TAC derived_form_taum_d3_exists [`x4`;`x5`;`x6`;`e1`;`e2`;`e3`]; + DISCH_THEN (X_CHOOSE_TAC `g'':real->real`); + FIRST_X_ASSUM (X_CHOOSE_TAC `g''':real`); + FIRST_X_ASSUM MP_TAC THEN ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC FIRST_DERIV_POS_OPEN_COMPOSE [`\ (y4:real). &0 < y4` ;`\ (x:real). &0 < x /\ x < &16 /\ &0 < delta_x (&4) (&4) (&4) x x5 x6` ;`y4`;`xrr y2 y3 y4`;`(\q. xrr y2 y3 q)`;`\q. (&8 * q) / (y2*y3)`;`\ (q:real). (&8) / (y2 * y3)`;`(\q. e1 * dih_x (&4) (&4) (&4) q x5 x6 + e2 * dih_x (&4) (&4) (&4) x5 x6 q + e3 * dih_x (&4) (&4) (&4) x6 q x5 - (&1 + const1) * pi) `;`(\q. ( num1 e1 e2 e3 q x5 x6) / (&2 * q * (&16 - q) * sqrt(delta_x (&4) (&4) (&4) q x5 x6))) `;`g''`]; + REWRITE_TAC[]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + ASM_REWRITE_TAC[]; + SUBCONJ_TAC; + EXPAND_TAC "x5"; + EXPAND_TAC "x6"; + ASM_SIMP_TAC[xrr_convert]; + TYPIFY `{x | &0 < x /\ &0 < ups_x (y2 * y2) (y3 * y3) (x * x) /\ &0 < delta_y y1 y2 y3 x y5 y6} = {x | &0 < x /\ &0 < delta_y y1 y2 y3 x y5 y6} INTER {x | &0 < ups_x (y2 * y2) (y3 * y3) (x * x) }` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + MATCH_MP_TAC REAL_OPEN_INTER; + REWRITE_TAC[real_open_ups_y]; + BY(REWRITE_TAC[real_open_delta_y]); + DISCH_TAC; + ONCE_REWRITE_TAC[derived_form_b]; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_SIMP_TAC[ONCE_REWRITE_RULE[derived_form_b] derived_form_xrr]); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_SIMP_TAC[ONCE_REWRITE_RULE[derived_form_b] derived_form_xrr_D2]); + CONJ2_TAC; + BY(ASM_REWRITE_TAC[]); + BY(ASM_SIMP_TAC[derived_form_sum_dih444sub]); + DISCH_TAC; + TYPED_ABBREV_TAC `s = {x | (&0 < x /\ &0 < xrr y2 y3 x /\ xrr y2 y3 x < &16 /\ &0 < delta_x (&4) (&4) (&4) (xrr y2 y3 x) x5 x6) /\ &0 < num1 e1 e2 e3 (xrr y2 y3 x) x5 x6 / (&2 * xrr y2 y3 x * (&16 - xrr y2 y3 x) * sqrt (delta_x (&4) (&4) (&4) (xrr y2 y3 x) x5 x6)) * (&8 * x) / (y2 * y3)}` ; + TYPIFY `y4 IN s` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "s"; + ASM_REWRITE_TAC[IN_ELIM_THM]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_DIV; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_DIV; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL_EQ); + GMATCH_SIMP_TAC SQRT_POS_LT; + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM_ST `x < &16` MP_TAC) THEN REAL_ARITH_TAC); + INTRO_TAC real_open_contains_real_interval [`y4`;`s`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`a`;`b`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `y4' IN s /\ y4'' IN s` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + TYPIFY `real_interval[y4',y4''] SUBSET s` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT (FIRST_X_ASSUM_ST `real_interval:(real#real)->(real->bool)` MP_TAC); + REWRITE_TAC[real_interval;IN_ELIM_THM;SUBSET]; + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT "introduce MVT"; + TYPED_ABBREV_TAC `f = (\q. xrr y2 y3 q)`; + TYPED_ABBREV_TAC `g = (\q. e1 * dih_x (&4) (&4) (&4) q x5 x6 + e2 * dih_x (&4) (&4) (&4) x5 x6 q + e3 * dih_x (&4) (&4) (&4) x6 q x5 - (&1 + const1) * pi) `; + INTRO_TAC REAL_MVT_SIMPLE [`g o f`;`(\x. num1 e1 e2 e3 (xrr y2 y3 x) x5 x6 / (&2 * xrr y2 y3 x * (&16 - xrr y2 y3 x) * sqrt (delta_x (&4) (&4) (&4) (xrr y2 y3 x) x5 x6)) * (&8 * x) / (y2 * y3))`;`y4'`;`y4''`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_ATREAL_WITHIN; + ONCE_REWRITE_TAC[GSYM WITHINREAL_UNIV]; + MP_TAC TRUTH; + PURE_ONCE_REWRITE_TAC[GSYM Calc_derivative.derived_form]; + MATCH_MP_TAC derived_form_chain; + TYPIFY `f x` EXISTS_TAC; + REWRITE_TAC[]; + CONJ_TAC; + EXPAND_TAC "f"; + BY(ASM_SIMP_TAC[ONCE_REWRITE_RULE[derived_form_b] derived_form_xrr]); + EXPAND_TAC "g"; + EXPAND_TAC "f"; + MATCH_MP_TAC derived_form_sum_dih444sub; + ASM_REWRITE_TAC[]; + TYPIFY `x IN s` (C SUBGOAL_THEN MP_TAC); + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + EXPAND_TAC "s"; + REWRITE_TAC[IN_ELIM_THM]; + BY(DISCH_THEN (unlist REWRITE_TAC)); + REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "u positive"; + TYPED_ABBREV_TAC `u = (num1 e1 e2 e3 (xrr y2 y3 x) x5 x6 / (&2 * xrr y2 y3 x * (&16 - xrr y2 y3 x) * sqrt (delta_x (&4) (&4) (&4) (xrr y2 y3 x) x5 x6)) * (&8 * x) / (y2 * y3))`; + TYPIFY `x IN s` (C SUBGOAL_THEN MP_TAC); + (FIRST_X_ASSUM_ST `real_interval:(real#real)->(real->bool)` MP_TAC); + FIRST_X_ASSUM_ST `SUBSET` MP_TAC; + BY(SET_TAC[REAL_INTERVAL_OPEN_SUBSET_CLOSED]); + EXPAND_TAC "s"; + REWRITE_TAC[IN_ELIM_THM]; + DISCH_TAC; + TYPIFY `&0 < u` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "u"; + BY(ASM_REWRITE_TAC[]); + REPEAT (GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] taum_compose_xrr)); + ASM_REWRITE_TAC[]; + COMMENT "final kill"; + TYPIFY_GOAL_THEN ` (g o f) y4' < (g o f) y4''` (unlist REWRITE_TAC); + ONCE_REWRITE_TAC[arith `g' < g'' <=> &0 < g'' - g'`]; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 15 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `!y. y IN s ==> &0 < delta_y y1 y2 y3 y y5 y6` ENOUGH_TO_SHOW_TAC; + DISCH_THEN (REPEAT o GMATCH_SIMP_TAC); + BY(ASM_REWRITE_TAC[]); + EXPAND_TAC "s"; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC delta_y_pos_xrr; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let const1_pos = prove_by_refinement( + `&0 < const1`, + (* {{{ proof *) + [ + REWRITE_TAC[GSYM Nonlinear_lemma.sol0_over_pi_EQ_const1]; + GMATCH_SIMP_TAC REAL_LT_DIV; + REWRITE_TAC[PI_POS]; + MP_TAC Flyspeck_constants.bounds; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let rho_bounds = prove_by_refinement( + `!y. &2 <= y /\ y <= &2 * h0 ==> &1 <= rho y /\ rho y <= &1 + sol0 / pi`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlinear_lemma.rho_alt;Nonlinear_lemma.sol0_over_pi_EQ_const1]; + REPEAT WEAKER_STRIP_TAC; + ASSUME_TAC const1_pos; + REWRITE_TAC[arith `&1 <= &1 + x <=> &0 <= x`;arith `&1 + c* x <= &1 + c <=> &0 <= c *(&1 - x)`]; + GMATCH_SIMP_TAC REAL_LE_MUL; + GMATCH_SIMP_TAC REAL_LE_MUL; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let LEMMA_1834976363 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6 a b. + &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + (&2 / h0) pow 2 <= xrr y2 y3 y4 /\ xrr y2 y3 y4 <= #15.53 /\ + (&2 / h0) pow 2 <= xrr y1 y3 y5 /\ + (&2 / h0) pow 2 <= xrr y1 y2 y6 /\ + y4 IN real_interval (a,b) /\ + real_interval (a,b) SUBSET + {y4 | &0 < delta_y y1 y2 y3 y4 y5 y6 /\ &0 < y4 /\ &0 < ups_x (y2*y2) (y3*y3) (y4*y4)} /\ + &0 < y5 /\ &0 < y6 /\ + &0 < ups_x (y1*y1) (y2*y2) (y6*y6) /\ + &0 < ups_x (y1*y1) (y3*y3) (y5*y5) ==> + (?y4'. y4' IN real_interval(a,b) /\ taum y1 y2 y3 y4' y5 y6 < taum y1 y2 y3 y4 y5 y6))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC SECOND_DERIVATIVE_TEST_TAUM; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[arith `&2 <= y ==> &0 < y`]; + DISCH_TAC; + PROOF_BY_CONTR_TAC; + INTRO_TAC (Terminal.get_main_nonlinear "1834976363") [`rho y1`;`rho y2`;`rho y3`;`xrr y2 y3 y4`;`xrr y1 y3 y5`;`xrr y1 y2 y6`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`]; + REWRITE_TAC[arith `~(&0 > &0) /\ ~(&0 < &0)`;arith `&4 pow 2 = &16`;rho_bounds]; + ASM_SIMP_TAC[rho_bounds]; + REPEAT (GMATCH_SIMP_TAC (arith `x < y ==> x <= y`)); + BY(ASM_MESON_TAC[arith `&2 <= y ==> &0 < y`;xrr_bounds]) + ]);; + (* }}} *) + +let xrr_increasing = prove_by_refinement( + `!y1 y2 y6 y6'. &0 < y1 /\ &0 < y2 /\ &0 <= y6 /\ y6 < y6' ==> xrr y1 y2 y6 < xrr y1 y2 y6'`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[arith `x < y <=> &0 < y - x`]; + TYPIFY `xrr y1 y2 y6' - xrr y1 y2 y6 = (&4 / (y1 * y2)) * (y6' * y6' - y6 * y6)` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[Appendix.xrr]; + Calc_derivative.CALC_ID_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_DIV; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ONCE_REWRITE_TAC[arith `&0 < y - x <=> x < y`]; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let xrr_decreasing = prove_by_refinement( + `!y1 y1' y2 y6. &2 <= y1 /\ &2 <= y1' /\ &2 <= y2 /\ &2 <= y6 /\ y2 <= &2 * h0 /\ y1 <= y1' ==> + xrr y1' y2 y6 <= xrr y1 y2 y6`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `y1 = y1'` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + INTRO_TAC REAL_MVT_SIMPLE [`(\q. xrr q y2 y6)`;`\q. ( -- &4 * ((q*q + y6*y6 - y2*y2)/ (q pow 2 * y2)))`;`y1`;`y1'`]; + REWRITE_TAC[IN_REAL_INTERVAL]; + ANTS_TAC; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_ATREAL_WITHIN; + INTRO_TAC derived_form_xrr_wrt_y1 [`x`;`y2`;`y6`]; + REWRITE_TAC[Calc_derivative.derived_form;WITHINREAL_UNIV]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC [arith `x <= y <=> &0 <= y - x`]; + RULE_ASSUM_TAC(ONCE_REWRITE_RULE[arith `x' - x = (-- &4 * u/v) * z <=> x - x' = &4 * u/ v * z`]); + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LE_MUL; + GMATCH_SIMP_TAC REAL_LE_MUL; + GMATCH_SIMP_TAC REAL_LE_DIV; + GMATCH_SIMP_TAC REAL_LE_MUL; + REWRITE_TAC[ REAL_LE_POW_2]; + ENOUGH_TO_SHOW_TAC ` &0 <= x * x + y6 * y6 - y2 * y2`; + BY(ASM_TAC THEN REAL_ARITH_TAC); + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `&2 * &2 + &2 * &2 - (&2 * h0) * (&2 * h0)` EXISTS_TAC; + CONJ_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + MATCH_MP_TAC (arith `x <= x' /\ y <= y' /\ z' <= z ==> x + y - z <= x' + y' - z'`); + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let xrr_simple_lower_bound = prove_by_refinement( + `!y1 y2 y6 y6inf. &2 <= y1 /\ y1 <= &2 * h0 /\ &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y6inf /\ y6inf <= y6 ==> (y6inf/ h0) pow 2 <= xrr y1 y2 y6`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `xrr (&2 * h0) y2 y6` EXISTS_TAC; + CONJ2_TAC; + MATCH_MP_TAC xrr_decreasing; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `xrr (&2 * h0) (&2 * h0) y6` EXISTS_TAC; + CONJ2_TAC; + ONCE_REWRITE_TAC[xrr_sym]; + MATCH_MP_TAC xrr_decreasing; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `xrr (&2 * h0) (&2 * h0) y6inf` EXISTS_TAC; + CONJ2_TAC; + TYPIFY `y6inf = y6` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + MATCH_MP_TAC (arith (`x < y ==> x <= y`)); + MATCH_MP_TAC xrr_increasing; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + REWRITE_TAC[Appendix.xrr]; + MATCH_MP_TAC (arith `x = y ==> x <= y`); + Calc_derivative.CALC_ID_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let xrr_simple_upper_bound = prove_by_refinement( + `!y1 y2 y6 y6sup. &2 <= y1 /\ y1 <= &2 * h0 /\ &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y6 /\ y6 <= y6sup /\ y6sup < &4 ==> xrr y1 y2 y6 <= y6sup pow 2`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `xrr (&2) y2 y6` EXISTS_TAC; + CONJ_TAC; + MATCH_MP_TAC xrr_decreasing; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `xrr (&2) (&2) y6` EXISTS_TAC; + CONJ_TAC; + ONCE_REWRITE_TAC[xrr_sym]; + MATCH_MP_TAC xrr_decreasing; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `xrr (&2) (&2) y6sup` EXISTS_TAC; + CONJ_TAC; + TYPIFY `y6sup = y6` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + MATCH_MP_TAC (arith (`x < y ==> x <= y`)); + MATCH_MP_TAC xrr_increasing; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + REWRITE_TAC[Appendix.xrr]; + MATCH_MP_TAC (arith `x = y ==> x <= y`); + Calc_derivative.CALC_ID_TAC; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let NUM1_GENERIC = prove_by_refinement( + ` (!x4inf x4sup x5inf x5sup x6inf x6sup y1 y2 y3 y4 y5 y6. + ineq + [ + (&1 , rho y1, &1 + sol0/ pi); + (&1 , rho y2, &1 + sol0/ pi); + (&1 , rho y3, &1 + sol0/ pi); + (x4inf, xrr y2 y3 y4, x4sup); + (x5inf, xrr y1 y3 y5, x5sup); + (x6inf, xrr y1 y2 y6, x6sup) + ] + ((num1 (rho y1) (rho y2) (rho y3) (xrr y2 y3 y4) (xrr y1 y3 y5) (xrr y1 y2 y6) ) > &0) /\ + &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + x4inf <= xrr y2 y3 y4 /\ xrr y2 y3 y4 <= x4sup /\ + x5inf <= xrr y1 y3 y5 /\ xrr y1 y3 y5 <= x5sup /\ + x6inf <= xrr y1 y2 y6 /\ xrr y1 y2 y6 <= x6sup /\ + &0 < y4 /\ &0 < y5 /\ &0 < y6 /\ + &0 < delta_y y1 y2 y3 y4 y5 y6 /\ + &0 < ups_x (y2 * y2) (y3 * y3) (y4* y4) /\ + &0 < ups_x (y1*y1) (y2*y2) (y6*y6) /\ + &0 < ups_x (y1*y1) (y3*y3) (y5*y5) ==> + (?a b. y4 IN real_interval (a,b) /\ + (!y4' y4''. (y4' IN real_interval(a,b) /\ y4'' IN real_interval(a,b) /\ y4' < y4'' ==> + taum y1 y2 y3 y4' y5 y6 < taum y1 y2 y3 y4'' y5 y6))))`, + (* {{{ proof *) + [ + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `num1` MP_TAC; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[rho_bounds]); + DISCH_TAC; + MATCH_MP_TAC FIRST_DERIVATIVE_TEST_TAUM; + ASM_REWRITE_TAC[]; + BY(ASM_SIMP_TAC[arith `n > &0 ==> &0 < n`;arith `&2 <= y ==> &0 < y`]) + ]);; + (* }}} *) + +let LEMMA_4828966562 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (!y1 y2 y3 y4 y5 y6. + &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + &2 <= y4 /\ y4 <= &2 * h0 /\ + &2 <= y5 /\ y5 <= #3.01 /\ + (&3 <= y6) /\ + &0 < delta_y y1 y2 y3 y4 y5 y6 /\ +// &0 < ups_x (y2 * y2) (y3 * y3) (y4* y4) /\ +// &0 < ups_x (y1*y1) (y3*y3) (y5*y5) /\ + &0 < ups_x (y1*y1) (y2*y2) (y6*y6) ==> + (?a b. y4 IN real_interval (a,b) /\ + (!y4' y4''. (y4' IN real_interval(a,b) /\ y4'' IN real_interval(a,b) /\ y4' < y4'' ==> + taum y1 y2 y3 y4' y5 y6 < taum y1 y2 y3 y4'' y5 y6))))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC NUM1_GENERIC; + GEXISTL_TAC [ `(&2/h0) pow 2`;`(&2 * h0) pow 2`;`(&2/h0) pow 2 `;`#3.01 pow 2`;`#2.38 pow 2`;`#16.0`]; + INTRO_TAC (Terminal.get_main_nonlinear "4828966562") [`xrr y2 y3 y4`;`xrr y1 y3 y5`;`xrr y1 y2 y6`;`rho y1`;`rho y2`;`rho y3`]; + DISCH_THEN (unlist REWRITE_TAC); + ASM_REWRITE_TAC[]; + TYPIFY `&0 < ups_x (y2 * y2) (y3 * y3) (y4 * y4) /\ &0 < ups_x (y1 * y1) (y3 * y3) (y5 * y5)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT (GMATCH_SIMP_TAC Ysskqoy.TRI_UPS_X_STRICT_POS); + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REPEAT (GMATCH_SIMP_TAC xrr_simple_lower_bound); + ASM_REWRITE_TAC[]; + REPEAT (GMATCH_SIMP_TAC xrr_simple_upper_bound); + ASM_REWRITE_TAC[arith `#16.0 = &16`]; + GMATCH_SIMP_TAC xrr_le_16; + TYPIFY_GOAL_THEN `#2.38 pow 2 <= xrr y1 y2 y6` (unlist REWRITE_TAC); + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `(&3 / h0) pow 2` EXISTS_TAC; + CONJ_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC xrr_simple_lower_bound; + BY(ASM_TAC THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let LEMMA_6843920790 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (!y1 y2 y3 y4 y5 y6. + &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + &2 <= y4 /\ y4 <= #3.01 /\ + &3 <= y5 /\ xrr y1 y3 y5 <= #15.53 /\ + &3 <= y6 /\ xrr y1 y2 y6 <= #15.53 /\ + &0 < delta_y y1 y2 y3 y4 y5 y6 +==> + (?a b. y4 IN real_interval (a,b) /\ + (!y4' y4''. (y4' IN real_interval(a,b) /\ y4'' IN real_interval(a,b) /\ y4' < y4'' ==> + taum y1 y2 y3 y4' y5 y6 < taum y1 y2 y3 y4'' y5 y6))))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC NUM1_GENERIC; + GEXISTL_TAC [ `(&2/h0) pow 2`;`#3.01 pow 2`;`(#2.38) pow 2 `;`#15.53`;`#2.38 pow 2`;`#15.53`]; + INTRO_TAC (Terminal.get_main_nonlinear "6843920790") [`xrr y2 y3 y4`;`xrr y1 y3 y5`;`xrr y1 y2 y6`;`rho y1`;`rho y2`;`rho y3`]; + DISCH_THEN (unlist REWRITE_TAC); + ASM_REWRITE_TAC[]; + REPEAT (GMATCH_SIMP_TAC xrr_simple_lower_bound); + ASM_REWRITE_TAC[]; + REPEAT (GMATCH_SIMP_TAC xrr_simple_upper_bound); + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `#2.38 pow 2 <= xrr y1 y2 y6` (ASSUME_TAC); + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `(&3 / h0) pow 2` EXISTS_TAC; + CONJ_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC xrr_simple_lower_bound; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY_GOAL_THEN `#2.38 pow 2 <= xrr y1 y3 y5` (ASSUME_TAC); + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `(&3 / h0) pow 2` EXISTS_TAC; + CONJ_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC xrr_simple_lower_bound; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `&0 < ups_x (y2 * y2) (y3 * y3) (y4 * y4) ` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT (GMATCH_SIMP_TAC Ysskqoy.TRI_UPS_X_STRICT_POS); + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REPEAT (GMATCH_SIMP_TAC xrr_bounds_2); + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + + +(* RETURN TO PENT HEX CASES *) + +(* IS_SCS LEMMAS *) + +let is_scs_funlist_basic = prove_by_refinement( + `!k d a0 b0 a b . d < #0.9 /\ 3 <= k /\ k <= 6 /\ + (!i j. i < j /\ j < k ==> funlist_v39 a a0 k i j <= funlist_v39 b b0 k i j) /\ + (!i j. i < j /\ j < k ==> &2 <= funlist_v39 a a0 k i j) /\ + (!i. i < 3 /\ k = 3 ==> funlist_v39 b b0 k i (SUC i) < &4) /\ + (!i. i < k /\ 3 < k ==> funlist_v39 b b0 k i (SUC i) <= cstab) /\ + CARD + {i | i < k /\ + (&2 * h0 < funlist_v39 b b0 k i (SUC i) \/ + &2 < funlist_v39 a a0 k i (SUC i))} + + k <= 6 ==> + is_scs_v39 (scs_v39 (k,d, + funlist_v39 a a0 k,funlist_v39 a a0 k, + funlist_v39 b b0 k,funlist_v39 b b0 k, + (\i j. F),{},{},{}))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[GSYM Terminal.funlistA_empty]; + MATCH_MP_TAC Terminal.is_scs_funlist; + ASM_REWRITE_TAC[Appendix.periodic_empty]; + BY(REWRITE_TAC[Terminal.funlistA_empty]) + ]);; + (* }}} *) + +let periodic2_cs_adj = prove_by_refinement( + `!k r r'. periodic2(cs_adj k r r') k`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[LET_DEF;LET_END_DEF;Appendix.periodic2;Appendix.cs_adj]; + TYPIFY `!i. (i + k) MOD k = i MOD k` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + ONCE_REWRITE_TAC[arith `i + (k:num) = 1 * k + i`]; + BY(REWRITE_TAC[MOD_MULT_ADD]); + REPEAT WEAKER_STRIP_TAC; + BY(ASM_REWRITE_TAC[arith `SUC (i + k) = (SUC i + k)`]) + ]);; + (* }}} *) + +let is_scs_adj = prove_by_refinement( + `!k d r r' s s'. d < #0.9 /\ 3 <= k /\ k <= 6 /\ (k = 3 ==> s < &4) /\ (3 < k ==> s <= cstab) /\ + (&2 <= r ) /\ (&2 <= r') /\ (r <= s) /\ (r' <= s') /\ (3 < k ==> s <= &2 * h0 /\ r = &2) ==> + is_scs_v39 (mk_unadorned_v39 k d (cs_adj k r r') (cs_adj k s s'))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[Appendix.is_scs_v39;Terminal.scs_unadorned_explicit;Appendix.scs_v39_explicit;arith `x <= x`;Appendix.periodic_empty;periodic2_cs_adj]; + CONJ_TAC; + BY(REWRITE_TAC[Appendix.periodic2]); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Appendix.cs_adj]; + CONJ_TAC; + BY(MESON_TAC[]); + CONJ_TAC; + BY(MESON_TAC[]); + BY(MESON_TAC[]); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Appendix.cs_adj]; + COND_CASES_TAC THEN ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + COND_CASES_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + BY(REWRITE_TAC[Appendix.cs_adj]); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Appendix.cs_adj]; + COND_CASES_TAC; + BY(ASM_MESON_TAC[MOD_LT;arith `3 <= k ==> 0 < k`]); + BY(ASM_TAC THEN REAL_ARITH_TAC); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Appendix.cs_adj]; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + BY(ASM_TAC THEN REAL_ARITH_TAC); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Appendix.cs_adj]; + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + BY(ASM_TAC THEN REAL_ARITH_TAC); + ASM_CASES_TAC `k=3`; + ASM_REWRITE_TAC[arith `x + 3 <= 6 <=> x <= 3`]; + INTRO_TAC HAS_SIZE_NUMSEG_LT [`3`]; + REWRITE_TAC[HAS_SIZE]; + TYPIFY `{i | i < 3 /\ (&2 * h0 < cs_adj 3 s s' i (SUC i) \/ &2 < cs_adj 3 r r' i (SUC i))} SUBSET {i | i < 3}` (C SUBGOAL_THEN MP_TAC); + BY(SET_TAC[]); + BY(MESON_TAC[CARD_SUBSET]); + TYPIFY `{i | i < k /\ (&2 * h0 < cs_adj k s s' i (SUC i) \/ &2 < cs_adj k r r' i (SUC i))} = {}` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[CARD_CLAUSES]; + BY(ASM_TAC THEN ARITH_TAC); + REWRITE_TAC[EXTENSION;IN_ELIM_THM;NOT_IN_EMPTY]; + REWRITE_TAC[Appendix.cs_adj]; + GEN_TAC; + REWRITE_TAC[DE_MORGAN_THM]; + REWRITE_TAC[TAUT `~a \/ b <=> a ==> b`]; + DISCH_TAC; + ASM_SIMP_TAC[Qknvmlb.SUC_MOD_NOT_EQ;arith `3 <= k==> 1 < k`]; + TYPIFY `3 < k` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_TAC THEN ARITH_TAC); + FIRST_X_ASSUM_ST `h0` MP_TAC; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let is_scs_6T1 = prove_by_refinement( + `is_scs_v39 scs_6T1`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_6T1]; + MATCH_MP_TAC is_scs_adj; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab]; + NUM_REDUCE_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let azim_in_fan_azim = prove_by_refinement( + `!vv E k i. + periodic vv k /\ 3 <= k /\ (!i j. i < k /\ j < k /\ vv i = vv j ==> i =j ) /\ + E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) + ==> + azim_in_fan (vv i,vv (SUC i)) E = azim (vec 0) (vv i) (vv (SUC i)) (vv (i + k -1))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[Localization.azim_in_fan;LET_DEF;LET_END_DEF]; + GMATCH_SIMP_TAC Terminal.EE_vv; + TYPIFY `k` EXISTS_TAC; + ASM_REWRITE_TAC[]; + COND_CASES_TAC; + BY(REWRITE_TAC[GEN_ALL Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]); + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `CARD` MP_TAC; + TYPIFY `~(k = 0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + REWRITE_TAC[]; + MATCH_MP_TAC (arith `c = 2 ==> c > 1`); + MATCH_MP_TAC Hypermap.CARD_TWO_ELEMENTS; + INTRO_TAC Oxl_def.periodic_mod [`vv`;`k`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist ONCE_REWRITE_TAC); + DISCH_TAC; + TYPIFY `SUC i MOD k = (i + k - 1) MOD k` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[DIVISION]); + INTRO_TAC Oxlzlez.MOD_INJ1_ALT [`k-2`;`k`]; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `3 <= k` MP_TAC) THEN ARITH_TAC); + DISCH_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`SUC i`]); + ASM_REWRITE_TAC[]; + BY(ASM_SIMP_TAC[arith `3 <= k ==> SUC x + k - 2 = x + k - 1`]) + ]);; + (* }}} *) + +let sol_local_azim = prove_by_refinement( + `!vv k . + ( + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + let f = IMAGE (\i. vv i,vv (SUC i)) (:num) in + (periodic vv k /\ 3 <= k /\ + (!i j. i < k /\ j < k /\ vv i = vv j ==> (i = j)) ==> + sol_local E f = sum {i | i < k} (\i. + azim (vec 0) (vv i) (vv (i+1)) (vv (i + (k-1)))) - pi * (&k - &2)))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF;Localization.sol_local]; + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC (GSYM Oxlzlez.PERIODIC_IMAGE); + TYPIFY `k` EXISTS_TAC; + CONJ_TAC; + ASM_SIMP_TAC[arith `3 <= k ==> ~(0 = k)`]; + FIRST_X_ASSUM_ST `periodic` MP_TAC; + REWRITE_TAC[Oxl_def.periodic;PAIR_EQ]; + BY(MESON_TAC[arith `SUC (i + k) = SUC i + k`]); + TYPIFY `FINITE (IMAGE (\i. vv i,vv (SUC i)) {i | i < k})` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC FINITE_IMAGE; + BY(REWRITE_TAC[FINITE_NUMSEG_LT]); + ASM_SIMP_TAC[ SUM_SUB]; + ASM_SIMP_TAC[ SUM_CONST]; + MATCH_MP_TAC (arith `b = b' /\ s = s' ==> &2 * pi + s - b*pi = s' - (pi) * (b'- &2)`); + GMATCH_SIMP_TAC CARD_IMAGE_INJ; + ASM_REWRITE_TAC[IN_ELIM_THM;PAIR_EQ;FINITE_NUMSEG_LT;CARD_NUMSEG_LT]; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC SUM_IMAGE; + ASM_REWRITE_TAC[IN_ELIM_THM;PAIR_EQ;FINITE_NUMSEG_LT;CARD_NUMSEG_LT]; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC SUM_EQ; + REWRITE_TAC[IN_ELIM_THM;o_THM]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `x + 1 = SUC x`]; + MATCH_MP_TAC azim_in_fan_azim; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let vv_inj_lemma = prove_by_refinement( + `!s v k. is_scs_v39 s /\ v IN BBs_v39 s /\ scs_k_v39 s = k ==> + (!i j. i < k /\ j < k /\ v i = v j ==> i = j)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[Appendix.is_scs_v39;IN;Appendix.BBs_v39;LET_THM]); + ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`i`;`j`]); + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `&2 <= x` (C INTRO_TAC [`i`;`j`]); + ASM_REWRITE_TAC[arith `~(x <= y) <=> y < x`]; + FIRST_X_ASSUM_ST `a <= dist(u,v)` MP_TAC; + ASM_REWRITE_TAC[DIST_REFL]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let LOCAL_FAN_AZIM_POS = prove_by_refinement( + `!s vv i. + (let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + let f = IMAGE (\i. (vv i,vv (SUC i))) (:num) in + let k = scs_k_v39 s in + (convex_local_fan (V,E,f) /\ is_scs_v39 s /\ vv IN BBs_v39 s + ==> &0 < azim (vec 0) (vv i ) (vv (SUC i)) (vv (i + (k-1)))))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_THM]; + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC (GSYM azim_in_fan_azim); + TYPED_ABBREV_TAC `V = IMAGE vv (:num)`; + TYPED_ABBREV_TAC `E = IMAGE (\i. {vv i, vv (SUC i)}) (:num)`; + TYPED_ABBREV_TAC `f = IMAGE (\i. (vv i,vv (SUC i))) (:num)`; + TYPIFY `vv i IN V` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "V"; + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + TYPIFY ` E` EXISTS_TAC; + INTRO_TAC (GEN_ALL Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM) [`V`;`f`;`E`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (C INTRO_TAC [`vv i`]); + ASM_REWRITE_TAC[]; + INTRO_TAC Terminal.vv_rho_node1 [`vv`;`scs_k_v39 s`]; + ASM_REWRITE_TAC[LET_THM]; + INTRO_TAC vv_inj_lemma [`s`;`vv`;`scs_k_v39 s`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC (GEN_ALL Local_lemmas.INTERIOR_ANGLE1_POS) [`E`;`V`;`f`;`vv i`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ASM_SIMP_TAC[Local_lemmas.CVX_LO_IMP_LO]); + TYPIFY `periodic vv (scs_k_v39 s) /\ 3 <= scs_k_v39 s` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[]); + RULE_ASSUM_TAC(REWRITE_RULE[Appendix.is_scs_v39]); + ASM_REWRITE_TAC[]; + RULE_ASSUM_TAC(REWRITE_RULE[IN;Appendix.BBs_v39;LET_THM]); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let INTERIOR_ANGLE1_AZIM = prove_by_refinement( + `!s vv i. + (let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + let f = IMAGE (\i. (vv i,vv (SUC i))) (:num) in + let k = scs_k_v39 s in + (is_scs_v39 s /\ vv IN BBs_v39 s /\ 3 < k + ==> azim (vec 0) (vv i ) (vv (SUC i)) (vv (i + (k-1))) = interior_angle1 (vec 0) f (vv(i) )))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_THM]; + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC (GSYM azim_in_fan_azim); + TYPED_ABBREV_TAC `V = IMAGE vv (:num)`; + TYPED_ABBREV_TAC `E = IMAGE (\i. {vv i, vv (SUC i)}) (:num)`; + TYPED_ABBREV_TAC `f = IMAGE (\i. (vv i,vv (SUC i))) (:num)`; + TYPIFY `vv i IN V` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "V"; + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + TYPIFY ` E` EXISTS_TAC; + INTRO_TAC (GEN_ALL Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM) [`V`;`f`;`E`]; + TYPIFY `convex_local_fan(V,E,f)` (C SUBGOAL_THEN ASSUME_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[Appendix.BBs_v39;IN;LET_THM]); + FIRST_X_ASSUM_ST `convex_local_fan` MP_TAC THEN ASM_REWRITE_TAC[]; + BY(ASM_SIMP_TAC[arith `3 < k ==> ~( k <= 3)`]); + ASM_REWRITE_TAC[]; + DISCH_THEN (C INTRO_TAC [`vv i`]); + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + INTRO_TAC Terminal.vv_rho_node1 [`vv`;`scs_k_v39 s`]; + ASM_REWRITE_TAC[LET_THM]; + INTRO_TAC vv_inj_lemma [`s`;`vv`;`scs_k_v39 s`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `periodic vv (scs_k_v39 s) /\ 3 <= scs_k_v39 s` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[]); + RULE_ASSUM_TAC(REWRITE_RULE[Appendix.is_scs_v39]); + ASM_REWRITE_TAC[]; + RULE_ASSUM_TAC(REWRITE_RULE[IN;Appendix.BBs_v39;LET_THM]); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let delta_x4_imp_obtuse = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + &0 < x1 /\ &0 <= delta_x x1 x2 x3 x4 x5 x6 /\ delta_x4 x1 x2 x3 x4 x5 x6 < &0 ==> + pi/ &2 < dih_x x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Sphere.dih_x;LET_THM]; + REWRITE_TAC[arith `x < x + y <=> &0 < y`]; + TYPED_ABBREV_TAC `s = sqrt(&4 * x1 * delta_x x1 x2 x3 x4 x5 x6)`; + TYPIFY `&0 <= s` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "s"; + GMATCH_SIMP_TAC SQRT_POS_LE; + GMATCH_SIMP_TAC REAL_LE_MUL; + GMATCH_SIMP_TAC REAL_LE_MUL; + BY(ASM_TAC THEN REAL_ARITH_TAC); + ASM_CASES_TAC `&0 < s`; + ASM_SIMP_TAC[Merge_ineq.ATN2_POS]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `s = &0` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC Merge_ineq.atn2_0; + MP_TAC PI_POS; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let delta4_y_imp_obtuse = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. &0 < y1 /\ &0 <= delta_y y1 y2 y3 y4 y5 y6 /\ delta4_y y1 y2 y3 y4 y5 y6 < &0 ==> + pi/ &2 < dih_y y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.dih_y;LET_THM;Sphere.delta_y;Sphere.delta4_y;Sphere.y_of_x]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC delta_x4_imp_obtuse; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let scs_vv_MOD = prove_by_refinement( + `!s vv i. is_scs_v39 s /\ BBs_v39 s vv ==> vv(i MOD scs_k_v39 s) = vv i`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.is_scs_v39;Appendix.BBs_v39;LET_THM]; + REPEAT WEAKER_STRIP_TAC; + SPEC_TAC (`i:num`,`i:num`); + MATCH_MP_TAC Xwitccn.PERIODIC_PROPERTY; + ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM_ST `3 <= k` MP_TAC THEN ARITH_TAC) + ]);; + (* }}} *) + +let scs_lb_2 = prove_by_refinement( + `!s vv i j. is_scs_v39 s /\ BBs_v39 s vv /\ ~(i MOD scs_k_v39 s = j MOD scs_k_v39 s) ==> + &2 <= dist(vv i,vv j)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY_GOAL_THEN `!i. vv(i MOD scs_k_v39 s) = vv (i)` (unlist ONCE_REWRITE_TAC o GSYM); + BY(ASM_MESON_TAC[scs_vv_MOD]); + RULE_ASSUM_TAC(REWRITE_RULE[Appendix.is_scs_v39;Appendix.BBs_v39;LET_THM]); + TYPED_ABBREV_TAC `k = scs_k_v39 s`; + ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `&2 <= x` (C INTRO_TAC [`i MOD k`;`j MOD k`]); + FIRST_X_ASSUM_ST `scs_a_v39` (C INTRO_TAC [`i MOD k`;`j MOD k`]); + ASM_SIMP_TAC[arith `3 <= k ==> ~(k = 0)`;DIVISION]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let delta_x4_decreasing = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6 x4'. + x4 <= x4' /\ &0 <= x1 ==> + delta_x4 x1 x2 x3 x4' x5 x6 <= delta_x4 x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ENOUGH_TO_SHOW_TAC `delta_x4 x1 x2 x3 x4 x5 x6 - delta_x4 x1 x2 x3 x4' x5 x6 = &2 * x1 * (x4' - x4)`; + ONCE_REWRITE_TAC[arith `d' <= d <=> &0 <= d - d'`]; + DISCH_THEN SUBST1_TAC; + GMATCH_SIMP_TAC REAL_LE_MUL; + CONJ_TAC; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LE_MUL; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[Nonlin_def.delta_x4]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let SYNQIWN = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!s v i k. + is_scs_v39 s /\ BBs_v39 s v /\ scs_k_v39 s =k /\ 3 < k /\ + ((norm (v (SUC i)) = &2 /\ dist(v i,v (i+k-1)) = &2) \/ + (norm (v (i+k-1)) = &2 /\ dist(v i,v (SUC i)) = &2) \/ + (norm (v (SUC i)) = &2 /\ norm (v(i+k-1)) = &2) \/ + (dist(v i,v(SUC i)) = &2 /\ dist(v i,v(i + k - 1)) = &2) \/ + (norm (v (SUC i)) = &2 /\ dist(v i,v (SUC i)) = &2) \/ + (norm (v (i+k-1)) = &2 /\ dist(v i,v (i+k-1)) = &2)) /\ + (dist(v i,v (SUC i)) <= &2 * h0) /\ + (dist(v (i),v(i+k-1)) <= &2 * h0) /\ + cstab <= dist(v (SUC i),v(i+k - 1)) ==> + pi/ &2 < azim (vec 0) (v (i)) (v (SUC i)) (v (i + k - 1))) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `x < y <=> ~(y <= x)`]; + DISCH_TAC; + TYPED_ABBREV_TAC `E = IMAGE (\i. {v i, v (SUC i)}) (:num) `; + INTRO_TAC vv_inj_lemma [`s`;`v`;`k`]; + ASM_REWRITE_TAC[IN]; + COMMENT "noncollinearity"; + DISCH_TAC; + INTRO_TAC (GEN_ALL Qknvmlb.IS_SCS_NOT_COLLINEAR_BBs_CASE_LE_PRIME_3) [`v`;`i`;`s`]; + ASM_REWRITE_TAC[IN]; + INTRO_TAC (GEN_ALL Qknvmlb.IS_SCS_NOT_COLLINEAR_BBs_CASE_LE_PRIME_3) [`v`;`i + k - 1`;`s`]; + ASM_REWRITE_TAC[IN]; + TYPIFY `SUC (i + k -1) MOD k = i MOD k` (C SUBGOAL_THEN SUBST1_TAC); + TYPIFY `SUC (i + k - 1) = 1*k + i` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + BY(REWRITE_TAC[MOD_MULT_ADD]); + TYPIFY_GOAL_THEN `!i. v (i MOD k) = v i` (unlist REWRITE_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[Appendix.BBs_v39;LET_THM]); + MATCH_MP_TAC Xwitccn.PERIODIC_PROPERTY; + BY(ASM_MESON_TAC[arith `3 < k ==> ~(k=0)`]); + TYPIFY `{vec 0, v (i + k - 1),v ( i)} = {vec 0,v (i),v (i + k - 1)}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + TYPIFY `azim (vec 0) (v i) (v (SUC i)) (v (i + k - 1)) = dihV (vec 0) (v i) (v (SUC i)) (v (i + k - 1))` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC (GSYM Polar_fan.AZIM_DIHV_SAME_STRONG); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `pi` MP_TAC; + MP_TAC PI_POS; + BY(REAL_ARITH_TAC); + TYPIFY `pi / &2 < dihV (vec 0) (v (i)) (v (SUC i)) (v (i + k - 1))` ENOUGH_TO_SHOW_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Merge_ineq.DIHV_EQ_DIH_Y); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC delta4_y_imp_obtuse; + COMMENT "three final steps"; + TYPIFY `!i. &2 <= norm(v i) /\ norm(v i) <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[Appendix.BBs_v39;LET_THM;Terminal.IMAGE_SUBSET_IN;IN_UNIV]); + BY(ASM_MESON_TAC[Fnjlbxs.in_ball_annulus]); + REWRITE_TAC[Trigonometry1.DIST_L_ZERO]; + SUBCONJ_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`i`]); + BY(REAL_ARITH_TAC); + DISCH_TAC; + REWRITE_TAC[REWRITE_RULE[LET_THM] Tame_lemmas.delta_y_pos]; + INTRO_TAC scs_lb_2 [`s`;`v`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `&2 <= dist (v i, v (SUC i))` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_MESON_TAC[ Qknvmlb.SUC_MOD_NOT_EQ;arith `3 < k ==> 1 < k`]); + TYPIFY `&2 <= dist(v i,v (i + k - 1))` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + INTRO_TAC (GEN_ALL Oxl_2012.MOD_INJ1) [`k - 1`;`k`]; + ANTS_TAC; + BY(FIRST_X_ASSUM_ST `3 < k` MP_TAC THEN ARITH_TAC); + BY(DISCH_THEN (unlist REWRITE_TAC)); + TYPIFY `delta4_y (norm (v i)) (norm (v (SUC i))) (norm (v (i + k - 1))) cstab (dist (v i,v (i + k - 1))) (dist (v i,v (SUC i))) < &0` ENOUGH_TO_SHOW_TAC; + MATCH_MP_TAC (arith `y<= x ==> (x < &0 ==> y < &0)`); + REWRITE_TAC[Sphere.delta4_y;Sphere.y_of_x]; + MATCH_MP_TAC delta_x4_decreasing; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + REWRITE_TAC[ REAL_LE_SQUARE]; + BY(FIRST_X_ASSUM_ST `cstab` MP_TAC THEN REWRITE_TAC[Sphere.cstab] THEN REAL_ARITH_TAC); + REWRITE_TAC[Sphere.cstab]; + COMMENT "ineq cases"; + REPEAT (FIRST_X_ASSUM_ST `collinear` kill); + REPEAT (FIRST_X_ASSUM_ST `azim` kill); + FIRST_ASSUM_ST `h0` (C INTRO_TAC [`i`]); + FIRST_ASSUM_ST `h0` (C INTRO_TAC [`SUC i`]); + FIRST_X_ASSUM_ST `h0` (C INTRO_TAC [`i + k - 1`]); + TYPED_ABBREV_TAC `y1 = norm (v i)`; + TYPED_ABBREV_TAC `y2 = norm (v (SUC i))`; + TYPED_ABBREV_TAC `y3 = norm (v (i + k - 1))`; + TYPED_ABBREV_TAC `y5 = dist(v i ,v(i + k - 1))`; + TYPED_ABBREV_TAC `y6 = dist(v i, v(SUC i))`; + REPLICATE_TAC 5 (FIRST_X_ASSUM kill); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `delta4_y y1 y3 y2 #3.01 y6 y5 = delta4_y y1 y2 y3 #3.01 y5 y6 /\ delta4_y y1 y5 y6 #3.01 y2 y3 = delta4_y y1 y2 y3 #3.01 y5 y6 /\ delta4_y y1 y6 y5 #3.01 y3 y2 = delta4_y y1 y2 y3 #3.01 y5 y6` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Sphere.delta4_y;Sphere.delta_x4;Sphere.y_of_x] THEN REAL_ARITH_TAC); + (FIRST_X_ASSUM_ST `\/` MP_TAC) THEN REPEAT STRIP_TAC; + INTRO_TAC (Terminal.get_main_nonlinear "1117202051") [`y1`;`y3`;`y2`;`#3.01`;`y6`;`y5`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + INTRO_TAC (Terminal.get_main_nonlinear "1117202051") [`y1`;`y2`;`y3`;`#3.01`;`y5`;`y6`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + INTRO_TAC (Terminal.get_main_nonlinear "4559601669") [`y1`;`y2`;`y3`;`#3.01`;`y5`;`y6`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + INTRO_TAC (Terminal.get_main_nonlinear "4559601669") [`y1`;`y5`;`y6`;`#3.01`;`y2`;`y3`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + INTRO_TAC (Terminal.get_main_nonlinear "4559601669b") [`y1`;`y2`;`y3`;`#3.01`;`y5`;`y6`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + INTRO_TAC (Terminal.get_main_nonlinear "4559601669b") [`y1`;`y3`;`y2`;`#3.01`;`y6`;`y5`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* +let edge2_generic = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (!vv k d. + (let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + let s = mk_unadorned_v39 k d (cs_adj k (&2) cstab) (cs_adj k (&2) (&6)) in + (BBs_v39 s vv /\ 3 < k /\ taustar_v39 s vv < &0 /\ is_scs_v39 s /\ + (!i j. i < k /\ j < k /\ vv i = vv j ==> (i = j)) ==> + generic V E)))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `s = mk_unadorned_v39 k d (cs_adj k (&2) cstab) (cs_adj k (&2) (&6))`; + TYPIFY `scs_k_v39 s =k ` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "s"; + BY(ASM_REWRITE_TAC[Terminal.scs_unadorned_explicit]); + INTRO_TAC Jkqewgv.JKQEWGV2 [`s`;`vv`]; + ASM_REWRITE_TAC[LET_THM]; + DISCH_TAC; + TYPED_ABBREV_TAC `V = IMAGE vv (:num)`; + TYPED_ABBREV_TAC `E = IMAGE (\i. {vv i, vv (SUC i)}) (:num)`; + TYPED_ABBREV_TAC `f = IMAGE (\i. (vv i,vv (SUC i))) (:num)`; + TYPIFY `convex_local_fan(V,E,f)` (C SUBGOAL_THEN ASSUME_TAC); + RULE_ASSUM_TAC (REWRITE_RULE[Appendix.BBs_v39;LET_THM]); + BY(ASM_MESON_TAC[arith `3 < k ==> ~(k <= 3)`;LET_THM]); + TYPIFY `~(?v w. lunar (v,w) V E)` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[Local_lemmas.CVX_LO_IMP_LO; Wrgcvdr_cizmrrh.CIZMRRH]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Jkqewgv.JKQEWGV3 [`s`;`vv`;`v`;`w`]; + ASM_REWRITE_TAC[LET_THM]; + TYPIFY `v IN V` (C SUBGOAL_THEN ASSUME_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[Wrgcvdr_cizmrrh.lunar]); + BY(FIRST_X_ASSUM MP_TAC THEN SET_TAC[]); + TYPIFY ` interior_angle1 (vec 0) f v = azim_in_fan (v,rho_node1 f v) E` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM]); + TYPIFY `!v. v IN V ==> ?i. v = vv i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + EXPAND_TAC "V"; + BY(REWRITE_TAC[IN_IMAGE;IN_UNIV]); + FIRST_X_ASSUM (C INTRO_TAC [`v`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[]; + EXPAND_TAC "f"; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Terminal.vv_rho_node1); + TYPIFY `periodic vv k /\ 3 <= k` (C SUBGOAL_THEN ASSUME_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[Appendix.BBs_v39;LET_THM]); + ASM_SIMP_TAC[arith `3 < k ==> 3 <= k`]; + EXPAND_TAC "k"; + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + TYPIFY `k` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + GMATCH_SIMP_TAC azim_in_fan_azim; + TYPIFY `k` EXISTS_TAC; + ASM_REWRITE_TAC[]; + DISCH_TAC +(* unfinished need SYN, redo as RRCWNS_WEAK *) + ]);; + (* }}} *) +*) + +let scs_diag_2 = prove_by_refinement( + `!k i. 3 < k ==> scs_diag k (SUC i) (i + k - 1)`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REWRITE_TAC[Appendix.scs_diag]; + DISCH_TAC; + TYPIFY_GOAL_THEN `~(SUC (SUC i) MOD k = (i + k - 1) MOD k)` (unlist REWRITE_TAC); + TYPIFY_GOAL_THEN `i + k - 1 = SUC(SUC i) + (k - 3)` (unlist REWRITE_TAC); + BY(ASM_TAC THEN ARITH_TAC); + BY(ASM_MESON_TAC[Oxl_2012.MOD_INJ1;arith `3 < k ==> ~(k = 0) /\ ~(k - 3 = 0) /\ (k - 3 < k)`]); + TYPIFY_GOAL_THEN `SUC (i + k - 1) = SUC i + (k-1)` (unlist REWRITE_TAC); + BY(ASM_TAC THEN ARITH_TAC); + CONJ2_TAC; + BY(ASM_MESON_TAC[Oxl_2012.MOD_INJ1;arith `3 < k ==> ~(k = 0) /\ ~(k - 1 = 0) /\ (k - 1 < k)`]); + TYPIFY_GOAL_THEN `i + k - 1 = SUC i + k - 2` (unlist REWRITE_TAC); + BY(ASM_TAC THEN ARITH_TAC); + BY(ASM_MESON_TAC[Oxl_2012.MOD_INJ1;arith `3 < k ==> ~(k = 0) /\ ~(k - 2 = 0) /\ (k - 2 < k)`]) + ]);; + (* }}} *) + +let RRCWNS_WEAK = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!s vv. + (let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + let k = scs_k_v39 s in + (BBs_v39 s vv /\ 3 < k /\ taustar_v39 s vv < &0 /\ + is_scs_v39 s /\ scs_basic_v39 s /\ + (!i j. scs_diag (scs_k_v39 s) i j ==> cstab <= dist(vv i,vv j)) /\ + (!i w. lunar(vv i,w) V E ==> + dist(vv i,vv(SUC i)) <= &2*h0 /\ + dist(vv i,vv(i + k - 1)) <= &2*h0 /\ + ((norm (vv (SUC i)) = &2 \/ dist(vv i, vv(SUC i)) = &2)) /\ + ((norm (vv (i + k - 1)) = &2 \/ dist(vv i, vv(i + k - 1)) = &2))) + ==> + scs_generic vv)))`, + (* {{{ proof *) + [ + DISCH_TAC; + REWRITE_TAC[LET_THM;Appendix.scs_generic]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Jkqewgv.JKQEWGV2 [`s`;`vv`]; + ASM_REWRITE_TAC[LET_THM]; + DISCH_TAC; + TYPED_ABBREV_TAC `V = IMAGE vv (:num)`; + TYPED_ABBREV_TAC `E = IMAGE (\i. {vv i, vv (SUC i)}) (:num)`; + TYPED_ABBREV_TAC `f = IMAGE (\i. (vv i,vv (SUC i))) (:num)`; + TYPIFY `convex_local_fan(V,E,f)` (C SUBGOAL_THEN ASSUME_TAC); + RULE_ASSUM_TAC (REWRITE_RULE[Appendix.BBs_v39;LET_THM]); + BY(ASM_MESON_TAC[arith `3 < k ==> ~(k <= 3)`;LET_THM]); + TYPIFY `~(?v w. lunar (v,w) V E)` ENOUGH_TO_SHOW_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP Local_lemmas.CVX_LO_IMP_LO)); + FIRST_X_ASSUM_ST `circular` MP_TAC; + BY(MESON_TAC[Wrgcvdr_cizmrrh.CIZMRRH]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Jkqewgv.JKQEWGV3 [`s`;`vv`;`v`;`w`]; + ASM_REWRITE_TAC[LET_THM]; + TYPIFY `v IN V /\ w IN V` (C SUBGOAL_THEN ASSUME_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[Wrgcvdr_cizmrrh.lunar]); + BY(FIRST_X_ASSUM MP_TAC THEN SET_TAC[]); + TYPIFY `!v. v IN V ==> ?i. v = vv i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + EXPAND_TAC "V"; + BY(REWRITE_TAC[IN_IMAGE;IN_UNIV]); + FIRST_X_ASSUM (C INTRO_TAC [`v`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (REWRITE_RULE[LET_THM] (GSYM INTERIOR_ANGLE1_AZIM)) [`s`;`vv`;`i`]; + ASM_REWRITE_TAC[IN]; + DISCH_TAC; + FIRST_X_ASSUM_ST `pi` MP_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `y < x ==> ~(x < y)`); + FIRST_X_ASSUM (C INTRO_TAC [`i`;`w`]); + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + MATCH_MP_TAC (UNDISCH SYNQIWN); + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `cstab <= dist(vv (SUC i),vv(i+ scs_k_v39 s - 1))` (unlist REWRITE_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + MATCH_MP_TAC scs_diag_2; + BY(ASM_REWRITE_TAC[]); + COMMENT "final kill"; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]) + ]);; + (* }}} *) + +let EAR_SOL_NN = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> ( !y1 y2 y3 y4 y5 y6. + &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + cstab <= y4 /\ y4 <= #3.915 /\ + y5 = &2 /\ + y6 = &2 /\ + &0 <= delta_y y1 y2 y3 y4 y5 y6 ==> + &0 <= sol_y y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + COMMENT "delta=0"; + ASM_CASES_TAC `delta_y y1 y2 y3 y4 y5 y6 = &0`; + INTRO_TAC (UNDISCH Terminal.EAR_DIH1_DELTA_0) [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + DISCH_TAC; + REWRITE_TAC[Sphere.sol_y]; + ASM_REWRITE_TAC[]; + INTRO_TAC Terminal.DIH_Y_NN [`y2`;`y3`;`y1`;`(&2)`;`(&2)`;`y4`]; + ANTS_TAC; + FIRST_X_ASSUM_ST `delta_y` MP_TAC; + ASM_REWRITE_TAC[Merge_ineq.delta_y_sym]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + INTRO_TAC Terminal.DIH_Y_NN [`y3`;`y1`;`y2`;`(&2)`;`y4`;`(&2)`]; + ANTS_TAC; + FIRST_X_ASSUM_ST `delta_y` MP_TAC; + ASM_REWRITE_TAC[Merge_ineq.delta_y_sym]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(REAL_ARITH_TAC); + COMMENT "replace solid angle"; + TYPIFY `&0 < delta_y y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN MP_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + DISCH_TAC; + MATCH_MP_TAC (arith `&0 < x ==> &0 <= x`); + REWRITE_TAC[Merge_ineq.sol_y_sol_x]; + MATCH_MP_TAC Terminal.sol_x_nn; + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL_EQ); + REWRITE_TAC[Trigonometry1.UPS_X_SQUARES]; + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL_EQ); + TYPIFY `&0 < eulerA_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + INTRO_TAC (Terminal.get_main_nonlinear "4821120729") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + REWRITE_TAC[Sphere.ineq;Sphere.y_of_x;arith `x > &0 <=> &0 < x`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Appendix.cstab] THEN REAL_ARITH_TAC); + TYPIFY `&0 < delta_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + FIRST_X_ASSUM MP_TAC; + BY(REWRITE_TAC[Sphere.delta_y]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN (REWRITE_TAC[Appendix.cstab;Sphere.h0]) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let scs_mk_unadorned_unadorned = prove_by_refinement( + `!k d a b. unadorned_v39 (mk_unadorned_v39 k d a b)`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Appendix.unadorned_v39;Terminal.scs_unadorned_explicit]) + ]);; + (* }}} *) + +let scs_basic_unadorned = prove_by_refinement( + `!k d a b. scs_basic_v39 (mk_unadorned_v39 k d a b)`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Appendix.scs_basic;Terminal.scs_unadorned_explicit;scs_mk_unadorned_unadorned]) + ]);; + (* }}} *) + +let scs_diag_cs_adj = prove_by_refinement( + `!k a b i j. scs_diag k i j ==> cs_adj k a b i j = b`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_diag;Appendix.cs_adj]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let cs_adj_SUC = prove_by_refinement( + `!k a b i j. 1 < k ==> cs_adj k a b i (SUC i) = a`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_diag;Appendix.cs_adj]; + BY(MESON_TAC[Qknvmlb.SUC_MOD_NOT_EQ]) + ]);; + (* }}} *) + +let scs_6T1_props = prove_by_refinement( + `scs_k_v39 scs_6T1 = 6 /\ + scs_basic_v39 scs_6T1 /\ + (!vv i j. BBs_v39 scs_6T1 vv /\ scs_diag 6 i j ==> cstab <= dist(vv i,vv j)) /\ + (!vv i. BBs_v39 scs_6T1 vv ==> dist(vv i, vv(SUC i)) = &2)`, + (* {{{ proof *) + [ + SUBCONJ_TAC; + BY(REWRITE_TAC[Appendix.scs_6T1;Terminal.scs_unadorned_explicit;]); + DISCH_TAC; + SUBCONJ_TAC; + BY(REWRITE_TAC[Appendix.scs_6T1;scs_basic_unadorned]); + DISCH_TAC; + MP_TAC (REWRITE_RULE[Appendix.scs_6T1] is_scs_6T1); + REWRITE_TAC[Appendix.scs_6T1;Appendix.BBs_v39;Terminal.scs_unadorned_explicit;LET_THM;Appendix.is_scs_v39]; + REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP scs_diag_cs_adj)); + BY(FIRST_X_ASSUM_ST `cs_adj` MP_TAC THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + BY(FIRST_X_ASSUM_ST `cs_adj` MP_TAC THEN MESON_TAC[cs_adj_SUC;arith `&2 <= x /\ x <= &2 ==> x = &2`;arith `1 < 6`]) + ]);; + (* }}} *) + +let scs_6T1_generic = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!vv. + (let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + BBs_v39 scs_6T1 vv /\ taustar_v39 scs_6T1 vv < &0 ==> scs_generic vv))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_THM]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (UNDISCH (REWRITE_RULE[LET_THM] RRCWNS_WEAK)); + TYPIFY `scs_6T1` EXISTS_TAC; + ASM_REWRITE_TAC[is_scs_6T1]; + ASSUME_TAC scs_6T1_props; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `3 < 6`;(REWRITE_RULE[GSYM Appendix.scs_6T1] is_scs_6T1)]; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `i+6 - 1 = i+5`]; + TYPIFY `dist(vv i,vv(i+5)) = dist(vv(i+5),vv(SUC(i+5)))` (C SUBGOAL_THEN SUBST1_TAC); + TYPIFY `vv (SUC (i+5)) = vv(i)` ENOUGH_TO_SHOW_TAC; + BY(DISCH_THEN SUBST1_TAC THEN REWRITE_TAC[DIST_SYM]); + RULE_ASSUM_TAC(REWRITE_RULE[Appendix.BBs_v39;LET_THM;scs_6T1_props;Sphere.periodic]); + BY(ASM_REWRITE_TAC[arith `SUC (i+5) = i + 6`]); + ASM_SIMP_TAC[]; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let empty_6T1 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (!vv. BBs_v39 scs_6T1 vv ==> &0 <= taustar_v39 scs_6T1 vv)` , + (* {{{ proof *) + [ + COMMENT "preliminaries, sol < pi"; + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + ASSUME_TAC (REWRITE_RULE[GSYM Appendix.scs_6T1] (is_scs_6T1)); + COMMENT "new material"; + TYPIFY `!i j. i < 6 /\ j < 6 /\ vv i = vv j ==> i = j` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC vv_inj_lemma; + BY(ASM_MESON_TAC[Appendix.scs_6T1;IN;Terminal.scs_unadorned_explicit]); + INTRO_TAC Jkqewgv.JKQEWGV1 [`scs_6T1`;`vv`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[arith `~(&0 <= t) ==> (t < &0)`]; + REWRITE_TAC[Appendix.scs_6T1]; + ASM_REWRITE_TAC[Terminal.scs_unadorned_explicit]; + BY(ARITH_TAC); + DISCH_TAC; + TYPIFY `scs_generic vv` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC (REWRITE_RULE[LET_THM] (UNDISCH scs_6T1_generic)); + BY(ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC); + COMMENT "big expansion"; + REPEAT (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[Appendix.taustar_v39;LET_DEF;LET_END_DEF;Appendix.BBs_v39;Terminal.scs_unadorned_explicit;Appendix.scs_6T1]; + REWRITE_TAC[arith `~(6 <= 3)`;Terminal.dsv_unadorned]; + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `tau_fun` MP_TAC; + REWRITE_TAC[]; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Terminal.tau_fun_azim); + TYPIFY `6` EXISTS_TAC; + ASM_REWRITE_TAC[arith `3 <= 6`;arith `&6 - &2 = &4`]; + TYPIFY `!i. dist(vv i,vv (i+1)) = &2` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`i`;`i+1`]); + REWRITE_TAC[Appendix.cs_adj;arith `i + 1 = SUC i`]; + SIMP_TAC[Qknvmlb.SUC_MOD_NOT_EQ;arith `1< 6`]; + BY(REAL_ARITH_TAC); + COMMENT "end expansion"; + COMMENT "edge lengths"; + TYPIFY `!i. cstab <= dist(vv i,vv (i+2))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`i`;`i+2`]); + TYPIFY `cs_adj 6 (&2) cstab i (i+2) = cstab` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(MESON_TAC[]); + REWRITE_TAC[Appendix.cs_adj]; + COND_CASES_TAC; + FIRST_X_ASSUM MP_TAC; + BY(MESON_TAC[arith `~(0=6) /\ (2 < 6) /\ ~(0=2)`;Oxl_2012.MOD_INJ1]); + COND_CASES_TAC; + FIRST_X_ASSUM MP_TAC; + STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[arith `SUC i = i+1 /\ i + 2 = (i+1) + 1`]; + BY(MESON_TAC[arith `~(0=6) /\ (1 < 6) /\ ~(0=1)`;Oxl_2012.MOD_INJ1]); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[arith `SUC (i+2)=i+3`]; + BY(MESON_TAC[arith `~(0=6) /\ (3 < 6) /\ ~(0=3)`;Oxl_2012.MOD_INJ1]); + BY(REWRITE_TAC[]); + TYPIFY `!i. &2 <= norm (vv i) /\ norm (vv i) <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + REWRITE_TAC[GSYM Fnjlbxs.in_ball_annulus]; + RULE_ASSUM_TAC(REWRITE_RULE[Terminal.IMAGE_SUBSET_IN;IN_UNIV]); + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. dist(vv i,vv(i+2)) <= &4` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `dist(vv i,vv (i+1)) + dist(vv (i+1),vv(i+2))` EXISTS_TAC; + CONJ_TAC; + BY(REWRITE_TAC[DIST_TRIANGLE]); + ASM_REWRITE_TAC[arith `i+2 = (i+1)+1`]; + BY(REAL_ARITH_TAC); + TYPIFY `!i. dist(vv i,vv (i+2)) <= #3.915` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (Terminal.get_main_nonlinear "6459846571") [`norm(vv (i+1))`;`norm (vv i)`;`norm (vv (i+2))`;`dist(vv i,vv (i+2))`;`dist(vv (i+1),vv(i+2))`;`dist(vv i,vv(i+1))`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`]; + ANTS_TAC; + ASM_REWRITE_TAC[arith `(i+2 = (i+1)+1)`]; + TYPIFY `#2.52 = &2 * h0` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[arith `&2 <= &2`]; + CONJ_TAC; + FIRST_X_ASSUM_ST `cstab` (C INTRO_TAC [`i`]); + REWRITE_TAC[Sphere.cstab;arith `(i+1)+1 = i+2`]; + BY(REAL_ARITH_TAC); + BY(FIRST_X_ASSUM (C INTRO_TAC [`i`]) THEN REWRITE_TAC[arith `(i+1)+1 = i+2`] THEN REAL_ARITH_TAC); + TYPIFY `dist(vv i,vv(i+1)) = dist(vv(i+1),vv(i))` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[DIST_SYM]); + REWRITE_TAC[arith `x < y <=> ~(y <= x)`;REWRITE_RULE[LET_THM] Tame_lemmas.delta_y_pos]; + BY(REAL_ARITH_TAC); + COMMENT "azim le pi"; + TYPIFY `!i. azim (vec 0) (vv i) (vv (i+1)) (vv (i + 6 -1)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[Localization.convex_local_fan]); + ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `i+1 = SUC i`]; + GMATCH_SIMP_TAC (GSYM azim_in_fan_azim); + TYPIFY `IMAGE (\i. {vv i, vv (SUC i)}) (:num)` EXISTS_TAC; + ASM_REWRITE_TAC[arith `3 <= 6`]; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[IN_IMAGE;IN_UNIV]); + COMMENT "expand sol_local"; + FIRST_X_ASSUM_ST `sol_local` MP_TAC; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] sol_local_azim); + TYPIFY `6` EXISTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[arith `3 <= 6`]); + DISCH_TAC; + COMMENT "split azim"; + RULE_ASSUM_TAC(REWRITE_RULE[Appendix.scs_generic]); + TYPIFY `!i. azim(vec 0) (vv i) (vv (SUC i)) (vv (i + 5)) = azim(vec 0) (vv i) (vv (SUC i)) (vv (i+2)) + azim(vec 0) (vv i) (vv (i+2)) (vv (i+4)) + azim (vec 0) (vv i) (vv (i+4)) (vv (i+5))` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + INTRO_TAC Terminal.vv_split_azim_generic [`vv`;`6`;`i`;`4`;`5`]; + ASM_REWRITE_TAC[LET_THM;arith `3 <= 6 /\ 0 < 4 /\ 4 < 5 /\ 5 < 6`]; + DISCH_THEN SUBST1_TAC; + INTRO_TAC Terminal.vv_split_azim_generic [`vv`;`6`;`i`;`2`;`4`]; + ASM_REWRITE_TAC[LET_THM;arith `3 <= 6 /\ 0 < 2 /\ 2 < 4 /\ 4 < 6`]; + BY(REAL_ARITH_TAC); + COMMENT "expand sums"; + FIRST_X_ASSUM_ST `sum` MP_TAC; + TYPIFY `{i | i < 6 } = {0,1,2,3,4,5}` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; + BY(ARITH_TAC); + REPEAT (GMATCH_SIMP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt THEN REWRITE_TAC[NOT_IN_EMPTY;IN_INSERT;arith `~(0=1)/\ ~(0=2)/\ ~(0=3) /\ ~(0=4) /\ ~(0=5) /\ ~(1=2) /\ ~(1 = 3) /\ ~(1 = 4) /\ ~(1=5) /\ ~(2 = 3) /\ ~(2 = 4) /\ ~(2 = 5) /\ ~(3 = 4) /\ ~(3 =5) /\ ~(4 = 5)`]); + REWRITE_TAC[SUM_CLAUSES;Geomdetail.FINITE6]; + REWRITE_TAC[arith `i + 1 = SUC i`]; + FIRST_ASSUM (C INTRO_TAC [`0`]); + FIRST_ASSUM (C INTRO_TAC [`2`]); + FIRST_X_ASSUM (C INTRO_TAC [`4`]); + FIRST_ASSUM (C INTRO_TAC [`0`]); + FIRST_ASSUM (C INTRO_TAC [`1`]); + FIRST_ASSUM (C INTRO_TAC [`2`]); + FIRST_ASSUM (C INTRO_TAC [`3`]); + FIRST_ASSUM (C INTRO_TAC [`4`]); + FIRST_X_ASSUM (C INTRO_TAC [`5`]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `azim (vec 0) (vv 4) (vv (SUC 4)) (vv (4 + 2)) <= pi /\ azim (vec 0) (vv 4) (vv (4 + 2)) (vv (4 + 4)) <= pi /\ azim (vec 0) (vv 4) (vv (4 + 4)) (vv (4 + 5)) <= pi /\ azim (vec 0) (vv 2) (vv (SUC 2)) (vv (2 + 2)) <= pi /\ azim (vec 0) (vv 2) (vv (2 + 2)) (vv (2 + 4)) <= pi /\ azim (vec 0) (vv 2) (vv (2 + 4)) (vv (2 + 5)) <= pi /\ azim (vec 0) (vv 0) (vv (SUC 0)) (vv (0 + 2)) <= pi /\ azim (vec 0) (vv 0) (vv (0 + 2)) (vv (0 + 4)) <= pi /\ azim (vec 0) (vv 0) (vv (0 + 4)) (vv (0 + 5)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + MP_TAC Counting_spheres.AZIM_NN; + REPEAT (FIRST_X_ASSUM_ST `x <= pi` MP_TAC); + ASM_REWRITE_TAC[arith `i + 1 = SUC i /\ 6 - 1 = 5`]; + BY(MESON_TAC[arith `&0 <= x /\ &0 <= y /\ &0 <= z /\ x + y + z <= pi ==> x <= pi /\ y <= pi /\ z <= pi`]); + FIRST_X_ASSUM_ST `&6 - &2` MP_TAC; + ASM_REWRITE_TAC[arith `6 - 1 = 5`]; + RULE_ASSUM_TAC(REWRITE_RULE[arith `6 - 1 = 5 /\ i + 1 = SUC i`]); + COMMENT "collinearity"; + TYPIFY `!i j. ~(vv i = vv j) ==> ~collinear {vec 0,vv i,vv j}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Nkezbfc_local.PROPERTIES_GENERIC_LOCAL_FAN [`IMAGE vv (:num)`;`IMAGE (\i. {vv i, vv (SUC i)}) (:num)`;`IMAGE (\i. vv i,vv (SUC i)) (:num)`;`vv i`]; + ASM_SIMP_TAC[Local_lemmas.CVX_LO_IMP_LO]; + REWRITE_TAC[Qknvmlb.IN_IMAGE_VV]; + DISCH_THEN (C INTRO_TAC [`vv j`]); + BY(ASM_REWRITE_TAC[Qknvmlb.IN_IMAGE_VV]); + COMMENT "convert to dih"; + ASSUME_TAC (arith `SUC 0 = 1 /\ SUC 1 = 2 /\ SUC 2 = 3 /\ SUC 3 = 4 /\ SUC 4 = 5 /\ SUC 5 = 6 /\ 0+2=2 /\ 0+4=4 /\ 0+5=5 /\ 1+5=6 /\ 3+5 = 8 /\ 5 + 5 = 10 /\ 2 + 2 = 4 /\ 2+4=6 /\ 2+5=7 /\ 4+2=6 /\ 4+4=8 /\ 4+5=9`); + ASM_REWRITE_TAC[]; + TYPIFY `vv 6 = vv 0 /\ vv 7 = vv 1 /\ vv 8 = vv 2 /\ vv 9 = vv 3 /\ vv 10 = vv 4` (C SUBGOAL_THEN ASSUME_TAC); + ONCE_REWRITE_TAC[arith `6 = 0 + 6 /\ 7 = 1 + 6 /\ 8 = 2 + 6 /\ 9 = 3 + 6 /\ 10 = 4 + 6`]; + FIRST_X_ASSUM_ST `periodic` MP_TAC; + BY(SIMP_TAC [Sphere.periodic]); + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `azim` MP_TAC) THEN ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!i j. (i < 6 /\ j < 6 /\ ~(i = j)) ==> ~collinear {vec 0 ,vv i ,vv j}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + DISCH_TAC; + FIRST_X_ASSUM_ST `~` MP_TAC; + REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `azim (vec 0) (vv 0) (vv 1) (vv 2) = dihV (vec 0) (vv 0) (vv 1) (vv 2) /\ azim (vec 0) (vv 0) (vv 2) (vv 4) = dihV (vec 0) (vv 0) (vv 2) (vv 4) /\ azim (vec 0) (vv 0) (vv 4) (vv 5) = dihV (vec 0) (vv 0) (vv 4) (vv 5) /\ azim (vec 0) (vv 1) (vv 2) (vv 0) = dihV (vec 0) (vv 1) (vv 2) (vv 0) /\ azim (vec 0) (vv 2) (vv 3) (vv 4) = dihV (vec 0) (vv 2) (vv 3) (vv 4) /\ azim (vec 0) (vv 2) (vv 4) (vv 0) = dihV (vec 0) (vv 2) (vv 4) (vv 0) /\ azim (vec 0) (vv 2) (vv 0) (vv 1) = dihV (vec 0) (vv 2) (vv 0) (vv 1) /\ azim (vec 0) (vv 3) (vv 4) (vv 2) = dihV (vec 0) (vv 3) (vv 4) (vv 2) /\ azim (vec 0) (vv 4) (vv 5) (vv 0) = dihV (vec 0) (vv 4) (vv 5) (vv 0) /\ azim (vec 0) (vv 4) (vv 0) (vv 2) = dihV (vec 0) (vv 4) (vv 0) (vv 2) /\ azim (vec 0) (vv 4) (vv 2) (vv 3) = dihV (vec 0) (vv 4) (vv 2) (vv 3) /\ azim (vec 0) (vv 5) (vv 0) (vv 4) = dihV (vec 0) (vv 5) (vv 0) (vv 4)` (C SUBGOAL_THEN ASSUME_TAC); + ASSUME_TAC (arith `0 < 6 /\ 1 < 6 /\ 2 < 6 /\ 3 < 6 /\ 4 < 6 /\ 5 < 6 /\ ~(0=1)/\ ~(0=2)/\ ~(0=3) /\ ~(0=4) /\ ~(0=5) /\ ~(1=2) /\ ~(1 = 3) /\ ~(1 = 4) /\ ~(1=5) /\ ~(2 = 3) /\ ~(2 = 4) /\ ~(2 = 5) /\ ~(3 = 4) /\ ~(3 =5) /\ ~(4 = 5)`); + BY(REPEAT (CONJ_TAC) THEN MATCH_MP_TAC Polar_fan.AZIM_DIHV_SAME_STRONG THEN ASM_REWRITE_TAC[] THEN CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + TYPIFY `#0.712 <= tau3 (vv 0) (vv 1) (vv 2) + tau3 (vv 0) (vv 2) (vv 4) + tau3 (vv 0) (vv 4) (vv 5) + tau3 (vv 2) (vv 3) (vv 4)` ENOUGH_TO_SHOW_TAC; + ONCE_REWRITE_TAC[arith `&0 <= a - b - c <=> c <= a - b`]; + MATCH_MP_TAC (arith `d = #0.712 /\ ts = rs ==> (#0.712 <= ts ==> d <= rs)`); + REWRITE_TAC[Appendix.d_tame;arith `~( 6=3) /\ ~(6 = 4) /\ ~(6 = 5)`]; + REWRITE_TAC[Appendix.tau3;Appendix.rho_rho_fun]; + BY(REAL_ARITH_TAC); + REPEAT (GMATCH_SIMP_TAC Terminal.tau3_taum_40); + ASM_REWRITE_TAC[]; + RULE_ASSUM_TAC(REWRITE_RULE[Terminal.IMAGE_SUBSET_IN;IN_UNIV]); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `dist(a,b) = &2` MP_TAC; + DISCH_TAC; + FIRST_ASSUM (C INTRO_TAC [`0`]); + FIRST_ASSUM (C INTRO_TAC [`1`]); + FIRST_ASSUM (C INTRO_TAC [`2`]); + FIRST_ASSUM (C INTRO_TAC [`3`]); + FIRST_ASSUM (C INTRO_TAC [`4`]); + FIRST_X_ASSUM (C INTRO_TAC [`5`]); + ASM_REWRITE_TAC[DIST_SYM]; + REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `cstab <= dist(a,b)` MP_TAC; + DISCH_TAC; + FIRST_ASSUM (C INTRO_TAC [`0`]); + FIRST_ASSUM (C INTRO_TAC [`2`]); + FIRST_X_ASSUM (C INTRO_TAC [`4`]); + ASM_REWRITE_TAC[DIST_SYM]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `dist(a,b) <= #3.915` MP_TAC; + DISCH_TAC; + FIRST_ASSUM (C INTRO_TAC [`0`]); + FIRST_ASSUM (C INTRO_TAC [`2`]); + FIRST_X_ASSUM (C INTRO_TAC [`4`]); + ASM_REWRITE_TAC[DIST_SYM]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[TAUT `a /\ b /\ c <=> (a /\ b) /\ c`]; + CONJ_TAC; + BY(REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.cstab] THEN REAL_ARITH_TAC); + COMMENT "introduce ineq"; + INTRO_TAC Pent_hex.terminal_hex_taum [`norm (vv 0)`;`norm (vv 2)`;`norm (vv 4)`;`dist (vv 2,vv 4)`;`dist(vv 0,vv 4)`;`dist(vv 0,vv 2)`;`norm (vv 3)`;`norm(vv 1)`;`norm (vv 5)`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`]; + ANTS_TAC; + REPEAT (FIRST_X_ASSUM_ST `azim` kill); + ASM_REWRITE_TAC[]; + TYPIFY `#2.52 = &2 * h0` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[DIST_SYM;GSYM Sphere.cstab]); + COMMENT "break into final cases"; + STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[DIST_SYM]; + REWRITE_TAC[Terminal.taum_sym]; + BY(REAL_ARITH_TAC); + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `delta_y` MP_TAC; + INTRO_TAC Tame_lemmas.delta_y_pos [`vv 5`;`vv 0`;`vv 4`]; + ASM_REWRITE_TAC[LET_THM;DIST_SYM]; + BY(REAL_ARITH_TAC); + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `delta_y` MP_TAC; + INTRO_TAC Tame_lemmas.delta_y_pos [`vv 1`;`vv 0`;`vv 2`]; + ASM_REWRITE_TAC[LET_THM;DIST_SYM]; + BY(REAL_ARITH_TAC); + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `delta_y` MP_TAC; + INTRO_TAC Tame_lemmas.delta_y_pos [`vv 3`;`vv 2`;`vv 4`]; + ASM_REWRITE_TAC[LET_THM;DIST_SYM]; + BY(REAL_ARITH_TAC); + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `eulerA_x` MP_TAC; + REWRITE_TAC[]; + MATCH_MP_TAC (arith ` e > &0 ==> ~(e < &0)`); + INTRO_TAC (UNDISCH DIH_IMP_EULER_A_POS) [`(vec 0):real^3`;`vv 0`;`vv 2`;`vv 4`]; + REWRITE_TAC[Sphere.y_of_x;DIST_SYM;LET_THM;DIST_0]; + DISCH_THEN MATCH_MP_TAC; + ASM_REWRITE_TAC[GSYM Sphere.cstab]; + TYPIFY_GOAL_THEN `~collinear {vec 0, vv 0, vv 2} /\ ~collinear {vec 0, vv 2, vv 4} /\ ~collinear {vec 0, vv 0, vv 4}` (unlist REWRITE_TAC); + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN REWRITE_TAC[arith `~(0=2) /\ ~(2 = 4) /\ ~(0=4) /\ 0 < 6 /\ 2 < 6 /\ 4 < 6`]); + FIRST_X_ASSUM_ST `(&6 - &2)` MP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `pi <= dihV (vec 0) (vv 1) (vv 2) (vv 0) + dihV (vec 0) (vv 2) (vv 0) (vv 1) + dihV (vec 0) (vv 0) (vv 1) (vv 2) /\pi <= dihV (vec 0) (vv 3) (vv 4) (vv 2) + dihV (vec 0) (vv 4) (vv 2) (vv 3)+dihV (vec 0) (vv 2) (vv 3) (vv 4) /\ pi <= dihV (vec 0) (vv 5) (vv 0) (vv 4) + dihV (vec 0) (vv 0) (vv 4) (vv 5) +dihV (vec 0) (vv 4) (vv 5) (vv 0) ` ENOUGH_TO_SHOW_TAC; + REWRITE_TAC [DIHV_SYM]; + BY(REAL_ARITH_TAC); + REPEAT (GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Merge_ineq.DIHV_EQ_DIH_Y)); + FIRST_X_ASSUM_ST `collinear` (REPEAT o GMATCH_SIMP_TAC); + REWRITE_TAC[arith `0 < 6 /\ 1 < 6 /\ 2 < 6 /\ 3 < 6 /\ 4 < 6 /\ 5 < 6 /\ ~(0=1)/\ ~(0=2)/\ ~(0=3) /\ ~(0=4) /\ ~(0=5) /\ ~(1=2) /\ ~(1 = 3) /\ ~(1 = 4) /\ ~(1=5) /\ ~(2 = 3) /\ ~(2 = 4) /\ ~(2 = 5) /\ ~(3 = 4) /\ ~(3 =5) /\ ~(4 = 5)`]; + REWRITE_TAC[arith `pi <= a + b + c <=> &0 <= a + b + c - pi`;GSYM Sphere.sol_y;DIST_SYM]; + REPEAT CONJ_TAC THEN (MATCH_MP_TAC (UNDISCH EAR_SOL_NN)) THEN ASM_REWRITE_TAC[DIST_0]; + INTRO_TAC Tame_lemmas.delta_y_pos [`vv 1`;`vv 2`;`vv 0`]; + BY(ASM_REWRITE_TAC[LET_THM;DIST_SYM]); + INTRO_TAC Tame_lemmas.delta_y_pos [`vv 3`;`vv 4`;`vv 2`]; + BY(ASM_REWRITE_TAC[LET_THM;DIST_SYM]); + INTRO_TAC Tame_lemmas.delta_y_pos [`vv 5`;`vv 0`;`vv 4`]; + BY(ASM_REWRITE_TAC[LET_THM;DIST_SYM]) + ]);; + (* }}} *) + +let is_scs_5T1 = prove_by_refinement( + `is_scs_v39 (scs_5T1)`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_5T1]; + MATCH_MP_TAC is_scs_adj; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab]; + REWRITE_TAC[arith `~(5 = 3) /\ (3 <= 5) /\ (5 <= 6) /\ (3 < 5)`]; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let scs_5T1_props = prove_by_refinement( + `scs_k_v39 scs_5T1 = 5 /\ + scs_basic_v39 scs_5T1 /\ + (!vv i j. BBs_v39 scs_5T1 vv /\ scs_diag 5 i j ==> cstab <= dist(vv i,vv j)) /\ + (!vv i. BBs_v39 scs_5T1 vv ==> dist(vv i, vv(SUC i)) = &2)`, + (* {{{ proof *) + [ + SUBCONJ_TAC; + BY(REWRITE_TAC[Appendix.scs_5T1;Terminal.scs_unadorned_explicit;]); + DISCH_TAC; + SUBCONJ_TAC; + BY(REWRITE_TAC[Appendix.scs_5T1;scs_basic_unadorned]); + DISCH_TAC; + MP_TAC is_scs_5T1; + REWRITE_TAC[Appendix.scs_5T1;Appendix.BBs_v39;Terminal.scs_unadorned_explicit;LET_THM;Appendix.is_scs_v39]; + REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP scs_diag_cs_adj)); + BY(FIRST_X_ASSUM_ST `cs_adj` MP_TAC THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + BY(FIRST_X_ASSUM_ST `cs_adj` MP_TAC THEN MESON_TAC[cs_adj_SUC;arith `&2 <= x /\ x <= &2 ==> x = &2`;arith `1 < 5`]) + ]);; + (* }}} *) + +let scs_5T1_generic = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!vv. + (let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + BBs_v39 scs_5T1 vv /\ taustar_v39 scs_5T1 vv < &0 ==> scs_generic vv))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_THM]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (UNDISCH (REWRITE_RULE[LET_THM] RRCWNS_WEAK)); + TYPIFY `scs_5T1` EXISTS_TAC; + ASM_REWRITE_TAC[is_scs_5T1]; + ASSUME_TAC scs_5T1_props; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `3 < 5`;(is_scs_5T1)]; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `i+5 - 1 = i+4`]; + TYPIFY `dist(vv i,vv(i+4)) = dist(vv(i+4),vv(SUC(i+4)))` (C SUBGOAL_THEN SUBST1_TAC); + TYPIFY `vv (SUC (i+4)) = vv(i)` ENOUGH_TO_SHOW_TAC; + BY(DISCH_THEN SUBST1_TAC THEN REWRITE_TAC[DIST_SYM]); + RULE_ASSUM_TAC(REWRITE_RULE[Appendix.BBs_v39;LET_THM;scs_5T1_props;Sphere.periodic]); + BY(ASM_REWRITE_TAC[arith `SUC (i+4) = i + 5`]); + ASM_SIMP_TAC[]; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + + + +let periodic_sum_shift = prove_by_refinement( + `!j f n. + periodic f n /\ ~(n = 0) ==> + sum { i | i < n} f = sum {i | i < n } (\i. f (j+i))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Oxl_def.periodic_sum [`f`;`n`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (C INTRO_TAC [`j`]); + TYPIFY `(0.. n - 1) = {i | i < n}` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[EXTENSION;IN_NUMSEG;IN_ELIM_THM]; + GEN_TAC; + BY(ASM_TAC THEN ARITH_TAC); + DISCH_THEN (SUBST1_TAC o GSYM); + INTRO_TAC Oxl_def.BIJ_SUM [`{i | (i:num) < n}`;`j..n - 1 + j`;`f`;`(\i. j+(i:num))`]; + ANTS_TAC; + REWRITE_TAC[BIJ;INJ;SURJ]; + SUBCONJ_TAC; + REWRITE_TAC[IN_NUMSEG;IN_ELIM_THM]; + BY(ASM_TAC THEN ARITH_TAC); + DISCH_THEN (unlist REWRITE_TAC); + REWRITE_TAC[IN_NUMSEG;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `x - (j:num)` EXISTS_TAC; + BY(ASM_TAC THEN ARITH_TAC); + DISCH_THEN (SUBST1_TAC o GSYM); + MATCH_MP_TAC SUM_EQ; + BY(REWRITE_TAC[o_THM]) + ]);; + (* }}} *) + +let c110186 = Flyspeck_constants.calc `atn (sqrt (#0.110186)) < #0.3205`;; + +let LEMMA_7175074394 = prove_by_refinement( +`main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6. ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (&2,y6,&2) + ] +( + (delta_y y1 y2 y3 y4 y5 y6 <= &20) /\ (&0 <= delta_y y1 y2 y3 y4 y5 y6) ==> + (dih_y y1 y2 y3 y4 y5 y6 < #0.3205) + ))`, + (* {{{ proof *) + [ + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;LET_THM]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (Terminal.get_main_nonlinear "2485876245a") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;LET_THM]; + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[Sphere.delta4_y;Sphere.y_of_x]; + DISCH_TAC; + INTRO_TAC (Terminal.get_main_nonlinear "7175074394") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;LET_THM]; + ASM_SIMP_TAC [arith `x <= &20 ==> ~(x > &20)`]; + DISCH_TAC; + REWRITE_TAC[Sphere.dih_y;LET_THM]; + GMATCH_SIMP_TAC Merge_ineq.lindih_lt; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + CONJ_TAC; + CONJ_TAC; + BY(MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC); + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `&0 <= (&4 * (y1 * y1) * delta_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT (GMATCH_SIMP_TAC REAL_LE_MUL); + REWRITE_TAC[GSYM Sphere.delta_y]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC Pack1.bp_bdt; + GMATCH_SIMP_TAC SQRT_POS_LE; + ASM_REWRITE_TAC[]; + CONJ_TAC; + GMATCH_SIMP_TAC REAL_LE_MUL; + GMATCH_SIMP_TAC TAN_POS_PI2_LE; + BY(MP_TAC Flyspeck_constants.bounds THEN ASM_TAC THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC SQRT_POW_2; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LT_TRANS; + TYPIFY `#0.110186 * delta4_squared_y y1 y2 y3 y4 y5 y6` EXISTS_TAC; + CONJ_TAC; + FIRST_X_ASSUM_ST `x1_delta_y` MP_TAC; + BY(REWRITE_TAC[Sphere.x1_delta_y;Sphere.delta4_squared_y;Sphere.y_of_x;Sphere.x1_delta_x]); + REWRITE_TAC[Sphere.delta4_squared_y;Sphere.y_of_x;Sphere.delta4_squared_x]; + REWRITE_TAC[arith `(x * y) pow 2 = x pow 2 * y pow 2`]; + GMATCH_SIMP_TAC REAL_LT_RMUL_EQ; + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `#0.110186 = sqrt(#0.110186) pow 2` (C SUBGOAL_THEN SUBST1_TAC); + GMATCH_SIMP_TAC SQRT_POW_2; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC Tame_inequalities.REAL_LT_SQUARE_POS; + GMATCH_SIMP_TAC SQRT_POS_LT; + CONJ_TAC; + BY(REAL_ARITH_TAC); + TYPIFY `atn(sqrt #0.110186) < atn(tan #0.3205)` ENOUGH_TO_SHOW_TAC; + BY(REWRITE_TAC[ATN_MONO_LT_EQ]); + GMATCH_SIMP_TAC TAN_ATN; + CONJ_TAC; + BY(MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[c110186]) + ]);; + (* }}} *) + + +let angle_sum_5T1 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6 y126 y135. + ineq [&2,y1,&2*h0; + &2,y2,&2*h0; + &2,y3,&2*h0; + &2,y126,&2*h0; + &2,y135,&2*h0; + &2,y4,&2; + cstab,y5,#3.237; + cstab,y6,#3.237] + (dih_y y1 y126 y135 cstab (&2) (&2) <= + dih_y y1 y2 y3 y4 y5 y6 + dih_y y1 y2 y126 (&2) (&2) y6 + dih_y y1 y3 y135 (&2) (&2) y5 /\ + &0 <= delta_y y1 y2 y126 (&2) (&2) y6 /\ &0 <= delta_y y1 y3 y135 (&2) (&2) y5 ==> + (&20 <= delta_y y1 y2 y126 (&2) (&2) y6 \/ &20 <= delta_y y1 y3 y135 (&2) (&2) y5))) + `, + (* {{{ proof *) + [ + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`]; + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[DE_MORGAN_THM;arith `~(x <= y) <=> y < x`]); + TYPIFY `#2.52 = &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + INTRO_TAC (Terminal.get_main_nonlinear "6789182745") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;GSYM Sphere.cstab]; + DISCH_TAC; + INTRO_TAC (Terminal.get_main_nonlinear "4887115291") [`y1`;`y126`;`y135`;`cstab`;`(&2)`;`(&2)`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;GSYM Sphere.cstab]; + REWRITE_TAC[arith `x <= x`]; + DISCH_TAC; + INTRO_TAC (UNDISCH LEMMA_7175074394) [`y1`;`y126`;`y2`;`(&2)`;`y6`;`(&2)`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;GSYM Sphere.cstab;LET_THM]; + INTRO_TAC (UNDISCH LEMMA_7175074394) [`y1`;`y135`;`y3`;`(&2)`;`y5`;`(&2)`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;GSYM Sphere.cstab;LET_THM]; + ONCE_REWRITE_TAC[Nonlinear_lemma.dih_y_sym]; + REPEAT (FIRST_X_ASSUM_ST `delta_y` MP_TAC) THEN REWRITE_TAC[Pent_hex.delta_y_hex_cases] THEN REPEAT WEAKER_STRIP_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_pent_taum2 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6 y126 y135. + &0 <= delta_y y126 y1 y2 y6 (&2) (&2) /\ + &0 <= delta_y y135 y1 y3 y5 (&2) (&2) /\ + dih_y y1 y126 y135 cstab (&2) (&2) <= + dih_y y1 y2 y3 y4 y5 y6 + + dih_y y1 y2 y126 (&2) (&2) y6 + + dih_y y1 y3 y135 (&2) (&2) y5 + ==> + (ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237); + (&2,y126,&2 * h0); + (&2,y135,&2 * h0) + ] + (#0.616 < taum y126 y1 y2 y6 (&2) (&2) + taum y1 y2 y3 y4 y5 y6 + taum y135 y1 y3 y5 (&2) (&2)))) + `, + (* {{{ proof *) + [ + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (UNDISCH angle_sum_5T1) [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`;`y126`;`y135`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`]; + ASM_REWRITE_TAC[Pent_hex.delta_y_hex_cases;Sphere.cstab]; + STRIP_TAC; + INTRO_TAC (UNDISCH Pent_hex.terminal_pent_taum) [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`;`y126`;`y135`]; + BY(ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`]); + INTRO_TAC (UNDISCH Pent_hex.terminal_pent_taum) [`y1`;`y3`;`y2`;`y4`;`y6`;`y5`;`y135`;`y126`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`]; + TYPIFY `taum y1 y3 y2 y4 y6 y5 = taum y1 y2 y3 y4 y5 y6` ENOUGH_TO_SHOW_TAC; + BY(REAL_ARITH_TAC); + BY(MESON_TAC[Terminal.taum_sym]) + ]);; + (* }}} *) + +let delta_diff4 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6 z4. + delta_x x1 x2 x3 x4 x5 x6 = delta_x x1 x2 x3 z4 x5 x6 + + delta_x4 x1 x2 x3 x4 x5 x6 * (x4 - z4) + x1 * (x4 - z4) pow 2`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Sphere.delta_x;Sphere.delta_x4] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let dih_y_mono = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6 y4'. + y4 <= y4' /\ &0 < y1 /\ &0 < y4 /\ + &0 < delta_y y1 y2 y3 y4 y5 y6 /\ + &0 <= delta_y y1 y2 y3 y4' y5 y6 ==> + dih_y y1 y2 y3 y4 y5 y6 <= dih_y y1 y2 y3 y4' y5 y6`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `y4 = y4'` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + ASM_CASES_TAC `&0 < delta_y y1 y2 y3 y4' y5 y6`; + REWRITE_TAC[Sphere.dih_y;LET_THM]; + MATCH_MP_TAC (arith `x < y ==> x <= y`); + MATCH_MP_TAC Tame_inequalities.DIH_X_MONO_LT_4; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_REWRITE_TAC[GSYM Sphere.delta_y]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `delta_y y1 y2 y3 y4' y5 y6 = &0` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + ASM_CASES_TAC `delta4_y y1 y2 y3 y4' y5 y6 <= &0`; + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `pi` EXISTS_TAC; + CONJ_TAC; + REWRITE_TAC[Sphere.dih_y;LET_THM]; + MATCH_MP_TAC (arith (`x < y ==> x <= y`)); + MATCH_MP_TAC Oxlzlez.DIH_X_LT_PI; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[GSYM Sphere.delta_y]); + ASM_REWRITE_TAC[Sphere.dih_y;LET_THM;Sphere.dih_x;GSYM Sphere.delta_y]; + REWRITE_TAC[arith `x * &0 = &0`;SQRT_0]; + ASM_CASES_TAC `delta4_y y1 y2 y3 y4' y5 y6 = &0`; + RULE_ASSUM_TAC(REWRITE_RULE[Sphere.y_of_x;Sphere.delta4_y]); + ASM_REWRITE_TAC[]; + BY(MESON_TAC[arith `-- &0 = &0`;Merge_ineq.atn2_0;PI_POS;arith `&0 < x ==> x <= x / &2 + x`]); + TYPIFY `delta4_y y1 y2 y3 y4' y5 y6 < &0` (C SUBGOAL_THEN MP_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[Sphere.y_of_x;Sphere.delta4_y]; + TYPED_ABBREV_TAC `u = delta_x4 (y1 * y1) (y2 * y2) (y3 * y3) (y4' * y4') (y5 * y5) (y6 * y6)`; + BY(MESON_TAC[arith `u < &0 ==> &0 < -- u`;Merge_ineq.atn2_0;arith `x <= x / &2 + x / &2`]); + INTRO_TAC delta_diff4 [`y1*y1`;`y2*y2`;`y3*y3`;`y4'*y4'`;`y5*y5`;`y6*y6`;`y4*y4`]; + RULE_ASSUM_TAC(REWRITE_RULE[Sphere.delta_y;Sphere.delta4_y;Sphere.y_of_x]); + ASM_REWRITE_TAC[]; + ENOUGH_TO_SHOW_TAC `&0 < delta_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6) /\ &0 <= delta_x4 (y1 * y1) (y2 * y2) (y3 * y3) (y4' * y4') (y5 * y5) (y6 * y6) * (y4' * y4' - y4 * y4) /\ &0 <= (y1 * y1) * (y4' * y4' - y4 * y4) pow 2`; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + CONJ_TAC; + GMATCH_SIMP_TAC REAL_LE_MUL; + REWRITE_TAC[arith `&0 <= a - b <=> b <= a`]; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + BY(ASM_TAC THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LE_MUL; + REWRITE_TAC[ REAL_LE_POW_2]; + BY(REWRITE_TAC[ REAL_LE_SQUARE]) + ]);; + (* }}} *) + +let MOD_EQ_MOD_SHIFT = prove_by_refinement( + `!n x1 x2 y. ~(n=0) ==> (((y + x1) MOD n = (y + x2) MOD n) <=> (x1 MOD n = x2 MOD n))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (TAUT `((a ==> b) /\ (b ==> a)) ==> (a <=> b)`); + CONJ_TAC; + BY(ASM_MESON_TAC[Hdplygy.MOD_EQ_MOD]); + BY(ASM_MESON_TAC[MOD_ADD_MOD]) + ]);; + (* }}} *) + +let empty_5T1 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (!vv. BBs_v39 scs_5T1 vv ==> &0 <= taustar_v39 scs_5T1 vv)` , + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + ASSUME_TAC ((is_scs_5T1)); + COMMENT "new material"; + TYPIFY `!i j. i < 5 /\ j < 5 /\ vv i = vv j ==> i = j` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC vv_inj_lemma; + BY(ASM_MESON_TAC[Appendix.scs_5T1;IN;Terminal.scs_unadorned_explicit]); + TYPIFY `scs_generic vv` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC (REWRITE_RULE[LET_THM] (UNDISCH scs_5T1_generic)); + BY(ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC); + COMMENT "big expansion"; + REPEAT (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[Appendix.taustar_v39;LET_DEF;LET_END_DEF;Appendix.BBs_v39;Terminal.scs_unadorned_explicit;Appendix.scs_5T1]; + REWRITE_TAC[arith `~(5 <= 3)`;Terminal.dsv_unadorned]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `tau_fun` MP_TAC; + REWRITE_TAC[]; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Terminal.tau_fun_azim); + TYPIFY `5` EXISTS_TAC; + ASM_REWRITE_TAC[arith `3 <= 5`;arith `&5 - &2 = &3`]; + TYPIFY `!i. dist(vv i,vv (i+1)) = &2` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`i`;`i+1`]); + REWRITE_TAC[Appendix.cs_adj;arith `i + 1 = SUC i`]; + SIMP_TAC[Qknvmlb.SUC_MOD_NOT_EQ;arith `1< 5`]; + BY(REAL_ARITH_TAC); + COMMENT "end expansion"; + COMMENT "edge lengths"; + TYPIFY `!i. cstab <= dist(vv i,vv (i+2))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`i`;`i+2`]); + TYPIFY `cs_adj 5 (&2) cstab i (i+2) = cstab` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(MESON_TAC[]); + REWRITE_TAC[Appendix.cs_adj]; + COND_CASES_TAC; + FIRST_X_ASSUM MP_TAC; + BY(MESON_TAC[arith `~(0=5) /\ (2 < 5) /\ ~(0=2)`;Oxl_2012.MOD_INJ1]); + COND_CASES_TAC; + FIRST_X_ASSUM MP_TAC; + STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[arith `SUC i = i+1 /\ i + 2 = (i+1) + 1`]; + BY(MESON_TAC[arith `~(0=5) /\ (1 < 5) /\ ~(0=1)`;Oxl_2012.MOD_INJ1]); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[arith `SUC (i+2)=i+3`]; + BY(MESON_TAC[arith `~(0=5) /\ (3 < 5) /\ ~(0=3)`;Oxl_2012.MOD_INJ1]); + BY(REWRITE_TAC[]); + COMMENT "second diag"; + TYPIFY `!i. cstab <= dist(vv i,vv (i+3))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `dist` (C INTRO_TAC [`i`;`i+3`]); + TYPIFY `cs_adj 5 (&2) cstab i (i+3) = cstab` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(MESON_TAC[]); + REWRITE_TAC[Appendix.cs_adj]; + COND_CASES_TAC; + FIRST_X_ASSUM MP_TAC; + BY(MESON_TAC[arith `~(0=5) /\ (3 < 5) /\ ~(0=3)`;Oxl_2012.MOD_INJ1]); + COND_CASES_TAC; + FIRST_X_ASSUM MP_TAC; + STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[arith `SUC i = i+1 /\ i + 3 = (i+1) + 2`]; + BY(MESON_TAC[arith `~(0=5) /\ (2 < 5) /\ ~(0=2)`;Oxl_2012.MOD_INJ1]); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[arith `SUC (i+3)=i+4`]; + BY(MESON_TAC[arith `~(0=5) /\ (4 < 5) /\ ~(0=4)`;Oxl_2012.MOD_INJ1]); + BY(REWRITE_TAC[]); + COMMENT "more distances"; + TYPIFY `!i. &2 <= norm (vv i) /\ norm (vv i) <= &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + REWRITE_TAC[GSYM Fnjlbxs.in_ball_annulus]; + RULE_ASSUM_TAC(REWRITE_RULE[Terminal.IMAGE_SUBSET_IN;IN_UNIV]); + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i j. i < 5 /\ j < 5 /\ ~(i = j) ==> &2 <= dist(vv i,vv j)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`i`;`j`]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`i`;`j`]); + ASM_REWRITE_TAC[Appendix.cs_adj]; + COND_CASES_TAC; + BY(ASM_MESON_TAC[MOD_LT]); + TYPIFY `&2 <= cstab` (C SUBGOAL_THEN MP_TAC); + BY(REWRITE_TAC[Sphere.cstab] THEN REAL_ARITH_TAC); + BY(REAL_ARITH_TAC); + COMMENT "1+sqrt(5)"; + TYPIFY `?j. j < 5 /\ dist(vv j,vv (j+2)) <= &1 + sqrt(&5) /\ dist(vv j,vv (j+3)) <= &1 + sqrt(&5)` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC Vpwshto.VPWSHTO_PRIME [`vv`]; + ANTS_TAC; + ONCE_REWRITE_TAC[GSYM dist]; + CONJ_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[Terminal.IMAGE_SUBSET_IN;IN_UNIV]); + BY(FIRST_X_ASSUM_ST `ball_annulus` MP_TAC THEN SET_TAC[]); + REWRITE_TAC[Sphere.packing]; + TYPIFY_GOAL_THEN `!a b c d e (f:real^3). {a,b,c,d,e} f <=> (f = a \/ f = b \/ f = c \/ f = d \/ f = e)` (unlist REWRITE_TAC); + REWRITE_TAC[INSERT;IN_ELIM_THM;NOT_IN_EMPTY]; + BY(MESON_TAC[]); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?i j. u = vv i /\ v = vv j /\ i < 5 /\ j < 5 /\ ~(i=j)` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[arith `0 < 5 /\ 1 < 5 /\ 2 < 5 /\ 3 < 5 /\ 4 < 5`]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY_GOAL_THEN `~(vv 0 = vv 1) /\ ~(vv 0 = vv 1) /\ ~(vv 0 = vv 2) /\ ~(vv 0 = vv 3) /\ ~(vv 0 = vv 4) /\ ~(vv 1 = vv 2) /\ ~(vv 1 = vv 3) /\ ~(vv 1 = vv 4) /\ ~(vv 2 = vv 3) /\ ~(vv 2 = vv 4) /\ ~(vv 3 = vv 4)` (unlist REWRITE_TAC); + TYPIFY `!i j. i < 5 /\ j < 5 /\ ~(i = j) ==> ~(vv i = vv j)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[]); + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ARITH_TAC); + TYPIFY `vv 0 = vv 5` (C SUBGOAL_THEN ASSUME_TAC); + ONCE_REWRITE_TAC[arith `5 = 0 +5`]; + BY(ASM_MESON_TAC[Sphere.periodic]); + BY(ASM_MESON_TAC[arith `1 = 0+1 /\ 2 = 1+1 /\ 3 = 2+1 /\ 4 = 3+1 /\ 5 = 4+1`]); + REWRITE_TAC[GSYM dist]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `i` EXISTS_TAC; + CONJ_TAC; + FIRST_X_ASSUM_ST `IN` MP_TAC; + REWRITE_TAC[IN_NUMSEG]; + BY(ARITH_TAC); + BY(ASM_MESON_TAC[Oxl_def.periodic_mod;arith `~(5=0)`]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "pick up the hex flow again"; + COMMENT "azim le pi"; + TYPIFY `!i. azim (vec 0) (vv i) (vv (i+1)) (vv (i + 5 -1)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[Localization.convex_local_fan]); + ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `i+1 = SUC i`]; + GMATCH_SIMP_TAC (GSYM azim_in_fan_azim); + TYPIFY `IMAGE (\i. {vv i, vv (SUC i)}) (:num)` EXISTS_TAC; + ASM_REWRITE_TAC[arith `3 <= 5`]; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[IN_IMAGE;IN_UNIV]); + COMMENT "split azim"; + RULE_ASSUM_TAC(REWRITE_RULE[Appendix.scs_generic]); + TYPIFY `azim(vec 0) (vv j) (vv (SUC j)) (vv (j + 4)) = azim(vec 0) (vv j) (vv (SUC j)) (vv (j+2)) + azim(vec 0) (vv j) (vv (j+2)) (vv (j+3)) + azim (vec 0) (vv j) (vv (j+3)) (vv (j+4))` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC Terminal.vv_split_azim_generic [`vv`;`5`;`j`;`3`;`4`]; + ASM_REWRITE_TAC[LET_THM;arith `3 <= 5 /\ 0 < 3 /\ 3 < 4 /\ 4 < 5`]; + DISCH_THEN SUBST1_TAC; + INTRO_TAC Terminal.vv_split_azim_generic [`vv`;`5`;`j`;`2`;`3`]; + ASM_REWRITE_TAC[LET_THM;arith `3 <= 5 /\ 0 < 2 /\ 2 < 3 /\ 3 < 5`]; + BY(REAL_ARITH_TAC); + COMMENT "split at j+2 and j+3"; + TYPIFY `vv (j+5) = vv j /\ vv (j+6) = vv(j+1) /\ vv (j+7) = vv(j+2) /\ vv(j+8)=vv(j+3) /\ vv(j+9) = vv(j+4)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `periodic` MP_TAC; + BY(MESON_TAC[Sphere.periodic;arith `j+6 = (j+1)+5 /\ j+7 = (j+2)+5 /\ j+8 = (j+3)+5 /\ j+9 = (j+4)+5`]); + ASSUME_TAC (arith `SUC(j) = j+1 /\ SUC(j+1)=j+2 /\ SUC(j+2)=j+3 /\ SUC(j+3)=j+4 /\ SUC(j+4)=j+5`); + TYPIFY `azim(vec 0) (vv (j+2)) (vv(SUC (j+2))) (vv (j+1)) = azim(vec 0) (vv (j+2)) (vv(SUC (j+2))) (vv(j)) + azim(vec 0) (vv (j+2)) (vv j) (vv (j+1))` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC Terminal.vv_split_azim_generic [`vv`;`5`;`j+2`;`3`;`4`]; + ASM_REWRITE_TAC[LET_THM;arith `3 <= 5 /\ 0 < 3 /\ 3 < 4 /\ 4 < 5`]; + BY(ASM_REWRITE_TAC[arith `(a +b)+(c:num) = a+(b+c) /\ 2+4=6 /\ 2+3 = 5`]); + TYPIFY `azim (vec 0) (vv(j+3)) (vv(j+4)) (vv(j+2)) = azim(vec 0) (vv(j+3)) (vv(j+4)) (vv j) + azim(vec 0) (vv(j+3)) (vv j) (vv (j+2))` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC Terminal.vv_split_azim_generic [`vv`;`5`;`j+3`;`2`;`4`]; + ASM_REWRITE_TAC[LET_THM;arith `3 <= 5 /\ 0 < 2 /\ 2 < 4 /\ 4 < 5`]; + BY(ASM_REWRITE_TAC[arith `(a +b)+(c:num) = a+(b+c) /\ 3+4=7 /\ 3+2 = 5`]); + COMMENT "expand sum"; + INTRO_TAC periodic_sum_shift [`j`]; + DISCH_THEN GMATCH_SIMP_TAC; + CONJ_TAC; + REWRITE_TAC[arith `~(5 = 0)`;Sphere.periodic]; + GEN_TAC; + REWRITE_TAC[arith `(i+5) + j = (i+j) + 5`]; + RULE_ASSUM_TAC(REWRITE_RULE[Sphere.periodic]); + BY(ASM_REWRITE_TAC[]); + TYPIFY `{i | i < 5 } = {0,1,2,3,4}` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; + BY(ARITH_TAC); + REPEAT (GMATCH_SIMP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt THEN REWRITE_TAC[NOT_IN_EMPTY;IN_INSERT;arith `~(0=1)/\ ~(0=2)/\ ~(0=3) /\ ~(0=4) /\ ~(0=5) /\ ~(1=2) /\ ~(1 = 3) /\ ~(1 = 4) /\ ~(1=5) /\ ~(2 = 3) /\ ~(2 = 4) /\ ~(2 = 5) /\ ~(3 = 4) /\ ~(3 =5) /\ ~(4 = 5)`]); + REWRITE_TAC[SUM_CLAUSES;Geomdetail.FINITE6]; + FIRST_ASSUM (C INTRO_TAC [`j`]); + FIRST_ASSUM (C INTRO_TAC [`j+1`]); + FIRST_ASSUM (C INTRO_TAC [`j+2`]); + FIRST_ASSUM (C INTRO_TAC [`j+3`]); + FIRST_X_ASSUM (C INTRO_TAC [`j+4`]); + REWRITE_TAC[arith `5-1=4`]; + REPEAT (FIRST_X_ASSUM_ST `azim` MP_TAC); + REWRITE_TAC[arith `(a+b)+(c:num) = a+b+c`;arith `SUC i = i+1`]; + NUM_REDUCE_TAC; + ASM_REWRITE_TAC[]; + COMMENT "start again here"; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `azim (vec 0) (vv j) (vv (j + 3)) (vv (j + 4)) <= pi /\ azim (vec 0) (vv j) (vv (j + 1)) (vv (j + 2)) <= pi /\ azim (vec 0) (vv j) (vv (j + 2)) (vv (j + 3)) <= pi /\ azim (vec 0) (vv (j + 2)) (vv (j + 3)) (vv j) <= pi /\ azim (vec 0) (vv (j + 2)) (vv j) (vv (j + 1)) <= pi /\ azim (vec 0) (vv (j + 3)) (vv (j + 4)) (vv j) <= pi /\ azim (vec 0) (vv (j + 3)) (vv j) (vv (j + 2)) <= pi`(C SUBGOAL_THEN ASSUME_TAC); + MP_TAC Counting_spheres.AZIM_NN; + REPEAT (FIRST_X_ASSUM_ST `x <= pi` MP_TAC); + REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC); + BY(MESON_TAC[arith `&0 <= x /\ &0 <= y /\ &0 <= z /\ x + y + z <= pi ==> x <= pi /\ y <= pi /\ z <= pi`;arith `&0 <= x /\ &0 <= y /\ x + y <= pi ==> x <= pi /\ y <= pi`]); + COMMENT "collinearity"; + TYPIFY `!i i'. (i < 5 /\ i' < 5 /\ ~(i=i')) ==> ~collinear {vec 0,vv (j+i),vv (j+i')}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Nkezbfc_local.PROPERTIES_GENERIC_LOCAL_FAN [`IMAGE vv (:num)`;`IMAGE (\i. {vv i, vv (SUC i)}) (:num)`;`IMAGE (\i. vv i,vv (SUC i)) (:num)`;`vv (j+(i:num))`]; + ASM_REWRITE_TAC[Qknvmlb.IN_IMAGE_VV]; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP Local_lemmas.CVX_LO_IMP_LO)); + REWRITE_TAC[arith `SUC i = i+1`]; + DISCH_THEN (unlist REWRITE_TAC); + DISCH_THEN (C INTRO_TAC [`vv (j+(i':num))`]); + (ASM_REWRITE_TAC[Qknvmlb.IN_IMAGE_VV]); + TYPIFY `!i. vv i = vv (i MOD 5) ` (C SUBGOAL_THEN MP_TAC); + GEN_TAC; + MATCH_MP_TAC (Oxl_def.periodic_mod); + BY(ASM_REWRITE_TAC[arith `~(0=5)`]); + DISCH_THEN (unlist ONCE_REWRITE_TAC); + DISCH_TAC; + FIRST_X_ASSUM_ST `x ==> (i:num) = j` (C INTRO_TAC [`(j+i') MOD 5`;`(j+i) MOD 5`]); + FIRST_X_ASSUM (SUBST1_TAC); + SIMP_TAC[arith `~(5 = 0)`;DIVISION]; + DISCH_TAC; + INTRO_TAC Hdplygy.MOD_EQ_MOD [`i`;`i'`;`j`;`5`]; + ASM_REWRITE_TAC[arith `~(5=0)`]; + REPEAT (GMATCH_SIMP_TAC MOD_LT); + BY(ASM_REWRITE_TAC[]); + COMMENT "convert to dih"; + TYPIFY `azim (vec 0) (vv j) (vv (j + 1)) (vv (j + 4)) = dihV (vec 0) (vv j) (vv (j + 1)) (vv (j + 4)) /\ azim (vec 0) (vv j) (vv (j + 3)) (vv (j + 4)) = dihV (vec 0) (vv j) (vv (j + 3)) (vv (j + 4)) /\ azim (vec 0) (vv j) (vv (j + 1)) (vv (j + 2)) = dihV (vec 0) (vv j) (vv (j + 1)) (vv (j + 2)) /\ azim (vec 0) (vv j) (vv (j + 2)) (vv (j + 3)) = dihV (vec 0) (vv j) (vv (j + 2)) (vv (j + 3)) /\ azim (vec 0) (vv (j + 2)) (vv (j + 3)) (vv j) = dihV (vec 0) (vv (j + 2)) (vv (j + 3)) (vv j) /\ azim (vec 0) (vv (j + 2)) (vv j) (vv (j + 1)) = dihV (vec 0) (vv (j + 2)) (vv j) (vv (j + 1)) /\ azim (vec 0) (vv (j + 3)) (vv (j + 4)) (vv j) = dihV (vec 0) (vv (j + 3)) (vv (j + 4)) (vv j) /\ azim (vec 0) (vv (j + 3)) (vv j) (vv (j + 2)) = dihV (vec 0) (vv (j + 3)) (vv j) (vv (j + 2)) /\ azim (vec 0) (vv (j + 4)) (vv j) (vv (j + 3)) = dihV (vec 0) (vv (j + 4)) (vv j) (vv (j + 3)) /\ azim (vec 0) (vv (j + 1)) (vv (j + 2)) (vv j) = dihV (vec 0) (vv (j + 1)) (vv (j + 2)) (vv j)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT (FIRST_X_ASSUM_ST `pi` MP_TAC); + TYPIFY `vv j = vv (j+0)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[arith `j+0=j`]); + REPEAT WEAKER_STRIP_TAC; + BY((REPEAT (CONJ_TAC) THEN MATCH_MP_TAC Polar_fan.AZIM_DIHV_SAME_STRONG THEN ASM_REWRITE_TAC[] THEN REPEAT CONJ_TAC THEN TRY (FIRST_X_ASSUM MATCH_MP_TAC) THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[])); + REWRITE_TAC[arith `j+0=j`]; + TYPIFY `#0.616 < tau3 (vv j) (vv (j+1)) (vv (j+2)) + tau3 (vv j) (vv (j+2)) (vv (j+3)) + tau3 (vv j) (vv (j+3)) (vv (j+4))` ENOUGH_TO_SHOW_TAC; + ONCE_REWRITE_TAC[arith `&0 <= a - b - c <=> c <= a - b`]; + MATCH_MP_TAC (arith `ts = rs ==> (d < ts ==> d <= rs)`); + ASM_REWRITE_TAC[Appendix.tau3;Appendix.rho_rho_fun]; + BY(REAL_ARITH_TAC); + REPEAT (GMATCH_SIMP_TAC Terminal.tau3_taum_40); + ASM_REWRITE_TAC[]; + RULE_ASSUM_TAC(REWRITE_RULE[Terminal.IMAGE_SUBSET_IN;IN_UNIV]); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `dist(a,b) = &2` MP_TAC; + DISCH_TAC; + FIRST_ASSUM (C INTRO_TAC [`j`]); + FIRST_ASSUM (C INTRO_TAC [`j+1`]); + FIRST_ASSUM (C INTRO_TAC [`j+2`]); + FIRST_ASSUM (C INTRO_TAC [`j+3`]); + FIRST_X_ASSUM (C INTRO_TAC [`j+4`]); + ASM_REWRITE_TAC[arith `((a:num) + b) + c = a+b+c`]; + NUM_REDUCE_TAC; + ASM_REWRITE_TAC[DIST_SYM]; + REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `cstab <= dist(a,b)` MP_TAC; + TYPIFY `&2 <= cstab` (C SUBGOAL_THEN MP_TAC); + BY(REWRITE_TAC[Sphere.cstab] THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY_GOAL_THEN `&2 <= dist(vv j, vv(j+3))` (unlist REWRITE_TAC); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[REAL_LE_TRANS]); + FIRST_X_ASSUM_ST `a = a1 + a2 + a3` MP_TAC; + ASM_REWRITE_TAC[]; + DISCH_TAC; + COMMENT "kill azim"; + REPEAT (FIRST_X_ASSUM_ST `azim` kill); + TYPIFY_GOAL_THEN `&2 <= dist(vv j, vv(j+2))` (unlist REWRITE_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[REAL_LE_TRANS]); + TYPIFY `&1 + sqrt(&5) < #3.237` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `sqrt(&5) < sqrt(#2.237 pow 2)` ENOUGH_TO_SHOW_TAC; + GMATCH_SIMP_TAC POW_2_SQRT; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC SQRT_MONO_LT_EQ; + BY(REAL_ARITH_TAC); + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `&5` MP_TAC) THEN REAL_ARITH_TAC); + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `&5` MP_TAC) THEN REAL_ARITH_TAC); + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `&5` MP_TAC) THEN REAL_ARITH_TAC); + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `dihV` MP_TAC; + REWRITE_TAC[]; + REPEAT (GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] Merge_ineq.DIHV_EQ_DIH_Y)); + REWRITE_TAC[DIST_0]; + REWRITE_TAC[TAUT `a /\ b /\ c <=> (a /\ b) /\ c`]; + CONJ_TAC; + TYPIFY `vv j = vv (j+0)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[arith `j+0=j`]); + BY((REPEAT (CONJ_TAC) THEN TRY (FIRST_X_ASSUM MATCH_MP_TAC) THEN NUM_REDUCE_TAC THEN ASM_REWRITE_TAC[])); + DISCH_TAC; + TYPIFY `dih_y (norm (vv j)) (norm (vv (j + 1))) (norm (vv (j + 4))) (cstab) (dist (vv j,vv (j + 4))) (dist (vv j,vv (j + 1))) <= dih_y (norm (vv j)) (norm (vv (j + 1))) (norm (vv (j + 4))) (dist (vv (j + 1),vv (j + 4))) (dist (vv j,vv (j + 4))) (dist (vv j,vv (j + 1)))` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC dih_y_mono; + CONJ_TAC; + FIRST_X_ASSUM_ST `cs_adj` (C INTRO_TAC [`j+1`;`j+4`]); + INTRO_TAC scs_diag_cs_adj [`5`;`&2`;`cstab`;`j+1`;`j+4`]; + ANTS_TAC; + REWRITE_TAC[Appendix.scs_diag]; + REWRITE_TAC[arith `SUC (j+1) = j+2 /\ SUC (j+4) = j+5`]; + SIMP_TAC[MOD_EQ_MOD_SHIFT;arith `~(5 = 0)`]; + BY(REWRITE_TAC[Uxckfpe.ARITH_5_TAC]); + BY(REAL_ARITH_TAC); + CONJ_TAC; + FIRST_X_ASSUM_ST `&2 <= norm (vv i)` (C INTRO_TAC [`j`]); + BY(REAL_ARITH_TAC); + CONJ_TAC; + BY(REWRITE_TAC[Sphere.cstab] THEN REAL_ARITH_TAC); + CONJ_TAC; + INTRO_TAC (Terminal.get_main_nonlinear "2125338128") [`norm(vv(j+1))`;`norm(vv(j+4))`;`norm(vv j)`;`dist(vv j,vv(j+4))`;`dist(vv j, vv(j+1))`;`cstab`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`;GSYM Sphere.cstab]; + ANTS_TAC; + TYPIFY `#2.52 = &2 * h0` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[Sphere.h0;Sphere.cstab] THEN REAL_ARITH_TAC); + REWRITE_TAC[Pent_hex.delta_y_hex_cases]; + BY(REAL_ARITH_TAC); + INTRO_TAC (REWRITE_RULE[LET_THM] Tame_lemmas.delta_y_pos) [`(vv j)`;` (vv (j+1))`;` (vv (j+4))`]; + BY(REWRITE_TAC[]); + COMMENT "introduce ineq"; + INTRO_TAC (UNDISCH terminal_pent_taum2) [`norm (vv(j))`;`norm (vv(j+2))`;`norm (vv(j+3))`;`dist (vv(j+2),vv(j+3))`;`dist(vv(j),vv(j+3))`;`dist(vv(j),vv(j+2))`;`norm (vv(j+1))`;`norm(vv(j+4))`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> a /\ b ==> c`]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + CONJ_TAC; + INTRO_TAC (REWRITE_RULE[LET_THM] Tame_lemmas.delta_y_pos) [`(vv (j+1))`;` (vv (j))`;` (vv (j+2))`]; + ASM_REWRITE_TAC[]; + BY(ASM_REWRITE_TAC[DIST_SYM]); + CONJ_TAC; + INTRO_TAC (REWRITE_RULE[LET_THM] Tame_lemmas.delta_y_pos) [`(vv (j+4))`;` (vv (j))`;` (vv (j+3))`]; + BY(ASM_REWRITE_TAC[DIST_SYM]); + CONJ_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN ASM_REWRITE_TAC[]; + TYPED_ABBREV_TAC `df = dih_y (norm (vv j)) (norm (vv (j + 1))) (norm (vv (j + 4))) (dist (vv (j + 1),vv (j + 4))) (&2) (&2)`; + TYPED_ABBREV_TAC `dc = dih_y (norm (vv j)) (norm (vv (j + 1))) (norm (vv (j + 4))) cstab (&2) (&2)`; + DISCH_THEN SUBST1_TAC; + MATCH_MP_TAC (arith `(a12 = a21' /\ a23 = a23' /\ a34 = a34') ==> (dc <= a12 + a23 + a34 ==> dc <= a23' + a21' + a34')`); + ASM_REWRITE_TAC[]; + ASM_REWRITE_TAC[DIST_SYM]; + BY(MESON_TAC[Nonlinear_lemma.dih_y_sym]); + CONJ_TAC; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[GSYM Sphere.cstab]; + BY(REPEAT (FIRST_X_ASSUM_ST `&5` MP_TAC) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `taum` MP_TAC; + REWRITE_TAC[]; + MATCH_MP_TAC (arith `a = b ==> ~(d < a) ==> ~(d < b)`); + MATCH_MP_TAC (arith `a1 = b1 /\ a2 = b2 /\ a3 = b3 ==> (a1 + a2 + a3 = b1 + b2 +b3)`); + ASM_REWRITE_TAC[DIST_SYM]; + BY(MESON_TAC[Terminal.taum_sym]) + ]);; + (* }}} *) + +let psort_4 = prove_by_refinement( + `!i. psort 4(i,4) = psort 4(i,0) /\ psort 4 (4,i)=psort 4 (0,i)`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.psort;LET_THM;Uxckfpe.ARITH_4_TAC] + ]);; + (* }}} *) + +let I_LT_J_LT_5_EXPLICIT = prove_by_refinement( + `!i j. (i < j /\ j < 5) <=> ((i = 0 /\ j = 1) \/ (i = 0 /\ j = 2) \/ (i = 0 /\ j = 3) \/ (i = 1 /\ j = 2) \/ + (i = 1 /\ j = 3) \/ (i = 2 /\ j = 3) \/ + (i=0 /\ j=4) \/ (i=1 /\ j=4) \/ (i=2 /\ j=4) \/ (i=3 /\ j=4))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Geomdetail.EQ_EXPAND]; + CONJ2_TAC; + BY(ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `j = 1 \/ j = 2 \/ j = 3 \/ j= 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[] THEN REPEAT (FIRST_X_ASSUM MP_TAC); + BY(ARITH_TAC); + BY(ARITH_TAC); + BY(ARITH_TAC); + BY(ARITH_TAC) + ]);; + (* }}} *) + +let MOD_5_EXPLICIT = prove_by_refinement( + `0 MOD 5 = 0 /\ 1 MOD 5 = 1 /\ 2 MOD 5 = 2 /\ 3 MOD 5 = 3 /\ 4 MOD 5 = 4 /\ + 5 MOD 5 = 0 /\ 6 MOD 5 = 1 /\ 7 MOD 5 = 2`, + (* {{{ proof *) + [ + ASM_SIMP_TAC[MOD_LT;MOD_MULT_ADD;arith `0 < 5 /\ 1 < 5 /\ 2 < 5 /\ 3 < 5 /\ 4 < 5 /\ 6 = 1*5 + 1 /\ 7 = 1*5 + 2`]; + BY(ASM_SIMP_TAC[Oxlzlez.MOD_REFL_ALT;arith `~(5 =0)`]) + ]);; + (* }}} *) + +let psort_5 = prove_by_refinement( + ` +psort 5 (0,1) = (0,1) /\ psort 5 (0,2) = (0,2) /\ psort 5(0,3) = (0,3) /\ psort 5 (0,4)=(0,4) /\ +psort 5 (1,1) = (1,1) /\ psort 5 (1,2) = (1,2) /\ psort 5(1,3) = (1,3) /\ psort 5 (1,4)=(1,4) /\ +psort 5 (2,1) = (1,2) /\ psort 5 (2,2) = (2,2) /\ psort 5(2,3) = (2,3) /\ psort 5 (2,4)=(2,4) /\ +psort 5 (3,1) = (1,3) /\ psort 5 (3,2) = (2,3) /\ psort 5(3,3) = (3,3) /\ psort 5 (3,4)=(3,4) /\ +psort 5 (4,1) = (1,4) /\ psort 5 (4,2) = (2,4) /\ psort 5(4,3) = (3,4) /\ psort 5 (4,4)=(4,4) /\ +psort 5 (4,5) = (0,4) /\ psort 5 (5,4) = (0,4) +`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.psort;LET_DEF;LET_END_DEF]; + REWRITE_TAC[MOD_5_EXPLICIT;PAIR_EQ]; + NUM_REDUCE_TAC + ]);; + (* }}} *) + + +(* NOW FINISH OTHER TERMINAL CASES *) + +is_scs_6T1;; +is_scs_5T1;; + +let is_scs_4T1 = prove_by_refinement( + `is_scs_v39 scs_4T1`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_4T1]; + MATCH_MP_TAC is_scs_adj; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab]; + NUM_REDUCE_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let is_scs_4T2 = prove_by_refinement( + `is_scs_v39 scs_4T2`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_4T2]; + MATCH_MP_TAC is_scs_adj; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab]; + NUM_REDUCE_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let is_scs_4T3 = prove_by_refinement( + `is_scs_v39 scs_4T3`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_4T3]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;Terminal.I_LT_J_LT_4_EXPLICIT]; + TYPED_ABBREV_TAC `s = {i | i < 4 /\ (&2 * #1.26 < funlist_v39 [(0,1), #3.01; (0,2),&6; (1,3),&6] (&2) 4 i (SUC i) \/ &2 < funlist_v39 [(0,1), #3.01; (0,2), #3.01; (1,3), #3.01] (&2) 4 i (SUC i))}`; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + NUM_REDUCE_TAC; + REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (REAL_ARITH_TAC); + TYPIFY `CARD s = 1` ENOUGH_TO_SHOW_TAC; + BY(ARITH_TAC); + MATCH_MP_TAC Misc_defs_and_lemmas.CARD_SING; + REWRITE_TAC[SING]; + TYPIFY `0` EXISTS_TAC; + EXPAND_TAC "s"; + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + GEN_TAC; + ASM_CASES_TAC `x = 0`; + ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4]; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[TAUT `~(a /\ b) <=> (a ==> ~b)`]; + BY(STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_4T4 = prove_by_refinement( + `is_scs_v39 scs_4T4`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_4T4]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;Terminal.I_LT_J_LT_4_EXPLICIT]; + TYPED_ABBREV_TAC `s = {i | i < 4 /\ (&2 * #1.26 < funlist_v39 [(0,1),sqrt8; (0,2),&6; (1,3), #3.01] (&2 * #1.26) 4 i (SUC i) \/ &2 < funlist_v39 [(0,1),&2 * #1.26; (0,2),sqrt8; (1,3),sqrt8] (&2) 4 i (SUC i))}`; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + NUM_REDUCE_TAC; + REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN MP_TAC sqrt8_flyspeck (* Flyspeck_constants.bounds *) THEN TRY (REAL_ARITH_TAC); + DISCH_THEN kill; + TYPIFY `CARD s = 1` ENOUGH_TO_SHOW_TAC; + BY(ARITH_TAC); + MATCH_MP_TAC Misc_defs_and_lemmas.CARD_SING; + REWRITE_TAC[SING]; + TYPIFY `0` EXISTS_TAC; + EXPAND_TAC "s"; + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + GEN_TAC; + ASM_CASES_TAC `x = 0`; + ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4]; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[TAUT `~(a /\ b) <=> (a ==> ~b)`]; + BY(STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_4T5 = prove_by_refinement( + `is_scs_v39 scs_4T5`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_4T5]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;Terminal.I_LT_J_LT_4_EXPLICIT]; + TYPED_ABBREV_TAC `s = {i | i < 4 /\ (&2 * #1.26 < funlist_v39 [(0,1), #3.01; (0,2),&6; (1,3), #3.01] (&2 * #1.26) 4 i (SUC i) \/ &2 < funlist_v39 [(0,1),&2 * #1.26; (0,2), #3.01; (1,3), #3.01] (&2) 4 i (SUC i))}`; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + NUM_REDUCE_TAC; + REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (REAL_ARITH_TAC); + TYPIFY `CARD s = 1` ENOUGH_TO_SHOW_TAC; + BY(ARITH_TAC); + MATCH_MP_TAC Misc_defs_and_lemmas.CARD_SING; + REWRITE_TAC[SING]; + TYPIFY `0` EXISTS_TAC; + EXPAND_TAC "s"; + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + GEN_TAC; + ASM_CASES_TAC `x = 0`; + ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4]; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[TAUT `~(a /\ b) <=> (a ==> ~b)`]; + BY(STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let CARD_3_SUBSET = prove_by_refinement( + `!f. CARD {i | i < 3 /\ f i} <= 3`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `CARD {i | i < 3 } = 3` ENOUGH_TO_SHOW_TAC; + DISCH_TAC; + INTRO_TAC CARD_SUBSET [`{i | i < 3 /\ f i}`;`{i | i < 3}`]; + ANTS_TAC; + CONJ_TAC; + BY(SET_TAC[]); + BY(REWRITE_TAC[FINITE_NUMSEG_LT]); + BY(ASM_TAC THEN ARITH_TAC); + BY(REWRITE_TAC[CARD_NUMSEG_LT]) + ]);; + (* }}} *) + +let is_scs_3T1 = prove_by_refinement( + `is_scs_v39 scs_3T1`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_3T1]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;Terminal.I_LT_J_LT_3_EXPLICIT;arith `x + 3 <= 6 <=> x <= 3`;CARD_3_SUBSET]; + REWRITE_TAC[arith `i < 3 <=> i=0 \/ i=1 \/ i=2`]; + NUM_REDUCE_TAC; + BY(REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_3_TAC] THEN MP_TAC sqrt8_flyspeck (* 1 *) THEN TRY (REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_3M1 = prove_by_refinement( + `is_scs_v39 scs_3M1`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_3M1]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;Terminal.I_LT_J_LT_3_EXPLICIT;arith `x + 3 <= 6 <=> x <= 3`;CARD_3_SUBSET]; + REWRITE_TAC[arith `i < 3 <=> i=0 \/ i=1 \/ i=2`]; + NUM_REDUCE_TAC; + BY(REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_3_TAC] THEN MP_TAC sqrt8_flyspeck (* 1 *) THEN TRY (REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_3T2 = prove_by_refinement( + `is_scs_v39 scs_3T2`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_3T2]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;Terminal.I_LT_J_LT_3_EXPLICIT;arith `x + 3 <= 6 <=> x <= 3`;CARD_3_SUBSET]; + REWRITE_TAC[arith `i < 3 <=> i=0 \/ i=1 \/ i=2`]; + NUM_REDUCE_TAC; + BY(REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_3_TAC] THEN MP_TAC sqrt8_flyspeck (* 1 *) THEN TRY (REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_3T3 = prove_by_refinement( + `is_scs_v39 scs_3T3`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_3T3]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;Terminal.I_LT_J_LT_3_EXPLICIT;arith `x + 3 <= 6 <=> x <= 3`;CARD_3_SUBSET]; + REWRITE_TAC[arith `i < 3 <=> i=0 \/ i=1 \/ i=2`]; + NUM_REDUCE_TAC; + BY(REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_3_TAC] THEN MP_TAC sqrt8_flyspeck (* 1 *) THEN TRY (REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_3T4 = prove_by_refinement( + `is_scs_v39 scs_3T4`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_3T4]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;Terminal.I_LT_J_LT_3_EXPLICIT;arith `x + 3 <= 6 <=> x <= 3`;CARD_3_SUBSET]; + REWRITE_TAC[arith `i < 3 <=> i=0 \/ i=1 \/ i=2`]; + NUM_REDUCE_TAC; + BY(REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_3_TAC] THEN MP_TAC sqrt8_flyspeck (* 1 *) THEN TRY (REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_3T5 = prove_by_refinement( + `is_scs_v39 scs_3T5`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_3T5]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;Terminal.I_LT_J_LT_3_EXPLICIT;arith `x + 3 <= 6 <=> x <= 3`;CARD_3_SUBSET]; + REWRITE_TAC[arith `i < 3 <=> i=0 \/ i=1 \/ i=2`]; + NUM_REDUCE_TAC; + BY(REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_3_TAC] THEN MP_TAC sqrt8_flyspeck (* 1 *) THEN TRY (REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_3T6 = prove_by_refinement( + `is_scs_v39 scs_3T6'`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_3T6]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;Terminal.I_LT_J_LT_3_EXPLICIT;arith `x + 3 <= 6 <=> x <= 3`;CARD_3_SUBSET]; + REWRITE_TAC[arith `i < 3 <=> i=0 \/ i=1 \/ i=2`]; + NUM_REDUCE_TAC; + BY(REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_3_TAC] THEN MP_TAC sqrt8_flyspeck (* 1 *) THEN TRY (REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_3T7 = prove_by_refinement( + `is_scs_v39 scs_3T7`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_3T7]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;Terminal.I_LT_J_LT_3_EXPLICIT;arith `x + 3 <= 6 <=> x <= 3`;CARD_3_SUBSET]; + REWRITE_TAC[arith `i < 3 <=> i=0 \/ i=1 \/ i=2`]; + NUM_REDUCE_TAC; + BY(REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_3_TAC] THEN MP_TAC sqrt8_flyspeck (* 1 *) THEN TRY (REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_6I1 = prove_by_refinement( + `is_scs_v39 scs_6I1`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_6I1]; + MATCH_MP_TAC is_scs_adj; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab]; + NUM_REDUCE_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let is_scs_5I1 = prove_by_refinement( + `is_scs_v39 scs_5I1`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_5I1]; + MATCH_MP_TAC is_scs_adj; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab]; + NUM_REDUCE_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let is_scs_5I2 = prove_by_refinement( + `is_scs_v39 scs_5I2`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_5I2]; + MATCH_MP_TAC is_scs_adj; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab]; + NUM_REDUCE_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN MP_TAC sqrt8_flyspeck (* 1 *) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let is_scs_5I3 = prove_by_refinement( + `is_scs_v39 scs_5I3`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_5I3]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;I_LT_J_LT_5_EXPLICIT]; + TYPED_ABBREV_TAC `s = {i | i < 5 /\ (&2 * #1.26 < funlist_v39 [(0,1),sqrt8; (0,2),&6; (0,3),&6; (1,3),&6; (1,4),&6; (2,4),&6] (&2 * #1.26) 5 i (SUC i) \/ &2 < funlist_v39 [(0,1),&2 * #1.26; (0,2),&2 * #1.26; (0,3),&2 * #1.26; (1,3), &2 * #1.26; (1,4), &2 * #1.26; (2,4),&2 * #1.26] (&2) 5 i (SUC i))}`; + REWRITE_TAC[arith `i < 5 <=> i=0 \/ i=1 \/ i=2 \/ i=3 \/ i=4`]; + NUM_REDUCE_TAC; + REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_5_TAC;psort_5] THEN MP_TAC sqrt8_flyspeck (* 1 *) THEN TRY (REAL_ARITH_TAC); + DISCH_THEN kill; + TYPIFY `CARD s = 1` ENOUGH_TO_SHOW_TAC; + BY(ARITH_TAC); + MATCH_MP_TAC Misc_defs_and_lemmas.CARD_SING; + REWRITE_TAC[SING]; + TYPIFY `0` EXISTS_TAC; + EXPAND_TAC "s"; + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[arith `i < 5 <=> i=0 \/ i=1 \/ i=2 \/ i=3 \/ i=4`]; + GEN_TAC; + ASM_CASES_TAC `x = 0`; + ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_5_TAC;psort_5]; + BY(MP_TAC sqrt8_flyspeck (* 1 *) THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[TAUT `~(a /\ b) <=> (a ==> ~b)`]; + BY(STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_5_TAC;psort_5] THEN TRY (REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_4I1 = prove_by_refinement( + `is_scs_v39 scs_4I1`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_4I1]; + MATCH_MP_TAC is_scs_adj; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab]; + NUM_REDUCE_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN MP_TAC sqrt8_flyspeck (* 1 *) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let is_scs_4I2 = prove_by_refinement( + `is_scs_v39 scs_4I2`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_4I2]; + MATCH_MP_TAC is_scs_adj; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab]; + NUM_REDUCE_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN MP_TAC sqrt8_flyspeck (* 1 *) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let is_scs_4I3 = prove_by_refinement( + `is_scs_v39 scs_4I3`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_4I3]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;Terminal.I_LT_J_LT_4_EXPLICIT]; + TYPED_ABBREV_TAC `s = {i | i < 4 /\ (&2 * #1.26 < funlist_v39 [(0,1),sqrt8; (0,2),&6; (1,3),&6] (&2 * #1.26) 4 i (SUC i) \/ &2 < funlist_v39 [(0,1),&2 * #1.26; (0,2),sqrt8; (1,3),sqrt8] (&2) 4 i (SUC i))}`; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + NUM_REDUCE_TAC; + REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (MP_TAC sqrt8_flyspeck (* 1 *) THEN REAL_ARITH_TAC); + TYPIFY `CARD s = 1` ENOUGH_TO_SHOW_TAC; + BY(ARITH_TAC); + MATCH_MP_TAC Misc_defs_and_lemmas.CARD_SING; + REWRITE_TAC[SING]; + TYPIFY `0` EXISTS_TAC; + EXPAND_TAC "s"; + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + GEN_TAC; + ASM_CASES_TAC `x = 0`; + ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4]; + BY(MP_TAC sqrt8_flyspeck (* 1 *) THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[TAUT `~(a /\ b) <=> (a ==> ~b)`]; + BY(STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (MP_TAC sqrt8_flyspeck (* 1 *) THEN REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_3I1 = prove_by_refinement( + `is_scs_v39 scs_3I1`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_3I1]; + MATCH_MP_TAC is_scs_adj; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab]; + NUM_REDUCE_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* +let stab_diag_basic = prove_by_refinement( + `!s i j. scs_basic_v39 s /\ ~(i = j) ==> scs_basic_v39 (scs_stab_diag_v39 s i j)`, + (* {{{ proof *) + [ + rt[Appendix.scs_is_basic;Appendix.is_scs_v39;Appendix.unadorned_v39;Appendix.scs_stab_diag_v39] + ]);; + (* }}} *) +*) + +let is_scs_6M1 = prove_by_refinement( + `is_scs_v39 scs_6M1`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_6M1]; + MATCH_MP_TAC is_scs_adj; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab]; + NUM_REDUCE_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let is_scs_5M1 = prove_by_refinement( + `is_scs_v39 scs_5M1`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_5M1]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;I_LT_J_LT_5_EXPLICIT]; + TYPED_ABBREV_TAC `s = {i | i < 5 /\ (&2 * #1.26 < funlist_v39 [(0,1), #3.01; (0,2),&6; (0,3),&6; (1,3),&6; (1,4),&6; (2,4),&6] (&2 * #1.26) 5 i (SUC i) \/ &2 < funlist_v39 [(0,1),&2 * #1.26; (0,2),&2 * #1.26; (0,3),&2 * #1.26; (1,3), &2 * #1.26; (1,4), &2 * #1.26; (2,4),&2 * #1.26] (&2) 5 i (SUC i))}`; + REWRITE_TAC[arith `i < 5 <=> i=0 \/ i=1 \/ i=2 \/ i=3 \/ i=4`]; + NUM_REDUCE_TAC; + REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_5_TAC;psort_5] THEN TRY (REAL_ARITH_TAC); + TYPIFY `CARD s = 1` ENOUGH_TO_SHOW_TAC; + BY(ARITH_TAC); + MATCH_MP_TAC Misc_defs_and_lemmas.CARD_SING; + REWRITE_TAC[SING]; + TYPIFY `0` EXISTS_TAC; + EXPAND_TAC "s"; + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[arith `i < 5 <=> i=0 \/ i=1 \/ i=2 \/ i=3 \/ i=4`]; + GEN_TAC; + ASM_CASES_TAC `x = 0`; + ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_5_TAC;psort_5]; + BY(MP_TAC sqrt8_flyspeck (* 1 *) THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[TAUT `~(a /\ b) <=> (a ==> ~b)`]; + BY(STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_5_TAC;psort_5] THEN TRY (REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_5M2 = prove_by_refinement( + `is_scs_v39 scs_5M2`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_5M2]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;I_LT_J_LT_5_EXPLICIT]; + TYPED_ABBREV_TAC `s = {i | i < 5 /\ (&2 * #1.26 < funlist_v39 [(0,1), #3.01; (0,2),&6; (0,3),&6; (1,3),&6; (1,4),&6; (2,4),&6] (&2 * #1.26) 5 i (SUC i) \/ &2 < funlist_v39 [(0,1),&2; (0,2), #3.01; (0,3), #3.01; (1,3), #3.01; (1,4), #3.01; (2,4), #3.01] (&2) 5 i (SUC i))}`; + REWRITE_TAC[arith `i < 5 <=> i=0 \/ i=1 \/ i=2 \/ i=3 \/ i=4`]; + NUM_REDUCE_TAC; + REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_5_TAC;psort_5] THEN TRY (REAL_ARITH_TAC); + TYPIFY `CARD s = 1` ENOUGH_TO_SHOW_TAC; + BY(ARITH_TAC); + MATCH_MP_TAC Misc_defs_and_lemmas.CARD_SING; + REWRITE_TAC[SING]; + TYPIFY `0` EXISTS_TAC; + EXPAND_TAC "s"; + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[arith `i < 5 <=> i=0 \/ i=1 \/ i=2 \/ i=3 \/ i=4`]; + GEN_TAC; + ASM_CASES_TAC `x = 0`; + ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_5_TAC;psort_5]; + BY(MP_TAC sqrt8_flyspeck (* 1 *) THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[TAUT `~(a /\ b) <=> (a ==> ~b)`]; + BY(STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_5_TAC;psort_5] THEN TRY (REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_4M1 = prove_by_refinement( + `is_scs_v39 scs_4M1`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_4M1]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;Terminal.I_LT_J_LT_4_EXPLICIT]; + TYPED_ABBREV_TAC `s = {i | i < 4 /\ (&2 * #1.26 < funlist_v39 [(0,1), #3.01; (0,2),&6; (1,3),&6] (&2 * #1.26) 4 i (SUC i) \/ &2 < funlist_v39 [(0,1),&2 * #1.26; (0,2),&2 * #1.26; (1,3),&2 * #1.26] (&2) 4 i (SUC i))}`; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + NUM_REDUCE_TAC; + REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (MP_TAC sqrt8_flyspeck (* 1 *) THEN REAL_ARITH_TAC); + TYPIFY `CARD s = 1` ENOUGH_TO_SHOW_TAC; + BY(ARITH_TAC); + MATCH_MP_TAC Misc_defs_and_lemmas.CARD_SING; + REWRITE_TAC[SING]; + TYPIFY `0` EXISTS_TAC; + EXPAND_TAC "s"; + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + GEN_TAC; + ASM_CASES_TAC `x = 0`; + ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4]; + BY(MP_TAC sqrt8_flyspeck (* 1 *) THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[TAUT `~(a /\ b) <=> (a ==> ~b)`]; + BY(STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (MP_TAC sqrt8_flyspeck (* 1 *) THEN REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_4M2 = prove_by_refinement( + `is_scs_v39 scs_4M2`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_4M2]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;Terminal.I_LT_J_LT_4_EXPLICIT]; + TYPED_ABBREV_TAC `s = {i | i < 4 /\ (&2 * #1.26 < funlist_v39 [(0,1), #3.01; (0,2),&6; (1,3),&6] (&2 * #1.26) 4 i (SUC i) \/ &2 < funlist_v39 [(0,1),&2 * #1.26; (0,2),&2 * #1.26; (1,3),&2 * #1.26] (&2) 4 i (SUC i))}`; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + NUM_REDUCE_TAC; + REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (MP_TAC sqrt8_flyspeck (* 1 *) THEN REAL_ARITH_TAC); + TYPIFY `CARD s = 1` ENOUGH_TO_SHOW_TAC; + BY(ARITH_TAC); + MATCH_MP_TAC Misc_defs_and_lemmas.CARD_SING; + REWRITE_TAC[SING]; + TYPIFY `0` EXISTS_TAC; + EXPAND_TAC "s"; + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + GEN_TAC; + ASM_CASES_TAC `x = 0`; + ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4]; + BY(MP_TAC sqrt8_flyspeck (* 1 *) THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[TAUT `~(a /\ b) <=> (a ==> ~b)`]; + BY(STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (MP_TAC sqrt8_flyspeck (* 1 *) THEN REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_4M3 = prove_by_refinement( + `is_scs_v39 scs_4M3'`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_4M3]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;Terminal.I_LT_J_LT_4_EXPLICIT]; + TYPED_ABBREV_TAC `s = {i | i < 4 /\ (&2 * #1.26 < funlist_v39 [(0,1), #3.01; (0,2),&6; (1,3),&6] (&2 * #1.26) 4 i (SUC i) \/ &2 < funlist_v39 [(0,1),sqrt8; (0,2),sqrt8; (1,3),sqrt8] (&2) 4 i (SUC i))}`; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + NUM_REDUCE_TAC; + REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (MP_TAC sqrt8_flyspeck (* 1 *) THEN REAL_ARITH_TAC); + TYPIFY `CARD s = 1` ENOUGH_TO_SHOW_TAC; + BY(ARITH_TAC); + MATCH_MP_TAC Misc_defs_and_lemmas.CARD_SING; + REWRITE_TAC[SING]; + TYPIFY `0` EXISTS_TAC; + EXPAND_TAC "s"; + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + GEN_TAC; + ASM_CASES_TAC `x = 0`; + ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4]; + BY(MP_TAC sqrt8_flyspeck (* 1 *) THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[TAUT `~(a /\ b) <=> (a ==> ~b)`]; + BY(STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (MP_TAC sqrt8_flyspeck (* 1 *) THEN REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_4M4 = prove_by_refinement( + `is_scs_v39 scs_4M4'`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_4M4]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;Terminal.I_LT_J_LT_4_EXPLICIT]; + TYPED_ABBREV_TAC `s = {i | i < 4 /\ (&2 * #1.26 < funlist_v39 [(0,1), #3.01; (1,2), #3.01; (0,2),&6; (1,3),&6] (&2 * #1.26) 4 i (SUC i) \/ &2 < funlist_v39 [(0,1),&2 * #1.26; (1,2),&2 * #1.26; (0,2),&2 * #1.26; (1,3), &2 * #1.26] (&2) 4 i (SUC i))}`; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + NUM_REDUCE_TAC; + REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (REAL_ARITH_TAC); + TYPIFY `s = {0,1}` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(MESON_TAC[Geomdetail.CARD2;arith `x <= 2 ==> x + 4 <= 6`]); + EXPAND_TAC "s"; + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + GEN_TAC; + ASM_CASES_TAC `x = 0`; + ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4]; + BY( REAL_ARITH_TAC); + ASM_CASES_TAC `x = 1`; + ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4]; + BY( REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[TAUT `~(a /\ b) <=> (a ==> ~b)`]; + BY(STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_4M5 = prove_by_refinement( + `is_scs_v39 scs_4M5'`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_4M5]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;Terminal.I_LT_J_LT_4_EXPLICIT]; + TYPED_ABBREV_TAC `s = {i | i < 4 /\ (&2 * #1.26 < funlist_v39 [(0,1), #3.01; (2,3), #3.01; (0,2),&6; (1,3),&6] (&2 * #1.26) 4 i (SUC i) \/ &2 < funlist_v39 [(0,1),&2 * #1.26; (2,3),&2 * #1.26; (0,2),&2 * #1.26; (1,3), &2 * #1.26] (&2) 4 i (SUC i))}`; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + NUM_REDUCE_TAC; + REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (REAL_ARITH_TAC); + TYPIFY `s = {0,2}` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(MESON_TAC[Geomdetail.CARD2;arith `x <= 2 ==> x + 4 <= 6`]); + EXPAND_TAC "s"; + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + GEN_TAC; + ASM_CASES_TAC `x = 0`; + ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4]; + BY( REAL_ARITH_TAC); + ASM_CASES_TAC `x = 2`; + ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4]; + BY( REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[TAUT `~(a /\ b) <=> (a ==> ~b)`]; + BY(STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_4M6 = prove_by_refinement( + `is_scs_v39 scs_4M6'`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_4M6]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;Terminal.I_LT_J_LT_4_EXPLICIT]; + TYPED_ABBREV_TAC `s = {i | i < 4 /\ (&2 * #1.26 < funlist_v39 [(0,1), #3.01; (0,2),&6; (1,3),&6] (&2 * #1.26) 4 i (SUC i) \/ &2 < funlist_v39 [(0,1),&2 * #1.26; (0,2), #3.01; (1,3), #3.01] (&2) 4 i (SUC i))}`; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + NUM_REDUCE_TAC; + REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (MP_TAC sqrt8_flyspeck (* 1 *) THEN REAL_ARITH_TAC); + TYPIFY `CARD s = 1` ENOUGH_TO_SHOW_TAC; + BY(ARITH_TAC); + MATCH_MP_TAC Misc_defs_and_lemmas.CARD_SING; + REWRITE_TAC[SING]; + TYPIFY `0` EXISTS_TAC; + EXPAND_TAC "s"; + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + GEN_TAC; + ASM_CASES_TAC `x = 0`; + ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4]; + BY(MP_TAC sqrt8_flyspeck (* 1 *) THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[TAUT `~(a /\ b) <=> (a ==> ~b)`]; + BY(STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (MP_TAC sqrt8_flyspeck (* 1 *) THEN REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_4M7 = prove_by_refinement( + `is_scs_v39 scs_4M7`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_4M7]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;Terminal.I_LT_J_LT_4_EXPLICIT]; + TYPED_ABBREV_TAC `s = {i | i < 4 /\ (&2 * #1.26 < funlist_v39 [(0,1), #3.01; (1,2), #3.01; (0,2),&6; (1,3),&6; (1,3),&6] (&2 * #1.26) 4 i (SUC i) \/ &2 < funlist_v39 [(0,1),&2 * #1.26; (1,2),&2 * #1.26; (0,2), #3.01; (1,3), #3.01] (&2) 4 i (SUC i))}`; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + NUM_REDUCE_TAC; + REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (REAL_ARITH_TAC); + TYPIFY `s = {0,1}` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(MESON_TAC[Geomdetail.CARD2;arith `x <= 2 ==> x + 4 <= 6`]); + EXPAND_TAC "s"; + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + GEN_TAC; + ASM_CASES_TAC `x = 0`; + ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4]; + BY( REAL_ARITH_TAC); + ASM_CASES_TAC `x = 1`; + ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4]; + BY( REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[TAUT `~(a /\ b) <=> (a ==> ~b)`]; + BY(STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_4M8 = prove_by_refinement( + `is_scs_v39 scs_4M8`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_4M8]; + REWRITE_TAC[Appendix.mk_unadorned_v39]; + MATCH_MP_TAC is_scs_funlist_basic; + REWRITE_TAC[Appendix.d_tame;Sphere.cstab;Sphere.h0;Terminal.I_LT_J_LT_4_EXPLICIT]; + TYPED_ABBREV_TAC `s = {i | i < 4 /\ (&2 * #1.26 < funlist_v39 [(0,1), #3.01; (2,3), #3.01; (0,2),&6; (1,3),&6; (1,3),&6] (&2 * #1.26) 4 i (SUC i) \/ &2 < funlist_v39 [(0,1),&2 * #1.26; (2,3),&2 * #1.26; (0,2), #3.01; (1,3), #3.01] (&2) 4 i (SUC i))} `; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + NUM_REDUCE_TAC; + REPEAT CONJ_TAC THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (REAL_ARITH_TAC); + TYPIFY `s = {0,2}` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(MESON_TAC[Geomdetail.CARD2;arith `x <= 2 ==> x + 4 <= 6`]); + EXPAND_TAC "s"; + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[arith `i < 4 <=> i=0 \/ i=1 \/ i=2 \/ i=3`]; + GEN_TAC; + ASM_CASES_TAC `x = 0`; + ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4]; + BY( REAL_ARITH_TAC); + ASM_CASES_TAC `x = 2`; + ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4]; + BY( REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[TAUT `~(a /\ b) <=> (a ==> ~b)`]; + BY(STRIP_TAC THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;Uxckfpe.ARITH_4_TAC;psort_4] THEN TRY (REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let is_scs_examples = prove_by_refinement( + `is_scs_v39 scs_6I1 /\ +is_scs_v39 scs_5I1 /\ +is_scs_v39 scs_5I2 /\ +is_scs_v39 scs_5I3 /\ +is_scs_v39 scs_4I1 /\ +is_scs_v39 scs_4I2 /\ +is_scs_v39 scs_4I3 /\ +is_scs_v39 scs_3I1 /\ + +is_scs_v39 scs_6T1 /\ +is_scs_v39 scs_5T1 /\ +is_scs_v39 scs_4T1 /\ +is_scs_v39 scs_4T2 /\ +is_scs_v39 scs_4T3 /\ +is_scs_v39 scs_4T4 /\ +is_scs_v39 scs_4T5 /\ +is_scs_v39 scs_3T1 /\ +is_scs_v39 scs_3T2 /\ +is_scs_v39 scs_3T3 /\ +is_scs_v39 scs_3T4 /\ +is_scs_v39 scs_3T5 /\ +is_scs_v39 scs_3T6' /\ +is_scs_v39 scs_3T7 /\ + +is_scs_v39 scs_6M1 /\ +is_scs_v39 scs_5M1 /\ +is_scs_v39 scs_5M2 /\ +is_scs_v39 scs_4M1 /\ +is_scs_v39 scs_4M2 /\ +is_scs_v39 scs_4M3' /\ +is_scs_v39 scs_4M4' /\ +is_scs_v39 scs_4M5' /\ +is_scs_v39 scs_4M6' /\ +is_scs_v39 scs_4M7 /\ +is_scs_v39 scs_4M8 /\ +is_scs_v39 scs_3M1 +`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[is_scs_6I1;is_scs_5I1;is_scs_5I2;is_scs_5I3;is_scs_4I1;is_scs_4I2;is_scs_4I3;is_scs_3I1; is_scs_6T1;is_scs_5T1;is_scs_4T1;is_scs_4T2;is_scs_4T3;is_scs_4T4;is_scs_4T5;is_scs_3T1;is_scs_3T2;is_scs_3T3;is_scs_3T4;is_scs_3T5;is_scs_3T6;is_scs_3T7;is_scs_6M1;is_scs_5M1;is_scs_5M2;is_scs_4M1;is_scs_4M2;is_scs_4M3;is_scs_4M4;is_scs_4M5;is_scs_4M6;is_scs_4M7;is_scs_4M8;is_scs_3M1]) + ]);; + (* }}} *) + + +let scs_example_list = [Appendix.scs_6I1;Appendix.scs_5I1;Appendix.scs_5I2;Appendix.scs_5I3;Appendix.scs_4I1;Appendix.scs_4I2;Appendix.scs_4I3;Appendix.scs_3I1; Appendix.scs_6T1;Appendix.scs_5T1;Appendix.scs_4T1;Appendix.scs_4T2;Appendix.scs_4T3;Appendix.scs_4T4;Appendix.scs_4T5;Appendix.scs_3T1;Appendix.scs_3T2;Appendix.scs_3T3;Appendix.scs_3T4;Appendix.scs_3T5;Appendix.scs_3T6;Appendix.scs_3T7;Appendix.scs_6M1;Appendix.scs_5M1;Appendix.scs_5M2;Appendix.scs_4M1;Appendix.scs_4M2;Appendix.scs_4M3;Appendix.scs_4M4;Appendix.scs_4M5;Appendix.scs_4M6;Appendix.scs_4M7;Appendix.scs_4M8;Appendix.scs_3M1];; + +let unadorned_examples = prove_by_refinement( + `unadorned_v39 scs_6I1 /\ +unadorned_v39 scs_5I1 /\ +unadorned_v39 scs_5I2 /\ +unadorned_v39 scs_5I3 /\ +unadorned_v39 scs_4I1 /\ +unadorned_v39 scs_4I2 /\ +unadorned_v39 scs_4I3 /\ +unadorned_v39 scs_3I1 /\ + +unadorned_v39 scs_6T1 /\ +unadorned_v39 scs_5T1 /\ +unadorned_v39 scs_4T1 /\ +unadorned_v39 scs_4T2 /\ +unadorned_v39 scs_4T3 /\ +unadorned_v39 scs_4T4 /\ +unadorned_v39 scs_4T5 /\ +unadorned_v39 scs_3T1 /\ +unadorned_v39 scs_3T2 /\ +unadorned_v39 scs_3T3 /\ +unadorned_v39 scs_3T4 /\ +unadorned_v39 scs_3T5 /\ +unadorned_v39 scs_3T6' /\ +unadorned_v39 scs_3T7 /\ + +unadorned_v39 scs_6M1 /\ +unadorned_v39 scs_5M1 /\ +unadorned_v39 scs_5M2 /\ +unadorned_v39 scs_4M1 /\ +unadorned_v39 scs_4M2 /\ +unadorned_v39 scs_4M3' /\ +unadorned_v39 scs_4M4' /\ +unadorned_v39 scs_4M5' /\ +unadorned_v39 scs_4M6' /\ +unadorned_v39 scs_4M7 /\ +unadorned_v39 scs_4M8 /\ +unadorned_v39 scs_3M1 +`, + (* {{{ proof *) + [ + REWRITE_TAC scs_example_list; + BY(REWRITE_TAC[scs_mk_unadorned_unadorned]) + ]);; + (* }}} *) + +let basic_examples = prove_by_refinement( + `scs_basic_v39 scs_6I1 /\ +scs_basic_v39 scs_5I1 /\ +scs_basic_v39 scs_5I2 /\ +scs_basic_v39 scs_5I3 /\ +scs_basic_v39 scs_4I1 /\ +scs_basic_v39 scs_4I2 /\ +scs_basic_v39 scs_4I3 /\ +scs_basic_v39 scs_3I1 /\ + +scs_basic_v39 scs_6T1 /\ +scs_basic_v39 scs_5T1 /\ +scs_basic_v39 scs_4T1 /\ +scs_basic_v39 scs_4T2 /\ +scs_basic_v39 scs_4T3 /\ +scs_basic_v39 scs_4T4 /\ +scs_basic_v39 scs_4T5 /\ +scs_basic_v39 scs_3T1 /\ +scs_basic_v39 scs_3T2 /\ +scs_basic_v39 scs_3T3 /\ +scs_basic_v39 scs_3T4 /\ +scs_basic_v39 scs_3T5 /\ +scs_basic_v39 scs_3T6' /\ +scs_basic_v39 scs_3T7 /\ + +scs_basic_v39 scs_6M1 /\ +scs_basic_v39 scs_5M1 /\ +scs_basic_v39 scs_5M2 /\ +scs_basic_v39 scs_4M1 /\ +scs_basic_v39 scs_4M2 /\ +scs_basic_v39 scs_4M3' /\ +scs_basic_v39 scs_4M4' /\ +scs_basic_v39 scs_4M5' /\ +scs_basic_v39 scs_4M6' /\ +scs_basic_v39 scs_4M7 /\ +scs_basic_v39 scs_4M8 /\ +scs_basic_v39 scs_3M1 +`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_basic]; + REWRITE_TAC[is_scs_examples;unadorned_examples]; + REWRITE_TAC scs_example_list; + BY(REWRITE_TAC[Terminal.scs_unadorned_explicit]) + ]);; + (* }}} *) + +let scs_arrow_sing_empty = prove_by_refinement( + `!s. scs_arrow_v39 {s} {} <=> (MMs_v39 s = {})`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_arrow_v39;NOT_IN_EMPTY;IN_SING]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let pos_imp_scs_arrow_empty = prove_by_refinement( + `!s. (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv) ==> scs_arrow_v39 {s} {}`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[scs_arrow_sing_empty;EXTENSION;NOT_IN_EMPTY]; + REWRITE_TAC[IN;Appendix.MMs_v39;Appendix.BBprime2_v39;Appendix.BBprime_v39]; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[arith `x < &0 ==> ~(&0 <= x)`]) + ]);; + (* }}} *) + +let arrow_rewrite_list = + map (UNDISCH o (REWRITE_RULE ((map GSYM scs_example_list) @ [LET_THM]))) + [Terminal.empty_3T1;Terminal.empty_3T2;Terminal.empty_3T3;Terminal.empty_3T4; + Terminal.empty_3T5;Terminal.empty_3T6;Terminal.empty_3T6;Terminal.empty_3T7; + Terminal.empty_4T1;Terminal.empty_4T2;Terminal.empty_4T3;Terminal.empty_4T4; + Terminal.empty_4T5;empty_5T1;empty_6T1];; + + + +let OCBICBY = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + +scs_arrow_v39 {scs_6T1} {} /\ +scs_arrow_v39 {scs_5T1} {} /\ +scs_arrow_v39 {scs_4T1} {} /\ +scs_arrow_v39 {scs_4T2} {} /\ +scs_arrow_v39 {scs_4T3} {} /\ +scs_arrow_v39 {scs_4T4} {} /\ +scs_arrow_v39 {scs_4T5} {} /\ +scs_arrow_v39 {scs_3T1} {} /\ +scs_arrow_v39 {scs_3T2} {} /\ +scs_arrow_v39 {scs_3T3} {} /\ +scs_arrow_v39 {scs_3T4} {} /\ +scs_arrow_v39 {scs_3T5} {} /\ +scs_arrow_v39 {scs_3T6' } {} /\ +scs_arrow_v39 {scs_3T7} {} +`, + (* {{{ proof *) + [ + DISCH_TAC; + REPEAT (GMATCH_SIMP_TAC pos_imp_scs_arrow_empty); + BY(REWRITE_TAC arrow_rewrite_list) + ]);; + (* }}} *) + + + + + + + + +end;; diff --git a/text_formalization/local/ODXLSTCv2.hl b/text_formalization/local/ODXLSTCv2.hl new file mode 100755 index 0000000..0cdd383 --- /dev/null +++ b/text_formalization/local/ODXLSTCv2.hl @@ -0,0 +1,4114 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Odxlstcv2 = struct + + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; +open Qknvmlb;; + + + + + +let ww_defor=new_definition`ww_defor w v t = if v= w then (&1-t) % w else v`;; + +let FUN_WW_DEFOR=prove(`ww_defor w v =(\t. if v= w then (&1-t) % w else v)`, +REWRITE_TAC[FUN_EQ_THM;ww_defor]);; + + +let WW_DEFOR_DEFORMATION=prove_by_refinement(`&0deformation (ww_defor (w:real^3)) V (-- e1,e1)`, +[ +REWRITE_TAC[deformation;real_interval;IN_ELIM_THM;REAL_ARITH`(-- &1 < &0 /\ &0 < &1)`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0< e1==> -- e1< &0`) +THEN RESA_TAC +THEN STRIP_TAC; + +REPEAT STRIP_TAC +THEN REWRITE_TAC[FUN_WW_DEFOR] +THEN MP_TAC(SET_RULE`v=w:real^3\/ ~(v=w)`) +THEN RESA_TAC; + +REWRITE_TAC[continuous_atreal] +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[dist;VECTOR_ARITH`(&1 - x') % w - (&1 - r) % w = -- ((x' -r) %w)`;NORM_MUL;NORM_NEG] +THEN MRESA_TAC NORM_POS_LE[`w:real^3`] +THEN MP_TAC(REAL_ARITH`&0 <= norm (w:real^3)==> norm w = &0\/ &0 < norm w`) +THEN RESA_TAC; + +EXISTS_TAC`&1` +THEN ASM_REWRITE_TAC[REAL_ARITH`A * &0= &0/\ &0< &1`]; + +EXISTS_TAC`inv(norm (w:real^3)) * e/ &2` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0 ~(norm w= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC NORM_EQ_0`w:real^3` +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`w:real^3`;`vec 0:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN MRESA_TAC REAL_LT_MUL[`inv(norm (w:real^3))`;`e:real`] +THEN MP_TAC(REAL_ARITH`&0< inv (norm (w:real^3)) * e==> &0< inv (norm w) * e/ &2`) +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MRESA_TAC REAL_LT_RMUL[`abs (x' - r)`;`inv (norm (w:real^3)) * e / &2`;`norm (w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`(A*B/ &2) *C= (A*C) * B/ &2`] +THEN ASM_TAC +THEN REAL_ARITH_TAC; + +REWRITE_TAC[continuous_atreal;DIST_REFL] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`&1` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1`]; + +REPEAT STRIP_TAC +THEN REWRITE_TAC[ww_defor;VECTOR_ARITH`(&1 - &0) % w= w`] +THEN MP_TAC(SET_RULE`v=w:real^3\/ ~(v=w)`) +THEN RESA_TAC]);; + + + + + + + + +let DEFORMATION_IN_BALL_ANNULUS=prove( +` ~(&2 = norm (w:real^3)) /\ w IN ball_annulus +==> ?e. &0< e/\ !t. &0 < t /\ t < e ==> (&1- t) %w IN ball_annulus`, +REWRITE_TAC[ball_annulus;cball;DIFF;ball;IN_ELIM_THM;dist; VECTOR_ARITH`vec 0 -A= --A`;NORM_NEG;NORM_MUL;REAL_ARITH`~(a b<= a`] +THEN STRIP_TAC +THEN EXISTS_TAC`inv(norm w) * (norm (w:real^3) - &2)/ &2` +THEN MP_TAC(REAL_ARITH`&2<=norm(w:real^3)/\ ~(&2 = norm w)==> ~(norm w= &0)/\ norm w - &2< norm w/\ &0< norm w- &2`) +THEN RESA_TAC +THEN MRESA1_TAC NORM_EQ_0`w:real^3` +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`w:real^3`;`vec 0:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN MRESA_TAC REAL_LT_MUL[`inv(norm(w:real^3))`;`norm(w:real^3)- &2`] +THEN MP_TAC(REAL_ARITH`&0 < inv (norm w) * (norm w - &2) +==> &0 < inv (norm w) * (norm (w:real^3) - &2)/ &2`) +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MRESA_TAC REAL_LT_LMUL[`inv(norm (w:real^3))`;`(norm (w:real^3) - &2)`;`norm(w:real^3)`] +THEN MP_TAC(REAL_ARITH`&0< t/\t < inv (norm (w:real^3)) * (norm w - &2) / &2 +/\ inv (norm w) * (norm w - &2) < &1 +==> t< &1 /\ &0<= &1- t/\ &1 - t< &1/\ t < inv (norm (w:real^3)) * (norm w - &2)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_ABS_REFL`&1- t` +THENL[ +MRESA_TAC REAL_LT_RMUL[`&1 -t`;`&1:real`;`norm(w:real^3)`] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +REWRITE_TAC[REAL_ARITH`&2 <= (&1 - t) * norm w <=> t * norm w<= norm w - &2`] +THEN MRESA_TAC REAL_LT_RMUL[`t:real`;`inv(norm (w:real^3))*(norm (w:real^3) - &2)`;`norm(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`(inv (norm w) * (norm w - &2)) * norm w= +(inv (norm w) * (norm w)) * (norm w - &2)`] +THEN REAL_ARITH_TAC]);; + + + +let DEFORMATION_DIST_LE_A=prove(`a< dist(w,v:real^3) +==> ?e. &0< e /\ (!t. &0< t /\ t< e==> a< dist ((&1-t)% w,v) )`, +REWRITE_TAC[dist;VECTOR_ARITH`(&1 - t) % w - v =(w-v) - t %w`] +THEN MRESA_TAC NORM_POS_LE[`w:real^3`] +THEN MP_TAC(REAL_ARITH`&0 <= norm (w:real^3) ==> norm w = &0 \/ (&0 < norm w/\ ~(norm w= &0))`) +THEN RESA_TAC +THENL[MRESA1_TAC NORM_EQ_0`w:real^3` +THEN REWRITE_TAC[VECTOR_ARITH`vec 0- v= -- v/\ vec 0 - v - t % vec 0 = -- v`] +THEN STRIP_TAC +THEN EXISTS_TAC`&1` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1`]; +STRIP_TAC +THEN EXISTS_TAC`inv(norm (w:real^3)) * (norm (w-v)- a)/ &2` +THEN MRESA1_TAC NORM_EQ_0`w:real^3` +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`w:real^3`;`vec 0:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN MP_TAC(REAL_ARITH`a < norm (w - v) ==> &0< norm (w - v:real^3) - a`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`inv(norm(w:real^3))`;`norm(w:real^3 -v)- a`] +THEN MP_TAC(REAL_ARITH`&0 < inv (norm w) * (norm (w-v) - a) +==> &0 < inv (norm w) * (norm (w:real^3-v) - a)/ &2`) +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MRESA_TAC REAL_LT_RMUL[`t:real`;`inv(norm (w:real^3))*(norm (w:real^3-v) - a)/ &2`;`norm(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`(inv (norm w) * (norm (w-v) - a)/ &2) * norm w= +(inv (norm w) * (norm w)) * (norm (w- v) - a)/ &2/\ &1 *A=A`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0< t==> &0<= t`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t * norm w < (norm (w - v) - a) / &2 +/\ a< norm(w-v:real^3) +==> a< norm (w-v)- t* norm w`) +THEN ASM_REWRITE_TAC[] +THEN MRESA1_TAC REAL_ABS_REFL`t:real` +THEN MRESA_TAC NORM_MUL[`t:real`;`w:real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC NORM_TRIANGLE[`w- v - t % w:real^3`;`t % w:real^3`][VECTOR_ARITH`w - v - t % w + t % w= w-v`] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]);; + + + +let DEFORMATION_DIST_LE_ALL=prove(`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3 scs_a_v39 s l i < dist(w l,w i)) +==> +(!i. ~(i MOD k = l MOD k) ==> ?e. &0< e/\ +(!t. &0< t/\ t< e ==> scs_a_v39 s l i < dist((&1-t) %(w l),w i)))`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA_TAC th[`i:num`]) +THEN MRESA_TAC(GEN_ALL DEFORMATION_DIST_LE_A)[`scs_a_v39 s l i`;`(w:num->real^3) l`;`(w:num->real^3) i`]);; + + + + +let DEFORMATION_DIST_LE_ALL_COM=prove_by_refinement(`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3 scs_a_v39 s l i < dist(w l,w i)) +==> + ?e. &0< e/\ +(!t i. &0< t/\ t< e /\ ~(i MOD k = l MOD k) ==> scs_a_v39 s l i < dist((&1-t) %(w l),w i))`, +[REPEAT STRIP_TAC +THEN MP_TAC DEFORMATION_DIST_LE_ALL +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] +THEN REWRITE_TAC[SKOLEM_THM] +THEN STRIP_TAC +THEN ABBREV_TAC`e1= inf {(e:num->real) i| i < k/\ ~(i= l MOD k)}` +THEN EXISTS_TAC`e1:real` +THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` +THEN STRIP_TAC; + +MATCH_MP_TAC FINITE_IMAGE +THEN REWRITE_TAC[FINITE_NUMSEG]; + +REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`i:num` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(i = l MOD k)} = {})`ASSUME_TAC; + + +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] +THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(0=l MOD k )`) +THEN RESA_TAC; + +EXISTS_TAC`(e:num->real)1` +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 1real)0` +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real) i| i < k/\ ~(i= l MOD k)}`;`&0`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN REPLICATE_TAC (13-5) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`]); + +REPEAT STRIP_TAC +THEN MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(i= l MOD k)}`;`t:real`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`i MOD k` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`]; + +STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_REFL[`i:num`;`k:num`] +THEN REPLICATE_TAC (15-5) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num MOD k`]) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`])]);; + + + + +let DEFORMATION_DIST_LE_B=prove( +` dist(w,v:real^3) < a +==> ?e. &0< e /\ (!t. &0< t /\ t< e==> dist ((&1-t)% w,v) norm w = &0 \/ (&0 < norm w/\ ~(norm w= &0))`) +THEN RESA_TAC +THENL[ +MRESA1_TAC NORM_EQ_0`w:real^3` +THEN REWRITE_TAC[VECTOR_ARITH`vec 0- v= -- v/\ vec 0 - v - t % vec 0 = -- v`] +THEN STRIP_TAC +THEN EXISTS_TAC`&1` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1`]; +STRIP_TAC +THEN EXISTS_TAC`inv(norm (w:real^3)) * (a- norm (w-v))/ &2` +THEN MRESA1_TAC NORM_EQ_0`w:real^3` +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`w:real^3`;`vec 0:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN MP_TAC(REAL_ARITH`norm (w - v) < a ==> &0 &0 < inv (norm w) * (a- norm (w:real^3-v) )/ &2`) +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MRESA_TAC REAL_LT_RMUL[`t:real`;`inv(norm (w:real^3))*(a-norm (w:real^3-v) )/ &2`;`norm(w:real^3)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`(inv (norm w) * (a-norm (w-v))/ &2) * norm w= +(inv (norm w) * (norm w)) * (a-norm (w- v))/ &2/\ &1 *A=A`] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0< t==> &0<= t`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t * norm w < (a-norm (w - v)) / &2 +/\ norm(w-v:real^3) norm (w-v)+ t* norm w REWRITE_TAC[SYM th]) +THEN MRESAL_TAC NORM_TRIANGLE[`w- v :real^3`;`-- (t % w):real^3`][VECTOR_ARITH`w - v + --(t%w)= w-v - t %w`;NORM_NEG] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]);; + + + + + + +let DEFORMATION_DIST_LE_BLL=prove_by_refinement(`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3 &4 * h0 < scs_b_v39 s l i) +==> +(!i. scs_diag k l i ==> ?e. &0< e/\ +(!t. &0< t/\ t< e ==> dist((&1-t) %(w l),w i) STRIP_TAC +THEN MRESA_TAC th[`i:num`]) +THEN SUBGOAL_THEN`dist((w:num->real^3) l,w i)< scs_b_v39 s l i`ASSUME_TAC; + +MRESAL_TAC DIST_TRIANGLE[`(w:num->real^3) l`;`vec 0:real^3`;`(w:num->real^3) i`][] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;IMAGE;IN_ELIM_THM;SUBSET;ball_annulus;DIFF;cball] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) l = w x) `ASSUME_TAC; + +EXISTS_TAC `l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + + +SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) i = w x) `ASSUME_TAC; + +EXISTS_TAC `i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +REPLICATE_TAC (36-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN REPLICATE_TAC (2) (POP_ASSUM MP_TAC) +THEN MRESA_TAC th[`(w:num->real^3) i`] +THEN MRESA_TAC th[`(w:num->real^3) l`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[dist;VECTOR_ARITH`a- vec 0= a/\ vec 0 - a= --a`;NORM_NEG] +THEN REAL_ARITH_TAC; + + +EXISTS_TAC `l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) i = w x) `ASSUME_TAC; + +EXISTS_TAC `i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +REPLICATE_TAC (36-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN REPLICATE_TAC (2) (POP_ASSUM MP_TAC) +THEN MRESA_TAC th[`(w:num->real^3) i`] +THEN MRESA_TAC th[`(w:num->real^3) l`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[dist;VECTOR_ARITH`a- vec 0= a/\ vec 0 - a= --a`;NORM_NEG] +THEN REAL_ARITH_TAC; + +MRESA_TAC(GEN_ALL DEFORMATION_DIST_LE_B)[`(w:num->real^3) l`;`(w:num->real^3) i`;`scs_b_v39 s l i`;]]);; + + + + + + + + +let DEFORMATION_DIST_LE_BLL_EDGE=prove_by_refinement(`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3(!i. l MOD k= SUC i MOD k +==> +?e. &0< e/\ +(!t. &0< t/\ t< e ==> dist((&1-t) %(w l),w i)real^3) l- w i) dot -- (w:num->real^3) l< &0` ASSUME_TAC; + +MRESAL_TAC DOT_NORM[`(w:num->real^3) l- w i`;`-- (w:num->real^3) l`][VECTOR_ARITH`wl - wi + (-- wl)= --wi:real^3`;NORM_NEG] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;IMAGE;SUBSET;IN_ELIM_THM;ball_annulus;cball;DIFF;ball] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) l = w x) `ASSUME_TAC; + +EXISTS_TAC `l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) i = w x) `ASSUME_TAC; + +EXISTS_TAC `i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +REPLICATE_TAC (37-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`(w:num->real^3) i`] +THEN MRESA_TAC th[`(w:num->real^3) l`]) +THEN REPLICATE_TAC (4) (POP_ASSUM MP_TAC) +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (40-21) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num`;`i:num`][dist]) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1< k`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`SUC i`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`i:num`) +THEN REPLICATE_TAC (48-14) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num MOD k`;`i MOD k:num`][dist]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&2 <= scs_a_v39 s i l +/\ scs_a_v39 s i l <= norm (w l - (w:num->real^3)i)/\ ~(norm (w l) < &2) +==> &2<= norm (w l - (w:num->real^3)i) /\ &2<= norm (w l)`) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm ((w:num->real^3) l)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm (w l - (w:num->real^3)i)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN ASM_TAC +THEN REWRITE_TAC[h0] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`norm ((w:num->real^3) i)`;`&2* h0`;][ARITH_RULE`abs (&2 * #1.26)= &2 * #1.26`;REAL_ABS_NORM;h0] +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +EXISTS_TAC `l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) i = w x) `ASSUME_TAC; + +EXISTS_TAC `i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +REPLICATE_TAC (37-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`(w:num->real^3) i`] +THEN MRESA_TAC th[`(w:num->real^3) l`]) +THEN REPLICATE_TAC (4) (POP_ASSUM MP_TAC) +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (40-21) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num`;`i:num`][dist]) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1< k`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`SUC i`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`i:num`) +THEN REPLICATE_TAC (48-14) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num MOD k`;`i MOD k:num`][dist]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&2 <= scs_a_v39 s i l +/\ scs_a_v39 s i l <= norm (w l - (w:num->real^3)i)/\ ~(norm (w l) < &2) +==> &2<= norm (w l - (w:num->real^3)i) /\ &2<= norm (w l)`) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm ((w:num->real^3) l)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm (w l - (w:num->real^3)i)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN ASM_TAC +THEN REWRITE_TAC[h0] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`norm ((w:num->real^3) i)`;`&2* h0`;][ARITH_RULE`abs (&2 * #1.26)= &2 * #1.26`;REAL_ABS_NORM;h0] +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[DOT_RNEG;REAL_ARITH`-- a< &0 <=> a> &0`] +THEN STRIP_TAC +THEN MRESA_TAC CLOSER_POINTS_LEMMA[`(w:num->real^3) l- w i`;`(w:num->real^3) l`] +THEN EXISTS_TAC `u:real` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`t< u==> t<= u`) +THEN RESA_TAC +THEN MRESA_TAC th[`t:real`]) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;IMAGE;SUBSET;IN_ELIM_THM;ball_annulus;cball;DIFF;ball] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (40-22) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num`;`i:num`][dist]) +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC]);; + + + + + + + +let DEFORMATION_DIST_LE_BLL_EDGE2=prove_by_refinement( +`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3(!i. i MOD k= SUC l MOD k +==> +?e. &0< e/\ +(!t. &0< t/\ t< e ==> dist((&1-t) %(w l),w i)real^3) l- w i) dot -- (w:num->real^3) l< &0` ASSUME_TAC; + +MRESAL_TAC DOT_NORM[`(w:num->real^3) l- w i`;`-- (w:num->real^3) l`][VECTOR_ARITH`wl - wi + (-- wl)= --wi:real^3`;NORM_NEG] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;IMAGE;SUBSET;IN_ELIM_THM;ball_annulus;cball;DIFF;ball] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) l = w x) `ASSUME_TAC; + +EXISTS_TAC `l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) i = w x) `ASSUME_TAC; + +EXISTS_TAC `i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +REPLICATE_TAC (37-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`(w:num->real^3) i`] +THEN MRESA_TAC th[`(w:num->real^3) l`]) +THEN REPLICATE_TAC (4) (POP_ASSUM MP_TAC) +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (40-21) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num`;`i:num`][dist]) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1< k`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`l:num`) +THEN REPLICATE_TAC (48-14) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num MOD k`;`i MOD k:num`][dist]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&2 <= scs_a_v39 s i l +/\ scs_a_v39 s i l <= norm (w l - (w:num->real^3)i)/\ ~(norm (w l) < &2) +==> &2<= norm (w l - (w:num->real^3)i) /\ &2<= norm (w l)`) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm ((w:num->real^3) l)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm (w l - (w:num->real^3)i)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN ASM_TAC +THEN REWRITE_TAC[h0] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`norm ((w:num->real^3) i)`;`&2* h0`;][ARITH_RULE`abs (&2 * #1.26)= &2 * #1.26`;REAL_ABS_NORM;h0] +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + + +EXISTS_TAC `l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) i = w x) `ASSUME_TAC; + +EXISTS_TAC `i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +REPLICATE_TAC (37-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`(w:num->real^3) i`] +THEN MRESA_TAC th[`(w:num->real^3) l`]) +THEN REPLICATE_TAC (4) (POP_ASSUM MP_TAC) +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (40-21) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num`;`i:num`][dist]) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1< k`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`l:num`) +THEN REPLICATE_TAC (48-14) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num MOD k`;`i MOD k:num`][dist]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&2 <= scs_a_v39 s i l +/\ scs_a_v39 s i l <= norm (w l - (w:num->real^3)i)/\ ~(norm (w l) < &2) +==> &2<= norm (w l - (w:num->real^3)i) /\ &2<= norm (w l)`) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm ((w:num->real^3) l)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm (w l - (w:num->real^3)i)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN ASM_TAC +THEN REWRITE_TAC[h0] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`norm ((w:num->real^3) i)`;`&2* h0`;][ARITH_RULE`abs (&2 * #1.26)= &2 * #1.26`;REAL_ABS_NORM;h0] +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[DOT_RNEG;REAL_ARITH`-- a< &0 <=> a> &0`] +THEN STRIP_TAC +THEN MRESA_TAC CLOSER_POINTS_LEMMA[`(w:num->real^3) l- w i`;`(w:num->real^3) l`] +THEN EXISTS_TAC `u:real` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`t< u==> t<= u`) +THEN RESA_TAC +THEN MRESA_TAC th[`t:real`]) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;IMAGE;SUBSET;IN_ELIM_THM;ball_annulus;cball;DIFF;ball] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (40-22) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num`;`i:num`][dist]) +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC]);; + + + +let DEFORMATION_DIST_LE_BLL_PRIME=prove_by_refinement(`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3 &4 * h0 < scs_b_v39 s l i) +==> +(!i. ~(i MOD k = l MOD k) ==> ?e. &0< e/\ +(!t. &0< t/\ t< e ==> dist((&1-t) %(w l),w i) &4 * h0 < scs_b_v39 s l i) +==> + ?e. &0< e/\ +(!t i. &0< t/\ t< e /\ ~(i MOD k = l MOD k) ==> dist((&1-t) %(w l),w i)< scs_b_v39 s l i) `, +[REPEAT STRIP_TAC +THEN MP_TAC DEFORMATION_DIST_LE_BLL_PRIME +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] +THEN REWRITE_TAC[SKOLEM_THM] +THEN STRIP_TAC +THEN ABBREV_TAC`e1= inf {(e:num->real) i| i < k/\ ~(i= l MOD k)}` +THEN EXISTS_TAC`e1:real` +THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` +THEN STRIP_TAC; + +MATCH_MP_TAC FINITE_IMAGE +THEN REWRITE_TAC[FINITE_NUMSEG]; + +REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`i:num` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(i = l MOD k)} = {})`ASSUME_TAC; + +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] +THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(0=l MOD k )`) +THEN RESA_TAC; + + +EXISTS_TAC`(e:num->real)1` +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 1real)0` +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3 0real) i| i < k/\ ~(i= l MOD k)}`;`&0`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN REPLICATE_TAC (13-5) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`]); + +REPEAT STRIP_TAC +THEN MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(i= l MOD k)}`;`t:real`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`i MOD k` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`]; + +STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_REFL[`i:num`;`k:num`] +THEN REPLICATE_TAC (15-5) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num MOD k`]) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`])]);; + + + +let IMAGE_WW_DEFOR=prove_by_refinement(`!w:num->real^3. + IMAGE (\i. ww_defor (w l) (w i) t) (:num)= ((IMAGE w (:num)) DIFF {w l}) UNION {ww_defor (w l) (w l) t}`, +[ +REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;DIFF;UNION;EXTENSION;IN_SING] +THEN GEN_TAC +THEN EQ_TAC; + +RESA_TAC +THEN REWRITE_TAC[ww_defor] +THEN MP_TAC(SET_RULE`(w:num->real^3) l= w x' \/ ~((w:num->real^3) l= w x' )`) +THEN RESA_TAC; + +MATCH_MP_TAC(SET_RULE`A==> A\/B`) +THEN EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num) IN (:num)`]; + +REPEAT RESA_TAC +THEN REWRITE_TAC[ww_defor]; + +EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num) IN (:num)`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; + +EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num) IN (:num)`]]);; + + + + +let WW_DEFOR_FF1=prove_by_refinement(`(!x. x IN FF==> ~(FST x= SND x)/\ ~((&1 - t) % v = FST x)/\ ~((&1 - t) % v = SND x)) +==>(!w. +ww_defor (v:real^3) v t,(w:real^3) IN + IMAGE (\uv. ww_defor v (FST uv) t,ww_defor v (SND uv) t) FF +<=> v,w IN FF)`, +[REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;ww_defor] +THEN EQ_TAC; + +RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN MP_TAC(SET_RULE`v=FST (x:real^3#real^3)\/ ~(FST x = v:real^3)`) +THEN RESA_TAC +THEN REPLICATE_TAC (2) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> STRIP_TAC THEN STRIP_TAC +THEN MRESA_TAC th[`x:real^3#real^3`]) +THEN RESA_TAC; + +RESA_TAC +THEN EXISTS_TAC`v:real^3,w:real^3` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA1_TAC th`v:real^3,w:real^3`)]);; + + + + +let WW_DEFOR_rho_node1=prove(`(!x. x IN FF==> ~(FST x= SND x)/\ ~((&1 - t) % v = FST x) /\ ~((&1 - t) % v = SND x)) +==>(rho_node1 (IMAGE (\uv. ww_defor v (FST uv) t,ww_defor v (SND uv) t) FF) (ww_defor (v:real^3) v t)= rho_node1 FF v)`, +STRIP_TAC +THEN REWRITE_TAC[rho_node1] +THEN MP_TAC WW_DEFOR_FF1 +THEN RESA_TAC);; + + + + +let WW_DEFOR_FF2=prove_by_refinement( +`(!x. x IN FF==> ~(FST x= SND x)/\ ~((&1 - t) % v = FST x)/\ ~((&1 - t) % v = SND x)) +==>(!w. +(w:real^3),ww_defor (v:real^3) v t IN + IMAGE (\uv. ww_defor v (FST uv) t,ww_defor v (SND uv) t) FF +<=> w,v IN FF)`, +[REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;ww_defor] +THEN EQ_TAC; + +RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN MP_TAC(SET_RULE`v=SND (x:real^3#real^3)\/ ~(SND x = v:real^3)`) +THEN RESA_TAC +THEN REPLICATE_TAC (2) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> STRIP_TAC THEN STRIP_TAC +THEN MRESA_TAC th[`x:real^3#real^3`]) +THEN RESA_TAC; + +RESA_TAC +THEN EXISTS_TAC`w:real^3,v:real^3` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA1_TAC th`w:real^3,v:real^3`)]);; + + + + +let WW_DEFOR_APHA=prove(`(!x. x IN FF==> ~(FST x= SND x)/\ ~((&1 - t) % v = FST x)/\ ~((&1 - t) % v = SND x)) +==>(@w. +(w:real^3),ww_defor (v:real^3) v t IN + IMAGE (\uv. ww_defor v (FST uv) t,ww_defor v (SND uv) t) FF) += (@w. w,v IN FF)`, +STRIP_TAC +THEN MP_TAC WW_DEFOR_FF2 +THEN RESA_TAC);; + + + + +let WW_DEFOR_AZIM=prove(`(!x. x IN FF==> ~(FST x= SND x)/\ ~((&1 - t) % v = FST x)/\ ~((&1 - t) % v = SND x))/\ t< &1 +==> +azim (vec 0) (ww_defor v v t) + (rho_node1 (IMAGE (\uv. ww_defor v (FST uv) t,ww_defor v (SND uv) t) FF) + (ww_defor v v t)) + (@a. a,ww_defor v v t IN + IMAGE (\uv. ww_defor v (FST uv) t,ww_defor v (SND uv) t) FF) +=azim (vec 0) v (rho_node1 FF v) (@a. a,v IN FF)`, +REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`t< &1==> &0< &1-t`) +THEN RESA_TAC +THEN MP_TAC WW_DEFOR_APHA +THEN RESA_TAC +THEN MP_TAC WW_DEFOR_rho_node1 +THEN RESA_TAC +THEN REWRITE_TAC[ww_defor] +THEN ASM_SIMP_TAC[AZIM_SPECIAL_SCALE]);; + + +let GENERIC_HYPOTHESIS_WW_DEFOR=prove_by_refinement(` local_fan(V,E,FF)/\ ~(t= &0)/\ v IN V /\ generic V E +==> +(!x. x IN FF==> ~(FST x= SND x)/\ ~((&1 - t) % v = FST x)/\ ~((&1 - t) % v = SND x))`, +[REPEAT STRIP_TAC; + +MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_DISTINCT +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN MP_TAC Local_lemmas.LOFA_IMP_V_DIFF +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v:real^3`]) +THEN MP_TAC(SET_RULE`FST x = v\/ ~(FST (x:real^3#real^3)=v)`) +THEN RESA_TAC; + +REWRITE_TAC[VECTOR_ARITH`(&1 - t) % v = v<=> t %v= vec 0`;VECTOR_MUL_EQ_0] +THEN ASM_REWRITE_TAC[]; + + +MP_TAC Local_lemmas.LOCAL_FAN_IMP_IN_V2 +THEN RESA_TAC +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC_LOCAL_FAN[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v:real^3`] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`FST (x:real^3#real^3)`]) +THEN MRESAL_TAC th3[`vec 0:real^3`;`v:real^3`;`FST (x:real^3#real^3)`][Trigonometry2.AFF2;IN_ELIM_THM;VECTOR_ARITH`A % vec 0+B= B`] +THEN POP_ASSUM (fun th-> +STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`t:real` +THEN ASM_REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN MP_TAC Local_lemmas.LOFA_IMP_V_DIFF +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v:real^3`]) +THEN MP_TAC(SET_RULE`SND x = v\/ ~(SND (x:real^3#real^3)=v)`) +THEN RESA_TAC; + +REWRITE_TAC[VECTOR_ARITH`(&1 - t) % v = v<=> t %v= vec 0`;VECTOR_MUL_EQ_0] +THEN ASM_REWRITE_TAC[]; + +MP_TAC Local_lemmas.LOCAL_FAN_IMP_IN_V2 +THEN RESA_TAC +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC_LOCAL_FAN[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v:real^3`] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`SND (x:real^3#real^3)`]) +THEN MRESAL_TAC th3[`vec 0:real^3`;`v:real^3`;`SND (x:real^3#real^3)`][Trigonometry2.AFF2;IN_ELIM_THM;VECTOR_ARITH`A % vec 0+B= B`] +THEN POP_ASSUM (fun th-> +STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`t:real` +THEN ASM_REWRITE_TAC[]]);; + + + + + + + +let WW_DEFOR_0_ID=prove(`ww_defor v w (&0)= w:real^3`, +REWRITE_TAC[ww_defor;VECTOR_ARITH`(&1- &0) %v= v`] +THEN MP_TAC(SET_RULE`~(v=w:real^3)\/ v=w`) +THEN RESA_TAC);; + +let AZIM_0_WW_DEFOR=prove(`t= &0 +==> +azim (vec 0) (ww_defor v v t) + (rho_node1 (IMAGE (\uv. ww_defor v (FST uv) t,ww_defor v (SND uv) t) FF) + (ww_defor v v t)) + (@a. a,ww_defor v v t IN + IMAGE (\uv. ww_defor v (FST uv) t,ww_defor v (SND uv) t) FF) +=azim (vec 0) v (rho_node1 FF v) (@a. a,v IN FF)`, +RESA_TAC +THEN REWRITE_TAC[WW_DEFOR_0_ID;IMAGE_ID]);; + + + + +let GENEIRC_WW_DEFOR_AZIM=prove(`local_fan(V,E,FF)/\ v IN V /\ generic V E /\ t< &1 +==> +azim (vec 0) (ww_defor v v t) + (rho_node1 (IMAGE (\uv. ww_defor v (FST uv) t,ww_defor v (SND uv) t) FF) + (ww_defor v v t)) + (@a. a,ww_defor v v t IN + IMAGE (\uv. ww_defor v (FST uv) t,ww_defor v (SND uv) t) FF) +=azim (vec 0) v (rho_node1 FF v) (@a. a,v IN FF)`, +STRIP_TAC +THEN MP_TAC(SET_RULE`t= &0\/ ~(t= &0)`) +THEN RESA_TAC +THENL[ +ASM_REWRITE_TAC[WW_DEFOR_0_ID;IMAGE_ID]; + +MP_TAC GENERIC_HYPOTHESIS_WW_DEFOR +THEN RESA_TAC +THEN MP_TAC WW_DEFOR_AZIM +THEN RESA_TAC +]);; + + + + +let WW_DEFOR_FF3=prove_by_refinement( +`(!x. x IN FF==> ~(FST x= SND x)/\ ~((&1 - t) % w1 = FST x)/\ ~((&1 - t) % w1 = SND x)) /\ w1,v IN FF /\ ~(v,w1 IN FF)/\ ~(t= &0) +==>(!w. +ww_defor (w1:real^3) v t,(w:real^3) IN + IMAGE (\uv. ww_defor w1 (FST uv) t,ww_defor w1 (SND uv) t) FF +<=> v,w IN FF)`, + +[ + +REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;ww_defor] +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`w1:real^3,v:real^3` +THEN ASSUME_TAC th) +THEN EQ_TAC; + +RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN MP_TAC(SET_RULE`FST (x:real^3#real^3)=w1\/ ~(FST x = w1:real^3)`) +THEN RESA_TAC; + +REPLICATE_TAC (2) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC (2) STRIP_TAC +THEN MRESA_TAC th[`x:real^3#real^3`]) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`w1= SND (x:real^3#real^3)\/ ~(SND x = w1:real^3)`) +THEN RESA_TAC; + +SUBGOAL_THEN`v,w1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +ASM_TAC +THEN STRIP_TAC +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REPEAT RESA_TAC; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[]; + +STRIP_TAC +THEN EXISTS_TAC`v:real^3,w:real^3` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (1) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC (1) STRIP_TAC +THEN MRESA1_TAC th`v:real^3,w:real^3`) +THEN ASM_TAC +THEN MP_TAC(SET_RULE`(w=w1:real^3)\/ ~(w=w1)`) +THEN REPEAT RESA_TAC]);; + + + +let WW_DEFOR_RHO_NODE1=prove(`(!x. x IN FF==> ~(FST x= SND x)/\ ~((&1 - t) % w1 = FST x)/\ ~((&1 - t) % w1 = SND x)) /\ w1,v IN FF /\ ~(v,w1 IN FF)/\ ~(t= &0) +==> rho_node1( + IMAGE (\uv. ww_defor w1 (FST uv) t,ww_defor w1 (SND uv) t) FF) (ww_defor (w1:real^3) v t) += rho_node1 FF v`, +STRIP_TAC +THEN REWRITE_TAC[rho_node1] +THEN MP_TAC WW_DEFOR_FF3 +THEN RESA_TAC);; + + + +let GENERIC_WW_DEFOR_RHO_NODE1=prove(`local_fan(V,E,FF)/\ generic V E /\ w1,v IN FF /\ ~(t= &0) +==> rho_node1( + IMAGE (\uv. ww_defor w1 (FST uv) t,ww_defor w1 (SND uv) t) FF) (ww_defor (w1:real^3) v t) += rho_node1 FF v`, +RESA_TAC +THEN MATCH_MP_TAC WW_DEFOR_RHO_NODE1 +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`w1:real^3,v:real^3`;`V:real^3->bool`;] +THEN MRESA_TAC(GEN_ALL GENERIC_HYPOTHESIS_WW_DEFOR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`t:real`;`w1:real^3`] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v:real^3`;`w1:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v:real^3`;`w1:real^3`] +THEN MRESAL_TAC (GEN_ALL Local_lemmas1.LOFA_IMP_EE_TWO_ELMS_INS_ND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v:real^3`][SET_RULE`{a,a}={a}`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`w1:real^3`;`v:real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOFA_CARD_EE_V_2)[`V:real^3->bool`;`(FF:real^3#real^3->bool)`;`w1:real^3`;`v:real^3`;`E:(real^3->bool)->bool`][Geomdetail.CARD_SING;ARITH_RULE`~(1=2)`]);; + + + +let WW_DEFOR_ALPHA3=prove_by_refinement( +`local_fan(V,E,FF)/\ generic V E /\ w1,v IN FF /\ ~(t= &0) +==>(@w. +(w:real^3),ww_defor (w1:real^3) v t IN + IMAGE (\uv. ww_defor w1 (FST uv) t,ww_defor w1 (SND uv) t) FF) += (&1-t) %w1`, +[ +REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;ww_defor] +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`w1:real^3,v:real^3`;`V:real^3->bool`;] +THEN MRESA_TAC(GEN_ALL GENERIC_HYPOTHESIS_WW_DEFOR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`t:real`;`w1:real^3`] +THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA +THEN STRIP_TAC; + +EXISTS_TAC`(&1-t)%w1:real^3`THEN EXISTS_TAC`w1:real^3,v:real^3` +THEN ASM_REWRITE_TAC[]; + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN MP_TAC(SET_RULE`(FST (x:real^3#real^3)=w1)\/ ~((FST (x:real^3#real^3)=w1))`) +THEN RESA_TAC; + +RESA_TAC; + +REPLICATE_TAC (2) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC (2) STRIP_TAC +THEN MRESA_TAC th[`(w1,v):real^3#real^3`]) +THEN MP_TAC(SET_RULE`(SND (x:real^3#real^3)=w1)\/ ~((SND (x:real^3#real^3)=w1))`) +THEN RESA_TAC; + +STRIP_TAC +THEN SUBGOAL_THEN`w,v IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +ASM_TAC +THEN STRIP_TAC +THEN STRIP_TAC +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND) +[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`(FF:real^3#real^3->bool)`;`w:real^3`;`w1:real^3`]]);; + + + + +let AZIM_DEFOR_EDGE1=prove(`local_fan(V,E,FF)/\ generic V E /\ w1,v IN FF /\ t< &1 +==> +azim (vec 0) (ww_defor w1 v t) + (rho_node1 (IMAGE (\uv. ww_defor w1 (FST uv) t,ww_defor w1 (SND uv) t) FF) + (ww_defor w1 v t)) + (@a. a,ww_defor w1 v t IN + IMAGE (\uv. ww_defor w1 (FST uv) t,ww_defor w1 (SND uv) t) FF) +=azim (vec 0) v (rho_node1 FF v) (@a. a,v IN FF)`, +REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`t= &0 \/ ~(t= &0)`) +THEN RESA_TAC +THENL[ + +ASM_REWRITE_TAC[WW_DEFOR_0_ID;IMAGE_ID]; + +MP_TAC WW_DEFOR_ALPHA3 +THEN RESA_TAC +THEN MP_TAC GENERIC_WW_DEFOR_RHO_NODE1 +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`w1:real^3,v:real^3`;`V:real^3->bool`;] +THEN MRESA_TAC(GEN_ALL GENERIC_HYPOTHESIS_WW_DEFOR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`t:real`;`w1:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`w1:real^3,v:real^3`) +THEN ASM_REWRITE_TAC[ww_defor] +THEN MRESAL_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v:real^3`;`w1:real^3`][ivs_rho_node1] +THEN MP_TAC(REAL_ARITH`t< &1==> &0< &1- t`) +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL AZIM_SCALE_ALL)[`&1`;`&1-t`;`&1`;`v:real^3`;`rho_node1 FF v`;`w1:real^3`][VECTOR_ARITH`&1 % v=v`;REAL_ARITH`&0< &1`]]);; + + +(******************) + + + +let WW_DEFOR_FF4=prove_by_refinement(`local_fan(V,E,FF)/\ generic V E /\ v,w1 IN FF /\ ~(t= &0) +==>(!w. +(w:real^3),ww_defor (w1:real^3) v t IN + IMAGE (\uv. ww_defor w1 (FST uv) t,ww_defor w1 (SND uv) t) FF +<=> w,v IN FF)`, +[ +REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;ww_defor] +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v:real^3,w1:real^3`;`V:real^3->bool`;] +THEN MRESA_TAC(GEN_ALL GENERIC_HYPOTHESIS_WW_DEFOR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`t:real`;`w1:real^3`] +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`v:real^3,w1:real^3` +THEN ASSUME_TAC th) +THEN EQ_TAC; + + +RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN MP_TAC(SET_RULE`w1=FST (x:real^3#real^3)\/ ~(FST x = w1:real^3)`) +THEN RESA_TAC; + + +REPLICATE_TAC (2) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC (2) STRIP_TAC +THEN MRESA_TAC th[`x:real^3#real^3`]) +THEN RESA_TAC; + +SUBGOAL_THEN`w1,v IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +ASM_TAC +THEN STRIP_TAC +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REPEAT RESA_TAC; + + +MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v:real^3`;`w1:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v:real^3`;`w1:real^3`] +THEN MRESAL_TAC (GEN_ALL Local_lemmas1.LOFA_IMP_EE_TWO_ELMS_INS_ND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v:real^3`][SET_RULE`{a,a}={a}`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`w1:real^3`;`v:real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOFA_CARD_EE_V_2)[`V:real^3->bool`;`(FF:real^3#real^3->bool)`;`w1:real^3`;`v:real^3`;`E:(real^3->bool)->bool`][Geomdetail.CARD_SING;ARITH_RULE`~(1=2)`]; + + + +MP_TAC(SET_RULE`w1= SND (x:real^3#real^3)\/ ~(SND x = w1:real^3)`) +THEN RESA_TAC; + + +STRIP_TAC +THEN SUBGOAL_THEN`w,w1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +ASM_TAC +THEN STRIP_TAC +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REPEAT RESA_TAC; + + +MRESA_TAC(GEN_ALL Local_lemmas.FST_EQ_IF_SAME_SND) +[`V:real^3->bool`;`E:(real^3->bool)->bool`;`w1:real^3`;`(FF:real^3#real^3->bool)`;`w:real^3`;`v:real^3`] +THEN REPLICATE_TAC (16-9) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`x:real^3#real^3`]); + +STRIP_TAC +THEN EXISTS_TAC`w:real^3,v:real^3` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (1) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC (1) STRIP_TAC +THEN MRESA1_TAC th`w:real^3,v:real^3`) +THEN ASM_TAC +THEN MP_TAC(SET_RULE`(w=w1:real^3)\/ ~(w=w1)`) +THEN REPEAT RESA_TAC; + +MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v:real^3`;`w1:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v:real^3`;`w1:real^3`] +THEN MRESAL_TAC (GEN_ALL Local_lemmas1.LOFA_IMP_EE_TWO_ELMS_INS_ND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v:real^3`][SET_RULE`{a,a}={a}`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`w1:real^3`;`v:real^3`] +THEN MRESAL_TAC(GEN_ALL Local_lemmas.LOFA_CARD_EE_V_2)[`V:real^3->bool`;`(FF:real^3#real^3->bool)`;`w1:real^3`;`v:real^3`;`E:(real^3->bool)->bool`][Geomdetail.CARD_SING;ARITH_RULE`~(1=2)`]; +]);; + + + +let WW_DEFOR_RHO_NODE2=prove(`local_fan(V,E,FF)/\ generic V E /\ v,w1 IN FF /\ ~(t= &0) +==> (@w. w,ww_defor w1 v t IN + IMAGE (\uv. ww_defor w1 (FST uv) t,ww_defor w1 (SND uv) t) FF) = + (@w. w,v IN FF)`, +STRIP_TAC +THEN REWRITE_TAC[rho_node1] +THEN MP_TAC WW_DEFOR_FF4 +THEN RESA_TAC);; + + + +let GENERIC_WW_DEFOR_RHO_NODE2=prove_by_refinement( +`local_fan(V,E,FF)/\ generic V E /\ v,w1 IN FF /\ ~(t= &0) +==> rho_node1( + IMAGE (\uv. ww_defor w1 (FST uv) t,ww_defor w1 (SND uv) t) FF) (ww_defor (w1:real^3) v t) += (&1-t) %w1`, +[ +REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;ww_defor;rho_node1] +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v:real^3,w1:real^3`;`V:real^3->bool`;] +THEN MRESA_TAC(GEN_ALL GENERIC_HYPOTHESIS_WW_DEFOR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`t:real`;`w1:real^3`] +THEN MATCH_MP_TAC Hypermap_and_fan.CHOICE_LEMMA +THEN STRIP_TAC; + +EXISTS_TAC`(&1-t)%w1:real^3`THEN EXISTS_TAC`v:real^3,w1:real^3` +THEN ASM_REWRITE_TAC[]; + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN MP_TAC(SET_RULE`(FST (x:real^3#real^3)=w1)\/ ~((FST (x:real^3#real^3)=w1))`) +THEN RESA_TAC; + +REPLICATE_TAC (2) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC (2) STRIP_TAC +THEN MRESA_TAC th[`(v,w1):real^3#real^3`]); + +REPLICATE_TAC (2) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC (2) STRIP_TAC +THEN MRESA_TAC th[`(v,w1):real^3#real^3`]) +THEN MP_TAC(SET_RULE`(SND (x:real^3#real^3)=w1)\/ ~((SND (x:real^3#real^3)=w1))`) +THEN RESA_TAC; + +RESA_TAC; + +STRIP_TAC +THEN SUBGOAL_THEN`v,w IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +ASM_TAC +THEN STRIP_TAC +THEN STRIP_TAC +THEN REPEAT RESA_TAC; + +MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v:real^3`;`w1:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v:real^3`;`w:real^3`]]);; + + + + +let AZIM_DEFOR_EDGE2=prove(`local_fan(V,E,FF)/\ generic V E /\ v,w1 IN FF /\ t< &1 +==> +azim (vec 0) (ww_defor w1 v t) + (rho_node1 (IMAGE (\uv. ww_defor w1 (FST uv) t,ww_defor w1 (SND uv) t) FF) + (ww_defor w1 v t)) + (@a. a,ww_defor w1 v t IN + IMAGE (\uv. ww_defor w1 (FST uv) t,ww_defor w1 (SND uv) t) FF) +=azim (vec 0) v (rho_node1 FF v) (@a. a,v IN FF)`, +REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`t= &0 \/ ~(t= &0)`) +THEN RESA_TAC +THENL[ +ASM_REWRITE_TAC[WW_DEFOR_0_ID;IMAGE_ID]; +MP_TAC WW_DEFOR_RHO_NODE2 +THEN RESA_TAC +THEN MP_TAC GENERIC_WW_DEFOR_RHO_NODE2 +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V2)[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`v:real^3,w1:real^3`;`V:real^3->bool`;] +THEN MRESA_TAC(GEN_ALL GENERIC_HYPOTHESIS_WW_DEFOR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`t:real`;`w1:real^3`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3,w1:real^3`) +THEN ASM_REWRITE_TAC[ww_defor] +THEN MP_TAC(REAL_ARITH`t< &1==> &0< &1- t`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`v:real^3`;`w1:real^3`] +THEN MRESAL_TAC (GEN_ALL AZIM_SCALE_ALL)[`&1-t`;`&1`;`&1`;`v:real^3`;`w1:real^3`;`(@a:real^3. a,(v:real^3) IN FF)`][VECTOR_ARITH`&1 % v=v`;REAL_ARITH`&0< &1`]]);; + + + +let WW_DEFOR_FF5=prove_by_refinement( +`local_fan(V,E,FF)/\ generic V E /\ ~(v=w1)/\ ~(w1,v IN FF) /\ ~(v,w1 IN FF)/\ ~(t= &0)/\ v IN V/\ w1 IN V +==>(!w. +ww_defor (w1:real^3) v t,(w:real^3) IN + IMAGE (\uv. ww_defor w1 (FST uv) t,ww_defor w1 (SND uv) t) FF +<=> v,w IN FF)`, +[ +REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;ww_defor] +THEN EQ_TAC; + +RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN MP_TAC(SET_RULE`FST (x:real^3#real^3)=w1\/ ~(FST x = w1:real^3)`) +THEN RESA_TAC; + +MRESA_TAC(GEN_ALL GENERIC_HYPOTHESIS_WW_DEFOR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`t:real`;`w1:real^3`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`x:real^3#real^3`]) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC_LOCAL_FAN[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`w1:real^3`] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`v:real^3`]) +THEN MRESAL_TAC th3[`vec 0:real^3`;`w1:real^3`;`v:real^3`][Trigonometry2.AFF2;IN_ELIM_THM;VECTOR_ARITH`A % vec 0+B= B`] +THEN POP_ASSUM (fun th-> +STRIP_TAC +THEN MP_TAC th) +THEN SUBGOAL_THEN`?t. v = (&1 - t) % w1:real^3`ASSUME_TAC; + +EXISTS_TAC`t:real` +THEN ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[]; + + +MP_TAC(SET_RULE`w1= SND (x:real^3#real^3)\/ ~(SND x = w1:real^3)`) +THEN RESA_TAC; + +STRIP_TAC +THEN SUBGOAL_THEN`v,w1 IN (FF:real^3#real^3->bool)` ASSUME_TAC; + +ASM_TAC +THEN REPLICATE_TAC (5) STRIP_TAC +THEN REPLICATE_TAC (5) REMOVE_ASSUM_TAC +THEN REPEAT RESA_TAC; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[]; + +STRIP_TAC +THEN EXISTS_TAC`v:real^3,w:real^3` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`(w=w1:real^3)\/ ~(w=w1)`) +THEN REPEAT RESA_TAC]);; + + + + + +let GENERIC_WW_DEFOR_RHO_NODE1_NOT_EDGE=prove( +`local_fan(V,E,FF)/\ generic V E /\ ~(v=w1)/\ ~(w1,v IN FF) /\ ~(v,w1 IN FF)/\ ~(t= &0)/\ v IN V/\ w1 IN V +==> rho_node1( + IMAGE (\uv. ww_defor w1 (FST uv) t,ww_defor w1 (SND uv) t) FF) (ww_defor (w1:real^3) v t) += rho_node1 FF v`, +RESA_TAC +THEN MP_TAC WW_DEFOR_FF5 +THEN ASM_REWRITE_TAC[rho_node1] +THEN RESA_TAC);; + + + + + + + +let WW_DEFOR_FF6=prove_by_refinement(`local_fan(V,E,FF)/\ generic V E /\ ~(v=w1)/\ ~(w1,v IN FF) /\ ~(v,w1 IN FF)/\ ~(t= &0)/\ v IN V/\ w1 IN V +==>(!w. +(w:real^3),ww_defor (w1:real^3) v t IN + IMAGE (\uv. ww_defor w1 (FST uv) t,ww_defor w1 (SND uv) t) FF +<=> w,v IN FF)`, +[REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;ww_defor] +THEN EQ_TAC; + +RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN MP_TAC(SET_RULE`SND (x:real^3#real^3)=w1\/ ~(SND x = w1:real^3)`) +THEN RESA_TAC; + +MRESA_TAC(GEN_ALL GENERIC_HYPOTHESIS_WW_DEFOR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`(FF:real^3#real^3->bool)`;`t:real`;`w1:real^3`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`x:real^3#real^3`]) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC_LOCAL_FAN[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`w1:real^3`] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`v:real^3`]) +THEN MRESAL_TAC th3[`vec 0:real^3`;`w1:real^3`;`v:real^3`][Trigonometry2.AFF2;IN_ELIM_THM;VECTOR_ARITH`A % vec 0+B= B`] +THEN POP_ASSUM (fun th-> +STRIP_TAC THEN STRIP_TAC +THEN MP_TAC th) +THEN SUBGOAL_THEN`?t. v = (&1 - t) % w1:real^3`ASSUME_TAC; + +EXISTS_TAC`t:real` +THEN ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[]; + +MP_TAC(SET_RULE`w1= FST (x:real^3#real^3)\/ ~(FST x = w1:real^3)`) +THEN RESA_TAC; + +STRIP_TAC +THEN SUBGOAL_THEN`w1,v IN (FF:real^3#real^3->bool)` ASSUME_TAC; + + +ASM_TAC +THEN REPLICATE_TAC (5) STRIP_TAC +THEN REPLICATE_TAC (5) REMOVE_ASSUM_TAC +THEN REPEAT RESA_TAC; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[]; + +STRIP_TAC +THEN EXISTS_TAC`w:real^3,v:real^3` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`(w=w1:real^3)\/ ~(w=w1)`) +THEN REPEAT RESA_TAC;]);; + + + +let GENERIC_WW_DEFOR_RHO_NODE1_NOT_EDGE2=prove(`local_fan(V,E,FF)/\ generic V E /\ ~(v=w1)/\ ~(w1,v IN FF) /\ ~(v,w1 IN FF)/\ ~(t= &0)/\ v IN V/\ w1 IN V +==>(@w. +(w:real^3),ww_defor (w1:real^3) v t IN + IMAGE (\uv. ww_defor w1 (FST uv) t,ww_defor w1 (SND uv) t) FF)=(@w. w,v IN FF)`, +RESA_TAC +THEN MP_TAC WW_DEFOR_FF6 +THEN ASM_REWRITE_TAC[rho_node1] +THEN RESA_TAC);; + + + + + +let AZIM_DEFOR_EDGE3=prove(`local_fan(V,E,FF)/\ generic V E /\ ~(v=w1)/\ ~(w1,v IN FF) /\ ~(v,w1 IN FF)/\ v IN V/\ w1 IN V +==> +azim (vec 0) (ww_defor w1 v t) + (rho_node1 (IMAGE (\uv. ww_defor w1 (FST uv) t,ww_defor w1 (SND uv) t) FF) + (ww_defor w1 v t)) + (@a. a,ww_defor w1 v t IN + IMAGE (\uv. ww_defor w1 (FST uv) t,ww_defor w1 (SND uv) t) FF) +=azim (vec 0) v (rho_node1 FF v) (@a. a,v IN FF)`, +REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`t= &0 \/ ~(t= &0)`) +THEN RESA_TAC +THENL[ +ASM_REWRITE_TAC[WW_DEFOR_0_ID;IMAGE_ID]; + +MP_TAC GENERIC_WW_DEFOR_RHO_NODE1_NOT_EDGE2 +THEN RESA_TAC +THEN MP_TAC GENERIC_WW_DEFOR_RHO_NODE1_NOT_EDGE +THEN RESA_TAC +THEN ASM_REWRITE_TAC[ww_defor] +THEN ASM_SIMP_TAC[AZIM_SPECIAL_SCALE]]);; + + + + + + +let AZIM_DEFORMATION_GENERIC=prove_by_refinement(`local_fan(V,E,FF)/\ generic V E /\ v IN V/\ w1 IN V/\ t< &1 +==> +azim (vec 0) (ww_defor w1 v t) + (rho_node1 (IMAGE (\uv. ww_defor w1 (FST uv) t,ww_defor w1 (SND uv) t) FF) + (ww_defor w1 v t)) + (@a. a,ww_defor w1 v t IN + IMAGE (\uv. ww_defor w1 (FST uv) t,ww_defor w1 (SND uv) t) FF) +=azim (vec 0) v (rho_node1 FF v) (@a. a,v IN FF)`, +[STRIP_TAC +THEN MP_TAC(SET_RULE`w1=v:real^3\/ ~(w1=v)`) +THEN RESA_TAC; + +MP_TAC GENEIRC_WW_DEFOR_AZIM +THEN RESA_TAC; + +MP_TAC (SET_RULE`w1,v IN FF \/ v,w1 IN FF\/ (~(w1,v IN FF)/\ ~(v,w1 IN (FF:real^3#real^3->bool)))`) +THEN RESA_TAC; + +MP_TAC AZIM_DEFOR_EDGE1 +THEN RESA_TAC; + +MP_TAC AZIM_DEFOR_EDGE2 +THEN RESA_TAC; + +MP_TAC AZIM_DEFOR_EDGE3 +THEN RESA_TAC]);; + + + +let V_DEFORMATION_WW_DEFOR=prove(`IMAGE (\v. ww_defor w1 v t) (IMAGE w (:num)) +=IMAGE (\i. ww_defor w1 (w i) t) (:num)`, +REWRITE_TAC[IMAGE;IN_ELIM_THM;EXTENSION] +THEN SET_TAC[]);; + + + +let E_DEFORMATION_WW_DEFOR=prove_by_refinement(`IMAGE (\i. {ww_defor w1 ((w:num->real^3) i) t, ww_defor w1 (w (SUC i)) t}) (:num) += IMAGE (IMAGE (\v. ww_defor w1 v t)) (IMAGE (\i. {w i, w (SUC i)}) (:num))`, +[REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; +RESA_TAC +THEN EXISTS_TAC`{(w:num->real^3) x', w (SUC x')}` +THEN STRIP_TAC; + +EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[]; +SET_TAC[]; +RESA_TAC +THEN EXISTS_TAC`x'':num` +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]]);; + +let F_DEFORMATION_WW_DEFOR=prove(`IMAGE (\i. ww_defor w1 ((w:num->real^3) i) t,ww_defor w1 (w (SUC i)) t) (:num) += IMAGE (\uv. ww_defor w1 (FST uv) t,ww_defor w1 (SND uv) t) (IMAGE (\i. w i,w (SUC i)) (:num))`, +REWRITE_TAC[EXTENSION;IMAGE;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +RESA_TAC +THEN EXISTS_TAC`(w:num->real^3) x',w (SUC x')` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[]; +RESA_TAC +THEN EXISTS_TAC`x'':num` +THEN ASM_REWRITE_TAC[]]);; + + + + + +let WW_DEFOR_AFFINE_HULL=prove(`!t. t IN real_interval (--e,e) + ==> ww_defor w1 w1 t IN affine hull {vec 0, v, w', w1}`, +STRIP_TAC +THEN REWRITE_TAC[ww_defor;real_interval;IN_ELIM_THM;Collect_geom2.AFFINE_HULL_4] +THEN STRIP_TAC +THEN EXISTS_TAC`t:real` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&1-t:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`t+ &0+ &0+ &1-t= &1`] +THEN VECTOR_ARITH_TAC);; + + + + +(***concl ***) + + +let MHAEYJN_concl = +`!a b V E FF f v w u. + convex_local_fan (V,E,FF) /\ + lunar (v,w) V E /\ + deformation f V (a,b) /\ + interior_angle1 (vec 0) FF v < pi /\ + u IN V /\ + ~(u = v) /\ + ~(u = w) /\ + (!u' t. u' IN V /\ ~(u = u') /\ t IN real_interval (a,b) ==> f u' t = u') /\ + (!t. t IN real_interval (a,b) ==> f u t IN affine hull {vec 0, v, w, u}) + ==> (?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> convex_local_fan + (IMAGE (\v. f v t) V, + IMAGE (IMAGE (\v. f v t)) E, + IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) /\ + lunar (v,w) (IMAGE (\v. f v t) V) + (IMAGE (IMAGE (\v. f v t)) E)))`;; +let ZLZTHIC_concl = +`!a b V E FF f. + convex_local_fan (V,E,FF) /\ + generic V E /\ + deformation f V (a,b) /\ + (!v t. v IN V /\ t IN real_interval (a,b)/\ interior_angle1 (vec 0) FF v = pi ==> interior_angle1 (vec 0) ( IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) (f v t) <= pi) + ==> (?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> convex_local_fan + (IMAGE (\v. f v t) V, + IMAGE (IMAGE (\v. f v t)) E, + IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) /\ + generic (IMAGE (\v. f v t) V) + (IMAGE (IMAGE (\v. f v t)) E)))`;; + + + + + +let ODXLSTCv2_concl = `!s k w l. + is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3 &4 * h0 < scs_b_v39 s l i) /\ + ~(&2 = norm (w l)) /\ + (!i. ~(i MOD k = l MOD k) ==> scs_a_v39 s l i < dist(w l,w i)) /\ + (!i. ~(scs_J_v39 s l i)) /\ + (!V E v. + V = IMAGE w (:num) /\ + E = IMAGE (\i. {w i, w (SUC i)}) (:num) ==> + ~(lunar (v,(w l)) V E )) ==> F`;; + + + +let LEMMA1_concl = `!s k w l. + is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3 &4 * h0 < scs_b_v39 s l i) /\ + ~(&2 = norm (w l)) /\ + (!i. ~(i MOD k = l MOD k) ==> scs_a_v39 s l i < dist(w l,w i)) /\ + (!i. ~(scs_J_v39 s l i)) /\ + (!V E v. + V = IMAGE w (:num) /\ + E = IMAGE (\i. {w i, w (SUC i)}) (:num) ==> + ~(lunar (v,(w l)) V E )) ==> +(?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> convex_local_fan + (IMAGE (\i. ww_defor (w l) (w i) t) (:num), + IMAGE (\i. {ww_defor (w l) (w i) t, ww_defor (w l) (w (SUC i)) t}) (:num), + IMAGE (\i. ww_defor (w l) (w i) t,ww_defor (w l) (w (SUC i)) t) (:num)) +))`;; + + + + + +let TAUSTAR_WW_DEFOR_concl = `!s k w l. + is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3 &4 * h0 < scs_b_v39 s l i) /\ + ~(&2 = norm (w l)) /\ + (!i. ~(i MOD k = l MOD k) ==> scs_a_v39 s l i < dist(w l,w i)) /\ + (!i. ~(scs_J_v39 s l i)) /\ +(!t. &0 < t /\ t < e1 ==> BBs_v39 s (\i. ww_defor (w l) (w i) t))/\ +&0< e1/\ e1< &1/\ + (!V E v. + V = IMAGE w (:num) /\ + E = IMAGE (\i. {w i, w (SUC i)}) (:num) ==> + ~(lunar (v,(w l)) V E )) ==> +(?e. &0 < e /\ + (!t. &0 < t /\ t < e + ==> taustar_v39 s (\i. ww_defor (w l) (w i) t)< taustar_v39 s w +))`;; + +(***********) + +let WW_DEFORMATION_CONVEX_LOCAL_FAN=prove_by_refinement((mk_imp(ZLZTHIC_concl, mk_imp (MHAEYJN_concl, LEMMA1_concl))), +[ + +REPEAT STRIP_TAC +THEN REPLICATE_TAC (9-2)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +ASM_TAC +THEN REPLICATE_TAC 5 (STRIP_TAC) +THEN MP_TAC(ARITH_RULE`3< k==> ~(k<=3)`) +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (25-12) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[]) +THEN RESA_TAC; + +POP_ASSUM(fun th-> MP_TAC th +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[convex_local_fan;] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th1-> STRIP_TAC +THEN MP_TAC th1 +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[local_fan;LET_DEF;LET_END_DEF] +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN STRIP_TAC +THEN REPLICATE_TAC (3) (REMOVE_ASSUM_TAC) +THEN ASSUME_TAC th1) +THEN ASSUME_TAC th) +THEN MRESA_TAC Deformation.XRECQNS[`-- &1`;`&1`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`ww_defor ((w:num->real^3) l)`] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`e:real`][REAL_ARITH`&0< &1`] +THEN MP_TAC Wrgcvdr_cizmrrh.CIZMRRH +THEN RESA_TAC; + +ABBREV_TAC`e1= (min e (&1))/ &2` +THEN MP_TAC(REAL_ARITH`e1= (min e (&1))/ &2/\ &0< e==> &0< e1/\ e1< &1/\ e1< e `) +THEN RESA_TAC +THEN SUBGOAL_THEN`(w:num->real^3) l IN ball_annulus` ASSUME_TAC; + +ASM_TAC +THEN REPLICATE_TAC 4 (STRIP_TAC) +THEN MP_TAC(ARITH_RULE`3< k==> ~(k<=3)`) +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;IMAGE;IN_ELIM_THM;SUBSET] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) l= w x)`ASSUME_TAC; + +EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +REPLICATE_TAC (41-11) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th`(w:num->real^3) l`); + +EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +REPLICATE_TAC (41-11) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th`(w:num->real^3) l`); + +ABBREV_TAC`w1= (w:num->real^3) l` +THEN SUBGOAL_THEN`(w1:real^3) IN V`ASSUME_TAC; + +EXPAND_TAC"V" +THEN REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +SUBGOAL_THEN`(!v t. + v IN V /\ t IN real_interval (-- e1, e1)/\ interior_angle1 (vec 0) FF v = pi + ==>interior_angle1 (vec 0) + (IMAGE + (\uv. ww_defor ((w:num->real^3) l) (FST uv) t,ww_defor (w l) (SND uv) t) + FF) + (ww_defor (w l) v t) <= + pi)`ASSUME_TAC; + +REWRITE_TAC[interior_angle1;real_interval;IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< &1==> t< &1`) +THEN RESA_TAC +THEN MP_TAC AZIM_DEFORMATION_GENERIC +THEN RESA_TAC +THEN REAL_ARITH_TAC; + +MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`e1:real`][REAL_ARITH`&0< &1`] +THEN REPLICATE_TAC (41-0) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th[`-- e1`;`e1:real`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`ww_defor ((w:num->real^3) l)`]) +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN EXISTS_TAC`e':real` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESAL_TAC th[`t:real`;][GSYM(GEN_ALL V_DEFORMATION_WW_DEFOR); E_DEFORMATION_WW_DEFOR;F_DEFORMATION_WW_DEFOR]); + +(***lunar case**) + + +ABBREV_TAC`e1= (min e (&1))/ &2` +THEN MP_TAC(REAL_ARITH`e1= (min e (&1))/ &2/\ &0< e==> &0< e1/\ e1< &1/\ e1< e `) +THEN RESA_TAC +THEN SUBGOAL_THEN`(w:num->real^3) l IN ball_annulus` ASSUME_TAC; + +ASM_TAC +THEN REPLICATE_TAC 4 (STRIP_TAC) +THEN MP_TAC(ARITH_RULE`3< k==> ~(k<=3)`) +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;IMAGE;IN_ELIM_THM;SUBSET] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) l= w x)`ASSUME_TAC; + +EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +REPLICATE_TAC (41-11) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th`(w:num->real^3) l`); + +EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +REPLICATE_TAC (41-11) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th`(w:num->real^3) l`); + +ABBREV_TAC`w1= (w:num->real^3) l` +THEN SUBGOAL_THEN`(w1:real^3) IN V`ASSUME_TAC; + +EXPAND_TAC"V" +THEN REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +MRESAL_TAC JKQEWGV3[`s:scs_v39`;`w:num->real^3`;`v:real^3`;`w':real^3`][LET_DEF;LET_END_DEF;] +THEN MP_TAC(REAL_ARITH`interior_angle1 (vec 0) FF v < pi / &2/\ &0< pi +==> interior_angle1 (vec 0) FF v < pi`) +THEN ASM_REWRITE_TAC[PI_WORKS] +THEN RESA_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`~(w1=v:real^3)`ASSUME_TAC; + +POP_ASSUM(fun th-> MRESA_TAC th[`V:real^3->bool`;`E:(real^3->bool)->bool`;`w':real^3`]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT RESA_TAC) +THEN ASM_REWRITE_TAC[Local_lemmas.LUNAR_COMM]; + +SUBGOAL_THEN`~(w1=w':real^3)`ASSUME_TAC; + +REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT RESA_TAC); + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN SUBGOAL_THEN`(!u' t. + u' IN V /\ ~(w1 = u':real^3) /\ t IN real_interval (--e,e) + ==> ww_defor w1 u' t = u')`ASSUME_TAC; + +REPEAT STRIP_TAC +THEN REWRITE_TAC[ww_defor] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]); + +REPLICATE_TAC (44-1) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th[`-- e`;`e:real`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`ww_defor ((w:num->real^3) l)`;`v:real^3`;`w':real^3`;`w1:real^3`]) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL WW_DEFOR_AFFINE_HULL)[`e:real`;`v:real^3`;`w':real^3`;`w1:real^3`;] +THEN RESA_TAC +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN EXISTS_TAC`e':real` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESAL_TAC th[`t:real`;][GSYM(GEN_ALL V_DEFORMATION_WW_DEFOR); E_DEFORMATION_WW_DEFOR;F_DEFORMATION_WW_DEFOR])]);; + + + +let CARD_V_EQ_SCS_K1=prove_by_refinement( +` scs_k_v39 s =k /\ + IMAGE (vv:num->real^3) (:num)=V/\ + is_scs_v39 s /\ +3< k/\ + BBs_v39 s vv +==> CARD V=k`, +[ +REPEAT STRIP_TAC +THEN MP_TAC IS_SCS_STABLE_SYSTEM +THEN ASM_REWRITE_TAC[ARITH_RULE`3<4`] +THEN MP_TAC Qknvmlb.SCS_K_LE_6 +THEN RESA_TAC +THEN STRIP_TAC +THEN ABBREV_TAC`s1 =stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))` +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN MP_TAC(ARITH_RULE`3 < scs_k_v39 s /\ scs_k_v39 s<=6 ==> scs_k_v39 s=4 \/ +scs_k_v39 s=5 \/ scs_k_v39 s=6`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN ASSUME_TAC th) +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 0]:real^3^(2+2)` +THEN ABBREV_TAC`a=matvec (v:real^3^(2+2))` +THEN MP_TAC(INST_TYPE [`:2+2`,`:M`]V_E_FF_IS_SCS_CASES_4) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_4;IN] +THEN STRIP_TAC +THEN MRESAL_TAC (INST_TYPE [`:2+2`,`:M`]VECTOR_3_4)[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 4 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)`;Basics.DIMINDEX_4] +THEN EXPAND_TAC "V" +THEN REWRITE_TAC[V_SY;rows;Basics.DIMINDEX_4;ARITH_RULE`1<=i /\ i<=4 <=> i=1\/ i=2\/ i=3 \/ i=4`;SET_RULE`{row i v | i = 1 \/ i = 2 \/ i = 3 \/ i = 4}={row 1 v, row 2 v, row 3 v,row 4 v}`] +THEN ASM_REWRITE_TAC[] +THEN MP_TAC VV_INJ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`1`;`2`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<4/\ 1<4/\ 2<4/\ 3<4`] +THEN MRESAL_TAC th[`1`;`3`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<4/\ 1<4/\ 2<4/\ 3<4`] +THEN MRESAL_TAC th[`1`;`0`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<4/\ 1<4/\ 2<4/\ 3<4`] +THEN MRESAL_TAC th[`2`;`0`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<4/\ 1<4/\ 2<4/\ 3<4`] +THEN MRESAL_TAC th[`3`;`0`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<4/\ 1<4/\ 2<4/\ 3<4`] +THEN MRESAL_TAC th[`2`;`3`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<4/\ 1<4/\ 2<4/\ 3<4`]) +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + +POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN ASSUME_TAC th) +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 0]:real^3^(2+3)` +THEN ABBREV_TAC`a=matvec (v:real^3^(2+3))` +THEN MP_TAC(INST_TYPE [`:2+3`,`:M`]V_E_FF_IS_SCS_CASES_5) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_5;IN] +THEN STRIP_TAC +THEN MRESAL_TAC (INST_TYPE [`:2+3`,`:M`]VECTOR_3_5)[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 5<=5/\ 0 MOD 5= 0 /\ 1 MOD 5= 1 /\ 2 MOD 5= 2/\ 3 MOD 5= 3 /\ 4 MOD 5= 4 /\ 5 MOD 5=0 /\ ~(2=1) +/\ SUC 0 MOD 5= 1 /\ SUC 1 MOD 5= 2 /\ SUC 2 MOD 5= 3/\ SUC 3 MOD 5= 4 +/\ SUC 4 MOD 5= 0 /\ SUC 5 MOD 5 = 1 /\ ~(3=1)/\ ~(1=0)`;SET_RULE`(a:num) IN (:num)`;Basics.DIMINDEX_5] +THEN EXPAND_TAC "V" +THEN REWRITE_TAC[V_SY;rows;Basics.DIMINDEX_5;ARITH_RULE`1<=i /\ i<=5 <=> i=1\/ i=2\/ i=3 \/ i=4 \/ i=5`;SET_RULE`{row i v | i = 1 \/ i = 2 \/ i = 3 \/ i = 4\/ i=5}={row 1 v, row 2 v, row 3 v,row 4 v, row 5 v}`] +THEN ASM_REWRITE_TAC[] +THEN MP_TAC VV_INJ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`1`;`2`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<5/\ 1<5/\ 2<5/\ 3<5/\ 4<5 /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)`] +THEN MRESAL_TAC th[`1`;`3`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<5/\ 1<5/\ 2<5/\ 3<5/\ 4<5 /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)`] +THEN MRESAL_TAC th[`1`;`0`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<5/\ 1<5/\ 2<5/\ 3<5/\ 4<5 /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)`] +THEN MRESAL_TAC th[`2`;`0`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<5/\ 1<5/\ 2<5/\ 3<5/\ 4<5 /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)`] +THEN MRESAL_TAC th[`3`;`0`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<5/\ 1<5/\ 2<5/\ 3<5/\ 4<5 /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)`] +THEN MRESAL_TAC th[`2`;`3`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<5/\ 1<5/\ 2<5/\ 3<5/\ 4<5 /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)`] +THEN MRESAL_TAC th[`1`;`4`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<5/\ 1<5/\ 2<5/\ 3<5/\ 4<5 /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)`] +THEN MRESAL_TAC th[`2`;`4`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<5/\ 1<5/\ 2<5/\ 3<5/\ 4<5 /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)`] +THEN MRESAL_TAC th[`3`;`4`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<5/\ 1<5/\ 2<5/\ 3<5/\ 4<5 /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)`] +THEN MRESAL_TAC th[`0`;`4`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<5/\ 1<5/\ 2<5/\ 3<5/\ 4<5 /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)`]) +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + +POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN ASSUME_TAC th) +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 5;(vv:num->real^3) 0]:real^3^(3+3)` +THEN ABBREV_TAC`a=matvec (v:real^3^(3+3))` +THEN MP_TAC(INST_TYPE [`:3+3`,`:M`]V_E_FF_IS_SCS_CASES_6) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_6;IN] +THEN STRIP_TAC +THEN MRESAL_TAC (INST_TYPE [`:3+3`,`:M`]VECTOR_3_6)[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 5`;`(vv:num->real^3) 0`][ARITH_RULE`1<=6/\ 2<=6/\ 3<=6/\ 4<=6/\ 5<=6 /\ 6<=6 /\ 0 MOD 6= 0 /\ 1 MOD 6= 1 /\ 2 MOD 6= 2/\ 3 MOD 6= 3 /\ 4 MOD 6= 4 /\ 5 MOD 6=5 /\ 6 MOD 6=0 /\ ~(2=1) +/\ SUC 0 MOD 6= 1 /\ SUC 1 MOD 6= 2 /\ SUC 2 MOD 6= 3/\ SUC 3 MOD 6= 4 +/\ SUC 4 MOD 6= 5 /\ SUC 5 MOD 6 = 0 /\ SUC 6 MOD 6 =1 /\ ~(3=1)/\ ~(1=0)`;Basics.DIMINDEX_6] +THEN EXPAND_TAC "V" +THEN REWRITE_TAC[V_SY;rows;Basics.DIMINDEX_6;ARITH_RULE`1<=i /\ i<=6 <=> i=1\/ i=2\/ i=3 \/ i=4 \/ i=5\/ i=6`;SET_RULE`{row i v | i = 1 \/ i = 2 \/ i = 3 \/ i = 4\/ i=5 \/ i=6}={row 1 v, row 2 v, row 3 v,row 4 v, row 5 v, row 6 v}`] +THEN ASM_REWRITE_TAC[] +THEN MP_TAC VV_INJ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`1`;`2`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0) /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`1`;`3`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`1`;`0`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`2`;`0`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`3`;`0`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`2`;`3`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`1`;`4`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`2`;`4`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`3`;`4`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`0`;`4`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`1`;`5`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`2`;`5`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`3`;`5`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`0`;`5`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`4`;`5`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`]) +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC]);; + + + + + +let CARD_FF_EQ_WW_DEFORMATION=prove(` +scs_k_v39 s =k /\ + IMAGE (w:num->real^3) (:num)=V/\ + is_scs_v39 s /\ +3< k/\ + BBs_v39 s w /\(!t. &0 < t /\ t < e1 ==> BBs_v39 s (\i. ww_defor (w l) (w i) t)) +==> (!t. &0< t/\ t< e1==> +CARD (IMAGE + (\i. ww_defor ((w:num->real^3) l) (w i) t, + ww_defor (w l) (w (SUC i)) t) + (:num)) +=CARD(IMAGE (\i. w i,w (SUC i)) (:num)))`, + +STRIP_TAC +THEN GEN_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA_TAC th[`t:real`]) +THEN MRESA_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`] +THEN MRESA_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`(\i. ww_defor ((w:num->real^3) l) (w i) t)`;`IMAGE ((\i. ww_defor ((w:num->real^3) l) (w i) t)) (:num)`;`k:num`] +THEN MP_TAC(ARITH_RULE`3 ~(k<= 3)`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN ASSUME_TAC(th) +THEN REPEAT RESA_TAC) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;convex_local_fan] +THEN REPEAT RESA_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ) +[`IMAGE (\i. {ww_defor ((w:num->real^3) l) (w i) t, ww_defor (w l) (w (SUC i)) t}) + (:num)`;`IMAGE (\i. ww_defor ((w:num->real^3) l) (w i) t,ww_defor (w l) (w (SUC i)) t) (:num)`;`IMAGE (\i. ww_defor (w l) ((w:num->real^3) i) t) (:num)`] +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ) +[`IMAGE (\i. {w i, (w:num->real^3) (SUC i)}) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`V:real^3->bool`]);; + + + + + +let DSV_WW_DEFOR_EQ=prove_by_refinement(` +scs_k_v39 s=k/\ + is_scs_v39 s /\ + BBs_v39 s w /\ +(!i. ~(scs_J_v39 s l i)) +==> +dsv_v39 s (\i. ww_defor (w l) (w i) t) = dsv_v39 s w`, +[ +REWRITE_TAC[dsv_v39] +THEN STRIP_TAC +THEN MATCH_MP_TAC(REAL_ARITH`a=b==> c+a=c+b`) +THEN MP_TAC(SET_RULE`is_ear_v39 s\/ ~(is_ear_v39 s)`) +THEN RESA_TAC +THEN MATCH_MP_TAC(REAL_ARITH`a=b==> #0.1*a= #0.1*b`); + +REWRITE_TAC[REAL_ARITH`&1 *a=a`] +THEN MATCH_MP_TAC SUM_EQ +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`(w:num->real^3) l= w x\/ ~(w l =w x)`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`l:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (4) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`l MOD k:num`;`x:num`]) +THEN REPLICATE_TAC (34-25) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`SUC x:num`;]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (SUC x)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]); + +MP_TAC(SET_RULE`(w:num->real^3) l= w (SUC x)\/ ~(w l =w (SUC x))`) +THEN RESA_TAC; + + +MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN POP_ASSUM MP_TAC +THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC DIVISION[`l:num`;`scs_k_v39 s`] +THEN MRESA_TAC DIVISION[`SUC x:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (6) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`l MOD k:num`;`SUC x MOD k:num`]) +THEN REPLICATE_TAC (37-25) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`x:num`;]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (x)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> +MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]); + +ASM_REWRITE_TAC[ww_defor]; + + +REWRITE_TAC[REAL_ARITH`-- &1 *a= -- &1 * b<=> a=b`] +THEN MATCH_MP_TAC SUM_EQ +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`(w:num->real^3) l= w x\/ ~(w l =w x)`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`l:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (4) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`l MOD k:num`;`x:num`]) +THEN REPLICATE_TAC (34-25) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`SUC x:num`;]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (SUC x)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]); + +MP_TAC(SET_RULE`(w:num->real^3) l= w (SUC x)\/ ~(w l =w (SUC x))`) +THEN RESA_TAC; + + +MRESA_TAC (GEN_ALL VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN POP_ASSUM MP_TAC +THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MRESA_TAC DIVISION[`l:num`;`scs_k_v39 s`] +THEN MRESA_TAC DIVISION[`SUC x:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (6) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`l MOD k:num`;`SUC x MOD k:num`]) +THEN REPLICATE_TAC (37-25) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`x:num`;]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (x)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> +MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]); + + +ASM_REWRITE_TAC[ww_defor]]);; + + + + +let INTERIOR_ANGLE_SAME_WW_DEFOR0=prove_by_refinement(` +3 +interior_angle1 (vec 0) + (IMAGE (\i. ww_defor (w l) (w i) t,ww_defor (w l) (w (SUC i)) t) (:num)) + (ww_defor (w l) (w (l MOD k)) t) = + interior_angle1 (vec 0) FF (w (l MOD k))`, +[ +STRIP_TAC +THEN ASM_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k<=3)`) +THEN RESA_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`w (l MOD k) IN IMAGE (w:num->real^3) (:num)`ASSUME_TAC; + +REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l MOD k` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +REPLICATE_TAC (14-7)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[convex_local_fan;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN REPLICATE_TAC (16-10)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[convex_local_fan;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39] +THEN MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`(\i. ww_defor ((w:num->real^3) l) (w i) t)`;`IMAGE ((\i. ww_defor ((w:num->real^3) l) (w i) t)) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39] +THEN MRESA_TAC(GEN_ALL Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM_IVS) +[`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(w:num->real^3) (l MOD k)`]) +THEN MRESA_TAC (GEN_ALL Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1)[`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(w:num->real^3) (l MOD k)`]) +THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME)[`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`;`w:num->real^3`;`l MOD k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39] +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`SUC 0`][ITER] THEN MRESA_TAC th[`k-1`]) +THEN SUBGOAL_THEN`(&1-t) %((w:num->real^3) (l MOD k)) IN IMAGE (\i. ww_defor (w l) (w i) t) (:num)`ASSUME_TAC; + +REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l MOD k` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ww_defor] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]; + +SUBGOAL_THEN`ww_defor (w l) (w (l MOD k)) t =(&1-t) %((w:num->real^3) (l MOD k))` ASSUME_TAC; + +ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ww_defor] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]; + +MRESA_TAC(GEN_ALL Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM_IVS) +[`IMAGE (\i. {ww_defor (w l) (w i) t, ww_defor ((w:num->real^3) l) (w (SUC i)) t}) (:num)`;`IMAGE (\i. ww_defor (w l) ((w:num->real^3) i) t) (:num)`;`IMAGE (\i. ww_defor (w l) (w i) t,ww_defor (w l) ((w:num->real^3) (SUC i)) t) (:num)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(&1-t) %((w:num->real^3) (l MOD k))`]) +THEN MRESA_TAC (GEN_ALL Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1) +[`IMAGE (\i. {ww_defor (w l) (w i) t, ww_defor ((w:num->real^3) l) (w (SUC i)) t}) (:num)`;`IMAGE (\i. ww_defor (w l) ((w:num->real^3) i) t) (:num)`;`IMAGE (\i. ww_defor (w l) (w i) t,ww_defor (w l) ((w:num->real^3) (SUC i)) t) (:num)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(&1-t) %((w:num->real^3) (l MOD k))`]) +THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME) +[`IMAGE (\i. ww_defor (w l) ((w:num->real^3) i) t) (:num)`;`IMAGE (\i. {ww_defor (w l) (w i) t, ww_defor ((w:num->real^3) l) (w (SUC i)) t}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. ww_defor (w l) (w i) t,ww_defor (w l) ((w:num->real^3) (SUC i)) t) (:num)`;`(\i. ww_defor (w l) ((w:num->real^3) i) t) (l MOD k)`;`(\i. ww_defor (w l) ((w:num->real^3) i) t)`;`l MOD k`] +[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39] +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`SUC 0`][ITER] THEN MRESA_TAC th[`k-1`]) +THEN MP_TAC(ARITH_RULE`3 1real^3) i, w (SUC i)}) (:num)`;`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`] +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`0:num`;`SUC 0`][ITER;ARITH_RULE`0< SUC 0/\ SUC 0=1`] +THEN MRESAL_TAC th[`0`;`k-1`][ITER]) +THEN ASM_REWRITE_TAC[ww_defor] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC (GEN_ALL AZIM_SCALE_ALL)[`&1`;`&1`;`&1-t`;`(w:num->real^3) (l MOD k)`;`(w:num->real^3) (1+l MOD k)`;`(w:num->real^3) (k-1+l MOD k)`][VECTOR_ARITH`&1 % v=v`;REAL_ARITH`&0< &1/\ (&0< &1-t<=> t< &1)`]]);; + + + + +let INTERIOR_ANGLE_SAME_WW_DEFOR1=prove_by_refinement(` +3 +interior_angle1 (vec 0) + (IMAGE (\i. ww_defor (w l) (w i) t,ww_defor (w l) (w (SUC i)) t) + (:num)) + (ITER i + (rho_node1 + (IMAGE (\i. ww_defor (w l) (w i) t,ww_defor (w l) (w (SUC i)) t) + (:num))) + (ww_defor (w l) (w (l MOD k)) t)) = +interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) (w (l MOD k)))`, +[ +STRIP_TAC +THEN ASM_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k<=3)`) +THEN RESA_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`w (l MOD k) IN IMAGE (w:num->real^3) (:num)`ASSUME_TAC; + +REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l MOD k` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +REPLICATE_TAC (16-7)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[convex_local_fan;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN REPLICATE_TAC (18-10)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN REWRITE_TAC[convex_local_fan;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39] +THEN MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`(\i. ww_defor ((w:num->real^3) l) (w i) t)`;`IMAGE ((\i. ww_defor ((w:num->real^3) l) (w i) t)) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V) +[`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3)(l MOD k)`;`IMAGE (w:num->real^3) (:num)`;] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`]) +THEN MRESA_TAC(GEN_ALL Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM_IVS) +[`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`ITER i (rho_node1 FF)((w:num->real^3) (l MOD k))`]) +THEN MRESA_TAC (GEN_ALL Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1)[`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`ITER i (rho_node1 FF)((w:num->real^3) (l MOD k))`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ITER_ADD]) +THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME)[`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`;`w:num->real^3`;`l MOD k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`] THEN MRESAL_TAC th[`SUC(i)`][ITER] THEN MRESA_TAC th[`k-1+i`] THEN MRESA_TAC th[`SUC i:num`] THEN MRESA_TAC th[`k-2:num`] +THEN MRESA_TAC th[`i-1:num`]) +THEN SUBGOAL_THEN`(&1-t) %((w:num->real^3) (l MOD k)) IN IMAGE (\i. ww_defor (w l) (w i) t) (:num)`ASSUME_TAC; + +REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l MOD k` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ww_defor] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]; + +SUBGOAL_THEN`ww_defor (w l) (w (l MOD k)) t =(&1-t) %((w:num->real^3) (l MOD k))` ASSUME_TAC; + +ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ww_defor] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;]; + + +MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V) +[`IMAGE (\i. {ww_defor (w l) (w i) t, ww_defor ((w:num->real^3) l) (w (SUC i)) t}) (:num)`;`IMAGE (\i. ww_defor (w l) (w i) t,ww_defor (w l) ((w:num->real^3) (SUC i)) t) (:num)`;`(&1 - t) % (w:num->real^3) (l MOD k)`;`IMAGE (\i. ww_defor (w l) ((w:num->real^3) i) t) (:num)`] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`]) +THEN MRESA_TAC(GEN_ALL Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM_IVS) +[`IMAGE (\i. {ww_defor (w l) (w i) t, ww_defor ((w:num->real^3) l) (w (SUC i)) t}) (:num)`;`IMAGE (\i. ww_defor (w l) ((w:num->real^3) i) t) (:num)`;`IMAGE (\i. ww_defor (w l) (w i) t,ww_defor (w l) ((w:num->real^3) (SUC i)) t) (:num)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(ITER i + (rho_node1 + (IMAGE (\i. ww_defor (w l) (w i) t,ww_defor (w l) (w (SUC i)) t) (:num))) + ((&1 - t) % w (l MOD k))) +`]) +THEN MRESA_TAC (GEN_ALL Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1) +[`IMAGE (\i. {ww_defor (w l) (w i) t, ww_defor ((w:num->real^3) l) (w (SUC i)) t}) (:num)`;`IMAGE (\i. ww_defor (w l) ((w:num->real^3) i) t) (:num)`;`IMAGE (\i. ww_defor (w l) (w i) t,ww_defor (w l) ((w:num->real^3) (SUC i)) t) (:num)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(ITER i + (rho_node1 + (IMAGE (\i. ww_defor (w l) (w i) t,ww_defor (w l) (w (SUC i)) t) (:num))) + ((&1 - t) % w (l MOD k))) +`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ITER_ADD]) +THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME) +[`IMAGE (\i. ww_defor (w l) ((w:num->real^3) i) t) (:num)`;`IMAGE (\i. {ww_defor (w l) (w i) t, ww_defor ((w:num->real^3) l) (w (SUC i)) t}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. ww_defor (w l) (w i) t,ww_defor (w l) ((w:num->real^3) (SUC i)) t) (:num)`;`(\i. ww_defor (w l) ((w:num->real^3) i) t) (l MOD k)`;`(\i. ww_defor (w l) ((w:num->real^3) i) t)`;`l MOD k`] +[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`] THEN MRESAL_TAC th[`SUC(i)`][ITER] THEN MRESA_TAC th[`k-1+i`]) +THEN MP_TAC(ARITH_RULE`3 k-1+1=k/\ k-1 i=1\/ i=k-1\/ (1real^3) i, w (SUC i)}) (:num)`;`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`] +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`0:num`;`i:num `][ITER;ARITH_RULE`0< 1/\ SUC 0=1`] +THEN MRESAL_TAC th[`0`;`SUC(i)`][ARITH_RULE`SUC 1=2/\ 0<2`;ITER]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`(k-1+ i) + l MOD k:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`l MOD k`][ARITH_RULE`1*k=k/\ SUC 1=2`] +THEN MRESA_TAC MOD_MOD_REFL[`l:num`;`k:num`] +THEN ASM_REWRITE_TAC[ww_defor] +THEN MRESAL_TAC (GEN_ALL AZIM_SCALE_ALL)[`&1`;`&1-t`;`&1`;`(w:num->real^3) (1+l MOD k)`;`(w:num->real^3) (2+l MOD k)`;`(w:num->real^3) (l MOD k)`][VECTOR_ARITH`&1 % v=v`;REAL_ARITH`&0< &1/\ (&0< &1-t<=> t< &1)`]; + + +MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_DIS_ELMS23) +[`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`] +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`0:num`;`i:num `][ITER;ARITH_RULE`0< 1/\ SUC 0=1`] +THEN MRESAL_TAC th[`0`;`k-2`][ARITH_RULE`SUC 1=2/\ 0<2`;ITER]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> +MRESAL1_TAC th`k-2 + l MOD k:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`(k-1+ k-1) + l MOD k:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`k + l MOD k:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`l MOD k`][ARITH_RULE`1*k=k/\ SUC 1=2`] +THEN MRESA_TAC MOD_MOD_REFL[`l:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`k-2+l MOD k`][ARITH_RULE`1*k=k/\ SUC 1=2`;ARITH_RULE`(k + k - 2) + l MOD k=k + k - 2 + l MOD k`] +THEN ASM_REWRITE_TAC[ww_defor] +THEN MRESAL_TAC (GEN_ALL AZIM_SCALE_ALL)[`&1-t`;`&1`;`&1`;`(w:num->real^3) (k-1+l MOD k)`;`(w:num->real^3) (l MOD k)`;`(w:num->real^3) (k-2+l MOD k)`][VECTOR_ARITH`&1 % v=v`;REAL_ARITH`&0< &1/\ (&0< &1-t<=> t< &1)`]; + +MP_TAC(ARITH_RULE`1 0real^3) i, w (SUC i)}) (:num)`;`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`] +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`0:num`;`i:num `][ITER;ARITH_RULE`0< 1/\ SUC 0=1`] +THEN MRESAL_TAC th[`0`;`SUC i`][ARITH_RULE`SUC 1=2/\ 0<2`;ITER] +THEN MRESAL_TAC th[`0`;`i-1`][ARITH_RULE`SUC 1=2/\ 0<2`;ITER]) +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`i-1+l MOD k`][ARITH_RULE`1*k=k/\ SUC 1=2`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> +MRESAL1_TAC th`i-1 + l MOD k:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`k+i-1 + l MOD k:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[ww_defor]]);; + + + + +let INTERIOR_ANGLE_SAME_WW_DEFOR=prove(`3 +interior_angle1 (vec 0) + (IMAGE (\i. ww_defor (w l) (w i) t,ww_defor (w l) (w (SUC i)) t) + (:num)) + (ITER i + (rho_node1 + (IMAGE (\i. ww_defor (w l) (w i) t,ww_defor (w l) (w (SUC i)) t) + (:num))) + (ww_defor (w l) (w (l MOD k)) t)) = +interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) (w (l MOD k)))`, + +REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`i=0\/ 1<=i`) +THEN RESA_TAC +THENL[ +REWRITE_TAC[ITER] +THEN MP_TAC INTERIOR_ANGLE_SAME_WW_DEFOR0 +THEN RESA_TAC; + +MP_TAC INTERIOR_ANGLE_SAME_WW_DEFOR1 +THEN RESA_TAC]);; + + + +let rho_fun_decreasing=prove_by_refinement(` + &0< t/\ t< &1/\ ~(wl= vec 0) +==> rho_fun (norm (ww_defor (wl) (wl) t)) +< rho_fun (norm (wl))`, +[ +STRIP_TAC +THEN REWRITE_TAC[rho_fun;h0;] +THEN MATCH_MP_TAC(REAL_ARITH`a c+a a-c &0<= &1- t`) +THEN RESA_TAC +THEN MRESA_TAC REAL_ABS_REFL[`&1-t`] +THEN REWRITE_TAC[REAL_ARITH`(&1 - t) * norm wl < norm wl<=> &0< t *norm wl`] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[NORM_POS_LT]]);; + + + + + + +let TAUSTAR_WW_DEFOR=prove_by_refinement((mk_imp(ZLZTHIC_concl, mk_imp (MHAEYJN_concl, TAUSTAR_WW_DEFOR_concl))), +[ +REPEAT STRIP_TAC +THEN REPLICATE_TAC (12-2)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN MP_TAC(ARITH_RULE`3 ~(k<= 3)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[taustar_v39;LET_DEF;LET_END_DEF;tau_fun] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN EXISTS_TAC`e1:real` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MP_TAC CARD_FF_EQ_WW_DEFORMATION +THEN RESA_TAC +THEN POP_ASSUM(fun th->MRESA1_TAC th`t:real`) +THEN MP_TAC DSV_WW_DEFOR_EQ +THEN RESA_TAC +THEN MATCH_MP_TAC(REAL_ARITH`a a-c< b-c`) +THEN MATCH_MP_TAC(REAL_ARITH`a a-c< b-c`) +THEN MRESA_TAC(GEN_ALL Qknvmlb.SUM_AZIM_EQ_ANGLE_LE4)[`V:real^3->bool`;`w:num->real^3`;`l:num`;`s:scs_v39`;`(w:num->real^3) (l MOD scs_k_v39 s)`;`FF:real^3#real^3->bool`;`E:(real^3->bool)->bool`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPLICATE_TAC (31-9)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`t:real`]) +THEN MRESA_TAC(GEN_ALL Qknvmlb.SUM_AZIM_EQ_ANGLE_LE4)[`IMAGE (\i. ww_defor (w l) ((w:num->real^3) i) t) (:num)`;`(\i. ww_defor (w l) ((w:num->real^3) i) t)`;`l:num`;`s:scs_v39`;`(\i. ww_defor (w l) ((w:num->real^3) i) t) (l MOD scs_k_v39 s)`;`IMAGE (\i. ww_defor ((w:num->real^3) l) (w i) t,ww_defor (w l) (w (SUC i)) t) (:num)`;`IMAGE (\i. {ww_defor (w l) ((w:num->real^3) i) t, ww_defor (w l) (w (SUC i)) t}) (:num)`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`{i|i a+c t< &1`) +THEN RESA_TAC +THEN MP_TAC INTERIOR_ANGLE_SAME_WW_DEFOR0 +THEN RESA_TAC +THEN STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`0+A=A`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39;convex_local_fan] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k= 0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN SUBGOAL_THEN`(w:num->real^3) l IN V`ASSUME_TAC; + + +EXPAND_TAC"V" +THEN REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(l:num)IN(:num)`]; + +REPLICATE_TAC (65-33)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN RESA_TAC) +THEN MP_TAC Local_lemmas.LOFA_IMP_V_DIFF +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(w:num->real^3) l`]) +THEN MATCH_MP_TAC REAL_LT_RMUL +THEN STRIP_TAC; + + +MATCH_MP_TAC rho_fun_decreasing +THEN ASM_REWRITE_TAC[]; + +MRESA_TAC (GEN_ALL Local_lemmas.INTERIOR_ANGLE1_POS)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`(w:num->real^3) (l MOD scs_k_v39 s)`]; + +MATCH_MP_TAC SUM_EQ +THEN REWRITE_TAC[IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`x<=k-1/\ 3< k==> x< k`) +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL INTERIOR_ANGLE_SAME_WW_DEFOR1) +[`s:scs_v39`;`t:real`;`x:num`;`FF:real^3#real^3->bool`;`w:num->real^3`;`l:num`;`k:num`] +THEN REWRITE_TAC[REAL_EQ_MUL_RCANCEL] +THEN MATCH_MP_TAC (SET_RULE`A==> A\/ B`) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;is_scs_v39;convex_local_fan] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k= 0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN SUBGOAL_THEN`(w:num->real^3) l IN V`ASSUME_TAC; + +EXPAND_TAC"V" +THEN REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(l:num)IN(:num)`]; + +MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`w:num->real^3`;`IMAGE (w:num->real^3) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;convex_local_fan;is_scs_v39;periodic2] +THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME)[`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`;`w:num->real^3`;`l MOD k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;convex_local_fan;is_scs_v39;periodic2] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`x:num`] ) +THEN MP_TAC(ARITH_RULE`1<=x==> 0real^3) i, w (SUC i)}) (:num)`;`IMAGE (w:num->real^3) (:num)`;`IMAGE (\i. w i,(w:num->real^3) (SUC i)) (:num)`;`(w:num->real^3) (l MOD k)`] +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`0:num`;`x:num`][ITER;ww_defor] )]);; + + + + + + + +let ODXLSTCv2 =prove_by_refinement((mk_imp(ZLZTHIC_concl, mk_imp (MHAEYJN_concl, ODXLSTCv2_concl))), +[ +REPEAT STRIP_TAC +THEN REPLICATE_TAC (9-2)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN SUBGOAL_THEN `convex_local_fan ((V:real^3->bool),(E:(real^3->bool)->bool),FF)` ASSUME_TAC; + +ASM_TAC +THEN REPLICATE_TAC 5 (STRIP_TAC) +THEN MP_TAC(ARITH_RULE`3< k==> ~(k<=3)`) +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (27-14) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[]) +THEN RESA_TAC; + + +SUBGOAL_THEN`(w:num->real^3) l IN ball_annulus` ASSUME_TAC; + +ASM_TAC +THEN REPLICATE_TAC 5 (STRIP_TAC) +THEN MP_TAC(ARITH_RULE`3< k==> ~(k<=3)`) +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;IMAGE;IN_ELIM_THM;SUBSET] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) l= w x)`ASSUME_TAC; + +EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +REPLICATE_TAC (29-11) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th`(w:num->real^3) l`); + +MRESA_TAC (GEN_ALL DEFORMATION_IN_BALL_ANNULUS)[`(w:num->real^3) l`] +THEN MP_TAC DEFORMATION_DIST_LE_ALL_COM +THEN RESA_TAC +THEN MP_TAC DEFORMATION_DIST_LE_BLL_COM +THEN RESA_TAC +THEN MP_TAC WW_DEFORMATION_CONVEX_LOCAL_FAN +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`]) +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC(SET_RULE`(A==> ~(B))==>((A==>B)==> ~A)`) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> +STRIP_TAC +THEN MP_TAC th) +THEN ABBREV_TAC`e1=(min (min (min (min e e') e'') e''') (&1))/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min (min (min (min e e') e'') e''') (&1))/ &2 /\ &0< e/\ &0< e'/\ &0< e''/\ &0 &0 BBs_v39 s (\i. ww_defor ((w:num->real^3) l) ((w:num->real^3) i) t)` ASSUME_TAC; + +REMOVE_ASSUM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT STRIP_TAC; + + + + +ASM_REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;ww_defor] +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`((w:num->real^3) x' = w l)\/ ~(w x' = w l)`) +THEN RESA_TAC +; + + +REPLICATE_TAC (44-27) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (42-27) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + + + + + +ASM_TAC +THEN REPLICATE_TAC 5 (STRIP_TAC) +THEN MP_TAC(ARITH_RULE`3< k==> ~(k<=3)`) +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;IMAGE;IN_ELIM_THM;SUBSET] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) x'= w x)`ASSUME_TAC; + +EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +; + + +REPLICATE_TAC (49-11) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th`(w:num->real^3) x'`) +; + + + +ASM_TAC +THEN REPLICATE_TAC 5 (STRIP_TAC) +THEN MP_TAC(ARITH_RULE`3< k==> ~(k<=3)`) +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;periodic;ww_defor] +THEN REPEAT RESA_TAC +; + + +ASM_REWRITE_TAC[ww_defor] +THEN MP_TAC(ARITH_RULE`3< k==> ~(k=0)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`(w:num->real^3) i =w l \/ ~(w i = w l)`) +THEN RESA_TAC; + + +MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`) +THEN RESA_TAC; + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i MOD k`;`j MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]); + + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`j MOD k = l MOD k==> (w:num->real^3)(j MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'==> t< e'`) +THEN RESA_TAC +THEN REPLICATE_TAC (77-50) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`;`j:num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC ; + + + + +MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`) +THEN RESA_TAC; + + + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`j MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`i MOD k = l MOD k==> (w:num->real^3)(i MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'==> t< e'`) +THEN RESA_TAC +THEN REPLICATE_TAC (77-50) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`;`i:num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REMOVE_ASSUM_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC ; + + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +; + + + + +ASM_REWRITE_TAC[ww_defor] +THEN MP_TAC(ARITH_RULE`3< k==> ~(k=0)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`(w:num->real^3) i =w l \/ ~(w i = w l)`) +THEN RESA_TAC; + + +MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`) +THEN RESA_TAC; + + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i MOD k`;`j MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`;DIST_REFL]) +THEN REPLICATE_TAC (72-12) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`;`j:num`]) +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + + + + + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s j`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`j MOD k = l MOD k==> (w:num->real^3)(j MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''==> t< e''`) +THEN RESA_TAC +THEN REPLICATE_TAC (77-52) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`;`j:num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s j`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC ; + + + + + + +MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`) +THEN RESA_TAC; + + + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`j MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`i MOD k = l MOD k==> (w:num->real^3)(i MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''==> t< e''`) +THEN RESA_TAC +THEN REPLICATE_TAC (77-52) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`;`i:num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REMOVE_ASSUM_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC ; + + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +; + + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 ~(k<=3)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'''/\ &0< t/\ &0< e'''==> t< e'''/\ --e'''< t`) +THEN RESA_TAC +THEN REPLICATE_TAC (44-33) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`;]) +; + + + + +MP_TAC TAUSTAR_WW_DEFOR +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`k:num`;`w:num->real^3`;`l:num`]) +THEN POP_ASSUM MP_TAC +THEN MATCH_MP_TAC(SET_RULE`(A==> ~(B))==>((A==>B)==> ~A)`) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> +STRIP_TAC +THEN MP_TAC th) +THEN ABBREV_TAC`e2= (min e1 e'''')/ &2` +THEN MP_TAC(REAL_ARITH`e2= (min e1 e'''')/ &2 /\ &0< e1/\ &0< e'''' +==> &0< e2/\ e2< e1/\ e2< e''''`) +THEN RESA_TAC +THEN REPLICATE_TAC (47-43)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`e2:real`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`~(a b<=a`] +THEN REPLICATE_TAC (47-41)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`e2:real`]) +; + +]) +;; + + + +(*********CASE k = 3************) + + + +let DEFORMATION_DIST_LE_ALL_LE3=prove(`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3<=k/\ + (!i. ~(i MOD k = l MOD k) ==> scs_a_v39 s l i < dist(w l,w i)) +==> +(!i. ~(i MOD k = l MOD k) ==> ?e. &0< e/\ +(!t. &0< t/\ t< e ==> scs_a_v39 s l i < dist((&1-t) %(w l),w i)))`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA_TAC th[`i:num`]) +THEN MRESA_TAC(GEN_ALL DEFORMATION_DIST_LE_A)[`scs_a_v39 s l i`;`(w:num->real^3) l`;`(w:num->real^3) i`]);; + + + +let DEFORMATION_DIST_LE_ALL_COM_LE3=prove_by_refinement(`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3<=k/\ + (!i. ~(i MOD k = l MOD k) ==> scs_a_v39 s l i < dist(w l,w i)) +==> + ?e. &0< e/\ +(!t i. &0< t/\ t< e /\ ~(i MOD k = l MOD k) ==> scs_a_v39 s l i < dist((&1-t) %(w l),w i))`, +[REPEAT STRIP_TAC +THEN MP_TAC DEFORMATION_DIST_LE_ALL_LE3 +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] +THEN REWRITE_TAC[SKOLEM_THM] +THEN STRIP_TAC +THEN ABBREV_TAC`e1= inf {(e:num->real) i| i < k/\ ~(i= l MOD k)}` +THEN EXISTS_TAC`e1:real` +THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` +THEN STRIP_TAC; + +MATCH_MP_TAC FINITE_IMAGE +THEN REWRITE_TAC[FINITE_NUMSEG]; + +REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`i:num` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(i = l MOD k)} = {})`ASSUME_TAC; + + +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] +THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(0=l MOD k )`) +THEN RESA_TAC; + +EXISTS_TAC`(e:num->real)1` +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3<=k==> 1real)0` +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3<=k==> 0real) i| i < k/\ ~(i= l MOD k)}`;`&0`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN REPLICATE_TAC (13-5) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`]); + +REPEAT STRIP_TAC +THEN MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(i= l MOD k)}`;`t:real`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`i MOD k` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`]; + +STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_REFL[`i:num`;`k:num`] +THEN REPLICATE_TAC (15-5) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num MOD k`]) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`])]);; + + + +let DEFORMATION_DIST_LE_BLL_LE3=prove_by_refinement(`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3<=k/\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) +==> +(!i. scs_diag k l i ==> ?e. &0< e/\ +(!t. &0< t/\ t< e ==> dist((&1-t) %(w l),w i) STRIP_TAC +THEN MRESA_TAC th[`i:num`]) +THEN SUBGOAL_THEN`dist((w:num->real^3) l,w i)< scs_b_v39 s l i`ASSUME_TAC; + +MRESAL_TAC DIST_TRIANGLE[`(w:num->real^3) l`;`vec 0:real^3`;`(w:num->real^3) i`][] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;IMAGE;IN_ELIM_THM;SUBSET;ball_annulus;DIFF;cball] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) l = w x) `ASSUME_TAC; + +EXISTS_TAC `l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + + +SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) i = w x) `ASSUME_TAC; + +EXISTS_TAC `i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +REPLICATE_TAC (36-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN REPLICATE_TAC (2) (POP_ASSUM MP_TAC) +THEN MRESA_TAC th[`(w:num->real^3) i`] +THEN MRESA_TAC th[`(w:num->real^3) l`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[dist;VECTOR_ARITH`a- vec 0= a/\ vec 0 - a= --a`;NORM_NEG] +THEN REAL_ARITH_TAC; + + +EXISTS_TAC `l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) i = w x) `ASSUME_TAC; + +EXISTS_TAC `i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +REPLICATE_TAC (36-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN REPLICATE_TAC (2) (POP_ASSUM MP_TAC) +THEN MRESA_TAC th[`(w:num->real^3) i`] +THEN MRESA_TAC th[`(w:num->real^3) l`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[dist;VECTOR_ARITH`a- vec 0= a/\ vec 0 - a= --a`;NORM_NEG] +THEN REAL_ARITH_TAC; + +MRESA_TAC(GEN_ALL DEFORMATION_DIST_LE_B)[`(w:num->real^3) l`;`(w:num->real^3) i`;`scs_b_v39 s l i`;]]);; + + + +let DEFORMATION_DIST_LE_BLL_EDGE_LE3=prove_by_refinement(`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3<=k +==>(!i. l MOD k= SUC i MOD k +==> +?e. &0< e/\ +(!t. &0< t/\ t< e ==> dist((&1-t) %(w l),w i)real^3) l- w i) dot -- (w:num->real^3) l< &0` ASSUME_TAC; + +MRESAL_TAC DOT_NORM[`(w:num->real^3) l- w i`;`-- (w:num->real^3) l`][VECTOR_ARITH`wl - wi + (-- wl)= --wi:real^3`;NORM_NEG] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;IMAGE;SUBSET;IN_ELIM_THM;ball_annulus;cball;DIFF;ball] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) l = w x) `ASSUME_TAC; + +EXISTS_TAC `l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) i = w x) `ASSUME_TAC; + +EXISTS_TAC `i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +REPLICATE_TAC (37-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`(w:num->real^3) i`] +THEN MRESA_TAC th[`(w:num->real^3) l`]) +THEN REPLICATE_TAC (4) (POP_ASSUM MP_TAC) +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (40-21) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num`;`i:num`][dist]) +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)/\ 1< k`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`SUC i`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`i:num`) +THEN REPLICATE_TAC (48-14) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num MOD k`;`i MOD k:num`][dist]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&2 <= scs_a_v39 s i l +/\ scs_a_v39 s i l <= norm (w l - (w:num->real^3)i)/\ ~(norm (w l) < &2) +==> &2<= norm (w l - (w:num->real^3)i) /\ &2<= norm (w l)`) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm ((w:num->real^3) l)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm (w l - (w:num->real^3)i)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN ASM_TAC +THEN REWRITE_TAC[h0] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`norm ((w:num->real^3) i)`;`&2* h0`;][ARITH_RULE`abs (&2 * #1.26)= &2 * #1.26`;REAL_ABS_NORM;h0] +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +EXISTS_TAC `l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) i = w x) `ASSUME_TAC; + +EXISTS_TAC `i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +REPLICATE_TAC (37-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`(w:num->real^3) i`] +THEN MRESA_TAC th[`(w:num->real^3) l`]) +THEN REPLICATE_TAC (4) (POP_ASSUM MP_TAC) +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (40-21) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num`;`i:num`][dist]) +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)/\ 1< k`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`SUC i`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`i:num`) +THEN REPLICATE_TAC (48-14) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num MOD k`;`i MOD k:num`][dist]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&2 <= scs_a_v39 s i l +/\ scs_a_v39 s i l <= norm (w l - (w:num->real^3)i)/\ ~(norm (w l) < &2) +==> &2<= norm (w l - (w:num->real^3)i) /\ &2<= norm (w l)`) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm ((w:num->real^3) l)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm (w l - (w:num->real^3)i)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN ASM_TAC +THEN REWRITE_TAC[h0] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`norm ((w:num->real^3) i)`;`&2* h0`;][ARITH_RULE`abs (&2 * #1.26)= &2 * #1.26`;REAL_ABS_NORM;h0] +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[DOT_RNEG;REAL_ARITH`-- a< &0 <=> a> &0`] +THEN STRIP_TAC +THEN MRESA_TAC CLOSER_POINTS_LEMMA[`(w:num->real^3) l- w i`;`(w:num->real^3) l`] +THEN EXISTS_TAC `u:real` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`t< u==> t<= u`) +THEN RESA_TAC +THEN MRESA_TAC th[`t:real`]) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;IMAGE;SUBSET;IN_ELIM_THM;ball_annulus;cball;DIFF;ball] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (40-22) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num`;`i:num`][dist]) +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC]);; + + + + +let DEFORMATION_DIST_LE_BLL_EDGE2_LE3=prove_by_refinement( +`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3<=k +==>(!i. i MOD k= SUC l MOD k +==> +?e. &0< e/\ +(!t. &0< t/\ t< e ==> dist((&1-t) %(w l),w i)real^3) l- w i) dot -- (w:num->real^3) l< &0` ASSUME_TAC; + +MRESAL_TAC DOT_NORM[`(w:num->real^3) l- w i`;`-- (w:num->real^3) l`][VECTOR_ARITH`wl - wi + (-- wl)= --wi:real^3`;NORM_NEG] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;IMAGE;SUBSET;IN_ELIM_THM;ball_annulus;cball;DIFF;ball] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) l = w x) `ASSUME_TAC; + +EXISTS_TAC `l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) i = w x) `ASSUME_TAC; + +EXISTS_TAC `i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +REPLICATE_TAC (37-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`(w:num->real^3) i`] +THEN MRESA_TAC th[`(w:num->real^3) l`]) +THEN REPLICATE_TAC (4) (POP_ASSUM MP_TAC) +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (40-21) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num`;`i:num`][dist]) +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)/\ 1< k`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`l:num`) +THEN REPLICATE_TAC (48-14) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num MOD k`;`i MOD k:num`][dist]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&2 <= scs_a_v39 s i l +/\ scs_a_v39 s i l <= norm (w l - (w:num->real^3)i)/\ ~(norm (w l) < &2) +==> &2<= norm (w l - (w:num->real^3)i) /\ &2<= norm (w l)`) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm ((w:num->real^3) l)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm (w l - (w:num->real^3)i)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN ASM_TAC +THEN REWRITE_TAC[h0] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`norm ((w:num->real^3) i)`;`&2* h0`;][ARITH_RULE`abs (&2 * #1.26)= &2 * #1.26`;REAL_ABS_NORM;h0] +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + + +EXISTS_TAC `l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) i = w x) `ASSUME_TAC; + +EXISTS_TAC `i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN (:num)`]; + +REPLICATE_TAC (37-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`(w:num->real^3) i`] +THEN MRESA_TAC th[`(w:num->real^3) l`]) +THEN REPLICATE_TAC (4) (POP_ASSUM MP_TAC) +THEN REWRITE_TAC[dist;VECTOR_ARITH`vec 0- A= --A`;NORM_NEG] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (40-21) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num`;`i:num`][dist]) +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)/\ 1< k`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC Qknvmlb.SUC_MOD_NOT_EQ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`l:num`) +THEN REPLICATE_TAC (48-14) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num MOD k`;`i MOD k:num`][dist]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&2 <= scs_a_v39 s i l +/\ scs_a_v39 s i l <= norm (w l - (w:num->real^3)i)/\ ~(norm (w l) < &2) +==> &2<= norm (w l - (w:num->real^3)i) /\ &2<= norm (w l)`) +THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm ((w:num->real^3) l)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`&2`;`norm (w l - (w:num->real^3)i)`][ARITH_RULE`abs (&2)= &2`;REAL_ABS_NORM] +THEN ASM_TAC +THEN REWRITE_TAC[h0] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC REAL_LE_SQUARE_ABS[`norm ((w:num->real^3) i)`;`&2* h0`;][ARITH_RULE`abs (&2 * #1.26)= &2 * #1.26`;REAL_ABS_NORM;h0] +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[DOT_RNEG;REAL_ARITH`-- a< &0 <=> a> &0`] +THEN STRIP_TAC +THEN MRESA_TAC CLOSER_POINTS_LEMMA[`(w:num->real^3) l- w i`;`(w:num->real^3) l`] +THEN EXISTS_TAC `u:real` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`t< u==> t<= u`) +THEN RESA_TAC +THEN MRESA_TAC th[`t:real`]) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2;IMAGE;SUBSET;IN_ELIM_THM;ball_annulus;cball;DIFF;ball] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (40-22) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`l:num`;`i:num`][dist]) +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC]);; + + + +let DEFORMATION_DIST_LE_BLL_PRIME_LE3=prove_by_refinement(`is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3<=k/\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) +==> +(!i. ~(i MOD k = l MOD k) ==> ?e. &0< e/\ +(!t. &0< t/\ t< e ==> dist((&1-t) %(w l),w i) &4 * h0 < scs_b_v39 s l i) +==> + ?e. &0< e/\ +(!t i. &0< t/\ t< e /\ ~(i MOD k = l MOD k) ==> dist((&1-t) %(w l),w i)< scs_b_v39 s l i) `, +[REPEAT STRIP_TAC +THEN MP_TAC DEFORMATION_DIST_LE_BLL_PRIME_LE3 +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] +THEN REWRITE_TAC[SKOLEM_THM] +THEN STRIP_TAC +THEN ABBREV_TAC`e1= inf {(e:num->real) i| i < k/\ ~(i= l MOD k)}` +THEN EXISTS_TAC`e1:real` +THEN SUBGOAL_THEN`FINITE {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`IMAGE (e:num->real) (0..k)` +THEN STRIP_TAC; + +MATCH_MP_TAC FINITE_IMAGE +THEN REWRITE_TAC[FINITE_NUMSEG]; + +REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`i:num` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`~({(e:num->real) i | i < k /\ ~(i = l MOD k)} = {})`ASSUME_TAC; + +REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`;IN_ELIM_THM] +THEN MP_TAC(SET_RULE`l MOD k=0\/ ~(0=l MOD k )`) +THEN RESA_TAC; + + +EXISTS_TAC`(e:num->real)1` +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3<=k==> 1real)0` +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MP_TAC(ARITH_RULE`3<=k==> 0real) i| i < k/\ ~(i= l MOD k)}`;`&0`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN REPLICATE_TAC (13-5) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`]); + +REPEAT STRIP_TAC +THEN MRESA_TAC REAL_LT_INF_FINITE[`{(e:num->real) i| i < k/\ ~(i= l MOD k)}`;`t:real`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`e (i MOD k) IN {(e:num->real) i | i < k /\ ~(i = l MOD k)}`ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`i MOD k` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`]; + +STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(e:num->real) (i MOD k)`) +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_REFL[`i:num`;`k:num`] +THEN REPLICATE_TAC (15-5) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num MOD k`]) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`t:real`) +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s l`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`])]);; + + +let DIHV_SPECIAL_SCALE1 = prove + (`!a v w1 w2:real^N. + (&0< a ) + ==> dihV (vec 0) w1 (a % v) w2 = dihV (vec 0) w1 v w2`, + REPEAT STRIP_TAC THEN REWRITE_TAC[DIHV; VECTOR_SUB_RZERO] THEN + CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN + REWRITE_TAC[DOT_LMUL; DOT_RMUL; GSYM VECTOR_MUL_ASSOC] THEN + REWRITE_TAC[VECTOR_ARITH `c % a % x - a % b % y:real^N = + (a ) % (c% x - b % y)`] THEN + REWRITE_TAC[angle; VECTOR_SUB_RZERO] THEN + REWRITE_TAC[VECTOR_ANGLE_LMUL; VECTOR_ANGLE_RMUL] THEN + ASM_REWRITE_TAC[REAL_LE_SQUARE; REAL_ENTIRE] + THEN MP_TAC(REAL_ARITH`&0< a==> ~(a= &0) /\ &0<= a`) + THEN RESA_TAC);; + + + +let DIHV_SPECIAL_SCALE2 = prove (`!a v w1 w2:real^N. + (&0< a ) + ==> dihV (vec 0) w1 w2 (a % v) = dihV (vec 0) w1 w2 v `, + REPEAT STRIP_TAC THEN REWRITE_TAC[DIHV; VECTOR_SUB_RZERO] THEN + CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN + REWRITE_TAC[DOT_LMUL; DOT_RMUL; GSYM VECTOR_MUL_ASSOC] THEN + REWRITE_TAC[VECTOR_ARITH `c % a % x - a % b % y:real^N = + (a ) % (c% x - b % y)`] THEN + REWRITE_TAC[angle; VECTOR_SUB_RZERO] THEN + REWRITE_TAC[VECTOR_ANGLE_LMUL; VECTOR_ANGLE_RMUL] THEN + ASM_REWRITE_TAC[REAL_LE_SQUARE; REAL_ENTIRE] + THEN MP_TAC(REAL_ARITH`&0< a==> ~(a= &0) /\ &0<= a`) + THEN RESA_TAC);; + + + +let DEFORMATION_BB_WW_DEFOR_LE3=prove_by_refinement( +`!s k w l. + is_scs_v39 s /\ + MMs_v39 s w /\ + scs_k_v39 s =k/\ + 3=k/\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + ~(&2 = norm (w l)) /\ + (!i. ~(i MOD k = l MOD k) ==> scs_a_v39 s l i < dist(w l,w i)) /\ + (!i. ~(scs_J_v39 s l i)) /\ + (!V E v. + V = IMAGE w (:num) /\ + E = IMAGE (\i. {w i, w (SUC i)}) (:num) ==> + ~(lunar (v,(w l)) V E )) ==> +(?e1. &0< e1/\(!t. &0 < t /\ t < e1 +==> BBs_v39 s (\i. ww_defor ((w:num->real^3) l) ((w:num->real^3) i) t)) )`, +[ +REPEAT STRIP_TAC +THEN REPLICATE_TAC (9-2)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`V= IMAGE (w:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(w:num->real^3) i, w (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((w:num->real^3) i, w (SUC i))) (:num)` +THEN MRESAL_TAC JKQEWGV2[`s:scs_v39`;`w:num->real^3`][LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC (GEN_ALL WW_DEFOR_DEFORMATION)[`(w:num->real^3) l`;`V:real^3->bool`;`&1`][REAL_ARITH`&0< &1`] +THEN SUBGOAL_THEN`(w:num->real^3) l IN ball_annulus` ASSUME_TAC; + +ASM_TAC +THEN REPLICATE_TAC 5 (STRIP_TAC) +THEN MP_TAC(ARITH_RULE`3= k==> (k<=3)`) +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;IMAGE;IN_ELIM_THM;SUBSET] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) l= w x)`ASSUME_TAC; + +EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +REPLICATE_TAC (25-9) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th`(w:num->real^3) l`); + +MP_TAC(ARITH_RULE`3=k==> 3<=k`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL DEFORMATION_IN_BALL_ANNULUS)[`(w:num->real^3) l`] +THEN MP_TAC DEFORMATION_DIST_LE_ALL_COM_LE3 +THEN RESA_TAC +THEN MP_TAC DEFORMATION_DIST_LE_BLL_COM_LE3 +THEN RESA_TAC +THEN ABBREV_TAC`e1=(min (min (min e e') e'')(&1))/ &2` +THEN MP_TAC(REAL_ARITH`e1=(min (min (min e e') e'') (&1))/ &2 /\ &0< e /\ &0< e'/\ &0< e''==> &0 BBs_v39 s (\i. ww_defor ((w:num->real^3) l) ((w:num->real^3) i) t)` ASSUME_TAC; + + +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT STRIP_TAC; + + +ASM_REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;ww_defor] +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`((w:num->real^3) x' = w l)\/ ~(w x' = w l)`) +THEN RESA_TAC; + + +REPLICATE_TAC (40-25) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (44-27) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + + +ASM_TAC +THEN REPLICATE_TAC 5 (STRIP_TAC) +THEN MP_TAC(ARITH_RULE`3= k==> (k<=3)`) +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;IMAGE;IN_ELIM_THM;SUBSET] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ (w:num->real^3) x'= w x)`ASSUME_TAC; + +EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + + +REPLICATE_TAC (43-9) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th`(w:num->real^3) x'`); + +ASM_TAC +THEN REPLICATE_TAC 5 (STRIP_TAC) +THEN MP_TAC(ARITH_RULE`3< k==> ~(k<=3)`) +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;periodic;ww_defor] +THEN REPEAT RESA_TAC; + + +ASM_REWRITE_TAC[ww_defor] +THEN MP_TAC(ARITH_RULE`3= k==> ~(k=0)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`(w:num->real^3) i =w l \/ ~(w i = w l)`) +THEN RESA_TAC; + + +MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`) +THEN RESA_TAC; + + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i MOD k`;`j MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]); + + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`j MOD k = l MOD k==> (w:num->real^3)(j MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'==> t< e'`) +THEN RESA_TAC +THEN REPLICATE_TAC (72-47) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`;`j:num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC ; + + +MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`j MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`i MOD k = l MOD k==> (w:num->real^3)(i MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e'==> t< e'`) +THEN RESA_TAC +THEN REPLICATE_TAC (72-47) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`;`i:num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REMOVE_ASSUM_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC ; + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC; + +ASM_REWRITE_TAC[ww_defor] +THEN MP_TAC(ARITH_RULE`3= k==> ~(k=0)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`(w:num->real^3) i =w l \/ ~(w i = w l)`) +THEN RESA_TAC; + +MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i MOD k`;`j MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`;DIST_REFL]); + +REPLICATE_TAC (69-12) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`;`j:num`]) +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +REPLICATE_TAC (70-12) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`;`j:num`]) +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s j`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`j MOD k = l MOD k==> (w:num->real^3)(j MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''==> t< e''`) +THEN RESA_TAC +THEN REPLICATE_TAC (72-49) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`;`j:num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s j`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC ; + +MP_TAC(SET_RULE`(w:num->real^3) j =w l \/ ~(w j = w l)`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`w:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`w:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN MRESA_TAC DIVISION[`l:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`j MOD k`;`l MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIST_POS_LE]) +THEN MP_TAC(SET_RULE`i MOD k = l MOD k==> (w:num->real^3)(i MOD k)=(w:num->real^3)(l MOD k)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`t< e1/\ e1< e''==> t< e''`) +THEN RESA_TAC +THEN REPLICATE_TAC (72-49) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`t:real`;`i:num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`l:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REMOVE_ASSUM_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC ; + +ASM_TAC +THEN REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;periodic2] +THEN REPEAT RESA_TAC; + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3=k==> (k<=3)`) +THEN RESA_TAC; + + +STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN EXISTS_TAC`e1:real` +THEN ASM_REWRITE_TAC[]]);; + + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/OTMTOTJ.hl b/text_formalization/local/OTMTOTJ.hl new file mode 100644 index 0000000..33619bd --- /dev/null +++ b/text_formalization/local/OTMTOTJ.hl @@ -0,0 +1,1574 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Otmtotj = struct + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +open Yxionxl2;; +open Eyypqdw;; +open Ocbicby;; +open Imjxphr;; + +open Nuxcoea;; +open Fektyiy;; +open Hexagons;; + + +let SCSE_TAC= ASM_REWRITE_TAC[scs_basic;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;d_tame;REAL_ARITH`#0.712 < #0.9`;periodic;SET_RULE`{} j <=> {} i`;periodic2;scs_basic;unadorned_v39;scs_prop_equ_v39;LET_DEF;LET_END_DEF;scs_stab_diag_v39;scs_half_slice_v39; +Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_5_TAC; +scs_5M1;scs_3M1;scs_6I1;scs_3T1;scs_4M2;scs_6M1;scs_6T1;scs_5I1;scs_5I2;scs_5I3;scs_5M2; +Terminal.FUNLIST_EXPLICIT;Yrtafyh.PSORT_PERIODIC;PSORT_5_EXPLICIT; +ARITH_RULE`SUC 0=1/\ SUC 1=2/\ SUC 2=3/\ SUC 3=4/\ SUC 4=5/\ SUC 5=6/\ SUC 6=7/\ SUC 7=8`];; + + + +let DIAG_5_EQU_PSORT=prove(`~(i MOD 5 = j MOD 5) /\ + ~(SUC i MOD 5 = j MOD 5) /\ + ~(i MOD 5 = SUC j MOD 5) +<=> psort 5 (i,j) = 0,2\/ psort 5 (i,j) = 0,3\/ psort 5 (i,j) = 1,3 +\/ psort 5 (i,j) = 1,4\/ psort 5 (i,j) = 2,4`, +MRESAL_TAC Hexagons.PSORT_MOD[`5`;`i`;`j`][ARITH_RULE`~(5=0)`] +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`j`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`i`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`j MOD 5<5==> j MOD 5=0\/ j MOD 5=1\/ j MOD 5=2\/ j MOD 5=3\/j MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`i MOD 5<5==> i MOD 5=0\/ i MOD 5=1\/ i MOD 5=2\/ i MOD 5=3\/i MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN REWRITE_TAC[PSORT_5_EXPLICIT;PAIR_EQ] +THEN ARITH_TAC);; + + + +let BB_5I1_IS_BB_5M2=prove_by_refinement(`BBs_v39 scs_5I1 v/\ (!i j. scs_diag 5 i j ==> cstab <= dist(v i,v j)) ==> BBs_v39 scs_5M2 v`, +[ +REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_5I1;scs_5M2;CS_ADJ;scs_diag;ARITH_RULE`~(5<=3)`] +THEN REPEAT RESA_TAC +THEN SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC; + +THAYTHE_TAC (5-2)[`i`;`j`]; + +MP_TAC(SET_RULE`SUC i MOD 5= j MOD 5\/ ~(SUC i MOD 5= j MOD 5)`) +THEN RESA_TAC; + +MRESAL_TAC Hexagons.PSORT_MOD[`5`;`i`;`j`][ARITH_RULE`~(5=0)`] +THEN THAYTHE_TAC (7-2)[`i`;`j`] +THEN DICH_TAC 2 +THEN DICH_TAC 2 +THEN STRIP_TAC +THEN STRIP_TAC +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`i`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 5<5==> i MOD 5=0\/ i MOD 5=1\/ i MOD 5=2\/ i MOD 5=3\/i MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN SCS_TAC; + + +MP_TAC(SET_RULE`i MOD 5= SUC j MOD 5\/ ~(i MOD 5= SUC j MOD 5)`) +THEN RESA_TAC; + +MRESAL_TAC Hexagons.PSORT_MOD[`5`;`i`;`j`][ARITH_RULE`~(5=0)`] +THEN THAYTHE_TAC (8-2)[`i`;`j`] +THEN DICH_TAC 2 +THEN STRIP_TAC +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`j`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`j MOD 5<5==> j MOD 5=0\/ j MOD 5=1\/ j MOD 5=2\/ j MOD 5=3\/j MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN SCS_TAC; + +MP_TAC DIAG_5_EQU_PSORT +THEN RESA_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN SCS_TAC; + + +THAYTHE_TAC (5-2)[`i`;`j`]; + +MP_TAC(SET_RULE`SUC i MOD 5= j MOD 5\/ ~(SUC i MOD 5= j MOD 5)`) +THEN RESA_TAC; + +MRESAL_TAC Hexagons.PSORT_MOD[`5`;`i`;`j`][ARITH_RULE`~(5=0)`] +THEN THAYTHE_TAC (7-2)[`i`;`j`] +THEN DICH_TAC 2 +THEN DICH_TAC 2 +THEN STRIP_TAC +THEN STRIP_TAC +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`i`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 5<5==> i MOD 5=0\/ i MOD 5=1\/ i MOD 5=2\/ i MOD 5=3\/i MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN DICH_TAC 1 +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +MP_TAC(SET_RULE`i MOD 5= SUC j MOD 5\/ ~(i MOD 5= SUC j MOD 5)`) +THEN RESA_TAC; + +MRESAL_TAC Hexagons.PSORT_MOD[`5`;`i`;`j`][ARITH_RULE`~(5=0)`] +THEN THAYTHE_TAC (8-2)[`i`;`j`] +THEN DICH_TAC 2 +THEN STRIP_TAC +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`j`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`j MOD 5<5==> j MOD 5=0\/ j MOD 5=1\/ j MOD 5=2\/ j MOD 5=3\/j MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN DICH_TAC 1 +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +MP_TAC DIAG_5_EQU_PSORT +THEN RESA_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN SCS_TAC +THEN THAYTHE_TAC(8-2)[`i`;`j`]]);; + + +let MM_5I1_IMP_MM_5M2=prove(`MMs_v39 scs_5I1 v/\ (!i j. scs_diag 5 i j ==> cstab <= dist(v i,v j)) ==> ~(MMs_v39 scs_5M2 ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_5I1` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_5I1`;`v`] +THEN ASSUME_TAC SCS_5I1_BASIC +THEN ASSUME_TAC K_SCS_5I1 +THEN ASSUME_TAC SCS_5M2_BASIC +THEN ASSUME_TAC K_SCS_5M2 +THEN ASSUME_TAC SCS_5M2_IS_SCS +THEN ASM_SIMP_TAC[BB_5I1_IS_BB_5M2;IN;SCS_5I1_IS_SCS] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + +let BB_5I2_IS_BB_5M2=prove_by_refinement(`BBs_v39 scs_5I2 v/\ (!i j. scs_diag 5 i j ==> cstab <= dist(v i,v j)) ==> BBs_v39 scs_5M2 v`, +[ +REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_5I2;scs_5M2;CS_ADJ;scs_diag;ARITH_RULE`~(5<=3)`] +THEN REPEAT RESA_TAC +THEN SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC; + +THAYTHE_TAC (5-2)[`i`;`j`]; + +MP_TAC(SET_RULE`SUC i MOD 5= j MOD 5\/ ~(SUC i MOD 5= j MOD 5)`) +THEN RESA_TAC; + +MRESAL_TAC Hexagons.PSORT_MOD[`5`;`i`;`j`][ARITH_RULE`~(5=0)`] +THEN THAYTHE_TAC (7-2)[`i`;`j`] +THEN DICH_TAC 2 +THEN DICH_TAC 2 +THEN STRIP_TAC +THEN STRIP_TAC +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`i`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 5<5==> i MOD 5=0\/ i MOD 5=1\/ i MOD 5=2\/ i MOD 5=3\/i MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN SCS_TAC; + + +MP_TAC(SET_RULE`i MOD 5= SUC j MOD 5\/ ~(i MOD 5= SUC j MOD 5)`) +THEN RESA_TAC; + +MRESAL_TAC Hexagons.PSORT_MOD[`5`;`i`;`j`][ARITH_RULE`~(5=0)`] +THEN THAYTHE_TAC (8-2)[`i`;`j`] +THEN DICH_TAC 2 +THEN STRIP_TAC +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`j`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`j MOD 5<5==> j MOD 5=0\/ j MOD 5=1\/ j MOD 5=2\/ j MOD 5=3\/j MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN SCS_TAC; + +MP_TAC DIAG_5_EQU_PSORT +THEN RESA_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN SCS_TAC; + + +THAYTHE_TAC (5-2)[`i`;`j`]; + +MP_TAC(SET_RULE`SUC i MOD 5= j MOD 5\/ ~(SUC i MOD 5= j MOD 5)`) +THEN RESA_TAC; + +MRESAL_TAC Hexagons.PSORT_MOD[`5`;`i`;`j`][ARITH_RULE`~(5=0)`] +THEN THAYTHE_TAC (7-2)[`i`;`j`] +THEN DICH_TAC 2 +THEN DICH_TAC 2 +THEN STRIP_TAC +THEN STRIP_TAC +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`i`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 5<5==> i MOD 5=0\/ i MOD 5=1\/ i MOD 5=2\/ i MOD 5=3\/i MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN DICH_TAC 1 +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +MP_TAC(SET_RULE`i MOD 5= SUC j MOD 5\/ ~(i MOD 5= SUC j MOD 5)`) +THEN RESA_TAC; + +MRESAL_TAC Hexagons.PSORT_MOD[`5`;`i`;`j`][ARITH_RULE`~(5=0)`] +THEN THAYTHE_TAC (8-2)[`i`;`j`] +THEN DICH_TAC 2 +THEN STRIP_TAC +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`j`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`j MOD 5<5==> j MOD 5=0\/ j MOD 5=1\/ j MOD 5=2\/ j MOD 5=3\/j MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN DICH_TAC 1 +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +MP_TAC DIAG_5_EQU_PSORT +THEN RESA_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN SCS_TAC +THEN THAYTHE_TAC(8-2)[`i`;`j`]]);; + + +let MM_5I2_IMP_MM_5M2=prove(`MMs_v39 scs_5I2 v/\ (!i j. scs_diag 5 i j ==> cstab <= dist(v i,v j)) ==> ~(MMs_v39 scs_5M2 ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_5I2` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_5I2`;`v`] +THEN ASSUME_TAC SCS_5I2_BASIC +THEN ASSUME_TAC K_SCS_5I2 +THEN ASSUME_TAC SCS_5M2_BASIC +THEN ASSUME_TAC K_SCS_5M2 +THEN ASSUME_TAC SCS_5M2_IS_SCS +THEN ASM_SIMP_TAC[BB_5I2_IS_BB_5M2;IN;SCS_5I2_IS_SCS] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + +let BB_5I3_IS_BB_5M2=prove_by_refinement(`BBs_v39 scs_5I3 v/\ (!i j. scs_diag 5 i j ==> cstab <= dist(v i,v j)) ==> BBs_v39 scs_5M2 v`, +[ +REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_5I3;scs_5M2;CS_ADJ;scs_diag;ARITH_RULE`~(5<=3)`] +THEN SCS_TAC +THEN REPEAT RESA_TAC +THEN SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC; + +THAYTHE_TAC (5-2)[`i`;`j`]; + +MP_TAC(SET_RULE`SUC i MOD 5= j MOD 5\/ ~(SUC i MOD 5= j MOD 5)`) +THEN RESA_TAC; + +MRESAL_TAC Hexagons.PSORT_MOD[`5`;`i`;`j`][ARITH_RULE`~(5=0)`] +THEN THAYTHE_TAC (7-2)[`i`;`j`] +THEN DICH_TAC 1 +THEN DICH_TAC 1 +THEN DICH_TAC 1 +THEN STRIP_TAC +THEN STRIP_TAC +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`i`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 5<5==> i MOD 5=0\/ i MOD 5=1\/ i MOD 5=2\/ i MOD 5=3\/i MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +MP_TAC(SET_RULE`i MOD 5= SUC j MOD 5\/ ~(i MOD 5= SUC j MOD 5)`) +THEN RESA_TAC; + +MRESAL_TAC Hexagons.PSORT_MOD[`5`;`i`;`j`][ARITH_RULE`~(5=0)`] +THEN THAYTHE_TAC (8-2)[`i`;`j`] +THEN DICH_TAC 1 +THEN DICH_TAC 1 +THEN STRIP_TAC +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`j`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`j MOD 5<5==> j MOD 5=0\/ j MOD 5=1\/ j MOD 5=2\/ j MOD 5=3\/j MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +MP_TAC DIAG_5_EQU_PSORT +THEN RESA_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN SCS_TAC; + +THAYTHE_TAC (5-2)[`i`;`j`]; + +MP_TAC(SET_RULE`SUC i MOD 5= j MOD 5\/ ~(SUC i MOD 5= j MOD 5)`) +THEN RESA_TAC; + +MRESAL_TAC Hexagons.PSORT_MOD[`5`;`i`;`j`][ARITH_RULE`~(5=0)`] +THEN THAYTHE_TAC (7-2)[`i`;`j`] +THEN DICH_TAC 0 +THEN DICH_TAC 1 +THEN DICH_TAC 1 +THEN STRIP_TAC +THEN STRIP_TAC +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`i`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 5<5==> i MOD 5=0\/ i MOD 5=1\/ i MOD 5=2\/ i MOD 5=3\/i MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC; + +MP_TAC(SET_RULE`i MOD 5= SUC j MOD 5\/ ~(i MOD 5= SUC j MOD 5)`) +THEN RESA_TAC; + +MRESAL_TAC Hexagons.PSORT_MOD[`5`;`i`;`j`][ARITH_RULE`~(5=0)`] +THEN THAYTHE_TAC (8-2)[`i`;`j`] +THEN DICH_TAC 0 +THEN DICH_TAC 1 +THEN STRIP_TAC +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`j`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`j MOD 5<5==> j MOD 5=0\/ j MOD 5=1\/ j MOD 5=2\/ j MOD 5=3\/j MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC; + +MP_TAC DIAG_5_EQU_PSORT +THEN RESA_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN SCS_TAC +THEN THAYTHE_TAC(8-2)[`i`;`j`] +THEN DICH_TAC 0 +THEN REWRITE_TAC[PAIR_EQ] +THEN SCS_TAC]);; + + +let MM_5I3_IMP_MM_5M2=prove(`MMs_v39 scs_5I3 v/\ (!i j. scs_diag 5 i j ==> cstab <= dist(v i,v j)) ==> ~(MMs_v39 scs_5M2 ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_5I3` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_5I3`;`v`] +THEN ASSUME_TAC SCS_5I3_BASIC +THEN ASSUME_TAC K_SCS_5I3 +THEN ASSUME_TAC SCS_5M2_BASIC +THEN ASSUME_TAC K_SCS_5M2 +THEN ASSUME_TAC SCS_5M2_IS_SCS +THEN ASM_SIMP_TAC[BB_5I3_IS_BB_5M2;IN;SCS_5I3_IS_SCS] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + +let BB_5M1_IS_BB_5M2=prove_by_refinement(`BBs_v39 scs_5M1 v/\ (!i j. scs_diag 5 i j ==> cstab <= dist(v i,v j)) ==> BBs_v39 scs_5M2 v`, +[ +REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_5M1;scs_5M2;CS_ADJ;scs_diag;ARITH_RULE`~(5<=3)`] +THEN SCS_TAC +THEN REPEAT RESA_TAC +THEN SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC; + +THAYTHE_TAC (5-2)[`i`;`j`]; + +MP_TAC(SET_RULE`SUC i MOD 5= j MOD 5\/ ~(SUC i MOD 5= j MOD 5)`) +THEN RESA_TAC; + +MRESAL_TAC Hexagons.PSORT_MOD[`5`;`i`;`j`][ARITH_RULE`~(5=0)`] +THEN THAYTHE_TAC (7-2)[`i`;`j`] +THEN DICH_TAC 1 +THEN DICH_TAC 1 +THEN DICH_TAC 1 +THEN STRIP_TAC +THEN STRIP_TAC +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`i`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 5<5==> i MOD 5=0\/ i MOD 5=1\/ i MOD 5=2\/ i MOD 5=3\/i MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +MP_TAC(SET_RULE`i MOD 5= SUC j MOD 5\/ ~(i MOD 5= SUC j MOD 5)`) +THEN RESA_TAC; + +MRESAL_TAC Hexagons.PSORT_MOD[`5`;`i`;`j`][ARITH_RULE`~(5=0)`] +THEN THAYTHE_TAC (8-2)[`i`;`j`] +THEN DICH_TAC 1 +THEN DICH_TAC 1 +THEN STRIP_TAC +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC Yxionxl2.MOD_SUC_MOD[`j`;`5`][ARITH_RULE`1<5`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`j MOD 5<5==> j MOD 5=0\/ j MOD 5=1\/ j MOD 5=2\/ j MOD 5=3\/j MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +MP_TAC DIAG_5_EQU_PSORT +THEN RESA_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN SCS_TAC]);; + + + +let MM_5M1_IMP_MM_5M2=prove(`MMs_v39 scs_5M1 v/\ (!i j. scs_diag 5 i j ==> cstab <= dist(v i,v j)) ==> ~(MMs_v39 scs_5M2 ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`scs_5M1` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_5M1`;`v`] +THEN ASSUME_TAC SCS_5M1_BASIC +THEN ASSUME_TAC K_SCS_5M1 +THEN ASSUME_TAC SCS_5M2_BASIC +THEN ASSUME_TAC K_SCS_5M2 +THEN ASSUME_TAC SCS_5M2_IS_SCS +THEN ASM_SIMP_TAC[BB_5M1_IS_BB_5M2;IN;SCS_5M1_IS_SCS] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + +(***********DIST<= cstab*************) + + +let SCS_5I1_STAB_DIAG= prove( +`!v i j. + v IN MMs_v39 scs_5I1 /\ + scs_diag 5 i j /\ + dist(v i,v j) <= cstab ==> + v IN MMs_v39 (scs_stab_diag_v39 scs_5I1 i j)`, +REWRITE_TAC[IN] +THEN REPEAT STRIP_TAC +THEN MP_TAC SCS_5I1_IS_SCS +THEN STRIP_TAC +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_5I1`;`v`] +THEN MRESA_TAC DIST_LE_IMP_A_LE[`v`;`scs_5I1`;`i`;`j`;`cstab`] +THEN ASSUME_TAC SCS_5I1_BASIC +THEN ASSUME_TAC K_SCS_5I1 +THEN MRESAL_TAC Yrtafyh.YRTAFYH[`scs_5I1`;`i`;`j`][ARITH_RULE`3<5`;] +THEN MP_TAC Ppbtydq.MXQTIED +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN EXISTS_TAC`scs_5I1` +THEN ASM_SIMP_TAC[STAB_BB;SCS_K_D_A_STAB_EQ;DIAG_SCS_M_EQ;REAL_ARITH`a<=a`] +THEN REPEAT GEN_TAC +THEN REWRITE_TAC[scs_stab_diag_v39;scs_5I1;scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_M;CS_ADJ] +THEN SCS_TAC +THEN MP_TAC(SET_RULE`psort 5 (i,j) = psort 5 (i',j')\/ ~(psort 5 (i,j) = psort 5 (i',j'))`) +THEN RESA_TAC +THENL[ +MRESAL_TAC DIAD_PSORT_IMP_DIAD[`i`;`j`;`5`;`i'`;`j'`][ARITH_RULE`~(5=0)`] +THEN DICH_TAC 0 +THEN REWRITE_TAC[scs_diag;cstab;h0] +THEN RESA_TAC +THEN REAL_ARITH_TAC; +REAL_ARITH_TAC]);; + +let SCS_5I2_STAB_DIAG= prove( `!v i j. + v IN MMs_v39 scs_5I2 /\ + scs_diag 5 i j /\ + dist(v i,v j) <= cstab ==> + v IN MMs_v39 (scs_stab_diag_v39 scs_5I2 i j)`, +REWRITE_TAC[IN] +THEN REPEAT STRIP_TAC +THEN MP_TAC SCS_5I2_IS_SCS +THEN STRIP_TAC +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_5I2`;`v`] +THEN MRESA_TAC DIST_LE_IMP_A_LE[`v`;`scs_5I2`;`i`;`j`;`cstab`] +THEN ASSUME_TAC SCS_5I2_BASIC +THEN ASSUME_TAC K_SCS_5I2 +THEN MRESAL_TAC Yrtafyh.YRTAFYH[`scs_5I2`;`i`;`j`][ARITH_RULE`3<5`;] +THEN MP_TAC Ppbtydq.MXQTIED +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN EXISTS_TAC`scs_5I2` +THEN ASM_SIMP_TAC[STAB_BB;SCS_K_D_A_STAB_EQ;DIAG_SCS_M_EQ;REAL_ARITH`a<=a`] +THEN REPEAT GEN_TAC +THEN REWRITE_TAC[scs_stab_diag_v39;scs_5I2;scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_M;CS_ADJ] +THEN SCS_TAC +THEN MP_TAC(SET_RULE`psort 5 (i,j) = psort 5 (i',j')\/ ~(psort 5 (i,j) = psort 5 (i',j'))`) +THEN RESA_TAC +THENL[ +MRESAL_TAC DIAD_PSORT_IMP_DIAD[`i`;`j`;`5`;`i'`;`j'`][ARITH_RULE`~(5=0)`] +THEN DICH_TAC 0 +THEN REWRITE_TAC[scs_diag;cstab;h0] +THEN RESA_TAC +THEN REAL_ARITH_TAC; +REAL_ARITH_TAC]);; + + + +let SCS_5I3_STAB_DIAG= prove( `!v i j. + v IN MMs_v39 scs_5I3 /\ + scs_diag 5 i j /\ + dist(v i,v j) <= cstab ==> + v IN MMs_v39 (scs_stab_diag_v39 scs_5I3 i j)`, +REWRITE_TAC[IN] +THEN REPEAT STRIP_TAC +THEN MP_TAC SCS_5I3_IS_SCS +THEN STRIP_TAC +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_5I3`;`v`] +THEN MRESA_TAC DIST_LE_IMP_A_LE[`v`;`scs_5I3`;`i`;`j`;`cstab`] +THEN ASSUME_TAC SCS_5I3_BASIC +THEN ASSUME_TAC K_SCS_5I3 +THEN MRESAL_TAC Yrtafyh.YRTAFYH[`scs_5I3`;`i`;`j`][ARITH_RULE`3<5`;] +THEN MP_TAC Ppbtydq.MXQTIED +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN EXISTS_TAC`scs_5I3` +THEN ASM_SIMP_TAC[STAB_BB;SCS_K_D_A_STAB_EQ;DIAG_SCS_M_EQ;REAL_ARITH`a<=a`] +THEN REPEAT GEN_TAC +THEN REWRITE_TAC[scs_stab_diag_v39;scs_5I3;scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_M;CS_ADJ] +THEN SCS_TAC +THEN MP_TAC(SET_RULE`psort 5 (i,j) = psort 5 (i',j')\/ ~(psort 5 (i,j) = psort 5 (i',j'))`) +THEN RESA_TAC +THENL[ +MRESAL_TAC DIAD_PSORT_IMP_DIAD[`i`;`j`;`5`;`i'`;`j'`][ARITH_RULE`~(5=0)`] +THEN DICH_TAC 0 +THEN REWRITE_TAC[scs_diag;cstab;h0] +THEN RESA_TAC +THEN MRESA_TAC DIAG_5_EQU_PSORT[`i'`;`j'`] +THEN REWRITE_TAC[PAIR_EQ] +THEN SCS_TAC +THEN REAL_ARITH_TAC; +REAL_ARITH_TAC]);; + + +let SCS_5M1_STAB_DIAG= prove( `!v i j. + v IN MMs_v39 scs_5M1 /\ + scs_diag 5 i j /\ + dist(v i,v j) <= cstab ==> + v IN MMs_v39 (scs_stab_diag_v39 scs_5M1 i j)`, +REWRITE_TAC[IN] +THEN REPEAT STRIP_TAC +THEN MP_TAC SCS_5M1_IS_SCS +THEN STRIP_TAC +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_5M1`;`v`] +THEN MRESA_TAC DIST_LE_IMP_A_LE[`v`;`scs_5M1`;`i`;`j`;`cstab`] +THEN ASSUME_TAC SCS_5M1_BASIC +THEN ASSUME_TAC K_SCS_5M1 +THEN MRESAL_TAC Yrtafyh.YRTAFYH[`scs_5M1`;`i`;`j`][ARITH_RULE`3<5`;] +THEN MP_TAC Ppbtydq.MXQTIED +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN EXISTS_TAC`scs_5M1` +THEN ASM_SIMP_TAC[STAB_BB;SCS_K_D_A_STAB_EQ;DIAG_SCS_M_EQ;REAL_ARITH`a<=a`] +THEN REPEAT GEN_TAC +THEN REWRITE_TAC[scs_stab_diag_v39;scs_5M1;scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_M;CS_ADJ] +THEN SCS_TAC +THEN MP_TAC(SET_RULE`psort 5 (i,j) = psort 5 (i',j')\/ ~(psort 5 (i,j) = psort 5 (i',j'))`) +THEN RESA_TAC +THENL[ +MRESAL_TAC DIAD_PSORT_IMP_DIAD[`i`;`j`;`5`;`i'`;`j'`][ARITH_RULE`~(5=0)`] +THEN DICH_TAC 0 +THEN REWRITE_TAC[scs_diag;cstab;h0] +THEN RESA_TAC +THEN MRESA_TAC DIAG_5_EQU_PSORT[`i'`;`j'`] +THEN REWRITE_TAC[PAIR_EQ] +THEN SCS_TAC +THEN REAL_ARITH_TAC; +REAL_ARITH_TAC]);; + + +(*****************) + + +let SCS_5I1_BERAK_BY_CSTAB= prove_by_refinement( `scs_arrow_v39 { scs_5I1 } ({ scs_5M2}UNION { scs_stab_diag_v39 scs_5I1 i j| scs_diag 5 i j })`, +[ +REPEAT GEN_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;IN_ELIM_THM;UNION] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +REWRITE_TAC[SCS_5M2_IS_SCS]; + +MATCH_MP_TAC Yrtafyh.STAB_IS_SCS +THEN ASM_SIMP_TAC[SCS_5I1_IS_SCS;K_SCS_5I1;SCS_5I1_BASIC;ARITH_RULE`3<5`] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_5I1 ==> MMs_v39 s = {}) \/ ~((!s. s = scs_5I1 ==> MMs_v39 s = {}))`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC; + +MP_TAC(SET_RULE`(!i j. scs_diag 5 i j ==> cstab < dist(v i,v j))\/ ~((!i j. scs_diag 5 i j ==> cstab < dist((v:num->real^3) i,v j)))`) +THEN RESA_TAC; + +EXISTS_TAC`scs_5M2` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MM_5I1_IMP_MM_5M2 +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN REPEAT STRIP_TAC +THEN THAYTHE_TAC 1[`i`;`j`] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;REAL_ARITH`~(a b<=a`] +THEN STRIP_TAC +THEN EXISTS_TAC`scs_stab_diag_v39 scs_5I1 i j` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +MATCH_MP_TAC(SET_RULE`A==> B\/A`) +THEN EXISTS_TAC`i:num` +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[]; + +MRESAL_TAC SCS_5I1_STAB_DIAG[`v`;`i`;`j`][IN] +THEN EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[];]);; + + +let SCS_5I2_BERAK_BY_CSTAB= prove_by_refinement( +`scs_arrow_v39 { scs_5I2 } ({ scs_5M2}UNION { scs_stab_diag_v39 scs_5I2 i j| scs_diag 5 i j })`, +[ +REPEAT GEN_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;IN_ELIM_THM;UNION] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +REWRITE_TAC[SCS_5M2_IS_SCS]; + +MATCH_MP_TAC Yrtafyh.STAB_IS_SCS +THEN ASM_SIMP_TAC[SCS_5I2_IS_SCS;K_SCS_5I2;SCS_5I2_BASIC;ARITH_RULE`3<5`] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC; + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_5I2 ==> MMs_v39 s = {}) \/ ~((!s. s = scs_5I2 ==> MMs_v39 s = {}))`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC; + +MP_TAC(SET_RULE`(!i j. scs_diag 5 i j ==> cstab < dist(v i,v j))\/ ~((!i j. scs_diag 5 i j ==> cstab < dist((v:num->real^3) i,v j)))`) +THEN RESA_TAC; + +EXISTS_TAC`scs_5M2` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MM_5I2_IMP_MM_5M2 +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN REPEAT STRIP_TAC +THEN THAYTHE_TAC 1[`i`;`j`] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;REAL_ARITH`~(a b<=a`] +THEN STRIP_TAC +THEN EXISTS_TAC`scs_stab_diag_v39 scs_5I2 i j` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +MATCH_MP_TAC(SET_RULE`A==> B\/A`) +THEN EXISTS_TAC`i:num` +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[]; + +MRESAL_TAC SCS_5I2_STAB_DIAG[`v`;`i`;`j`][IN] +THEN EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[]]);; + + + +let SCS_5I3_BERAK_BY_CSTAB= prove_by_refinement( +`scs_arrow_v39 { scs_5I3 } ({ scs_5M2}UNION { scs_stab_diag_v39 scs_5I3 i j| scs_diag 5 i j })`, +[ +REPEAT GEN_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;IN_ELIM_THM;UNION] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +REWRITE_TAC[SCS_5M2_IS_SCS]; + +MATCH_MP_TAC Yrtafyh.STAB_IS_SCS +THEN ASM_SIMP_TAC[SCS_5I3_IS_SCS;K_SCS_5I3;SCS_5I3_BASIC;ARITH_RULE`3<5`] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC; + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_5I3 ==> MMs_v39 s = {}) \/ ~((!s. s = scs_5I3 ==> MMs_v39 s = {}))`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC; + +MP_TAC(SET_RULE`(!i j. scs_diag 5 i j ==> cstab < dist(v i,v j))\/ ~((!i j. scs_diag 5 i j ==> cstab < dist((v:num->real^3) i,v j)))`) +THEN RESA_TAC; + +EXISTS_TAC`scs_5M2` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MM_5I3_IMP_MM_5M2 +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN REPEAT STRIP_TAC +THEN THAYTHE_TAC 1[`i`;`j`] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;REAL_ARITH`~(a b<=a`] +THEN STRIP_TAC +THEN EXISTS_TAC`scs_stab_diag_v39 scs_5I3 i j` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +MATCH_MP_TAC(SET_RULE`A==> B\/A`) +THEN EXISTS_TAC`i:num` +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[]; + +MRESAL_TAC SCS_5I3_STAB_DIAG[`v`;`i`;`j`][IN] +THEN EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[]]);; + + +let SCS_5M1_BERAK_BY_CSTAB= prove_by_refinement(`scs_arrow_v39 { scs_5M1 } ({ scs_5M2}UNION { scs_stab_diag_v39 scs_5M1 i j| scs_diag 5 i j })`, +[ +REPEAT GEN_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;IN_ELIM_THM;UNION] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +REWRITE_TAC[SCS_5M2_IS_SCS]; + +MATCH_MP_TAC Yrtafyh.STAB_IS_SCS +THEN ASM_SIMP_TAC[SCS_5M1_IS_SCS;K_SCS_5M1;SCS_5M1_BASIC;ARITH_RULE`3<5`] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC; + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_5M1 ==> MMs_v39 s = {}) \/ ~((!s. s = scs_5M1 ==> MMs_v39 s = {}))`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC; + +MP_TAC(SET_RULE`(!i j. scs_diag 5 i j ==> cstab < dist(v i,v j))\/ ~((!i j. scs_diag 5 i j ==> cstab < dist((v:num->real^3) i,v j)))`) +THEN RESA_TAC; + +EXISTS_TAC`scs_5M2` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MM_5M1_IMP_MM_5M2 +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN REPEAT STRIP_TAC +THEN THAYTHE_TAC 1[`i`;`j`] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;REAL_ARITH`~(a b<=a`] +THEN STRIP_TAC +THEN EXISTS_TAC`scs_stab_diag_v39 scs_5M1 i j` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +MATCH_MP_TAC(SET_RULE`A==> B\/A`) +THEN EXISTS_TAC`i:num` +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[]; + +MRESAL_TAC SCS_5M1_STAB_DIAG[`v`;`i`;`j`][IN] +THEN EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[]]);; + + +(**********************) + +let DIAG_EQ_ADD5=prove(`scs_diag 5 (i MOD 5) (j MOD 5)<=> +((i MOD 5= (j MOD 5+ 2) MOD 5)\/ +(j MOD 5=(i MOD 5+2) MOD 5))`, +REWRITE_TAC[scs_diag] +THEN MP_TAC(ARITH_RULE`i MOD 5<5==> i MOD 5= 0 \/ i MOD 5= 1 \/i MOD 5= 2 \/ +i MOD 5= 3 \/i MOD 5= 4 `) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`j MOD 5<5==> j MOD 5= 0 \/ j MOD 5= 1 \/j MOD 5= 2 \/ +j MOD 5= 3 \/j MOD 5= 4 +`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN ARITH_TAC);; + + +let EXPAND_STAB_DIAG_5=prove_by_refinement(`is_scs_v39 s /\scs_k_v39 s=5==> +{scs_stab_diag_v39 s (i MOD 5) (j MOD 5) | i MOD 5 = + (j MOD 5 + 2) MOD 5 \/ + j MOD 5 = + (i MOD 5 + 2) MOD 5}= +{scs_stab_diag_v39 s (i+2) i| i<5} `, +[REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;UNION] +THEN STRIP_TAC +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MRESAS_TAC STAB_MOD[`s`;`j MOD 5 + 2`;`j MOD 5`][SCS_5I1_IS_SCS;K_SCS_5I1;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN EXISTS_TAC`j MOD 5` +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`]; + +MRESAS_TAC STAB_MOD[`s`;`i MOD 5`;`i MOD 5 + 2`][SCS_5I1_IS_SCS;K_SCS_5I1;MOD_REFL;ARITH_RULE`~(5=0)`] +THEN EXISTS_TAC`i MOD 5` +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`;STAB_SYM]; + +EXISTS_TAC`i+2` +THEN EXISTS_TAC`i:num` +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`;MOD_LT] +THEN MRESAS_TAC STAB_MOD[`s`;`(i + 2)`;`i`][SCS_5I1_IS_SCS;K_SCS_5I1;MOD_REFL;ARITH_RULE`~(5=0)`;MOD_LT]]);; + + +let EXPAND_STAB_DIAG_5I1=prove(`{scs_stab_diag_v39 scs_5I1 (i MOD 5) (j MOD 5) | i MOD 5 = + (j MOD 5 + 2) MOD 5 \/ + j MOD 5 = + (i MOD 5 + 2) MOD 5}= +{scs_stab_diag_v39 scs_5I1 (i+2) i| i<5} `, +ASM_SIMP_TAC[EXPAND_STAB_DIAG_5;SCS_5I1_IS_SCS;K_SCS_5I1]);; + + +let EXPAND_STAB_DIAG_5I2=prove(`{scs_stab_diag_v39 scs_5I2 (i MOD 5) (j MOD 5) | i MOD 5 = + (j MOD 5 + 2) MOD 5 \/ + j MOD 5 = + (i MOD 5 + 2) MOD 5}= +{scs_stab_diag_v39 scs_5I2 (i+2) i| i<5} `, +ASM_SIMP_TAC[EXPAND_STAB_DIAG_5;SCS_5I2_IS_SCS;K_SCS_5I2]);; + + + +let EXPAND_STAB_DIAG_5I3=prove(`{scs_stab_diag_v39 scs_5I3 (i MOD 5) (j MOD 5) | i MOD 5 = + (j MOD 5 + 2) MOD 5 \/ + j MOD 5 = + (i MOD 5 + 2) MOD 5}= +{scs_stab_diag_v39 scs_5I3 (i+2) i| i<5} `, +ASM_SIMP_TAC[EXPAND_STAB_DIAG_5;SCS_5I3_IS_SCS;K_SCS_5I3]);; + + +let EXPAND_STAB_DIAG_5M1=prove(`{scs_stab_diag_v39 scs_5M1 (i MOD 5) (j MOD 5) | i MOD 5 = + (j MOD 5 + 2) MOD 5 \/ + j MOD 5 = + (i MOD 5 + 2) MOD 5}= +{scs_stab_diag_v39 scs_5M1 (i+2) i| i<5} `, +ASM_SIMP_TAC[EXPAND_STAB_DIAG_5;SCS_5M1_IS_SCS;K_SCS_5M1]);; + + + + + + +let EQ_DIAG_STAB_5I1_02=prove(`scs_arrow_v39 + {scs_stab_diag_v39 scs_5I1 (i + 2) i } + {scs_stab_diag_v39 scs_5I1 0 2}`, +MRESA_TAC STAB_SYM[`scs_5I1`;`2`;`0`] +THEN MP_TAC (GEN_ALL Wkeidft.WKEIDFT) +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_SIMP_TAC[ARITH_RULE`2 + i = (i + 2) + 0/\ 3<6/\ i+1= SUC i`;K_SCS_5I1;h0_LT_B_SCS_5I1;h0_EQ_B_SCS_5I1;SCS_5I1_IS_SCS;SCS_5I1_BASIC] +THEN SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`1<5`;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&2` +THEN EXISTS_TAC`&2 *h0` +THEN EXISTS_TAC`&2 *h0` +THEN EXISTS_TAC`&6` +THEN ASM_SIMP_TAC[scs_diag;ARITH_RULE`SUC (i + 2)= i+3/\ SUC i= i+1/\ 2+1=3`;ARITH_RULE`1<5/\ ~(5=0)`;Qknvmlb.SUC_MOD_NOT_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN SCS_TAC +THEN MP_TAC(SET_RULE`i= i+0==> i MOD 5= (i+0) MOD 5`) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[ARITH_RULE`x+0=x`] +THEN RESA_TAC +THEN ASM_SIMP_TAC[Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`1<5/\ ~(5=0)/\ 3<5`] +THEN SCS_TAC);; + + + +let EQ_DIAG_STAB_5I2_02=prove(`scs_arrow_v39 + {scs_stab_diag_v39 scs_5I2 (i + 2) i } + {scs_stab_diag_v39 scs_5I2 0 2}`, +MRESA_TAC STAB_SYM[`scs_5I2`;`2`;`0`] +THEN MP_TAC (GEN_ALL Wkeidft.WKEIDFT) +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_SIMP_TAC[ARITH_RULE`2 + i = (i + 2) + 0/\ 3<6/\ i+1= SUC i`;K_SCS_5I2;h0_LT_B_SCS_5I2;h0_EQ_B_SCS_5I2;SCS_5I2_IS_SCS;SCS_5I2_BASIC] +THEN SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`1<5`;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&2` +THEN EXISTS_TAC`&2 *h0` +THEN EXISTS_TAC`sqrt8` +THEN EXISTS_TAC`&6` +THEN ASM_SIMP_TAC[scs_diag;ARITH_RULE`SUC (i + 2)= i+3/\ SUC i= i+1/\ 2+1=3`;ARITH_RULE`1<5/\ ~(5=0)`;Qknvmlb.SUC_MOD_NOT_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN SCS_TAC +THEN MP_TAC(SET_RULE`i= i+0==> i MOD 5= (i+0) MOD 5`) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[ARITH_RULE`x+0=x`] +THEN RESA_TAC +THEN ASM_SIMP_TAC[Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`1<5/\ ~(5=0)/\ 3<5`] +THEN SCS_TAC);; + + +let SET_EQ_DIAG_STAB_5I1_02=prove(`scs_arrow_v39 + {scs_stab_diag_v39 scs_5I1 (i + 2) i |i<5} + {scs_stab_diag_v39 scs_5I1 0 2}`, +REWRITE_TAC[ARITH_RULE`i<5<=> i=0\/i=1\/i=2\/i=3\/i=4`;SET_RULE`{scs_stab_diag_v39 scs_5I1 (i + 2) i |i=0\/i=1\/i=2\/i=3\/i=4} += +{scs_stab_diag_v39 scs_5I1 (0 + 2) 0} UNION +{scs_stab_diag_v39 scs_5I1 (1 + 2) 1} UNION +{scs_stab_diag_v39 scs_5I1 (2 + 2) 2} UNION +{scs_stab_diag_v39 scs_5I1 (3 + 2) 3} UNION +{scs_stab_diag_v39 scs_5I1 (4 + 2) 4} +`;] +THEN REPEAT(ONCE_REWRITE_TAC[SET_RULE`{scs_stab_diag_v39 scs_5I1 0 2}={scs_stab_diag_v39 scs_5I1 0 2} UNION {scs_stab_diag_v39 scs_5I1 0 2}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[EQ_DIAG_STAB_5I1_02]));; + + + +let SET_EQ_DIAG_STAB_5I2_02=prove(`scs_arrow_v39 + {scs_stab_diag_v39 scs_5I2 (i + 2) i |i<5} + {scs_stab_diag_v39 scs_5I2 0 2}`, +REWRITE_TAC[ARITH_RULE`i<5<=> i=0\/i=1\/i=2\/i=3\/i=4`;SET_RULE`{scs_stab_diag_v39 scs_5I2 (i + 2) i |i=0\/i=1\/i=2\/i=3\/i=4} += +{scs_stab_diag_v39 scs_5I2 (0 + 2) 0} UNION +{scs_stab_diag_v39 scs_5I2 (1 + 2) 1} UNION +{scs_stab_diag_v39 scs_5I2 (2 + 2) 2} UNION +{scs_stab_diag_v39 scs_5I2 (3 + 2) 3} UNION +{scs_stab_diag_v39 scs_5I2 (4 + 2) 4} +`;] +THEN REPEAT(ONCE_REWRITE_TAC[SET_RULE`{scs_stab_diag_v39 scs_5I2 0 2}={scs_stab_diag_v39 scs_5I2 0 2} UNION {scs_stab_diag_v39 scs_5I2 0 2}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[EQ_DIAG_STAB_5I2_02]));; + + + +(*******************) + +let SET_STAB_5I1=prove(`{ scs_stab_diag_v39 scs_5I1 i j| scs_diag 5 i j }= { scs_stab_diag_v39 scs_5I1 (i MOD 5) (j MOD 5)| scs_diag 5 (i MOD 5) (j MOD 5) }`, + ASM_SIMP_TAC[STAB_MOD;DIAG_MOD;EXTENSION;IN_ELIM_THM;ARITH_RULE`~(5=0)`;] +THEN MRESAL_TAC STAB_MOD[`scs_5I1`][SCS_5I1_IS_SCS;K_SCS_5I1]);; + + +let SET_STAB_5I2=prove(`{ scs_stab_diag_v39 scs_5I2 i j| scs_diag 5 i j }= { scs_stab_diag_v39 scs_5I2 (i MOD 5) (j MOD 5)| scs_diag 5 (i MOD 5) (j MOD 5) }`, + ASM_SIMP_TAC[STAB_MOD;DIAG_MOD;EXTENSION;IN_ELIM_THM;ARITH_RULE`~(5=0)`;] +THEN MRESAL_TAC STAB_MOD[`scs_5I2`][SCS_5I2_IS_SCS;K_SCS_5I2]);; + + +let SET_STAB_5I3=prove(`{ scs_stab_diag_v39 scs_5I3 i j| scs_diag 5 i j }= { scs_stab_diag_v39 scs_5I3 (i MOD 5) (j MOD 5)| scs_diag 5 (i MOD 5) (j MOD 5) }`, + ASM_SIMP_TAC[STAB_MOD;DIAG_MOD;EXTENSION;IN_ELIM_THM;ARITH_RULE`~(5=0)`;] +THEN MRESAL_TAC STAB_MOD[`scs_5I3`][SCS_5I3_IS_SCS;K_SCS_5I3]);; + + +let SET_STAB_5M1=prove(`{ scs_stab_diag_v39 scs_5M1 i j| scs_diag 5 i j }= { scs_stab_diag_v39 scs_5M1 (i MOD 5) (j MOD 5)| scs_diag 5 (i MOD 5) (j MOD 5) }`, + ASM_SIMP_TAC[STAB_MOD;DIAG_MOD;EXTENSION;IN_ELIM_THM;ARITH_RULE`~(5=0)`;] +THEN MRESAL_TAC STAB_MOD[`scs_5M1`][SCS_5M1_IS_SCS;K_SCS_5M1]);; + + +let SET_EQ_DIAG_STAB_5I1=prove( `scs_arrow_v39 { scs_stab_diag_v39 scs_5I1 i j| scs_diag 5 i j } +{ scs_stab_diag_v39 scs_5I1 0 2}`, +ONCE_REWRITE_TAC[SET_STAB_5I1] +THEN REWRITE_TAC[DIAG_EQ_ADD5;EXPAND_STAB_DIAG_5I1] +THEN ASM_SIMP_TAC[SET_EQ_DIAG_STAB_5I1_02;]);; + + +let SET_EQ_DIAG_STAB_5I2=prove( `scs_arrow_v39 { scs_stab_diag_v39 scs_5I2 i j| scs_diag 5 i j } +{ scs_stab_diag_v39 scs_5I2 0 2}`, +ONCE_REWRITE_TAC[SET_STAB_5I2] +THEN REWRITE_TAC[DIAG_EQ_ADD5;EXPAND_STAB_DIAG_5I2] +THEN ASM_SIMP_TAC[SET_EQ_DIAG_STAB_5I2_02;]);; + + + +let OTMTOTJ1= prove(`scs_arrow_v39 { scs_5I1 } { scs_stab_diag_v39 scs_5I1 0 2 , scs_5M2 }`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`({ scs_5M2}UNION { scs_stab_diag_v39 scs_5I1 i j| scs_diag 5 i j })` +THEN ASM_SIMP_TAC[SCS_5I1_BERAK_BY_CSTAB] +THEN REWRITE_TAC[SET_RULE`{A,B}={B} UNION {A}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_REWRITE_TAC[SET_EQ_DIAG_STAB_5I1] +THEN MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[SCS_5M2_IS_SCS]);; + + +let OTMTOTJ2= prove(`scs_arrow_v39 { scs_5I2 } { scs_stab_diag_v39 scs_5I2 0 2 , scs_5M2 }`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`({ scs_5M2}UNION { scs_stab_diag_v39 scs_5I2 i j| scs_diag 5 i j })` +THEN ASM_SIMP_TAC[SCS_5I2_BERAK_BY_CSTAB] +THEN REWRITE_TAC[SET_RULE`{A,B}={B} UNION {A}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_REWRITE_TAC[SET_EQ_DIAG_STAB_5I2] +THEN MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[SCS_5M2_IS_SCS]);; + +(*************************) + + +let BB_5I3_IS_BB_5M1=prove( ` BBs_v39 (scs_stab_diag_v39 scs_5I3 i j) v==> BBs_v39 (scs_stab_diag_v39 scs_5M1 i j) v`, +REWRITE_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_5I3;scs_5M2;CS_ADJ;scs_diag;ARITH_RULE`~(5<=3)`] +THEN SCS_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`psort 5 (i,j) = psort 5 (i',j')\/ ~(psort 5 (i,j) = psort 5 (i',j'))`) +THEN RESA_TAC +THEN THAYTHE_TAC 2[`i'`;`j'`] +THEN DICH_TAC 0 +THEN MP_TAC sqrt8_LE_CSTAB +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC);; + +(***********SCS_BAISC************) + + +let STAB_5I3_SCS=prove(` scs_diag (scs_k_v39 scs_5I3) i j +==> is_scs_v39 (scs_stab_diag_v39 scs_5I3 i j)/\ scs_basic_v39 (scs_stab_diag_v39 scs_5I3 i j)`, +STRIP_TAC +THEN MATCH_MP_TAC Yrtafyh.YRTAFYH +THEN ASM_REWRITE_TAC[SCS_K_D_A_STAB_EQ;SCS_5I3_IS_SCS;SCS_5I3_BASIC;K_SCS_5I3; +ARITH_RULE`3<5`;LET_DEF;LET_END_DEF;scs_5I3;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;h0;cstab] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + + +let STAB_5I2_SCS=prove(` scs_diag (scs_k_v39 scs_5I2) i j +==> is_scs_v39 (scs_stab_diag_v39 scs_5I2 i j)/\ scs_basic_v39 (scs_stab_diag_v39 scs_5I2 i j)`, +STRIP_TAC +THEN MATCH_MP_TAC Yrtafyh.YRTAFYH +THEN ASM_REWRITE_TAC[SCS_K_D_A_STAB_EQ;SCS_5I2_IS_SCS;SCS_5I2_BASIC;K_SCS_5I2; +ARITH_RULE`3<5`;LET_DEF;LET_END_DEF;scs_5I3;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;h0;cstab] +THEN SCS_TAC +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC);; + + + + +let STAB_5M1_SCS=prove(` scs_diag (scs_k_v39 scs_5M1) i j +==> is_scs_v39 (scs_stab_diag_v39 scs_5M1 i j)/\ scs_basic_v39 (scs_stab_diag_v39 scs_5M1 i j)`, +STRIP_TAC +THEN MATCH_MP_TAC Yrtafyh.YRTAFYH +THEN ASM_REWRITE_TAC[SCS_K_D_A_STAB_EQ;SCS_5M1_IS_SCS;SCS_5M1_BASIC;K_SCS_5M1; +ARITH_RULE`3<5`;LET_DEF;LET_END_DEF;scs_5I3;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;h0;cstab] +THEN SCS_TAC +THEN REWRITE_TAC[h0] +THEN REAL_ARITH_TAC);; + +let STAB_5M2_SCS=prove(` scs_diag (scs_k_v39 scs_5M2) i j +==> is_scs_v39 (scs_stab_diag_v39 scs_5M2 i j)/\ scs_basic_v39 (scs_stab_diag_v39 scs_5M2 i j)`, +STRIP_TAC +THEN MATCH_MP_TAC Yrtafyh.YRTAFYH +THEN ASM_REWRITE_TAC[SCS_K_D_A_STAB_EQ;SCS_5M2_IS_SCS;SCS_5M2_BASIC;K_SCS_5M2; +ARITH_RULE`3<5`;LET_DEF;LET_END_DEF;scs_5I3;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;h0;cstab] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC);; + + + +(*****************) + + +let MM_5I3_IMP_MM_5M1=prove(`scs_diag 5 i j /\ MMs_v39 (scs_stab_diag_v39 scs_5I3 i j) v ==> ~(MMs_v39 ((scs_stab_diag_v39 scs_5M1 i j)) ={})`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL Ppbtydq.XWNHLMD_MM) +THEN EXISTS_TAC`v:num->real^3` +THEN EXISTS_TAC`(scs_stab_diag_v39 scs_5I3 i j)` +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`(scs_stab_diag_v39 scs_5I3 i j)`;`v`] +THEN ASSUME_TAC SCS_5M1_BASIC +THEN ASSUME_TAC K_SCS_5M1 +THEN ASM_SIMP_TAC[BB_5I3_IS_BB_5M1;IN;SCS_5M1_IS_SCS;SCS_K_D_A_STAB_EQ;K_SCS_5I3;STAB_5M1_SCS;STAB_5I3_SCS] +THEN SCS_TAC +THEN REAL_ARITH_TAC);; + + +let STAB_5I3_ARROW_STAB_5M1=prove_by_refinement(`scs_diag 5 i j +==> scs_arrow_v39 { scs_stab_diag_v39 scs_5I3 i j} { scs_stab_diag_v39 scs_5M1 i j}`, +[ +STRIP_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;IN_ELIM_THM;UNION] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +ASM_SIMP_TAC[BB_5I3_IS_BB_5M1;IN;SCS_5M1_IS_SCS;SCS_K_D_A_STAB_EQ;K_SCS_5I3;STAB_5M1_SCS;STAB_5I3_SCS;K_SCS_5M1]; + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_stab_diag_v39 scs_5I3 i j==> MMs_v39 s = {}) \/ ~((!s. s = scs_stab_diag_v39 scs_5I3 i j ==> MMs_v39 s = {}))`); + +ASM_REWRITE_TAC[]; + + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC +THEN EXISTS_TAC`scs_stab_diag_v39 scs_5M1 i j` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MM_5I3_IMP_MM_5M1 +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN REPEAT STRIP_TAC]);; + + +let h0_EQ_B_SCS_5M2=prove(`(!i j. scs_diag 5 i j ==> scs_b_v39 scs_5M2 i j= &6) +/\ (!i j. scs_diag 5 i j ==> scs_a_v39 scs_5M2 i j= cstab)`, +SCS_TAC +THEN REWRITE_TAC[h0;scs_diag;cstab] +THEN REPEAT RESA_TAC +THEN MP_TAC DIAG_5_EQU_PSORT +THEN RESA_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN SCS_TAC);; + + +let h0_EQ_B_SCS_5M1=prove(`(!i j. scs_diag 5 i j ==> scs_b_v39 scs_5M1 i j= &6) +/\ (!i j. scs_diag 5 i j ==> scs_a_v39 scs_5M1 i j= &2 * h0)`, +SCS_TAC +THEN REWRITE_TAC[h0;scs_diag;cstab] +THEN REPEAT RESA_TAC +THEN MP_TAC DIAG_5_EQU_PSORT +THEN RESA_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN SCS_TAC);; + + + +let PROP_OPP_DIAG_5M1_03= prove_by_refinement(`scs_stab_diag_v39 scs_5M1 0 3= scs_prop_equ_v39(scs_opp_v39 (scs_stab_diag_v39 scs_5M1 1 3)) 3 `, + +[REWRITE_TAC[scs_prop_equ_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39; scs_basic;SCS_K_D_A_STAB_EQ;scs_opp_v39] +THEN MATCH_MP_TAC scs_inj +THEN SIMP_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;SCS_5M1_BASIC] +THEN STRIP_TAC; + +MRESAL_TAC STAB_5M1_SCS[`0`;`3`][K_SCS_5M1;scs_diag;ARITH_RULE`~(0 MOD 5 = 3 MOD 5) /\ + ~(SUC 0 MOD 5 = 3 MOD 5) /\ + ~(0 MOD 5 = SUC 3 MOD 5)`]; + +STRIP_TAC; + +ASM_REWRITE_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_5M1;mk_unadorned_v39;peropp;peropp2;FUN_EQ_THM] +THEN SET_TAC[]; + +STRIP_TAC +THEN ASM_REWRITE_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_5M1;mk_unadorned_v39;peropp;peropp2;FUN_EQ_THM;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN REPEAT GEN_TAC +THEN ASSUME_TAC (ARITH_RULE`~(5=0)`) +THEN MRESA_TAC PSORT_MOD[`5`;`x`;`x'`] +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`3`;`x`;`5`] +THEN MRESA_TAC MOD_ADD_MOD[`3`;`x'`;`5`] +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`x MOD 5<5==> x MOD 5=0\/ x MOD 5=1\/ x MOD 5=2\/ x MOD 5=3\/x MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 5<5==> x' MOD 5=0\/ x' MOD 5=1\/ x' MOD 5=2\/ x' MOD 5=3\/x' MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT;ARITH_RULE`5-1=4/\ 5-2=3/\ 5-3=2/\ 5-4=1/\ 5-5=0/\ 2+0=2/\ 2+1=3/\ 2+2=4/\ 2+3=5/\2+4=6 +/\ 3+0=3/\ 3+1=4/\ 3+2=5/\ 3+3=6/\ 3+4=7/\ 7 MOD 5=2`;PAIR_EQ]]);; + + + +let PROP_OPP_DIAG_5M1_02= prove_by_refinement(`scs_stab_diag_v39 scs_5M1 0 2= scs_prop_equ_v39(scs_opp_v39 (scs_stab_diag_v39 scs_5M1 1 4)) 3 `, + +[REWRITE_TAC[scs_prop_equ_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39; scs_basic;SCS_K_D_A_STAB_EQ;scs_opp_v39] +THEN MATCH_MP_TAC scs_inj +THEN SIMP_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;SCS_5M1_BASIC] +THEN STRIP_TAC; + +MRESAL_TAC STAB_5M1_SCS[`0`;`2`][K_SCS_5M1;scs_diag;ARITH_RULE`~(0 MOD 5 = 2 MOD 5) /\ + ~(SUC 0 MOD 5 = 2 MOD 5) /\ + ~(0 MOD 5 = SUC 2 MOD 5)`]; + +STRIP_TAC; + +ASM_REWRITE_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_5M1;mk_unadorned_v39;peropp;peropp2;FUN_EQ_THM] +THEN SET_TAC[]; + +STRIP_TAC +THEN ASM_REWRITE_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_5M1;mk_unadorned_v39;peropp;peropp2;FUN_EQ_THM;] +THEN REWRITE_TAC[Terminal.FUNLIST_EXPLICIT] +THEN REPEAT GEN_TAC +THEN ASSUME_TAC (ARITH_RULE`~(5=0)`) +THEN MRESA_TAC PSORT_MOD[`5`;`x`;`x'`] +THEN SYM_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`3`;`x`;`5`] +THEN MRESA_TAC MOD_ADD_MOD[`3`;`x'`;`5`] +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`x MOD 5<5==> x MOD 5=0\/ x MOD 5=1\/ x MOD 5=2\/ x MOD 5=3\/x MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 5<5==> x' MOD 5=0\/ x' MOD 5=1\/ x' MOD 5=2\/ x' MOD 5=3\/x' MOD 5=4`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(5=0)`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT;ARITH_RULE`5-1=4/\ 5-2=3/\ 5-3=2/\ 5-4=1/\ 5-5=0/\ 2+0=2/\ 2+1=3/\ 2+2=4/\ 2+3=5/\2+4=6 +/\ 3+0=3/\ 3+1=4/\ 3+2=5/\ 3+3=6/\ 3+4=7/\ 7 MOD 5=2`;PAIR_EQ]]);; + + + +let STAB_5I3_ARROW_STAB_5M1_DIAG=prove( `scs_arrow_v39 {scs_stab_diag_v39 scs_5I3 i j | scs_diag 5 i j} + {scs_stab_diag_v39 scs_5M1 i j | scs_diag 5 i j}`, +ONCE_REWRITE_TAC[SET_STAB_5I3] +THEN ONCE_REWRITE_TAC[SET_STAB_5M1] +THEN REWRITE_TAC[DIAG_EQ_ADD5;EXPAND_STAB_DIAG_5I3;EXPAND_STAB_DIAG_5M1] +THEN REWRITE_TAC[ARITH_RULE`i<5<=> i=0\/i=1\/i=2\/i=3\/i=4`;SET_RULE`{scs_stab_diag_v39 scs_5I3 (i + 2) i |i=0\/i=1\/i=2\/i=3\/i=4} += +{scs_stab_diag_v39 scs_5I3 (0 + 2) 0} UNION +{scs_stab_diag_v39 scs_5I3 (1 + 2) 1} UNION +{scs_stab_diag_v39 scs_5I3 (2 + 2) 2} UNION +{scs_stab_diag_v39 scs_5I3 (3 + 2) 3} UNION +{scs_stab_diag_v39 scs_5I3 (4 + 2) 4} +`;SET_RULE`{scs_stab_diag_v39 scs_5M1 (i + 2) i |i=0\/i=1\/i=2\/i=3\/i=4} += +{scs_stab_diag_v39 scs_5M1 (0 + 2) 0} UNION +{scs_stab_diag_v39 scs_5M1 (1 + 2) 1} UNION +{scs_stab_diag_v39 scs_5M1 (2 + 2) 2} UNION +{scs_stab_diag_v39 scs_5M1 (3 + 2) 3} UNION +{scs_stab_diag_v39 scs_5M1 (4 + 2) 4} +`;] +THEN REPEAT(MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC +THENL[MATCH_MP_TAC STAB_5I3_ARROW_STAB_5M1 +THEN REWRITE_TAC[scs_diag;ARITH_RULE`3+2=5/\ 2+2=4`] +THEN SCS_TAC; +ALL_TAC]) +THEN MATCH_MP_TAC STAB_5I3_ARROW_STAB_5M1 +THEN REWRITE_TAC[scs_diag;ARITH_RULE`4+2=6/\ 7 MOD 5=2`] +THEN SCS_TAC +THEN REWRITE_TAC[scs_diag;ARITH_RULE`4+2=6/\ 7 MOD 5=2/\ ~(2=4)`]);; + + + + +let SET_EQ_DIAG_STAB_5M1= prove_by_refinement(`scs_arrow_v39 {scs_stab_diag_v39 scs_5M1 i j | scs_diag 5 i j} + {scs_stab_diag_v39 scs_5M1 0 2, scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 + scs_5M1 + 2 + 4}`, +[ +ONCE_REWRITE_TAC[SET_STAB_5M1] +THEN REWRITE_TAC[DIAG_EQ_ADD5;EXPAND_STAB_DIAG_5I3;EXPAND_STAB_DIAG_5M1] +THEN REWRITE_TAC[ARITH_RULE`i<5<=> i=0\/i=1\/i=2\/i=3\/i=4`; +SET_RULE`{A,B,C} += +{A}UNION +{B}UNION +{C}UNION +{B}UNION +{A} +`;SET_RULE`{scs_stab_diag_v39 scs_5M1 (i + 2) i |i=0\/i=1\/i=2\/i=3\/i=4} += +{scs_stab_diag_v39 scs_5M1 (0 + 2) 0} UNION +{scs_stab_diag_v39 scs_5M1 (1 + 2) 1} UNION +{scs_stab_diag_v39 scs_5M1 (2 + 2) 2} UNION +{scs_stab_diag_v39 scs_5M1 (3 + 2) 3} UNION +{scs_stab_diag_v39 scs_5M1 (4 + 2) 4} +`;] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`0+2=2`;STAB_SYM] +THEN MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC STAB_5M1_SCS[`2`;`0`][scs_diag;K_SCS_5M1;ARITH_RULE`~(2 MOD 5 = 0 MOD 5) /\ + ~(SUC 2 MOD 5 = 0 MOD 5) /\ + ~(2 MOD 5 = SUC 0 MOD 5)`]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`1+2=3`;STAB_SYM;PROP_OPP_DIAG_5M1_03] +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_opp_v39 (scs_stab_diag_v39 scs_5M1 1 3)}` +THEN STRIP_TAC; + +MATCH_MP_TAC (GEN_ALL YXIONXL2) +THEN EXISTS_TAC`5` +THEN ASM_SIMP_TAC[SCS_K_D_A_STAB_EQ;ARITH_RULE`~(5<=3)`;K_SCS_5M1] +THEN MRESAL_TAC STAB_5M1_SCS[`1`;`3`][scs_diag;K_SCS_5M1;ARITH_RULE`~(1 MOD 5 = 3 MOD 5) /\ + ~(SUC 1 MOD 5 = 3 MOD 5) /\ + ~(1 MOD 5 = SUC 3 MOD 5)`]; + +MATCH_MP_TAC(GEN_ALL YXIONXL3) +THEN MATCH_MP_TAC (GEN_ALL OPP_IS_SCS) +THEN EXISTS_TAC`scs_opp_v39 (scs_stab_diag_v39 scs_5M1 1 3)` +THEN MRESAL_TAC STAB_5M1_SCS[`1`;`3`][scs_diag;K_SCS_5M1;ARITH_RULE`~(1 MOD 5 = 3 MOD 5) /\ + ~(SUC 1 MOD 5 = 3 MOD 5) /\ + ~(1 MOD 5 = SUC 3 MOD 5)`]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`2+2=4`;STAB_SYM] +THEN MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC STAB_5M1_SCS[`2`;`4`][scs_diag;K_SCS_5M1;ARITH_RULE`~(2 MOD 5 = 4 MOD 5) /\ + ~(SUC 2 MOD 5 = 4 MOD 5) /\ + ~(2 MOD 5 = SUC 4 MOD 5)`]; + +MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`3+2=5`;STAB_SYM] +THEN MRESAL_TAC STAB_MOD[`scs_5M1`;`5`;`3`][SCS_5M1_IS_SCS;K_SCS_5M1;ARITH_RULE`5 MOD 5=0/\ 3 MOD 5=3`] +THEN SYM_ASSUM_TAC +THEN REWRITE_TAC[ARITH_RULE`3+2=5`;STAB_SYM] +THEN MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC STAB_5M1_SCS[`3`;`0`][scs_diag;K_SCS_5M1;ARITH_RULE`~(3 MOD 5 = 0 MOD 5) /\ + ~(SUC 3 MOD 5 = 0 MOD 5) /\ + ~(3 MOD 5 = SUC 0 MOD 5)`]; + +REWRITE_TAC[ARITH_RULE`4+2=6`;] +THEN MRESAL_TAC STAB_MOD[`scs_5M1`;`6`;`4`][SCS_5M1_IS_SCS;K_SCS_5M1;ARITH_RULE`6 MOD 5=1/\ 4 MOD 5=4`] +THEN SYM_ASSUM_TAC +THEN REWRITE_TAC[PROP_OPP_DIAG_5M1_02]; + +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_opp_v39 (scs_stab_diag_v39 scs_5M1 1 4)}` +THEN STRIP_TAC; + +MATCH_MP_TAC (GEN_ALL YXIONXL2) +THEN EXISTS_TAC`5` +THEN ASM_SIMP_TAC[SCS_K_D_A_STAB_EQ;ARITH_RULE`~(5<=3)`;K_SCS_5M1] +THEN MRESAL_TAC STAB_5M1_SCS[`1`;`4`][scs_diag;K_SCS_5M1;ARITH_RULE`~(1 MOD 5 = 4 MOD 5) /\ + ~(SUC 1 MOD 5 = 4 MOD 5) /\ + ~(1 MOD 5 = SUC 4 MOD 5)`]; + +MATCH_MP_TAC(GEN_ALL YXIONXL3) +THEN MATCH_MP_TAC (GEN_ALL OPP_IS_SCS) +THEN EXISTS_TAC`scs_opp_v39 (scs_stab_diag_v39 scs_5M1 1 4)` +THEN MRESAL_TAC STAB_5M1_SCS[`1`;`4`][scs_diag;K_SCS_5M1;ARITH_RULE`~(1 MOD 5 = 4 MOD 5) /\ + ~(SUC 1 MOD 5 = 4 MOD 5) /\ + ~(1 MOD 5 = SUC 4 MOD 5)`]]);; + +let OTMTOTJ3= prove_by_refinement(`scs_arrow_v39 { scs_5I3 } { scs_stab_diag_v39 scs_5M1 0 2 , scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4, scs_5M2 }`, + +[MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`({ scs_5M2}UNION { scs_stab_diag_v39 scs_5I3 i j| scs_diag 5 i j })` +THEN ASM_SIMP_TAC[SCS_5I3_BERAK_BY_CSTAB;SET_RULE`{A,B,C,D}={D} UNION {A,B,C}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC; + +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[SCS_5M2_IS_SCS]; + +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{scs_stab_diag_v39 scs_5M1 i j | scs_diag 5 i j}` +THEN ASM_REWRITE_TAC[STAB_5I3_ARROW_STAB_5M1_DIAG]; + +ASM_SIMP_TAC[SET_EQ_DIAG_STAB_5M1]]);; + + +let OTMTOTJ4= prove(`scs_arrow_v39 { scs_5M1 } { scs_stab_diag_v39 scs_5M1 0 2 , scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4, scs_5M2 }`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`({ scs_5M2}UNION { scs_stab_diag_v39 scs_5M1 i j| scs_diag 5 i j })` +THEN ASM_SIMP_TAC[SCS_5M1_BERAK_BY_CSTAB;SET_RULE`{A,B,C,D}={D} UNION {A,B,C}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_REWRITE_TAC[SET_EQ_DIAG_STAB_5M1] +THEN MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[SCS_5M2_IS_SCS]);; + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/PCRTTID.hl b/text_formalization/local/PCRTTID.hl new file mode 100644 index 0000000..3322020 --- /dev/null +++ b/text_formalization/local/PCRTTID.hl @@ -0,0 +1,401 @@ + +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + + + +module Pcrttid= struct + + + + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; + + + +let tri_stable=new_definition +`tri_stable k d s a b J f<=> +constraint_system k d s a b J f /\ k=3 +/\ +(!i j. i IN s /\ j IN s /\ ~(i=j) ==> &2<= a(i,j)) /\ +(!i. i IN s==> a(i,i)= &0 /\ b(i,f i)< &4)/\ +(!i j. {i,j} IN J ==> a(i,j)= sqrt(&8) /\ b(i,j) =cstab)`;; + + + +let EAR_TRI_STABLE_SYSTEM=prove_by_refinement( +`tri_stable 3 ((#0.11)) (0..2) (a_ear0 {{1,2}}) (b_ear0 {{1,2}}) ({{1,2}}) (\i. (1 + i) MOD 3)`, +[ +MRESAL_TAC HAS_SIZE_NUMSEG[`0`;`2`][ARITH_RULE`(2+1)-0=3`] +THEN ASM_SIMP_TAC[tri_stable;constraint_system;torsor;ARITH_RULE`3<= 3 /\3<=6/\ 1+3<=6/\ (2+1)-0=3/\ 3=3`;CARD_NUMSEG;Hypermap.CARD_SINGLETON;] +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC; +STRIP_TAC; +STRIP_TAC; +REWRITE_TAC[ARITH_RULE`3-1=2`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN MRESAL1_TAC Hypermap.LE_MOD_SUC`2`[ARITH_RULE`SUC 2=3`]; +STRIP_TAC; +REWRITE_TAC[ARITH_RULE`3-1=2`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL MOD_IMP_EQ)[`3`;`1+x1`;`1+x2`][ARITH_RULE`1<= 1+A /\ (1+A<=3<=> A<=2)`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +STRIP_TAC; +REWRITE_TAC[ARITH_RULE`3-1=2`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`0 1<= i /\ 1<3`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`3:num`;`x:num`;`i:num`] +THEN MP_TAC(ARITH_RULE`0 i=1 \/ i=2`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x<= 2==> x=0 \/ x=1 \/ x=2`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; +REWRITE_TAC[ARITH_RULE`3-1=2`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN ASSUME_TAC(ARITH_RULE`1<=3 /\1<3/\ 1<=2`) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`3:num`;`x:num`;`3:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`3`;`x:num`][ARITH_RULE`1*3=3`] +THEN MP_TAC(ARITH_RULE`x<= 2==> x=0 \/ x=1 \/ x=2`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; +STRIP_TAC; +REWRITE_TAC[b_ear0;a_ear0] +THEN REPEAT GEN_TAC +THEN DISJ_CASES_TAC(SET_RULE`i MOD 3 =j MOD 3 \/ ~(i MOD 3 =j MOD 3:num)`); +ASM_REWRITE_TAC[REAL_ARITH`&0<= &0`]; +ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(SET_RULE`{i MOD 3,j MOD 3} IN {{1,2}} \/ ~({i MOD 3,j MOD 3} IN {{1,2}})`); +ASM_REWRITE_TAC[IN_SING] +THEN ONCE_REWRITE_TAC[SET_RULE`{i MOD 3,j MOD 3} ={1,2} <=> {j MOD 3,i MOD 3}= {1,2}`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_SING;cstab] +THEN RESA_TAC +THEN MATCH_MP_TAC REAL_LE_LSQRT +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[IN_SING] +THEN ONCE_REWRITE_TAC[SET_RULE`{i MOD 3,j MOD 3} ={1,2} <=> {j MOD 3,i MOD 3}= {1,2}`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_SING;h0] +THEN RESA_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC; +REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`1<= 3 /\ 1<3`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`3`;`j:num`][ARITH_RULE`1*3=3`] +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`3:num`;`j:num`;`3:num`] +THEN SIMP_TAC[b_ear0;a_ear0;ARITH_RULE`A+0=A`;MOD_MOD_REFL;ARITH_RULE`~(3=0)`]; +REWRITE_TAC[SUBSET;IN_SING;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`0<=1 /\ 1<=2/\ (1 +1 ) MOD 3= 2`]; +STRIP_TAC; +REWRITE_TAC[a_ear0;IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`i<= 2/\ j<= 2==> i< 3 /\ j< 3`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`3`] +THEN MRESA_TAC MOD_LT[`j:num`;`3`] +THEN DISJ_CASES_TAC(SET_RULE`{i,j} IN {{1,2}} \/ ~({i,j} IN {{1,2}})`); +ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_RSQRT +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; +STRIP_TAC; +REWRITE_TAC[b_ear0;a_ear0;MOD_MOD_REFL] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`i MOD 3 =(1+i) MOD 3 MOD 3\/ ~(i MOD 3 =(1+i) MOD 3 MOD 3:num)`); +ASM_REWRITE_TAC[REAL_ARITH`&0<= &0`;cstab] +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(SET_RULE`{i MOD 3,(1+i) MOD 3 MOD 3} IN {{1,2}} \/ ~({i MOD 3,(1+i) MOD 3 MOD 3} IN {{1,2}})`); +ASM_REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; +REWRITE_TAC[IN_SING;a_ear0;b_ear0] +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`{i,j}={1,2} /\ ~(1=2) ==> ~(i=j) /\ (i =1\/ i=2) /\ (j=1\/ j=2)`) +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=2)`] +THEN DISCH_TAC +THEN MP_TAC(ARITH_RULE`(i =1\/ i=2) /\ (j=1\/ j=2)==> i< 3 /\ j< 3`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`3`] +THEN MRESA_TAC MOD_LT[`j:num`;`3`]]);; + + + + +let exist_tri_stable=prove_by_refinement(`?s:(num#real#(num->bool)#(num#num->real)#(num#num->real)#((num->bool)->bool)#(num->num)). tri_stable (FST s) (FST (SND s)) (FST (SND (SND s))) (FST (SND (SND (SND s)))) (FST(SND (SND (SND (SND s))))) (FST (SND (SND (SND (SND (SND s)))))) +(SND(SND (SND (SND (SND (SND s))))))`, +[EXISTS_TAC`3, (#0.11), (0..2), (a_ear0 {{1,2}}), (b_ear0 {{1,2}}), ({{1,2}}),(\i. (1 + i) MOD 3)` +THEN REWRITE_TAC[EAR_TRI_STABLE_SYSTEM]]);; + + +let tri_sy_tybij = (new_type_definition "tri_sy" ("tri_sy", "tuple_tri_sy")exist_tri_stable);; + + +let k_ts = new_definition `k_ts (s:tri_sy) = FST (tuple_tri_sy s)`;; + +let d_ts = new_definition `d_ts (s:tri_sy) = (FST (SND (tuple_tri_sy s)))`;; + +let I_TS = new_definition `I_TS (s:tri_sy) = (FST (SND (SND (tuple_tri_sy s))))`;; + +let a_ts = new_definition `a_ts (s:tri_sy) = (FST (SND (SND (SND (tuple_tri_sy s)))))`;; + +let b_ts = new_definition `b_ts (s:tri_sy) = (FST(SND (SND (SND (SND (tuple_tri_sy s)))))) `;; + + +let J_TS = new_definition `J_TS (s:tri_sy) = (FST (SND (SND (SND (SND (SND (tuple_tri_sy s))))))) `;; + +let f_ts = new_definition `f_ts (s:tri_sy) = (SND(SND (SND (SND (SND (SND (tuple_tri_sy s)))))))`;; + + + +let tri_sy_lemma=prove(`!s:tri_sy. tri_stable (k_ts s) (d_ts s) (I_TS s) (a_ts s) (b_ts s) (J_TS s) (f_ts s)`, + ASM_REWRITE_TAC[tri_sy_tybij;k_ts;d_ts;I_TS; a_ts; b_ts; J_TS; f_ts]);; + + + + + + +let augmented_constraint_system1=new_definition +`augmented_constraint_system1 (s:stable_sy) I_lo I_str a b m <=> +d_sy s <= # 0.9 +/\ m=CARD {i | i IN I_SY s /\ (?j. j IN I_SY s /\( &2< a_sy s (i,j) \/ &2* h0< b_sy s (i,j)))} DIV 2 +/\ m+k_sy s <= 6 +/\ (!i j. i IN I_SY s /\ j IN I_SY s ==> +a_sy s (i,j)<= a (i,j) +/\ a (i,j)<= b (i,j) +/\ b (i,j)<= b_sy s (i,j))`;; + + + +let augmented_constraint_system2=new_definition +`augmented_constraint_system3 (s:tri_sy) I_lo I_str a b m <=> +d_ts s <= # 0.9 +/\ m=CARD {i | i IN I_TS s /\ (?j. j IN I_TS s /\( &2< a_ts s (i,j) \/ &2* h0< b_ts s (i,j)))} DIV 2 +/\ m+k_ts s <= 6 +/\ (!i j. i IN I_TS s /\ j IN I_TS s ==> +a_ts s (i,j)<= a (i,j) +/\ a (i,j)<= b (i,j) +/\ b (i,j)<= b_ts s (i,j))`;; + + + + +let CLOSED_TRI_SY=prove_by_refinement(` +tri_stable k d (0..k-1) a b J (\i. ((1+i):num MOD k)) /\k= dimindex(:M) +/\ 2 +closed {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY a b v }`, +[REWRITE_TAC[CONDITION2_SY;CONDITION1_SY;tri_stable] +THEN REPEAT GEN_TAC THEN REWRITE_TAC[CLOSED_SEQUENTIAL_LIMITS] THEN REWRITE_TAC[LIM_SEQUENTIALLY; IN_ELIM_THM; dist] +THEN REPEAT STRIP_TAC +THEN ASM_TAC +THEN DISCH_THEN(LABEL_TAC"THYGIANG2") +THEN DISCH_THEN(LABEL_TAC"THYGIANG") +THEN DISCH_THEN(LABEL_TAC"THYGIANG1") +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`vecmats (l:real^(M,3)finite_product)` +THEN SIMP_TAC[MATVEC_VECMATS_ID] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SKOLEM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY1") +THEN DISCH_THEN(LABEL_TAC"THY2") +THEN SUBGOAL_THEN` +!i j. 1 <= i /\ i <= dimindex (:M) /\ 1 <= j /\ j <= dimindex (:M) +==> +((\n. row i (v n) - row j ((v:num->real^3^M) n)) --> row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))) + sequentially`ASSUME_TAC; +SIMP_TAC[EVENTUALLY_SEQUENTIALLY;TRIVIAL_LIMIT_SEQUENTIALLY;LIM_SEQUENTIALLY] +THEN REPEAT STRIP_TAC +THEN SIMP_TAC[dist;VECTOR_ARITH`A-B-(C-D)=(A-C)-(B-D):real^N`] +THEN MP_TAC(REAL_ARITH`&0< e==> &0< e/ &2`) +THEN RESA_TAC +THEN REMOVE_THEN "THY2"(fun th-> MRESA1_TAC th`e/ &2:real`) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY2") +THEN EXISTS_TAC`N:num` +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THY2"(fun th-> MRESA1_TAC th`n:num`) +THEN MP_TAC(ARITH_RULE`1<=i /\ i <= dimindex (:M)==> i -1 < dimindex (:M)/\ SUC(i-1)=i`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`1<=j /\ j <= dimindex (:M)==> j -1 < dimindex (:M)/\ SUC(j-1)=j`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`i-1`;`((v:num->real^3^M) n)`] +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`i-1`;`vecmats (l:real^(M,3)finite_product)`] +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[MATVEC_VECMATS_ID] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL NORM_VECMAT)[`i-1`;`matvec ((v:num->real^3^M) n) - (l:real^(M,3)finite_product)`][VECMAT_SUB] +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`j-1`;`((v:num->real^3^M) n)`] +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`j-1`;`vecmats (l:real^(M,3)finite_product)`] +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[MATVEC_VECMATS_ID] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL NORM_VECMAT)[`j-1`;`matvec ((v:num->real^3^M) n) - (l:real^(M,3)finite_product)`][VECMAT_SUB] +THEN MRESAL_TAC NORM_TRIANGLE[`row i ((v:num->real^3^M) n) - row i (vecmats (l:real^(M,3)finite_product))`;`--(row j ((v:num->real^3^M) n) - row j (vecmats (l:real^(M,3)finite_product)))`][NORM_NEG;VECTOR_ARITH`A+ --B=A-B:real^N` ] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +SUBGOAL_THEN` +!i. 1 <= i /\ i <= dimindex (:M) ==> +((\n. row i ((v:num->real^3^M) n)) --> row i (vecmats (l:real^(M,3)finite_product))) + sequentially`ASSUME_TAC; +SIMP_TAC[EVENTUALLY_SEQUENTIALLY;TRIVIAL_LIMIT_SEQUENTIALLY;LIM_SEQUENTIALLY] +THEN REPEAT STRIP_TAC +THEN SIMP_TAC[dist;VECTOR_ARITH`A-B-(C-D)=(A-C)-(B-D):real^N`] +THEN MP_TAC(REAL_ARITH`&0< e==> &0< e/ &2`) +THEN RESA_TAC +THEN REMOVE_THEN "THY2"(fun th-> MRESA1_TAC th`e:real`) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY2") +THEN EXISTS_TAC`N:num` +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THY2"(fun th-> MRESA1_TAC th`n:num`) +THEN MP_TAC(ARITH_RULE`1<=i /\ i <= dimindex (:M)==> i -1 < dimindex (:M)/\ SUC(i-1)=i`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`1<=j /\ j <= dimindex (:M)==> j -1 < dimindex (:M)/\ SUC(j-1)=j`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`i-1`;`((v:num->real^3^M) n)`] +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`i-1`;`vecmats (l:real^(M,3)finite_product)`] +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[MATVEC_VECMATS_ID] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL NORM_VECMAT)[`i-1`;`matvec ((v:num->real^3^M) n) - (l:real^(M,3)finite_product)`][VECMAT_SUB] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU2") +THEN SUBGOAL_THEN`(!i j. + 1 <= i /\ i <= dimindex (:M) /\ 1 <= j /\ j <= dimindex (:M) + ==> (a:num#num->real) (i,j) <= norm (row i (vecmats l) - row j (vecmats l)) /\ + norm (row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))) <= (b:num#num->real) (i,j))` ASSUME_TAC; +REPEAT STRIP_TAC; +MRESA_TAC LIM_NORM_LBOUND[`sequentially`;`(\n. row i (v n) - row j ((v:num->real^3^M) n))`;`row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))`;`(a:num#num->real)(i,j)`] +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_SIMP_TAC[EVENTUALLY_SEQUENTIALLY;TRIVIAL_LIMIT_SEQUENTIALLY;LIM_SEQUENTIALLY]; +MRESA_TAC LIM_NORM_UBOUND[`sequentially`;`(\n. row i (v n) - row j ((v:num->real^3^M) n))`;`row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))`;`(b:num#num->real)(i,j)`] +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_SIMP_TAC[EVENTUALLY_SEQUENTIALLY;TRIVIAL_LIMIT_SEQUENTIALLY;LIM_SEQUENTIALLY]; +ASM_REWRITE_TAC[] +THEN MP_TAC COMPACT_BALL_ANNULUS +THEN ASM_SIMP_TAC[COMPACT_EQ_BOUNDED_CLOSED] +THEN REWRITE_TAC[CLOSED_SEQUENTIAL_LIMITS] THEN REWRITE_TAC[ IN_ELIM_THM; dist] +THEN REWRITE_TAC[SKOLEM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "YEU" (fun th-> MRESA_TAC th[`(\n. row i ((v:num->real^3^M) n)) `;` row i (vecmats (l:real^(M,3)finite_product))`]) +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_SIMP_TAC[]]);; + + + + + +let BOUNDED_TRI_SY=prove(` +tri_stable k d (0..k-1) a b J (\i. ((1+i):num MOD k)) /\k= dimindex(:M) +/\ 2 +bounded {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY a b v}`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC BOUNDED_SUBSET +THEN EXISTS_TAC`{matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) }` +THEN MP_TAC COMPACT_BALL_ANNULUS_MATVEC +THEN SIMP_TAC[COMPACT_EQ_BOUNDED_CLOSED] +THEN RESA_TAC +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM] +THEN SET_TAC[]);; + +let COMPACT_TRI_STABLE= prove (` +tri_stable k (d:real) (0..k-1) a b J (\i. ((1+i):num MOD k)) /\k= dimindex(:M) +/\ 2 +compact {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY a b v }`, +SIMP_TAC[COMPACT_EQ_BOUNDED_CLOSED; BOUNDED_TRI_SY; CLOSED_TRI_SY;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`2 1bool)->bool`;`k:num`;`a:num#num->real`;`b:num#num->real`;]; +MRESA_TAC (GEN_ALL CLOSED_TRI_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`a:num#num->real`;`b:num#num->real`;]]);; + + + + + + + +let PCRTTID=prove(`(!d J k a b. +tri_stable k (d:real) (0..k-1) a b J (\i. ((1+i):num MOD k)) /\k= dimindex(:M) +/\ 2 +compact {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY a b v }) +/\ (!d J k a b. +stable_system k (d:real) (0..k-1) a b J (\i. ((1+i):num MOD k)) /\k= dimindex(:M) +/\ 2 +compact {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY a b v /\ CONDITION2_SY v })`, +STRIP_TAC +THEN REPEAT GEN_TAC +THEN MESON_TAC[COMPACT_TRI_STABLE;WJSCPRO]);; + + + + + +end;; + + diff --git a/text_formalization/local/PPBTYDQ.hl b/text_formalization/local/PPBTYDQ.hl new file mode 100644 index 0000000..3fbf0d9 --- /dev/null +++ b/text_formalization/local/PPBTYDQ.hl @@ -0,0 +1,614 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Ppbtydq = struct + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +open Yxionxl2;; +open Eyypqdw;; +open Ocbicby;; +open Imjxphr;; + +open Nuxcoea;; +open Fektyiy;; + + + +let PPBTYDQ_concl = `!(u:real^3) v p. ~collinear {vec 0,v,p} /\ ~collinear {vec 0,u,p} /\ + arcV (vec 0) u p + arcV (vec 0) p v < pi ==> ~(vec 0 IN conv{u,v})`;; + + + +let PPBTYDQ= prove_by_refinement((PPBTYDQ_concl), +[REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC `e= u cross (p:real^3)` +THEN SUBGOAL_THEN`orthogonal e (u:real^3)`ASSUME_TAC; + +EXPAND_TAC "e" +THEN REWRITE_TAC[orthogonal;DOT_CROSS_SELF]; + + +SUBGOAL_THEN`orthogonal e (p:real^3)`ASSUME_TAC; + +EXPAND_TAC "e" +THEN REWRITE_TAC[orthogonal;DOT_CROSS_SELF]; + + +REWRITE_TAC[Collect_geom.CONV_SET2;IN_ELIM_THM;VECTOR_ARITH`vec 0 = a % u + b % v<=> b % v = (--a) % u `] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0<=b==> b= &0\/ &0< b`) +THEN RESA_TAC; + + +REWRITE_TAC[VECTOR_ARITH`&0 % v = --a % u<=> a % u= vec 0`;VECTOR_MUL_EQ_0;REAL_ARITH`a + &0= &1<=> a= &1`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`~(&1= &0)`] +THEN MRESA_TAC th3[`vec 0:real^3`;`u`;`p`]; + + +MP_TAC(REAL_ARITH`&0<=a==> a= &0\/ &0< a`) +THEN RESA_TAC; + + +REWRITE_TAC[VECTOR_ARITH`b % v = -- &0 % u<=> b % v= vec 0`;VECTOR_MUL_EQ_0;REAL_ARITH` &0+a= &1<=> a= &1`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[REAL_ARITH`~(&1= &0)`] +THEN MRESA_TAC th3[`vec 0:real^3`;`v`;`p`]; + +REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`b % v = --a % u +==> (inv b) %b % v = (inv b) % --a % u:real^3`) +THEN REWRITE_TAC[VECTOR_ARITH`a%b%c=(a*b)%c`] +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`&0< b==> ~(b= &0)`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[REAL_MUL_LINV;VECTOR_ARITH`&1 %v= v`] +THEN SUBGOAL_THEN`(inv b * --a)< &0` ASSUME_TAC; + +MATCH_MP_TAC(REAL_ARITH`&0<(inv b *a)==> (inv b * --a)< &0`) +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_INV +THEN ASM_REWRITE_TAC[]; + +ABBREV_TAC `v'=(inv b * --a)` +THEN STRIP_TAC +THEN DICH_TAC (15-5) +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC th3[`vec 0:real^3`;`u`;`p`]; + + + + +MRESA_TAC Local_lemmas1.ARCV_PI_OPPOSITE[`v'`;`u`;`vec 0:real^3`] +THEN POP_ASSUM MP_TAC +THEN REDUCE_VECTOR_TAC +THEN STRIP_TAC +THEN SYM_ASSUM_TAC +THEN REWRITE_TAC[REAL_ARITH`~(a b<=a`] +THEN MATCH_MP_TAC Trigonometry.KEITDWB +THEN MRESAL_TAC th3[`vec 0:real^3`;`v`;`p`][VECTOR_ARITH`&0 % a= vec 0`]]);; + + +let OIQKKEP_concl = `!u v c. + u IN ball_annulus /\ v IN ball_annulus /\ c < &4 /\ dist(u,v) <= c /\ &2<= dist(u,v)==> + arcV (vec 0) u v <= arclength (&2) (&2) c`;; + + +let OIQKKEP = prove_by_refinement( + OIQKKEP_concl, +[ +REWRITE_TAC[Ckqowsa_3_points.in_ball_annulus;dist] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC Trigonometry1.arcVarc[`vec 0:real^3`;`u`;`v`][dist;VECTOR_ARITH`vec 0- A= --A`; NORM_NEG] +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`u`;`vec 0:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`v`;`vec 0:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN MRESAL_TAC NORM_TRIANGLE[`u:real^3`;`-- v:real^3`][VECTOR_ARITH`a+ --b=a-b:real^3`;NORM_NEG] +THEN MRESAL_TAC NORM_TRIANGLE[`v:real^3`;`u- v:real^3`][VECTOR_ARITH`a+ b-a=b:real^3`;NORM_NEG] +THEN MRESAL_TAC NORM_TRIANGLE[`u-v:real^3`;`-- u:real^3`][VECTOR_ARITH`a- b+ --a= --b:real^3`;NORM_NEG] +THEN MRESAL_TAC Trigonometry1.ACS_ARCLENGTH[`norm (u)`;`norm v`;`norm(u-v)`] +[NORM_POS_LE] +THEN MP_TAC(REAL_ARITH`norm (u - v:real^3) <= c /\ c< &4 /\ &0<= norm (u - v) +==> &0 <= c /\ c <= &2 + &2 /\ &2 <= &2 + c /\ &2 <= c + &2 /\ c<= &4`) +THEN ASM_REWRITE_TAC[NORM_POS_LE] +THEN RESA_TAC +THEN MRESAL_TAC Trigonometry1.ACS_ARCLENGTH[`&2`;`&2`;`c:real`] +[NORM_POS_LE;REAL_ARITH`&0< &2`] +THEN MATCH_MP_TAC ACS_MONO_LE +THEN STRIP_TAC; + + +REWRITE_TAC[REAL_ARITH`-- &1 <= (&2 * &2 + &2 * &2 - c * c) / (&2 * &2 * &2) +<=> c*c<= &4* &4`] +THEN MATCH_MP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE +THEN MRESA_TAC REAL_ABS_REFL[`c`]; + +STRIP_TAC; + +MRESAL_TAC Imjxphr.xrr_increasing_le[`&2`;`&2`;`norm(u-v)`;`c`][NORM_POS_LE;REAL_ARITH`&0< &2`] +THEN MRESAL_TAC Ocbicby.xrr_decreasing[`&2`;`norm u`;`&2`;`norm(u-v)`] +[NORM_POS_LE;REAL_ARITH`&2<= &2/\ &2 <= &2 * #1.26`;h0] +THEN MRESAL_TAC Ocbicby.xrr_decreasing[`&2`;`norm v`;`norm u`;`norm(u-v)`] +[NORM_POS_LE;REAL_ARITH`&2<= &2/\ &2 <= &2 * #1.26`;h0;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[Ocbicby.xrr_sym] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`xrr (&2) (&2) (norm (u - v)) <= xrr (&2) (&2) c +/\ xrr (norm u) (&2) (norm (u - v)) <= xrr (&2) (&2) (norm (u - v)) +/\ xrr (norm u) (norm v) (norm (u - v)) <= xrr (norm u) (&2) (norm (u - v:real^3)) +==> xrr (norm u) (norm v) (norm (u - v))<= xrr (&2) (&2) c`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[xrr] +THEN REAL_ARITH_TAC; + +MRESAL_TAC Trigonometry1.TRI_SQUARES_BOUNDS[`norm u`;`norm v`;`norm(u-v)`] +[NORM_POS_LE]]);; + + + + + +let MXQTIED_concl = `!s s' v. + is_scs_v39 s /\ is_scs_v39 s' /\ scs_basic_v39 s /\ scs_basic_v39 s' /\ + scs_M s = scs_M s' /\ scs_k_v39 s = scs_k_v39 s' /\ + scs_d_v39 s'= scs_d_v39 s /\ + v IN MMs_v39 s /\ v IN BBs_v39 s' /\ + (!i. scs_a_v39 s' i (SUC i) = scs_a_v39 s i (SUC i)) +/\ (!i j. scs_a_v39 s i j<= scs_a_v39 s' i j/\ scs_b_v39 s' i j<= scs_b_v39 s i j) ==> + v IN MMs_v39 s'`;; + + +let MXQTIED_PRIME2_concl = ` + is_scs_v39 s /\ is_scs_v39 s' /\ scs_basic_v39 s /\ scs_basic_v39 s' /\ + scs_M s = scs_M s' /\ scs_k_v39 s = scs_k_v39 s' /\ + scs_d_v39 s'= scs_d_v39 s /\ + v IN MMs_v39 s /\ v IN BBs_v39 s' /\ + (!i. scs_a_v39 s' i (SUC i) = scs_a_v39 s i (SUC i)) +/\ (!i j. scs_a_v39 s i j<= scs_a_v39 s' i j/\ scs_b_v39 s' i j<= scs_b_v39 s i j) ==> + BBprime2_v39 s' v`;; + + + +let MXQTIED_PRIME_concl = ` + is_scs_v39 s /\ is_scs_v39 s' /\ scs_basic_v39 s /\ scs_basic_v39 s' /\ + scs_M s = scs_M s' /\ scs_k_v39 s = scs_k_v39 s' /\ + scs_d_v39 s'= scs_d_v39 s /\ + v IN BBprime_v39 s /\ v IN BBs_v39 s' /\ + (!i. scs_a_v39 s' i (SUC i) = scs_a_v39 s i (SUC i)) +/\ (!i j. scs_a_v39 s i j<= scs_a_v39 s' i j/\ scs_b_v39 s' i j<= scs_b_v39 s i j) ==> + BBprime_v39 s' v`;; + + + + + +let MXQTIED_TAU_concl = ` + is_scs_v39 s /\ is_scs_v39 s' /\ scs_basic_v39 s /\ scs_basic_v39 s' /\ + scs_M s = scs_M s' /\ scs_k_v39 s = scs_k_v39 s' /\ + scs_d_v39 s'= scs_d_v39 s /\ + (!i. scs_a_v39 s' i (SUC i) = scs_a_v39 s i (SUC i)) ==> + taustar_v39 s' v= taustar_v39 s v`;; + + +let MXQTIED_TAU_DSV_concl = ` + is_scs_v39 s /\ is_scs_v39 s' /\ scs_basic_v39 s /\ scs_basic_v39 s' /\ + scs_M s = scs_M s' /\ scs_k_v39 s = scs_k_v39 s' /\ + scs_d_v39 s'= scs_d_v39 s /\ + (!i. scs_a_v39 s' i (SUC i) = scs_a_v39 s i (SUC i)) +==> + dsv_v39 s' v= dsv_v39 s v`;; + + +let MXQTIED_BB_concl = `!s s' v. + is_scs_v39 s /\ is_scs_v39 s' /\ scs_basic_v39 s /\ scs_basic_v39 s' /\ + scs_M s = scs_M s' /\ scs_k_v39 s = scs_k_v39 s' /\ + scs_d_v39 s'= scs_d_v39 s /\ + v IN BBs_v39 s' /\ + (!i. scs_a_v39 s' i (SUC i) = scs_a_v39 s i (SUC i)) +/\ (!i j. scs_a_v39 s i j<= scs_a_v39 s' i j/\ scs_b_v39 s' i j<= scs_b_v39 s i j) ==> + BBs_v39 s v`;; + + + + + + + +let MXQTIED_INDEX_concl = ` + is_scs_v39 s /\ is_scs_v39 s' /\ scs_basic_v39 s /\ scs_basic_v39 s' /\ + scs_M s = scs_M s' /\ scs_k_v39 s = scs_k_v39 s' /\ + scs_d_v39 s'= scs_d_v39 s /\ + v IN BBs_v39 s' /\ + (!i. scs_a_v39 s' i (SUC i) = scs_a_v39 s i (SUC i)) +/\ (!i j. scs_a_v39 s i j<= scs_a_v39 s' i j/\ scs_b_v39 s' i j<= scs_b_v39 s i j) ==> + BBindex_v39 s' v= BBindex_v39 s v`;; + + + +let MXQTIED_INDEX=prove( MXQTIED_INDEX_concl, +REWRITE_TAC[IN;BBindex_v39] +THEN REPEAT RESA_TAC);; + + + + + + +let MXQTIED_BB=prove_by_refinement( MXQTIED_BB_concl, +[REWRITE_TAC[IN;scs_basic] +THEN REPEAT STRIP_TAC +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;taustar_v39;dsv_v39;SET_RULE`{i| F}={}`;SUM_CLAUSES;REAL_ARITH`a* &0= &0`] +THEN REPEAT RESA_TAC; + +THAYTHE_TAC 1[`i`;`j:num`] +THEN THAYTHE_TAC (15-10)[`i`;`j`] +THEN DICH_TAC 1 +THEN DICH_TAC 2 +THEN REAL_ARITH_TAC; + +THAYTHE_TAC 1[`i`;`j:num`] +THEN THAYTHE_TAC (15-10)[`i`;`j`] +THEN DICH_TAC 0 +THEN DICH_TAC 1 +THEN REAL_ARITH_TAC; + +THAYTHE_TAC 1[`i`;`j:num`] +THEN THAYTHE_TAC (15-10)[`i`;`j`] +THEN DICH_TAC 1 +THEN DICH_TAC 2 +THEN REAL_ARITH_TAC; + +THAYTHE_TAC 1[`i`;`j:num`] +THEN THAYTHE_TAC (15-10)[`i`;`j`] +THEN DICH_TAC 0 +THEN DICH_TAC 1 +THEN REAL_ARITH_TAC]);; + + + +let MXQTIED_TAU_DSV =prove(MXQTIED_TAU_DSV_concl, +REWRITE_TAC[IN;scs_basic] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;taustar_v39;dsv_v39;SET_RULE`{i| F}={}`;SUM_CLAUSES;REAL_ARITH`a* &0= &0`] +THEN REPEAT STRIP_TAC);; + + + +let MXQTIED_TAU =prove(MXQTIED_TAU_concl, +REWRITE_TAC[IN;scs_basic] +THEN REPEAT STRIP_TAC +THEN MP_TAC MXQTIED_TAU_DSV +THEN REWRITE_TAC[IN;scs_basic] +THEN RESA_TAC THEN ASM_REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;taustar_v39;] +THEN REPEAT STRIP_TAC);; + + + + +let MXQTIED_PRIME=prove_by_refinement( + MXQTIED_PRIME_concl, +[ +REWRITE_TAC[IN;scs_basic] +THEN REPEAT STRIP_TAC +THEN MP_TAC MXQTIED_TAU_DSV +THEN REWRITE_TAC[IN;scs_basic] +THEN RESA_TAC THEN ASM_REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;] +THEN REPEAT STRIP_TAC; + +MP_TAC MXQTIED_TAU +THEN REWRITE_TAC[IN;scs_basic] +THEN RESA_TAC +THEN MRESAL_TAC MXQTIED_TAU[`s'`;`s`;`ww`][IN;scs_basic] +THEN DICH_TAC (16-9) +THEN ASM_REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;] +THEN REPEAT RESA_TAC +THEN MATCH_DICH_TAC (18-17) +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC MXQTIED_BB +THEN ASM_REWRITE_TAC[IN;scs_basic] +THEN EXISTS_TAC`s':scs_v39` +THEN ASM_REWRITE_TAC[]; + +MP_TAC MXQTIED_TAU +THEN REWRITE_TAC[IN;scs_basic] +THEN RESA_TAC +THEN DICH_TAC (14-9) +THEN ASM_REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39;] +THEN REPEAT RESA_TAC]);; + + + +let BBPRIME_IMP_BB=prove(`BBprime_v39 s' w ==> BBs_v39 s' w`, +ASM_REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime_v39;] +THEN RESA_TAC);; + + + +let MXQTIED_PRIME2=prove_by_refinement( MXQTIED_PRIME2_concl, +[ +REWRITE_TAC[IN;scs_basic] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC(GEN_ALL Nuxcoea.MMS_IMP_BBPRIME)[`s`;`v`] +THEN MP_TAC MXQTIED_PRIME +THEN REWRITE_TAC[IN;scs_basic] +THEN RESA_TAC THEN ASM_REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;] +THEN REPEAT STRIP_TAC +THEN MP_TAC MXQTIED_INDEX +THEN REWRITE_TAC[IN;scs_basic] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`(?w. BBprime_v39 (s':scs_v39) w /\ BBindex_v39 s w< BBindex_v39 s v) \/ ~(?w. BBprime_v39 s' w /\ BBindex_v39 s w< BBindex_v39 s v)`) +THEN RESA_TAC; + +MP_TAC BBPRIME_IMP_BB +THEN RESA_TAC +THEN MRESAL_TAC MXQTIED_BB[`s`;`s'`;`w`][scs_basic;IN] +THEN DICH_TAC (19-9) +THEN ASM_REWRITE_TAC[MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;] +THEN RESA_TAC +THEN DICH_TAC(24-19) +THEN REWRITE_TAC[BBindex_min_v39] +THEN SUBGOAL_THEN`BBprime_v39 s (w:num->real^3)`ASSUME_TAC; + +ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;BBprime_v39;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MXQTIED_TAU[`s'`;`s`;`w`][scs_basic;IN] +THEN MRESAL_TAC MXQTIED_TAU[`s'`;`s`;`ww:num->real^3`][scs_basic;IN] +THEN SYM_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN DICH_TAC (28-19) +THEN STRIP_TAC; + +THAYTHE_TAC 0[`v`] +THEN THAYTHE_TAC (28-13)[`ww`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC MXQTIED_TAU[`s'`;`s`;`v`][scs_basic;IN] +THEN MRESAL_TAC MXQTIED_TAU[`s'`;`s`;`ww`][scs_basic;IN] +THEN REAL_ARITH_TAC; + +MRESAL_TAC MXQTIED_TAU[`s'`;`s`;`w`][scs_basic;IN]; + +SUBGOAL_THEN`BBindex_v39 s w IN IMAGE (BBindex_v39 s) (BBprime_v39 s)`ASSUME_TAC; + +REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN REWRITE_TAC[IN] +THEN EXISTS_TAC`w:num->real^3` +THEN ASM_REWRITE_TAC[]; + +MRESA_TAC Nuxcoea.MIN_LEAST[`(IMAGE (BBindex_v39 s) (BBprime_v39 s))`;`BBindex_v39 s w`] +THEN STRIP_TAC +THEN DICH_TAC(28-16) +THEN DICH_TAC 1 +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_EXISTS_THM;BBindex_min_v39] +THEN STRIP_TAC +THEN SUBGOAL_THEN`BBindex_v39 s v IN IMAGE (BBindex_v39 s') (BBprime_v39 s')`ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN REWRITE_TAC[IN] +THEN EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[]; + +MRESA_TAC Nuxcoea.MIN_LEAST[`(IMAGE (BBindex_v39 s') (BBprime_v39 s'))`;`BBindex_v39 s v`] +THEN MP_TAC(ARITH_RULE`min_num (IMAGE (BBindex_v39 s') (BBprime_v39 s')) <= BBindex_v39 s v +==> min_num (IMAGE (BBindex_v39 s') (BBprime_v39 s')) < BBindex_v39 s v +\/ min_num (IMAGE (BBindex_v39 s') (BBprime_v39 s')) = BBindex_v39 s v`) +THEN RESA_TAC; + +DICH_TAC 2 +THEN REWRITE_TAC[GSYM BBindex_min_v39] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN REWRITE_TAC[IN] +THEN RESA_TAC +THEN THAYTHE_TAC(21-16)[`x`] +THEN POP_ASSUM MP_TAC +THEN DICH_TAC 2 +THEN ASM_REWRITE_TAC[GSYM BBindex_min_v39] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC BBPRIME_IMP_BB[`s'`;`x`] +THEN MRESAL_TAC MXQTIED_INDEX[`s'`;`s`;`x`][IN;scs_basic] +THEN RESA_TAC]);; + + + + + +let MXQTIED=prove(MXQTIED_concl, +REWRITE_TAC[IN;scs_basic;] +THEN REPEAT STRIP_TAC +THEN MP_TAC MXQTIED_PRIME2 +THEN REWRITE_TAC[IN;scs_basic;] +THEN RESA_TAC +THEN MRESA_TAC Ayqjtmd.unadorned_MMs[`s'`]);; + + + + + + + +let SCS_BASIC_DSV=prove(` is_scs_v39 s /\ is_scs_v39 s' /\ scs_basic_v39 s /\ scs_basic_v39 s' /\ + scs_k_v39 s = scs_k_v39 s' /\ scs_d_v39 s<= scs_d_v39 s' ==> +dsv_v39 s v <= dsv_v39 s' v`, +REWRITE_TAC[taustar_v39;LET_DEF;LET_END_DEF;IN;dsv_v39;scs_basic;SET_RULE`{i| F}={}`;SUM_CLAUSES;REAL_ARITH`a* &0= &0`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{i| F}={}`;SUM_CLAUSES;REAL_ARITH`a* &0= &0/\ a+ &0=a`]);; + + + + + + + +let SCS_BASIC_TAUSTAR=prove(` is_scs_v39 s /\ is_scs_v39 s' /\ scs_basic_v39 s /\ scs_basic_v39 s' /\ + scs_k_v39 s = scs_k_v39 s' +/\ scs_d_v39 s<= scs_d_v39 s' +==> taustar_v39 s' v <= taustar_v39 s v`, +STRIP_TAC +THEN MP_TAC SCS_BASIC_DSV +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[taustar_v39;LET_DEF;LET_END_DEF] +THEN MP_TAC(SET_RULE`scs_k_v39 s' <= 3 \/ ~(scs_k_v39 s' <= 3)`) +THEN RESA_TAC +THEN REAL_ARITH_TAC);; + + +let TAUSTAR_LE_0_XWNHLMD=prove(` is_scs_v39 s /\ is_scs_v39 s' /\ scs_basic_v39 s /\ scs_basic_v39 s' /\ + scs_k_v39 s = scs_k_v39 s' /\ + v IN MMs_v39 s /\ v IN BBs_v39 s' /\ scs_d_v39 s<= scs_d_v39 s' + ==> taustar_v39 s' v< &0`, +REWRITE_TAC[IN;LET_DEF;LET_END_DEF;MMs_v39;BBprime2_v39;BBprime_v39] +THEN STRIP_TAC +THEN MP_TAC SCS_BASIC_TAUSTAR +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DICH_TAC(15-7) +THEN REAL_ARITH_TAC);; + + + + + + +let XWNHLMD_MM=prove(` is_scs_v39 s /\ is_scs_v39 s' /\ scs_basic_v39 s /\ scs_basic_v39 s' /\ + scs_k_v39 s = scs_k_v39 s' /\ + v IN MMs_v39 s /\ v IN BBs_v39 s' /\ scs_d_v39 s<= scs_d_v39 s' +==> ~(MMs_v39 s' ={})`, +STRIP_TAC +THEN MP_TAC TAUSTAR_LE_0_XWNHLMD +THEN RESA_TAC +THEN MATCH_MP_TAC SGTRNAF +THEN EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[scs_basic] +THEN REPEAT RESA_TAC);; + +let XWNHLMD_concl = `!s s' v. + is_scs_v39 s /\ is_scs_v39 s' /\ scs_basic_v39 s /\ scs_basic_v39 s' /\ + scs_k_v39 s = scs_k_v39 s' /\ scs_d_v39 s<= scs_d_v39 s' /\ + v IN MMs_v39 s /\ v IN BBs_v39 s' ==> + scs_arrow_v39 {s} {s'}`;; + + + + +let XWNHLMD=prove_by_refinement(XWNHLMD_concl, +[REPEAT GEN_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;IN] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +DISJ_CASES_TAC(SET_RULE`(!s'. s' = s ==> MMs_v39 s' = {}) \/ ~((!s'. s' = s ==> MMs_v39 s' = {}))`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`s':scs_v39` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC XWNHLMD_MM +THEN ASM_REWRITE_TAC[IN]]);; + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/PQCSXWG.hl b/text_formalization/local/PQCSXWG.hl new file mode 100644 index 0000000..7ed7644 --- /dev/null +++ b/text_formalization/local/PQCSXWG.hl @@ -0,0 +1,320 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Section: Appendix *) +(* Chapter: Local Fan *) +(* Author: John Harrison *) +(* Date: 2013-07-12 *) +(* ========================================================================== *) + +module Pqcsxwg = struct + +(* open Xbjrphc;; *) +(* ------------------------------------------------------------------------- *) +(* Suite of continuity properties for sqrt. *) +(* ------------------------------------------------------------------------- *) + +let CONTINUOUS_WITHIN_SQRT_COMPOSE = prove + (`!f s a:real^N. + (\x. lift(f x)) continuous (at a within s) /\ + (&0 < f a \/ !x. x IN s ==> &0 <= f x) + ==> (\x. lift(sqrt(f x))) continuous (at a within s)`, + REPEAT GEN_TAC THEN + SUBGOAL_THEN + `(\x:real^N. lift(sqrt(f x))) = (lift o sqrt o drop) o (lift o f)` + SUBST1_TAC THENL [REWRITE_TAC[o_DEF; LIFT_DROP]; ALL_TAC] THEN + REPEAT STRIP_TAC THEN + (MATCH_MP_TAC CONTINUOUS_WITHIN_COMPOSE THEN + CONJ_TAC THENL [ASM_REWRITE_TAC[o_DEF]; ALL_TAC]) + THENL + [MATCH_MP_TAC CONTINUOUS_AT_WITHIN THEN + MATCH_MP_TAC CONTINUOUS_AT_SQRT THEN ASM_REWRITE_TAC[o_DEF; LIFT_DROP]; + MATCH_MP_TAC CONTINUOUS_WITHIN_LIFT_SQRT THEN + ASM_REWRITE_TAC[FORALL_IN_IMAGE; o_DEF; LIFT_DROP]]);; + +let CONTINUOUS_AT_SQRT_COMPOSE = prove + (`!f a:real^N. + (\x. lift(f x)) continuous (at a) /\ (&0 < f a \/ !x. &0 <= f x) + ==> (\x. lift(sqrt(f x))) continuous (at a)`, + REPEAT GEN_TAC THEN + MP_TAC(ISPECL [`f:real^N->real`; `(:real^N)`; `a:real^N`] + CONTINUOUS_WITHIN_SQRT_COMPOSE) THEN + REWRITE_TAC[WITHIN_UNIV; IN_UNIV]);; + +let REAL_CONTINUOUS_WITHIN_SQRT_COMPOSE = prove + (`!f s a:real^N. + f real_continuous (at a within s) /\ + (&0 < f a \/ !x. x IN s ==> &0 <= f x) + ==> (\x. sqrt(f x)) real_continuous (at a within s)`, + REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1; o_DEF] THEN + REWRITE_TAC[CONTINUOUS_WITHIN_SQRT_COMPOSE]);; + +let REAL_CONTINUOUS_AT_SQRT_COMPOSE = prove + (`!f a:real^N. + f real_continuous (at a) /\ + (&0 < f a \/ !x. &0 <= f x) + ==> (\x. sqrt(f x)) real_continuous (at a)`, + REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1; o_DEF] THEN + REWRITE_TAC[CONTINUOUS_AT_SQRT_COMPOSE]);; + +let CONTINUOUS_WITHINREAL_SQRT_COMPOSE = prove + (`!f s a. (\x. lift(f x)) continuous (atreal a within s) /\ + (&0 < f a \/ !x. x IN s ==> &0 <= f x) + ==> (\x. lift(sqrt(f x))) continuous (atreal a within s)`, + REWRITE_TAC[(* Xbjrphc. *)CONTINUOUS_CONTINUOUS_WITHINREAL] THEN + REWRITE_TAC[o_DEF] THEN REPEAT GEN_TAC THEN DISCH_TAC THEN + MATCH_MP_TAC CONTINUOUS_WITHIN_SQRT_COMPOSE THEN + ASM_REWRITE_TAC[FORALL_IN_IMAGE; LIFT_DROP]);; + +let CONTINUOUS_ATREAL_SQRT_COMPOSE = prove + (`!f a. (\x. lift(f x)) continuous (atreal a) /\ (&0 < f a \/ !x. &0 <= f x) + ==> (\x. lift(sqrt(f x))) continuous (atreal a)`, + REPEAT GEN_TAC THEN + MP_TAC(ISPECL [`f:real->real`; `(:real)`; `a:real`] + CONTINUOUS_WITHINREAL_SQRT_COMPOSE) THEN + REWRITE_TAC[WITHINREAL_UNIV; IN_UNIV]);; + +let REAL_CONTINUOUS_WITHINREAL_SQRT_COMPOSE = prove + (`!f s a. f real_continuous (atreal a within s) /\ + (&0 < f a \/ !x. x IN s ==> &0 <= f x) + ==> (\x. sqrt(f x)) real_continuous (atreal a within s)`, + REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1; o_DEF] THEN + REWRITE_TAC[CONTINUOUS_WITHINREAL_SQRT_COMPOSE]);; + +let REAL_CONTINUOUS_ATREAL_SQRT_COMPOSE = prove + (`!f a. f real_continuous (atreal a) /\ + (&0 < f a \/ !x. &0 <= f x) + ==> (\x. sqrt(f x)) real_continuous (atreal a)`, + REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1; o_DEF] THEN + REWRITE_TAC[CONTINUOUS_ATREAL_SQRT_COMPOSE]);; + +(* ------------------------------------------------------------------------- *) +(* Flyspeck definition of mk_simplex (corrected). *) +(* ------------------------------------------------------------------------- *) + +let mk_simplex1 = new_definition `mk_simplex1 v0 v1 v2 x1 x2 x3 x4 x5 x6 = + (let uinv = &1 / ups_x x1 x2 x6 in + let d = delta_x x1 x2 x3 x4 x5 x6 in + let d5 = delta_x5 x1 x2 x3 x4 x5 x6 in + let d4 = delta_x4 x1 x2 x3 x4 x5 x6 in + let vcross = (v1 - v0) cross (v2 - v0) in + v0 + uinv % ((&2 * sqrt d) % vcross + d5 % (v1 - v0) + d4 % (v2 - v0)))`;; + +let MK_SIMPLEX_TRANSLATION = prove + (`!a v0 v1 v2 x1 x2 x3 x4 x5 x6. + mk_simplex1 (a + v0) (a + v1) (a + v2) x1 x2 x3 x4 x5 x6 = + a + mk_simplex1 v0 v1 v2 x1 x2 x3 x4 x5 x6`, + REPEAT GEN_TAC THEN REWRITE_TAC[mk_simplex1] THEN + CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN + REWRITE_TAC[VECTOR_ARITH `(a + x) - (a + y):real^N = x - y`] THEN + REWRITE_TAC[GSYM VECTOR_ADD_ASSOC]);; + +add_translation_invariants [MK_SIMPLEX_TRANSLATION];; + +(* ------------------------------------------------------------------------- *) +(* The first part of PQCSXWG. *) +(* ------------------------------------------------------------------------- *) + +let PQCSXWG1_concl = `!v0 v1 v2 v3 x1 x2 x3 x4 x5 x6. + &0 < x1 /\ &0 < x2 /\ &0 < x3 /\ &0 < x4 /\ &0 < x5 /\ &0 < x6 /\ + ~collinear {v0,v1,v2} /\ + x1 = dist(v1,v0) pow 2 /\ + x2 = dist(v2,v0) pow 2 /\ + x6 = dist(v1,v2) pow 2 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 /\ + v3 = mk_simplex1 v0 v1 v2 x1 x2 x3 x4 x5 x6 ==> + (x3 = dist(v3,v0) pow 2 /\ + x5 = dist(v3,v1) pow 2 /\ + x4 = dist(v3,v2) pow 2 /\ + (v1 - v0) dot ((v2 - v0) cross (v3 - v0)) > &0)`;; + +let PQCSXWG1 = prove + (PQCSXWG1_concl, + GEOM_ORIGIN_TAC `v0:real^3` THEN REPEAT GEN_TAC THEN + REWRITE_TAC[mk_simplex1; VECTOR_SUB_RZERO; VECTOR_ADD_LID] THEN + REPEAT LET_TAC THEN REWRITE_TAC[CONJ_ASSOC] THEN + DISCH_THEN(CONJUNCTS_THEN2 MP_TAC SUBST1_TAC) THEN + REWRITE_TAC[GSYM CONJ_ASSOC] THEN + DISCH_THEN(STRIP_ASSUME_TAC o GSYM) THEN + REWRITE_TAC[dist; VECTOR_SUB_RZERO] THEN + REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC] THEN + REWRITE_TAC[CROSS_RADD; CROSS_RMUL; + VECTOR_ARITH `(a + x % b + c) - b:real^N = a + (x - &1) % b + c`; + VECTOR_ARITH `(a + b + x % c) - c:real^N = a + b + (x - &1) % c`] THEN + SUBGOAL_THEN + `!a b c. norm(a % vcross + b % v1 + c % v2:real^3) pow 2 = + norm(a % vcross) pow 2 + norm(b % v1 + c % v2) pow 2` + (fun th -> REWRITE_TAC[th]) + THENL + [REPEAT GEN_TAC THEN MATCH_MP_TAC NORM_ADD_PYTHAGOREAN THEN + EXPAND_TAC "vcross" THEN REWRITE_TAC[orthogonal] THEN VEC3_TAC; + ALL_TAC] THEN + REWRITE_TAC[CROSS_REFL; VECTOR_MUL_RZERO; VECTOR_ADD_RID; real_gt] THEN + REWRITE_TAC[DOT_RADD; DOT_RMUL; DOT_CROSS_SELF] THEN + REWRITE_TAC[REAL_MUL_RZERO; REAL_ADD_RID] THEN + REWRITE_TAC[VEC3_RULE `v1 dot (v2 cross v) = (v1 cross v2) dot v`] THEN + SUBGOAL_THEN `~(vcross:real^3 = vec 0)` ASSUME_TAC THENL + [EXPAND_TAC "vcross" THEN REWRITE_TAC[CROSS_EQ_0] THEN ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[GSYM NORM_POW_2; NORM_POS_LT; REAL_POW_LT; REAL_LT_MUL_EQ; + REAL_ARITH `&0 < x * &2 * y <=> &0 < x * y`; SQRT_POS_LT]] THEN + SUBGOAL_THEN `&0 < ups_x x1 x2 x6` ASSUME_TAC THENL + [FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I + [Collect_geom2.NOT_COL_EQ_UPS_X_POS]) THEN + MAP_EVERY EXPAND_TAC ["x1"; "x2"; "x6"] THEN REWRITE_TAC[DIST_SYM]; + EXPAND_TAC "uinv" THEN + ASM_SIMP_TAC[REAL_LT_DIV; REAL_OF_NUM_LT; ARITH]] THEN + REWRITE_TAC[NORM_MUL; REAL_POW_MUL; REAL_POW2_ABS] THEN + ASM_SIMP_TAC[SQRT_POW_2; REAL_LT_IMP_LE] THEN + REWRITE_TAC[REAL_ARITH `x * &2 pow 2 * y = &4 * x * y`] THEN + REWRITE_TAC[NORM_POW_2; VECTOR_ARITH + `(a + b) dot (a + b:real^3) = a dot a + b dot b + &2 * a dot b`] THEN + REWRITE_TAC[DOT_LMUL] THEN REWRITE_TAC[DOT_RMUL] THEN + ONCE_REWRITE_TAC[REAL_ARITH + `x3:real = a + b /\ x5 = a + c /\ x4 = a + d <=> + x3 = a + b /\ x3 - x5 = b - c /\ x3 - x4 = b - d`] THEN + REWRITE_TAC[REAL_ARITH + `(b * b * x + c * c * y + &2 * b * c * z) - + ((b - &1) * (b - &1) * x + c * c * y + &2 * (b - &1) * c * z) = + (&2 * b - &1) * x + &2 * c * z /\ + (b * b * x + c * c * y + &2 * b * c * z) - + (b * b * x + (c - &1) * (c - &1) * y + &2 * b * (c - &1) * z) = + (&2 * c - &1) * y + &2 * b * z`] THEN + RULE_ASSUM_TAC(REWRITE_RULE[DIST_0]) THEN + ASM_REWRITE_TAC[GSYM NORM_POW_2; REAL_ARITH + `x = (&2 * b - &1) * y + &2 * c * z <=> + b * y + c * z = (y + x) / &2`] THEN + EXPAND_TAC "vcross" THEN REWRITE_TAC[NORM_POW_2; DOT_CROSS] THEN + ASM_REWRITE_TAC[GSYM NORM_POW_2] THEN + SUBST1_TAC(VECTOR_ARITH `(v2:real^3) dot v1 = v1 dot v2`) THEN + REWRITE_TAC[GSYM REAL_POW_2] THEN + SUBGOAL_THEN `(v1:real^3) dot v2 = ((x1 + x2) - x6) / &2` SUBST1_TAC THENL + [MAP_EVERY EXPAND_TAC ["x1"; "x2"; "x6"] THEN + REWRITE_TAC[dist; NORM_POW_2; DOT_RSUB; DOT_LSUB] THEN + REWRITE_TAC[DOT_SYM] THEN REAL_ARITH_TAC; + ALL_TAC] THEN + REWRITE_TAC[REAL_ARITH + `(&4 * u pow 2 * d) * x + (u * e) * (u * e) * y + (u * f) * (u * f) * z + + &2 * (u * e) * (u * f) * j = + u pow 2 * (&4 * d * x + e pow 2 * y + f pow 2 * z + &2 * e * f * j)`] THEN + REWRITE_TAC[REAL_ARITH + `(u * d) * x + (u * e) * y:real = z <=> u * (d * x + e * y) = z`] THEN + EXPAND_TAC "uinv" THEN MATCH_MP_TAC(REAL_FIELD + `&0 < u /\ + u pow 2 * x = y /\ u * a = b /\ u * c = d + ==> x = (&1 / u) pow 2 * y /\ + (&1 / u) * b = a /\ (&1 / u) * d = c`) THEN + ASM_REWRITE_TAC[] THEN MAP_EVERY EXPAND_TAC ["uinv"; "d"; "d5"; "d4"] THEN + REPEAT(FIRST_X_ASSUM(MP_TAC o MATCH_MP REAL_LT_IMP_NZ)) THEN + REWRITE_TAC[Nonlin_def.delta_x5; Nonlin_def.delta_x4] THEN + REWRITE_TAC[Sphere.ups_x; Sphere.delta_x] THEN CONV_TAC REAL_RING);; + +(* ------------------------------------------------------------------------- *) +(* The continuity part. *) +(* ------------------------------------------------------------------------- *) + +let CONTINUOUS_MK_SIMPLEX_WITHINREAL = prove + (`!v0 v1 v2 x1 x2 x3 x4 x5 x6 s a. + ~(ups_x (x1 a) (x2 a) (x6 a) = &0) /\ + &0 < delta_x (x1 a) (x2 a) (x3 a) (x4 a) (x5 a) (x6 a) /\ + v0 continuous (atreal a within s) /\ + v1 continuous (atreal a within s) /\ + v2 continuous (atreal a within s) /\ + x1 real_continuous (atreal a within s) /\ + x2 real_continuous (atreal a within s) /\ + x3 real_continuous (atreal a within s) /\ + x4 real_continuous (atreal a within s) /\ + x5 real_continuous (atreal a within s) /\ + x6 real_continuous (atreal a within s) + ==> (\t. mk_simplex1 (v0 t) (v1 t) (v2 t) + (x1 t) (x2 t) (x3 t) (x4 t) (x5 t) (x6 t)) + continuous (atreal a within s)`, + let POLY_CONT_TAC = + REPEAT((MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE + MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE + MATCH_MP_TAC REAL_CONTINUOUS_SUB) THEN CONJ_TAC) THEN + ASM_SIMP_TAC[REAL_CONTINUOUS_NEG; REAL_CONTINUOUS_CONST] in + REPEAT STRIP_TAC THEN REWRITE_TAC[mk_simplex1] THEN + CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN + MATCH_MP_TAC CONTINUOUS_ADD THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC CONTINUOUS_MUL THEN CONJ_TAC THENL + [REWRITE_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS1; real_div; REAL_MUL_LID] THEN + MATCH_MP_TAC REAL_CONTINUOUS_INV_WITHINREAL THEN + ASM_REWRITE_TAC[] THEN REWRITE_TAC[Sphere.ups_x] THEN POLY_CONT_TAC; + ALL_TAC] THEN + MATCH_MP_TAC CONTINUOUS_ADD THEN CONJ_TAC THENL + [MATCH_MP_TAC CONTINUOUS_MUL THEN + ASM_SIMP_TAC[CONTINUOUS_CROSS; CONTINUOUS_SUB] THEN + REWRITE_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS1] THEN + MATCH_MP_TAC REAL_CONTINUOUS_LMUL THEN + MATCH_MP_TAC REAL_CONTINUOUS_WITHINREAL_SQRT_COMPOSE THEN + ASM_REWRITE_TAC[] THEN REWRITE_TAC[Sphere.delta_x] THEN POLY_CONT_TAC; + MATCH_MP_TAC CONTINUOUS_ADD THEN + REWRITE_TAC[Nonlin_def.delta_x5; Nonlin_def.delta_x4] THEN + CONJ_TAC THEN MATCH_MP_TAC CONTINUOUS_MUL THEN + ASM_SIMP_TAC[CONTINUOUS_SUB; GSYM REAL_CONTINUOUS_CONTINUOUS1] THEN + POLY_CONT_TAC]);; + +let PQCSXWG2_WITHINREAL = prove + (`!v0 v1 v2 x1 x2 x3 x4 x5 x6 s a. + ~collinear {v0 a,v1 a,v2 a} /\ + x1 a = dist(v1 a,v0 a) pow 2 /\ + x2 a = dist(v2 a,v0 a) pow 2 /\ + x6 a = dist(v1 a,v2 a) pow 2 /\ + &0 < delta_x (x1 a) (x2 a) (x3 a) (x4 a) (x5 a) (x6 a) /\ + v0 continuous (atreal a within s) /\ + v1 continuous (atreal a within s) /\ + v2 continuous (atreal a within s) /\ + x1 real_continuous (atreal a within s) /\ + x2 real_continuous (atreal a within s) /\ + x3 real_continuous (atreal a within s) /\ + x4 real_continuous (atreal a within s) /\ + x5 real_continuous (atreal a within s) /\ + x6 real_continuous (atreal a within s) + ==> (\t. mk_simplex1 (v0 t) (v1 t) (v2 t) + (x1 t) (x2 t) (x3 t) (x4 t) (x5 t) (x6 t)) + continuous (atreal a within s)`, + REPEAT GEN_TAC THEN DISCH_THEN(STRIP_ASSUME_TAC o GSYM) THEN + MATCH_MP_TAC CONTINUOUS_MK_SIMPLEX_WITHINREAL THEN + ASM_REWRITE_TAC[] THEN FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I + [Collect_geom2.NOT_COL_EQ_UPS_X_POS]) THEN + REPEAT(FIRST_X_ASSUM(SUBST1_TAC o SYM)) THEN REWRITE_TAC[DIST_SYM] THEN + REAL_ARITH_TAC);; + +let PQCSXWG2_ATREAL = prove + (`!v0 v1 v2 x1 x2 x3 x4 x5 x6 a. + ~collinear {v0 a,v1 a,v2 a} /\ + x1 a = dist(v1 a,v0 a) pow 2 /\ + x2 a = dist(v2 a,v0 a) pow 2 /\ + x6 a = dist(v1 a,v2 a) pow 2 /\ + &0 < delta_x (x1 a) (x2 a) (x3 a) (x4 a) (x5 a) (x6 a) /\ + v0 continuous (atreal a) /\ + v1 continuous (atreal a) /\ + v2 continuous (atreal a) /\ + x1 real_continuous (atreal a) /\ + x2 real_continuous (atreal a) /\ + x3 real_continuous (atreal a) /\ + x4 real_continuous (atreal a) /\ + x5 real_continuous (atreal a) /\ + x6 real_continuous (atreal a) + ==> (\t. mk_simplex1 (v0 t) (v1 t) (v2 t) + (x1 t) (x2 t) (x3 t) (x4 t) (x5 t) (x6 t)) + continuous (atreal a)`, + ONCE_REWRITE_TAC[GSYM WITHINREAL_UNIV] THEN + REWRITE_TAC[PQCSXWG2_WITHINREAL]);; + +let PQCSXWG2_concl = `!(v0:real^3) v1 v2 v3 x1 x2 x3 x4 x5 x6. + &0 < x1 /\ &0 < x2 /\ &0 < x3 /\ &0 < x4 /\ &0 < x5 /\ &0 < x6 /\ + ~collinear {v0,v1,v2} /\ + x1 = dist(v1,v0) pow 2 /\ + x2 = dist(v2,v0) pow 2 /\ + x6 = dist(v1,v2) pow 2 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 /\ + v3 = mk_simplex1 v0 v1 v2 x1 x2 x3 x4 x5 x6 ==> + (\q. mk_simplex1 v0 v1 v2 x1 x2 x3 x4 q x6) continuous atreal x5`;; + +let PQCSXWG2 = prove + (PQCSXWG2_concl, + REPEAT STRIP_TAC THEN MATCH_MP_TAC PQCSXWG2_ATREAL THEN + ASM_REWRITE_TAC[REAL_CONTINUOUS_CONST; CONTINUOUS_CONST; + REAL_CONTINUOUS_AT_ID]);; + +end;; diff --git a/text_formalization/local/QKNVMLB.hl b/text_formalization/local/QKNVMLB.hl new file mode 100755 index 0000000..9e45901 --- /dev/null +++ b/text_formalization/local/QKNVMLB.hl @@ -0,0 +1,10773 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Qknvmlb = struct + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +let MOD_EQ_IMP_MOD_EQ_0=prove( +`~(k=0)/\ p MOD k = q MOD k/\ q<= p + ==> (p-q) MOD k =0`, +REPEAT STRIP_TAC +THEN MRESA_TAC DIVISION[`p:num`;`k:num`] +THEN MRESA_TAC DIVISION[`q:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`p = p DIV k * k + q MOD k +/\ q = q DIV k * k + q MOD k + /\ q<=p +==> p-q = (p DIV k *k - q DIV k *k)`) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> +REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th1-> +GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th1]) +THEN REWRITE_TAC[] +THEN GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC DIV_MONO[`q:num`;`p:num`;`k:num`] +THEN REWRITE_TAC[GSYM RIGHT_SUB_DISTRIB] +THEN RESA_TAC +THEN MRESA_TAC MOD_MULT[`k:num`;`(p DIV k - q DIV k)`] +THEN ONCE_REWRITE_TAC[ARITH_RULE`(p DIV k - q DIV k) * k=k* (p DIV k - q DIV k) `] +THEN ASM_REWRITE_TAC[]);; + + +let SCS_K_PRIME_CASE_4=prove(`s' = scs_half_slice_v39 s p q d' mkj +/\ is_scs_v39 s +/\ scs_k_v39 s=4 +/\ scs_diag (scs_k_v39 s) p q +==> scs_k_v39 s' =3`, + +let CASE_DIAGONAL_MOD= +fun (so:term) (so1:term) (so2:term)-> +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`p:num`;so;`4`][ARITH_RULE`~(4=0)/\ 4 MOD 4=0/\ SUC 0 MOD 4=1/\ 1 MOD 4=1 /\ 2 MOD 4=2 /\ 3 MOD 4=3/\ 0 MOD 4=0 /\ SUC 1=2 /\ SUC 2=3/\ SUC 3=4`] +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC MOD_ADD_MOD[`q:num`;so1;`4`][ARITH_RULE`~(4=0) /\ 1 MOD 4=1/\ 1+4-0=5/\ 1+4-1=4 /\ 5 MOD 4=1/\ 4 MOD 4=0/\ 1+4-2=3 /\ 3 MOD 4=3/\ 2 MOD 4=2 /\ 1+4-3=2`;ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`q:num`;`4:num`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`q MOD 4 < 4 ==> q MOD 4 =0 \/ q MOD 4 =1 \/ q MOD 4 =2 \/ q MOD 4 =3`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`(3) MOD 4=3 /\ 2 +1=3 /\ 3+0=3/\ 0+3=3 /\ 1+2=3`] +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`q:num`;so2;`4`][ARITH_RULE`~(4=0)/\ 4 MOD 4=0/\ SUC 0 MOD 4=1/\ 1 MOD 4=1 /\ 2 MOD 4=2 /\ 3 MOD 4=3/\ 0 MOD 4=0/\ SUC 3=4/\ SUC 1=2/\ SUC 2=3`] +in + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[scs_half_slice_v39;LET_DEF;LET_END_DEF;scs_k_v39_explicit;scs_diag] +THEN STRIP_TAC +THEN MRESAL_TAC DIVISION[`p:num`;`4:num`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`p MOD 4 < 4 ==> p MOD 4 =0 \/ p MOD 4 =1 \/ p MOD 4 =2 \/ p MOD 4 =3`) +THEN RESA_TAC +THENL[ +CASE_DIAGONAL_MOD `0` `5` `3`; +CASE_DIAGONAL_MOD `1` `4` `0`; +CASE_DIAGONAL_MOD `2` `3` `1`; +CASE_DIAGONAL_MOD `3` `2` `2`]);; + + + + + + +let SCS_K_PRIME_CASE_5=prove( +`s' = scs_half_slice_v39 s p q d' mkj +/\ s'' = scs_half_slice_v39 s q p d' mkj +/\ is_scs_v39 s +/\ scs_k_v39 s=5 +/\ scs_diag (scs_k_v39 s) p q +==> (scs_k_v39 s' =3 /\ scs_k_v39 s'' =4) \/ (scs_k_v39 s' =4 /\ scs_k_v39 s'' =3)`, +let CASE_DIAGONAL_MOD= +fun (so:term) (so1:term) (so2:term) -> +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`p:num`;so;`5`][ARITH_RULE`~(5=0)/\ 5 MOD 5=0/\ SUC 0 MOD 5=1/\ 1 MOD 5=1 /\ 2 MOD 5=2 /\ 3 MOD 5=3/\ 0 MOD 5=0 /\ SUC 1=2 /\ SUC 2=3/\ SUC 3=4/\ 4 MOD 5=4 /\ SUC 4=5`] +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC +THEN ASSUME_TAC th) +THEN MRESAL_TAC MOD_ADD_MOD[`q:num`;so1;`5`][ARITH_RULE`~(5=0) /\ 1 MOD 5=1/\ 1+5-0=6/\ 1+5-1=5 /\ 6 MOD 5=1/\ 5 MOD 5=0/\ 1+5-2=4 /\ 3 MOD 5=3/\ 2 MOD 5=2 /\ 1+5-3=3/\ 1+5-4=2`;ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`q:num`;`5:num`][ARITH_RULE`~(5=0)`]THEN MP_TAC(ARITH_RULE`q MOD 5 < 5 ==> q MOD 5 =0 \/ q MOD 5 =1 \/ q MOD 5 =2 \/ q MOD 5 = 3\/ q MOD 5=4`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`(3) MOD 5=3 /\ 2 +1=3 /\ 3+0=3/\ 0+3=3 /\ 1+2=3`] +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`q:num`;so2;`5`][ARITH_RULE`~(5=0)/\ 5 MOD 5=0/\ SUC 0 MOD 5=1/\ 1 MOD 5=1 /\ 2 MOD 5=2 /\ 3 MOD 5=3/\ 0 MOD 5=0/\ SUC 3=4/\ SUC 1=2/\ SUC 2=3/\ SUC 4=5/\ 4 MOD 5=4`] +THEN MRESAL_TAC MOD_ADD_MOD[`p:num`;`4`;`5`][ARITH_RULE`~(5=0) /\ 1 MOD 5=1/\ 1+5-0=6/\ 1+5-1=5 /\ 6 MOD 5=1/\ 5 MOD 5=0/\ 1+5-2=4 /\ 3 MOD 5=3/\ 2 MOD 5=2 /\ 1+5-3=3/\ 1+5-4=2/\ 4 MOD 5=4 /\ 0+4=4`;ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC MOD_ADD_MOD[`p:num`;`3`;`5`][ARITH_RULE`~(5=0) /\ 1 MOD 5=1/\ 1+5-0=6/\ 1+5-1=5 /\ 6 MOD 5=1/\ 5 MOD 5=0/\ 1+5-2=4 /\ 3 MOD 5=3/\ 2 MOD 5=2 /\ 1+5-3=3/\ 1+5-4=2/\ 4 MOD 5=4 /\ 0+3=3 /\ 3+1=4/\ 1+3=4/\ 4+0=4`;ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC MOD_ADD_MOD[`p:num`;`2`;`5`][ARITH_RULE`~(5=0) /\ 1 MOD 5=1/\ 1+5-0=6/\ 1+5-1=5 /\ 6 MOD 5=1/\ 5 MOD 5=0/\ 1+5-2=4 /\ 3 MOD 5=3/\ 2 MOD 5=2 /\ 1+5-3=3/\ 1+5-4=2/\ 4 MOD 5=4 /\ 0+3=3 /\ 3+1=4/\ 1+3=4/\ 4+0=4/\ 1+2=3`;ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC MOD_ADD_MOD[`p:num`;`6`;`5`][ARITH_RULE`~(5=0) /\ 1 MOD 5=1/\ 1+5-0=6/\ 1+5-1=5 /\ 6 MOD 5=1/\ 5 MOD 5=0/\ 1+5-2=4 /\ 3 MOD 5=3/\ 2 MOD 5=2 /\ 1+5-3=3/\ 1+5-4=2/\ 4 MOD 5=4 /\ 0+3=3 /\ 3+1=4/\ 1+3=4/\ 4+0=4/\ 1+2=3/\ 2+1=3 /\ 4+4=8 /\ 8 MOD 5=3 /\ 2+2=4`;ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC MOD_ADD_MOD[`p:num`;`5`;`5`][ARITH_RULE`~(5=0) /\ 1 MOD 5=1/\ 1+5-0=6/\ 1+5-1=5 /\ 6 MOD 5=1/\ 5 MOD 5=0/\ 1+5-2=4 /\ 3 MOD 5=3/\ 2 MOD 5=2 /\ 1+5-3=3/\ 1+5-4=2/\ 4 MOD 5=4 /\ 0+3=3 /\ 3+1=4/\ 1+3=4/\ 4+0=4/\ 1+2=3/\ 2+1=3 /\ 4+4=8 /\ 8 MOD 5=3 /\ 2+2=4/\ 3+0=3`;ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +in + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[scs_half_slice_v39;LET_DEF;LET_END_DEF;scs_k_v39_explicit;scs_diag] +THEN STRIP_TAC +THEN MRESAL_TAC DIVISION[`p:num`;`5:num`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`p MOD 5 < 5 ==> p MOD 5 =0 \/ p MOD 5 =1 \/ p MOD 5 =2 \/ p MOD 5 =3\/ p MOD 5=4`) +THEN RESA_TAC +THENL[ +CASE_DIAGONAL_MOD `0` `6` `4`; +CASE_DIAGONAL_MOD `1` `5` `0`; +CASE_DIAGONAL_MOD `2` `4` `1`; +CASE_DIAGONAL_MOD `3` `3` `2`; +CASE_DIAGONAL_MOD `4` `2` `3`]);; + + + +let SCS_K_PRIME_CASE_6=prove( +`s' = scs_half_slice_v39 s p q d' mkj +/\ s'' = scs_half_slice_v39 s q p d' mkj +/\ is_scs_v39 s +/\ scs_k_v39 s=6 +/\ scs_diag (scs_k_v39 s) p q +==> (scs_k_v39 s' =3 /\ scs_k_v39 s'' =5) \/ (scs_k_v39 s' =5 /\ scs_k_v39 s'' =3) \/ (scs_k_v39 s' =4 /\ scs_k_v39 s'' =4)`, +let CASE_DIAGONAL_MOD= +fun (so:term) (so1:term) (so2:term) -> +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`p:num`;so;`6`][ARITH_RULE`~(6=0)/\ 6 MOD 6=0/\ SUC 0 MOD 6=1/\ 1 MOD 6=1 /\ 2 MOD 6=2 /\ 3 MOD 6=3/\ 0 MOD 6=0 /\ SUC 1=2 /\ SUC 2=3/\ SUC 3=4/\ 4 MOD 6=4 /\ SUC 4=5/\ SUC 5=6 /\ 5 MOD 6=5`] +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC +THEN ASSUME_TAC th) +THEN MRESAL_TAC MOD_ADD_MOD[`q:num`;so1;`6`][ARITH_RULE`~(6=0) /\ 1 MOD 6=1/\ 1+6-0=7/\ 1+6-1=6 /\ 7 MOD 6=1/\ 6 MOD 6=0/\ 1+6-2=5 /\ 3 MOD 6=3/\ 2 MOD 6=2 /\ 1+6-3=4/\ 1+6-4=3/\ 1+6-5=2`;ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`q:num`;`6:num`][ARITH_RULE`~(6=0)`]THEN MP_TAC(ARITH_RULE`q MOD 6 < 6 ==> q MOD 6 =0 \/ q MOD 6 =1 \/ q MOD 6 =2 \/ q MOD 6 = 3\/ q MOD 6=4\/ q MOD 6=5`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`(3) MOD 6=3 /\ 2 +1=3 /\ 3+0=3/\ 0+3=3 /\ 1+2=3`] +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`q:num`;so2;`6`][ARITH_RULE`~(6=0)/\ 6 MOD 6=0/\ SUC 0 MOD 6=1/\ 1 MOD 6=1 /\ 2 MOD 6=2 /\ 3 MOD 6=3/\ 0 MOD 6=0/\ SUC 3=4/\ SUC 1=2/\ SUC 2=3/\ SUC 4=5/\ SUC 5=6/\ 4 MOD 6=4/\ 5 MOD 6=5`] +THEN MRESAL_TAC MOD_ADD_MOD[`p:num`;`4`;`6`][ARITH_RULE`~(6=0) /\ 1 MOD 6=1/\ 1+6-0=7/\ 1+6-1=6 /\ 7 MOD 6=1/\ 6 MOD 6=0/\ 1+6-2=5 /\ 3 MOD 6=3/\ 2 MOD 6=2 /\ 1+6-3=4/\ 1+6-4=3/\ 4 MOD 6=4 /\ 0+3=3 /\ 3+1=4/\ 1+3=4/\ 4+0=4/\ 1+2=3/\ 2+1=3 /\ 4+4=8 /\ 8 MOD 6=2 /\ 2+2=4/\ 3+0=3/\ 1+6-5=2`;ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC MOD_ADD_MOD[`p:num`;`3`;`6`][ARITH_RULE`~(6=0) /\ 1 MOD 6=1/\ 1+6-0=7/\ 1+6-1=6 /\ 7 MOD 6=1/\ 6 MOD 6=0/\ 1+6-2=5 /\ 3 MOD 6=3/\ 2 MOD 6=2 /\ 1+6-3=4/\ 1+6-4=3/\ 4 MOD 6=4 /\ 0+3=3 /\ 3+1=4/\ 1+3=4/\ 4+0=4/\ 1+2=3/\ 2+1=3 /\ 4+4=8 /\ 8 MOD 6=2 /\ 2+2=4/\ 3+0=3`;ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC MOD_ADD_MOD[`p:num`;`2`;`6`][ARITH_RULE`~(6=0) /\ 1 MOD 6=1/\ 1+6-0=7/\ 1+6-1=6 /\ 7 MOD 6=1/\ 6 MOD 6=0/\ 1+6-2=5 /\ 3 MOD 6=3/\ 2 MOD 6=2 /\ 1+6-3=4/\ 1+6-4=3/\ 4 MOD 6=4 /\ 0+3=3 /\ 3+1=4/\ 1+3=4/\ 4+0=4/\ 1+2=3/\ 2+1=3 /\ 4+4=8 /\ 8 MOD 6=2 /\ 2+2=4/\ 3+0=3`;ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC MOD_ADD_MOD[`p:num`;`6`;`6`][ARITH_RULE`~(6=0) /\ 1 MOD 6=1/\ 1+6-0=7/\ 1+6-1=6 /\ 7 MOD 6=1/\ 6 MOD 6=0/\ 1+6-2=5 /\ 3 MOD 6=3/\ 2 MOD 6=2 /\ 1+6-3=4/\ 1+6-4=3/\ 4 MOD 6=4 /\ 0+3=3 /\ 3+1=4/\ 1+3=4/\ 4+0=4/\ 1+2=3/\ 2+1=3 /\ 4+4=8 /\ 8 MOD 6=2 /\ 2+2=4/\ 3+0=3`;ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC MOD_ADD_MOD[`p:num`;`5`;`6`][ARITH_RULE`~(6=0) /\ 1 MOD 6=1/\ 1+6-0=7/\ 1+6-1=6 /\ 7 MOD 6=1/\ 6 MOD 6=0/\ 1+6-2=5 /\ 3 MOD 6=3/\ 2 MOD 6=2 /\ 1+6-3=4/\ 1+6-4=3/\ 4 MOD 6=4 /\ 0+3=3 /\ 3+1=4/\ 1+3=4/\ 4+0=4/\ 1+2=3/\ 2+1=3 /\ 4+4=8 /\ 8 MOD 6=2 /\ 2+2=4/\ 3+0=3/\ 5 MOD 6=5/\ 0+5=5/\0+4= 4/\ 4+1=5/\ 1+4=5 /\ 5+0=5`;ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC MOD_ADD_MOD[`p:num`;`7`;`6`][ARITH_RULE`~(6=0) /\ 1 MOD 6=1/\ 1+6-0=7/\ 1+6-1=6 /\ 7 MOD 6=1/\ 6 MOD 6=0/\ 1+6-2=5 /\ 3 MOD 6=3/\ 2 MOD 6=2 /\ 1+6-3=4/\ 1+6-4=3/\ 4 MOD 6=4 /\ 0+3=3 /\ 3+1=4/\ 1+3=4/\ 4+0=4/\ 1+2=3/\ 2+1=3 /\ 4+4=8 /\ 8 MOD 6=2 /\ 2+2=4/\ 3+0=3/\ 5 MOD 6=5/\ 0+5=5/\0+4= 4/\ 4+1=5/\ 1+4=5 /\ 5+0=5/\ 4+5=9/\ 9 MOD 6=3/\ 2+3=5/\ 5+5=10/\ 10 MOD 6=4/\ 5+4=9/\ 3+2=5`;ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +in + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[scs_half_slice_v39;LET_DEF;LET_END_DEF;scs_k_v39_explicit;scs_diag] +THEN STRIP_TAC +THEN MRESAL_TAC DIVISION[`p:num`;`6:num`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`p MOD 6 < 6 ==> p MOD 6 =0 \/ p MOD 6 =1 \/ p MOD 6 =2 \/ p MOD 6 =3\/ p MOD 6=4\/ p MOD 6=5`) +THEN RESA_TAC +THENL[ +CASE_DIAGONAL_MOD `0` `7` `5`; +CASE_DIAGONAL_MOD `1` `6` `0`; +CASE_DIAGONAL_MOD `2` `5` `1`; +CASE_DIAGONAL_MOD `3` `4` `2`; +CASE_DIAGONAL_MOD `4` `3` `3`; +CASE_DIAGONAL_MOD `5` `2` `4`]);; + + + + +let SCS_K_PRIME_CASE_3=prove(`is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q +==> 3< scs_k_v39 s`, +let LEMMA_TAC= +fun (so:term) (so1:term)-> +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`p:num`;so;`3`][ARITH_RULE`~(3=0)/\ 3 MOD 3=0/\ SUC 0 MOD 3=1/\ 1 MOD 3=1 /\ 2 MOD 3=2 /\ 0 MOD 3=0 /\ SUC 1=2 /\ SUC 2=3/\ SUC 3=4`] +THEN MRESAL_TAC DIVISION[`q:num`;`3:num`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`q MOD 3< 3 ==> q MOD 3 =0\/ q MOD 3 =1 \/ q MOD 3 =2`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`q:num`;so1;`3`][ARITH_RULE`~(3=0)/\ 3 MOD 3=0/\ SUC 0 MOD 3=1/\ 1 MOD 3=1 /\ 2 MOD 3=2 /\ 0 MOD 3=0 /\ SUC 1=2 /\ SUC 2=3/\ SUC 3=4`] +in + +REWRITE_TAC[LET_DEF;LET_END_DEF;scs_half_slice_v39;is_scs_v39;scs_diag;scs_v39_explicit] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> scs_k_v39 s =3\/ 3 ASM_TAC THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN REPLICATE_TAC 3 (POP_ASSUM MP_TAC) +THEN MRESAL_TAC DIVISION[`p:num`;`3:num`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`p MOD 3< 3 ==> p MOD 3 =0\/ p MOD 3 =1 \/ p MOD 3 =2`) +THEN RESA_TAC +THENL[LEMMA_TAC `0` `2`; +LEMMA_TAC `1` `0`; +LEMMA_TAC `2` `1`]);; + + +let SCS_K_PRIME_LE_GE=prove(` let s' = scs_half_slice_v39 s p q d' mkj in + is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q +==> + 3<= scs_k_v39 s' /\ scs_k_v39 s'<=6 /\ scs_k_v39 s'< scs_k_v39 s `, +REWRITE_TAC[LET_DEF;LET_END_DEF;] +THEN STRIP_TAC +THEN MP_TAC SCS_K_PRIME_CASE_3 +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th THEN REWRITE_TAC[is_scs_v39] +THEN ASSUME_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`s' = scs_half_slice_v39 s p q d' mkj` +THEN ABBREV_TAC`s'' = scs_half_slice_v39 s q p d' mkj` +THEN MP_TAC(ARITH_RULE`3 < scs_k_v39 s /\ scs_k_v39 s<=6 ==> scs_k_v39 s = 4\/ scs_k_v39 s = 5\/ scs_k_v39 s = 6`) +THEN RESA_TAC +THENL[ +MP_TAC SCS_K_PRIME_CASE_4 +THEN RESA_TAC +THEN ARITH_TAC; +MP_TAC SCS_K_PRIME_CASE_5 +THEN RESA_TAC +THEN ARITH_TAC; +MP_TAC SCS_K_PRIME_CASE_6 +THEN RESA_TAC +THEN ARITH_TAC]);; + + + + + +let SCS_HALF_SLICE_IS_SCS=prove_by_refinement( +` s' = scs_half_slice_v39 s p q d' mkj /\ + s'' = scs_half_slice_v39 s q p d'' mkj /\ + (scs_J_v39 s' 0 (scs_k_v39 s' -1))= mkj +/\ +(~(scs_J_v39 s' 0 (scs_k_v39 s' -1))) +/\ vv' = (\i. (vv:num->real^3) (i MOD (scs_k_v39 s')+p MOD (scs_k_v39 s))) +/\ is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q +/\ +d'< #0.9 /\ +scs_bm_v39 s p q < &4 /\ +(4 scs_bm_v39 s p q <= cstab) +==> + is_scs_v39 s'`, + (* {{{ proof *) +[ +STRIP_TAC +THEN MRESA_TAC (GEN_ALL SCS_K_PRIME_LE_GE)[`s:scs_v39`;`p:num`;`q:num`;`d':real`;`scs_J_v39 s' p q`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;] +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;scs_half_slice_v39;is_scs_v39;scs_diag;scs_v39_explicit] +THEN ABBREV_TAC`k'=(q + 1 + scs_k_v39 s - p MOD scs_k_v39 s) MOD scs_k_v39 s` +THEN REPEAT RESA_TAC; + + + +REWRITE_TAC[periodic] +THEN SET_TAC[] +; + + +REWRITE_TAC[periodic] +THEN SET_TAC[] +; + + +REWRITE_TAC[periodic] +THEN SET_TAC[] +; + + +REWRITE_TAC[periodic] +THEN SET_TAC[] +; + + +REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +; + + + +MRESAL_TAC MOD_EQ [`i+k':num`;`i:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`i+p+k':num`;`i+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`] +; + + + +MRESAL_TAC MOD_EQ [`j+k':num`;`j:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`j+p+k':num`;`j+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`] +; + + + +REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +; + + + +MRESAL_TAC MOD_EQ [`i+k':num`;`i:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`i+p+k':num`;`i+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + + +MRESAL_TAC MOD_EQ [`j+k':num`;`j:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`j+p+k':num`;`j+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + + + + + +REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC; + + + +MRESAL_TAC MOD_EQ [`i+k':num`;`i:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`i+p+k':num`;`i+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + + + +MRESAL_TAC MOD_EQ [`j+k':num`;`j:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`j+p+k':num`;`j+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + + + + +REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +; + + + +MRESAL_TAC MOD_EQ [`i+k':num`;`i:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`i+p+k':num`;`i+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + + + + +MRESAL_TAC MOD_EQ [`j+k':num`;`j:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`j+p+k':num`;`j+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`] +; + + + +REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +; + + + +MRESAL_TAC MOD_EQ [`i+k':num`;`i:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`i+p+k':num`;`i+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + + +MRESAL_TAC MOD_EQ [`j+k':num`;`j:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`j+p+k':num`;`j+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + + + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`({A,B}={C,D})<=> ({B,A}={C,D}) `] +THEN REWRITE_TAC[]; + + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`({A,B}={C,D})<=> ({B,A}={C,D}) `] +THEN REWRITE_TAC[]; + + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`({A,B}={C,D})<=> ({B,A}={C,D}) `] +THEN REWRITE_TAC[]; + + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`({A,B}={C,D})<=> ({B,A}={C,D}) `] +THEN REWRITE_TAC[]; + + + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`({A,B}={C,D})<=> ({B,A}={C,D}) `] +THEN REWRITE_TAC[]; + + + + +REAL_ARITH_TAC; + + + +DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k'-1} \/ ~({i MOD k', j MOD k'} = {0, k'-1})`); + + + +ASM_REWRITE_TAC[]; + + +ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (17)(REMOVE_ASSUM_TAC) +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i MOD k' + p MOD scs_k_v39 s`;`j MOD k' + p MOD scs_k_v39 s`]) +THEN REPLICATE_TAC 3 (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC +; + + + +REAL_ARITH_TAC; + + + +MP_TAC(ARITH_RULE`3<=k' ==> ~(0=k'-1)`) +THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`{i MOD k', i MOD k'} = {0, k'-1} \/ ~({i MOD k', i MOD k'} = {0, k'-1})`); + + + +MP_TAC(SET_RULE`{i MOD k', i MOD k'} = {0, k'-1}==> i MOD k'= 0 /\ i MOD k'= k'-1`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; + + + +ASM_REWRITE_TAC[]; + + + + +DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k'-1} \/ ~({i MOD k', j MOD k'} = {0, k'-1})`); + + + +ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s = 0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s p`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `q:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s (q MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `p:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`p:num`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC DIVISION[`q:num`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN REPLICATE_TAC 23 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`p MOD scs_k_v39 s`;`q MOD scs_k_v39 s`]) +THEN REPLICATE_TAC 25(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`p MOD scs_k_v39 s`;`q MOD scs_k_v39 s`]) +THEN REPLICATE_TAC 4(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + + + +ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s = 0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(j MOD k' + p MOD scs_k_v39 s):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (((j MOD k' + p MOD scs_k_v39 s) MOD scs_k_v39 s))`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `((i MOD k' + p MOD scs_k_v39 s)):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN REPLICATE_TAC (34-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN MRESAL_TAC DIVISION[`(i MOD k' + p MOD scs_k_v39 s):num`;`scs_k_v39 s:num`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC DIVISION[`(j MOD k' + p MOD scs_k_v39 s):num`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN STRIP_TAC +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`i MOD k':num`;`j MOD k':num`;`p MOD scs_k_v39 s`;`scs_k_v39 s`][ADD_SYM] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k':num`] +THEN MRESA_TAC MOD_LT[`j:num`;`k':num`] +THEN MP_TAC(ARITH_RULE`i< k' /\ k'< scs_k_v39 s /\ j +i< scs_k_v39 s /\ j< scs_k_v39 s`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_LT[`j:num`;`scs_k_v39 s`] +; + + + + + +DISJ_CASES_TAC(SET_RULE`{i MOD 3, SUC i MOD 3} = {0, 3-1} \/ ~({i MOD 3, SUC i MOD 3} = {0, 3-1})`); + + +ASM_REWRITE_TAC[] +; + + + +ASM_REWRITE_TAC[] +THEN MRESAL_TAC DIVISION[`i:num`;`k':num`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s = 0)`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`(i ) MOD 3 < 3 ==> (i ) MOD 3 =0 \/ (i ) MOD 3 =1 \/ (i ) MOD 3 =2`) +THEN RESA_TAC +; + + +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`0`;`3`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 0+A=A /\ 1+A= SUC A`] +THEN REPLICATE_TAC (37-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th `p MOD scs_k_v39 s` [ARITH_RULE`SUC 0=1/\ SUC 1=2/\ SUC 2=3`;cstab]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + + + +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`1`;`3`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 2+A=SUC(1+A) `] +THEN REPLICATE_TAC (37-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th `1+p MOD scs_k_v39 s` [ARITH_RULE`SUC 0=1/\ SUC 1=2/\ SUC 2=3`;cstab]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + + +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`2`;`3`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 2+A=SUC(1+A) `] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;ARITH_RULE`3-1=2`] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;ARITH_RULE`3-1=2`] +THEN REPEAT STRIP_TAC) +THEN REPLICATE_TAC (4) REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + + + + + + + + + + +DISJ_CASES_TAC(SET_RULE`{i MOD k', SUC i MOD k'} = {0, k'-1} \/ ~({i MOD k', SUC i MOD k'} = {0, k'-1})`); + + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 4< scs_k_v39 s`) +THEN RESA_TAC +THEN REPLICATE_TAC (6) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN RESA_TAC +; + + + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'`) +THEN RESA_TAC +THEN MRESAL_TAC DIVISION[`i:num`;`k':num`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s = 0)`) +THEN RESA_TAC +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`1:num`;`k':num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_LT[`1`;`k':num`] +THEN MP_TAC(ARITH_RULE`3 i MOD k' =k'-1 \/ i MOD k' +1 < k' `) +THEN RESA_TAC +; + + + + +MRESA_TAC MOD_LT[`k'-1`;`k':num`] +THEN MRESAL_TAC MOD_MULT[`k':num`;`1`][ARITH_RULE`A* 1=A`] +THEN +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`k'-1`;`k':num`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 2+A=SUC(1+A) `] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN REPLICATE_TAC (2) REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN REPLICATE_TAC (8) REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + + + +MRESAL_TAC MOD_LT[`i MOD k' +1`;`k':num`][ARITH_RULE`(i MOD k' + 1) + p MOD scs_k_v39 s= SUC(i MOD k' + p MOD scs_k_v39 s)`] +THEN REPLICATE_TAC (42-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + + + +POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k' - 1} \/ ~({i MOD k', j MOD k'} = {0, k' - 1})`) +; + + +ASM_REWRITE_TAC[]; + + +MP_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k' - 1} ==> (i MOD k'= 0 /\ j MOD k' = k'-1)\/ (i MOD k'= k'-1 /\ j MOD k' = 0)`) +THEN RESA_TAC; + + +MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`k'-1`;`k':num`] +THEN MRESAL_TAC MOD_MULT[`k':num`;`1`][ARITH_RULE`A* 1=A`] +THEN +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`j:num`;`k'-1`;`k':num`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 2+A=SUC(1+A) `] +; + + + + +MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'/\ ~(scs_k_v39 s =0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`k'-1`;`k':num`] +THEN MRESAL_TAC MOD_MULT[`k':num`;`1`][ARITH_RULE`A* 1=A`] +THEN +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`k'-1`;`k':num`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 2+A=SUC(1+A) `] +; + + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REPLICATE_TAC (31-18)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`(i MOD k' + p MOD scs_k_v39 s)`;`(j MOD k' + p MOD scs_k_v39 s)`][ARITH_RULE`SUC(A+B)= SUC A+B`]) + +; + + +MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'/\ ~(scs_k_v39 s =0)`) +THEN RESA_TAC +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`j MOD k':num`;`SUC(i MOD k'):num`;`p MOD scs_k_v39 s`;`scs_k_v39 s`][ADD_SYM] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC DIVISION[`(i):num`;`k':num`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC DIVISION[`(j):num`;`k':num`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`j MOD k' < k' /\ k'< scs_k_v39 s +/\ i MOD k' < k' ==> j MOD k' < scs_k_v39 s /\ SUC (i MOD k') < scs_k_v39 s`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`j MOD k'`;`scs_k_v39 s:num`] +THEN MRESA_TAC MOD_LT[`SUC(i MOD k')`;`scs_k_v39 s:num`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k' /\ i MOD k' < k' ==> i MOD k' =k'-1 \/ i MOD k' +1 < k' `) +THEN RESA_TAC +; + + + + + + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (4) REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + + + +REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`1:num`;`k':num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_LT[`1`;`k':num`] +THEN MRESA_TAC MOD_LT[`i MOD k' + 1`;`k':num`] +; + + + + + + + +MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'/\ ~(scs_k_v39 s =0)`) +THEN RESA_TAC +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`i MOD k':num`;`SUC(j MOD k'):num`;`p MOD scs_k_v39 s`;`scs_k_v39 s`][ADD_SYM] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC DIVISION[`(i):num`;`k':num`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC DIVISION[`(j):num`;`k':num`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`j MOD k' < k' /\ k'< scs_k_v39 s +/\ i MOD k' < k' ==> SUC(j MOD k') < scs_k_v39 s /\ (i MOD k') < scs_k_v39 s`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`i MOD k'`;`scs_k_v39 s:num`] +THEN MRESA_TAC MOD_LT[`SUC(j MOD k')`;`scs_k_v39 s:num`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k' /\ j MOD k' < k' ==> j MOD k' =k'-1 \/ j MOD k' +1 < k' `) +THEN RESA_TAC +; + + + + + + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (5) REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + + + +REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_ADD_MOD[`j:num`;`1:num`;`k':num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_LT[`1`;`k':num`] +THEN MRESA_TAC MOD_LT[`j MOD k' + 1`;`k':num`] +; + + + + + + +POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k' - 1} \/ ~({i MOD k', j MOD k'} = {0, k' - 1})`) +; + + + + +ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (33)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REPLICATE_TAC (36-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(i MOD k' + p MOD scs_k_v39 s)`;`(j MOD k' + p MOD scs_k_v39 s)`]) +; + + + +POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k' - 1} \/ ~({i MOD k', j MOD k'} = {0, k' - 1})`) +; + + + + +ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (33)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REPLICATE_TAC (36-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(i MOD k' + p MOD scs_k_v39 s)`;`(j MOD k' + p MOD scs_k_v39 s)`]) +; + + + +SUBGOAL_THEN`IMAGE (\x. (x+p MOD scs_k_v39 s )MOD scs_k_v39 s ) {i | i < k' /\ + (&2 * h0 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_bm_v39 s p q + else scs_b_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)) \/ + &2 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_am_v39 s p q + else scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)))} +SUBSET {i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))} UNION {(k'-1 + p MOD scs_k_v39 s) MOD scs_k_v39 s}` ASSUME_TAC; + + + + +REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING;IMAGE] +THEN GEN_TAC +THEN RESA_TAC; + + +REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`x' x'= k'-1\/ SUC x' < k' `) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`x':num`;`k':num`] +THEN MRESA_TAC MOD_LT[`SUC x':num`;`k':num`] +THEN DISJ_CASES_TAC(SET_RULE`{x', SUC x'} = {0, k' - 1} \/ ~({x', SUC x'} = {0, k' - 1})`) + ; + + + + +MP_TAC(SET_RULE`{x', SUC x'} = {0, k' - 1} ==> (x' =0 /\ SUC x' = k'-1)\/ (x' =k'-1/\ SUC x' =0)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0= k'-1<=> k'=2`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> +REPLICATE_TAC (40-32)(REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[th]) +THEN ARITH_TAC +; + + + + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MATCH_MP_TAC(SET_RULE`A==>A \/ B`) +THEN MP_TAC(ARITH_RULE`k' < scs_k_v39 s /\ 3<= k' /\ x'< k' /\ SUC x' < k' ==> ~(scs_k_v39 s=0) /\ x'< scs_k_v39 s/\ SUC x' < scs_k_v39 s/\ 1< scs_k_v39 s`) +THEN RESA_TAC +THEN MRESAL_TAC DIVISION[`x' + p MOD scs_k_v39 s`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN MATCH_MP_TAC(SET_RULE`A==>A \/ B`) +THEN MRESA_TAC MOD_LT[`x':num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_LT[`SUC x':num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`x':num`;`p:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`SUC x':num`;`p:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (10)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (x' + p MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(SUC x' + p MOD scs_k_v39 s):num`) +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s ((SUC x' + p) MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x' + p MOD scs_k_v39 s):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s ((x' + p) MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(SUC ((x' + p) MOD scs_k_v39 s)):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;ADD1]) +THEN MRESA_TAC MOD_LT[`1:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`(x' + p):num`;`1:num`;`scs_k_v39 s`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`(x' + p) + 1=(x' + 1) + p`] +; + + + + +REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`x' x'= k'-1\/ SUC x' < k' `) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`x':num`;`k':num`] +THEN MRESA_TAC MOD_LT[`SUC x':num`;`k':num`] +THEN DISJ_CASES_TAC(SET_RULE`{x', SUC x'} = {0, k' - 1} \/ ~({x', SUC x'} = {0, k' - 1})`) + ; + + + + +MP_TAC(SET_RULE`{x', SUC x'} = {0, k' - 1} ==> (x' =0 /\ SUC x' = k'-1)\/ (x' =k'-1/\ SUC x' =0)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0= k'-1<=> k'=2`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> +REPLICATE_TAC (40-32)(REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[th]) +THEN ARITH_TAC +; + + + + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MATCH_MP_TAC(SET_RULE`A==>A \/ B`) +THEN MP_TAC(ARITH_RULE`k' < scs_k_v39 s /\ 3<= k' /\ x'< k' /\ SUC x' < k' ==> ~(scs_k_v39 s=0) /\ x'< scs_k_v39 s/\ SUC x' < scs_k_v39 s/\ 1< scs_k_v39 s`) +THEN RESA_TAC +THEN MRESAL_TAC DIVISION[`x' + p MOD scs_k_v39 s`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN MATCH_MP_TAC(SET_RULE`B==>A \/ B`) +THEN MRESA_TAC MOD_LT[`x':num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_LT[`SUC x':num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`x':num`;`p:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`SUC x':num`;`p:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (10)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (x' + p MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(SUC x' + p MOD scs_k_v39 s):num`) +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((SUC x' + p) MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x' + p MOD scs_k_v39 s):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((x' + p) MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(SUC ((x' + p) MOD scs_k_v39 s)):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;ADD1]) +THEN MRESA_TAC MOD_LT[`1:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`(x' + p):num`;`1:num`;`scs_k_v39 s`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`(x' + p) + 1=(x' + 1) + p`] +; + + + + +SUBGOAL_THEN`CARD(IMAGE (\x. (x+p MOD scs_k_v39 s )MOD scs_k_v39 s ) {i | i < k' /\ + (&2 * h0 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_bm_v39 s p q + else scs_b_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)) \/ + &2 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_am_v39 s p q + else scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)))}) += CARD {i | i < k' /\ + (&2 * h0 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_bm_v39 s p q + else scs_b_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)) \/ + &2 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_am_v39 s p q + else scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)))}`ASSUME_TAC +; + + + + +MATCH_MP_TAC CARD_IMAGE_INJ +THEN STRIP_TAC; + + +REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'/\ ~(scs_k_v39 s =0) +/\ x< scs_k_v39 s/\ y< scs_k_v39 s`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`x:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_LT[`y:num`;`scs_k_v39 s`] +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`x:num`;`y:num`;`p MOD scs_k_v39 s`;`scs_k_v39 s`][ADD_SYM] +; + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. k'` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + + +POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`FINITE + ({i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))} UNION + {(k' - 1 + p MOD scs_k_v39 s) MOD scs_k_v39 s})`ASSUME_TAC +; + + + + +REWRITE_TAC[FINITE_UNION;FINITE_SING] +THEN MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. (scs_k_v39 s)` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + +MRESA_TAC CARD_SUBSET[`IMAGE (\x. (x+p MOD scs_k_v39 s )MOD scs_k_v39 s ) {i | i < k' /\ + (&2 * h0 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_bm_v39 s p q + else scs_b_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)) \/ + &2 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_am_v39 s p q + else scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)))}`;`{i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))} UNION {(k'-1 + p MOD scs_k_v39 s) MOD scs_k_v39 s}`] +THEN SUBGOAL_THEN`FINITE + ({i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))})`ASSUME_TAC +; + + + + +REWRITE_TAC[FINITE_UNION;FINITE_SING] +THEN MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. (scs_k_v39 s)` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + + +MRESAL_TAC CARD_UNION_LE[`{i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}`; +`{(k' - 1 + p MOD scs_k_v39 s) MOD scs_k_v39 s}`][FINITE_SING;Geomdetail.CARD_SING] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC (8) REMOVE_ASSUM_TAC +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`a= CARD + ({i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))} UNION + {(k' - 1 + p MOD scs_k_v39 s) MOD scs_k_v39 s})` +THEN ABBREV_TAC`b=CARD + {i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}` +THEN ABBREV_TAC`c=CARD + (IMAGE (\x. (x + p MOD scs_k_v39 s) MOD scs_k_v39 s) + {i | i < k' /\ + (&2 * h0 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_bm_v39 s p q + else scs_b_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)) \/ + &2 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_am_v39 s p q + else scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)))})` +THEN MP_TAC(ARITH_RULE`c<=a /\ a<= b+1 /\ k'< scs_k_v39 s/\ b + scs_k_v39 s <= 6 ==> c+k' <=6`) +THEN RESA_TAC;]);; + + + + + +let SCS_HALF_SLICE_IS_SCS_4=prove_by_refinement(` s' = scs_half_slice_v39 s p q d' mkj /\ + s'' = scs_half_slice_v39 s q p d'' mkj /\ + (scs_J_v39 s' 0 (scs_k_v39 s' -1))= mkj +/\ +(~(scs_J_v39 s' 0 (scs_k_v39 s' -1))) +/\ vv' = (\i. (vv:num->real^3) (i MOD (scs_k_v39 s')+p MOD (scs_k_v39 s))) +/\ is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q +/\ +d'< #0.9 /\ +scs_bm_v39 s p q < &4 /\ + scs_k_v39 s =4 +==> + is_scs_v39 s'`, +[STRIP_TAC +THEN MRESA_TAC (GEN_ALL SCS_K_PRIME_LE_GE)[`s:scs_v39`;`p:num`;`q:num`;`d':real`;`scs_J_v39 s' p q`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;] +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;scs_half_slice_v39;is_scs_v39;scs_diag;scs_v39_explicit] +THEN ABBREV_TAC`k'=(q + 1 + scs_k_v39 s - p MOD scs_k_v39 s) MOD scs_k_v39 s` +THEN REPEAT RESA_TAC; + +REWRITE_TAC[periodic] +THEN SET_TAC[] +; +REWRITE_TAC[periodic] +THEN SET_TAC[] +; +REWRITE_TAC[periodic] +THEN SET_TAC[] +; +REWRITE_TAC[periodic] +THEN SET_TAC[] +; +REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +; + +MRESAL_TAC MOD_EQ [`i+k':num`;`i:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`i+p+k':num`;`i+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`] +; + +MRESAL_TAC MOD_EQ [`j+k':num`;`j:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`j+p+k':num`;`j+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`] +; + +REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +; + +MRESAL_TAC MOD_EQ [`i+k':num`;`i:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`i+p+k':num`;`i+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; +MRESAL_TAC MOD_EQ [`j+k':num`;`j:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`j+p+k':num`;`j+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + + + +REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC; + +MRESAL_TAC MOD_EQ [`i+k':num`;`i:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`i+p+k':num`;`i+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + +MRESAL_TAC MOD_EQ [`j+k':num`;`j:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`j+p+k':num`;`j+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + + +REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +; + +MRESAL_TAC MOD_EQ [`i+k':num`;`i:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`i+p+k':num`;`i+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + + +MRESAL_TAC MOD_EQ [`j+k':num`;`j:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`j+p+k':num`;`j+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`] +; + +REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +; + +MRESAL_TAC MOD_EQ [`i+k':num`;`i:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`i+p+k':num`;`i+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; +MRESAL_TAC MOD_EQ [`j+k':num`;`j:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`j+p+k':num`;`j+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`({A,B}={C,D})<=> ({B,A}={C,D}) `] +THEN REWRITE_TAC[]; +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`({A,B}={C,D})<=> ({B,A}={C,D}) `] +THEN REWRITE_TAC[]; +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`({A,B}={C,D})<=> ({B,A}={C,D}) `] +THEN REWRITE_TAC[]; +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`({A,B}={C,D})<=> ({B,A}={C,D}) `] +THEN REWRITE_TAC[]; + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`({A,B}={C,D})<=> ({B,A}={C,D}) `] +THEN REWRITE_TAC[]; + + +REAL_ARITH_TAC; + +DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k'-1} \/ ~({i MOD k', j MOD k'} = {0, k'-1})`); + +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`i MOD k' + p MOD scs_k_v39 s`;`j MOD k' + p MOD scs_k_v39 s`]) +THEN REPLICATE_TAC 3 (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +REAL_ARITH_TAC; + +MP_TAC(ARITH_RULE`3<=k' ==> ~(0=k'-1)`) +THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`{i MOD k', i MOD k'} = {0, k'-1} \/ ~({i MOD k', i MOD k'} = {0, k'-1})`); + +MP_TAC(SET_RULE`{i MOD k', i MOD k'} = {0, k'-1}==> i MOD k'= 0 /\ i MOD k'= k'-1`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; + +ASM_REWRITE_TAC[]; + + +DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k'-1} \/ ~({i MOD k', j MOD k'} = {0, k'-1})`); + +ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s = 0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s p`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `q:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s (q MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `p:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`p:num`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC DIVISION[`q:num`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN REPLICATE_TAC 23 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`p MOD scs_k_v39 s`;`q MOD scs_k_v39 s`]) +THEN REPLICATE_TAC 25(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`p MOD scs_k_v39 s`;`q MOD scs_k_v39 s`]) +THEN REPLICATE_TAC 4(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s = 0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(j MOD k' + p MOD scs_k_v39 s):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (((j MOD k' + p MOD scs_k_v39 s) MOD scs_k_v39 s))`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `((i MOD k' + p MOD scs_k_v39 s)):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN REPLICATE_TAC (34-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN MRESAL_TAC DIVISION[`(i MOD k' + p MOD scs_k_v39 s):num`;`scs_k_v39 s:num`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC DIVISION[`(j MOD k' + p MOD scs_k_v39 s):num`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN STRIP_TAC +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`i MOD k':num`;`j MOD k':num`;`p MOD scs_k_v39 s`;`scs_k_v39 s`][ADD_SYM] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k':num`] +THEN MRESA_TAC MOD_LT[`j:num`;`k':num`] +THEN MP_TAC(ARITH_RULE`i< k' /\ k'< scs_k_v39 s /\ j +i< scs_k_v39 s /\ j< scs_k_v39 s`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_LT[`j:num`;`scs_k_v39 s`] +; + + + +DISJ_CASES_TAC(SET_RULE`{i MOD 3, SUC i MOD 3} = {0, 3-1} \/ ~({i MOD 3, SUC i MOD 3} = {0, 3-1})`); +ASM_REWRITE_TAC[] +; + +ASM_REWRITE_TAC[] +THEN MRESAL_TAC DIVISION[`i:num`;`k':num`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s = 0)`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`(i ) MOD 3 < 3 ==> (i ) MOD 3 =0 \/ (i ) MOD 3 =1 \/ (i ) MOD 3 =2`) +THEN RESA_TAC +; +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`0`;`3`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 0+A=A /\ 1+A= SUC A`] +THEN REPLICATE_TAC (41-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th `p MOD scs_k_v39 s` [ARITH_RULE`SUC 0=1/\ SUC 1=2/\ SUC 2=3/\ 3<4`;cstab]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`1`;`3`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 2+A=SUC(1+A) `] +THEN REPLICATE_TAC (41-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th `1+p MOD scs_k_v39 s` [ARITH_RULE`SUC 0=1/\ SUC 1=2/\ SUC 2=3/\3<4`;cstab]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`2`;`3`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 2+A=SUC(1+A) `] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;ARITH_RULE`3-1=2`] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;ARITH_RULE`3-1=2`] +THEN REPEAT STRIP_TAC) +THEN REPLICATE_TAC (3) REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC +; + + + + + + + + + +POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k' - 1} \/ ~({i MOD k', j MOD k'} = {0, k' - 1})`) +; +ASM_REWRITE_TAC[]; +MP_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k' - 1} ==> (i MOD k'= 0 /\ j MOD k' = k'-1)\/ (i MOD k'= k'-1 /\ j MOD k' = 0)`) +THEN RESA_TAC; +MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`k'-1`;`k':num`] +THEN MRESAL_TAC MOD_MULT[`k':num`;`1`][ARITH_RULE`A* 1=A`] +THEN +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`j:num`;`k'-1`;`k':num`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 2+A=SUC(1+A) `] +; + + +MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'/\ ~(scs_k_v39 s =0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`k'-1`;`k':num`] +THEN MRESAL_TAC MOD_MULT[`k':num`;`1`][ARITH_RULE`A* 1=A`] +THEN +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`k'-1`;`k':num`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 2+A=SUC(1+A) `] +; + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REPLICATE_TAC (36-23)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`(i MOD k' + p MOD scs_k_v39 s)`;`(j MOD k' + p MOD scs_k_v39 s)`][ARITH_RULE`SUC(A+B)= SUC A+B`]) + +; +MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'/\ ~(scs_k_v39 s =0)`) +THEN RESA_TAC +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`j MOD k':num`;`SUC(i MOD k'):num`;`p MOD scs_k_v39 s`;`scs_k_v39 s`][ADD_SYM] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC DIVISION[`(i):num`;`k':num`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC DIVISION[`(j):num`;`k':num`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`j MOD k' < k' /\ k'< scs_k_v39 s +/\ i MOD k' < k' ==> j MOD k' < scs_k_v39 s /\ SUC (i MOD k') < scs_k_v39 s`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`j MOD k'`;`scs_k_v39 s:num`] +THEN MRESA_TAC MOD_LT[`SUC(i MOD k')`;`scs_k_v39 s:num`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k' /\ i MOD k' < k' ==> i MOD k' =k'-1 \/ i MOD k' +1 < k' `) +THEN RESA_TAC +; + + + + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (4) REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`1:num`;`k':num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_LT[`1`;`k':num`] +THEN MRESA_TAC MOD_LT[`i MOD k' + 1`;`k':num`] +; + + + + + +MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'/\ ~(scs_k_v39 s =0)`) +THEN RESA_TAC +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`i MOD k':num`;`SUC(j MOD k'):num`;`p MOD scs_k_v39 s`;`scs_k_v39 s`][ADD_SYM] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC DIVISION[`(i):num`;`k':num`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC DIVISION[`(j):num`;`k':num`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`j MOD k' < k' /\ k'< scs_k_v39 s +/\ i MOD k' < k' ==> SUC(j MOD k') < scs_k_v39 s /\ (i MOD k') < scs_k_v39 s`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`i MOD k'`;`scs_k_v39 s:num`] +THEN MRESA_TAC MOD_LT[`SUC(j MOD k')`;`scs_k_v39 s:num`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k' /\ j MOD k' < k' ==> j MOD k' =k'-1 \/ j MOD k' +1 < k' `) +THEN RESA_TAC +; + + + + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (5) REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_ADD_MOD[`j:num`;`1:num`;`k':num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_LT[`1`;`k':num`] +THEN MRESA_TAC MOD_LT[`j MOD k' + 1`;`k':num`] +; + + + + +POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k' - 1} \/ ~({i MOD k', j MOD k'} = {0, k' - 1})`) +; + + +ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (33)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REPLICATE_TAC (36-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(i MOD k' + p MOD scs_k_v39 s)`;`(j MOD k' + p MOD scs_k_v39 s)`]) +; + +POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k' - 1} \/ ~({i MOD k', j MOD k'} = {0, k' - 1})`) +; + + +ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (33)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REPLICATE_TAC (36-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(i MOD k' + p MOD scs_k_v39 s)`;`(j MOD k' + p MOD scs_k_v39 s)`]) +; + +SUBGOAL_THEN`IMAGE (\x. (x+p MOD scs_k_v39 s )MOD scs_k_v39 s ) {i | i < k' /\ + (&2 * h0 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_bm_v39 s p q + else scs_b_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)) \/ + &2 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_am_v39 s p q + else scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)))} +SUBSET {i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))} UNION {(k'-1 + p MOD scs_k_v39 s) MOD scs_k_v39 s}` ASSUME_TAC; + + +REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING;IMAGE] +THEN GEN_TAC +THEN RESA_TAC; +REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`x' x'= k'-1\/ SUC x' < k' `) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`x':num`;`k':num`] +THEN MRESA_TAC MOD_LT[`SUC x':num`;`k':num`] +THEN DISJ_CASES_TAC(SET_RULE`{x', SUC x'} = {0, k' - 1} \/ ~({x', SUC x'} = {0, k' - 1})`) + ; + + +MP_TAC(SET_RULE`{x', SUC x'} = {0, k' - 1} ==> (x' =0 /\ SUC x' = k'-1)\/ (x' =k'-1/\ SUC x' =0)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0= k'-1<=> k'=2`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> +REPLICATE_TAC (40-32)(REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[th]) +THEN ARITH_TAC +; + + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MATCH_MP_TAC(SET_RULE`A==>A \/ B`) +THEN MP_TAC(ARITH_RULE`k' < scs_k_v39 s /\ 3<= k' /\ x'< k' /\ SUC x' < k' ==> ~(scs_k_v39 s=0) /\ x'< scs_k_v39 s/\ SUC x' < scs_k_v39 s/\ 1< scs_k_v39 s`) +THEN RESA_TAC +THEN MRESAL_TAC DIVISION[`x' + p MOD scs_k_v39 s`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN MATCH_MP_TAC(SET_RULE`A==>A \/ B`) +THEN MRESA_TAC MOD_LT[`x':num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_LT[`SUC x':num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`x':num`;`p:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`SUC x':num`;`p:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (10)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (x' + p MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(SUC x' + p MOD scs_k_v39 s):num`) +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s ((SUC x' + p) MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x' + p MOD scs_k_v39 s):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s ((x' + p) MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(SUC ((x' + p) MOD scs_k_v39 s)):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;ADD1]) +THEN MRESA_TAC MOD_LT[`1:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`(x' + p):num`;`1:num`;`scs_k_v39 s`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`(x' + p) + 1=(x' + 1) + p`] +; + + +REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`x' x'= k'-1\/ SUC x' < k' `) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`x':num`;`k':num`] +THEN MRESA_TAC MOD_LT[`SUC x':num`;`k':num`] +THEN DISJ_CASES_TAC(SET_RULE`{x', SUC x'} = {0, k' - 1} \/ ~({x', SUC x'} = {0, k' - 1})`) + ; + + +MP_TAC(SET_RULE`{x', SUC x'} = {0, k' - 1} ==> (x' =0 /\ SUC x' = k'-1)\/ (x' =k'-1/\ SUC x' =0)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0= k'-1<=> k'=2`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> +REPLICATE_TAC (40-32)(REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[th]) +THEN ARITH_TAC +; + + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MATCH_MP_TAC(SET_RULE`A==>A \/ B`) +THEN MP_TAC(ARITH_RULE`k' < scs_k_v39 s /\ 3<= k' /\ x'< k' /\ SUC x' < k' ==> ~(scs_k_v39 s=0) /\ x'< scs_k_v39 s/\ SUC x' < scs_k_v39 s/\ 1< scs_k_v39 s`) +THEN RESA_TAC +THEN MRESAL_TAC DIVISION[`x' + p MOD scs_k_v39 s`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN MATCH_MP_TAC(SET_RULE`B==>A \/ B`) +THEN MRESA_TAC MOD_LT[`x':num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_LT[`SUC x':num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`x':num`;`p:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`SUC x':num`;`p:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (10)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (x' + p MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(SUC x' + p MOD scs_k_v39 s):num`) +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((SUC x' + p) MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x' + p MOD scs_k_v39 s):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((x' + p) MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(SUC ((x' + p) MOD scs_k_v39 s)):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;ADD1]) +THEN MRESA_TAC MOD_LT[`1:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`(x' + p):num`;`1:num`;`scs_k_v39 s`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`(x' + p) + 1=(x' + 1) + p`] +; + + +SUBGOAL_THEN`CARD(IMAGE (\x. (x+p MOD scs_k_v39 s )MOD scs_k_v39 s ) {i | i < k' /\ + (&2 * h0 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_bm_v39 s p q + else scs_b_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)) \/ + &2 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_am_v39 s p q + else scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)))}) += CARD {i | i < k' /\ + (&2 * h0 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_bm_v39 s p q + else scs_b_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)) \/ + &2 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_am_v39 s p q + else scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)))}`ASSUME_TAC +; + + +MATCH_MP_TAC CARD_IMAGE_INJ +THEN STRIP_TAC; +ASM_REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'/\ ~(scs_k_v39 s =0) +/\ x< scs_k_v39 s/\ y< scs_k_v39 s`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`x:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_LT[`y:num`;`scs_k_v39 s`] +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`x:num`;`y:num`;`p MOD scs_k_v39 s`;`scs_k_v39 s`][ADD_SYM] +; +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. k'` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`FINITE + ({i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))} UNION + {(k' - 1 + p MOD scs_k_v39 s) MOD scs_k_v39 s})`ASSUME_TAC +; + + +REWRITE_TAC[FINITE_UNION;FINITE_SING] +THEN MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. (scs_k_v39 s)` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC CARD_SUBSET[`IMAGE (\x. (x+p MOD scs_k_v39 s )MOD scs_k_v39 s ) {i | i < k' /\ + (&2 * h0 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_bm_v39 s p q + else scs_b_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)) \/ + &2 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_am_v39 s p q + else scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)))}`;`{i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))} UNION {(k'-1 + p MOD scs_k_v39 s) MOD scs_k_v39 s}`] +THEN SUBGOAL_THEN`FINITE + ({i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))})`ASSUME_TAC +; + + +REWRITE_TAC[FINITE_UNION;FINITE_SING] +THEN MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. (scs_k_v39 s)` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESAL_TAC CARD_UNION_LE[`{i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}`;`{(k' - 1 + p MOD scs_k_v39 s) MOD scs_k_v39 s}`][FINITE_SING;Geomdetail.CARD_SING] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> +REPLICATE_TAC (5) REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[th]) +THEN ABBREV_TAC`a={i | i < 4 /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}` +THEN ABBREV_TAC`b=CARD + (IMAGE (\x. (x + p MOD 4) MOD 4) + {i | i < k' /\ + (&2 * h0 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_bm_v39 s p q + else scs_b_v39 s (i MOD k' + p MOD 4) (SUC i MOD k' + p MOD 4)) \/ + &2 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_am_v39 s p q + else scs_a_v39 s (i MOD k' + p MOD 4) (SUC i MOD k' + p MOD 4)))})` +THEN ABBREV_TAC`c=CARD (a UNION {(k' - 1 + p MOD 4) MOD 4})` +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC;]);; + + + + + +let IS_EAR_IS_SCS=prove(`is_ear_v39 s +==> is_scs_v39 s`, +REWRITE_TAC[is_ear_v39;is_scs_v39] +THEN RESA_TAC);; + + + +let SCS_HALF_SLICE_IS_SCS_4_PRIME=prove_by_refinement( +` s' = scs_half_slice_v39 s p q d' mkj /\ + s'' = scs_half_slice_v39 s q p d'' mkj /\ + (scs_J_v39 s' 0 (scs_k_v39 s' -1))= mkj +/\ +(is_ear_v39 s'') +/\ vv' = (\i. (vv:num->real^3) (i MOD (scs_k_v39 s')+p MOD (scs_k_v39 s))) +/\ is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q +/\ +d'< #0.9 /\ +scs_bm_v39 s p q < &4 /\ + scs_k_v39 s =4 +==> + is_scs_v39 s'`, +[ +STRIP_TAC +THEN MRESA_TAC (GEN_ALL SCS_K_PRIME_LE_GE)[`s:scs_v39`;`p:num`;`q:num`;`d':real`;`scs_J_v39 s' p q`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;] +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;scs_half_slice_v39;is_scs_v39;scs_diag;scs_v39_explicit] +THEN ABBREV_TAC`k'=(q + 1 + scs_k_v39 s - p MOD scs_k_v39 s) MOD scs_k_v39 s` +THEN REPEAT RESA_TAC; + +REWRITE_TAC[periodic] +THEN SET_TAC[] +; +REWRITE_TAC[periodic] +THEN SET_TAC[] +; +REWRITE_TAC[periodic] +THEN SET_TAC[] +; +REWRITE_TAC[periodic] +THEN SET_TAC[] +; +REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +; + +MRESAL_TAC MOD_EQ [`i+k':num`;`i:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`i+p+k':num`;`i+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`] +; + +MRESAL_TAC MOD_EQ [`j+k':num`;`j:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`j+p+k':num`;`j+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`] +; + +REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +; + +MRESAL_TAC MOD_EQ [`i+k':num`;`i:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`i+p+k':num`;`i+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; +MRESAL_TAC MOD_EQ [`j+k':num`;`j:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`j+p+k':num`;`j+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + + + +REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC; + +MRESAL_TAC MOD_EQ [`i+k':num`;`i:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`i+p+k':num`;`i+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + +MRESAL_TAC MOD_EQ [`j+k':num`;`j:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`j+p+k':num`;`j+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + + +REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +; + +MRESAL_TAC MOD_EQ [`i+k':num`;`i:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`i+p+k':num`;`i+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + + +MRESAL_TAC MOD_EQ [`j+k':num`;`j:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`j+p+k':num`;`j+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`] +; + +REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +; + +MRESAL_TAC MOD_EQ [`i+k':num`;`i:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`i+p+k':num`;`i+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; +MRESAL_TAC MOD_EQ [`j+k':num`;`j:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`j+p+k':num`;`j+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`({A,B}={C,D})<=> ({B,A}={C,D}) `] +THEN REWRITE_TAC[]; +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`({A,B}={C,D})<=> ({B,A}={C,D}) `] +THEN REWRITE_TAC[]; +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`({A,B}={C,D})<=> ({B,A}={C,D}) `] +THEN REWRITE_TAC[]; +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`({A,B}={C,D})<=> ({B,A}={C,D}) `] +THEN REWRITE_TAC[]; + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`({A,B}={C,D})<=> ({B,A}={C,D}) `] +THEN REWRITE_TAC[]; + + +REAL_ARITH_TAC; + +DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k'-1} \/ ~({i MOD k', j MOD k'} = {0, k'-1})`); + +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`i MOD k' + p MOD scs_k_v39 s`;`j MOD k' + p MOD scs_k_v39 s`]) +THEN REPLICATE_TAC 3 (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +REAL_ARITH_TAC; + +MP_TAC(ARITH_RULE`3<=k' ==> ~(0=k'-1)`) +THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`{i MOD k', i MOD k'} = {0, k'-1} \/ ~({i MOD k', i MOD k'} = {0, k'-1})`); + +MP_TAC(SET_RULE`{i MOD k', i MOD k'} = {0, k'-1}==> i MOD k'= 0 /\ i MOD k'= k'-1`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; + +ASM_REWRITE_TAC[]; + + +DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k'-1} \/ ~({i MOD k', j MOD k'} = {0, k'-1})`); + +ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s = 0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s p`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `q:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s (q MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `p:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`p:num`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC DIVISION[`q:num`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN REPLICATE_TAC 23 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`p MOD scs_k_v39 s`;`q MOD scs_k_v39 s`]) +THEN REPLICATE_TAC 25(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`p MOD scs_k_v39 s`;`q MOD scs_k_v39 s`]) +THEN REPLICATE_TAC 4(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s = 0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(j MOD k' + p MOD scs_k_v39 s):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (((j MOD k' + p MOD scs_k_v39 s) MOD scs_k_v39 s))`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `((i MOD k' + p MOD scs_k_v39 s)):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN REPLICATE_TAC (34-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN MRESAL_TAC DIVISION[`(i MOD k' + p MOD scs_k_v39 s):num`;`scs_k_v39 s:num`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC DIVISION[`(j MOD k' + p MOD scs_k_v39 s):num`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN STRIP_TAC +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`i MOD k':num`;`j MOD k':num`;`p MOD scs_k_v39 s`;`scs_k_v39 s`][ADD_SYM] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k':num`] +THEN MRESA_TAC MOD_LT[`j:num`;`k':num`] +THEN MP_TAC(ARITH_RULE`i< k' /\ k'< scs_k_v39 s /\ j +i< scs_k_v39 s /\ j< scs_k_v39 s`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_LT[`j:num`;`scs_k_v39 s`] +; + + + +DISJ_CASES_TAC(SET_RULE`{i MOD 3, SUC i MOD 3} = {0, 3-1} \/ ~({i MOD 3, SUC i MOD 3} = {0, 3-1})`); +ASM_REWRITE_TAC[] +; + +ASM_REWRITE_TAC[] +THEN MRESAL_TAC DIVISION[`i:num`;`k':num`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s = 0)`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`(i ) MOD 3 < 3 ==> (i ) MOD 3 =0 \/ (i ) MOD 3 =1 \/ (i ) MOD 3 =2`) +THEN RESA_TAC +; +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`0`;`3`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 0+A=A /\ 1+A= SUC A`] +THEN REPLICATE_TAC (41-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th `p MOD scs_k_v39 s` [ARITH_RULE`SUC 0=1/\ SUC 1=2/\ SUC 2=3/\ 3<4`;cstab]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`1`;`3`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 2+A=SUC(1+A) `] +THEN REPLICATE_TAC (41-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th `1+p MOD scs_k_v39 s` [ARITH_RULE`SUC 0=1/\ SUC 1=2/\ SUC 2=3/\3<4`;cstab]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`2`;`3`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 2+A=SUC(1+A) `] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;ARITH_RULE`3-1=2`] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;ARITH_RULE`3-1=2`] +THEN REPEAT STRIP_TAC) +THEN REPLICATE_TAC (3) REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC +; + + + + + + + + + +POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k' - 1} \/ ~({i MOD k', j MOD k'} = {0, k' - 1})`) +; +ASM_REWRITE_TAC[]; +MP_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k' - 1} ==> (i MOD k'= 0 /\ j MOD k' = k'-1)\/ (i MOD k'= k'-1 /\ j MOD k' = 0)`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`k'-1`;`k':num`] +THEN MRESAL_TAC MOD_MULT[`k':num`;`1`][ARITH_RULE`A* 1=A`] +THEN +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`j:num`;`k'-1`;`k':num`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 2+A=SUC(1+A) `] +; + + +MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'/\ ~(scs_k_v39 s =0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`k'-1`;`k':num`] +THEN MRESAL_TAC MOD_MULT[`k':num`;`1`][ARITH_RULE`A* 1=A`] +THEN +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`k'-1`;`k':num`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 2+A=SUC(1+A) `] +; + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REPLICATE_TAC (36-23)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`(i MOD k' + p MOD scs_k_v39 s)`;`(j MOD k' + p MOD scs_k_v39 s)`][ARITH_RULE`SUC(A+B)= SUC A+B`]) + +; + +MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'/\ ~(scs_k_v39 s =0)`) +THEN RESA_TAC +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`j MOD k':num`;`SUC(i MOD k'):num`;`p MOD scs_k_v39 s`;`scs_k_v39 s`][ADD_SYM] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC DIVISION[`(i):num`;`k':num`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC DIVISION[`(j):num`;`k':num`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`j MOD k' < k' /\ k'< scs_k_v39 s +/\ i MOD k' < k' ==> j MOD k' < scs_k_v39 s /\ SUC (i MOD k') < scs_k_v39 s`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`j MOD k'`;`scs_k_v39 s:num`] +THEN MRESA_TAC MOD_LT[`SUC(i MOD k')`;`scs_k_v39 s:num`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k' /\ i MOD k' < k' ==> i MOD k' =k'-1 \/ i MOD k' +1 < k' `) +THEN RESA_TAC +; + + + + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (4) REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`1:num`;`k':num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_LT[`1`;`k':num`] +THEN MRESA_TAC MOD_LT[`i MOD k' + 1`;`k':num`] +; + + + + + +MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'/\ ~(scs_k_v39 s =0)`) +THEN RESA_TAC +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`i MOD k':num`;`SUC(j MOD k'):num`;`p MOD scs_k_v39 s`;`scs_k_v39 s`][ADD_SYM] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC DIVISION[`(i):num`;`k':num`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC DIVISION[`(j):num`;`k':num`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`j MOD k' < k' /\ k'< scs_k_v39 s +/\ i MOD k' < k' ==> SUC(j MOD k') < scs_k_v39 s /\ (i MOD k') < scs_k_v39 s`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`i MOD k'`;`scs_k_v39 s:num`] +THEN MRESA_TAC MOD_LT[`SUC(j MOD k')`;`scs_k_v39 s:num`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k' /\ j MOD k' < k' ==> j MOD k' =k'-1 \/ j MOD k' +1 < k' `) +THEN RESA_TAC +; + + + + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (5) REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_ADD_MOD[`j:num`;`1:num`;`k':num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_LT[`1`;`k':num`] +THEN MRESA_TAC MOD_LT[`j MOD k' + 1`;`k':num`] +; + + + + +POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k' - 1} \/ ~({i MOD k', j MOD k'} = {0, k' - 1})`) +; + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REPLICATE_TAC (36-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[is_ear_v39;scs_half_slice_v39;LET_DEF;LET_END_DEF;scs_half_slice_v39;is_scs_v39;scs_diag;scs_v39_explicit]) +THEN STRIP_TAC +THEN ABBREV_TAC`k''=(p + 1 + 4 - q MOD 4) MOD 4` +THEN SUBGOAL_THEN`k'' -1 IN {i | i < 3 /\ + (if {i MOD k'', SUC i MOD k''} = {0, k'' - 1} + then T + else scs_J_v39 s (i MOD k'' + q MOD 4) (SUC i MOD k'' + q MOD 4))}` ASSUME_TAC +; + +REWRITE_TAC[IN_ELIM_THM] +THEN ASM_REWRITE_TAC[ARITH_RULE`3-1=2 /\ 2<3 /\ 2 MOD 3=2/\ SUC 2=3/\ 3 MOD 3=0 `]; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`3-1=2`;SET_RULE`( a = b <=> b=a)`;IN_SING] +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[ARITH_RULE`3-1=2 /\ 2<3 /\ 2 MOD 3=2/\ SUC 2=3/\ 3 MOD 3=0 `]; + + + + + + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REPLICATE_TAC (36-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(i MOD k' + p MOD scs_k_v39 s)`;`(j MOD k' + p MOD scs_k_v39 s)`]) +; + +POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k' - 1} \/ ~({i MOD k', j MOD k'} = {0, k' - 1})`) +; + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REPLICATE_TAC (36-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[is_ear_v39;scs_half_slice_v39;LET_DEF;LET_END_DEF;scs_half_slice_v39;is_scs_v39;scs_diag;scs_v39_explicit]) +THEN STRIP_TAC +THEN ABBREV_TAC`k''=(p + 1 + 4 - q MOD 4) MOD 4` +THEN SUBGOAL_THEN`k'' -1 IN {i | i < 3 /\ + (if {i MOD k'', SUC i MOD k''} = {0, k'' - 1} + then T + else scs_J_v39 s (i MOD k'' + q MOD 4) (SUC i MOD k'' + q MOD 4))}` ASSUME_TAC +; + +REWRITE_TAC[IN_ELIM_THM] +THEN ASM_REWRITE_TAC[ARITH_RULE`3-1=2 /\ 2<3 /\ 2 MOD 3=2/\ SUC 2=3/\ 3 MOD 3=0 `]; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`3-1=2`;SET_RULE`( a = b <=> b=a)`;IN_SING] +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[ARITH_RULE`3-1=2 /\ 2<3 /\ 2 MOD 3=2/\ SUC 2=3/\ 3 MOD 3=0 `] +THEN RESA_TAC; + + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REPLICATE_TAC (36-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(i MOD k' + p MOD scs_k_v39 s)`;`(j MOD k' + p MOD scs_k_v39 s)`]) +; + +SUBGOAL_THEN`IMAGE (\x. (x+p MOD scs_k_v39 s )MOD scs_k_v39 s ) {i | i < k' /\ + (&2 * h0 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_bm_v39 s p q + else scs_b_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)) \/ + &2 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_am_v39 s p q + else scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)))} +SUBSET {i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))} UNION {(k'-1 + p MOD scs_k_v39 s) MOD scs_k_v39 s}` ASSUME_TAC; + + +REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING;IMAGE] +THEN GEN_TAC +THEN RESA_TAC; +REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`x' x'= k'-1\/ SUC x' < k' `) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`x':num`;`k':num`] +THEN MRESA_TAC MOD_LT[`SUC x':num`;`k':num`] +THEN DISJ_CASES_TAC(SET_RULE`{x', SUC x'} = {0, k' - 1} \/ ~({x', SUC x'} = {0, k' - 1})`) + ; + + +MP_TAC(SET_RULE`{x', SUC x'} = {0, k' - 1} ==> (x' =0 /\ SUC x' = k'-1)\/ (x' =k'-1/\ SUC x' =0)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0= k'-1<=> k'=2`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> +REPLICATE_TAC (40-32)(REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[th]) +THEN ARITH_TAC +; + + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MATCH_MP_TAC(SET_RULE`A==>A \/ B`) +THEN MP_TAC(ARITH_RULE`k' < scs_k_v39 s /\ 3<= k' /\ x'< k' /\ SUC x' < k' ==> ~(scs_k_v39 s=0) /\ x'< scs_k_v39 s/\ SUC x' < scs_k_v39 s/\ 1< scs_k_v39 s`) +THEN RESA_TAC +THEN MRESAL_TAC DIVISION[`x' + p MOD scs_k_v39 s`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN MATCH_MP_TAC(SET_RULE`A==>A \/ B`) +THEN MRESA_TAC MOD_LT[`x':num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_LT[`SUC x':num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`x':num`;`p:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`SUC x':num`;`p:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (10)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (x' + p MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(SUC x' + p MOD scs_k_v39 s):num`) +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s ((SUC x' + p) MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x' + p MOD scs_k_v39 s):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s ((x' + p) MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(SUC ((x' + p) MOD scs_k_v39 s)):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;ADD1]) +THEN MRESA_TAC MOD_LT[`1:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`(x' + p):num`;`1:num`;`scs_k_v39 s`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`(x' + p) + 1=(x' + 1) + p`] +; + + +REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`x' x'= k'-1\/ SUC x' < k' `) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`x':num`;`k':num`] +THEN MRESA_TAC MOD_LT[`SUC x':num`;`k':num`] +THEN DISJ_CASES_TAC(SET_RULE`{x', SUC x'} = {0, k' - 1} \/ ~({x', SUC x'} = {0, k' - 1})`) + ; + + +MP_TAC(SET_RULE`{x', SUC x'} = {0, k' - 1} ==> (x' =0 /\ SUC x' = k'-1)\/ (x' =k'-1/\ SUC x' =0)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0= k'-1<=> k'=2`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> +REPLICATE_TAC (40-32)(REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[th]) +THEN ARITH_TAC +; + + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MATCH_MP_TAC(SET_RULE`A==>A \/ B`) +THEN MP_TAC(ARITH_RULE`k' < scs_k_v39 s /\ 3<= k' /\ x'< k' /\ SUC x' < k' ==> ~(scs_k_v39 s=0) /\ x'< scs_k_v39 s/\ SUC x' < scs_k_v39 s/\ 1< scs_k_v39 s`) +THEN RESA_TAC +THEN MRESAL_TAC DIVISION[`x' + p MOD scs_k_v39 s`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN MATCH_MP_TAC(SET_RULE`B==>A \/ B`) +THEN MRESA_TAC MOD_LT[`x':num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_LT[`SUC x':num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`x':num`;`p:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`SUC x':num`;`p:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (10)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (x' + p MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(SUC x' + p MOD scs_k_v39 s):num`) +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((SUC x' + p) MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x' + p MOD scs_k_v39 s):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((x' + p) MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(SUC ((x' + p) MOD scs_k_v39 s)):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;ADD1]) +THEN MRESA_TAC MOD_LT[`1:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`(x' + p):num`;`1:num`;`scs_k_v39 s`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`(x' + p) + 1=(x' + 1) + p`] +; + + +SUBGOAL_THEN`CARD(IMAGE (\x. (x+p MOD scs_k_v39 s )MOD scs_k_v39 s ) {i | i < k' /\ + (&2 * h0 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_bm_v39 s p q + else scs_b_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)) \/ + &2 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_am_v39 s p q + else scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)))}) += CARD {i | i < k' /\ + (&2 * h0 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_bm_v39 s p q + else scs_b_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)) \/ + &2 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_am_v39 s p q + else scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)))}`ASSUME_TAC +; + + +MATCH_MP_TAC CARD_IMAGE_INJ +THEN STRIP_TAC; +ASM_REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'/\ ~(scs_k_v39 s =0) +/\ x< scs_k_v39 s/\ y< scs_k_v39 s`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`x:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_LT[`y:num`;`scs_k_v39 s`] +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`x:num`;`y:num`;`p MOD scs_k_v39 s`;`scs_k_v39 s`][ADD_SYM] +; +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. k'` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`FINITE + ({i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))} UNION + {(k' - 1 + p MOD scs_k_v39 s) MOD scs_k_v39 s})`ASSUME_TAC +; + + +REWRITE_TAC[FINITE_UNION;FINITE_SING] +THEN MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. (scs_k_v39 s)` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC CARD_SUBSET[`IMAGE (\x. (x+p MOD scs_k_v39 s )MOD scs_k_v39 s ) {i | i < k' /\ + (&2 * h0 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_bm_v39 s p q + else scs_b_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)) \/ + &2 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_am_v39 s p q + else scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)))}`;`{i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))} UNION {(k'-1 + p MOD scs_k_v39 s) MOD scs_k_v39 s}`] +THEN SUBGOAL_THEN`FINITE + ({i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))})`ASSUME_TAC +; + + +REWRITE_TAC[FINITE_UNION;FINITE_SING] +THEN MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. (scs_k_v39 s)` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESAL_TAC CARD_UNION_LE[`{i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}`;`{(k' - 1 + p MOD scs_k_v39 s) MOD scs_k_v39 s}`][FINITE_SING;Geomdetail.CARD_SING] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> +REPLICATE_TAC (5) REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[th]) +THEN ABBREV_TAC`a={i | i < 4 /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}` +THEN ABBREV_TAC`b=CARD + (IMAGE (\x. (x + p MOD 4) MOD 4) + {i | i < k' /\ + (&2 * h0 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_bm_v39 s p q + else scs_b_v39 s (i MOD k' + p MOD 4) (SUC i MOD k' + p MOD 4)) \/ + &2 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_am_v39 s p q + else scs_a_v39 s (i MOD k' + p MOD 4) (SUC i MOD k' + p MOD 4)))})` +THEN ABBREV_TAC`c=CARD (a UNION {(k' - 1 + p MOD 4) MOD 4})` +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC]);; + + + + + +let SCS_HALF_SLICE_IS_SCS_PRIME=prove_by_refinement( +` s' = scs_half_slice_v39 s p q d' mkj /\ + s'' = scs_half_slice_v39 s q p d'' mkj /\ + (scs_J_v39 s' 0 (scs_k_v39 s' -1))= mkj +/\ +(is_ear_v39 s'') +/\ vv' = (\i. (vv:num->real^3) (i MOD (scs_k_v39 s')+p MOD (scs_k_v39 s))) +/\ is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q +/\ +d'< #0.9 /\ +scs_bm_v39 s p q < &4 /\ +(4 scs_bm_v39 s p q <= cstab) +==> + is_scs_v39 s'`, +[ +STRIP_TAC +THEN MRESA_TAC (GEN_ALL SCS_K_PRIME_LE_GE)[`s:scs_v39`;`p:num`;`q:num`;`d':real`;`scs_J_v39 s' p q`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;] +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;scs_half_slice_v39;is_scs_v39;scs_diag;scs_v39_explicit] +THEN ABBREV_TAC`k'=(q + 1 + scs_k_v39 s - p MOD scs_k_v39 s) MOD scs_k_v39 s` +THEN REPEAT RESA_TAC; + + + +REWRITE_TAC[periodic] +THEN SET_TAC[] +; + + +REWRITE_TAC[periodic] +THEN SET_TAC[] +; + + +REWRITE_TAC[periodic] +THEN SET_TAC[] +; + + +REWRITE_TAC[periodic] +THEN SET_TAC[] +; + + +REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +; + + + +MRESAL_TAC MOD_EQ [`i+k':num`;`i:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`i+p+k':num`;`i+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`] +; + + + +MRESAL_TAC MOD_EQ [`j+k':num`;`j:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`j+p+k':num`;`j+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`] +; + + + +REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +; + + + +MRESAL_TAC MOD_EQ [`i+k':num`;`i:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`i+p+k':num`;`i+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + + +MRESAL_TAC MOD_EQ [`j+k':num`;`j:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`j+p+k':num`;`j+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + + + + + +REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC; + + + +MRESAL_TAC MOD_EQ [`i+k':num`;`i:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`i+p+k':num`;`i+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + + + +MRESAL_TAC MOD_EQ [`j+k':num`;`j:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`j+p+k':num`;`j+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + + + + +REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +; + + + +MRESAL_TAC MOD_EQ [`i+k':num`;`i:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`i+p+k':num`;`i+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + + + + +MRESAL_TAC MOD_EQ [`j+k':num`;`j:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`j+p+k':num`;`j+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`] +; + + + +REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +; + + + +MRESAL_TAC MOD_EQ [`i+k':num`;`i:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`i+p+k':num`;`i+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + + +MRESAL_TAC MOD_EQ [`j+k':num`;`j:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ (i + k') + p = i+p+k'`] +THEN MRESAL_TAC MOD_EQ [`j+p+k':num`;`j+p:num`;`k':num`;`1`][ARITH_RULE`1* k'=k'/\ i + p + k' = (i + p) + k'`]; + + + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`({A,B}={C,D})<=> ({B,A}={C,D}) `] +THEN REWRITE_TAC[]; + + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`({A,B}={C,D})<=> ({B,A}={C,D}) `] +THEN REWRITE_TAC[]; + + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`({A,B}={C,D})<=> ({B,A}={C,D}) `] +THEN REWRITE_TAC[]; + + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`({A,B}={C,D})<=> ({B,A}={C,D}) `] +THEN REWRITE_TAC[]; + + + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`({A,B}={C,D})<=> ({B,A}={C,D}) `] +THEN REWRITE_TAC[]; + + + + +REAL_ARITH_TAC; + + + +DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k'-1} \/ ~({i MOD k', j MOD k'} = {0, k'-1})`); + + + +ASM_REWRITE_TAC[]; + + +ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (17)(REMOVE_ASSUM_TAC) +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i MOD k' + p MOD scs_k_v39 s`;`j MOD k' + p MOD scs_k_v39 s`]) +THEN REPLICATE_TAC 3 (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC +; + + + +REAL_ARITH_TAC; + + + +MP_TAC(ARITH_RULE`3<=k' ==> ~(0=k'-1)`) +THEN RESA_TAC +THEN DISJ_CASES_TAC(SET_RULE`{i MOD k', i MOD k'} = {0, k'-1} \/ ~({i MOD k', i MOD k'} = {0, k'-1})`); + + + +MP_TAC(SET_RULE`{i MOD k', i MOD k'} = {0, k'-1}==> i MOD k'= 0 /\ i MOD k'= k'-1`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; + + + +ASM_REWRITE_TAC[]; + + + + +DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k'-1} \/ ~({i MOD k', j MOD k'} = {0, k'-1})`); + + + +ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s = 0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s p`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `q:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s (q MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `p:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`p:num`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC DIVISION[`q:num`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN REPLICATE_TAC 23 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`p MOD scs_k_v39 s`;`q MOD scs_k_v39 s`]) +THEN REPLICATE_TAC 25(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`p MOD scs_k_v39 s`;`q MOD scs_k_v39 s`]) +THEN REPLICATE_TAC 4(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + + + +ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s = 0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(j MOD k' + p MOD scs_k_v39 s):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (((j MOD k' + p MOD scs_k_v39 s) MOD scs_k_v39 s))`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `((i MOD k' + p MOD scs_k_v39 s)):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN REPLICATE_TAC (34-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN MRESAL_TAC DIVISION[`(i MOD k' + p MOD scs_k_v39 s):num`;`scs_k_v39 s:num`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC DIVISION[`(j MOD k' + p MOD scs_k_v39 s):num`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN STRIP_TAC +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`i MOD k':num`;`j MOD k':num`;`p MOD scs_k_v39 s`;`scs_k_v39 s`][ADD_SYM] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`k':num`] +THEN MRESA_TAC MOD_LT[`j:num`;`k':num`] +THEN MP_TAC(ARITH_RULE`i< k' /\ k'< scs_k_v39 s /\ j +i< scs_k_v39 s /\ j< scs_k_v39 s`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_LT[`j:num`;`scs_k_v39 s`] +; + + + + + +DISJ_CASES_TAC(SET_RULE`{i MOD 3, SUC i MOD 3} = {0, 3-1} \/ ~({i MOD 3, SUC i MOD 3} = {0, 3-1})`); + + +ASM_REWRITE_TAC[] +; + + + +ASM_REWRITE_TAC[] +THEN MRESAL_TAC DIVISION[`i:num`;`k':num`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s = 0)`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`(i ) MOD 3 < 3 ==> (i ) MOD 3 =0 \/ (i ) MOD 3 =1 \/ (i ) MOD 3 =2`) +THEN RESA_TAC +; + + +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`0`;`3`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 0+A=A /\ 1+A= SUC A`] +THEN REPLICATE_TAC (37-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th `p MOD scs_k_v39 s` [ARITH_RULE`SUC 0=1/\ SUC 1=2/\ SUC 2=3`;cstab]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + + + +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`1`;`3`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 2+A=SUC(1+A) `] +THEN REPLICATE_TAC (37-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th `1+p MOD scs_k_v39 s` [ARITH_RULE`SUC 0=1/\ SUC 1=2/\ SUC 2=3`;cstab]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + + +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`2`;`3`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 2+A=SUC(1+A) `] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;ARITH_RULE`3-1=2`] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;ARITH_RULE`3-1=2`] +THEN REPEAT STRIP_TAC) +THEN REPLICATE_TAC (4) REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + + + + + + + + + + +DISJ_CASES_TAC(SET_RULE`{i MOD k', SUC i MOD k'} = {0, k'-1} \/ ~({i MOD k', SUC i MOD k'} = {0, k'-1})`); + + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3 4< scs_k_v39 s`) +THEN RESA_TAC +THEN REPLICATE_TAC (6) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN RESA_TAC +; + + + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'`) +THEN RESA_TAC +THEN MRESAL_TAC DIVISION[`i:num`;`k':num`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s = 0)`) +THEN RESA_TAC +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`1:num`;`k':num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_LT[`1`;`k':num`] +THEN MP_TAC(ARITH_RULE`3 i MOD k' =k'-1 \/ i MOD k' +1 < k' `) +THEN RESA_TAC +; + + + + +MRESA_TAC MOD_LT[`k'-1`;`k':num`] +THEN MRESAL_TAC MOD_MULT[`k':num`;`1`][ARITH_RULE`A* 1=A`] +THEN +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`k'-1`;`k':num`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 2+A=SUC(1+A) `] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN REPLICATE_TAC (2) REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN REPLICATE_TAC (8) REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + + + +MRESAL_TAC MOD_LT[`i MOD k' +1`;`k':num`][ARITH_RULE`(i MOD k' + 1) + p MOD scs_k_v39 s= SUC(i MOD k' + p MOD scs_k_v39 s)`] +THEN REPLICATE_TAC (42-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + + + +POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k' - 1} \/ ~({i MOD k', j MOD k'} = {0, k' - 1})`) +; + + +ASM_REWRITE_TAC[]; + + +MP_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k' - 1} ==> (i MOD k'= 0 /\ j MOD k' = k'-1)\/ (i MOD k'= k'-1 /\ j MOD k' = 0)`) +THEN RESA_TAC; + + +MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`k'-1`;`k':num`] +THEN MRESAL_TAC MOD_MULT[`k':num`;`1`][ARITH_RULE`A* 1=A`] +THEN +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`j:num`;`k'-1`;`k':num`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 2+A=SUC(1+A) `] +; + + + + +MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'/\ ~(scs_k_v39 s =0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`k'-1`;`k':num`] +THEN MRESAL_TAC MOD_MULT[`k':num`;`1`][ARITH_RULE`A* 1=A`] +THEN +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`k'-1`;`k':num`][ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1/\ 2 MOD 3=2/\ SUC 0=1/\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ ~(3=0)/\ 2+A=SUC(1+A) `] +; + + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REPLICATE_TAC (31-18)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`(i MOD k' + p MOD scs_k_v39 s)`;`(j MOD k' + p MOD scs_k_v39 s)`][ARITH_RULE`SUC(A+B)= SUC A+B`]) + +; + + +MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'/\ ~(scs_k_v39 s =0)`) +THEN RESA_TAC +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`j MOD k':num`;`SUC(i MOD k'):num`;`p MOD scs_k_v39 s`;`scs_k_v39 s`][ADD_SYM] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC DIVISION[`(i):num`;`k':num`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC DIVISION[`(j):num`;`k':num`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`j MOD k' < k' /\ k'< scs_k_v39 s +/\ i MOD k' < k' ==> j MOD k' < scs_k_v39 s /\ SUC (i MOD k') < scs_k_v39 s`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`j MOD k'`;`scs_k_v39 s:num`] +THEN MRESA_TAC MOD_LT[`SUC(i MOD k')`;`scs_k_v39 s:num`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k' /\ i MOD k' < k' ==> i MOD k' =k'-1 \/ i MOD k' +1 < k' `) +THEN RESA_TAC +; + + + + + + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (4) REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + + + +REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`1:num`;`k':num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_LT[`1`;`k':num`] +THEN MRESA_TAC MOD_LT[`i MOD k' + 1`;`k':num`] +; + + + + + + + +MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'/\ ~(scs_k_v39 s =0)`) +THEN RESA_TAC +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`i MOD k':num`;`SUC(j MOD k'):num`;`p MOD scs_k_v39 s`;`scs_k_v39 s`][ADD_SYM] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC DIVISION[`(i):num`;`k':num`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC DIVISION[`(j):num`;`k':num`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`j MOD k' < k' /\ k'< scs_k_v39 s +/\ i MOD k' < k' ==> SUC(j MOD k') < scs_k_v39 s /\ (i MOD k') < scs_k_v39 s`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`i MOD k'`;`scs_k_v39 s:num`] +THEN MRESA_TAC MOD_LT[`SUC(j MOD k')`;`scs_k_v39 s:num`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k' /\ j MOD k' < k' ==> j MOD k' =k'-1 \/ j MOD k' +1 < k' `) +THEN RESA_TAC +; + + + + + + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (5) REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + + + +REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_ADD_MOD[`j:num`;`1:num`;`k':num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_LT[`1`;`k':num`] +THEN MRESA_TAC MOD_LT[`j MOD k' + 1`;`k':num`] +; + + + + + + +POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k' - 1} \/ ~({i MOD k', j MOD k'} = {0, k' - 1})`) +; + + + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REPLICATE_TAC (36-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[is_ear_v39;scs_half_slice_v39;LET_DEF;LET_END_DEF;scs_half_slice_v39;is_scs_v39;scs_diag;scs_v39_explicit]) +THEN STRIP_TAC +THEN ABBREV_TAC`k''=(p + 1 + scs_k_v39 s - q MOD scs_k_v39 s) MOD scs_k_v39 s` +THEN SUBGOAL_THEN`k'' -1 IN {i | i < 3 /\ + (if {i MOD k'', SUC i MOD k''} = {0, k'' - 1} + then T + else scs_J_v39 s (i MOD k'' + q MOD scs_k_v39 s) + (SUC i MOD k'' + q MOD scs_k_v39 s))}` ASSUME_TAC +; + +REWRITE_TAC[IN_ELIM_THM] +THEN ASM_REWRITE_TAC[ARITH_RULE`3-1=2 /\ 2<3 /\ 2 MOD 3=2/\ SUC 2=3/\ 3 MOD 3=0 `;SET_RULE`{A,B}={B,A}`]; + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`3-1=2`;SET_RULE`( a = b <=> b=a)`;IN_SING] +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[ARITH_RULE`3-1=2 /\ 2<3 /\ 2 MOD 3=2/\ SUC 2=3/\ 3 MOD 3=0 `] +THEN RESA_TAC; + + + + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REPLICATE_TAC (36-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(i MOD k' + p MOD scs_k_v39 s)`;`(j MOD k' + p MOD scs_k_v39 s)`]) +; + + + +POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k' - 1} \/ ~({i MOD k', j MOD k'} = {0, k' - 1})`) +; + + + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REPLICATE_TAC (36-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[is_ear_v39;scs_half_slice_v39;LET_DEF;LET_END_DEF;scs_half_slice_v39;is_scs_v39;scs_diag;scs_v39_explicit]) +THEN STRIP_TAC +THEN ABBREV_TAC`k''=(p + 1 + scs_k_v39 s - q MOD scs_k_v39 s) MOD scs_k_v39 s` +THEN SUBGOAL_THEN`k'' -1 IN {i | i < 3 /\ + (if {i MOD k'', SUC i MOD k''} = {0, k'' - 1} + then T + else scs_J_v39 s (i MOD k'' + q MOD scs_k_v39 s) + (SUC i MOD k'' + q MOD scs_k_v39 s))}` ASSUME_TAC +; + +REWRITE_TAC[IN_ELIM_THM] +THEN ASM_REWRITE_TAC[ARITH_RULE`3-1=2 /\ 2<3 /\ 2 MOD 3=2/\ SUC 2=3/\ 3 MOD 3=0 `;SET_RULE`{A,B}={B,A}`]; + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`3-1=2`;SET_RULE`( a = b <=> b=a)`;IN_SING] +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[ARITH_RULE`3-1=2 /\ 2<3 /\ 2 MOD 3=2/\ SUC 2=3/\ 3 MOD 3=0 `] +THEN RESA_TAC; + + + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REPLICATE_TAC (36-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(i MOD k' + p MOD scs_k_v39 s)`;`(j MOD k' + p MOD scs_k_v39 s)`]) +; + + + +SUBGOAL_THEN`IMAGE (\x. (x+p MOD scs_k_v39 s )MOD scs_k_v39 s ) {i | i < k' /\ + (&2 * h0 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_bm_v39 s p q + else scs_b_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)) \/ + &2 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_am_v39 s p q + else scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)))} +SUBSET {i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))} UNION {(k'-1 + p MOD scs_k_v39 s) MOD scs_k_v39 s}` ASSUME_TAC; + + + + +REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;IN_SING;IMAGE] +THEN GEN_TAC +THEN RESA_TAC; + + +REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`x' x'= k'-1\/ SUC x' < k' `) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`x':num`;`k':num`] +THEN MRESA_TAC MOD_LT[`SUC x':num`;`k':num`] +THEN DISJ_CASES_TAC(SET_RULE`{x', SUC x'} = {0, k' - 1} \/ ~({x', SUC x'} = {0, k' - 1})`) + ; + + + + +MP_TAC(SET_RULE`{x', SUC x'} = {0, k' - 1} ==> (x' =0 /\ SUC x' = k'-1)\/ (x' =k'-1/\ SUC x' =0)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0= k'-1<=> k'=2`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> +REPLICATE_TAC (40-32)(REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[th]) +THEN ARITH_TAC +; + + + + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MATCH_MP_TAC(SET_RULE`A==>A \/ B`) +THEN MP_TAC(ARITH_RULE`k' < scs_k_v39 s /\ 3<= k' /\ x'< k' /\ SUC x' < k' ==> ~(scs_k_v39 s=0) /\ x'< scs_k_v39 s/\ SUC x' < scs_k_v39 s/\ 1< scs_k_v39 s`) +THEN RESA_TAC +THEN MRESAL_TAC DIVISION[`x' + p MOD scs_k_v39 s`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN MATCH_MP_TAC(SET_RULE`A==>A \/ B`) +THEN MRESA_TAC MOD_LT[`x':num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_LT[`SUC x':num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`x':num`;`p:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`SUC x':num`;`p:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (10)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (x' + p MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(SUC x' + p MOD scs_k_v39 s):num`) +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s ((SUC x' + p) MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x' + p MOD scs_k_v39 s):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s ((x' + p) MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(SUC ((x' + p) MOD scs_k_v39 s)):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;ADD1]) +THEN MRESA_TAC MOD_LT[`1:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`(x' + p):num`;`1:num`;`scs_k_v39 s`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`(x' + p) + 1=(x' + 1) + p`] +; + + + + +REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`x' x'= k'-1\/ SUC x' < k' `) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`x':num`;`k':num`] +THEN MRESA_TAC MOD_LT[`SUC x':num`;`k':num`] +THEN DISJ_CASES_TAC(SET_RULE`{x', SUC x'} = {0, k' - 1} \/ ~({x', SUC x'} = {0, k' - 1})`) + ; + + + + +MP_TAC(SET_RULE`{x', SUC x'} = {0, k' - 1} ==> (x' =0 /\ SUC x' = k'-1)\/ (x' =k'-1/\ SUC x' =0)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0= k'-1<=> k'=2`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> +REPLICATE_TAC (40-32)(REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[th]) +THEN ARITH_TAC +; + + + + + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MATCH_MP_TAC(SET_RULE`A==>A \/ B`) +THEN MP_TAC(ARITH_RULE`k' < scs_k_v39 s /\ 3<= k' /\ x'< k' /\ SUC x' < k' ==> ~(scs_k_v39 s=0) /\ x'< scs_k_v39 s/\ SUC x' < scs_k_v39 s/\ 1< scs_k_v39 s`) +THEN RESA_TAC +THEN MRESAL_TAC DIVISION[`x' + p MOD scs_k_v39 s`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN MATCH_MP_TAC(SET_RULE`B==>A \/ B`) +THEN MRESA_TAC MOD_LT[`x':num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_LT[`SUC x':num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`x':num`;`p:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`SUC x':num`;`p:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (10)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (x' + p MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(SUC x' + p MOD scs_k_v39 s):num`) +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((SUC x' + p) MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x' + p MOD scs_k_v39 s):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((x' + p) MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(SUC ((x' + p) MOD scs_k_v39 s)):num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;ADD1]) +THEN MRESA_TAC MOD_LT[`1:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_ADD_MOD[`(x' + p):num`;`1:num`;`scs_k_v39 s`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`(x' + p) + 1=(x' + 1) + p`] +; + + + + +SUBGOAL_THEN`CARD(IMAGE (\x. (x+p MOD scs_k_v39 s )MOD scs_k_v39 s ) {i | i < k' /\ + (&2 * h0 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_bm_v39 s p q + else scs_b_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)) \/ + &2 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_am_v39 s p q + else scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)))}) += CARD {i | i < k' /\ + (&2 * h0 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_bm_v39 s p q + else scs_b_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)) \/ + &2 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_am_v39 s p q + else scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)))}`ASSUME_TAC +; + + + + +MATCH_MP_TAC CARD_IMAGE_INJ +THEN STRIP_TAC; + + +REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= k' /\ k' 3< scs_k_v39 s/\ ~(k'=0) /\ 1< k'/\ k'-1< k'/\ SUC(k'-1)= k'/\ ~(scs_k_v39 s =0) +/\ x< scs_k_v39 s/\ y< scs_k_v39 s`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`x:num`;`scs_k_v39 s`] +THEN MRESA_TAC MOD_LT[`y:num`;`scs_k_v39 s`] +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`x:num`;`y:num`;`p MOD scs_k_v39 s`;`scs_k_v39 s`][ADD_SYM] +; + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. k'` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + + +POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`FINITE + ({i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))} UNION + {(k' - 1 + p MOD scs_k_v39 s) MOD scs_k_v39 s})`ASSUME_TAC +; + + + + +REWRITE_TAC[FINITE_UNION;FINITE_SING] +THEN MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. (scs_k_v39 s)` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + +MRESA_TAC CARD_SUBSET[`IMAGE (\x. (x+p MOD scs_k_v39 s )MOD scs_k_v39 s ) {i | i < k' /\ + (&2 * h0 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_bm_v39 s p q + else scs_b_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)) \/ + &2 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_am_v39 s p q + else scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)))}`;`{i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))} UNION {(k'-1 + p MOD scs_k_v39 s) MOD scs_k_v39 s}`] +THEN SUBGOAL_THEN`FINITE + ({i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))})`ASSUME_TAC +; + + + + +REWRITE_TAC[FINITE_UNION;FINITE_SING] +THEN MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. (scs_k_v39 s)` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + + +MRESAL_TAC CARD_UNION_LE[`{i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}`;`{(k' - 1 + p MOD scs_k_v39 s) MOD scs_k_v39 s}`][FINITE_SING;Geomdetail.CARD_SING] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC (8) REMOVE_ASSUM_TAC +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`a= CARD + ({i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))} UNION + {(k' - 1 + p MOD scs_k_v39 s) MOD scs_k_v39 s})` +THEN ABBREV_TAC`b=CARD + {i | i < scs_k_v39 s /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}` +THEN ABBREV_TAC`c=CARD + (IMAGE (\x. (x + p MOD scs_k_v39 s) MOD scs_k_v39 s) + {i | i < k' /\ + (&2 * h0 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_bm_v39 s p q + else scs_b_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)) \/ + &2 < + (if {i MOD k', SUC i MOD k'} = {0, k' - 1} + then scs_am_v39 s p q + else scs_a_v39 s (i MOD k' + p MOD scs_k_v39 s) + (SUC i MOD k' + p MOD scs_k_v39 s)))})` +THEN MP_TAC(ARITH_RULE`c<=a /\ a<= b+1 /\ k'< scs_k_v39 s/\ b + scs_k_v39 s <= 6 ==> c+k' <=6`) +THEN RESA_TAC]);; + + + + +let SCS_HALF_SLICE_IS_A_SCS=prove_by_refinement( +` is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q +/\ is_scs_slice_v39 s s' s'' p q +==> is_scs_v39 s'`, + (* {{{ proof *) +[ +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC SCS_K_PRIME_CASE_3 +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3 < scs_k_v39 s ==> scs_k_v39 s =4\/ (4 < scs_k_v39 s /\ ~(scs_k_v39 s=4))`) +THEN RESA_TAC; + +ASM_REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;scs_diag;scs_v39_explicit;scs_slice_v39;PAIR_EQ] +THEN STRIP_TAC +THEN ABBREV_TAC`k'=scs_k_v39 s'` +THEN ABBREV_TAC`d'=scs_d_v39 s'` +THEN ABBREV_TAC`d''=scs_d_v39 s''` +THEN ABBREV_TAC`mkj=scs_J_v39 s' 0 (k'-1)` +THEN ABBREV_TAC`vv' = (\i. (vv:num->real^3) ((i) MOD k'+p MOD (scs_k_v39 s)))` +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC; + +DISJ_CASES_TAC(SET_RULE`~(scs_J_v39 s' 0 (k'-1)) \/ scs_J_v39 s' 0 (k'-1)`); + +MP_TAC SCS_HALF_SLICE_IS_SCS_4 +THEN ASM_REWRITE_TAC[scs_diag] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; + +REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN POP_ASSUM MP_TAC +THEN RESA_TAC) +THEN STRIP_TAC; + +MATCH_MP_TAC IS_EAR_IS_SCS +THEN ASM_REWRITE_TAC[]; + +MP_TAC SCS_HALF_SLICE_IS_SCS_4_PRIME +THEN ASM_REWRITE_TAC[scs_diag] +THEN RESA_TAC +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN RESA_TAC; + +ASM_REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;scs_diag;scs_v39_explicit;scs_slice_v39;PAIR_EQ] +THEN STRIP_TAC +THEN ABBREV_TAC`k'=scs_k_v39 s'` +THEN ABBREV_TAC`d'=scs_d_v39 s'` +THEN ABBREV_TAC`d''=scs_d_v39 s''` +THEN ABBREV_TAC`mkj=scs_J_v39 s' 0 (k'-1)` +THEN ABBREV_TAC`vv' = (\i. (vv:num->real^3) ((i) MOD k'+p MOD (scs_k_v39 s)))` +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC; + +DISJ_CASES_TAC(SET_RULE`~(scs_J_v39 s' 0 (k'-1)) \/ scs_J_v39 s' 0 (k'-1)`); + +MP_TAC SCS_HALF_SLICE_IS_SCS +THEN ASM_REWRITE_TAC[scs_diag] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; + +REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN POP_ASSUM MP_TAC +THEN RESA_TAC) +THEN STRIP_TAC; + +MATCH_MP_TAC IS_EAR_IS_SCS +THEN ASM_REWRITE_TAC[]; + +MP_TAC SCS_HALF_SLICE_IS_SCS_PRIME +THEN ASM_REWRITE_TAC[scs_diag] +THEN RESA_TAC +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN RESA_TAC]);; + + + +let NOT_EQ_DIAG=prove(` is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q +/\ dist(vv (p MOD (scs_k_v39 s)) ,vv (q MOD (scs_k_v39 s))) <= cstab +/\ BBs_v39 s vv + ==> ~(vv (p MOD (scs_k_v39 s)) =vv (q MOD (scs_k_v39 s)))`, +STRIP_TAC +THEN POP_ASSUM(fun thH-> +ASSUME_TAC thH +THEN MP_TAC SCS_K_PRIME_CASE_3 +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN ASSUME_TAC th +THEN MP_TAC(ARITH_RULE`3 ~(scs_k_v39 s<=3)`)) +THEN ASM_REWRITE_TAC[scs_diag;BBs_v39;LET_DEF;LET_END_DEF;] +THEN RESA_TAC +THEN ASSUME_TAC thH) +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC (GEN_ALL IS_SCS_NOT_COLLINEAR_BBs_CASE_LE_3)[`p:num`;`vv:num->real^3`;`q:num`;`s:scs_v39`][IN] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN STRIP_TAC +THEN MRESA_TAC th3[`(vv:num->real^3) (p MOD k)`;`vec 0:real^3`;`(vv:num->real^3) (q MOD k)`]);; + + + +let IN_IMAGE_VV=prove(` vv p IN IMAGE vv (:num)`, +REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`p:num` +THEN SET_TAC[]);; + + + +let SUC_MOD_NOT_EQ=prove(` 1 !i. ~(i MOD k= SUC i MOD k)`, +STRIP_TAC +THEN INDUCT_TAC +THENL[ MP_TAC(ARITH_RULE`1 0 ~(k=0)/\ SUC 0=1/\ i<= i+1 `) +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL Hdplygy.MOD_EQ_MOD1)[`i+1:num`;`i:num`;`1`;`k:num`][ADD_SYM]]);; + + +let IS_SCS_NOT_COLLINEAR_BBs_CASE_LE_PRIME_3=prove_by_refinement( +`3< scs_k_v39 s/\ is_scs_v39 s +/\ vv IN BBs_v39 s +==> ~collinear{vec 0, vv (i MOD (scs_k_v39 s)) ,vv ((SUC i) MOD (scs_k_v39 s))}`, +[ + +REWRITE_TAC[Local_lemmas.collinear_fan22;aff;AFFINE_HULL_2;IN_ELIM_THM;VECTOR_ARITH`A % vec 0+B=B`;cstab] +THEN STRIP_TAC +THEN MRESA_TAC( GEN_ALL IS_SCS_POINT_IN_BBS_IS_NOT_0_LE_3)[`s:scs_v39`;`vv:num->real^3`;`i MOD scs_k_v39 s`] +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ;is_scs_v39] +THEN POP_ASSUM(fun th-> +STRIP_TAC +THEN ASSUME_TAC th) +THEN REPEAT STRIP_TAC; + +MP_TAC(ARITH_RULE`3 < scs_k_v39 s==> ~(scs_k_v39 s <= 3)`) +THEN RESA_TAC; + +ABBREV_TAC`k=scs_k_v39 s` +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)/\ 1 MRESA1_TAC th`i:num`) +THEN STRIP_TAC +THEN REPLICATE_TAC (35-14) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i MOD k`;`(SUC i) MOD k`][scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ; +ARITH_RULE`1 MOD 3 =1 /\ 2 MOD 3=2/\ ~(1=2) /\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ 1<3/\ 2<3`;dist;VECTOR_ARITH`A- B%A=(&1-B)%A`;NORM_MUL]) +THEN REPLICATE_TAC (35-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (34-22) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC th[`i MOD k`;`(SUC i) MOD k`][scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ; +ARITH_RULE`1 MOD 3 =1 /\ 2 MOD 3=2/\ ~(1=2) /\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0`;dist;VECTOR_ARITH`A- B%A=(&1-B)%A`;NORM_MUL]) +THEN REPLICATE_TAC (35-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ vv (i MOD k) = (vv:num->real^3) x)`ASSUME_TAC; + +EXISTS_TAC`i MOD k` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + + +SUBGOAL_THEN`(?x. x IN (:num) /\ vv ((SUC i) MOD k) = (vv:num->real^3) x)`ASSUME_TAC; + +EXISTS_TAC`SUC(i) MOD k` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(vv:num->real^3) (i MOD k)`[ball_annulus;IN_ELIM_THM;DIFF;cball;ball;dist;VECTOR_ARITH`vec 0- B= --B`;NORM_NEG;NORM_MUL;REAL_ARITH`~(a b<=a`] +THEN MRESAL1_TAC th`(vv:num->real^3) ((SUC i) MOD k)`[ball_annulus;IN_ELIM_THM;DIFF;cball;ball;dist;VECTOR_ARITH`vec 0- B= --B`;NORM_NEG;NORM_MUL;REAL_ARITH`~(a b<=a`]) +THEN MP_TAC(REAL_ARITH`&0<= &1-v\/ &0<= --( &1-v)`) +THEN STRIP_TAC; + + MP_TAC(REAL_ARITH`&0<= v\/ &0<= --( v)`) +THEN STRIP_TAC; + +MRESA1_TAC Trigonometry2.ABS_REFL `v:real` +THEN MRESA1_TAC Trigonometry2.ABS_REFL `&1- v:real` +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <=scs_a_v39 s (i MOD k) ((SUC i) MOD k)/\ scs_a_v39 s (i MOD k) ((SUC i) MOD k)<= (&1 - v) * norm (vv (i MOD k)) +/\ &2 <= v * norm (vv (i MOD k)) ==> &4<= norm ((vv:num->real^3) (i MOD k))`) +THEN REPLICATE_TAC 6(POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; + +MRESAL1_TAC Trigonometry2.ABS_REFL `-- v:real`[REAL_ABS_NEG] +THEN MRESA1_TAC Trigonometry2.ABS_REFL `&1- v:real` +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= --v * norm (vv (i MOD k)) +/\ &2 <= norm (vv (i MOD k)) ==> &4<=(&1- v) *norm ((vv:num->real^3) (i MOD k) )`) +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (45-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA1_TAC th`i:num` +THEN ASM_REWRITE_TAC[]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`SUC i:num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s ((SUC i MOD k))`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`i:num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPLICATE_TAC (44-33)(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +MP_TAC(REAL_ARITH`&0<= v\/ &0<= --( v)`) +THEN STRIP_TAC; + +MRESAL1_TAC Trigonometry2.ABS_REFL ` v:real`[REAL_ABS_NEG] +THEN MRESAL1_TAC Trigonometry2.ABS_REFL `--(&1- v):real` [REAL_ABS_NEG] +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= norm (vv (i MOD k)) +/\ &2 <= scs_a_v39 s (i MOD k) ((SUC i) MOD k)/\ scs_a_v39 s (i MOD k) ((SUC i) MOD k)<= --(&1 - v) * norm (vv (i MOD k)) ==> &4<= v *norm ((vv:num->real^3) (i MOD k))`) +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 3(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; + +MRESAL1_TAC Trigonometry2.ABS_REFL ` --v:real`[REAL_ABS_NEG] +THEN MRESAL1_TAC Trigonometry2.ABS_REFL `--(&1- v):real` [REAL_ABS_NEG] +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= norm (vv (i MOD k)) +/\ &2 <= --v * norm (vv (i MOD k)) ==> &4<= (&1-v) *norm ((vv:num->real^3) (i MOD k))`) +THEN ASM_REWRITE_TAC[REAL_ARITH`~(a<= b) <=> b REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (44-32)(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC;]);; + (* }}} *) + + + +let DIAG_NOT_IN_EDGES=prove_by_refinement( +`is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q +/\ dist(u ,w) <= cstab +/\ (vv:num->real^3) (p MOD (scs_k_v39 s))=u +/\ (vv:num->real^3) (q MOD (scs_k_v39 s))=w +/\ E= IMAGE (\i. {vv i, vv (SUC i)}) (:num) +/\ BBs_v39 s vv +==> ~({u,w} IN E)`, +[RESA_TAC +THEN MP_TAC SCS_K_PRIME_CASE_3 +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;scs_diag] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`{u, w} = {vv x, vv (SUC x)}==> (u= vv x /\ w= vv (SUC x))\/(u= (vv:num->real^3) (SUC x) /\ w= vv (x))`) +THEN RESA_TAC; + +ASM_TAC +THEN REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ;BBs_v39;is_scs_v39;scs_diag] +THEN REPEAT RESA_TAC; + +MP_TAC(ARITH_RULE`3< scs_k_v39 s==> ~(scs_k_v39 s<= 3)`) +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`3< scs_k_v39 s==> ~(scs_k_v39 s= 0)`) +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x:num` THEN MRESA1_TAC th`SUC x:num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC DIVISION[`x:num`;`scs_k_v39 s`] +THEN MRESA_TAC DIVISION[`p:num`;`scs_k_v39 s`] +THEN MRESA_TAC DIVISION[`q:num`;`scs_k_v39 s`] +THEN MRESA_TAC DIVISION[`SUC x:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (42-14) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`x MOD scs_k_v39 s`;`p MOD scs_k_v39 s`] +THEN MRESA_TAC th[`SUC x MOD scs_k_v39 s`;`q MOD scs_k_v39 s`]) +THEN REPLICATE_TAC (45-28) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`x MOD scs_k_v39 s`;`p MOD scs_k_v39 s`][DIST_REFL] +THEN MRESAL_TAC th[`SUC x MOD scs_k_v39 s`;`q MOD scs_k_v39 s`][DIST_REFL]) +THEN REPLICATE_TAC (6) (POP_ASSUM MP_TAC) +THEN MP_TAC(SET_RULE`~(x MOD scs_k_v39 s = p MOD scs_k_v39 s) \/ (x MOD scs_k_v39 s = p MOD scs_k_v39 s)`) +THEN RESA_TAC; + +REAL_ARITH_TAC; + +MP_TAC(SET_RULE`~(SUC x MOD scs_k_v39 s = q MOD scs_k_v39 s) \/ (SUC x MOD scs_k_v39 s = q MOD scs_k_v39 s)`) +THEN RESA_TAC; + +REAL_ARITH_TAC; + +REPEAT STRIP_TAC +THEN REPLICATE_TAC (3) (REMOVE_ASSUM_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[SYM th;]) +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL Zithlqn.IMP_SUC_MOD_EQ)[`x:num`;`p:num`;`scs_k_v39 s`][]; + +ASM_TAC +THEN REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ;BBs_v39;is_scs_v39;scs_diag] +THEN REPEAT RESA_TAC; + +MP_TAC(ARITH_RULE`3< scs_k_v39 s==> ~(scs_k_v39 s<= 3)`) +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`3< scs_k_v39 s==> ~(scs_k_v39 s= 0)`) +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x:num` THEN MRESA1_TAC th`SUC x:num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC DIVISION[`x:num`;`scs_k_v39 s`] +THEN MRESA_TAC DIVISION[`p:num`;`scs_k_v39 s`] +THEN MRESA_TAC DIVISION[`q:num`;`scs_k_v39 s`] +THEN MRESA_TAC DIVISION[`SUC x:num`;`scs_k_v39 s`] +THEN REPLICATE_TAC (42-14) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`x MOD scs_k_v39 s`;`q MOD scs_k_v39 s`] +THEN MRESA_TAC th[`SUC x MOD scs_k_v39 s`;`p MOD scs_k_v39 s`]) +THEN REPLICATE_TAC (45-28) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`x MOD scs_k_v39 s`;`q MOD scs_k_v39 s`][DIST_REFL] +THEN MRESAL_TAC th[`SUC x MOD scs_k_v39 s`;`p MOD scs_k_v39 s`][DIST_REFL]) +THEN REPLICATE_TAC (6) (POP_ASSUM MP_TAC) +THEN MP_TAC(SET_RULE`~(x MOD scs_k_v39 s = q MOD scs_k_v39 s) \/ (x MOD scs_k_v39 s = q MOD scs_k_v39 s)`) +THEN RESA_TAC; + +REAL_ARITH_TAC; + + +MP_TAC(SET_RULE`~(SUC x MOD scs_k_v39 s = p MOD scs_k_v39 s) \/ (SUC x MOD scs_k_v39 s = p MOD scs_k_v39 s)`) +THEN RESA_TAC; + +REAL_ARITH_TAC; + + +REPEAT STRIP_TAC +THEN REPLICATE_TAC (3) (REMOVE_ASSUM_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[SYM th;]) +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL Zithlqn.IMP_SUC_MOD_EQ)[`x:num`;`q:num`;`scs_k_v39 s`][]]);; + + + + + + + +let SCS_K_LE_6=prove(`is_scs_v39 s ==> scs_k_v39 s<=6`, +REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ;BBs_v39;is_scs_v39;scs_diag] +THEN REPEAT RESA_TAC);; + + + +let TECOXBMv2=prove_by_refinement( +`is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q +/\ dist(u ,w) <= cstab +/\ (vv:num->real^3) (p MOD (scs_k_v39 s))=u +/\ (vv:num->real^3) (q MOD (scs_k_v39 s))=w +/\ IMAGE (vv:num->real^3) (:num)=V/\ + IMAGE (\i. {vv i,(vv:num->real^3) (SUC i)}) (:num) =E/\ + IMAGE (\i. (vv i,(vv:num->real^3) (SUC i))) (:num)=FF /\ + BBs_v39 s vv + ==> +(!x. x IN FF ==> aff_gt {vec 0} {u, w} SUBSET wedge_in_fan_gt x E)`, +[ +REWRITE_TAC[dist] +THEN REPEAT STRIP_TAC +THEN MP_TAC IS_SCS_STABLE_SYSTEM +THEN ASM_REWRITE_TAC[ARITH_RULE`3<4`] +THEN MP_TAC SCS_K_PRIME_CASE_3 +THEN RESA_TAC +THEN MP_TAC SCS_K_LE_6 +THEN RESA_TAC +THEN STRIP_TAC +THEN ABBREV_TAC`s1 =stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))` +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN MP_TAC(ARITH_RULE`3 < scs_k_v39 s /\ scs_k_v39 s<=6 ==> scs_k_v39 s=4 \/ +scs_k_v39 s=5 \/ scs_k_v39 s=6`) +THEN RESA_TAC; + + + + +POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN ASSUME_TAC th) +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 0]:real^3^(2+2)` +THEN ABBREV_TAC`a=matvec (v:real^3^(2+2))` +THEN MP_TAC(INST_TYPE [`:2+2`,`:M`]V_E_FF_IS_SCS_CASES_4) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_4;IN] +THEN STRIP_TAC +THEN MP_TAC(INST_TYPE [`:2+2`,`:M`]IN_IS_SCS_CASE_4) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_4;IN] +THEN STRIP_TAC +THEN SUBGOAL_THEN`{u, w} SUBSET V_SY (v:real^3^(2+2))` ASSUME_TAC; + + + + + +REWRITE_TAC[SET_RULE`{a,b} SUBSET A<=> a IN A /\ b IN A`] +THEN MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`p MOD scs_k_v39 s`;`vv:num->real^3`] +THEN MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`q MOD scs_k_v39 s`;`vv:num->real^3`]; + + + + + +SUBGOAL_THEN`&2 <= norm (u - w:real^3)` ASSUME_TAC; + + + + + + +ASM_TAC +THEN REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;scs_diag] +THEN REPEAT RESA_TAC; + + + + + +ASM_TAC +THEN ARITH_TAC; + + + + + + +REPLICATE_TAC (51-32)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th [`p MOD scs_k_v39 s`;`q MOD scs_k_v39 s`] [ARITH_RULE`SUC 0=1/\ SUC 1=2/\ SUC 2=3`;cstab;dist]) +THEN MRESAL_TAC DIVISION[`p:num`;`scs_k_v39 s`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC DIVISION[`q:num`;`scs_k_v39 s`][ARITH_RULE`~(4=0)`] +THEN REPLICATE_TAC (56-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th [`p MOD scs_k_v39 s`;`q MOD scs_k_v39 s`] [ARITH_RULE`SUC 0=1/\ SUC 1=2/\ SUC 2=3`;cstab;dist]) +THEN REPLICATE_TAC (58-48)(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + + + + + +MP_TAC DIAG_NOT_IN_EDGES +THEN ASM_REWRITE_TAC[dist;IN] +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL (INST_TYPE [`:2+2`,`:M`]Tecoxbm.TECOXBM))[`scs_d_v39 s`; +`(change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;`(scs_k_v39 s)`;`(change_type_v3 (scs_a_v39 s))`;`(change_type_v3 (scs_b_v39 s))`;`u:real^3`;`w:real^3`;`matvec (v:real^3^(2+2))`] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[Dih2k_hypermap.VECMATS_MATVEC_ID] +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_4;IN;B_SY1;ARITH_RULE`2<4`] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_TAC +THEN REWRITE_TAC[IN] +THEN REPEAT RESA_TAC; + + + + + + + + + + + + + +POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN ASSUME_TAC th) +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 0]:real^3^(2+3)` +THEN ABBREV_TAC`a=matvec (v:real^3^(2+3))` +THEN MP_TAC(INST_TYPE [`:2+3`,`:M`]V_E_FF_IS_SCS_CASES_5) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_5;IN] +THEN STRIP_TAC +THEN MP_TAC(INST_TYPE [`:2+3`,`:M`]IN_IS_SCS_CASE_5) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_5;IN] +THEN STRIP_TAC +THEN SUBGOAL_THEN`{u, w} SUBSET V_SY (v:real^3^(2+3))` ASSUME_TAC; + + + + + +REWRITE_TAC[SET_RULE`{a,b} SUBSET A<=> a IN A /\ b IN A`] +THEN MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`p MOD scs_k_v39 s`;`vv:num->real^3`] +THEN MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`q MOD scs_k_v39 s`;`vv:num->real^3`]; + + + + + +SUBGOAL_THEN`&2 <= norm (u - w:real^3)` ASSUME_TAC; + + + + + + +ASM_TAC +THEN REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;scs_diag] +THEN REPEAT RESA_TAC; + + + + + +ASM_TAC +THEN ARITH_TAC; + + + + + + +REPLICATE_TAC (50-31)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th [`p MOD scs_k_v39 s`;`q MOD scs_k_v39 s`] [ARITH_RULE`SUC 0=1/\ SUC 1=2/\ SUC 2=3`;cstab;dist]) +THEN MRESAL_TAC DIVISION[`p:num`;`scs_k_v39 s`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC DIVISION[`q:num`;`scs_k_v39 s`][ARITH_RULE`~(5=0)`] +THEN REPLICATE_TAC (56-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th [`p MOD scs_k_v39 s`;`q MOD scs_k_v39 s`] [ARITH_RULE`SUC 0=1/\ SUC 1=2/\ SUC 2=3`;cstab;dist]) +THEN REPLICATE_TAC (57-48)(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + + + + + +MP_TAC DIAG_NOT_IN_EDGES +THEN ASM_REWRITE_TAC[dist;IN] +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL (INST_TYPE [`:2+3`,`:M`]Tecoxbm.TECOXBM))[`scs_d_v39 s`; +`(change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;`(scs_k_v39 s)`;`(change_type_v3 (scs_a_v39 s))`;`(change_type_v3 (scs_b_v39 s))`;`u:real^3`;`w:real^3`;`matvec (v:real^3^(2+3))`] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[Dih2k_hypermap.VECMATS_MATVEC_ID] +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_5;IN;B_SY1;ARITH_RULE`2<5`] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_TAC +THEN REWRITE_TAC[IN] +THEN REPEAT RESA_TAC; + + + + + +POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN ASSUME_TAC th) +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 5;(vv:num->real^3) 0]:real^3^(3+3)` +THEN ABBREV_TAC`a=matvec (v:real^3^(3+3))` +THEN MP_TAC(INST_TYPE [`:3+3`,`:M`]V_E_FF_IS_SCS_CASES_6) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_6;IN] +THEN STRIP_TAC +THEN MP_TAC(INST_TYPE [`:3+3`,`:M`]IN_IS_SCS_CASE_6) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_6;IN] +THEN STRIP_TAC +THEN SUBGOAL_THEN`{u, w} SUBSET V_SY (v:real^3^(3+3))` ASSUME_TAC; + + + + + +REWRITE_TAC[SET_RULE`{a,b} SUBSET A<=> a IN A /\ b IN A`] +THEN MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`p MOD scs_k_v39 s`;`vv:num->real^3`] +THEN MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`q MOD scs_k_v39 s`;`vv:num->real^3`]; + + + + + +SUBGOAL_THEN`&2 <= norm (u - w:real^3)` ASSUME_TAC; + + + + + + +ASM_TAC +THEN REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;scs_diag] +THEN REPEAT RESA_TAC; + + + + + +ASM_TAC +THEN ARITH_TAC; + + + + + + +REPLICATE_TAC (50-31)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th [`p MOD scs_k_v39 s`;`q MOD scs_k_v39 s`] [ARITH_RULE`SUC 0=1/\ SUC 1=2/\ SUC 2=3`;cstab;dist]) +THEN MRESAL_TAC DIVISION[`p:num`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC DIVISION[`q:num`;`scs_k_v39 s`][ARITH_RULE`~(6=0)`] +THEN REPLICATE_TAC (56-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th [`p MOD scs_k_v39 s`;`q MOD scs_k_v39 s`] [ARITH_RULE`SUC 0=1/\ SUC 1=2/\ SUC 2=3`;cstab;dist]) +THEN REPLICATE_TAC (57-48)(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + + + + +MP_TAC DIAG_NOT_IN_EDGES +THEN ASM_REWRITE_TAC[dist;IN] +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL (INST_TYPE [`:3+3`,`:M`]Tecoxbm.TECOXBM))[`scs_d_v39 s`; +`(change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;`(scs_k_v39 s)`;`(change_type_v3 (scs_a_v39 s))`;`(change_type_v3 (scs_b_v39 s))`;`u:real^3`;`w:real^3`;`matvec (v:real^3^(3+3))`] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[Dih2k_hypermap.VECMATS_MATVEC_ID] +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_6;IN;B_SY1;ARITH_RULE`2<6`] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_TAC +THEN REWRITE_TAC[IN] +THEN REPEAT RESA_TAC; +]);; + + + + +let VV_SUC_EQ_RHO_NODE=prove_by_refinement(`scs_k_v39 s =k /\ + (vv:num->real^3) p1=u /\ + IMAGE (vv:num->real^3) (:num)=V/\ + IMAGE (\i. {vv i,(vv:num->real^3) (SUC i)}) (:num) =E/\ + IMAGE (\i. (vv i,(vv:num->real^3) (SUC i))) (:num)=FF /\ + is_scs_v39 s /\ + scs_diag (scs_k_v39 s) p q /\ + BBs_v39 s vv +==> +(!m. ITER m (rho_node1 FF) u= vv (m+p1))`, +[STRIP_TAC +THEN INDUCT_TAC; + +ASM_REWRITE_TAC[ITER;ARITH_RULE`0+p=p`]; + +ASM_REWRITE_TAC[ITER] +THEN SUBGOAL_THEN`(vv:num->real^3) (m+p1), (vv:num->real^3) (SUC m+p1) IN FF ` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`m+p1:num` +THEN REWRITE_TAC[ARITH_RULE`SUC m+p= SUC(m+p)`;SET_RULE`(a:num)IN(:num)`]; + +MATCH_MP_TAC(GEN_ALL Local_lemmas.DETER_RHO_NODE) +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC SCS_K_PRIME_CASE_3 +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN ASSUME_TAC th +THEN MP_TAC(ARITH_RULE`3 ~(k<=3)`)) +THEN ASM_REWRITE_TAC[scs_diag;BBs_v39;LET_DEF;LET_END_DEF;convex_local_fan] +THEN REPEAT RESA_TAC]);; + + + +let W_EW_K_SCS_ADD_P=prove_by_refinement( +` scs_half_slice_v39 s p q d' mkj= s' /\ +scs_k_v39 s'=k' /\ scs_k_v39 s =k /\ + (vv:num->real^3) (p MOD k)=u /\ + (vv:num->real^3) (q MOD k)=w /\ + is_scs_v39 s /\ + scs_diag (scs_k_v39 s) p q /\ + BBs_v39 s vv +==> vv (k' - 1 + p MOD k) = w`, +[ +ABBREV_TAC`V= IMAGE (vv:num->real^3) (:num)` +THEN ABBREV_TAC`E= IMAGE (\i. {vv i,(vv:num->real^3) (SUC i)}) (:num)` +THEN ABBREV_TAC`FF= IMAGE (\i. (vv i,(vv:num->real^3) (SUC i))) (:num)` +THEN REPEAT STRIP_TAC +THEN MP_TAC SCS_K_PRIME_CASE_3 +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3 ~(scs_k_v39 s<=3)`) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> +REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN ASSUME_TAC th) +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;scs_half_slice_v39;is_scs_v39;scs_diag;scs_v39_explicit] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (1) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN ASSUME_TAC th +THEN MP_TAC th +THEN REWRITE_TAC[convex_local_fan] +THEN STRIP_TAC) +THEN MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`p MOD scs_k_v39 s`;`vv:num->real^3`] +THEN MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`q MOD scs_k_v39 s`;`vv:num->real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.POINT_PRESENTED_IN_RHOND1)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`u:real^3`;`w:real^3`] +THEN SUBGOAL_THEN`(!i. scs_b_v39 s i (SUC i) <= cstab)`ASSUME_TAC; + +REPLICATE_TAC (45-27)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +REPLICATE_TAC (43-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN EXPAND_TAC"s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +THEN ASM_SIMP_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL SCS_K_PRIME_LE_GE)[`s:scs_v39`;`p:num`;`q:num`;`d':real`;`scs_J_v39 s' p q`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;scs_half_slice_v39] +THEN ASM_SIMP_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`p:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`p MOD k< k==> 0< q + 1 + k - p MOD k`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k/\ 3<= (q + 1 + k - p MOD k) MOD k /\ p MOD k +(((q + 1 + k - p MOD k) MOD k - 1 + p MOD k) + k) +=(q + 1 + k - p MOD k) MOD k +(k- 1 + p MOD k) +`) +THEN RESA_TAC +THEN REPLICATE_TAC (52-32)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REWRITE_TAC[periodic] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(q + 1 + k - p MOD k) MOD k - 1 + p MOD k` +THEN POP_ASSUM(fun th1-> REWRITE_TAC[SYM th1]) +THEN ASSUME_TAC th) +THEN MRESA_TAC MOD_MOD_REFL[`(q + 1 + k - p MOD k)`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`(q + 1 + k - p MOD k) :num`;`k - 1 + p MOD k:num`;`scs_k_v39 s`] +THEN MP_TAC(ARITH_RULE`p MOD k< k /\ 3<=k==> (q + 1 + k - p MOD k) + k - 1 + p MOD k =q+ 2*k`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`q :num` THEN MRESA1_TAC th`q +2*k:num` THEN MRESA1_TAC th `((q + 1 + k - p MOD k) MOD k + k - 1 + p MOD k):num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_ADD_MOD[`(q + 1 + k - p MOD k) MOD k:num`;`k - 1 + p MOD k:num`;`scs_k_v39 s`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN REPLICATE_TAC (5)(REMOVE_ASSUM_TAC) +THEN POP_ASSUM(fun th-> MRESA1_TAC th`q:num` THEN MRESAL1_TAC th`q+k:num`[ARITH_RULE`(A+B)+B=A+2*B`])]);; + + + +let VV_INJ=prove(` scs_k_v39 s =k /\ + is_scs_v39 s /\ + BBs_v39 s vv +==>(!i j. i ~(vv i= vv j))`, +REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (5)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i:num`;`j:num`][VECTOR_ARITH`a-a= vec 0`;NORM_0]) +THEN REPLICATE_TAC (29-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`;`j:num`]) +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC);; + + + + +let CARD_V_EQ_SCS_K=prove_by_refinement( +` scs_k_v39 s =k /\ + IMAGE (vv:num->real^3) (:num)=V/\ + is_scs_v39 s /\ + scs_diag (scs_k_v39 s) p q /\ + BBs_v39 s vv +==> CARD V=k`, +[ +REPEAT STRIP_TAC +THEN MP_TAC IS_SCS_STABLE_SYSTEM +THEN ASM_REWRITE_TAC[ARITH_RULE`3<4`] +THEN MP_TAC SCS_K_PRIME_CASE_3 +THEN RESA_TAC +THEN MP_TAC SCS_K_LE_6 +THEN RESA_TAC +THEN STRIP_TAC +THEN ABBREV_TAC`s1 =stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))` +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN MP_TAC(ARITH_RULE`3 < scs_k_v39 s /\ scs_k_v39 s<=6 ==> scs_k_v39 s=4 \/ +scs_k_v39 s=5 \/ scs_k_v39 s=6`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN ASSUME_TAC th) +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 0]:real^3^(2+2)` +THEN ABBREV_TAC`a=matvec (v:real^3^(2+2))` +THEN MP_TAC(INST_TYPE [`:2+2`,`:M`]V_E_FF_IS_SCS_CASES_4) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_4;IN] +THEN STRIP_TAC +THEN MRESAL_TAC (INST_TYPE [`:2+2`,`:M`]VECTOR_3_4)[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 4 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)`;Basics.DIMINDEX_4] +THEN EXPAND_TAC "V" +THEN REWRITE_TAC[V_SY;rows;Basics.DIMINDEX_4;ARITH_RULE`1<=i /\ i<=4 <=> i=1\/ i=2\/ i=3 \/ i=4`;SET_RULE`{row i v | i = 1 \/ i = 2 \/ i = 3 \/ i = 4}={row 1 v, row 2 v, row 3 v,row 4 v}`] +THEN ASM_REWRITE_TAC[] +THEN MP_TAC VV_INJ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`1`;`2`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<4/\ 1<4/\ 2<4/\ 3<4`] +THEN MRESAL_TAC th[`1`;`3`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<4/\ 1<4/\ 2<4/\ 3<4`] +THEN MRESAL_TAC th[`1`;`0`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<4/\ 1<4/\ 2<4/\ 3<4`] +THEN MRESAL_TAC th[`2`;`0`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<4/\ 1<4/\ 2<4/\ 3<4`] +THEN MRESAL_TAC th[`3`;`0`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<4/\ 1<4/\ 2<4/\ 3<4`] +THEN MRESAL_TAC th[`2`;`3`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<4/\ 1<4/\ 2<4/\ 3<4`]) +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + +POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN ASSUME_TAC th) +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 0]:real^3^(2+3)` +THEN ABBREV_TAC`a=matvec (v:real^3^(2+3))` +THEN MP_TAC(INST_TYPE [`:2+3`,`:M`]V_E_FF_IS_SCS_CASES_5) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_5;IN] +THEN STRIP_TAC +THEN MRESAL_TAC (INST_TYPE [`:2+3`,`:M`]VECTOR_3_5)[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 5<=5/\ 0 MOD 5= 0 /\ 1 MOD 5= 1 /\ 2 MOD 5= 2/\ 3 MOD 5= 3 /\ 4 MOD 5= 4 /\ 5 MOD 5=0 /\ ~(2=1) +/\ SUC 0 MOD 5= 1 /\ SUC 1 MOD 5= 2 /\ SUC 2 MOD 5= 3/\ SUC 3 MOD 5= 4 +/\ SUC 4 MOD 5= 0 /\ SUC 5 MOD 5 = 1 /\ ~(3=1)/\ ~(1=0)`;SET_RULE`(a:num) IN (:num)`;Basics.DIMINDEX_5] +THEN EXPAND_TAC "V" +THEN REWRITE_TAC[V_SY;rows;Basics.DIMINDEX_5;ARITH_RULE`1<=i /\ i<=5 <=> i=1\/ i=2\/ i=3 \/ i=4 \/ i=5`;SET_RULE`{row i v | i = 1 \/ i = 2 \/ i = 3 \/ i = 4\/ i=5}={row 1 v, row 2 v, row 3 v,row 4 v, row 5 v}`] +THEN ASM_REWRITE_TAC[] +THEN MP_TAC VV_INJ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`1`;`2`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<5/\ 1<5/\ 2<5/\ 3<5/\ 4<5 /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)`] +THEN MRESAL_TAC th[`1`;`3`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<5/\ 1<5/\ 2<5/\ 3<5/\ 4<5 /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)`] +THEN MRESAL_TAC th[`1`;`0`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<5/\ 1<5/\ 2<5/\ 3<5/\ 4<5 /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)`] +THEN MRESAL_TAC th[`2`;`0`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<5/\ 1<5/\ 2<5/\ 3<5/\ 4<5 /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)`] +THEN MRESAL_TAC th[`3`;`0`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<5/\ 1<5/\ 2<5/\ 3<5/\ 4<5 /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)`] +THEN MRESAL_TAC th[`2`;`3`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<5/\ 1<5/\ 2<5/\ 3<5/\ 4<5 /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)`] +THEN MRESAL_TAC th[`1`;`4`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<5/\ 1<5/\ 2<5/\ 3<5/\ 4<5 /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)`] +THEN MRESAL_TAC th[`2`;`4`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<5/\ 1<5/\ 2<5/\ 3<5/\ 4<5 /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)`] +THEN MRESAL_TAC th[`3`;`4`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<5/\ 1<5/\ 2<5/\ 3<5/\ 4<5 /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)`] +THEN MRESAL_TAC th[`0`;`4`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<5/\ 1<5/\ 2<5/\ 3<5/\ 4<5 /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)`]) +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + +POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN ASSUME_TAC th) +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 5;(vv:num->real^3) 0]:real^3^(3+3)` +THEN ABBREV_TAC`a=matvec (v:real^3^(3+3))` +THEN MP_TAC(INST_TYPE [`:3+3`,`:M`]V_E_FF_IS_SCS_CASES_6) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_6;IN] +THEN STRIP_TAC +THEN MRESAL_TAC (INST_TYPE [`:3+3`,`:M`]VECTOR_3_6)[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 5`;`(vv:num->real^3) 0`][ARITH_RULE`1<=6/\ 2<=6/\ 3<=6/\ 4<=6/\ 5<=6 /\ 6<=6 /\ 0 MOD 6= 0 /\ 1 MOD 6= 1 /\ 2 MOD 6= 2/\ 3 MOD 6= 3 /\ 4 MOD 6= 4 /\ 5 MOD 6=5 /\ 6 MOD 6=0 /\ ~(2=1) +/\ SUC 0 MOD 6= 1 /\ SUC 1 MOD 6= 2 /\ SUC 2 MOD 6= 3/\ SUC 3 MOD 6= 4 +/\ SUC 4 MOD 6= 5 /\ SUC 5 MOD 6 = 0 /\ SUC 6 MOD 6 =1 /\ ~(3=1)/\ ~(1=0)`;Basics.DIMINDEX_6] +THEN EXPAND_TAC "V" +THEN REWRITE_TAC[V_SY;rows;Basics.DIMINDEX_6;ARITH_RULE`1<=i /\ i<=6 <=> i=1\/ i=2\/ i=3 \/ i=4 \/ i=5\/ i=6`;SET_RULE`{row i v | i = 1 \/ i = 2 \/ i = 3 \/ i = 4\/ i=5 \/ i=6}={row 1 v, row 2 v, row 3 v,row 4 v, row 5 v, row 6 v}`] +THEN ASM_REWRITE_TAC[] +THEN MP_TAC VV_INJ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`1`;`2`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0) /\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`1`;`3`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`1`;`0`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`2`;`0`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`3`;`0`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`2`;`3`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`1`;`4`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`2`;`4`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`3`;`4`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`0`;`4`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`1`;`5`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`2`;`5`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`3`;`5`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`0`;`5`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`] +THEN MRESAL_TAC th[`4`;`5`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ ~(3=4)/\ ~(1=4)/\ ~(2=4)/\ ~(0=4)/\ 0<6/\ 1<6/\ 2<6/\ 3<6/\ 4<6/\ 5<6 /\ ~(0=5) /\ ~(1=5) /\ ~(2=5)/\ ~(3=5)/\ ~(4=5)`]) +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC]);; + + + +let V_PRIME_EQ_V_vv= prove_by_refinement( +` scs_half_slice_v39 s p q d' mkj= s' /\ + scs_half_slice_v39 s q p d'' mkj =s''/\ + scs_k_v39 s'=k' /\ scs_k_v39 s =k /\ + (vv:num->real^3) (p MOD k)=u /\ + (vv:num->real^3) (q MOD k)=w /\ + IMAGE (vv:num->real^3) (:num)=V/\ + IMAGE (\i. {vv i,(vv:num->real^3) (SUC i)}) (:num) =E/\ + IMAGE (\i. (vv i,(vv:num->real^3) (SUC i))) (:num)=FF /\ +norm (u - w) <= cstab /\ + is_scs_v39 s /\ + scs_diag (scs_k_v39 s) p q /\ + BBs_v39 s vv +==> +IMAGE (\i. vv (i MOD k' + p MOD k)) (:num)=v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) +`, +[ +REPEAT STRIP_TAC +THEN MP_TAC SCS_K_PRIME_CASE_3 +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3 ~(scs_k_v39 s<=3) `) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> +REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN ASSUME_TAC th) +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;scs_half_slice_v39;is_scs_v39;scs_diag;scs_v39_explicit] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (1) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN ASSUME_TAC th +THEN MP_TAC th +THEN REWRITE_TAC[convex_local_fan] +THEN STRIP_TAC) +THEN MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`p MOD scs_k_v39 s`;`vv:num->real^3`] +THEN MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`q MOD scs_k_v39 s`;`vv:num->real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.POINT_PRESENTED_IN_RHOND1)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`u:real^3`;`w:real^3`] +THEN SUBGOAL_THEN`(!i. scs_b_v39 s i (SUC i) <= cstab)`ASSUME_TAC; + +REPLICATE_TAC (45-27)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +MP_TAC NOT_EQ_DIAG +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN MP_TAC TECOXBMv2 +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas1.PROVE_THE_SLICE_ASSUMPTION)[`FF:real^3#real^3->bool`;`E:(real^3->bool)->bool`;`V:real^3->bool`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC (GEN_ALL Nkezbfc_local.COMPATIBLE_BW_TWO_LEMMAS) +[`hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))`;`V:real^3->bool`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (u,rho_node1 FF u)`;`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;`u:real^3`;`w:real^3`;] +THEN REWRITE_TAC[slicev] +THEN MP_TAC W_EW_K_SCS_ADD_P +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN SUBGOAL_THEN`order (rho_node1 FF) u w= k'-1` ASSUME_TAC; + +MATCH_MP_TAC Nkezbfc_local.UNIQUE_ORDER +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC(GEN_ALL VV_SUC_EQ_RHO_NODE)[`scs_k_v39 s`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`p:num`;`q:num`;`s:scs_v39`;`FF:real^3#real^3->bool`;`u:real^3`;`vv:num->real^3`;`p:num MOD k`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN GEN_TAC +THEN STRIP_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC 2 STRIP_TAC +THEN MRESA1_TAC th`k'-1:num` THEN MRESA1_TAC th`i:num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC CARD_V_EQ_SCS_K +THEN MP_TAC SCS_K_PRIME_LE_GE +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<=k' /\ k' k'-1bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`u:real^3`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`k'-1`]); + +ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM;EXTENSION] +THEN GEN_TAC +THEN EQ_TAC; + +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC SCS_K_PRIME_LE_GE +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<=k/\ 3<=k' ==> ~(k=0) /\ ~(k'=0)`) +THEN RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`k':num`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD k'< k' /\ k' x' MOD k'< k/\ x' MOD k'<= k'-1`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`(x') MOD k':num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`x' MOD k':num`;`p:num`;`k:num`] +THEN EXISTS_TAC`x' MOD k'` +THEN ASM_REWRITE_TAC[ARITH_RULE`0<= a`] +THEN MRESAL_TAC(GEN_ALL VV_SUC_EQ_RHO_NODE)[`scs_k_v39 s`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`p:num`;`q:num`;`s:scs_v39`;`FF:real^3#real^3->bool`;`u:real^3`;`vv:num->real^3`;`p:num MOD k`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist]; + +RESA_TAC +THEN EXISTS_TAC`n':num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN MP_TAC SCS_K_PRIME_LE_GE +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN MRESAL_TAC(GEN_ALL VV_SUC_EQ_RHO_NODE)[`scs_k_v39 s`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`p:num`;`q:num`;`s:scs_v39`;`FF:real^3#real^3->bool`;`u:real^3`;`vv:num->real^3`;`p:num MOD k`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN MP_TAC(ARITH_RULE`n'<= k'-1 /\ 3<=k'/\ k' n'< k'`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`n':num`;`k':num`]]);; + + + +let E_PRIME_EQ_E_vv= prove_by_refinement( +` scs_half_slice_v39 s p q d' mkj= s' /\ + scs_half_slice_v39 s q p d'' mkj =s''/\ + scs_k_v39 s'=k' /\ scs_k_v39 s =k /\ + (vv:num->real^3) (p MOD k)=u /\ + (vv:num->real^3) (q MOD k)=w /\ + IMAGE (vv:num->real^3) (:num)=V/\ + IMAGE (\i. {vv i,(vv:num->real^3) (SUC i)}) (:num) =E/\ + IMAGE (\i. (vv i,(vv:num->real^3) (SUC i))) (:num)=FF /\ +norm (u - w) <= cstab /\ + is_scs_v39 s /\ + scs_diag (scs_k_v39 s) p q /\ + BBs_v39 s vv +==> + IMAGE (\i. {vv (i MOD k' + p MOD k), vv (SUC i MOD k' + p MOD k)}) (:num) = + e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) +`, +[REPEAT STRIP_TAC +THEN MP_TAC SCS_K_PRIME_CASE_3 +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3 ~(scs_k_v39 s<=3) `) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> +REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN ASSUME_TAC th) +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;scs_half_slice_v39;is_scs_v39;scs_diag;scs_v39_explicit] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (1) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN ASSUME_TAC th +THEN MP_TAC th +THEN REWRITE_TAC[convex_local_fan] +THEN STRIP_TAC) +THEN MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`p MOD scs_k_v39 s`;`vv:num->real^3`] +THEN MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`q MOD scs_k_v39 s`;`vv:num->real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.POINT_PRESENTED_IN_RHOND1)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`u:real^3`;`w:real^3`] +THEN SUBGOAL_THEN`(!i. scs_b_v39 s i (SUC i) <= cstab)`ASSUME_TAC; + + +REPLICATE_TAC (45-27)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + + +MP_TAC NOT_EQ_DIAG +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN MP_TAC TECOXBMv2 +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas1.PROVE_THE_SLICE_ASSUMPTION)[`FF:real^3#real^3->bool`;`E:(real^3->bool)->bool`;`V:real^3->bool`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC (GEN_ALL Nkezbfc_local.COMPATIBLE_BW_TWO_LEMMAS) +[`hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))`;`V:real^3->bool`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (u,rho_node1 FF u)`;`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;`u:real^3`;`w:real^3`;] +THEN REWRITE_TAC[slicee] +THEN MP_TAC W_EW_K_SCS_ADD_P +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN SUBGOAL_THEN`order (rho_node1 FF) u w= k'-1` ASSUME_TAC; + + +MATCH_MP_TAC Nkezbfc_local.UNIQUE_ORDER +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC(GEN_ALL VV_SUC_EQ_RHO_NODE)[`scs_k_v39 s`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`p:num`;`q:num`;`s:scs_v39`;`FF:real^3#real^3->bool`;`u:real^3`;`vv:num->real^3`;`p:num MOD k`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN GEN_TAC +THEN STRIP_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC 2 STRIP_TAC +THEN MRESA1_TAC th`k'-1:num` THEN MRESA1_TAC th`i:num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC CARD_V_EQ_SCS_K +THEN MP_TAC SCS_K_PRIME_LE_GE +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<=k' /\ k' k'-1bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`u:real^3`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`k'-1`]); + + + + + +ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM;EXTENSION;UNION] +THEN GEN_TAC +THEN REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + + + + +MP_TAC V_PRIME_EQ_V_vv +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM;DELETE;IN_SING] +THEN MP_TAC SCS_K_PRIME_LE_GE +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<=k/\ 3<=k' ==> ~(k=0) /\ ~(k'=0)`) +THEN RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`k':num`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD k'< k' /\ k' x' MOD k'< k/\ x' MOD k'<= k'-1/\ k'-1 x' MOD k' = k'-1\/ x' MOD k'< k'-1`) +THEN RESA_TAC +; + +MRESA_TAC MOD_LT[`k'-1:num`;`k':num`] +THEN MRESA_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`x':num`;`k'-1`;`k':num`] +THEN MRESAL_TAC MOD_MULT[`k':num`;`1:num`][ARITH_RULE`k'*1 =k'/\ 0+A=A`] + +; + + +MATCH_MP_TAC(SET_RULE`A==> A\/B`) +THEN EXISTS_TAC`(vv:num->real^3) (x' MOD k' + p MOD k)` +THEN MRESAL_TAC(GEN_ALL VV_SUC_EQ_RHO_NODE)[`scs_k_v39 s`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`p:num`;`q:num`;`s:scs_v39`;`FF:real^3#real^3->bool`;`(vv (x' MOD k' + p MOD k)):real^3`;`vv:num->real^3`;`x' MOD k'+p:num MOD k`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th` SUC 0`[ITER]) +THEN REWRITE_TAC[ARITH_RULE`SUC 0=1`;ADD1] +THEN MRESA_TAC MOD_LT[`1`;`k':num`] +THEN MP_TAC(ARITH_RULE`3<=k' /\ x' MOD k' 1+x' MOD k' MRESA_TAC th[`(x' MOD k' +p MOD k)MOD k`;`(k'-1+p MOD k) MOD k`]) +THEN ONCE_REWRITE_TAC[ADD_SYM] +THEN ASM_TAC +THEN REWRITE_TAC[periodic;] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `y + p MOD k:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MP_TAC(SET_RULE`~((x' MOD k' + p MOD k) MOD k = (k' - 1 + p MOD k) MOD k) +\/ ((x' MOD k' + p MOD k) MOD k = (k' - 1 + p MOD k) MOD k)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL Hdplygy.MOD_EQ_MOD)[`x' MOD k':num`;`k'-1`;`p MOD k`;`k:num`][] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ADD_SYM] +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`x' MOD k'`;`k:num`] +THEN MP_TAC(ARITH_RULE`3<=k' /\k' k'-1bool`;`E:(real^3->bool)->bool`;`p:num`;`q:num`;`s:scs_v39`;`FF:real^3#real^3->bool`;`(vv ( p MOD k)):real^3`;`vv:num->real^3`;`p:num MOD k`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN POP_ASSUM (fun th-> MRESA1_TAC th` n':num` +THEN MRESAL1_TAC th` SUC n'`[ITER] ) +THEN EXISTS_TAC`n':num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN(:num)`] +THEN MP_TAC(ARITH_RULE`n'<= k'-1 ==> n'=k'-1 \/ (SUC n' ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT RESA_TAC) +; + + +MRESA_TAC MOD_LT[`n':num`;`k':num`] +THEN MRESA_TAC MOD_LT[`SUC n':num`;`k':num`] +; + + +ASM_REWRITE_TAC[] +THEN EXISTS_TAC`k'-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`] +THEN MP_TAC SCS_K_PRIME_LE_GE +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<=k' /\k' k'-1real^3) (p MOD k)=u /\ + (vv:num->real^3) (q MOD k)=w /\ + IMAGE (vv:num->real^3) (:num)=V/\ + IMAGE (\i. {vv i,(vv:num->real^3) (SUC i)}) (:num) =E/\ + IMAGE (\i. (vv i,(vv:num->real^3) (SUC i))) (:num)=FF /\ +norm (u - w) <= cstab /\ + is_scs_v39 s /\ + scs_diag (scs_k_v39 s) p q /\ + BBs_v39 s vv +==> +IMAGE (\i. vv (i MOD k' + p MOD k),vv (SUC i MOD k' + p MOD k)) (:num) += face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u) +`,[ + +REPEAT STRIP_TAC +THEN MP_TAC SCS_K_PRIME_CASE_3 +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3 ~(scs_k_v39 s<=3) `) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> +REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN ASSUME_TAC th) +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;scs_half_slice_v39;is_scs_v39;scs_diag;scs_v39_explicit] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (1) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN ASSUME_TAC th +THEN MP_TAC th +THEN REWRITE_TAC[convex_local_fan] +THEN STRIP_TAC) +THEN MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`p MOD scs_k_v39 s`;`vv:num->real^3`] +THEN MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`q MOD scs_k_v39 s`;`vv:num->real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.POINT_PRESENTED_IN_RHOND1)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`u:real^3`;`w:real^3`] +THEN SUBGOAL_THEN`(!i. scs_b_v39 s i (SUC i) <= cstab)`ASSUME_TAC; + + +REPLICATE_TAC (45-27)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + + +MP_TAC NOT_EQ_DIAG +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN MP_TAC TECOXBMv2 +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas1.PROVE_THE_SLICE_ASSUMPTION)[`FF:real^3#real^3->bool`;`E:(real^3->bool)->bool`;`V:real^3->bool`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC (GEN_ALL Nkezbfc_local.COMPATIBLE_BW_TWO_LEMMAS) +[`hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))`;`V:real^3->bool`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (u,rho_node1 FF u)`;`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;`u:real^3`;`w:real^3`;] +THEN REWRITE_TAC[slicef] +THEN MP_TAC W_EW_K_SCS_ADD_P +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN SUBGOAL_THEN`order (rho_node1 FF) u w= k'-1` ASSUME_TAC; + + +MATCH_MP_TAC Nkezbfc_local.UNIQUE_ORDER +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC(GEN_ALL VV_SUC_EQ_RHO_NODE)[`scs_k_v39 s`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`p:num`;`q:num`;`s:scs_v39`;`FF:real^3#real^3->bool`;`u:real^3`;`vv:num->real^3`;`p:num MOD k`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN GEN_TAC +THEN STRIP_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC 2 STRIP_TAC +THEN MRESA1_TAC th`k'-1:num` THEN MRESA1_TAC th`i:num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC CARD_V_EQ_SCS_K +THEN MP_TAC SCS_K_PRIME_LE_GE +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<=k' /\ k' k'-1bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`u:real^3`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i:num`;`k'-1`]); + + + + + +ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM;EXTENSION;UNION] +THEN GEN_TAC +THEN REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + + + + +MP_TAC V_PRIME_EQ_V_vv +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM;DELETE;IN_SING] +THEN MP_TAC SCS_K_PRIME_LE_GE +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<=k/\ 3<=k' ==> ~(k=0) /\ ~(k'=0)`) +THEN RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`k':num`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD k'< k' /\ k' x' MOD k'< k/\ x' MOD k'<= k'-1/\ k'-1 x' MOD k' = k'-1\/ x' MOD k'< k'-1`) +THEN RESA_TAC +; + +MRESA_TAC MOD_LT[`k'-1:num`;`k':num`] +THEN MRESA_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`x':num`;`k'-1`;`k':num`] +THEN MRESAL_TAC MOD_MULT[`k':num`;`1:num`][ARITH_RULE`k'*1 =k'/\ 0+A=A`] + +; + + +MATCH_MP_TAC(SET_RULE`A==> A\/B`) +THEN EXISTS_TAC`(vv:num->real^3) (x' MOD k' + p MOD k)` +THEN MRESAL_TAC(GEN_ALL VV_SUC_EQ_RHO_NODE)[`scs_k_v39 s`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`p:num`;`q:num`;`s:scs_v39`;`FF:real^3#real^3->bool`;`(vv (x' MOD k' + p MOD k)):real^3`;`vv:num->real^3`;`x' MOD k'+p:num MOD k`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th` SUC 0`[ITER]) +THEN REWRITE_TAC[ARITH_RULE`SUC 0=1`;ADD1] +THEN MRESA_TAC MOD_LT[`1`;`k':num`] +THEN MP_TAC(ARITH_RULE`3<=k' /\ x' MOD k' 1+x' MOD k' MRESA_TAC th[`(x' MOD k' +p MOD k)MOD k`;`(k'-1+p MOD k) MOD k`]) +THEN ONCE_REWRITE_TAC[ADD_SYM] +THEN ASM_TAC +THEN REWRITE_TAC[periodic;] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `y + p MOD k:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MP_TAC(SET_RULE`~((x' MOD k' + p MOD k) MOD k = (k' - 1 + p MOD k) MOD k) +\/ ((x' MOD k' + p MOD k) MOD k = (k' - 1 + p MOD k) MOD k)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL Hdplygy.MOD_EQ_MOD)[`x' MOD k':num`;`k'-1`;`p MOD k`;`k:num`][] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ADD_SYM] +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`x' MOD k'`;`k:num`] +THEN MP_TAC(ARITH_RULE`3<=k' /\k' k'-1bool`;`E:(real^3->bool)->bool`;`p:num`;`q:num`;`s:scs_v39`;`FF:real^3#real^3->bool`;`(vv ( p MOD k)):real^3`;`vv:num->real^3`;`p:num MOD k`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN POP_ASSUM (fun th-> MRESA1_TAC th` n':num` +THEN MRESAL1_TAC th` SUC n'`[ITER] ) +THEN EXISTS_TAC`n':num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN(:num)`] +THEN MP_TAC(ARITH_RULE`n'<= k'-1 ==> n'=k'-1 \/ (SUC n' ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT RESA_TAC) +; + + +MRESA_TAC MOD_LT[`n':num`;`k':num`] +THEN MRESA_TAC MOD_LT[`SUC n':num`;`k':num`] +; + + +ASM_REWRITE_TAC[] +THEN EXISTS_TAC`k'-1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`] +THEN MP_TAC SCS_K_PRIME_LE_GE +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<=k' /\k' k'-1real^3) (i MOD (scs_k_v39 s')+p MOD (scs_k_v39 s))) +/\ is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q +/\ +d'< #0.9 /\ +(4 + BBs_v39 s' vv'`, +[ +STRIP_TAC +THEN POP_ASSUM MP_TAC +(*THEN MP_TAC SCS_HALF_SLICE_IS_SCS +THEN RESA_TAC*) +THEN MRESA_TAC (GEN_ALL SCS_K_PRIME_LE_GE)[`s:scs_v39`;`p:num`;`q:num`;`d':real`;`scs_J_v39 s' p q`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;] +THEN MP_TAC SCS_K_PRIME_CASE_3 +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3 ~(scs_k_v39 s<=3)`) +THEN RESA_TAC +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;scs_half_slice_v39;is_scs_v39;scs_diag;scs_v39_explicit] +THEN ABBREV_TAC`k'=(q + 1 + scs_k_v39 s - p MOD scs_k_v39 s) MOD scs_k_v39 s` +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN REPEAT RESA_TAC; + +ASM_TAC +THEN REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (51-38) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN EXISTS_TAC`((x') MOD k'+p MOD k)` +THEN REWRITE_TAC[SET_RULE`(a:num) IN (:num)`]; + + + +REWRITE_TAC[periodic;] +THEN GEN_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k':num`;`i:num`][ARITH_RULE`1 * k' + i = (i+k')`] +; + + +DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k'-1} \/ ~({i MOD k', j MOD k'} = {0, k'-1})`); + + + +ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESA_TAC th[`((i) MOD k'+p MOD k)`;`((j) MOD k'+p MOD k)`]) +THEN STRIP_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`scs_am_v39 s ((i) MOD k'+p MOD k) ((j) MOD k'+p MOD k) +=scs_am_v39 s p q`ASSUME_TAC; + + +MP_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k' - 1} +==> (i MOD k' =0 /\ j MOD k'=k'-1)\/ (i MOD k' =k'-1 /\ j MOD k'=0)`) +THEN RESA_TAC +THEN REWRITE_TAC[ARITH_RULE`0+p=p`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s = 0) /\ 0 MRESA1_TAC th `k'+(k-1)+p MOD k:num`) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC MOD_LT[`k':num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`k':num`;`k-1+p MOD k`;`k:num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`q + 1 + k - p MOD k`;`k-1+p MOD k`;`k:num`] +THEN EXPAND_TAC"k'" +THEN MRESA_TAC DIVISION[`p:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`p MOD k< k==>(((q + 1 + k - p MOD k) + k - 1 + p MOD k)) +=(q+ 2*k) `) +THEN RESA_TAC +THEN MRESA_TAC MOD_EQ[`q+2*k`;`q:num`;`k:num`;`2`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s p`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `q:num`) +THEN REPLICATE_TAC (60-14) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`0 (k' - 1 + p MOD k) + k =k' + k - 1 + p MOD k`) +THEN RESA_TAC +THEN MRESA_TAC th[`k'-1+p MOD k`;`p:num`] +THEN REMOVE_ASSUM_TAC +THEN ASSUME_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s (k' - 1 + p MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `p:num`) +; + +POP_ASSUM(fun th1->ASM_REWRITE_TAC[SYM th1]) +; + + + +ASM_REWRITE_TAC[]; + + +DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k'-1} \/ ~({i MOD k', j MOD k'} = {0, k'-1})`); + + + +ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 1 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESA_TAC th[`((i) MOD k'+p MOD k)`;`((j) MOD k'+p MOD k)`]) +THEN STRIP_TAC +THEN SUBGOAL_THEN`scs_bm_v39 s ((i) MOD k'+p MOD k) ((j) MOD k'+p MOD k) +=scs_bm_v39 s p q`ASSUME_TAC; + + +MP_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k' - 1} +==> (i MOD k' =0 /\ j MOD k'=k'-1)\/ (i MOD k' =k'-1 /\ j MOD k'=0)`) +THEN RESA_TAC +THEN REWRITE_TAC[ARITH_RULE`0+p=p`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s = 0) /\ 0 MRESA1_TAC th `k'+(k-1)+p MOD k:num`) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC MOD_LT[`k':num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`k':num`;`k-1+p MOD k`;`k:num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`q + 1 + k - p MOD k`;`k-1+p MOD k`;`k:num`] +THEN EXPAND_TAC"k'" +THEN MRESA_TAC DIVISION[`p:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`p MOD k< k==>(((q + 1 + k - p MOD k) + k - 1 + p MOD k)) +=(q+ 2*k) `) +THEN RESA_TAC +THEN MRESA_TAC MOD_EQ[`q+2*k`;`q:num`;`k:num`;`2`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s p`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `q:num`) +THEN REPLICATE_TAC (60-15) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`0 (k' - 1 + p MOD k) + k =k' + k - 1 + p MOD k`) +THEN RESA_TAC +THEN MRESA_TAC th[`k'-1+p MOD k`;`p:num`] +THEN REMOVE_ASSUM_TAC +THEN ASSUME_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s (k' - 1 + p MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `p:num`) +; + +POP_ASSUM(fun th1->ASM_REWRITE_TAC[SYM th1]) +; + + + +ASM_REWRITE_TAC[]; + + + +ABBREV_TAC`u= (vv:num->real^3) (p MOD k)` +THEN ABBREV_TAC `w= (vv:num->real^3) (q MOD k)` +THEN ABBREV_TAC`V= IMAGE (vv:num->real^3) (:num)` +THEN ABBREV_TAC`E= IMAGE (\i. {vv i,(vv:num->real^3) (SUC i)}) (:num)` +THEN ABBREV_TAC`FF= IMAGE (\i. (vv i,(vv:num->real^3) (SUC i))) (:num)` +THEN MP_TAC(ARITH_RULE`3<=k'==> k'<=3 \/ ~(k'<=3)`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`p MOD scs_k_v39 s`;`vv:num->real^3`] +THEN MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`q MOD scs_k_v39 s`;`vv:num->real^3`] +THEN SUBGOAL_THEN`(!i. scs_b_v39 s i (SUC i) <= cstab)`ASSUME_TAC +; + + + +REPLICATE_TAC (57-23)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`norm (u - w:real^3) <= cstab`ASSUME_TAC +; + + +MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s (p)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `q:num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s (q MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `p:num`) +THEN REPLICATE_TAC (61-49)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th [`p MOD scs_k_v39 s`;`q MOD scs_k_v39 s`] [ARITH_RULE`SUC 0=1/\ SUC 1=2/\ SUC 2=3`;dist]) +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC (60-32)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC + +; + +MP_TAC NOT_EQ_DIAG +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN MP_TAC TECOXBMv2 +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas1.EJRCFJD)[`hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))`;`(E:(real^3->bool)->bool)`;`w:real^3`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (u,rho_node1 FF u)`;`V:real^3->bool`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (w,rho_node1 FF w)`;`FF:real^3#real^3->bool`;`u:real^3`] +THEN MP_TAC F_PRIME_EQ_F_vv +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39] +THEN STRIP_TAC +THEN MP_TAC E_PRIME_EQ_E_vv +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39] +THEN STRIP_TAC +THEN MP_TAC V_PRIME_EQ_V_vv +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[]]);; + + + + +let QKNVMLB1_EQ4F= prove_by_refinement( +` s' = scs_half_slice_v39 s p q d' mkj /\ + s'' = scs_half_slice_v39 s q p d'' mkj /\ + vv' = (\i. (vv:num->real^3) (i MOD (scs_k_v39 s')+p MOD (scs_k_v39 s))) +/\ is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q +/\ +d'< #0.9 /\ +(4=scs_k_v39 s /\ scs_bm_v39 s p q <= &4) +/\ MMs_v39 s vv + ==> + BBs_v39 s' vv'`, +[ +STRIP_TAC +THEN POP_ASSUM MP_TAC +(*THEN MP_TAC SCS_HALF_SLICE_IS_SCS +THEN RESA_TAC*) +THEN MRESA_TAC (GEN_ALL SCS_K_PRIME_LE_GE)[`s:scs_v39`;`p:num`;`q:num`;`d':real`;`scs_J_v39 s' p q`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;] +THEN MP_TAC SCS_K_PRIME_CASE_3 +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3 ~(scs_k_v39 s<=3)`) +THEN RESA_TAC +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;scs_half_slice_v39;is_scs_v39;scs_diag;scs_v39_explicit] +THEN ABBREV_TAC`k'=(q + 1 + scs_k_v39 s - p MOD scs_k_v39 s) MOD scs_k_v39 s` +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN REPEAT RESA_TAC; + +ASM_TAC +THEN REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (51-38) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN EXISTS_TAC`((x') MOD k'+p MOD k)` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`]; + + +REWRITE_TAC[periodic;] +THEN GEN_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k':num`;`i:num`][ARITH_RULE`1 * k' + i = (i+k')`]; + +DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k'-1} \/ ~({i MOD k', j MOD k'} = {0, k'-1})`); + +ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESA_TAC th[`((i) MOD k'+p MOD k)`;`((j) MOD k'+p MOD k)`]) +THEN STRIP_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`scs_am_v39 s ((i) MOD k'+p MOD k) ((j) MOD k'+p MOD k) +=scs_am_v39 s p q`ASSUME_TAC; + +MP_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k' - 1} +==> (i MOD k' =0 /\ j MOD k'=k'-1)\/ (i MOD k' =k'-1 /\ j MOD k'=0)`) +THEN RESA_TAC +THEN REWRITE_TAC[ARITH_RULE`0+p=p`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s = 0) /\ 0 MRESA1_TAC th `k'+(k-1)+p MOD k:num`) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC MOD_LT[`k':num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`k':num`;`k-1+p MOD k`;`k:num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`q + 1 + k - p MOD k`;`k-1+p MOD k`;`k:num`] +THEN EXPAND_TAC"k'" +THEN MRESA_TAC DIVISION[`p:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`p MOD k< k==>(((q + 1 + k - p MOD k) + k - 1 + p MOD k)) +=(q+ 2*k) `) +THEN RESA_TAC +THEN MRESA_TAC MOD_EQ[`q+2*k`;`q:num`;`k:num`;`2`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s p`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `q:num`) +THEN REPLICATE_TAC (60-14) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`0 (k' - 1 + p MOD k) + k =k' + k - 1 + p MOD k`) +THEN RESA_TAC +THEN MRESA_TAC th[`k'-1+p MOD k`;`p:num`] +THEN REMOVE_ASSUM_TAC +THEN ASSUME_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s (k' - 1 + p MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `p:num`); + +POP_ASSUM(fun th1->ASM_REWRITE_TAC[SYM th1]); + +ASM_REWRITE_TAC[]; + +DISJ_CASES_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k'-1} \/ ~({i MOD k', j MOD k'} = {0, k'-1})`); + +ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 1 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESA_TAC th[`((i) MOD k'+p MOD k)`;`((j) MOD k'+p MOD k)`]) +THEN STRIP_TAC +THEN SUBGOAL_THEN`scs_bm_v39 s ((i) MOD k'+p MOD k) ((j) MOD k'+p MOD k) +=scs_bm_v39 s p q`ASSUME_TAC; + +MP_TAC(SET_RULE`{i MOD k', j MOD k'} = {0, k' - 1} +==> (i MOD k' =0 /\ j MOD k'=k'-1)\/ (i MOD k' =k'-1 /\ j MOD k'=0)`) +THEN RESA_TAC +THEN REWRITE_TAC[ARITH_RULE`0+p=p`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s ==> ~(scs_k_v39 s = 0) /\ 0 MRESA1_TAC th `k'+(k-1)+p MOD k:num`) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC MOD_LT[`k':num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`k':num`;`k-1+p MOD k`;`k:num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC MOD_ADD_MOD[`q + 1 + k - p MOD k`;`k-1+p MOD k`;`k:num`] +THEN EXPAND_TAC"k'" +THEN MRESA_TAC DIVISION[`p:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`p MOD k< k==>(((q + 1 + k - p MOD k) + k - 1 + p MOD k)) +=(q+ 2*k) `) +THEN RESA_TAC +THEN MRESA_TAC MOD_EQ[`q+2*k`;`q:num`;`k:num`;`2`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s p`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `q:num`) +THEN REPLICATE_TAC (60-15) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`0 (k' - 1 + p MOD k) + k =k' + k - 1 + p MOD k`) +THEN RESA_TAC +THEN MRESA_TAC th[`k'-1+p MOD k`;`p:num`] +THEN REMOVE_ASSUM_TAC +THEN ASSUME_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s (k' - 1 + p MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `p:num`); + +POP_ASSUM(fun th1->ASM_REWRITE_TAC[SYM th1]); + +ASM_REWRITE_TAC[]; + +MP_TAC SCS_K_PRIME_CASE_4 +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39] +THEN RESA_TAC +THEN REPLICATE_TAC (50-31)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] +THEN REPEAT RESA_TAC) +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`(!i. scs_b_v39 s i (SUC i) <= cstab)`ASSUME_TAC; + +REPLICATE_TAC (48-23)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN ARITH_TAC]);; + + +let QKNVMLB1=prove_by_refinement( +` (let s' = scs_half_slice_v39 s p q d' mkj in + let vv' = (\i. vv (i MOD (scs_k_v39 s')+ p MOD (scs_k_v39 s))) in + MMs_v39 s vv /\ + scs_bm_v39 s p q < &4 /\ + ((scs_k_v39 s = 4) \/ scs_bm_v39 s p q <= cstab) /\ + is_scs_v39 s /\ d' < #0.9 /\ scs_diag (scs_k_v39 s) p q ==> + BBs_v39 s' vv')`, +[REPEAT GEN_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;] +THEN STRIP_TAC; + +ABBREV_TAC`s' = scs_half_slice_v39 s p q d' mkj` +THEN ABBREV_TAC`s'' = scs_half_slice_v39 s q p d'' mkj` +THEN ABBREV_TAC`vv' = (\i. (vv:num->real^3) (i MOD (scs_k_v39 s')+ p MOD (scs_k_v39 s)))` +THEN MP_TAC(REAL_ARITH`scs_bm_v39 s p q < &4==> scs_bm_v39 s p q <= &4`) +THEN RESA_TAC +THEN MP_TAC QKNVMLB1_EQ4F +THEN RESA_TAC; + +ABBREV_TAC`s' = scs_half_slice_v39 s p q d' mkj` +THEN ABBREV_TAC`s'' = scs_half_slice_v39 s q p d'' mkj` +THEN ABBREV_TAC`vv' = (\i. (vv:num->real^3) (i MOD (scs_k_v39 s')+ p MOD (scs_k_v39 s)))` +THEN MP_TAC SCS_K_PRIME_CASE_3 +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3 < scs_k_v39 s ==> scs_k_v39 s =4 \/ 4 < scs_k_v39 s`) +THEN RESA_TAC; + +ASM_TAC +THEN REWRITE_TAC[cstab] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`scs_bm_v39 s p q <= #3.01 ==> scs_bm_v39 s p q <= &4`) +THEN RESA_TAC +THEN MP_TAC QKNVMLB1_EQ4F +THEN RESA_TAC; + +MP_TAC QKNVMLB1_LE4F +THEN RESA_TAC]);; + + + + +let DIAG_IS_NOT_EAR=prove(`is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q +==> ~(is_ear_v39 s)`, +STRIP_TAC +THEN MP_TAC SCS_K_PRIME_CASE_3 +THEN RESA_TAC +THEN REWRITE_TAC[is_ear_v39] +THEN POP_ASSUM (fun th-> STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[]) +THEN ARITH_TAC);; + + + +let SCS_J_DIAG_EQ=prove(`s'= scs_half_slice_v39 s p q d' mkj /\ + s''= scs_half_slice_v39 s q p d'' mkj /\ + is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q /\ + is_scs_slice_v39 s s' s'' p q +==> +scs_J_v39 s' 0 (scs_k_v39 s' - 1) =scs_J_v39 s'' 0 (scs_k_v39 s'' - 1)`, +ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ] +THEN RESA_TAC +THEN ABBREV_TAC`k'=(q + 1 + scs_k_v39 s - p MOD scs_k_v39 s) MOD scs_k_v39 s` +THEN ABBREV_TAC`k''=(p + 1 + scs_k_v39 s - q MOD scs_k_v39 s) MOD scs_k_v39 s` +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39] +THEN MP_TAC SCS_K_PRIME_LE_GE +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39] +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL SCS_K_PRIME_LE_GE)[`s:scs_v39`;`q:num`;`p:num`;`d'':real`;`mkj:bool`] +[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39] +THEN MP_TAC(ARITH_RULE`3<=k' /\ 3<=k''==>0< k' /\ k'-1 ~(scs_J_v39 s p q)`, +ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ] +THEN RESA_TAC +THEN REPLICATE_TAC (22-17) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`p:num`;`q:num`][ADD1;ARITH_RULE`1+i=i+1`]));; + + +let SCS_J_PRIME_SUBSET_SCS_J=prove_by_refinement( +`scs_half_slice_v39 s p q d' mkj =s'/\ + is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q /\ +i< scs_k_v39 s'-1 /\ scs_J_v39 s' i (SUC i) +==> scs_J_v39 s ((i+ p MOD scs_k_v39 s)MOD scs_k_v39 s) (SUC ((i + p MOD scs_k_v39 s)MOD scs_k_v39 s))`, +[REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39] +THEN ABBREV_TAC`k'=(q + 1 + scs_k_v39 s - p MOD scs_k_v39 s) MOD scs_k_v39 s` +THEN STRIP_TAC +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN MP_TAC SCS_K_PRIME_CASE_3 +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL SCS_K_PRIME_LE_GE)[`s:scs_v39`;`p:num`;`q:num`;`d':real`;`scs_J_v39 s' p q`][MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39] +THEN MP_TAC(ARITH_RULE`i i (i=0 /\ SUC i= k'-1) \/ (i= k'-1 /\ SUC i=0)`) +THEN RESA_TAC; + +REWRITE_TAC[ADD1;ARITH_RULE`SUC i+A=SUC(i+A)`]; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0 = k' - 1<=> k'=2`] +THEN REPLICATE_TAC (19-7) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC; + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + +STRIP_TAC +THEN ASM_TAC +THEN REWRITE_TAC[periodic;periodic2;is_scs_v39] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1 MRESA1_TAC th`(i + p MOD k):num`) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i + p MOD k) MOD k)`][periodic;ARITH_RULE`1 MOD 4=1 /\ SUC 1=2/\ 1<4/\ ~(4=0)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(SUC i + p MOD k):num` +THEN MRESA1_TAC th`SUC((i+p) MOD k)`)]);; + + + +let INTER_SLICE_SCS_EMPTY1=prove_by_refinement( +` scs_half_slice_v39 s p q d' mkj =s'/\ + scs_half_slice_v39 s q p d'' mkj =s'' /\ + is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q /\ + p MOD scs_k_v39 s +{(i + p MOD scs_k_v39 s) MOD scs_k_v39 s | i < scs_k_v39 s'-1 } +INTER {(i + q MOD scs_k_v39 s)MOD scs_k_v39 s | i < scs_k_v39 s''-1 }={} +`, +[ +REWRITE_TAC[SET_RULE`A INTER B={}<=> ~(?a. a IN A INTER B)`;INTER] +THEN STRIP_TAC +THEN EXPAND_TAC"s'" +THEN EXPAND_TAC"s''" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39;IN_ELIM_THM] +THEN ABBREV_TAC`k'=(q + 1 + scs_k_v39 s - p MOD scs_k_v39 s) MOD scs_k_v39 s` +THEN ABBREV_TAC`k''=(p + 1 + scs_k_v39 s - q MOD scs_k_v39 s) MOD scs_k_v39 s` +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th->ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC (GEN_ALL SCS_K_PRIME_LE_GE)[`s:scs_v39`;`p:num`;`q:num`;`d':real`;`scs_J_v39 s' p q`][MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39;IN_ELIM_THM] +THEN SUBGOAL_THEN`(k'-1 +p MOD k) <= q MOD k `ASSUME_TAC; + +MP_TAC(ARITH_RULE`3<= k' /\ k' ~(k=0)/\ (q +k -p MOD k)+1=q + 1 + k - p MOD k/\ 1 q+k- p MOD k= 1*k + (q- p MOD k)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`q-p MOD k`] +THEN MRESA_TAC MOD_LT[`1`;`k:num`] +THEN MRESA_TAC DIVISION[`q:num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`q+k-p MOD k`;`1`;`k:num`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN MP_TAC(ARITH_RULE`q MOD k <= q /\ p MOD k< q MOD k/\ p MOD k< k ==> (q DIV k * k + q MOD k)- p MOD k= (q DIV k)*k + (q MOD k- p MOD k)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_MULT_ADD[`q DIV k `;`k:num`;`q MOD k-p MOD k`] +THEN MRESA_TAC DIVISION[`q:num`;`k:num`] +THEN MP_TAC(ARITH_RULE` p MOD k< q MOD k/\ q MOD k< k ==> q MOD k- p MOD k k' -1 + p MOD k <= q MOD k`) +THEN RESA_TAC +THEN REPLICATE_TAC (32-26) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT STRIP_TAC +THEN ONCE_REWRITE_TAC[SYM th] THEN ASSUME_TAC(SYM th)) +THEN ASM_REWRITE_TAC[]; + +MP_TAC(ARITH_RULE`3<= k' /\ k' ~(k=0)/\ (q +k -p MOD k)+1=q + 1 + k - p MOD k/\ 1 i + p MOD k < q MOD k/\ i + p MOD k REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_LT[`1`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`p+k-q MOD k`;`1`;`k:num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC DIVISION[`p:num`;`k:num`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th] +THEN MP_TAC(ARITH_RULE`(p DIV k * k + p MOD k) + k - q MOD k= (p DIV k)*k + (p MOD k + k - q MOD k)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_MULT_ADD[`p DIV k `;`k:num`;`p MOD k + k - q MOD k`] +THEN ONCE_REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_LE[`p MOD k + k - q MOD k:num`;`k:num`] +THEN MRESA_TAC MOD_LE[`(p MOD k + k - q MOD k) MOD k +1:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`(p MOD k + k - q MOD k) MOD k <= p MOD k + k - q MOD k +/\ ((p MOD k + k - q MOD k) MOD k + 1) MOD k <= + (p MOD k + k - q MOD k) MOD k + 1 /\ q MOD k ((p MOD k + k - q MOD k) MOD k + 1) MOD k + q MOD k <= k+ p MOD k +1`) +THEN RESA_TAC; + +ASM_TAC +THEN REWRITE_TAC[scs_diag] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL SCS_K_PRIME_LE_GE)[`s:scs_v39`;`q:num`;`p:num`;`d'':real`;`scs_J_v39 s' p q`][MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;scs_diag;is_scs_v39;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39;IN_ELIM_THM] +THEN MP_TAC(ARITH_RULE`i' i'+ q MOD k < k + p MOD k `) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`i'+ q MOD k< k \/ k <= i' + q MOD k `) +THEN RESA_TAC; + +MRESA_TAC MOD_LT[`i' + q MOD k`;`k:num`] +THEN MRESA_TAC MOD_LT[`i + p MOD k`;`k:num`] +THEN MP_TAC(ARITH_RULE`q MOD k<= i'+ q MOD k`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ASM_REWRITE_TAC[ARITH_RULE`~(q MOD k <= i + p MOD k)<=> i + p MOD k< q MOD k`]; + +MRESA_TAC DIVISION[`p:num`;`k:num`] +THEN +MP_TAC(ARITH_RULE`i' + q MOD k < k + p MOD k +/\ k <= i' + q MOD k /\ p MOD k 1 * k + (i' + q MOD k) - k = i' + q MOD k /\ (i' + q MOD k) - k p MOD k <= i + p MOD k/\ i + p MOD k < q MOD k/\ i + p MOD k +{(i + p MOD scs_k_v39 s) MOD scs_k_v39 s | i < scs_k_v39 s'-1 } +INTER {(i + q MOD scs_k_v39 s)MOD scs_k_v39 s | i < scs_k_v39 s''-1 }={} +`, +REWRITE_TAC[scs_diag] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`~(p MOD scs_k_v39 s = q MOD scs_k_v39 s) +==> (p MOD scs_k_v39 s < q MOD scs_k_v39 s)\/ (q MOD scs_k_v39 s < p MOD scs_k_v39 s)`) +THEN RESA_TAC +THENL[ +MATCH_MP_TAC INTER_SLICE_SCS_EMPTY1 +THEN ASM_REWRITE_TAC[scs_diag]; +ONCE_REWRITE_TAC[SET_RULE`A INTER B= B INTER A`] +THEN MATCH_MP_TAC (GEN_ALL INTER_SLICE_SCS_EMPTY1) +THEN ASM_REWRITE_TAC[scs_diag] +THEN EXISTS_TAC`d'':real` +THEN EXISTS_TAC`d':real` +THEN EXISTS_TAC`mkj:bool` +THEN ASM_REWRITE_TAC[]]);; + + + + + +let QKNVMLB2 = prove_by_refinement( +` scs_half_slice_v39 s p q d' mkj =s'/\ + scs_half_slice_v39 s q p d'' mkj =s'' /\ + vv' = (\i. (vv:num->real^3) (i MOD (scs_k_v39 s')+p MOD (scs_k_v39 s))) +/\ + vv'' = (\i. (vv:num->real^3) (i MOD (scs_k_v39 s'')+q MOD (scs_k_v39 s))) +/\ + MMs_v39 s vv /\ + is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q /\ + is_scs_slice_v39 s s' s'' p q /\ + scs_d_v39 s <= d' + d'' ==> + dsv_v39 s vv <= dsv_v39 s' vv' + dsv_v39 s'' vv''`, +[ + +STRIP_TAC +THEN POP_ASSUM MP_TAC +(*THEN MP_TAC SCS_HALF_SLICE_IS_SCS +THEN RESA_TAC*) +THEN MRESA_TAC (GEN_ALL SCS_K_PRIME_LE_GE)[`s:scs_v39`;`p:num`;`q:num`;`d':real`;`scs_J_v39 s' p q`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;] +THEN MRESA_TAC (GEN_ALL SCS_K_PRIME_LE_GE)[`s:scs_v39`;`q:num`;`p:num`;`d'':real`;`scs_J_v39 s' p q`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;] +THEN MP_TAC SCS_K_PRIME_CASE_3 +THEN RESA_TAC +THEN MP_TAC DIAG_IS_NOT_EAR +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3 ~(scs_k_v39 s<=3)`) +THEN RESA_TAC +THEN MP_TAC DIAG_NOT_IN_SCS_J +THEN RESA_TAC +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;] +THEN ABBREV_TAC`k'=(q + 1 + scs_k_v39 s - p MOD scs_k_v39 s) MOD scs_k_v39 s` +THEN ABBREV_TAC`k''=(p + 1 + scs_k_v39 s - q MOD scs_k_v39 s) MOD scs_k_v39 s` +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN REPEAT RESA_TAC +; + + + + +REPLICATE_TAC (49-37) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC(SYM th)) +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (7) (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`FINITE {i | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)} +` ASSUME_TAC +; + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. (scs_k_v39 s' -1)` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + +SUBGOAL_THEN`{i | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)} INTER + {i| i=scs_k_v39 s' - 1/\ scs_J_v39 s' (scs_k_v39 s' - 1) (SUC (scs_k_v39 s' - 1)) }={}` ASSUME_TAC +; + + +REWRITE_TAC[INTER;SET_RULE`A={}<=> ~(?a. a IN A)`;IN_ELIM_THM;IN_SING] +THEN ARITH_TAC; + + + +SUBGOAL_THEN`{i | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)} UNION + {i| i=scs_k_v39 s' - 1/\ scs_J_v39 s' (scs_k_v39 s' - 1) (SUC(scs_k_v39 s'-1)) }={i | i < scs_k_v39 s' /\ scs_J_v39 s' i (SUC i)}` +ASSUME_TAC; + + +REWRITE_TAC[UNION;IN_SING;IN_ELIM_THM;EXTENSION] +THEN GEN_TAC +THEN EXPAND_TAC "s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (47-43) REMOVE_ASSUM_TAC +THEN EQ_TAC +; + + +RESA_TAC +; + +REPLICATE_TAC (47-40) (POP_ASSUM MP_TAC) +THEN ARITH_TAC +; + + + +MP_TAC(ARITH_RULE`3<=k' ==>SUC (k' - 1) =k'/\ k'-1 x< k'-1 \/ (x=k'-1)`) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> +POP_ASSUM MP_TAC +THEN REWRITE_TAC[th] +THEN RESA_TAC) +; + + + +SUBGOAL_THEN`FINITE + {i | i = scs_k_v39 s' - 1 /\ + scs_J_v39 s' (scs_k_v39 s' - 1) (SUC (scs_k_v39 s' - 1))}`ASSUME_TAC +; + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`{(scs_k_v39 s' -1)}` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_SING;FINITE_SING] +THEN SET_TAC[]; + + + +MRESAL_TAC SUM_INCL_EXCL[`{i | i < scs_k_v39 s'-1 /\ scs_J_v39 s' i (SUC i)}`;`{i| i=scs_k_v39 s' - 1/\ scs_J_v39 s' (scs_k_v39 s' - 1) (SUC(scs_k_v39 s'-1)) }`;`(\i. cstab - + dist + ((vv:num->real^3) (i MOD scs_k_v39 s' + p MOD k), + vv (SUC i MOD scs_k_v39 s' + p MOD k)))`][FINITE_SING;SUM_SING;SUM_CLAUSES;REAL_ARITH`a+ &0=a`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`FINITE {i | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)} +` ASSUME_TAC +; + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. (scs_k_v39 s'' -1)` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + +SUBGOAL_THEN`{i | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)} INTER + {i| i=scs_k_v39 s'' - 1/\ scs_J_v39 s'' (scs_k_v39 s'' - 1) (SUC (scs_k_v39 s'' - 1)) }={}` ASSUME_TAC +; + + +REWRITE_TAC[INTER;SET_RULE`A={}<=> ~(?a. a IN A)`;IN_ELIM_THM;IN_SING] +THEN ARITH_TAC; + + + +SUBGOAL_THEN`{i | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)} UNION + {i| i=scs_k_v39 s'' - 1/\ scs_J_v39 s'' (scs_k_v39 s'' - 1) (SUC(scs_k_v39 s''-1)) }={i | i < scs_k_v39 s'' /\ scs_J_v39 s'' i (SUC i)}` +ASSUME_TAC; + + +REWRITE_TAC[UNION;IN_SING;IN_ELIM_THM;EXTENSION] +THEN GEN_TAC +THEN EXPAND_TAC "s''" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (47-43) REMOVE_ASSUM_TAC +THEN EQ_TAC +; + + +RESA_TAC +; + +REPLICATE_TAC (47-40) (POP_ASSUM MP_TAC) +THEN ARITH_TAC +; + + + +MP_TAC(ARITH_RULE`3<=k'' ==>SUC (k'' - 1) =k''/\ k''-1 x< k''-1 \/ (x=k''-1)`) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> +POP_ASSUM MP_TAC +THEN REWRITE_TAC[th] +THEN RESA_TAC) +; + + + +SUBGOAL_THEN`FINITE + {i | i = scs_k_v39 s'' - 1 /\ + scs_J_v39 s'' (scs_k_v39 s'' - 1) (SUC (scs_k_v39 s'' - 1))}`ASSUME_TAC +; + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`{(scs_k_v39 s'' -1)}` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_SING;FINITE_SING] +THEN SET_TAC[]; + + + +MRESAL_TAC SUM_INCL_EXCL[`{i | i < scs_k_v39 s''-1 /\ scs_J_v39 s'' i (SUC i)}`;`{i| i=scs_k_v39 s'' - 1/\ scs_J_v39 s'' (scs_k_v39 s'' - 1) (SUC(scs_k_v39 s''-1)) }`;`(\i. cstab - + dist + ((vv:num->real^3) (i MOD scs_k_v39 s'' + q MOD k), + vv (SUC i MOD scs_k_v39 s'' + q MOD k)))`][FINITE_SING;SUM_SING;SUM_CLAUSES;REAL_ARITH`a+ &0=a`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`sum + {i | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)} + (\i. cstab - + dist + (vv (i MOD scs_k_v39 s' + p MOD k), + (vv:num->real^3) (SUC i MOD scs_k_v39 s' + p MOD k))) += sum + {(i + p MOD scs_k_v39 s) MOD scs_k_v39 s | i < scs_k_v39 s'-1 + /\ scs_J_v39 s' i (SUC i)} + (\i. cstab - + dist + (vv (i ), + vv (SUC i )))`ASSUME_TAC +; + + + +MATCH_MP_TAC SUM_EQ_GENERAL +THEN REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`(\i. (i + p MOD scs_k_v39 s) MOD scs_k_v39 s)` +THEN ASM_REWRITE_TAC[EXISTS_UNIQUE] +THEN REPEAT RESA_TAC; + + +EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +; + + + +REPEAT STRIP_TAC +THEN REPLICATE_TAC (47-40) (POP_ASSUM MP_TAC) +THEN EXPAND_TAC "s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`i i x real^3`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x + p MOD k):num` +THEN MRESA1_TAC th ` ((x + p MOD k) +1):num` +THEN MRESA1_TAC th ` SUC ((x + p MOD k) MOD k):num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_LT[`1`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`x+p MOD k`;`1`;`k:num`] +THEN REWRITE_TAC[ARITH_RULE`((x + p MOD k) + 1)= (x+ 1) + p MOD k`] +; + + + + +SUBGOAL_THEN`sum + {i | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)} + (\i. cstab - + dist + (vv (i MOD scs_k_v39 s'' + q MOD k), + (vv:num->real^3) (SUC i MOD scs_k_v39 s'' + q MOD k))) += sum + {(i + q MOD scs_k_v39 s) MOD scs_k_v39 s | i < scs_k_v39 s''-1 + /\ scs_J_v39 s'' i (SUC i)} + (\i. cstab - + dist + (vv (i ), + vv (SUC i )))`ASSUME_TAC +; + + + +MATCH_MP_TAC SUM_EQ_GENERAL +THEN REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`(\i. (i + q MOD scs_k_v39 s) MOD scs_k_v39 s)` +THEN ASM_REWRITE_TAC[EXISTS_UNIQUE] +THEN REPEAT RESA_TAC; + + +EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +; + + + +REPEAT STRIP_TAC +THEN REPLICATE_TAC (47-40) (POP_ASSUM MP_TAC) +THEN EXPAND_TAC "s''" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`i i x real^3`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x + q MOD k):num` +THEN MRESA1_TAC th ` ((x + q MOD k) +1):num` +THEN MRESA1_TAC th ` SUC ((x + q MOD k) MOD k):num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_LT[`1`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`x+q MOD k`;`1`;`k:num`] +THEN REWRITE_TAC[ARITH_RULE`((x + q MOD k) + 1)= (x+ 1) + q MOD k`] +; + + + +ASM_REWRITE_TAC[ +REAL_ARITH`a + b * (-- &1) *c <= (a1 + b * d1 *(c1+c2)) + a2 + b * d2 *(c3+c4) +<=> &0<= (a1+ a2-a) + b*(c+ d1* c1 +d2*c3)+ b*(d1* c2+ d2* c4)`] +THEN MATCH_MP_TAC(REAL_ARITH`&0<=a /\ &0<=b /\ &0<=c==> &0<= a+b+c`) +THEN STRIP_TAC; + +EXPAND_TAC "s'" +THEN EXPAND_TAC "s''" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +; + + + +STRIP_TAC; + + +MATCH_MP_TAC(REAL_ARITH`&0<= a==> &0<= #0.1 *a`) +THEN SUBGOAL_THEN`-- &1<= if is_ear_v39 s' then &1 else -- &1` ASSUME_TAC; + + + +MP_TAC(SET_RULE`is_ear_v39 s' \/ ~(is_ear_v39 s')`) +THEN RESA_TAC +THEN REAL_ARITH_TAC; + + + SUBGOAL_THEN`-- &1<= if is_ear_v39 s'' then &1 else -- &1` ASSUME_TAC; + + + +MP_TAC(SET_RULE`is_ear_v39 s'' \/ ~(is_ear_v39 s'')`) +THEN RESA_TAC +THEN REAL_ARITH_TAC; + + + +SUBGOAL_THEN`&0<= sum {(i + p MOD k) MOD k | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)} + (\i. cstab - dist ((vv:num->real^3) i,vv (SUC i)))`ASSUME_TAC + +; + + +MATCH_MP_TAC SUM_POS_LE +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG;ARITH_RULE`0<= a`] +THEN GEN_TAC +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i + p MOD k`;`k:num`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + + + +REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (75-6)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(i + p MOD k) MOD k`;`SUC ((i + p MOD k) MOD k)`]) +THEN REPLICATE_TAC (76-34)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`(i + p MOD k) MOD k`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC +; + + + + +SUBGOAL_THEN`&0<= sum {(i + q MOD k) MOD k | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)} + (\i. cstab - dist ((vv:num->real^3) i,vv (SUC i)))`ASSUME_TAC + +; + + +MATCH_MP_TAC SUM_POS_LE +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG;ARITH_RULE`0<= a`] +THEN GEN_TAC +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i + q MOD k`;`k:num`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + + + +REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (76-6)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(i + q MOD k) MOD k`;`SUC ((i + q MOD k) MOD k)`]) +THEN REPLICATE_TAC (77-34)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`(i + q MOD k) MOD k`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC +; + + + +MRESA_TAC REAL_LE_RMUL[`-- &1`;`(if is_ear_v39 s' then &1 else -- &1)`;`sum {(i + p MOD k) MOD k | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)} + (\i. cstab - dist (vv i,(vv:num->real^3) (SUC i)))`] +THEN MRESA_TAC REAL_LE_RMUL[`-- &1`;`(if is_ear_v39 s'' then &1 else -- &1)`;`sum {(i + q MOD k) MOD k | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)} + (\i. cstab - dist (vv i,(vv:num->real^3) (SUC i)))`] +THEN SUBGOAL_THEN`FINITE + {(i + p MOD k) MOD k | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)}`ASSUME_TAC +; + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG;ARITH_RULE`0<= a`] +THEN GEN_TAC +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i + q MOD k`;`k:num`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + + + +SUBGOAL_THEN`FINITE + {(i + q MOD k) MOD k | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)}`ASSUME_TAC +; + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG;ARITH_RULE`0<= a`] +THEN GEN_TAC +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i + q MOD k`;`k:num`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + + +SUBGOAL_THEN`&0 <= + sum {i | i < k /\ scs_J_v39 s i (SUC i)} + (\i. cstab - dist (vv i,vv (SUC i))) - + (sum {(i + p MOD k) MOD k | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)} + (\i. cstab - dist (vv i,vv (SUC i))) + + sum {(i + q MOD k) MOD k | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)} + (\i. cstab - dist (vv i,(vv:num->real^3) (SUC i))))` ASSUME_TAC +; + + +SUBGOAL_THEN`(!i. scs_b_v39 s i (SUC i) <= cstab)`ASSUME_TAC; + + + +REPLICATE_TAC (67-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + + + + + +MP_TAC INTER_SLICE_SCS_EMPTY +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +THEN REPLICATE_TAC (68-37)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN ASSUME_TAC th THEN REPEAT RESA_TAC) +THEN SUBGOAL_THEN`{(i + p MOD k) MOD k | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)} INTER + {(i + q MOD k) MOD k | i < scs_k_v39 s'' - 1 /\ + scs_J_v39 s'' i (SUC i)}={}`ASSUME_TAC +; + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[INTER;IN_ELIM_THM] +THEN SET_TAC[]; + + + + +MRESAL_TAC SUM_INCL_EXCL[`{(i + p MOD k) MOD k | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)}`;`{(i + q MOD k) MOD k | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)}`;`(\i. cstab - dist ((vv:num->real^3) i,vv (SUC i)))`][SUM_CLAUSES;REAL_ARITH`a+ &0=a`;dist] +THEN SUBGOAL_THEN`{(i + p MOD k) MOD k | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)} UNION + {(i + q MOD k) MOD k | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)} +SUBSET {i | i < k /\ scs_J_v39 s i (SUC i)}`ASSUME_TAC +; + + + +REWRITE_TAC[UNION;IN_ELIM_THM;SUBSET] +THEN REPEAT RESA_TAC +; + + + + +MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i + p MOD k`;`k:num`] +; + + + + + +MP_TAC SCS_J_PRIME_SUBSET_SCS_J +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +; + + + + +MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i + q MOD k`;`k:num`] +; + + + +MRESA_TAC(GEN_ALL SCS_J_PRIME_SUBSET_SCS_J)[`d'':real`;`mkj:bool`;`p:num`;`s'':scs_v39`;`i:num`;`q:num`;`s:scs_v39`] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`]; + + + +SUBGOAL_THEN`FINITE {i | i < k /\ scs_J_v39 s i (SUC i)}` ASSUME_TAC +; + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + + +MRESA_TAC SUM_DIFF[`(\i. cstab - norm (vv i - (vv:num->real^3) (SUC i)))`;`{i | i < k /\ scs_J_v39 s i (SUC i)}`;`{(i + p MOD k) MOD k | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)} UNION + {(i + q MOD k) MOD k | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)}`;] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MATCH_MP_TAC SUM_POS_LE +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET; DIFF;IN_ELIM_THM;IN_NUMSEG;ARITH_RULE`0<= a`] +THEN ARITH_TAC; + + + + +REWRITE_TAC[IN_ELIM_THM;DIFF] +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (87-7)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`x:num`;`SUC (x)`]) +THEN REPLICATE_TAC (88-78)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`x:num`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + + + + +MATCH_MP_TAC(REAL_ARITH`-- &1 *a <=c* a /\ -- &1 *b<= d*b /\ &0<= a1-(a+b) ==> &0<= a1+ c*a+d*b`) +THEN ASM_REWRITE_TAC[] +; + + + + +MATCH_MP_TAC(REAL_ARITH`&0<=a ==> &0<= #0.1 *a`) +THEN MP_TAC SCS_J_DIAG_EQ +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;] +THEN ASM_SIMP_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +THEN REPLICATE_TAC (59-31)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (1)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th) +THEN REWRITE_TAC[] +THEN REPLICATE_TAC (59-31)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (1)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th) +THEN RESA_TAC +THEN SUBGOAL_THEN`scs_k_v39 s'=k'`ASSUME_TAC +; + + + + +EXPAND_TAC"s'" +THEN EXPAND_TAC"s''" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +; + + + +SUBGOAL_THEN`scs_k_v39 s''=k''`ASSUME_TAC +; + + + + +EXPAND_TAC"s'" +THEN EXPAND_TAC"s''" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +; + + +MP_TAC(ARITH_RULE`3<=k'/\ 3<=k'' ==> SUC(k'-1)=k' /\ SUC (k''-1)=k''`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`scs_J_v39 s' (scs_k_v39 s' - 1) (SUC (scs_k_v39 s' - 1)) \/ ~(scs_J_v39 s' (scs_k_v39 s' - 1) (SUC (scs_k_v39 s' - 1)))`) +THEN RESA_TAC; + + + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC SCS_HALF_SLICE_IS_A_SCS +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2] +THEN ASM_SIMP_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +THEN REPLICATE_TAC (64-58)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th +THEN ASM_REWRITE_TAC[]) +THEN REPLICATE_TAC (64-58)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th) +THEN RESA_TAC +THEN REPLICATE_TAC (81-72)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`0`;`k'-1`;][ARITH_RULE`0+A=A`]) +THEN SUBGOAL_THEN`(!i. scs_b_v39 s i (SUC i) <= cstab)`ASSUME_TAC; + + + +REPLICATE_TAC (83-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + + + + + +MRESAL_TAC(GEN_ALL SCS_HALF_SLICE_IS_A_SCS)[`s:scs_v39`;`s':scs_v39`;`q:num`;`p:num`;`s'':scs_v39`] +[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2] +THEN REPLICATE_TAC (85-35)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN ASSUME_TAC th THEN REPEAT RESA_TAC) +THEN REPLICATE_TAC (85-36)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN RESA_TAC) +THEN ASM_REWRITE_TAC[SET_RULE`A\/B<=> B\/A`] +THEN REPLICATE_TAC (84-63)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (1)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th +THEN ASM_REWRITE_TAC[]) +THEN REPLICATE_TAC (84-62)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (1)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th) +THEN ASM_REWRITE_TAC[REAL_ARITH`a<=b+c<=> a<= c+b`] +THEN STRIP_TAC +THEN REPLICATE_TAC (101-92)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`0`;`k''-1`;][ARITH_RULE`0+A=A`]) +THEN REPLICATE_TAC (102-57)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN REWRITE_TAC[SET_RULE`{a|a=b}={b}`;SUM_SING] +THEN MP_TAC(ARITH_RULE`3<=k'/\ 3<=k'' ==> (k'-1)real^3)(p MOD k)`;`q:num`;`s:scs_v39`;`(vv:num->real^3)`;`k':num`;`p:num`;`k:num`;`(vv:num->real^3) (q MOD k)`] +THEN MRESA_TAC (GEN_ALL W_EW_K_SCS_ADD_P)[ +`d'':real`;`mkj:bool`;`s'':scs_v39`;`(vv:num->real^3)(q MOD k)`;`p:num`;`s:scs_v39`;`(vv:num->real^3)`;`k'':num`;`q:num`;`k:num`;`(vv:num->real^3) (p MOD k)`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k'/\ 3<=k'' ==> ~(k'=0) /\ ~(k''=0)`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT[`k':num`;`1:num`][ARITH_RULE`k'*1 =k'/\ 0+A=A`] +THEN MRESAL_TAC MOD_MULT[`k'':num`;`1:num`][ARITH_RULE`k'*1 =k'/\ 0+A=A`] +THEN SUBGOAL_THEN`norm ((vv:num->real^3) (q MOD k) - vv (p MOD k)) =norm (vv (p MOD k) - vv (q MOD k))`ASSUME_TAC +; + + + +MP_TAC(VECTOR_ARITH`vv (q MOD k) - vv (p MOD k) = --(vv (p MOD k) - (vv:num->real^3) (q MOD k))`) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[NORM_NEG]; + + + +ASM_REWRITE_TAC[ARITH_RULE`a*b+c*b=(a+c)*b`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN STRIP_TAC; + + + +REPLICATE_TAC (124-92)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN RESA_TAC) +THEN REAL_ARITH_TAC +; + + + + +REPLICATE_TAC (124-92)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN RESA_TAC) +; + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[is_ear_v39] +THEN STRIP_TAC +THEN SUBGOAL_THEN`k'-1 IN {i | i < 3 /\ scs_J_v39 s' i (SUC i)}`ASSUME_TAC; + + + +ASM_REWRITE_TAC[IN_ELIM_THM;ARITH_RULE`3-1<3`] +THEN REPLICATE_TAC (132-88)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[]); + + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_SING;ARITH_RULE`3-1=2`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`d' = scs_d_v39 s' `ASSUME_TAC +; + + +EXPAND_TAC"s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +; + + +MP_TAC QKNVMLB1 +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`2`;`SUC 2`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`SUC 2 MOD 3=0/\ 0+A=A/\ 2 MOD 3=2`] +THEN REPLICATE_TAC (136-117)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`3-1=2`]) +THEN RESA_TAC +THEN REAL_ARITH_TAC; + + + + + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[is_ear_v39] +THEN STRIP_TAC +THEN SUBGOAL_THEN`k''-1 IN {i | i < 3 /\ scs_J_v39 s'' i (SUC i)}`ASSUME_TAC; + + + +ASM_REWRITE_TAC[IN_ELIM_THM;ARITH_RULE`3-1<3`] +THEN REPLICATE_TAC (132-110)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[]); + + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_SING;ARITH_RULE`3-1=2`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`d'' = scs_d_v39 s'' `ASSUME_TAC +; + + +EXPAND_TAC"s''" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +; + + +MRESAL_TAC (GEN_ALL QKNVMLB1)[`vv:num->real^3`;`s:scs_v39`;`q:num`;`p:num`;`d'':real`;`mkj:bool`] +[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;] +THEN REPLICATE_TAC (134-9)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN RESA_TAC) +THEN REWRITE_TAC[REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`2`;`SUC 2`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`SUC 2 MOD 3=0/\ 0+A=A/\ 2 MOD 3=2`] +THEN REPLICATE_TAC (136-117)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`3-1=2`]) +THEN RESA_TAC +THEN REAL_ARITH_TAC; + + + + + + + + + + + + +MP_TAC(VECTOR_ARITH`vv (q MOD k) - vv (p MOD k) = --(vv (p MOD k) - (vv:num->real^3) (q MOD k))`) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[NORM_NEG]; + + + +ASM_REWRITE_TAC[ARITH_RULE`a*b+c*b=(a+c)*b`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN STRIP_TAC; + + + +REPLICATE_TAC (124-92)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN RESA_TAC) +THEN REAL_ARITH_TAC +; + + + + +REPLICATE_TAC (124-92)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN RESA_TAC) +; + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[is_ear_v39] +THEN STRIP_TAC +THEN SUBGOAL_THEN`k'-1 IN {i | i < 3 /\ scs_J_v39 s' i (SUC i)}`ASSUME_TAC; + + + +ASM_REWRITE_TAC[IN_ELIM_THM;ARITH_RULE`3-1<3`] +THEN REPLICATE_TAC (132-88)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[]); + + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_SING;ARITH_RULE`3-1=2`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`d' = scs_d_v39 s' `ASSUME_TAC +; + + +EXPAND_TAC"s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +; + + +MP_TAC QKNVMLB1 +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`2`;`SUC 2`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`SUC 2 MOD 3=0/\ 0+A=A/\ 2 MOD 3=2`] +THEN REPLICATE_TAC (136-117)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`3-1=2`]) +THEN RESA_TAC +THEN REAL_ARITH_TAC; + + + + + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[is_ear_v39] +THEN STRIP_TAC +THEN SUBGOAL_THEN`k''-1 IN {i | i < 3 /\ scs_J_v39 s'' i (SUC i)}`ASSUME_TAC; + + + +ASM_REWRITE_TAC[IN_ELIM_THM;ARITH_RULE`3-1<3`] +THEN REPLICATE_TAC (132-110)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[]); + + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_SING;ARITH_RULE`3-1=2`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`d'' = scs_d_v39 s'' `ASSUME_TAC +; + + +EXPAND_TAC"s''" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +; + + +MRESAL_TAC (GEN_ALL QKNVMLB1)[`vv:num->real^3`;`s:scs_v39`;`q:num`;`p:num`;`d'':real`;`mkj:bool`] +[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;] +THEN REPLICATE_TAC (134-9)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN RESA_TAC) +THEN REWRITE_TAC[REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`2`;`SUC 2`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`SUC 2 MOD 3=0/\ 0+A=A/\ 2 MOD 3=2`] +THEN REPLICATE_TAC (136-117)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`3-1=2`]) +THEN RESA_TAC +THEN REAL_ARITH_TAC; + + + + + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC SCS_HALF_SLICE_IS_A_SCS +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2] +THEN ASM_SIMP_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +THEN REPLICATE_TAC (64-58)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th +THEN ASM_REWRITE_TAC[]) +THEN REPLICATE_TAC (64-58)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th) +THEN RESA_TAC +THEN REPLICATE_TAC (81-72)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`0`;`k'-1`;][ARITH_RULE`0+A=A`]) +THEN SUBGOAL_THEN`(!i. scs_b_v39 s i (SUC i) <= cstab)`ASSUME_TAC; + + + +REPLICATE_TAC (83-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + + + + + +MRESAL_TAC(GEN_ALL SCS_HALF_SLICE_IS_A_SCS)[`s:scs_v39`;`s':scs_v39`;`q:num`;`p:num`;`s'':scs_v39`] +[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2] +THEN REPLICATE_TAC (85-35)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN ASSUME_TAC th THEN REPEAT RESA_TAC) +THEN REPLICATE_TAC (85-36)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN RESA_TAC) +THEN ASM_REWRITE_TAC[SET_RULE`A\/B<=> B\/A`] +THEN REPLICATE_TAC (84-63)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (1)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th +THEN ASM_REWRITE_TAC[]) +THEN REPLICATE_TAC (84-62)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (1)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th) +THEN ASM_REWRITE_TAC[REAL_ARITH`a<=b+c<=> a<= c+b`] +THEN STRIP_TAC +THEN REPLICATE_TAC (101-92)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`0`;`k''-1`;][ARITH_RULE`0+A=A`]) +THEN REPLICATE_TAC (102-57)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN REWRITE_TAC[SET_RULE`{a|F}={}`;SUM_SING;SUM_CLAUSES] +THEN REAL_ARITH_TAC; + + + +(********************************) + + + + +REPLICATE_TAC (7) (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`FINITE {i | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)} +` ASSUME_TAC +; + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. (scs_k_v39 s' -1)` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + +SUBGOAL_THEN`{i | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)} INTER + {i| i=scs_k_v39 s' - 1/\ scs_J_v39 s' (scs_k_v39 s' - 1) (SUC (scs_k_v39 s' - 1)) }={}` ASSUME_TAC +; + + +REWRITE_TAC[INTER;SET_RULE`A={}<=> ~(?a. a IN A)`;IN_ELIM_THM;IN_SING] +THEN ARITH_TAC; + + + +SUBGOAL_THEN`{i | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)} UNION + {i| i=scs_k_v39 s' - 1/\ scs_J_v39 s' (scs_k_v39 s' - 1) (SUC(scs_k_v39 s'-1)) }={i | i < scs_k_v39 s' /\ scs_J_v39 s' i (SUC i)}` +ASSUME_TAC; + + +REWRITE_TAC[UNION;IN_SING;IN_ELIM_THM;EXTENSION] +THEN GEN_TAC +THEN EXPAND_TAC "s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (47-43) REMOVE_ASSUM_TAC +THEN EQ_TAC +; + + +RESA_TAC +; + +REPLICATE_TAC (47-40) (POP_ASSUM MP_TAC) +THEN ARITH_TAC +; + + + +MP_TAC(ARITH_RULE`3<=k' ==>SUC (k' - 1) =k'/\ k'-1 x< k'-1 \/ (x=k'-1)`) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> +POP_ASSUM MP_TAC +THEN REWRITE_TAC[th] +THEN RESA_TAC) +; + + + +SUBGOAL_THEN`FINITE + {i | i = scs_k_v39 s' - 1 /\ + scs_J_v39 s' (scs_k_v39 s' - 1) (SUC (scs_k_v39 s' - 1))}`ASSUME_TAC +; + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`{(scs_k_v39 s' -1)}` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_SING;FINITE_SING] +THEN SET_TAC[]; + + + +MRESAL_TAC SUM_INCL_EXCL[`{i | i < scs_k_v39 s'-1 /\ scs_J_v39 s' i (SUC i)}`;`{i| i=scs_k_v39 s' - 1/\ scs_J_v39 s' (scs_k_v39 s' - 1) (SUC(scs_k_v39 s'-1)) }`;`(\i. cstab - + dist + ((vv:num->real^3) (i MOD scs_k_v39 s' + p MOD k), + vv (SUC i MOD scs_k_v39 s' + p MOD k)))`][FINITE_SING;SUM_SING;SUM_CLAUSES;REAL_ARITH`a+ &0=a`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`FINITE {i | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)} +` ASSUME_TAC +; + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. (scs_k_v39 s'' -1)` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + +SUBGOAL_THEN`{i | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)} INTER + {i| i=scs_k_v39 s'' - 1/\ scs_J_v39 s'' (scs_k_v39 s'' - 1) (SUC (scs_k_v39 s'' - 1)) }={}` ASSUME_TAC +; + + +REWRITE_TAC[INTER;SET_RULE`A={}<=> ~(?a. a IN A)`;IN_ELIM_THM;IN_SING] +THEN ARITH_TAC; + + + +SUBGOAL_THEN`{i | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)} UNION + {i| i=scs_k_v39 s'' - 1/\ scs_J_v39 s'' (scs_k_v39 s'' - 1) (SUC(scs_k_v39 s''-1)) }={i | i < scs_k_v39 s'' /\ scs_J_v39 s'' i (SUC i)}` +ASSUME_TAC; + + +REWRITE_TAC[UNION;IN_SING;IN_ELIM_THM;EXTENSION] +THEN GEN_TAC +THEN EXPAND_TAC "s''" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (47-43) REMOVE_ASSUM_TAC +THEN EQ_TAC +; + + +RESA_TAC +; + +REPLICATE_TAC (47-40) (POP_ASSUM MP_TAC) +THEN ARITH_TAC +; + + + +MP_TAC(ARITH_RULE`3<=k'' ==>SUC (k'' - 1) =k''/\ k''-1 x< k''-1 \/ (x=k''-1)`) +THEN RESA_TAC +THEN POP_ASSUM (fun th-> +POP_ASSUM MP_TAC +THEN REWRITE_TAC[th] +THEN RESA_TAC) +; + + + +SUBGOAL_THEN`FINITE + {i | i = scs_k_v39 s'' - 1 /\ + scs_J_v39 s'' (scs_k_v39 s'' - 1) (SUC (scs_k_v39 s'' - 1))}`ASSUME_TAC +; + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`{(scs_k_v39 s'' -1)}` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_SING;FINITE_SING] +THEN SET_TAC[]; + + + +MRESAL_TAC SUM_INCL_EXCL[`{i | i < scs_k_v39 s''-1 /\ scs_J_v39 s'' i (SUC i)}`;`{i| i=scs_k_v39 s'' - 1/\ scs_J_v39 s'' (scs_k_v39 s'' - 1) (SUC(scs_k_v39 s''-1)) }`;`(\i. cstab - + dist + ((vv:num->real^3) (i MOD scs_k_v39 s'' + q MOD k), + vv (SUC i MOD scs_k_v39 s'' + q MOD k)))`][FINITE_SING;SUM_SING;SUM_CLAUSES;REAL_ARITH`a+ &0=a`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`sum + {i | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)} + (\i. cstab - + dist + (vv (i MOD scs_k_v39 s' + p MOD k), + (vv:num->real^3) (SUC i MOD scs_k_v39 s' + p MOD k))) += sum + {(i + p MOD scs_k_v39 s) MOD scs_k_v39 s | i < scs_k_v39 s'-1 + /\ scs_J_v39 s' i (SUC i)} + (\i. cstab - + dist + (vv (i ), + vv (SUC i )))`ASSUME_TAC +; + + + +MATCH_MP_TAC SUM_EQ_GENERAL +THEN REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`(\i. (i + p MOD scs_k_v39 s) MOD scs_k_v39 s)` +THEN ASM_REWRITE_TAC[EXISTS_UNIQUE] +THEN REPEAT RESA_TAC; + + +EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +; + + + +REPEAT STRIP_TAC +THEN REPLICATE_TAC (47-40) (POP_ASSUM MP_TAC) +THEN EXPAND_TAC "s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`i i x real^3`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x + p MOD k):num` +THEN MRESA1_TAC th ` ((x + p MOD k) +1):num` +THEN MRESA1_TAC th ` SUC ((x + p MOD k) MOD k):num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_LT[`1`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`x+p MOD k`;`1`;`k:num`] +THEN REWRITE_TAC[ARITH_RULE`((x + p MOD k) + 1)= (x+ 1) + p MOD k`] +; + + + + +SUBGOAL_THEN`sum + {i | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)} + (\i. cstab - + dist + (vv (i MOD scs_k_v39 s'' + q MOD k), + (vv:num->real^3) (SUC i MOD scs_k_v39 s'' + q MOD k))) += sum + {(i + q MOD scs_k_v39 s) MOD scs_k_v39 s | i < scs_k_v39 s''-1 + /\ scs_J_v39 s'' i (SUC i)} + (\i. cstab - + dist + (vv (i ), + vv (SUC i )))`ASSUME_TAC +; + + + +MATCH_MP_TAC SUM_EQ_GENERAL +THEN REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`(\i. (i + q MOD scs_k_v39 s) MOD scs_k_v39 s)` +THEN ASM_REWRITE_TAC[EXISTS_UNIQUE] +THEN REPEAT RESA_TAC; + + +EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +; + + + +REPEAT STRIP_TAC +THEN REPLICATE_TAC (47-40) (POP_ASSUM MP_TAC) +THEN EXPAND_TAC "s''" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`i i x real^3`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x + q MOD k):num` +THEN MRESA1_TAC th ` ((x + q MOD k) +1):num` +THEN MRESA1_TAC th ` SUC ((x + q MOD k) MOD k):num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_LT[`1`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`x+q MOD k`;`1`;`k:num`] +THEN REWRITE_TAC[ARITH_RULE`((x + q MOD k) + 1)= (x+ 1) + q MOD k`] +; + + + +ASM_REWRITE_TAC[ +REAL_ARITH`a + b * (-- &1) *c <= (a1 + b * d1 *(c1+c2)) + a2 + b * d2 *(c3+c4) +<=> &0<= (a1+ a2-a) + b*(c+ d1* c1 +d2*c3)+ b*(d1* c2+ d2* c4)`] +THEN MATCH_MP_TAC(REAL_ARITH`&0<=a /\ &0<=b /\ &0<=c==> &0<= a+b+c`) +THEN STRIP_TAC; + +EXPAND_TAC "s'" +THEN EXPAND_TAC "s''" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +; + + + +STRIP_TAC; + + +MATCH_MP_TAC(REAL_ARITH`&0<= a==> &0<= #0.1 *a`) +THEN SUBGOAL_THEN`-- &1<= if is_ear_v39 s' then &1 else -- &1` ASSUME_TAC; + + + +MP_TAC(SET_RULE`is_ear_v39 s' \/ ~(is_ear_v39 s')`) +THEN RESA_TAC +THEN REAL_ARITH_TAC; + + + SUBGOAL_THEN`-- &1<= if is_ear_v39 s'' then &1 else -- &1` ASSUME_TAC; + + + +MP_TAC(SET_RULE`is_ear_v39 s'' \/ ~(is_ear_v39 s'')`) +THEN RESA_TAC +THEN REAL_ARITH_TAC; + + + +SUBGOAL_THEN`&0<= sum {(i + p MOD k) MOD k | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)} + (\i. cstab - dist ((vv:num->real^3) i,vv (SUC i)))`ASSUME_TAC + +; + + +MATCH_MP_TAC SUM_POS_LE +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG;ARITH_RULE`0<= a`] +THEN GEN_TAC +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i + p MOD k`;`k:num`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + + + +REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (75-6)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(i + p MOD k) MOD k`;`SUC ((i + p MOD k) MOD k)`]) +THEN REPLICATE_TAC (76-34)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`(i + p MOD k) MOD k`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC +; + + + + +SUBGOAL_THEN`&0<= sum {(i + q MOD k) MOD k | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)} + (\i. cstab - dist ((vv:num->real^3) i,vv (SUC i)))`ASSUME_TAC + +; + + +MATCH_MP_TAC SUM_POS_LE +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG;ARITH_RULE`0<= a`] +THEN GEN_TAC +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i + q MOD k`;`k:num`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + + + +REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (76-6)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(i + q MOD k) MOD k`;`SUC ((i + q MOD k) MOD k)`]) +THEN REPLICATE_TAC (77-34)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`(i + q MOD k) MOD k`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC +; + + + +MRESA_TAC REAL_LE_RMUL[`-- &1`;`(if is_ear_v39 s' then &1 else -- &1)`;`sum {(i + p MOD k) MOD k | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)} + (\i. cstab - dist (vv i,(vv:num->real^3) (SUC i)))`] +THEN MRESA_TAC REAL_LE_RMUL[`-- &1`;`(if is_ear_v39 s'' then &1 else -- &1)`;`sum {(i + q MOD k) MOD k | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)} + (\i. cstab - dist (vv i,(vv:num->real^3) (SUC i)))`] +THEN SUBGOAL_THEN`FINITE + {(i + p MOD k) MOD k | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)}`ASSUME_TAC +; + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG;ARITH_RULE`0<= a`] +THEN GEN_TAC +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i + q MOD k`;`k:num`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + + + +SUBGOAL_THEN`FINITE + {(i + q MOD k) MOD k | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)}`ASSUME_TAC +; + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG;ARITH_RULE`0<= a`] +THEN GEN_TAC +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i + q MOD k`;`k:num`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + + +SUBGOAL_THEN`&0 <= + sum {i | i < k /\ scs_J_v39 s i (SUC i)} + (\i. cstab - dist (vv i,vv (SUC i))) - + (sum {(i + p MOD k) MOD k | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)} + (\i. cstab - dist (vv i,vv (SUC i))) + + sum {(i + q MOD k) MOD k | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)} + (\i. cstab - dist (vv i,(vv:num->real^3) (SUC i))))` ASSUME_TAC +; + + +SUBGOAL_THEN`(!i. scs_b_v39 s i (SUC i) <= cstab)`ASSUME_TAC; + + + +REPLICATE_TAC (67-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + + + + + +MP_TAC INTER_SLICE_SCS_EMPTY +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +THEN REPLICATE_TAC (68-37)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN ASSUME_TAC th THEN REPEAT RESA_TAC) +THEN SUBGOAL_THEN`{(i + p MOD k) MOD k | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)} INTER + {(i + q MOD k) MOD k | i < scs_k_v39 s'' - 1 /\ + scs_J_v39 s'' i (SUC i)}={}`ASSUME_TAC +; + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[INTER;IN_ELIM_THM] +THEN SET_TAC[]; + + + + +MRESAL_TAC SUM_INCL_EXCL[`{(i + p MOD k) MOD k | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)}`;`{(i + q MOD k) MOD k | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)}`;`(\i. cstab - dist ((vv:num->real^3) i,vv (SUC i)))`][SUM_CLAUSES;REAL_ARITH`a+ &0=a`;dist] +THEN SUBGOAL_THEN`{(i + p MOD k) MOD k | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)} UNION + {(i + q MOD k) MOD k | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)} +SUBSET {i | i < k /\ scs_J_v39 s i (SUC i)}`ASSUME_TAC +; + + + +REWRITE_TAC[UNION;IN_ELIM_THM;SUBSET] +THEN REPEAT RESA_TAC +; + + + + +MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i + p MOD k`;`k:num`] +; + + + + + +MP_TAC SCS_J_PRIME_SUBSET_SCS_J +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +; + + + + +MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i + q MOD k`;`k:num`] +; + + + +MRESA_TAC(GEN_ALL SCS_J_PRIME_SUBSET_SCS_J)[`d'':real`;`mkj:bool`;`p:num`;`s'':scs_v39`;`i:num`;`q:num`;`s:scs_v39`] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`]; + + + +SUBGOAL_THEN`FINITE {i | i < k /\ scs_J_v39 s i (SUC i)}` ASSUME_TAC +; + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + + +MRESA_TAC SUM_DIFF[`(\i. cstab - norm (vv i - (vv:num->real^3) (SUC i)))`;`{i | i < k /\ scs_J_v39 s i (SUC i)}`;`{(i + p MOD k) MOD k | i < scs_k_v39 s' - 1 /\ scs_J_v39 s' i (SUC i)} UNION + {(i + q MOD k) MOD k | i < scs_k_v39 s'' - 1 /\ scs_J_v39 s'' i (SUC i)}`;] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MATCH_MP_TAC SUM_POS_LE +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET; DIFF;IN_ELIM_THM;IN_NUMSEG;ARITH_RULE`0<= a`] +THEN ARITH_TAC; + + + + +REWRITE_TAC[IN_ELIM_THM;DIFF] +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (87-7)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`x:num`;`SUC (x)`]) +THEN REPLICATE_TAC (88-78)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`x:num`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + + + + +MATCH_MP_TAC(REAL_ARITH`-- &1 *a <=c* a /\ -- &1 *b<= d*b /\ &0<= a1-(a+b) ==> &0<= a1+ c*a+d*b`) +THEN ASM_REWRITE_TAC[] +; + + + + +MATCH_MP_TAC(REAL_ARITH`&0<=a ==> &0<= #0.1 *a`) +THEN MP_TAC SCS_J_DIAG_EQ +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;] +THEN ASM_SIMP_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +THEN REPLICATE_TAC (59-31)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (1)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th) +THEN REWRITE_TAC[] +THEN REPLICATE_TAC (59-31)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (1)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th) +THEN RESA_TAC +THEN SUBGOAL_THEN`scs_k_v39 s'=k'`ASSUME_TAC +; + + + + +EXPAND_TAC"s'" +THEN EXPAND_TAC"s''" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +; + + + +SUBGOAL_THEN`scs_k_v39 s''=k''`ASSUME_TAC +; + + + + +EXPAND_TAC"s'" +THEN EXPAND_TAC"s''" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +; + + +MP_TAC(ARITH_RULE`3<=k'/\ 3<=k'' ==> SUC(k'-1)=k' /\ SUC (k''-1)=k''`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`scs_J_v39 s' (scs_k_v39 s' - 1) (SUC (scs_k_v39 s' - 1)) \/ ~(scs_J_v39 s' (scs_k_v39 s' - 1) (SUC (scs_k_v39 s' - 1)))`) +THEN RESA_TAC; + + + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC SCS_HALF_SLICE_IS_A_SCS +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2] +THEN ASM_SIMP_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +THEN REPLICATE_TAC (64-58)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th +THEN ASM_REWRITE_TAC[]) +THEN REPLICATE_TAC (64-58)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th) +THEN RESA_TAC +THEN REPLICATE_TAC (81-72)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`0`;`k'-1`;][ARITH_RULE`0+A=A`]) +THEN SUBGOAL_THEN`(!i. scs_b_v39 s i (SUC i) <= cstab)`ASSUME_TAC; + + + +REPLICATE_TAC (83-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + + + + + +MRESAL_TAC(GEN_ALL SCS_HALF_SLICE_IS_A_SCS)[`s:scs_v39`;`s':scs_v39`;`q:num`;`p:num`;`s'':scs_v39`] +[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2] +THEN REPLICATE_TAC (85-35)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN ASSUME_TAC th THEN REPEAT RESA_TAC) +THEN REPLICATE_TAC (85-36)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN RESA_TAC) +THEN ASM_REWRITE_TAC[SET_RULE`A\/B<=> B\/A`] +THEN REPLICATE_TAC (84-63)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (1)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th +THEN ASM_REWRITE_TAC[]) +THEN REPLICATE_TAC (84-62)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (1)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th) +THEN ASM_REWRITE_TAC[REAL_ARITH`a<=b+c<=> a<= c+b`] +THEN STRIP_TAC +THEN REPLICATE_TAC (101-92)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`0`;`k''-1`;][ARITH_RULE`0+A=A`]) +THEN REPLICATE_TAC (102-57)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN REWRITE_TAC[SET_RULE`{a|a=b}={b}`;SUM_SING] +THEN MP_TAC(ARITH_RULE`3<=k'/\ 3<=k'' ==> (k'-1)real^3)(p MOD k)`;`q:num`;`s:scs_v39`;`(vv:num->real^3)`;`k':num`;`p:num`;`k:num`;`(vv:num->real^3) (q MOD k)`] +THEN MRESA_TAC (GEN_ALL W_EW_K_SCS_ADD_P)[ +`d'':real`;`mkj:bool`;`s'':scs_v39`;`(vv:num->real^3)(q MOD k)`;`p:num`;`s:scs_v39`;`(vv:num->real^3)`;`k'':num`;`q:num`;`k:num`;`(vv:num->real^3) (p MOD k)`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k'/\ 3<=k'' ==> ~(k'=0) /\ ~(k''=0)`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT[`k':num`;`1:num`][ARITH_RULE`k'*1 =k'/\ 0+A=A`] +THEN MRESAL_TAC MOD_MULT[`k'':num`;`1:num`][ARITH_RULE`k'*1 =k'/\ 0+A=A`] +THEN SUBGOAL_THEN`norm ((vv:num->real^3) (q MOD k) - vv (p MOD k)) =norm (vv (p MOD k) - vv (q MOD k))`ASSUME_TAC +; + + + +MP_TAC(VECTOR_ARITH`vv (q MOD k) - vv (p MOD k) = --(vv (p MOD k) - (vv:num->real^3) (q MOD k))`) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[NORM_NEG]; + + + +ASM_REWRITE_TAC[ARITH_RULE`a*b+c*b=(a+c)*b`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN STRIP_TAC; + + + +REPLICATE_TAC (124-92)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN RESA_TAC) +THEN REAL_ARITH_TAC +; + + + + +REPLICATE_TAC (124-92)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN RESA_TAC) +; + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[is_ear_v39] +THEN STRIP_TAC +THEN SUBGOAL_THEN`k'-1 IN {i | i < 3 /\ scs_J_v39 s' i (SUC i)}`ASSUME_TAC; + + + +ASM_REWRITE_TAC[IN_ELIM_THM;ARITH_RULE`3-1<3`] +THEN REPLICATE_TAC (132-88)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[]); + + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_SING;ARITH_RULE`3-1=2`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`d' = scs_d_v39 s' `ASSUME_TAC +; + + +EXPAND_TAC"s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +; + + +MP_TAC QKNVMLB1 +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`2`;`SUC 2`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`SUC 2 MOD 3=0/\ 0+A=A/\ 2 MOD 3=2`] +THEN REPLICATE_TAC (136-117)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`3-1=2`]) +THEN RESA_TAC +THEN REAL_ARITH_TAC; + + + + + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[is_ear_v39] +THEN STRIP_TAC +THEN SUBGOAL_THEN`k''-1 IN {i | i < 3 /\ scs_J_v39 s'' i (SUC i)}`ASSUME_TAC; + + + +ASM_REWRITE_TAC[IN_ELIM_THM;ARITH_RULE`3-1<3`] +THEN REPLICATE_TAC (132-110)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[]); + + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_SING;ARITH_RULE`3-1=2`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`d'' = scs_d_v39 s'' `ASSUME_TAC +; + + +EXPAND_TAC"s''" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +; + + +MRESAL_TAC (GEN_ALL QKNVMLB1)[`vv:num->real^3`;`s:scs_v39`;`q:num`;`p:num`;`d'':real`;`mkj:bool`] +[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;] +THEN REPLICATE_TAC (134-9)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN RESA_TAC) +THEN REWRITE_TAC[REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`2`;`SUC 2`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`SUC 2 MOD 3=0/\ 0+A=A/\ 2 MOD 3=2`] +THEN REPLICATE_TAC (136-117)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`3-1=2`]) +THEN RESA_TAC +THEN REAL_ARITH_TAC; + + + + + + + + + + + + +MP_TAC(VECTOR_ARITH`vv (q MOD k) - vv (p MOD k) = --(vv (p MOD k) - (vv:num->real^3) (q MOD k))`) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[NORM_NEG]; + + + +ASM_REWRITE_TAC[ARITH_RULE`a*b+c*b=(a+c)*b`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN STRIP_TAC; + + + +REPLICATE_TAC (124-92)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN RESA_TAC) +THEN REAL_ARITH_TAC +; + + + + +REPLICATE_TAC (124-92)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN RESA_TAC) +; + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[is_ear_v39] +THEN STRIP_TAC +THEN SUBGOAL_THEN`k'-1 IN {i | i < 3 /\ scs_J_v39 s' i (SUC i)}`ASSUME_TAC; + + + +ASM_REWRITE_TAC[IN_ELIM_THM;ARITH_RULE`3-1<3`] +THEN REPLICATE_TAC (132-88)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[]); + + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_SING;ARITH_RULE`3-1=2`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`d' = scs_d_v39 s' `ASSUME_TAC +; + + +EXPAND_TAC"s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +; + + +MP_TAC QKNVMLB1 +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`2`;`SUC 2`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`SUC 2 MOD 3=0/\ 0+A=A/\ 2 MOD 3=2`] +THEN REPLICATE_TAC (136-117)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`3-1=2`]) +THEN RESA_TAC +THEN REAL_ARITH_TAC; + + + + + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[is_ear_v39] +THEN STRIP_TAC +THEN SUBGOAL_THEN`k''-1 IN {i | i < 3 /\ scs_J_v39 s'' i (SUC i)}`ASSUME_TAC; + + + +ASM_REWRITE_TAC[IN_ELIM_THM;ARITH_RULE`3-1<3`] +THEN REPLICATE_TAC (132-110)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[]); + + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_SING;ARITH_RULE`3-1=2`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`d'' = scs_d_v39 s'' `ASSUME_TAC +; + + +EXPAND_TAC"s''" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +; + + +MRESAL_TAC (GEN_ALL QKNVMLB1)[`vv:num->real^3`;`s:scs_v39`;`q:num`;`p:num`;`d'':real`;`mkj:bool`] +[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;] +THEN REPLICATE_TAC (134-9)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN RESA_TAC) +THEN REWRITE_TAC[REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`2`;`SUC 2`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`SUC 2 MOD 3=0/\ 0+A=A/\ 2 MOD 3=2`] +THEN REPLICATE_TAC (136-117)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`3-1=2`]) +THEN RESA_TAC +THEN REAL_ARITH_TAC; + + + + + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC SCS_HALF_SLICE_IS_A_SCS +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2] +THEN ASM_SIMP_TAC[REAL_ARITH`&0<= A+B -C<=> C<= A+B`] +THEN REPLICATE_TAC (64-58)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th +THEN ASM_REWRITE_TAC[]) +THEN REPLICATE_TAC (64-58)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th) +THEN RESA_TAC +THEN REPLICATE_TAC (81-72)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`0`;`k'-1`;][ARITH_RULE`0+A=A`]) +THEN SUBGOAL_THEN`(!i. scs_b_v39 s i (SUC i) <= cstab)`ASSUME_TAC; + + + +REPLICATE_TAC (83-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + + + + + +MRESAL_TAC(GEN_ALL SCS_HALF_SLICE_IS_A_SCS)[`s:scs_v39`;`s':scs_v39`;`q:num`;`p:num`;`s'':scs_v39`] +[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2] +THEN REPLICATE_TAC (85-35)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN ASSUME_TAC th THEN REPEAT RESA_TAC) +THEN REPLICATE_TAC (85-36)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN RESA_TAC) +THEN ASM_REWRITE_TAC[SET_RULE`A\/B<=> B\/A`] +THEN REPLICATE_TAC (84-63)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (1)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th +THEN ASM_REWRITE_TAC[]) +THEN REPLICATE_TAC (84-62)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (1)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th) +THEN ASM_REWRITE_TAC[REAL_ARITH`a<=b+c<=> a<= c+b`] +THEN STRIP_TAC +THEN REPLICATE_TAC (101-92)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`0`;`k''-1`;][ARITH_RULE`0+A=A`]) +THEN REPLICATE_TAC (102-57)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN REWRITE_TAC[SET_RULE`{a|F}={}`;SUM_SING;SUM_CLAUSES] +THEN REAL_ARITH_TAC; + + +]);; + + + + + +let DIST_DIAG_LE_CSTAB= prove_by_refinement( +`~(scs_k_v39 s =4 /\ ~(scs_J_v39 s' 0 (scs_k_v39 s' - 1)))/\ + scs_half_slice_v39 s p q d' mkj =s'/\ + scs_half_slice_v39 s q p d'' mkj =s'' /\ + MMs_v39 s vv /\ + is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q /\ + is_scs_slice_v39 s s' s'' p q + ==> +norm(vv (p MOD (scs_k_v39 s)) - vv (q MOD (scs_k_v39 s)))<= cstab`, +[ + +STRIP_TAC +THEN MP_TAC SCS_K_PRIME_CASE_3 +THEN REWRITE_TAC[taustar_v39;LET_DEF;LET_END_DEF;] +THEN RESA_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN MP_TAC(ARITH_RULE`3 ~(k<=3)`) +THEN RESA_TAC +THEN MP_TAC SCS_K_LE_6 +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (48-5)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[]) +THEN STRIP_TAC +THEN ABBREV_TAC`k'=scs_k_v39 s'` +THEN ABBREV_TAC`k''=scs_k_v39 s''` +THEN MP_TAC(SET_RULE`scs_J_v39 s' 0 (scs_k_v39 s' - 1) \/ ~(scs_J_v39 s' 0 (scs_k_v39 s' - 1) )`) +THEN RESA_TAC +; + + +REPLICATE_TAC (52)(POP_ASSUM MP_TAC) +THEN REMOVE_ASSUM_TAC +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (51-43)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[]) +; + + +STRIP_TAC; + + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[is_ear_v39;is_scs_v39;periodic2] +THEN STRIP_TAC +THEN SUBGOAL_THEN`k'-1 IN {i | i < 3 /\ scs_J_v39 s' i (SUC i)}`ASSUME_TAC; + + + + + +ASM_REWRITE_TAC[IN_ELIM_THM;ARITH_RULE`3-1<3`] +THEN REPLICATE_TAC (77-60)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`0`;`3-1`][ARITH_RULE`0+3=3`] +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(3-1)=3`]) +THEN REPLICATE_TAC (78-50)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(3-1)=3`]) +; + + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_SING;ARITH_RULE`3-1=2`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (77-5)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(3-1)=3`]) +THEN STRIP_TAC +THEN SUBGOAL_THEN`d' = scs_d_v39 s' `ASSUME_TAC +; + + + +EXPAND_TAC"s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +; + + +MP_TAC QKNVMLB1 +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`2`;`SUC 2`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`SUC 2 MOD 3=0/\ 0+A=A/\ 2 MOD 3=2`;dist] +THEN MRESAL_TAC (GEN_ALL W_EW_K_SCS_ADD_P)[ +`d':real`;`mkj:bool`;`s':scs_v39`;`(vv:num->real^3)(p MOD k)`;`q:num`;`s:scs_v39`;`(vv:num->real^3)`;`k':num`;`p:num`;`k:num`;`(vv:num->real^3) (q MOD k)`][MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;ARITH_RULE`3-1=2`] +THEN SUBGOAL_THEN`norm ((vv:num->real^3) (q MOD k) - vv (p MOD k)) =norm (vv (p MOD k) - vv (q MOD k))`ASSUME_TAC +; + + + +MP_TAC(VECTOR_ARITH`vv (q MOD k) - vv (p MOD k) = --(vv (p MOD k) - (vv:num->real^3) (q MOD k))`) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[NORM_NEG]; + + +RESA_TAC; + + + +MP_TAC SCS_J_DIAG_EQ +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;is_ear_v39] +THEN REPLICATE_TAC (51-36)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (1)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASM_REWRITE_TAC[] +THEN ASSUME_TAC th) +THEN REPLICATE_TAC (51-36)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REPLICATE_TAC (1)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASM_REWRITE_TAC[] +THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN REPLICATE_TAC (51-48)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[is_ear_v39;is_scs_v39;periodic2] +THEN STRIP_TAC) +THEN SUBGOAL_THEN`k''-1 IN {i | i < 3 /\ scs_J_v39 s'' i (SUC i)}`ASSUME_TAC; + + + + + +ASM_REWRITE_TAC[IN_ELIM_THM;ARITH_RULE`3-1<3`] +THEN REPLICATE_TAC (78-61)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`0`;`3-1`][ARITH_RULE`0+3=3`] +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(3-1)=3`]) +THEN REPLICATE_TAC (79-51)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(3-1)=3`]) +; + + + + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_SING;ARITH_RULE`3-1=2`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (78-5)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(3-1)=3`]) +THEN STRIP_TAC +THEN SUBGOAL_THEN`d'' = scs_d_v39 s'' `ASSUME_TAC +; + + + +EXPAND_TAC"s''" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +; + + +MRESAL_TAC (GEN_ALL QKNVMLB1)[`vv:num->real^3`;`s:scs_v39`;`q:num`;`p:num`;`d'':real`;`mkj:bool`] +[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`] +THEN REPLICATE_TAC (80-41)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[ARITH_RULE`SUC(3-1)=3`;SYM th] +THEN REWRITE_TAC[th] +THEN MP_TAC th) +THEN REPEAT RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`2`;`SUC 2`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`SUC 2 MOD 3=0/\ 0+A=A/\ 2 MOD 3=2`;dist] +THEN MRESAL_TAC (GEN_ALL W_EW_K_SCS_ADD_P)[ +`d'':real`;`mkj:bool`;`s'':scs_v39`;`(vv:num->real^3)(q MOD k)`;`p:num`;`s:scs_v39`;`(vv:num->real^3)`;`k'':num`;`q:num`;`k:num`;`(vv:num->real^3) (p MOD k)`][MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;ARITH_RULE`3-1=2`] +; + + + + + +REPLICATE_TAC (52)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[]) +; + + + + + + +REPLICATE_TAC (52-6)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(3-1)=3`]) +THEN STRIP_TAC +THEN SUBGOAL_THEN`d' = scs_d_v39 s' `ASSUME_TAC +; + + + +EXPAND_TAC"s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +; + + +SUBGOAL_THEN` (q+1+k -p MOD k)MOD k =scs_k_v39 s'` ASSUME_TAC +; + + +EXPAND_TAC"s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[] +; + + + +MRESA_TAC (GEN_ALL SCS_K_PRIME_LE_GE)[`s:scs_v39`;`p:num`;`q:num`;`d':real`;`scs_J_v39 s' p q`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;scs_half_slice_v39;PAIR_EQ;REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= k' /\ k' 0real^3)(p MOD k)`;`q:num`;`s:scs_v39`;`(vv:num->real^3)`;`k':num`;`p:num`;`k:num`;`(vv:num->real^3) (q MOD k)`][MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;ARITH_RULE`3-1=2`] +THEN MP_TAC QKNVMLB1 +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`0`;`k'-1`][ARITH_RULE`0+A=A`;dist]) +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (66-42)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[cstab]) +THEN REAL_ARITH_TAC; + + + +REPLICATE_TAC (52-6)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(3-1)=3`]) +THEN STRIP_TAC +THEN SUBGOAL_THEN`d' = scs_d_v39 s' `ASSUME_TAC +; + + + +EXPAND_TAC"s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +; + + +SUBGOAL_THEN` (q+1+k -p MOD k)MOD k =scs_k_v39 s'` ASSUME_TAC +; + + +EXPAND_TAC"s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[] +; + + + +MRESA_TAC (GEN_ALL SCS_K_PRIME_LE_GE)[`s:scs_v39`;`p:num`;`q:num`;`d':real`;`scs_J_v39 s' p q`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;scs_half_slice_v39;PAIR_EQ;REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= k' /\ k' 0real^3)(p MOD k)`;`q:num`;`s:scs_v39`;`(vv:num->real^3)`;`k':num`;`p:num`;`k:num`;`(vv:num->real^3) (q MOD k)`][MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;ARITH_RULE`3-1=2`] +THEN MP_TAC QKNVMLB1 +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`0`;`k'-1`][ARITH_RULE`0+A=A`;dist]) +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (66-42)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[cstab]) +THEN REAL_ARITH_TAC; + +]);; + + + + + +let VV_SUC_EQ_RHO_NODE_PRIME=prove_by_refinement(`scs_k_v39 s =k /\ + (vv:num->real^3) p1=u /\ + IMAGE (vv:num->real^3) (:num)=V/\ + IMAGE (\i. {vv i,(vv:num->real^3) (SUC i)}) (:num) =E/\ + IMAGE (\i. (vv i,(vv:num->real^3) (SUC i))) (:num)=FF /\ + is_scs_v39 s /\ ~(k<=3)/\ + BBs_v39 s vv +==> +(!m. ITER m (rho_node1 FF) u= vv (m+p1))`, +[ +STRIP_TAC +THEN INDUCT_TAC; + +ASM_REWRITE_TAC[ITER;ARITH_RULE`0+p=p`]; + +ASM_REWRITE_TAC[ITER] +THEN SUBGOAL_THEN`(vv:num->real^3) (m+p1), (vv:num->real^3) (SUC m+p1) IN FF ` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`m+p1:num` +THEN REWRITE_TAC[ARITH_RULE`SUC m+p= SUC(m+p)`;SET_RULE`(a:num)IN(:num)`]; + +MATCH_MP_TAC(GEN_ALL Local_lemmas.DETER_RHO_NODE) +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC SCS_K_PRIME_CASE_3 +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN ASSUME_TAC th) +THEN ASM_REWRITE_TAC[scs_diag;BBs_v39;LET_DEF;LET_END_DEF;convex_local_fan] +THEN REPEAT RESA_TAC]);; + + +let SUM_AZIM_EQ_ANGLE_LE4=prove_by_refinement( +` ~(scs_k_v39 s<=3)/\ + BBs_v39 s vv /\ + is_scs_v39 s /\ +(vv:num->real^3) (p MOD (scs_k_v39 s))=u /\ +IMAGE (vv:num->real^3) (:num)=V/\ + IMAGE (\i. {vv i,(vv:num->real^3) (SUC i)}) (:num)=E/\ + IMAGE (\i. (vv i,(vv:num->real^3) (SUC i))) (:num)=FF +==> + sum {i | i < scs_k_v39 s} + (\i. rho_fun (norm ((vv:num->real^3) (i+p MOD scs_k_v39 s))) * + interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) u)) +=sum FF (\e. rho_fun (norm (FST e)) * azim_in_fan e E) +`, +[ +MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`p MOD scs_k_v39 s`;`vv:num->real^3`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[MMs_v39;BBprime_v39;BBprime2_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN REPEAT RESA_TAC; + +REPLICATE_TAC (30-2)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +MATCH_MP_TAC SUM_EQ_GENERAL +THEN EXISTS_TAC`(\i. (vv:num->real^3) (i+ p MOD k), vv (SUC i + p MOD k))` +THEN MP_TAC(ARITH_RULE`3<= k ==> ~(k=0) /\ 1(x MOD k+ k- p MOD k) + p MOD k = x MOD k+k /\ (x + p MOD k) + k- p MOD k= x+k`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x MOD k + k - p MOD k) MOD k + p MOD k:num` +THEN MRESA1_TAC th ` x:num`) +THEN MRESA_TAC MOD_ADD_MOD[`x:num`;`1`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`(x MOD k + k - p MOD k) MOD k + p MOD k`;`1`;`k:num`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;ARITH_RULE`SUC ((x MOD k + k - p MOD k) MOD k) + p MOD k = ((x MOD k + k - p MOD k) MOD k + p MOD k)+1`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `((x MOD k + k - p MOD k) MOD k + p MOD k)+1:num` +THEN MRESA1_TAC th ` x+1:num`) +THEN REWRITE_TAC[ADD1] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC DIVISION[`x:num`;`k:num`] +THEN MRESA_TAC DIVISION[`y' + p MOD k:num`;`k:num`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `y' + p MOD k:num`) +THEN MP_TAC VV_INJ +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;scs_half_slice_v39;PAIR_EQ;REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`;dist] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(y'+ p MOD k) MOD k:num`;`(x MOD k + k)MOD k`]) +THEN MRESA_TAC MOD_LT[`y':num`;`k:num`] +THEN MRESAL_TAC(GEN_ALL Hdplygy.MOD_EQ_MOD)[`y':num`;`x MOD k + k- p MOD k`;`p MOD k`;`k:num`][] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ADD_SYM] +THEN RESA_TAC; + +REWRITE_TAC[IN_ELIM_THM;] +THEN REPEAT STRIP_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`x+ p MOD k` +THEN REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ADD1;ARITH_RULE`(x + 1) + p MOD k= (x + p MOD k)+1`]; + +MRESAL_TAC(GEN_ALL VV_SUC_EQ_RHO_NODE_PRIME)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`k:num`;`s:scs_v39`;`FF:real^3#real^3->bool`;`u:real^3`;`vv:num->real^3`;`p:num MOD k`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN SUBGOAL_THEN`(vv:num->real^3) (x + p MOD k) IN V`ASSUME_TAC; + +EXPAND_TAC"V" +THEN REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`x+ p MOD k` +THEN REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +REPLICATE_TAC (35-6)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(vv:num->real^3) (x + p MOD k )`]) +THEN REPLICATE_TAC (3) REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC th +THEN MRESAL1_TAC th`SUC x`[ITER])]);; + + + + + + + + + + + + + + + +let V_SLICE_EQ_NUMSEG=prove_by_refinement( +` IMAGE (\i. (vv i,(vv:num->real^3) (SUC i))) (:num) = FF/\ +scs_k_v39 s=k /\ +scs_k_v39 s'=k' /\ +vv (p MOD k) =u +/\ +scs_half_slice_v39 s p q d' mkj =s'/\ + MMs_v39 s vv /\ + is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q /\ + is_scs_slice_v39 s s' s'' p q ==> +{i | i < k /\ + ITER i (rho_node1 FF) u IN IMAGE (\i. vv (i MOD k' + p MOD k)) (:num)} +={i | ireal^3) (:num)`;`IMAGE (\i. {(vv:num->real^3) i, vv (SUC i)}) (:num)`;`p:num`;`q:num`;`s:scs_v39`;`FF:real^3#real^3->bool`;`(vv:num->real^3) (p MOD k)`;`vv:num->real^3`;`p:num MOD k`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN SUBGOAL_THEN` (q+1+k -p MOD k)MOD k =scs_k_v39 s'` ASSUME_TAC; + +EXPAND_TAC"s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[]; + +MRESAL_TAC (GEN_ALL SCS_K_PRIME_LE_GE)[`s:scs_v39`;`p:num`;`q:num`;`d':real`;`scs_J_v39 s' p q`] +[MMs_v39;BBprime_v39;BBprime2_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39] +THEN GEN_TAC +THEN EQ_TAC; + +MP_TAC(ARITH_RULE`3 <= scs_k_v39 s ==> ~(scs_k_v39 s=0)`) +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `x + p MOD k:num` +THEN MRESA1_TAC th `x' MOD k'+ p MOD k:num`) +THEN MRESA_TAC DIVISION[`x+ p MOD k`;`k:num`] +THEN MRESA_TAC DIVISION[`x' MOD k'+ p MOD k`;`k:num`] +THEN MP_TAC VV_INJ +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;scs_half_slice_v39;PAIR_EQ;REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`;dist] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(x' MOD k'+ p MOD k) MOD k:num`;`(x + p MOD k)MOD k`]) +THEN MRESAL_TAC(GEN_ALL Hdplygy.MOD_EQ_MOD)[`x' MOD k':num`;`x:num`;`p MOD k`;`k:num`][] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ADD_SYM] +THEN MRESA_TAC MOD_LT[`x:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`3<=k' ==> ~(k'=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`x':num`;`k':num`] +THEN MP_TAC(ARITH_RULE`3<=k'/\ k' x' MOD k'< k`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`x' MOD k':num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); + +REPEAT STRIP_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +EXISTS_TAC`x:num` +THEN MRESA_TAC MOD_LT[`x:num`;`k':num`] +THEN REWRITE_TAC[SET_RULE`(x:num)IN(:num)`]; + +EXPAND_TAC"s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[]; + +MRESAL_TAC (GEN_ALL SCS_K_PRIME_LE_GE)[`s:scs_v39`;`p:num`;`q:num`;`d':real`;`scs_J_v39 s' p q`] +[MMs_v39;BBprime_v39;BBprime2_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39] +THEN GEN_TAC +THEN EQ_TAC; + + +MP_TAC(ARITH_RULE`3 <= scs_k_v39 s ==> ~(scs_k_v39 s=0)`) +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `x + p MOD k:num` +THEN MRESA1_TAC th `x' MOD k'+ p MOD k:num`) +THEN MRESA_TAC DIVISION[`x+ p MOD k`;`k:num`] +THEN MRESA_TAC DIVISION[`x' MOD k'+ p MOD k`;`k:num`] +THEN MP_TAC VV_INJ +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;scs_half_slice_v39;PAIR_EQ;REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`;dist] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(x' MOD k'+ p MOD k) MOD k:num`;`(x + p MOD k)MOD k`]) +THEN MRESAL_TAC(GEN_ALL Hdplygy.MOD_EQ_MOD)[`x' MOD k':num`;`x:num`;`p MOD k`;`k:num`][] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ADD_SYM] +THEN MRESA_TAC MOD_LT[`x:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`3<=k' ==> ~(k'=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`x':num`;`k':num`] +THEN MP_TAC(ARITH_RULE`3<=k'/\ k' x' MOD k'< k`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`x' MOD k':num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); + +REPEAT STRIP_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +EXISTS_TAC`x:num` +THEN MRESA_TAC MOD_LT[`x:num`;`k':num`] +THEN REWRITE_TAC[SET_RULE`(x:num)IN(:num)`]]);; + + + + + + + + +let SCS_SLICE_SYM= prove_by_refinement(` + is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q==> +(is_scs_slice_v39 s s' s'' p q <=> is_scs_slice_v39 s s'' s' q p)`, +[ + +REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist; +is_scs_slice_v39;scs_slice_v39;PAIR_EQ] +THEN RESA_TAC +THEN EQ_TAC; + +RESA_TAC +THEN MRESAL_TAC(GEN_ALL SCS_J_DIAG_EQ)[`scs_d_v39 s'`;`scs_d_v39 s''`;`scs_J_v39 s' 0 (scs_k_v39 s' - 1):bool`;`s:scs_v39`;`p:num`;`q:num`;`s':scs_v39`;`s'':scs_v39`] +[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist; +is_scs_slice_v39;scs_slice_v39;PAIR_EQ] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`(A/\ B/\A /\B==>C)<=>(A/\B==>C) `] +THEN REPLICATE_TAC (30-23)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN REPLICATE_TAC (1)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th) +THEN REWRITE_TAC[] +THEN REPLICATE_TAC (30-23)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN REPLICATE_TAC (1)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;REAL_ARITH`a<=b+c <=> a<= c+b`; +SET_RULE`(A==> B\/C)<=> (A==>C\/B)`]) +THEN STRIP_TAC; + +POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[]; + +REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[]; + +POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[]; + +REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[]; + +RESA_TAC +THEN MRESAL_TAC(GEN_ALL SCS_J_DIAG_EQ)[`scs_d_v39 s''`;`scs_d_v39 s'`;`scs_J_v39 s'' 0 (scs_k_v39 s'' - 1):bool`;`s:scs_v39`;`q:num`;`p:num`;`s'':scs_v39`;`s':scs_v39`] +[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist; +is_scs_slice_v39;scs_slice_v39;PAIR_EQ] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`(A/\ B/\A /\B==>C)<=>(A/\B==>C) `] +THEN REPLICATE_TAC (30-23)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN REPLICATE_TAC (1)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th) +THEN REWRITE_TAC[] +THEN REPLICATE_TAC (30-23)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN REPLICATE_TAC (1)(POP_ASSUM MP_TAC) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] +THEN ASSUME_TAC th) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;]) +THEN STRIP_TAC; + +STRIP_TAC; + +POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[]; + +REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[]; + +STRIP_TAC; + +ONCE_REWRITE_TAC[REAL_ARITH`a<=b+c <=> a<= c+b`] +THEN ASM_REWRITE_TAC[]; + +ONCE_REWRITE_TAC[SET_RULE`(A==> B\/C)<=> (A==>C\/B)`] +THEN ASM_REWRITE_TAC[]; + +STRIP_TAC; + +POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[]; + +REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[]; + +STRIP_TAC; + +ONCE_REWRITE_TAC[REAL_ARITH`a<=b+c <=> a<= c+b`] +THEN ASM_REWRITE_TAC[]; + +ONCE_REWRITE_TAC[SET_RULE`(A==> B\/C)<=> (A==>C\/B)`] +THEN ASM_REWRITE_TAC[]]);; + + + +let SUM_NUMSEG2=prove(`!t. sum(0..2) t = t(0) +t(1) + t(2)`, + REWRITE_TAC[num_CONV `1`;num_CONV `2`; SUM_CLAUSES_NUMSEG] THEN + REWRITE_TAC[SUM_SING_NUMSEG; ARITH; REAL_ADD_ASSOC]);; + + + +let NUMSEG_2=prove(`{i| i<3}=0..2`, +REWRITE_TAC[EXTENSION;IN_NUMSEG;IN_ELIM_THM] +THEN ARITH_TAC);; + + +let SUM_NUMSEG3=prove(`!t. sum(0..3) t = t(0) +t(1) + t(2)+ t(3)`, + REWRITE_TAC[num_CONV `1`;num_CONV `2`;num_CONV `3`; SUM_CLAUSES_NUMSEG] THEN + REWRITE_TAC[SUM_SING_NUMSEG; ARITH; REAL_ADD_ASSOC]);; + + + +let NUMSEG_3=prove(`{i| i<4}=0..3`, +REWRITE_TAC[EXTENSION;IN_NUMSEG;IN_ELIM_THM] +THEN ARITH_TAC);; + + + +let SUM_AZIM_EQ_ANGLE_EQ4=prove_by_refinement( +`(k'=3)/\ +scs_half_slice_v39 s p q d' mkj =s'/\ + scs_half_slice_v39 s q p d'' mkj =s'' /\ + vv' = (\i. (vv:num->real^3) (i MOD (scs_k_v39 s')+p MOD (scs_k_v39 s))) +/\ + vv'' = (\i. (vv:num->real^3) (i MOD (scs_k_v39 s'')+q MOD (scs_k_v39 s))) +/\ + MMs_v39 s vv /\ + is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q /\ + is_scs_slice_v39 s s' s'' p q /\ +scs_k_v39 s' =k' /\ scs_k_v39 s =k +/\(vv:num->real^3) (p MOD k)=u /\ + (vv:num->real^3) (q MOD k)=w /\ + IMAGE (vv:num->real^3) (:num)=V/\ + IMAGE (\i. {vv i,(vv:num->real^3) (SUC i)}) (:num) =E/\ + IMAGE (\i. (vv i,(vv:num->real^3) (SUC i))) (:num)=FF /\ +norm (u - w) <= cstab /\ + convex_local_fan + (v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)), + e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)), + face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) +==> +tau3 (vv (0 MOD k' + p MOD k)) (vv (1 MOD k' + p MOD k)) + (vv (2 MOD k' + p MOD k)) += sum {i | i < k'} + (\i. rho_fun (norm (vv (i + p MOD k))) * + interior_angle1 (vec 0) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) + (ITER i (rho_node1 FF) u)) + - (pi + sol0)`, +[ +REWRITE_TAC[LET_DEF;LET_END_DEF;tau3;MMs_v39;BBprime2_v39;BBprime_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC(REAL_ARITH`a1+a2+a3=b==> a1+a2+a3-c= b-c`) +THEN ASM_REWRITE_TAC[NUMSEG_2;SUM_NUMSEG2;ARITH_RULE`0 MOD 3=0/\1 MOD 3=1/\ 2 MOD 3=2`;Appendix.rho_rho_fun] +THEN MP_TAC V_PRIME_EQ_V_vv +THEN RESA_TAC +THEN MP_TAC E_PRIME_EQ_E_vv +THEN RESA_TAC +THEN MP_TAC F_PRIME_EQ_F_vv +THEN RESA_TAC +THEN MP_TAC SCS_HALF_SLICE_IS_A_SCS +THEN RESA_TAC +THEN SUBGOAL_THEN`BBs_v39 s' vv'`ASSUME_TAC; + + +MP_TAC QKNVMLB1 +THEN REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;] +THEN RESA_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;tau3;MMs_v39;BBprime2_v39;BBprime_v39;is_scs_slice_v39] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`d' = scs_d_v39 s'`ASSUME_TAC +; + + +EXPAND_TAC"s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[]; + + + +ASM_REWRITE_TAC[] +; + + +EXPAND_TAC"s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[]; + + + +ASM_REWRITE_TAC[] +; + + + + + +MRESAL_TAC (GEN_ALL(INST_TYPE [`:3`,`:M`]V_E_FF_IS_SCS_CASES_3))[`s':scs_v39`;`vv':num->real^3`] +[DIMINDEX_3] +THEN MRESA_TAC(GEN_ALL VV_SUC_EQ_RHO_NODE)[`scs_k_v39 s`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`p:num`;`q:num`;`s:scs_v39`;`FF:real^3#real^3->bool`;`u:real^3`;`vv:num->real^3`;`p:num MOD k`] +THEN MRESA_TAC (GEN_ALL Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM_IVS) +[`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)`] +THEN MATCH_MP_TAC(REAL_ARITH`a1= b1 /\ a2= b2 /\a3= b3 ==> a1+a2+a3= b1+b2+b3`) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[REAL_EQ_MUL_LCANCEL] +THEN MATCH_MP_TAC(SET_RULE`A==>B\/A`) +; + + +POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`vv (0 + p MOD k) IN + v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +ASSUME_TAC; + + +REPLICATE_TAC (33-26)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REWRITE_TAC[SYM th;IN_ELIM_THM;IMAGE]) +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[SET_RULE`(a:num)IN(:num)`;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`]; + + + + + +SUBGOAL_THEN`vv (1 + p MOD k) IN + v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +ASSUME_TAC; + + +REPLICATE_TAC (34-26)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REWRITE_TAC[SYM th;IN_ELIM_THM;IMAGE]) +THEN EXISTS_TAC`1` +THEN REWRITE_TAC[SET_RULE`(a:num)IN(:num)`;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`]; + + +SUBGOAL_THEN`vv (2 + p MOD k) IN + v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +ASSUME_TAC; + + +REPLICATE_TAC (35-26)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REWRITE_TAC[SYM th;IN_ELIM_THM;IMAGE]) +THEN EXISTS_TAC`2` +THEN REWRITE_TAC[SET_RULE`(a:num)IN(:num)`;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`]; + + +REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN REPLICATE_TAC (4) RESA_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(vv:num->real^3) (0 + p MOD k)`) +THEN SUBGOAL_THEN`(rho_node1 + {(vv (0 MOD 3 + p MOD k),vv (1 MOD 3 + p MOD k)), (vv (1 MOD 3 + p MOD k), + vv (2 MOD 3 + p MOD k)), + (vv (2 MOD 3 + p MOD k), + vv (0 MOD 3 + p MOD k))} + (vv (0 + p MOD k))) = (vv:num->real^3) (1 MOD 3 + p MOD k)`ASSUME_TAC +; + + +MATCH_MP_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE) +THEN EXISTS_TAC`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +THEN EXISTS_TAC`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (37-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[convex_local_fan] +THEN RESA_TAC) +THEN REWRITE_TAC[SET_RULE`a IN {a1,b,c} <=> a=a1\/ a=b\/ a=c`;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`] +; + + + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`(ivs_rho_node1 + {(vv (0 MOD 3 + p MOD k),vv (1 MOD 3 + p MOD k)), (vv (1 MOD 3 + p MOD k), + vv (2 MOD 3 + p MOD k)), + (vv (2 MOD 3 + p MOD k), + vv (0 MOD 3 + p MOD k))} + (vv (0 + p MOD k))) = (vv:num->real^3) (2 MOD 3 + p MOD k)`ASSUME_TAC +; + + +MATCH_MP_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE) +THEN EXISTS_TAC`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +THEN EXISTS_TAC`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (38-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[convex_local_fan] +THEN RESA_TAC) +THEN REWRITE_TAC[SET_RULE`a IN {a1,b,c} <=> a=a1\/ a=b\/ a=c`;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`] +; + + +SUBGOAL_THEN`(rho_node1 + {(vv (0 MOD 3 + p MOD k),vv (1 MOD 3 + p MOD k)), (vv (1 MOD 3 + p MOD k), + vv (2 MOD 3 + p MOD k)), + (vv (2 MOD 3 + p MOD k), + vv (0 MOD 3 + p MOD k))} + (vv (2 + p MOD k))) = (vv:num->real^3) (0 MOD 3 + p MOD k)`ASSUME_TAC +; + + +MATCH_MP_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE) +THEN EXISTS_TAC`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +THEN EXISTS_TAC`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (39-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[convex_local_fan] +THEN RESA_TAC) +THEN REWRITE_TAC[SET_RULE`a IN {a1,b,c} <=> a=a1\/ a=b\/ a=c`;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`] +; + + + +ASM_REWRITE_TAC[ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.IN_V_IMP_AZIM_LESS_PI)[`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)`;`(vv:num->real^3) (0 + p MOD k)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(vv:num->real^3) (2 + p MOD k)`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`] +THEN STRIP_TAC +THEN SUBGOAL_THEN` local_fan + (v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)), + e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)), + face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) +`ASSUME_TAC +; + +ASM_TAC +THEN REWRITE_TAC[convex_local_fan] +THEN REPEAT RESA_TAC +; + + +MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2) +[`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)`;`(vv:num->real^3) (0 + p MOD k)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2) +[`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)`;`(vv:num->real^3) (2 + p MOD k)`]THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.AZIM_LE_PI_EQ_DIHV)[`vec 0:real^3`;`(vv:num->real^3) (0 + p MOD k)`;`(vv:num->real^3) (1 + p MOD k)`;`(vv:num->real^3) (2 + p MOD k)`] + +; + + + +(******************) + +POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`vv (0 + p MOD k) IN + v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +ASSUME_TAC; + + +REPLICATE_TAC (33-26)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REWRITE_TAC[SYM th;IN_ELIM_THM;IMAGE]) +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[SET_RULE`(a:num)IN(:num)`;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`]; + + + + + +SUBGOAL_THEN`vv (1 + p MOD k) IN + v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +ASSUME_TAC; + + +REPLICATE_TAC (34-26)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REWRITE_TAC[SYM th;IN_ELIM_THM;IMAGE]) +THEN EXISTS_TAC`1` +THEN REWRITE_TAC[SET_RULE`(a:num)IN(:num)`;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`]; + + +SUBGOAL_THEN`vv (2 + p MOD k) IN + v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +ASSUME_TAC; + + +REPLICATE_TAC (35-26)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REWRITE_TAC[SYM th;IN_ELIM_THM;IMAGE]) +THEN EXISTS_TAC`2` +THEN REWRITE_TAC[SET_RULE`(a:num)IN(:num)`;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`]; + + +REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN REPLICATE_TAC (4) RESA_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(vv:num->real^3) (1 + p MOD k)`) +THEN SUBGOAL_THEN`(rho_node1 + {(vv (0 MOD 3 + p MOD k),vv (1 MOD 3 + p MOD k)), (vv (1 MOD 3 + p MOD k), + vv (2 MOD 3 + p MOD k)), + (vv (2 MOD 3 + p MOD k), + vv (0 MOD 3 + p MOD k))} + (vv (1 + p MOD k))) = (vv:num->real^3) (2 MOD 3 + p MOD k)`ASSUME_TAC +; + + +MATCH_MP_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE) +THEN EXISTS_TAC`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +THEN EXISTS_TAC`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (37-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[convex_local_fan] +THEN RESA_TAC) +THEN REWRITE_TAC[SET_RULE`a IN {a1,b,c} <=> a=a1\/ a=b\/ a=c`;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`] +; + + + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`(ivs_rho_node1 + {(vv (0 MOD 3 + p MOD k),vv (1 MOD 3 + p MOD k)), (vv (1 MOD 3 + p MOD k), + vv (2 MOD 3 + p MOD k)), + (vv (2 MOD 3 + p MOD k), + vv (0 MOD 3 + p MOD k))} + (vv (1 + p MOD k))) = (vv:num->real^3) (0 MOD 3 + p MOD k)`ASSUME_TAC +; + + +MATCH_MP_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE) +THEN EXISTS_TAC`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +THEN EXISTS_TAC`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (38-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[convex_local_fan] +THEN RESA_TAC) +THEN REWRITE_TAC[SET_RULE`a IN {a1,b,c} <=> a=a1\/ a=b\/ a=c`;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`] +; + + +SUBGOAL_THEN`(rho_node1 + {(vv (0 MOD 3 + p MOD k),vv (1 MOD 3 + p MOD k)), (vv (1 MOD 3 + p MOD k), + vv (2 MOD 3 + p MOD k)), + (vv (2 MOD 3 + p MOD k), + vv (0 MOD 3 + p MOD k))} + (vv (0 + p MOD k))) = (vv:num->real^3) (1 MOD 3 + p MOD k)`ASSUME_TAC +; + + +MATCH_MP_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE) +THEN EXISTS_TAC`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +THEN EXISTS_TAC`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (39-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[convex_local_fan] +THEN RESA_TAC) +THEN REWRITE_TAC[SET_RULE`a IN {a1,b,c} <=> a=a1\/ a=b\/ a=c`;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`] +; + + + +ASM_REWRITE_TAC[ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.IN_V_IMP_AZIM_LESS_PI)[`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)`;`(vv:num->real^3) (1 + p MOD k)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(vv:num->real^3) (0 + p MOD k)`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`] +THEN STRIP_TAC +THEN SUBGOAL_THEN` local_fan + (v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)), + e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)), + face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) +`ASSUME_TAC +; + +ASM_TAC +THEN REWRITE_TAC[convex_local_fan] +THEN REPEAT RESA_TAC +; + + +MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2) +[`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)`;`(vv:num->real^3) (1 + p MOD k)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2) +[`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)`;`(vv:num->real^3) (0 + p MOD k)`]THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.AZIM_LE_PI_EQ_DIHV)[`vec 0:real^3`;`(vv:num->real^3) (1 + p MOD k)`;`(vv:num->real^3) (2 + p MOD k)`;`(vv:num->real^3) (0 + p MOD k)`] + +; + +(************) + + +POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`vv (0 + p MOD k) IN + v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +ASSUME_TAC; + + +REPLICATE_TAC (33-26)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REWRITE_TAC[SYM th;IN_ELIM_THM;IMAGE]) +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[SET_RULE`(a:num)IN(:num)`;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`]; + + + + + +SUBGOAL_THEN`vv (1 + p MOD k) IN + v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +ASSUME_TAC; + + +REPLICATE_TAC (34-26)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REWRITE_TAC[SYM th;IN_ELIM_THM;IMAGE]) +THEN EXISTS_TAC`1` +THEN REWRITE_TAC[SET_RULE`(a:num)IN(:num)`;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`]; + + +SUBGOAL_THEN`vv (2 + p MOD k) IN + v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +ASSUME_TAC; + + +REPLICATE_TAC (35-26)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REWRITE_TAC[SYM th;IN_ELIM_THM;IMAGE]) +THEN EXISTS_TAC`2` +THEN REWRITE_TAC[SET_RULE`(a:num)IN(:num)`;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`]; + + +REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN REPLICATE_TAC (4) RESA_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(vv:num->real^3) (2 + p MOD k)`) +THEN SUBGOAL_THEN`(rho_node1 + {(vv (0 MOD 3 + p MOD k),vv (1 MOD 3 + p MOD k)), (vv (1 MOD 3 + p MOD k), + vv (2 MOD 3 + p MOD k)), + (vv (2 MOD 3 + p MOD k), + vv (0 MOD 3 + p MOD k))} + (vv (2 + p MOD k))) = (vv:num->real^3) (0 MOD 3 + p MOD k)`ASSUME_TAC +; + + +MATCH_MP_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE) +THEN EXISTS_TAC`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +THEN EXISTS_TAC`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (37-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[convex_local_fan] +THEN RESA_TAC) +THEN REWRITE_TAC[SET_RULE`a IN {a1,b,c} <=> a=a1\/ a=b\/ a=c`;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`] +; + + + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`(ivs_rho_node1 + {(vv (0 MOD 3 + p MOD k),vv (1 MOD 3 + p MOD k)), (vv (1 MOD 3 + p MOD k), + vv (2 MOD 3 + p MOD k)), + (vv (2 MOD 3 + p MOD k), + vv (0 MOD 3 + p MOD k))} + (vv (2 + p MOD k))) = (vv:num->real^3) (1 MOD 3 + p MOD k)`ASSUME_TAC +; + + +MATCH_MP_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE) +THEN EXISTS_TAC`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +THEN EXISTS_TAC`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (38-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[convex_local_fan] +THEN RESA_TAC) +THEN REWRITE_TAC[SET_RULE`a IN {a1,b,c} <=> a=a1\/ a=b\/ a=c`;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`] +; + + +SUBGOAL_THEN`(rho_node1 + {(vv (0 MOD 3 + p MOD k),vv (1 MOD 3 + p MOD k)), (vv (1 MOD 3 + p MOD k), + vv (2 MOD 3 + p MOD k)), + (vv (2 MOD 3 + p MOD k), + vv (0 MOD 3 + p MOD k))} + (vv (1 + p MOD k))) = (vv:num->real^3) (2 MOD 3 + p MOD k)`ASSUME_TAC +; + + +MATCH_MP_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE) +THEN EXISTS_TAC`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +THEN EXISTS_TAC`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC (39-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[convex_local_fan] +THEN RESA_TAC) +THEN REWRITE_TAC[SET_RULE`a IN {a1,b,c} <=> a=a1\/ a=b\/ a=c`;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`] +; + + + +ASM_REWRITE_TAC[ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.IN_V_IMP_AZIM_LESS_PI)[`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)`;`(vv:num->real^3) (2 + p MOD k)`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(vv:num->real^3) (1 + p MOD k)`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`] +THEN STRIP_TAC +THEN SUBGOAL_THEN` local_fan + (v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)), + e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)), + face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) +`ASSUME_TAC +; + +ASM_TAC +THEN REWRITE_TAC[convex_local_fan] +THEN REPEAT RESA_TAC +; + + +MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2) +[`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)`;`(vv:num->real^3) (2 + p MOD k)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2) +[`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)`;`(vv:num->real^3) (1 + p MOD k)`]THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.AZIM_LE_PI_EQ_DIHV)[`vec 0:real^3`;`(vv:num->real^3) (2 + p MOD k)`;`(vv:num->real^3) (0 + p MOD k)`;`(vv:num->real^3) (1 + p MOD k)`] +;]);; + + + + + + +let CARD_FF_EQ_CARD_SLICE_FF= prove_by_refinement( +`convex_local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E) /\ + HS = hypermap (HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v,rho_node1 FF v) /\ + fw = face HS (w,rho_node1 FF w) +==> CARD FF = CARD fv + CARD fw -2`, +[ +STRIP_TAC +THEN MP_TAC Local_lemmas1.PROVE_THE_SLICE_ASSUMPTION +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v:real^3`;`w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[DIFF;IN_ELIM_THM;IN_SING] +THEN ONCE_REWRITE_TAC[SET_RULE`~(a=b)<=> ~(b=a)`] +THEN STRIP_TAC +THEN MP_TAC Nkezbfc_local.COMPATIBLE_BW_TWO_LEMMAS +THEN RESA_TAC +THEN SUBGOAL_THEN`{{w, v}} = {{v,w:real^3}}` ASSUME_TAC; + +REWRITE_TAC[EXTENSION;IN_SING] +THEN SET_TAC[]; + +MRESA_TAC (GEN_ALL Nkezbfc_local.COMPATIBLE_BW_TWO_LEMMAS) +[`hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{v, w}}))`;`V:real^3->bool`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{v, w}}))) (w,rho_node1 FF w)`;`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;`w:real^3`;`v:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`~(a=b)<=> ~(b=a)`] +THEN ONCE_REWRITE_TAC[SET_RULE`{a,b}={b,a}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{a,b}={b,a}`] +THEN RESA_TAC +THEN MRESA_TAC CARD_SLICE_EQ[`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;`v:real^3`;`w:real^3`;] +THEN MP_TAC Local_lemmas1.EJRCFJD +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ) +[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`V:real^3->bool`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ) +[`e_prime (E UNION {{v, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{v, w}}))) (w,rho_node1 FF w))`;`face (hypermap (HYP (vec 0,V,E UNION {{v, w}}))) (w,rho_node1 FF w)`;`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{v, w}}))) (w,rho_node1 FF w))`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ) +[`e_prime (E UNION {{v, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{v, w}}))) (v,rho_node1 FF v))`;`face (hypermap (HYP (vec 0,V,E UNION {{v, w}}))) (v,rho_node1 FF v)`;`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{v, w}}))) (v,rho_node1 FF v))`] +THEN ASM_TAC +THEN REWRITE_TAC[convex_local_fan] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (25-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN MP_TAC th +THEN REPEAT RESA_TAC) +THEN REPLICATE_TAC (25-13)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN MP_TAC th +THEN REPEAT RESA_TAC)]);; + + + +let CARD_SLICE_FF_LE_3= prove_by_refinement( +`convex_local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E) /\ + HS = hypermap (HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v,rho_node1 FF v) /\ + fw = face HS (w,rho_node1 FF w) +==> 3<= CARD fv /\ 3<= CARD fw`, +[ +STRIP_TAC +THEN MP_TAC Local_lemmas1.PROVE_THE_SLICE_ASSUMPTION +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v:real^3`;`w:real^3`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[DIFF;IN_ELIM_THM;IN_SING] +THEN ONCE_REWRITE_TAC[SET_RULE`~(a=b)<=> ~(b=a)`] +THEN STRIP_TAC +THEN MP_TAC Nkezbfc_local.COMPATIBLE_BW_TWO_LEMMAS +THEN RESA_TAC +THEN SUBGOAL_THEN`{{w, v}} = {{v,w:real^3}}` ASSUME_TAC; + +REWRITE_TAC[EXTENSION;IN_SING] +THEN SET_TAC[]; + +MRESA_TAC (GEN_ALL Nkezbfc_local.COMPATIBLE_BW_TWO_LEMMAS) +[`hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{v, w}}))`;`V:real^3->bool`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{v, w}}))) (w,rho_node1 FF w)`;`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;`w:real^3`;`v:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`~(a=b)<=> ~(b=a)`] +THEN ONCE_REWRITE_TAC[SET_RULE`{a,b}={b,a}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{a,b}={b,a}`] +THEN RESA_TAC +THEN MRESA_TAC CARD_SLICE_EQ[`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;`v:real^3`;`w:real^3`;] +THEN MP_TAC Local_lemmas1.EJRCFJD +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ) +[`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`V:real^3->bool`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ) +[`e_prime (E UNION {{v, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{v, w}}))) (w,rho_node1 FF w))`;`face (hypermap (HYP (vec 0,V,E UNION {{v, w}}))) (w,rho_node1 FF w)`;`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{v, w}}))) (w,rho_node1 FF w))`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_CARD_FF_V_EQ) +[`e_prime (E UNION {{v, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{v, w}}))) (v,rho_node1 FF v))`;`face (hypermap (HYP (vec 0,V,E UNION {{v, w}}))) (v,rho_node1 FF v)`;`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{v, w}}))) (v,rho_node1 FF v))`] +THEN ASM_TAC +THEN REWRITE_TAC[convex_local_fan] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (25-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN MP_TAC th +THEN REPEAT RESA_TAC) +THEN REPLICATE_TAC (25-13)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN MP_TAC th +THEN REPEAT RESA_TAC) +THEN MRESA_TAC (GEN_ALL Nkezbfc_local.CARD_VERTEX_GE_3_LOCAL_FAN) +[`slicev (E:(real^3->bool)->bool) FF w v`;`slicee (E:(real^3->bool)->bool) FF w v`;`slicef (E:(real^3->bool)->bool) FF w v`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL Nkezbfc_local.CARD_VERTEX_GE_3_LOCAL_FAN) +[`slicev (E:(real^3->bool)->bool) FF v w`;`slicee (E:(real^3->bool)->bool) FF v w`;`slicef (E:(real^3->bool)->bool) FF v w`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[convex_local_fan] +THEN RESA_TAC;]);; + + + +let CARD_FF_EQ_SCS_K_3=prove( +` scs_k_v39 s =k /\ + IMAGE (\i. vv i,vv (SUC i)) (:num)=FF/\ + is_scs_v39 s /\ +k=3 /\ + BBs_v39 s vv +==> CARD FF=3`, +REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL(INST_TYPE [`:3`,`:M`]V_E_FF_IS_SCS_CASES_3))[`s:scs_v39`;`vv:num->real^3`] +[DIMINDEX_3] +THEN MP_TAC VV_INJ +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`1`;`2`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<3/\ 1<3/\ 2<3/\ 3<4`] +THEN MRESAL_TAC th[`1`;`0`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<3/\ 1<3/\ 2<3/\ 3<4`] +THEN MRESAL_TAC th[`2`;`0`][ARITH_RULE`~(1=2)/\ ~(1=0) /\ ~(1=3)/\ ~(2=3)/\ ~(2=0)/\ ~(3=0)/\ 0<3/\ 1<3/\ 2<3/\ 3<4`]) +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY;PAIR_EQ] +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC);; + + + +let QKNVMLB3_LE4=prove_by_refinement( +`~(scs_k_v39 s =4 /\ ~(scs_J_v39 s' 0 (scs_k_v39 s' - 1)))/\ + scs_half_slice_v39 s p q d' mkj =s'/\ + scs_half_slice_v39 s q p d'' mkj =s'' /\ + vv' = (\i. (vv:num->real^3) (i MOD (scs_k_v39 s')+p MOD (scs_k_v39 s))) +/\ + vv'' = (\i. (vv:num->real^3) (i MOD (scs_k_v39 s'')+q MOD (scs_k_v39 s))) +/\ + MMs_v39 s vv /\ + is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q /\ + is_scs_slice_v39 s s' s'' p q /\ + scs_d_v39 s <= d' + d'' ==> + taustar_v39 s' vv' + taustar_v39 s'' vv'' <= taustar_v39 s vv`, +[REWRITE_TAC[taustar_v39;LET_DEF;LET_END_DEF;scs_diag] +THEN STRIP_TAC +THEN MP_TAC SCS_K_PRIME_CASE_3 +THEN REWRITE_TAC[taustar_v39;LET_DEF;LET_END_DEF;scs_diag] +THEN RESA_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN ABBREV_TAC`k'=scs_k_v39 s'` +THEN ABBREV_TAC`k''=scs_k_v39 s''` +THEN MP_TAC(ARITH_RULE`3 ~(k<=3)`) +THEN RESA_TAC +THEN MP_TAC SCS_K_LE_6 +THEN RESA_TAC +THEN ABBREV_TAC`u= (vv:num->real^3) (p MOD k)` +THEN ABBREV_TAC `w= (vv:num->real^3) (q MOD k)` +THEN ABBREV_TAC`V= IMAGE (vv:num->real^3) (:num)` +THEN ABBREV_TAC`E= IMAGE (\i. {vv i,(vv:num->real^3) (SUC i)}) (:num)` +THEN ABBREV_TAC`FF= IMAGE (\i. (vv i,(vv:num->real^3) (SUC i))) (:num)` +THEN MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`p MOD scs_k_v39 s`;`vv:num->real^3`] +THEN MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`q MOD scs_k_v39 s`;`vv:num->real^3`] +THEN ASM_TAC +THEN REPLICATE_TAC 2 STRIP_TAC +THEN ASM_REWRITE_TAC[MMs_v39;BBprime_v39;BBprime2_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN REPEAT RESA_TAC +; + + +REPLICATE_TAC (54-8)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + + + +REPLICATE_TAC (54-8)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN SUBGOAL_THEN`(!i. scs_b_v39 s i (SUC i) <= cstab)`ASSUME_TAC; + + + +REPLICATE_TAC (54-32)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + + +REPLICATE_TAC (55-8)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(3-1)=3`]) +THEN STRIP_TAC +THEN MP_TAC NOT_EQ_DIAG +THEN MP_TAC DIST_DIAG_LE_CSTAB +THEN MP_TAC CARD_V_EQ_SCS_K +THEN ASM_REWRITE_TAC[MMs_v39;BBprime_v39;BBprime2_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC TECOXBMv2 +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;tau_fun] +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas1.EJRCFJD)[`hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))`;`(E:(real^3->bool)->bool)`;`w:real^3`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (u,rho_node1 FF u)`;`V:real^3->bool`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (w,rho_node1 FF w)`;`FF:real^3#real^3->bool`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC V_PRIME_EQ_V_vv +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN MRESA_TAC (GEN_ALL V_PRIME_EQ_V_vv) +[`d'':real`;`d':real`;`mkj:bool`;`s':scs_v39`;`s'':scs_v39`;`p:num`;`s:scs_v39`; `vv:num->real^3`;`k'':num`;`q:num`;`k:num`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u:real^3`;`FF:real^3#real^3->bool`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39;] +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`u-w= --(w-u):real^3`] +THEN ASM_REWRITE_TAC[NORM_NEG] +THEN SUBGOAL_THEN`{{w, u}} = {{u,w:real^3}}` ASSUME_TAC +; + +REWRITE_TAC[EXTENSION;IN_SING] +THEN SET_TAC[]; + + +RESA_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(\i. rho_fun (norm ((vv:num->real^3) (i+ p MOD k))))`) +THEN SUBGOAL_THEN` sum {i | i < k} + (\i. rho_fun (norm ((vv:num->real^3) (i+p MOD k))) * + interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) u)) +=sum FF (\e. rho_fun (norm (FST e)) * azim_in_fan e E) +`ASSUME_TAC +; + + + +MATCH_MP_TAC SUM_EQ_GENERAL +THEN EXISTS_TAC`(\i. (vv:num->real^3) (i+ p MOD k), vv (SUC i + p MOD k))` +THEN SUBGOAL_THEN` (q+1+k -p MOD k)MOD k =scs_k_v39 s'` ASSUME_TAC; + + + +EXPAND_TAC"s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[] +; + +MRESA_TAC (GEN_ALL SCS_K_PRIME_LE_GE)[`s:scs_v39`;`p:num`;`q:num`;`d':real`;`scs_J_v39 s' p q`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;scs_half_slice_v39;PAIR_EQ;REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<= k' /\ k' 0(x MOD k+ k- p MOD k) + p MOD k = x MOD k+k /\ (x + p MOD k) + k- p MOD k= x+k`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x MOD k + k - p MOD k) MOD k + p MOD k:num` +THEN MRESA1_TAC th ` x:num`) +THEN MRESA_TAC MOD_ADD_MOD[`x:num`;`1`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`(x MOD k + k - p MOD k) MOD k + p MOD k`;`1`;`k:num`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;ARITH_RULE`SUC ((x MOD k + k - p MOD k) MOD k) + p MOD k = ((x MOD k + k - p MOD k) MOD k + p MOD k)+1`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `((x MOD k + k - p MOD k) MOD k + p MOD k)+1:num` +THEN MRESA1_TAC th ` x+1:num`) +THEN REWRITE_TAC[ADD1] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC DIVISION[`x:num`;`k:num`] +THEN MRESA_TAC DIVISION[`y' + p MOD k:num`;`k:num`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `y' + p MOD k:num`) +THEN MP_TAC VV_INJ +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;scs_half_slice_v39;PAIR_EQ;REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`;dist] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(y'+ p MOD k) MOD k:num`;`(x MOD k + k)MOD k`]) +THEN MRESA_TAC MOD_LT[`y':num`;`k:num`] +THEN MRESAL_TAC(GEN_ALL Hdplygy.MOD_EQ_MOD)[`y':num`;`x MOD k + k- p MOD k`;`p MOD k`;`k:num`][] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ADD_SYM] +THEN RESA_TAC + +; + + + + +REWRITE_TAC[IN_ELIM_THM;] +THEN REPEAT STRIP_TAC; + + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`x+ p MOD k` +THEN REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ADD1;ARITH_RULE`(x + 1) + p MOD k= (x + p MOD k)+1`] +; + + + + +MRESAL_TAC(GEN_ALL VV_SUC_EQ_RHO_NODE)[`scs_k_v39 s`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`p:num`;`q:num`;`s:scs_v39`;`FF:real^3#real^3->bool`;`u:real^3`;`vv:num->real^3`;`p:num MOD k`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN SUBGOAL_THEN`(vv:num->real^3) (x + p MOD k) IN V`ASSUME_TAC +; + +EXPAND_TAC"V" +THEN REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`x+ p MOD k` +THEN REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + + MP_TAC Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(vv:num->real^3) (x + p MOD k )`]) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC th +THEN MRESAL1_TAC th`SUC x`[ITER]) +; + + + + + + + + +POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MP_TAC F_PRIME_EQ_F_vv +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[th]) +THEN MRESAL_TAC (GEN_ALL F_PRIME_EQ_F_vv)[`d'':real`;`d':real`;`mkj:bool`;`s':scs_v39`;`s'':scs_v39`;`p:num`;`s:scs_v39`;`vv:num->real^3`;`k'':num`;`q:num`;`k:num`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u:real^3`;`FF:real^3#real^3->bool`;`w:real^3`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`u-w= --(w-u):real^3`] +THEN ASM_REWRITE_TAC[NORM_NEG] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[th]) +THEN MP_TAC V_SLICE_EQ_NUMSEG +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39] +THEN RESA_TAC +THEN MP_TAC SCS_SLICE_SYM +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39;] +THEN STRIP_TAC +THEN MRESAL_TAC(GEN_ALL V_SLICE_EQ_NUMSEG)[ +`d'':real`;`mkj:bool`;`s:scs_v39`;`s'':scs_v39`;`s':scs_v39`;`p:num`;`FF:real^3#real^3->bool`;`w:real^3`;`vv:num->real^3`;`q:num`;`k:num`;`k'':num`] +[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39;] +THEN SUBGOAL_THEN`sum + {i | i < k /\ + ITER i (rho_node1 FF) u IN IMAGE (\i. vv (i MOD k'' + q MOD k)) (:num)} + (\i. rho_fun (norm ((vv:num->real^3) (i + p MOD k))) * + interior_angle1 (vec 0) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)) + (ITER i (rho_node1 FF) u)) += sum + {i | i < k /\ + ITER i (rho_node1 FF) w IN IMAGE (\i. vv (i MOD k'' + q MOD k)) (:num)} + (\i. rho_fun (norm (vv (i + q MOD k))) * + interior_angle1 (vec 0) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)) + (ITER i (rho_node1 FF) w))` ASSUME_TAC +; + + + +MATCH_MP_TAC SUM_EQ_GENERAL +THEN MRESAL_TAC(GEN_ALL VV_SUC_EQ_RHO_NODE)[`scs_k_v39 s`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`p:num`;`q:num`;`s:scs_v39`;`FF:real^3#real^3->bool`;`u:real^3`;`vv:num->real^3`;`p:num MOD k`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN MRESAL_TAC(GEN_ALL VV_SUC_EQ_RHO_NODE)[`scs_k_v39 s`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`p:num`;`q:num`;`s:scs_v39`;`FF:real^3#real^3->bool`;`w:real^3`;`vv:num->real^3`;`q:num MOD k`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN MP_TAC SCS_K_PRIME_LE_GE +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN SUBGOAL_THEN` (p+1+k -q MOD k)MOD k =scs_k_v39 s''` ASSUME_TAC; + + +EXPAND_TAC"s''" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[] +; + + +MRESAL_TAC (GEN_ALL SCS_K_PRIME_LE_GE)[`s:scs_v39`;`q:num`;`p:num`;`d'':real`;`scs_J_v39 s' p q`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39;IN_ELIM_THM;IMAGE] +THEN MP_TAC(ARITH_RULE`3<=k'/\ k' ~(k=0)`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`p MOD k<= q MOD k \/ q MOD k<= p MOD k`) +THEN RESA_TAC; + + +EXISTS_TAC`(\i. (i+ p MOD k + k - q MOD k) MOD k)` +THEN STRIP_TAC; + + + +REWRITE_TAC[IN_ELIM_THM; IMAGE;EXISTS_UNIQUE] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`(y + q MOD k - p MOD k) MOD k ` +THEN MRESA_TAC DIVISION[`q:num`;`k:num`] +THEN MRESA_TAC DIVISION[`p:num`;`k:num`] +THEN MRESA_TAC DIVISION[`y + q MOD k - p MOD k:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`y yreal^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(y + q MOD k - p MOD k) MOD k + p MOD k:num` +THEN MRESA1_TAC th`y+ q MOD k`) +THEN STRIP_TAC +; + + + +EXISTS_TAC`y:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +; + +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MP_TAC(ARITH_RULE`y (y' + k - (q MOD k - p MOD k)) + q MOD k - p MOD k = y'+k /\ q MOD k - p MOD k < k`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`q MOD k - p MOD k`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`y' + k - (q MOD k - p MOD k)`;`q MOD k - p MOD k`;`k:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`y':num`][ARITH_RULE`1 * k' + i = (i+k')`] +THEN MRESA_TAC MOD_LT[`y':num`;`k:num`] +; + + +REPEAT RESA_TAC +; + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x + p MOD k):num` +THEN MRESA1_TAC th`x' MOD k''+ q MOD k`) +THEN MP_TAC(ARITH_RULE`3<= k'' ==> ~(k''=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`q:num`;`k:num`] +THEN MRESA_TAC DIVISION[`x':num`;`k'':num`] +THEN MRESA_TAC DIVISION[`x +p MOD k`;`k:num`] +THEN MRESA_TAC DIVISION[`x' MOD k'' +q MOD k`;`k:num`] +THEN MP_TAC(ARITH_RULE`p MOD k<= q MOD k /\ q MOD k < k/\ x' MOD k'' p MOD k + x' MOD k''+ q MOD k - p MOD k = q MOD k +x' MOD k'' /\ (p MOD k + k - q MOD k) + q MOD k - p MOD k + x' MOD k'' = k + x' MOD k'' /\ x' MOD k'' < k`) +THEN RESA_TAC +THEN MP_TAC VV_INJ +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;scs_half_slice_v39;PAIR_EQ;REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`;dist] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(x+ p MOD k) MOD k:num`;`(x' MOD k'' + q MOD k)MOD k`]) +THEN MRESAL_TAC(GEN_ALL Hdplygy.MOD_EQ_MOD)[`x:num`;`x' MOD k'' + q MOD k - p MOD k`;`p MOD k`;`k:num`][] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ADD_SYM] +THEN RESA_TAC +THEN MRESA_TAC MOD_ADD_MOD[`(p MOD k + k - q MOD k)`;`x:num`;`k:num`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_ADD_MOD[`(p MOD k + k - q MOD k)`;`q MOD k - p MOD k + x' MOD k'':num`;`k:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`x' MOD k'':num`][ARITH_RULE`1 * k' + i = (k' +i)`] +THEN MRESA_TAC MOD_LT[`x' MOD k''`;`k:num`]; + + + +MRESA_TAC DIVISION[`q:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`q MOD k< k ==>(x + p MOD k + k - q MOD k) + q MOD k = +((x + p MOD k) + k) `) +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`x+ p MOD k:num`][ARITH_RULE`1 * k' + i = (i+ k')`] +THEN MRESA_TAC MOD_LT[`q MOD k`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`(x + p MOD k + k - q MOD k)`;`q MOD k:num`;`k:num`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM(fun th-> +MRESA1_TAC th`x+ p MOD k` +THEN MRESA1_TAC th `(x + p MOD k + k - q MOD k) MOD k + q MOD k:num` +) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); + + + + + + + +EXISTS_TAC`(\i. (i+ p MOD k - q MOD k) MOD k)` +THEN STRIP_TAC; + + + +REWRITE_TAC[IN_ELIM_THM; IMAGE;EXISTS_UNIQUE] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`(y + q MOD k +k - p MOD k) MOD k ` +THEN MRESA_TAC DIVISION[`p:num`;`k:num`] +THEN MRESA_TAC DIVISION[`q:num`;`k:num`] +THEN MRESA_TAC DIVISION[`y + q MOD k +k - p MOD k:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`y yreal^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`y+ q MOD k` THEN MRESA1_TAC th `((y + q MOD k + k - p MOD k) MOD k + p MOD k):num` +) +THEN STRIP_TAC +; + + + +EXISTS_TAC`y:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); + + +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MP_TAC(ARITH_RULE`y q MOD k + k - p MOD k< k/\ (y' + p MOD k - q MOD k) + q MOD k + k - p MOD k = y'+k`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`q MOD k + k - p MOD k`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`y' + p MOD k - q MOD k`;`q MOD k + k - p MOD k`;`k:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`y':num`][ARITH_RULE`1 * k' + i = (i+k')`] +THEN MRESA_TAC MOD_LT[`y':num`;`k:num`] +; + + + + + + +REPEAT RESA_TAC +; + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x + p MOD k):num` +THEN MRESA1_TAC th`x' MOD k''+ q MOD k`) +THEN MP_TAC(ARITH_RULE`3<= k'' ==> ~(k''=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`x +p MOD k`;`k:num`] +THEN MRESA_TAC DIVISION[`x' MOD k'' +q MOD k`;`k:num`] +THEN MRESA_TAC DIVISION[`x':num`;`k'':num`] +THEN MP_TAC VV_INJ +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;scs_half_slice_v39;PAIR_EQ;REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`;dist] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(x+ p MOD k) MOD k:num`;`(x' MOD k'' + q MOD k)MOD k`]) +THEN MP_TAC(ARITH_RULE`q MOD k<= p MOD k /\ x' MOD k''< k'' /\ k'' (x + p MOD k - q MOD k) + q MOD k = x + p MOD k /\ x' MOD k''< k`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL Hdplygy.MOD_EQ_MOD)[`x + p MOD k - q MOD k`;`x' MOD k'' `;`q MOD k`;`k:num`][] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ADD_SYM] +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`x' MOD k''`;`k:num`]; + + + + +MRESA_TAC DIVISION[`q:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`q MOD k<= p MOD k ==> (x + p MOD k - q MOD k) + q MOD k = +(x + p MOD k) `) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`q MOD k`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`(x + p MOD k - q MOD k)`;`q MOD k:num`;`k:num`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM(fun th-> +MRESA1_TAC th`x+ p MOD k` +THEN MRESA1_TAC th `((x + p MOD k - q MOD k) MOD k + q MOD k):num` +) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); + + + +ASM_REWRITE_TAC[] +THEN MP_TAC E_PRIME_EQ_E_vv +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL E_PRIME_EQ_E_vv) +[`d'':real`;`d':real`;`mkj:bool`;`s':scs_v39`;`s'':scs_v39`;`p:num`;`s:scs_v39`; `vv:num->real^3`;`k'':num`;`q:num`;`k:num`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u:real^3`;`FF:real^3#real^3->bool`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39;] +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`u-w= --(w-u):real^3`] +THEN ASM_REWRITE_TAC[NORM_NEG] +THEN STRIP_TAC +THEN MP_TAC F_PRIME_EQ_F_vv +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL F_PRIME_EQ_F_vv) +[`d'':real`;`d':real`;`mkj:bool`;`s':scs_v39`;`s'':scs_v39`;`p:num`;`s:scs_v39`; `vv:num->real^3`;`k'':num`;`q:num`;`k:num`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u:real^3`;`FF:real^3#real^3->bool`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39;] +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`u-w= --(w-u):real^3`] +THEN ASM_REWRITE_TAC[NORM_NEG] +THEN STRIP_TAC +THEN SUBGOAL_THEN`BBs_v39 s' vv'`ASSUME_TAC; + + + +MP_TAC QKNVMLB1 +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;] +THEN RESA_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;tau3;MMs_v39;BBprime2_v39;BBprime_v39;is_scs_slice_v39] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`d' = scs_d_v39 s'`ASSUME_TAC +; + + +EXPAND_TAC"s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[]; + + + + +ASM_REWRITE_TAC[] +; + + +EXPAND_TAC"s'" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[]; + + + + +ASM_REWRITE_TAC[] +; + + + +SUBGOAL_THEN`BBs_v39 s'' vv''`ASSUME_TAC; + + + +MRESAL_TAC (GEN_ALL QKNVMLB1)[`vv:num->real^3`;`s:scs_v39`;`q:num`;`p:num`;`d'':real`;`mkj:bool`] +[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;] +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;tau3;MMs_v39;BBprime2_v39;BBprime_v39;is_scs_slice_v39] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`d'' = scs_d_v39 s''`ASSUME_TAC +; + + +EXPAND_TAC"s''" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[]; + + + + +ASM_REWRITE_TAC[] +; + + +EXPAND_TAC"s''" +THEN REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;dist;periodic2;scs_half_slice_v39] +THEN ASM_REWRITE_TAC[]; + + + + +ASM_REWRITE_TAC[] +; + + + + + +MP_TAC SCS_HALF_SLICE_IS_A_SCS +THEN ASM_REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL SCS_HALF_SLICE_IS_A_SCS)[`s:scs_v39`;`s':scs_v39`;`q:num`;`p:num`;`s'':scs_v39`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39] +THEN MRESAL_TAC(GEN_ALL VV_SUC_EQ_RHO_NODE_PRIME)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`k:num`;`s:scs_v39`;`FF:real^3#real^3->bool`;`u:real^3`;`vv:num->real^3`;`p:num MOD k`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN MRESAL_TAC(GEN_ALL VV_SUC_EQ_RHO_NODE_PRIME)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`k:num`;`s:scs_v39`;`FF:real^3#real^3->bool`;`w:real^3`;`vv:num->real^3`;`q:num MOD k`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN MP_TAC(ARITH_RULE`~(k'<= 3)\/ k'<= 3 `) +THEN RESA_TAC; + + +MP_TAC(ARITH_RULE`~(k''<= 3)\/ k''<= 3 `) +THEN RESA_TAC; + + + + +MP_TAC(ARITH_RULE`3<=k'==> ~(k'=0)/\ 0real^3`;`0:num MOD k'`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3/\ 0+A=A`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN MRESAL_TAC (GEN_ALL SUM_AZIM_EQ_ANGLE_LE4) +[`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`vv':num->real^3`;`0`;`s':scs_v39`;`u:real^3`;`face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)`;`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`;] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)/\ 0+A=A/\ A+0=A`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`sum {i | i < k'} + (\i. rho_fun (norm (vv (i MOD k' + p MOD k))) * + interior_angle1 (vec 0) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) + (vv (i MOD k' + p MOD k))) +=sum {i | i < k'} + (\i. rho_fun (norm (vv (i + p MOD k))) * + interior_angle1 (vec 0) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) + (vv (i + p MOD k)))` ASSUME_TAC +; + + +MATCH_MP_TAC SUM_EQ +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`x:num`;`k':num`]; + + + + +MP_TAC(ARITH_RULE`3<=k''==> ~(k''=0)/\ 0real^3`;`0:num MOD k'`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3/\ 0+A=A`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN MRESAL_TAC (GEN_ALL SUM_AZIM_EQ_ANGLE_LE4) +[`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w))`; +`vv'':num->real^3`;`0`;`s'':scs_v39`;`w:real^3`;`face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)`;`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w))`;] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)/\ 0+A=A/\ A+0=A`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`sum {i | i < k''} + (\i. rho_fun (norm (vv (i MOD k'' + q MOD k))) * + interior_angle1 (vec 0) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)) + (vv (i MOD k'' + q MOD k))) +=sum {i | i < k''} + (\i. rho_fun (norm (vv (i + q MOD k))) * + interior_angle1 (vec 0) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)) + (vv (i + q MOD k)))` ASSUME_TAC +; + + +MATCH_MP_TAC SUM_EQ +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`x:num`;`k'':num`]; + + +ASM_REWRITE_TAC[] +; + + + + + +MRESA_TAC (GEN_ALL CARD_FF_EQ_CARD_SLICE_FF) +[`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`u:real^3`;`hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))`;`w:real^3`;`FF:real^3#real^3->bool`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (u,rho_node1 FF u)`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (w,rho_node1 FF w)`] +THEN MRESA_TAC (GEN_ALL CARD_SLICE_FF_LE_3)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`u:real^3`;`hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))`;`FF:real^3#real^3->bool`;`w:real^3`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (u,rho_node1 FF u)`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (w,rho_node1 FF w)`] +THEN MP_TAC(ARITH_RULE` +3<= CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) +/\ 3<= CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)) +==> (CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) + + CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)) - + 2) - + 2= +(CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) -2)+ + (CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)) - + 2)`) +THEN RESA_TAC +THEN REWRITE_TAC[GSYM REAL_OF_NUM_ADD] +THEN MP_TAC QKNVMLB2 +THEN REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3/\ 0+A=A`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN RESA_TAC +THEN MATCH_MP_TAC(REAL_ARITH`d2<= d+d1 ==> a-c*b-d + a1-c*b1-d1<= (a+a1) - c*(b+b1)-d2`) +THEN ASM_REWRITE_TAC[] +; + + + +(******3 ~(k'=0)/\ 0real^3`;`0:num MOD k'`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3/\ 0+A=A`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN MRESAL_TAC (GEN_ALL SUM_AZIM_EQ_ANGLE_LE4) +[`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`; +`vv':num->real^3`;`0`;`s':scs_v39`;`u:real^3`;`face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)`;`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u))`;] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)/\ 0+A=A/\ A+0=A`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`sum {i | i < k'} + (\i. rho_fun (norm (vv (i MOD k' + p MOD k))) * + interior_angle1 (vec 0) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) + (vv (i MOD k' + p MOD k))) +=sum {i | i < k'} + (\i. rho_fun (norm (vv (i + p MOD k))) * + interior_angle1 (vec 0) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) + (vv (i + p MOD k)))` ASSUME_TAC +; + + +MATCH_MP_TAC SUM_EQ +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`x:num`;`k':num`]; + + +MP_TAC(ARITH_RULE`(k''<=3) /\ 3<= k'' ==> k''=3`) +THEN RESA_TAC +THEN REPLICATE_TAC (125-61)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC) +THEN MRESA_TAC (GEN_ALL SUM_AZIM_EQ_ANGLE_EQ4) +[`d'':real`;`d':real`;`mkj:bool`;`vv'':num->real^3`;`vv':num->real^3`;`s':scs_v39`;`s'':scs_v39`;`s:scs_v39`;`p:num`;`k'':num`;`vv:num->real^3`;`q:num`;`k:num`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u:real^3`;`FF:real^3#real^3->bool`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39;] +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`u-w= --(w-u):real^3`] +THEN ASM_REWRITE_TAC[NORM_NEG] +THEN RESA_TAC +; + + + + + + +MRESA_TAC (GEN_ALL CARD_FF_EQ_CARD_SLICE_FF) +[`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`u:real^3`;`hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))`;`w:real^3`;`FF:real^3#real^3->bool`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (u,rho_node1 FF u)`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (w,rho_node1 FF w)`] +THEN MRESA_TAC (GEN_ALL CARD_SLICE_FF_LE_3)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`u:real^3`;`hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))`;`FF:real^3#real^3->bool`;`w:real^3`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (u,rho_node1 FF u)`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (w,rho_node1 FF w)`] +THEN MP_TAC(ARITH_RULE` +3<= CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) +/\ 3<= CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)) +==> (CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) + + CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)) - + 2) - + 2= +(CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) -2)+ + (CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)) - + 2)`) +THEN RESA_TAC +THEN REWRITE_TAC[GSYM REAL_OF_NUM_ADD] +THEN MP_TAC QKNVMLB2 +THEN REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3/\ 0+A=A`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN RESA_TAC +THEN REPLICATE_TAC (131-124)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN ASM_REWRITE_TAC[th] +THEN MP_TAC th +THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC(GEN_ALL CARD_FF_EQ_SCS_K_3)[`k'':num`;`s'':scs_v39`;`vv'':num->real^3`;`face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)`][MMs_v39;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3/\ 0+A=A`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3) /\ 3-2=1`;mk_unadorned_v39;scs_diag;dist] +THEN MATCH_MP_TAC(REAL_ARITH`d2<= d+d1 ==> a-c*b-d + a1-c-d1<= (a+a1) - c*(b+ &1)-d2`) +THEN ASM_REWRITE_TAC[] +; + + + + +MP_TAC(ARITH_RULE`~(k''<= 3)\/ k''<= 3 `) +THEN RESA_TAC; + +(********k'=3 /\ 3< k''***********) + + + +MP_TAC(ARITH_RULE`3<=k''==> ~(k''=0)/\ 0real^3`;`0:num MOD k''`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3/\ 0+A=A`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN MRESAL_TAC (GEN_ALL SUM_AZIM_EQ_ANGLE_LE4) +[`v_prime V + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w))`; +`vv'':num->real^3`;`0`;`s'':scs_v39`;`w:real^3`;`face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)`;`e_prime (E UNION {{u, w}}) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w))`;] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)/\ 0+A=A/\ A+0=A`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`sum {i | i < k''} + (\i. rho_fun (norm (vv (i MOD k'' + q MOD k))) * + interior_angle1 (vec 0) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)) + (vv (i MOD k'' + q MOD k))) +=sum {i | i < k''} + (\i. rho_fun (norm (vv (i + q MOD k))) * + interior_angle1 (vec 0) + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)) + (vv (i + q MOD k)))` ASSUME_TAC +; + + +MATCH_MP_TAC SUM_EQ +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_LT[`x:num`;`k'':num`]; + + +ASM_REWRITE_TAC[] +; + + + + +MP_TAC(ARITH_RULE`(k'<=3) /\ 3<= k' ==> k'=3`) +THEN RESA_TAC +THEN REPLICATE_TAC (125-60)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC) +THEN MRESA_TAC (GEN_ALL SUM_AZIM_EQ_ANGLE_EQ4) +[`d':real`;`d'':real`;`mkj:bool`;`vv':num->real^3`;`vv'':num->real^3`;`s'':scs_v39`;`s':scs_v39`;`s:scs_v39`;`q:num`;`k':num`;`vv:num->real^3`;`p:num`;`k:num`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`;`FF:real^3#real^3->bool`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39;] +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`u-w= --(w-u):real^3`] +THEN ASM_REWRITE_TAC[NORM_NEG] +THEN RESA_TAC +; + + + + +MRESA_TAC (GEN_ALL CARD_FF_EQ_CARD_SLICE_FF) +[`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`u:real^3`;`hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))`;`w:real^3`;`FF:real^3#real^3->bool`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (u,rho_node1 FF u)`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (w,rho_node1 FF w)`] +THEN MRESA_TAC (GEN_ALL CARD_SLICE_FF_LE_3)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`u:real^3`;`hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))`;`FF:real^3#real^3->bool`;`w:real^3`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (u,rho_node1 FF u)`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (w,rho_node1 FF w)`] +THEN MP_TAC(ARITH_RULE` +3<= CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) +/\ 3<= CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)) +==> (CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) + + CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)) - + 2) - + 2= +(CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) -2)+ + (CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)) - + 2)`) +THEN RESA_TAC +THEN REWRITE_TAC[GSYM REAL_OF_NUM_ADD] +THEN MP_TAC QKNVMLB2 +THEN REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3/\ 0+A=A`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN RESA_TAC +THEN REPLICATE_TAC (131-124)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN ASM_REWRITE_TAC[th] +THEN MP_TAC th +THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC(GEN_ALL CARD_FF_EQ_SCS_K_3)[`k':num`;`s':scs_v39`;`vv':num->real^3`;`face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)`][MMs_v39;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3/\ 0+A=A`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3) /\ 3-2=1`;mk_unadorned_v39;scs_diag;dist] +THEN MATCH_MP_TAC(REAL_ARITH`d2<= d+d1 ==> a-c-d + a1-c*b-d1<= (a+a1) - c*(&1+b)-d2`) +THEN ASM_REWRITE_TAC[] +; + + +(*********k'=3 /\ k''=3********) + + + + +MP_TAC(ARITH_RULE`(k'<=3) /\ 3<= k' ==> k'=3`) +THEN RESA_TAC +THEN REPLICATE_TAC (120-60)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC) +THEN MRESA_TAC (GEN_ALL SUM_AZIM_EQ_ANGLE_EQ4) +[`d':real`;`d'':real`;`mkj:bool`;`vv':num->real^3`;`vv'':num->real^3`;`s'':scs_v39`;`s':scs_v39`;`s:scs_v39`;`q:num`;`k':num`;`vv:num->real^3`;`p:num`;`k:num`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`;`FF:real^3#real^3->bool`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39;] +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`u-w= --(w-u):real^3`] +THEN ASM_REWRITE_TAC[NORM_NEG] +THEN RESA_TAC +; + + + +MP_TAC(ARITH_RULE`(k''<=3) /\ 3<= k'' ==> k''=3`) +THEN RESA_TAC +THEN REPLICATE_TAC (122-60)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC) +THEN MRESA_TAC (GEN_ALL SUM_AZIM_EQ_ANGLE_EQ4) +[`d'':real`;`d':real`;`mkj:bool`;`vv'':num->real^3`;`vv':num->real^3`;`s':scs_v39`;`s'':scs_v39`;`s:scs_v39`;`p:num`;`k'':num`;`vv:num->real^3`;`q:num`;`k:num`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u:real^3`;`FF:real^3#real^3->bool`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;scs_half_slice_v39;] +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`u-w= --(w-u):real^3`] +THEN ASM_REWRITE_TAC[NORM_NEG] +THEN RESA_TAC +; + + + + +MRESA_TAC (GEN_ALL CARD_FF_EQ_CARD_SLICE_FF) +[`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`u:real^3`;`hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))`;`w:real^3`;`FF:real^3#real^3->bool`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (u,rho_node1 FF u)`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (w,rho_node1 FF w)`] +THEN MRESA_TAC (GEN_ALL CARD_SLICE_FF_LE_3)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`u:real^3`;`hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))`;`FF:real^3#real^3->bool`;`w:real^3`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (u,rho_node1 FF u)`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{u, w}}))) (w,rho_node1 FF w)`] +THEN MP_TAC(ARITH_RULE` +3<= CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) +/\ 3<= CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)) +==> (CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) + + CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)) - + 2) - + 2= +(CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)) -2)+ + (CARD + (face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)) - + 2)`) +THEN RESA_TAC +THEN REWRITE_TAC[GSYM REAL_OF_NUM_ADD] +THEN MP_TAC QKNVMLB2 +THEN REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3/\ 0+A=A`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN RESA_TAC +THEN REPLICATE_TAC (128-118)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN ASM_REWRITE_TAC[th] +THEN MP_TAC th +THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC(GEN_ALL CARD_FF_EQ_SCS_K_3)[`k':num`;`s':scs_v39`;`vv':num->real^3`;`face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (u,rho_node1 FF u)`][MMs_v39;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3/\ 0+A=A`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3) /\ 3-2=1`;mk_unadorned_v39;scs_diag;dist] +THEN REPLICATE_TAC (128-120)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN ASM_REWRITE_TAC[th] +THEN MP_TAC th +THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC(GEN_ALL CARD_FF_EQ_SCS_K_3)[`k'':num`;`s'':scs_v39`;`vv'':num->real^3`;`face (hypermap (HYP (vec 0,V,E UNION {{u, w}}))) (w,rho_node1 FF w)`][MMs_v39;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3/\ 0+A=A`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3) /\ 3-2=1`;mk_unadorned_v39;scs_diag;dist] +THEN MATCH_MP_TAC(REAL_ARITH`d2<= d+d1 ==> a-c-d + a1-c-d1<= (a+a1) - c*(&1+ &1)-d2`) +THEN ASM_REWRITE_TAC[] +; + +]);; + + + + + + +let DIAGE_VAL_P_Q=prove(`~(p MOD 4 = q MOD 4)/\ +~(SUC p MOD 4 = q MOD 4)/\ +~(p MOD 4 = SUC q MOD 4) +==> q MOD 4=(p MOD 4 +2) MOD 4`, +MRESAL_TAC DIVISION[`p:num`;`4`][ARITH_RULE`~(4=0)`;ADD1] +THEN MP_TAC(ARITH_RULE`p MOD 4<4==> p MOD 4=0 \/ p MOD 4=1 \/ p MOD 4=2 \/ p MOD 4=3`) +THEN RESA_TAC +THEN MRESAL_TAC DIVISION[`q:num`;`4`][ARITH_RULE`~(4=0)`;ADD1] +THEN MP_TAC(ARITH_RULE`q MOD 4<4==> q MOD 4=0 \/ q MOD 4=1 \/ q MOD 4=2 \/ q MOD 4=3`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_ADD_MOD[`p:num`;`1`;`4`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`q:num`;`1`;`4`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ARITH_TAC);; + + + +let QKNVMLB3_Eq4=prove_by_refinement( +`(scs_k_v39 s =4 /\ ~(scs_J_v39 s' 0 (scs_k_v39 s' - 1)))/\ + scs_half_slice_v39 s p q d' mkj =s'/\ + scs_half_slice_v39 s q p d'' mkj =s'' /\ + vv' = (\i. (vv:num->real^3) (i MOD (scs_k_v39 s')+p MOD (scs_k_v39 s))) +/\ + vv'' = (\i. (vv:num->real^3) (i MOD (scs_k_v39 s'')+q MOD (scs_k_v39 s))) +/\ + MMs_v39 s vv /\ + is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q /\ + is_scs_slice_v39 s s' s'' p q /\ + scs_d_v39 s <= d' + d'' ==> + taustar_v39 s' vv' + taustar_v39 s'' vv'' <= taustar_v39 s vv`, +[ +REWRITE_TAC[taustar_v39;LET_DEF;LET_END_DEF;scs_diag] +THEN STRIP_TAC +THEN MP_TAC SCS_K_PRIME_CASE_3 +THEN REWRITE_TAC[taustar_v39;LET_DEF;LET_END_DEF;scs_diag] +THEN RESA_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN ABBREV_TAC`k'=scs_k_v39 s'` +THEN ABBREV_TAC`k''=scs_k_v39 s''` +THEN MP_TAC(ARITH_RULE`3 ~(k<=3)`) +THEN RESA_TAC +THEN MP_TAC SCS_K_LE_6 +THEN RESA_TAC +THEN ABBREV_TAC`u= (vv:num->real^3) (p MOD k)` +THEN ABBREV_TAC `w= (vv:num->real^3) (q MOD k)` +THEN ABBREV_TAC`V= IMAGE (vv:num->real^3) (:num)` +THEN ABBREV_TAC`E= IMAGE (\i. {vv i,(vv:num->real^3) (SUC i)}) (:num)` +THEN ABBREV_TAC`FF= IMAGE (\i. (vv i,(vv:num->real^3) (SUC i))) (:num)` +THEN MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`p MOD scs_k_v39 s`;`vv:num->real^3`] +THEN MRESA_TAC (GEN_ALL IN_IMAGE_VV)[`q MOD scs_k_v39 s`;`vv:num->real^3`] +THEN ASM_TAC +THEN REPLICATE_TAC 2 STRIP_TAC +THEN ASM_REWRITE_TAC[MMs_v39;BBprime_v39;BBprime2_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;] +THEN REPEAT RESA_TAC +; + + +REPLICATE_TAC (54-9)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[ARITH_RULE`~(4<=3)`] +; + + + + + + +MP_TAC SCS_K_PRIME_CASE_4 +THEN ASM_REWRITE_TAC[MMs_v39;BBprime_v39;BBprime2_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN STRIP_TAC +THEN MRESAL_TAC(GEN_ALL SCS_K_PRIME_CASE_4) +[`d'':real`;`mkj:bool`;`s:scs_v39`;`q:num`;`p:num`;`s'':scs_v39`] +[MMs_v39;BBprime_v39;BBprime2_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN MATCH_MP_TAC(REAL_ARITH`a2=a+a1 /\ b2<= b+b1==>a-b+a1-b1<=a2-b2`) +THEN MP_TAC QKNVMLB2 +THEN REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3/\ 0+A=A`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN RESA_TAC +THEN REWRITE_TAC[tau_fun] +THEN SUBGOAL_THEN`local_fan(V,E,FF)`ASSUME_TAC +; + + +REPLICATE_TAC (57-9)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REWRITE_TAC[convex_local_fan] +THEN ASM_REWRITE_TAC[ARITH_RULE`~(4<=3)`] +THEN REPEAT RESA_TAC +; + +MP_TAC Local_lemmas.LOFA_IMP_CARD_FF_V_EQ +THEN RESA_TAC +THEN MP_TAC CARD_V_EQ_SCS_K +THEN REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3/\ 4-2=2`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;Basics.DIMINDEX_4;IN] +THEN RESA_TAC +THEN REWRITE_TAC[ARITH_RULE`4-2=2`] +THEN MP_TAC SUM_AZIM_EQ_ANGLE_LE4 +THEN +ASM_REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;BBs_v39;is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3/\ ~(4<=3)`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist;Basics.DIMINDEX_4;IN] +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;NUMSEG_3;SUM_NUMSEG3]) +THEN MRESAL_TAC(GEN_ALL VV_SUC_EQ_RHO_NODE)[`scs_k_v39 s`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`p:num`;`q:num`;`s:scs_v39`;`FF:real^3#real^3->bool`;`u:real^3`;`vv:num->real^3`;`p:num MOD k`] +[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;scs_diag;dist] +THEN REPLICATE_TAC (61-9)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[ARITH_RULE`~(4<=3)`] +THEN REPEAT RESA_TAC +THEN SUBGOAL_THEN`(vv:num->real^3) (0+p MOD 4) IN V`ASSUME_TAC +; + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`0+p MOD 4` +THEN REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +SUBGOAL_THEN`(vv:num->real^3) (1+p MOD 4) IN V`ASSUME_TAC +; + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`1+p MOD 4` +THEN REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + + +SUBGOAL_THEN`(vv:num->real^3) (2+p MOD 4) IN V`ASSUME_TAC +; + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`2+p MOD 4` +THEN REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +SUBGOAL_THEN`(vv:num->real^3) (3+p MOD 4) IN V`ASSUME_TAC +; + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`3+p MOD 4` +THEN REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +MP_TAC Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM_IVS +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`(vv:num->real^3) (0+p MOD 4)` +THEN MRESA1_TAC th`(vv:num->real^3) (1+p MOD 4)` +THEN MRESA1_TAC th`(vv:num->real^3) (2+p MOD 4)` +THEN MRESA1_TAC th`(vv:num->real^3) (3+p MOD 4)`) +THEN SUBGOAL_THEN`(rho_node1 FF (vv (0 + p MOD 4))) =vv (1 + p MOD 4)`ASSUME_TAC; + + + + +MATCH_MP_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE) +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`0+p MOD 4` +THEN REWRITE_TAC[SET_RULE`(a:num)IN(:num)`;ARITH_RULE`SUC(0+p MOD 4)= 1+ p MOD 4`]; + + +SUBGOAL_THEN`(rho_node1 FF (vv (1 + p MOD 4))) =vv (2 + p MOD 4)`ASSUME_TAC; + + + + +MATCH_MP_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE) +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`1+p MOD 4` +THEN REWRITE_TAC[SET_RULE`(a:num)IN(:num)`;ARITH_RULE`SUC(1+p MOD 4)= 2+ p MOD 4`]; + + + +SUBGOAL_THEN`(rho_node1 FF (vv (2 + p MOD 4))) =vv (3 + p MOD 4)`ASSUME_TAC; + + + + +MATCH_MP_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE) +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`2+p MOD 4` +THEN REWRITE_TAC[SET_RULE`(a:num)IN(:num)`;ARITH_RULE`SUC(2+p MOD 4)= 3+ p MOD 4`]; + + + + + +SUBGOAL_THEN`(rho_node1 FF (vv (3 + p MOD 4))) =vv (0 + p MOD 4)`ASSUME_TAC; + + + + +MATCH_MP_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE) +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`3+p MOD 4` +THEN REWRITE_TAC[SET_RULE`(a:num)IN(:num)`;ARITH_RULE`SUC(3+p MOD 4)= 4+ p MOD 4/\ 0+A=A`] +THEN MRESAL_TAC MOD_MOD_REFL[`p:num`;`k:num`][ARITH_RULE`~(4=0)`;] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`p MOD k`][ARITH_RULE`1 * k + x MOD k = k+ x MOD k`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(4+ p MOD 4)`) ; + + +SUBGOAL_THEN`(ivs_rho_node1 FF (vv (0 + p MOD 4))) =vv (3 + p MOD 4)`ASSUME_TAC +; + + + +MATCH_MP_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE) +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`3+p MOD 4` +THEN REWRITE_TAC[SET_RULE`(a:num)IN(:num)`;ARITH_RULE`SUC(3+p MOD 4)= 4+ p MOD 4/\ 0+A=A`] +THEN MRESAL_TAC MOD_MOD_REFL[`p:num`;`k:num`][ARITH_RULE`~(4=0)`;] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`p MOD k`][ARITH_RULE`1 * k + x MOD k = k+ x MOD k`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(4+ p MOD 4)`) ; + + + + + + +SUBGOAL_THEN`(ivs_rho_node1 FF (vv (3 + p MOD 4))) =vv (2 + p MOD 4)`ASSUME_TAC; + + + + +MATCH_MP_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE) +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`2+p MOD 4` +THEN REWRITE_TAC[SET_RULE`(a:num)IN(:num)`;ARITH_RULE`SUC(2+p MOD 4)= 3+ p MOD 4`]; + + + + + + + +SUBGOAL_THEN`(ivs_rho_node1 FF (vv (1 + p MOD 4))) =vv (0 + p MOD 4)`ASSUME_TAC; + + + + +MATCH_MP_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE) +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`0+p MOD 4` +THEN REWRITE_TAC[SET_RULE`(a:num)IN(:num)`;ARITH_RULE`SUC(0+p MOD 4)= 1+ p MOD 4`]; + + +SUBGOAL_THEN`(ivs_rho_node1 FF (vv (2 + p MOD 4))) =vv (1 + p MOD 4)`ASSUME_TAC; + + + + +MATCH_MP_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE) +THEN EXISTS_TAC`V:real^3->bool` +THEN EXISTS_TAC`E:(real^3->bool)->bool` +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`1+p MOD 4` +THEN REWRITE_TAC[SET_RULE`(a:num)IN(:num)`;ARITH_RULE`SUC(1+p MOD 4)= 2+ p MOD 4`]; + +ASM_REWRITE_TAC[] +THEN MP_TAC VV_INJ +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;scs_half_slice_v39;PAIR_EQ;REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`3<=3`;dist] +THEN STRIP_TAC THEN SUBGOAL_THEN`(!i j. i < 4 /\ j < 4 /\ vv i = (vv:num->real^3) j ==> (i = j))`ASSUME_TAC +; + + +REPEAT GEN_TAC +THEN POP_ASSUM(fun th-> +REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`;`j:num`]) +; + + + +SUBGOAL_THEN`dist(vv 0, vv 1) < &4 /\ + dist(vv 0, vv 3) < &4 /\ + dist(vv 1,vv 2) < &4 /\ + dist(vv 2,(vv:num->real^3) 3) < &4 `ASSUME_TAC +; + + +REWRITE_TAC[dist] +THEN REPLICATE_TAC (79-16) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`0`;`1`] +THEN MRESA_TAC th[`0`;`3`] +THEN MRESA_TAC th[`1`;`2`] +THEN MRESA_TAC th[`2`;`3`]) +THEN REPLICATE_TAC (82-32) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL1_TAC th`0`[ARITH_RULE`SUC 0=1`] +THEN MRESAL1_TAC th`1`[ARITH_RULE`SUC 1=2`] +THEN MRESAL1_TAC th`2`[ARITH_RULE`SUC 2=3`] +THEN MRESAL1_TAC th`3`[ARITH_RULE`SUC 3=4`]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (85-28) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`0`;`1`] +THEN MRESA_TAC th[`0`;`3`] +THEN MRESA_TAC th[`1`;`2`] +THEN MRESA_TAC th[`2`;`3`]) +THEN REPLICATE_TAC (96-76) (POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s 3`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th `4:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;cstab]) +THEN REAL_ARITH_TAC; + + + + + +REPLICATE_TAC (80-7) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN RESA_TAC) +THEN SUBGOAL_THEN`!i j. ~(vv i = vv j) ==> &2 <= dist(vv i,(vv:num->real^3) j) ` ASSUME_TAC +; + + + +REWRITE_TAC[dist] +THEN REPEAT GEN_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th `i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th `j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`i:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC DIVISION[`j:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC; + + +REPLICATE_TAC (85-78) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th[`i MOD 4`;`j MOD 4`]) +; + + +REPLICATE_TAC (85-30) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`i MOD 4`;`j MOD 4`]) +THEN REPLICATE_TAC (85-7) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`i MOD 4`;`j MOD 4`]) +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + + +SUBGOAL_THEN`dist((vv:num->real^3) (p MOD 4), vv (q MOD 4))< &4`ASSUME_TAC +; + + + +REWRITE_TAC[dist] +THEN REPLICATE_TAC (81-39) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;scs_half_slice_v39;PAIR_EQ;REAL_ARITH`#0.11 < #0.9`;ARITH_RULE`~(4<=3)`;dist] +THEN STRIP_TAC +THEN REPLICATE_TAC (87-15) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`p MOD 4`;`q MOD 4`]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (3) (POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s p`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th `q:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s (q MOD 4)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th `p:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REAL_ARITH_TAC; + + +POP_ASSUM MP_TAC +THEN MRESAL_TAC DIVISION[`p:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th `4:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`5`[ARITH_RULE`5 MOD 4=1`] +THEN MRESAL1_TAC th`6`[ARITH_RULE`6 MOD 4=2`]) +THEN POP_ASSUM(fun th-> +POP_ASSUM (fun th1-> +POP_ASSUM(fun th2-> ASSUME_TAC(SYM th2)) +THEN ASSUME_TAC(SYM th1)) +THEN ASSUME_TAC (SYM th)) +THEN MP_TAC(ARITH_RULE`p MOD 4<4==> p MOD 4=0 \/ p MOD 4=1 \/ p MOD 4=2 \/ p MOD 4=3`) +THEN RESA_TAC; + + + +MP_TAC DIAGE_VAL_P_Q +THEN RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1 /\ 2 MOD 3=2/\ A+0=A /\ 0+A=A/\ 1+2=3/\ 2 MOD 4=2 /\ 3 MOD 4=3/\ 2+2=4`;SET_RULE`(A /\ B) ==> B`] +THEN POP_ASSUM(fun th-> +POP_ASSUM(fun th1-> +ASM_TAC +THEN REWRITE_TAC[th;th1;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1 /\ 2 MOD 3=2/\ A+0=A /\ 0+A=A/\ 1+2=3/\ 2 MOD 4=2 /\ 3 MOD 4=3/\ 2+2=4`;])) +THEN REPEAT STRIP_TAC +THEN MRESAL1_TAC (GEN_ALL Terminal.vv_quad_split012)`vv:num->real^3`[LET_DEF;LET_END_DEF;] +; + + + +MP_TAC DIAGE_VAL_P_Q +THEN RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1 /\ 2 MOD 3=2/\ A+0=A /\ 0+A=A/\ 1+2=3/\ 2 MOD 4=2 /\ 3 MOD 4=3/\ 2+2=4/\ 1+1=2 /\ 2+1=3/\ 1+3=4/\ 2+3=5/\3+1=4`;SET_RULE`(B /\ A) ==> B`] +THEN POP_ASSUM(fun th-> +POP_ASSUM(fun th1-> +ASM_TAC +THEN REWRITE_TAC[th;th1;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1 /\ 2 MOD 3=2/\ A+0=A /\ 0+A=A/\ 1+2=3/\ 2 MOD 4=2 /\ 3 MOD 4=3/\ 2+2=4`;])) +THEN REPEAT STRIP_TAC +THEN MRESAL1_TAC (GEN_ALL Terminal.vv_quad_split123)`vv:num->real^3`[LET_DEF;LET_END_DEF;] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC +; + + + +MP_TAC DIAGE_VAL_P_Q +THEN RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1 /\ 2 MOD 3=2/\ A+0=A /\ 0+A=A/\ 1+2=3/\ 2 MOD 4=2 /\ 3 MOD 4=3/\ 2+2=4/\ 1+1=2 /\ 2+1=3/\ 1+3=4/\ 2+3=5/\3+1=4/\ 3+2=5/\ 4 MOD 4=0`;SET_RULE`(B /\ A) ==> B`] +THEN POP_ASSUM(fun th-> +POP_ASSUM(fun th1-> +ASM_TAC +THEN REWRITE_TAC[th;th1;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1 /\ 2 MOD 3=2/\ A+0=A /\ 0+A=A/\ 1+2=3/\ 2 MOD 4=2 /\ 3 MOD 4=3/\ 2+2=4/\ 1+1=2 /\ 2+1=3/\ 1+3=4/\ 2+3=5/\3+1=4/\ 3+2=5/\ 4 MOD 4=0`;])) +THEN REPEAT STRIP_TAC +THEN MRESAL1_TAC (GEN_ALL Terminal.vv_quad_split012)`vv:num->real^3`[LET_DEF;LET_END_DEF;DIST_SYM] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + + + + +MP_TAC DIAGE_VAL_P_Q +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1 /\ 2 MOD 3=2/\ A+0=A /\ 0+A=A/\ 1+2=3/\ 2 MOD 4=2 /\ 3 MOD 4=3/\ 2+2=4/\ 1+1=2 /\ 2+1=3/\ 1+3=4/\ 2+3=5/\3+1=4/\ 3+2=5/\ 4 MOD 4=0/\ 5 MOD 4=1/\ 3+3=6`;] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> +POP_ASSUM(fun th1-> +ASM_TAC +THEN REWRITE_TAC[th;th1;ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1 /\ 2 MOD 3=2/\ A+0=A /\ 0+A=A/\ 1+2=3/\ 2 MOD 4=2 /\ 3 MOD 4=3/\ 2+2=4/\ 1+1=2 /\ 2+1=3/\ 1+3=4/\ 2+3=5/\3+1=4/\ 3+2=5/\ 4 MOD 4=0`;])) +THEN REPEAT STRIP_TAC +THEN MRESAL1_TAC (GEN_ALL Terminal.vv_quad_split123)`vv:num->real^3`[LET_DEF;LET_END_DEF;DIST_SYM] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + + +]);; + + +let QKNVMLB3=prove(` scs_half_slice_v39 s p q d' mkj =s'/\ + scs_half_slice_v39 s q p d'' mkj =s'' /\ + vv' = (\i. (vv:num->real^3) (i MOD (scs_k_v39 s')+p MOD (scs_k_v39 s))) +/\ + vv'' = (\i. (vv:num->real^3) (i MOD (scs_k_v39 s'')+q MOD (scs_k_v39 s))) +/\ + MMs_v39 s vv /\ + is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q /\ + is_scs_slice_v39 s s' s'' p q /\ + scs_d_v39 s <= d' + d'' ==> + taustar_v39 s' vv' + taustar_v39 s'' vv'' <= taustar_v39 s vv`, +MP_TAC(SET_RULE`~(scs_k_v39 s =4 /\ ~(scs_J_v39 s' 0 (scs_k_v39 s' - 1)))\/ +(scs_k_v39 s =4 /\ ~(scs_J_v39 s' 0 (scs_k_v39 s' - 1)))`) +THEN STRIP_TAC +THEN STRIP_TAC +THENL[ +MP_TAC QKNVMLB3_LE4 +THEN RESA_TAC; +MP_TAC QKNVMLB3_Eq4 +THEN RESA_TAC]);; + + + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/RNSYJXM-compiled.hl b/text_formalization/local/RNSYJXM-compiled.hl new file mode 100644 index 0000000..e161a47 --- /dev/null +++ b/text_formalization/local/RNSYJXM-compiled.hl @@ -0,0 +1,397 @@ +needs "tame/ssreflect/tame_lemmas-compiled.hl";; + +(* Module Rnsyjxm*) +module Rnsyjxm = struct + +open Localization;; +open Tame_defs;; +open Ssrbool;; +open Ssrnat;; +open Hypermap_and_fan;; +open Fan_defs;; +open Hypermap;; +open Add_triangle;; +open Tame_general;; +open Hypermap_iso;; +open Wrgcvdr_cizmrrh;; + +(* Lemma localization_set_of_edge_subset *) +let localization_set_of_edge_subset = Sections.section_proof ["V";"E";"f";"v"] +`set_of_edge v (v_prime V f) (e_prime E f) SUBSET set_of_edge v V E` +[ + ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("set_of_edge", [set_of_edge]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("e_prime", [e_prime]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("v_prime", [v_prime]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((BETA_TAC THEN (move ["u"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["x"])) THEN (case THEN (move ["w"])) THEN (case THEN (move ["h"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma in_face_imp_in_dart *) +let in_face_imp_in_dart = Sections.section_proof ["x";"H";"d"] +`x IN dart H /\ d IN face H x ==> d IN dart H` +[ + (BETA_TAC THEN (case THEN ((move ["x_in"]) THEN (move ["d_in"])))); + (((((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma in_face_imp_in_dart_alt *) +let in_face_imp_in_dart_alt = Sections.section_proof ["H";"f";"d"] +`f IN face_set H /\ d IN f ==> d IN dart H` +[ + (BETA_TAC THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (case THEN (move ["x"])) THEN (case THEN (move ["x_in"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["d_in"])); + ((((fun arg_tac -> (use_arg_then2 ("in_face_imp_in_dart", [in_face_imp_in_dart])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma face_face_map_eq *) +let face_face_map_eq = Sections.section_proof ["H";"d"] +`face H (face_map H d) = face H d` +[ + ((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("face", [face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_orbit_map1", [in_orbit_map1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Fan *) +Sections.begin_section "Fan";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_hyp "fanV" (`FAN (vec 0,V,E)`));; + +(* Let dartH *) +Sections.add_section_lemma "dartH" (Sections.section_proof [] +`dart (hypermap_of_fan (V,E)) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let in_dart_inV *) +Sections.add_section_lemma "in_dart_inV" (Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) ==> FST d IN V /\ SND d IN V` +[ + (((((use_arg_then2 ("pair_expand", [pair_expand]))(thm_tac (new_rewrite [1] [])))) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +]);; + +(* Lemma card_set_of_edge_gt1_imp_in_dart1 *) +let card_set_of_edge_gt1_imp_in_dart1 = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + /\ CARD (set_of_edge v V E) > 1 ==> v,w IN dart1_of_fan (V,E)` +[ + (BETA_TAC THEN (case THEN ((move ["vw_in"]) THEN (move ["card_gt1"])))); + ((((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN (clear_assumption "vw_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("dart_of_fan_eq", [dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (case THEN ((TRY done_tac)))); + (((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["z"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["z_in"])) THEN (move ["eq1"]) THEN (move ["eq2"])); + ((((use_arg_then2 ("card_gt1", [])) (disch_tac [])) THEN (clear_assumption "card_gt1") THEN BETA_TAC) THEN ((((use_arg_then2 ("eq2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CARD_CLAUSES", [CARD_CLAUSES]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma azim_in_fan_eq_azim_dart *) +let azim_in_fan_eq_azim_dart = Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) + ==> azim_in_fan d E = azim_dart (V,E) d` +[ + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"])); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE azim_in_fan)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("azim_dart_eq_azim_fan", [azim_dart_eq_azim_fan]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("azim_fan", [azim_fan]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("EE_elim", [EE_elim])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`_ > 1`))) (disch_eq_tac "ineq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((fun arg_tac -> (use_arg_then2 ("AZIM_CYCLE_EQ_SIGMA_FAN_ALT", [AZIM_CYCLE_EQ_SIGMA_FAN_ALT])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("card_set_of_edge_gt1_imp_in_dart1", [card_set_of_edge_gt1_imp_in_dart1])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN", [PAIR_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma wedge_in_fan_gt_eq_w_dart_fan *) +let wedge_in_fan_gt_eq_w_dart_fan = Sections.section_proof ["d"] +`d IN dart1_of_fan (V,E) + ==> wedge_in_fan_gt d E = w_dart_fan (vec 0) V E (ext_dart (V,E) d)` +[ + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"])); + ((((use_arg_then2 ("wedge_in_fan_gt", [wedge_in_fan_gt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ext_dart", [ext_dart]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w_dart_fan", [w_dart_fan]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("EE_elim", [EE_elim])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN", [PAIR_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["_"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["w_inE"])) THEN (move ["_"]))))); + (((fun arg_tac -> arg_tac (Arg_term (`CARD _ > 1`))) (disch_eq_tac "ineq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((fun arg_tac -> (use_arg_then2 ("AZIM_CYCLE_EQ_SIGMA_FAN_ALT", [AZIM_CYCLE_EQ_SIGMA_FAN_ALT])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`set_of_edge v V E = {w}`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac)))))); + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN ((((use_arg_then2 ("gtE", [gtE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_LT", [NOT_LT]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("finite_set_of_edge", [finite_set_of_edge])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finE"]))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x <= 1 <=> x = 0 \/ x = 1`))) (term_tac (have_gen_tac ["x"](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((((((use_arg_then2 ("CARD_EQ_0", [CARD_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["eq"])) THEN (((use_arg_then2 ("w_inE", [])) (disch_tac [])) THEN (clear_assumption "w_inE") THEN BETA_TAC) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("Rogers.CARD_1_IMP_SING", [Rogers.CARD_1_IMP_SING])) (fun fst_arg -> (use_arg_then2 ("finE", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["x"])) THEN (move ["eq"])); + ((((use_arg_then2 ("w_inE", [])) (disch_tac [])) THEN (clear_assumption "w_inE") THEN BETA_TAC) THEN (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma localization_dart_eq_dart1 *) +let localization_dart_eq_dart1 = Sections.section_proof ["f"] +`f IN face_set (hypermap_of_fan (V,E)) + /\ 2 <= CARD f + ==> dart_of_fan (v_prime V f, e_prime E f) = dart1_of_fan (v_prime V f, e_prime E f)` +[ + (BETA_TAC THEN (case THEN ((move ["f_in"]) THEN (move ["card_f"])))); + ((((((use_arg_then2 ("dart_of_fan_eq", [dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (move ["d"])) THEN ((THENL) (split_tac) [((case THEN ALL_TAC) THEN ((TRY done_tac))); ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))])); + (((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac) THEN (move ["_"]))); + (((((use_arg_then2 ("NOT_EXISTS_THM", [NOT_EXISTS_THM]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] [])))))) THEN (move ["v"])); + ((((fun arg_tac -> arg_tac (Arg_term (`v IN _`))) (disch_eq_tac "v_in" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN (DISJ1_TAC)); + ((((use_arg_then2 ("v_in", [])) (disch_tac [])) THEN (clear_assumption "v_in") THEN BETA_TAC) THEN (((((use_arg_then2 ("v_prime", [v_prime]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["v_in"])) THEN (case THEN (move ["w"])) THEN (move ["vw_in_f"]))); + ((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("w", [])) (term_tac exists_tac))); + ((((use_arg_then2 ("f_in", [])) (disch_tac [])) THEN (clear_assumption "f_in") THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["x"]))) THEN ((((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["x_in"])) THEN (move ["f_eq"]))); + ((fun arg_tac -> arg_tac (Arg_term (`x IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["x_in1"])))); + (((use_arg_then2 ("card_f", [])) (disch_tac [])) THEN (clear_assumption "card_f") THEN ((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac) THEN (move ["x_not_in"])); + (((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("E_N_F_DEGENERATE_CASE", [E_N_F_DEGENERATE_CASE]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("CARD_SINGLETON", [CARD_SINGLETON]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["vw_in1"])))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FACE_SUBSET_DART1_OF_FAN", [FACE_SUBSET_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("set_of_edge", [set_of_edge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_prime", [e_prime]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)); + ((((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("w", [])) (term_tac exists_tac))) THEN (((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("v_prime", [v_prime]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN", [PAIR_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`SND (f_fan_pair (V,E) (v,w))`))) (term_tac exists_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`w, SND (f_fan_pair (V,E) (v,w)) = face_map (hypermap_of_fan (V,E)) (v,w)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + (in_tac ["vw_in_f"] false (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("POWER_1", [POWER_1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (fun fst_arg -> (use_arg_then2 ("vw_in_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lemma_in_face", [lemma_in_face]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma localization_dart1_subset *) +let localization_dart1_subset = Sections.section_proof ["f";"d"] +`d IN dart1_of_fan (v_prime V f, e_prime E f) ==> d IN dart1_of_fan (V,E)` +[ + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((fun arg_tac -> arg_tac (Arg_term (`{v,w}`))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((use_arg_then2 ("Wrgcvdr_cizmrrh.E_PRIME_SUBSET_E", [Wrgcvdr_cizmrrh.E_PRIME_SUBSET_E])) (thm_tac apply_tac)); +];; + +(* Lemma localization_node_subset *) +let localization_node_subset = Sections.section_proof ["f";"d"] +`f IN face_set (hypermap_of_fan (V,E)) + ==> node (hypermap_of_fan (v_prime V f, e_prime E f)) d + SUBSET node (hypermap_of_fan (V,E)) d` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["x"]))) THEN ((((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["x_in"])) THEN (move ["f_eq"]))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Wrgcvdr_cizmrrh.IMP_FAN_V_PRIME_E_PRIME))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((THENL_FIRST) (((((use_arg_then2 ("hypermap_HYP_elim", [hypermap_HYP_elim]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (ANTS_TAC)) (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac))); + (BETA_TAC THEN (move ["fan'"])); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`d IN dart1_of_fan (V,E)`))) (disch_eq_tac "d_in1" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("E_N_F_DEGENERATE_CASE", [E_N_F_DEGENERATE_CASE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SUBSET_REFL", [SUBSET_REFL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fan'", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("d_in1", [])) (disch_tac [])) THEN (clear_assumption "d_in1") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("localization_dart1_subset", [localization_dart1_subset])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); + (((use_arg_then2 ("d_in1", [])) (disch_tac [])) THEN (clear_assumption "d_in1") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in1"])); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart1_of_fan (v_prime V f, e_prime E f)`))) (disch_eq_tac "vw_in1'" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + (((((use_arg_then2 ("E_N_F_DEGENERATE_CASE", [E_N_F_DEGENERATE_CASE]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SING_SUBSET", [SING_SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("node_refl", [node_refl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then2 ("NODE_HYPERMAP_OF_FAN_ALT", [NODE_HYPERMAP_OF_FAN_ALT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["a"]) THEN (move ["b"])))); + (((repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["u"])) THEN (case THEN (move ["u_in"])) THEN (move ["eqs"])); + (((use_arg_then2 ("u", [])) (term_tac exists_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + ((((fun arg_tac -> (use_arg_then2 ("IN_TRANS", [IN_TRANS])) (fun fst_arg -> (use_arg_then2 ("u_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("localization_set_of_edge_subset", [localization_set_of_edge_subset]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma f_fan_pair_ext_in_dart1 *) +let f_fan_pair_ext_in_dart1 = Sections.section_proof ["d"] +`d IN dart1_of_fan (V,E) ==> + f_fan_pair_ext (V,E) d IN dart1_of_fan (V,E)` +[ + ((BETA_TAC THEN (move ["d_in"])) THEN ((((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("E_N_F_IN_DART1_OF_FAN", [E_N_F_IN_DART1_OF_FAN]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma localization_simple_hypermap *) +let localization_simple_hypermap = Sections.section_proof ["f"] +`f IN face_set (hypermap_of_fan (V,E)) + /\ 2 <= CARD f + /\ simple_hypermap (hypermap_of_fan (V,E)) + ==> simple_hypermap (hypermap_of_fan (v_prime V f, e_prime E f))` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("simple_hypermap", [simple_hypermap]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["f_in"])) THEN (case THEN (move ["card_f"])) THEN (move ["simpleH"])); + ((((use_arg_then2 ("f_in", [])) (disch_tac [])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (case THEN ((move ["v"]) THEN (move ["w"]))))) THEN ((((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["f_eq"]))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Lvducxu.LVDUCXU))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IMP_FAN_V_PRIME_E_PRIME))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((THENL_FIRST) (((((use_arg_then2 ("hypermap_HYP_elim", [hypermap_HYP_elim]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (ANTS_TAC)) (((fun arg_tac -> arg_tac (Arg_term (`v,w`))) (term_tac exists_tac)) THEN (done_tac))); + (BETA_TAC THEN (move ["fan'"])); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH'"]) THEN (move ["_"]))))); + (((((use_arg_then2 ("hypermap_HYP_elim", [hypermap_HYP_elim]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("darts_of_hyp_elim", [darts_of_hyp_elim]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))); + ((THENL_FIRST) (ANTS_TAC) ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (BETA_TAC THEN (case THEN (move ["ff_eq"])) THEN (move ["_"])); + ((((use_arg_then2 ("dartH'", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["a"]) THEN (move ["b"]))) THEN (move ["ab_in"])); + ((((use_arg_then2 ("ab_in", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("localization_dart_eq_dart1", [localization_dart_eq_dart1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["ab_in1"]))); + ((THENL_ROT (-1)) ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["x"]) THEN (move ["y"])))) THEN (split_tac))); + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("node_refl", [node_refl]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("face_refl", [face_refl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["xy_in_n"])) THEN (move ["xy_in_f"])); + ((fun arg_tac -> arg_tac (Arg_term (`d IN f ==> d IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac ["d"](move ["in_f_in_dart"])))); + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FACE_SUBSET_DART_OF_FAN", [FACE_SUBSET_DART_OF_FAN]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`d IN dart_of_fan (v_prime V f, e_prime E f) ==> d IN f \/ SND d, FST d IN f`))) (term_tac (have_gen_tac ["d"](move ["dart_or"])))); + (((((use_arg_then2 ("localization_dart_eq_dart1", [localization_dart_eq_dart1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["u"]) THEN (move ["z"]))); + ((((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("e_prime", [e_prime]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((BETA_TAC THEN (case THEN (move ["x'"])) THEN (case THEN (move ["y'"])) THEN (case THEN (move ["xy'_in"]))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Geomdetail.PAIR_EQ_EXPAND)))(thm_tac (new_rewrite [] []))))); + ((case THEN ALL_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac)); + (((fun arg_tac -> (use_arg_then2 ("dart_or", [])) (fun fst_arg -> (use_arg_then2 ("ab_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (simp_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`a,b IN f`))) (disch_eq_tac "ab_in_f" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((fun arg_tac -> (use_arg_then2 ("simpleH", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("in_f_in_dart", [])) (fun fst_arg -> (use_arg_then2 ("ab_in_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`v,w`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ff_eq", []))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`v,w`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`a,b`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ff_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("xy_in_f", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("IN_TRANS", [IN_TRANS])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("localization_node_subset", [localization_node_subset])) (fun fst_arg -> (use_arg_then2 ("f_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`a,b`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (BETA_TAC THEN (move ["ba_in_f"])); + ((fun arg_tac -> arg_tac (Arg_term (`x = a`))) (term_tac (have_gen_tac [](move ["x_eq_a"])))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fst_node_hypermap_of_fan", [fst_node_hypermap_of_fan])) (fun fst_arg -> (use_arg_then2 ("fan'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("xy_in_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (done_tac)); + ((in_tac ["xy_in_f"] true ((((use_arg_then2 ("x_eq_a", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("x_eq_a", [])) (disch_tac [])) THEN (clear_assumption "x_eq_a") THEN ((use_arg_then2 ("xy_in_n", [])) (disch_tac [])) THEN (clear_assumption "xy_in_n") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]) THEN (simp_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`a,y IN dart_of_fan (v_prime V f,e_prime E f)`))) (term_tac (have_gen_tac [](move ["ay_in'"])))); + (((((fun arg_tac -> (use_arg_then2 ("IN_TRANS", [IN_TRANS])) (fun fst_arg -> (use_arg_then2 ("xy_in_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FACE_SUBSET_DART_OF_FAN", [FACE_SUBSET_DART_OF_FAN]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`y,a IN f`))) (term_tac (have_gen_tac [](move ["ya_in_f"])))); + (((use_arg_then2 ("ay_in'", [])) (disch_tac [])) THEN (clear_assumption "ay_in'") THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("dart_or", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN case THEN (simp_tac) THEN (move ["ay_in_f2"])); + (((use_arg_then2 ("xy_in_f", [])) (disch_tac [])) THEN (clear_assumption "xy_in_f") THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`v,w`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`a,y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ff_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["eq1"])); + ((((use_arg_then2 ("ab_in_f", [])) (disch_tac [])) THEN (clear_assumption "ab_in_f") THEN BETA_TAC) THEN ((((use_arg_then2 ("ff_eq", []))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_different_faces", [lemma_different_faces])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN ((((use_arg_then2 ("eq1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ff_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`f_fan_pair_ext (V,E) (y,a) = f_fan_pair_ext (V,E) (b,a)`))) (term_tac (have_gen_tac []ALL_TAC)))); + (((((fun arg_tac -> (use_arg_then2 ("PERMUTES_INJECTIVE", [PERMUTES_INJECTIVE])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN", [F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`_1 _2 (y,a)`))) (term_tac (set_tac "d1"))); + ((fun arg_tac -> arg_tac (Arg_term (`_1 _2 (b,a)`))) (term_tac (set_tac "d2"))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`{d1} = {d2}`))) (term_tac (have_gen_tac []ALL_TAC)))) ((((use_arg_then2 ("SING_EQ", [SING_EQ]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["_"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (move ["fH"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`y,a IN dart1_of_fan (V,E) /\ b,a IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](case THEN ((move ["ya_in1"]) THEN (move ["ba_in1"])))))); + ((split_tac) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("ay_in'", [])) (disch_tac [])) THEN (clear_assumption "ay_in'") THEN BETA_TAC) THEN (((((use_arg_then2 ("localization_dart_eq_dart1", [localization_dart_eq_dart1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("localization_dart1_subset", [localization_dart1_subset])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("ab_in1", [])) (disch_tac [])) THEN (clear_assumption "ab_in1") THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("localization_dart1_subset", [localization_dart1_subset])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`d1 IN dart1_of_fan (V,E) /\ d2 IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](case THEN ((move ["d1_in1"]) THEN (move ["d2_in1"])))))); + (((((use_arg_then2 ("d1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("f_fan_pair_ext_in_dart1", [f_fan_pair_ext_in_dart1]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`d1 IN dart_of_fan (V,E) /\ d2 IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](case THEN ((move ["d1_in"]) THEN (move ["d2_in"])))))); + (((((use_arg_then2 ("dart_of_fan_eq", [dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d1_in1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d2_in1", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((fun arg_tac -> (use_arg_then2 ("simpleH", [])) (fun fst_arg -> (use_arg_then2 ("d1_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("simpleH", [])) (fun fst_arg -> (use_arg_then2 ("d2_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (congr_tac (`_1 INTER _2`))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("HYPERMAP_OF_FAN_NODE_EQ", [HYPERMAP_OF_FAN_NODE_EQ])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d1_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d2_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((((use_arg_then2 ("d1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("f_fan_pair_ext", [f_fan_pair_ext]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ya_in1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ba_in1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("f_fan_pair", [f_fan_pair]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("d1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("fH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("face_face_map_eq", [face_face_map_eq]))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`v,w`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y,a`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`v,w`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`b,a`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section Fan *) +let card_set_of_edge_gt1_imp_in_dart1 = Sections.finalize_theorem card_set_of_edge_gt1_imp_in_dart1;; +let azim_in_fan_eq_azim_dart = Sections.finalize_theorem azim_in_fan_eq_azim_dart;; +let wedge_in_fan_gt_eq_w_dart_fan = Sections.finalize_theorem wedge_in_fan_gt_eq_w_dart_fan;; +let localization_dart_eq_dart1 = Sections.finalize_theorem localization_dart_eq_dart1;; +let localization_dart1_subset = Sections.finalize_theorem localization_dart1_subset;; +let localization_node_subset = Sections.finalize_theorem localization_node_subset;; +let f_fan_pair_ext_in_dart1 = Sections.finalize_theorem f_fan_pair_ext_in_dart1;; +let localization_simple_hypermap = Sections.finalize_theorem localization_simple_hypermap;; +Sections.end_section "Fan";; + +(* Section FullySurrounded *) +Sections.begin_section "FullySurrounded";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_hyp "fanV" (`FAN (vec 0,V,E)`));; +(Sections.add_section_hyp "f_surr" (`fully_surrounded (V,E)`));; + +(* Let dartH *) +Sections.add_section_lemma "dartH" (Sections.section_proof [] +`dart (hypermap_of_fan (V,E)) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let dart1_eq *) +Sections.add_section_lemma "dart1_eq" (Sections.section_proof [] +`dart1_of_fan (V,E) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Lemma fully_surrounded_simple_hypermap *) +let fully_surrounded_simple_hypermap = Sections.section_proof [] +`simple_hypermap (hypermap_of_fan (V,E))` +[ + ((fun arg_tac -> (use_arg_then2 ("Hypermap_iso.fan_hypermaps_iso", [Hypermap_iso.fan_hypermaps_iso])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["iso"]))); + ((((fun arg_tac -> (use_arg_then2 ("Hypermap_iso.iso_simple", [Hypermap_iso.iso_simple])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Conforming.SRPRNPL", [Conforming.SRPRNPL]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("fully_surrounded_imp_conforming", [fully_surrounded_imp_conforming]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma f_surr_localization *) +let f_surr_localization = Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) + ==> let f = face (hypermap_of_fan (V,E)) d in + local_fan (v_prime V f,e_prime E f,f) + /\ face (hypermap_of_fan (v_prime V f, e_prime E f)) d = f + /\ (!x. x IN f ==> azim_dart (V,E) x = azim_dart (v_prime V f, e_prime E f) x) + /\ (!x. x IN f ==> wedge_in_fan_gt x E = wedge_in_fan_gt x (e_prime E f)) + /\ (!x. x IN f ==> wedge_in_fan_ge x E = wedge_in_fan_ge x (e_prime E f))` +[ + ((((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"])) THEN (CONV_TAC let_CONV)); + ((fun arg_tac -> arg_tac (Arg_term (`face _1 _2`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Lvducxu.LVDUCXU))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IMP_FAN_V_PRIME_E_PRIME))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("darts_of_hyp_elim", [darts_of_hyp_elim]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("hypermap_HYP_elim", [hypermap_HYP_elim]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (ANTS_TAC) (((fun arg_tac -> arg_tac (Arg_term (`v,w`))) (term_tac exists_tac)) THEN (done_tac))); + ((BETA_TAC THEN (move ["fan'"]) THEN ((fun arg_tac -> (fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("hypermap_HYP_elim", [hypermap_HYP_elim]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((ANTS_TAC) THEN ((TRY done_tac)) THEN (case THEN (move ["f_eq"])) THEN (case THEN (move ["in_f_eq"])))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH'"]) THEN (move ["_"]))))); + (ANTS_TAC); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FULLY_SURROUNDED_IMP_CARD_FACE_GE_3", [FULLY_SURROUNDED_IMP_CARD_FACE_GE_3])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["card_ge3"]))); + ((THENL_FIRST) (split_tac) ((((use_arg_then2 ("card_ge3", [])) (disch_tac [])) THEN (clear_assumption "card_ge3") THEN BETA_TAC) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("localization_simple_hypermap", [localization_simple_hypermap]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fanV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fully_surrounded_simple_hypermap", [fully_surrounded_simple_hypermap]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_ge3", [])) (disch_tac [])) THEN (clear_assumption "card_ge3") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + ((repeat_tactic 1 9 ((split_tac))) THEN (BETA_TAC THEN (move ["d"]) THEN (move ["d_in_f"])) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("in_f_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((fun arg_tac -> arg_tac (Arg_term (`d IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["d_in"])))); + (((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("in_face_imp_in_dart", [in_face_imp_in_dart])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`v,w`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`d IN dart_of_fan (v_prime V f, e_prime E f)`))) (term_tac (have_gen_tac [](move ["d_in'"]))))); + (((((fun arg_tac -> (use_arg_then2 ("azim_in_fan_eq_azim_dart", [azim_in_fan_eq_azim_dart])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("azim_in_fan_eq_azim_dart", [azim_in_fan_eq_azim_dart])) (fun fst_arg -> (use_arg_then2 ("fan'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("in_f_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("dart_of_fan_eq", [dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (DISJ1_TAC)); + (((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN ((use_arg_then2 ("d_in_f", [])) (disch_tac [])) THEN (clear_assumption "d_in_f") THEN ((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["a"]) THEN (move ["b"]) THEN (move ["ab_in_f"]) THEN (move ["ab_in"])); + ((((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("e_prime", [e_prime]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("a", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("b", [])) (term_tac exists_tac))) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("E", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma f_surr_localization_convex_local *) +let f_surr_localization_convex_local = Sections.section_proof ["d"] +`d IN dart_of_fan (V,E) + ==> let f = face (hypermap_of_fan (V,E)) d in + convex_local_fan (v_prime V f,e_prime E f,f)` +[ + ((((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"])) THEN (CONV_TAC let_CONV)); + ((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_surr_localization))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["local"]) THEN (case THEN (move ["f_eq"])) THEN (case THEN (move ["azim_eq"])) THEN (move ["wedge_eq"]))))); + ((((use_arg_then2 ("convex_local_fan", [convex_local_fan]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE f_surr_localization))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`face _1 _2`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL IMP_FAN_V_PRIME_E_PRIME))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((THENL_FIRST) (((((use_arg_then2 ("hypermap_HYP_elim", [hypermap_HYP_elim]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (ANTS_TAC)) (((fun arg_tac -> arg_tac (Arg_term (`v,w`))) (term_tac exists_tac)) THEN (done_tac))); + (BETA_TAC THEN (move ["fan'"]) THEN (case THEN ((move ["a"]) THEN (move ["b"]))) THEN (move ["ab_in_f"])); + ((fun arg_tac -> arg_tac (Arg_term (`a,b IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["ab_in"])))); + (((((fun arg_tac -> (use_arg_then2 ("IN_TRANS", [IN_TRANS])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FACE_SUBSET_DART_OF_FAN", [FACE_SUBSET_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart_of_fan (v_prime V f, e_prime E f)`))) (term_tac (have_gen_tac [](move ["vw_in'"])))); + (((((use_arg_then2 ("dart_of_fan_eq", [dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (DISJ1_TAC)); + ((((use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("e_prime", [e_prime]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("w", [])) (term_tac exists_tac))) THEN ((((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("face_refl", [face_refl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`a,b IN dart_of_fan (v_prime V f, e_prime E f)`))) (term_tac (have_gen_tac [](move ["ab_in'"])))); + (((((fun arg_tac -> (use_arg_then2 ("IN_TRANS", [IN_TRANS])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FACE_SUBSET_DART_OF_FAN", [FACE_SUBSET_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("azim_in_fan_eq_azim_dart", [azim_in_fan_eq_azim_dart])) (fun fst_arg -> (use_arg_then2 ("fan'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("azim_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((THENL_FIRST) (split_tac) ((((use_arg_then2 ("f_surr", [])) (disch_tac [])) THEN (clear_assumption "f_surr") THEN BETA_TAC) THEN ((((use_arg_then2 ("fully_surrounded", [fully_surrounded]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("ab_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac))); + (((((use_arg_then2 ("wedge_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("v_prime", [v_prime]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN (move ["x_inV"])) THEN (case THEN (move ["y"])) THEN (move ["xy_in_f"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`a,b IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["ab_in1"])))) ((((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`closure (wedge_in_fan_gt (a,b) E)`))) (term_tac exists_tac)) THEN (split_tac)); + ((((use_arg_then2 ("wedge_in_fan_gt", [wedge_in_fan_gt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("wedge_in_fan_ge", [wedge_in_fan_ge]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("EE_elim", [EE_elim])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("fully_surrounded_card_set_of_edge1", [fully_surrounded_card_set_of_edge1]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("ab_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))); + ((((use_arg_then2 ("CLOSURE_MINIMAL_EQ", [CLOSURE_MINIMAL_EQ]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("Leaf_cell.WEDGE_SUBSET_WEDGE_GE", [Leaf_cell.WEDGE_SUBSET_WEDGE_GE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("AZIM_CYCLE_EQ_SIGMA_FAN_ALT", [AZIM_CYCLE_EQ_SIGMA_FAN_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN", [PAIR_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("ab_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("Leaf_cell.CLOSED_WEDGE", [Leaf_cell.CLOSED_WEDGE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DART1_NOT_COLLINEAR_2", [DART1_NOT_COLLINEAR_2])) (fun fst_arg -> (use_arg_then2 ("ab_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("wedge_in_fan_gt_eq_w_dart_fan", [wedge_in_fan_gt_eq_w_dart_fan])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_imp_conforming", [fully_surrounded_imp_conforming])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["confV"]))); + (((fun arg_tac -> (use_arg_then2 ("fan_hypermaps_iso_explicit2", [fan_hypermaps_iso_explicit2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((fun arg_tac -> arg_tac (Arg_term (`ext_dart _`))) (term_tac (set_tac "h")))); + (BETA_TAC THEN (move ["h_iso"])); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Conforming.DARTSET_LEADS_INTO_SUBSET_WDART_FAN", [Conforming.DARTSET_LEADS_INTO_SUBSET_WDART_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("confV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`IMAGE h f`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`h (a,b)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (ANTS_TAC); + ((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("iso_components", [iso_components])) (fun fst_arg -> (use_arg_then2 ("h_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("h_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> (use_arg_then2 ("iso_components", [iso_components])) (fun fst_arg -> (use_arg_then2 ("h_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`a,b`))) (term_tac exists_tac)) THEN (done_tac)); + ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("SUBSET_CLOSURE", [SUBSET_CLOSURE])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E x y`))) (term_tac (set_tac "y'"))); + ((fun arg_tac -> arg_tac (Arg_term (`x,y IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["xy_in"])))); + (((((fun arg_tac -> (use_arg_then2 ("IN_TRANS", [IN_TRANS])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FACE_SUBSET_DART_OF_FAN", [FACE_SUBSET_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`closure (aff_gt {vec 0} {x,y})`))) (term_tac exists_tac))); + ((((use_arg_then2 ("Planarity.POINT_IN_CLOSURE_AFF_GT_1_2", [Planarity.POINT_IN_CLOSURE_AFF_GT_1_2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("xy_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["xyV"]))); + ((((use_arg_then2 ("fanV", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("FAN", [FAN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fan2", [fan2]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["n0V"])) THEN (move ["_"]))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ", [PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); + ((split_tac) THEN (((use_arg_then2 ("n0V", [])) (disch_tac [])) THEN (clear_assumption "n0V") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("CLOSURE_MINIMAL_EQ", [CLOSURE_MINIMAL_EQ]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("CLOSED_CLOSURE", [CLOSED_CLOSURE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Cfyxfty.AFF_GT_SUBSET_CLOSURE_DARTSET_LEADS_INTO_FAN))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`h (x,y)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`IMAGE h f`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((THENL_ROT (-1)) (ANTS_TAC)); + (((((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ext_dart", [ext_dart]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Fan.pr2", [Fan.pr2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Fan.pr3", [Fan.pr3]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("fully_surrounded_imp_fan80", [fully_surrounded_imp_fan80]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("iso_components", [iso_components])) (fun fst_arg -> (use_arg_then2 ("h_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("h_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac)); + ((BETA_TAC THEN (move ["z"]) THEN (move ["zV"])) THEN (((use_arg_then2 ("fully_surrounded_card_set_of_edge1", [fully_surrounded_card_set_of_edge1]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((fun arg_tac -> (use_arg_then2 ("iso_components", [iso_components])) (fun fst_arg -> (use_arg_then2 ("h_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`x,y`))) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Finalization of the section FullySurrounded *) +let fully_surrounded_simple_hypermap = Sections.finalize_theorem fully_surrounded_simple_hypermap;; +let f_surr_localization = Sections.finalize_theorem f_surr_localization;; +let f_surr_localization_convex_local = Sections.finalize_theorem f_surr_localization_convex_local;; +Sections.end_section "FullySurrounded";; +let RNSYJXM = REWRITE_RULE[IMP_IMP] f_surr_localization_convex_local;; + +(* Close the module *) +end;; diff --git a/text_formalization/local/RRCWNSJ.hl b/text_formalization/local/RRCWNSJ.hl new file mode 100644 index 0000000..cbf8914 --- /dev/null +++ b/text_formalization/local/RRCWNSJ.hl @@ -0,0 +1,878 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Rrcwnsj = struct + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +open Yxionxl2;; +open Eyypqdw;; +open Ocbicby;; +open Imjxphr;; + +open Nuxcoea;; +open Fektyiy;; + + + +let BB_VV_FUN_EQ=prove(`is_scs_v39 s /\ BBs_v39 s vv + ==> (!i j. vv i = vv j <=> i MOD (scs_k_v39 s) = j MOD (scs_k_v39 s))`, +REPEAT RESA_TAC +THEN EQ_TAC +THENL[ +MRESA_TAC W_IN_BB_FUN_EQ[`vv`;`i`;`j`;`s`]; +MRESA_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`i`;`vv`;`j`]]);; + +let WL_IN_E=prove(`{(w:num->real^3) l,w (SUC l)} IN IMAGE (\i. {w i,w (SUC i)}) (:num)`, +REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`l:num` +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]);; + + + +let LUNAR_IN_V=prove(`lunar (v,w) V E==> v IN V/\ w IN V`, +REWRITE_TAC[lunar] +THEN SET_TAC[]);; + + + +let B_LE_2h0_A_EQ2_IN_CASES_6=prove( +`scs_k_v39 s=6 /\ is_scs_v39 s +==> !i. scs_b_v39 s i (SUC i)<= &2 *h0/\ scs_a_v39 s i (SUC i)= &2 `, +STRIP_TAC +THEN POP_ASSUM (fun th-> MP_TAC th +THEN ASSUME_TAC th) +THEN REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF;] +THEN RESA_TAC +THEN GEN_TAC +THEN DICH_TAC (0) +THEN REWRITE_TAC[ARITH_RULE`a+b<=b <=> a= 0`] +THEN SUBGOAL_THEN`FINITE + {i | i < 6 /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}` ASSUME_TAC +THENL[ + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..6` +THEN ASM_REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + +MRESA_TAC CARD_EQ_0[`{i | i < 6 /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}`] +THEN REWRITE_TAC[SET_RULE`A={}<=> !x. ~(x IN A)`;IN_ELIM_THM] +THEN MRESAL_TAC DIVISION[`i`;`6`][ARITH_RULE`~(6=0)`] +THEN STRIP_TAC +THEN THAYTHEL_TAC 0[`i MOD 6`][DE_MORGAN_THM;REAL_ARITH`~(a b<=a`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`i:num`;`SUC(i MOD 6) MOD 6:num`;`s:scs_v39`;`i MOD 6:num`;`SUC(i MOD 6):num`][MOD_REFL;ARITH_RULE`~(6=0)`] +THEN SYM_ASSUM_TAC +THEN ASM_SIMP_TAC[Hypermap.lemma_suc_mod;ARITH_RULE`~(6=0)`] +THEN MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`i:num`;`SUC i MOD 6:num`;`s:scs_v39`;`i:num`;`SUC i:num`][MOD_REFL;ARITH_RULE`~(6=0)`] +THEN THAYTHES_TAC (26-17)[`i MOD 6`;`SUC i MOD 6`][DIVISION;Hypermap.lemma_suc_mod;ARITH_RULE`~(6=0)/\ 1<6`;Qknvmlb.SUC_MOD_NOT_EQ] +THEN DICH_TAC 0 +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`i:num`;`SUC(i MOD 6) MOD 6:num`;`s:scs_v39`;`i MOD 6:num`;`SUC(i MOD 6):num`][MOD_REFL;ARITH_RULE`~(6=0)`] +THEN SYM_ASSUM_TAC +THEN ASM_SIMP_TAC[Hypermap.lemma_suc_mod;ARITH_RULE`~(6=0)`] +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`i:num`;`SUC i MOD 6:num`;`s:scs_v39`;`i:num`;`SUC i:num`][MOD_REFL;ARITH_RULE`~(6=0)/\ 1<6`;Qknvmlb.SUC_MOD_NOT_EQ] +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`i MOD 6:num`;`SUC i MOD 6:num`;`s:scs_v39`;`i:num`;`SUC i:num`][MOD_REFL;ARITH_RULE`~(6=0)`] +THEN REAL_ARITH_TAC]);; + + + +let J_EMPY_CASES_6=prove(`scs_k_v39 s=6 /\ is_scs_v39 s +==> scs_J_v39 s i= {}`, +STRIP_TAC +THEN MP_TAC(SET_RULE`(?x. scs_J_v39 s i x) \/ (scs_J_v39 s i= {})`) +THEN RESA_TAC +THEN MP_TAC B_LE_2h0_A_EQ2_IN_CASES_6 +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC +THEN THAYTHEL_ASM_TAC(22-19)[`i`;`x`][] +THEN THAYTHEL_ASM_TAC (24-18)[`i`;`x`][] +THENL[ + +DICH_TAC (25-18) +THEN RESA_TAC +THEN DICH_TAC 4 +THEN MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`i`;`x`;`s`;`i`;`SUC i`][is_scs_v39] +THEN THAYTHE_TAC (25-19)[`i`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN SYM_ASSUM_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +DICH_TAC (25-18) +THEN RESA_TAC +THEN DICH_TAC 4 +THEN MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`i`;`x`;`s`;`SUC x`;`x`][is_scs_v39] +THEN THAYTHE_TAC (25-19)[`x`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN SYM_ASSUM_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC]);; + + +let BB_RHO_NODE_IVS=prove(`scs_k_v39 s = k /\ + vv p1 = u /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF /\ + is_scs_v39 s /\ + 3 rho_node1 FF u = vv (p1+1) /\ ivs_rho_node1 FF u = vv (p1+k-1)`, +STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k<=3)`) +THEN RESA_TAC +THEN MP_TAC Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME +THEN RESA_TAC +THEN THAYTHEL_ASM_TAC 0[`SUC 0`][ITER;I_DEF;ARITH_RULE`SUC 0+a= a+1`] +THEN THAYTHEL_ASM_TAC 0[`k-1`][ITER;I_DEF;ARITH_RULE`SUC 0+a= a+1`] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`k:num`;`s`;`vv`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MRESA_TAC WL_IN_V[`p1`;`vv`] +THEN MP_TAC Odxlstcv2.CARD_V_EQ_SCS_K1 +THEN RESA_TAC +THEN MP_TAC Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1 +THEN RESA_TAC +THEN THAYTHES_TAC 0[`vv p1`][WL_IN_V;ARITH_RULE`k-1+a=a+k-1`]);; + + + +let BB_F_SUC_PRE=prove(`is_scs_v39 s /\ BBs_v39 s f ==> f (SUC (i + (scs_k_v39 s) - 1)) = f i`, +STRIP_TAC +THEN MATCH_MP_TAC Oxlzlez.F_SUC_PRE +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;BBs_v39;is_scs_v39] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DICH_TAC (23-1) +THEN ARITH_TAC);; + + +let RRCWNSJ_concl = ` +main_nonlinear_terminal_v11 +==>(!s (v:num->real^3). + is_scs_v39 s /\ scs_basic_v39 s /\ MMs_v39 s v/\ + 3< scs_k_v39 s /\ + (!i j. scs_diag (scs_k_v39 s) i j ==> &4 * h0 < scs_b_v39 s i j) /\ + (!i j. scs_diag (scs_k_v39 s) i j ==> (scs_a_v39 s i j <= cstab /\ cstab < dist(v i, v j))) /\ + (!i. scs_b_v39 s i (SUC i) <= cstab) ==> + scs_generic v)`;; + + + + +let RRCWNSJ = prove_by_refinement( + RRCWNSJ_concl, +[ +STRIP_TAC +THEN REPEAT GEN_TAC +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN ABBREV_TAC`V= IMAGE (v:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((v:num->real^3) i, v (SUC i))) (:num)` +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MMS_IMP_BBPRIME[`s`;`v`][LET_DEF;LET_END_DEF;BBprime_v39] +THEN MRESAL_TAC JKQEWGV2[`s`;`v`][LET_DEF;LET_END_DEF;scs_generic] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`k:num`;`s`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MP_TAC Wrgcvdr_cizmrrh.CIZMRRH +THEN RESA_TAC +THEN MRESA_TAC LUNAR_IN_V[`E`;`v'`;`w`;`V`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC "V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN DICH_TAC 5 +THEN RESA_TAC +THEN MRESA_TAC Axjrpnc.AXJRPNC[`s`;`v`;`x`;`x'`] +THEN DICH_TAC 1 +THEN STRIP_TAC +THEN POP_ASSUM(fun th->ASSUME_TAC (SYM th)) +THEN MP_TAC B_LE_2h0_A_EQ2_IN_CASES_6 +THEN RESA_TAC +THEN MRESA_TAC Axjrpnc.DIST_EDGE_IN_BB_LE_2[`s`;`v`] +THEN THAYTHEL_ASM_TAC 0[`x`][] +THEN THAYTHE_TAC 0[`SUC x`] +THEN SUBGOAL_THEN`norm((v:num->real^3) (SUC x))= &2 \/ norm (v x- v (SUC x))= &2` ASSUME_TAC; + +MP_TAC(REAL_ARITH`&2 <= norm (v x - v (SUC x)) +/\ &2 <= norm (v (SUC x) - v (SUC (SUC x))) +==> (&2 < norm (v x - v (SUC x)) +/\ &2 < norm (v (SUC x) - v (SUC (SUC x))))\/ norm (v x - v (SUC x))= &2 +\/ (norm ((v:num->real^3) (SUC x) - v (SUC (SUC x)))= &2) `) +THEN RESA_TAC; + +SUBGOAL_THEN`!i. ~(i MOD k = (SUC x) MOD k) ==> scs_a_v39 s (SUC x) i < dist (v (SUC x),(v:num->real^3) i)`ASSUME_TAC +; + + +REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`i MOD k= x MOD k\/ ~(i MOD k= x MOD k)`) +THEN RESA_TAC; + + +MRESA_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`i`;`v:num->real^3`;`x:num`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[dist] +THEN THAYTHE_TAC (33-26)[`x`] +THEN DICH_TAC (34-28) +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`SUC x`;`i `;`s:scs_v39`;`SUC x`;`x`][is_scs_v39] +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF] +THEN REPEAT RESA_TAC; + + + +MP_TAC(SET_RULE`i MOD k= SUC (SUC x) MOD k\/ ~(i MOD k= SUC (SUC x) MOD k)`) +THEN RESA_TAC; + + + +MRESA_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`i`;`v:num->real^3`;`SUC(SUC x):num`] +THEN THAYTHEL_TAC (34-26)[`SUC(x)`][dist] +THEN DICH_TAC (35-29) +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`SUC x`;`i`;`s:scs_v39`;`SUC x`;`SUC(SUC x)`][is_scs_v39] +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF] +THEN REPEAT RESA_TAC; + + + +MP_TAC(ARITH_RULE`~(6=0)`) +THEN RESA_TAC +THEN THAYTHES_TAC (34-9)[`i`;`SUC x`][scs_diag;ADD1;ARITH_RULE`~(6=0)/\ i+1=1+i`;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DICH_TAC 0 +THEN REAL_ARITH_TAC; + + +MRESA_TAC J_EMPY_CASES_6[`s`;`SUC x`] +THEN DICH_TAC 0 +THEN REWRITE_TAC[SET_RULE`(a = {})<=> !i. ~ (a i)`] +THEN STRIP_TAC +THEN MRESAL_TAC ODXLSTCv2[`s`;`k`;`v`;`SUC x`][DE_MORGAN_THM;] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`!V' E' v1. V' = V /\ E' = E ==> ~lunar (v1,(v:num->real^3) (SUC x)) V' E'` +ASSUME_TAC +; + + +REPEAT RESA_TAC +THEN DICH_TAC (35-23) +THEN RESA_TAC +THEN MRESA_TAC Local_lemmas.HKIRPEP[`E`;`w`;`FF`;`v'`;`V`] +THEN REPLICATE_TAC (49-36) (REMOVE_ASSUM_TAC) +THEN MRESA_TAC WL_IN_V[`SUC x`;`v:num->real^3`] +THEN MP_TAC(ARITH_RULE`1<6/\ 2<6/\ ~(6=0)/\ ~(1 MOD 6= 3 MOD 6)`) +THEN RESA_TAC +THEN THAYTHES_TAC 5[`(v:num->real^3) (SUC x)`][DIFF;IN_ELIM_THM;SET_RULE`a IN {b,c} <=> a= b\/ a=c`;BB_VV_FUN_EQ;DE_MORGAN_THM;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[ADD1;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN MRESAS_TAC Jkqewgv.JKQEWGV3[`s`;`v`;`v (SUC x)`;`v1`][LET_DEF;LET_END_DEF;] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[Local_lemmas.LUNAR_COMM] +THEN ASM_REWRITE_TAC[ADD1] +THEN MP_TAC PI_WORKS +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[] +; + + +MP_TAC(REAL_ARITH`norm (v (SUC x)) = &2 \/ ~(norm ((v:num->real^3) (SUC x)) = &2)`) +THEN RESA_TAC +THEN MRESA_TAC J_EMPY_CASES_6[`s`;`SUC x`] +THEN DICH_TAC 0 +THEN REWRITE_TAC[SET_RULE`(a = {})<=> !i. ~ (a i)`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`!V' E' v1. V' = V /\ E' = E ==> ~lunar (v1,(v:num->real^3) (SUC x)) V' E'` +ASSUME_TAC +; + + +REPEAT RESA_TAC +THEN DICH_TAC (34-23) +THEN RESA_TAC +THEN MRESA_TAC Local_lemmas.HKIRPEP[`E`;`w`;`FF`;`v'`;`V`] +THEN REPLICATE_TAC (48-35) (REMOVE_ASSUM_TAC) +THEN MRESA_TAC WL_IN_V[`SUC x`;`v:num->real^3`] +THEN MP_TAC(ARITH_RULE`1<6/\ 2<6/\ ~(6=0)/\ ~(1 MOD 6= 3 MOD 6)`) +THEN RESA_TAC +THEN THAYTHES_TAC 5[`(v:num->real^3) (SUC x)`][DIFF;IN_ELIM_THM;SET_RULE`a IN {b,c} <=> a= b\/ a=c`;BB_VV_FUN_EQ;DE_MORGAN_THM;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[ADD1;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN MRESAS_TAC Jkqewgv.JKQEWGV3[`s`;`v`;`v (SUC x)`;`v1`][LET_DEF;LET_END_DEF;] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[Local_lemmas.LUNAR_COMM] +THEN ASM_REWRITE_TAC[ADD1] +THEN MP_TAC PI_WORKS +THEN REAL_ARITH_TAC; + + +SUBGOAL_THEN`(!i. scs_diag k (SUC x) i + ==> scs_a_v39 s (SUC x) i < dist (v (SUC x),(v:num->real^3) i))`ASSUME_TAC +; + +GEN_TAC +THEN STRIP_TAC +THEN THAYTHE_TAC (33-9)[`SUC x`;`i`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC +; + + + + +SUBGOAL_THEN`azim (vec 0) (v (SUC x)) (v (SUC (SUC x))) ((v:num->real^3) (SUC x + k - 1)) = pi`ASSUME_TAC +; + + +DICH_TAC (33-23) +THEN RESA_TAC +THEN MRESA_TAC Local_lemmas.HKIRPEP[`E`;`w`;`FF`;`v'`;`V`] +THEN REPLICATE_TAC (48-35) (REMOVE_ASSUM_TAC) +THEN MRESA_TAC WL_IN_V[`SUC x`;`v:num->real^3`] +THEN MP_TAC(ARITH_RULE`1<6/\ 2<6/\ ~(6=0)/\ ~(1 MOD 6= 3 MOD 6)`) +THEN RESA_TAC +THEN THAYTHES_TAC 5[`(v:num->real^3) (SUC x)`][DIFF;IN_ELIM_THM;SET_RULE`a IN {b,c} <=> a= b\/ a=c`;BB_VV_FUN_EQ;DE_MORGAN_THM;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[ADD1;Ocbicby.MOD_EQ_MOD_SHIFT;interior_angle1;GSYM ivs_rho_node1] +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v (x+1)`;`v`;`x+1`;`k`]; + + +SUBGOAL_THEN`~collinear {vec 0, (v:num->real^3) (SUC (SUC x)), v (SUC x + k - 1)}` +ASSUME_TAC +; + + +DICH_TAC (34-23) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`1<6/\ 2<6/\ ~(6=0)/\ ~(2 MOD 6= 3 MOD 6)/\ ~(2 MOD 6= 0 MOD 6)`) +THEN RESA_TAC +THEN MRESA_TAC Lunar_deform.LOCAL_CONVEX_NOT_COLLINEAR[`FF`;`E`;`V`;`w`;`v'`] +THEN MRESA_TAC BB_F_SUC_PRE[`s`;`v`;`x`] +THEN ASM_SIMP_TAC[BB_F_SUC_PRE;ARITH_RULE`SUC i+k-1=SUC(i+k-1)`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN MATCH_DICH_TAC 1 +THEN MRESAS_TAC WL_IN_V[`SUC (SUC x)`;`v:num->real^3`][BB_VV_FUN_EQ;ARITH_RULE`SUC (SUC x)=x+2`;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN MP_TAC(SET_RULE`x= x+0==> x MOD k= (x+0) MOD k`) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[ARITH_RULE`x+0=x`] +THEN RESA_TAC +THEN ASM_SIMP_TAC[Ocbicby.MOD_EQ_MOD_SHIFT]; + + + + + +SUBGOAL_THEN`(v:num->real^3) (SUC x) IN aff_gt {vec 0} {v (SUC (SUC x)), v (SUC x + k - 1)}` +ASSUME_TAC; + + +DICH_TAC (35-23) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`1<6/\ 2<6/\ ~(6=0)/\ ~(2 MOD 6= 1 MOD 6)/\ ~(2 MOD 6= 0 MOD 6)/\ ~(6<=3)/\ 3 MOD 6=3`) +THEN RESA_TAC +THEN MRESA_TAC Odxlstcv2.CARD_V_EQ_SCS_K1[`s`;`v`;`V`;`k`] +THEN MRESA_TAC Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME[`V`;`E`;`k`;`s`;`FF`;`v x`;`v`;`x`] +THEN MRESAS_TAC Local_lemmas.LUNAR_IMP_HALF_CIRCLE_SUBSET_AFF_GT[`E`;`V`;`w`;`FF`;`v'`][BB_VV_FUN_EQ] +THEN DICH_TAC 1 +THEN ASM_SIMP_TAC[BB_VV_FUN_EQ;] +THEN ONCE_REWRITE_TAC[ARITH_RULE`i+x=x+i:num`] +THEN REWRITE_TAC[ARITH_RULE`3+x=x+3`] +THEN ASM_SIMP_TAC[Ocbicby.MOD_EQ_MOD_SHIFT;MOD_LT] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN DICH_TAC 1 +THEN MRESAL_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;` FF`;`v x`;`v`;`x`;`k`][ARITH_RULE`0< l/\ l<3<=> l=1\/ l=2`;SET_RULE`{v (l + x) | l = 1 \/ l = 2} = {v (1+x), v(2+x)}`;SET_RULE`{a,b} SUBSET A<=> a IN A/\ b IN A`;ARITH_RULE`2+x=x+2`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`v (x + 2) IN aff_gt {vec 0, v x} {v (x + 1)} +/\ aff_gt {vec 0, v x} {v (x + 1)} SUBSET aff_ge {vec 0, v x} {v (x + 1)} +==> v (x + 2) IN aff_ge {vec 0, (v:num->real^3) x} {v (x + 1)}`) +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN STRIP_TAC +THEN MRESA_TAC BB_F_SUC_PRE[`s`;`v`;`x`] +THEN ASM_SIMP_TAC[BB_F_SUC_PRE;ARITH_RULE`k-1+ SUC i=SUC(i+k-1)`] +THEN DICH_TAC(52-34) +THEN ASM_SIMP_TAC[BB_F_SUC_PRE;ARITH_RULE`SUC i+k-1=SUC(i+k-1)/\ SUC (SUC x)= x+2`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC WL_IN_V[`x`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`x+2`;`v:num->real^3`] +THEN MRESAL_TAC WL_IN_E[`x`;`v:num->real^3`][ADD1] +THEN MRESA_TAC Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2[`E`;`V`;`FF`;`v x`] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN MRESAL_TAC Planarity.decomposition_planar_by_angle_fan[`vec 0:real^3`;`v x`;`v (x+1)`;`v (x+2)`][ADD1] +THEN MRESA_TAC th3[`vec 0:real^3`;`v x`;`v (x+2)`] +THEN MRESAS_TAC Planarity.POINT_IN_AFF_GE_IMP_IN_EDGE[`vec 0:real^3`;`V`;`E`;`v(x)`;`v (x+1)`;`v (x+2)`][SET_RULE`a IN{b,c}<=> a=b\/ a=c`;Ocbicby.MOD_EQ_MOD_SHIFT;BB_VV_FUN_EQ] +; + + +MP_TAC(SET_RULE`x= x+0==> x MOD k= (x+0) MOD k`) +THEN GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o DEPTH_CONV)[ARITH_RULE`x+0=x:num`] +THEN RESA_TAC +THEN DICH_TAC 1 +THEN ASM_SIMP_TAC[Ocbicby.MOD_EQ_MOD_SHIFT] +; + + +MRESAL_TAC IMJXPHRv2[`s`;`k`;`v`;`SUC x`][dist] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC BB_F_SUC_PRE[`s`;`v`;`x`] +THEN ASM_SIMP_TAC[BB_F_SUC_PRE;ARITH_RULE` SUC i+k-1=SUC(i+k-1)`] +THEN MP_TAC(ARITH_RULE`SUC (x + 6 - 1)= 1*6+x/\ ~(6=0)`) +THEN RESA_TAC +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`SUC x:num`;`1*k+x `;`s:scs_v39`;`SUC x:num`;`(1*k+x) MOD k:num`][MOD_REFL;ARITH_RULE`~(6=0)`;MOD_MULT_ADD] +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`SUC x:num`;`x MOD k `;`s:scs_v39`;`SUC x:num`;`x:num`][MOD_REFL;ARITH_RULE`~(6=0)`;MOD_MULT_ADD] +THEN STRIP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN SYM_ASSUM_TAC +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC +; + + +(********CASES 2*****) + + + +SUBGOAL_THEN`norm((v:num->real^3) (x+k-1))= &2 \/ norm (v (x+k-1)- v (x))= &2` ASSUME_TAC; + +REPLICATE_TAC 3 REMOVE_ASSUM_TAC +THEN ASSUME_TAC(ARITH_RULE`(x + k - 1) + k - 1=x + k - 1 + k - 1`) +THEN MRESA_TAC BB_F_SUC_PRE[`s`;`v`;`x`] +THEN MRESAL_TAC BB_F_SUC_PRE[`s`;`v`;`x+k-1`][] +THEN MRESA_TAC Axjrpnc.DIST_EDGE_IN_BB_LE_2[`s`;`v`] +THEN THAYTHEL_ASM_TAC 0[`x+k-1`][] +THEN THAYTHE_TAC 0[`x+ k-1+k-1`] +THEN MP_TAC(REAL_ARITH`&2 <= norm (v (x+k-1) - v (x)) +/\ &2 <= norm (v (x+k-1+k-1) - v (x+k-1)) +==> (&2 < norm (v (x+k-1) - v (x)) +/\ &2 < norm (v (x+k-1+k-1) - v (x+k-1)))\/ norm (v (x+k-1) - v (x))= &2 +\/ (norm ((v:num->real^3) (x+k-1+k-1) - v (x+k-1))= &2) `) +THEN RESA_TAC; + +SUBGOAL_THEN`!i. ~(i MOD k = (x+k-1) MOD k) ==> scs_a_v39 s (x+k-1) i < dist (v (x+k-1),(v:num->real^3) i)`ASSUME_TAC +; + + +REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`i MOD k= x MOD k\/ ~(i MOD k= x MOD k)`) +THEN RESA_TAC; + + +MRESA_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`i`;`v:num->real^3`;`x:num`] +THEN THAYTHE_TAC (36-26)[`x+k-1`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`SUC (x + 6 - 1)= 1*6+x/\ ~(6=0)`) +THEN RESA_TAC +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`x+k-1:num`;`1*k+x `;`s:scs_v39`;` x+k-1:num`;`(1*k+x) MOD k:num`][MOD_REFL;ARITH_RULE`~(6=0)`;MOD_MULT_ADD] +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`x+k-1:num`;`x MOD k `;`s:scs_v39`;` x+k-1:num`;`x:num`][MOD_REFL;ARITH_RULE`~(6=0)`;MOD_MULT_ADD] +THEN MRESAL_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`x+k-1`;`i `;`s:scs_v39`;` x+k-1`;`x`][is_scs_v39;dist] +THEN RESA_TAC +THEN DICH_TAC (42-31) +; + +MP_TAC(SET_RULE`i MOD k= (x+k-1+k-1) MOD k\/ ~(i MOD k= (x+k-1+k-1) MOD k)`) +THEN RESA_TAC; + + + +MRESA_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`i`;`v:num->real^3`;`(x+k-1+k-1):num`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN THAYTHEL_TAC (37-26)[`x+k-1+k-1`][dist] +THEN DICH_TAC 0 +THEN MP_TAC(ARITH_RULE`SUC (x + 6 - 1+ 6 - 1)= 1*6+(x+ 6 - 1)/\ ~(6=0)`) +THEN RESA_TAC +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`x+k-1+k-1:num`;`1*k+(x+k-1) `;`s:scs_v39`;` x+k-1+k-1:num`;`(1*k+(x+k-1)) MOD k:num`][MOD_REFL;ARITH_RULE`~(6=0)`;MOD_MULT_ADD] +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`x+k-1+k-1:num`;`(x+k-1) MOD k `;`s:scs_v39`;` x+k-1+k-1:num`;`x+k-1:num`][MOD_REFL;ARITH_RULE`~(6=0)`;MOD_MULT_ADD] +THEN MRESAL_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`x+k-1`;`i `;`s:scs_v39`;` x+k-1`;`x+k-1+k-1`][is_scs_v39;dist] +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF] +THEN REPEAT RESA_TAC; + + + +MP_TAC(ARITH_RULE`~(6=0)/\ 1+(x + 6- 1)= 1*6+x`) +THEN RESA_TAC +THEN THAYTHES_TAC (38-9)[`i`;`x+k-1`][scs_diag;ADD1;ARITH_RULE`~(6=0)/\ i+1=1+i`;Ocbicby.MOD_EQ_MOD_SHIFT;MOD_MULT_ADD] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN DICH_TAC 0 +THEN MP_TAC(ARITH_RULE`x+6-1=1+(x+6-2)`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[Ocbicby.MOD_EQ_MOD_SHIFT] +THEN DICH_TAC 3 +THEN MP_TAC(ARITH_RULE`x+6-1+6-1=1*6+(x+6-2)`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[MOD_MULT_ADD] +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN DICH_TAC 0 +THEN REAL_ARITH_TAC; + + +MRESA_TAC J_EMPY_CASES_6[`s`;`x+k-1`] +THEN DICH_TAC 0 +THEN REWRITE_TAC[SET_RULE`(a = {})<=> !i. ~ (a i)`] +THEN STRIP_TAC +THEN MRESAL_TAC ODXLSTCv2[`s`;`k`;`v`;`x+k-1`][DE_MORGAN_THM;] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`!V' E' v1. V' = V /\ E' = E ==> ~lunar (v1,(v:num->real^3) (x+k-1)) V' E'` +ASSUME_TAC +; + + +REPEAT RESA_TAC +THEN DICH_TAC (38-23) +THEN RESA_TAC +THEN MRESA_TAC Local_lemmas.HKIRPEP[`E`;`w`;`FF`;`v'`;`V`] +THEN REPLICATE_TAC (52-39) (REMOVE_ASSUM_TAC) +THEN MRESA_TAC WL_IN_V[`x+k-1`;`v:num->real^3`] +THEN MP_TAC(ARITH_RULE`1<6/\ 2<6/\ ~(6=0)/\ ~((6-1) MOD 6= 3 MOD 6) /\ ~((6-1) MOD 6= 0 MOD 6)`) +THEN RESA_TAC +THEN THAYTHES_TAC 6[`(v:num->real^3) (x+k-1)`][DIFF;IN_ELIM_THM;SET_RULE`a IN {b,c} <=> a= b\/ a=c`;BB_VV_FUN_EQ;DE_MORGAN_THM;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[ADD1;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN MP_TAC(SET_RULE`x= x+0==> x MOD k= (x+0) MOD k`) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[ARITH_RULE`x+0=x`] +THEN RESA_TAC +THEN ASM_SIMP_TAC[Ocbicby.MOD_EQ_MOD_SHIFT] +THEN MRESAS_TAC Jkqewgv.JKQEWGV3[`s`;`v`;`v (x+k-1)`;`v1`][LET_DEF;LET_END_DEF;] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[Local_lemmas.LUNAR_COMM] +THEN ASM_REWRITE_TAC[ADD1] +THEN MP_TAC PI_WORKS +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[] +; + + +MP_TAC(REAL_ARITH`norm (v (x+k-1)) = &2 \/ ~(norm ((v:num->real^3) (x+k-1)) = &2)`) +THEN RESA_TAC +THEN MRESA_TAC J_EMPY_CASES_6[`s`;`x+k-1`] +THEN DICH_TAC 0 +THEN REWRITE_TAC[SET_RULE`(a = {})<=> !i. ~ (a i)`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`!V' E' v1. V' = V /\ E' = E ==> ~lunar (v1,(v:num->real^3) (x+k-1)) V' E'` +ASSUME_TAC +; + + +REPEAT RESA_TAC +THEN DICH_TAC (37-23) +THEN RESA_TAC +THEN MRESA_TAC Local_lemmas.HKIRPEP[`E`;`w`;`FF`;`v'`;`V`] +THEN REPLICATE_TAC (48-35) (REMOVE_ASSUM_TAC) +THEN MRESA_TAC WL_IN_V[`x+k-1`;`v:num->real^3`] +THEN MP_TAC(ARITH_RULE`1<6/\ 2<6/\ ~(6=0)/\ ~((6-1) MOD 6= 3 MOD 6) /\ ~((6-1) MOD 6= 0 MOD 6)`) +THEN RESA_TAC +THEN THAYTHES_TAC 6[`(v:num->real^3) (x+k-1)`][DIFF;IN_ELIM_THM;SET_RULE`a IN {b,c} <=> a= b\/ a=c`;BB_VV_FUN_EQ;DE_MORGAN_THM;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[ADD1;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN MP_TAC(SET_RULE`x= x+0==> x MOD k= (x+0) MOD k`) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[ARITH_RULE`x+0=x`] +THEN RESA_TAC +THEN ASM_SIMP_TAC[Ocbicby.MOD_EQ_MOD_SHIFT] +THEN MRESAS_TAC Jkqewgv.JKQEWGV3[`s`;`v`;`v (x+k-1)`;`v1`][LET_DEF;LET_END_DEF;] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[Local_lemmas.LUNAR_COMM] +THEN ASM_REWRITE_TAC[ADD1] +THEN MP_TAC PI_WORKS +THEN REAL_ARITH_TAC; + + +SUBGOAL_THEN`(!i. scs_diag k (x+k-1) i + ==> scs_a_v39 s (x+k-1) i < dist (v (x+k-1),(v:num->real^3) i))`ASSUME_TAC +; + +GEN_TAC +THEN STRIP_TAC +THEN THAYTHE_TAC (36-9)[`x+k-1`;`i`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC +; + + + + +SUBGOAL_THEN`azim (vec 0) ((v:num->real^3) (x + k - 1)) (v x) (v (x + k - 1+k-1)) = pi`ASSUME_TAC +; + + +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC Local_lemmas.HKIRPEP[`E`;`w`;`FF`;`v'`;`V`] +THEN DICH_TAC 0 +THEN DICH_TAC(33-23) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th] +THEN ASSUME_TAC th) +THEN REWRITE_TAC[] +THEN STRIP_TAC +THEN REPLICATE_TAC (47-34) (REMOVE_ASSUM_TAC) +THEN MRESA_TAC WL_IN_V[`x+k-1`;`v:num->real^3`] +THEN MP_TAC(ARITH_RULE`1<6/\ 2<6/\ ~(6=0)/\ ~((6-1) MOD 6= 3 MOD 6) /\ ~((6-1) MOD 6= 0 MOD 6)`) +THEN RESA_TAC +THEN THAYTHES_TAC 6[`(v:num->real^3) (x+k-1)`][DIFF;IN_ELIM_THM;SET_RULE`a IN {b,c} <=> a= b\/ a=c`;BB_VV_FUN_EQ;DE_MORGAN_THM;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[ADD1;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN MP_TAC(SET_RULE`x= x+0==> x MOD k= (x+0) MOD k`) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[ARITH_RULE`x+0=x`] +THEN RESA_TAC +THEN ASM_SIMP_TAC[Ocbicby.MOD_EQ_MOD_SHIFT] +THEN ASM_SIMP_TAC[ADD1;Ocbicby.MOD_EQ_MOD_SHIFT;interior_angle1;GSYM ivs_rho_node1] +THEN MRESAL_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v (x+k-1)`;`v`;`x+k-1`;`k`][ARITH_RULE`(x + k - 1) + 1= SUC (x + k - 1)`]; + + + +SUBGOAL_THEN`~collinear {vec 0, (v:num->real^3) x, v (x + k - 1 + k - 1)}` +ASSUME_TAC +; + + +DICH_TAC (37-23) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`1<6/\ 2<6/\ ~(6=0)/\ ~((6-1+6-1) MOD 6= 3 MOD 6)/\ ~((6-1+6-1) MOD 6= 0 MOD 6)`) +THEN RESA_TAC +THEN MRESA_TAC Lunar_deform.LOCAL_CONVEX_NOT_COLLINEAR[`FF`;`E`;`V`;`w`;`v'`] +THEN MATCH_DICH_TAC 0 +THEN MRESAS_TAC WL_IN_V[`x+k-1+k-1`;`v:num->real^3`][BB_VV_FUN_EQ;ARITH_RULE`SUC (SUC x)=x+2`;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN MP_TAC(SET_RULE`x= x+0==> x MOD k= (x+0) MOD k`) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[ARITH_RULE`x+0=x`] +THEN RESA_TAC +THEN ASM_SIMP_TAC[Ocbicby.MOD_EQ_MOD_SHIFT]; + + + + +SUBGOAL_THEN`(v:num->real^3) (x + k - 1) IN aff_gt {vec 0} {v x, v (x + k - 1 + k - 1)}` +ASSUME_TAC; + + +DICH_TAC (38-23) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`1<6/\ 2<6/\ ~(6=0)/\ (0 MOD 6= (3+3) MOD 6)/\ ~(1 MOD 6= 3 MOD 6)/\ ~(6<=3)/\ ~((3+1) MOD 6= (6-1) MOD 6)`) +THEN RESA_TAC +THEN MRESA_TAC Odxlstcv2.CARD_V_EQ_SCS_K1[`s`;`v`;`V`;`k`] +THEN MRESA_TAC Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME[`V`;`E`;`k`;`s`;`FF`;`v (x+3)`;`v`;`x+3`] +THEN MRESA_TAC Local_lemmas.AFF_IVS_RHO_NODE_EQQ[`V`;`E`;`w`;`FF`;`v'`] +THEN MRESAS_TAC Local_lemmas.LUNAR_IMP_HALF_CIRCLE_SUBSET_AFF_GT[`E`;`V`;`v'`;`FF`;`w`][BB_VV_FUN_EQ;Local_lemmas.LUNAR_COMM;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC(SYM th)) +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v x`;`v`;`x`;`k`] +THEN DICH_TAC 2 +THEN ASM_SIMP_TAC[BB_VV_FUN_EQ;] +THEN ONCE_REWRITE_TAC[ARITH_RULE`i+x+3=x+i+3:num`] +THEN MP_TAC(SET_RULE`x= x+0==> x MOD k= (x+0) MOD k`) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[ARITH_RULE`x+0=x`] +THEN RESA_TAC +THEN ASM_SIMP_TAC[Ocbicby.MOD_EQ_MOD_SHIFT] +THEN ONCE_REWRITE_TAC[ARITH_RULE`i+3=3+i:num`] +THEN ASM_SIMP_TAC[Ocbicby.MOD_EQ_MOD_SHIFT;MOD_LT] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0< l/\ l<3<=> l=1\/ l=2`;SET_RULE`{v (x + 3 + l) | l = 1 \/ l = 2} = {v (x+3+1), v(x+3+2)}`;SET_RULE`{a,b} SUBSET A<=> a IN A/\ b IN A`;ARITH_RULE` 3+2=6-1`] +THEN MP_TAC(ARITH_RULE`x+6-1+6-1= 1*6+(x+3+1)`) +THEN RESA_TAC +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`1 * k + x + 3 + 1`;`v:num->real^3`;`(1 * k + x + 3 + 1) MOD k:num`][MOD_REFL;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`(x + 3 + 1) MOD k`;`v:num->real^3`;`(x + 3 + 1):num`][MOD_REFL;MOD_MULT_ADD] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`v (x + 3+1) IN aff_gt {vec 0, v x} {v (x +k- 1)} +/\ aff_gt {vec 0, v x} {v (x +k- 1)} SUBSET aff_ge {vec 0, v x} {v (x + k-1)} +==> v (x + 3+1) IN aff_ge {vec 0, (v:num->real^3) x} {v (x + k-1)}`) +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN STRIP_TAC +THEN DICH_TAC (59-37) +THEN RESA_TAC +THEN MRESA_TAC WL_IN_V[`x+k-1`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`x+3+1`;`v:num->real^3`] +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v (x+k-1)`;`v`;`x+k-1`;`k`] +THEN MRESAL_TAC Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2[`E`;`V`;`FF`;`v (x+k-1)`][GSYM ADD1] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESAL_TAC Planarity.decomposition_planar_by_angle_fan[`vec 0:real^3`;`v x`;`v (x+k-1)`;`v (x+3+1)`][ADD1] +THEN MRESAL_TAC WL_IN_E[`x+k-1`;`v:num->real^3`][] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN RESA_TAC +THEN MRESA_TAC th3[`vec 0:real^3`;`v x`;`v (x+3+1)`] +THEN MRESAS_TAC Planarity.POINT_IN_AFF_GE_IMP_IN_EDGE[`vec 0:real^3`;`V`;`E`;`v(x)`;`v (x+k-1)`;`v (x+3+1)`][SET_RULE`a IN{b,c}<=> a=b\/ a=c`;Ocbicby.MOD_EQ_MOD_SHIFT;BB_VV_FUN_EQ]; + +MRESAL_TAC IMJXPHRv2[`s`;`k`;`v`;`x+k-1`][dist] +; + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM dist] +THEN DISCH_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN DISCH_TAC +; + + + +MRESA_TAC BB_F_SUC_PRE[`s`;`v:num->real^3`;`x`] +THEN MP_TAC Axjrpnc.DIST_LE_2h0_IN_CASES_6 +THEN RESA_TAC +THEN THAYTHEL_ASM_TAC 0[`x`][GSYM dist] +THEN THAYTHEL_TAC 0[`x+k-1`][GSYM dist] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN STRIP_TAC; + +SUBGOAL_THEN` cstab <= dist (v (SUC x),(v:num->real^3) (x + k - 1))`ASSUME_TAC +; + +MP_TAC(ARITH_RULE`1<6/\ 2<6/\ ~(1 MOD 6=6 MOD 6)/\ (x+6-1)+1=x+6/\ ~(1 MOD 6= (6-1) MOD 6)/\ ~(6=0)/\ ~((2) MOD 6= (6-1) MOD 6)`) +THEN RESA_TAC +THEN THAYTHES_TAC (41-10)[`SUC x`;`x+k-1`][scs_diag;ADD1;ARITH_RULE`(i+1)+1= i+2`;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + + +DICH_TAC (35-24) +THEN RESA_TAC +THEN MRESAL_TAC JKQEWGV3[`s`;`v`;`v'`;`w`][LET_DEF;LET_END_DEF;]; + + +DICH_TAC 1 +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN MP_TAC SYNQIWN +THEN RESA_TAC +THEN THAYTHE_TAC 0[`s`;`v`;`x`;`k`] +THEN DICH_TAC 0 +THEN DICH_TAC (35-30) +THEN DICH_TAC (34-29) +THEN RESA_TAC +THEN RESA_TAC +THEN DICH_TAC 2 +THEN REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1;ADD1] +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v (x)`;`v`;`x`;`k`] +THEN REAL_ARITH_TAC; + + + + + +]);; + + + + + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/SGTRNAF.hl b/text_formalization/local/SGTRNAF.hl new file mode 100755 index 0000000..0b5e267 --- /dev/null +++ b/text_formalization/local/SGTRNAF.hl @@ -0,0 +1,191 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Sgtrnaf = struct +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + +open Uxckfpe;; + + + +let UXCKFPE2=prove_by_refinement( +` !s vv. is_scs_v39 s /\ vv IN BBs_v39 s +/\ taustar_v39 s vv < &0 + ==> ~(BBprime2_v39 s = {})`, + (* {{{ proof *) +[ +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MRESA_TAC UXCKFPE[`s:scs_v39`;`vv:num->real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?vv1. vv1 IN A`;BBprime2_v39;IN;BBindex_min_v39;] +THEN STRIP_TAC +THEN SUBGOAL_THEN`?n. (?vv1. BBprime_v39 s vv1 /\ + BBindex_v39 s vv1=n)` ASSUME_TAC; + +EXISTS_TAC`BBindex_v39 s vv1` +THEN EXISTS_TAC`vv1:num->real^3` +THEN ASM_REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[MINIMAL] +THEN STRIP_TAC +THEN EXISTS_TAC`vv1':num->real^3` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th] THEN ASSUME_TAC (SYM th)) +THEN ASM_REWRITE_TAC[Misc_defs_and_lemmas.min_num;ARITH_RULE`(A=B:num)<=> (B=A)`] +THEN STRIP_TAC +THEN MATCH_MP_TAC SELECT_UNIQUE +THEN ASM_REWRITE_TAC[BETA_THM;IMAGE;IN_ELIM_THM;] +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN EQ_TAC; + +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`(?x. BBprime_v39 s x /\ BBindex_v39 s vv1' = BBindex_v39 s x)`ASSUME_TAC; + +EXISTS_TAC`vv1':num->real^3` +THEN ASM_REWRITE_TAC[]; + +STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`BBindex_v39 s vv1'`) +THEN MP_TAC(ARITH_RULE`BBindex_v39 s x <= BBindex_v39 s vv1' ==> +BBindex_v39 s x < BBindex_v39 s vv1' \/ BBindex_v39 s x = BBindex_v39 s vv1'`) +THEN RESA_TAC +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN +MRESA1_TAC th` BBindex_v39 s x`) +THEN SUBGOAL_THEN`(?vv1. BBprime_v39 s vv1 /\ BBindex_v39 s x = BBindex_v39 s vv1)`ASSUME_TAC; + +EXISTS_TAC`x:num->real^3` +THEN ASM_REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[]; + +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + + + +EXISTS_TAC`vv1':num->real^3` +THEN ASM_REWRITE_TAC[]; + + +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`BBindex_v39 s x REPEAT STRIP_TAC THEN +MRESA1_TAC th` BBindex_v39 s x`) +THEN SUBGOAL_THEN`(?vv1. BBprime_v39 s vv1 /\ BBindex_v39 s x = BBindex_v39 s vv1)`ASSUME_TAC; + +EXISTS_TAC`x:num->real^3` +THEN ASM_REWRITE_TAC[]; + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[]; +]);; + (* }}} *) + + + + +let SGTRNAF =prove( +`!s vv. is_scs_v39 s/\ unadorned_v39 s /\ vv IN BBs_v39 s /\ + taustar_v39 s vv < &0 + ==> ~(MMs_v39 s = {})`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC unadorned_MMs +THEN RESA_TAC +THEN MATCH_MP_TAC UXCKFPE2 +THEN EXISTS_TAC`vv:num->real^3` +THEN ASM_REWRITE_TAC[]);; + + + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/TECOXBM.hl b/text_formalization/local/TECOXBM.hl new file mode 100644 index 0000000..f2e5a1b --- /dev/null +++ b/text_formalization/local/TECOXBM.hl @@ -0,0 +1,1742 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================= *) + + + + +module Tecoxbm = struct + + + +open Wjscpro;; +open Polyhedron;; +open Sphere;; +open Fan_defs;; +open Hypermap;; +open Vol1;; +open Fan;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Sphere;; +open Hypermap;; +open Fan;; +open Topology;; +open Prove_by_refinement;; +open Pack_defs;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; + + +let CROSS_DOT_POS_SY=prove_by_refinement(`!l:real^(M,3)finite_product. stable_system k d (0..k-1) a b J (\i. ((1+i):num MOD k)) /\ k= dimindex(:M)/\ 2 &0<= (y cross z) dot u `, +[REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY] +THEN REPEAT STRIP_TAC +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v:real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th +THEN REWRITE_TAC[convex_local_fan] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th1-> MP_TAC th1 +THEN REWRITE_TAC[local_fan] +THEN LET_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th2-> ASSUME_TAC (SYM th2)) +THEN STRIP_TAC +THEN ASSUME_TAC th1) +THEN DISCH_THEN(LABEL_TAC"THY1") +THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN SUBGOAL_THEN `(y,z)IN F_SY(vecmats(l:real^(M,3)finite_product))`ASSUME_TAC; +REWRITE_TAC[F_SY;rows;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; +MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`i:num`;`y:real^3`;`z:real^3`;`(l:real^(M,3)finite_product)`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`z:real^3`;`y:real^3`] +THEN MRESA_TAC Conforming.aff_3_rep_cross_dot[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN REMOVE_THEN"THY1"(fun th-> MRESA1_TAC th`(y,z):real^3#real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETERMINE_WEDGE_IN_FAN)[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`((y,z):real^3#real^3)`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.PGSQVBL)[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`u:real^3`;`w:real^3`;`(y,z):real^3#real^3`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_DETERMINE_AZIM_IN_FA)[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`((y,z):real^3#real^3)`] +THEN REWRITE_TAC[REAL_ARITH`A<=B<=> A=B\/ A &0<= (y cross z) dot u`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.AZIM_CYCLE_EQ_SIGMA_FAN)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC(sigma_fan_in_set_of_edge)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`row i (vecmats (l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`;] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats (l:real^(M,3)finite_product))) (E_SY (vecmats (l:real^(M,3)finite_product))) (row i (vecmats (l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`row i (vecmats(l:real^(M,3)finite_product))`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.WEDGE_GE_EQ_AFF_GE)[`vec 0:real^3`;`y:real^3`;`z:real^3`;`(azim_cycle (EE y (E_SY (vecmats (l:real^(M,3)finite_product)))) (vec 0) y z)`] +THEN MP_TAC(REAL_ARITH`&0<= azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))) +==> azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))) = &0 \/ +&0< azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))))`) +THEN ASM_REWRITE_TAC[azim] +THEN STRIP_TAC; +MRESA_TAC Fan.UNIQUE_AZIM_0_POINT_FAN[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`] +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.FAN_IMP_EE_EQ_SET_OF_EDGE)[`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_CARD_EE_V_1)[`F_SY (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`row i (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`] +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge (row i (vecmats l)) (V_SY (vecmats l)) (E_SY (vecmats l)) ={row (SUC (i MOD dimindex (:M))) (vecmats l)} +\/ ~(set_of_edge (row i (vecmats l)) (V_SY (vecmats l)) (E_SY (vecmats l)) ={(row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))})`); +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; +MRESA_TAC SIGMA_FAN[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A=B<=>B=A`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]); +MP_TAC(REAL_ARITH` +&0 ~(azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))) = + &0 \/ + azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))) = + pi)`) +THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN STRIP_TAC +THEN MRESA_TAC( GEN_ALL Nkezbfc_local.inter_aff_ge_3_1_is_aff_ge_2_2)[`vec 0:real^3`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`row i (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC Planarity.cross_dot_fully_surrounded_fan[`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`][VECTOR_ARITH`A- vec 0=A`] +THEN MRESAL_TAC Nkezbfc_local.aff_ge_3_1_rep_cross_dot [`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`][VECTOR_ARITH`A- vec 0=A`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`u IN V_SY (vecmats (l:real^(M,3)finite_product)) +/\ V_SY (vecmats l) SUBSET {y' | &0 <= (y cross z) dot y'} INTER + aff_ge + {vec 0, sigma_fan (vec 0) (V_SY (vecmats l)) (E_SY (vecmats l)) y z, y} + {z} +==> &0<= (y cross z) dot u`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]);; + + +let IVS_RHO_NODE_IN_EDGE = prove(`!v. local_fan (V,E,FF) /\ v IN V ==> {v,ivs_rho_node1 FF v} IN E`, +NHANH EXISTS_INVERSE_OF_V THEN REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC(GEN_ALL Local_lemmas.IVS_RHO_IDD)[`E:(real^3->bool)->bool`;`V:real^3->bool`; +`FF:real^3#real^3->bool`;`vv:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_EE_TWO_ELMS)[`V:real^3->bool`;`E:(real^3->bool)->bool`; +`FF:real^3#real^3->bool`;`rho_node1 (FF:real^3#real^3->bool) vv`;`vv:real^3`] +THEN MP_TAC(SET_RULE`EE (rho_node1 FF vv) E = {rho_node1 FF (rho_node1 FF vv), vv} ==> vv IN EE (rho_node1 FF vv) (E:(real^3->bool)->bool) `) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[EE;IN_ELIM_THM]);; + + +let RHO_IVS_IDD = prove(` local_fan (V,E,FF) /\ v IN V +==> rho_node1 FF ( ivs_rho_node1 FF v ) = v `, +NHANH EXISTS_INVERSE_OF_V +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_IDD)[`E:(real^3->bool)->bool`;`V:real^3->bool`; +`FF:real^3#real^3->bool`;`vv:real^3`]);; + + + +let PROPERTIES_OF_FAN_IN_B_SY=prove_by_refinement(`!l:real^(M,3)finite_product. stable_system k (d:real) (0..k-1) a b J (\i. ((1+i):num MOD k)) /\ dimindex(:M)= k/\ 2 &2<= norm (y-z) `, +[REPEAT STRIP_TAC +THEN ASM_TAC +THEN DISCH_THEN(LABEL_TAC"THYGIANG") +THEN REPEAT STRIP_TAC +THEN POP_ASSUM( fun th-> ASSUME_TAC th THEN MP_TAC th THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY;CONDITION1_SY] THEN STRIP_TAC) +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v:real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN DISCH_THEN(LABEL_TAC"THY2") +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th +THEN REWRITE_TAC[convex_local_fan] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th1-> MP_TAC th1 +THEN REWRITE_TAC[local_fan] +THEN LET_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th2-> ASSUME_TAC (SYM th2)) +THEN STRIP_TAC +THEN ASSUME_TAC th1) +THEN DISCH_THEN(LABEL_TAC"THY1") +THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN REMOVE_THEN"THY2"(fun th-> MRESA_TAC th[`i:num`;`j:num`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "THYGIANG" MP_TAC +THEN REWRITE_TAC[stable_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THYGIANG2") +THEN MP_TAC(ARITH_RULE`i<= dimindex (:M)==> i <= dimindex (:M)-1 \/ i = dimindex (:M)`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE`j <= dimindex (:M)==> j <= dimindex (:M)-1 \/ j = dimindex (:M)`) +THEN RESA_TAC; + +STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`i:num`;`j:num`][ARITH_RULE`0<= i:num`;IN_NUMSEG]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +MP_TAC(ARITH_RULE`1<= i /\ 2< k==> ~(i = 0) /\ ~(k=0)/\ 1 MRESAL_TAC th[`i:num`;`0:num`][ARITH_RULE`0<= i:num`;IN_NUMSEG]) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ dimindex (:M) + dimindex (:M)= dimindex (:M) *2`] +THEN REMOVE_THEN "THYGIANG2" MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`i:num`;`k:num`;][IN_NUMSEG;ARITH_RULE`0<=a:num/\ A+0=A /\ k+k=k *2`]) +THEN MRESAL_TAC MOD_MULT[`k:num`;`1`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A`] +THEN REAL_ARITH_TAC; + +MP_TAC(ARITH_RULE`j <= dimindex (:M)==> j <= dimindex (:M)-1 \/ j = dimindex (:M)`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE`2< k==> ~(k = 0)/\ 1<=k /\ 1 MRESAL_TAC th[`j:num`;`k:num`;][IN_NUMSEG;ARITH_RULE`0<=a:num/\ A+0=A `]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`j:num`;`k:num`;][IN_NUMSEG;ARITH_RULE`0<=a:num/\ A+0=A /\ k+k= k*2`]) +THEN MP_TAC(ARITH_RULE`1<= j==> ~(j = 0)`) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`j:num`;`0:num`][ARITH_RULE`0<= i:num`;IN_NUMSEG]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN SET_TAC[]]);; + + +let AFF_GT_INTER_AFF_SY=prove_by_refinement(`!l:real^(M,3)finite_product. stable_system k (d:real) (0..k-1) a b J (\i. ((1+i):num MOD k)) /\ dimindex(:M)= k/\ 2 aff_gt {vec 0}{u,w} INTER aff {vec 0,y,z}={} `, +[REPEAT STRIP_TAC +THEN POP_ASSUM( fun th-> ASSUME_TAC th THEN MP_TAC th THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY] THEN STRIP_TAC) +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v:real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th +THEN REWRITE_TAC[convex_local_fan] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th1-> MP_TAC th1 +THEN REWRITE_TAC[local_fan] +THEN LET_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th2-> ASSUME_TAC (SYM th2)) +THEN STRIP_TAC +THEN ASSUME_TAC th1) +THEN DISCH_THEN(LABEL_TAC"THY1") +THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN SUBGOAL_THEN `(y,z)IN F_SY(vecmats(l:real^(M,3)finite_product))`ASSUME_TAC; +REWRITE_TAC[F_SY;rows;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; +MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`i:num`;`y:real^3`;`z:real^3`;`(l:real^(M,3)finite_product)`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`z:real^3`;`y:real^3`] +THEN MRESA_TAC Conforming.aff_3_rep_cross_dot[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN SUBGOAL_THEN `u IN ball_annulus` ASSUME_TAC; +MP_TAC(SET_RULE`{u, w} SUBSET V_SY (vecmats l) ==> u IN V_SY (vecmats (l:real^(M,3)finite_product))`) +THEN ASM_REWRITE_TAC[V_SY;IN_ELIM_THM;rows] +THEN STRIP_TAC +THEN REMOVE_THEN"THY"(fun th-> MRESA1_TAC th`i':num`); +SUBGOAL_THEN `w IN ball_annulus` ASSUME_TAC; +MP_TAC(SET_RULE`{u, w} SUBSET V_SY (vecmats l) ==> w IN V_SY (vecmats (l:real^(M,3)finite_product))`) +THEN ASM_REWRITE_TAC[V_SY;IN_ELIM_THM;rows] +THEN STRIP_TAC +THEN REMOVE_THEN"THY"(fun th-> MRESA1_TAC th`i':num`); +MRESAL_TAC (GEN_ALL NONPARALLEL_BALL_ANNULUS)[`u:real^3`;`w:real^3`][SET_RULE`{A} UNION {B,C}={A,B,C}`] +THEN MRESA_TAC th3[`vec 0:real^3`;`u:real^3`;`w:real^3`] +THEN MRESA_TAC AFF_GT_1_2[`vec 0:real^3`;`u:real^3`;`w:real^3`] +THEN REWRITE_TAC[SET_RULE`A= {}<=> ~(?x1. x1 IN A)`;INTER;IN_ELIM_THM;VECTOR_ARITH`A- vec 0=A`] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A % vec 0+C=C`;DOT_RADD;DOT_RMUL]; +SUBGOAL_THEN`&0<=(y cross z) dot u/\ &0<=(y cross z) dot w` ASSUME_TAC; +REMOVE_THEN"THY1"(fun th-> MRESA1_TAC th`(y,z):real^3#real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETERMINE_WEDGE_IN_FAN)[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`((y,z):real^3#real^3)`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.PGSQVBL)[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`u:real^3`;`w:real^3`;`(y,z):real^3#real^3`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_DETERMINE_AZIM_IN_FA)[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`((y,z):real^3#real^3)`] +THEN REWRITE_TAC[REAL_ARITH`A<=B<=> A=B\/ A &0<= (y cross z) dot u /\ &0<= (y cross z) dot w`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.AZIM_CYCLE_EQ_SIGMA_FAN)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC(sigma_fan_in_set_of_edge)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`row i (vecmats (l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`;] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats (l:real^(M,3)finite_product))) (E_SY (vecmats (l:real^(M,3)finite_product))) (row i (vecmats (l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`row i (vecmats(l:real^(M,3)finite_product))`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.WEDGE_GE_EQ_AFF_GE)[`vec 0:real^3`;`y:real^3`;`z:real^3`;`(azim_cycle (EE y (E_SY (vecmats (l:real^(M,3)finite_product)))) (vec 0) y z)`] +THEN MP_TAC(REAL_ARITH`&0<= azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))) +==> azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))) = &0 \/ +&0< azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))))`) +THEN ASM_REWRITE_TAC[azim] +THEN STRIP_TAC; +MRESA_TAC Fan.UNIQUE_AZIM_0_POINT_FAN[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`] +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.FAN_IMP_EE_EQ_SET_OF_EDGE)[`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_CARD_EE_V_1)[`F_SY (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`row i (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`] +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge (row i (vecmats l)) (V_SY (vecmats l)) (E_SY (vecmats l)) ={row (SUC (i MOD dimindex (:M))) (vecmats l)} +\/ ~(set_of_edge (row i (vecmats l)) (V_SY (vecmats l)) (E_SY (vecmats l)) ={(row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))})`); +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; +MRESA_TAC SIGMA_FAN[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A=B<=>B=A`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]); +MP_TAC(REAL_ARITH` +&0 ~(azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))) = + &0 \/ + azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))) = + pi)`) +THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN STRIP_TAC +THEN MRESA_TAC( GEN_ALL Nkezbfc_local.inter_aff_ge_3_1_is_aff_ge_2_2)[`vec 0:real^3`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`row i (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC Planarity.cross_dot_fully_surrounded_fan[`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`][VECTOR_ARITH`A- vec 0=A`] +THEN MRESAL_TAC Nkezbfc_local.aff_ge_3_1_rep_cross_dot [`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`][VECTOR_ARITH`A- vec 0=A`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`{u, w} SUBSET V_SY (vecmats (l:real^(M,3)finite_product)) +/\ V_SY (vecmats l) SUBSET {y' | &0 <= (y cross z) dot y'} INTER + aff_ge + {vec 0, sigma_fan (vec 0) (V_SY (vecmats l)) (E_SY (vecmats l)) y z, y} + {z} +==> &0<= (y cross z) dot u /\ &0<= (y cross z) dot w`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`&0<=A <=> &0< A \/ A= &0`] +THEN RESA_TAC; +REWRITE_TAC[REAL_ARITH`&0< A \/ A= &0<=> &0<=A `] +THEN STRIP_TAC; +MP_TAC(REAL_ARITH`&0< t3==> &0<= t3`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LT_MUL[`t2:real`;`(y cross z) dot u`] +THEN MRESA_TAC REAL_LE_MUL[`t3:real`;`(y cross z) dot w`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC; +MRESA_TAC REAL_LT_MUL[`t3:real`;`(y cross z) dot w`] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN ABBREV_TAC`y1= rho_node1 (F_SY(vecmats (l:real^(M,3)finite_product))) u` +THEN ABBREV_TAC`z1= ivs_rho_node1 (F_SY(vecmats (l:real^(M,3)finite_product))) u` +THEN MP_TAC(SET_RULE`{u, w} SUBSET V_SY (vecmats (l:real^(M,3)finite_product)) +==> u IN V_SY (vecmats (l:real^(M,3)finite_product))`) +THEN RESA_TAC +THEN SUBGOAL_THEN`y1 IN V_SY(vecmats(l:real^(M,3)finite_product))`ASSUME_TAC; +MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V)[`E_SY (vecmats(l:real^(M,3)finite_product))`;`F_SY (vecmats(l:real^(M,3)finite_product))`;`u:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th `SUC 0`[ITER;I_DEF;o_DEF]); +SUBGOAL_THEN`z1 IN V_SY(vecmats(l:real^(M,3)finite_product))`ASSUME_TAC; +MRESA_TAC (GEN_ALL Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1)[`E_SY (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`F_SY (vecmats(l:real^(M,3)finite_product))`;] +THEN POP_ASSUM(fun th-> MRESA1_TAC th`u:real^3`) +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V)[`E_SY (vecmats(l:real^(M,3)finite_product))`;`F_SY (vecmats(l:real^(M,3)finite_product))`;`u:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th `CARD (V_SY (vecmats (l:real^(M,3)finite_product))) - 1`[]); +SUBGOAL_THEN`&0<= (y cross z) dot y1/\ &0<= (y cross z) dot z1`ASSUME_TAC; +REMOVE_THEN"THY1"(fun th-> MRESA1_TAC th`(y,z):real^3#real^3`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETERMINE_WEDGE_IN_FAN)[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`((y,z):real^3#real^3)`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.PGSQVBL)[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`u:real^3`;`w:real^3`;`(y,z):real^3#real^3`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_DETERMINE_AZIM_IN_FA)[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`((y,z):real^3#real^3)`] +THEN REWRITE_TAC[REAL_ARITH`A<=B<=> A=B\/ A &0<= (y cross z) dot y1 /\ &0<= (y cross z) dot z1`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.AZIM_CYCLE_EQ_SIGMA_FAN)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC(sigma_fan_in_set_of_edge)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`row i (vecmats (l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`;] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats (l:real^(M,3)finite_product))) (E_SY (vecmats (l:real^(M,3)finite_product))) (row i (vecmats (l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`row i (vecmats(l:real^(M,3)finite_product))`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.WEDGE_GE_EQ_AFF_GE)[`vec 0:real^3`;`y:real^3`;`z:real^3`;`(azim_cycle (EE y (E_SY (vecmats (l:real^(M,3)finite_product)))) (vec 0) y z)`] +THEN MP_TAC(REAL_ARITH`&0<= azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))) +==> azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))) = &0 \/ +&0< azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))))`) +THEN ASM_REWRITE_TAC[azim] +THEN STRIP_TAC; +MRESA_TAC Fan.UNIQUE_AZIM_0_POINT_FAN[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`] +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.FAN_IMP_EE_EQ_SET_OF_EDGE)[`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_CARD_EE_V_1)[`F_SY (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`row i (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`] +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge (row i (vecmats l)) (V_SY (vecmats l)) (E_SY (vecmats l)) ={row (SUC (i MOD dimindex (:M))) (vecmats l)} +\/ ~(set_of_edge (row i (vecmats l)) (V_SY (vecmats l)) (E_SY (vecmats l)) ={(row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))})`); +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; +MRESA_TAC SIGMA_FAN[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A=B<=>B=A`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]); +MP_TAC(REAL_ARITH` +&0 ~(azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))) = + &0 \/ + azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))) = + pi)`) +THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN STRIP_TAC +THEN MRESA_TAC( GEN_ALL Nkezbfc_local.inter_aff_ge_3_1_is_aff_ge_2_2)[`vec 0:real^3`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`row i (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC Planarity.cross_dot_fully_surrounded_fan[`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`][VECTOR_ARITH`A- vec 0=A`] +THEN MRESAL_TAC Nkezbfc_local.aff_ge_3_1_rep_cross_dot [`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`][VECTOR_ARITH`A- vec 0=A`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`y1 IN V_SY (vecmats (l:real^(M,3)finite_product)) +/\ z1 IN V_SY (vecmats (l:real^(M,3)finite_product)) +/\ V_SY (vecmats l) SUBSET {y' | &0 <= (y cross z) dot y'} INTER + aff_ge + {vec 0, sigma_fan (vec 0) (V_SY (vecmats l)) (E_SY (vecmats l)) y z, y} + {z} +==> &0<= (y cross z) dot y1 /\ &0<= (y cross z) dot z1 `) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CHANGE") +THEN STRIP_TAC +THEN STRIP_TAC +THEN DISCH_THEN(LABEL_TAC"THY4") +THEN REMOVE_THEN"CHANGE" (fun th-> ASSUME_TAC th THEN +MP_TAC th THEN REWRITE_TAC[V_SY;IN_ELIM_THM;rows] +THEN STRIP_TAC) +THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN SUBGOAL_THEN`u,row (SUC (i' MOD k)) (vecmats l) IN F_SY(vecmats(l:real^(M,3)finite_product))` ASSUME_TAC; +REWRITE_TAC[F_SY;rows;IN_ELIM_THM] +THEN EXISTS_TAC`i':num` +THEN ASM_REWRITE_TAC[]; +MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_RHO_NODE_PROS)[`E_SY (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`F_SY (vecmats(l:real^(M,3)finite_product))`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`u:real^3,row (SUC (i' MOD k)) (vecmats (l:real^(M,3)finite_product))`[PAIR_EQ]) +THEN MRESA_TAC (GEN_ALL CROSS_DOT_POS_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i':num`;`a:num#num->real`;`b:num#num->real`;`u:real^3`;`y1:real^3`;`y:real^3`;`l:real^(M,3)finite_product`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`y:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL CROSS_DOT_POS_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i':num`;`a:num#num->real`;`b:num#num->real`;`u:real^3`;`y1:real^3`;`z:real^3`;`l:real^(M,3)finite_product`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL CROSS_DOT_POS_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i':num`;`a:num#num->real`;`b:num#num->real`;`u:real^3`;`y1:real^3`;`z1:real^3`;`l:real^(M,3)finite_product`] +THEN SUBGOAL_THEN(` &0 <= (z1 cross u) dot w /\ &0 <= (z1 cross u) dot y /\ &0 <= (z1 cross u) dot z `)ASSUME_TAC; +MP_TAC(ARITH_RULE`1<=i'==> i'=1 \/ 1<= i'-1`) +THEN RESA_TAC; +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN MRESAL_TAC MOD_MULT[`dimindex (:M)`;`1`][ARITH_RULE`k*1=k`;ARITH_RULE`SUC 0=1`;DIMINDEX_NONZERO] +THEN MP_TAC(ARITH_RULE`2 1<= k/\ k<=k`) +THEN RESA_TAC +THEN SUBGOAL_THEN`row k (vecmats l), u IN F_SY(vecmats(l:real^(M,3)finite_product))` ASSUME_TAC; +REWRITE_TAC[F_SY;rows;IN_ELIM_THM] +THEN EXISTS_TAC`k:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0=1`]; +MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_RHO_NODE_PROS)[`E_SY (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`F_SY (vecmats(l:real^(M,3)finite_product))`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`row k (vecmats (l:real^(M,3)finite_product)):real^3,u:real^3`[PAIR_EQ]) +THEN FIND_ASSUM MP_TAC`ivs_rho_node1 (F_SY (vecmats (l:real^(M,3)finite_product))) u=z1` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN SUBGOAL_THEN`row k (vecmats l) IN V_SY(vecmats(l:real^(M,3)finite_product))` ASSUME_TAC; +REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN EXISTS_TAC`k:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0=1`]; +MRESA_TAC(GEN_ALL Local_lemmas.IVS_RHO_IDD) [`E_SY (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`F_SY (vecmats(l:real^(M,3)finite_product))`;`(row k (vecmats (l:real^(M,3)finite_product)))`] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL CROSS_DOT_POS_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`k:num`;`a:num#num->real`;`b:num#num->real`;`z1:real^3`;`u:real^3`;`y:real^3`;`l:real^(M,3)finite_product`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`] +THEN MRESAL_TAC (GEN_ALL CROSS_DOT_POS_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`k:num`;`a:num#num->real`;`b:num#num->real`;`z1:real^3`;`u:real^3`;`z:real^3`;`l:real^(M,3)finite_product`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`] +THEN MP_TAC(SET_RULE`{u, w} SUBSET V_SY (vecmats (l:real^(M,3)finite_product)) +==> w IN V_SY (vecmats l) `) +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL CROSS_DOT_POS_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`k:num`;`a:num#num->real`;`b:num#num->real`;`z1:real^3`;`u:real^3`;`w:real^3`;`l:real^(M,3)finite_product`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`]; +MP_TAC(ARITH_RULE`1<= i' /\ i'<= dimindex (:M) ==> i'-1 < dimindex (:M)/\ i'-1 <= dimindex (:M)`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_LT[`i'-1:num`;`dimindex (:M):num`][ARITH_RULE`0<1`] +THEN MP_TAC(SET_RULE`{u, w} SUBSET V_SY (vecmats (l:real^(M,3)finite_product)) +==> w IN V_SY (vecmats l) `) +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL CROSS_DOT_POS_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i'-1:num`;`a:num#num->real`;`b:num#num->real`;`z1:real^3`;`u:real^3`;`y:real^3`;`l:real^(M,3)finite_product`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`] +THEN MRESAL_TAC (GEN_ALL CROSS_DOT_POS_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i'-1:num`;`a:num#num->real`;`b:num#num->real`;`z1:real^3`;`u:real^3`;`z:real^3`;`l:real^(M,3)finite_product`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`] +THEN MRESAL_TAC (GEN_ALL CROSS_DOT_POS_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i'-1:num`;`a:num#num->real`;`b:num#num->real`;`z1:real^3`;`u:real^3`;`w:real^3`;`l:real^(M,3)finite_product`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= i' /\ i'<= dimindex (:M) ==> SUC (i'-1)=i'`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN SUBGOAL_THEN`row (i'-1) (vecmats l), u IN F_SY(vecmats(l:real^(M,3)finite_product))` ASSUME_TAC; +REWRITE_TAC[F_SY;rows;IN_ELIM_THM] +THEN EXISTS_TAC`i'-1:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0=1`] +THEN MP_TAC(ARITH_RULE`1<= i' /\ i'<= dimindex (:M) ==> SUC (i'-1)=i'`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]); +MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_RHO_NODE_PROS)[`E_SY (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`F_SY (vecmats(l:real^(M,3)finite_product))`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`row (i'-1) (vecmats (l:real^(M,3)finite_product)):real^3,u:real^3`[PAIR_EQ]) +THEN FIND_ASSUM MP_TAC`ivs_rho_node1 (F_SY (vecmats (l:real^(M,3)finite_product))) u=z1` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th) +THEN SUBGOAL_THEN`row (i'-1) (vecmats l) IN V_SY(vecmats(l:real^(M,3)finite_product))` ASSUME_TAC; +REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN EXISTS_TAC`i'-1:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0=1`]; +MRESA_TAC(GEN_ALL Local_lemmas.IVS_RHO_IDD) [`E_SY (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`F_SY (vecmats(l:real^(M,3)finite_product))`;`(row (i'-1) (vecmats (l:real^(M,3)finite_product)))`] +THEN RESA_TAC +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`u IN aff{vec 0, y,z:real^3}` ASSUME_TAC; +ASM_REWRITE_TAC[VECTOR_ARITH`A- vec 0=A`;IN_ELIM_THM]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[AFFINE_HULL_3;aff;IN_ELIM_THM;VECTOR_ARITH`a % vec 0 +C=C`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[th] THEN ASSUME_TAC (SYM th)) +THEN REWRITE_TAC[CROSS_LADD;CROSS_LMUL;DOT_LADD;DOT_LMUL;DOT_CROSS_SELF;REAL_ARITH`A* &0= &0/\ A+ &0=A /\ &0+ A=A`;CROSS_RADD;CROSS_RMUL;] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN MP_TAC(REAL_ARITH`&0 <= (y cross z) dot y1 ==> ~((y cross z) dot y1< &0)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`(y cross z1) dot z<= &0` ASSUME_TAC; +ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[DOT_LNEG;REAL_ARITH`-- A<= &0<=> &0<= A`]; +MP_TAC(REAL_ARITH` (y cross z1) dot z<= &0 ==> ~(&0< (y cross z1) dot z)`) +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`(y cross z1) dot z= &0 \/ (y cross z) dot y1= &0` ASSUME_TAC; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[REAL_MUL_POS_LE] +THEN SUBGOAL_THEN`~(w' = &0 /\ v'= &0)` ASSUME_TAC; +STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN ASM_TAC +THEN REWRITE_TAC[VECTOR_ARITH`&0 % A= vec 0/\ vec 0+ vec 0= vec 0`] +THEN REPEAT STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[SET_RULE`~(A /\ B)<=> ~A \/ ~B`] +THEN RESA_TAC; +RESA_TAC; +MP_TAC(REAL_ARITH`w'< &0==> ~(&0 < w')`) +THEN RESA_TAC +THEN SET_TAC[]; +DISCH_TAC +THEN REMOVE_ASSUM_TAC +THEN RESA_TAC; +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[DOT_LNEG;] +THEN REAL_ARITH_TAC; +MP_TAC(REAL_ARITH`v'< &0==> ~(&0 < v')`) +THEN RESA_TAC +THEN STRIP_TAC; +ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[DOT_LNEG;] +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[DOT_LNEG; REAL_ARITH`&0< -- A<=> ~(&0 <= A)`]; +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ASM_REWRITE_TAC[DOT_LNEG; REAL_ARITH` A< &0 <=> ~(&0 <= A)`]; +POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`{u, w} SUBSET V_SY (vecmats (l:real^(M,3)finite_product)) +==> w IN V_SY (vecmats l) `) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL CROSS_DOT_POS_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i':num`;`a:num#num->real`;`b:num#num->real`;`u:real^3`;`y1:real^3`;`w:real^3`;`l:real^(M,3)finite_product`] +THEN SUBGOAL_THEN`w IN aff{vec 0, y,z:real^3}` ASSUME_TAC; +ASM_REWRITE_TAC[VECTOR_ARITH`A- vec 0=A`;IN_ELIM_THM]; +STRIP_TAC; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[AFFINE_HULL_3;aff;IN_ELIM_THM;VECTOR_ARITH`a % vec 0 +C=C`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`z1 IN aff{vec 0,u,w:real^3}` ASSUME_TAC; +MRESA_TAC Conforming.aff_3_rep_cross_dot[`vec 0:real^3`;`u:real^3`;`w:real^3`] +THEN REWRITE_TAC[IN_ELIM_THM;VECTOR_ARITH`A- vec 0=A`] +THEN EXPAND_TAC"u" +THEN REWRITE_TAC[CROSS_LADD;CROSS_LMUL;DOT_LADD;DOT_LMUL;CROSS_RADD;CROSS_RMUL;DOT_CROSS_SELF;CROSS_REFL;DOT_LZERO] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[CROSS_LNEG;DOT_LNEG] +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN STRIP_TAC +THEN REWRITE_TAC[AFFINE_HULL_3;aff;IN_ELIM_THM;VECTOR_ARITH`a % vec 0 +C=C`] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC `&0 <= (u cross y1) dot z1` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;DOT_RADD;DOT_RMUL;DOT_CROSS_SELF;REAL_ARITH`A * &0+B=B`] THEN ASSUME_TAC (SYM th)) +THEN MP_TAC(REAL_ARITH`&0 <= (u cross y1) dot w==> (u cross y1) dot w = &0 \/ &0 < (u cross y1) dot w`) +THEN RESA_TAC; +SUBGOAL_THEN`{u,row (SUC (i' MOD k)) (vecmats l)} IN E_SY(vecmats(l:real^(M,3)finite_product))` ASSUME_TAC; +REWRITE_TAC[E_SY;rows;IN_ELIM_THM] +THEN EXISTS_TAC`i':num` +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`y1:real^3`;`u:real^3`] +THEN SUBGOAL_THEN`w IN aff{vec 0,u,y1:real^3}` ASSUME_TAC; +MRESA_TAC Conforming.aff_3_rep_cross_dot[`vec 0:real^3`;`u:real^3`;`y1:real^3`] +THEN ASM_REWRITE_TAC[IN_ELIM_THM;VECTOR_ARITH`A- vec 0=A`]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[AFFINE_HULL_3;aff;IN_ELIM_THM;VECTOR_ARITH`a % vec 0 +C=C`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASSUME_TAC (SYM th)) +THEN DISJ_CASES_TAC(REAL_ARITH`w''''< &0 \/ &0<= w''''`); +SUBGOAL_THEN`w IN aff_lt{vec 0,u} {y1:real^3}` ASSUME_TAC; +ASM_SIMP_TAC[AFF_LT_2_1;IN_ELIM_THM] +THEN EXISTS_TAC`u'''':real` +THEN EXISTS_TAC`v'''':real` +THEN EXISTS_TAC`w'''':real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A % vec 0+C=C`]; +MRESA_TAC(GEN_ALL IVS_RHO_NODE_IN_EDGE)[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`u:real^3`] +THEN MRESA_TAC AZIM_EQ_PI_ALT[`vec 0:real^3`;`u:real^3`;`y1:real^3`;`w:real^3`] +THEN SUBGOAL_THEN`coplanar{vec 0, u, y1, z1:real^3} `ASSUME_TAC; +ASM_SIMP_TAC[Local_lemmas.COPLANAR_IFF_CROSS_DOT;VECTOR_ARITH`A- vec 0=A`] +THEN EXPAND_TAC"z1" +THEN REWRITE_TAC[DOT_RADD;DOT_RMUL] +THEN ASM_REWRITE_TAC[DOT_CROSS_SELF] +THEN REAL_ARITH_TAC; +MRESA_TAC(GEN_ALL Local_lemmas.LOFA_IMP_NOT_COLL_IVS)[`E_SY (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`F_SY (vecmats(l:real^(M,3)finite_product))`;`u:real^3`] +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`vec 0:real^3`;`u:real^3`;`y1:real^3`;`z1:real^3`]; +MRESA_TAC Fan.UNIQUE_AZIM_0_POINT_FAN[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`;`u:real^3`;`y1:real^3`;`z1:real^3`] +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE)[`E_SY (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`F_SY (vecmats(l:real^(M,3)finite_product))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`) +THEN MRESA_TAC(GEN_ALL RHO_IVS_IDD)[`E_SY (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`F_SY (vecmats(l:real^(M,3)finite_product))`;`u:real^3`]; +POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN MRESA_TAC AZIM_EQ[`vec 0:real^3`;`u:real^3`;`y1:real^3`;`z1:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE`w IN aff_gt {vec 0, u} {z1} +/\ aff_gt {vec 0, u} {z1} SUBSET aff_ge {vec 0, u} {z1} +==> w IN aff_ge {vec 0, u} {z1:real^3}`) +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN STRIP_TAC +THEN MRESA_TAC Planarity.decomposition_planar_by_angle_fan[`vec 0:real^3`;`u:real^3`;`z1:real^3`;`w:real^3`]; +MRESA_TAC (GEN_ALL BALL_ANNULUS_4PONITS_AFF_GT)[`z1:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`z1 IN ball_annulus` ASSUME_TAC; +FIND_ASSUM MP_TAC`z1 IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN"THY"(fun th-> MRESA1_TAC th`i'':num`); +SUBGOAL_THEN `&2<= norm (z1- u:real^3)` ASSUME_TAC; +FIND_ASSUM MP_TAC`z1 IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`i''= i' \/ ~(i''=i':num)`); +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`z1:real^3`;`u:real^3`]; +MRESA_TAC (GEN_ALL PROPERTIES_OF_FAN_IN_B_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i'':num`;`i':num`;`a:num#num->real`;`b:num#num->real`;`z1:real^3`;`u:real^3`;`l:real^(M,3)finite_product`]; +SUBGOAL_THEN `&2<= norm (z1- w:real^3)` ASSUME_TAC; +FIND_ASSUM MP_TAC`z1 IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`w IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`i''= i''' \/ ~(i''=i''':num)`); +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MP_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN ASM_TAC +THEN SET_TAC[]; +MRESA_TAC (GEN_ALL PROPERTIES_OF_FAN_IN_B_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i'':num`;`i''':num`;`a:num#num->real`;`b:num#num->real`;`z1:real^3`;`w:real^3`;`l:real^(M,3)finite_product`]; +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC (Planarity.properties_of_collinear4_points_fan)[`vec 0:real^3`;`w:real^3`;`u:real^3`;`z1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[]; +DISJ_CASES_TAC(SET_RULE`z1=w \/ ~(z1= w:real^3)`); +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN ASM_TAC +THEN SET_TAC[]; +MRESA_TAC th3[`u:real^3`;`w:real^3`;`vec 0:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(z1=w) /\ ~(u=w)==> {u,z1} INTER {w:real^3}={}`) +THEN RESA_TAC +THEN SUBGOAL_THEN`(?v. v IN V_SY (vecmats (l:real^(M,3)finite_product)) /\ {w} = {v:real^3})` ASSUME_TAC; +EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[]; +FIND_ASSUM MP_TAC`FAN (vec 0,V_SY (vecmats l),E_SY (vecmats (l:real^(M,3)finite_product)))` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`{u,z1:real^3}`;`{w:real^3}`][UNION;IN_ELIM_THM;AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING]) +THEN MRESA_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE`w IN aff_ge {vec 0} {w} +/\ aff_ge {vec 0} {u, z1} INTER aff_ge {vec 0} {w} = {vec 0} +/\ w IN aff_ge {vec 0} {u, z1} +==> vec 0= w:real^3`) +THEN RESA_TAC; +SUBGOAL_THEN`w IN aff_ge{vec 0:real^3,u} {y1}` ASSUME_TAC; +ASM_SIMP_TAC[AFF_GE_2_1;IN_ELIM_THM] +THEN EXISTS_TAC`u'''':real` +THEN EXISTS_TAC`v'''':real` +THEN EXISTS_TAC`w'''':real` +THEN ASM_REWRITE_TAC[] +THEN VECTOR_ARITH_TAC; +MRESA_TAC Planarity.decomposition_planar_by_angle_fan[`vec 0:real^3`;`u:real^3`;`y1:real^3`;`w:real^3`]; +MRESA_TAC (GEN_ALL BALL_ANNULUS_4PONITS_AFF_GT)[`y1:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`y1 IN ball_annulus` ASSUME_TAC; +FIND_ASSUM MP_TAC`y1 IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN"THY"(fun th-> MRESA1_TAC th`i'':num`); +SUBGOAL_THEN `&2<= norm (y1- u:real^3)` ASSUME_TAC; +FIND_ASSUM MP_TAC`y1 IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`i''= i' \/ ~(i''=i':num)`); +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`y1:real^3`;`u:real^3`]; +MRESA_TAC (GEN_ALL PROPERTIES_OF_FAN_IN_B_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i'':num`;`i':num`;`a:num#num->real`;`b:num#num->real`;`y1:real^3`;`u:real^3`;`l:real^(M,3)finite_product`]; +SUBGOAL_THEN `&2<= norm (y1- w:real^3)` ASSUME_TAC; +FIND_ASSUM MP_TAC`y1 IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`w IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`i''= i''' \/ ~(i''=i''':num)`); +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MP_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN ASM_TAC +THEN SET_TAC[]; +MRESA_TAC (GEN_ALL PROPERTIES_OF_FAN_IN_B_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i'':num`;`i''':num`;`a:num#num->real`;`b:num#num->real`;`y1:real^3`;`w:real^3`;`l:real^(M,3)finite_product`]; +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC (Planarity.properties_of_collinear4_points_fan)[`vec 0:real^3`;`w:real^3`;`u:real^3`;`y1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[]; +DISJ_CASES_TAC(SET_RULE`y1=w \/ ~(y1= w:real^3)`); +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN ASM_TAC +THEN SET_TAC[]; +MRESA_TAC th3[`u:real^3`;`w:real^3`;`vec 0:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(y1=w) /\ ~(u=w)==> {u,y1} INTER {w:real^3}={}`) +THEN RESA_TAC +THEN SUBGOAL_THEN`(?v. v IN V_SY (vecmats (l:real^(M,3)finite_product)) /\ {w} = {v:real^3})` ASSUME_TAC; +EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[]; +FIND_ASSUM MP_TAC`FAN (vec 0,V_SY (vecmats l),E_SY (vecmats (l:real^(M,3)finite_product)))` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`{u,y1:real^3}`;`{w:real^3}`][UNION;IN_ELIM_THM;AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING]) +THEN MRESA_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE`w IN aff_ge {vec 0} {w} +/\ aff_ge {vec 0} {u, y1} INTER aff_ge {vec 0} {w} = {vec 0} +/\ w IN aff_ge {vec 0} {u, y1} +==> vec 0= w:real^3`) +THEN RESA_TAC; +MP_TAC(REAL_ARITH`&0 < (u cross y1:real^3) dot w ==> ~((u cross y1) dot w = &0) /\ ~((u cross y1) dot w < &0)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[REAL_MUL_POS_LE] +THEN STRIP_TAC; +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN ASM_TAC +THEN REWRITE_TAC[VECTOR_ARITH`&0 %A= vec 0/\ A + vec 0=A`] +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`z1 IN aff{vec 0, u:real^3}`ASSUME_TAC; +REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`&1- v''':real` +THEN EXISTS_TAC`v''':real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - v''' + v''' = &1`] +THEN VECTOR_ARITH_TAC; +MRESA_TAC(GEN_ALL Local_lemmas.LOFA_IMP_NOT_COLL_IVS)[`E_SY (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`F_SY (vecmats(l:real^(M,3)finite_product))`;`u:real^3`] +THEN MRESA_TAC th3[`vec 0:real^3`;`u:real^3`;`z1:real^3`]; +POP_ASSUM MP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOFA_IMP_NOT_COLL_IVS)[`E_SY (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`F_SY (vecmats(l:real^(M,3)finite_product))`;`u:real^3`] +THEN MRESA_TAC th3[`vec 0:real^3`;`u:real^3`;`z1:real^3`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`w IN aff_ge{vec 0:real^3,u} {z1}` ASSUME_TAC; +ASM_SIMP_TAC[AFF_GE_2_1;IN_ELIM_THM] +THEN EXISTS_TAC`&1 + (inv w''') *v''' - inv w''':real` +THEN EXISTS_TAC`-- (inv w''') *v''':real` +THEN EXISTS_TAC`inv w''':real` +THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 + inv w''' * v''' - inv w''') + --inv w''' * v''' + inv w''' = &1`] +THEN EXPAND_TAC"z1" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 + inv w''' * v''' - inv w''') % vec 0 + + (--inv w''' * v''') % u + + inv w''' % (v''' % u + w''' % w) += (inv w''' *w''') % w`] +THEN MP_TAC(REAL_ARITH`&0< w'''==> ~(w'''= &0)`) +THEN RESA_TAC +THEN MRESAL1_TAC REAL_MUL_LINV`w''':real`[VECTOR_ARITH`A= &1 %A`] +THEN MATCH_MP_TAC REAL_LE_INV +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"A") +THEN STRIP_TAC +THEN REMOVE_THEN"A" MP_TAC +THEN MRESA_TAC Planarity.decomposition_planar_by_angle_fan[`vec 0:real^3`;`u:real^3`;`z1:real^3`;`w:real^3`]; +MRESA_TAC (GEN_ALL BALL_ANNULUS_4PONITS_AFF_GT)[`z1:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`z1 IN ball_annulus` ASSUME_TAC; +FIND_ASSUM MP_TAC`z1 IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN"THY"(fun th-> MRESA1_TAC th`i'':num`); +SUBGOAL_THEN `&2<= norm (z1- u:real^3)` ASSUME_TAC; +FIND_ASSUM MP_TAC`z1 IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`i''= i' \/ ~(i''=i':num)`); +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th3[`u:real^3`;`z1:real^3`;`vec 0:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; +MRESA_TAC (GEN_ALL PROPERTIES_OF_FAN_IN_B_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i'':num`;`i':num`;`a:num#num->real`;`b:num#num->real`;`z1:real^3`;`u:real^3`;`l:real^(M,3)finite_product`]; +SUBGOAL_THEN `&2<= norm (z1- w:real^3)` ASSUME_TAC; +FIND_ASSUM MP_TAC`z1 IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`w IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL IVS_RHO_NODE_IN_EDGE)[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`u:real^3`] +THEN DISJ_CASES_TAC(ARITH_RULE`i''= i''' \/ ~(i''=i''':num)`); +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[]; +MRESA_TAC (GEN_ALL PROPERTIES_OF_FAN_IN_B_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i'':num`;`i''':num`;`a:num#num->real`;`b:num#num->real`;`z1:real^3`;`w:real^3`;`l:real^(M,3)finite_product`]; +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC (Planarity.properties_of_collinear4_points_fan)[`vec 0:real^3`;`w:real^3`;`u:real^3`;`z1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[]; +DISJ_CASES_TAC(SET_RULE`z1=w \/ ~(z1= w:real^3)`); +MRESA_TAC(GEN_ALL IVS_RHO_NODE_IN_EDGE)[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`u:real^3`]; +MRESA_TAC th3[`u:real^3`;`w:real^3`;`vec 0:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(z1=w) /\ ~(u=w)==> {u,z1} INTER {w:real^3}={}`) +THEN RESA_TAC +THEN SUBGOAL_THEN`(?v. v IN V_SY (vecmats (l:real^(M,3)finite_product)) /\ {w} = {v:real^3})` ASSUME_TAC; +EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[]; +MRESA_TAC(GEN_ALL IVS_RHO_NODE_IN_EDGE)[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`u:real^3`] +THEN FIND_ASSUM MP_TAC`FAN (vec 0,V_SY (vecmats l),E_SY (vecmats (l:real^(M,3)finite_product)))` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`{u,z1:real^3}`;`{w:real^3}`][UNION;IN_ELIM_THM;AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING]) +THEN MRESA_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE`w IN aff_ge {vec 0} {w} +/\ aff_ge {vec 0} {u, z1} INTER aff_ge {vec 0} {w} = {vec 0} +/\ w IN aff_ge {vec 0} {u, z1} +==> vec 0= w:real^3`) +THEN RESA_TAC; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[AFFINE_HULL_3;aff;IN_ELIM_THM;VECTOR_ARITH`a % vec 0 +C=C`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`y1 IN aff{vec 0,u,w:real^3}` ASSUME_TAC; +MRESA_TAC Conforming.aff_3_rep_cross_dot[`vec 0:real^3`;`u:real^3`;`w:real^3`] +THEN REWRITE_TAC[IN_ELIM_THM;VECTOR_ARITH`A- vec 0=A`] +THEN EXPAND_TAC"u" +THEN REWRITE_TAC[CROSS_LADD;CROSS_LMUL;DOT_LADD;DOT_LMUL;CROSS_RADD;CROSS_RMUL;DOT_CROSS_SELF;CROSS_REFL;DOT_LZERO] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[CROSS_LNEG;DOT_LNEG] +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN STRIP_TAC +THEN REWRITE_TAC[AFFINE_HULL_3;aff;IN_ELIM_THM;VECTOR_ARITH`a % vec 0 +C=C`] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC `&0 <= (u cross y1) dot z1` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;CROSS_RADD;CROSS_RMUL;DOT_LADD;DOT_LMUL;DOT_CROSS_SELF;] THEN ASSUME_TAC (SYM th)) +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN REWRITE_TAC[DOT_CROSS_SELF;REAL_ARITH`A * &0+B=B`] +THEN MP_TAC(REAL_ARITH`&0 <= (z1 cross u) dot w==> (z1 cross u) dot w = &0 \/ &0 < (z1 cross u) dot w`) +THEN RESA_TAC; +SUBGOAL_THEN`{u,row (SUC (i' MOD k)) (vecmats l)} IN E_SY(vecmats(l:real^(M,3)finite_product))` ASSUME_TAC; +REWRITE_TAC[E_SY;rows;IN_ELIM_THM] +THEN EXISTS_TAC`i':num` +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL IVS_RHO_NODE_IN_EDGE)[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`z1:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`y1:real^3`;`u:real^3`] +THEN SUBGOAL_THEN`w IN aff{vec 0,u,z1:real^3}` ASSUME_TAC; +MRESA_TAC Conforming.aff_3_rep_cross_dot[`vec 0:real^3`;`u:real^3`;`z1:real^3`] +THEN ASM_REWRITE_TAC[IN_ELIM_THM;VECTOR_ARITH`A- vec 0=A`] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[CROSS_LNEG;DOT_LNEG] +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[AFFINE_HULL_3;aff;IN_ELIM_THM;VECTOR_ARITH`a % vec 0 +C=C`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASSUME_TAC (SYM th)) +THEN DISJ_CASES_TAC(REAL_ARITH`w''''< &0 \/ &0<= w''''`); +SUBGOAL_THEN`w IN aff_lt{vec 0,u} {z1:real^3}` ASSUME_TAC; +ASM_SIMP_TAC[AFF_LT_2_1;IN_ELIM_THM] +THEN EXISTS_TAC`u'''':real` +THEN EXISTS_TAC`v'''':real` +THEN EXISTS_TAC`w'''':real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A % vec 0+C=C`]; +MRESA_TAC AZIM_EQ_PI_ALT[`vec 0:real^3`;`u:real^3`;`z1:real^3`;`w:real^3`] +THEN SUBGOAL_THEN`coplanar{vec 0, u, z1, y1:real^3} `ASSUME_TAC; +ASM_SIMP_TAC[Local_lemmas.COPLANAR_IFF_CROSS_DOT;VECTOR_ARITH`A- vec 0=A`] +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[CROSS_RADD;CROSS_RMUL;CROSS_LADD;CROSS_LADD;DOT_RADD;DOT_RMUL;CROSS_REFL] +THEN ASM_REWRITE_TAC[DOT_CROSS_SELF;] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[CROSS_LNEG;DOT_LNEG] +THEN REAL_ARITH_TAC; +MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`vec 0:real^3`;`u:real^3`;`z1:real^3`;`y1:real^3`]; +MRESA_TAC Fan.UNIQUE_AZIM_0_POINT_FAN[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`;`u:real^3`;`z1:real^3`;`y1:real^3`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE)[`E_SY (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`F_SY (vecmats(l:real^(M,3)finite_product))`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN MRESA_TAC(GEN_ALL RHO_IVS_IDD)[`E_SY (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`F_SY (vecmats(l:real^(M,3)finite_product))`;`u:real^3`]; +POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN MRESA_TAC AZIM_EQ[`vec 0:real^3`;`u:real^3`;`z1:real^3`;`y1:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE`w IN aff_gt {vec 0, u} {y1} +/\ aff_gt {vec 0, u} {y1} SUBSET aff_ge {vec 0, u} {y1} +==> w IN aff_ge {vec 0, u} {y1:real^3}`) +THEN ASM_REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] +THEN STRIP_TAC +THEN MRESA_TAC Planarity.decomposition_planar_by_angle_fan[`vec 0:real^3`;`u:real^3`;`y1:real^3`;`w:real^3`]; +MRESA_TAC (GEN_ALL BALL_ANNULUS_4PONITS_AFF_GT)[`y1:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`y1 IN ball_annulus` ASSUME_TAC; +FIND_ASSUM MP_TAC`y1 IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN"THY"(fun th-> MRESA1_TAC th`i'':num`); +SUBGOAL_THEN `&2<= norm (y1- u:real^3)` ASSUME_TAC; +FIND_ASSUM MP_TAC`y1 IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`i''= i' \/ ~(i''=i':num)`); +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`y1:real^3`;`u:real^3`]; +MRESA_TAC (GEN_ALL PROPERTIES_OF_FAN_IN_B_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i'':num`;`i':num`;`a:num#num->real`;`b:num#num->real`;`y1:real^3`;`u:real^3`;`l:real^(M,3)finite_product`]; +SUBGOAL_THEN `&2<= norm (y1- w:real^3)` ASSUME_TAC; +FIND_ASSUM MP_TAC`y1 IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`w IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`i''= i''' \/ ~(i''=i''':num)`); +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MP_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN ASM_TAC +THEN SET_TAC[]; +MRESA_TAC (GEN_ALL PROPERTIES_OF_FAN_IN_B_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i'':num`;`i''':num`;`a:num#num->real`;`b:num#num->real`;`y1:real^3`;`w:real^3`;`l:real^(M,3)finite_product`]; +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC (Planarity.properties_of_collinear4_points_fan)[`vec 0:real^3`;`w:real^3`;`u:real^3`;`y1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[]; +DISJ_CASES_TAC(SET_RULE`y1=w \/ ~(y1= w:real^3)`); +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN ASM_TAC +THEN SET_TAC[]; +MRESA_TAC th3[`u:real^3`;`w:real^3`;`vec 0:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(y1=w) /\ ~(u=w)==> {u,y1} INTER {w:real^3}={}`) +THEN RESA_TAC +THEN SUBGOAL_THEN`(?v. v IN V_SY (vecmats (l:real^(M,3)finite_product)) /\ {w} = {v:real^3})` ASSUME_TAC; +EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[]; +FIND_ASSUM MP_TAC`FAN (vec 0,V_SY (vecmats l),E_SY (vecmats (l:real^(M,3)finite_product)))` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`{u,y1:real^3}`;`{w:real^3}`][UNION;IN_ELIM_THM;AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING]) +THEN MRESA_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE`w IN aff_ge {vec 0} {w} +/\ aff_ge {vec 0} {u, y1} INTER aff_ge {vec 0} {w} = {vec 0} +/\ w IN aff_ge {vec 0} {u, y1} +==> vec 0= w:real^3`) +THEN RESA_TAC; +SUBGOAL_THEN`w IN aff_ge{vec 0:real^3,u} {z1}` ASSUME_TAC; +ASM_SIMP_TAC[AFF_GE_2_1;IN_ELIM_THM] +THEN EXISTS_TAC`u'''':real` +THEN EXISTS_TAC`v'''':real` +THEN EXISTS_TAC`w'''':real` +THEN ASM_REWRITE_TAC[] +THEN VECTOR_ARITH_TAC; +MRESA_TAC Planarity.decomposition_planar_by_angle_fan[`vec 0:real^3`;`u:real^3`;`z1:real^3`;`w:real^3`]; +MRESA_TAC (GEN_ALL BALL_ANNULUS_4PONITS_AFF_GT)[`z1:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`z1 IN ball_annulus` ASSUME_TAC; +FIND_ASSUM MP_TAC`z1 IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN"THY"(fun th-> MRESA1_TAC th`i'':num`); +SUBGOAL_THEN `&2<= norm (z1- u:real^3)` ASSUME_TAC; +FIND_ASSUM MP_TAC`z1 IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`i''= i' \/ ~(i''=i':num)`); +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`z1:real^3`;`u:real^3`]; +MRESA_TAC (GEN_ALL PROPERTIES_OF_FAN_IN_B_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i'':num`;`i':num`;`a:num#num->real`;`b:num#num->real`;`z1:real^3`;`u:real^3`;`l:real^(M,3)finite_product`]; +SUBGOAL_THEN `&2<= norm (z1- w:real^3)` ASSUME_TAC; +FIND_ASSUM MP_TAC`z1 IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`w IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`i''= i''' \/ ~(i''=i''':num)`); +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MP_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN ASM_TAC +THEN SET_TAC[]; +MRESA_TAC (GEN_ALL PROPERTIES_OF_FAN_IN_B_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i'':num`;`i''':num`;`a:num#num->real`;`b:num#num->real`;`z1:real^3`;`w:real^3`;`l:real^(M,3)finite_product`]; +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC (Planarity.properties_of_collinear4_points_fan)[`vec 0:real^3`;`w:real^3`;`u:real^3`;`z1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[]; +DISJ_CASES_TAC(SET_RULE`z1=w \/ ~(z1= w:real^3)`); +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN ASM_TAC +THEN SET_TAC[]; +MRESA_TAC th3[`u:real^3`;`w:real^3`;`vec 0:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(z1=w) /\ ~(u=w)==> {u,z1} INTER {w:real^3}={}`) +THEN RESA_TAC +THEN SUBGOAL_THEN`(?v. v IN V_SY (vecmats (l:real^(M,3)finite_product)) /\ {w} = {v:real^3})` ASSUME_TAC; +EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[]; +FIND_ASSUM MP_TAC`FAN (vec 0,V_SY (vecmats l),E_SY (vecmats (l:real^(M,3)finite_product)))` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`{u,z1:real^3}`;`{w:real^3}`][UNION;IN_ELIM_THM;AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING]) +THEN MRESA_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE`w IN aff_ge {vec 0} {w} +/\ aff_ge {vec 0} {u, z1} INTER aff_ge {vec 0} {w} = {vec 0} +/\ w IN aff_ge {vec 0} {u, z1} +==> vec 0= w:real^3`) +THEN RESA_TAC; +ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN MP_TAC(REAL_ARITH`&0 < (z1 cross u:real^3) dot w ==> ~((z1 cross u) dot w = &0) /\ ~((z1 cross u) dot w < &0)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[REAL_MUL_POS_LE] +THEN STRIP_TAC; +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN ASM_TAC +THEN REWRITE_TAC[VECTOR_ARITH`&0 %A= vec 0/\ A + vec 0=A`] +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`y1 IN aff{vec 0, u:real^3}`ASSUME_TAC; +REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM] +THEN EXISTS_TAC`&1- v''':real` +THEN EXISTS_TAC`v''':real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - v''' + v''' = &1`] +THEN VECTOR_ARITH_TAC; +SUBGOAL_THEN`{u,row (SUC (i' MOD k)) (vecmats l)} IN E_SY(vecmats(l:real^(M,3)finite_product))` ASSUME_TAC; +REWRITE_TAC[E_SY;rows;IN_ELIM_THM] +THEN EXISTS_TAC`i':num` +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`y1:real^3`;`u:real^3`]; +SUBGOAL_THEN`{u,row (SUC (i' MOD k)) (vecmats l)} IN E_SY(vecmats(l:real^(M,3)finite_product))` ASSUME_TAC; +REWRITE_TAC[E_SY;rows;IN_ELIM_THM] +THEN EXISTS_TAC`i':num` +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`y1:real^3`;`u:real^3`] +THEN SUBGOAL_THEN`w IN aff_ge{vec 0:real^3,u} {y1}` ASSUME_TAC; +ASM_SIMP_TAC[AFF_GE_2_1;IN_ELIM_THM] +THEN EXISTS_TAC`&1 + (inv w''') *v''' - inv w''':real` +THEN EXISTS_TAC`-- (inv w''') *v''':real` +THEN EXISTS_TAC`inv w''':real` +THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 + inv w''' * v''' - inv w''') + --inv w''' * v''' + inv w''' = &1`] +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 + inv w''' * v''' - inv w''') % vec 0 + + (--inv w''' * v''') % u + + inv w''' % (v''' % u + w''' % w) += (inv w''' *w''') % w`] +THEN MP_TAC(REAL_ARITH`&0< w'''==> ~(w'''= &0)`) +THEN RESA_TAC +THEN MRESAL1_TAC REAL_MUL_LINV`w''':real`[VECTOR_ARITH`A= &1 %A`] +THEN MATCH_MP_TAC REAL_LE_INV +THEN ASM_TAC +THEN REAL_ARITH_TAC; +REMOVE_THEN "THY4" MP_TAC +THEN MRESA_TAC Planarity.decomposition_planar_by_angle_fan[`vec 0:real^3`;`u:real^3`;`y1:real^3`;`w:real^3`]; +MRESA_TAC (GEN_ALL BALL_ANNULUS_4PONITS_AFF_GT)[`y1:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`y1 IN ball_annulus` ASSUME_TAC; +FIND_ASSUM MP_TAC`y1 IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN"THY"(fun th-> MRESA1_TAC th`i'':num`); +SUBGOAL_THEN `&2<= norm (y1- u:real^3)` ASSUME_TAC; +FIND_ASSUM MP_TAC`y1 IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`i''= i' \/ ~(i''=i':num)`); +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`y1:real^3`;`u:real^3`]; +MRESA_TAC (GEN_ALL PROPERTIES_OF_FAN_IN_B_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i'':num`;`i':num`;`a:num#num->real`;`b:num#num->real`;`y1:real^3`;`u:real^3`;`l:real^(M,3)finite_product`]; +SUBGOAL_THEN `&2<= norm (y1- w:real^3)` ASSUME_TAC; +FIND_ASSUM MP_TAC`y1 IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN FIND_ASSUM MP_TAC`w IN V_SY (vecmats (l:real^(M,3)finite_product))` +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`i''= i''' \/ ~(i''=i''':num)`); +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MP_TAC(SYM th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN ASM_TAC +THEN SET_TAC[]; +MRESA_TAC (GEN_ALL PROPERTIES_OF_FAN_IN_B_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i'':num`;`i''':num`;`a:num#num->real`;`b:num#num->real`;`y1:real^3`;`w:real^3`;`l:real^(M,3)finite_product`]; +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC (Planarity.properties_of_collinear4_points_fan)[`vec 0:real^3`;`w:real^3`;`u:real^3`;`y1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[]; +DISJ_CASES_TAC(SET_RULE`y1=w \/ ~(y1= w:real^3)`); +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN ASM_TAC +THEN SET_TAC[]; +MRESA_TAC th3[`u:real^3`;`w:real^3`;`vec 0:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(y1=w) /\ ~(u=w)==> {u,y1} INTER {w:real^3}={}`) +THEN RESA_TAC +THEN SUBGOAL_THEN`(?v. v IN V_SY (vecmats (l:real^(M,3)finite_product)) /\ {w} = {v:real^3})` ASSUME_TAC; +EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[]; +FIND_ASSUM MP_TAC`FAN (vec 0,V_SY (vecmats l),E_SY (vecmats (l:real^(M,3)finite_product)))` +THEN REWRITE_TAC[FAN;fan7] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`{u,y1:real^3}`;`{w:real^3}`][UNION;IN_ELIM_THM;AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING]) +THEN MRESA_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`w:real^3`] +THEN MP_TAC(SET_RULE`w IN aff_ge {vec 0} {w} +/\ aff_ge {vec 0} {u, y1} INTER aff_ge {vec 0} {w} = {vec 0} +/\ w IN aff_ge {vec 0} {u, y1} +==> vec 0= w:real^3`) +THEN RESA_TAC]);; + + + + +let TECOXBM1=prove_by_refinement(`!l:real^(M,3)finite_product. stable_system k (d:real) (0..k-1) a b J (\i. ((1+i):num MOD k)) /\ k= dimindex(:M)/\ 2 (!x. x IN F_SY(vecmats l)==> aff_gt {vec 0}{u,w} SUBSET wedge_in_fan_gt x (E_SY (vecmats l))) `, +[GEN_TAC THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC th THEN MP_TAC th THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v:real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> MP_TAC th +THEN REWRITE_TAC[convex_local_fan] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th2-> ASSUME_TAC th2 THEN MP_TAC th2 +THEN REWRITE_TAC[local_fan] +THEN LET_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th3-> ASSUME_TAC(SYM th3)) +THEN STRIP_TAC) +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN MP_TAC(SET_RULE`{u,w} SUBSET V_SY(vecmats(l)) ==> w IN V_SY(vecmats(l:real^(M,3)finite_product)) /\ u IN V_SY(vecmats(l))`) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th +THEN REWRITE_TAC[F_SY;IN_ELIM_THM;] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN ABBREV_TAC`y=row i (vecmats (l:real^(M,3)finite_product))` +THEN ABBREV_TAC`z=row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))` +THEN SUBGOAL_THEN `y IN V_SY (vecmats (l:real^(M,3)finite_product))`ASSUME_TAC; +REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; +MRESA_TAC (GEN_ALL Local_lemmas.LOFA_CARD_EE_V_1)[`F_SY (vecmats (l:real^(M,3)finite_product))`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`y:real^3`;`E_SY (vecmats (l:real^(M,3)finite_product))`;] +THEN ASM_REWRITE_TAC[wedge_in_fan_gt;ARITH_RULE`2>1`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETERMINE_WEDGE_IN_FAN)[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`(x:real^3#real^3)`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.PGSQVBL)[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`u:real^3`;`w:real^3`;`x:real^3#real^3`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{vec 0:real^3}`;`{u,w:real^3}`] +THEN MP_TAC(SET_RULE`aff_gt {vec 0} {u, w} SUBSET aff_ge {vec 0} {u, w} +/\ aff_ge {vec 0} {u, w} SUBSET wedge_ge (vec 0) y z (azim_cycle (EE y (E_SY (vecmats l))) (vec 0) y z) +==> aff_gt {vec 0} {u, w} SUBSET wedge_ge (vec 0) y z (azim_cycle (EE y (E_SY (vecmats (l:real^(M,3)finite_product)))) (vec 0) y z)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th`x:real^3#real^3`) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_DETERMINE_AZIM_IN_FA)[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`(x:real^3#real^3)`] +THEN ABBREV_TAC`y1=azim_cycle (EE y (E_SY (vecmats (l:real^(M,3)finite_product)))) (vec 0) y z` +THEN REWRITE_TAC[REAL_ARITH`a<= b<=> a=b\/ a< b`] +THEN STRIP_TAC; +MRESA_TAC(GEN_ALL Local_lemmas.AZIM_PI_WEDGE_GE_CROSS_DOT)[`y1:real^3`;`y:real^3`;`z:real^3`;`vec 0:real^3`] +THEN SUBGOAL_THEN`{y,row (SUC (i MOD k)) (vecmats l)} IN E_SY(vecmats(l:real^(M,3)finite_product))` ASSUME_TAC; +REWRITE_TAC[E_SY;rows;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`z:real^3`;`y:real^3`] +THEN MRESA_TAC Conforming.aff_3_rep_cross_dot[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC (GEN_ALL Nkezbfc_local.AZIM_PI_WEDGE_CROSS_DOT)[`y1:real^3`;`y:real^3`;`z:real^3`;`vec 0:real^3`] +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;REAL_ARITH`&0<= A<=> A= &0 \/ &0< A`] +THEN DISCH_THEN(LABEL_TAC"THY4") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"THY4"(fun th-> MRESA1_TAC th`x'':real^3`) +THEN SUBGOAL_THEN`x'' IN aff_gt {vec 0} {u, w} INTER aff {vec 0, y, z:real^3}` ASSUME_TAC; +ASM_REWRITE_TAC[INTER;IN_ELIM_THM]; +MRESAL_TAC(GEN_ALL AFF_GT_INTER_AFF_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i:num`;`a:num#num->real`;`b:num#num->real`;`u:real^3`;`w:real^3`;`y:real^3`;`z:real^3`;`l:real^(M,3)finite_product`][B_SY1;IN_ELIM_THM;CONDITION2_SY] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]; +POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`{y,row (SUC (i MOD k)) (vecmats l)} IN E_SY(vecmats(l:real^(M,3)finite_product))` ASSUME_TAC; +REWRITE_TAC[E_SY;rows;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`z:real^3`;`y:real^3`] +THEN MRESA_TAC Conforming.aff_3_rep_cross_dot[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.AZIM_CYCLE_EQ_SIGMA_FAN)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC(sigma_fan_in_set_of_edge)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`row i (vecmats (l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`;] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats (l:real^(M,3)finite_product))) (E_SY (vecmats (l:real^(M,3)finite_product))) (row i (vecmats (l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`row i (vecmats(l:real^(M,3)finite_product))`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.WEDGE_GE_EQ_AFF_GE)[`vec 0:real^3`;`y:real^3`;`z:real^3`;`(azim_cycle (EE y (E_SY (vecmats (l:real^(M,3)finite_product)))) (vec 0) y z)`] +THEN MP_TAC(REAL_ARITH`&0<= azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))) +==> azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))) = &0 \/ +&0< azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))))`) +THEN ASM_REWRITE_TAC[azim] +THEN STRIP_TAC; +MRESA_TAC Fan.UNIQUE_AZIM_0_POINT_FAN[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`] +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.FAN_IMP_EE_EQ_SET_OF_EDGE)[`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_CARD_EE_V_1)[`F_SY (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`row i (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`] +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge (row i (vecmats l)) (V_SY (vecmats l)) (E_SY (vecmats l)) ={row (SUC (i MOD dimindex (:M))) (vecmats l)} +\/ ~(set_of_edge (row i (vecmats l)) (V_SY (vecmats l)) (E_SY (vecmats l)) ={(row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))})`); +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; +MRESA_TAC SIGMA_FAN[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A=B<=>B=A`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]); +MP_TAC(REAL_ARITH` +&0 ~(azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))) = + &0 \/ + azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))) = + pi)`) +THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN STRIP_TAC +THEN MRESA_TAC( GEN_ALL Nkezbfc_local.inter_aff_ge_3_1_is_aff_ge_2_2)[`vec 0:real^3`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`row i (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC Planarity.cross_dot_fully_surrounded_fan[`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`][VECTOR_ARITH`A- vec 0=A`] +THEN MRESAL_TAC Nkezbfc_local.aff_ge_3_1_rep_cross_dot [`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`][VECTOR_ARITH`A- vec 0=A`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN MRESAL_TAC Nkezbfc_local.aff_ge_3_1_rep_cross_dot [`vec 0:real^3`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`][VECTOR_ARITH`A- vec 0=A`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN MRESA_TAC WEDGE_LUNE[`vec 0:real^3`;`y:real^3`;`z:real^3`;`y1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN RESA_TAC +THEN MRESA_TAC(inter_aff_gt_3_1_is_aff_gt_2_2)[`vec 0:real^3`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`row i (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot [`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`][VECTOR_ARITH`A- vec 0=A`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot [`vec 0:real^3`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`][VECTOR_ARITH`A- vec 0=A`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN RESA_TAC +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;INTER] +THEN DISCH_THEN(LABEL_TAC"YEU1") +THEN REPEAT STRIP_TAC; +REMOVE_THEN "YEU1"(fun th-> MRESA1_TAC th`x'':real^3`) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`&0<= A<=> A= &0 \/ &0< A`] +THEN STRIP_TAC; +SUBGOAL_THEN`x'' IN aff_gt {vec 0} {u, w} INTER aff {vec 0, y, z:real^3}` ASSUME_TAC; +ASM_REWRITE_TAC[INTER;IN_ELIM_THM;VECTOR_ARITH`A- vec 0=A`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ASM_REWRITE_TAC[]; +MRESAL_TAC(GEN_ALL AFF_GT_INTER_AFF_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i:num`;`a:num#num->real`;`b:num#num->real`;`u:real^3`;`w:real^3`;`y:real^3`;`z:real^3`;`l:real^(M,3)finite_product`][B_SY1;IN_ELIM_THM;CONDITION2_SY] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]; +REMOVE_THEN "YEU1"(fun th-> MRESA1_TAC th`x'':real^3`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`&0<= A<=> A= &0 \/ &0< A`] +THEN STRIP_TAC; +SUBGOAL_THEN`x'' IN aff_gt {vec 0} {u, w} INTER aff {vec 0, y1, y:real^3}` ASSUME_TAC; +MRESA_TAC Conforming.aff_3_rep_cross_dot[`vec 0:real^3`;`y1:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM;VECTOR_ARITH`A- vec 0=A`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN MRESA_TAC(GEN_ALL Lvducxu.AZIM_CY_FST_Y_IN_FF)[`x':real^3#real^3`;`F_SY (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`;`vec 0:real^3`;`x:real^3#real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[F_SY;IN_ELIM_THM;PAIR_EQ] +THEN STRIP_TAC +THEN MRESAL_TAC(GEN_ALL AFF_GT_INTER_AFF_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`i':num`;`a:num#num->real`;`b:num#num->real`;`u:real^3`;`w:real^3`;`y1:real^3`;`y:real^3`;`l:real^(M,3)finite_product`][B_SY1;IN_ELIM_THM;CONDITION2_SY] +THEN SET_TAC[]]);; + + +let TECOXBM2= prove(`!l:real^(M,3)finite_product. stable_system k (d:real) (0..k-1) a b J (\i. ((1+i):num MOD k)) /\ k= dimindex(:M)/\ 2 ~(collinear ({vec 0} UNION {u,w}))`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM( fun th-> ASSUME_TAC th THEN MP_TAC th THEN REWRITE_TAC[B_SY1;IN_ELIM_THM;CONDITION2_SY] THEN STRIP_TAC) +THEN MRESA1_TAC (GEN_ALL VECMATS_MATVEC_ID)`v:real^3^M` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th +THEN REWRITE_TAC[convex_local_fan] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th1-> MP_TAC th1 +THEN REWRITE_TAC[local_fan] +THEN LET_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th2-> ASSUME_TAC (SYM th2)) +THEN STRIP_TAC +THEN ASSUME_TAC th1) +THEN DISCH_THEN(LABEL_TAC"THY1") +THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(SYM th)) +THEN MATCH_MP_TAC NONPARALLEL_BALL_ANNULUS +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`{u, w} SUBSET V_SY (vecmats l) +==> u IN V_SY(vecmats l) /\ w IN V_SY(vecmats (l:real^(M,3)finite_product))`) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN"THY" (fun th-> MRESA1_TAC th`i:num` THEN MRESA1_TAC th`i':num` ));; + +let TECOXBM=prove(`!l:real^(M,3)finite_product. stable_system k (d:real) (0..k-1) a b J (\i. ((1+i):num MOD k)) /\ k= dimindex(:M)/\ 2 ~(collinear ({vec 0} UNION {u,w})) +/\ (!x. x IN F_SY(vecmats l)==> aff_gt {vec 0}{u,w} SUBSET wedge_in_fan_gt x (E_SY (vecmats l)))`, +GEN_TAC +THEN STRIP_TAC +THEN STRIP_TAC +THENL[MRESA_TAC (GEN_ALL TECOXBM2)[`d:real`;`J:(num->bool)->bool`;`k:num`;`a:num#num->real`;`b:num#num->real`;`u:real^3`;`w:real^3`;`l:real^(M,3)finite_product`]; +MRESA_TAC (GEN_ALL TECOXBM1)[`d:real`;`J:(num->bool)->bool`;`k:num`;`a:num#num->real`;`b:num#num->real`;`u:real^3`;`w:real^3`;`l:real^(M,3)finite_product`]]);; + + +end;; + diff --git a/text_formalization/local/TFITSKC.hl b/text_formalization/local/TFITSKC.hl new file mode 100644 index 0000000..83f55be --- /dev/null +++ b/text_formalization/local/TFITSKC.hl @@ -0,0 +1,673 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Tfitskc = struct + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +open Yxionxl2;; +open Eyypqdw;; +open Ocbicby;; +open Imjxphr;; + +open Nuxcoea;; +open Aursipd;; +open Cuxvzoz;; +open Rrcwnsj;; + + + +let SCS_DIAG_A_LE_DIST=prove(`(!i j. scs_diag (scs_k_v39 s) i j ==> (scs_a_v39 s i j <= cstab /\ cstab < dist(v i, v j)/\ &4 * h0 < scs_b_v39 s i j)) +==> (!i j. scs_diag (scs_k_v39 s) i j ==> (scs_a_v39 s i j < dist(v i, (v:num->real^3) j)))`, +REPEAT RESA_TAC +THEN THAYTHE_TAC 1[`i`;`j`] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + +let DIST_EQ_2_IMP_A_EQ_2=prove(`is_scs_v39 s/\ BBs_v39 s v /\ dist (v i,v (SUC i)) = &2 +==> scs_a_v39 s i (SUC i) = &2`, +REWRITE_TAC[LET_DEF;LET_END_DEF;BBs_v39;is_scs_v39] +THEN RESA_TAC +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`i MOD k`;`SUC i MOD k `;`s:scs_v39`;`i`;`SUC i`][MOD_REFL;MOD_MULT_ADD;ARITH_RULE`3<=k==> ~(k=0)/\ 1 ~(k=0)/\ 1 scs_diag k i (SUC (SUC i))`, +STRIP_TAC +THEN REWRITE_TAC[scs_diag;ADD1] +THEN MP_TAC(ARITH_RULE`3 (i+1)+1=i+2/\ (i+2)+1=i+3/\ ~(k=0)/\ k-1 i MOD k= (i+0) MOD k`) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[ARITH_RULE`x+0=x`] +THEN RESA_TAC +THEN ASM_SIMP_TAC[Ocbicby.MOD_EQ_MOD_SHIFT;MOD_LT]);; + + +let TFITSKCv1_concl = ` +main_nonlinear_terminal_v11 +==> (!s (v:num->real^3) i. +(!i'. ~scs_J_v39 s (SUC (SUC i)) i')/\ + scs_a_v39 s (SUC (SUC i)) (SUC(SUC(SUC i)))< scs_b_v39 s (SUC (SUC i)) (SUC(SUC(SUC i))) /\ +3< scs_k_v39 s /\ +is_scs_v39 s /\ v IN MMs_v39 s /\ scs_generic v /\ scs_basic_v39 s /\ + scs_a_v39 s (i+1) (i+2) = &2 /\ scs_b_v39 s (i+1) (i+2) <= &2 * h0 /\ + dist(v i,v (i+1)) = &2 /\ dist(v i,v (i+1))< scs_b_v39 s i (i+1) /\ + (!i j. scs_diag (scs_k_v39 s) i j ==> (scs_a_v39 s i j <= cstab /\ cstab < dist(v i, v j)/\ &4 * h0 < scs_b_v39 s i j)) ==> + dist(v (i+1),v(i+2)) = &2)`;; + + + + + + +let TFITSKCv1=prove_by_refinement( TFITSKCv1_concl, +[ +STRIP_TAC +THEN REWRITE_TAC[IN;GSYM ADD1;ARITH_RULE`i+2=SUC(SUC i)`;scs_generic] +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN ABBREV_TAC`V=(IMAGE (v:num->real^3) (:num))` +THEN ABBREV_TAC`E=(IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num))` +THEN ABBREV_TAC`FF=IMAGE (\i. ((v:num->real^3) i, v (SUC i))) (:num)` +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`k`;`s`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MP_TAC SCS_DIAG_A_LE_DIST +THEN RESA_TAC +THEN MRESAL_TAC Axjrpnc.DIST_EDGE_IN_BB_LE_2[`s`;`v`;`SUC i`][ARITH_RULE`SUC(i+1)=i+2`;GSYM dist] +THEN MP_TAC(REAL_ARITH`&2 <= dist (v (SUC i),v (SUC(SUC i))) +==> dist (v (SUC i),v (SUC(SUC i))) = &2 \/ &2 < dist (v (SUC i),(v:num->real^3) (SUC(SUC i)))`) +THEN RESA_TAC +THEN MRESA_TAC WL_IN_V[`i`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`SUC i`;`v:num->real^3`] +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v (SUC i)`;`v`;`SUC i`;`k`] +THEN MRESAL_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v (SUC i)`][GSYM ADD1] +THEN THAYTHE_TAC 0[`v i`] +THEN MP_TAC(REAL_ARITH`azim (vec 0) (v (SUC i)) (v (SUC (SUC i))) (v i) <= pi +==> azim (vec 0) (v (SUC i)) (v (SUC (SUC i))) (v i) = pi +\/ azim (vec 0) (v (SUC i)) (v (SUC (SUC i))) ((v:num->real^3) i) < pi`) +THEN RESA_TAC; + + + +MP_TAC Jcyfmrp.J_EMPY_CASES_A_EQ_2_V1 +THEN DICH_TAC 0 +THEN REWRITE_TAC[SET_RULE`(a = {})<=> !i. ~ (a i)`] +THEN STRIP_TAC +THEN MP_TAC DIST_EQ_2_IMP_A_EQ_2 +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESAL_TAC MMS_IMP_BBPRIME[`s`;`v`][LET_DEF;LET_END_DEF;BBprime_v39] +THEN MRESA_TAC Imjxphr.EQ_W_L_IN_BBS[`s`;`k`;`v`;`i`] +THEN MRESAL_TAC JKQEWGV2[`s`;`v`][LET_DEF;LET_END_DEF;scs_generic] +THEN MP_TAC Wrgcvdr_cizmrrh.CIZMRRH +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_EXISTS_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN`(!V' E' v1. V' = V /\ E' = E ==> ~lunar (v1,(v:num->real^3) (SUC i)) V' E')` ASSUME_TAC; + + + +REPEAT RESA_TAC +; + + + +SUBGOAL_THEN`~collinear {vec 0, (v:num->real^3) (SUC (SUC i)), v (i)}` +ASSUME_TAC; + + +MRESAS_TAC WL_IN_V[`SUC (SUC i)`;`v:num->real^3`][BB_VV_FUN_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v (SUC(SUC i))`;`v i`;`V`] +THEN THAYTHES_TAC 0[`v (SUC(SUC i))`;`v i`][SET_RULE`a IN {a,b}`;BB_VV_FUN_EQ;ARITH_RULE`SUC (SUC x)=x+2`;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN MATCH_DICH_TAC 0 +THEN MP_TAC(SET_RULE`i= i+0==> i MOD k= (i+0) MOD k`) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[ARITH_RULE`x+0=x`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 0real^3) (SUC i) IN aff_gt {vec 0} {v (SUC (SUC i)), v (i)}` +ASSUME_TAC; + + + + +MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v ((SUC i))`;`v i`;`V`] +THEN THAYTHES_TAC 0[`v (SUC i)`;`v i`][SET_RULE`a IN {a,b}`;BB_VV_FUN_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;ADD1] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`i= i+0==> i MOD k= (i+0) MOD k`) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[ARITH_RULE`x+0=x`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 0real^3`][] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v (SUC (SUC i))`;`v (SUC i)`;`V`] +THEN THAYTHES_TAC 0[`(v:num->real^3) (SUC(SUC i))`;`v (SUC i)`][SET_RULE`a IN {a,b}`;BB_VV_FUN_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;ADD1;ARITH_RULE`(i+1)+1=i+2`;MOD_LT] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`i+2=(i+1)+1`;GSYM ADD1] +THEN REPEAT STRIP_TAC +THEN DICH_TAC 1 +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN DICH_TAC (45-3) +THEN REWRITE_TAC[GSYM ADD1;generic] +THEN STRIP_TAC +THEN MRESAL_TAC WL_IN_E[`SUC i`;`v:num->real^3`][] +THEN THAYTHE_TAC 1[`v (SUC i)`;`v(SUC(SUC i))`;`v i`] +THEN MRESAS_TAC Polar_fan.GENERIC_LOCAL_FAN_STRAIGHT_AFF_GE[`v i`;`v (SUC i)`;`v(SUC(SUC i))`;][] +THEN DICH_TAC 0 +THEN MRESA_TAC th3[`vec 0:real^3`;`v (SUC(SUC i))`;`v i`] +THEN MRESAS_TAC Local_lemmas.FAN_IMP_NOT_IN_AFF_GE[`E`;`V`;`v (SUC i)`;`vec 0:real^3`;`v i`][SET_RULE`{a,b} SUBSET A<=> a IN A/\ b IN A`;BB_VV_FUN_EQ;ADD1] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`i= i+0==> i MOD k= (i+0) MOD k`) +THEN GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o LAND_CONV o DEPTH_CONV)[ARITH_RULE`x+0=x`] +THEN ASM_SIMP_TAC[Ocbicby.MOD_EQ_MOD_SHIFT;MOD_LT] +THEN MRESAS_TAC Local_lemmas.FAN_IMP_NOT_IN_AFF_GE[`E`;`V`;`v (SUC i)`;`vec 0:real^3`;`v (SUC(SUC i))`][SET_RULE`{a,b} SUBSET A<=> a IN A/\ b IN A`;BB_VV_FUN_EQ;ADD1;ARITH_RULE`(i+1)+1=i+2`;MOD_LT;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`i+2=(i+1)+1`;GSYM ADD1] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESAL_TAC Wrgcvdr_cizmrrh.AFF_GE_TO_AFF_GT2_GE1[`v i`;`vec 0:real^3`;`v (SUC(SUC i))`][UNION;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]; + + + + +MRESAS_TAC NUXCOEAv2[`s`;`k`;`v`;`SUC i`;`i`][ARITH_RULE`SUC i + k - 1=SUC (i + k - 1)`]; + + + + +MRESAL_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC(SUC i)`][Fnjlbxs.in_ball_annulus] +THEN MP_TAC(REAL_ARITH`&2 <= norm (v (SUC(SUC i))) +==> norm (v (SUC(SUC i)))= &2\/ &2 < norm ((v:num->real^3) (SUC(SUC i)))`) +THEN RESA_TAC; + + + + + +MRESA_TAC Imjxphr.EQ_W_L_IN_BBS[`s`;`k`;`v`;`i`] +THEN MP_TAC SYNQIWN +THEN RESA_TAC +THEN THAYTHES_TAC 0[`s`;`v`;`SUC i`;`k`][Imjxphr.EQ_W_L_IN_BBS;ARITH_RULE`SUC i + k - 1=SUC( i + k - 1)`] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`dist (v (SUC (SUC i)),(v:num->real^3) (SUC i)) <= &2 * h0`ASSUME_TAC; + + + +REPLICATE_TAC (31-1) (POP_ASSUM MP_TAC) +THEN MP_TAC(ARITH_RULE`3 ~(k<=3)`) +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;is_scs_v39;BBs_v39] +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC (52-36)[`SUC(SUC i)`;`SUC i`]THEN DICH_TAC (56-29) +THEN DICH_TAC 0 +THEN REAL_ARITH_TAC; + + +ASM_REWRITE_TAC[] +THEN REWRITE_TAC[h0;REAL_ARITH`&2<= &2* #1.26`] +THEN SUBGOAL_THEN`cstab <= dist (v i,(v:num->real^3) (SUC (SUC i)))`ASSUME_TAC +; + + +MP_TAC(ARITH_RULE`3 SUC (i + k - 1)= i+ 1*k+0/\ ~(k<=3)/\ ~(k=0)/\ k-1 i MOD k= (i+0) MOD k`) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[ARITH_RULE`x+0=x`] +THEN RESA_TAC +THEN ASM_SIMP_TAC[Ocbicby.MOD_EQ_MOD_SHIFT;MOD_LT] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN DICH_TAC 1 +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MP_TAC(ARITH_RULE`3 SUC i+k-1=SUC(i+k-1)`) +THEN RESA_TAC +; + + +MP_TAC Cuxvzoz.CUXVZOZ +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`FF`;`k`;`SUC i`;`v`][scs_generic;GSYM ADD1;] +THEN MATCH_DICH_TAC 0 +THEN STRIP_TAC; + + +THAYTHES_TAC (35-10)[`i`;`SUC(SUC i)`][SCS_DIAG_2] +THEN DICH_TAC 1 +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + +REWRITE_TAC[REAL_ARITH`a<= a/\ &2<= #3.01`;cstab] +THEN STRIP_TAC; + + +REPEAT RESA_TAC +THEN THAYTHE_TAC (37-10)[`i'`;`j`] +THEN DICH_TAC 1 +THEN DICH_TAC 1 +THEN REAL_ARITH_TAC; + + +STRIP_TAC +; + + +REPEAT RESA_TAC +THEN THAYTHE_TAC (36-10)[`i'`;`j`] +; + +STRIP_TAC +; + + + +ASM_REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1;GSYM ADD1] +; + + + +ASM_REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1;GSYM ADD1] +; + + +MP_TAC(REAL_ARITH`&2 < norm ((v:num->real^3) (SUC (SUC i))) ==> ~(&2 = norm (v (SUC (SUC i))))`) +THEN RESA_TAC +THEN SUBGOAL_THEN`(!i'. scs_diag k (SUC (SUC i)) i' + ==> &4 * h0 < scs_b_v39 s (SUC (SUC i)) i')`ASSUME_TAC +; + + +REPEAT RESA_TAC +THEN THAYTHE_TAC(33-11)[`SUC(SUC i)`;`i'`] +; + + + + +MRESAL_TAC MMS_IMP_BBPRIME[`s`;`v`][LET_DEF;LET_END_DEF;BBprime_v39] +THEN MRESAL_TAC JKQEWGV2[`s`;`v`][LET_DEF;LET_END_DEF;scs_generic] +THEN MP_TAC Wrgcvdr_cizmrrh.CIZMRRH +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_EXISTS_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN`(!V' E' v1. V' = V /\ E' = E ==> ~lunar (v1,(v:num->real^3) (SUC (SUC i))) V' E')` ASSUME_TAC; + + + +REPEAT RESA_TAC; + +MRESA_TAC ODXLSTCv2[`s`;`k`;`v`;`SUC(SUC i)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN STRIP_TAC +THEN THAYTHEL_ASM_TAC (41-21)[`SUC(SUC i)`;`i'`][scs_diag;] +THEN DICH_TAC 1 +THEN REWRITE_TAC[DE_MORGAN_THM] +THEN ONCE_REWRITE_TAC[SET_RULE`A\/B<=> B\/A`] +THEN STRIP_TAC; + + + +POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[ADD1;ARITH_RULE`i+1=1+i`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`3 ~(k=0)`] +THEN REWRITE_TAC[ARITH_RULE`1+i= SUC i`] +THEN STRIP_TAC +THEN DICH_TAC 2 +THEN MRESA_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`i'`;`v:num->real^3`;`SUC i:num`] +THEN MRESAL_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`SUC(SUC i)`;`i' `;`s:scs_v39`;`SUC(SUC i)`;`SUC i`][] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF] +THEN REPEAT RESA_TAC +; + + + +SUBGOAL_THEN`scs_a_v39 s (SUC (SUC (SUC i))) (SUC (SUC i))= dist ((v:num->real^3) (SUC (SUC (SUC i))),v (SUC (SUC i)))`ASSUME_TAC +; + + +DICH_TAC 2 +THEN MRESAL_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`SUC(SUC i)`;`i' `;`s:scs_v39`;`SUC(SUC i)`;`SUC (SUC(SUC i))`][] +THEN MRESA_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`i'`;`v:num->real^3`;`SUC (SUC(SUC i)):num`] +THEN DICH_TAC(43-17) +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF] +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC 1[`SUC(SUC i)`;`SUC(SUC(SUC i))`] +THEN DICH_TAC 1 +THEN DICH_TAC 1 +THEN DICH_TAC(45-4) +THEN REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF] +THEN REPEAT RESA_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN REAL_ARITH_TAC; + + + + + +MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v (SUC (SUC i))`;`v`;`SUC (SUC i)`;`k`] +THEN MRESA_TAC WL_IN_V[`SUC (SUC i)`;`v:num->real^3`] +THEN MRESAL_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v (SUC (SUC i))`][GSYM ADD1] +THEN THAYTHE_TAC 0[`v (SUC i)`] +THEN MP_TAC(REAL_ARITH`azim (vec 0) (v (SUC (SUC i))) (v (SUC (SUC (SUC i)))) (v (SUC i)) <= pi +==> azim (vec 0) (v (SUC (SUC i))) (v (SUC (SUC (SUC i)))) (v (SUC i)) = pi +\/ azim (vec 0) (v (SUC (SUC i))) (v (SUC (SUC (SUC i)))) ((v:num->real^3) (SUC i)) < pi`) +THEN RESA_TAC; + + + +MRESA_TAC Imjxphr.EQ_W_L_IN_BBS[`s`;`k`;`v`;`SUC i`] +THEN SUBGOAL_THEN`dist ((v:num->real^3) (SUC (SUC (SUC i))),v (SUC (SUC i))) < + scs_b_v39 s (SUC (SUC (SUC i))) (SUC (SUC i))` ASSUME_TAC; + + + + +DICH_TAC(49-43) +THEN STRIP_TAC +THEN SYM_ASSUM_TAC +THEN DICH_TAC(48-4) +THEN REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF] +THEN REPEAT RESA_TAC +; + + +SUBGOAL_THEN`~collinear {vec 0, (v:num->real^3) (SUC (SUC (SUC i))), v ((SUC i))}` +ASSUME_TAC; + + +MRESAS_TAC WL_IN_V[`SUC (SUC (SUC i))`;`v:num->real^3`][BB_VV_FUN_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN MP_TAC(ARITH_RULE`3 ~(k=0)/\ 1real^3) (SUC (SUC i)) IN aff_gt {vec 0} {v (SUC (SUC (SUC i))), v (SUC i)}` +ASSUME_TAC; + + + +MP_TAC(ARITH_RULE`3 ~(k=0)/\ 0real^3`][] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v (SUC (SUC (SUC i)))`;`v (SUC (SUC i))`;`V`] +THEN THAYTHES_TAC 0[`(v:num->real^3) (SUC(SUC (SUC i)))`;`v (SUC (SUC i))`][SET_RULE`a IN {a,b}`;BB_VV_FUN_EQ;Ocbicby.MOD_EQ_MOD_SHIFT;ADD1;ARITH_RULE`(i+1)+1=i+2/\ (i+2)+1=i+3`;MOD_LT] +THEN DICH_TAC (60-6) +THEN REWRITE_TAC[GSYM ADD1;generic] +THEN STRIP_TAC +THEN MRESAL_TAC WL_IN_E[`SUC (SUC i)`;`v:num->real^3`][] +THEN THAYTHE_TAC 1[`v (SUC (SUC i))`;`v(SUC(SUC (SUC i)))`;`v (SUC i)`] +THEN MRESAS_TAC Polar_fan.GENERIC_LOCAL_FAN_STRAIGHT_AFF_GE[`v (SUC i)`;`v (SUC (SUC i))`;`v(SUC(SUC (SUC i)))`;][ARITH_RULE`SUC(SUC i)=i+2/\ SUC i= i+1/\ SUC(SUC(SUC i))=i+3`] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN DICH_TAC 0 +THEN MRESA_TAC th3[`vec 0:real^3`;`v (SUC(SUC (SUC i)))`;`v (SUC i)`] +THEN MRESAS_TAC Local_lemmas.FAN_IMP_NOT_IN_AFF_GE[`E`;`V`;`v (SUC (SUC i))`;`vec 0:real^3`;`v (SUC i)`][SET_RULE`{a,b} SUBSET A<=> a IN A/\ b IN A`;BB_VV_FUN_EQ;ADD1;ARITH_RULE`SUC(SUC i)=i+2/\ SUC i= i+1/\ SUC(SUC(SUC i))=i+3`;Ocbicby.MOD_EQ_MOD_SHIFT;MOD_LT] +THEN MRESAS_TAC Local_lemmas.FAN_IMP_NOT_IN_AFF_GE[`E`;`V`;`v (SUC (SUC i))`;`vec 0:real^3`;`v (SUC(SUC (SUC i)))`][SET_RULE`{a,b} SUBSET A<=> a IN A/\ b IN A`;BB_VV_FUN_EQ;ADD1;ARITH_RULE`SUC(SUC i)=i+2/\ SUC i= i+1/\ SUC(SUC(SUC i))=i+3`;Ocbicby.MOD_EQ_MOD_SHIFT;MOD_LT] +THEN MRESAL_TAC Wrgcvdr_cizmrrh.AFF_GE_TO_AFF_GT2_GE1[`v (SUC i)`;`vec 0:real^3`;`(v:num->real^3) (SUC(SUC (SUC i)))`][UNION;IN_ELIM_THM;ARITH_RULE`SUC(SUC i)=i+2/\ SUC i= i+1/\ SUC(SUC(SUC i))=i+3`] +THEN REPEAT STRIP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +; + + +MRESAS_TAC NUXCOEAv2[`s`;`k`;`v`;`SUC (SUC i)`;`SUC (SUC (SUC i))`][ARITH_RULE`SUC (SUC i) + k - 1=SUC (SUC i + k - 1)`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN SYM_ASSUM_TAC +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`SUC(SUC i)`;`SUC(SUC i+k-1)`;`s:scs_v39`;`SUC(SUC i)`;`SUC(SUC i+k-1) MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)`;] +THEN ASM_SIMP_TAC[ARITH_RULE`3 SUC (SUC i + k - 1) = 1*k+SUC i `;MOD_MULT_ADD] +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`SUC(SUC i)`;`SUC i MOD k`;`s:scs_v39`;`SUC(SUC i)`;`SUC i`][MOD_REFL;ARITH_RULE`3 ~(k=0)`;] +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC +; + + + + +ONCE_REWRITE_TAC[DIST_SYM] +THEN MP_TAC(ARITH_RULE`3 SUC i+k-1=SUC(i+k-1)`) +THEN RESA_TAC +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`SUC (SUC i)+k-1`;`v:num->real^3`;`(SUC (SUC i)+k-1)MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)`;ARITH_RULE`3 SUC (SUC i) + k - 1 = 1*k+SUC i `;] +THEN MRESAS_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`s`;`(SUC i) MOD k`;`v:num->real^3`;`(SUC i)`][MOD_REFL;ARITH_RULE`3 ~(k=0)`;ARITH_RULE`3 SUC (SUC i) + k - 1 = 1*k+SUC i `;] +; + + + +MP_TAC Cuxvzoz.CJBDXXN +THEN RESA_TAC +THEN THAYTHES_TAC 0[`s`;`FF`;`k`;`SUC(SUC i)`;`v`][scs_generic;MOD_MULT_ADD;ARITH_RULE`3 SUC (SUC i) + k - 1 = 1*k+SUC i `;] +THEN MATCH_DICH_TAC 0 +THEN STRIP_TAC; + + + +ASM_REWRITE_TAC[GSYM ADD1] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MRESA_TAC SCS_DIAG_2[`k`;`SUC i`] +THEN THAYTHE_TAC (52-12)[`SUC i`;`SUC(SUC(SUC i))`] +THEN DICH_TAC 1 +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + +STRIP_TAC +; + + +ASM_SIMP_TAC[interior_angle1;GSYM ivs_rho_node1;ARITH_RULE`3 SUC (SUC i) + k - 1 = 1*k+SUC i `;MOD_MULT_ADD;GSYM ADD1] +; + + +STRIP_TAC +; + + +ASM_SIMP_TAC[interior_angle1;GSYM ivs_rho_node1;ARITH_RULE`3 SUC (SUC i) + k - 1 = 1*k+SUC i `;MOD_MULT_ADD;GSYM ADD1] +THEN MRESA_TAC Rrcwnsj.BB_F_SUC_PRE[`s`;`v`;`i`] +; + + + +STRIP_TAC +; + + +MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`SUC(SUC i)`;`(1*k+SUC i) `;`s:scs_v39`;`SUC(SUC i)`;`(1*k+SUC i)MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)`;MOD_MULT_ADD] +THEN MRESAS_TAC(GEN_ALL CHANGE_A_SCS_MOD)[`SUC(SUC i)`;`(SUC i) MOD k`;`s:scs_v39`;`SUC(SUC i)`;`SUC i`][MOD_REFL;ARITH_RULE`3 ~(k=0)`;MOD_MULT_ADD] +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC +; + + + +STRIP_TAC +; + + + +MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`SUC(SUC i)`;`(1*k+SUC i) `;`s:scs_v39`;`SUC(SUC i)`;`(1*k+SUC i)MOD k`][MOD_REFL;ARITH_RULE`3 ~(k=0)`;MOD_MULT_ADD] +THEN MRESAS_TAC(GEN_ALL CHANGE_B_SCS_MOD)[`SUC(SUC i)`;`(SUC i) MOD k`;`s:scs_v39`;`SUC(SUC i)`;`SUC i`][MOD_REFL;ARITH_RULE`3 ~(k=0)`;MOD_MULT_ADD] +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC +THEN REAL_ARITH_TAC; + + +REWRITE_TAC[GSYM ADD1] +THEN ONCE_REWRITE_TAC[DIST_SYM]; + +MRESAL_TAC Axjrpnc.DIST_EDGE_IN_BB_LE_2[`s`;`v`;`SUC(SUC i)`][GSYM dist]; + + +DICH_TAC (52-4) +THEN ASM_REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF] +THEN STRIP_TAC +THEN THAYTHE_TAC (71-68)[`SUC(SUC i)`] +THEN DICH_TAC(71-16) +THEN ASM_REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF] +THEN STRIP_TAC +THEN THAYTHE_TAC 0[`SUC(SUC i)`;`SUC(SUC(SUC i))`] +THEN POP_ASSUM MP_TAC +THEN DICH_TAC 3 +THEN REAL_ARITH_TAC; + + + +]);; + + + + +let TFITSKC_concl = ` +main_nonlinear_terminal_v11 +==> (!s (v:num->real^3) i. + scs_a_v39 s (i+2) (i+3)< scs_b_v39 s (i+2) (i+3) /\ +3< scs_k_v39 s /\ +is_scs_v39 s /\ v IN MMs_v39 s /\ scs_generic v /\ scs_basic_v39 s /\ + scs_a_v39 s (i+1) (i+2) = &2 /\ scs_b_v39 s (i+1) (i+2) <= &2 * h0 /\ + dist(v i,v (i+1)) = &2 /\ &2< scs_b_v39 s i (i+1) /\ + (!i j. scs_diag (scs_k_v39 s) i j ==> (scs_a_v39 s i j <= cstab /\ cstab < dist(v i, v j)/\ &4 * h0 < scs_b_v39 s i j)) ==> + dist(v (i+1),v(i+2)) = &2)`;; + + + +let TFITSKC=prove( TFITSKC_concl, +STRIP_TAC +THEN REPEAT STRIP_TAC +THEN MP_TAC TFITSKCv1 +THEN RESA_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN EXISTS_TAC`s:scs_v39` +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(SUC i)=i+2/\ SUC i+2=i+3`] +THEN ASM_TAC +THEN REWRITE_TAC[scs_basic] +THEN REPEAT RESA_TAC);; + + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/UAGHHBM.hl b/text_formalization/local/UAGHHBM.hl new file mode 100755 index 0000000..1289881 --- /dev/null +++ b/text_formalization/local/UAGHHBM.hl @@ -0,0 +1,4153 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Uaghhbm = struct + + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + + + + + +let PERIODIC_PSORT=prove(`~(k=0)==>psort (k) (i + k,j) = psort (k) (i,j)/\ +psort (k) (i,j+k) = psort (k) (i,j) `, +REWRITE_TAC[psort;LET_DEF;LET_END_DEF;] +THEN STRIP_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`j:num`][ARITH_RULE`1*k+i=i+k`]);; + + +let CASE_PSORT=prove(`psort (k) (i,j) = psort (k) (i',j') +==> (i MOD k=i' MOD k/\ j MOD k= j' MOD k)\/(i MOD k=j' MOD k/\ j MOD k= i' MOD k)`, +REWRITE_TAC[psort;LET_DEF;LET_END_DEF;] +THEN MP_TAC(ARITH_RULE`i MOD k <= j MOD k \/ ~(i MOD k <= j MOD k)`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`i' MOD k <= j' MOD k \/ ~(i' MOD k <= j' MOD k)`) +THEN RESA_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN SET_TAC[]);; + +let C_LE_2_IS_SCS=prove(`is_scs_v39 s /\ ~(i MOD scs_k_v39 s=j MOD scs_k_v39 s) +/\ scs_a_v39 s i j <= c +==> &2<= c`, +REWRITE_TAC[is_scs_v39;periodic2] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN REPLICATE_TAC (27-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i MOD k`;`j MOD k`]) +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC);; + + + +let C_LT_2_IS_SCS=prove(`is_scs_v39 s /\ ~(i MOD scs_k_v39 s=j MOD scs_k_v39 s) +/\ scs_a_v39 s i j < c +==> &2< c`, +REWRITE_TAC[is_scs_v39;periodic2] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN REPLICATE_TAC (27-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i MOD k`;`j MOD k`]) +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC);; + + + +let A_LE_A_OVERRIDE=prove_by_refinement( +`is_scs_v39 s/\ + scs_a_v39 s i j <= c +==> scs_a_v39 s i' j' <= override (scs_a_v39 s) (scs_k_v39 s) (i,j) c i' j' `, +[ + +ASM_REWRITE_TAC[override;periodic2;LET_DEF;LET_END_DEF;TRIV_OR_FORALL_THM] +THEN MP_TAC(SET_RULE`~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j')) \/ (psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC; + +REAL_ARITH_TAC; + +REWRITE_TAC[is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC; + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`j':num`;`j:num`;`i':num`;`k:num`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`])]);; + + + + + + + +let B_OVERRIDE_LE_B=prove_by_refinement( +`is_scs_v39 s/\ + c <= scs_b_v39 s i j +==> override (scs_b_v39 s) (scs_k_v39 s) (i,j) c i' j' <= scs_b_v39 s i' j'`, +[ +ASM_REWRITE_TAC[override;periodic2;LET_DEF;LET_END_DEF;TRIV_OR_FORALL_THM] +THEN MP_TAC(SET_RULE`~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j')) \/ (psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC; + +REAL_ARITH_TAC; + +REWRITE_TAC[is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC; + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`j':num`;`j:num`;`i':num`;`k:num`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (j' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`])]);; + + + +let BB_EQ_UNION_BB_SUBDIVISION=prove_by_refinement(` + is_scs_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j +==> +BBs_v39 s = BBs_v39 (restriction_cs1_v39 s i j c) UNION BBs_v39 (restriction_cs2_v39 s i j c)`, +[ +REWRITE_TAC[is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC; + +REWRITE_TAC[IN] +THEN ASM_REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_v39_explicit;restriction_cs1_v39;restriction_cs2_v39] +THEN EQ_TAC; + +RESA_TAC; + +ASM_REWRITE_TAC[override;periodic2;LET_DEF;LET_END_DEF;TRIV_OR_FORALL_THM] +THEN MP_TAC(SET_RULE`(!i' j'. + dist ((x:num->real^3) i',x j') <= + (if psort k (i,j) = psort k (i',j') then c else scs_b_v39 s i' j'))\/ +~(!i' j'. + dist (x i',x j') <= + (if psort k (i,j) = psort k (i',j') then c else scs_b_v39 s i' j'))`) +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM] +THEN RESA_TAC; + + + +POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j')) \/ (psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC; + + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i'',j'') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i'',j''))`) +THEN RESA_TAC; + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i':num`;`j'':num`;`j':num`;`i'':num`;`k:num`]; + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`x:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i'':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j'':num`[ARITH_RULE`4 MOD 4=0`]) +THEN REAL_ARITH_TAC +; + + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`x:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i'':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j'':num`[ARITH_RULE`4 MOD 4=0`]) +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + + + + + +ASM_REWRITE_TAC[override;periodic2;LET_DEF;LET_END_DEF;TRIV_OR_FORALL_THM] +THEN MP_TAC(SET_RULE`(!i' j'. + dist ((x:num->real^3) i',x j') <= + (if psort k (i,j) = psort k (i',j') then c else scs_b_v39 s i' j'))\/ +~(!i' j'. + dist (x i',x j') <= + (if psort k (i,j) = psort k (i',j') then c else scs_b_v39 s i' j'))`) +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM] +THEN RESA_TAC; + + + +POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j')) \/ (psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC; + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i'',j'') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i'',j''))`) +THEN RESA_TAC; + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i':num`;`j'':num`;`j':num`;`i'':num`;`k:num`]; + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`x:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i'':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j'':num`[ARITH_RULE`4 MOD 4=0`]) +THEN REAL_ARITH_TAC +; + + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`x:num->real^3`][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i'':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j'':num`[ARITH_RULE`4 MOD 4=0`]) +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +RESA_TAC; + +REPEAT GEN_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i':num`;`j':num`]) +THEN MP_TAC B_OVERRIDE_LE_B +THEN ASM_REWRITE_TAC[is_scs_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM] +THEN REPLICATE_TAC (27-18)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN RESA_TAC) +THEN REAL_ARITH_TAC; + +REPEAT GEN_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i':num`;`j':num`]) +THEN MP_TAC B_OVERRIDE_LE_B +THEN ASM_REWRITE_TAC[is_scs_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM] +THEN REPLICATE_TAC (27-18)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN RESA_TAC) +THEN REAL_ARITH_TAC; + +REPEAT GEN_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i':num`;`j':num`]) +THEN REMOVE_ASSUM_TAC +THEN MP_TAC A_LE_A_OVERRIDE +THEN ASM_REWRITE_TAC[is_scs_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM] +THEN REPLICATE_TAC (26-18)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN RESA_TAC) +THEN REAL_ARITH_TAC +; +REPEAT GEN_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`i':num`;`j':num`]) +THEN REMOVE_ASSUM_TAC +THEN MP_TAC A_LE_A_OVERRIDE +THEN ASM_REWRITE_TAC[is_scs_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM] +THEN REPLICATE_TAC (26-18)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC th +THEN RESA_TAC) +THEN REAL_ARITH_TAC; +]);; + + +let SUBDIVISION_IS_NOT_EAR=prove(`3< scs_k_v39 s +==> +~(is_ear_v39 s)/\ ~(is_ear_v39 (restriction_cs1_v39 s i j c)) /\ ~(is_ear_v39 (restriction_cs2_v39 s i j c))`, +REWRITE_TAC[is_scs_v39;is_ear_v39;restriction_cs1_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;unadorned_v39;restriction_cs2_v39] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3< scs_k_v39 s ==> ~(scs_k_v39 s =3)`) +THEN RESA_TAC);; + + + +let SUBDIVISION_CS1_DSV_EQ=prove(` + 3< scs_k_v39 s +==> +dsv_v39 (restriction_cs1_v39 s i j c) ww =dsv_v39 s ww +/\ dsv_v39 (restriction_cs2_v39 s i j c) ww =dsv_v39 s ww`, +STRIP_TAC +THEN MP_TAC SUBDIVISION_IS_NOT_EAR +THEN RESA_TAC +THEN ASM_REWRITE_TAC[dsv_v39] +THEN REWRITE_TAC[MMs_v39;BBprime2_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM;dsv_v39;restriction_cs1_v39;restriction_cs2_v39]);; + + +let SUBDIVISION_CS1_TAUSTAR_EQ=prove(` + 3< scs_k_v39 s +==> +taustar_v39 (restriction_cs1_v39 s i j c) ww =taustar_v39 s ww /\ +taustar_v39 (restriction_cs2_v39 s i j c) ww =taustar_v39 s ww`, +STRIP_TAC +THEN MP_TAC SUBDIVISION_CS1_DSV_EQ +THEN RESA_TAC +THEN ASM_REWRITE_TAC[taustar_v39] +THEN MP_TAC(ARITH_RULE`3< scs_k_v39 s ==> ~(scs_k_v39 s <=3)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[MMs_v39;BBprime2_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM;taustar_v39;restriction_cs1_v39;restriction_cs2_v39]);; + + + +let BBPRIME_SUBSET_SUBDIVISION_UNION=prove_by_refinement(` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ + BBprime_v39 s ww +==> + ww IN BBprime_v39 (restriction_cs1_v39 s i j c) UNION BBprime_v39 (restriction_cs2_v39 s i j c)`, +[ +STRIP_TAC +THEN MP_TAC BB_EQ_UNION_BB_SUBDIVISION +THEN RESA_TAC +THEN ASM_TAC +THEN +REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC; + +REWRITE_TAC[IN] +THEN ASM_REWRITE_TAC[BBprime_v39;LET_DEF;LET_END_DEF;scs_v39_explicit;] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> STRIP_TAC +THEN MRESAL1_TAC th`ww:num->real^3`[IN] +THEN ASSUME_TAC(th)); + +MATCH_MP_TAC(SET_RULE`A==> A\/B`) +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`ww:num->real^3`] +THEN GEN_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESAL1_TAC th`ww':num->real^3`[IN]) +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`ww':num->real^3`] +THEN REPLICATE_TAC (32-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +MATCH_MP_TAC(SET_RULE`A==> B\/A`) +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`ww:num->real^3`] +THEN GEN_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESAL1_TAC th`ww':num->real^3`[IN]) +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`ww':num->real^3`] +THEN REPLICATE_TAC (32-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]]);; + + + +let BBPRIME_SUBSET_BBPRIME_SUBDIVISION_UNION = prove( +`is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j + ==> BBprime_v39 s SUBSET BBprime_v39 (restriction_cs1_v39 s i j c) UNION BBprime_v39 (restriction_cs2_v39 s i j c)`, +REWRITE_TAC[SUBSET] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC BBPRIME_SUBSET_SUBDIVISION_UNION +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN]);; + + +(**********c< norm(ww i- ww j)*********) + +let BBINDEX_EQ_SUBDIVISION=prove_by_refinement( +` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ + BBs_v39 s ww /\ c< norm(ww i- ww j) +==> +BBindex_v39 s ww = BBindex_v39 (restriction_cs2_v39 s i j c) ww`, +[ +STRIP_TAC +THEN MP_TAC BB_EQ_UNION_BB_SUBDIVISION +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[BBindex_v39] +THEN +REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM;restriction_cs2_v39] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC; + +MATCH_MP_TAC CARD_IMAGE_INJ_EQ +THEN REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`(\i:num. i)` +THEN STRIP_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + +STRIP_TAC; + +REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`psort k (i,j) = psort k (x,SUC x) \/ ~(psort k (i,j) = psort k (x,SUC x))`) +THEN RESA_TAC; + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`SUC x:num`;`j:num`;`x:num`;`k:num`]; + +ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (32-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`;dist]) +THEN REAL_ARITH_TAC; + +ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (32-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`;]) +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN REAL_ARITH_TAC; + +REPEAT RESA_TAC; + +REWRITE_TAC[EXISTS_UNIQUE] +THEN EXISTS_TAC`y:num` +THEN ASM_REWRITE_TAC[] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`psort k (i,j) = psort k (y,SUC y) \/ ~(psort k (i,j) = psort k (y,SUC y))`) +THEN RESA_TAC; + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`SUC y:num`;`j:num`;`y:num`;`k:num`]; + +ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (32-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`y:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC y:num`[ARITH_RULE`4 MOD 4=0`;]) +THEN REPLICATE_TAC (37-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s y`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC y:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC y MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`y:num`[ARITH_RULE`4 MOD 4=0`;dist]) +THEN REAL_ARITH_TAC; + +ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (35-28)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`y:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC y:num`[ARITH_RULE`4 MOD 4=0`;]) +THEN REPLICATE_TAC (37-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s y`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC y:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC y MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`y:num`[ARITH_RULE`4 MOD 4=0`;]) +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN REAL_ARITH_TAC;]);; + + +let BB_INTER_BBPRIME_SUBDIVISION2= prove_by_refinement(` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j +==> +(BBprime_v39 s) INTER (BBs_v39 (restriction_cs2_v39 s i j c)) SUBSET +(BBprime_v39 (restriction_cs2_v39 s i j c))`, +[ +STRIP_TAC +THEN MP_TAC BB_EQ_UNION_BB_SUBDIVISION +THEN RESA_TAC +THEN REWRITE_TAC[INTER;EXTENSION;IN_ELIM_THM;SUBSET] +THEN GEN_TAC; + +REWRITE_TAC[SUBSET;UNION;IN_ELIM_THM;] +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN +REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM;BBprime_v39;IN] +THEN ASM_REWRITE_TAC[] +THEN REPEAT RESA_TAC; + +REPLICATE_TAC (11-6)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th`ww':num->real^3`) +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`ww:num->real^3`] +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`x:num->real^3`] +THEN REPLICATE_TAC (13-5)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`x:num->real^3`]; + +REPLICATE_TAC (10-6)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th`ww':num->real^3`) +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`ww:num->real^3`] +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`x:num->real^3`] +THEN REPLICATE_TAC (14-7)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`x:num->real^3`]]);; + + + + +let CONDITION_BBPRIME_SUBSET_BBPRIME_SUBDIVISION= prove_by_refinement(` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ +BBprime_v39 s ww /\ c< norm(ww i- ww j) +==> +BBs_v39 (restriction_cs2_v39 s i j c) ww`, +[ +REWRITE_TAC[MMs_v39;BBs_v39;BBprime_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM;SUBSET;restriction_cs2_v39] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN REPEAT RESA_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MP_TAC th) +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC; + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`j':num`;`j:num`;`i':num`;`k:num`]; + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;dist]) +THEN REAL_ARITH_TAC; + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;]) +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MP_TAC th) +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC; + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`j':num`;`j:num`;`i':num`;`k:num`]; + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;dist]) +THEN REAL_ARITH_TAC; + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;]) +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN REAL_ARITH_TAC]);; + +let BBPRIME_SUBDIVISION2_SUBSET_BBPRIME=prove_by_refinement(` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ +BBprime_v39 s ww /\ c< norm(ww i- ww j) +==> +(BBprime_v39 (restriction_cs2_v39 s i j c)) SUBSET (BBprime_v39 s) `, +[ +STRIP_TAC +THEN MP_TAC CONDITION_BBPRIME_SUBSET_BBPRIME_SUBDIVISION +THEN RESA_TAC +THEN MP_TAC BB_EQ_UNION_BB_SUBDIVISION +THEN ASM_REWRITE_TAC[EXTENSION;IN] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM;SUBSET;IN] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`ww:num->real^3`] +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`x:num->real^3`] +THEN REPLICATE_TAC (37-31)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`ww:num->real^3`) +THEN REPLICATE_TAC (37-29)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`ww':num->real^3`) +THEN REPLICATE_TAC (37-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`ww':num->real^3`) +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`ww:num->real^3`] +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`x:num->real^3`] +THEN REPLICATE_TAC (37-31)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`ww:num->real^3`) +THEN REPLICATE_TAC (37-29)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`ww':num->real^3`) +THEN REPLICATE_TAC (37-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`ww':num->real^3`) +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`x:num->real^3`]]);; + + + +let IN_BBPRIME_SUBDIVISION=prove_by_refinement(` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ +BBprime_v39 s ww /\ c< norm(ww i- ww j) +==> +BBprime_v39 (restriction_cs2_v39 s i j c) ww`, +[ +STRIP_TAC +THEN MP_TAC CONDITION_BBPRIME_SUBSET_BBPRIME_SUBDIVISION +THEN RESA_TAC +THEN MP_TAC BB_EQ_UNION_BB_SUBDIVISION +THEN ASM_REWRITE_TAC[EXTENSION;UNION;IN_ELIM_THM] +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[BBprime_v39] +THEN REPEAT RESA_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th -> STRIP_TAC +THEN MRESA1_TAC th`ww':num->real^3`) +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`ww:num->real^3`] +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`ww':num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM;SUBSET;IN] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (33-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`ww':num->real^3`); + +MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`ww:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM;SUBSET;IN] +THEN REPEAT RESA_TAC]);; + + + +let MIN_NUM_SUBSET=prove( +`X SUBSET Y/\ a IN X==> min_num Y<= min_num X`, +REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MRESA_TAC Misc_defs_and_lemmas.min_least[`X:num->bool`;`a:num`] +THEN MP_TAC(SET_RULE`X (min_num X) /\ X SUBSET Y==> Y (min_num X)`) +THEN RESA_TAC +THEN MRESA_TAC Misc_defs_and_lemmas.min_least[`Y:num->bool`;`min_num X`]);; + + +let BBINDEX_MIN_S_LE_SUBDIVISION2=prove_by_refinement(` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ + BBprime_v39 s ww /\ c< norm(ww i- ww j) +==> +BBindex_min_v39 s <= min_num + (IMAGE (BBindex_v39 s) + (BBprime_v39 (restriction_cs2_v39 s i j c)))`, +[ +STRIP_TAC +THEN MP_TAC BBPRIME_SUBSET_BBPRIME_SUBDIVISION_UNION +THEN RESA_TAC +THEN REWRITE_TAC[BBindex_min_v39] +THEN MATCH_MP_TAC(GEN_ALL MIN_NUM_SUBSET) +THEN EXISTS_TAC`BBindex_v39 s ww` +THEN STRIP_TAC; + +MATCH_MP_TAC IMAGE_SUBSET +THEN MP_TAC BBPRIME_SUBDIVISION2_SUBSET_BBPRIME +THEN RESA_TAC; + +REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`ww:num->real^3` +THEN REWRITE_TAC[IN] +THEN MP_TAC IN_BBPRIME_SUBDIVISION +THEN RESA_TAC]);; + + +let BBINDEX_BBPRIME_LE_SUBDIVISION2=prove_by_refinement(` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ + BBprime_v39 s ww /\ c< norm(ww i- ww j)/\ + BBprime_v39 (restriction_cs2_v39 s i j c) vv +==> + BBindex_v39 s vv<= BBindex_v39 (restriction_cs2_v39 s i j c) vv`, +[ + +STRIP_TAC +THEN REWRITE_TAC[BBindex_v39] +THEN ASM_TAC +THEN +REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM;restriction_cs2_v39;IN;BBs_v39] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC; + + + +MATCH_MP_TAC CARD_SUBSET +THEN REWRITE_TAC[IN_ELIM_THM;SUBSET] +THEN REPEAT RESA_TAC; + + +MP_TAC(SET_RULE`psort k (i,j) = psort k (x,SUC x) \/ ~(psort k (i,j) = psort k (x,SUC x))`) +THEN RESA_TAC; + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`SUC x:num`;`j:num`;`x:num`;`k:num`] +THEN REPLICATE_TAC (41-33)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]) +THEN REMOVE_ASSUM_TAC +THEN REPLICATE_TAC (41-37)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (40-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`;]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s x`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC x MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`;]) +THEN REAL_ARITH_TAC; + + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + + + + + +MATCH_MP_TAC CARD_SUBSET +THEN REWRITE_TAC[IN_ELIM_THM;SUBSET] +THEN REPEAT RESA_TAC; + + +MP_TAC(SET_RULE`psort k (i,j) = psort k (x,SUC x) \/ ~(psort k (i,j) = psort k (x,SUC x))`) +THEN RESA_TAC; + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`SUC x:num`;`j:num`;`x:num`;`k:num`] +THEN REPLICATE_TAC (42-33)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]) +THEN REMOVE_ASSUM_TAC +THEN REPLICATE_TAC (42-37)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (41-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`;]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s x`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC x MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`;]) +THEN REAL_ARITH_TAC; + + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + + + + + + +MATCH_MP_TAC CARD_SUBSET +THEN REWRITE_TAC[IN_ELIM_THM;SUBSET] +THEN REPEAT RESA_TAC; + + +MP_TAC(SET_RULE`psort k (i,j) = psort k (x,SUC x) \/ ~(psort k (i,j) = psort k (x,SUC x))`) +THEN RESA_TAC; + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`SUC x:num`;`j:num`;`x:num`;`k:num`] +THEN REPLICATE_TAC (42-33)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]) +THEN REMOVE_ASSUM_TAC +THEN REPLICATE_TAC (42-37)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (41-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`;]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s x`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC x MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`;]) +THEN REAL_ARITH_TAC; + + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + + +MATCH_MP_TAC CARD_SUBSET +THEN REWRITE_TAC[IN_ELIM_THM;SUBSET] +THEN REPEAT RESA_TAC; + + +MP_TAC(SET_RULE`psort k (i,j) = psort k (x,SUC x) \/ ~(psort k (i,j) = psort k (x,SUC x))`) +THEN RESA_TAC; + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`SUC x:num`;`j:num`;`x:num`;`k:num`] +THEN REPLICATE_TAC (42-33)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]) +THEN REMOVE_ASSUM_TAC +THEN REPLICATE_TAC (42-37)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (41-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`;]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s x`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC x MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`;]) +THEN REAL_ARITH_TAC; + + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + + + +]);; + + +let MIN_NUM_LE_IMAGE=prove_by_refinement(` +(a:A) IN s/\ (!x. x IN s==> f x <= g x) ==> min_num (IMAGE f s)<= min_num (IMAGE g s)`, +[ +STRIP_TAC +THEN SUBGOAL_THEN `g (a:A) IN ((IMAGE g s):num->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`a:A` +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MRESA_TAC Misc_defs_and_lemmas.min_least[`(IMAGE g (s:A->bool)):num->bool`;`(g (a:A)):num`] +THEN SUBGOAL_THEN`(min_num (IMAGE g s)) IN IMAGE g (s:A->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[IN]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN STRIP_TAC +THEN REPLICATE_TAC (6-1)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`x:A`) +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN `f (x:A) IN ((IMAGE f s):num->bool)`ASSUME_TAC; + +ASM_REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`x:A` +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN] +THEN STRIP_TAC + THEN MRESA_TAC Misc_defs_and_lemmas.min_least[`(IMAGE f (s:A->bool)):num->bool`;`(f:A->num) (x:A)`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[IMAGE;IN] +THEN ARITH_TAC]);; + + +let CLAIM_BBINDEX_BBPRIME_LE_SUBDIVISION2=prove(` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ + BBprime_v39 s ww /\ c< norm(ww i- ww j) +==> +min_num + (IMAGE (BBindex_v39 s) + (BBprime_v39 (restriction_cs2_v39 s i j c))) +<= min_num + (IMAGE (BBindex_v39 (restriction_cs2_v39 s i j c)) + (BBprime_v39 (restriction_cs2_v39 s i j c)))`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL MIN_NUM_LE_IMAGE) +THEN EXISTS_TAC`ww:num->real^3` +THEN MP_TAC IN_BBPRIME_SUBDIVISION +THEN ASM_REWRITE_TAC[IN] +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC BBINDEX_BBPRIME_LE_SUBDIVISION2 +THEN ASM_REWRITE_TAC[]);; + + +let BBindex_min_LE_SUBDIVISION2=prove(` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ + BBprime_v39 s ww /\ c< norm(ww i- ww j) +==> +BBindex_min_v39 s <= BBindex_min_v39 (restriction_cs2_v39 s i j c)`, +STRIP_TAC +THEN MP_TAC CLAIM_BBINDEX_BBPRIME_LE_SUBDIVISION2 +THEN RESA_TAC +THEN MP_TAC BBINDEX_MIN_S_LE_SUBDIVISION2 +THEN RESA_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN REWRITE_TAC[BBindex_min_v39] +THEN ARITH_TAC);; + + +let BBPRIME2_IS_NOT_2EMPTY_SUBDIVISION=prove_by_refinement(` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ + MMs_v39 s ww /\ c< norm(ww i- ww j) +==> + ww IN BBprime2_v39 (restriction_cs2_v39 s i j c)`, +[ +STRIP_TAC +THEN MP_TAC BB_EQ_UNION_BB_SUBDIVISION +THEN RESA_TAC +THEN ASM_TAC +THEN +REWRITE_TAC[MMs_v39;BBprime2_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC; + +REWRITE_TAC[IN] +THEN ASM_REWRITE_TAC[BBprime2_v39;LET_DEF;LET_END_DEF;scs_v39_explicit;] +THEN MP_TAC IN_BBPRIME_SUBDIVISION +THEN RESA_TAC +THEN SUBGOAL_THEN`BBs_v39 s ww` ASSUME_TAC; + +ASM_TAC +THEN REWRITE_TAC[BBprime_v39;LET_DEF;LET_END_DEF] +THEN REPEAT RESA_TAC; + +MP_TAC BBINDEX_EQ_SUBDIVISION +THEN RESA_TAC +THEN MP_TAC BBindex_min_LE_SUBDIVISION2 +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[BBindex_min_v39] +THEN SUBGOAL_THEN`(BBindex_v39 (restriction_cs2_v39 s i j c) ww) +IN IMAGE (BBindex_v39 (restriction_cs2_v39 s i j c)) + (BBprime_v39 (restriction_cs2_v39 s i j c))`ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`ww:num->real^3` +THEN ASM_REWRITE_TAC[IN]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MRESA_TAC Misc_defs_and_lemmas.min_least[`IMAGE (BBindex_v39 (restriction_cs2_v39 s i j c)) (BBprime_v39 (restriction_cs2_v39 s i j c))`;`BBindex_v39 (restriction_cs2_v39 s i j c) ww`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC]);; + + + +let MM_IS_NOT_2EMPTY_SUBDIVISION=prove_by_refinement(` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ +scs_am_v39 s i j < c/\ + MMs_v39 s ww /\ c< norm(ww i- ww j) +==> + ww IN MMs_v39 (restriction_cs2_v39 s i j c)`, +[ +STRIP_TAC +THEN MP_TAC BBPRIME2_IS_NOT_2EMPTY_SUBDIVISION +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[IN;MMs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;restriction_cs2_v39] +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[override] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC; + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`j':num`;`j:num`;`i':num`;`k:num`]; + + +ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT STRIP_TAC; + + +REPLICATE_TAC (28-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;dist]) +THEN REAL_ARITH_TAC; + + +REPLICATE_TAC (28-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;dist]) +THEN REAL_ARITH_TAC; + +REPLICATE_TAC (28-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;dist]) +THEN REAL_ARITH_TAC; + + +REPLICATE_TAC (27-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;dist]) +THEN REAL_ARITH_TAC; + +ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT STRIP_TAC; + +REPLICATE_TAC (28-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;]) +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN REAL_ARITH_TAC; + +REPLICATE_TAC (28-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;]) +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN REAL_ARITH_TAC; + +REPLICATE_TAC (28-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;]) +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN REAL_ARITH_TAC; + +REPLICATE_TAC (27-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;]) +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REWRITE_TAC[dist] +THEN REAL_ARITH_TAC]);; + + + +let MM_IS_NOT_1EMPTY_SUBDIVISION=prove_by_refinement( +` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ +c<= scs_am_v39 s i j /\ + MMs_v39 s ww /\ c< norm(ww i- ww j) +==> + ww IN MMs_v39 (restriction_cs2_v39 s i j c)`, +[STRIP_TAC +THEN MP_TAC BBPRIME2_IS_NOT_2EMPTY_SUBDIVISION +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[IN;MMs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;restriction_cs2_v39] +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[override] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`c<= scs_am_v39 s i j==> ~(scs_am_v39 s i j +BBindex_v39 s ww = BBindex_v39 (restriction_cs1_v39 s i j c) ww`, +[STRIP_TAC +THEN MP_TAC BB_EQ_UNION_BB_SUBDIVISION +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[BBindex_v39] +THEN +REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM;restriction_cs1_v39] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC]);; + + +let CONDITION_BBPRIME_SUBSET_BBPRIME_SUBDIVISION1= prove_by_refinement( +` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ +BBprime_v39 s ww /\ dist(ww i,ww j) <= c +==> +BBs_v39 (restriction_cs1_v39 s i j c) ww`, +[ +REWRITE_TAC[MMs_v39;BBs_v39;BBprime_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM;SUBSET;restriction_cs1_v39] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN REPEAT RESA_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MP_TAC th) +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC; + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`j':num`;`j:num`;`i':num`;`k:num`]; + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;dist]) +THEN REAL_ARITH_TAC; + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;]) +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MP_TAC th) +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC; + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`j':num`;`j:num`;`i':num`;`k:num`]; + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;dist]) +THEN REAL_ARITH_TAC; + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;]) +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN RESA_TAC]);; + + + + +let IN_BBPRIME_SUBDIVISION1=prove_by_refinement( +` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ +BBprime_v39 s ww /\ dist(ww i,ww j) <= c +==> +BBprime_v39 (restriction_cs1_v39 s i j c) ww`, +[ +STRIP_TAC +THEN MP_TAC CONDITION_BBPRIME_SUBSET_BBPRIME_SUBDIVISION1 +THEN RESA_TAC +THEN MP_TAC BB_EQ_UNION_BB_SUBDIVISION +THEN ASM_REWRITE_TAC[EXTENSION;UNION;IN_ELIM_THM] +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[BBprime_v39] +THEN REPEAT RESA_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th -> STRIP_TAC +THEN MRESA1_TAC th`ww':num->real^3`) +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`ww:num->real^3`] +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`ww':num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM;SUBSET;IN] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (33-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`ww':num->real^3`); + +MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`ww:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM;SUBSET;IN] +THEN REPEAT RESA_TAC]);; + + + + + +let BBPRIME_SUBDIVISION2_SUBSET_BBPRIME1=prove_by_refinement( +` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ +BBprime_v39 s ww /\ dist(ww i,ww j) <= c +==> +(BBprime_v39 (restriction_cs1_v39 s i j c)) SUBSET (BBprime_v39 s) `, +[ +STRIP_TAC +THEN MP_TAC CONDITION_BBPRIME_SUBSET_BBPRIME_SUBDIVISION1 +THEN RESA_TAC +THEN MP_TAC BB_EQ_UNION_BB_SUBDIVISION +THEN ASM_REWRITE_TAC[EXTENSION;IN] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM;SUBSET;IN] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + + +MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`ww':num->real^3`] +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`x:num->real^3`] +THEN REPLICATE_TAC (36-30)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`ww':num->real^3`); + + +MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`ww:num->real^3`] +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`x:num->real^3`] +THEN REPLICATE_TAC (37-29)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`ww':num->real^3`) +THEN REPLICATE_TAC (37-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`ww':num->real^3`) +THEN REPLICATE_TAC (37-29)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`ww:num->real^3`) +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`x:num->real^3`]]);; + + + + + +let BBINDEX_MIN_S_LE_SUBDIVISION1=prove_by_refinement( +` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ + BBprime_v39 s ww /\ dist(ww i,ww j) <= c +==> +BBindex_min_v39 s <= min_num + (IMAGE (BBindex_v39 s) + (BBprime_v39 (restriction_cs1_v39 s i j c)))`, +[ +STRIP_TAC +THEN MP_TAC BBPRIME_SUBSET_BBPRIME_SUBDIVISION_UNION +THEN RESA_TAC +THEN REWRITE_TAC[BBindex_min_v39] +THEN MATCH_MP_TAC(GEN_ALL MIN_NUM_SUBSET) +THEN EXISTS_TAC`BBindex_v39 s ww` +THEN STRIP_TAC; + +MATCH_MP_TAC IMAGE_SUBSET +THEN MP_TAC BBPRIME_SUBDIVISION2_SUBSET_BBPRIME1 +THEN RESA_TAC; + +REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`ww:num->real^3` +THEN REWRITE_TAC[IN] +THEN MP_TAC IN_BBPRIME_SUBDIVISION1 +THEN RESA_TAC;]);; + + + + + + +let BBINDEX_BBPRIME_LE_SUBDIVISION1=prove_by_refinement( +` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ + BBprime_v39 s ww /\ dist(ww i,ww j) <= c/\ + BBprime_v39 (restriction_cs1_v39 s i j c) vv +==> + BBindex_v39 s vv= BBindex_v39 (restriction_cs1_v39 s i j c) vv`, +[STRIP_TAC +THEN REWRITE_TAC[BBindex_v39] +THEN ASM_TAC +THEN +REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM;restriction_cs1_v39;IN;BBs_v39] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC]);; + + + + +let CLAIM_BBINDEX_BBPRIME_LE_SUBDIVISION1=prove(` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ + BBprime_v39 s ww /\ dist(ww i,ww j) <= c +==> +min_num + (IMAGE (BBindex_v39 s) + (BBprime_v39 (restriction_cs1_v39 s i j c))) +<= min_num + (IMAGE (BBindex_v39 (restriction_cs1_v39 s i j c)) + (BBprime_v39 (restriction_cs1_v39 s i j c)))`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL MIN_NUM_LE_IMAGE) +THEN EXISTS_TAC`ww:num->real^3` +THEN MP_TAC IN_BBPRIME_SUBDIVISION1 +THEN ASM_REWRITE_TAC[IN] +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MRESA_TAC(GEN_ALL BBINDEX_BBPRIME_LE_SUBDIVISION1)[`ww:num->real^3`;`s:scs_v39`;`i:num`;`j:num`;`c:real`;`x:num->real^3`] +THEN ARITH_TAC);; + + + +let BBindex_min_LE_SUBDIVISION1=prove(` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ + BBprime_v39 s ww /\ dist(ww i,ww j) <= c +==> +BBindex_min_v39 s <= BBindex_min_v39 (restriction_cs1_v39 s i j c)`, +STRIP_TAC +THEN MP_TAC CLAIM_BBINDEX_BBPRIME_LE_SUBDIVISION1 +THEN RESA_TAC +THEN MP_TAC BBINDEX_MIN_S_LE_SUBDIVISION1 +THEN RESA_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN REWRITE_TAC[BBindex_min_v39] +THEN ARITH_TAC);; + + + +let BBPRIME2_IS_NOT_2EMPTY_SUBDIVISION1=prove_by_refinement( +` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ + MMs_v39 s ww /\ dist(ww i,ww j) <= c +==> + ww IN BBprime2_v39 (restriction_cs1_v39 s i j c)`, +[ +STRIP_TAC +THEN MP_TAC BB_EQ_UNION_BB_SUBDIVISION +THEN RESA_TAC +THEN ASM_TAC +THEN +REWRITE_TAC[MMs_v39;BBprime2_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC; + +REWRITE_TAC[IN] +THEN ASM_REWRITE_TAC[BBprime2_v39;LET_DEF;LET_END_DEF;scs_v39_explicit;] +THEN MP_TAC IN_BBPRIME_SUBDIVISION1 +THEN RESA_TAC +THEN SUBGOAL_THEN`BBs_v39 s ww` ASSUME_TAC; + +ASM_TAC +THEN REWRITE_TAC[BBprime_v39;LET_DEF;LET_END_DEF] +THEN REPEAT RESA_TAC; + +MP_TAC BBINDEX_EQ_SUBDIVISION1 +THEN RESA_TAC +THEN MP_TAC BBindex_min_LE_SUBDIVISION1 +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[BBindex_min_v39] +THEN SUBGOAL_THEN`(BBindex_v39 (restriction_cs1_v39 s i j c) ww) +IN IMAGE (BBindex_v39 (restriction_cs1_v39 s i j c)) + (BBprime_v39 (restriction_cs1_v39 s i j c))`ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`ww:num->real^3` +THEN ASM_REWRITE_TAC[IN]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MRESA_TAC Misc_defs_and_lemmas.min_least[`IMAGE (BBindex_v39 (restriction_cs1_v39 s i j c)) (BBprime_v39 (restriction_cs1_v39 s i j c))`;`BBindex_v39 (restriction_cs1_v39 s i j c) ww`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC]);; + + + + +let MM_IS_NOT_2EMPTY_SUBDIVISION1=prove_by_refinement( +` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ +c < scs_bm_v39 s i j/\ + MMs_v39 s ww /\ dist(ww i,ww j) <= c +==> + ww IN MMs_v39 (restriction_cs1_v39 s i j c)`, +[STRIP_TAC +THEN MP_TAC BBPRIME2_IS_NOT_2EMPTY_SUBDIVISION1 +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[IN;MMs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;restriction_cs1_v39] +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[override] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC; + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`j':num`;`j:num`;`i':num`;`k:num`]; + + +ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT STRIP_TAC; + + +REPLICATE_TAC (28-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;]) +THEN REAL_ARITH_TAC; + + + +REPLICATE_TAC (28-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;]) +THEN REAL_ARITH_TAC; + +REPLICATE_TAC (28-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;dist]) +THEN REAL_ARITH_TAC; + + +REPLICATE_TAC (27-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;dist]) +THEN REAL_ARITH_TAC; + +ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBprime_v39] +THEN REPEAT STRIP_TAC; + +REPLICATE_TAC (28-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;]) +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN RESA_TAC; + +REPLICATE_TAC (28-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;]) +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN RESA_TAC; + +REPLICATE_TAC (28-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;]) +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN RESA_TAC; + +REPLICATE_TAC (27-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;]) +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN RESA_TAC; +]);; + + +let MM_IS_NOT_1EMPTY_SUBDIVISION1=prove_by_refinement( +` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ + scs_bm_v39 s i j <=c /\ + MMs_v39 s ww /\ dist(ww i,ww j) <= c +==> + ww IN MMs_v39 (restriction_cs1_v39 s i j c)`, +[STRIP_TAC +THEN MP_TAC BBPRIME2_IS_NOT_2EMPTY_SUBDIVISION1 +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[IN;MMs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;restriction_cs1_v39] +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[override] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`scs_bm_v39 s i j <= c==> ~(c< scs_bm_v39 s i j)`) +THEN RESA_TAC]);; + + + + +let BBINDEX_EQ_SUBDIVISION_C_EQ_AM=prove_by_refinement( +` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ +((j MOD scs_k_v39 s = SUC i MOD scs_k_v39 s) \/ (SUC j MOD scs_k_v39 s = i MOD scs_k_v39 s) ==> (~(c = scs_am_v39 s i j))) /\ + BBs_v39 s ww /\ dist(ww i,ww j) = c /\ scs_am_v39 s i j = c +==> +BBindex_v39 s ww = BBindex_v39 (restriction_cs2_v39 s i j c) ww`, +[ +STRIP_TAC +THEN MP_TAC BB_EQ_UNION_BB_SUBDIVISION +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[BBindex_v39] +THEN +REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM;restriction_cs2_v39] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC; + +MATCH_MP_TAC CARD_IMAGE_INJ_EQ +THEN REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`(\i:num. i)` +THEN STRIP_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + +STRIP_TAC; + +REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`psort k (i,j) = psort k (x,SUC x) \/ ~(psort k (i,j) = psort k (x,SUC x))`) +THEN RESA_TAC; + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`SUC x:num`;`j:num`;`x:num`;`k:num`]; + +ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (37-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`;dist]) +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`x:num`;`i:num`;`k:num`][]; + +ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (37-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`;dist]) +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`x:num`;`j:num`;`k:num`][]; + +REPEAT RESA_TAC; + +REWRITE_TAC[EXISTS_UNIQUE] +THEN EXISTS_TAC`y:num` +THEN ASM_REWRITE_TAC[] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`psort k (i,j) = psort k (y,SUC y) \/ ~(psort k (i,j) = psort k (y,SUC y))`) +THEN RESA_TAC; + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`SUC y:num`;`j:num`;`y:num`;`k:num`]; + +ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (37-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`;dist]) +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`y:num`;`i:num`;`k:num`][]; + +ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (37-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`;dist]) +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`y:num`;`j:num`;`k:num`][]]);; + + + +let CONDITION_BBPRIME_SUBSET_BBPRIME_SUBDIVISION_C_EQ_AM= prove_by_refinement(` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ +BBprime_v39 s ww /\ dist(ww i,ww j) = c /\ scs_am_v39 s i j = c /\ +((j MOD scs_k_v39 s = SUC i MOD scs_k_v39 s) \/ (SUC j MOD scs_k_v39 s = i MOD scs_k_v39 s) ==> (~(c = scs_am_v39 s i j))) +==> +BBs_v39 (restriction_cs2_v39 s i j c) ww`, +[ +REWRITE_TAC[MMs_v39;BBs_v39;BBprime_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM;SUBSET;restriction_cs2_v39] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN REPEAT RESA_TAC; + +REPLICATE_TAC (33-30)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC; + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`j':num`;`j:num`;`i':num`;`k:num`]; + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;dist]) +THEN REAL_ARITH_TAC; + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;]) +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +REPLICATE_TAC (33-30)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC; + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`j':num`;`j:num`;`i':num`;`k:num`]; + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;dist]) +THEN REAL_ARITH_TAC; + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`;]) +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]);; + + + + +let BBPRIME_SUBDIVISION2_SUBSET_BBPRIME_C_EQ_AM=prove_by_refinement(` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ +BBprime_v39 s ww /\ dist(ww i,ww j) = c /\ scs_am_v39 s i j = c /\ +((j MOD scs_k_v39 s = SUC i MOD scs_k_v39 s) \/ (SUC j MOD scs_k_v39 s = i MOD scs_k_v39 s) ==> (~(c = scs_am_v39 s i j))) +==> +(BBprime_v39 (restriction_cs2_v39 s i j c)) SUBSET (BBprime_v39 s) `, +[ +STRIP_TAC +THEN MP_TAC CONDITION_BBPRIME_SUBSET_BBPRIME_SUBDIVISION_C_EQ_AM +THEN RESA_TAC +THEN MP_TAC BB_EQ_UNION_BB_SUBDIVISION +THEN ASM_REWRITE_TAC[EXTENSION;IN] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM;SUBSET;IN] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`ww:num->real^3`] +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`x:num->real^3`] +THEN REPLICATE_TAC (39-33)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`ww:num->real^3`) +THEN REPLICATE_TAC (39-31)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`ww':num->real^3`) +THEN REPLICATE_TAC (39-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`ww':num->real^3`) +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`ww:num->real^3`] +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`x:num->real^3`] +THEN REPLICATE_TAC (39-33)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`ww:num->real^3`) +THEN REPLICATE_TAC (39-31)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`ww':num->real^3`) +THEN REPLICATE_TAC (39-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`ww':num->real^3`) +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`x:num->real^3`]]);; + + + + +let IN_BBPRIME_SUBDIVISION_C_EQ_AM=prove_by_refinement( +` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ +BBprime_v39 s ww /\ dist(ww i,ww j) = c /\ scs_am_v39 s i j = c /\ +((j MOD scs_k_v39 s = SUC i MOD scs_k_v39 s) \/ (SUC j MOD scs_k_v39 s = i MOD scs_k_v39 s) ==> (~(c = scs_am_v39 s i j))) +==> +BBprime_v39 (restriction_cs2_v39 s i j c) ww`, +[ +STRIP_TAC +THEN MP_TAC CONDITION_BBPRIME_SUBSET_BBPRIME_SUBDIVISION_C_EQ_AM +THEN RESA_TAC +THEN MP_TAC BB_EQ_UNION_BB_SUBDIVISION +THEN ASM_REWRITE_TAC[EXTENSION;UNION;IN_ELIM_THM] +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[BBprime_v39] +THEN REPEAT RESA_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th -> STRIP_TAC +THEN MRESA1_TAC th`ww':num->real^3`) +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`ww:num->real^3`] +THEN MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`ww':num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM;SUBSET;IN] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (35-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`ww':num->real^3`); + +MRESA_TAC (GEN_ALL SUBDIVISION_CS1_TAUSTAR_EQ)[`i:num`;`j:num`;`c:real`;`s:scs_v39`;`ww:num->real^3`] +THEN ASM_TAC +THEN REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM;SUBSET;IN] +THEN REPEAT RESA_TAC]);; + + + + +let BBINDEX_MIN_S_LE_SUBDIVISION2_C_EQ_AM=prove_by_refinement(` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ + BBprime_v39 s ww /\ dist(ww i,ww j) = c /\ scs_am_v39 s i j = c /\ +((j MOD scs_k_v39 s = SUC i MOD scs_k_v39 s) \/ (SUC j MOD scs_k_v39 s = i MOD scs_k_v39 s) ==> (~(c = scs_am_v39 s i j))) +==> +BBindex_min_v39 s <= min_num + (IMAGE (BBindex_v39 s) + (BBprime_v39 (restriction_cs2_v39 s i j c)))`, +[ +STRIP_TAC +THEN MP_TAC BBPRIME_SUBSET_BBPRIME_SUBDIVISION_UNION +THEN RESA_TAC +THEN REWRITE_TAC[BBindex_min_v39] +THEN MATCH_MP_TAC(GEN_ALL MIN_NUM_SUBSET) +THEN EXISTS_TAC`BBindex_v39 s ww` +THEN STRIP_TAC; + +MATCH_MP_TAC IMAGE_SUBSET +THEN MP_TAC BBPRIME_SUBDIVISION2_SUBSET_BBPRIME_C_EQ_AM +THEN RESA_TAC; + +REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`ww:num->real^3` +THEN REWRITE_TAC[IN] +THEN MP_TAC IN_BBPRIME_SUBDIVISION_C_EQ_AM +THEN RESA_TAC]);; + + + + + +let BBINDEX_BBPRIME_LE_SUBDIVISION2_C_EQ_AM=prove_by_refinement( +` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ + BBprime_v39 s ww /\ dist(ww i,ww j) = c /\ scs_am_v39 s i j = c /\ +((j MOD scs_k_v39 s = SUC i MOD scs_k_v39 s) \/ (SUC j MOD scs_k_v39 s = i MOD scs_k_v39 s) ==> (~(c = scs_am_v39 s i j))) /\ + BBprime_v39 (restriction_cs2_v39 s i j c) vv +==> + BBindex_v39 s vv<= BBindex_v39 (restriction_cs2_v39 s i j c) vv`, +[ + +STRIP_TAC +THEN REWRITE_TAC[BBindex_v39] +THEN ASM_TAC +THEN +REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39;is_scs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM;restriction_cs2_v39;IN;BBs_v39] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC; + + + + +MATCH_MP_TAC CARD_SUBSET +THEN REWRITE_TAC[IN_ELIM_THM;SUBSET] +THEN REPEAT RESA_TAC; + + + +MP_TAC(SET_RULE`psort k (i,j) = psort k (x,SUC x) \/ ~(psort k (i,j) = psort k (x,SUC x))`) +THEN RESA_TAC; + + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`SUC x:num`;`j:num`;`x:num`;`k:num`] +THEN REPLICATE_TAC (41-33)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]) +THEN REMOVE_ASSUM_TAC +THEN REPLICATE_TAC (41-37)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (42-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`;]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s x`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC x MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`;]) +THEN REAL_ARITH_TAC; + + + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + + + + + + +MATCH_MP_TAC CARD_SUBSET +THEN REWRITE_TAC[IN_ELIM_THM;SUBSET] +THEN REPEAT RESA_TAC; + + + +MP_TAC(SET_RULE`psort k (i,j) = psort k (x,SUC x) \/ ~(psort k (i,j) = psort k (x,SUC x))`) +THEN RESA_TAC; + + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`SUC x:num`;`j:num`;`x:num`;`k:num`] +THEN REPLICATE_TAC (42-33)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]) +THEN REMOVE_ASSUM_TAC +THEN REPLICATE_TAC (42-37)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (43-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`;]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s x`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC x MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`;]) +THEN REAL_ARITH_TAC; + + + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + + + + + + + +MATCH_MP_TAC CARD_SUBSET +THEN REWRITE_TAC[IN_ELIM_THM;SUBSET] +THEN REPEAT RESA_TAC; + + + +MP_TAC(SET_RULE`psort k (i,j) = psort k (x,SUC x) \/ ~(psort k (i,j) = psort k (x,SUC x))`) +THEN RESA_TAC; + + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`SUC x:num`;`j:num`;`x:num`;`k:num`] +THEN REPLICATE_TAC (42-33)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]) +THEN REMOVE_ASSUM_TAC +THEN REPLICATE_TAC (42-37)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (43-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`;]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s x`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC x MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`;]) +THEN REAL_ARITH_TAC; + + + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + + + +MATCH_MP_TAC CARD_SUBSET +THEN REWRITE_TAC[IN_ELIM_THM;SUBSET] +THEN REPEAT RESA_TAC; + + + +MP_TAC(SET_RULE`psort k (i,j) = psort k (x,SUC x) \/ ~(psort k (i,j) = psort k (x,SUC x))`) +THEN RESA_TAC; + + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`SUC x:num`;`j:num`;`x:num`;`k:num`] +THEN REPLICATE_TAC (42-33)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]) +THEN REMOVE_ASSUM_TAC +THEN REPLICATE_TAC (42-37)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (43-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3 `][ARITH_RULE`~(4=0)`;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`;]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s x`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC x MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`;]) +THEN REAL_ARITH_TAC; + + + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; +]);; + + + + + + +let CLAIM_BBINDEX_BBPRIME_LE_SUBDIVISION2_C_EQ_AM=prove( +` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ + BBprime_v39 s ww /\ dist(ww i,ww j) = c /\ scs_am_v39 s i j = c /\ +((j MOD scs_k_v39 s = SUC i MOD scs_k_v39 s) \/ (SUC j MOD scs_k_v39 s = i MOD scs_k_v39 s) ==> (~(c = scs_am_v39 s i j))) +==> +min_num + (IMAGE (BBindex_v39 s) + (BBprime_v39 (restriction_cs2_v39 s i j c))) +<= min_num + (IMAGE (BBindex_v39 (restriction_cs2_v39 s i j c)) + (BBprime_v39 (restriction_cs2_v39 s i j c)))`, +STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL MIN_NUM_LE_IMAGE) +THEN EXISTS_TAC`ww:num->real^3` +THEN MP_TAC IN_BBPRIME_SUBDIVISION_C_EQ_AM +THEN ASM_REWRITE_TAC[IN] +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC BBINDEX_BBPRIME_LE_SUBDIVISION2_C_EQ_AM +THEN ASM_REWRITE_TAC[]);; + + + +let BBindex_min_LE_SUBDIVISION2_C_EQ_AM=prove(` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ + BBprime_v39 s ww /\ dist(ww i,ww j) = c /\ scs_am_v39 s i j = c /\ +((j MOD scs_k_v39 s = SUC i MOD scs_k_v39 s) \/ (SUC j MOD scs_k_v39 s = i MOD scs_k_v39 s) ==> (~(c = scs_am_v39 s i j))) +==> +BBindex_min_v39 s <= BBindex_min_v39 (restriction_cs2_v39 s i j c)`, +STRIP_TAC +THEN MP_TAC CLAIM_BBINDEX_BBPRIME_LE_SUBDIVISION2_C_EQ_AM +THEN RESA_TAC +THEN MP_TAC BBINDEX_MIN_S_LE_SUBDIVISION2_C_EQ_AM +THEN RESA_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN REWRITE_TAC[BBindex_min_v39] +THEN ARITH_TAC);; + + + + +let BBPRIME2_IS_NOT_2EMPTY_SUBDIVISION_C_EQ_AM=prove_by_refinement(` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ + MMs_v39 s ww /\ dist(ww i,ww j) = c /\ scs_am_v39 s i j = c /\ +((j MOD scs_k_v39 s = SUC i MOD scs_k_v39 s) \/ (SUC j MOD scs_k_v39 s = i MOD scs_k_v39 s) ==> (~(c = scs_am_v39 s i j))) +==> + ww IN BBprime2_v39 (restriction_cs2_v39 s i j c)`, +[ +STRIP_TAC +THEN MP_TAC BB_EQ_UNION_BB_SUBDIVISION +THEN RESA_TAC +THEN ASM_TAC +THEN +REWRITE_TAC[MMs_v39;BBprime2_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;EXTENSION;UNION;IN_ELIM_THM] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`3 ~(k=0)`) +THEN ASM_TAC +THEN REPEAT RESA_TAC; + +REWRITE_TAC[IN] +THEN ASM_REWRITE_TAC[BBprime2_v39;LET_DEF;LET_END_DEF;scs_v39_explicit;] +THEN MP_TAC IN_BBPRIME_SUBDIVISION_C_EQ_AM +THEN RESA_TAC +THEN SUBGOAL_THEN`BBs_v39 s ww` ASSUME_TAC; + +ASM_TAC +THEN REWRITE_TAC[BBprime_v39;LET_DEF;LET_END_DEF] +THEN REPEAT RESA_TAC; + +MP_TAC BBINDEX_EQ_SUBDIVISION_C_EQ_AM +THEN RESA_TAC +THEN MP_TAC BBindex_min_LE_SUBDIVISION2_C_EQ_AM +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[BBindex_min_v39] +THEN SUBGOAL_THEN`(BBindex_v39 (restriction_cs2_v39 s i j c) ww) +IN IMAGE (BBindex_v39 (restriction_cs2_v39 s i j c)) + (BBprime_v39 (restriction_cs2_v39 s i j c))`ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`ww:num->real^3` +THEN ASM_REWRITE_TAC[IN]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MRESA_TAC Misc_defs_and_lemmas.min_least[`IMAGE (BBindex_v39 (restriction_cs2_v39 s i j c)) (BBprime_v39 (restriction_cs2_v39 s i j c))`;`BBindex_v39 (restriction_cs2_v39 s i j c) ww`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC]);; + + + + +let MM_IS_NOT_2EMPTY_SUBDIVISION_C_EQ_AM=prove_by_refinement( +` + is_scs_v39 s /\ 3< scs_k_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ + MMs_v39 s ww /\ dist(ww i,ww j) = c /\ scs_am_v39 s i j = c /\ +((j MOD scs_k_v39 s = SUC i MOD scs_k_v39 s) \/ (SUC j MOD scs_k_v39 s = i MOD scs_k_v39 s) ==> (~(c = scs_am_v39 s i j))) +==> + ww IN MMs_v39 (restriction_cs2_v39 s i j c)`, +[ +STRIP_TAC +THEN MP_TAC BBPRIME2_IS_NOT_2EMPTY_SUBDIVISION_C_EQ_AM +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[IN;MMs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;restriction_cs2_v39] +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[override;REAL_ARITH`~(c ~(k=0)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC]);; + + + + +let UAGHHBM=prove_by_refinement( +`!s i j c . + is_scs_v39 s /\ ~(i MOD scs_k_v39 s=j MOD scs_k_v39 s)/\ + ~(scs_J_v39 s i j) /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j/\ +((j MOD scs_k_v39 s = SUC i MOD scs_k_v39 s) \/ (SUC j MOD scs_k_v39 s = i MOD scs_k_v39 s) ==> (&2 < scs_a_v39 s i j \/ &2 * h0 < scs_b_v39 s i j)) +/\ 3< scs_k_v39 s /\ +((j MOD scs_k_v39 s = SUC i MOD scs_k_v39 s) \/ (SUC j MOD scs_k_v39 s = i MOD scs_k_v39 s) ==> (~(c = scs_am_v39 s i j))) +==> + scs_arrow_v39 {s} (set_of_list (subdiv_v39 s i j c))`, +[ +REPEAT GEN_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;subdiv_v39;PAIR_EQ;LET_DEF;LET_END_DEF;] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC +; + + + +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;] +THEN MP_TAC(SET_RULE`c <= scs_a_v39 s i j \/ ~(c <= scs_a_v39 s i j)`) +THEN RESA_TAC; + + +ASM_REWRITE_TAC[IN_SET_OF_LIST;set_of_list;Seq.mem_seq1] +THEN RESA_TAC; + + + +MP_TAC(SET_RULE`c <= scs_am_v39 s i j \/ ~(c <= scs_am_v39 s i j)`) +THEN RESA_TAC; + + +ASM_REWRITE_TAC[IN_SET_OF_LIST;set_of_list;Seq.mem_seq1;restriction_cs2_v39;LET_DEF;LET_END_DEF;] +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;scs_v39_explicit;override] +THEN RESA_TAC +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN REPEAT RESA_TAC; + + + + +REWRITE_TAC[override;periodic2;LET_DEF;LET_END_DEF;] +THEN REPEAT GEN_TAC +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i' + scs_k_v39 s,j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i' + scs_k_v39 s,j'))`) +THEN RESA_TAC; + + +MRESA_TAC (GEN_ALL PERIODIC_PSORT)[`k:num`;`i':num`;`j':num`] +; + + +POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL PERIODIC_PSORT)[`k:num`;`i':num`;`j':num`] +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN ASM_REWRITE_TAC[]; + + + +MP_TAC(REAL_ARITH`c <= scs_am_v39 s i j==> ~(scs_am_v39 s i j < c)`) +THEN RESA_TAC +; + + +MRESA_TAC Terminal.psort_sym[`k:num`;`i':num`;`j':num`] +; + + + +MP_TAC(REAL_ARITH`c <= scs_am_v39 s i j==> ~(scs_am_v39 s i j < c)`) +THEN RESA_TAC +; + + +MP_TAC(REAL_ARITH`c <= scs_am_v39 s i j==> ~(scs_am_v39 s i j < c)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC +; + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`j':num`;`j:num`;`i':num`;`k:num`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s (j' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); + + + + +MP_TAC(REAL_ARITH`c <= scs_am_v39 s i j==> ~(scs_am_v39 s i j < c)`) +THEN RESA_TAC +; + + + +MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',i') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',i'))`) +THEN RESA_TAC; + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`i':num`;`j:num`;`i':num`;`k:num`] +THEN POP_ASSUM(fun th-> MP_TAC (SYM th)) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); + + + +MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC; + + +MP_TAC C_LE_2_IS_SCS +THEN REWRITE_TAC[is_scs_v39] +THEN ASM_TAC +THEN REPEAT RESA_TAC +; + + + + +REPLICATE_TAC (33-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i':num`;`j':num`]) +; + + +POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC; + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`j':num`;`j:num`;`i':num`;`k:num`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (j' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +; + + + +STRIP_TAC +THEN REPLICATE_TAC (31-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i':num`;`j':num`]) +; + + + +REPLICATE_TAC (30-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i':num`;`j':num`]) +; + + + + +SUBGOAL_THEN`CARD + {i' | i' < k /\ + (&2 * h0 < scs_b_v39 s i' (SUC i') \/ + &2 < + (if psort k (i,j) = psort k (i',SUC i') + then c + else scs_a_v39 s i' (SUC i')))} += CARD + {i | i < k /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}` +ASSUME_TAC; + + + +MATCH_MP_TAC CARD_IMAGE_INJ_EQ +THEN REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`(\i:num. i)` +THEN STRIP_TAC; + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + +STRIP_TAC; + + +REPEAT RESA_TAC +; + + +MP_TAC(SET_RULE`psort k (i,j) = psort k (x,SUC x) \/ ~(psort k (i,j) = psort k (x,SUC x))`) +THEN RESA_TAC +; + + + +MP_TAC(REAL_ARITH`~(c <= scs_a_v39 s i j)==> scs_a_v39 s i j < c`) +THEN RESA_TAC +THEN MP_TAC C_LT_2_IS_SCS +THEN REWRITE_TAC[is_scs_v39] +THEN ASM_TAC +THEN REPEAT RESA_TAC +; + + + + +REPEAT RESA_TAC +; + + +REWRITE_TAC[EXISTS_UNIQUE] +THEN EXISTS_TAC`y:num` +THEN ASM_REWRITE_TAC[] +THEN REPEAT RESA_TAC +; + + + +REWRITE_TAC[EXISTS_UNIQUE] +THEN EXISTS_TAC`y:num` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`psort k (i,j) = psort k (y,SUC y) \/ ~(psort k (i,j) = psort k (y,SUC y))`) +THEN RESA_TAC +; + + + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`SUC y:num`;`j:num`;`y:num`;`k:num`] +; + + +POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL Zithlqn.IMP_SUC_MOD_EQ)[`y:num`;`i:num`;`k:num`] +THEN STRIP_TAC +THEN REPLICATE_TAC (34-26)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN RESA_TAC) +; + + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s y`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC y:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`y:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REPEAT RESA_TAC +; + + + + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (SUC i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s y`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC y:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (SUC i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`y:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REPEAT RESA_TAC +; + + + + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MP_TAC th) +THEN MRESA_TAC (GEN_ALL Zithlqn.IMP_SUC_MOD_EQ)[`y:num`;`j:num`;`k:num`] +THEN STRIP_TAC +THEN REPLICATE_TAC (34-26)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN RESA_TAC) +; + + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (y MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s y`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC y:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`y:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REPEAT RESA_TAC +; + + + + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (y MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s y`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC y:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (SUC j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`y:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REPEAT RESA_TAC +; + + +REPEAT RESA_TAC +; + + + +ASM_REWRITE_TAC[] +; + + + +(**********c < scs_bm_v39 s i j *******) + +MP_TAC(SET_RULE`c < scs_bm_v39 s i j \/ ~(c < scs_bm_v39 s i j)`) +THEN RESA_TAC; + + + +ASM_REWRITE_TAC[Basics.set_of_list2_explicit;SET_RULE`A IN{B,C}<=> A=B \/ A=C`] +THEN RESA_TAC; + + +(**********restriction_cs1_v39 s i j c *******) + + + +ASM_TAC +THEN REWRITE_TAC[is_scs_v39;scs_v39_explicit;override;restriction_cs1_v39;LET_DEF;LET_END_DEF;] +THEN RESA_TAC +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN REPEAT RESA_TAC; + + + +REWRITE_TAC[override;periodic2;LET_DEF;LET_END_DEF;] +THEN REPEAT GEN_TAC +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i' + scs_k_v39 s,j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i' + scs_k_v39 s,j'))`) +THEN RESA_TAC; + + +MRESA_TAC (GEN_ALL PERIODIC_PSORT)[`k:num`;`i':num`;`j':num`] +; + + +POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL PERIODIC_PSORT)[`k:num`;`i':num`;`j':num`] +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN ASM_REWRITE_TAC[]; + + + + + +REWRITE_TAC[override;periodic2;LET_DEF;LET_END_DEF;] +THEN REPEAT GEN_TAC +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i' + scs_k_v39 s,j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i' + scs_k_v39 s,j'))`) +THEN RESA_TAC; + + +MRESA_TAC (GEN_ALL PERIODIC_PSORT)[`k:num`;`i':num`;`j':num`] +; + + +POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL PERIODIC_PSORT)[`k:num`;`i':num`;`j':num`] +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN ASM_REWRITE_TAC[]; + + + + +REWRITE_TAC[override;periodic2;LET_DEF;LET_END_DEF;] +THEN MRESA_TAC Terminal.psort_sym[`k:num`;`i':num`;`j':num`] +; + + + +MRESA_TAC Terminal.psort_sym[`k:num`;`i':num`;`j':num`] +; + + + +REWRITE_TAC[override;periodic2;LET_DEF;LET_END_DEF;] +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC; + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`j':num`;`j:num`;`i':num`;`k:num`] +THEN MP_TAC(REAL_ARITH`~(c <= scs_am_v39 s i j) ==> scs_am_v39 s i j<= c`) +THEN RESA_TAC +; + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s (j' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s (j' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +; + + + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s (i' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s (j' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +; + + + +REWRITE_TAC[override;periodic2;LET_DEF;LET_END_DEF;] +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC; + + +REAL_ARITH_TAC +; + + + +POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',SUC i') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',SUC i'))`) +THEN RESA_TAC; + + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`SUC i':num`;`j:num`;`i':num`;`k:num`] +THEN REPLICATE_TAC (34-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th`i':num`) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (SUC i' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN REPLICATE_TAC (35-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REAL_ARITH_TAC; + + + + +REPLICATE_TAC (32-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th`i':num`) +; + + + + +MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',SUC i') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',SUC i'))`) +THEN RESA_TAC; + + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`SUC i':num`;`j:num`;`i':num`;`k:num`] +THEN REPLICATE_TAC (34-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th`i':num`) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (SUC i' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN REPLICATE_TAC (35-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REAL_ARITH_TAC; + + +REPLICATE_TAC (32-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th`i':num`) +; + + + + +REPLICATE_TAC (31-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`i':num`;`j':num`]) +; + + +POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC +; + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`j':num`;`j:num`;`i':num`;`k:num`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (j' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +; + + + + +REPLICATE_TAC (31-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`i':num`;`j':num`]) +; + + + + +SUBGOAL_THEN`CARD + {i' | i' < k /\ + (&2 * h0 < + (if psort k (i,j) = psort k (i',SUC i') + then c + else scs_b_v39 s i' (SUC i')) \/ + &2 < scs_a_v39 s i' (SUC i'))} +<= CARD + {i' | i' < k /\ + (&2 * h0 < + (scs_b_v39 s i' (SUC i')) \/ + &2 < scs_a_v39 s i' (SUC i'))}`ASSUME_TAC +; + + + + + +MATCH_MP_TAC CARD_SUBSET +THEN REWRITE_TAC[IN_ELIM_THM;SUBSET] +THEN STRIP_TAC; + + + +REPEAT RESA_TAC +; + + +POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (x,SUC x) \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (x,SUC x))`) +THEN RESA_TAC +; + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`SUC x:num`;`j:num`;`x:num`;`k:num`] +THEN REPLICATE_TAC (34-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s x`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (SUC x MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REAL_ARITH_TAC; + + +RESA_TAC; + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + + +REPLICATE_TAC (31-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC +; + + + +(**********restriction_cs2_v39 s i j c *******) + + +ASM_TAC +THEN REWRITE_TAC[is_scs_v39;scs_v39_explicit;override;restriction_cs2_v39;LET_DEF;LET_END_DEF;] +THEN RESA_TAC +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN REPEAT RESA_TAC; + + + + +REWRITE_TAC[override;periodic2;LET_DEF;LET_END_DEF;] +THEN REPEAT GEN_TAC +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i' + scs_k_v39 s,j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i' + scs_k_v39 s,j'))`) +THEN RESA_TAC; + + +MRESA_TAC (GEN_ALL PERIODIC_PSORT)[`k:num`;`i':num`;`j':num`] +; + + +POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL PERIODIC_PSORT)[`k:num`;`i':num`;`j':num`] +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN ASM_REWRITE_TAC[]; + + + + + + +MP_TAC(REAL_ARITH`~(c <= scs_am_v39 s i j)==> (scs_am_v39 s i j < c)`) +THEN RESA_TAC +; + + + + + +REWRITE_TAC[override;periodic2;LET_DEF;LET_END_DEF;] +THEN REPEAT GEN_TAC +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i' + scs_k_v39 s,j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i' + scs_k_v39 s,j'))`) +THEN RESA_TAC; + + +MRESA_TAC (GEN_ALL PERIODIC_PSORT)[`k:num`;`i':num`;`j':num`] +; + + +POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL PERIODIC_PSORT)[`k:num`;`i':num`;`j':num`] +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN ASM_REWRITE_TAC[]; + + + + +MRESA_TAC Terminal.psort_sym[`k:num`;`i':num`;`j':num`] +; + + + +MP_TAC(REAL_ARITH`~(c <= scs_am_v39 s i j)==> (scs_am_v39 s i j < c)`) +THEN RESA_TAC +; + + + +REWRITE_TAC[override;periodic2;LET_DEF;LET_END_DEF;] +THEN MRESA_TAC Terminal.psort_sym[`k:num`;`i':num`;`j':num`] +; + + + +MP_TAC(REAL_ARITH`~(c <= scs_am_v39 s i j)==> (scs_am_v39 s i j < c)`) +THEN RESA_TAC +THEN REWRITE_TAC[override;periodic2;LET_DEF;LET_END_DEF;] +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC +; + + +REAL_ARITH_TAC; + + + +MP_TAC(REAL_ARITH`~(c <= scs_am_v39 s i j)==> (scs_am_v39 s i j < c)`) +THEN RESA_TAC +THEN REWRITE_TAC[override;periodic2;LET_DEF;LET_END_DEF;] +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC; + + + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`j':num`;`j:num`;`i':num`;`k:num`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s (j' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MP_TAC(REAL_ARITH`c < scs_bm_v39 s i j ==> c <= scs_bm_v39 s i j`) +THEN RESA_TAC; + + + + + +MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',i') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',i'))`) +THEN RESA_TAC; + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`i':num`;`j:num`;`i':num`;`k:num`] +THEN POP_ASSUM(fun th-> MP_TAC (SYM th)) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); + + + +MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC; + + +MP_TAC C_LE_2_IS_SCS +THEN REWRITE_TAC[is_scs_v39] +THEN ASM_TAC +THEN REPEAT RESA_TAC +; + + + + +REPLICATE_TAC (34-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i':num`;`j':num`]) +; + + +POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC; + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`j':num`;`j:num`;`i':num`;`k:num`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (j' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +; + + + +STRIP_TAC +THEN REPLICATE_TAC (32-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i':num`;`j':num`]) +; + + + +REPLICATE_TAC (31-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i':num`;`j':num`]) +; + + + + +SUBGOAL_THEN`CARD + {i' | i' < k /\ + (&2 * h0 < scs_b_v39 s i' (SUC i') \/ + &2 < + (if psort k (i,j) = psort k (i',SUC i') + then c + else scs_a_v39 s i' (SUC i')))} += CARD + {i | i < k /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))}` +ASSUME_TAC; + + + +MATCH_MP_TAC CARD_IMAGE_INJ_EQ +THEN REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`(\i:num. i)` +THEN STRIP_TAC; + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + +STRIP_TAC; + + +REPEAT RESA_TAC +; + + +MP_TAC(SET_RULE`psort k (i,j) = psort k (x,SUC x) \/ ~(psort k (i,j) = psort k (x,SUC x))`) +THEN RESA_TAC +; + + + +MP_TAC(REAL_ARITH`~(c <= scs_a_v39 s i j)==> scs_a_v39 s i j < c`) +THEN RESA_TAC +THEN MP_TAC C_LT_2_IS_SCS +THEN REWRITE_TAC[is_scs_v39] +THEN ASM_TAC +THEN REPEAT RESA_TAC +; + + + + +REPEAT RESA_TAC +; + + +REWRITE_TAC[EXISTS_UNIQUE] +THEN EXISTS_TAC`y:num` +THEN ASM_REWRITE_TAC[] +THEN REPEAT RESA_TAC +; + + + +REWRITE_TAC[EXISTS_UNIQUE] +THEN EXISTS_TAC`y:num` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`psort k (i,j) = psort k (y,SUC y) \/ ~(psort k (i,j) = psort k (y,SUC y))`) +THEN RESA_TAC +; + + + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`SUC y:num`;`j:num`;`y:num`;`k:num`] +; + + +POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL Zithlqn.IMP_SUC_MOD_EQ)[`y:num`;`i:num`;`k:num`] +THEN STRIP_TAC +THEN REPLICATE_TAC (35-26)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN RESA_TAC) +; + + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s y`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC y:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`y:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REPEAT RESA_TAC +; + + + + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (SUC i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s y`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC y:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (SUC i MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`y:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REPEAT RESA_TAC +; + + + + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MP_TAC th) +THEN MRESA_TAC (GEN_ALL Zithlqn.IMP_SUC_MOD_EQ)[`y:num`;`j:num`;`k:num`] +THEN STRIP_TAC +THEN REPLICATE_TAC (35-26)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th +THEN RESA_TAC) +; + + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (y MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s y`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC y:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`y:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REPEAT RESA_TAC +; + + + + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (y MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s y`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC y:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (SUC j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`y:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REPEAT RESA_TAC +; + + +REPEAT RESA_TAC +; + + + +ASM_REWRITE_TAC[] +; + + + +(**********restriction_cs1_v39 s i j c *******) + +MP_TAC(SET_RULE`c < scs_b_v39 s i j \/ ~(c < scs_b_v39 s i j)`) +THEN RESA_TAC; + + + +ASM_REWRITE_TAC[IN_SET_OF_LIST;set_of_list;Seq.mem_seq1;restriction_cs1_v39;LET_DEF;LET_END_DEF;] +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;scs_v39_explicit;override] +THEN RESA_TAC +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN REPEAT RESA_TAC; + + + +REWRITE_TAC[override;periodic2;LET_DEF;LET_END_DEF;] +THEN REPEAT GEN_TAC +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i' + scs_k_v39 s,j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i' + scs_k_v39 s,j'))`) +THEN RESA_TAC; + + +MRESA_TAC (GEN_ALL PERIODIC_PSORT)[`k:num`;`i':num`;`j':num`] +; + + +POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL PERIODIC_PSORT)[`k:num`;`i':num`;`j':num`] +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN ASM_REWRITE_TAC[]; + + + + + + + + MRESA_TAC Terminal.psort_sym[`k:num`;`i':num`;`j':num`] +; + + + + + +REWRITE_TAC[override;periodic2;LET_DEF;LET_END_DEF;] +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC; + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`j':num`;`j:num`;`i':num`;`k:num`] +THEN MP_TAC(REAL_ARITH`~(c < scs_bm_v39 s i j) ==> scs_bm_v39 s i j<= c`) +THEN RESA_TAC +; + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s (j' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s (j' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +; + + + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s (i' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s (j' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +; + + + + +POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',SUC i') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',SUC i'))`) +THEN RESA_TAC; + + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`SUC i':num`;`j:num`;`i':num`;`k:num`] +THEN REPLICATE_TAC (35-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th`i':num`) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (SUC i' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN REPLICATE_TAC (36-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REAL_ARITH_TAC; + + + + +REPLICATE_TAC (33-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th`i':num`) +; + + + + +MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',SUC i') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',SUC i'))`) +THEN RESA_TAC; + + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`SUC i':num`;`j:num`;`i':num`;`k:num`] +THEN REPLICATE_TAC (35-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th`i':num`) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (SUC i' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +THEN REPLICATE_TAC (36-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REAL_ARITH_TAC; + + +REPLICATE_TAC (33-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th`i':num`) +; + + + + +REPLICATE_TAC (32-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`i':num`;`j':num`]) +; + + +POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j') \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC +; + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`j':num`;`j:num`;`i':num`;`k:num`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i'`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j':num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (j' MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i':num`[ARITH_RULE`4 MOD 4=0`]) +; + + + + +REPLICATE_TAC (32-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA_TAC th[`i':num`;`j':num`]) +; + + + + +SUBGOAL_THEN`CARD + {i' | i' < k /\ + (&2 * h0 < + (if psort k (i,j) = psort k (i',SUC i') + then c + else scs_b_v39 s i' (SUC i')) \/ + &2 < scs_a_v39 s i' (SUC i'))} +<= CARD + {i' | i' < k /\ + (&2 * h0 < + (scs_b_v39 s i' (SUC i')) \/ + &2 < scs_a_v39 s i' (SUC i'))}`ASSUME_TAC +; + + + + + +MATCH_MP_TAC CARD_SUBSET +THEN REWRITE_TAC[IN_ELIM_THM;SUBSET] +THEN STRIP_TAC; + + + +REPEAT RESA_TAC +; + + +POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (x,SUC x) \/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (x,SUC x))`) +THEN RESA_TAC +; + + + +MRESA_TAC(GEN_ALL CASE_PSORT)[`i:num`;`SUC x:num`;`j:num`;`x:num`;`k:num`] +THEN REPLICATE_TAC (35-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`j:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (j MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s x`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`SUC x:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (SUC x MOD k)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`x:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REAL_ARITH_TAC; + + +RESA_TAC; + + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + + +REPLICATE_TAC (32-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC +; + + + +ASM_REWRITE_TAC[IN_SET_OF_LIST;set_of_list;Seq.mem_seq1;restriction_cs1_v39;LET_DEF;LET_END_DEF;] +THEN RESA_TAC +; + + + +DISJ_CASES_TAC(SET_RULE`(!s'. s' = s ==> MMs_v39 s' = {}) \/ ~((!s'. s' = s ==> MMs_v39 s' = {}))`); + + +ASM_REWRITE_TAC[] +; + + + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[SET_RULE`~(A={})<=> ?ww. A ww`;] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`c <= scs_a_v39 s i j \/ ~(c <= scs_a_v39 s i j)`) +THEN RESA_TAC; + + + +ASM_REWRITE_TAC[IN_SET_OF_LIST;set_of_list;Seq.mem_seq1] +THEN EXISTS_TAC`s:scs_v39` +THEN ASM_REWRITE_TAC[SET_RULE`~(A={})<=> ?ww. ww IN A`;IN] +THEN EXISTS_TAC`ww:num->real^3` +THEN ASM_REWRITE_TAC[]; + + + +MP_TAC(SET_RULE`c <= scs_am_v39 s i j \/ ~(c <= scs_am_v39 s i j)`) +THEN RESA_TAC; + + +SUBGOAL_THEN`c<= norm(ww i- (ww:num->real^3) j)` ASSUME_TAC; + + + + +ASM_TAC +THEN REWRITE_TAC[IN;MMs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;restriction_cs2_v39;BBprime2_v39;BBprime_v39; BBs_v39;] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (22-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`i:num`;`j:num`][dist]) +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC +; + + + + + +MP_TAC(REAL_ARITH`c <= norm ((ww:num->real^3) i - ww j)==> c = norm (ww i - ww j)\/ c < norm (ww i - ww j)`) +THEN RESA_TAC; + + + +SUBGOAL_THEN`c=scs_am_v39 s i j` ASSUME_TAC +; + + + + +ASM_TAC +THEN REWRITE_TAC[IN;MMs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;restriction_cs2_v39;BBprime2_v39;BBprime_v39; BBs_v39;] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (25-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`i:num`;`j:num`][dist]) +THEN REPLICATE_TAC (1)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN REWRITE_TAC[th]) +THEN REAL_ARITH_TAC; + + + + +REPLICATE_TAC (15-8)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th) +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC MM_IS_NOT_2EMPTY_SUBDIVISION_C_EQ_AM +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[dist;] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[IN_SET_OF_LIST;set_of_list;Seq.mem_seq1;LET_DEF;LET_END_DEF;] +THEN EXISTS_TAC`restriction_cs2_v39 s i j c` +THEN ASM_REWRITE_TAC[SET_RULE`~(A={})<=> ?ww. ww IN A`;] +THEN EXISTS_TAC`ww:num->real^3` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[]; + + + + + + +ASM_REWRITE_TAC[IN_SET_OF_LIST;set_of_list;Seq.mem_seq1;LET_DEF;LET_END_DEF;] +THEN EXISTS_TAC`restriction_cs2_v39 s i j c` +THEN ASM_REWRITE_TAC[SET_RULE`~(A={})<=> ?ww. ww IN A`;] +THEN EXISTS_TAC`ww:num->real^3` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MM_IS_NOT_1EMPTY_SUBDIVISION +THEN RESA_TAC; + + + + + + +MP_TAC(REAL_ARITH`~(c <= scs_am_v39 s i j)==> scs_am_v39 s i j A=B \/ A=C`] +THEN MP_TAC(ARITH_RULE` c< norm(ww i- (ww:num->real^3) j) \/ norm(ww i- (ww:num->real^3) j)<=c` ) +THEN RESA_TAC; + + + + + + +EXISTS_TAC`restriction_cs2_v39 s i j c` +THEN ASM_REWRITE_TAC[SET_RULE`~(A={})<=> ?ww. ww IN A`;] +THEN EXISTS_TAC`ww:num->real^3` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MM_IS_NOT_2EMPTY_SUBDIVISION +THEN RESA_TAC; + + + +EXISTS_TAC`restriction_cs1_v39 s i j c` +THEN ASM_REWRITE_TAC[SET_RULE`~(A={})<=> ?ww. ww IN A`;] +THEN EXISTS_TAC`ww:num->real^3` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC MM_IS_NOT_2EMPTY_SUBDIVISION1 +THEN ASM_REWRITE_TAC[dist] +; + + + + +MP_TAC(REAL_ARITH`scs_bm_v39 s i j <= c ==> ~(creal^3) j) \/ norm(ww i- (ww:num->real^3) j)<=c` ) +THEN RESA_TAC; + + + + + +ASM_TAC +THEN REWRITE_TAC[IN;MMs_v39;scs_v39_explicit;override;LET_DEF;LET_END_DEF;restriction_cs2_v39;BBprime2_v39;BBprime_v39; BBs_v39;] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (28-21)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`i:num`;`j:num`][dist]) +THEN REPLICATE_TAC (28-23)(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + + + + + + + + + +MP_TAC MM_IS_NOT_1EMPTY_SUBDIVISION1 +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[dist] +THEN STRIP_TAC +THEN EXISTS_TAC`restriction_cs1_v39 s i j c` +THEN ASM_REWRITE_TAC[SET_RULE`~(A={})<=> ?ww. ww IN A`;] +THEN ASM_REWRITE_TAC[IN_SET_OF_LIST;set_of_list;Seq.mem_seq1;LET_DEF;LET_END_DEF;] +THEN EXISTS_TAC`ww:num->real^3` +THEN ASM_REWRITE_TAC[] +; + + + +MP_TAC(REAL_ARITH`scs_b_v39 s i j <= c==> ~(c< scs_b_v39 s i j )`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[IN_SET_OF_LIST;set_of_list;Seq.mem_seq1;LET_DEF;LET_END_DEF;] +THEN EXISTS_TAC`s:scs_v39` +THEN ASM_REWRITE_TAC[SET_RULE`~(A={})<=> ?ww. A ww`;] +THEN EXISTS_TAC`ww:num->real^3` +THEN ASM_REWRITE_TAC[] + ; + + +]);; + + + + + + + + + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/UXCKFPE.hl b/text_formalization/local/UXCKFPE.hl new file mode 100755 index 0000000..dc19fd6 --- /dev/null +++ b/text_formalization/local/UXCKFPE.hl @@ -0,0 +1,2656 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Uxckfpe = struct + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +let NOT_EMPTY_CASE_4_IS_SCS=prove_by_refinement( +` is_scs_v39 s /\ scs_k_v39 s=4 /\ BBs_v39 s vv +/\ dimindex(:M)= scs_k_v39 s +==> ~({matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ CONDITION2_SY v }={})`, +[REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;] +THEN STRIP_TAC +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 0]:real^3^M` +THEN ABBREV_TAC`a=matvec (v:real^3^M) ` +THEN EXISTS_TAC`a:real^(M,3)finite_product` +THEN MATCH_MP_TAC IN_IS_SCS_CASE_4 +THEN ASM_REWRITE_TAC[]]);; + + + +let ARITH_4_TAC =ARITH_RULE`1<=4/\1<=2/\1<=3/\1<=1/\2<=4/\3<=4/\4<=4/\ ~(1=0)/\ ~(2=0)/\ ~(2=1)/\ ~(3=0)/\ ~(3=1)/\ ~(3=2)/\ 4 MOD 4=0/\ SUC 0=1/\ 1<=4/\ 4<=4/\ 1+0=1/\ 1 MOD 4=1/\ 1<=1/\ 1<=4/\ 1 MOD 4=1/\ 1+1=2/\ ~(1=0)/\ 2 MOD 4=2/\ SUC 2=3/\ ~(2=0)/\ 1<=2/\ 2<=4/\ 1+2=3/\ 3 MOD 4=3/\ 1<=3/\ 3<=4/\ 1+3=4/\ SUC 3=4/\ ~(3=0)/\ SUC 1=2/\ SUC 4=5/\ 5 MOD 4=1/\ ~(4=0)/\ 0 MOD 4=0`;; + + +let VV_IN_BALL_ANNULUS_TAC_4= +fun (so:term)-> +REPLICATE_TAC (31-23)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th so[ARITH_RULE`1<=4/\1<=2/\1<=3/\1<=1/\2<=4/\3<=4/\4<=4/\ ~(1=0)/\ ~(2=0)/\ ~(2=1)/\ ~(3=0)/\ ~(3=1)/\ ~(3=2)`;IN]) +;; + + +let SCS_A_LE_NORM_4_IS_SCS= +fun (so:term) (so1:term)-> +REPLICATE_TAC (33-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th [so;so1][ARITH_RULE`1<=4/\1<=2/\1<=3/\1<=1/\2<=4/\3<=4/\4<=4/\ ~(1=0)/\ ~(2=0)/\ ~(2=1)/\ ~(3=0)/\ ~(3=1)/\ ~(3=2)`;IN]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (34-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN ASSUME_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`4:num`[ARITH_RULE`4 MOD 4=0`] THEN MRESA1_TAC th`i:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`4:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REPEAT RESA_TAC +;; + +let PROVE_INEQUALITY_TAC_4= +fun (th:term)-> +MP_TAC(ARITH_RULE`(j MOD 4<4)==> (j MOD 4=0) \/ (j MOD 4=1) \/ (j MOD 4=2)\/ (j MOD 4=3)`) +THEN RESA_TAC +THENL[ +SCS_A_LE_NORM_4_IS_SCS th `4`; +SCS_A_LE_NORM_4_IS_SCS th `1`; +SCS_A_LE_NORM_4_IS_SCS th `2`; +SCS_A_LE_NORM_4_IS_SCS th `3`];; + + + + +let SCS_B_LE_NORM_4_IS_SCS= +fun (so:term) (so1:term)-> +REPLICATE_TAC (33-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th [so;so1][ARITH_RULE`1<=4/\1<=2/\1<=3/\1<=1/\2<=4/\3<=4/\4<=4/\ ~(1=0)/\ ~(2=0)/\ ~(2=1)/\ ~(3=0)/\ ~(3=1)/\ ~(3=2)`;IN]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (34-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN ASSUME_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (j MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`4:num`[ARITH_RULE`4 MOD 4=0`] THEN MRESA1_TAC th`i:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (i MOD scs_k_v39 s)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`4:num`[ARITH_RULE`4 MOD 4=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (4)`][ARITH_RULE`~(4=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`4:num`[ARITH_RULE`4 MOD 4=0`]) +THEN REPEAT RESA_TAC +;; + +let PROVE_INEQUALITY_TAC_4B= +fun (th:term)-> +MP_TAC(ARITH_RULE`(j MOD 4<4)==> (j MOD 4=0) \/ (j MOD 4=1) \/ (j MOD 4=2)\/ (j MOD 4=3)`) +THEN RESA_TAC +THENL[ +SCS_B_LE_NORM_4_IS_SCS th `4`; +SCS_B_LE_NORM_4_IS_SCS th `1`; +SCS_B_LE_NORM_4_IS_SCS th `2`; +SCS_B_LE_NORM_4_IS_SCS th `3`];; + + + + +let V_SY_EQ_IMAGE_VV_TAC4= +fun (th:term)-> +ASM_REWRITE_TAC[] +THEN EXISTS_TAC th +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`;ARITH_4_TAC];; + + +let PROVE_E_SY_EQ_MOD_TAC_4= +fun (so:term)-> +EXISTS_TAC so +THEN ASM_REWRITE_TAC[ARITH_4_TAC] +;; + + + + + + + +let PROOF_E_EQ_TAC_4= +fun (so:term)-> +EXISTS_TAC so +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ARITH_4_TAC;] +;; + + +let PROVE_E_SY_EQ_IMAGE_VV_4= +fun (so:term) (so1:term)-> +MRESAL_TAC(GEN_ALL Zithlqn.IMP_SUC_MOD_EQ)[`x':num`;so1;`scs_k_v39 s`][ARITH_4_TAC] +THEN EXISTS_TAC so +THEN ASM_REWRITE_TAC[ARITH_4_TAC];; + + + + +let IN_NOT_EMPTY_B1_SY_4_IS_SCS=prove_by_refinement( +`is_scs_v39 s /\ scs_k_v39 s=4 /\ +dimindex(:M) = scs_k_v39 s/\ + matvec (v:real^3^M) =a/\ +(!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ + CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ + CONDITION2_SY v +/\ (!i. vv i = +if i MOD scs_k_v39 s = 0 then row 4 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +if i MOD scs_k_v39 s = 2 then row 2 v else +row 3 v) +==> vv IN BBs_v39 s`, +[ + +REWRITE_TAC[CONDITION1_SY;CONDITION2_SY;change_type_v3] +THEN REPEAT STRIP_TAC +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;] +THEN REPEAT RESA_TAC; + + +ASM_REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 4<4 ==> x' MOD 4 = 0 \/ x' MOD 4 = 1 \/ x' MOD 4 = 2 \/ x' MOD 4 = 3`) +THEN RESA_TAC +THENL[ +VV_IN_BALL_ANNULUS_TAC_4 `4`; +VV_IN_BALL_ANNULUS_TAC_4 `1`; +VV_IN_BALL_ANNULUS_TAC_4 `2`; +VV_IN_BALL_ANNULUS_TAC_4 `3`]; + + + +ASM_REWRITE_TAC[periodic] +THEN GEN_TAC +THEN MRESAL_TAC MOD_EQ[`i+4:num`;`i:num`;`4:num`;`1`][ARITH_RULE`1*A=A`]; + + + +REWRITE_TAC[dist] +THEN REPEAT GEN_TAC +THEN SUBGOAL_THEN`!i. (vv:num->real^3) i= vv (i MOD 4)` ASSUME_TAC; + + +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN GEN_TAC +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`4`][ARITH_RULE`~(4=0)`]; + + + +MRESAL_TAC DIVISION[`i:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC DIVISION[`j:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`(i MOD 4<4)==> (i MOD 4=0) \/ (i MOD 4=1) \/ (i MOD 4=2)\/ (i MOD 4=3)`) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_4 `4`; +PROVE_INEQUALITY_TAC_4 `1`; +PROVE_INEQUALITY_TAC_4 `2`; +PROVE_INEQUALITY_TAC_4 `3`] +; + + + + + +REWRITE_TAC[dist] +THEN REPEAT GEN_TAC +THEN SUBGOAL_THEN`!i. (vv:num->real^3) i= vv (i MOD 4)` ASSUME_TAC; + + +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN GEN_TAC +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`4`][ARITH_RULE`~(4=0)`]; + + + +MRESAL_TAC DIVISION[`i:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC DIVISION[`j:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`(i MOD 4<4)==> (i MOD 4=0) \/ (i MOD 4=1) \/ (i MOD 4=2)\/ (i MOD 4=3)`) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_4B `4`; +PROVE_INEQUALITY_TAC_4B `1`; +PROVE_INEQUALITY_TAC_4B `2`; +PROVE_INEQUALITY_TAC_4B `3`] +; + + + + + + + + + + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`~(4<=3)`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`V_SY (v:real^3^M) = IMAGE vv (:num)`ASSUME_TAC; + + + +ASM_REWRITE_TAC[V_SY;rows;IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 4)<=> i= 1\/ i=2 \/ i=3 \/ i=4`] +THEN STRIP_TAC +THENL[ +V_SY_EQ_IMAGE_VV_TAC4 `1`; +V_SY_EQ_IMAGE_VV_TAC4 `2`; +V_SY_EQ_IMAGE_VV_TAC4 `3`; +V_SY_EQ_IMAGE_VV_TAC4 `4`]; + + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 4<4)==> (x' MOD 4=0) \/ (x' MOD 4=1) \/ (x' MOD 4=2)\/ (x' MOD 4=3)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_MOD_TAC_4 `4`; +PROVE_E_SY_EQ_MOD_TAC_4 `1`; +PROVE_E_SY_EQ_MOD_TAC_4 `2`; +PROVE_E_SY_EQ_MOD_TAC_4 `3`] +; + + + + + + + +SUBGOAL_THEN`E_SY (v:real^3^M) = IMAGE (\i. {vv i, vv (SUC i)}) (:num)`ASSUME_TAC; + + + +ASM_REWRITE_TAC[E_SY;rows;IMAGE;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +; + + + + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 4)<=> i= 1\/ i=2 \/ i=3 \/ i=4`] +THEN RESA_TAC +THENL[ +PROOF_E_EQ_TAC_4`1`; +PROOF_E_EQ_TAC_4`2`; +PROOF_E_EQ_TAC_4`3`; +PROOF_E_EQ_TAC_4`4`] +; + + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 4<4)==> (x' MOD 4=0) \/ (x' MOD 4=1) \/ (x' MOD 4=2)\/ (x' MOD 4=3)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_IMAGE_VV_4 `4` `0`; +PROVE_E_SY_EQ_IMAGE_VV_4 `1` `1`; +PROVE_E_SY_EQ_IMAGE_VV_4 `2` `2`; +PROVE_E_SY_EQ_IMAGE_VV_4 `3` `3`]; + + + +SUBGOAL_THEN`F_SY (v:real^3^M) = IMAGE (\i. (vv i, vv (SUC i))) (:num)`ASSUME_TAC; + + +ASM_REWRITE_TAC[F_SY;rows;IMAGE;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +; + + + + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 4)<=> i= 1\/ i=2 \/ i=3 \/ i=4`] +THEN RESA_TAC +THENL[ +PROOF_E_EQ_TAC_4`1`; +PROOF_E_EQ_TAC_4`2`; +PROOF_E_EQ_TAC_4`3`; +PROOF_E_EQ_TAC_4`4`] +; + + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 4<4)==> (x' MOD 4=0) \/ (x' MOD 4=1) \/ (x' MOD 4=2)\/ (x' MOD 4=3)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_IMAGE_VV_4 `4` `0`; +PROVE_E_SY_EQ_IMAGE_VV_4 `1` `1`; +PROVE_E_SY_EQ_IMAGE_VV_4 `2` `2`; +PROVE_E_SY_EQ_IMAGE_VV_4 `3` `3`]; + + + +REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[]; +]);; + (* }}} *) + + + +let XWITCCN_CASE_4_IS_SCS=prove_by_refinement( +` is_scs_v39 s /\ BBs_v39 s vv +/\ scs_k_v39 s=4 +/\ dimindex(:M) =scs_k_v39 s +/\ taustar_v39 s vv < &0 + ==> ~(BBprime_v39 s = {})`, + (* {{{ proof *) +[ + + +STRIP_TAC +THEN MP_TAC IS_SCS_STABLE_SYSTEM +THEN ASM_REWRITE_TAC[ARITH_RULE`3<4`] +THEN STRIP_TAC +THEN MP_TAC NOT_EMPTY_CASE_4_IS_SCS +THEN RESA_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`] +THEN ABBREV_TAC`s1 =stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))` +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN MRESAL_TAC (GEN_ALL HDPLYGY)[`(scs_k_v39 s)`;`s1:stable_sy`][k_sy;B_SY1;ARITH_RULE`2<4`;] +THEN POP_ASSUM (fun th-> +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN REWRITE_TAC[BBprime_v39;IN] +THEN ABBREV_TAC`( vv1 i = +if i MOD scs_k_v39 s = 0 then row 4 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +if i MOD scs_k_v39 s = 2 then row 2 v else +row 3 (v:real^3^M))` +THEN EXISTS_TAC`vv1:num->real^3` +THEN STRIP_TAC; + + +ONCE_REWRITE_TAC[GSYM IN] +THEN MATCH_MP_TAC(GEN_ALL IN_NOT_EMPTY_B1_SY_4_IS_SCS) +THEN EXISTS_TAC`x:real^(M,3)finite_product` +THEN EXISTS_TAC`v:real^3^M` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +; + + +SUBGOAL_THEN`vector [ vv1 1; vv1 2; (vv1:num->real^3) 3;vv1 0] = v:real^3^M` +ASSUME_TAC; + +POP_ASSUM(fun th-> REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`1 MOD 4=1/\ 2 MOD 4=2/\ 3 MOD 4=3/\ 0 MOD 4=0 /\ ~(1=0)/\ ~(2=0)/\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2)`;] +THEN ONCE_REWRITE_TAC[CART_EQ] +THEN ASM_REWRITE_TAC[ARITH_RULE`1<=i/\ i<=4 <=>i=1\/ i=2\/ i=3\/ i=4`] +THEN REPEAT RESA_TAC +THEN +ASM_SIMP_TAC[row;vector; LAMBDA_BETA; DIMINDEX_3; LENGTH; ARITH] THEN +REWRITE_TAC[num_CONV `3`;num_CONV `2`; num_CONV `1`; EL; HD; TL;] +THEN ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;row;LAMBDA_BETA]; + + + +STRIP_TAC; + +GEN_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM IN] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_4_IS_SCS) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_IS_SCS_CASE_4)[`v:real^3^M`;`s:scs_v39`;`vv1:num->real^3`;`s1:stable_sy`;`x:real^(M,3)finite_product`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_IS_SCS_CASE_4) +[`vector [ww 1; ww 2; ww 3; ww 0]:real^3^M`;`s:scs_v39`;`ww:num->real^3`;`s1:stable_sy`;`matvec(vector [ww 1; ww 2; ww 3; ww 0]:real^3^M):real^(M,3)finite_product`;] +THEN MRESA_TAC (GEN_ALL IN_IS_SCS_CASE_4)[`ww:num->real^3`;`vector [ww 1; ww 2; ww 3; ww 0]:real^3^M`;`matvec(vector [ww 1; ww 2; ww 3; ww 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN REPLICATE_TAC (27-23) (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[IN] +THEN STRIP_TAC) +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC +THEN REWRITE_TAC[th] +THEN RESA_TAC) +THEN REPLICATE_TAC (26-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th `matvec(vector [ww 1; ww 2; ww 3; ww 0]:real^3^M):real^(M,3)finite_product`); + +MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_4_IS_SCS) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_IS_SCS_CASE_4)[`v:real^3^M`;`s:scs_v39`;`vv1:num->real^3`;`s1:stable_sy`;`x:real^(M,3)finite_product`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_IS_SCS_CASE_4) +[`vector [vv 1; vv 2; vv 3; vv 0]:real^3^M`;`s:scs_v39`;`vv:num->real^3`;`s1:stable_sy`;`matvec(vector [vv 1; vv 2; vv 3; vv 0]:real^3^M):real^(M,3)finite_product`;] +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN MRESA_TAC (GEN_ALL IN_IS_SCS_CASE_4)[`vv:num->real^3`;`vector [vv 1; vv 2; vv 3; vv 0]:real^3^M`;`matvec(vector [vv 1; vv 2; vv 3; vv 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN ASM_REWRITE_TAC[IN] +THEN STRIP_TAC +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th `matvec(vector [vv 1; vv 2; vv 3; vv 0]:real^3^M):real^(M,3)finite_product`) +THEN REPLICATE_TAC (26-4) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +]);; + (* }}} *) + +(*************CASE 5****************) + +let NOT_EMPTY_CASE_5_IS_SCS=prove_by_refinement( +` is_scs_v39 s /\ scs_k_v39 s=5 /\ BBs_v39 s vv +/\ dimindex(:M)= scs_k_v39 s +==> ~({matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ CONDITION2_SY v }={})`, +[REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;] +THEN STRIP_TAC +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 0]:real^3^M` +THEN ABBREV_TAC`a=matvec (v:real^3^M) ` +THEN EXISTS_TAC`a:real^(M,3)finite_product` +THEN MATCH_MP_TAC IN_IS_SCS_CASE_5 +THEN ASM_REWRITE_TAC[]]);; + + + + + +let ARITH_5_TAC =ARITH_RULE`1<=4/\1<=2/\1<=3/\1<=1/\2<=5/\3<=5/\5<=5 /\ 4<=5/\ ~(1=0)/\ ~(2=0)/\ ~(2=1)/\ ~(3=0)/\ ~(3=1)/\ ~(3=2)/\ 6 MOD 5=1/\ SUC 0=1/\ 1<=4/\ 4<=4/\ 1+0=1/\ 1 MOD 5=1/\ 1<=1/\ 1<=4/\ 4 MOD 5=4/\ 1+1=2/\ ~(1=0)/\ 2 MOD 5=2/\ SUC 2=3/\ ~(2=0)/\ 1<=2/\ 2<=4/\ 1+2=3/\ 3 MOD 5=3/\ 1<=3/\ 3<=4/\ 1+3=4/\ SUC 3=4/\ ~(3=0)/\ SUC 1=2/\ SUC 4=5/\ 5 MOD 5=0/\ ~(4=0)/\ 0 MOD 5=0 +/\ 1<=5 /\ ~(4=1)/\ ~(4=2)/\ ~(4=3)/\ SUC 5=6/\ ~(5=0) +`;; + + + +let VV_IN_BALL_ANNULUS_TAC_5= +fun (so:term)-> +REPLICATE_TAC (31-23)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th so[ARITH_5_TAC;IN]) +;; + + + + +let SCS_A_LE_NORM_5_IS_SCS= +fun (so:term) (so1:term)-> +REPLICATE_TAC (33-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th [so;so1][ARITH_5_TAC;IN]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (34-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN ASSUME_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(5=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j MOD scs_k_v39 s)`][ARITH_RULE`~(5=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`5:num`[ARITH_RULE`5 MOD 5=0`] THEN MRESA1_TAC th`i:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD scs_k_v39 s)`][ARITH_RULE`~(5=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`5:num`[ARITH_RULE`5 MOD 5=0`]) +THEN REPEAT RESA_TAC +;; + +let PROVE_INEQUALITY_TAC_5= +fun (th:term)-> +MP_TAC(ARITH_RULE`(j MOD 5<5)==> (j MOD 5=0) \/ (j MOD 5=1) \/ (j MOD 5=2)\/ (j MOD 5=3)\/ (j MOD 5=4)`) +THEN RESA_TAC +THENL[ +SCS_A_LE_NORM_5_IS_SCS th `5`; +SCS_A_LE_NORM_5_IS_SCS th `1`; +SCS_A_LE_NORM_5_IS_SCS th `2`; +SCS_A_LE_NORM_5_IS_SCS th `3`; +SCS_A_LE_NORM_5_IS_SCS th `4`];; + + + + + + +let SCS_B_LE_NORM_5_IS_SCS= +fun (so:term) (so1:term)-> +REPLICATE_TAC (33-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th [so;so1][ARITH_5_TAC;IN]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (34-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN ASSUME_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(5=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (j MOD scs_k_v39 s)`][ARITH_RULE`~(5=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`5:num`[ARITH_RULE`5 MOD 5=0`] THEN MRESA1_TAC th`i:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (i MOD scs_k_v39 s)`][ARITH_RULE`~(5=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`5:num`[ARITH_RULE`5 MOD 5=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (5)`][ARITH_RULE`~(5=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`5:num`[ARITH_RULE`5 MOD 5=0`]) +THEN REPEAT RESA_TAC +;; + +let PROVE_INEQUALITY_TAC_5B= +fun (th:term)-> +MP_TAC(ARITH_RULE`(j MOD 5<5)==> (j MOD 5=0) \/ (j MOD 5=1) \/ (j MOD 5=2)\/ (j MOD 5=3)\/ (j MOD 5=4)`) +THEN RESA_TAC +THENL[ +SCS_B_LE_NORM_5_IS_SCS th `5`; +SCS_B_LE_NORM_5_IS_SCS th `1`; +SCS_B_LE_NORM_5_IS_SCS th `2`; +SCS_B_LE_NORM_5_IS_SCS th `3`; +SCS_B_LE_NORM_5_IS_SCS th `4`];; + + + + + + + + + + + + +let V_SY_EQ_IMAGE_VV_TAC5= +fun (th:term)-> +ASM_REWRITE_TAC[] +THEN EXISTS_TAC th +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`;ARITH_5_TAC];; + + +let PROVE_E_SY_EQ_MOD_TAC_5= +fun (so:term)-> +EXISTS_TAC so +THEN ASM_REWRITE_TAC[ARITH_5_TAC] +;; + + + + + + + +let PROOF_E_EQ_TAC_5= +fun (so:term)-> +EXISTS_TAC so +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ARITH_5_TAC;] +;; + + +let PROVE_E_SY_EQ_IMAGE_VV_5= +fun (so:term) (so1:term)-> +MRESAL_TAC(GEN_ALL Zithlqn.IMP_SUC_MOD_EQ)[`x':num`;so1;`scs_k_v39 s`][ARITH_5_TAC] +THEN EXISTS_TAC so +THEN ASM_REWRITE_TAC[ARITH_5_TAC];; + + + + +let IN_NOT_EMPTY_B1_SY_5_IS_SCS=prove_by_refinement( +`is_scs_v39 s /\ scs_k_v39 s=5 /\ +dimindex(:M) = scs_k_v39 s/\ + matvec (v:real^3^M) =a/\ +(!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ + CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ + CONDITION2_SY v +/\ (!i. vv i = +if i MOD scs_k_v39 s = 0 then row 5 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +if i MOD scs_k_v39 s = 2 then row 2 v else +if i MOD scs_k_v39 s = 3 then row 3 v else +row 4 v) +==> vv IN BBs_v39 s`, +[ +REWRITE_TAC[CONDITION1_SY;CONDITION2_SY;change_type_v3] +THEN REPEAT STRIP_TAC +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39;] +THEN REPEAT RESA_TAC; + +ASM_REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 5<5 ==> x' MOD 5 = 0 \/ x' MOD 5 = 1 \/ x' MOD 5 = 2 \/ x' MOD 5 = 3\/ x' MOD 5 = 4`) +THEN RESA_TAC +THENL[ +VV_IN_BALL_ANNULUS_TAC_5 `5`; +VV_IN_BALL_ANNULUS_TAC_5 `1`; +VV_IN_BALL_ANNULUS_TAC_5 `2`; +VV_IN_BALL_ANNULUS_TAC_5 `3`; +VV_IN_BALL_ANNULUS_TAC_5 `4`]; + +ASM_REWRITE_TAC[periodic] +THEN GEN_TAC +THEN MRESAL_TAC MOD_EQ[`i+5:num`;`i:num`;`5:num`;`1`][ARITH_RULE`1*A=A`]; + +REWRITE_TAC[dist] +THEN REPEAT GEN_TAC +THEN SUBGOAL_THEN`!i. (vv:num->real^3) i= vv (i MOD 5)` ASSUME_TAC; + +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN GEN_TAC +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`5`][ARITH_RULE`~(5=0)`]; + +MRESAL_TAC DIVISION[`i:num`;`5`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC DIVISION[`j:num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`(i MOD 5<5)==> (i MOD 5=0) \/ (i MOD 5=1) \/ (i MOD 5=2)\/ (i MOD 5=3) \/ (i MOD 5=4)`) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_5 `5`; +PROVE_INEQUALITY_TAC_5 `1`; +PROVE_INEQUALITY_TAC_5 `2`; +PROVE_INEQUALITY_TAC_5 `3`; +PROVE_INEQUALITY_TAC_5 `4`]; + + + + +REWRITE_TAC[dist] +THEN REPEAT GEN_TAC +THEN SUBGOAL_THEN`!i. (vv:num->real^3) i= vv (i MOD 5)` ASSUME_TAC; + +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN GEN_TAC +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`5`][ARITH_RULE`~(5=0)`]; + + + +MRESAL_TAC DIVISION[`i:num`;`5`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC DIVISION[`j:num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`(i MOD 5<5)==> (i MOD 5=0) \/ (i MOD 5=1) \/ (i MOD 5=2)\/ (i MOD 5=3) \/ (i MOD 5=4)`) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_5B `5`; +PROVE_INEQUALITY_TAC_5B `1`; +PROVE_INEQUALITY_TAC_5B `2`; +PROVE_INEQUALITY_TAC_5B `3`; +PROVE_INEQUALITY_TAC_5B `4`]; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`~(5<=3)`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`V_SY (v:real^3^M) = IMAGE vv (:num)`ASSUME_TAC; + +ASM_REWRITE_TAC[V_SY;rows;IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 5)<=> i= 1\/ i=2 \/ i=3 \/ i=4 \/ i=5`] +THEN STRIP_TAC +THENL[ +V_SY_EQ_IMAGE_VV_TAC5 `1`; +V_SY_EQ_IMAGE_VV_TAC5 `2`; +V_SY_EQ_IMAGE_VV_TAC5 `3`; +V_SY_EQ_IMAGE_VV_TAC5 `4`; +V_SY_EQ_IMAGE_VV_TAC5 `5`;]; + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 5<5)==> (x' MOD 5=0) \/ (x' MOD 5=1) \/ (x' MOD 5=2)\/ (x' MOD 5=3)\/ (x' MOD 5=4)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_MOD_TAC_5 `5`; +PROVE_E_SY_EQ_MOD_TAC_5 `1`; +PROVE_E_SY_EQ_MOD_TAC_5 `2`; +PROVE_E_SY_EQ_MOD_TAC_5 `3`; +PROVE_E_SY_EQ_MOD_TAC_5 `4`]; + + +SUBGOAL_THEN`E_SY (v:real^3^M) = IMAGE (\i. {vv i, vv (SUC i)}) (:num)`ASSUME_TAC; + +ASM_REWRITE_TAC[E_SY;rows;IMAGE;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 5)<=> i= 1\/ i=2 \/ i=3 \/ i=4\/ i=5`] +THEN RESA_TAC +THENL[ +PROOF_E_EQ_TAC_5`1`; +PROOF_E_EQ_TAC_5`2`; +PROOF_E_EQ_TAC_5`3`; +PROOF_E_EQ_TAC_5`4`; +PROOF_E_EQ_TAC_5`5`]; + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 5<5)==> (x' MOD 5=0) \/ (x' MOD 5=1) \/ (x' MOD 5=2)\/ (x' MOD 5=3) \/ (x' MOD 5=4)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_IMAGE_VV_5 `5` `0`; +PROVE_E_SY_EQ_IMAGE_VV_5 `1` `1`; +PROVE_E_SY_EQ_IMAGE_VV_5 `2` `2`; +PROVE_E_SY_EQ_IMAGE_VV_5 `3` `3`; +PROVE_E_SY_EQ_IMAGE_VV_5 `4` `4`]; + +SUBGOAL_THEN`F_SY (v:real^3^M) = IMAGE (\i. (vv i, vv (SUC i))) (:num)`ASSUME_TAC; + +ASM_REWRITE_TAC[F_SY;rows;IMAGE;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 5)<=> i= 1\/ i=2 \/ i=3 \/ i=4\/ i=5`] +THEN RESA_TAC +THENL[ +PROOF_E_EQ_TAC_5`1`; +PROOF_E_EQ_TAC_5`2`; +PROOF_E_EQ_TAC_5`3`; +PROOF_E_EQ_TAC_5`4`; +PROOF_E_EQ_TAC_5`5`]; + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 5<5)==> (x' MOD 5=0) \/ (x' MOD 5=1) \/ (x' MOD 5=2)\/ (x' MOD 5=3) \/ (x' MOD 5=4)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_IMAGE_VV_5 `5` `0`; +PROVE_E_SY_EQ_IMAGE_VV_5 `1` `1`; +PROVE_E_SY_EQ_IMAGE_VV_5 `2` `2`; +PROVE_E_SY_EQ_IMAGE_VV_5 `3` `3`; +PROVE_E_SY_EQ_IMAGE_VV_5 `4` `4`]; + +REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[]; + +]);; + (* }}} *) + + + +let XWITCCN_CASE_5_IS_SCS=prove_by_refinement( +` is_scs_v39 s /\ BBs_v39 s vv +/\ scs_k_v39 s=5 +/\ dimindex(:M) =scs_k_v39 s +/\ taustar_v39 s vv < &0 + ==> ~(BBprime_v39 s = {})`, + (* {{{ proof *) +[ +STRIP_TAC +THEN MP_TAC IS_SCS_STABLE_SYSTEM +THEN ASM_REWRITE_TAC[ARITH_RULE`3<5`] +THEN STRIP_TAC +THEN MP_TAC NOT_EMPTY_CASE_5_IS_SCS +THEN RESA_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`] +THEN ABBREV_TAC`s1 =stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))` +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN MRESAL_TAC (GEN_ALL HDPLYGY)[`(scs_k_v39 s)`;`s1:stable_sy`][k_sy;B_SY1;ARITH_RULE`2<5`;] +THEN POP_ASSUM (fun th-> +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN REWRITE_TAC[BBprime_v39;IN] +THEN ABBREV_TAC`( vv1 i = +if i MOD scs_k_v39 s = 0 then row 5 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +if i MOD scs_k_v39 s = 2 then row 2 v else +if i MOD scs_k_v39 s = 3 then row 3 v else +row 4 (v:real^3^M))` +THEN EXISTS_TAC`vv1:num->real^3` +THEN STRIP_TAC; + +ONCE_REWRITE_TAC[GSYM IN] +THEN MATCH_MP_TAC(GEN_ALL IN_NOT_EMPTY_B1_SY_5_IS_SCS) +THEN EXISTS_TAC`x:real^(M,3)finite_product` +THEN EXISTS_TAC`v:real^3^M` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC; + +SUBGOAL_THEN`vector [ vv1 1; vv1 2; (vv1:num->real^3) 3;vv1 4; vv1 0] = v:real^3^M` +ASSUME_TAC; + +POP_ASSUM(fun th-> REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`1 MOD 5=1/\ 2 MOD 5=2/\ 3 MOD 5=3/\ 0 MOD 5=0 /\ ~(1=0)/\ ~(2=0)/\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2) /\ ~(4=0) /\ ~(4=1) /\ ~(4=2) /\ ~(4=3)/\ 4 MOD 5=4`;] +THEN ONCE_REWRITE_TAC[CART_EQ] +THEN ASM_REWRITE_TAC[ARITH_RULE`1<=i/\ i<=5 <=>i=1\/ i=2\/ i=3\/ i=4\/ i=5`] +THEN REPEAT RESA_TAC +THEN +ASM_SIMP_TAC[row;vector; LAMBDA_BETA; DIMINDEX_3; LENGTH; ARITH] THEN +REWRITE_TAC[num_CONV `4`;num_CONV `3`;num_CONV `2`; num_CONV `1`; EL; HD; TL;] +THEN ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;row;LAMBDA_BETA]; + + +STRIP_TAC; + +GEN_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM IN] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_5_IS_SCS) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_IS_SCS_CASE_5)[`v:real^3^M`;`s:scs_v39`;`vv1:num->real^3`;`s1:stable_sy`;`x:real^(M,3)finite_product`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_IS_SCS_CASE_5) +[`vector [ww 1; ww 2; ww 3; ww 4; ww 0]:real^3^M`;`s:scs_v39`;`ww:num->real^3`;`s1:stable_sy`;`matvec(vector [ww 1; ww 2; ww 3; ww 4; ww 0]:real^3^M):real^(M,3)finite_product`;] +THEN MRESA_TAC (GEN_ALL IN_IS_SCS_CASE_5)[`ww:num->real^3`;`vector [ww 1; ww 2; ww 3; ww 4; ww 0]:real^3^M`;`matvec(vector [ww 1; ww 2; ww 3; ww 4; ww 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN REPLICATE_TAC (27-23) (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[IN] +THEN STRIP_TAC) +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC +THEN REWRITE_TAC[th] +THEN RESA_TAC) +THEN REPLICATE_TAC (26-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th `matvec(vector [ww 1; ww 2; ww 3; ww 4; ww 0]:real^3^M):real^(M,3)finite_product`); + +MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_5_IS_SCS) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_IS_SCS_CASE_5)[`v:real^3^M`;`s:scs_v39`;`vv1:num->real^3`;`s1:stable_sy`;`x:real^(M,3)finite_product`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_IS_SCS_CASE_5) +[`vector [vv 1; vv 2; vv 3; vv 4; vv 0]:real^3^M`;`s:scs_v39`;`vv:num->real^3`;`s1:stable_sy`;`matvec(vector [vv 1; vv 2; vv 3; vv 4; vv 0]:real^3^M):real^(M,3)finite_product`;] +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN MRESA_TAC (GEN_ALL IN_IS_SCS_CASE_5)[`vv:num->real^3`;`vector [vv 1; vv 2; vv 3; vv 4; vv 0]:real^3^M`;`matvec(vector [vv 1; vv 2; vv 3; vv 4; vv 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN ASM_REWRITE_TAC[IN] +THEN STRIP_TAC +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th `matvec(vector [vv 1; vv 2; vv 3; vv 4; vv 0]:real^3^M):real^(M,3)finite_product`) +THEN REPLICATE_TAC (26-4) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +]);; + (* }}} *) + + + + + +(*************CASE 6****************) + +let NOT_EMPTY_CASE_6_IS_SCS=prove_by_refinement( +` is_scs_v39 s /\ scs_k_v39 s=6 /\ BBs_v39 s vv +/\ dimindex(:M)= scs_k_v39 s +==> ~({matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ CONDITION2_SY v }={})`, +[REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;] +THEN STRIP_TAC +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 5;(vv:num->real^3) 0]:real^3^M` +THEN ABBREV_TAC`a=matvec (v:real^3^M) ` +THEN EXISTS_TAC`a:real^(M,3)finite_product` +THEN MATCH_MP_TAC IN_IS_SCS_CASE_6 +THEN ASM_REWRITE_TAC[]]);; + + + + +let ARITH_6_TAC =ARITH_RULE`1<=4/\1<=2/\1<=3/\1<=1/\2<=6/\3<=6/\5<=6 /\ 4<=6/\5<=6/\ 6<=6/\ 1<=6 /\ ~(1=0)/\ ~(2=0)/\ ~(2=1)/\ ~(3=0)/\ ~(3=1)/\ ~(3=2)/\ 6 MOD 5=1/\ SUC 0=1/\ 1<=4/\ 4<=4/\ 1+0=1/\ 1 MOD 6=1/\ 1<=1/\ 1<=4/\ 4 MOD 6=4/\ 1+1=2/\ ~(1=0)/\ 2 MOD 6=2/\ SUC 2=3/\ ~(2=0)/\ 1<=2/\ 2<=4/\ 1+2=3/\ 3 MOD 6=3/\ 1<=3/\ 3<=4/\ 1+3=4/\ SUC 3=4/\ ~(3=0)/\ SUC 1=2/\ SUC 4=5/\ 5 MOD 6=5/\ ~(4=0)/\ 0 MOD 6=0/\ 6 MOD 6=0/\ 7 MOD 6=1 /\ SUC 6=7 +/\ 1<=5 /\ ~(4=1)/\ ~(4=2)/\ ~(4=3)/\ SUC 5=6/\ ~(5=0)/\ ~(6=0) +/\ ~(5=1)/\ ~(5=2)/\ ~(5=3)/\ ~(5=4)`;; + + + +let VV_IN_BALL_ANNULUS_TAC_6= +fun (so:term)-> +REPLICATE_TAC (31-23)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th so[ARITH_6_TAC;IN]) +;; + + + + +let SCS_A_LE_NORM_6_IS_SCS= +fun (so:term) (so1:term)-> +REPLICATE_TAC (33-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th [so;so1][ARITH_6_TAC;IN]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (34-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN ASSUME_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(6=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j MOD scs_k_v39 s)`][ARITH_RULE`~(6=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`6:num`[ARITH_RULE`6 MOD 6=0`] THEN MRESA1_TAC th`i:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD scs_k_v39 s)`][ARITH_RULE`~(6=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`6:num`[ARITH_RULE`6 MOD 6=0`]) +THEN REPEAT RESA_TAC +;; + +let PROVE_INEQUALITY_TAC_6= +fun (th:term)-> +MP_TAC(ARITH_RULE`(j MOD 6<6)==> (j MOD 6=0) \/ (j MOD 6=1) \/ (j MOD 6=2)\/ (j MOD 6=3)\/ (j MOD 6=4) \/ (j MOD 6=5)`) +THEN RESA_TAC +THENL[ +SCS_A_LE_NORM_6_IS_SCS th `6`; +SCS_A_LE_NORM_6_IS_SCS th `1`; +SCS_A_LE_NORM_6_IS_SCS th `2`; +SCS_A_LE_NORM_6_IS_SCS th `3`; +SCS_A_LE_NORM_6_IS_SCS th `4`; +SCS_A_LE_NORM_6_IS_SCS th `5`];; + + + + + + +let SCS_B_LE_NORM_6_IS_SCS= +fun (so:term) (so1:term)-> +REPLICATE_TAC (33-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th [so;so1][ARITH_6_TAC;IN]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (34-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN ASSUME_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(6=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (j MOD scs_k_v39 s)`][ARITH_RULE`~(6=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`6:num`[ARITH_RULE`6 MOD 6=0`] THEN MRESA1_TAC th`i:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (i MOD scs_k_v39 s)`][ARITH_RULE`~(6=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`6:num`[ARITH_RULE`6 MOD 6=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (6)`][ARITH_RULE`~(6=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`6:num`[ARITH_RULE`6 MOD 6=0`]) +THEN REPEAT RESA_TAC +;; + +let PROVE_INEQUALITY_TAC_6B= +fun (th:term)-> +MP_TAC(ARITH_RULE`(j MOD 6<6)==> (j MOD 6=0) \/ (j MOD 6=1) \/ (j MOD 6=2)\/ (j MOD 6=3)\/ (j MOD 6=4) \/ (j MOD 6=5)`) +THEN RESA_TAC +THENL[ +SCS_B_LE_NORM_6_IS_SCS th `6`; +SCS_B_LE_NORM_6_IS_SCS th `1`; +SCS_B_LE_NORM_6_IS_SCS th `2`; +SCS_B_LE_NORM_6_IS_SCS th `3`; +SCS_B_LE_NORM_6_IS_SCS th `4`; +SCS_B_LE_NORM_6_IS_SCS th `5`];; + + + + + + + + + + + + +let V_SY_EQ_IMAGE_VV_TAC6= +fun (th:term)-> +ASM_REWRITE_TAC[] +THEN EXISTS_TAC th +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`;ARITH_6_TAC];; + + +let PROVE_E_SY_EQ_MOD_TAC_6= +fun (so:term)-> +EXISTS_TAC so +THEN ASM_REWRITE_TAC[ARITH_6_TAC] +;; + + + + + + + +let PROOF_E_EQ_TAC_6= +fun (so:term)-> +EXISTS_TAC so +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ARITH_6_TAC;] +;; + + +let PROVE_E_SY_EQ_IMAGE_VV_6= +fun (so:term) (so1:term)-> +MRESAL_TAC(GEN_ALL Zithlqn.IMP_SUC_MOD_EQ)[`x':num`;so1;`scs_k_v39 s`][ARITH_6_TAC] +THEN EXISTS_TAC so +THEN ASM_REWRITE_TAC[ARITH_6_TAC];; + + + + +let IN_NOT_EMPTY_B1_SY_6_IS_SCS=prove_by_refinement(`is_scs_v39 s /\ scs_k_v39 s=6 /\ +dimindex(:M) = scs_k_v39 s/\ + matvec (v:real^3^M) =a/\ +(!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ + CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ + CONDITION2_SY v +/\ (!i. vv i = +if i MOD scs_k_v39 s = 0 then row 6 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +if i MOD scs_k_v39 s = 2 then row 2 v else +if i MOD scs_k_v39 s = 3 then row 3 v else +if i MOD scs_k_v39 s = 4 then row 4 v else +row 5 v) +==> vv IN BBs_v39 s`, +[ +REWRITE_TAC[CONDITION1_SY;CONDITION2_SY;change_type_v3] +THEN REPEAT STRIP_TAC +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(6<=3)`;IN;mk_unadorned_v39;] +THEN REPEAT RESA_TAC; + + +ASM_REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC DIVISION[`x':num`;`6`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 6<6 ==> x' MOD 6 = 0 \/ x' MOD 6 = 1 \/ x' MOD 6 = 2 \/ x' MOD 6 = 3\/ x' MOD 6 = 4\/ x' MOD 6 = 5`) +THEN RESA_TAC +THENL[ +VV_IN_BALL_ANNULUS_TAC_6 `6`; +VV_IN_BALL_ANNULUS_TAC_6 `1`; +VV_IN_BALL_ANNULUS_TAC_6 `2`; +VV_IN_BALL_ANNULUS_TAC_6 `3`; +VV_IN_BALL_ANNULUS_TAC_6 `4`; +VV_IN_BALL_ANNULUS_TAC_6 `5`]; + + +ASM_REWRITE_TAC[periodic] +THEN GEN_TAC +THEN MRESAL_TAC MOD_EQ[`i+6:num`;`i:num`;`6:num`;`1`][ARITH_RULE`1*A=A`]; + + +REWRITE_TAC[dist] +THEN REPEAT GEN_TAC +THEN SUBGOAL_THEN`!i. (vv:num->real^3) i= vv (i MOD 6)` ASSUME_TAC; + + +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN GEN_TAC +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`6`][ARITH_RULE`~(6=0)`]; + + +MRESAL_TAC DIVISION[`i:num`;`6`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC DIVISION[`j:num`;`6`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`(i MOD 6<6)==> (i MOD 6=0) \/ (i MOD 6=1) \/ (i MOD 6=2)\/ (i MOD 6=3) \/ (i MOD 6=4) \/ (i MOD 6=5)`) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_6 `6`; +PROVE_INEQUALITY_TAC_6 `1`; +PROVE_INEQUALITY_TAC_6 `2`; +PROVE_INEQUALITY_TAC_6 `3`; +PROVE_INEQUALITY_TAC_6 `4`; +PROVE_INEQUALITY_TAC_6 `5`]; + + + + + +REWRITE_TAC[dist] +THEN REPEAT GEN_TAC +THEN SUBGOAL_THEN`!i. (vv:num->real^3) i= vv (i MOD 6)` ASSUME_TAC; + + +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN GEN_TAC +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`6`][ARITH_RULE`~(6=0)`]; + + +MRESAL_TAC DIVISION[`i:num`;`6`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC DIVISION[`j:num`;`6`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`(i MOD 6<6)==> (i MOD 6=0) \/ (i MOD 6=1) \/ (i MOD 6=2)\/ (i MOD 6=3) \/ (i MOD 6=4) \/ (i MOD 6=5)`) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_6B `6`; +PROVE_INEQUALITY_TAC_6B `1`; +PROVE_INEQUALITY_TAC_6B `2`; +PROVE_INEQUALITY_TAC_6B `3`; +PROVE_INEQUALITY_TAC_6B `4`; +PROVE_INEQUALITY_TAC_6B `5`]; + + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`~(5<=3)`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`V_SY (v:real^3^M) = IMAGE vv (:num)`ASSUME_TAC; + + +ASM_REWRITE_TAC[V_SY;rows;IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 6)<=> i= 1\/ i=2 \/ i=3 \/ i=4 \/ i=5\/ i=6`] +THEN STRIP_TAC +THENL[ +V_SY_EQ_IMAGE_VV_TAC6 `1`; +V_SY_EQ_IMAGE_VV_TAC6 `2`; +V_SY_EQ_IMAGE_VV_TAC6 `3`; +V_SY_EQ_IMAGE_VV_TAC6 `4`; +V_SY_EQ_IMAGE_VV_TAC6 `5`; +V_SY_EQ_IMAGE_VV_TAC6 `6`;]; + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`6`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 6<6)==> (x' MOD 6=0) \/ (x' MOD 6=1) \/ (x' MOD 6=2)\/ (x' MOD 6=3)\/ (x' MOD 6=4)\/ (x' MOD 6=5)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_MOD_TAC_6 `6`; +PROVE_E_SY_EQ_MOD_TAC_6 `1`; +PROVE_E_SY_EQ_MOD_TAC_6 `2`; +PROVE_E_SY_EQ_MOD_TAC_6 `3`; +PROVE_E_SY_EQ_MOD_TAC_6 `4`; +PROVE_E_SY_EQ_MOD_TAC_6 `5`;]; + + + +SUBGOAL_THEN`E_SY (v:real^3^M) = IMAGE (\i. {vv i, vv (SUC i)}) (:num)`ASSUME_TAC; + + +ASM_REWRITE_TAC[E_SY;rows;IMAGE;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + + + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 6)<=> i= 1\/ i=2 \/ i=3 \/ i=4\/ i=5 \/ i=6`] +THEN RESA_TAC +THENL[ +PROOF_E_EQ_TAC_6`1`; +PROOF_E_EQ_TAC_6`2`; +PROOF_E_EQ_TAC_6`3`; +PROOF_E_EQ_TAC_6`4`; +PROOF_E_EQ_TAC_6`5`; +PROOF_E_EQ_TAC_6`6`]; + + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`6`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 6<6)==> (x' MOD 6=0) \/ (x' MOD 6=1) \/ (x' MOD 6=2)\/ (x' MOD 6=3) \/ (x' MOD 6=4)\/ (x' MOD 6=5)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_IMAGE_VV_6 `6` `0`; +PROVE_E_SY_EQ_IMAGE_VV_6 `1` `1`; +PROVE_E_SY_EQ_IMAGE_VV_6 `2` `2`; +PROVE_E_SY_EQ_IMAGE_VV_6 `3` `3`; +PROVE_E_SY_EQ_IMAGE_VV_6 `4` `4`; +PROVE_E_SY_EQ_IMAGE_VV_6 `5` `5`]; + + +SUBGOAL_THEN`F_SY (v:real^3^M) = IMAGE (\i. (vv i, vv (SUC i))) (:num)`ASSUME_TAC; + + +ASM_REWRITE_TAC[F_SY;rows;IMAGE;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + + + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 6)<=> i= 1\/ i=2 \/ i=3 \/ i=4\/ i=5 \/ i=6`] +THEN RESA_TAC +THENL[ +PROOF_E_EQ_TAC_6`1`; +PROOF_E_EQ_TAC_6`2`; +PROOF_E_EQ_TAC_6`3`; +PROOF_E_EQ_TAC_6`4`; +PROOF_E_EQ_TAC_6`5`; +PROOF_E_EQ_TAC_6`6`]; + + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`6`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 6<6)==> (x' MOD 6=0) \/ (x' MOD 6=1) \/ (x' MOD 6=2)\/ (x' MOD 6=3) \/ (x' MOD 6=4)\/ (x' MOD 6=5)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_IMAGE_VV_6 `6` `0`; +PROVE_E_SY_EQ_IMAGE_VV_6 `1` `1`; +PROVE_E_SY_EQ_IMAGE_VV_6 `2` `2`; +PROVE_E_SY_EQ_IMAGE_VV_6 `3` `3`; +PROVE_E_SY_EQ_IMAGE_VV_6 `4` `4`; +PROVE_E_SY_EQ_IMAGE_VV_6 `5` `5`]; + + +REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th->REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[]; + + +]);; + (* }}} *) + + +let XWITCCN_CASE_6_IS_SCS=prove_by_refinement( +` is_scs_v39 s /\ BBs_v39 s vv +/\ scs_k_v39 s=6 +/\ dimindex(:M) =scs_k_v39 s +/\ taustar_v39 s vv < &0 + ==> ~(BBprime_v39 s = {})`, + (* {{{ proof *) +[ +STRIP_TAC +THEN MP_TAC IS_SCS_STABLE_SYSTEM +THEN ASM_REWRITE_TAC[ARITH_RULE`3<6`] +THEN STRIP_TAC +THEN MP_TAC NOT_EMPTY_CASE_6_IS_SCS +THEN RESA_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`] +THEN ABBREV_TAC`s1 =stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))` +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN MRESAL_TAC (GEN_ALL HDPLYGY)[`(scs_k_v39 s)`;`s1:stable_sy`][k_sy;B_SY1;ARITH_RULE`2<6`;] +THEN POP_ASSUM (fun th-> +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN REWRITE_TAC[BBprime_v39;IN] +THEN ABBREV_TAC`( vv1 i = +if i MOD scs_k_v39 s = 0 then row 6 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +if i MOD scs_k_v39 s = 2 then row 2 v else +if i MOD scs_k_v39 s = 3 then row 3 v else +if i MOD scs_k_v39 s = 4 then row 4 v else +row 5 (v:real^3^M))` +THEN EXISTS_TAC`vv1:num->real^3` +THEN STRIP_TAC; + +ONCE_REWRITE_TAC[GSYM IN] +THEN MATCH_MP_TAC(GEN_ALL IN_NOT_EMPTY_B1_SY_6_IS_SCS) +THEN EXISTS_TAC`x:real^(M,3)finite_product` +THEN EXISTS_TAC`v:real^3^M` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC; + +SUBGOAL_THEN`vector [ vv1 1; vv1 2; (vv1:num->real^3) 3;vv1 4; vv1 5; vv1 0] = v:real^3^M` +ASSUME_TAC; + +POP_ASSUM(fun th-> REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`1 MOD 6=1/\ 2 MOD 6=2/\ 3 MOD 6=3/\ 0 MOD 6 +=0 /\ ~(1=0)/\ ~(2=0)/\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2) /\ ~(4=0) /\ ~(4=1) /\ ~(4=2) /\ ~(4=3)/\ 4 MOD 6=4/\ 5 MOD 6=5/\ ~(1=5)/\ ~(2=5)/\ ~(3=5)/\ ~(4=5)/\ ~(0=5)`;] +THEN ONCE_REWRITE_TAC[CART_EQ] +THEN ASM_REWRITE_TAC[ARITH_RULE`1<=i/\ i<=6 + <=>i=1\/ i=2\/ i=3\/ i=4\/ i=5\/ i=6`] +THEN REPEAT RESA_TAC +THEN +ASM_SIMP_TAC[row;vector; LAMBDA_BETA; DIMINDEX_3; LENGTH; ARITH] THEN +REWRITE_TAC[num_CONV `4`;num_CONV `5`;num_CONV `3`;num_CONV `2`; num_CONV `1`; EL; HD; TL;] +THEN ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;row;LAMBDA_BETA]; + + +STRIP_TAC; + +GEN_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM IN] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_6_IS_SCS) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_IS_SCS_CASE_6)[`v:real^3^M`;`s:scs_v39`;`vv1:num->real^3`;`s1:stable_sy`;`x:real^(M,3)finite_product`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_IS_SCS_CASE_6) +[`vector [ww 1; ww 2; ww 3; ww 4;ww 5; ww 0]:real^3^M`;`s:scs_v39`;`ww:num->real^3`;`s1:stable_sy`;`matvec(vector [ww 1; ww 2; ww 3; ww 4;ww 5; ww 0]:real^3^M):real^(M,3)finite_product`;] +THEN MRESA_TAC (GEN_ALL IN_IS_SCS_CASE_6)[`ww:num->real^3`;`vector [ww 1; ww 2; ww 3; ww 4;ww 5; ww 0]:real^3^M`;`matvec(vector [ww 1; ww 2; ww 3; ww 4;ww 5; ww 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN REPLICATE_TAC (27-23) (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN REWRITE_TAC[IN] +THEN STRIP_TAC) +THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC +THEN REWRITE_TAC[th] +THEN RESA_TAC) +THEN REPLICATE_TAC (26-20) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th `matvec(vector [ww 1; ww 2; ww 3; ww 4;ww 5; ww 0]:real^3^M):real^(M,3)finite_product`); + +MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_6_IS_SCS) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_IS_SCS_CASE_6)[`v:real^3^M`;`s:scs_v39`;`vv1:num->real^3`;`s1:stable_sy`;`x:real^(M,3)finite_product`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_IS_SCS_CASE_6) +[`vector [vv 1; vv 2; vv 3; vv 4; vv 5; vv 0]:real^3^M`;`s:scs_v39`;`vv:num->real^3`;`s1:stable_sy`;`matvec(vector [vv 1; vv 2; vv 3; vv 4; vv 5; vv 0]:real^3^M):real^(M,3)finite_product`;] +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN MRESA_TAC (GEN_ALL IN_IS_SCS_CASE_6)[`vv:num->real^3`;`vector [vv 1; vv 2; vv 3; vv 4; vv 5; vv 0]:real^3^M`;`matvec(vector [vv 1; vv 2; vv 3; vv 4; vv 5; vv 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN ASM_REWRITE_TAC[IN] +THEN STRIP_TAC +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th `matvec(vector [vv 1; vv 2; vv 3; vv 4; vv 5;vv 0]:real^3^M):real^(M,3)finite_product`) +THEN REPLICATE_TAC (26-4) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +]);; + (* }}} *) + + +(****************CASE 3**************) + +let IS_SCS_IN_BALL_ANNULUS_3= +fun (so:term)-> +REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th THEN REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM]) +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN EXISTS_TAC so +THEN MRESAL_TAC VECTOR_3_3[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=3/\ 2<=3/\ 3<=3/\ 3<=3/\ 3 MOD 3= 0 /\ 1 MOD 3= 1 /\ 2 MOD 3= 2/\ 3 MOD 3= 0/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)`;SET_RULE`(a:num) IN (:num)`] +;; + + + +let IN_IS_SCS_CASE_3=prove_by_refinement( +` is_scs_v39 s /\ scs_k_v39 s=3 /\ BBs_v39 s vv +/\ dimindex(:M)= scs_k_v39 s +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +==> +a IN {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v }`, + (* {{{ proof *) +[ +REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;IN_ELIM_THM;CONDITION1_SY;CONDITION2_SY;BBs_v39;LET_DEF;LET_END_DEF;change_type_v3;dist] +THEN STRIP_TAC; + +EXISTS_TAC`v:real^3^M` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`(1<= i /\ i<= 3)<=> (i=1\/ i=2\/ i=3)`] +THEN REPEAT STRIP_TAC +THENL[ +IS_SCS_IN_BALL_ANNULUS_3 `1`; +IS_SCS_IN_BALL_ANNULUS_3 `2`; +IS_SCS_IN_BALL_ANNULUS_3 `0`]; + +REWRITE_TAC[ARITH_RULE`(1<= i /\ i<= 3)<=> (i=1\/ i=2\/ i=3 )`] +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`1<=i /\ i<= 3==> (i=1\/ i=2\/ i=3)`) +THEN RESA_TAC +THEN MRESAL_TAC VECTOR_3_3[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=3/\ 2<=3/\ 3<=3/\ 3<=3/\ 3 MOD 3= 0 /\ 1 MOD 3= 1 /\ 2 MOD 3= 2/\ 3 MOD 3= 0/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)`;SET_RULE`(a:num) IN (:num)`] +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;periodic2] +THEN STRIP_TAC +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 1`][periodic;ARITH_RULE`~(3=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3`[ARITH_RULE`3 MOD 3=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 1`][periodic;ARITH_RULE`~(3=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3`[ARITH_RULE`3 MOD 3=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 2`][periodic;ARITH_RULE`~(3=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3`[ARITH_RULE`3 MOD 3=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 2`][periodic;ARITH_RULE`~(3=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3`[ARITH_RULE`3 MOD 3=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 3`][periodic;ARITH_RULE`~(3=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3`[ARITH_RULE`3 MOD 3=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 3`][periodic;ARITH_RULE`~(3=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3`[ARITH_RULE`3 MOD 3=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 0`][periodic;ARITH_RULE`~(3=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3`[ARITH_RULE`3 MOD 3=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 0`][periodic;ARITH_RULE`~(3=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3`[ARITH_RULE`3 MOD 3=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[ SYM th;NORM_SUB;]) +THEN REWRITE_TAC[VECTOR_ARITH`A-A= vec 0`;NORM_0;REAL_ARITH`&0<= &0`]; + +EXISTS_TAC`v:real^3^M` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`(1<= i /\ i<= 3)<=> (i=1\/ i=2\/ i=3)`] +THEN REPEAT STRIP_TAC +THENL[ +IS_SCS_IN_BALL_ANNULUS_3 `1`; +IS_SCS_IN_BALL_ANNULUS_3 `2`; +IS_SCS_IN_BALL_ANNULUS_3 `0`]; + +REWRITE_TAC[ARITH_RULE`(1<= i /\ i<= 3)<=> (i=1\/ i=2\/ i=3 )`] +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`1<=i /\ i<= 3==> (i=1\/ i=2\/ i=3)`) +THEN RESA_TAC +THEN MRESAL_TAC VECTOR_3_3[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=3/\ 2<=3/\ 3<=3/\ 3<=3/\ 3 MOD 3= 0 /\ 1 MOD 3= 1 /\ 2 MOD 3= 2/\ 3 MOD 3= 0/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)`;SET_RULE`(a:num) IN (:num)`] +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;periodic2] +THEN STRIP_TAC +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 1`][periodic;ARITH_RULE`~(3=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3`[ARITH_RULE`3 MOD 3=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 1`][periodic;ARITH_RULE`~(3=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3`[ARITH_RULE`3 MOD 3=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 2`][periodic;ARITH_RULE`~(3=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3`[ARITH_RULE`3 MOD 3=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 2`][periodic;ARITH_RULE`~(3=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3`[ARITH_RULE`3 MOD 3=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 3`][periodic;ARITH_RULE`~(3=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3`[ARITH_RULE`3 MOD 3=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 3`][periodic;ARITH_RULE`~(3=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3`[ARITH_RULE`3 MOD 3=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_a_v39 s 0`][periodic;ARITH_RULE`~(3=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3`[ARITH_RULE`3 MOD 3=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;NORM_SUB]) +THEN MRESAL_TAC (GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s:num`;`scs_b_v39 s 0`][periodic;ARITH_RULE`~(3=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`3`[ARITH_RULE`3 MOD 3=0`]) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[ SYM th;NORM_SUB;]) +THEN REWRITE_TAC[VECTOR_ARITH`A-A= vec 0`;NORM_0;REAL_ARITH`&0<= &0`]; +]);; + + + +let ARITH_3_TAC =ARITH_RULE`1<=3/\1<=2/\1<=3/\1<=1/\2<=3/\3<=3/\4<=4/\ ~(1=0)/\ ~(2=0)/\ ~(2=1)/\ ~(3=0)/\ ~(3=1)/\ ~(3=2)/\ 0 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2/\ 3 MOD 3=0/\ SUC 0=1 /\ SUC 1=2/\ SUC 2=3/\ SUC 3=4/\ 0<3/\ a+0=a/\ 0+a=a/\ 3-1=2/\ 3-2=1/\ 3-0=3/\ 3-3=0`;; + + + + +let VV_IN_BALL_ANNULUS_TAC_3= +fun (so:term)-> +REPLICATE_TAC (30-23)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th so[ARITH_RULE`1<=3/\1<=2/\1<=3/\1<=1/\2<=3/\3<=3/\4<=4/\ ~(1=0)/\ ~(2=0)/\ ~(2=1)/\ ~(3=0)/\ ~(3=1)/\ ~(3=2)`;IN]) +;; + + +let SCS_A_LE_NORM_3_IS_SCS= +fun (so:term) (so1:term)-> +REPLICATE_TAC (32-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th [so;so1][ARITH_3_TAC;IN]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (33-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN ASSUME_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s i`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (j MOD scs_k_v39 s)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`3:num`[ARITH_RULE`3 MOD 3=0`] THEN MRESA1_TAC th`i:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i MOD scs_k_v39 s)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`3:num`[ARITH_RULE`3 MOD 3=0`]) +THEN REPEAT RESA_TAC +;; + +let PROVE_INEQUALITY_TAC_3= +fun (th:term)-> +MP_TAC(ARITH_RULE`(j MOD 3<3)==> (j MOD 3=0) \/ (j MOD 3=1) \/ (j MOD 3=2)`) +THEN RESA_TAC +THENL[ +SCS_A_LE_NORM_3_IS_SCS th `3`; +SCS_A_LE_NORM_3_IS_SCS th `1`; +SCS_A_LE_NORM_3_IS_SCS th `2`;];; + + + + +let SCS_B_LE_NORM_3_IS_SCS= +fun (so:term) (so1:term)-> +REPLICATE_TAC (32-24)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th [so;so1][ARITH_3_TAC;IN]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (33-20)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (2)(POP_ASSUM MP_TAC) +THEN ASSUME_TAC th) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (j MOD scs_k_v39 s)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`3:num`[ARITH_RULE`3 MOD 3=0`] THEN MRESA1_TAC th`i:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (i MOD scs_k_v39 s)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`3:num`[ARITH_RULE`3 MOD 3=0`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`3:num`[ARITH_RULE`3 MOD 3=0`]) +THEN REPEAT RESA_TAC +;; + +let PROVE_INEQUALITY_TAC_3B= +fun (th:term)-> +MP_TAC(ARITH_RULE`(j MOD 3<3)==> (j MOD 3=0) \/ (j MOD 3=1) \/ (j MOD 3=2)`) +THEN RESA_TAC +THENL[ +SCS_B_LE_NORM_3_IS_SCS th `3`; +SCS_B_LE_NORM_3_IS_SCS th `1`; +SCS_B_LE_NORM_3_IS_SCS th `2`;];; + + + +let IN_NOT_EMPTY_B1_SY_3_IS_SCS=prove_by_refinement( +`is_scs_v39 s /\ scs_k_v39 s=3 /\ +dimindex(:M) = scs_k_v39 s/\ + matvec (v:real^3^M) =a/\ +(!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ + CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ (!i. vv i = +if i MOD scs_k_v39 s = 0 then row 3 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +row 2 v) +==> vv IN BBs_v39 s`, +[ +REWRITE_TAC[CONDITION1_SY;CONDITION2_SY;change_type_v3] +THEN REPEAT STRIP_TAC +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;] +THEN REPEAT RESA_TAC; + +ASM_REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC DIVISION[`x':num`;`3`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 3<3 ==> x' MOD 3 = 0 \/ x' MOD 3 = 1 \/ x' MOD 3 = 2 `) +THEN RESA_TAC +THENL[ +VV_IN_BALL_ANNULUS_TAC_3 `3`; +VV_IN_BALL_ANNULUS_TAC_3 `1`; +VV_IN_BALL_ANNULUS_TAC_3 `2`;]; + + +ASM_REWRITE_TAC[periodic] +THEN GEN_TAC +THEN MRESAL_TAC MOD_EQ[`i+3:num`;`i:num`;`3:num`;`1`][ARITH_RULE`1*A=A`]; + +REWRITE_TAC[dist] +THEN REPEAT GEN_TAC +THEN SUBGOAL_THEN`!i. (vv:num->real^3) i= vv (i MOD 3)` ASSUME_TAC; + +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN GEN_TAC +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`3`][ARITH_RULE`~(3=0)`]; + +MRESAL_TAC DIVISION[`i:num`;`3`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC DIVISION[`j:num`;`3`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`(i MOD 3<3)==> (i MOD 3=0) \/ (i MOD 3=1) \/ (i MOD 3=2)`) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_3 `3`; +PROVE_INEQUALITY_TAC_3 `1`; +PROVE_INEQUALITY_TAC_3 `2`;]; + + +REWRITE_TAC[dist] +THEN REPEAT GEN_TAC +THEN SUBGOAL_THEN`!i. (vv:num->real^3) i= vv (i MOD 3)` ASSUME_TAC; + +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN GEN_TAC +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`3`][ARITH_RULE`~(3=0)`]; + +MRESAL_TAC DIVISION[`i:num`;`3`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC DIVISION[`j:num`;`3`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`(i MOD 3<3)==> (i MOD 3=0) \/ (i MOD 3=1) \/ (i MOD 3=2)`) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_3B `3`; +PROVE_INEQUALITY_TAC_3B `1`; +PROVE_INEQUALITY_TAC_3B `2`;]; + +REWRITE_TAC[ARITH_RULE`3<=3`]; + +]);; + (* }}} *) + + +let NOT_EMPTY_CASE_3_IS_SCS=prove_by_refinement( +` is_scs_v39 s /\ scs_k_v39 s=3 /\ BBs_v39 s vv +/\ dimindex(:M)= scs_k_v39 s +==> ~({matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v }={})`, +[REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;] +THEN STRIP_TAC +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 0]:real^3^M` +THEN ABBREV_TAC`a=matvec (v:real^3^M) ` +THEN EXISTS_TAC`a:real^(M,3)finite_product` +THEN MATCH_MP_TAC IN_IS_SCS_CASE_3 +THEN ASM_REWRITE_TAC[]]);; + + + + + + +let J1_TS=new_definition `J1_TS (s:tri_sy)= {x| ?i. {i MOD 3,f_ts s (i MOD (3))} IN J_TS s /\ i IN 1..3 /\ x=i,SUC(i MOD (3))}`;; + + + + +let d_fun3=new_definition `d_fun3 (s1:scs_v39)(s:tri_sy,l:real^(M,3)finite_product) = (d_ts s) + #0.1 * (if is_ear_v39 s1 then &1 else -- &1) * sum (J1_TS s) (\x. cstab -norm (row (FST x) (vecmats l) - row (SND x) (vecmats l) ))`;; + + + +let FINITE_J1_TS=prove(`!s:tri_sy . +FINITE (J1_TS s)`, +GEN_TAC +THEN REWRITE_TAC[J1_TS] +THEN MRESAL_TAC FINITE_IMAGE[`(\i. i, SUC(i MOD (3)))`;`1..3`][FINITE_NUMSEG;IMAGE] +THEN MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`{y | ?x. x IN 1..(3) /\ y = x,SUC(x MOD (3))}` +THEN ASM_REWRITE_TAC[SUBSET;IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]);; + +let INDEX_J1_TS=prove(`!s:tri_sy . +x IN J1_TS s ==> 1 <= FST x /\ FST x <= 3`, +REWRITE_TAC[J1_TS;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[]);; + + + +let CONTINUOUS_ON_D_FUN3=prove(`!s:tri_sy . +k=3 /\ +k_ts s =k /\ dimindex(:M) =k/\ I_TS s= 0..k-1 /\ f_ts s=(\i. ((1+i):num MOD k)) +==> lift o(\l:real^(M,3)finite_product. d_fun3 s1 (s,l)) continuous_on ( +{matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (a_ts s) (b_ts s) v })`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[d_fun3;LIFT_ADD;o_DEF;] +THEN MATCH_MP_TAC CONTINUOUS_ON_ADD +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;] +THEN MATCH_MP_TAC CONTINUOUS_ON_CMUL +THEN MATCH_MP_TAC CONTINUOUS_ON_CMUL +THEN ASSUME_TAC FINITE_J1_TS +THEN POP_ASSUM(fun th -> MRESA1_TAC th`s:tri_sy`) +THEN ASM_SIMP_TAC[LIFT_SUM;o_DEF] +THEN MATCH_MP_TAC CONTINUOUS_ON_VSUM +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[LIFT_SUB] +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;] +THEN MATCH_MP_TAC CONTINUOUS_ON_LIFT_NORM_COMPOSE +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC CONTINUOUS_ON_ROW +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[J1_TS;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT RESA_TAC; + +MATCH_MP_TAC CONTINUOUS_ON_ROW +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[J1_TS;IN_ELIM_THM;IN_NUMSEG] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC]);; + + + + + + +let tri_sy_explicit = prove_by_refinement( + `!k d s a b J f. tri_stable k d s a b J f ==> k_ts (tri_sy (k,d,s, a,b,J,f)) = k/\ +d_ts (tri_sy (k,d,s, a,b,J,f)) = d /\ +a_ts (tri_sy (k,d,s, a,b,J,f)) = a /\ +b_ts (tri_sy (k,d,s, a,b,J,f)) = b /\ +J_TS (tri_sy (k,d,s, a,b,J,f)) = J /\ +I_TS (tri_sy (k,d,s, a,b,J,f)) = s /\ +f_ts (tri_sy (k,d,s, a,b,J,f)) = f `, + (* {{{ proof *) + [ REWRITE_TAC[k_ts;d_ts;a_ts;b_ts;J_TS;I_TS;f_ts;tri_sy_tybij;] +THEN MP_TAC tri_sy_tybij +THEN STRIP_TAC +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> +POP_ASSUM (fun th1-> ASSUME_TAC th THEN MRESA1_TAC th1`(k,d,s,a,b,J,f):(num#real#(num->bool)#(num#num->real)#(num#num->real)#((num->bool)->bool)#(num->num))`)) +]);; + (* }}} *) + + + + +let IN_B_SY1_COLLINEAR_CASE_3_IS_SCS=prove_by_refinement( +`is_scs_v39 s +/\ scs_k_v39 s=3/\ +dimindex(:M)= scs_k_v39 s +==> + (!a. a IN {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v } +==> ~collinear{vec 0, row 1 (vecmats a),row 2 (vecmats a)}/\ +~collinear{vec 0, row 1 (vecmats a),row 3 (vecmats a)}/\ +~collinear{vec 0, row 2 (vecmats a),row 3 (vecmats a)})`, + (* {{{ proof *) +[ +REWRITE_TAC[IN_ELIM_THM;] +THEN STRIP_TAC +THEN GEN_TAC +THEN STRIP_TAC +THEN ABBREV_TAC`( vv i = +if i MOD scs_k_v39 s = 0 then row 3 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +row 2 (v:real^3^M))` +THEN MP_TAC IN_NOT_EMPTY_B1_SY_3_IS_SCS +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[Dih2k_hypermap.VECMATS_MATVEC_ID] +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC IS_SCS_NOT_COLLINEAR_BBs_CASE_3 +THEN RESA_TAC; + +SUBGOAL_THEN`vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 0]:real^3^M +=v`ASSUME_TAC; + +REPLICATE_TAC 4 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`1 MOD 3=1/\ 2 MOD 3=2/\ 3 MOD 3=0/\ 0 MOD 3=0 /\ ~(1=0)/\ ~(2=0)/\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2)`;] +THEN ONCE_REWRITE_TAC[CART_EQ] +THEN ASM_REWRITE_TAC[ARITH_RULE`1<=i/\ i<=3 <=>i=1\/ i=2\/ i=3`] +THEN REPEAT RESA_TAC +THEN +ASM_SIMP_TAC[row;vector; LAMBDA_BETA; DIMINDEX_3; LENGTH; ARITH] THEN +REWRITE_TAC[num_CONV `3`;num_CONV `2`; num_CONV `1`; EL; HD; TL;] +THEN ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;row;LAMBDA_BETA]; + +MRESAL_TAC VECTOR_3_3[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=3/\ 2<=3/\ 3<=3`]; +]);; + (* }}} *) + + + +let HDPLYGY_CASE_30=prove_by_refinement( +`tri_stable k (d:real) (0..k-1) a b J (\i. ((1+i):num MOD k)) /\k= dimindex(:M) +/\ 2 row i v IN ball_annulus) /\ CONDITION1_SY a b v } = {}:real^(M,3)finite_product->bool) +/\ (!l. l IN {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY a b v } +==> ~collinear{vec 0, row 1 (vecmats l),row 2 (vecmats l)}/\ +~collinear{vec 0, row 1 (vecmats l),row 3 (vecmats l)}/\ +~collinear{vec 0, row 2 (vecmats l),row 3 (vecmats l)}) +/\ k_ts s = 3 /\ I_TS s = 0..3 - 1 /\ f_ts s = (\i. (1 + i) MOD 3) +/\ a_ts s =a /\ b_ts s =b +==> ?x:real^(M,3)finite_product. x IN ({matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY a b v }) +/\ (!y:real^(M,3)finite_product. y IN ({matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY a b v }) +==> tau3 (row 1 (vecmats (x:real^(M,3)finite_product))) (row 2 (vecmats x)) (row 3 ( vecmats x)) +- d_fun3 s1 (s,x) + <= tau3 (row 1 (vecmats y)) (row 2 (vecmats y)) (row 3 (vecmats y)) +- d_fun3 s1 (s,y) +)`, + (* {{{ proof *) +[ + +REPEAT STRIP_TAC +THEN MP_TAC TRI_STABLE_K_EQ_3 +THEN RESA_TAC +THEN MRESA_TAC CONTINUOUS_ATTAINS_INF[`(\x:real^(M,3)finite_product. tau3 (row 1 (vecmats (x:real^(M,3)finite_product))) (row 2 (vecmats x)) (row 3 ( vecmats x))- d_fun3 s1 (s,x))`;`{matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY a b v }:real^(M,3)finite_product->bool`] +THEN POP_ASSUM MATCH_MP_TAC +THEN STRIP_TAC; + +POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MATCH_MP_TAC COMPACT_TRI_STABLE +THEN ASM_REWRITE_TAC[]; + +SIMP_TAC[o_DEF;LIFT_SUM;FINITE_NUMSEG; o_DEF;LIFT_SUB;LIFT_SUM;REAL_ARITH`A+B+C-D=((A+B)+C)-D`] +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN ONCE_REWRITE_TAC[SET_RULE`A/\B <=> B/\ A`] +THEN STRIP_TAC; + +MRESAL_TAC(GEN_ALL CONTINUOUS_ON_D_FUN3)[`k:num`;`s1:scs_v39`;`s:tri_sy`][o_DEF]; + +POP_ASSUM MP_TAC +THEN REPLICATE_TAC 5(REMOVE_ASSUM_TAC) +THEN STRIP_TAC +THEN SIMP_TAC[o_DEF;LIFT_SUM;FINITE_NUMSEG;tau3; o_DEF;LIFT_SUB;LIFT_SUM;REAL_ARITH`A+B+C-D=((A+B)+C)-D`] +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN SIMP_TAC[o_DEF;LIFT_ADD;] +THEN MATCH_MP_TAC CONTINUOUS_ON_ADD +THEN STRIP_TAC; + + +SIMP_TAC[o_DEF;LIFT_ADD;] +THEN MATCH_MP_TAC CONTINUOUS_ON_ADD +THEN STRIP_TAC; + + +SIMP_TAC[o_DEF;LIFT_CMUL;FINITE_NUMSEG] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC CONTINUOUS_ON_MUL +THEN STRIP_TAC; + + +REWRITE_TAC[rho;o_DEF;LIFT_ADD] +THEN MATCH_MP_TAC CONTINUOUS_ON_ADD +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_CMUL +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_ADD;ly;interp;REAL_ARITH`a*b=b*a`;LIFT_CMUL] +THEN MATCH_MP_TAC CONTINUOUS_ON_ADD +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_CMUL +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_ADD;ly;interp;REAL_ARITH`a*b=b*a`;LIFT_CMUL] +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_LIFT_NORM_COMPOSE +THEN MATCH_MP_TAC CONTINUOUS_ON_ROW +THEN ASM_REWRITE_TAC[IN_NUMSEG] +THEN ARITH_TAC; + +REWRITE_TAC[CONTINUOUS_ON_SEQUENTIALLY;o_DEF] +THEN REPEAT STRIP_TAC +THEN MP_TAC (GEN_ALL SEQUENTIALLY_DIVH) +THEN REWRITE_TAC[o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESAL_TAC (GEN_ALL LIM_VECMAT)[`(\n:num. vecmats ((x:num->real^(M,3)finite_product) n))`;`vecmats(a':real^(M,3)finite_product)`][MATVEC_VECMATS_ID;ETA_AX] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`1`[ARITH_RULE`1<=1/\ 1<=3`] +THEN MRESAL1_TAC th`2`[ARITH_RULE`1<=2/\ 2<=3`] +THEN MRESAL1_TAC th`3`[ARITH_RULE`1<=3/\ 3<=3`]) +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th `a':real^(M,3)finite_product` +THEN ASSUME_TAC th) +THEN GEN_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x (n:num)):real^(M,3)finite_product`) + +; + + + +SIMP_TAC[o_DEF;LIFT_CMUL;FINITE_NUMSEG] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC CONTINUOUS_ON_MUL +THEN STRIP_TAC; + + +REWRITE_TAC[rho;o_DEF;LIFT_ADD] +THEN MATCH_MP_TAC CONTINUOUS_ON_ADD +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_CMUL +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_ADD;ly;interp;REAL_ARITH`a*b=b*a`;LIFT_CMUL] +THEN MATCH_MP_TAC CONTINUOUS_ON_ADD +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_CMUL +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_ADD;ly;interp;REAL_ARITH`a*b=b*a`;LIFT_CMUL] +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_LIFT_NORM_COMPOSE +THEN MATCH_MP_TAC CONTINUOUS_ON_ROW +THEN ASM_REWRITE_TAC[IN_NUMSEG] +THEN ARITH_TAC; + +REWRITE_TAC[CONTINUOUS_ON_SEQUENTIALLY;o_DEF] +THEN REPEAT STRIP_TAC +THEN MP_TAC (GEN_ALL SEQUENTIALLY_DIVH) +THEN REWRITE_TAC[o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESAL_TAC (GEN_ALL LIM_VECMAT)[`(\n:num. vecmats ((x:num->real^(M,3)finite_product) n))`;`vecmats(a':real^(M,3)finite_product)`][MATVEC_VECMATS_ID;ETA_AX] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`1`[ARITH_RULE`1<=1/\ 1<=3`] +THEN MRESAL1_TAC th`2`[ARITH_RULE`1<=2/\ 2<=3`] +THEN MRESAL1_TAC th`3`[ARITH_RULE`1<=3/\ 3<=3`]) +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th `a':real^(M,3)finite_product` +THEN ASSUME_TAC th) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x (n:num)):real^(M,3)finite_product`) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] + +; + + + +SIMP_TAC[o_DEF;LIFT_CMUL;FINITE_NUMSEG] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC CONTINUOUS_ON_MUL +THEN STRIP_TAC; + + +REWRITE_TAC[rho;o_DEF;LIFT_ADD] +THEN MATCH_MP_TAC CONTINUOUS_ON_ADD +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_CMUL +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_ADD;ly;interp;REAL_ARITH`a*b=b*a`;LIFT_CMUL] +THEN MATCH_MP_TAC CONTINUOUS_ON_ADD +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_CMUL +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_ADD;ly;interp;REAL_ARITH`a*b=b*a`;LIFT_CMUL] +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_LIFT_NORM_COMPOSE +THEN MATCH_MP_TAC CONTINUOUS_ON_ROW +THEN ASM_REWRITE_TAC[IN_NUMSEG] +THEN ARITH_TAC; + +REWRITE_TAC[CONTINUOUS_ON_SEQUENTIALLY;o_DEF] +THEN REPEAT STRIP_TAC +THEN MP_TAC (GEN_ALL SEQUENTIALLY_DIVH) +THEN REWRITE_TAC[o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESAL_TAC (GEN_ALL LIM_VECMAT)[`(\n:num. vecmats ((x:num->real^(M,3)finite_product) n))`;`vecmats(a':real^(M,3)finite_product)`][MATVEC_VECMATS_ID;ETA_AX] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`1`[ARITH_RULE`1<=1/\ 1<=3`] +THEN MRESAL1_TAC th`2`[ARITH_RULE`1<=2/\ 2<=3`] +THEN MRESAL1_TAC th`3`[ARITH_RULE`1<=3/\ 3<=3`]) +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th `a':real^(M,3)finite_product` +THEN ASSUME_TAC th) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x (n:num)):real^(M,3)finite_product`) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[]; +]);; + (* }}} *) + + + + + + +let TAUSTAR_EQ_TAU_STAR_3_IS_SCS=prove_by_refinement( +`is_scs_v39 s /\ BBs_v39 s vv +/\ scs_k_v39 s=3 +/\ dimindex (:M)=3 +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +/\ tri_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))=s1 +==> taustar_v39 s vv = tau3 (vv 1) (vv 2) (vv 0) -d_fun3 s (s1,a)`, + (* {{{ proof *) +[ + +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[taustar_v39;tau_star;LET_DEF;LET_END_DEF;ARITH_RULE`3<=3`;] +THEN MATCH_MP_TAC(REAL_ARITH`a=b /\ c=d==> a -c= b- d`) +THEN STRIP_TAC +; + +REWRITE_TAC[tau3] +THEN REAL_ARITH_TAC; + +REWRITE_TAC[dsv_v39;d_fun3] +THEN MP_TAC IS_SCS_TRI_STABLE_SYSTEM +THEN RESA_TAC +THEN MRESA_TAC tri_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[Dih2k_hypermap.VECMATS_MATVEC_ID] +THEN MATCH_MP_TAC(REAL_ARITH`a=b ==> d+ a=d+b`) +THEN MP_TAC(SET_RULE`is_ear_v39 s \/ ~(is_ear_v39 s)`) +THEN RESA_TAC + +; + + +MATCH_MP_TAC(REAL_ARITH`a=b ==> #0.1 * &1 * a= #0.1 * &1 *b`) +THEN ASM_REWRITE_TAC[J1_TS;change_type_v2;IN_ELIM_THM] +THEN MATCH_MP_TAC SUM_EQ_GENERAL +THEN REWRITE_TAC[IN_ELIM_THM;dist] +THEN EXISTS_TAC`(\i. if i MOD 3=0 then 3,1 else i, SUC(i MOD 3))` +THEN STRIP_TAC; + + +REWRITE_TAC[IN_ELIM_THM; IMAGE;EXISTS_UNIQUE;IN_NUMSEG] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`i<=3==> i=3\/ (i<3)`) +THEN RESA_TAC; + +REWRITE_TAC[ARITH_3_TAC] +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_3_TAC] +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th;ARITH_3_TAC] +THEN REPEAT DISCH_TAC) +THEN STRIP_TAC +; + +MP_TAC(SET_RULE`{0, 1} = {i' MOD 3, j MOD 3} ==> (i' MOD 3=0/\ j MOD 3=1)\/ (i' MOD 3=1/\ j MOD 3=0)`) +THEN RESA_TAC; + + +ASM_TAC +THEN REWRITE_TAC[is_scs_v39;periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i'`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s 1`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i':num`) +; + + +ASM_TAC +THEN REWRITE_TAC[is_scs_v39;periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i'`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s 0`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i':num`) +; + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC MOD_LT[`y':num`;`3`][ARITH_3_TAC] +THEN MP_TAC(SET_RULE`y' MOD 3=0\/ ~(y' MOD 3=0)`) +THEN RESA_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN STRIP_TAC +THEN MRESAL_TAC Ssrnat.eqSS[`y':num`;`0`][ARITH_3_TAC]; + + +EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`~(i MOD 3=0)`ASSUME_TAC; + +MP_TAC(ARITH_RULE`1<=i/\ i<3==> i=1\/ i=2`) +THEN RESA_TAC +THEN REWRITE_TAC[ARITH_3_TAC] +; + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +; + +REPLICATE_TAC (22-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN MRESAL_TAC MOD_LT[`i:num`;`3`][ARITH_3_TAC] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`{i, (1 + i) MOD 3} = {i' MOD 3, j MOD 3} +==> (i' MOD 3= i/\ j MOD 3= (1+i) MOD 3)\/ (i' MOD 3= (1+i) MOD 3/\ j MOD 3= i)`) +THEN RESA_TAC; + + +ASM_TAC +THEN REWRITE_TAC[is_scs_v39;periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i'`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((1 + i) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i':num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`1+i:num`) +THEN REWRITE_TAC[ADD1;] +THEN ONCE_REWRITE_TAC[ADD_SYM] +THEN ASM_REWRITE_TAC[]; + + + +ASM_TAC +THEN REWRITE_TAC[is_scs_v39;periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i'`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i':num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`1+i:num`) +THEN REWRITE_TAC[ADD1;] +THEN ONCE_REWRITE_TAC[ADD_SYM] +THEN ASM_REWRITE_TAC[]; + + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC MOD_LT[`y':num`;`3`][ARITH_3_TAC] +THEN MP_TAC(SET_RULE`y'=0\/ ~(y'=0)`) +THEN RESA_TAC +; + +REWRITE_TAC[PAIR_EQ] +THEN MP_TAC(ARITH_RULE`i<3==> ~(3=i)`) +THEN RESA_TAC; + +REWRITE_TAC[PAIR_EQ] +THEN RESA_TAC; + + +REPEAT RESA_TAC +THEN MRESAL_TAC MOD_LT[`x:num`;`3`][ARITH_3_TAC] +; + +MP_TAC(ARITH_RULE`x=0 \/ ~(x=0)`) +THEN RESA_TAC +; + +EXISTS_TAC`3` +THEN ASM_REWRITE_TAC[IN_NUMSEG;ARITH_3_TAC] +THEN EXISTS_TAC`x:num` +THEN EXISTS_TAC`SUC x:num` +THEN ASM_REWRITE_TAC[ARITH_3_TAC]; + +EXISTS_TAC`x:num` +THEN ASM_REWRITE_TAC[IN_NUMSEG] +THEN MP_TAC(ARITH_RULE`~(x=0) /\ x<3==> 1<=x/\ x<=3`) +THEN RESA_TAC +THEN EXISTS_TAC`x:num` +THEN EXISTS_TAC`SUC x` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[ADD_SYM] +THEN REWRITE_TAC[ADD1] +; + + +MP_TAC(ARITH_RULE`x<3==> x=0 \/ (~(x=0) /\ x=1) \/ (~(x=0) /\ x=2)`) +THEN RESA_TAC +THEN MRESAL_TAC VECTOR_3_3[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=3/\ 2<=3/\ 3<=3/\ SUC 0=1/\ SUC 1=2/\ SUC 2=3`] +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;periodic;LET_DEF;LET_END_DEF;] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`3:num`[ARITH_3_TAC]) + +; + + +(*************-1*************) + +MATCH_MP_TAC(REAL_ARITH`a=b ==> #0.1 * -- &1 * a= #0.1 * -- &1 *b`) +THEN ASM_REWRITE_TAC[J1_TS;change_type_v2;IN_ELIM_THM] +THEN MATCH_MP_TAC SUM_EQ_GENERAL +THEN REWRITE_TAC[IN_ELIM_THM;dist] +THEN EXISTS_TAC`(\i. if i MOD 3=0 then 3,1 else i, SUC(i MOD 3))` +THEN STRIP_TAC; + + +REWRITE_TAC[IN_ELIM_THM; IMAGE;EXISTS_UNIQUE;IN_NUMSEG] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`i<=3==> i=3\/ (i<3)`) +THEN RESA_TAC; + +REWRITE_TAC[ARITH_3_TAC] +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_3_TAC] +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th;ARITH_3_TAC] +THEN REPEAT DISCH_TAC) +THEN STRIP_TAC +; + +MP_TAC(SET_RULE`{0, 1} = {i' MOD 3, j MOD 3} ==> (i' MOD 3=0/\ j MOD 3=1)\/ (i' MOD 3=1/\ j MOD 3=0)`) +THEN RESA_TAC; + + +ASM_TAC +THEN REWRITE_TAC[is_scs_v39;periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i'`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s 1`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i':num`) +; + + +ASM_TAC +THEN REWRITE_TAC[is_scs_v39;periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i'`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s 0`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i':num`) +; + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC MOD_LT[`y':num`;`3`][ARITH_3_TAC] +THEN MP_TAC(SET_RULE`y' MOD 3=0\/ ~(y' MOD 3=0)`) +THEN RESA_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN STRIP_TAC +THEN MRESAL_TAC Ssrnat.eqSS[`y':num`;`0`][ARITH_3_TAC]; + + +EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`~(i MOD 3=0)`ASSUME_TAC; + +MP_TAC(ARITH_RULE`1<=i/\ i<3==> i=1\/ i=2`) +THEN RESA_TAC +THEN REWRITE_TAC[ARITH_3_TAC] +; + +ASM_REWRITE_TAC[] +THEN STRIP_TAC +; + +REPLICATE_TAC (22-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN MRESAL_TAC MOD_LT[`i:num`;`3`][ARITH_3_TAC] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`{i, (1 + i) MOD 3} = {i' MOD 3, j MOD 3} +==> (i' MOD 3= i/\ j MOD 3= (1+i) MOD 3)\/ (i' MOD 3= (1+i) MOD 3/\ j MOD 3= i)`) +THEN RESA_TAC; + + +ASM_TAC +THEN REWRITE_TAC[is_scs_v39;periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i'`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((1 + i) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i':num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`1+i:num`) +THEN REWRITE_TAC[ADD1;] +THEN ONCE_REWRITE_TAC[ADD_SYM] +THEN ASM_REWRITE_TAC[]; + + + +ASM_TAC +THEN REWRITE_TAC[is_scs_v39;periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i'`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i':num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`1+i:num`) +THEN REWRITE_TAC[ADD1;] +THEN ONCE_REWRITE_TAC[ADD_SYM] +THEN ASM_REWRITE_TAC[]; + + + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC MOD_LT[`y':num`;`3`][ARITH_3_TAC] +THEN MP_TAC(SET_RULE`y'=0\/ ~(y'=0)`) +THEN RESA_TAC +; + +REWRITE_TAC[PAIR_EQ] +THEN MP_TAC(ARITH_RULE`i<3==> ~(3=i)`) +THEN RESA_TAC; + +REWRITE_TAC[PAIR_EQ] +THEN RESA_TAC; + + +REPEAT RESA_TAC +THEN MRESAL_TAC MOD_LT[`x:num`;`3`][ARITH_3_TAC] +; + +MP_TAC(ARITH_RULE`x=0 \/ ~(x=0)`) +THEN RESA_TAC +; + +EXISTS_TAC`3` +THEN ASM_REWRITE_TAC[IN_NUMSEG;ARITH_3_TAC] +THEN EXISTS_TAC`x:num` +THEN EXISTS_TAC`SUC x:num` +THEN ASM_REWRITE_TAC[ARITH_3_TAC]; + +EXISTS_TAC`x:num` +THEN ASM_REWRITE_TAC[IN_NUMSEG] +THEN MP_TAC(ARITH_RULE`~(x=0) /\ x<3==> 1<=x/\ x<=3`) +THEN RESA_TAC +THEN EXISTS_TAC`x:num` +THEN EXISTS_TAC`SUC x` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[ADD_SYM] +THEN REWRITE_TAC[ADD1] +; + + +MP_TAC(ARITH_RULE`x<3==> x=0 \/ (~(x=0) /\ x=1) \/ (~(x=0) /\ x=2)`) +THEN RESA_TAC +THEN MRESAL_TAC VECTOR_3_3[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=3/\ 2<=3/\ 3<=3/\ SUC 0=1/\ SUC 1=2/\ SUC 2=3`] +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;periodic;LET_DEF;LET_END_DEF;] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`3:num`[ARITH_3_TAC]) + +; + +]);; + + +let XWITCCN_CASE_3_IS_SCS=prove_by_refinement( +`is_scs_v39 s /\ BBs_v39 s vv +/\ scs_k_v39 s=3 +/\ dimindex(:M) =scs_k_v39 s +/\ taustar_v39 s vv < &0 + ==> ~(BBprime_v39 s = {})`, + + (* {{{ proof *) +[ +STRIP_TAC +THEN MP_TAC IS_SCS_TRI_STABLE_SYSTEM +THEN RESA_TAC +THEN MP_TAC NOT_EMPTY_CASE_3_IS_SCS +THEN RESA_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`] +THEN MP_TAC IN_B_SY1_COLLINEAR_CASE_3_IS_SCS +THEN RESA_TAC +THEN ABBREV_TAC`s1 =tri_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))` +THEN MRESA_TAC tri_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s)(scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN MRESAL_TAC (GEN_ALL HDPLYGY_CASE_30)[`scs_d_v39 s`;`(change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;`scs_k_v39 s`;`(change_type_v3 (scs_a_v39 s))`;` (change_type_v3 (scs_b_v39 s))`;`s:scs_v39`;`s1:tri_sy`][ARITH_RULE`2<3`] +THEN POP_ASSUM (fun th-> +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN REWRITE_TAC[BBprime_v39;IN] +THEN ABBREV_TAC`( vv1 i = +if i MOD scs_k_v39 s = 0 then row 3 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +row 2 (v:real^3^M))` +THEN EXISTS_TAC`vv1:num->real^3` +THEN STRIP_TAC; + +ONCE_REWRITE_TAC[GSYM IN] +THEN MATCH_MP_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_3_IS_SCS) +THEN EXISTS_TAC`x:real^(M,3)finite_product` +THEN EXISTS_TAC`v:real^3^M` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; + +SUBGOAL_THEN`vector [ vv1 1; (vv1:num->real^3) 2;vv1 0] = v:real^3^M` +ASSUME_TAC; + +POP_ASSUM(fun th-> REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`1 MOD 3=1/\ 2 MOD 3=2/\ 3 MOD 3=0/\ 0 MOD 3=0 /\ ~(1=0)/\ ~(2=0)/\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2)`;] +THEN ONCE_REWRITE_TAC[CART_EQ] +THEN ASM_REWRITE_TAC[ARITH_RULE`1<=i/\ i<=3 <=>i=1\/ i=2\/ i=3`] +THEN REPEAT RESA_TAC +THEN +ASM_SIMP_TAC[row;vector; LAMBDA_BETA; DIMINDEX_3; LENGTH; ARITH] THEN +REWRITE_TAC[num_CONV `3`;num_CONV `2`; num_CONV `1`; EL; HD; TL;] +THEN ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;row;LAMBDA_BETA]; + +STRIP_TAC; + +GEN_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM IN] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_3_IS_SCS) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL TAUSTAR_EQ_TAU_STAR_3_IS_SCS)[`vector [(vv1:num->real^3) 1; vv1 2; vv1 0]:real^3^M`;`vv1:num->real^3`;`s:scs_v39`;`s1:tri_sy`;`matvec(vector [vv1 1; vv1 2; vv1 0]:real^3^M):real^(M,3)finite_product`] +THEN MRESA_TAC (GEN_ALL TAUSTAR_EQ_TAU_STAR_3_IS_SCS)[`vector [(ww:num->real^3) 1; ww 2; ww 0]:real^3^M`;`ww:num->real^3`;`s:scs_v39`;`s1:tri_sy`;`matvec(vector [ww 1; ww 2; ww 0]:real^3^M):real^(M,3)finite_product`] +THEN MRESA_TAC (GEN_ALL IN_IS_SCS_CASE_3)[`ww:num->real^3`;`vector [ww 1; ww 2; ww 0]:real^3^M`;`matvec(vector [ww 1; ww 2; ww 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`] +THEN MRESAL_TAC VECTOR_3_3[`(vv1:num->real^3) 1`;`(vv1:num->real^3) 2`;`(vv1:num->real^3) 0`;][ARITH_RULE`1<=3/\ 2<=3/\ 3<=3`] +THEN MRESAL_TAC VECTOR_3_3[`(ww:num->real^3) 1`;`(ww:num->real^3) 2`;`(ww:num->real^3) 0`;][ARITH_RULE`1<=3/\ 2<=3/\ 3<=3`] +THEN REPLICATE_TAC 13 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th `matvec(vector [ww 1; ww 2; ww 0]:real^3^M):real^(M,3)finite_product`[Dih2k_hypermap.VECMATS_MATVEC_ID]); + +MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_3_IS_SCS) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL TAUSTAR_EQ_TAU_STAR_3_IS_SCS)[`vector [(vv1:num->real^3) 1; vv1 2; vv1 0]:real^3^M`;`vv1:num->real^3`;`s:scs_v39`;`s1:tri_sy`;`matvec(vector [vv1 1; vv1 2; vv1 0]:real^3^M):real^(M,3)finite_product`] +THEN MRESA_TAC (GEN_ALL TAUSTAR_EQ_TAU_STAR_3_IS_SCS)[`vector [(vv:num->real^3) 1; vv 2; vv 0]:real^3^M`;`vv:num->real^3`;`s:scs_v39`;`s1:tri_sy`;`matvec(vector [vv 1; vv 2; vv 0]:real^3^M):real^(M,3)finite_product`] +THEN MRESA_TAC (GEN_ALL IN_IS_SCS_CASE_3)[`vv:num->real^3`;`vector [vv 1; vv 2; vv 0]:real^3^M`;`matvec(vector [vv 1; vv 2; vv 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`] +THEN MRESAL_TAC VECTOR_3_3[`(vv1:num->real^3) 1`;`(vv1:num->real^3) 2`;`(vv1:num->real^3) 0`;][ARITH_RULE`1<=3/\ 2<=3/\ 3<=3`] +THEN MRESAL_TAC VECTOR_3_3[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=3/\ 2<=3/\ 3<=3`] +THEN REPLICATE_TAC 12 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th `matvec(vector [(vv:num->real^3) 1; vv 2; vv 0]:real^3^M):real^(M,3)finite_product`[Dih2k_hypermap.VECMATS_MATVEC_ID]) +THEN REPLICATE_TAC (31-4) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +]);; + (* }}} *) + + + + +let UXCKFPE=prove_by_refinement( +` !s vv . is_scs_v39 s /\ vv IN BBs_v39 s +/\ taustar_v39 s vv < &0 + ==> ~(BBprime_v39 s = {})`, + + (* {{{ proof *) +[ +REPEAT GEN_TAC +THEN REWRITE_TAC[IN] +THEN DISCH_TAC +THEN SUBGOAL_THEN`3<= scs_k_v39 s /\ scs_k_v39 s<=6` ASSUME_TAC; + +ASM_TAC +THEN REWRITE_TAC[is_scs_v39] +THEN RESA_TAC; + +MP_TAC(ARITH_RULE`3<= scs_k_v39 s /\ scs_k_v39 s<=6 ==> scs_k_v39 s=3 \/ scs_k_v39 s=4 \/ scs_k_v39 s=5 \/ scs_k_v39 s=6`) +THEN RESA_TAC; + +MP_TAC(INST_TYPE [`:3`,`:M`]XWITCCN_CASE_3_IS_SCS) +THEN ASM_REWRITE_TAC[DIMINDEX_3] +THEN STRIP_TAC ; + +MP_TAC(INST_TYPE [`:2+2`,`:M`]XWITCCN_CASE_4_IS_SCS) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_4] +THEN STRIP_TAC; + +MP_TAC(INST_TYPE [`:2+3`,`:M`]XWITCCN_CASE_5_IS_SCS) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_5] +THEN STRIP_TAC ; +MP_TAC(INST_TYPE [`:3+3`,`:M`]XWITCCN_CASE_6_IS_SCS) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_6] +THEN STRIP_TAC ]);; + + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/VASYYAU.hl b/text_formalization/local/VASYYAU.hl new file mode 100644 index 0000000..ca3554e --- /dev/null +++ b/text_formalization/local/VASYYAU.hl @@ -0,0 +1,2861 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Vasyyau = struct + + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +open Yxionxl2;; +open Eyypqdw;; +open Ocbicby;; +open Imjxphr;; +open Nuxcoea;; +open Aursipd;; +open Cuxvzoz;; +open Rrcwnsj;; +open Tfitskc;; +open Hexagons;; +open Otmtotj;; +open Hijqaha;; +open Cnicgsf;; +open Ardbzye;; +open Aueaheh;; + + +let WGDHPPI= prove(`!s v. + is_scs_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s ==> + CARD { i | i < scs_k_v39 s /\ scs_is_str s v i} <= 1`, +REPEAT RESA_TAC +THEN MRESA_TAC GSXRFWM[`s`;`v`] +THEN MRESAL_TAC Aursipd.AURSIPD[`s`;`v`][ARITH_RULE`3<4`] +THEN DICH_TAC 0 +THEN ARITH_TAC);; + +(************************************) + +let DIST_V_IN_BB_LE_C=prove(` scs_b_v39 s i (SUC i) <= c/\ + BBs_v39 s v +==> dist (v i, v (SUC i))<= c`, +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;dist] +THEN RESA_TAC +THEN THAYTHE_TAC 1[`i`;`SUC i`] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + +let arclength_lt_1553 = prove_by_refinement( + `&2 * arclength (&2) (&2) (&2 * h0) < arclength (&2) (&2) +(sqrt(#15.53))`, + (* {{{ proof *) + [ + REPEAT (GMATCH_SIMP_TAC Compute_2158872499.ATN_UPS_X_BREAKDOWN1); + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL_EQ); + REWRITE_TAC[arith `x + &2 - &2 = x`]; + REWRITE_TAC[Sphere.h0]; + TYPIFY `#3.9 < sqrt (#15.53) /\ sqrt(#15.53) < #3.95` (C +SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC REAL_LT_RSQRT; + CONJ_TAC; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC REAL_LT_LSQRT; + BY(REAL_ARITH_TAC); + TYPIFY_GOAL_THEN `&0 < &2 + &2 * #1.26 - &2 /\ &0 < &2 + &2 - &2 * + #1.26 /\ &0 < &2 + &2 + &2 * #1.26 /\ &0 < &2 + sqrt #15.53 - &2 /\ +&0 < &2 + &2 - sqrt #15.53 /\ &0 < &2 + &2 + sqrt #15.53 /\ &0 < +sqrt #15.53 /\ &0 < &2 * #1.26` (unlist REWRITE_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + MP_TAC (Flyspeck_constants.calc `&2 * (pi / &2 + atn (((&2 * +#1.26) * &2 * #1.26 - &2 * &2 - &2 * &2) / sqrt ((&2 + &2 + &2 * + #1.26) * (&2 + &2 - &2 * #1.26) * (&2 + &2 * #1.26 - &2) * + &2 * #1.26))) < pi / &2 + atn ((sqrt #15.53 * sqrt #15.53 - &2 +* &2 - &2 * &2) / sqrt ((&2 + &2 + sqrt #15.53) * (&2 + &2 - sqrt + #15.53) * (&2 + sqrt #15.53 - &2) * sqrt #15.53))` ); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + + + let ASSWPOW= prove_by_refinement( `!s v i. + is_scs_v39 s /\ v IN MMs_v39 s /\ scs_k_v39 s = 4 /\ scs_basic_v39 s /\ + scs_b_v39 s i (i+1) <= &2 * h0 /\ scs_b_v39 s (i+1) (i+2) <= &2 * h0 + ==> xrr (norm (v i)) (norm(v(i+2))) (dist(v i,v(i+2))) <= #15.53 `, +[ +REWRITE_TAC[IN;GSYM ADD1;ARITH_RULE`i+2=SUC(SUC i)`] +THEN REPEAT GEN_TAC +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN ABBREV_TAC`V= IMAGE (v:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((v:num->real^3) i, v (SUC i))) (:num)` +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`3<4`) +THEN MRESAL_TAC MMS_IMP_BBPRIME[`s`;`v`][LET_DEF;LET_END_DEF;BBprime_v39] +THEN MRESAL_TAC JKQEWGV2[`s`;`v`][LET_DEF;LET_END_DEF;scs_generic] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`k:num`;`s`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC; + + + + + +MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`i`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC i`] +THEN MRESA_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`SUC(SUC i)`] +THEN MRESA_TAC Axjrpnc.DIST_EDGE_IN_BB_LE_2[`s`;`v`;`i`] +THEN MRESA_TAC Axjrpnc.DIST_EDGE_IN_BB_LE_2[`s`;`v`;`SUC i`] +THEN MRESAL_TAC DIST_V_IN_BB_LE_C[`s`;`v`;`i`;`&2*h0`][dist] +THEN MRESAL_TAC DIST_V_IN_BB_LE_C[`s`;`v`;`SUC i`;`&2*h0`][dist] +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v i`;`v (SUC i)`;`&2* h0`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;REAL_ARITH`&2 * #1.26 < &4`] +THEN REWRITE_TAC[GSYM h0] +THEN STRIP_TAC +THEN MRESAL_TAC Ppbtydq.OIQKKEP[`v (SUC i)`;`v (SUC(SUC i))`;`&2* h0`][dist;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;REAL_ARITH`&2 * #1.26 < &4`] +THEN REWRITE_TAC[GSYM h0] +THEN STRIP_TAC +THEN DICH_TAC (26-18) +THEN DICH_TAC (25-18) +THEN DICH_TAC (24-18) +THEN REWRITE_TAC[Ckqowsa_3_points.in_ball_annulus] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC Trigonometry2.ARCV_INEQUALTY[`vec 0:real^3`;`v i`;`v (SUC (SUC i))`;`v(SUC i)`] +THEN MP_TAC(REAL_ARITH`arcV (vec 0) (v (i)) (v (SUC (i))) <= arclength (&2) (&2) (&2 * h0) +/\ arcV (vec 0) ((v:num->real^3) (SUC (i))) (v (SUC (SUC (i)))) <= + arclength (&2) (&2) (&2 * h0) +/\ &2 * arclength (&2) (&2) (&2 * h0) < arclength (&2) (&2) +(sqrt(#15.53)) +/\ arcV (vec 0) (v i) (v (SUC (SUC i))) <= + arcV (vec 0) (v i) (v (SUC i)) + + arcV (vec 0) (v (SUC i)) (v (SUC (SUC i))) +==>arcV (vec 0) (v i) (v (SUC (SUC i))) + < arclength (&2) (&2) +(sqrt(#15.53))`) +THEN ASM_SIMP_TAC[arclength_lt_1553] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN MRESAS_TAC Planarity.IMP_NORM_FAN[`v (i+0)`;`v(i+2):real^3`][VECTOR_ARITH`A- vec 0=A:real^3`;ARITH_RULE`~(4=0)/\ ~(0 MOD 4 = 2 MOD 4)`;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN MRESA_TAC WL_IN_V[`i+0`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`i+2`;`v:num->real^3`] +THEN MRESAL_TAC GSXRFWM[`s`;`v`][IN;scs_generic] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v (i+0)`;`v (i+2)`;`V`] +THEN THAYTHES_TAC 0[`v (i+0)`;`v (i+2)`][SET_RULE`a IN {a,b}`;ARITH_RULE`~(4=0)/\ ~(0 MOD 4 = 2 MOD 4)`;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN ASM_TAC +THEN REWRITE_TAC[ARITH_RULE`i+0=i/\ i+2=SUC(SUC i)`] +THEN REPEAT RESA_TAC +THEN ABBREV_TAC`u=(v:num->real^3) i` +THEN ABBREV_TAC`w=(v:num->real^3) (SUC (SUC i))` +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`u`;`vec 0:real^3`][VECTOR_ARITH`A- vec 0=A:real^3`] +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`w`;`vec 0:real^3`][VECTOR_ARITH`A- vec 0=A:real^3`] +THEN MRESAL_TAC Collect_geom2.NOT_COL_EQ_UPS_X_POS[`vec 0:real^3`;`u`;`w`][dist;VECTOR_ARITH`vec 0- a= --a:real^3`;NORM_NEG] +THEN MRESAL_TAC arclength_xrr[`norm (u)`;`norm w`;`norm (u-w)`][REAL_ARITH`a*a= a pow 2`] +THEN MRESA_TAC Trigonometry1.arcVarc[`vec 0:real^3`;`u`;`w`] +THEN DICH_TAC (62-45) +THEN ASM_SIMP_TAC[dist;VECTOR_ARITH`vec 0- a= --a:real^3`;NORM_NEG] +THEN MRESAL_TAC arclength_xrr[`&2`;`&2`;`sqrt #15.53`][REAL_ARITH`a*a= a pow 2/\ &0< &2`] +THEN DICH_TAC 0; + + + + + + TYPIFY `#3.9 < sqrt (#15.53) /\ sqrt(#15.53) < #3.95` (C +SUBGOAL_THEN ASSUME_TAC); + + GMATCH_SIMP_TAC REAL_LT_RSQRT; + CONJ_TAC; + BY(REAL_ARITH_TAC); + + MATCH_MP_TAC REAL_LT_LSQRT; + + BY(REAL_ARITH_TAC); + + TYPIFY_GOAL_THEN `&0 < &2 + &2 * #1.26 - &2 /\ &0 < &2 + &2 - &2 * + #1.26 /\ &0 < &2 + &2 + &2 * #1.26 /\ &0 < &2 + sqrt #15.53 - &2 /\ +&0 < &2 + &2 - sqrt #15.53 /\ &0 < &2 + &2 + sqrt #15.53 /\ &0 < +sqrt #15.53 /\ &0 < &2 * #1.26` (unlist REWRITE_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); +MP_TAC(REAL_ARITH`#3.9 < sqrt #15.53==> &0 < sqrt #15.53`) +THEN RESA_TAC +THEN MRESAL_TAC SQRT_POW2[`#15.53`][REAL_ARITH`&0<= #15.53`] +THEN REWRITE_TAC[ups_x;REAL_ARITH`&0 < + --(&2 pow 2) * &2 pow 2 - &2 pow 2 * &2 pow 2 - #15.53 * #15.53 + + &2 * &2 pow 2 * #15.53 + + &2 * &2 pow 2 * &2 pow 2 + + &2 * &2 pow 2 * #15.53`] +THEN RESA_TAC +THEN MRESAL_TAC Ocbicby.xrr_bounds_2[`norm u`;`norm w`;`norm (u-w)`][REAL_ARITH`a*a= a pow 2`] +THEN MP_TAC(REAL_ARITH`&0 < xrr (norm u) (norm w) (norm (u-w))/\ +xrr (norm u) (norm w) (norm (u-w)) < &16 +==> abs (&1 - xrr (norm u) (norm w) (norm (u-w:real^3)) / &8) <= &1`) +THEN RESA_TAC +THEN SUBGOAL_THEN`abs (&1 - xrr (&2) (&2) (sqrt #15.53) / &8) <= &1`ASSUME_TAC +; + + + +ASM_REWRITE_TAC[xrr;REAL_ARITH`a*a= a pow 2`] +THEN REAL_ARITH_TAC; + + +MRESAL_TAC ACS_MONO_LT_EQ[`&1 - xrr (norm u) (norm w) (norm (u-w)) / &8`;`&1 - xrr (&2) (&2) (sqrt #15.53) / &8`][REAL_ARITH`&1- a/ &8< &1- b/ &8<=> b(cc<=b)`) +; + + + +ASM_REWRITE_TAC[xrr;REAL_ARITH`a*a= a pow 2`] +THEN REAL_ARITH_TAC; + +]);; + + + + + +let YEBWJNG= prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (!s v p. + is_scs_v39 s /\ scs_basic_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4*h0 < scs_b_v39 s i j) /\ + (!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/ + (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) /\ + ~scs_is_str s v p /\ ~scs_is_str s v (p+1) /\ scs_a_v39 s p (p+1) = &2 + ==> dist(v p,v(p+1)) = &2)`, +[ +REWRITE_TAC[IN;scs_is_str] +THEN REPEAT RESA_TAC +THEN ABBREV_TAC`V= IMAGE (v:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((v:num->real^3) i, v (SUC i))) (:num)` +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC Cuxvzoz.CUXVZOZ +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN EXISTS_TAC`s:scs_v39` +THEN EXISTS_TAC`FF:real^3#real^3->bool` +THEN EXISTS_TAC`4` +THEN ASSUME_TAC(ARITH_RULE`3<4/\ 1<4/\ ~(4=0)`) +THEN ASM_SIMP_TAC[] +THEN MRESAL_TAC GSXRFWM[`s`;`v`][IN] +THEN ASM_REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1;GSYM ADD1] +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`4`;`s`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MP_TAC SCS_DIAG_A_LE_DIST +THEN RESA_TAC +THEN ASM_SIMP_TAC[] +THEN MRESA_TAC WL_IN_V[`p`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`SUC p`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+4-1`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`SUC p+4-1`;`v:num->real^3`] +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v p`;`v`;`p`;`4`] +THEN MRESAL_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v p`][GSYM ADD1] +THEN THAYTHE_TAC 0[`v (p+4-1)`] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN MP_TAC(REAL_ARITH`azim (vec 0) (v p) (v (SUC p)) (v (p + 4 - 1)) <= pi +/\ ~(azim (vec 0) (v p) (v (SUC p)) (v (p + 4 - 1)) = pi) +==> azim (vec 0) (v p) (v (SUC p)) (v (p + 4 - 1)) < pi`) +THEN RESA_TAC +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v (p+1)`;`v`;`p+1`;`4`] +THEN MRESAL_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v (p+1)`][GSYM ADD1] +THEN THAYTHE_TAC 0[`v (SUC p+4-1)`] +THEN DICH_TAC (31-8) +THEN REWRITE_TAC[GSYM ADD1] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim (vec 0) (v (SUC p)) (v (SUC (SUC p))) (v (SUC p + 4 - 1)) <= pi +/\ ~(azim (vec 0) (v (SUC p)) (v (SUC (SUC p))) (v (SUC p + 4 - 1)) = pi) +==> azim (vec 0) (v (SUC p)) (v (SUC (SUC p))) (v (SUC p + 4 - 1)) < pi`) +THEN RESA_TAC +THEN THAYTHES_TAC(32-26)[`1 * 4 + p`;`p`][MOD_MULT_ADD] +THEN MRESAL_TAC Axjrpnc.DIST_EDGE_IN_BB_LE_2[`s`;`v`;`p+3`][ARITH_RULE`SUC(i+3)=1*4+i/\ p+4-1=p+3`;GSYM dist] +THEN SUBGOAL_THEN`!i. scs_b_v39 s i (SUC(i)) <= cstab`ASSUME_TAC; + +GEN_TAC +THEN THAYTHE_TAC (33-6)[`i`] +THEN DICH_TAC 0 +THEN REWRITE_TAC[cstab;h0;ADD1] +THEN REAL_ARITH_TAC; + +MP_TAC Axjrpnc.NORM_V_IN_BB_LE_CSTAB +THEN RESA_TAC +THEN REWRITE_TAC[GSYM dist] +THEN THAYTHES_TAC 0[`p+3`][ARITH_RULE`SUC(i+3)=1*4+i/\ p+4-1=p+3`;GSYM dist] +THEN ONCE_REWRITE_TAC[SET_RULE`A/\B<=> B/\A`] +THEN STRIP_TAC; + +THAYTHE_TAC (35-6)[`p`]; + +DICH_TAC 0 +THEN REWRITE_TAC[ADD1] +THEN REAL_ARITH_TAC; + +DICH_TAC 1 +THEN REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; + +MRESA_TAC Ardbzye.SCS_DIAG_4_ADD2[`p`] +THEN THAYTHE_TAC (36-5)[`p+1`;`p+3`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN DICH_TAC 1 +THEN REWRITE_TAC[ADD1;cstab] +THEN REAL_ARITH_TAC]);; + +(************************************) + + +let NOT_MOD_4_CASES=prove(`~(i MOD 4 = (p + 2) MOD 4)<=> i MOD 4 = p MOD 4\/ i MOD 4 = (p + 1) MOD 4 +\/ i MOD 4 = (p + 3) MOD 4`, +MRESAL_TAC MOD_ADD_MOD[`p`;`1`;`4`][ARITH_RULE`~(4=0)`] +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC MOD_ADD_MOD[`p`;`2`;`4`][ARITH_RULE`~(4=0)`] +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC MOD_ADD_MOD[`p`;`3`;`4`][ARITH_RULE`~(4=0)`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`p MOD 4<4==> p MOD 4=0\/ p MOD 4=1\/ p MOD 4=2\/ p MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN ARITH_TAC);; + + + + +let NOT_MOD_4_CASES_3=prove(`~(i MOD 4 = (p + 3) MOD 4)<=> i MOD 4 = p MOD 4\/ i MOD 4 = (p + 1) MOD 4 +\/ i MOD 4 = (p + 2) MOD 4`, +MRESAL_TAC MOD_ADD_MOD[`p`;`1`;`4`][ARITH_RULE`~(4=0)`] +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC MOD_ADD_MOD[`p`;`2`;`4`][ARITH_RULE`~(4=0)`] +THEN SYM_ASSUM_TAC +THEN MRESAL_TAC MOD_ADD_MOD[`p`;`3`;`4`][ARITH_RULE`~(4=0)`] +THEN SYM_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i MOD 4<4==> i MOD 4=0\/ i MOD 4=1\/ i MOD 4=2\/ i MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`p MOD 4<4==> p MOD 4=0\/ p MOD 4=1\/ p MOD 4=2\/ p MOD 4=3`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(4=0)`] +THEN RESA_TAC +THEN ARITH_TAC);; + + + + +let SCS_STR_CASES_4= prove_by_refinement(`!s v. + is_scs_v39 s /\ scs_k_v39 s = 4 /\ MMs_v39 s v /\ + ~scs_is_str s v p /\ ~scs_is_str s v (p+1) +==> ~scs_is_str s v (p+3)\/ ~scs_is_str s v (p+2)`, +[ +REPEAT RESA_TAC +THEN REWRITE_TAC[GSYM DE_MORGAN_THM] +THEN STRIP_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ (4-1) MOD 4= 4-1/\ 1<4`) +THEN MRESAL_TAC MMS_IMP_BBS[`s`;`v`][IN] +THEN SUBGOAL_THEN`(p +3) MOD 4 IN { i | i < scs_k_v39 s /\ scs_is_str s (v:num->real^3) i}` +ASSUME_TAC; + +ASM_REWRITE_TAC[IN_ELIM_THM] +THEN ASM_TAC +THEN SIMP_TAC[scs_is_str;DIVISION;] +THEN REPEAT RESA_TAC +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`(p+3) MOD 4`;`p+3:num`][MOD_REFL] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`SUC((p+3) MOD 4)`;`SUC((p+3) MOD 4)MOD 4`][MOD_REFL;Hypermap.lemma_suc_mod] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`SUC(p+3) MOD 4`;`SUC(p+3) `][MOD_REFL;Hypermap.lemma_suc_mod] +THEN MRESA_TAC MOD_ADD_MOD[`p+3`;`4-1`;`4`] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`(p + 3) MOD 4 + 4 - 1`;`((p + 3) MOD 4 + 4 - 1)MOD 4`][MOD_REFL;Hypermap.lemma_suc_mod] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`((p + 3) + 4 - 1) MOD 4`;`(p + 3) + 4 - 1`][MOD_REFL;Hypermap.lemma_suc_mod]; + + +SUBGOAL_THEN`(p +2) MOD 4 IN { i | i < scs_k_v39 s /\ scs_is_str s (v:num->real^3) i}` +ASSUME_TAC; + +ASM_REWRITE_TAC[IN_ELIM_THM] +THEN ASM_TAC +THEN SIMP_TAC[scs_is_str;DIVISION;] +THEN REPEAT RESA_TAC +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`(p+2) MOD 4`;`p+2:num`][MOD_REFL] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`SUC((p+2) MOD 4)`;`SUC((p+2) MOD 4)MOD 4`][MOD_REFL;Hypermap.lemma_suc_mod] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`SUC(p+2) MOD 4`;`SUC(p+2) `][MOD_REFL;Hypermap.lemma_suc_mod] +THEN MRESA_TAC MOD_ADD_MOD[`p+2`;`4-1`;`4`] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`(p + 2) MOD 4 + 4 - 1`;`((p + 2) MOD 4 + 4 - 1)MOD 4`][MOD_REFL;Hypermap.lemma_suc_mod] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`((p + 2) + 4 - 1) MOD 4`;`(p + 2) + 4 - 1`][MOD_REFL;Hypermap.lemma_suc_mod]; + +MP_TAC(SET_RULE`(p + 3) MOD 4 IN {i | i < scs_k_v39 s /\ scs_is_str s v i}/\ +(p + 2) MOD 4 IN {i | i < scs_k_v39 s /\ scs_is_str s v i} +==> {(p + 3) MOD 4 ,(p + 2) MOD 4 } SUBSET {i | i < scs_k_v39 s /\ scs_is_str s v i}`) +THEN RESA_TAC +THEN MRESA_TAC Qknvmlb.SUC_MOD_NOT_EQ[`4`] +THEN DICH_TAC 1 +THEN THAYTHEL_TAC 0[`p+2`][ARITH_RULE`SUC(p+2)=p+3`] +THEN MRESA_TAC Planarity.CARD_2_FAN[`(p + 3) MOD 4`;`(p + 2) MOD 4`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`FINITE {i | i < 4 /\ scs_is_str s v i}` ASSUME_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..4` +THEN ASM_REWRITE_TAC[SUBSET;IN_ELIM_THM;IN_NUMSEG;FINITE_NUMSEG] +THEN ARITH_TAC; + +MRESA_TAC CARD_SUBSET[`{(p + 3) MOD 4, (p + 2) MOD 4}`;`{i | i < 4 /\ scs_is_str s v i}`] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC WGDHPPI[`s`;`v`][IN] +THEN DICH_TAC 0 +THEN ARITH_TAC]);; + + + + +let NEHXMWH_concl=`main_nonlinear_terminal_v11 ==> + (!s FF v p. + IMAGE (\i. (v i,v (SUC i))) (:num) = FF /\ + is_scs_v39 s /\ + scs_k_v39 s = 4 /\ + MMs_v39 s v /\ + scs_basic_v39 s /\ + scs_generic v /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4 * h0 < scs_b_v39 s i j) /\ + (!i. ~(i MOD 4 = (p+2) MOD 4) ==> interior_angle1 (vec 0) FF (v i) < pi) + ==> (dist(v p,v(p+1)) = scs_a_v39 s p (p+1) \/ dist(v p,v(p+1)) = scs_b_v39 s p (p+1)))`;; + +let NEHXMWH1_concl=`main_nonlinear_terminal_v11 ==> + (!s FF v p. + IMAGE (\i. (v i,v (SUC i))) (:num) = FF /\ + is_scs_v39 s /\ + scs_k_v39 s = 4 /\ + MMs_v39 s v /\ + scs_basic_v39 s /\ + scs_generic v /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4 * h0 < scs_b_v39 s i j) /\ + (!i. ~(i MOD 4 = (p+3) MOD 4) ==> interior_angle1 (vec 0) FF (v i) < pi) + ==> (dist(v p,v(p+1)) = scs_a_v39 s p (p+1) \/ dist(v p,v(p+1)) = scs_b_v39 s p (p+1)))`;; + + + + let TUAPYYU_concl = ` +main_nonlinear_terminal_v11 ==> +(!s v p. + is_scs_v39 s /\ scs_basic_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4*h0 < scs_b_v39 s i j) /\ + (!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/ + (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) /\ + ~scs_is_str s v p /\ ~scs_is_str s v (p+1) + ==> dist(v p,v(p+1)) = scs_a_v39 s p (p+1) \/ dist(v p,v(p+1)) = scs_b_v39 s p (p+1))`;; + + + +let TUAPYYU1= prove_by_refinement((mk_imp(NEHXMWH1_concl,mk_imp(NEHXMWH_concl, TUAPYYU_concl))), +[ +REWRITE_TAC[IN;scs_is_str] +THEN REPEAT RESA_TAC +THEN ABBREV_TAC`V= IMAGE (v:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((v:num->real^3) i, v (SUC i))) (:num)` +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`3<4/\ 1<4/\ ~(4=0)`) +THEN ASM_SIMP_TAC[] +THEN MRESAL_TAC GSXRFWM[`s`;`v`][IN] +THEN MRESAL_TAC SCS_STR_CASES_4[`p`;`s`;`v`][scs_is_str] +THEN ASM_REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1;GSYM ADD1] +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`4`;`s`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MP_TAC SCS_DIAG_A_LE_DIST +THEN RESA_TAC +THEN ASM_SIMP_TAC[] +THEN MRESA_TAC WL_IN_V[`p`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`SUC p`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+4-1`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`SUC p+4-1`;`v:num->real^3`] +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v p`;`v`;`p`;`4`] +THEN MRESAL_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v p`][GSYM ADD1] +THEN THAYTHE_TAC 0[`v (p+4-1)`] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN MP_TAC(REAL_ARITH`azim (vec 0) (v p) (v (SUC p)) (v (p + 4 - 1)) <= pi +/\ ~(azim (vec 0) (v p) (v (SUC p)) (v (p + 4 - 1)) = pi) +==> azim (vec 0) (v p) (v (SUC p)) (v (p + 4 - 1)) < pi`) +THEN RESA_TAC +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v (p+1)`;`v`;`p+1`;`4`] +THEN MRESAL_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v (p+1)`][GSYM ADD1] +THEN THAYTHE_TAC 0[`v (SUC p+4-1)`] +THEN DICH_TAC (32-9) +THEN REWRITE_TAC[GSYM ADD1] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`azim (vec 0) (v (SUC p)) (v (SUC (SUC p))) (v (SUC p + 4 - 1)) <= pi +/\ ~(azim (vec 0) (v (SUC p)) (v (SUC (SUC p))) (v (SUC p + 4 - 1)) = pi) +==> azim (vec 0) (v (SUC p)) (v (SUC (SUC p))) (v (SUC p + 4 - 1)) < pi`) +THEN RESA_TAC; + +DICH_TAC (33) +THEN RESA_TAC +THEN REWRITE_TAC[ADD1] +THEN MATCH_DICH_TAC 0 +THEN EXISTS_TAC`FF:real^3#real^3->bool` +THEN ASM_SIMP_TAC[] +THEN ASM_REWRITE_TAC[NOT_MOD_4_CASES] +THEN ASM_REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1;GSYM ADD1] +THEN REPEAT RESA_TAC; + +THAYTHEL_TAC(32-25)[`i`;`p`][GSYM ADD1]; + + +THAYTHEL_TAC(32-25)[`i`;`p+1`][ADD1] +THEN ASM_REWRITE_TAC[GSYM ADD1]; + + +MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v (p+3)`;`v`;`p+3`;`4`] +THEN MRESA_TAC WL_IN_V[`p+3`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`(p+3)+4-1`;`v:num->real^3`] +THEN MRESAL_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v (p+3)`][GSYM ADD1] +THEN THAYTHE_TAC 0[`v ((p+3)+4-1)`] +THEN MP_TAC(REAL_ARITH`azim (vec 0) (v (p+3)) (v (SUC (p+3))) (v ((p+3) + 4 - 1)) <= pi +/\ ~(azim (vec 0) (v (p+3)) (v (SUC (p+3))) (v ((p+3) + 4 - 1)) = pi) +==> azim (vec 0) (v (p+3)) (v (SUC ((p+3)))) (v ((p+3) + 4 - 1)) < pi`) +THEN RESA_TAC; + +THAYTHEL_TAC(38-25)[`i`;`p+3`][GSYM ADD1]; + +DICH_TAC (34) +THEN RESA_TAC +THEN REWRITE_TAC[ADD1] +THEN MATCH_DICH_TAC 0 +THEN EXISTS_TAC`FF:real^3#real^3->bool` +THEN ASM_SIMP_TAC[] +THEN ASM_REWRITE_TAC[NOT_MOD_4_CASES_3] +THEN ASM_REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1;GSYM ADD1] +THEN REPEAT RESA_TAC; + +THAYTHEL_TAC(32-25)[`i`;`p`][GSYM ADD1]; + + +THAYTHEL_TAC(32-25)[`i`;`p+1`][ADD1] +THEN ASM_REWRITE_TAC[GSYM ADD1]; + + +MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v (p+2)`;`v`;`p+2`;`4`] +THEN MRESA_TAC WL_IN_V[`p+2`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`(p+2)+4-1`;`v:num->real^3`] +THEN MRESAL_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v (p+2)`][GSYM ADD1] +THEN THAYTHE_TAC 0[`v ((p+2)+4-1)`] +THEN MP_TAC(REAL_ARITH`azim (vec 0) (v (p+2)) (v (SUC (p+2))) (v ((p+2) + 4 - 1)) <= pi +/\ ~(azim (vec 0) (v (p+2)) (v (SUC (p+2))) (v ((p+2) + 4 - 1)) = pi) +==> azim (vec 0) (v (p+2)) (v (SUC ((p+2)))) (v ((p+2) + 4 - 1)) < pi`) +THEN RESA_TAC; + +THAYTHEL_TAC(38-25)[`i`;`p+2`][GSYM ADD1]]);; + + +let TUAPYYU=prove( TUAPYYU_concl, +STRIP_TAC +THEN MP_TAC TUAPYYU1 +THEN RESA_TAC +THEN MP_TAC Jotswix.NEHXMWH +THEN MP_TAC Jotswix.BZQNDMN +THEN ASM_REWRITE_TAC[]);; + + +(**************************) + + +let SCS_M_CASES_4_LE_2=prove(`scs_k_v39 s = 4/\ is_scs_v39 s +==> CARD (scs_M s)<=2`, +REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF;scs_M] +THEN RESA_TAC +THEN DICH_TAC 0 +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC);; + + + +let SCS_M_CASES_4_EQ=prove(`scs_k_v39 s = 4/\ is_scs_v39 s /\ {p MOD 4,(p+3)MOD 4} SUBSET scs_M s +==> scs_M s={p MOD 4,(p+3)MOD 4}`, +REPEAT STRIP_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ ~(0 MOD 4 = 3 MOD 4)`) +THEN MRESAS_TAC Planarity.CARD_2_FAN[`(p+0) MOD 4`;`(p+3) MOD 4`][Ocbicby.MOD_EQ_MOD_SHIFT] +THEN DICH_TAC 0 +THEN REWRITE_TAC[ARITH_RULE`p+0=p`] +THEN STRIP_TAC +THEN MP_TAC SCS_M_CASES_4_LE_2 +THEN RESA_TAC +THEN MP_TAC Jlxfdmj.FINITE_SCS_M +THEN RESA_TAC +THEN MRESA_TAC CARD_SUBSET_LE[`{p MOD 4, (p + 3) MOD 4}`;`scs_M s`]);; + +let B_LE_2h0_SCS_M_4=prove(`scs_k_v39 s = 4/\ is_scs_v39 s /\ {p MOD 4,(p+3)MOD 4} SUBSET scs_M s +==> scs_b_v39 s (p+1) (p+2)<= &2*h0`, +REPEAT STRIP_TAC +THEN MP_TAC SCS_M_CASES_4_EQ +THEN RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ ~(1 MOD 4 = 3 MOD 4)/\ 1<4`) +THEN SUBGOAL_THEN`~((p+1) MOD 4 IN scs_M s)`ASSUME_TAC +THENL[ +ASM_SIMP_TAC[SET_RULE`a IN {b,c}<=> a=b\/ a=c`;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN MRESAL_TAC Qknvmlb.SUC_MOD_NOT_EQ[`4`][ADD1]; + +DICH_TAC 0 +THEN REWRITE_TAC[scs_M;IN_ELIM_THM] +THEN ASM_SIMP_TAC[DIVISION] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+1) MOD 4`;`SUC ((p + 1) MOD 4)`;`s`;`p+1`;`SUC ((p + 1) MOD 4) MOD 4`][MOD_REFL;Yxionxl2.MOD_SUC_MOD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+1)`;`SUC (p + 1) MOD 4`;`s`;`p+1`;`SUC (p + 1)`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`SUC(p+1)=p+2`] +THEN REAL_ARITH_TAC]);; + + +let B_LE_2h0_2_SCS_M_4=prove(`scs_k_v39 s = 4/\ is_scs_v39 s /\ {p MOD 4,(p+3)MOD 4} SUBSET scs_M s +==> scs_b_v39 s (p+2) (p+3)<= &2*h0`, +REPEAT STRIP_TAC +THEN MP_TAC SCS_M_CASES_4_EQ +THEN RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ ~(2 MOD 4 = 3 MOD 4)/\ ~(2 MOD 4 = 0 MOD 4)/\ 1<4`) +THEN SUBGOAL_THEN`~((p+2) MOD 4 IN scs_M s)`ASSUME_TAC +THENL[ +ASM_SIMP_TAC[SET_RULE`a IN {b,c}<=> a=b\/ a=c`;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`2`;`0`;`p`][ARITH_RULE`p+0=p`]; +DICH_TAC 0 +THEN REWRITE_TAC[scs_M;IN_ELIM_THM] +THEN ASM_SIMP_TAC[DIVISION] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+2) MOD 4`;`SUC ((p + 2) MOD 4)`;`s`;`p+2`;`SUC ((p + 2) MOD 4) MOD 4`][MOD_REFL;Yxionxl2.MOD_SUC_MOD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+2)`;`SUC (p + 2) MOD 4`;`s`;`p+2`;`SUC (p + 2)`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`SUC(p+2)=p+3`] +THEN REAL_ARITH_TAC]);; + + + +let B_LE_2h0_2_SCS_M_4=prove(`scs_k_v39 s = 4/\ is_scs_v39 s /\ {p MOD 4,(p+3)MOD 4} SUBSET scs_M s +==> scs_b_v39 s (p+1) (p+2)<= &2*h0 /\ scs_b_v39 s (p+2) (p+3)<= &2*h0`, +SIMP_TAC[B_LE_2h0_2_SCS_M_4;B_LE_2h0_SCS_M_4]);; + + + +let WKZZEEH = prove_by_refinement(`main_nonlinear_terminal_v11 ==> + (!s v p. + is_scs_v39 s /\ scs_basic_v39 s /\ scs_k_v39 s = 4 /\ MMs_v39 s v/\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4*h0 < scs_b_v39 s i j) /\ + (!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/ + (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) /\ + ~scs_is_str s v p /\ ~scs_is_str s v (p+1) /\ ~scs_is_str s v (p+3) + ==> (~(dist(v p,v(p+3)) = cstab /\ dist(v(p),v(p+1)) = cstab)))`, +[STRIP_TAC +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN REWRITE_TAC[DE_MORGAN_THM] +THEN ABBREV_TAC`V= IMAGE (v:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((v:num->real^3) i, v (SUC i))) (:num)` +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`3<4/\ 1<4/\ ~(4=0)`) +THEN ASM_SIMP_TAC[] +THEN MRESAL_TAC GSXRFWM[`s`;`v`][IN] +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`4`;`s`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN SUBGOAL_THEN`!i. dist((v:num->real^3) i, v(SUC i))<= cstab`ASSUME_TAC +; + + +REWRITE_TAC[dist] +THEN MATCH_MP_TAC (GEN_ALL Axjrpnc.NORM_V_IN_BB_LE_CSTAB) +THEN EXISTS_TAC`s:scs_v39` +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN REWRITE_TAC[ADD1] +THEN THAYTHE_TAC (18-6)[`i`] +THEN REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC; + +THAYTHEL_ASM_TAC 0[`p`][ADD1] +THEN THAYTHEL_TAC 0[`p+3`][ARITH_RULE`SUC(p+3)=1*4+p`] +THEN DICH_TAC 0 +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`1*4+p`;`p`][MOD_MULT_ADD] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[DIST_SYM] +THEN REMOVE_ASSUM_TAC +THEN DICH_TAC 0 +THEN MP_TAC Jotswix.JOTSWIX +THEN RESA_TAC +THEN THAYTHE_TAC 0[`s`;`FF`;`v`;`p`] +THEN DICH_TAC 0 +THEN SUBGOAL_THEN`scs_a_v39 s p (p + 1) < cstab`ASSUME_TAC; + + +THAYTHE_TAC (18-6)[`p`] +THEN REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC; + + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`(!i. ~(i MOD 4 = (p + 2) MOD 4) ==> interior_angle1 (vec 0) FF ((v:num->real^3)i) < pi)`ASSUME_TAC; + +REMOVE_ASSUM_TAC +THEN ASM_REWRITE_TAC[NOT_MOD_4_CASES] +THEN REPEAT STRIP_TAC; + + +MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`i`;`p`][MOD_MULT_ADD] +THEN DICH_TAC(20-7) +THEN ASM_REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1;GSYM ADD1;scs_is_str] +THEN MRESA_TAC WL_IN_V[`p`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`SUC p`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+4-1`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`SUC p+4-1`;`v:num->real^3`] +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v p`;`v`;`p`;`4`] +THEN MRESAL_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v p`][GSYM ADD1] +THEN THAYTHE_TAC 0[`v (p+4-1)`] +THEN DICH_TAC 0 +THEN REAL_ARITH_TAC; + + + + +MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`i`;`p+1`][MOD_MULT_ADD] +THEN DICH_TAC(20-8) +THEN ASM_REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1;GSYM ADD1;scs_is_str] +THEN MRESA_TAC WL_IN_V[`p`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`SUC p`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+4-1`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`SUC p+4-1`;`v:num->real^3`] +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v (SUC p)`;`v`;`(SUC p)`;`4`] +THEN MRESAL_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v (p+1)`][GSYM ADD1] +THEN THAYTHE_TAC 0[`v ((SUC p)+4-1)`] +THEN DICH_TAC 0 +THEN REAL_ARITH_TAC; + + + + +MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`i`;`p+3`][MOD_MULT_ADD] +THEN DICH_TAC(20-9) +THEN ASM_REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1;GSYM ADD1;scs_is_str] +THEN MRESA_TAC WL_IN_V[`p`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`(p+3)`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+4-1`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`(p+3)+4-1`;`v:num->real^3`] +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v ((p+3))`;`v`;`((p+3))`;`4`] +THEN MRESAL_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v ((p+3))`][GSYM ADD1] +THEN THAYTHE_TAC 0[`v (((p+3))+4-1)`] +THEN DICH_TAC 0 +THEN REAL_ARITH_TAC; + + +REPEAT RESA_TAC +THEN MP_TAC(REAL_ARITH`dist (v p,v (p + 1)) <= cstab/\ +dist (v p,v (p + 3)) <= cstab +==> (dist (v p,v (p + 1)) = cstab/\dist (v p,v (p + 3)) = cstab) +\/ dist ((v:num->real^3) p,v (p + 1)) < cstab \/ dist (v p,v (p + 3)) < cstab`) +THEN RESA_TAC; + + +SUBGOAL_THEN`p MOD 4 IN scs_M s`ASSUME_TAC; + + +ASM_SIMP_TAC[scs_M;IN_ELIM_THM;DIVISION] +THEN MATCH_MP_TAC(SET_RULE`A==> A\/B`) +THEN DICH_TAC(25-15) +THEN ASM_REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;] +THEN STRIP_TAC +THEN THAYTHE_TAC 0[`p MOD 4`;`SUC(p MOD 4)`] +THEN DICH_TAC 0 +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`p MOD 4`;`p`][MOD_REFL] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`SUC(p MOD 4)`;`SUC(p MOD 4) MOD 4`][MOD_REFL;Yxionxl2.MOD_SUC_MOD] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`SUC p MOD 4`;`SUC p`][MOD_REFL;ADD1;cstab;h0] +THEN REAL_ARITH_TAC +; + + + +SUBGOAL_THEN`(p+3) MOD 4 IN scs_M s`ASSUME_TAC; + +REMOVE_ASSUM_TAC +THEN ASM_SIMP_TAC[scs_M;IN_ELIM_THM;DIVISION] +THEN MATCH_MP_TAC(SET_RULE`A==> A\/B`) +THEN DICH_TAC(25-15) +THEN ASM_REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;] +THEN STRIP_TAC +THEN THAYTHE_TAC 0[`(p+3) MOD 4`;`SUC((p+3) MOD 4)`] +THEN DICH_TAC 0 +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`(p+3) MOD 4`;`(p+3)`][MOD_REFL] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`SUC((p+3) MOD 4)`;`SUC((p+3) MOD 4) MOD 4`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`SUC(p+3)=(1*4+p)`;MOD_MULT_ADD] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`p MOD 4`;`p`][MOD_REFL;ADD1;cstab;h0] +THEN REAL_ARITH_TAC +; + + +MP_TAC(SET_RULE`p MOD 4 IN scs_M s/\ +(p + 3) MOD 4 IN scs_M s==>{p MOD 4,(p+3)MOD 4} SUBSET scs_M s`) +THEN RESA_TAC +THEN MP_TAC B_LE_2h0_2_SCS_M_4 +THEN RESA_TAC +THEN MRESAL_TAC ASSWPOW[`s`;`v`;`p+1`][IN;ARITH_RULE`(a+1)+1=a+2/\ (a+1)+2=a+3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ONCE_REWRITE_TAC[Ocbicby.xrr_sym] +THEN STRIP_TAC +THEN DICH_TAC(31-21) +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; + + + +DICH_TAC 0 +THEN REAL_ARITH_TAC +; + +DICH_TAC 0 +THEN REAL_ARITH_TAC +; +]);; + + +(***************************) +let BASIC_IMP_NOT_J=prove(`scs_basic_v39 s==> (!p i. ~scs_J_v39 s p i)`, +REWRITE_TAC[scs_basic] +THEN SET_TAC[]);; + +let CONDTION_A_LT_B=prove(`(!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/ + (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) +==> (!i. scs_a_v39 s i (i+1)< scs_b_v39 s i (i+1))`, +REWRITE_TAC[h0;cstab] +THEN REPEAT STRIP_TAC +THEN THAYTHE_TAC 0[`i`] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + +let A_EQ2_IMP_B=prove(`(!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/ + (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) +/\ scs_a_v39 s p (p+1) = &2 +==> scs_b_v39 s p (p+1)= &2 * h0`, +REPEAT STRIP_TAC +THEN THAYTHE_TAC 1[`p`] +THEN DICH_TAC 1 +THEN ASM_REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC);; + +let A_EQ2h0_IMP_B=prove(`(!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/ + (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) +/\ scs_a_v39 s p (p+1) = &2 * h0 +==> scs_b_v39 s p (p+1)= cstab`, +REPEAT STRIP_TAC +THEN THAYTHE_TAC 1[`p`] +THEN DICH_TAC 1 +THEN ASM_REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC);; + + +let A_NOT_EQ2_IMP_B=prove(`(!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/ + (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) +/\ ~(scs_a_v39 s p (p+1) = &2 ) +==> scs_a_v39 s p (p+1) = &2* h0 /\ scs_b_v39 s p (p+1)= cstab`, +REPEAT STRIP_TAC +THEN THAYTHE_TAC 1[`p`]);; + + + +let B_LE_2h0_IMP_B=prove(`(!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/ + (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) +/\ scs_b_v39 s p (p+1) <= &2 *h0 +==> scs_a_v39 s p (p+1) = &2 /\ scs_b_v39 s p (p+1)= &2*h0`, +REPEAT STRIP_TAC +THEN DICH_TAC 0 +THEN THAYTHE_TAC 0[`p`] +THEN ASM_REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC);; + + +let STR_MOD_EQ=prove(`is_scs_v39 s /\ scs_k_v39 s = k /\ v IN MMs_v39 s +==> +(scs_is_str s v (p MOD k)<=> scs_is_str s v p)`, +REWRITE_TAC[IN;scs_is_str] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MP_TAC Yrtafyh.PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`1 k-1 +p MOD 4 IN {i | i < 4 /\ scs_is_str s v i}`, +REWRITE_TAC[IN] +THEN REPEAT STRIP_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\1<4/\ 3<4`) +THEN ASM_SIMP_TAC[IN_ELIM_THM;DIVISION] +THEN DICH_TAC 1 +THEN MRESAL_TAC STR_MOD_EQ[`4`;`s`;`v`;`p`][IN]);; + + +let FINITE_SET_STR=prove(`FINITE {i | i < k /\ scs_is_str s v i}`, +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN ASM_REWRITE_TAC[FINITE_NUMSEG;IN_ELIM_THM;IN_NUMSEG;SUBSET] +THEN ARITH_TAC);; + +let NOT_STR_IN_CASES_4=prove(`!s v. + is_scs_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s /\ scs_is_str s v p==> + ~scs_is_str s v (p+1)/\ ~scs_is_str s v (p+2)/\ ~scs_is_str s v (p+3)`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)`) +THEN MRESA_TAC WGDHPPI[`s`;`v`] +THEN MP_TAC IN_SCS_STR_CASES_4 +THEN RESA_TAC +THEN MRESA_TAC FINITE_SET_STR[`4`;`s`;`v`] +THEN MRESAS_TAC CARD_SUBSET_LE[`{p MOD 4}`;`{i | i < 4 /\ scs_is_str s v i}`][Geomdetail.CARD_SING;SET_RULE`a IN A==> {a} SUBSET A`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`2`;`0`;`p`][ARITH_RULE`p+0=p/\ ~(2 MOD 4= 0 MOD 4)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`1`;`0`;`p`][ARITH_RULE`p+0=p/\ ~(1 MOD 4= 0 MOD 4)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`3`;`0`;`p`][ARITH_RULE`p+0=p/\ ~(3 MOD 4= 0 MOD 4)`] +THEN MP_TAC(SET_RULE`{p MOD 4} = {i | i < 4 /\ scs_is_str s v i}/\ +~((p + 2) MOD 4 = p MOD 4)/\ +~((p + 1) MOD 4 = p MOD 4)/\ +~((p + 3) MOD 4 = p MOD 4) +==> ~((p + 1) MOD 4 IN {i | i < 4 /\ scs_is_str s v i})/\ + ~((p + 2) MOD 4 IN {i | i < 4 /\ scs_is_str s v i})/\ +~((p + 3) MOD 4 IN {i | i < 4 /\ scs_is_str s v i})`) +THEN RESA_TAC +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN ASM_SIMP_TAC[IN_ELIM_THM; DIVISION;STR_MOD_EQ]);; + + +let NOT_STR_IN_CASES_4_1=prove(`!s v. + is_scs_v39 s /\ + scs_k_v39 s = 4 /\ + v IN MMs_v39 s /\ + scs_is_str s v (p+1) + ==> ~scs_is_str s v (p ) /\ + ~scs_is_str s v (p + 2) /\ + ~scs_is_str s v (p + 3)`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MRESAL_TAC NOT_STR_IN_CASES_4[`p+1`;`s`;`v`][ARITH_RULE`(p+1)+1=p+2/\ (p+1)+2=p+3/\ (p+1)+3=1*4+p`] +THEN MRESAS_TAC STR_MOD_EQ[`4`;`s`;`v`;`1*4+p`][MOD_MULT_ADD] +THEN MRESAS_TAC STR_MOD_EQ[`4`;`s`;`v`;`p`][MOD_MULT_ADD]);; + + +let PRO_ADD_NOT_IN_SCS_M=prove(`is_scs_v39 s/\ scs_a_v39 s i (i+1) = &2 * h0/\ scs_k_v39 s=k +==> i MOD k IN scs_M s`, +REWRITE_TAC[IN_ELIM_THM;scs_M] +THEN RESA_TAC +THEN MP_TAC Yrtafyh.PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`i MOD k`;`SUC(i MOD k)`;`s`;`i`;`SUC(i MOD k) MOD k`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD;DIVISION] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`i`;`SUC i MOD k`;`s`;`i`;`SUC i`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN ASM_REWRITE_TAC[ADD1;h0] +THEN REAL_ARITH_TAC);; + +let TUAPYYU_IMP_CASES=prove(` +main_nonlinear_terminal_v11 ==> +(!s v p. + is_scs_v39 s /\ scs_basic_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4*h0 < scs_b_v39 s i j) /\ + (!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/ + (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) /\ + ~scs_is_str s v p /\ ~scs_is_str s v (p+1) + ==> dist(v p,v(p+1)) = &2\/ dist(v p,v(p+1)) = &2 * h0 \/ dist(v p,v(p+1)) = cstab)`, +REPEAT STRIP_TAC +THEN MP_TAC TUAPYYU +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p`][] +THEN THAYTHE_TAC 3[`p`]);; + +let SCS_M_CASES_4_EQ1=prove(`scs_k_v39 s = 4/\ is_scs_v39 s /\ {(p+1) MOD 4,(p+3)MOD 4} SUBSET scs_M s +==> scs_M s={(p+1) MOD 4,(p+3)MOD 4}`, +REPEAT STRIP_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ ~(1 MOD 4 = 3 MOD 4)`) +THEN MRESAS_TAC Planarity.CARD_2_FAN[`(p+1) MOD 4`;`(p+3) MOD 4`][Ocbicby.MOD_EQ_MOD_SHIFT] +THEN DICH_TAC 0 +THEN REWRITE_TAC[ARITH_RULE`p+1=p+1`] +THEN STRIP_TAC +THEN MP_TAC SCS_M_CASES_4_LE_2 +THEN RESA_TAC +THEN MP_TAC Jlxfdmj.FINITE_SCS_M +THEN RESA_TAC +THEN MRESA_TAC CARD_SUBSET_LE[`{(p+1) MOD 4, (p + 3) MOD 4}`;`scs_M s`]);; + + + + +let B_LE_2h0_2_SCS_M_4_1=prove( +`scs_k_v39 s = 4/\ is_scs_v39 s /\ {(p+1) MOD 4,(p+3)MOD 4} SUBSET scs_M s +==> scs_b_v39 s (p+2) (p+3)<= &2*h0`, +REPEAT STRIP_TAC +THEN MP_TAC SCS_M_CASES_4_EQ1 +THEN RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`~(4=0)/\ ~(2 MOD 4 = 3 MOD 4)/\ ~(2 MOD 4 = 1 MOD 4)/\ 1<4`) +THEN SUBGOAL_THEN`~((p+2) MOD 4 IN scs_M s)`ASSUME_TAC +THENL[ + +ASM_SIMP_TAC[SET_RULE`a IN {b,c}<=> a=b\/ a=c`;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`2`;`1`;`p`][ARITH_RULE`p+0=p`]; + +DICH_TAC 0 +THEN REWRITE_TAC[scs_M;IN_ELIM_THM] +THEN ASM_SIMP_TAC[DIVISION] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+2) MOD 4`;`SUC ((p + 2) MOD 4)`;`s`;`p+2`;`SUC ((p + 2) MOD 4) MOD 4`][MOD_REFL;Yxionxl2.MOD_SUC_MOD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+2)`;`SUC (p + 2) MOD 4`;`s`;`p+2`;`SUC (p + 2)`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`SUC(p+2)=p+3`] +THEN REAL_ARITH_TAC]);; + + +let SCS_A_SYM=prove(`is_scs_v39 s +==> scs_a_v39 s i j= scs_a_v39 s j i`, +REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF;dist] +THEN RESA_TAC);; + +let SCS_B_SYM=prove(`is_scs_v39 s +==> scs_b_v39 s i j= scs_b_v39 s j i`, +REWRITE_TAC[is_scs_v39;LET_DEF;LET_END_DEF;dist] +THEN RESA_TAC);; + + + + +(***************************) + +let PWEIWBZ= prove_by_refinement(` +main_nonlinear_terminal_v11 ==> +(!s v p. + is_scs_v39 s /\ scs_basic_v39 s /\ scs_k_v39 s = 4 /\ MMs_v39 s v/\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4*h0 < scs_b_v39 s i j) /\ + (!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/ + (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) /\ + scs_a_v39 s p (p+1) = &2 + ==> dist(v p,v(p+1)) = &2)`, +[REPEAT RESA_TAC +THEN ABBREV_TAC`V= IMAGE (v:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((v:num->real^3) i, v (SUC i))) (:num)` +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN ASSUME_TAC(ARITH_RULE`3<4/\ 1<4/\ ~(4=0)/\ 4-1=3/\ SUC (p + 3)= 1*4+p/\ SUC p= p+1`) +THEN ASM_SIMP_TAC[] +THEN MRESAL_TAC GSXRFWM[`s`;`v`][IN;scs_generic] +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`4`;`s`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MP_TAC Tfitskc.SCS_DIAG_A_LE_DIST +THEN RESA_TAC +THEN MP_TAC(SET_RULE`(~scs_is_str s v p /\ ~scs_is_str s v (p+1))\/ scs_is_str s v p \/ scs_is_str s v (p+1)`) +THEN RESA_TAC; + + +MP_TAC YEBWJNG +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN EXISTS_TAC`s:scs_v39` +THEN ASM_REWRITE_TAC[IN]; + + +MRESAL_TAC NOT_STR_IN_CASES_4[`p`;`s`;`v`][IN] +THEN DICH_TAC 3 +THEN ASM_REWRITE_TAC[scs_is_str;] +THEN STRIP_TAC +THEN DICH_TAC(21-13) +THEN ASM_REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;] +THEN STRIP_TAC +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN THAYTHE_TAC 1[`p+3`;`p`] +; + + +MRESAL_TAC MMS_IMP_BBPRIME[`s`;`v`][LET_DEF;LET_END_DEF;BBprime_v39] +THEN MRESAL_TAC JKQEWGV2[`s`;`v`][LET_DEF;LET_END_DEF;scs_generic] +THEN MP_TAC Wrgcvdr_cizmrrh.CIZMRRH +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_EXISTS_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN`(!V' E' v1. V' = V /\ E' = E ==> ~lunar (v1,(v:num->real^3) (p)) V' E')` ASSUME_TAC; + + + +REPEAT RESA_TAC +; + + + +MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`(p+3)+1`;`p`][ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN DICH_TAC 0 +THEN REWRITE_TAC[ARITH_RULE`1 * 4 + p=(p+3)+1`] +THEN STRIP_TAC +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`(p+3)+2`;`p+1`][ARITH_RULE`(p+3)+2=1*4+p+1`;MOD_MULT_ADD] +THEN DICH_TAC 0 +THEN REWRITE_TAC[ARITH_RULE`1 * 4 + p+1=(p+3)+2`] +THEN STRIP_TAC +THEN MRESA_TAC Local_lemmas1.AZIM_COND_FOR_COPLANAR[`vec 0:real^3`;`v p`;`v (p+1)`;`(v:num->real^3) (p+3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_V[`p`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+1`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+2`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+3`;`v:num->real^3`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v (p+1)`;`v (p+3)`;`V`] +THEN SUBGOAL_THEN`(!j. ~(v j = v (p + 3)) ==> ~collinear {vec 0, (v:num->real^3) (p + 3), v j})`ASSUME_TAC +; + +REPEAT RESA_TAC +THEN DICH_TAC 0 +THEN REWRITE_TAC[] +THEN MATCH_DICH_TAC 1 +THEN ASM_SIMP_TAC[] +THEN MRESA_TAC WL_IN_V[`j`;`v:num->real^3`] +THEN SET_TAC[]; + + +MRESAL_TAC Iunbuig.coplanar_aff_gt_simple[`s`;`4`;`v`;`p+3`][ARITH_RULE`0+2=2`] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 3[`v (p+1)`;`v(p+3)`][SET_RULE`a IN {a,b}`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(1 MOD 4 = 3 MOD 4)`] +THEN MP_TAC CONDTION_A_LT_B +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`scs_a_v39 s (p + 3) p <= dist (v (p + 3),v p) +==> scs_a_v39 s (p + 3) p = dist (v (p + 3),v p)\/ scs_a_v39 s (p + 3) p < dist (v (p + 3),(v:num->real^3) p)`) +THEN RESA_TAC +; + + + + + +SUBGOAL_THEN`dist (v (p + 3),(v:num->real^3) p) < scs_b_v39 s (p + 3) p` +ASSUME_TAC +; + +THAYTHE_TAC 1[`p+3`] +THEN DICH_TAC 0 +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+3)`;`((p + 3) +1)`;`s`;`p+3`;`((p + 3)+1) MOD 4`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+3)`;`p MOD 4`;`s`;`p+3`;`p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(p+3)`;`(1 * 4 + p)`;`s`;`p+3`;`(1 * 4 + p) MOD 4`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(p+3)`;`p MOD 4`;`s`;`p+3`;`p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +; + + + +MRESAS_TAC NUXCOEAv2[`s`;`4`;`v`;`p`;`p+3`][MOD_MULT_ADD;BASIC_IMP_NOT_J] +; + + +MP_TAC(SET_RULE`~(&2=norm ((v:num->real^3) p))\/ norm (v p)= &2`) +THEN RESA_TAC +; + +MRESAS_TAC IMJXPHRv2[`s`;`4`;`v`;`p`;][MOD_MULT_ADD;BASIC_IMP_NOT_J] +; + +MP_TAC(SET_RULE`(scs_a_v39 s (p+1) (p+2) = &2 )\/ ~((scs_a_v39 s (p+1) (p+2) = &2 ))`) +THEN RESA_TAC; + + + +SUBGOAL_THEN`scs_a_v39 s (p + 3) p < scs_b_v39 s (p + 3) p` +ASSUME_TAC +; + +THAYTHE_TAC (45-42)[`p+3`] +THEN DICH_TAC 0 +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+3)`;`((p + 3) +1)`;`s`;`p+3`;`((p + 3)+1) MOD 4`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+3)`;`p MOD 4`;`s`;`p+3`;`p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(p+3)`;`(1 * 4 + p)`;`s`;`p+3`;`(1 * 4 + p) MOD 4`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(p+3)`;`p MOD 4`;`s`;`p+3`;`p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +; + + + +MP_TAC YEBWJNG +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p+1`][IN;ARITH_RULE`(p+1)+1=p+2`] +THEN ASSUME_TAC(ARITH_RULE`(p+1)+1=p+2/\ (p+2)+1=p+3`) +THEN MRESA_TAC A_EQ2_IMP_B[`s`;`p+1`] +THEN THAYTHE_TAC (49-42)[`p+2`] +THEN MP_TAC Cqaoqlr.CQAOQLR +THEN RESA_TAC +THEN THAYTHES_TAC 0[`s`;`v`;`p`][scs_generic;IN;A_EQ2_IMP_B;REAL_ARITH`a<=a`] +THEN MATCH_DICH_TAC 0 +THEN REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; + + + +ASSUME_TAC(ARITH_RULE`(p+1)+1=p+2/\ (p+2)+1=p+3/\ (p+2)+3=1*4+p+1/\ (p+1)+3=1*4+p/\ (p+3)+1=1*4+p/\ (p+3)+3=1*4+p+2/\ (p+3)+2=1*4+p+1`) +THEN MRESA_TAC A_NOT_EQ2_IMP_B[`s`;`p+1`] +THEN MRESAS_TAC STR_MOD_EQ[`4`;`s`;`v`;`1*4+p+1`][IN;MOD_MULT_ADD] +THEN MRESAS_TAC STR_MOD_EQ[`4`;`s`;`v`;`p+1`][IN;MOD_MULT_ADD;MOD_REFL] +THEN THAYTHES_TAC (50-40)[`1 * 4 + p + 1`;`p+1`][MOD_MULT_ADD] +THEN MP_TAC WKZZEEH +THEN RESA_TAC +THEN THAYTHE_TAC 0[`s`;`v`;`p+2`] +THEN MRESA_TAC PRO_ADD_NOT_IN_SCS_M[`p+1`;`4`;`s`] +THEN MP_TAC(SET_RULE`scs_a_v39 s (p + 3) p = &2 \/ ~(scs_a_v39 s (p + 3) p = &2 )`) +THEN RESA_TAC; + +(**********CASES a 3 0 =2********************) + +MP_TAC TUAPYYU +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p+1`][IN]; + + +MP_TAC Jotswix.LEMMA_PWE1 +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p`][scs_generic;IN;REAL_ARITH`a<=a`;scs_is_str] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`1*4+p`;`p`][MOD_MULT_ADD] +THEN MP_TAC Cuxvzoz.CJBDXXN +THEN RESA_TAC +THEN THAYTHE_TAC 0[`s`;`FF`;`4`;`p+1`;`v`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MATCH_DICH_TAC 0 +THEN ASM_SIMP_TAC[] +THEN REWRITE_TAC[GSYM ADD1] +THEN ASM_REWRITE_TAC[scs_generic] +THEN ASM_SIMP_TAC[A_EQ2_IMP_B;REAL_ARITH`a<=a`] +THEN ASM_REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1;] +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v (p+1)`;`v`;`(p+1)`;`4`] +THEN DICH_TAC(58-17) +THEN ASM_REWRITE_TAC[scs_is_str] +THEN RESA_TAC +THEN MRESAL_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v (p+1)`][] +THEN THAYTHE_TAC 0[`v (p)`] +THEN MP_TAC(REAL_ARITH`azim (vec 0) (v (p + 1)) (v (p + 2)) (v p) <= pi +/\ ~(azim (vec 0) (v (p + 1)) (v (p + 2)) (v p) = pi) +==> azim (vec 0) (v (p + 1)) (v (p + 2)) ((v:num->real^3) p) < pi`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[h0;cstab;REAL_ARITH`&2 <= &2 * #1.26 /\ + &2 * #1.26 <= #3.01`] +THEN REPEAT STRIP_TAC; + + + +THAYTHES_TAC(60-5)[`p`;`p+2`][SCS_DIAG_4_ADD0] +THEN DICH_TAC 1 +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v (p+1)`;`v (p+2)`;`V`] +THEN THAYTHES_TAC 0[`v (p+1)`;`v (p+2)`][SET_RULE`a IN {a,b}`;SET_RULE`a IN {a,b}`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(1 MOD 4 = 2 MOD 4)`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v (p+1)`;`v (p+2)`;`V`] +THEN THAYTHES_TAC 0[`v (p+1)`;`v (p+0)`][SET_RULE`a IN {a,b}`;SET_RULE`a IN {a,b}`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(1 MOD 4 = 0 MOD 4)`] +THEN DICH_TAC 0 +THEN ASM_REWRITE_TAC[ARITH_RULE`a+0=a`] +THEN RESA_TAC +THEN MRESA_TAC AZIM_DIHV_SAME_STRONG[`vec 0:real^3`;`v (p+1)`;`v(p+2)`;`v p`] +; + + + + +MRESAS_TAC CHANGE_A_SCS_MOD[`(p+1)`;`(1 * 4 + p)`;`s`;`p+1`;`(1 * 4 + p) MOD 4`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(p+1)`;`p MOD 4`;`s`;`p+1`;`p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC +; + + + +MRESAS_TAC CHANGE_B_SCS_MOD[`(p+1)`;`(1 * 4 + p)`;`s`;`p+1`;`(1 * 4 + p) MOD 4`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+1)`;`p MOD 4`;`s`;`p+1`;`p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[A_EQ2_IMP_B;h0] +THEN REAL_ARITH_TAC; + + +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN STRIP_TAC +THEN DICH_TAC 3 +THEN RESA_TAC +THEN MP_TAC TUAPYYU_IMP_CASES +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p+2`][IN]; + + +(************CASES 2 3= 2**********) + +MP_TAC Jotswix.LEMMA_PWE2 +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p`][scs_generic;IN;REAL_ARITH`a<=a/\ &2 <= &2 * #1.26`;scs_is_str;h0] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`1*4+p`;`p`][MOD_MULT_ADD] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`1*4+p+2`;`p+2`][MOD_MULT_ADD] +THEN MP_TAC Cuxvzoz.CUXVZOZ +THEN RESA_TAC +THEN THAYTHE_TAC 0[`s`;`FF`;`4`;`p+3`;`v`] +THEN DICH_TAC 0 +THEN ASM_SIMP_TAC[] +THEN REWRITE_TAC[GSYM ADD1] +THEN ASM_REWRITE_TAC[scs_generic] +THEN ASM_SIMP_TAC[A_EQ2_IMP_B;REAL_ARITH`a<=a`] +THEN ASM_REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1;] +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v (p+3)`;`v`;`(p+3)`;`4`] +THEN DICH_TAC(60-19) +THEN ASM_REWRITE_TAC[scs_is_str] +THEN RESA_TAC +THEN MRESAL_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v (p+3)`][] +THEN THAYTHE_TAC 0[`v (p+2)`] +THEN MP_TAC(REAL_ARITH`azim (vec 0) (v (p + 3)) (v p) (v (p + 2)) <= pi +/\ ~(azim (vec 0) (v (p + 3)) (v p) (v (p + 2)) = pi) +==> azim (vec 0) (v (p + 3)) ((v:num->real^3) p) (v (p + 2)) < pi`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN SUBGOAL_THEN`&3 <= dist ((v:num->real^3) p,v (p + 2))`ASSUME_TAC +; + + + + +THAYTHES_TAC(62-5)[`p`;`p+2`][SCS_DIAG_4_ADD0] +THEN DICH_TAC 1 +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +SUBGOAL_THEN`(pi / &2 < azim (vec 0) (v (p + 3)) (v p) (v (p + 2)) \/ + azim (vec 0) (v p) (rho_node1 FF (v p)) (ivs_rho_node1 FF ((v:num->real^3) p)) < pi)`ASSUME_TAC +; + + + + + +MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHEL_ASM_TAC(64-37)[`p+0`][] +THEN THAYTHES_TAC(0)[`p+2`][Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(3 MOD 4 = 2 MOD 4)`] +THEN DICH_TAC 1 +THEN ASM_SIMP_TAC[Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(3 MOD 4 = 0 MOD 4)`] +THEN ASM_REWRITE_TAC[ARITH_RULE`a+0=a`] +THEN RESA_TAC +THEN MRESA_TAC AZIM_DIHV_SAME_STRONG[`vec 0:real^3`;`v (p+3)`;`v(p)`;`v (p+2)`] +; + + +SUBGOAL_THEN`scs_a_v39 s (p + 3) (1 * 4 + p) = &2`ASSUME_TAC +; + + + +MRESAS_TAC CHANGE_A_SCS_MOD[`(p+3)`;`(1 * 4 + p)`;`s`;`p+3`;`(1 * 4 + p) MOD 4`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(p+3)`;`p MOD 4`;`s`;`p+3`;`p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC +; + + +SUBGOAL_THEN`scs_b_v39 s (p + 3) (1 * 4 + p) <= &2 * h0`ASSUME_TAC +; + + + +MRESAS_TAC CHANGE_B_SCS_MOD[`(p+3)`;`(1 * 4 + p)`;`s`;`p+3`;`(1 * 4 + p) MOD 4`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+3)`;`p MOD 4`;`s`;`p+3`;`p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[A_EQ2_IMP_B;] +THEN MRESA_TAC A_EQ2_IMP_B[`s`;`p+3`] +THEN REAL_ARITH_TAC +; + + +ASM_REWRITE_TAC[cstab;REAL_ARITH`&2 <= #3.01`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MP_TAC Cqaoqlr.CQAOQLR +THEN RESA_TAC +THEN THAYTHES_TAC 0[`s`;`v`;`p+3`][scs_generic;IN;A_EQ2_IMP_B;REAL_ARITH`a<=a`] +THEN DICH_TAC 0 +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(1 * 4 + p)`;`(1 * 4 + p+1)`;`s`;`p`;`p+1`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(1 * 4 + p)`;`(1 * 4 + p+1)`;`s`;`p`;`p+1`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD;A_EQ2_IMP_B;REAL_ARITH`a<=a`] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(1 * 4 + p+2)`;`(p+3)`;`s`;`p+2`;`p+3`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(1 * 4 + p+2)`;`(p+3)`;`s`;`p+2`;`p+3`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(1 * 4 + p+1)`;`(1 * 4 + p+2)`;`s`;`p+1`;`p+2`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(1 * 4 + p+1)`;`(1 * 4 + p+2)`;`s`;`p+1`;`p+2`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD;A_EQ2_IMP_B;REAL_ARITH`a<=a`] +THEN THAYTHEL_ASM_TAC(73-40)[`p+2`][] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`( p+3)`;`(1 * 4 + p)`;`s`;`p+3`;`p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD;A_EQ2_IMP_B;REAL_ARITH`a<=a`] +THEN THAYTHEL_ASM_TAC(1)[`p+3`][h0;cstab] +THEN REAL_ARITH_TAC; + +(************CASES 2 3= 2* H0**********) + + +MP_TAC Jotswix.LEMMA_PWE2 +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p`][scs_generic;IN;REAL_ARITH`a<=a/\ &2 <= &2 * #1.26`;scs_is_str;h0] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`1*4+p`;`p`][MOD_MULT_ADD] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`1*4+p+2`;`p+2`][MOD_MULT_ADD] +THEN MP_TAC Cuxvzoz.CUXVZOZ +THEN RESA_TAC +THEN THAYTHE_TAC 0[`s`;`FF`;`4`;`p+3`;`v`] +THEN DICH_TAC 0 +THEN ASM_SIMP_TAC[] +THEN REWRITE_TAC[GSYM ADD1] +THEN ASM_REWRITE_TAC[scs_generic] +THEN ASM_SIMP_TAC[A_EQ2_IMP_B;REAL_ARITH`a<=a`] +THEN ASM_REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1;] +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v (p+3)`;`v`;`(p+3)`;`4`] +THEN DICH_TAC(60-19) +THEN ASM_REWRITE_TAC[scs_is_str] +THEN RESA_TAC +THEN MRESAL_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v (p+3)`][] +THEN THAYTHE_TAC 0[`v (p+2)`] +THEN MP_TAC(REAL_ARITH`azim (vec 0) (v (p + 3)) (v p) (v (p + 2)) <= pi +/\ ~(azim (vec 0) (v (p + 3)) (v p) (v (p + 2)) = pi) +==> azim (vec 0) (v (p + 3)) ((v:num->real^3) p) (v (p + 2)) < pi`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN SUBGOAL_THEN`&3 <= dist ((v:num->real^3) p,v (p + 2))`ASSUME_TAC +; + + + + +THAYTHES_TAC(62-5)[`p`;`p+2`][SCS_DIAG_4_ADD0] +THEN DICH_TAC 1 +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +SUBGOAL_THEN`(pi / &2 < azim (vec 0) (v (p + 3)) (v p) (v (p + 2)) \/ + azim (vec 0) (v p) (rho_node1 FF (v p)) (ivs_rho_node1 FF ((v:num->real^3) p)) < pi)`ASSUME_TAC +; + + + + + +MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHEL_ASM_TAC(64-37)[`p+0`][] +THEN THAYTHES_TAC(0)[`p+2`][Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(3 MOD 4 = 2 MOD 4)`] +THEN DICH_TAC 1 +THEN ASM_SIMP_TAC[Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(3 MOD 4 = 0 MOD 4)`] +THEN ASM_REWRITE_TAC[ARITH_RULE`a+0=a`] +THEN RESA_TAC +THEN MRESA_TAC AZIM_DIHV_SAME_STRONG[`vec 0:real^3`;`v (p+3)`;`v(p)`;`v (p+2)`] +; + + +SUBGOAL_THEN`scs_a_v39 s (p + 3) (1 * 4 + p) = &2`ASSUME_TAC +; + + + +MRESAS_TAC CHANGE_A_SCS_MOD[`(p+3)`;`(1 * 4 + p)`;`s`;`p+3`;`(1 * 4 + p) MOD 4`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(p+3)`;`p MOD 4`;`s`;`p+3`;`p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC +; + + +SUBGOAL_THEN`scs_b_v39 s (p + 3) (1 * 4 + p) <= &2 * h0`ASSUME_TAC +; + + + +MRESAS_TAC CHANGE_B_SCS_MOD[`(p+3)`;`(1 * 4 + p)`;`s`;`p+3`;`(1 * 4 + p) MOD 4`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+3)`;`p MOD 4`;`s`;`p+3`;`p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[A_EQ2_IMP_B;] +THEN MRESA_TAC A_EQ2_IMP_B[`s`;`p+3`] +THEN REAL_ARITH_TAC +; + + +ASM_REWRITE_TAC[cstab;REAL_ARITH`&2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01`;h0] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MP_TAC Cqaoqlr.CQAOQLR +THEN RESA_TAC +THEN THAYTHES_TAC 0[`s`;`v`;`p+3`][scs_generic;IN;A_EQ2_IMP_B;REAL_ARITH`a<=a`] +THEN DICH_TAC 0 +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(1 * 4 + p)`;`(1 * 4 + p+1)`;`s`;`p`;`p+1`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(1 * 4 + p)`;`(1 * 4 + p+1)`;`s`;`p`;`p+1`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD;A_EQ2_IMP_B;REAL_ARITH`a<=a`] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(1 * 4 + p+2)`;`(p+3)`;`s`;`p+2`;`p+3`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(1 * 4 + p+2)`;`(p+3)`;`s`;`p+2`;`p+3`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(1 * 4 + p+1)`;`(1 * 4 + p+2)`;`s`;`p+1`;`p+2`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(1 * 4 + p+1)`;`(1 * 4 + p+2)`;`s`;`p+1`;`p+2`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD;A_EQ2_IMP_B;REAL_ARITH`a<=a`] +THEN THAYTHEL_ASM_TAC(73-40)[`p+2`][] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`( p+3)`;`(1 * 4 + p)`;`s`;`p+3`;`p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD;A_EQ2_IMP_B;REAL_ARITH`a<=a`] +THEN THAYTHEL_ASM_TAC(1)[`p+3`][h0;cstab] +THEN REAL_ARITH_TAC; + + + +(*************CASES a 3 0 NOT = 2************) + + +MRESAS_TAC CHANGE_A_SCS_MOD[`(p+3)`;`(1 * 4 + p)`;`s`;`p+3`;`p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+3)`;`(1 * 4 + p)`;`s`;`p+3`;`p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESA_TAC A_NOT_EQ2_IMP_B [`s`;`p+3`] +THEN MRESA_TAC PRO_ADD_NOT_IN_SCS_M[`p+3`;`4`;`s`] +THEN MRESAL_TAC B_LE_2h0_2_SCS_M_4_1[`s`;`p`][SET_RULE`{a,b} SUBSET A<=> a IN A/\ b IN A`] +THEN MRESA_TAC B_LE_2h0_IMP_B[`s`;`p+2`] +THEN MP_TAC YEBWJNG +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p+2`][IN]; + + + +MP_TAC TUAPYYU +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p+1`][IN]; + + +MP_TAC Jotswix.LEMMA_PWE3 +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p`][scs_generic;IN;REAL_ARITH`a<=a`;scs_is_str] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`1*4+p`;`p`][MOD_MULT_ADD] +THEN MP_TAC Cuxvzoz.CJBDXXN +THEN RESA_TAC +THEN THAYTHE_TAC 0[`s`;`FF`;`4`;`p+1`;`v`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MATCH_DICH_TAC 0 +THEN ASM_SIMP_TAC[] +THEN REWRITE_TAC[GSYM ADD1] +THEN ASM_REWRITE_TAC[scs_generic] +THEN ASM_SIMP_TAC[A_EQ2_IMP_B;REAL_ARITH`a<=a`] +THEN ASM_REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1;] +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v (p+1)`;`v`;`(p+1)`;`4`] +; + +DICH_TAC(67-17) +THEN ASM_REWRITE_TAC[scs_is_str] +THEN RESA_TAC +THEN MRESAL_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v (p+1)`][] +THEN THAYTHE_TAC 0[`v (p)`] +THEN MP_TAC(REAL_ARITH`azim (vec 0) (v (p + 1)) (v (p + 2)) (v p) <= pi +/\ ~(azim (vec 0) (v (p + 1)) (v (p + 2)) (v p) = pi) +==> azim (vec 0) (v (p + 1)) (v (p + 2)) ((v:num->real^3) p) < pi`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[h0;cstab;REAL_ARITH`&2 <= &2 * #1.26 /\ + &2 * #1.26 <= #3.01`] +THEN REPEAT STRIP_TAC; + + + +THAYTHES_TAC(69-5)[`p`;`p+2`][SCS_DIAG_4_ADD0] +THEN DICH_TAC 1 +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v (p+1)`;`v (p+2)`;`V`] +THEN THAYTHES_TAC 0[`v (p+1)`;`v (p+2)`][SET_RULE`a IN {a,b}`;SET_RULE`a IN {a,b}`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(1 MOD 4 = 2 MOD 4)`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v (p+1)`;`v (p+2)`;`V`] +THEN THAYTHES_TAC 0[`v (p+1)`;`v (p+0)`][SET_RULE`a IN {a,b}`;SET_RULE`a IN {a,b}`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(1 MOD 4 = 0 MOD 4)`] +THEN DICH_TAC 0 +THEN ASM_REWRITE_TAC[ARITH_RULE`a+0=a`] +THEN RESA_TAC +THEN MRESA_TAC AZIM_DIHV_SAME_STRONG[`vec 0:real^3`;`v (p+1)`;`v(p+2)`;`v p`] +THEN ASM_REWRITE_TAC[DIHV_SYM]; + + + + +MRESAS_TAC CHANGE_A_SCS_MOD[`(p+1)`;`(1 * 4 + p)`;`s`;`p+1`;`(1 * 4 + p) MOD 4`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(p+1)`;`p MOD 4`;`s`;`p+1`;`p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC +; + + + +MRESAS_TAC CHANGE_B_SCS_MOD[`(p+1)`;`(1 * 4 + p)`;`s`;`p+1`;`(1 * 4 + p) MOD 4`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+1)`;`p MOD 4`;`s`;`p+1`;`p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[A_EQ2_IMP_B;h0] +THEN REAL_ARITH_TAC; + + + +(*************CASES 1 2= cstab **************) + + +MP_TAC Jotswix.LEMMA_PWE3 +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p`][scs_generic;IN;REAL_ARITH`a<=a/\ &2 * #1.26 <= #3.01`;scs_is_str;h0;cstab] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`1*4+p`;`p`][MOD_MULT_ADD] +THEN MP_TAC Cuxvzoz.CJBDXXN +THEN RESA_TAC +THEN THAYTHE_TAC 0[`s`;`FF`;`4`;`p+1`;`v`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MATCH_DICH_TAC 0 +THEN ASM_SIMP_TAC[] +THEN REWRITE_TAC[GSYM ADD1] +THEN ASM_REWRITE_TAC[scs_generic] +THEN ASM_SIMP_TAC[A_EQ2_IMP_B;REAL_ARITH`a<=a`] +THEN ASM_REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1;] +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v (p+1)`;`v`;`(p+1)`;`4`] +; + +DICH_TAC(67-17) +THEN ASM_REWRITE_TAC[scs_is_str] +THEN RESA_TAC +THEN MRESAL_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v (p+1)`][] +THEN THAYTHE_TAC 0[`v (p)`] +THEN MP_TAC(REAL_ARITH`azim (vec 0) (v (p + 1)) (v (p + 2)) (v p) <= pi +/\ ~(azim (vec 0) (v (p + 1)) (v (p + 2)) (v p) = pi) +==> azim (vec 0) (v (p + 1)) (v (p + 2)) ((v:num->real^3) p) < pi`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[h0;cstab;REAL_ARITH`&2 <= &2 * #1.26 /\ + &2 * #1.26 <= #3.01`] +THEN REPEAT STRIP_TAC; + + + +THAYTHES_TAC(69-5)[`p`;`p+2`][SCS_DIAG_4_ADD0] +THEN DICH_TAC 1 +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v (p+1)`;`v (p+2)`;`V`] +THEN THAYTHES_TAC 0[`v (p+1)`;`v (p+2)`][SET_RULE`a IN {a,b}`;SET_RULE`a IN {a,b}`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(1 MOD 4 = 2 MOD 4)`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v (p+1)`;`v (p+2)`;`V`] +THEN THAYTHES_TAC 0[`v (p+1)`;`v (p+0)`][SET_RULE`a IN {a,b}`;SET_RULE`a IN {a,b}`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(1 MOD 4 = 0 MOD 4)`] +THEN DICH_TAC 0 +THEN ASM_REWRITE_TAC[ARITH_RULE`a+0=a`] +THEN RESA_TAC +THEN MRESA_TAC AZIM_DIHV_SAME_STRONG[`vec 0:real^3`;`v (p+1)`;`v(p+2)`;`v p`] +THEN ASM_REWRITE_TAC[DIHV_SYM]; + + + + +MRESAS_TAC CHANGE_A_SCS_MOD[`(p+1)`;`(1 * 4 + p)`;`s`;`p+1`;`(1 * 4 + p) MOD 4`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(p+1)`;`p MOD 4`;`s`;`p+1`;`p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC +; + + + +MRESAS_TAC CHANGE_B_SCS_MOD[`(p+1)`;`(1 * 4 + p)`;`s`;`p+1`;`(1 * 4 + p) MOD 4`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+1)`;`p MOD 4`;`s`;`p+1`;`p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[A_EQ2_IMP_B;h0] +THEN REAL_ARITH_TAC; + + +REAL_ARITH_TAC; + + +REAL_ARITH_TAC; + + + +(*********scs_is_str p+1***********) + + + + +MRESAL_TAC NOT_STR_IN_CASES_4_1[`p`;`s`;`v`][IN] +THEN DICH_TAC 3 +THEN ASM_REWRITE_TAC[scs_is_str;] +THEN STRIP_TAC +THEN DICH_TAC(21-13) +THEN ASM_REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;] +THEN STRIP_TAC +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN THAYTHE_TAC 1[`p+1`;`(p+2)`] +; + + +MRESAL_TAC MMS_IMP_BBPRIME[`s`;`v`][LET_DEF;LET_END_DEF;BBprime_v39] +THEN MRESAL_TAC JKQEWGV2[`s`;`v`][LET_DEF;LET_END_DEF;scs_generic] +THEN MP_TAC Wrgcvdr_cizmrrh.CIZMRRH +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_EXISTS_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN`(!V' E' v1. V' = V /\ E' = E ==> ~lunar (v1,(v:num->real^3) (p)) V' E')` ASSUME_TAC; + + + +REPEAT RESA_TAC +; + + +ASSUME_TAC(ARITH_RULE`(p+1)+1=p+2/\ (p+1)+3= 1*4+p/\ (p+3)+1= 1*4+p/\ (p+3)+2= 1*4+p+1/\ (p+3)+3= 1*4+p+2`) +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`1*4+p`;`p`][ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN DICH_TAC(32-20) +THEN RESA_TAC +THEN MRESA_TAC Local_lemmas1.AZIM_COND_FOR_COPLANAR[`vec 0:real^3`;`v (p+1)`;`v (p+2)`;`(v:num->real^3) (p)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_V[`p`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+1`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+2`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+3`;`v:num->real^3`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v p`;`v (p+2)`;`V`] +THEN SUBGOAL_THEN`(!j. ~(v j = v (p)) ==> ~collinear {vec 0, (v:num->real^3) (p ), v j})`ASSUME_TAC +; + +REPEAT RESA_TAC +THEN DICH_TAC 0 +THEN REWRITE_TAC[] +THEN MATCH_DICH_TAC 1 +THEN ASM_SIMP_TAC[] +THEN MRESA_TAC WL_IN_V[`j`;`v:num->real^3`] +THEN SET_TAC[]; + + +MRESAL_TAC Iunbuig.coplanar_aff_gt_simple[`s`;`4`;`v`;`p`][ARITH_RULE`0+2=2`] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 3[`v (p+0)`;`v(p+2)`][SET_RULE`a IN {a,b}`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(0 MOD 4 = 2 MOD 4)`] +THEN DICH_TAC 0 +THEN REWRITE_TAC[ARITH_RULE`a+0=a`;SET_RULE`a IN {a,b}`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MP_TAC CONDTION_A_LT_B +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`scs_a_v39 s (p+1) (p+2) <= dist (v (p+1),v (p+2)) +==> scs_a_v39 s (p+1) (p+2) = dist (v (p+1),v (p+2))\/ scs_a_v39 s (p+1) (p+2) < dist (v (p+1),(v:num->real^3) (p+2))`) +THEN RESA_TAC +; + + + + + +SUBGOAL_THEN`dist (v (p + 1),(v:num->real^3) (p+2)) < scs_b_v39 s (p + 1) (p+2)` +ASSUME_TAC +; + +THAYTHE_TAC 1[`p+1`] +THEN DICH_TAC 0 +; + +MRESAS_TAC NUXCOEAv2[`s`;`4`;`v`;`p+1`;`p+2`][MOD_MULT_ADD;BASIC_IMP_NOT_J] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN MRESA_TAC SCS_A_SYM[`s`;`1*4+p`;`p+1`] +THEN MRESA_TAC SCS_A_SYM[`s`;`p+1`;`p+2`] +THEN MRESA_TAC SCS_B_SYM[`s`;`p+1`;`p+2`] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(1*4+p)`;`(p+1)`;`s`;`p`;`(p+1)`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN ASM_SIMP_TAC[DIST_SYM]; + + +MP_TAC(SET_RULE`~(&2=norm ((v:num->real^3) (p+1)))\/ norm (v (p+1))= &2`) +THEN RESA_TAC +; + +MRESAS_TAC IMJXPHRv2[`s`;`4`;`v`;`p+1`;][MOD_MULT_ADD;BASIC_IMP_NOT_J] +THEN DICH_TAC 0 +THEN MRESA_TAC SCS_A_SYM[`s`;`1*4+p`;`p+1`] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(1*4+p)`;`(p+1)`;`s`;`p`;`(p+1)`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN ASM_SIMP_TAC[DIST_SYM]; + + + + + + + +MP_TAC(SET_RULE`(scs_a_v39 s (p+3) (p) = &2 )\/ ~((scs_a_v39 s (p+3) (p) = &2 ))`) +THEN RESA_TAC; + + + +MRESAS_TAC CHANGE_A_SCS_MOD[`(p+3)`;`(1 * 4 + p)`;`s`;`p+3`;` p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(1*4+p+1)`;`(1 * 4 + p+2)`;`s`;`p+1`;` p+2`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(1*4+p+2)`;`(p+3)`;`s`;`p+2`;` p+3`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(1*4+p+1)`;`(1 * 4 + p+2)`;`s`;`p+1`;` p+2`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(1*4+p+2)`;`(p+3)`;`s`;`p+2`;` p+3`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+3)`;`(1 * 4 + p)`;`s`;`p+3`;` p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(1*4+p)`;`(1 * 4 + p+1)`;`s`;`p`;` p+1`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAL_TAC STR_MOD_EQ[`4`;`s`;`v`;`1*4+p`][IN;MOD_MULT_ADD] +THEN MRESAL_TAC STR_MOD_EQ[`4`;`s`;`v`;`p`][IN;MOD_MULT_ADD] +THEN MP_TAC YEBWJNG +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p+3`][IN;ARITH_RULE`(p+1)+1=p+2`] +THEN THAYTHEL_ASM_TAC (55-42)[`p+1`][] +THEN THAYTHEL_TAC 0[`p+2`][ARITH_RULE`(i+2)+1=i+3`] +THEN MRESA_TAC A_EQ2_IMP_B[`s`;`p+3`] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(1*4+p)`;`(1 * 4 + p+1)`;`s`;`p`;` p+1`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN THAYTHES_TAC (58-40)[`(1 * 4 + p+1)`;`p+1`][MOD_MULT_ADD] +THEN MP_TAC Cqaoqlr.CQAOQLR +THEN RESA_TAC +THEN THAYTHES_TAC 0[`s`;`v`;`p+3`][scs_generic;IN;A_EQ2_IMP_B;REAL_ARITH`a<=a`] +THEN MATCH_DICH_TAC 0 +THEN REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; + + + +ASSUME_TAC(ARITH_RULE`(p+1)+1=p+2/\ (p+2)+1=p+3/\ (p+2)+3=1*4+p+1/\ (p+1)+3=1*4+p/\ (p+3)+1=1*4+p/\ (p+3)+3=1*4+p+2/\ (p+3)+2=1*4+p+1/\ (p+1)+2=p+3`) +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(p+3)`;`(1 * 4 + p)`;`s`;`p+3`;` p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(1*4+p+1)`;`(1 * 4 + p+2)`;`s`;`p+1`;` p+2`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(1*4+p+2)`;`(p+3)`;`s`;`p+2`;` p+3`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(1*4+p+1)`;`(1 * 4 + p+2)`;`s`;`p+1`;` p+2`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(1*4+p+2)`;`(p+3)`;`s`;`p+2`;` p+3`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+3)`;`(1 * 4 + p)`;`s`;`p+3`;` p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(1*4+p)`;`(1 * 4 + p+1)`;`s`;`p`;` p+1`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESA_TAC A_NOT_EQ2_IMP_B[`s`;`p+3`] +THEN MRESAS_TAC STR_MOD_EQ[`4`;`s`;`v`;`1*4+p+2`][IN;MOD_MULT_ADD] +THEN MRESAS_TAC STR_MOD_EQ[`4`;`s`;`v`;`p+2`][IN;MOD_MULT_ADD;MOD_REFL] +THEN MRESAS_TAC STR_MOD_EQ[`4`;`s`;`v`;`1*4+p`][IN;MOD_MULT_ADD] +THEN MRESAS_TAC STR_MOD_EQ[`4`;`s`;`v`;`p`][IN;MOD_MULT_ADD;MOD_REFL] +; + +THAYTHES_TAC (59-40)[`1 * 4 + p + 2`;`p+2`][MOD_MULT_ADD] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`1*4+p+1`;`p+1`][ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`1*4+p+3`;`p+3`][ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MP_TAC WKZZEEH +THEN RESA_TAC +THEN THAYTHE_TAC 0[`s`;`v`;`p+3`] +THEN MRESA_TAC PRO_ADD_NOT_IN_SCS_M[`p+3`;`4`;`s`] +THEN MP_TAC(SET_RULE`scs_a_v39 s (p + 1) (p+2) = &2 \/ ~(scs_a_v39 s (p + 1) (p+2) = &2 )`) +THEN RESA_TAC; + +(**********CASES a 1 2 =2********************) + + +MP_TAC TUAPYYU +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p+3`][IN]; + + + + + + +MRESAS_TAC CHANGE_A_SCS_MOD[`(1*4+p)`;`(p+1)`;`s`;`p`;` p+1`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MP_TAC Jotswix.LEMMA_PWE2 +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p+1`][scs_generic;IN;REAL_ARITH`a<=a`;] +THEN DICH_TAC 0 +THEN ASM_REWRITE_TAC[scs_is_str] +THEN STRIP_TAC +THEN MP_TAC Cuxvzoz.CUXVZOZ +THEN RESA_TAC +THEN THAYTHE_TAC 0[`s`;`FF`;`4`;`p`;`v`] +THEN MATCH_DICH_TAC 0 +THEN ASM_SIMP_TAC[] +THEN REWRITE_TAC[GSYM ADD1] +THEN ASM_REWRITE_TAC[scs_generic] +THEN ASM_SIMP_TAC[A_EQ2_IMP_B;REAL_ARITH`a<=a`] +THEN ASM_REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1;] +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v p`;`v`;`p`;`4`] +; + +DICH_TAC(69-17) +THEN ASM_REWRITE_TAC[scs_is_str] +THEN RESA_TAC +THEN MRESAL_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v p`][] +THEN THAYTHE_TAC 0[`v (p+3)`] +THEN MP_TAC(REAL_ARITH`azim (vec 0) (v p) (v (p + 1)) (v (p + 3)) <= pi +/\ ~(azim (vec 0) (v p) (v (p + 1)) (v (p + 3)) = pi) +==> azim (vec 0) (v p) (v (p + 1)) ((v:num->real^3) (p + 3)) < pi`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[h0;cstab;REAL_ARITH`&2 <= &2 * #1.26 /\ + &2 * #1.26 <= #3.01`] +THEN REPEAT STRIP_TAC; + + + +THAYTHES_TAC(71-5)[`p+1`;`p+3`][SCS_DIAG_4_ADD2] +THEN DICH_TAC 1 +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + + +MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v p`;`v (p+1)`;`V`] +THEN THAYTHES_TAC 0[`v (p+0)`;`v (p+1)`][SET_RULE`a IN {a,b}`;SET_RULE`a IN {a,b}`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(1 MOD 4 = 0 MOD 4)`] +THEN DICH_TAC 0 +THEN ASM_REWRITE_TAC[ARITH_RULE`a+0=a`;SET_RULE`a IN {a,b}`] +THEN RESA_TAC +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v p`;`v (p+3)`;`V`] +THEN THAYTHES_TAC 0[`v (p+0)`;`v (p+3)`][SET_RULE`a IN {a,b}`;SET_RULE`a IN {a,b}`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(3 MOD 4 = 0 MOD 4)`] +THEN DICH_TAC 0 +THEN ASM_REWRITE_TAC[ARITH_RULE`a+0=a`;SET_RULE`a IN {a,b}`] +THEN RESA_TAC +THEN MRESA_TAC AZIM_DIHV_SAME_STRONG[`vec 0:real^3`;`v p`;`v(p+1)`;`v (p+3)`] +; + + + + + + + + +DICH_TAC 3 +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN STRIP_TAC +THEN MP_TAC TUAPYYU_IMP_CASES +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p+2`][IN]; + + +(************CASES 2 3= 2**********) + + +MRESAS_TAC CHANGE_A_SCS_MOD[`(1*4+p)`;`(p+1)`;`s`;`p`;` p+1`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MP_TAC Jotswix.LEMMA_PWE1 +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p+1`][scs_generic;IN;REAL_ARITH`a<=a/\ &2 <= &2 * #1.26`;h0] +THEN DICH_TAC 0 +THEN ASM_REWRITE_TAC[scs_is_str] +THEN STRIP_TAC +THEN MP_TAC Cuxvzoz.CJBDXXN +THEN RESA_TAC +THEN THAYTHE_TAC 0[`s`;`FF`;`4`;`p+2`;`v`] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_SIMP_TAC[] +THEN REWRITE_TAC[GSYM ADD1] +THEN ASM_REWRITE_TAC[scs_generic] +THEN ASM_REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1;] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(p+2)`;`(1 * 4 + p+1)`;`s`;`p+2`;` p+1`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+2)`;`(1 * 4 + p+1)`;`s`;`p+2`;` p+1`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESA_TAC SCS_A_SYM[`s`;`p+1`;`p+2`] +THEN MRESA_TAC SCS_B_SYM[`s`;`p+1`;`p+2`] +THEN MRESA_TAC A_EQ2_IMP_B[`s`;`p+1`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_SIMP_TAC[REAL_ARITH`a<=a`] +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v (p+2)`;`v`;`(p+2)`;`4`] +; + +DICH_TAC(75-18) +THEN ASM_REWRITE_TAC[scs_is_str] +THEN RESA_TAC +THEN MRESAL_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v (p+2)`][] +THEN THAYTHE_TAC 0[`v (p+1)`] +THEN MP_TAC(REAL_ARITH`azim (vec 0) (v (p + 2)) (v (p + 3)) (v (p + 1)) <= pi +/\ ~(azim (vec 0) (v (p + 2)) (v (p + 3)) (v (p + 1)) = pi) +==> azim (vec 0) (v (p + 2)) (v (p + 3)) ((v:num->real^3) (p + 1)) < pi`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN SUBGOAL_THEN`&3 <= dist ((v:num->real^3) (p+1),v (p + 3))`ASSUME_TAC +; + + + + +THAYTHES_TAC(77-5)[`p+1`;`p+3`][SCS_DIAG_4_ADD2] +THEN DICH_TAC 1 +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +SUBGOAL_THEN`(pi / &2 < azim (vec 0) (v (p + 2)) (v (p + 3)) (v (p + 1)) \/ + azim (vec 0) ((v:num->real^3) (p + 1)) (rho_node1 FF (v (p + 1))) + (ivs_rho_node1 FF (v (p + 1))) < + pi)`ASSUME_TAC +; + + + + + +MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v (p+2)`;`v (p+1)`;`V`] +THEN THAYTHES_TAC 0[`v (p+2)`;`v (p+1)`][SET_RULE`a IN {a,b}`;SET_RULE`a IN {a,b}`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(1 MOD 4 = 2 MOD 4)`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v (p+2)`;`v (p+3)`;`V`] +THEN THAYTHES_TAC 0[`v (p+2)`;`v (p+3)`][SET_RULE`a IN {a,b}`;SET_RULE`a IN {a,b}`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(3 MOD 4 = 2 MOD 4)`] +THEN MRESA_TAC AZIM_DIHV_SAME_STRONG[`vec 0:real^3`;`v (p+2)`;`v(p+3)`;`v (p+1)`] +; + + +ASM_REWRITE_TAC[cstab;REAL_ARITH`&2 <= #3.01`] +THEN STRIP_TAC +THEN MP_TAC Cqaoqlr.CQAOQLR +THEN RESA_TAC +THEN THAYTHES_TAC 0[`s`;`v`;`p`][scs_generic;IN;A_EQ2_IMP_B;REAL_ARITH`a<=a`] +THEN MATCH_DICH_TAC 0 +THEN THAYTHEL_ASM_TAC(80-40)[`p+2`][h0;cstab] +THEN REAL_ARITH_TAC; + +(************CASES 2 3= 2* H0**********) + + + + +MRESAS_TAC CHANGE_A_SCS_MOD[`(1*4+p)`;`(p+1)`;`s`;`p`;` p+1`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MP_TAC Jotswix.LEMMA_PWE1 +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p+1`][scs_generic;IN;REAL_ARITH`a<=a/\ &2 <= &2 * #1.26`;h0] +THEN DICH_TAC 0 +THEN ASM_REWRITE_TAC[scs_is_str] +THEN STRIP_TAC +THEN MP_TAC Cuxvzoz.CJBDXXN +THEN RESA_TAC +THEN THAYTHE_TAC 0[`s`;`FF`;`4`;`p+2`;`v`] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_SIMP_TAC[] +THEN REWRITE_TAC[GSYM ADD1] +THEN ASM_REWRITE_TAC[scs_generic] +THEN ASM_REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1;] +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(p+2)`;`(1 * 4 + p+1)`;`s`;`p+2`;` p+1`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+2)`;`(1 * 4 + p+1)`;`s`;`p+2`;` p+1`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESA_TAC SCS_A_SYM[`s`;`p+1`;`p+2`] +THEN MRESA_TAC SCS_B_SYM[`s`;`p+1`;`p+2`] +THEN MRESA_TAC A_EQ2_IMP_B[`s`;`p+1`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_SIMP_TAC[REAL_ARITH`a<=a`] +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v (p+2)`;`v`;`(p+2)`;`4`] +; + +DICH_TAC(75-18) +THEN ASM_REWRITE_TAC[scs_is_str] +THEN RESA_TAC +THEN MRESAL_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v (p+2)`][] +THEN THAYTHE_TAC 0[`v (p+1)`] +THEN MP_TAC(REAL_ARITH`azim (vec 0) (v (p + 2)) (v (p + 3)) (v (p + 1)) <= pi +/\ ~(azim (vec 0) (v (p + 2)) (v (p + 3)) (v (p + 1)) = pi) +==> azim (vec 0) (v (p + 2)) (v (p + 3)) ((v:num->real^3) (p + 1)) < pi`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN SUBGOAL_THEN`&3 <= dist ((v:num->real^3) (p+1),v (p + 3))`ASSUME_TAC +; + + + + +THAYTHES_TAC(77-5)[`p+1`;`p+3`][SCS_DIAG_4_ADD2] +THEN DICH_TAC 1 +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +SUBGOAL_THEN`(pi / &2 < azim (vec 0) (v (p + 2)) (v (p + 3)) (v (p + 1)) \/ + azim (vec 0) ((v:num->real^3) (p + 1)) (rho_node1 FF (v (p + 1))) + (ivs_rho_node1 FF (v (p + 1))) < + pi)`ASSUME_TAC +; + + + + + +MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v (p+2)`;`v (p+1)`;`V`] +THEN THAYTHES_TAC 0[`v (p+2)`;`v (p+1)`][SET_RULE`a IN {a,b}`;SET_RULE`a IN {a,b}`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(1 MOD 4 = 2 MOD 4)`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v (p+2)`;`v (p+3)`;`V`] +THEN THAYTHES_TAC 0[`v (p+2)`;`v (p+3)`][SET_RULE`a IN {a,b}`;SET_RULE`a IN {a,b}`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(3 MOD 4 = 2 MOD 4)`] +THEN MRESA_TAC AZIM_DIHV_SAME_STRONG[`vec 0:real^3`;`v (p+2)`;`v(p+3)`;`v (p+1)`] +; + + +ASM_REWRITE_TAC[cstab;REAL_ARITH`&2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01`;h0] +THEN STRIP_TAC +THEN MP_TAC Cqaoqlr.CQAOQLR +THEN RESA_TAC +THEN THAYTHES_TAC 0[`s`;`v`;`p`][scs_generic;IN;A_EQ2_IMP_B;REAL_ARITH`a<=a`] +THEN MATCH_DICH_TAC 0 +THEN THAYTHEL_ASM_TAC(80-40)[`p+2`][h0;cstab] +THEN REAL_ARITH_TAC; + + +(*************CASES a 1 2 NOT = 2************) + + +MRESA_TAC A_NOT_EQ2_IMP_B [`s`;`p+1`] +THEN MRESA_TAC PRO_ADD_NOT_IN_SCS_M[`p+1`;`4`;`s`] +THEN MRESAL_TAC B_LE_2h0_2_SCS_M_4_1[`s`;`p`][SET_RULE`{a,b} SUBSET A<=> a IN A/\ b IN A`] +THEN MRESA_TAC B_LE_2h0_IMP_B[`s`;`p+2`] +THEN MP_TAC YEBWJNG +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p+2`][IN]; + + + +MP_TAC TUAPYYU +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p+3`][IN]; + + +MRESAS_TAC CHANGE_A_SCS_MOD[`(1*4+p)`;`(p+1)`;`s`;`p`;` p+1`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MP_TAC Jotswix.LEMMA_PWE4 +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p+1`][scs_generic;IN;REAL_ARITH`a<=a`;] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[scs_is_str;REAL_ARITH`a<=a`] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +; + + + + +MP_TAC Cuxvzoz.CUXVZOZ +THEN RESA_TAC +THEN THAYTHE_TAC 0[`s`;`FF`;`4`;`p`;`v`] +THEN MATCH_DICH_TAC 0 +THEN ASM_SIMP_TAC[] +THEN REWRITE_TAC[GSYM ADD1] +THEN ASM_REWRITE_TAC[scs_generic] +THEN ASM_SIMP_TAC[A_EQ2_IMP_B;REAL_ARITH`a<=a`] +THEN ASM_REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1;] +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v p`;`v`;`p`;`4`] +; + +DICH_TAC(76-17) +THEN ASM_REWRITE_TAC[scs_is_str] +THEN RESA_TAC +THEN MRESAL_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v p`][] +THEN THAYTHE_TAC 0[`v (p+3)`] +THEN MP_TAC(REAL_ARITH`azim (vec 0) (v p) (v (p + 1)) (v (p + 3)) <= pi +/\ ~(azim (vec 0) (v p) (v (p + 1)) (v (p + 3)) = pi) +==> azim (vec 0) (v p) (v (p + 1)) ((v:num->real^3) (p + 3)) < pi`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[h0;cstab;REAL_ARITH`&2 <= &2 * #1.26 /\ + &2 * #1.26 <= #3.01`] +THEN REPEAT STRIP_TAC; + + + +THAYTHES_TAC(78-5)[`p+1`;`p+3`][SCS_DIAG_4_ADD2] +THEN DICH_TAC 1 +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + + +MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v p`;`v (p+1)`;`V`] +THEN THAYTHES_TAC 0[`v (p+0)`;`v (p+1)`][SET_RULE`a IN {a,b}`;SET_RULE`a IN {a,b}`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(1 MOD 4 = 0 MOD 4)`] +THEN DICH_TAC 0 +THEN ASM_REWRITE_TAC[ARITH_RULE`a+0=a`;SET_RULE`a IN {a,b}`] +THEN RESA_TAC +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v p`;`v (p+3)`;`V`] +THEN THAYTHES_TAC 0[`v (p+0)`;`v (p+3)`][SET_RULE`a IN {a,b}`;SET_RULE`a IN {a,b}`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(3 MOD 4 = 0 MOD 4)`] +THEN DICH_TAC 0 +THEN ASM_REWRITE_TAC[ARITH_RULE`a+0=a`;SET_RULE`a IN {a,b}`] +THEN RESA_TAC +THEN MRESA_TAC AZIM_DIHV_SAME_STRONG[`vec 0:real^3`;`v p`;`v(p+1)`;`v (p+3)`] +; + + + +(*************CASES 0 3= cstab **************) + + + +MRESAS_TAC CHANGE_A_SCS_MOD[`(1*4+p)`;`(p+1)`;`s`;`p`;` p+1`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MP_TAC Jotswix.LEMMA_PWE4 +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p+1`][scs_generic;IN;REAL_ARITH`a<=a`;] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[scs_is_str;REAL_ARITH`&2 * #1.26 <= #3.01`;h0;cstab] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +; + +MP_TAC Cuxvzoz.CUXVZOZ +THEN RESA_TAC +THEN THAYTHE_TAC 0[`s`;`FF`;`4`;`p`;`v`] +THEN MATCH_DICH_TAC 0 +THEN ASM_SIMP_TAC[] +THEN REWRITE_TAC[GSYM ADD1] +THEN ASM_REWRITE_TAC[scs_generic] +THEN ASM_SIMP_TAC[A_EQ2_IMP_B;REAL_ARITH`a<=a`] +THEN ASM_REWRITE_TAC[interior_angle1;GSYM ivs_rho_node1;] +THEN MRESA_TAC BB_RHO_NODE_IVS[`V`;`E`;`s`;`FF`;`v p`;`v`;`p`;`4`] +; + +DICH_TAC(76-17) +THEN ASM_REWRITE_TAC[scs_is_str] +THEN RESA_TAC +THEN MRESAL_TAC Local_lemmas.IN_V_IMP_AZIM_LESS_PI[`E`;`V`;`FF`;`v p`][] +THEN THAYTHE_TAC 0[`v (p+3)`] +THEN MP_TAC(REAL_ARITH`azim (vec 0) (v p) (v (p + 1)) (v (p + 3)) <= pi +/\ ~(azim (vec 0) (v p) (v (p + 1)) (v (p + 3)) = pi) +==> azim (vec 0) (v p) (v (p + 1)) ((v:num->real^3) (p + 3)) < pi`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[h0;cstab;REAL_ARITH`&2 <= &2 * #1.26 /\ + &2 * #1.26 <= #3.01`] +THEN REPEAT STRIP_TAC; + + + +THAYTHES_TAC(78-5)[`p+1`;`p+3`][SCS_DIAG_4_ADD2] +THEN DICH_TAC 1 +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + + + +MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v p`;`v (p+1)`;`V`] +THEN THAYTHES_TAC 0[`v (p+0)`;`v (p+1)`][SET_RULE`a IN {a,b}`;SET_RULE`a IN {a,b}`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(1 MOD 4 = 0 MOD 4)`] +THEN DICH_TAC 0 +THEN ASM_REWRITE_TAC[ARITH_RULE`a+0=a`;SET_RULE`a IN {a,b}`] +THEN RESA_TAC +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v p`;`v (p+3)`;`V`] +THEN THAYTHES_TAC 0[`v (p+0)`;`v (p+3)`][SET_RULE`a IN {a,b}`;SET_RULE`a IN {a,b}`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(3 MOD 4 = 0 MOD 4)`] +THEN DICH_TAC 0 +THEN ASM_REWRITE_TAC[ARITH_RULE`a+0=a`;SET_RULE`a IN {a,b}`] +THEN RESA_TAC +THEN MRESA_TAC AZIM_DIHV_SAME_STRONG[`vec 0:real^3`;`v p`;`v(p+1)`;`v (p+3)`] +; + + + + +REAL_ARITH_TAC; + +]);; + + + +let h0_CSTAB_LT_4=prove(`&2< &2*h0 /\ cstab< &4/\ &2<= &2*h0 /\ cstab<= &4 +/\ &2*h0< &4/\ &2< &4`, +REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC);; + + + + + + + +let VASYYAU= prove_by_refinement(` +main_nonlinear_terminal_v11 ==> +(!s v p. + is_scs_v39 s /\ scs_basic_v39 s /\ scs_k_v39 s = 4 /\ MMs_v39 s v/\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4*h0 < scs_b_v39 s i j) /\ + (!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/ + (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) /\ + scs_is_str s v p + ==> (dist(v p,v (p+1)) = scs_a_v39 s p (p+1) /\ dist(v p,v (p+3)) = scs_a_v39 s p (p+3)))`, +[STRIP_TAC +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN ABBREV_TAC`V= IMAGE (v:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(v:num->real^3) i, v (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((v:num->real^3) i, v (SUC i))) (:num)` +THEN ASM_TAC +THEN REPLICATE_TAC 11 (RESA_TAC) +THEN ASSUME_TAC(ARITH_RULE`3<4/\ 1<4/\ ~(4=0)/\ 4-1=3/\ SUC (p + 3)= 1*4+p/\ SUC p= p+1`) +THEN ASM_SIMP_TAC[] +THEN MRESAL_TAC GSXRFWM[`s`;`v`][IN;scs_generic] +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN MRESA_TAC Imjxphr.BBS_IMP_CONVEX_LOCAL_FAN[`4`;`s`;`v`] +THEN MP_TAC Local_lemmas.CVLF_LF_F +THEN RESA_TAC +THEN MP_TAC Tfitskc.SCS_DIAG_A_LE_DIST +THEN RESA_TAC +THEN MP_TAC Jlxfdmj.SCS_A_2 +THEN RESA_TAC +THEN THAYTHE_TAC 0[`p`] +THEN MP_TAC(REAL_ARITH`&2 <= scs_a_v39 s p (p + 1) +==> scs_a_v39 s p (p+1) = &2\/ &2 < scs_a_v39 s p (p + 1)`) +THEN RESA_TAC; + + +MP_TAC PWEIWBZ +THEN RESA_TAC +THEN THAYTHE_TAC 0[`s`;`v`;`p`] +THEN DICH_TAC(20-7) +THEN ASM_REWRITE_TAC[scs_is_str] +THEN STRIP_TAC; + + +MRESAL_TAC MMS_IMP_BBPRIME[`s`;`v`][LET_DEF;LET_END_DEF;BBprime_v39] +THEN MRESAL_TAC JKQEWGV2[`s`;`v`][LET_DEF;LET_END_DEF;scs_generic] +THEN MP_TAC Wrgcvdr_cizmrrh.CIZMRRH +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_EXISTS_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN`(!V' E' v1. V' = V /\ E' = E ==> ~lunar (v1,(v:num->real^3) (p)) V' E')` ASSUME_TAC; + + + + +REPEAT RESA_TAC +; + + + +MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`(p+3)+1`;`p`][ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN DICH_TAC 0 +THEN REWRITE_TAC[ARITH_RULE`1 * 4 + p=(p+3)+1`] +THEN STRIP_TAC +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`(p+3)+2`;`p+1`][ARITH_RULE`(p+3)+2=1*4+p+1`;MOD_MULT_ADD] +THEN DICH_TAC 0 +THEN REWRITE_TAC[ARITH_RULE`1 * 4 + p+1=(p+3)+2`] +THEN STRIP_TAC +THEN MRESA_TAC Local_lemmas1.AZIM_COND_FOR_COPLANAR[`vec 0:real^3`;`v p`;`v (p+1)`;`(v:num->real^3) (p+3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_V[`p`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+1`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+2`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+3`;`v:num->real^3`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v (p+1)`;`v (p+3)`;`V`] +THEN SUBGOAL_THEN`(!j. ~(v j = v (p + 3)) ==> ~collinear {vec 0, (v:num->real^3) (p + 3), v j})`ASSUME_TAC +; + + +REPEAT RESA_TAC +THEN DICH_TAC 0 +THEN REWRITE_TAC[] +THEN MATCH_DICH_TAC 1 +THEN ASM_SIMP_TAC[] +THEN MRESA_TAC WL_IN_V[`j`;`v:num->real^3`] +THEN SET_TAC[]; + + + +MRESAL_TAC Iunbuig.coplanar_aff_gt_simple[`s`;`4`;`v`;`p+3`][ARITH_RULE`0+2=2`] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 3[`v (p+1)`;`v(p+3)`][SET_RULE`a IN {a,b}`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(1 MOD 4 = 3 MOD 4)`] +THEN MP_TAC CONDTION_A_LT_B +THEN RESA_TAC; + + + +MRESAS_TAC NUXCOEAv2[`s`;`4`;`v`;`p`;`p+1`][MOD_MULT_ADD;BASIC_IMP_NOT_J] +THEN DICH_TAC 0 +THEN MRESA_TAC SCS_A_SYM[`s`;`p`;`p+1`] +THEN MRESA_TAC SCS_B_SYM[`s`;`p`;`p+1`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN THAYTHE_TAC 2[`p`] +THEN RESA_TAC; + +ASSUME_TAC(ARITH_RULE`(p+3)+1=1*4+p/\ (p+1)+1=p+2/\ (p+2)+1=p+3`) +THEN MRESAS_TAC CHANGE_A_SCS_MOD[`(p+3)`;`(1 * 4 + p)`;`s`;`p+3`;`p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`1*4+p`;`p`][MOD_MULT_ADD] +THEN MP_TAC Jlxfdmj.SCS_A_2 +THEN RESA_TAC +THEN THAYTHE_TAC 0[`p+3`] +THEN MP_TAC(REAL_ARITH`&2 <= scs_a_v39 s (p + 3) p +==> scs_a_v39 s (p+3) p = &2\/ &2 < scs_a_v39 s (p + 3) p`) +THEN RESA_TAC; + + +MP_TAC PWEIWBZ +THEN RESA_TAC +THEN THAYTHE_TAC 0[`s`;`v`;`p+3`] +THEN MRESA_TAC SCS_A_SYM[`s`;`p+3`;`p`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN DICH_TAC(26-7) +THEN ASM_REWRITE_TAC[scs_is_str] +THEN STRIP_TAC; + + +MRESAL_TAC MMS_IMP_BBPRIME[`s`;`v`][LET_DEF;LET_END_DEF;BBprime_v39] +THEN MRESAL_TAC JKQEWGV2[`s`;`v`][LET_DEF;LET_END_DEF;scs_generic] +THEN MP_TAC Wrgcvdr_cizmrrh.CIZMRRH +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_EXISTS_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN`(!V' E' v1. V' = V /\ E' = E ==> ~lunar (v1,(v:num->real^3) (p)) V' E')` ASSUME_TAC; + + + + +REPEAT RESA_TAC +; + + + +MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`(p+3)+2`;`p+1`][ARITH_RULE`(p+3)+2=1*4+p+1`;MOD_MULT_ADD] +THEN DICH_TAC 0 +THEN REWRITE_TAC[ARITH_RULE`1 * 4 + p+1=(p+3)+2`] +THEN STRIP_TAC +THEN MRESA_TAC Local_lemmas1.AZIM_COND_FOR_COPLANAR[`vec 0:real^3`;`v p`;`v (p+1)`;`(v:num->real^3) (p+3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_V[`p`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+1`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+2`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+3`;`v:num->real^3`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v (p+1)`;`v (p+3)`;`V`] +THEN SUBGOAL_THEN`(!j. ~(v j = v (p + 3)) ==> ~collinear {vec 0, (v:num->real^3) (p + 3), v j})`ASSUME_TAC +; + + +REPEAT RESA_TAC +THEN DICH_TAC 0 +THEN REWRITE_TAC[] +THEN MATCH_DICH_TAC 1 +THEN ASM_SIMP_TAC[] +THEN MRESA_TAC WL_IN_V[`j`;`v:num->real^3`] +THEN SET_TAC[]; + + + +MRESAL_TAC Iunbuig.coplanar_aff_gt_simple[`s`;`4`;`v`;`p+3`][ARITH_RULE`0+2=2`] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 3[`v (p+1)`;`v(p+3)`][SET_RULE`a IN {a,b}`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(1 MOD 4 = 3 MOD 4)`] +THEN MP_TAC CONDTION_A_LT_B +THEN RESA_TAC; + + + +MRESAS_TAC NUXCOEAv2[`s`;`4`;`v`;`p`;`p+3`][MOD_MULT_ADD;BASIC_IMP_NOT_J] +THEN DICH_TAC 0 +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+3)`;`(1 * 4 + p)`;`s`;`p+3`;`p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN THAYTHE_TAC 1[`p+3`] +THEN RESA_TAC; + + +MP_TAC(REAL_ARITH`&2 < scs_a_v39 s p (p + 1) +/\ &2 < scs_a_v39 s (p + 3) p +==> ~(scs_a_v39 s (p + 3) p = &2)/\ ~(scs_a_v39 s p (p + 1)= &2)`) +THEN RESA_TAC +THEN MP_TAC A_NOT_EQ2_IMP_B +THEN RESA_TAC +THEN MRESAS_TAC CHANGE_B_SCS_MOD[`(p+3)`;`(1 * 4 + p)`;`s`;`p+3`;`p`][MOD_REFL;Yxionxl2.MOD_SUC_MOD;ARITH_RULE`(p+3)+1=1*4+p`;MOD_MULT_ADD] +THEN MRESA_TAC A_NOT_EQ2_IMP_B[`s`;`p+3`] +THEN MRESA_TAC PRO_ADD_NOT_IN_SCS_M[`p`;`4`;`s`] +THEN MRESA_TAC PRO_ADD_NOT_IN_SCS_M[`p+3`;`4`;`s`] +THEN MRESAL_TAC B_LE_2h0_2_SCS_M_4[`s`;`p`][SET_RULE`{a,b} SUBSET A<=> a IN A/\ b IN A`] +THEN MRESA_TAC B_LE_2h0_IMP_B[`s`;`p+1`] +THEN MRESA_TAC B_LE_2h0_IMP_B[`s`;`p+2`] +THEN MRESAL_TAC NOT_STR_IN_CASES_4[`p`;`s`;`v`][IN] +THEN MP_TAC YEBWJNG +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p+1`][IN] +THEN MP_TAC YEBWJNG +THEN RESA_TAC +THEN THAYTHEL_TAC 0[`s`;`v`;`p+2`][IN] +THEN DICH_TAC (44-13) +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;BBs_v39] +THEN RESA_TAC +THEN MRESA_TAC MMS_IMP_BBS[`s`;`v`] +THEN THAYTHEL_ASM_TAC 1[`p`;`p+1`][] +THEN THAYTHE_TAC 0[`p+3`;`p`]; + + + +MP_TAC(SET_RULE`~(&2=norm ((v:num->real^3) p))\/ norm (v p)= &2`) +THEN RESA_TAC +; + + + + +DICH_TAC(51-7) +THEN ASM_REWRITE_TAC[scs_is_str] +THEN STRIP_TAC; + + +MRESAL_TAC MMS_IMP_BBPRIME[`s`;`v`][LET_DEF;LET_END_DEF;BBprime_v39] +THEN MRESAL_TAC JKQEWGV2[`s`;`v`][LET_DEF;LET_END_DEF;scs_generic] +THEN MP_TAC Wrgcvdr_cizmrrh.CIZMRRH +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_EXISTS_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN`(!V' E' v1. V' = V /\ E' = E ==> ~lunar (v1,(v:num->real^3) (p)) V' E')` ASSUME_TAC; + + + + +REPEAT RESA_TAC +; + + + +MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`(p+3)+2`;`p+1`][ARITH_RULE`(p+3)+2=1*4+p+1`;MOD_MULT_ADD] +THEN DICH_TAC 0 +THEN REWRITE_TAC[ARITH_RULE`1 * 4 + p+1=(p+3)+2`] +THEN STRIP_TAC +THEN MRESA_TAC Local_lemmas1.AZIM_COND_FOR_COPLANAR[`vec 0:real^3`;`v p`;`v (p+1)`;`(v:num->real^3) (p+3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_V[`p`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+1`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+2`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+3`;`v:num->real^3`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v (p+1)`;`v (p+3)`;`V`] +THEN SUBGOAL_THEN`(!j. ~(v j = v (p + 3)) ==> ~collinear {vec 0, (v:num->real^3) (p + 3), v j})`ASSUME_TAC +; + + +REPEAT RESA_TAC +THEN DICH_TAC 0 +THEN REWRITE_TAC[] +THEN MATCH_DICH_TAC 1 +THEN ASM_SIMP_TAC[] +THEN MRESA_TAC WL_IN_V[`j`;`v:num->real^3`] +THEN SET_TAC[]; + + + +MRESAL_TAC Iunbuig.coplanar_aff_gt_simple[`s`;`4`;`v`;`p+3`][ARITH_RULE`0+2=2`] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN STRIP_TAC +THEN MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 3[`v (p+1)`;`v(p+3)`][SET_RULE`a IN {a,b}`;Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`~(1 MOD 4 = 3 MOD 4)`] +THEN MP_TAC CONDTION_A_LT_B +THEN RESA_TAC; + + + +MRESAS_TAC IMJXPHRv2[`s`;`4`;`v`;`p`;][MOD_MULT_ADD;BASIC_IMP_NOT_J] +; + + + +MRESAS_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`p`][Ckqowsa_3_points.in_ball_annulus;dist] +THEN MRESAS_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`p+1`][Ckqowsa_3_points.in_ball_annulus;dist] +THEN MRESAS_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`p+2`][Ckqowsa_3_points.in_ball_annulus;dist] +THEN MRESAS_TAC WL_IN_BALL_ANNULUS[`s`;`v`;`p+3`][Ckqowsa_3_points.in_ball_annulus;dist] +THEN MRESAL_TAC Trigonometry1.arcVarc[`vec 0:real^3`;`v p`;`v (p+3)`][dist;VECTOR_ARITH`vec 0- A= --A`; NORM_NEG] +THEN MRESAL_TAC Trigonometry1.arcVarc[`vec 0:real^3`;`v (p+1)`;`v (p)`][dist;VECTOR_ARITH`vec 0- A= --A`; NORM_NEG] +THEN MRESAL_TAC Trigonometry1.arcVarc[`vec 0:real^3`;`v (p+1)`;`v (p+2)`][dist;VECTOR_ARITH`vec 0- A= --A`; NORM_NEG] +THEN MRESAL_TAC Trigonometry1.arcVarc[`vec 0:real^3`;`v (p+2)`;`v (p+3)`][dist;VECTOR_ARITH`vec 0- A= --A`; NORM_NEG] +THEN MRESA_TAC Trigonometry.KEITDWB[`vec 0:real^3`;`v (p+1)`;`v (p+3)`;`v (p+2)`]; + + + + +DICH_TAC(68-7) +THEN ASM_REWRITE_TAC[scs_is_str] +THEN STRIP_TAC; + + + + +MRESA_TAC BB_VV_FUN_EQ[`v`;`s`] +THEN THAYTHES_TAC 0[`(p+3)+2`;`p+1`][ARITH_RULE`(p+3)+2=1*4+p+1`;MOD_MULT_ADD] +THEN DICH_TAC 0 +THEN REWRITE_TAC[ARITH_RULE`1 * 4 + p+1=(p+3)+2`] +THEN STRIP_TAC +THEN MRESA_TAC Local_lemmas1.AZIM_COND_FOR_COPLANAR[`vec 0:real^3`;`v p`;`v (p+1)`;`(v:num->real^3) (p+3)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] +THEN STRIP_TAC +THEN MRESA_TAC WL_IN_V[`p`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+1`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+2`;`v:num->real^3`] +THEN MRESA_TAC WL_IN_V[`p+3`;`v:num->real^3`] +THEN MRESA_TAC Nkezbfc_local.PROPERTIES_GENERIC[`FF`;`E`;`v (p+1)`;`v (p+3)`;`V`] +THEN SUBGOAL_THEN`(!j. ~(v j = v (p + 3)) ==> ~collinear {vec 0, (v:num->real^3) (p + 3), v j})`ASSUME_TAC +; + + +REPEAT RESA_TAC +THEN DICH_TAC 0 +THEN REWRITE_TAC[] +THEN MATCH_DICH_TAC 1 +THEN ASM_SIMP_TAC[] +THEN MRESA_TAC WL_IN_V[`j`;`v:num->real^3`] +THEN SET_TAC[]; + + + +MRESAL_TAC Iunbuig.coplanar_aff_gt_simple[`s`;`4`;`v`;`p+3`][ARITH_RULE`0+2=2`] +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`v p IN aff_gt {vec 0} {v (p + 1), v (p + 3)} +/\ aff_gt {vec 0} {v (p + 1), v (p + 3)} SUBSET aff_ge {vec 0} {v (p + 1), v (p + 3)} +==> (v:num->real^3) p IN aff_ge {vec 0} {v (p + 1), v (p + 3)}`) +THEN ASM_SIMP_TAC[AFF_GT_SUBSET_AFF_GE] +THEN RESA_TAC +THEN MRESA_TAC Iunbuig.ARCV_ADD_AFF_GE[`vec 0:real^3`;`v (p+1)`;`v (p+3)`;`v (p)`] +THEN DICH_TAC(79-67) +THEN SYM_ASSUM_TAC +THEN REWRITE_TAC[GSYM dist] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASSUME_TAC(h0_CSTAB_LT_4) +THEN MP_TAC(REAL_ARITH` norm ((v:num->real^3) (p + 1)) <= &2 * h0 /\ &2<= norm (v (p + 1))/\ +norm ((v:num->real^3) (p + 3)) <= &2 * h0 /\ &2<= norm (v (p + 3))/\ +norm ((v:num->real^3) (p + 2)) <= &2 * h0 /\ &2<= norm (v (p + 2))/\ +cstab< &4/\ &2 * h0< &4 /\ &2< &2 *h0 +/\ dist (v p,v (p + 1)) <= cstab +/\ &2* h0<= dist (v p,v (p + 1)) +/\ dist (v p,v (p + 3)) <= cstab +/\ &2* h0<= dist (v p,v (p + 3)) +==> norm (v (p + 1)) < &4 /\ &0< norm (v (p + 1))/\ +norm (v (p + 3)) < &4 /\ &0< norm (v (p + 3))/\ +norm (v (p + 2)) < &4 /\ &0< norm (v (p + 2))/\ + dist (v p,v (p + 1))< &4/\ &2<= dist (v p,v (p + 1))/\ &0< dist (v p,v (p + 1))/\ + dist (v p,v (p + 3))< &4/\ &2<= dist (v p,v (p + 3))/\ &0< dist (v p,v (p + 3))/\ + &2< dist (v p,v (p + 1))/\ + &2< dist (v p,v (p + 3))/\ + &0< &2 +`) +THEN RESA_TAC +THEN DICH_TAC 0 +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN RESA_TAC +THEN MRESAS_TAC Oxlzlez.DIST_IMP_UPS_X_POS[`vec 0:real^3`;`v (p)`;`v (p+1)`][] +THEN DICH_TAC 0 +THEN ASM_SIMP_TAC[dist;VECTOR_ARITH`vec 0- A= -- A`; NORM_NEG;REAL_ARITH`a<=b/\ b a a a areal^3) (p + 1))) (&2) < + xrr (&2) (norm (v (p + 1))) (dist (v p,v (p + 1)))/\ +xrr (&2) (norm (v (p + 3))) (&2) < + xrr (&2) (norm (v (p + 3))) (dist (v (p + 3),v p))/\ +xrr (norm (v (p + 1))) (norm (v (p + 2))) (&2) <= + xrr (&2) (norm (v (p + 1))) (&2)/\ +xrr (norm (v (p + 2))) (norm (v (p + 3))) (&2) <= + xrr (&2) (norm (v (p + 3))) (&2)/\ +&0 < xrr (&2) (norm (v (p + 1))) (dist (v p,v (p + 1)))/\ +xrr (&2) (norm (v (p + 1))) (dist (v p,v (p + 1))) < &16/\ +&0 < xrr (&2) (norm (v (p + 3))) (dist (v (p + 3),v p))/\ +xrr (&2) (norm (v (p + 3))) (dist (v (p + 3),v p)) < &16/\ +&0 < xrr (norm (v (p + 1))) (norm (v (p + 2))) (&2)/\ +xrr (norm (v (p + 1))) (norm (v (p + 2))) (&2) < &16/\ +&0 < xrr (norm (v (p + 2))) (norm (v (p + 3))) (&2)/\ +xrr (norm (v (p + 2))) (norm (v (p + 3))) (&2) < &16 +==> xrr (&2) (norm (v (p + 1))) (dist (v p,v (p + 1))) <= &16 /\ + &0 <= xrr (&2) (norm (v (p + 1))) (&2)/\ +xrr (&2) (norm (v (p + 3))) (dist (v (p + 3),v p)) <= &16 /\ + &0 <= xrr (&2) (norm (v (p + 3))) (&2)/\ +xrr (&2) (norm (v (p + 1))) (&2) <= &16 /\ + &0 <= xrr (norm (v (p + 1))) (norm (v (p + 2))) (&2)/\ +xrr (&2) (norm (v (p + 3))) (&2) <= &16 /\ + &0 <= xrr (norm (v (p + 2))) (norm (v (p + 3))) (&2) +`) +THEN RESA_TAC +THEN MRESAL_TAC ACS_MONO_LT[`&1 - xrr (&2) (norm (v (p + 1))) (dist (v p,v (p + 1))) / &8`;`&1 - xrr (&2) (norm (v (p + 1))) (&2) / &8`] +[REAL_ARITH`&1- a/ &8< &1- b/ &8 <=> b &0<=a`; +REAL_ARITH`(-- &1) <= &1- a/ &8<=> a<= &16`] +THEN MRESAL_TAC ACS_MONO_LT[`&1 - xrr (&2) (norm (v (p + 3))) (dist (v (p+3),v (p ))) / &8`;`&1 - xrr (&2) (norm (v (p + 3))) (&2) / &8`] +[REAL_ARITH`&1- a/ &8< &1- b/ &8 <=> b &0<=a`; +REAL_ARITH`(-- &1) <= &1- a/ &8<=> a<= &16`] +THEN MRESAL_TAC ACS_MONO_LE[`&1 - xrr (&2) (norm (v (p + 1))) (&2) / &8`;`&1 - xrr (norm (v (p + 1))) (norm (v (p + 2))) (&2) / &8`] +[REAL_ARITH`&1- a/ &8<= &1- b/ &8 <=> b<=a`;REAL_ARITH`&1- a/ &8<= &1<=> &0<=a`; +REAL_ARITH`(-- &1) <= &1- a/ &8<=> a<= &16`] +THEN MRESAL_TAC ACS_MONO_LE[`&1 - xrr (&2) (norm (v (p + 3))) (&2) / &8`;`&1 - xrr (norm (v (p + 2))) (norm (v (p + 3))) (&2) / &8`] +[REAL_ARITH`&1- a/ &8<= &1- b/ &8 <=> b<=a`;REAL_ARITH`&1- a/ &8<= &1<=> &0<=a`; +REAL_ARITH`(-- &1) <= &1- a/ &8<=> a<= &16`] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN REAL_ARITH_TAC; + +]);; + + + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/VPWSHTO.hl b/text_formalization/local/VPWSHTO.hl new file mode 100644 index 0000000..11acf26 --- /dev/null +++ b/text_formalization/local/VPWSHTO.hl @@ -0,0 +1,2969 @@ + +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + + + +module Vpwshto = struct + + +open Sphere;; +open Prove_by_refinement;; +open Collect_geom;; +open Fan_defs;; +open Hypermap;; +open Vol1;; +open Fan;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Pack_defs;; + + +let NORM_COS_ANGLE_LE=prove(`!v u w w1:real^3. +norm(v-w)=norm(v-w1) +/\ ~(v=u) /\ ~(v=w)/\ ~(v=w1) +==> (norm (u-w)<= norm(u-w1)<=> cos(angle(u,v,w1))<= cos(angle(u,v,w)))`, +REPEAT STRIP_TAC +THEN MRESAL_TAC LAW_OF_COSINES[`v:real^3`;`u:real^3`;`w:real^3`][dist] +THEN MRESAL_TAC LAW_OF_COSINES[`v:real^3`;`u:real^3`;`w1:real^3`][dist] +THEN MRESAL_TAC Trigonometry2.POW2_COND[`norm(u-w:real^3)`;`norm(u-w1:real^3)`][NORM_POS_LE;REAL_ARITH`(a+b)- &2 * c<= (a+b)- &2 * c1<=> c1<= c`] +THEN MRESA_TAC Planarity.IMP_NORM_FAN[`v:real^3`;`u:real^3`] +THEN MRESA_TAC Planarity.IMP_NORM_FAN[`v:real^3`;`w1:real^3`] +THEN MRESA_TAC REAL_LE_LMUL_EQ[`cos (angle (u,v,w1:real^3))`;` cos (angle (u,v,w:real^3))`;`norm(v-w1:real^3)`] +THEN MRESA_TAC REAL_LE_LMUL_EQ[`norm(v-w1:real^3) *cos (angle (u,v,w1:real^3))`;` norm(v-w1:real^3)* cos (angle (u,v,w:real^3))`;`norm(v-u:real^3)`]);; + + + + +let NORM_COS_ANGLE_LT=prove(`!v v1 u:real^3 u1 w w1:real^3. +norm(v-w)=norm(v1-w1) +/\ norm(v-u)=norm(v1-u1) +/\ ~(v=u) /\ ~(v=w)/\ ~(v1=w1) +==> (norm (u-w)< norm(u1-w1)<=> (angle(u,v,w)) < (angle(u1,v1,w1)))`, +REPEAT STRIP_TAC +THEN MRESAL_TAC LAW_OF_COSINES[`v:real^3`;`u:real^3`;`w:real^3`][dist] +THEN MRESAL_TAC LAW_OF_COSINES[`v1:real^3`;`u1:real^3`;`w1:real^3`][dist] +THEN ONCE_REWRITE_TAC[GSYM REAL_ABS_NORM] +THEN ONCE_REWRITE_TAC[REAL_LT_SQUARE_ABS] +THEN ASM_REWRITE_TAC[NORM_POS_LE;REAL_ARITH`(a+b)- &2 * c< (a+b)- &2 * c1<=> c1< c`;] +THEN MRESA_TAC Planarity.IMP_NORM_FAN[`v:real^3`;`u:real^3`] +THEN MRESA_TAC Planarity.IMP_NORM_FAN[`v1:real^3`;`w1:real^3`] +THEN MRESA_TAC REAL_LT_LMUL_EQ[`cos (angle (u1,v1,w1:real^3))`;` cos (angle (u,v,w:real^3))`;`norm(v1-w1:real^3)`] +THEN MRESA_TAC REAL_LT_LMUL_EQ[`norm(v1-w1:real^3) *cos (angle (u1,v1,w1:real^3))`;` norm(v1-w1:real^3)* cos (angle (u,v,w:real^3))`;`norm(v1-u1:real^3)`] +THEN MATCH_MP_TAC COS_MONO_LT_EQ +THEN REWRITE_TAC [ANGLE_RANGE]);; + + +let NORM_COS_ANGLE_4POINT=prove(`!v u w w1:real^3. +norm(v-w)=norm(u-w1) +/\ ~(v=u) /\ ~(v=w)/\ ~(u=w1) +==> (norm (u-w)= norm(v-w1)<=> cos(angle(v,u,w1))= cos(angle(u,v,w)))`, +REPEAT STRIP_TAC +THEN MRESAL_TAC LAW_OF_COSINES[`v:real^3`;`u:real^3`;`w:real^3`][dist] +THEN MRESAL_TAC LAW_OF_COSINES[`u:real^3`;`v:real^3`;`w1:real^3`][dist] +THEN MRESAL_TAC DIST_EQ[`u:real^3`;`w:real^3`;`v:real^3`;`w1:real^3`][dist;REAL_ARITH`(a+b)- &2 * c= (a1+b)- &2 * c1<=> a1- &2 *c1= a- &2 *c`] +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[NORM_SUB] +THEN REWRITE_TAC[REAL_ARITH`a- &2 *c1= a- &2 *c<=> c1= c`] +THEN MRESA_TAC Planarity.IMP_NORM_FAN[`v:real^3`;`u:real^3`] +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`u:real^3`;`w1:real^3`][REAL_EQ_MUL_LCANCEL] +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[NORM_SUB] +THEN ASM_REWRITE_TAC[REAL_EQ_MUL_LCANCEL]);; + + + + + + +let MAX_COPLANAR_4POINT=prove(`!v x:real^3 u w w1:real^3. +~(v=x)/\ ~(v=u) /\ ~(v=w) /\ ~(x=u)/\ ~(x=w) /\ ~(u=w) +/\ ~(v=w1) /\ ~(x=w1) /\ ~(u=w1) +/\ norm(v-x)=t +/\ norm(v-u)=a +/\ norm(x-w)=a +/\ norm(u-w)=a +/\ y IN segment(v,w) INTER segment (x,u) +/\ norm(x-w1)=a +/\ norm(u-w1)=a +==> min (norm(v-w1)) (norm (x-u)) <= min (norm(v-w)) (norm (x-u))`, +REPEAT STRIP_TAC +THEN SUBGOAL_THEN`norm(y-w1)= norm(y-w:real^3)` ASSUME_TAC +THENL[ +MRESAL_TAC DIST_EQ[`y:real^3`;`w1:real^3`;`y:real^3`;`w:real^3`][dist;] +THEN MRESAL_TAC LAW_OF_COSINES[`x:real^3`;`y:real^3`;`w:real^3`][dist] +THEN MRESAL_TAC LAW_OF_COSINES[`x:real^3`;`y:real^3`;`w1:real^3`][dist] +THEN REWRITE_TAC[REAL_ARITH`a- &2 *c1= a- &2 *c<=> c1= c`] +THEN MP_TAC(SET_RULE`y IN segment(v,w) INTER segment (x,u) +==> y IN segment(v,w) +/\ y IN segment (x,u:real^3)`) +THEN ASM_REWRITE_TAC[IN_OPEN_SEGMENT] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC [IN_SEGMENT] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> + STRIP_TAC THEN STRIP_TAC +THEN MRESA_TAC Planarity.IMP_NORM_FAN[`v:real^3`;`u:real^3`] +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`x:real^3`;`y:real^3`][REAL_EQ_MUL_LCANCEL] +THEN MRESA_TAC ANGLE_EQ[`y:real^3`;`x:real^3`;`w:real^3`;`u:real^3`;`x:real^3`;`w:real^3`] +THEN MRESA_TAC ANGLE_EQ[`y:real^3`;`x:real^3`;`w1:real^3`;`u:real^3`;`x:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA1_TAC REAL_ABS_REFL`u':real` +THEN ASM_REWRITE_TAC[th;VECTOR_ARITH`((&1 - u') % x + u' % u) - x=u' %(u-x)`;DOT_LMUL;NORM_MUL;REAL_ARITH`((u - x) dot (w - x)) * (u' * norm (u - x)) * norm (w - x) = + (u' * ((u - x) dot (w - x))) * norm (u - x) * norm (w - x)`]) +THEN RESA_TAC +THEN RESA_TAC +THEN MRESAL_TAC CONGRUENT_TRIANGLES_SSS[`u:real^3`;`x:real^3`;`w:real^3`;`u:real^3`;`x:real^3`;`w1:real^3`][dist] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN RESA_TAC; +MP_TAC(SET_RULE`y IN segment(v,w) INTER segment (x,u) +==> y IN segment(v,w:real^3)`) +THEN ASM_REWRITE_TAC[IN_OPEN_SEGMENT] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC [IN_SEGMENT] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> +MRESAL_TAC NORM_TRIANGLE[`v-y:real^3`;`y-w1:real^3`][VECTOR_ARITH`A-B+B-C=A-C:real^3`] +THEN POP_ASSUM MP_TAC +THEN MRESA1_TAC REAL_ABS_REFL`u':real` +THEN MRESAL1_TAC REAL_ABS_REFL`&1-u':real`[REAL_ARITH`&0<= &1- u<=> u<= &1`] +THEN ASM_REWRITE_TAC[th;VECTOR_ARITH`v - ((&1 - u') % v + u' % w)=u' %(v-w) +/\ ((&1 - u') % v + u' % w) - w= (&1- u') %(v-w)`;NORM_MUL; REAL_ARITH`u' * norm (v - w) + (&1 - u') * norm (v - w)=norm (v - w)`]) +THEN REAL_ARITH_TAC]);; + + +let SUM_4ANGLE_4POINT_EQ_2PI=prove(`!v x:real^3 u w:real^3 y. +~(v=x)/\ ~(v=u) /\ ~(v=w) /\ ~(x=u)/\ ~(x=w) /\ ~(u=w) +/\ y IN segment(v,w) INTER segment (x,u) +==> angle(x,v,u) + angle(v,u,w)+ angle(u,w,x)+angle(w,x,v)= &2 *pi`, +REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`y IN segment(v,w) INTER segment (x,u) +==> y IN segment(v,w:real^3)`) +THEN ASM_REWRITE_TAC[IN_OPEN_SEGMENT] +THEN STRIP_TAC +THEN MRESAL_TAC ANGLES_ADD_BETWEEN[`v:real^3`;`w:real^3`;`y:real^3`;`u:real^3`][BETWEEN_IN_SEGMENT] +THEN MRESAL_TAC ANGLES_ADD_BETWEEN[`v:real^3`;`w:real^3`;`y:real^3`;`x:real^3`][BETWEEN_IN_SEGMENT] +THEN ONCE_REWRITE_TAC[ANGLE_SYM] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ONCE_REWRITE_TAC[ANGLE_SYM] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC(SET_RULE`y IN segment(v,w) INTER segment (x,u) +==> y IN segment (x,u:real^3)`) +THEN ASM_REWRITE_TAC[IN_OPEN_SEGMENT] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC [IN_SEGMENT] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> +REPEAT STRIP_TAC +THEN MRESA_TAC Planarity.IMP_NORM_FAN[`v:real^3`;`u:real^3`] +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`x:real^3`;`y:real^3`][REAL_EQ_MUL_LCANCEL] +THEN MRESA_TAC ANGLE_EQ[`w:real^3`;`x:real^3`;`y:real^3`;`w:real^3`;`x:real^3`;`u:real^3`] +THEN MRESA_TAC ANGLE_EQ[`y:real^3`;`x:real^3`;`v:real^3`;`u:real^3`;`x:real^3`;`v:real^3`] +THEN MRESA_TAC ANGLE_EQ[`v:real^3`;`u:real^3`;`y:real^3`;`v:real^3`;`u:real^3`;`x:real^3`] +THEN MRESA_TAC ANGLE_EQ[`y:real^3`;`u:real^3`;`w:real^3`;`x:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA1_TAC REAL_ABS_REFL`u':real` +THEN MRESAL1_TAC REAL_ABS_REFL`&1-u':real`[REAL_ARITH`&0<= &1- u<=> u<= &1`] +THEN ASM_REWRITE_TAC[th;VECTOR_ARITH`((&1 - u') % x + u' % u) - u= (&1- u') % (x-u)/\ ((&1 - u') % x + u' % u) - x= u' %(u-x)`;NORM_MUL;DOT_LMUL;DOT_RMUL;REAL_ARITH`a*(b*c)*d= (b*a) *c*d/\ a*c *b*d= (b*a) *c*d`]) +THEN RESA_TAC +THEN RESA_TAC +THEN RESA_TAC +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ARITH`angle (x,v,u) + + (angle (v,u,x) + angle (x,u,w)) + + angle (u,w,x) + + angle (u,x,v) + + angle (w,x,u) += (angle (x,v,u) + angle (u,x,v) + + angle (v,u,x) )+ (angle (w,x,u) + + angle (u,w,x) +angle (x,u,w) )`] +THEN MRESA_TAC TRIANGLE_ANGLE_SUM[`v:real^3`;`x:real^3`;`u:real^3`] +THEN MRESA_TAC TRIANGLE_ANGLE_SUM[`x:real^3`;`w:real^3`;`u:real^3`] +THEN MRESA_TAC ANGLE_SYM[`u:real^3`;`x:real^3`;`v:real^3`] +THEN MRESA_TAC ANGLE_SYM[`v:real^3`;`u:real^3`;`x:real^3`] +THEN MRESA_TAC ANGLE_SYM[`u:real^3`;`w:real^3`;`x:real^3`] +THEN MRESA_TAC ANGLE_SYM[`x:real^3`;`u:real^3`;`w:real^3`] +THEN REAL_ARITH_TAC);; + + +let EQ_DIAGONAL_MIN=prove(`!v v1 x:real^3 x1 u w u1 w1:real^3. +~(v=x)/\ ~(v=u) /\ ~(v=w) /\ ~(x=u)/\ ~(x=w) /\ ~(u=w) +/\ ~(v1=x1)/\ ~(v1=u1) /\ ~(v1=w1) /\ ~(x1=u1)/\ ~(x1=w1) /\ ~(u1=w1) +/\ norm(v-x)=t +/\ norm(v-u)=a +/\ norm(x-w)=a +/\ norm(u-w)=a +/\ y IN segment(v,w) INTER segment (x,u) +/\ norm(v-w)=norm(x-u) +/\ norm(v1-x1)=t +/\ norm(v1-u1)=a +/\ norm(x1-w1)=a +/\ norm(u1-w1)=a +/\ y1 IN segment(v1,w1) INTER segment (x1,u1) +==> min (norm(v1-w1)) (norm (x1-u1)) <= norm (x-u)`, +REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`norm (x-u:real^3)< min (norm(v1-w1:real^3)) (norm (x1-u1:real^3)) \/ min (norm(v1-w1)) (norm (x1-u1)) <= norm (x-u)`) +THENL[ +MP_TAC (REAL_ARITH`norm (v - w:real^3) = norm (x - u:real^3) +/\ norm (x-u) < min (norm(v1-w1)) (norm (x1-u1)) +==> norm (x - u:real^3) < norm (x1 - u1:real^3)/\ norm (v - w:real^3) < norm (v1 - w1:real^3)`) +THEN RESA_TAC +THEN MRESA_TAC NORM_COS_ANGLE_LT[`x:real^3`;`x1:real^3`;`v:real^3`;`v1:real^3`;`w:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN RESA_TAC +THEN MRESA_TAC NORM_COS_ANGLE_LT[`u:real^3`;`u1:real^3`;`v:real^3`;`v1:real^3`;`w:real^3`;`w1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN RESA_TAC +THEN MRESA_TAC NORM_COS_ANGLE_LT[`v:real^3`;`v1:real^3`;`u:real^3`;`u1:real^3`;`x:real^3`;`x1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN RESA_TAC +THEN MRESA_TAC NORM_COS_ANGLE_LT[`w:real^3`;`w1:real^3`;`u:real^3`;`u1:real^3`;`x:real^3`;`x1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`angle (v,x,w) < angle (v1,x1,w1) +/\ angle (v,u,w) < angle (v1,u1,w1)/\ +angle (u,v,x) < angle (u1,v1,x1) /\angle (u,w,x) < angle (u1,w1,x1) +==> angle (u,v,x:real^3) +angle (v,u,w) + angle (u,w,x) + angle (v,x,w) +< angle (u1,v1,x1:real^3) +angle (v1,u1,w1) + angle (u1,w1,x1) + angle (v1,x1,w1)`) +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC SUM_4ANGLE_4POINT_EQ_2PI[`v:real^3`;`x:real^3`;`u:real^3`;`w:real^3`;`y:real^3`] +THEN MRESA_TAC SUM_4ANGLE_4POINT_EQ_2PI[`v1:real^3`;`x1:real^3`;`u1:real^3`;`w1:real^3`;`y1:real^3`] +THEN MRESA_TAC ANGLE_SYM[`u:real^3`;`v:real^3`;`x:real^3`] +THEN MRESA_TAC ANGLE_SYM[`u1:real^3`;`v1:real^3`;`x1:real^3`] +THEN MRESA_TAC ANGLE_SYM[`v:real^3`;`x:real^3`;`w:real^3`] +THEN MRESA_TAC ANGLE_SYM[`v1:real^3`;`x1:real^3`;`w1:real^3`] +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[]]);; + + + + + +let TWO_DIAGONAL_AT_MOST=prove_by_refinement(` &2 <=t /\ t<= &4 +==> +?u w:real^3 v x y. +~(v=x)/\ ~(v=u) /\ ~(v=w) /\ ~(x=u)/\ ~(x=w) /\ ~(u=w) +/\ norm(v-x)=t +/\ norm(v-u)= &2 +/\ norm(x-w)= &2 +/\ norm(u-w)= &2 +/\ y IN segment(v,w) INTER segment (x,u) +/\ norm(v-w)= norm(x-u) +/\ (t<= norm(v-w) ==> norm(v-w)<= &1 + sqrt( &5) /\ t<= &1 + sqrt( &5))`, +[REPEAT STRIP_TAC +THEN ABBREV_TAC`b=(&1- t/ &2)` +THEN ABBREV_TAC`c=(&1+ t/ &2)` +THEN ABBREV_TAC`d=(sqrt(&4- (t/ &2- &1) pow 2))` +THEN ABBREV_TAC`e= &2* inv(t+ &2) * d` +THEN SUBGOAL_THEN`&0<= &4- (t/ &2- &1) pow 2` ASSUME_TAC; +REWRITE_TAC[REAL_ARITH`&0<= A- B<=> B<=A`] +THEN MATCH_MP_TAC REAL_RSQRT_LE +THEN MRESAL_TAC SQRT_UNIQUE[`&4`;`&2`][REAL_ARITH`&0<= &2 /\ &2 pow 2= &4`] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0 <= t / &2 - &1 <=> &2<= t`; REAL_ARITH`t / &2 - &1 <= &2 <=> t<= &6`; REAL_ARITH`&0 <= &4`] +THEN MP_TAC(REAL_ARITH`t<= &4==> t <= &6`) +THEN RESA_TAC; +SUBGOAL_THEN`~(&4- (t/ &2- &1) pow 2= &0)` ASSUME_TAC; +REWRITE_TAC[REAL_ARITH`A-B= &0 <=> B=A`] +THEN STRIP_TAC +THEN MRESAL_TAC Collect_geom.EQ_POW2_COND[`t/ &2 - &1`;`&2`][REAL_ARITH`&2 pow 2= &4/\ &0<= &2`;REAL_ARITH`&0 <= t / &2 - &1<=> &2<= t`;REAL_ARITH`t / &2 - &1 = &2<=> t= &6`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`t<= &4==> ~(t = &6)`) +THEN RESA_TAC; +SUBGOAL_THEN`b pow 2 + d pow 2= &4`ASSUME_TAC; +MRESA1_TAC SQRT_POW_2`&4- (t/ &2- &1) pow 2` +THEN EXPAND_TAC"b" +THEN REAL_ARITH_TAC; +MRESA1_TAC SQRT_EQ_0`&4- (t/ &2- &1) pow 2` +THEN MP_TAC(REAL_ARITH`&2<= t==> &0<= t/\ (&1 - t / &2) - (&1 + t / &2)= -- t +/\ (&1 + t / &2) - &2= -- (&1 - t / &2) /\ &0< t /\ &0< t+ &2/\ ~(t + &2= &0) +/\ (&1 - t / &2) - &2= -- (&1 + t / &2) /\ ~(t<= &0)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`&1 - t * inv (t + &2) = &2 * inv (t + &2)` ASSUME_TAC; +REWRITE_TAC[REAL_ARITH`A-B *D=C *D<=> D *(B+C)= A:real`] +THEN MATCH_MP_TAC REAL_MUL_LINV +THEN ASM_REWRITE_TAC[]; +EXISTS_TAC`vec 0:real^3` +THEN EXISTS_TAC`(vector[&2; &0; &0]):real^3` +THEN EXISTS_TAC`(vector[b; d; &0]):real^3` +THEN EXISTS_TAC`(vector[c; d; &0]):real^3` +THEN EXISTS_TAC`(vector[&1;e; &0]):real^3` +THEN STRIP_TAC; +SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH] +THEN EXPAND_TAC"b" +THEN EXPAND_TAC"c" +THEN REWRITE_TAC[REAL_ARITH`&1 - t / &2 = &1 + t / &2 <=> t= &0`] +THEN MP_TAC(REAL_ARITH`&2<=t==> ~(t= &0)`) +THEN RESA_TAC; +STRIP_TAC; +SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH] +THEN EXPAND_TAC"b" +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - t / &2= &0 <=> t= &2`;REAL_ARITH`&1 + t / &2= &0 <=> t= -- &2`;DE_MORGAN_THM]; +STRIP_TAC; +ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;DE_MORGAN_THM]; +STRIP_TAC; +ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;DE_MORGAN_THM]; +STRIP_TAC; +ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;DE_MORGAN_THM]; +STRIP_TAC; +ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;DE_MORGAN_THM;REAL_ARITH`~(&0= &2)`]; +STRIP_TAC; +ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA; FORALL_3; SUM_3; DIMINDEX_3; VECTOR_3; + vector_add; vec; dot; cross; orthogonal; basis; NORM_EQ_SQUARE; + vector_neg; vector_sub; vector_mul; ARITH;] +THEN REAL_ARITH_TAC; +STRIP_TAC; +ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA; FORALL_3; SUM_3; DIMINDEX_3; VECTOR_3; + vector_add; vec; dot; cross; orthogonal; basis; NORM_EQ_SQUARE; + vector_neg; vector_sub; vector_mul; ARITH;VECTOR_ARITH`A- vec 0=A`; +REAL_ARITH`&0<= &2 /\ a * a= a pow 2/\ A+ &0 pow 2=A/\ &2 pow 2= &4`]; +STRIP_TAC; +ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA; FORALL_3; SUM_3; DIMINDEX_3; VECTOR_3; + vector_add; vec; dot; cross; orthogonal; basis; NORM_EQ_SQUARE; + vector_neg; vector_sub; vector_mul; ARITH; +REAL_ARITH`&0<= &2 /\ --a * --a= a pow 2/\ A- &0 =A/\ A+ &0 * &0=A/\ &2 pow 2= &4`] +THEN ASM_REWRITE_TAC[REAL_ARITH`b * b= b pow 2`]; +STRIP_TAC; +ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA; FORALL_3; SUM_3; DIMINDEX_3; VECTOR_3; + vector_add; vec; dot; cross; orthogonal; basis; NORM_EQ_SQUARE; + vector_neg; vector_sub; vector_mul; ARITH;VECTOR_ARITH`A- vec 0=A`; +REAL_ARITH`&0<= &2 /\ a * a= a pow 2/\ A+ &0 pow 2=A/\ &2 pow 2= &4`]; +STRIP_TAC; +REWRITE_TAC[INTER;IN_SEGMENT;IN_ELIM_THM] +THEN STRIP_TAC; +STRIP_TAC; +ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;DE_MORGAN_THM]; +EXISTS_TAC`t * inv(t+ &2)` +THEN STRIP_TAC; +MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_INV +THEN ASM_REWRITE_TAC[]; +STRIP_TAC; +MATCH_MP_TAC REAL_LT_RCANCEL_IMP +THEN MRESA1_TAC REAL_MUL_LINV`t + &2` +THEN EXISTS_TAC`t+ &2` +THEN ASM_REWRITE_TAC[REAL_ARITH`(A *B) * C= A *(B*C)`] +THEN REAL_ARITH_TAC; +ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA; FORALL_3; SUM_3; DIMINDEX_3; VECTOR_3; + vector_add; vec; dot; cross; orthogonal; basis; NORM_EQ_SQUARE; + vector_neg; vector_sub; vector_mul; ARITH;REAL_ARITH`A * &0= &0 /\ a+ &0 = a/\ (a*b)*c=a *b*c`;REAL_ARITH`&2 * inv (t + &2) * b + t * inv (t + &2) * &2= &2 * inv (t + &2) * (b+t)`] +THEN EXPAND_TAC"b" +THEN REWRITE_TAC[REAL_ARITH`&1 = &2 * inv (t + &2) * (&1 - t / &2 + t) +<=> inv (t + &2) * (t + &2)= &1`] +THEN MRESA1_TAC REAL_MUL_LINV`t + &2`; +STRIP_TAC; +ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;DE_MORGAN_THM]; +EXISTS_TAC`t * inv(t+ &2)` +THEN STRIP_TAC; +MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_INV +THEN ASM_REWRITE_TAC[]; +STRIP_TAC; +MATCH_MP_TAC REAL_LT_RCANCEL_IMP +THEN MRESA1_TAC REAL_MUL_LINV`t + &2` +THEN EXISTS_TAC`t+ &2` +THEN ASM_REWRITE_TAC[REAL_ARITH`(A *B) * C= A *(B*C)`] +THEN REAL_ARITH_TAC; +ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA; FORALL_3; SUM_3; DIMINDEX_3; VECTOR_3; + vector_add; vec; dot; cross; orthogonal; basis; NORM_EQ_SQUARE; + vector_neg; vector_sub; vector_mul; ARITH;REAL_ARITH`A * &0= &0 /\ a+ &0 = a/\ (a*b)*c=a *b*c`;REAL_ARITH`&2 * inv (t + &2) * b + t * inv (t + &2) * &2= &2 * inv (t + &2) * (b+t)`] +THEN EXPAND_TAC"c" +THEN REWRITE_TAC[REAL_ARITH`&1 = &2 * inv (t + &2) * (&1 + t / &2) +<=> inv (t + &2) * (t + &2)= &1`] +THEN MRESA1_TAC REAL_MUL_LINV`t + &2`; +STRIP_TAC; +ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA; FORALL_3; SUM_3; DIMINDEX_3; VECTOR_3; + vector_add; vec; dot; cross; orthogonal; basis; NORM_EQ; + vector_neg; vector_sub; vector_mul; ARITH;REAL_ARITH`A * &0= &0 /\ a+ &0 = a/\ (a*b)*c=a *b*c`;REAL_ARITH`a- &0=a `;VECTOR_ARITH`A- vec 0=A`] +THEN REAL_ARITH_TAC; +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[REAL_ARITH`a<=b <=> b>=a`] +THEN ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA; FORALL_3; SUM_3; DIMINDEX_3; VECTOR_3; + vector_add; vec; dot; cross; orthogonal; basis; NORM_LE_SQUARE;NORM_GE_SQUARE; + vector_neg; vector_sub; vector_mul; ARITH;REAL_ARITH`A * &0= &0 /\ a+ &0 = a/\ (a*b)*c=a *b*c/\ --c * --c + d * d= c pow 2 + d pow 2`;REAL_ARITH`a- &0=a `;VECTOR_ARITH`A- vec 0=A`] +THEN MRESA1_TAC SQRT_POW_2`&4 - (t / &2 - &1) pow 2` +THEN MRESAL1_TAC SQRT_POW_2`(&5)`[REAL_ARITH`&0<= &5`;REAL_ARITH`(&1 + sqrt (&5)) pow 2= &1 + &2 * sqrt(&5) + sqrt(&5) pow 2`] +THEN EXPAND_TAC"c" +THEN REWRITE_TAC[REAL_ARITH`(&1 + t / &2) pow 2 + &4 - (t / &2 - &1) pow 2 += &4 + &2 * t`;REAL_ARITH`&4 + &2 * t <= &1 + &2 * sqrt (&5) + &5<=> t <= &1 + sqrt( &5) `; REAL_ARITH`&4 + &2 * t >= t pow 2<=> (t- &1) pow 2<= &5`] +THEN STRIP_TAC +THEN MRESAL_TAC REAL_LE_RSQRT[`t- &1`;`&5`][REAL_ARITH`A-B<= C<=> A<= B+C`] +THEN MRESAL1_TAC SQRT_POS_LE`&5`[REAL_ARITH`&0<= &5`] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]);; + + + + + + + +let MAX_IF_COPLANAR=prove_by_refinement(`!v x:real^3 u w:real^3 a t. + a<= t /\ +~(v=x)/\ ~(v=u) /\ ~(v=w) /\ ~(x=u)/\ ~(x=w) /\ ~(u=w) +/\ ~(collinear{v,x,u}) +/\ ~(collinear{w,x,u}) +/\ norm(v-x)=t +/\ norm(v-u)=a +/\ norm(x-w)=a +/\ norm(u-w)=a +/\ t<= norm(x-u) +==> ?w1 y. +y IN segment(v,w1) INTER segment (x,u) +/\ norm(x-w1)=a +/\ norm(u-w1)=a +/\ ~(v=w1)`, +[REPEAT STRIP_TAC +THEN ABBREV_TAC`b=norm(x-u:real^3)` +THEN ABBREV_TAC`a1= inv(b) * (a pow 2 + b pow 2 -t pow 2)/ &2` +THEN ABBREV_TAC`v1= (a1 * inv(b)) % (x-u:real^3) +u:real^3` +THEN ABBREV_TAC`y1= (&1/ &2) %(u+x:real^3) ` +THEN ABBREV_TAC`b1= sqrt(a pow 2- (b/ &2) pow 2) ` +THEN ABBREV_TAC`w1= (b1* inv(norm(v1- v))) %(v1-v:real^3) +y1` +THEN ABBREV_TAC`y= (&1- norm(v1-v:real^3) * inv(norm(v1-v)+b1)) %v + (norm(v1-v) * inv(norm(v1-v)+b1)) % w1:real^3` +THEN SUBGOAL_THEN`~(y1=x:real^3)` ASSUME_TAC; +EXPAND_TAC"y1" +THEN REWRITE_TAC[VECTOR_ARITH`&1 / &2 % (u + x) = x<=> x=u`] +THEN ASM_REWRITE_TAC[]; +SUBGOAL_THEN`~(y1=u:real^3)` ASSUME_TAC; +EXPAND_TAC"y1" +THEN REWRITE_TAC[VECTOR_ARITH`&1 / &2 % (u + x) = u<=> x=u`] +THEN ASM_REWRITE_TAC[]; +SUBGOAL_THEN`y1 IN segment[u,x:real^3]`ASSUME_TAC; +REWRITE_TAC[IN_SEGMENT] +THEN EXISTS_TAC`&1/ &2` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &1/ &2 /\ &1/ &2<= &1 /\ &1- &1/ &2= &1/ &2`;VECTOR_ARITH`A % x + A % u= A%(x+u)`]; +SUBGOAL_THEN`~(y1=w:real^3)` ASSUME_TAC; +STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN MP_TAC(REAL_ARITH`&0 = &0`) +THEN MRESA_TAC COLLINEAR_SUBSET[`{w,x,u:real^3}`;`segment[u,x:real^3]`] +THEN ASM_REWRITE_TAC[COLLINEAR_SEGMENT] +THEN MRESA_TAC ENDS_IN_SEGMENT[`u:real^3`;`x:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; +SUBGOAL_THEN`&0<=a pow 2 - (b / &2) pow 2` ASSUME_TAC; +MRESAL_TAC CONGRUENT_TRIANGLES_SSS[`w:real^3`;`y1:real^3`;`u:real^3`;`w:real^3`;`y1:real^3`;`x:real^3`][dist] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 / &2) % (u + x) - u = &1 / &2 % (x - u) /\ (&1 / &2) % (u + x) - x = (&1 / &2) % (u -x) `;NORM_MUL;] +THEN SIMP_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESAL_TAC ANGLES_ALONG_LINE[`u:real^3`;`x:real^3`;`y1:real^3`;`w:real^3`][BETWEEN_IN_SEGMENT] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ANGLE_SYM] +THEN ASM_REWRITE_TAC[REAL_ARITH`A+A= B <=> A= B/ &2`] +THEN STRIP_TAC +THEN MRESAL_TAC LAW_OF_COSINES[`y1:real^3`;`w:real^3`;`u:real^3`][dist] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[COS_PI2; REAL_ARITH`A * &0= &0/\ A- &0= A`] +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[VECTOR_ARITH`u - &1 / &2 % (u + x)= &1 / &2 % (u - x)`;NORM_MUL;REAL_ARITH`abs(&1/ &2)= &1/ &2`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[REAL_ARITH`&1/ &2 *A=A/ &2`] +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ARITH`(A+B)-B=A`;REAL_LE_POW_2]; +SUBGOAL_THEN`&0< a pow 2 - (b / &2) pow 2` ASSUME_TAC; +MRESAL_TAC CONGRUENT_TRIANGLES_SSS[`w:real^3`;`y1:real^3`;`u:real^3`;`w:real^3`;`y1:real^3`;`x:real^3`][dist] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 / &2) % (u + x) - u = &1 / &2 % (x - u) /\ (&1 / &2) % (u + x) - x = (&1 / &2) % (u -x) `;NORM_MUL;] +THEN SIMP_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESAL_TAC ANGLES_ALONG_LINE[`u:real^3`;`x:real^3`;`y1:real^3`;`w:real^3`][BETWEEN_IN_SEGMENT] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ANGLE_SYM] +THEN ASM_REWRITE_TAC[REAL_ARITH`A+A= B <=> A= B/ &2`] +THEN STRIP_TAC +THEN MRESAL_TAC LAW_OF_COSINES[`y1:real^3`;`w:real^3`;`u:real^3`][dist] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[COS_PI2; REAL_ARITH`A * &0= &0/\ A- &0= A`] +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[VECTOR_ARITH`u - &1 / &2 % (u + x)= &1 / &2 % (u - x)`;NORM_MUL;REAL_ARITH`abs(&1/ &2)= &1/ &2`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[REAL_ARITH`&1/ &2 *A=A/ &2`] +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ARITH`(A+B)-B=A`;REAL_LE_POW_2; GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT] +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`y1:real^3`;`w:real^3`][REAL_EQ_MUL_LCANCEL]; +MRESA1_TAC SQRT_WORKS`a pow 2 - (b / &2) pow 2` +THEN +MRESA1_TAC SQRT_POS_LT`a pow 2 - (b / &2) pow 2` +THEN SUBGOAL_THEN`&0<= b1 * inv (norm(v1- v:real^3))`ASSUME_TAC; +MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_INV +THEN REWRITE_TAC[NORM_POS_LE]; +MRESAL_TAC Planarity.IMP_NORM_FAN[`x:real^3`;`u:real^3`][REAL_EQ_MUL_LCANCEL] +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`v:real^3`;`u:real^3`][REAL_EQ_MUL_LCANCEL] +THEN SUBGOAL_THEN`~(v1=v:real^3)` ASSUME_TAC; +EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`(a1 * inv b) % (x-u) + u = v<=> (a1 * inv b) % ( x-u) = v-u`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(a1 * inv b) % (x-u) = v - u:real^3 +==> norm((a1 * inv b) % ( x-u)) = norm( v - u)`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[NORM_MUL] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[REAL_ARITH`(a*b)*c= a*(b*c)`;REAL_ABS_MUL] +THEN MRESAL1_TAC REAL_ABS_REFL`inv b:real`[REAL_ARITH`A* &1=A`] +THEN MRESAL_TAC LAW_OF_COSINES[`u:real^3`;`v:real^3`;`x:real^3`][dist] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[REAL_ARITH`t pow 2 = (a pow 2 + b pow 2) - &2 * a * b * cos (angle (v,u,x))<=> a pow 2 + b pow 2 -t pow 2= &2 * a * b * cos (angle (v,u,x)) `] +THEN STRIP_TAC +THEN EXPAND_TAC"a1" +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;REAL_ABS_MUL;REAL_ARITH`(&2*A)/ &2=A`]) +THEN ASM_REWRITE_TAC[REAL_ABS_MUL] +THEN MRESAL1_TAC REAL_ABS_REFL`b:real`[REAL_ARITH`A* &1=A`] +THEN MRESAL1_TAC REAL_ABS_REFL`a:real`[REAL_ARITH`A* &1=A`] +THEN ASM_REWRITE_TAC[REAL_ARITH`A *B* C*D=(A*C) *B*D /\ &1*A=A`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`a * abs (cos (angle (v,u,x:real^3))) = a +==> inv(a) * (a * abs (cos (angle (v,u,x)))) = inv a * a`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*B*C=(A*B)*C/\ &1 *A =A`] +THEN DISJ_CASES_TAC(REAL_ARITH`&0<= cos (angle (v,u,x:real^3)) \/ &0<= -- cos (angle (v,u,x))`); +MRESAL1_TAC REAL_ABS_REFL`cos (angle (v,u,x:real^3))`[REAL_ARITH`A* &1=A`] +THEN STRIP_TAC +THEN ASSUME_TAC(PI_WORKS) +THEN MP_TAC(REAL_ARITH`&0< pi==> &0<= pi`) +THEN RESA_TAC +THEN MRESAL_TAC COS_INJ_PI[`angle (v,u,x:real^3)`;`&0`][COS_0;ANGLE_RANGE;REAL_ARITH`&0<= &0`] +THEN MRESA_TAC COLLINEAR_ANGLE[`v:real^3`;`u:real^3`;`x:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC; +MRESAL1_TAC REAL_ABS_REFL`-- cos (angle (v,u,x:real^3))`[REAL_ARITH`--A= &1<=> A= -- &1`;REAL_ABS_NEG] +THEN STRIP_TAC +THEN ASSUME_TAC(PI_WORKS) +THEN MP_TAC(REAL_ARITH`&0< pi==> &0<= pi`) +THEN RESA_TAC +THEN MRESAL_TAC COS_INJ_PI[`angle (v,u,x:real^3)`;`pi`][COS_PI;ANGLE_RANGE;REAL_ARITH`pi<= pi`] +THEN MRESA_TAC COLLINEAR_ANGLE[`v:real^3`;`u:real^3`;`x:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC; +MRESAL_TAC Planarity.IMP_NORM_FAN[`v1:real^3`;`v:real^3`][REAL_EQ_MUL_LCANCEL] +THEN SUBGOAL_THEN`angle(v,u,x)= angle(v,u,y1:real^3)`ASSUME_TAC; +MRESA_TAC ANGLE_EQ[`v:real^3`;`u:real^3`;`x:real^3`;`v:real^3`;`u:real^3`;`y1:real^3`] +THEN EXPAND_TAC"y1" +THEN ASM_REWRITE_TAC[VECTOR_ARITH`&1 / &2 % (u + x) - u= &1 / &2 % ( x - u)`;NORM_MUL;REAL_ARITH`abs(&1/ &2) *A=A/ &2`;REAL_ARITH`(A+B)- &2 * C= A-B<=> B=C`;DOT_RMUL] +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`~(v=w1:real^3)` ASSUME_TAC; +EXPAND_TAC"w1" +THEN REWRITE_TAC[VECTOR_ARITH`v = (b1 * inv (norm (v1 - v))) % (v1 - v) + y1 +<=> v- y1 = (b1 * inv (norm (v1 - v))) % (v1 - v) `] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`v - y1 = (b1 * inv (norm (v1 - v))) % (v1 - v):real^3 +==> norm(v - y1) = norm( (b1 * inv (norm (v1 - v))) % (v1 - v))`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN ASSUME_TAC (SYM th)) +THEN REWRITE_TAC[NORM_MUL] +THEN MRESA1_TAC REAL_ABS_REFL`b1 * inv (norm(v1- v:real^3))` +THEN ASM_REWRITE_TAC[REAL_ARITH`(A*B)*C=A*(B*C)/\ A* &1= A`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`norm (v - y1:real^3) = b1 +==> norm (v - y1) pow 2= b1 pow 2`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN ASSUME_TAC (SYM th)) +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC LAW_OF_COSINES[`u:real^3`;`v:real^3`;`y1:real^3`][dist] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"y1" +THEN ASM_REWRITE_TAC[VECTOR_ARITH`&1 / &2 % (u + x) - u= &1 / &2 % ( x - u)`;NORM_MUL;REAL_ARITH`abs(&1/ &2) *A=A/ &2`;REAL_ARITH`(A+B)- &2 * C= A-B<=> B=C`] +THEN MRESAL_TAC LAW_OF_COSINES[`u:real^3`;`v:real^3`;`x:real^3`][dist] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[REAL_ARITH`t pow 2 = (a pow 2 + b pow 2) - &2 * a * b * cos (angle (v,u,y1)) +<=> a * b / &2* cos (angle (v,u,y1))= (a pow 2 + b pow 2- t pow 2 )/ &4`] +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ARITH`(b / &2) pow 2 = (a pow 2 + b pow 2 - t pow 2) / &4<=> a pow 2= t pow 2`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN ASM_TAC +THEN REWRITE_TAC[REAL_ARITH`A+B-A=B`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`inv b * b pow 2 / &2 = (inv b * b) * b / &2`) +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 *A=A`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN MP_TAC(VECTOR_ARITH`(b / &2 * inv b) % (x-u) + u= (inv b *b )/ &2 % (x-u) + u:real^3`) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`&1 / &2 % (x-u) + u= &1/ &2 %(u+x)`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[REAL_ARITH`norm (y1 - v) * inv (norm (y1 - v)) = inv (norm (y1 - v))* norm (y1 - v) `] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`&1 % (y1 - v) = v - y1<=> y1=v`]; +SUBGOAL_THEN`norm(v1-u:real^3) pow 2+ norm(v1- v) pow 2= norm(v-u:real^3) pow 2`ASSUME_TAC; +DISJ_CASES_TAC(SET_RULE`v1=u \/ ~(v1=u:real^3)`); +ASM_REWRITE_TAC[VECTOR_ARITH`A-A= vec 0`;NORM_0;REAL_ARITH`&0 pow 2+A= A`] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[]; +MRESAL_TAC LAW_OF_COSINES[`u:real^3`;`v:real^3`;`v1:real^3`][dist] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`((a1 * inv b) % (x - u) + u) - u= (a1 * inv b) % (x - u) `] +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC LAW_OF_COSINES[`u:real^3`;`v:real^3`;`x:real^3`][dist] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[REAL_ARITH`t pow 2 = (a pow 2 + b pow 2) - &2 * a * b * cos (angle (v,u,y1)) +<=> a * b * cos (angle (v,u,y1))= (a pow 2 + b pow 2- t pow 2) / &2 `] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`a * b * cos (angle (v,u,y1:real^3))= (a pow 2 + b pow 2- t pow 2) / &2 +==> inv b*(a * b * cos (angle (v,u,y1)))= inv b*((a pow 2 + b pow 2- t pow 2) / &2 )`) +THEN POP_ASSUM(fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[th]) +THEN REWRITE_TAC[REAL_ARITH`inv b * a * b * cos (angle (v,u,y1))= (inv b * b) * a * cos (angle (v,u,y1))`] +THEN ASM_REWRITE_TAC[NORM_MUL;REAL_ARITH`&1*A=A`;REAL_ABS_MUL;REAL_ABS_INV] +THEN MRESA1_TAC REAL_ABS_NORM`x-u:real^3` +THEN ASM_REWRITE_TAC[REAL_ARITH`A* &1=A /\ (A*B)*C=A*(B*C)/\ abs a pow 2= a pow 2`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`abs a1= a *cos(angle(v, u, v1:real^3))` ASSUME_TAC; +POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`&0 <= a1 \/ &0 <=(-- a1)`); +MRESA1_TAC REAL_ABS_REFL`a1:real` +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MATCH_MP_TAC(SET_RULE`angle (v,u,x) = angle (v,u,v1) +==> a * cos (angle (v,u,x)) = a * cos (angle (v,u,v1:real^3))`) +THEN MRESA_TAC ANGLE_EQ[`v:real^3`;`u:real^3`;`x:real^3`;`v:real^3`;`u:real^3`;`v1:real^3`] +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`((a1 * inv b) % (x - u) + u) - u +=(a1 * inv b) % (x - u)`;NORM_MUL;DOT_RMUL] +THEN ASM_REWRITE_TAC[NORM_MUL;REAL_ARITH`&1*A=A`;REAL_ABS_MUL;REAL_ABS_INV] +THEN REAL_ARITH_TAC; +MRESAL1_TAC REAL_ABS_REFL`--a1:real`[REAL_ABS_NEG] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;REAL_ARITH`--(A*B)=A*(-- B)`]) +THEN MRESAL1_TAC COS_PERIODIC_PI`-- angle(v,u,y1:real^3)`[COS_NEG] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;REAL_ARITH`--A+B=B-A`]) +THEN MATCH_MP_TAC(SET_RULE` angle (v,u,v1) =(pi -angle (v,u,y1) ) +==> a * cos (pi-angle (v,u,y1) ) = a * cos (angle (v,u,v1:real^3))`) +THEN MRESA_TAC (GEN_ALL ANGLE_EQ_PI_LEFT)[`v:real^3`;`v1:real^3`;`u:real^3`;`x:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ANGLE_SYM] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[ANGLE_SYM] +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[ANGLE_BETWEEN;BETWEEN_IN_SEGMENT;IN_SEGMENT] +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`( &1 - u1) % x + u1 % ((a1 * inv b) % (x - u) + u) += ( &1 - u1 *( &1-a1 * inv b)) % x + (u1 * ( &1- a1 * inv b)) % u`] +THEN EXISTS_TAC`inv (&1 - a1 * inv b)` +THEN STRIP_TAC; +REWRITE_TAC[REAL_LE_INV_EQ] +THEN MATCH_MP_TAC(REAL_ARITH`&0<= (-- a) *b ==> &0<= &1- a*b`) +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[]; +STRIP_TAC; +MATCH_MP_TAC REAL_INV_LE_1 +THEN MATCH_MP_TAC(REAL_ARITH`&0<= (-- a) *b ==> &1<= &1- a*b`) +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[]; +SUBGOAL_THEN`~( &1 - a1 * inv b = &0)`ASSUME_TAC; +MATCH_MP_TAC(REAL_ARITH`&0<= (-- a) *b ==> ~( &1- a*b= &0)`) +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[]; +MRESA1_TAC REAL_MUL_LINV`&1 - a1 * inv b` +THEN VECTOR_ARITH_TAC; +REWRITE_TAC[REAL_ARITH`&2 * a * abs a1 * inv b * b * cos (angle (v,u,v1)) += &2 * abs a1 * (inv b * b) *( a* cos (angle (v,u,v1)))`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;]) +THEN REAL_ARITH_TAC; +POP_ASSUM (fun th-> MP_TAC th +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`((a1 * inv b) % (x - u) + u) - u=(a1 * inv b) % (x - u) `;NORM_MUL] +THEN ASM_REWRITE_TAC[REAL_ARITH`(abs (a1 * inv b) * b) pow 2= (a1 * inv b * b) pow 2/\ a* &1=a`;REAL_ARITH`A+B=C<=> B=C-A`] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN SUBGOAL_THEN`~(w1=y1:real^3)`ASSUME_TAC; +EXPAND_TAC"w1" +THEN REWRITE_TAC[VECTOR_ARITH`(b1 * inv (norm (v1 - v))) % (v1 - v) + y1 = y1<=> (b1 * inv (norm (v1 - v))) % (v1 - v) = vec 0`;GSYM NORM_EQ_0;NORM_MUL;REAL_ABS_MUL] +THEN MRESA1_TAC REAL_ABS_REFL`b1:real` +THEN MRESA1_TAC REAL_ABS_REFL`inv (norm (v1 - v:real^3)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`(A*B)*C=A*(B*C)`] +THEN MP_TAC(REAL_ARITH`&0< b1==> ~(b1 * &1= &0)`) +THEN RESA_TAC; +SUBGOAL_THEN`(u-x) dot (v1- v:real^3)= &0` ASSUME_TAC; +DISJ_CASES_TAC(SET_RULE`v1=u\/ ~(u=v1:real^3)`); +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`(a1 * inv b) % (x - u) + u=u<=> (a1 * inv b) % (x - u) = vec 0`;GSYM NORM_EQ_0;NORM_MUL;REAL_ENTIRE;REAL_ABS_MUL] +THEN ASM_REWRITE_TAC[] +THEN MRESA1_TAC REAL_ABS_REFL`inv b:real` +THEN MP_TAC(REAL_ARITH`&0 < inv b /\ &0< inv a==> ~(inv b= &0)/\ ~(inv a= &0)`) +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ABS_ZERO] +THEN EXPAND_TAC"a1" +THEN REWRITE_TAC[REAL_ENTIRE;REAL_ABS_MUL] +THEN ASM_REWRITE_TAC[REAL_ARITH`(A+B-C) / &2= &0<=> A+B=C`] +THEN STRIP_TAC +THEN MRESAL_TAC LAW_OF_COSINES[`u:real^3`;`v:real^3`;`x:real^3`][dist;COS_ANGLE] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[real_div;REAL_ARITH`t pow 2 = t pow 2 - &2 * a * b * ((v - u) dot (x - u)) * inv (a * b)<=> a * b * ((v - u) dot (x - u)) * inv (a * b)= &0`;REAL_ENTIRE;] +THEN ASM_REWRITE_TAC[REAL_ENTIRE;REAL_INV_MUL] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`A-B= --(B-A):real^3`] +THEN ASM_REWRITE_TAC[DOT_LNEG;DOT_RNEG;DOT_SYM] +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC LAW_OF_COSINES[`v1:real^3`;`u:real^3`;`v:real^3`][dist;COS_ANGLE] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[real_div;REAL_INV_MUL;REAL_ARITH`a pow 2 = + a pow 2 - + &2 * + norm (u - v1) * + norm (v - v1) * + ((u - v1) dot (v - v1)) * + inv (norm (v1 - u)) * + inv (norm (v1 - v)) +<=> norm (u - v1) * + norm (v - v1) * + ((u - v1) dot (v - v1)) * + inv (norm (v1 - u)) * + inv (norm (v1 - v))= &0`;REAL_ENTIRE] +THEN MP_TAC(REAL_ARITH` &0 < norm (v1 - v)/\ &0< inv (norm (v1 - v))==> ~( norm (v1 - v:real^3)= &0)/\ ~(inv (norm (v1 - v))= &0)`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`v1:real^3`;`u:real^3`][REAL_EQ_MUL_LCANCEL] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN MP_TAC(REAL_ARITH` &0< inv (norm (v1 - u:real^3))==> ~(inv (norm (v1 - u))= &0)`) +THEN RESA_TAC +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`u - ((a1 * inv b) % (x - u) + u)= (a1 * inv b) % (--(x-u)) `;DOT_LMUL] +THEN ASM_REWRITE_TAC[REAL_ENTIRE] +THEN MP_TAC(REAL_ARITH`&0 < inv b /\ &0< inv a==> ~(inv b= &0)/\ ~(inv a= &0)`) +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`((a1 * inv b) % (x - u) + u)-u= (a1 * inv b) % ((x-u)) `;NORM_MUL] +THEN ASM_REWRITE_TAC[REAL_ENTIRE;REAL_ABS_ZERO] +THEN MP_TAC(REAL_ARITH`&0 < inv b /\ &0< inv a==> ~(inv b= &0)/\ ~(inv a= &0)`) +THEN RESA_TAC +THEN RESA_TAC +THEN REWRITE_TAC[DOT_LNEG;REAL_ARITH`--A = &0<=> A= &0`] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`A-B= --(B-A):real^3`] +THEN ASM_REWRITE_TAC[DOT_LNEG;DOT_RNEG;DOT_SYM] +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`norm(x- w1:real^3)=a`ASSUME_TAC; +MRESAL_TAC DIST_EQ[`x:real^3`;`w1:real^3`;`x:real^3`;`w:real^3`][dist] +THEN MRESAL_TAC LAW_OF_COSINES[`y1:real^3`;`x:real^3`;`w1:real^3`][dist;COS_ANGLE] +THEN EXPAND_TAC"w1" +THEN REWRITE_TAC[VECTOR_ARITH`(y1 - ((b1 * inv (norm (v1 - v))) % (v1 - v) + y1))= -- ((b1 * inv (norm (v1 - v))) % (v1 - v)) /\ +(((b1 * inv (norm (v1 - v))) % (v1 - v) + y1) - y1)=(b1 * inv (norm (v1 - v))) % (v1 - v) `;NORM_NEG;NORM_MUL;REAL_ABS_MUL] +THEN MRESA1_TAC REAL_ABS_REFL`b1:real` +THEN MRESA1_TAC REAL_ABS_REFL`inv (norm (v1 - v:real^3)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`(A*B)*C=A*(B*C)/\ a* &1=a`;DOT_RMUL;] +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[VECTOR_ARITH`&1 / &2 % (u + x) - x= &1 / &2 % (u - x) `;NORM_MUL;VECTOR_ARITH`x - &1 / &2 % (u + x)= (-- &1 / &2) % (u - x)`;DOT_LMUL] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`norm(u- w1:real^3)=a`ASSUME_TAC; +MRESAL_TAC DIST_EQ[`u:real^3`;`w1:real^3`;`u:real^3`;`w:real^3`][dist] +THEN MRESAL_TAC LAW_OF_COSINES[`y1:real^3`;`u:real^3`;`w1:real^3`][dist;COS_ANGLE] +THEN EXPAND_TAC"w1" +THEN REWRITE_TAC[VECTOR_ARITH`(y1 - ((b1 * inv (norm (v1 - v))) % (v1 - v) + y1))= -- ((b1 * inv (norm (v1 - v))) % (v1 - v)) /\ +(((b1 * inv (norm (v1 - v))) % (v1 - v) + y1) - y1)=(b1 * inv (norm (v1 - v))) % (v1 - v) `;NORM_NEG;NORM_MUL;REAL_ABS_MUL] +THEN MRESA1_TAC REAL_ABS_REFL`b1:real` +THEN MRESA1_TAC REAL_ABS_REFL`inv (norm (v1 - v:real^3)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`(A*B)*C=A*(B*C)/\ a* &1=a`;DOT_RMUL;] +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[VECTOR_ARITH`&1 / &2 % (u + x) - u= &1 / &2 % (x - u) `;NORM_MUL;VECTOR_ARITH`u - &1 / &2 % (u + x)= (&1 / &2) % (u - x)`;DOT_LMUL] +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`a1 * inv b<= &1/ &2`ASSUME_TAC; +MRESAL_TAC Planarity.IMP_NORM_FAN[`v:real^3`;`x:real^3`][REAL_EQ_MUL_LCANCEL] +THEN +MRESA_TAC Trigonometry2.POW2_COND[`a:real`;`t:real`] +THEN MP_TAC(REAL_ARITH`a pow 2 <= t pow 2 ==> (a pow 2 +b pow 2 - t pow 2)/ &2<= b pow 2 / &2`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_LMUL[`inv b`;`(a pow 2 +b pow 2 - t pow 2)/ &2`;`b pow 2 / &2`] +THEN MRESAL_TAC REAL_LE_RMUL[`a1:real`;`inv b * b pow 2 / &2`;`inv b`][REAL_ARITH`(inv b * b pow 2 / &2) * inv b= (inv b * b) pow 2 / &2/\ &1 pow 2 = &1`]; +EXISTS_TAC`w1:real^3` +THEN EXISTS_TAC`y:real^3` +THEN STRIP_TAC; +ASM_REWRITE_TAC[INTER;IN_ELIM_THM;IN_SEGMENT] +THEN STRIP_TAC; +EXISTS_TAC`norm (v1 - v:real^3) * inv (norm (v1 - v) + b1)` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; +MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_INV +THEN MATCH_MP_TAC(REAL_ARITH`&0< A /\ &0< B==> &0< A+B`) +THEN ASM_REWRITE_TAC[]; +MP_TAC(REAL_ARITH`&0< b1 /\ &0< norm (v1-v)==>norm(v1-v:real^3) < norm (v1-v) +b1/\ ~(norm (v1-v) +b1= &0)/\ &0< norm (v1-v) +b1`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`(norm(v1-v:real^3)+b1)` +THEN MRESA1_TAC REAL_MUL_LINV`(norm(v1-v:real^3)+b1)` +THEN MRESA_TAC REAL_LT_LMUL[`inv(norm(v1-v:real^3)+b1)`;`norm(v1-v:real^3)`;`norm(v1-v:real^3)+b1`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B=B*A`] +THEN RESA_TAC; +SUBGOAL_THEN`~(y=v1:real^3)<=> ~(v1= y1)`ASSUME_TAC; +EXPAND_TAC"y" +THEN REWRITE_TAC[VECTOR_ARITH`(&1-a) %u+ a%v= x<=> (&1-a) %(u-x)= a%(x-v)`] +THEN EXPAND_TAC"w1" +THEN REWRITE_TAC[VECTOR_ARITH`v1 - ((b1 * inv (norm (v1 - v))) % (v1 - v) + y1) += (v1-y1) - ((b1 * inv (norm (v1 - v))) % (v1 - v))`;] +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`A%(B-C)= A%B-A%C`] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;REAL_ARITH`(norm (v1 - v) * inv (norm (v1 - v) + b1)) * b1 * inv (norm (v1 - v)) += inv (norm (v1 - v) + b1) * b1 * inv (norm (v1 - v)) *norm (v1 - v) /\ A * &1=A`] +THEN ONCE_REWRITE_TAC[ VECTOR_ARITH` A%B-A%C=A%(B-C)`] +THEN MP_TAC(REAL_ARITH`&0< b1 /\ &0< norm (v1-v)==>norm(v1-v:real^3) < norm (v1-v) +b1/\ ~(norm (v1-v) +b1= &0)/\ &0< norm (v1-v) +b1`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`(norm(v1-v:real^3)+b1)` +THEN MRESA1_TAC REAL_MUL_LINV`(norm(v1-v:real^3)+b1)` +THEN SUBGOAL_THEN`inv (norm (v1 - v:real^3) + b1) * b1 = (&1 - norm (v1 - v) * inv (norm (v1 - v) + b1))`ASSUME_TAC; +ASM_REWRITE_TAC[REAL_ARITH`inv (norm (v1 - v) + b1) * b1 = + &1 - norm (v1 - v) * inv (norm (v1 - v) + b1) +<=> inv (norm (v1 - v) + b1) *(norm(v1-v)+ b1) = + &1 `]; +ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - norm (v1 - v) * inv (norm (v1 - v) + b1)) % (v - v1) = + (norm (v1 - v) * inv (norm (v1 - v) + b1)) % (v1 - y1) - + (&1 - norm (v1 - v) * inv (norm (v1 - v) + b1)) % (v1 - v) +<=> + (norm (v1 - v) * inv (norm (v1 - v) + b1)) % (v1 - y1) = vec 0`;VECTOR_MUL_EQ_0] +THEN MRESA_TAC REAL_LT_MUL[`norm(v1-v:real^3)`;`inv (norm (v1 - v:real^3) + b1)`] +THEN MP_TAC(REAL_ARITH` +&0< norm (v1 - v) * inv (norm (v1 - v) + b1) +==> +~(norm (v1 - v) * inv (norm (v1 - v:real^3) + b1) = &0)`) +THEN RESA_TAC +THEN REWRITE_TAC[VECTOR_ARITH`A-B= vec 0<=> A=B`]; +POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(v1 = y1) \/ ~(v1 = y1:real^3)`); +ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN EXISTS_TAC`&1/ &2` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1/ &2/\ &1/ &2< &1`;VECTOR_ARITH`(&1 - &1 / &2) % x + &1 / &2 % u= &1/ &2 %(u+x)`]; +RESA_TAC +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`y:real^3`;`v1:real^3`][REAL_EQ_MUL_LCANCEL] +THEN EXISTS_TAC`(&1 - norm (v1 - v) * inv (norm (v1 - v:real^3) + b1)) * (&1 / &2 - a1 * inv b) + &1/ &2` +THEN ONCE_REWRITE_TAC[SET_RULE`A/\B/\C<=> C/\A/\B`] +THEN STRIP_TAC; +REWRITE_TAC[VECTOR_ARITH`y= (&1-u) %A+u%B<=> y-A= u%(B-A)`] +THEN EXPAND_TAC"y" +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[VECTOR_ARITH`((&1-u) %A+u%B)-y= (&1-u) %(A-y)+u%(B-y)`;NORM_MUL] +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"w1" +THEN REWRITE_TAC[VECTOR_ARITH`A%((B+C)-D)=A%B+A%(C-D)/\ A%E%B=(A*E)%B`;REAL_ARITH`(norm (v1 - v) * inv (norm (v1 - v) + b1)) * b1 * inv (norm (v1 - v)) +=inv (norm (v1 - v) + b1) * b1 * inv (norm (v1 - v)) *norm (v1 - v) `] +THEN ASM_REWRITE_TAC[REAL_ARITH`a* &1= a`] +THEN MP_TAC(REAL_ARITH`&0< b1 /\ &0< norm (v1-v)==>norm(v1-v:real^3) < norm (v1-v) +b1/\ ~(norm (v1-v) +b1= &0)/\ &0< norm (v1-v) +b1`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`(norm(v1-v:real^3)+b1)` +THEN MRESA1_TAC REAL_MUL_LINV`(norm(v1-v:real^3)+b1)` +THEN SUBGOAL_THEN`inv (norm (v1 - v:real^3) + b1) * b1 = (&1 - norm (v1 - v) * inv (norm (v1 - v) + b1))`ASSUME_TAC; +ASM_REWRITE_TAC[REAL_ARITH`inv (norm (v1 - v) + b1) * b1 = + &1 - norm (v1 - v) * inv (norm (v1 - v) + b1) +<=> inv (norm (v1 - v) + b1) *(norm(v1-v)+ b1) = + &1 `;]; +ASM_REWRITE_TAC[VECTOR_ARITH`A%(v-x)+ A%(y-v)+c= A%(y-x)+c`] +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[VECTOR_ARITH`&1 / &2 % (u + x) - x= &1/ &2 %(u-x)`] +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - norm (v1 - v) * inv (norm (v1 - v) + b1)) % (v1 - x) + + (norm (v1 - v) * inv (norm (v1 - v) + b1)) % &1 / &2 % (u - x) = + ((&1 - norm (v1 - v) * inv (norm (v1 - v) + b1)) * (&1 / &2 - a1 * inv b) + &1 / &2) % (u - x) +<=> (&1 - norm (v1 - v) * inv (norm (v1 - v) + b1)) % (v1 - &1/ &2 %(x+u)) = + ((&1 - norm (v1 - v) * inv (norm (v1 - v) + b1)) * (&1 / &2 - a1 * inv b)) % (u - x) +`] +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`((a1 * inv b) % (x - u) + u) - &1 / &2 % (x + u) += (&1/ &2- a1 * inv b) % (u-x) `] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`]; +STRIP_TAC; +MATCH_MP_TAC(REAL_ARITH`&0<=A ==> &0< A+ &1/ &2`) +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0< b1 /\ &0< norm (v1-v)==>norm(v1-v:real^3) < norm (v1-v) +b1/\ ~(norm (v1-v) +b1= &0)/\ &0<= norm (v1-v) +b1`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LE_INV`(norm(v1-v:real^3)+b1)` +THEN MRESA1_TAC REAL_MUL_LINV`(norm(v1-v:real^3)+b1)` +THEN SUBGOAL_THEN`inv (norm (v1 - v:real^3) + b1) * b1 = (&1 - norm (v1 - v) * inv (norm (v1 - v) + b1))`ASSUME_TAC; +ASM_REWRITE_TAC[REAL_ARITH`inv (norm (v1 - v) + b1) * b1 = + &1 - norm (v1 - v) * inv (norm (v1 - v) + b1) +<=> inv (norm (v1 - v) + b1) *(norm(v1-v)+ b1) = + &1 `;]; +POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC; +MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[REAL_ARITH`&0<= A-B<=> B<=A`]; +SUBGOAL_THEN`&0< a1 * inv b`ASSUME_TAC; +MRESAL_TAC Planarity.IMP_NORM_FAN[`v:real^3`;`x:real^3`][REAL_EQ_MUL_LCANCEL] +THEN +MRESA_TAC Trigonometry2.POW2_COND[`t:real`;`b:real`] +THEN MP_TAC(REAL_ARITH`t pow 2 <= b pow 2 /\ &0< a pow 2 ==> &0< (a pow 2 +b pow 2 - t pow 2)/ &2`) +THEN ASM_REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT] +THEN STRIP_TAC +THEN MRESA_TAC REAL_LT_MUL[`inv b`;`(a pow 2 +b pow 2 - t pow 2)/ &2`] +THEN MRESA_TAC REAL_LT_MUL[`a1:real`;`inv b`]; +MP_TAC(REAL_ARITH`&0< a1 * inv b==>(&1 / &2 - a1 * inv b)< &1/ &2`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0< b1 /\ &0< norm (v1-v:real^3)==>b1 < norm (v1-v) +b1/\ ~(norm (v1-v) +b1= &0)/\ &0< norm (v1-v) +b1 /\ &0<= norm (v1-v) +b1`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`(norm(v1-v:real^3)+b1)` +THEN MRESA1_TAC REAL_LE_INV`(norm(v1-v:real^3)+b1)` +THEN MRESA1_TAC REAL_MUL_LINV`(norm(v1-v:real^3)+b1)` +THEN SUBGOAL_THEN`inv (norm (v1 - v:real^3) + b1) * b1 = (&1 - norm (v1 - v) * inv (norm (v1 - v) + b1))`ASSUME_TAC; +ASM_REWRITE_TAC[REAL_ARITH`inv (norm (v1 - v) + b1) * b1 = + &1 - norm (v1 - v) * inv (norm (v1 - v) + b1) +<=> inv (norm (v1 - v) + b1) *(norm(v1-v)+ b1) = + &1 `;]; +POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC REAL_LT_LMUL[`inv (norm (v1 - v:real^3) + b1)`;`b1:real`;`norm (v1 - v:real^3) + b1`] +THEN MRESA_TAC REAL_LE_MUL[`inv (norm (v1 - v:real^3) + b1)`;`b1:real`] +THEN MRESAL_TAC Real_ext.REAL_PROP_LT_LRMUL[`(inv (norm (v1 - v:real^3) + b1) * b1)`;`&1`;`(&1 / &2 - a1 * inv b)`;`&1/ &2`][REAL_ARITH`&0<= A-B<=> B<=A`] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[]]);; + + + + + + + + + + +let MAX_IF_COPLANAR1=prove_by_refinement(`!v x:real^3 u w:real^3 a a2 t. + a<= t /\ +~(v=x)/\ ~(v=u) /\ ~(v=w) /\ ~(x=u)/\ ~(x=w) /\ ~(u=w) +/\ ~(collinear{v,x,u}) +/\ ~(collinear{w,x,u}) +/\ norm(v-x)=t +/\ norm(v-u)=a +/\ norm(x-w)=a2 +/\ norm(u-w)=a2 +/\ a2=t +/\ t<= norm(x-u) +==> ?w1 y. +y IN segment(v,w1) INTER segment (x,u) +/\ norm(x-w1)=a2 +/\ norm(u-w1)=a2 +/\ ~(v=w1)`, +[REPEAT STRIP_TAC +THEN ABBREV_TAC`b=norm(x-u:real^3)` +THEN ABBREV_TAC`a1= inv(b) * (a pow 2 + b pow 2 -t pow 2)/ &2` +THEN ABBREV_TAC`v1= (a1 * inv(b)) % (x-u:real^3) +u:real^3` +THEN ABBREV_TAC`y1= (&1/ &2) %(u+x:real^3) ` +THEN ABBREV_TAC`b1= sqrt(a2 pow 2- (b/ &2) pow 2) ` +THEN ABBREV_TAC`w1= (b1* inv(norm(v1- v))) %(v1-v:real^3) +y1` +THEN ABBREV_TAC`y= (&1- norm(v1-v:real^3) * inv(norm(v1-v)+b1)) %v + (norm(v1-v) * inv(norm(v1-v)+b1)) % w1:real^3` +THEN SUBGOAL_THEN`~(y1=x:real^3)` ASSUME_TAC; +EXPAND_TAC"y1" +THEN REWRITE_TAC[VECTOR_ARITH`&1 / &2 % (u + x) = x<=> x=u`] +THEN ASM_REWRITE_TAC[]; +SUBGOAL_THEN`~(y1=u:real^3)` ASSUME_TAC; +EXPAND_TAC"y1" +THEN REWRITE_TAC[VECTOR_ARITH`&1 / &2 % (u + x) = u<=> x=u`] +THEN ASM_REWRITE_TAC[]; +SUBGOAL_THEN`y1 IN segment[u,x:real^3]`ASSUME_TAC; +REWRITE_TAC[IN_SEGMENT] +THEN EXISTS_TAC`&1/ &2` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &1/ &2 /\ &1/ &2<= &1 /\ &1- &1/ &2= &1/ &2`;VECTOR_ARITH`A % x + A % u= A%(x+u)`]; +SUBGOAL_THEN`~(y1=w:real^3)` ASSUME_TAC; +STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN MP_TAC(REAL_ARITH`&0 = &0`) +THEN MRESA_TAC COLLINEAR_SUBSET[`{w,x,u:real^3}`;`segment[u,x:real^3]`] +THEN ASM_REWRITE_TAC[COLLINEAR_SEGMENT] +THEN MRESA_TAC ENDS_IN_SEGMENT[`u:real^3`;`x:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; +SUBGOAL_THEN`&0<=a2 pow 2 - (b / &2) pow 2` ASSUME_TAC; +MRESAL_TAC CONGRUENT_TRIANGLES_SSS[`w:real^3`;`y1:real^3`;`u:real^3`;`w:real^3`;`y1:real^3`;`x:real^3`][dist] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 / &2) % (u + x) - u = &1 / &2 % (x - u) /\ (&1 / &2) % (u + x) - x = (&1 / &2) % (u -x) `;NORM_MUL;] +THEN SIMP_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESAL_TAC ANGLES_ALONG_LINE[`u:real^3`;`x:real^3`;`y1:real^3`;`w:real^3`][BETWEEN_IN_SEGMENT] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ANGLE_SYM] +THEN ASM_REWRITE_TAC[REAL_ARITH`A+A= B <=> A= B/ &2`] +THEN STRIP_TAC +THEN MRESAL_TAC LAW_OF_COSINES[`y1:real^3`;`w:real^3`;`u:real^3`][dist] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[COS_PI2; REAL_ARITH`A * &0= &0/\ A- &0= A`] +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[VECTOR_ARITH`u - &1 / &2 % (u + x)= &1 / &2 % (u - x)`;NORM_MUL;REAL_ARITH`abs(&1/ &2)= &1/ &2`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[REAL_ARITH`&1/ &2 *A=A/ &2`] +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ARITH`(A+B)-B=A`;REAL_LE_POW_2]; +SUBGOAL_THEN`&0< a2 pow 2 - (b / &2) pow 2` ASSUME_TAC; +MRESAL_TAC CONGRUENT_TRIANGLES_SSS[`w:real^3`;`y1:real^3`;`u:real^3`;`w:real^3`;`y1:real^3`;`x:real^3`][dist] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[VECTOR_ARITH`(&1 / &2) % (u + x) - u = &1 / &2 % (x - u) /\ (&1 / &2) % (u + x) - x = (&1 / &2) % (u -x) `;NORM_MUL;] +THEN SIMP_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESAL_TAC ANGLES_ALONG_LINE[`u:real^3`;`x:real^3`;`y1:real^3`;`w:real^3`][BETWEEN_IN_SEGMENT] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ANGLE_SYM] +THEN ASM_REWRITE_TAC[REAL_ARITH`A+A= B <=> A= B/ &2`] +THEN STRIP_TAC +THEN MRESAL_TAC LAW_OF_COSINES[`y1:real^3`;`w:real^3`;`u:real^3`][dist] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[COS_PI2; REAL_ARITH`A * &0= &0/\ A- &0= A`] +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[VECTOR_ARITH`u - &1 / &2 % (u + x)= &1 / &2 % (u - x)`;NORM_MUL;REAL_ARITH`abs(&1/ &2)= &1/ &2`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[REAL_ARITH`&1/ &2 *A=A/ &2`] +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ARITH`(A+B)-B=A`;REAL_LE_POW_2; GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT] +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`y1:real^3`;`w:real^3`][REAL_EQ_MUL_LCANCEL]; +MRESA1_TAC SQRT_WORKS`a2 pow 2 - (b / &2) pow 2` +THEN +MRESA1_TAC SQRT_POS_LT`a2 pow 2 - (b / &2) pow 2` +THEN SUBGOAL_THEN`&0<= b1 * inv (norm(v1- v:real^3))`ASSUME_TAC; +MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_INV +THEN REWRITE_TAC[NORM_POS_LE]; +MRESAL_TAC Planarity.IMP_NORM_FAN[`x:real^3`;`u:real^3`][REAL_EQ_MUL_LCANCEL] +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`v:real^3`;`u:real^3`][REAL_EQ_MUL_LCANCEL] +THEN SUBGOAL_THEN`~(v1=v:real^3)` ASSUME_TAC; +EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`(a1 * inv b) % (x-u) + u = v<=> (a1 * inv b) % ( x-u) = v-u`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`(a1 * inv b) % (x-u) = v - u:real^3 +==> norm((a1 * inv b) % ( x-u)) = norm( v - u)`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[NORM_MUL] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[REAL_ARITH`(a*b)*c= a*(b*c)`;REAL_ABS_MUL] +THEN MRESAL1_TAC REAL_ABS_REFL`inv b:real`[REAL_ARITH`A* &1=A`] +THEN MRESAL_TAC LAW_OF_COSINES[`u:real^3`;`v:real^3`;`x:real^3`][dist] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[REAL_ARITH`t pow 2 = (a pow 2 + b pow 2) - &2 * a * b * cos (angle (v,u,x))<=> a pow 2 + b pow 2 -t pow 2= &2 * a * b * cos (angle (v,u,x)) `] +THEN STRIP_TAC +THEN EXPAND_TAC"a1" +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;REAL_ABS_MUL;REAL_ARITH`(&2*A)/ &2=A`]) +THEN ASM_REWRITE_TAC[REAL_ABS_MUL] +THEN MRESAL1_TAC REAL_ABS_REFL`b:real`[REAL_ARITH`A* &1=A`] +THEN MRESAL1_TAC REAL_ABS_REFL`a:real`[REAL_ARITH`A* &1=A`] +THEN ASM_REWRITE_TAC[REAL_ARITH`A *B* C*D=(A*C) *B*D /\ &1*A=A`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`a * abs (cos (angle (v,u,x:real^3))) = a +==> inv(a) * (a * abs (cos (angle (v,u,x)))) = inv a * a`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[REAL_ARITH`A*B*C=(A*B)*C/\ &1 *A =A`] +THEN DISJ_CASES_TAC(REAL_ARITH`&0<= cos (angle (v,u,x:real^3)) \/ &0<= -- cos (angle (v,u,x))`); +MRESAL1_TAC REAL_ABS_REFL`cos (angle (v,u,x:real^3))`[REAL_ARITH`A* &1=A`] +THEN STRIP_TAC +THEN ASSUME_TAC(PI_WORKS) +THEN MP_TAC(REAL_ARITH`&0< pi==> &0<= pi`) +THEN RESA_TAC +THEN MRESAL_TAC COS_INJ_PI[`angle (v,u,x:real^3)`;`&0`][COS_0;ANGLE_RANGE;REAL_ARITH`&0<= &0`] +THEN MRESA_TAC COLLINEAR_ANGLE[`v:real^3`;`u:real^3`;`x:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC; +MRESAL1_TAC REAL_ABS_REFL`-- cos (angle (v,u,x:real^3))`[REAL_ARITH`--A= &1<=> A= -- &1`;REAL_ABS_NEG] +THEN STRIP_TAC +THEN ASSUME_TAC(PI_WORKS) +THEN MP_TAC(REAL_ARITH`&0< pi==> &0<= pi`) +THEN RESA_TAC +THEN MRESAL_TAC COS_INJ_PI[`angle (v,u,x:real^3)`;`pi`][COS_PI;ANGLE_RANGE;REAL_ARITH`pi<= pi`] +THEN MRESA_TAC COLLINEAR_ANGLE[`v:real^3`;`u:real^3`;`x:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC; +MRESAL_TAC Planarity.IMP_NORM_FAN[`v1:real^3`;`v:real^3`][REAL_EQ_MUL_LCANCEL] +THEN SUBGOAL_THEN`angle(v,u,x)= angle(v,u,y1:real^3)`ASSUME_TAC; +MRESA_TAC ANGLE_EQ[`v:real^3`;`u:real^3`;`x:real^3`;`v:real^3`;`u:real^3`;`y1:real^3`] +THEN EXPAND_TAC"y1" +THEN ASM_REWRITE_TAC[VECTOR_ARITH`&1 / &2 % (u + x) - u= &1 / &2 % ( x - u)`;NORM_MUL;REAL_ARITH`abs(&1/ &2) *A=A/ &2`;REAL_ARITH`(A+B)- &2 * C= A-B<=> B=C`;DOT_RMUL] +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`~(v=w1:real^3)` ASSUME_TAC; +EXPAND_TAC"w1" +THEN REWRITE_TAC[VECTOR_ARITH`v = (b1 * inv (norm (v1 - v))) % (v1 - v) + y1 +<=> v- y1 = (b1 * inv (norm (v1 - v))) % (v1 - v) `] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`v - y1 = (b1 * inv (norm (v1 - v))) % (v1 - v):real^3 +==> norm(v - y1) = norm( (b1 * inv (norm (v1 - v))) % (v1 - v))`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN ASSUME_TAC (SYM th)) +THEN REWRITE_TAC[NORM_MUL] +THEN MRESA1_TAC REAL_ABS_REFL`b1 * inv (norm(v1- v:real^3))` +THEN ASM_REWRITE_TAC[REAL_ARITH`(A*B)*C=A*(B*C)/\ A* &1= A`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`norm (v - y1:real^3) = b1 +==> norm (v - y1) pow 2= b1 pow 2`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN ASSUME_TAC (SYM th)) +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC LAW_OF_COSINES[`u:real^3`;`v:real^3`;`y1:real^3`][dist] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"y1" +THEN ASM_REWRITE_TAC[VECTOR_ARITH`&1 / &2 % (u + x) - u= &1 / &2 % ( x - u)`;NORM_MUL;REAL_ARITH`abs(&1/ &2) *A=A/ &2`;REAL_ARITH`(A+B)- &2 * C= A-B<=> B=C`] +THEN MRESAL_TAC LAW_OF_COSINES[`u:real^3`;`v:real^3`;`x:real^3`][dist] +THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th] THEN MP_TAC th) +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[REAL_ARITH`t pow 2 = (a pow 2 + b pow 2) - &2 * a * b * cos (angle (v,u,y1)) +<=> a * b / &2* cos (angle (v,u,y1))= (a pow 2 + b pow 2- t pow 2 )/ &4`] +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ARITH`(a pow 2 + (b / &2) pow 2) - &2 * (a pow 2 + b pow 2 - t pow 2) / &4=t pow 2 - (b / &2) pow 2 <=> a pow 2 = t pow 2`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN ASM_TAC +THEN REWRITE_TAC[REAL_ARITH`A+B-A=B`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`inv b * b pow 2 / &2 = (inv b * b) * b / &2`) +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 *A=A`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN MP_TAC(VECTOR_ARITH`(b / &2 * inv b) % (x-u) + u= (inv b *b )/ &2 % (x-u) + u:real^3`) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`&1 / &2 % (x-u) + u= &1/ &2 %(u+x)`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[REAL_ARITH`norm (y1 - v) * inv (norm (y1 - v)) = inv (norm (y1 - v))* norm (y1 - v) `] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`&1 % (y1 - v) = v - y1<=> y1=v`]; +SUBGOAL_THEN`norm(v1-u:real^3) pow 2+ norm(v1- v) pow 2= norm(v-u:real^3) pow 2`ASSUME_TAC; +DISJ_CASES_TAC(SET_RULE`v1=u \/ ~(v1=u:real^3)`); +ASM_REWRITE_TAC[VECTOR_ARITH`A-A= vec 0`;NORM_0;REAL_ARITH`&0 pow 2+A= A`] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[]; +MRESAL_TAC LAW_OF_COSINES[`u:real^3`;`v:real^3`;`v1:real^3`][dist] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`((a1 * inv b) % (x - u) + u) - u= (a1 * inv b) % (x - u) `] +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC LAW_OF_COSINES[`u:real^3`;`v:real^3`;`x:real^3`][dist] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[REAL_ARITH`t pow 2 = (a pow 2 + b pow 2) - &2 * a * b * cos (angle (v,u,y1)) +<=> a * b * cos (angle (v,u,y1))= (a pow 2 + b pow 2- t pow 2) / &2 `] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`a * b * cos (angle (v,u,y1:real^3))= (a pow 2 + b pow 2- t pow 2) / &2 +==> inv b*(a * b * cos (angle (v,u,y1)))= inv b*((a pow 2 + b pow 2- t pow 2) / &2 )`) +THEN POP_ASSUM(fun th->GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[th]) +THEN REWRITE_TAC[REAL_ARITH`inv b * a * b * cos (angle (v,u,y1))= (inv b * b) * a * cos (angle (v,u,y1))`] +THEN ASM_REWRITE_TAC[NORM_MUL;REAL_ARITH`&1*A=A`;REAL_ABS_MUL;REAL_ABS_INV] +THEN MRESA1_TAC REAL_ABS_NORM`x-u:real^3` +THEN ASM_REWRITE_TAC[REAL_ARITH`A* &1=A /\ (A*B)*C=A*(B*C)/\ abs a pow 2= a pow 2`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`abs a1= a *cos(angle(v, u, v1:real^3))` ASSUME_TAC; +POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`&0 <= a1 \/ &0 <=(-- a1)`); +MRESA1_TAC REAL_ABS_REFL`a1:real` +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MATCH_MP_TAC(SET_RULE`angle (v,u,x) = angle (v,u,v1) +==> a * cos (angle (v,u,x)) = a * cos (angle (v,u,v1:real^3))`) +THEN MRESA_TAC ANGLE_EQ[`v:real^3`;`u:real^3`;`x:real^3`;`v:real^3`;`u:real^3`;`v1:real^3`] +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`((a1 * inv b) % (x - u) + u) - u +=(a1 * inv b) % (x - u)`;NORM_MUL;DOT_RMUL] +THEN ASM_REWRITE_TAC[NORM_MUL;REAL_ARITH`&1*A=A`;REAL_ABS_MUL;REAL_ABS_INV] +THEN REAL_ARITH_TAC; +MRESAL1_TAC REAL_ABS_REFL`--a1:real`[REAL_ABS_NEG] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;REAL_ARITH`--(A*B)=A*(-- B)`]) +THEN MRESAL1_TAC COS_PERIODIC_PI`-- angle(v,u,y1:real^3)`[COS_NEG] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;REAL_ARITH`--A+B=B-A`]) +THEN MATCH_MP_TAC(SET_RULE` angle (v,u,v1) =(pi -angle (v,u,y1) ) +==> a * cos (pi-angle (v,u,y1) ) = a * cos (angle (v,u,v1:real^3))`) +THEN MRESA_TAC (GEN_ALL ANGLE_EQ_PI_LEFT)[`v:real^3`;`v1:real^3`;`u:real^3`;`x:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ANGLE_SYM] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[ANGLE_SYM] +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[ANGLE_BETWEEN;BETWEEN_IN_SEGMENT;IN_SEGMENT] +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`( &1 - u1) % x + u1 % ((a1 * inv b) % (x - u) + u) += ( &1 - u1 *( &1-a1 * inv b)) % x + (u1 * ( &1- a1 * inv b)) % u`] +THEN EXISTS_TAC`inv (&1 - a1 * inv b)` +THEN STRIP_TAC; +REWRITE_TAC[REAL_LE_INV_EQ] +THEN MATCH_MP_TAC(REAL_ARITH`&0<= (-- a) *b ==> &0<= &1- a*b`) +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[]; +STRIP_TAC; +MATCH_MP_TAC REAL_INV_LE_1 +THEN MATCH_MP_TAC(REAL_ARITH`&0<= (-- a) *b ==> &1<= &1- a*b`) +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[]; +SUBGOAL_THEN`~( &1 - a1 * inv b = &0)`ASSUME_TAC; +MATCH_MP_TAC(REAL_ARITH`&0<= (-- a) *b ==> ~( &1- a*b= &0)`) +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[]; +MRESA1_TAC REAL_MUL_LINV`&1 - a1 * inv b` +THEN VECTOR_ARITH_TAC; +REWRITE_TAC[REAL_ARITH`&2 * a * abs a1 * inv b * b * cos (angle (v,u,v1)) += &2 * abs a1 * (inv b * b) *( a* cos (angle (v,u,v1)))`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;]) +THEN REAL_ARITH_TAC; +POP_ASSUM (fun th-> MP_TAC th +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`((a1 * inv b) % (x - u) + u) - u=(a1 * inv b) % (x - u) `;NORM_MUL] +THEN ASM_REWRITE_TAC[REAL_ARITH`(abs (a1 * inv b) * b) pow 2= (a1 * inv b * b) pow 2/\ a* &1=a`;REAL_ARITH`A+B=C<=> B=C-A`] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN SUBGOAL_THEN`~(w1=y1:real^3)`ASSUME_TAC; +EXPAND_TAC"w1" +THEN REWRITE_TAC[VECTOR_ARITH`(b1 * inv (norm (v1 - v))) % (v1 - v) + y1 = y1<=> (b1 * inv (norm (v1 - v))) % (v1 - v) = vec 0`;GSYM NORM_EQ_0;NORM_MUL;REAL_ABS_MUL] +THEN MRESA1_TAC REAL_ABS_REFL`b1:real` +THEN MRESA1_TAC REAL_ABS_REFL`inv (norm (v1 - v:real^3)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`(A*B)*C=A*(B*C)`] +THEN MP_TAC(REAL_ARITH`&0< b1==> ~(b1 * &1= &0)`) +THEN RESA_TAC; +SUBGOAL_THEN`(u-x) dot (v1- v:real^3)= &0` ASSUME_TAC; +DISJ_CASES_TAC(SET_RULE`v1=u\/ ~(u=v1:real^3)`); +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`(a1 * inv b) % (x - u) + u=u<=> (a1 * inv b) % (x - u) = vec 0`;GSYM NORM_EQ_0;NORM_MUL;REAL_ENTIRE;REAL_ABS_MUL] +THEN ASM_REWRITE_TAC[] +THEN MRESA1_TAC REAL_ABS_REFL`inv b:real` +THEN MP_TAC(REAL_ARITH`&0 < inv b /\ &0< inv a==> ~(inv b= &0)/\ ~(inv a= &0)`) +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ABS_ZERO] +THEN EXPAND_TAC"a1" +THEN REWRITE_TAC[REAL_ENTIRE;REAL_ABS_MUL] +THEN ASM_REWRITE_TAC[REAL_ARITH`(A+B-C) / &2= &0<=> A+B=C`] +THEN STRIP_TAC +THEN MRESAL_TAC LAW_OF_COSINES[`u:real^3`;`v:real^3`;`x:real^3`][dist;COS_ANGLE] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[real_div;REAL_ARITH`t pow 2 = t pow 2 - &2 * a * b * ((v - u) dot (x - u)) * inv (a * b)<=> a * b * ((v - u) dot (x - u)) * inv (a * b)= &0`;REAL_ENTIRE;] +THEN ASM_REWRITE_TAC[REAL_ENTIRE;REAL_INV_MUL] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`A-B= --(B-A):real^3`] +THEN ASM_REWRITE_TAC[DOT_LNEG;DOT_RNEG;DOT_SYM] +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC LAW_OF_COSINES[`v1:real^3`;`u:real^3`;`v:real^3`][dist;COS_ANGLE] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[real_div;REAL_INV_MUL;REAL_ARITH`a pow 2 = + a pow 2 - + &2 * + norm (u - v1) * + norm (v - v1) * + ((u - v1) dot (v - v1)) * + inv (norm (v1 - u)) * + inv (norm (v1 - v)) +<=> norm (u - v1) * + norm (v - v1) * + ((u - v1) dot (v - v1)) * + inv (norm (v1 - u)) * + inv (norm (v1 - v))= &0`;REAL_ENTIRE] +THEN MP_TAC(REAL_ARITH` &0 < norm (v1 - v)/\ &0< inv (norm (v1 - v))==> ~( norm (v1 - v:real^3)= &0)/\ ~(inv (norm (v1 - v))= &0)`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`v1:real^3`;`u:real^3`][REAL_EQ_MUL_LCANCEL] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN MP_TAC(REAL_ARITH` &0< inv (norm (v1 - u:real^3))==> ~(inv (norm (v1 - u))= &0)`) +THEN RESA_TAC +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`u - ((a1 * inv b) % (x - u) + u)= (a1 * inv b) % (--(x-u)) `;DOT_LMUL] +THEN ASM_REWRITE_TAC[REAL_ENTIRE] +THEN MP_TAC(REAL_ARITH`&0 < inv b /\ &0< inv a==> ~(inv b= &0)/\ ~(inv a= &0)`) +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`((a1 * inv b) % (x - u) + u)-u= (a1 * inv b) % ((x-u)) `;NORM_MUL] +THEN ASM_REWRITE_TAC[REAL_ENTIRE;REAL_ABS_ZERO] +THEN MP_TAC(REAL_ARITH`&0 < inv b /\ &0< inv a==> ~(inv b= &0)/\ ~(inv a= &0)`) +THEN RESA_TAC +THEN RESA_TAC +THEN REWRITE_TAC[DOT_LNEG;REAL_ARITH`--A = &0<=> A= &0`] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`A-B= --(B-A):real^3`] +THEN ASM_REWRITE_TAC[DOT_LNEG;DOT_RNEG;DOT_SYM] +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`norm(x- w1:real^3)=a2`ASSUME_TAC; +MRESAL_TAC DIST_EQ[`x:real^3`;`w1:real^3`;`x:real^3`;`w:real^3`][dist] +THEN MRESAL_TAC LAW_OF_COSINES[`y1:real^3`;`x:real^3`;`w1:real^3`][dist;COS_ANGLE] +THEN EXPAND_TAC"w1" +THEN REWRITE_TAC[VECTOR_ARITH`(y1 - ((b1 * inv (norm (v1 - v))) % (v1 - v) + y1))= -- ((b1 * inv (norm (v1 - v))) % (v1 - v)) /\ +(((b1 * inv (norm (v1 - v))) % (v1 - v) + y1) - y1)=(b1 * inv (norm (v1 - v))) % (v1 - v) `;NORM_NEG;NORM_MUL;REAL_ABS_MUL] +THEN MRESA1_TAC REAL_ABS_REFL`b1:real` +THEN MRESA1_TAC REAL_ABS_REFL`inv (norm (v1 - v:real^3)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`(A*B)*C=A*(B*C)/\ a* &1=a`;DOT_RMUL;] +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[VECTOR_ARITH`&1 / &2 % (u + x) - x= &1 / &2 % (u - x) `;NORM_MUL;VECTOR_ARITH`x - &1 / &2 % (u + x)= (-- &1 / &2) % (u - x)`;DOT_LMUL] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`norm(u- w1:real^3)=a2`ASSUME_TAC; +MRESAL_TAC DIST_EQ[`u:real^3`;`w1:real^3`;`u:real^3`;`w:real^3`][dist] +THEN MRESAL_TAC LAW_OF_COSINES[`y1:real^3`;`u:real^3`;`w1:real^3`][dist;COS_ANGLE] +THEN EXPAND_TAC"w1" +THEN REWRITE_TAC[VECTOR_ARITH`(y1 - ((b1 * inv (norm (v1 - v))) % (v1 - v) + y1))= -- ((b1 * inv (norm (v1 - v))) % (v1 - v)) /\ +(((b1 * inv (norm (v1 - v))) % (v1 - v) + y1) - y1)=(b1 * inv (norm (v1 - v))) % (v1 - v) `;NORM_NEG;NORM_MUL;REAL_ABS_MUL] +THEN MRESA1_TAC REAL_ABS_REFL`b1:real` +THEN MRESA1_TAC REAL_ABS_REFL`inv (norm (v1 - v:real^3)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`(A*B)*C=A*(B*C)/\ a* &1=a`;DOT_RMUL;] +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[VECTOR_ARITH`&1 / &2 % (u + x) - u= &1 / &2 % (x - u) `;NORM_MUL;VECTOR_ARITH`u - &1 / &2 % (u + x)= (&1 / &2) % (u - x)`;DOT_LMUL] +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`a1 * inv b<= &1/ &2`ASSUME_TAC; +MRESAL_TAC Planarity.IMP_NORM_FAN[`v:real^3`;`x:real^3`][REAL_EQ_MUL_LCANCEL] +THEN +MRESA_TAC Trigonometry2.POW2_COND[`a:real`;`t:real`] +THEN MP_TAC(REAL_ARITH`a pow 2 <= t pow 2 ==> (a pow 2 +b pow 2 - t pow 2)/ &2<= b pow 2 / &2`) +THEN RESA_TAC +THEN MRESA_TAC REAL_LE_LMUL[`inv b`;`(a pow 2 +b pow 2 - t pow 2)/ &2`;`b pow 2 / &2`] +THEN MRESAL_TAC REAL_LE_RMUL[`a1:real`;`inv b * b pow 2 / &2`;`inv b`][REAL_ARITH`(inv b * b pow 2 / &2) * inv b= (inv b * b) pow 2 / &2/\ &1 pow 2 = &1`]; +EXISTS_TAC`w1:real^3` +THEN EXISTS_TAC`y:real^3` +THEN STRIP_TAC; +ASM_REWRITE_TAC[INTER;IN_ELIM_THM;IN_SEGMENT] +THEN STRIP_TAC; +EXISTS_TAC`norm (v1 - v:real^3) * inv (norm (v1 - v) + b1)` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; +MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_INV +THEN MATCH_MP_TAC(REAL_ARITH`&0< A /\ &0< B==> &0< A+B`) +THEN ASM_REWRITE_TAC[]; +MP_TAC(REAL_ARITH`&0< b1 /\ &0< norm (v1-v)==>norm(v1-v:real^3) < norm (v1-v) +b1/\ ~(norm (v1-v) +b1= &0)/\ &0< norm (v1-v) +b1`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`(norm(v1-v:real^3)+b1)` +THEN MRESA1_TAC REAL_MUL_LINV`(norm(v1-v:real^3)+b1)` +THEN MRESA_TAC REAL_LT_LMUL[`inv(norm(v1-v:real^3)+b1)`;`norm(v1-v:real^3)`;`norm(v1-v:real^3)+b1`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B=B*A`] +THEN RESA_TAC; +SUBGOAL_THEN`~(y=v1:real^3)<=> ~(v1= y1)`ASSUME_TAC; +EXPAND_TAC"y" +THEN REWRITE_TAC[VECTOR_ARITH`(&1-a) %u+ a%v= x<=> (&1-a) %(u-x)= a%(x-v)`] +THEN EXPAND_TAC"w1" +THEN REWRITE_TAC[VECTOR_ARITH`v1 - ((b1 * inv (norm (v1 - v))) % (v1 - v) + y1) += (v1-y1) - ((b1 * inv (norm (v1 - v))) % (v1 - v))`;] +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`A%(B-C)= A%B-A%C`] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;REAL_ARITH`(norm (v1 - v) * inv (norm (v1 - v) + b1)) * b1 * inv (norm (v1 - v)) += inv (norm (v1 - v) + b1) * b1 * inv (norm (v1 - v)) *norm (v1 - v) /\ A * &1=A`] +THEN ONCE_REWRITE_TAC[ VECTOR_ARITH` A%B-A%C=A%(B-C)`] +THEN MP_TAC(REAL_ARITH`&0< b1 /\ &0< norm (v1-v)==>norm(v1-v:real^3) < norm (v1-v) +b1/\ ~(norm (v1-v) +b1= &0)/\ &0< norm (v1-v) +b1`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`(norm(v1-v:real^3)+b1)` +THEN MRESA1_TAC REAL_MUL_LINV`(norm(v1-v:real^3)+b1)` +THEN SUBGOAL_THEN`inv (norm (v1 - v:real^3) + b1) * b1 = (&1 - norm (v1 - v) * inv (norm (v1 - v) + b1))`ASSUME_TAC; +ASM_REWRITE_TAC[REAL_ARITH`inv (norm (v1 - v) + b1) * b1 = + &1 - norm (v1 - v) * inv (norm (v1 - v) + b1) +<=> inv (norm (v1 - v) + b1) *(norm(v1-v)+ b1) = + &1 `]; +ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - norm (v1 - v) * inv (norm (v1 - v) + b1)) % (v - v1) = + (norm (v1 - v) * inv (norm (v1 - v) + b1)) % (v1 - y1) - + (&1 - norm (v1 - v) * inv (norm (v1 - v) + b1)) % (v1 - v) +<=> + (norm (v1 - v) * inv (norm (v1 - v) + b1)) % (v1 - y1) = vec 0`;VECTOR_MUL_EQ_0] +THEN MRESA_TAC REAL_LT_MUL[`norm(v1-v:real^3)`;`inv (norm (v1 - v:real^3) + b1)`] +THEN MP_TAC(REAL_ARITH` +&0< norm (v1 - v) * inv (norm (v1 - v) + b1) +==> +~(norm (v1 - v) * inv (norm (v1 - v:real^3) + b1) = &0)`) +THEN RESA_TAC +THEN REWRITE_TAC[VECTOR_ARITH`A-B= vec 0<=> A=B`]; +POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`(v1 = y1) \/ ~(v1 = y1:real^3)`); +ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN EXISTS_TAC`&1/ &2` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1/ &2/\ &1/ &2< &1`;VECTOR_ARITH`(&1 - &1 / &2) % x + &1 / &2 % u= &1/ &2 %(u+x)`]; +RESA_TAC +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`y:real^3`;`v1:real^3`][REAL_EQ_MUL_LCANCEL] +THEN EXISTS_TAC`(&1 - norm (v1 - v) * inv (norm (v1 - v:real^3) + b1)) * (&1 / &2 - a1 * inv b) + &1/ &2` +THEN ONCE_REWRITE_TAC[SET_RULE`A/\B/\C<=> C/\A/\B`] +THEN STRIP_TAC; +REWRITE_TAC[VECTOR_ARITH`y= (&1-u) %A+u%B<=> y-A= u%(B-A)`] +THEN EXPAND_TAC"y" +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[VECTOR_ARITH`((&1-u) %A+u%B)-y= (&1-u) %(A-y)+u%(B-y)`;NORM_MUL] +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"w1" +THEN REWRITE_TAC[VECTOR_ARITH`A%((B+C)-D)=A%B+A%(C-D)/\ A%E%B=(A*E)%B`;REAL_ARITH`(norm (v1 - v) * inv (norm (v1 - v) + b1)) * b1 * inv (norm (v1 - v)) +=inv (norm (v1 - v) + b1) * b1 * inv (norm (v1 - v)) *norm (v1 - v) `] +THEN ASM_REWRITE_TAC[REAL_ARITH`a* &1= a`] +THEN MP_TAC(REAL_ARITH`&0< b1 /\ &0< norm (v1-v)==>norm(v1-v:real^3) < norm (v1-v) +b1/\ ~(norm (v1-v) +b1= &0)/\ &0< norm (v1-v) +b1`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`(norm(v1-v:real^3)+b1)` +THEN MRESA1_TAC REAL_MUL_LINV`(norm(v1-v:real^3)+b1)` +THEN SUBGOAL_THEN`inv (norm (v1 - v:real^3) + b1) * b1 = (&1 - norm (v1 - v) * inv (norm (v1 - v) + b1))`ASSUME_TAC; +ASM_REWRITE_TAC[REAL_ARITH`inv (norm (v1 - v) + b1) * b1 = + &1 - norm (v1 - v) * inv (norm (v1 - v) + b1) +<=> inv (norm (v1 - v) + b1) *(norm(v1-v)+ b1) = + &1 `;]; +ASM_REWRITE_TAC[VECTOR_ARITH`A%(v-x)+ A%(y-v)+c= A%(y-x)+c`] +THEN EXPAND_TAC"y1" +THEN REWRITE_TAC[VECTOR_ARITH`&1 / &2 % (u + x) - x= &1/ &2 %(u-x)`] +THEN REWRITE_TAC[VECTOR_ARITH`(&1 - norm (v1 - v) * inv (norm (v1 - v) + b1)) % (v1 - x) + + (norm (v1 - v) * inv (norm (v1 - v) + b1)) % &1 / &2 % (u - x) = + ((&1 - norm (v1 - v) * inv (norm (v1 - v) + b1)) * (&1 / &2 - a1 * inv b) + &1 / &2) % (u - x) +<=> (&1 - norm (v1 - v) * inv (norm (v1 - v) + b1)) % (v1 - &1/ &2 %(x+u)) = + ((&1 - norm (v1 - v) * inv (norm (v1 - v) + b1)) * (&1 / &2 - a1 * inv b)) % (u - x) +`] +THEN EXPAND_TAC"v1" +THEN REWRITE_TAC[VECTOR_ARITH`((a1 * inv b) % (x - u) + u) - &1 / &2 % (x + u) += (&1/ &2- a1 * inv b) % (u-x) `] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`]; +STRIP_TAC; +MATCH_MP_TAC(REAL_ARITH`&0<=A ==> &0< A+ &1/ &2`) +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(REAL_ARITH`&0< b1 /\ &0< norm (v1-v)==>norm(v1-v:real^3) < norm (v1-v) +b1/\ ~(norm (v1-v) +b1= &0)/\ &0<= norm (v1-v) +b1`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LE_INV`(norm(v1-v:real^3)+b1)` +THEN MRESA1_TAC REAL_MUL_LINV`(norm(v1-v:real^3)+b1)` +THEN SUBGOAL_THEN`inv (norm (v1 - v:real^3) + b1) * b1 = (&1 - norm (v1 - v) * inv (norm (v1 - v) + b1))`ASSUME_TAC; +ASM_REWRITE_TAC[REAL_ARITH`inv (norm (v1 - v) + b1) * b1 = + &1 - norm (v1 - v) * inv (norm (v1 - v) + b1) +<=> inv (norm (v1 - v) + b1) *(norm(v1-v)+ b1) = + &1 `;]; +POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC; +MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[REAL_ARITH`&0<= A-B<=> B<=A`]; +SUBGOAL_THEN`&0< a1 * inv b`ASSUME_TAC; +MRESAL_TAC Planarity.IMP_NORM_FAN[`v:real^3`;`x:real^3`][REAL_EQ_MUL_LCANCEL] +THEN +MRESA_TAC Trigonometry2.POW2_COND[`t:real`;`b:real`] +THEN MP_TAC(REAL_ARITH`t pow 2 <= b pow 2 /\ &0< a pow 2 ==> &0< (a pow 2 +b pow 2 - t pow 2)/ &2`) +THEN ASM_REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT] +THEN STRIP_TAC +THEN MRESA_TAC REAL_LT_MUL[`inv b`;`(a pow 2 +b pow 2 - t pow 2)/ &2`] +THEN MRESA_TAC REAL_LT_MUL[`a1:real`;`inv b`]; +MP_TAC(REAL_ARITH`&0< a1 * inv b==>(&1 / &2 - a1 * inv b)< &1/ &2`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0< b1 /\ &0< norm (v1-v:real^3)==>b1 < norm (v1-v) +b1/\ ~(norm (v1-v) +b1= &0)/\ &0< norm (v1-v) +b1 /\ &0<= norm (v1-v) +b1`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`(norm(v1-v:real^3)+b1)` +THEN MRESA1_TAC REAL_LE_INV`(norm(v1-v:real^3)+b1)` +THEN MRESA1_TAC REAL_MUL_LINV`(norm(v1-v:real^3)+b1)` +THEN SUBGOAL_THEN`inv (norm (v1 - v:real^3) + b1) * b1 = (&1 - norm (v1 - v) * inv (norm (v1 - v) + b1))`ASSUME_TAC; +ASM_REWRITE_TAC[REAL_ARITH`inv (norm (v1 - v) + b1) * b1 = + &1 - norm (v1 - v) * inv (norm (v1 - v) + b1) +<=> inv (norm (v1 - v) + b1) *(norm(v1-v)+ b1) = + &1 `;]; +POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC REAL_LT_LMUL[`inv (norm (v1 - v:real^3) + b1)`;`b1:real`;`norm (v1 - v:real^3) + b1`] +THEN MRESA_TAC REAL_LE_MUL[`inv (norm (v1 - v:real^3) + b1)`;`b1:real`] +THEN MRESAL_TAC Real_ext.REAL_PROP_LT_LRMUL[`(inv (norm (v1 - v:real^3) + b1) * b1)`;`&1`;`(&1 / &2 - a1 * inv b)`;`&1/ &2`][REAL_ARITH`&0<= A-B<=> B<=A`] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[]]);; + + + + + + + + + + + + + + + + + + +let TWO_DIAGONAL_AT_MOST1=prove_by_refinement(` t<= &2 /\ &0< t +==> +?u w:real^3 v x y. +~(v=x)/\ ~(v=u) /\ ~(v=w) /\ ~(x=u)/\ ~(x=w) /\ ~(u=w) +/\ norm(v-x)=t +/\ norm(v-u)= &2 +/\ norm(x-w)= &2 +/\ norm(u-w)= &2 +/\ y IN segment(v,w) INTER segment (x,u) +/\ norm(v-w)= norm(x-u) +/\ (t<= norm(v-w) ==> norm(v-w)<= &1 + sqrt( &5) /\ t<= &1 + sqrt( &5))`, +[REPEAT STRIP_TAC +THEN ABBREV_TAC`b=(&1- t/ &2)` +THEN ABBREV_TAC`c=(&1+ t/ &2)` +THEN ABBREV_TAC`d=(sqrt(&4- (&1- t/ &2) pow 2))` +THEN ABBREV_TAC`e= &2* inv(t+ &2) * d` +THEN MP_TAC(REAL_ARITH`t<= &2 /\ &0< t==> &0<= (&1- t/ &2) /\ (&1- t/ &2)<= &2/\ ~((&1- t/ &2)= &2) /\ ~(t+ &2= &0)/\ &0<= t/\ (&1- t/ &2) -(&1+ t/ &2) = -- t +/\ (&1+ t/ &2) - &2 = -- (&1- t/ &2) /\ &0< t+ &2 /\ (&1- t/ &2) - &2 = -- (&1+ t/ &2)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`&0<= &4- (&1- t/ &2) pow 2` ASSUME_TAC; +REWRITE_TAC[REAL_ARITH`&0<= A- B<=> B<=A`] +THEN MATCH_MP_TAC REAL_RSQRT_LE +THEN MRESAL_TAC SQRT_UNIQUE[`&4`;`&2`][REAL_ARITH`&0<= &2 /\ &2 pow 2= &4`] +THEN ASM_REWRITE_TAC[REAL_ARITH`&0 <= &1- t/ &2 <=> t<= &2`; REAL_ARITH`t / &2 - &1 <= &2 <=> t<= &6`; REAL_ARITH`&0 <= &4`] +THEN MP_TAC(REAL_ARITH`t<= &2==> t <= &6`) +THEN RESA_TAC; +SUBGOAL_THEN`~(&4- (&1- t/ &2) pow 2= &0)` ASSUME_TAC; +REWRITE_TAC[REAL_ARITH`A-B= &0 <=> B=A`] +THEN STRIP_TAC +THEN MRESAL_TAC Collect_geom.EQ_POW2_COND[` &1- t/ &2`;`&2`][REAL_ARITH`&2 pow 2= &4/\ &0<= &2`;REAL_ARITH`&0 <= t / &2 - &1<=> &2<= t`;REAL_ARITH`t / &2 - &1 = &2<=> t= &6`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`t<= &4==> ~(t = &6)`) +THEN RESA_TAC; +SUBGOAL_THEN`b pow 2 + d pow 2= &4`ASSUME_TAC; +MRESA1_TAC SQRT_POW_2`&4- (&1- t/ &2) pow 2` +THEN EXPAND_TAC"b" +THEN REAL_ARITH_TAC; +MRESA1_TAC SQRT_EQ_0`&4- (&1- t/ &2) pow 2` +THEN SUBGOAL_THEN`&1 - t * inv (t + &2) = &2 * inv (t + &2)` ASSUME_TAC; +REWRITE_TAC[REAL_ARITH`A-B *D=C *D<=> D *(B+C)= A`] +THEN MATCH_MP_TAC REAL_MUL_LINV +THEN ASM_REWRITE_TAC[]; +EXISTS_TAC`vec 0:real^3` +THEN EXISTS_TAC`(vector[&2; &0; &0]):real^3` +THEN EXISTS_TAC`(vector[b; d; &0]):real^3` +THEN EXISTS_TAC`(vector[c; d; &0]):real^3` +THEN EXISTS_TAC`(vector[&1;e; &0]):real^3` +THEN STRIP_TAC; +SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH] +THEN EXPAND_TAC"b" +THEN EXPAND_TAC"c" +THEN REWRITE_TAC[REAL_ARITH`&1 - t / &2 = &1 + t / &2 <=> t= &0`] +THEN MP_TAC(REAL_ARITH`&0 ~(t= &0)`) +THEN RESA_TAC; +STRIP_TAC; +SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH] +THEN EXPAND_TAC"b" +THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - t / &2= &0 <=> t= &2`;REAL_ARITH`&1 + t / &2= &0 <=> t= -- &2`;DE_MORGAN_THM]; +STRIP_TAC; +ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;DE_MORGAN_THM]; +STRIP_TAC; +ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;DE_MORGAN_THM]; +STRIP_TAC; +ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;DE_MORGAN_THM]; +STRIP_TAC; +ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;DE_MORGAN_THM;REAL_ARITH`~(&0= &2)`]; +STRIP_TAC; +ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA; FORALL_3; SUM_3; DIMINDEX_3; VECTOR_3; + vector_add; vec; dot; cross; orthogonal; basis; NORM_EQ_SQUARE; + vector_neg; vector_sub; vector_mul; ARITH;] +THEN REAL_ARITH_TAC; +STRIP_TAC; +ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA; FORALL_3; SUM_3; DIMINDEX_3; VECTOR_3; + vector_add; vec; dot; cross; orthogonal; basis; NORM_EQ_SQUARE; + vector_neg; vector_sub; vector_mul; ARITH;VECTOR_ARITH`A- vec 0=A`; +REAL_ARITH`&0<= &2 /\ a * a= a pow 2/\ A+ &0 pow 2=A/\ &2 pow 2= &4`]; +STRIP_TAC; +ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA; FORALL_3; SUM_3; DIMINDEX_3; VECTOR_3; + vector_add; vec; dot; cross; orthogonal; basis; NORM_EQ_SQUARE; + vector_neg; vector_sub; vector_mul; ARITH; +REAL_ARITH`&0<= &2 /\ --a * --a= a pow 2/\ A- &0 =A/\ A+ &0 * &0=A/\ &2 pow 2= &4`] +THEN ASM_REWRITE_TAC[REAL_ARITH`b * b= b pow 2`]; +STRIP_TAC; +ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA; FORALL_3; SUM_3; DIMINDEX_3; VECTOR_3; + vector_add; vec; dot; cross; orthogonal; basis; NORM_EQ_SQUARE; + vector_neg; vector_sub; vector_mul; ARITH;VECTOR_ARITH`A- vec 0=A`; +REAL_ARITH`&0<= &2 /\ a * a= a pow 2/\ A+ &0 pow 2=A/\ &2 pow 2= &4`]; +STRIP_TAC; +REWRITE_TAC[INTER;IN_SEGMENT;IN_ELIM_THM] +THEN STRIP_TAC; +STRIP_TAC; +ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;DE_MORGAN_THM]; +EXISTS_TAC`t * inv(t+ &2)` +THEN STRIP_TAC; +MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_INV +THEN ASM_REWRITE_TAC[]; +STRIP_TAC; +MATCH_MP_TAC REAL_LT_RCANCEL_IMP +THEN MRESA1_TAC REAL_MUL_LINV`t + &2` +THEN EXISTS_TAC`t+ &2` +THEN ASM_REWRITE_TAC[REAL_ARITH`(A *B) * C= A *(B*C)`] +THEN REAL_ARITH_TAC; +ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA; FORALL_3; SUM_3; DIMINDEX_3; VECTOR_3; + vector_add; vec; dot; cross; orthogonal; basis; NORM_EQ_SQUARE; + vector_neg; vector_sub; vector_mul; ARITH;REAL_ARITH`A * &0= &0 /\ a+ &0 = a/\ (a*b)*c=a *b*c`;REAL_ARITH`&2 * inv (t + &2) * b + t * inv (t + &2) * &2= &2 * inv (t + &2) * (b+t)`] +THEN EXPAND_TAC"b" +THEN REWRITE_TAC[REAL_ARITH`&1 = &2 * inv (t + &2) * (&1 - t / &2 + t) +<=> inv (t + &2) * (t + &2)= &1`] +THEN MRESA1_TAC REAL_MUL_LINV`t + &2`; +STRIP_TAC; +ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;DE_MORGAN_THM]; +EXISTS_TAC`t * inv(t+ &2)` +THEN STRIP_TAC; +MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_INV +THEN ASM_REWRITE_TAC[]; +STRIP_TAC; +MATCH_MP_TAC REAL_LT_RCANCEL_IMP +THEN MRESA1_TAC REAL_MUL_LINV`t + &2` +THEN EXISTS_TAC`t+ &2` +THEN ASM_REWRITE_TAC[REAL_ARITH`(A *B) * C= A *(B*C)`] +THEN REAL_ARITH_TAC; +ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA; FORALL_3; SUM_3; DIMINDEX_3; VECTOR_3; + vector_add; vec; dot; cross; orthogonal; basis; NORM_EQ_SQUARE; + vector_neg; vector_sub; vector_mul; ARITH;REAL_ARITH`A * &0= &0 /\ a+ &0 = a/\ (a*b)*c=a *b*c`;REAL_ARITH`&2 * inv (t + &2) * b + t * inv (t + &2) * &2= &2 * inv (t + &2) * (b+t)`] +THEN EXPAND_TAC"c" +THEN REWRITE_TAC[REAL_ARITH`&1 = &2 * inv (t + &2) * (&1 + t / &2) +<=> inv (t + &2) * (t + &2)= &1`] +THEN MRESA1_TAC REAL_MUL_LINV`t + &2`; +STRIP_TAC; +ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA; FORALL_3; SUM_3; DIMINDEX_3; VECTOR_3; + vector_add; vec; dot; cross; orthogonal; basis; NORM_EQ; + vector_neg; vector_sub; vector_mul; ARITH;REAL_ARITH`A * &0= &0 /\ a+ &0 = a/\ (a*b)*c=a *b*c`;REAL_ARITH`a- &0=a `;VECTOR_ARITH`A- vec 0=A`] +THEN REAL_ARITH_TAC; +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[REAL_ARITH`a<=b <=> b>=a`] +THEN ASM_SIMP_TAC[CART_EQ; LAMBDA_BETA; FORALL_3; SUM_3; DIMINDEX_3; VECTOR_3; + vector_add; vec; dot; cross; orthogonal; basis; NORM_LE_SQUARE;NORM_GE_SQUARE; + vector_neg; vector_sub; vector_mul; ARITH;REAL_ARITH`A * &0= &0 /\ a+ &0 = a/\ (a*b)*c=a *b*c/\ --c * --c + d * d= c pow 2 + d pow 2`;REAL_ARITH`a- &0=a `;VECTOR_ARITH`A- vec 0=A`] +THEN MRESA1_TAC SQRT_POW_2`&4 - (&1- t/ &2) pow 2` +THEN MRESAL1_TAC SQRT_POW_2`(&5)`[REAL_ARITH`&0<= &5`;REAL_ARITH`(&1 + sqrt (&5)) pow 2= &1 + &2 * sqrt(&5) + sqrt(&5) pow 2`] +THEN MP_TAC(REAL_ARITH`&0< t==> ~(t<= &0)`) +THEN RESA_TAC +THEN EXPAND_TAC"b" +THEN EXPAND_TAC"c" +THEN REWRITE_TAC[REAL_ARITH`(&1 + t / &2) pow 2 + &4 - (&1- t/ &2) pow 2 += &4 + &2 * t`;REAL_ARITH`&4 + &2 * t <= &1 + &2 * sqrt (&5) + &5<=> t <= &1 + sqrt( &5) `; REAL_ARITH`&4 + &2 * t >= t pow 2<=> (t- &1) pow 2<= &5`] +THEN STRIP_TAC +THEN MRESAL_TAC REAL_LE_RSQRT[`t- &1`;`&5`][REAL_ARITH`A-B<= C<=> A<= B+C`] +THEN MRESAL1_TAC SQRT_POS_LE`&5`[REAL_ARITH`&0<= &5`] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]);; + + + + + + + + +let VPWSHTO1=prove_by_refinement(`!v x:real^3 u w:real^3. +t<= &4 /\ ~(collinear{v,x,u}) +/\ ~(collinear{w,x,u}) +/\ ~(v=w) +/\ norm(v-x)=t +/\ norm(v-u)= &2 +/\ norm(x-w)= &2 +/\ norm(u-w)= &2 +/\ t<= norm(x-u) +/\ t<= norm(v-w) +==> min (norm(v-w)) (norm(x-u))<= &1 + sqrt(&5)/\ t<= &1 + sqrt(&5)`, +[REPEAT GEN_TAC +THEN STRIP_TAC +THEN MRESA_TAC th3[`v:real^3`;`x:real^3`;`u:real^3`] +THEN MRESA_TAC th3[`w:real^3`;`x:real^3`;`u:real^3`] +THEN MRESA_TAC th3[`x:real^3`;`w:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{x,w,u}={w,x,u}`] +THEN RESA_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`&2<= t \/ t<= &2`); +MRESA_TAC MAX_IF_COPLANAR[`v:real^3`;`x:real^3`;`u:real^3`;`w:real^3`;`&2`;`t:real`] +THEN SUBGOAL_THEN`~(x =w1:real^3)` ASSUME_TAC; +STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`A-A= vec 0`;NORM_0] +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`~(u =w1:real^3)` ASSUME_TAC; +STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`A-A= vec 0`;NORM_0] +THEN REAL_ARITH_TAC; +MRESA_TAC (GEN_ALL MAX_COPLANAR_4POINT)[`t:real`;`y:real^3`;`&2`;`v:real^3`;`x:real^3`;`u:real^3`;`w1:real^3`;`w:real^3`] +THEN MRESA1_TAC (GEN_ALL TWO_DIAGONAL_AT_MOST)`t:real` +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL EQ_DIAGONAL_MIN)[`y':real^3`;`t:real`;`&2`;`y:real^3`;`v':real^3`;`v:real^3`;`x':real^3`;`x:real^3`;`u':real^3`;`w':real^3`;`u:real^3`;`w1:real^3`] +THEN MP_TAC(REAL_ARITH`min (norm (v - w1)) (norm (x - u)) <= norm (x' - u') +/\ min (norm (v - w:real^3)) (norm (x - u)) <= min (norm (v - w1)) (norm (x - u:real^3)) +/\ t<= norm (v - w) /\ t <= norm (x - u) +==> min (norm (v - w)) (norm (x - u)) <= norm (x' - u':real^3)/\ t<= norm (x' - u':real^3) `) +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +MRESAL_TAC Planarity.IMP_NORM_FAN[`v:real^3`;`x:real^3`][REAL_EQ_MUL_LCANCEL] +THEN DISJ_CASES_TAC (REAL_ARITH`norm (u - x:real^3)< &2\/(&2 <= norm (u - x))`); +SUBGOAL_THEN`&2<= &1+ sqrt(&5)` ASSUME_TAC; +REWRITE_TAC[REAL_ARITH`&2<= &1+ sqrt(&5)<=> &1<= sqrt(&5)`] +THEN MATCH_MP_TAC REAL_LE_RSQRT +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +MRESA_TAC MAX_IF_COPLANAR1[`v:real^3`;`u:real^3`;`x:real^3`;`w:real^3`;`t:real`;`&2:real`;`&2`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN SUBGOAL_THEN`~(x =w1:real^3)` ASSUME_TAC; +STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`A-A= vec 0`;NORM_0] +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`~(u =w1:real^3)` ASSUME_TAC; +STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`A-A= vec 0`;NORM_0] +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`y IN segment (v,w1) INTER segment (x,u:real^3)` ASSUME_TAC; +ASM_TAC +THEN REWRITE_TAC[INTER;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SEGMENT_SYM] +THEN ASM_REWRITE_TAC[]; +MRESA_TAC (GEN_ALL MAX_COPLANAR_4POINT)[`t:real`;`y:real^3`;`&2`;`v:real^3`;`x:real^3`;`u:real^3`;`w1:real^3`;`w:real^3`] +THEN MRESA1_TAC (GEN_ALL TWO_DIAGONAL_AT_MOST1)`t:real` +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL EQ_DIAGONAL_MIN)[`y':real^3`;`t:real`;`&2`;`y:real^3`;`v':real^3`;`v:real^3`;`x':real^3`;`x:real^3`;`u':real^3`;`w':real^3`;`u:real^3`;`w1:real^3`] +THEN MP_TAC(REAL_ARITH`min (norm (v - w1)) (norm (x - u)) <= norm (x' - u') +/\ min (norm (v - w:real^3)) (norm (x - u)) <= min (norm (v - w1)) (norm (x - u:real^3)) +/\ t<= norm (v - w) /\ t <= norm (x - u) +==> min (norm (v - w)) (norm (x - u)) <= norm (x' - u':real^3)/\ t<= norm (x' - u':real^3) `) +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]);; + + + + + + +let VPWSHTO200=prove_by_refinement( +`!v x:real^3 u w:real^3 w1. +~(collinear{v,x,u}) +/\ ~(collinear{w,x,u}) +/\ ~(collinear{w1,x,u}) +/\ ~(collinear{w,v,u}) +/\ ~(collinear{w1,v,u}) +/\ ~(collinear{w1,w,u}) +/\ ~(collinear{w,v,x}) +/\ ~(collinear{w1,v,x}) +/\ ~(collinear{w1,w,x}) +/\ ~(collinear{w1,w,v}) +/\ norm(v-x)= &2 +/\ norm(x-u)= &2 +/\ norm(u-w)= &2 +/\ norm(w-w1)= &2 +/\ norm(w1-v)= &2 +/\ norm(v-u)<= norm(v-w) +/\ norm(v-u)<= norm(u-w1) +/\ norm(v-u)<= norm(w1-x) +/\ norm(v-u)<= norm(x-w) +==> ?w2. w2 IN {v,x,u,w,w1}/\ ~(x=w2) +/\ norm(v-u) <= &1 + sqrt(&5)/\ + ((~(w1=w2) /\ norm(v-w2)<= &1 + sqrt(&5)) \/ (~(w=w2) /\ norm(u-w2)<= &1 + sqrt(&5)))`, +[REPEAT STRIP_TAC +THEN MRESAL_TAC NORM_TRIANGLE[`v-x:real^3`;`x-u:real^3`][VECTOR_ARITH`v-x+x-u=v-u:real^3`;REAL_ARITH`&2+ &2= &4`] +THEN MRESA_TAC (GEN_ALL VPWSHTO1)[`norm(v-u:real^3)`;`v:real^3`;`u:real^3`;`w1:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC th3[`w:real^3`;`v:real^3`;`u:real^3`] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`norm(w1-u) <= norm(w-v:real^3)\/ norm(w-v) <= norm(w1-u:real^3)`); +MP_TAC(REAL_ARITH`norm (w1 - u) <= norm (w - v:real^3) /\ min (norm (w - v)) (norm (w1 - u)) <= &1 + sqrt (&5) +==> norm(w1-u:real^3)<= &1 + sqrt (&5)`) +THEN RESA_TAC +THEN EXISTS_TAC`w1:real^3` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC th3[`w1:real^3`;`w:real^3`;`u:real^3`] +THEN MRESA_TAC th3[`w1:real^3`;`v:real^3`;`x:real^3`] +THEN SET_TAC[]; +MP_TAC(REAL_ARITH`norm (w - v) <= norm (w1 - u:real^3) /\ min (norm (w - v)) (norm (w1 - u)) <= &1 + sqrt (&5) +==> norm(w-v:real^3)<= &1 + sqrt (&5)`) +THEN RESA_TAC +THEN EXISTS_TAC`w:real^3` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC th3[`w1:real^3`;`w:real^3`;`u:real^3`] +THEN MRESA_TAC th3[`w:real^3`;`v:real^3`;`x:real^3`] +THEN SET_TAC[]]);; + + +let VPWSHTO2=prove(`!vv:num->real^3. +~(collinear{vv 0, vv 1 ,vv 2}) +/\ ~(collinear{vv 3,vv 1,vv 2}) +/\ ~(collinear{vv 4,vv 1,vv 2}) +/\ ~(collinear{vv 3,vv 0,vv 2}) +/\ ~(collinear{vv 4, vv 0,vv 2}) +/\ ~(collinear{vv 4, vv 3,vv 2}) +/\ ~(collinear{vv 3,vv 0,vv 1}) +/\ ~(collinear{vv 4,vv 0,vv 1}) +/\ ~(collinear{vv 4,vv 3,vv 1}) +/\ ~(collinear{vv 4,vv 3,vv 0}) +/\ norm(vv 0-vv 1)= &2 +/\ norm(vv 1-vv 2)= &2 +/\ norm(vv 2-vv 3)= &2 +/\ norm(vv 3-vv 4)= &2 +/\ norm(vv 4-vv 0)= &2 +/\ norm(vv 0-vv 2)<= norm(vv 0-vv 3) +/\ norm(vv 0-vv 2)<= norm(vv 2-vv 4) +/\ norm(vv 0-vv 2)<= norm(vv 4-vv 1) +/\ norm(vv 0-vv 2)<= norm(vv 1-vv 3) +==> +?i. i IN 0..4/\ norm(vv i - vv ((i +2) MOD 5) ) <= &1 + sqrt(&5)/\ norm(vv i - vv ((i +3) MOD 5))<= &1 + sqrt(&5)`, +REPEAT STRIP_TAC +THEN ABBREV_TAC `v= (vv:num->real^3) 0` +THEN ABBREV_TAC `x= (vv:num->real^3) 1` +THEN ABBREV_TAC `u= (vv:num->real^3) 2` +THEN ABBREV_TAC `w= (vv:num->real^3) 3` +THEN ABBREV_TAC `w1= (vv:num->real^3) 4` +THEN MRESAL_TAC NORM_TRIANGLE[`v-x:real^3`;`x-u:real^3`][VECTOR_ARITH`v-x+x-u=v-u:real^3`;REAL_ARITH`&2+ &2= &4`] +THEN MRESA_TAC (GEN_ALL VPWSHTO1)[`norm(v-u:real^3)`;`v:real^3`;`u:real^3`;`w1:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC th3[`w:real^3`;`v:real^3`;`u:real^3`] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`norm(w1-u) <= norm(w-v:real^3)\/ norm(w-v) <= norm(w1-u:real^3)`) +THENL[ +MP_TAC(REAL_ARITH`norm (w1 - u) <= norm (w - v:real^3) /\ min (norm (w - v)) (norm (w1 - u)) <= &1 + sqrt (&5) +==> norm(w1-u:real^3)<= &1 + sqrt (&5)`) +THEN RESA_TAC +THEN EXISTS_TAC`2` +THEN ASM_REWRITE_TAC[ARITH_RULE`(2+2) MOD 5=4/\(2+3) MOD 5=0/\ 0<=2/\2<=4`;IN_NUMSEG] +THEN ONCE_REWRITE_TAC[NORM_SUB] +THEN ASM_REWRITE_TAC[]; +MP_TAC(REAL_ARITH`norm (w - v) <= norm (w1 - u:real^3) /\ min (norm (w - v)) (norm (w1 - u)) <= &1 + sqrt (&5) +==> norm(w-v:real^3)<= &1 + sqrt (&5)`) +THEN RESA_TAC +THEN EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[ARITH_RULE`(0+2) MOD 5=2/\(0+3) MOD 5=3/\ +0<=0/\0<=4`;IN_NUMSEG]]);; + + + + +let MOD_ADD_235=prove(`((i + 2) MOD 5 + 3) MOD 5 =i MOD 5`, +MRESAL_TAC MOD_ADD_MOD[`i+2`;`3`;`5`][ARITH_RULE`~(5=0)/\ 3 MOD 5=3/\ (i + 2) + 3=1*5+i`] +THEN MRESA_TAC MOD_MULT_ADD[`1`;`5`;`i:num`]);; + + +let MOD_ADD_325=prove(`((i + 3) MOD 5 + 2) MOD 5 =i MOD 5`, +MRESAL_TAC MOD_ADD_MOD[`i+3`;`2`;`5`][ARITH_RULE`~(5=0)/\ 2 MOD 5=2/\ (i + 3) + 2=1*5+i`] +THEN MRESA_TAC MOD_MULT_ADD[`1`;`5`;`i:num`]);; + +let MOD_ADD_225=prove(`((i + 2) MOD 5 + 2) MOD 5 =(i+4) MOD 5`, +MRESAL_TAC MOD_ADD_MOD[`i+2`;`2`;`5`][ARITH_RULE`~(5=0)/\ 2 MOD 5=2/\ (i + 2) + 2=i+4`] +THEN MRESA_TAC MOD_MULT_ADD[`1`;`5`;`i:num`]);; + +let MOD_ADD_335=prove(`((i + 3) MOD 5 + 3) MOD 5 =(i+1) MOD 5`, +MRESAL_TAC MOD_ADD_MOD[`i+3`;`3`;`5`][ARITH_RULE`~(5=0)/\ 3 MOD 5=3/\ (i + 3) + 3=1*5+(i+1)`] +THEN MRESA_TAC MOD_MULT_ADD[`1`;`5`;`i+1:num`]);; + + +let MOD_ADD_345=prove(`((i + 3) MOD 5 + 4) MOD 5 =(i+2) MOD 5`, +MRESAL_TAC MOD_ADD_MOD[`i+3`;`4`;`5`][ARITH_RULE`~(5=0)/\ 4 MOD 5=4/\ (i + 3) + 4=1*5+(i+2)`] +THEN MRESA_TAC MOD_MULT_ADD[`1`;`5`;`i+2:num`]);; + +let MOD_ADD_245=prove(`((i + 2) MOD 5 + 4) MOD 5 =(i+1) MOD 5`, +MRESAL_TAC MOD_ADD_MOD[`i+2`;`4`;`5`][ARITH_RULE`~(5=0)/\ 4 MOD 5=4/\ (i + 2) + 4=1*5+(i+1)`] +THEN MRESA_TAC MOD_MULT_ADD[`1`;`5`;`i+1:num`]);; + +let MOD_ADD_425=prove(`((i + 4) MOD 5 + 2) MOD 5 =(i+1) MOD 5`, +MRESAL_TAC MOD_ADD_MOD[`i+4`;`2`;`5`][ARITH_RULE`~(5=0)/\ 2 MOD 5=2/\ (i + 4) + 2=1*5+(i+1)`] +THEN MRESA_TAC MOD_MULT_ADD[`1`;`5`;`i+1:num`]);; + +let MOD_ADD_435=prove(`((i + 4) MOD 5 + 3) MOD 5 =(i+2) MOD 5`, +MRESAL_TAC MOD_ADD_MOD[`i+4`;`3`;`5`][ARITH_RULE`~(5=0)/\ 3 MOD 5=3/\ (i + 4) + 3=1*5+(i+2)`] +THEN MRESA_TAC MOD_MULT_ADD[`1`;`5`;`i+2:num`]);; + + + + + + + + + + +let MOD_ADD_215=prove(`((i + 2) MOD 5 + 1) MOD 5 =(i+3) MOD 5`, +MRESAL_TAC MOD_ADD_MOD[`i+2`;`1`;`5`][ARITH_RULE`~(5=0)/\ 1 MOD 5=1/\ (i + 2) + 1=(i+3)`] +THEN MRESA_TAC MOD_MULT_ADD[`1`;`5`;`i+1:num`]);; + +let MOD_ADD_125=prove(`((i + 1) MOD 5 + 2) MOD 5 =(i+3) MOD 5`, +MRESAL_TAC MOD_ADD_MOD[`i+1`;`2`;`5`][ARITH_RULE`~(5=0)/\ 2 MOD 5=2/\ (i + 1) + 2=(i+3)`] +THEN MRESA_TAC MOD_MULT_ADD[`1`;`5`;`i+1:num`]);; + +let MOD_ADD_135=prove(`((i + 1) MOD 5 + 3) MOD 5 =(i+4) MOD 5`, +MRESAL_TAC MOD_ADD_MOD[`i+1`;`3`;`5`][ARITH_RULE`~(5=0)/\ 3 MOD 5=3/\ (i + 1) + 3=(i+4)`] +THEN MRESA_TAC MOD_MULT_ADD[`1`;`5`;`i+2:num`]);; + +let MOD_ADD_315=prove(`((i + 3) MOD 5 + 1) MOD 5 =(i+4) MOD 5`, +MRESAL_TAC MOD_ADD_MOD[`i+3`;`1`;`5`][ARITH_RULE`~(5=0)/\ 1 MOD 5=1/\ (i + 3) + 1=(i+4)`] +THEN MRESA_TAC MOD_MULT_ADD[`1`;`5`;`i+2:num`]);; + +let VPWSHTO=prove_by_refinement(`!vv:num->real^3. +~(collinear{vv 0, vv 1 ,vv 2}) +/\ ~(collinear{vv 3,vv 1,vv 2}) +/\ ~(collinear{vv 4,vv 1,vv 2}) +/\ ~(collinear{vv 3,vv 0,vv 2}) +/\ ~(collinear{vv 4, vv 0,vv 2}) +/\ ~(collinear{vv 4, vv 3,vv 2}) +/\ ~(collinear{vv 3,vv 0,vv 1}) +/\ ~(collinear{vv 4,vv 0,vv 1}) +/\ ~(collinear{vv 4,vv 3,vv 1}) +/\ ~(collinear{vv 4,vv 3,vv 0}) +/\ norm(vv 0-vv 1)= &2 +/\ norm(vv 1-vv 2)= &2 +/\ norm(vv 2-vv 3)= &2 +/\ norm(vv 3-vv 4)= &2 +/\ norm(vv 4-vv 0)= &2 +==> +?i. i IN 0..4/\ norm(vv i - vv ((i +2) MOD 5) ) <= &1 + sqrt(&5)/\ norm(vv i - vv ((i +3) MOD 5))<= &1 + sqrt(&5)`, +[ +REPEAT STRIP_TAC +THEN ABBREV_TAC `v= (vv:num->real^3) 0` +THEN ABBREV_TAC `x= (vv:num->real^3) 1` +THEN ABBREV_TAC `u= (vv:num->real^3) 2` +THEN ABBREV_TAC `w= (vv:num->real^3) 3` +THEN ABBREV_TAC `w1= (vv:num->real^3) 4` +THEN DISJ_CASES_TAC(REAL_ARITH`(norm(v-u)<= norm(v-w) +/\ norm(v-u)<= norm(u-w1) +/\ norm(v-u)<= norm(w1-x) +/\ norm(v-u)<= norm(x-w:real^3)) +\/ +(norm(v-w)<= norm(v-u) +/\ norm(v-w)<= norm(u-w1) +/\ norm(v-w)<= norm(w1-x) +/\ norm(v-w)<= norm(x-w)) +\/ +(norm(u-w1)<= norm(v-w) +/\ norm(u-w1)<= norm(v-u) +/\ norm(u-w1)<= norm(w1-x) +/\ norm(u-w1)<= norm(x-w)) +\/ +(norm(w1-x)<= norm(v-w) +/\ norm(w1-x)<= norm(u-w1) +/\ norm(w1-x)<= norm(v-u) +/\ norm(w1-x)<= norm(x-w)) +\/ +(norm(x-w)<= norm(v-w) +/\ norm(x-w)<= norm(u-w1) +/\ norm(x-w)<= norm(w1-x) +/\ norm(x-w)<= norm(v-u))`); +MRESA_TAC VPWSHTO2[`vv:num->real^3`]; +POP_ASSUM MP_TAC +THEN STRIP_TAC; +MRESAL_TAC VPWSHTO2[`(\i. (vv:num->real^3) ((i+3) MOD 5))`;] +[ARITH_RULE`0+3=3/\ 1+3=4/\ 2+3=5/\ 3+3=6/\ 4+3=7/\ 0 MOD 5=0 +/\ 1 MOD 5=1 /\ 2 MOD 5=2/\ 3 MOD 5=3/\ 4 MOD 5=4/\ 5 MOD 5=0/\ 6 MOD 5=1/\ 7 MOD 5=2`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC NORM_SUB[`w:real^3`;`v:real^3`] +THEN MRESA_TAC NORM_SUB[`w:real^3`;`x:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[MOD_ADD_235;MOD_ADD_335] +THEN STRIP_TAC +THEN EXISTS_TAC`(i+3) MOD 5` +THEN MRESAL_TAC DIVISION[`i+3`;`5`][ARITH_RULE`~(5=0)`;IN_NUMSEG;MOD_ADD_325;MOD_ADD_335] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MRESAL_TAC VPWSHTO2[`(\i. (vv:num->real^3) ((i+2) MOD 5))`;] +[ARITH_RULE`0+2=2/\ 1+2=3/\ 2+2=4/\ 3+2=5/\ 4+2=6/\ 0 MOD 5=0 +/\ 1 MOD 5=1 /\ 2 MOD 5=2/\ 3 MOD 5=3/\ 4 MOD 5=4/\ 5 MOD 5=0/\ 6 MOD 5=1/\ 7 MOD 5=2`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC NORM_SUB[`w:real^3`;`v:real^3`] +THEN MRESA_TAC NORM_SUB[`u:real^3`;`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[MOD_ADD_225;MOD_ADD_325] +THEN STRIP_TAC +THEN EXISTS_TAC`(i+2) MOD 5` +THEN MRESAL_TAC DIVISION[`i+2`;`5`][ARITH_RULE`~(5=0)`;IN_NUMSEG;MOD_ADD_225;MOD_ADD_235] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MRESAL_TAC VPWSHTO2[`(\i. (vv:num->real^3) ((i+4) MOD 5))`;] +[ARITH_RULE`0+4=4/\ 1+4=5/\ 2+4=6/\ 3+4=7/\ 4+4=8/\ 0 MOD 5=0 +/\ 1 MOD 5=1 /\ 2 MOD 5=2/\ 3 MOD 5=3/\ 4 MOD 5=4/\ 5 MOD 5=0/\ 6 MOD 5=1/\ 7 MOD 5=2/\ 8 MOD 5=3`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC NORM_SUB[`w:real^3`;`v:real^3`] +THEN MRESA_TAC NORM_SUB[`w1:real^3`;`u:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[MOD_ADD_245;MOD_ADD_345] +THEN STRIP_TAC +THEN EXISTS_TAC`(i+4) MOD 5` +THEN MRESAL_TAC DIVISION[`i+4`;`5`][ARITH_RULE`~(5=0)`;IN_NUMSEG;MOD_ADD_425;MOD_ADD_435] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MRESAL_TAC VPWSHTO2[`(\i. (vv:num->real^3) ((i+1) MOD 5))`;] +[ARITH_RULE`0+1=1/\ 1+1=2/\ 2+1=3/\ 3+1=4/\ 4+1=5/\ 0 MOD 5=0 +/\ 1 MOD 5=1 /\ 2 MOD 5=2/\ 3 MOD 5=3/\ 4 MOD 5=4/\ 5 MOD 5=0/\ 6 MOD 5=1/\ 7 MOD 5=2/\ 8 MOD 5=3`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC NORM_SUB[`w:real^3`;`v:real^3`] +THEN MRESA_TAC NORM_SUB[`x:real^3`;`w1:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[MOD_ADD_215;MOD_ADD_315] +THEN STRIP_TAC +THEN EXISTS_TAC`(i+1) MOD 5` +THEN MRESAL_TAC DIVISION[`i+1`;`5`][ARITH_RULE`~(5=0)`;IN_NUMSEG;MOD_ADD_125;MOD_ADD_135] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC]);; + + + +let POINTS_IN_BALL_ANNULUS_NOT_COLLINEAR=prove_by_refinement(`{u,v,w} SUBSET ball_annulus /\ packing {u,v,w} /\ ~(u=v)/\ ~(u=w)/\ ~(v=w) +==> ~(v IN segment [u,w])`, +[REPEAT STRIP_TAC +THEN ABBREV_TAC`t= (inv (norm(u-w))) pow 2 * (w dot (w-u:real^3))` +THEN ABBREV_TAC`p=t %(u-w)+w:real^3` +THEN SUBGOAL_THEN`collinear{u,p,w:real^3}` ASSUME_TAC; +REWRITE_TAC[COLLINEAR_3_EXPAND] +THEN MATCH_MP_TAC(SET_RULE`A==> B\/ A`) +THEN EXISTS_TAC`t:real` +THEN EXPAND_TAC"p" +THEN VECTOR_ARITH_TAC; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[COLLINEAR_BETWEEN_CASES;BETWEEN_IN_SEGMENT] +THEN SUBGOAL_THEN`norm(p:real^3) pow 2+ norm(p-w:real^3) pow 2= norm(w) pow 2` ASSUME_TAC; +MRESAL_TAC LAW_OF_COSINES[`p:real^3`;`w:real^3`;`vec 0:real^3`][dist;VECTOR_ARITH`A- vec 0=A`;REAL_ARITH`A+B=(B+A)- &2* C<=> C= &0`;COS_ANGLE] +THEN EXPAND_TAC"p" +THEN REWRITE_TAC[VECTOR_ARITH`w - (t % (u - w) + w)= (-- t) % (u - w)/\ vec 0-A= --A`;DOT_RNEG;DOT_LMUL;DOT_RMUL;DOT_RADD] +THEN EXPAND_TAC"t" +THEN REWRITE_TAC[DOT_SQUARE_NORM;VECTOR_ARITH`(inv (norm (u - w)) pow 2 * (w dot (w - u))) * norm (u - w) pow 2 + + (u - w) dot w +=(inv (norm (u - w)) * norm (u - w)) pow 2 * (w dot (w-u)) - + (w-u) dot w`] +THEN MRESA_TAC Planarity.IMP_NORM_FAN[`u:real^3`;`w:real^3`] +THEN MRESA_TAC DOT_SYM[`w:real^3`;`w-u:real^3`] +THEN REWRITE_TAC[REAL_ARITH`(--t * --(&1 pow 2 * ((w - u) dot w) - (w - u) dot w)) / + (norm (--t % (u - w)) * norm (--p))= &0`] +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`norm(p:real^3) pow 2+ norm(p-u:real^3) pow 2= norm(u) pow 2` ASSUME_TAC; +MRESAL_TAC LAW_OF_COSINES[`p:real^3`;`u:real^3`;`vec 0:real^3`][dist;VECTOR_ARITH`A- vec 0=A`;REAL_ARITH`A+B=(B+A)- &2* C<=> C= &0`;COS_ANGLE] +THEN EXPAND_TAC"p" +THEN REWRITE_TAC[VECTOR_ARITH`u - (t % (u - w) + w)= (&1- t) % (u - w)/\ vec 0-A= --A`;DOT_RNEG;DOT_LMUL;DOT_RMUL;DOT_RADD] +THEN EXPAND_TAC"t" +THEN REWRITE_TAC[DOT_SQUARE_NORM;VECTOR_ARITH`(inv (norm (u - w)) pow 2 * (w dot (w - u))) * norm (u - w) pow 2 + + (u - w) dot w +=(inv (norm (u - w)) * norm (u - w)) pow 2 * (w dot (w-u)) - + (w-u) dot w`] +THEN MRESA_TAC Planarity.IMP_NORM_FAN[`u:real^3`;`w:real^3`] +THEN MRESA_TAC DOT_SYM[`w:real^3`;`w-u:real^3`] +THEN REWRITE_TAC[REAL_ARITH`(--t * --(&1 pow 2 * ((w - u) dot w) - (w - u) dot w)) / + (norm (--t % (u - w)) * norm (--p))= &0`] +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`norm(p:real^3) pow 2+ norm(p-v:real^3) pow 2= norm(v) pow 2` ASSUME_TAC; +MRESAL_TAC LAW_OF_COSINES[`p:real^3`;`v:real^3`;`vec 0:real^3`][dist;VECTOR_ARITH`A- vec 0=A`;REAL_ARITH`A+B=(B+A)- &2* C<=> C= &0`;COS_ANGLE] +THEN FIND_ASSUM MP_TAC`v IN segment [u,w:real^3]` +THEN REWRITE_TAC[IN_SEGMENT] +THEN RESA_TAC +THEN EXPAND_TAC"p" +THEN REWRITE_TAC[VECTOR_ARITH`((&1 - u') % u + u' % w) - (t % (u - w) + w) += (&1 - u'-t) % (u - w) /\ vec 0-A= --A`;DOT_RNEG;DOT_LMUL;DOT_RMUL;DOT_RADD] +THEN EXPAND_TAC"t" +THEN REWRITE_TAC[DOT_SQUARE_NORM;VECTOR_ARITH`(inv (norm (u - w)) pow 2 * (w dot (w - u))) * norm (u - w) pow 2 + + (u - w) dot w +=(inv (norm (u - w)) * norm (u - w)) pow 2 * (w dot (w-u)) - + (w-u) dot w`] +THEN MRESA_TAC Planarity.IMP_NORM_FAN[`u:real^3`;`w:real^3`] +THEN MRESA_TAC DOT_SYM[`w:real^3`;`w-u:real^3`] +THEN REWRITE_TAC[REAL_ARITH`(--t * --(&1 pow 2 * ((w - u) dot w) - (w - u) dot w)) / + (norm (--t % (u - w)) * norm (--p))= &0`] +THEN REAL_ARITH_TAC; +STRIP_TAC; +SUBGOAL_THEN`&2<= norm(p-w:real^3)`ASSUME_TAC; +MRESAL_TAC DIST_IN_CLOSED_SEGMENT[`p:real^3`;`w:real^3`;`u:real^3`][dist] +THEN MRESA1_TAC packing`{u,v,w:real^3}` +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`u:real^3`;`w:real^3`][SET_RULE`{u, v, w} u /\ {u, v, w} w`;dist]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`norm (p:real^3) pow 2<= (&2 * h0) pow 2- &4`ASSUME_TAC; +MATCH_MP_TAC(REAL_ARITH`&4 <= norm (p - w:real^3) pow 2/\ norm p pow 2 + norm (p - w:real^3) pow 2 = norm w pow 2 /\ norm w pow 2 <= (&2 * h0) pow 2 ==> norm (p:real^3) pow 2<= (&2 * h0) pow 2- &4`) +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC Trigonometry2.POW2_COND[`&2`;`norm(p-w:real^3)`][REAL_ARITH`&0<= &2/\ &2 pow 2= &4`;NORM_POS_LE] +THEN MRESAL_TAC Trigonometry2.POW2_COND[`norm (w:real^3)`;`&2 * h0`][REAL_ARITH`&0 <= &2 * #1.26/\ &2 pow 2= &4`;NORM_POS_LE; h0] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC(SET_RULE`{u, v, w} SUBSET ball_annulus +==> w IN ball_annulus`) +THEN ASM_REWRITE_TAC[ball_annulus; cball;IN_ELIM_THM;DIFF;dist;VECTOR_ARITH`vec 0- w= -- w`;NORM_NEG;h0] +THEN RESA_TAC; +SUBGOAL_THEN`&0<= &2 pow 2 -norm (p:real^3) pow 2` ASSUME_TAC; +MATCH_MP_TAC(REAL_ARITH`A<=(&2 * h0) pow 2 - &4/\ (&2 * h0) pow 2 - &4<= &2 pow 2 ==> &0<= &2 pow 2 -A`) +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MRESAL_TAC between[`p:real^3`;`u:real^3`;`w:real^3`][BETWEEN_IN_SEGMENT;dist] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC SQRT_UNIQUE[`norm (w:real^3) pow 2- norm (p:real^3) pow 2`;`norm (p-w:real^3)`][NORM_POS_LE;REAL_ARITH`A=B-C<=> C+A=B`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC SQRT_UNIQUE[`norm (u:real^3) pow 2- norm (p:real^3) pow 2`;`norm (p-u:real^3)`][NORM_POS_LE;REAL_ARITH`A=B-C<=> C+A=B`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[REAL_ARITH`A=B+C<=> C= A-B`] +THEN MP_TAC(SET_RULE`{u, v, w} SUBSET ball_annulus +==> w IN ball_annulus/\ u IN ball_annulus /\ v IN ball_annulus`) +THEN ASM_REWRITE_TAC[ball_annulus; cball;IN_ELIM_THM;DIFF;dist;VECTOR_ARITH`vec 0- w= -- w`;NORM_NEG;ball;REAL_ARITH`~(a< &2)<=> &2<= a`] +THEN STRIP_TAC +THEN MRESAL_TAC Trigonometry2.POW2_COND[`norm(w:real^3)`;`&2 * h0`][NORM_POS_LE;h0;REAL_ARITH`&0 <= &2 * #1.26`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SYM h0] +THEN STRIP_TAC +THEN MRESAL_TAC Trigonometry2.POW2_COND[`&2`;`norm(u:real^3)`][NORM_POS_LE;REAL_ARITH`&0 <= &2 `] +THEN MP_TAC(REAL_ARITH` +norm (w:real^3) pow 2<= (&2 * h0) pow 2 +/\ &2 pow 2 <= norm (u:real^3) pow 2 +==> +norm w pow 2 - norm (p:real^3) pow 2 <= (&2 * h0) pow 2 - norm p pow 2 +/\ &2 pow 2 - norm p pow 2<= norm u pow 2 - norm p pow 2 `) +THEN RESA_TAC +THEN MRESAL_TAC SQRT_MONO_LE[`norm (w:real^3) pow 2 - norm (p:real^3) pow 2`;`(&2 * h0) pow 2 - norm (p:real^3) pow 2`][REAL_ARITH`&0 <= norm (w:real^3) pow 2 - norm (p:real^3) pow 2 <=> &0 <= norm w pow 2 - (norm p pow 2+ norm(p-w:real^3) pow 2) + norm(p-w:real^3) pow 2`;REAL_ARITH`A-A+B=B`;REAL_LE_POW_2] +THEN MRESAL_TAC SQRT_MONO_LE[`&2 pow 2 - norm (p:real^3) pow 2 `;`norm (u:real^3) pow 2 - norm (p:real^3) pow 2`][] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`norm (u - w:real^3) = + sqrt (norm w pow 2 - norm p pow 2) - sqrt (norm u pow 2 - norm p pow 2) +/\ sqrt (norm w pow 2 - norm (p:real^3) pow 2) <= + sqrt ((&2 * h0) pow 2 - norm p pow 2) +/\ sqrt (&2 pow 2 - norm p pow 2) <= sqrt (norm u pow 2 - norm p pow 2) +==> norm (u - w:real^3) <= sqrt ((&2 * h0) pow 2 - norm p pow 2) - sqrt (&2 pow 2 - norm p pow 2)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`~(sqrt ((&2 * h0) pow 2 - norm (p:real^3) pow 2) + sqrt (&2 pow 2 - norm p pow 2)= &0)` ASSUME_TAC; +MRESAL_TAC SQRT_UNIQUE[`norm (w:real^3) pow 2- norm (p:real^3) pow 2`;`norm (p-w:real^3)`][NORM_POS_LE;REAL_ARITH`A=B-C<=> C+A=B`] +THEN MATCH_MP_TAC(REAL_ARITH`~(A= &0/\B= &0) /\ &0<= A /\ &0<= B ==> ~(A+B= &0)`) +THEN MRESA1_TAC SQRT_POS_LE`&2 pow 2 - norm (p:real^3) pow 2` +THEN MP_TAC(REAL_ARITH`sqrt (norm w pow 2 - norm p pow 2) <= + sqrt ((&2 * h0) pow 2 - norm p pow 2) +/\ sqrt (norm w pow 2 - norm p pow 2) = norm (p - w:real^3) +/\ &0 <= norm (p - w) +==> &0 <= sqrt ((&2 * h0) pow 2 - norm p pow 2) +`) +THEN ASM_REWRITE_TAC[NORM_POS_LE] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH` (norm w pow 2 - norm p pow 2) <= + ((&2 * h0) pow 2 - norm p pow 2) +/\ norm p pow 2 +norm (p - w:real^3) pow 2 =norm w pow 2 +/\ &0<= norm (p-w) pow 2 +==> &0 <= ((&2 * h0) pow 2 - norm p pow 2) +`) +THEN ASM_REWRITE_TAC[REAL_LE_POW_2] +THEN RESA_TAC +THEN MRESA1_TAC SQRT_EQ_0`(&2 * h0) pow 2 - norm (p:real^3) pow 2` +THEN MRESA1_TAC SQRT_EQ_0`(&2 ) pow 2 - norm (p:real^3) pow 2` +THEN REWRITE_TAC[REAL_ARITH`A-B= &0<=> B=A`] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MRESA1_TAC REAL_MUL_LINV`sqrt ((&2 * h0) pow 2 - norm (p:real^3) pow 2) + + sqrt (&2 pow 2 - norm p pow 2)` +THEN ONCE_REWRITE_TAC[REAL_ARITH`sqrt ((&2 * h0) pow 2 - norm p pow 2) - sqrt (&2 pow 2 - norm p pow 2)= &1 *(sqrt ((&2 * h0) pow 2 - norm p pow 2) - sqrt (&2 pow 2 - norm p pow 2))`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;REAL_ARITH`(A*(B+C))*(B-C)=A* (B pow 2- C pow 2)`]) +THEN MP_TAC(REAL_ARITH` (norm w pow 2 - norm p pow 2) <= + ((&2 * h0) pow 2 - norm p pow 2) +/\ norm p pow 2 +norm (p - w:real^3) pow 2 =norm w pow 2 +/\ &0<= norm (p-w) pow 2 +==> &0 <= ((&2 * h0) pow 2 - norm p pow 2) +`) +THEN ASM_REWRITE_TAC[REAL_LE_POW_2] +THEN RESA_TAC +THEN MRESAL1_TAC SQRT_POW_2`(&2 * h0) pow 2 - norm (p:real^3) pow 2`[REAL_ARITH`&0 <= norm (w:real^3) pow 2 - norm (p:real^3) pow 2 <=> &0 <= norm w pow 2 - (norm p pow 2+ norm(p-w:real^3) pow 2) + norm(p-w:real^3) pow 2`;REAL_ARITH`A-A+B=B`;REAL_LE_POW_2] +THEN MRESAL1_TAC SQRT_POW_2`&2 pow 2 - norm (p:real^3) pow 2`[REAL_ARITH`&0 <= norm (u:real^3) pow 2 - norm (p:real^3) pow 2 <=> &0 <= norm u pow 2 - (norm p pow 2+ norm(p-u:real^3) pow 2) + norm(p-u:real^3) pow 2`;REAL_ARITH`A-A+B=B`;REAL_LE_POW_2] +THEN REWRITE_TAC[REAL_ARITH`A-B-(C-B)=A-C`] +THEN MP_TAC( REAL_ARITH` +norm (p:real^3) pow 2 <= (&2 * h0) pow 2 - &4 +==> +&4<= (&2 * h0) pow 2 - norm p pow 2 /\ &8 - (&2 * h0) pow 2<= &2 pow 2 - norm p pow 2`) +THEN RESA_TAC +THEN MRESAL_TAC SQRT_MONO_LE[`&4`;`(&2 *h0) pow 2 - norm (p:real^3) pow 2 `][REAL_ARITH`&0<= &4`] +THEN SUBGOAL_THEN`&0 <= &8 - (&2 * h0) pow 2`ASSUME_TAC; +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MRESAL_TAC SQRT_MONO_LE[`&8 - (&2 * h0) pow 2`;`(&2 ) pow 2 - norm (p:real^3) pow 2 `][REAL_ARITH`&0<= &4`] +THEN MP_TAC(REAL_ARITH`sqrt (&8 - (&2 * h0) pow 2) <= sqrt (&2 pow 2 - norm p pow 2)/\ sqrt (&4) <= sqrt ((&2 * h0) pow 2 - norm p pow 2) +==> sqrt (&8 - (&2 * h0) pow 2)+ sqrt (&4) <= sqrt (&2 pow 2 - norm p pow 2)+ sqrt ((&2 * h0) pow 2 - norm (p:real^3) pow 2)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`&0 < sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)` ASSUME_TAC; +MATCH_MP_TAC(REAL_ARITH`&0< A/\ &0 &0< A+B`) +THEN STRIP_TAC +THEN MATCH_MP_TAC SQRT_POS_LT +THEN REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`&0 <= (&2 * h0) pow 2 - &2 pow 2`ASSUME_TAC; +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MRESA_TAC REAL_LE_INV2[`sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)`;`sqrt (&2 pow 2 - norm p pow 2) + sqrt ((&2 * h0) pow 2 - norm (p:real^3) pow 2)`] +THEN MRESA_TAC REAL_LE_RMUL[`inv(sqrt (&2 pow 2 - norm p pow 2) + sqrt ((&2 * h0) pow 2 - norm (p:real^3) pow 2))`;`inv(sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4))`;`((&2 * h0) pow 2 - &2 pow 2)`] +THEN SUBGOAL_THEN`inv (sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)) * + ((&2 * h0) pow 2 - &2 pow 2)< &2` ASSUME_TAC; +MP_TAC(REAL_ARITH` &0< sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4) ==> ~(sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4) = &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`(sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4))` +THEN MRESAL_TAC REAL_LT_LMUL[`inv(sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4))`;`((&2 * h0) pow 2 - &2 pow 2)`;`(sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)) * &2`][REAL_ARITH`A*(B*C)=(A*B)*C/\ &1 *A=A`] +THEN POP_ASSUM MATCH_MP_TAC +THEN STRIP_TAC; +MATCH_MP_TAC REAL_LT_INV +THEN ASM_REWRITE_TAC[]; +REWRITE_TAC[REAL_ARITH`&4= &2 pow 2/\ abs(&2)= &2`;POW_2_SQRT_ABS;] +THEN MATCH_MP_TAC(REAL_ARITH` + h0 pow 2 < &2/\ &0< sqrt (&8 - (&2 * h0) pow 2) +==> +(&2 * h0) pow 2 - &2 pow 2 < (sqrt (&8 - (&2 * h0) pow 2) + &2) * &2 +`) +THEN STRIP_TAC; +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MATCH_MP_TAC SQRT_POS_LT +THEN REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +STRIP_TAC +THEN MP_TAC(REAL_ARITH`inv + (sqrt (&2 pow 2 - norm (p:real^3) pow 2) + + sqrt ((&2 * h0) pow 2 - norm p pow 2)) * + ((&2 * h0) pow 2 - &2 pow 2) <= + inv (sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)) * + ((&2 * h0) pow 2 - &2 pow 2) +/\ inv (sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)) * + ((&2 * h0) pow 2 - &2 pow 2) < + &2 +/\ norm (u - w) <= + inv + (sqrt ((&2 * h0) pow 2 - norm p pow 2) + sqrt (&2 pow 2 - norm p pow 2)) * + ((&2 * h0) pow 2 - &2 pow 2) +==> norm(u-w:real^3)< &2`) +THEN RESA_TAC; +MRESA1_TAC( GEN_ALL packing_lt)`{u,v,w:real^3}` +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`u:real^3`;`w:real^3`][SET_RULE`u IN {u, v, w}`;]); +SET_TAC[]; +ASM_REWRITE_TAC[dist]; +MRESA_TAC UNION_SEGMENT[`w:real^3`;`p:real^3`;`u:real^3`] +THEN FIND_ASSUM MP_TAC`v IN segment [u,w:real^3]` +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SEGMENT_SYM] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM]) +THEN STRIP_TAC; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SEGMENT_SYM] +THEN STRIP_TAC +THEN SUBGOAL_THEN`&2<= norm(p-w:real^3)`ASSUME_TAC; +MRESAL_TAC DIST_IN_CLOSED_SEGMENT[`p:real^3`;`w:real^3`;`v:real^3`][dist] +THEN MRESA1_TAC packing`{u,v,w:real^3}` +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`v:real^3`;`w:real^3`][SET_RULE`{u, v, w} v /\ {u, v, w} w`;dist]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`norm (p:real^3) pow 2<= (&2 * h0) pow 2- &4`ASSUME_TAC; +MATCH_MP_TAC(REAL_ARITH`&4 <= norm (p - w:real^3) pow 2/\ norm p pow 2 + norm (p - w:real^3) pow 2 = norm w pow 2 /\ norm w pow 2 <= (&2 * h0) pow 2 ==> norm (p:real^3) pow 2<= (&2 * h0) pow 2- &4`) +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC Trigonometry2.POW2_COND[`&2`;`norm(p-w:real^3)`][REAL_ARITH`&0<= &2/\ &2 pow 2= &4`;NORM_POS_LE] +THEN MRESAL_TAC Trigonometry2.POW2_COND[`norm (w:real^3)`;`&2 * h0`][REAL_ARITH`&0 <= &2 * #1.26/\ &2 pow 2= &4`;NORM_POS_LE; h0] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC(SET_RULE`{u, v, w} SUBSET ball_annulus +==> w IN ball_annulus`) +THEN ASM_REWRITE_TAC[ball_annulus; cball;IN_ELIM_THM;DIFF;dist;VECTOR_ARITH`vec 0- w= -- w`;NORM_NEG;h0] +THEN RESA_TAC; +SUBGOAL_THEN`&0<= &2 pow 2 -norm (p:real^3) pow 2` ASSUME_TAC; +MATCH_MP_TAC(REAL_ARITH`A<=(&2 * h0) pow 2 - &4/\ (&2 * h0) pow 2 - &4<= &2 pow 2 ==> &0<= &2 pow 2 -A`) +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MRESAL_TAC between[`p:real^3`;`v:real^3`;`w:real^3`][BETWEEN_IN_SEGMENT;dist] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC SQRT_UNIQUE[`norm (w:real^3) pow 2- norm (p:real^3) pow 2`;`norm (p-w:real^3)`][NORM_POS_LE;REAL_ARITH`A=B-C<=> C+A=B`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC SQRT_UNIQUE[`norm (v:real^3) pow 2- norm (p:real^3) pow 2`;`norm (p-v:real^3)`][NORM_POS_LE;REAL_ARITH`A=B-C<=> C+A=B`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[REAL_ARITH`A=B+C<=> C= A-B`] +THEN MP_TAC(SET_RULE`{u, v, w} SUBSET ball_annulus +==> w IN ball_annulus/\ u IN ball_annulus /\ v IN ball_annulus`) +THEN ASM_REWRITE_TAC[ball_annulus; cball;IN_ELIM_THM;DIFF;dist;VECTOR_ARITH`vec 0- w= -- w`;NORM_NEG;ball;REAL_ARITH`~(a< &2)<=> &2<= a`] +THEN STRIP_TAC +THEN MRESAL_TAC Trigonometry2.POW2_COND[`norm(w:real^3)`;`&2 * h0`][NORM_POS_LE;h0;REAL_ARITH`&0 <= &2 * #1.26`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SYM h0] +THEN STRIP_TAC +THEN MRESAL_TAC Trigonometry2.POW2_COND[`&2`;`norm(v:real^3)`][NORM_POS_LE;REAL_ARITH`&0 <= &2 `] +THEN MP_TAC(REAL_ARITH` +norm (w:real^3) pow 2<= (&2 * h0) pow 2 +/\ &2 pow 2 <= norm (v:real^3) pow 2 +==> +norm w pow 2 - norm (p:real^3) pow 2 <= (&2 * h0) pow 2 - norm p pow 2 +/\ &2 pow 2 - norm p pow 2<= norm v pow 2 - norm p pow 2 `) +THEN RESA_TAC +THEN MRESAL_TAC SQRT_MONO_LE[`norm (w:real^3) pow 2 - norm (p:real^3) pow 2`;`(&2 * h0) pow 2 - norm (p:real^3) pow 2`][REAL_ARITH`&0 <= norm (w:real^3) pow 2 - norm (p:real^3) pow 2 <=> &0 <= norm w pow 2 - (norm p pow 2+ norm(p-w:real^3) pow 2) + norm(p-w:real^3) pow 2`;REAL_ARITH`A-A+B=B`;REAL_LE_POW_2] +THEN MRESAL_TAC SQRT_MONO_LE[`&2 pow 2 - norm (p:real^3) pow 2 `;`norm (v:real^3) pow 2 - norm (p:real^3) pow 2`][] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`norm (v - w:real^3) = + sqrt (norm w pow 2 - norm p pow 2) - sqrt (norm v pow 2 - norm p pow 2) +/\ sqrt (norm w pow 2 - norm (p:real^3) pow 2) <= + sqrt ((&2 * h0) pow 2 - norm p pow 2) +/\ sqrt (&2 pow 2 - norm p pow 2) <= sqrt (norm v pow 2 - norm p pow 2) +==> norm (v - w:real^3) <= sqrt ((&2 * h0) pow 2 - norm p pow 2) - sqrt (&2 pow 2 - norm p pow 2)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`~(sqrt ((&2 * h0) pow 2 - norm (p:real^3) pow 2) + sqrt (&2 pow 2 - norm p pow 2)= &0)` ASSUME_TAC; +MRESAL_TAC SQRT_UNIQUE[`norm (w:real^3) pow 2- norm (p:real^3) pow 2`;`norm (p-w:real^3)`][NORM_POS_LE;REAL_ARITH`A=B-C<=> C+A=B`] +THEN MATCH_MP_TAC(REAL_ARITH`~(A= &0/\B= &0) /\ &0<= A /\ &0<= B ==> ~(A+B= &0)`) +THEN MRESA1_TAC SQRT_POS_LE`&2 pow 2 - norm (p:real^3) pow 2` +THEN MP_TAC(REAL_ARITH`sqrt (norm w pow 2 - norm p pow 2) <= + sqrt ((&2 * h0) pow 2 - norm p pow 2) +/\ sqrt (norm w pow 2 - norm p pow 2) = norm (p - w:real^3) +/\ &0 <= norm (p - w) +==> &0 <= sqrt ((&2 * h0) pow 2 - norm p pow 2) +`) +THEN ASM_REWRITE_TAC[NORM_POS_LE] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH` (norm w pow 2 - norm p pow 2) <= + ((&2 * h0) pow 2 - norm p pow 2) +/\ norm p pow 2 +norm (p - w:real^3) pow 2 =norm w pow 2 +/\ &0<= norm (p-w) pow 2 +==> &0 <= ((&2 * h0) pow 2 - norm p pow 2) +`) +THEN ASM_REWRITE_TAC[REAL_LE_POW_2] +THEN RESA_TAC +THEN MRESA1_TAC SQRT_EQ_0`(&2 * h0) pow 2 - norm (p:real^3) pow 2` +THEN MRESA1_TAC SQRT_EQ_0`(&2 ) pow 2 - norm (p:real^3) pow 2` +THEN REWRITE_TAC[REAL_ARITH`A-B= &0<=> B=A`] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MRESA1_TAC REAL_MUL_LINV`sqrt ((&2 * h0) pow 2 - norm (p:real^3) pow 2) + + sqrt (&2 pow 2 - norm p pow 2)` +THEN ONCE_REWRITE_TAC[REAL_ARITH`sqrt ((&2 * h0) pow 2 - norm p pow 2) - sqrt (&2 pow 2 - norm p pow 2)= &1 *(sqrt ((&2 * h0) pow 2 - norm p pow 2) - sqrt (&2 pow 2 - norm p pow 2))`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;REAL_ARITH`(A*(B+C))*(B-C)=A* (B pow 2- C pow 2)`]) +THEN MP_TAC(REAL_ARITH` (norm w pow 2 - norm p pow 2) <= + ((&2 * h0) pow 2 - norm p pow 2) +/\ norm p pow 2 +norm (p - w:real^3) pow 2 =norm w pow 2 +/\ &0<= norm (p-w) pow 2 +==> &0 <= ((&2 * h0) pow 2 - norm p pow 2) +`) +THEN ASM_REWRITE_TAC[REAL_LE_POW_2] +THEN RESA_TAC +THEN MRESAL1_TAC SQRT_POW_2`(&2 * h0) pow 2 - norm (p:real^3) pow 2`[REAL_ARITH`&0 <= norm (w:real^3) pow 2 - norm (p:real^3) pow 2 <=> &0 <= norm w pow 2 - (norm p pow 2+ norm(p-w:real^3) pow 2) + norm(p-w:real^3) pow 2`;REAL_ARITH`A-A+B=B`;REAL_LE_POW_2] +THEN MRESAL1_TAC SQRT_POW_2`&2 pow 2 - norm (p:real^3) pow 2`[REAL_ARITH`&0 <= norm (u:real^3) pow 2 - norm (p:real^3) pow 2 <=> &0 <= norm u pow 2 - (norm p pow 2+ norm(p-u:real^3) pow 2) + norm(p-u:real^3) pow 2`;REAL_ARITH`A-A+B=B`;REAL_LE_POW_2] +THEN REWRITE_TAC[REAL_ARITH`A-B-(C-B)=A-C`] +THEN MP_TAC( REAL_ARITH` +norm (p:real^3) pow 2 <= (&2 * h0) pow 2 - &4 +==> +&4<= (&2 * h0) pow 2 - norm p pow 2 /\ &8 - (&2 * h0) pow 2<= &2 pow 2 - norm p pow 2`) +THEN RESA_TAC +THEN MRESAL_TAC SQRT_MONO_LE[`&4`;`(&2 *h0) pow 2 - norm (p:real^3) pow 2 `][REAL_ARITH`&0<= &4`] +THEN SUBGOAL_THEN`&0 <= &8 - (&2 * h0) pow 2`ASSUME_TAC; +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MRESAL_TAC SQRT_MONO_LE[`&8 - (&2 * h0) pow 2`;`(&2 ) pow 2 - norm (p:real^3) pow 2 `][REAL_ARITH`&0<= &4`] +THEN MP_TAC(REAL_ARITH`sqrt (&8 - (&2 * h0) pow 2) <= sqrt (&2 pow 2 - norm p pow 2)/\ sqrt (&4) <= sqrt ((&2 * h0) pow 2 - norm p pow 2) +==> sqrt (&8 - (&2 * h0) pow 2)+ sqrt (&4) <= sqrt (&2 pow 2 - norm p pow 2)+ sqrt ((&2 * h0) pow 2 - norm (p:real^3) pow 2)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`&0 < sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)` ASSUME_TAC; +MATCH_MP_TAC(REAL_ARITH`&0< A/\ &0 &0< A+B`) +THEN STRIP_TAC +THEN MATCH_MP_TAC SQRT_POS_LT +THEN REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`&0 <= (&2 * h0) pow 2 - &2 pow 2`ASSUME_TAC; +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MRESA_TAC REAL_LE_INV2[`sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)`;`sqrt (&2 pow 2 - norm p pow 2) + sqrt ((&2 * h0) pow 2 - norm (p:real^3) pow 2)`] +THEN MRESA_TAC REAL_LE_RMUL[`inv(sqrt (&2 pow 2 - norm p pow 2) + sqrt ((&2 * h0) pow 2 - norm (p:real^3) pow 2))`;`inv(sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4))`;`((&2 * h0) pow 2 - &2 pow 2)`] +THEN SUBGOAL_THEN`inv (sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)) * + ((&2 * h0) pow 2 - &2 pow 2)< &2` ASSUME_TAC; +MP_TAC(REAL_ARITH` &0< sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4) ==> ~(sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4) = &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`(sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4))` +THEN MRESAL_TAC REAL_LT_LMUL[`inv(sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4))`;`((&2 * h0) pow 2 - &2 pow 2)`;`(sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)) * &2`][REAL_ARITH`A*(B*C)=(A*B)*C/\ &1 *A=A`] +THEN POP_ASSUM MATCH_MP_TAC +THEN STRIP_TAC; +MATCH_MP_TAC REAL_LT_INV +THEN ASM_REWRITE_TAC[]; +REWRITE_TAC[REAL_ARITH`&4= &2 pow 2/\ abs(&2)= &2`;POW_2_SQRT_ABS;] +THEN MATCH_MP_TAC(REAL_ARITH` + h0 pow 2 < &2/\ &0< sqrt (&8 - (&2 * h0) pow 2) +==> +(&2 * h0) pow 2 - &2 pow 2 < (sqrt (&8 - (&2 * h0) pow 2) + &2) * &2 +`) +THEN STRIP_TAC; +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MATCH_MP_TAC SQRT_POS_LT +THEN REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +STRIP_TAC +THEN MP_TAC(REAL_ARITH`inv + (sqrt (&2 pow 2 - norm (p:real^3) pow 2) + + sqrt ((&2 * h0) pow 2 - norm p pow 2)) * + ((&2 * h0) pow 2 - &2 pow 2) <= + inv (sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)) * + ((&2 * h0) pow 2 - &2 pow 2) +/\ inv (sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)) * + ((&2 * h0) pow 2 - &2 pow 2) < + &2 +/\ norm (v - w) <= + inv + (sqrt ((&2 * h0) pow 2 - norm p pow 2) + sqrt (&2 pow 2 - norm p pow 2)) * + ((&2 * h0) pow 2 - &2 pow 2) +==> norm(v-w:real^3)< &2`) +THEN RESA_TAC; +MRESA1_TAC( GEN_ALL packing_lt)`{u,v,w:real^3}` +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`v:real^3`;`w:real^3`][SET_RULE`v IN {u, v, w}`;]); +SET_TAC[]; +ASM_REWRITE_TAC[dist]; +SUBGOAL_THEN`&2<= norm(p-u:real^3)`ASSUME_TAC; +MRESAL_TAC DIST_IN_CLOSED_SEGMENT[`p:real^3`;`u:real^3`;`v:real^3`][dist] +THEN MRESA1_TAC packing`{u,v,w:real^3}` +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`v:real^3`;`u:real^3`][SET_RULE`{u, v, w} v /\ {u, v, w} u`;dist]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`norm (p:real^3) pow 2<= (&2 * h0) pow 2- &4`ASSUME_TAC; +MATCH_MP_TAC(REAL_ARITH`&4 <= norm (p - u:real^3) pow 2/\ norm p pow 2 + norm (p - u:real^3) pow 2 = norm u pow 2 /\ norm u pow 2 <= (&2 * h0) pow 2 ==> norm (p:real^3) pow 2<= (&2 * h0) pow 2- &4`) +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC Trigonometry2.POW2_COND[`&2`;`norm(p-u:real^3)`][REAL_ARITH`&0<= &2/\ &2 pow 2= &4`;NORM_POS_LE] +THEN MRESAL_TAC Trigonometry2.POW2_COND[`norm (u:real^3)`;`&2 * h0`][REAL_ARITH`&0 <= &2 * #1.26/\ &2 pow 2= &4`;NORM_POS_LE; h0] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC(SET_RULE`{u, v, w} SUBSET ball_annulus +==> u IN ball_annulus`) +THEN ASM_REWRITE_TAC[ball_annulus; cball;IN_ELIM_THM;DIFF;dist;VECTOR_ARITH`vec 0- w= -- w`;NORM_NEG;h0] +THEN RESA_TAC; +SUBGOAL_THEN`&0<= &2 pow 2 -norm (p:real^3) pow 2` ASSUME_TAC; +MATCH_MP_TAC(REAL_ARITH`A<=(&2 * h0) pow 2 - &4/\ (&2 * h0) pow 2 - &4<= &2 pow 2 ==> &0<= &2 pow 2 -A`) +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MRESAL_TAC between[`p:real^3`;`v:real^3`;`u:real^3`][BETWEEN_IN_SEGMENT;dist] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC SQRT_UNIQUE[`norm (u:real^3) pow 2- norm (p:real^3) pow 2`;`norm (p-u:real^3)`][NORM_POS_LE;REAL_ARITH`A=B-C<=> C+A=B`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC SQRT_UNIQUE[`norm (v:real^3) pow 2- norm (p:real^3) pow 2`;`norm (p-v:real^3)`][NORM_POS_LE;REAL_ARITH`A=B-C<=> C+A=B`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[REAL_ARITH`A=B+C<=> C= A-B`] +THEN MP_TAC(SET_RULE`{u, v, w} SUBSET ball_annulus +==> w IN ball_annulus/\ u IN ball_annulus /\ v IN ball_annulus`) +THEN ASM_REWRITE_TAC[ball_annulus; cball;IN_ELIM_THM;DIFF;dist;VECTOR_ARITH`vec 0- w= -- w`;NORM_NEG;ball;REAL_ARITH`~(a< &2)<=> &2<= a`] +THEN STRIP_TAC +THEN MRESAL_TAC Trigonometry2.POW2_COND[`norm(u:real^3)`;`&2 * h0`][NORM_POS_LE;h0;REAL_ARITH`&0 <= &2 * #1.26`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SYM h0] +THEN STRIP_TAC +THEN MRESAL_TAC Trigonometry2.POW2_COND[`&2`;`norm(v:real^3)`][NORM_POS_LE;REAL_ARITH`&0 <= &2 `] +THEN MP_TAC(REAL_ARITH` +norm (u:real^3) pow 2<= (&2 * h0) pow 2 +/\ &2 pow 2 <= norm (v:real^3) pow 2 +==> +norm u pow 2 - norm (p:real^3) pow 2 <= (&2 * h0) pow 2 - norm p pow 2 +/\ &2 pow 2 - norm p pow 2<= norm v pow 2 - norm p pow 2 `) +THEN RESA_TAC +THEN MRESAL_TAC SQRT_MONO_LE[`norm (u:real^3) pow 2 - norm (p:real^3) pow 2`;`(&2 * h0) pow 2 - norm (p:real^3) pow 2`][REAL_ARITH`&0 <= norm (w:real^3) pow 2 - norm (p:real^3) pow 2 <=> &0 <= norm w pow 2 - (norm p pow 2+ norm(p-w:real^3) pow 2) + norm(p-w:real^3) pow 2`;REAL_ARITH`A-A+B=B`;REAL_LE_POW_2] +THEN MRESAL_TAC SQRT_MONO_LE[`&2 pow 2 - norm (p:real^3) pow 2 `;`norm (v:real^3) pow 2 - norm (p:real^3) pow 2`][] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`norm (v - u:real^3) = + sqrt (norm u pow 2 - norm p pow 2) - sqrt (norm v pow 2 - norm p pow 2) +/\ sqrt (norm u pow 2 - norm (p:real^3) pow 2) <= + sqrt ((&2 * h0) pow 2 - norm p pow 2) +/\ sqrt (&2 pow 2 - norm p pow 2) <= sqrt (norm v pow 2 - norm p pow 2) +==> norm (v - u:real^3) <= sqrt ((&2 * h0) pow 2 - norm p pow 2) - sqrt (&2 pow 2 - norm p pow 2)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`~(sqrt ((&2 * h0) pow 2 - norm (p:real^3) pow 2) + sqrt (&2 pow 2 - norm p pow 2)= &0)` ASSUME_TAC; +MRESAL_TAC SQRT_UNIQUE[`norm (u:real^3) pow 2- norm (p:real^3) pow 2`;`norm (p-u:real^3)`][NORM_POS_LE;REAL_ARITH`A=B-C<=> C+A=B`] +THEN MATCH_MP_TAC(REAL_ARITH`~(A= &0/\B= &0) /\ &0<= A /\ &0<= B ==> ~(A+B= &0)`) +THEN MRESA1_TAC SQRT_POS_LE`&2 pow 2 - norm (p:real^3) pow 2` +THEN MP_TAC(REAL_ARITH`sqrt (norm u pow 2 - norm p pow 2) <= + sqrt ((&2 * h0) pow 2 - norm p pow 2) +/\ sqrt (norm u pow 2 - norm p pow 2) = norm (p - u:real^3) +/\ &0 <= norm (p - u) +==> &0 <= sqrt ((&2 * h0) pow 2 - norm p pow 2) +`) +THEN ASM_REWRITE_TAC[NORM_POS_LE] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH` (norm u pow 2 - norm p pow 2) <= + ((&2 * h0) pow 2 - norm p pow 2) +/\ norm p pow 2 +norm (p - u:real^3) pow 2 =norm u pow 2 +/\ &0<= norm (p-u) pow 2 +==> &0 <= ((&2 * h0) pow 2 - norm p pow 2) +`) +THEN ASM_REWRITE_TAC[REAL_LE_POW_2] +THEN RESA_TAC +THEN MRESA1_TAC SQRT_EQ_0`(&2 * h0) pow 2 - norm (p:real^3) pow 2` +THEN MRESA1_TAC SQRT_EQ_0`(&2 ) pow 2 - norm (p:real^3) pow 2` +THEN REWRITE_TAC[REAL_ARITH`A-B= &0<=> B=A`] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MRESA1_TAC REAL_MUL_LINV`sqrt ((&2 * h0) pow 2 - norm (p:real^3) pow 2) + + sqrt (&2 pow 2 - norm p pow 2)` +THEN ONCE_REWRITE_TAC[REAL_ARITH`sqrt ((&2 * h0) pow 2 - norm p pow 2) - sqrt (&2 pow 2 - norm p pow 2)= &1 *(sqrt ((&2 * h0) pow 2 - norm p pow 2) - sqrt (&2 pow 2 - norm p pow 2))`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;REAL_ARITH`(A*(B+C))*(B-C)=A* (B pow 2- C pow 2)`]) +THEN MP_TAC(REAL_ARITH` (norm u pow 2 - norm p pow 2) <= + ((&2 * h0) pow 2 - norm p pow 2) +/\ norm p pow 2 +norm (p - u:real^3) pow 2 =norm u pow 2 +/\ &0<= norm (p-u) pow 2 +==> &0 <= ((&2 * h0) pow 2 - norm p pow 2) +`) +THEN ASM_REWRITE_TAC[REAL_LE_POW_2] +THEN RESA_TAC +THEN MRESAL1_TAC SQRT_POW_2`(&2 * h0) pow 2 - norm (p:real^3) pow 2`[REAL_ARITH`&0 <= norm (w:real^3) pow 2 - norm (p:real^3) pow 2 <=> &0 <= norm w pow 2 - (norm p pow 2+ norm(p-w:real^3) pow 2) + norm(p-w:real^3) pow 2`;REAL_ARITH`A-A+B=B`;REAL_LE_POW_2] +THEN MRESAL1_TAC SQRT_POW_2`&2 pow 2 - norm (p:real^3) pow 2`[REAL_ARITH`&0 <= norm (u:real^3) pow 2 - norm (p:real^3) pow 2 <=> &0 <= norm u pow 2 - (norm p pow 2+ norm(p-u:real^3) pow 2) + norm(p-u:real^3) pow 2`;REAL_ARITH`A-A+B=B`;REAL_LE_POW_2] +THEN REWRITE_TAC[REAL_ARITH`A-B-(C-B)=A-C`] +THEN MP_TAC( REAL_ARITH` +norm (p:real^3) pow 2 <= (&2 * h0) pow 2 - &4 +==> +&4<= (&2 * h0) pow 2 - norm p pow 2 /\ &8 - (&2 * h0) pow 2<= &2 pow 2 - norm p pow 2`) +THEN RESA_TAC +THEN MRESAL_TAC SQRT_MONO_LE[`&4`;`(&2 *h0) pow 2 - norm (p:real^3) pow 2 `][REAL_ARITH`&0<= &4`] +THEN SUBGOAL_THEN`&0 <= &8 - (&2 * h0) pow 2`ASSUME_TAC; +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MRESAL_TAC SQRT_MONO_LE[`&8 - (&2 * h0) pow 2`;`(&2 ) pow 2 - norm (p:real^3) pow 2 `][REAL_ARITH`&0<= &4`] +THEN MP_TAC(REAL_ARITH`sqrt (&8 - (&2 * h0) pow 2) <= sqrt (&2 pow 2 - norm p pow 2)/\ sqrt (&4) <= sqrt ((&2 * h0) pow 2 - norm p pow 2) +==> sqrt (&8 - (&2 * h0) pow 2)+ sqrt (&4) <= sqrt (&2 pow 2 - norm p pow 2)+ sqrt ((&2 * h0) pow 2 - norm (p:real^3) pow 2)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`&0 < sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)` ASSUME_TAC; +MATCH_MP_TAC(REAL_ARITH`&0< A/\ &0 &0< A+B`) +THEN STRIP_TAC +THEN MATCH_MP_TAC SQRT_POS_LT +THEN REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`&0 <= (&2 * h0) pow 2 - &2 pow 2`ASSUME_TAC; +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MRESA_TAC REAL_LE_INV2[`sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)`;`sqrt (&2 pow 2 - norm p pow 2) + sqrt ((&2 * h0) pow 2 - norm (p:real^3) pow 2)`] +THEN MRESA_TAC REAL_LE_RMUL[`inv(sqrt (&2 pow 2 - norm p pow 2) + sqrt ((&2 * h0) pow 2 - norm (p:real^3) pow 2))`;`inv(sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4))`;`((&2 * h0) pow 2 - &2 pow 2)`] +THEN SUBGOAL_THEN`inv (sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)) * + ((&2 * h0) pow 2 - &2 pow 2)< &2` ASSUME_TAC; +MP_TAC(REAL_ARITH` &0< sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4) ==> ~(sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4) = &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`(sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4))` +THEN MRESAL_TAC REAL_LT_LMUL[`inv(sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4))`;`((&2 * h0) pow 2 - &2 pow 2)`;`(sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)) * &2`][REAL_ARITH`A*(B*C)=(A*B)*C/\ &1 *A=A`] +THEN POP_ASSUM MATCH_MP_TAC +THEN STRIP_TAC; +MATCH_MP_TAC REAL_LT_INV +THEN ASM_REWRITE_TAC[]; +REWRITE_TAC[REAL_ARITH`&4= &2 pow 2/\ abs(&2)= &2`;POW_2_SQRT_ABS;] +THEN MATCH_MP_TAC(REAL_ARITH` + h0 pow 2 < &2/\ &0< sqrt (&8 - (&2 * h0) pow 2) +==> +(&2 * h0) pow 2 - &2 pow 2 < (sqrt (&8 - (&2 * h0) pow 2) + &2) * &2 +`) +THEN STRIP_TAC; +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MATCH_MP_TAC SQRT_POS_LT +THEN REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +STRIP_TAC +THEN MP_TAC(REAL_ARITH`inv + (sqrt (&2 pow 2 - norm (p:real^3) pow 2) + + sqrt ((&2 * h0) pow 2 - norm p pow 2)) * + ((&2 * h0) pow 2 - &2 pow 2) <= + inv (sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)) * + ((&2 * h0) pow 2 - &2 pow 2) +/\ inv (sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)) * + ((&2 * h0) pow 2 - &2 pow 2) < + &2 +/\ norm (v - u) <= + inv + (sqrt ((&2 * h0) pow 2 - norm p pow 2) + sqrt (&2 pow 2 - norm p pow 2)) * + ((&2 * h0) pow 2 - &2 pow 2) +==> norm(v-u:real^3)< &2`) +THEN RESA_TAC; +MRESA1_TAC( GEN_ALL packing_lt)`{u,v,w:real^3}` +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`v:real^3`;`u:real^3`][SET_RULE`v IN {u, v, w}`;]); +SET_TAC[]; +ASM_REWRITE_TAC[dist]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SEGMENT_SYM] +THEN STRIP_TAC +THEN SUBGOAL_THEN`&2<= norm(p-u:real^3)`ASSUME_TAC; +MRESAL_TAC DIST_IN_CLOSED_SEGMENT[`p:real^3`;`u:real^3`;`w:real^3`][dist] +THEN MRESA1_TAC packing`{u,v,w:real^3}` +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`w:real^3`;`u:real^3`][SET_RULE`{u, v, w} w /\ {u, v, w} u`;dist]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`norm (p:real^3) pow 2<= (&2 * h0) pow 2- &4`ASSUME_TAC; +MATCH_MP_TAC(REAL_ARITH`&4 <= norm (p - u:real^3) pow 2/\ norm p pow 2 + norm (p - u:real^3) pow 2 = norm u pow 2 /\ norm u pow 2 <= (&2 * h0) pow 2 ==> norm (p:real^3) pow 2<= (&2 * h0) pow 2- &4`) +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC Trigonometry2.POW2_COND[`&2`;`norm(p-u:real^3)`][REAL_ARITH`&0<= &2/\ &2 pow 2= &4`;NORM_POS_LE] +THEN MRESAL_TAC Trigonometry2.POW2_COND[`norm (u:real^3)`;`&2 * h0`][REAL_ARITH`&0 <= &2 * #1.26/\ &2 pow 2= &4`;NORM_POS_LE; h0] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC(SET_RULE`{u, v, w} SUBSET ball_annulus +==> u IN ball_annulus`) +THEN ASM_REWRITE_TAC[ball_annulus; cball;IN_ELIM_THM;DIFF;dist;VECTOR_ARITH`vec 0- w= -- w`;NORM_NEG;h0] +THEN RESA_TAC; +SUBGOAL_THEN`&0<= &2 pow 2 -norm (p:real^3) pow 2` ASSUME_TAC; +MATCH_MP_TAC(REAL_ARITH`A<=(&2 * h0) pow 2 - &4/\ (&2 * h0) pow 2 - &4<= &2 pow 2 ==> &0<= &2 pow 2 -A`) +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MRESAL_TAC between[`p:real^3`;`w:real^3`;`u:real^3`][BETWEEN_IN_SEGMENT;dist] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC SQRT_UNIQUE[`norm (u:real^3) pow 2- norm (p:real^3) pow 2`;`norm (p-u:real^3)`][NORM_POS_LE;REAL_ARITH`A=B-C<=> C+A=B`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC SQRT_UNIQUE[`norm (w:real^3) pow 2- norm (p:real^3) pow 2`;`norm (p-w:real^3)`][NORM_POS_LE;REAL_ARITH`A=B-C<=> C+A=B`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[REAL_ARITH`A=B+C<=> C= A-B`] +THEN MP_TAC(SET_RULE`{u, v, w} SUBSET ball_annulus +==> w IN ball_annulus/\ u IN ball_annulus /\ v IN ball_annulus`) +THEN ASM_REWRITE_TAC[ball_annulus; cball;IN_ELIM_THM;DIFF;dist;VECTOR_ARITH`vec 0- w= -- w`;NORM_NEG;ball;REAL_ARITH`~(a< &2)<=> &2<= a`] +THEN STRIP_TAC +THEN MRESAL_TAC Trigonometry2.POW2_COND[`norm(u:real^3)`;`&2 * h0`][NORM_POS_LE;h0;REAL_ARITH`&0 <= &2 * #1.26`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SYM h0] +THEN STRIP_TAC +THEN MRESAL_TAC Trigonometry2.POW2_COND[`&2`;`norm(w:real^3)`][NORM_POS_LE;REAL_ARITH`&0 <= &2 `] +THEN MP_TAC(REAL_ARITH` +norm (u:real^3) pow 2<= (&2 * h0) pow 2 +/\ &2 pow 2 <= norm (w:real^3) pow 2 +==> +norm u pow 2 - norm (p:real^3) pow 2 <= (&2 * h0) pow 2 - norm p pow 2 +/\ &2 pow 2 - norm p pow 2<= norm w pow 2 - norm p pow 2 `) +THEN RESA_TAC +THEN MRESAL_TAC SQRT_MONO_LE[`norm (u:real^3) pow 2 - norm (p:real^3) pow 2`;`(&2 * h0) pow 2 - norm (p:real^3) pow 2`][REAL_ARITH`&0 <= norm (w:real^3) pow 2 - norm (p:real^3) pow 2 <=> &0 <= norm w pow 2 - (norm p pow 2+ norm(p-w:real^3) pow 2) + norm(p-w:real^3) pow 2`;REAL_ARITH`A-A+B=B`;REAL_LE_POW_2] +THEN MRESAL_TAC SQRT_MONO_LE[`&2 pow 2 - norm (p:real^3) pow 2 `;`norm (w:real^3) pow 2 - norm (p:real^3) pow 2`][] +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`norm (w - u:real^3) = + sqrt (norm u pow 2 - norm p pow 2) - sqrt (norm w pow 2 - norm p pow 2) +/\ sqrt (norm u pow 2 - norm (p:real^3) pow 2) <= + sqrt ((&2 * h0) pow 2 - norm p pow 2) +/\ sqrt (&2 pow 2 - norm p pow 2) <= sqrt (norm w pow 2 - norm p pow 2) +==> norm (w - u:real^3) <= sqrt ((&2 * h0) pow 2 - norm p pow 2) - sqrt (&2 pow 2 - norm p pow 2)`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SUBGOAL_THEN`~(sqrt ((&2 * h0) pow 2 - norm (p:real^3) pow 2) + sqrt (&2 pow 2 - norm p pow 2)= &0)` ASSUME_TAC; +MRESAL_TAC SQRT_UNIQUE[`norm (u:real^3) pow 2- norm (p:real^3) pow 2`;`norm (p-u:real^3)`][NORM_POS_LE;REAL_ARITH`A=B-C<=> C+A=B`] +THEN MATCH_MP_TAC(REAL_ARITH`~(A= &0/\B= &0) /\ &0<= A /\ &0<= B ==> ~(A+B= &0)`) +THEN MRESA1_TAC SQRT_POS_LE`&2 pow 2 - norm (p:real^3) pow 2` +THEN MP_TAC(REAL_ARITH`sqrt (norm u pow 2 - norm p pow 2) <= + sqrt ((&2 * h0) pow 2 - norm p pow 2) +/\ sqrt (norm u pow 2 - norm p pow 2) = norm (p - u:real^3) +/\ &0 <= norm (p - u) +==> &0 <= sqrt ((&2 * h0) pow 2 - norm p pow 2) +`) +THEN ASM_REWRITE_TAC[NORM_POS_LE] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH` (norm u pow 2 - norm p pow 2) <= + ((&2 * h0) pow 2 - norm p pow 2) +/\ norm p pow 2 +norm (p - u:real^3) pow 2 =norm u pow 2 +/\ &0<= norm (p-u) pow 2 +==> &0 <= ((&2 * h0) pow 2 - norm p pow 2) +`) +THEN ASM_REWRITE_TAC[REAL_LE_POW_2] +THEN RESA_TAC +THEN MRESA1_TAC SQRT_EQ_0`(&2 * h0) pow 2 - norm (p:real^3) pow 2` +THEN MRESA1_TAC SQRT_EQ_0`(&2 ) pow 2 - norm (p:real^3) pow 2` +THEN REWRITE_TAC[REAL_ARITH`A-B= &0<=> B=A`] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MRESA1_TAC REAL_MUL_LINV`sqrt ((&2 * h0) pow 2 - norm (p:real^3) pow 2) + + sqrt (&2 pow 2 - norm p pow 2)` +THEN ONCE_REWRITE_TAC[REAL_ARITH`sqrt ((&2 * h0) pow 2 - norm p pow 2) - sqrt (&2 pow 2 - norm p pow 2)= &1 *(sqrt ((&2 * h0) pow 2 - norm p pow 2) - sqrt (&2 pow 2 - norm p pow 2))`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;REAL_ARITH`(A*(B+C))*(B-C)=A* (B pow 2- C pow 2)`]) +THEN MP_TAC(REAL_ARITH` (norm u pow 2 - norm p pow 2) <= + ((&2 * h0) pow 2 - norm p pow 2) +/\ norm p pow 2 +norm (p - u:real^3) pow 2 =norm u pow 2 +/\ &0<= norm (p-u) pow 2 +==> &0 <= ((&2 * h0) pow 2 - norm p pow 2) +`) +THEN ASM_REWRITE_TAC[REAL_LE_POW_2] +THEN RESA_TAC +THEN MRESAL1_TAC SQRT_POW_2`(&2 * h0) pow 2 - norm (p:real^3) pow 2`[REAL_ARITH`&0 <= norm (w:real^3) pow 2 - norm (p:real^3) pow 2 <=> &0 <= norm w pow 2 - (norm p pow 2+ norm(p-w:real^3) pow 2) + norm(p-w:real^3) pow 2`;REAL_ARITH`A-A+B=B`;REAL_LE_POW_2] +THEN MRESAL1_TAC SQRT_POW_2`&2 pow 2 - norm (p:real^3) pow 2`[REAL_ARITH`&0 <= norm (u:real^3) pow 2 - norm (p:real^3) pow 2 <=> &0 <= norm u pow 2 - (norm p pow 2+ norm(p-u:real^3) pow 2) + norm(p-u:real^3) pow 2`;REAL_ARITH`A-A+B=B`;REAL_LE_POW_2] +THEN REWRITE_TAC[REAL_ARITH`A-B-(C-B)=A-C`] +THEN MP_TAC( REAL_ARITH` +norm (p:real^3) pow 2 <= (&2 * h0) pow 2 - &4 +==> +&4<= (&2 * h0) pow 2 - norm p pow 2 /\ &8 - (&2 * h0) pow 2<= &2 pow 2 - norm p pow 2`) +THEN RESA_TAC +THEN MRESAL_TAC SQRT_MONO_LE[`&4`;`(&2 *h0) pow 2 - norm (p:real^3) pow 2 `][REAL_ARITH`&0<= &4`] +THEN SUBGOAL_THEN`&0 <= &8 - (&2 * h0) pow 2`ASSUME_TAC; +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MRESAL_TAC SQRT_MONO_LE[`&8 - (&2 * h0) pow 2`;`(&2 ) pow 2 - norm (p:real^3) pow 2 `][REAL_ARITH`&0<= &4`] +THEN MP_TAC(REAL_ARITH`sqrt (&8 - (&2 * h0) pow 2) <= sqrt (&2 pow 2 - norm p pow 2)/\ sqrt (&4) <= sqrt ((&2 * h0) pow 2 - norm p pow 2) +==> sqrt (&8 - (&2 * h0) pow 2)+ sqrt (&4) <= sqrt (&2 pow 2 - norm p pow 2)+ sqrt ((&2 * h0) pow 2 - norm (p:real^3) pow 2)`) +THEN RESA_TAC +THEN SUBGOAL_THEN`&0 < sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)` ASSUME_TAC; +MATCH_MP_TAC(REAL_ARITH`&0< A/\ &0 &0< A+B`) +THEN STRIP_TAC +THEN MATCH_MP_TAC SQRT_POS_LT +THEN REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`&0 <= (&2 * h0) pow 2 - &2 pow 2`ASSUME_TAC; +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MRESA_TAC REAL_LE_INV2[`sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)`;`sqrt (&2 pow 2 - norm p pow 2) + sqrt ((&2 * h0) pow 2 - norm (p:real^3) pow 2)`] +THEN MRESA_TAC REAL_LE_RMUL[`inv(sqrt (&2 pow 2 - norm p pow 2) + sqrt ((&2 * h0) pow 2 - norm (p:real^3) pow 2))`;`inv(sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4))`;`((&2 * h0) pow 2 - &2 pow 2)`] +THEN SUBGOAL_THEN`inv (sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)) * + ((&2 * h0) pow 2 - &2 pow 2)< &2` ASSUME_TAC; +MP_TAC(REAL_ARITH` &0< sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4) ==> ~(sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4) = &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`(sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4))` +THEN MRESAL_TAC REAL_LT_LMUL[`inv(sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4))`;`((&2 * h0) pow 2 - &2 pow 2)`;`(sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)) * &2`][REAL_ARITH`A*(B*C)=(A*B)*C/\ &1 *A=A`] +THEN POP_ASSUM MATCH_MP_TAC +THEN STRIP_TAC; +MATCH_MP_TAC REAL_LT_INV +THEN ASM_REWRITE_TAC[]; +REWRITE_TAC[REAL_ARITH`&4= &2 pow 2/\ abs(&2)= &2`;POW_2_SQRT_ABS;] +THEN MATCH_MP_TAC(REAL_ARITH` + h0 pow 2 < &2/\ &0< sqrt (&8 - (&2 * h0) pow 2) +==> +(&2 * h0) pow 2 - &2 pow 2 < (sqrt (&8 - (&2 * h0) pow 2) + &2) * &2 +`) +THEN STRIP_TAC; +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MATCH_MP_TAC SQRT_POS_LT +THEN REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +STRIP_TAC +THEN MP_TAC(REAL_ARITH`inv + (sqrt (&2 pow 2 - norm (p:real^3) pow 2) + + sqrt ((&2 * h0) pow 2 - norm p pow 2)) * + ((&2 * h0) pow 2 - &2 pow 2) <= + inv (sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)) * + ((&2 * h0) pow 2 - &2 pow 2) +/\ inv (sqrt (&8 - (&2 * h0) pow 2) + sqrt (&4)) * + ((&2 * h0) pow 2 - &2 pow 2) < + &2 +/\ norm (w - u) <= + inv + (sqrt ((&2 * h0) pow 2 - norm p pow 2) + sqrt (&2 pow 2 - norm p pow 2)) * + ((&2 * h0) pow 2 - &2 pow 2) +==> norm(w-u:real^3)< &2`) +THEN RESA_TAC; +MRESA1_TAC( GEN_ALL packing_lt)`{u,v,w:real^3}` +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`w:real^3`;`u:real^3`][SET_RULE`w IN {u, v, w}`;]); +SET_TAC[]; +ASM_REWRITE_TAC[dist]]);; + + +let POINTS_IN_BALL_ANNULUS_NOT_COLLINEAR2 =prove(`{u,v,w} SUBSET ball_annulus /\ packing {u,v,w} /\ ~(v = u) /\ ~(v = w) /\ ~(u = w) +==> ~(collinear{u,v,w})`, +REWRITE_TAC[COLLINEAR_BETWEEN_CASES;BETWEEN_IN_SEGMENT] +THEN REPEAT STRIP_TAC +THENL[MRESA_TAC(GEN_ALL POINTS_IN_BALL_ANNULUS_NOT_COLLINEAR)[`u:real^3`;`v:real^3`;`w:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{v,u,w}={u,v,w}`] +THEN ASM_REWRITE_TAC[]; +MRESA_TAC(GEN_ALL POINTS_IN_BALL_ANNULUS_NOT_COLLINEAR)[`v:real^3`;`w:real^3`;`u:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{w,v,u}={u,v,w}`] +THEN ASM_REWRITE_TAC[]; +MRESA_TAC(GEN_ALL POINTS_IN_BALL_ANNULUS_NOT_COLLINEAR)[`w:real^3`;`u:real^3`;`v:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`{u,w,v}={u,v,w}`] +THEN ASM_REWRITE_TAC[]]);; + +let SUBSET_PACKING=prove(`!sub s. + packing s /\ sub SUBSET s + ==> packing sub`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[packing;GSYM dist3] +THEN MRESAL_TAC Geomdetail.SUB_PACKING[`sub:real^3->bool`;`s:real^3->bool`][IN]);; + + + + + + + + +let VPWSHTO_PRIME=prove(`!vv:num->real^3. +{vv 0,vv 1,vv 2,vv 3,vv 4} SUBSET ball_annulus /\ packing {vv 0,vv 1,vv 2,vv 3,vv 4} /\ ~(vv 0 = vv 1) /\ ~(vv 0 = vv 1) /\ ~(vv 0 = vv 2)/\ ~(vv 0 = vv 3) +/\ ~(vv 0 = vv 4) /\ ~(vv 1 = vv 2)/\ ~(vv 1 = vv 3) +/\ ~(vv 1 = vv 4) /\ ~(vv 2 = vv 3) +/\ ~(vv 2 = vv 4)/\ ~(vv 3 = vv 4) +/\ norm(vv 0-vv 1)= &2 +/\ norm(vv 1-vv 2)= &2 +/\ norm(vv 2-vv 3)= &2 +/\ norm(vv 3-vv 4)= &2 +/\ norm(vv 4-vv 0)= &2 +==> +?i. i IN 0..4/\ norm(vv i - vv ((i +2) MOD 5) ) <= &1 + sqrt(&5)/\ norm(vv i - vv ((i +3) MOD 5))<= &1 + sqrt(&5)`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC VPWSHTO +THEN ASM_REWRITE_TAC[] +THEN ABBREV_TAC `v= (vv:num->real^3) 0` +THEN ABBREV_TAC `x= (vv:num->real^3) 1` +THEN ABBREV_TAC `u= (vv:num->real^3) 2` +THEN ABBREV_TAC `w= (vv:num->real^3) 3` +THEN ABBREV_TAC `w1= (vv:num->real^3) 4` +THEN MP_TAC(SET_RULE`{v,x,u,w,w1} SUBSET ball_annulus +==> {v, x, u} SUBSET ball_annulus /\ +{w, x, u} SUBSET ball_annulus /\ + {w1, x, u} SUBSET ball_annulus /\ + {w, v, u} SUBSET ball_annulus /\ + {w1, v, u} SUBSET ball_annulus /\ + {w1, w, u} SUBSET ball_annulus /\ + {w, v, x} SUBSET ball_annulus /\ + {w1, v, x} SUBSET ball_annulus /\ + {w1, w, x} SUBSET ball_annulus /\ + {w1, w, v} SUBSET ball_annulus `) +THEN RESA_TAC +THEN MRESAL_TAC SUBSET_PACKING[`{v, x, u:real^3}`;`{v,x,u,w,w1:real^3}`][SET_RULE`{v, x, u:real^3} SUBSET {v,x,u,w,w1:real^3}`] +THEN MRESAL_TAC SUBSET_PACKING[`{w, x, u:real^3}`;`{v,x,u,w,w1:real^3}`][SET_RULE`{w, x, u:real^3} SUBSET {v,x,u,w,w1:real^3}`] +THEN MRESAL_TAC SUBSET_PACKING[`{w1, x, u:real^3}`;`{v,x,u,w,w1:real^3}`][SET_RULE`{w1, x, u:real^3} SUBSET {v,x,u,w,w1:real^3}`] +THEN MRESAL_TAC SUBSET_PACKING[`{w, v, u:real^3}`;`{v,x,u,w,w1:real^3}`][SET_RULE`{w, v, u:real^3} SUBSET {v,x,u,w,w1:real^3}`] +THEN MRESAL_TAC SUBSET_PACKING[`{w1, v, u:real^3}`;`{v,x,u,w,w1:real^3}`][SET_RULE`{w1, v, u:real^3} SUBSET {v,x,u,w,w1:real^3}`] +THEN MRESAL_TAC SUBSET_PACKING[`{w1, w, u:real^3}`;`{v,x,u,w,w1:real^3}`][SET_RULE`{w1, w, u:real^3} SUBSET {v,x,u,w,w1:real^3}`] +THEN MRESAL_TAC SUBSET_PACKING[`{w, v, x:real^3}`;`{v,x,u,w,w1:real^3}`][SET_RULE`{w, v, x:real^3} SUBSET {v,x,u,w,w1:real^3}`] +THEN MRESAL_TAC SUBSET_PACKING[`{w1, v, x:real^3}`;`{v,x,u,w,w1:real^3}`][SET_RULE`{w1, v, x:real^3} SUBSET {v,x,u,w,w1:real^3}`] +THEN MRESAL_TAC SUBSET_PACKING[`{w1, w, x:real^3}`;`{v,x,u,w,w1:real^3}`][SET_RULE`{w1, w, x:real^3} SUBSET {v,x,u,w,w1:real^3}`] +THEN MRESAL_TAC SUBSET_PACKING[`{w1, w, v:real^3}`;`{v,x,u,w,w1:real^3}`][SET_RULE`{w1, w, v:real^3} SUBSET {v,x,u,w,w1:real^3}`] +THEN MRESA_TAC (GEN_ALL POINTS_IN_BALL_ANNULUS_NOT_COLLINEAR2)[`v:real^3`; `x:real^3`; `u:real^3`] +THEN MRESA_TAC (GEN_ALL POINTS_IN_BALL_ANNULUS_NOT_COLLINEAR2)[`w1:real^3`; `x:real^3`; `u:real^3`] +THEN MRESA_TAC (GEN_ALL POINTS_IN_BALL_ANNULUS_NOT_COLLINEAR2)[`w:real^3`; `v:real^3`; `u:real^3`] +THEN MRESA_TAC (GEN_ALL POINTS_IN_BALL_ANNULUS_NOT_COLLINEAR2)[`w1:real^3`; `v:real^3`; `u:real^3`] +THEN MRESA_TAC (GEN_ALL POINTS_IN_BALL_ANNULUS_NOT_COLLINEAR2)[`w:real^3`; `x:real^3`; `u:real^3`] +THEN MRESA_TAC (GEN_ALL POINTS_IN_BALL_ANNULUS_NOT_COLLINEAR2)[`w1:real^3`; `w:real^3`; `u:real^3`] +THEN MRESA_TAC (GEN_ALL POINTS_IN_BALL_ANNULUS_NOT_COLLINEAR2)[`w:real^3`; `v:real^3`; `x:real^3`] +THEN MRESA_TAC (GEN_ALL POINTS_IN_BALL_ANNULUS_NOT_COLLINEAR2)[`w1:real^3`; `v:real^3`; `x:real^3`] +THEN MRESA_TAC (GEN_ALL POINTS_IN_BALL_ANNULUS_NOT_COLLINEAR2)[`w1:real^3`; `w:real^3`; `x:real^3`] +THEN MRESA_TAC (GEN_ALL POINTS_IN_BALL_ANNULUS_NOT_COLLINEAR2)[`w1:real^3`; `w:real^3`; `v:real^3`]);; + + + + +end;; + + diff --git a/text_formalization/local/WJSCPRO.hl b/text_formalization/local/WJSCPRO.hl new file mode 100755 index 0000000..abc1c25 --- /dev/null +++ b/text_formalization/local/WJSCPRO.hl @@ -0,0 +1,3216 @@ + +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + + + +module Wjscpro = struct + + + + + +open Polyhedron;; +open Sphere;; +open Fan_defs;; +open Hypermap;; +open Vol1;; +open Fan;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Sphere;; +open Hypermap;; +open Fan;; +open Topology;; +open Prove_by_refinement;; +open Pack_defs;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; + + + +let POWER_MOD_FUN=prove(`!n. 1<=n /\ 1 ((\i. ((1+i):num MOD k)) POWER n) i = (\i. ((n+i):num MOD k)) i`, +INDUCT_TAC +THENL[ARITH_TAC; +DISJ_CASES_TAC(ARITH_RULE`n=0 \/ 1<=n`) +THENL[ +ASM_REWRITE_TAC[POWER;I_DEF;ARITH_RULE`SUC 0=1`;o_DEF]; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN STRIP_TAC THEN STRIP_TAC +THEN REMOVE_THEN "THY" MP_TAC +THEN RESA_TAC +THEN ASM_REWRITE_TAC[COM_POWER;o_DEF;ADD1;MOD_ADD_MOD] +THEN MP_TAC(ARITH_RULE`1 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`1:num`;`k:num`] +THEN MRESAL_TAC MOD_ADD_MOD[`1`;`n+i:num`;`k:num`][ARITH_RULE`(n + 1) + i=1+n+i`]]]);; + + + + +let CLOSED_SY=prove_by_refinement(` +stable_system k d (0..k-1) a b J (\i. ((1+i):num MOD k)) /\k= dimindex(:M) +/\ 1< k /\ 2 +closed {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY a b v /\ CONDITION2_SY v }`, +[REWRITE_TAC[CONDITION2_SY;CONDITION1_SY;stable_system] +THEN REPEAT GEN_TAC THEN REWRITE_TAC[CLOSED_SEQUENTIAL_LIMITS] THEN REWRITE_TAC[LIM_SEQUENTIALLY; IN_ELIM_THM; dist] +THEN REPEAT STRIP_TAC +THEN ASM_TAC +THEN DISCH_THEN(LABEL_TAC"THYGIANG2") +THEN DISCH_THEN(LABEL_TAC"THYGIANG") +THEN DISCH_THEN(LABEL_TAC"THYGIANG1") +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`vecmats (l:real^(M,3)finite_product)` +THEN SIMP_TAC[MATVEC_VECMATS_ID] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SKOLEM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY1") +THEN DISCH_THEN(LABEL_TAC"THY2") +THEN SUBGOAL_THEN` +!i j. 1 <= i /\ i <= dimindex (:M) /\ 1 <= j /\ j <= dimindex (:M) +==> +((\n. row i (v n) - row j ((v:num->real^3^M) n)) --> row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))) + sequentially`ASSUME_TAC; + +SIMP_TAC[EVENTUALLY_SEQUENTIALLY;TRIVIAL_LIMIT_SEQUENTIALLY;LIM_SEQUENTIALLY] +THEN REPEAT STRIP_TAC +THEN SIMP_TAC[dist;VECTOR_ARITH`A-B-(C-D)=(A-C)-(B-D):real^N`] +THEN MP_TAC(REAL_ARITH`&0< e==> &0< e/ &2`) +THEN RESA_TAC +THEN REMOVE_THEN "THY2"(fun th-> MRESA1_TAC th`e/ &2:real`) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY2") +THEN EXISTS_TAC`N:num` +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THY2"(fun th-> MRESA1_TAC th`n:num`) +THEN MP_TAC(ARITH_RULE`1<=i /\ i <= dimindex (:M)==> i -1 < dimindex (:M)/\ SUC(i-1)=i`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`1<=j /\ j <= dimindex (:M)==> j -1 < dimindex (:M)/\ SUC(j-1)=j`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`i-1`;`((v:num->real^3^M) n)`] +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`i-1`;`vecmats (l:real^(M,3)finite_product)`] +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[MATVEC_VECMATS_ID] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL NORM_VECMAT)[`i-1`;`matvec ((v:num->real^3^M) n) - (l:real^(M,3)finite_product)`][VECMAT_SUB] +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`j-1`;`((v:num->real^3^M) n)`] +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`j-1`;`vecmats (l:real^(M,3)finite_product)`] +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[MATVEC_VECMATS_ID] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL NORM_VECMAT)[`j-1`;`matvec ((v:num->real^3^M) n) - (l:real^(M,3)finite_product)`][VECMAT_SUB] +THEN MRESAL_TAC NORM_TRIANGLE[`row i ((v:num->real^3^M) n) - row i (vecmats (l:real^(M,3)finite_product))`;`--(row j ((v:num->real^3^M) n) - row j (vecmats (l:real^(M,3)finite_product)))`][NORM_NEG;VECTOR_ARITH`A+ --B=A-B:real^N` ] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +SUBGOAL_THEN` +!i. 1 <= i /\ i <= dimindex (:M) ==> +((\n. row i ((v:num->real^3^M) n)) --> row i (vecmats (l:real^(M,3)finite_product))) + sequentially`ASSUME_TAC; + +SIMP_TAC[EVENTUALLY_SEQUENTIALLY;TRIVIAL_LIMIT_SEQUENTIALLY;LIM_SEQUENTIALLY] +THEN REPEAT STRIP_TAC +THEN SIMP_TAC[dist;VECTOR_ARITH`A-B-(C-D)=(A-C)-(B-D):real^N`] +THEN MP_TAC(REAL_ARITH`&0< e==> &0< e/ &2`) +THEN RESA_TAC +THEN REMOVE_THEN "THY2"(fun th-> MRESA1_TAC th`e:real`) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY2") +THEN EXISTS_TAC`N:num` +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THY2"(fun th-> MRESA1_TAC th`n:num`) +THEN MP_TAC(ARITH_RULE`1<=i /\ i <= dimindex (:M)==> i -1 < dimindex (:M)/\ SUC(i-1)=i`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`1<=j /\ j <= dimindex (:M)==> j -1 < dimindex (:M)/\ SUC(j-1)=j`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`i-1`;`((v:num->real^3^M) n)`] +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`i-1`;`vecmats (l:real^(M,3)finite_product)`] +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[MATVEC_VECMATS_ID] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL NORM_VECMAT)[`i-1`;`matvec ((v:num->real^3^M) n) - (l:real^(M,3)finite_product)`][VECMAT_SUB] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU2") +THEN SUBGOAL_THEN`(!i j. + 1 <= i /\ i <= dimindex (:M) /\ 1 <= j /\ j <= dimindex (:M) + ==> (a:num#num->real) (i,j) <= norm (row i (vecmats l) - row j (vecmats l)) /\ + norm (row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))) <= (b:num#num->real) (i,j))` ASSUME_TAC; + +REPEAT STRIP_TAC; + +MRESA_TAC LIM_NORM_LBOUND[`sequentially`;`(\n. row i (v n) - row j ((v:num->real^3^M) n))`;`row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))`;`(a:num#num->real)(i,j)`] +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_SIMP_TAC[EVENTUALLY_SEQUENTIALLY;TRIVIAL_LIMIT_SEQUENTIALLY;LIM_SEQUENTIALLY]; + +MRESA_TAC LIM_NORM_UBOUND[`sequentially`;`(\n. row i (v n) - row j ((v:num->real^3^M) n))`;`row i (vecmats l) - row j (vecmats (l:real^(M,3)finite_product))`;`(b:num#num->real)(i,j)`] +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_SIMP_TAC[EVENTUALLY_SEQUENTIALLY;TRIVIAL_LIMIT_SEQUENTIALLY;LIM_SEQUENTIALLY]; + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`!i j. + 1 <= i /\ i <= dimindex (:M) /\ 1 <= j /\ j <= dimindex (:M) /\ ~(i=j) + ==> &2 <= norm (row i (vecmats (l:real^(M,3)finite_product)) - row j (vecmats l))` ASSUME_TAC; + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY3") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THY3"(fun th-> MRESA_TAC th[`i:num`;`j:num`]) +THEN MATCH_MP_TAC(REAL_ARITH`a (i,j) <= norm (row i (vecmats l) - row j (vecmats l)) /\ &2<= a(i,j)==> &2 <= norm (row i (vecmats l) - row j (vecmats l))`) +THEN MP_TAC(ARITH_RULE`i <= dimindex (:M)==> i <= dimindex (:M)-1 \/ i = dimindex (:M)`); + +RESA_TAC; + +MP_TAC(ARITH_RULE`j <= dimindex (:M)==> j <= dimindex (:M)-1 \/ j = dimindex (:M)`); + +RESA_TAC; + +REMOVE_THEN"THYGIANG"MP_TAC +THEN ASM_SIMP_TAC[IN_NUMSEG] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`i:num`;`j:num`][ARITH_RULE`0<= i:num`]); + +MP_TAC(ARITH_RULE`1<= i==> ~(i = 0)`) +THEN RESA_TAC +THEN REMOVE_THEN"THYGIANG"MP_TAC +THEN ASM_SIMP_TAC[IN_NUMSEG] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`i:num`;`0:num`][ARITH_RULE`0<= i:num`]) +THEN MP_TAC(ARITH_RULE`1 1<=k`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] +THEN REMOVE_THEN "THYGIANG2" MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`i:num`;`k:num`;][IN_NUMSEG;ARITH_RULE`0<=a:num/\ A+0=A `]) +THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ dimindex (:M) + dimindex (:M)= dimindex (:M) *2`]; + +MP_TAC(ARITH_RULE`j <= dimindex (:M)==> j <= dimindex (:M)-1 \/ j = dimindex (:M)`); + +RESA_TAC; + +MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A`] +THEN MP_TAC(ARITH_RULE`1 1<=k`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] +THEN REMOVE_THEN "THYGIANG2" MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`j:num`;`k:num`;][IN_NUMSEG;ARITH_RULE`0<=a:num/\ A+0=A `]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`j:num`;`k:num`;][IN_NUMSEG;ARITH_RULE`0<=a:num/\ A+0=A /\ dimindex (:M) + dimindex (:M)= dimindex (:M) *2`]) +THEN MP_TAC(ARITH_RULE`1<= j==> ~(j = 0)`) +THEN RESA_TAC +THEN REMOVE_THEN"THYGIANG"MP_TAC +THEN ASM_SIMP_TAC[IN_NUMSEG] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`j:num`;`0:num`][ARITH_RULE`0<= i:num`]); + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN SET_TAC[]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY3") +THEN DISCH_THEN(LABEL_TAC"THY4") +THEN SUBGOAL_THEN`!i. + 1 <= i /\ i <= dimindex (:M) + ==> norm (row i (vecmats (l:real^(M,3)finite_product)) - row (SUC (i MOD dimindex (:M))) (vecmats l))<= cstab` ASSUME_TAC; + +REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`i<= dimindex (:M) ==> i< dimindex (:M) \/ i=dimindex (:M)`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE`i< dimindex (:M) ==> i<= dimindex (:M) /\ i+1<=dimindex (:M) /\ i<= dimindex (:M)-1`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_LT[`i:num`;`k:num`][ADD1] +THEN REMOVE_THEN "THY3"(fun th-> MRESAL_TAC th[`i:num`;`i+1:num`][ARITH_RULE`1<= i+1`]) +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN"THYGIANG1"MP_TAC +THEN ASM_SIMP_TAC[IN_NUMSEG] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`i:num`[ARITH_RULE`0<= i:num`]) +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "THYGIANG2" MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`i:num`;`i+1:num`;][IN_NUMSEG;ARITH_RULE`0<=a:num/\ A+0=A `]) +THEN MP_TAC(ARITH_RULE`1 1<=k`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`i+1:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`i+1`][ARITH_RULE`1*A=A`] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[ARITH_RULE`A+1=1+A`] +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +MRESAL_TAC MOD_MULT[`k:num`;`1`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ SUC 0=1`] +THEN REMOVE_THEN "THY3"(fun th-> MRESAL_TAC th[`k:num`;`1:num`][ARITH_RULE`1<= 1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE` (1 <= dimindex (:M)) ==> 0 <= dimindex (:M) - 1` ) +THEN SIMP_TAC[DIMINDEX_GE_1] +THEN STRIP_TAC +THEN REMOVE_THEN"THYGIANG1"MP_TAC +THEN ASM_SIMP_TAC[IN_NUMSEG] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`0:num`[ARITH_RULE`0<= 0:num/\ 0+1=1`;]) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC MOD_LT[`1:num`;`k:num`][ARITH_RULE`0<1`] +THEN REMOVE_THEN "THYGIANG2" MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`k:num`;`1:num`;][IN_NUMSEG;ARITH_RULE`0<=a:num/\ A+0=A `] THEN +MRESAL_TAC th[`0:num`;`1:num`;][IN_NUMSEG;ARITH_RULE`0<=a:num/\ A+0=A `]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`1:num`;`k:num`;][IN_NUMSEG;ARITH_RULE`0<=a:num/\ A+0=A `]) +THEN MP_TAC(ARITH_RULE`1 1<=k`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ dimindex (:M) + dimindex (:M)= dimindex (:M) *2`] +THEN REAL_ARITH_TAC; + +SUBGOAL_THEN`(!i. 1 <= i /\ i <= dimindex (:M) ==> row i (vecmats (l:real^(M,3)finite_product)) IN ball_annulus)` ASSUME_TAC; + +MP_TAC COMPACT_BALL_ANNULUS +THEN ASM_SIMP_TAC[COMPACT_EQ_BOUNDED_CLOSED] +THEN REWRITE_TAC[CLOSED_SEQUENTIAL_LIMITS] THEN REWRITE_TAC[ IN_ELIM_THM; dist] +THEN REWRITE_TAC[SKOLEM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "YEU" (fun th-> MRESA_TAC th[`(\n. row i ((v:num->real^3^M) n)) `;` row i (vecmats (l:real^(M,3)finite_product))`]) +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_SIMP_TAC[]; + +SUBGOAL_THEN`!i. 1 <= i /\ i <= dimindex (:M) + ==> + ~(row i (vecmats l) = + row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))) `ASSUME_TAC; + +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY5") +THEN REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL SUC_NOT)[`i:num`;`k:num`] +THEN REMOVE_THEN"THY5"(fun th-> MRESAL_TAC th[`i:num`;`SUC (i MOD dimindex (:M))`][VECTOR_ARITH`A-A = vec 0`;NORM_0]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[convex_local_fan] +THEN ASM_REWRITE_TAC[local_fan] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN SUBGOAL_THEN `FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l))`ASSUME_TAC; + +REWRITE_TAC[FAN] +THEN STRIP_TAC; + +REWRITE_TAC[SUBSET;UNIONS;E_SY;V_SY;IN_ELIM_THM;rows] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[SET_RULE`A IN {B,C}<=> A=B \/ A=C`] +THEN STRIP_TAC; + +EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; + +EXISTS_TAC`SUC (i MOD dimindex (:M))` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[GRAPH;E_SY;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[HAS_SIZE] +THEN ASM_SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY ; IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[fan1;V_SY;rows] +THEN STRIP_TAC; + +MRESAL_TAC FINITE_IMAGE[`(\i. row i (vecmats (l:real^(M,3)finite_product)))`;`1..k`][IMAGE;IN_ELIM_THM;FINITE_NUMSEG;IN_NUMSEG] +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`{y | ?x. (1 <= x /\ x <= dimindex (:M)) /\ y = row x (vecmats l)}={row i (vecmats (l:real^(M,3)finite_product)) | 1 <= i /\ i <= dimindex (:M)}`ASSUME_TAC; + +REWRITE_TAC[EXTENSION;IN_ELIM_THM]; + +ASM_REWRITE_TAC[]; + +REWRITE_TAC[SET_RULE`~(A SUBSET {})<=> ?a. a IN A`;IN_ELIM_THM] +THEN EXISTS_TAC`row 1(vecmats (l:real^(M,3)finite_product))` +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<=1`;DIMINDEX_GE_1]; + +STRIP_TAC; + +REWRITE_TAC[fan2;V_SY;IN_ELIM_THM;rows;NOT_EXISTS_THM;DE_MORGAN_THM] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(1<= i) \/ 1<= i`); + +ASM_REWRITE_TAC[]; + +DISJ_CASES_TAC(SET_RULE`~(i<= dimindex (:M)) \/ i<= dimindex (:M)`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEUEM") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"YEUEM"(fun th-> MRESAL1_TAC th `i:num`[ball_annulus;IN_ELIM_THM]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIFF;IN_ELIM_THM;ball;DE_MORGAN_THM;dist;VECTOR_ARITH`vec 0- vec 0=vec 0`;NORM_0;REAL_ARITH`&0< &2`]); + +SUBGOAL_THEN`!i. (1 <= i /\ i <= dimindex (:M)) + ==> ~collinear ({vec 0} UNION {row i (vecmats l), row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))})`ASSUME_TAC; + +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC NONPARALLEL_BALL_ANNULUS +THEN ASM_SIMP_TAC[] +THEN MRESA_TAC (GEN_ALL SUC_NOT)[`i:num`;`k:num`] +THEN ASM_SIMP_TAC[]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`{A} UNION {B,C}={A,B,C}`] +THEN REPEAT STRIP_TAC; + +REWRITE_TAC[fan6;E_SY;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC NONPARALLEL_BALL_ANNULUS +THEN ASM_SIMP_TAC[] +THEN MRESA_TAC (GEN_ALL SUC_NOT)[`i:num`;`k:num`] +THEN ASM_SIMP_TAC[]; + +REWRITE_TAC[fan7;] +THEN SUBGOAL_THEN`!i. 1 <= i /\ i <= dimindex (:M) + ==> ~(vec 0= row i (vecmats l)) /\ ~(vec 0 = row (SUC (i MOD dimindex (:M)))(vecmats (l:real^(M,3)finite_product)))`ASSUME_TAC; + +STRIP_TAC +THEN STRIP_TAC +THEN MRESA_TAC th3[`(vec 0):real^3`;`row i (vecmats (l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[]; + +SUBGOAL_THEN`!u w. + u IN V_SY (vecmats l) /\ + w IN V_SY (vecmats (l:real^(M,3)finite_product)) + ==> aff_ge {vec 0} {u} INTER aff_ge {vec 0} {w} = + aff_ge {vec 0} ({u} INTER {w})`ASSUME_TAC; + +REWRITE_TAC[V_SY;IN_ELIM_THM;rows] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`u=w:real^3 \/ {u} INTER {w}={}`); + +POP_ASSUM(fun th-> REWRITE_TAC[th;SET_RULE`A INTER A=A`]); + +ASM_REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{u} INTER {w} = {} <=> ~(u=w) `;EXTENSION; INTER;IN_ELIM_THM;IN_SING] +THEN REPEAT STRIP_TAC +THEN EQ_TAC; + +REPEAT STRIP_TAC +THEN MATCH_MP_TAC (GEN_ALL VEC0_BALL_ANNULUS) +THEN EXISTS_TAC`u:real^3` +THEN EXISTS_TAC`w:real^3` +THEN DISJ_CASES_TAC(SET_RULE`i=i':num \/ ~(i=i')`); + +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN SET_TAC[]); + +ASM_SIMP_TAC[]; + +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[ENDS_IN_HALFLINE]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY50") +THEN DISCH_THEN(LABEL_TAC"THY5") +THEN DISCH_THEN(LABEL_TAC"THY55") +THEN DISCH_THEN(LABEL_TAC"THY6") +THEN DISCH_THEN(LABEL_TAC"THY7") +THEN DISCH_THEN(LABEL_TAC"THY8") +THEN SUBGOAL_THEN`!e1 v. + e1 IN E_SY (vecmats l) /\ v IN V_SY (vecmats (l:real^(M,3)finite_product)) + ==> aff_ge {vec 0} e1 INTER aff_ge {vec 0} {v} = + aff_ge {vec 0} (e1 INTER {v})` ASSUME_TAC; + +REWRITE_TAC[E_SY;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"GIANG") +THEN ABBREV_TAC`y=row i (vecmats (l:real^(M,3)finite_product))` +THEN ABBREV_TAC`z=row (SUC (i MOD dimindex (:M))) (vecmats +(l:real^(M,3)finite_product))` +THEN ASM_REWRITE_TAC[] +THEN DISJ_CASES_TAC(SET_RULE`y= v' \/ z= v' \/ (~(v'=y)/\ ~(v'=z:real^3))`); + +ASM_REWRITE_TAC[SET_RULE`{A,B} INTER {A}={A}`] +THEN REMOVE_THEN "THY6"(fun th-> MRESA1_TAC th`i:num`) +THEN MRESA_TAC Planarity.aff_ge_eq_aff_gt_union_aff_ge[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN SET_TAC[]; + +POP_ASSUM MP_TAC +THEN STRIP_TAC; + +ASM_REWRITE_TAC[SET_RULE`{A,B} INTER {B}={B}`] +THEN REMOVE_THEN "THY6"(fun th-> MRESA1_TAC th`i:num`) +THEN MRESA_TAC Planarity.aff_ge_eq_aff_gt_union_aff_ge[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN SET_TAC[]; + +SUBGOAL_THEN`y IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`z IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`SUC (i MOD dimindex (:M))` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +REMOVE_THEN "THY6"(fun th-> MRESA1_TAC th`i:num`) +THEN MRESA_TAC Planarity.aff_ge_eq_aff_gt_union_aff_ge[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN REMOVE_THEN"THY8"(fun th-> MRESA_TAC th[`y:real^3`;`v':real^3`] THEN MRESA_TAC th[`z:real^3`;`v':real^3`]) +THEN MP_TAC(SET_RULE`~(y= v') /\ ~(z= v') ==> {y} INTER {v':real^3}={}/\ {z} INTER {v':real^3}={} /\ {y,z} INTER {v':real^3}={}`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`(A UNION B UNION C) INTER D=(A INTER D) UNION (B INTER D) UNION (C INTER D)`;SET_RULE`A UNION A=A`] +THEN REMOVE_THEN "THY50"(fun th-> MRESA1_TAC th`i:num`) +THEN USE_THEN"GIANG" MP_TAC +THEN REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN STRIP_TAC +THEN SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; + +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +REMOVE_THEN "THY5"(fun th-> MRESA1_TAC th`i:num` THEN MRESA1_TAC th`i':num` THEN MRESA1_TAC th`(SUC (i MOD dimindex (:M))):num`) +THEN DISJ_CASES_TAC(SET_RULE`i= i' \/ ~(i= i':num)`); + +POP_ASSUM( fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT RESA_TAC); + +DISJ_CASES_TAC(SET_RULE`i'= SUC (i MOD dimindex (:M)) \/ ~(i'= SUC (i MOD dimindex (:M)):num)`); + +POP_ASSUM( fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT RESA_TAC); + + + + + + + + + + + +MRESA_TAC (GEN_ALL SUC_NOT)[`i:num`;`k:num`] +THEN REMOVE_THEN"THY4"(fun th-> MRESA_TAC th[`i':num`;`i:num`] THEN MRESA_TAC th[`i':num`;`SUC (i MOD dimindex (:M)):num`] THEN MRESA_TAC th[`i:num`;`SUC (i MOD dimindex (:M)):num`]) +THEN DISJ_CASES_TAC(SET_RULE`collinear{vec 0, y, v':real^3}\/ ~collinear{vec 0, y, v':real^3}`); + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC th3[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.collinear_fan22)[`vec 0:real^3`;`v':real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,B,A}`] +THEN RESA_TAC +THEN REMOVE_THEN"THY7"(fun th-> MRESA1_TAC th`i':num`) +THEN MRESAL_TAC Planarity.sym_line_fan[`vec 0:real^3`;`v':real^3`;`y:real^3`][SET_RULE`DISJOINT {x} {y,z} <=> ~(x=y)/\ ~(x=z)`] +THEN MRESA_TAC (GEN_ALL AFF_INTER_AFF_GT_EQ_EMPTY)[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{vec 0:real^3}`;`{v':real^3}`][SET_RULE`{A} UNION {B}={A,B}`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[aff] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`aff_ge {vec 0} {v'} SUBSET affine hull {vec 0, v'} + /\ affine hull {vec 0, v'} INTER aff_gt {vec 0} {y, z} = {} +==> aff_gt {vec 0} {y, z:real^3} INTER aff_ge {vec 0} {v'} = {}`) +THEN RESA_TAC +THEN SET_TAC[]; + +DISJ_CASES_TAC(SET_RULE`collinear{vec 0, z, v':real^3}\/ ~collinear{vec 0, z, v':real^3}`); + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC th3[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.collinear_fan22)[`vec 0:real^3`;`v':real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,B,A}`] +THEN RESA_TAC +THEN REMOVE_THEN"THY7"(fun th-> MRESA1_TAC th`i':num`) +THEN MRESAL_TAC Planarity.sym_line_fan[`vec 0:real^3`;`v':real^3`;`z:real^3`][SET_RULE`DISJOINT {x} {y,z} <=> ~(x=y)/\ ~(x=z)`] +THEN MRESA_TAC (GEN_ALL AFF_INTER_AFF_GT_EQ_EMPTY)[`vec 0:real^3`;`z:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{vec 0:real^3}`;`{v':real^3}`][SET_RULE`{A} UNION {B}={A,B}`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[aff] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`aff_ge {vec 0} {v'} SUBSET affine hull {vec 0, v'} + /\ affine hull {vec 0, v'} INTER aff_gt {vec 0} {z,y} = {} +==> aff_gt {vec 0} { z:real^3,y} INTER aff_ge {vec 0} {v'} = {}`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]; + +MRESA_TAC (GEN_ALL BALL_ANNULUS_4PONITS_AFF_GT)[`v':real^3`;`y:real^3`;`z:real^3`] +THEN MRESA_TAC th3[`vec 0:real^3`;`y:real^3`;`v':real^3`] +THEN MRESA_TAC (GEN_ALL AFF_GE_INTER_AFF_GT_EQ_EMPTY)[`v':real^3`;`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B= B INTER A`] +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]; + +SUBGOAL_THEN`!e1 e2. + e1 IN E_SY (vecmats l) /\ + e2 IN E_SY (vecmats (l:real^(M,3)finite_product)) /\ (e1 INTER e2={}) + ==> aff_gt {vec 0} e1 INTER aff_gt {vec 0} e2 = {}` ASSUME_TAC; + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN REPEAT GEN_TAC +THEN DISCH_TAC +THEN POP_ASSUM (fun th-> MP_TAC th +THEN REWRITE_TAC[E_SY;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MP_TAC th +THEN STRIP_TAC) +THEN ABBREV_TAC`y=row i (vecmats (l:real^(M,3)finite_product))` +THEN ABBREV_TAC`z=row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))` +THEN ABBREV_TAC`y1=row i' (vecmats (l:real^(M,3)finite_product))` +THEN ABBREV_TAC`z1=row (SUC (i' MOD dimindex (:M))) (vecmats +(l:real^(M,3)finite_product))` +THEN DISJ_CASES_TAC(SET_RULE`(?v3. v3 IN aff_gt {vec 0} {y, z} INTER aff_gt {vec 0} {y1, z1}) \/ aff_gt {vec 0} {y, z} INTER aff_gt {vec 0} {y1, z1:real^3}={}`); + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[INTER;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_THEN"THY6"(fun th-> MRESA1_TAC th`i:num` THEN MRESA1_TAC th`i':num` THEN MP_TAC(th) THEN DISCH_THEN(LABEL_TAC"THY6")) +THEN MRESA_TAC Planarity.properties_of_collinear4_points_fan[`vec 0:real^3`;`y:real^3`;`z:real^3`;`v3:real^3`;] +THEN MRESA_TAC Planarity.properties_of_collinear4_points_fan[`vec 0:real^3`;`z:real^3`;`y:real^3`;`v3:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MRESA_TAC Planarity.properties_of_collinear4_points_fan[`vec 0:real^3`;`y1:real^3`;`z1:real^3`;`v3:real^3`;] +THEN MRESA_TAC Planarity.properties_of_collinear4_points_fan[`vec 0:real^3`;`z1:real^3`;`y1:real^3`;`v3:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`(v3 cross y:real^3) dot y1 = &0 \/ &0< (v3 cross y) dot y1 \/ &0< --((v3 cross y) dot y1)`); + +MRESAL_TAC (GEN_ALL Local_lemmas.COPLANAR_IFF_CROSS_DOT)[`y:real^3`;`v3:real^3`;`y1:real^3`;`vec 0:real^3`;][VECTOR_ARITH`A- vec 0=A`] +THEN SUBGOAL_THEN`y1 IN aff {vec 0, v3,y:real^3}` ASSUME_TAC; + +ASM_SIMP_TAC[Conforming.aff_3_rep_cross_dot;IN_ELIM_THM;VECTOR_ARITH`A- vec 0=A`]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[aff; AFFINE_HULL_3;IN_ELIM_THM;VECTOR_ARITH`A % vec 0+B=B`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th)) +THEN DISJ_CASES_TAC(REAL_ARITH`&0<= w\/ &0<= -- w`); + +SUBGOAL_THEN`y1 IN aff_ge {vec 0,v3} {y:real^3}` ASSUME_TAC; + +ASM_SIMP_TAC[AFF_GE_2_1;th3;IN_ELIM_THM] +THEN EXISTS_TAC`u:real` +THEN EXISTS_TAC`v':real` +THEN EXISTS_TAC`w:real` +THEN ASM_REWRITE_TAC[] +THEN VECTOR_ARITH_TAC; + +MRESA_TAC Planarity.decomposition_planar_by_angle_fan[`vec 0:real^3`;`v3:real^3`;`y:real^3`;`y1:real^3`]; + +MRESA_TAC Planarity.aff_gt3_subset_aff_gt[`vec 0:real^3`;`y1:real^3`;`z1:real^3`;`v3:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[th3;SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`y IN aff_gt {vec 0} {v3, y1} /\ aff_gt {vec 0} {v3, y1} SUBSET aff_gt {vec 0} {y1, z1} /\ aff_gt {vec 0} {y1, z1} SUBSET aff_ge {vec 0} {y1, z1} +==> y IN aff_ge {vec 0} {y1, z1:real^3}`) +THEN ASM_SIMP_TAC[AFF_GT_SUBSET_AFF_GE] +THEN STRIP_TAC +THEN MRESA_TAC Planarity.aff_ge_1_1_subset_aff_ge_fan[`vec 0:real^3`;`y1:real^3`;`z1:real^3`;`y:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[th3] +THEN MRESA_TAC th3[`vec 0:real^3`;`v3:real^3`;`y:real^3`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`aff_ge {vec 0} {y} SUBSET aff_ge {vec 0} {y1, z1} +==> aff_ge {vec 0} {y1, z1} INTER aff_ge {vec 0} {y} =aff_ge {vec 0} {y:real^3} `) +THEN RESA_TAC +THEN SUBGOAL_THEN`y IN V_SY(vecmats (l:real^(M,3)finite_product))`ASSUME_TAC; + +ASM_SIMP_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; + +MP_TAC(SET_RULE`y IN aff_gt {vec 0} {v3, y1}/\ aff_gt {vec 0} {v3, y1} SUBSET aff_gt {vec 0} {y1, z1:real^3} ==> y IN aff_gt {vec 0} {y1, z1}`) +THEN RESA_TAC +THEN MRESA_TAC Planarity.properties_of_collinear4_points_fan[`vec 0:real^3`;`y1:real^3`;`z1:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,C,A}`] +THEN RESA_TAC +THEN MRESA_TAC th3[`y:real^3`;`y1:real^3`;`vec 0:real^3`] +THEN MRESA_TAC Planarity.properties_of_collinear4_points_fan[`vec 0:real^3`;`z1:real^3`;`y1:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,C,A}`] +THEN RESA_TAC +THEN MRESA_TAC th3[`z1:real^3`;`y:real^3`;`vec 0:real^3`] +THEN MP_TAC(SET_RULE`~(y = y1) /\ ~(z1=y)==> {y1,z1:real^3} INTER {y}={}`) +THEN RESA_TAC +THEN REMOVE_THEN"YEU"(fun th-> MRESAL_TAC th[`e2:(real^3->bool)`;`y:real^3`][AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING]) +THEN MRESAL_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`y:real^3`][IN_SING]; + +MP_TAC(SET_RULE`v3 IN aff_gt {vec 0} {y, z} /\ aff_gt {vec 0} {y, z} SUBSET aff_ge {vec 0} {y, z} +==> v3 IN aff_ge {vec 0} {y, z:real^3}`) +THEN ASM_SIMP_TAC[AFF_GT_SUBSET_AFF_GE] +THEN STRIP_TAC +THEN MRESA_TAC Planarity.aff_ge1_subset_aff_ge[`vec 0:real^3`;`z:real^3`;`y:real^3`;`v3:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[th3;SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`y1 IN aff_ge {vec 0} {v3, y} /\ aff_ge {vec 0} {v3, y} SUBSET aff_ge {vec 0} {y, z} +==> y1 IN aff_ge {vec 0} {y, z:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC Planarity.aff_ge_1_1_subset_aff_ge_fan[`vec 0:real^3`;`y:real^3`;`z:real^3`;`y1:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[th3] +THEN MRESA_TAC th3[`vec 0:real^3`;`v3:real^3`;`y1:real^3`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`aff_ge {vec 0} {y1} SUBSET aff_ge {vec 0} {y, z} +==> aff_ge {vec 0} {y, z} INTER aff_ge {vec 0} {y1} =aff_ge {vec 0} {y1:real^3} `) +THEN RESA_TAC +THEN SUBGOAL_THEN`y1 IN V_SY(vecmats (l:real^(M,3)finite_product))`ASSUME_TAC; + +ASM_SIMP_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`i':num` +THEN ASM_REWRITE_TAC[]; + +MP_TAC(SET_RULE`{y,z} INTER {y1,z1:real^3}={}==> {y,z} INTER {y1}={}`) +THEN RESA_TAC +THEN REMOVE_THEN"YEU"(fun th-> MRESAL_TAC th[`e1:(real^3->bool)`;`y1:real^3`][AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING]) +THEN MRESAL_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`y1:real^3`][IN_SING]; + +SUBGOAL_THEN`y1 IN aff_ge {vec 0,v3} {z:real^3}` ASSUME_TAC; + +ASM_SIMP_TAC[AFF_GE_2_1;th3;IN_ELIM_THM] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AFF_GT_1_2[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[th3] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`v3 IN aff_gt {vec 0} {y, z:real^3}` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM;VECTOR_ARITH`a % vec 0 + b=b`]) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;VECTOR_ARITH`v' % (t2 % y + t3 % z) + w % y= (v' * t2+w) % y + (v'*t3) % z /\ +t2' % (t2 % y + t3 % z) + t3' % z = (t2' *t2) % y + (t2'*t3+t3') % z`]) +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 ~(t2= &0) /\ &0<= t3 /\ &0<= t2`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2:real` +THEN EXISTS_TAC`&1- (v' * t2 + w)* inv t2 -(v' * t3 - (v' * t2 + w)* inv t2 * t3):real` +THEN EXISTS_TAC`(v' * t2 + w)* inv t2 :real` +THEN EXISTS_TAC`v' * t3 - (v' * t2 + w)* inv t2 * t3:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1-A-B+A+B= &1/\ ((v' * t2 + w) * inv t2) * t3 + v' * t3 - (v' * t2 + w) * inv t2 * t3 =v' * t3 /\ (A*B)*C=A*(B*C) /\A * &1=A +/\ v' * t3 - (v' * t2 + w) * inv t2 * t3= (v' - v' * (inv t2 *t2) - w* inv t2) * t3 /\ A-A -B*C= (--B)* C`;] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LE_INV +THEN ASM_REWRITE_TAC[]; + +MRESA_TAC Planarity.decomposition_planar_by_angle_fan[`vec 0:real^3`;`v3:real^3`;`z:real^3`;`y1:real^3`]; + +MRESA_TAC Planarity.aff_gt3_subset_aff_gt[`vec 0:real^3`;`y1:real^3`;`z1:real^3`;`v3:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[th3;SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`z IN aff_gt {vec 0} {v3, y1} /\ aff_gt {vec 0} {v3, y1} SUBSET aff_gt {vec 0} {y1, z1} /\ aff_gt {vec 0} {y1, z1} SUBSET aff_ge {vec 0} {y1, z1} +==> z IN aff_ge {vec 0} {y1, z1:real^3}`) +THEN ASM_SIMP_TAC[AFF_GT_SUBSET_AFF_GE] +THEN STRIP_TAC +THEN MRESA_TAC Planarity.aff_ge_1_1_subset_aff_ge_fan[`vec 0:real^3`;`y1:real^3`;`z1:real^3`;`z:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[th3] +THEN MRESA_TAC th3[`vec 0:real^3`;`v3:real^3`;`z:real^3`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`aff_ge {vec 0} {z} SUBSET aff_ge {vec 0} {y1, z1} +==> aff_ge {vec 0} {y1, z1} INTER aff_ge {vec 0} {z} =aff_ge {vec 0} {z:real^3} `) +THEN RESA_TAC +THEN SUBGOAL_THEN`z IN V_SY(vecmats (l:real^(M,3)finite_product))`ASSUME_TAC; + +ASM_SIMP_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`(SUC (i MOD dimindex (:M))):num` +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +MP_TAC(SET_RULE`{y,z} INTER {y1,z1}={} ==> {y1, z1} INTER {z:real^3}={}`) +THEN RESA_TAC +THEN REMOVE_THEN"YEU"(fun th-> MRESAL_TAC th[`e2:(real^3->bool)`;`z:real^3`][AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING]) +THEN MRESAL_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`z:real^3`][IN_SING]; + +MP_TAC(SET_RULE`v3 IN aff_gt {vec 0} {y, z} /\ aff_gt {vec 0} {y, z} SUBSET aff_ge {vec 0} {y, z} +==> v3 IN aff_ge {vec 0} {y, z:real^3}`) +THEN ASM_SIMP_TAC[AFF_GT_SUBSET_AFF_GE] +THEN STRIP_TAC +THEN MRESA_TAC Planarity.aff_ge1_subset_aff_ge[`vec 0:real^3`;`y:real^3`;`z:real^3`;`v3:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[th3;] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`y1 IN aff_ge {vec 0} {v3, z} /\ aff_ge {vec 0} {v3, z} SUBSET aff_ge {vec 0} {y, z} +==> y1 IN aff_ge {vec 0} {y, z:real^3}`) +THEN RESA_TAC +THEN MRESA_TAC Planarity.aff_ge_1_1_subset_aff_ge_fan[`vec 0:real^3`;`y:real^3`;`z:real^3`;`y1:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[th3] +THEN MRESA_TAC th3[`vec 0:real^3`;`v3:real^3`;`y1:real^3`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`aff_ge {vec 0} {y1} SUBSET aff_ge {vec 0} {y, z} +==> aff_ge {vec 0} {y, z} INTER aff_ge {vec 0} {y1} =aff_ge {vec 0} {y1:real^3} `) +THEN RESA_TAC +THEN SUBGOAL_THEN`y1 IN V_SY(vecmats (l:real^(M,3)finite_product))`ASSUME_TAC; + +ASM_SIMP_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`i':num` +THEN ASM_REWRITE_TAC[]; + +MP_TAC(SET_RULE`{y,z} INTER {y1,z1}={} ==> {y, z} INTER {y1:real^3}={}`) +THEN RESA_TAC +THEN REMOVE_THEN"YEU"(fun th-> MRESAL_TAC th[`e1:(real^3->bool)`;`y1:real^3`][AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING]) +THEN MRESAL_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`y1:real^3`][IN_SING]; + +POP_ASSUM MP_TAC +THEN STRIP_TAC; + +MRESAL_TAC Planarity.aff_gt_1_2_cross_dotr_4point[`vec 0:real^3`;`v3:real^3`;`y:real^3`;`y1:real^3`;`z1:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN SUBGOAL_THEN`&0<(z cross y) dot y1` ASSUME_TAC; + +REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AFF_GT_1_2[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[th3] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`v3 IN aff_gt {vec 0} {y, z:real^3}` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM;VECTOR_ARITH`a % vec 0 + b=b`]) +THEN RESA_TAC +THEN REWRITE_TAC[CROSS_LADD;CROSS_LMUL;CROSS_REFL;VECTOR_ARITH`t% vec 0 +A=A`] +THEN REWRITE_TAC[DOT_LMUL] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 < t3==> ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`t3:real` +THEN MRESA1_TAC REAL_MUL_LINV`t3:real` +THEN MRESAL_TAC REAL_LT_MUL[`inv t3`;`t3 * ((z cross y) dot y1)`][REAL_ARITH`A *B*C=(A*B)*C/\ &1*A=A`]; + +SUBGOAL_THEN`&0< --((z cross y) dot z1)` ASSUME_TAC; + +REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AFF_GT_1_2[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[th3] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`v3 IN aff_gt {vec 0} {y, z:real^3}` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM;VECTOR_ARITH`a % vec 0 + b=b`]) +THEN RESA_TAC +THEN REWRITE_TAC[CROSS_LADD;CROSS_LMUL;CROSS_REFL;VECTOR_ARITH`t% vec 0 +A=A`] +THEN REWRITE_TAC[DOT_LMUL;REAL_ARITH`--(A*B)=A*(--B)`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 < t3==> ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`t3:real` +THEN MRESA1_TAC REAL_MUL_LINV`t3:real` +THEN MRESAL_TAC REAL_LT_MUL[`inv t3`;`t3 * --((z cross y) dot z1)`][REAL_ARITH`A *B*C=(A*B)*C/\ &1*A=A`]; + +SUBGOAL_THEN`&0<(z1 cross y) dot y1` ASSUME_TAC; + +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AFF_GT_1_2[`vec 0:real^3`;`y1:real^3`;`z1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[th3] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`v3 IN aff_gt {vec 0} {y1, z1:real^3}` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM;VECTOR_ARITH`a % vec 0 + b=b`]) +THEN RESA_TAC +THEN REWRITE_TAC[CROSS_LADD;CROSS_LMUL;CROSS_REFL;REAL_ARITH`t* &0 +A=A`;DOT_LADD;DOT_CROSS_SELF;DOT_LMUL] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 < t3==> ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`t3:real` +THEN MRESA1_TAC REAL_MUL_LINV`t3:real` +THEN MRESAL_TAC REAL_LT_MUL[`inv t3`;`t3 * ((z1 cross y) dot y1)`][REAL_ARITH`A *B*C=(A*B)*C/\ &1*A=A`]; + +MRESAL_TAC Planarity.aff_gt_1_2_cross_dotr_4point[`vec 0:real^3`;`v3:real^3`;`z1:real^3`;`y:real^3`;`z:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN REWRITE_TAC[DOT_LNEG] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ASM_REWRITE_TAC[REAL_ARITH`-- -- A=A`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`&0< --((z1 cross z) dot y1)` ASSUME_TAC; + +POP_ASSUM MP_TAC +THEN MRESA_TAC AFF_GT_1_2[`vec 0:real^3`;`y1:real^3`;`z1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[th3] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`v3 IN aff_gt {vec 0} {y1, z1:real^3}` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM;VECTOR_ARITH`a % vec 0 + b=b`]) +THEN RESA_TAC +THEN REWRITE_TAC[CROSS_LADD;CROSS_LMUL;CROSS_REFL;REAL_ARITH`A+t* &0 =A`;DOT_LADD;DOT_CROSS_SELF;DOT_LMUL;REAL_ARITH`--(A*B)= A*(--B)`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 < t2==> ~(t2= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`t2:real` +THEN MRESA1_TAC REAL_MUL_LINV`t2:real` +THEN MRESAL_TAC REAL_LT_MUL[`inv t2`;`t2 * ((y1 cross z) dot z1)`][REAL_ARITH`A *B*C=(A*B)*C/\ &1*A=A`] +THEN ONCE_REWRITE_TAC[GSYM CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN REWRITE_TAC[DOT_LNEG;REAL_ARITH`-- --A=A`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; + +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`1 <= SUC (i' MOD dimindex (:M)) /\ + SUC (i' MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; + +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i':num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +REMOVE_THEN "YEU2" (fun th-> MRESA1_TAC th`i:num` THEN MRESA1_TAC th`i':num` +THEN MRESA1_TAC th`SUC (i MOD dimindex (:M))` THEN MRESA1_TAC th`SUC (i' MOD dimindex (:M))` THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"YEU2")) +THEN +MRESA_TAC (GEN_ALL CROSS_DOT_SEQUENTIALLY)[`(\n. row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n))`;`(\n. row i ((v:num->real^3^M) n))`;`(\n. row i' ((v:num->real^3^M) n))`;`z:real^3`;`y:real^3`;`y1:real^3`] +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[LIM_SEQUENTIALLY;dist;o_DEF;GSYM LIFT_SUB;NORM_LIFT] +THEN MP_TAC(REAL_ARITH`&0< (z cross y) dot y1==> &0< ((z cross y) dot y1)/ &4`) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`((z cross y) dot y1)/ &4`) +THEN SUBGOAL_THEN`!n. N <= n + ==> &0< (row (SUC (i MOD dimindex (:M))) ((v:num-> real^3^M) n) cross row i (v n)) dot + row i' (v n) ` ASSUME_TAC; + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CHANGE") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"CHANGE"(fun th-> MRESA1_TAC th`n:num`) +THEN MRESA_TAC ABS_LT_EPSI[`(row (SUC (i MOD dimindex (:M))) ((v:num-> real^3^M) n) cross row i (v n)) dot row i' (v n)`;`(z cross y) dot y1`]; + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEUTHY1") +THEN MRESA_TAC (GEN_ALL CROSS_DOT_SEQUENTIALLY)[`(\n. row (SUC (i' MOD dimindex (:M))) ((v:num->real^3^M) n))`;`(\n. row i ((v:num->real^3^M) n))`;`(\n. row i' ((v:num->real^3^M) n))`;`z1:real^3`;`y:real^3`;`y1:real^3`] +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[LIM_SEQUENTIALLY;dist;o_DEF;GSYM LIFT_SUB;NORM_LIFT] +THEN MP_TAC(REAL_ARITH`&0< (z1 cross y) dot y1==> &0< ((z1 cross y) dot y1)/ &4`) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`((z1 cross y) dot y1)/ &4`) +THEN SUBGOAL_THEN`!n. N' <= n + ==> &0< (row (SUC (i' MOD dimindex (:M))) ((v:num-> real^3^M) n) cross row i (v n)) dot + row i' (v n) ` ASSUME_TAC; + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CHANGE") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"CHANGE"(fun th-> MRESA1_TAC th`n:num`) +THEN MRESA_TAC ABS_LT_EPSI[`(row (SUC (i' MOD dimindex (:M))) ((v:num-> real^3^M) n) cross row i (v n)) dot row i' (v n)`;`(z1 cross y) dot y1`]; + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEUTHY2") +THEN MRESA_TAC (GEN_ALL CROSS_DOT_SEQUENTIALLY)[`(\n. row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n))`;`(\n. row i ((v:num->real^3^M) n))`;`(\n. row (SUC (i' MOD dimindex (:M))) ((v:num->real^3^M) n))`;`z:real^3`;`y:real^3`;`z1:real^3`] +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[LIM_SEQUENTIALLY;dist;o_DEF;GSYM LIFT_SUB;NORM_LIFT] +THEN MP_TAC(REAL_ARITH`&0< --((z cross y) dot z1)==> &0< --((z cross y) dot z1)/ &4`) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`--((z cross y) dot z1)/ &4`) +THEN SUBGOAL_THEN`!n. N'' <= n + ==> &0< --((row (SUC (i MOD dimindex (:M))) ((v:num-> real^3^M) n) cross row i (v n)) dot + row (SUC (i' MOD dimindex (:M))) (v n)) ` ASSUME_TAC; + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CHANGE") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"CHANGE"(fun th-> MRESA1_TAC th`n:num`) +THEN MRESA_TAC ABS_LT_EPSI[`--((row (SUC (i MOD dimindex (:M))) ((v:num-> real^3^M) n) cross row i (v n)) dot row (SUC (i' MOD dimindex (:M))) (v n))`;`--((z cross y) dot z1)`] +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_SIMP_TAC[REAL_ARITH`-- A - --B= --(A-B)`;REAL_ABS_NEG]; + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEUTHY3") +THEN MRESA_TAC (GEN_ALL CROSS_DOT_SEQUENTIALLY)[`(\n. row (SUC (i' MOD dimindex (:M))) ((v:num->real^3^M) n))`;`(\n. row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n))`;`(\n. row i' ((v:num->real^3^M) n))`;`z1:real^3`;`z:real^3`;`y1:real^3`] +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[LIM_SEQUENTIALLY;dist;o_DEF;GSYM LIFT_SUB;NORM_LIFT] +THEN MP_TAC(REAL_ARITH`&0< --((z1 cross z) dot y1)==> &0< --((z1 cross z) dot y1)/ &4`) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`--((z1 cross z) dot y1)/ &4`) +THEN SUBGOAL_THEN`!n. N''' <= n + ==> &0< --((row (SUC (i' MOD dimindex (:M))) ((v:num-> real^3^M) n) cross row (SUC (i MOD dimindex (:M))) (v n)) dot + row i' (v n)) ` ASSUME_TAC; + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CHANGE") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"CHANGE"(fun th-> MRESA1_TAC th`n:num`) +THEN MRESA_TAC ABS_LT_EPSI[`--((row (SUC (i' MOD dimindex (:M))) ((v:num-> real^3^M) n) cross row (SUC (i MOD dimindex (:M))) (v n)) dot row i' (v n))`;`--((z1 cross z) dot y1)`] +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_SIMP_TAC[REAL_ARITH`-- A - --B= --(A-B)`;REAL_ABS_NEG]; + +MRESA1_TAC (SET_RULE`!A. ~A\/ A`)`(?N2:num. !n. N2<=n ==> ~( row (SUC (i MOD dimindex (:M))) (v n) IN {row i' ((v:num->real^3^M) n), row (SUC (i' MOD dimindex (:M))) (v n)}))`; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_EXISTS_THM;NOT_FORALL_THM;SKOLEM_THM;NOT_IMP;] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL LIM_SUBSEQUENCE1)[`y:real^3`;`(\n. row i ((v:num->real^3^M) n))`;`n:num->num`][o_DEF] +THEN MRESAL_TAC (GEN_ALL LIM_SUBSEQUENCE1)[`y1:real^3`;`(\n. row i' ((v:num->real^3^M) n))`;`n:num->num`][o_DEF] +THEN MRESAL_TAC (GEN_ALL LIM_SUBSEQUENCE1)[`z:real^3`;`(\n. row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n))`;`n:num->num`][o_DEF] +THEN MRESAL_TAC (GEN_ALL LIM_SUBSEQUENCE1)[`z1:real^3`;`(\n. row (SUC (i' MOD dimindex (:M))) ((v:num->real^3^M) n))`;`n:num->num`][o_DEF] +THEN MRESAL_TAC LIM_IN_SET[`(\m:num. row i' ((v:num->real^3^M) m)) o (n:num->num)`;`(\m:num. row (SUC (i' MOD dimindex (:M))) ((v:num->real^3^M) m)) o (n:num->num)`;`(\m:num. row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) m)) o (n:num->num)`;`y1:real^3`;`z1:real^3`;`z:real^3`][o_DEF] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`z IN{y1,z1}==> ~({y,z} INTER {y1,z1:real^3}={})`) +THEN RESA_TAC; + +MRESA1_TAC (SET_RULE`!A. ~A\/ A`)`(?N3:num. !n. N3<=n ==> ~(row i ((v:num->real^3^M) n) IN {row i' ((v:num->real^3^M) n), row (SUC (i' MOD dimindex (:M))) (v n)}))`; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_EXISTS_THM;NOT_FORALL_THM;SKOLEM_THM;NOT_IMP;] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL LIM_SUBSEQUENCE1)[`y:real^3`;`(\n. row i ((v:num->real^3^M) n))`;`n:num->num`][o_DEF] +THEN MRESAL_TAC (GEN_ALL LIM_SUBSEQUENCE1)[`y1:real^3`;`(\n. row i' ((v:num->real^3^M) n))`;`n:num->num`][o_DEF] +THEN MRESAL_TAC (GEN_ALL LIM_SUBSEQUENCE1)[`z:real^3`;`(\n. row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n))`;`n:num->num`][o_DEF] +THEN MRESAL_TAC (GEN_ALL LIM_SUBSEQUENCE1)[`z1:real^3`;`(\n. row (SUC (i' MOD dimindex (:M))) ((v:num->real^3^M) n))`;`n:num->num`][o_DEF] +THEN MRESAL_TAC LIM_IN_SET[`(\m:num. row i' ((v:num->real^3^M) m)) o (n:num->num)`;`(\m:num. row (SUC (i' MOD dimindex (:M))) ((v:num->real^3^M) m)) o (n:num->num)`;`(\m:num. row i ((v:num->real^3^M) m)) o (n:num->num)`;`y1:real^3`;`z1:real^3`;`y:real^3`][o_DEF] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`y IN{y1,z1}==> ~({y,z} INTER {y1,z1:real^3}={})`) +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEUTHY4") +THEN DISCH_THEN(LABEL_TAC"YEUTHY5") +THEN DISCH_THEN(LABEL_TAC"YEUTHY6") +THEN ABBREV_TAC`N1=N+N'+N''+N'''+N2+N3:num` +THEN MP_TAC(ARITH_RULE`N+N'+N''+N'''+N2+N3= N1:num ==> N<= N1/\ N'<= N1 /\ N''<= N1/\ N'''<= N1 /\ N2<= N1/\ N3<=N1`) +THEN RESA_TAC +THEN REMOVE_THEN "YEUTHY1"(fun th-> MRESA1_TAC th`N1:num`) +THEN REMOVE_THEN "YEUTHY2"(fun th-> MRESA1_TAC th`N1:num`) +THEN REMOVE_THEN "YEUTHY3"(fun th-> MRESA1_TAC th`N1:num`) +THEN REMOVE_THEN "YEUTHY4"(fun th-> MRESA1_TAC th`N1:num`) +THEN REMOVE_THEN "YEUTHY5"(fun th-> MRESA1_TAC th`N1:num`) +THEN REMOVE_THEN "YEUTHY6"(fun th-> MRESA1_TAC th`N1:num`) +THEN ABBREV_TAC`y'=row i ((v:num-> real^3^M) N1)` +THEN ABBREV_TAC`z'=row (SUC (i MOD dimindex (:M))) ((v:num-> real^3^M) N1)` +THEN ABBREV_TAC`y1'=row i' ((v:num-> real^3^M) N1)` +THEN ABBREV_TAC`z1'=row (SUC (i' MOD dimindex (:M))) ((v:num-> real^3^M) N1)` +THEN REMOVE_THEN "THY1"(fun th-> MRESA1_TAC th`N1:num`) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[convex_local_fan;local_fan] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[FAN;fan7;fan6] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEUTHY1") +THEN DISCH_THEN(LABEL_TAC"YEUTHY2") +THEN SUBGOAL_THEN`{y',z'} IN E_SY((v:num->real^3^M) N1)`ASSUME_TAC; + +REWRITE_TAC[E_SY;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`{y1',z1'} IN E_SY((v:num->real^3^M) N1)`ASSUME_TAC; + +REWRITE_TAC[E_SY;IN_ELIM_THM] +THEN EXISTS_TAC`i':num` +THEN ASM_REWRITE_TAC[]; + +REMOVE_THEN "YEUTHY1"(fun th-> MRESAL1_TAC th`{y',z':real^3}`[SET_RULE`{a} UNION {b,c}={a,b,c}`] +THEN MRESAL1_TAC th`{y1',z1':real^3}`[SET_RULE`{a} UNION {b,c}={a,b,c}`]) +THEN MRESAL_TAC Planarity.condition_cross_dot_4point[`vec 0:real^3`;`y':real^3`;`z':real^3`;`y1':real^3`;`z1':real^3`][VECTOR_ARITH`A- vec 0=A/\ A+ vec 0=A`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[DOT_LNEG;REAL_ARITH`-- --A=A`] +THEN STRIP_TAC +THEN MRESAL_TAC Planarity.condition_cross_dot_4point[`vec 0:real^3`;`z1':real^3`;`y1':real^3`;`y':real^3`;`z':real^3`][VECTOR_ARITH`A- vec 0=A/\ A+ vec 0=A`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[DOT_LNEG;REAL_ARITH`-- --A=A`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ASM_REWRITE_TAC[] +THEN ABBREV_TAC`a=(y' cross z')` +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ONCE_REWRITE_TAC[GSYM CROSS_LNEG] +THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] +THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`--((y1' cross z1') cross a') IN aff_gt {vec 0} {y1', z1'} +/\ --((y1' cross z1') cross a') IN aff_gt {vec 0} {y', z'} +/\ aff_gt {vec 0} {y', z'} SUBSET aff_ge {vec 0} {y', z'} +/\ aff_gt {vec 0} {y1', z1'} SUBSET aff_ge {vec 0} {y1', z1'} +==> --((y1' cross z1') cross a') IN aff_ge {vec 0} {y', z'} INTER aff_ge {vec 0} {y1', z1'}`) +THEN ASM_SIMP_TAC[AFF_GT_SUBSET_AFF_GE] +THEN MP_TAC(SET_RULE`~(y' IN {y1',z1'}) /\ ~(z' IN {y1',z1':real^3})==> ({y',z'}INTER{y1',z1'}={})`) +THEN RESA_TAC +THEN REMOVE_THEN"YEUTHY2"(fun th-> MRESAL_TAC th[`{y',z':real^3}`;`{y1',z1':real^3}`][UNION;IN_ELIM_THM;AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING;IN_SING]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC Planarity.origin_is_not_aff_gt_fan[`vec 0:real^3`;`y':real^3`;`z':real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[th3]; + +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN REWRITE_TAC[DOT_LNEG;REAL_ARITH`-- --A=A`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN STRIP_TAC +THEN MRESAL_TAC Planarity.aff_gt_1_2_cross_dotr_4point[`vec 0:real^3`;`v3:real^3`;`y1:real^3`;`y:real^3`;`z:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN SUBGOAL_THEN`&0<(z1 cross y1) dot y` ASSUME_TAC; + +REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AFF_GT_1_2[`vec 0:real^3`;`y1:real^3`;`z1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[th3] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`v3 IN aff_gt {vec 0} {y1, z1:real^3}` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM;VECTOR_ARITH`a % vec 0 + b=b`]) +THEN RESA_TAC +THEN REWRITE_TAC[CROSS_LADD;CROSS_LMUL;CROSS_REFL;VECTOR_ARITH`t% vec 0 +A=A`] +THEN REWRITE_TAC[DOT_LMUL] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 < t3==> ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`t3:real` +THEN MRESA1_TAC REAL_MUL_LINV`t3:real` +THEN MRESAL_TAC REAL_LT_MUL[`inv t3`;`t3 * ((z1 cross y1) dot y)`][REAL_ARITH`A *B*C=(A*B)*C/\ &1*A=A`]; + +SUBGOAL_THEN`&0< --((z1 cross y1) dot z)` ASSUME_TAC; + +REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AFF_GT_1_2[`vec 0:real^3`;`y1:real^3`;`z1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[th3] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`v3 IN aff_gt {vec 0} {y1, z1:real^3}` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM;VECTOR_ARITH`a % vec 0 + b=b`]) +THEN RESA_TAC +THEN REWRITE_TAC[CROSS_LADD;CROSS_LMUL;CROSS_REFL;VECTOR_ARITH`t% vec 0 +A=A`] +THEN REWRITE_TAC[DOT_LMUL;REAL_ARITH`--(A*B)=A*(--B)`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 < t3==> ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`t3:real` +THEN MRESA1_TAC REAL_MUL_LINV`t3:real` +THEN MRESAL_TAC REAL_LT_MUL[`inv t3`;`t3 * --((z1 cross y1) dot z)`][REAL_ARITH`A *B*C=(A*B)*C/\ &1*A=A`]; + +SUBGOAL_THEN`&0<(z cross y1) dot y` ASSUME_TAC; + +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AFF_GT_1_2[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[th3] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`v3 IN aff_gt {vec 0} {y, z:real^3}` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM;VECTOR_ARITH`a % vec 0 + b=b`]) +THEN RESA_TAC +THEN REWRITE_TAC[CROSS_LADD;CROSS_LMUL;CROSS_REFL;REAL_ARITH`t* &0 +A=A`;DOT_LADD;DOT_CROSS_SELF;DOT_LMUL] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 < t3==> ~(t3= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`t3:real` +THEN MRESA1_TAC REAL_MUL_LINV`t3:real` +THEN MRESAL_TAC REAL_LT_MUL[`inv t3`;`t3 * ((z cross y1) dot y)`][REAL_ARITH`A *B*C=(A*B)*C/\ &1*A=A`]; + +MRESAL_TAC Planarity.aff_gt_1_2_cross_dotr_4point[`vec 0:real^3`;`v3:real^3`;`z:real^3`;`y1:real^3`;`z1:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN REWRITE_TAC[DOT_LNEG] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ASM_REWRITE_TAC[REAL_ARITH`-- -- A=A`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`&0< --((z cross z1) dot y)` ASSUME_TAC; + +POP_ASSUM MP_TAC +THEN MRESA_TAC AFF_GT_1_2[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[th3] +THEN STRIP_TAC +THEN FIND_ASSUM(MP_TAC)`v3 IN aff_gt {vec 0} {y, z:real^3}` +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;IN_ELIM_THM;VECTOR_ARITH`a % vec 0 + b=b`]) +THEN RESA_TAC +THEN REWRITE_TAC[CROSS_LADD;CROSS_LMUL;CROSS_REFL;REAL_ARITH`A+t* &0 =A`;DOT_LADD;DOT_CROSS_SELF;DOT_LMUL;REAL_ARITH`--(A*B)= A*(--B)`] +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0 < t2==> ~(t2= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_LT_INV`t2:real` +THEN MRESA1_TAC REAL_MUL_LINV`t2:real` +THEN MRESAL_TAC REAL_LT_MUL[`inv t2`;`t2 * ((y cross z1) dot z)`][REAL_ARITH`A *B*C=(A*B)*C/\ &1*A=A`] +THEN ONCE_REWRITE_TAC[GSYM CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN REWRITE_TAC[DOT_LNEG;REAL_ARITH`-- --A=A`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; + +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`1 <= SUC (i' MOD dimindex (:M)) /\ + SUC (i' MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; + +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i':num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +REMOVE_THEN "YEU2" (fun th-> MRESA1_TAC th`i:num` THEN MRESA1_TAC th`i':num` +THEN MRESA1_TAC th`SUC (i MOD dimindex (:M))` THEN MRESA1_TAC th`SUC (i' MOD dimindex (:M))` THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"YEU2")) +THEN +MRESA_TAC (GEN_ALL CROSS_DOT_SEQUENTIALLY)[`(\n. row (SUC (i' MOD dimindex (:M))) ((v:num->real^3^M) n))`;`(\n. row i' ((v:num->real^3^M) n))`;`(\n. row i ((v:num->real^3^M) n))`;`z1:real^3`;`y1:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[LIM_SEQUENTIALLY;dist;o_DEF;GSYM LIFT_SUB;NORM_LIFT] +THEN MP_TAC(REAL_ARITH`&0< (z1 cross y1) dot y==> &0< ((z1 cross y1) dot y)/ &4`) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`((z1 cross y1) dot y)/ &4`) +THEN SUBGOAL_THEN`!n. N <= n + ==> &0< (row (SUC (i' MOD dimindex (:M))) ((v:num-> real^3^M) n) cross row i' (v n)) dot + row i (v n) ` ASSUME_TAC; + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CHANGE") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"CHANGE"(fun th-> MRESA1_TAC th`n:num`) +THEN MRESA_TAC ABS_LT_EPSI[`(row (SUC (i' MOD dimindex (:M))) ((v:num-> real^3^M) n) cross row i' (v n)) dot row i (v n)`;`(z1 cross y1) dot y`]; + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEUTHY1") +THEN MRESA_TAC (GEN_ALL CROSS_DOT_SEQUENTIALLY)[`(\n. row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n))`;`(\n. row i' ((v:num->real^3^M) n))`;`(\n. row i ((v:num->real^3^M) n))`;`z:real^3`;`y1:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[LIM_SEQUENTIALLY;dist;o_DEF;GSYM LIFT_SUB;NORM_LIFT] +THEN MP_TAC(REAL_ARITH`&0< (z cross y1) dot y==> &0< ((z cross y1) dot y)/ &4`) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`((z cross y1) dot y)/ &4`) +THEN SUBGOAL_THEN`!n. N' <= n + ==> &0< (row (SUC (i MOD dimindex (:M))) ((v:num-> real^3^M) n) cross row i' (v n)) dot + row i (v n) ` ASSUME_TAC; + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CHANGE") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"CHANGE"(fun th-> MRESA1_TAC th`n:num`) +THEN MRESA_TAC ABS_LT_EPSI[`(row (SUC (i MOD dimindex (:M))) ((v:num-> real^3^M) n) cross row i' (v n)) dot row i (v n)`;`(z cross y1) dot y`]; + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEUTHY2") +THEN MRESA_TAC (GEN_ALL CROSS_DOT_SEQUENTIALLY)[`(\n. row (SUC (i' MOD dimindex (:M))) ((v:num->real^3^M) n))`;`(\n. row i' ((v:num->real^3^M) n))`;`(\n. row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n))`;`z1:real^3`;`y1:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[LIM_SEQUENTIALLY;dist;o_DEF;GSYM LIFT_SUB;NORM_LIFT] +THEN MP_TAC(REAL_ARITH`&0< --((z1 cross y1) dot z)==> &0< --((z1 cross y1) dot z)/ &4`) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`--((z1 cross y1) dot z)/ &4`) +THEN SUBGOAL_THEN`!n. N'' <= n + ==> &0< --((row (SUC (i' MOD dimindex (:M))) ((v:num-> real^3^M) n) cross row i' (v n)) dot + row (SUC (i MOD dimindex (:M))) (v n)) ` ASSUME_TAC; + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CHANGE") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"CHANGE"(fun th-> MRESA1_TAC th`n:num`) +THEN MRESA_TAC ABS_LT_EPSI[`--((row (SUC (i' MOD dimindex (:M))) ((v:num-> real^3^M) n) cross row i' (v n)) dot row (SUC (i MOD dimindex (:M))) (v n))`;`--((z1 cross y1) dot z)`] +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_SIMP_TAC[REAL_ARITH`-- A - --B= --(A-B)`;REAL_ABS_NEG]; + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEUTHY3") +THEN MRESA_TAC (GEN_ALL CROSS_DOT_SEQUENTIALLY)[`(\n. row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n))`;`(\n. row (SUC (i' MOD dimindex (:M))) ((v:num->real^3^M) n))`;`(\n. row i ((v:num->real^3^M) n))`;`z:real^3`;`z1:real^3`;`y:real^3`] +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[LIM_SEQUENTIALLY;dist;o_DEF;GSYM LIFT_SUB;NORM_LIFT] +THEN MP_TAC(REAL_ARITH`&0< --((z cross z1) dot y)==> &0< --((z cross z1) dot y)/ &4`) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`--((z cross z1) dot y)/ &4`) +THEN SUBGOAL_THEN`!n. N''' <= n + ==> &0< --((row (SUC (i MOD dimindex (:M))) ((v:num-> real^3^M) n) cross row (SUC (i' MOD dimindex (:M))) (v n)) dot + row i (v n)) ` ASSUME_TAC; + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"CHANGE") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"CHANGE"(fun th-> MRESA1_TAC th`n:num`) +THEN MRESA_TAC ABS_LT_EPSI[`--((row (SUC (i MOD dimindex (:M))) ((v:num-> real^3^M) n) cross row (SUC (i' MOD dimindex (:M))) (v n)) dot row i (v n))`;`--((z cross z1) dot y)`] +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_SIMP_TAC[REAL_ARITH`-- A - --B= --(A-B)`;REAL_ABS_NEG]; + +MRESA1_TAC (SET_RULE`!A. ~A\/ A`)`(?N2:num. !n. N2<=n ==> ~( row (SUC (i MOD dimindex (:M))) (v n) IN {row i' ((v:num->real^3^M) n), row (SUC (i' MOD dimindex (:M))) (v n)}))`; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_EXISTS_THM;NOT_FORALL_THM;SKOLEM_THM;NOT_IMP;] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL LIM_SUBSEQUENCE1)[`y:real^3`;`(\n. row i ((v:num->real^3^M) n))`;`n:num->num`][o_DEF] +THEN MRESAL_TAC (GEN_ALL LIM_SUBSEQUENCE1)[`y1:real^3`;`(\n. row i' ((v:num->real^3^M) n))`;`n:num->num`][o_DEF] +THEN MRESAL_TAC (GEN_ALL LIM_SUBSEQUENCE1)[`z:real^3`;`(\n. row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n))`;`n:num->num`][o_DEF] +THEN MRESAL_TAC (GEN_ALL LIM_SUBSEQUENCE1)[`z1:real^3`;`(\n. row (SUC (i' MOD dimindex (:M))) ((v:num->real^3^M) n))`;`n:num->num`][o_DEF] +THEN MRESAL_TAC LIM_IN_SET[`(\m:num. row i' ((v:num->real^3^M) m)) o (n:num->num)`;`(\m:num. row (SUC (i' MOD dimindex (:M))) ((v:num->real^3^M) m)) o (n:num->num)`;`(\m:num. row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) m)) o (n:num->num)`;`y1:real^3`;`z1:real^3`;`z:real^3`][o_DEF] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`z IN{y1,z1}==> ~({y,z} INTER {y1,z1:real^3}={})`) +THEN RESA_TAC; + +MRESA1_TAC (SET_RULE`!A. ~A\/ A`)`(?N3:num. !n. N3<=n ==> ~(row i ((v:num->real^3^M) n) IN {row i' ((v:num->real^3^M) n), row (SUC (i' MOD dimindex (:M))) (v n)}))`; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_EXISTS_THM;NOT_FORALL_THM;SKOLEM_THM;NOT_IMP;] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL LIM_SUBSEQUENCE1)[`y:real^3`;`(\n. row i ((v:num->real^3^M) n))`;`n:num->num`][o_DEF] +THEN MRESAL_TAC (GEN_ALL LIM_SUBSEQUENCE1)[`y1:real^3`;`(\n. row i' ((v:num->real^3^M) n))`;`n:num->num`][o_DEF] +THEN MRESAL_TAC (GEN_ALL LIM_SUBSEQUENCE1)[`z:real^3`;`(\n. row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n))`;`n:num->num`][o_DEF] +THEN MRESAL_TAC (GEN_ALL LIM_SUBSEQUENCE1)[`z1:real^3`;`(\n. row (SUC (i' MOD dimindex (:M))) ((v:num->real^3^M) n))`;`n:num->num`][o_DEF] +THEN MRESAL_TAC LIM_IN_SET[`(\m:num. row i' ((v:num->real^3^M) m)) o (n:num->num)`;`(\m:num. row (SUC (i' MOD dimindex (:M))) ((v:num->real^3^M) m)) o (n:num->num)`;`(\m:num. row i ((v:num->real^3^M) m)) o (n:num->num)`;`y1:real^3`;`z1:real^3`;`y:real^3`][o_DEF] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`y IN{y1,z1}==> ~({y,z} INTER {y1,z1:real^3}={})`) +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEUTHY4") +THEN DISCH_THEN(LABEL_TAC"YEUTHY5") +THEN DISCH_THEN(LABEL_TAC"YEUTHY6") +THEN ABBREV_TAC`N1=N+N'+N''+N'''+N2+N3:num` +THEN MP_TAC(ARITH_RULE`N+N'+N''+N'''+N2+N3= N1:num ==> N<= N1/\ N'<= N1 /\ N''<= N1/\ N'''<= N1 /\ N2<= N1/\ N3<=N1`) +THEN RESA_TAC +THEN REMOVE_THEN "YEUTHY1"(fun th-> MRESA1_TAC th`N1:num`) +THEN REMOVE_THEN "YEUTHY2"(fun th-> MRESA1_TAC th`N1:num`) +THEN REMOVE_THEN "YEUTHY3"(fun th-> MRESA1_TAC th`N1:num`) +THEN REMOVE_THEN "YEUTHY4"(fun th-> MRESA1_TAC th`N1:num`) +THEN REMOVE_THEN "YEUTHY5"(fun th-> MRESA1_TAC th`N1:num`) +THEN REMOVE_THEN "YEUTHY6"(fun th-> MRESA1_TAC th`N1:num`) +THEN ABBREV_TAC`y'=row i ((v:num-> real^3^M) N1)` +THEN ABBREV_TAC`z'=row (SUC (i MOD dimindex (:M))) ((v:num-> real^3^M) N1)` +THEN ABBREV_TAC`y1'=row i' ((v:num-> real^3^M) N1)` +THEN ABBREV_TAC`z1'=row (SUC (i' MOD dimindex (:M))) ((v:num-> real^3^M) N1)` +THEN REMOVE_THEN "THY1"(fun th-> MRESA1_TAC th`N1:num`) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[convex_local_fan;local_fan] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[FAN;fan7;fan6] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEUTHY1") +THEN DISCH_THEN(LABEL_TAC"YEUTHY2") +THEN SUBGOAL_THEN`{y',z'} IN E_SY((v:num->real^3^M) N1)`ASSUME_TAC; + +REWRITE_TAC[E_SY;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`{y1',z1'} IN E_SY((v:num->real^3^M) N1)`ASSUME_TAC; + +REWRITE_TAC[E_SY;IN_ELIM_THM] +THEN EXISTS_TAC`i':num` +THEN ASM_REWRITE_TAC[]; + +REMOVE_THEN "YEUTHY1"(fun th-> MRESAL1_TAC th`{y',z':real^3}`[SET_RULE`{a} UNION {b,c}={a,b,c}`] +THEN MRESAL1_TAC th`{y1',z1':real^3}`[SET_RULE`{a} UNION {b,c}={a,b,c}`]) +THEN MRESAL_TAC Planarity.condition_cross_dot_4point[`vec 0:real^3`;`y1':real^3`;`z1':real^3`;`y':real^3`;`z':real^3`][VECTOR_ARITH`A- vec 0=A/\ A+ vec 0=A`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[DOT_LNEG;REAL_ARITH`-- --A=A`] +THEN STRIP_TAC +THEN MRESAL_TAC Planarity.condition_cross_dot_4point[`vec 0:real^3`;`z':real^3`;`y':real^3`;`y1':real^3`;`z1':real^3`][VECTOR_ARITH`A- vec 0=A/\ A+ vec 0=A`] +THEN POP_ASSUM MP_TAC +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ASM_REWRITE_TAC[DOT_LNEG;REAL_ARITH`-- --A=A`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ASM_REWRITE_TAC[] +THEN ABBREV_TAC`a=(y1' cross z1')` +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN ONCE_REWRITE_TAC[GSYM CROSS_LNEG] +THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] +THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW] +THEN ONCE_REWRITE_TAC[CROSS_SKEW] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`--((y' cross z') cross a') IN aff_gt {vec 0} {y1', z1'} +/\ --((y' cross z') cross a') IN aff_gt {vec 0} {y', z'} +/\ aff_gt {vec 0} {y', z'} SUBSET aff_ge {vec 0} {y', z'} +/\ aff_gt {vec 0} {y1', z1'} SUBSET aff_ge {vec 0} {y1', z1'} +==> --((y' cross z') cross a') IN aff_ge {vec 0} {y', z'} INTER aff_ge {vec 0} {y1', z1'}`) +THEN ASM_SIMP_TAC[AFF_GT_SUBSET_AFF_GE] +THEN MP_TAC(SET_RULE`~(y' IN {y1',z1'}) /\ ~(z' IN {y1',z1':real^3})==> ({y',z'}INTER{y1',z1'}={})`) +THEN RESA_TAC +THEN REMOVE_THEN"YEUTHY2"(fun th-> MRESAL_TAC th[`{y',z':real^3}`;`{y1',z1':real^3}`][UNION;IN_ELIM_THM;AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING;IN_SING]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC Planarity.origin_is_not_aff_gt_fan[`vec 0:real^3`;`y':real^3`;`z':real^3`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[th3]; + +ASM_REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"MA1") +THEN DISCH_THEN(LABEL_TAC"MA2") +THEN REWRITE_TAC[UNION;IN_ELIM_THM] +THEN REPEAT STRIP_TAC; + +POP_ASSUM(fun th-> POP_ASSUM(fun th1-> MP_TAC th1 THEN +REWRITE_TAC[E_SY;IN_ELIM_THM] +THEN REPEAT STRIP_TAC THEN ASSUME_TAC th1 +)THEN MP_TAC th THEN +REWRITE_TAC[E_SY;IN_ELIM_THM] +THEN REPEAT STRIP_TAC THEN ASSUME_TAC th) +THEN ABBREV_TAC`y=row i (vecmats (l:real^(M,3)finite_product))` +THEN ABBREV_TAC`z=row (SUC (i MOD dimindex (:M))) (vecmats +(l:real^(M,3)finite_product))` +THEN ABBREV_TAC`y1=row i' (vecmats (l:real^(M,3)finite_product))` +THEN ABBREV_TAC`z1=row (SUC (i' MOD dimindex (:M))) (vecmats +(l:real^(M,3)finite_product))` +THEN DISJ_CASES_TAC(SET_RULE`{y,z}INTER {y1,z1:real^3}={} \/ {y,z} INTER {y1,z1}={y} +\/ {y,z} INTER {y1,z1}={z}\/ {y,z} INTER {y1,z1}={y,z}`); + +ASM_SIMP_TAC[] +THEN REMOVE_THEN"THY6"(fun th-> MRESA1_TAC th`i:num` THEN MRESA1_TAC th`i':num` THEN MP_TAC(th) THEN DISCH_THEN(LABEL_TAC"THY6")) +THEN MRESA_TAC Planarity.aff_ge_eq_aff_gt_union_aff_ge[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN MRESAL_TAC Planarity.aff_ge_eq_aff_gt_union_aff_ge[`vec 0:real^3`;`y1:real^3`;`z1:real^3`][SET_RULE`(A UNION B) INTER C=(A INTER C) UNION (B INTER C)/\ A INTER (B UNION C)=(A INTER B) UNION (A INTER C)`] +THEN SUBGOAL_THEN`z IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`SUC (i MOD dimindex (:M))` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`z1 IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`SUC (i' MOD dimindex (:M))` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`y IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`y1 IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`i':num` +THEN ASM_REWRITE_TAC[]; + +REMOVE_THEN"THY8"(fun th-> MRESA_TAC th[`y:real^3`;`y1:real^3`] THEN MRESA_TAC th[`y:real^3`;`z1:real^3`] THEN MRESA_TAC th[`z:real^3`;`y1:real^3`] THEN MRESA_TAC th[`z:real^3`;`z1:real^3`]) +THEN MP_TAC(SET_RULE`{y, z} INTER {y1, z1} = {} ==> {y} INTER {y1:real^3}={}/\ {y} INTER {z1:real^3}={} /\ {z} INTER {z1:real^3}={} /\ {z} INTER {y1:real^3}={} /\ {y,z} INTER {y1:real^3}={} /\ {y,z} INTER {z1:real^3}={} /\ {z} INTER {y1:real^3,z1}={}/\ {y} INTER {y1:real^3,z1}={}`) +THEN RESA_TAC +THEN REMOVE_THEN"MA1"(fun th-> MRESAL_TAC th[`e1:real^3->bool`;`y1:real^3`][SET_RULE`(A UNION B) INTER C=(A INTER C) UNION (B INTER C)/\ A INTER (B UNION C)=(A INTER B) UNION (A INTER C)`] THEN MRESAL_TAC th[`e1:real^3->bool`;`z1:real^3`][SET_RULE`(A UNION B) INTER C=(A INTER C) UNION (B INTER C)/\ A INTER (B UNION C)=(A INTER B) UNION (A INTER C)`] THEN MRESAL_TAC th[`e2:real^3->bool`;`y:real^3`][SET_RULE`(A UNION B) INTER C=(A INTER C) UNION (B INTER C)/\ A INTER (B UNION C)=(A INTER B) UNION (A INTER C)`] THEN MRESAL_TAC th[`e2:real^3->bool`;`z:real^3`][SET_RULE`(A UNION B) INTER C=(A INTER C) UNION (B INTER C)/\ A INTER (B UNION C)=(A INTER B) UNION (A INTER C)`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B= B INTER A`] +THEN RESA_TAC +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B= B INTER A`] +THEN REMOVE_THEN"MA2"(fun th-> MRESA_TAC th[`e1:real^3->bool`;`e2:real^3->bool`]) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + +POP_ASSUM MP_TAC +THEN STRIP_TAC; + +ASM_SIMP_TAC[] +THEN REMOVE_THEN"THY6"(fun th-> MRESA1_TAC th`i:num` THEN MRESA1_TAC th`i':num` THEN MP_TAC(th) THEN DISCH_THEN(LABEL_TAC"THY6")) +THEN MRESA_TAC Planarity.aff_ge_eq_aff_gt_union_aff_ge[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN MRESAL_TAC Planarity.aff_ge_eq_aff_gt_union_aff_ge[`vec 0:real^3`;`y1:real^3`;`z1:real^3`][SET_RULE`(A UNION B) INTER C=(A INTER C) UNION (B INTER C)/\ A INTER (B UNION C)=(A INTER B) UNION (A INTER C)`]; + +MP_TAC(SET_RULE`{y, z} INTER {y1, z1} = {y}==> y1=y \/ z1=y:real^3`) +THEN RESA_TAC; + +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN DISJ_CASES_TAC(SET_RULE`(?v3. v3 IN aff_gt {vec 0} {y, z} INTER aff_gt {vec 0} +{y, z1}) \/ aff_gt {vec 0} {y, z} INTER aff_gt {vec 0} {y, z1:real^3}={}`); + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC POINT_COM_AFF_GT_INTER[`y:real^3`;`z:real^3`;`z1:real^3`;`v3:real^3`] +THEN +SUBGOAL_THEN`z IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`SUC (i MOD dimindex (:M))` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +MRESA_TAC Planarity.decomposition_planar_by_angle_fan[`vec 0:real^3`;`y:real^3`;`z:real^3`;`z1:real^3`]; + +REMOVE_THEN"MA1"(fun th-> MRESAL_TAC th[`e2:(real^3->bool)`;`z:real^3`][AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING]) +THEN MRESA_TAC th3[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN MRESAL_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`z:real^3`][IN_SING] +THEN MP_TAC(SET_RULE`z IN aff_gt {vec 0} {y, z1} /\ aff_gt {vec 0} {y, z1} SUBSET +aff_ge {vec 0} {y, z1:real^3} /\ aff_ge {vec 0} {y, z1:real^3} INTER aff_ge {vec 0} {z} = aff_ge {vec 0} ({y, z1:real^3} INTER {z}) /\ z IN aff_ge {vec 0} {z} +==> z IN aff_ge {vec 0} ({y, z1} INTER {z})`) +THEN ASM_SIMP_TAC[AFF_GT_SUBSET_AFF_GE] +THEN MRESA_TAC th3[`y:real^3`;`z:real^3`;`vec 0:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(y=z) /\ {y, z} INTER {y, z1} = {y} ==> {y, z1} INTER {z:real^3}={}`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING;IN_SING]; + +SUBGOAL_THEN`z1 IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`SUC (i' MOD dimindex (:M))` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i':num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +REMOVE_THEN"MA1"(fun th-> MRESAL_TAC th[`e1:(real^3->bool)`;`z1:real^3`][AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING]) +THEN MRESA_TAC th3[`vec 0:real^3`;`y:real^3`;`z1:real^3`] +THEN MRESAL_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`z1:real^3`][IN_SING] +THEN MP_TAC(SET_RULE`z1 IN aff_ge {vec 0} {y, z} /\ aff_ge {vec 0} {y, z:real^3} INTER aff_ge {vec 0} {z1} = aff_ge {vec 0} ({y, z:real^3} INTER {z1}) /\ z1 IN aff_ge {vec 0} {z1} +==> z1 IN aff_ge {vec 0} ({y, z} INTER {z1})`) +THEN ASM_SIMP_TAC[AFF_GT_SUBSET_AFF_GE] +THEN MRESA_TAC th3[`y:real^3`;`z1:real^3`;`vec 0:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(y=z1) /\ {y, z} INTER {y, z1} = {y} ==> {y, z} INTER {z1:real^3}={}`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING;IN_SING]; + +SUBGOAL_THEN`z IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`SUC (i MOD dimindex (:M))` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`z1 IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`SUC (i' MOD dimindex (:M))` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`y IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; + +REMOVE_THEN"THY8"(fun th-> MRESA_TAC th[`y:real^3`;`z1:real^3`] THEN MRESA_TAC th[`z:real^3`;`y:real^3`] THEN MRESA_TAC th[`z:real^3`;`z1:real^3`]) +THEN MRESA_TAC th3[`y:real^3`;`z1:real^3`;`vec 0:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MRESA_TAC th3[`y:real^3`;`z:real^3`;`vec 0:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{y, z} INTER {y, z1} = {y} /\ ~(y=z) /\ ~(y=z1) ==> {y} INTER {z1:real^3}={} /\ {z} INTER {z1:real^3}={} /\ {z} INTER {y:real^3}={} /\ {y,z} INTER {z1:real^3}={} /\ {y,z1} INTER {z:real^3}={}`) +THEN RESA_TAC +THEN REMOVE_THEN"MA1"(fun th-> MRESAL_TAC th[`e1:real^3->bool`;`z1:real^3`][SET_RULE`(A UNION B) INTER C=(A INTER C) UNION (B INTER C)/\ A INTER (B UNION C)=(A INTER B) UNION (A INTER C)`] THEN MRESAL_TAC th[`e2:real^3->bool`;`z:real^3`][SET_RULE`(A UNION B) INTER C=(A INTER C) UNION (B INTER C)/\ A INTER (B UNION C)=(A INTER B) UNION (A INTER C)`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B= B INTER A`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B= B INTER A`] +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC (GEN_ALL AFF_INTER_AFF_GT_EQ_EMPTY)[`vec 0:real^3`;`y:real^3`;`z1:real^3`][aff] +THEN MRESAL_TAC (GEN_ALL AFF_INTER_AFF_GT_EQ_EMPTY)[`vec 0:real^3`;`y:real^3`;`z:real^3`][aff] +THEN MRESA_TAC HALFLINE_SUBSET_AFFINE_HULL[`vec 0:real^3`;`y:real^3`] +THEN MP_TAC(SET_RULE` +affine hull {vec 0, y} INTER aff_gt {vec 0} {y, z1} = {} +/\ affine hull {vec 0, y} INTER aff_gt {vec 0} {y, z} = {} +/\ aff_ge {vec 0} {y} SUBSET affine hull {vec 0, y:real^3} +==> aff_gt {vec 0} {y, z} INTER aff_ge {vec 0} {y}={} +/\ aff_ge {vec 0} {y} INTER aff_gt {vec 0} {y, z1}={}`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{} UNION A=A +/\ aff_gt {vec 0} {y, z} INTER aff_ge {vec 0} {z1} UNION + (aff_ge {vec 0} {y} INTER aff_ge {vec 0} {y} UNION aff_ge {vec 0} {}) UNION + aff_ge {vec 0} {}= +(aff_gt {vec 0} {y, z} INTER aff_ge {vec 0} {z1} UNION aff_ge {vec 0} {} UNION +aff_ge {vec 0} {}) UNION + (aff_ge {vec 0} {y} INTER aff_ge {vec 0} {y} UNION aff_ge {vec 0} {}) + `;] +THEN MRESAL_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`y:real^3`][IN_SING] +THEN ASM_SIMP_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING;IN_SING] +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN DISJ_CASES_TAC(SET_RULE`(?v3. v3 IN aff_gt {vec 0} {y, z} INTER aff_gt {vec 0} +{y, y1}) \/ aff_gt {vec 0} {y, z} INTER aff_gt {vec 0} {y, y1:real^3}={}`); + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC POINT_COM_AFF_GT_INTER[`y:real^3`;`z:real^3`;`y1:real^3`;`v3:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN +SUBGOAL_THEN`z IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`SUC (i MOD dimindex (:M))` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +MRESA_TAC Planarity.decomposition_planar_by_angle_fan[`vec 0:real^3`;`y:real^3`;`z:real^3`;`y1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC; + +REMOVE_THEN"MA1"(fun th-> MRESAL_TAC th[`e2:(real^3->bool)`;`z:real^3`][AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING]) +THEN MRESA_TAC th3[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN MRESAL_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`z:real^3`][IN_SING] +THEN MP_TAC(SET_RULE`z IN aff_gt {vec 0} {y1, y} /\ aff_gt {vec 0} {y1, y} SUBSET +aff_ge {vec 0} {y1, y:real^3} /\ aff_ge {vec 0} {y1, y:real^3} INTER aff_ge {vec 0} {z} = aff_ge {vec 0} ({y1, y:real^3} INTER {z}) /\ z IN aff_ge {vec 0} {z} +==> z IN aff_ge {vec 0} ({y1, y} INTER {z})`) +THEN ASM_SIMP_TAC[AFF_GT_SUBSET_AFF_GE] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC th3[`y:real^3`;`z:real^3`;`vec 0:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(y=z) /\ {y, z} INTER {y1, y} = {y} ==> {y, y1} INTER {z:real^3}={}`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING;IN_SING]; + +SUBGOAL_THEN`y1 IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`i':num` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i':num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +REMOVE_THEN"MA1"(fun th-> MRESAL_TAC th[`e1:(real^3->bool)`;`y1:real^3`][AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING]) +THEN MRESA_TAC th3[`vec 0:real^3`;`y1:real^3`;`y:real^3`] +THEN MRESAL_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`y1:real^3`][IN_SING] +THEN MP_TAC(SET_RULE`y1 IN aff_ge {vec 0} {y, z} /\ aff_ge {vec 0} {y, z:real^3} INTER aff_ge {vec 0} {y1} = aff_ge {vec 0} ({y, z:real^3} INTER {y1}) /\ y1 IN aff_ge {vec 0} {y1} +==> y1 IN aff_ge {vec 0} ({y, z} INTER {y1})`) +THEN ASM_SIMP_TAC[AFF_GT_SUBSET_AFF_GE] +THEN MRESA_TAC th3[`y1:real^3`;`y:real^3`;`vec 0:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(y=y1) /\ {y, z} INTER {y1, y} = {y} ==> {y, z} INTER {y1:real^3}={}`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING;IN_SING]; + +SUBGOAL_THEN`z IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`SUC (i MOD dimindex (:M))` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`y1 IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`i':num` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`y IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; + +REMOVE_THEN"THY8"(fun th-> MRESA_TAC th[`y:real^3`;`y1:real^3`] THEN MRESA_TAC th[`z:real^3`;`y:real^3`] THEN MRESA_TAC th[`z:real^3`;`y1:real^3`]) +THEN MRESA_TAC th3[`y1:real^3`;`y:real^3`;`vec 0:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MRESA_TAC th3[`y:real^3`;`z:real^3`;`vec 0:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{y, z} INTER {y1, y} = {y} /\ ~(y=z) /\ ~(y=y1) ==> {y} INTER {y1:real^3}={} /\ {z} INTER {y1:real^3}={} /\ {z} INTER {y:real^3}={} /\ {y,z} INTER {y1:real^3}={} /\ {y1,y} INTER {z:real^3}={}`) +THEN RESA_TAC +THEN REMOVE_THEN"MA1"(fun th-> MRESAL_TAC th[`e1:real^3->bool`;`y1:real^3`][SET_RULE`(A UNION B) INTER C=(A INTER C) UNION (B INTER C)/\ A INTER (B UNION C)=(A INTER B) UNION (A INTER C)`] THEN MRESAL_TAC th[`e2:real^3->bool`;`z:real^3`][SET_RULE`(A UNION B) INTER C=(A INTER C) UNION (B INTER C)/\ A INTER (B UNION C)=(A INTER B) UNION (A INTER C)`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B= B INTER A`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B= B INTER A`] +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC (GEN_ALL AFF_INTER_AFF_GT_EQ_EMPTY)[`vec 0:real^3`;`y:real^3`;`y1:real^3`][aff] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL AFF_INTER_AFF_GT_EQ_EMPTY)[`vec 0:real^3`;`y:real^3`;`z:real^3`][aff] +THEN MRESA_TAC HALFLINE_SUBSET_AFFINE_HULL[`vec 0:real^3`;`y:real^3`] +THEN MP_TAC(SET_RULE` +affine hull {vec 0, y} INTER aff_gt {vec 0} {y, y1} = {} +/\ affine hull {vec 0, y} INTER aff_gt {vec 0} {y, z} = {} +/\ aff_ge {vec 0} {y} SUBSET affine hull {vec 0, y:real^3} +==> aff_gt {vec 0} {y, z} INTER aff_ge {vec 0} {y}={} +/\ aff_ge {vec 0} {y} INTER aff_gt {vec 0} {y, y1}={}`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[SET_RULE`A UNION {}=A`;] +THEN SUBGOAL_THEN`aff_gt{vec 0} {y1,y}=aff_gt{vec 0} {y,y1:real^3}` ASSUME_TAC; + +ASSUME_TAC(SET_RULE`{y1,y}={y,y1:real^3}`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]); + +ASM_REWRITE_TAC[SET_RULE`({} UNION aff_gt {vec 0} {y, z} INTER aff_ge {vec 0} {y1}) UNION + ({} UNION + aff_ge {vec 0} {} UNION + aff_ge {vec 0} {y} INTER aff_ge {vec 0} {y}) UNION + aff_ge {vec 0} {} +=(aff_gt {vec 0} {y, z} INTER aff_ge {vec 0} {y1} UNION aff_ge {vec 0} {} + UNION + aff_ge {vec 0} {}) UNION + aff_ge {vec 0} {y}`] +THEN MRESAL_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`y:real^3`][IN_SING] +THEN ASM_SIMP_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING;IN_SING] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + +ASM_SIMP_TAC[] +THEN REMOVE_THEN"THY6"(fun th-> MRESA1_TAC th`i:num` THEN MRESA1_TAC th`i':num` THEN MP_TAC(th) THEN DISCH_THEN(LABEL_TAC"THY6")) +THEN MRESA_TAC Planarity.aff_ge_eq_aff_gt_union_aff_ge[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN MRESAL_TAC Planarity.aff_ge_eq_aff_gt_union_aff_ge[`vec 0:real^3`;`y1:real^3`;`z1:real^3`][SET_RULE`(A UNION B) INTER C=(A INTER C) UNION (B INTER C)/\ A INTER (B UNION C)=(A INTER B) UNION (A INTER C)`]; + +MP_TAC(SET_RULE`{y, z} INTER {y1, z1} = {z}==> y1=z \/ z1=z:real^3`) +THEN RESA_TAC; + +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN DISJ_CASES_TAC(SET_RULE`(?v3. v3 IN aff_gt {vec 0} {z,y} INTER aff_gt {vec 0} +{z, z1}) \/ aff_gt {vec 0} {z,y} INTER aff_gt {vec 0} {z, z1:real^3}={}`); + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC POINT_COM_AFF_GT_INTER[`z:real^3`;`y:real^3`;`z1:real^3`;`v3:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN +SUBGOAL_THEN`y IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +MRESA_TAC Planarity.decomposition_planar_by_angle_fan[`vec 0:real^3`;`z:real^3`;`y:real^3`;`z1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC; + +REMOVE_THEN"MA1"(fun th-> MRESAL_TAC th[`e2:(real^3->bool)`;`y:real^3`][AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING]) +THEN MRESA_TAC th3[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN MRESAL_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`y:real^3`][IN_SING] +THEN MP_TAC(SET_RULE`y IN aff_gt {vec 0} {z, z1} /\ aff_gt {vec 0} {z, z1} SUBSET +aff_ge {vec 0} {z, z1:real^3} /\ aff_ge {vec 0} {z, z1:real^3} INTER aff_ge {vec 0} {y} = aff_ge {vec 0} ({z, z1:real^3} INTER {y}) /\ y IN aff_ge {vec 0} {y} +==> y IN aff_ge {vec 0} ({z, z1} INTER {y})`) +THEN ASM_SIMP_TAC[AFF_GT_SUBSET_AFF_GE] +THEN MRESA_TAC th3[`y:real^3`;`z:real^3`;`vec 0:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(y=z) /\ {y, z} INTER {z, z1} = {z} ==> {z, z1} INTER {y:real^3}={}`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING;IN_SING]; + +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN SUBGOAL_THEN`z1 IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`SUC (i' MOD dimindex (:M))` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i':num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +REMOVE_THEN"MA1"(fun th-> MRESAL_TAC th[`e1:(real^3->bool)`;`z1:real^3`][AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING]) +THEN MRESA_TAC th3[`vec 0:real^3`;`z:real^3`;`z1:real^3`] +THEN MRESAL_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`z1:real^3`][IN_SING] +THEN MP_TAC(SET_RULE`z1 IN aff_ge {vec 0} {y, z} /\ aff_ge {vec 0} {y, z:real^3} INTER aff_ge {vec 0} {z1} = aff_ge {vec 0} ({y, z:real^3} INTER {z1}) /\ z1 IN aff_ge {vec 0} {z1} +==> z1 IN aff_ge {vec 0} ({y, z} INTER {z1})`) +THEN ASM_SIMP_TAC[AFF_GT_SUBSET_AFF_GE] +THEN MRESA_TAC th3[`z:real^3`;`z1:real^3`;`vec 0:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(z=z1) /\ {y, z} INTER {z, z1} = {z} ==> {y, z} INTER {z1:real^3}={}`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING;IN_SING]; + +POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`aff_gt{vec 0} {z,y}=aff_gt{vec 0} {y,z:real^3}` ASSUME_TAC; + +ASSUME_TAC(SET_RULE`{z,y}={y,z:real^3}`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]); + +RESA_TAC +THEN SUBGOAL_THEN`z IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`SUC (i MOD dimindex (:M))` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`z1 IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`SUC (i' MOD dimindex (:M))` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`y IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; + +REMOVE_THEN"THY8"(fun th-> MRESA_TAC th[`y:real^3`;`z1:real^3`] THEN MRESA_TAC th[`z:real^3`;`y:real^3`] THEN MRESA_TAC th[`z:real^3`;`z1:real^3`]) +THEN MRESA_TAC th3[`z:real^3`;`z1:real^3`;`vec 0:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MRESA_TAC th3[`y:real^3`;`z:real^3`;`vec 0:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{y, z} INTER {z, z1} = {z} /\ ~(y=z) /\ ~(z=z1) ==> {y} INTER {z1:real^3}={} /\ {z} INTER {z1:real^3}={} /\ {z} INTER {y:real^3}={} /\ {y,z} INTER {z1:real^3}={} /\ {z,z1} INTER {y:real^3}={}`) +THEN RESA_TAC +THEN REMOVE_THEN"MA1"(fun th-> MRESAL_TAC th[`e1:real^3->bool`;`z1:real^3`][SET_RULE`(A UNION B) INTER C=(A INTER C) UNION (B INTER C)/\ A INTER (B UNION C)=(A INTER B) UNION (A INTER C)`] THEN MRESAL_TAC th[`e2:real^3->bool`;`y:real^3`][SET_RULE`(A UNION B) INTER C=(A INTER C) UNION (B INTER C)/\ A INTER (B UNION C)=(A INTER B) UNION (A INTER C)`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B= B INTER A`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B= B INTER A`] +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC (GEN_ALL AFF_INTER_AFF_GT_EQ_EMPTY)[`vec 0:real^3`;`z:real^3`;`z1:real^3`][aff] +THEN MRESAL_TAC (GEN_ALL AFF_INTER_AFF_GT_EQ_EMPTY)[`vec 0:real^3`;`z:real^3`;`y:real^3`][aff] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC HALFLINE_SUBSET_AFFINE_HULL[`vec 0:real^3`;`z:real^3`] +THEN MP_TAC(SET_RULE` +affine hull {vec 0, z} INTER aff_gt {vec 0} {z, z1} = {} +/\ affine hull {vec 0, z} INTER aff_gt {vec 0} {y, z} = {} +/\ aff_ge {vec 0} {z} SUBSET affine hull {vec 0, z:real^3} +==> aff_gt {vec 0} {y, z} INTER aff_ge {vec 0} {z}={} +/\ aff_ge {vec 0} {z} INTER aff_gt {vec 0} {z, z1}={}`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`({} UNION {} UNION aff_gt {vec 0} {y, z} INTER aff_ge {vec 0} {z1}) UNION + aff_ge {vec 0} {} UNION + {} UNION + aff_ge {vec 0} {z} INTER aff_ge {vec 0} {z} UNION + aff_ge {vec 0} {}= +(aff_gt {vec 0} {y, z} INTER aff_ge {vec 0} {z1} UNION aff_ge {vec 0} {} UNION +aff_ge {vec 0} {}) UNION + ( aff_ge {vec 0} {z}) + `;] +THEN MRESAL_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`z:real^3`][IN_SING] +THEN ASM_SIMP_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING;IN_SING] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN DISJ_CASES_TAC(SET_RULE`(?v3. v3 IN aff_gt {vec 0} {z, y} INTER aff_gt {vec 0} +{z, y1}) \/ aff_gt {vec 0} {z, y} INTER aff_gt {vec 0} {z, y1:real^3}={}`); + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN MRESA_TAC POINT_COM_AFF_GT_INTER[`z:real^3`;`y:real^3`;`y1:real^3`;`v3:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN +SUBGOAL_THEN`y IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +MRESA_TAC Planarity.decomposition_planar_by_angle_fan[`vec 0:real^3`;`z:real^3`;`y:real^3`;`y1:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN REMOVE_THEN"MA1"(fun th-> MRESAL_TAC th[`e2:(real^3->bool)`;`y:real^3`][AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING]) +THEN MRESA_TAC th3[`vec 0:real^3`;`y:real^3`;`z:real^3`] +THEN MRESAL_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`y:real^3`][IN_SING] +THEN MP_TAC(SET_RULE`y IN aff_gt {vec 0} {y1, z} /\ aff_gt {vec 0} {y1, z} SUBSET +aff_ge {vec 0} {y1, z:real^3} /\ aff_ge {vec 0} {y1, z:real^3} INTER aff_ge {vec 0} {y} = aff_ge {vec 0} ({y1, z:real^3} INTER {y}) /\ y IN aff_ge {vec 0} {y} +==> y IN aff_ge {vec 0} ({y1, z} INTER {y})`) +THEN ASM_SIMP_TAC[AFF_GT_SUBSET_AFF_GE] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC th3[`y:real^3`;`z:real^3`;`vec 0:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(y=z) /\ {y, z} INTER {y1, z} = {z} ==> { z,y1} INTER {y:real^3}={}`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING;IN_SING]; + +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`y1 IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`i':num` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i':num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +REMOVE_THEN"MA1"(fun th-> MRESAL_TAC th[`e1:(real^3->bool)`;`y1:real^3`][AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING]) +THEN MRESA_TAC th3[`vec 0:real^3`;`y1:real^3`;`z:real^3`] +THEN MRESAL_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`y1:real^3`][IN_SING] +THEN MP_TAC(SET_RULE`y1 IN aff_ge {vec 0} {y, z} /\ aff_ge {vec 0} {y, z:real^3} INTER aff_ge {vec 0} {y1} = aff_ge {vec 0} ({y, z:real^3} INTER {y1}) /\ y1 IN aff_ge {vec 0} {y1} +==> y1 IN aff_ge {vec 0} ({y, z} INTER {y1})`) +THEN ASM_SIMP_TAC[AFF_GT_SUBSET_AFF_GE] +THEN MRESA_TAC th3[`y1:real^3`;`z:real^3`;`vec 0:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(z=y1) /\ {y, z} INTER {y1, z} = {z} ==> {y, z} INTER {y1:real^3}={}`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING;IN_SING]; + +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`z IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`SUC (i MOD dimindex (:M))` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`y1 IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`i':num` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`y IN V_SY (vecmats (l:real^(M,3)finite_product))` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM;V_SY;rows] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; + +ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN REMOVE_THEN"THY8"(fun th-> MRESA_TAC th[`y:real^3`;`y1:real^3`] THEN MRESA_TAC th[`z:real^3`;`y:real^3`] THEN MRESA_TAC th[`z:real^3`;`y1:real^3`]) +THEN MRESA_TAC th3[`y1:real^3`;`z:real^3`;`vec 0:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MRESA_TAC th3[`y:real^3`;`z:real^3`;`vec 0:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`{y, z} INTER {y1, z} = {z} /\ ~(y=z) /\ ~(z=y1) ==> {y} INTER {y1:real^3}={} /\ {z} INTER {y1:real^3}={} /\ {z} INTER {y:real^3}={} /\ {y,z} INTER {y1:real^3}={} /\ {y1,z} INTER {y:real^3}={}`) +THEN RESA_TAC +THEN REMOVE_THEN"MA1"(fun th-> MRESAL_TAC th[`e1:real^3->bool`;`y1:real^3`][SET_RULE`(A UNION B) INTER C=(A INTER C) UNION (B INTER C)/\ A INTER (B UNION C)=(A INTER B) UNION (A INTER C)`] THEN MRESAL_TAC th[`e2:real^3->bool`;`y:real^3`][SET_RULE`(A UNION B) INTER C=(A INTER C) UNION (B INTER C)/\ A INTER (B UNION C)=(A INTER B) UNION (A INTER C)`]) +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B= B INTER A`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B= B INTER A`] +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC (GEN_ALL AFF_INTER_AFF_GT_EQ_EMPTY)[`vec 0:real^3`;`z:real^3`;`y1:real^3`][aff] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL AFF_INTER_AFF_GT_EQ_EMPTY)[`vec 0:real^3`;`z:real^3`;`y:real^3`][aff] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN MRESA_TAC HALFLINE_SUBSET_AFFINE_HULL[`vec 0:real^3`;`z:real^3`] +THEN MP_TAC(SET_RULE` +affine hull {vec 0, z} INTER aff_gt {vec 0} {z, y1} = {} +/\ affine hull {vec 0, z} INTER aff_gt {vec 0} {z, y} = {} +/\ aff_ge {vec 0} {z} SUBSET affine hull {vec 0, z:real^3} +==> aff_gt {vec 0} {z, y} INTER aff_ge {vec 0} {z}={} +/\ aff_ge {vec 0} {z} INTER aff_gt {vec 0} {z, y1}={}`) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`] +THEN ASM_REWRITE_TAC[SET_RULE`({} UNION aff_gt {vec 0} {y, z} INTER aff_ge {vec 0} {y1} UNION {}) UNION + aff_ge {vec 0} {} UNION + {} UNION + aff_ge {vec 0} {} UNION + aff_ge {vec 0} {z} INTER aff_ge {vec 0} {z} += (aff_gt {vec 0} {y, z} INTER aff_ge {vec 0} {y1} UNION aff_ge {vec 0} {} UNION + aff_ge {vec 0} {}) UNION + aff_ge {vec 0} {z} `;] +THEN MRESA_TAC th3[`vec 0:real^3`;`y1:real^3`;`z:real^3`;] +THEN MRESAL_TAC Planarity.point_in_aff_ge_1_1[`vec 0:real^3`;`z:real^3`][IN_SING] +THEN ASM_SIMP_TAC[AFF_GE_EQ_AFFINE_HULL;AFFINE_HULL_SING;IN_SING] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; + +ASM_SIMP_TAC[] +THEN REMOVE_THEN"THY6"(fun th-> MRESA1_TAC th`i:num` THEN MRESA1_TAC th`i':num` THEN MP_TAC(th) THEN DISCH_THEN(LABEL_TAC"THY6")) +THEN MRESA_TAC th3[`y:real^3`;`z:real^3`;`vec 0:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MRESA_TAC th3[`y1:real^3`;`z1:real^3`;`vec 0:real^3`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={C,A,B}`] +THEN RESA_TAC +THEN MP_TAC(SET_RULE`~(y1=z1)/\ ~(y=z)/\ {y, z} INTER {y1, z1} = {y, z}==> {y1, z1:real^3} = {y, z}`) +THEN RESA_TAC +THEN SET_TAC[]; + +ASM_SIMP_TAC[]; + +REMOVE_THEN "MA1"(fun th-> MRESA_TAC th[`e2:real^3->bool`;`v':real^3`]) +THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B=B INTER A`] +THEN ASM_REWRITE_TAC[]; + +ASM_SIMP_TAC[]; + + + +SUBGOAL_THEN`!i j. + 1 <= i /\ + i <= dimindex (:M) /\ + 1 <= j /\ + j <= dimindex (:M) /\ + row i (vecmats l) = row j (vecmats (l:real^(M,3)finite_product)) + ==> i = j` ASSUME_TAC; + +REPEAT STRIP_TAC +THEN REMOVE_THEN "THY3"(fun th-> MRESAL_TAC th[`i:num`;`j:num`][VECTOR_ARITH`A-A= vec 0`;NORM_0]) +THEN DISJ_CASES_TAC(SET_RULE`~(i=j:num)\/ (i=j)`); + +MP_TAC(ARITH_RULE`i <= dimindex (:M)==> i <= dimindex (:M)-1 \/ i = dimindex (:M)`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE`j <= dimindex (:M)==> j <= dimindex (:M)-1 \/ j = dimindex (:M)`) +THEN RESA_TAC; + +REMOVE_THEN"THYGIANG"MP_TAC +THEN ASM_SIMP_TAC[IN_NUMSEG] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`i:num`;`j:num`][ARITH_RULE`0<= i:num`]) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN REMOVE_THEN"THYGIANG"MP_TAC +THEN ASM_SIMP_TAC[IN_NUMSEG] +THEN MP_TAC(ARITH_RULE`1<= i==> ~(i = 0)`) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`i:num`;`0:num`][ARITH_RULE`0<= i:num`]) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ dimindex (:M) + dimindex (:M)= dimindex (:M) *2`] +THEN REMOVE_THEN "THYGIANG2" MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`i:num`;`k:num`;][IN_NUMSEG;ARITH_RULE`0<=a:num/\ A+0=A /\ dimindex (:M) + dimindex (:M)= dimindex (:M) *2`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC MOD_MULT[`k:num`;`1`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +MP_TAC(ARITH_RULE`j <= dimindex (:M)==> j <= dimindex (:M)-1 \/ j = dimindex (:M)`) +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN STRIP_TAC +THEN MRESAL_TAC MOD_MULT[`k:num`;`1`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A`] +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ dimindex (:M) + dimindex (:M)= dimindex (:M) *2`] +THEN REMOVE_THEN "THYGIANG2" MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`j:num`;`k:num`;][IN_NUMSEG;ARITH_RULE`0<=a:num/\ A+0=A `]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`j:num`;`k:num`;][IN_NUMSEG;ARITH_RULE`0<=a:num/\ A+0=A /\ dimindex (:M) + dimindex (:M)= dimindex (:M) *2`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= j==> ~(j = 0)`) +THEN RESA_TAC +THEN REMOVE_THEN"THYGIANG"MP_TAC +THEN ASM_SIMP_TAC[IN_NUMSEG] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`j:num`;`0:num`][ARITH_RULE`0<= i:num`]) +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MESON_TAC[]; + +SET_TAC[]; + +SUBGOAL_THEN`local_fan (V_SY (vecmats l),E_SY (vecmats l), F_SY(vecmats (l:real^(M,3)finite_product)))` ASSUME_TAC; + +ASM_REWRITE_TAC[local_fan] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC; + +EXISTS_TAC`(row 1 (vecmats (l:real^(M,3)finite_product)), row (SUC (1 MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))` +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN STRIP_TAC; + +SIMP_TAC[darts_of_hyp;ord_pairs;E_SY;] +THEN MATCH_MP_TAC(SET_RULE`A IN B ==> A IN B UNION C`) +THEN REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`row 1 (vecmats (l:real^(M,3)finite_product))` +THEN EXISTS_TAC`row (SUC (1 MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<=1`; DIMINDEX_GE_1]; + +MATCH_MP_TAC FACE_HYP_FAN_SY +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN MESON_TAC[]; + +MRESA1_TAC (GEN_ALL DIH2K_FAN_HYP_SY)`l:real^(M,3)finite_product` +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`2 MP_TAC th +THEN ASM_REWRITE_TAC[local_fan] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN DISCH_TAC THEN ASSUME_TAC th) +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`!i u v w. 1<= i /\ i<= dimindex (:M) +/\ row i (vecmats l)=u +/\ row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))=v +/\ (row (SUC ((SUC (i MOD dimindex (:M))) MOD dimindex (:M))) (vecmats l))=w +==> &0<= (v cross w) dot u` ASSUME_TAC; + +REPEAT STRIP_TAC +THEN SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; + +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SUBGOAL_THEN`1 <= SUC (SUC (i MOD dimindex (:M)) MOD dimindex (:M)) /\ + SUC (SUC (i MOD dimindex (:M)) MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; + +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`SUC (i MOD dimindex (:M)):num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +REMOVE_THEN "YEU2" (fun th-> MRESA1_TAC th`i:num` THEN MRESA1_TAC th`SUC (i MOD dimindex (:M))` +THEN MRESA1_TAC th`(SUC (SUC (i MOD dimindex (:M)) MOD dimindex (:M)))` THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"YEU2")) +THEN +MRESA_TAC (GEN_ALL CROSS_DOT_SEQUENTIALLY)[`(\n. row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n))`;`(\n. row (SUC (SUC (i MOD dimindex (:M)) MOD dimindex (:M))) ((v:num->real^3^M) n))`;`(\n. row i ((v:num->real^3^M) n))`;`v':real^3`;`w:real^3`;`u:real^3`] +THEN SUBGOAL_THEN`eventually + (\x. &0 <= + drop + ((lift o + (\n. (row (SUC (i MOD dimindex (:M))) (v n) cross + row (SUC (SUC (i MOD dimindex (:M)) MOD dimindex (:M))) + (v n)) dot + row i ((v:num->real^3^M) n))) + x)) + sequentially` ASSUME_TAC; + +REWRITE_TAC[EVENTUALLY_SEQUENTIALLY;o_DEF;LIFT_DROP] +THEN EXISTS_TAC`0` +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THY1"(fun th-> MRESA1_TAC th`n:num`) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[convex_local_fan;] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY30") +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th +THEN REWRITE_TAC[local_fan] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN SUBGOAL_THEN`row (SUC (i MOD dimindex (:M))) (v n), + row (SUC (SUC (i MOD dimindex (:M)) MOD dimindex (:M))) (v n) IN + F_SY ((v:num->real^3^M) n)`ASSUME_TAC; + +REWRITE_TAC[F_SY;IN_ELIM_THM] +THEN EXISTS_TAC`(SUC (i MOD dimindex (:M)))` +THEN ASM_REWRITE_TAC[]; + +STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th` +row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n), + row (SUC (SUC (i MOD dimindex (:M)) MOD dimindex (:M))) (v n)`) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_DETERMINE_AZIM_IN_FA)[`V_SY (((v:num->real^3^M) n))`;`F_SY (((v:num->real^3^M) n))`;`E_SY ( ((v:num->real^3^M) n))`;`row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n), + row (SUC (SUC (i MOD dimindex (:M)) MOD dimindex (:M))) (v n)`] +THEN FIND_ASSUM MP_TAC`1real^3^M) n) + ==> i1 = j)` ASSUME_TAC; + +REPEAT STRIP_TAC +THEN REMOVE_THEN "THY30"(fun th-> MRESAL_TAC th[`i1:num`;`j:num`][VECTOR_ARITH`A-A= vec 0`;NORM_0]) +THEN DISJ_CASES_TAC(SET_RULE`~(i1=j:num)\/ (i1=j)`); + +MP_TAC(ARITH_RULE`i1 <= dimindex (:M)==> i1 <= dimindex (:M)-1 \/ i1 = dimindex (:M)`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE`j <= dimindex (:M)==> j <= dimindex (:M)-1 \/ j = dimindex (:M)`) +THEN RESA_TAC; + +REMOVE_THEN"THYGIANG"MP_TAC +THEN MRESA_TAC IN_NUMSEG[`0`;`k-1:num`;`i1:num`] +THEN MRESA_TAC IN_NUMSEG[`0`;`k-1:num`;`j:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`i1:num`;`j:num`][ARITH_RULE`0<= i:num`]) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN REMOVE_THEN"THYGIANG"MP_TAC +THEN MRESA_TAC IN_NUMSEG[`0`;`k-1:num`;`i1:num`] +THEN MRESA_TAC IN_NUMSEG[`0`;`k-1:num`;`j:num`] +THEN MRESA_TAC IN_NUMSEG[`0`;`k-1:num`;`0:num`] +THEN MP_TAC(ARITH_RULE`1<= i1==> ~(i1 = 0)`) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`i1:num`;`0:num`][ARITH_RULE`0<= i1:num`]) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ dimindex (:M) + dimindex (:M)= dimindex (:M) *2`] +THEN REMOVE_THEN "THYGIANG2" MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`i1:num`;`k:num`;][IN_NUMSEG;ARITH_RULE`0<=a:num/\ A+0=A /\ dimindex (:M) + dimindex (:M)= dimindex (:M) *2`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC MOD_MULT[`k:num`;`1`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +MP_TAC(ARITH_RULE`j <= dimindex (:M)==> j <= dimindex (:M)-1 \/ j = dimindex (:M)`) +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN STRIP_TAC +THEN MRESAL_TAC MOD_MULT[`k:num`;`1`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A`] +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ dimindex (:M) + dimindex (:M)= dimindex (:M) *2`] +THEN REMOVE_THEN "THYGIANG2" MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`j:num`;`k:num`;][ARITH_RULE`0<=a:num/\ A+0=A `]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`j:num`;`k:num`;][ARITH_RULE`0<=a:num/\ A+0=A /\ dimindex (:M) + dimindex (:M)= dimindex (:M) *2`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= j==> ~(j = 0)`) +THEN RESA_TAC +THEN REMOVE_THEN"THYGIANG"MP_TAC +THEN MRESA_TAC IN_NUMSEG[`0`;`k-1:num`;`j:num`] +THEN MRESA_TAC IN_NUMSEG[`0`;`k-1:num`;`0:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`j:num`;`0:num`][ARITH_RULE`0<= i:num`]) +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MESON_TAC[]; + +ASM_MESON_TAC[]; + +MRESAL_TAC(GEN_ALL AZIM_CYCLE_EQ1)[`i:num`;`row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n)`;`row (SUC (SUC (i MOD dimindex (:M)) MOD dimindex (:M))) ((v:num->real^3^M) n)`;`row (i) ((v:num->real^3^M) n)`;`matvec((v:num-> real^3^M) n)`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;VECMATS_MATVEC_ID] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL EDGE_IN_E_SY)[`i:num`;`row i ((v:num->real^3^M) n)`;`row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n)`;`matvec ((v:num->real^3^M) n)`][VECMATS_MATVEC_ID] +THEN MRESAL_TAC (GEN_ALL EDGE_IN_E_SY)[`(SUC (i MOD dimindex (:M)))`;`row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n)`;`row (SUC (SUC (i MOD dimindex (:M)) MOD dimindex (:M))) ((v:num->real^3^M) n)`;`matvec ((v:num->real^3^M) n)`][VECMATS_MATVEC_ID] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY ((v:num->real^3^M) n)`;`E_SY ((v:num->real^3^M) n)`;`row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n)`;`row (SUC (SUC (i MOD dimindex (:M)) MOD dimindex (:M))) ((v:num->real^3^M) n)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY ((v:num->real^3^M) n)`;`E_SY ((v:num->real^3^M) n)`;`row i ((v:num->real^3^M) n)`;`row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN MRESAL_TAC Planarity.cross_dot_fully_surrounded_ge_fan[`vec 0:real^3`;`row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n)`;`row i ((v:num->real^3^M) n)`;`row (SUC (SUC (i MOD dimindex (:M)) MOD dimindex (:M))) ((v:num->real^3^M) n)`][azim;VECTOR_ARITH`A- vec 0=A`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC; + +MRESAL_TAC LIM_DROP_LBOUND[`sequentially`;`lift o + (\n. (row (SUC (i MOD dimindex (:M))) (v n) cross + row (SUC (SUC (i MOD dimindex (:M)) MOD dimindex (:M))) (v n)) dot + row i ((v:num->real^3^M) n))`;`lift ((v' cross w:real^3) dot u)`;`&0`][TRIVIAL_LIMIT_SEQUENTIALLY;LIFT_DROP]; + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY30") +THEN GEN_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`azim_in_fan x' (E_SY (vecmats (l:real^(M,3)finite_product))) <= pi` ASSUME_TAC; + +POP_ASSUM(fun th-> MP_TAC th +THEN REWRITE_TAC[F_SY;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_DETERMINE_AZIM_IN_FA)[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`x':real^3#real^3`] +THEN ABBREV_TAC`u1=row i (vecmats (l:real^(M,3)finite_product))` +THEN ABBREV_TAC`v1=row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))` +THEN FIND_ASSUM MP_TAC`1 i=1 \/ 1<= i-1`) +THEN RESA_TAC; + +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN MRESAL_TAC MOD_MULT[`dimindex (:M)`;`1`][ARITH_RULE`k*1=k`;ARITH_RULE`SUC 0=1`;DIMINDEX_NONZERO] +THEN MRESAL_TAC(GEN_ALL AZIM_CYCLE_EQ1)[`k:num`;`u1:real^3`;`v1:real^3`;`(row +(dimindex (:M)) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`] +THEN REMOVE_THEN"THY30"(fun th-> MRESAL_TAC th [`k:num`;`(row +(dimindex (:M)) (vecmats (l:real^(M,3)finite_product)))`;`u1:real^3`;`v1:real^3`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`]) +THEN MP_TAC(REAL_ARITH`&0 <= (u1 cross v1) dot row (dimindex (:M)) (vecmats (l:real^(M,3)finite_product)) +==> &0 < (u1 cross v1) dot row (dimindex (:M)) (vecmats l)\/ (u1 cross v1) dot row (dimindex (:M)) (vecmats l)= &0`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`1:num`;`u1:real^3`;`v1:real^3`;`(l:real^(M,3)finite_product)`] +THEN MRESAL_TAC (GEN_ALL EDGE_IN_E_SY)[`dimindex (:M):num`;`row (dimindex (:M)) (vecmats (l:real^(M,3)finite_product))`;`u1:real^3`;`(l:real^(M,3)finite_product)`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`v1:real^3`;`u1:real^3`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`u1:real^3`;`row (dimindex (:M)) (vecmats (l:real^(M,3)finite_product))`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.MIXED_PROD_POS_IMP_RANGE_AZIM)[`u1:real^3`;`v1:real^3`;`(row +(dimindex (:M)) (vecmats (l:real^(M,3)finite_product)))`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{C,A,B}={C,B,A}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[Local_lemmas.CROSS_DOT_COPLANAR] +THEN MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`1:num`;`u1:real^3`;`v1:real^3`;`(l:real^(M,3)finite_product)`] +THEN MRESAL_TAC (GEN_ALL EDGE_IN_E_SY)[`dimindex (:M):num`;`row (dimindex (:M)) (vecmats (l:real^(M,3)finite_product))`;`u1:real^3`;`(l:real^(M,3)finite_product)`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`v1:real^3`;`u1:real^3`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`u1:real^3`;`row (dimindex (:M)) (vecmats (l:real^(M,3)finite_product))`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MRESAL_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`vec 0:real^3`;`u1:real^3`;`v1:real^3`;`row (dimindex (:M)) (vecmats (l:real^(M,3)finite_product))`][PI_POS_LE;REAL_ARITH`a<=a`]; + +MP_TAC(ARITH_RULE`1<= i /\ i<= dimindex (:M) ==> i-1 < dimindex (:M)/\ i-1 <= dimindex (:M)`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_LT[`i-1:num`;`dimindex (:M):num`][ARITH_RULE`0<1`] +THEN MRESAL_TAC(GEN_ALL AZIM_CYCLE_EQ1)[`i-1:num`;`u1:real^3`;`v1:real^3`;`(row +(i-1) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN"THY30"(fun th-> MRESAL_TAC th [`i-1:num`;`(row +(i-1) (vecmats (l:real^(M,3)finite_product)))`;`u1:real^3`;`v1:real^3`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= i /\ i<= dimindex (:M) ==> i-1 < dimindex (:M)/\ i-1 <= dimindex (:M)/\ SUC (i-1)=i`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN STRIP_TAC +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`&0 <= (u1 cross v1) dot row (i-1) (vecmats (l:real^(M,3)finite_product)) +==> &0 < (u1 cross v1) dot row (i-1) (vecmats l)\/ (u1 cross v1) dot row (i-1) (vecmats l)= &0`) +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`i:num`;`u1:real^3`;`v1:real^3`;`(l:real^(M,3)finite_product)`] +THEN MRESAL_TAC (GEN_ALL EDGE_IN_E_SY)[`i-1:num`;`row (i-1) (vecmats (l:real^(M,3)finite_product))`;`u1:real^3`;`(l:real^(M,3)finite_product)`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= i /\ i<= dimindex (:M) ==> i-1 < dimindex (:M)/\ i-1 <= dimindex (:M)/\ SUC (i-1)=i`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`v1:real^3`;`u1:real^3`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`u1:real^3`;`row (i-1) (vecmats (l:real^(M,3)finite_product))`] +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.MIXED_PROD_POS_IMP_RANGE_AZIM)[`u1:real^3`;`v1:real^3`;`(row +(i-1) (vecmats (l:real^(M,3)finite_product)))`;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{C,A,B}={C,B,A}`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[Local_lemmas.CROSS_DOT_COPLANAR] +THEN MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`i:num`;`u1:real^3`;`v1:real^3`;`(l:real^(M,3)finite_product)`] +THEN MRESAL_TAC (GEN_ALL EDGE_IN_E_SY)[`i-1:num`;`row (i-1) (vecmats (l:real^(M,3)finite_product))`;`u1:real^3`;`(l:real^(M,3)finite_product)`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= i /\ i<= dimindex (:M) ==> i-1 < dimindex (:M)/\ i-1 <= dimindex (:M)/\ SUC (i-1)=i`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN STRIP_TAC +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`v1:real^3`;`u1:real^3`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`u1:real^3`;`row (i-1) (vecmats (l:real^(M,3)finite_product))`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MRESAL_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`vec 0:real^3`;`u1:real^3`;`v1:real^3`;`row (i-1) (vecmats (l:real^(M,3)finite_product))`][PI_POS_LE;REAL_ARITH`a<=a`]; + +SUBGOAL_THEN`!i j u v w. 1<= i /\ i<= dimindex (:M) +/\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)=u +/\ row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))=v +/\ row j (vecmats l)=w +==> &0<= (u cross v) dot w` ASSUME_TAC; + +REPEAT STRIP_TAC +THEN SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; + +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +REMOVE_THEN "YEU2" (fun th-> MRESA1_TAC th`i:num` THEN MRESA1_TAC th`SUC (i MOD dimindex (:M))` +THEN MRESA1_TAC th`j:num` THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"YEU2")) +THEN +MRESA_TAC (GEN_ALL CROSS_DOT_SEQUENTIALLY)[`(\n. row i ((v:num->real^3^M) n))`;`(\n. row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n))`;`(\n. row j ((v:num->real^3^M) n))`;`u:real^3`;`v':real^3`;`w:real^3`] +THEN SUBGOAL_THEN`eventually + (\x. &0 <= + drop + ((lift o + (\n. (row i (v n) cross + row (SUC (i MOD dimindex (:M))) + (v n)) dot + row j ((v:num->real^3^M) n))) + x)) + sequentially` ASSUME_TAC; + +REWRITE_TAC[EVENTUALLY_SEQUENTIALLY;o_DEF;LIFT_DROP] +THEN EXISTS_TAC`0` +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THY1"(fun th-> MRESA1_TAC th`n:num`) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[convex_local_fan;] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY31") +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th +THEN REWRITE_TAC[local_fan] +THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN SUBGOAL_THEN`row i (v n), + row (SUC (i MOD dimindex (:M))) (v n) IN + F_SY ((v:num->real^3^M) n)`ASSUME_TAC; + +REWRITE_TAC[F_SY;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`row j ((v:num->real^3^M) n) IN V_SY((v:num->real^3^M) n)` ASSUME_TAC; + +REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[]; + +STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th` +row i ((v:num->real^3^M) n), + row (SUC (i MOD dimindex (:M))) (v n)`[SUBSET;IN_ELIM_THM]) +THEN POP_ASSUM(fun th-> MRESAL1_TAC th` +row j ((v:num->real^3^M) n)`[SUBSET;IN_ELIM_THM]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_DETERMINE_AZIM_IN_FA)[`V_SY (((v:num->real^3^M) n))`;`F_SY (((v:num->real^3^M) n))`;`E_SY ( ((v:num->real^3^M) n))`;`row i ((v:num->real^3^M) n), + row (SUC (i MOD dimindex (:M))) (v n)`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.DETERMINE_WEDGE_IN_FAN)[`V_SY (((v:num->real^3^M) n))`;`F_SY (((v:num->real^3^M) n))`;`E_SY ( ((v:num->real^3^M) n))`;`row i ((v:num->real^3^M) n), + row (SUC (i MOD dimindex (:M))) (v n)`] +THEN FIND_ASSUM MP_TAC`1real^3^M) n) + ==> i1 = j1)` ASSUME_TAC; + +REPEAT STRIP_TAC +THEN REMOVE_THEN "THY31"(fun th-> MRESAL_TAC th[`i1:num`;`j1:num`][VECTOR_ARITH`A-A= vec 0`;NORM_0]) +THEN DISJ_CASES_TAC(SET_RULE`~(i1=j1:num)\/ (i1=j1)`); + +MP_TAC(ARITH_RULE`i1 <= dimindex (:M)==> i1 <= dimindex (:M)-1 \/ i1 = dimindex (:M)`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE`j1 <= dimindex (:M)==> j1 <= dimindex (:M)-1 \/ j1 = dimindex (:M)`) +THEN RESA_TAC; + +REMOVE_THEN"THYGIANG"MP_TAC +THEN MRESA_TAC IN_NUMSEG[`0`;`k-1:num`;`i1:num`] +THEN MRESA_TAC IN_NUMSEG[`0`;`k-1:num`;`j1:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`i1:num`;`j1:num`][ARITH_RULE`0<= i:num`]) +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN REMOVE_THEN"THYGIANG"MP_TAC +THEN MRESA_TAC IN_NUMSEG[`0`;`k-1:num`;`i1:num`] +THEN MRESA_TAC IN_NUMSEG[`0`;`k-1:num`;`j1:num`] +THEN MRESA_TAC IN_NUMSEG[`0`;`k-1:num`;`0:num`] +THEN MP_TAC(ARITH_RULE`1<= i1==> ~(i1 = 0)`) +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`i1:num`;`0:num`][ARITH_RULE`0<= i1:num`]) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ dimindex (:M) + dimindex (:M)= dimindex (:M) *2`] +THEN REMOVE_THEN "THYGIANG2" MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`i1:num`;`k:num`;][IN_NUMSEG;ARITH_RULE`0<=a:num/\ A+0=A /\ dimindex (:M) + dimindex (:M)= dimindex (:M) *2`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC MOD_MULT[`k:num`;`1`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +MP_TAC(ARITH_RULE`j1 <= dimindex (:M)==> j1 <= dimindex (:M)-1 \/ j1 = dimindex (:M)`) +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN STRIP_TAC +THEN MRESAL_TAC MOD_MULT[`k:num`;`1`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A`] +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`k:num`;`k:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT[`k:num`;`2`][DIMINDEX_NONZERO;ARITH_RULE`A*1=A/\ dimindex (:M) + dimindex (:M)= dimindex (:M) *2`] +THEN REMOVE_THEN "THYGIANG2" MP_TAC +THEN REWRITE_TAC[constraint_system] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`j1:num`;`k:num`;][ARITH_RULE`0<=a:num/\ A+0=A `]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`j1:num`;`k:num`;][ARITH_RULE`0<=a:num/\ A+0=A /\ dimindex (:M) + dimindex (:M)= dimindex (:M) *2`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= j1==> ~(j1 = 0)`) +THEN RESA_TAC +THEN REMOVE_THEN"THYGIANG"MP_TAC +THEN MRESA_TAC IN_NUMSEG[`0`;`k-1:num`;`j1:num`] +THEN MRESA_TAC IN_NUMSEG[`0`;`k-1:num`;`0:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`j1:num`;`0:num`][ARITH_RULE`0<= i:num`]) +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MESON_TAC[]; + +ASM_MESON_TAC[]; + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY32") +THEN REWRITE_TAC[REAL_ARITH`A<=B <=> A=B\/ A< B`] +THEN STRIP_TAC; + +MRESAL_TAC(GEN_ALL Local_lemmas.AZIM_PI_WEDGE_GE_CROSS_DOT)[`(azim_cycle (EE (row i (v n)) (E_SY (v n))) (vec 0) (row i (v n)) + (row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n)))`;`(row i ((v:num->real^3^M) n))`;`(row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n))`;`vec 0:real^3`][IN_ELIM_THM;REAL_ARITH`A=B\/ A< B<=> A<=B`;VECTOR_ARITH`A- vec 0=A`] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`{row i (v n), + row (SUC (i MOD dimindex (:M))) (v n)} IN + E_SY ((v:num->real^3^M) n)`ASSUME_TAC; + +REWRITE_TAC[E_SY;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; + +MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY ((v:num->real^3^M) n)`;`E_SY ((v:num->real^3^M) n)`;`row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n)`;`row i ((v:num->real^3^M) n)`] +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.AZIM_CYCLE_EQ_SIGMA_FAN)[`vec 0:real^3`;`V_SY ((v:num->real^3^M) n)`;`E_SY ((v:num->real^3^M) n)`;`row i ((v:num->real^3^M) n)`;`row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n)`;] +THEN MRESA_TAC(sigma_fan_in_set_of_edge)[`vec 0:real^3`;`V_SY ((v:num->real^3^M) n)`;`E_SY ((v:num->real^3^M) n)`;`row i ((v:num->real^3^M) n)`;`row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n)`;] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY ((v:num->real^3^M) n)`;`E_SY ((v:num->real^3^M) n)`;`sigma_fan (vec 0) (V_SY (v n)) (E_SY (v n)) (row i (v n)) + (row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n))`;`row i ((v:num->real^3^M) n)`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.WEDGE_GE_EQ_AFF_GE)[`vec 0:real^3`;`row i ((v:num->real^3^M) n)`;`row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n)`;`sigma_fan (vec 0) (V_SY (v n)) (E_SY (v n)) (row i (v n)) + (row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n))`] +THEN MP_TAC(REAL_ARITH`&0<= azim (vec 0) (row i (v n)) (row (SUC (i MOD dimindex (:M))) (v n)) + (sigma_fan (vec 0) (V_SY (v n)) (E_SY (v n)) (row i (v n)) + (row (SUC (i MOD dimindex (:M))) (v n))) +==> azim (vec 0) (row i (v n)) (row (SUC (i MOD dimindex (:M))) (v n)) + (sigma_fan (vec 0) (V_SY (v n)) (E_SY (v n)) (row i (v n)) + (row (SUC (i MOD dimindex (:M))) (v n))) = &0 \/ +&0< azim (vec 0) (row i (v n)) (row (SUC (i MOD dimindex (:M))) (v n)) + (sigma_fan (vec 0) (V_SY (v n)) (E_SY (v n)) (row i (v n)) + (row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n)))`) +THEN REWRITE_TAC[azim] +THEN STRIP_TAC; + +MRESA_TAC Fan.UNIQUE_AZIM_0_POINT_FAN[`vec 0:real^3`;`V_SY ((v:num->real^3^M) n)`;`E_SY ((v:num->real^3^M) n)`;`row i ((v:num->real^3^M) n)`;`row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n)`;`sigma_fan (vec 0) (V_SY (v n)) (E_SY (v n)) (row i (v n)) + (row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n))`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th; SET_RULE`{A,A}={A}`]) +THEN STRIP_TAC +THEN MRESAL_TAC AFF_GE_SUBSET_AFFINE_HULL[`{vec 0,row i ((v:num->real^3^M) n)}`;`{(row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n))}`][GSYM aff] +THEN MP_TAC(SET_RULE`row j (v n) IN + aff_ge {vec 0, row i (v n)} {row (SUC (i MOD dimindex (:M))) (v n)} +/\ aff_ge {vec 0, row i (v n)} {row (SUC (i MOD dimindex (:M))) (v n)} SUBSET + aff + ({vec 0, row i (v n)} UNION {row (SUC (i MOD dimindex (:M))) (v n)}) +==> row j ((v:num->real^3^M) n) IN + aff + ({vec 0, row i (v n)} UNION {row (SUC (i MOD dimindex (:M))) (v n)})`) +THEN ASM_REWRITE_TAC[SET_RULE` {A,B}UNION{C}={A,B,C}`] +THEN MRESAL_TAC Conforming.aff_3_rep_cross_dot[`vec 0:real^3`;`row i ((v:num->real^3^M) n)`;`row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n)`] +[IN_ELIM_THM;VECTOR_ARITH`A- vec 0=A`] +THEN RESA_TAC; + +MP_TAC(REAL_ARITH` +&0real^3^M) n))) < + pi +==> ~(azim (vec 0) (row i (v n)) (row (SUC (i MOD dimindex (:M))) (v n)) + (sigma_fan (vec 0) (V_SY (v n)) (E_SY (v n)) (row i (v n)) + (row (SUC (i MOD dimindex (:M))) (v n))) = + &0 \/ + azim (vec 0) (row i (v n)) (row (SUC (i MOD dimindex (:M))) (v n)) + (sigma_fan (vec 0) (V_SY (v n)) (E_SY (v n)) (row i (v n)) + (row (SUC (i MOD dimindex (:M))) (v n))) = + pi)`) +THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`vec 0:real^3`;`row i ((v:num->real^3^M) n)`;`row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n)`;`sigma_fan (vec 0) (V_SY (v n)) (E_SY (v n)) (row i (v n)) + (row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n))`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN STRIP_TAC +THEN MRESA_TAC( GEN_ALL Nkezbfc_local.inter_aff_ge_3_1_is_aff_ge_2_2)[`vec 0:real^3`;`row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n)`;`row i ((v:num->real^3^M) n)`;`sigma_fan (vec 0) (V_SY (v n)) (E_SY (v n)) (row i (v n)) + (row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n))`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;INTER;IN_ELIM_THM]) +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC Planarity.cross_dot_fully_surrounded_fan[`vec 0:real^3`;`row i ((v:num->real^3^M) n)`;`sigma_fan (vec 0) (V_SY (v n)) (E_SY (v n)) (row i (v n)) + (row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n))`;`row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n)`][VECTOR_ARITH`A- vec 0=A`] +THEN MRESAL_TAC Nkezbfc_local.aff_ge_3_1_rep_cross_dot [`vec 0:real^3`;`row i ((v:num->real^3^M) n)`;`row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n)`;`sigma_fan (vec 0) (V_SY (v n)) (E_SY (v n)) (row i (v n)) + (row (SUC (i MOD dimindex (:M))) ((v:num->real^3^M) n))`][VECTOR_ARITH`A- vec 0=A`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN REAL_ARITH_TAC; + +MRESAL_TAC LIM_DROP_LBOUND[`sequentially`;`lift o + (\n. (row i (v n) cross + row (SUC (i MOD dimindex (:M))) (v n))dot + row j ((v:num->real^3^M) n))`;`lift ((u cross v':real^3) dot w)`;`&0`][TRIVIAL_LIMIT_SEQUENTIALLY;LIFT_DROP]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th +THEN REWRITE_TAC[F_SY;IN_ELIM_THM] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_DETERMINE_AZIM_IN_FA)[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`x':real^3#real^3`] +THEN MRESA_TAC(GEN_ALL Local_lemmas.DETERMINE_WEDGE_IN_FAN) +[`V_SY (vecmats (l:real^(M,3)finite_product))`;`F_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`x':real^3#real^3`] +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM] +THEN REWRITE_TAC[REAL_ARITH`A<=B <=> A=B\/ A< B`] +THEN STRIP_TAC; + +DISCH_THEN(LABEL_TAC"THY31") +THEN GEN_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th +THEN REWRITE_TAC[V_SY;IN_ELIM_THM;rows] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN MRESAL_TAC(GEN_ALL Local_lemmas.AZIM_PI_WEDGE_GE_CROSS_DOT)[`(azim_cycle (EE (row i (vecmats (l:real^(M,3)finite_product))) (E_SY (vecmats (l:real^(M,3)finite_product)))) (vec 0) (row i (vecmats l)) + (row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))))`;`(row i (vecmats (l:real^(M,3)finite_product)))`;`(row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`vec 0:real^3`][IN_ELIM_THM;REAL_ARITH`A=B\/ A< B<=> A<=B`;VECTOR_ARITH`A- vec 0=A`] +THEN REMOVE_THEN"THY31"(fun th-> MRESA_TAC th[`i:num`;`i':num`;`(row i (vecmats (l:real^(M,3)finite_product)))`;`(row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(row i' (vecmats (l:real^(M,3)finite_product)))`]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY32") +THEN DISCH_THEN(LABEL_TAC"THY31") +THEN GEN_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th +THEN REWRITE_TAC[V_SY;IN_ELIM_THM;rows] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN SUBGOAL_THEN`{row i (vecmats (l:real^(M,3)finite_product)), + row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))} IN + E_SY (vecmats (l:real^(M,3)finite_product))`ASSUME_TAC; + +REWRITE_TAC[E_SY;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; + +MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`;`row i (vecmats (l:real^(M,3)finite_product))`] +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.AZIM_CYCLE_EQ_SIGMA_FAN)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`row i (vecmats (l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`;] +THEN MRESA_TAC(sigma_fan_in_set_of_edge)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`row i (vecmats (l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`;] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats (l:real^(M,3)finite_product))) (E_SY (vecmats (l:real^(M,3)finite_product))) (row i (vecmats (l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`row i (vecmats(l:real^(M,3)finite_product))`] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN REMOVE_THEN "THY32" MP_TAC +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.WEDGE_GE_EQ_AFF_GE)[`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`] +THEN MP_TAC(REAL_ARITH`&0<= azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))) +==> azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))) = &0 \/ +&0< azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))))`) +THEN REWRITE_TAC[azim] +THEN STRIP_TAC; + +MRESA_TAC Fan.UNIQUE_AZIM_0_POINT_FAN[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`] +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.FAN_IMP_EE_EQ_SET_OF_EDGE)[`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_CARD_EE_V_1)[`F_SY (vecmats(l:real^(M,3)finite_product))`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`row i (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`] +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`set_of_edge (row i (vecmats l)) (V_SY (vecmats l)) (E_SY (vecmats l)) ={row (SUC (i MOD dimindex (:M))) (vecmats l)} +\/ ~(set_of_edge (row i (vecmats l)) (V_SY (vecmats l)) (E_SY (vecmats l)) ={(row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))})`); + +ASM_REWRITE_TAC[] +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; IN_INSERT; NOT_IN_EMPTY] +THEN ARITH_TAC; + +MRESA_TAC SIGMA_FAN[`vec 0:real^3`;`V_SY (vecmats(l:real^(M,3)finite_product))`;`E_SY (vecmats(l:real^(M,3)finite_product))`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A=B<=>B=A`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]); + +MP_TAC(REAL_ARITH` +&0 ~(azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))) = + &0 \/ + azim (vec 0) (row i (vecmats(l:real^(M,3)finite_product))) (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))) + (sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))) = + pi)`) +THEN RESA_TAC +THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN STRIP_TAC +THEN MRESA_TAC( GEN_ALL Nkezbfc_local.inter_aff_ge_3_1_is_aff_ge_2_2)[`vec 0:real^3`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`row i (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;INTER;IN_ELIM_THM]) +THEN STRIP_TAC; + +MRESAL_TAC Planarity.cross_dot_fully_surrounded_fan[`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`][VECTOR_ARITH`A- vec 0=A`] +THEN MRESAL_TAC Nkezbfc_local.aff_ge_3_1_rep_cross_dot [`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`][VECTOR_ARITH`A- vec 0=A`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN REMOVE_THEN"THY31"(fun th-> MRESA_TAC th[`i:num`;`i':num`;`(row i (vecmats (l:real^(M,3)finite_product)))`;`(row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(row i' (vecmats (l:real^(M,3)finite_product)))`]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +MRESAL_TAC Planarity.cross_dot_fully_surrounded_fan[`vec 0:real^3`;`row i (vecmats(l:real^(M,3)finite_product))`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`][VECTOR_ARITH`A- vec 0=A`] +THEN MRESAL_TAC Nkezbfc_local.aff_ge_3_1_rep_cross_dot [`vec 0:real^3`;`sigma_fan (vec 0) (V_SY (vecmats(l:real^(M,3)finite_product))) (E_SY (vecmats(l:real^(M,3)finite_product))) (row i (vecmats(l:real^(M,3)finite_product))) + (row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product)))`;`row i (vecmats(l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats(l:real^(M,3)finite_product))`;][VECTOR_ARITH`A- vec 0=A`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN FIND_ASSUM MP_TAC`1 i=1 \/ 1<= i-1`) +THEN RESA_TAC; + +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN MRESAL_TAC MOD_MULT[`dimindex (:M)`;`1`][ARITH_RULE`k*1=k`;ARITH_RULE`SUC 0=1`;DIMINDEX_NONZERO] +THEN MRESA_TAC MOD_LT[`1:num`;`dimindex (:M)`] +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th) THEN ASSUME_TAC th) +THEN MRESAL_TAC(GEN_ALL AZIM_CYCLE_EQ1)[`k:num`;`row 1 (vecmats (l:real^(M,3)finite_product))`;`row (SUC 1) (vecmats (l:real^(M,3)finite_product))`;`(row +(dimindex (:M)) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN REMOVE_THEN"THY31"(fun th-> MRESAL_TAC th[`k:num`;`i':num`;`row (dimindex (:M)) (vecmats(l:real^(M,3)finite_product))`;`(row 1 (vecmats (l:real^(M,3)finite_product)))`;`(row i' (vecmats (l:real^(M,3)finite_product)))`][ARITH_RULE`dimindex (:M) <= dimindex (:M) /\ SUC 0=1`]) +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +MP_TAC(ARITH_RULE`1<= i /\ i<= dimindex (:M) ==> i-1 < dimindex (:M)/\ i-1 <= dimindex (:M)`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_LT[`i-1:num`;`dimindex (:M):num`][ARITH_RULE`0<1`] +THEN +MRESAL_TAC(GEN_ALL AZIM_CYCLE_EQ1)[`i-1:num`;`(row i (vecmats (l:real^(M,3)finite_product)))`;`(row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(row +(i-1) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= i /\ i<= dimindex (:M) ==> i-1 < dimindex (:M)/\ i-1 <= dimindex (:M)/\ SUC (i-1)=i`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] +THEN REMOVE_THEN"THY31"(fun th-> MRESA_TAC th[`i-1:num`;`i':num`;`row (i - 1) (vecmats(l:real^(M,3)finite_product))`;`(row i (vecmats (l:real^(M,3)finite_product)))`;`(row i' (vecmats (l:real^(M,3)finite_product)))`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= i /\ i<= dimindex (:M) ==> i-1 < dimindex (:M)/\ i-1 <= dimindex (:M)/\ SUC (i-1)=i`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REAL_ARITH_TAC +]);; + + + + +let BOUNDED_SY=prove(` +stable_system k d (0..k-1) a b J (\i. ((1+i):num MOD k)) /\k= dimindex(:M) +/\ 1< k /\ 2 +bounded {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY a b v /\ CONDITION2_SY v }`, +REPEAT STRIP_TAC +THEN MATCH_MP_TAC BOUNDED_SUBSET +THEN EXISTS_TAC`{matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) }` +THEN MP_TAC COMPACT_BALL_ANNULUS_MATVEC +THEN SIMP_TAC[COMPACT_EQ_BOUNDED_CLOSED] +THEN RESA_TAC +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM] +THEN SET_TAC[]);; + + +let WJSCPRO= prove (` +stable_system k (d:real) (0..k-1) a b J (\i. ((1+i):num MOD k)) /\k= dimindex(:M) +/\ 2 +compact {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY a b v /\ CONDITION2_SY v }`, +SIMP_TAC[COMPACT_EQ_BOUNDED_CLOSED; BOUNDED_SY; CLOSED_SY;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`2 1bool)->bool`;`k:num`;`a:num#num->real`;`b:num#num->real`;]; +MRESA_TAC (GEN_ALL CLOSED_SY)[`d:real`;`J:(num->bool)->bool`;`k:num`;`a:num#num->real`;`b:num#num->real`;]]);; + + + + + + + + + +end;; + + diff --git a/text_formalization/local/WKEIDFT.hl b/text_formalization/local/WKEIDFT.hl new file mode 100644 index 0000000..b48c5aa --- /dev/null +++ b/text_formalization/local/WKEIDFT.hl @@ -0,0 +1,834 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Wkeidft = struct + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +open Yxionxl2;; +open Eyypqdw;; +open Ocbicby;; +open Imjxphr;; + +open Nuxcoea;; +open Fektyiy;; + + + +let SUR_MOD_FUN=prove(`~(k=0)==> ?i. (i+p) MOD k = p' MOD k`, +STRIP_TAC +THEN MP_TAC(ARITH_RULE`p MOD k<= p' MOD k\/ p' MOD k< p MOD k`) +THEN RESA_TAC +THENL[ +EXISTS_TAC`p' MOD k- p MOD k` +THEN MRESA_TAC DIVISION[`p'`;`k`] +THEN MP_TAC(ARITH_RULE`p' MOD k< k /\ p MOD k<= p' MOD k ==> p' MOD k - p MOD k < k /\ p' MOD k - p MOD k + p MOD k= p' MOD k`) +THEN RESA_TAC +THEN MRESAS_TAC MOD_LT[`p' MOD k- p MOD k`;`k`][DIVISION] +THEN MRESAS_TAC MOD_ADD_MOD[`p' MOD k- p MOD k`;`p`;`k`][DIVISION;MOD_REFL] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]); + +EXISTS_TAC`p' MOD k +k - p MOD k` +THEN MRESA_TAC DIVISION[`p`;`k`] +THEN MP_TAC(ARITH_RULE`p MOD k< k /\ p' MOD k< p MOD k ==> p' MOD k +k - p MOD k < k /\ (p' MOD k + k - p MOD k) + p MOD k=1*k+ p' MOD k`) +THEN RESA_TAC +THEN MRESAS_TAC MOD_LT[`p' MOD k+k- p MOD k`;`k`][DIVISION] +THEN MRESAS_TAC MOD_ADD_MOD[`p' MOD k+k- p MOD k`;`p`;`k`][DIVISION;MOD_REFL;MOD_MULT_ADD] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])]);; + +let TRANS_DIAG=prove(`~(k=0)/\ (i+p) MOD k = p' MOD k /\ p' + q = p + q' +==> (i+q) MOD k= q' MOD k `, +STRIP_TAC +THEN MATCH_MP_TAC Hdplygy.MOD_EQ_MOD +THEN EXISTS_TAC`p:num` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[ARITH_RULE`p + i + q= (i +p)+ q:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i+p:num`;`q`;`k`] +THEN POP_ASSUM(fun th-> ASM_SIMP_TAC[SYM th;MOD_ADD_MOD]));; + + +(*************) + + +(*******************) + + +let scs_components = prove_by_refinement( + `!s. dest_scs_v39 s = (scs_k_v39 s,scs_d_v39 s,scs_a_v39 +s,scs_am_v39 s ,scs_bm_v39 s,scs_b_v39 s,scs_J_v39 s, + scs_lo_v39 s,scs_hi_v39 s,scs_str_v39 s)`, + (* {{{ proof *) + [ + REWRITE_TAC[Wrgcvdr_cizmrrh.PAIR_EQ2;scs_k_v39;scs_d_v39;scs_a_v39;]; + REWRITE_TAC[scs_am_v39;scs_bm_v39;scs_b_v39;]; + REWRITE_TAC[scs_J_v39;scs_hi_v39;scs_lo_v39;]; + REWRITE_TAC[scs_str_v39]; + +BY(REWRITE_TAC[Misc_defs_and_lemmas.part1;Misc_defs_and_lemmas.part2;Misc_defs_and_lemmas.part3;Misc_defs_and_lemmas.part4; +Misc_defs_and_lemmas.part5;Misc_defs_and_lemmas.part6;Misc_defs_and_lemmas.part7;Misc_defs_and_lemmas.drop0;Misc_defs_and_lemmas.drop3;Misc_defs_and_lemmas.drop1;Misc_defs_and_lemmas.part0;Misc_defs_and_lemmas.part8;Misc_defs_and_lemmas.drop2]) + ]);; + (* }}} *) + +let scs_inj = prove_by_refinement( + `!s s'. scs_basic_v39 s /\ scs_basic_v39 s' /\ + scs_d_v39 s = scs_d_v39 s' /\ + scs_k_v39 s = scs_k_v39 s' /\ + (scs_a_v39 s = scs_a_v39 s') /\ + (scs_b_v39 s = scs_b_v39 s') + ==> (s = s')`, + + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `scs_basic_v39` MP_TAC); + REWRITE_TAC[scs_basic;unadorned_v39]; + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + REWRITE_TAC[SET_RULE `{} = a <=> a = {}`]; + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[GSYM scs_v39]; + AP_TERM_TAC; + ASM_REWRITE_TAC[scs_components]; + TYPIFY `scs_J_v39 s = scs_J_v39 s'` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_REWRITE_TAC[FUN_EQ_THM]); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + + + +let DIAG_PSORT1=prove_by_refinement(` ~(k=0) /\ (i+p) MOD k = p' MOD k /\ +p' + q = p + q' /\ ~(k=0) /\ (psort k (i',j) = psort k (p,q)) +==> (psort k (i+i',i+j) = psort k (p',q'))`, + +[ +REWRITE_TAC[psort;LET_DEF;LET_END_DEF;COND_EXPAND +] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC TRANS_DIAG +THEN RESA_TAC +THEN MP_TAC(SET_RULE`i' MOD k <= j MOD k \/ ~(i' MOD k <= j MOD k)`) +THEN RESA_TAC; + +MP_TAC(SET_RULE`p MOD k <= q MOD k \/ ~(p MOD k <= q MOD k)`) +THEN RESA_TAC; + +REWRITE_TAC[PAIR_EQ] +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`i'`;`p`;`i`] +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`j`;`q`;`i`]; + +REWRITE_TAC[PAIR_EQ] +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`i'`;`q`;`i`] +THEN MRESAS_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`j`;`p`;`i`][] +THEN MP_TAC(ARITH_RULE`(~(p' MOD k<= q' MOD k))\/ (p' MOD k < q' MOD k ) \/ (p' MOD k = q' MOD k )`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE` ~(p' MOD k<= q' MOD k)==> q' MOD k <= p' MOD k`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE` (p' MOD k< q' MOD k)==> ~(q' MOD k <= p' MOD k)/\ (p' MOD k<= q' MOD k)`) +THEN RESA_TAC; + +MP_TAC(SET_RULE`p MOD k <= q MOD k \/ ~(p MOD k <= q MOD k)`) +THEN RESA_TAC; + +REWRITE_TAC[PAIR_EQ] +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`i'`;`q`;`i`] +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`j`;`p`;`i`]; + + +MP_TAC(ARITH_RULE`(~(p' MOD k<= q' MOD k))\/ (p' MOD k < q' MOD k ) \/ (p' MOD k = q' MOD k )`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE` ~(p' MOD k<= q' MOD k)==> q' MOD k <= p' MOD k`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE` (p' MOD k< q' MOD k)==> ~(q' MOD k <= p' MOD k)/\ (p' MOD k<= q' MOD k)`) +THEN RESA_TAC; + +REWRITE_TAC[PAIR_EQ] +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`i'`;`p`;`i`] +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`j`;`q`;`i`]]);; + + + + + +let DIAG_PSORT2=prove_by_refinement(` ~(k=0) /\ (i+p) MOD k = p' MOD k /\ +p' + q = p + q' /\ ~(k=0) /\ (psort k (i+i',i+j) = psort k (p',q')) +==> +(psort k (i',j) = psort k (p,q))`, +[ +REWRITE_TAC[psort;LET_DEF;LET_END_DEF;COND_EXPAND +] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC TRANS_DIAG +THEN RESA_TAC +THEN MP_TAC(SET_RULE`(i+i') MOD k <= (i+j) MOD k \/ ~((i+i') MOD k <= (i+j) MOD k)`) +THEN RESA_TAC; + +MP_TAC(SET_RULE`p' MOD k <= q' MOD k \/ ~(p' MOD k <= q' MOD k)`) +THEN RESA_TAC; + +REWRITE_TAC[PAIR_EQ] +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`i'`;`p`;`i`] +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`j`;`q`;`i`]; + +REWRITE_TAC[PAIR_EQ] +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`i'`;`q`;`i`] +THEN MRESAS_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`j`;`p`;`i`][]; + +MP_TAC(ARITH_RULE`(~(p MOD k<= q MOD k))\/ (p MOD k < q MOD k ) \/ (p MOD k = q MOD k )`) +THEN RESA_TAC; + + +MP_TAC(ARITH_RULE` ~(p MOD k<= q MOD k)==> q MOD k <= p MOD k`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE` (p MOD k< q MOD k)==> ~(q MOD k <= p MOD k)/\ (p MOD k<= q MOD k)`) +THEN RESA_TAC; + +MP_TAC(SET_RULE`p' MOD k <= q' MOD k \/ ~(p' MOD k <= q' MOD k)`) +THEN RESA_TAC; + +REWRITE_TAC[PAIR_EQ] +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`i'`;`q`;`i`] +THEN MRESAS_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`j`;`p`;`i`][]; + +MP_TAC(ARITH_RULE`(~(p MOD k<= q MOD k))\/ (p MOD k < q MOD k ) \/ (p MOD k = q MOD k )`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE` ~(p MOD k<= q MOD k)==> q MOD k <= p MOD k`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE` (p MOD k< q MOD k)==> ~(q MOD k <= p MOD k)/\ (p MOD k<= q MOD k)`) +THEN RESA_TAC; + +REWRITE_TAC[PAIR_EQ] +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`i'`;`p`;`i`] +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`j`;`q`;`i`]]);; + + + + +let DIAG_PSORT=prove( + ` ~(k=0) /\ (i+p) MOD k = p' MOD k /\ +p' + q = p + q' /\ ~(k=0) +==> +((psort k (i+i',i+j) = psort k (p',q')) +<=> +(psort k (i',j) = psort k (p,q)))`, +STRIP_TAC +THEN EQ_TAC +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC DIAG_PSORT2 +THEN RESA_TAC; +MATCH_MP_TAC DIAG_PSORT1 +THEN RESA_TAC]);; + +let TRANS_DIAG=prove(` +~(k=0) +==> (scs_diag k i' j<=> scs_diag k (i+i') (i+j)) `, +SIMP_TAC[scs_diag;ARITH_RULE`SUC (i + i') = i + (i' + 1)/\ SUC i= i+1`;Ocbicby.MOD_EQ_MOD_SHIFT]);; + + +let A_EQ_PSORT=prove(` is_scs_v39 s /\ psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (p,q) +==> scs_a_v39 s i j= scs_a_v39 s p q`, +REWRITE_TAC[scs_prop_equ_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF; BBs_v39; FUN_EQ_THM;psort] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN MP_TAC(ARITH_RULE`i MOD k <= j MOD k \/ ~(i MOD k <= j MOD k)`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`p MOD k <= q MOD k \/ ~(p MOD k <= q MOD k)`) +THEN RESA_TAC +THEN +REWRITE_TAC[PAIR_EQ] +THEN STRIP_TAC +THEN MRESA_TAC CHANGE_A_SCS_MOD[`i`;`j`;`s`;`p`;`q`] +THEN MRESA_TAC CHANGE_A_SCS_MOD[`j`;`i`;`s`;`p`;`q`] +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC);; + + +let B_EQ_PSORT=prove(` is_scs_v39 s /\ psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (p,q) +==> scs_b_v39 s i j= scs_b_v39 s p q`, +REWRITE_TAC[scs_prop_equ_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF; BBs_v39; FUN_EQ_THM;psort] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN MP_TAC(ARITH_RULE`i MOD k <= j MOD k \/ ~(i MOD k <= j MOD k)`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`p MOD k <= q MOD k \/ ~(p MOD k <= q MOD k)`) +THEN RESA_TAC +THEN +REWRITE_TAC[PAIR_EQ] +THEN STRIP_TAC +THEN MRESA_TAC CHANGE_B_SCS_MOD[`i`;`j`;`s`;`p`;`q`] +THEN MRESA_TAC CHANGE_B_SCS_MOD[`j`;`i`;`s`;`p`;`q`] +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC);; + +let PROPERTY_OF_K_SCS=prove(`is_scs_v39 s==> ~(scs_k_v39 s= 0)/\ 0< scs_k_v39 s/\ 1< scs_k_v39 s/\ 2< scs_k_v39 s`, +STRIP_TAC +THEN MP_TAC Axjrpnc.is_scs_k_le_3 +THEN RESA_TAC +THEN DICH_TAC 0 +THEN ARITH_TAC);; + +let WKEIDFT_A_concl = `!s s' a b a' b' p q p' q' i. + (let k = scs_k_v39 s in + (is_scs_v39 s /\ is_scs_v39 s' /\ scs_basic_v39 s /\ scs_basic_v39 s' /\ + (!i. scs_a_v39 s i (i + 1) = a) /\ + (!i. scs_b_v39 s i (i + 1) = b) /\ + (!i. scs_a_v39 s' i (i + 1) = a) /\ + (!i. scs_b_v39 s' i (i + 1) = b) /\ + scs_k_v39 s' = k /\ + p' + q = p + q' /\ + scs_d_v39 s = scs_d_v39 s' /\ + (!i j. scs_diag k i j /\ ~(psort k (i,j) = psort k (p,q)) ==> scs_a_v39 s i j = a') /\ + (!i j. scs_diag k i j /\ ~(psort k (i,j) = psort k (p,q)) ==> scs_b_v39 s i j = b') /\ + (!i j. scs_diag k i j /\ ~(psort k (i,j) = psort k (p',q')) ==> scs_a_v39 s' i j = a') /\ + (!i j. scs_diag k i j /\ ~(psort k (i,j) = psort k (p',q')) ==> scs_b_v39 s' i j = b') /\ + scs_a_v39 s p q = scs_a_v39 s' p' q' /\ scs_b_v39 s p q = scs_b_v39 s' p' q' /\ (i+p) MOD k = p' MOD k ==> +(\j j'. scs_a_v39 s' (i + j) (i + j')) = scs_a_v39 s))`;; + + + +let WKEIDFT_A=prove_by_refinement( WKEIDFT_A_concl, +[ +REWRITE_TAC[scs_prop_equ_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39; BBs_v39; FUN_EQ_THM] +THEN REPEAT RESA_TAC +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN MP_TAC(SET_RULE`scs_diag k x x'\/ ~(scs_diag k x x')`) +THEN RESA_TAC; + +MP_TAC(SET_RULE`(psort k (x,x') = psort k (p,q))\/ ~(psort k (x,x') = psort k (p,q))`) +THEN RESA_TAC; + +MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESAS_TAC DIAG_PSORT[`i`;`p'`;`q'`;`x`;`x'`;`k`;`p`;`q`][PROPERTY_OF_K_SCS] +THEN MRESA_TAC A_EQ_PSORT[`x`;`x'`;`s`;`p`;`q`] +THEN MRESA_TAC A_EQ_PSORT[`i+x:num`;`i+x':num`;`s'`;`p'`;`q'`]; + +MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESAS_TAC DIAG_PSORT[`i`;`p'`;`q'`;`x`;`x'`;`k`;`p`;`q`][PROPERTY_OF_K_SCS] +THEN MRESA_TAC TRANS_DIAG[`k`;`x`;`i`;`x'`] +THEN MATCH_DICH_TAC (26-13) +THEN ASM_REWRITE_TAC[]; + + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[scs_diag;DE_MORGAN_THM] +THEN STRIP_TAC; + +MRESA_TAC CHANGE_A_SCS_MOD[`x`;`x'`;`s`;`x`;`x`] +THEN MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`x`;`x'`;`i`] +THEN MRESA_TAC CHANGE_A_SCS_MOD[`i+x:num`;`i+x':num`;`s'`;`i+x:num`;`i+x:num`] +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC; + +MRESA_TAC CHANGE_A_SCS_MOD[`x`;`x'`;`s`;`x`;`SUC x`] +THEN MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`SUC x`;`x'`;`i`] +THEN MRESA_TAC CHANGE_A_SCS_MOD[`i+x:num`;`i+x':num`;`s'`;`i+x:num`;`i+SUC x:num`] +THEN REWRITE_TAC[ADD1] +THEN THAYTHEL_TAC(26-6)[`i+x:num`][ARITH_RULE`(i + x) + 1= i + x + 1`] +THEN THAYTHE_TAC(26-4)[`x`]; + + +MRESA_TAC CHANGE_A_SCS_MOD[`x`;`x'`;`s`;`SUC x'`;`x'`] +THEN MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`x`;`SUC x'`;`i`] +THEN MRESA_TAC CHANGE_A_SCS_MOD[`i+x:num`;`i+x':num`;`s'`;`i+SUC x':num`;`i+x':num`] +THEN REWRITE_TAC[ADD1] +THEN THAYTHEL_TAC(26-6)[`i+x':num`][ARITH_RULE`(i + x) + 1= i + x + 1`] +THEN THAYTHE_TAC(26-4)[`x'`] +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC]);; + + + + + +let WKEIDFT_B_concl = `!s s' a b a' b' p q p' q' a1 i. + (let k = scs_k_v39 s in + (is_scs_v39 s /\ is_scs_v39 s' /\ scs_basic_v39 s /\ scs_basic_v39 s' /\ + (!i. scs_b_v39 s i i = a1) /\ + (!i. scs_b_v39 s' i i = a1) /\ + (!i. scs_a_v39 s i (i + 1) = a) /\ + (!i. scs_b_v39 s i (i + 1) = b) /\ + (!i. scs_a_v39 s' i (i + 1) = a) /\ + (!i. scs_b_v39 s' i (i + 1) = b) /\ + scs_k_v39 s' = k /\ + p' + q = p + q' /\ + scs_d_v39 s = scs_d_v39 s' /\ + (!i j. scs_diag k i j /\ ~(psort k (i,j) = psort k (p,q)) ==> scs_a_v39 s i j = a') /\ + (!i j. scs_diag k i j /\ ~(psort k (i,j) = psort k (p,q)) ==> scs_b_v39 s i j = b') /\ + (!i j. scs_diag k i j /\ ~(psort k (i,j) = psort k (p',q')) ==> scs_a_v39 s' i j = a') /\ + (!i j. scs_diag k i j /\ ~(psort k (i,j) = psort k (p',q')) ==> scs_b_v39 s' i j = b') /\ + scs_a_v39 s p q = scs_a_v39 s' p' q' /\ scs_b_v39 s p q = scs_b_v39 s' p' q' /\ (i+p) MOD k = p' MOD k ==> +(\j j'. scs_b_v39 s' (i + j) (i + j')) = scs_b_v39 s))`;; + + + +let WKEIDFT_B=prove_by_refinement( WKEIDFT_B_concl, +[ +REWRITE_TAC[scs_prop_equ_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39; BBs_v39; FUN_EQ_THM] +THEN REPEAT RESA_TAC +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN MP_TAC(SET_RULE`scs_diag k x x'\/ ~(scs_diag k x x')`) +THEN RESA_TAC; + +MP_TAC(SET_RULE`(psort k (x,x') = psort k (p,q))\/ ~(psort k (x,x') = psort k (p,q))`) +THEN RESA_TAC; + +MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESAS_TAC DIAG_PSORT[`i`;`p'`;`q'`;`x`;`x'`;`k`;`p`;`q`][PROPERTY_OF_K_SCS] +THEN MRESA_TAC B_EQ_PSORT[`x`;`x'`;`s`;`p`;`q`] +THEN MRESA_TAC B_EQ_PSORT[`i+x:num`;`i+x':num`;`s'`;`p'`;`q'`]; + +MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESAS_TAC DIAG_PSORT[`i`;`p'`;`q'`;`x`;`x'`;`k`;`p`;`q`][PROPERTY_OF_K_SCS] +THEN MRESA_TAC TRANS_DIAG[`k`;`x`;`i`;`x'`] +THEN MATCH_DICH_TAC (26-14) +THEN ASM_REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[scs_diag;DE_MORGAN_THM] +THEN STRIP_TAC; + +MRESA_TAC CHANGE_B_SCS_MOD[`x`;`x'`;`s`;`x`;`x`] +THEN MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`x`;`x'`;`i`] +THEN MRESA_TAC CHANGE_B_SCS_MOD[`i+x:num`;`i+x':num`;`s'`;`i+x:num`;`i+x:num`] +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC; + +MRESA_TAC CHANGE_B_SCS_MOD[`x`;`x'`;`s`;`x`;`SUC x`] +THEN MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`SUC x`;`x'`;`i`] +THEN MRESA_TAC CHANGE_B_SCS_MOD[`i+x:num`;`i+x':num`;`s'`;`i+x:num`;`i+SUC x:num`] +THEN REWRITE_TAC[ADD1] +THEN THAYTHEL_TAC(26-7)[`i+x:num`][ARITH_RULE`(i + x) + 1= i + x + 1`] +THEN THAYTHE_TAC(26-5)[`x`]; + +MRESA_TAC CHANGE_B_SCS_MOD[`x`;`x'`;`s`;`SUC x'`;`x'`] +THEN MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`x`;`SUC x'`;`i`] +THEN MRESA_TAC CHANGE_B_SCS_MOD[`i+x:num`;`i+x':num`;`s'`;`i+SUC x':num`;`i+x':num`] +THEN REWRITE_TAC[ADD1] +THEN THAYTHEL_TAC(26-7)[`i+x':num`][ARITH_RULE`(i + x) + 1= i + x + 1`] +THEN THAYTHE_TAC(26-5)[`x'`] +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC]);; + + + + + +let WKEIDFT_EQU_concl = ` + (let k = scs_k_v39 s in + (is_scs_v39 s /\ is_scs_v39 s' /\ scs_basic_v39 s /\ scs_basic_v39 s' /\ + (!i. scs_b_v39 s i i = a1) /\ + (!i. scs_b_v39 s' i i = a1) /\ + (!i. scs_a_v39 s i (i + 1) = a) /\ + (!i. scs_b_v39 s i (i + 1) = b) /\ + (!i. scs_a_v39 s' i (i + 1) = a) /\ + (!i. scs_b_v39 s' i (i + 1) = b) /\ + scs_k_v39 s' = k /\ + p' + q = p + q' /\ + scs_d_v39 s = scs_d_v39 s' /\ + (!i j. scs_diag k i j /\ ~(psort k (i,j) = psort k (p,q)) ==> scs_a_v39 s i j = a') /\ + (!i j. scs_diag k i j /\ ~(psort k (i,j) = psort k (p,q)) ==> scs_b_v39 s i j = b') /\ + (!i j. scs_diag k i j /\ ~(psort k (i,j) = psort k (p',q')) ==> scs_a_v39 s' i j = a') /\ + (!i j. scs_diag k i j /\ ~(psort k (i,j) = psort k (p',q')) ==> scs_b_v39 s' i j = b') /\ + scs_a_v39 s p q = scs_a_v39 s' p' q' /\ scs_b_v39 s p q = scs_b_v39 s' p' q' ==> + ?i. s'= scs_prop_equ_v39 s i))`;; + + + + + +let WKEIDFT_EQU=prove( WKEIDFT_EQU_concl, +REWRITE_TAC[scs_prop_equ_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39; scs_basic] +THEN REPEAT RESA_TAC +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESA_TAC SUR_MOD_FUN[`p':num`;`p:num`;`k:num`] +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`i:num` +THEN MRESAL_TAC WKEIDFT_B[`s':scs_v39`;`s:scs_v39`;`a:real`;`b:real`;`a':real`;`b':real`;`p':num`;`q':num`;`p:num`;`q:num`;`a1:real`;`i`][LET_DEF;LET_END_DEF;scs_basic;unadorned_v39] +THEN MRESAL_TAC WKEIDFT_A[`s':scs_v39`;`s:scs_v39`;`a:real`;`b:real`;`a':real`;`b':real`;`p':num`;`q':num`;`p:num`;`q:num`;`i`][LET_DEF;LET_END_DEF;scs_basic;unadorned_v39] +THEN MATCH_MP_TAC scs_inj +THEN ASM_REWRITE_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;scs_basic;unadorned_v39] +THEN SET_TAC[]);; + +let WKEIDFT_concl = `!s s' a b a' b' p q p' q'. + (let k = scs_k_v39 s in + (is_scs_v39 s /\ is_scs_v39 s' /\ scs_basic_v39 s /\ scs_basic_v39 s' /\ + (!i. scs_b_v39 s i i = a1) /\ + (!i. scs_b_v39 s' i i = a1) /\ + (!i. scs_a_v39 s i (i + 1) = a) /\ + (!i. scs_b_v39 s i (i + 1) = b) /\ + (!i. scs_a_v39 s' i (i + 1) = a) /\ + (!i. scs_b_v39 s' i (i + 1) = b) /\ + scs_k_v39 s' = k /\ + p' + q = p + q' /\ + scs_d_v39 s = scs_d_v39 s' /\ + (!i j. scs_diag k i j /\ ~(psort k (i,j) = psort k (p,q)) ==> scs_a_v39 s i j = a') /\ + (!i j. scs_diag k i j /\ ~(psort k (i,j) = psort k (p,q)) ==> scs_b_v39 s i j = b') /\ + (!i j. scs_diag k i j /\ ~(psort k (i,j) = psort k (p',q')) ==> scs_a_v39 s' i j = a') /\ + (!i j. scs_diag k i j /\ ~(psort k (i,j) = psort k (p',q')) ==> scs_b_v39 s' i j = b') /\ + scs_a_v39 s p q = scs_a_v39 s' p' q' /\ scs_b_v39 s p q = scs_b_v39 s' p' q' ==> + scs_arrow_v39 {s} {s'}))`;; + + + +let WKEIDFT_PRIME= prove(WKEIDFT_concl, +REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN REPEAT RESA_TAC +THEN MP_TAC WKEIDFT_EQU +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN RESA_TAC +THEN MATCH_MP_TAC YXIONXL3 +THEN ASM_REWRITE_TAC[]);; + + + +(********************************) + +let WKEIDFT_B_v2_concl = `!s a b a' b' p q p' q'. + (let k = scs_k_v39 s in + (is_scs_v39 s /\ scs_basic_v39 s /\ + (!i. scs_a_v39 s i (i + 1) = a) /\ + (!i. scs_b_v39 s i (i + 1) = b) /\ + p' + q = p + q' /\ + scs_diag k p q/\ + scs_diag k p' q'/\ + (!i j. scs_diag k i j ==> scs_a_v39 s i j <= cstab) /\ + (!i j. scs_diag k i j ==> scs_a_v39 s i j = a') /\ + (!i j. scs_diag k i j ==> scs_b_v39 s i j = b')/\ + (!i. scs_b_v39 s i i = b1) /\ + (i+p) MOD k = p' MOD k ==> +(\j j'. scs_b_v39 (scs_stab_diag_v39 s p' q') (i + j) (i + j')) = scs_b_v39 (scs_stab_diag_v39 s p q)))`;; + + +let WKEIDFT_B_V2=prove_by_refinement( WKEIDFT_B_v2_concl, +[ +REWRITE_TAC[scs_prop_equ_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39; BBs_v39; FUN_EQ_THM;scs_stab_diag_v39;mk_unadorned_v39;scs_v39_explicit] +THEN REPEAT RESA_TAC +THEN ABBREV_TAC`k= scs_k_v39 s`; + +MP_TAC(SET_RULE`scs_diag k x x'\/ ~(scs_diag k x x')`) +THEN RESA_TAC; + +MP_TAC(SET_RULE`(psort k (x,x') = psort k (p,q))\/ ~(psort k (x,x') = psort k (p,q))`) +THEN RESA_TAC; + +MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESAS_TAC DIAG_PSORT[`i`;`p'`;`q'`;`x`;`x'`;`k`;`p`;`q`][PROPERTY_OF_K_SCS] +THEN MRESA_TAC B_EQ_PSORT[`x`;`x'`;`s`;`p`;`q`] +THEN MRESA_TAC B_EQ_PSORT[`i+x:num`;`i+x':num`;`s'`;`p'`;`q'`]; + +MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESAS_TAC DIAG_PSORT[`i`;`p'`;`q'`;`x`;`x'`;`k`;`p`;`q`][PROPERTY_OF_K_SCS] +THEN MRESA_TAC TRANS_DIAG[`k`;`x`;`i`;`x'`] ; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[scs_diag;DE_MORGAN_THM] +THEN STRIP_TAC; + +MP_TAC(SET_RULE`(psort k (x,x') = psort k (p,q))\/ ~(psort k (x,x') = psort k (p,q))`) +THEN RESA_TAC +THEN MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESAS_TAC DIAG_PSORT[`i`;`p'`;`q'`;`x`;`x'`;`k`;`p`;`q`][PROPERTY_OF_K_SCS] +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`x`;`x'`;`i`] +THEN MRESA_TAC CHANGE_B_SCS_MOD[`i+x:num`;`i+x':num`;`s`;`i+x:num`;`i+x:num`] +THEN MRESA_TAC CHANGE_B_SCS_MOD[`x`;`x'`;`s`;`x`;`x`]; + +MP_TAC(SET_RULE`(psort k (x,x') = psort k (p,q))\/ ~(psort k (x,x') = psort k (p,q))`) +THEN RESA_TAC +THEN MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESAS_TAC DIAG_PSORT[`i`;`p'`;`q'`;`x`;`x'`;`k`;`p`;`q`][PROPERTY_OF_K_SCS] +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`SUC x`;`x'`;`i`] +THEN MRESA_TAC CHANGE_B_SCS_MOD[`i+x:num`;`i+x':num`;`s`;`i+x:num`;`i+SUC x:num`] +THEN MRESA_TAC CHANGE_B_SCS_MOD[`x`;`x'`;`s`;`x`;`SUC x`] +THEN ASM_SIMP_TAC[ADD1;ARITH_RULE`i+a+1=(i+a)+1`]; + + +MP_TAC(SET_RULE`(psort k (x,x') = psort k (p,q))\/ ~(psort k (x,x') = psort k (p,q))`) +THEN RESA_TAC +THEN MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESAS_TAC DIAG_PSORT[`i`;`p'`;`q'`;`x`;`x'`;`k`;`p`;`q`][PROPERTY_OF_K_SCS] +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`x`;`SUC x'`;`i`] +THEN MRESA_TAC CHANGE_B_SCS_MOD[`i+x:num`;`i+x':num`;`s`;`i+SUC x':num`;`i+x':num`] +THEN MRESA_TAC CHANGE_B_SCS_MOD[`x`;`x'`;`s`;`SUC x'`;`x'`] +THEN ASM_SIMP_TAC[ADD1;ARITH_RULE`i+a+1=(i+a)+1`] +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC]);; + + + + + + +let WKEIDFT_A_v2_concl = `!s a b a' b' p q p' q'. + (let k = scs_k_v39 s in + (is_scs_v39 s /\ scs_basic_v39 s /\ + (!i. scs_a_v39 s i (i + 1) = a) /\ + (!i. scs_b_v39 s i (i + 1) = b) /\ + p' + q = p + q' /\ + scs_diag k p q/\ + scs_diag k p' q'/\ + (!i j. scs_diag k i j ==> scs_a_v39 s i j <= cstab) /\ + (!i j. scs_diag k i j ==> scs_a_v39 s i j = a') /\ + (!i j. scs_diag k i j ==> scs_b_v39 s i j = b')/\ + (!i. scs_b_v39 s i i = b1) /\ + (i+p) MOD k = p' MOD k ==> +(\j j'. scs_a_v39 (scs_stab_diag_v39 s p' q') (i + j) (i + j')) = scs_a_v39 (scs_stab_diag_v39 s p q)))`;; + + +let WKEIDFT_A_V2=prove_by_refinement( WKEIDFT_A_v2_concl, +[ +REWRITE_TAC[scs_prop_equ_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39; BBs_v39; FUN_EQ_THM;scs_stab_diag_v39;mk_unadorned_v39;scs_v39_explicit] +THEN REPEAT RESA_TAC +THEN ABBREV_TAC`k= scs_k_v39 s`; + +MP_TAC(SET_RULE`scs_diag k x x'\/ ~(scs_diag k x x')`) +THEN RESA_TAC; + +MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESAS_TAC TRANS_DIAG[`k`;`x`;`i`;`x'`][]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[scs_diag;DE_MORGAN_THM] +THEN STRIP_TAC; + +MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`x`;`x'`;`i`] +THEN MRESA_TAC CHANGE_A_SCS_MOD[`i+x:num`;`i+x':num`;`s`;`i+x:num`;`i+x:num`] +THEN MRESA_TAC CHANGE_A_SCS_MOD[`x`;`x'`;`s`;`x`;`x`] +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC; + +MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`SUC x`;`x'`;`i`] +THEN MRESA_TAC CHANGE_A_SCS_MOD[`i+x:num`;`i+x':num`;`s`;`i+x:num`;`i+SUC x:num`] +THEN MRESA_TAC CHANGE_A_SCS_MOD[`x`;`x'`;`s`;`x`;`SUC x`] +THEN ASM_SIMP_TAC[ADD1;ARITH_RULE`i+a+1=(i+a)+1`]; + +MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`x`;`SUC x'`;`i`] +THEN MRESA_TAC CHANGE_A_SCS_MOD[`i+x:num`;`i+x':num`;`s`;`i+SUC x':num`;`i+x':num`] +THEN MRESA_TAC CHANGE_A_SCS_MOD[`x`;`x'`;`s`;`SUC x'`;`x'`] +THEN ASM_SIMP_TAC[ADD1;ARITH_RULE`i+a+1=(i+a)+1`] +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC]);; + + +let SCS_K_D_A_STAB_EQ=prove(`scs_d_v39 (scs_stab_diag_v39 s i j) =scs_d_v39 s +/\ scs_k_v39 (scs_stab_diag_v39 s i j) =scs_k_v39 s +/\(!i' j'. scs_a_v39 (scs_stab_diag_v39 s i j) i' j'= scs_a_v39 s i' j')`, +SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39]);; + + + + +let WKEIDFT_EQU_v2_concl = ` + (let k = scs_k_v39 s in + (is_scs_v39 s /\ scs_basic_v39 s /\ + (!i. scs_a_v39 s i (i + 1) = a) /\ + (!i. scs_b_v39 s i (i + 1) = b) /\ + p' + q = p + q' /\ + scs_diag k p q/\ + scs_diag k p' q'/\ + 3 < k /\ + (!i j. scs_diag k i j ==> scs_a_v39 s i j <= cstab) /\ + (!i j. scs_diag k i j ==> scs_a_v39 s i j = a') /\ + (!i j. scs_diag k i j ==> scs_b_v39 s i j = b')/\ + (!i. scs_b_v39 s i i = b1) ==> +?i. scs_stab_diag_v39 s p' q'= scs_prop_equ_v39 (scs_stab_diag_v39 s p q) i))`;; + + +let WKEIDFT_EQU_V2= prove(WKEIDFT_EQU_v2_concl, +REWRITE_TAC[scs_prop_equ_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39; scs_basic] +THEN REPEAT RESA_TAC +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN MRESA_TAC SUR_MOD_FUN[`p':num`;`p:num`;`k:num`] +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`i:num` +THEN MRESAL_TAC WKEIDFT_B_V2[`b1`;`i`;`s`;`a`;`b`;`a'`;`b'`;`p'`;`q'`;`p`;`q`][LET_DEF;LET_END_DEF;scs_basic;unadorned_v39] +THEN MRESAL_TAC WKEIDFT_A_V2[`b1`;`i`;`s`;`a`;`b`;`a'`;`b'`;`p'`;`q'`;`p`;`q`][LET_DEF;LET_END_DEF;scs_basic;unadorned_v39] +THEN MRESAS_TAC Yrtafyh.YRTAFYH[`s`;`p`;`q`][LET_DEF;LET_END_DEF;scs_basic;unadorned_v39;SCS_K_D_A_STAB_EQ] +THEN DICH_TAC 1 +THEN STRIP_TAC +THEN SYM_ASSUM_TAC +THEN DICH_TAC 1 +THEN STRIP_TAC +THEN SYM_ASSUM_TAC +THEN MATCH_MP_TAC scs_inj +THEN MRESAS_TAC Yrtafyh.YRTAFYH[`s`;`p'`;`q'`][LET_DEF;LET_END_DEF;scs_basic;unadorned_v39;SCS_K_D_A_STAB_EQ] +THEN ASM_SIMP_TAC[scs_v39_explicit;LET_DEF;LET_END_DEF;scs_basic;unadorned_v39] +THEN SET_TAC[]);; + +let WKEIDFT_concl = `!s a b a' b' p q p' q'. + (let k = scs_k_v39 s in + (is_scs_v39 s /\ scs_basic_v39 s /\ + (!i. scs_a_v39 s i (i + 1) = a) /\ + (!i. scs_b_v39 s i (i + 1) = b) /\ + p' + q = p + q' /\ + scs_diag k p q/\ + scs_diag k p' q'/\ + 3 < k /\ + (!i j. scs_diag k i j ==> scs_a_v39 s i j <= cstab) /\ + (!i j. scs_diag k i j ==> scs_a_v39 s i j = a') /\ + (!i j. scs_diag k i j ==> scs_b_v39 s i j = b')/\ + (!i. scs_b_v39 s i i = b1) ==> +scs_arrow_v39 {scs_stab_diag_v39 s p q} {scs_stab_diag_v39 s p' q'}))`;; + + +let WKEIDFT=prove(WKEIDFT_concl, +REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN REPEAT RESA_TAC +THEN MP_TAC WKEIDFT_EQU_V2 +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN RESA_TAC +THEN MATCH_MP_TAC YXIONXL3 +THEN ASM_REWRITE_TAC[] +THEN MRESAS_TAC Yrtafyh.YRTAFYH[`s`;`p`;`q`][LET_DEF;LET_END_DEF;scs_basic;unadorned_v39;SCS_K_D_A_STAB_EQ]);; + + + + + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/WRGCVDR_CIZMRRH.hl b/text_formalization/local/WRGCVDR_CIZMRRH.hl new file mode 100644 index 0000000..f003ad6 --- /dev/null +++ b/text_formalization/local/WRGCVDR_CIZMRRH.hl @@ -0,0 +1,3860 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Definitions: *) +(* Chapter: Local Fan *) +(* Author: Truong Nguyen Quang *) +(* Date: 2010-03 - 30 *) +(* ========================================================================== *) + + +(* needs "/home/user1/flyspeck/working/flyspeck_needs.hl";; *) +(* =========== snapshot 1631 ===================== *) + + +let build_sequence = + ["general/sphere.hl"; + "general/prove_by_refinement.hl"; + "trigonometry/trig1.hl"; + "trigonometry/trig2.hl"; + "hypermap/hypermap.hl"; + "fan/introduction.hl"; + "fan/topology.hl"];; + +map flyspeck_needs build_sequence;; + + +module type Wrgcvdr_cizmrrh = sig + +end;; + +module Wrgcvdr_cizmrrh = struct + + +open Sphere;; +open Trigonometry1;; +open Trigonometry2;; +open Hypermap;; +open Fan;; +open Topology;; +open Prove_by_refinement;; + + +let SET_TAC = let basicthms = +[NOT_IN_EMPTY; IN_UNIV; IN_UNION; IN_INTER; IN_DIFF; IN_INSERT; +IN_DELETE; IN_REST; IN_INTERS; IN_UNIONS; IN_IMAGE] in +let allthms = basicthms @ map (REWRITE_RULE[IN]) basicthms @ +[IN_ELIM_THM; IN] in +let PRESET_TAC = +TRY(POP_ASSUM_LIST(MP_TAC o end_itlist CONJ)) THEN +REPEAT COND_CASES_TAC THEN +REWRITE_TAC[EXTENSION; SUBSET; PSUBSET; DISJOINT; SING] THEN +REWRITE_TAC allthms in +fun ths -> +PRESET_TAC THEN +(if ths = [] then ALL_TAC else MP_TAC(end_itlist CONJ ths)) THEN +MESON_TAC ths ;; + +(* =========== improved SET_RULE ============= *) +let TR_SET_RULE a = fun x -> prove(x, SET_TAC a );; +let SET_RULE tm = prove(tm,SET_TAC[]);; + + +let all_hy_map = let t1 = CONJ dart edge_map in +let t2 = CONJ t1 node_map in +CONJ t2 face_map;; + + + +let SPEC_HY_ELEMS = prove_by_refinement( +`! (H: (A)hypermap) . tuple_hypermap H = (D,e,n,f) <=> +dart H = D /\ edge_map H = e /\ node_map H = n /\ face_map H = f `, +[ REWRITE_TAC[dart; all_hy_map]; +GEN_TAC THEN EQ_TAC; +SIMP_TAC[FST; SND; PAIR]; +DISCH_TAC; +PAT_ONCE_REWRITE_TAC`\x. x = y ` [GSYM PAIR] THEN +REWRITE_TAC[PAIR_EQ] THEN ASM_SIMP_TAC[]; +PAT_ONCE_REWRITE_TAC`\x. x = y ` [GSYM PAIR] THEN +REWRITE_TAC[PAIR_EQ] THEN ASM_SIMP_TAC[]; +PAT_ONCE_REWRITE_TAC`\x. x = y ` [GSYM PAIR] THEN +REWRITE_TAC[PAIR_EQ] THEN ASM_SIMP_TAC[]]);; + +(* =============================== *) +(* =============================== *) + +let hypermap = prove_by_refinement( +`! H: (A) hypermap. tuple_hypermap H = D,e,n,f ==> +e permutes D /\ n permutes D /\ f permutes D /\ e o n o f = I `, +[REWRITE_TAC[SPEC_HY_ELEMS]; +GEN_TAC THEN MP_TAC (SPEC_ALL hypermap_lemma); +ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> b ==> a ==> c `]; +SIMP_TAC[]]);; + + +parse_as_infix("has_orders",(12,"right"));; +parse_as_infix("cyclic_on",(13,"right"));; + +let has_orders = new_definition ` (f: A -> A) has_orders k <=> +(! i. 0 < i /\ i < k ==> ~( ITER i f = I )) /\ +ITER k f = I `;; + +let cyclic_on = new_definition` f cyclic_on (S:A -> bool) <=> +(! x. x IN S ==> S = {z | ?n. z = ITER n f x }) `;; + + +let dih2k = new_definition` dih2k (H: (A) hypermap) k <=> +CARD (dart H) = 2 * k +/\ (! x. x IN (dart H) ==> let S = face H x in + dart H = S UNION (IMAGE (node_map H) S )) +/\ (face_map H ) has_orders k /\ +(edge_map H ) has_orders 2 /\ +(node_map H) has_orders 2 `;; + + +let EE = new_definition` EE v S = {w | {v,w} IN S }`;; + +let ord_pairs = new_definition` ord_pairs E = { a,b | {a,b} IN E } `;; + +let self_pairs = new_definition` self_pairs E V = { (v,v) | v IN V /\ + EE v E = {} } `;; + +let darts_of_hyp = new_definition` darts_of_hyp E V = ord_pairs E UNION +self_pairs E V `;; + +let ee_of_hyp = new_definition` ee_of_hyp (x,V,E) ((a:real^3),(b:real^3)) = +if (a,b) IN darts_of_hyp E V then (b,a) else (a,b)`;; + +let ee_of_hyp2 = prove(` ee_of_hyp (x,V,E) u = +if u IN darts_of_hyp E V then (SND u, FST u) else u `, +PAT_ONCE_REWRITE_TAC `\x. f x = y ` [GSYM PAIR] THEN +PURE_REWRITE_TAC[ee_of_hyp] THEN REWRITE_TAC[]);; + +let nn_of_hyp = new_definition` nn_of_hyp (x,V,E) (v,u) = +if (v,u) IN darts_of_hyp E V then +(v, azim_cycle (EE v E) x v u) else (v,u)`;; + + + +let nn_of_hyp2 = prove(` nn_of_hyp (x,V,E) u = +if u IN darts_of_hyp E V then +(FST u, azim_cycle (EE (FST u) E) x (FST u) (SND u)) else u `, +PAT_ONCE_REWRITE_TAC `\x. f x = y ` [GSYM PAIR] THEN +PURE_REWRITE_TAC[nn_of_hyp] THEN REWRITE_TAC[]);; + + +let ivs_azim_cycle = new_definition`ivs_azim_cycle W v0 v w = +if W = {} then w else +(@x. x IN W /\ azim_cycle W v0 v x = w ) `;; + +let ff_of_hyp = new_definition` ff_of_hyp (x,V,E) (v,u) = +if (v,u) IN darts_of_hyp E V then +(u, ivs_azim_cycle (EE u E) x u v) else (v,u)`;; + +let ff_of_hyp2 = prove(` ff_of_hyp (x,V,E) u = +if u IN darts_of_hyp E V then +(SND u, ivs_azim_cycle (EE (SND u) E) x (SND u) (FST u)) else u`, +PAT_ONCE_REWRITE_TAC `\x. f x = y ` [GSYM PAIR] THEN +PURE_REWRITE_TAC[ff_of_hyp] THEN REWRITE_TAC[]);; + +let HYP = new_definition` HYP (x,V,E) = (darts_of_hyp E V, +ee_of_hyp (x,V,E), nn_of_hyp (x,V,E), ff_of_hyp (x,V,E)) `;; + + +let local_fan = new_definition ` local_fan (V,E,FF ) <=> + let H = hypermap ( HYP (vec 0, (V: real^3 -> bool), E)) in + FAN (vec 0, V, E) /\ + (?x. x IN ( dart H) /\ FF = face H x ) /\ +dih2k H (CARD FF ) `;; + + +let azim_in_fan = new_definition` azim_in_fan (v:real^3,w:real^3) E = +let d = (azim_cycle (EE v E) ( vec 0 ) v w) in + if CARD ( EE v E ) > 1 then + azim (vec 0 ) v w d else &2 * pi `;; + +let wedge_in_fan_gt = new_definition`wedge_in_fan_gt (v,w) E = + if CARD (EE v E) > 1 then +wedge (vec 0) v w (azim_cycle (EE v E) (vec 0 ) v w ) else if +EE v E = {w} then { x | ~ ( x IN aff_ge {vec 0, v} {w} ) } else +{ x | ~ ( x IN aff {vec 0, v} )} `;; + +let wedge_ge = new_definition `wedge_ge v0 v1 w1 w2 = { z | +&0 <= azim v0 v1 w1 z /\ azim v0 v1 w1 z <= azim v0 v1 w1 w2 }`;; + +let wedge_in_fan_ge = new_definition` wedge_in_fan_ge ((v:real^3),w) E = + if CARD (EE v E) > 1 then +wedge_ge (vec 0) v w (azim_cycle (EE v E) (vec 0 ) v w ) else { x:real^3 | T } `;; + +let convex_local_fan = new_definition + `convex_local_fan (V,E,FF) <=> + local_fan (V,E,FF) /\ + (!x. x IN FF ==> azim_in_fan x E <= pi /\ V SUBSET wedge_in_fan_ge x E)`;; + +let FST_SND_FORM_OF_4_TUPLE = GEN_ALL ( +prove_by_refinement(` FST X = D /\ FST (SND X) = e /\ +FST (SND (SND X)) = n /\ SND (SND (SND X)) = f <=> X = D,e,n,f `, +[EQ_TAC; +STRIP_TAC; +REPEAT (PAT_ONCE_REWRITE_TAC `\x. x = y `[GSYM PAIR] THEN + ASM_SIMP_TAC[PAIR_EQ]); +SIMP_TAC[PAIR_EQ]]));; +(* =================================================== *) + + + +let V_IN_DARTS_IFF_E_V_IN_DARTS = prove_by_refinement +(`v IN darts_of_hyp E V <=> ee_of_hyp (x,V,E) v IN darts_of_hyp E V `, +[EQ_TAC; +REWRITE_TAC[ee_of_hyp2]; +SIMP_TAC[darts_of_hyp; IN_UNION; ord_pairs; self_pairs]; +DISCH_THEN DISJ_CASES_TAC; +DISJ1_TAC; +DOWN; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +ASM_SIMP_TAC[]; +EXISTS_TAC `b:real^3 `; +EXISTS_TAC `a:real^3 `; +ASM_SIMP_TAC[INSERT_COMM]; +DISJ2_TAC; +DOWN THEN REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC `v':real^3 `; +ASM_SIMP_TAC[]; +ONCE_REWRITE_TAC[TAUT` a ==> b <=> ~ b ==> ~ a `]; +SIMP_TAC[ee_of_hyp2]]);; + + + + +let V_IN_DARTS_IMP_SWICH_SO_DO = prove_by_refinement +(` (v:A#A) IN darts_of_hyp E V ==> SND v, FST v IN darts_of_hyp E V `, +[REWRITE_TAC[darts_of_hyp; ord_pairs; self_pairs; IN_UNION; IN_ELIM_THM]; +STRIP_TAC; +DISJ1_TAC; +EXISTS_TAC `b:A `; +EXISTS_TAC `a:A`; +ASM_SIMP_TAC[INSERT_COMM]; +DISJ2_TAC; +EXISTS_TAC ` v':A`; +ASM_SIMP_TAC[]]);; +let V_IN_DARTS_IFF_SWICH_SO_DO = V_IN_DARTS_IMP_SWICH_SO_DO;; + + +(* removed, 2011-08-01, `fan` deprecated, thales +let fan_expand = let t1 = CONJ fan fan1 in +let t2 = CONJ fan2 t1 in +let t3 = CONJ fan3 t2 in +let t4 = CONJ fan4 t3 in +let t5 = CONJ fan5 t4 in +let t6 = CONJ fan6 t5 in +let t7 = CONJ fan7 t6 in +CONJ FAN t7;; +*) + + + + + + +let IN_V_OF_FAN_EXISTS_DART = GEN_ALL ( +prove_by_refinement( +` UNIONS E SUBSET (V:real^3 -> bool) /\ u IN V ==> + ? v. v IN V /\ (u,v) IN darts_of_hyp E V `, +[REWRITE_TAC[darts_of_hyp; IN_UNION; ord_pairs; self_pairs]; +PHA THEN DAO THEN STRIP_TAC THEN ASM_CASES_TAC `?(v:real^3). {u,v} IN E `; +(* Subgoal 1 *) +FIRST_X_ASSUM CHOOSE_TAC THEN EXISTS_TAC `v:real^3 `; +ASSUME_TAC2 (prove(` UNIONS E SUBSET V /\ {(u:real^3), v} IN E ==> v IN V `, +REWRITE_TAC[ UNIONS_SUBSET] THEN +STRIP_TAC THEN +MATCH_MP_TAC (TR_SET_RULE[]` {u,v} SUBSET V ==> v IN V `) THEN +FIRST_X_ASSUM MATCH_MP_TAC THEN +ASM_SIMP_TAC[])); +ASM_REWRITE_TAC[] THEN EVERY_ASSUM (fun x -> SET_TAC[x]); +(* Subgoal 2 *) +EXISTS_TAC `u:real^3 ` THEN ASM_REWRITE_TAC[EE]; +DISJ2_TAC THEN FIRST_X_ASSUM MP_TAC THEN SET_TAC[]]));; + + + + + + +let X_IN_ITS_ORBIT = prove(` (x:A) IN orbit_map f x `, +REWRITE_TAC[orbit_map; IN_ELIM_THM] THEN +EXISTS_TAC ` 0 ` THEN REWRITE_TAC[POWER; I_THM; GE_REFL]);; + +let X_IN_HYP_ORBITS = prove(`! (x:A). x IN edge H x /\ x IN node H x /\ x IN face H x `, +REWRITE_TAC[node; edge; face; X_IN_ITS_ORBIT]);; + + + + + +prove(` UNIONS E SUBSET V /\ {a, b} IN E ==> a IN V /\ b IN V `, +REWRITE_TAC[UNIONS_SUBSET; +(GSYM o (TR_SET_RULE[]))` {a,b} SUBSET V <=> a IN V /\ b IN V `] THEN +MESON_TAC[]);; + + + +let IN_DARTS_HYP_IMP_FST_SND_IN_V = prove_by_refinement +(`UNIONS E SUBSET V /\ (y:A#A) IN darts_of_hyp E V ==> FST y IN V /\ SND y IN V `, +[SIMP_TAC[darts_of_hyp; ord_pairs; self_pairs; IN_UNION; IN_ELIM_THM]; +STRIP_TAC; +(* sub 1 *) +ASM_SIMP_TAC[]; +MATCH_MP_TAC (prove(` UNIONS E SUBSET V /\ {a, b} IN E ==> a IN V /\ b IN V `, +REWRITE_TAC[UNIONS_SUBSET; +(GSYM o (TR_SET_RULE[]))` {a,b} SUBSET V <=> a IN V /\ b IN V `] THEN +MESON_TAC[])); +ASM_SIMP_TAC[]; +(* sub 2 *) +ASM_SIMP_TAC[FST; SND]]);; + + + +let POWER_SND = prove_by_refinement +(`!n. f POWER SUC n = f o (f POWER n)`, +[INDUCT_TAC; +REWRITE_TAC[POWER; FUN_EQ_THM; o_THM; I_THM]; +DOWN THEN SIMP_TAC[POWER; FUN_EQ_THM; o_THM]]);; + + +let POWER_TO_ITER = prove(`! n. (f POWER n) = ITER n f `, +INDUCT_TAC THENL [ +REWRITE_TAC[POWER; ITER; FUN_EQ_THM; I_THM]; +ASM_REWRITE_TAC[POWER_SND; ITER; FUN_EQ_THM; o_THM]]);; + + +let SND_IN_SET_OF_DART_OF_FRST = prove( +` UNIONS (E:(A -> bool) -> bool) SUBSET (V:A -> bool) /\ y IN darts_of_hyp E V ==> +FST y = SND y \/ SND y IN set_of_edge (FST y) V E`, +REWRITE_TAC[set_of_edge; darts_of_hyp; ord_pairs; +self_pairs; IN_ELIM_THM; IN_UNION] THEN +STRIP_TAC THENL [ +ASM_SIMP_TAC[] THEN +DISJ2_TAC THEN +ASM_MESON_TAC[prove(` UNIONS E SUBSET V /\ {(u:A), v} IN E ==> v IN V `, +REWRITE_TAC[ UNIONS_SUBSET] THEN +STRIP_TAC THEN +MATCH_MP_TAC (TR_SET_RULE[]` {u,v} SUBSET V ==> v IN V `) THEN +FIRST_X_ASSUM MATCH_MP_TAC THEN +ASM_SIMP_TAC[])]; +ASM_SIMP_TAC[]]);; + + + +let UNI_E_IMP_EE_EQ_SET_OF_EDGE = +prove(` UNIONS E SUBSET V ==> EE (v:A) E = set_of_edge v V E `, +REWRITE_TAC[EE; set_of_edge] THEN +REWRITE_TAC[UNIONS_SUBSET; FUN_EQ_THM; IN_ELIM_THM] +THEN REWRITE_TAC[MESON[]`( a <=> a /\ b ) <=> a ==> b `] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC (TR_SET_RULE[]` {v:A,b} SUBSET V ==> b IN V `) +THEN ASM_MESON_TAC[]);; + + + +let types_in_th th = let t = frees (concl (SPEC_ALL th)) in + map dest_var t;; + + +let IN_ORD_PAIRS_IMP_IMP_IN_TOO = +prove_by_refinement( +`y IN ord_pairs E ==> ((FST y):A,d) IN darts_of_hyp E V ==> + ((FST y),d) IN ord_pairs E `, +[REWRITE_TAC[ord_pairs; darts_of_hyp; +self_pairs; IN_ELIM_THM] THEN +REPEAT STRIP_TAC; +(* sub 1 *) +EXISTS_TAC `FST (y:A#A)` THEN +EXISTS_TAC `d: A` THEN +DOWN; +REWRITE_TAC[IN_UNION; IN_ELIM_THM]; +STRIP_TAC; +DOWN_TAC; +SIMP_TAC[PAIR_EQ]; +(* sub 2 *) +DOWN_TAC; +IMP_TAC THEN IMP_TAC THEN SIMP_TAC[]; +SIMP_TAC[EE; PAIR_EQ]; SET_TAC[]]);; + + + + +let IN_ORD_PAIRS_IMP_SND_IN_EE_FST = prove( +`y IN ord_pairs E ==> SND y IN (EE (FST y) E) ` , +REWRITE_TAC[ord_pairs; EE; IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_SIMP_TAC[]);; + + + + + + + + + +let IN_SELF_PAIRS_IMP_FST_EQ_SND_FORALL = +prove_by_refinement( +`! (v:A). y IN self_pairs E V /\ FST y,v IN darts_of_hyp E V ==> FST y = v`, +[GEN_TAC THEN REWRITE_TAC[self_pairs; darts_of_hyp]; +REWRITE_TAC[IN_ELIM_THM; ord_pairs; IN_UNION; EE]; +STRIP_TAC; +DOWN; +ASM_SIMP_TAC[PAIR_EQ]; +STRIP_TAC; +ASM SET_TAC[]; +DOWN THEN SIMP_TAC[PAIR_EQ]]);; + + + +let choose_nd_point = new_specification ["choose_nd_point"] + (REWRITE_RULE[RIGHT_IMP_EXISTS_THM; SKOLEM_THM] IN_V_OF_FAN_EXISTS_DART);; + +(* ============================ *) + + +let ITER_N_I = prove(`! n. ITER n I = I`, +INDUCT_TAC THENL [ +REWRITE_TAC[ITER; FUN_EQ_THM; I_THM]; +ASM_REWRITE_TAC[ITER; FUN_EQ_THM; I_THM]]);; + + + + + + +let HAS_ORDERS_IMP_ORBIT_MAP_FIRST_ROW = +prove_by_refinement( +`(f: A -> A) has_orders k /\ ~ (k = 0 ) ==> +(! x. orbit_map f x = { y| ? n. 0 <= n /\ n < k /\ y = ITER n f x }) `, +[ REWRITE_TAC[has_orders; orbit_map; POWER_TO_ITER]; +REWRITE_TAC[FUN_EQ_THM]; +REPEAT STRIP_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EQ_TAC; +STRIP_TAC; +EXISTS_TAC `n MOD k `; +ASM_SIMP_TAC[LE_0; DIVISION]; +ASSUME_TAC2 (SPECL [` n: num `;` k:num `] DIVISION); +FIRST_X_ASSUM (fun x -> PAT_ONCE_REWRITE_TAC `\x. x = y ` [x]); +REWRITE_TAC[GSYM ITER_ADD; GSYM ITER_MUL]; +UNDISCH_TAC `!x. ITER k (f: A -> A) x = I x`; +SIMP_TAC[GSYM FUN_EQ_THM; ETA_AX; ITER_N_I; I_THM]; +STRIP_TAC; +REWRITE_TAC[ARITH_RULE` n >= 0 `]; +EXISTS_TAC `n: num `; +ASM_REWRITE_TAC[]]);; + + + +let FINITE_OF_N_FIRST_ELMS = +prove_by_refinement( +`! k (x:A). FINITE {y | ?n. n < k /\ y = ITER n f x}`, +[INDUCT_TAC; +REWRITE_TAC[ ARITH_RULE ` ~( n < 0 ) `; EMPTY_GSPEC; FINITE_EMPTY]; +REWRITE_TAC[ARITH_RULE` x < SUC k <=> x < k \/ x = k `]; +KHANANG; +REWRITE_TAC[TR_SET_RULE[]` { y | ? n. P n y \/ Q n y } = {y | ? n. P n y } + UNION { y | ? n. Q n y } `]; +DOWN; +REWRITE_TAC[LE_0; TR_SET_RULE[]` {y| ? n. n = k /\ y = P n } = { P k } `]; +SIMP_TAC[FINITE_UNION; FINITE_SINGLETON]]);; + + + + + +let F_HAS_ORDERS_IMP_FINITE_ORBIT = +prove_by_refinement( +` (f: A -> A) has_orders k /\ ~( k = 0 ) ==> +(! x. FINITE (orbit_map f x )) `, +[NHANH HAS_ORDERS_IMP_ORBIT_MAP_FIRST_ROW; +SIMP_TAC[] THEN STRIP_TAC; +SPEC_TAC (`k:num `,` k:num`); +INDUCT_TAC; +REWRITE_TAC[ ARITH_RULE ` ~( n < 0 ) `; EMPTY_GSPEC; FINITE_EMPTY]; +REWRITE_TAC[ARITH_RULE` x < SUC k <=> x < k \/ x = k `]; +KHANANG; +REWRITE_TAC[TR_SET_RULE[]` { y | ? n. P n y \/ Q n y } = {y | ? n. P n y } + UNION { y | ? n. Q n y } `]; +DOWN; +REWRITE_TAC[LE_0; TR_SET_RULE[]` {y| ? n. n = k /\ y = P n } = { P k } `]; +SIMP_TAC[FINITE_UNION; FINITE_SINGLETON]]);; + + + + + + + +let CARD_CLAUSES2 = prove(`FINITE (S: A -> bool) + ==> (!x. x IN S ==> CARD (x INSERT S) = CARD S) /\ + (!x. ~(x IN S) ==> CARD (x INSERT S) = SUC (CARD S))`, +SIMP_TAC[CARD_CLAUSES]);; + + +let CARD_INSERT_GE_AND_LE = prove( +`FINITE (S: A -> bool) ==> CARD S <= CARD (x INSERT S ) /\ +CARD (x INSERT S) <= SUC ( CARD S)`, +SIMP_TAC[CARD_CLAUSES] THEN +COND_CASES_TAC THENL [ +DISCH_TAC THEN ARITH_TAC; +DISCH_TAC THEN ARITH_TAC]);; + + + + + +let HAVING_ORDERS_K_IMP_CARD_ORBIT_LE_K = +prove_by_refinement( +`(f: A -> A) has_orders k /\ ~( k = 0 ) ==> +(! x. CARD (orbit_map f x) <= k )`, +[SIMP_TAC[HAS_ORDERS_IMP_ORBIT_MAP_FIRST_ROW ]; +STRIP_TAC; +SPEC_TAC (`k: num `,` k: num`); +INDUCT_TAC; +REWRITE_TAC[LE_0; ARITH_RULE ` ~( n < 0 ) `; EMPTY_GSPEC; CARD_CLAUSES]; +REWRITE_TAC[ARITH_RULE` x < SUC k <=> x < k \/ x = k `]; +GEN_TAC; +KHANANG; +REWRITE_TAC[TR_SET_RULE[]` { y | ? n. P n y \/ Q n y } = {y | ? n. P n y } + UNION { y | ? n. Q n y } `]; +DOWN; +REWRITE_TAC[LE_0; TR_SET_RULE[]` {y| ? n. n = k /\ y = P n } = { P k } `]; +SIMP_TAC[TR_SET_RULE[]` a UNION {x} = x INSERT a `]; +MP_TAC (SPECL [`k' :num `;`x: A `] FINITE_OF_N_FIRST_ELMS); +NHANH (ISPEC ` ITER k' f (x:A) ` ( GEN `x :A ` CARD_INSERT_GE_AND_LE)); +STRIP_TAC THEN STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC `x: A `)); +DOWN; +ARITH_TAC]);; + +(* CARD_LE_K_OF_SET_K_FIRST_ELMS +|- CARD {ITER i f x | i < k} <= k *) +let CARD_LE_K_OF_SET_K_FIRST_ELMS = +BETA_RULE (SPECL [`k: num `;`(\i. ITER i (f: A -> A) x )`] +CARD_FINITE_SERIES_LE);; + + + + + + +let CARD_K_FIRST_ELMS_EQ_K = +prove_by_refinement( +`! k (f: A -> A). CARD {ITER n f x | n < k} = k ==> + CARD {ITER n f x | n < k - 1} = k - 1 /\ + (!i. i < k - 1 ==> ~(ITER i f x = ITER ( k - 1 ) f x))`, +[INDUCT_TAC; +REWRITE_TAC[ARITH_RULE ` ~( a < 0 - 1 ) `; LT]; +REWRITE_TAC[TR_SET_RULE[]` {ITER n f x | n | F} = {} `; CARD_CLAUSES]; +ARITH_TAC; +GEN_TAC; +REWRITE_TAC[ARITH_RULE ` a < SUC k <=> a < k \/ a = k `]; +REWRITE_TAC[TR_SET_RULE[]` { ITER n f x | n < k \/ n = k } = ITER k f x INSERT { ITER n f x | n < k } `]; +ASM_CASES_TAC ` ITER k f (x:A) IN {ITER n f x | n < k} `; +MP_TAC (SPEC_ALL FINITE_OF_N_FIRST_ELMS); +REWRITE_TAC[TR_SET_RULE[]` {y | ?n. n < k /\ y = ITER n f x} = {ITER n f x | n < k} `]; +ASM_SIMP_TAC[CARD_CLAUSES; FINITE_OF_N_FIRST_ELMS]; +DISCH_TAC THEN MP_TAC CARD_LE_K_OF_SET_K_FIRST_ELMS; +ARITH_TAC; +DOWN; +MP_TAC (SPEC_ALL FINITE_OF_N_FIRST_ELMS); +REWRITE_TAC[TR_SET_RULE[]` {y | ?n. n < k /\ y = ITER n f x} = {ITER n f x | n < k} `]; +SIMP_TAC[ARITH_RULE ` SUC k - 1 = k `; CARD_CLAUSES; SUC_INJ]; +DISCH_TAC; +SET_TAC[]]);; + + +let FINITENESS_OF_K_FIRST_ELMS = prove_by_refinement( +`! k (f: num -> A). FINITE { f n | n < k }`, +[INDUCT_TAC; +REWRITE_TAC[LT; TR_SET_RULE[]` {f n | n | F } = {} `; FINITE_RULES]; +REWRITE_TAC[ARITH_RULE` n < SUC k <=> n < k \/ n = k `; + TR_SET_RULE[]` {(f: num -> A) n | n < k \/ n = k} = f k INSERT {f n | n < k } `]; +ASM_REWRITE_TAC[FINITE_INSERT]]);; + + +let LT_SUC_E = ARITH_RULE` i < SUC k <=> i < k \/ i = k `;; + +(* |- !k. CARD {f i | i < k} <= k *) +let CARD_K_FIRST_ELMS_LE_K = +GEN `k: num ` (SPECL [`k: num `;` f: num -> A `] CARD_FINITE_SERIES_LE);; + + + +let REMOVE_TAC = MATCH_MP_TAC (TAUT ` a ==> b ==> a `);; + + + +let CARD_N_FIRST_ELMS_UNDUCTIVE = prove_by_refinement( +`! k (f: num -> A ). CARD { f n | n < k} = k <=> + CARD {f n | n < k - 1} = k - 1 /\ + (!i. i < k - 1 ==> ~(f i = f ( k - 1 )))`, +[REPEAT GEN_TAC; +ASM_CASES_TAC ` k = 0 `; +ASM_SIMP_TAC[ARITH_RULE` ~( x < 0 - 1 ) `; LT; ARITH_RULE` 0 - 1 = 0 `]; +DOWN; +NHANH (ARITH_RULE` ~( k = 0 ) ==> (! n. n < k <=> n < k - 1 \/ n = k - 1 ) `); +SIMP_TAC[]; +STRIP_TAC; +REWRITE_TAC[TR_SET_RULE[]` {(f:num -> A) n | n < k - 1 \/ n = k - 1} + = f ( k - 1 ) INSERT {f n | n < k - 1 }`]; +MP_TAC (SPECL [` k - 1 `;` f: num -> A `] FINITENESS_OF_K_FIRST_ELMS); +DISCH_TAC; +EQ_TAC; +(* sub 1 *) +ASM_SIMP_TAC[CARD_CLAUSES]; +COND_CASES_TAC; +(* sub 1.1 *) +MP_TAC (SPEC ` k - 1 ` CARD_K_FIRST_ELMS_LE_K); +UNDISCH_TAC ` ~( k = 0 ) `; +MESON_TAC[ARITH_RULE `~ ( ~(k = 0) /\ a <= k - 1 /\ a = k ) `]; +(* sub 1.2 *) +UNDISCH_TAC ` ~( k = 0 ) `; +SIMP_TAC[ARITH_RULE ` ~( k = 0 ) ==> ( SUC x = k <=> x = k - 1 )`]; +MATCH_MP_TAC (TAUT ` a ==> b ==> a `); +MATCH_MP_TAC (TAUT ` a ==> b ==> a `); +DOWN; +REWRITE_TAC[IN_ELIM_THM]; +MESON_TAC[]; +(* SUB 2 *) +STRIP_TAC; +SUBGOAL_THEN ` ~( f ( k - 1 ) IN {(f: num -> A) n | n < k - 1})` ASSUME_TAC; +DOWN THEN REWRITE_TAC[IN_ELIM_THM]; +MESON_TAC[]; +ASM_SIMP_TAC[CARD_CLAUSES]; +UNDISCH_TAC `~( k = 0 ) `; +ARITH_TAC]);; + + + + + +let CARD_ADD1_LE = prove_by_refinement( +`! f: num -> A. CARD { f n | n < k + 1 } <= CARD {f n | n < k } + 1 `, +[REWRITE_TAC[ARITH_RULE` a < v + 1 <=> a < v \/ a = v `; + TR_SET_RULE[]` {(f: num -> A) n | n < k \/ n = k} = f k INSERT {f n | n < k } `]; +GEN_TAC; +MP_TAC (SPEC_ALL FINITENESS_OF_K_FIRST_ELMS); +SIMP_TAC[CARD_CLAUSES]; +COND_CASES_TAC; +DISCH_TAC THEN ARITH_TAC; +DISCH_TAC THEN ARITH_TAC]);; + + + + + +let CARD_LT_KT_LE_ADDT = +prove_by_refinement( +` CARD { (f: num -> A) n | n < k + t } <= CARD {f n | n < k } + t `, +[SPEC_TAC (`t:num `,` t:num `); +INDUCT_TAC; +REWRITE_TAC[ADD_0; LE_REFL]; +REWRITE_TAC[ADD1]; +REWRITE_TAC[ARITH_RULE` a + b + 1 = (a + b ) + 1 `]; +MP_TAC (SPECL [` k + (t:num) `;` f: num -> A `] (GEN_ALL CARD_ADD1_LE)); +DOWN THEN ARITH_TAC]);; + + + + + +let CARD_KS_EQ_K_EQ_ALL_LE = prove_by_refinement +(`! k (f: num -> A ). CARD { f n | n < k} = k <=> +(! kk. kk <= k ==> CARD { f n | n < kk} = kk ) `, +[REPEAT STRIP_TAC; +EQ_TAC; +REPEAT STRIP_TAC; +ASM_CASES_TAC ` CARD {(f: num -> A) n | n < kk} = kk`; +ASM_SIMP_TAC[]; +ASSUME_TAC (SPEC `kk: num ` CARD_K_FIRST_ELMS_LE_K ); +UNDISCH_TAC ` kk <= (k:num ) `; +NHANH (ARITH_RULE` kk <= (k:num) ==> k = kk + k - kk`); +STRIP_TAC; +UNDISCH_TAC `CARD {(f:num -> A) n | n < k} = k`; +FIRST_ASSUM (fun x -> ONCE_REWRITE_TAC[x]); + MP_TAC (SPECL [`kk : num `;` f: num -> A `;` k - (kk: num ) `] + (GEN_ALL CARD_LT_KT_LE_ADDT)); +REPEAT STRIP_TAC; +UNDISCH_TAC `~(CARD {(f: num -> A) n | n < kk} = kk) `; +UNDISCH_TAC ` CARD {(f: num -> A) i | i < kk} <= kk`; +PHA; +REWRITE_TAC[ARITH_RULE` a <= b /\ ~( a = b ) <=> a < (b: num) `]; +DOWN THEN DOWN; +MESON_TAC[ARITH_RULE` ~( a <= b + c /\ a = kk + c /\ b < (kk: num) ) `]; +(* SUB 2 *) +DISCH_THEN (MP_TAC o (SPEC `k: num `)); +SIMP_TAC[LE_REFL]]);; +(* ======================== *) + + + + + +let CARD_K_ELMS_EQ_K_IMP_ALL_DISTINCT = +prove_by_refinement( +`! k (f: num -> A). CARD {f n | n < k} = k +==> (!i j. i < k /\ j < k /\ ~( i = j) ==> ~( f i = f j )) `, +[INDUCT_TAC; +REWRITE_TAC[LT]; +ONCE_REWRITE_TAC[CARD_N_FIRST_ELMS_UNDUCTIVE]; +REWRITE_TAC[ARITH_RULE` SUC k - 1 = k `]; +FIRST_X_ASSUM NHANH; +REWRITE_TAC[ARITH_RULE` a < SUC b <=> a < b \/ a = b `]; +MESON_TAC[]]);; + + + + + + + +let CARD_UNION_NOT_DISTJ_LT = +prove_by_refinement( +` FINITE (s: A -> bool) /\ FINITE t /\ ~( s INTER t = {} ) ==> + CARD (s UNION t) < CARD s + CARD t `, +[NGOAC; +NHANH CARD_UNION_GEN; +REWRITE_TAC[TR_SET_RULE[]` ~( x = {} ) <=> (?a. {a} SUBSET x ) `]; +NHANH (MESON[FINITE_INTER]` FINITE s /\ FINITE t ==> FINITE (s INTER t)`); +STRIP_TAC; +UNDISCH_TAC `FINITE ((s: A -> bool) INTER t)`; +DOWN THEN PHA; +NHANH CARD_SUBSET; +REWRITE_TAC[CARD_SINGLETON]; +STRIP_TAC; +UNDISCH_TAC `CARD ((s: A -> bool) UNION t) = +(CARD s + CARD t) - CARD (s INTER t)`; +ONCE_REWRITE_TAC[ARITH_RULE` a < b <=> 0 < b - a `]; +ASSUME_TAC2 (SPEC_ALL CARD_UNION_LE); +ASSUME_TAC (TR_SET_RULE[]` (s INTER t) SUBSET (s: A -> bool) `); +ASSUME_TAC2 (SPECL [`(s:A -> bool) INTER t `;` s: A -> bool`] CARD_SUBSET); +DOWN THEN DOWN THEN REMOVE_TAC; +DOWN THEN DOWN THEN PHA THEN ARITH_TAC]);; + + + + + + + +let CARD_ITER_K_EK_IMP_DIST = prove_by_refinement( +`! k (f: A -> A). CARD {ITER n f x | n < k} = k ==> + (!i j. i < k /\ j < k /\ ~(i = j ) ==> ~(ITER i f x = ITER j f x))`, +[REPEAT GEN_TAC; +REWRITE_TAC[BETA_RULE (SPECL [`k: num `; +`(\n. ITER n (f:A -> A) x ) `] CARD_K_ELMS_EQ_K_IMP_ALL_DISTINCT)]]);; + + + + + + + + +let DIH2K_IMP_PRE_SIMPLE_HYP = prove_by_refinement +(`FINITE ( dart H ) /\ +dih2k (H:(A)hypermap) k /\ ~( k = 0 ) +==> (! x. x IN dart H ==> ~( node_map H x IN face H (x:A) )) `, +[REWRITE_TAC[ dih2k; simple_hypermap]; +STRIP_TAC; +GEN_TAC; +ASM_CASES_TAC `node_map H x IN face H (x:A) `; +(* subgoal 1 *) +FIRST_X_ASSUM NHANH; +LET_TAC; +STRIP_TAC; +SUBGOAL_THEN ` ~( (S: A -> bool) INTER (IMAGE (node_map H) S) = {}) ` ASSUME_TAC; +ASSUME_TAC (SPEC_ALL face_refl); +DOWN; +NHANH (ISPECL [`node_map (H:(A) hypermap)`;`S: A -> bool `;`x:A `] FUN_IN_IMAGE); +UNDISCH_TAC `node_map H (x:A) IN S`; +ASM_REWRITE_TAC[]; +SET_TAC[]; +ASSUME_TAC2 lemma_face_subset; +ASSUME_TAC2 (SPECL [`face H (x:A) `;` dart (H:(A) hypermap)`] FINITE_SUBSET); +ASSUME_TAC2 (ISPECL [` node_map (H:(A) hypermap) `;`face H (x:A) `] FINITE_IMAGE); +REPLICATE_TAC 5 DOWN; +PHA THEN ASM_REWRITE_TAC[]; +STRIP_TAC; +ASSUME_TAC2 (SPECL [`S: A -> bool `;` IMAGE (node_map H) + (S: A -> bool) `] (GEN_ALL CARD_UNION_NOT_DISTJ_LT)); +ASSUME_TAC2 (ISPECL [`node_map (H:(A) hypermap)`;` S:A -> bool`] CARD_IMAGE_LE); +ASSUME_TAC2 (SPECL [`face_map (H:(A) hypermap)`;`k: num `] +(GEN_ALL HAVING_ORDERS_K_IMP_CARD_ORBIT_LE_K)); +DOWN; +ASM_REWRITE_TAC[GSYM face]; +DISCH_THEN (MP_TAC o (SPEC `x: A`)); +ASM_REWRITE_TAC[] THEN STRIP_TAC; +DOWN THEN DOWN THEN DOWN THEN PHA; +NHANH (ARITH_RULE`a < b + c /\ c <= b /\ b <= k ==> a < 2 * k `); +FIRST_ASSUM (fun x -> REWRITE_TAC[SYM x]); +STRIP_TAC; +ASM_MESON_TAC[ARITH_RULE` x = 2 * k ==> ~(x < 2 * k ) `]; +(* subgoal 2 *) +ASM_REWRITE_TAC[]]);; + + + +let ITER1 = prove(`ITER 1 f = (f:A -> A) `, +REWRITE_TAC[ARITH_RULE` 1 = SUC 0 `; ITER; FUN_EQ_THM]);; + + + + + + +let DIH2K_IMP_SIMPLE_HYPERMAP = prove_by_refinement( + ` FINITE ( dart H ) /\ +dih2k (H:(A)hypermap) k /\ ~( k = 0 ) ==> simple_hypermap H`, +[NHANH DIH2K_IMP_PRE_SIMPLE_HYP; +REWRITE_TAC[ dih2k; simple_hypermap]; +STRIP_TAC; +GEN_TAC; +ASSUME_TAC (ARITH_RULE` ~( 2 = 0 ) `); +ASSUME_TAC2 (SPECL [`2`; `node_map (H:(A) hypermap) `] (GEN_ALL HAS_ORDERS_IMP_ORBIT_MAP_FIRST_ROW)); +FIRST_X_ASSUM (MP_TAC o (SPEC `x:A `)); +REWRITE_TAC[GSYM node]; +REPEAT STRIP_TAC; +REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM; TR_SET_RULE[]` (a INTER b) x <=> x IN a /\ x IN b `]; +REWRITE_TAC[TR_SET_RULE[]` {s} a <=> a = s `]; +GEN_TAC THEN EQ_TAC; +ASM_SIMP_TAC[IN_ELIM_THM; ARITH_RULE` x < 2 <=> x = 0 \/ x = 1 `]; +STRIP_TAC; +(* sub 1.1 *) +REPLICATE_TAC 3 DOWN; +SIMP_TAC[ITER]; +(* sub 1.2 *) +REPLICATE_TAC 3 DOWN; +SIMP_TAC[ITER; ITER1]; +ASM_MESON_TAC[]; +(* sub 2 *) +SIMP_TAC[X_IN_HYP_ORBITS]]);; + + + + + +let IN_ORBIT_IMP_ORBIT_SUBSET = prove_by_refinement( +`! x (y:A) f. x IN orbit_map f y ==> orbit_map f x SUBSET orbit_map f y `, +[REPEAT GEN_TAC; +REWRITE_TAC[orbit_map; IN_ELIM_THM; SUBSET; POWER_TO_ITER]; +REPEAT STRIP_TAC; +ASM_SIMP_TAC[]; +REWRITE_TAC[ITER_ADD]; +EXISTS_TAC `n' + (n:num) `; +REWRITE_TAC[ARITH_RULE ` a >= 0 `]]);; + + + + + + +let IN_FACE_IMP_SUBSET_FACE = prove( +`! (x:A). x IN face H y ==> face H x SUBSET face H y `, +REWRITE_TAC[face] THEN +NHANH IN_ORBIT_IMP_ORBIT_SUBSET THEN +SIMP_TAC[]);; + + + + + + +let HAS_ORDK_IN_ORBIT_IMP_SAME_ORBIT = prove_by_refinement( +` (f:A -> A) has_orders k /\ x IN orbit_map f y /\ ~( k = 0 ) ==> +orbit_map f x = orbit_map f y `, +[NHANH IN_ORBIT_IMP_ORBIT_SUBSET; +SIMP_TAC[TR_SET_RULE[]` a = b <=> a SUBSET b /\ b SUBSET a `]; +STRIP_TAC; +ASSUME_TAC2 HAS_ORDERS_IMP_ORBIT_MAP_FIRST_ROW; +UNDISCH_TAC `(x:A) IN orbit_map f y`; +ASM_REWRITE_TAC[]; +REWRITE_TAC[SUBSET; IN_ELIM_THM]; +REPEAT STRIP_TAC; +ASM_REWRITE_TAC[ITER_ADD]; +ASM_CASES_TAC ` (n:num) <= n' `; +EXISTS_TAC ` n' - (n:num) `; +ASM_SIMP_TAC[ARITH_RULE` n <= (n': num) ==> n' - n + n = n' `]; +ASM_ARITH_TAC; +EXISTS_TAC ` (k: num) - n + n' `; +ASM_SIMP_TAC[ARITH_RULE` n < k ==> (k - n + n') + n = n' + (k:num) `]; +UNDISCH_TAC `(f: A -> A) has_orders k `; +SIMP_TAC[has_orders; GSYM ITER_ADD; I_THM]; +REMOVE_TAC THEN ASM_ARITH_TAC]);; + + + + + + + + + + + + + +let DIH_IMP_EVERY_NODE_INTER_FACE = prove_by_refinement +(` dih2k (H:(A) hypermap) k +==> (! x y. {x,y} SUBSET dart H ==> ? d. d IN node H x /\ d IN face H y ) `, +[REWRITE_TAC[dih2k; INSERT_SUBSET]; +REPEAT STRIP_TAC; +UNDISCH_TAC `(y:A) IN dart H `; +FIRST_X_ASSUM NHANH; +REWRITE_TAC[let_CONV` let S = face H (y:A) in dart H = S UNION IMAGE (node_map H) S`]; +STRIP_TAC; +UNDISCH_TAC `(x:A) IN dart H`; +ASM_REWRITE_TAC[IN_UNION]; +STRIP_TAC; +EXISTS_TAC `x:A`; +ASM_SIMP_TAC[node_refl]; +DOWN; +REWRITE_TAC[IN_IMAGE]; +STRIP_TAC; +EXISTS_TAC `x':A`; +ASM_REWRITE_TAC[node; orbit_map; IN_ELIM_THM]; +EXISTS_TAC `1 `; +REWRITE_TAC[ARITH_RULE` 1 >= 0 `; POWER_1]; +REWRITE_TAC[ARITH_RULE` 1 >= 0 `; POWER_1]; +UNDISCH_TAC `node_map (H:(A) hypermap ) has_orders 2`; +REWRITE_TAC[has_orders; FUN_EQ_THM; ITER; ARITH_RULE`2 = SUC 1 `; ITER1; I_THM]; +SIMP_TAC[EQ_SYM_EQ]]);; +(* ================================ *) + + + +let F_INVERSE_F = prove(` (? y. f y = x ) ==> f ( (inverse f) x ) = x`, +REWRITE_TAC[FUN_EQ_THM; I_THM; o_THM; inverse; IN_IMAGE] +THEN ASM_MESON_TAC[]);; + +let F_INVERSE_F_F = MESON[F_INVERSE_F]` f ( inverse f (f x)) = f x `;; + +let INJ_IMP_INVERSE_FF = MESON[F_INVERSE_F_F]`(!y. f y = f x ==> y = x ) ==> inverse f ( f x ) = x `;; + +let BIJ_AND_BIJ_INVERSE = prove(` BIJ f S1 S2 /\ (! x. f x IN S2 ==> x IN S1 ) +==> BIJ (inverse f) S2 S1 `, +REWRITE_TAC[BIJ; INJ; SURJ] THEN +ASM_MESON_TAC[F_INVERSE_F ]);; + + + + + + + + +let INVERSE_FUNCTION_OF_BIJ = prove_by_refinement( +`BIJ (f:A -> B) S1 S2 /\ g = (\x. if x IN S2 then (@t. t IN S1 /\ f t = x ) else tt ) +==> BIJ g S2 S1 `, +[REWRITE_TAC[BIJ; INJ; SURJ]; +STRIP_TAC; +SUBGOAL_THEN `(!x. (x:B) IN S2 ==> g x IN (S1: A -> bool) /\ f ( g x ) = x )` ASSUME_TAC; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM NHANH; +SIMP_TAC[]; +MESON_TAC[]; +(* ================= *) +CONJ_TAC; +ASM_MESON_TAC[]; +CONJ_TAC; +FIRST_X_ASSUM NHANH; +SIMP_TAC[]; +REPEAT STRIP_TAC; +EXISTS_TAC `(f:A -> B) x `; +ASM_MESON_TAC[]]);; + + + + + +let TOW_BIJS_IMP_BIJ_BETWEEN_FIRST = prove_by_refinement( +` BIJ (f:B -> A ) S1 V /\ BIJ (g:C -> A) S2 V /\ +ff = (\x. if x IN S1 then (@a. a IN S2 /\ f x = g a) else aa) +==> BIJ ff S1 S2 `, +[REWRITE_TAC[BIJ; INJ; SURJ]; +STRIP_TAC; +SUBGOAL_THEN ` (!x. (x:B) IN S1 ==> ff x IN (S2: C -> bool) /\ (f:B -> A) x = g ( ff x )) ` ASSUME_TAC; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +ASM_MESON_TAC[]; +ASM_MESON_TAC[]]);; + + + + + + + +let INDENT_IN_S1_IMP_BIJ = +prove(` BIJ (f: A -> B) S1 S2 /\ (! x. x IN S1 ==> f x = g x ) +==> BIJ g S1 S2 `, +REWRITE_TAC[BIJ; INJ; SURJ] THEN +MESON_TAC[]);; + + +let LOCAL_FAN_IMP_FAN = prove(` local_fan (V,E,FF) ==> FAN ( vec 0, V,E) `, +REWRITE_TAC[local_fan] THEN +LET_TAC THEN SIMP_TAC[]);; + + + + + + +let IN_ORBIT_MAP_IMP_F_Y = prove(` (y:A) IN orbit_map f x ==> f y IN orbit_map f x `, +REWRITE_TAC[orbit_map; IN_ELIM_THM] THEN +STRIP_TAC THEN +EXISTS_TAC ` n + 1 ` THEN +ASM_REWRITE_TAC[ARITH_RULE ` a >= 0 /\ +n + 1 = SUC n`; COM_POWER; I_THM; o_THM]);; + + + + + + +let SURJ_IMP_S2_EQ_IMAGE_S1 = prove(` SURJ (f:A ->B) S1 S2 ==> IMAGE f S1 = S2 `, +REWRITE_TAC[IMAGE; SURJ] THEN SET_TAC[]);; + + + + +let CYCLIC_SET_IMP_NOT_COLLINEAR = +prove_by_refinement( +` cyclic_set W (x:real^3) y ==> (! v. v IN W ==> ~ collinear {v,x,y}) `, +[REWRITE_TAC[TR_SET_RULE[]` x IN a <=> {x,x,x} SUBSET a `]; +STRIP_TAC THEN GEN_TAC; +DOWN THEN PHA; +ONCE_REWRITE_TAC[CONJ_SYM]; +NHANH Fan.subset_cyclic_set_fan; +NHANH Fan.properties_of_cyclic_set; +SIMP_TAC[INSERT_COMM]]);; + + + + + +let SLIDABLE_PROJECTION = +prove_by_refinement(` ~( e = vec 0) ==> projection e ( t % e + x ) = projection e x `, +[REWRITE_TAC[projection; DOT_LADD; +REAL_FIELD` (a + b ) / c = a / c + b / c `; VECTOR_ADD_RDISTRIB; +DOT_LMUL]; +SIMP_TAC[GSYM DOT_EQ_0; REAL_FIELD` ~( b = &0 ) ==> ( a * b ) / b = a `]; +DISCH_TAC; +VECTOR_ARITH_TAC]);; + + + + + + +let LINEAR_PROJECTION = prove(` projection e (t % x ) = t % ( projection e x ) `, +REWRITE_TAC[projection; DOT_LMUL; REAL_ARITH ` ( a * b ) / c = a * ( b / c ) `; GSYM VECTOR_MUL_ASSOC; VECTOR_SUB_LDISTRIB]);; + + + + + +let IDENTIFY_AZIM_CYCLE = prove_by_refinement +(` ~( W SUBSET {p}) /\ ~collinear {p,v,w} /\ + cyclic_set W v w /\ ( ~(u = p) /\ W u ) /\ +(!q. ~(q = p) /\ W q + ==> azim v w p u < azim v w p q \/ + azim v w p u = azim v w p q /\ + norm (projection (w - v) (u - v)) <= + norm (projection (w - v) (q - v))) +==> azim_cycle W v w p = u `, +[ABBREV_TAC ` uu = azim_cycle W v w (p:real^3) `; +STRIP_TAC; +SUBGOAL_THEN` ~( uu = p) /\ W (uu:real^3) /\ +(!q. ~(q = p) /\ W q + ==> azim v w p uu < azim v w p q \/ + azim v w p uu = azim v w p q /\ + norm (projection (w - v) (uu - v)) <= + norm (projection (w - v) (q - v))) ` ASSUME_TAC; +EXPAND_TAC "uu"; +UNDISCH_TAC ` ~(W SUBSET {p:real^3} ) `; +SIMP_TAC[azim_cycle]; +DISCH_TAC; +CONV_TAC SELECT_CONV; +EXISTS_TAC `u:real^3 `; +ASM_REWRITE_TAC[]; +DOWN THEN STRIP_TAC; +UNDISCH_TAC `(W:real^3 -> bool) (u:real^3) `; +UNDISCH_TAC `~( u = (p:real^3)) `; +PHA; +FIRST_X_ASSUM NHANH; +DISCH_TAC; +UNDISCH_TAC `(W:real^3 -> bool) (uu:real^3) `; +UNDISCH_TAC `~( uu = (p:real^3)) `; +PHA; +FIRST_ASSUM NHANH; +DOWN THEN STRIP_TAC; +STRIP_TAC; +ASM_REAL_ARITH_TAC; +ASM_REAL_ARITH_TAC; +STRIP_TAC; +ASM_REAL_ARITH_TAC; +UNDISCH_TAC `cyclic_set W v (w:real^3) `; +NHANH CYCLIC_SET_IMP_NOT_COLLINEAR; +REWRITE_TAC[IN]; +STRIP_TAC; +UNDISCH_TAC `(W:real^3 -> bool) u `; +UNDISCH_TAC `(W:real^3 -> bool) uu `; +FIRST_ASSUM NHANH; +STRIP_TAC THEN STRIP_TAC; +MP_TAC (MESON[AZIM_EQ]`~collinear {v, w, (p:real^3)} /\ + ~collinear {v, w, u} /\ + ~collinear {v, w, uu} /\ + azim v w p u = azim v w p uu +==> uu IN aff_gt {v,w} {u}`); +ANTS_TAC; +SIMP_TAC[INSERT_COMM]; +CONJ_TAC; +FIRST_ASSUM ACCEPT_TAC; +CONJ_TAC; +FIRST_ASSUM ACCEPT_TAC; +CONJ_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +DOWN; +NHANH (MESON[COLLINEAR_2; INSERT_INSERT; INSERT_COMM]` +~ collinear {a,b,c} ==> ~( a = b ) /\ ~( a = c )`); +REWRITE_TAC[TR_SET_RULE[]`~(u = v) /\ ~(u = w) <=> DISJOINT {v,w} {u} `]; +NHANH AFF_GT_2_1; +SIMP_TAC[IN_ELIM_THM]; +STRIP_TAC; +STRIP_TAC; +UNDISCH_TAC` norm (projection (w - v) (uu - v)) <= norm (projection (w - v) (u - (v:real^3))) `; +UNDISCH_TAC `norm (projection (w - v) (u - v)) <= norm (projection (w - v) (uu - (v:real^3)))`; +PHA; +REWRITE_TAC[REAL_ARITH` a <= b /\ b <= a <=> a = b `]; +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` t1 + t2 + t3 = &1 `; +SIMP_TAC[REAL_ARITH` a + b = &1 <=> a = &1 - b `; +VECTOR_ARITH` (((&1 - (t2 + t3)) % v + t2 % w + t3 % u) - v) = +t2 % ( w - v ) + t3 % ( u - v ) `]; +UNDISCH_TAC ` cyclic_set W v (w:real^3) `; +REWRITE_TAC[cyclic_set]; +ONCE_REWRITE_TAC[VECTOR_ARITH` a = b <=> b - a = vec 0 `]; +SIMP_TAC[SLIDABLE_PROJECTION; LINEAR_PROJECTION]; +REWRITE_TAC[NORM_MUL; REAL_FIELD` a = x * a <=> a = &0 \/ x = &1 `]; +REPEAT STRIP_TAC; +DOWN; +REWRITE_TAC[NORM_EQ_0; projection]; +REWRITE_TAC[VECTOR_ARITH` u - v - x % ( w - v ) = vec 0 <=> +u = (&1 - x ) % v + x % w `]; +DISCH_TAC; +SUBGOAL_THEN` (u:real^3) IN aff {v,w} ` ASSUME_TAC; +REWRITE_TAC[AFF2; IN_ELIM_THM]; +DOWN; +MESON_TAC[REAL_ARITH` a = &1 - (&1 - a ) `]; +UNDISCH_TAC`~(w - (v:real^3) = vec 0 ) `; +REWRITE_TAC[VECTOR_SUB_EQ]; +NHANH NOT_EQ_IMP_AFF_AND_COLL3; +SIMP_TAC[INSERT_COMM]; +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +ASM_MESON_TAC[]; +ASSUME_TAC2 (SPEC `t3:real ` (GEN_ALL LT_IMP_ABS_REFL)); +DOWN THEN ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` uu + ( -- t1) % ( v - w ) - (u:real^3) = vec 0 ` ASSUME_TAC; +ASM_REWRITE_TAC[]; +EXPAND_TAC "t3"; +VECTOR_ARITH_TAC; +DOWN; +UNDISCH_TAC`(W:real^3 -> bool) uu `; +UNDISCH_TAC `(W:real^3 -> bool) u `; +PHA; +REWRITE_TAC[VECTOR_ARITH` a + b - (c:real^N) = (a + b ) - c `]; +FIRST_ASSUM NHANH; +STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[]; +VECTOR_ARITH_TAC]);; + + + + +(* *) + +let EXISTS_SMALLEST_ELMS = prove_by_refinement +(` FINITE W /\ ~(W = {} ) /\ +(! x (y:A). ll x y \/ ll y x ) /\ +(! x y z. ll x y /\ ll y z ==> ll x z ) +==> ? v. v IN W /\ (! w. w IN W ==> ll v w ) `, +[WF_INDUCT_TAC `CARD (W:A -> bool) `; +REWRITE_TAC[TR_SET_RULE[]`~( a = {}) <=> ? x. x IN a `]; +STRIP_TAC; +ASSUME_TAC2 (ISPECL [`W:A -> bool`;`x:A`] CARD_MINUS_ONE); +DOWN; +NHANH (ARITH_RULE` a = b + 1 ==> b < a `); +FIRST_ASSUM NHANH; +UNDISCH_TAC `!(W':A -> bool). CARD W' < CARD (W:A -> bool) + ==> FINITE W' /\ + ~(W' = {}) /\ + (!x y. ll (x:A) (y:A) \/ ll y x) /\ + (!x y z. ll x y /\ ll y z ==> ll x z) + ==> (?v. v IN W' /\ (!w. w IN W' ==> ll v w)) `; +DISCH_TAC; +FIRST_ASSUM NHANH; +STRIP_TAC THEN DOWN; +ASM_CASES_TAC ` W = {x:A} `; +REMOVE_TAC; +EXISTS_TAC `x:A`; +ASM_SIMP_TAC[IN_ELIM_THM; IN_SING]; +UNDISCH_TAC `! x y. (ll:A -> A -> bool) x y \/ ll y x `; +MESON_TAC[]; +ASSUME_TAC2 (TR_SET_RULE[]` (x:A) IN W /\ ~(W = {x}) ==> ~(W DELETE x = {}) `); +ANTS_TAC; +ASM_SIMP_TAC[FINITE_DELETE]; +FIRST_X_ASSUM ACCEPT_TAC; +STRIP_TAC; +USE_FIRST `! x y. (ll: A -> A -> bool) x y \/ ll y x ` (DISJ_CASES_TAC o (SPECL[` x:A `;` v:A`])); +EXISTS_TAC `x:A`; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 ( +TR_SET_RULE[]` x:A IN W ==> (! a. a IN W <=> a IN (W DELETE x) \/ a = x )`); +ASM_REWRITE_TAC[]; +ASM_MESON_TAC[]; +EXISTS_TAC `v:A`; +ASSUME_TAC2 (TR_SET_RULE[]` (v:A) IN W DELETE x ==> v IN W`); +ASM_REWRITE_TAC[]; +ASSUME_TAC2 ( +TR_SET_RULE[]` x:A IN W ==> (! a. a IN W <=> a IN (W DELETE x) \/ a = x )`); +ASM_REWRITE_TAC[]; +ASM_MESON_TAC[]]);; + + + + + + + +let EXIS_SMALLEST_WITH_AZIM_ORD = prove_by_refinement +(`~(W SUBSET {p}) /\ FINITE W +==> ?u. + (~(u = p) /\ W u) /\ + (!q. ~(q = p) /\ W q + ==> azim v w p u < azim v w p q \/ + azim v w p u = azim v w p q /\ + norm (projection (w - v) (u - v)) <= + norm (projection (w - v) (q - v))) `, +[ABBREV_TAC ` ll (u:real^3) (q:real^3) <=> + ~ (W:real^3 -> bool) u \/ W u /\ W q /\ + ( azim v w p u < azim v w p q \/ + azim v w p u = azim v w p q /\ + norm (projection (w - v) (u - v)) <= + norm (projection (w - v) (q - v)))`; +STRIP_TAC; +MP_TAC (ISPECL [`(W:real^3 -> bool) DELETE p`;` ll:real^3 -> real^3 -> bool` ] (GEN_ALL EXISTS_SMALLEST_ELMS)); +ANTS_TAC; +DOWN_TAC; +SIMP_TAC[cyclic_set]; +NHANH (TR_SET_RULE[]` ~( a SUBSET {b}) ==> ~(a DELETE b = {}) `); +SIMP_TAC[FINITE_DELETE]; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +STRIP_TAC; +CONJ_TAC; +ASM_REWRITE_TAC[REAL_LE_REFL]; +GEN_TAC THEN GEN_TAC; +ASM_CASES_TAC ` ~ (W:real^3 -> bool) x `; +REPEAT DISJ1_TAC; +FIRST_ASSUM ACCEPT_TAC; +ASM_CASES_TAC ` ~ (W:real^3 -> bool) y `; +DISJ2_TAC; +DISJ1_TAC; +FIRST_ASSUM ACCEPT_TAC; +DOWN THEN DOWN THEN PHA; +SIMP_TAC[]; +DISCH_TAC; +REAL_ARITH_TAC; +REPEAT GEN_TAC; +ASM_REWRITE_TAC[]; +IMP_TAC THEN DISCH_TAC; +FIRST_X_ASSUM DISJ_CASES_TAC; +ASM_REWRITE_TAC[]; +DISCH_TAC; +FIRST_X_ASSUM DISJ_CASES_TAC; +DOWN THEN MATCH_MP_TAC (TAUT` a ==> ~ a ==> b `); +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM (CONJUNCTS_THEN ASSUME_TAC); +FIRST_X_ASSUM (CONJUNCTS_THEN ASSUME_TAC); +DISJ2_TAC; +DOWN; +FIRST_X_ASSUM (CONJUNCTS_THEN ASSUME_TAC); +FIRST_X_ASSUM (CONJUNCTS_THEN ASSUME_TAC); +DOWN THEN PHA; +ASM_REWRITE_TAC[]; +REAL_ARITH_TAC; + + +DOWN_TAC THEN ONCE_REWRITE_TAC[EQ_SYM_EQ]; +STRIP_TAC; +DOWN; +DOWN; +ASM_REWRITE_TAC[IN_DELETE; IN]; +SIMP_TAC[EQ_SYM_EQ]; +STRIP_TAC; +STRIP_TAC; +EXISTS_TAC`v':real^3 `; +REPLICATE_TAC 3 DOWN THEN PHA; +SIMP_TAC[CONJ_SYM]; +MESON_TAC[]]);; + + + + + + + +let AZIM_CYCLE_PROPERTIES = prove_by_refinement +(` ~(W SUBSET {p}) /\ FINITE W ==> +~(azim_cycle W v w p = p) /\ W (azim_cycle W v w p) /\ + (!q. ~(q = p) /\ W q + ==> azim v w p (azim_cycle W v w p) < azim v w p q \/ + azim v w p (azim_cycle W v w p) = azim v w p q /\ + norm (projection (w - v) ((azim_cycle W v w p) - v)) <= + norm (projection (w - v) (q - v))) `, +[NHANH EXIS_SMALLEST_WITH_AZIM_ORD; +STRIP_TAC; +REWRITE_TAC[azim_cycle]; +ASM_SIMP_TAC[]; +CONV_TAC SELECT_CONV; +EXISTS_TAC `u:real^3 `; +ASM_SIMP_TAC[]]);; + + + +let PROJECT_EQ_VEC0_IMP_PARALLED = prove( +` projection e x = vec 0 ==> (?t. x = t % e ) `, +REWRITE_TAC[projection; VECTOR_SUB_EQ] +THEN MESON_TAC[]);; + + + + + +let PROJECTION_VEC0 = prove(` projection e ( vec 0 ) = vec 0 `, +REWRITE_TAC[projection; DOT_LZERO; REAL_ARITH` &0 / d = &0 `] +THEN VECTOR_ARITH_TAC);; + + + +(* removed 2011-08-01, thales : +let azim_cycle2 = new_definition +` azim_cycle2 W v w p = + (if W SUBSET {p} + then p + else let le = + (\u q. + azim v w (CHOICE W) u < azim v w (CHOICE W) q \/ + azim v w (CHOICE W) u = azim v w (CHOICE W) q /\ + norm (projection (w - v) (u - v)) <= + norm (projection (w - v) (q - v))) in + @u. ~(u = p) /\ + W u /\ + le p u /\ + (!q. ~(q = p) /\ W q /\ le p q ==> le u q) \/ + ~(u = p) /\ W u /\ (!q. W q ==> le u q)) `;; +let W_SUBSET_SINGLETON_IMP_IDE2 = prove( +` W SUBSET {p} ==> azim_cycle2 W v w p = p `, SIMP_TAC[azim_cycle2]);; +*) + + + + + +let LE_ORD_IS_ASSYMETRY = prove_by_refinement +(` let le = (\u q. + azim v w (CHOICE W) u < azim v w (CHOICE W) q \/ + azim v w (CHOICE W) u = azim v w (CHOICE W) q /\ + norm (projection (w - v) (u - v)) <= + norm (projection (w - v) (q - v))) +in cyclic_set W v w /\ {x,y} SUBSET W /\ le x y /\ le y x +==> x = y `, +[LET_TAC; +EXPAND_TAC "le"; +REWRITE_TAC[REAL_ARITH`( a < b \/ a = b /\ x <= y ) /\ +( b < a \/ b = a /\ y <= x ) <=> a = b /\ x = y `]; +ASM_CASES_TAC ` (W:real^3 -> bool) = {} `; +ASM_REWRITE_TAC[INSERT_SUBSET; NOT_IN_EMPTY]; +DOWN THEN NHANH CHOICE_DEF; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +NHANH CYCLIC_SET_IMP_NOT_COLLINEAR; +STRIP_TAC; +IMP_TAC THEN STRIP_TAC; +UNDISCH_TAC ` CHOICE (W:real^3 -> bool) IN W `; +FIRST_ASSUM NHANH; +REPEAT STRIP_TAC; +SUBGOAL_THEN ` azim v w (CHOICE W) x = azim v w (CHOICE W) y <=> +x IN aff_gt {v, w} {y}` ASSUME_TAC; +MATCH_MP_TAC AZIM_EQ_ALT; +DOWN_TAC; +SIMP_TAC[INSERT_COMM]; +FIRST_X_ASSUM SUBST_ALL_TAC; +REPLICATE_TAC 3 DOWN THEN PHA; +NHANH th3b; +NHANH th3b1; +REWRITE_TAC[SET_RULE` (a /\ ~( y = w )) /\ ~( y = u) <=> a /\ DISJOINT {u,w} {y} `]; +NHANH AFF_GT_2_1; +IMP_TAC THEN STRIP_TAC; +ASM_REWRITE_TAC[IN_ELIM_THM]; +REWRITE_TAC[REAL_ARITH` a + b + c = d <=> c = d - a - b `]; +IMP_TAC THEN STRIP_TAC; +ASM_REWRITE_TAC[]; +REWRITE_TAC[VECTOR_ARITH` (t1 % v + t2 % w + (&1 - t1 - t2) % y) - v = +t2 % ( w - v ) + (&1 - t1 - t2 ) % ( y - v ) `]; +UNDISCH_TAC` cyclic_set W (v:real^3) w `; +REWRITE_TAC[cyclic_set]; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +IMP_TAC; +PAT_ONCE_REWRITE_TAC `\x. x ==> y `[GSYM VECTOR_SUB_EQ]; +NHANH (MESON[SLIDABLE_PROJECTION]` ~ ( e = vec 0) ==> (! t x. projection e +( t % e + x ) = projection e x )`); +STRIP_TAC; +ASM_REWRITE_TAC[LINEAR_PROJECTION; NORM_MUL; REAL_RING` a = b * a <=> b = &1 \/ a = &0 `]; +STRIP_TAC THEN DISCH_THEN DISJ_CASES_TAC; +DOWN; +UNDISCH_TAC ` t3 = &1 - t1 - t2 `; +UNDISCH_TAC ` &0 < t3 `; +NHANH LT_IMP_ABS_REFL; +STRIP_TAC; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +DISCH_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +USE_FIRST ` (x:real^3) = t1 % v + t2 % w + t3 % y ` MP_TAC; +EXPAND_TAC "t3"; +ASSUME_TAC2 (REAL_ARITH` &1 - t1 - t2 = t3 /\ &1 = t3 ==> t2 = -- t1 `); +DOWN THEN SIMP_TAC[] THEN STRIP_TAC; +REWRITE_TAC[VECTOR_ARITH` x = t1 % v + --t1 % w + &1 % y <=> y + t1 % +(v - w ) = x `]; +UNDISCH_TAC` (y:real^3) IN W `; +UNDISCH_TAC` (x:real^3) IN W `; +PHA; +REWRITE_TAC[IN]; +FIRST_X_ASSUM NHANH; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +SIMP_TAC[EQ_SYM_EQ]; +DOWN; +REWRITE_TAC[NORM_EQ_0]; +NHANH PROJECT_EQ_VEC0_IMP_PARALLED; +STRIP_TAC; +DOWN; +UNDISCH_TAC ` ~( w - (v:real^3) = vec 0 ) `; +REWRITE_TAC[VECTOR_SUB_EQ]; +NHANH (SPECL [`a:real^3 `;` b:real^3 `;`y:real^3 `] + (Collect_geom.NOT_TWO_EQ_IMP_COL_EQUAVALENT)); +REPEAT STRIP_TAC; +SUBGOAL_THEN ` collinear {(y:real^3), w, v}` ASSUME_TAC; +ASM_REWRITE_TAC[AFF2; IN_ELIM_THM]; +EXISTS_TAC `t:real `; +DOWN; +VECTOR_ARITH_TAC; +MATCH_MP_TAC (TAUT` F ==> h `); +DOWN; REWRITE_TAC[]; +ONCE_REWRITE_TAC[SET_RULE` {a,b} = {b,a}`]; +FIRST_ASSUM ACCEPT_TAC]);; + + + +let LE_ORD_IS_ASSYMETRY2 = +REWRITE_RULE[let_CONV (concl LE_ORD_IS_ASSYMETRY); +REAL_ARITH` ( a < b \/ a = b /\ x <= y ) /\ ( b < a \/ b = a /\ y <= x ) +<=> a = b /\ x = y `] +LE_ORD_IS_ASSYMETRY;; + + + + + + +let W_SUBSET_SINGLETON_IMP_IDE = +prove(` W SUBSET {p} ==> azim_cycle W v w p = p `, +SIMP_TAC[azim_cycle]);; + + + + + + +let AZIM_CYCLE_EQ_SIGMA_FAN = prove_by_refinement +(` FAN ((x:real^3),V,E) /\ u IN set_of_edge v V E ==> +azim_cycle (EE v E) x v u = sigma_fan x V E v u `, +[REWRITE_TAC[sigma_fan;FAN]; +NHANH UNI_E_IMP_EE_EQ_SET_OF_EDGE; +SIMP_TAC[]; +STRIP_TAC; +ASM_CASES_TAC ` set_of_edge (v:real^3) V E SUBSET {u} `; +ASM_SIMP_TAC[W_SUBSET_SINGLETON_IMP_IDE]; +DOWN THEN DOWN THEN PHA; +NHANH (SET_RULE` u IN S /\ S SUBSET {u} ==> S = {u} `); +STRIP_TAC THEN ASM_REWRITE_TAC[]; +REWRITE_TAC[GSYM sigma_fan]; +UNDISCH_TAC `fan1 ((x:real^3),(V:real^3 -> bool),(E: (real^3 -> bool) -> bool)) `; +REWRITE_TAC[fan1]; +NHANH remark_finite_fan1; +STRIP_TAC; +UNDISCH_TAC ` FINITE (set_of_edge (v:real^3) V E) `; +UNDISCH_TAC ` ~( set_of_edge (v:real^3) V E SUBSET {u})`; +PHA; +NHANH ( +SPECL [`W:real^3 -> bool`;` p:real^3` ;`v:real^3`;` x:real^3`] +(GEN_ALL AZIM_CYCLE_PROPERTIES)); +STRIP_TAC; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +MATCH_MP_TAC UNIQUE_SIGMA_FAN; +ASM_REWRITE_TAC[FAN; IN; fan1]; +CONJ_TAC; +MATCH_MP_TAC (SET_RULE` u IN S /\ ~( S SUBSET {u}) ==> ~( S = {u}) `); +ASM_REWRITE_TAC[]; +ONCE_REWRITE_TAC[TAUT` a /\ b <=> b /\ a `]; +FIRST_X_ASSUM NHANH; +GEN_TAC THEN IMP_TAC; +STRIP_TAC; +REAL_ARITH_TAC]);; + + + + + +let IVS_AZIM_AS_SIGMA_FAN = prove( +` FAN (x,V,E) /\ u IN set_of_edge v V E +==> ivs_azim_cycle (set_of_edge v V E) x v u = + @xx. xx IN set_of_edge v V E /\ sigma_fan x V E v xx = u`, +NHANH (REWRITE_RULE[ RIGHT_FORALL_IMP_THM; TAUT ` a/\ b ==> c +<=> a ==> b ==> c `] (GEN_ALL AZIM_CYCLE_EQ_SIGMA_FAN)) THEN +REWRITE_TAC[ivs_azim_cycle] THEN +NHANH_PAT `\x. y /\ x ==> i ` (SET_RULE ` x IN a ==> ~( a = {} ) `) THEN +SIMP_TAC[FAN; fan1] THEN +NHANH UNI_E_IMP_EE_EQ_SET_OF_EDGE THEN +STRIP_TAC THEN +DOWN THEN +ASM_REWRITE_TAC[] THEN +SIMP_TAC[] THEN +FIRST_X_ASSUM NHANH THEN +ASM_REWRITE_TAC[] THEN +PHA THEN +REWRITE_TAC[MESON[]` a = b /\ a = c <=> a = b /\ b = c `]);; + + + + + + + + +let IVS_AZIM_PROPERTIES = prove_by_refinement +(` FAN (x,V,E) /\ u IN set_of_edge v V E +==> ivs_azim_cycle (set_of_edge v V E) x v u IN set_of_edge v V E /\ +sigma_fan x V E v (ivs_azim_cycle (set_of_edge v V E) x v u) = u `, +[STRIP_TAC; +ASSUME_TAC2 IVS_AZIM_AS_SIGMA_FAN; +ASM_REWRITE_TAC[]; +CONV_TAC SELECT_CONV; +MP_TAC (SPEC_ALL SUR_SIGMA_FAN); +ANTS_TAC; +ASM_REWRITE_TAC[]; +DOWN_TAC; +SIMP_TAC[set_of_edge; IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC ` w:real^3 `; +ASM_REWRITE_TAC[set_of_edge; IN_ELIM_THM]; +MATCH_MP_TAC (SET_RULE` UNIONS E SUBSET V /\ x IN UNIONS E ==> x IN V `); +DOWN_TAC; +REWRITE_TAC[FAN; fan1]; +SIMP_TAC[IN_UNIONS]; +STRIP_TAC; +EXISTS_TAC ` {v,(w:real^3) }`; +ASM_REWRITE_TAC[]; +SET_TAC[]]);; + + + + + + + +let IVS_AZIM_EQ_INVERSE_SIGMA_FAN = prove_by_refinement +(`FAN (x,V,E) /\ {v,u} IN E +==> ivs_azim_cycle (EE v E ) x v u = inverse1_sigma_fan x V E v u `, +[STRIP_TAC; +ASSUME_TAC2 properties_of_set_of_edge_fan; +UNDISCH_TAC ` {v,u:real^3 } IN E `; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASSUME_TAC2 IVS_AZIM_PROPERTIES; +ASSUME_TAC2 INVERSE1_SIGMA_FAN; +SUBGOAL_THEN ` {v,u:real^3} IN E ` MP_TAC; +ASM_REWRITE_TAC[]; +DOWN THEN STRIP_TAC; +DOWN THEN FIRST_X_ASSUM NHANH; +FIRST_X_ASSUM NHANH; +REPEAT STRIP_TAC; +MATCH_MP_TAC (SPEC_ALL MONO_SIGMA_FAN); +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` FAN ((x:real^3),V,E) `; +REWRITE_TAC[FAN; fan1]; +SIMP_TAC[UNI_E_IMP_EE_EQ_SET_OF_EDGE]; +ASM_REWRITE_TAC[]]);; + + + + + + + +let IVS_AZIM_EQ_INVERSE_SIGMA_FAN2 = prove(`FAN (x,V,E) /\ {v, u} IN E + ==> ivs_azim_cycle (set_of_edge v V E) x v u = + inverse1_sigma_fan x V E v u `, +NHANH IVS_AZIM_EQ_INVERSE_SIGMA_FAN THEN +REWRITE_TAC[FAN; fan1] THEN +NHANH UNI_E_IMP_EE_EQ_SET_OF_EDGE THEN +IMP_TAC THEN STRIP_TAC THEN +ASM_REWRITE_TAC[]);; + + + + + + +let EE_OF_HYP_PERMUTES_DARTS = prove_by_refinement +(` (ee_of_hyp (x,V,E) ) permutes ( darts_of_hyp E V )`, +[REWRITE_TAC[permutes]; +CONJ_TAC; +SIMP_TAC[ee_of_hyp2]; +REWRITE_TAC[EXISTS_UNIQUE; ee_of_hyp2]; +GEN_TAC; +ASM_CASES_TAC ` y IN darts_of_hyp E (V:real^3 -> bool) `; +EXISTS_TAC `SND (y:real^3 # real^3 ), FST y `; +DOWN; +NHANH_PAT `\x. x ==> l ` V_IN_DARTS_IMP_SWICH_SO_DO; +SIMP_TAC[]; +STRIP_TAC; +GEN_TAC THEN COND_CASES_TAC; +DISCH_TAC; +EXPAND_TAC "y"; +REWRITE_TAC[]; +ASM_MESON_TAC[]; +EXISTS_TAC ` y:real^3 # real^3 `; +ASM_REWRITE_TAC[]; +GEN_TAC THEN COND_CASES_TAC; +DOWN; +NHANH V_IN_DARTS_IMP_SWICH_SO_DO; +ASM_MESON_TAC[]; +REWRITE_TAC[]]);; + + + +let EE_SUBSET_UNIONS_E = prove_by_refinement +(` EE (v:A) E SUBSET UNIONS E `, +[REWRITE_TAC[EE]; +REWRITE_TAC[SUBSET]; +GEN_TAC; +REWRITE_TAC[IN_ELIM_THM; IN_UNIONS]; +STRIP_TAC; +EXISTS_TAC ` ({v,(x:A) }) `; +ASM_REWRITE_TAC[]; +SET_TAC[]]);; + + +let FAN_IMP_FINITE_EE = prove(` + FAN ((x:real^3),V,E) ==> FINITE ( EE v E ) `, +REWRITE_TAC[FAN;fan2; fan1] THEN +PHA THEN ONCE_REWRITE_TAC[TAUT` a /\ b /\ c /\ d <=> (c /\ a ) /\ b /\ d `] +THEN NHANH FINITE_SUBSET THEN +MESON_TAC[EE_SUBSET_UNIONS_E; FINITE_SUBSET]);; + + + + +let SMOOTH_GEN_ALL t = +REWRITE_RULE[ RIGHT_FORALL_IMP_THM; TAUT ` a/\ b ==> c <=> a ==> b ==> c `] (GEN_ALL t);; + +let W_SUBSET_SINGLETON_IMP_IDE = +SMOOTH_GEN_ALL (GENL [`v:real^3 `;`w:real^3`] W_SUBSET_SINGLETON_IMP_IDE);; + + + +let IN_SELF_PAIRS_IMP_EE_EMPTY = prove( +` x IN self_pairs E V ==> EE (FST x) E = {} `, +REWRITE_TAC[self_pairs; IN_ELIM_THM; EE] THEN +STRIP_TAC THEN ASM_REWRITE_TAC[]);; + + + + +let IN_DARTS_IFF_NN_OF_HYP_TOO = prove_by_refinement +(` FAN (x,V,E) ==> +( y IN darts_of_hyp E V <=> nn_of_hyp (x,V,E) y IN darts_of_hyp E V )`, +[DISCH_TAC THEN EQ_TAC; + +SIMP_TAC[nn_of_hyp2; darts_of_hyp; IN_UNION]; +STRIP_TAC; +DISJ1_TAC; +DOWN; +NHANH IN_ORD_PAIRS_IMP_SND_IN_EE_FST; +REWRITE_TAC[ord_pairs; IN_ELIM_THM]; +ASSUME_TAC2 (SPEC `FST (y:real^3 # real^ 3) ` (GEN `v:real^3` FAN_IMP_FINITE_EE)); +STRIP_TAC; +DOWN; +ASM_CASES_TAC ` (EE (FST y) E) SUBSET {SND (y:real^3 # real^3 )} `; +DOWN; +NHANH W_SUBSET_SINGLETON_IMP_IDE; +SIMP_TAC[]; +ASM_MESON_TAC[]; +STRIP_TAC; +UNDISCH_TAC ` FINITE (EE (FST (y:real^3 # real^3)) E)`; +UNDISCH_TAC ` ~(EE ((FST y):real^3) E SUBSET {SND y}) `; +PHA; +NHANH (REWRITE_RULE[TAUT` a ==> b ==> c <=> a /\ b ==> c `] +(SMOOTH_GEN_ALL AZIM_CYCLE_PROPERTIES)); +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPECL [` FST (y:real^3 # real^ 3) `;` x:real^3 `])); +STRIP_TAC; +ASM_REWRITE_TAC[IN]; +UNDISCH_TAC `EE (FST y) E (azim_cycle (EE (FST y) E) x (FST y) (SND y)) `; +ASM_REWRITE_TAC[]; +REWRITE_TAC[EE; IN_ELIM_THM; IN]; +MESON_TAC[]; +DISJ2_TAC; +DOWN; +NHANH IN_SELF_PAIRS_IMP_EE_EMPTY; +SIMP_TAC[azim_cycle; EMPTY_SUBSET]; +ONCE_REWRITE_TAC[TAUT` a ==> b <=> ~ b ==> ~ a `]; +SIMP_TAC[nn_of_hyp2]]);; + + + + + + +let IN_E_IMP_IMP_IN_DARTS = prove( +` {a,b} IN E ==> (a,b) IN darts_of_hyp E V `, +REWRITE_TAC[darts_of_hyp; IN_UNION] THEN +STRIP_TAC THEN DISJ1_TAC THEN +REWRITE_TAC[ord_pairs; IN_ELIM_THM] +THEN ASM_MESON_TAC[]);; + + + + + +let PAIR_EQ2 = +MESON[PAIR; PAIR_EQ]` (a:A#B) = b <=> FST a = FST b /\ SND a = SND b `;; + + + +let IN_ORD_E_EQ_IN_E = prove( +` x IN ord_pairs E <=> {FST x, SND x } IN E `, +REWRITE_TAC[ord_pairs; IN_ELIM_THM; PAIR_EQ2] +THEN MESON_TAC[]);; + + + + + +let FAN_IMP_NN_OF_HYP_PERMUTES_DARTS = prove_by_refinement +(`FAN (x,V,E) ==> nn_of_hyp (x,V,E) permutes darts_of_hyp E V `, +[REWRITE_TAC[permutes]; +STRIP_TAC; +CONJ_TAC; +SIMP_TAC[nn_of_hyp2]; +GEN_TAC THEN REWRITE_TAC[EXISTS_UNIQUE]; +ASM_CASES_TAC ` y IN darts_of_hyp E (V:real^3 -> bool) `; +ASSUME_TAC2 (SMOOTH_GEN_ALL INVERSE1_SIGMA_FAN); +FIRST_X_ASSUM (MP_TAC o SPEC `FST (y:real^3 # real^3)`); +STRIP_TAC; +DOWN; +FIRST_X_ASSUM (MP_TAC o SPEC `SND (y:real^3 # real^3)`); +REPEAT STRIP_TAC; +ASM_CASES_TAC ` (y:real^3 # real^3) IN self_pairs E V `; +EXISTS_TAC `y:real^3 # real^3 `; +REWRITE_TAC[nn_of_hyp2]; +ASM_REWRITE_TAC[]; +DOWN; +REWRITE_TAC[self_pairs; IN_ELIM_THM]; +STRIP_TAC; +ASM_SIMP_TAC[W_SUBSET_SINGLETON_IMP_IDE; EMPTY_SUBSET]; +GEN_TAC; +COND_CASES_TAC; +REWRITE_TAC[PAIR_EQ]; +DOWN; +REWRITE_TAC[darts_of_hyp; IN_UNION]; +STRIP_TAC; +DOWN; +REWRITE_TAC[ord_pairs; IN_ELIM_THM]; +ASSUME_TAC2 (SMOOTH_GEN_ALL properties_of_set_of_edge_fan); +ASM_REWRITE_TAC[]; +STRIP_TAC; +STRIP_TAC; +UNDISCH_TAC ` b IN set_of_edge (a:real^3) V E`; +UNDISCH_TAC ` FAN ((x:real^3),V,E) `; +PHA; +NHANH sigma_fan_in_set_of_edge; +NHANH AZIM_CYCLE_EQ_SIGMA_FAN; +DOWN; +DOWN; +ASM_REWRITE_TAC[]; +PHA; +IMP_TAC; +ASM_SIMP_TAC[EMPTY_SUBSET; W_SUBSET_SINGLETON_IMP_IDE]; +IMP_TAC; +ASM_SIMP_TAC[EMPTY_SUBSET; W_SUBSET_SINGLETON_IMP_IDE]; +ONCE_REWRITE_TAC[GSYM PAIR]; +REWRITE_TAC[PAIR_EQ]; +ASM_SIMP_TAC[]; +SIMP_TAC[]; +EXISTS_TAC ` FST y, inverse1_sigma_fan x V E (FST y) (SND y) `; +SUBGOAL_THEN ` nn_of_hyp (x,V,E) (FST y,inverse1_sigma_fan x V E (FST y) (SND y)) = y ` ASSUME_TAC; +REWRITE_TAC[nn_of_hyp]; +UNDISCH_TAC ` y IN darts_of_hyp E (V:real^3 -> bool) `; +PAT_REWRITE_TAC `\x. x ==> y ` [darts_of_hyp]; +ASM_REWRITE_TAC[IN_UNION]; +REWRITE_TAC[ord_pairs; IN_ELIM_THM]; +STRIP_TAC; +SUBGOAL_THEN ` {FST (y:real^3 # real^3), +inverse1_sigma_fan x V E (FST y) b} IN E ` ASSUME_TAC; +ASM_MESON_TAC[PAIR; PAIR_EQ]; +DOWN THEN NHANH IN_E_IMP_IMP_IN_DARTS; +STRIP_TAC THEN ASM_SIMP_TAC[]; +DOWN THEN ASM_SIMP_TAC[]; + +STRIP_TAC; +REWRITE_TAC[PAIR_EQ]; +SUBGOAL_THEN ` (inverse1_sigma_fan x V E a b) IN set_of_edge a V E ` +ASSUME_TAC; +ASSUME_TAC2 (SMOOTH_GEN_ALL properties_of_set_of_edge_fan); +FIRST_X_ASSUM (fun c -> REWRITE_TAC[GSYM c]); +DOWN THEN DOWN; +ASM_REWRITE_TAC[TAUT ` a ==> b ==> a `]; +DOWN; +UNDISCH_TAC `FAN (x:real^3, V, E) `; +PHA; +NHANH AZIM_CYCLE_EQ_SIGMA_FAN; +ASM_SIMP_TAC[]; +STRIP_TAC; +UNDISCH_TAC ` {FST (y:real^3 # real^3), SND y} IN E + ==> sigma_fan x V E (FST y) (inverse1_sigma_fan x V E (FST y) (SND y)) = + SND y `; +ANTS_TAC; +ASM_SIMP_TAC[]; +ASM_SIMP_TAC[]; +ASM_REWRITE_TAC[]; +GEN_TAC; +ASSUME_TAC2 (SMOOTH_GEN_ALL (GEN `y:real^3 # real^3` IN_DARTS_IFF_NN_OF_HYP_TOO)); +REWRITE_TAC[nn_of_hyp2]; +COND_CASES_TAC; +REWRITE_TAC[PAIR_EQ2]; +ASM_SIMP_TAC[]; +UNDISCH_TAC` nn_of_hyp (x,V,E) (FST y,inverse1_sigma_fan x V E (FST y) (SND y)) = y `; +REWRITE_TAC[nn_of_hyp2]; +UNDISCH_TAC ` (y:real^3 # real^3) IN darts_of_hyp E V `; +REWRITE_TAC[darts_of_hyp; IN_UNION]; +ASM_SIMP_TAC[IN_ORD_E_EQ_IN_E]; +REWRITE_TAC[PAIR_EQ2]; +REPEAT STRIP_TAC; +SUBGOAL_THEN ` (inverse1_sigma_fan x V E (FST y) (SND y)) IN +set_of_edge (FST y) V E /\ +SND y' IN set_of_edge (FST y') V E ` MP_TAC; +ASSUME_TAC2 (SMOOTH_GEN_ALL properties_of_set_of_edge_fan); +FIRST_ASSUM (fun x -> REWRITE_TAC[GSYM x]); +CONJ_TAC; +ASM_MESON_TAC[]; +UNDISCH_TAC ` y' IN darts_of_hyp E (V:real^3 -> bool) `; +REWRITE_TAC[darts_of_hyp; IN_UNION]; +STRIP_TAC; +DOWN; +REWRITE_TAC[IN_ORD_E_EQ_IN_E]; +DOWN; +NHANH IN_SELF_PAIRS_IMP_EE_EMPTY; +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +UNDISCH_TAC `azim_cycle {} x (FST y') (SND y') = SND (y:real^3 # real^3)`; +SIMP_TAC[W_SUBSET_SINGLETON_IMP_IDE; EMPTY_SUBSET]; +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +DOWN; +UNDISCH_TAC ` FAN (x:real^3, V, E) `; +PHA; +NHANH AZIM_CYCLE_EQ_SIGMA_FAN; +STRIP_TAC; +UNDISCH_TAC ` inverse1_sigma_fan x V E (FST y) (SND y) IN set_of_edge (FST y) V E `; +UNDISCH_TAC ` FAN (x:real^3, V, E) `; +PHA; +NHANH AZIM_CYCLE_EQ_SIGMA_FAN; +STRIP_TAC; +ASSUME_TAC2 (SMOOTH_GEN_ALL properties_of_set_of_edge_fan); +UNDISCH_TAC ` SND (y':real^3 # real^3) IN set_of_edge (FST (y:real^3 # real^3)) V E`; +FIRST_ASSUM (fun x -> REWRITE_TAC[ GSYM x]); +ASM_MESON_TAC[MONO_SIGMA_FAN]; +ASM_MESON_TAC[]; +EXISTS_TAC ` y:real^3 # real^3 `; +ASM_REWRITE_TAC[nn_of_hyp2]; +GEN_TAC; +REWRITE_TAC[GSYM nn_of_hyp2]; +ASM_MESON_TAC[IN_DARTS_IFF_NN_OF_HYP_TOO; nn_of_hyp2]]);; + + + + + +let IVS_AZIM_EMPTY_IDE = prove(` ivs_azim_cycle {} x y t = t `, +REWRITE_TAC[ivs_azim_cycle]);; + + + + + + +let FAN_IMP_IN_DARTS_IFF_FF_TOO = prove_by_refinement +(` FAN (x,V,E) ==> +(y IN darts_of_hyp E V <=> ff_of_hyp (x,V,E) y IN darts_of_hyp E V)`, +[STRIP_TAC; +EQ_TAC; +REWRITE_TAC[ff_of_hyp2]; +SIMP_TAC[darts_of_hyp; IN_UNION]; +STRIP_TAC; +DISJ1_TAC; +DOWN THEN REWRITE_TAC[IN_ORD_E_EQ_IN_E]; +DOWN THEN PHA; +ONCE_REWRITE_TAC[INSERT_COMM]; +NHANH IVS_AZIM_EQ_INVERSE_SIGMA_FAN; +SIMP_TAC[]; +NHANH (SMOOTH_GEN_ALL INVERSE1_SIGMA_FAN); +IMP_TAC THEN STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC ` SND (y:real^3 # real^3) `)); +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC o (SPEC ` FST (y:real^3 # real^3) `)); +FIRST_X_ASSUM (ASSUME_TAC o (SPEC ` FST (y:real^3 # real^3) `)); +FIRST_X_ASSUM (ASSUME_TAC o (SPEC ` FST (y:real^3 # real^3) `)); +DOWN; +ANTS_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +SIMP_TAC[INSERT_COMM]; +DISJ2_TAC; +DOWN; +REWRITE_TAC[self_pairs; IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC ` v:real^3 `; +ASM_SIMP_TAC[IVS_AZIM_EMPTY_IDE]; +ONCE_REWRITE_TAC[TAUT` a ==> b <=> ~ b ==> ~ a `]; +SIMP_TAC[ff_of_hyp2]]);; + + + + + + +let IN_E_IFF_IN_ORD_E = prove( +` {a,b} IN E <=> (a,b) IN ord_pairs E`, +REWRITE_TAC[ord_pairs; IN_ELIM_THM] +THEN MESON_TAC[PAIR_EQ]);; + + + + +let IN_ORD_E_IFF_SWITCH_TOO = prove_by_refinement +(` (x:A#A) IN ord_pairs E <=> (SND x, FST x) IN ord_pairs E `, +[REWRITE_TAC[ord_pairs; IN_ELIM_THM]; +EQ_TAC; +STRIP_TAC; +EXISTS_TAC`b:A`; +EXISTS_TAC `a:A`; +ASM_SIMP_TAC[INSERT_COMM]; +STRIP_TAC; +EXISTS_TAC`b:A`; +EXISTS_TAC `a:A`; +DOWN; +ASM_SIMP_TAC[INSERT_COMM; PAIR_EQ2]]);; + + + + + +let SIG_AND_INVERSE1_SIG = prove(` FAN (x,V,E) /\ {u,w} IN E ==> +(sigma_fan x V E u w = v ==> inverse1_sigma_fan x V E u v = w )`, +NHANH (SMOOTH_GEN_ALL INVERSE1_SIGMA_FAN) THEN +ASM_MESON_TAC[]);; + + +let INVERSE1_SIG_AND_SIG = prove(` FAN (x,V,E) /\ {u,v} IN E ==> +(inverse1_sigma_fan x V E u v = w ==> sigma_fan x V E u w = v ) `, +NHANH (SMOOTH_GEN_ALL INVERSE1_SIGMA_FAN) THEN +ASM_MESON_TAC[]);; + + + + + + +let FAN_IMP_FACE_MAP_PERMUTES_DARTS = prove_by_refinement +(` FAN (x,V,E) ==> ff_of_hyp (x,V,E) permutes darts_of_hyp E V `, +[STRIP_TAC; +REWRITE_TAC[permutes]; +CONJ_TAC; +SIMP_TAC[ff_of_hyp2]; +GEN_TAC; +REWRITE_TAC[EXISTS_UNIQUE]; +ASM_CASES_TAC ` (y:real^3 # real^3) IN darts_of_hyp E V `; +FIRST_ASSUM MP_TAC; +REWRITE_TAC[darts_of_hyp; IN_UNION]; +STRIP_TAC; +DOWN THEN REWRITE_TAC[IN_ORD_E_EQ_IN_E]; +UNDISCH_TAC ` FAN (x:real^3,V,E) `; +PHA; +ONCE_REWRITE_TAC[INSERT_COMM]; +NHANH IVS_AZIM_EQ_INVERSE_SIGMA_FAN; +STRIP_TAC; +ASSUME_TAC2 (SMOOTH_GEN_ALL INVERSE1_SIGMA_FAN); +FIRST_X_ASSUM (MP_TAC o (SPEC ` FST (y:real^3 # real^3 )`)); +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC o (SPEC ` SND (y:real^3 # real^3 )`)); +FIRST_X_ASSUM (ASSUME_TAC o (SPEC ` SND (y:real^3 # real^3 )`)); +FIRST_X_ASSUM (ASSUME_TAC o (SPEC ` SND (y:real^3 # real^3 )`)); +DOWN; +ANTS_TAC; +ONCE_REWRITE_TAC[INSERT_COMM]; +FIRST_X_ASSUM ACCEPT_TAC; +STRIP_TAC; +ASSUME_TAC2 (SMOOTH_GEN_ALL properties_of_set_of_edge_fan); +UNDISCH_TAC `{SND (y:real^3 # real^3), FST y} IN E `; +ONCE_REWRITE_TAC[INSERT_COMM]; +FIRST_ASSUM (fun x -> REWRITE_TAC[x]); +UNDISCH_TAC ` FAN (x:real^3, V,E) `; +PHA; +NHANH sigma_fan_in_set_of_edge; +FIRST_ASSUM (fun x -> REWRITE_TAC[GSYM x]); +REWRITE_TAC[IN_E_IFF_IN_ORD_E]; +STRIP_TAC; +EXISTS_TAC `sigma_fan x V E (FST y) (SND y), FST y `; +ASM_REWRITE_TAC[ff_of_hyp; darts_of_hyp; IN_UNION]; +ONCE_REWRITE_TAC[IN_ORD_E_IFF_SWITCH_TOO]; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` FST y, + ivs_azim_cycle (EE (FST y) E) x (FST y) (sigma_fan x V E (FST y) (SND y)) = + y ` ASSUME_TAC; +REWRITE_TAC[PAIR_EQ2]; +SUBGOAL_THEN ` {FST y, sigma_fan x V E (FST y) (SND y)} IN E ` ASSUME_TAC; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC sigma_fan_in_set_of_edge; +ASM_REWRITE_TAC[]; +USE_FIRST ` !v u. {v, u} IN E <=> u IN set_of_edge (v:real^3) V E ` (fun x -> REWRITE_TAC[GSYM x ]); +REWRITE_TAC[IN_E_IFF_IN_ORD_E]; +FIRST_X_ASSUM ACCEPT_TAC; +DOWN; +UNDISCH_TAC ` FAN (x:real^3,V,E) `; +PHA; +NHANH IVS_AZIM_EQ_INVERSE_SIGMA_FAN; +SIMP_TAC[]; +STRIP_TAC; +UNDISCH_TAC ` (y:real^3 # real^3) IN ord_pairs E `; +REWRITE_TAC[IN_ORD_E_EQ_IN_E]; +FIRST_X_ASSUM NHANH; +FIRST_X_ASSUM NHANH; +SIMP_TAC[]; +ASM_SIMP_TAC[]; +GEN_TAC; +ASM_CASES_TAC ` (y':real^3 # real^3) IN darts_of_hyp E V `; +ASM_REWRITE_TAC[ff_of_hyp2; PAIR_EQ2]; +SIMP_TAC[]; +DOWN; +REWRITE_TAC[darts_of_hyp; IN_UNION]; +STRIP_TAC; +DOWN; +REWRITE_TAC[IN_ORD_E_EQ_IN_E]; +ONCE_REWRITE_TAC[INSERT_COMM]; +UNDISCH_TAC ` FAN (x:real^3,V,E) `; +REWRITE_TAC[TAUT` a ==> b ==> c <=> a /\ b ==> c `]; +NHANH IVS_AZIM_EQ_INVERSE_SIGMA_FAN; +DOWN; +REWRITE_TAC[PAIR_EQ2]; +REPEAT STRIP_TAC; +UNDISCH_TAC `FST y,sigma_fan x V E (FST y) (SND y) IN ord_pairs E `; +REWRITE_TAC[IN_ORD_E_EQ_IN_E]; +UNDISCH_TAC ` FAN (x:real^3,V,E) `; +PHA; +NHANH IVS_AZIM_EQ_INVERSE_SIGMA_FAN; +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +UNDISCH_TAC ` ivs_azim_cycle (EE (SND (y':real^3 # real^3)) E) x (SND y') + (FST y') = SND (y:real^3 # real^3) `; +ASM_SIMP_TAC[]; +SUBGOAL_THEN` {FST (y:real^3 # real^3), FST (y':real^3 # real^3)} IN E ` ASSUME_TAC; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[]; +UNDISCH_TAC `inverse1_sigma_fan x V E (FST y) (sigma_fan x V E (FST y) (SND y)) = + SND y `; +DOWN THEN DOWN; +UNDISCH_TAC ` FAN (x:real^3,V,E) `; +PHA; +MESON_TAC[INVERSE1_SIG_AND_SIG]; +DOWN; +REWRITE_TAC[self_pairs; IN_ELIM_THM]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` (y:real^3 # real^3) IN ord_pairs E `; +NHANH IN_ORD_PAIRS_IMP_SND_IN_EE_FST; +STRIP_TAC THEN STRIP_TAC; +UNDISCH_TAC ` SND (y:real^3 # real^3) IN EE (FST y) E `; +ASM_MESON_TAC[NOT_IN_EMPTY]; +ASM_SIMP_TAC[NOT_IN_EMPTY]; +ASM_MESON_TAC[FAN_IMP_IN_DARTS_IFF_FF_TOO]; +DOWN; +REWRITE_TAC[self_pairs; IN_ELIM_THM; ff_of_hyp2]; +STRIP_TAC; +EXISTS_TAC ` (v,v:real^3)`; +DOWN; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +ASM_SIMP_TAC[ff_of_hyp2; IVS_AZIM_EMPTY_IDE]; +STRIP_TAC; +GEN_TAC; +COND_CASES_TAC; +EXPAND_TAC "y"; +REWRITE_TAC[PAIR_EQ]; +STRIP_TAC; +DOWN; +FIRST_X_ASSUM SUBST_ALL_TAC; +ASM_REWRITE_TAC[IVS_AZIM_EMPTY_IDE; PAIR_EQ2]; +SIMP_TAC[]; +REWRITE_TAC[]; +EXISTS_TAC `y:real^3 # real^3 `; +ASM_REWRITE_TAC[ff_of_hyp2]; +ASM_MESON_TAC[FAN_IMP_IN_DARTS_IFF_FF_TOO; ff_of_hyp2]]);; + + + + + +let nn_of_hyp3 = prove_by_refinement +(` nn_of_hyp (x,V,E) y = (if ~( y IN darts_of_hyp E V ) \/ y IN self_pairs E V then y else ( FST y, (azim_cycle (EE (FST y) E ) x (FST y) (SND y))))`, +[REWRITE_TAC[nn_of_hyp2]; +COND_CASES_TAC; +REWRITE_TAC[]; +COND_CASES_TAC; +DOWN; +REWRITE_TAC[self_pairs; IN_ELIM_THM]; +STRIP_TAC; +ASM_SIMP_TAC[W_SUBSET_SINGLETON_IMP_IDE; EMPTY_SUBSET]; +REWRITE_TAC[]; +REWRITE_TAC[]]);; + + +let ff_of_hyp3 = prove_by_refinement +(` ff_of_hyp (x,V,E) u = if ~( u IN darts_of_hyp E V) \/ u IN self_pairs E V +then u else SND u,ivs_azim_cycle (EE (SND u) E) x (SND u) (FST u) `, +[REWRITE_TAC[ff_of_hyp2]; +COND_CASES_TAC; +ASM_REWRITE_TAC[]; +COND_CASES_TAC; +DOWN; +REWRITE_TAC[self_pairs; IN_ELIM_THM]; +STRIP_TAC; +ASM_SIMP_TAC[IVS_AZIM_EMPTY_IDE]; +REWRITE_TAC[]; +REWRITE_TAC[]]);; + + + + +let FAN_IMP_FIMITE_DARTS = prove_by_refinement +(` FAN ((x:real^N),V,E) ==> FINITE (darts_of_hyp E V) `, +[REWRITE_TAC[FAN; fan1]; +NHANH_PAT `\x. x ==> l ` (TAUT` FINITE S ==> FINITE S `); +NHANH FINITE_PRODUCT; +STRIP_TAC; +UNDISCH_TAC ` FINITE {x,(y:real^N) | x IN V /\ y IN V}`; +MATCH_MP_TAC (REWRITE_RULE[TAUT` a /\ b ==> c <=> b ==> a ==> c `]FINITE_SUBSET); +REWRITE_TAC[darts_of_hyp; SUBSET; IN_UNION; ord_pairs; self_pairs; IN_ELIM_THM]; +REPEAT STRIP_TAC; +EXISTS_TAC `a:real^N`; +EXISTS_TAC `b:real^N`; +ASM_REWRITE_TAC[]; +DOWN_TAC; +NHANH lemma_sub_support; +REWRITE_TAC[INSERT_SUBSET; SUBSET]; +MESON_TAC[]; +ASM_MESON_TAC[]]);; + + + + + +let FAN_IMP_EE_EQ_SET_OF_EDGE = prove( +` FAN ((x:real^N),V,E) ==> EE v E = set_of_edge v V E `, +SIMP_TAC[FAN; UNI_E_IMP_EE_EQ_SET_OF_EDGE]);; + + + + +let FAN_IMP_IN_SELF_PAIRS_IFF_FF_OF_HYP = prove_by_refinement +(` FAN (x,V,E) ==> +(y IN self_pairs E V <=> ff_of_hyp (x,V,E) y IN self_pairs E V )`, +[STRIP_TAC; +EQ_TAC; +SIMP_TAC[ff_of_hyp3]; +ONCE_REWRITE_TAC[TAUT` a ==> b <=> ~ b ==> ~ a `]; +SIMP_TAC[ff_of_hyp3]; +STRIP_TAC; +COND_CASES_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +DOWN; +ASM_REWRITE_TAC[darts_of_hyp; IN_UNION; IN_ORD_E_EQ_IN_E]; +ASSUME_TAC2 (SMOOTH_GEN_ALL properties_of_set_of_edge_fan); +ONCE_REWRITE_TAC[INSERT_COMM]; +ASM_REWRITE_TAC[]; +UNDISCH_TAC `FAN (x:real^3,V,E) `; +PHA; +NHANH IVS_AZIM_PROPERTIES; +STRIP_TAC; +UNDISCH_TAC ` FAN (x:real^3,V,E) `; +NHANH (SMOOTH_GEN_ALL (GEN `v:real^N` FAN_IMP_EE_EQ_SET_OF_EDGE)); +SIMP_TAC[]; +STRIP_TAC; +REWRITE_TAC[self_pairs; IN_ELIM_THM; PAIR_EQ]; +STRIP_TAC; +ASM_MESON_TAC[NOT_IN_EMPTY]]);; + + + + + + + + + + +let FIRST_AAUHTVE = prove_by_refinement +(`FAN (x,V,E) /\ HYP (x,V,E) = D,e,n,f + ==> FINITE D /\ + e permutes D /\ + n permutes D /\ + f permutes D /\ + e o n o f = I /\ + e o e = I `, +[NHANH FAN_IMP_NN_OF_HYP_PERMUTES_DARTS; +NHANH FAN_IMP_FACE_MAP_PERMUTES_DARTS; +REWRITE_TAC[HYP; PAIR_EQ; FAN; fan1; fan2]; +STRIP_TAC; +CONJ_TAC; +EXPAND_TAC "D"; +MATCH_MP_TAC FAN_IMP_FIMITE_DARTS; +ASM_REWRITE_TAC[FAN;fan1; fan2]; +EXPAND_TAC "e"; +EXPAND_TAC "D"; +REWRITE_TAC[EE_OF_HYP_PERMUTES_DARTS]; +CONJ_TAC; +ASM_MESON_TAC[]; +CONJ_TAC; +ASM_MESON_TAC[]; +CONJ_TAC; +EXPAND_TAC "n"; +EXPAND_TAC "f"; +REWRITE_TAC[FUN_EQ_THM]; +GEN_TAC; +REWRITE_TAC[o_THM; I_THM; ff_of_hyp3]; +ASM_CASES_TAC ` ~(x' IN darts_of_hyp E (V:real^3 -> bool)) \/ x' IN self_pairs E V `; +ASM_SIMP_TAC[]; +EXPAND_TAC "n"; +REWRITE_TAC[nn_of_hyp3]; +ASM_REWRITE_TAC[]; +EXPAND_TAC "e"; +REWRITE_TAC[ee_of_hyp2]; +DOWN; +ASM_REWRITE_TAC[]; +DISCH_THEN DISJ_CASES_TAC; +ASM_REWRITE_TAC[]; +DOWN; +EXPAND_TAC "D"; +REWRITE_TAC[darts_of_hyp; IN_UNION]; +SIMP_TAC[self_pairs; IN_ELIM_THM]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +DOWN; +SIMP_TAC[]; +REWRITE_TAC[nn_of_hyp3]; +SIMP_TAC[]; +SUBGOAL_THEN ` FAN (x:real^3, V, E) ` ASSUME_TAC; +ASM_REWRITE_TAC[FAN;fan1;fan2]; + +ASSUME_TAC2 (SMOOTH_GEN_ALL (GEN `y:real^3 # real^3 ` FAN_IMP_IN_DARTS_IFF_FF_TOO)); +ASSUME_TAC2 (SMOOTH_GEN_ALL (GEN `y:real^3 # real^3 ` FAN_IMP_IN_SELF_PAIRS_IFF_FF_OF_HYP)); +NHANH (TAUT` ~ a ==> ~ a `); +FIRST_X_ASSUM (fun x -> PAT_ONCE_REWRITE_TAC` \x. y /\ x ==> i ` [x]); +FIRST_X_ASSUM (fun x -> PAT_ONCE_REWRITE_TAC` \x. y /\ x ==> i ` [x]); +IMP_TAC; +STRIP_TAC; +REWRITE_TAC[ff_of_hyp3]; +ASM_REWRITE_TAC[]; +EXPAND_TAC "n"; +REWRITE_TAC[nn_of_hyp3]; +ASM_SIMP_TAC[]; +ASSUME_TAC2 ( +SMOOTH_GEN_ALL (GEN `y:real^3# real^3 ` IN_DARTS_IFF_NN_OF_HYP_TOO)); +NHANH (TAUT` ~ a ==> ~ a `); +EXPAND_TAC "D"; +FIRST_X_ASSUM (fun x -> PAT_ONCE_REWRITE_TAC` \x. y /\ x ==> i ` [x]); +REWRITE_TAC[DE_MORGAN_THM]; +IMP_TAC; +SIMP_TAC[nn_of_hyp2]; +EXPAND_TAC "e"; +SIMP_TAC[ee_of_hyp]; +REPEAT STRIP_TAC; +REWRITE_TAC[PAIR_EQ2]; +SUBGOAL_THEN ` (ivs_azim_cycle (EE (SND x') E) x (SND x') (FST x')) IN +set_of_edge (SND x') V E ` ASSUME_TAC; +ASSUME_TAC2 (SMOOTH_GEN_ALL (GSYM properties_of_set_of_edge_fan)); +ASM_REWRITE_TAC[IN_E_IFF_IN_ORD_E]; +UNDISCH_TAC ` SND x',ivs_azim_cycle (EE (SND x') E) x (SND x') (FST x') IN + darts_of_hyp E V `; +REWRITE_TAC[darts_of_hyp; IN_UNION]; +ASM_REWRITE_TAC[]; +DOWN; +UNDISCH_TAC `FAN (x:real^3,V,E) `; +PHA; +NHANH AZIM_CYCLE_EQ_SIGMA_FAN; +SIMP_TAC[]; +STRIP_TAC; +ASSUME_TAC2 (SMOOTH_GEN_ALL (GSYM properties_of_set_of_edge_fan)); +SUBGOAL_THEN ` FST (x':real^3 # real^3) IN set_of_edge (SND x') V E ` +MP_TAC; +ASM_REWRITE_TAC[IN_E_IFF_IN_ORD_E]; +ONCE_REWRITE_TAC[IN_ORD_E_IFF_SWITCH_TOO]; +REWRITE_TAC[]; +UNDISCH_TAC ` ~(~(x' IN darts_of_hyp E (V:real^3 -> bool)) \/ x' IN self_pairs E V) `; +REWRITE_TAC[DE_MORGAN_THM; darts_of_hyp; IN_UNION]; +CONV_TAC TAUT; +UNDISCH_TAC ` FAN (x:real^3,V,E) `; +PHA; +NHANH IVS_AZIM_PROPERTIES; +NHANH ( +SMOOTH_GEN_ALL (GEN `v:real^N ` FAN_IMP_EE_EQ_SET_OF_EDGE)); +SIMP_TAC[]; + + +REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM]; +GEN_TAC; +ASM_CASES_TAC ` (x':real^3 # real^3) IN D `; +REWRITE_TAC[ee_of_hyp2]; +ASM_REWRITE_TAC[]; +DOWN; +EXPAND_TAC "D"; +SIMP_TAC[V_IN_DARTS_IFF_SWICH_SO_DO]; +ASM_REWRITE_TAC[ee_of_hyp2]]);; + + + +let HYP_LEMMA = prove_by_refinement( +`! (x:real^3). FAN (x,V,E) ==> +tuple_hypermap (hypermap (HYP (x,V,E))) = HYP (x,V,E) `, +[GEN_TAC THEN ABBREV_TAC ` D = FST (HYP (x,V,E)) `; +ABBREV_TAC ` e = FST ( SND (HYP (x,V,E))) `; +ABBREV_TAC `n = FST (SND (SND (HYP (x,V,E)))) `; +ABBREV_TAC `f = SND (SND (SND (HYP (x,V,E)))) `; +REPEAT (DOWN THEN ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> b ==> a ==> c `]); +PHA; +REWRITE_TAC[FST_SND_FORM_OF_4_TUPLE]; +NHANH (FIRST_AAUHTVE); +SIMP_TAC[]; +SIMP_TAC[GSYM hypermap_tybij]]);; + + + + + + + +let ELMS_OF_HYPERMAP_HYP = prove_by_refinement +(`FAN (x,V,E) + ==> dart (hypermap (HYP (x,V,E))) = darts_of_hyp E V /\ + edge_map (hypermap (HYP (x,V,E))) = ee_of_hyp (x,V,E) /\ + node_map (hypermap (HYP (x,V,E))) = nn_of_hyp (x,V,E) /\ + face_map (hypermap (HYP (x,V,E))) = ff_of_hyp (x,V,E)`, +[REWRITE_TAC[dart;edge_map; node_map; face_map]; +SIMP_TAC[HYP_LEMMA; HYP]]);; + + + + +let NN_OF_HYP_POWER_IDE = prove( +` ~ ( y IN darts_of_hyp E V ) \/ y IN self_pairs E V +==> ! n. (nn_of_hyp (x,V,E) POWER n) y = y `, +DISCH_TAC THEN INDUCT_TAC THENL +[REWRITE_TAC[POWER; I_THM]; +ASM_REWRITE_TAC[COM_POWER; o_THM] THEN +ASM_REWRITE_TAC[nn_of_hyp3]]);; + + +let XX_SS_TT = prove_by_refinement +(` FAN (x,V,E) /\ y IN ord_pairs E ==> SND ( nn_of_hyp (x,V,E) y) IN EE (FST y) E `, +[REWRITE_TAC[nn_of_hyp2; darts_of_hyp; IN_UNION]; +SIMP_TAC[]; +NHANH (SMOOTH_GEN_ALL (GEN` v:real^3 ` FAN_IMP_FINITE_EE)); +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC o (SPEC ` FST (y:real^3 # real^3)`)); +DOWN_TAC THEN NHANH IN_ORD_PAIRS_IMP_SND_IN_EE_FST; +STRIP_TAC; +ASM_CASES_TAC ` EE (FST (y:real^3 # real^3)) E SUBSET {SND y} `; +ASM_REWRITE_TAC[azim_cycle]; +UNDISCH_TAC ` FINITE (EE (FST (y:real^3 # real^3 )) E) `; +DOWN; +PHA; +NHANH (SMOOTH_GEN_ALL AZIM_CYCLE_PROPERTIES); +SIMP_TAC[IN]]);; + + + +let IN_ORD_PAIRS_IMP_NN_OF_HYP_IN_ORD = +prove(`FAN (x,V,E) /\ y IN ord_pairs E + ==> (nn_of_hyp (x,V,E) y) IN ord_pairs E `, +NHANH XX_SS_TT THEN IMP_TAC THEN +SIMP_TAC[nn_of_hyp2; darts_of_hyp; IN_UNION] THEN +REWRITE_TAC[EE; ord_pairs; IN_ELIM_THM] THEN +MESON_TAC[]);; + + + + + + +let NN_OF_HYP_POWER_IN_ORD_PAIRS = prove_by_refinement +(` FAN (x,V,E) /\ y IN ord_pairs E +==> ! n. ((nn_of_hyp (x,V,E) POWER n ) y) IN ord_pairs E `, +[STRIP_TAC; INDUCT_TAC; +ASM_REWRITE_TAC[POWER; I_THM]; +REWRITE_TAC[COM_POWER; o_THM]; +ASM_MESON_TAC[IN_ORD_PAIRS_IMP_NN_OF_HYP_IN_ORD]]);; + + + + + + +let N_HYP_TO_AZIM_CYCLE_LEM = +prove_by_refinement ( +`FAN (x,V,E) /\ u,v IN darts_of_hyp E V ==> !n. (nn_of_hyp (x,V,E) POWER n) (u,v) = u,((azim_cycle (EE u E) x u) POWER n) v`, +[STRIP_TAC; +INDUCT_TAC; +REWRITE_TAC[POWER; I_THM]; +ABBREV_TAC ` y = (u:real^3, v:real^3 ) `; +ASM_CASES_TAC ` (y:real^3 # real^3) IN self_pairs E V `; +SUBGOAL_THEN ` ! n. (nn_of_hyp (x,V,E) POWER n) (y:real^3 # real^3) IN self_pairs E V ` ASSUME_TAC; +INDUCT_TAC; +ASM_REWRITE_TAC[POWER; I_THM]; +ASM_REWRITE_TAC[COM_POWER; I_THM]; +DOWN; +STRIP_TAC; +REWRITE_TAC[COM_POWER; o_THM]; +ABBREV_TAC ` tr = (nn_of_hyp ((x:real^3),V,E) POWER n') y`; +ASM_REWRITE_TAC[nn_of_hyp3; IN_UNION]; +ASM_REWRITE_TAC[COM_POWER]; +ASM_REWRITE_TAC[o_THM; nn_of_hyp3]; +REWRITE_TAC[PAIR_EQ]; +DOWN THEN DOWN THEN PHA; +EXPAND_TAC "y"; +REWRITE_TAC[self_pairs; IN_ELIM_THM; PAIR_EQ]; +STRIP_TAC; +ASM_SIMP_TAC[W_SUBSET_SINGLETON_IMP_IDE; EMPTY_SUBSET]; +SUBGOAL_THEN ` ! n . (nn_of_hyp (x,V,E) POWER n) y IN darts_of_hyp E V ` +ASSUME_TAC; +INDUCT_TAC; +ASM_REWRITE_TAC[POWER; I_THM]; +REWRITE_TAC[COM_POWER; o_THM]; +ASM_MESON_TAC[IN_DARTS_IFF_NN_OF_HYP_TOO]; +ASM_REWRITE_TAC[COM_POWER; o_THM; nn_of_hyp2]]);; + + + +let iter_sigma_fan_in_set_of_edge = +prove_by_refinement(`!x V E v u. + FAN (x,V,E) /\ u IN set_of_edge v V E + ==> ! n. ITER n (sigma_fan x V E v) u IN set_of_edge v V E`, +[REPEAT GEN_TAC; +STRIP_TAC; INDUCT_TAC; +ASM_REWRITE_TAC[ITER]; +ASM_REWRITE_TAC[ITER]; +ASM_MESON_TAC[sigma_fan_in_set_of_edge]]);; + + + + + +let ITER_AZIM_CYCLE_EQ_ITER_SIGMA = prove_by_refinement +(`FAN (x,V,E) /\ {v, u} IN E + ==> (!a. a IN EE v E + ==> (!n. ITER n (azim_cycle (EE v E) x v) a = + ITER n (sigma_fan x V E v) a))`, +[NHANH (SMOOTH_GEN_ALL AZIM_CYCLE_EQ_SIGMA_FAN); +STRIP_TAC THEN STRIP_TAC; +DISCH_TAC; +INDUCT_TAC; +REWRITE_TAC[ITER]; +ASM_REWRITE_TAC[ITER]; +DOWN_TAC; +NHANH (SMOOTH_GEN_ALL (GEN `v:real^N` FAN_IMP_EE_EQ_SET_OF_EDGE)); +IMP_TAC; +SIMP_TAC[]; +STRIP_TAC THEN STRIP_TAC; +UNDISCH_TAC ` (a:real^3) IN set_of_edge v V E`; +UNDISCH_TAC ` FAN (x:real^3,V,E) `; +PHA; +NHANH iter_sigma_fan_in_set_of_edge; +ASM_MESON_TAC[AZIM_CYCLE_EQ_SIGMA_FAN]]);; + + + + + +let pmp_to_iter = prove( +`!n. power_map_points f x V E v w n = ITER n (f x V E v) w `, +INDUCT_TAC THENL [ +REWRITE_TAC[power_map_points; ITER]; +ASM_REWRITE_TAC[power_map_points; ITER]]);; + + + + + +let CYCLIC_SET_IMP_STABLE_SET2 = prove_by_refinement +(`FAN (x,V,E) /\ {v, u} IN E + ==> (!a. a IN EE v E + ==> EE v E = {y | ?n. y = ITER n (azim_cycle (EE v E) x v) a})`, +[NHANH ITER_AZIM_CYCLE_EQ_ITER_SIGMA; +SIMP_TAC[]; +NHANH (SMOOTH_GEN_ALL (GEN `v:real^N` FAN_IMP_EE_EQ_SET_OF_EDGE)); +SIMP_TAC[]; +NHANH (SMOOTH_GEN_ALL AZIM_CYCLE_EQ_SIGMA_FAN); +NHANH ( +SMOOTH_GEN_ALL (GSYM properties_of_set_of_edge_fan)); +SIMP_TAC[]; +STRIP_TAC; +GEN_TAC; +UNDISCH_TAC ` FAN (x:real^3,V,E) `; +PHA; +NHANH ORBITS_EQ_SET_EDGE_FAN; +SIMP_TAC[]; +REPEAT STRIP_TAC; +REWRITE_TAC[set_of_orbits_points_fan; power_map_points]; +REWRITE_TAC[pmp_to_iter; FUN_EQ_THM; IN_ELIM_THM]; +REWRITE_TAC[ARITH_RULE ` 0 <= n `]]);; + + + + +let FAN_IMP_BIJ_V_NODE_OF_HYP = +prove_by_refinement(`FAN ((x:real^3),V,E) /\ + f = + (\u. if u IN V + then node (hypermap (HYP (x,V,E))) (u,choose_nd_point u E V) + else {}) + ==> BIJ f V {node (hypermap (HYP (x,V,E))) y | y | y IN darts_of_hyp E V}`, +[STRIP_TAC; +ASM_SIMP_TAC[]; +FIRST_X_ASSUM (fun x -> REWRITE_TAC[x]); +ASSUME_TAC choose_nd_point; +REWRITE_TAC[BIJ] THEN CONJ_TAC; +(* subgoal 1 *) +REWRITE_TAC[INJ] THEN CONJ_TAC; +(* subgoal 1.1 *) +GEN_TAC THEN SIMP_TAC[]; +UNDISCH_TAC `FAN ((x:real^3),V,E) `; +REWRITE_TAC[FAN] THEN REPEAT STRIP_TAC; +ASM SET_TAC[]; +(* subgoal 1.2 *) +IMP_TAC THEN IMP_TAC THEN SIMP_TAC[]; +NHANH (MESON[X_IN_HYP_ORBITS] `node H (x:A) = A ==> x IN A `); +REPEAT STRIP_TAC; +DOWN; +ASM_SIMP_TAC[node; ELMS_OF_HYPERMAP_HYP; orbit_map; IN_ELIM_THM]; +STRIP_TAC; + + +DOWN; +SUBGOAL_THEN ` y:real^3 IN V ` MP_TAC; + +FIRST_ASSUM ACCEPT_TAC; +SUBGOAL_THEN ` UNIONS E SUBSET (V:real^3 -> bool) ` MP_TAC; +UNDISCH_TAC ` FAN (x:real^3,V,E) `; +SIMP_TAC[FAN]; +ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> a /\ b ==> c `]; +NHANH choose_nd_point; +IMP_TAC; +REMOVE_TAC; +IMP_TAC THEN REMOVE_TAC; +SUBGOAL_THEN ` FAN (x:real^3, V,E) ` MP_TAC; +ASM_REWRITE_TAC[]; +ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> a /\ b ==> c `]; +SIMP_TAC[N_HYP_TO_AZIM_CYCLE_LEM]; +REMOVE_TAC; + + +SIMP_TAC[PAIR_EQ]; +(* suggoal 2 *) +REWRITE_TAC[SURJ] THEN CONJ_TAC; +(* subgoal 2.1 *) +GEN_TAC THEN SIMP_TAC[]; +UNDISCH_TAC `FAN ((x:real^3),V,E) `; +REWRITE_TAC[FAN] THEN REPEAT STRIP_TAC; +ASM SET_TAC[]; +(* subgaol 2.2 *) +GEN_TAC; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC ` FST (y:real^3 # real^3 )`; +UNDISCH_TAC ` FAN ((x:real^3),V,E) `; +REWRITE_TAC[FAN] THEN STRIP_TAC; +ASSUME_TAC2 (ISPECL [`E:(real^3 -> bool) -> bool `; +` y: real^3 # real^3`;`V:real^3 -> bool `] + (GEN_ALL IN_DARTS_HYP_IMP_FST_SND_IN_V)); +ASM_SIMP_TAC[node; REWRITE_RULE[FAN] ELMS_OF_HYPERMAP_HYP]; +MP_TAC (ISPECL [`x: real^3 `;` V:real^3 -> bool `; +` E: (real^3 -> bool) -> bool`; + `FST (y:real^3# real^3 ) `] XOHLED); +ANTS_TAC; +REPLICATE_TAC 5 DOWN; +PHA THEN ASM_SIMP_TAC[FAN]; + + +REWRITE_TAC[orbit_map]; + +SUBGOAL_THEN ` FST (y:real^3#real^3) IN V ` MP_TAC; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN ` UNIONS E SUBSET (V:real^3 -> bool) ` MP_TAC; +ASM_REWRITE_TAC[]; +ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> a /\ b ==> c `]; +NHANH choose_nd_point; +IMP_TAC; +REMOVE_TAC; +IMP_TAC THEN REMOVE_TAC; +SUBGOAL_THEN ` FAN (x:real^3, V,E) ` MP_TAC; +ASM_REWRITE_TAC[FAN]; +ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> a /\ b ==> c `]; +SIMP_TAC[N_HYP_TO_AZIM_CYCLE_LEM]; +REMOVE_TAC; + +MP_TAC (ISPEC `y: real^3#real^3` (GSYM PAIR)); +ABBREV_TAC `fy = FST (y:real^3#real^3)`; +ABBREV_TAC `sy = SND (y:real^3#real^3)`; + +(* +e (SIMP_TAC[N_HYP_TO_AZIM_CYCLE_LEM]);; + +*) + + + +STRIP_TAC; +SUBGOAL_THEN ` (y:real^3 # real^3) IN darts_of_hyp E V ` MP_TAC; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN ` FAN (x:real^3, V,E) ` MP_TAC; +ASM_REWRITE_TAC[FAN]; +ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> a /\ b ==> c `]; +FIRST_ASSUM (fun x -> REWRITE_TAC[x]); +SIMP_TAC[N_HYP_TO_AZIM_CYCLE_LEM]; +REMOVE_TAC; +DOWN; +(* ==================================== *) +DISCH_TAC; +FIRST_X_ASSUM (MP_TAC o (SPECL [`fy: real^3 `])); + +DISCH_THEN (MP_TAC o SPEC_ALL) THEN ANTS_TAC; +(* sub I *) +ASM_SIMP_TAC[]; +(* sub II *) +REPEAT STRIP_TAC; +ASSUME_TAC2 (SPEC_ALL (ISPECL [`fy:real^3`] (GEN_ALL UNI_E_IMP_EE_EQ_SET_OF_EDGE))); +FIRST_X_ASSUM (SUBST_ALL_TAC o SYM); +ASM_CASES_TAC `(y:real^3 # real^3) IN ord_pairs E `; +ASSUME_TAC (UNDISCH (SPEC_ALL ( +ISPECL [`V: real^3 -> bool `;` y:real^3 # real^3 `;` (choose_nd_point: real^3 -> +((real^3 -> bool) -> bool) ->(real^3 -> bool) -> real^3) fy E V`;` +E:(real^3 -> bool) -> bool `] + (GEN_ALL IN_ORD_PAIRS_IMP_IMP_IN_TOO)))); +DOWN; +ASM_REWRITE_TAC[]; +DOWN THEN NHANH IN_ORD_PAIRS_IMP_SND_IN_EE_FST; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; + + + +(* +e (DOWN_TAC THEN NHANH CYCLIC_SET_IMP_STABLE_SET);; + +*) + + + +SUBGOAL_THEN ` {fy:real^3, sy} IN E ` MP_TAC; +UNDISCH_TAC ` (sy:real^3) IN EE fy E `; +REWRITE_TAC[EE; IN_ELIM_THM]; +SUBGOAL_THEN ` FAN (x:real^3,V,E) ` MP_TAC; +ASM_REWRITE_TAC[FAN]; +PHA; +NHANH CYCLIC_SET_IMP_STABLE_SET2; +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC o (SPEC `sy:real^3 `)); + +FIRST_ASSUM (ASSUME_TAC o (SPEC `(choose_nd_poind: real^3 -> +((real^3 -> bool) -> bool) ->(real^3 -> bool) -> real^3) fy E V`)); + + +DOWN THEN DOWN THEN DISCH_THEN ASSUME_TAC2; +FIRST_ASSUM (fun x -> PAT_ONCE_REWRITE_TAC `\x. x = a ==> b ` [x]); +STRIP_TAC; + +REWRITE_TAC[EXTENSION]; +GEN_TAC THEN EQ_TAC; +(* sub 2.1 *) +REWRITE_TAC[IN_ELIM_THM; ARITH_RULE` n >= 0 `]; +DISCH_THEN CHOOSE_TAC; +ASM_SIMP_TAC[PAIR_EQ; POWER_TO_ITER]; +DOWN THEN DOWN; +SET_TAC[]; +(* sub 2.2 *) +REWRITE_TAC[IN_ELIM_THM; ARITH_RULE` n >= 0 `]; +DISCH_THEN CHOOSE_TAC; +ASM_SIMP_TAC[PAIR_EQ; POWER_TO_ITER]; +DOWN THEN DOWN; +SET_TAC[]; +(* sub IIIIII *) + +ASSUME_TAC2 (prove(`y IN darts_of_hyp E (V:real^3 -> bool) + /\ ~(y IN ord_pairs E) +==> y IN self_pairs E V `, +REWRITE_TAC[darts_of_hyp; IN_UNION] +THEN CONV_TAC TAUT)); +UNDISCH_TAC `fy,choose_nd_point fy E V IN darts_of_hyp E (V:real^3 -> bool) `; +DOWN; +EXPAND_TAC "fy"; +PHA; +NHANH IN_SELF_PAIRS_IMP_FST_EQ_SND_FORALL; +STRIP_TAC; +UNDISCH_TAC `y IN darts_of_hyp E (V:real^3 -> bool) `; +UNDISCH_TAC `y IN self_pairs E (V:real^3 -> bool) `; +PHA; +UNDISCH_TAC `y = (fy:real^3), (sy: real^3 ) `; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +EXPAND_TAC "fy"; +DISCH_THEN (fun x -> PAT_REWRITE_TAC`\x. x /\ y ==> z ` [GSYM x]); +NHANH IN_SELF_PAIRS_IMP_FST_EQ_SND_FORALL; +DOWN; +ASM_REWRITE_TAC[]; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[]]);; + + + +let LOCAL_FAN_IMP_FF_SUBSET_DARTS = prove_by_refinement( +` local_fan ((V:real^3 -> bool),E,FF) ==> FF SUBSET darts_of_hyp E V`, +[REWRITE_TAC[local_fan]; +LET_TAC; +STRIP_TAC; +DOWN_TAC; +NHANH lemma_face_subset; +STRIP_TAC; +UNDISCH_TAC ` face H (x:real^3#real^3) SUBSET dart H`; +ASSUME_TAC2 (SPEC `(vec 0): real^3 ` HYP_LEMMA); +REWRITE_TAC[dart]; +EXPAND_TAC "H"; +FIRST_X_ASSUM (fun x -> REWRITE_TAC[x]); +ASM_REWRITE_TAC[HYP]]);; + + + + + + + + +let LOCAL_IMP_FINITE_DARTS = prove_by_refinement( +` local_fan ((V:real^3 -> bool),E,FF) ==> FINITE (darts_of_hyp E V) `, +[REWRITE_TAC[local_fan] THEN LET_TAC; +EXPAND_TAC "H"; +NHANH HYP_LEMMA; +REWRITE_TAC[dart]; +REWRITE_TAC[GSYM hypermap_tybij; HYP]; +SIMP_TAC[]]);; + + + + +let LOCAL_FAN_FINITE_FF = prove_by_refinement( +` local_fan ((V:real^3 -> bool),E,FF) ==> FINITE FF `, +[NHANH LOCAL_FAN_IMP_FF_SUBSET_DARTS; +NHANH LOCAL_IMP_FINITE_DARTS; +PHA THEN IMP_TAC THEN REMOVE_TAC; +REWRITE_TAC[FINITE_SUBSET]]);; + + + + + + + + + + + +let LOCAL_FAN_IMP_BIJ_FF_NODES = prove_by_refinement( +`local_fan ((V:real^3 -> bool),E,FF) /\ + f = (\y. node (hypermap (HYP (vec 0,V,E))) y ) ==> +BIJ f FF {node (hypermap (HYP (vec 0,V,E))) y | y | y IN darts_of_hyp E V} `, +[REWRITE_TAC[local_fan]; +LET_TAC; +REWRITE_TAC[dih2k]; +STRIP_TAC; +ASM_REWRITE_TAC[BIJ; INJ; SURJ]; +PHA; +CONJ_TAC; +(* SUB 1 *) +GEN_TAC; +ASSUME_TAC2 (ISPEC `(vec 0): real^3 ` HYP_LEMMA); +DOWN; +REWRITE_TAC[GSYM hypermap_tybij; HYP]; +ASSUME_TAC2 (ISPECL [`H: (real^3 # real^3)hypermap `; +`x:real^3 # real^3 `] lemma_face_subset); +ASSUME_TAC2 (SPEC `(vec 0): real^3 ` (GEN `x: real^3 ` ELMS_OF_HYPERMAP_HYP)); +PHA THEN STRIP_TAC; +UNDISCH_TAC `face H (x:real^3 # real^3) SUBSET dart H`; +DOWN; +DOWN_TAC THEN STRIP_TAC; +EXPAND_TAC "H"; +USE_FIRST `dart (hypermap (HYP (vec 0,V,E))) = darts_of_hyp E (V:real^3 -> bool) ` + ( fun x -> REWRITE_TAC[GSYM x]); +REPLICATE_TAC 3 DOWN; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +ASM_REWRITE_TAC[IN_ELIM_THM; SUBSET]; +MESON_TAC[]; +(* SUB 2.1 *) +CONJ_TAC; +(* sub 2.1.1 *) +REPEAT STRIP_TAC; +MP_TAC LOCAL_FAN_FINITE_FF; +ANTS_TAC THENL [ +REWRITE_TAC[local_fan; dih2k] THEN +LET_TAC THEN ASM_SIMP_TAC[] THEN +ASM_MESON_TAC[]; +ASM_CASES_TAC ` CARD (FF:real^3 # real^3 -> bool) = 0`]; +(* sub I *) +DOWN THEN PHA; +NHANH (MESON[CARD_EQ_0]` CARD FF = 0 /\ FINITE FF ==> FF = {} `); +STRIP_TAC; +MP_TAC (ISPECL [`H: (real^3#real^3) hypermap `;` x: real^3 # real^3 `] face_refl); +DOWN; +ASM_SIMP_TAC[NOT_IN_EMPTY]; +(* SUB II *) +MP_TAC (ISPECL [` CARD (FF: (real^3 # real^3 ) -> bool) `;` y: real^3 # real^3 `; + `face_map (H:(real^3 # real^3) hypermap) `;` x: real^3 # real^3 `] +(GEN_ALL HAS_ORDK_IN_ORBIT_IMP_SAME_ORBIT)); +ANTS_TAC THENL [ +ASM_REWRITE_TAC[GSYM face]; +REWRITE_TAC[GSYM face]]; +DISCH_TAC; +MP_TAC (ISPECL [` CARD (FF: (real^3 # real^3 ) -> bool) `;` x': real^3 # real^3 `; + `face_map (H:(real^3 # real^3) hypermap) `;` x: real^3 # real^3 `] +(GEN_ALL HAS_ORDK_IN_ORBIT_IMP_SAME_ORBIT)); +ANTS_TAC THENL [ +ASM_REWRITE_TAC[GSYM face]; +ASM_REWRITE_TAC[GSYM face]]; +REPEAT STRIP_TAC; +MP_TAC (ISPECL [`CARD (FF: real^3 # real^3 -> bool) `; +` H: (real^3 # real^3) hypermap `] (GEN_ALL DIH2K_IMP_SIMPLE_HYPERMAP)); +ANTS_TAC; +(* SUB GOAL *) + + +ASM_SIMP_TAC[dih2k]; +EXPAND_TAC "H"; +ASSUME_TAC2 (SPEC `(vec 0): real^3 ` (GEN `x: real^ 3 ` ELMS_OF_HYPERMAP_HYP)); +MP_TAC (REWRITE_RULE[local_fan] LOCAL_IMP_FINITE_DARTS); +ANTS_TAC THENL [ +LET_TAC THEN +REWRITE_TAC[dih2k] THEN +ASM_MESON_TAC[]; +ASM_REWRITE_TAC[]]; + +(* =============== *) +(* SUB *) +NHANH lemma_simple_hypermap; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPEC `y: real^3 # real^3 `)); +UNDISCH_TAC `node H x' = node H (y: real^3 # real^3 ) `; +DISCH_THEN (fun x -> REWRITE_TAC[SYM x]); +ASM_REWRITE_TAC[]; +UNDISCH_TAC `face H x' = face H (x: real^3 # real^3 ) `; +DISCH_THEN (fun x -> REWRITE_TAC[SYM x]); +ASM_REWRITE_TAC[]; +SET_TAC[]; + + +(* ---------------------------------- *) +ASSUME_TAC2 (SPEC `(vec 0): real^3 ` (GEN `x: real^3 ` ELMS_OF_HYPERMAP_HYP)); +DOWN; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +ASM_SIMP_TAC[]; +STRIP_TAC; +ASSUME_TAC2 (ISPEC `H:(real^3 # real^3 ) hypermap ` lemma_face_subset); +CONJ_TAC; +STRIP_TAC THEN DOWN THEN PHA; +SET_TAC[]; +REWRITE_TAC[IN_ELIM_THM]; +REPEAT STRIP_TAC; +MP_TAC (ISPECL [`CARD (FF: real^3#real^3->bool) `;` H : (real^3#real^3)hypermap`] + ( GEN_ALL DIH_IMP_EVERY_NODE_INTER_FACE)); +ANTS_TAC THENL [ +REWRITE_TAC[dih2k] THEN +ASM_SIMP_TAC[]; +DISCH_THEN (MP_TAC o (SPECL [`y:real^3 # real^3 `;`x:real^3# real^3`]))]; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +DISCH_THEN ASSUME_TAC2; +FIRST_X_ASSUM CHOOSE_TAC; +EXISTS_TAC `d: real^3 # real^3 `; +FIRST_X_ASSUM MP_TAC THEN NHANH lemma_node_identity; +ASM_SIMP_TAC[]]);; + + + + +(* ++++++++++++++ *) + + + + + + + + + + + +(* +++++++++++++ *) + + + + + +(* local_fan (V,E,FF) /\ f = (\y. node (hypermap (HYP (vec 0,V,E))) y) + ==> BIJ f FF + {node (hypermap (HYP (vec 0,V,E))) y | y | y IN darts_of_hyp E V} +*) + +REWRITE_RULE[MESON[]` (! h. a /\ h = f ==> BIJ h S C ) <=> ( a ==> BIJ f S C ) `] + (GEN `f: real^3#real^3->real^3#real^3->bool ` LOCAL_FAN_IMP_BIJ_FF_NODES);; + + +(* +val it : thm = + |- local_fan (V,E,FF) + ==> BIJ (\y. node (hypermap (HYP (vec 0,V,E))) y) FF + {node (hypermap (HYP (vec 0,V,E))) y | y | y IN darts_of_hyp E V} + +*) + +REWRITE_RULE[MESON[]` (! h. a /\ h = f ==> BIJ h S C ) <=> ( a ==> BIJ f S C ) `] + (GEN `f: real^3->real^3#real^3->bool` FAN_IMP_BIJ_V_NODE_OF_HYP);; + +FAN_IMP_BIJ_V_NODE_OF_HYP ;; +(* val it : thm = + |- FAN (x,V,E) /\ + f = + (\u. if u IN V + then node (hypermap (HYP (x,V,E))) (u,choose_nd_point u E V) + else {}) + ==> BIJ f V + {node (hypermap (HYP (x,V,E))) y | y | y IN darts_of_hyp E V} + +*) + + +let NOT_IN_DARTS_NN_IDE = prove( +` ~( y IN darts_of_hyp E V) +==> nn_of_hyp (x,V,E) y = y `, +REWRITE_TAC[nn_of_hyp2] THEN SIMP_TAC[]);; + +let ITER_FIXPOINT2 = +MESON[ITER_FIXPOINT]`! f x. f x = x ==> ! n . ITER n f x = x `;; + + + +let NOT_IN_DARTS_NN_OF_HYP_POWER_IDE = prove( +` ~( y IN darts_of_hyp E V) +==> ! n. (nn_of_hyp (x,V,E) POWER n ) y = y `, +STRIP_TAC THEN INDUCT_TAC THENL [ +REWRITE_TAC[POWER; I_THM]; +ASM_REWRITE_TAC[COM_POWER; o_THM; nn_of_hyp2]]);; + + + + + +let IN_NODE_IMP_FIRST_EQ = prove_by_refinement( +` FAN (x,V,E) /\ a IN ( node (hypermap (HYP (x,V,E))) b ) + ==> FST a = FST b `, +[REWRITE_TAC[node]; +NHANH ELMS_OF_HYPERMAP_HYP; +IMP_TAC; +SIMP_TAC[]; +STRIP_TAC; +REWRITE_TAC[IN_ELIM_THM; orbit_map]; +STRIP_TAC; +DOWN; +PAT_ONCE_REWRITE_TAC `\x. a = P x ==> y ` [GSYM PAIR]; +ASM_CASES_TAC ` (b:real^3# real^3 ) IN darts_of_hyp E V `; +ABBREV_TAC ` u = FST (b:real^3# real^3) `; +ABBREV_TAC ` v = SND (b:real^3# real^3) `; +MP_TAC N_HYP_TO_AZIM_CYCLE_LEM; +ANTS_TAC; +ASM_REWRITE_TAC[]; +ASM_MESON_TAC[PAIR_EQ2; PAIR]; +SIMP_TAC[]; +DOWN; +NHANH NOT_IN_DARTS_NN_OF_HYP_POWER_IDE; +SIMP_TAC[]]);; + + + + + + +let BIJ_BETWEEN_FF_AND_V = prove_by_refinement( +`local_fan (V,E,FF) /\ k = (\x. FST x ) +==> BIJ k FF V `, +[ABBREV_TAC ` f = + (\u. if (u:real^3) IN V + then node (hypermap (HYP (vec 0,V,E))) (u,choose_nd_point u E V) + else {}) `; +ABBREV_TAC `h = (\y. node (hypermap (HYP (vec 0,V,E))) y) ` ; +DOWN_TAC; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +STRIP_TAC; +ASSUME_TAC2 ( +prove(` local_fan (V,E,FF) /\ + f = + (\u. if (u:real^3) IN V + then node (hypermap (HYP (vec 0,V,E))) (u,choose_nd_point u E V) + else {}) /\ + h = (\y. node (hypermap (HYP (vec 0,V,E))) y) + ==> BIJ h FF + {node (hypermap (HYP (vec 0,V,E))) y | y | y IN darts_of_hyp E V} /\ + BIJ f V + {node (hypermap (HYP (vec 0,V,E))) y | y | y IN darts_of_hyp E V}`, +SIMP_TAC[FAN_IMP_BIJ_V_NODE_OF_HYP ; LOCAL_FAN_IMP_BIJ_FF_NODES] THEN +REWRITE_TAC[local_fan] THEN LET_TAC THEN +EXPAND_TAC "H" THEN +SIMP_TAC[FAN_IMP_BIJ_V_NODE_OF_HYP])); +DOWN; +NHANH (REWRITE_RULE[RIGHT_FORALL_IMP_THM] + (GEN `ff: B -> C ` (REWRITE_RULE[TAUT` a/\b/\c ==> d <=> + a /\ b ==> c ==> d `] TOW_BIJS_IMP_BIJ_BETWEEN_FIRST))); +REWRITE_TAC[MESON[]` (! x. x = a ==> P x ) <=> P a `]; +ABBREV_TAC ` ff = (\x. if x IN FF then @a. a IN V /\ +(h:real^3#real^3->real^3#real^3->bool) x = f (a:real^3) else aa) `; +STRIP_TAC; +SUBGOAL_THEN `(!x. x IN FF ==> (ff: real^3#real^3->real^3) + x = k x ) ` ASSUME_TAC; +SUBGOAL_THEN ` (! x. (x:real^3 # real^3) IN FF ==> ff x IN (V:real^3 -> bool) /\ + (h:real^3#real^3->real^3#real^3->bool) x = f ( ff x )) ` ASSUME_TAC; + +(* SUBGOAL 1 *) +EXPAND_TAC "ff"; +SIMP_TAC[]; +STRIP_TAC THEN STRIP_TAC; +CONV_TAC SELECT_CONV; +DOWN_TAC; +REWRITE_TAC[BIJ; INJ; SURJ]; +MESON_TAC[]; +(* end 1 *) + +(* sub 2 *) +FIRST_X_ASSUM NHANH; +STRIP_TAC; +STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (ISPECL [` hypermap (HYP (vec 0,V,E)) `;` x: real^3 # real^3 `] node_refl); +ASM_REWRITE_TAC[]; +ASSUME_TAC2 LOCAL_FAN_IMP_FAN; +DOWN THEN PHA; +NHANH IN_NODE_IMP_FIRST_EQ; +EXPAND_TAC "k"; +SIMP_TAC[EQ_SYM_EQ]; +(* subgoal -------------------------- *) +(* oooooooooooooooooooooooooooooooooo *) + +DOWN THEN DOWN; +PHA; +REWRITE_TAC[INDENT_IN_S1_IMP_BIJ ]]);; + + + + + +let WRGCVDR = prove_by_refinement( +`local_fan (V,E,FF) /\ k = (\x. FST x) + ==> BIJ k FF V /\ + ((!x. x IN V ==> x,hro x IN FF) /\ + (!x. x IN FF ==> x = FST x,hro (FST x)) + ==> (!x. x IN V ==> V = orbit_map hro x))`, +[STRIP_TAC; +ASSUME_TAC2 BIJ_BETWEEN_FF_AND_V; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +DOWN_TAC; +REWRITE_TAC[local_fan; dih2k]; +LET_TAC; +STRIP_TAC; +SUBGOAL_THEN ` (x:real^3), (hro:real^3 -> real^3) x IN FF ` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_SIMP_TAC[]; +DOWN; +UNDISCH_TAC ` FF = face H (x':real^3 # real^3 ) `; +SIMP_TAC[] THEN STRIP_TAC; +NHANH lemma_face_identity; +DOWN_TAC THEN REWRITE_TAC[BIJ]; +NHANH (prove(` SURJ (f:A ->B) S1 S2 ==> IMAGE f S1 = S2 `, +REWRITE_TAC[IMAGE; SURJ] THEN SET_TAC[])); +STRIP_TAC; +EXPAND_TAC "V"; +REPLICATE_TAC 3 DOWN THEN PHA; +SIMP_TAC[]; +STRIP_TAC; +REWRITE_TAC[face; IMAGE; orbit_map; IN_ELIM_THM]; +SUBGOAL_THEN ` (! n. (face_map H POWER n) (x,(hro:real^3 -> real^3 ) x) = +((hro POWER n) x, (hro POWER ( n + 1 )) x )) ` ASSUME_TAC; +INDUCT_TAC; +REWRITE_TAC[POWER; I_THM; ARITH_RULE` 0 + 1 = 1`; POWER_1]; +ASM_REWRITE_TAC[COM_POWER; o_THM]; +DOWN THEN ONCE_REWRITE_TAC[EQ_SYM_EQ]; +NHANH in_orbit_lemma; +ASSUME_TAC2 (SPEC `(vec 0):real^3 ` (GEN `x:real^3 ` ELMS_OF_HYPERMAP_HYP)); +DOWN; +ASM_SIMP_TAC[FUN_EQ_THM]; +STRIP_TAC; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +STRIP_TAC; +SUBGOAL_THEN `ff_of_hyp (vec 0,(V:real^3 -> bool),E) ((face_map H POWER n) (x,hro x)) IN (FF: real^3 # real^3 -> bool) ` + ASSUME_TAC; +ASM_SIMP_TAC[]; +DOWN; +NHANH IN_ORBIT_MAP_IMP_F_Y; +REWRITE_TAC[GSYM face]; +ASM_SIMP_TAC[]; +(* gggggggggggggggggggg *) +DOWN; + +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` (hro POWER n) (x:real^3),(hro POWER (n + 1)) x IN +darts_of_hyp E V ` MP_TAC; +DOWN; +REWRITE_TAC[GSYM face]; +DOWN_TAC THEN NHANH lemma_face_subset; +STRIP_TAC; +SUBGOAL_THEN` (x:real^3), (hro: real^3 -> real^3) x IN dart H ` MP_TAC; +MATCH_MP_TAC (SET_RULE` face H (x':real^3 # real^3) SUBSET S/\ +y IN face H (x':real^3 # real^3) ==> y IN S `); +ASM_REWRITE_TAC[]; +NHANH lemma_face_subset; +STRIP_TAC; +DOWN; +DOWN_TAC THEN REWRITE_TAC[GSYM FUN_EQ_THM; ETA_AX]; +STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC (SET_RULE` x IN a ==> a SUBSET b ==> x IN b `); +FIRST_X_ASSUM ACCEPT_TAC; +ASM_SIMP_TAC[ff_of_hyp]; +REMOVE_TAC; +DOWN_TAC; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +STRIP_TAC; +DOWN; +UNDISCH_TAC `face H (x,(hro: real^3 -> real^3) x) = face H x' `; +SIMP_TAC[]; +DISCH_TAC; +UNDISCH_TAC `face H (x':real^3 # real^3 ) = FF`; +SIMP_TAC[]; +FIRST_ASSUM NHANH; +REWRITE_TAC[PAIR_EQ]; +SIMP_TAC[GSYM ADD1; COM_POWER; o_THM]; +(* iiiiiiiiiiiiiiiiiiiiiiii *) +REWRITE_TAC[FUN_EQ_THM]; +GEN_TAC THEN EQ_TAC; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +DOWN; +ASM_SIMP_TAC[]; +STRIP_TAC; +EXISTS_TAC `n: num `; +ASM_SIMP_TAC[]; +(* ::::::::::::::::::: *) +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC `(hro POWER n) (x: real^3 ), (hro POWER (n + 1)) x `; +ASM_REWRITE_TAC[]; +EXISTS_TAC `n:num `; +ASM_REWRITE_TAC[]]);; + + + + + + + + +let SET_TAC = +let basicthms = +[NOT_IN_EMPTY; IN_UNIV; IN_UNION; IN_INTER; IN_DIFF; IN_INSERT; +IN_DELETE; IN_REST; IN_INTERS; IN_UNIONS; IN_IMAGE] in +let allthms = basicthms @ map (REWRITE_RULE[IN]) basicthms @ +[IN_ELIM_THM; IN] in +let PRESET_TAC = +TRY(POP_ASSUM_LIST(MP_TAC o end_itlist CONJ)) THEN +REPEAT COND_CASES_TAC THEN +REWRITE_TAC[EXTENSION; SUBSET; PSUBSET; DISJOINT; SING] THEN +REWRITE_TAC allthms in +fun ths -> +PRESET_TAC THEN +(if ths = [] then ALL_TAC else MP_TAC(end_itlist CONJ ths)) THEN +MESON_TAC[];; + +let SET_RULE tm = prove(tm,SET_TAC[]);; + + +(* ====================================== *) + +(* ============ MFMPCVM ================ *) + +(* ===================================== *) + + + +(* ================================= *) +(* PJRIMCV *) +(* ================================= *) + + +(* +let wedge_fan_gt = new_definition +` wedge_fan_gt v E = wedge_in_fan_gt (v, rho_fan v) E `;; + + +let wedge_fan_ge = new_definition +`wedge_fan_ge v E = wedge_in_fan_ge (v, rho_fan v) E`;; + +*) + +(* ============================= *) +(* localization *) +(* BIFQATK *) +(* ============================= *) + + +let v_prime = new_definition `v_prime V FF = {v| v IN V /\ + (?w. (v,w) IN FF )} `;; + +let e_prime = new_definition ` e_prime E FF = {{v,w} | {v,w} IN E /\ +(v,w) IN FF } `;; + + +let IMP_FAN_V_PRIME_E_PRIME = prove_by_refinement +(`FAN (v, V, E) /\ (?x. x IN dart (hypermap (HYP (v,V,E))) /\ +FF = face ( hypermap (HYP (v, V, E))) x) +==> FAN (v, v_prime V FF , e_prime E FF ) `, +[REWRITE_TAC[FAN; v_prime; e_prime]; +STRIP_TAC; +CONJ_TAC; +REWRITE_TAC[UNIONS_SUBSET; IN_ELIM_THM]; +REPEAT STRIP_TAC; +DOWN THEN SIMP_TAC[]; +DOWN; +MP_TAC (SPEC `v: real^3 ` (GEN `x: real^3 ` ELMS_OF_HYPERMAP_HYP)); +ANTS_TAC THENL [ +ASM_REWRITE_TAC[FAN]; +DOWN THEN DOWN]; +REWRITE_TAC[face]; +SIMP_TAC[]; +STRIP_TAC THEN STRIP_TAC THEN STRIP_TAC; +NHANH_PAT `\x. x ==> y ` IN_ORBIT_MAP_IMP_F_Y; +REWRITE_TAC[ff_of_hyp]; +FIRST_ASSUM (fun x -> REWRITE_TAC[GSYM x; GSYM face]); +SUBGOAL_THEN ` x IN dart (hypermap (HYP ((v:real^3),V,E))) ` MP_TAC; +ASM_REWRITE_TAC[]; +IMP_TAC; +NHANH lemma_face_subset; +IMP_TAC THEN REMOVE_TAC; +ONCE_REWRITE_TAC[TAUT` a ==> b ==> c <=> a /\ b ==> c `]; +ONCE_REWRITE_TAC[SET_RULE` a SUBSET b /\ x IN a <=> x IN b /\ a SUBSET b /\ x IN a `]; +ASM_SIMP_TAC[]; +IMP_TAC THEN REMOVE_TAC; +UNDISCH_TAC ` {v', (w:real^3) } IN E `; +UNDISCH_TAC ` UNIONS E SUBSET (V: real^3 -> bool) `; +REWRITE_TAC[UNIONS_SUBSET]; +DISCH_THEN NHANH; +SET_TAC[]; +UNDISCH_TAC ` graph (E:(real^3 -> bool) -> bool) `; +REWRITE_TAC[graph]; +DISCH_TAC; +CONJ_TAC; +DOWN THEN SET_TAC[]; +REWRITE_TAC[fan1; fan2; fan6; fan7]; +CONJ_TAC; +DOWN_TAC; +REWRITE_TAC[fan1]; +STRIP_TAC; +CONJ_TAC; +UNDISCH_TAC `FINITE (V:real^3 -> bool) `; +MATCH_MP_TAC (REWRITE_RULE[TAUT` a /\ b ==> c <=> +b ==> a ==> c `] FINITE_SUBSET); +SET_TAC[]; +DOWN THEN DOWN; +NHANH (MESON[face_refl]` FF = face H x ==> x IN FF `); +REPEAT STRIP_TAC; +MP_TAC (SPEC `v:real^3 ` (GEN `x:real^3 ` ELMS_OF_HYPERMAP_HYP)); +ANTS_TAC THENL [ +ASM_REWRITE_TAC[FAN; graph; fan1]; +STRIP_TAC]; +UNDISCH_TAC `x IN dart (hypermap (HYP (v,V,E)))`; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASSUME_TAC2 ( +ISPEC `x:real^3#real^3 ` (GEN `y:A#A ` IN_DARTS_HYP_IMP_FST_SND_IN_V)); +UNDISCH_TAC `(x:real^3 # real^3 ) IN FF `; +REWRITE_TAC[]; +ONCE_REWRITE_TAC[GSYM PAIR]; +ABBREV_TAC ` fx = FST (x:real^3 # real^3) `; +ASM SET_TAC[]; +DOWN_TAC THEN REWRITE_TAC[fan1; fan2]; +STRIP_TAC; +CONJ_TAC; +ASM SET_TAC[]; +DOWN_TAC THEN REWRITE_TAC[fan6; fan7]; +SET_TAC[]]);; + + + + +let E_PRIME_SUBSET_E = prove(` e_prime E FF SUBSET E `, +REWRITE_TAC[e_prime; SUBSET; IN_ELIM_THM] THEN +REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]);; + +let SUBSET_IMP_SO_DO_EE = +prove(` W1 SUBSET W2 ==> EE v W1 SUBSET EE v W2 `, +REWRITE_TAC[EE] THEN SET_TAC[]);; + + + + +let FST_SND_X_IN_EE_E_PRIME =prove(` +(x:A #A) IN FF /\ {FST x, SND x} IN E +==> FST x IN EE (SND x) (e_prime E FF ) /\ +SND x IN EE (FST x) (e_prime E FF) `, +PAT_ONCE_REWRITE_TAC`\x. x ==> y ` [GSYM PAIR] THEN +ABBREV_TAC ` ax = FST (x:A#A) ` THEN +REWRITE_TAC[EE; IN_ELIM_THM; e_prime] THEN +STRIP_TAC THEN +CONJ_TAC THENL [ +EXISTS_TAC `ax: A ` THEN +EXISTS_TAC `SND (x:A#A) ` THEN +ASM_SIMP_TAC[INSERT_COMM] ; +EXISTS_TAC `ax:A` THEN +EXISTS_TAC `SND (x:A#A) ` THEN +ASM_REWRITE_TAC[]]);; + + + + + +let CYCLIC_MAP_IMP_CIRCLE_ITSELF = +prove_by_refinement(` +(!(x:A). x IN W ==> W = orbit_map f x ) /\ y IN W +==> (?x. x IN W /\ y = f x )`, [ +IMP_TAC THEN DISCH_TAC; +FIRST_ASSUM (NHANH_PAT `\x. x ==> l`); +STRIP_TAC; +UNDISCH_TAC `y:A IN W `; +FIRST_ASSUM (fun x -> PAT_ONCE_REWRITE_TAC`\x. x ==> y ` [x]); +NHANH IN_ORBIT_MAP_IMP_F_Y; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +FIRST_ASSUM (NHANH_PAT `\x. x ==> y `); +STRIP_TAC; +UNDISCH_TAC `y:A IN W `; +FIRST_ASSUM (fun x -> PAT_REWRITE_TAC`\x. x ==> y `[x]); +REWRITE_TAC[orbit_map; IN_ELIM_THM; POWER_FUNCTION; GSYM COM_POWER_FUNCTION]; +STRIP_TAC; +EXISTS_TAC `(f POWER n) (y:A) `; +CONJ_TAC; +ASM_REWRITE_TAC[lemma_in_orbit]; +FIRST_X_ASSUM ACCEPT_TAC]);; + + + + + + + +(* ================================= *) +(* definition 7.8 RTPRRJS *) +(* chapter: Local Fan *) +(* ================================= *) + + +let generic = new_definition` generic V E <=> +(! v w u. {v,w} IN E /\ u IN V ==> aff_ge { vec 0 } {v,w} INTER +aff_lt {vec 0} {u} = {} )`;; + + +let circular = new_definition ` circular V E <=> +(? v w u. {v,w} IN E /\ u IN V /\ ~(aff_gt { vec 0 } {v,w} INTER +aff_lt {vec 0} {u} = {}) )`;; + + +let lunar = new_definition +` lunar (v,w) V E <=> ~(circular V E) /\ {v,w} SUBSET V /\ +~( v = w ) /\ collinear {vec 0, v, w } `;; + +open Aff_sgn_tac;; +let AFF_SGN_TRULE tm = prove (tm, AFF_SGN_TAC);; + + +let DIH2K_IMP_NODE_MAP_X_DIFF_X = +prove(`FINITE (dart H) /\ dih2k H k /\ ~(k = 0) ==> +(!x. x IN dart H ==> ~((node_map H) x = x )) `, +NHANH DIH2K_IMP_PRE_SIMPLE_HYP THEN +STRIP_TAC THEN FIRST_ASSUM NHANH THEN +MESON_TAC[face_refl]);; + + + + +let FAN_IMP_FINITE_DARTS = +prove(` FAN ((x:real^3),V,E) ==> FINITE (darts_of_hyp E V) `, +NHANH HYP_LEMMA THEN +SIMP_TAC[GSYM hypermap_tybij; HYP]);; + + + +let FAN_IMP_NOT_EMPTY_DARTS = +prove(` FAN ((x:real^N),V,E) ==> ~(darts_of_hyp E V = {} ) `, +REWRITE_TAC[darts_of_hyp; FAN; fan1; ord_pairs; self_pairs; EE] +THEN SET_TAC[]);; + + + + + + + +let FAN7_SIMPLE = +prove(`!x. fan7 ((x:real^N),V,E) ==> (!a b. a IN V /\ b IN V +==> aff_ge {x} {a} INTER aff_ge {x} {b} = +aff_ge {x} ({a} INTER {b})) `, +REWRITE_TAC[fan7] THEN SET_TAC[]);; + + + + + +let FAN_IMP_DIFF = +prove(`FAN (x,V,E) ==> (!v. v IN V \/ v IN UNIONS E ==> ~( v = x )) `, +REWRITE_TAC[FAN; fan2] THEN SET_TAC[]);; + + + +let AFF_GE_TO_AFF_GT2_GE1 = prove_by_refinement( +` ~( u = x ) /\ ~( v = x ) ==> +aff_ge {x} {u,v} = aff_gt {x} {u,v} UNION aff_ge {x} {u} +UNION aff_ge {x} {v} `, +[SIMP_TAC[ +AFF_SGN_TRULE` ~( u = x ) /\ ~( v = x ) ==> +aff_ge {x} {u,v} = {w| ? tx tu tv. &0 <= tu /\ &0 <= tv /\ +tx + tu + tv = &1 /\ w = tx % x + tu % u + tv % v } `]; +SIMP_TAC[ +AFF_SGN_TRULE` ~( u = x ) /\ ~( v = x ) ==> +aff_gt {x} {u,v} = {w| ? tx tu tv. &0 < tu /\ &0 < tv /\ +tx + tu + tv = &1 /\ w = tx % x + tu % u + tv % v } `]; +SIMP_TAC[ +AFF_SGN_TRULE` ~( u = x ) ==> +aff_ge {x} {u} = {w| ? tx tu . &0 <= tu /\ +tx + tu = &1 /\ w = tx % x + tu % u} `]; +REWRITE_TAC[SET_RULE` a = b <=> (!x. x IN a <=> x IN b) `; IN_ELIM_THM; IN_UNION]; +REPEAT STRIP_TAC; +EQ_TAC; +STRIP_TAC; +ASM_CASES_TAC ` tu = &0 `; +DISJ2_TAC THEN DISJ2_TAC; +EXISTS_TAC ` tx: real `; +EXISTS_TAC `tv:real`; +ASM_SIMP_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID]; +ASM_REAL_ARITH_TAC; +(* ========= *) +ASM_CASES_TAC ` tv = &0 `; +DISJ2_TAC THEN DISJ1_TAC; +EXISTS_TAC `tx:real`; +EXISTS_TAC `tu:real`; +ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID]; +ASM_REAL_ARITH_TAC; +DISJ1_TAC; +ASM_MESON_TAC[REAL_ARITH` &0 <= a /\ ~(a = &0 ) <=> &0 < a `]; +(* _______________ *) +STRIP_TAC; +ASM_MESON_TAC[REAL_ARITH` &0 <= a /\ ~(a = &0 ) <=> &0 < a `]; +(* iiiii *) +EXISTS_TAC `tx:real`; +EXISTS_TAC `tu:real `; +EXISTS_TAC ` &0 `; +ASM_SIMP_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID; REAL_ADD_RID]; +REAL_ARITH_TAC; +(* yyyyyyyyyyyy *) +EXISTS_TAC ` tx:real `; +EXISTS_TAC ` &0 `; +EXISTS_TAC `tu:real`; +ASM_SIMP_TAC[REAL_ADD_LID; VECTOR_MUL_LZERO; VECTOR_ADD_LID]; +REAL_ARITH_TAC]);; + + + + + + + +let AFF_GE_INTER_AFF_LT_IMP_NOT_EQ_COL = +prove_by_refinement(`~((v:real^3) = vec 0)/\ +~( u = vec 0 ) /\ +~(aff_ge {vec 0} {v} INTER aff_lt {vec 0} {u} = {}) +==> ~ (u = v ) /\ collinear {vec 0, u, v } `, +[ONCE_REWRITE_TAC[EQ_SYM_EQ]; +STRIP_TAC THEN DOWN; +ASM_SIMP_TAC[AFF_GE_1_1; +REWRITE_RULE[SET_RULE` DISJOINT {a} {b} <=> ~( a = b ) `] +AFF_LT_1_1; SET_RULE` ~( {} = a INTER b ) <=> ?x. x IN a /\ x IN b `]; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +CONJ_TAC; +STRIP_TAC; +UNDISCH_TAC` x = t1' % vec 0 + t2' % (u:real^3) `; +ASM_SIMP_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +REWRITE_TAC[VECTOR_ARITH` a % x = b % x <=> (a - b ) % x = vec 0 `]; +REWRITE_TAC[VECTOR_MUL_EQ_0]; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +ASM_SIMP_TAC[DE_MORGAN_THM]; +ASM_REAL_ARITH_TAC; +(* hhhhhhhhhh *) +ASM_REWRITE_TAC[COLLINEAR_LEMMA]; +EXISTS_TAC ` t2' / (t2:real) `; +DOWN; +ASM_SIMP_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID]; + +ASM_CASES_TAC ` t2 = &0 `; +ASM_SIMP_TAC[VECTOR_ARITH` &0 % x = c <=> c = vec 0`;VECTOR_MUL_EQ_0]; +ASM_REAL_ARITH_TAC; +ASSUME_TAC2 (REAL_FIELD` ~( t2 = &0) ==> t2' = t2 * (t2' / t2 ) `); +FIRST_ASSUM SUBST1_TAC; +REWRITE_TAC[GSYM VECTOR_MUL_ASSOC; VECTOR_MUL_LCANCEL]; +DOWN THEN ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[]; +REPEAT STRIP_TAC; +ASM_REAL_ARITH_TAC]);; + + + + + + + + +let CIZMRRH = prove_by_refinement +(`local_fan (V,E,FF) ==> +generic V E /\ ~(circular V E \/ (? v w. lunar (v,w) V E )) \/ +circular V E /\ ~(generic V E \/ (? v w. lunar (v,w) V E )) \/ +(? v w. lunar (v,w) V E ) /\ ~( generic V E \/ circular V E ) `, +[ASM_CASES_TAC `(!v w u. + {(v:real^3), w} IN E /\ u IN V + ==> aff_ge {vec 0} {v, w} INTER aff_lt {vec 0} {u} = {})`; +REWRITE_TAC[convex_local_fan; generic]; +STRIP_TAC; +DISJ1_TAC; +ASM_REWRITE_TAC[circular; lunar; DE_MORGAN_THM]; +CONJ_TAC; +REWRITE_TAC[NOT_EXISTS_THM; +TAUT` ~( a /\ b /\ c) <=> a /\ b ==> ~c `]; +ASM_MESON_TAC[ +SET_RULE` a INTER b = {} /\ aa SUBSET a ==> aa INTER b = {} `; +AFF_GT_SUBSET_AFF_GE]; +REWRITE_TAC[GSYM circular; NOT_EXISTS_THM; DE_MORGAN_THM]; +REPEAT GEN_TAC THEN DISJ2_TAC; +ASM_CASES_TAC `{v:real^3, w} SUBSET V `; +DISJ2_TAC; +REWRITE_TAC[GSYM (TAUT` ~ a ==> b <=> a \/ b `)]; + +DOWN_TAC; +REWRITE_TAC[local_fan]; +LET_TAC; +NHANH FAN_IMP_NOT_EMPTY_DARTS; +NHANH ELMS_OF_HYPERMAP_HYP; +ASM_SIMP_TAC[]; +IMP_TAC; +REWRITE_TAC[TAUT`(a/\b)/\c <=> a/\b/\c`]; +IMP_TAC; +IMP_TAC; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[]; +NHANH (MESON[dih2k]` dih2k H d ==> CARD (dart H) = 2 * d `); +MP_TAC (ISPEC `H: (real^3#real^3)hypermap ` hypermap_lemma); +REPEAT STRIP_TAC; +ASSUME_TAC2 (ISPEC `dart (H:(real^3#real^3)hypermap)` CARD_EQ_0); +UNDISCH_TAC` ~( {} = dart (H:(real^3#real^3)hypermap)) `; +REWRITE_TAC[]; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +DOWN; +ASM_REWRITE_TAC[ARITH_RULE`2 * k = 0 <=> k = 0 `]; +ONCE_REWRITE_TAC[TAUT` a ==> b <=> ~ b ==> ~ a `]; +STRIP_TAC; +ASSUME_TAC2 ( +ISPECL [`CARD (FF:real^3#real^3 -> bool) `;`H:(real^3#real^3) hypermap `] +(GEN_ALL DIH2K_IMP_NODE_MAP_X_DIFF_X)); +DOWN_TAC; +REWRITE_TAC[FAN; INSERT_SUBSET; EMPTY_SUBSET]; +STRIP_TAC; +ASSUME_TAC2 (SPEC `v:real^3 ` IN_V_OF_FAN_EXISTS_DART); +DOWN; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM NHANH; +STRIP_TAC; +DOWN THEN DOWN; +UNDISCH_TAC` darts_of_hyp E (V:real^3 -> bool) = dart H `; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[]; +STRIP_TAC; +REWRITE_TAC[darts_of_hyp; IN_UNION; self_pairs; IN_ELIM_THM]; +ONCE_REWRITE_TAC[TAUT`a\/b <=> b\/a`]; +DISCH_THEN DISJ_CASES_TAC; +DOWN THEN STRIP_TAC; +UNDISCH_TAC `nn_of_hyp (vec 0,(V:real^3 -> bool),E) = node_map H`; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[]; +STRIP_TAC; + + +SUBGOAL_THEN ` (v:real^3,v':real^3) IN darts_of_hyp E V ` MP_TAC; +REWRITE_TAC[darts_of_hyp; IN_UNION]; +DISJ2_TAC; +REWRITE_TAC[self_pairs; IN_ELIM_THM]; +EXISTS_TAC `v'':real^3`; +ASM_REWRITE_TAC[]; +SIMP_TAC[nn_of_hyp]; +REMOVE_TAC; +UNDISCH_TAC` EE (v'':real^3) E = {} `; +DOWN THEN DOWN; +SIMP_TAC[PAIR_EQ; EMPTY_SUBSET; W_SUBSET_SINGLETON_IMP_IDE]; +(* --------------------------------------------------- *) +DOWN; +REWRITE_TAC[ord_pairs; IN_ELIM_THM; PAIR_EQ]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +UNDISCH_TAC` (w:real^3) IN V `; +UNDISCH_TAC ` {(a:real^3),b} IN E `; +PHA; +UNDISCH_TAC `!v w u. + {(v:real^3), w} IN E /\ u IN V + ==> {} = aff_ge {vec 0} {v, w} INTER aff_lt {vec 0} {u}`; +DISCH_TAC; +FIRST_ASSUM NHANH; +DOWN_TAC; +REWRITE_TAC[fan2]; +REWRITE_TAC[SET_RULE` ~( x IN s) <=> (!a. a IN s ==> ~(a = x )) `]; +REPLICATE_TAC 10 (IMP_TAC THEN DISCH_TAC); +FIRST_X_ASSUM NHANH; +STRIP_TAC; +REWRITE_TAC[COLLINEAR_LEMMA; DE_MORGAN_THM]; +CONJ_TAC THENL [ +EXPAND_TAC "a" THEN +FIRST_ASSUM ACCEPT_TAC; +CONJ_TAC THENL [ +FIRST_ASSUM ACCEPT_TAC; +REWRITE_TAC[]]]; + +ASSUME_TAC2 (ISPEC `vec 0:real^3 ` FAN7_SIMPLE); +DOWN THEN PHA THEN STRIP_TAC; +STRIP_TAC; +ASM_CASES_TAC `c = &0 ` THENL [ +UNDISCH_TAC `w = c % (a:real^3)` THEN +ASM_REWRITE_TAC[VECTOR_MUL_LZERO]; +ASM_CASES_TAC ` c = &1 `] THENL [ +UNDISCH_TAC `w = c % (a:real^3) ` THEN +ASM_SIMP_TAC[VECTOR_MUL_LID] THEN +EXPAND_TAC "a" THEN +FIRST_X_ASSUM ACCEPT_TAC; +ASM_CASES_TAC ` &0 < c `]; +(* ---------- sub 1 ---------- *) +UNDISCH_TAC` w IN (V:real^3 -> bool) `; +UNDISCH_TAC` v IN (V:real^3 -> bool) `; +PHA; +FIRST_ASSUM NHANH; +UNDISCH_TAC`~(w = (v:real^3)) `; +SIMP_TAC[SET_RULE`~(a = b) <=> {a} INTER {b} = {} `; INTER_COMM]; +REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING]; +ASSUME_TAC2 (AFF_SGN_TRULE`!v. ~((v:real^3) = vec 0) ==> +aff_ge {vec 0} {v} = { x| ?t0 tv. &0 <= tv /\ t0 + tv = &1 /\ +x = t0 % (vec 0) + tv % v } `); +ASSUME_TAC2 (SPEC `w:real^3` (AFF_SGN_TRULE`!v. ~((v:real^3) = vec 0) ==> +aff_ge {vec 0} {v} = { x| ?t0 tv. &0 <= tv /\ t0 + tv = &1 /\ +x = t0 % (vec 0) + tv % v } `)); +DOWN THEN DOWN THEN PHA THEN SIMP_TAC[]; +REPEAT STRIP_TAC; +DOWN; +UNDISCH_TAC ` ~((w:real^3) = vec 0) `; +PHA; +MATCH_MP_TAC (SET_RULE` a IN S ==> ~(~(a = x ) /\ S = {x}) `); +REWRITE_TAC[IN_INTER; IN_ELIM_THM]; +CONJ_TAC; +EXISTS_TAC` &1 - c `; +EXISTS_TAC `c:real`; +UNDISCH_TAC `&0 < c `; +SIMP_TAC[REAL_ARITH` &0 < a ==> &0 <= a `; +REAL_ARITH` &1 - c + c = &1 `; VECTOR_MUL_RZERO; +VECTOR_ADD_LID]; +ASM_REWRITE_TAC[]; +(* ============================ *) +EXISTS_TAC `&0 `; +EXISTS_TAC `&1 `; + +SIMP_TAC[VECTOR_MUL_LID; VECTOR_MUL_RZERO; +VECTOR_ADD_LID]; +REAL_ARITH_TAC; +UNDISCH_TAC ` ~(c = &0 ) `; +DOWN; +PHA; +REWRITE_TAC[REAL_ARITH` ~(&0 < c) /\ ~(c = &0) <=> c < &0 `]; +STRIP_TAC; +UNDISCH_TAC` {} = aff_ge {vec 0} {a, b} INTER aff_lt {vec 0} {(w:real^3)}`; +EXPAND_TAC "a"; +EXPAND_TAC "b"; +ASSUME_TAC2 (AFF_SGN_TRULE` ~((w:real^3) = vec 0) ==> +aff_lt {vec 0} {w} = {x | ? t0 tw . tw < &0 /\ t0 + tw = &1 /\ +x = t0 % (vec 0) + tw % w }`); +ASSUME_TAC2 ( +AFF_SGN_TRULE` ~((v:real^3) = vec 0) /\ ~( v' = vec 0) ==> +aff_ge {vec 0} {v,v'} = {x | ? t0 tv tv' . &0 <= tv /\ +&0 <= tv' /\ t0 + tv + tv' = &1 /\ +x = t0 % (vec 0) + tv % v + tv' % v' }`); +MATCH_MP_TAC ( +SET_RULE` -- (w:real^3) IN S ==> {} = S ==> F `); +DOWN THEN DOWN THEN PHA THEN SIMP_TAC[]; +REMOVE_TAC; +REWRITE_TAC[IN_INTER; IN_ELIM_THM]; +CONJ_TAC; +EXISTS_TAC` &1 + c `; +EXISTS_TAC ` -- (c:real) `; +EXISTS_TAC `&0 `; +ASM_REWRITE_TAC[VECTOR_MUL_LNEG; VECTOR_MUL_RZERO; VECTOR_MUL_LZERO; +VECTOR_ADD_RID; VECTOR_ADD_LID]; +DOWN THEN REAL_ARITH_TAC; +(* =================== *) +EXISTS_TAC `&2 `; +EXISTS_TAC ` -- &1 `; +REWRITE_TAC[VECTOR_MUL_LNEG; VECTOR_MUL_LID; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +REAL_ARITH_TAC; +(* +++++++++++++++++++++++++++++++++++++++++++++++++ *) +(* ================================================= *) +ASM_SIMP_TAC[]; +(* ************************************************* *) +(* ================================================= *) +DOWN; +REWRITE_TAC[NOT_FORALL_THM; TAUT` ~( a ==> b) <=> a /\ ~ b `; +local_fan]; +LET_TAC; +REPEAT STRIP_TAC; +DOWN_TAC; +NHANH FAN_IMP_DIFF; +STRIP_TAC; +SUBGOAL_THEN ` (v:real^3) IN UNIONS E /\ w IN UNIONS E ` ASSUME_TAC +THENL [REWRITE_TAC[IN_UNIONS] THEN +ASM_MESON_TAC[SET_RULE` a IN {a,b} /\ b IN {a,b} `]; +DOWN_TAC]; +REWRITE_TAC[MESON[]`(!x. P x \/ Q x ==> R x) <=> +(! x. P x ==> R x ) /\ (!x. Q x ==> R x ) `]; +STRIP_TAC; +DOWN THEN DOWN; +FIRST_X_ASSUM NHANH; +UNDISCH_TAC `(u:real^3) IN V `; +FIRST_ASSUM NHANH; +REPEAT STRIP_TAC; +ASSUME_TAC2 ( +AFF_SGN_TRULE` ~((v:real^3) = vec 0 ) /\ ~(w = vec 0 ) ==> +aff_ge {vec 0} {v, w} = {x | ? t0 tv tw. &0 <= tv /\ &0 <= tw /\ +t0 + tv + tw = &1 /\ x = t0 % (vec 0) + tv % v + tw % w } `); +ASSUME_TAC2 ( +ISPECL [`(vec 0):real^3 `;`u:real^3`] (REWRITE_RULE[DISJOINT; +SET_RULE` {a} INTER {b} = {} <=> ~( b = a )`] AFF_LT_1_1)); +SUBGOAL_THEN` ~ (generic (V:real^3 -> bool) E )` ASSUME_TAC +THENL [REWRITE_TAC[generic] THEN +ASM_MESON_TAC[]; +UNDISCH_TAC `~(aff_ge {vec 0} {(v:real^3), w} INTER +aff_lt {vec 0} {u} = {})`]; +ASSUME_TAC2 ( +ISPECL [` v:real^3 `;` (vec 0): real^3 `;` w:real^3 `] +(GEN_ALL AFF_GE_TO_AFF_GT2_GE1)); +DOWN THEN SIMP_TAC[]; +STRIP_TAC; +REWRITE_TAC[SET_RULE`( a UNION b ) INTER c = {} <=> a INTER c = {} /\ +b INTER c = {} `]; +STRIP_TAC; +ASM_SIMP_TAC[]; +DOWN THEN REWRITE_TAC[DE_MORGAN_THM]; +DISCH_TAC; +ASM_CASES_TAC ` circular (V:real^3 -> bool) E ` THENL [ +ASM_SIMP_TAC[lunar]; +DISJ2_TAC]; +ASM_SIMP_TAC[lunar]; +DOWN THEN DOWN THEN STRIP_TAC; +(* there are three subgoal here *) +(* -------- sub 1 -------------- *) +REWRITE_TAC[circular]; +ASM_MESON_TAC[]; +(* --------- sub 2 -------------- *) +DISCH_TAC; +EXISTS_TAC `v:real^3`; +EXISTS_TAC `u:real^3 `; +ASSUME_TAC2 AFF_GE_INTER_AFF_LT_IMP_NOT_EQ_COL; +DOWN; +ASM_SIMP_TAC[INSERT_COMM; INSERT_SUBSET; EMPTY_SUBSET]; +DISCH_TAC; +MATCH_MP_TAC (SET_RULE`v IN UNIONS E /\ UNIONS E SUBSET V ==> v IN V `); +DOWN_TAC; +SIMP_TAC[FAN]; +(* -------------- sub 3 ------------- *) +DISCH_TAC; +EXISTS_TAC `u:real^3 `; +EXISTS_TAC `w:real^3 `; +ASSUME_TAC2 ( +SPEC `w:real^3 ` (GEN `v:real^3 ` AFF_GE_INTER_AFF_LT_IMP_NOT_EQ_COL)); +ASM_SIMP_TAC[]; +ASM_SIMP_TAC[INSERT_COMM; INSERT_SUBSET; EMPTY_SUBSET]; +MATCH_MP_TAC (SET_RULE`v IN UNIONS E /\ UNIONS E SUBSET V ==> v IN V `); +DOWN_TAC; +SIMP_TAC[FAN]]);; + + +end;; diff --git a/text_formalization/local/XIVPHKS.hl b/text_formalization/local/XIVPHKS.hl new file mode 100644 index 0000000..10c6168 --- /dev/null +++ b/text_formalization/local/XIVPHKS.hl @@ -0,0 +1,487 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Section: Appendix *) +(* Chapter: Local Fan *) +(* Author: John Harrison *) +(* Date: 2013-06-11 *) +(* ========================================================================== *) + +module Xivphks = struct + + open Hales_tactic;; + +(* ------------------------------------------------------------------------- *) +(* Lemma 7.141 *) +(* ------------------------------------------------------------------------- *) + +let FSQKWKK = prove + (`!v0 v1 v2 v3. + azim v0 v1 v2 v3 <= pi ==> azim v0 v2 v3 v1 <= pi`, + GEOM_ORIGIN_TAC `v0:real^3` THEN + REWRITE_TAC[GSYM Local_lemmas.SIN_AZIM_POS_PI_LT] THEN + REWRITE_TAC[GSYM REAL_NOT_LT; Local_lemmas.SIN_AZIM_MUTUAL_SROSS] THEN + MESON_TAC[CROSS_TRIPLE]);; + +(* ------------------------------------------------------------------------- *) +(* Lemma 7.143. *) +(* ------------------------------------------------------------------------- *) + +let XIVPHKS = prove + (`!W a d e n r w. + 1 <= n /\ n - 1 = r /\ + pairwise (\i j. ~collinear{vec 0,w i,w j}) (0..n) /\ + (\(i,j,k). dihV (vec 0) (w i) (w j) (w k)) = d /\ + (\(i,j,k). azim (vec 0) (w i) (w j) (w k)) = a /\ + (\i. wedge_ge (vec 0) (w i) (w(i + 1)) (w(i - 1))) = W /\ + &0 < &2 * e /\ + (!i. i IN 1..r ==> &2 * e < a(i,i + 1,i - 1)) /\ + (!i. i IN 1..r ==> a(i,i + 1,i - 1) <= pi) /\ + (!p q. {p,q,q+1} SUBSET 0..r /\ ~(p = q) /\ ~(p = q + 1) + ==> d(p,q,q + 1) < e) /\ + (!p q. {p,p+1,q} SUBSET 0..r /\ q > p + 1 + ==> d(p,p + 1,q) < e) /\ + (!p q. {p+1,p,q} SUBSET 0..r /\ q < p + ==> d(p + 1,p,q) < e) + ==> (!k j. j + k <= r ==> w j IN W(j + k)) /\ + (!k j. 1 <= j /\ j + k <= r ==> w(j + k) IN W(j))`, + REPEAT GEN_TAC THEN REWRITE_TAC[REAL_ARITH `&0 < &2 * e <=> &0 < e`] THEN + REWRITE_TAC[IN_NUMSEG; GT; pairwise; LE_0] THEN STRIP_TAC THEN + REWRITE_TAC[AND_FORALL_THM; TAUT + `(p ==> r) /\ (q /\ p ==> s) <=> p ==> r /\ (q ==> s)`] THEN + INDUCT_TAC THENL + [REWRITE_TAC[ADD_CLAUSES; SUB_0] THEN + EXPAND_TAC "W" THEN REWRITE_TAC[Localization.wedge_ge; IN_ELIM_THM] THEN + REWRITE_TAC[Local_lemmas.AZIM_SPEC_DEGENERATE; azim; REAL_LE_REFL]; + ALL_TAC] THEN + ASM_CASES_TAC `k = 0` THENL + [ASM_REWRITE_TAC[ADD_CLAUSES] THEN REWRITE_TAC[ADD1] THEN + EXPAND_TAC "W" THEN REWRITE_TAC[Localization.wedge_ge; IN_ELIM_THM] THEN + REWRITE_TAC[ADD_SUB; azim; REAL_LE_REFL; AZIM_REFL]; + ALL_TAC] THEN + DISJ_CASES_TAC(ARITH_RULE `r <= 1 \/ 2 <= r`) THENL + [ASM_ARITH_TAC; ALL_TAC] THEN + SUBGOAL_THEN `&2 * e < &2 * pi` ASSUME_TAC THENL + [MATCH_MP_TAC REAL_LT_TRANS THEN + EXISTS_TAC `a(1,1 + 1,1 - 1):real` THEN CONJ_TAC THENL + [FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; + EXPAND_TAC "a" THEN REWRITE_TAC[azim]]; + ALL_TAC] THEN + REWRITE_TAC[ADD1] THEN X_GEN_TAC `j:num` THEN DISCH_TAC THEN + MATCH_MP_TAC(TAUT `q /\ (q ==> p) ==> p /\ q`) THEN CONJ_TAC THENL + [DISCH_TAC THEN UNDISCH_THEN + `!j. j + k <= r + ==> (w:num->real^3) j IN W (j + k) /\ (1 <= j ==> w (j + k) IN W j)` + (MP_TAC o SPEC `j:num`) THEN + ASM_REWRITE_TAC[] THEN ANTS_TAC THENL [ASM_ARITH_TAC; STRIP_TAC] THEN + SUBGOAL_THEN + `a(j + k,j + k + 1,j) <= a(j + k,j + k + 1,j + k - 1)` + ASSUME_TAC THENL + [UNDISCH_TAC `(w:num->real^3) j IN W (j + k)` THEN + MAP_EVERY EXPAND_TAC ["W"; "a"] THEN + REWRITE_TAC[Localization.wedge_ge; IN_ELIM_THM] THEN + DISCH_THEN(MP_TAC o CONJUNCT2) THEN MATCH_MP_TAC EQ_IMP THEN + REPEAT(BINOP_TAC THEN REWRITE_TAC[]) THEN AP_TERM_TAC THEN ASM_ARITH_TAC; + ALL_TAC] THEN + SUBGOAL_THEN `a(j + k,j + k + 1,j + k - 1) <= pi` ASSUME_TAC THENL + [ASM_SIMP_TAC[ARITH_RULE `~(k = 0) ==> j + k - 1 = (j + k) - 1`] THEN + REWRITE_TAC[ADD_ASSOC] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; + ALL_TAC] THEN + SUBGOAL_THEN `a(j,j + k,j + k + 1) <= pi` ASSUME_TAC THENL + [SUBGOAL_THEN `a (j + k,j + k + 1,j) <= pi` MP_TAC THENL + [ASM_REAL_ARITH_TAC; EXPAND_TAC "a" THEN REWRITE_TAC[]] THEN + MESON_TAC[FSQKWKK]; + ALL_TAC] THEN + SUBGOAL_THEN `a(j,j + k,j + k + 1) < e` ASSUME_TAC THENL + [SUBGOAL_THEN `a(j,j + k,j + k + 1):real = d(j,j + k,j + k + 1)` + SUBST1_TAC THENL + [UNDISCH_TAC `a (j,j + k,j + k + 1) <= pi` THEN + MAP_EVERY EXPAND_TAC ["a"; "d"] THEN REWRITE_TAC[] THEN DISCH_TAC THEN + MATCH_MP_TAC Polar_fan.AZIM_DIHV_SAME_STRONG THEN ASM_REWRITE_TAC[] THEN + CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; + REWRITE_TAC[ADD_ASSOC] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_NUMSEG] THEN ASM_ARITH_TAC]; + ALL_TAC] THEN + SUBGOAL_THEN `a(j,j + 1,j + k) <= a(j,j + 1,j - 1)` ASSUME_TAC THENL + [UNDISCH_TAC `(w:num->real^3) (j + k) IN W j` THEN + MAP_EVERY EXPAND_TAC ["W"; "a"] THEN + SIMP_TAC[Localization.wedge_ge; IN_ELIM_THM]; + ALL_TAC] THEN + SUBGOAL_THEN `a(j,j + 1,j - 1) <= pi` ASSUME_TAC THENL + [FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; ALL_TAC] THEN + SUBGOAL_THEN `a(j,j + 1,j + k) <= pi` ASSUME_TAC THENL + [ASM_REAL_ARITH_TAC; ALL_TAC] THEN + SUBGOAL_THEN `a(j,j + 1,j + k) < e` ASSUME_TAC THENL + [ASM_CASES_TAC `k = 1` THENL + [EXPAND_TAC "a" THEN REWRITE_TAC[] THEN ASM_REWRITE_TAC[AZIM_REFL]; + ALL_TAC] THEN + SUBGOAL_THEN `a(j,j + 1,j + k):real = d(j,j + 1,j + k)` + SUBST1_TAC THENL + [UNDISCH_TAC `a (j,j + 1,j + k) <= pi` THEN + MAP_EVERY EXPAND_TAC ["a"; "d"] THEN REWRITE_TAC[] THEN DISCH_TAC THEN + MATCH_MP_TAC Polar_fan.AZIM_DIHV_SAME_STRONG THEN ASM_REWRITE_TAC[] THEN + CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; + FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_NUMSEG] THEN + ASM_ARITH_TAC]; + ALL_TAC] THEN + SUBGOAL_THEN `a(j,j + 1,j + k + 1):real <= a(j,j + 1,j - 1)` + MP_TAC THENL + [MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a(j,j + 1,j + k) + a(j,j + k,j + k + 1)` THEN CONJ_TAC THENL + [MATCH_MP_TAC REAL_EQ_IMP_LE THEN MAP_EVERY UNDISCH_TAC + [`a (j,j + k,j + k + 1):real < e`; `a (j,j + 1,j + k):real < e`] THEN + EXPAND_TAC "a" THEN REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC Fan.sum3_azim_fan THEN + CONJ_TAC THENL [ASM_REAL_ARITH_TAC; ALL_TAC] THEN + REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; + ALL_TAC] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&2 * e` THEN CONJ_TAC THENL + [ASM_REAL_ARITH_TAC; MATCH_MP_TAC REAL_LT_IMP_LE] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; + EXPAND_TAC "W" THEN REWRITE_TAC[Localization.wedge_ge; IN_ELIM_THM] THEN + EXPAND_TAC "a" THEN REWRITE_TAC[azim]]; + ALL_TAC] THEN + DISCH_TAC THEN + UNDISCH_THEN + `!j. j + k <= r + ==> (w:num->real^3) j IN W (j + k) /\ (1 <= j ==> w (j + k) IN W j)` + (MP_TAC o SPEC `j + 1`) THEN + ASM_REWRITE_TAC[ARITH_RULE `(j + 1) + k = j + k + 1`; + ARITH_RULE `1 <= j + 1`] THEN + STRIP_TAC THEN + SUBGOAL_THEN `a(j + 1,j + 2,j + k + 1) <= a(j + 1,j + 2,j)` ASSUME_TAC THENL + [UNDISCH_TAC `(w:num->real^3) (j + k + 1) IN W (j + 1)` THEN + EXPAND_TAC "W" THEN REWRITE_TAC[Localization.wedge_ge; IN_ELIM_THM] THEN + EXPAND_TAC "a" THEN SIMP_TAC[ARITH_RULE `(a + 1) + 1 = a + 2`; ADD_SUB]; + ALL_TAC] THEN + SUBGOAL_THEN `a(j + 1,j + 2,j + k + 1) + a(j + 1,j + k + 1,j) = + a(j + 1,j + 2,j)` + ASSUME_TAC THENL + [CONV_TAC SYM_CONV THEN + UNDISCH_TAC `a(j + 1,j + 2,j + k + 1) <= a(j + 1,j + 2,j)` THEN + EXPAND_TAC "a" THEN REWRITE_TAC[] THEN DISCH_TAC THEN + MATCH_MP_TAC Fan.sum4_azim_fan THEN ASM_REWRITE_TAC[] THEN + REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; + ALL_TAC] THEN + SUBGOAL_THEN `a(j + 1,j + k + 1,j) <= a(j + 1,j + 2,j)` ASSUME_TAC THENL + [FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (REAL_ARITH + `a + b = c ==> &0 <= a ==> b <= c`)) THEN + EXPAND_TAC "a" THEN REWRITE_TAC[azim]; + ALL_TAC] THEN + SUBGOAL_THEN `a(j + 1,(j + 1) + 1,(j + 1) - 1) <= pi` MP_TAC THENL + [FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; + REWRITE_TAC[ADD_SUB; ARITH_RULE `(n + 1) + 1 = n + 2`] THEN + DISCH_TAC] THEN + SUBGOAL_THEN `a(j + k + 1,j,j + 1) <= pi` ASSUME_TAC THENL + [SUBGOAL_THEN `a(j + 1,j + k + 1,j) <= pi` MP_TAC THENL + [ASM_REAL_ARITH_TAC; EXPAND_TAC "a" THEN REWRITE_TAC[]] THEN + MESON_TAC[FSQKWKK]; + ALL_TAC] THEN + SUBGOAL_THEN `a(j + k + 1,j,j + 1) < e` ASSUME_TAC THENL + [SUBGOAL_THEN `a(j + k + 1,j,j + 1):real = d(j + k + 1,j,j + 1) ` + SUBST1_TAC THENL + [UNDISCH_TAC `a(j + k + 1,j,j + 1) <= pi` THEN + MAP_EVERY EXPAND_TAC ["a"; "d"] THEN REWRITE_TAC[] THEN DISCH_TAC THEN + MATCH_MP_TAC Polar_fan.AZIM_DIHV_SAME_STRONG THEN ASM_REWRITE_TAC[] THEN + CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; + REWRITE_TAC[ADD_ASSOC] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_NUMSEG] THEN ASM_ARITH_TAC]; + ALL_TAC] THEN + SUBGOAL_THEN `a(j + k + 1,j + k + 2,j + 1) <= a(j + k + 1,j + k + 2,j + k)` + ASSUME_TAC THENL + [UNDISCH_TAC `(w:num->real^3)(j + 1) IN W (j + k + 1)` THEN + MAP_EVERY EXPAND_TAC ["W"; "a"] THEN + SIMP_TAC[Localization.wedge_ge; IN_ELIM_THM; + ARITH_RULE `(j + k + 1) + 1 = j + k + 2`; + ARITH_RULE `(j + k + 1) - 1 = j + k`]; + ALL_TAC] THEN + SUBGOAL_THEN `a(j + k + 1,j + k + 2,j + 1) + a(j + k + 1,j + 1,j + k) = + a(j + k + 1,j + k + 2,j + k)` + ASSUME_TAC THENL + [CONV_TAC SYM_CONV THEN UNDISCH_TAC + `a(j + k + 1,j + k + 2,j + 1) <= a(j + k + 1,j + k + 2,j + k)` THEN + EXPAND_TAC "a" THEN REWRITE_TAC[] THEN DISCH_TAC THEN + MATCH_MP_TAC Fan.sum4_azim_fan THEN ASM_REWRITE_TAC[] THEN + REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; + ALL_TAC] THEN + SUBGOAL_THEN `a(j + k + 1,(j + k + 1) + 1,(j + k + 1) - 1) <= pi` + MP_TAC THENL + [FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; + REWRITE_TAC[ARITH_RULE `(j + k + 1) + 1 = j + k + 2`; + ARITH_RULE `(j + k + 1) - 1 = j + k`] THEN + DISCH_TAC] THEN + SUBGOAL_THEN `a(j + k + 1,j + 1,j + k) <= a(j + k + 1,j + k + 2,j + k)` + ASSUME_TAC THENL + [FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (REAL_ARITH + `a + b = c ==> &0 <= a ==> b <= c`)) THEN + EXPAND_TAC "a" THEN REWRITE_TAC[azim]; + ALL_TAC] THEN + SUBGOAL_THEN `a(j + k + 1,j + 1,j + k) <= pi` ASSUME_TAC THENL + [ASM_REAL_ARITH_TAC; ALL_TAC] THEN + SUBGOAL_THEN `a(j + k + 1,j + 1,j + k) < e` ASSUME_TAC THENL + [ASM_CASES_TAC `k = 1` THENL + [ASM_REWRITE_TAC[] THEN EXPAND_TAC "a" THEN REWRITE_TAC[AZIM_REFL] THEN + ASM_REWRITE_TAC[]; + ALL_TAC] THEN + SUBGOAL_THEN `a(j + k + 1,j + 1,j + k):real = d(j + k + 1,j + 1,j + k)` + SUBST1_TAC THENL + [UNDISCH_TAC `a(j + k + 1,j + 1,j + k) <= pi` THEN + MAP_EVERY EXPAND_TAC ["a"; "d"] THEN REWRITE_TAC[] THEN DISCH_TAC THEN + MATCH_MP_TAC Polar_fan.AZIM_DIHV_SAME_STRONG THEN ASM_REWRITE_TAC[] THEN + CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; + ALL_TAC] THEN + SUBGOAL_THEN `d((j + k) + 1,j + k,j + 1) < e` MP_TAC THENL + [FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_NUMSEG] THEN ASM_ARITH_TAC; + EXPAND_TAC "d" THEN REWRITE_TAC[ADD_ASSOC; Counting_spheres.DIHV_SYM]]; + ALL_TAC] THEN + SUBGOAL_THEN `a(j + k + 1,j + k + 2,j) <= a(j + k + 1,j + k + 2,j + k)` + MP_TAC THENL + [ALL_TAC; + MAP_EVERY EXPAND_TAC ["W"; "a"] THEN + SIMP_TAC[Localization.wedge_ge; azim; IN_ELIM_THM; + ARITH_RULE `(j + k + 1) + 1 = j + k + 2`; + ARITH_RULE `(j + k + 1) - 1 = j + k`]] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a(j + k + 1,j + k + 2,j) + a(j + k + 1,j,j + k)` THEN + CONJ_TAC THENL + [REWRITE_TAC[REAL_LE_ADDR] THEN EXPAND_TAC "a" THEN REWRITE_TAC[azim]; + ALL_TAC] THEN + MATCH_MP_TAC REAL_EQ_IMP_LE THEN CONV_TAC SYM_CONV THEN + EXPAND_TAC "a" THEN REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC Fan.sum5_azim_fan THEN CONJ_TAC THENL + [ALL_TAC; + REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&2 * e` THEN CONJ_TAC THENL + [MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a(j + k + 1,j,j + 1) + a(j + k + 1,j + 1,j + k)` THEN + CONJ_TAC THENL + [MATCH_MP_TAC REAL_EQ_IMP_LE THEN MAP_EVERY UNDISCH_TAC + [`a(j + k + 1,j,j + 1):real < e`; + `a(j + k + 1,j + 1,j + k):real < e`] THEN + EXPAND_TAC "a" THEN REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC Fan.sum3_azim_fan THEN + CONJ_TAC THENL [ASM_REAL_ARITH_TAC; ALL_TAC] THEN + REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; + ASM_REAL_ARITH_TAC]; + SUBGOAL_THEN + `&2 * e < a (j + k + 1,(j + k + 1) + 1,(j + k + 1) - 1)` + MP_TAC THENL + [FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; + EXPAND_TAC "a" THEN + REWRITE_TAC[ARITH_RULE `(j + k + 1) + 1 = j + k + 2`; + ARITH_RULE `(j + k + 1) - 1 = j + k`] THEN + REAL_ARITH_TAC]]);; + +(* 1..r are the straight angles. Modified from Xivphks.XIVPHKS by shifting indices. *) + +let XIVPHKS_SHIFT = prove_by_refinement( + `!W a d e r w. + pairwise (\i j. ~collinear {vec 0, w i, w j}) (0..(r+1)) /\ + pairwise (\i j. ~collinear {vec 0, w i, w j}) (1..(r+2)) /\ + (\(i,j,k). dihV (vec 0) (w i) (w j) (w k)) = d /\ + (\(i,j,k). azim (vec 0) (w i) (w j) (w k)) = a /\ + (\i. wedge_ge (vec 0) (w i) (w (i + 1)) (w (i - 1))) = W /\ + &0 < &2 * e /\ + (!i. i IN 1..(r+1) ==> &2 * e < a (i,i + 1,i - 1)) /\ + (!i. i IN 1..(r+1) ==> a (i,i + 1,i - 1) <= pi) /\ + (!p q. + {p, q, q + 1} SUBSET 1..(r+1) /\ ~(p = q) /\ ~(p = q + 1) + ==> d (p,q,q + 1) < e) /\ + (!p q. + {p, p + 1, q} SUBSET 1..(r+1) /\ q > p + 1 ==> d (p,p + 1,q) < e) /\ + (!p q. {p + 1, p, q} SUBSET 1..(r+1) /\ q < p ==> d (p + 1,p,q) < e) + ==> (!k j. 1 <= j /\ j + k <= r+1 ==> w j IN W (j + k)) /\ + (!k j. 1 <= j /\ j + k <= r+1 ==> w (j + k) IN W j)`, + (* {{{ proof *) + [ + REPEAT GEN_TAC THEN REWRITE_TAC[REAL_ARITH `&0 < &2 * e <=> &0 < e`]; + REWRITE_TAC[IN_NUMSEG; GT; pairwise; LE_0] THEN STRIP_TAC; + REWRITE_TAC[AND_FORALL_THM; TAUT `(p ==> r) /\ (q /\ p ==> s) <=> p ==> r /\ (q ==> s)`]; + INDUCT_TAC; + REWRITE_TAC[ADD_CLAUSES; SUB_0]; + EXPAND_TAC "W" THEN REWRITE_TAC[Localization.wedge_ge; IN_ELIM_THM]; + BY(REWRITE_TAC[Local_lemmas.AZIM_SPEC_DEGENERATE; azim; REAL_LE_REFL]); + ASM_CASES_TAC `k = 0`; + ASM_REWRITE_TAC[ADD_CLAUSES] THEN REWRITE_TAC[ADD1]; + EXPAND_TAC "W" THEN REWRITE_TAC[Localization.wedge_ge; IN_ELIM_THM]; + BY(REWRITE_TAC[ADD_SUB; azim; REAL_LE_REFL; AZIM_REFL]); + SUBGOAL_THEN `&2 * e < &2 * pi` ASSUME_TAC; + MATCH_MP_TAC REAL_LT_TRANS; + EXISTS_TAC `a(1,1 + 1,1 - 1):real` THEN CONJ_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC); + BY(EXPAND_TAC "a" THEN REWRITE_TAC[azim]); + REWRITE_TAC[ADD1] THEN X_GEN_TAC `j:num`; + MATCH_MP_TAC(TAUT `q /\ (q ==> p) ==> p /\ q`) THEN CONJ_TAC; + DISCH_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`j`]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC THEN ANTS_TAC; + BY(ASM_ARITH_TAC); + DISCH_TAC; + FIRST_X_ASSUM_ST `==>` MP_TAC THEN ANTS_TAC; + BY(ASM_ARITH_TAC); + DISCH_TAC; + SUBGOAL_THEN `a(j + k,j + k + 1,j) <= a(j + k,j + k + 1,j + k - 1)` ASSUME_TAC; + FIRST_X_ASSUM MP_TAC THEN MAP_EVERY EXPAND_TAC ["W"; "a"]; + REWRITE_TAC[Localization.wedge_ge; IN_ELIM_THM]; + DISCH_THEN(MP_TAC o CONJUNCT2) THEN MATCH_MP_TAC EQ_IMP; + BY(REPEAT(BINOP_TAC THEN REWRITE_TAC[]) THEN AP_TERM_TAC THEN ASM_ARITH_TAC); + SUBGOAL_THEN `a(j + k,j + k + 1,j + k - 1) <= pi` ASSUME_TAC; + ASM_SIMP_TAC[ARITH_RULE `~(k = 0) ==> j + k - 1 = (j + k) - 1`]; + BY(REWRITE_TAC[ADD_ASSOC] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC); + SUBGOAL_THEN `a(j,j + k,j + k + 1) <= pi` ASSUME_TAC; + SUBGOAL_THEN `a (j + k,j + k + 1,j) <= pi` MP_TAC THENL [ASM_REAL_ARITH_TAC; EXPAND_TAC "a" THEN REWRITE_TAC[]]; + BY(MESON_TAC[FSQKWKK]); + SUBGOAL_THEN `a(j,j + k,j + k + 1) < e` ASSUME_TAC; + SUBGOAL_THEN `a(j,j + k,j + k + 1):real = d(j,j + k,j + k + 1)` SUBST1_TAC; + UNDISCH_TAC `a (j,j + k,j + k + 1) <= pi`; + MAP_EVERY EXPAND_TAC ["a"; "d"] THEN REWRITE_TAC[] THEN DISCH_TAC; + MATCH_MP_TAC Polar_fan.AZIM_DIHV_SAME_STRONG THEN ASM_REWRITE_TAC[]; + BY(CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC); + REWRITE_TAC[ADD_ASSOC] THEN FIRST_X_ASSUM MATCH_MP_TAC; + REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_NUMSEG]; + BY(ASM_ARITH_TAC); + SUBGOAL_THEN `a(j,j + 1,j + k) <= a(j,j + 1,j - 1)` ASSUME_TAC; + UNDISCH_TAC `(w:num->real^3) (j + k) IN W j`; + MAP_EVERY EXPAND_TAC ["W"; "a"]; + BY(SIMP_TAC[Localization.wedge_ge; IN_ELIM_THM]); + SUBGOAL_THEN `a(j,j + 1,j - 1) <= pi` ASSUME_TAC THENL [FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; ALL_TAC]; + SUBGOAL_THEN `a(j,j + 1,j + k) <= pi` ASSUME_TAC THENL [ASM_REAL_ARITH_TAC; ALL_TAC]; + SUBGOAL_THEN `a(j,j + 1,j + k) < e` ASSUME_TAC; + ASM_CASES_TAC `k=1`; + BY(EXPAND_TAC "a" THEN REWRITE_TAC[] THEN ASM_REWRITE_TAC[AZIM_REFL]); + SUBGOAL_THEN `a(j,j + 1,j + k):real = d(j,j + 1,j + k)` SUBST1_TAC; + UNDISCH_TAC `a (j,j + 1,j + k) <= pi`; + MAP_EVERY EXPAND_TAC ["a"; "d"] THEN REWRITE_TAC[] THEN DISCH_TAC; + MATCH_MP_TAC Polar_fan.AZIM_DIHV_SAME_STRONG THEN ASM_REWRITE_TAC[]; + BY(CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_NUMSEG]; + BY(ASM_ARITH_TAC); + SUBGOAL_THEN `a(j,j + 1,j + k + 1):real <= a(j,j + 1,j - 1)` MP_TAC; + MATCH_MP_TAC REAL_LE_TRANS; + EXISTS_TAC `a(j,j + 1,j + k) + a(j,j + k,j + k + 1)` THEN CONJ_TAC; + MATCH_MP_TAC REAL_EQ_IMP_LE THEN MAP_EVERY UNDISCH_TAC [`a (j,j + k,j + k + 1):real < e`; `a (j,j + 1,j + k):real < e`]; + EXPAND_TAC "a" THEN REWRITE_TAC[] THEN REPEAT STRIP_TAC; + MATCH_MP_TAC Fan.sum3_azim_fan; + CONJ_TAC THENL [ASM_REAL_ARITH_TAC; ALL_TAC]; + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC); + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&2 * e` THEN CONJ_TAC; + BY(ASM_REAL_ARITH_TAC); + MATCH_MP_TAC REAL_LT_IMP_LE; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC); + EXPAND_TAC "W" THEN REWRITE_TAC[Localization.wedge_ge; IN_ELIM_THM]; + BY(EXPAND_TAC "a" THEN REWRITE_TAC[azim]); + DISCH_TAC; + COMMENT "midpoint -- down to 1 goal"; + DISCH_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`j+1`]); + ASM_REWRITE_TAC[arith `1 <= j+1`;arith `(j + 1) + k = j + k + 1`;]; + REPEAT WEAKER_STRIP_TAC; + SUBGOAL_THEN `a(j + 1,j + 2,j + k + 1) <= a(j + 1,j + 2,j)` ASSUME_TAC; + UNDISCH_TAC `(w:num->real^3) (j + k + 1) IN W (j + 1)`; + EXPAND_TAC "W" THEN REWRITE_TAC[Localization.wedge_ge; IN_ELIM_THM]; + BY(EXPAND_TAC "a" THEN SIMP_TAC[ARITH_RULE `(a + 1) + 1 = a + 2`; ADD_SUB]); + SUBGOAL_THEN `a(j + 1,j + 2,j + k + 1) + a(j + 1,j + k + 1,j) = a(j + 1,j + 2,j)` ASSUME_TAC; + CONV_TAC SYM_CONV; + UNDISCH_TAC `a(j + 1,j + 2,j + k + 1) <= a(j + 1,j + 2,j)`; + EXPAND_TAC "a" THEN REWRITE_TAC[] THEN DISCH_TAC; + MATCH_MP_TAC Fan.sum4_azim_fan THEN ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `~collinear {vec 0, w (j + 1), w j}` (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `collinear` kill; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC); + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN TRY ASM_ARITH_TAC); + SUBGOAL_THEN `a(j + 1,j + k + 1,j) <= a(j + 1,j + 2,j)` ASSUME_TAC; + FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (REAL_ARITH `a + b = c ==> &0 <= a ==> b <= c`)); + BY(EXPAND_TAC "a" THEN REWRITE_TAC[azim]); + SUBGOAL_THEN `a(j + 1,(j + 1) + 1,(j + 1) - 1) <= pi` MP_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC); + REWRITE_TAC[ADD_SUB; ARITH_RULE `(n + 1) + 1 = n + 2`]; + DISCH_TAC; + SUBGOAL_THEN `a(j + k + 1,j,j + 1) <= pi` ASSUME_TAC; + SUBGOAL_THEN `a(j + 1,j + k + 1,j) <= pi` MP_TAC; + BY(ASM_REAL_ARITH_TAC); + EXPAND_TAC "a" THEN REWRITE_TAC[]; + BY(MESON_TAC[FSQKWKK]); + SUBGOAL_THEN `a(j + k + 1,j,j + 1) < e` ASSUME_TAC; + ASM_CASES_TAC `k = 0`; + BY(EXPAND_TAC "a" THEN ASM_REWRITE_TAC[Local_lemmas.AZIM_SPEC_DEGENERATE;arith `j + 0 + 1 = j+1`]); + SUBGOAL_THEN `a(j + k + 1,j,j + 1):real = d(j + k + 1,j,j + 1) ` SUBST1_TAC; + UNDISCH_TAC `a(j + k + 1,j,j + 1) <= pi`; + MAP_EVERY EXPAND_TAC ["a"; "d"] THEN REWRITE_TAC[] THEN DISCH_TAC; + MATCH_MP_TAC Polar_fan.AZIM_DIHV_SAME_STRONG THEN ASM_REWRITE_TAC[]; + BY(CONJ_TAC THENL [FIRST_X_ASSUM_ST `collinear` kill;ALL_TAC] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC); + REWRITE_TAC[ADD_ASSOC] THEN FIRST_X_ASSUM MATCH_MP_TAC; + BY(REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_NUMSEG] THEN ASM_ARITH_TAC); + SUBGOAL_THEN `a(j + k + 1,j + k + 2,j + 1) <= a(j + k + 1,j + k + 2,j + k)` ASSUME_TAC; + UNDISCH_TAC `(w:num->real^3)(j + 1) IN W (j + k + 1)`; + MAP_EVERY EXPAND_TAC ["W"; "a"]; + BY(SIMP_TAC[Localization.wedge_ge; IN_ELIM_THM; ARITH_RULE `(j + k + 1) + 1 = j + k + 2`; ARITH_RULE `(j + k + 1) - 1 = j + k`]); + SUBGOAL_THEN `a(j + k + 1,j + k + 2,j + 1) + a(j + k + 1,j + 1,j + k) = a(j + k + 1,j + k + 2,j + k)` ASSUME_TAC; + CONV_TAC SYM_CONV; + UNDISCH_TAC `a(j + k + 1,j + k + 2,j + 1) <= a(j + k + 1,j + k + 2,j + k)`; + EXPAND_TAC "a" THEN REWRITE_TAC[] THEN DISCH_TAC; + MATCH_MP_TAC Fan.sum4_azim_fan THEN ASM_REWRITE_TAC[]; + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC); + COMMENT "ok"; + ASM_CASES_TAC `k = 0`; + ASM_REWRITE_TAC[arith `j+0+1 = j+1`]; + EXPAND_TAC "W" THEN REWRITE_TAC[]; + ASM_SIMP_TAC[arith `1 <= j ==> (j+1)+1 = j+2 /\ (j+1)-1 = j`]; + BY(REWRITE_TAC[Local_lemmas1.FST_LST_IN_WEDGE_GE]); + SUBGOAL_THEN `a(j + k + 1,(j + k + 1) + 1,(j + k + 1) - 1) <= pi` MP_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC); + REWRITE_TAC[ARITH_RULE `(j + k + 1) + 1 = j + k + 2`; ARITH_RULE `(j + k + 1) - 1 = j + k`]; + DISCH_TAC; + SUBGOAL_THEN `a(j + k + 1,j + 1,j + k) <= a(j + k + 1,j + k + 2,j + k)` ASSUME_TAC; + FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (REAL_ARITH `a + b = c ==> &0 <= a ==> b <= c`)); + BY(EXPAND_TAC "a" THEN REWRITE_TAC[azim]); + SUBGOAL_THEN `a(j + k + 1,j + 1,j + k) <= pi` ASSUME_TAC; + BY(ASM_REAL_ARITH_TAC); + SUBGOAL_THEN `a(j + k + 1,j + 1,j + k) < e` ASSUME_TAC; + ASM_CASES_TAC `k = 1`; + ASM_REWRITE_TAC[] THEN EXPAND_TAC "a" THEN REWRITE_TAC[AZIM_REFL]; + BY(ASM_REWRITE_TAC[]); + SUBGOAL_THEN `a(j + k + 1,j + 1,j + k):real = d(j + k + 1,j + 1,j + k)` SUBST1_TAC; + UNDISCH_TAC `a(j + k + 1,j + 1,j + k) <= pi`; + MAP_EVERY EXPAND_TAC ["a"; "d"] THEN REWRITE_TAC[] THEN DISCH_TAC; + MATCH_MP_TAC Polar_fan.AZIM_DIHV_SAME_STRONG THEN ASM_REWRITE_TAC[]; + BY(CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC); + SUBGOAL_THEN `d((j + k) + 1,j + k,j + 1) < e` MP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_NUMSEG] THEN ASM_ARITH_TAC); + BY(EXPAND_TAC "d" THEN REWRITE_TAC[ADD_ASSOC; Counting_spheres.DIHV_SYM]); + COMMENT "ok"; + ENOUGH_TO_SHOW_TAC `a(j + k + 1,j + k + 2,j) <= a(j + k + 1,j + k + 2,j + k)`; + MAP_EVERY EXPAND_TAC ["W"; "a"]; + BY(SIMP_TAC[Localization.wedge_ge; azim; IN_ELIM_THM; ARITH_RULE `(j + k + 1) + 1 = j + k + 2`; ARITH_RULE `(j + k + 1) - 1 = j + k`]); + MATCH_MP_TAC REAL_LE_TRANS; + EXISTS_TAC `a(j + k + 1,j + k + 2,j) + a(j + k + 1,j,j + k)`; + CONJ_TAC; + BY(REWRITE_TAC[REAL_LE_ADDR] THEN EXPAND_TAC "a" THEN REWRITE_TAC[azim]); + MATCH_MP_TAC REAL_EQ_IMP_LE THEN CONV_TAC SYM_CONV; + EXPAND_TAC "a" THEN REWRITE_TAC[] THEN REPEAT STRIP_TAC; + MATCH_MP_TAC Fan.sum5_azim_fan; + CONJ2_TAC; + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC); + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `&2 * e` THEN CONJ_TAC; + MATCH_MP_TAC REAL_LE_TRANS; + EXISTS_TAC `a(j + k + 1,j,j + 1) + a(j + k + 1,j + 1,j + k)`; + CONJ_TAC; + MATCH_MP_TAC REAL_EQ_IMP_LE THEN MAP_EVERY UNDISCH_TAC [`a(j + k + 1,j,j + 1):real < e`; `a(j + k + 1,j + 1,j + k):real < e`]; + EXPAND_TAC "a" THEN REWRITE_TAC[] THEN REPEAT STRIP_TAC; + MATCH_MP_TAC Fan.sum3_azim_fan; + CONJ_TAC THENL [ASM_REAL_ARITH_TAC; ALL_TAC]; + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC); + BY(ASM_REAL_ARITH_TAC); + SUBGOAL_THEN `&2 * e < a (j + k + 1,(j + k + 1) + 1,(j + k + 1) - 1)` MP_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC); + EXPAND_TAC "a"; + REWRITE_TAC[ARITH_RULE `(j + k + 1) + 1 = j + k + 2`; ARITH_RULE `(j + k + 1) - 1 = j + k`]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + +end;; diff --git a/text_formalization/local/XWITCCN.hl b/text_formalization/local/XWITCCN.hl new file mode 100755 index 0000000..7a93bb1 --- /dev/null +++ b/text_formalization/local/XWITCCN.hl @@ -0,0 +1,8426 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Xwitccn = struct + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +let CARD_SLICE_EQ=prove_by_refinement( +`!V E FF v w. +convex_local_fan(V,E,FF) +/\ ~(v=w) /\ +v IN V /\ w IN V +/\ (!u u1. u IN {v,w} /\ u1 IN V /\ ~(u=u1) ==> ~(collinear {vec 0, u, u1})) +/\ (!e. e IN FF ==> aff_gt {vec 0} {v,w} SUBSET wedge_in_fan_gt e E) +==> CARD V = CARD (slicev E FF v w) + CARD (slicev E FF w v) - 2`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN ASM_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC th +THEN REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REWRITE_TAC[convex_local_fan] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL COMPATIBLE_BW_TWO_LEMMAS2 +)[`hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))`;`face (hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))) (v,rho_node1 FF v)`;`V:real^3->bool`;`face (hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))) (w,rho_node1 FF w)`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.EJRCFJD)[`hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))`;`E:(real^3->bool)->bool`;`w:real^3`;`face (hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))) (v,rho_node1 FF v)`;`V:real^3->bool`;`face (hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))) (w,rho_node1 FF w)`;`FF:real^3#real^3->bool`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[convex_local_fan] +THEN STRIP_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`v IN slicev (E:(real^3->bool)->bool) FF w v`ASSUME_TAC +; + + +REWRITE_TAC[slicev;IN_ELIM_THM] +THEN EXISTS_TAC`order (rho_node1 (FF:real^3#real^3->bool)) w v ` +THEN REWRITE_TAC[ARITH_RULE`0<=a /\ a<=a`] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.POINT_PRESENTED_IN_RHOND1)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`w:real^3`;`v:real^3`] +THEN SUBGOAL_THEN`(!i. 0 < i /\ i < n ==> ~(ITER i (rho_node1 (FF:real^3#real^3->bool)) w = v))`ASSUME_TAC +; + + +STRIP_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA1_TAC th`i:num`) +; + + MRESA_TAC (GEN_ALL ORDER)[`n:num`;`rho_node1 (FF:real^3#real^3->bool)`;`w:real^3`;`v:real^3`]; + + + +SUBGOAL_THEN`v IN slicev (E:(real^3->bool)->bool) FF v w`ASSUME_TAC + +; + + +REWRITE_TAC[slicev;IN_ELIM_THM] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[ITER] +THEN ARITH_TAC; + + +MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_LT_CARD_SET_V)[`slicee (E:(real^3->bool)->bool) FF v w`;`slicef (E:(real^3->bool)->bool) FF v w`;`slicev (E:(real^3->bool)->bool) FF v w`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_LT_CARD_SET_V)[`slicee (E:(real^3->bool)->bool) FF w v`;`slicef (E:(real^3->bool)->bool) FF w v`;`slicev (E:(real^3->bool)->bool) FF w v`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.POINT_PRESENTED_IN_RHOND1)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`w:real^3`] +THEN MRESAL_TAC (GEN_ALL Local_lemmas1.CONDS_IN_V_PRIME_NUM)[`(E:(real^3->bool)->bool)`;`hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{v, w}}))`;`w:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`V:real^3->bool`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{v, w}}))) (v,rho_node1 (FF:real^3#real^3->bool) v)`;`n:num`][DIFF;IN_SING;IN_ELIM_THM;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`~(t = z) <=> ~(z = t)`] +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL Local_lemmas1.CONDS_IN_V_PRIME_NUM2)[`(E:(real^3->bool)->bool)`;`hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{v, w}}))`;`w:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{v, w}}))) (w,rho_node1 (FF:real^3#real^3->bool) w)`;`n:num`;`V:real^3->bool`][DIFF;IN_SING;IN_ELIM_THM;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`~(t = z) <=> ~(z = t)`] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`(slicev (E:(real^3->bool)->bool) FF v w) = IMAGE (\i. ITER i (rho_node1 FF) v) {i| i < CARD (V:real^3->bool) /\ ITER i (rho_node1 FF) v IN slicev E FF v w}`ASSUME_TAC + +; + + +REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +STRIP_TAC +THEN POP_ASSUM(fun th-> +MP_TAC th +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[slicev;IN_ELIM_THM] +THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN SUBGOAL_THEN`(!i. 0 < i /\ i < n ==> ~(ITER i (rho_node1 (FF:real^3#real^3->bool)) v = w))`ASSUME_TAC +; + + +STRIP_TAC +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC 4 (STRIP_TAC) THEN STRIP_TAC +THEN MRESA1_TAC th`i:num`) +; + +MRESA_TAC (GEN_ALL UNIQUE_ORDER)[`v:real^3`;`w:real^3`;`n:num`;`(rho_node1 (FF:real^3#real^3->bool))`] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`n':num` +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 4 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +RESA_TAC +; + + + + + +SUBGOAL_THEN`(slicev (E:(real^3->bool)->bool) FF w v) = IMAGE (\i. ITER i (rho_node1 FF) v) {i| i < CARD (V:real^3->bool) /\ ITER i (rho_node1 FF) v IN slicev E FF w v}`ASSUME_TAC + +; + + +REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> +MP_TAC th +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[slicev;IN_ELIM_THM] +THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V) +[`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;`w:real^3`;`V:real^3->bool`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `n':num`) +THEN MRESA_TAC (GEN_ALL Local_lemmas1.POINT_PRESENTED_IN_RHOND1) +[`(E:(real^3->bool)->bool)`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`x:real^3`] +THEN EXISTS_TAC`n'':num` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 4 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); + + +RESA_TAC +; + + + +SUBGOAL_THEN`CARD (slicev (E:(real^3->bool)->bool) FF v w) = CARD {i | i < CARD (V:real^3->bool) /\ ITER i (rho_node1 FF) v IN slicev E FF v w}`ASSUME_TAC; + +REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN MATCH_MP_TAC CARD_IMAGE_INJ +THEN STRIP_TAC +; + +REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MP_TAC Local_lemmas1.LT_CARD_MONO_LOFA +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[]; + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. (CARD (V:real^3->bool))` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC +; + + + + SUBGOAL_THEN`CARD (slicev (E:(real^3->bool)->bool) FF w v) = CARD {i | i < CARD (V:real^3->bool) /\ ITER i (rho_node1 FF) v IN slicev E FF w v}`ASSUME_TAC; + +REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN MATCH_MP_TAC CARD_IMAGE_INJ +THEN STRIP_TAC +; + +REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MP_TAC Local_lemmas1.LT_CARD_MONO_LOFA +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[]; + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. (CARD (V:real^3->bool))` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC +; + + + +POP_ASSUM(fun th-> +POP_ASSUM( fun th1-> +STRIP_TAC +THEN STRIP_TAC +THEN GEN_REWRITE_TAC(RAND_CONV o ONCE_DEPTH_CONV)[th] +THEN GEN_REWRITE_TAC(RAND_CONV o ONCE_DEPTH_CONV)[th1])) +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`{i| ibool)} = (n.. (CARD V -1)) UNION {0}` +ASSUME_TAC; + + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG;UNION;IN_SING] +THEN ARITH_TAC; + + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`n=0\/ 0< n`) +THEN RESA_TAC; + +POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th;ITER]) +THEN REPEAT RESA_TAC +; + + +SUBGOAL_THEN`(n..CARD (V:real^3->bool) - 1) INTER {0} ={}`ASSUME_TAC; + + + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG;UNION;IN_SING;INTER] +THEN GEN_TAC +THEN EQ_TAC; + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SET_TAC[]; + + +MRESAL_TAC Geomdetail.CARD_EQUATION[`n..(CARD (V:real^3->bool)-1)`;`{0}`][FINITE_NUMSEG;FINITE_SING;CARD_CLAUSES;Geomdetail.CARD_SING;ARITH_RULE`A+0=A`;CARD_NUMSEG] +THEN REPLICATE_TAC 2 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 8 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC +; + +]);; + + + +let CARD_SLICE_LE=prove_by_refinement( +`!V E FF v w. +convex_local_fan(V,E,FF) +/\ ~(v=w) /\ +v IN V /\ w IN V +/\ (!u u1. u IN {v,w} /\ u1 IN V /\ ~(u=u1) ==> ~(collinear {vec 0, u, u1})) +/\ (!e. e IN FF ==> aff_gt {vec 0} {v,w} SUBSET wedge_in_fan_gt e E) +==> CARD (slicev E FF v w)< CARD V`, +[ +REPEAT STRIP_TAC +THEN ASM_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC th +THEN REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REWRITE_TAC[convex_local_fan] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL COMPATIBLE_BW_TWO_LEMMAS2 +)[`hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))`;`face (hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))) (v,rho_node1 FF v)`;`V:real^3->bool`;`face (hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))) (w,rho_node1 FF w)`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.EJRCFJD)[`hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))`;`E:(real^3->bool)->bool`;`w:real^3`;`face (hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))) (v,rho_node1 FF v)`;`V:real^3->bool`;`face (hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))) (w,rho_node1 FF w)`;`FF:real^3#real^3->bool`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MP_TAC th +THEN POP_ASSUM (fun th1-> MP_TAC th1 +THEN REWRITE_TAC[convex_local_fan] +THEN ASSUME_TAC th THEN ASSUME_TAC th1)) +THEN STRIP_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`v IN slicev (E:(real^3->bool)->bool) FF w v`ASSUME_TAC; + +REWRITE_TAC[slicev;IN_ELIM_THM] +THEN EXISTS_TAC`order (rho_node1 (FF:real^3#real^3->bool)) w v ` +THEN REWRITE_TAC[ARITH_RULE`0<=a /\ a<=a`] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.POINT_PRESENTED_IN_RHOND1)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`w:real^3`;`v:real^3`] +THEN SUBGOAL_THEN`(!i. 0 < i /\ i < n ==> ~(ITER i (rho_node1 (FF:real^3#real^3->bool)) w = v))`ASSUME_TAC; + +STRIP_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA1_TAC th`i:num`); + +MRESA_TAC (GEN_ALL ORDER)[`n:num`;`rho_node1 (FF:real^3#real^3->bool)`;`w:real^3`;`v:real^3`]; + +SUBGOAL_THEN`v IN slicev (E:(real^3->bool)->bool) FF v w`ASSUME_TAC; + +REWRITE_TAC[slicev;IN_ELIM_THM] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[ITER] +THEN ARITH_TAC; + +MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_LT_CARD_SET_V)[`slicee (E:(real^3->bool)->bool) FF v w`;`slicef (E:(real^3->bool)->bool) FF v w`;`slicev (E:(real^3->bool)->bool) FF v w`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_LT_CARD_SET_V)[`slicee (E:(real^3->bool)->bool) FF w v`;`slicef (E:(real^3->bool)->bool) FF w v`;`slicev (E:(real^3->bool)->bool) FF w v`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.POINT_PRESENTED_IN_RHOND1)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`w:real^3`] +THEN MRESAL_TAC (GEN_ALL Local_lemmas1.CONDS_IN_V_PRIME_NUM)[`(E:(real^3->bool)->bool)`;`hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{v, w}}))`;`w:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`V:real^3->bool`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{v, w}}))) (v,rho_node1 (FF:real^3#real^3->bool) v)`;`n:num`][DIFF;IN_SING;IN_ELIM_THM;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`~(t = z) <=> ~(z = t)`] +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL Local_lemmas1.CONDS_IN_V_PRIME_NUM2)[`(E:(real^3->bool)->bool)`;`hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{v, w}}))`;`w:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{v, w}}))) (w,rho_node1 (FF:real^3#real^3->bool) w)`;`n:num`;`V:real^3->bool`][DIFF;IN_SING;IN_ELIM_THM;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`~(t = z) <=> ~(z = t)`] +THEN RESA_TAC +THEN MRESA_TAC CARD_SLICE_EQ[`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;`v:real^3`;`w:real^3`;] +THEN MRESA_TAC (GEN_ALL CARD_VERTEX_GE_3_LOCAL_FAN) +[`slicev (E:(real^3->bool)->bool) FF w v`;`slicee (E:(real^3->bool)->bool) FF w v`;`slicef (E:(real^3->bool)->bool) FF w v`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL CARD_VERTEX_GE_3_LOCAL_FAN) +[`slicev (E:(real^3->bool)->bool) FF v w`;`slicee (E:(real^3->bool)->bool) FF v w`;`slicef (E:(real^3->bool)->bool) FF v w`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC]);; + + + + + + +let CARD_SLICE_LE1=prove_by_refinement( +`!V E FF v w. +convex_local_fan(V,E,FF) +/\ ~(v=w) /\ +v IN V /\ w IN V +/\ (!u u1. u IN {v,w} /\ u1 IN V /\ ~(u=u1) ==> ~(collinear {vec 0, u, u1})) +/\ (!e. e IN FF ==> aff_gt {vec 0} {v,w} SUBSET wedge_in_fan_gt e E) +==> CARD (slicev E FF w v)< CARD V`, +[ +REPEAT STRIP_TAC +THEN ASM_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC th +THEN REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REWRITE_TAC[convex_local_fan] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL COMPATIBLE_BW_TWO_LEMMAS2 +)[`hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))`;`face (hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))) (v,rho_node1 FF v)`;`V:real^3->bool`;`face (hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))) (w,rho_node1 FF w)`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.EJRCFJD)[`hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))`;`E:(real^3->bool)->bool`;`w:real^3`;`face (hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))) (v,rho_node1 FF v)`;`V:real^3->bool`;`face (hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))) (w,rho_node1 FF w)`;`FF:real^3#real^3->bool`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th-> MP_TAC th +THEN POP_ASSUM (fun th1-> MP_TAC th1 +THEN REWRITE_TAC[convex_local_fan] +THEN ASSUME_TAC th THEN ASSUME_TAC th1)) +THEN STRIP_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`v IN slicev (E:(real^3->bool)->bool) FF w v`ASSUME_TAC; + +REWRITE_TAC[slicev;IN_ELIM_THM] +THEN EXISTS_TAC`order (rho_node1 (FF:real^3#real^3->bool)) w v ` +THEN REWRITE_TAC[ARITH_RULE`0<=a /\ a<=a`] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.POINT_PRESENTED_IN_RHOND1)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`w:real^3`;`v:real^3`] +THEN SUBGOAL_THEN`(!i. 0 < i /\ i < n ==> ~(ITER i (rho_node1 (FF:real^3#real^3->bool)) w = v))`ASSUME_TAC; + +STRIP_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA1_TAC th`i:num`); + +MRESA_TAC (GEN_ALL ORDER)[`n:num`;`rho_node1 (FF:real^3#real^3->bool)`;`w:real^3`;`v:real^3`]; + +SUBGOAL_THEN`v IN slicev (E:(real^3->bool)->bool) FF v w`ASSUME_TAC; + +REWRITE_TAC[slicev;IN_ELIM_THM] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[ITER] +THEN ARITH_TAC; + +MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_LT_CARD_SET_V)[`slicee (E:(real^3->bool)->bool) FF v w`;`slicef (E:(real^3->bool)->bool) FF v w`;`slicev (E:(real^3->bool)->bool) FF v w`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_LT_CARD_SET_V)[`slicee (E:(real^3->bool)->bool) FF w v`;`slicef (E:(real^3->bool)->bool) FF w v`;`slicev (E:(real^3->bool)->bool) FF w v`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.POINT_PRESENTED_IN_RHOND1)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`w:real^3`] +THEN MRESAL_TAC (GEN_ALL Local_lemmas1.CONDS_IN_V_PRIME_NUM)[`(E:(real^3->bool)->bool)`;`hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{v, w}}))`;`w:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`V:real^3->bool`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{v, w}}))) (v,rho_node1 (FF:real^3#real^3->bool) v)`;`n:num`][DIFF;IN_SING;IN_ELIM_THM;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`~(t = z) <=> ~(z = t)`] +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL Local_lemmas1.CONDS_IN_V_PRIME_NUM2)[`(E:(real^3->bool)->bool)`;`hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{v, w}}))`;`w:real^3`;`FF:real^3#real^3->bool`;`v:real^3`;`face (hypermap (HYP (vec 0,V,(E:(real^3->bool)->bool) UNION {{v, w}}))) (w,rho_node1 (FF:real^3#real^3->bool) w)`;`n:num`;`V:real^3->bool`][DIFF;IN_SING;IN_ELIM_THM;] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`~(t = z) <=> ~(z = t)`] +THEN RESA_TAC +THEN MRESA_TAC CARD_SLICE_EQ[`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;`v:real^3`;`w:real^3`;] +THEN MRESA_TAC (GEN_ALL CARD_VERTEX_GE_3_LOCAL_FAN) +[`slicev (E:(real^3->bool)->bool) FF w v`;`slicee (E:(real^3->bool)->bool) FF w v`;`slicef (E:(real^3->bool)->bool) FF w v`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL CARD_VERTEX_GE_3_LOCAL_FAN) +[`slicev (E:(real^3->bool)->bool) FF v w`;`slicee (E:(real^3->bool)->bool) FF v w`;`slicef (E:(real^3->bool)->bool) FF v w`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC]);; + + + + + +let SLICE_REPRENT=prove_by_refinement( +`!V E FF v w. +convex_local_fan(V,E,FF) +/\ ~(v=w) /\ +v IN V /\ w IN V +/\ (!u u1. u IN {v,w} /\ u1 IN V /\ ~(u=u1) ==> ~(collinear {vec 0, u, u1})) +/\ (!e. e IN FF ==> aff_gt {vec 0} {v,w} SUBSET wedge_in_fan_gt e E) +==>(slicev (E:(real^3->bool)->bool) FF v w) = IMAGE (\i. ITER i (rho_node1 FF) v) {i| i < CARD (V:real^3->bool) /\ ITER i (rho_node1 FF) v IN slicev E FF v w}` +, +[ +REPEAT STRIP_TAC +THEN ASM_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC th +THEN REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REWRITE_TAC[convex_local_fan] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL COMPATIBLE_BW_TWO_LEMMAS2 +)[`hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))`;`face (hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))) (v,rho_node1 FF v)`;`V:real^3->bool`;`face (hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))) (w,rho_node1 FF w)`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.EJRCFJD)[`hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))`;`E:(real^3->bool)->bool`;`w:real^3`;`face (hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))) (v,rho_node1 FF v)`;`V:real^3->bool`;`face (hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))) (w,rho_node1 FF w)`;`FF:real^3#real^3->bool`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[convex_local_fan] +THEN STRIP_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`v IN slicev (E:(real^3->bool)->bool) FF w v`ASSUME_TAC; + +REWRITE_TAC[slicev;IN_ELIM_THM] +THEN EXISTS_TAC`order (rho_node1 (FF:real^3#real^3->bool)) w v ` +THEN REWRITE_TAC[ARITH_RULE`0<=a /\ a<=a`] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.POINT_PRESENTED_IN_RHOND1)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`w:real^3`;`v:real^3`] +THEN SUBGOAL_THEN`(!i. 0 < i /\ i < n ==> ~(ITER i (rho_node1 (FF:real^3#real^3->bool)) w = v))`ASSUME_TAC; + +STRIP_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA1_TAC th`i:num`); + + MRESA_TAC (GEN_ALL ORDER)[`n:num`;`rho_node1 (FF:real^3#real^3->bool)`;`w:real^3`;`v:real^3`]; + +SUBGOAL_THEN`v IN slicev (E:(real^3->bool)->bool) FF v w`ASSUME_TAC; + +REWRITE_TAC[slicev;IN_ELIM_THM] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[ITER] +THEN ARITH_TAC; + + +MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_LT_CARD_SET_V)[`slicee (E:(real^3->bool)->bool) FF v w`;`slicef (E:(real^3->bool)->bool) FF v w`;`slicev (E:(real^3->bool)->bool) FF v w`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_LT_CARD_SET_V)[`slicee (E:(real^3->bool)->bool) FF w v`;`slicef (E:(real^3->bool)->bool) FF w v`;`slicev (E:(real^3->bool)->bool) FF w v`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.POINT_PRESENTED_IN_RHOND1)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`w:real^3`] +THEN REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +STRIP_TAC +THEN POP_ASSUM(fun th-> +MP_TAC th +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[slicev;IN_ELIM_THM] +THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN SUBGOAL_THEN`(!i. 0 < i /\ i < n ==> ~(ITER i (rho_node1 (FF:real^3#real^3->bool)) v = w))`ASSUME_TAC; + +STRIP_TAC +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC 4 (STRIP_TAC) THEN STRIP_TAC +THEN MRESA1_TAC th`i:num`); + +MRESA_TAC (GEN_ALL UNIQUE_ORDER)[`v:real^3`;`w:real^3`;`n:num`;`(rho_node1 (FF:real^3#real^3->bool))`] +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`n':num` +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 4 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +RESA_TAC; + +]);; + + + + +let SLICE_REPRENT2=prove_by_refinement( +`!V E FF v w. +convex_local_fan(V,E,FF) +/\ ~(v=w) /\ +v IN V /\ w IN V +/\ (!u u1. u IN {v,w} /\ u1 IN V /\ ~(u=u1) ==> ~(collinear {vec 0, u, u1})) +/\ (!e. e IN FF ==> aff_gt {vec 0} {v,w} SUBSET wedge_in_fan_gt e E) +==> (slicev (E:(real^3->bool)->bool) FF w v) = IMAGE (\i. ITER i (rho_node1 FF) v) {i| i < CARD (V:real^3->bool) /\ ITER i (rho_node1 FF) v IN slicev E FF w v}`, +[ +REPEAT STRIP_TAC +THEN ASM_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASSUME_TAC th +THEN REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REWRITE_TAC[convex_local_fan] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL COMPATIBLE_BW_TWO_LEMMAS2 +)[`hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))`;`face (hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))) (v,rho_node1 FF v)`;`V:real^3->bool`;`face (hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))) (w,rho_node1 FF w)`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.EJRCFJD)[`hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))`;`E:(real^3->bool)->bool`;`w:real^3`;`face (hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))) (v,rho_node1 FF v)`;`V:real^3->bool`;`face (hypermap (HYP (vec 0,(V:real^3->bool),E UNION {{v, w:real^3}}))) (w,rho_node1 FF w)`;`FF:real^3#real^3->bool`;`v:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[convex_local_fan] +THEN STRIP_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`v IN slicev (E:(real^3->bool)->bool) FF w v`ASSUME_TAC; + + +REWRITE_TAC[slicev;IN_ELIM_THM] +THEN EXISTS_TAC`order (rho_node1 (FF:real^3#real^3->bool)) w v ` +THEN REWRITE_TAC[ARITH_RULE`0<=a /\ a<=a`] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.POINT_PRESENTED_IN_RHOND1)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`w:real^3`;`v:real^3`] +THEN SUBGOAL_THEN`(!i. 0 < i /\ i < n ==> ~(ITER i (rho_node1 (FF:real^3#real^3->bool)) w = v))`ASSUME_TAC; + +STRIP_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA1_TAC th`i:num`); + + MRESA_TAC (GEN_ALL ORDER)[`n:num`;`rho_node1 (FF:real^3#real^3->bool)`;`w:real^3`;`v:real^3`]; + +SUBGOAL_THEN`v IN slicev (E:(real^3->bool)->bool) FF v w`ASSUME_TAC; + +REWRITE_TAC[slicev;IN_ELIM_THM] +THEN EXISTS_TAC`0` +THEN REWRITE_TAC[ITER] +THEN ARITH_TAC; + + +MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_LT_CARD_SET_V)[`slicee (E:(real^3->bool)->bool) FF v w`;`slicef (E:(real^3->bool)->bool) FF v w`;`slicev (E:(real^3->bool)->bool) FF v w`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IMP_LT_CARD_SET_V)[`slicee (E:(real^3->bool)->bool) FF w v`;`slicef (E:(real^3->bool)->bool) FF w v`;`slicev (E:(real^3->bool)->bool) FF w v`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.POINT_PRESENTED_IN_RHOND1)[`E:(real^3->bool)->bool`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`w:real^3`] +THEN REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> +MP_TAC th +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[slicev;IN_ELIM_THM] +THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V) +[`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;`w:real^3`;`V:real^3->bool`] +THEN POP_ASSUM(fun th-> MRESA1_TAC th `n':num`) +THEN MRESA_TAC (GEN_ALL Local_lemmas1.POINT_PRESENTED_IN_RHOND1) +[`(E:(real^3->bool)->bool)`;`V:real^3->bool`;`FF:real^3#real^3->bool`;`v:real^3`;`x:real^3`] +THEN EXISTS_TAC`n'':num` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 4 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); + + +RESA_TAC; + +]);; + + +let change_type_v3= new_definition`(change_type_v3 (a:num->num->real)) (i,j)= a i j ` +;; + + +let change_type_v2= new_definition`(change_type_v2 (a:num->num->bool)) k = + { {i MOD k,j MOD k} | a i j =T} ` +;; + +let PERIODIC_PROPERTY= prove( +` ~(k = 0) /\ periodic vv k ==> (!i. vv (i MOD k)= vv i)`, +REWRITE_TAC[periodic] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(RAND_CONV o ONCE_DEPTH_CONV)[th] +THEN MP_TAC th) +THEN ABBREV_TAC`n= i DIV k` +THEN ASM_TAC +THEN SPEC_TAC (`i:num`,`i:num`) +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC +THENL[REWRITE_TAC[ARITH_RULE`0*K+A=A`]; +POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`n *k + i MOD k`) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC MOD_MULT_ADD[`n:num`;`k:num`;`i MOD k`] +THEN MRESA_TAC DIV_UNIQ[`n * k + i MOD k`;`k:num`;`n:num`;`i MOD k`] +THEN ASM_SIMP_TAC[MOD_MOD_REFL;ARITH_RULE`SUC n * k + i MOD k = (n * k + i MOD k) +k`]]) +;; + + + + +let SCS_3_IS_TRI_STABLE=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 3 (d_tame 3) (cs_adj 3 (&2) (&2 * h0)) (cs_adj 3 (&2 * h0) upperbd)) +==> tri_stable (scs_k_v39 s) (scs_d_v39 s) (0..(scs_k_v39 s)-1) +(change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) +(change_type_v2 (scs_J_v39 s) (scs_k_v39 s)) (\i. ((1+i):num MOD (scs_k_v39 s)))`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`~(4<=3)/\ 3-1=2`;mk_unadorned_v39;CS_ADJ;scs_J_v39_explicit;change_type_v2;d_tame ;change_type_v3] +THEN MRESAL_TAC HAS_SIZE_NUMSEG[`0`;`2`][ARITH_RULE`(2+1)-0=3`] +THEN ASM_SIMP_TAC[tri_stable;constraint_system;torsor;ARITH_RULE`3<= 3 /\3<=6/\ 1+3<=6/\ (2+1)-0=3/\ 3=3 /\ 0+3<=6`;CARD_NUMSEG;Hypermap.CARD_SINGLETON;change_type_v3;ARITH_RULE`A=B:num <=> B=A`;SET_RULE`A\/B<=> B\/A`;SET_RULE`A\/B<=> B\/A`;SET_RULE`{{i MOD k,j MOD K}| i,j| F}={}`;CARD_CLAUSES] +THEN STRIP_TAC; + +STRIP_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`3-1=2`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN MRESAL1_TAC Hypermap.LE_MOD_SUC`2`[ARITH_RULE`SUC 2=3`]; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`3-1=2`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL MOD_IMP_EQ)[`3`;`1+x1`;`1+x2`][ARITH_RULE`1<= 1+A /\ (1+A<=3<=> A<=2)`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`3-1=2`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`0 1<= i /\ 1<3`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`3:num`;`x:num`;`i:num`] +THEN MP_TAC(ARITH_RULE`0 i=1 \/ i=2`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x<= 2==> x=0 \/ x=1 \/ x=2`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +REWRITE_TAC[ARITH_RULE`3-1=2`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN ASSUME_TAC(ARITH_RULE`1<=3 /\1<3/\ 1<=2`) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`3:num`;`x:num`;`3:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`3`;`x:num`][ARITH_RULE`1*3=3`] +THEN MP_TAC(ARITH_RULE`x<= 2==> x=0 \/ x=1 \/ x=2`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`i MOD 3= j MOD 3 \/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC; + +REAL_ARITH_TAC; + +MP_TAC(ARITH_RULE`i MOD 3= SUC j MOD 3 \/ ~(i MOD 3= SUC j MOD 3)`) +THEN RESA_TAC; + +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; + +MP_TAC CHOOSE_MOD_3 +THEN ASM_REWRITE_TAC[h0] +THEN RESA_TAC +THEN REAL_ARITH_TAC; + +STRIP_TAC; + +REPEAT GEN_TAC +THEN ASSUME_TAC(ARITH_RULE`1<=3 /\1<3/\ 1<=2`) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`3:num`;`j:num`;`3:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`3`;`j:num`][ARITH_RULE`1*3=3`] +THEN MRESAL_TAC MOD_MOD_REFL[`j:num`;`3`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`j:num`;`1:num`;`3`][ARITH_RULE`~(3=0) /\ 1 MOD 3=1`;ADD1]; + + +SET_TAC[]; + +STRIP_TAC; + +REWRITE_TAC[IN_NUMSEG;ARITH_RULE`(0 <= i /\ i <= 2)<=> i=0 \/ i=1\/ i=2`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1 /\ 2 MOD 3=2 /\ ~(0=1) +/\ SUC 0 MOD 3=1 /\ SUC 1 MOD 3=2/\ SUC 2 MOD 3=0`;h0;REAL_ARITH`&2<= &2`;cstab] +THEN REAL_ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[IN_NUMSEG;ARITH_RULE`(0 <= i /\ i <= 2)<=> i=0 \/ i=1\/ i=2`] +THEN REPEAT STRIP_TAC +THEN +ASM_REWRITE_TAC[ARITH_RULE`0 MOD 3=0 /\ 1 MOD 3=1 /\ 2 MOD 3=2 /\ ~(0=1) +/\ SUC 0 MOD 3=1 /\ SUC 1 MOD 3=2/\ SUC 2 MOD 3=0 +/\ (1+ 0) MOD 3=1 /\ (1+ 1) MOD 3=2 /\ (1+ 2) MOD 3=0 +`;h0;REAL_ARITH`&2<= &2`;cstab] +THEN REAL_ARITH_TAC; + +SET_TAC[] +]);; + (* }}} *) + + + + +let SCS_4_IS_TRI_STABLE=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (d_tame 4) (cs_adj 4 (&2) (&2 * h0)) (cs_adj 4 (&2 * h0) upperbd)) +==> stable_system (scs_k_v39 s) (scs_d_v39 s) (0..(scs_k_v39 s)-1) +(change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) +(change_type_v2 (scs_J_v39 s) (scs_k_v39 s)) (\i. ((1+i):num MOD (scs_k_v39 s))) +`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`~(4=3)/\ 4-1=3`;mk_unadorned_v39;CS_ADJ;scs_J_v39_explicit;change_type_v2;d_tame ;change_type_v3] +THEN MRESAL_TAC HAS_SIZE_NUMSEG[`0`;`3`][ARITH_RULE`(3+1)-0=4`] +THEN ASM_SIMP_TAC[stable_system;constraint_system;torsor;ARITH_RULE`3<= 4 /\4<=6/\ 1+4<=6/\ (3+1)-0=4/\ 4=4 /\ 0+4<=6`;CARD_NUMSEG;Hypermap.CARD_SINGLETON;change_type_v3;ARITH_RULE`A=B:num <=> B=A`;SET_RULE`A\/B<=> B\/A`;SET_RULE`{{i MOD k,j MOD K}| i,j| F}={}/\ {} SUBSET A`;CARD_CLAUSES] +THEN STRIP_TAC; + +STRIP_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN MRESAL1_TAC Hypermap.LE_MOD_SUC`3`[ARITH_RULE`SUC 3=4`]; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL MOD_IMP_EQ)[`4`;`1+x1`;`1+x2`][ARITH_RULE`1<= 1+A /\ (1+A<=4<=> A<=3)`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`0 1<= i /\ 1<4`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`4:num`;`x:num`;`i:num`] +THEN MP_TAC(ARITH_RULE`0 i=1 \/ i=2 \/ i=3`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x<= 3==> x=0 \/ x=1 \/ x=2 \/ x=3`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN ASSUME_TAC(ARITH_RULE`1<=4 /\1<4/\ 1<=3`) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`4:num`;`x:num`;`4:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`4`;`x:num`][ARITH_RULE`1*4=4`] +THEN MP_TAC(ARITH_RULE`x<= 3==> x=0 \/ x=1 \/ x=2\/ x=3`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`i MOD 4= j MOD 4 \/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC; + +REAL_ARITH_TAC; + +MP_TAC(ARITH_RULE`(i MOD 4 = SUC j MOD 4 \/ j MOD 4 = SUC i MOD 4) \/ ~(i MOD 4 = SUC j MOD 4 \/ j MOD 4 = SUC i MOD 4)`) +THEN RESA_TAC +THEN REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; + +STRIP_TAC; + +REPEAT GEN_TAC +THEN ASSUME_TAC(ARITH_RULE`1<=4 /\1<4/\ 1<=2`) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`4:num`;`j:num`;`4:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`4`;`j:num`][ARITH_RULE`1*4=4`] +THEN MRESAL_TAC MOD_MOD_REFL[`j:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`j:num`;`1:num`;`4`][ARITH_RULE`~(4=0) /\ 1 MOD 4=1`;ADD1]; + +STRIP_TAC; + +REWRITE_TAC[IN_NUMSEG;ARITH_RULE`(0 <= i /\ i <= 3)<=> i=0 \/ i=1\/ i=2 \/ i=3`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 4=0 /\ 1 MOD 4=1 /\ 2 MOD 4=2 /\ 3 MOD 4=3 /\ ~(0=1) +/\ SUC 0 MOD 4=1 /\ SUC 1 MOD 4=2/\ SUC 2 MOD 4=3 /\ SUC 3 MOD 4=0`;h0;REAL_ARITH`&2<= &2`;cstab] +THEN REAL_ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[IN_NUMSEG;ARITH_RULE`(0 <= i /\ i <= 3)<=> i=0 \/ i=1\/ i=2\/ i=3`] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 4=0 /\ 1 MOD 4=1 /\ 2 MOD 4=2 /\ 3 MOD 4=3 /\ ~(0=1) +/\ SUC 0 MOD 4=1 /\ SUC 1 MOD 4=2/\ SUC 2 MOD 4=3 /\ SUC 3 MOD 4=0/\ 1+i=i+1`;h0;REAL_ARITH`&2<= &2`;cstab;GSYM ADD1] +THEN REAL_ARITH_TAC; + +SET_TAC[] +]);; + (* }}} *) + + + + + + +let SCS_5_IS_TRI_STABLE=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (d_tame 5) (cs_adj 5 (&2) (&2 * h0)) (cs_adj 5 (&2 * h0) upperbd)) +==> stable_system (scs_k_v39 s) (scs_d_v39 s) (0..(scs_k_v39 s)-1) +(change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) +(change_type_v2 (scs_J_v39 s) (scs_k_v39 s)) (\i. ((1+i):num MOD (scs_k_v39 s)))`, + (* {{{ proof *) +[ + +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`~(5=3)/\ 5-1=4`;mk_unadorned_v39;CS_ADJ;scs_J_v39_explicit;change_type_v2;d_tame ;change_type_v3] +THEN MRESAL_TAC HAS_SIZE_NUMSEG[`0`;`4`][ARITH_RULE`(4+1)-0=5`] +THEN ASM_SIMP_TAC[stable_system;constraint_system;torsor;ARITH_RULE`3<= 5 /\5<=6/\ 1+5<=6/\ (4+1)-0=5/\ 5=5 /\ 0+5<=6`;CARD_NUMSEG;Hypermap.CARD_SINGLETON;change_type_v3;ARITH_RULE`A=B:num <=> B=A`;SET_RULE`A\/B<=> B\/A`;SET_RULE`{{i MOD k,j MOD K}| i,j| F}={}/\ {} SUBSET A`;CARD_CLAUSES] +THEN STRIP_TAC; + + +STRIP_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`5-1=4`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN MRESAL1_TAC Hypermap.LE_MOD_SUC`4`[ARITH_RULE`SUC 4=5`]; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`5-1=4`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL MOD_IMP_EQ)[`5`;`1+x1`;`1+x2`][ARITH_RULE`1<= 1+A /\ (1+A<=5<=> A<=4)`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`5-1=4`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`0 1<= i /\ 1<5`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`5:num`;`x:num`;`i:num`] +THEN MP_TAC(ARITH_RULE`0 i=1 \/ i=2 \/ i=3\/ i=4`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x<= 4==> x=0 \/ x=1 \/ x=2 \/ x=3\/ x=4`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +REWRITE_TAC[ARITH_RULE`5-1=4`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN ASSUME_TAC(ARITH_RULE`1<=5 /\1<5/\ 1<=4`) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`5:num`;`x:num`;`5:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`5`;`x:num`][ARITH_RULE`1*5=5`] +THEN MP_TAC(ARITH_RULE`x<= 4==> x=0 \/ x=1 \/ x=2\/ x=3\/ x=4`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`i MOD 5= j MOD 5 \/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC; + +REAL_ARITH_TAC; + +MP_TAC(ARITH_RULE`(i MOD 5 = SUC j MOD 5 \/ j MOD 5 = SUC i MOD 5) \/ ~(i MOD 5 = SUC j MOD 5 \/ j MOD 5 = SUC i MOD 5)`) +THEN RESA_TAC +THEN REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; + +STRIP_TAC; + +REPEAT GEN_TAC +THEN ASSUME_TAC(ARITH_RULE`1<=5 /\1<5/\ 1<=2`) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`5:num`;`j:num`;`5:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`5`;`j:num`][ARITH_RULE`1*5=5`] +THEN MRESAL_TAC MOD_MOD_REFL[`j:num`;`5`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`j:num`;`1:num`;`5`][ARITH_RULE`~(5=0) /\ 1 MOD 5=1`;ADD1]; + +STRIP_TAC; + +REWRITE_TAC[IN_NUMSEG;ARITH_RULE`(0 <= i /\ i <= 4)<=> i=0 \/ i=1\/ i=2 \/ i=3\/ i=4`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 5=0 /\ 1 MOD 5=1 /\ 2 MOD 5=2 /\ 3 MOD 5=3 /\ ~(0=1) +/\ SUC 0 MOD 5=1 /\ SUC 1 MOD 5=2/\ SUC 2 MOD 5=3 /\ SUC 3 MOD 5=4/\ SUC 4 MOD 5=0 /\ 4 MOD 5=4`;h0;REAL_ARITH`&2<= &2`;cstab] +THEN REAL_ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[IN_NUMSEG;ARITH_RULE`(0 <= i /\ i <= 4)<=> i=0 \/ i=1\/ i=2 \/ i=3\/ i=4`] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 5=0 /\ 1 MOD 5=1 /\ 2 MOD 5=2 /\ 3 MOD 5=3 /\ ~(0=1) +/\ SUC 0 MOD 5=1 /\ SUC 1 MOD 5=2/\ SUC 2 MOD 5=3 /\ SUC 3 MOD 5=4/\ SUC 4 MOD 5=0 /\ 4 MOD 5=4/\ 1+i=i+1`;h0;REAL_ARITH`&2<= &2`;cstab;GSYM ADD1] +THEN REAL_ARITH_TAC; + +SET_TAC[] +]);; + (* }}} *) + + + + + + + +let SCS_6_IS_TRI_STABLE=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (&2 * h0)) (cs_adj 6 (&2 * h0) upperbd)) +==> stable_system (scs_k_v39 s) (scs_d_v39 s) (0..(scs_k_v39 s)-1) +(change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) +(change_type_v2 (scs_J_v39 s) (scs_k_v39 s)) (\i. ((1+i):num MOD (scs_k_v39 s)))`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`~(6=3)/\ 6-1=5`;mk_unadorned_v39;CS_ADJ;scs_J_v39_explicit;change_type_v2;d_tame ;change_type_v3] +THEN MRESAL_TAC HAS_SIZE_NUMSEG[`0`;`5`][ARITH_RULE`(5+1)-0=6`] +THEN ASM_SIMP_TAC[stable_system;constraint_system;torsor;ARITH_RULE`3<= 6 /\6<=6/\ (5+1)-0=6/\ 6=6 /\ 0+6<=6`;CARD_NUMSEG;Hypermap.CARD_SINGLETON;change_type_v3;ARITH_RULE`A=B:num <=> B=A`;SET_RULE`A\/B<=> B\/A`;SET_RULE`{{i MOD k,j MOD K}| i,j| F}={}/\ {} SUBSET A`;CARD_CLAUSES] +THEN STRIP_TAC; + + +STRIP_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`6-1=5`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN MRESAL1_TAC Hypermap.LE_MOD_SUC`5`[ARITH_RULE`SUC 5=6`]; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`6-1=5`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL MOD_IMP_EQ)[`6`;`1+x1`;`1+x2`][ARITH_RULE`1<= 1+A /\ (1+A<=6<=> A<=5)`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`6-1=5`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`0 1<= i /\ 1<6`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`6:num`;`x:num`;`i:num`] +THEN MP_TAC(ARITH_RULE`0 i=1 \/ i=2 \/ i=3\/ i=4\/ i=5`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x<= 5==> x=0 \/ x=1 \/ x=2 \/ x=3\/ x=4\/ x=5`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +REWRITE_TAC[ARITH_RULE`6-1=5`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN ASSUME_TAC(ARITH_RULE`1<=6 /\1<6/\ 1<=5`) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`6:num`;`x:num`;`6:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`6`;`x:num`][ARITH_RULE`1*6=6`] +THEN MP_TAC(ARITH_RULE`x<= 5==> x=0 \/ x=1 \/ x=2\/ x=3\/ x=4\/ x=5`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`i MOD 6= j MOD 6 \/ ~(i MOD 6= j MOD 6)`) +THEN RESA_TAC; + +REAL_ARITH_TAC; + +MP_TAC(ARITH_RULE`(i MOD 6 = SUC j MOD 6 \/ j MOD 6 = SUC i MOD 6) \/ ~(i MOD 6 = SUC j MOD 6 \/ j MOD 6 = SUC i MOD 6)`) +THEN RESA_TAC +THEN REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; + +STRIP_TAC; + +REPEAT GEN_TAC +THEN ASSUME_TAC(ARITH_RULE`1<=6 /\1<6/\ 1<=2`) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`6:num`;`j:num`;`6:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`6`;`j:num`][ARITH_RULE`1*6=6`] +THEN MRESAL_TAC MOD_MOD_REFL[`j:num`;`6`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`j:num`;`1:num`;`6`][ARITH_RULE`~(6=0) /\ 1 MOD 6=1`;ADD1]; + +STRIP_TAC; + +REWRITE_TAC[IN_NUMSEG;ARITH_RULE`(0 <= i /\ i <= 5)<=> i=0 \/ i=1\/ i=2 \/ i=3\/ i=4 \/ i=5`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 6=0 /\ 1 MOD 6=1 /\ 2 MOD 6=2 /\ 3 MOD 6=3 /\ ~(0=1) +/\ SUC 0 MOD 6=1 /\ SUC 1 MOD 6=2/\ SUC 2 MOD 6=3 /\ SUC 3 MOD 6=4/\ SUC 4 MOD 6=5 /\ 4 MOD 6=4/\ SUC 5 MOD 6=0/\ 5 MOD 6=5`;h0;REAL_ARITH`&2<= &2`;cstab] +THEN REAL_ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[IN_NUMSEG;ARITH_RULE`(0 <= i /\ i <= 5)<=> i=0 \/ i=1\/ i=2 \/ i=3\/ i=4 \/ i=5`] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 6=0 /\ 1 MOD 6=1 /\ 2 MOD 6=2 /\ 3 MOD 6=3 /\ ~(0=1)/\ ~(1=2) +/\ SUC 0 MOD 6=1 /\ SUC 1 MOD 6=2/\ SUC 2 MOD 6=3 /\ SUC 3 MOD 6=4/\ SUC 4 MOD 6=5 /\ 4 MOD 6=4/\ SUC 5 MOD 6=0/\ 5 MOD 6=5/\ 1+i=i+1`;h0;REAL_ARITH`&2<= &2`;cstab;GSYM ADD1] +THEN REAL_ARITH_TAC; + +SET_TAC[] +]);; + (* }}} *) + + + + + + + + + + + + +let SCS_4_3_IS_TRI_STABLE=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (#0.467) (cs_adj 4 (&2) (&3)) (cs_adj 4 (&2 * h0) upperbd)) +==> stable_system (scs_k_v39 s) (scs_d_v39 s) (0..(scs_k_v39 s)-1) +(change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) +(change_type_v2 (scs_J_v39 s) (scs_k_v39 s)) (\i. ((1+i):num MOD (scs_k_v39 s))) +`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`~(4=3)/\ 4-1=3`;mk_unadorned_v39;CS_ADJ;scs_J_v39_explicit;change_type_v2;d_tame ;change_type_v3] +THEN MRESAL_TAC HAS_SIZE_NUMSEG[`0`;`3`][ARITH_RULE`(3+1)-0=4`] +THEN ASM_SIMP_TAC[stable_system;constraint_system;torsor;ARITH_RULE`3<= 4 /\4<=6/\ 1+4<=6/\ (3+1)-0=4/\ 4=4 /\ 0+4<=6`;CARD_NUMSEG;Hypermap.CARD_SINGLETON;change_type_v3;ARITH_RULE`A=B:num <=> B=A`;SET_RULE`A\/B<=> B\/A`;SET_RULE`{{i MOD k,j MOD K}| i,j| F}={}/\ {} SUBSET A`;CARD_CLAUSES] +THEN STRIP_TAC; + +STRIP_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN MRESAL1_TAC Hypermap.LE_MOD_SUC`3`[ARITH_RULE`SUC 3=4`]; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL MOD_IMP_EQ)[`4`;`1+x1`;`1+x2`][ARITH_RULE`1<= 1+A /\ (1+A<=4<=> A<=3)`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`0 1<= i /\ 1<4`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`4:num`;`x:num`;`i:num`] +THEN MP_TAC(ARITH_RULE`0 i=1 \/ i=2 \/ i=3`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x<= 3==> x=0 \/ x=1 \/ x=2 \/ x=3`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN ASSUME_TAC(ARITH_RULE`1<=4 /\1<4/\ 1<=3`) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`4:num`;`x:num`;`4:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`4`;`x:num`][ARITH_RULE`1*4=4`] +THEN MP_TAC(ARITH_RULE`x<= 3==> x=0 \/ x=1 \/ x=2\/ x=3`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`i MOD 4= j MOD 4 \/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC; + +REAL_ARITH_TAC; + +MP_TAC(ARITH_RULE`(i MOD 4 = SUC j MOD 4 \/ j MOD 4 = SUC i MOD 4) \/ ~(i MOD 4 = SUC j MOD 4 \/ j MOD 4 = SUC i MOD 4)`) +THEN RESA_TAC +THEN REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; + +STRIP_TAC; + +REPEAT GEN_TAC +THEN ASSUME_TAC(ARITH_RULE`1<=4 /\1<4/\ 1<=2`) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`4:num`;`j:num`;`4:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`4`;`j:num`][ARITH_RULE`1*4=4`] +THEN MRESAL_TAC MOD_MOD_REFL[`j:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`j:num`;`1:num`;`4`][ARITH_RULE`~(4=0) /\ 1 MOD 4=1`;ADD1]; + +STRIP_TAC; + +REWRITE_TAC[IN_NUMSEG;ARITH_RULE`(0 <= i /\ i <= 3)<=> i=0 \/ i=1\/ i=2 \/ i=3`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 4=0 /\ 1 MOD 4=1 /\ 2 MOD 4=2 /\ 3 MOD 4=3 /\ ~(0=1) +/\ SUC 0 MOD 4=1 /\ SUC 1 MOD 4=2/\ SUC 2 MOD 4=3 /\ SUC 3 MOD 4=0`;h0;REAL_ARITH`&2<= &2`;cstab] +THEN REAL_ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[IN_NUMSEG;ARITH_RULE`(0 <= i /\ i <= 3)<=> i=0 \/ i=1\/ i=2\/ i=3`] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 4=0 /\ 1 MOD 4=1 /\ 2 MOD 4=2 /\ 3 MOD 4=3 /\ ~(0=1) +/\ SUC 0 MOD 4=1 /\ SUC 1 MOD 4=2/\ SUC 2 MOD 4=3 /\ SUC 3 MOD 4=0/\ 1+i=i+1`;h0;REAL_ARITH`&2<= &2`;cstab;GSYM ADD1] +THEN REAL_ARITH_TAC; + +SET_TAC[] +]);; + (* }}} *) + + + + + + + + +let SCS_5_sqrt8_IS_TRI_STABLE=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (#0.616) (cs_adj 5 (&2) (sqrt8)) (cs_adj 5 (&2 * h0) upperbd)) +==> stable_system (scs_k_v39 s) (scs_d_v39 s) (0..(scs_k_v39 s)-1) +(change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) +(change_type_v2 (scs_J_v39 s) (scs_k_v39 s)) (\i. ((1+i):num MOD (scs_k_v39 s)))`, + (* {{{ proof *) +[ + +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`~(5=3)/\ 5-1=4`;mk_unadorned_v39;CS_ADJ;scs_J_v39_explicit;change_type_v2;d_tame ;change_type_v3] +THEN MRESAL_TAC HAS_SIZE_NUMSEG[`0`;`4`][ARITH_RULE`(4+1)-0=5`] +THEN ASM_SIMP_TAC[stable_system;constraint_system;torsor;ARITH_RULE`3<= 5 /\5<=6/\ 1+5<=6/\ (4+1)-0=5/\ 5=5 /\ 0+5<=6`;CARD_NUMSEG;Hypermap.CARD_SINGLETON;change_type_v3;ARITH_RULE`A=B:num <=> B=A`;SET_RULE`A\/B<=> B\/A`;SET_RULE`{{i MOD k,j MOD K}| i,j| F}={}/\ {} SUBSET A`;CARD_CLAUSES] +THEN STRIP_TAC; + + +STRIP_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`5-1=4`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN MRESAL1_TAC Hypermap.LE_MOD_SUC`4`[ARITH_RULE`SUC 4=5`]; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`5-1=4`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL MOD_IMP_EQ)[`5`;`1+x1`;`1+x2`][ARITH_RULE`1<= 1+A /\ (1+A<=5<=> A<=4)`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`5-1=4`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`0 1<= i /\ 1<5`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`5:num`;`x:num`;`i:num`] +THEN MP_TAC(ARITH_RULE`0 i=1 \/ i=2 \/ i=3\/ i=4`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x<= 4==> x=0 \/ x=1 \/ x=2 \/ x=3\/ x=4`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +REWRITE_TAC[ARITH_RULE`5-1=4`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN ASSUME_TAC(ARITH_RULE`1<=5 /\1<5/\ 1<=4`) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`5:num`;`x:num`;`5:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`5`;`x:num`][ARITH_RULE`1*5=5`] +THEN MP_TAC(ARITH_RULE`x<= 4==> x=0 \/ x=1 \/ x=2\/ x=3\/ x=4`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`i MOD 5= j MOD 5 \/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC; + +REAL_ARITH_TAC; + +MP_TAC(ARITH_RULE`(i MOD 5 = SUC j MOD 5 \/ j MOD 5 = SUC i MOD 5) \/ ~(i MOD 5 = SUC j MOD 5 \/ j MOD 5 = SUC i MOD 5)`) +THEN RESA_TAC +THEN REWRITE_TAC[h0;sqrt8] +THEN MRESAL_TAC REAL_LE_LSQRT [`&8`;`&6`][REAL_ARITH`&0<= &8/\ &0<= &6 /\ &8<= &6 pow 2`] +THEN REAL_ARITH_TAC; + + +STRIP_TAC; + +REPEAT GEN_TAC +THEN ASSUME_TAC(ARITH_RULE`1<=5 /\1<5/\ 1<=2`) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`5:num`;`j:num`;`5:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`5`;`j:num`][ARITH_RULE`1*5=5`] +THEN MRESAL_TAC MOD_MOD_REFL[`j:num`;`5`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`j:num`;`1:num`;`5`][ARITH_RULE`~(5=0) /\ 1 MOD 5=1`;ADD1]; + +STRIP_TAC; + +REWRITE_TAC[IN_NUMSEG;ARITH_RULE`(0 <= i /\ i <= 4)<=> i=0 \/ i=1\/ i=2 \/ i=3\/ i=4`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 5=0 /\ 1 MOD 5=1 /\ 2 MOD 5=2 /\ 3 MOD 5=3 /\ ~(0=1)/\ ~(0=2)/\ ~(0=3)/\ ~(2=1)/\ ~(0=4)/\ ~(3=1) /\ ~(1=4) /\ ~(3=2) +/\ ~(4=2) /\ ~(4=3) +/\ SUC 0 MOD 5=1 /\ SUC 1 MOD 5=2/\ SUC 2 MOD 5=3 /\ SUC 3 MOD 5=4/\ SUC 4 MOD 5=0 /\ 4 MOD 5=4`;h0;REAL_ARITH`&2<= &2`;cstab;sqrt8] +THEN MRESAL_TAC REAL_LE_RSQRT [`&2`;`&8`][REAL_ARITH`&0<= &8/\ &0<= &8 /\ &2 pow 2<= &8`] +THEN MRESAL_TAC REAL_LE_LSQRT [`&8`;`#3.01`][REAL_ARITH`&0<= &8/\ &0<= #3.01 /\ &8<= #3.01 pow 2`] +THEN REAL_ARITH_TAC; + +STRIP_TAC; + + +REWRITE_TAC[IN_NUMSEG;ARITH_RULE`(0 <= i /\ i <= 4)<=> i=0 \/ i=1\/ i=2 \/ i=3\/ i=4`] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 5=0 /\ 1 MOD 5=1 /\ 2 MOD 5=2 /\ 3 MOD 5=3 /\ ~(0=1)/\ ~(0=2)/\ ~(0=3)/\ ~(2=1)/\ ~(0=4)/\ ~(3=1) /\ ~(1=4) /\ ~(3=2) +/\ ~(4=2) /\ ~(4=3) +/\ SUC 0 MOD 5=1 /\ SUC 1 MOD 5=2/\ SUC 2 MOD 5=3 /\ SUC 3 MOD 5=4/\ SUC 4 MOD 5=0 /\ 4 MOD 5=4/\ 1+i=i+1`;h0;REAL_ARITH`&2<= &2`;cstab;GSYM ADD1;h0;REAL_ARITH`&2<= &2`;cstab;sqrt8] +THEN MRESAL_TAC REAL_LE_RSQRT [`&2`;`&8`][REAL_ARITH`&0<= &8/\ &0<= &8 /\ &2 pow 2<= &8`] +THEN MRESAL_TAC REAL_LE_LSQRT [`&8`;`#3.01`][REAL_ARITH`&0<= &8/\ &0<= #3.01 /\ &8<= #3.01 pow 2`] + +THEN REAL_ARITH_TAC; + + +SET_TAC[] +]);; + (* }}} *) + + + + + + + +let SCS_4_sqrt8_IS_TRI_STABLE=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (#0.477) (a_pro 4 (&2 * h0) (&2) sqrt8) (a_pro 4 sqrt8 (&2 * h0) upperbd)) +==> stable_system (scs_k_v39 s) (scs_d_v39 s) (0..(scs_k_v39 s)-1) +(change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) +(change_type_v2 (scs_J_v39 s) (scs_k_v39 s)) (\i. ((1+i):num MOD (scs_k_v39 s)))`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`~(4=3)/\ 4-1=3`;mk_unadorned_v39;CS_ADJ;scs_J_v39_explicit;change_type_v2;d_tame ;change_type_v3] +THEN MRESAL_TAC HAS_SIZE_NUMSEG[`0`;`3`][ARITH_RULE`(3+1)-0=4`] +THEN ASM_SIMP_TAC[stable_system;constraint_system;torsor;ARITH_RULE`3<= 4 /\4<=6/\ 1+4<=6/\ (3+1)-0=4/\ 4=4 /\ 0+4<=6`;CARD_NUMSEG;Hypermap.CARD_SINGLETON;change_type_v3;ARITH_RULE`A=B:num <=> B=A`;SET_RULE`A\/B<=> B\/A`;SET_RULE`{{i MOD k,j MOD K}| i,j| F}={}/\ {} SUBSET A`;CARD_CLAUSES;SET_RULE`({j MOD 4, i MOD 4} = {0, 1})<=> {i MOD 4, j MOD 4} = {0, 1}`] +THEN STRIP_TAC; + +STRIP_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN MRESAL1_TAC Hypermap.LE_MOD_SUC`3`[ARITH_RULE`SUC 3=4`]; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL MOD_IMP_EQ)[`4`;`1+x1`;`1+x2`][ARITH_RULE`1<= 1+A /\ (1+A<=4<=> A<=3)`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`0 1<= i /\ 1<4`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`4:num`;`x:num`;`i:num`] +THEN MP_TAC(ARITH_RULE`0 i=1 \/ i=2 \/ i=3`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x<= 3==> x=0 \/ x=1 \/ x=2 \/ x=3`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +REWRITE_TAC[ARITH_RULE`4-1=3`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN ASSUME_TAC(ARITH_RULE`1<=4 /\1<4/\ 1<=3`) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`4:num`;`x:num`;`4:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`4`;`x:num`][ARITH_RULE`1*4=4`] +THEN MP_TAC(ARITH_RULE`x<= 3==> x=0 \/ x=1 \/ x=2\/ x=3`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`i MOD 4= j MOD 4 \/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC; + +REAL_ARITH_TAC; + +MP_TAC(SET_RULE`{i MOD 4, j MOD 4} = {0, 1} \/ ~({i MOD 4, j MOD 4} = {0, 1})`) +THEN RESA_TAC; + + +MRESAL_TAC REAL_LE_RSQRT [`&2 * #1.26 `;`&8`][sqrt8;h0;REAL_ARITH`&0<= &8/\ &0<= &2 * #1.26 /\ (&2 * #1.26) pow 2<= &8`]; + +MP_TAC(ARITH_RULE`(i MOD 4 = SUC j MOD 4 \/ j MOD 4 = SUC i MOD 4) \/ ~(i MOD 4 = SUC j MOD 4 \/ j MOD 4 = SUC i MOD 4)`) +THEN RESA_TAC +THEN REWRITE_TAC[h0;sqrt8] +THEN MRESAL_TAC REAL_LE_LSQRT [`&8`;`&6`][REAL_ARITH`&0<= &8/\ &0<= &6 /\ &8<= &6 pow 2`] +THEN REAL_ARITH_TAC; + + +STRIP_TAC; + +REPEAT GEN_TAC +THEN ASSUME_TAC(ARITH_RULE`1<=4 /\1<4/\ 1<=2`) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`4:num`;`j:num`;`4:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`4`;`j:num`][ARITH_RULE`1*4=4`] +THEN MRESAL_TAC MOD_MOD_REFL[`j:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`j:num`;`1:num`;`4`][ARITH_RULE`~(4=0) /\ 1 MOD 4=1`;ADD1]; + +STRIP_TAC; + +REWRITE_TAC[IN_NUMSEG;ARITH_RULE`(0 <= i /\ i <= 3)<=> i=0 \/ i=1\/ i=2 \/ i=3`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`~(2=0) /\ ~(2=1)/\ ~(3=0) /\ ~(3=1)==> ~({2,3}={1,0}) `) +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 4=0 /\ 1 MOD 4=1 /\ 2 MOD 4=2 /\ 3 MOD 4=3 /\ ~(0=1)/\ ~(0=2)/\ ~(0=3)/\ ~(2=1)/\ ~(0=4)/\ ~(3=1) /\ ~(1=4) /\ ~(3=2) +/\ ~(4=2) /\ ~(4=3) +/\ SUC 0 MOD 4=1 /\ SUC 1 MOD 4=2/\ SUC 2 MOD 4=3 /\ SUC 3 MOD 4=0 `;h0;REAL_ARITH`&2<= &2`;cstab;SET_RULE`{A,B}={A,C}<=> B=C`;sqrt8;SET_RULE`{A,B}={B,A}`;SET_RULE`{B,A}={C,A}<=> B=C`;SET_RULE`{B,A}={A,C}<=> B=C`;] +THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_RSQRT [`&2`;`&8`][REAL_ARITH`&0<= &8/\ &0<= &8 /\ &2 pow 2<= &8`] +THEN MRESAL_TAC REAL_LE_LSQRT [`&8`;`#3.01`][REAL_ARITH`&0<= &8/\ &0<= #3.01 /\ &8<= #3.01 pow 2`] +THEN REAL_ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[IN_NUMSEG;ARITH_RULE`(0 <= i /\ i <= 3)<=> i=0 \/ i=1\/ i=2 \/ i=3`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`~(2=0) /\ ~(2=1)/\ ~(3=0) /\ ~(3=1)==> ~({2,3}={1,0}) `) +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 4=0 /\ 1 MOD 4=1 /\ 2 MOD 4=2 /\ 3 MOD 4=3 /\ ~(0=1)/\ ~(0=2)/\ ~(0=3)/\ ~(2=1)/\ ~(0=4)/\ ~(3=1) /\ ~(1=4) /\ ~(3=2) +/\ ~(4=2) /\ ~(4=3)/\ 1+0=1/\ 1+2=3/\ 1+3=4/\ 4 MOD 4=0 +/\ SUC 0 MOD 4=1 /\ SUC 1 MOD 4=2/\ SUC 2 MOD 4=3 /\ SUC 3 MOD 4=0 `;h0;REAL_ARITH`&2<= &2`;cstab;SET_RULE`{A,B}={A,C}<=> B=C`;sqrt8;SET_RULE`{A,B}={B,A}`;SET_RULE`{B,A}={C,A}<=> B=C`;SET_RULE`{B,A}={A,C}<=> B=C`;cstab;GSYM ADD1;h0;REAL_ARITH`&2<= &2`;cstab;sqrt8] +THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_RSQRT [`&2`;`&8`][REAL_ARITH`&0<= &8/\ &0<= &8 /\ &2 pow 2<= &8`] +THEN MRESAL_TAC REAL_LE_LSQRT [`&8`;`#3.01`][REAL_ARITH`&0<= &8/\ &0<= #3.01 /\ &8<= #3.01 pow 2`] +THEN REAL_ARITH_TAC; + + +SET_TAC[] +]);; + (* }}} *) + + + + + +let SCS_5_pro_cs_IS_TRI_STABLE=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (#0.616) (a_pro 5 (&2 * h0) (&2) (&2 * h0)) (a_pro 5 sqrt8 (&2 * h0) upperbd)) +==> stable_system (scs_k_v39 s) (scs_d_v39 s) (0..(scs_k_v39 s)-1) +(change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) +(change_type_v2 (scs_J_v39 s) (scs_k_v39 s)) (\i. ((1+i):num MOD (scs_k_v39 s)))`, + (* {{{ proof *) +[ + +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`~(5=3)/\ 5-1=4`;mk_unadorned_v39;CS_ADJ;scs_J_v39_explicit;change_type_v2;d_tame ;change_type_v3] +THEN MRESAL_TAC HAS_SIZE_NUMSEG[`0`;`4`][ARITH_RULE`(4+1)-0=5`] +THEN ASM_SIMP_TAC[stable_system;constraint_system;torsor;ARITH_RULE`3<= 5 /\5<=6/\ 1+5<=6/\ (4+1)-0=5/\ 5=5 /\ 0+5<=6`;CARD_NUMSEG;Hypermap.CARD_SINGLETON;change_type_v3;ARITH_RULE`A=B:num <=> B=A`;SET_RULE`A\/B<=> B\/A`;SET_RULE`{{i MOD k,j MOD K}| i,j| F}={}/\ {} SUBSET A`;CARD_CLAUSES;SET_RULE`({j MOD 5, i MOD 5} = {0, 1})<=> {i MOD 5, j MOD 5} = {0, 1}`] +THEN STRIP_TAC; + +STRIP_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`5-1=4`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN MRESAL1_TAC Hypermap.LE_MOD_SUC`4`[ARITH_RULE`SUC 4=5`]; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`5-1=4`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL MOD_IMP_EQ)[`5`;`1+x1`;`1+x2`][ARITH_RULE`1<= 1+A /\ (1+A<=5<=> A<=4)`] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`5-1=4`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`0 1<= i /\ 1<5`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`5:num`;`x:num`;`i:num`] +THEN MP_TAC(ARITH_RULE`0 i=1 \/ i=2 \/ i=3\/ i=4`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x<= 4==> x=0 \/ x=1 \/ x=2 \/ x=3\/ x=4`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +REWRITE_TAC[ARITH_RULE`5-1=4`;IN_NUMSEG;ARITH_RULE`0<= A`] +THEN REPEAT STRIP_TAC +THEN ASSUME_TAC(ARITH_RULE`1<=5 /\1<5/\ 1<=4`) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`5:num`;`x:num`;`5:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`5`;`x:num`][ARITH_RULE`1*5=5`] +THEN MP_TAC(ARITH_RULE`x<= 4==> x=0 \/ x=1 \/ x=2\/ x=3\/ x=4`) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ARITH_TAC; + +STRIP_TAC; + +REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`i MOD 5= j MOD 5 \/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC; + +REAL_ARITH_TAC; + +MP_TAC(SET_RULE`{i MOD 5, j MOD 5} = {0, 1} \/ ~({i MOD 5, j MOD 5} = {0, 1})`) +THEN RESA_TAC; + +MRESAL_TAC REAL_LE_RSQRT [`&2 * #1.26 `;`&8`][sqrt8;h0;REAL_ARITH`&0<= &8/\ &0<= &2 * #1.26 /\ (&2 * #1.26) pow 2<= &8`]; + +MP_TAC(ARITH_RULE`(i MOD 5 = SUC j MOD 5 \/ j MOD 5 = SUC i MOD 5) \/ ~(i MOD 5 = SUC j MOD 5 \/ j MOD 5 = SUC i MOD 5)`) +THEN RESA_TAC +THEN REWRITE_TAC[h0;sqrt8] +THEN MRESAL_TAC REAL_LE_LSQRT [`&8`;`&6`][REAL_ARITH`&0<= &8/\ &0<= &6 /\ &8<= &6 pow 2`] +THEN REAL_ARITH_TAC; + + +STRIP_TAC; + +REPEAT GEN_TAC +THEN ASSUME_TAC(ARITH_RULE`1<=5 /\1<5/\ 1<=2`) +THEN MRESA_TAC (GEN_ALL POWER_MOD_FUN)[`5:num`;`j:num`;`5:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`5`;`j:num`][ARITH_RULE`1*5=5`] +THEN MRESAL_TAC MOD_MOD_REFL[`j:num`;`5`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`j:num`;`1:num`;`5`][ARITH_RULE`~(5=0) /\ 1 MOD 5=1`;ADD1]; + +STRIP_TAC; + +REWRITE_TAC[IN_NUMSEG;ARITH_RULE`(0 <= i /\ i <= 4)<=> i=0 \/ i=1\/ i=2 \/ i=3\/ i=4`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 5=0 /\ 1 MOD 5=1 /\ 2 MOD 5=2 /\ 3 MOD 5=3 /\ ~(0=1)/\ ~(0=2)/\ ~(0=3)/\ ~(2=1)/\ ~(0=4)/\ ~(3=1) /\ ~(1=4) /\ ~(3=2) +/\ ~(4=2) /\ ~(4=3)/\ 1+0=1/\ 1+2=3/\ 1+3=4/\ 5 MOD 5=0 +/\ SUC 0 MOD 5=1 /\ SUC 1 MOD 5=2/\ SUC 2 MOD 5=3 /\ SUC 3 MOD 5=4/\ SUC 4 MOD 5=0 /\ 4 MOD 5=4`;h0;REAL_ARITH`&2<= &2`;cstab;sqrt8] +THEN MRESAL_TAC REAL_LE_RSQRT [`&2`;`&8`][REAL_ARITH`&0<= &8/\ &0<= &8 /\ &2 pow 2<= &8`] +THEN MRESAL_TAC REAL_LE_LSQRT [`&8`;`#3.01`][REAL_ARITH`&0<= &8/\ &0<= #3.01 /\ &8<= #3.01 pow 2`] +THEN REAL_ARITH_TAC; + +STRIP_TAC; + +REWRITE_TAC[IN_NUMSEG;ARITH_RULE`(0 <= i /\ i <= 4)<=> i=0 \/ i=1\/ i=2 \/ i=3\/ i=4`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`~(2=0) /\ ~(2=1)/\ ~(3=0) /\ ~(3=1)==> ~({2,3}={1,0}) `) +THEN MP_TAC(SET_RULE`~(4=0) /\ ~(4=1)/\ ~(3=0) /\ ~(3=1)==> ~({4,3}={1,0}) `) +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 5=0 /\ 1 MOD 5=1 /\ 2 MOD 5=2 /\ 3 MOD 5=3 /\ ~(0=1)/\ ~(0=2)/\ ~(0=3)/\ ~(2=1)/\ ~(0=4)/\ ~(3=1) /\ ~(1=4) /\ ~(3=2) +/\ ~(4=2) /\ ~(4=3)/\ 1+0=1/\ 1+2=3/\ 1+3=4/\ 5 MOD 5=0 +/\ SUC 0 MOD 5=1 /\ SUC 1 MOD 5=2/\ SUC 2 MOD 5=3 /\ SUC 3 MOD 5=4/\ SUC 4 MOD 5=0 /\ 4 MOD 5=4/\ 1+i=i+1`;h0;REAL_ARITH`&2<= &2`;cstab;GSYM ADD1;h0;REAL_ARITH`&2<= &2`;cstab;cstab;SET_RULE`{A,B}={A,C}<=> B=C`;sqrt8;SET_RULE`{A,B}={B,A}`;SET_RULE`{B,A}={C,A}<=> B=C`;SET_RULE`{B,A}={A,C}<=> B=C`;cstab;GSYM ADD1;h0;REAL_ARITH`&2<= &2`;cstab;sqrt8] +THEN RESA_TAC +THEN RESA_TAC +THEN MRESAL_TAC REAL_LE_RSQRT [`&2`;`&8`][REAL_ARITH`&0<= &8/\ &0<= &8 /\ &2 pow 2<= &8`] +THEN MRESAL_TAC REAL_LE_LSQRT [`&8`;`#3.01`][REAL_ARITH`&0<= &8/\ &0<= #3.01 /\ &8<= #3.01 pow 2`] +THEN REAL_ARITH_TAC; + +SET_TAC[] +]);; + (* }}} *) + + + + + + + +let stable_sy_explicit = prove_by_refinement( + `!k d s a b J f. stable_system k d s a b J f ==> k_sy (stable_sy (k,d,s, a,b,J,f)) = k/\ +d_sy (stable_sy (k,d,s, a,b,J,f)) = d /\ +a_sy (stable_sy (k,d,s, a,b,J,f)) = a /\ +b_sy (stable_sy (k,d,s, a,b,J,f)) = b /\ +J_SY (stable_sy (k,d,s, a,b,J,f)) = J /\ +I_SY (stable_sy (k,d,s, a,b,J,f)) = s /\ +f_sy (stable_sy (k,d,s, a,b,J,f)) = f `, + (* {{{ proof *) + [ REWRITE_TAC[k_sy;d_sy;a_sy;b_sy;J_SY;I_SY;f_sy;stable_sy_tybij;] +THEN MP_TAC stable_sy_tybij +THEN STRIP_TAC +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> +POP_ASSUM (fun th1-> ASSUME_TAC th THEN MRESA1_TAC th1`(k,d,s,a,b,J,f):(num#real#(num->bool)#(num#num->real)#(num#num->real)#((num->bool)->bool)#(num->num))`)) +]);; + (* }}} *) + + + + + + +let SCS_K_LT_2= prove_by_refinement( +`MEM s s_init_list_v39 +==> 2< scs_k_v39 s`, + (* {{{ proof *) + [ +REWRITE_TAC[s_init_list_v39;JEJTVGB_assume_v39;GSYM IN_SET_OF_LIST;taustar_v39;set_of_list;LET_DEF;LET_END_DEF +;SET_RULE`A IN {A1,A2,A3,A4,A5,A6,A7,A8} <=> A= A1 \/ A= A2 \/ A= A3 \/ A= A4 \/ A= A5 \/ A= A6 \/ A= A7 \/ A= A8`] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;mk_unadorned_v39;scs_k_v39_explicit] +THEN ARITH_TAC +]);; + (* }}} *) + + + + + + + + + + + + + + + + + + + + + + + + + + + + +let VECTOR_3_3=prove(`!x y z. 1<= dimindex(:M)/\ 2<= dimindex(:M) /\ 3<= dimindex(:M) ==> (row 1 (vector[x;y;z:real^3]:real^3^M)) = x +/\ (row 2 (vector[x;y;z:real^3]:real^3^M)) = y +/\ (row 3 (vector[x;y;z:real^3]:real^3^M)) = z +`, +REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[row;vector; LAMBDA_BETA; DIMINDEX_3; LENGTH; ARITH] THEN +REWRITE_TAC[num_CONV `2`; num_CONV `1`; EL; HD; TL] +THEN VECTOR_ARITH_TAC);; + + + + +let ROW_IN_BALL_ANNULUS_3= +fun (th:term)-> +ASM_SIMP_TAC[] +THEN MRESAL_TAC VECTOR_3_3[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=3/\ 2<=3/\ 3<=3`] +THEN MATCH_MP_TAC(SET_RULE` +vv th IN IMAGE vv (:num) /\ IMAGE vv (:num) SUBSET ball_annulus +==> vv th IN ball_annulus`) +THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC th +THEN REWRITE_TAC[SET_RULE`(a:num) IN(:num)`] +;; + +let INEQUALITY_A_B_SCS_TAC_30= +fun (so:term) (so1:term)-> +ASM_SIMP_TAC[change_type_v3] +THEN MRESAL_TAC VECTOR_3_3[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 0`][ARITH_RULE`1<=3/\ 2<=3/\ 3<=3/\ 1 MOD 3=1/\ 2 MOD 3=2 /\ ~(1=2) /\ SUC 1 MOD 3=2/\ SUC 2 MOD 3=0`] +THEN REPLICATE_TAC 10 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL_TAC th[so;so1][dist;ARITH_RULE`1<=3/\ 2<=3/\ 3<=3/\ 1 MOD 3=1/\ 2 MOD 3=2 /\ ~(1=2) /\ SUC 1 MOD 3=2/\ SUC 2 MOD 3=0/\ 0 MOD 3=0/\ ~(1=0)/\ SUC 0 MOD 3=1 /\ ~(2=1) /\ 3 MOD 3=0 /\ SUC 3 MOD 3=1/\ ~(2=0)`]);; + +let INEQUALITY_A_B_SCS_TAC_3= +fun (th:term)-> +MP_TAC(ARITH_RULE`1<= i /\ i<= 3==> i=1\/ i=2\/ i=3`) +THEN RESA_TAC +THENL[ +INEQUALITY_A_B_SCS_TAC_30 `1` th; +INEQUALITY_A_B_SCS_TAC_30 `2` th; +INEQUALITY_A_B_SCS_TAC_30 `0` th];; + + + + + +let IN_NOT_EMPTY_CASE_3=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 3 (d_tame 3) (cs_adj 3 (&2) (&2 * h0)) (cs_adj 3 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 0]:real^3^M +=v +/\ matvec (v:real^3^M) =a +==> +a IN {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v }`, + (* {{{ proof *) +[ + +REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;IN_ELIM_THM;CONDITION1_SY] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ] +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[IN] +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`v:real^3^M` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 3)<=> (i=1\/ i=2\/ i=3)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THENL[ +ROW_IN_BALL_ANNULUS_3 `1`; +ROW_IN_BALL_ANNULUS_3 `2`; +ROW_IN_BALL_ANNULUS_3 `0`]; + +REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 3)<=> (i=1\/ i=2\/ i=3)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT DISCH_TAC +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THENL[ +INEQUALITY_A_B_SCS_TAC_3 `1` ; +INEQUALITY_A_B_SCS_TAC_3 `2` ; +INEQUALITY_A_B_SCS_TAC_3 `0` ]; +]);; + (* }}} *) + + +let NOT_EMPTY_CASE_3=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 3 (d_tame 3) (cs_adj 3 (&2) (&2 * h0)) (cs_adj 3 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +==> +~({matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v }={})` +, + (* {{{ proof *) +[ +REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;] +THEN STRIP_TAC +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 0]:real^3^M` +THEN ABBREV_TAC`a=matvec (v:real^3^M) ` +THEN EXISTS_TAC`a:real^(M,3)finite_product` +THEN MATCH_MP_TAC IN_NOT_EMPTY_CASE_3 +THEN ASM_REWRITE_TAC[] +]);; + (* }}} *) + + + +let SCS_A_B__EQ_MOD_3=prove( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 3 (d_tame 3) (cs_adj 3 (&2) (&2 * h0)) (cs_adj 3 (&2 * h0) upperbd)) +==> +!i j. scs_a_v39 s i j = scs_a_v39 s (i MOD 3) (j MOD 3)/\ + scs_b_v39 s i j = scs_b_v39 s (i MOD 3) (j MOD 3)`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;CS_ADJ] +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`3`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC MOD_MOD_REFL[`j:num`;`3`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`j:num`;`1:num`;`3`][ARITH_RULE`~(3=0) /\ 1 MOD 3=1`;ADD1] +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`1:num`;`3`][ARITH_RULE`~(3=0) /\ 1 MOD 3=1`;ADD1]);; + + + + + + + +let VV_IN_BALL_ANNULUS_TAC_3= +fun (so:term)-> +REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL1_TAC th so [ARITH_RULE`1<=1 /\ 1<=2 /\1<=3 /\ 1<= 4/\ 1<=3 /\ 2<=3/\ 3<=3/\ 4<=4/\ ~(1=0)/\ ~(2=0) /\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2) `] ) +;; + +let PROVE_INEQUALITY_TAC_30= +fun (so:term) (so1:term)-> +REPLICATE_TAC 6(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL_TAC th[so;so1][ARITH_RULE`1<=3 /\ 3<=3/\ 1<=1 /\ 1<=3/\ 1<=2 /\ 2<=3/\1<=3 /\ 3<=4`]) +THEN POP_ASSUM( fun th-> +POP_ASSUM( fun th1-> +REPEAT DISCH_TAC +THEN MP_TAC th THEN MP_TAC th1 +THEN POP_ASSUM(fun th2-> ONCE_REWRITE_TAC[th2] +THEN POP_ASSUM(fun th3-> MRESAL1_TAC th3`3`[ARITH_RULE`3 MOD 3=0`] +THEN MRESAL1_TAC th3`1`[ARITH_RULE`1 MOD 3=1/\ ~(1=0)`] +THEN MRESAL1_TAC th3`2`[ARITH_RULE`2 MOD 3=2/\ ~(2=0)/\ ~(2=1)`]) +THEN MRESAL1_TAC th2`3`[ARITH_RULE`3 MOD 3=0`]) +)) +THEN MP_TAC SCS_A_B__EQ_MOD_3 +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`3 MOD 3=0/\ 1 MOD 3=1/\ 2 MOD 3=2 /\ 3 MOD 4=3`] +THEN RESA_TAC +THEN RESA_TAC +;; + + +let PROVE_INEQUALITY_TAC_3= +fun (th:term)-> +MP_TAC(ARITH_RULE`(j MOD 3<3)==> (j MOD 3=0) \/ (j MOD 3=1) \/ (j MOD 3=2)`) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_30 th `3`; +PROVE_INEQUALITY_TAC_30 th `1`; +PROVE_INEQUALITY_TAC_30 th `2`];; + + +let IN_NOT_EMPTY_B1_SY_3=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 3 (d_tame 3) (cs_adj 3 (&2) (&2 * h0)) (cs_adj 3 (&2 * h0) upperbd))=s +/\ + scs_k_v39 s= dimindex(:M)/\ + matvec (v:real^3^M) =a/\ +(!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ + CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ (!i. vv i = +if i MOD scs_k_v39 s = 0 then row 3 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +row 2 v) +==> vv IN BBs_v39 s`, + (* {{{ proof *) +[ + +REWRITE_TAC[CONDITION1_SY;CONDITION2_SY;change_type_v3] +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`scs_k_v39 s =3` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;]; + +ASM_REWRITE_TAC[ARITH_RULE`3<=3`] +THEN +POP_ASSUM (fun th-> +REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th1-> ASSUME_TAC(SYM th1)) +THEN ASSUME_TAC th +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[th;IN] +THEN STRIP_TAC +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;] +THEN STRIP_TAC; + +ASM_REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC DIVISION[`x':num`;`3`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 3<3 ==> x' MOD 3 = 0 \/ x' MOD 3 = 1 \/ x' MOD 3 = 2`) +THEN RESA_TAC +THENL[ +VV_IN_BALL_ANNULUS_TAC_3 `3`; +VV_IN_BALL_ANNULUS_TAC_3 `1`; +VV_IN_BALL_ANNULUS_TAC_3 `2`;]; + +STRIP_TAC; + +ASM_REWRITE_TAC[periodic] +THEN GEN_TAC +THEN MRESAL_TAC MOD_EQ[`i+3:num`;`i:num`;`3:num`;`1`][ARITH_RULE`1*A=A`]; + +STRIP_TAC; + +REWRITE_TAC[dist] +THEN REPEAT GEN_TAC +THEN SUBGOAL_THEN`!i. (vv:num->real^3) i= vv (i MOD 3)` ASSUME_TAC; + +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN GEN_TAC +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`3`][ARITH_RULE`~(3=0)`]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC DIVISION[`i:num`;`3`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC DIVISION[`j:num`;`3`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`(i MOD 3<3)==> (i MOD 3=0) \/ (i MOD 3=1) \/ (i MOD 3=2)`) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_3 `3`; +PROVE_INEQUALITY_TAC_3 `1`; +PROVE_INEQUALITY_TAC_3 `2`;]; + +ASM_REWRITE_TAC[ARITH_RULE`3<=3`]; +]);; + (* }}} *) + + + + + +let TRI_STABLE_K_EQ_3=prove(`tri_stable k (d:real) (0..k-1) a b J (\i. ((1+i):num MOD k)) +==> k=3/\ 2 ~(vv 1= vec 0)/\ ~(vv 2= vec 0) /\ ~(vv 0= vec 0)`, + (* {{{ proof *) +[ +REWRITE_TAC[IN] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ;IMAGE;SUBSET;IN_ELIM_THM] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ vv 0 = (vv:num->real^3) x)`ASSUME_TAC; + +EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +SUBGOAL_THEN`(?x. x IN (:num) /\ vv 1 = (vv:num->real^3) x)`ASSUME_TAC; + +EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +SUBGOAL_THEN`(?x. x IN (:num) /\ vv 2 = (vv:num->real^3) x)`ASSUME_TAC; + +EXISTS_TAC`2` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +REPLICATE_TAC 3(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL1_TAC th`(vv:num->real^3) 0`[ball_annulus;IN_ELIM_THM;DIFF;ball] +THEN MRESAL1_TAC th`(vv:num->real^3) 1`[ball_annulus;IN_ELIM_THM;DIFF;ball] +THEN MRESAL1_TAC th`(vv:num->real^3) 2`[ball_annulus;IN_ELIM_THM;DIFF;ball;]) +THEN STRIP_TAC; + +STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th;DIST_REFL;REAL_ARITH`(&0< &2)`]); +STRIP_TAC; +STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th;DIST_REFL;REAL_ARITH`(&0< &2)`]); +STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th;DIST_REFL;REAL_ARITH`(&0< &2)`]) +]);; + (* }}} *) + + + + +let NOT_COLLINEAR_BBs_CASE_3=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 3 (d_tame 3) (cs_adj 3 (&2) (&2 * h0)) (cs_adj 3 (&2 * h0) upperbd))=s +/\ vv IN BBs_v39 s +==> ~collinear{vec 0, vv 1 ,vv 2}/\ + ~collinear{vec 0, vv 1 ,vv 0}/\ + ~collinear{vec 0, vv 2 ,vv 0}` +, + (* {{{ proof *) +[ + +REWRITE_TAC[Local_lemmas.collinear_fan22;aff;AFFINE_HULL_2;IN_ELIM_THM; +VECTOR_ARITH`A % vec 0+B=B`] +THEN STRIP_TAC +THEN MP_TAC POINT_IN_BBS_IS_NOT_0_3 +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ] +THEN SUBGOAL_THEN`scs_k_v39 s =3` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;]; + + +ASM_REWRITE_TAC[ARITH_RULE`3<=3`] +THEN POP_ASSUM(fun th-> +STRIP_TAC +THEN ASSUME_TAC th) +THEN REPEAT DISCH_TAC +THEN REPEAT STRIP_TAC; + + +REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`1`;`2`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ; +ARITH_RULE`1 MOD 3 =1 /\ 2 MOD 3=2/\ ~(1=2) /\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0`;dist;VECTOR_ARITH`A- B%A=(&1-B)%A`;NORM_MUL] +THEN REPLICATE_TAC 7(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ vv 1 = (vv:num->real^3) x)`ASSUME_TAC; + + +EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +SUBGOAL_THEN`(?x. x IN (:num) /\ vv 2 = (vv:num->real^3) x)`ASSUME_TAC; + + +EXISTS_TAC`2` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + + +REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(vv:num->real^3) 2`[ball_annulus;IN_ELIM_THM;DIFF;cball;ball;dist;VECTOR_ARITH`vec 0- B= --B`;NORM_NEG;NORM_MUL;REAL_ARITH`~(a b<=a`] +THEN MRESAL1_TAC th`(vv:num->real^3) 1`[ball_annulus;IN_ELIM_THM;DIFF;cball;ball;dist;VECTOR_ARITH`vec 0- B= --B`;NORM_NEG;NORM_MUL;REAL_ARITH`~(a b<=a`]) +THEN MP_TAC(REAL_ARITH`&0<= &1-v\/ &0<= --( &1-v)`) +THEN STRIP_TAC +; + + + MP_TAC(REAL_ARITH`&0<= v\/ &0<= --( v)`) +THEN STRIP_TAC +; + + +MRESA1_TAC Trigonometry2.ABS_REFL `v:real` +THEN MRESA1_TAC Trigonometry2.ABS_REFL `&1- v:real` +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= (&1 - v) * norm (vv 1) +/\ &2 <= v * norm (vv 1) ==> &4<= norm ((vv:num->real^3) 1)`) +THEN REPLICATE_TAC 5(POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC + +; + + + + +MRESAL1_TAC Trigonometry2.ABS_REFL `-- v:real`[REAL_ABS_NEG] +THEN MRESA1_TAC Trigonometry2.ABS_REFL `&1- v:real` +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= --v * norm (vv 1) +/\ &2 <= norm (vv 1) ==> &4<=(&1- v) *norm ((vv:num->real^3) 1)`) +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 10(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC +; + + + MP_TAC(REAL_ARITH`&0<= v\/ &0<= --( v)`) +THEN STRIP_TAC +; + + +MRESAL1_TAC Trigonometry2.ABS_REFL ` v:real`[REAL_ABS_NEG] +THEN MRESAL1_TAC Trigonometry2.ABS_REFL `--(&1- v):real` [REAL_ABS_NEG] +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= norm (vv 1) +/\ &2 <= --(&1 - v) * norm (vv 1) ==> &4<= v *norm ((vv:num->real^3) 1)`) +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 5(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC +; + + +MRESAL1_TAC Trigonometry2.ABS_REFL ` --v:real`[REAL_ABS_NEG] +THEN MRESAL1_TAC Trigonometry2.ABS_REFL `--(&1- v):real` [REAL_ABS_NEG] +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= norm (vv 1) +/\ &2 <= --v * norm (vv 1) ==> &4<= (&1-v) *norm ((vv:num->real^3) 1)`) +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 11(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; + + +REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`0`;`1`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ; +ARITH_RULE`1 MOD 3 =1 /\ 2 MOD 3=2/\ ~(1=2) /\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ 0 MOD 3=0/\ SUC 0=1/\ ~(0=1)`;dist;VECTOR_ARITH`B%A-A= --((&1-B)%A)`;NORM_MUL;NORM_NEG] +THEN REPLICATE_TAC 7(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ vv 1 = (vv:num->real^3) x)`ASSUME_TAC; + + +EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +SUBGOAL_THEN`(?x. x IN (:num) /\ vv 0 = (vv:num->real^3) x)`ASSUME_TAC; + + +EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + + +REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(vv:num->real^3) 0`[ball_annulus;IN_ELIM_THM;DIFF;cball;ball;dist;VECTOR_ARITH`vec 0- B= --B`;NORM_NEG;NORM_MUL;REAL_ARITH`~(a b<=a`] +THEN MRESAL1_TAC th`(vv:num->real^3) 1`[ball_annulus;IN_ELIM_THM;DIFF;cball;ball;dist;VECTOR_ARITH`vec 0- B= --B`;NORM_NEG;NORM_MUL;REAL_ARITH`~(a b<=a`]) +THEN MP_TAC(REAL_ARITH`&0<= &1-v\/ &0<= --( &1-v)`) +THEN STRIP_TAC +; + + + MP_TAC(REAL_ARITH`&0<= v\/ &0<= --( v)`) +THEN STRIP_TAC +; + + +MRESA1_TAC Trigonometry2.ABS_REFL `v:real` +THEN MRESA1_TAC Trigonometry2.ABS_REFL `&1- v:real` +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= (&1 - v) * norm (vv 1) +/\ &2 <= v * norm (vv 1) ==> &4<= norm ((vv:num->real^3) 1)`) +THEN REPLICATE_TAC 5(POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC + +; + + + + +MRESAL1_TAC Trigonometry2.ABS_REFL `-- v:real`[REAL_ABS_NEG] +THEN MRESA1_TAC Trigonometry2.ABS_REFL `&1- v:real` +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= --v * norm (vv 1) +/\ &2 <= norm (vv 1) ==> &4<=(&1- v) *norm ((vv:num->real^3) 1)`) +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 10(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC +; + + + MP_TAC(REAL_ARITH`&0<= v\/ &0<= --( v)`) +THEN STRIP_TAC +; + + +MRESAL1_TAC Trigonometry2.ABS_REFL ` v:real`[REAL_ABS_NEG] +THEN MRESAL1_TAC Trigonometry2.ABS_REFL `--(&1- v):real` [REAL_ABS_NEG] +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= norm (vv 1) +/\ &2 <= --(&1 - v) * norm (vv 1) ==> &4<= v *norm ((vv:num->real^3) 1)`) +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 5(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC +; + + +MRESAL1_TAC Trigonometry2.ABS_REFL ` --v:real`[REAL_ABS_NEG] +THEN MRESAL1_TAC Trigonometry2.ABS_REFL `--(&1- v):real` [REAL_ABS_NEG] +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= norm (vv 1) +/\ &2 <= --v * norm (vv 1) ==> &4<= (&1-v) *norm ((vv:num->real^3) 1)`) +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 11(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; + + + + + + +REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`0`;`2`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`3<=3`;mk_unadorned_v39;CS_ADJ; +ARITH_RULE`1 MOD 3 =1 /\ 2 MOD 3=2/\ ~(1=2) /\ SUC 1=2 /\ SUC 2=3/\ 3 MOD 3=0/\ 0 MOD 3=0/\ SUC 0=1/\ ~(0=1)/\ ~(0=2)`;dist;VECTOR_ARITH`B%A-A= --((&1-B)%A)`;NORM_MUL;NORM_NEG] +THEN REPLICATE_TAC 7(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN SUBGOAL_THEN`(?x. x IN (:num) /\ vv 2 = (vv:num->real^3) x)`ASSUME_TAC; + + +EXISTS_TAC`2` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + +SUBGOAL_THEN`(?x. x IN (:num) /\ vv 0 = (vv:num->real^3) x)`ASSUME_TAC; + + +EXISTS_TAC`0` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`]; + + +REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(vv:num->real^3) 0`[ball_annulus;IN_ELIM_THM;DIFF;cball;ball;dist;VECTOR_ARITH`vec 0- B= --B`;NORM_NEG;NORM_MUL;REAL_ARITH`~(a b<=a`] +THEN MRESAL1_TAC th`(vv:num->real^3) 2`[ball_annulus;IN_ELIM_THM;DIFF;cball;ball;dist;VECTOR_ARITH`vec 0- B= --B`;NORM_NEG;NORM_MUL;REAL_ARITH`~(a b<=a`]) +THEN MP_TAC(REAL_ARITH`&0<= &1-v\/ &0<= --( &1-v)`) +THEN STRIP_TAC +; + + + MP_TAC(REAL_ARITH`&0<= v\/ &0<= --( v)`) +THEN STRIP_TAC +; + + +MRESA1_TAC Trigonometry2.ABS_REFL `v:real` +THEN MRESA1_TAC Trigonometry2.ABS_REFL `&1- v:real` +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= (&1 - v) * norm (vv 2) +/\ &2 <= v * norm (vv 2) ==> &4<= norm ((vv:num->real^3) 2)`) +THEN REPLICATE_TAC 5(POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC + +; + + + + +MRESAL1_TAC Trigonometry2.ABS_REFL `-- v:real`[REAL_ABS_NEG] +THEN MRESA1_TAC Trigonometry2.ABS_REFL `&1- v:real` +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= --v * norm (vv 2) +/\ &2 <= norm (vv 2) ==> &4<=(&1- v) *norm ((vv:num->real^3) 2)`) +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 10(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC +; + + + MP_TAC(REAL_ARITH`&0<= v\/ &0<= --( v)`) +THEN STRIP_TAC +; + + +MRESAL1_TAC Trigonometry2.ABS_REFL ` v:real`[REAL_ABS_NEG] +THEN MRESAL1_TAC Trigonometry2.ABS_REFL `--(&1- v):real` [REAL_ABS_NEG] +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= norm (vv 2) +/\ &2 <= --(&1 - v) * norm (vv 2) ==> &4<= v *norm ((vv:num->real^3) 2)`) +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 5(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC +; + + +MRESAL1_TAC Trigonometry2.ABS_REFL ` --v:real`[REAL_ABS_NEG] +THEN MRESAL1_TAC Trigonometry2.ABS_REFL `--(&1- v):real` [REAL_ABS_NEG] +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th; ] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(REAL_ARITH`&2 <= norm (vv 2) +/\ &2 <= --v * norm (vv 2) ==> &4<= (&1-v) *norm ((vv:num->real^3) 2)`) +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 11(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +]);; + (* }}} *) + + + + + +let IN_B_SY1_COLLINEAR_CASE_3=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 3 (d_tame 3) (cs_adj 3 (&2) (&2 * h0)) (cs_adj 3 (&2 * h0) upperbd))=s +/\ + scs_k_v39 s= dimindex(:M) +==> + (!a. a IN {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v } +==> ~collinear{vec 0, row 1 (vecmats a),row 2 (vecmats a)}/\ +~collinear{vec 0, row 1 (vecmats a),row 3 (vecmats a)}/\ +~collinear{vec 0, row 2 (vecmats a),row 3 (vecmats a)})` +, + (* {{{ proof *) +[ + +REWRITE_TAC[IN_ELIM_THM;] +THEN STRIP_TAC +THEN GEN_TAC +THEN STRIP_TAC +THEN ABBREV_TAC`( vv i = +if i MOD scs_k_v39 s = 0 then row 3 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +row 2 (v:real^3^M))` +THEN MP_TAC IN_NOT_EMPTY_B1_SY_3 +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[Dih2k_hypermap.VECMATS_MATVEC_ID] +THEN RESA_TAC +THEN STRIP_TAC +THEN MP_TAC NOT_COLLINEAR_BBs_CASE_3 +THEN RESA_TAC +THEN SUBGOAL_THEN`scs_k_v39 s =3` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;]; + +SUBGOAL_THEN`vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 0]:real^3^M +=v`ASSUME_TAC; + +POP_ASSUM(fun th-> +REPLICATE_TAC 8 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th1-> MP_TAC (SYM th1) +THEN REWRITE_TAC[ th])) +THEN REPEAT DISCH_TAC +THEN REPLICATE_TAC 4 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`1 MOD 3=1/\ 2 MOD 3=2/\ 3 MOD 3=0/\ 0 MOD 3=0 /\ ~(1=0)/\ ~(2=0)/\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2)`;] +THEN ONCE_REWRITE_TAC[CART_EQ] +THEN ASM_REWRITE_TAC[ARITH_RULE`1<=i/\ i<=3 <=>i=1\/ i=2\/ i=3`] +THEN REPEAT RESA_TAC +THEN +ASM_SIMP_TAC[row;vector; LAMBDA_BETA; DIMINDEX_3; LENGTH; ARITH] THEN +REWRITE_TAC[num_CONV `3`;num_CONV `2`; num_CONV `1`; EL; HD; TL;] +THEN ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;row;LAMBDA_BETA]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> +REPLICATE_TAC 8 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th1-> MP_TAC (SYM th1) +THEN REWRITE_TAC[ th])) +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC VECTOR_3_3[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=3/\ 2<=3/\ 3<=3`] +]);; + (* }}} *) + + + + + +let HDPLYGY_CASE_3=prove_by_refinement( +`tri_stable k (d:real) (0..k-1) a b J (\i. ((1+i):num MOD k)) /\k= dimindex(:M) +/\ 2 row i v IN ball_annulus) /\ CONDITION1_SY a b v } = {}:real^(M,3)finite_product->bool) +/\ (!l. l IN {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY a b v } +==> ~collinear{vec 0, row 1 (vecmats l),row 2 (vecmats l)}/\ +~collinear{vec 0, row 1 (vecmats l),row 3 (vecmats l)}/\ +~collinear{vec 0, row 2 (vecmats l),row 3 (vecmats l)}) +==> ?x:real^(M,3)finite_product. x IN ({matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY a b v }) +/\ (!y:real^(M,3)finite_product. y IN ({matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY a b v }) +==> tau3 (row 1 (vecmats (x:real^(M,3)finite_product))) (row 2 (vecmats x)) (row 3 ( vecmats x)) <= tau3 (row 1 (vecmats y)) (row 2 (vecmats y)) (row 3 (vecmats y)))` +, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN MP_TAC TRI_STABLE_K_EQ_3 +THEN RESA_TAC +THEN MRESA_TAC CONTINUOUS_ATTAINS_INF[`(\x:real^(M,3)finite_product. tau3 (row 1 (vecmats (x:real^(M,3)finite_product))) (row 2 (vecmats x)) (row 3 ( vecmats x)))`;`{matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY a b v }:real^(M,3)finite_product->bool`] +THEN POP_ASSUM MATCH_MP_TAC +THEN STRIP_TAC +; + + +POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MATCH_MP_TAC COMPACT_TRI_STABLE +THEN ASM_REWRITE_TAC[]; + + +SIMP_TAC[o_DEF;LIFT_SUM;FINITE_NUMSEG;tau3; o_DEF;LIFT_SUB;LIFT_SUM;REAL_ARITH`A+B+C-D=((A+B)+C)-D`] +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN SIMP_TAC[o_DEF;LIFT_ADD;] +THEN MATCH_MP_TAC CONTINUOUS_ON_ADD +THEN STRIP_TAC; + + +SIMP_TAC[o_DEF;LIFT_ADD;] +THEN MATCH_MP_TAC CONTINUOUS_ON_ADD +THEN STRIP_TAC; + + +SIMP_TAC[o_DEF;LIFT_CMUL;FINITE_NUMSEG] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC CONTINUOUS_ON_MUL +THEN STRIP_TAC; + + +REWRITE_TAC[rho;o_DEF;LIFT_ADD] +THEN MATCH_MP_TAC CONTINUOUS_ON_ADD +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_CMUL +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_ADD;ly;interp;REAL_ARITH`a*b=b*a`;LIFT_CMUL] +THEN MATCH_MP_TAC CONTINUOUS_ON_ADD +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_CMUL +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_ADD;ly;interp;REAL_ARITH`a*b=b*a`;LIFT_CMUL] +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_LIFT_NORM_COMPOSE +THEN MATCH_MP_TAC CONTINUOUS_ON_ROW +THEN ASM_REWRITE_TAC[IN_NUMSEG] +THEN ARITH_TAC; + +REWRITE_TAC[CONTINUOUS_ON_SEQUENTIALLY;o_DEF] +THEN REPEAT STRIP_TAC +THEN MP_TAC (GEN_ALL SEQUENTIALLY_DIVH) +THEN REWRITE_TAC[o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESAL_TAC (GEN_ALL LIM_VECMAT)[`(\n:num. vecmats ((x:num->real^(M,3)finite_product) n))`;`vecmats(a':real^(M,3)finite_product)`][MATVEC_VECMATS_ID;ETA_AX] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`1`[ARITH_RULE`1<=1/\ 1<=3`] +THEN MRESAL1_TAC th`2`[ARITH_RULE`1<=2/\ 2<=3`] +THEN MRESAL1_TAC th`3`[ARITH_RULE`1<=3/\ 3<=3`]) +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th `a':real^(M,3)finite_product` +THEN ASSUME_TAC th) +THEN GEN_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x (n:num)):real^(M,3)finite_product`) + +; + + + +SIMP_TAC[o_DEF;LIFT_CMUL;FINITE_NUMSEG] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC CONTINUOUS_ON_MUL +THEN STRIP_TAC; + + +REWRITE_TAC[rho;o_DEF;LIFT_ADD] +THEN MATCH_MP_TAC CONTINUOUS_ON_ADD +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_CMUL +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_ADD;ly;interp;REAL_ARITH`a*b=b*a`;LIFT_CMUL] +THEN MATCH_MP_TAC CONTINUOUS_ON_ADD +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_CMUL +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_ADD;ly;interp;REAL_ARITH`a*b=b*a`;LIFT_CMUL] +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_LIFT_NORM_COMPOSE +THEN MATCH_MP_TAC CONTINUOUS_ON_ROW +THEN ASM_REWRITE_TAC[IN_NUMSEG] +THEN ARITH_TAC; + +REWRITE_TAC[CONTINUOUS_ON_SEQUENTIALLY;o_DEF] +THEN REPEAT STRIP_TAC +THEN MP_TAC (GEN_ALL SEQUENTIALLY_DIVH) +THEN REWRITE_TAC[o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESAL_TAC (GEN_ALL LIM_VECMAT)[`(\n:num. vecmats ((x:num->real^(M,3)finite_product) n))`;`vecmats(a':real^(M,3)finite_product)`][MATVEC_VECMATS_ID;ETA_AX] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`1`[ARITH_RULE`1<=1/\ 1<=3`] +THEN MRESAL1_TAC th`2`[ARITH_RULE`1<=2/\ 2<=3`] +THEN MRESAL1_TAC th`3`[ARITH_RULE`1<=3/\ 3<=3`]) +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th `a':real^(M,3)finite_product` +THEN ASSUME_TAC th) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x (n:num)):real^(M,3)finite_product`) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] + +; + + + +SIMP_TAC[o_DEF;LIFT_CMUL;FINITE_NUMSEG] +THEN REPEAT STRIP_TAC +THEN MATCH_MP_TAC CONTINUOUS_ON_MUL +THEN STRIP_TAC; + + +REWRITE_TAC[rho;o_DEF;LIFT_ADD] +THEN MATCH_MP_TAC CONTINUOUS_ON_ADD +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_CMUL +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_ADD;ly;interp;REAL_ARITH`a*b=b*a`;LIFT_CMUL] +THEN MATCH_MP_TAC CONTINUOUS_ON_ADD +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_CMUL +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_ADD;ly;interp;REAL_ARITH`a*b=b*a`;LIFT_CMUL] +THEN MATCH_MP_TAC CONTINUOUS_ON_SUB +THEN REWRITE_TAC[CONTINUOUS_ON_CONST;LIFT_CMUL;LIFT_SUB;] +THEN MATCH_MP_TAC CONTINUOUS_ON_LIFT_NORM_COMPOSE +THEN MATCH_MP_TAC CONTINUOUS_ON_ROW +THEN ASM_REWRITE_TAC[IN_NUMSEG] +THEN ARITH_TAC; + +REWRITE_TAC[CONTINUOUS_ON_SEQUENTIALLY;o_DEF] +THEN REPEAT STRIP_TAC +THEN MP_TAC (GEN_ALL SEQUENTIALLY_DIVH) +THEN REWRITE_TAC[o_DEF] +THEN STRIP_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESAL_TAC (GEN_ALL LIM_VECMAT)[`(\n:num. vecmats ((x:num->real^(M,3)finite_product) n))`;`vecmats(a':real^(M,3)finite_product)`][MATVEC_VECMATS_ID;ETA_AX] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`1`[ARITH_RULE`1<=1/\ 1<=3`] +THEN MRESAL1_TAC th`2`[ARITH_RULE`1<=2/\ 2<=3`] +THEN MRESAL1_TAC th`3`[ARITH_RULE`1<=3/\ 3<=3`]) +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESA1_TAC th `a':real^(M,3)finite_product` +THEN ASSUME_TAC th) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th `(x (n:num)):real^(M,3)finite_product`) +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[]; +]);; + (* }}} *) + + + + +let TAUSTAR_EQ_TAU_STAR_3=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 3 (d_tame 3) (cs_adj 3 (&2) (&2 * h0)) (cs_adj 3 (&2 * h0) upperbd))=s +/\ vv IN BBs_v39 s +==> taustar_v39 s vv = tau3 (vv 1) (vv 2) (vv 0)` +, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN SUBGOAL_THEN`scs_k_v39 s =3` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;]; + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN ASM_REWRITE_TAC[taustar_v39;tau_star] +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;] +THEN MRESA_TAC dsv_J_empty[`s:scs_v39`;`vv:num->real^3`] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_J_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;d_tame] +THEN RESA_TAC +THEN REWRITE_TAC[tau3;REAL_ARITH`A- &0=A`] +THEN REAL_ARITH_TAC +]);; + (* }}} *) + + + + + + + + + +let XWITCCN_CASE_3=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 3 (d_tame 3) (cs_adj 3 (&2) (&2 * h0)) (cs_adj 3 (&2 * h0) upperbd))=s + /\ vv IN BBs_v39 s /\ + taustar_v39 s vv < &0 +/\ scs_k_v39 s= dimindex(:M) + ==> ~(BBprime_v39 s = {})` +, + (* {{{ proof *) +[ + STRIP_TAC +THEN MP_TAC SCS_3_IS_TRI_STABLE +THEN RESA_TAC +THEN MP_TAC NOT_EMPTY_CASE_3 +THEN RESA_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`] +THEN SUBGOAL_THEN`scs_k_v39 s =3` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;]; + +POP_ASSUM (fun th-> +REPLICATE_TAC 3 (POP_ASSUM MP_TAC) +THEN REWRITE_TAC[th] +THEN STRIP_TAC +THEN POP_ASSUM(fun th1-> ASSUME_TAC(SYM th1)) +THEN ASSUME_TAC th +THEN REPEAT RESA_TAC) +THEN MP_TAC IN_B_SY1_COLLINEAR_CASE_3 +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL HDPLYGY_CASE_3)[`scs_d_v39 s`;`(change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;`scs_k_v39 s`;`(change_type_v3 (scs_a_v39 s))`;` (change_type_v3 (scs_b_v39 s))`][ARITH_RULE`2<3`] +THEN POP_ASSUM (fun th-> +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN REWRITE_TAC[BBprime_v39;IN] +THEN ABBREV_TAC`( vv1 i = +if i MOD scs_k_v39 s = 0 then row 3 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +row 2 (v:real^3^M))` +THEN EXISTS_TAC`vv1:num->real^3` +THEN STRIP_TAC; + +ONCE_REWRITE_TAC[GSYM IN] +THEN MATCH_MP_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_3) +THEN EXISTS_TAC`x:real^(M,3)finite_product` +THEN EXISTS_TAC`v:real^3^M` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; + +SUBGOAL_THEN`vector [ vv1 1; (vv1:num->real^3) 2;vv1 0] = v:real^3^M` +ASSUME_TAC; + +POP_ASSUM(fun th-> REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`1 MOD 3=1/\ 2 MOD 3=2/\ 3 MOD 3=0/\ 0 MOD 3=0 /\ ~(1=0)/\ ~(2=0)/\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2)`;] +THEN ONCE_REWRITE_TAC[CART_EQ] +THEN ASM_REWRITE_TAC[ARITH_RULE`1<=i/\ i<=3 <=>i=1\/ i=2\/ i=3`] +THEN REPEAT RESA_TAC +THEN +ASM_SIMP_TAC[row;vector; LAMBDA_BETA; DIMINDEX_3; LENGTH; ARITH] THEN +REWRITE_TAC[num_CONV `3`;num_CONV `2`; num_CONV `1`; EL; HD; TL;] +THEN ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;row;LAMBDA_BETA]; + +STRIP_TAC; + +GEN_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM IN] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_3) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_3)[`s:scs_v39`;`vv1:num->real^3`;] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_3) +[`s:scs_v39`;`ww:num->real^3`;] +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_CASE_3)[`ww:num->real^3`;`vector [ww 1; ww 2; ww 0]:real^3^M`;`matvec(vector [ww 1; ww 2; ww 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN MRESAL_TAC VECTOR_3_3[`(vv1:num->real^3) 1`;`(vv1:num->real^3) 2`;`(vv1:num->real^3) 0`;][ARITH_RULE`1<=3/\ 2<=3/\ 3<=3`] +THEN MRESAL_TAC VECTOR_3_3[`(ww:num->real^3) 1`;`(ww:num->real^3) 2`;`(ww:num->real^3) 0`;][ARITH_RULE`1<=3/\ 2<=3/\ 3<=3`] +THEN REPLICATE_TAC 13 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th `matvec(vector [ww 1; ww 2; ww 0]:real^3^M):real^(M,3)finite_product`[Dih2k_hypermap.VECMATS_MATVEC_ID]); + +MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_3) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_3)[`s:scs_v39`;`vv1:num->real^3`;] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_3) +[`s:scs_v39`;`vv:num->real^3`;] +THEN REPLICATE_TAC 14 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_CASE_3)[`vv:num->real^3`;`vector [vv 1; vv 2; vv 0]:real^3^M`;`matvec(vector [vv 1; vv 2; vv 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN MRESAL_TAC VECTOR_3_3[`(vv1:num->real^3) 1`;`(vv1:num->real^3) 2`;`(vv1:num->real^3) 0`;][ARITH_RULE`1<=3/\ 2<=3/\ 3<=3`] +THEN MRESAL_TAC VECTOR_3_3[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=3/\ 2<=3/\ 3<=3`] +THEN REPLICATE_TAC 12 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th `matvec(vector [(vv:num->real^3) 1; vv 2; vv 0]:real^3^M):real^(M,3)finite_product`[Dih2k_hypermap.VECMATS_MATVEC_ID]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC +]);; + (* }}} *) + + + + +let VECTOR_3_4=prove(`!x y z t. 1<= dimindex(:M)/\ 2<= dimindex(:M) /\ 3<= dimindex(:M)/\ 4<= dimindex(:M) ==> (row 1 (vector[x;y;z:real^3;t]:real^3^M)) = x +/\ (row 2 (vector[x;y;z:real^3;t]:real^3^M)) = y +/\ (row 3 (vector[x;y;z:real^3;t]:real^3^M)) = z +/\ (row 4 (vector[x;y;z:real^3;t]:real^3^M)) = t +`, +REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[row;vector; LAMBDA_BETA; DIMINDEX_3; LENGTH; ARITH] THEN +REWRITE_TAC[num_CONV `3`;num_CONV `2`; num_CONV `1`; EL; HD; TL] +THEN VECTOR_ARITH_TAC);; + + + + + + + + +let PROVE_V_SY_EQ_TAC= +fun (th:term)-> +EXISTS_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= 1 /\ 1<= 4`] +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 4 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)`] +THEN ARITH_TAC +;; + + +let PROVE_E_SY_EQ_TAC= +fun (th:term)-> +EXISTS_TAC th +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 4 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)/\ SUC 1=2/\ SUC 0=1 /\ SUC 2= 3/\ SUC 3=4 /\ SUC 4=5`;SET_RULE`(a:num)IN (:num)`] +;; + + +let PROVE_EQ_V_SY_TAC_4= +fun (th:term)-> +ASM_REWRITE_TAC[] +THEN EXISTS_TAC th +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 4 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)`;SET_RULE`(a:num)IN (:num)`] +;; + + + +let PROVE_F_SY_EQ_TAC= +fun (th:term)-> +EXISTS_TAC th +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 0`;`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 4 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)/\ SUC 1=2/\ SUC 0=1 /\ SUC 2= 3/\ SUC 3=4 /\ SUC 4=5`] +THEN SET_TAC[];; + +let PROOF_E_EQ_IMAGE_4= +fun (th:term)-> +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`x':num`;th;`4`][ARITH_RULE`~(4=0)/\ 4 MOD 4=0/\ SUC 0 MOD 4=1/\ 1 MOD 4=1/\ 2 MOD 4=2 /\ 3 MOD 4=3`] +THEN EXISTS_TAC th +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 4 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)/\ SUC 1=2/\ SUC 0=1 /\ SUC 2= 3/\ SUC 3=4/\ 1<=1/\ 1<=2/\ 1<=3`];; + + + + + + + + + +let V_E_FF_CASE_4=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (d_tame 4) (cs_adj 4 (&2) (&2 * h0)) (cs_adj 4 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +==> +V_SY (v:real^3^M)=IMAGE vv (:num)/\ + E_SY (v:real^3^M)=IMAGE (\i. {vv i, vv (SUC i)}) (:num)/\ +F_SY (v:real^3^M)=IMAGE (\i. vv i,vv (SUC i)) (:num)`, + (* {{{ proof *) +[ + +STRIP_TAC +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39] +THEN REPEAT STRIP_TAC; + +REWRITE_TAC[V_SY;rows] +THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 4)<=> (i=1\/ i=2\/ i=3 \/ i=4)`] THEN ASSUME_TAC (SYM th)) +THEN STRIP_TAC +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +REPEAT STRIP_TAC +THENL[ +PROVE_EQ_V_SY_TAC_4 `1`; +PROVE_EQ_V_SY_TAC_4 `2`; +PROVE_EQ_V_SY_TAC_4 `3`; +PROVE_EQ_V_SY_TAC_4 `0`]; + +REPEAT STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4)<=> (1<= i /\ i<= 4)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`4`;`vv:num-> real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 4 < 4==> x' MOD 4 =0 \/ x' MOD 4 = 1\/ x' MOD 4 = 2 \/ x' MOD 4 =3`) +THEN RESA_TAC +THENL[ +PROVE_V_SY_EQ_TAC `4`; +PROVE_V_SY_EQ_TAC `1`; +PROVE_V_SY_EQ_TAC `2`; +PROVE_V_SY_EQ_TAC `3`]; + +REWRITE_TAC[E_SY;rows] +THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 4)<=> (i=1\/ i=2\/ i=3 \/ i=4)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THENL[ +PROVE_E_SY_EQ_TAC `1`; +PROVE_E_SY_EQ_TAC `2`; +EXISTS_TAC `3` +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 4 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)/\ SUC 1=2/\ SUC 0=1 /\ SUC 2= 3/\ SUC 3=4`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`4`;`vv:num-> real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`SUC 3`[ARITH_RULE`SUC 3 MOD 4=0/\ SUC 3=4`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SET_TAC[]; +PROVE_E_SY_EQ_TAC `0`]; + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4)<=> (1<= i /\ i<= 4)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`4`;`vv:num-> real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num` THEN MRESA1_TAC th`SUC x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 4 < 4==> x' MOD 4 =0 \/ x' MOD 4 = 1\/ x' MOD 4 = 2 \/ x' MOD 4 =3`) +THEN RESA_TAC +THENL[ +PROOF_E_EQ_IMAGE_4 `4`; +PROOF_E_EQ_IMAGE_4 `1`; +PROOF_E_EQ_IMAGE_4 `2`; +PROOF_E_EQ_IMAGE_4 `3`]; + +REWRITE_TAC[F_SY;rows] +THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 4)<=> (i=1\/ i=2\/ i=3 \/ i=4)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THENL[ +PROVE_E_SY_EQ_TAC `1`; +PROVE_E_SY_EQ_TAC `2`; +EXISTS_TAC `3` +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 4 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)/\ SUC 1=2/\ SUC 0=1 /\ SUC 2= 3/\ SUC 3=4`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`4`;`vv:num-> real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`SUC 3`[ARITH_RULE`SUC 3 MOD 4=0/\ SUC 3=4`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SET_TAC[]; +PROVE_E_SY_EQ_TAC `0`]; + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4)<=> (1<= i /\ i<= 4)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`4`;`vv:num-> real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num` THEN MRESA1_TAC th`SUC x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 4 < 4==> x' MOD 4 =0 \/ x' MOD 4 = 1\/ x' MOD 4 = 2 \/ x' MOD 4 =3`) +THEN RESA_TAC +THENL[ +PROOF_E_EQ_IMAGE_4 `4`; +PROOF_E_EQ_IMAGE_4 `1`; +PROOF_E_EQ_IMAGE_4 `2`; +PROOF_E_EQ_IMAGE_4 `3`]; +]);; + (* }}} *) + + + + + + +let IN_BALL_ANNULUS_ROW_TAC_4= +fun (th:term)-> +ASM_SIMP_TAC[] +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4`] +THEN MATCH_MP_TAC(SET_RULE` +vv th IN IMAGE vv (:num) /\ IMAGE vv (:num) SUBSET ball_annulus +==> vv th IN ball_annulus`) +THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC th +THEN REWRITE_TAC[SET_RULE`(a:num)IN (:num)`] +;; + + + +let INEQUALITY_PROOF_TAC40= +fun (so:term) (so1:term)-> +ASM_SIMP_TAC[change_type_v3] +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 4 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)`] +THEN REPLICATE_TAC 12 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL_TAC th[so;so1][dist;ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 0 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 0 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0 /\ ~(2=0)/\ ~(3=0)/\ ~(2=3)/\ ~(3=1)/\ ~(1=0)`]);; + + + + +let INEQUALITY_PROOF_TAC4= +fun (th:term)-> +MP_TAC(ARITH_RULE`1<= i /\ i<= 4==> i=1\/ i=2\/ i=3\/ i=4`) +THEN RESA_TAC +THENL[ +INEQUALITY_PROOF_TAC40 `1` th; +INEQUALITY_PROOF_TAC40 `2` th; +INEQUALITY_PROOF_TAC40 `3` th; +INEQUALITY_PROOF_TAC40 `0` th];; + + + + + +let IN_NOT_EMPTY_CASE_4=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (d_tame 4) (cs_adj 4 (&2) (&2 * h0)) (cs_adj 4 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +==> +a IN {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ CONDITION2_SY v }`, + (* {{{ proof *) +[ + +REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;IN_ELIM_THM;CONDITION1_SY;CONDITION2_SY] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;CS_ADJ] +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[IN] +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:real^3^M` +THEN STRIP_TAC; + +STRIP_TAC; + +REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 4)<=> (i=1\/ i=2\/ i=3 \/ i=4)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THENL[ +IN_BALL_ANNULUS_ROW_TAC_4 `1`; +IN_BALL_ANNULUS_ROW_TAC_4 `2`; +IN_BALL_ANNULUS_ROW_TAC_4 `3`; +IN_BALL_ANNULUS_ROW_TAC_4 `0`]; + +STRIP_TAC; + +REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 4)<=> (i=1\/ i=2\/ i=3 \/ i=4)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT DISCH_TAC +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THENL[ +INEQUALITY_PROOF_TAC4 `1`; +INEQUALITY_PROOF_TAC4 `2`; +INEQUALITY_PROOF_TAC4 `3`; +INEQUALITY_PROOF_TAC4 `0`]; + +MP_TAC V_E_FF_CASE_4 +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;CS_ADJ] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN REPEAT RESA_TAC; + +ASM_REWRITE_TAC[]; +]);; + (* }}} *) + + + +let NOT_EMPTY_CASE_4=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (d_tame 4) (cs_adj 4 (&2) (&2 * h0)) (cs_adj 4 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +==> +~({matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ CONDITION2_SY v }={})` +, + (* {{{ proof *) +[ +REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;] +THEN STRIP_TAC +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 0]:real^3^M` +THEN ABBREV_TAC`a=matvec (v:real^3^M) ` +THEN EXISTS_TAC`a:real^(M,3)finite_product` +THEN MATCH_MP_TAC IN_NOT_EMPTY_CASE_4 +THEN ASM_REWRITE_TAC[] +]);; + (* }}} *) + + + + +let TAUSTAR_EQ_TAU_STAR_4=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (d_tame 4) (cs_adj 4 (&2) (&2 * h0)) (cs_adj 4 (&2 * h0) upperbd))=s +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +/\ stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))=s1 +==> taustar_v39 s vv = tau_star s1 a`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN MP_TAC V_E_FF_CASE_4 +THEN RESA_TAC +THEN SUBGOAL_THEN`scs_k_v39 s =4` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;]; + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN ASM_REWRITE_TAC[taustar_v39;tau_star] +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;] +THEN ASM_SIMP_TAC[dsv_J_empty] +THEN MP_TAC SCS_4_IS_TRI_STABLE +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN STRIP_TAC +THEN MRESAL_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s)(scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`][LET_DEF;LET_END_DEF;d_fun] +THEN SUBGOAL_THEN`J1_SY (s1:stable_sy)={}` ASSUME_TAC; + +ASM_REWRITE_TAC[J1_SY;] +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_J_v39_explicit;LET_DEF;LET_END_DEF;mk_unadorned_v39;change_type_v2;SET_RULE`a IN {{i, j} | F}<=> F`] +THEN SET_TAC[]; + +ASM_REWRITE_TAC[SUM_CLAUSES;REAL_ARITH`a* &0= &0 /\a + &0=a`] +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[MATVEC_VECMATS_ID;VECMATS_MATVEC_ID] +THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=>B=C`] +THEN MATCH_MP_TAC dsv_J_empty +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_J_v39_explicit;LET_DEF;LET_END_DEF;mk_unadorned_v39;change_type_v2;SET_RULE`a IN {{i, j} | F}<=> F`] +]);; + (* }}} *) + + + + + + + + + + + + + + + + + + +let VV_IN_BALL_ANNULUS_TAC_4= +fun (so:term)-> +REPLICATE_TAC 8 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL1_TAC th so [ARITH_RULE`1<=1 /\ 1<=2 /\1<=3 /\ 1<= 4/\ 1<=4 /\ 2<=4/\ 3<=4/\ 4<=4/\ ~(1=0)/\ ~(2=0) /\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2) `] ) +;; + + + + + + + +let SCS_A_B__EQ_MOD_4=prove( +`s=(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (d_tame 4) (cs_adj 4 (&2) (&2 * h0)) (cs_adj 4 (&2 * h0) upperbd)) +==> +!i j. scs_a_v39 s i j = scs_a_v39 s (i MOD 4) (j MOD 4)/\ + scs_b_v39 s i j = scs_b_v39 s (i MOD 4) (j MOD 4)`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;CS_ADJ] +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC MOD_MOD_REFL[`j:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`j:num`;`1:num`;`4`][ARITH_RULE`~(4=0) /\ 1 MOD 4=1`;ADD1] +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`1:num`;`4`][ARITH_RULE`~(4=0) /\ 1 MOD 4=1`;ADD1]);; + + + + + +let PROVE_INEQUALITY_TAC_40= +fun (so:term) (so1:term)-> +REPLICATE_TAC 7(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL_TAC th[so;so1][ARITH_RULE`1<=4 /\ 4<=4/\ 1<=1 /\ 1<=4/\ 1<=2 /\ 2<=4/\1<=3 /\ 3<=4`]) +THEN POP_ASSUM( fun th-> +POP_ASSUM( fun th1-> +REPEAT DISCH_TAC +THEN MP_TAC th THEN MP_TAC th1 +THEN POP_ASSUM(fun th2-> ONCE_REWRITE_TAC[th2] +THEN POP_ASSUM(fun th3-> MRESAL1_TAC th3`4`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th3`1`[ARITH_RULE`1 MOD 4=1/\ ~(1=0)`] +THEN MRESAL1_TAC th3`2`[ARITH_RULE`2 MOD 4=2/\ ~(2=0)/\ ~(2=1)`] +THEN MRESAL1_TAC th3`3`[ARITH_RULE`3 MOD 4=3/\ ~(3=0)/\ ~(3=1)/\ ~(3=2)`]) +THEN MRESAL1_TAC th2`4`[ARITH_RULE`4 MOD 4=0`]) +)) +THEN MP_TAC SCS_A_B__EQ_MOD_4 +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`4 MOD 4=0/\ 1 MOD 4=1/\ 2 MOD 4=2 /\ 3 MOD 4=3`] +THEN RESA_TAC +THEN RESA_TAC +;; + + +let PROVE_INEQUALITY_TAC_4= +fun (th:term)-> +MP_TAC(ARITH_RULE`(j MOD 4<4)==> (j MOD 4=0) \/ (j MOD 4=1) \/ (j MOD 4=2)\/ (j MOD 4=3)`) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_40 th `4`; +PROVE_INEQUALITY_TAC_40 th `1`; +PROVE_INEQUALITY_TAC_40 th `2`; +PROVE_INEQUALITY_TAC_40 th `3`];; + + + +let V_SY_EQ_IMAGE_VV_TAC4= +fun (th:term)-> +ASM_REWRITE_TAC[] +THEN EXISTS_TAC th +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ARITH_RULE`1 MOD 4=1 /\ ~(1=0) /\ 2 MOD 4=2 /\ ~(2=0)/\ ~(2=1)/\ 3 MOD 4=3 /\ ~(3=0)/\ ~(3=1)/\ ~(3=2)/\ 4 MOD 4=0`];; + + + +let PROVE_E_SY_EQ_MOD_TAC_4= +fun (th:term)-> +EXISTS_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`~(3=0)/\ ~(3=1)/\ ~(3=2)/\ ~(2=0)/\ ~(2=1)/\ ~(1=0)`] +THEN ARITH_TAC;; + + + +let PROVE_E_SY_EQ_IMAGE_VV_4= +fun (so:term)-> +EXISTS_TAC so +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`x':num`;`1:num`;`4`][ARITH_RULE`~(4=0) /\ 1 MOD 4=1/\ 1<=4/\ 4<=4/\ 0+1=1`;ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`~(1=0)/\ 4 MOD 4=0/\ 0+1=1/\ 1<=1 /\ 1+1=2/\ 2 MOD 4=2/\ ~(2=0)/\ ~(2=1)/\ 2+1=3/\ 3 MOD 4=3 +/\ ~(3=0)/\ ~(3=1)/\ ~(3=2)/\1<=2/\ 2<=4 +/\ 1<=3/\ 3<=4/\ 3+1=4`]) +;; + + + +let PROOF_E_EQ_TAC_4= +fun (th:term)-> +EXISTS_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)/\ 1 MOD 4=1/\ SUC 1=2/\ 2 MOD 4=2/\ ~(2=0)/\ ~(2=1)/\ SUC 2=3 /\ 3 MOD 4=3/\ ~(3=0) /\ ~(3=1)/\ ~(3=2)/\ SUC 3=4/\ 4 MOD 4=0/\ SUC 0=1 /\ SUC 4=5/\ 5 MOD 4=1`;SET_RULE`(a:num) IN (:num)`] +;; + + + +let IN_NOT_EMPTY_B1_SY_4=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (d_tame 4) (cs_adj 4 (&2) (&2 * h0)) (cs_adj 4 (&2 * h0) upperbd))=s/\ + scs_k_v39 s= dimindex(:M)/\ + matvec (v:real^3^M) =a/\ +(!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ + CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ + CONDITION2_SY v +/\ (!i. vv i = +if i MOD scs_k_v39 s = 0 then row 4 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +if i MOD scs_k_v39 s = 2 then row 2 v else +row 3 v) +==> vv IN BBs_v39 s`, + (* {{{ proof *) +[ +REWRITE_TAC[CONDITION1_SY;CONDITION2_SY;change_type_v3] +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`scs_k_v39 s =4` ASSUME_TAC; + + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;]; + +POP_ASSUM (fun th-> +REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th1-> ASSUME_TAC(SYM th1)) +THEN ASSUME_TAC th +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[th;IN] +THEN STRIP_TAC +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;] +THEN STRIP_TAC; + +ASM_REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 4<4 ==> x' MOD 4 = 0 \/ x' MOD 4 = 1 \/ x' MOD 4 = 2 \/ x' MOD 4 = 3`) +THEN RESA_TAC +THENL[ +VV_IN_BALL_ANNULUS_TAC_4 `4`; +VV_IN_BALL_ANNULUS_TAC_4 `1`; +VV_IN_BALL_ANNULUS_TAC_4 `2`; +VV_IN_BALL_ANNULUS_TAC_4 `3`]; + + +STRIP_TAC; + +ASM_REWRITE_TAC[periodic] +THEN GEN_TAC +THEN MRESAL_TAC MOD_EQ[`i+4:num`;`i:num`;`4:num`;`1`][ARITH_RULE`1*A=A`]; + +STRIP_TAC; + +REWRITE_TAC[dist] +THEN REPEAT GEN_TAC +THEN SUBGOAL_THEN`!i. (vv:num->real^3) i= vv (i MOD 4)` ASSUME_TAC; + +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN GEN_TAC +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`4`][ARITH_RULE`~(4=0)`]; + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC DIVISION[`i:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC DIVISION[`j:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`(i MOD 4<4)==> (i MOD 4=0) \/ (i MOD 4=1) \/ (i MOD 4=2)\/ (i MOD 4=3)`) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_4 `4`; +PROVE_INEQUALITY_TAC_4 `1`; +PROVE_INEQUALITY_TAC_4 `2`; +PROVE_INEQUALITY_TAC_4 `3`]; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`~(4<=3)`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`V_SY (v:real^3^M) = IMAGE vv (:num)`ASSUME_TAC; + + +ASM_REWRITE_TAC[V_SY;rows;IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 4)<=> i= 1\/ i=2 \/ i=3 \/ i=4`] +THEN STRIP_TAC +THENL[ +V_SY_EQ_IMAGE_VV_TAC4 `1`; +V_SY_EQ_IMAGE_VV_TAC4 `2`; +V_SY_EQ_IMAGE_VV_TAC4 `3`; +V_SY_EQ_IMAGE_VV_TAC4 `4`]; + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 4<4)==> (x' MOD 4=0) \/ (x' MOD 4=1) \/ (x' MOD 4=2)\/ (x' MOD 4=3)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_MOD_TAC_4 `4`; +PROVE_E_SY_EQ_MOD_TAC_4 `1`; +PROVE_E_SY_EQ_MOD_TAC_4 `2`; +PROVE_E_SY_EQ_MOD_TAC_4 `3`]; + + + + +SUBGOAL_THEN`E_SY (v:real^3^M) = IMAGE (\i. {vv i, vv (SUC i)}) (:num)`ASSUME_TAC; + + +ASM_REWRITE_TAC[E_SY;rows;IMAGE;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 4)<=> i= 1\/ i=2 \/ i=3 \/ i=4`] +THEN RESA_TAC +THENL[ +PROOF_E_EQ_TAC_4`1`; +PROOF_E_EQ_TAC_4`2`; +PROOF_E_EQ_TAC_4`3`; +PROOF_E_EQ_TAC_4`4`]; + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 4<4)==> (x' MOD 4=0) \/ (x' MOD 4=1) \/ (x' MOD 4=2)\/ (x' MOD 4=3)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_IMAGE_VV_4 `4`; +PROVE_E_SY_EQ_IMAGE_VV_4 `1`; +PROVE_E_SY_EQ_IMAGE_VV_4 `2`; +PROVE_E_SY_EQ_IMAGE_VV_4 `3`]; + +SUBGOAL_THEN`F_SY (v:real^3^M) = IMAGE (\i. (vv i, vv (SUC i))) (:num)`ASSUME_TAC; + + +ASM_REWRITE_TAC[F_SY;rows;IMAGE;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 4)<=> i= 1\/ i=2 \/ i=3 \/ i=4`] +THEN RESA_TAC +THENL[ +PROOF_E_EQ_TAC_4`1`; +PROOF_E_EQ_TAC_4`2`; +PROOF_E_EQ_TAC_4`3`; +PROOF_E_EQ_TAC_4`4`]; + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 4<4)==> (x' MOD 4=0) \/ (x' MOD 4=1) \/ (x' MOD 4=2)\/ (x' MOD 4=3)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_IMAGE_VV_4 `4`; +PROVE_E_SY_EQ_IMAGE_VV_4 `1`; +PROVE_E_SY_EQ_IMAGE_VV_4 `2`; +PROVE_E_SY_EQ_IMAGE_VV_4 `3`]; + +POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[]; +]);; + (* }}} *) + + + + + +let XWITCCN_CASE_4=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (d_tame 4) (cs_adj 4 (&2) (&2 * h0)) (cs_adj 4 (&2 * h0) upperbd))=s + /\ vv IN BBs_v39 s /\ + taustar_v39 s vv < &0 +/\ scs_k_v39 s= dimindex(:M) + ==> ~(BBprime_v39 s = {})`, + (* {{{ proof *) +[ +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC SCS_4_IS_TRI_STABLE +THEN RESA_TAC +THEN MP_TAC NOT_EMPTY_CASE_4 +THEN RESA_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`] +THEN ABBREV_TAC`s1 =stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))` +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN SUBGOAL_THEN`scs_k_v39 s =4` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;]; + +POP_ASSUM (fun th-> +REPLICATE_TAC 11 (POP_ASSUM MP_TAC) +THEN REWRITE_TAC[th] +THEN STRIP_TAC +THEN POP_ASSUM(fun th1-> ASSUME_TAC(SYM th1)) +THEN ASSUME_TAC th +THEN REPEAT RESA_TAC) +THEN MRESAL_TAC (GEN_ALL HDPLYGY)[`(scs_k_v39 s)`;`s1:stable_sy`][k_sy;B_SY1;ARITH_RULE`2<4`;] +THEN POP_ASSUM (fun th-> +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN REWRITE_TAC[BBprime_v39;IN] +THEN ABBREV_TAC`( vv1 i = +if i MOD scs_k_v39 s = 0 then row 4 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +if i MOD scs_k_v39 s = 2 then row 2 v else +row 3 (v:real^3^M))` +THEN EXISTS_TAC`vv1:num->real^3` +THEN STRIP_TAC; + +ONCE_REWRITE_TAC[GSYM IN] +THEN MATCH_MP_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_4) +THEN EXISTS_TAC`x:real^(M,3)finite_product` +THEN EXISTS_TAC`v:real^3^M` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; + +SUBGOAL_THEN`vector [ vv1 1; vv1 2; (vv1:num->real^3) 3;vv1 0] = v:real^3^M` +ASSUME_TAC; + +POP_ASSUM(fun th-> REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`1 MOD 4=1/\ 2 MOD 4=2/\ 3 MOD 4=3/\ 0 MOD 4=0 /\ ~(1=0)/\ ~(2=0)/\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2)`;] +THEN ONCE_REWRITE_TAC[CART_EQ] +THEN ASM_REWRITE_TAC[ARITH_RULE`1<=i/\ i<=4 <=>i=1\/ i=2\/ i=3\/ i=4`] +THEN REPEAT RESA_TAC +THEN +ASM_SIMP_TAC[row;vector; LAMBDA_BETA; DIMINDEX_3; LENGTH; ARITH] THEN +REWRITE_TAC[num_CONV `3`;num_CONV `2`; num_CONV `1`; EL; HD; TL;] +THEN ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;row;LAMBDA_BETA]; + +STRIP_TAC; + +GEN_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM IN] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_4) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_4)[`v:real^3^M`;`s:scs_v39`;`vv1:num->real^3`;`s1:stable_sy`;`x:real^(M,3)finite_product`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_4) +[`vector [ww 1; ww 2; ww 3; ww 0]:real^3^M`;`s:scs_v39`;`ww:num->real^3`;`s1:stable_sy`;`matvec(vector [ww 1; ww 2; ww 3; ww 0]:real^3^M):real^(M,3)finite_product`;] +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_CASE_4)[`ww:num->real^3`;`vector [ww 1; ww 2; ww 3; ww 0]:real^3^M`;`matvec(vector [ww 1; ww 2; ww 3; ww 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th `matvec(vector [ww 1; ww 2; ww 3; ww 0]:real^3^M):real^(M,3)finite_product`); + +MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_4) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_4)[`v:real^3^M`;`s:scs_v39`;`vv1:num->real^3`;`s1:stable_sy`;`x:real^(M,3)finite_product`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_4) +[`vector [vv 1; vv 2; vv 3; vv 0]:real^3^M`;`s:scs_v39`;`vv:num->real^3`;`s1:stable_sy`;`matvec(vector [vv 1; vv 2; vv 3; vv 0]:real^3^M):real^(M,3)finite_product`;] +THEN REPLICATE_TAC 23 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_CASE_4)[`vv:num->real^3`;`vector [vv 1; vv 2; vv 3; vv 0]:real^3^M`;`matvec(vector [vv 1; vv 2; vv 3; vv 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th `matvec(vector [vv 1; vv 2; vv 3; vv 0]:real^3^M):real^(M,3)finite_product`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC +]);; + (* }}} *) + + + + + + +let VECTOR_3_5=prove(`!x y z t u. 1<= dimindex(:M)/\ 2<= dimindex(:M) /\ 3<= dimindex(:M)/\ 4<= dimindex(:M) /\ 5<= dimindex(:M) ==> (row 1 (vector[x;y;z:real^3;t;u]:real^3^M)) = x +/\ (row 2 (vector[x;y;z:real^3;t;u]:real^3^M)) = y +/\ (row 3 (vector[x;y;z:real^3;t;u]:real^3^M)) = z +/\ (row 4 (vector[x;y;z:real^3;t;u]:real^3^M)) = t +/\ (row 5 (vector[x;y;z:real^3;t;u]:real^3^M)) = u +`, +REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[row;vector; LAMBDA_BETA; DIMINDEX_3; LENGTH; ARITH] THEN +REWRITE_TAC[num_CONV `4`;num_CONV `3`;num_CONV `2`; num_CONV `1`; EL; HD; TL] +THEN VECTOR_ARITH_TAC);; + + + + + +let EQUALITY_V_SY_TAC_5 = +fun (th:term)-> +ASM_REWRITE_TAC[] +THEN EXISTS_TAC th +THEN MRESAL_TAC VECTOR_3_5[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 5<=5/\ 0 MOD 5= 0 /\ 1 MOD 5= 1 /\ 2 MOD 5= 2/\ 3 MOD 5= 3 /\ 4 MOD 5= 4 /\ 5 MOD 5=0 /\ ~(2=1) +/\ SUC 0 MOD 5= 1 /\ SUC 1 MOD 5= 2 /\ SUC 2 MOD 5= 3/\ SUC 3 MOD 5= 4 +/\ SUC 4 MOD 5= 0 /\ SUC 5 MOD 5 = 1 /\ ~(3=1)/\ ~(1=0)`;SET_RULE`(a:num) IN (:num)`] +;; + + + +let PROVE_V_SY_EQ_5_TAC= +fun (th:term)-> +EXISTS_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= 1 /\ 1<= 5`] +THEN MRESAL_TAC VECTOR_3_5[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 4 MOD 5= 4/\ 5 MOD 5=0 /\ 1 MOD 5= 1 /\ 2 MOD 5= 2/\ 3 MOD 5= 3 /\ ~(2=1) +/\ SUC 4 MOD 5= 0 /\ SUC 1 MOD 5= 2 /\ SUC 2 MOD 5= 3/\ SUC 3 MOD 5= 4/\ ~(3=1)/\ ~(1=0)/\ 5<=5/\ 1<=1 /\ 1<=2 /\ 1<= 3 /\ 1<=4 /\ 1<=5`] +;; + +let PROVE_E_SY_EQ_5_TAC = +fun (th:term)-> +EXISTS_TAC th +THEN MRESAL_TAC VECTOR_3_5[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 4 MOD 5= 4/\ 5 MOD 5=0 /\ 1 MOD 5= 1 /\ 2 MOD 5= 2/\ 3 MOD 5= 3 /\ ~(2=1) +/\ SUC 4 MOD 5= 0 /\ SUC 1 MOD 5= 2 /\ SUC 2 MOD 5= 3/\ SUC 3 MOD 5= 4/\ ~(3=1)/\ ~(1=0)/\ 5<=5/\ 1<=1 /\ 1<=2 /\ 1<= 3 /\ 1<=4 /\ 1<=5 +/\ SUC 1=2 /\ SUC 0 =1/\ SUC 2=3/\ SUC 3=4 `; SET_RULE`(a:num) IN (:num)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`5`;`vv:num-> real^3`][ARITH_RULE`~(5=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`SUC 4`[ARITH_RULE`SUC 4 MOD 5=0/\ SUC 4=5`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +;; + + + +let PROVE_E_SY_EQ_INV_5_TAC= +fun (th:term) -> +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`x':num`;th;`5`][ARITH_RULE`~(5=0)/\ 0 MOD 5=0/\ SUC 0 MOD 5=1 /\ 1 MOD 5=1 /\ 2 MOD 5=2 /\ 3 MOD 5=3/\ 4 MOD 5=4`] +THEN EXISTS_TAC th +THEN MRESAL_TAC VECTOR_3_5[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 4 MOD 5= 4/\ 5 MOD 5=0 /\ 1 MOD 5= 1 /\ 2 MOD 5= 2/\ 3 MOD 5= 3 /\ ~(2=1) +/\ SUC 4 MOD 5= 0 /\ SUC 1 MOD 5= 2 /\ SUC 2 MOD 5= 3/\ SUC 3 MOD 5= 4/\ ~(3=1)/\ ~(1=0)/\ 5<=5/\ 1<=1 /\ 1<=2 /\ 1<= 3 /\ 1<=4 /\ 1<=5 +/\ SUC 1=2 /\ SUC 0 =1/\ SUC 2=3/\ SUC 3=4/\ SUC 4=5 `; SET_RULE`(a:num) IN (:num)`] +;; + + + +let PROVE_E_SY_EQ_INV_5_TAC= +fun (th:term) -> +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`x':num`;th;`5`][ARITH_RULE`~(5=0)/\ 5 MOD 5=0/\ SUC 0 MOD 5=1 /\ 1 MOD 5=1 /\ 2 MOD 5=2 /\ 3 MOD 5=3/\ 4 MOD 5=4`] +THEN EXISTS_TAC th +THEN MRESAL_TAC VECTOR_3_5[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 4 MOD 5= 4/\ 5 MOD 5=0 /\ 1 MOD 5= 1 /\ 2 MOD 5= 2/\ 3 MOD 5= 3 /\ ~(2=1)/\ SUC 5 MOD 5=1 +/\ SUC 4 MOD 5= 0 /\ SUC 1 MOD 5= 2 /\ SUC 2 MOD 5= 3/\ SUC 3 MOD 5= 4/\ ~(3=1)/\ ~(1=0)/\ 5<=5/\ 1<=1 /\ 1<=2 /\ 1<= 3 /\ 1<=4 /\ 1<=5 +/\ SUC 1=2 /\ SUC 0 =1/\ SUC 2=3/\ SUC 3=4/\ SUC 4=5 `; SET_RULE`(a:num) IN (:num)`] +;; + + + + + + + + +let V_E_FF_CASE_5=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (d_tame 5) (cs_adj 5 (&2) (&2 * h0)) (cs_adj 5 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +==> +V_SY (v:real^3^M)=IMAGE vv (:num)/\ + E_SY (v:real^3^M)=IMAGE (\i. {vv i, vv (SUC i)}) (:num)/\ +F_SY (v:real^3^M)=IMAGE (\i. vv i,vv (SUC i)) (:num)`, + (* {{{ proof *) +[ +STRIP_TAC +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39] +THEN REPEAT STRIP_TAC; + +REWRITE_TAC[V_SY;rows] +THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 5)<=> (i=1\/ i=2\/ i=3 \/ i=4\/ i=5)`] THEN ASSUME_TAC (SYM th)) +THEN STRIP_TAC +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +REPEAT STRIP_TAC +THENL[ +EQUALITY_V_SY_TAC_5 `1`; +EQUALITY_V_SY_TAC_5 `2`; +EQUALITY_V_SY_TAC_5 `3`; +EQUALITY_V_SY_TAC_5 `4`; +EQUALITY_V_SY_TAC_5 `0`;]; + +REPEAT STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)<=> (1<= i /\ i<= 5)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`5`;`vv:num-> real^3`][ARITH_RULE`~(5=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 5 < 5 ==> x' MOD 5 =0 \/ x' MOD 5 = 1\/ x' MOD 5 = 2 \/ x' MOD 5 =3 \/ x' MOD 5 =4`) +THEN RESA_TAC +THENL[ +PROVE_V_SY_EQ_5_TAC`5`; +PROVE_V_SY_EQ_5_TAC`1`; +PROVE_V_SY_EQ_5_TAC`2`; +PROVE_V_SY_EQ_5_TAC`3`; +PROVE_V_SY_EQ_5_TAC`4`;]; + +REWRITE_TAC[E_SY;rows] +THEN REPLICATE_TAC 2(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 5)<=> (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THENL[ +PROVE_E_SY_EQ_5_TAC `1`; +PROVE_E_SY_EQ_5_TAC `2`; +PROVE_E_SY_EQ_5_TAC `3`; +PROVE_E_SY_EQ_5_TAC `4`; +PROVE_E_SY_EQ_5_TAC `0`;]; + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)<=> (1<= i /\ i<= 5)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`5`;`vv:num-> real^3`][ARITH_RULE`~(5=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num` THEN MRESA1_TAC th`SUC x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 5 < 5==> x' MOD 5 =0 \/ x' MOD 5 = 1\/ x' MOD 5 = 2 \/ x' MOD 5 =3 \/ x' MOD 5 =4`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_INV_5_TAC `5`; +PROVE_E_SY_EQ_INV_5_TAC `1`; +PROVE_E_SY_EQ_INV_5_TAC `2` ; +PROVE_E_SY_EQ_INV_5_TAC `3` ; +PROVE_E_SY_EQ_INV_5_TAC `4` ;]; + +REWRITE_TAC[F_SY;rows] +THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 5)<=> (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THENL[ +PROVE_E_SY_EQ_5_TAC `1`; +PROVE_E_SY_EQ_5_TAC `2`; +PROVE_E_SY_EQ_5_TAC `3`; +PROVE_E_SY_EQ_5_TAC `4`; +PROVE_E_SY_EQ_5_TAC `0`;]; + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)<=> (1<= i /\ i<= 5)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`5`;`vv:num-> real^3`][ARITH_RULE`~(5=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num` THEN MRESA1_TAC th`SUC x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 5 < 5==> x' MOD 5 =0 \/ x' MOD 5 = 1\/ x' MOD 5 = 2 \/ x' MOD 5 =3 \/ x' MOD 5 =4`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_INV_5_TAC `5`; +PROVE_E_SY_EQ_INV_5_TAC `1`; +PROVE_E_SY_EQ_INV_5_TAC `2` ; +PROVE_E_SY_EQ_INV_5_TAC `3` ; +PROVE_E_SY_EQ_INV_5_TAC `4` ;]; +]);; + (* }}} *) + + + + + + +let IN_BALL_ANNUUS_TAC_5 = +fun (th:term)-> +ASM_SIMP_TAC[] +THEN MRESAL_TAC VECTOR_3_5[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 5<=5`] +THEN MATCH_MP_TAC(SET_RULE` +vv th IN IMAGE vv (:num) /\ IMAGE vv (:num) SUBSET ball_annulus +==> vv th IN ball_annulus`) +THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC th +THEN REWRITE_TAC[SET_RULE`(a:num) IN(:num)`] +;; + + + +let INEQUALITY_A_B_TAC_50 = +fun (so:term) (so1:term)-> +ASM_SIMP_TAC[change_type_v3] +THEN MRESAL_TAC VECTOR_3_5[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 5<=5/\ 0 MOD 5= 0 /\ 1 MOD 5= 1 /\ 2 MOD 5= 2/\ 3 MOD 5= 3 /\ 4 MOD 5= 4 /\ 5 MOD 5=0 /\ ~(2=1) +/\ SUC 0 MOD 5= 1 /\ SUC 1 MOD 5= 2 /\ SUC 2 MOD 5= 3/\ SUC 3 MOD 5= 4 +/\ SUC 4 MOD 5= 0 /\ SUC 5 MOD 5 = 1 /\ ~(3=1)/\ ~(1=0)`] +THEN REPLICATE_TAC 13 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL_TAC th[so;so1][dist;ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 0 MOD 5= 0 /\ 1 MOD 5= 1 /\ 2 MOD 5= 2/\ 3 MOD 5= 3 /\ 4 MOD 5= 4 /\ 5 MOD 5=0 /\ ~(2=1) +/\ SUC 0 MOD 5= 1 /\ SUC 1 MOD 5= 2 /\ SUC 2 MOD 5= 3/\ SUC 3 MOD 5= 4 +/\ SUC 4 MOD 5= 0 /\ SUC 5 MOD 5 = 1 /\ ~(3=1)/\ ~(1=0) /\ ~(1=4)/\ ~(2=3) /\ ~(2=0) /\ ~(3=0)/\ ~(0=4)/\ ~(2=4) +/\ ~(3=4)`]);; + + +let INEQUALITY_A_B_TAC_5 = +fun (th:term)-> +MP_TAC(ARITH_RULE`1<= i /\ i<= 5==> i=1\/ i=2\/ i=3\/ i=4 \/ i=5`) +THEN RESA_TAC +THENL[ +INEQUALITY_A_B_TAC_50 `1` th; +INEQUALITY_A_B_TAC_50 `2` th; +INEQUALITY_A_B_TAC_50 `3` th; +INEQUALITY_A_B_TAC_50 `4` th; +INEQUALITY_A_B_TAC_50 `0` th;];; + + + + + +let IN_NOT_EMPTY_CASE_5=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (d_tame 5) (cs_adj 5 (&2) (&2 * h0)) (cs_adj 5 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +==> +a IN {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ CONDITION2_SY v }`, + (* {{{ proof *) +[ +REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;IN_ELIM_THM;CONDITION1_SY;CONDITION2_SY] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`~(5<=3)`;mk_unadorned_v39;CS_ADJ] +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[IN] +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:real^3^M` +THEN STRIP_TAC; + +STRIP_TAC; + +REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 5)<=> (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THENL[ +IN_BALL_ANNUUS_TAC_5 `(1:num)`; +IN_BALL_ANNUUS_TAC_5 `(2:num)`; +IN_BALL_ANNUUS_TAC_5 `(3:num)`; +IN_BALL_ANNUUS_TAC_5 `(4:num)`; +IN_BALL_ANNUUS_TAC_5 `(0:num)`;]; + +STRIP_TAC; + +REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 5)<=> (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT DISCH_TAC +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THENL[ +INEQUALITY_A_B_TAC_5 `1`; +INEQUALITY_A_B_TAC_5 `2`; +INEQUALITY_A_B_TAC_5 `3`; +INEQUALITY_A_B_TAC_5 `4`; +INEQUALITY_A_B_TAC_5 `0`; ]; + +MP_TAC V_E_FF_CASE_5 +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;CS_ADJ] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN REPEAT RESA_TAC; + +ASM_REWRITE_TAC[] +]);; + (* }}} *) + + + +let NOT_EMPTY_CASE_5=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (d_tame 5) (cs_adj 5 (&2) (&2 * h0)) (cs_adj 5 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +==> +~({matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ CONDITION2_SY v }={})` +, + (* {{{ proof *) +[ +REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;] +THEN STRIP_TAC +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 0]:real^3^M` +THEN ABBREV_TAC`a=matvec (v:real^3^M) ` +THEN EXISTS_TAC`a:real^(M,3)finite_product` +THEN MATCH_MP_TAC IN_NOT_EMPTY_CASE_5 +THEN ASM_REWRITE_TAC[] +]);; + (* }}} *) + + + + + + + + + + + + +let TAUSTAR_EQ_TAU_STAR_5=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (d_tame 5) (cs_adj 5 (&2) (&2 * h0)) (cs_adj 5 (&2 * h0) upperbd))=s +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +/\ stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))=s1 +==> taustar_v39 s vv = tau_star s1 a`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN MP_TAC V_E_FF_CASE_5 +THEN RESA_TAC +THEN SUBGOAL_THEN`scs_k_v39 s =5` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39;]; + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN ASM_REWRITE_TAC[taustar_v39;tau_star] +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39;] +THEN ASM_SIMP_TAC[dsv_J_empty] +THEN MP_TAC SCS_5_IS_TRI_STABLE +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN STRIP_TAC +THEN MRESAL_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`][LET_DEF;LET_END_DEF;d_fun] +THEN SUBGOAL_THEN`J1_SY (s1:stable_sy)={}` ASSUME_TAC; + +ASM_REWRITE_TAC[J1_SY;] +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_J_v39_explicit;LET_DEF;LET_END_DEF;mk_unadorned_v39;change_type_v2;SET_RULE`a IN {{i, j} | F}<=> F`] +THEN SET_TAC[]; + +ASM_REWRITE_TAC[SUM_CLAUSES;REAL_ARITH`a* &0= &0 /\a + &0=a`] +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[MATVEC_VECMATS_ID;VECMATS_MATVEC_ID] +THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=>B=C`] +THEN MATCH_MP_TAC dsv_J_empty +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_J_v39_explicit;LET_DEF;LET_END_DEF;mk_unadorned_v39;change_type_v2;SET_RULE`a IN {{i, j} | F}<=> F`] +]);; + (* }}} *) + + + + +let SCS_A_B__EQ_MOD_5=prove( +`s=(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (d_tame 5) (cs_adj 5 (&2) (&2 * h0)) (cs_adj 5 (&2 * h0) upperbd)) +==> +!i j. scs_a_v39 s i j = scs_a_v39 s (i MOD 5) (j MOD 5)/\ + scs_b_v39 s i j = scs_b_v39 s (i MOD 5) (j MOD 5)`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39;CS_ADJ] +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`5`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC MOD_MOD_REFL[`j:num`;`5`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`j:num`;`1:num`;`5`][ARITH_RULE`~(5=0) /\ 1 MOD 5=1`;ADD1] +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`1:num`;`5`][ARITH_RULE`~(5=0) /\ 1 MOD 5=1`;ADD1]);; + + + +let VV_IN_BALL_ANNULUS_TAC_5= +fun (so:term)-> +REPLICATE_TAC 8 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL1_TAC th so [ARITH_RULE`1<=1 /\ 1<=2 /\1<=3 /\ 1<= 4/\ 1<=5 /\ 2<=5/\ 3<=5/\ 4<=5/\ 5<=5/\ ~(1=0)/\ ~(2=0) /\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2)/\ ~(4=0) /\ ~(4=1)/\ ~(4=2)/\ ~(4=3)`] ) +;; + + +let PROVE_INEQUALITY_TAC_50= +fun (so:term) (so1:term)-> +REPLICATE_TAC 7(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL_TAC th[so;so1][ARITH_RULE`1<=5 /\ 5<=5/\ 1<=1 /\ 1<=5/\ 1<=2 /\ 2<=5/\1<=3 /\ 3<=5/\ 1<=4/\ 4<=5`]) +THEN POP_ASSUM( fun th-> +POP_ASSUM( fun th1-> +REPEAT DISCH_TAC +THEN MP_TAC th THEN MP_TAC th1 +THEN POP_ASSUM(fun th2-> ONCE_REWRITE_TAC[th2] +THEN POP_ASSUM(fun th3-> MRESAL1_TAC th3`5`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th3`1`[ARITH_RULE`1 MOD 5=1/\ ~(1=0)`] +THEN MRESAL1_TAC th3`2`[ARITH_RULE`2 MOD 5=2/\ ~(2=0)/\ ~(2=1)`] +THEN MRESAL1_TAC th3`3`[ARITH_RULE`3 MOD 5=3/\ ~(3=0)/\ ~(3=1)/\ ~(3=2)`] +THEN MRESAL1_TAC th3`4`[ARITH_RULE`4 MOD 5=4/\ ~(4=0)/\ ~(4=1)/\ ~(4=2)/\ ~(4=3)`]) +THEN MRESAL1_TAC th2`5`[ARITH_RULE`5 MOD 5=0`]) +)) +THEN MP_TAC SCS_A_B__EQ_MOD_5 +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`5 MOD 5=0/\ 1 MOD 5=1/\ 2 MOD 5=2 /\ 3 MOD 5=3 /\ 4 MOD 5=4`] +THEN RESA_TAC +THEN RESA_TAC +;; + + + + +let PROVE_INEQUALITY_TAC_5= +fun (th:term)-> +MP_TAC(ARITH_RULE`(j MOD 5<5)==> (j MOD 5=0) \/ (j MOD 5=1) \/ (j MOD 5=2)\/ (j MOD 5=3)\/ (j MOD 5=4) `) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_50 th `5`; +PROVE_INEQUALITY_TAC_50 th `1`; +PROVE_INEQUALITY_TAC_50 th `2`; +PROVE_INEQUALITY_TAC_50 th `3`; +PROVE_INEQUALITY_TAC_50 th `4`];; + + + + +let V_SY_EQ_IMAGE_VV_TAC5= +fun (th:term)-> +ASM_REWRITE_TAC[] +THEN EXISTS_TAC th +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ARITH_RULE`1 MOD 5=1 /\ ~(1=0) /\ 2 MOD 5=2 /\ ~(2=0)/\ ~(2=1)/\ 3 MOD 5=3 /\ ~(3=0)/\ ~(3=1)/\ ~(3=2)/\ 4 MOD 5=4/\ 5 MOD 5=0/\ ~(4=0)/\ ~(4=1)/\ ~(4=2)/\ ~(4=3)`];; + + + + + +let PROVE_E_SY_EQ_MOD_TAC_5= +fun (th:term)-> +EXISTS_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`~(3=0)/\ ~(3=1)/\ ~(3=2)/\ ~(2=0)/\ ~(2=1)/\ ~(1=0)/\ ~(4=0) /\ ~(4=1) /\ ~(4=2) /\ ~(4=3) `] +THEN ARITH_TAC;; + + + + + + + +let PROOF_E_EQ_TAC_5= +fun (th:term)-> +EXISTS_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)/\ 1 MOD 5=1/\ SUC 1=2/\ 2 MOD 5=2/\ ~(2=0)/\ ~(2=1)/\ SUC 2=3 /\ 3 MOD 5=3/\ ~(3=0) /\ ~(3=1)/\ ~(3=2)/\ SUC 3=4 +/\ ~(4=0) /\ ~(4=1) /\ ~(4=2) /\ ~(4=3) /\ 4 MOD 5=4/\ 5 MOD 5=0/\ SUC 0=1 +/\ SUC 5=6/\ SUC 4=5/\ 6 MOD 5=1`;SET_RULE`(a:num) IN (:num)`] +;; + + +let PROVE_E_SY_EQ_IMAGE_VV_5= +fun (so:term)-> +EXISTS_TAC so +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`x':num`;`1:num`;`5`][ARITH_RULE`~(5=0) /\ 1 MOD 5=1/\ 1<=5/\ 5<=5/\ 0+1=1`;ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`~(1=0)/\ 4 MOD 5=4/\ 5 MOD 5=0 /\ 0+1=1/\ 1<=1 /\ 1+1=2/\ 2 MOD 5=2/\ ~(2=0)/\ ~(2=1)/\ 2+1=3/\ 3 MOD 5=3 +/\ ~(3=0)/\ ~(3=1)/\ ~(3=2)/\1<=2/\ 2<=5 /\ 3<=5 /\ 4<=5/\ 1<=4/\ 4+1=5 +/\ 1<=3/\ 3<=4/\ 3+1=4/\ ~(4=0) /\ ~(4=1) /\ ~(4=2) /\ ~(4=3)`]) +;; + + + + + + + +let IN_NOT_EMPTY_B1_SY_5=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (d_tame 5) (cs_adj 5 (&2) (&2 * h0)) (cs_adj 5 (&2 * h0) upperbd))=s/\ + scs_k_v39 s= dimindex(:M)/\ + matvec (v:real^3^M) =a/\ +(!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ + CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ + CONDITION2_SY v +/\ (!i. vv i = +if i MOD scs_k_v39 s = 0 then row 5 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +if i MOD scs_k_v39 s = 2 then row 2 v else +if i MOD scs_k_v39 s = 3 then row 3 v else +row 4 v) +==> vv IN BBs_v39 s`, + (* {{{ proof *) +[ +REWRITE_TAC[CONDITION1_SY;CONDITION2_SY;change_type_v3] +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`scs_k_v39 s =5` ASSUME_TAC; + + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39;]; + +POP_ASSUM (fun th-> +REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th1-> ASSUME_TAC(SYM th1)) +THEN ASSUME_TAC th +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[th;IN] +THEN STRIP_TAC +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39;] +THEN STRIP_TAC; + +ASM_REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 5<5 ==> x' MOD 5 = 0 \/ x' MOD 5 = 1 \/ x' MOD 5 = 2 \/ x' MOD 5 = 3\/ x' MOD 5 = 4`) +THEN RESA_TAC +THENL[ +VV_IN_BALL_ANNULUS_TAC_5 `5`; +VV_IN_BALL_ANNULUS_TAC_5 `1`; +VV_IN_BALL_ANNULUS_TAC_5 `2`; +VV_IN_BALL_ANNULUS_TAC_5 `3`; +VV_IN_BALL_ANNULUS_TAC_5 `4`]; + + + +STRIP_TAC; + +ASM_REWRITE_TAC[periodic] +THEN GEN_TAC +THEN MRESAL_TAC MOD_EQ[`i+5:num`;`i:num`;`5:num`;`1`][ARITH_RULE`1*A=A`]; + +STRIP_TAC; + +REWRITE_TAC[dist] +THEN REPEAT GEN_TAC +THEN SUBGOAL_THEN`!i. (vv:num->real^3) i= vv (i MOD 5)` ASSUME_TAC; + +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN GEN_TAC +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`5`][ARITH_RULE`~(5=0)`]; + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC DIVISION[`i:num`;`5`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC DIVISION[`j:num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`(i MOD 5<5)==> (i MOD 5=0) \/ (i MOD 5=1) \/ (i MOD 5=2)\/ (i MOD 5=3) \/ (i MOD 5=4)`) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_5 `5`; +PROVE_INEQUALITY_TAC_5 `1`; +PROVE_INEQUALITY_TAC_5 `2`; +PROVE_INEQUALITY_TAC_5 `3`; +PROVE_INEQUALITY_TAC_5 `4`]; + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`~(5<=3)`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`V_SY (v:real^3^M) = IMAGE vv (:num)`ASSUME_TAC; + + +ASM_REWRITE_TAC[V_SY;rows;IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 5)<=> i= 1\/ i=2 \/ i=3 \/ i=4\/ i=5`] +THEN STRIP_TAC +THENL[ +V_SY_EQ_IMAGE_VV_TAC5 `1`; +V_SY_EQ_IMAGE_VV_TAC5 `2`; +V_SY_EQ_IMAGE_VV_TAC5 `3`; +V_SY_EQ_IMAGE_VV_TAC5 `4`; +V_SY_EQ_IMAGE_VV_TAC5 `5`]; + + + + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 5<5)==> (x' MOD 5=0) \/ (x' MOD 5=1) \/ (x' MOD 5=2)\/ (x' MOD 5=3)\/ (x' MOD 5=4)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_MOD_TAC_5 `5`; +PROVE_E_SY_EQ_MOD_TAC_5 `1`; +PROVE_E_SY_EQ_MOD_TAC_5 `2`; +PROVE_E_SY_EQ_MOD_TAC_5 `3`; +PROVE_E_SY_EQ_MOD_TAC_5 `4`]; + + + +SUBGOAL_THEN`E_SY (v:real^3^M) = IMAGE (\i. {vv i, vv (SUC i)}) (:num)`ASSUME_TAC; + + + +ASM_REWRITE_TAC[E_SY;rows;IMAGE;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 5)<=> i= 1\/ i=2 \/ i=3 \/ i=4\/ i=5`] +THEN RESA_TAC +THENL[ +PROOF_E_EQ_TAC_5`1`; +PROOF_E_EQ_TAC_5`2`; +PROOF_E_EQ_TAC_5`3`; +PROOF_E_EQ_TAC_5`4`; +PROOF_E_EQ_TAC_5`5`]; + + + + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 5<5)==> (x' MOD 5=0) \/ (x' MOD 5=1) \/ (x' MOD 5=2)\/ (x' MOD 5=3) \/ (x' MOD 5=4)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_IMAGE_VV_5 `5`; +PROVE_E_SY_EQ_IMAGE_VV_5 `1`; +PROVE_E_SY_EQ_IMAGE_VV_5 `2`; +PROVE_E_SY_EQ_IMAGE_VV_5 `3`; +PROVE_E_SY_EQ_IMAGE_VV_5 `4`]; + + + + +SUBGOAL_THEN`F_SY (v:real^3^M) = IMAGE (\i. (vv i, vv (SUC i))) (:num)`ASSUME_TAC; + + + +ASM_REWRITE_TAC[F_SY;rows;IMAGE;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 5)<=> i= 1\/ i=2 \/ i=3 \/ i=4\/ i=5`] +THEN RESA_TAC +THENL[ +PROOF_E_EQ_TAC_5`1`; +PROOF_E_EQ_TAC_5`2`; +PROOF_E_EQ_TAC_5`3`; +PROOF_E_EQ_TAC_5`4`; +PROOF_E_EQ_TAC_5`5`]; + + + + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 5<5)==> (x' MOD 5=0) \/ (x' MOD 5=1) \/ (x' MOD 5=2)\/ (x' MOD 5=3) \/ (x' MOD 5=4)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_IMAGE_VV_5 `5`; +PROVE_E_SY_EQ_IMAGE_VV_5 `1`; +PROVE_E_SY_EQ_IMAGE_VV_5 `2`; +PROVE_E_SY_EQ_IMAGE_VV_5 `3`; +PROVE_E_SY_EQ_IMAGE_VV_5 `4`]; + +POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[]; +]);; + (* }}} *) + + + + +let XWITCCN_CASE_5=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (d_tame 5) (cs_adj 5 (&2) (&2 * h0)) (cs_adj 5 (&2 * h0) upperbd))=s + /\ vv IN BBs_v39 s /\ + taustar_v39 s vv < &0 +/\ scs_k_v39 s= dimindex(:M) + ==> ~(BBprime_v39 s = {})`, + (* {{{ proof *) +[ +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC SCS_5_IS_TRI_STABLE +THEN RESA_TAC +THEN MP_TAC NOT_EMPTY_CASE_5 +THEN RESA_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`] +THEN ABBREV_TAC`s1 =stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))` +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN SUBGOAL_THEN`scs_k_v39 s =5` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39;]; + +POP_ASSUM (fun th-> +REPLICATE_TAC 11 (POP_ASSUM MP_TAC) +THEN REWRITE_TAC[th] +THEN STRIP_TAC +THEN POP_ASSUM(fun th1-> ASSUME_TAC(SYM th1)) +THEN ASSUME_TAC th +THEN REPEAT RESA_TAC) +THEN MRESAL_TAC (GEN_ALL HDPLYGY)[`(scs_k_v39 s)`;`s1:stable_sy`][k_sy;B_SY1;ARITH_RULE`2<5`;] +THEN POP_ASSUM (fun th-> +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN REWRITE_TAC[BBprime_v39;IN] +THEN ABBREV_TAC`( vv1 i = +if i MOD scs_k_v39 s = 0 then row 5 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +if i MOD scs_k_v39 s = 2 then row 2 v else +if i MOD scs_k_v39 s = 3 then row 3 v else +row 4 (v:real^3^M))` +THEN EXISTS_TAC`vv1:num->real^3` +THEN STRIP_TAC; + +ONCE_REWRITE_TAC[GSYM IN] +THEN MATCH_MP_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_5) +THEN EXISTS_TAC`x:real^(M,3)finite_product` +THEN EXISTS_TAC`v:real^3^M` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; + +SUBGOAL_THEN`vector [ vv1 1; vv1 2; (vv1:num->real^3) 3;vv1 4;vv1 0] = v:real^3^M` +ASSUME_TAC; + +POP_ASSUM(fun th-> REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`1 MOD 5=1/\ 2 MOD 5=2/\ 3 MOD 5=3/\ 0 MOD 5=0 /\ ~(1=0)/\ ~(2=0)/\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2) /\ ~(4=0) /\ ~(4=1) /\ ~(4=2) /\ ~(4=3)/\ 4 MOD 5=4`;] +THEN ONCE_REWRITE_TAC[CART_EQ] +THEN ASM_REWRITE_TAC[ARITH_RULE`1<=i/\ i<=5 <=>i=1\/ i=2\/ i=3\/ i=4\/ i=5`] +THEN REPEAT RESA_TAC +THEN +ASM_SIMP_TAC[row;vector; LAMBDA_BETA; DIMINDEX_3; LENGTH; ARITH] THEN +REWRITE_TAC[num_CONV `4`;num_CONV `3`;num_CONV `2`; num_CONV `1`; EL; HD; TL;] +THEN ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;row;LAMBDA_BETA]; + +STRIP_TAC; + +GEN_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM IN] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_5) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_5)[`v:real^3^M`;`s:scs_v39`;`vv1:num->real^3`;`s1:stable_sy`;`x:real^(M,3)finite_product`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_5) +[`vector [ww 1; ww 2; ww 3; ww 4; ww 0]:real^3^M`;`s:scs_v39`;`ww:num->real^3`;`s1:stable_sy`;`matvec(vector [ww 1; ww 2; ww 3; ww 4; ww 0]:real^3^M):real^(M,3)finite_product`;] +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_CASE_5)[`ww:num->real^3`;`vector [ww 1; ww 2; ww 3; ww 4; ww 0]:real^3^M`;`matvec(vector [ww 1; ww 2; ww 3; ww 4;ww 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th `matvec(vector [ww 1; ww 2; ww 3; ww 4;ww 0]:real^3^M):real^(M,3)finite_product`); + +MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_5) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_5)[`v:real^3^M`;`s:scs_v39`;`vv1:num->real^3`;`s1:stable_sy`;`x:real^(M,3)finite_product`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_5) +[`vector [vv 1; vv 2; vv 3; vv 4;vv 0]:real^3^M`;`s:scs_v39`;`vv:num->real^3`;`s1:stable_sy`;`matvec(vector [vv 1; vv 2; vv 3; vv 4; vv 0]:real^3^M):real^(M,3)finite_product`;] +THEN REPLICATE_TAC 23 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_CASE_5)[`vv:num->real^3`;`vector [vv 1; vv 2; vv 3; vv 4; vv 0]:real^3^M`;`matvec(vector [vv 1; vv 2; vv 3; vv 4; vv 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th `matvec(vector [vv 1; vv 2; vv 3; vv 4; vv 0]:real^3^M):real^(M,3)finite_product`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +]);; + (* }}} *) + + + + + + + + + +let VECTOR_3_6=prove(`!x y z t u v. 1<= dimindex(:M)/\ 2<= dimindex(:M) /\ 3<= dimindex(:M)/\ 4<= dimindex(:M) /\ 5<= dimindex(:M) /\ 6<= dimindex(:M) ==> (row 1 (vector[x;y;z:real^3;t;u;v]:real^3^M)) = x +/\ (row 2 (vector[x;y;z:real^3;t;u;v]:real^3^M)) = y +/\ (row 3 (vector[x;y;z:real^3;t;u;v]:real^3^M)) = z +/\ (row 4 (vector[x;y;z:real^3;t;u;v]:real^3^M)) = t +/\ (row 5 (vector[x;y;z:real^3;t;u;v]:real^3^M)) = u +/\ (row 6 (vector[x;y;z:real^3;t;u;v]:real^3^M)) = v +`, +REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[row;vector; LAMBDA_BETA; DIMINDEX_3; LENGTH; ARITH] THEN +REWRITE_TAC[num_CONV `5`;num_CONV `4`;num_CONV `3`;num_CONV `2`; num_CONV `1`; EL; HD; TL] +THEN VECTOR_ARITH_TAC);; + + + +let IN_BALL_ANNUUS_TAC_6 = +fun (th:term)-> +ASM_SIMP_TAC[] +THEN MRESAL_TAC VECTOR_3_6[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 5`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=6/\ 2<=6/\ 3<=6/\ 4<=6/\ 5<=6/\6<=6`] +THEN MATCH_MP_TAC(SET_RULE` +vv th IN IMAGE vv (:num) /\ IMAGE vv (:num) SUBSET ball_annulus +==> vv th IN ball_annulus`) +THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC th +THEN REWRITE_TAC[SET_RULE`(a:num) IN(:num)`] +;; + + +let INEQUALITY_A_B_TAC_60 = +fun (so:term) (so1:term)-> +ASM_SIMP_TAC[change_type_v3] +THEN MRESAL_TAC VECTOR_3_6[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 5`;`(vv:num->real^3) 0`][ARITH_RULE`1<=6/\ 2<=6/\ 3<=6/\ 4<=6/\ 5<=6 /\ 6<=6 /\ 0 MOD 6= 0 /\ 1 MOD 6= 1 /\ 2 MOD 6= 2/\ 3 MOD 6= 3 /\ 4 MOD 6= 4 /\ 5 MOD 6=5 /\ 6 MOD 6=0 /\ ~(2=1) +/\ SUC 0 MOD 6= 1 /\ SUC 1 MOD 6= 2 /\ SUC 2 MOD 6= 3/\ SUC 3 MOD 6= 4 +/\ SUC 4 MOD 6= 5 /\ SUC 5 MOD 6 = 0 /\ SUC 6 MOD 6 =1 /\ ~(3=1)/\ ~(1=0)`] +THEN REPLICATE_TAC 14 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL_TAC th[so;so1][dist;ARITH_RULE`1<=6/\ 2<=6/\ 3<=6/\ 4<=6/\ 5<=6 /\ 6<=6 /\ 0 MOD 6= 0 /\ 1 MOD 6= 1 /\ 2 MOD 6= 2/\ 3 MOD 6= 3 /\ 4 MOD 6= 4 /\ 5 MOD 6=5 /\ 6 MOD 6=0 /\ ~(2=1) +/\ SUC 0 MOD 6= 1 /\ SUC 1 MOD 6= 2 /\ SUC 2 MOD 6= 3/\ SUC 3 MOD 6= 4 +/\ SUC 4 MOD 6= 5 /\ SUC 5 MOD 6 = 0 /\ SUC 6 MOD 6 =1 /\ ~(3=1)/\ ~(1=0) /\ ~(1=4)/\ ~(2=3) /\ ~(2=0) /\ ~(3=0)/\ ~(0=4)/\ ~(2=4) +/\ ~(3=4)/\ ~(1=5)/\ ~(2=5)/\ ~(3=5)/\ ~(4=5)/\ ~(0=5)`]);; + + +let INEQUALITY_A_B_TAC_6 = +fun (th:term)-> +MP_TAC(ARITH_RULE`1<= i /\ i<= 6==> i=1\/ i=2\/ i=3\/ i=4 \/ i=5 \/ i=6`) +THEN RESA_TAC +THENL[ +INEQUALITY_A_B_TAC_60 `1` th; +INEQUALITY_A_B_TAC_60 `2` th; +INEQUALITY_A_B_TAC_60 `3` th; +INEQUALITY_A_B_TAC_60 `4` th; +INEQUALITY_A_B_TAC_60 `5` th; +INEQUALITY_A_B_TAC_60 `0` th;];; + + +let EQUALITY_V_SY_TAC_6 = +fun (th:term)-> +ASM_REWRITE_TAC[] +THEN EXISTS_TAC th +THEN MRESAL_TAC VECTOR_3_6[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 5`;`(vv:num->real^3) 0`][ARITH_RULE`1<=6/\ 2<=6/\ 3<=6/\ 4<=6/\ 5<=6 /\ 6<=6 /\ 0 MOD 6= 0 /\ 1 MOD 6= 1 /\ 2 MOD 6= 2/\ 3 MOD 6= 3 /\ 4 MOD 6= 4 /\ 5 MOD 6=5 /\ 6 MOD 6=0 /\ ~(2=1) +/\ SUC 0 MOD 6= 1 /\ SUC 1 MOD 6= 2 /\ SUC 2 MOD 6= 3/\ SUC 3 MOD 6= 4 +/\ SUC 4 MOD 6= 5 /\ SUC 5 MOD 6 = 0 /\ SUC 6 MOD 6 =1 /\ ~(3=1)/\ ~(1=0)`;SET_RULE`(a:num) IN (:num)`] +;; + + + +let PROVE_V_SY_EQ_6_TAC= +fun (th:term)-> +EXISTS_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= 1 /\ 1<= 5`] +THEN MRESAL_TAC VECTOR_3_6[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 5`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=6/\ 2<=6/\ 3<=6/\ 4<=6/\ 5<=6 /\ 6<=6 /\ 0 MOD 6= 0 /\ 1 MOD 6= 1 /\ 2 MOD 6= 2/\ 3 MOD 6= 3 /\ 4 MOD 6= 4 /\ 5 MOD 6=5 /\ 6 MOD 6=0 /\ ~(2=1) +/\ SUC 0 MOD 6= 1 /\ SUC 1 MOD 6= 2 /\ SUC 2 MOD 6= 3/\ SUC 3 MOD 6= 4 +/\ SUC 4 MOD 6= 5 /\ SUC 5 MOD 6 = 0 /\ SUC 6 MOD 6 =1 /\ ~(3=1)/\ ~(1=0)`;SET_RULE`(a:num) IN (:num)`] +THEN ARITH_TAC +;; + +let PROVE_E_SY_EQ_6_TAC = +fun (th:term)-> +EXISTS_TAC th +THEN MRESAL_TAC VECTOR_3_6[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 5`;`(vv:num->real^3) 0`][ARITH_RULE`1<=6/\ 2<=6/\ 3<=6/\ 4<=6/\ 5<=6 /\ 6<=6 /\ 0 MOD 6= 0 /\ 1 MOD 6= 1 /\ 2 MOD 6= 2/\ 3 MOD 6= 3 /\ 4 MOD 6= 4 /\ 5 MOD 6=5 /\ 6 MOD 6=0 /\ ~(2=1) +/\ SUC 0 MOD 6= 1 /\ SUC 1 MOD 6= 2 /\ SUC 2 MOD 6= 3/\ SUC 3 MOD 6= 4 +/\ SUC 4 MOD 6= 5 /\ SUC 5 MOD 6 = 0 /\ SUC 6 MOD 6 =1 /\ ~(3=1)/\ ~(3=1)/\ ~(1=0)/\ 5<=5/\ 1<=1 /\ 1<=2 /\ 1<= 3 /\ 1<=4 /\ 1<=5 +/\ SUC 1=2 /\ SUC 0 =1/\ SUC 2=3/\ SUC 3=4 /\ SUC 4=5 `; SET_RULE`(a:num) IN (:num)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`6`;`vv:num-> real^3`][ARITH_RULE`~(6=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`SUC 5`[ARITH_RULE`SUC 5 MOD 6=0/\ SUC 5=6`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +;; + + + +let PROVE_E_SY_EQ_INV_6_TAC= +fun (th:term) -> +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`x':num`;th;`6`][ARITH_RULE`~(6=0)/\ 0 MOD 6=0/\ SUC 0 MOD 6=1 /\ 1 MOD 6=1 /\ 2 MOD 6=2 /\ 3 MOD 6=3/\ 4 MOD 6=4 /\ 5 MOD 6=5/\ 6 MOD 6=0 `] +THEN EXISTS_TAC th +THEN MRESAL_TAC VECTOR_3_6[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 5`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=6/\ 2<=6/\ 3<=6/\ 4<=6/\ 5<=6 /\ 6<=6 /\ 0 MOD 6= 0 /\ 1 MOD 6= 1 /\ 2 MOD 6= 2/\ 3 MOD 6= 3 /\ 4 MOD 6= 4 /\ 5 MOD 6=5 /\ 6 MOD 6=0 /\ ~(2=1) +/\ SUC 0 MOD 6= 1 /\ SUC 1 MOD 6= 2 /\ SUC 2 MOD 6= 3/\ SUC 3 MOD 6= 4 +/\ SUC 4 MOD 6= 5 /\ SUC 5 MOD 6 = 0 /\ SUC 6 MOD 6 =1 /\ ~(3=1)/\ ~(3=1)/\ ~(1=0)/\ 5<=5/\ 1<=1 /\ 1<=2 /\ 1<= 3 /\ 1<=4 /\ 1<=5 +/\ SUC 1=2 /\ SUC 0 =1/\ SUC 2=3/\ SUC 3=4 /\ SUC 4=5 /\ SUC 5=6`; SET_RULE`(a:num) IN (:num)`] +;; + + + + +let V_E_FF_CASE_6=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (&2 * h0)) (cs_adj 6 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 5;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +==> +V_SY (v:real^3^M)=IMAGE vv (:num)/\ + E_SY (v:real^3^M)=IMAGE (\i. {vv i, vv (SUC i)}) (:num)/\ +F_SY (v:real^3^M)=IMAGE (\i. vv i,vv (SUC i)) (:num)`, + (* {{{ proof *) +[ + +STRIP_TAC +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(6<=3)`;IN;mk_unadorned_v39] +THEN REPEAT STRIP_TAC; + +REWRITE_TAC[V_SY;rows] +THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 6)<=> (i=1\/ i=2\/ i=3 \/ i=4\/ i=5 \/ i=6)`] THEN ASSUME_TAC (SYM th)) +THEN STRIP_TAC +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +REPEAT STRIP_TAC +THENL[ +EQUALITY_V_SY_TAC_6 `1`; +EQUALITY_V_SY_TAC_6 `2`; +EQUALITY_V_SY_TAC_6 `3`; +EQUALITY_V_SY_TAC_6 `4`; +EQUALITY_V_SY_TAC_6 `5`; +EQUALITY_V_SY_TAC_6 `0`;]; + + + +REPEAT STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5 \/ i=6)<=> (1<= i /\ i<= 6)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`6`;`vv:num-> real^3`][ARITH_RULE`~(6=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`6`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 6 < 6 ==> x' MOD 6 =0 \/ x' MOD 6 = 1\/ x' MOD 6 = 2 \/ x' MOD 6 =3 \/ x' MOD 6 =4 \/ x' MOD 6 =5`) +THEN RESA_TAC +THENL[ +PROVE_V_SY_EQ_6_TAC`6`; +PROVE_V_SY_EQ_6_TAC`1`; +PROVE_V_SY_EQ_6_TAC`2`; +PROVE_V_SY_EQ_6_TAC`3`; +PROVE_V_SY_EQ_6_TAC`4`; +PROVE_V_SY_EQ_6_TAC`5`;]; + +REWRITE_TAC[E_SY;rows] +THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 6)<=> (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5\/ i=6)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THENL[ +PROVE_E_SY_EQ_6_TAC `1`; +PROVE_E_SY_EQ_6_TAC `2`; +PROVE_E_SY_EQ_6_TAC `3`; +PROVE_E_SY_EQ_6_TAC `4`; +PROVE_E_SY_EQ_6_TAC `5`; +PROVE_E_SY_EQ_6_TAC `0`;]; + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5 \/ i=6)<=> (1<= i /\ i<= 6)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`6`;`vv:num-> real^3`][ARITH_RULE`~(6=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num` THEN MRESA1_TAC th`SUC x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`6`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 6 < 6==> x' MOD 6 =0 \/ x' MOD 6 = 1\/ x' MOD 6 = 2 \/ x' MOD 6 =3 \/ x' MOD 6 =4 \/ x' MOD 6 =5`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_INV_6_TAC `6`; +PROVE_E_SY_EQ_INV_6_TAC `1`; +PROVE_E_SY_EQ_INV_6_TAC `2`; +PROVE_E_SY_EQ_INV_6_TAC `3`; +PROVE_E_SY_EQ_INV_6_TAC `4`; +PROVE_E_SY_EQ_INV_6_TAC `5`;]; + +REWRITE_TAC[F_SY;rows] +THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 6)<=> (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5 \/ i=6)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THENL[ +PROVE_E_SY_EQ_6_TAC `1`; +PROVE_E_SY_EQ_6_TAC `2`; +PROVE_E_SY_EQ_6_TAC `3`; +PROVE_E_SY_EQ_6_TAC `4`; +PROVE_E_SY_EQ_6_TAC `5`; +PROVE_E_SY_EQ_6_TAC `0`;]; + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5 \/ i=6)<=> (1<= i /\ i<= 6)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`6`;`vv:num-> real^3`][ARITH_RULE`~(6=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num` THEN MRESA1_TAC th`SUC x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`6`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 6 < 6==> x' MOD 6 =0 \/ x' MOD 6 = 1\/ x' MOD 6 = 2 \/ x' MOD 6 =3 \/ x' MOD 6 =4 \/ x' MOD 6 =5`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_INV_6_TAC `6`; +PROVE_E_SY_EQ_INV_6_TAC `1`; +PROVE_E_SY_EQ_INV_6_TAC `2`; +PROVE_E_SY_EQ_INV_6_TAC `3`; +PROVE_E_SY_EQ_INV_6_TAC `4`; +PROVE_E_SY_EQ_INV_6_TAC `5`;]; + +]);; + (* }}} *) + + + + +let IN_NOT_EMPTY_CASE_6=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in +mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (&2 * h0)) (cs_adj 6 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 5;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +==> +a IN {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ CONDITION2_SY v }`, + (* {{{ proof *) +[ +REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;IN_ELIM_THM;CONDITION1_SY;CONDITION2_SY] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`~(6<=3)`;mk_unadorned_v39;CS_ADJ] +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[IN] +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(6<=3)`] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:real^3^M` +THEN STRIP_TAC; + +STRIP_TAC; + +REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 6)<=> (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5\/ i=6)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THENL[ +IN_BALL_ANNUUS_TAC_6 `(1:num)`; +IN_BALL_ANNUUS_TAC_6 `(2:num)`; +IN_BALL_ANNUUS_TAC_6 `(3:num)`; +IN_BALL_ANNUUS_TAC_6 `(4:num)`; +IN_BALL_ANNUUS_TAC_6 `(5:num)`; +IN_BALL_ANNUUS_TAC_6 `(0:num)`;]; + +STRIP_TAC; + +REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 6)<=> (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5\/ i=6)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT DISCH_TAC +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THENL[ +INEQUALITY_A_B_TAC_6 `1`; +INEQUALITY_A_B_TAC_6 `2`; +INEQUALITY_A_B_TAC_6 `3`; +INEQUALITY_A_B_TAC_6 `4`; +INEQUALITY_A_B_TAC_6 `5`; +INEQUALITY_A_B_TAC_6 `0`;]; + +MP_TAC V_E_FF_CASE_6 +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;CS_ADJ] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN REPEAT RESA_TAC; + +ASM_REWRITE_TAC[] +]);; + (* }}} *) + + + +let NOT_EMPTY_CASE_6=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in +mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (&2 * h0)) (cs_adj 6 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +==> +~({matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ CONDITION2_SY v }={})` +, + (* {{{ proof *) +[ +REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;] +THEN STRIP_TAC +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 5;(vv:num->real^3) 0]:real^3^M` +THEN ABBREV_TAC`a=matvec (v:real^3^M) ` +THEN EXISTS_TAC`a:real^(M,3)finite_product` +THEN MATCH_MP_TAC IN_NOT_EMPTY_CASE_6 +THEN ASM_REWRITE_TAC[] +]);; + (* }}} *) + + +let TAUSTAR_EQ_TAU_STAR_6=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in +mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (&2 * h0)) (cs_adj 6 (&2 * h0) upperbd))=s +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 5;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +/\ stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))=s1 +==> taustar_v39 s vv = tau_star s1 a`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN MP_TAC V_E_FF_CASE_6 +THEN RESA_TAC +THEN SUBGOAL_THEN`scs_k_v39 s =6` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(6<=3)`;IN;mk_unadorned_v39;]; + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN ASM_REWRITE_TAC[taustar_v39;tau_star] +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(6<=3)`;IN;mk_unadorned_v39;] +THEN ASM_SIMP_TAC[dsv_J_empty] +THEN MP_TAC SCS_6_IS_TRI_STABLE +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN STRIP_TAC +THEN MRESAL_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`][LET_DEF;LET_END_DEF;d_fun] +THEN SUBGOAL_THEN`J1_SY (s1:stable_sy)={}` ASSUME_TAC; + +ASM_REWRITE_TAC[J1_SY;] +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_J_v39_explicit;LET_DEF;LET_END_DEF;mk_unadorned_v39;change_type_v2;SET_RULE`a IN {{i, j} | F}<=> F`] +THEN SET_TAC[]; + +ASM_REWRITE_TAC[SUM_CLAUSES;REAL_ARITH`a* &0= &0 /\a + &0=a`] +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[MATVEC_VECMATS_ID;VECMATS_MATVEC_ID] +THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=>B=C`] +THEN MATCH_MP_TAC dsv_J_empty +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_J_v39_explicit;LET_DEF;LET_END_DEF;mk_unadorned_v39;change_type_v2;SET_RULE`a IN {{i, j} | F}<=> F`] +]);; + (* }}} *) + + + + + + + + + + + + + + + + + + + +let SCS_A_B__EQ_MOD_6=prove( +`s=(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (&2 * h0)) (cs_adj 6 (&2 * h0) upperbd)) +==> +!i j. scs_a_v39 s i j = scs_a_v39 s (i MOD 6) (j MOD 6)/\ + scs_b_v39 s i j = scs_b_v39 s (i MOD 6) (j MOD 6)`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(6<=3)`;IN;mk_unadorned_v39;CS_ADJ] +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`6`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC MOD_MOD_REFL[`j:num`;`6`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`j:num`;`1:num`;`6`][ARITH_RULE`~(6=0) /\ 1 MOD 6=1`;ADD1] +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`1:num`;`6`][ARITH_RULE`~(6=0) /\ 1 MOD 6=1`;ADD1]);; + + + + +let VV_IN_BALL_ANNULUS_TAC_6= +fun (so:term)-> +REPLICATE_TAC 8 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL1_TAC th so [ARITH_RULE`1<=1 /\ 1<=2 /\1<=3 /\ 1<= 4/\ 1<=6 /\ 2<=6/\ 3<=6/\ 4<=6/\ 6<=6/\ ~(1=0)/\ ~(2=0) /\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2)/\ ~(4=0) /\ ~(4=1)/\ ~(4=2)/\ ~(4=3)/\ 1<=5/\ 5<=6 +/\ ~(5=0) /\ ~(5=1)/\ ~(5=2)/\ ~(5=3) /\ ~(5=4)`] ) +;; + + + + +let PROVE_INEQUALITY_TAC_60= +fun (so:term) (so1:term)-> +REPLICATE_TAC 7(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL_TAC th[so;so1][ARITH_RULE`1<=6 /\ 6<=6/\ 1<=1 /\ 1<=6/\ 1<=2 /\ 2<=6/\1<=3 /\ 3<=6/\ 1<=4/\ 4<=6/\ 1<=5/\ 5<=6`]) +THEN POP_ASSUM( fun th-> +POP_ASSUM( fun th1-> +REPEAT DISCH_TAC +THEN MP_TAC th THEN MP_TAC th1 +THEN POP_ASSUM(fun th2-> ONCE_REWRITE_TAC[th2] +THEN POP_ASSUM(fun th3-> MRESAL1_TAC th3`6`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th3`1`[ARITH_RULE`1 MOD 6=1/\ ~(1=0)`] +THEN MRESAL1_TAC th3`2`[ARITH_RULE`2 MOD 6=2/\ ~(2=0)/\ ~(2=1)`] +THEN MRESAL1_TAC th3`3`[ARITH_RULE`3 MOD 6=3/\ ~(3=0)/\ ~(3=1)/\ ~(3=2)`] +THEN MRESAL1_TAC th3`4`[ARITH_RULE`4 MOD 6=4/\ ~(4=0)/\ ~(4=1)/\ ~(4=2)/\ ~(4=3)`] +THEN MRESAL1_TAC th3`5`[ARITH_RULE`5 MOD 6=5/\ ~(5=0)/\ ~(5=1)/\ ~(5=2)/\ ~(5=3)/\ ~(5=4)`]) +THEN MRESAL1_TAC th2`6`[ARITH_RULE`6 MOD 6=0`]) +)) +THEN MP_TAC SCS_A_B__EQ_MOD_6 +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`6 MOD 6=0/\ 1 MOD 6=1/\ 2 MOD 6=2 /\ 3 MOD 6=3 /\ 4 MOD 6=4/\ 5 MOD 6=5`] +THEN RESA_TAC +THEN RESA_TAC +;; + + + + + + +let PROVE_INEQUALITY_TAC_6= +fun (th:term)-> +MP_TAC(ARITH_RULE`(j MOD 6<6)==> (j MOD 6=0) \/ (j MOD 6=1) \/ (j MOD 6=2)\/ (j MOD 6=3)\/ (j MOD 6=4) \/ (j MOD 6=5)`) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_60 th `6`; +PROVE_INEQUALITY_TAC_60 th `1`; +PROVE_INEQUALITY_TAC_60 th `2`; +PROVE_INEQUALITY_TAC_60 th `3`; +PROVE_INEQUALITY_TAC_60 th `4`; +PROVE_INEQUALITY_TAC_60 th `5`];; + + + + + +let V_SY_EQ_IMAGE_VV_TAC6= +fun (th:term)-> +ASM_REWRITE_TAC[] +THEN EXISTS_TAC th +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ARITH_RULE`1 MOD 6=1 /\ ~(1=0) /\ 2 MOD 6=2 /\ ~(2=0)/\ ~(2=1)/\ 3 MOD 6=3 /\ ~(3=0)/\ ~(3=1)/\ ~(3=2)/\ 4 MOD 6=4/\ 5 MOD 6=5/\ 6 MOD 6=0 /\ ~(4=0)/\ ~(4=1)/\ ~(4=2)/\ ~(4=3) +/\ ~(5=0) /\ ~(5=1)/\ ~(5=2)/\ ~(5=3) /\ ~(5=4)`];; + + + + + + + + + + +let PROVE_E_SY_EQ_MOD_TAC_6= +fun (th:term)-> +EXISTS_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`~(3=0)/\ ~(3=1)/\ ~(3=2)/\ ~(2=0)/\ ~(2=1)/\ ~(1=0)/\ ~(4=0) /\ ~(4=1) /\ ~(4=2) /\ ~(4=3)/\ ~(5=0) /\ ~(5=1)/\ ~(5=2)/\ ~(5=3) /\ ~(5=4) `] +THEN ARITH_TAC;; + + + + + + + + + + +let PROOF_E_EQ_TAC_6= +fun (th:term)-> +EXISTS_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)/\ 1 MOD 6=1/\ SUC 1=2/\ 2 MOD 6=2/\ ~(2=0)/\ ~(2=1)/\ SUC 2=3 /\ 3 MOD 6=3/\ ~(3=0) /\ ~(3=1)/\ ~(3=2)/\ SUC 3=4 +/\ ~(4=0) /\ ~(4=1) /\ ~(4=2) /\ ~(4=3) /\ 4 MOD 6=4/\ 6 MOD 6=0/\ SUC 0=1 +/\ SUC 5=6/\ SUC 4=5/\ 7 MOD 6=1/\ 5 MOD 6=5/\ SUC 6=7 +/\ ~(5=0) /\ ~(5=1)/\ ~(5=2)/\ ~(5=3) /\ ~(5=4) +`;SET_RULE`(a:num) IN (:num)`] +;; + + + + + + +let PROVE_E_SY_EQ_IMAGE_VV_6= +fun (so:term)-> +EXISTS_TAC so +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`x':num`;`1:num`;`6`][ARITH_RULE`~(6=0) /\ 1 MOD 6=1/\ 1<=6/\ 6<=6/\ 0+1=1`;ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`~(1=0)/\ 1 MOD 6=1/\ SUC 1=2/\ 2 MOD 6=2/\ ~(2=0)/\ ~(2=1)/\ SUC 2=3 /\ 3 MOD 6=3/\ ~(3=0) /\ ~(3=1)/\ ~(3=2)/\ SUC 3=4 +/\ ~(4=0) /\ ~(4=1) /\ ~(4=2) /\ ~(4=3) /\ 4 MOD 6=4/\ 6 MOD 6=0/\ SUC 0=1 +/\ SUC 5=6/\ SUC 4=5/\ 7 MOD 6=1/\ 5 MOD 6=5/\ SUC 6=7 +/\ ~(5=0) /\ ~(5=1)/\ ~(5=2)/\ ~(5=3) /\ ~(5=4)/\3<=6/\ 4+1=5/\ 5+1=6 +/\ 0+1=1/\ 1<=1 /\1+1=2/\ 1<=2/\ 2+1=3/\ 1<=3/\ 3+1=4/\ 2<=6 +/\ 1<=4/\ 4<=6/\ 1<=5/\ 5<=6`]) +;; + + + + + + + + +let IN_NOT_EMPTY_B1_SY_6=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (&2 * h0)) (cs_adj 6 (&2 * h0) upperbd))=s/\ + scs_k_v39 s= dimindex(:M)/\ + matvec (v:real^3^M) =a/\ +(!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ + CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ + CONDITION2_SY v +/\ (!i. vv i = +if i MOD scs_k_v39 s = 0 then row 6 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +if i MOD scs_k_v39 s = 2 then row 2 v else +if i MOD scs_k_v39 s = 3 then row 3 v else +if i MOD scs_k_v39 s = 4 then row 4 v else +row 5 v) +==> vv IN BBs_v39 s`, + (* {{{ proof *) +[ + +REWRITE_TAC[CONDITION1_SY;CONDITION2_SY;change_type_v3] +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`scs_k_v39 s =6` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(6<=3)`;IN;mk_unadorned_v39;]; + +POP_ASSUM (fun th-> +REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th1-> ASSUME_TAC(SYM th1)) +THEN ASSUME_TAC th +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[th;IN] +THEN STRIP_TAC +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(6<=3)`;IN;mk_unadorned_v39;] +THEN STRIP_TAC; + +ASM_REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC DIVISION[`x':num`;`6`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 6<6 ==> x' MOD 6 = 0 \/ x' MOD 6 = 1 \/ x' MOD 6 = 2 \/ x' MOD 6 = 3\/ x' MOD 6 = 4 \/ x' MOD 6 = 5`) +THEN RESA_TAC +THENL[ +VV_IN_BALL_ANNULUS_TAC_6 `6`; +VV_IN_BALL_ANNULUS_TAC_6 `1`; +VV_IN_BALL_ANNULUS_TAC_6 `2`; +VV_IN_BALL_ANNULUS_TAC_6 `3`; +VV_IN_BALL_ANNULUS_TAC_6 `4`; +VV_IN_BALL_ANNULUS_TAC_6 `5`]; + + + + +STRIP_TAC; + +ASM_REWRITE_TAC[periodic] +THEN GEN_TAC +THEN MRESAL_TAC MOD_EQ[`i+6:num`;`i:num`;`6:num`;`1`][ARITH_RULE`1*A=A`]; + +STRIP_TAC; + +REWRITE_TAC[dist] +THEN REPEAT GEN_TAC +THEN SUBGOAL_THEN`!i. (vv:num->real^3) i= vv (i MOD 6)` ASSUME_TAC; + +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN GEN_TAC +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`6`][ARITH_RULE`~(6=0)`]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC DIVISION[`i:num`;`6`][ARITH_RULE`~(6=0)`] +THEN MRESAL_TAC DIVISION[`j:num`;`6`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`(i MOD 6<6)==> (i MOD 6=0) \/ (i MOD 6=1) \/ (i MOD 6=2)\/ (i MOD 6=3) \/ (i MOD 6=4) \/ (i MOD 6=5)`) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_6 `6`; +PROVE_INEQUALITY_TAC_6 `1`; +PROVE_INEQUALITY_TAC_6 `2`; +PROVE_INEQUALITY_TAC_6 `3`; +PROVE_INEQUALITY_TAC_6 `4`; +PROVE_INEQUALITY_TAC_6 `5`]; + + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`~(6<=3)`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`V_SY (v:real^3^M) = IMAGE vv (:num)`ASSUME_TAC; + +ASM_REWRITE_TAC[V_SY;rows;IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 6)<=> i= 1\/ i=2 \/ i=3 \/ i=4\/ i=5\/ i=6`] +THEN STRIP_TAC +THENL[ +V_SY_EQ_IMAGE_VV_TAC6 `1`; +V_SY_EQ_IMAGE_VV_TAC6 `2`; +V_SY_EQ_IMAGE_VV_TAC6 `3`; +V_SY_EQ_IMAGE_VV_TAC6 `4`; +V_SY_EQ_IMAGE_VV_TAC6 `5`; +V_SY_EQ_IMAGE_VV_TAC6 `6`]; + + + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`6`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 6<6)==> (x' MOD 6=0) \/ (x' MOD 6=1) \/ (x' MOD 6=2)\/ (x' MOD 6=3)\/ (x' MOD 6=4) \/ (x' MOD 6=5)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_MOD_TAC_6 `6`; +PROVE_E_SY_EQ_MOD_TAC_6 `1`; +PROVE_E_SY_EQ_MOD_TAC_6 `2`; +PROVE_E_SY_EQ_MOD_TAC_6 `3`; +PROVE_E_SY_EQ_MOD_TAC_6 `4`; +PROVE_E_SY_EQ_MOD_TAC_6 `5`]; + + +SUBGOAL_THEN`E_SY (v:real^3^M) = IMAGE (\i. {vv i, vv (SUC i)}) (:num)`ASSUME_TAC; + + +ASM_REWRITE_TAC[E_SY;rows;IMAGE;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 6)<=> i= 1\/ i=2 \/ i=3 \/ i=4\/ i=5\/ i=6`] +THEN RESA_TAC +THENL[ +PROOF_E_EQ_TAC_6`1`; +PROOF_E_EQ_TAC_6`2`; +PROOF_E_EQ_TAC_6`3`; +PROOF_E_EQ_TAC_6`4`; +PROOF_E_EQ_TAC_6`5`; +PROOF_E_EQ_TAC_6`6`]; + + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`6`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 6<6)==> (x' MOD 6=0) \/ (x' MOD 6=1) \/ (x' MOD 6=2)\/ (x' MOD 6=3) \/ (x' MOD 6=4) \/ (x' MOD 6=5)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_IMAGE_VV_6 `6`; +PROVE_E_SY_EQ_IMAGE_VV_6 `1`; +PROVE_E_SY_EQ_IMAGE_VV_6 `2`; +PROVE_E_SY_EQ_IMAGE_VV_6 `3`; +PROVE_E_SY_EQ_IMAGE_VV_6 `4`; +PROVE_E_SY_EQ_IMAGE_VV_6 `5`]; + + + + + +SUBGOAL_THEN`F_SY (v:real^3^M) = IMAGE (\i. (vv i, vv (SUC i))) (:num)`ASSUME_TAC; + + +ASM_REWRITE_TAC[F_SY;rows;IMAGE;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 6)<=> i= 1\/ i=2 \/ i=3 \/ i=4\/ i=5\/ i=6`] +THEN RESA_TAC +THENL[ +PROOF_E_EQ_TAC_6`1`; +PROOF_E_EQ_TAC_6`2`; +PROOF_E_EQ_TAC_6`3`; +PROOF_E_EQ_TAC_6`4`; +PROOF_E_EQ_TAC_6`5`; +PROOF_E_EQ_TAC_6`6`]; + + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`6`][ARITH_RULE`~(6=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 6<6)==> (x' MOD 6=0) \/ (x' MOD 6=1) \/ (x' MOD 6=2)\/ (x' MOD 6=3) \/ (x' MOD 6=4) \/ (x' MOD 6=5)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_IMAGE_VV_6 `6`; +PROVE_E_SY_EQ_IMAGE_VV_6 `1`; +PROVE_E_SY_EQ_IMAGE_VV_6 `2`; +PROVE_E_SY_EQ_IMAGE_VV_6 `3`; +PROVE_E_SY_EQ_IMAGE_VV_6 `4`; +PROVE_E_SY_EQ_IMAGE_VV_6 `5`]; + + + + + +POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[]; +]);; + (* }}} *) + + + + + +let XWITCCN_CASE_6=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (&2 * h0)) (cs_adj 6 (&2 * h0) upperbd))=s + /\ vv IN BBs_v39 s /\ + taustar_v39 s vv < &0 +/\ scs_k_v39 s= dimindex(:M) + ==> ~(BBprime_v39 s = {})`, + (* {{{ proof *) +[ +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC SCS_6_IS_TRI_STABLE +THEN RESA_TAC +THEN MP_TAC NOT_EMPTY_CASE_6 +THEN RESA_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`] +THEN ABBREV_TAC`s1 =stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))` +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN SUBGOAL_THEN`scs_k_v39 s =6` ASSUME_TAC; + + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(6 +<=3)`;IN;mk_unadorned_v39;]; + +POP_ASSUM (fun th-> +REPLICATE_TAC 11 (POP_ASSUM MP_TAC) +THEN REWRITE_TAC[th] +THEN STRIP_TAC +THEN POP_ASSUM(fun th1-> ASSUME_TAC(SYM th1)) +THEN ASSUME_TAC th +THEN REPEAT RESA_TAC) +THEN MRESAL_TAC (GEN_ALL HDPLYGY)[`(scs_k_v39 s)`;`s1:stable_sy`][k_sy;B_SY1;ARITH_RULE`2<6 +`;] +THEN POP_ASSUM (fun th-> +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN REWRITE_TAC[BBprime_v39;IN] +THEN ABBREV_TAC`( vv1 i = +if i MOD scs_k_v39 s = 0 then row 6 + v else +if i MOD scs_k_v39 s = 1 then row 1 v else +if i MOD scs_k_v39 s = 2 then row 2 v else +if i MOD scs_k_v39 s = 3 then row 3 v else +if i MOD scs_k_v39 s = 4 then row 4 v else +row 5 (v:real^3^M))` +THEN EXISTS_TAC`vv1:num->real^3` +THEN STRIP_TAC; + +ONCE_REWRITE_TAC[GSYM IN] +THEN MATCH_MP_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_6) +THEN EXISTS_TAC`x:real^(M,3)finite_product` +THEN EXISTS_TAC`v:real^3^M` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; + +SUBGOAL_THEN`vector [ vv1 1; vv1 2; (vv1:num->real^3) 3;vv1 4;vv1 5;vv1 0] = v:real^3^M` +ASSUME_TAC; + +POP_ASSUM(fun th-> REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`1 MOD 6=1/\ 2 MOD 6=2/\ 3 MOD 6=3/\ 0 MOD 6 +=0 /\ ~(1=0)/\ ~(2=0)/\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2) /\ ~(4=0) /\ ~(4=1) /\ ~(4=2) /\ ~(4=3)/\ 4 MOD 6=4/\ 5 MOD 6=5/\ ~(1=5)/\ ~(2=5)/\ ~(3=5)/\ ~(4=5)/\ ~(0=5)`;] +THEN ONCE_REWRITE_TAC[CART_EQ] +THEN ASM_REWRITE_TAC[ARITH_RULE`1<=i/\ i<=6 + <=>i=1\/ i=2\/ i=3\/ i=4\/ i=5\/ i=6`] +THEN REPEAT RESA_TAC +THEN +ASM_SIMP_TAC[row;vector; LAMBDA_BETA; DIMINDEX_3; LENGTH; ARITH] THEN +REWRITE_TAC[num_CONV `4`;num_CONV `5`;num_CONV `3`;num_CONV `2`; num_CONV `1`; EL; HD; TL;] +THEN ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;row;LAMBDA_BETA]; + +STRIP_TAC; + +GEN_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM IN] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_6) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_6)[`v:real^3^M`;`s:scs_v39`;`vv1:num->real^3`;`s1:stable_sy`;`x:real^(M,3)finite_product`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_6) +[`vector [ww 1; ww 2; ww 3; ww 4; ww 5; ww 0]:real^3^M`;`s:scs_v39`;`ww:num->real^3`;`s1:stable_sy`;`matvec(vector [ww 1; ww 2; ww 3; ww 4;ww 5; ww 0]:real^3^M):real^(M,3)finite_product`;] +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_CASE_6 +)[`ww:num->real^3`;`vector [ww 1; ww 2; ww 3; ww 4; ww 5;ww 0]:real^3^M`;`matvec(vector [ww 1; ww 2; ww 3; ww 4; ww 5; ww 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th `matvec(vector [ww 1; ww 2; ww 3; ww 4; ww 5; ww 0]:real^3^M):real^(M,3)finite_product`); + +MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_6 +) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_6 +)[`v:real^3^M`;`s:scs_v39`;`vv1:num->real^3`;`s1:stable_sy`;`x:real^(M,3)finite_product`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_6 +) +[`vector [vv 1; vv 2; vv 3; vv 4;vv 5;vv 0]:real^3^M`;`s:scs_v39`;`vv:num->real^3`;`s1:stable_sy`;`matvec(vector [vv 1; vv 2; vv 3; vv 4;vv 5; vv 0]:real^3^M):real^(M,3)finite_product`;] +THEN REPLICATE_TAC 23 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_CASE_6 +)[`vv:num->real^3`;`vector [vv 1; vv 2; vv 3; vv 4; vv 5;vv 0]:real^3^M`;`matvec(vector [vv 1; vv 2; vv 3; vv 4; vv 5; vv 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th `matvec(vector [vv 1; vv 2; vv 3; vv 4; vv 5; vv 0]:real^3^M):real^(M,3)finite_product`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +]);; + (* }}} *) + + + + + + + + + + + + + + + + + + + + + + + + + + +let V_E_FF_CASE_5_sqrt8=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (#0.616) (cs_adj 5 (&2) (sqrt8)) (cs_adj 5 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +==> +V_SY (v:real^3^M)=IMAGE vv (:num)/\ + E_SY (v:real^3^M)=IMAGE (\i. {vv i, vv (SUC i)}) (:num)/\ +F_SY (v:real^3^M)=IMAGE (\i. vv i,vv (SUC i)) (:num)`, + (* {{{ proof *) +[ +STRIP_TAC +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39] +THEN REPEAT STRIP_TAC; + +REWRITE_TAC[V_SY;rows] +THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 5)<=> (i=1\/ i=2\/ i=3 \/ i=4\/ i=5)`] THEN ASSUME_TAC (SYM th)) +THEN STRIP_TAC +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +REPEAT STRIP_TAC +THENL[ +EQUALITY_V_SY_TAC_5 `1`; +EQUALITY_V_SY_TAC_5 `2`; +EQUALITY_V_SY_TAC_5 `3`; +EQUALITY_V_SY_TAC_5 `4`; +EQUALITY_V_SY_TAC_5 `0`;]; + +REPEAT STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)<=> (1<= i /\ i<= 5)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`5`;`vv:num-> real^3`][ARITH_RULE`~(5=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 5 < 5 ==> x' MOD 5 =0 \/ x' MOD 5 = 1\/ x' MOD 5 = 2 \/ x' MOD 5 =3 \/ x' MOD 5 =4`) +THEN RESA_TAC +THENL[ +PROVE_V_SY_EQ_5_TAC`5`; +PROVE_V_SY_EQ_5_TAC`1`; +PROVE_V_SY_EQ_5_TAC`2`; +PROVE_V_SY_EQ_5_TAC`3`; +PROVE_V_SY_EQ_5_TAC`4`;]; + +REWRITE_TAC[E_SY;rows] +THEN REPLICATE_TAC 2(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 5)<=> (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THENL[ +PROVE_E_SY_EQ_5_TAC `1`; +PROVE_E_SY_EQ_5_TAC `2`; +PROVE_E_SY_EQ_5_TAC `3`; +PROVE_E_SY_EQ_5_TAC `4`; +PROVE_E_SY_EQ_5_TAC `0`;]; + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)<=> (1<= i /\ i<= 5)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`5`;`vv:num-> real^3`][ARITH_RULE`~(5=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num` THEN MRESA1_TAC th`SUC x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 5 < 5==> x' MOD 5 =0 \/ x' MOD 5 = 1\/ x' MOD 5 = 2 \/ x' MOD 5 =3 \/ x' MOD 5 =4`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_INV_5_TAC `5`; +PROVE_E_SY_EQ_INV_5_TAC `1`; +PROVE_E_SY_EQ_INV_5_TAC `2` ; +PROVE_E_SY_EQ_INV_5_TAC `3` ; +PROVE_E_SY_EQ_INV_5_TAC `4` ;]; + +REWRITE_TAC[F_SY;rows] +THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 5)<=> (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THENL[ +PROVE_E_SY_EQ_5_TAC `1`; +PROVE_E_SY_EQ_5_TAC `2`; +PROVE_E_SY_EQ_5_TAC `3`; +PROVE_E_SY_EQ_5_TAC `4`; +PROVE_E_SY_EQ_5_TAC `0`;]; + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)<=> (1<= i /\ i<= 5)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`5`;`vv:num-> real^3`][ARITH_RULE`~(5=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num` THEN MRESA1_TAC th`SUC x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 5 < 5==> x' MOD 5 =0 \/ x' MOD 5 = 1\/ x' MOD 5 = 2 \/ x' MOD 5 =3 \/ x' MOD 5 =4`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_INV_5_TAC `5`; +PROVE_E_SY_EQ_INV_5_TAC `1`; +PROVE_E_SY_EQ_INV_5_TAC `2` ; +PROVE_E_SY_EQ_INV_5_TAC `3` ; +PROVE_E_SY_EQ_INV_5_TAC `4` ;]; +]);; + (* }}} *) + + + + + + + +let IN_NOT_EMPTY_CASE_5_sqrt8=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (#0.616) (cs_adj 5 (&2) (sqrt8)) (cs_adj 5 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +==> +a IN {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ CONDITION2_SY v }`, + (* {{{ proof *) +[ +REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;IN_ELIM_THM;CONDITION1_SY;CONDITION2_SY] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`~(5<=3)`;mk_unadorned_v39;CS_ADJ] +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[IN] +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:real^3^M` +THEN STRIP_TAC; + +STRIP_TAC; + +REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 5)<=> (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THENL[ +IN_BALL_ANNUUS_TAC_5 `(1:num)`; +IN_BALL_ANNUUS_TAC_5 `(2:num)`; +IN_BALL_ANNUUS_TAC_5 `(3:num)`; +IN_BALL_ANNUUS_TAC_5 `(4:num)`; +IN_BALL_ANNUUS_TAC_5 `(0:num)`;]; + +STRIP_TAC; + +REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 5)<=> (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT DISCH_TAC +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THENL[ +INEQUALITY_A_B_TAC_5 `1`; +INEQUALITY_A_B_TAC_5 `2`; +INEQUALITY_A_B_TAC_5 `3`; +INEQUALITY_A_B_TAC_5 `4`; +INEQUALITY_A_B_TAC_5 `0`; ]; + +MP_TAC V_E_FF_CASE_5_sqrt8 +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;CS_ADJ] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN REPEAT RESA_TAC; + +ASM_REWRITE_TAC[] +]);; + (* }}} *) + + + + + + + + + + + + + + + +let NOT_EMPTY_CASE_5_sqrt8=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (#0.616) (cs_adj 5 (&2) (sqrt8)) (cs_adj 5 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +==> +~({matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ CONDITION2_SY v }={})` +, + (* {{{ proof *) +[ +REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;] +THEN STRIP_TAC +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 0]:real^3^M` +THEN ABBREV_TAC`a=matvec (v:real^3^M) ` +THEN EXISTS_TAC`a:real^(M,3)finite_product` +THEN MATCH_MP_TAC IN_NOT_EMPTY_CASE_5_sqrt8 +THEN ASM_REWRITE_TAC[] +]);; + (* }}} *) + + +let TAUSTAR_EQ_TAU_STAR_5_sqrt8=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (#0.616) (cs_adj 5 (&2) (sqrt8)) (cs_adj 5 (&2 * h0) upperbd))=s +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +/\ stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s)(scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))=s1 +==> taustar_v39 s vv = tau_star s1 a`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN MP_TAC V_E_FF_CASE_5_sqrt8 +THEN RESA_TAC +THEN SUBGOAL_THEN`scs_k_v39 s =5` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39;]; + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN ASM_REWRITE_TAC[taustar_v39;tau_star] +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39;] +THEN ASM_SIMP_TAC[dsv_J_empty] +THEN MP_TAC SCS_5_sqrt8_IS_TRI_STABLE +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN STRIP_TAC +THEN MRESAL_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s)(scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`][LET_DEF;LET_END_DEF;d_fun] +THEN SUBGOAL_THEN`J1_SY (s1:stable_sy)={}` ASSUME_TAC; + +ASM_REWRITE_TAC[J1_SY;] +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_J_v39_explicit;LET_DEF;LET_END_DEF;mk_unadorned_v39;change_type_v2;SET_RULE`a IN {{i, j} | F}<=> F`] +THEN SET_TAC[]; + +ASM_REWRITE_TAC[SUM_CLAUSES;REAL_ARITH`a* &0= &0 /\a + &0=a`] +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[MATVEC_VECMATS_ID;VECMATS_MATVEC_ID] +THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=>B=C`] +THEN MATCH_MP_TAC dsv_J_empty +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_J_v39_explicit;LET_DEF;LET_END_DEF;mk_unadorned_v39;change_type_v2;SET_RULE`a IN {{i, j} | F}<=> F`] +]);; + (* }}} *) + + + + + + + +let SCS_A_B__EQ_MOD_5_sqrt8=prove( +`s=(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (#0.616) (cs_adj 5 (&2) (sqrt8)) (cs_adj 5 (&2 * h0) upperbd)) +==> +!i j. scs_a_v39 s i j = scs_a_v39 s (i MOD 5) (j MOD 5)/\ + scs_b_v39 s i j = scs_b_v39 s (i MOD 5) (j MOD 5)`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39;CS_ADJ] +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`5`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC MOD_MOD_REFL[`j:num`;`5`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`j:num`;`1:num`;`5`][ARITH_RULE`~(5=0) /\ 1 MOD 5=1`;ADD1] +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`1:num`;`5`][ARITH_RULE`~(5=0) /\ 1 MOD 5=1`;ADD1]);; + + + +let VV_IN_BALL_ANNULUS_TAC_5= +fun (so:term)-> +REPLICATE_TAC 8 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL1_TAC th so [ARITH_RULE`1<=1 /\ 1<=2 /\1<=3 /\ 1<= 4/\ 1<=5 /\ 2<=5/\ 3<=5/\ 4<=5/\ 5<=5/\ ~(1=0)/\ ~(2=0) /\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2)/\ ~(4=0) /\ ~(4=1)/\ ~(4=2)/\ ~(4=3)`] ) +;; + + +let PROVE_INEQUALITY_TAC_50= +fun (so:term) (so1:term)-> +REPLICATE_TAC 7(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL_TAC th[so;so1][ARITH_RULE`1<=5 /\ 5<=5/\ 1<=1 /\ 1<=5/\ 1<=2 /\ 2<=5/\1<=3 /\ 3<=5/\ 1<=4/\ 4<=5`]) +THEN POP_ASSUM( fun th-> +POP_ASSUM( fun th1-> +REPEAT DISCH_TAC +THEN MP_TAC th THEN MP_TAC th1 +THEN POP_ASSUM(fun th2-> ONCE_REWRITE_TAC[th2] +THEN POP_ASSUM(fun th3-> MRESAL1_TAC th3`5`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th3`1`[ARITH_RULE`1 MOD 5=1/\ ~(1=0)`] +THEN MRESAL1_TAC th3`2`[ARITH_RULE`2 MOD 5=2/\ ~(2=0)/\ ~(2=1)`] +THEN MRESAL1_TAC th3`3`[ARITH_RULE`3 MOD 5=3/\ ~(3=0)/\ ~(3=1)/\ ~(3=2)`] +THEN MRESAL1_TAC th3`4`[ARITH_RULE`4 MOD 5=4/\ ~(4=0)/\ ~(4=1)/\ ~(4=2)/\ ~(4=3)`]) +THEN MRESAL1_TAC th2`5`[ARITH_RULE`5 MOD 5=0`]) +)) +THEN MP_TAC SCS_A_B__EQ_MOD_5_sqrt8 +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`5 MOD 5=0/\ 1 MOD 5=1/\ 2 MOD 5=2 /\ 3 MOD 5=3 /\ 4 MOD 5=4`] +THEN RESA_TAC +THEN RESA_TAC +;; + + + + +let PROVE_INEQUALITY_TAC_5= +fun (th:term)-> +MP_TAC(ARITH_RULE`(j MOD 5<5)==> (j MOD 5=0) \/ (j MOD 5=1) \/ (j MOD 5=2)\/ (j MOD 5=3)\/ (j MOD 5=4) `) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_50 th `5`; +PROVE_INEQUALITY_TAC_50 th `1`; +PROVE_INEQUALITY_TAC_50 th `2`; +PROVE_INEQUALITY_TAC_50 th `3`; +PROVE_INEQUALITY_TAC_50 th `4`];; + + + + +let V_SY_EQ_IMAGE_VV_TAC5= +fun (th:term)-> +ASM_REWRITE_TAC[] +THEN EXISTS_TAC th +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ARITH_RULE`1 MOD 5=1 /\ ~(1=0) /\ 2 MOD 5=2 /\ ~(2=0)/\ ~(2=1)/\ 3 MOD 5=3 /\ ~(3=0)/\ ~(3=1)/\ ~(3=2)/\ 4 MOD 5=4/\ 5 MOD 5=0/\ ~(4=0)/\ ~(4=1)/\ ~(4=2)/\ ~(4=3)`];; + + + + + +let PROVE_E_SY_EQ_MOD_TAC_5= +fun (th:term)-> +EXISTS_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`~(3=0)/\ ~(3=1)/\ ~(3=2)/\ ~(2=0)/\ ~(2=1)/\ ~(1=0)/\ ~(4=0) /\ ~(4=1) /\ ~(4=2) /\ ~(4=3) `] +THEN ARITH_TAC;; + + + + + + + +let PROOF_E_EQ_TAC_5= +fun (th:term)-> +EXISTS_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)/\ 1 MOD 5=1/\ SUC 1=2/\ 2 MOD 5=2/\ ~(2=0)/\ ~(2=1)/\ SUC 2=3 /\ 3 MOD 5=3/\ ~(3=0) /\ ~(3=1)/\ ~(3=2)/\ SUC 3=4 +/\ ~(4=0) /\ ~(4=1) /\ ~(4=2) /\ ~(4=3) /\ 4 MOD 5=4/\ 5 MOD 5=0/\ SUC 0=1 +/\ SUC 5=6/\ SUC 4=5/\ 6 MOD 5=1`;SET_RULE`(a:num) IN (:num)`] +;; + + +let PROVE_E_SY_EQ_IMAGE_VV_5= +fun (so:term)-> +EXISTS_TAC so +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`x':num`;`1:num`;`5`][ARITH_RULE`~(5=0) /\ 1 MOD 5=1/\ 1<=5/\ 5<=5/\ 0+1=1`;ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`~(1=0)/\ 4 MOD 5=4/\ 5 MOD 5=0 /\ 0+1=1/\ 1<=1 /\ 1+1=2/\ 2 MOD 5=2/\ ~(2=0)/\ ~(2=1)/\ 2+1=3/\ 3 MOD 5=3 +/\ ~(3=0)/\ ~(3=1)/\ ~(3=2)/\1<=2/\ 2<=5 /\ 3<=5 /\ 4<=5/\ 1<=4/\ 4+1=5 +/\ 1<=3/\ 3<=4/\ 3+1=4/\ ~(4=0) /\ ~(4=1) /\ ~(4=2) /\ ~(4=3)`]) +;; + + + + + + + +let IN_NOT_EMPTY_B1_SY_5_sqrt8=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (#0.616) (cs_adj 5 (&2) (sqrt8)) (cs_adj 5 (&2 * h0) upperbd))=s/\ + scs_k_v39 s= dimindex(:M)/\ + matvec (v:real^3^M) =a/\ +(!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ + CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ + CONDITION2_SY v +/\ (!i. vv i = +if i MOD scs_k_v39 s = 0 then row 5 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +if i MOD scs_k_v39 s = 2 then row 2 v else +if i MOD scs_k_v39 s = 3 then row 3 v else +row 4 v) +==> vv IN BBs_v39 s`, + (* {{{ proof *) +[ + +REWRITE_TAC[CONDITION1_SY;CONDITION2_SY;change_type_v3] +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`scs_k_v39 s =5` ASSUME_TAC; +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39;]; +POP_ASSUM (fun th-> +REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th1-> ASSUME_TAC(SYM th1)) +THEN ASSUME_TAC th +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[th;IN] +THEN STRIP_TAC +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39;] +THEN STRIP_TAC; +ASM_REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 5<5 ==> x' MOD 5 = 0 \/ x' MOD 5 = 1 \/ x' MOD 5 = 2 \/ x' MOD 5 = 3\/ x' MOD 5 = 4`) +THEN RESA_TAC +THENL[ +VV_IN_BALL_ANNULUS_TAC_5 `5`; +VV_IN_BALL_ANNULUS_TAC_5 `1`; +VV_IN_BALL_ANNULUS_TAC_5 `2`; +VV_IN_BALL_ANNULUS_TAC_5 `3`; +VV_IN_BALL_ANNULUS_TAC_5 `4`]; +STRIP_TAC; +ASM_REWRITE_TAC[periodic] +THEN GEN_TAC +THEN MRESAL_TAC MOD_EQ[`i+5:num`;`i:num`;`5:num`;`1`][ARITH_RULE`1*A=A`]; +STRIP_TAC; +REWRITE_TAC[dist] +THEN REPEAT GEN_TAC +THEN SUBGOAL_THEN`!i. (vv:num->real^3) i= vv (i MOD 5)` ASSUME_TAC; +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN GEN_TAC +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`5`][ARITH_RULE`~(5=0)`]; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC DIVISION[`i:num`;`5`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC DIVISION[`j:num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`(i MOD 5<5)==> (i MOD 5=0) \/ (i MOD 5=1) \/ (i MOD 5=2)\/ (i MOD 5=3) \/ (i MOD 5=4)`) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_5 `5`; +PROVE_INEQUALITY_TAC_5 `1`; +PROVE_INEQUALITY_TAC_5 `2`; +PROVE_INEQUALITY_TAC_5 `3`; +PROVE_INEQUALITY_TAC_5 `4`]; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`~(5<=3)`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`V_SY (v:real^3^M) = IMAGE vv (:num)`ASSUME_TAC; +ASM_REWRITE_TAC[V_SY;rows;IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 5)<=> i= 1\/ i=2 \/ i=3 \/ i=4\/ i=5`] +THEN STRIP_TAC +THENL[ +V_SY_EQ_IMAGE_VV_TAC5 `1`; +V_SY_EQ_IMAGE_VV_TAC5 `2`; +V_SY_EQ_IMAGE_VV_TAC5 `3`; +V_SY_EQ_IMAGE_VV_TAC5 `4`; +V_SY_EQ_IMAGE_VV_TAC5 `5`]; + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 5<5)==> (x' MOD 5=0) \/ (x' MOD 5=1) \/ (x' MOD 5=2)\/ (x' MOD 5=3)\/ (x' MOD 5=4)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_MOD_TAC_5 `5`; +PROVE_E_SY_EQ_MOD_TAC_5 `1`; +PROVE_E_SY_EQ_MOD_TAC_5 `2`; +PROVE_E_SY_EQ_MOD_TAC_5 `3`; +PROVE_E_SY_EQ_MOD_TAC_5 `4`]; +SUBGOAL_THEN`E_SY (v:real^3^M) = IMAGE (\i. {vv i, vv (SUC i)}) (:num)`ASSUME_TAC; +ASM_REWRITE_TAC[E_SY;rows;IMAGE;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 5)<=> i= 1\/ i=2 \/ i=3 \/ i=4\/ i=5`] +THEN RESA_TAC +THENL[ +PROOF_E_EQ_TAC_5`1`; +PROOF_E_EQ_TAC_5`2`; +PROOF_E_EQ_TAC_5`3`; +PROOF_E_EQ_TAC_5`4`; +PROOF_E_EQ_TAC_5`5`]; + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 5<5)==> (x' MOD 5=0) \/ (x' MOD 5=1) \/ (x' MOD 5=2)\/ (x' MOD 5=3) \/ (x' MOD 5=4)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_IMAGE_VV_5 `5`; +PROVE_E_SY_EQ_IMAGE_VV_5 `1`; +PROVE_E_SY_EQ_IMAGE_VV_5 `2`; +PROVE_E_SY_EQ_IMAGE_VV_5 `3`; +PROVE_E_SY_EQ_IMAGE_VV_5 `4`]; + +SUBGOAL_THEN`F_SY (v:real^3^M) = IMAGE (\i. (vv i, vv (SUC i))) (:num)`ASSUME_TAC; +ASM_REWRITE_TAC[F_SY;rows;IMAGE;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 5)<=> i= 1\/ i=2 \/ i=3 \/ i=4\/ i=5`] +THEN RESA_TAC +THENL[ +PROOF_E_EQ_TAC_5`1`; +PROOF_E_EQ_TAC_5`2`; +PROOF_E_EQ_TAC_5`3`; +PROOF_E_EQ_TAC_5`4`; +PROOF_E_EQ_TAC_5`5`]; + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 5<5)==> (x' MOD 5=0) \/ (x' MOD 5=1) \/ (x' MOD 5=2)\/ (x' MOD 5=3) \/ (x' MOD 5=4)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_IMAGE_VV_5 `5`; +PROVE_E_SY_EQ_IMAGE_VV_5 `1`; +PROVE_E_SY_EQ_IMAGE_VV_5 `2`; +PROVE_E_SY_EQ_IMAGE_VV_5 `3`; +PROVE_E_SY_EQ_IMAGE_VV_5 `4`]; + + + +POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[]; + +]);; + (* }}} *) + + + +let XWITCCN_CASE_5_sqrt8=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (#0.616) (cs_adj 5 (&2) (sqrt8)) (cs_adj 5 (&2 * h0) upperbd))=s + /\ vv IN BBs_v39 s /\ + taustar_v39 s vv < &0 +/\ scs_k_v39 s= dimindex(:M) + ==> ~(BBprime_v39 s = {})`, + (* {{{ proof *) +[ +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC SCS_5_sqrt8_IS_TRI_STABLE +THEN RESA_TAC +THEN MP_TAC NOT_EMPTY_CASE_5_sqrt8 +THEN RESA_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`] +THEN ABBREV_TAC`s1 =stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s)(scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))` +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s)(scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN SUBGOAL_THEN`scs_k_v39 s =5` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39;]; + +POP_ASSUM (fun th-> +REPLICATE_TAC 11 (POP_ASSUM MP_TAC) +THEN REWRITE_TAC[th] +THEN STRIP_TAC +THEN POP_ASSUM(fun th1-> ASSUME_TAC(SYM th1)) +THEN ASSUME_TAC th +THEN REPEAT RESA_TAC) +THEN MRESAL_TAC (GEN_ALL HDPLYGY)[`(scs_k_v39 s)`;`s1:stable_sy`][k_sy;B_SY1;ARITH_RULE`2<5`;] +THEN POP_ASSUM (fun th-> +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN REWRITE_TAC[BBprime_v39;IN] +THEN ABBREV_TAC`( vv1 i = +if i MOD scs_k_v39 s = 0 then row 5 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +if i MOD scs_k_v39 s = 2 then row 2 v else +if i MOD scs_k_v39 s = 3 then row 3 v else +row 4 (v:real^3^M))` +THEN EXISTS_TAC`vv1:num->real^3` +THEN STRIP_TAC; + +ONCE_REWRITE_TAC[GSYM IN] +THEN MATCH_MP_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_5_sqrt8) +THEN EXISTS_TAC`x:real^(M,3)finite_product` +THEN EXISTS_TAC`v:real^3^M` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; + +SUBGOAL_THEN`vector [ vv1 1; vv1 2; (vv1:num->real^3) 3;vv1 4;vv1 0] = v:real^3^M` +ASSUME_TAC; + +POP_ASSUM(fun th-> REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`1 MOD 5=1/\ 2 MOD 5=2/\ 3 MOD 5=3/\ 0 MOD 5=0 /\ ~(1=0)/\ ~(2=0)/\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2) /\ ~(4=0) /\ ~(4=1) /\ ~(4=2) /\ ~(4=3)/\ 4 MOD 5=4`;] +THEN ONCE_REWRITE_TAC[CART_EQ] +THEN ASM_REWRITE_TAC[ARITH_RULE`1<=i/\ i<=5 <=>i=1\/ i=2\/ i=3\/ i=4\/ i=5`] +THEN REPEAT RESA_TAC +THEN +ASM_SIMP_TAC[row;vector; LAMBDA_BETA; DIMINDEX_3; LENGTH; ARITH] THEN +REWRITE_TAC[num_CONV `4`;num_CONV `3`;num_CONV `2`; num_CONV `1`; EL; HD; TL;] +THEN ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;row;LAMBDA_BETA]; + +STRIP_TAC; + +GEN_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM IN] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_5_sqrt8) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_5_sqrt8)[`v:real^3^M`;`s:scs_v39`;`vv1:num->real^3`;`s1:stable_sy`;`x:real^(M,3)finite_product`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_5_sqrt8) +[`vector [ww 1; ww 2; ww 3; ww 4; ww 0]:real^3^M`;`s:scs_v39`;`ww:num->real^3`;`s1:stable_sy`;`matvec(vector [ww 1; ww 2; ww 3; ww 4; ww 0]:real^3^M):real^(M,3)finite_product`;] +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_CASE_5_sqrt8)[`ww:num->real^3`;`vector [ww 1; ww 2; ww 3; ww 4; ww 0]:real^3^M`;`matvec(vector [ww 1; ww 2; ww 3; ww 4;ww 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th `matvec(vector [ww 1; ww 2; ww 3; ww 4;ww 0]:real^3^M):real^(M,3)finite_product`); + +MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_5_sqrt8) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_5_sqrt8)[`v:real^3^M`;`s:scs_v39`;`vv1:num->real^3`;`s1:stable_sy`;`x:real^(M,3)finite_product`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_5_sqrt8) +[`vector [vv 1; vv 2; vv 3; vv 4;vv 0]:real^3^M`;`s:scs_v39`;`vv:num->real^3`;`s1:stable_sy`;`matvec(vector [vv 1; vv 2; vv 3; vv 4; vv 0]:real^3^M):real^(M,3)finite_product`;] +THEN REPLICATE_TAC 23 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_CASE_5_sqrt8)[`vv:num->real^3`;`vector [vv 1; vv 2; vv 3; vv 4; vv 0]:real^3^M`;`matvec(vector [vv 1; vv 2; vv 3; vv 4; vv 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th `matvec(vector [vv 1; vv 2; vv 3; vv 4; vv 0]:real^3^M):real^(M,3)finite_product`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +]);; + (* }}} *) + + + + + + + + + + + + + +let IN_BALL_ANNUUS_TAC_5 = +fun (th:term)-> +ASM_SIMP_TAC[] +THEN MRESAL_TAC VECTOR_3_5[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 5<=5`] +THEN MATCH_MP_TAC(SET_RULE` +vv th IN IMAGE vv (:num) /\ IMAGE vv (:num) SUBSET ball_annulus +==> vv th IN ball_annulus`) +THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC th +THEN REWRITE_TAC[] +THEN SET_TAC[] +;; + + + +let INEQUALITY_A_B_TAC_50 = +fun (so:term) (so1:term)-> +ASM_SIMP_TAC[change_type_v3] +THEN MRESAL_TAC VECTOR_3_5[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 0`][ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 5<=5/\ 0 MOD 5= 0 /\ 1 MOD 5= 1 /\ 2 MOD 5= 2/\ 3 MOD 5= 3 /\ 4 MOD 5= 4 /\ 5 MOD 5=0 /\ ~(2=1) +/\ SUC 0 MOD 5= 1 /\ SUC 1 MOD 5= 2 /\ SUC 2 MOD 5= 3/\ SUC 3 MOD 5= 4 +/\ SUC 4 MOD 5= 0 /\ SUC 5 MOD 5 = 1 /\ ~(3=1)/\ ~(1=0)`] +THEN REPLICATE_TAC 13 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL_TAC th[so;so1][dist;ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 0 MOD 5= 0 /\ 1 MOD 5= 1 /\ 2 MOD 5= 2/\ 3 MOD 5= 3 /\ 4 MOD 5= 4 /\ 5 MOD 5=0 /\ ~(2=1) +/\ SUC 0 MOD 5= 1 /\ SUC 1 MOD 5= 2 /\ SUC 2 MOD 5= 3/\ SUC 3 MOD 5= 4 +/\ SUC 4 MOD 5= 0 /\ SUC 5 MOD 5 = 1 /\ ~(3=1)/\ ~(1=0) /\ ~(1=4)/\ ~(2=3) /\ ~(2=0) /\ ~(3=0)/\ ~(0=4)/\ ~(2=4) +/\ ~(3=4)`;SET_RULE`{1,0}={0,1}`; ]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`5`;`vv:num-> real^3`][ARITH_RULE`~(5=0)`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`5:num`[ARITH_RULE`5 MOD 5=0`]) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT RESA_TAC) +;; + + + + +let INEQUALITY_A_B_TAC_5 = +fun (th:term)-> +MP_TAC(ARITH_RULE`1<= i /\ i<= 5==> i=1\/ i=2\/ i=3\/ i=4 \/ i=5`) +THEN RESA_TAC +THENL[ INEQUALITY_A_B_TAC_50 `1` th; +INEQUALITY_A_B_TAC_50 `2` th; +INEQUALITY_A_B_TAC_50 `3` th; +INEQUALITY_A_B_TAC_50 `4` th; +INEQUALITY_A_B_TAC_50 `5` th];; + + + + +let EQUALITY_V_SY_TAC_5 = +fun (th:term)-> +ASM_REWRITE_TAC[] +THEN EXISTS_TAC th +THEN MRESAL_TAC VECTOR_3_5[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 0`][ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 5<=5/\ 0 MOD 5= 0 /\ 1 MOD 5= 1 /\ 2 MOD 5= 2/\ 3 MOD 5= 3 /\ 4 MOD 5= 4 /\ 5 MOD 5=0 /\ ~(2=1) +/\ SUC 0 MOD 5= 1 /\ SUC 1 MOD 5= 2 /\ SUC 2 MOD 5= 3/\ SUC 3 MOD 5= 4 +/\ SUC 4 MOD 5= 0 /\ SUC 5 MOD 5 = 1 /\ ~(3=1)/\ ~(1=0)`;SET_RULE`(a:num) IN (:num)`] +;; + + + +let PROVE_V_SY_EQ_5_TAC= +fun (th:term)-> +EXISTS_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= 1 /\ 1<= 5`] +THEN MRESAL_TAC VECTOR_3_5[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 4 MOD 5= 4/\ 5 MOD 5=0 /\ 1 MOD 5= 1 /\ 2 MOD 5= 2/\ 3 MOD 5= 3 /\ ~(2=1) +/\ SUC 4 MOD 5= 0 /\ SUC 1 MOD 5= 2 /\ SUC 2 MOD 5= 3/\ SUC 3 MOD 5= 4/\ ~(3=1)/\ ~(1=0)/\ 5<=5/\ 1<=1 /\ 1<=2 /\ 1<= 3 /\ 1<=4 /\ 1<=5`] +;; + +let PROVE_E_SY_EQ_5_TAC = +fun (th:term)-> +EXISTS_TAC th +THEN MRESAL_TAC VECTOR_3_5[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 0`][ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 4 MOD 5= 4/\ 5 MOD 5=0 /\ 1 MOD 5= 1 /\ 2 MOD 5= 2/\ 3 MOD 5= 3 /\ ~(2=1) +/\ SUC 4 MOD 5= 0 /\ SUC 1 MOD 5= 2 /\ SUC 2 MOD 5= 3/\ SUC 3 MOD 5= 4/\ ~(3=1)/\ ~(1=0)/\ 5<=5/\ 1<=1 /\ 1<=2 /\ 1<= 3 /\ 1<=4 /\ 1<=5 +/\ SUC 1=2 /\ SUC 0 =1/\ SUC 2=3/\ SUC 3=4 `; SET_RULE`(a:num) IN (:num)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`5`;`vv:num-> real^3`][ARITH_RULE`~(5=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`SUC 4`[ARITH_RULE`SUC 4 MOD 5=0/\ SUC 4=5`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +;; + + + + + + +let PROVE_E_SY_EQ_INV_5_TAC= +fun (th:term) (th1:term) -> +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`x':num`;th;`5`][ARITH_RULE`~(5=0)/\ 0 MOD 5=0/\ SUC 5 MOD 5=1 /\ 1 MOD 5=1 /\ 2 MOD 5=2 /\ 3 MOD 5=3/\ 4 MOD 5=4/\ 5 MOD 5=0`] +THEN EXISTS_TAC th1 +THEN MRESAL_TAC VECTOR_3_5[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 4`;`(vv:num->real^3) 0`][ARITH_RULE`1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 4 MOD 5= 4/\ 5 MOD 5=0 /\ 1 MOD 5= 1 /\ 2 MOD 5= 2/\ 3 MOD 5= 3 /\ ~(2=1) +/\ SUC 4 MOD 5= 0 /\ SUC 1 MOD 5= 2 /\ SUC 2 MOD 5= 3/\ SUC 3 MOD 5= 4/\ ~(3=1)/\ ~(1=0)/\ 5<=5/\ 1<=1 /\ 1<=2 /\ 1<= 3 /\ 1<=4 /\ 1<=5 +/\ SUC 1=2 /\ SUC 0 =1/\ SUC 2=3/\ SUC 3=4/\ SUC 4=5 `; SET_RULE`(a:num) IN (:num)`] +;; + + + +let V_E_FF_CASE_5_pro_cs=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (#0.616) (a_pro 5 (&2 * h0) (&2) (&2 * h0)) (a_pro 5 sqrt8 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +==> +V_SY (v:real^3^M)=IMAGE vv (:num)/\ + E_SY (v:real^3^M)=IMAGE (\i. {vv i, vv (SUC i)}) (:num)/\ +F_SY (v:real^3^M)=IMAGE (\i. vv i,vv (SUC i)) (:num)`, + (* {{{ proof *) +[ + +STRIP_TAC +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39] +THEN REPEAT STRIP_TAC; + +REWRITE_TAC[V_SY;rows] +THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 5)<=> (i=1\/ i=2\/ i=3 \/ i=4\/ i=5)`] THEN ASSUME_TAC (SYM th)) +THEN STRIP_TAC +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +REPEAT STRIP_TAC +THENL[ +EQUALITY_V_SY_TAC_5 `1`; +EQUALITY_V_SY_TAC_5 `2`; +EQUALITY_V_SY_TAC_5 `3`; +EQUALITY_V_SY_TAC_5 `4`; +EQUALITY_V_SY_TAC_5 `0`]; + +REPEAT STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)<=> (1<= i /\ i<= 5)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`5`;`vv:num-> real^3`][ARITH_RULE`~(5=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 5 < 5 ==> x' MOD 5 =0 \/ x' MOD 5 = 1\/ x' MOD 5 = 2 \/ x' MOD 5 =3 \/ x' MOD 5 =4`) +THEN RESA_TAC +THENL[ +PROVE_V_SY_EQ_5_TAC`5`; +PROVE_V_SY_EQ_5_TAC`1`; +PROVE_V_SY_EQ_5_TAC`2`; +PROVE_V_SY_EQ_5_TAC`3`; +PROVE_V_SY_EQ_5_TAC`4`]; + +REWRITE_TAC[E_SY;rows] +THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 5)<=> (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THENL[ +PROVE_E_SY_EQ_5_TAC `1`; +PROVE_E_SY_EQ_5_TAC `2`; +PROVE_E_SY_EQ_5_TAC `3`; +PROVE_E_SY_EQ_5_TAC `4`; +PROVE_E_SY_EQ_5_TAC `0`]; + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)<=> (1<= i /\ i<= 5)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`5`;`vv:num-> real^3`][ARITH_RULE`~(5=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num` THEN MRESA1_TAC th`SUC x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 5 < 5==> x' MOD 5 =0 \/ x' MOD 5 = 1\/ x' MOD 5 = 2 \/ x' MOD 5 =3 \/ x' MOD 5 =4`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_INV_5_TAC `5` `5`; +PROVE_E_SY_EQ_INV_5_TAC `1` `1`; +PROVE_E_SY_EQ_INV_5_TAC `2` `2`; +PROVE_E_SY_EQ_INV_5_TAC `3` `3`; +PROVE_E_SY_EQ_INV_5_TAC `4` `4`;]; + +REWRITE_TAC[F_SY;rows] +THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 5)<=> (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THENL[ +PROVE_E_SY_EQ_5_TAC `1`; +PROVE_E_SY_EQ_5_TAC `2`; +PROVE_E_SY_EQ_5_TAC `3`; +PROVE_E_SY_EQ_5_TAC `4`; +PROVE_E_SY_EQ_5_TAC `0`]; + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)<=> (1<= i /\ i<= 5)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`5`;`vv:num-> real^3`][ARITH_RULE`~(5=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num` THEN MRESA1_TAC th`SUC x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 5 < 5==> x' MOD 5 =0 \/ x' MOD 5 = 1\/ x' MOD 5 = 2 \/ x' MOD 5 =3 \/ x' MOD 5 =4`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_INV_5_TAC `5` `5`; +PROVE_E_SY_EQ_INV_5_TAC `1` `1`; +PROVE_E_SY_EQ_INV_5_TAC `2` `2`; +PROVE_E_SY_EQ_INV_5_TAC `3` `3`; +PROVE_E_SY_EQ_INV_5_TAC `4` `4`;]; +]);; + (* }}} *) + + + + + + +let IN_NOT_EMPTY_CASE_5_pro_cs=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (#0.616) (a_pro 5 (&2 * h0) (&2) (&2 * h0)) (a_pro 5 sqrt8 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +==> +a IN {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ CONDITION2_SY v }`, + (* {{{ proof *) +[ +REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;IN_ELIM_THM;CONDITION1_SY;CONDITION2_SY] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`~(5<=3)`;mk_unadorned_v39;CS_ADJ] +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[IN] +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:real^3^M` +THEN STRIP_TAC; + +STRIP_TAC; +REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 5)<=> (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THENL[ +IN_BALL_ANNUUS_TAC_5 `(1:num)`; +IN_BALL_ANNUUS_TAC_5 `(2:num)`; +IN_BALL_ANNUUS_TAC_5 `(3:num)`; +IN_BALL_ANNUUS_TAC_5 `(4:num)`; +IN_BALL_ANNUUS_TAC_5 `(0:num)`]; + +STRIP_TAC; + +REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 5)<=> (i=1\/ i=2\/ i=3 \/ i=4 \/ i=5)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT DISCH_TAC +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THENL[ +INEQUALITY_A_B_TAC_5 `1`; +INEQUALITY_A_B_TAC_5 `2`; +INEQUALITY_A_B_TAC_5 `3`; +INEQUALITY_A_B_TAC_5 `4`; +INEQUALITY_A_B_TAC_5 `0` ]; + + + +MP_TAC V_E_FF_CASE_5_pro_cs +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;CS_ADJ] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN REPEAT RESA_TAC; + +ASM_REWRITE_TAC[] +]);; + (* }}} *) + + + + + + + + + + +let NOT_EMPTY_CASE_5_pro_cs=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (#0.616) (a_pro 5 (&2 * h0) (&2) (&2 * h0)) (a_pro 5 sqrt8 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +==> +~({matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ CONDITION2_SY v }={})` +, + (* {{{ proof *) +[ +REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;] +THEN STRIP_TAC +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 0]:real^3^M` +THEN ABBREV_TAC`a=matvec (v:real^3^M) ` +THEN EXISTS_TAC`a:real^(M,3)finite_product` +THEN MATCH_MP_TAC IN_NOT_EMPTY_CASE_5_pro_cs +THEN ASM_REWRITE_TAC[] +]);; + (* }}} *) + + +let TAUSTAR_EQ_TAU_STAR_5_pro_cs=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (#0.616) (a_pro 5 (&2 * h0) (&2) (&2 * h0)) (a_pro 5 sqrt8 (&2 * h0) upperbd))=s +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 4;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +/\ stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s)(scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))=s1 +==> taustar_v39 s vv = tau_star s1 a`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN MP_TAC V_E_FF_CASE_5_pro_cs +THEN RESA_TAC +THEN SUBGOAL_THEN`scs_k_v39 s =5` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39;]; + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN ASM_REWRITE_TAC[taustar_v39;tau_star] +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39;] +THEN ASM_SIMP_TAC[dsv_J_empty] +THEN MP_TAC SCS_5_pro_cs_IS_TRI_STABLE +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN STRIP_TAC +THEN MRESAL_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s)(scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`][LET_DEF;LET_END_DEF;d_fun] +THEN SUBGOAL_THEN`J1_SY (s1:stable_sy)={}` ASSUME_TAC; + +ASM_REWRITE_TAC[J1_SY;] +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_J_v39_explicit;LET_DEF;LET_END_DEF;mk_unadorned_v39;change_type_v2;SET_RULE`a IN {{i, j} | F}<=> F`] +THEN SET_TAC[]; + +ASM_REWRITE_TAC[SUM_CLAUSES;REAL_ARITH`a* &0= &0 /\a + &0=a`] +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[MATVEC_VECMATS_ID;VECMATS_MATVEC_ID] +THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=>B=C`] +THEN MATCH_MP_TAC dsv_J_empty +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_J_v39_explicit;LET_DEF;LET_END_DEF;mk_unadorned_v39;change_type_v2;SET_RULE`a IN {{i, j} | F}<=> F`] +]);; + (* }}} *) + + + + + + +let SCS_A_B__EQ_MOD_5_pro_cs=prove( +`s=(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (#0.616) (a_pro 5 (&2 * h0) (&2) (&2 * h0)) (a_pro 5 sqrt8 (&2 * h0) upperbd)) +==> +!i j. scs_a_v39 s i j = scs_a_v39 s (i MOD 5) (j MOD 5)/\ + scs_b_v39 s i j = scs_b_v39 s (i MOD 5) (j MOD 5)`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39;CS_ADJ] +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`5`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC MOD_MOD_REFL[`j:num`;`5`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`j:num`;`1:num`;`5`][ARITH_RULE`~(5=0) /\ 1 MOD 5=1`;ADD1] +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`1:num`;`5`][ARITH_RULE`~(5=0) /\ 1 MOD 5=1`;ADD1]);; + + + +let VV_IN_BALL_ANNULUS_TAC_5= +fun (so:term)-> +REPLICATE_TAC 8 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL1_TAC th so [ARITH_RULE`1<=1 /\ 1<=2 /\1<=3 /\ 1<= 4/\ 1<=5 /\ 2<=5/\ 3<=5/\ 4<=5/\ 5<=5/\ ~(1=0)/\ ~(2=0) /\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2)/\ ~(4=0) /\ ~(4=1)/\ ~(4=2)/\ ~(4=3)`] ) +;; + + +let PROVE_INEQUALITY_TAC_50= +fun (so:term) (so1:term)-> +REPLICATE_TAC 7(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL_TAC th[so;so1][ARITH_RULE`1<=5 /\ 5<=5/\ 1<=1 /\ 1<=5/\ 1<=2 /\ 2<=5/\1<=3 /\ 3<=5/\ 1<=4/\ 4<=5`]) +THEN POP_ASSUM( fun th-> +POP_ASSUM( fun th1-> +REPEAT DISCH_TAC +THEN MP_TAC th THEN MP_TAC th1 +THEN POP_ASSUM(fun th2-> ONCE_REWRITE_TAC[th2] +THEN POP_ASSUM(fun th3-> MRESAL1_TAC th3`5`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th3`1`[ARITH_RULE`1 MOD 5=1/\ ~(1=0)`] +THEN MRESAL1_TAC th3`2`[ARITH_RULE`2 MOD 5=2/\ ~(2=0)/\ ~(2=1)`] +THEN MRESAL1_TAC th3`3`[ARITH_RULE`3 MOD 5=3/\ ~(3=0)/\ ~(3=1)/\ ~(3=2)`] +THEN MRESAL1_TAC th3`4`[ARITH_RULE`4 MOD 5=4/\ ~(4=0)/\ ~(4=1)/\ ~(4=2)/\ ~(4=3)`]) +THEN MRESAL1_TAC th2`5`[ARITH_RULE`5 MOD 5=0`]) +)) +THEN MP_TAC SCS_A_B__EQ_MOD_5_pro_cs +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`5 MOD 5=0/\ 1 MOD 5=1/\ 2 MOD 5=2 /\ 3 MOD 5=3 /\ 4 MOD 5=4`] +THEN RESA_TAC +THEN RESA_TAC +;; + + + + +let PROVE_INEQUALITY_TAC_5= +fun (th:term)-> +MP_TAC(ARITH_RULE`(j MOD 5<5)==> (j MOD 5=0) \/ (j MOD 5=1) \/ (j MOD 5=2)\/ (j MOD 5=3)\/ (j MOD 5=4) `) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_50 th `5`; +PROVE_INEQUALITY_TAC_50 th `1`; +PROVE_INEQUALITY_TAC_50 th `2`; +PROVE_INEQUALITY_TAC_50 th `3`; +PROVE_INEQUALITY_TAC_50 th `4`];; + + + + +let V_SY_EQ_IMAGE_VV_TAC5= +fun (th:term)-> +ASM_REWRITE_TAC[] +THEN EXISTS_TAC th +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ARITH_RULE`1 MOD 5=1 /\ ~(1=0) /\ 2 MOD 5=2 /\ ~(2=0)/\ ~(2=1)/\ 3 MOD 5=3 /\ ~(3=0)/\ ~(3=1)/\ ~(3=2)/\ 4 MOD 5=4/\ 5 MOD 5=0/\ ~(4=0)/\ ~(4=1)/\ ~(4=2)/\ ~(4=3)`];; + + + + + +let PROVE_E_SY_EQ_MOD_TAC_5= +fun (th:term)-> +EXISTS_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`~(3=0)/\ ~(3=1)/\ ~(3=2)/\ ~(2=0)/\ ~(2=1)/\ ~(1=0)/\ ~(4=0) /\ ~(4=1) /\ ~(4=2) /\ ~(4=3) `] +THEN ARITH_TAC;; + + + + + + + +let PROOF_E_EQ_TAC_5= +fun (th:term)-> +EXISTS_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)/\ 1 MOD 5=1/\ SUC 1=2/\ 2 MOD 5=2/\ ~(2=0)/\ ~(2=1)/\ SUC 2=3 /\ 3 MOD 5=3/\ ~(3=0) /\ ~(3=1)/\ ~(3=2)/\ SUC 3=4 +/\ ~(4=0) /\ ~(4=1) /\ ~(4=2) /\ ~(4=3) /\ 4 MOD 5=4/\ 5 MOD 5=0/\ SUC 0=1 +/\ SUC 5=6/\ SUC 4=5/\ 6 MOD 5=1`;SET_RULE`(a:num) IN (:num)`] +;; + + +let PROVE_E_SY_EQ_IMAGE_VV_5= +fun (so:term)-> +EXISTS_TAC so +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`x':num`;`1:num`;`5`][ARITH_RULE`~(5=0) /\ 1 MOD 5=1/\ 1<=5/\ 5<=5/\ 0+1=1`;ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`~(1=0)/\ 4 MOD 5=4/\ 5 MOD 5=0 /\ 0+1=1/\ 1<=1 /\ 1+1=2/\ 2 MOD 5=2/\ ~(2=0)/\ ~(2=1)/\ 2+1=3/\ 3 MOD 5=3 +/\ ~(3=0)/\ ~(3=1)/\ ~(3=2)/\1<=2/\ 2<=5 /\ 3<=5 /\ 4<=5/\ 1<=4/\ 4+1=5 +/\ 1<=3/\ 3<=4/\ 3+1=4/\ ~(4=0) /\ ~(4=1) /\ ~(4=2) /\ ~(4=3)`]) +;; + + + + + + + +let IN_NOT_EMPTY_B1_SY_5_pro_cs=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (#0.616) (a_pro 5 (&2 * h0) (&2) (&2 * h0)) (a_pro 5 sqrt8 (&2 * h0) upperbd))=s/\ + scs_k_v39 s= dimindex(:M)/\ + matvec (v:real^3^M) =a/\ +(!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ + CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ + CONDITION2_SY v +/\ (!i. vv i = +if i MOD scs_k_v39 s = 0 then row 5 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +if i MOD scs_k_v39 s = 2 then row 2 v else +if i MOD scs_k_v39 s = 3 then row 3 v else +row 4 v) +==> vv IN BBs_v39 s`, + (* {{{ proof *) +[ + +REWRITE_TAC[CONDITION1_SY;CONDITION2_SY;change_type_v3] +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`scs_k_v39 s =5` ASSUME_TAC; +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39;]; +POP_ASSUM (fun th-> +REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th1-> ASSUME_TAC(SYM th1)) +THEN ASSUME_TAC th +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[th;IN] +THEN STRIP_TAC +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39;] +THEN STRIP_TAC; +ASM_REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 5<5 ==> x' MOD 5 = 0 \/ x' MOD 5 = 1 \/ x' MOD 5 = 2 \/ x' MOD 5 = 3\/ x' MOD 5 = 4`) +THEN RESA_TAC +THENL[ +VV_IN_BALL_ANNULUS_TAC_5 `5`; +VV_IN_BALL_ANNULUS_TAC_5 `1`; +VV_IN_BALL_ANNULUS_TAC_5 `2`; +VV_IN_BALL_ANNULUS_TAC_5 `3`; +VV_IN_BALL_ANNULUS_TAC_5 `4`]; +STRIP_TAC; +ASM_REWRITE_TAC[periodic] +THEN GEN_TAC +THEN MRESAL_TAC MOD_EQ[`i+5:num`;`i:num`;`5:num`;`1`][ARITH_RULE`1*A=A`]; +STRIP_TAC; +REWRITE_TAC[dist] +THEN REPEAT GEN_TAC +THEN SUBGOAL_THEN`!i. (vv:num->real^3) i= vv (i MOD 5)` ASSUME_TAC; +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN GEN_TAC +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`5`][ARITH_RULE`~(5=0)`]; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC DIVISION[`i:num`;`5`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC DIVISION[`j:num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`(i MOD 5<5)==> (i MOD 5=0) \/ (i MOD 5=1) \/ (i MOD 5=2)\/ (i MOD 5=3) \/ (i MOD 5=4)`) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_5 `5`; +PROVE_INEQUALITY_TAC_5 `1`; +PROVE_INEQUALITY_TAC_5 `2`; +PROVE_INEQUALITY_TAC_5 `3`; +PROVE_INEQUALITY_TAC_5 `4`]; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`~(5<=3)`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`V_SY (v:real^3^M) = IMAGE vv (:num)`ASSUME_TAC; +ASM_REWRITE_TAC[V_SY;rows;IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 5)<=> i= 1\/ i=2 \/ i=3 \/ i=4\/ i=5`] +THEN STRIP_TAC +THENL[ +V_SY_EQ_IMAGE_VV_TAC5 `1`; +V_SY_EQ_IMAGE_VV_TAC5 `2`; +V_SY_EQ_IMAGE_VV_TAC5 `3`; +V_SY_EQ_IMAGE_VV_TAC5 `4`; +V_SY_EQ_IMAGE_VV_TAC5 `5`]; + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 5<5)==> (x' MOD 5=0) \/ (x' MOD 5=1) \/ (x' MOD 5=2)\/ (x' MOD 5=3)\/ (x' MOD 5=4)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_MOD_TAC_5 `5`; +PROVE_E_SY_EQ_MOD_TAC_5 `1`; +PROVE_E_SY_EQ_MOD_TAC_5 `2`; +PROVE_E_SY_EQ_MOD_TAC_5 `3`; +PROVE_E_SY_EQ_MOD_TAC_5 `4`]; +SUBGOAL_THEN`E_SY (v:real^3^M) = IMAGE (\i. {vv i, vv (SUC i)}) (:num)`ASSUME_TAC; +ASM_REWRITE_TAC[E_SY;rows;IMAGE;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 5)<=> i= 1\/ i=2 \/ i=3 \/ i=4\/ i=5`] +THEN RESA_TAC +THENL[ +PROOF_E_EQ_TAC_5`1`; +PROOF_E_EQ_TAC_5`2`; +PROOF_E_EQ_TAC_5`3`; +PROOF_E_EQ_TAC_5`4`; +PROOF_E_EQ_TAC_5`5`]; + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 5<5)==> (x' MOD 5=0) \/ (x' MOD 5=1) \/ (x' MOD 5=2)\/ (x' MOD 5=3) \/ (x' MOD 5=4)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_IMAGE_VV_5 `5`; +PROVE_E_SY_EQ_IMAGE_VV_5 `1`; +PROVE_E_SY_EQ_IMAGE_VV_5 `2`; +PROVE_E_SY_EQ_IMAGE_VV_5 `3`; +PROVE_E_SY_EQ_IMAGE_VV_5 `4`]; + +SUBGOAL_THEN`F_SY (v:real^3^M) = IMAGE (\i. (vv i, vv (SUC i))) (:num)`ASSUME_TAC; +ASM_REWRITE_TAC[F_SY;rows;IMAGE;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 5)<=> i= 1\/ i=2 \/ i=3 \/ i=4\/ i=5`] +THEN RESA_TAC +THENL[ +PROOF_E_EQ_TAC_5`1`; +PROOF_E_EQ_TAC_5`2`; +PROOF_E_EQ_TAC_5`3`; +PROOF_E_EQ_TAC_5`4`; +PROOF_E_EQ_TAC_5`5`]; + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`5`][ARITH_RULE`~(5=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 5<5)==> (x' MOD 5=0) \/ (x' MOD 5=1) \/ (x' MOD 5=2)\/ (x' MOD 5=3) \/ (x' MOD 5=4)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_IMAGE_VV_5 `5`; +PROVE_E_SY_EQ_IMAGE_VV_5 `1`; +PROVE_E_SY_EQ_IMAGE_VV_5 `2`; +PROVE_E_SY_EQ_IMAGE_VV_5 `3`; +PROVE_E_SY_EQ_IMAGE_VV_5 `4`]; + + + +POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[]; + +]);; + (* }}} *) + + + + + + +let XWITCCN_CASE_5_pro_cs=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (#0.616) (a_pro 5 (&2 * h0) (&2) (&2 * h0)) (a_pro 5 sqrt8 (&2 * h0) upperbd))=s + /\ vv IN BBs_v39 s /\ + taustar_v39 s vv < &0 +/\ scs_k_v39 s= dimindex(:M) + ==> ~(BBprime_v39 s = {})`, + (* {{{ proof *) +[ +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC SCS_5_pro_cs_IS_TRI_STABLE +THEN RESA_TAC +THEN MP_TAC NOT_EMPTY_CASE_5_pro_cs +THEN RESA_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`] +THEN ABBREV_TAC`s1 =stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s)(scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))` +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s)(scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN SUBGOAL_THEN`scs_k_v39 s =5` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(5<=3)`;IN;mk_unadorned_v39;]; + +POP_ASSUM (fun th-> +REPLICATE_TAC 11 (POP_ASSUM MP_TAC) +THEN REWRITE_TAC[th] +THEN STRIP_TAC +THEN POP_ASSUM(fun th1-> ASSUME_TAC(SYM th1)) +THEN ASSUME_TAC th +THEN REPEAT RESA_TAC) +THEN MRESAL_TAC (GEN_ALL HDPLYGY)[`(scs_k_v39 s)`;`s1:stable_sy`][k_sy;B_SY1;ARITH_RULE`2<5`;] +THEN POP_ASSUM (fun th-> +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN REWRITE_TAC[BBprime_v39;IN] +THEN ABBREV_TAC`( vv1 i = +if i MOD scs_k_v39 s = 0 then row 5 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +if i MOD scs_k_v39 s = 2 then row 2 v else +if i MOD scs_k_v39 s = 3 then row 3 v else +row 4 (v:real^3^M))` +THEN EXISTS_TAC`vv1:num->real^3` +THEN STRIP_TAC; + +ONCE_REWRITE_TAC[GSYM IN] +THEN MATCH_MP_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_5_pro_cs) +THEN EXISTS_TAC`x:real^(M,3)finite_product` +THEN EXISTS_TAC`v:real^3^M` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; + +SUBGOAL_THEN`vector [ vv1 1; vv1 2; (vv1:num->real^3) 3;vv1 4;vv1 0] = v:real^3^M` +ASSUME_TAC; + +POP_ASSUM(fun th-> REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`1 MOD 5=1/\ 2 MOD 5=2/\ 3 MOD 5=3/\ 0 MOD 5=0 /\ ~(1=0)/\ ~(2=0)/\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2) /\ ~(4=0) /\ ~(4=1) /\ ~(4=2) /\ ~(4=3)/\ 4 MOD 5=4`;] +THEN ONCE_REWRITE_TAC[CART_EQ] +THEN ASM_REWRITE_TAC[ARITH_RULE`1<=i/\ i<=5 <=>i=1\/ i=2\/ i=3\/ i=4\/ i=5`] +THEN REPEAT RESA_TAC +THEN +ASM_SIMP_TAC[row;vector; LAMBDA_BETA; DIMINDEX_3; LENGTH; ARITH] THEN +REWRITE_TAC[num_CONV `4`;num_CONV `3`;num_CONV `2`; num_CONV `1`; EL; HD; TL;] +THEN ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;row;LAMBDA_BETA]; + +STRIP_TAC; + +GEN_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM IN] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_5_pro_cs) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_5_pro_cs)[`v:real^3^M`;`s:scs_v39`;`vv1:num->real^3`;`s1:stable_sy`;`x:real^(M,3)finite_product`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_5_pro_cs) +[`vector [ww 1; ww 2; ww 3; ww 4; ww 0]:real^3^M`;`s:scs_v39`;`ww:num->real^3`;`s1:stable_sy`;`matvec(vector [ww 1; ww 2; ww 3; ww 4; ww 0]:real^3^M):real^(M,3)finite_product`;] +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_CASE_5_pro_cs)[`ww:num->real^3`;`vector [ww 1; ww 2; ww 3; ww 4; ww 0]:real^3^M`;`matvec(vector [ww 1; ww 2; ww 3; ww 4;ww 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th `matvec(vector [ww 1; ww 2; ww 3; ww 4;ww 0]:real^3^M):real^(M,3)finite_product`); + +MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_5_pro_cs) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_5_pro_cs)[`v:real^3^M`;`s:scs_v39`;`vv1:num->real^3`;`s1:stable_sy`;`x:real^(M,3)finite_product`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_5_pro_cs) +[`vector [vv 1; vv 2; vv 3; vv 4;vv 0]:real^3^M`;`s:scs_v39`;`vv:num->real^3`;`s1:stable_sy`;`matvec(vector [vv 1; vv 2; vv 3; vv 4; vv 0]:real^3^M):real^(M,3)finite_product`;] +THEN REPLICATE_TAC 23 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_CASE_5_pro_cs)[`vv:num->real^3`;`vector [vv 1; vv 2; vv 3; vv 4; vv 0]:real^3^M`;`matvec(vector [vv 1; vv 2; vv 3; vv 4; vv 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th `matvec(vector [vv 1; vv 2; vv 3; vv 4; vv 0]:real^3^M):real^(M,3)finite_product`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +]);; + (* }}} *) + + + + +let V_E_FF_CASE_4_3=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (#0.467) (cs_adj 4 (&2) (&3)) (cs_adj 4 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +==> +V_SY (v:real^3^M)=IMAGE vv (:num)/\ + E_SY (v:real^3^M)=IMAGE (\i. {vv i, vv (SUC i)}) (:num)/\ +F_SY (v:real^3^M)=IMAGE (\i. vv i,vv (SUC i)) (:num)`, + (* {{{ proof *) +[ + +STRIP_TAC +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39] +THEN REPEAT STRIP_TAC; + +REWRITE_TAC[V_SY;rows] +THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 4)<=> (i=1\/ i=2\/ i=3 \/ i=4)`] THEN ASSUME_TAC (SYM th)) +THEN STRIP_TAC +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +REPEAT STRIP_TAC +THENL[ +PROVE_EQ_V_SY_TAC_4 `1`; +PROVE_EQ_V_SY_TAC_4 `2`; +PROVE_EQ_V_SY_TAC_4 `3`; +PROVE_EQ_V_SY_TAC_4 `0`]; + +REPEAT STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4)<=> (1<= i /\ i<= 4)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`4`;`vv:num-> real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 4 < 4==> x' MOD 4 =0 \/ x' MOD 4 = 1\/ x' MOD 4 = 2 \/ x' MOD 4 =3`) +THEN RESA_TAC +THENL[ +PROVE_V_SY_EQ_TAC `4`; +PROVE_V_SY_EQ_TAC `1`; +PROVE_V_SY_EQ_TAC `2`; +PROVE_V_SY_EQ_TAC `3`]; + +REWRITE_TAC[E_SY;rows] +THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 4)<=> (i=1\/ i=2\/ i=3 \/ i=4)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THENL[ +PROVE_E_SY_EQ_TAC `1`; +PROVE_E_SY_EQ_TAC `2`; +EXISTS_TAC `3` +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 4 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)/\ SUC 1=2/\ SUC 0=1 /\ SUC 2= 3/\ SUC 3=4`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`4`;`vv:num-> real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`SUC 3`[ARITH_RULE`SUC 3 MOD 4=0/\ SUC 3=4`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SET_TAC[]; +PROVE_E_SY_EQ_TAC `0`]; + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4)<=> (1<= i /\ i<= 4)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`4`;`vv:num-> real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num` THEN MRESA1_TAC th`SUC x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 4 < 4==> x' MOD 4 =0 \/ x' MOD 4 = 1\/ x' MOD 4 = 2 \/ x' MOD 4 =3`) +THEN RESA_TAC +THENL[ +PROOF_E_EQ_IMAGE_4 `4`; +PROOF_E_EQ_IMAGE_4 `1`; +PROOF_E_EQ_IMAGE_4 `2`; +PROOF_E_EQ_IMAGE_4 `3`]; + +REWRITE_TAC[F_SY;rows] +THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 4)<=> (i=1\/ i=2\/ i=3 \/ i=4)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THENL[ +PROVE_E_SY_EQ_TAC `1`; +PROVE_E_SY_EQ_TAC `2`; +EXISTS_TAC `3` +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 4 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)/\ SUC 1=2/\ SUC 0=1 /\ SUC 2= 3/\ SUC 3=4`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`4`;`vv:num-> real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`SUC 3`[ARITH_RULE`SUC 3 MOD 4=0/\ SUC 3=4`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN SET_TAC[]; +PROVE_E_SY_EQ_TAC `0`]; + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4)<=> (1<= i /\ i<= 4)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`4`;`vv:num-> real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num` THEN MRESA1_TAC th`SUC x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 4 < 4==> x' MOD 4 =0 \/ x' MOD 4 = 1\/ x' MOD 4 = 2 \/ x' MOD 4 =3`) +THEN RESA_TAC +THENL[ +PROOF_E_EQ_IMAGE_4 `4`; +PROOF_E_EQ_IMAGE_4 `1`; +PROOF_E_EQ_IMAGE_4 `2`; +PROOF_E_EQ_IMAGE_4 `3`]; +]);; + (* }}} *) + + + + +let IN_NOT_EMPTY_CASE_4_3=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (#0.467) (cs_adj 4 (&2) (&3)) (cs_adj 4 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +==> +a IN {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ CONDITION2_SY v }`, + (* {{{ proof *) +[ + +REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;IN_ELIM_THM;CONDITION1_SY;CONDITION2_SY] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;CS_ADJ] +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[IN] +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:real^3^M` +THEN STRIP_TAC; + +STRIP_TAC; + +REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 4)<=> (i=1\/ i=2\/ i=3 \/ i=4)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THENL[ +IN_BALL_ANNULUS_ROW_TAC_4 `1`; +IN_BALL_ANNULUS_ROW_TAC_4 `2`; +IN_BALL_ANNULUS_ROW_TAC_4 `3`; +IN_BALL_ANNULUS_ROW_TAC_4 `0`]; + +STRIP_TAC; + +REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 4)<=> (i=1\/ i=2\/ i=3 \/ i=4)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT DISCH_TAC +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THENL[ +INEQUALITY_PROOF_TAC4 `1`; +INEQUALITY_PROOF_TAC4 `2`; +INEQUALITY_PROOF_TAC4 `3`; +INEQUALITY_PROOF_TAC4 `0`]; + +MP_TAC V_E_FF_CASE_4_3 +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;CS_ADJ] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN REPEAT RESA_TAC; + +ASM_REWRITE_TAC[]; +]);; + (* }}} *) + + + + + + + + + + + + + + + + + +let NOT_EMPTY_CASE_4_3=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (#0.467) (cs_adj 4 (&2) (&3)) (cs_adj 4 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +==> +~({matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ CONDITION2_SY v }={})` +, + (* {{{ proof *) +[ +REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;] +THEN STRIP_TAC +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 0]:real^3^M` +THEN ABBREV_TAC`a=matvec (v:real^3^M) ` +THEN EXISTS_TAC`a:real^(M,3)finite_product` +THEN MATCH_MP_TAC IN_NOT_EMPTY_CASE_4_3 +THEN ASM_REWRITE_TAC[] +]);; + (* }}} *) + + +let TAUSTAR_EQ_TAU_STAR_4_3=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (#0.467) (cs_adj 4 (&2) (&3)) (cs_adj 4 (&2 * h0) upperbd))=s +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +/\ stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s)(scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))=s1 +==> taustar_v39 s vv = tau_star s1 a` +, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN MP_TAC V_E_FF_CASE_4_3 +THEN RESA_TAC +THEN SUBGOAL_THEN`scs_k_v39 s =4` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;]; + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN ASM_REWRITE_TAC[taustar_v39;tau_star] +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;] +THEN ASM_SIMP_TAC[dsv_J_empty] +THEN MP_TAC SCS_4_3_IS_TRI_STABLE +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN STRIP_TAC +THEN MRESAL_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s)(scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`][LET_DEF;LET_END_DEF;d_fun] +THEN SUBGOAL_THEN`J1_SY (s1:stable_sy)={}` ASSUME_TAC; + +ASM_REWRITE_TAC[J1_SY;] +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_J_v39_explicit;LET_DEF;LET_END_DEF;mk_unadorned_v39;change_type_v2;SET_RULE`a IN {{i, j} | F}<=> F`] +THEN SET_TAC[]; + +ASM_REWRITE_TAC[SUM_CLAUSES;REAL_ARITH`a* &0= &0 /\a + &0=a`] +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[MATVEC_VECMATS_ID;VECMATS_MATVEC_ID] +THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=>B=C`] +THEN MATCH_MP_TAC dsv_J_empty +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_J_v39_explicit;LET_DEF;LET_END_DEF;mk_unadorned_v39;change_type_v2;SET_RULE`a IN {{i, j} | F}<=> F`] +]);; + (* }}} *) + + + + + + + + + + + + + + + + + +let VV_IN_BALL_ANNULUS_TAC_4= +fun (so:term)-> +REPLICATE_TAC 8 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL1_TAC th so [ARITH_RULE`1<=1 /\ 1<=2 /\1<=3 /\ 1<= 4/\ 1<=4 /\ 2<=4/\ 3<=4/\ 4<=4/\ ~(1=0)/\ ~(2=0) /\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2) `] ) +;; + + + + + + + +let SCS_A_B__EQ_MOD_4_3=prove( +`s=(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (#0.467) (cs_adj 4 (&2) (&3)) (cs_adj 4 (&2 * h0) upperbd)) +==> +!i j. scs_a_v39 s i j = scs_a_v39 s (i MOD 4) (j MOD 4)/\ + scs_b_v39 s i j = scs_b_v39 s (i MOD 4) (j MOD 4)`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;CS_ADJ] +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC MOD_MOD_REFL[`j:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`j:num`;`1:num`;`4`][ARITH_RULE`~(4=0) /\ 1 MOD 4=1`;ADD1] +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`1:num`;`4`][ARITH_RULE`~(4=0) /\ 1 MOD 4=1`;ADD1]);; + + + + + +let PROVE_INEQUALITY_TAC_40= +fun (so:term) (so1:term)-> +REPLICATE_TAC 7(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL_TAC th[so;so1][ARITH_RULE`1<=4 /\ 4<=4/\ 1<=1 /\ 1<=4/\ 1<=2 /\ 2<=4/\1<=3 /\ 3<=4`]) +THEN POP_ASSUM( fun th-> +POP_ASSUM( fun th1-> +REPEAT DISCH_TAC +THEN MP_TAC th THEN MP_TAC th1 +THEN POP_ASSUM(fun th2-> ONCE_REWRITE_TAC[th2] +THEN POP_ASSUM(fun th3-> MRESAL1_TAC th3`4`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th3`1`[ARITH_RULE`1 MOD 4=1/\ ~(1=0)`] +THEN MRESAL1_TAC th3`2`[ARITH_RULE`2 MOD 4=2/\ ~(2=0)/\ ~(2=1)`] +THEN MRESAL1_TAC th3`3`[ARITH_RULE`3 MOD 4=3/\ ~(3=0)/\ ~(3=1)/\ ~(3=2)`]) +THEN MRESAL1_TAC th2`4`[ARITH_RULE`4 MOD 4=0`]) +)) +THEN MP_TAC SCS_A_B__EQ_MOD_4_3 +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`4 MOD 4=0/\ 1 MOD 4=1/\ 2 MOD 4=2 /\ 3 MOD 4=3`] +THEN RESA_TAC +THEN RESA_TAC +;; + + +let PROVE_INEQUALITY_TAC_4= +fun (th:term)-> +MP_TAC(ARITH_RULE`(j MOD 4<4)==> (j MOD 4=0) \/ (j MOD 4=1) \/ (j MOD 4=2)\/ (j MOD 4=3)`) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_40 th `4`; +PROVE_INEQUALITY_TAC_40 th `1`; +PROVE_INEQUALITY_TAC_40 th `2`; +PROVE_INEQUALITY_TAC_40 th `3`];; + + + +let V_SY_EQ_IMAGE_VV_TAC4= +fun (th:term)-> +ASM_REWRITE_TAC[] +THEN EXISTS_TAC th +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ARITH_RULE`1 MOD 4=1 /\ ~(1=0) /\ 2 MOD 4=2 /\ ~(2=0)/\ ~(2=1)/\ 3 MOD 4=3 /\ ~(3=0)/\ ~(3=1)/\ ~(3=2)/\ 4 MOD 4=0`];; + + + +let PROVE_E_SY_EQ_MOD_TAC_4= +fun (th:term)-> +EXISTS_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`~(3=0)/\ ~(3=1)/\ ~(3=2)/\ ~(2=0)/\ ~(2=1)/\ ~(1=0)`] +THEN ARITH_TAC;; + + + +let PROVE_E_SY_EQ_IMAGE_VV_4= +fun (so:term)-> +EXISTS_TAC so +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`x':num`;`1:num`;`4`][ARITH_RULE`~(4=0) /\ 1 MOD 4=1/\ 1<=4/\ 4<=4/\ 0+1=1`;ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`~(1=0)/\ 4 MOD 4=0/\ 0+1=1/\ 1<=1 /\ 1+1=2/\ 2 MOD 4=2/\ ~(2=0)/\ ~(2=1)/\ 2+1=3/\ 3 MOD 4=3 +/\ ~(3=0)/\ ~(3=1)/\ ~(3=2)/\1<=2/\ 2<=4 +/\ 1<=3/\ 3<=4/\ 3+1=4`]) +;; + + + +let PROOF_E_EQ_TAC_4= +fun (th:term)-> +EXISTS_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)/\ 1 MOD 4=1/\ SUC 1=2/\ 2 MOD 4=2/\ ~(2=0)/\ ~(2=1)/\ SUC 2=3 /\ 3 MOD 4=3/\ ~(3=0) /\ ~(3=1)/\ ~(3=2)/\ SUC 3=4/\ 4 MOD 4=0/\ SUC 0=1 /\ SUC 4=5/\ 5 MOD 4=1`;SET_RULE`(a:num) IN (:num)`] +;; + + + +let IN_NOT_EMPTY_B1_SY_4_3=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (#0.467) (cs_adj 4 (&2) (&3)) (cs_adj 4 (&2 * h0) upperbd))=s/\ + scs_k_v39 s= dimindex(:M)/\ + matvec (v:real^3^M) =a/\ +(!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ + CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ + CONDITION2_SY v +/\ (!i. vv i = +if i MOD scs_k_v39 s = 0 then row 4 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +if i MOD scs_k_v39 s = 2 then row 2 v else +row 3 v) +==> vv IN BBs_v39 s`, + (* {{{ proof *) +[ +REWRITE_TAC[CONDITION1_SY;CONDITION2_SY;change_type_v3] +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`scs_k_v39 s =4` ASSUME_TAC; + + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;]; + +POP_ASSUM (fun th-> +REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th1-> ASSUME_TAC(SYM th1)) +THEN ASSUME_TAC th +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[th;IN] +THEN STRIP_TAC +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;] +THEN STRIP_TAC; + +ASM_REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 4<4 ==> x' MOD 4 = 0 \/ x' MOD 4 = 1 \/ x' MOD 4 = 2 \/ x' MOD 4 = 3`) +THEN RESA_TAC +THENL[ +VV_IN_BALL_ANNULUS_TAC_4 `4`; +VV_IN_BALL_ANNULUS_TAC_4 `1`; +VV_IN_BALL_ANNULUS_TAC_4 `2`; +VV_IN_BALL_ANNULUS_TAC_4 `3`]; + + +STRIP_TAC; + +ASM_REWRITE_TAC[periodic] +THEN GEN_TAC +THEN MRESAL_TAC MOD_EQ[`i+4:num`;`i:num`;`4:num`;`1`][ARITH_RULE`1*A=A`]; + +STRIP_TAC; + +REWRITE_TAC[dist] +THEN REPEAT GEN_TAC +THEN SUBGOAL_THEN`!i. (vv:num->real^3) i= vv (i MOD 4)` ASSUME_TAC; + +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN GEN_TAC +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`4`][ARITH_RULE`~(4=0)`]; + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC DIVISION[`i:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC DIVISION[`j:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`(i MOD 4<4)==> (i MOD 4=0) \/ (i MOD 4=1) \/ (i MOD 4=2)\/ (i MOD 4=3)`) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_4 `4`; +PROVE_INEQUALITY_TAC_4 `1`; +PROVE_INEQUALITY_TAC_4 `2`; +PROVE_INEQUALITY_TAC_4 `3`]; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`~(4<=3)`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`V_SY (v:real^3^M) = IMAGE vv (:num)`ASSUME_TAC; + + +ASM_REWRITE_TAC[V_SY;rows;IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 4)<=> i= 1\/ i=2 \/ i=3 \/ i=4`] +THEN STRIP_TAC +THENL[ +V_SY_EQ_IMAGE_VV_TAC4 `1`; +V_SY_EQ_IMAGE_VV_TAC4 `2`; +V_SY_EQ_IMAGE_VV_TAC4 `3`; +V_SY_EQ_IMAGE_VV_TAC4 `4`]; + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 4<4)==> (x' MOD 4=0) \/ (x' MOD 4=1) \/ (x' MOD 4=2)\/ (x' MOD 4=3)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_MOD_TAC_4 `4`; +PROVE_E_SY_EQ_MOD_TAC_4 `1`; +PROVE_E_SY_EQ_MOD_TAC_4 `2`; +PROVE_E_SY_EQ_MOD_TAC_4 `3`]; + + + + +SUBGOAL_THEN`E_SY (v:real^3^M) = IMAGE (\i. {vv i, vv (SUC i)}) (:num)`ASSUME_TAC; + + +ASM_REWRITE_TAC[E_SY;rows;IMAGE;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 4)<=> i= 1\/ i=2 \/ i=3 \/ i=4`] +THEN RESA_TAC +THENL[ +PROOF_E_EQ_TAC_4`1`; +PROOF_E_EQ_TAC_4`2`; +PROOF_E_EQ_TAC_4`3`; +PROOF_E_EQ_TAC_4`4`]; + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 4<4)==> (x' MOD 4=0) \/ (x' MOD 4=1) \/ (x' MOD 4=2)\/ (x' MOD 4=3)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_IMAGE_VV_4 `4`; +PROVE_E_SY_EQ_IMAGE_VV_4 `1`; +PROVE_E_SY_EQ_IMAGE_VV_4 `2`; +PROVE_E_SY_EQ_IMAGE_VV_4 `3`]; + +SUBGOAL_THEN`F_SY (v:real^3^M) = IMAGE (\i. (vv i, vv (SUC i))) (:num)`ASSUME_TAC; + + +ASM_REWRITE_TAC[F_SY;rows;IMAGE;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 4)<=> i= 1\/ i=2 \/ i=3 \/ i=4`] +THEN RESA_TAC +THENL[ +PROOF_E_EQ_TAC_4`1`; +PROOF_E_EQ_TAC_4`2`; +PROOF_E_EQ_TAC_4`3`; +PROOF_E_EQ_TAC_4`4`]; + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 4<4)==> (x' MOD 4=0) \/ (x' MOD 4=1) \/ (x' MOD 4=2)\/ (x' MOD 4=3)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_IMAGE_VV_4 `4`; +PROVE_E_SY_EQ_IMAGE_VV_4 `1`; +PROVE_E_SY_EQ_IMAGE_VV_4 `2`; +PROVE_E_SY_EQ_IMAGE_VV_4 `3`]; + +POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[]; +]);; + (* }}} *) + + + + + + + +let XWITCCN_CASE_4_3=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (#0.467) (cs_adj 4 (&2) (&3)) (cs_adj 4 (&2 * h0) upperbd))=s + /\ vv IN BBs_v39 s /\ + taustar_v39 s vv < &0 +/\ scs_k_v39 s= dimindex(:M) + ==> ~(BBprime_v39 s = {})`, + (* {{{ proof *) +[ +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC SCS_4_3_IS_TRI_STABLE +THEN RESA_TAC +THEN MP_TAC NOT_EMPTY_CASE_4_3 +THEN RESA_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`] +THEN ABBREV_TAC`s1 =stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s)(scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))` +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s)(scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN SUBGOAL_THEN`scs_k_v39 s =4` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;]; + +POP_ASSUM (fun th-> +REPLICATE_TAC 11 (POP_ASSUM MP_TAC) +THEN REWRITE_TAC[th] +THEN STRIP_TAC +THEN POP_ASSUM(fun th1-> ASSUME_TAC(SYM th1)) +THEN ASSUME_TAC th +THEN REPEAT RESA_TAC) +THEN MRESAL_TAC (GEN_ALL HDPLYGY)[`(scs_k_v39 s)`;`s1:stable_sy`][k_sy;B_SY1;ARITH_RULE`2<4`;] +THEN POP_ASSUM (fun th-> +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN REWRITE_TAC[BBprime_v39;IN] +THEN ABBREV_TAC`( vv1 i = +if i MOD scs_k_v39 s = 0 then row 4 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +if i MOD scs_k_v39 s = 2 then row 2 v else +row 3 (v:real^3^M))` +THEN EXISTS_TAC`vv1:num->real^3` +THEN STRIP_TAC; + +ONCE_REWRITE_TAC[GSYM IN] +THEN MATCH_MP_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_4_3) +THEN EXISTS_TAC`x:real^(M,3)finite_product` +THEN EXISTS_TAC`v:real^3^M` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; + +SUBGOAL_THEN`vector [ vv1 1; vv1 2; (vv1:num->real^3) 3;vv1 0] = v:real^3^M` +ASSUME_TAC; + +POP_ASSUM(fun th-> REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`1 MOD 4=1/\ 2 MOD 4=2/\ 3 MOD 4=3/\ 0 MOD 4=0 /\ ~(1=0)/\ ~(2=0)/\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2)`;] +THEN ONCE_REWRITE_TAC[CART_EQ] +THEN ASM_REWRITE_TAC[ARITH_RULE`1<=i/\ i<=4 <=>i=1\/ i=2\/ i=3\/ i=4`] +THEN REPEAT RESA_TAC +THEN +ASM_SIMP_TAC[row;vector; LAMBDA_BETA; DIMINDEX_3; LENGTH; ARITH] THEN +REWRITE_TAC[num_CONV `3`;num_CONV `2`; num_CONV `1`; EL; HD; TL;] +THEN ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;row;LAMBDA_BETA]; + +STRIP_TAC; + +GEN_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM IN] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_4_3) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_4_3)[`v:real^3^M`;`s:scs_v39`;`vv1:num->real^3`;`s1:stable_sy`;`x:real^(M,3)finite_product`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_4_3) +[`vector [ww 1; ww 2; ww 3; ww 0]:real^3^M`;`s:scs_v39`;`ww:num->real^3`;`s1:stable_sy`;`matvec(vector [ww 1; ww 2; ww 3; ww 0]:real^3^M):real^(M,3)finite_product`;] +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_CASE_4_3)[`ww:num->real^3`;`vector [ww 1; ww 2; ww 3; ww 0]:real^3^M`;`matvec(vector [ww 1; ww 2; ww 3; ww 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th `matvec(vector [ww 1; ww 2; ww 3; ww 0]:real^3^M):real^(M,3)finite_product`); + +MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_4_3) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_4_3)[`v:real^3^M`;`s:scs_v39`;`vv1:num->real^3`;`s1:stable_sy`;`x:real^(M,3)finite_product`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_4_3) +[`vector [vv 1; vv 2; vv 3; vv 0]:real^3^M`;`s:scs_v39`;`vv:num->real^3`;`s1:stable_sy`;`matvec(vector [vv 1; vv 2; vv 3; vv 0]:real^3^M):real^(M,3)finite_product`;] +THEN REPLICATE_TAC 23 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_CASE_4_3)[`vv:num->real^3`;`vector [vv 1; vv 2; vv 3; vv 0]:real^3^M`;`matvec(vector [vv 1; vv 2; vv 3; vv 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th `matvec(vector [vv 1; vv 2; vv 3; vv 0]:real^3^M):real^(M,3)finite_product`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC +]);; + (* }}} *) + + + + + + + + + + + + + + + + + + + + + + + +let IN_BALL_ANNULUS_TAC_4= +fun (th:term) -> +ASM_SIMP_TAC[] +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`][ARITH_RULE`1<= 4 /\ 2<= 4 /\ 3<= 4 /\ 4<= 4`] +THEN MATCH_MP_TAC(SET_RULE` +vv th IN IMAGE vv (:num) /\ IMAGE vv (:num) SUBSET ball_annulus +==> vv th IN ball_annulus`) +THEN ASM_REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC th +THEN REWRITE_TAC[SET_RULE`(a:num) IN (:num)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`4`;`vv:num-> real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`4:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT RESA_TAC) +;; + + + + + +let INEQUALITY_A_B_TAC_40= +fun (so:term) (so1:term)-> +ASM_SIMP_TAC[change_type_v3] +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 0 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 0 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)`] +THEN REPLICATE_TAC 12 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL_TAC th[so;so1][dist;ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 0 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 0 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0 /\ 4 MOD 4 =0/\ SUC 4 MOD 4 =1 /\ ~(2=0)/\ ~(3=0)/\ ~(2=3)/\ ~(3=1)/\ ~(1=0)`;SET_RULE`({A,B}= {C,B})<=> A=C`;SET_RULE`({B,A}= {B,C})<=> A=C`;SET_RULE`({A,B}= {B,C})<=> A=C`;SET_RULE`{A,B}={B,A}`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`4`;`vv:num-> real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`4:num`[ARITH_RULE`4 MOD 4=0`]) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT RESA_TAC) +;; + + +let INEQUALITY_A_B_TAC_4= +fun (th:term)-> +MP_TAC(ARITH_RULE`1<= i /\ i<= 4==> i=1\/ i=2\/ i=3\/ i=4`) +THEN RESA_TAC +THENL[ +INEQUALITY_A_B_TAC_40 `1` th; +INEQUALITY_A_B_TAC_40 `2` th; +INEQUALITY_A_B_TAC_40 `3` th; +INEQUALITY_A_B_TAC_40 `4` th];; + + + + +let EQ_V_SY_TAC_4= +fun (th:term)-> +ASM_REWRITE_TAC[] +THEN EXISTS_TAC th +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 4 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)`;SET_RULE`(a:num) IN (:num)`] +;; + + +let PROVE_V_SY_EQ_TAC= +fun (th:term)-> +EXISTS_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= 1 /\ 1<= 4`] +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 4 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)/\ 1<=2 /\ 1<=3`] +;; + + + + +let PROVE_E_SY_EQ_TAC= +fun (th:term)-> +EXISTS_TAC th +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 4 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)/\ SUC 1=2/\ SUC 0=1 /\ SUC 2= 3/\ SUC 3=4`;SET_RULE`(a:num) IN (:num)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`4`;`vv:num-> real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`SUC 3`[ARITH_RULE`SUC 3 MOD 4=0/\ SUC 3=4`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]);; + + +let PROVE_E_SY_INV_TAC_4= +fun (th:term)-> +MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`x':num`;th;`4`][ARITH_RULE`~(4=0)/\ 4 MOD 4=0/\ SUC 0 MOD 4=1/\ 1 MOD 4=1 /\ 2 MOD 4=2 /\ 3 MOD 4=3`] +THEN EXISTS_TAC th +THEN MRESAL_TAC VECTOR_3_4[`(vv:num->real^3) 1`;`(vv:num->real^3) 2`;`(vv:num->real^3) 3`;`(vv:num->real^3) 0`;][ARITH_RULE`1<=4/\ 2<=4/\ 3<=4/\ 4<=4/\ 4 MOD 4= 0 /\ 1 MOD 4= 1 /\ 2 MOD 4= 2/\ 3 MOD 4= 3/\ ~(2=1) +/\ SUC 4 MOD 4= 1 /\ SUC 1 MOD 4= 2 /\ SUC 2 MOD 4= 3/\ SUC 3 MOD 4= 0/\ ~(3=1)/\ ~(1=0)/\ SUC 1=2/\ SUC 0=1 /\ SUC 2= 3/\ SUC 3=4/\ 1<=1 /\ 1<=2 /\ 1<=3`];; + + + + +let V_E_FF_CASE_4_sqrt8=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (#0.477) (a_pro 4 (&2 * h0) (&2) sqrt8) (a_pro 4 sqrt8 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +==> +V_SY (v:real^3^M)=IMAGE vv (:num)/\ + E_SY (v:real^3^M)=IMAGE (\i. {vv i, vv (SUC i)}) (:num)/\ +F_SY (v:real^3^M)=IMAGE (\i. vv i,vv (SUC i)) (:num)`, + (* {{{ proof *) +[ + +STRIP_TAC +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39] +THEN REPEAT STRIP_TAC; + + +REWRITE_TAC[V_SY;rows] +THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 4)<=> (i=1\/ i=2\/ i=3 \/ i=4)`] THEN ASSUME_TAC (SYM th)) +THEN STRIP_TAC +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +REPEAT STRIP_TAC +THENL[ +EQ_V_SY_TAC_4 `1`; +EQ_V_SY_TAC_4 `2`; +EQ_V_SY_TAC_4 `3`; +EQ_V_SY_TAC_4 `0`]; + +REPEAT STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4)<=> (1<= i /\ i<= 4)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`4`;`vv:num-> real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 4 < 4==> x' MOD 4 =0 \/ x' MOD 4 = 1\/ x' MOD 4 = 2 \/ x' MOD 4 =3`) +THEN RESA_TAC +THENL[ +PROVE_V_SY_EQ_TAC `4`; +PROVE_V_SY_EQ_TAC `1`; +PROVE_V_SY_EQ_TAC `2`; +PROVE_V_SY_EQ_TAC `3`]; + + +REWRITE_TAC[E_SY;rows] +THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 4)<=> (i=1\/ i=2\/ i=3 \/ i=4)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THENL[ +PROVE_E_SY_EQ_TAC `1`; +PROVE_E_SY_EQ_TAC `2`; +PROVE_E_SY_EQ_TAC `3`; +PROVE_E_SY_EQ_TAC `0`]; + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4)<=> (1<= i /\ i<= 4)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`4`;`vv:num-> real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num` THEN MRESA1_TAC th`SUC x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 4 < 4==> x' MOD 4 =0 \/ x' MOD 4 = 1\/ x' MOD 4 = 2 \/ x' MOD 4 =3`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_INV_TAC_4 `4`; +PROVE_E_SY_INV_TAC_4 `1`; +PROVE_E_SY_INV_TAC_4 `2`; +PROVE_E_SY_INV_TAC_4 `3`]; + +REWRITE_TAC[F_SY;rows] +THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 4)<=> (i=1\/ i=2\/ i=3 \/ i=4)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN ONCE_REWRITE_TAC[GSYM EXTENSION] +THEN EQ_TAC; + +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THENL[ +PROVE_E_SY_EQ_TAC `1`; +PROVE_E_SY_EQ_TAC `2`; +PROVE_E_SY_EQ_TAC `3`; +PROVE_E_SY_EQ_TAC `0`]; + +STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE` (i=1\/ i=2\/ i=3 \/ i=4)<=> (1<= i /\ i<= 4)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`4`;`vv:num-> real^3`][ARITH_RULE`~(4=0)`] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num` THEN MRESA1_TAC th`SUC x':num`) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 4 < 4==> x' MOD 4 =0 \/ x' MOD 4 = 1\/ x' MOD 4 = 2 \/ x' MOD 4 =3`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_INV_TAC_4 `4`; +PROVE_E_SY_INV_TAC_4 `1`; +PROVE_E_SY_INV_TAC_4 `2`; +PROVE_E_SY_INV_TAC_4 `3`]; +]);; + (* }}} *) + + + + + + +let IN_NOT_EMPTY_CASE_4_sqrt8=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (#0.477) (a_pro 4 (&2 * h0) (&2) sqrt8) (a_pro 4 sqrt8 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +==> +a IN {matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ CONDITION2_SY v }`, + (* {{{ proof *) +[ +REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;IN_ELIM_THM;CONDITION1_SY;CONDITION2_SY] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;BBs_v39;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;CS_ADJ] +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[IN] +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:real^3^M` +THEN STRIP_TAC; + +STRIP_TAC; + +REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 4)<=> (i=1\/ i=2\/ i=3 \/ i=4)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THENL[ +IN_BALL_ANNULUS_TAC_4 `1`; +IN_BALL_ANNULUS_TAC_4 `2`; +IN_BALL_ANNULUS_TAC_4 `3`; +IN_BALL_ANNULUS_TAC_4 `4`]; + +STRIP_TAC; + +REPLICATE_TAC 2 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`(1<= i /\ i<= 4)<=> (i=1\/ i=2\/ i=3 \/ i=4)`] THEN ASSUME_TAC (SYM th)) +THEN REPEAT DISCH_TAC +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THENL[ +INEQUALITY_A_B_TAC_4 `1`; +INEQUALITY_A_B_TAC_4 `2`; +INEQUALITY_A_B_TAC_4 `3`; +INEQUALITY_A_B_TAC_4 `0`]; + + + +MP_TAC V_E_FF_CASE_4_sqrt8 +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;CS_ADJ] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN REPEAT RESA_TAC; + +ASM_REWRITE_TAC[] +]);; + (* }}} *) + + + + + + + + + + +let NOT_EMPTY_CASE_4_sqrt8=prove_by_refinement( +`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (#0.477) (a_pro 4 (&2 * h0) (&2) sqrt8) (a_pro 4 sqrt8 (&2 * h0) upperbd)) +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +==> +~({matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ CONDITION2_SY v }={})` +, + (* {{{ proof *) +[ +REWRITE_TAC[SET_RULE`~(A={})<=> (?a. a IN A)`;] +THEN STRIP_TAC +THEN ABBREV_TAC`v=vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 0]:real^3^M` +THEN ABBREV_TAC`a=matvec (v:real^3^M) ` +THEN EXISTS_TAC`a:real^(M,3)finite_product` +THEN MATCH_MP_TAC IN_NOT_EMPTY_CASE_4_sqrt8 +THEN ASM_REWRITE_TAC[] +]);; + (* }}} *) + + +let TAUSTAR_EQ_TAU_STAR_4_sqrt8=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (#0.477) (a_pro 4 (&2 * h0) (&2) sqrt8) (a_pro 4 sqrt8 (&2 * h0) upperbd))=s +/\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +/\ vector[(vv:num->real^3) 1;(vv:num->real^3) 2;(vv:num->real^3) 3;(vv:num->real^3) 0]:real^3^M= v +/\ matvec (v:real^3^M) =a +/\ stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s)(scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))=s1 +==> taustar_v39 s vv = tau_star s1 a`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN MP_TAC V_E_FF_CASE_4_sqrt8 +THEN RESA_TAC +THEN SUBGOAL_THEN`scs_k_v39 s =4` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;]; + +POP_ASSUM MP_TAC +THEN RESA_TAC +THEN ASM_REWRITE_TAC[taustar_v39;tau_star] +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;] +THEN ASM_SIMP_TAC[dsv_J_empty] +THEN MP_TAC SCS_4_sqrt8_IS_TRI_STABLE +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN STRIP_TAC +THEN MRESAL_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s)(scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`][LET_DEF;LET_END_DEF;d_fun] +THEN SUBGOAL_THEN`J1_SY (s1:stable_sy)={}` ASSUME_TAC; + +ASM_REWRITE_TAC[J1_SY;] +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_J_v39_explicit;LET_DEF;LET_END_DEF;mk_unadorned_v39;change_type_v2;SET_RULE`a IN {{i, j} | F}<=> F`] +THEN SET_TAC[]; + +ASM_REWRITE_TAC[SUM_CLAUSES;REAL_ARITH`a* &0= &0 /\a + &0=a`] +THEN EXPAND_TAC"a" +THEN REWRITE_TAC[MATVEC_VECMATS_ID;VECMATS_MATVEC_ID] +THEN ASM_REWRITE_TAC[REAL_ARITH`A-B=A-C<=>B=C`] +THEN MATCH_MP_TAC dsv_J_empty +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_J_v39_explicit;LET_DEF;LET_END_DEF;mk_unadorned_v39;change_type_v2;SET_RULE`a IN {{i, j} | F}<=> F`] +]);; + (* }}} *) + + + + + +let VV_IN_BALL_ANNULUS_TAC_4= +fun (so:term)-> +REPLICATE_TAC 8 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL1_TAC th so [ARITH_RULE`1<=1 /\ 1<=2 /\1<=3 /\ 1<= 4/\ 1<=4 /\ 2<=4/\ 3<=4/\ 4<=4/\ ~(1=0)/\ ~(2=0) /\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2) `] ) +;; + + + + + + + +let SCS_A_B__EQ_MOD_4_sqrt8=prove( +`s=(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (#0.477) (a_pro 4 (&2 * h0) (&2) sqrt8) (a_pro 4 sqrt8 (&2 * h0) upperbd)) +==> +!i j. scs_a_v39 s i j = scs_a_v39 s (i MOD 4) (j MOD 4)/\ + scs_b_v39 s i j = scs_b_v39 s (i MOD 4) (j MOD 4)`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;CS_ADJ] +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC MOD_MOD_REFL[`j:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`j:num`;`1:num`;`4`][ARITH_RULE`~(4=0) /\ 1 MOD 4=1`;ADD1] +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`1:num`;`4`][ARITH_RULE`~(4=0) /\ 1 MOD 4=1`;ADD1]);; + + + + + +let PROVE_INEQUALITY_TAC_40= +fun (so:term) (so1:term)-> +REPLICATE_TAC 7(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESAL_TAC th[so;so1][ARITH_RULE`1<=4 /\ 4<=4/\ 1<=1 /\ 1<=4/\ 1<=2 /\ 2<=4/\1<=3 /\ 3<=4`]) +THEN POP_ASSUM( fun th-> +POP_ASSUM( fun th1-> +REPEAT DISCH_TAC +THEN MP_TAC th THEN MP_TAC th1 +THEN POP_ASSUM(fun th2-> ONCE_REWRITE_TAC[th2] +THEN POP_ASSUM(fun th3-> MRESAL1_TAC th3`4`[ARITH_RULE`4 MOD 4=0`] +THEN MRESAL1_TAC th3`1`[ARITH_RULE`1 MOD 4=1/\ ~(1=0)`] +THEN MRESAL1_TAC th3`2`[ARITH_RULE`2 MOD 4=2/\ ~(2=0)/\ ~(2=1)`] +THEN MRESAL1_TAC th3`3`[ARITH_RULE`3 MOD 4=3/\ ~(3=0)/\ ~(3=1)/\ ~(3=2)`]) +THEN MRESAL1_TAC th2`4`[ARITH_RULE`4 MOD 4=0`]) +)) +THEN MP_TAC SCS_A_B__EQ_MOD_4_sqrt8 +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`4 MOD 4=0/\ 1 MOD 4=1/\ 2 MOD 4=2 /\ 3 MOD 4=3`] +THEN RESA_TAC +THEN RESA_TAC +;; + + +let PROVE_INEQUALITY_TAC_4= +fun (th:term)-> +MP_TAC(ARITH_RULE`(j MOD 4<4)==> (j MOD 4=0) \/ (j MOD 4=1) \/ (j MOD 4=2)\/ (j MOD 4=3)`) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_40 th `4`; +PROVE_INEQUALITY_TAC_40 th `1`; +PROVE_INEQUALITY_TAC_40 th `2`; +PROVE_INEQUALITY_TAC_40 th `3`];; + + + +let V_SY_EQ_IMAGE_VV_TAC4= +fun (th:term)-> +ASM_REWRITE_TAC[] +THEN EXISTS_TAC th +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN (:num)`;ARITH_RULE`1 MOD 4=1 /\ ~(1=0) /\ 2 MOD 4=2 /\ ~(2=0)/\ ~(2=1)/\ 3 MOD 4=3 /\ ~(3=0)/\ ~(3=1)/\ ~(3=2)/\ 4 MOD 4=0`];; + + + +let PROVE_E_SY_EQ_MOD_TAC_4= +fun (th:term)-> +EXISTS_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`~(3=0)/\ ~(3=1)/\ ~(3=2)/\ ~(2=0)/\ ~(2=1)/\ ~(1=0)`] +THEN ARITH_TAC;; + + + +let PROVE_E_SY_EQ_IMAGE_VV_4= +fun (so:term)-> +EXISTS_TAC so +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)`] +THEN MRESAL_TAC MOD_ADD_MOD[`x':num`;`1:num`;`4`][ARITH_RULE`~(4=0) /\ 1 MOD 4=1/\ 1<=4/\ 4<=4/\ 0+1=1`;ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`~(1=0)/\ 4 MOD 4=0/\ 0+1=1/\ 1<=1 /\ 1+1=2/\ 2 MOD 4=2/\ ~(2=0)/\ ~(2=1)/\ 2+1=3/\ 3 MOD 4=3 +/\ ~(3=0)/\ ~(3=1)/\ ~(3=2)/\1<=2/\ 2<=4 +/\ 1<=3/\ 3<=4/\ 3+1=4`]) +;; + + + +let PROOF_E_EQ_TAC_4= +fun (th:term)-> +EXISTS_TAC th +THEN ASM_REWRITE_TAC[ARITH_RULE`~(1=0)/\ 1 MOD 4=1/\ SUC 1=2/\ 2 MOD 4=2/\ ~(2=0)/\ ~(2=1)/\ SUC 2=3 /\ 3 MOD 4=3/\ ~(3=0) /\ ~(3=1)/\ ~(3=2)/\ SUC 3=4/\ 4 MOD 4=0/\ SUC 0=1 /\ SUC 4=5/\ 5 MOD 4=1`;SET_RULE`(a:num) IN (:num)`] +;; + + + +let IN_NOT_EMPTY_B1_SY_4_sqrt8=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (#0.477) (a_pro 4 (&2 * h0) (&2) sqrt8) (a_pro 4 sqrt8 (&2 * h0) upperbd))=s/\ + scs_k_v39 s= dimindex(:M)/\ + matvec (v:real^3^M) =a/\ +(!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ + CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ + CONDITION2_SY v +/\ (!i. vv i = +if i MOD scs_k_v39 s = 0 then row 4 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +if i MOD scs_k_v39 s = 2 then row 2 v else +row 3 v) +==> vv IN BBs_v39 s`, + (* {{{ proof *) +[ +REWRITE_TAC[CONDITION1_SY;CONDITION2_SY;change_type_v3] +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`scs_k_v39 s =4` ASSUME_TAC; + + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;]; + +POP_ASSUM (fun th-> +REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th1-> ASSUME_TAC(SYM th1)) +THEN ASSUME_TAC th +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[th;IN] +THEN STRIP_TAC +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;] +THEN STRIP_TAC; + +ASM_REWRITE_TAC[IMAGE;SUBSET;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`x' MOD 4<4 ==> x' MOD 4 = 0 \/ x' MOD 4 = 1 \/ x' MOD 4 = 2 \/ x' MOD 4 = 3`) +THEN RESA_TAC +THENL[ +VV_IN_BALL_ANNULUS_TAC_4 `4`; +VV_IN_BALL_ANNULUS_TAC_4 `1`; +VV_IN_BALL_ANNULUS_TAC_4 `2`; +VV_IN_BALL_ANNULUS_TAC_4 `3`]; + + +STRIP_TAC; + +ASM_REWRITE_TAC[periodic] +THEN GEN_TAC +THEN MRESAL_TAC MOD_EQ[`i+4:num`;`i:num`;`4:num`;`1`][ARITH_RULE`1*A=A`]; + +STRIP_TAC; + +REWRITE_TAC[dist] +THEN REPEAT GEN_TAC +THEN SUBGOAL_THEN`!i. (vv:num->real^3) i= vv (i MOD 4)` ASSUME_TAC; + +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN GEN_TAC +THEN MRESAL_TAC MOD_MOD_REFL[`i:num`;`4`][ARITH_RULE`~(4=0)`]; + + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC DIVISION[`i:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC DIVISION[`j:num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`(i MOD 4<4)==> (i MOD 4=0) \/ (i MOD 4=1) \/ (i MOD 4=2)\/ (i MOD 4=3)`) +THEN RESA_TAC +THENL[ +PROVE_INEQUALITY_TAC_4 `4`; +PROVE_INEQUALITY_TAC_4 `1`; +PROVE_INEQUALITY_TAC_4 `2`; +PROVE_INEQUALITY_TAC_4 `3`]; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`~(4<=3)`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`V_SY (v:real^3^M) = IMAGE vv (:num)`ASSUME_TAC; + + +ASM_REWRITE_TAC[V_SY;rows;IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 4)<=> i= 1\/ i=2 \/ i=3 \/ i=4`] +THEN STRIP_TAC +THENL[ +V_SY_EQ_IMAGE_VV_TAC4 `1`; +V_SY_EQ_IMAGE_VV_TAC4 `2`; +V_SY_EQ_IMAGE_VV_TAC4 `3`; +V_SY_EQ_IMAGE_VV_TAC4 `4`]; + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 4<4)==> (x' MOD 4=0) \/ (x' MOD 4=1) \/ (x' MOD 4=2)\/ (x' MOD 4=3)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_MOD_TAC_4 `4`; +PROVE_E_SY_EQ_MOD_TAC_4 `1`; +PROVE_E_SY_EQ_MOD_TAC_4 `2`; +PROVE_E_SY_EQ_MOD_TAC_4 `3`]; + + + + +SUBGOAL_THEN`E_SY (v:real^3^M) = IMAGE (\i. {vv i, vv (SUC i)}) (:num)`ASSUME_TAC; + + +ASM_REWRITE_TAC[E_SY;rows;IMAGE;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 4)<=> i= 1\/ i=2 \/ i=3 \/ i=4`] +THEN RESA_TAC +THENL[ +PROOF_E_EQ_TAC_4`1`; +PROOF_E_EQ_TAC_4`2`; +PROOF_E_EQ_TAC_4`3`; +PROOF_E_EQ_TAC_4`4`]; + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 4<4)==> (x' MOD 4=0) \/ (x' MOD 4=1) \/ (x' MOD 4=2)\/ (x' MOD 4=3)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_IMAGE_VV_4 `4`; +PROVE_E_SY_EQ_IMAGE_VV_4 `1`; +PROVE_E_SY_EQ_IMAGE_VV_4 `2`; +PROVE_E_SY_EQ_IMAGE_VV_4 `3`]; + +SUBGOAL_THEN`F_SY (v:real^3^M) = IMAGE (\i. (vv i, vv (SUC i))) (:num)`ASSUME_TAC; + + +ASM_REWRITE_TAC[F_SY;rows;IMAGE;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +ASM_REWRITE_TAC[ARITH_RULE`(1 <= i /\ i <= 4)<=> i= 1\/ i=2 \/ i=3 \/ i=4`] +THEN RESA_TAC +THENL[ +PROOF_E_EQ_TAC_4`1`; +PROOF_E_EQ_TAC_4`2`; +PROOF_E_EQ_TAC_4`3`; +PROOF_E_EQ_TAC_4`4`]; + +RESA_TAC +THEN MRESAL_TAC DIVISION[`x':num`;`4`][ARITH_RULE`~(4=0)`] +THEN MP_TAC(ARITH_RULE`(x' MOD 4<4)==> (x' MOD 4=0) \/ (x' MOD 4=1) \/ (x' MOD 4=2)\/ (x' MOD 4=3)`) +THEN RESA_TAC +THENL[ +PROVE_E_SY_EQ_IMAGE_VV_4 `4`; +PROVE_E_SY_EQ_IMAGE_VV_4 `1`; +PROVE_E_SY_EQ_IMAGE_VV_4 `2`; +PROVE_E_SY_EQ_IMAGE_VV_4 `3`]; + +POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[]; +]);; + (* }}} *) + + + + + +let XWITCCN_CASE_4_sqrt8=prove_by_refinement( +`(let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (#0.477) (a_pro 4 (&2 * h0) (&2) sqrt8) (a_pro 4 sqrt8 (&2 * h0) upperbd))=s + /\ vv IN BBs_v39 s /\ + taustar_v39 s vv < &0 +/\ scs_k_v39 s= dimindex(:M) + ==> ~(BBprime_v39 s = {})`, + (* {{{ proof *) +[ +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC SCS_4_sqrt8_IS_TRI_STABLE +THEN RESA_TAC +THEN MP_TAC NOT_EMPTY_CASE_4_sqrt8 +THEN RESA_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?a. a IN A`] +THEN ABBREV_TAC`s1 =stable_sy((scs_k_v39 s),(scs_d_v39 s),(0..scs_k_v39 s - 1), + (change_type_v3 (scs_a_v39 s)), + (change_type_v3 (scs_b_v39 s)), + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s)), + (\i. (1 + i) MOD scs_k_v39 s))` +THEN MRESA_TAC stable_sy_explicit[`(scs_k_v39 s)`;`(scs_d_v39 s)`;`(0..scs_k_v39 s - 1)`;` + (change_type_v3 (scs_a_v39 s))`;` + (change_type_v3 (scs_b_v39 s))`;` + (change_type_v2 (scs_J_v39 s) (scs_k_v39 s))`;` + (\i. (1 + i) MOD scs_k_v39 s)`] +THEN SUBGOAL_THEN`scs_k_v39 s =4` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;]; + +POP_ASSUM (fun th-> +REPLICATE_TAC 11 (POP_ASSUM MP_TAC) +THEN REWRITE_TAC[th] +THEN STRIP_TAC +THEN POP_ASSUM(fun th1-> ASSUME_TAC(SYM th1)) +THEN ASSUME_TAC th +THEN REPEAT RESA_TAC) +THEN MRESAL_TAC (GEN_ALL HDPLYGY)[`(scs_k_v39 s)`;`s1:stable_sy`][k_sy;B_SY1;ARITH_RULE`2<4`;] +THEN POP_ASSUM (fun th-> +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ASSUME_TAC th) +THEN REWRITE_TAC[BBprime_v39;IN] +THEN ABBREV_TAC`( vv1 i = +if i MOD scs_k_v39 s = 0 then row 4 v else +if i MOD scs_k_v39 s = 1 then row 1 v else +if i MOD scs_k_v39 s = 2 then row 2 v else +row 3 (v:real^3^M))` +THEN EXISTS_TAC`vv1:num->real^3` +THEN STRIP_TAC; + +ONCE_REWRITE_TAC[GSYM IN] +THEN MATCH_MP_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_4_sqrt8) +THEN EXISTS_TAC`x:real^(M,3)finite_product` +THEN EXISTS_TAC`v:real^3^M` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN RESA_TAC; + +SUBGOAL_THEN`vector [ vv1 1; vv1 2; (vv1:num->real^3) 3;vv1 0] = v:real^3^M` +ASSUME_TAC; + +POP_ASSUM(fun th-> REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[ARITH_RULE`1 MOD 4=1/\ 2 MOD 4=2/\ 3 MOD 4=3/\ 0 MOD 4=0 /\ ~(1=0)/\ ~(2=0)/\ ~(3=0)/\ ~(2=1)/\ ~(3=1)/\ ~(3=2)`;] +THEN ONCE_REWRITE_TAC[CART_EQ] +THEN ASM_REWRITE_TAC[ARITH_RULE`1<=i/\ i<=4 <=>i=1\/ i=2\/ i=3\/ i=4`] +THEN REPEAT RESA_TAC +THEN +ASM_SIMP_TAC[row;vector; LAMBDA_BETA; DIMINDEX_3; LENGTH; ARITH] THEN +REWRITE_TAC[num_CONV `3`;num_CONV `2`; num_CONV `1`; EL; HD; TL;] +THEN ASM_SIMP_TAC[CART_EQ; DIMINDEX_3; FORALL_3; VEC_COMPONENT; VECTOR_3; ARITH;row;LAMBDA_BETA]; + +STRIP_TAC; + +GEN_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM IN] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_4_sqrt8) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_4_sqrt8)[`v:real^3^M`;`s:scs_v39`;`vv1:num->real^3`;`s1:stable_sy`;`x:real^(M,3)finite_product`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_4_sqrt8) +[`vector [ww 1; ww 2; ww 3; ww 0]:real^3^M`;`s:scs_v39`;`ww:num->real^3`;`s1:stable_sy`;`matvec(vector [ww 1; ww 2; ww 3; ww 0]:real^3^M):real^(M,3)finite_product`;] +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_CASE_4_sqrt8)[`ww:num->real^3`;`vector [ww 1; ww 2; ww 3; ww 0]:real^3^M`;`matvec(vector [ww 1; ww 2; ww 3; ww 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th `matvec(vector [ww 1; ww 2; ww 3; ww 0]:real^3^M):real^(M,3)finite_product`); + +MRESA_TAC (GEN_ALL IN_NOT_EMPTY_B1_SY_4_sqrt8) +[`x:real^(M,3)finite_product`;`v:real^3^M`;`vv1:num->real^3`;`s:scs_v39`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_4_sqrt8)[`v:real^3^M`;`s:scs_v39`;`vv1:num->real^3`;`s1:stable_sy`;`x:real^(M,3)finite_product`] +THEN MRESA_TAC ( GEN_ALL TAUSTAR_EQ_TAU_STAR_4_sqrt8) +[`vector [vv 1; vv 2; vv 3; vv 0]:real^3^M`;`s:scs_v39`;`vv:num->real^3`;`s1:stable_sy`;`matvec(vector [vv 1; vv 2; vv 3; vv 0]:real^3^M):real^(M,3)finite_product`;] +THEN REPLICATE_TAC 23 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN MRESA_TAC (GEN_ALL IN_NOT_EMPTY_CASE_4_sqrt8)[`vv:num->real^3`;`vector [vv 1; vv 2; vv 3; vv 0]:real^3^M`;`matvec(vector [vv 1; vv 2; vv 3; vv 0]:real^3^M):real^(M,3)finite_product`;`s:scs_v39`;] +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th `matvec(vector [vv 1; vv 2; vv 3; vv 0]:real^3^M):real^(M,3)finite_product`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC +]);; + (* }}} *) + + + + + + + + + + + + +let NOT_EMPTY_BBs_v39= prove( +` !s vv. MEM s s_init_list_v39 /\ vv IN BBs_v39 s +/\ scs_k_v39 s= dimindex(:M) +==> +~({matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v }={}) +\/ +~({matvec(v:real^3^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) /\ CONDITION1_SY (change_type_v3 (scs_a_v39 s)) (change_type_v3 (scs_b_v39 s)) v /\ CONDITION2_SY v } ={}) +`, +REWRITE_TAC[s_init_list_v39;JEJTVGB_assume_v39;GSYM IN_SET_OF_LIST;taustar_v39;set_of_list;LET_DEF;LET_END_DEF +;SET_RULE`A IN {A1,A2,A3,A4,A5,A6,A7,A8} <=> A= A1 \/ A= A2 \/ A= A3 \/ A= A4 \/ A= A5 \/ A= A6 \/ A= A7 \/ A= A8`] +THEN REPEAT STRIP_TAC +THEN MP_TAC NOT_EMPTY_CASE_3 +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN RESA_TAC +THEN MP_TAC NOT_EMPTY_CASE_4 +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN RESA_TAC +THEN MP_TAC NOT_EMPTY_CASE_5 +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN RESA_TAC +THEN MP_TAC NOT_EMPTY_CASE_6 +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN RESA_TAC +THEN MP_TAC NOT_EMPTY_CASE_4_3 +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN RESA_TAC +THEN MP_TAC NOT_EMPTY_CASE_4_sqrt8 +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN RESA_TAC +THEN MP_TAC NOT_EMPTY_CASE_5_sqrt8 +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN RESA_TAC +THEN MP_TAC NOT_EMPTY_CASE_5_pro_cs +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN RESA_TAC);; + + + + + + +let XWITCCN_TYPE= prove( +` !s vv. MEM s s_init_list_v39 /\ vv IN BBs_v39 s +/\ taustar_v39 s vv < &0 +/\ scs_k_v39 s= dimindex(:M) + ==> ~(BBprime_v39 s = {}) +`, +REWRITE_TAC[s_init_list_v39;JEJTVGB_assume_v39;GSYM IN_SET_OF_LIST;set_of_list;LET_DEF;LET_END_DEF +;SET_RULE`A IN {A1,A2,A3,A4,A5,A6,A7,A8} <=> A= A1 \/ A= A2 \/ A= A3 \/ A= A4 \/ A= A5 \/ A= A6 \/ A= A7 \/ A= A8`] +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC XWITCCN_CASE_3 +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN RESA_TAC +THEN MP_TAC XWITCCN_CASE_4 +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN RESA_TAC +THEN MP_TAC XWITCCN_CASE_5 +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN RESA_TAC +THEN MP_TAC XWITCCN_CASE_6 +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN RESA_TAC +THEN MP_TAC XWITCCN_CASE_4_3 +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN RESA_TAC +THEN MP_TAC XWITCCN_CASE_4_sqrt8 +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN RESA_TAC +THEN MP_TAC XWITCCN_CASE_5_sqrt8 +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN RESA_TAC +THEN MP_TAC XWITCCN_CASE_5_pro_cs +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN RESA_TAC);; + + + + + +let XWITCCN= prove(` !s vv . MEM s s_init_list_v39 /\ vv IN BBs_v39 s +/\ taustar_v39 s vv < &0 + ==> ~(BBprime_v39 s = {})`, +REPEAT GEN_TAC +THEN DISCH_TAC +THEN MP_TAC(INST_TYPE [`:3`,`:M`]XWITCCN_TYPE) +THEN ASM_REWRITE_TAC[DIMINDEX_3] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`vv:num->real^3`]) +THEN MP_TAC(INST_TYPE [`:2+2`,`:M`]XWITCCN_TYPE) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_4] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`vv:num->real^3`]) +THEN MP_TAC(INST_TYPE [`:2+3`,`:M`]XWITCCN_TYPE) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_5] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`vv:num->real^3`]) +THEN MP_TAC(INST_TYPE [`:3+3`,`:M`]XWITCCN_TYPE) +THEN ASM_REWRITE_TAC[Basics.DIMINDEX_6] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`vv:num->real^3`]) +THEN ASM_TAC +THEN REWRITE_TAC[s_init_list_v39;JEJTVGB_assume_v39;GSYM IN_SET_OF_LIST;set_of_list;LET_DEF;LET_END_DEF +;SET_RULE`A IN {A1,A2,A3,A4,A5,A6,A7,A8} <=> A= A1 \/ A= A2 \/ A= A3 \/ A= A4 \/ A= A5 \/ A= A6 \/ A= A7 \/ A= A8`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[scs_k_v39_explicit;scs_d_v39_explicit;scs_a_v39_explicit;scs_b_v39_explicit;BBs_v39;ARITH_RULE`3<=3`;LET_DEF;LET_END_DEF;ARITH_RULE`~(4<=3)`;IN;mk_unadorned_v39;] +THEN REPEAT RESA_TAC +);; + + + +(* + +*) + + end;; + + + + + diff --git a/text_formalization/local/YRTAFYH.hl b/text_formalization/local/YRTAFYH.hl new file mode 100644 index 0000000..01aee95 --- /dev/null +++ b/text_formalization/local/YRTAFYH.hl @@ -0,0 +1,520 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Yrtafyh = struct + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +open Yxionxl2;; +open Eyypqdw;; +open Ocbicby;; +open Imjxphr;; + +open Nuxcoea;; +open Fektyiy;; + +let SUR_MOD_FUN=prove(`~(k=0)==> ?i. (i+p) MOD k = p' MOD k`, +STRIP_TAC +THEN MP_TAC(ARITH_RULE`p MOD k<= p' MOD k\/ p' MOD k< p MOD k`) +THEN RESA_TAC +THENL[ +EXISTS_TAC`p' MOD k- p MOD k` +THEN MRESA_TAC DIVISION[`p'`;`k`] +THEN MP_TAC(ARITH_RULE`p' MOD k< k /\ p MOD k<= p' MOD k ==> p' MOD k - p MOD k < k /\ p' MOD k - p MOD k + p MOD k= p' MOD k`) +THEN RESA_TAC +THEN MRESAS_TAC MOD_LT[`p' MOD k- p MOD k`;`k`][DIVISION] +THEN MRESAS_TAC MOD_ADD_MOD[`p' MOD k- p MOD k`;`p`;`k`][DIVISION;MOD_REFL] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]); + +EXISTS_TAC`p' MOD k +k - p MOD k` +THEN MRESA_TAC DIVISION[`p`;`k`] +THEN MP_TAC(ARITH_RULE`p MOD k< k /\ p' MOD k< p MOD k ==> p' MOD k +k - p MOD k < k /\ (p' MOD k + k - p MOD k) + p MOD k=1*k+ p' MOD k`) +THEN RESA_TAC +THEN MRESAS_TAC MOD_LT[`p' MOD k+k- p MOD k`;`k`][DIVISION] +THEN MRESAS_TAC MOD_ADD_MOD[`p' MOD k+k- p MOD k`;`p`;`k`][DIVISION;MOD_REFL;MOD_MULT_ADD] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])]);; + +let TRANS_DIAG=prove(`~(k=0)/\ (i+p) MOD k = p' MOD k /\ p' + q = p + q' +==> (i+q) MOD k= q' MOD k `, +STRIP_TAC +THEN MATCH_MP_TAC Hdplygy.MOD_EQ_MOD +THEN EXISTS_TAC`p:num` +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[ARITH_RULE`p + i + q= (i +p)+ q:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i+p:num`;`q`;`k`] +THEN POP_ASSUM(fun th-> ASM_SIMP_TAC[SYM th;MOD_ADD_MOD]));; + + +(*************) + + +(*******************) + + +let scs_components = prove_by_refinement( + `!s. dest_scs_v39 s = (scs_k_v39 s,scs_d_v39 s,scs_a_v39 +s,scs_am_v39 s ,scs_bm_v39 s,scs_b_v39 s,scs_J_v39 s, + scs_lo_v39 s,scs_hi_v39 s,scs_str_v39 s)`, + (* {{{ proof *) + [ + REWRITE_TAC[Wrgcvdr_cizmrrh.PAIR_EQ2;scs_k_v39;scs_d_v39;scs_a_v39;]; + REWRITE_TAC[scs_am_v39;scs_bm_v39;scs_b_v39;]; + REWRITE_TAC[scs_J_v39;scs_hi_v39;scs_lo_v39;]; + REWRITE_TAC[scs_str_v39]; + +BY(REWRITE_TAC[Misc_defs_and_lemmas.part1;Misc_defs_and_lemmas.part2;Misc_defs_and_lemmas.part3;Misc_defs_and_lemmas.part4; +Misc_defs_and_lemmas.part5;Misc_defs_and_lemmas.part6;Misc_defs_and_lemmas.part7;Misc_defs_and_lemmas.drop0;Misc_defs_and_lemmas.drop3;Misc_defs_and_lemmas.drop1;Misc_defs_and_lemmas.part0;Misc_defs_and_lemmas.part8;Misc_defs_and_lemmas.drop2]) + ]);; + (* }}} *) + +let scs_inj = prove_by_refinement( + `!s s'. scs_basic_v39 s /\ scs_basic_v39 s' /\ + scs_d_v39 s = scs_d_v39 s' /\ + scs_k_v39 s = scs_k_v39 s' /\ + (scs_a_v39 s = scs_a_v39 s') /\ + (scs_b_v39 s = scs_b_v39 s') + ==> (s = s')`, + + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `scs_basic_v39` MP_TAC); + REWRITE_TAC[scs_basic;unadorned_v39]; + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + REWRITE_TAC[SET_RULE `{} = a <=> a = {}`]; + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[GSYM scs_v39]; + AP_TERM_TAC; + ASM_REWRITE_TAC[scs_components]; + TYPIFY `scs_J_v39 s = scs_J_v39 s'` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_REWRITE_TAC[FUN_EQ_THM]); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + + + +let DIAG_PSORT1=prove_by_refinement(` ~(k=0) /\ (i+p) MOD k = p' MOD k /\ +p' + q = p + q' /\ ~(k=0) /\ (psort k (i',j) = psort k (p,q)) +==> (psort k (i+i',i+j) = psort k (p',q'))`, + +[ +REWRITE_TAC[psort;LET_DEF;LET_END_DEF;COND_EXPAND +] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC TRANS_DIAG +THEN RESA_TAC +THEN MP_TAC(SET_RULE`i' MOD k <= j MOD k \/ ~(i' MOD k <= j MOD k)`) +THEN RESA_TAC; + +MP_TAC(SET_RULE`p MOD k <= q MOD k \/ ~(p MOD k <= q MOD k)`) +THEN RESA_TAC; + +REWRITE_TAC[PAIR_EQ] +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`i'`;`p`;`i`] +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`j`;`q`;`i`]; + +REWRITE_TAC[PAIR_EQ] +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`i'`;`q`;`i`] +THEN MRESAS_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`j`;`p`;`i`][] +THEN MP_TAC(ARITH_RULE`(~(p' MOD k<= q' MOD k))\/ (p' MOD k < q' MOD k ) \/ (p' MOD k = q' MOD k )`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE` ~(p' MOD k<= q' MOD k)==> q' MOD k <= p' MOD k`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE` (p' MOD k< q' MOD k)==> ~(q' MOD k <= p' MOD k)/\ (p' MOD k<= q' MOD k)`) +THEN RESA_TAC; + +MP_TAC(SET_RULE`p MOD k <= q MOD k \/ ~(p MOD k <= q MOD k)`) +THEN RESA_TAC; + +REWRITE_TAC[PAIR_EQ] +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`i'`;`q`;`i`] +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`j`;`p`;`i`]; + + +MP_TAC(ARITH_RULE`(~(p' MOD k<= q' MOD k))\/ (p' MOD k < q' MOD k ) \/ (p' MOD k = q' MOD k )`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE` ~(p' MOD k<= q' MOD k)==> q' MOD k <= p' MOD k`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE` (p' MOD k< q' MOD k)==> ~(q' MOD k <= p' MOD k)/\ (p' MOD k<= q' MOD k)`) +THEN RESA_TAC; + +REWRITE_TAC[PAIR_EQ] +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`i'`;`p`;`i`] +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`j`;`q`;`i`]]);; + + + + + +let DIAG_PSORT2=prove_by_refinement(` ~(k=0) /\ (i+p) MOD k = p' MOD k /\ +p' + q = p + q' /\ ~(k=0) /\ (psort k (i+i',i+j) = psort k (p',q')) +==> +(psort k (i',j) = psort k (p,q))`, +[ +REWRITE_TAC[psort;LET_DEF;LET_END_DEF;COND_EXPAND +] +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC TRANS_DIAG +THEN RESA_TAC +THEN MP_TAC(SET_RULE`(i+i') MOD k <= (i+j) MOD k \/ ~((i+i') MOD k <= (i+j) MOD k)`) +THEN RESA_TAC; + +MP_TAC(SET_RULE`p' MOD k <= q' MOD k \/ ~(p' MOD k <= q' MOD k)`) +THEN RESA_TAC; + +REWRITE_TAC[PAIR_EQ] +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`i'`;`p`;`i`] +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`j`;`q`;`i`]; + +REWRITE_TAC[PAIR_EQ] +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`i'`;`q`;`i`] +THEN MRESAS_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`j`;`p`;`i`][]; + +MP_TAC(ARITH_RULE`(~(p MOD k<= q MOD k))\/ (p MOD k < q MOD k ) \/ (p MOD k = q MOD k )`) +THEN RESA_TAC; + + +MP_TAC(ARITH_RULE` ~(p MOD k<= q MOD k)==> q MOD k <= p MOD k`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE` (p MOD k< q MOD k)==> ~(q MOD k <= p MOD k)/\ (p MOD k<= q MOD k)`) +THEN RESA_TAC; + +MP_TAC(SET_RULE`p' MOD k <= q' MOD k \/ ~(p' MOD k <= q' MOD k)`) +THEN RESA_TAC; + +REWRITE_TAC[PAIR_EQ] +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`i'`;`q`;`i`] +THEN MRESAS_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`j`;`p`;`i`][]; + +MP_TAC(ARITH_RULE`(~(p MOD k<= q MOD k))\/ (p MOD k < q MOD k ) \/ (p MOD k = q MOD k )`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE` ~(p MOD k<= q MOD k)==> q MOD k <= p MOD k`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE` (p MOD k< q MOD k)==> ~(q MOD k <= p MOD k)/\ (p MOD k<= q MOD k)`) +THEN RESA_TAC; + +REWRITE_TAC[PAIR_EQ] +THEN RESA_TAC +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`i'`;`p`;`i`] +THEN MRESA_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`k`;`j`;`q`;`i`]]);; + + + + +let DIAG_PSORT=prove( + ` ~(k=0) /\ (i+p) MOD k = p' MOD k /\ +p' + q = p + q' /\ ~(k=0) +==> +((psort k (i+i',i+j) = psort k (p',q')) +<=> +(psort k (i',j) = psort k (p,q)))`, +STRIP_TAC +THEN EQ_TAC +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC DIAG_PSORT2 +THEN RESA_TAC; +MATCH_MP_TAC DIAG_PSORT1 +THEN RESA_TAC]);; + +let TRANS_DIAG=prove(` +~(k=0) +==> (scs_diag k i' j<=> scs_diag k (i+i') (i+j)) `, +SIMP_TAC[scs_diag;ARITH_RULE`SUC (i + i') = i + (i' + 1)/\ SUC i= i+1`;Ocbicby.MOD_EQ_MOD_SHIFT]);; + + +let A_EQ_PSORT=prove(` is_scs_v39 s /\ psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (p,q) +==> scs_a_v39 s i j= scs_a_v39 s p q`, +REWRITE_TAC[scs_prop_equ_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF; BBs_v39; FUN_EQ_THM;psort] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN MP_TAC(ARITH_RULE`i MOD k <= j MOD k \/ ~(i MOD k <= j MOD k)`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`p MOD k <= q MOD k \/ ~(p MOD k <= q MOD k)`) +THEN RESA_TAC +THEN +REWRITE_TAC[PAIR_EQ] +THEN STRIP_TAC +THEN MRESA_TAC CHANGE_A_SCS_MOD[`i`;`j`;`s`;`p`;`q`] +THEN MRESA_TAC CHANGE_A_SCS_MOD[`j`;`i`;`s`;`p`;`q`] +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC);; + + +let B_EQ_PSORT=prove(` is_scs_v39 s /\ psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (p,q) +==> scs_b_v39 s i j= scs_b_v39 s p q`, +REWRITE_TAC[scs_prop_equ_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF; BBs_v39; FUN_EQ_THM;psort] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN MP_TAC(ARITH_RULE`i MOD k <= j MOD k \/ ~(i MOD k <= j MOD k)`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`p MOD k <= q MOD k \/ ~(p MOD k <= q MOD k)`) +THEN RESA_TAC +THEN +REWRITE_TAC[PAIR_EQ] +THEN STRIP_TAC +THEN MRESA_TAC CHANGE_B_SCS_MOD[`i`;`j`;`s`;`p`;`q`] +THEN MRESA_TAC CHANGE_B_SCS_MOD[`j`;`i`;`s`;`p`;`q`] +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;is_scs_v39] +THEN REPEAT RESA_TAC);; + +let PROPERTY_OF_K_SCS=prove(`is_scs_v39 s==> ~(scs_k_v39 s= 0)/\ 0< scs_k_v39 s/\ 1< scs_k_v39 s/\ 2< scs_k_v39 s`, +STRIP_TAC +THEN MP_TAC Axjrpnc.is_scs_k_le_3 +THEN RESA_TAC +THEN DICH_TAC 0 +THEN ARITH_TAC);; + + +let PSORT_PERIODIC=prove(`~(k=0) ==> psort (k) (i + k,j) = psort (k) (i,j) +/\ psort (k) (i,j+k) = psort (k) (i,j)`, +REPEAT RESA_TAC +THEN REWRITE_TAC[psort;LET_DEF;LET_END_DEF;] +THEN ONCE_REWRITE_TAC[ARITH_RULE`i+k=1*k+i`] +THEN ASM_SIMP_TAC[MOD_MULT_ADD]);; + + +let DIAG_NOT_PSORT = prove_by_refinement( +`~(k=0) /\ scs_diag k i j ==> !i'. ~(psort k (i,j) = psort k (i',SUC i'))`, +[ +REWRITE_TAC[scs_diag;psort;LET_DEF;LET_END_DEF] +THEN STRIP_TAC +THEN GEN_TAC +THEN MP_TAC(ARITH_RULE`i MOD k <= j MOD k\/ ~(i MOD k <= j MOD k)`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE`i' MOD k <= SUC i' MOD k\/ ~(i' MOD k <= SUC i' MOD k)`) +THEN RESA_TAC; + +REWRITE_TAC[PAIR_EQ] +THEN STRIP_TAC +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i'`;`i`;`k`] +THEN POP_ASSUM MP_TAC +THEN SYM_ASSUM_TAC +THEN ASM_REWRITE_TAC[]; + +REWRITE_TAC[PAIR_EQ] +THEN STRIP_TAC +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j`;`i'`;`k`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN ASM_REWRITE_TAC[]; + +MP_TAC(ARITH_RULE`i' MOD k <= SUC i' MOD k\/ ~(i' MOD k <= SUC i' MOD k)`) +THEN RESA_TAC; + + +REWRITE_TAC[PAIR_EQ] +THEN STRIP_TAC +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j`;`i'`;`k`] +THEN POP_ASSUM MP_TAC +THEN SYM_ASSUM_TAC +THEN ASM_REWRITE_TAC[]; + +REWRITE_TAC[PAIR_EQ] +THEN STRIP_TAC +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i'`;`i`;`k`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN SYM_ASSUM_TAC +THEN ASM_REWRITE_TAC[]]);; + + +let YRTAFYH_concl = + `!s i j. + is_scs_v39 s /\ + scs_basic_v39 s /\ + 3 < scs_k_v39 s /\ + scs_diag (scs_k_v39 s) i j /\ + scs_a_v39 s i j <= cstab ==> + is_scs_v39 (scs_stab_diag_v39 s i j) /\ scs_basic_v39 (scs_stab_diag_v39 s i j) + `;; + + +let YRTAFYH= prove_by_refinement(YRTAFYH_concl, +[ + +REPEAT RESA_TAC +THEN MP_TAC PROPERTY_OF_K_SCS +THEN RESA_TAC; + +DICH_TAC 8 +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MP_TAC th THEN ASSUME_TAC(th)) +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;scs_stab_diag_v39;is_scs_v39;scs_v39_explicit;mk_unadorned_v39;scs_basic;periodic;periodic2] +THEN REPEAT RESA_TAC +THEN ABBREV_TAC`k= scs_k_v39 s`; + +SET_TAC[]; + +SET_TAC[]; + +SET_TAC[]; + +SET_TAC[]; + +ASM_SIMP_TAC[PSORT_PERIODIC]; + +ASM_SIMP_TAC[PSORT_PERIODIC]; + +ASM_SIMP_TAC[PSORT_PERIODIC]; + +ASM_SIMP_TAC[PSORT_PERIODIC]; + +ASM_SIMP_TAC[Terminal.psort_sym]; + +REAL_ARITH_TAC; + +MP_TAC(SET_RULE`psort k (i,j) = psort k (i',j') \/ ~(psort k (i,j) = psort k (i',j'))`) +THEN RESA_TAC; + +MRESAL_TAC A_EQ_PSORT[`i'`;`j'`;`s`;`i`;`j`][]; + +THAYTHE_TAC (30-21)[`i'`;`j'`] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN REAL_ARITH_TAC; + +MP_TAC(SET_RULE`psort k (i,j) = psort k (i',j') \/ ~(psort k (i,j) = psort k (i',j'))`) +THEN RESA_TAC +THEN REAL_ARITH_TAC; + +MP_TAC(SET_RULE`psort 3 (i,j) = psort 3 (i',SUC i') \/ ~(psort 3 (i,j) = psort 3 (i', SUC i'))`) +THEN RESA_TAC; + +REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +MATCH_DICH_TAC (31-24) +THEN ASM_REWRITE_TAC[]; + +MP_TAC(SET_RULE`psort k (i,j) = psort k (i',SUC i') \/ ~(psort k (i,j) = psort k (i', SUC i'))`) +THEN RESA_TAC; + +REAL_ARITH_TAC; + +MP_TAC DIAG_NOT_PSORT +THEN RESA_TAC; + +REWRITE_TAC[scs_basic;scs_stab_diag_v39;LET_DEF;LET_END_DEF;unadorned_v39;mk_unadorned_v39;scs_v39_explicit]]);; + + + +let STAB_IS_SCS=prove(`!s i j. + is_scs_v39 s /\ + scs_basic_v39 s /\ + 3 < scs_k_v39 s /\ + scs_diag (scs_k_v39 s) i j /\ + scs_a_v39 s i j <= cstab ==> + is_scs_v39 (scs_stab_diag_v39 s i j) `, +SIMP_TAC[YRTAFYH]);; + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/YXIONXL.hl b/text_formalization/local/YXIONXL.hl new file mode 100755 index 0000000..97de330 --- /dev/null +++ b/text_formalization/local/YXIONXL.hl @@ -0,0 +1,2800 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Yxionxl = struct + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + +open Uxckfpe;; +open Sgtrnaf;; +open Qknvmlb;; + + + +let TRANSFER_SUBSET_BB=prove_by_refinement( +`is_scs_v39 s /\ is_scs_v39 t/\ scs_k_v39 t= scs_k_v39 s/\ + transfer_v39 s t /\ BBs_v39 s ww + ==> BBs_v39 t ww`, +[REWRITE_TAC[transfer_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39; BBs_v39] +THEN REPEAT RESA_TAC; + +REPLICATE_TAC 1(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`;`j:num`]) +THEN REPLICATE_TAC 7(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`;`j:num`]) +THEN REPLICATE_TAC 3(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +REPLICATE_TAC 1(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`;`j:num`]) +THEN REPLICATE_TAC 6(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`;`j:num`]) +THEN REPLICATE_TAC 3(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +REPLICATE_TAC 1(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`;`j:num`]) +THEN REPLICATE_TAC 7(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`;`j:num`]) +THEN REPLICATE_TAC 3(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC; + +REPLICATE_TAC 1(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`;`j:num`]) +THEN REPLICATE_TAC 6(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i:num`;`j:num`]) +THEN REPLICATE_TAC 3(POP_ASSUM MP_TAC) +THEN REAL_ARITH_TAC]);; + + + +let DSV_LE_DSV_TRANSFER=prove_by_refinement( +`is_scs_v39 s /\ is_scs_v39 t/\ scs_k_v39 t= scs_k_v39 s/\ + transfer_v39 s t /\ BBs_v39 s vv +==> dsv_v39 s vv <= dsv_v39 t vv`, +[ +REWRITE_TAC[transfer_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39; BBs_v39;dsv_v39] +THEN REPEAT RESA_TAC; + +ASM_TAC +THEN MP_TAC(SET_RULE`is_ear_v39 s \/ ~(is_ear_v39 s)`) +THEN RESA_TAC; + +REPEAT DISCH_TAC +THEN REPLICATE_TAC (17-4)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; + +REPEAT DISCH_TAC +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN` +sum {i | i < scs_k_v39 s /\ scs_J_v39 t i (SUC i)} + (\i. cstab - dist ((vv:num->real^3) i,vv (SUC i))) +<= sum {i | i < scs_k_v39 s /\ scs_J_v39 s i (SUC i)} + (\i. cstab - dist (vv i,vv (SUC i)))`ASSUME_TAC; + +MATCH_MP_TAC SUM_SUBSET_SIMPLE +THEN REPEAT STRIP_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. (scs_k_v39 s)` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + +REWRITE_TAC[SUBSET;IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (6)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]); + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[DIFF;IN_ELIM_THM] +THEN STRIP_TAC +THEN REPLICATE_TAC (19-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]) +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (58-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]) +THEN REAL_ARITH_TAC; + +SUBGOAL_THEN` +&0 <= sum {i | i < scs_k_v39 s /\ scs_J_v39 t i (SUC i)} + (\i. cstab - dist ((vv:num->real^3) i,vv (SUC i)))`ASSUME_TAC; + +MATCH_MP_TAC SUM_POS_LE +THEN REPEAT STRIP_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. (scs_k_v39 s)` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[DIFF;IN_ELIM_THM] +THEN STRIP_TAC +THEN REPLICATE_TAC (19-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]) +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (58-50)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]) +THEN REPLICATE_TAC (57-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]) +THEN REAL_ARITH_TAC; + +REPLICATE_TAC (18-9)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`is_ear_v39 t \/ ~(is_ear_v39 t)`) +THEN RESA_TAC; + +REPEAT STRIP_TAC +THEN MATCH_MP_TAC(REAL_ARITH`a<= a1 /\ b1<= b/\ &0<= b1 ==> a+ #0.1 * -- &1 * b <= a1+ #0.1 * &1 * b1`) +THEN ASM_REWRITE_TAC[]; + +REPEAT STRIP_TAC +THEN MATCH_MP_TAC(REAL_ARITH`a<= a1 /\ b1<= b/\ &0<= b1 ==> a+ #0.1 * -- &1 * b <= a1+ #0.1 * -- &1 * b1`) +THEN ASM_REWRITE_TAC[]; + +ASM_TAC +THEN MP_TAC(SET_RULE`is_ear_v39 s \/ ~(is_ear_v39 s)`) +THEN RESA_TAC; + +REPEAT DISCH_TAC +THEN REPLICATE_TAC (17-4)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN REWRITE_TAC[SYM th]) +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; + +REPEAT DISCH_TAC +THEN ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN` +sum {i | i < scs_k_v39 s /\ scs_J_v39 t i (SUC i)} + (\i. cstab - dist ((vv:num->real^3) i,vv (SUC i))) +<= sum {i | i < scs_k_v39 s /\ scs_J_v39 s i (SUC i)} + (\i. cstab - dist (vv i,vv (SUC i)))`ASSUME_TAC; + + +MATCH_MP_TAC SUM_SUBSET_SIMPLE +THEN REPEAT STRIP_TAC; + + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. (scs_k_v39 s)` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + +REWRITE_TAC[SUBSET;IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (6)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]); + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[DIFF;IN_ELIM_THM] +THEN STRIP_TAC +THEN REPLICATE_TAC (19-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]) +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (58-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]) +THEN REAL_ARITH_TAC; + +SUBGOAL_THEN` +&0 <= sum {i | i < scs_k_v39 s /\ scs_J_v39 t i (SUC i)} + (\i. cstab - dist ((vv:num->real^3) i,vv (SUC i)))`ASSUME_TAC; + +MATCH_MP_TAC SUM_POS_LE +THEN REPEAT STRIP_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. (scs_k_v39 s)` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[DIFF;IN_ELIM_THM] +THEN STRIP_TAC +THEN REPLICATE_TAC (19-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]) +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (58-50)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]) +THEN REPLICATE_TAC (57-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]) +THEN REAL_ARITH_TAC; + +REPLICATE_TAC (18-9)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`is_ear_v39 t \/ ~(is_ear_v39 t)`) +THEN RESA_TAC; + +REPEAT STRIP_TAC +THEN MATCH_MP_TAC(REAL_ARITH`a<= a1 /\ b1<= b/\ &0<= b1 ==> a+ #0.1 * -- &1 * b <= a1+ #0.1 * &1 * b1`) +THEN ASM_REWRITE_TAC[]; + +REPEAT STRIP_TAC +THEN MATCH_MP_TAC(REAL_ARITH`a<= a1 /\ b1<= b/\ &0<= b1 ==> a+ #0.1 * -- &1 * b <= a1+ #0.1 * -- &1 * b1`) +THEN ASM_REWRITE_TAC[]]);; + + + + +let TAUSTAR_LE_TAUSTAR_TRANSFER=prove( +`is_scs_v39 s /\ is_scs_v39 t/\ scs_k_v39 t= scs_k_v39 s/\ + transfer_v39 s t /\ BBs_v39 s vv +==> taustar_v39 t vv <= taustar_v39 s vv`, +STRIP_TAC +THEN MP_TAC DSV_LE_DSV_TRANSFER +THEN RESA_TAC +THEN REWRITE_TAC[taustar_v39;LET_DEF;LET_END_DEF] +THEN ASM_TAC +THEN REWRITE_TAC[transfer_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39; BBs_v39;taustar_v39] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`scs_k_v39 s <= 3 \/ ~(scs_k_v39 s <= 3)`) +THEN RESA_TAC +THEN REAL_ARITH_TAC);; + + +let TRANSTER_IS_UNADORNED=prove(`transfer_v39 s t +==> unadorned_v39 t`, +REWRITE_TAC[transfer_v39] +THEN RESA_TAC);; + + +let NOT_EMPETY_MMS_TRANSFER=prove(`is_scs_v39 s /\ is_scs_v39 t/\ scs_k_v39 t= scs_k_v39 s/\ + transfer_v39 s t /\ MMs_v39 s vv +==> ?ww. MMs_v39 t ww`, +REWRITE_TAC[MMs_v39;BBprime2_v39;BBprime_v39] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC(GEN_ALL TRANSFER_SUBSET_BB)[`s:scs_v39`;`t:scs_v39`;`vv:num->real^3`] +THEN MP_TAC TAUSTAR_LE_TAUSTAR_TRANSFER +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`taustar_v39 t vv <= taustar_v39 s vv/\ taustar_v39 s vv< &0 ==> taustar_v39 t vv < &0`) +THEN RESA_TAC +THEN MP_TAC TRANSTER_IS_UNADORNED +THEN RESA_TAC +THEN MRESAL_TAC SGTRNAF[`t:scs_v39`;`vv:num->real^3`][SET_RULE`~(A={})<=> ?a. a IN A`;IN;BBprime_v39;BBprime2_v39;MMs_v39]);; + + + + + +let YXIONXL1 = prove_by_refinement(`!s t. + is_scs_v39 s /\ + transfer_v39 s t ==> scs_arrow_v39 {s} {t}`, +[ +REWRITE_TAC[transfer_v39;scs_arrow_v39;IN_SING;LET_DEF;LET_END_DEF;unadorned_v39] +THEN REPEAT STRIP_TAC; +ASM_REWRITE_TAC[]; +DISJ_CASES_TAC(SET_RULE`(!s'. s' = s ==> MMs_v39 s' = {}) \/ ~((!s'. s' = s ==> MMs_v39 s' = {}))`); +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`t:scs_v39` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?vv. vv IN A`;IN] +THEN STRIP_TAC +THEN MP_TAC NOT_EMPETY_MMS_TRANSFER +THEN RESA_TAC +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[transfer_v39;unadorned_v39]]);; + + + + +(************YXIONXL3************) + + +let TRANS_V=prove_by_refinement(` is_scs_v39 s /\ BBs_v39 s vv +==> IMAGE (\x. vv (i + x)) (:num)= IMAGE vv (:num)`, +[ +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39;IMAGE] +THEN RESA_TAC +THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + + +RESA_TAC +THEN EXISTS_TAC`i+x':num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN(:num)`]; + +RESA_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num`) +THEN EXISTS_TAC`(x'+ k- i MOD k) MOD k` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`] +THEN MRESA_TAC DIVISION[`x' + k - i MOD k`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD k< k ==> i MOD k + x' + k - i MOD k= k+ x'`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`(x' + k - i MOD k) MOD k`;`k:num`] +THEN MRESA_TAC MOD_LT[`(i MOD k)`;`k:num`] +THEN MRESAL_TAC MOD_ADD_MOD[`i MOD k:num`;`(x' + k - i MOD k)`;`k:num`][ADD1] +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`(x' + k - i MOD k) MOD k`;`k:num`][ADD1] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`x':num`][ARITH_RULE`1*k+y=k+y`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i + (x' + k - i MOD k) MOD k:num`); + +RESA_TAC +THEN EXISTS_TAC`i+x':num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN(:num)`]; + +RESA_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num`) +THEN EXISTS_TAC`(x'+ k- i MOD k) MOD k` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`] +THEN MRESA_TAC DIVISION[`x' + k - i MOD k`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD k< k ==> i MOD k + x' + k - i MOD k= k+ x'`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`(x' + k - i MOD k) MOD k`;`k:num`] +THEN MRESA_TAC MOD_LT[`(i MOD k)`;`k:num`] +THEN MRESAL_TAC MOD_ADD_MOD[`i MOD k:num`;`(x' + k - i MOD k)`;`k:num`][ADD1] +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`(x' + k - i MOD k) MOD k`;`k:num`][ADD1] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`x':num`][ARITH_RULE`1*k+y=k+y`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i + (x' + k - i MOD k) MOD k:num`)]);; + +let TRANS_FF=prove_by_refinement(`is_scs_v39 s /\ BBs_v39 s vv +==> IMAGE (\i'. vv (i + i'), vv (i + SUC i')) (:num) +=IMAGE (\i. vv i, vv (SUC i)) (:num)`, +[REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39;IMAGE;IN_ELIM_THM] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +RESA_TAC +THEN EXISTS_TAC`i+x':num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN(:num)`;ARITH_RULE`i + SUC a= SUC(i+a)`]; + +RESA_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)/\ 1real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num`) +THEN EXISTS_TAC`(x'+ k- i MOD k) MOD k` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`] +THEN MRESA_TAC DIVISION[`x' + k - i MOD k`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD k< k ==> i MOD k + x' + k - i MOD k= k+ x'`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`(x' + k - i MOD k) MOD k`;`k:num`] +THEN MRESA_TAC MOD_LT[`(i MOD k)`;`k:num`] +THEN MRESAL_TAC MOD_ADD_MOD[`i MOD k:num`;`(x' + k - i MOD k)`;`k:num`][ADD1] +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`(x' + k - i MOD k) MOD k`;`k:num`][ADD_AC] +THEN MRESAL_TAC MOD_ADD_MOD[`x':num`;`1`;`k:num`][ADD_AC] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`x':num`][ARITH_RULE`1*k+y=k+y`] +THEN MRESAL_TAC MOD_ADD_MOD[`i+(x' + k - i MOD k) MOD k`;`1:num`;`k:num`][ADD_AC] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i + (x' + k - i MOD k) MOD k:num` +THEN MRESA1_TAC th`x'+1:num` +THEN MRESA1_TAC th`i + (x' + k - i MOD k) MOD k +1:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); + +RESA_TAC +THEN EXISTS_TAC`i+x':num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN(:num)`;ARITH_RULE`i + SUC a= SUC(i+a)`]; + +RESA_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)/\ 1real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num`) +THEN EXISTS_TAC`(x'+ k- i MOD k) MOD k` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`] +THEN MRESA_TAC DIVISION[`x' + k - i MOD k`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD k< k ==> i MOD k + x' + k - i MOD k= k+ x'`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`(x' + k - i MOD k) MOD k`;`k:num`] +THEN MRESA_TAC MOD_LT[`(i MOD k)`;`k:num`] +THEN MRESAL_TAC MOD_ADD_MOD[`i MOD k:num`;`(x' + k - i MOD k)`;`k:num`][ADD1] +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`(x' + k - i MOD k) MOD k`;`k:num`][ADD_AC] +THEN MRESAL_TAC MOD_ADD_MOD[`x':num`;`1`;`k:num`][ADD_AC] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`x':num`][ARITH_RULE`1*k+y=k+y`] +THEN MRESAL_TAC MOD_ADD_MOD[`i+(x' + k - i MOD k) MOD k`;`1:num`;`k:num`][ADD_AC] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i + (x' + k - i MOD k) MOD k:num` +THEN MRESA1_TAC th`x'+1:num` +THEN MRESA1_TAC th`i + (x' + k - i MOD k) MOD k +1:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])]);; + + +let TRANS_E=prove_by_refinement(`is_scs_v39 s /\ BBs_v39 s vv +==> IMAGE (\i'. {vv (i + i'), vv (i + SUC i')}) (:num) +=IMAGE (\i. {vv i, vv (SUC i)}) (:num)`, +[REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39;IMAGE;IN_ELIM_THM] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +RESA_TAC +THEN EXISTS_TAC`i+x':num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN(:num)`;ARITH_RULE`i + SUC a= SUC(i+a)`]; + +RESA_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)/\ 1real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num`) +THEN EXISTS_TAC`(x'+ k- i MOD k) MOD k` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`] +THEN MRESA_TAC DIVISION[`x' + k - i MOD k`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD k< k ==> i MOD k + x' + k - i MOD k= k+ x'`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`(x' + k - i MOD k) MOD k`;`k:num`] +THEN MRESA_TAC MOD_LT[`(i MOD k)`;`k:num`] +THEN MRESAL_TAC MOD_ADD_MOD[`i MOD k:num`;`(x' + k - i MOD k)`;`k:num`][ADD1] +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`(x' + k - i MOD k) MOD k`;`k:num`][ADD_AC] +THEN MRESAL_TAC MOD_ADD_MOD[`x':num`;`1`;`k:num`][ADD_AC] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`x':num`][ARITH_RULE`1*k+y=k+y`] +THEN MRESAL_TAC MOD_ADD_MOD[`i+(x' + k - i MOD k) MOD k`;`1:num`;`k:num`][ADD_AC] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i + (x' + k - i MOD k) MOD k:num` +THEN MRESA1_TAC th`x'+1:num` +THEN MRESA1_TAC th`i + (x' + k - i MOD k) MOD k +1:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); + +RESA_TAC +THEN EXISTS_TAC`i+x':num` +THEN ASM_REWRITE_TAC[SET_RULE`(x:num)IN(:num)`;ARITH_RULE`i + SUC a= SUC(i+a)`]; + +RESA_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)/\ 1real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num`) +THEN EXISTS_TAC`(x'+ k- i MOD k) MOD k` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`] +THEN MRESA_TAC DIVISION[`x' + k - i MOD k`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD k< k ==> i MOD k + x' + k - i MOD k= k+ x'`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`(x' + k - i MOD k) MOD k`;`k:num`] +THEN MRESA_TAC MOD_LT[`(i MOD k)`;`k:num`] +THEN MRESAL_TAC MOD_ADD_MOD[`i MOD k:num`;`(x' + k - i MOD k)`;`k:num`][ADD1] +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`(x' + k - i MOD k) MOD k`;`k:num`][ADD_AC] +THEN MRESAL_TAC MOD_ADD_MOD[`x':num`;`1`;`k:num`][ADD_AC] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`x':num`][ARITH_RULE`1*k+y=k+y`] +THEN MRESAL_TAC MOD_ADD_MOD[`i+(x' + k - i MOD k) MOD k`;`1:num`;`k:num`][ADD_AC] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i + (x' + k - i MOD k) MOD k:num` +THEN MRESA1_TAC th`x'+1:num` +THEN MRESA1_TAC th`i + (x' + k - i MOD k) MOD k +1:num`) +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])]);; + + + + +let BB_TRANS_SUBSET_BB=prove(` is_scs_v39 s /\ BBs_v39 s vv +==> BBs_v39 (scs_prop_equ_v39 s i) (\x. vv (i+x))`, +STRIP_TAC +THEN MP_TAC TRANS_V +THEN RESA_TAC +THEN MP_TAC TRANS_E +THEN RESA_TAC +THEN MP_TAC TRANS_FF +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39] +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN ASM_REWRITE_TAC[periodic;] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (26-21)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i+i':num`][ADD_AC]));; + + + + +let PROP_EQU_IS_SCS= prove_by_refinement(`scs_k_v39 s = k /\ is_scs_v39 s /\ t= (scs_prop_equ_v39 s i) +==> is_scs_v39 t`, +[RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[scs_v39_explicit;scs_opp_v39;LET_DEF;LET_END_DEF;is_scs_v39;peropp;scs_prop_equ_v39] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN REPEAT RESA_TAC; + + +ASM_TAC +THEN ASM_REWRITE_TAC[periodic;] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (22-4)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i+i':num`][ADD_AC]); + + +ASM_TAC +THEN ASM_REWRITE_TAC[periodic;] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (22-5)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i+i':num`][ADD_AC]); + + +ASM_TAC +THEN ASM_REWRITE_TAC[periodic;] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (22-6)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i+i':num`][ADD_AC]); + +ASM_TAC +THEN ASM_REWRITE_TAC[periodic;] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (22-6)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i+i':num`][ADD_AC]); + + + +ASM_TAC +THEN ASM_REWRITE_TAC[periodic2;] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (22-7)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i+j:num`;`i+i':num`][ADD_AC]); + + +ASM_TAC +THEN ASM_REWRITE_TAC[periodic2;] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (22-8)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i+j:num`;`i+i':num`][ADD_AC]); + + +ASM_TAC +THEN ASM_REWRITE_TAC[periodic2;] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (22-9)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i+j:num`;`i+i':num`][ADD_AC]); + +ASM_TAC +THEN ASM_REWRITE_TAC[periodic2;] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (22-10)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i+j:num`;`i+i':num`][ADD_AC]); + +ASM_TAC +THEN ASM_REWRITE_TAC[periodic2;] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (22-11)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i+j:num`;`i+i':num`][ADD_AC]); + + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i+i')`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i+j:num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((i+j) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i+i':num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_LT[`i':num`;`k:num`] +THEN MRESA_TAC MOD_LT[`j:num`;`k:num`] +THEN MRESA_TAC Hdplygy.MOD_EQ_MOD[`i':num`;`j:num`;`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`i+i':num`;`k:num`] +THEN MRESA_TAC DIVISION[`i+j:num`;`k:num`] +THEN REPLICATE_TAC (33-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`(i+i') MOD k:num`;`(i+j) MOD k:num`][ADD_AC]) +; + + +ASM_REWRITE_TAC[ARITH_RULE`i+ SUC i'= SUC(i+i')`] +THEN REPLICATE_TAC (23-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i+i':num`][ADD_AC]); + + + +ASM_REWRITE_TAC[ARITH_RULE`i+ SUC i'= SUC(i+i')`] +THEN REPLICATE_TAC (23-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i+i':num`][ADD_AC]) +; + + +REPLICATE_TAC (23-18)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i+i':num`;`i+j:num`][ADD_AC;ARITH_RULE` SUC(i+i')=i+ SUC i'`]) +; + + +MRESA_TAC Hdplygy.MOD_EQ_MOD[`j:num`;`SUC i':num`;`i:num`;`k:num`] +; + + +MRESA_TAC Hdplygy.MOD_EQ_MOD[`i':num`;`SUC j:num`;`i:num`;`k:num`] +; + + +SUBGOAL_THEN` + CARD + {i | i < k /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))} +=CARD + {i' | i' < k /\ + (&2 * h0 < scs_b_v39 s (i + i') (i + SUC i') \/ + &2 < scs_a_v39 s (i + i') (i + SUC i'))} +` +ASSUME_TAC +; + + +MATCH_MP_TAC CARD_IMAGE_INJ_EQ +THEN REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`(\x:num. (i+x) MOD k)` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC +; + + +STRIP_TAC; + + +REPEAT RESA_TAC +; + +MRESA_TAC DIVISION[`i+x:num`;`k:num`] +; + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (i+x)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i+SUC x:num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s ((i+ SUC x) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i+x:num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s ((i+x) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC ((i + x) MOD k):num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[ADD1] +THEN MP_TAC(ARITH_RULE`3<=k==> 1 MRESA1_TAC th`i+SUC x:num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((i+ SUC x) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i+x:num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((i+x) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC ((i + x) MOD k):num`) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[ADD1] +THEN MP_TAC(ARITH_RULE`3<=k==> 1 1 ASSUME_TAC(SYM th)) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (i + y - i MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i + SUC (y - i MOD k):num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s ((i + SUC (y - i MOD k)) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i + y - i MOD k:num`) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC MOD_ADD_MOD[`i+y- i MOD k`;`1`;`k:num`][ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s y`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y+1:num`) +THEN REWRITE_TAC[ARITH_RULE`a+1= SUC a`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC MOD_LT[`y':num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`y':num`;`k:num`] +THEN MRESA_TAC Hdplygy.MOD_EQ_MOD[`y':num`;`y- i MOD k:num`;`i MOD k:num`;`k:num`] +; + + +EXISTS_TAC`(y+ k- i MOD k)MOD k` +THEN MRESA_TAC DIVISION[`y + k- i MOD k`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC MOD_LT[`(y + k- i MOD k) MOD k`;`k:num`] +THEN MRESA_TAC MOD_LT[`i MOD k`;`k:num`] +THEN MRESA_TAC MOD_LT[`y:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD k< k/\ 3<=k ==> i MOD k + y + k - i MOD k= k+y/\ 1 ASSUME_TAC(SYM th)) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (i + (y + k - i MOD k) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i + SUC ((y + k - i MOD k) MOD k):num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s ((i + SUC ((y + k - i MOD k) MOD k)) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i + ((y + k - i MOD k) MOD k):num`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ADD1] +THEN MRESAL_TAC MOD_ADD_MOD[`i + (y + k - i MOD k) MOD k`;`1`;`k:num`][ADD_AC] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s y`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y+1:num`) +THEN REWRITE_TAC[ARITH_RULE`a+1= SUC a`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC MOD_LT[`y':num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`y':num`;`k:num`] +THEN MRESA_TAC Hdplygy.MOD_EQ_MOD[`y':num`;`y +k- i MOD k:num`;`i MOD k:num`;`k:num`] +; + + + +MP_TAC(ARITH_RULE`i MOD k<=y\/ y< i MOD k`) +THEN RESA_TAC +; + +EXISTS_TAC`y- i MOD k` +THEN MP_TAC(ARITH_RULE`i MOD k<=y /\ y< k/\ 3<=k ==> 1 ASSUME_TAC(SYM th)) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i + y - i MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i + SUC (y - i MOD k):num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((i + SUC (y - i MOD k)) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i + y - i MOD k:num`) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC MOD_ADD_MOD[`i+y- i MOD k`;`1`;`k:num`][ADD1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s y`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y+1:num`) +THEN REWRITE_TAC[ARITH_RULE`a+1= SUC a`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC MOD_LT[`y':num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`y':num`;`k:num`] +THEN MRESA_TAC Hdplygy.MOD_EQ_MOD[`y':num`;`y- i MOD k:num`;`i MOD k:num`;`k:num`] +; + + +EXISTS_TAC`(y+ k- i MOD k)MOD k` +THEN MRESA_TAC DIVISION[`y + k- i MOD k`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC MOD_LT[`(y + k- i MOD k) MOD k`;`k:num`] +THEN MRESA_TAC MOD_LT[`i MOD k`;`k:num`] +THEN MRESA_TAC MOD_LT[`y:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD k< k/\ 3<=k ==> i MOD k + y + k - i MOD k= k+y/\ 1 ASSUME_TAC(SYM th)) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i + (y + k - i MOD k) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i + SUC ((y + k - i MOD k) MOD k):num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((i + SUC ((y + k - i MOD k) MOD k)) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i + ((y + k - i MOD k) MOD k):num`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ADD1] +THEN MRESAL_TAC MOD_ADD_MOD[`i + (y + k - i MOD k) MOD k`;`1`;`k:num`][ADD_AC] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s y`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`y+1:num`) +THEN REWRITE_TAC[ARITH_RULE`a+1= SUC a`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC MOD_LT[`y':num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`y':num`;`k:num`] +THEN MRESA_TAC Hdplygy.MOD_EQ_MOD[`y':num`;`y +k- i MOD k:num`;`i MOD k:num`;`k:num`] +; + + + +POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +; + +]);; + + +let TRANS_MOD_EQ=prove(`~(k=0)==> (i+ (x+ k- i MOD k)MOD k) MOD k= x MOD k`, +STRIP_TAC +THEN MRESA_TAC DIVISION[`x + k - i MOD k`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC MOD_LT[`(x + k - i MOD k) MOD k`;`k:num`] +THEN MRESA_TAC MOD_LT[`i MOD k`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD k < k ==> i MOD k + x + k - i MOD k= k+x`) +THEN RESA_TAC +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`(x + k - i MOD k) MOD k`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i MOD k`;`(x + k - i MOD k)`;`k:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`x:num`][ARITH_RULE`1*k=k`]);; + + + +let TRANS_MOD_EQ_SUC=prove(`1 (i+ SUC ((x+ k- i MOD k)MOD k)) MOD k= SUC x MOD k`, +STRIP_TAC +THEN REWRITE_TAC[ADD1] +THEN MP_TAC(ARITH_RULE`1 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`1`;`k:num`] +THEN MP_TAC TRANS_MOD_EQ +THEN RESA_TAC +THEN MRESA_TAC MOD_ADD_MOD[`x:num`;`1`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i +(x + k - i MOD k) MOD k`;`1`;`k:num`] +THEN ASM_REWRITE_TAC[ADD_AC]);; + + +let TRANS_PROPERTY=prove(`(!i. vv (i MOD k) = vv i) /\ ~(k=0) +==> +( (!j:num. vv j) <=> (!j:num. vv (i+ j)))`, +REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`i+j:num`); + +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`(j+ k- i MOD k) MOD k`]) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL TRANS_MOD_EQ)[`i:num`;`j:num`;`k:num`] +THEN REPLICATE_TAC (2) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i + (j + k - i MOD k) MOD k`] +THEN MRESA_TAC th[`j:num`] +THEN ASSUME_TAC th)]);; + + + + + + + +let TRANS_PROPERTY_IN=prove(`(!i. (i MOD k) IN vv <=> i IN vv ) /\ ~(k=0) +==> +( (!j:num. j IN vv ) <=> (!j:num. (i+ j) IN vv ))`, +REWRITE_TAC[IN] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`i+j:num`); + +REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA_TAC th[`(j+ k- i MOD k) MOD k`]) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL TRANS_MOD_EQ)[`i:num`;`j:num`;`k:num`] +THEN REPLICATE_TAC (2) (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i + (j + k - i MOD k) MOD k`] +THEN MRESA_TAC th[`j:num`] +THEN ASSUME_TAC th)]);; + + + + +let PRO_EQU_IS_EAR=prove_by_refinement(` is_scs_v39 s +==> +(is_ear_v39 s <=> is_ear_v39 (scs_prop_equ_v39 s i))`, +[REWRITE_TAC[is_ear_v39] +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39;] +THEN ONCE_REWRITE_TAC[EXTENSION;] +THEN STRIP_TAC +THEN EQ_TAC +; + +RESA_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN MRESAL_TAC(GEN_ALL PROP_EQU_IS_SCS)[`k:num`;`s:scs_v39`;`i:num`;`(scs_prop_equ_v39 s i)`;][scs_prop_equ_v39;LET_DEF;LET_END_DEF;unadorned_v39;scs_v39_explicit] +THEN ASM_TAC +THEN REWRITE_TAC[unadorned_v39;] +THEN REPEAT RESA_TAC; + + +SET_TAC[]; + + + + +MRESAL_TAC (GEN_ALL TRANS_MOD_EQ)[`i:num`;`i':num`;`k:num`][ARITH_RULE`~(3=0)`] +THEN EXISTS_TAC`(i'+ k- i MOD k)MOD k` +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC; + + +REWRITE_TAC[IN_ELIM_THM;IN_SING] +THEN EQ_TAC; + + + + + +STRIP_TAC +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (i+x)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i+ SUC x:num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i+SUC x) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i+ x:num`) +THEN REWRITE_TAC[ARITH_RULE`i+ SUC x= SUC(i+x)`] +THEN MRESAL_TAC DIVISION[`i+x:num`;`k:num`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i+x) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC ((i + x) MOD 3):num`) +THEN REPLICATE_TAC (60-28)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i':num`][IN_ELIM_THM;IN_SING] +THEN MRESAL_TAC th[`(i+x) MOD k`][IN_ELIM_THM;IN_SING]) +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPLICATE_TAC (2) STRIP_TAC +THEN REWRITE_TAC[SYM th;ADD1]) +THEN MRESAL_TAC MOD_ADD_MOD[`i+x:num`;`1`;`3`][ARITH_RULE`~(3=0)/\ 1 MOD 3=1/\ (i + x) + 1= i +SUC x`] +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`x:num`;`3`][ARITH_RULE`~(3=0)/\ 1 MOD 3=1/\ (i + x) + 1= i +SUC x`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ADD1]) +THEN MRESAL_TAC MOD_LT[`x:num`;`k:num`][ARITH_RULE`~(3=0)/\ 1 MOD 3=1/\ (i + x) + 1= i +SUC x`] +THEN STRIP_TAC +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][ARITH_RULE`~(3=0)/\ 1 MOD 3=1/\ (i + x) + 1= i +SUC x`] +THEN MRESAL_TAC MOD_LT[`i':num`;`k:num`][ARITH_RULE`~(3=0)/\ 1 MOD 3=1/\ (i + x) + 1= i +SUC x`] +THEN MP_TAC(ARITH_RULE`i MOD 3< 3==> i MOD 3 + i' + 3 - i MOD 3= 3+i'`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`i':num`][ARITH_RULE`1*k=k`] +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`x:num`;`i'+ 3- i MOD 3:num`;`i MOD k:num`;`k:num`] [ARITH_RULE`~(3=0)/\ 1 MOD 3=1/\ (i + x) + 1= i +SUC x`] +; + + +RESA_TAC +THEN MRESAL_TAC DIVISION[`i'+3- i MOD 3`;`3`][ARITH_RULE`~(3=0)`] +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL TRANS_MOD_EQ_SUC)[`i:num`;`i':num`;`k:num`][ARITH_RULE`1<3`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (i + (i' + 3 - i MOD 3) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(i + SUC ((i' + 3 - i MOD 3) MOD 3)):num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i + SUC ((i' + 3 - i MOD 3) MOD 3)) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(i + (i' + 3 - i MOD 3) MOD 3):num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s i'`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC i':num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (SUC i' MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i':num`) +THEN REPLICATE_TAC (61-28)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i':num`][IN_ELIM_THM;IN_SING]) +; + + + +ASM_TAC +THEN REWRITE_TAC[is_scs_v39;periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL TRANS_MOD_EQ_SUC)[`i:num`;`i':num`;`k:num`][ARITH_RULE`1<3`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s (i + (i' + 3 - i MOD 3) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(i + SUC ((i' + 3 - i MOD 3) MOD 3)):num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s ((i + SUC ((i' + 3 - i MOD 3) MOD 3)) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(i + (i' + 3 - i MOD 3) MOD 3):num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s i'`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC i':num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s (SUC i' MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i':num`) +; + + + + + +ASM_TAC +THEN REWRITE_TAC[is_scs_v39;periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL TRANS_MOD_EQ_SUC)[`i:num`;`i':num`;`k:num`][ARITH_RULE`1<3`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s (i + (i' + 3 - i MOD 3) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(i + SUC ((i' + 3 - i MOD 3) MOD 3)):num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s ((i + SUC ((i' + 3 - i MOD 3) MOD 3)) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(i + (i' + 3 - i MOD 3) MOD 3):num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s i'`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC i':num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s (SUC i' MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i':num`) +; + + +REPLICATE_TAC (17-9)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i':num`][IN_ELIM_THM;IN_SING]) +THEN MRESAL_TAC MOD_LT[`i':num`;`k:num`][ARITH_RULE`~(3=0)`] +THEN MRESA_TAC MOD_LT[`j:num`;`3`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC DIVISION[`i+j:num`;`k:num`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`i MOD 3< 3==> i MOD 3+ i' +3 - i MOD 3= 3+i'`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`j:num`;`k:num`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`i':num`][ARITH_RULE`1*k=k`] +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`j MOD k:num`;`i'+ 3- i MOD 3:num`;`i MOD k:num`;`k:num`] [ARITH_RULE`~(3=0)/\ 1 MOD 3=1/\ (i + x) + 1= i +SUC x`] +THEN REPLICATE_TAC (28-11)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`(i+j)MOD k:num`][IN_ELIM_THM;IN_SING]) +THEN MRESAL_TAC MOD_ADD_MOD[`i+j:num`;`1`;`k:num`][ARITH_RULE`~(3=0)/\ 1 MOD 3=1`;GSYM ADD1] +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL TRANS_MOD_EQ_SUC)[`i:num`;`i':num`;`k:num`][ARITH_RULE`1<3`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s (i + SUC j)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(i + j):num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s ((i + j) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(i + SUC j):num` +THEN MRESAL1_TAC th`SUC((i + j) MOD 3):num`[ARITH_RULE`SUC(i +j)= i+ SUC j`]) +; + + + +REPLICATE_TAC (17-9)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i':num`][IN_ELIM_THM;IN_SING]) +THEN MRESAL_TAC MOD_LT[`i':num`;`k:num`][ARITH_RULE`~(3=0)`] +THEN MRESA_TAC MOD_LT[`j:num`;`3`] +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC DIVISION[`i+j:num`;`k:num`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`i MOD 3< 3==> i MOD 3+ i' +3 - i MOD 3= 3+i'`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`j:num`;`k:num`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`i':num`][ARITH_RULE`1*k=k`] +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`j MOD k:num`;`i'+ 3- i MOD 3:num`;`i MOD k:num`;`k:num`] [ARITH_RULE`~(3=0)/\ 1 MOD 3=1/\ (i + x) + 1= i +SUC x`] +THEN REPLICATE_TAC (28-11)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`(i+j)MOD k:num`][IN_ELIM_THM;IN_SING]) +THEN MRESAL_TAC MOD_ADD_MOD[`i+j:num`;`1`;`k:num`][ARITH_RULE`~(3=0)/\ 1 MOD 3=1`;GSYM ADD1] +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL TRANS_MOD_EQ_SUC)[`i:num`;`i':num`;`k:num`][ARITH_RULE`1<3`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s (i + SUC j)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(i + j):num`) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s ((i + j) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM (fun th-> MRESA1_TAC th`(i + SUC j):num` +THEN MRESAL1_TAC th`SUC((i + j) MOD 3):num`[ARITH_RULE`SUC(i +j)= i+ SUC j`]) +; + + + +ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;unadorned_v39;scs_v39_explicit;is_scs_v39] +THEN REPEAT RESA_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN MP_TAC(ARITH_RULE`3<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN REPLICATE_TAC (46-38)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> ASM_TAC +THEN REWRITE_TAC[th] +THEN ASSUME_TAC th +THEN REPEAT RESA_TAC) +; + + + +ASM_TAC +THEN REWRITE_TAC[SET_RULE`A={} <=> ~(?a. A a)`] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (49-36)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`(a+ k- i MOD k)MOD k` +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_lo_v39 s `][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`a:num`] +THEN MRESA_TAC th[`(i + (a + 3 - i MOD 3) MOD 3)`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC (GEN_ALL TRANS_MOD_EQ)[`i:num`;`a:num`;`k:num`] +; + + +ASM_TAC +THEN REWRITE_TAC[SET_RULE`A={} <=> ~(?a. A a)`] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (47-35)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`(a+ k- i MOD k)MOD k` +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_hi_v39 s `][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`a:num`] +THEN MRESA_TAC th[`(i + (a + 3 - i MOD 3) MOD 3)`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC (GEN_ALL TRANS_MOD_EQ)[`i:num`;`a:num`;`k:num`] +; + + + + +ASM_TAC +THEN REWRITE_TAC[SET_RULE`A={} <=> ~(?a. A a)`] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC (47-36)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`(a+ k- i MOD k)MOD k` +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_str_v39 s `][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`a:num`] +THEN MRESA_TAC th[`(i + (a + 3 - i MOD 3) MOD 3)`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC (GEN_ALL TRANS_MOD_EQ)[`i:num`;`a:num`;`k:num`] +; + + +REWRITE_TAC[FUN_EQ_THM] +THEN REPEAT GEN_TAC +THEN REPLICATE_TAC (46-37)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REWRITE_TAC[FUN_EQ_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`((x + 3 - i MOD 3) MOD 3)`;`((x' + 3 - i MOD 3) MOD 3)`]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL TRANS_MOD_EQ)[`i:num`;`x:num`;`k:num`] +THEN MRESA_TAC (GEN_ALL TRANS_MOD_EQ)[`i:num`;`x':num`;`k:num`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i + (x + 3 - i MOD 3) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`(i + (x' + 3 - i MOD 3) MOD 3)`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((i + (x' + 3 - i MOD 3) MOD 3) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`(i + (x + 3 - i MOD 3) MOD 3)`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s (i + (x + 3 - i MOD 3) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`(i + (x' + 3 - i MOD 3) MOD 3)`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s ((i + (x' + 3 - i MOD 3) MOD 3) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`(i + (x + 3 - i MOD 3) MOD 3)`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s x`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`x':num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (x' MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`x:num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s x`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`x':num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s (x' MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`x:num`]) +; + +REWRITE_TAC[FUN_EQ_THM] +THEN REPEAT GEN_TAC +THEN REPLICATE_TAC (46-38)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REWRITE_TAC[FUN_EQ_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`((x + 3 - i MOD 3) MOD 3)`;`((x' + 3 - i MOD 3) MOD 3)`]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL TRANS_MOD_EQ)[`i:num`;`x:num`;`k:num`] +THEN MRESA_TAC (GEN_ALL TRANS_MOD_EQ)[`i:num`;`x':num`;`k:num`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (i + (x + 3 - i MOD 3) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`(i + (x' + 3 - i MOD 3) MOD 3)`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s ((i + (x' + 3 - i MOD 3) MOD 3) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`(i + (x + 3 - i MOD 3) MOD 3)`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s (i + (x + 3 - i MOD 3) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`(i + (x' + 3 - i MOD 3) MOD 3)`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s ((i + (x' + 3 - i MOD 3) MOD 3) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`(i + (x + 3 - i MOD 3) MOD 3)`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s x`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`x':num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (x' MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`x:num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s x`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`x':num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s (x' MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`x:num`]) +; + + +REPLICATE_TAC (46-40)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(i''+k- i MOD k)MOD k:num`]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL TRANS_MOD_EQ)[`i:num`;`i'':num`;`k:num`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (i + (i'' + 3 - i MOD 3) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`(i + (i'' + 3 - i MOD 3) MOD 3)`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s ((i + (i'' + 3 - i MOD 3) MOD 3) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`(i + (i'' + 3 - i MOD 3) MOD 3)`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s i''`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i'':num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (i'' MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i'':num`]) +; + + + +EXISTS_TAC`(i+i') MOD k:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(A+B)= A+ SUC B`] +THEN REPEAT RESA_TAC; + + +REWRITE_TAC[IN_ELIM_THM;IN_SING] +THEN EQ_TAC +; + + +REPEAT STRIP_TAC +THEN MRESA_TAC DIVISION[`x+3- i MOD 3`;`k:num`] +THEN REPLICATE_TAC (50-41)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i':num`][IN_ELIM_THM;IN_SING] +THEN MRESAL_TAC th[`(x +k-i MOD k) MOD k:num`][IN_ELIM_THM;IN_SING]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL TRANS_MOD_EQ)[`i:num`;`x:num`;`k:num`] +THEN MRESAL_TAC (GEN_ALL TRANS_MOD_EQ_SUC)[`i:num`;`x:num`;`k:num`][ARITH_RULE`1<3`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (i + (x + 3 - i MOD 3) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`(i + SUC ((x + 3 - i MOD 3) MOD 3))`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i + SUC((x + 3 - i MOD 3) MOD 3)) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`(i + (x + 3 - i MOD 3) MOD 3)`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s x`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC x:num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (SUC x MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`x:num`]) +THEN STRIP_TAC +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][ARITH_RULE`~(3=0)`] +THEN MRESA_TAC MOD_LT[`i':num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD k< k ==> (i' MOD 3 + i MOD 3) + 3 - i MOD 3= i' MOD 3 +3`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`i' MOD 3:num`][ARITH_RULE`1*k+a=a+k`] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`i':num`;`k:num`] +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`i' MOD k + i MOD k:num`;`x:num`;`3- i MOD 3:num`;`k:num`] [ARITH_RULE`~(3=0)/\ 1 MOD 3=1/\ 3 - i MOD 3 + x= x+ 3- i MOD 3`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`i' + i MOD 3= i MOD 3+i'`] +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`x:num`;`k:num`] +; + +RESA_TAC +THEN MRESA_TAC DIVISION[`i+i':num`;`k:num`] +THEN REPLICATE_TAC (49-41)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i':num`][IN_ELIM_THM;IN_SING]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL TRANS_MOD_EQ_SUC)[`i:num`;`x:num`;`k:num`][ARITH_RULE`1<3`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (i+i')`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC ((i + i') MOD 3)`] +THEN MRESA_TAC th[`(i + SUC i')`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (SUC ((i+i') MOD k))`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`(i + i') :num`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ADD1]) +THEN MRESAL_TAC MOD_ADD_MOD[`i+i':num`;`1:num`;`k:num`][ARITH_RULE`1 MOD 3=1`;ADD_AC]; + + + + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL TRANS_MOD_EQ_SUC)[`i:num`;`x:num`;`k:num`][ARITH_RULE`1<3`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i+i')`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC ((i + i') MOD 3)`] +THEN MRESA_TAC th[`(i + SUC i')`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC ((i+i') MOD k))`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`(i + i') :num`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ADD1]) +THEN MRESAL_TAC MOD_ADD_MOD[`i+i':num`;`1:num`;`k:num`][ARITH_RULE`1 MOD 3=1`;ADD_AC]; + + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL TRANS_MOD_EQ_SUC)[`i:num`;`x:num`;`k:num`][ARITH_RULE`1<3`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (i+i')`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC ((i + i') MOD 3)`] +THEN MRESA_TAC th[`(i + SUC i')`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (SUC ((i+i') MOD k))`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`(i + i') :num`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ADD1]) +THEN MRESAL_TAC MOD_ADD_MOD[`i+i':num`;`1:num`;`k:num`][ARITH_RULE`1 MOD 3=1`;ADD_AC]; + + + +REPLICATE_TAC (48-41)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i':num`][IN_ELIM_THM;IN_SING]) +THEN MRESA_TAC DIVISION[`j+3- i MOD 3`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD 3< 3==> (i MOD 3 + i' MOD 3) + 3 - i MOD 3= 3+ i' MOD 3`) +THEN RESA_TAC +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`i':num`;`k:num`] +THEN MRESA_TAC MOD_LT[`j:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`i' MOD 3:num`][ARITH_RULE`1*k=k`] +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`j:num`;`i MOD k + i' MOD k:num`;`3- i MOD 3:num`;`k:num`] [ARITH_RULE`~(3=0)/\ 1 MOD 3=1/\ 3 - i MOD 3 + x= x+ 3- i MOD 3`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC MOD_LT[`i':num`;`k:num`] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL TRANS_MOD_EQ)[`i:num`;`j:num`;`k:num`] +THEN MRESAL_TAC (GEN_ALL TRANS_MOD_EQ_SUC)[`i:num`;`j:num`;`k:num`][ARITH_RULE`1<3`] +THEN REPLICATE_TAC (61-43)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`(j+k-i MOD k) MOD k:num`][IN_ELIM_THM;IN_SING]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC 2(POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i + (j + 3 - i MOD 3) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + SUC ((j + 3 - i MOD 3) MOD 3)`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((i + SUC ((j + 3 - i MOD 3) MOD 3)) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + ((j + 3 - i MOD 3) MOD 3)`]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s j`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC j`]) +THEN REPEAT RESA_TAC; + + + +REPLICATE_TAC (48-41)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`i':num`][IN_ELIM_THM;IN_SING]) +THEN MRESA_TAC DIVISION[`j+3- i MOD 3`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD 3< 3==> (i MOD 3 + i' MOD 3) + 3 - i MOD 3= 3+ i' MOD 3`) +THEN RESA_TAC +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`i':num`;`k:num`] +THEN MRESA_TAC MOD_LT[`j:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`i' MOD 3:num`][ARITH_RULE`1*k=k`] +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`j:num`;`i MOD k + i' MOD k:num`;`3- i MOD 3:num`;`k:num`] [ARITH_RULE`~(3=0)/\ 1 MOD 3=1/\ 3 - i MOD 3 + x= x+ 3- i MOD 3`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC MOD_LT[`i':num`;`k:num`] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL TRANS_MOD_EQ)[`i:num`;`j:num`;`k:num`] +THEN MRESAL_TAC (GEN_ALL TRANS_MOD_EQ_SUC)[`i:num`;`j:num`;`k:num`][ARITH_RULE`1<3`] +THEN REPLICATE_TAC (61-43)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`(j+k-i MOD k) MOD k:num`][IN_ELIM_THM;IN_SING]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC 2(POP_ASSUM MP_TAC) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (i + (j + 3 - i MOD 3) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + SUC ((j + 3 - i MOD 3) MOD 3)`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s ((i + SUC ((j + 3 - i MOD 3) MOD 3)) MOD 3)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + ((j + 3 - i MOD 3) MOD 3)`]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s j`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC j`]) +THEN REPEAT RESA_TAC; + + +]);; + + +let PRO_EQU_DSV_EQ=prove_by_refinement(` is_scs_v39 s + /\ BBs_v39 s vv +==> dsv_v39 (scs_prop_equ_v39 s i) (\x. vv (i+x)) = dsv_v39 s vv`, +[STRIP_TAC +THEN MP_TAC PRO_EQU_IS_EAR THEN RESA_TAC +THEN ASM_TAC +THEN +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;dsv_v39;scs_slice_v39;PAIR_EQ;scs_half_slice_v39] +THEN REPEAT RESA_TAC +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN MP_TAC(ARITH_RULE`3<= k==> ~(k=0)/\ 1< k`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`is_ear_v39 s \/ ~(is_ear_v39 s)`) +THEN RESA_TAC; + + +MATCH_MP_TAC(REAL_ARITH`a=b==> a1+ #0.1 * &1 *a=a1+ #0.1 * &1 *b`) +THEN MATCH_MP_TAC SUM_EQ_GENERAL +THEN EXISTS_TAC`(\j. (i+j)MOD k)` +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +; + +REWRITE_TAC[EXISTS_UNIQUE] +THEN EXISTS_TAC`(y+k- i MOD k) MOD k` +THEN MRESA_TAC MOD_LT[`y:num`;`k:num`] +THEN MRESA_TAC (GEN_ALL TRANS_MOD_EQ)[`i:num`;`y:num`;`k:num`] +THEN MRESA_TAC (GEN_ALL TRANS_MOD_EQ_SUC)[`i:num`;`y:num`;`k:num`] +THEN MRESA_TAC DIVISION[`y+k- i MOD k`;`k:num`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i + (y + k - i MOD k) MOD k))`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + SUC ((y + k - i MOD k) MOD k)`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i + SUC ((y + k - i MOD k) MOD k)) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + ((y + k - i MOD k) MOD k)`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (y)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC y`]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD k< k/\ 3<=k==> i MOD k + y + k - i MOD k= k+ y`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`y':num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`y':num`;`k:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`y:num`][ARITH_RULE`1*k=k`] +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`y':num`;`y+k-i MOD k:num`;`i MOD k:num`;`k:num`] [ARITH_RULE`~(3=0)`] +; + +MRESA_TAC DIVISION[`i+x:num`;`k:num`] +; + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i +x))`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + SUC x`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i + SUC x) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + x:num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i +x)MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC((i +x) MOD k)`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_LT[`1`;`k:num`] +THEN MRESAL_TAC MOD_ADD_MOD[`i+x:num`;`1:num`;`k:num`][ADD_AC] +; + + + + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`(vv:num->real^3)`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + x +1`] +THEN MRESA_TAC th[`i + x:num`] +THEN MRESA_TAC th[`SUC ((i + x) MOD k)`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_LT[`1`;`k:num`] +THEN MRESAL_TAC MOD_ADD_MOD[`i+x:num`;`1:num`;`k:num`][ADD_AC] +THEN RESA_TAC; + +MATCH_MP_TAC(REAL_ARITH`a=b==> a1+ #0.1 * -- &1 *a=a1+ #0.1 * -- &1 *b`) +THEN MATCH_MP_TAC SUM_EQ_GENERAL +THEN EXISTS_TAC`(\j. (i+j)MOD k)` +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +; + +REWRITE_TAC[EXISTS_UNIQUE] +THEN EXISTS_TAC`(y+k- i MOD k) MOD k` +THEN MRESA_TAC MOD_LT[`y:num`;`k:num`] +THEN MRESA_TAC (GEN_ALL TRANS_MOD_EQ)[`i:num`;`y:num`;`k:num`] +THEN MRESA_TAC (GEN_ALL TRANS_MOD_EQ_SUC)[`i:num`;`y:num`;`k:num`] +THEN MRESA_TAC DIVISION[`y+k- i MOD k`;`k:num`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i + (y + k - i MOD k) MOD k))`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + SUC ((y + k - i MOD k) MOD k)`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i + SUC ((y + k - i MOD k) MOD k)) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + ((y + k - i MOD k) MOD k)`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (y)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC y`]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD k< k/\ 3<=k==> i MOD k + y + k - i MOD k= k+ y`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`y':num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`y':num`;`k:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`y:num`][ARITH_RULE`1*k=k`] +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`y':num`;`y+k-i MOD k:num`;`i MOD k:num`;`k:num`] [ARITH_RULE`~(3=0)`] +; + +MRESA_TAC DIVISION[`i+x:num`;`k:num`] +; + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i +x))`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + SUC x`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i + SUC x) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + x:num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i +x)MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC((i +x) MOD k)`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_LT[`1`;`k:num`] +THEN MRESAL_TAC MOD_ADD_MOD[`i+x:num`;`1:num`;`k:num`][ADD_AC] +; + + + + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`(vv:num->real^3)`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + x +1`] +THEN MRESA_TAC th[`i + x:num`] +THEN MRESA_TAC th[`SUC ((i + x) MOD k)`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_LT[`1`;`k:num`] +THEN MRESAL_TAC MOD_ADD_MOD[`i+x:num`;`1:num`;`k:num`][ADD_AC] +THEN RESA_TAC; + + +MATCH_MP_TAC(REAL_ARITH`a=b==> a1+ #0.1 * &1 *a=a1+ #0.1 * &1 *b`) +THEN MATCH_MP_TAC SUM_EQ_GENERAL +THEN EXISTS_TAC`(\j. (i+j)MOD k)` +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +; + +REWRITE_TAC[EXISTS_UNIQUE] +THEN EXISTS_TAC`(y+k- i MOD k) MOD k` +THEN MRESA_TAC MOD_LT[`y:num`;`k:num`] +THEN MRESA_TAC (GEN_ALL TRANS_MOD_EQ)[`i:num`;`y:num`;`k:num`] +THEN MRESA_TAC (GEN_ALL TRANS_MOD_EQ_SUC)[`i:num`;`y:num`;`k:num`] +THEN MRESA_TAC DIVISION[`y+k- i MOD k`;`k:num`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i + (y + k - i MOD k) MOD k))`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + SUC ((y + k - i MOD k) MOD k)`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i + SUC ((y + k - i MOD k) MOD k)) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + ((y + k - i MOD k) MOD k)`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (y)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC y`]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD k< k/\ 3<=k==> i MOD k + y + k - i MOD k= k+ y`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`y':num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`y':num`;`k:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`y:num`][ARITH_RULE`1*k=k`] +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`y':num`;`y+k-i MOD k:num`;`i MOD k:num`;`k:num`] [ARITH_RULE`~(3=0)`] +; + +MRESA_TAC DIVISION[`i+x:num`;`k:num`] +; + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i +x))`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + SUC x`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i + SUC x) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + x:num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i +x)MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC((i +x) MOD k)`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_LT[`1`;`k:num`] +THEN MRESAL_TAC MOD_ADD_MOD[`i+x:num`;`1:num`;`k:num`][ADD_AC] +; + + + + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`(vv:num->real^3)`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + x +1`] +THEN MRESA_TAC th[`i + x:num`] +THEN MRESA_TAC th[`SUC ((i + x) MOD k)`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_LT[`1`;`k:num`] +THEN MRESAL_TAC MOD_ADD_MOD[`i+x:num`;`1:num`;`k:num`][ADD_AC] +THEN RESA_TAC; + +MATCH_MP_TAC(REAL_ARITH`a=b==> a1+ #0.1 * -- &1 *a=a1+ #0.1 * -- &1 *b`) +THEN MATCH_MP_TAC SUM_EQ_GENERAL +THEN EXISTS_TAC`(\j. (i+j)MOD k)` +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +; + +REWRITE_TAC[EXISTS_UNIQUE] +THEN EXISTS_TAC`(y+k- i MOD k) MOD k` +THEN MRESA_TAC MOD_LT[`y:num`;`k:num`] +THEN MRESA_TAC (GEN_ALL TRANS_MOD_EQ)[`i:num`;`y:num`;`k:num`] +THEN MRESA_TAC (GEN_ALL TRANS_MOD_EQ_SUC)[`i:num`;`y:num`;`k:num`] +THEN MRESA_TAC DIVISION[`y+k- i MOD k`;`k:num`] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i + (y + k - i MOD k) MOD k))`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + SUC ((y + k - i MOD k) MOD k)`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i + SUC ((y + k - i MOD k) MOD k)) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + ((y + k - i MOD k) MOD k)`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (y)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC y`]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD k< k/\ 3<=k==> i MOD k + y + k - i MOD k= k+ y`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`y':num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`y':num`;`k:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`y:num`][ARITH_RULE`1*k=k`] +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`y':num`;`y+k-i MOD k:num`;`i MOD k:num`;`k:num`] [ARITH_RULE`~(3=0)`] +; + +MRESA_TAC DIVISION[`i+x:num`;`k:num`] +; + + +ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i +x))`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + SUC x`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i + SUC x) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + x:num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i +x)MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC((i +x) MOD k)`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_LT[`1`;`k:num`] +THEN MRESAL_TAC MOD_ADD_MOD[`i+x:num`;`1:num`;`k:num`][ADD_AC] +; + + + + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`(vv:num->real^3)`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + x +1`] +THEN MRESA_TAC th[`i + x:num`] +THEN MRESA_TAC th[`SUC ((i + x) MOD k)`]) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_LT[`1`;`k:num`] +THEN MRESAL_TAC MOD_ADD_MOD[`i+x:num`;`1:num`;`k:num`][ADD_AC] +THEN RESA_TAC; + + + +]);; + + +let PRO_EQU_TAUSTAR_EQ=prove_by_refinement(` is_scs_v39 s /\ BBs_v39 s vv +==> taustar_v39 (scs_prop_equ_v39 s i) (\j. vv (i+j)) = taustar_v39 s vv`, +[ +STRIP_TAC +THEN MP_TAC PRO_EQU_DSV_EQ +THEN RESA_TAC +THEN REWRITE_TAC[taustar_v39;LET_DEF;LET_END_DEF] +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;] +THEN REPEAT RESA_TAC +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN MP_TAC(ARITH_RULE`3<= k==> ~(k=0)/\ 1< k/\ 0real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i+0`] +THEN MRESA_TAC th[`i+1`] +THEN MRESA_TAC th[`i+2`]) +THEN REPLICATE_TAC (3)(POP_ASSUM (fun th-> REWRITE_TAC[SYM th])) +THEN MRESA_TAC MOD_LT[`0`;`k:num`] +THEN MRESA_TAC MOD_LT[`1`;`k:num`] +THEN MRESA_TAC MOD_LT[`2`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`0`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`1`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`2`;`k:num`] +THEN REPLICATE_TAC (3)(POP_ASSUM (fun th-> REWRITE_TAC[SYM th])) +THEN MP_TAC(ARITH_RULE`3<=k /\ k<= 3==> k=3`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD 3<3==> i MOD 3=0\/ i MOD 3=1\/ i MOD 3=2`) +THEN RESA_TAC +THEN REWRITE_TAC[tau3; ARITH_RULE`1 MOD 3=1/\ 2 MOD 3=2/\ 0 MOD 3=0/\ 4 MOD 3=1/\ 5 MOD 3=2/\ 3 MOD 3=0/\ 0+A=A/\ 1+2=3/\ 2+1=3/\ 2+2=4/\ 2+3=5/\ 3+2=5/\ 1+1=2/\1+0=1/\ 2+0=2`] +THEN REAL_ARITH_TAC; + + +MP_TAC(ARITH_RULE` k<=3\/ ~(k<=3)`) +THEN RESA_TAC; + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i+0`] +THEN MRESA_TAC th[`i+1`] +THEN MRESA_TAC th[`i+2`]) +THEN REPLICATE_TAC (3)(POP_ASSUM (fun th-> REWRITE_TAC[SYM th])) +THEN MRESA_TAC MOD_LT[`0`;`k:num`] +THEN MRESA_TAC MOD_LT[`1`;`k:num`] +THEN MRESA_TAC MOD_LT[`2`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`0`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`1`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`2`;`k:num`] +THEN REPLICATE_TAC (3)(POP_ASSUM (fun th-> REWRITE_TAC[SYM th])) +THEN MP_TAC(ARITH_RULE`3<=k /\ k<= 3==> k=3`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD 3<3==> i MOD 3=0\/ i MOD 3=1\/ i MOD 3=2`) +THEN RESA_TAC +THEN REWRITE_TAC[tau3; ARITH_RULE`1 MOD 3=1/\ 2 MOD 3=2/\ 0 MOD 3=0/\ 4 MOD 3=1/\ 5 MOD 3=2/\ 3 MOD 3=0/\ 0+A=A/\ 1+2=3/\ 2+1=3/\ 2+2=4/\ 2+3=5/\ 3+2=5/\ 1+1=2/\1+0=1/\ 2+0=2`] +THEN REAL_ARITH_TAC; + + +MATCH_MP_TAC(REAL_ARITH`a=b==> a-c=b-c`) +THEN REWRITE_TAC[tau_fun] +THEN MP_TAC TRANS_FF +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;] +THEN RESA_TAC +THEN MATCH_MP_TAC(REAL_ARITH`a=b==> a-c=b-c`) +THEN POP_ASSUM(fun th-> +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM th;]) +THEN MRESAL_TAC (GEN_ALL SUM_AZIM_EQ_ANGLE_LE4) +[`IMAGE (vv:num->real^3) (:num)`;`vv:num->real^3`;`i:num`;`s:scs_v39`;`(vv:num->real^3)(i MOD k)`;`IMAGE (\i. vv i,(vv:num->real^3) (SUC i)) (:num)`;`IMAGE (\i. {vv i, (vv:num->real^3) (SUC i)}) (:num)`][BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC BB_TRANS_SUBSET_BB +THEN ASM_REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;] +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL PROP_EQU_IS_SCS)[`k:num`;`s:scs_v39`;`i:num`;`scs_prop_equ_v39 s i`] +[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;] +THEN MRESAL_TAC (GEN_ALL SUM_AZIM_EQ_ANGLE_LE4) +[`IMAGE (\x. (vv:num->real^3) (i + x)) (:num)`;`(\x. (vv:num->real^3) (i+x)) `;`0:num`;`scs_prop_equ_v39 s i`;`(\x. (vv:num->real^3) (i+x))(0 MOD k)`;`IMAGE (\i'. vv (i + i'),(vv:num->real^3) (i + SUC i')) (:num)`;`IMAGE (\i'. {(vv:num->real^3) (i + i'), vv (i + SUC i')}) (:num)`][BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC MOD_LT[`0`;`k:num`][ARITH_RULE`A+0=A`] +THEN MP_TAC TRANS_FF +THEN REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;] +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN MATCH_MP_TAC SUM_EQ +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[REAL_EQ_MUL_RCANCEL] +THEN MATCH_MP_TAC(SET_RULE`A==> A\/ B`) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MRESA_TAC th[`i+x:num`] +THEN MRESA_TAC th[`x +i MOD k:num`]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_LT[`x:num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`x:num`;`k:num`] +THEN ASM_REWRITE_TAC[ARITH_RULE`x+ i MOD k= i MOD k+ x`]]);; + + + + +let TRANS_ID_INDEX=prove(`~(k=0) ==> (k- i MOD k +i+ j) MOD k= j MOD k`, +STRIP_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD k=0 \/ ~(i MOD k=0)`) +THEN RESA_TAC +THENL[ +REWRITE_TAC[ARITH_RULE`k-0=k`] +THEN MRESA_TAC MOD_REFL[`j:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`i+j:num`][ARITH_RULE`1*k=k`] +THEN MRESAL_TAC MOD_ADD_MOD[`i:num`;`j:num`;`k:num`][ARITH_RULE`1*k=k/\ 0+A=A`]; + +MP_TAC(ARITH_RULE`~(i MOD k = 0) /\ i MOD k< k/\ ~(k=0)==> k -i MOD k REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`0+A=A`]) +THEN MRESA_TAC MOD_REFL[`j:num`;`k:num`]]);; + + + +let TRANS_SCS_A_ID=prove(` scs_k_v39 s =k /\ is_scs_v39 s +==> +(\j j'. scs_a_v39 s (k - i MOD k + i + j) (k - i MOD k + i + j')) += scs_a_v39 s`, +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;FUN_EQ_THM;periodic2] +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (k - i MOD k + i + x)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`k - i MOD k + i + x'`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((k - i MOD k + i + x') MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`k - i MOD k + i + x`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[TRANS_ID_INDEX] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (x)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[` x':num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((x') MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[` x:num`]));; + + +search[`(i + (x + k - i MOD k) MOD k) MOD k`] +;; + +let TRANS_SCS_A_ID_MOD=prove(` scs_k_v39 s =k /\ is_scs_v39 s +==> +(\j j'. scs_a_v39 s (i+ (j+ k - i MOD k) MOD k) (i+ (j'+ k - i MOD k) MOD k)) += scs_a_v39 s`, +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;FUN_EQ_THM;periodic2] +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (i + (x + k - i MOD k) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + (x' + k - i MOD k) MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((i + (x' + k - i MOD k) MOD k) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + (x + k - i MOD k) MOD k`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[TRANS_MOD_EQ] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (x)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[` x':num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((x') MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[` x:num`]));; + + + + +let TRANS_SCS_B_ID=prove(` scs_k_v39 s =k /\ is_scs_v39 s +==> +(\j j'. scs_b_v39 s (k - i MOD k + i + j) (k - i MOD k + i + j')) += scs_b_v39 s`, +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;FUN_EQ_THM;periodic2] +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (k - i MOD k + i + x)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`k - i MOD k + i + x'`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s ((k - i MOD k + i + x') MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`k - i MOD k + i + x`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[TRANS_ID_INDEX] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (x)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[` x':num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s ((x') MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[` x:num`]));; + + +let TRANS_SCS_B_ID_MOD=prove(` scs_k_v39 s =k /\ is_scs_v39 s +==> +(\j j'. scs_b_v39 s (i+ (j+ k - i MOD k) MOD k) (i+ (j'+ k - i MOD k) MOD k)) += scs_b_v39 s`, +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;FUN_EQ_THM;periodic2] +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (i + (x + k - i MOD k) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + (x' + k - i MOD k) MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s ((i + (x' + k - i MOD k) MOD k) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + (x + k - i MOD k) MOD k`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[TRANS_MOD_EQ] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (x)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[` x':num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s ((x') MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[` x:num`]));; + + + +let TRANS_SCS_AM_ID=prove(` scs_k_v39 s =k /\ is_scs_v39 s +==> +(\j j'. scs_am_v39 s (k - i MOD k + i + j) (k - i MOD k + i + j')) += scs_am_v39 s`, +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;FUN_EQ_THM;periodic2] +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s (k - i MOD k + i + x)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`k - i MOD k + i + x'`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s ((k - i MOD k + i + x') MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`k - i MOD k + i + x`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[TRANS_ID_INDEX] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s (x)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[` x':num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s ((x') MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[` x:num`]));; + + +let TRANS_SCS_AM_ID_MOD=prove(` scs_k_v39 s =k /\ is_scs_v39 s +==> +(\j j'. scs_am_v39 s (i+ (j+ k - i MOD k) MOD k) (i+ (j'+ k - i MOD k) MOD k)) += scs_am_v39 s`, +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;FUN_EQ_THM;periodic2] +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s (i + (x + k - i MOD k) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + (x' + k - i MOD k) MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s ((i + (x' + k - i MOD k) MOD k) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + (x + k - i MOD k) MOD k`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[TRANS_MOD_EQ] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s (x)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[` x':num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_am_v39 s ((x') MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[` x:num`]));; + + + + + + +let TRANS_SCS_BM_ID=prove(` scs_k_v39 s =k /\ is_scs_v39 s +==> +(\j j'. scs_bm_v39 s (k - i MOD k + i + j) (k - i MOD k + i + j')) += scs_bm_v39 s`, +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;FUN_EQ_THM;periodic2] +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s (k - i MOD k + i + x)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`k - i MOD k + i + x'`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s ((k - i MOD k + i + x') MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`k - i MOD k + i + x`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[TRANS_ID_INDEX] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s (x)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[` x':num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s ((x') MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[` x:num`]));; + + + + +let TRANS_SCS_BM_ID_MOD=prove(` scs_k_v39 s =k /\ is_scs_v39 s +==> +(\j j'. scs_bm_v39 s (i+ (j+ k - i MOD k) MOD k) (i+ (j'+ k - i MOD k) MOD k)) += scs_bm_v39 s`, +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;FUN_EQ_THM;periodic2] +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s (i + (x + k - i MOD k) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + (x' + k - i MOD k) MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s ((i + (x' + k - i MOD k) MOD k) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + (x + k - i MOD k) MOD k`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[TRANS_MOD_EQ] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s (x)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[` x':num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_bm_v39 s ((x') MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[` x:num`]));; + + + + + +let TRANS_SCS_J_ID=prove(` scs_k_v39 s =k /\ is_scs_v39 s +==> +(\j j'. scs_J_v39 s (k - i MOD k + i + j) (k - i MOD k + i + j')) += scs_J_v39 s`, +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;FUN_EQ_THM;periodic2] +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (k - i MOD k + i + x)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`k - i MOD k + i + x'`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((k - i MOD k + i + x') MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`k - i MOD k + i + x`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[TRANS_ID_INDEX] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (x)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[` x':num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((x') MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[` x:num`]));; + + + +let TRANS_SCS_J_ID_MOD=prove(` scs_k_v39 s =k /\ is_scs_v39 s +==> +(\j j'. scs_J_v39 s (i+ (j+ k - i MOD k) MOD k) (i+ (j'+ k - i MOD k) MOD k)) += scs_J_v39 s`, +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;FUN_EQ_THM;periodic2] +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (i + (x + k - i MOD k) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + (x' + k - i MOD k) MOD k`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((i + (x' + k - i MOD k) MOD k) MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + (x + k - i MOD k) MOD k`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[TRANS_MOD_EQ] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s (x)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[` x':num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_J_v39 s ((x') MOD k)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[` x:num`]));; + + + + + + + +let TRANS_SCS_LO_ID=prove(` scs_k_v39 s =k /\ is_scs_v39 s +==> +(\j. scs_lo_v39 s (k - i MOD k + i + j)) += scs_lo_v39 s`, +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;FUN_EQ_THM;periodic2] +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_lo_v39 s `][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`k - i MOD k + i + x`] +THEN MRESA_TAC th[`x:num`]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[TRANS_ID_INDEX]);; + + +let TRANS_SCS_HI_ID=prove(` scs_k_v39 s =k /\ is_scs_v39 s +==> +(\j. scs_hi_v39 s (k - i MOD k + i + j)) += scs_hi_v39 s`, +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;FUN_EQ_THM;periodic2] +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_hi_v39 s `][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`k - i MOD k + i + x`] +THEN MRESA_TAC th[`x:num`]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[TRANS_ID_INDEX]);; + + +let TRANS_SCS_STR_ID=prove(` scs_k_v39 s =k /\ is_scs_v39 s +==> +(\j. scs_str_v39 s (k - i MOD k + i + j)) += scs_str_v39 s`, +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;FUN_EQ_THM;periodic2] +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_str_v39 s `][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`k - i MOD k + i + x`] +THEN MRESA_TAC th[`x:num`]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[TRANS_ID_INDEX]);; + + + +let PRO_EQU_ID=prove(` scs_k_v39 s =k /\ is_scs_v39 s +==> s= scs_prop_equ_v39 (scs_prop_equ_v39 s (k- i MOD k)) i`, +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;scs_diag;scs_v39_explicit;is_scs_slice_v39;] +THEN STRIP_TAC +THEN ASM_SIMP_TAC[TRANS_SCS_STR_ID;TRANS_SCS_HI_ID;TRANS_SCS_LO_ID; +TRANS_SCS_A_ID;TRANS_SCS_B_ID;TRANS_SCS_AM_ID;TRANS_SCS_BM_ID;TRANS_SCS_J_ID;] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;scs_v39_explicit;scs_k_v39; +scs_d_v39;scs_a_v39 ; + scs_am_v39 ; + scs_bm_v39 ; + scs_b_v39 ; + scs_J_v39 ; + scs_lo_v39 ; + scs_hi_v39 ; + scs_str_v39; +scs_v39;Misc_defs_and_lemmas.part6;Misc_defs_and_lemmas.drop3;FST; +Misc_defs_and_lemmas.part1;Misc_defs_and_lemmas.drop1; +Misc_defs_and_lemmas.part2;Misc_defs_and_lemmas.drop2; +Misc_defs_and_lemmas.part3;Misc_defs_and_lemmas.drop3; +Misc_defs_and_lemmas.part4;Misc_defs_and_lemmas.drop0; +Misc_defs_and_lemmas.part5; +Misc_defs_and_lemmas.part7; +Misc_defs_and_lemmas.part8; +Misc_defs_and_lemmas.part0;]));; + + +let PRO_EQU_ID1=prove(` scs_k_v39 s =k /\ is_scs_v39 s +==> s= scs_prop_equ_v39 (scs_prop_equ_v39 s i) (k- i MOD k)`, +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;scs_diag;scs_v39_explicit;is_scs_slice_v39;] +THEN STRIP_TAC +THEN REWRITE_TAC[ARITH_RULE`i + k - i MOD k+j =k - i MOD k +i +j`] +THEN ASM_SIMP_TAC[TRANS_SCS_STR_ID;TRANS_SCS_HI_ID;TRANS_SCS_LO_ID; +TRANS_SCS_A_ID;TRANS_SCS_B_ID;TRANS_SCS_AM_ID;TRANS_SCS_BM_ID;TRANS_SCS_J_ID;] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;scs_v39_explicit;scs_k_v39; +scs_d_v39;scs_a_v39 ; + scs_am_v39 ; + scs_bm_v39 ; + scs_b_v39 ; + scs_J_v39 ; + scs_lo_v39 ; + scs_hi_v39 ; + scs_str_v39; +scs_v39;Misc_defs_and_lemmas.part6;Misc_defs_and_lemmas.drop3;FST; +Misc_defs_and_lemmas.part1;Misc_defs_and_lemmas.drop1; +Misc_defs_and_lemmas.part2;Misc_defs_and_lemmas.drop2; +Misc_defs_and_lemmas.part3;Misc_defs_and_lemmas.drop3; +Misc_defs_and_lemmas.part4;Misc_defs_and_lemmas.drop0; +Misc_defs_and_lemmas.part5; +Misc_defs_and_lemmas.part7; +Misc_defs_and_lemmas.part8; +Misc_defs_and_lemmas.part0;]));; + + + +let PROP_EQU_EQ_BB=prove(` is_scs_v39 s/\ is_scs_v39 (scs_prop_equ_v39 s i) /\ BBs_v39 (scs_prop_equ_v39 s i) vv /\ scs_k_v39 s=k +==> BBs_v39 s (\x. vv (k- i MOD k +x))`, +STRIP_TAC +THEN MP_TAC PRO_EQU_ID1 +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL BB_TRANS_SUBSET_BB)[`scs_prop_equ_v39 s i`;`(vv:num->real^3) `;`k- i MOD k`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]));; + + +let TRANS_SCS_WW_ID=prove(`scs_k_v39 s= k/\ 3<= k /\ BBs_v39 (scs_prop_equ_v39 s i) ww +==> (\j. ww (k - i MOD k + i + j)) = ww`, +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;FUN_EQ_THM;periodic2] +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`ww:num->real^3 `][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`k - i MOD k + i + x`] +THEN MRESA_TAC th[`x:num`]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[TRANS_ID_INDEX]);; + + + + +let scs_k_le_3=prove(`is_scs_v39 s ==> 3<= scs_k_v39 s`, +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;FUN_EQ_THM;periodic2] +THEN REPEAT RESA_TAC);; + + +let TRANS_SCS_BBPRIME=prove(` is_scs_v39 s /\ BBprime_v39 s vv +==> BBprime_v39 (scs_prop_equ_v39 s i) (\x. vv (i+x))`, +REWRITE_TAC[BBprime_v39] +THEN STRIP_TAC +THEN MP_TAC BB_TRANS_SUBSET_BB +THEN RESA_TAC +THEN MP_TAC PRO_EQU_TAUSTAR_EQ +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN MRESAL_TAC(GEN_ALL PROP_EQU_IS_SCS)[`k:num`;`s:scs_v39`;`i:num`;`(scs_prop_equ_v39 s i)`;][LET_DEF;LET_END_DEF;unadorned_v39;scs_v39_explicit] +THEN MP_TAC scs_k_le_3 +THEN RESA_TAC +THEN MP_TAC TRANS_SCS_WW_ID +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL PROP_EQU_EQ_BB)[`s:scs_v39`;`ww:num->real^3`;`i:num`;`k:num`] +THEN MRESA_TAC (GEN_ALL PRO_EQU_TAUSTAR_EQ)[`i:num`;`s:scs_v39`;`(\x. (ww:num->real^3) (k - i MOD k + x))`] +THEN REPLICATE_TAC (12-2)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MATCH_MP_TAC th) +THEN ASM_REWRITE_TAC[]);; + + + +let TRANS_BBINDEX_ID= prove_by_refinement(` scs_k_v39 s= k/\ is_scs_v39 s /\ BBs_v39 s vv +==> +BBindex_v39 (scs_prop_equ_v39 s i) (\x. vv (i + x)) += BBindex_v39 s vv`, +[ +STRIP_TAC +THEN MP_TAC TRANS_SCS_A_ID_MOD +THEN RESA_TAC +THEN ASM_TAC +THEN +REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;FUN_EQ_THM;periodic2;BBindex_v39] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)/\ 1 REPEAT STRIP_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((i + (x + k - i MOD k) MOD k))`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + ((SUC x + k - i MOD k) MOD k)`] +THEN MRESA_TAC th[`i + SUC ((x + k - i MOD k) MOD k)`] +) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[TRANS_MOD_EQ_SUC;TRANS_MOD_EQ] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`x:num`] +THEN MRESA_TAC th[`SUC x`] +THEN MRESA_TAC th[`i + ((x + k - i MOD k) MOD k)`] +THEN MRESA_TAC th[`i + SUC ((x + k - i MOD k) MOD k)`] +) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[TRANS_MOD_EQ_SUC;TRANS_MOD_EQ]; + + +REWRITE_TAC[IN_ELIM_THM;EXISTS_UNIQUE] +THEN GEN_TAC +THEN RESA_TAC +THEN EXISTS_TAC`(i +y) MOD k` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC DIVISION[`i+y:num`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD k< k==> (i MOD k + y MOD k) + k - i MOD k= k + y MOD k`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`y:num`][ARITH_RULE`1*k=k`] +THEN MRESA_TAC MOD_REFL[`i+y:num`;`k:num`] +THEN MRESA_TAC MOD_LT[`y:num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`y:num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i MOD k +y MOD k :num`;`k- i MOD k:num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`(i +y) MOD k :num`;`k- i MOD k:num`;`k:num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC ((i + y) MOD k))`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + y:num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ( ((i + y)))`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC ((i + y) MOD k)`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ADD1]) +THEN MRESA_TAC MOD_LT[`1:num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i +y :num`;`1:num`;`k:num`] +THEN ASM_REWRITE_TAC[GSYM ADD1] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ( ((i + y)))`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC ((i + y))`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC ((i + y) MOD k)`] +THEN MRESA_TAC th[`((i + y)):num`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;ADD1]) +THEN ASM_REWRITE_TAC[GSYM ADD1] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC ((i + y))`]) +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(i+j)= i+ SUC j`] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_ADD_MOD[`(i +y) :num`;`k- i MOD k:num`;`k:num`] +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`y':num`;`i+y:num`;`k-i MOD k:num`;`k:num`] +[ARITH_RULE`k - i MOD k + y'= y' + k- i MOD k`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_LT[`y':num`;`k:num`] +THEN RESA_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0.. k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC; + + +STRIP_TAC; + +REWRITE_TAC[IN_ELIM_THM] +THEN GEN_TAC +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`x+k- i MOD k`;`k:num`] +THEN REPLICATE_TAC (31-25)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`x:num`;`SUC x`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ((i + (x + k - i MOD k) MOD k))`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + ((SUC x + k - i MOD k) MOD k)`] +THEN MRESA_TAC th[`i + SUC ((x + k - i MOD k) MOD k)`] +) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[TRANS_MOD_EQ_SUC;TRANS_MOD_EQ] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`x:num`] +THEN MRESA_TAC th[`SUC x`] +THEN MRESA_TAC th[`i + ((x + k - i MOD k) MOD k)`] +THEN MRESA_TAC th[`i + SUC ((x + k - i MOD k) MOD k)`] +) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[TRANS_MOD_EQ_SUC;TRANS_MOD_EQ]; + + +REWRITE_TAC[IN_ELIM_THM;EXISTS_UNIQUE] +THEN GEN_TAC +THEN RESA_TAC +THEN EXISTS_TAC`(i +y) MOD k` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC DIVISION[`i+y:num`;`k:num`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD k< k==> (i MOD k + y MOD k) + k - i MOD k= k + y MOD k`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1`;`k:num`;`y:num`][ARITH_RULE`1*k=k`] +THEN MRESA_TAC MOD_REFL[`i+y:num`;`k:num`] +THEN MRESA_TAC MOD_LT[`y:num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`y:num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i MOD k +y MOD k :num`;`k- i MOD k:num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`(i +y) MOD k :num`;`k- i MOD k:num`;`k:num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (SUC ((i + y) MOD k))`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`i + y:num`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ( ((i + y)))`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC ((i + y) MOD k)`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ADD1]) +THEN MRESA_TAC MOD_LT[`1:num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i +y :num`;`1:num`;`k:num`] +THEN ASM_REWRITE_TAC[GSYM ADD1] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s ( ((i + y)))`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC ((i + y))`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC ((i + y) MOD k)`] +THEN MRESA_TAC th[`((i + y)):num`]) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;ADD1]) +THEN ASM_REWRITE_TAC[GSYM ADD1] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`SUC ((i + y))`]) +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(i+j)= i+ SUC j`] +THEN REPEAT RESA_TAC +THEN MRESA_TAC MOD_ADD_MOD[`(i +y) :num`;`k- i MOD k:num`;`k:num`] +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`y':num`;`i+y:num`;`k-i MOD k:num`;`k:num`] +[ARITH_RULE`k - i MOD k + y'= y' + k- i MOD k`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_LT[`y':num`;`k:num`] +THEN RESA_TAC]);; + + + + +let PROP_EQU_EQ_BBPRIME=prove(`is_scs_v39 s/\ is_scs_v39 (scs_prop_equ_v39 s i) /\ BBprime_v39 (scs_prop_equ_v39 s i) vv /\ scs_k_v39 s=k +==> BBprime_v39 s (\x. vv (k- i MOD k +x))`, +STRIP_TAC +THEN MP_TAC PRO_EQU_ID1 +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL TRANS_SCS_BBPRIME)[`scs_prop_equ_v39 s i`;`(vv:num->real^3) `;`k- i MOD k`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]));; + + +let TRANS_IMAGE_BBINDEX_EQ=prove(`scs_k_v39 s = k /\ is_scs_v39 s +==> +IMAGE (BBindex_v39 (scs_prop_equ_v39 s i)) + (BBprime_v39 (scs_prop_equ_v39 s i)) +=IMAGE (BBindex_v39 s) (BBprime_v39 s)`, +STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;EXTENSION] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +REWRITE_TAC[IN] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`(\x1. (x':num->real^3) (k- i MOD k +x1))` +THEN MRESA_TAC(GEN_ALL PROP_EQU_IS_SCS)[`k:num`;`s:scs_v39`;`i:num`;`(scs_prop_equ_v39 s i)`;] +THEN MRESA_TAC (GEN_ALL PROP_EQU_EQ_BBPRIME)[`s:scs_v39`;`x':num->real^3`;`i:num`;`k:num`] +THEN MP_TAC scs_k_le_3 +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;BBprime_v39] +THEN REPEAT RESA_TAC +THEN MRESA_TAC (GEN_ALL TRANS_SCS_WW_ID)[`s:scs_v39`;`k:num`;`i:num`;`x':num->real^3`] +THEN MRESA_TAC(GEN_ALL TRANS_BBINDEX_ID)[`k:num`;`i:num`;`s:scs_v39`;`(\x1. (x':num->real^3) (k - i MOD k + x1))`]; + +REWRITE_TAC[IN] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`(\x1. (x':num->real^3) (i +x1))` +THEN MRESA_TAC(GEN_ALL TRANS_SCS_BBPRIME)[`s:scs_v39`;`x':num->real^3`;`i:num`] +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;BBprime_v39] +THEN REPEAT RESA_TAC +THEN MRESA_TAC(GEN_ALL TRANS_BBINDEX_ID)[`k:num`;`i:num`;`s:scs_v39`;`x':num->real^3`]]);; + + + +let TRANS_BBINDEX_MIN_EQ=prove(` scs_k_v39 s= k/\ is_scs_v39 s /\ BBs_v39 s vv +==> +BBindex_min_v39 (scs_prop_equ_v39 s i) += BBindex_min_v39 s`, +SIMP_TAC[BBindex_min_v39;] +THEN STRIP_TAC +THEN MP_TAC TRANS_IMAGE_BBINDEX_EQ +THEN RESA_TAC);; + + + +let TRANS_BBPRIME2_SUBSET=prove(` is_scs_v39 s /\ BBprime2_v39 s vv +==> BBprime2_v39 (scs_prop_equ_v39 s i) (\x. vv (i+x))`, +REWRITE_TAC[BBprime2_v39] +THEN STRIP_TAC +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN MP_TAC TRANS_SCS_BBPRIME +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;BBprime_v39] +THEN REPEAT RESA_TAC +THEN MP_TAC TRANS_BBINDEX_MIN_EQ +THEN RESA_TAC +THEN MP_TAC TRANS_BBINDEX_ID +THEN RESA_TAC);; + + + +let TRANS_MMS_SUBSET=prove(` is_scs_v39 s /\ MMs_v39 s vv +==> MMs_v39 (scs_prop_equ_v39 s i) (\x. vv (i+x))`, +REWRITE_TAC[MMs_v39] +THEN RESA_TAC +THEN MP_TAC TRANS_BBPRIME2_SUBSET +THEN RESA_TAC +THEN ASM_REWRITE_TAC[BBs_v39;LET_DEF;LET_END_DEF;scs_prop_equ_v39;MMs_v39; BBprime2_v39;BBprime_v39;BBs_v39;LET_DEF;LET_END_DEF;is_scs_v39;scs_diag;scs_v39_explicit;is_scs_slice_v39;FUN_EQ_THM;periodic2;BBindex_v39] +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[ARITH_RULE`i + SUC j= SUC(i+j)/\ i + i' + scs_k_v39 s - 1= (i + i') + scs_k_v39 s - 1`] +THEN REPLICATE_TAC (8-2)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`i+i':num`]));; + + +let YXIONXL3=prove_by_refinement(`!s i. + is_scs_v39 s ==> scs_arrow_v39 {s} {scs_prop_equ_v39 s i}`, +[REPEAT GEN_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +MRESA_TAC(GEN_ALL PROP_EQU_IS_SCS)[`k:num`;`s:scs_v39`;`i:num`;`(scs_prop_equ_v39 s i)`;]; + +DISJ_CASES_TAC(SET_RULE`(!s'. s' = s ==> MMs_v39 s' = {}) \/ ~((!s'. s' = s ==> MMs_v39 s' = {}))`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`scs_prop_equ_v39 s i` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?vv. vv IN A`;IN] +THEN STRIP_TAC +THEN EXISTS_TAC`(\x. (vv:num->real^3) (i+x))` +THEN ASM_SIMP_TAC[TRANS_MMS_SUBSET]]);; + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/YXIONXL2.hl b/text_formalization/local/YXIONXL2.hl new file mode 100755 index 0000000..f4d558e --- /dev/null +++ b/text_formalization/local/YXIONXL2.hl @@ -0,0 +1,4195 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Yxionxl2 = struct + + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +let IN_SYM_0=prove(`a IN A ==> (-- a) IN IMAGE (\x:real^N. -- x) A`, +REWRITE_TAC[IMAGE;IN_ELIM_THM;VECTOR_ARITH`(--a= --b)<=> (a=b:real^N)`] +THEN SET_TAC[]);; + + + +let SUBSET_SYM_0=prove(`A SUBSET B ==> IMAGE (\x. -- x) A SUBSET IMAGE (\x:real^N. -- x) B`, +REWRITE_TAC[SUBSET;IMAGE;IN_ELIM_THM;VECTOR_ARITH`(--a= --b)<=> (a=b:real^N)`] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[VECTOR_ARITH`(--a= --b)<=> (a=b:real^N)`] +THEN ASM_TAC +THEN SET_TAC[]);; + +let SET_EQ_SYM_0=prove(`A = B ==> IMAGE (\x. -- x) A = IMAGE (\x:real^N. -- x) B`, +REWRITE_TAC[EXTENSION] +THEN REPEAT RESA_TAC +THEN EQ_TAC +THEN ASM_SIMP_TAC[VECTOR_ARITH`(--a= --b)<=> (a=b:real^N)`] +THEN ASM_TAC +THEN SET_TAC[]);; + + +let IMAGE_V_SYM_0=prove(`IMAGE (\i. --(vv:num->real^N) i) (:num)= IMAGE (\x. -- x) (IMAGE vv (:num))`, +REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THENL[ +EXISTS_TAC`(vv:num->real^N) x'` +THEN ASM_SIMP_TAC[VECTOR_ARITH`(--a= --b)<=> (a=b:real^N)`] +THEN EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[]; +EXISTS_TAC`x'':num` +THEN ASM_SIMP_TAC[VECTOR_ARITH`(--a= --b)<=> (a=b:real^N)`]]);; + + + +let UNIONS_IMAGE_FAN_SYM_0=prove_by_refinement(`UNIONS (IMAGE (\i. {--vv i, --vv (SUC i)}) (:num)) += IMAGE (\x:real^N. -- x) (UNIONS (IMAGE (\i. {vv i, vv (SUC i)}) (:num)))`, +[REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[UNIONS;IMAGE;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[SET_RULE`a IN {b,c} <=> a=b\/ a=c`] +THEN RESA_TAC; + +EXISTS_TAC`(vv:num->real^N) x'` +THEN ASM_SIMP_TAC[VECTOR_ARITH`(--a= --b)<=> (a=b:real^N)`] +THEN EXISTS_TAC`{(vv:num->real^N) x', vv (SUC x')}` +THEN ASM_REWRITE_TAC[SET_RULE`a IN {a,b}`] +THEN EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[]; + +EXISTS_TAC`(vv:num->real^N) (SUC x')` +THEN ASM_SIMP_TAC[VECTOR_ARITH`(--a= --b)<=> (a=b:real^N)`] +THEN EXISTS_TAC`{(vv:num->real^N) x', vv (SUC x')}` +THEN ASM_REWRITE_TAC[SET_RULE`a IN {b,a}`] +THEN EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[]; +REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[SET_RULE`a IN {b,c} <=> a=b\/ a=c`] +THEN RESA_TAC; +EXISTS_TAC`{--(vv:num->real^N) x', --vv (SUC x')}` +THEN ASM_REWRITE_TAC[SET_RULE`a IN {a,b}`] +THEN EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[]; +EXISTS_TAC`{--(vv:num->real^N) x', --vv (SUC x')}` +THEN ASM_REWRITE_TAC[SET_RULE`a IN {b,a}`] +THEN EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[]]);; + + +let FINITE_SYM_0=prove(`FINITE A ==> FINITE (IMAGE (\x:real^N. -- x) A)`, +SIMP_TAC[FINITE_IMAGE]);; + +let CARD_SYM_0=prove(`FINITE A ==> CARD (IMAGE (\x:real^N. -- x) A)= CARD A`, +STRIP_TAC +THEN MATCH_MP_TAC CARD_IMAGE_INJ +THEN RESA_TAC +THEN ASM_SIMP_TAC[VECTOR_ARITH`(--a= --b)<=> (a=b:real^N)`]);; + + +let ELEMENT2_SYM_0=prove(`{--a, --b}= IMAGE (\x:real^N. --x) {a,b}`, +REWRITE_TAC[IMAGE;IN_ELIM_THM;EXTENSION;SET_RULE`a IN{b,c} <=> a=b\/ a=c`] +THEN GEN_TAC +THEN EQ_TAC +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[VECTOR_ARITH`(--a= --b)<=> (a=b:real^N)`] +THEN SET_TAC[]);; + + +let GRAPH_SYM_0=prove(`graph (IMAGE (\i. {(vv:num->real^N) i, vv (SUC i)}) (:num)) +==> +graph (IMAGE (\i. {--vv i, --vv (SUC i)}) (:num))`, +REWRITE_TAC[GRAPH;HAS_SIZE;IMAGE;IN_ELIM_THM] +THEN STRIP_TAC +THEN GEN_TAC +THEN RESA_TAC +THEN SUBGOAL_THEN `(?x'. x' IN (:num) /\ {(vv:num->real^N) x, vv (SUC x)} = {vv x', vv (SUC x')})`ASSUME_TAC +THENL[ +EXISTS_TAC`x:num` +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th1-> REPEAT DISCH_TAC THEN + MRESA_TAC th1[`{(vv:num->real^N) x, vv (SUC x)}`]) +THEN ASM_SIMP_TAC[ELEMENT2_SYM_0;FINITE_SYM_0;CARD_SYM_0]]);; + + +let NOT_SUBSET_EMPTY_SYM_0=prove(`~(A SUBSET {}) +==> ~(IMAGE (\x:real^N. --x) A SUBSET {})`, +REWRITE_TAC[SET_RULE`~(A SUBSET {}) <=> ?a. a IN A`] +THEN RESA_TAC +THEN EXISTS_TAC`-- a:real^N` +THEN ASM_SIMP_TAC[IN_SYM_0]);; + + +let NOT_EMPTY_SYM_0=prove(`~(A ={}) +==> ~(IMAGE (\x:real^N. --x) A = {})`, +REWRITE_TAC[SET_RULE`~(A = {}) <=> ?a. a IN A`] +THEN RESA_TAC +THEN EXISTS_TAC`-- a:real^N` +THEN ASM_SIMP_TAC[IN_SYM_0]);; + + +let REFL_SYM_0=prove(`IMAGE (\x:real^N. --x) (IMAGE (\x. --x) A) =A`, +REWRITE_TAC[IMAGE;IN_ELIM_THM;EXTENSION] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN ASM_SIMP_TAC[VECTOR_ARITH`-- -- A=A:real^N`] +THEN EXISTS_TAC`--x:real^N` +THEN ASM_SIMP_TAC[VECTOR_ARITH`-- -- A=A:real^N`] +THEN EXISTS_TAC`x:real^N` +THEN ASM_REWRITE_TAC[]);; + + +let IMAGE_E_SYM_0=prove(`e IN IMAGE (\i. {--vv i, --vv (SUC i)}) (:num) +==> IMAGE (\x:real^N. --x) e IN IMAGE (\i. {vv i, vv (SUC i)}) (:num)`, +REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`x:num` +THEN ASM_REWRITE_TAC[EXTENSION;IN_ELIM_THM;SET_RULE`a IN {b,c} <=> a=b\/ a=c`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN ASM_SIMP_TAC[VECTOR_ARITH`(-- --a=a:real^N)`] +THENL[ + EXISTS_TAC`-- (vv:num->real^N) x` +THEN ASM_SIMP_TAC[VECTOR_ARITH`(-- --a=a:real^N)`]; + EXISTS_TAC`-- (vv:num->real^N) (SUC x)` +THEN ASM_SIMP_TAC[VECTOR_ARITH`(-- --a=a:real^N)`]]);; + + +let COLLINEAR_SYM_0=prove(`(collinear e) ==> (collinear (IMAGE (\x:real^N. --x) e))`, +REWRITE_TAC[collinear;IMAGE;IN_ELIM_THM] +THEN RESA_TAC +THEN EXISTS_TAC`--u:real^N` +THEN REPEAT RESA_TAC +THEN ASM_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`x':real^N`;`x'':real^N`]) +THEN EXISTS_TAC`c:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`c % --u = --(c % u)/\ -- a - -- b= --(a-b:real^N)`]);; + + + + +let UNION_SYM_0=prove(`IMAGE (\x:real^N. --x) (s UNION e) = (IMAGE (\x:real^N. --x) s) UNION (IMAGE (\x:real^N. --x) e)`, +SIMP_TAC[IMAGE_UNION]);; + + +let VEC0_SYM_0=prove(`IMAGE (\x:real^N. --x) {vec 0}= {vec 0}`, +REWRITE_TAC[IMAGE;IN_ELIM_THM;IN_SING;VECTOR_ARITH`-- vec 0=vec 0`;EXTENSION] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;IN_SING;VECTOR_ARITH`-- vec 0=vec 0`;EXTENSION] +THEN EXISTS_TAC`vec 0:real^N` +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;IN_SING;VECTOR_ARITH`-- vec 0=vec 0`;EXTENSION]);; + + +let VEC0_UNION_SYM_0=prove(`IMAGE (\x:real^N. --x) ({vec 0} UNION e) = {vec 0} UNION (IMAGE (\x:real^N. --x) e)`, +ASM_SIMP_TAC[UNION_SYM_0;VEC0_SYM_0]);; + + +let NOT_COLLINEAR_SYM_0=prove(`~(collinear e) ==> ~(collinear (IMAGE (\x:real^N. --x) e))`, +REPEAT STRIP_TAC +THEN MRESA_TAC(GEN_ALL COLLINEAR_SYM_0)[`IMAGE (\x:real^N. --x) (e:real^N->bool)`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[REFL_SYM_0]);; + + +let VEC0_NOT_COLLINEAR_SYM_0=prove(`~(collinear ({vec 0} UNION e)) ==> ~(collinear ({vec 0} UNION (IMAGE (\x:real^N. --x) e)))`, +REPEAT STRIP_TAC +THEN MRESAL_TAC(GEN_ALL NOT_COLLINEAR_SYM_0)[`{vec 0} UNION (e:real^N->bool)`] +[VEC0_UNION_SYM_0]);; + + +let IMAGE_E_UNION_V_SYM_0=prove(`e IN + IMAGE (\i. {--vv i, --vv (SUC i)}) (:num) UNION + {{v} | v IN IMAGE (\i. --vv i) (:num)} +==> IMAGE (\x:real^N. --x) e IN IMAGE (\i. {vv i, vv (SUC i)}) (:num) UNION + {{v} | v IN IMAGE vv (:num)}`, +REWRITE_TAC[UNION;IN_ELIM_THM] +THEN MATCH_MP_TAC(SET_RULE`(A==>A1)/\ (B==>B1)==> (A\/B==> A1\/B1)`) +THEN ASM_SIMP_TAC[IMAGE_E_SYM_0] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;] +THEN RESA_TAC +THEN REWRITE_TAC[IN_SING] +THEN EXISTS_TAC`(vv:num->real^N) x` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THENL[ +EXISTS_TAC`x:num` +THEN ASM_REWRITE_TAC[]; +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN ASM_SIMP_TAC[VECTOR_ARITH`-- -- A=A:real^N`] +THEN EXISTS_TAC`-- (vv:num->real^N) x` +THEN ASM_SIMP_TAC[VECTOR_ARITH`-- -- A=A:real^N`]]);; + +let LINAER_SYM_0=prove(`linear (\x:real^N. --x)`, +ASM_SIMP_TAC[VECTOR_ARITH`--(x+y)= -- x+ -- y:real^N`;linear] +THEN VECTOR_ARITH_TAC);; + + +let AFF_GE_COMMUTATIVE_SYM_0=prove(`aff_ge (IMAGE (\x. --x) e1) (IMAGE (\x. --x) e) = IMAGE (\x:real^N. --x) (aff_ge e1 e)`, +MATCH_MP_TAC AFF_GE_INJECTIVE_LINEAR_IMAGE +THEN ASM_REWRITE_TAC[VECTOR_ARITH`-- x= -- y==> x=y:real^N`;LINAER_SYM_0]);; + + + +let AFF_GE_VEC0_SYM_0=prove(`aff_ge {vec 0} (IMAGE (\x. --x) e) = IMAGE (\x:real^N. --x) (aff_ge {vec 0} e)`, +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM VEC0_SYM_0] +THEN ASM_SIMP_TAC[AFF_GE_COMMUTATIVE_SYM_0]);; + + + +let AFF_GT_COMMUTATIVE_SYM_0=prove(`aff_gt (IMAGE (\x. --x) e1) (IMAGE (\x. --x) e) = IMAGE (\x:real^N. --x) (aff_gt e1 e)`, +MATCH_MP_TAC AFF_GT_INJECTIVE_LINEAR_IMAGE +THEN ASM_REWRITE_TAC[VECTOR_ARITH`-- x= -- y==> x=y:real^N`;LINAER_SYM_0]);; + + + +let AFF_GT_VEC0_SYM_0=prove(`aff_gt {vec 0} (IMAGE (\x. --x) e) = IMAGE (\x:real^N. --x) (aff_gt {vec 0} e)`, +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM VEC0_SYM_0] +THEN ASM_SIMP_TAC[AFF_GT_COMMUTATIVE_SYM_0]);; + + + +let AFF_LE_COMMUTATIVE_SYM_0=prove(`aff_le (IMAGE (\x. --x) e1) (IMAGE (\x. --x) e) = IMAGE (\x:real^N. --x) (aff_le e1 e)`, +MATCH_MP_TAC AFF_LE_INJECTIVE_LINEAR_IMAGE +THEN ASM_REWRITE_TAC[VECTOR_ARITH`-- x= -- y==> x=y:real^N`;LINAER_SYM_0]);; + + + +let AFF_LE_VEC0_SYM_0=prove(`aff_le {vec 0} (IMAGE (\x. --x) e) = IMAGE (\x:real^N. --x) (aff_le {vec 0} e)`, +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM VEC0_SYM_0] +THEN ASM_SIMP_TAC[AFF_LE_COMMUTATIVE_SYM_0]);; + + +let AFF_LT_COMMUTATIVE_SYM_0=prove(`aff_lt (IMAGE (\x. --x) e1) (IMAGE (\x. --x) e) = IMAGE (\x:real^N. --x) (aff_lt e1 e)`, +MATCH_MP_TAC AFF_LT_INJECTIVE_LINEAR_IMAGE +THEN ASM_REWRITE_TAC[VECTOR_ARITH`-- x= -- y==> x=y:real^N`;LINAER_SYM_0]);; + + + +let AFF_LT_VEC0_SYM_0=prove(`aff_lt {vec 0} (IMAGE (\x. --x) e) = IMAGE (\x:real^N. --x) (aff_lt {vec 0} e)`, +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[GSYM VEC0_SYM_0] +THEN ASM_SIMP_TAC[AFF_LT_COMMUTATIVE_SYM_0]);; + + +let INTER_SYM_0=prove(`IMAGE (\x:real^N. --x) (e1 INTER e2) =IMAGE (\x. --x) e1 INTER IMAGE (\x. --x) e2`, +MATCH_MP_TAC IMAGE_INTER_INJ +THEN ASM_REWRITE_TAC[] +THEN VECTOR_ARITH_TAC);; + + +let FAN_SYM_0=prove_by_refinement(`FAN + (vec 0, IMAGE (vv:num->real^3) (:num), + IMAGE (\i. {vv i, vv (SUC i)}) (:num)) +==> FAN + (vec 0, IMAGE (\i. -- vv i) (:num), + IMAGE (\i. {-- vv i, -- vv (SUC i)}) (:num))`, +[REWRITE_TAC[FAN;fan1;fan2;fan6;fan7] +THEN REPEAT RESA_TAC; + +ASM_SIMP_TAC[UNIONS_IMAGE_FAN_SYM_0;IMAGE_V_SYM_0;SUBSET_SYM_0]; + +ASM_SIMP_TAC[GRAPH_SYM_0]; + +ASM_SIMP_TAC[IMAGE_V_SYM_0;FINITE_SYM_0]; + +POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[IMAGE_V_SYM_0;SUBSET_SYM_0;NOT_SUBSET_EMPTY_SYM_0]; + +POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[IMAGE_V_SYM_0;SUBSET_SYM_0;NOT_SUBSET_EMPTY_SYM_0] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL IN_SYM_0)[`vec 0:real^3`;`IMAGE (\x:real^3. --x) (IMAGE (vv:num->real^3) (:num))`][VECTOR_ARITH`-- vec 0= vec 0`;REFL_SYM_0]; + +POP_ASSUM MP_TAC +THEN MRESA_TAC(GEN_ALL IMAGE_E_SYM_0)[`e:real^3->bool`;`vv:num->real^3`] +THEN REPLICATE_TAC (10-7)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC th[`IMAGE (\x:real^3. --x) e`]) +THEN MRESAL_TAC(GEN_ALL VEC0_NOT_COLLINEAR_SYM_0)[`IMAGE (\x:real^3. --x) e`][REFL_SYM_0]; + +MRESA_TAC (GEN_ALL IMAGE_E_UNION_V_SYM_0)[`e1:real^3->bool`;`vv:num->real^3`] +THEN MRESA_TAC (GEN_ALL IMAGE_E_UNION_V_SYM_0)[`e2:real^3->bool`;`vv:num->real^3`] +THEN REPLICATE_TAC (12-8)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MRESAL_TAC th[`IMAGE (\x:real^3. --x) e1`;`IMAGE (\x:real^3. --x) e2`][]) +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[AFF_GE_VEC0_SYM_0;GSYM INTER_SYM_0] +THEN MRESAL_TAC(GEN_ALL SET_EQ_SYM_0)[`IMAGE (\x:real^3. --x) (aff_ge {vec 0} e1 INTER aff_ge {vec 0} e2)`;`IMAGE (\x:real^3. --x) (aff_ge {vec 0} (e1 INTER e2))`][REFL_SYM_0]]);; + + + + + + +let OPP_SUC_MOD=prove(`~(k=0)==>k - SUC ((k - SUC (x MOD k)) MOD k) = x MOD k` +, +RESA_TAC +THEN MRESA_TAC DIVISION[`k- SUC(x MOD k)`;`k:num`] +THEN MRESA_TAC DIVISION[`x:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`x MOD k < k ==> k- SUC(x MOD k) (k - SUC ((k - SUC (x MOD k)) MOD k) = x MOD k) +<=> k -SUC( x MOD k) = (k - SUC (x MOD k)) MOD k`) +THEN RESA_TAC);; + + + +let OPP_IMAGE_V_EQ=prove(`periodic vv k/\ ~(k=0) +==> +IMAGE (\i. vv (k - SUC (i MOD k))) (:num)= IMAGE vv (:num)`, + +REWRITE_TAC[IMAGE;IN_ELIM_THM;EXTENSION] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +RESA_TAC +THEN EXISTS_TAC`k - SUC (x' MOD k)` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; +RESA_TAC +THEN EXISTS_TAC`k- SUC(x' MOD k)` +THEN ASM_SIMP_TAC[OPP_SUC_MOD;SET_RULE`(a:num)IN (:num)`;PERIODIC_PROPERTY]]);; + + +let MOD_SUC_MOD=prove(`1 SUC (x MOD k) MOD k= SUC x MOD k`, +STRIP_TAC +THEN REWRITE_TAC[ADD1] +THEN MRESA_TAC MOD_LT[`1`;`k:num`] +THEN MP_TAC(ARITH_RULE`1 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_ADD_MOD[`x:num`;`1:num`;`k:num`]);; + +let SUC_MOD_EQ_MOD_SUC=prove(`1(k - SUC (x MOD k)) MOD k =(k - SUC x MOD k) MOD k`, +STRIP_TAC +THEN REWRITE_TAC[ADD1] +THEN MP_TAC(ARITH_RULE`1 ~(k=0)/\ k - (k - 1 + 1)=0/\ k - 1 + 1=k/\ k-k=0/\ 0 REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_LT[`1`;`k:num`] +THEN MRESA_TAC MOD_LT[`0`;`k:num`] +THEN MRESA_TAC DIVISION[`x:num`;`k:num`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`0:num`][ARITH_RULE`1*k+0=k`] +THEN MP_TAC(ARITH_RULE`x MOD k< k/\ 1 x MOD k= k-1\/ x MOD k +1< k`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`x MOD k +1`;`k:num`]);; + + + + + +let OPP_IMAGE_E_EQ=prove(`periodic (vv:num->real^3) k/\ 1 +IMAGE (\i. {vv (k - SUC (i MOD k)), vv (k - SUC (SUC i MOD k))}) (:num) +=IMAGE (\i. {vv i, vv (SUC i)}) (:num)`, +ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +RESA_TAC +THEN EXISTS_TAC`(k - SUC(SUC(x' MOD k)MOD k))` +THEN ASM_SIMP_TAC[SET_RULE`(a:num)IN(:num)`;MOD_SUC_MOD] +THEN MP_TAC(ARITH_RULE`1 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`SUC x'`;`k:num`] +THEN MP_TAC(ARITH_RULE`SUC x' MOD k< k==> SUC (k - SUC (SUC x' MOD k)) =k - SUC x' MOD k`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k - SUC (x' MOD k)`] +THEN MRESA_TAC th[`k - SUC x' MOD k`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[SUC_MOD_EQ_MOD_SUC]; +RESA_TAC +THEN MP_TAC(ARITH_RULE`1 ~(k=0)`) +THEN RESA_TAC +THEN EXISTS_TAC`(k - SUC(SUC(x' MOD k)MOD k))` +THEN ASM_SIMP_TAC[SET_RULE`(a:num)IN (:num)`] +THEN MRESA_TAC (GEN_ALL OPP_SUC_MOD)[`SUC(x' MOD k)`;`k:num`] +THEN MRESA_TAC DIVISION[`SUC(x' MOD k)`;`k:num`] +THEN MP_TAC(ARITH_RULE`SUC(x' MOD k) MOD k SUC (k - SUC (SUC (x' MOD k) MOD k))= k-(SUC(x' MOD k) MOD k)`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL MOD_SUC_MOD)[`x':num`;`k:num`] +THEN MRESA_TAC (GEN_ALL SUC_MOD_EQ_MOD_SUC)[`SUC (k - SUC(SUC (x' MOD k)MOD k))`;`k:num`] +THEN MRESA_TAC (GEN_ALL SUC_MOD_EQ_MOD_SUC)[`x':num`;`k:num`] +THEN MRESA_TAC (GEN_ALL OPP_SUC_MOD)[`x':num`;`k:num`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`x':num`] +THEN MRESA_TAC th[`SUC x'`]) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]]);; + +let OPP_IMAGE_F_EQ=prove(`periodic (vv:num->real^3) k/\ 1 +IMAGE (\i. vv (k - SUC (SUC i MOD k)),vv (k - SUC (i MOD k))) (:num) +=IMAGE (\i. vv i, vv (SUC i)) (:num)`, +ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +RESA_TAC +THEN EXISTS_TAC`(k - SUC(SUC(x' MOD k)MOD k))` +THEN ASM_SIMP_TAC[SET_RULE`(a:num)IN(:num)`;MOD_SUC_MOD] +THEN MP_TAC(ARITH_RULE`1 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`SUC x'`;`k:num`] +THEN MP_TAC(ARITH_RULE`SUC x' MOD k< k==> SUC (k - SUC (SUC x' MOD k)) =k - SUC x' MOD k`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k - SUC (x' MOD k)`] +THEN MRESA_TAC th[`k - SUC x' MOD k`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[SUC_MOD_EQ_MOD_SUC]; +RESA_TAC +THEN MP_TAC(ARITH_RULE`1 ~(k=0)`) +THEN RESA_TAC +THEN EXISTS_TAC`(k - SUC(SUC(x' MOD k)MOD k))` +THEN ASM_SIMP_TAC[SET_RULE`(a:num)IN (:num)`] +THEN MRESA_TAC (GEN_ALL OPP_SUC_MOD)[`SUC(x' MOD k)`;`k:num`] +THEN MRESA_TAC DIVISION[`SUC(x' MOD k)`;`k:num`] +THEN MP_TAC(ARITH_RULE`SUC(x' MOD k) MOD k SUC (k - SUC (SUC (x' MOD k) MOD k))= k-(SUC(x' MOD k) MOD k)`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL MOD_SUC_MOD)[`x':num`;`k:num`] +THEN MRESA_TAC (GEN_ALL SUC_MOD_EQ_MOD_SUC)[`SUC (k - SUC(SUC (x' MOD k)MOD k))`;`k:num`] +THEN MRESA_TAC (GEN_ALL SUC_MOD_EQ_MOD_SUC)[`x':num`;`k:num`] +THEN MRESA_TAC (GEN_ALL OPP_SUC_MOD)[`x':num`;`k:num`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`x':num`] +THEN MRESA_TAC th[`SUC x'`]) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]]);; + + +let OPP_IMAGE_F_EQ2=prove(`periodic (vv:num->real^3) k/\ 1 +IMAGE (\i. vv (k - SUC (i MOD k)),vv (k - SUC (SUC i MOD k))) (:num) +=IMAGE (\i. vv (SUC i),vv i ) (:num)`, +ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +RESA_TAC +THEN EXISTS_TAC`(k - SUC(SUC(x' MOD k)MOD k))` +THEN ASM_SIMP_TAC[SET_RULE`(a:num)IN(:num)`;MOD_SUC_MOD] +THEN MP_TAC(ARITH_RULE`1 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`SUC x'`;`k:num`] +THEN MP_TAC(ARITH_RULE`SUC x' MOD k< k==> SUC (k - SUC (SUC x' MOD k)) =k - SUC x' MOD k`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k - SUC (x' MOD k)`] +THEN MRESA_TAC th[`k - SUC x' MOD k`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[SUC_MOD_EQ_MOD_SUC]; +RESA_TAC +THEN MP_TAC(ARITH_RULE`1 ~(k=0)`) +THEN RESA_TAC +THEN EXISTS_TAC`(k - SUC(SUC(x' MOD k)MOD k))` +THEN ASM_SIMP_TAC[SET_RULE`(a:num)IN (:num)`] +THEN MRESA_TAC (GEN_ALL OPP_SUC_MOD)[`SUC(x' MOD k)`;`k:num`] +THEN MRESA_TAC DIVISION[`SUC(x' MOD k)`;`k:num`] +THEN MP_TAC(ARITH_RULE`SUC(x' MOD k) MOD k SUC (k - SUC (SUC (x' MOD k) MOD k))= k-(SUC(x' MOD k) MOD k)`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL MOD_SUC_MOD)[`x':num`;`k:num`] +THEN MRESA_TAC (GEN_ALL SUC_MOD_EQ_MOD_SUC)[`SUC (k - SUC(SUC (x' MOD k)MOD k))`;`k:num`] +THEN MRESA_TAC (GEN_ALL SUC_MOD_EQ_MOD_SUC)[`x':num`;`k:num`] +THEN MRESA_TAC (GEN_ALL OPP_SUC_MOD)[`x':num`;`k:num`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`x':num`] +THEN MRESA_TAC th[`SUC x'`]) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]]);; + + +let BALL_ANNULUS_SYM_0=prove(`-- v IN ball_annulus <=> v IN ball_annulus`, +ASM_SIMP_TAC[ball_annulus;IN_ELIM_THM;DIFF;cball;ball;dist;VECTOR_ARITH`vec 0- A= -- A/\ -- --A=A`;NORM_NEG]);; + + +let DIST_SYM_0=prove(`dist(-- a, -- b)= dist(a,b:real^N)`, +ASM_SIMP_TAC[dist;VECTOR_ARITH`--a - --b= --(a-b):real^N`;NORM_NEG]);; + + +let OPP_FAN_SYM_0=prove(` 3<=k /\ +periodic vv k /\ +FAN + (vec 0, IMAGE (vv:num->real^3) (:num), + IMAGE (\i. {vv i, vv (SUC i)}) (:num)) +==> FAN + (vec 0,IMAGE (\i. --vv (k - SUC (i MOD k))) (:num), + IMAGE (\i. {--vv (k - SUC (i MOD k)), --vv (k - SUC (SUC i MOD k))}) (:num))`, +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)/\ 1real^3`] +THEN MRESA_TAC(GEN_ALL OPP_IMAGE_V_EQ)[`k:num`;`vv:num->real^3`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[FAN_SYM_0]);; + + + +let ORD_PAIRS_E_VV=prove(`ord_pairs (IMAGE (\i. {vv i, vv (SUC i)}) (:num)) +=IMAGE (\i. vv i, vv (SUC i)) (:num) UNION IMAGE (\i. vv (SUC i),vv i) (:num) +`, +ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[ord_pairs;IMAGE;IN_ELIM_THM;UNION;SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ b=c)`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN SET_TAC[]);; + + +let SELF_PAIR_EMPTY_VV=prove(`self_pairs (IMAGE (\i. {(vv:num->real^N) i, vv (SUC i)}) (:num)) (IMAGE vv (:num))={}`, +REWRITE_TAC[SET_RULE`A={}<=> ~(?a. a IN A)`;self_pairs;IN_ELIM_THM;EE;IMAGE] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM (fun th-> STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[]) +THEN EXISTS_TAC`(vv:num->real^N) (SUC x)` +THEN EXISTS_TAC`x:num` +THEN ASM_REWRITE_TAC[]);; + + +let DART_OF_HYP_VV=prove(`darts_of_hyp (IMAGE (\i. {(vv:num->real^N) i, vv (SUC i)}) (:num)) (IMAGE vv (:num)) += IMAGE (\i. vv i, vv (SUC i)) (:num) UNION IMAGE (\i. vv (SUC i),vv i) (:num)`, +ASM_SIMP_TAC[darts_of_hyp;SELF_PAIR_EMPTY_VV;ORD_PAIRS_E_VV] +THEN SET_TAC[]);; + + +let PAIR_FUN_SYM_0=prove(`IMAGE (\i. -- vv1 i, -- vv2 i) (:num) += IMAGE(\(x:real^N,y:real^N). --x, --y) (IMAGE (\i. vv1 i, vv2 i) (:num))`, +REWRITE_TAC[IMAGE;IN_ELIM_THM;EXTENSION] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THENL[ +EXISTS_TAC` (vv1 :num->real^N) x', (vv2 :num->real^N) x'` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[]; +EXISTS_TAC`x'':num` +THEN ASM_REWRITE_TAC[]]);; + + +let IN_PAIR_SYM_0=prove(`a IN A==> (\(x:real^N,y:real^N). --x, --y) a IN IMAGE(\(x:real^N,y:real^N). --x, --y) A`, +ASM_SIMP_TAC[FUN_IN_IMAGE]);; + +let ID_SYM_0_PRIME=prove(`(\(x:real^N,y). --x,--y) ((\(x,y). --x,--y) (a:real^N,b:real^N)) += (a,b)` , +ASM_REWRITE_TAC[VECTOR_ARITH`-- -- a= a:real^N`]);; + + +let ID_SYM_0=prove(`(\(x:real^N,y). --x,--y) ((\(x,y). --x,--y) x) += (x:real^N#real^N)`, +MP_TAC(SET_RULE`x=(FST (x:real^N#real^N),SND (x:real^N#real^N))`) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`-- -- a= a:real^N`]);; + + +let ID_PAIR_SYM_0=prove(`IMAGE (\(x,y):real^N#real^N. --x,--y) (IMAGE (\(x,y). --x,--y) A)=A`, +REWRITE_TAC[IMAGE;IN_ELIM_THM;EXTENSION] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN ASM_SIMP_TAC[ID_SYM_0] +THEN +EXISTS_TAC`(\(x,y):real^N#real^N. --x,--y) x` +THEN ASM_SIMP_TAC[ID_SYM_0] +THEN EXISTS_TAC`x:real^N#real^N` +THEN ASM_REWRITE_TAC[]);; + + +let IN_EQ_PAIR_SYM_0=prove(` (\(x:real^N,y:real^N). --x, --y) a IN IMAGE(\(x:real^N,y:real^N). --x, --y) A<=> a IN A`, +EQ_TAC +THENL[ +STRIP_TAC +THEN MRESAL_TAC (GEN_ALL IN_PAIR_SYM_0)[`(\(x:real^N,y:real^N). --x,--y) a`;`IMAGE(\(x:real^N,y:real^N). --x, --y) A`][ID_PAIR_SYM_0;ID_SYM_0]; +ASM_SIMP_TAC[FUN_IN_IMAGE];]);; + + + +let FST_SND_PAIR_SYM_0=prove(`FST ((\(x,y):real^N#real^N. --x,--y) x)= -- FST x +/\ SND ((\(x,y):real^N#real^N. --x,--y) x)= -- SND x`, +MP_TAC(SET_RULE`x=(FST (x:real^N#real^N),SND (x:real^N#real^N))`) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[]);; + + +let EQ_SET_PAIR_SYM_0=prove(`IMAGE (\(x,y):real^N#real^N. --x,--y) A =IMAGE (\(x,y). --x,--y) B <=> A=B`, +EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[EXTENSION;IN_EQ_PAIR_SYM_0] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[` (\(x,y):real^N#real^N. --x,--y) x:real^N#real^N`][IN_EQ_PAIR_SYM_0]));; + + +let EE_SYM_0=prove_by_refinement(`EE (--a) (IMAGE (\i. {--vv i, --vv (SUC i)}) (:num)) += IMAGE(\x:real^N. --x)(EE (a) (IMAGE (\i. {vv i, vv (SUC i)}) (:num)) +)`, +[REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[EE;IMAGE;IN_ELIM_THM;SET_RULE`{a,b}={c,d}<=> (a=c/\b=d)\/ (a=d/\ b=c)`;VECTOR_ARITH`--a= --b<=> a=b:real^N`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; +EXISTS_TAC`(vv:num->real^N) (SUC x')` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[]; +EXISTS_TAC`(vv:num->real^N) (x')` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[]; +EXISTS_TAC`(x'':num)` +THEN ASM_REWRITE_TAC[]; +EXISTS_TAC`(x'':num)` +THEN ASM_REWRITE_TAC[]]);; + +let EMPTY_EQ_SYM_0=prove(` +(IMAGE (\x:real^N. --x) A = {}) +<=> (A ={})`, +EQ_TAC +THENL[ +ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] +THEN ASM_SIMP_TAC[NOT_EMPTY_SYM_0]; +ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] +THEN MRESAL_TAC (GEN_ALL NOT_EMPTY_SYM_0)[`IMAGE (\x. --x) (A:real^N->bool)`][REFL_SYM_0];]);; + + +let EE_EXPAND_BB_VV=prove_by_refinement(`scs_k_v39 s=k /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ is_scs_v39 s /\ ~(k <= 3)/\ BBs_v39 s vv +==> EE (vv i) E= {vv (SUC i),vv (i+k-1)}`, +[ +REWRITE_TAC[BBs_v39;PAIR_EQ;LET_DEF;LET_END_DEF] +THEN STRIP_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[convex_local_fan] +THEN STRIP_TAC +THEN SUBGOAL_THEN`(vv:num->real^3) i IN V` ASSUME_TAC; +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`]; +MRESA_TAC (GEN_ALL Local_lemmas1.LOFA_IMP_EE_TWO_ELMS_INS_ND)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(vv:num->real^3) i`] +THEN MP_TAC(ARITH_RULE`~(k<=3)==> 3 MRESA_TAC th[`(vv:num->real^3) i`]) +THEN MRESAL_TAC(GEN_ALL VV_SUC_EQ_RHO_NODE_PRIME)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`k:num`;`s:scs_v39`;`FF:real^3#real^3->bool`;`(vv:num->real^3) i:real^3`;`vv:num->real^3`;`i:num`] +[BBs_v39;PAIR_EQ;LET_DEF;LET_END_DEF;convex_local_fan] +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`SUC 0`][ITER;ARITH_RULE`SUC 0 +i= SUC i`] THEN MRESA_TAC th[`k-1`]) +THEN REWRITE_TAC[ARITH_RULE`k-1+i= i+k-1`]]);; + + + + + +let AZIM_CYCLE1_SYM_0=prove(` +scs_k_v39 s=k /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ is_scs_v39 s /\ ~(k <= 3)/\ BBs_v39 s vv +==> +azim_cycle (IMAGE (\x. --x) (EE (vv i) E)) (vec 0) (--vv i) (--vv (SUC i)) = + --azim_cycle (EE (vv i) E) (vec 0) (vv i) (vv (SUC i))`, +RESA_TAC +THEN MP_TAC EE_EXPAND_BB_VV +THEN RESA_TAC +THEN ASM_SIMP_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;GSYM ELEMENT2_SYM_0]);; + + + +let AZIM_CYCLE2_SYM_0=prove(` +scs_k_v39 s=k /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ is_scs_v39 s /\ ~(k <= 3)/\ BBs_v39 s vv +==> +azim_cycle (IMAGE (\x. --x) (EE (vv i) E)) (vec 0) (--vv i) (--vv (i + k-1)) = + --azim_cycle (EE (vv i) E) (vec 0) (vv i) (vv (i+k-1))`, +RESA_TAC +THEN MP_TAC EE_EXPAND_BB_VV +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_SIMP_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;GSYM ELEMENT2_SYM_0]);; + + + + +let IVS_AZIM_CYCLE_SYM_0=prove_by_refinement(`scs_k_v39 s=k /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ is_scs_v39 s /\ ~(k <= 3)/\ BBs_v39 s vv +/\ x IN darts_of_hyp E V +==> ivs_azim_cycle + (EE (--SND x) (IMAGE (\i. {--vv i, --vv (SUC i)}) (:num))) + (vec 0) + (--SND x) + (--FST x) += -- ivs_azim_cycle (EE (SND x) E) (vec 0) (SND x) (FST x)`, +[ +RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC(GEN_ALL DART_OF_HYP_VV)[`vv:num->real^3`] +THEN EXPAND_TAC"FF" +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[UNION;IN_ELIM_THM;IMAGE] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC; +MRESA_TAC (GEN_ALL EE_EXPAND_BB_VV)[`V:real^3->bool`;`FF:real^3#real^3->bool`;`s:scs_v39`;`E:(real^3->bool)->bool`;`vv:num->real^3`;`SUC x'`;`k:num`] +THEN ASM_SIMP_TAC[EE_SYM_0] +THEN SUBGOAL_THEN`vv (SUC x' + k - 1) = (vv:num->real^3) x'`ASSUME_TAC; + +MP_TAC(ARITH_RULE`~(k<=3)==> SUC x' + k - 1= x' +k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;PAIR_EQ;LET_DEF;LET_END_DEF;convex_local_fan;periodic] +THEN REPEAT RESA_TAC; + +ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_SIMP_TAC[Polar_fan.IVS_AZIM_CYCLE_TWO_POINT_SET;GSYM ELEMENT2_SYM_0]; + +MRESA_TAC (GEN_ALL EE_EXPAND_BB_VV)[`V:real^3->bool`;`FF:real^3#real^3->bool`;`s:scs_v39`;`E:(real^3->bool)->bool`;`vv:num->real^3`;`x':num`;`k:num`] +THEN ASM_SIMP_TAC[EE_SYM_0] +THEN ASM_SIMP_TAC[Polar_fan.IVS_AZIM_CYCLE_TWO_POINT_SET;GSYM ELEMENT2_SYM_0]]);; + + +let ff_FUN_COMMUTATIVE_SYM_0=prove(` +scs_k_v39 s=k /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ is_scs_v39 s /\ ~(k <= 3)/\ BBs_v39 s vv +==> (!x. ff_of_hyp + (vec 0,IMAGE (\i. --vv i) (:num),IMAGE (\i. {--vv i, --vv (SUC i)}) (:num)) + ((\(x,y). --x,--y) x) = + (\(x,y). --x,--y) (ff_of_hyp (vec 0,V,E) x)) +`, +RESA_TAC +THEN GEN_TAC +THEN ASM_SIMP_TAC[ff_of_hyp2;DART_OF_HYP_VV;PAIR_FUN_SYM_0;IN_EQ_PAIR_SYM_0;GSYM IMAGE_UNION;FST_SND_PAIR_SYM_0] +THEN MP_TAC(SET_RULE`x IN darts_of_hyp (E:(real^3->bool)->bool) V \/ ~(x IN darts_of_hyp E V)`) +THEN RESA_TAC +THENL[ +POP_ASSUM MP_TAC +THEN MRESA_TAC(GEN_ALL DART_OF_HYP_VV)[`vv:num->real^3`] +THEN RESA_TAC +THEN MP_TAC IVS_AZIM_CYCLE_SYM_0 +THEN RESA_TAC; + +POP_ASSUM MP_TAC +THEN MRESA_TAC(GEN_ALL DART_OF_HYP_VV)[`vv:num->real^3`] +THEN RESA_TAC]);; + +let FUN_COMMUTATIVE=prove(`(!x. f(g x)= g(f1 x)) +==> !n x. (f POWER n) (g x) = g((f1 POWER n) x)`, +STRIP_TAC +THEN INDUCT_TAC +THENL[ +ASM_REWRITE_TAC[POWER;I_DEF]; +ASM_REWRITE_TAC[POWER;o_DEF]]);; + + +let ff_POWER_COMMUTATIVE_SYM_0=prove(`scs_k_v39 s=k /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ is_scs_v39 s /\ ~(k <= 3)/\ BBs_v39 s vv +==> +!n x. (ff_of_hyp + (vec 0, + IMAGE (\i. --vv i) (:num), + IMAGE (\i. {--vv i, --vv (SUC i)}) (:num)) POWER + n) + ((\(x,y). --x,--y) x) += (\(x,y). --x,--y) ( (ff_of_hyp (vec 0,IMAGE vv (:num),IMAGE (\i. {vv i, vv (SUC i)}) (:num)) POWER + n) + x) +`, +RESA_TAC +THEN MATCH_MP_TAC FUN_COMMUTATIVE +THEN MATCH_MP_TAC ff_FUN_COMMUTATIVE_SYM_0 +THEN ASM_REWRITE_TAC[]);; + + + +let FACE_SYM_0=prove(`scs_k_v39 s=k /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ is_scs_v39 s /\ ~(k <= 3)/\ BBs_v39 s vv +==> +face + (hypermap + (HYP + (vec 0,IMAGE (\i. --vv i) (:num),IMAGE (\i. {--vv i, --vv (SUC i)}) (:num)))) + ((\(x,y). --x,--y) x) = + IMAGE (\(x,y). --x,--y) (face (hypermap (HYP (vec 0,V,E))) x)`, +STRIP_TAC +THEN MP_TAC ff_POWER_COMMUTATIVE_SYM_0 +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;PAIR_EQ;LET_DEF;LET_END_DEF;convex_local_fan;local_fan;] +THEN REPEAT RESA_TAC +THEN MP_TAC FAN_SYM_0 +THEN RESA_TAC +THEN REWRITE_TAC[face] +THEN MRESAL_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`IMAGE (\i. --(vv:num->real^3) i) (:num)`;`IMAGE (\i. {--(vv:num->real^3) i, --vv (SUC i)}) (:num)`][orbit_map;IN_ELIM_THM;] +THEN MRESAL_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`IMAGE (vv:num->real^3) (:num)`;`IMAGE (\i. {(vv:num->real^3) i, vv (SUC i)}) (:num)`][orbit_map;IN_ELIM_THM;] +THEN GEN_REWRITE_TAC(RAND_CONV o ONCE_DEPTH_CONV)[IMAGE] +THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THENL[ +EXISTS_TAC`(ff_of_hyp (vec 0,V,E) POWER n) x` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`n:num` +THEN ASM_REWRITE_TAC[]; +EXISTS_TAC`n:num` +THEN ASM_REWRITE_TAC[]]);; + + + + +let OPP_IMAGE_V_EQ_NEG=prove(`periodic vv k/\ ~(k=0) +==> +IMAGE (\i. -- (vv:num->real^3) (k - SUC (i MOD k))) (:num)= IMAGE (\i. -- vv i) (:num)`, + +REWRITE_TAC[IMAGE;IN_ELIM_THM;EXTENSION] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +RESA_TAC +THEN EXISTS_TAC`k - SUC (x' MOD k)` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; +RESA_TAC +THEN EXISTS_TAC`k- SUC(x' MOD k)` +THEN ASM_SIMP_TAC[OPP_SUC_MOD;SET_RULE`(a:num)IN (:num)`;PERIODIC_PROPERTY]]);; + + + +let OPP_IMAGE_E_EQ_NEG=prove(`periodic (vv:num->real^3) k/\ 1 +IMAGE (\i. {--vv (k - SUC (i MOD k)), --vv (k - SUC (SUC i MOD k))}) (:num) +=IMAGE (\i. {--vv i, --vv (SUC i)}) (:num)`, +ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +RESA_TAC +THEN EXISTS_TAC`(k - SUC(SUC(x' MOD k)MOD k))` +THEN ASM_SIMP_TAC[SET_RULE`(a:num)IN(:num)`;MOD_SUC_MOD] +THEN MP_TAC(ARITH_RULE`1 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`SUC x'`;`k:num`] +THEN MP_TAC(ARITH_RULE`SUC x' MOD k< k==> SUC (k - SUC (SUC x' MOD k)) =k - SUC x' MOD k`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k - SUC (x' MOD k)`] +THEN MRESA_TAC th[`k - SUC x' MOD k`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[SUC_MOD_EQ_MOD_SUC]; +RESA_TAC +THEN MP_TAC(ARITH_RULE`1 ~(k=0)`) +THEN RESA_TAC +THEN EXISTS_TAC`(k - SUC(SUC(x' MOD k)MOD k))` +THEN ASM_SIMP_TAC[SET_RULE`(a:num)IN (:num)`] +THEN MRESA_TAC (GEN_ALL OPP_SUC_MOD)[`SUC(x' MOD k)`;`k:num`] +THEN MRESA_TAC DIVISION[`SUC(x' MOD k)`;`k:num`] +THEN MP_TAC(ARITH_RULE`SUC(x' MOD k) MOD k SUC (k - SUC (SUC (x' MOD k) MOD k))= k-(SUC(x' MOD k) MOD k)`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL MOD_SUC_MOD)[`x':num`;`k:num`] +THEN MRESA_TAC (GEN_ALL SUC_MOD_EQ_MOD_SUC)[`SUC (k - SUC(SUC (x' MOD k)MOD k))`;`k:num`] +THEN MRESA_TAC (GEN_ALL SUC_MOD_EQ_MOD_SUC)[`x':num`;`k:num`] +THEN MRESA_TAC (GEN_ALL OPP_SUC_MOD)[`x':num`;`k:num`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`x':num`] +THEN MRESA_TAC th[`SUC x'`]) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]]);; + + +let OPP_IMAGE_F_EQ_NEG=prove(`periodic (vv:num->real^3) k/\ 1 +IMAGE (\i. --vv (k - SUC (SUC i MOD k)),--vv (k - SUC (i MOD k))) (:num) +=IMAGE (\i. --vv i, --vv (SUC i)) (:num)`, +ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +RESA_TAC +THEN EXISTS_TAC`(k - SUC(SUC(x' MOD k)MOD k))` +THEN ASM_SIMP_TAC[SET_RULE`(a:num)IN(:num)`;MOD_SUC_MOD] +THEN MP_TAC(ARITH_RULE`1 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`SUC x'`;`k:num`] +THEN MP_TAC(ARITH_RULE`SUC x' MOD k< k==> SUC (k - SUC (SUC x' MOD k)) =k - SUC x' MOD k`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k - SUC (x' MOD k)`] +THEN MRESA_TAC th[`k - SUC x' MOD k`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[SUC_MOD_EQ_MOD_SUC]; +RESA_TAC +THEN MP_TAC(ARITH_RULE`1 ~(k=0)`) +THEN RESA_TAC +THEN EXISTS_TAC`(k - SUC(SUC(x' MOD k)MOD k))` +THEN ASM_SIMP_TAC[SET_RULE`(a:num)IN (:num)`] +THEN MRESA_TAC (GEN_ALL OPP_SUC_MOD)[`SUC(x' MOD k)`;`k:num`] +THEN MRESA_TAC DIVISION[`SUC(x' MOD k)`;`k:num`] +THEN MP_TAC(ARITH_RULE`SUC(x' MOD k) MOD k SUC (k - SUC (SUC (x' MOD k) MOD k))= k-(SUC(x' MOD k) MOD k)`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL MOD_SUC_MOD)[`x':num`;`k:num`] +THEN MRESA_TAC (GEN_ALL SUC_MOD_EQ_MOD_SUC)[`SUC (k - SUC(SUC (x' MOD k)MOD k))`;`k:num`] +THEN MRESA_TAC (GEN_ALL SUC_MOD_EQ_MOD_SUC)[`x':num`;`k:num`] +THEN MRESA_TAC (GEN_ALL OPP_SUC_MOD)[`x':num`;`k:num`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`x':num`] +THEN MRESA_TAC th[`SUC x'`]) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]]);; + + + +let OPP_IMAGE_F_EQ2_NEG=prove(`periodic (vv:num->real^3) k/\ 1 +IMAGE (\i. --vv (k - SUC (i MOD k)),--vv (k - SUC (SUC i MOD k))) (:num) +=IMAGE (\i. --vv (SUC i),--vv i ) (:num)`, +ONCE_REWRITE_TAC[EXTENSION] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;] +THEN REPEAT STRIP_TAC +THEN EQ_TAC +THENL[ +RESA_TAC +THEN EXISTS_TAC`(k - SUC(SUC(x' MOD k)MOD k))` +THEN ASM_SIMP_TAC[SET_RULE`(a:num)IN(:num)`;MOD_SUC_MOD] +THEN MP_TAC(ARITH_RULE`1 ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`SUC x'`;`k:num`] +THEN MP_TAC(ARITH_RULE`SUC x' MOD k< k==> SUC (k - SUC (SUC x' MOD k)) =k - SUC x' MOD k`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k - SUC (x' MOD k)`] +THEN MRESA_TAC th[`k - SUC x' MOD k`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[SUC_MOD_EQ_MOD_SUC]; +RESA_TAC +THEN MP_TAC(ARITH_RULE`1 ~(k=0)`) +THEN RESA_TAC +THEN EXISTS_TAC`(k - SUC(SUC(x' MOD k)MOD k))` +THEN ASM_SIMP_TAC[SET_RULE`(a:num)IN (:num)`] +THEN MRESA_TAC (GEN_ALL OPP_SUC_MOD)[`SUC(x' MOD k)`;`k:num`] +THEN MRESA_TAC DIVISION[`SUC(x' MOD k)`;`k:num`] +THEN MP_TAC(ARITH_RULE`SUC(x' MOD k) MOD k SUC (k - SUC (SUC (x' MOD k) MOD k))= k-(SUC(x' MOD k) MOD k)`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL MOD_SUC_MOD)[`x':num`;`k:num`] +THEN MRESA_TAC (GEN_ALL SUC_MOD_EQ_MOD_SUC)[`SUC (k - SUC(SUC (x' MOD k)MOD k))`;`k:num`] +THEN MRESA_TAC (GEN_ALL SUC_MOD_EQ_MOD_SUC)[`x':num`;`k:num`] +THEN MRESA_TAC (GEN_ALL OPP_SUC_MOD)[`x':num`;`k:num`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`x':num`] +THEN MRESA_TAC th[`SUC x'`]) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[]]);; + + + + +let CARD_PAIR_SYM_0=prove(`FINITE s ==> CARD (IMAGE (\(x,y):real^N#real^N. --x,--y) s) =CARD s`, +STRIP_TAC +THEN MATCH_MP_TAC CARD_IMAGE_INJ +THEN RESA_TAC +THEN RESA_TAC +THEN ASM_SIMP_TAC[VECTOR_ARITH`(--a= --b)<=> (a=b:real^N)`;PAIR_EQ] +THEN MP_TAC(SET_RULE`x=(FST (x:real^N#real^N),SND (x:real^N#real^N))`) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN MP_TAC(SET_RULE`y=(FST (y:real^N#real^N),SND (y:real^N#real^N))`) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_SIMP_TAC[VECTOR_ARITH`(--a= --b)<=> (a=b:real^N)`;PAIR_EQ] +THEN ASM_REWRITE_TAC[GSYM PAIR_EQ] +THEN RESA_TAC);; + + + + +let FACE_ALL_SYM_0=prove(`scs_k_v39 s=k /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ is_scs_v39 s /\ ~(k <= 3)/\ BBs_v39 s vv +==> +(!x. face + (hypermap + (HYP + (vec 0,IMAGE (\i. --vv i) (:num),IMAGE (\i. {--vv i, --vv (SUC i)}) (:num)))) + ((\(x,y). --x,--y) x) = + IMAGE (\(x,y). --x,--y) (face (hypermap (HYP (vec 0,V,E))) x))`, +REPEAT STRIP_TAC +THEN MP_TAC ff_POWER_COMMUTATIVE_SYM_0 +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;PAIR_EQ;LET_DEF;LET_END_DEF;convex_local_fan;local_fan;] +THEN REPEAT RESA_TAC +THEN MP_TAC FAN_SYM_0 +THEN RESA_TAC +THEN REWRITE_TAC[face] +THEN MRESAL_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`IMAGE (\i. --(vv:num->real^3) i) (:num)`;`IMAGE (\i. {--(vv:num->real^3) i, --vv (SUC i)}) (:num)`][orbit_map;IN_ELIM_THM;] +THEN MRESAL_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`IMAGE (vv:num->real^3) (:num)`;`IMAGE (\i. {(vv:num->real^3) i, vv (SUC i)}) (:num)`][orbit_map;IN_ELIM_THM;] +THEN GEN_REWRITE_TAC(RAND_CONV o ONCE_DEPTH_CONV)[IMAGE] +THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THENL[ +EXISTS_TAC`(ff_of_hyp (vec 0,V,E) POWER n) x` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`n:num` +THEN ASM_REWRITE_TAC[]; +EXISTS_TAC`n:num` +THEN ASM_REWRITE_TAC[]]);; + + + + +let AZIM_CYCLE_SYM_0=prove_by_refinement(`scs_k_v39 s=k /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ is_scs_v39 s /\ ~(k <= 3)/\ BBs_v39 s vv +/\ x IN darts_of_hyp E V +==> azim_cycle + (EE (--SND x) (IMAGE (\i. {--vv i, --vv (SUC i)}) (:num))) + (vec 0) + (--SND x) + (--FST x) += -- azim_cycle (EE (SND x) E) (vec 0) (SND x) (FST x)`, +[RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC(GEN_ALL DART_OF_HYP_VV)[`vv:num->real^3`] +THEN EXPAND_TAC"FF" +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[UNION;IN_ELIM_THM;IMAGE] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL EE_EXPAND_BB_VV)[`V:real^3->bool`;`FF:real^3#real^3->bool`;`s:scs_v39`;`E:(real^3->bool)->bool`;`vv:num->real^3`;`SUC x'`;`k:num`] +THEN ASM_SIMP_TAC[EE_SYM_0] +THEN SUBGOAL_THEN`vv (SUC x' + k - 1) = (vv:num->real^3) x'`ASSUME_TAC; + +MP_TAC(ARITH_RULE`~(k<=3)==> SUC x' + k - 1= x' +k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;PAIR_EQ;LET_DEF;LET_END_DEF;convex_local_fan;periodic] +THEN REPEAT RESA_TAC; + +ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_SIMP_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;GSYM ELEMENT2_SYM_0]; + +MRESA_TAC (GEN_ALL EE_EXPAND_BB_VV)[`V:real^3->bool`;`FF:real^3#real^3->bool`;`s:scs_v39`;`E:(real^3->bool)->bool`;`vv:num->real^3`;`x':num`;`k:num`] +THEN ASM_SIMP_TAC[EE_SYM_0] +THEN ASM_SIMP_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;GSYM ELEMENT2_SYM_0] +]);; + + + + + +let FST_SND_EQ_PAIR_SYM_0=prove(`(\(x,y):real^N#real^N. --x,--y)x= --FST x,--SND x`, + MP_TAC(SET_RULE`x=(FST (x:real^N#real^N),SND (x:real^N#real^N))`) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[]);; + + + +let SYM_AZIM_CYCLE_SYM_0=prove_by_refinement(`scs_k_v39 s=k /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ is_scs_v39 s /\ ~(k <= 3)/\ BBs_v39 s vv +/\ x IN darts_of_hyp E V +==> azim_cycle + (EE (--FST x) (IMAGE (\i. {--vv i, --vv (SUC i)}) (:num))) + (vec 0) + (--FST x) + (--SND x) += -- azim_cycle (EE (FST x) E) (vec 0) (FST x) (SND x)`, +[RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC(GEN_ALL DART_OF_HYP_VV)[`vv:num->real^3`] +THEN EXPAND_TAC"FF" +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[UNION;IN_ELIM_THM;IMAGE] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC; + +MRESA_TAC (GEN_ALL EE_EXPAND_BB_VV)[`V:real^3->bool`;`FF:real^3#real^3->bool`;`s:scs_v39`;`E:(real^3->bool)->bool`;`vv:num->real^3`;`x':num`;`k:num`] +THEN ASM_SIMP_TAC[EE_SYM_0] +THEN ASM_SIMP_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;GSYM ELEMENT2_SYM_0]; +MRESA_TAC (GEN_ALL EE_EXPAND_BB_VV)[`V:real^3->bool`;`FF:real^3#real^3->bool`;`s:scs_v39`;`E:(real^3->bool)->bool`;`vv:num->real^3`;`SUC x'`;`k:num`] +THEN ASM_SIMP_TAC[EE_SYM_0] +THEN SUBGOAL_THEN`vv (SUC x' + k - 1) = (vv:num->real^3) x'`ASSUME_TAC; + + +MP_TAC(ARITH_RULE`~(k<=3)==> SUC x' + k - 1= x' +k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;PAIR_EQ;LET_DEF;LET_END_DEF;convex_local_fan;periodic] +THEN REPEAT RESA_TAC; + +ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_SIMP_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;GSYM ELEMENT2_SYM_0]; +]);; + + +let NODE_MAP_SYM_0=prove(`scs_k_v39 s=k /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ is_scs_v39 s /\ ~(k <= 3)/\ BBs_v39 s vv +==> +(!x. (node_map + (hypermap + (HYP + (vec 0,IMAGE (\i. --vv i) (:num),IMAGE (\i. {--vv i, --vv (SUC i)}) (:num))))) +((\(x,y). --x,--y) x) += (\(x,y). --x,--y) (node_map (hypermap (HYP (vec 0,V,E))) x))`, +STRIP_TAC +THEN GEN_TAC +THEN POP_ASSUM(fun th-> +MP_TAC th +THEN ASSUME_TAC th +THEN REWRITE_TAC[BBs_v39;PAIR_EQ;LET_DEF;LET_END_DEF;convex_local_fan;local_fan;] +THEN REPEAT RESA_TAC +) +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC FAN_SYM_0 +THEN RESA_TAC +THEN ASM_SIMP_TAC[Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP;FUN_EQ_THM] +THEN MP_TAC(SET_RULE`x=(FST (x:real^3#real^3),SND (x:real^3#real^3))`) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_SIMP_TAC[nn_of_hyp;] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN ASM_SIMP_TAC[ff_of_hyp2;DART_OF_HYP_VV;PAIR_FUN_SYM_0;IN_EQ_PAIR_SYM_0;GSYM IMAGE_UNION;FST_SND_PAIR_SYM_0;Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP] +THEN MRESA_TAC(GEN_ALL DART_OF_HYP_VV)[`vv:num->real^3`] +THEN ASM_SIMP_TAC[GSYM FST_SND_EQ_PAIR_SYM_0;IN_EQ_PAIR_SYM_0] +THEN MP_TAC(SET_RULE`x IN FF UNION IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num) +\/ ~(x IN FF UNION IMAGE (\i. vv (SUC i),vv i) (:num))`) +THEN RESA_TAC +THEN MP_TAC SYM_AZIM_CYCLE_SYM_0 +THEN RESA_TAC);; + + + +let IMAGE_NODE_SYM_0=prove(`scs_k_v39 s=k /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ is_scs_v39 s /\ ~(k <= 3)/\ BBs_v39 s vv +==> +(!A. IMAGE (node_map + (hypermap + (HYP + (vec 0,IMAGE (\i. --vv i) (:num),IMAGE (\i. {--vv i, --vv (SUC i)}) (:num))))) +(IMAGE (\(x,y). --x,--y) A) += IMAGE (\(x,y). --x,--y) (IMAGE (node_map (hypermap (HYP (vec 0,V,E)))) A))`, +RESA_TAC +THEN GEN_TAC +THEN ONCE_REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THENL[ +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[IMAGE;IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MP_TAC NODE_MAP_SYM_0 +THEN RESA_TAC +THEN EXISTS_TAC`node_map (hypermap (HYP (vec 0,V,E))) x''` +THEN ASM_REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`x'':real^3#real^3` +THEN ASM_REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[IMAGE;IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MP_TAC NODE_MAP_SYM_0 +THEN RESA_TAC +THEN EXISTS_TAC`(\(x,y):real^3#real^3. --x,--y) x''` +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[IN_ELIM_THM;IMAGE] +THEN EXISTS_TAC`x'':real^3#real^3` +THEN ASM_REWRITE_TAC[]]);; + + + +let COMMUTATIVE_POINT_PAIR_0=prove(`(\(x,y):real^N#real^N. --x,--y) a= b <=> a= (\(x,y). --x,--y) b `, +EQ_TAC +THENL[ +STRIP_TAC +THEN MRESA_TAC(GEN_ALL ID_SYM_0)[`a:real^N#real^N`]; +STRIP_TAC +THEN MRESA_TAC(GEN_ALL ID_SYM_0)[`b:real^N#real^N`]]);; + + +let EDGE_MAP_SYM_0=prove(`scs_k_v39 s=k /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ is_scs_v39 s /\ ~(k <= 3)/\ BBs_v39 s vv +==> +(!x. (edge_map + (hypermap + (HYP + (vec 0,IMAGE (\i. --vv i) (:num),IMAGE (\i. {--vv i, --vv (SUC i)}) (:num))))) +((\(x,y). --x,--y) x) += (\(x,y). --x,--y) (edge_map (hypermap (HYP (vec 0,V,E))) x))`, +STRIP_TAC +THEN GEN_TAC +THEN POP_ASSUM(fun th-> +MP_TAC th +THEN ASSUME_TAC th +THEN REWRITE_TAC[BBs_v39;PAIR_EQ;LET_DEF;LET_END_DEF;convex_local_fan;local_fan;] +THEN REPEAT RESA_TAC +) +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC FAN_SYM_0 +THEN RESA_TAC +THEN ASM_SIMP_TAC[Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP;FUN_EQ_THM] +THEN MP_TAC(SET_RULE`x=(FST (x:real^3#real^3),SND (x:real^3#real^3))`) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_SIMP_TAC[ee_of_hyp;] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN ASM_SIMP_TAC[ff_of_hyp2;DART_OF_HYP_VV;PAIR_FUN_SYM_0;IN_EQ_PAIR_SYM_0;GSYM IMAGE_UNION;FST_SND_PAIR_SYM_0;Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP] +THEN MRESA_TAC(GEN_ALL DART_OF_HYP_VV)[`vv:num->real^3`] +THEN ASM_SIMP_TAC[GSYM FST_SND_EQ_PAIR_SYM_0;IN_EQ_PAIR_SYM_0] +THEN MP_TAC(SET_RULE`x IN FF UNION IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num) +\/ ~(x IN FF UNION IMAGE (\i. vv (SUC i),vv i) (:num))`) +THEN RESA_TAC);; + + + +let EDGE_POWER_MAP_SYM_0=prove(`scs_k_v39 s=k /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ is_scs_v39 s /\ ~(k <= 3)/\ BBs_v39 s vv +==> +(!n x. (edge_map + (hypermap + (HYP + (vec 0,IMAGE (\i. --vv i) (:num),IMAGE (\i. {--vv i, --vv (SUC i)}) (:num)))) POWER n) +((\(x,y). --x,--y) x) += (\(x,y). --x,--y) ((edge_map (hypermap (HYP (vec 0,V,E))) POWER n) x))`, +RESA_TAC +THEN MATCH_MP_TAC FUN_COMMUTATIVE +THEN MATCH_MP_TAC EDGE_MAP_SYM_0 +THEN ASM_REWRITE_TAC[]);; + + +let NODE_POWER_MAP_SYM_0=prove(`scs_k_v39 s=k /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ is_scs_v39 s /\ ~(k <= 3)/\ BBs_v39 s vv +==> +(!n x. (node_map + (hypermap + (HYP + (vec 0,IMAGE (\i. --vv i) (:num),IMAGE (\i. {--vv i, --vv (SUC i)}) (:num)))) POWER n) +((\(x,y). --x,--y) x) += (\(x,y). --x,--y) ((node_map (hypermap (HYP (vec 0,V,E))) POWER n) x))`, +RESA_TAC +THEN MATCH_MP_TAC FUN_COMMUTATIVE +THEN MATCH_MP_TAC NODE_MAP_SYM_0 +THEN ASM_REWRITE_TAC[]);; + + + + + +let LOCAL_FAN_SYM_0=prove_by_refinement(`scs_k_v39 s=k /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ is_scs_v39 s /\ ~(k <= 3)/\ BBs_v39 s vv +==> local_fan + (IMAGE (\i. --vv (k - SUC (i MOD k))) (:num), + IMAGE (\i. {--vv (k - SUC (i MOD k)), --vv (k - SUC (SUC i MOD k))}) (:num), + IMAGE (\i. --vv (k - SUC (SUC i MOD k)),--vv (k - SUC (i MOD k))) (:num))`, +[ + + +STRIP_TAC +THEN POP_ASSUM(fun th-> +MP_TAC th +THEN MP_TAC(ARITH_RULE`~(k<=3)==> 3<=k/\ 1 +REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (15-12)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC (SYM th)) +THEN MRESAL_TAC (GEN_ALL Lvducxu.FAN_DART_DARTS)[`vec 0:real^3`;`IMAGE (\i. {(vv:num->real^3) i, vv (SUC i)}) (:num)`;`IMAGE (vv:num->real^3) (:num)`][DART_OF_HYP_VV] +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN MP_TAC OPP_FAN_SYM_0 +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL Lvducxu.FAN_DART_DARTS)[`vec 0:real^3`;`IMAGE (\i. {--(vv:num->real^3) (k - SUC (i MOD k)), --vv (k - SUC (SUC i MOD k))}) (:num)`;`IMAGE (\i. --(vv:num->real^3) (k - SUC (i MOD k))) (:num)`][DART_OF_HYP_VV] +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN ASM_SIMP_TAC[IN_ELIM_THM;PAIR_FUN_SYM_0;OPP_IMAGE_F_EQ;OPP_IMAGE_F_EQ2] +THEN GEN_REWRITE_TAC(RAND_CONV o LAND_CONV o DEPTH_CONV)[UNION;IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`(\(x:real^3,y:real^3). --x,--y) x` +THEN ASM_SIMP_TAC[UNION;IN_ELIM_THM;IN_PAIR_SYM_0;] +THEN MP_TAC FACE_SYM_0 +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`~(k<=3)==> ~(k=0)`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[OPP_IMAGE_E_EQ_NEG;OPP_IMAGE_V_EQ_NEG] +; + + + + +REPLICATE_TAC (16-12)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (15-12)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC (SYM th)) +THEN MRESAL_TAC (GEN_ALL Lvducxu.FAN_DART_DARTS)[`vec 0:real^3`;`IMAGE (\i. {(vv:num->real^3) i, vv (SUC i)}) (:num)`;`IMAGE (vv:num->real^3) (:num)`][DART_OF_HYP_VV] +THEN MP_TAC OPP_FAN_SYM_0 +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL Lvducxu.FAN_DART_DARTS)[`vec 0:real^3`;`IMAGE (\i. {--(vv:num->real^3) (k - SUC (i MOD k)), --vv (k - SUC (SUC i MOD k))}) (:num)`;`IMAGE (\i. --(vv:num->real^3) (k - SUC (i MOD k))) (:num)`][DART_OF_HYP_VV] +THEN ASM_SIMP_TAC[IN_ELIM_THM;PAIR_FUN_SYM_0;OPP_IMAGE_F_EQ;OPP_IMAGE_F_EQ2] +THEN GEN_REWRITE_TAC(RAND_CONV o LAND_CONV o DEPTH_CONV)[UNION;IN_ELIM_THM] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`~(k<=3)==> ~(k=0)`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[dih2k] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[OPP_IMAGE_E_EQ_NEG;OPP_IMAGE_V_EQ_NEG;OPP_IMAGE_F_EQ_NEG;OPP_IMAGE_F_EQ2_NEG;dih2k;PAIR_FUN_SYM_0;GSYM IMAGE_UNION;OPP_IMAGE_E_EQ;OPP_IMAGE_V_EQ;OPP_IMAGE_F_EQ;OPP_IMAGE_F_EQ2;] +THEN REPEAT STRIP_TAC; + + + + +MRESA_TAC Hypermap.node_map_and_darts[`hypermap + (HYP + (vec 0, + IMAGE (\i. --vv (k - SUC (i MOD k))) (:num), + IMAGE (\i. {--(vv:num->real^3) (k - SUC (i MOD k)), --vv (k - SUC (SUC i MOD k))}) + (:num)))`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[OPP_IMAGE_E_EQ_NEG;OPP_IMAGE_V_EQ_NEG;OPP_IMAGE_F_EQ_NEG;OPP_IMAGE_F_EQ2_NEG;dih2k;PAIR_FUN_SYM_0;GSYM IMAGE_UNION;OPP_IMAGE_E_EQ;OPP_IMAGE_V_EQ;OPP_IMAGE_F_EQ;OPP_IMAGE_F_EQ2;] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL FINITE_IMAGE)[`(\(x,y):real^3#real^3. --x,--y)`;`IMAGE (\(x,y):real^3#real^3. --x,--y)(IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num) UNION FF)`][ID_PAIR_SYM_0] +THEN MP_TAC(SET_RULE`FF SUBSET IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num) UNION FF`) +THEN RESA_TAC +THEN MRESA_TAC(FINITE_SUBSET)[`FF:real^3#real^3->bool`;`IMAGE (\i. vv (SUC i),(vv:num->real^3) i) (:num) UNION FF`] +THEN ASM_SIMP_TAC[CARD_PAIR_SYM_0] +THEN ONCE_REWRITE_TAC[SET_RULE`A UNION B=B UNION A`] +THEN REPLICATE_TAC (28-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[SYM th]); + + + + +ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;] +THEN REPEAT RESA_TAC +THEN MP_TAC FACE_ALL_SYM_0 +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`(\(x,y):real^3#real^3. --x,--y) x'`][ID_SYM_0]) +THEN MP_TAC IMAGE_NODE_SYM_0 +THEN RESA_TAC +THEN ASM_SIMP_TAC[GSYM IMAGE_UNION] +THEN MRESA_TAC (GEN_ALL IN_EQ_PAIR_SYM_0)[`x':real^3#real^3`;`IMAGE (\i. --vv (k - SUC (i MOD k)),--vv (k - SUC (SUC i MOD k))) + (:num) UNION + IMAGE (\i. --vv (k - SUC (SUC i MOD k)),--(vv:num->real^3) (k - SUC (i MOD k))) + (:num)`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[OPP_IMAGE_E_EQ_NEG;OPP_IMAGE_V_EQ_NEG;OPP_IMAGE_F_EQ_NEG;OPP_IMAGE_F_EQ2_NEG;dih2k;PAIR_FUN_SYM_0;GSYM IMAGE_UNION;OPP_IMAGE_E_EQ;OPP_IMAGE_V_EQ;OPP_IMAGE_F_EQ;OPP_IMAGE_F_EQ2;ID_PAIR_SYM_0] +THEN ONCE_REWRITE_TAC[SET_RULE`A UNION B= B UNION A`] +THEN STRIP_TAC +THEN REPLICATE_TAC (28-13)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT STRIP_TAC +THEN MRESA_TAC th[`((\(x,y):real^3#real^3. --x,--y) x')`] +) +THEN SET_TAC[] +; + + + +REWRITE_TAC[Wrgcvdr_cizmrrh.has_orders;FUN_EQ_THM;I_DEF] +THEN MP_TAC ff_POWER_COMMUTATIVE_SYM_0 +THEN REWRITE_TAC[Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN RESA_TAC +THEN SUBGOAL_THEN `!n x. + ITER n + (ff_of_hyp + (vec 0, + IMAGE (\i. --vv i) (:num), + IMAGE (\i. {--vv i, --vv (SUC i)}) (:num))) + (x) = + (\(x,y). --x,--y) (ITER n (ff_of_hyp (vec 0,V,E)) ((\(x,y). --x,--y) x))` +ASSUME_TAC; + + + +REPEAT GEN_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`n:num`;`(\(x,y). --x,--y) x':real^3#real^3`][ID_SYM_0]) +; + + +MP_TAC FAN_SYM_0 +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`IMAGE (\i. --(vv:num->real^3) i) (:num)`;`IMAGE (\i. {--(vv:num->real^3) i, --vv (SUC i)}) (:num)`][orbit_map;IN_ELIM_THM;] +THEN MRESAL_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`IMAGE (vv:num->real^3) (:num)`;`IMAGE (\i. {(vv:num->real^3) i, vv (SUC i)}) (:num)`][] +THEN MRESA_TAC Hypermap.node_map_and_darts[`hypermap + (HYP + (vec 0, + IMAGE (\i. --vv (k - SUC (i MOD k))) (:num), + IMAGE (\i. {--(vv:num->real^3) (k - SUC (i MOD k)), --vv (k - SUC (SUC i MOD k))}) + (:num)))`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[OPP_IMAGE_E_EQ_NEG;OPP_IMAGE_V_EQ_NEG;OPP_IMAGE_F_EQ_NEG;OPP_IMAGE_F_EQ2_NEG;dih2k;PAIR_FUN_SYM_0;GSYM IMAGE_UNION;OPP_IMAGE_E_EQ;OPP_IMAGE_V_EQ;OPP_IMAGE_F_EQ;OPP_IMAGE_F_EQ2;] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL FINITE_IMAGE)[`(\(x,y):real^3#real^3. --x,--y)`;`IMAGE (\(x,y):real^3#real^3. --x,--y)(IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num) UNION FF)`][ID_PAIR_SYM_0] +THEN MP_TAC(SET_RULE`FF SUBSET IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num) UNION FF`) +THEN RESA_TAC +THEN MRESA_TAC(FINITE_SUBSET)[`FF:real^3#real^3->bool`;`IMAGE (\i. vv (SUC i),(vv:num->real^3) i) (:num) UNION FF`] +THEN ASM_SIMP_TAC[CARD_PAIR_SYM_0;COMMUTATIVE_POINT_PAIR_0] +THEN REPLICATE_TAC (39-14)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REWRITE_TAC[Wrgcvdr_cizmrrh.has_orders;FUN_EQ_THM;I_DEF] +THEN REPEAT RESA_TAC; + + + + +REPLICATE_TAC (43-39)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT DISCH_TAC +THEN MP_TAC(ISPEC `i:num` th)) +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`(\(x,y). --x,--y) x':real^3#real^3`][ID_SYM_0]); + + + +REWRITE_TAC[Wrgcvdr_cizmrrh.has_orders;FUN_EQ_THM;I_DEF] +THEN MP_TAC EDGE_POWER_MAP_SYM_0 +THEN REWRITE_TAC[Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN RESA_TAC +THEN SUBGOAL_THEN `!n x. ITER n + (edge_map + (hypermap + (HYP + (vec 0, + IMAGE (\i. --vv i) (:num), + IMAGE (\i. {--vv i, --vv (SUC i)}) (:num))))) + (x) = + (\(x,y). --x,--y) + (ITER n (edge_map (hypermap (HYP (vec 0,V,E)))) ((\(x,y). --x,--y) x))` +ASSUME_TAC; + + + +REPEAT GEN_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`n:num`;`(\(x,y). --x,--y) x':real^3#real^3`][ID_SYM_0]) +; + + +ASM_SIMP_TAC[CARD_PAIR_SYM_0;COMMUTATIVE_POINT_PAIR_0] +THEN REPLICATE_TAC (26-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REWRITE_TAC[Wrgcvdr_cizmrrh.has_orders;FUN_EQ_THM;I_DEF] +THEN REPEAT RESA_TAC; + + + +REPLICATE_TAC (30-26)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT DISCH_TAC +THEN MP_TAC(ISPEC `i:num` th)) +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`(\(x,y). --x,--y) x':real^3#real^3`][ID_SYM_0]); + + + + + + +REWRITE_TAC[Wrgcvdr_cizmrrh.has_orders;FUN_EQ_THM;I_DEF] +THEN MP_TAC NODE_POWER_MAP_SYM_0 +THEN REWRITE_TAC[Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN RESA_TAC +THEN SUBGOAL_THEN `!n x. ITER n + (node_map + (hypermap + (HYP + (vec 0, + IMAGE (\i. --vv i) (:num), + IMAGE (\i. {--vv i, --vv (SUC i)}) (:num))))) + (x) = + (\(x,y). --x,--y) + (ITER n (node_map (hypermap (HYP (vec 0,V,E)))) ((\(x,y). --x,--y) x))` +ASSUME_TAC; + + + +REPEAT GEN_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`n:num`;`(\(x,y). --x,--y) x':real^3#real^3`][ID_SYM_0]) +; + + +ASM_SIMP_TAC[CARD_PAIR_SYM_0;COMMUTATIVE_POINT_PAIR_0] +THEN REPLICATE_TAC (26-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REWRITE_TAC[Wrgcvdr_cizmrrh.has_orders;FUN_EQ_THM;I_DEF] +THEN REPEAT RESA_TAC; + + + +REPLICATE_TAC (30-26)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT DISCH_TAC +THEN MP_TAC(ISPEC `i:num` th)) +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`(\(x,y). --x,--y) x':real^3#real^3`][ID_SYM_0]); + + + + + +(*******) +MRESA_TAC Hypermap.node_map_and_darts[`hypermap + (HYP + (vec 0, + IMAGE (\i. --vv (k - SUC (i MOD k))) (:num), + IMAGE (\i. {--(vv:num->real^3) (k - SUC (i MOD k)), --vv (k - SUC (SUC i MOD k))}) + (:num)))`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[OPP_IMAGE_E_EQ_NEG;OPP_IMAGE_V_EQ_NEG;OPP_IMAGE_F_EQ_NEG;OPP_IMAGE_F_EQ2_NEG;dih2k;PAIR_FUN_SYM_0;GSYM IMAGE_UNION;OPP_IMAGE_E_EQ;OPP_IMAGE_V_EQ;OPP_IMAGE_F_EQ;OPP_IMAGE_F_EQ2;] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL FINITE_IMAGE)[`(\(x,y):real^3#real^3. --x,--y)`;`IMAGE (\(x,y):real^3#real^3. --x,--y)(IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num) UNION FF)`][ID_PAIR_SYM_0] +THEN MP_TAC(SET_RULE`FF SUBSET IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num) UNION FF`) +THEN RESA_TAC +THEN MRESA_TAC(FINITE_SUBSET)[`FF:real^3#real^3->bool`;`IMAGE (\i. vv (SUC i),(vv:num->real^3) i) (:num) UNION FF`] +THEN ASM_SIMP_TAC[CARD_PAIR_SYM_0] +THEN ONCE_REWRITE_TAC[SET_RULE`A UNION B=B UNION A`] +THEN REPLICATE_TAC (28-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[SYM th]); + + + + +ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;] +THEN REPEAT RESA_TAC +THEN MP_TAC FACE_ALL_SYM_0 +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`(\(x,y):real^3#real^3. --x,--y) x'`][ID_SYM_0]) +THEN MP_TAC IMAGE_NODE_SYM_0 +THEN RESA_TAC +THEN ASM_SIMP_TAC[GSYM IMAGE_UNION] +THEN MRESA_TAC (GEN_ALL IN_EQ_PAIR_SYM_0)[`x':real^3#real^3`;`IMAGE (\i. --vv (k - SUC (i MOD k)),--vv (k - SUC (SUC i MOD k))) + (:num) UNION + IMAGE (\i. --vv (k - SUC (SUC i MOD k)),--(vv:num->real^3) (k - SUC (i MOD k))) + (:num)`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[OPP_IMAGE_E_EQ_NEG;OPP_IMAGE_V_EQ_NEG;OPP_IMAGE_F_EQ_NEG;OPP_IMAGE_F_EQ2_NEG;dih2k;PAIR_FUN_SYM_0;GSYM IMAGE_UNION;OPP_IMAGE_E_EQ;OPP_IMAGE_V_EQ;OPP_IMAGE_F_EQ;OPP_IMAGE_F_EQ2;ID_PAIR_SYM_0] +THEN ONCE_REWRITE_TAC[SET_RULE`A UNION B= B UNION A`] +THEN STRIP_TAC +THEN REPLICATE_TAC (28-13)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT STRIP_TAC +THEN MRESA_TAC th[`((\(x,y):real^3#real^3. --x,--y) x')`] +) +THEN SET_TAC[] +; + + + +REWRITE_TAC[Wrgcvdr_cizmrrh.has_orders;FUN_EQ_THM;I_DEF] +THEN MP_TAC ff_POWER_COMMUTATIVE_SYM_0 +THEN REWRITE_TAC[Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN RESA_TAC +THEN SUBGOAL_THEN `!n x. + ITER n + (ff_of_hyp + (vec 0, + IMAGE (\i. --vv i) (:num), + IMAGE (\i. {--vv i, --vv (SUC i)}) (:num))) + (x) = + (\(x,y). --x,--y) (ITER n (ff_of_hyp (vec 0,V,E)) ((\(x,y). --x,--y) x))` +ASSUME_TAC; + + + +REPEAT GEN_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`n:num`;`(\(x,y). --x,--y) x':real^3#real^3`][ID_SYM_0]) +; + + +MP_TAC FAN_SYM_0 +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`IMAGE (\i. --(vv:num->real^3) i) (:num)`;`IMAGE (\i. {--(vv:num->real^3) i, --vv (SUC i)}) (:num)`][orbit_map;IN_ELIM_THM;] +THEN MRESAL_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`IMAGE (vv:num->real^3) (:num)`;`IMAGE (\i. {(vv:num->real^3) i, vv (SUC i)}) (:num)`][] +THEN MRESA_TAC Hypermap.node_map_and_darts[`hypermap + (HYP + (vec 0, + IMAGE (\i. --vv (k - SUC (i MOD k))) (:num), + IMAGE (\i. {--(vv:num->real^3) (k - SUC (i MOD k)), --vv (k - SUC (SUC i MOD k))}) + (:num)))`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[OPP_IMAGE_E_EQ_NEG;OPP_IMAGE_V_EQ_NEG;OPP_IMAGE_F_EQ_NEG;OPP_IMAGE_F_EQ2_NEG;dih2k;PAIR_FUN_SYM_0;GSYM IMAGE_UNION;OPP_IMAGE_E_EQ;OPP_IMAGE_V_EQ;OPP_IMAGE_F_EQ;OPP_IMAGE_F_EQ2;] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL FINITE_IMAGE)[`(\(x,y):real^3#real^3. --x,--y)`;`IMAGE (\(x,y):real^3#real^3. --x,--y)(IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num) UNION FF)`][ID_PAIR_SYM_0] +THEN MP_TAC(SET_RULE`FF SUBSET IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num) UNION FF`) +THEN RESA_TAC +THEN MRESA_TAC(FINITE_SUBSET)[`FF:real^3#real^3->bool`;`IMAGE (\i. vv (SUC i),(vv:num->real^3) i) (:num) UNION FF`] +THEN ASM_SIMP_TAC[CARD_PAIR_SYM_0;COMMUTATIVE_POINT_PAIR_0] +THEN REPLICATE_TAC (39-14)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REWRITE_TAC[Wrgcvdr_cizmrrh.has_orders;FUN_EQ_THM;I_DEF] +THEN REPEAT RESA_TAC; + + + + +REPLICATE_TAC (43-39)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT DISCH_TAC +THEN MP_TAC(ISPEC `i:num` th)) +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`(\(x,y). --x,--y) x':real^3#real^3`][ID_SYM_0]); + + + +REWRITE_TAC[Wrgcvdr_cizmrrh.has_orders;FUN_EQ_THM;I_DEF] +THEN MP_TAC EDGE_POWER_MAP_SYM_0 +THEN REWRITE_TAC[Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN RESA_TAC +THEN SUBGOAL_THEN `!n x. ITER n + (edge_map + (hypermap + (HYP + (vec 0, + IMAGE (\i. --vv i) (:num), + IMAGE (\i. {--vv i, --vv (SUC i)}) (:num))))) + (x) = + (\(x,y). --x,--y) + (ITER n (edge_map (hypermap (HYP (vec 0,V,E)))) ((\(x,y). --x,--y) x))` +ASSUME_TAC; + + + +REPEAT GEN_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`n:num`;`(\(x,y). --x,--y) x':real^3#real^3`][ID_SYM_0]) +; + + +ASM_SIMP_TAC[CARD_PAIR_SYM_0;COMMUTATIVE_POINT_PAIR_0] +THEN REPLICATE_TAC (26-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REWRITE_TAC[Wrgcvdr_cizmrrh.has_orders;FUN_EQ_THM;I_DEF] +THEN REPEAT RESA_TAC; + + + +REPLICATE_TAC (30-26)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT DISCH_TAC +THEN MP_TAC(ISPEC `i:num` th)) +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`(\(x,y). --x,--y) x':real^3#real^3`][ID_SYM_0]); + + + + + + +REWRITE_TAC[Wrgcvdr_cizmrrh.has_orders;FUN_EQ_THM;I_DEF] +THEN MP_TAC NODE_POWER_MAP_SYM_0 +THEN REWRITE_TAC[Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN RESA_TAC +THEN SUBGOAL_THEN `!n x. ITER n + (node_map + (hypermap + (HYP + (vec 0, + IMAGE (\i. --vv i) (:num), + IMAGE (\i. {--vv i, --vv (SUC i)}) (:num))))) + (x) = + (\(x,y). --x,--y) + (ITER n (node_map (hypermap (HYP (vec 0,V,E)))) ((\(x,y). --x,--y) x))` +ASSUME_TAC; + + + +REPEAT GEN_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`n:num`;`(\(x,y). --x,--y) x':real^3#real^3`][ID_SYM_0]) +; + + +ASM_SIMP_TAC[CARD_PAIR_SYM_0;COMMUTATIVE_POINT_PAIR_0] +THEN REPLICATE_TAC (26-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REWRITE_TAC[Wrgcvdr_cizmrrh.has_orders;FUN_EQ_THM;I_DEF] +THEN REPEAT RESA_TAC; + + + +REPLICATE_TAC (30-26)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT DISCH_TAC +THEN MP_TAC(ISPEC `i:num` th)) +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`(\(x,y). --x,--y) x':real^3#real^3`][ID_SYM_0]); + + + + +]);; + + + + + +let POINT_IN_AFF_LT_SYM_0=prove(` DISJOINT {vec 0,v1} {w2} +==> +-- w2 IN aff_lt {vec 0,v1} {w2}`, +STRIP_TAC +THEN ASM_SIMP_TAC[AFF_LT_2_1;IN_ELIM_THM] +THEN EXISTS_TAC`&2` +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`-- &1` +THEN REWRITE_TAC[REAL_ARITH`-- &1< &0/\ &2 + &0 + -- &1 = &1`] +THEN VECTOR_ARITH_TAC);; + + +let COLLINEAR_POINT_SYM_0=prove(`~collinear {vec 0, v1, w1} ==> ~collinear {vec 0, v1, --w1}`, +REWRITE_TAC[COLLINEAR_LEMMA;IMAGE;IN_ELIM_THM;VECTOR_ARITH`-- a= vec 0<=> a= vec 0`] +THEN RESA_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> STRIP_TAC +THEN MP_TAC th +THEN ASM_REWRITE_TAC[]) +THEN MATCH_MP_TAC(SET_RULE`A==> B\/C\/A`) +THEN EXISTS_TAC`--c:real` +THEN POP_ASSUM MP_TAC +THEN VECTOR_ARITH_TAC);; + + +let AZIM_EQ_PI_POINT_SYM_0=prove(`~collinear {vec 0, v1, w1:real^3} +==> azim (vec 0) v1 w1 (--w1) = pi`, +STRIP_TAC +THEN MRESA_TAC(GEN_ALL COLLINEAR_POINT_SYM_0)[`v1:real^3`;`w1:real^3`] +THEN ASM_SIMP_TAC[AZIM_EQ_PI] +THEN MRESAL_TAC (GEN_ALL POINT_IN_AFF_LT_SYM_0)[`v1:real^3`;`-- w1:real^3`][VECTOR_ARITH`-- --A=A:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_SIMP_TAC[Fan.th3a]);; + + + +let SUM_AZIM_SYM_0=prove(`~collinear {vec 0, v1, w1} /\ ~collinear {vec 0, v1, w2} +/\ azim (vec 0) v1 w1 w2<= pi +==> azim (vec 0) v1 w1 w2 + azim (vec 0) v1 w2 (--w1) = pi `, +REPEAT STRIP_TAC +THEN MRESA_TAC(GEN_ALL COLLINEAR_POINT_SYM_0)[`v1:real^3`;`w1:real^3`] +THEN MRESA_TAC(GEN_ALL AZIM_EQ_PI_POINT_SYM_0)[`v1:real^3`;`w1:real^3`] +THEN MRESA_TAC Fan.sum4_azim_fan[`vec 0:real^3`;`v1:real^3`;`w1:real^3`;`w2:real^3`;`--w1:real^3`]);; + + + +let SUM_AZIM_SYM_0=prove(`~collinear {vec 0, v1, w1} /\ ~collinear {vec 0, v1, w2} +/\ azim (vec 0) v1 w1 w2<= pi +==> azim (vec 0) v1 w1 w2 + azim (vec 0) v1 w2 (--w1) = pi `, +REPEAT STRIP_TAC +THEN MRESA_TAC(GEN_ALL COLLINEAR_POINT_SYM_0)[`v1:real^3`;`w1:real^3`] +THEN MRESA_TAC(GEN_ALL AZIM_EQ_PI_POINT_SYM_0)[`v1:real^3`;`w1:real^3`] +THEN MRESA_TAC Fan.sum4_azim_fan[`vec 0:real^3`;`v1:real^3`;`w1:real^3`;`w2:real^3`;`--w1:real^3`]);; + + + + +let AZIM_EQ_LE_SYM_0=prove(`~collinear {vec 0, v1, w1} /\ ~collinear {vec 0, v1, w2} +/\ azim (vec 0) v1 w1 w2<= pi +==> azim (vec 0) v1 (--w1) (--w2)=azim (vec 0) v1 w1 w2 `, +STRIP_TAC +THEN MP_TAC SUM_AZIM_SYM_0 +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0<= azim (vec 0) v1 w1 w2/\ azim (vec 0) v1 w1 w2 + azim (vec 0) v1 w2 (--w1) = pi +==> azim (vec 0) v1 w2 (--w1) <= pi`) +THEN ASM_SIMP_TAC[azim] +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL COLLINEAR_POINT_SYM_0)[`v1:real^3`;`w1:real^3`] +THEN MRESA_TAC (GEN_ALL SUM_AZIM_SYM_0)[`v1:real^3`;`--w1:real^3`;`w2:real^3`] +THEN ASM_TAC +THEN REAL_ARITH_TAC);; + + +let AZIM_LE_PI_SYM_0=prove(`~collinear {vec 0, v1, w1} /\ ~collinear {vec 0, v1, w2} +/\ azim (vec 0) v1 w1 w2<= pi +==> azim (vec 0) v1 (--w1) (--w2) <= pi`, +REPEAT STRIP_TAC +THEN MP_TAC AZIM_EQ_LE_SYM_0 +THEN RESA_TAC);; + + + + +let EQUI_FF_SYM_0=prove(`!(x:real^N#real^N). (SND x, FST x)IN IMAGE (\i. vv (SUC i),vv i) (:num) <=> x IN IMAGE (\i. vv i,vv (SUC i)) (:num)`, +REWRITE_TAC[IMAGE;IN_ELIM_THM;PAIR_EQ] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THENL[ +EXISTS_TAC`x':num` +THEN ASM_SIMP_TAC[] +THEN MP_TAC(SET_RULE`x=(FST (x:real^N#real^N),SND (x:real^N#real^N))`) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[PAIR_EQ] +THEN ASM_SIMP_TAC[]; +POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`x=(FST (x:real^N#real^N),SND (x:real^N#real^N))`) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[PAIR_EQ] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`x':num` +THEN ASM_SIMP_TAC[]]);; + + + +let CARD_EQUI_FF_SYM_0=prove(`FINITE (IMAGE (\i. vv i,vv (SUC i)) (:num)) +==> +CARD (IMAGE (\i. (vv:num->real^N) (SUC i),vv i) (:num))= CARD (IMAGE (\i. vv i,vv (SUC i)) (:num))`, +STRIP_TAC +THEN MATCH_MP_TAC CARD_IMAGE_INJ_EQ +THEN EXISTS_TAC`(\(x:real^N#real^N). (SND x, FST x))` +THEN ASM_REWRITE_TAC[EQUI_FF_SYM_0;EXISTS_UNIQUE] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`SND (y:real^N#real^N),FST (y:real^N#real^N)` +THEN MRESA_TAC( GEN_ALL EQUI_FF_SYM_0)[`vv:num->real^N`;`SND (y:real^N#real^N),FST (y:real^N#real^N)`] +THEN REPEAT RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]));; + + +let FF_OF_HYP_ITER_VV=prove(`scs_k_v39 s=k /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ is_scs_v39 s /\ ~(k <= 3)/\ BBs_v39 s vv +==> !n. +(ITER n (ff_of_hyp (vec 0,V,E)) ) (vv (SUC i),vv i)= vv (SUC(n*(k-1)+i)),vv (n*(k-1)+i)`, +STRIP_TAC +THEN INDUCT_TAC +THENL[ +REWRITE_TAC[ITER;I_DEF;ARITH_RULE`0 *B+A=A`]; +ASM_REWRITE_TAC[ITER] +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;PAIR_EQ;LET_DEF;LET_END_DEF;convex_local_fan;ff_of_hyp;] +THEN REPEAT RESA_TAC +THEN MRESA_TAC(GEN_ALL DART_OF_HYP_VV)[`vv:num->real^3`] +THEN SUBGOAL_THEN`vv (SUC (n *(k-1)+ i)),(vv:num->real^3) (n *(k-1)+ i) IN + FF UNION IMAGE (\i. vv (SUC i),vv i) (:num)`ASSUME_TAC +THENL[ +REWRITE_TAC[UNION;IN_ELIM_THM] +THEN MATCH_MP_TAC(SET_RULE`A==> B\/A`) +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`n *(k-1)+i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`~(k<=3)==> SUC (SUC n * (k - 1) + i) =(n*(k-1)+i) +k /\ (n * (k - 1) + i) + k - 1 =SUC n * (k - 1) + i`) +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL EE_EXPAND_BB_VV)[`V:real^3->bool`;`FF:real^3#real^3->bool`;`s:scs_v39`;`E:(real^3->bool)->bool`;`vv:num->real^3`;`(n * (k - 1) + i)`;`k:num`] +[BBs_v39;PAIR_EQ;LET_DEF;LET_END_DEF;convex_local_fan;ff_of_hyp;] +THEN SIMP_TAC[Polar_fan.IVS_AZIM_CYCLE_TWO_POINT_SET] +THEN ASM_TAC +THEN REWRITE_TAC[periodic] +THEN REPEAT RESA_TAC]]);; + + + +let DUAL_EXISTS_MOD0=prove(` ~(k=0) ==> ?n. (n*(k-1)) MOD k= b MOD k `, +STRIP_TAC +THEN EXISTS_TAC`k- b MOD k` +THEN MRESA_TAC DIVISION[`b:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`~(k=0)/\ b MOD k b MOD k<=k/\ 1 <= k- b MOD k /\ 0 (k * (k - b MOD k) + b MOD k) - k = k * (k - b MOD k) - k *1+ b MOD k`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[GSYM LEFT_SUB_DISTRIB] +THEN ONCE_REWRITE_TAC[MULT_SYM] +THEN MRESA_TAC MOD_MULT_ADD[`k-b MOD k-1`;`k:num`;`b MOD k`] +THEN ASM_SIMP_TAC[MOD_MOD_REFL]);; + + + +let DUAL_EXISTS_MOD_LE=prove(` ~(k=0)/\ a MOD k<= b MOD k ==> ?n. (n*(k-1) +a) MOD k= b MOD k `, +REPEAT STRIP_TAC +THEN MRESA_TAC(GEN_ALL DUAL_EXISTS_MOD0)[`b MOD k- a MOD k`;`k:num`] +THEN EXISTS_TAC`n:num` +THEN MRESA_TAC DIVISION[`b:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`a MOD k<= b MOD k /\ b MOD k b MOD k - a MOD k< k/\ (b MOD k- a MOD k) + a MOD k= b MOD k `) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`b MOD k- a MOD k`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`n*(k-1)`;`a:num`;`k:num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[MOD_MOD_REFL]);; + +let DUAL_EXISTS_MOD_GE=prove(` ~(k=0)/\ b MOD k<= a MOD k ==> ?n. (n*(k-1) +a) MOD k= b MOD k `, +REPEAT STRIP_TAC +THEN MRESA_TAC(GEN_ALL DUAL_EXISTS_MOD0)[`b MOD k +k- a MOD k`;`k:num`] +THEN EXISTS_TAC`n:num` +THEN MRESA_TAC DIVISION[`a:num`;`k:num`] +THEN MRESA_TAC MOD_LT[`a MOD k`;`k:num`] +THEN MP_TAC(ARITH_RULE`a MOD k(b MOD k + k - a MOD k) + a MOD k= 1* k+ b MOD k`) +THEN RESA_TAC +THEN MRESA_TAC MOD_MULT_ADD[`1:num`;`k:num`;`b MOD k`] +THEN MRESA_TAC MOD_ADD_MOD[`b MOD k + k - a MOD k`;`a MOD k:num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`n*(k-1)`;`a:num`;`k:num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[MOD_MOD_REFL]);; + + +let DUAL_EXISTS_MOD=prove(` ~(k=0) ==> ?n. (n*(k-1) +a) MOD k= b MOD k `, +STRIP_TAC +THEN MP_TAC(ARITH_RULE`a MOD k<= b MOD k\/ b MOD k<= a MOD k`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[DUAL_EXISTS_MOD_GE;DUAL_EXISTS_MOD_LE]);; + + + +let FACE_DUAL_SYM_0=prove(`scs_k_v39 s=k /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ x IN FF /\ SND x,FST x = v1 +/\ is_scs_v39 s /\ ~(k <= 3)/\ BBs_v39 s vv +==> +IMAGE (\i. vv (SUC i),vv i) (:num) = face (hypermap (HYP (vec 0,V,E))) v1`, +STRIP_TAC +THEN POP_ASSUM(fun th-> +MP_TAC th +THEN MP_TAC(ARITH_RULE`~(k<=3)==> 3<=k/\ 1bool`;`E:(real^3->bool)->bool`] +THEN ASM_TAC +THEN REPLICATE_TAC (16-12)(STRIP_TAC) +THEN EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;EXTENSION;Wrgcvdr_cizmrrh.POWER_TO_ITER;] +THEN REPEAT RESA_TAC +THEN EQ_TAC +THENL[ +REPEAT STRIP_TAC +THEN EXPAND_TAC"v1" +THEN MRESA_TAC(GEN_ALL FF_OF_HYP_ITER_VV) +[`FF:real^3#real^3->bool`;`s:scs_v39`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`vv:num->real^3`;`k:num`;`x'':num`;] +THEN MRESA_TAC (GEN_ALL DUAL_EXISTS_MOD)[`x'':num`;`x'''':num`;`k:num`] +THEN EXISTS_TAC`n:num` +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`x'''':num`] +THEN MRESA_TAC th[`n *(k-1) + x''`] +THEN MRESA_TAC th[`SUC x'''':num`] +THEN MRESA_TAC th[`SUC(n *(k-1) + x'')`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ADD1]) +THEN MRESA_TAC MOD_LT[`1`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`(n * (k - 1) + x'')`;`1`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`(x''''):num`;`1`;`k:num`] +THEN ARITH_TAC; +RESA_TAC +THEN EXPAND_TAC"v1" +THEN MRESA_TAC(GEN_ALL FF_OF_HYP_ITER_VV) +[`FF:real^3#real^3->bool`;`s:scs_v39`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`vv:num->real^3`;`k:num`;`x'':num`;] +THEN EXISTS_TAC`n * (k - 1) + x'':num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`]]);; + + + + +let LOCAL_FAN_DUAL_SYM_0=prove_by_refinement(`scs_k_v39 s=k /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ is_scs_v39 s /\ ~(k <= 3)/\ BBs_v39 s vv +==> local_fan + (IMAGE (\i. --vv (k - SUC (i MOD k))) (:num), + IMAGE (\i. {--vv (k - SUC (i MOD k)), --vv (k - SUC (SUC i MOD k))}) (:num), + IMAGE (\i. --vv (k - SUC (i MOD k)),--vv (k - SUC (SUC i MOD k))) (:num))`, +[STRIP_TAC +THEN POP_ASSUM(fun th-> +MP_TAC th +THEN MP_TAC(ARITH_RULE`~(k<=3)==> 3<=k/\ 1 +REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (15-12)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC face_refl[`hypermap (HYP (vec 0,(V:real^3->bool),(E:(real^3->bool)->bool)))`;`x:real^3#real^3`] +THEN ABBREV_TAC`v1=(SND (x:real^3#real^3),FST (x:real^3#real^3))` +THEN MP_TAC OPP_FAN_SYM_0 +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL Lvducxu.FAN_DART_DARTS)[`vec 0:real^3`;`IMAGE (\i. {--(vv:num->real^3) (k - SUC (i MOD k)), --vv (k - SUC (SUC i MOD k))}) (:num)`;`IMAGE (\i. --(vv:num->real^3) (k - SUC (i MOD k))) (:num)`][DART_OF_HYP_VV] +THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) +THEN ASM_SIMP_TAC[IN_ELIM_THM;PAIR_FUN_SYM_0;OPP_IMAGE_F_EQ;OPP_IMAGE_F_EQ2] +THEN REPEAT RESA_TAC +; + + + +EXISTS_TAC`(\(x:real^3,y:real^3). --x,--y) v1` +THEN ASM_SIMP_TAC[UNION;IN_ELIM_THM;IN_PAIR_SYM_0; IN_EQ_PAIR_SYM_0] +THEN MP_TAC FACE_SYM_0 +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`~(k<=3)==> ~(k=0)`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[OPP_IMAGE_E_EQ_NEG;OPP_IMAGE_V_EQ_NEG;] +; + + +MATCH_MP_TAC(SET_RULE`A==> A\/B`) +THEN EXPAND_TAC"v1" +THEN SIMP_TAC[EQUI_FF_SYM_0] +THEN ASM_SIMP_TAC[]; + + + + +MP_TAC FACE_ALL_SYM_0 +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC +THEN ASM_SIMP_TAC[EQ_SET_PAIR_SYM_0;] +THEN MP_TAC FACE_DUAL_SYM_0 +THEN RESA_TAC +; + + + +REPLICATE_TAC (16-12)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT STRIP_TAC +THEN MP_TAC th) +THEN REPLICATE_TAC (15-12)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC (SYM th)) +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL Lvducxu.FAN_DART_DARTS)[`vec 0:real^3`;`IMAGE (\i. {(vv:num->real^3) i, vv (SUC i)}) (:num)`;`IMAGE (vv:num->real^3) (:num)`][DART_OF_HYP_VV] +THEN MP_TAC OPP_FAN_SYM_0 +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL Lvducxu.FAN_DART_DARTS)[`vec 0:real^3`;`IMAGE (\i. {--(vv:num->real^3) (k - SUC (i MOD k)), --vv (k - SUC (SUC i MOD k))}) (:num)`;`IMAGE (\i. --(vv:num->real^3) (k - SUC (i MOD k))) (:num)`][DART_OF_HYP_VV] +THEN ASM_SIMP_TAC[IN_ELIM_THM;PAIR_FUN_SYM_0;OPP_IMAGE_F_EQ;OPP_IMAGE_F_EQ2] +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`~(k<=3)==> ~(k=0)`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[dih2k] +THEN REPEAT RESA_TAC +THEN ASM_SIMP_TAC[OPP_IMAGE_E_EQ_NEG;OPP_IMAGE_V_EQ_NEG;OPP_IMAGE_F_EQ_NEG;OPP_IMAGE_F_EQ2_NEG;dih2k;PAIR_FUN_SYM_0;GSYM IMAGE_UNION;OPP_IMAGE_E_EQ;OPP_IMAGE_V_EQ;OPP_IMAGE_F_EQ;OPP_IMAGE_F_EQ2;] +THEN REPEAT STRIP_TAC; + + + + + +MRESA_TAC Hypermap.node_map_and_darts[`hypermap + (HYP + (vec 0, + IMAGE (\i. --vv (k - SUC (i MOD k))) (:num), + IMAGE (\i. {--(vv:num->real^3) (k - SUC (i MOD k)), --vv (k - SUC (SUC i MOD k))}) + (:num)))`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[OPP_IMAGE_E_EQ_NEG;OPP_IMAGE_V_EQ_NEG;OPP_IMAGE_F_EQ_NEG;OPP_IMAGE_F_EQ2_NEG;dih2k;PAIR_FUN_SYM_0;GSYM IMAGE_UNION;OPP_IMAGE_E_EQ;OPP_IMAGE_V_EQ;OPP_IMAGE_F_EQ;OPP_IMAGE_F_EQ2;] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL FINITE_IMAGE)[`(\(x,y):real^3#real^3. --x,--y)`;`IMAGE (\(x,y):real^3#real^3. --x,--y)(IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num) UNION FF)`][ID_PAIR_SYM_0] +THEN MP_TAC(SET_RULE`IMAGE (\i. vv (SUC i),vv i) (:num) SUBSET IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num) UNION FF`) +THEN RESA_TAC +THEN MRESA_TAC(FINITE_SUBSET)[`IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num)`;`IMAGE (\i. vv (SUC i),(vv:num->real^3) i) (:num) UNION FF`] +THEN MP_TAC(SET_RULE`FF SUBSET IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num) UNION FF`) +THEN RESA_TAC +THEN MRESA_TAC(FINITE_SUBSET)[`IMAGE (\i. vv i,(vv:num->real^3) (SUC i)) (:num)`;`IMAGE (\i. vv (SUC i),(vv:num->real^3) i) (:num) UNION FF`] +THEN ASM_SIMP_TAC[CARD_PAIR_SYM_0] +THEN ONCE_REWRITE_TAC[SET_RULE`A UNION B=B UNION A`] +THEN MRESA_TAC (GEN_ALL CARD_EQUI_FF_SYM_0)[`vv:num->real^3`] +THEN REPLICATE_TAC (31-12)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[SYM th]); + + + + + +ASM_TAC +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;] +THEN REPEAT RESA_TAC +THEN MP_TAC FACE_ALL_SYM_0 +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`(\(x,y):real^3#real^3. --x,--y) x'`][ID_SYM_0]) +THEN MP_TAC IMAGE_NODE_SYM_0 +THEN RESA_TAC +THEN ASM_SIMP_TAC[GSYM IMAGE_UNION] +THEN MRESA_TAC (GEN_ALL IN_EQ_PAIR_SYM_0)[`x':real^3#real^3`;`IMAGE (\i. --vv (k - SUC (i MOD k)),--vv (k - SUC (SUC i MOD k))) + (:num) UNION + IMAGE (\i. --vv (k - SUC (SUC i MOD k)),--(vv:num->real^3) (k - SUC (i MOD k))) + (:num)`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[OPP_IMAGE_E_EQ_NEG;OPP_IMAGE_V_EQ_NEG;OPP_IMAGE_F_EQ_NEG;OPP_IMAGE_F_EQ2_NEG;dih2k;PAIR_FUN_SYM_0;GSYM IMAGE_UNION;OPP_IMAGE_E_EQ;OPP_IMAGE_V_EQ;OPP_IMAGE_F_EQ;OPP_IMAGE_F_EQ2;ID_PAIR_SYM_0] +THEN ONCE_REWRITE_TAC[SET_RULE`A UNION B= B UNION A`] +THEN STRIP_TAC +THEN REPLICATE_TAC (28-13)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT STRIP_TAC +THEN MRESA_TAC th[`((\(x,y):real^3#real^3. --x,--y) x')`] +) +THEN SET_TAC[] +; + + +REWRITE_TAC[Wrgcvdr_cizmrrh.has_orders;FUN_EQ_THM;I_DEF] +THEN MP_TAC ff_POWER_COMMUTATIVE_SYM_0 +THEN REWRITE_TAC[Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN RESA_TAC +THEN SUBGOAL_THEN `!n x. + ITER n + (ff_of_hyp + (vec 0, + IMAGE (\i. --vv i) (:num), + IMAGE (\i. {--vv i, --vv (SUC i)}) (:num))) + (x) = + (\(x,y). --x,--y) (ITER n (ff_of_hyp (vec 0,V,E)) ((\(x,y). --x,--y) x))` +ASSUME_TAC; + + + +REPEAT GEN_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`n:num`;`(\(x,y). --x,--y) x':real^3#real^3`][ID_SYM_0]) +; + + + +SUBGOAL_THEN`CARD (IMAGE (\(x,y). --x,--y) (IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num))) = CARD (FF:real^3#real^3->bool)`ASSUME_TAC +; + + +MRESA_TAC Hypermap.node_map_and_darts[`hypermap + (HYP + (vec 0, + IMAGE (\i. --vv (k - SUC (i MOD k))) (:num), + IMAGE (\i. {--(vv:num->real^3) (k - SUC (i MOD k)), --vv (k - SUC (SUC i MOD k))}) + (:num)))`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[OPP_IMAGE_E_EQ_NEG;OPP_IMAGE_V_EQ_NEG;OPP_IMAGE_F_EQ_NEG;OPP_IMAGE_F_EQ2_NEG;dih2k;PAIR_FUN_SYM_0;GSYM IMAGE_UNION;OPP_IMAGE_E_EQ;OPP_IMAGE_V_EQ;OPP_IMAGE_F_EQ;OPP_IMAGE_F_EQ2;] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL FINITE_IMAGE)[`(\(x,y):real^3#real^3. --x,--y)`;`IMAGE (\(x,y):real^3#real^3. --x,--y)(IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num) UNION FF)`][ID_PAIR_SYM_0] +THEN MP_TAC(SET_RULE`IMAGE (\i. vv (SUC i),vv i) (:num) SUBSET IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num) UNION FF`) +THEN RESA_TAC +THEN MRESA_TAC(FINITE_SUBSET)[`IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num)`;`IMAGE (\i. vv (SUC i),(vv:num->real^3) i) (:num) UNION FF`] +THEN MP_TAC(SET_RULE`FF SUBSET IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num) UNION FF`) +THEN RESA_TAC +THEN MRESA_TAC(FINITE_SUBSET)[`IMAGE (\i. vv i,(vv:num->real^3) (SUC i)) (:num)`;`IMAGE (\i. vv (SUC i),(vv:num->real^3) i) (:num) UNION FF`] +THEN ASM_SIMP_TAC[CARD_PAIR_SYM_0] +THEN ONCE_REWRITE_TAC[SET_RULE`A UNION B=B UNION A`] +THEN MRESA_TAC (GEN_ALL CARD_EQUI_FF_SYM_0)[`vv:num->real^3`] +; + + + + +MP_TAC FAN_SYM_0 +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`IMAGE (\i. --(vv:num->real^3) i) (:num)`;`IMAGE (\i. {--(vv:num->real^3) i, --vv (SUC i)}) (:num)`][orbit_map;IN_ELIM_THM;] +THEN MRESAL_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`IMAGE (vv:num->real^3) (:num)`;`IMAGE (\i. {(vv:num->real^3) i, vv (SUC i)}) (:num)`][] +THEN MRESA_TAC Hypermap.node_map_and_darts[`hypermap + (HYP + (vec 0, + IMAGE (\i. --vv (k - SUC (i MOD k))) (:num), + IMAGE (\i. {--(vv:num->real^3) (k - SUC (i MOD k)), --vv (k - SUC (SUC i MOD k))}) + (:num)))`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[OPP_IMAGE_E_EQ_NEG;OPP_IMAGE_V_EQ_NEG;OPP_IMAGE_F_EQ_NEG;OPP_IMAGE_F_EQ2_NEG;dih2k;PAIR_FUN_SYM_0;GSYM IMAGE_UNION;OPP_IMAGE_E_EQ;OPP_IMAGE_V_EQ;OPP_IMAGE_F_EQ;OPP_IMAGE_F_EQ2;] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL FINITE_IMAGE)[`(\(x,y):real^3#real^3. --x,--y)`;`IMAGE (\(x,y):real^3#real^3. --x,--y)(IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num) UNION FF)`][ID_PAIR_SYM_0] +THEN MP_TAC(SET_RULE`FF SUBSET IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num) UNION FF`) +THEN RESA_TAC +THEN MRESA_TAC(FINITE_SUBSET)[`FF:real^3#real^3->bool`;`IMAGE (\i. vv (SUC i),(vv:num->real^3) i) (:num) UNION FF`] +THEN ASM_SIMP_TAC[CARD_PAIR_SYM_0;COMMUTATIVE_POINT_PAIR_0] +THEN REPLICATE_TAC (40-14)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REWRITE_TAC[Wrgcvdr_cizmrrh.has_orders;FUN_EQ_THM;I_DEF] +THEN REPEAT RESA_TAC; + + +REPLICATE_TAC (43-39)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT DISCH_TAC +THEN MP_TAC(ISPEC `i:num` th)) +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`(\(x,y). --x,--y) x':real^3#real^3`][ID_SYM_0]); + + +REWRITE_TAC[Wrgcvdr_cizmrrh.has_orders;FUN_EQ_THM;I_DEF] +THEN MP_TAC EDGE_POWER_MAP_SYM_0 +THEN REWRITE_TAC[Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN RESA_TAC +THEN SUBGOAL_THEN `!n x. ITER n + (edge_map + (hypermap + (HYP + (vec 0, + IMAGE (\i. --vv i) (:num), + IMAGE (\i. {--vv i, --vv (SUC i)}) (:num))))) + (x) = + (\(x,y). --x,--y) + (ITER n (edge_map (hypermap (HYP (vec 0,V,E)))) ((\(x,y). --x,--y) x))` +ASSUME_TAC; + + +REPEAT GEN_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`n:num`;`(\(x,y). --x,--y) x':real^3#real^3`][ID_SYM_0]) +; + +ASM_SIMP_TAC[CARD_PAIR_SYM_0;COMMUTATIVE_POINT_PAIR_0] +THEN REPLICATE_TAC (26-15)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REWRITE_TAC[Wrgcvdr_cizmrrh.has_orders;FUN_EQ_THM;I_DEF] +THEN REPEAT RESA_TAC; + + +REPLICATE_TAC (30-26)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT DISCH_TAC +THEN MP_TAC(ISPEC `i:num` th)) +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`(\(x,y). --x,--y) x':real^3#real^3`][ID_SYM_0]); + + + + + +REWRITE_TAC[Wrgcvdr_cizmrrh.has_orders;FUN_EQ_THM;I_DEF] +THEN MP_TAC NODE_POWER_MAP_SYM_0 +THEN REWRITE_TAC[Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN RESA_TAC +THEN SUBGOAL_THEN `!n x. ITER n + (node_map + (hypermap + (HYP + (vec 0, + IMAGE (\i. --vv i) (:num), + IMAGE (\i. {--vv i, --vv (SUC i)}) (:num))))) + (x) = + (\(x,y). --x,--y) + (ITER n (node_map (hypermap (HYP (vec 0,V,E)))) ((\(x,y). --x,--y) x))` +ASSUME_TAC; + + +REPEAT GEN_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`n:num`;`(\(x,y). --x,--y) x':real^3#real^3`][ID_SYM_0]) +; + +ASM_SIMP_TAC[CARD_PAIR_SYM_0;COMMUTATIVE_POINT_PAIR_0] +THEN REPLICATE_TAC (26-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT DISCH_TAC +THEN MP_TAC th) +THEN REWRITE_TAC[Wrgcvdr_cizmrrh.has_orders;FUN_EQ_THM;I_DEF] +THEN REPEAT RESA_TAC; + + +REPLICATE_TAC (30-26)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +REPEAT DISCH_TAC +THEN MP_TAC(ISPEC `i:num` th)) +THEN ASM_REWRITE_TAC[] +THEN GEN_TAC +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`(\(x,y). --x,--y) x':real^3#real^3`][ID_SYM_0]); + +]);; + + + +let AZIM_NEG_FIRST_PI=prove_by_refinement( +`~collinear {vec 0, v1, w1} /\ ~collinear {vec 0, v1, w2} +/\ &0 azim (vec 0) (--v1) w1 w2 = &2 *pi- azim (vec 0) v1 w1 w2`, +[STRIP_TAC +THEN MATCH_MP_TAC AZIM_UNIQUE +THEN MRESA_TAC Fan.properties_coordinate[`vec 0:real^3`;`v1:real^3`;`w1:real^3`] +THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`w2:real^3`] +THEN MRESA_TAC azim[`vec 0:real^3`;`v1:real^3`;`w1:real^3`;`w2:real^3`] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`e1_fan (vec 0:real^3) v1 w1`;`e2_fan (vec 0:real^3) v1 w1`;`e3_fan (vec 0:real^3) v1 w1`]) +THEN EXISTS_TAC`--h1:real` +THEN EXISTS_TAC`--h2:real` +THEN EXISTS_TAC`r1:real` +THEN EXISTS_TAC`r2:real` +THEN EXISTS_TAC`e1_fan (vec 0:real^3) v1 w1` +THEN EXISTS_TAC`--e2_fan (vec 0:real^3) v1 w1` +THEN EXISTS_TAC`-- e3_fan (vec 0:real^3) v1 w1` +THEN EXISTS_TAC`&2 * pi- psi` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= A-B<=> B<=A`;REAL_ARITH`A-B< A<=> &0 a<=b`) +THEN ASM_REWRITE_TAC[]; +STRIP_TAC; +ASM_TAC +THEN REWRITE_TAC[orthonormal] +THEN REPEAT DISCH_TAC +THEN ASM_REWRITE_TAC[DOT_RNEG;DOT_LNEG;REAL_ARITH`-- -- A=A/\ -- &0= &0`;CROSS_RNEG] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DOT_SYM]; +ASM_REWRITE_TAC[VECTOR_ARITH`(-- A= vec 0:real^3<=> A= vec 0)/\ A- vec 0=A`;dist;NORM_NEG] +THEN STRIP_TAC; +ASM_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(-- A= vec 0:real^3<=> A= vec 0)/\ A- vec 0=A`;dist;NORM_NEG] +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`a % --b= -- c <=> a % b=c:real^3`]; +REWRITE_TAC[SIN_SUB;COS_SUB] +THEN MRESAL_TAC SIN_PERIODIC[`&0`][REAL_ARITH`&0+A=A`] +THEN MRESAL_TAC COS_PERIODIC[`&0`][REAL_ARITH`&0+A=A `;SIN_0;COS_0] +THEN STRIP_TAC; +VECTOR_ARITH_TAC; +REWRITE_TAC[REAL_ARITH`A-B+A-C=(A+A)-(B+C)`;SIN_SUB;COS_SUB] +THEN MRESAL_TAC SIN_PERIODIC[`&2 *pi`][REAL_ARITH`&0+A=A`] +THEN MRESAL_TAC COS_PERIODIC[`&2 *pi`][REAL_ARITH`&0+A=A `;SIN_0;COS_0] +THEN VECTOR_ARITH_TAC]);; + + + + +let AZIM_COMPL_NEG=prove(`~collinear {vec 0, v1, w1:real^3} /\ ~collinear {vec 0, v1, w2} +==> azim (vec 0) (--v1) w1 w2 = azim (vec 0) v1 w2 w1`, +REPEAT STRIP_TAC +THEN MRESA_TAC AZIM_COMPL[`vec 0:real^3`;`v1:real^3`;`w1:real^3`;`w2:real^3`] +THEN MRESA_TAC azim[`vec 0:real^3`;`v1:real^3`;`w1:real^3`;`w2:real^3`] +THEN MP_TAC(REAL_ARITH`&0 <= azim (vec 0) v1 w1 w2 +==> azim (vec 0) v1 w1 w2 = &0 \/ (&0 < azim (vec 0) v1 w1 (w2:real^3)/\ ~(azim (vec 0) v1 w1 w2 = &0))`) +THEN RESA_TAC +THENL[ +POP_ASSUM MP_TAC +THEN MRESA_TAC(GEN_ALL COLLINEAR_POINT_SYM_0)[`w1:real^3`;`v1:real^3`] +THEN MRESA_TAC(GEN_ALL COLLINEAR_POINT_SYM_0)[`w2:real^3`;`v1:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`w2:real^3`] +THEN MRESA_TAC th3[`vec 0:real^3`;`-- v1:real^3`;`w2:real^3`]THEN ASM_SIMP_TAC[AZIM_EQ_0;AFF_GT_2_1;IN_ELIM_THM] +THEN RESA_TAC +THEN EXISTS_TAC`t1+ &2 * t2` +THEN EXISTS_TAC`-- t2:real` +THEN EXISTS_TAC`t3:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`(t1 + &2 * t2) + --t2 + t3= t1+t2+t3`] +THEN VECTOR_ARITH_TAC; +ASM_SIMP_TAC[AZIM_NEG_FIRST_PI]]);; + + + +let REMOVE_NEG_AZIM1_SYM_0=prove_by_refinement(`~collinear {vec 0, v1, w1:real^3} /\ ~collinear {vec 0, v1, w2} +==> azim (vec 0) v1 (--w1) (--w2) = azim (vec 0) v1 w1 w2`, +[STRIP_TAC +THEN MATCH_MP_TAC AZIM_UNIQUE +THEN MRESA_TAC Fan.properties_coordinate[`vec 0:real^3`;`v1:real^3`;`w1:real^3`] +THEN MRESA_TAC th3[`vec 0:real^3`;`v1:real^3`;`w2:real^3`] +THEN MRESA_TAC azim[`vec 0:real^3`;`v1:real^3`;`w1:real^3`;`w2:real^3`] +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`e1_fan (vec 0:real^3) v1 w1`;`e2_fan (vec 0:real^3) v1 w1`;`e3_fan (vec 0:real^3) v1 w1`][VECTOR_ARITH`A- vec 0=A`]) +THEN EXISTS_TAC`--h1:real` +THEN EXISTS_TAC`--h2:real` +THEN EXISTS_TAC`r1:real` +THEN EXISTS_TAC`r2:real` +THEN EXISTS_TAC`--e1_fan (vec 0:real^3) v1 w1` +THEN EXISTS_TAC`--e2_fan (vec 0:real^3) v1 w1` +THEN EXISTS_TAC`e3_fan (vec 0:real^3) v1 w1` +THEN EXISTS_TAC`psi:real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= A-B<=> B<=A`;REAL_ARITH`A-B< A<=> &0 w1 = + (r1 * cos psi) % e1_fan (vec 0) v1 w1 + + (r1 * sin psi) % e2_fan (vec 0) v1 w1 + + h1 % v1:real^3`] +THEN ASM_REWRITE_TAC[VECTOR_ARITH`--w2 = + (r2 * cos (psi + azim (vec 0) v1 w1 w2)) % --e1_fan (vec 0) v1 w1 + + (r2 * sin (psi + azim (vec 0) v1 w1 w2)) % --e2_fan (vec 0) v1 w1 + + --h2 % v1<=> +w2 = + (r2 * cos (psi + azim (vec 0) v1 w1 w2)) % e1_fan (vec 0) v1 w1 + + (r2 * sin (psi + azim (vec 0) v1 w1 w2)) % e2_fan (vec 0) v1 w1 + + h2 % v1`] +THEN RESA_TAC; +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]; +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]);; + + + +let AZIM_NEG=prove(`~collinear {vec 0, v1, w1:real^3} /\ ~collinear {vec 0, v1, w2} +==> azim (vec 0) (--v1) (--w1) (--w2) = azim (vec 0) v1 w2 w1`, +STRIP_TAC +THEN MRESA_TAC (GEN_ALL COLLINEAR_POINT_SYM_0)[`w1:real^3`;`v1:real^3`] +THEN MRESA_TAC (GEN_ALL COLLINEAR_POINT_SYM_0)[`w2:real^3`;`v1:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN RESA_TAC +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL REMOVE_NEG_AZIM1_SYM_0)[`-- v1:real^3`;`w1:real^3`;` w2:real^3`] +THEN ASM_SIMP_TAC[AZIM_COMPL_NEG]);; + + + +let FST_SND_NEG_PAIR_SYM_0=prove(`--SND ((\(x,y):real^N#real^N. --x,--y) x)= SND x/\ --FST ((\(x,y):real^N#real^N. --x,--y) x)= FST x`, +MP_TAC(SET_RULE`x=(FST (x:real^N#real^N),SND (x:real^N#real^N))`) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[VECTOR_ARITH`-- -- A=A:real^N`]);; + + + + + + +let CONVEX_LOCAL_FAN_SYM_0=prove_by_refinement(` scs_k_v39 s=k /\ + IMAGE vv (:num) = V /\ + IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E /\ + IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ is_scs_v39 s /\ ~(k <= 3)/\ BBs_v39 s vv +==> convex_local_fan + (IMAGE (\i. --vv (k - SUC (i MOD k))) (:num), + IMAGE (\i. {--vv (k - SUC (i MOD k)), --vv (k - SUC (SUC i MOD k))}) (:num), + IMAGE (\i. --vv (k - SUC (i MOD k)),--vv (k - SUC (SUC i MOD k))) (:num))`, +[REWRITE_TAC[convex_local_fan] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`~(k<=3)==> ~(k=0)/\ 1real^3) (SUC i),vv (i)) (:num))`][ID_PAIR_SYM_0] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_DETERMINE_AZIM_IN_FA) +[`IMAGE (\x:real^3. --x) V`;`IMAGE (\(x,y):real^3#real^3. --x,--y) (IMAGE (\i. vv (SUC i),vv i) (:num))`;`IMAGE (\i. {-- (vv:num->real^3) i, --vv (SUC i)}) (:num)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`x:real^3#real^3`]) +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM PAIR_FUN_SYM_0] +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[IMAGE;IN_ELIM_THM] +THEN REWRITE_TAC[EE_SYM_0] +THEN RESA_TAC +THEN ASM_SIMP_TAC[EE_SYM_0;EE_EXPAND_BB_VV] +THEN MRESAL_TAC (GEN_ALL EE_EXPAND_BB_VV)[`V:real^3->bool`;`FF:real^3#real^3->bool`;`s:scs_v39`;`E:(real^3->bool)->bool`;`vv:num->real^3`;`SUC x'`;`k:num`;] +[BBs_v39;PAIR_EQ;LET_DEF;LET_END_DEF;convex_local_fan;] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`SUC x' +k-1`] +THEN MRESA_TAC th[`x':num`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC(ARITH_RULE`~(k<=3) ==> SUC x' + k - 1= 1 *k + x'/\ ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`x':num`] +THEN ASM_SIMP_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;GSYM ELEMENT2_SYM_0] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_SIMP_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;GSYM ELEMENT2_SYM_0;GSYM Local_lemmas.SIN_AZIM_POS_PI_LT;Polar_fan.SIN_AZIM_MUTUAL_CROSS;DOT_RNEG;] +THEN SUBGOAL_THEN `((vv:num->real^3) (SUC x'), (vv:num->real^3) (SUC(SUC x'))) IN FF` ASSUME_TAC; +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`SUC x':num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; +REPLICATE_TAC (19-10)(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(vv:num->real^3) (SUC x'), (vv:num->real^3) (SUC(SUC x'))`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_DETERMINE_AZIM_IN_FA) +[`V:real^3->bool`;` (IMAGE (\i. vv i,(vv:num->real^3) (SUC i)) (:num))`;`IMAGE (\i. { (vv:num->real^3) i, vv (SUC i)}) (:num)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(vv:num->real^3) (SUC x'), (vv:num->real^3) (SUC(SUC x'))`]) +THEN ASM_SIMP_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`x':num `] +THEN MRESA_TAC th[`1*k+ x' `]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;GSYM ELEMENT2_SYM_0;GSYM Local_lemmas.SIN_AZIM_POS_PI_LT;Polar_fan.SIN_AZIM_MUTUAL_CROSS;DOT_RNEG;CROSS_RNEG;CROSS_LNEG;] +THEN REPEAT STRIP_TAC +THEN ONCE_REWRITE_TAC[CROSS_SKEW;] +THEN REWRITE_TAC[CROSS_TRIPLE;DOT_LNEG] +THEN ONCE_REWRITE_TAC[CROSS_TRIPLE;DOT_LNEG] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[wedge_in_fan_ge2] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM PAIR_FUN_SYM_0] +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[IMAGE;IN_ELIM_THM] +THEN REWRITE_TAC[EE_SYM_0] +THEN RESA_TAC +THEN ASM_SIMP_TAC[EE_SYM_0;EE_EXPAND_BB_VV] +THEN MRESAL_TAC (GEN_ALL EE_EXPAND_BB_VV)[`V:real^3->bool`;`FF:real^3#real^3->bool`;`s:scs_v39`;`E:(real^3->bool)->bool`;`vv:num->real^3`;`SUC x'`;`k:num`;] +[BBs_v39;PAIR_EQ;LET_DEF;LET_END_DEF;convex_local_fan;] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`SUC x' +k-1`] +THEN MRESA_TAC th[`x':num`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC(ARITH_RULE`~(k<=3) ==> SUC x' + k - 1= 1 *k + x'/\ ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`x':num`] +THEN ASM_SIMP_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;GSYM ELEMENT2_SYM_0] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_SIMP_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;GSYM ELEMENT2_SYM_0;GSYM Local_lemmas.SIN_AZIM_POS_PI_LT;Polar_fan.SIN_AZIM_MUTUAL_CROSS;DOT_RNEG;] +THEN SUBGOAL_THEN `((vv:num->real^3) (SUC x')) IN V` ASSUME_TAC; + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`SUC x':num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`x':num `] +THEN MRESA_TAC th[`1 *k +x'`]) +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_CARD_EE_V_1)[`FF:real^3#real^3->bool`;`V:real^3->bool`;`(vv:num->real^3) (SUC x')`;`E:(real^3->bool)->bool`;] +THEN MP_TAC Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.FAN_IMP_FINITE_EE)[`vec 0:real^3`;`V:real^3->bool`;`(vv:num->real^3) (SUC x')`;`E:(real^3->bool)->bool`;] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_SIMP_TAC[ELEMENT2_SYM_0;CARD_SYM_0;ARITH_RULE`2>1`] +THEN SUBGOAL_THEN `((vv:num->real^3) (SUC x'), (vv:num->real^3) (SUC(SUC x'))) IN FF` ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`SUC x':num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +REPLICATE_TAC (25-10)(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(vv:num->real^3) (SUC x'), (vv:num->real^3) (SUC(SUC x'))`]) +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;wedge_in_fan_ge2;ARITH_RULE`2>1`;wedge_ge;azim;SUBSET;IN_ELIM_THM;IMAGE] +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`collinear {(vec 0),(--(vv:num->real^3) (SUC x')),-- x''' }\/ ~(collinear {(vec 0),(--(vv:num->real^3) (SUC x')),-- x''' })`) +THEN RESA_TAC; + +ASM_SIMP_TAC[AZIM_DEGENERATE;azim]; + +MRESAL_TAC (GEN_ALL VEC0_NOT_COLLINEAR_SYM_0)[`{--(vv:num->real^3) (SUC x'), --x'''}`][ELEMENT2_SYM_0;REFL_SYM_0] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[GSYM ELEMENT2_SYM_0;SET_RULE`{A} UNION {B,C}={A,B,C}`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`collinear {(vec 0),(--(vv:num->real^3) (SUC x')),(--vv (1 * k + x')) }\/ ~(collinear {(vec 0),(--(vv:num->real^3) (SUC x')),(--vv (1 * k + x')) })`) +THEN RESA_TAC; + +ASM_SIMP_TAC[AZIM_DEGENERATE;azim;] +THEN REAL_ARITH_TAC; + +MRESAL_TAC (GEN_ALL VEC0_NOT_COLLINEAR_SYM_0)[`{--(vv:num->real^3) (SUC x'), (--vv (1 * k + x'))}`][ELEMENT2_SYM_0;REFL_SYM_0] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[GSYM ELEMENT2_SYM_0;SET_RULE`{A} UNION {B,C}={A,B,C}`] +THEN STRIP_TAC +THEN REPLICATE_TAC (32-26)(POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`x''':real^3`]) +THEN ASM_SIMP_TAC[AZIM_NEG] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(vv:num->real^3) (SUC x'), (vv:num->real^3) (SUC (SUC x'))`] +THEN ASM_SIMP_TAC[AZIM_NEG] +THEN MRESA_TAC Fan.sum4_azim_fan[`vec 0:real^3`;`(vv:num->real^3) (SUC x')`;`(vv:num->real^3) (SUC(SUC x'))`;`x''':real^3`;`(vv:num->real^3) (x')`] +THEN REWRITE_TAC[REAL_ARITH`a<=b+a<=> &0<=b`;azim]]);; + + + +let PEROPP_IN_BB_SYM_0=prove_by_refinement(`scs_k_v39 s=k /\ is_scs_v39 s /\ BBs_v39 s vv /\ ~(k<=3) +==> BBs_v39 (scs_opp_v39 s) (\i. -- peropp vv k i)`, +[REPEAT GEN_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;scs_opp_v39;PAIR_EQ;LET_DEF;LET_END_DEF;BBs_v39;scs_v39_explicit;peropp2;peropp;is_scs_v39] +THEN STRIP_TAC +THEN ASM_TAC +THEN REPEAT RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)/\ 1real^3`] +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[SYM th] +THEN REPEAT STRIP_TAC) +THEN REPLICATE_TAC (29-21)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT DISCH_TAC +THEN MP_TAC th) +THEN MATCH_MP_TAC(SET_RULE`a IN A ==> (A SUBSET B==> a IN B)`) +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num) IN (:num)`]; + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`]; + +ASM_SIMP_TAC[DIST_SYM_0]; + +ASM_SIMP_TAC[DIST_SYM_0]; + +MRESA_TAC (GEN_ALL CONVEX_LOCAL_FAN_SYM_0)[`IMAGE (vv:num->real^3) (:num)`;`IMAGE (\i. {(vv:num->real^3) i, vv (SUC i)}) (:num)`;`IMAGE (\i. (vv:num->real^3) i,vv (SUC i)) (:num)`;`s:scs_v39`;`(vv:num->real^3)`;`k:num`] +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_REWRITE_TAC[scs_arrow_v39;IN_SING;scs_opp_v39;PAIR_EQ;LET_DEF;LET_END_DEF;BBs_v39;scs_v39_explicit;peropp2;peropp;is_scs_v39]]);; + + + + + +let NO_IS_EAR=prove(`~(scs_k_v39 s<=3)==> ~(is_ear_v39 s)`, +REWRITE_TAC[is_ear_v39] +THEN ARITH_TAC);; + +let NO_IS_EAR_SCS_OPP=prove(`~(scs_k_v39 s<=3)==> ~(is_ear_v39 (scs_opp_v39 s))`, +REWRITE_TAC[is_ear_v39;LET_DEF;LET_END_DEF;scs_opp_v39;scs_v39_explicit] +THEN ARITH_TAC);; + + + +let DSV_EQ_SYM_0=prove_by_refinement(`scs_k_v39 s=k /\ is_scs_v39 s /\ BBs_v39 s vv /\ ~(k<=3) +==> dsv_v39 (scs_opp_v39 s) (\i. --peropp vv k i) = dsv_v39 s vv`, +[STRIP_TAC +THEN ASM_SIMP_TAC[dsv_v39;NO_IS_EAR_SCS_OPP;NO_IS_EAR;LET_DEF;LET_END_DEF;scs_opp_v39;scs_v39_explicit;peropp2;DIST_SYM_0;peropp] +THEN MATCH_MP_TAC(REAL_ARITH`a=b==> c+ #0.1 * -- &1 *a= c+ #0.1 * -- &1 *b`) +THEN MATCH_MP_TAC SUM_EQ_GENERAL +THEN EXISTS_TAC`(\j. k - SUC(SUC(j MOD k) MOD k))` +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT RESA_TAC; + +REWRITE_TAC[EXISTS_UNIQUE] +THEN MP_TAC(ARITH_RULE`~(k<=3)==> k-1 y=k-1\/ SUC y +REPEAT DISCH_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[is_scs_v39;periodic2] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`scs_J_v39 s (k-1)`][ARITH_RULE`~(3=0)`;periodic] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`]) +THEN REMOVE_ASSUM_TAC +THEN MRESA_TAC DIVISION[`SUC(y' MOD k)`;`k:num`] +THEN MP_TAC(ARITH_RULE`SUC (y' MOD k) MOD k < k /\ 1 SUC (y' MOD k) MOD k = 0`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`~(k<=3)==> 1+k-1=k`) +THEN RESA_TAC +THEN MRESAL_TAC Hdplygy.MOD_EQ_MOD[`y' MOD k`;`k-1`;`1`;`k:num`][GSYM ADD1;ARITH_RULE`1+A=A+1`] +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC MOD_LT[`y':num`;`k:num`]; + +EXISTS_TAC`k- SUC(SUC y)` +THEN MP_TAC(ARITH_RULE`SUC y k - SUC (SUC y) < k/\ SUC (k - SUC (SUC y))= k - SUC y/\ k - SUC y y'=k-1\/ SUC y' ~(k-1=y)`) +THEN RESA_TAC; + +MRESA_TAC MOD_LT[`SUC y':num`;`k:num`] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`SUC y' y' = k - SUC (SUC y)`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE`~(k<=3)==> k-1 k-1 k-1 +REPEAT DISCH_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`xx=k-1\/ SUC x MRESA_TAC th[`k:num`]); + +MRESA_TAC MOD_LT[`SUC x`;`k:num`]; + +MP_TAC(ARITH_RULE`~(k<=3)==> k-1 k-1x=k-1\/ SUC xreal^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`]) +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[DIST_SYM] +THEN REWRITE_TAC[]; + +MRESA_TAC MOD_LT[`SUC x`;`k:num`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[DIST_SYM] +THEN REWRITE_TAC[]]);; + + + +let SUM_PAIR_SYM_0=prove(`sum (IMAGE (\(x,y):real^N#real^N. --x,--y) s) f= sum s (f o ((\(x,y). --x,--y)))`, +MATCH_MP_TAC SUM_IMAGE +THEN REPEAT GEN_TAC +THEN MP_TAC(SET_RULE`x=(FST (x:real^N#real^N),SND (x:real^N#real^N))`) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN MP_TAC(SET_RULE`y=(FST (y:real^N#real^N),SND (y:real^N#real^N))`) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN ASM_SIMP_TAC[VECTOR_ARITH`(--a= --b)<=> (a=b:real^N)`;PAIR_EQ] +THEN ASM_REWRITE_TAC[GSYM PAIR_EQ] +THEN RESA_TAC);; + + + +let TAUSTAR_EQ_SYM_0=prove_by_refinement(`scs_k_v39 s=k /\ is_scs_v39 s /\ BBs_v39 s vv /\ ~(k<=3) +==> taustar_v39 (scs_opp_v39 s) (\i. --peropp vv k i) = taustar_v39 s vv`, +[STRIP_TAC +THEN MP_TAC DSV_EQ_SYM_0 +THEN RESA_TAC +THEN +ASM_REWRITE_TAC[taustar_v39;LET_DEF;LET_END_DEF;scs_opp_v39;scs_v39_explicit] +THEN MATCH_MP_TAC (REAL_ARITH`C=A==>A-B=C-B`) +THEN MP_TAC(ARITH_RULE`~(k<=3)==> 3<=k/\ 1real^3) (SUC i)) (:num)`;`IMAGE (vv:num->real^3) (:num)`;` + IMAGE (\i. {(vv:num->real^3) i, vv (SUC i)}) (:num)`;] +THEN MRESA_TAC (GEN_ALL Wrgcvdr_cizmrrh.LOCAL_FAN_FINITE_FF)[`IMAGE (vv:num->real^3) (:num)`;` + IMAGE (\i. {(vv:num->real^3) i, vv (SUC i)}) (:num)`;` IMAGE (\i. vv i,(vv:num->real^3) (SUC i)) (:num)`] +THEN MRESA_TAC (GEN_ALL Wrgcvdr_cizmrrh.LOCAL_IMP_FINITE_DARTS) +[` IMAGE (\i. vv i,(vv:num->real^3) (SUC i)) (:num)`;` + IMAGE (\i. {(vv:num->real^3) i, vv (SUC i)}) (:num)`;`IMAGE (vv:num->real^3) (:num)`] +THEN MRESA_TAC(GEN_ALL DART_OF_HYP_VV)[`vv:num->real^3`] +THEN ASSUME_TAC(SET_RULE`IMAGE (\i. vv (SUC i),vv i) (:num) SUBSET + IMAGE (\i. vv i,vv (SUC i)) (:num) UNION + IMAGE (\i. vv (SUC i),(vv:num->real^3) i) (:num)`) +THEN MRESA_TAC(FINITE_SUBSET)[`IMAGE (\i. (vv:num->real^3) (SUC i),vv i) (:num)`;`darts_of_hyp (IMAGE (\i. {vv i, (vv:num->real^3) (SUC i)}) (:num)) (IMAGE vv (:num))`] +THEN ASM_SIMP_TAC[CARD_PAIR_SYM_0;CARD_EQUI_FF_SYM_0] +THEN MATCH_MP_TAC (REAL_ARITH`A=C==>A-B=C-B`) +THEN ASM_SIMP_TAC[SUM_PAIR_SYM_0;o_DEF;FST_SND_PAIR_SYM_0] +THEN MRESA_TAC(GEN_ALL Qknvmlb.SUM_AZIM_EQ_ANGLE_LE4)[`IMAGE (vv:num->real^3) (:num)`;`vv:num->real^3`;`1:num`;`s:scs_v39`;`(vv:num->real^3) (1 MOD scs_k_v39 s)`;` IMAGE (\i. vv i,(vv:num->real^3) (SUC i)) (:num)`;` + IMAGE (\i. {(vv:num->real^3) i, vv (SUC i)}) (:num)`] +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[BBs_v39;PAIR_EQ;LET_DEF;LET_END_DEF;] +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MATCH_MP_TAC SUM_EQ_GENERAL +THEN ASM_REWRITE_TAC[IN_ELIM_THM;] +THEN MP_TAC(ARITH_RULE`~(k<=3)==> SUC(k-1)=k/\ SUC(SUC(k-1))=k+1/\ SUC 0=1/\ ~(k=0)/\ 1 * k + 0=k/\ 1 * k + 1=k+1/\1real^3) (SUC i),vv i)` +THEN RESA_TAC; + +REWRITE_TAC[IN_ELIM_THM;IMAGE;EXISTS_UNIQUE] +THEN REPEAT RESA_TAC +THEN EXISTS_TAC`x MOD k` +THEN ASM_REWRITE_TAC[] +THEN MRESA_TAC DIVISION[`x:num`;`k:num`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`x:num`] +THEN MRESA_TAC th[`SUC x:num`] +THEN MRESA_TAC th[`SUC(x MOD k):num`]) +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[MOD_SUC_MOD;PAIR_EQ] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_INJ)[`s:scs_v39`;`k:num`;`vv:num->real^3`] +[BBs_v39;PAIR_EQ;LET_DEF;LET_END_DEF;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`y':num`;`x MOD k`]); + +REPEAT RESA_TAC; + +REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`x:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +REWRITE_TAC[ADD1;NORM_NEG;REAL_EQ_MUL_LCANCEL] +THEN MATCH_MP_TAC(SET_RULE`A==> C\/A`) +THEN REWRITE_TAC[GSYM ADD1] +THEN ABBREV_TAC`V= IMAGE (vv:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(vv:num->real^3) i, vv (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((vv:num->real^3) i, vv (SUC i))) (:num)` +THEN MP_TAC LOCAL_FAN_DUAL_SYM_0 +THEN ASM_TAC +THEN REWRITE_TAC[BBs_v39;PAIR_EQ;LET_DEF;LET_END_DEF;] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[OPP_IMAGE_F_EQ_NEG;OPP_IMAGE_E_EQ_NEG;OPP_IMAGE_V_EQ_NEG;OPP_IMAGE_E_EQ;OPP_IMAGE_F_EQ2] +THEN ASM_SIMP_TAC[PAIR_FUN_SYM_0;IMAGE_E_SYM_0;IMAGE_V_SYM_0;OPP_IMAGE_E_EQ;OPP_IMAGE_F_EQ2] +THEN STRIP_TAC +THEN SUBGOAL_THEN`(--vv (SUC x),--vv x) IN IMAGE (\(x,y). --x,--y) (IMAGE (\i. vv (SUC i),(vv:num->real^3) i) (:num))`ASSUME_TAC; + +REWRITE_TAC[GSYM PAIR_FUN_SYM_0] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`x:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +MRESA_TAC (GEN_ALL Local_lemmas.LOFA_DETERMINE_AZIM_IN_FA) +[`IMAGE (\x:real^3. --x) (IMAGE vv (:num))`;`IMAGE (\(x,y):real^3#real^3. --x,--y) (IMAGE (\i. vv (SUC i),vv i) (:num))`;`IMAGE (\i. {-- (vv:num->real^3) i, --vv (SUC i)}) (:num)`] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(--vv (SUC x),--(vv:num->real^3) x)`]) +THEN ASM_SIMP_TAC[EE_SYM_0;EE_EXPAND_BB_VV] +THEN MRESAL_TAC (GEN_ALL EE_EXPAND_BB_VV)[`V:real^3->bool`;`FF:real^3#real^3->bool`;`s:scs_v39`;`E:(real^3->bool)->bool`;`vv:num->real^3`;`SUC x`;`k:num`;] +[BBs_v39;PAIR_EQ;LET_DEF;LET_END_DEF;] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`SUC x +k-1`] +THEN MRESA_TAC th[`x:num`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MP_TAC(ARITH_RULE`~(k<=3) ==> SUC x + k - 1= 1 *k + x/\ ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`x:num`] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_SIMP_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET;GSYM ELEMENT2_SYM_0] +THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME)[`IMAGE (vv:num->real^3) (:num)`;`IMAGE (\i. {(vv:num->real^3) i, vv (SUC i)}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. vv i,(vv:num->real^3) (SUC i)) (:num)`;`(vv:num->real^3) (1 MOD k)`;`vv:num->real^3`;`1 MOD k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;GSYM ADD1] +THEN SUBGOAL_THEN`(vv:num->real^3) (SUC x) IN V`ASSUME_TAC; + +EXPAND_TAC"V" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`SUC x:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +MP_TAC Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM_IVS +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(vv:num->real^3) (SUC x)`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`SUC x `]) +THEN MRESAL_TAC(GEN_ALL CARD_V_EQ_SCS_K1)[`s:scs_v39`;`vv:num->real^3`;`IMAGE (vv:num->real^3) (:num)`;`k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39] +THEN MP_TAC Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1 +THEN RESA_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`(vv:num->real^3) (SUC x)`]) +THEN MRESAL_TAC (GEN_ALL Qknvmlb.VV_SUC_EQ_RHO_NODE_PRIME)[`IMAGE (vv:num->real^3) (:num)`;`IMAGE (\i. {(vv:num->real^3) i, vv (SUC i)}) (:num)`;`k:num`;`s:scs_v39`;`IMAGE (\i. vv i,(vv:num->real^3) (SUC i)) (:num)`;`(vv:num->real^3) (SUC x MOD k)`;`vv:num->real^3`;`SUC x MOD k:num`][MMs_v39;LET_DEF;LET_END_DEF;BBprime2_v39;BBs_v39;GSYM ADD1] +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`SUC 0`][ITER] +THEN MRESAL_TAC th[`k - 1`][ITER;ARITH_RULE`1+A=SUC A`]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> +MRESA_TAC th[`x:num`] +THEN MRESA_TAC th[`SUC (SUC x )`] +THEN MRESA_TAC th[`SUC (SUC x MOD k) `] +THEN MRESA_TAC th[`k-1+ (SUC x MOD k) `]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[MOD_SUC_MOD] +THEN MP_TAC(ARITH_RULE`3 k-1real^3) (SUC x),vv (SUC (SUC x)) IN FF`ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`SUC x:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(vv:num->real^3) (SUC x), (vv:num->real^3) (SUC (SUC x))`] +THEN SUBGOAL_THEN`(vv:num->real^3) ( x),vv ( (SUC x)) IN FF`ASSUME_TAC; + +EXPAND_TAC"FF" +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`x:num` +THEN ASM_REWRITE_TAC[SET_RULE`(a:num)IN(:num)`]; + +ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR)[`V:real^3->bool`;`E:(real^3->bool)->bool`;`FF:real^3#real^3->bool`;`(vv:num->real^3) (x), (vv:num->real^3) ( (SUC x))`]]);; + + + + + + + + +let OPP_IS_SCS=prove_by_refinement( `is_scs_v39 s/\ s' = scs_opp_v39 s==> is_scs_v39 (scs_opp_v39 s)`, +[ +ABBREV_TAC`k=scs_k_v39 s` +THEN ASM_TAC +THEN REWRITE_TAC[scs_v39_explicit;scs_opp_v39;LET_DEF;LET_END_DEF;is_scs_v39;peropp] +THEN RESA_TAC +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<=k==> ~(k=0)`) +THEN RESA_TAC +THEN REPEAT RESA_TAC; + + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +; + + + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +; + + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +; + + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +; + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;periodic2;peropp2;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`j:num`][ARITH_RULE`1*k+i=i+k`] +; + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;periodic2;peropp2;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`j:num`][ARITH_RULE`1*k+i=i+k`] +; + + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;periodic2;peropp2;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`j:num`][ARITH_RULE`1*k+i=i+k`] +; + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;periodic2;peropp2;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`j:num`][ARITH_RULE`1*k+i=i+k`] +; + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;periodic2;peropp2;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`j:num`][ARITH_RULE`1*k+i=i+k`] +; + + + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;periodic2;peropp2;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`j:num`][ARITH_RULE`1*k+i=i+k`] +; + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;periodic2;peropp2;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`j:num`][ARITH_RULE`1*k+i=i+k`] +; + + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;periodic2;peropp2;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`j:num`][ARITH_RULE`1*k+i=i+k`] +; + + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;periodic2;peropp2;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`j:num`][ARITH_RULE`1*k+i=i+k`] +; + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;periodic2;peropp2;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`j:num`][ARITH_RULE`1*k+i=i+k`] +; + + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;periodic2;peropp2;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`j:num`][ARITH_RULE`1*k+i=i+k`] +; + + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;periodic2;peropp2;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`j:num`][ARITH_RULE`1*k+i=i+k`] +; + + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;periodic2;peropp2;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`j:num`][ARITH_RULE`1*k+i=i+k`] +; + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;periodic2;peropp2;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`j:num`][ARITH_RULE`1*k+i=i+k`] +; + + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;periodic2;peropp2;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`j:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN MRESA_TAC MOD_LT[`j:num`;`k:num`] +THEN MRESA_TAC SUC_INJ[`i:num`;`j:num`] +THEN MP_TAC(ARITH_RULE`i < k/\ j k- SUC i i MOD 3=0\/ i MOD 3=1\/ i MOD 3=2`) +THEN RESA_TAC; + + + +MRESAL_TAC (GEN_ALL Zithlqn.IMP_SUC_MOD_EQ)[`i:num`;`0:num`;`3`][ARITH_3_TAC] +THEN REPLICATE_TAC (29-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th`1:num`[ARITH_3_TAC]) +; + + +MRESAL_TAC (GEN_ALL Zithlqn.IMP_SUC_MOD_EQ)[`i:num`;`1:num`;`3`][ARITH_3_TAC] +THEN REPLICATE_TAC (29-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th`0:num`[ARITH_3_TAC]) +; + + +MRESAL_TAC (GEN_ALL Zithlqn.IMP_SUC_MOD_EQ)[`i:num`;`2:num`;`3`][ARITH_3_TAC] +THEN REPLICATE_TAC (29-16)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th`2:num`[ARITH_3_TAC]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (29-22)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> +ASM_TAC +THEN REWRITE_TAC[th] +THEN ASSUME_TAC th +THEN REPEAT STRIP_TAC) +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s 2`][ARITH_3_TAC;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`3:num`[ARITH_3_TAC]) + +; + + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;periodic2;peropp2;] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`j:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD k i MOD k= k-1 \/ i MOD k k- SUC(k-1)=0/\ 1 ASM_REWRITE_TAC[SYM th]) +THEN ASM_TAC +THEN REWRITE_TAC[periodic2] +THEN REPEAT RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_b_v39 s (k-1)`][ARITH_3_TAC;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`k:num`[ARITH_3_TAC]) +THEN REPLICATE_TAC (37-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th`k-1:num`[ARITH_3_TAC]) +; + + +MP_TAC(ARITH_RULE`3 k- SUC(k-1)=0/\ 1 ASM_REWRITE_TAC[SYM th]) +THEN REPLICATE_TAC (38-17)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th`(k - ((i MOD k + 1) + 1)):num`[ARITH_3_TAC]) +; + + + + + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;periodic2;peropp2;] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`j:num`][ARITH_RULE`1*k+i=i+k`] +THEN STRIP_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC DIVISION[`j:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`3<=k/\ i MOD k SUC (k - SUC (i MOD k)) = (k - (i MOD k))/\ k- SUC(i MOD k) REPEAT STRIP_TAC +THEN MRESAL_TAC th[`k - SUC (i MOD k):num`;`(k - SUC (j MOD k))`][ARITH_3_TAC]) +; + +POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`i MOD k< k==> i MOD k=0 \/ k-i MOD k j MOD k= k-1 /\ k-1 i MOD k = SUC (j MOD k)/\ (j MOD k) +1 SUC(k- SUC(j MOD k))= k -j MOD k`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`j MOD k< k==> j MOD k=0 \/ k-j MOD k i MOD k= k-1 /\ k-1 j MOD k = SUC (i MOD k)/\ (i MOD k) +1 REPEAT STRIP_TAC +THEN MRESAL_TAC th[`k - SUC (i MOD k):num`;`(k - SUC (j MOD k))`][ARITH_3_TAC]) +; + + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;periodic2;peropp2;] +THEN REPEAT DISCH_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`j:num`][ARITH_RULE`1*k+i=i+k`] +THEN STRIP_TAC +THEN REPLICATE_TAC (25-19)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL_TAC th[`k - SUC (i MOD k):num`;`(k - SUC (j MOD k))`][ARITH_3_TAC]) +; + + + + +ASM_TAC +THEN REWRITE_TAC[periodic;peropp;periodic2;peropp2;] +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`i:num`][ARITH_RULE`1*k+i=i+k`] +THEN MRESAL_TAC MOD_MULT_ADD[`1:num`;`k:num`;`j:num`][ARITH_RULE`1*k+i=i+k`] +THEN SUBGOAL_THEN` +CARD + {i | i < k /\ + (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i))} +=CARD + {i | i < k /\ + (&2 * h0 < scs_b_v39 s (k - SUC (i MOD k)) (k - SUC (SUC i MOD k)) \/ + &2 < scs_a_v39 s (k - SUC (i MOD k)) (k - SUC (SUC i MOD k)))} +` +ASSUME_TAC +; + + + +MATCH_MP_TAC CARD_IMAGE_INJ_EQ +THEN REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`(\x. k - SUC (SUC x MOD k))` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_NUMSEG;IN_ELIM_THM] +THEN ARITH_TAC; + +STRIP_TAC; + + +GEN_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC MOD_LT[`x:num`;`k:num`] +THEN MRESA_TAC DIVISION[`SUC x`;`k:num`] +THEN MP_TAC(ARITH_RULE`3<=k /\ SUC x MOD k < k ==> k - SUC(SUC x MOD k ) MRESAL1_TAC th`k:num`[ARITH_3_TAC]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (k-1)`][ARITH_3_TAC;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`k:num`[ARITH_3_TAC]) +THEN MP_TAC(ARITH_RULE`x SUC x=k \/ SUC x y=k-1\/ y< k-1`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE`3<=k==> k-1 MRESAL1_TAC th`k:num`[ARITH_3_TAC]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC DIVISION[`SUC y':num`;`k:num`] +THEN MP_TAC(ARITH_RULE`SUC y' MOD k< k /\ k - SUC (SUC y' MOD k) = k - 1 ==> SUC y' MOD k=0`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`y' SUC y' k-y-2 SUC y' y'= k-y-2`) +THEN RESA_TAC; + + +MP_TAC(ARITH_RULE`3<=k/\ y< k-1 ==>SUC(k-1)=k/\ ~(k-1=y)`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`A*1=A/\ k-0=k /\ SUC 0=1/\ k-k=0`] +; + + +MRESAL_TAC MOD_LT[`SUC y':num`;`k:num`][ARITH_RULE`~(SUC a=0)`] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`k - y - 2 < k/\ k - SUC (SUC y') = y/\ SUC y' y'= k-y-2`) +THEN RESA_TAC; + + +MP_TAC(ARITH_RULE`3<=k/\ y< k-1 ==>SUC(k-1)=k/\ ~(k-1=y)`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`A*1=A/\ k-0=k /\ SUC 0=1/\ k-k=0`] +; + + + +POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`y y=k-1\/ y< k-1`) +THEN RESA_TAC; + +MP_TAC(ARITH_RULE`3<=k==> k-1 MRESAL1_TAC th`k:num`[ARITH_3_TAC]) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC DIVISION[`SUC y':num`;`k:num`] +THEN MP_TAC(ARITH_RULE`SUC y' MOD k< k /\ k - SUC (SUC y' MOD k) = k - 1 ==> SUC y' MOD k=0`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`y' SUC y' k-y-2 SUC y' y'= k-y-2`) +THEN RESA_TAC; + + +MP_TAC(ARITH_RULE`3<=k/\ y< k-1 ==>SUC(k-1)=k/\ ~(k-1=y)`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`A*1=A/\ k-0=k /\ SUC 0=1/\ k-k=0`] +; + + +MRESAL_TAC MOD_LT[`SUC y':num`;`k:num`][ARITH_RULE`~(SUC a=0)`] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`k - y - 2 < k/\ k - SUC (SUC y') = y/\ SUC y' y'= k-y-2`) +THEN RESA_TAC; + + +MP_TAC(ARITH_RULE`3<=k/\ y< k-1 ==>SUC(k-1)=k/\ ~(k-1=y)`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`A*1=A/\ k-0=k /\ SUC 0=1/\ k-k=0`] +; + +POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +; + + + +]);; + + +let DUAL_PEROPP=prove(`~(k=0) /\ periodic a k==> peropp (peropp a k) k=a`, +STRIP_TAC +THEN ASM_SIMP_TAC[FUN_EQ_THM;peropp;OPP_SUC_MOD;PERIODIC_PROPERTY]);; + + +let DUAL_PEROPP2=prove(`~(k=0) /\ periodic2 a k==> peropp2 (peropp2 a k) k=a`, +REWRITE_TAC[periodic2] +THEN STRIP_TAC +THEN ASM_SIMP_TAC[FUN_EQ_THM;peropp2;OPP_SUC_MOD;PERIODIC_PROPERTY;periodic]);; + + +let SCS_OPP_REFL=prove(`is_scs_v39 s +==> (scs_opp_v39 ((scs_opp_v39 s)))=s`, +SIMP_TAC[scs_opp_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;scs_v39_explicit;peropp2;is_scs_v39;BBprime_v39;is_scs_v39;DUAL_PEROPP2;DUAL_PEROPP] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`3<= scs_k_v39 s==> ~(scs_k_v39 s=0)`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[scs_opp_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;scs_v39_explicit;peropp2;is_scs_v39;BBprime_v39;is_scs_v39;DUAL_PEROPP2;DUAL_PEROPP] +THEN POP_ASSUM(fun th-> REWRITE_TAC[th;scs_v39_explicit;scs_k_v39; +scs_d_v39;scs_a_v39 ; + scs_am_v39 ; + scs_bm_v39 ; + scs_b_v39 ; + scs_J_v39 ; + scs_lo_v39 ; + scs_hi_v39 ; + scs_str_v39; +scs_v39;Misc_defs_and_lemmas.part6;Misc_defs_and_lemmas.drop3;FST; +Misc_defs_and_lemmas.part1;Misc_defs_and_lemmas.drop1; +Misc_defs_and_lemmas.part2;Misc_defs_and_lemmas.drop2; +Misc_defs_and_lemmas.part3;Misc_defs_and_lemmas.drop3; +Misc_defs_and_lemmas.part4;Misc_defs_and_lemmas.drop0; +Misc_defs_and_lemmas.part5; +Misc_defs_and_lemmas.part7; +Misc_defs_and_lemmas.part8; +Misc_defs_and_lemmas.part0;]));; + + + + + + + +let K_SCS_OPP=prove(`scs_k_v39 (scs_opp_v39 s) = scs_k_v39 s`, +REWRITE_TAC[scs_v39_explicit;scs_opp_v39;LET_DEF;LET_END_DEF;is_scs_v39;peropp] +);; + + +let DUAL_NEG_PEROPP=prove(`~(k=0) /\ periodic ww k==>(\i. --peropp (\i. --peropp (ww:num->real^N) k i) k i)= ww`, +STRIP_TAC +THEN ASM_SIMP_TAC[FUN_EQ_THM;peropp;OPP_SUC_MOD;VECTOR_ARITH`-- -- A=A:real^N`] +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`ww:num->real^N`][ARITH_3_TAC;]);; + + + + + +let DUALNEG_PEROPP_BB=prove(`scs_k_v39 s=k /\BBs_v39 (scs_opp_v39 s) ww /\ ~(k<=3) +==> (\i. --peropp (\i. --peropp (ww:num->real^3) k i) k i)= ww`, +STRIP_TAC +THEN MATCH_MP_TAC DUAL_NEG_PEROPP +THEN ASM_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;scs_v39_explicit;peropp2;BBs_v39;scs_opp_v39] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC);; + + + +let BBPRIME_EQ_OPP_SYM_0=prove(`scs_k_v39 s=k /\ is_scs_v39 s /\ BBprime_v39 s vv /\ ~(k<=3) +==> BBprime_v39 (scs_opp_v39 s) (\i. -- peropp vv k i)`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC PEROPP_IN_BB_SYM_0 +THEN RESA_TAC +THEN MRESA_TAC(GEN_ALL OPP_IS_SCS)[`scs_opp_v39 s`;`s:scs_v39`] +THEN MP_TAC SCS_OPP_REFL +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;scs_v39_explicit;peropp2;BBprime_v39] +THEN REPEAT RESA_TAC +THENL[ +MRESAL_TAC (GEN_ALL PEROPP_IN_BB_SYM_0)[`scs_opp_v39 s`;`ww:num->real^3`;`k:num`][K_SCS_OPP;] +THEN MP_TAC TAUSTAR_EQ_SYM_0 +THEN RESA_TAC +THEN MP_TAC DUALNEG_PEROPP_BB +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL TAUSTAR_EQ_SYM_0)[`k:num`;`s:scs_v39`;`(\i. --peropp (ww:num->real^3) k i)`] +THEN REPLICATE_TAC (13-3)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESAL1_TAC th`(\i. --peropp (ww:num->real^3) k i)`[ARITH_3_TAC]); +MP_TAC TAUSTAR_EQ_SYM_0 +THEN RESA_TAC]);; + + + + +let BBINDEX_EQ_SYM_0=prove_by_refinement(`scs_k_v39 s=k /\ is_scs_v39 s /\ BBprime_v39 s vv /\ ~(k<=3) +==> +BBindex_v39 (scs_opp_v39 s) (\i. --peropp vv k i) = BBindex_v39 s vv`, +[ +STRIP_TAC +THEN ASM_REWRITE_TAC[BBindex_v39;scs_opp_v39;LET_DEF;LET_END_DEF;scs_v39_explicit;peropp2;peropp;DIST_SYM_0] +THEN MP_TAC(ARITH_RULE`~(k<=3)==> ~(k=0)`) +THEN RESA_TAC +THEN MATCH_MP_TAC CARD_IMAGE_INJ_EQ +THEN REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`(\x:num. (k - SUC(SUC (x MOD k)MOD k)))` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +MATCH_MP_TAC FINITE_SUBSET +THEN EXISTS_TAC`0..k` +THEN REWRITE_TAC[FINITE_NUMSEG;SUBSET;IN_NUMSEG;IN_ELIM_THM] +THEN ARITH_TAC; + +STRIP_TAC; + +GEN_TAC +THEN RESA_TAC; + +ASM_SIMP_TAC[OPP_SUC_MOD] +THEN MRESA_TAC MOD_LT[`x:num`;`k:num`] +THEN MRESA_TAC DIVISION[`SUC x:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`SUC x MOD k< k/\ ~(k<=3)==> k - SUC (SUC x MOD k) < k /\ SUC (k-1)=k/\ k-1 x=k-1\/ SUC x REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;is_scs_v39;LET_DEF;LET_END_DEF;BBprime_v39;BBs_v39] +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (k-1)`][ARITH_3_TAC;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`k:num`[ARITH_3_TAC]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_3_TAC;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`k:num`[ARITH_3_TAC]) +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REPLICATE_TAC (4)(POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[] +THEN REPEAT RESA_TAC; + +MRESA_TAC DIVISION[`SUC x:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`SUC x SUC (k - SUC (SUC x))= k- SUC x/\ k - SUC x k - SUC (SUC y MOD k) < k/\ SUC(k-1)=k/\ k-1 y=k-1\/ SUC y REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;is_scs_v39;LET_DEF;LET_END_DEF;BBprime_v39;BBs_v39] +THEN REPEAT DISCH_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`scs_a_v39 s (k-1)`][ARITH_3_TAC;periodic] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`k:num`[ARITH_3_TAC]) +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`scs_k_v39 s`;`vv:num->real^3`][ARITH_3_TAC;] +THEN POP_ASSUM (fun th-> MRESAL1_TAC th`k:num`[ARITH_3_TAC;]) +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN REPLICATE_TAC (4)(POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[] +THEN REPEAT RESA_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]); + +REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC MOD_LT[`y':num`;`k:num`] +THEN STRIP_TAC +THEN MRESA_TAC DIVISION[`SUC y':num`;`k:num`] +THEN MP_TAC(ARITH_RULE`SUC y' MOD k< k /\ k - SUC (SUC y' MOD k) = k - 1 ==> SUC y' MOD k=0`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`y' SUC y' k- SUC(SUC y) REPEAT STRIP_TAC +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[periodic2;is_scs_v39;LET_DEF;LET_END_DEF;BBprime_v39;BBs_v39] +THEN REPEAT RESA_TAC +THEN REPLICATE_TAC (3)(POP_ASSUM MP_TAC) +THEN MP_TAC(ARITH_RULE`y' SUC y' y'= k-SUC(SUC y)`) +THEN RESA_TAC; + +MRESA_TAC MOD_LT[`k-1`;`k:num`] +THEN MRESAL_TAC MOD_MULT[`k:num`;`1:num`][ARITH_RULE`A*1=A/\ k-0=k /\ SUC 0=1/\ k-k=0`] +THEN MP_TAC(ARITH_RULE`SUC y ~(k-1=y)`) +THEN RESA_TAC]);; + + +let IMAGE_BBINDEX_SYM_0=prove(`scs_k_v39 s=k /\ is_scs_v39 s /\ BBprime_v39 s vv /\ ~(k<=3) +==>(IMAGE (BBindex_v39 (scs_opp_v39 s)) (BBprime_v39 (scs_opp_v39 s))) = + (IMAGE (BBindex_v39 s) (BBprime_v39 s))`, +REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;EXTENSION] +THEN REWRITE_TAC[IN] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THENL[ +MRESA_TAC(GEN_ALL OPP_IS_SCS)[`scs_opp_v39 s`;`s:scs_v39`] +THEN MP_TAC SCS_OPP_REFL +THEN RESA_TAC +THEN MRESAL_TAC (GEN_ALL BBPRIME_EQ_OPP_SYM_0)[`scs_opp_v39 s`;`x':num->real^3`;`k:num`][K_SCS_OPP;] +THEN EXISTS_TAC`(\i. --peropp (x':num->real^3) k i)` +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[BBprime_v39;LET_DEF;LET_END_DEF;scs_v39_explicit;] +THEN REPEAT RESA_TAC +THEN MRESA_TAC(GEN_ALL DUALNEG_PEROPP_BB)[`s:scs_v39`;`k:num`;`x':num->real^3`] +THEN MRESAL_TAC (GEN_ALL BBINDEX_EQ_SYM_0)[`k:num`;`s:scs_v39`;`(\i. --peropp (x':num->real^3) k i)`][BBprime_v39;LET_DEF;LET_END_DEF;scs_v39_explicit;]; + +EXISTS_TAC`(\i. --peropp (x':num->real^3) k i)` +THEN MRESAL_TAC (GEN_ALL BBPRIME_EQ_OPP_SYM_0)[`s:scs_v39`;`x':num->real^3`;`k:num`][K_SCS_OPP;] +THEN MRESA_TAC (GEN_ALL BBINDEX_EQ_SYM_0)[`k:num`;`s:scs_v39`;`(x':num->real^3)`]]);; + + +let BBINDEX_MIN_SYM_0=prove(`scs_k_v39 s=k /\ is_scs_v39 s /\ BBprime_v39 s vv /\ ~(k<=3) +==> BBindex_min_v39 (scs_opp_v39 s) =BBindex_min_v39 (s)`, +STRIP_TAC +THEN ASM_REWRITE_TAC[BBindex_min_v39;LET_DEF;LET_END_DEF;scs_v39_explicit;peropp2;peropp;DIST_SYM_0] +THEN MP_TAC(ARITH_RULE`~(k<=3)==> ~(k=0)`) +THEN RESA_TAC +THEN MP_TAC IMAGE_BBINDEX_SYM_0 +THEN RESA_TAC);; + + + + +let BBPRIME2_SYM_0=prove(`scs_k_v39 s=k /\ is_scs_v39 s /\ BBprime2_v39 s vv /\ ~(k<=3) +==> BBprime2_v39 (scs_opp_v39 s) (\i. -- peropp vv k i)`, +STRIP_TAC +THEN MP_TAC BBPRIME_EQ_OPP_SYM_0 +THEN RESA_TAC +THEN MP_TAC BBINDEX_EQ_SYM_0 +THEN RESA_TAC +THEN MP_TAC BBINDEX_MIN_SYM_0 +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;scs_v39_explicit;peropp2;BBprime2_v39] +THEN REPEAT RESA_TAC) +;; + + +let MM_SCS_OPP=prove_by_refinement(`scs_k_v39 s=k /\ is_scs_v39 s /\ MMs_v39 s vv /\ ~(k<=3) +==> MMs_v39 (scs_opp_v39 s) (\i. -- peropp vv k i)`, +[ +STRIP_TAC +THEN MP_TAC BBPRIME2_SYM_0 +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;scs_v39_explicit;peropp2;MMs_v39;scs_opp_v39;peropp;AZIM_NEG;BBprime2_v39;BBprime_v39] +THEN REPEAT RESA_TAC +THEN ABBREV_TAC`V= IMAGE (vv:num->real^3) (:num)` +THEN ABBREV_TAC`E = IMAGE (\i. {(vv:num->real^3) i, vv (SUC i)}) (:num)` +THEN ABBREV_TAC`FF = IMAGE (\i. ((vv:num->real^3) i, vv (SUC i))) (:num)` +THEN MP_TAC LOCAL_FAN_DUAL_SYM_0 +THEN RESA_TAC; + +SUBGOAL_THEN`--(vv:num->real^3) (k - SUC (i MOD k)),--vv (k - SUC (SUC i MOD k)) IN + IMAGE (\i. --vv (k - SUC (i MOD k)),--vv (k - SUC (SUC i MOD k))) + (:num)` ASSUME_TAC; + +REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[SET_RULE`(i:num)IN(:num)`]; + +SUBGOAL_THEN`--vv (k - SUC ((i + k - 1) MOD k)),--vv (k - SUC (i MOD k)) IN + IMAGE (\i. --(vv:num->real^3) (k - SUC (i MOD k)),--vv (k - SUC (SUC i MOD k))) + (:num)`ASSUME_TAC; + +REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`i+k-1:num` +THEN ASM_REWRITE_TAC[SET_RULE`(i:num)IN(:num)`] +THEN MP_TAC(ARITH_RULE`~(k<=3)==> SUC(i+k-1)=1*k+i/\ ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`i:num`]; + +MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR) +[`IMAGE (\i. --(vv:num->real^3) (k - SUC (i MOD k))) (:num)`;` + IMAGE (\i. {--(vv:num->real^3) (k - SUC (i MOD k)), --vv (k - SUC (SUC i MOD k))}) + (:num)`;` + IMAGE (\i. --(vv:num->real^3) (k - SUC (i MOD k)),--vv (k - SUC (SUC i MOD k))) + (:num)`;`((--(vv:num->real^3) (k - SUC (i MOD k))) ,(--vv (k - SUC (SUC i MOD k))))`] +THEN MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IN_FF_NOT_COLLINEAR) +[`IMAGE (\i. --(vv:num->real^3) (k - SUC (i MOD k))) (:num)`;` + IMAGE (\i. {--(vv:num->real^3) (k - SUC (i MOD k)), --vv (k - SUC (SUC i MOD k))}) + (:num)`;` + IMAGE (\i. --(vv:num->real^3) (k - SUC (i MOD k)),--vv (k - SUC (SUC i MOD k))) + (:num)`;`((--vv (k - SUC ((i + k - 1) MOD k))), (--(vv:num->real^3) (k - SUC (i MOD k))) )`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN STRIP_TAC +THEN MRESAL_TAC(GEN_ALL VEC0_NOT_COLLINEAR_SYM_0)[`{--(vv:num->real^3) (k - SUC (i MOD k)), --vv (k - SUC (SUC i MOD k))}`][ELEMENT2_SYM_0;REFL_SYM_0] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM ELEMENT2_SYM_0] +THEN ASM_REWRITE_TAC[SET_RULE`{A} UNION {B,C}={A,B,C}`] +THEN MRESAL_TAC(GEN_ALL VEC0_NOT_COLLINEAR_SYM_0)[`{--(vv:num->real^3) (k - SUC (i MOD k)), --vv (k - SUC ((i + k - 1) MOD k))}`][ELEMENT2_SYM_0;REFL_SYM_0] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM ELEMENT2_SYM_0] +THEN ASM_REWRITE_TAC[SET_RULE`{A} UNION {B,C}={A,B,C}`] +THEN REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[AZIM_NEG] +THEN REPLICATE_TAC (26-6)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(k - SUC (i MOD k))`]) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`~(k<=3)==> SUC(i+k-1)=1*k+i/\ ~(k=0)/\ k-1 SUC (k - SUC (i MOD k))=k-i MOD k/\ (i MOD k + k - 1) + 1= 1*k + i MOD k`) +THEN RESA_TAC +THEN ASM_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;scs_v39_explicit;peropp2;MMs_v39;scs_opp_v39;peropp;AZIM_NEG;BBprime2_v39;BBprime_v39;BBs_v39] +THEN REPEAT RESA_TAC +THEN POP_ASSUM MP_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k:num`;`vv:num->real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k - SUC (i MOD k) + k - 1`] +THEN MRESA_TAC th[`k - SUC (SUC i MOD k)`]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ASM_SIMP_TAC[ADD1] +THEN MRESA_TAC MOD_LT[`1:num`;`k:num`] +THEN MRESA_TAC MOD_LT[`0:num`;`k:num`] +THEN MRESA_TAC MOD_LT[`k-1:num`;`k:num`] +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`k-1:num`;`k:num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_ADD_MOD[`i:num`;`1:num`;`k:num`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`0:num`] +THEN MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`k-2:num`] +THEN MP_TAC(ARITH_RULE`i MOD k=0 \/ 0real^3`][ARITH_RULE`~(3=0)`;] +THEN POP_ASSUM(fun th-> MRESA_TAC th[`k:num`]); + +MP_TAC(ARITH_RULE`0< i MOD k/\ ~(k<=3)/\ i MOD k i MOD k + k - 1= 1*k+ (i MOD k -1)/\ i MOD k-1 i MOD k=k-1\/ i MOD k +1k-1+1=k`) +THEN RESA_TAC; + +MRESA_TAC MOD_LT[`i MOD k +1`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD k +1 k - (i MOD k + 1) + k - 1= 1*k+(k - ((i MOD k + 1) + 1))`) +THEN RESA_TAC +THEN MRESA_TAC MOD_MULT_ADD[`1`;`k:num`;`k - ((i MOD k + 1) + 1)`]; + +ASM_REWRITE_TAC[NORM_NEG] +THEN REPLICATE_TAC (20-7)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(k - SUC (i MOD k))`]) ; + +ASM_REWRITE_TAC[NORM_NEG] +THEN REPLICATE_TAC (20-8)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(k - SUC (i MOD k))`]); + +ASM_REWRITE_TAC[DIST_SYM_0] +THEN REPLICATE_TAC (20-8)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(k - SUC (i MOD k))`]); + +ASM_REWRITE_TAC[DIST_SYM_0] +THEN REPLICATE_TAC (20-8)(POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA_TAC th[`(k - SUC (i MOD k))`])]) ;; + + + +let YXIONXL2=prove_by_refinement( `!s. + is_scs_v39 s /\ scs_k_v39 s=k /\ ~(k<=3) ==> scs_arrow_v39 {s} {scs_opp_v39 s}`, +[REPEAT GEN_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;subdiv_v39;PAIR_EQ;LET_DEF;LET_END_DEF;] +THEN REPEAT RESA_TAC; +MRESA_TAC(GEN_ALL OPP_IS_SCS)[`(scs_opp_v39 s)`;`s:scs_v39`]; + +DISJ_CASES_TAC(SET_RULE`(!s'. s' = s ==> MMs_v39 s' = {}) \/ ~((!s'. s' = s ==> MMs_v39 s' = {}))`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN EXISTS_TAC`scs_opp_v39 s` +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?vv. vv IN A`;IN] +THEN STRIP_TAC +THEN EXISTS_TAC`(\i. -- peropp (vv:num->real^3) k i)` +THEN ASM_SIMP_TAC[MM_SCS_OPP]]);; + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/ZITHLQN.hl b/text_formalization/local/ZITHLQN.hl new file mode 100644 index 0000000..6839f53 --- /dev/null +++ b/text_formalization/local/ZITHLQN.hl @@ -0,0 +1,3202 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Zithlqn = struct + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + +let s_init_J_empty= prove_by_refinement( +`!s. MEM s s_init_list_v39 ==> scs_J_v39 s = (\i j. F)`, + (* {{{ proof *) +[ +REWRITE_TAC[s_init_list_v39;JEJTVGB_assume_v39;GSYM IN_SET_OF_LIST;LET_DEF;LET_END_DEF;set_of_list; FORALL_IN_CLAUSES; +scs_J_v39_explicit;mk_unadorned_v39] +]);; + (* }}} *) + +let dsv_scs_init= prove_by_refinement( +` MEM s s_init_list_v39 ==> dsv_v39 s vv = scs_d_v39 s`, + (* {{{ proof *) +[ +SIMP_TAC[s_init_J_empty;dsv_J_empty] +]);; + (* }}} *) + + +let exists_point_in_V= prove_by_refinement( +` convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + 3 <= CARD V /\ CARD V <= 6 +==> ?v. v IN V`, + (* {{{ proof *) +[ +ONCE_REWRITE_TAC[SET_RULE`(?v. v IN V)<=> ~(V={})`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;CARD_CLAUSES]) +THEN ARITH_TAC +]);; + (* }}} *) + + + + + + +let exists_vv_FF= prove_by_refinement( +` convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + 3 <= CARD V /\ CARD V <= 6 +/\ v, w IN FF +==> ?vv. + vv 0=v /\ vv 1= w +/\ (!i. vv i= vv (i MOD (CARD V))) +/\ (! i j. vv i = vv j ==> i MOD CARD V = j MOD CARD V) +/\ V = IMAGE vv (:num) /\ E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) +/\ FF = IMAGE (\i. vv i,vv (SUC i)) (:num)`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN EXISTS_TAC`(\i:num. ITER i (rho_node1 FF) v)` +THEN REWRITE_TAC[IMAGE;] +THEN STRIP_TAC; + +REWRITE_TAC[ITER]; + +STRIP_TAC; + +REWRITE_TAC[ARITH_RULE`1= SUC 0`; ITER] +THEN MATCH_MP_TAC Local_lemmas.DETER_RHO_NODE +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;]; + +MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN +MRESA_TAC(GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V)[`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;`v:real^3`;`w:real^3`;`(V:real^3->bool)`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`!i. ITER i (rho_node1 FF) v = ITER (i MOD CARD (V:real^3->bool)) (rho_node1 FF) v` ASSUME_TAC; + +GEN_TAC +THEN REWRITE_TAC[GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN MP_TAC(ARITH_RULE`3<= CARD V==> ~(CARD (V:real^3->bool) = 0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION [`i:num`;`CARD (V:real^3->bool)`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[Hypermap.lemma_add_exponent_function;Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MP_TAC Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i MOD CARD (V:real^3->bool)`) +THEN MRESA_TAC (GEN_ALL Local_lemmas1.LOFA_IMP_ITER_RHO_NODE_ID2)[`(E:(real^3->bool)->bool)`;`(V:real^3->bool)`;`FF:real^3#real^3->bool`;`ITER (i MOD CARD (V:real^3->bool)) (rho_node1 FF) v`] +THEN MRESAL_TAC Hypermap.power_map_fix_point[`CARD (V:real^3->bool)`;`(rho_node1 FF)`;`ITER (i MOD CARD (V:real^3->bool)) (rho_node1 FF) v`][Wrgcvdr_cizmrrh.POWER_TO_ITER]; + +STRIP_TAC; + +POP_ASSUM MP_TAC +THEN SET_TAC[]; + +STRIP_TAC; + +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.LT_CARD_MONO_LOFA) +[`(E:(real^3->bool)->bool)`;`(V:real^3->bool)`;`FF:real^3#real^3->bool`;`v:real^3`] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i MOD CARD(V:real^3->bool)`;`j MOD CARD(V:real^3->bool)`]) +THEN POP_ASSUM MATCH_MP_TAC +THEN MP_TAC(ARITH_RULE`3<= CARD V==> ~(CARD (V:real^3->bool) = 0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION [`i:num`;`CARD (V:real^3->bool)`] +THEN MRESA_TAC DIVISION [`j:num`;`CARD (V:real^3->bool)`]; + +REMOVE_ASSUM_TAC +THEN SUBGOAL_THEN`V = {y | ?x. x IN (:num) /\ y = ITER x (rho_node1 FF) v}` ASSUME_TAC; + +REWRITE_TAC[EXTENSION] +THEN GEN_TAC +THEN EQ_TAC; + +REWRITE_TAC[IN_ELIM_THM] +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MP_TAC Local_lemmas.LOFA_IMP_LT_CARD_SET_V +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`n:num` +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]; + +REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC Local_lemmas.LOCAL_FAN_ORBIT_MAP_VITER +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v:real^3`;`x':num`]); + +ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +ONCE_REWRITE_TAC[EXTENSION] +THEN GEN_TAC +THEN EQ_TAC; + +STRIP_TAC +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MRESAL_TAC local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;][LET_DEF;LET_END_DEF] +THEN MRESA_TAC Topology.expand_edge_graph_fan[`vec 0:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`x:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +THEN POP_ASSUM(fun th -> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC (GEN_ALL Local_lemmas1.LOCAL_E_SUB_V)[`FF:real^3#real^3->bool`;`(E:(real^3->bool)->bool)`;`v':real^3`;`w:real^3`;`(V:real^3->bool)`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN `(w:real^3) IN EE v' E`ASSUME_TAC; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[EE;IN_ELIM_THM]; + +POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas1.LOCAL_E_SUB_V)[`FF:real^3#real^3->bool`;`(E:(real^3->bool)->bool)`;`v':real^3`;`w:real^3`;`(V:real^3->bool)`] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.LOFA_IMP_EE_TWO_ELMS_INS_ND) +[`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;`v':real^3`;] +THEN REWRITE_TAC[SET_RULE`A IN {B,C}<=> A=B\/ A=C`] +THEN STRIP_TAC; + +EXISTS_TAC`x:num` +THEN ASM_REWRITE_TAC[ITER]; + +MP_TAC(ARITH_RULE`x =0 \/ 0 ASM_TAC THEN REWRITE_TAC[th;ITER] THEN REPEAT STRIP_TAC) +THEN MP_TAC Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1 +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`) +THEN EXISTS_TAC`CARD (V:real^3->bool) -1` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC Tecoxbm.RHO_IVS_IDD +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN SET_TAC[]; + +SUBGOAL_THEN`(?x'. x = SUC x')` (fun th-> MP_TAC th THEN STRIP_TAC); + +EXISTS_TAC`x-1` +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +EXISTS_TAC`x'':num` +THEN ASM_REWRITE_TAC[ITER] +THEN MP_TAC Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th -> MRESA1_TAC th `x'':num`) +THEN MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_IDD) +[`(E:(real^3->bool)->bool)`;`(V:real^3->bool)`;`FF:real^3#real^3->bool`;`ITER x'' (rho_node1 FF) v:real^3`;] +THEN ASM_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN SET_TAC[]; + +REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MP_TAC Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th -> MRESA1_TAC th `x':num`) +THEN REWRITE_TAC[ITER] +THEN MRESA1_TAC Local_lemmas1.LOCAL_RHO_NODE_PAIR_E`ITER x' (rho_node1 FF) v`; + +ONCE_REWRITE_TAC[EXTENSION] +THEN GEN_TAC +THEN EQ_TAC; + +STRIP_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MP_TAC Local_lemmas.LOCAL_FAN_RHO_NODE_PROS +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x:real^3#real^3`) +THEN POP_ASSUM (fun th-> ASM_TAC THEN ONCE_REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V)[`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;`FST (x:real^3#real^3)`;`rho_node1 FF (FST (x:real^3#real^3))`;`(V:real^3->bool)`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[ITER] +THEN EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[]; + +REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MP_TAC Local_lemmas1.LOCAL_FAN_ORBIT_MAP_VITERFF +THEN ASM_REWRITE_TAC[ITER;ARITH_RULE`A+1= SUC A`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num`) +]);; + (* }}} *) + + + + + + + +let exists_vv= prove_by_refinement( +` convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + 3 <= CARD V /\ CARD V <= 6 +==> ?vv. (!i. vv i= vv (i MOD (CARD V))) +/\ (! i j. vv i = vv j ==> i MOD CARD V = j MOD CARD V) +/\ V = IMAGE vv (:num) /\ E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) +/\ FF = IMAGE (\i. vv i,vv (SUC i)) (:num)`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN MP_TAC exists_point_in_V +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN EXISTS_TAC`(\i:num. ITER i (rho_node1 FF) v)` +THEN REWRITE_TAC[IMAGE;] +THEN SUBGOAL_THEN`!i. ITER i (rho_node1 FF) v = ITER (i MOD CARD (V:real^3->bool)) (rho_node1 FF) v` ASSUME_TAC; + +GEN_TAC +THEN REWRITE_TAC[GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN MP_TAC(ARITH_RULE`3<= CARD V==> ~(CARD (V:real^3->bool) = 0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION [`i:num`;`CARD (V:real^3->bool)`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[Hypermap.lemma_add_exponent_function;Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MP_TAC Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V +THEN RESA_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`i MOD CARD (V:real^3->bool)`) +THEN MRESA_TAC (GEN_ALL Local_lemmas1.LOFA_IMP_ITER_RHO_NODE_ID2)[`(E:(real^3->bool)->bool)`;`(V:real^3->bool)`;`FF:real^3#real^3->bool`;`ITER (i MOD CARD (V:real^3->bool)) (rho_node1 FF) v`] +THEN MRESAL_TAC Hypermap.power_map_fix_point[`CARD (V:real^3->bool)`;`(rho_node1 FF)`;`ITER (i MOD CARD (V:real^3->bool)) (rho_node1 FF) v`][Wrgcvdr_cizmrrh.POWER_TO_ITER]; + +STRIP_TAC; + +POP_ASSUM MP_TAC +THEN SET_TAC[]; + +STRIP_TAC; + +POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.LT_CARD_MONO_LOFA) +[`(E:(real^3->bool)->bool)`;`(V:real^3->bool)`;`FF:real^3#real^3->bool`;`v:real^3`] +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i MOD CARD(V:real^3->bool)`;`j MOD CARD(V:real^3->bool)`]) +THEN POP_ASSUM MATCH_MP_TAC +THEN MP_TAC(ARITH_RULE`3<= CARD V==> ~(CARD (V:real^3->bool) = 0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION [`i:num`;`CARD (V:real^3->bool)`] +THEN MRESA_TAC DIVISION [`j:num`;`CARD (V:real^3->bool)`]; + +REMOVE_ASSUM_TAC +THEN SUBGOAL_THEN`V = {y | ?x. x IN (:num) /\ y = ITER x (rho_node1 FF) v}` ASSUME_TAC; + +REWRITE_TAC[EXTENSION] +THEN GEN_TAC +THEN EQ_TAC; + +REWRITE_TAC[IN_ELIM_THM] +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MP_TAC Local_lemmas.LOFA_IMP_LT_CARD_SET_V +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`) +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN EXISTS_TAC`n:num` +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]; + +REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC Local_lemmas.LOCAL_FAN_ORBIT_MAP_VITER +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA_TAC th[`v:real^3`;`x':num`]); + +ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +ONCE_REWRITE_TAC[EXTENSION] +THEN GEN_TAC +THEN EQ_TAC; + +STRIP_TAC +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MRESAL_TAC local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;][LET_DEF;LET_END_DEF] +THEN MRESA_TAC Topology.expand_edge_graph_fan[`vec 0:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`x:real^3->bool`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +THEN POP_ASSUM(fun th -> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC (GEN_ALL Local_lemmas1.LOCAL_E_SUB_V)[`FF:real^3#real^3->bool`;`(E:(real^3->bool)->bool)`;`v':real^3`;`w:real^3`;`(V:real^3->bool)`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN SUBGOAL_THEN `(w:real^3) IN EE v' E`ASSUME_TAC; + +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[EE;IN_ELIM_THM]; + +POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL Local_lemmas1.LOCAL_E_SUB_V)[`FF:real^3#real^3->bool`;`(E:(real^3->bool)->bool)`;`v':real^3`;`w:real^3`;`(V:real^3->bool)`] +THEN MRESA_TAC (GEN_ALL Local_lemmas1.LOFA_IMP_EE_TWO_ELMS_INS_ND) +[`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;`v':real^3`;] +THEN REWRITE_TAC[SET_RULE`A IN {B,C}<=> A=B\/ A=C`] +THEN STRIP_TAC; + +EXISTS_TAC`x:num` +THEN ASM_REWRITE_TAC[ITER]; + +MP_TAC(ARITH_RULE`x =0 \/ 0 ASM_TAC THEN REWRITE_TAC[th;ITER] THEN REPEAT STRIP_TAC) +THEN MP_TAC Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1 +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`) +THEN EXISTS_TAC`CARD (V:real^3->bool) -1` +THEN ASM_REWRITE_TAC[] +THEN MP_TAC Tecoxbm.RHO_IVS_IDD +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN SET_TAC[]; + +SUBGOAL_THEN`(?x'. x = SUC x')` (fun th-> MP_TAC th THEN STRIP_TAC); + +EXISTS_TAC`x-1` +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +EXISTS_TAC`x'':num` +THEN ASM_REWRITE_TAC[ITER] +THEN MP_TAC Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th -> MRESA1_TAC th `x'':num`) +THEN MRESA_TAC (GEN_ALL Local_lemmas.IVS_RHO_IDD) +[`(E:(real^3->bool)->bool)`;`(V:real^3->bool)`;`FF:real^3#real^3->bool`;`ITER x'' (rho_node1 FF) v:real^3`;] +THEN ASM_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN SET_TAC[]; + +REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MP_TAC Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th -> MRESA1_TAC th `x':num`) +THEN REWRITE_TAC[ITER] +THEN MRESA1_TAC Local_lemmas1.LOCAL_RHO_NODE_PAIR_E`ITER x' (rho_node1 FF) v`; + +ONCE_REWRITE_TAC[EXTENSION] +THEN GEN_TAC +THEN EQ_TAC; + +STRIP_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MP_TAC Local_lemmas.LOCAL_FAN_RHO_NODE_PROS +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x:real^3#real^3`) +THEN POP_ASSUM (fun th-> ASM_TAC THEN ONCE_REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V)[`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;`FST (x:real^3#real^3)`;`rho_node1 FF (FST (x:real^3#real^3))`;`(V:real^3->bool)`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[ITER] +THEN EXISTS_TAC`x':num` +THEN ASM_REWRITE_TAC[]; + +REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MP_TAC Local_lemmas1.LOCAL_FAN_ORBIT_MAP_VITERFF +THEN ASM_REWRITE_TAC[ITER;ARITH_RULE`A+1= SUC A`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`x':num`) +]);; + (* }}} *) + + + + +let SUC_MOD_NOT_EQ=prove_by_refinement( +`~(i MOD 3 = SUC i MOD 3)`, + (* {{{ proof *) +[ +REWRITE_TAC[ADD1] +THEN STRIP_TAC +THEN MRESAL_TAC DIVISION[`i:num`;`3`][ARITH_RULE`~(3=0)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"YEU") +THEN DISCH_THEN(LABEL_TAC"EM") +THEN MRESAL_TAC DIV_MONO[`i:num`;`i+1`;`3`][ARITH_RULE`~(3=0)/\ i<= i+1`] +THEN MRESAL_TAC DIVISION[`i+1:num`;`3`][ARITH_RULE`~(3=0)`] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`i DIV 3 <= (i + 1) DIV 3 ==> (i + 1) DIV 3 = i DIV 3 \/ i DIV 3 < (i + 1) DIV 3`) +THEN RESA_TAC; + +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN ARITH_TAC; + +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_THEN "YEU"(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[ARITH_RULE`(i DIV 3 * 3 + (i + 1) MOD 3) + 1 = (i + 1) DIV 3 * 3 + (i + 1) MOD 3 +<=> 1 = ((i + 1) DIV 3 - i DIV 3) * 3`] +THEN MP_TAC(ARITH_RULE`i DIV 3 < (i + 1) DIV 3 ==> 1<= ( (i + 1) DIV 3 -i DIV 3 )`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE` 1<= ( (i + 1) DIV 3 -i DIV 3 )==> 3<= ( (i + 1) DIV 3 -i DIV 3 ) *3`) +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC +]);; + (* }}} *) + + + + +let SUC_MOD_EQ1=prove_by_refinement( +`(SUC i MOD 3 = SUC j MOD 3) +/\ i<=j +==> +(i MOD 3 = j MOD 3) `, + (* {{{ proof *) +[ +REWRITE_TAC[ADD1] +THEN STRIP_TAC +THEN MRESAL_TAC DIVISION[`i+1:num`;`3`][ARITH_RULE`~(3=0)`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`i + 1 = (i + 1) DIV 3 * 3 + (j + 1) MOD 3 +<=> (j + 1) MOD 3= (i + 1) - ((i + 1) DIV 3 * 3) `] +THEN STRIP_TAC +THEN MRESAL_TAC DIVISION[`j+1:num`;`3`][ARITH_RULE`~(3=0)`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`j + 1 = (j + 1) DIV 3 * 3 + (i + 1) - (i + 1) DIV 3 * 3 <=> j+ (i + 1) DIV 3 * 3 = (j + 1) DIV 3 * 3 +i `] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`i<=j==> i+1<= j+1`) +THEN RESA_TAC +THEN MRESAL_TAC DIV_MONO[`i+1`;`j+1`;`3`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`j + (i + 1) DIV 3 * 3 = (j + 1) DIV 3 * 3 + i +/\ i<= j /\ (i + 1) DIV 3 <= (j + 1) DIV 3 +==> j -i = 3*((j + 1) DIV 3 - (i + 1) DIV 3) `) +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC DIV_MONO[`i:num`;`j:num`;`3`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC DIVISION[`i:num`;`3`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC DIVISION[`j:num`;`3`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`j = j DIV 3 * 3 + j MOD 3 +/\ i = i DIV 3 * 3 + i MOD 3 /\ i<= j/\ i DIV 3<= j DIV 3 +==> j-i = ((j DIV 3 - i DIV 3) * 3 + j MOD 3) -i MOD 3 `) +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESAL_TAC MOD_MULT[`3`;`(j + 1) DIV 3 - (i + 1) DIV 3`][ARITH_RULE`~(3=0)/\ (a*b=b*a)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ARITH_RULE`a*b=b*a`] +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MP_TAC(ARITH_RULE`i MOD 3 <=j MOD 3 \/ j MOD 3 < i MOD 3:num`) +THEN STRIP_TAC; + +MP_TAC(ARITH_RULE` +i MOD 3 <=j MOD 3 +==> +((j DIV 3 - i DIV 3) * 3 + j MOD 3) - i MOD 3 += (j DIV 3 - i DIV 3) * 3 + j MOD 3 - i MOD 3 +`) +THEN RESA_TAC +THEN MRESA_TAC MOD_MULT_ADD[`(j DIV 3 - i DIV 3)`;`3`;`j MOD 3 - i MOD 3`] +THEN MRESAL_TAC DIVISION[`i:num`;`3`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC DIVISION[`j:num`;`3`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`j MOD 3 < 3 /\ i MOD 3 <=j MOD 3 + ==> j MOD 3 - i MOD 3 < 3 `) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC MOD_LT[`j MOD 3 - i MOD 3`;`3`] +THEN ASM_TAC +THEN ARITH_TAC; + +MRESAL_TAC DIVISION[`i:num`;`3`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC DIVISION[`j:num`;`3`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`i MOD 3 < 3/\ j MOD 3< i MOD 3 + ==> (3+ j MOD 3) - i MOD 3 < 3 /\ 0< (3+ j MOD 3) - i MOD 3`) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`j DIV 3 - i DIV 3 =0 \/ 1<= j DIV 3 - i DIV 3:num`) +THEN STRIP_TAC; + +POP_ASSUM (fun th -> ASM_TAC THEN REWRITE_TAC[th;ARITH_RULE` (0 * 3 + j MOD 3) - i MOD 3= j MOD 3 - i MOD 3`]) +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`j MOD 3 < i MOD 3 +/\ j - i = j MOD 3 - i MOD 3 /\ i<= j ==> j=i `) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC; + +STRIP_TAC +THEN MP_TAC(ARITH_RULE`1 <= j DIV 3 - i DIV 3 /\ 0 < (3 + j MOD 3) - i MOD 3 +==> ((j DIV 3 - i DIV 3) * 3 + j MOD 3) - i MOD 3 +=((j DIV 3 - i DIV 3)-1) * 3 +(3+ j MOD 3) - i MOD 3`) +THEN RESA_TAC +THEN MRESA_TAC MOD_MULT_ADD[`(j DIV 3 - i DIV 3 -1)`;`3`;`(3+ j MOD 3) - i MOD 3`] +THEN MRESA_TAC MOD_LT[`(3+j MOD 3) - i MOD 3`;`3`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC +]);; + (* }}} *) + +let SUC_MOD_EQ=prove_by_refinement( +`(SUC i MOD 3 = SUC j MOD 3) +==> +(i MOD 3 = j MOD 3) `, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`i<=j\/ j<=i:num`) +THEN STRIP_TAC; + +MATCH_MP_TAC SUC_MOD_EQ1 +THEN ASM_REWRITE_TAC[]; + +MRESA_TAC (GEN_ALL SUC_MOD_EQ1)[`j:num`;`i:num`] +THEN ASM_REWRITE_TAC[] +]);; + (* }}} *) + + +let NOT_IMP_SUC_MOD_EQ=prove_by_refinement( +`~(i MOD 3 = j MOD 3) +==> ~(SUC i MOD 3 = SUC j MOD 3)`, +[SIMP_TAC[CONTRAPOS_THM;] +THEN REWRITE_TAC[SUC_MOD_EQ]]);; + + + +let IMP_SUC_MOD_EQ1=prove_by_refinement( +` ~(k=0) /\ (i MOD k = j MOD k) +/\ i<= j +==> (SUC i MOD k = SUC j MOD k)`, + (* {{{ proof *) +[ +REWRITE_TAC[ADD1] +THEN STRIP_TAC +THEN MRESAL_TAC DIVISION[`i:num`;`k:num`][ARITH_RULE`~(3=0)`] +THEN REMOVE_ASSUM_TAC +THEN MP_TAC(ARITH_RULE`i:num = i DIV k * k + j MOD k +==> j MOD k = i - (i DIV k * k) `) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN ASSUME_TAC th) +THEN RESA_TAC +THEN MRESAL_TAC DIVISION[`j:num`;`k:num`][ARITH_RULE`~(3=0)`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`i<=j==> i+1<= j+1`) +THEN RESA_TAC +THEN MRESAL_TAC DIV_MONO[`i:num`;`j:num`;`k:num`][ARITH_RULE`~(3=0)`] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`j = (j DIV k) * k + i - (i DIV k) * k +/\ i +1 <= j+1 /\ i DIV k <= j DIV k /\ ~(k=0) +==> j -i = (j DIV k) *k - (i DIV k) *k `) +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o DEPTH_CONV)[th]) +THEN REWRITE_TAC[GSYM RIGHT_SUB_DISTRIB] +THEN ONCE_REWRITE_TAC[MULT_AC] +THEN MRESAL_TAC DIV_MONO[`i+1:num`;`j+1:num`;`k:num`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC DIVISION[`j+1:num`;`k:num`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC DIVISION[`i+1:num`;`k:num`][ARITH_RULE`~(3=0)`] +THEN MRESA_TAC LE_MULT_RCANCEL[`((i+1) DIV k)`;`((j+1) DIV k)`;`k:num`] +THEN MP_TAC(ARITH_RULE`i + 1 = (i + 1) DIV k * k + (i + 1) MOD k +/\ j + 1 = (j + 1) DIV k * k + (j + 1) MOD k /\ i<= j/\ ((i+1) DIV k)*k<= ((j+1) DIV k)*k +==> j-i = (((j + 1) DIV k * k - (i + 1) DIV k * k) + (j + 1) MOD k) - (i + 1) MOD k`) +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o LAND_CONV o DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[GSYM RIGHT_SUB_DISTRIB] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESAL_TAC MOD_MULT[`k:num`;`j DIV k - i DIV k`][ARITH_RULE`~(3=0)/\ (a*b=b*a)`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN MP_TAC(ARITH_RULE`(i+1) MOD k <=(j+1) MOD k \/ (j+1) MOD k < (i+1) MOD k:num`) +THEN STRIP_TAC; + +MP_TAC(ARITH_RULE` +(i+1) MOD k <=(j+1) MOD k +==> +((((j + 1) DIV k - (i + 1) DIV k) * k + (j + 1) MOD k) - (i + 1) MOD k)= +(((j + 1) DIV k - (i + 1) DIV k) * k + (j + 1) MOD k - (i + 1) MOD k)`) +THEN RESA_TAC +THEN MRESA_TAC MOD_MULT_ADD[`((j + 1) DIV k - (i + 1) DIV k)`;`k:num`;`(j + 1) MOD k - (i + 1) MOD k`] +THEN MRESAL_TAC DIVISION[`i+1:num`;`k:num`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC DIVISION[`j+1:num`;`k:num`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`(j + 1) MOD k < k /\ (i + 1) MOD k <=(j + 1) MOD k + ==> (j + 1) MOD k - (i + 1) MOD k < k `) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA_TAC MOD_LT[`(j + 1) MOD k - (i + 1) MOD k`;` k:num`] +THEN REPLICATE_TAC 8 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +MRESAL_TAC DIVISION[`i+1:num`;`k:num`][ARITH_RULE`~(3=0)`] +THEN MRESAL_TAC DIVISION[`j+1:num`;`k:num`][ARITH_RULE`~(3=0)`] +THEN MP_TAC(ARITH_RULE`(i+1) MOD k < k/\ (j+1) MOD k< (i+1) MOD k + ==> (k+ (j+1) MOD k) - (i+1) MOD k < k /\ 0< (k+ (j+1) MOD k) - (i+1) MOD k`) +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`(j+1) DIV k - (i+1) DIV k =0 \/ 1<= (j+1) DIV k - (i+1) DIV k`) +THEN STRIP_TAC; + +POP_ASSUM (fun th -> ASM_TAC THEN REWRITE_TAC[th;ARITH_RULE` (0 * k + (j + 1) MOD k) - (i + 1) MOD k= (j + 1) MOD k - (i + 1) MOD k`]) +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`(j + 1) MOD k < (i + 1) MOD k +/\ j - i = (j + 1) MOD k - (i + 1) MOD k /\ i<= j ==> j=i `) +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC; + +STRIP_TAC +THEN MRESAL_TAC LE_MULT_RCANCEL[`1`;`((j + 1) DIV k - (i + 1) DIV k)`;`k:num`][ARITH_RULE`1*k=k`] +THEN MP_TAC(ARITH_RULE`k <= ((j + 1) DIV k - (i + 1) DIV k)*k /\ 0 < (k + (j + 1) MOD k) - (i + 1) MOD k +==> ((((j + 1) DIV k - (i + 1) DIV k) * k + (j + 1) MOD k) - (i + 1) MOD k) += +((((j + 1) DIV k - (i + 1) DIV k) * k- 1*k)+(k+ (j + 1) MOD k) - (i + 1) MOD k) +`) +THEN RESA_TAC +THEN REWRITE_TAC[GSYM RIGHT_SUB_DISTRIB] +THEN MRESA_TAC MOD_MULT_ADD[`((j + 1) DIV k - (i + 1) DIV k - 1)`;`k:num`;`(k + (j + 1) MOD k) - (i + 1) MOD k`] +THEN MRESA_TAC MOD_LT[`(k + (j + 1) MOD k) - (i + 1) MOD k`;`k:num`] +THEN REPLICATE_TAC 4 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC +]);; + (* }}} *) + + +let IMP_SUC_MOD_EQ=prove_by_refinement( +` ~(k=0) /\ (i MOD k = j MOD k) +==> (SUC i MOD k = SUC j MOD k)`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`i<=j\/ j<=i:num`) +THEN STRIP_TAC; +MATCH_MP_TAC IMP_SUC_MOD_EQ1 +THEN ASM_REWRITE_TAC[]; +MRESA_TAC (GEN_ALL IMP_SUC_MOD_EQ1)[`j:num`;`i:num`;`k:num`] +THEN ASM_REWRITE_TAC[] +]);; + (* }}} *) + + + +let CHOOSE_MOD_3=prove_by_refinement( +`~(i MOD 3 = j MOD 3) /\ ~(SUC j MOD 3 = i MOD 3) +==> j MOD 3 = SUC i MOD 3`, + (* {{{ proof *) +[ +MP_TAC(ARITH_RULE`i MOD 3= 0 \/ i MOD 3= 1 \/ i MOD 3= 2`) +THEN ONCE_REWRITE_TAC[SET_RULE`(A=B\/ A=C\/A=D)<=> A IN {B,C,D}`] +THEN MP_TAC(ARITH_RULE`j MOD 3= 0 \/ j MOD 3= 1 \/ j MOD 3= 2`) +THEN ONCE_REWRITE_TAC[SET_RULE`(A=B\/ A=C\/A=D)<=> A IN {B,C,D}`] +THEN MP_TAC(ARITH_RULE`SUC j MOD 3= 0 \/ SUC j MOD 3= 1 \/ SUC j MOD 3= 2`) +THEN ONCE_REWRITE_TAC[SET_RULE`(A=B\/ A=C\/A=D)<=> A IN {B,C,D}`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE`SUC j MOD 3 IN {0, 1, 2} /\ + j MOD 3 IN {0, 1, 2} /\ i MOD 3 IN {0, 1, 2} +==> {SUC j MOD 3, j MOD 3, i MOD 3 }SUBSET {0, 1, 2}`) +THEN RESA_TAC +THEN SUBGOAL_THEN`CARD {SUC j MOD 3, j MOD 3, i MOD 3 }=3` ASSUME_TAC; + +ASM_SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY;] +THEN MRESA1_TAC(GEN_ALL SUC_MOD_NOT_EQ)`j:num` +THEN ARITH_TAC; + +SUBGOAL_THEN`CARD {0, 1, 2 }=3` ASSUME_TAC; + +ASM_SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY;] +THEN ARITH_TAC; + +SUBGOAL_THEN`FINITE {0, 1, 2 }` ASSUME_TAC; + +ASM_SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY;]; + +MRESA_TAC CARD_SUBSET_EQ[`{SUC j MOD 3, j MOD 3, i MOD 3 }`;`{0, 1, 2}`] +THEN MP_TAC(ARITH_RULE`SUC i MOD 3= 0 \/ SUC i MOD 3= 1 \/ SUC i MOD 3= 2`) +THEN ONCE_REWRITE_TAC[SET_RULE`(A=B\/ A=C\/A=D)<=> A IN {B,C,D}`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN ONCE_REWRITE_TAC[SET_RULE` A IN {B,C,D}<=> (A=B\/ A=C\/A=D)`] +THEN MRESA1_TAC(GEN_ALL SUC_MOD_NOT_EQ)`i:num` +THEN MRESA_TAC(GEN_ALL NOT_IMP_SUC_MOD_EQ)[`i:num`;`j:num`] +THEN RESA_TAC +]);; + (* }}} *) + + + + +let SMALL_BALL_ANNULUS_6=prove_by_refinement( +` convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + (!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> &2 * h0 <= dist(v,w)) +==> (!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> &2 * h0 <= dist(v,w) /\ dist(v,w)<= &6 )`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC; +REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA_TAC th[`v:real^3`;`w:real^3`]) +THEN POP_ASSUM (fun th -> REPEAT STRIP_TAC THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; +MP_TAC(SET_RULE`v IN V /\ w IN V /\ V SUBSET ball_annulus +==> v IN ball_annulus /\ w IN ball_annulus`) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[ball_annulus;DIFF;IN_ELIM_THM;cball] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN STRIP_TAC +THEN MRESA_TAC DIST_TRIANGLE[`w:real^3`;`vec 0:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0] +THEN REAL_ARITH_TAC +]);; + (* }}} *) + + + + + +let SMALL_BALL_ANNULUS_6_sqrt8=prove_by_refinement( +` convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + (!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> sqrt8 <= dist(v,w)) +==> (!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> sqrt8 <= dist(v,w) /\ dist(v,w)<= &6 )`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC; +REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA_TAC th[`v:real^3`;`w:real^3`]) +THEN POP_ASSUM (fun th -> REPEAT STRIP_TAC THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; +MP_TAC(SET_RULE`v IN V /\ w IN V /\ V SUBSET ball_annulus +==> v IN ball_annulus /\ w IN ball_annulus`) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[ball_annulus;DIFF;IN_ELIM_THM;cball] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN STRIP_TAC +THEN MRESA_TAC DIST_TRIANGLE[`w:real^3`;`vec 0:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0] +THEN REAL_ARITH_TAC +]);; + (* }}} *) + + + +let SMALL_BALL_ANNULUS_6_3=prove_by_refinement( +` convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + (!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> &3 <= dist(v,w)) +==> (!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> &3 <= dist(v,w) /\ dist(v,w)<= &6 )`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC; +REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA_TAC th[`v:real^3`;`w:real^3`]) +THEN POP_ASSUM (fun th -> REPEAT STRIP_TAC THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; +MP_TAC(SET_RULE`v IN V /\ w IN V /\ V SUBSET ball_annulus +==> v IN ball_annulus /\ w IN ball_annulus`) +THEN ASM_REWRITE_TAC[] +THEN REWRITE_TAC[ball_annulus;DIFF;IN_ELIM_THM;cball] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN STRIP_TAC +THEN MRESA_TAC DIST_TRIANGLE[`w:real^3`;`vec 0:real^3`;`v:real^3`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0] +THEN REAL_ARITH_TAC +]);; + (* }}} *) + + + +let CS_ADJ=prove(`cs_adj = (\k a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))`, +MP_TAC( GENL [`k:num`;`a1:real`;`a2:real`;`i:num`;`j:num`] (SPEC_ALL cs_adj)) +THEN REWRITE_TAC[GSYM FUN_EQ_THM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[GSYM th]) +THEN SIMP_TAC[FUN_EQ_THM]);; + + + + +let ZITHLQN_CASE_3=prove_by_refinement( +` V SUBSET ball_annulus /\ + CARD V =3 /\ + (!v w. {v,w} IN E ==> &2 <= dist(v,w) /\ dist(v,w) <= &2 * h0) +/\ (s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 3 (d_tame 3) (cs_adj 3 (&2) (&2 * h0)) (cs_adj 3 (&2 * h0) upperbd)) +/\ (!i. vv (i MOD (CARD V))= vv i) +/\ IMAGE vv (:num) = V /\ IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E +/\ IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +==> vv IN BBs_v39 s`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[BBs_v39;IN;LET_DEF;LET_END_DEF;Oxl_def.periodic;mk_unadorned_v39;CS_ADJ] +THEN STRIP_TAC; + +ASM_REWRITE_TAC[scs_k_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF] +THEN REPLICATE_TAC 3 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC MOD_EQ[`i+CARD(V:real^3->bool)`;`i:num`;`CARD(V:real^3->bool)`;`1`][ARITH_RULE`1*A=A`]; + +STRIP_TAC +THEN REPEAT GEN_TAC; + +ASM_REWRITE_TAC[scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF] +THEN MP_TAC(ARITH_RULE`i MOD 3 = j MOD 3 \/ ~(i MOD 3 = j MOD 3)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[DIST_POS_LE] +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num` THEN MRESA1_TAC th`i :num`) +THEN REPLICATE_TAC 2 (POP_ASSUM (fun th-> REWRITE_TAC[SYM th])) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[DIST_REFL] +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`SUC j MOD 3 = i MOD 3 \/ ~(SUC j MOD 3 = i MOD 3)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`{vv (i:num), (vv j)} IN (E:(real^3->bool)->bool)` ASSUME_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC j` THEN MRESA1_TAC th`i :num`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;SET_RULE`j IN (:num)`]) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`]; + +POP_ASSUM MP_TAC +THEN REPLICATE_TAC 7 REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th -> STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]); + +MP_TAC CHOOSE_MOD_3 +THEN ASM_REWRITE_TAC[] +THEN RESA_TAC; + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`{vv (i:num), (vv j)} IN (E:(real^3->bool)->bool)` ASSUME_TAC; + +REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC i` THEN MRESA1_TAC th`j :num`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;SET_RULE`i IN (:num)`]) +THEN REPEAT RESA_TAC; + +POP_ASSUM MP_TAC +THEN REPLICATE_TAC 8 REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th -> STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]); + +ASM_REWRITE_TAC[scs_k_v39_explicit;LET_DEF;LET_END_DEF;] +THEN ARITH_TAC +]);; + (* }}} *) + + + +let ZITHLQN_CASE_4=prove_by_refinement( +` convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + CARD V =4 /\ + (!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> &2 * h0 <= dist(v,w) ) /\ + (!v w. {v,w} IN E ==> &2 <= dist(v,w) /\ dist(v,w) <= &2 * h0) +/\ (s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (d_tame 4) (cs_adj 4 (&2) (&2 * h0)) (cs_adj 4 (&2 * h0) upperbd)) +/\ (!i. vv (i MOD (CARD V))= vv i) +/\ (! i j. vv i = vv j ==> i MOD CARD V = j MOD CARD V) +/\ IMAGE vv (:num) = V /\ IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E +/\ IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +==> vv IN BBs_v39 s`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN MP_TAC SMALL_BALL_ANNULUS_6 +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[BBs_v39;IN;LET_DEF;LET_END_DEF;mk_unadorned_v39;CS_ADJ] +THEN STRIP_TAC; + +ASM_REWRITE_TAC[scs_k_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;Oxl_def.periodic] +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC MOD_EQ[`i+CARD(V:real^3->bool)`;`i:num`;`CARD(V:real^3->bool)`;`1`][ARITH_RULE`1*A=A`]; + +STRIP_TAC +THEN REPEAT GEN_TAC; + +ASM_REWRITE_TAC[scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF] +THEN MP_TAC(ARITH_RULE`i MOD 4 = j MOD 4 \/ ~(i MOD 4 = j MOD 4)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[DIST_POS_LE] +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num` THEN MRESA1_TAC th`i :num`) +THEN REPLICATE_TAC 2 (POP_ASSUM (fun th-> REWRITE_TAC[SYM th])) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[DIST_REFL] +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`SUC j MOD 4 = i MOD 4 \/ ~(SUC j MOD 4 = i MOD 4)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`{vv (i:num), (vv j)} IN (E:(real^3->bool)->bool)` ASSUME_TAC; + +REPLICATE_TAC 3 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC j` THEN MRESA1_TAC th`i :num`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;SET_RULE`j IN (:num)`]) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`]; + +POP_ASSUM MP_TAC +THEN REPLICATE_TAC 8 REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th -> STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]); + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`SUC i MOD 4 = j MOD 4 \/ ~(SUC i MOD 4 = j MOD 4)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`{vv (i:num), (vv j)} IN (E:(real^3->bool)->bool)` ASSUME_TAC; + +REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC i` THEN MRESA1_TAC th`j :num`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;SET_RULE`i IN (:num)`]) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`]; + +POP_ASSUM MP_TAC +THEN REPLICATE_TAC 9 REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th -> STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]); + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`~({(vv:num->real^3) i, vv j} IN E)` ASSUME_TAC; + +STRIP_TAC +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IN_E_IMP_IN_FF) +[`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(vv:num->real^3) j`;`(vv:num->real^3) i`;`FF:real^3#real^3->bool`;] +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN STRIP_TAC +THEN REPLICATE_TAC 11 (POP_ASSUM MP_TAC); + +POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`;`x:num`] THEN MRESA_TAC th[`j:num`;`SUC x:num`]) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`x:num`;`4`][ARITH_RULE`~(4=0)`]; + +POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`j:num`;`x:num`] THEN MRESA_TAC th[`i:num`;`SUC x:num`]) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`j:num`;`x:num`;`4`][ARITH_RULE`~(4=0)`]; + + +SUBGOAL_THEN`~(vv i =(vv:num->real^3) j)`ASSUME_TAC; + + +REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`;`j:num`]); + + + REPLICATE_TAC 12 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th -> REPLICATE_TAC 12 STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]) +THEN POP_ASSUM MATCH_MP_TAC +THEN REPLICATE_TAC 7 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;IMAGE;IN_ELIM_THM]) +THEN STRIP_TAC; + +EXISTS_TAC`i:num` +THEN SET_TAC[]; + +EXISTS_TAC`j:num` +THEN SET_TAC[]; +]);; + (* }}} *) + + + + + +let ZITHLQN_CASE_5=prove_by_refinement( +` convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + CARD V =5 /\ + (!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> &2 * h0 <= dist(v,w) ) /\ + (!v w. {v,w} IN E ==> &2 <= dist(v,w) /\ dist(v,w) <= &2 * h0) +/\ (s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (d_tame 5) (cs_adj 5 (&2) (&2 * h0)) (cs_adj 5 (&2 * h0) upperbd)) +/\ (!i. vv (i MOD (CARD V))= vv i) +/\ (! i j. vv i = vv j ==> i MOD CARD V = j MOD CARD V) +/\ IMAGE vv (:num) = V /\ IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E +/\ IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +==> vv IN BBs_v39 s`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN MP_TAC SMALL_BALL_ANNULUS_6 +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[BBs_v39;IN;LET_DEF;LET_END_DEF;mk_unadorned_v39;CS_ADJ] +THEN STRIP_TAC; + +ASM_REWRITE_TAC[scs_k_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;Oxl_def.periodic] +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC MOD_EQ[`i+CARD(V:real^3->bool)`;`i:num`;`CARD(V:real^3->bool)`;`1`][ARITH_RULE`1*A=A`]; + +STRIP_TAC +THEN REPEAT GEN_TAC; + +ASM_REWRITE_TAC[scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF] +THEN MP_TAC(ARITH_RULE`i MOD 5 = j MOD 5 \/ ~(i MOD 5 = j MOD 5)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[DIST_POS_LE] +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num` THEN MRESA1_TAC th`i :num`) +THEN REPLICATE_TAC 2 (POP_ASSUM (fun th-> REWRITE_TAC[SYM th])) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[DIST_REFL] +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`SUC j MOD 5 = i MOD 5 \/ ~(SUC j MOD 5 = i MOD 5)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`{vv (i:num), (vv j)} IN (E:(real^3->bool)->bool)` ASSUME_TAC; + +REPLICATE_TAC 3 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC j` THEN MRESA1_TAC th`i :num`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;SET_RULE`j IN (:num)`]) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`]; + +POP_ASSUM MP_TAC +THEN REPLICATE_TAC 8 REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th -> STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]); + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`SUC i MOD 5 = j MOD 5 \/ ~(SUC i MOD 5 = j MOD 5)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`{vv (i:num), (vv j)} IN (E:(real^3->bool)->bool)` ASSUME_TAC; + +REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC i` THEN MRESA1_TAC th`j :num`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;SET_RULE`i IN (:num)`]) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`]; + +POP_ASSUM MP_TAC +THEN REPLICATE_TAC 9 REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th -> STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]); + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`~({(vv:num->real^3) i, vv j} IN E)` ASSUME_TAC; + +STRIP_TAC +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IN_E_IMP_IN_FF) +[`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(vv:num->real^3) j`;`(vv:num->real^3) i`;`FF:real^3#real^3->bool`;] +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN STRIP_TAC +THEN REPLICATE_TAC 11 (POP_ASSUM MP_TAC); + +POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`;`x:num`] THEN MRESA_TAC th[`j:num`;`SUC x:num`]) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`x:num`;`5`][ARITH_RULE`~(5=0)`]; + +POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`j:num`;`x:num`] THEN MRESA_TAC th[`i:num`;`SUC x:num`]) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`j:num`;`x:num`;`5`][ARITH_RULE`~(5=0)`]; + +SUBGOAL_THEN`~(vv i =(vv:num->real^3) j)`ASSUME_TAC; + +REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`;`j:num`]); + +REPLICATE_TAC 12 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th -> REPLICATE_TAC 12 STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]) +THEN POP_ASSUM MATCH_MP_TAC +THEN REPLICATE_TAC 7 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;IMAGE;IN_ELIM_THM]) +THEN STRIP_TAC; + +EXISTS_TAC`i:num` +THEN SET_TAC[]; + +EXISTS_TAC`j:num` +THEN SET_TAC[]; + +]);; + (* }}} *) + + + + + +let ZITHLQN_CASE_6=prove_by_refinement( +` convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + CARD V =6 /\ + (!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> &2 * h0 <= dist(v,w) ) /\ + (!v w. {v,w} IN E ==> &2 <= dist(v,w) /\ dist(v,w) <= &2 * h0) +/\ (s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (&2 * h0)) (cs_adj 6 (&2 * h0) upperbd)) +/\ (!i. vv (i MOD (CARD V))= vv i) +/\ (! i j. vv i = vv j ==> i MOD CARD V = j MOD CARD V) +/\ IMAGE vv (:num) = V /\ IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E +/\ IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +==> vv IN BBs_v39 s`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN MP_TAC SMALL_BALL_ANNULUS_6 +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[BBs_v39;IN;LET_DEF;LET_END_DEF;mk_unadorned_v39;CS_ADJ] +THEN STRIP_TAC; + +ASM_REWRITE_TAC[scs_k_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;Oxl_def.periodic] +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC MOD_EQ[`i+CARD(V:real^3->bool)`;`i:num`;`CARD(V:real^3->bool)`;`1`][ARITH_RULE`1*A=A`]; + +STRIP_TAC +THEN REPEAT GEN_TAC; + +ASM_REWRITE_TAC[scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF] +THEN MP_TAC(ARITH_RULE`i MOD 6 = j MOD 6 \/ ~(i MOD 6 = j MOD 6)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[DIST_POS_LE] +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num` THEN MRESA1_TAC th`i :num`) +THEN REPLICATE_TAC 2 (POP_ASSUM (fun th-> REWRITE_TAC[SYM th])) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[DIST_REFL] +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`SUC j MOD 6 = i MOD 6 \/ ~(SUC j MOD 6 = i MOD 6)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`{vv (i:num), (vv j)} IN (E:(real^3->bool)->bool)` ASSUME_TAC; + +REPLICATE_TAC 3 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC j` THEN MRESA1_TAC th`i :num`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;SET_RULE`j IN (:num)`]) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`]; + +POP_ASSUM MP_TAC +THEN REPLICATE_TAC 8 REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th -> STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]); + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`SUC i MOD 6 = j MOD 6 \/ ~(SUC i MOD 6 = j MOD 6)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`{vv (i:num), (vv j)} IN (E:(real^3->bool)->bool)` ASSUME_TAC; + +REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC i` THEN MRESA1_TAC th`j :num`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;SET_RULE`i IN (:num)`]) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`]; + +POP_ASSUM MP_TAC +THEN REPLICATE_TAC 9 REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th -> STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]); + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`~({(vv:num->real^3) i, vv j} IN E)` ASSUME_TAC; + +STRIP_TAC +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IN_E_IMP_IN_FF) +[`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(vv:num->real^3) j`;`(vv:num->real^3) i`;`FF:real^3#real^3->bool`;] +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN STRIP_TAC +THEN REPLICATE_TAC 11 (POP_ASSUM MP_TAC); + +POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`;`x:num`] THEN MRESA_TAC th[`j:num`;`SUC x:num`]) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`x:num`;`6`][ARITH_RULE`~(6=0)`]; + +POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`j:num`;`x:num`] THEN MRESA_TAC th[`i:num`;`SUC x:num`]) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`j:num`;`x:num`;`6`][ARITH_RULE`~(6=0)`]; + +SUBGOAL_THEN`~(vv i =(vv:num->real^3) j)`ASSUME_TAC; + +REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`;`j:num`]); + +REPLICATE_TAC 12 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th -> REPLICATE_TAC 12 STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]) +THEN POP_ASSUM MATCH_MP_TAC +THEN REPLICATE_TAC 7 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;IMAGE;IN_ELIM_THM]) +THEN STRIP_TAC; + +EXISTS_TAC`i:num` +THEN SET_TAC[]; + +EXISTS_TAC`j:num` +THEN SET_TAC[]; +]);; + (* }}} *) + + + + + + +let ZITHLQN_CASE_5_pro_cs=prove_by_refinement( + ` convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + CARD V =5 /\ +(!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> &2 * h0 <= dist(v,w)) /\ + (!v w. {v,w} IN E /\ ~({v,w} = {v0,w0}) ==> &2 <= dist(v,w) /\ dist(v,w) <= &2 * h0) /\ + {v0,w0} IN E /\ + &2 *h0 <= dist(v0,w0) /\ dist(v0,w0) <= sqrt8 +/\ (s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k ,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in +mk_unadorned_v39 5 (#0.616) (a_pro 5 (&2 * h0) (&2) (&2 * h0)) (a_pro 5 sqrt8 (&2 * h0) upperbd)) +/\ (!i. vv (i MOD (CARD V))= vv i) +/\ (! i j. vv i = vv j ==> i MOD CARD V = j MOD CARD V) +/\ IMAGE vv (:num) = V /\ IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E +/\ IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ vv 0= v0 /\ vv 1= w0 +==> vv IN BBs_v39 s`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN REPLICATE_TAC 12 (POP_ASSUM MP_TAC) +THEN MP_TAC SMALL_BALL_ANNULUS_6 +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[BBs_v39;IN;LET_DEF;LET_END_DEF;mk_unadorned_v39;CS_ADJ] +THEN STRIP_TAC; + +ASM_REWRITE_TAC[scs_k_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;Oxl_def.periodic] +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC MOD_EQ[`i+CARD(V:real^3->bool)`;`i:num`;`CARD(V:real^3->bool)`;`1`][ARITH_RULE`1*A=A`]; + +STRIP_TAC +THEN REPEAT GEN_TAC; + +ASM_REWRITE_TAC[scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF] +THEN MP_TAC(ARITH_RULE`i MOD 5 = j MOD 5 \/ ~(i MOD 5 = j MOD 5)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[DIST_POS_LE] +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num` THEN MRESA1_TAC th`i :num`) +THEN REPLICATE_TAC 2 (POP_ASSUM (fun th-> REWRITE_TAC[SYM th])) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[DIST_REFL] +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`{i MOD 5,j MOD 5}={0,1} \/ ~({i MOD 5,j MOD 5}={0,1})`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`(~(i=j:num))`ASSUME_TAC; + +STRIP_TAC +THEN POP_ASSUM (fun th-> REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[th]); + +MP_TAC(SET_RULE`{i MOD 5,j MOD 5} = {0, 1} /\ ~(i MOD 5=j MOD 5)/\ ~(0=1)==> (i MOD 5=0 /\ j MOD 5=1)\/ (i MOD 5=1 /\ j MOD 5=0)`) +THEN ASM_REWRITE_TAC[ARITH_RULE`~(0=1)`] +THEN STRIP_TAC +THEN REPLICATE_TAC 11 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th` j:num` THEN MRESA1_TAC th`i :num`) +THEN POP_ASSUM (fun th-> POP_ASSUM(fun th1-> REPEAT DISCH_TAC THEN MP_TAC th1) +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`SUC j MOD 5 = i MOD 5 \/ ~(SUC j MOD 5 = i MOD 5)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`{vv (i:num), (vv j)} IN (E:(real^3->bool)->bool)` ASSUME_TAC; + +REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 8 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC j` THEN MRESA1_TAC th`i :num`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;SET_RULE`j IN (:num)`]) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`]; + +SUBGOAL_THEN`~((vv:num->real^3) i= vv j)`ASSUME_TAC; + +REPLICATE_TAC 9 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`;`j:num`]) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`~({(vv:num->real^3) i, vv j}= {v0,w0})`ASSUME_TAC; + +STRIP_TAC +THEN MP_TAC(SET_RULE`{(vv:num->real^3) i, vv j} = {v0, w0} /\ ~(vv i = vv j) ==> (vv i = v0 /\ vv j= w0) \/( vv i = w0 /\ vv j= v0) +`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +REPLICATE_TAC 13 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`;`0:num`] THEN MRESA_TAC th[`j:num`;`1:num`]) +THEN POP_ASSUM (fun th-> POP_ASSUM(fun th1-> REPEAT STRIP_TAC THEN MP_TAC th1) +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC 6 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +REPLICATE_TAC 13 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`;`1:num`] THEN MRESA_TAC th[`j:num`;`0:num`]) +THEN POP_ASSUM (fun th-> POP_ASSUM(fun th1-> REPEAT STRIP_TAC THEN MP_TAC th1) +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC 6 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`1 MOD 5=1 /\ 0 MOD 5=0`] +THEN SET_TAC[]; + +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 14 REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th -> STRIP_TAC THEN STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]); + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`SUC i MOD 5 = j MOD 5 \/ ~(SUC i MOD 5 = j MOD 5)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`{vv (i:num), (vv j)} IN (E:(real^3->bool)->bool)` ASSUME_TAC; + +REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 9 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC i` THEN MRESA1_TAC th`j :num`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;SET_RULE`i IN (:num)`]) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`]; + +SUBGOAL_THEN`~((vv:num->real^3) i= vv j)`ASSUME_TAC; + +REPLICATE_TAC 10 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`;`j:num`]) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`~({(vv:num->real^3) i, vv j}= {v0,w0})`ASSUME_TAC; + +STRIP_TAC +THEN MP_TAC(SET_RULE`{(vv:num->real^3) i, vv j} = {v0, w0} /\ ~(vv i = vv j) ==> (vv i = v0 /\ vv j= w0) \/( vv i = w0 /\ vv j= v0) +`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +REPLICATE_TAC 14 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`;`0:num`] THEN MRESA_TAC th[`j:num`;`1:num`]) +THEN POP_ASSUM (fun th-> POP_ASSUM(fun th1-> REPEAT STRIP_TAC THEN MP_TAC th1) +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC 7 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +REPLICATE_TAC 14 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`;`1:num`] THEN MRESA_TAC th[`j:num`;`0:num`]) +THEN POP_ASSUM (fun th-> POP_ASSUM(fun th1-> REPEAT STRIP_TAC THEN MP_TAC th1) +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC 7 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`1 MOD 5=1 /\ 0 MOD 5=0`] +THEN SET_TAC[]; + +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 15 REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th -> STRIP_TAC THEN STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]); + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`~({(vv:num->real^3) i, vv j} IN E)` ASSUME_TAC; + +STRIP_TAC +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IN_E_IMP_IN_FF) +[`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(vv:num->real^3) j`;`(vv:num->real^3) i`;`FF:real^3#real^3->bool`;] +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 9 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN STRIP_TAC +THEN REPLICATE_TAC 14 (POP_ASSUM MP_TAC); + +POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`;`x:num`] THEN MRESA_TAC th[`j:num`;`SUC x:num`]) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`x:num`;`5`][ARITH_RULE`~(5=0)`]; + +POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`j:num`;`x:num`] THEN MRESA_TAC th[`i:num`;`SUC x:num`]) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`j:num`;`x:num`;`5`][ARITH_RULE`~(5=0)`]; + +SUBGOAL_THEN`~(vv i =(vv:num->real^3) j)`ASSUME_TAC; + +REPLICATE_TAC 10 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`;`j:num`]); + +REPLICATE_TAC 18 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th -> REPLICATE_TAC 18 STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]) +THEN POP_ASSUM MATCH_MP_TAC +THEN REPLICATE_TAC 10 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;IMAGE;IN_ELIM_THM]) +THEN STRIP_TAC; + +EXISTS_TAC`i:num` +THEN SET_TAC[]; + +EXISTS_TAC`j:num` +THEN SET_TAC[]; +]);; + (* }}} *) + + + + + + + + + +let ZITHLQN_CASE_4_3=prove_by_refinement( +` convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + CARD V =4 /\ + (!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> &3 <= dist(v,w) ) /\ + (!v w. {v,w} IN E ==> &2 <= dist(v,w) /\ dist(v,w) <= &2 * h0) +/\ (s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (#0.467) (cs_adj 4 (&2) (&3)) (cs_adj 4 (&2 * h0) upperbd)) +/\ (!i. vv (i MOD (CARD V))= vv i) +/\ (! i j. vv i = vv j ==> i MOD CARD V = j MOD CARD V) +/\ IMAGE vv (:num) = V /\ IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E +/\ IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +==> vv IN BBs_v39 s`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN MP_TAC SMALL_BALL_ANNULUS_6_3 +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[BBs_v39;IN;LET_DEF;LET_END_DEF;mk_unadorned_v39;CS_ADJ] +THEN STRIP_TAC; + +ASM_REWRITE_TAC[scs_k_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;Oxl_def.periodic] +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC MOD_EQ[`i+CARD(V:real^3->bool)`;`i:num`;`CARD(V:real^3->bool)`;`1`][ARITH_RULE`1*A=A`]; + +STRIP_TAC +THEN REPEAT GEN_TAC; + +ASM_REWRITE_TAC[scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF] +THEN MP_TAC(ARITH_RULE`i MOD 4 = j MOD 4 \/ ~(i MOD 4 = j MOD 4)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[DIST_POS_LE] +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num` THEN MRESA1_TAC th`i :num`) +THEN REPLICATE_TAC 2 (POP_ASSUM (fun th-> REWRITE_TAC[SYM th])) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[DIST_REFL] +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`SUC j MOD 4 = i MOD 4 \/ ~(SUC j MOD 4 = i MOD 4)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`{vv (i:num), (vv j)} IN (E:(real^3->bool)->bool)` ASSUME_TAC; + +REPLICATE_TAC 3 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC j` THEN MRESA1_TAC th`i :num`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;SET_RULE`j IN (:num)`]) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`]; + +POP_ASSUM MP_TAC +THEN REPLICATE_TAC 8 REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th -> STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]); + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`SUC i MOD 4 = j MOD 4 \/ ~(SUC i MOD 4 = j MOD 4)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`{vv (i:num), (vv j)} IN (E:(real^3->bool)->bool)` ASSUME_TAC; + +REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC i` THEN MRESA1_TAC th`j :num`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;SET_RULE`i IN (:num)`]) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`]; + +POP_ASSUM MP_TAC +THEN REPLICATE_TAC 9 REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th -> STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]); + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`~({(vv:num->real^3) i, vv j} IN E)` ASSUME_TAC; + +STRIP_TAC +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IN_E_IMP_IN_FF) +[`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(vv:num->real^3) j`;`(vv:num->real^3) i`;`FF:real^3#real^3->bool`;] +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN STRIP_TAC +THEN REPLICATE_TAC 11 (POP_ASSUM MP_TAC); + +POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`;`x:num`] THEN MRESA_TAC th[`j:num`;`SUC x:num`]) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`x:num`;`4`][ARITH_RULE`~(4=0)`]; + +POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`j:num`;`x:num`] THEN MRESA_TAC th[`i:num`;`SUC x:num`]) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`j:num`;`x:num`;`4`][ARITH_RULE`~(4=0)`]; + +SUBGOAL_THEN`~(vv i =(vv:num->real^3) j)`ASSUME_TAC; + +REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`;`j:num`]); + + REPLICATE_TAC 12 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th -> REPLICATE_TAC 12 STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]) +THEN POP_ASSUM MATCH_MP_TAC +THEN REPLICATE_TAC 7 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;IMAGE;IN_ELIM_THM]) +THEN STRIP_TAC; + +EXISTS_TAC`i:num` +THEN SET_TAC[]; + +EXISTS_TAC`j:num` +THEN SET_TAC[]; +]);; + (* }}} *) + + + + + + + + +let ZITHLQN_CASE_5_sqrt8=prove_by_refinement( +` convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + CARD V =5 /\ + (!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> sqrt8 <= dist(v,w) ) /\ + (!v w. {v,w} IN E ==> &2 <= dist(v,w) /\ dist(v,w) <= &2 * h0) +/\ (s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (#0.616) (cs_adj 5 (&2) (sqrt8)) (cs_adj 5 (&2 * h0) upperbd)) +/\ (!i. vv (i MOD (CARD V))= vv i) +/\ (! i j. vv i = vv j ==> i MOD CARD V = j MOD CARD V) +/\ IMAGE vv (:num) = V /\ IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E +/\ IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +==> vv IN BBs_v39 s`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN MP_TAC SMALL_BALL_ANNULUS_6_sqrt8 +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[BBs_v39;IN;LET_DEF;LET_END_DEF;mk_unadorned_v39;CS_ADJ] +THEN STRIP_TAC; + +ASM_REWRITE_TAC[scs_k_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;Oxl_def.periodic] +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC MOD_EQ[`i+CARD(V:real^3->bool)`;`i:num`;`CARD(V:real^3->bool)`;`1`][ARITH_RULE`1*A=A`]; + +STRIP_TAC +THEN REPEAT GEN_TAC; + +ASM_REWRITE_TAC[scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF] +THEN MP_TAC(ARITH_RULE`i MOD 5 = j MOD 5 \/ ~(i MOD 5 = j MOD 5)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[DIST_POS_LE] +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num` THEN MRESA1_TAC th`i :num`) +THEN REPLICATE_TAC 2 (POP_ASSUM (fun th-> REWRITE_TAC[SYM th])) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[DIST_REFL] +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`SUC j MOD 5 = i MOD 5 \/ ~(SUC j MOD 5 = i MOD 5)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`{vv (i:num), (vv j)} IN (E:(real^3->bool)->bool)` ASSUME_TAC; + +REPLICATE_TAC 3 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC j` THEN MRESA1_TAC th`i :num`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;SET_RULE`j IN (:num)`]) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`]; + +POP_ASSUM MP_TAC +THEN REPLICATE_TAC 8 REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th -> STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]); + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`SUC i MOD 5 = j MOD 5 \/ ~(SUC i MOD 5 = j MOD 5)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`{vv (i:num), (vv j)} IN (E:(real^3->bool)->bool)` ASSUME_TAC; + +REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC i` THEN MRESA1_TAC th`j :num`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;SET_RULE`i IN (:num)`]) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`]; + +POP_ASSUM MP_TAC +THEN REPLICATE_TAC 9 REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th -> STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]); + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`~({(vv:num->real^3) i, vv j} IN E)` ASSUME_TAC; + +STRIP_TAC +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IN_E_IMP_IN_FF) +[`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(vv:num->real^3) j`;`(vv:num->real^3) i`;`FF:real^3#real^3->bool`;] +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN STRIP_TAC +THEN REPLICATE_TAC 11 (POP_ASSUM MP_TAC); + +POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`;`x:num`] THEN MRESA_TAC th[`j:num`;`SUC x:num`]) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`x:num`;`5`][ARITH_RULE`~(5=0)`]; + +POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`j:num`;`x:num`] THEN MRESA_TAC th[`i:num`;`SUC x:num`]) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`j:num`;`x:num`;`5`][ARITH_RULE`~(5=0)`]; + +SUBGOAL_THEN`~(vv i =(vv:num->real^3) j)`ASSUME_TAC; + +REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`;`j:num`]); + +REPLICATE_TAC 12 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th -> REPLICATE_TAC 12 STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]) +THEN POP_ASSUM MATCH_MP_TAC +THEN REPLICATE_TAC 7 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;IMAGE;IN_ELIM_THM]) +THEN STRIP_TAC; + +EXISTS_TAC`i:num` +THEN SET_TAC[]; + +EXISTS_TAC`j:num` +THEN SET_TAC[]; +]);; + (* }}} *) + + + + + + + + + + + + + +let ZITHLQN_CASE_4_pro_cs=prove_by_refinement( + ` convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + CARD V =4 /\ +(!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> sqrt8 <= dist(v,w)) /\ + (!v w. {v,w} IN E /\ ~({v,w} = {v0,w0}) ==> &2 <= dist(v,w) /\ dist(v,w) <= &2 * h0) /\ + {v0,w0} IN E /\ + &2 *h0 <= dist(v0,w0) /\ dist(v0,w0) <= sqrt8 +/\ (s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k ,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (#0.477) (a_pro 4 (&2 * h0) (&2) sqrt8) (a_pro 4 sqrt8 (&2 * h0) upperbd)) +/\ (!i. vv (i MOD (CARD V))= vv i) +/\ (! i j. vv i = vv j ==> i MOD CARD V = j MOD CARD V) +/\ IMAGE vv (:num) = V /\ IMAGE (\i. {vv i, vv (SUC i)}) (:num) = E +/\ IMAGE (\i. vv i,vv (SUC i)) (:num) = FF +/\ vv 0= v0 /\ vv 1= w0 +==> vv IN BBs_v39 s`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC +THEN REPLICATE_TAC 12 (POP_ASSUM MP_TAC) +THEN MP_TAC SMALL_BALL_ANNULUS_6_sqrt8 +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[BBs_v39;IN;LET_DEF;LET_END_DEF;mk_unadorned_v39;CS_ADJ] +THEN STRIP_TAC; + +ASM_REWRITE_TAC[scs_k_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF;Oxl_def.periodic] +THEN REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[GSYM th]) +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC MOD_EQ[`i+CARD(V:real^3->bool)`;`i:num`;`CARD(V:real^3->bool)`;`1`][ARITH_RULE`1*A=A`]; + +STRIP_TAC +THEN REPEAT GEN_TAC; + +ASM_REWRITE_TAC[scs_a_v39_explicit;scs_b_v39_explicit;LET_DEF;LET_END_DEF] +THEN MP_TAC(ARITH_RULE`i MOD 4 = j MOD 4 \/ ~(i MOD 4 = j MOD 4)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[DIST_POS_LE] +THEN REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`j:num` THEN MRESA1_TAC th`i :num`) +THEN REPLICATE_TAC 2 (POP_ASSUM (fun th-> REWRITE_TAC[SYM th])) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[DIST_REFL] +THEN REAL_ARITH_TAC; + +ASM_REWRITE_TAC[] +THEN MP_TAC(SET_RULE`{i MOD 4,j MOD 4}={0,1} \/ ~({i MOD 4,j MOD 4}={0,1})`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`(~(i=j:num))`ASSUME_TAC; + +STRIP_TAC +THEN POP_ASSUM (fun th-> REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[th]); + +MP_TAC(SET_RULE`{i MOD 4,j MOD 4} = {0, 1} /\ ~(i MOD 4=j MOD 4)/\ ~(0=1)==> (i MOD 4=0 /\ j MOD 4=1)\/ (i MOD 4=1 /\ j MOD 4=0)`) +THEN ASM_REWRITE_TAC[ARITH_RULE`~(0=1)`] +THEN STRIP_TAC +THEN REPLICATE_TAC 11 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th` j:num` THEN MRESA1_TAC th`i :num`) +THEN POP_ASSUM (fun th-> POP_ASSUM(fun th1-> REPEAT DISCH_TAC THEN MP_TAC th1) +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]) +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`SUC j MOD 4 = i MOD 4 \/ ~(SUC j MOD 4 = i MOD 4)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`{vv (i:num), (vv j)} IN (E:(real^3->bool)->bool)` ASSUME_TAC; + +REPLICATE_TAC 6 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 8 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC j` THEN MRESA1_TAC th`i :num`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;SET_RULE`j IN (:num)`]) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`]; + +SUBGOAL_THEN`~((vv:num->real^3) i= vv j)`ASSUME_TAC; + +REPLICATE_TAC 9 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`;`j:num`]) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`~({(vv:num->real^3) i, vv j}= {v0,w0})`ASSUME_TAC; + +STRIP_TAC +THEN MP_TAC(SET_RULE`{(vv:num->real^3) i, vv j} = {v0, w0} /\ ~(vv i = vv j) ==> (vv i = v0 /\ vv j= w0) \/( vv i = w0 /\ vv j= v0) +`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +REPLICATE_TAC 13 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`;`0:num`] THEN MRESA_TAC th[`j:num`;`1:num`]) +THEN POP_ASSUM (fun th-> POP_ASSUM(fun th1-> REPEAT STRIP_TAC THEN MP_TAC th1) +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC 6 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +REPLICATE_TAC 13 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`;`1:num`] THEN MRESA_TAC th[`j:num`;`0:num`]) +THEN POP_ASSUM (fun th-> POP_ASSUM(fun th1-> REPEAT STRIP_TAC THEN MP_TAC th1) +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC 6 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`1 MOD 4=1 /\ 0 MOD 4=0`] +THEN SET_TAC[]; + +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 14 REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th -> STRIP_TAC THEN STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]); + +ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`SUC i MOD 4 = j MOD 4 \/ ~(SUC i MOD 4 = j MOD 4)`) +THEN STRIP_TAC; + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`{vv (i:num), (vv j)} IN (E:(real^3->bool)->bool)` ASSUME_TAC; + +REPLICATE_TAC 7 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[] +THEN REPLICATE_TAC 9 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`SUC i` THEN MRESA1_TAC th`j :num`) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;SET_RULE`i IN (:num)`]) +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`]; + +SUBGOAL_THEN`~((vv:num->real^3) i= vv j)`ASSUME_TAC; + +REPLICATE_TAC 10 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`;`j:num`]) +THEN POP_ASSUM (fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN ASM_REWRITE_TAC[]; + +SUBGOAL_THEN`~({(vv:num->real^3) i, vv j}= {v0,w0})`ASSUME_TAC; + +STRIP_TAC +THEN MP_TAC(SET_RULE`{(vv:num->real^3) i, vv j} = {v0, w0} /\ ~(vv i = vv j) ==> (vv i = v0 /\ vv j= w0) \/( vv i = w0 /\ vv j= v0) +`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +REPLICATE_TAC 14 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`;`0:num`] THEN MRESA_TAC th[`j:num`;`1:num`]) +THEN POP_ASSUM (fun th-> POP_ASSUM(fun th1-> REPEAT STRIP_TAC THEN MP_TAC th1) +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC 7 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + +REPLICATE_TAC 14 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th-> MRESA_TAC th[`i:num`;`1:num`] THEN MRESA_TAC th[`j:num`;`0:num`]) +THEN POP_ASSUM (fun th-> POP_ASSUM(fun th1-> REPEAT STRIP_TAC THEN MP_TAC th1) +THEN MP_TAC th) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN REPLICATE_TAC 7 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`1 MOD 4=1 /\ 0 MOD 4=0`] +THEN SET_TAC[]; + +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 15 REMOVE_ASSUM_TAC +THEN POP_ASSUM (fun th -> STRIP_TAC THEN STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]); + +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`~({(vv:num->real^3) i, vv j} IN E)` ASSUME_TAC; + +STRIP_TAC +THEN MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IN_E_IMP_IN_FF) +[`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(vv:num->real^3) j`;`(vv:num->real^3) i`;`FF:real^3#real^3->bool`;] +THEN POP_ASSUM MP_TAC +THEN REPLICATE_TAC 9 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN STRIP_TAC +THEN REPLICATE_TAC 14 (POP_ASSUM MP_TAC); + +POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`;`x:num`] THEN MRESA_TAC th[`j:num`;`SUC x:num`]) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`i:num`;`x:num`;`4`][ARITH_RULE`~(4=0)`]; + +POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`j:num`;`x:num`] THEN MRESA_TAC th[`i:num`;`SUC x:num`]) +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC(GEN_ALL IMP_SUC_MOD_EQ)[`j:num`;`x:num`;`4`][ARITH_RULE`~(4=0)`]; + +SUBGOAL_THEN`~(vv i =(vv:num->real^3) j)`ASSUME_TAC; + +REPLICATE_TAC 10 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MRESA_TAC th[`i:num`;`j:num`]); + +REPLICATE_TAC 18 (POP_ASSUM MP_TAC) +THEN POP_ASSUM (fun th -> REPLICATE_TAC 18 STRIP_TAC THEN MRESA_TAC th[`(vv:num->real^3) i`;`(vv:num->real^3) j`]) +THEN POP_ASSUM MATCH_MP_TAC +THEN REPLICATE_TAC 10 (REMOVE_ASSUM_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;IMAGE;IN_ELIM_THM]) +THEN STRIP_TAC; + +EXISTS_TAC`i:num` +THEN SET_TAC[]; + +EXISTS_TAC`j:num` +THEN SET_TAC[]; +]);; + (* }}} *) + + + + + +let exists_vv3=prove_by_refinement( +`&2 <= norm v1 /\ + &2 <= norm v2 /\ + &2 <= norm v3 /\ + norm v1 <= &2 * h0 /\ + norm v2 <= &2 * h0 /\ + norm v3 <= &2 * h0 /\ + &2 <= dist(v1,v2) /\ + &2 <= dist(v1,v3) /\ + &2 <= dist(v2,v3) /\ + dist(v1,v2) <= &2 * h0 /\ + dist(v1,v3) <= &2 * h0 /\ + dist(v2,v3) <= &2 * h0 +/\ (!i. vv i = +if i MOD 3 = 0 then v1 else +if i MOD 3 = 1 then v2 else v3) +/\ V= IMAGE vv (:num) /\ E= IMAGE (\i. {vv i, vv (SUC i)}) (:num) +/\ FF= IMAGE (\i. vv i,vv (SUC i)) (:num) +==> + (!i. vv (i MOD (CARD V))= vv i) +/\ V SUBSET ball_annulus /\ +CARD V =3/\ + (!v w. {v,w} IN E ==> &2 <= dist(v,w) /\ dist(v,w) <= &2 * h0)`, + (* {{{ proof *) +[ +STRIP_TAC +THEN SUBGOAL_THEN`(!i. (vv:num->real^3) (i MOD 3)= vv i)`ASSUME_TAC; + +ASM_SIMP_TAC[MOD_MOD_REFL;ARITH_RULE`~(3=0)`]; + +SUBGOAL_THEN`(V:real^3->bool)={v1,v2,v3}`ASSUME_TAC; + +ASM_REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM] +THEN GEN_TAC +THEN EQ_TAC; + +STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`x' MOD 3= 0 \/ x' MOD 3= 1\/ x' MOD 3=2`) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN SET_TAC[]; + +STRIP_TAC +THEN MP_TAC(SET_RULE`x IN {v1, v2, v3:real^3} ==> x = v1 \/ x= v2 \/ x= v3`) +THEN RESA_TAC; + +EXISTS_TAC`0:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`0 MOD 3 = 0`] +THEN SET_TAC[]; + +EXISTS_TAC`1:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`1 MOD 3 = 1/\ ~(1 MOD 3 = 0)`] +THEN SET_TAC[]; + +EXISTS_TAC`2:num` +THEN ASM_REWRITE_TAC[ARITH_RULE`~(2 MOD 3 = 1) /\ ~(2 MOD 3 = 0)`] +THEN SET_TAC[]; + +SUBGOAL_THEN(`~(v1=v2:real^3) /\ ~(v1=v3:real^3) /\ ~(v3=v2:real^3)`)ASSUME_TAC; + +STRIP_TAC; + +STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;DIST_REFL]) +THEN REAL_ARITH_TAC; + +STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;DIST_REFL]) +THEN REAL_ARITH_TAC; + +SUBGOAL_THEN`CARD (V:real^3->bool)=3` ASSUME_TAC; + +POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; + IN_INSERT; NOT_IN_EMPTY;] +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN ARITH_TAC; + +POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> + POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[GSYM th]) +THEN ASSUME_TAC th) +THEN ASM_SIMP_TAC[MOD_MOD_REFL;ARITH_RULE`~(3=0)`] +THEN STRIP_TAC; + +MATCH_MP_TAC(SET_RULE`(v1 IN ball_annulus +/\ v2 IN ball_annulus /\ v3 IN ball_annulus)==> {v1, v2, v3} SUBSET ball_annulus `) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[ball_annulus;DIFF;cball;ball;IN_ELIM_THM; REAL_ARITH`~(a< &2)<=> &2<=a`;DIST_0]; + +REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3= 0 \/ x MOD 3= 1\/ x MOD 3=2`) +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[]; + +MRESAL_TAC (GEN_ALL IMP_SUC_MOD_EQ)[`x:num`;`0`;`3`][ARITH_RULE`~(3=0)/\ 0 MOD 3=0/\ SUC 0 MOD 3=1/\ ~(1=0)`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`{v, w} = {v1, v2} /\ ~(v1=v2) ==>(v=v1 /\ w=v2)\/ (v=v2 /\ + w=v1:real^3)`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]; + +MRESAL_TAC (GEN_ALL IMP_SUC_MOD_EQ)[`x:num`;`1`;`3`][ARITH_RULE`~(3=0)/\ 1 MOD 3=1/\ SUC 1 MOD 3=2/\ ~(1=0)/\ ~(2=1)/\ ~(2=0)`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`{v, w} = {v2, v3} /\ ~(v3=v2) ==>(v=v2 /\ w=v3)\/ (v=v3 /\ + w=v2:real^3)`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[]; + +MRESAL_TAC (GEN_ALL IMP_SUC_MOD_EQ)[`x:num`;`2`;`3`][ARITH_RULE`~(3=0)/\ 2 MOD 3=2/\ SUC 2 MOD 3=0/\ ~(1=0)/\ ~(2=1)/\ ~(2=0)`] +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`{v, w} = {v3, v1} /\ ~(v1=v3) ==>(v=v1 /\ w=v3)\/ (v=v3 /\ + w=v1:real^3)`) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +]);; + (* }}} *) + + + +let ZITHLQN=prove_by_refinement(`(!s vv. MEM s s_init_list_v39 /\ vv IN + BBs_v39 s ==> + &0 <= taustar_v39 s vv) ==> JEJTVGB_assume_v39`, + (* {{{ proof *) +[ +REWRITE_TAC[IMP_CONJ] +THEN REWRITE_TAC[s_init_list_v39;JEJTVGB_assume_v39;GSYM IN_SET_OF_LIST;taustar_v39] +THEN REPEAT STRIP_TAC; + +MP_TAC(ARITH_RULE`4<= CARD(V:real^3->bool) /\ CARD(V:real^3->bool)<= 6 +==> CARD V= 4\/ CARD V=5 \/ CARD V=6 `) +THEN RESA_TAC; + +ABBREV_TAC`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (d_tame 4) (cs_adj 4 (&2) (&2 * h0)) (cs_adj 4 (&2 * h0) upperbd))` +THEN SUBGOAL_THEN +`s IN + set_of_list + (let upperbd = &6 in + let a_pro = + (\k p a1 a2 i j. + if i MOD k = j MOD k + then &0 + else if {i MOD k, j MOD k} = {0, 1} + then p + else if j MOD k = SUC i MOD k \/ + SUC j MOD k = i MOD k + then a1 + else a2) in + [mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (&2 * h0)) + (cs_adj 6 (&2 * h0) upperbd); mk_unadorned_v39 5 (d_tame 5) + (cs_adj 5 (&2) (&2 * h0)) + (cs_adj 5 (&2 * h0) upperbd); + mk_unadorned_v39 4 (d_tame 4) (cs_adj 4 (&2) (&2 * h0)) + (cs_adj 4 (&2 * h0) upperbd); mk_unadorned_v39 3 (d_tame 3) + (cs_adj 3 (&2) (&2 * h0)) + (cs_adj 3 (&2 * h0) upperbd); + mk_unadorned_v39 5 #0.616 (cs_adj 5 (&2) sqrt8) + (cs_adj 5 (&2 * h0) upperbd); mk_unadorned_v39 4 #0.467 + (cs_adj 4 (&2) (&3)) + (cs_adj 4 (&2 * h0) upperbd); + mk_unadorned_v39 5 #0.616 (a_pro 5 (&2 * h0) (&2) (&2 * h0)) + (a_pro 5 sqrt8 (&2 * h0) upperbd); mk_unadorned_v39 4 #0.477 + (a_pro 4 (&2 * h0) (&2) sqrt8) + (a_pro 4 sqrt8 (&2 * h0) + upperbd)])` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM;] +THEN SET_TAC[]; + +MP_TAC exists_vv +THEN ASM_REWRITE_TAC[ARITH_RULE`3<=4`] +THEN STRIP_TAC +THEN MP_TAC ZITHLQN_CASE_4 +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN GEN_REWRITE_TAC( LAND_CONV o ONCE_DEPTH_CONV)[GSYM th] +THEN ASM_REWRITE_TAC[]) +THEN STRIP_TAC +THEN REPLICATE_TAC 15 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`vv:num->real^3`]) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM] +THEN SUBGOAL_THEN`~(scs_k_v39 s <= 3)` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM +;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;CS_ADJ]; + +ASM_REWRITE_TAC[d_tame] +THEN MP_TAC dsv_scs_init +THEN ASM_REWRITE_TAC[s_init_list_v39;JEJTVGB_assume_v39;GSYM IN_SET_OF_LIST;taustar_v39] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_d_v39_explicit;LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM +;ARITH_RULE`~(4=3)`;d_tame;mk_unadorned_v39;CS_ADJ] +THEN REAL_ARITH_TAC; + +ABBREV_TAC`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (d_tame 5) (cs_adj 5 (&2) (&2 * h0)) (cs_adj 5 (&2 * h0) upperbd) )` +THEN SUBGOAL_THEN +`s IN + set_of_list + (let upperbd = &6 in + let a_pro = + (\k p a1 a2 i j. + if i MOD k = j MOD k + then &0 + else if {i MOD k, j MOD k} = {0, 1} + then p + else if j MOD k = SUC i MOD k \/ + SUC j MOD k = i MOD k + then a1 + else a2) in + [mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (&2 * h0)) + (cs_adj 6 (&2 * h0) upperbd); mk_unadorned_v39 5 (d_tame 5) + (cs_adj 5 (&2) (&2 * h0)) + (cs_adj 5 (&2 * h0) upperbd); + mk_unadorned_v39 4 (d_tame 4) (cs_adj 4 (&2) (&2 * h0)) + (cs_adj 4 (&2 * h0) upperbd); mk_unadorned_v39 3 (d_tame 3) + (cs_adj 3 (&2) (&2 * h0)) + (cs_adj 3 (&2 * h0) upperbd); + mk_unadorned_v39 5 #0.616 (cs_adj 5 (&2) sqrt8) + (cs_adj 5 (&2 * h0) upperbd); mk_unadorned_v39 4 #0.467 + (cs_adj 4 (&2) (&3)) + (cs_adj 4 (&2 * h0) upperbd); + mk_unadorned_v39 5 #0.616 (a_pro 5 (&2 * h0) (&2) (&2 * h0)) + (a_pro 5 sqrt8 (&2 * h0) upperbd); mk_unadorned_v39 4 #0.477 + (a_pro 4 (&2 * h0) (&2) sqrt8) + (a_pro 4 sqrt8 (&2 * h0) + upperbd)])` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM;mk_unadorned_v39] +THEN SET_TAC[]; + +MP_TAC exists_vv +THEN ASM_REWRITE_TAC[ARITH_RULE`3<=5`] +THEN STRIP_TAC +THEN MP_TAC ZITHLQN_CASE_5 +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN GEN_REWRITE_TAC( LAND_CONV o ONCE_DEPTH_CONV)[GSYM th] +THEN ASM_REWRITE_TAC[]) +THEN STRIP_TAC +THEN REPLICATE_TAC 15 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`vv:num->real^3`]) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM] +THEN SUBGOAL_THEN`~(scs_k_v39 s <= 3)` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM +;ARITH_RULE`~(5<=3)`;mk_unadorned_v39;CS_ADJ]; + +ASM_REWRITE_TAC[d_tame] +THEN MP_TAC dsv_scs_init +THEN ASM_REWRITE_TAC[s_init_list_v39;JEJTVGB_assume_v39;GSYM IN_SET_OF_LIST;taustar_v39] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_d_v39_explicit;LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM +;ARITH_RULE`~(5=3)`;d_tame;mk_unadorned_v39;CS_ADJ] +THEN REAL_ARITH_TAC; + +ABBREV_TAC`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (&2 * h0)) (cs_adj 6 (&2 * h0) upperbd) )` +THEN SUBGOAL_THEN +`s IN + set_of_list + (let upperbd = &6 in + let a_pro = + (\k p a1 a2 i j. + if i MOD k = j MOD k + then &0 + else if {i MOD k, j MOD k} = {0, 1} + then p + else if j MOD k = SUC i MOD k \/ + SUC j MOD k = i MOD k + then a1 + else a2) in + [mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (&2 * h0)) + (cs_adj 6 (&2 * h0) upperbd); mk_unadorned_v39 5 (d_tame 5) + (cs_adj 5 (&2) (&2 * h0)) + (cs_adj 5 (&2 * h0) upperbd); + mk_unadorned_v39 4 (d_tame 4) (cs_adj 4 (&2) (&2 * h0)) + (cs_adj 4 (&2 * h0) upperbd); mk_unadorned_v39 3 (d_tame 3) + (cs_adj 3 (&2) (&2 * h0)) + (cs_adj 3 (&2 * h0) upperbd); + mk_unadorned_v39 5 #0.616 (cs_adj 5 (&2) sqrt8) + (cs_adj 5 (&2 * h0) upperbd); mk_unadorned_v39 4 #0.467 + (cs_adj 4 (&2) (&3)) + (cs_adj 4 (&2 * h0) upperbd); + mk_unadorned_v39 5 #0.616 (a_pro 5 (&2 * h0) (&2) (&2 * h0)) + (a_pro 5 sqrt8 (&2 * h0) upperbd); mk_unadorned_v39 4 #0.477 + (a_pro 4 (&2 * h0) (&2) sqrt8) + (a_pro 4 sqrt8 (&2 * h0) + upperbd)])` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM;mk_unadorned_v39] +THEN SET_TAC[]; + +MP_TAC exists_vv +THEN ASM_REWRITE_TAC[ARITH_RULE`3<=6`] +THEN STRIP_TAC +THEN MP_TAC ZITHLQN_CASE_6 +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN GEN_REWRITE_TAC( LAND_CONV o ONCE_DEPTH_CONV)[GSYM th] +THEN ASM_REWRITE_TAC[]) +THEN STRIP_TAC +THEN REPLICATE_TAC 15 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`vv:num->real^3`]) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM] +THEN SUBGOAL_THEN`~(scs_k_v39 s <= 3)` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM +;ARITH_RULE`~(6<=3)`;mk_unadorned_v39;CS_ADJ]; + +ASM_REWRITE_TAC[d_tame] +THEN MP_TAC dsv_scs_init +THEN ASM_REWRITE_TAC[s_init_list_v39;JEJTVGB_assume_v39;GSYM IN_SET_OF_LIST;taustar_v39] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_d_v39_explicit;LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM +;ARITH_RULE`~(6=3)`;d_tame;mk_unadorned_v39;CS_ADJ] +THEN REAL_ARITH_TAC; + +ABBREV_TAC `(vv i = +if i MOD 3 = 0 then v1 else +if i MOD 3 = 1 then v2 else v3:real^3)` +THEN ABBREV_TAC`V = IMAGE (vv:num->real^3) (:num)` +THEN ABBREV_TAC` E= IMAGE (\i. {(vv:num->real^3) i, vv (SUC i)}) (:num) ` +THEN ABBREV_TAC` FF= IMAGE (\i. vv i,(vv:num->real^3) (SUC i)) (:num) ` +THEN ABBREV_TAC`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 3 (d_tame 3) (cs_adj 3 (&2) (&2 * h0)) (cs_adj 3 (&2 * h0) upperbd))` +THEN SUBGOAL_THEN +`s IN + set_of_list + (let upperbd = &6 in + let a_pro = + (\k p a1 a2 i j. + if i MOD k = j MOD k + then &0 + else if {i MOD k, j MOD k} = {0, 1} + then p + else if j MOD k = SUC i MOD k \/ + SUC j MOD k = i MOD k + then a1 + else a2) in + [mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (&2 * h0)) + (cs_adj 6 (&2 * h0) upperbd); mk_unadorned_v39 5 (d_tame 5) + (cs_adj 5 (&2) (&2 * h0)) + (cs_adj 5 (&2 * h0) upperbd); + mk_unadorned_v39 4 (d_tame 4) (cs_adj 4 (&2) (&2 * h0)) + (cs_adj 4 (&2 * h0) upperbd); mk_unadorned_v39 3 (d_tame 3) + (cs_adj 3 (&2) (&2 * h0)) + (cs_adj 3 (&2 * h0) upperbd); + mk_unadorned_v39 5 #0.616 (cs_adj 5 (&2) sqrt8) + (cs_adj 5 (&2 * h0) upperbd); mk_unadorned_v39 4 #0.467 + (cs_adj 4 (&2) (&3)) + (cs_adj 4 (&2 * h0) upperbd); + mk_unadorned_v39 5 #0.616 (a_pro 5 (&2 * h0) (&2) (&2 * h0)) + (a_pro 5 sqrt8 (&2 * h0) upperbd); mk_unadorned_v39 4 #0.477 + (a_pro 4 (&2 * h0) (&2) sqrt8) + (a_pro 4 sqrt8 (&2 * h0) + upperbd)])` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM;mk_unadorned_v39] +THEN SET_TAC[]; + +MP_TAC exists_vv3 +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC ZITHLQN_CASE_3 +THEN REPLICATE_TAC 4 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN GEN_REWRITE_TAC( LAND_CONV o ONCE_DEPTH_CONV)[GSYM th] +THEN ASM_REWRITE_TAC[]) +THEN SIMP_TAC[MOD_MOD_REFL;ARITH_RULE`~(3=0)`] +THEN STRIP_TAC +THEN REPLICATE_TAC 22 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`vv:num->real^3`]) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM] +THEN SUBGOAL_THEN`(scs_k_v39 s <= 3)` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM +;ARITH_RULE`(3<=3)`;mk_unadorned_v39;CS_ADJ]; + +ASM_REWRITE_TAC[d_tame] +THEN MP_TAC dsv_scs_init +THEN ASM_REWRITE_TAC[s_init_list_v39;JEJTVGB_assume_v39;GSYM IN_SET_OF_LIST;taustar_v39] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_d_v39_explicit;LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM +;ARITH_RULE`~(6=3)`;d_tame;mk_unadorned_v39;CS_ADJ] +THEN REPLICATE_TAC 11 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> REWRITE_TAC[GSYM th;]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`0 MOD 3=0/\ 1 MOD 3=1 /\ 2 MOD 3=2/\ ~(1=0)/\ ~(2=0)/\ ~(2=1)`] +THEN REAL_ARITH_TAC; + +ABBREV_TAC`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (#0.616) (cs_adj 5 (&2) (sqrt8)) (cs_adj 5 (&2 * h0) upperbd) )` +THEN SUBGOAL_THEN +`s IN + set_of_list + (let upperbd = &6 in + let a_pro = + (\k p a1 a2 i j. + if i MOD k = j MOD k + then &0 + else if {i MOD k, j MOD k} = {0, 1} + then p + else if j MOD k = SUC i MOD k \/ + SUC j MOD k = i MOD k + then a1 + else a2) in + [mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (&2 * h0)) + (cs_adj 6 (&2 * h0) upperbd); mk_unadorned_v39 5 (d_tame 5) + (cs_adj 5 (&2) (&2 * h0)) + (cs_adj 5 (&2 * h0) upperbd); + mk_unadorned_v39 4 (d_tame 4) (cs_adj 4 (&2) (&2 * h0)) + (cs_adj 4 (&2 * h0) upperbd); mk_unadorned_v39 3 (d_tame 3) + (cs_adj 3 (&2) (&2 * h0)) + (cs_adj 3 (&2 * h0) upperbd); + mk_unadorned_v39 5 #0.616 (cs_adj 5 (&2) sqrt8) + (cs_adj 5 (&2 * h0) upperbd); mk_unadorned_v39 4 #0.467 + (cs_adj 4 (&2) (&3)) + (cs_adj 4 (&2 * h0) upperbd); + mk_unadorned_v39 5 #0.616 (a_pro 5 (&2 * h0) (&2) (&2 * h0)) + (a_pro 5 sqrt8 (&2 * h0) upperbd); mk_unadorned_v39 4 #0.477 + (a_pro 4 (&2 * h0) (&2) sqrt8) + (a_pro 4 sqrt8 (&2 * h0) + upperbd)])` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM;mk_unadorned_v39] +THEN SET_TAC[]; + +MP_TAC exists_vv +THEN ASM_REWRITE_TAC[ARITH_RULE`3<=5/\ 5<=6`] +THEN STRIP_TAC +THEN MP_TAC ZITHLQN_CASE_5_sqrt8 +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN GEN_REWRITE_TAC( LAND_CONV o ONCE_DEPTH_CONV)[GSYM th] +THEN ASM_REWRITE_TAC[]) +THEN STRIP_TAC +THEN REPLICATE_TAC 13 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`vv:num->real^3`]) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM] +THEN SUBGOAL_THEN`~(scs_k_v39 s <= 3)` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM +;ARITH_RULE`~(5<=3)`;mk_unadorned_v39;CS_ADJ]; + +ASM_REWRITE_TAC[d_tame] +THEN MP_TAC dsv_scs_init +THEN ASM_REWRITE_TAC[s_init_list_v39;JEJTVGB_assume_v39;GSYM IN_SET_OF_LIST;taustar_v39] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_d_v39_explicit;LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM +;ARITH_RULE`~(5=3)`;d_tame;mk_unadorned_v39;CS_ADJ] +THEN REAL_ARITH_TAC; + +ABBREV_TAC`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 5 (#0.616) (a_pro 5 (&2 * h0) (&2) (&2 * h0)) (a_pro 5 sqrt8 (&2 * h0) upperbd) )` +THEN SUBGOAL_THEN +`s IN + set_of_list + (let upperbd = &6 in + let a_pro = + (\k p a1 a2 i j. + if i MOD k = j MOD k + then &0 + else if {i MOD k, j MOD k} = {0, 1} + then p + else if j MOD k = SUC i MOD k \/ + SUC j MOD k = i MOD k + then a1 + else a2) in + [mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (&2 * h0)) + (cs_adj 6 (&2 * h0) upperbd); mk_unadorned_v39 5 (d_tame 5) + (cs_adj 5 (&2) (&2 * h0)) + (cs_adj 5 (&2 * h0) upperbd); + mk_unadorned_v39 4 (d_tame 4) (cs_adj 4 (&2) (&2 * h0)) + (cs_adj 4 (&2 * h0) upperbd); mk_unadorned_v39 3 (d_tame 3) + (cs_adj 3 (&2) (&2 * h0)) + (cs_adj 3 (&2 * h0) upperbd); + mk_unadorned_v39 5 #0.616 (cs_adj 5 (&2) sqrt8) + (cs_adj 5 (&2 * h0) upperbd); mk_unadorned_v39 4 #0.467 + (cs_adj 4 (&2) (&3)) + (cs_adj 4 (&2 * h0) upperbd); + mk_unadorned_v39 5 #0.616 (a_pro 5 (&2 * h0) (&2) (&2 * h0)) + (a_pro 5 sqrt8 (&2 * h0) upperbd); mk_unadorned_v39 4 #0.477 + (a_pro 4 (&2 * h0) (&2) sqrt8) + (a_pro 4 sqrt8 (&2 * h0) + upperbd)])` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM;mk_unadorned_v39] +THEN SET_TAC[]; + +MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IN_E_IMP_IN_FF) +[`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w0:real^3`;`v0:real^3`;`FF:real^3#real^3->bool`;]; + +MRESA_TAC(GEN_ALL exists_vv_FF) +[`v0:real^3`;`w0:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`3<=5 /\ 5<=6`] +THEN STRIP_TAC +THEN MP_TAC ZITHLQN_CASE_5_pro_cs +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC( LAND_CONV o ONCE_DEPTH_CONV)[GSYM th] +) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REPLICATE_TAC 21 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`vv:num->real^3`]) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM] +THEN SUBGOAL_THEN`~(scs_k_v39 s <= 3)` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM +;ARITH_RULE`~(5<=3)`;mk_unadorned_v39;CS_ADJ]; + +ASM_REWRITE_TAC[d_tame] +THEN MP_TAC dsv_scs_init +THEN ASM_REWRITE_TAC[s_init_list_v39;JEJTVGB_assume_v39;GSYM IN_SET_OF_LIST;taustar_v39] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_d_v39_explicit;LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM +;ARITH_RULE`~(5=3)`;d_tame;mk_unadorned_v39;CS_ADJ] +THEN REAL_ARITH_TAC; + +MRESA_TAC(GEN_ALL exists_vv_FF) +[`w0:real^3`;`v0:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`3<=5 /\ 5<=6`] +THEN STRIP_TAC +THEN MP_TAC (ISPECL [`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;`w0:real^3`;`v0:real^3`;`vv:num->real^3`;`s:scs_v39`] +(GEN_ALL ZITHLQN_CASE_5_pro_cs)) +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[DIST_SYM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC( LAND_CONV o ONCE_DEPTH_CONV)[GSYM th] +) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{w, v} = {v0, w0}<=> {w, v} = {w0, v0}`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th] +THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN STRIP_TAC +THEN REPLICATE_TAC 21 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`vv:num->real^3`]) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM] +THEN SUBGOAL_THEN`~(scs_k_v39 s <= 3)` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM +;ARITH_RULE`~(5<=3)`;mk_unadorned_v39;CS_ADJ]; + +ASM_REWRITE_TAC[d_tame] +THEN MP_TAC dsv_scs_init +THEN ASM_REWRITE_TAC[s_init_list_v39;JEJTVGB_assume_v39;GSYM IN_SET_OF_LIST;taustar_v39] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_d_v39_explicit;LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM +;ARITH_RULE`~(5=3)`;d_tame;mk_unadorned_v39;CS_ADJ] +THEN REAL_ARITH_TAC; + +ABBREV_TAC`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (#0.477) (a_pro 4 (&2 * h0) (&2) sqrt8) (a_pro 4 sqrt8 (&2 * h0) upperbd) )` +THEN SUBGOAL_THEN +`s IN + set_of_list + (let upperbd = &6 in + let a_pro = + (\k p a1 a2 i j. + if i MOD k = j MOD k + then &0 + else if {i MOD k, j MOD k} = {0, 1} + then p + else if j MOD k = SUC i MOD k \/ + SUC j MOD k = i MOD k + then a1 + else a2) in + [mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (&2 * h0)) + (cs_adj 6 (&2 * h0) upperbd); mk_unadorned_v39 5 (d_tame 5) + (cs_adj 5 (&2) (&2 * h0)) + (cs_adj 5 (&2 * h0) upperbd); + mk_unadorned_v39 4 (d_tame 4) (cs_adj 4 (&2) (&2 * h0)) + (cs_adj 4 (&2 * h0) upperbd); mk_unadorned_v39 3 (d_tame 3) + (cs_adj 3 (&2) (&2 * h0)) + (cs_adj 3 (&2 * h0) upperbd); + mk_unadorned_v39 5 #0.616 (cs_adj 5 (&2) sqrt8) + (cs_adj 5 (&2 * h0) upperbd); mk_unadorned_v39 4 #0.467 + (cs_adj 4 (&2) (&3)) + (cs_adj 4 (&2 * h0) upperbd); + mk_unadorned_v39 5 #0.616 (a_pro 5 (&2 * h0) (&2) (&2 * h0)) + (a_pro 5 sqrt8 (&2 * h0) upperbd); mk_unadorned_v39 4 #0.477 + (a_pro 4 (&2 * h0) (&2) sqrt8) + (a_pro 4 sqrt8 (&2 * h0) + upperbd)])` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM;mk_unadorned_v39] +THEN SET_TAC[]; + +MRESA_TAC convex_local_fan [`FF:real^3#real^3->bool`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;] +THEN MRESA_TAC (GEN_ALL Local_lemmas.LOFA_IN_E_IMP_IN_FF) +[`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w0:real^3`;`v0:real^3`;`FF:real^3#real^3->bool`;]; + +MRESA_TAC(GEN_ALL exists_vv_FF) +[`v0:real^3`;`w0:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`3<=4 /\ 4<=6`] +THEN STRIP_TAC +THEN MP_TAC ZITHLQN_CASE_4_pro_cs +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC( LAND_CONV o ONCE_DEPTH_CONV)[GSYM th] +) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN REPLICATE_TAC 21 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`vv:num->real^3`]) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM] +THEN SUBGOAL_THEN`~(scs_k_v39 s <= 3)` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM +;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;CS_ADJ]; + +ASM_REWRITE_TAC[d_tame] +THEN MP_TAC dsv_scs_init +THEN ASM_REWRITE_TAC[s_init_list_v39;JEJTVGB_assume_v39;GSYM IN_SET_OF_LIST;taustar_v39] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_d_v39_explicit;LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM +;ARITH_RULE`~(5=3)`;d_tame;mk_unadorned_v39;CS_ADJ] +THEN REAL_ARITH_TAC; + +MRESA_TAC(GEN_ALL exists_vv_FF) +[`w0:real^3`;`v0:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ARITH_RULE`3<=4 /\ 4<=6`] +THEN STRIP_TAC +THEN MP_TAC (ISPECL [`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`FF:real^3#real^3->bool`;`w0:real^3`;`v0:real^3`;`vv:num->real^3`;`s:scs_v39`] +(GEN_ALL ZITHLQN_CASE_4_pro_cs)) +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN ASM_REWRITE_TAC[DIST_SYM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC( LAND_CONV o ONCE_DEPTH_CONV)[GSYM th] +) +THEN ASM_REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{w, v} = {v0, w0}<=> {w, v} = {w0, v0}`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th] +THEN ASSUME_TAC th) +THEN STRIP_TAC +THEN STRIP_TAC +THEN REPLICATE_TAC 21 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`vv:num->real^3`]) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM] +THEN SUBGOAL_THEN`~(scs_k_v39 s <= 3)` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM +;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;CS_ADJ]; + +ASM_REWRITE_TAC[d_tame] +THEN MP_TAC dsv_scs_init +THEN ASM_REWRITE_TAC[s_init_list_v39;JEJTVGB_assume_v39;GSYM IN_SET_OF_LIST;taustar_v39] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_d_v39_explicit;LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM +;ARITH_RULE`~(4=3)`;d_tame;mk_unadorned_v39;CS_ADJ] +THEN REAL_ARITH_TAC; + +ABBREV_TAC`(s=let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. (if (i MOD k = j MOD k) then &0 + else (if {i MOD k,j MOD k}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + mk_unadorned_v39 4 (#0.467) (cs_adj 4 (&2) (&3)) (cs_adj 4 (&2 * h0) upperbd))` +THEN SUBGOAL_THEN +`s IN + set_of_list + (let upperbd = &6 in + let a_pro = + (\k p a1 a2 i j. + if i MOD k = j MOD k + then &0 + else if {i MOD k, j MOD k} = {0, 1} + then p + else if j MOD k = SUC i MOD k \/ + SUC j MOD k = i MOD k + then a1 + else a2) in + [mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (&2 * h0)) + (cs_adj 6 (&2 * h0) upperbd); mk_unadorned_v39 5 (d_tame 5) + (cs_adj 5 (&2) (&2 * h0)) + (cs_adj 5 (&2 * h0) upperbd); + mk_unadorned_v39 4 (d_tame 4) (cs_adj 4 (&2) (&2 * h0)) + (cs_adj 4 (&2 * h0) upperbd); mk_unadorned_v39 3 (d_tame 3) + (cs_adj 3 (&2) (&2 * h0)) + (cs_adj 3 (&2 * h0) upperbd); + mk_unadorned_v39 5 #0.616 (cs_adj 5 (&2) sqrt8) + (cs_adj 5 (&2 * h0) upperbd); mk_unadorned_v39 4 #0.467 + (cs_adj 4 (&2) (&3)) + (cs_adj 4 (&2 * h0) upperbd); + mk_unadorned_v39 5 #0.616 (a_pro 5 (&2 * h0) (&2) (&2 * h0)) + (a_pro 5 sqrt8 (&2 * h0) upperbd); mk_unadorned_v39 4 #0.477 + (a_pro 4 (&2 * h0) (&2) sqrt8) + (a_pro 4 sqrt8 (&2 * h0) + upperbd)])` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM;mk_unadorned_v39] +THEN SET_TAC[]; + +MP_TAC exists_vv +THEN ASM_REWRITE_TAC[ARITH_RULE`3<=4/\ 4<=6`] +THEN STRIP_TAC +THEN MP_TAC ZITHLQN_CASE_4_3 +THEN REPLICATE_TAC 5 (POP_ASSUM MP_TAC) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN GEN_REWRITE_TAC( LAND_CONV o ONCE_DEPTH_CONV)[GSYM th] +THEN ASM_REWRITE_TAC[]) +THEN STRIP_TAC +THEN REPLICATE_TAC 13 (POP_ASSUM MP_TAC) +THEN POP_ASSUM(fun th-> MRESA_TAC th[`s:scs_v39`;`vv:num->real^3`]) +THEN POP_ASSUM(fun th-> REPEAT STRIP_TAC THEN MP_TAC th) +THEN ASM_REWRITE_TAC[LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM] +THEN SUBGOAL_THEN`~(scs_k_v39 s <= 3)` ASSUME_TAC; + +EXPAND_TAC"s" +THEN REWRITE_TAC[scs_k_v39_explicit;LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM +;ARITH_RULE`~(4<=3)`;mk_unadorned_v39;CS_ADJ]; + +ASM_REWRITE_TAC[d_tame] +THEN MP_TAC dsv_scs_init +THEN ASM_REWRITE_TAC[s_init_list_v39;JEJTVGB_assume_v39;GSYM IN_SET_OF_LIST;taustar_v39] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"s" +THEN REWRITE_TAC[scs_d_v39_explicit;LET_DEF;LET_END_DEF;set_of_list; IN_ELIM_THM +;ARITH_RULE`~(4=3)`;d_tame;mk_unadorned_v39;CS_ADJ] +THEN REAL_ARITH_TAC; +]);; + (* }}} *) + + + + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/ZLZTHIC.hl b/text_formalization/local/ZLZTHIC.hl new file mode 100644 index 0000000..99978fa --- /dev/null +++ b/text_formalization/local/ZLZTHIC.hl @@ -0,0 +1,4009 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Section: Conclusions *) +(* Chapter: Local Fan *) +(* Lemma: ZLZTHIC *) +(* Author: Thomas Hales *) +(* Date: 2013-07-10 *) +(* ========================================================================== *) + + + +module Zlzthic = struct + + open Hales_tactic;; + + +let FOR_ASM th = + let th1 = REWRITE_RULE[MESON[]` a /\ b ==> c <=> a ==> b ==> c `] th in + let th2 = SPEC_ALL th1 in + UNDISCH_ALL th2;; + +let ASSUME_TAC2 = ASSUME_TAC o FOR_ASM;; +let DOWN = FIRST_X_ASSUM MP_TAC;; +let ATTACH thm = MATCH_MP (MESON[]` ! a b. ( a ==> b ) ==> ( a <=> a /\ b )`) thm;; +let NHANH tm = ONCE_REWRITE_TAC[ ATTACH (SPEC_ALL ( tm ))];; +let SWITCH_TAC tm = UNDISCH_TAC tm THEN DISCH_THEN (ASSUME_TAC o GSYM);; +let PHA = REWRITE_TAC[ MESON[] ` (a/\b)/\c <=> a/\ b /\ c `; MESON[]` a ==> b ==> c <=> a /\ b ==> c `];; + + + +let NONCOLLINEAR_OPEN = Local_lemmas1.CONTINUOUS_PRESERVE_COLLINEAR;; + +let NONPLANAR_OPEN = prove_by_refinement( + `!(v1:real->real^3) v2 v3 v4 t. ~coplanar {v1 t,v2 t,v3 t, v4 t} /\ + v1 continuous atreal t /\ v2 continuous atreal t /\ v3 continuous atreal t /\ + v4 continuous atreal t + ==> + (?e. &0 < e /\ !t'. abs(t - t') < e ==> ~coplanar {v1 t', v2 t' ,v3 t',v4 t'})`, + (* {{{ proof *) + [ + REWRITE_TAC[Oxlzlez.coplanar_delta_y]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `(\t. delta_y (dist (v1 t,v2 t)) (dist (v1 t,v3 t)) (dist (v1 t,v4 t)) (dist (v3 t,v4 t)) (dist (v2 t,v4 t)) (dist (v2 t,v3 t))) real_continuous atreal t` ENOUGH_TO_SHOW_TAC; + REWRITE_TAC[real_continuous_atreal]; + DISCH_THEN (C INTRO_TAC [`delta_y (dist (v1 t,v2 t)) (dist (v1 t,v3 t)) (dist (v1 t,v4 t)) (dist (v3 t,v4 t)) (dist (v2 t,v4 t)) (dist (v2 t,v3 t))`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `d` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t'`]); + ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[Sphere.delta_y;Sphere.delta_x]; + BY((REPEAT ( (MATCH_MP_TAC REAL_CONTINUOUS_ADD ORELSE MATCH_MP_TAC REAL_CONTINUOUS_SUB ORELSE MATCH_MP_TAC REAL_CONTINUOUS_MUL ORELSE MATCH_MP_TAC REAL_CONTINUOUS_NEG ORELSE MATCH_MP_TAC Local_lemmas1.CON_ATREAL_REAL_CON2_REDO) THEN (REPEAT CONJ_TAC))) THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let COLL_IFF_COLL_CROSS2 = prove_by_refinement( + `!v w. collinear {vec 0, v, w} <=> collinear {vec 0, w, v cross w}`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `s = {vec 0,v,w}`; + (ONCE_REWRITE_TAC[CROSS_SKEW]); + ONCE_REWRITE_TAC[SET_RULE `{a,b,(c:real^3)} = {a,c,b}`]; + (REWRITE_TAC[arith `-- (u:real^3) = (-- &1) % u`]); + GMATCH_SIMP_TAC COLLINEAR_SPECIAL_SCALE; + (ONCE_REWRITE_TAC[SET_RULE `{vec 0,a,(b:real^3)} = {vec 0,b,a}`]); + RULE_ASSUM_TAC( ONCE_REWRITE_RULE[SET_RULE `{a,b,(c:real^3)} = {a,c,b}`]); + REWRITE_TAC[arith` ~( -- &1 = &0)`]; + BY(ASM_MESON_TAC([Local_lemmas.COLL_IFF_COLL_CROSS])) + ]);; + (* }}} *) + +let azim_cross_0 = prove_by_refinement( + `!v w. ~(collinear {vec 0,v,w}) ==> ~(azim (vec 0) (v cross w) v w = &0)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[Local_lemmas1.AZIM_COND_FOR_COPLANAR;Local_lemmas.NOT_COLL_IMP_COPL;SET_RULE `{vec 0,v,w,v cross w} = {vec 0,v cross w,v,(w:real^3)}`]) + ]);; + (* }}} *) + +let wedge_ge_cross = prove_by_refinement( + `!v w. ~collinear {vec 0,v,w} ==> wedge_ge (vec 0) (v cross w) v w = aff_ge {vec 0, v cross w} {v, w}`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC Local_lemmas.WEDGE_GE_EQ_AFF_GE; + CONJ_TAC; + TYPIFY `&0 < sin(azim (vec 0) (v cross w) v w)` ENOUGH_TO_SHOW_TAC; + REWRITE_TAC[arith `a < pi <=> a <= pi /\ ~(a = pi)`]; + STRIP_TAC; + CONJ_TAC; + REWRITE_TAC[GSYM Local_lemmas.SIN_AZIM_POS_PI_LT]; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + BY(ASM_MESON_TAC[SIN_PI;arith `~(&0 < &0)`]); + REWRITE_TAC[Local_lemmas.SIN_AZIM_MUTUAL_SROSS]; + ONCE_REWRITE_TAC[CROSS_TRIPLE]; + BY(ASM_REWRITE_TAC[DOT_POS_LT;CROSS_EQ_0]); + ONCE_REWRITE_TAC[SET_RULE `{a,b,(c:real^3)} = {a,c,b}`]; + BY(ASM_MESON_TAC[COLL_IFF_COLL_CROSS2;Local_lemmas.COLL_IFF_COLL_CROSS]) + ]);; + (* }}} *) + +let azim_lt_pi_cross = prove_by_refinement( + `!u1 u2 u3. (&0 < azim (vec 0) u1 u2 u3 /\ azim(vec 0) u1 u2 u3 < pi) <=> &0 < (u1 cross u2) dot u3`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Trigonometry.JBDNJJB [`u1`;`u2`;`u3`]; + ONCE_REWRITE_TAC[Leaf_cell.RE_EQVL_SYM]; + REWRITE_TAC[Trigonometry2.re_eqvl]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + ASM_CASES_TAC `&0 < sin(azim(vec 0) u1 u2 u3)`; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `a < pi <=> a <= pi /\ ~(a = pi)`]; + REWRITE_TAC[GSYM Local_lemmas.SIN_AZIM_POS_PI_LT]; + ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`]; + CONJ2_TAC; + DISCH_THEN (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + BY(ASM_MESON_TAC[SIN_PI;arith `~(&0 < &0)`]); + BY(ASM_MESON_TAC[Counting_spheres.AZIM_NN;SIN_0;arith `&0 < x <=> &0 <= x /\ ~(x = &0)`;arith `~(&0 < &0)`]); + COMMENT "other direction"; + TYPED_ABBREV_TAC `s = sin (azim (vec 0) u1 u2 u3)`; + REWRITE_TAC[arith `&0 < t * s <=> ~(&0 <= t* (-- s))`]; + GMATCH_SIMP_TAC REAL_LE_MUL; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `~` MP_TAC; + EXPAND_TAC "s"; + REWRITE_TAC[]; + BY(ASM_MESON_TAC[SIN_POS_PI]) + ]);; + (* }}} *) + +let generic_alt = prove_by_refinement( + `!u v w. ~collinear {vec 0,v,w} /\ ~(u = vec 0) ==> + (aff_ge {vec 0} {v,w} INTER aff_lt {vec 0} {u} = {} <=> + ~coplanar {vec 0,u,v,w} \/ ((-- u) IN wedge (vec 0) (v cross w) w v))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (TAUT `((a ==>b) /\ (b ==> a)) ==> (a = b)`); + CONJ_TAC THEN STRIP_TAC; + MATCH_MP_TAC (TAUT `(a ==> b ) ==> (~a \/ b)`); + DISCH_TAC; + GMATCH_SIMP_TAC (GSYM Leaf_cell.WEDGE_GE_COMPLEMENT); + REWRITE_TAC[IN_DIFF;IN_UNIV]; + ASM_SIMP_TAC[azim_cross_0]; + ASM_SIMP_TAC[wedge_ge_cross]; + COMMENT "down to three"; + GMATCH_SIMP_TAC Marchal_cells_2_new.AFF_GE_2_2; + REWRITE_TAC[IN_ELIM_THM;arith `t1 % (vec 0):real^3 = vec 0`]; + CONJ_TAC; + TYPIFY `DISJOINT {v, w} {vec 0} /\ ~(v cross w = v) /\ ~(v cross w = w)` ENOUGH_TO_SHOW_TAC; + REWRITE_TAC[DISJOINT]; + BY(SET_TAC[]); + CONJ_TAC; + MATCH_MP_TAC Collect_geom.COLLINEAR_DISJOINT3; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[CROSS_EQ_SELF]; + BY(CONJ_TAC THEN ASM_MESON_TAC[COLLINEAR_2;SET_RULE `{vec 0,(v:real^3),vec 0} = {vec 0,v} /\ {vec 0,vec 0,(w:real^3)} = {vec 0,w}`]); + REPEAT WEAKER_STRIP_TAC; + RULE_ASSUM_TAC( REWRITE_RULE[arith `-- (u:real^3) = w <=> u = -- w`] ); + FIRST_X_ASSUM_ST `aff_ge` MP_TAC; + REWRITE_TAC[EXTENSION;NOT_IN_EMPTY;IN_INTER;NOT_FORALL_THM]; + TYPIFY `-- (u:real^3)` EXISTS_TAC; + CONJ2_TAC; + GMATCH_SIMP_TAC AFF_LT_1_1; + REWRITE_TAC[IN_ELIM_THM;DISJOINT]; + CONJ_TAC; + BY(ASM_TAC THEN SET_TAC[]); + GEXISTL_TAC [`&2`;`-- &1`]; + BY(REPEAT CONJ_TAC THEN TRY REAL_ARITH_TAC THEN VECTOR_ARITH_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[GSYM Local_lemmas.CROSS_DOT_COPLANAR]); + RULE_ASSUM_TAC(ONCE_REWRITE_RULE[CROSS_TRIPLE]); + FIRST_X_ASSUM_ST `x = &0` MP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[DOT_RNEG;DOT_RADD;DOT_RMUL]; + REWRITE_TAC[DOT_RZERO]; + REWRITE_TAC[DOT_CROSS_SELF]; + (REWRITE_TAC[arith `--(&0 + t2 * a + t3 * &0 + t4 * &0) = &0 <=> t2 * a = &0`]); + REWRITE_TAC[REAL_ENTIRE]; + ASM_SIMP_TAC[DOT_POS_LT;CROSS_EQ_0;arith `&0 < x ==> ~(x = &0)`]; + DISCH_THEN (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + REWRITE_TAC[arith `-- --(vec 0 + &0 % a + b + (c:real^3)) = b + c`]; + GMATCH_SIMP_TAC AFF_GE_1_2; + CONJ_TAC; + ONCE_REWRITE_TAC[DISJOINT_SYM] THEN MATCH_MP_TAC Collect_geom.COLLINEAR_DISJOINT3; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[IN_ELIM_THM]; + GEXISTL_TAC [`t1`;`t3`;`t4`]; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(VECTOR_ARITH_TAC); + COMMENT "second case"; + REWRITE_TAC[EXTENSION;NOT_IN_EMPTY;IN_INTER]; + GMATCH_SIMP_TAC AFF_GE_1_2; + CONJ_TAC; + ONCE_REWRITE_TAC[DISJOINT_SYM] THEN MATCH_MP_TAC Collect_geom.COLLINEAR_DISJOINT3; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[IN_ELIM_THM]; + GMATCH_SIMP_TAC Nkezbfc_local.AFF_LT_1_1; + ASM_REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[GSYM Local_lemmas.CROSS_DOT_COPLANAR]); + RULE_ASSUM_TAC(ONCE_REWRITE_RULE[CROSS_TRIPLE]); + TYPIFY `(v cross w) dot (t1 % vec 0 + t2 % v + t3 % w) = (v cross w) dot (t1' % vec 0 + t2' % u)` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[]); + REWRITE_TAC[DOT_RNEG;DOT_RADD;DOT_RMUL;DOT_RZERO;DOT_CROSS_SELF]; + TYPIFY `~(t2' * ((v cross w) dot u) = &0)` ENOUGH_TO_SHOW_TAC; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[REAL_ENTIRE]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + COMMENT "third and final case"; + REWRITE_TAC[EXTENSION;NOT_IN_EMPTY;IN_INTER]; + GMATCH_SIMP_TAC AFF_GE_1_2; + CONJ_TAC; + ONCE_REWRITE_TAC[DISJOINT_SYM] THEN MATCH_MP_TAC Collect_geom.COLLINEAR_DISJOINT3; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[IN_ELIM_THM]; + GMATCH_SIMP_TAC Nkezbfc_local.AFF_LT_1_1; + ASM_REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `x IN wedge (vec 0) (v cross w) w v` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `wedge` MP_TAC; + REWRITE_TAC[Reuhady.WEDGE_SIMPLE;IN_ELIM_THM]; + FIRST_X_ASSUM SUBST1_TAC; + TYPIFY `t1' % vec 0 + t2' % u = (-- t2') % (-- u)` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + FIRST_X_ASSUM_ST `t < &0` MP_TAC; + BY(MESON_TAC[AZIM_SCALE_ALL;arith `&0 < &1`;arith `t < &0 ==> &0 < -- t`;arith `&1 % (v:real^3) = v`]); + FIRST_X_ASSUM_ST `x = y` kill; + TYPIFY `~(x IN wedge (vec 0) (v cross w) w v)` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC (GSYM Leaf_cell.WEDGE_GE_COMPLEMENT); + (REWRITE_TAC[IN_DIFF;IN_UNIV]); + ASM_SIMP_TAC[azim_cross_0]; + ASM_SIMP_TAC[wedge_ge_cross]; + GMATCH_SIMP_TAC Marchal_cells_2_new.AFF_GE_2_2; + REWRITE_TAC[IN_ELIM_THM]; + CONJ_TAC; + TYPIFY `DISJOINT {v, w} {vec 0} /\ ~(v cross w = v) /\ ~(v cross w = w)` ENOUGH_TO_SHOW_TAC; + REWRITE_TAC[DISJOINT]; + BY(SET_TAC[]); + CONJ_TAC; + MATCH_MP_TAC Collect_geom.COLLINEAR_DISJOINT3; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[CROSS_EQ_SELF]; + BY(CONJ_TAC THEN ASM_MESON_TAC[COLLINEAR_2;SET_RULE `{vec 0,(v:real^3),vec 0} = {vec 0,v} /\ {vec 0,vec 0,(w:real^3)} = {vec 0,w}`]); + GEXISTL_TAC [`t1`;`&0`;`t2`;`t3`]; + REPEAT CONJ_TAC THEN ASM_TAC THEN TRY REAL_ARITH_TAC; + BY(REPEAT WEAKER_STRIP_TAC THEN VECTOR_ARITH_TAC); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let vuy1 = prove_by_refinement( + `!v u0 u1. + ~collinear {vec 0,u0,v} /\ ~collinear {vec 0,u0,u1} /\ v IN aff_ge {vec 0,u0} {u1} ==> + (?t0 t1. &0 < t1 /\ v = t0 % u0 + t1 % u1)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `aff_ge` MP_TAC; + GMATCH_SIMP_TAC AFF_GE_2_1; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + ASM_SIMP_TAC[Fan.th3a]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + GEXISTL_TAC [`t2`;`t3`]; + CONJ_TAC; + PROOF_BY_CONTR_TAC; + TYPIFY `t3 = &0` (C SUBGOAL_THEN MP_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + DISCH_THEN (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + TYPIFY `v = t2 % u0` (C SUBGOAL_THEN MP_TAC); + BY(ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + DISCH_THEN (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + BY(ASM_MESON_TAC[COLLINEAR_LEMMA_ALT]); + BY(VECTOR_ARITH_TAC) + ]);; + (* }}} *) + +let DISJOINT_PAIR = prove_by_refinement( + `!a b c. DISJOINT a {b,c} <=> DISJOINT a {b} /\ DISJOINT a {c}`, + (* {{{ proof *) + [ + REWRITE_TAC[DISJOINT]; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let vuy2 = prove_by_refinement( + `!v u0 u1. + ~collinear {vec 0, u0, v} /\ + ~collinear {vec 0, u0, u1} /\ + v IN aff_ge {vec 0, u0} {u1} ==> + (u0 cross u1) dot v = &0`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC vuy1 [`v`;`u0`;`u1`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[DOT_RADD;DOT_RMUL;DOT_CROSS_SELF]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let vuy3 = prove_by_refinement( + `!v u0 u1. ~collinear {vec 0, u0, v} /\ + ~collinear {vec 0, u0, u1} /\ + v IN aff_ge {vec 0, u0} {u1} ==> + ~collinear {vec 0,u0 cross u1, v}`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + DISCH_TAC; + REWRITE_TAC[COLLINEAR_LEMMA_ALT;DE_MORGAN_THM]; + SUBCONJ_TAC; + BY(ASM_REWRITE_TAC[CROSS_EQ_0]); + ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + INTRO_TAC vuy1 [`v`;`u0`;`u1`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `v dot v = c % (u0 cross u1) dot (t0 % u0 + t1 % u1)` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[]); + REWRITE_TAC[DOT_RMUL;DOT_LMUL;DOT_RADD;DOT_CROSS_SELF]; + TYPIFY ` c * (t0 * &0 + t1 * &0) = &0` (C SUBGOAL_THEN SUBST1_TAC); + BY(REAL_ARITH_TAC); + REWRITE_TAC[DOT_EQ_0]; + DISCH_TAC; + BY(ASM_MESON_TAC[COLLINEAR_2;SET_RULE `{vec 0,u0,vec 0} = {vec 0,(u0:real^3)}`]) + ]);; + (* }}} *) + +let vuy4 = prove_by_refinement( + `!v u0 u1. ~collinear {vec 0, u0, v} /\ + ~collinear {vec 0, u0, u1} /\ + v IN aff_ge {vec 0, u0} {u1} ==> + azim (vec 0) (u0 cross u1) u0 v < pi`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `&0 < ((u0 cross u1) cross u0) dot v` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[azim_lt_pi_cross]); + INTRO_TAC vuy1 [`v`;`u0`;`u1`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[CROSS_TRIPLE]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[CROSS_RMUL;DOT_LMUL;CROSS_RADD;DOT_CROSS_SELF;CROSS_REFL;arith `t % vec 0 + (a:real^3) = a`]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[DOT_POS_LT;CROSS_EQ_0]) + ]);; + (* }}} *) + +let vuy5 = prove_by_refinement( + `!v u0 u1. + ~collinear {vec 0, u0, u1} ==> + u0 IN aff_ge {vec 0,u0} {u1}`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC AFF_GE_2_1; + ASM_SIMP_TAC[Fan.th3a]; + REWRITE_TAC[IN_ELIM_THM]; + GEXISTL_TAC [`&0`;`&1`;`&0`]; + REPEAT CONJ_TAC THEN TRY REAL_ARITH_TAC; + BY(VECTOR_ARITH_TAC) + ]);; + (* }}} *) + +let cross_independent = prove_by_refinement( + `!u0 u1 a b c. ~collinear {vec 0,u0,u1} /\ + a % (u0 cross u1) + b % u0 + c % u1 = vec 0 ==> a = &0`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY ` (u0 cross u1) dot ( (--b) % u0 + (--c) % u1 ) = a * ((u0 cross u1) dot (u0 cross u1))` (C SUBGOAL_THEN MP_TAC); + REWRITE_TAC[GSYM DOT_RMUL]; + TYPIFY `a % (u0 cross u1) = -- b % u0 + -- c % u1` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN VECTOR_ARITH_TAC); + REWRITE_TAC[DOT_RADD;DOT_RMUL;DOT_RZERO;DOT_CROSS_SELF]; + REWRITE_TAC[arith `-- b * &0 + -- c * &0 = x <=> x = &0`]; + REWRITE_TAC[REAL_ENTIRE;DOT_EQ_0]; + BY(ASM_REWRITE_TAC[CROSS_EQ_0]) + ]);; + (* }}} *) + +let ybt_inj = prove_by_refinement( + `!u0 u1 v1 v2 . ~collinear {vec 0, u0, v1} /\ + ~collinear {vec 0, u0, v2} /\ + ~collinear {vec 0, u0, u1} /\ ~collinear {vec 0,v1,v2} /\ + v1 IN aff_ge {vec 0, u0} {u1} /\ v2 IN aff_ge {vec 0, u0} {u1} ==> +~( azim (vec 0) (u0 cross u1) u0 v1 = azim (vec 0) (u0 cross u1) u0 v2) + `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Topology.th [`(vec 0):real^3`;`u0 cross u1`;`u0`;`v2`]; + REWRITE_TAC[EXTENSION;IN_ELIM_THM]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + ASM_SIMP_TAC[vuy3]; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,(b:real^3)}`]; + BY(ASM_MESON_TAC[Local_lemmas.COLL_IFF_COLL_CROSS]); + DISCH_THEN (C INTRO_TAC [`v1`]); + ASM_SIMP_TAC[vuy3]; + DISCH_TAC; + INTRO_TAC vuy1 [`v1`;`u0`;`u1`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `aff_gt` MP_TAC; + REWRITE_TAC[]; + GMATCH_SIMP_TAC AFF_GT_2_1; + CONJ_TAC; + REWRITE_TAC[DISJOINT;EXTENSION;IN_INTER;IN_SING;IN_INSERT;NOT_IN_EMPTY]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + FIRST_X_ASSUM DISJ_CASES_TAC; + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + BY(ASM_MESON_TAC[COLLINEAR_2;SET_RULE `{a,b,a}= {a,(b:real^3)}`]); + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + FIRST_X_ASSUM_ST `aff_ge` MP_TAC; + REWRITE_TAC[]; + GMATCH_SIMP_TAC AFF_GE_2_1; + ASM_SIMP_TAC[Fan.th3a;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `(-- &1) % (u0 cross u1) + t2 % u0 + t3 % u1 = vec 0` (C SUBGOAL_THEN MP_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN VECTOR_ARITH_TAC); + BY(ASM_MESON_TAC[cross_independent;arith `~(-- &1 = &0)`]); + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `v1 = t3 % v2` ENOUGH_TO_SHOW_TAC; + DISCH_THEN (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + BY(ASM_MESON_TAC[SET_RULE `{a,b,c} = {a,c,(b:real^3)}`;COLLINEAR_LEMMA_ALT]); + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `aff_ge` MP_TAC; + REWRITE_TAC[]; + GMATCH_SIMP_TAC AFF_GE_2_1; + ASM_SIMP_TAC[Fan.th3a;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `x:real^3` (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + FIRST_X_ASSUM_ST `v1 = t1' % ((vec 0):real^3) + c` (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + RULE_ASSUM_TAC(REWRITE_RULE[VECTOR_MUL_ASSOC;VECTOR_ADD_LDISTRIB]); + TYPIFY `t2 % (u0 cross u1) + (t3 * t2' - t0) % u0 + (t3*t3' - t1) % u1 = vec 0` (C SUBGOAL_THEN MP_TAC); + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `x:real^3` MP_TAC); + ONCE_REWRITE_TAC[TAUT `(a ==> b ==> c) <=> (b ==> a ==> c)`]; + DISCH_TAC; + BY(VECTOR_ARITH_TAC); + DISCH_TAC; + TYPIFY `t2 = &0` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[cross_independent]); + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + FIRST_X_ASSUM kill; + FIRST_X_ASSUM_ST `x:real^3` MP_TAC; + BY(VECTOR_ARITH_TAC) + ]);; + (* }}} *) + +let ybt_inj_0 = prove_by_refinement( + `!u0 u1 v2 . + ~collinear {vec 0, u0, v2} /\ + ~collinear {vec 0, u0, u1} /\ + v2 IN aff_ge {vec 0, u0} {u1} ==> +~( azim (vec 0) (u0 cross u1) u0 v2 = &0) + `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + GMATCH_SIMP_TAC Local_lemmas.AZIM_EQ_0_GE_ALT2; + CONJ_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,(b:real^3)}`]; + BY(ASM_MESON_TAC[Local_lemmas.COLL_IFF_COLL_CROSS]); + GMATCH_SIMP_TAC AFF_GE_2_1; + CONJ_TAC; + REWRITE_TAC[DISJOINT;EXTENSION;IN_INTER;IN_SING;IN_INSERT;NOT_IN_EMPTY]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + FIRST_X_ASSUM DISJ_CASES_TAC; + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + BY(ASM_MESON_TAC[COLLINEAR_2;SET_RULE `{a,a,b}= {a,(b:real^3)}`]); + TYPIFY `u0 dot u0 = (u0 cross u1) dot u0` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[]); + REWRITE_TAC[DOT_CROSS_SELF]; + REWRITE_TAC[DOT_EQ_0]; + DISCH_THEN (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + BY(ASM_MESON_TAC[COLLINEAR_2;SET_RULE `{a,a,b}= {a,(b:real^3)}`]); + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `aff_ge` MP_TAC; + REWRITE_TAC[]; + GMATCH_SIMP_TAC AFF_GE_2_1; + ASM_SIMP_TAC[Fan.th3a;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `t2 % (u0 cross u1) + (t3 - t2') % u0 + (-- t3') % u1 = vec 0` (C SUBGOAL_THEN MP_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN VECTOR_ARITH_TAC); + DISCH_TAC; + TYPIFY `t2 = &0` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[cross_independent]); + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + REPLICATE_TAC 4 (FIRST_X_ASSUM kill); + TYPIFY `v2 = t3 % u0` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN VECTOR_ARITH_TAC); + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + BY(ASM_MESON_TAC[COLLINEAR_LEMMA_ALT]) + ]);; + (* }}} *) + +let ECAU_aff_ge = prove_by_refinement( + `!(u:num->real^3) r. (!i j. i <= r /\ j <= r /\ ~(i = j) ==> ~collinear {vec 0, u i, u j}) /\ + (!i. 1 <= i /\ i <= r ==> u i IN aff_gt {vec 0,u 0 } {u 1} ) ==> + (!i. 1 <= i /\ i <= r ==> u i IN aff_ge {vec 0,u 0 } {u 1} ) `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `u i IN aff_gt {vec 0,u 0} {u 1}` (C SUBGOAL_THEN MP_TAC); + ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + BY(FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + INTRO_TAC AFF_GT_SUBSET_AFF_GE [`{vec 0,u 0}`;`{u 1}`]; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let collinear_cross = prove_by_refinement( + `!u i r. i <= r /\ 1 <= r /\ (!i j. i <= r /\ j <= r /\ ~(i = j) ==> ~collinear {vec 0, u i, u j}) /\ + (!i. 1 <= i /\ i <= r ==> u i IN aff_gt {vec 0,u 0 } {u 1} ) + ==> ~collinear {vec 0,u 0 cross u 1,u i}`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[]; + TYPIFY `i = 0` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`]; + REWRITE_TAC[GSYM Local_lemmas.COLL_IFF_COLL_CROSS]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_TAC THEN ARITH_TAC); + INTRO_TAC ECAU_aff_ge [`u`;`r`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + MATCH_MP_TAC vuy3; + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_TAC THEN TRY ARITH_TAC) + ]);; + (* }}} *) + +let YBTASCZ1 = prove_by_refinement( + `!u r j. + (j <= r) /\ (1<= r) /\ + (!i j. i <= r /\ j <= r /\ ~(i=j) ==> ~collinear {vec 0,u i ,u j}) /\ + (!i. 1 <= i /\ i <= r ==> u i IN aff_gt {vec 0,u 0 } {u 1} ) /\ + cyclic_set {u i | i <= r} (vec 0) ((u 0) cross (u 1)) /\ + (!i. i < r ==> azim_cycle {u i | i <= r} (vec 0) ((u 0) cross (u 1)) (u i) = u (i+1)) ==> + (!i. i < j ==> azim (vec 0) ((u 0) cross (u 1)) (u 0) (u i) < azim (vec 0) (u 0 cross (u 1)) (u 0) (u j)) + `, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + DISCH_TAC; + INTRO_TAC ECAU_aff_ge [`u`;`r`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INDUCT_TAC; + DISCH_TAC; + REWRITE_TAC[arith `a < b <=> (a <= b /\ ~(a = b))`]; + CONJ_TAC; + BY(REWRITE_TAC[AZIM_REFL;Local_lemmas.AZIM_RANGE]); + REWRITE_TAC[AZIM_REFL]; + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + MATCH_MP_TAC ybt_inj_0; + ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + BY(REPEAT CONJ_TAC THEN TRY (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_TAC THEN TRY ARITH_TAC); + COMMENT "induction step"; + ONCE_REWRITE_TAC[arith `a < b <=> ~(b < a) /\ ~(a = b)`]; + REPEAT WEAKER_STRIP_TAC; + CONJ2_TAC; + MATCH_MP_TAC ybt_inj; + ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + BY(REPEAT CONJ_TAC THEN TRY (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_TAC THEN TRY ARITH_TAC); + DISCH_TAC; + TYPIFY `i < (j:num)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `azim_cycle {u i | i <= r} (vec 0) (u 0 cross u 1) (u i) = u (i+1)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_TAC THEN ARITH_TAC); + INTRO_TAC (GEN_ALL Wrgcvdr_cizmrrh.AZIM_CYCLE_PROPERTIES) [`{u i | (i:num) <= r}`;`u i`;`u 0 cross u 1`;`(vec 0):real^3`]; + ANTS_TAC; + CONJ_TAC; + REWRITE_TAC[SUBSET;IN_ELIM_THM;IN_SING]; + TYPIFY `1 <= r` (C SUBGOAL_THEN MP_TAC); + BY(ASM_REWRITE_TAC[]); + TYPIFY (`~(u 0 = u 1)`) ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[arith `1 <= r ==> 0 <= r /\ 1 <= r`]); + DISCH_TAC; + FIRST_X_ASSUM_ST `collinear` (C INTRO_TAC [`0`;`1`]); + ANTS_TAC; + BY(ASM_TAC THEN ARITH_TAC); + ASM_REWRITE_TAC[]; + BY(MESON_TAC[COLLINEAR_2;SET_RULE `{a,b,b}= {a,(b:real^3)}`]); + TYPIFY `{u i | i <= r } = IMAGE u {i | i <= (r:num)}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + MATCH_MP_TAC FINITE_IMAGE; + BY(REWRITE_TAC[FINITE_NUMSEG_LE]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`u j`]); + ANTS_TAC; + CONJ_TAC; + DISCH_TAC; + FIRST_X_ASSUM_ST `collinear` (C INTRO_TAC [`j`;`i`]); + ANTS_TAC; + BY(ASM_TAC THEN ARITH_TAC); + ASM_REWRITE_TAC[]; + BY(MESON_TAC[COLLINEAR_2;SET_RULE `{a,b,b}= {a,(b:real^3)}`]); + TYPIFY_GOAL_THEN `(j:num) <=r ==> {u i | i <= r} (u j)` MATCH_MP_TAC; + TYPIFY `{u i | i <= r } = IMAGE u {i | i <= (r:num)}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + REWRITE_TAC[IMAGE;IN_ELIM_THM]; + BY(MESON_TAC[]); + BY(ASM_TAC THEN ARITH_TAC); + REWRITE_TAC[arith `i+1 = SUC i`]; + REWRITE_TAC[DE_MORGAN_THM]; + PROOF_BY_CONTR_TAC; + COMMENT "shift"; + FIRST_X_ASSUM_ST `(i:num) < j ==> b` MP_TAC; + ASM_REWRITE_TAC[]; + DISCH_TAC; + FIRST_ASSUM MP_TAC; + REWRITE_TAC[]; + ONCE_REWRITE_TAC[arith `a < b <=> &0 < b - a`]; + GMATCH_SIMP_TAC Leaf_cell.AZIM_BASE_SHIFT_LE; + TYPIFY `u i` EXISTS_TAC; + (ASM_SIMP_TAC[arith `x <= x` ;arith `x < y ==> x <= y`]); + CONJ_TAC; + BY(REPEAT (GMATCH_SIMP_TAC collinear_cross) THEN REPEAT CONJ_TAC THEN TYPIFY `r` EXISTS_TAC THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN TRY ARITH_TAC); + REWRITE_TAC[arith `&0 < a - b <=> b < a`]; + DISCH_TAC; + COMMENT "second shift"; + TYPIFY `azim (vec 0) (u 0 cross u 1) (u i) (u j) < azim (vec 0) (u 0 cross u 1) (u i) (u (SUC i))` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `SUC` kill; + FIRST_ASSUM_ST `SUC` MP_TAC; + ONCE_REWRITE_TAC[arith `a < b <=> &0 < b - a`]; + MATCH_MP_TAC (arith `a = b ==> &0 < a ==> &0 < b`); + MATCH_MP_TAC Leaf_cell.AZIM_BASE_SHIFT_LE; + (ASM_SIMP_TAC[arith `x <= x` ;arith `x < y ==> x <= y`]); + REWRITE_TAC[TAUT `(a /\ b /\ c) <=> ((a /\ b) /\ c)`]; + CONJ2_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(REPEAT (GMATCH_SIMP_TAC collinear_cross) THEN REPEAT CONJ_TAC THEN TYPIFY `r` EXISTS_TAC THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN TRY ARITH_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let YBTASCZ2 = prove_by_refinement( + `!u r i j. + (i < j) /\ (j <= r) /\ (1<= r) /\ + (!i j. i <= r /\ j <= r /\ ~(i=j) ==> ~collinear {vec 0,u i ,u j}) /\ + (!i. 1 <= i /\ i <= r ==> u i IN aff_gt {vec 0,u 0 } {u 1} ) /\ + cyclic_set {u i | i <= r} (vec 0) ((u 0) cross (u 1)) /\ + (!i. i < r ==> azim_cycle {u i | i <= r} (vec 0) ((u 0) cross (u 1)) (u i) = u (i+1)) ==> + (azim (vec 0) ((u 0) cross (u 1)) (u i) (u j) < pi) + `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC YBTASCZ1 [`u`;`r`;`j`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (C INTRO_TAC [`i`]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC Fan.sum4_azim_fan [`(vec 0):real^3`;`u 0 cross u 1`;`u 0`;`u i`;`u j`]; + ANTS_TAC; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + BY(REPEAT CONJ_TAC THEN MATCH_MP_TAC collinear_cross THEN TYPIFY `r` EXISTS_TAC THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN TRY ARITH_TAC); + INTRO_TAC vuy4 [`u j`;`u 0`;`u 1`]; + ANTS_TAC; + INTRO_TAC ECAU_aff_ge [`u`;`r`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_TAC THEN ARITH_TAC); + INTRO_TAC Counting_spheres.AZIM_NN [`(vec 0):real^3`;`u 0 cross u 1`;`u 0`;`u i`]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let YBTASCZ3 = prove_by_refinement( + `!u r i j. + (i < j) /\ (j <= r) /\ (1<= r) /\ + (!i j. i <= r /\ j <= r /\ ~(i=j) ==> ~collinear {vec 0,u i ,u j}) /\ + (!i. 1 <= i /\ i <= r ==> u i IN aff_gt {vec 0,u 0 } {u 1} ) /\ + cyclic_set {u i | i <= r} (vec 0) ((u 0) cross (u 1)) /\ + (!i. i < r ==> azim_cycle {u i | i <= r} (vec 0) ((u 0) cross (u 1)) (u i) = u (i+1)) ==> + (&0 < azim (vec 0) ((u 0) cross (u 1)) (u i) (u j)) + `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC YBTASCZ1 [`u`;`r`;`j`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (C INTRO_TAC [`i`]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC Fan.sum4_azim_fan [`(vec 0):real^3`;`u 0 cross u 1`;`u 0`;`u i`;`u j`]; + ANTS_TAC; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + BY(REPEAT CONJ_TAC THEN MATCH_MP_TAC collinear_cross THEN TYPIFY `r` EXISTS_TAC THEN ASM_REWRITE_TAC[] THEN ASM_TAC THEN TRY ARITH_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let KCZXLLE = prove_by_refinement( + `!u r i j k. + (j < k) /\ (k <= r) /\ (1<= r) /\ (i <= r) /\ ((i < j \/ k < i)) /\ + (!i j. i <= r /\ j <= r /\ ~(i=j) ==> ~collinear {vec 0,u i ,u j}) /\ + (!i. 1 <= i /\ i <= r ==> u i IN aff_gt {vec 0,u 0 } {u 1} ) /\ + cyclic_set {u i | i <= r} (vec 0) ((u 0) cross (u 1)) /\ + (!i. i < r ==> azim_cycle {u i | i <= r} (vec 0) ((u 0) cross (u 1)) (u i) = u (i+1)) ==> + (azim (vec 0) (u i) (u j) (u k) = &0) + `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?r. j < k /\ k <= r /\ 1 <= r /\ (!i j. i <= r /\ j <= r /\ ~(i = j) ==> ~collinear {vec 0, u i, u j}) /\ (!i. 1 <= i /\ i <= r ==> u i IN aff_gt {vec 0, u 0} {u 1}) /\ cyclic_set {u i | i <= r} (vec 0) (u 0 cross u 1) /\ (!i. i < r ==> azim_cycle {u i | i <= r} (vec 0) (u 0 cross u 1) (u i) = u (i + 1))` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `r` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC ECAU_aff_ge [`u`;`r`] THEN ASM_REWRITE_TAC[] THEN DISCH_TAC; + COMMENT "planarity"; + TYPIFY `!i. i <= r ==> u i IN affine hull {vec 0,u 0,u 1}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + ASM_CASES_TAC `i' = 0`; + MATCH_MP_TAC HULL_INC; + ASM_REWRITE_TAC[]; + BY(SET_TAC[]); + RULE_ASSUM_TAC(REWRITE_RULE[arith `~(i=0) <=> 1<= i`]); + REWRITE_TAC[GSYM Trigonometry.UIVNNRR2]; + INTRO_TAC (GEN_ALL Local_lemmas.AFF_GT_MONO) [`{vec 0,u 0}`;`{u 1}`;`{u 1}`]; + ANTS_TAC; + BY(SET_TAC[]); + TYPIFY_GOAL_THEN `{vec 0,u 0} UNION {u 1} = {vec 0,u 0,u 1} /\ {u 1} DIFF {u 1} = {}` (unlist REWRITE_TAC); + BY(SET_TAC[]); + TYPIFY `u i' IN aff_gt {vec 0, u 0} {u 1}` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + COMMENT "ARITH GOES HERE"; + TYPIFY `j <= (r:num)` (C SUBGOAL_THEN ASSUME_TAC); + REPLICATE_TAC 10 (FIRST_X_ASSUM kill); + BY(ASM_TAC THEN ARITH_TAC); + TYPIFY `~(i = j) /\ ~(i = k) /\ 0 <= r` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 6 (FIRST_X_ASSUM kill) THEN ASM_TAC THEN ARITH_TAC); + TYPIFY `~(0 = k) /\ (1 <= k) /\ ~(0=1)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM kill) THEN ASM_TAC THEN ARITH_TAC); + COMMENT "other prelims here"; + TYPIFY `~collinear {vec 0, u 0, u 1} /\ ~collinear {vec 0,u i,u j} /\ ~collinear {vec 0,u i,u k}` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[arith `~(0=1)`]); + TYPIFY `DISJOINT {vec 0, u 0} {u 1}` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC Fan.th3a; + BY(ASM_REWRITE_TAC[]); + TYPIFY `~collinear {vec 0, u 0, u k} /\ ~collinear {vec 0, u 0, u 1} /\ u k IN aff_ge {vec 0, u 0} {u 1} /\ u k IN aff_gt {vec 0, u 0} {u 1}` (C SUBGOAL_THEN ASSUME_TAC); + BY((REPEAT CONJ_TAC) THEN (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); + TYPIFY `!i. i <= r ==> ~collinear {vec 0,u 0 cross u 1, u i}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + ASM_CASES_TAC `i' = 0`; + FIRST_X_ASSUM_ST `collinear` MP_TAC; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`]; + REWRITE_TAC[GSYM Local_lemmas.COLL_IFF_COLL_CROSS]; + BY(ASM_REWRITE_TAC[]); + RULE_ASSUM_TAC (ONCE_REWRITE_RULE[arith `~(i'=0) <=> (1 <= i' /\ ~(i' = 0))`]); + FIRST_X_ASSUM_ST `collinear` MP_TAC; + REWRITE_TAC[]; + MATCH_MP_TAC vuy3; + BY((REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[])); + COMMENT "standard"; + TYPIFY `coplanar {vec 0, u i, u j, u k}` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[coplanar]; + GEXISTL_TAC [`(vec 0):real^3`;`u 0`;`u 1`]; + REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN (FIRST_X_ASSUM MATCH_MP_TAC ORELSE MATCH_MP_TAC HULL_INC) THEN ASM_REWRITE_TAC[]; + BY(REPEAT WEAKER_STRIP_TAC THEN SET_TAC[]); + RULE_ASSUM_TAC(REWRITE_RULE[GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]); + FIRST_X_ASSUM DISJ_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + PROOF_BY_CONTR_TAC THEN FIRST_X_ASSUM kill; + INTRO_TAC (GEN_ALL Ldurdpn.LDURDPN) [`u i`;`u j`;`u k`]; + ANTS_TAC; + BY(CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + REWRITE_TAC[DE_MORGAN_THM]; + DISJ2_TAC; + TYPIFY `conv0 {u j,u k} SUBSET aff_gt {vec 0, u 0} {u 1}` (C SUBGOAL_THEN ASSUME_TAC); + ASM_CASES_TAC `j=0`; + ASM_REWRITE_TAC[Geomdetail.CONV0_SET2;SUBSET;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC AFF_GT_2_1; + ASM_REWRITE_TAC[IN_ELIM_THM]; + INTRO_TAC vuy1 [`u k`;`u 0`;`u 1`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + GEXISTL_TAC [`&1 - a - b * (t0 + t1)`;`a + b * t0`;`b*t1`]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(REAL_ARITH_TAC); + BY(VECTOR_ARITH_TAC); + COMMENT "~(j=0)"; + MATCH_MP_TAC SUBSET_TRANS; + TYPIFY `conv {u j,u k}` EXISTS_TAC; + REWRITE_TAC[Geomdetail.CONV02_SU_CONV2]; + MATCH_MP_TAC Geomdetail.CONVEX_IM_CONV2_SU; + ASM_REWRITE_TAC[CONVEX_AFF_GT]; + RULE_ASSUM_TAC(REWRITE_RULE[arith `~(j=0) <=> 1<=j`]); + BY( FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INTER;NOT_IN_EMPTY]; + REWRITE_TAC[TAUT `~(a /\ b) <=> (b ==> ~a)`]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `aff` MP_TAC; + REWRITE_TAC[Trigonometry2.AFF2_VEC0;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `k' % u i IN aff_gt {vec 0, u 0} {u 1}` (C SUBGOAL_THEN MP_TAC); + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + REWRITE_TAC[]; + GMATCH_SIMP_TAC AFF_GT_2_1; + ASM_REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(i = 0)` (C SUBGOAL_THEN ASSUME_TAC); + DISCH_TAC; + FIRST_X_ASSUM_ST `%` MP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `~collinear {vec 0, u 0, u 1}` (C SUBGOAL_THEN MP_TAC); + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[COLLINEAR_LEMMA_ALT]; + REWRITE_TAC[DE_MORGAN_THM;NOT_EXISTS_THM]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`(inv t3 * (k' - t2))`]); + REWRITE_TAC[]; + TYPIFY `t3 % u 1 = t3 % (inv t3 * (k' - t2)) % u 0` ENOUGH_TO_SHOW_TAC; + REWRITE_TAC[VECTOR_MUL_LCANCEL]; + DISCH_THEN DISJ_CASES_TAC; + BY(FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)) THEN FIRST_X_ASSUM_ST `&0 < &0` MP_TAC THEN REAL_ARITH_TAC); + BY(FIRST_X_ASSUM ACCEPT_TAC); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[VECTOR_MUL_ASSOC]; + TYPIFY `(t3 * inv t3 * (k' - t2)) = k' - t2` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + BY(FIRST_X_ASSUM_ST `&0 < t3` MP_TAC THEN REAL_ARITH_TAC); + BY(VECTOR_ARITH_TAC); + TYPIFY `?t. &0 < t /\ x = t % u i` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM_ST `aff_gt` (C INTRO_TAC [`i`]); + (ANTS_TAC); + BY(RULE_ASSUM_TAC(REWRITE_RULE[arith `~(i=0) <=> 1 <= i`]) THEN ASM_REWRITE_TAC[]); + GMATCH_SIMP_TAC AFF_GT_2_1; + ASM_REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `k'` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `k' = t3/ t3'` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + GMATCH_SIMP_TAC REAL_LT_DIV; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + TYPIFY `t3 = k' * t3'` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + Calc_derivative.CALC_ID_TAC; + BY((FIRST_X_ASSUM_ST `&0 < t` MP_TAC) THEN REAL_ARITH_TAC); + PROOF_BY_CONTR_TAC; + TYPIFY `(k'*t2' - t2) % u 0 + (k'*t3' - t3) % u 1 = vec 0` (C SUBGOAL_THEN MP_TAC); + BY(FIRST_X_ASSUM_ST `%` MP_TAC THEN VECTOR_ARITH_TAC); + DISCH_TAC; + TYPIFY `inv (k' * t3' - t3) % (k' * t3' - t3) % u 1 = inv(k' * t3' - t3) % (t2 - k' * t2') % u 0` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[VECTOR_MUL_LCANCEL]; + DISJ2_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN VECTOR_ARITH_TAC); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[VECTOR_MUL_ASSOC]; + TYPIFY `inv (k' * t3' - t3) * (k' * t3' - t3) = &1` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REWRITE_TAC[VECTOR_MUL_LID]; + DISCH_TAC; + FIRST_X_ASSUM_ST `collinear` (C INTRO_TAC [`0`;`1`]); + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY(ASM_MESON_TAC[COLLINEAR_LEMMA_ALT]); + REPEAT WEAKER_STRIP_TAC; + (COMMENT "wedge"); + TYPIFY `conv0 {u j,u k} SUBSET wedge (vec 0) (u 0 cross u 1) (u j) (u k)` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `wedge (vec 0) (u 0 cross u 1) (u j) (u k) = aff_gt {vec 0,u 0 cross u 1} {u j,u k}` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[CONV0_AFF_GT]; + MATCH_MP_TAC AFF_GT_MONO_LEFT; + BY(SET_TAC[]); + MATCH_MP_TAC WEDGE_LUNE_GT; + TYPIFY_GOAL_THEN `~collinear {vec 0, u 0 cross u 1, u j}` (unlist REWRITE_TAC); + ASM_CASES_TAC `j= 0`; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`]; + REWRITE_TAC[GSYM Local_lemmas.COLL_IFF_COLL_CROSS]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + GMATCH_SIMP_TAC YBTASCZ3; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC YBTASCZ2; + BY(ASM_REWRITE_TAC[]); + TYPIFY `x IN wedge (vec 0) (u 0 cross u 1) (u j) (u k)` (C SUBGOAL_THEN MP_TAC); + BY(REPEAT (FIRST_X_ASSUM_ST `conv0` MP_TAC) THEN SET_TAC[]); + REWRITE_TAC[Reuhady.WEDGE_SIMPLE;IN_ELIM_THM]; + FIRST_X_ASSUM_ST `x = (y:real^3)` SUBST1_TAC; + TYPIFY `azim (vec 0) (u 0 cross u 1) (u j) (t % u i) = azim (vec 0) (u 0 cross u 1) (u j) (u i)` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM_ST `&0 < t` MP_TAC; + BY(MESON_TAC[AZIM_SCALE_ALL;arith `&0 < &1`;arith `&1 % v = v`]); + COMMENT "two cases"; + REWRITE_TAC[DE_MORGAN_THM]; + DISJ2_TAC; + FIRST_X_ASSUM DISJ_CASES_TAC; + REWRITE_TAC[arith `~(a < b) <=> b <= a`]; + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `pi` EXISTS_TAC; + SUBCONJ_TAC; + MATCH_MP_TAC (arith `x < pi ==> x <= pi`); + MATCH_MP_TAC YBTASCZ2; + EXISTS_TAC `r:num`; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + ONCE_REWRITE_TAC[Rogers.AZIM_COMPL_EXT]; + COND_CASES_TAC; + TYPIFY `&0 < azim (vec 0) (u 0 cross u 1) (u i) (u j)` ENOUGH_TO_SHOW_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + MATCH_MP_TAC YBTASCZ3; + TYPIFY `r` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + MATCH_MP_TAC (arith `x < pi ==> pi <= &2 * pi - x`); + MATCH_MP_TAC YBTASCZ2; + EXISTS_TAC `r:num`; + BY(ASM_REWRITE_TAC[]); + COMMENT "last case"; + REWRITE_TAC[arith `~(a < b) <=> b <= a`]; + INTRO_TAC Fan.sum3_azim_fan [`(vec 0):real^3`;`u 0 cross u 1`;`u j`;`u k`;`u i`]; + ANTS_TAC; + CONJ_TAC; + MATCH_MP_TAC (arith `x < pi /\ y < pi ==> x + y < &2 * pi`); + CONJ_TAC THEN (MATCH_MP_TAC YBTASCZ2); + TYPIFY `r` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `r` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + TYPIFY `&0 <= azim (vec 0) (u 0 cross u 1) (u k) (u i)` ENOUGH_TO_SHOW_TAC; + BY(REAL_ARITH_TAC); + BY(REWRITE_TAC[Counting_spheres.AZIM_NN]) + ]);; + (* }}} *) + +let KCZXLLE_SYM = prove_by_refinement( + `!u r i j k. + k <= r /\ + j <= r /\ + 1 <= r /\ + i <= r /\ + ((j < k /\ (i < j \/ k < i)) \/ (k < j /\ (i < k \/ j < i))) /\ + (!i j. + i <= r /\ j <= r /\ ~(i = j) ==> ~collinear {vec 0, u i, u j}) /\ + (!i. 1 <= i /\ i <= r ==> u i IN aff_gt {vec 0, u 0} {u 1}) /\ + cyclic_set {u i | i <= r} (vec 0) (u 0 cross u 1) /\ + (!i. i < r + ==> azim_cycle {u i | i <= r} (vec 0) (u 0 cross u 1) (u i) = + u (i + 1)) + ==> azim (vec 0) (u i) (u j) (u k) = &0`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM DISJ_CASES_TAC; + MATCH_MP_TAC KCZXLLE; + TYPIFY `r` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + ONCE_REWRITE_TAC[Local_lemmas.AZIM_EQ_0_SYM2]; + MATCH_MP_TAC KCZXLLE; + TYPIFY `r` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let open_continuous_eps = prove_by_refinement( + `!U f t a b. (t IN real_interval (a,b)) /\ f t IN U /\ + (!x. x IN real_interval (a,b) ==> f real_continuous atreal x) /\ real_open U ==> + (?e. &0 < e /\ (!x. abs (x-t) < e ==> f x IN U))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Pent_hex.continuous_preimage_open [`f`;`real_interval (a,b)`;`U`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ASM_SIMP_TAC[ Ocbicby.REAL_OPEN_REAL_INTERVAL;REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT ]); + REWRITE_TAC[real_open;IN_ELIM_THM]; + DISCH_THEN (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let coplanar_in_affine_hull = prove_by_refinement( + `!(u:real^A) v w x. ~collinear {u,v,w} /\ coplanar {x,u,v,w} ==> x IN affine hull {u,v,w}`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Counting_spheres.NOT_COLLINEAR_AFF_DIM_2 [`u`;`v`;`w`]; + ASM_REWRITE_TAC[] THEN DISCH_TAC; + MATCH_MP_TAC Leaf_cell.COPLANAR_INSERT; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let azim_0_as_closed = prove_by_refinement( + `!(v2:real^3) v3 v4. ~collinear {vec 0, v2,v3} /\ ~collinear {vec 0,v2,v4} ==> + (azim (vec 0) v2 v3 v4 = &0 <=> (coplanar {vec 0,v2,v3,v4} /\ &0 <= ((v2 cross v3) cross v2) dot v4))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~coplanar {vec 0,v2,v3,v4}` ASM_CASES_TAC THEN RULE_ASSUM_TAC(REWRITE_RULE[]) THEN ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[AZIM_EQ_0_PI_IMP_COPLANAR]); + INTRO_TAC coplanar_in_affine_hull [`(vec 0):real^3`;`v2`;`v3`;`v4`]; + ANTS_TAC; + ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {b,c,d,a}`]; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + INTRO_TAC Ckqowsa_4_points.in_affine_hull_lemma [`v2`;`v3`;`v4`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `&0 <= ((v2 cross v3) cross v2) dot v4 <=> &0 <= t2` (C SUBGOAL_THEN SUBST1_TAC); + ASM_REWRITE_TAC[DOT_RADD;DOT_RMUL]; + ONCE_REWRITE_TAC[CROSS_TRIPLE]; + REWRITE_TAC[CROSS_REFL;DOT_LZERO]; + REWRITE_TAC[arith `t1 * &0 + c = c`]; + GMATCH_SIMP_TAC (CONJUNCT2 REAL_LE_MUL_EQ); + REWRITE_TAC[DOT_POS_LT]; + BY(ASM_REWRITE_TAC[CROSS_EQ_0]); + TYPIFY `azim (vec 0) v2 v3 v4 = &0 <=> ~(azim (vec 0) v2 v3 v4 = pi)` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[Local_lemmas1.AZIM_COND_FOR_COPLANAR;PI_POS;arith `&0 < pi ==> ~(&0 = pi)`]); + GMATCH_SIMP_TAC Ldurdpn.LDURDPN; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + TYPIFY_GOAL_THEN `(?A. plane A /\ {vec 0, v2, v3, v4} SUBSET A)` (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `coplanar` MP_TAC THEN REWRITE_TAC[coplanar] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `affine hull {vec 0,v2,v3}` EXISTS_TAC; + CONJ2_TAC; + TYPIFY `v4 IN affine hull {vec 0,v2,v3} /\ {vec 0 ,v2,v3} SUBSET affine hull {vec 0,v2,v3}` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + BY(CONJ_TAC THEN ASM_MESON_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + REWRITE_TAC[plane]; + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[]; + REWRITE_TAC[EXTENSION;IN_INTER;NOT_IN_EMPTY]; + REWRITE_TAC[Trigonometry2.AFF2_VEC0;IN_ELIM_THM;Geomdetail.CONV0_SET2;DE_MORGAN_THM;NOT_EXISTS_THM]; + TYPIFY `(!x. (!k. ~(x = k % v2)) \/ (!a b. ~(&0 < a) \/ ~(&0 < b) \/ ~(a + b = &1) \/ ~(x = a % v3 + b % (t1 % v2 + t2 % v3)))) <=> (!k a b. &0 < a /\ &0 < b /\ a + b = &1 ==> ~(k % v2 = a % v3 + b % (t1 % v2 + t2 % v3)))` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[]); + COMMENT "first case"; + ASM_CASES_TAC `&0 <= t2`; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `v3 = (inv (b * t2 + a) * (-- (b * t1 - k))) % v2` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[COLLINEAR_LEMMA_ALT]); + MATCH_MP_TAC VECTOR_MUL_LCANCEL_IMP; + TYPIFY `(b * t2 + a)` EXISTS_TAC; + SUBCONJ_TAC; + MATCH_MP_TAC (arith `&0 <= b' /\ &0 < a ==> ~(b' + a = &0)`); + GMATCH_SIMP_TAC REAL_LE_MUL; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[VECTOR_MUL_ASSOC]; + DISCH_TAC; + TYPIFY `((b * t2 + a) * inv (b * t2 + a) * --(b * t1 - k)) = -- (b * t1 - k)` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + BY(FIRST_X_ASSUM_ST `%` MP_TAC THEN VECTOR_ARITH_TAC); + ASM_REWRITE_TAC[NOT_FORALL_THM]; + TYPIFY `~(t2 = &1)` (C SUBGOAL_THEN ASSUME_TAC); + DISCH_THEN (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + BY(ASM_TAC THEN REAL_ARITH_TAC); + GEXISTL_TAC [`t1 / (&1 - t2)`;`-- t2 / (&1 - t2)`;`&1 / (&1 - t2)`;]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + GMATCH_SIMP_TAC REAL_LT_DIV; + GMATCH_SIMP_TAC REAL_LT_DIV; + TYPIFY `--t2 / (&1 - t2) + &1 / (&1 - t2) = &1` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[]; + TYPIFY `&1 / (&1 - t2) % (t1 % v2 + t2 % v3) = t1 / (&1 - t2) % v2 - --t2 / (&1 - t2) % v3` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(VECTOR_ARITH_TAC); + REWRITE_TAC[VECTOR_ADD_LDISTRIB]; + REWRITE_TAC[VECTOR_MUL_ASSOC]; + TYPIFY `(&1 / (&1 - t2) * t1) = t1 / (&1 - t2)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REAL_ARITH_TAC); + BY(VECTOR_ARITH_TAC) + ]);; + (* }}} *) + +(* +let CONTINUOUS_LIFT_DOT2 = prove + (`!net f:A->real^N g. + f continuous net /\ g continuous net + ==> (\x. lift(f x dot g x)) continuous net`, + REPEAT GEN_TAC THEN DISCH_THEN(MP_TAC o MATCH_MP (MATCH_MP (REWRITE_RULE + [TAUT `p /\ q /\ r ==> s <=> r ==> p /\ q ==> s`] + BILINEAR_CONTINUOUS_COMPOSE) BILINEAR_DOT)) THEN REWRITE_TAC[]);; + +let REAL_CONTINUOUS_AT_DOT2 = prove_by_refinement( + `!(f:real->real^A) g x. f continuous atreal x /\ g continuous atreal x + ==> (\x. (f x dot g x)) real_continuous atreal x`, + (* {{{ proof *) + [ + REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `lift o (\x. f x dot g x) = (\x. lift (f x dot g x))` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[FUN_EQ_THM;o_DEF]); + INTRO_TAC CONTINUOUS_AT_LIFT_DOT2 [`f o drop`;`g o drop`;`lift x`]; + TYPIFY `(\x. lift ((f o drop) x dot (g o drop) x)) = (\x. lift (f x dot g x)) o drop` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[FUN_EQ_THM;o_DEF]); + BY(ASM_REWRITE_TAC[GSYM (* Xbjrphc. *) CONTINUOUS_CONTINUOUS_ATREAL]) + ]);; + (* }}} *) +*) + +let REAL_CONTINUOUS_AT_DOT2 = prove_by_refinement( + `!(f:real->real^A) g x. f continuous atreal x /\ g continuous atreal x + ==> (\x. (f x dot g x)) real_continuous atreal x`, + (* {{{ proof *) + [ + REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS1]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `lift o (\x. f x dot g x) = (\x. lift (f x dot g x))` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[FUN_EQ_THM;o_DEF]); + MATCH_MP_TAC CONTINUOUS_LIFT_DOT2; + ASM_REWRITE_TAC[]; + ]);; + (* }}} *) + +let azim_pos_open = prove_by_refinement( + `!v2 v3 v4 t a b. (!x. x IN real_interval (a,b) ==> v2 continuous (atreal x)) /\ + (!x. x IN real_interval (a,b) ==> v3 continuous (atreal x)) /\ + (!x. x IN real_interval (a,b) ==> v4 continuous (atreal x)) /\ + t IN real_interval(a,b) /\ + ~collinear {(vec 0) ,(v2 t) ,(v3 t)} /\ ~collinear {(vec 0), (v2 t), (v4 t)} /\ + ~(azim (vec 0) (v2 t) (v3 t) (v4 t) = &0) ==> + (?e. &0 < e /\ (!t'. abs(t' - t) < e ==> ~(azim (vec 0) (v2 t') (v3 t') (v4 t') = &0))) + `, + (* {{{ proof *) + [ + REWRITE_TAC[real_open;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GEN_ALL NONCOLLINEAR_OPEN ) [`t`;`(vec 0):real^3`;`v2`;`v3`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GEN_ALL NONCOLLINEAR_OPEN ) [`t`;`(vec 0):real^3`;`v2`;`v4`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC azim_0_as_closed [`v2 t`;`v3 t`;`v4 t`]; + ASM_REWRITE_TAC[DE_MORGAN_THM]; + DISCH_TAC; + TYPIFY `?e. &0 < e /\ (!t'. abs(t - t') < e ==> (~coplanar {vec 0, v2 t', v3 t', v4 t'} \/ ~(&0 <= ((v2 t' cross v3 t') cross v2 t') dot v4 t')))` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM DISJ_CASES_TAC; + INTRO_TAC NONPLANAR_OPEN [`\(t:real). ((vec 0):real^3)`;`v2`;`v3`;`v4`;`t`]; + ANTS_TAC; + ASM_REWRITE_TAC[CONTINUOUS_CONST]; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[]; + BY(MESON_TAC[]); + TYPIFY `(\t. ((v2 t cross v3 t) cross v2 t) dot -- (v4 t)) real_continuous_on ( real_interval(a,b) )` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT; + REWRITE_TAC[Ocbicby.REAL_OPEN_REAL_INTERVAL]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC REAL_CONTINUOUS_AT_DOT2; + CONJ2_TAC; + MATCH_MP_TAC CONTINUOUS_NEG; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC (* Xbjrphc. *)CONTINUOUS_CROSS; + CONJ2_TAC; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC (* Xbjrphc. *)CONTINUOUS_CROSS; + BY(ASM_MESON_TAC[]); + INTRO_TAC Pent_hex.continuous_preimage_open [`(\x. ((v2 x cross v3 x) cross v2 x) dot -- v4 x)`;`real_interval(a,b)`;`{u | &0 < u}`]; + ANTS_TAC; + ASM_REWRITE_TAC[Ocbicby.REAL_OPEN_REAL_INTERVAL]; + BY(REWRITE_TAC[REAL_OPEN_HALFSPACE_GT;arith ` &0 < x <=> x > &0`]); + REWRITE_TAC[IN_ELIM_THM]; + REWRITE_TAC[real_open;DOT_RNEG;arith `&0 < -- x <=> ~(&0 <= x)`;IN_ELIM_THM]; + DISCH_THEN (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY(MESON_TAC[arith `abs (x' - t) < e <=> abs (t - x') < e`]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?e'''. e''' <= e /\ e''' <= e' /\ e''' <= e'' /\ &0 < e'''` (C SUBGOAL_THEN MP_TAC); + TYPIFY `if (e'' <= e' /\ e'' <= e) then e'' else (if (e' <= e'' /\ e' <= e) then e' else e)` EXISTS_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `&0 < e` MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e'''` EXISTS_TAC; + ASM_REWRITE_TAC[]; + GEN_TAC; + DISCH_TAC; + GMATCH_SIMP_TAC azim_0_as_closed; + REWRITE_TAC[DE_MORGAN_THM]; + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_TAC THEN TRY REAL_ARITH_TAC) + ]);; + (* }}} *) + +let azim_real_continuous_on = prove_by_refinement( + `!v2 v3 v4 t a b. + (!x. x IN real_interval (a,b) ==> v2 continuous (atreal x)) /\ + (!x. x IN real_interval (a,b) ==> v3 continuous (atreal x)) /\ + (!x. x IN real_interval (a,b) ==> v4 continuous (atreal x)) /\ + t IN real_interval(a,b) /\ + ~collinear {(vec 0) ,(v2 t) ,(v3 t)} /\ ~collinear {(vec 0), (v2 t), (v4 t)} /\ + ~(azim (vec 0) (v2 t) (v3 t) (v4 t) = &0) ==> + (?e. &0 < e /\ (\q. azim (vec 0) (v2 q) (v3 q) (v4 q)) real_continuous_on (real_interval (t - e, t+ e)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GEN_ALL NONCOLLINEAR_OPEN) [`t`;`(vec 0):real^3`;`v2`;`v3`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[] THEN CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GEN_ALL NONCOLLINEAR_OPEN) [`t`;`(vec 0):real^3`;`v2`;`v4`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[] THEN CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC azim_pos_open [`v2`;`v3`;`v4`;`t`;`a`;`b`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?e'''. &0 < e''' /\ (!x. t - e''' < x /\ x < t + e''' ==> x IN real_interval (a,b))` (C SUBGOAL_THEN MP_TAC); + TYPIFY `if (b-t <= t -a) then b - t else t - a` EXISTS_TAC; + FIRST_X_ASSUM_ST `IN` MP_TAC; + REWRITE_TAC[IN_REAL_INTERVAL]; + BY(REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?e''''. e'''' <= e /\ e'''' <= e' /\ e'''' <= e'' /\ e'''' <= e''' /\ &0 < e''''` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC Packing3.REAL_FINITE_MIN_EXISTS [`{e,e',e'',e'''}`]; + ANTS_TAC; + CONJ_TAC; + BY(MESON_TAC[FINITE_RULES]); + BY(SET_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `m` EXISTS_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[IN_INSERT;NOT_IN_EMPTY]); + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN (REPEAT (FIRST_X_ASSUM_ST `&0 < e` MP_TAC)); + BY(MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''''` EXISTS_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT; + REWRITE_TAC[Ocbicby.REAL_OPEN_REAL_INTERVAL;IN_REAL_INTERVAL]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (* Xbjrphc. *)REAL_CONTINUOUS_ATREAL_AZIM_COMPOSE; + ASM_REWRITE_TAC[CONTINUOUS_CONST]; + GMATCH_SIMP_TAC (GSYM Local_lemmas.AZIM_EQ_0_GE_ALT2); + TYPIFY `x IN real_interval (a,b)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THEN (REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC)) THEN TRY REAL_ARITH_TAC) + ]);; + (* }}} *) + +let azim_pos_iff_nz = prove_by_refinement( + `!v1 v2 v3 v4. + &0 < azim v1 v2 v3 v4 <=> ~(azim v1 v2 v3 v4 = &0)`, + (* {{{ proof *) + [ + BY(MESON_TAC[Counting_spheres.AZIM_NN;arith `&0 < x <=> (&0 <= x /\ ~(x = &0))`]) + ]);; + (* }}} *) + +(* was NHCXLRV_PREP *) + +let NHCXLRV = prove_by_refinement( + `!v w0 w1 w2 f a b. + deformation f {w0,w1,w2,v} (a,b) /\ + ~collinear {vec 0, f w1 (&0), f w2 (&0)} /\ + ~collinear {vec 0, f w1 (&0), f w0 (&0)} /\ + ~collinear {vec 0, f w1 (&0), f v (&0)} /\ + v IN wedge (vec 0) w1 w2 w0 ==> + (?e. &0 < e /\ + (!t. abs t < e ==> (f v t) IN wedge (vec 0) (f w1 t) (f w2 t) (f w0 t)))`, + (* {{{ proof *) + [ + REWRITE_TAC[Reuhady.WEDGE_SIMPLE;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY;Localization.deformation]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?c. azim (vec 0) w1 w2 v < c /\ c < azim (vec 0) w1 w2 w0` (C SUBGOAL_THEN MP_TAC); + TYPIFY `(azim (vec 0) w1 w2 v + azim (vec 0) w1 w2 w0)/ &2` EXISTS_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `(?e1. &0 < e1 /\ (!t. abs t < e1 ==> &0 < azim (vec 0) (f w1 t) (f w2 t) (f v t))) /\(?e2. &0 < e2 /\ (!t. abs t < e2 ==> azim (vec 0) (f w1 t) (f w2 t) (f v t) < c)) /\ (?e3. &0 < e3 /\ (!t. abs t < e3 ==> c < azim (vec 0) (f w1 t) (f w2 t) (f w0 t)))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `if (e1 <= e2 /\ e1 <= e3) then e1 else if (e2 <= e3 /\ e2 <= e1) then e2 else e3` EXISTS_TAC; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + MATCH_MP_TAC REAL_LT_TRANS; + TYPIFY `c` EXISTS_TAC; + BY(CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + INTRO_TAC azim_real_continuous_on [`f w1`;`f w2`;`f w0`;`&0`;`a`;`b`]; + ANTS_TAC; + ASM_REWRITE_TAC[GSYM azim_pos_iff_nz]; + FIRST_X_ASSUM_ST `\/` (REPEAT o GMATCH_SIMP_TAC); + TYPIFY_GOAL_THEN `&0 < azim (vec 0) w1 w2 w0` (unlist REWRITE_TAC); + BY(ASM_MESON_TAC[Counting_spheres.AZIM_NN;arith `&0 <= x /\ x < y ==> &0 < y`]); + BY(REPEAT CONJ_TAC THEN REPEAT WEAKER_STRIP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC azim_real_continuous_on [`f w1`;`f w2`;`f v`;`&0`;`a`;`b`]; + ANTS_TAC; + ASM_REWRITE_TAC[GSYM azim_pos_iff_nz]; + FIRST_X_ASSUM_ST `\/` (REPEAT o GMATCH_SIMP_TAC); + ASM_REWRITE_TAC[]; + BY(REPEAT CONJ_TAC THEN REPEAT WEAKER_STRIP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + RULE_ASSUM_TAC (REWRITE_RULE[arith `&0 - e = -- e /\ &0 + e = e`]); + INTRO_TAC Pent_hex.continuous_preimage_open [`(\q. azim (vec 0) (f w1 q) (f w2 q) (f v q))`;`real_interval (-- e',e')`;`{x | &0 < x}`]; + ASM_REWRITE_TAC[Ocbicby.REAL_OPEN_REAL_INTERVAL;REAL_OPEN_HALFSPACE_GT;arith ` &0 < x <=> x > &0`]; + INTRO_TAC Pent_hex.continuous_preimage_open [`(\q. azim (vec 0) (f w1 q) (f w2 q) (f v q))`;`real_interval (-- e',e')`;`{x | x < c }`]; + ASM_REWRITE_TAC[Ocbicby.REAL_OPEN_REAL_INTERVAL;REAL_OPEN_HALFSPACE_LT]; + INTRO_TAC Pent_hex.continuous_preimage_open [`(\q. azim (vec 0) (f w1 q) (f w2 q) (f w0 q))`;`real_interval (-- e,e)`;`{x | c < x}`]; + ASM_REWRITE_TAC[Ocbicby.REAL_OPEN_REAL_INTERVAL;REAL_OPEN_HALFSPACE_GT;arith ` c < x <=> x > c`]; + REWRITE_TAC[IN_REAL_INTERVAL;IN_ELIM_THM;real_open]; + REWRITE_TAC[arith `x > c <=> c < x`]; + REPEAT (DISCH_THEN (C INTRO_TAC [`&0`]) THEN (FIRST_ASSUM_ST `\/` (REPEAT o GMATCH_SIMP_TAC)) THEN ASM_SIMP_TAC[arith `&0 < e ==> -- e < &0`] THEN DISCH_TAC); + RULE_ASSUM_TAC (REWRITE_RULE[arith `x - &0 = x`]); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let NHCXLRV_ALT = prove_by_refinement( + `!v w0 w1 w2 f a b. + deformation f {w0, w1, w2, v} (a,b) /\ + ~collinear {vec 0, w1, w2} /\ + ~collinear {vec 0, w1, w0} /\ + ~collinear {vec 0, w1, v} /\ + v IN wedge (vec 0) w1 w2 w0 + ==> (?e. &0 < e /\ + (!t. abs t < e + ==> f v t IN wedge (vec 0) (f w1 t) (f w2 t) (f w0 t)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC NHCXLRV; + GEXISTL_TAC [`a`;`b`]; + ASM_REWRITE_TAC[]; + TYPIFY `!u. u IN {w0,w1,w2,v} ==> f u (&0) = u` (C SUBGOAL_THEN ASSUME_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[Localization.deformation]); + ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM (REPEAT o GMATCH_SIMP_TAC); + ASM_REWRITE_TAC[]; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let WNWSHJT = prove_by_refinement( + `!w0 w1 w2 f a b. + deformation f {w0,w1,w2} (a,b) /\ + ~collinear {vec 0, f w1 (&0), f w2 (&0)} /\ + ~collinear {vec 0, f w1 (&0), f w0 (&0)} /\ + &0 < azim (vec 0) w1 w2 w0 /\ + azim (vec 0) w1 w2 w0 < pi ==> + (?e. &0 < e /\ + (!t. abs t < e ==> azim (vec 0) (f w1 t) (f w2 t) (f w0 t) < pi))`, + (* {{{ proof *) + [ + REWRITE_TAC[IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY;Localization.deformation]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC azim_real_continuous_on [`f w1`;`f w2`;`f w0`;`&0`;`a`;`b`]; + ANTS_TAC; + ASM_REWRITE_TAC[GSYM azim_pos_iff_nz]; + FIRST_X_ASSUM_ST `\/` (REPEAT o GMATCH_SIMP_TAC); + ASM_REWRITE_TAC[]; + BY(REPEAT CONJ_TAC THEN REPEAT WEAKER_STRIP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + RULE_ASSUM_TAC (REWRITE_RULE[arith `&0 - e = -- e /\ &0 + e = e`]); + INTRO_TAC Pent_hex.continuous_preimage_open [`(\q. azim (vec 0) (f w1 q) (f w2 q) (f w0 q))`;`real_interval (-- e,e)`;`{x | x < pi}`]; + ASM_REWRITE_TAC[Ocbicby.REAL_OPEN_REAL_INTERVAL;REAL_OPEN_HALFSPACE_LT]; + REWRITE_TAC[IN_REAL_INTERVAL;IN_ELIM_THM;real_open]; + REPEAT (DISCH_THEN (C INTRO_TAC [`&0`]) THEN (FIRST_ASSUM_ST `\/` (REPEAT o GMATCH_SIMP_TAC)) THEN ASM_SIMP_TAC[arith `&0 < e ==> -- e < &0`] THEN DISCH_TAC); + RULE_ASSUM_TAC (REWRITE_RULE[arith `x - &0 = x`]); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let LOFA_IMP_INANGLE_EQ_AZIM = prove_by_refinement +(`!V E FF v. local_fan (V,E,FF) /\ v IN V ==> interior_angle1 (vec 0) FF v = azim_in_fan (v, rho_node1 FF v) E `, +[ + REWRITE_TAC[Localization.convex_local_fan; Local_lemmas.azim_in_fan2]; + REPEAT STRIP_TAC; + ASSUME_TAC2 Local_lemmas.EXISTS_INVERSE_OF_V; + DOWN THEN STRIP_TAC; + ASSUME_TAC2 Local_lemmas.LOFA_IMP_EE_TWO_ELMS; + ASSUME_TAC2 Local_lemmas.LOFA_CARD_EE_V_1; + ASSUME_TAC2 Lunar_deform.LOCAL_FAN_RHO_NODE_PROS2; + DOWN THEN STRIP_TAC; + UNDISCH_TAC` v:real^3 IN V `; + FIRST_ASSUM NHANH; + LET_TAC; + SWITCH_TAC` EE v E = {rho_node1 FF v, vv} `; + ASM_SIMP_TAC[ARITH_RULE` a = 2 ==> a > 1 `]; + STRIP_TAC; + DOWN THEN DOWN THEN PHA; + ASSUME_TAC2 (SPEC `vv:real^3 ` (GEN` v:real^3 ` Local_lemmas.IVS_RHO_IDD)); + EXPAND_TAC "d"; + SIMP_TAC[]; + UNDISCH_TAC` {rho_node1 FF v, vv} = EE v E `; + DISCH_THEN (SUBST1_TAC o SYM); + EXPAND_TAC "v"; + DOWN; + BY(SIMP_TAC[Local_lemmas.interior_angle1; GSYM Local_lemmas.ivs_rho_node1; Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]) +]);; + +let deformation_rho_node1_equivariant1 = prove_by_refinement( + `!f V E FF a b v t. + deformation f V (a,b) /\ + local_fan (V,E,FF) /\ + local_fan + (IMAGE (\v. f v t) V, + IMAGE (\s. IMAGE (\v. f v t) s) E, + IMAGE (\ (u,v). f u t,f v t) FF) /\ + v IN V ==> + f (rho_node1 FF v) t = rho_node1 (IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) (f v t)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC EQ_SYM; + MATCH_MP_TAC (GEN_ALL Local_lemmas.DETER_RHO_NODE); + GEXISTL_TAC [`IMAGE (\v. f v t) V`;` IMAGE (\s. IMAGE (\v. f v t) s) E`]; + CONJ_TAC; + TYPIFY `IMAGE (\(u,v). f u t,f v t) FF = IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF` ENOUGH_TO_SHOW_TAC; + DISCH_THEN (SUBST1_TAC o GSYM); + BY(ASM_REWRITE_TAC[]); + BY(REWRITE_TAC[EXTENSION;IN_IMAGE;EXISTS_PAIR_THM]); + REWRITE_TAC[IN_IMAGE;EXISTS_PAIR_THM]; + GEXISTL_TAC [`v`;`rho_node1 FF v`]; + REWRITE_TAC[]; + BY(ASM_MESON_TAC[Lunar_deform.LOCAL_FAN_RHO_NODE_PROS2]) + ]);; + (* }}} *) + +let deformation_ivs_rho_node1_equivariant1 = prove_by_refinement( + `!f V E FF a b v t. + deformation f V (a,b) /\ + local_fan (V,E,FF) /\ + local_fan + (IMAGE (\v. f v t) V, + IMAGE (\s. IMAGE (\v. f v t) s) E, + IMAGE (\ (u,v). f u t,f v t) FF) /\ + v IN V ==> + f (ivs_rho_node1 FF v) t = ivs_rho_node1 (IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) (f v t)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC EQ_SYM; + MATCH_MP_TAC (GEN_ALL Local_lemmas.IVS_RHO_NODE1_DETE); + GEXISTL_TAC [`IMAGE (\v. f v t) V`;` IMAGE (\s. IMAGE (\v. f v t) s) E`]; + CONJ_TAC; + TYPIFY `IMAGE (\(u,v). f u t,f v t) FF = IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF` ENOUGH_TO_SHOW_TAC; + DISCH_THEN (SUBST1_TAC o GSYM); + BY(ASM_REWRITE_TAC[]); + BY(REWRITE_TAC[EXTENSION;IN_IMAGE;EXISTS_PAIR_THM]); + REWRITE_TAC[IN_IMAGE;EXISTS_PAIR_THM]; + GEXISTL_TAC [`ivs_rho_node1 FF v`;`v`]; + REWRITE_TAC[]; + BY(ASM_MESON_TAC[Lunar_deform.IVS_RHO_NODE_V_IN_FF]) + ]);; + (* }}} *) + +let deformation_rho_node1_equivariant = prove_by_refinement( + `!f V E FF a b v . + deformation f V (a,b) /\ + local_fan (V,E,FF) /\ + v IN V ==> + (?e. &0 < e /\ + (!t. abs t < e ==> f (rho_node1 FF v) t = rho_node1 (IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) (f v t)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GEN_ALL Lunar_deform.XRECQNS_UPDATE) [`a`;`b`;`V`;`E`;`f`;`FF`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[deformation_rho_node1_equivariant1]) + ]);; + (* }}} *) + +let deformation_subset = prove_by_refinement( + `!f U V a b. U SUBSET V /\ deformation f V (a,b) ==> deformation f U (a,b)`, + (* {{{ proof *) + [ + REWRITE_TAC[Localization.deformation;SUBSET]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let EXISTS_TRIPLE_THM = prove_by_refinement( + `!P. (?p1 p2 p3. P p1 p2 p3) <=> (?x. P (FST x) (FST (SND x)) (SND (SND x)))`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[EXISTS_PAIR_THM]) + ]);; + (* }}} *) + +let zlz_reduction = prove_by_refinement( + `!a b V E FF f. + convex_local_fan (V,E,FF) /\ + generic V E /\ + deformation f V (a,b) /\ + (!v t. v IN V /\ t IN real_interval (a,b) /\ interior_angle1 (vec 0) FF v = pi ==> + interior_angle1 (vec 0) ( IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) (f v t) <= pi) /\ + (!u v w. + ?e4. v,w IN FF /\ u IN V + ==> &0 < e4 /\ + (!t. --e4 < t /\ t < e4 + ==> aff_ge {vec 0} {f v t, f w t} INTER + aff_lt {vec 0} {f u t} = + {})) /\ + (!x. ?e3. x IN FF + ==> &0 < e3 /\ + (!t. --e3 < t /\ t < e3 + ==> IMAGE (\v. f v t) V SUBSET + wedge_in_fan_ge (f (FST x) t,f (SND x) t) + (IMAGE (IMAGE (\v. f v t)) E))) /\ + (!x. ?e2. x IN FF + ==> &0 < e2 /\ + (!t. --e2 < t /\ t < e2 + ==> azim_in_fan (f (FST x) t,f (SND x) t) + (IMAGE (IMAGE (\v. f v t)) E) <= + pi)) + ==> (?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> convex_local_fan + (IMAGE (\v. f v t) V, + IMAGE (IMAGE (\v. f v t)) E, + IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) /\ + generic (IMAGE (\v. f v t) V) + (IMAGE (IMAGE (\v. f v t)) E)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Localization.convex_local_fan]; + REWRITE_TAC[Localization.generic]; + COMMENT "preliminaries"; + TYPIFY `!t. IMAGE (\s. IMAGE (\v. f v t) s) E = IMAGE (IMAGE (\v. f v t)) E /\ IMAGE (\(u,v). f u t,f v t) FF = IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[EXTENSION;IN_IMAGE;EXISTS_PAIR_THM]); + INTRO_TAC (GEN_ALL Local_lemmas.CVX_LO_IMP_LO) [`V`;`E`;`FF`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `FINITE FF` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Wrgcvdr_cizmrrh.LOCAL_FAN_FINITE_FF; + BY(ASM_REWRITE_TAC[]); + TYPIFY `~(FF = {})` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Polar_fan.LOCAL_FAN_NOT_EMPTY_FF; + BY(ASM_MESON_TAC[]); + TYPIFY `(?e1. &0 < e1 /\ (!t. --e1 < t /\ t < e1 ==> (local_fan (IMAGE (\v. f v t) V, IMAGE (IMAGE (\v. f v t)) E, IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF)))) /\ (?e2. &0 < e2 /\ (!t. --e2 < t /\ t < e2 ==> ((!x. x IN IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF ==> azim_in_fan x (IMAGE (IMAGE (\v. f v t)) E) <= pi)))) /\ (?e3. &0 < e3 /\ (!t. --e3 < t /\ t < e3 ==> (!x. x IN IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF ==> IMAGE (\v. f v t) V SUBSET wedge_in_fan_ge x (IMAGE (IMAGE (\v. f v t)) E)))) /\ (?e4. &0 < e4 /\ (!t. --e4 < t /\ t < e4 ==> (!v w u. {v, w} IN IMAGE (IMAGE (\v. f v t)) E /\ u IN IMAGE (\v. f v t) V ==> aff_ge {vec 0} {v, w} INTER aff_lt {vec 0} {u} = {})))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?e. e <= e1 /\ e <= e2 /\ e <= e3 /\ e <= e4 /\ &0 < e` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC Packing3.REAL_FINITE_MIN_EXISTS [`{e1,e2,e3,e4}`]; + ANTS_TAC; + CONJ_TAC; + BY(MESON_TAC[FINITE_RULES]); + BY(SET_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `m` EXISTS_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[IN_INSERT;NOT_IN_EMPTY]); + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN (REPEAT (FIRST_X_ASSUM_ST `&0 < e` MP_TAC)); + BY(MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e` EXISTS_TAC; + BY(ASM_MESON_TAC[arith `-- e < t /\ t < e /\ e <= e' ==> (-- e' < t /\ t < e')`]); + COMMENT "local_fan"; + SUBCONJ_TAC; + INTRO_TAC (GEN_ALL Lunar_deform.XRECQNS_UPDATE) [`a`;`b`;`V`;`E`;`f`;`FF`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[arith `-- e < t /\ t < e <=> abs t < e`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + COMMENT "skolemize all variables"; + COMMENT "angle <= pi"; + TYPIFY_GOAL_THEN `(!x. ?e2. x IN FF ==> ( &0 < e2 /\ (!t. --e2 < t /\ t < e2 ==> azim_in_fan ( (\uv. f (FST uv) t,f (SND uv) t) x) (IMAGE (IMAGE (\v. f v t)) E) <= pi))) ==> (?e2. &0 < e2 /\ (!t. --e2 < t /\ t < e2 ==> (!x. x IN IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF ==> azim_in_fan x (IMAGE (IMAGE (\v. f v t)) E) <= pi)))` GMATCH_SIMP_TAC; + REWRITE_TAC[SKOLEM_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?e. &0 < e /\ (!x. x IN FF ==> e <= e2 x)` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC Packing3.REAL_FINITE_MIN_EXISTS [`IMAGE e2 FF`]; + ANTS_TAC; + CONJ_TAC; + (MATCH_MP_TAC FINITE_IMAGE); + BY(ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Fatugpd.NOT_EMPTY_IMAGE); + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `m` EXISTS_TAC; + REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[EXTENSION;NOT_IN_EMPTY]; + REWRITE_TAC[IN_IMAGE]; + BY(MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[IN_IMAGE;EXISTS_PAIR_THM]; + REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM (C INTRO_TAC [`p1,p2`])); + DISCH_TAC; + ASM_REWRITE_TAC[]; + DISCH_TAC; + FIRST_X_ASSUM_ST `IMAGE` MP_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[]); + COMMENT "skolemize wedge_in_fan"; + TYPIFY_GOAL_THEN `(!x. ?e3. x IN FF ==> &0 < e3 /\ (!t. --e3 < t /\ t < e3 ==> (IMAGE (\v. f v t) V SUBSET wedge_in_fan_ge (f (FST x) t, f (SND x) t) (IMAGE (IMAGE (\v. f v t)) E)))) ==> ( (?e3. &0 < e3 /\ (!t. --e3 < t /\ t < e3 ==> (!x. x IN IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF ==> IMAGE (\v. f v t) V SUBSET wedge_in_fan_ge x (IMAGE (IMAGE (\v. f v t)) E)))))` GMATCH_SIMP_TAC; + REWRITE_TAC[SKOLEM_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?e. &0 < e /\ (!x. x IN FF ==> e <= e3 x)` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC Packing3.REAL_FINITE_MIN_EXISTS [`IMAGE e3 FF`]; + ANTS_TAC; + CONJ_TAC; + (MATCH_MP_TAC FINITE_IMAGE); + BY(ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Fatugpd.NOT_EMPTY_IMAGE); + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `m` EXISTS_TAC; + REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[EXTENSION;NOT_IN_EMPTY]; + REWRITE_TAC[IN_IMAGE]; + BY(MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[IN_IMAGE;EXISTS_PAIR_THM]; + REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM (C INTRO_TAC [`p1,p2`])); + DISCH_TAC; + ASM_REWRITE_TAC[]; + DISCH_TAC; + FIRST_X_ASSUM_ST `IMAGE` MP_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[]); + TYPIFY_GOAL_THEN `(!u v w. ?e4. (v,w) IN FF /\ u IN V ==> &0 < e4 /\ (!t. --e4 < t /\ t < e4 ==> aff_ge {vec 0} {f v t, f w t} INTER aff_lt {vec 0} {f u t} = {})) ==> (?e4. &0 < e4 /\ (!t. --e4 < t /\ t < e4 ==> (!v w u. {v, w} IN IMAGE (IMAGE (\v. f v t)) E /\ u IN IMAGE (\v. f v t) V ==> aff_ge {vec 0} {v, w} INTER aff_lt {vec 0} {u} = {}))) ` GMATCH_SIMP_TAC; + REWRITE_TAC[SKOLEM_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?e. &0 < e /\ (!u v w. (u,(v,w)) IN V CROSS FF ==> e <= e4 u v w)` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC Packing3.REAL_FINITE_MIN_EXISTS [`IMAGE (\ x. e4 (FST x) (FST (SND x)) (SND(SND x))) (V CROSS FF)`]; + ANTS_TAC; + CONJ_TAC; + (MATCH_MP_TAC FINITE_IMAGE); + MATCH_MP_TAC FINITE_CROSS; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_FINITE_V]); + (MATCH_MP_TAC Fatugpd.NOT_EMPTY_IMAGE); + REWRITE_TAC[CROSS_EQ_EMPTY]; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[Local_lemmas.LOFA_V_NOT_EMP]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `m` EXISTS_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[EXTENSION;NOT_IN_EMPTY]; + REWRITE_TAC[IN_IMAGE]; + REWRITE_TAC[EXISTS_PAIR_THM]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`p1`;`p1'`;`p2`]); + ANTS_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[IN_CROSS]); + BY(ASM_REWRITE_TAC[]); + (REPEAT WEAKER_STRIP_TAC); + ASM_REWRITE_TAC[]; + TYPIFY `m = e4 p1 p1' p2` UNDISCH_TAC; + DISCH_THEN (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_MESON_TAC[IN_CROSS]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[IN_IMAGE;EXISTS_PAIR_THM]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `IMAGE` MP_TAC; + REWRITE_TAC[IN_IMAGE]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?v' w'. x' = {v',w'}` (C SUBGOAL_THEN MP_TAC); + TYPIFY `graph E` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Fan_defs.FAN;Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN]); + RULE_ASSUM_TAC(REWRITE_RULE[Fan_defs.graph]); + TYPIFY`x' HAS_SIZE 2` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[IN]); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[Local_lemmas1.HAS_SIZE_2_EXISTS2]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + FIRST_X_ASSUM_ST `IMAGE` MP_TAC; + REWRITE_TAC[SET_RULE `IMAGE f {u,v} = {f u,f v}`]; + DISCH_THEN ( SUBST1_TAC ); + ASM_REWRITE_TAC[]; + TYPIFY `?v'' w''. {v',w'} = {v'',w''} /\ (v'',w'') IN FF` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[Local_lemmas.LOFA_IN_E_IMP_IN_FF;SET_RULE `{a,b} = {b,a}`]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `{f v' t,f w' t} = {f v'' t,f w'' t}` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM_ST `{a,b}` MP_TAC; + REWRITE_TAC[Collect_geom.PAIR_EQ_EXPAND]; + BY(MESON_TAC[]); + FIRST_X_ASSUM (C INTRO_TAC [`x`;`v''`;`w''`]); + REWRITE_TAC[IN_CROSS]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`x`;`v''`;`w''`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let real_interval_contains_0_ball = prove_by_refinement( +`!a b e1. a < &0 /\ &0 < b /\ &0 < e1 ==> (?e. &0 < e /\ e <= e1 /\ (!t. abs t < e ==> t IN real_interval (a,b)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `if (b <= -- a) /\ b <= e1 then b else (if e1 <= b /\ e1 <= --a then e1 else -- a)` EXISTS_TAC; + REWRITE_TAC[IN_REAL_INTERVAL]; + ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + GEN_TAC; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let zlz_azim = prove_by_refinement( + `!a b V E FF f. + convex_local_fan (V,E,FF) /\ + generic V E /\ + deformation f V (a,b) /\ + (!v t. v IN V /\ t IN real_interval (a,b) /\ interior_angle1 (vec 0) FF v = pi ==> + interior_angle1 (vec 0) ( IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) (f v t) <= pi) ==> + (!x. ?e2. x IN FF + ==> &0 < e2 /\ + (!t. --e2 < t /\ t < e2 + ==> azim_in_fan (f (FST x) t,f (SND x) t) + (IMAGE (IMAGE (\v. f v t)) E) <= + pi)) `, + (* {{{ proof *) + [ + REWRITE_TAC[Localization.convex_local_fan]; + REWRITE_TAC[Localization.generic]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "preliminaries"; + TYPIFY `!t. IMAGE (\s. IMAGE (\v. f v t) s) E = IMAGE (IMAGE (\v. f v t)) E /\ IMAGE (\(u,v). f u t,f v t) FF = IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[EXTENSION;IN_IMAGE;EXISTS_PAIR_THM]); + INTRO_TAC (GEN_ALL Local_lemmas.CVX_LO_IMP_LO) [`V`;`E`;`FF`]; + ASM_REWRITE_TAC[]; + TYPIFY `FINITE FF` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Wrgcvdr_cizmrrh.LOCAL_FAN_FINITE_FF; + BY(ASM_REWRITE_TAC[]); + TYPIFY `~(FF = {})` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Polar_fan.LOCAL_FAN_NOT_EMPTY_FF; + BY(ASM_MESON_TAC[]); + COMMENT "local_fan"; + INTRO_TAC (GEN_ALL Lunar_deform.XRECQNS_UPDATE) [`a`;`b`;`V`;`E`;`f`;`FF`]; + ASM_REWRITE_TAC[arith `-- e < t /\ t < e <=> abs t < e`]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "restart here"; + TYPIFY `?p1 p2. (x = p1,p2)` (C SUBGOAL_THEN MP_TAC); + BY(REWRITE_TAC[PAIR_SURJECTIVE]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[FST;SND]; + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + REWRITE_TAC[RIGHT_EXISTS_IMP_THM]; + DISCH_TAC; + TYPIFY `p1 IN V` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_IMP_IN_V]); + TYPIFY `p2 = rho_node1 FF p1` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC EQ_SYM; + MATCH_MP_TAC Local_lemmas.DETER_RHO_NODE; + BY(ASM_REWRITE_TAC[]); + TYPIFY `interior_angle1 (vec 0) FF p1 = azim_in_fan (p1,p2) E` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC LOFA_IMP_INANGLE_EQ_AZIM [`V`;`E`;`FF`;`p1`]; + BY(ASM_MESON_TAC[]); + TYPIFY `?e2. &0 < e2 /\ e2 <= e /\ (!t. abs t < e2 ==> t IN real_interval (a,b))` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC real_interval_contains_0_ball; + RULE_ASSUM_TAC(REWRITE_RULE[Localization.deformation;IN_REAL_INTERVAL]); + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "first case"; + TYPIFY `interior_angle1 (vec 0) FF p1 = pi` ASM_CASES_TAC; + TYPIFY `e2` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "new insert"; + TYPIFY `local_fan (IMAGE (\v. f v t) V, IMAGE (IMAGE (\v. f v t)) E, IMAGE (\uv. f (FST uv) (t),f (SND uv) (t)) FF) /\ f p1 (t) IN IMAGE (\v. f v t) V` (C SUBGOAL_THEN ASSUME_TAC); + CONJ_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REWRITE_TAC[IN_IMAGE]; + TYPIFY `p1` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + GMATCH_SIMP_TAC deformation_rho_node1_equivariant1; + CONJ_TAC; + GEXISTL_TAC [`a`;`b`;`E`;`V`]; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC (GSYM LOFA_IMP_INANGLE_EQ_AZIM) [`IMAGE (\v. f v t) V`;`IMAGE (IMAGE (\v. f v t)) E`;`IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF`;`f p1 t`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(ASM_MESON_TAC[]); + COMMENT "second case here"; + COMMENT "case azim < pi"; + TYPIFY `interior_angle1 (vec 0) FF p1 < pi` (C SUBGOAL_THEN ASSUME_TAC); + RULE_ASSUM_TAC (REWRITE_RULE[Localization.convex_local_fan]); + FIRST_X_ASSUM_ST `wedge_in_fan_ge` MP_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `interior_angle1 (vec 0) FF p1 <= pi` ENOUGH_TO_SHOW_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]); + INTRO_TAC WNWSHJT [`ivs_rho_node1 FF p1`;`p1`;`p2`;`f`;`a`;`b`]; + ASM_REWRITE_TAC[]; + REPEAT (GMATCH_SIMP_TAC (GSYM Local_lemmas1.AZIM_IN_FAN_RHOND_IVS_RHOND)); + TYPIFY `E` EXISTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + ANTS_TAC; + CONJ_TAC; + MATCH_MP_TAC deformation_subset; + TYPIFY `V` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + BY(ASM_MESON_TAC[Local_lemmas1.LOCAL_FAN_IVS_IN_V;Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]); + (GMATCH_SIMP_TAC deformation_rho_node1_equivariant1); + GMATCH_SIMP_TAC deformation_ivs_rho_node1_equivariant1; + CONJ_TAC; + GEXISTL_TAC [`a`;`b`;`E`;`V`]; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `&0 < e1` MP_TAC) THEN REAL_ARITH_TAC); + CONJ_TAC; + GEXISTL_TAC [`a`;`b`;`E`;`V`]; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `&0 < e1` MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `!v. v IN V ==> f v (&0) = v` (C SUBGOAL_THEN ASSUME_TAC); + RULE_ASSUM_TAC (REWRITE_RULE[Localization.deformation]); + BY(ASM_REWRITE_TAC[]); + TYPIFY `f p1 (&0) = p1` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_SIMP_TAC[]); + ASM_REWRITE_TAC[]; + TYPIFY `IMAGE (\uv. f (FST uv) (&0),f (SND uv) (&0)) FF = FF` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[IN_IMAGE;EXTENSION;EXISTS_PAIR_THM]; + GEN_TAC; + INTRO_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V) [`E`;`FF`;`FST x`;`SND x`;`V`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `x IN FF` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + GEXISTL_TAC [ `FST x`;`SND x`]; + BY(REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[PAIR;FST;SND]); + ASM_REWRITE_TAC[]; + REWRITE_TAC[NOT_EXISTS_THM]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GEN_ALL Local_lemmas.LOCAL_FAN_IMP_IN_V) [`E`;`FF`;`p1'`;`p2'`;`V`]; + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 6 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[PAIR;FST;SND]); + TYPIFY `p1 IN V` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_IMP_IN_V]); + CONJ_TAC; + BY(ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2]); + CONJ_TAC; + BY(ASM_MESON_TAC[Local_lemmas.LOFA_IMP_NOT_COLL_IVS]); + CONJ_TAC; + INTRO_TAC (GEN_ALL Local_lemmas.INTERIOR_ANGLE1_POS) [`E`;`V`;`FF`;`p1`]; + BY(ASM_REWRITE_TAC[]); + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `(!t. abs t < e ==> azim_in_fan (f p1 t,f (rho_node1 FF p1) t) (IMAGE (IMAGE (\v. f v t)) E) = azim (vec 0) (f p1 t) (f (rho_node1 FF p1) t) (f (ivs_rho_node1 FF p1) t))` (C SUBGOAL_THEN MP_TAC); + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC deformation_rho_node1_equivariant1; + CONJ_TAC; + GEXISTL_TAC [`a`;`b`;`E`;`V`]; + (ASM_REWRITE_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + GMATCH_SIMP_TAC Local_lemmas1.AZIM_IN_FAN_RHOND_IVS_RHOND; + CONJ_TAC; + TYPIFY `IMAGE (\v. f v t) V` EXISTS_TAC; + CONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[IN_IMAGE]; + TYPIFY `p1` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + GMATCH_SIMP_TAC deformation_ivs_rho_node1_equivariant1; + GEXISTL_TAC [`a`;`b`;`E`;`V`]; + (ASM_REWRITE_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + TYPIFY `if (e2 <= e') then e2 else e'` EXISTS_TAC; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `&0 < e` MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + DISCH_THEN SUBST1_TAC; + MATCH_MP_TAC (arith `x < pi ==> x <= pi`); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let zlz_generic = prove_by_refinement( + `!a b V E FF f. + convex_local_fan (V,E,FF) /\ + generic V E /\ + deformation f V (a,b) ==> + (!u v w. + ?e4. v,w IN FF /\ u IN V + ==> &0 < e4 /\ + (!t. --e4 < t /\ t < e4 + ==> aff_ge {vec 0} {f v t, f w t} INTER + aff_lt {vec 0} {f u t} = + {}))`, + (* {{{ proof *) + [ + COMMENT "prelims"; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[RIGHT_EXISTS_IMP_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + TYPIFY `v IN V /\ w IN V` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.LOCAL_FAN_IMP_IN_V; + BY(ASM_REWRITE_TAC[]); + TYPIFY `~(u = vec 0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.LOFA_IMP_V_DIFF]); + TYPIFY `rho_node1 FF v = w` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.DETER_RHO_NODE; + BY(ASM_REWRITE_TAC[]); + TYPIFY `~collinear {vec 0,v, rho_node1 FF v}` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + COMMENT "expand generic"; + RULE_ASSUM_TAC(REWRITE_RULE[Localization.generic]); + FIRST_X_ASSUM (C INTRO_TAC [`v`;`rho_node1 FF v`;`u`]); + ANTS_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC Local_lemmas.LOCAL_FAN_IN_FF_IN_ORD_PAIRS2; + BY(ASM_REWRITE_TAC[]); + (GMATCH_SIMP_TAC generic_alt); + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `?e. &0 < e /\ (!t. -- e < t /\ t < e ==> ~(f u t = vec 0) /\ ~collinear {vec 0,f v t,f w t} /\ (~coplanar {vec 0,f u t,f v t,f w t} \/ -- (f u t) IN wedge (vec 0) (f v t cross f w t) (f w t) (f v t)))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC generic_alt; + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `?e1. &0 < e1 /\ (!t. abs t < e1 ==> ~(f u t = vec 0))` (C SUBGOAL_THEN MP_TAC); + REWRITE_TAC[GSYM NORM_POS_LT]; + INTRO_TAC Pent_hex.continuous_preimage_open [`norm o (f u)`;`real_interval (a,b)`;`{x | &0 < x}`]; + REWRITE_TAC[Ocbicby.REAL_OPEN_REAL_INTERVAL]; + REWRITE_TAC[IN_ELIM_THM;o_THM]; + ANTS_TAC; + REWRITE_TAC[REAL_OPEN_HALFSPACE_GT;arith ` &0 < x <=> x > &0`]; + GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT; + REWRITE_TAC[Ocbicby.REAL_OPEN_REAL_INTERVAL]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC REAL_CONTINUOUS_CONTINUOUS_ATREAL_COMPOSE; + CONJ_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[Localization.deformation]); + BY(ASM_MESON_TAC[]); + BY(REWRITE_TAC[REAL_CONTINUOUS_NORM_WITHIN]); + REWRITE_TAC[real_open;IN_ELIM_THM]; + DISCH_THEN (C INTRO_TAC [`&0`]); + ANTS_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[Localization.deformation]); + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[NORM_POS_LT]); + BY(MESON_TAC[arith `abs (x - &0) = abs x`]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "collinearity"; + TYPIFY `f v (&0) = v /\ f w (&0) = w /\ f u (&0) = u /\ f v continuous atreal (&0) /\ f w continuous atreal (&0) /\ f u continuous atreal (&0)` (C SUBGOAL_THEN ASSUME_TAC); + RULE_ASSUM_TAC (REWRITE_RULE[Localization.deformation]); + BY(ASM_MESON_TAC[]); + TYPIFY `?e2. &0 < e2 /\ (!t. abs t < e2 ==> ~collinear {vec 0,f v t, f w t})` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC (GEN_ALL NONCOLLINEAR_OPEN) [`&0`;`(vec 0):real^3`;`f v`;`f w`]; + ASM_REWRITE_TAC[]; + BY(MESON_TAC[arith `abs(&0 - r') = abs(r')`]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?e3. &0 < e3 /\ (!t. abs t < e3 ==> ((~coplanar {vec 0, f u t, f v t, f w t} \/ --f u t IN wedge (vec 0) (f v t cross f w t) (f w t) (f v t))))` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM DISJ_CASES_TAC; + INTRO_TAC NONPLANAR_OPEN [`\ (t:real). (vec 0):real^3`;`f u`;`f v`;`f w`;`&0`]; + ASM_REWRITE_TAC[CONTINUOUS_CONST;arith `abs(&0 - t') = abs(t')`]; + BY(MESON_TAC[]); + COMMENT "disjointness"; + TYPIFY `~(v cross w = v) /\ ~(v cross w = w) ` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[CROSS_EQ_SELF]; + BY(ASM_MESON_TAC[COLLINEAR_2;SET_RULE `{a,a,b} = {a,b}`;SET_RULE `{a,b,a} = {a,b}`]); + TYPIFY `~(v cross w = -- u)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `wedge` MP_TAC; + REWRITE_TAC[wedge;IN_ELIM_THM]; + BY(MESON_TAC[COLLINEAR_2;SET_RULE `{a,b,b}={a,b}`]); + TYPIFY `~( ( -- (u:real^3) = v) \/ (-- u = w))` (C SUBGOAL_THEN MP_TAC); + DISCH_TAC; + FIRST_X_ASSUM_ST `wedge` MP_TAC; + REWRITE_TAC[Reuhady.WEDGE_SIMPLE]; + FIRST_X_ASSUM DISJ_CASES_TAC; + ASM_REWRITE_TAC[IN_ELIM_THM]; + BY(REWRITE_TAC[arith `~(x < x)`]); + ASM_REWRITE_TAC[IN_ELIM_THM]; + BY(REWRITE_TAC[AZIM_REFL;arith `~(&0 < &0)`]); + REWRITE_TAC[DE_MORGAN_THM]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "wedge"; + TYPIFY `?g. deformation g {v, v cross w, w, --u} (a,b) /\ ( g (v cross w) = (\t. f v t cross f w t)) /\ (g v = f v) /\ (g w = f w) /\ (g (-- u) = (\t. -- f u t))` (C SUBGOAL_THEN MP_TAC); + TYPIFY `\x. if (x = --u) then (\t. -- f u t) else if (x = v cross w) then (\t. f v t cross f w t) else f x` EXISTS_TAC; + ASM_TAC THEN ASM_REWRITE_TAC[Localization.deformation;IN_INSERT;NOT_IN_EMPTY] THEN REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]; + CONJ2_TAC; + BY(REPEAT WEAKER_STRIP_TAC THEN (REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC)) THEN ASM_REWRITE_TAC[] THEN TRY (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC THEN (REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC)) THEN ASM_REWRITE_TAC[] THEN TRY (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[]; + BY(MATCH_MP_TAC (* Xbjrphc. *)CONTINUOUS_CROSS THEN REWRITE_TAC[ETA_AX] THEN CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + MATCH_MP_TAC CONTINUOUS_NEG; + BY(REWRITE_TAC[ETA_AX] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC NHCXLRV [`-- (u:real^3)`;`v`;`v cross w`;`w`;`g`;`a`;`b`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + TYPIFY_GOAL_THEN `~collinear {vec 0, v cross w, --u}` (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `wedge` MP_TAC; + REWRITE_TAC[wedge;IN_ELIM_THM]; + BY(MESON_TAC[]); + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`]; + BY(ASM_REWRITE_TAC[GSYM Local_lemmas.COLL_IFF_COLL_CROSS;GSYM COLL_IFF_COLL_CROSS2]); + BY(MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `(?e. (&0 < e /\ e <= e1 /\ e <= e2 /\ e <= e3))` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC Packing3.REAL_FINITE_MIN_EXISTS [`{e1,e2,e3}`]; + ANTS_TAC; + CONJ_TAC; + REWRITE_TAC[FINITE_RULES]; + BY(REWRITE_TAC[FINITE_INSERT;FINITE_EMPTY]); + BY(SET_TAC[]); + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `m` EXISTS_TAC; + CONJ_TAC; + REPEAT (FIRST_X_ASSUM_ST `&0 < e` MP_TAC); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e` EXISTS_TAC; + REWRITE_TAC[arith `-- e < t /\ t < e <=> abs t < e`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN (REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN TRY REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let zlz_wedge_skolem = prove_by_refinement( + `!a b V E FF f. + convex_local_fan (V,E,FF) /\ + (!x v. ?e3. x IN FF /\ v IN V + ==> &0 < e3 /\ + (!t. --e3 < t /\ t < e3 + ==> (f v t) IN + wedge_in_fan_ge (f (FST x) t,f (SND x) t) + (IMAGE (IMAGE (\v. f v t)) E))) + ==> + (!x. ?e3. x IN FF + ==> &0 < e3 /\ + (!t. --e3 < t /\ t < e3 + ==> IMAGE (\v. f v t) V SUBSET + wedge_in_fan_ge (f (FST x) t,f (SND x) t) + (IMAGE (IMAGE (\v. f v t)) E)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[RIGHT_EXISTS_IMP_THM]; + DISCH_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`x`]); + REWRITE_TAC[SKOLEM_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + TYPIFY `~(V = {})` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.LOFA_V_NOT_EMP; + BY(ASM_REWRITE_TAC[]); + TYPIFY `?e. &0 < e /\ (!v. v IN V ==> e <= e3 v)` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC Packing3.REAL_FINITE_MIN_EXISTS [`IMAGE e3 V`]; + ANTS_TAC; + CONJ_TAC; + (MATCH_MP_TAC FINITE_IMAGE); + MATCH_MP_TAC Local_lemmas.LOCAL_FAN_FINITE_V; + BY(ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Fatugpd.NOT_EMPTY_IMAGE); + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `m` EXISTS_TAC; + REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[IN_IMAGE;EXTENSION;NOT_IN_EMPTY]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `wedge_in_fan_ge` (C INTRO_TAC [`x'`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[SUBSET;IN_IMAGE]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `wedge_in_fan_ge` (C INTRO_TAC [`x''`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[]; + DISCH_THEN MATCH_MP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`x''`]); + ASM_REWRITE_TAC[]; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let wedge_ge_refl = prove_by_refinement( + `!v1 v2 v3 v4. v2 IN wedge_ge v1 v2 v3 v4`, + (* {{{ proof *) + [ + REWRITE_TAC[Local_lemmas.WEDGE_GE_AZIM_LE;Local_lemmas.AZIM_SPEC_DEGENERATE]; + BY(REWRITE_TAC[Counting_spheres.AZIM_NN]) + ]);; + (* }}} *) + +let zlz_wedge_refl = prove_by_refinement( + `!a b V E FF f. + convex_local_fan (V,E,FF) /\ + generic V E /\ + deformation f V (a,b) /\ + (!v t. v IN V /\ t IN real_interval (a,b) /\ interior_angle1 (vec 0) FF v = pi ==> + interior_angle1 (vec 0) ( IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) (f v t) <= pi) ==> + (!v w. (w IN V /\ v IN {w, rho_node1 FF w, ivs_rho_node1 FF w}) ==> + ?e. &0 < e /\ (!t. -- e < t /\ t < e ==> f v t IN wedge_in_fan_ge (f w t , f (rho_node1 FF w) t) + (IMAGE (IMAGE (\v. f v t)) E)))`, + (* {{{ proof *) + [ + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC (GEN_ALL Lunar_deform.XRECQNS_UPDATE) [`a`;`b`;`V`;`E`;`f`;`FF`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!t. IMAGE (\s. IMAGE (\v. f v t) s) E = IMAGE (IMAGE (\v. f v t)) E /\ IMAGE (\(u,v). f u t,f v t) FF = IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[EXTENSION;IN_IMAGE;EXISTS_PAIR_THM]); + INTRO_TAC (GEN_ALL Local_lemmas.CVX_LO_IMP_LO) [`V`;`E`;`FF`]; + ASM_REWRITE_TAC[]; + TYPIFY `e` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `-- e < t /\ t < e <=> abs t < e`]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `local_fan` (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC deformation_rho_node1_equivariant1 [`f`;`V`;`E`;`FF`;`a`;`b`;`w`;`t`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC deformation_ivs_rho_node1_equivariant1 [`f`;`V`;`E`;`FF`;`a`;`b`;`w`;`t`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Local_lemmas1.WEDGE_IN_FAN_RHOND_IVS_RHOND; + CONJ_TAC; + TYPIFY `IMAGE (\v. f v t) V` EXISTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[IN_IMAGE]); + REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[Local_lemmas1.FST_LST_IN_WEDGE_GE]; + BY(REWRITE_TAC[wedge_ge_refl]) + ]);; + (* }}} *) + +let zlz_wedge_open = prove_by_refinement( + `!a b V E FF f. + convex_local_fan (V,E,FF) /\ + generic V E /\ + deformation f V (a,b) /\ + (!v t. v IN V /\ t IN real_interval (a,b) /\ interior_angle1 (vec 0) FF v = pi ==> + interior_angle1 (vec 0) ( IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) (f v t) <= pi) ==> + (!v w. (v IN V /\ w IN V /\ v IN wedge (vec 0) w (rho_node1 FF w) (ivs_rho_node1 FF w)) ==> + ?e. &0 < e /\ (!t. -- e < t /\ t < e ==> f v t IN wedge_in_fan_ge (f w t , f (rho_node1 FF w) t) + (IMAGE (IMAGE (\v. f v t)) E)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC (GEN_ALL Lunar_deform.XRECQNS_UPDATE) [`a`;`b`;`V`;`E`;`f`;`FF`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!t. IMAGE (\s. IMAGE (\v. f v t) s) E = IMAGE (IMAGE (\v. f v t)) E /\ IMAGE (\(u,v). f u t,f v t) FF = IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[EXTENSION;IN_IMAGE;EXISTS_PAIR_THM]); + TYPIFY `v = w` ASM_CASES_TAC; + INTRO_TAC zlz_wedge_refl [`a`;`b`;`V`;`E`;`FF`;`f`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (C INTRO_TAC [`w`;`w`]); + BY(ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]); + INTRO_TAC NHCXLRV_ALT [`v`;`(ivs_rho_node1 FF w)`;`w`;`(rho_node1 FF w)`;`f`;`a`;`b`]; + ASM_REWRITE_TAC[]; + TYPIFY `rho_node1 FF w IN V` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + BY(ASM_REWRITE_TAC[]); + TYPIFY `ivs_rho_node1 FF w IN V` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas1.LOCAL_FAN_IVS_IN_V; + BY(ASM_REWRITE_TAC[]); + GMATCH_SIMP_TAC Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC Local_lemmas.LOFA_IMP_NOT_COLL_IVS; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + ANTS_TAC; + CONJ_TAC; + MATCH_MP_TAC deformation_subset; + TYPIFY `V` EXISTS_TAC; + ASM_REWRITE_TAC[]; + ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[Nkezbfc_local.PROPERTIES_GENERIC_LOCAL_FAN]); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `--e < t /\ t < e <=> abs t < e`]; + TYPIFY `?e''. (&0 < e'') /\ e'' <= e /\ e'' <= e'` (C SUBGOAL_THEN MP_TAC); + TYPIFY `if (e <= e') then e else e'` EXISTS_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `&0 < e` MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `e''` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `local_fan` (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + DISCH_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + DISCH_TAC; + INTRO_TAC deformation_rho_node1_equivariant1 [`f`;`V`;`E`;`FF`;`a`;`b`;`w`;`t`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC deformation_ivs_rho_node1_equivariant1 [`f`;`V`;`E`;`FF`;`a`;`b`;`w`;`t`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Local_lemmas1.WEDGE_IN_FAN_RHOND_IVS_RHOND; + CONJ_TAC; + TYPIFY `IMAGE (\v. f v t) V` EXISTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[IN_IMAGE]); + FIRST_X_ASSUM_ST `wedge` MP_TAC; + ASM_REWRITE_TAC[]; + BY(SET_TAC[Leaf_cell.WEDGE_SUBSET_WEDGE_GE]) + ]);; + (* }}} *) + +let PROPERTIES_GENERIC_LOCAL_FAN_ALT = prove_by_refinement( + `!V E FF u v. + local_fan (V,E,FF) /\ u IN V /\ v IN V /\ ~(u = v) /\ generic V E ==> ~collinear {vec 0,u,v}`, + (* {{{ proof *) + [ + BY(ASM_MESON_TAC[Nkezbfc_local.PROPERTIES_GENERIC_LOCAL_FAN]) + ]);; + (* }}} *) + +let skolem_epsilon_old = prove_by_refinement( + `!P Q s. (!e e' i. &0 < e /\ e <= e' /\ (i:A) IN s /\ P i==> (Q e' i ==> Q e i)) /\ FINITE s ==> + ((!i. ?e. (i IN s /\ P i) ==> (&0 < e /\ Q e i)) <=> (?e. !i. (i IN s /\ P i) ==> (&0 < e /\ Q e i)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(?i. i IN s /\ P i)` ASM_CASES_TAC; + BY(ASM_MESON_TAC[]); + RULE_ASSUM_TAC(REWRITE_RULE[]); + MATCH_MP_TAC (TAUT `((a ==>b) /\ (b ==> a)) ==> (a <=> b)`); + CONJ_TAC; + REWRITE_TAC[SKOLEM_THM]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Packing3.REAL_FINITE_MIN_EXISTS [`IMAGE e {i | i IN s /\ P i}`]; + ANTS_TAC; + CONJ_TAC; + (MATCH_MP_TAC FINITE_IMAGE); + MATCH_MP_TAC FINITE_SUBSET; + TYPIFY `s` EXISTS_TAC; + ASM_REWRITE_TAC[]; + BY(SET_TAC[]); + (MATCH_MP_TAC Fatugpd.NOT_EMPTY_IMAGE); + ASM_REWRITE_TAC[EXTENSION;IN_ELIM_THM;NOT_IN_EMPTY]; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `m` EXISTS_TAC; + REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[IN_IMAGE;EXTENSION;NOT_IN_EMPTY;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let SKOLEM_EPSILON = prove_by_refinement( + `!Q s. (!e e' i. &0 < e /\ e <= e' /\ (i:A) IN s ==> (Q e' i ==> Q e i)) /\ FINITE s ==> + ((!i. ?e. (&0 < e) /\ (i IN s ==> (Q e i))) <=> (?e. !i. (&0 < e) /\ (i IN s ==> ( Q e i))))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(?i. i IN s)` ASM_CASES_TAC; + BY(ASM_MESON_TAC[]); + RULE_ASSUM_TAC(REWRITE_RULE[]); + MATCH_MP_TAC (TAUT `((a ==>b) /\ (b ==> a)) ==> (a <=> b)`); + CONJ2_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[SKOLEM_THM]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Packing3.REAL_FINITE_MIN_EXISTS [`IMAGE e s`]; + ANTS_TAC; + CONJ_TAC; + (MATCH_MP_TAC FINITE_IMAGE); + BY(ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Fatugpd.NOT_EMPTY_IMAGE); + ASM_REWRITE_TAC[EXTENSION;IN_ELIM_THM;NOT_IN_EMPTY]; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `m` EXISTS_TAC; + GEN_TAC; + REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[IN_IMAGE;EXTENSION;NOT_IN_EMPTY;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let EXISTS_AND_IMP = prove_by_refinement( + `!P Q R. (?(d:A). (P /\ Q d ==> R d)) <=> (P ==> (?d. Q d ==> R d))`, + (* {{{ proof *) + [ + MESON_TAC[] + ]);; + (* }}} *) + +let XIV_DEFORMATION = prove_by_refinement( + `!f dh r w a b. + deformation f {w i | i <= r + 2} (a,b) /\ + pairwise (\i j. ~collinear {vec 0, w i, w j}) (0..(r+1)) /\ + pairwise (\i j. ~collinear {vec 0, w i, w j}) (1..(r+2)) /\ + (\ (i,j,k). dihV (vec 0) (w i) (w j) (w k)) = dh /\ + (!i. ?e2. i IN 1..r+1 ==> &0 < e2 /\ + (!t. abs t < e2 ==> azim (vec 0) (f (w i) t) (f (w (i+1)) t) (f (w (i-1)) t) <= pi)) /\ + (!i. i IN 1..r+1 ==> &0 < azim (vec 0) (w i) (w (i+1)) (w (i-1))) /\ + (!p q. + {p, q, q + 1} SUBSET 1..r+1 /\ ~(p = q) /\ ~(p = q + 1) + ==> dh (p,q,q + 1) = &0) /\ + (!p q. + {p, p + 1, q} SUBSET 1..r+1 /\ q > p + 1 ==> dh (p,p + 1,q) = &0) /\ + (!p q. {p + 1, p, q} SUBSET 1..r+1 /\ q < p ==> dh (p + 1,p,q) = &0) + ==> (?e. &0 < e /\ (!t. abs t < e ==> + f (w 1) t IN wedge_ge (vec 0) (f (w (r+1)) t) (f (w (r+2)) t) (f (w (r)) t) /\ + f (w (r+1)) t IN wedge_ge (vec 0) (f (w 1) t) (f (w (2)) t) (f (w (0)) t)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + COMMENT "prelims"; + COMMENT "find collinear epsilon"; + TYPIFY `!i. i <= r + 2 ==> f (w i) (&0) = w i` ((C SUBGOAL_THEN ASSUME_TAC)); + RULE_ASSUM_TAC(REWRITE_RULE[Localization.deformation;IN_ELIM_THM;]); + BY(ASM_MESON_TAC[]); + TYPIFY `!i j. i IN 0..r+2 /\ j IN 0..r+2 /\ ~collinear {vec 0,w i,w j} ==> (?dc. &0 < dc /\ (!t. abs t < dc ==> ~collinear {vec 0, f (w i) t, f (w j) t}))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GEN_ALL NONCOLLINEAR_OPEN) [`&0`;`(vec 0):real^3`;`f (w i)`;`f (w j)`]; + RULE_ASSUM_TAC(REWRITE_RULE[Localization.deformation;IN_ELIM_THM;IN_NUMSEG]); + ANTS_TAC; + BY(ASM_MESON_TAC[]); + BY(REWRITE_TAC[arith `abs(&0 - r') = abs r'`]); + COMMENT "skolemize collinear"; + TYPIFY `?dc. !i. (&0 < dc) /\ (i IN 0..r+2 ==> (!j. j IN 0..r+2 /\ ~collinear {vec 0,w i,w j} ==> (!t. abs t < dc ==> ~collinear {vec 0, f (w i) t, f (w j) t})))` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC (GSYM SKOLEM_EPSILON); + REWRITE_TAC[FINITE_NUMSEG]; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`j`]); + ANTS_TAC; + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + DISCH_THEN (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(REPLICATE_TAC 8 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + GEN_TAC; + REWRITE_TAC[MESON [arith `&0 < &1`] `(?dc. &0 < dc /\ (a ==> (!j. b j /\ c j ==> r dc j))) <=> (a ==> (?dc. !j. &0 < dc /\ (b j ==> (c j ==> r dc j))))`]; + DISCH_TAC; + GMATCH_SIMP_TAC (GSYM SKOLEM_EPSILON); + REWRITE_TAC[FINITE_NUMSEG]; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `!` MP_TAC; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN (C INTRO_TAC [`t`]); + ANTS_TAC; + BY(REPLICATE_TAC 8 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`i`;`j`]); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[arith `&0 < &1`]); + FIRST_X_ASSUM_ST `collinear` MP_TAC THEN BURY_MP_TAC; + FIRST_X_ASSUM_ST `collinear` kill; + COMMENT "find dih epsilon"; + TYPIFY `!i j k e. &0 < e /\ i IN 1..r+1 /\ j IN 1 ..r+1 /\ k IN 1..r+1 /\ ~(i=j) /\ ~(i=k) /\ dh (i,j,k) = &0 ==> (? d. &0 < d /\ (!t. abs t < d ==> dihV (vec 0) (f (w i) t) (f (w j) t) (f (w k) t) < e))` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "dh" THEN REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!i. i <= r + 2 ==> f (w i) (&0) = w i` ((C SUBGOAL_THEN ASSUME_TAC)); + RULE_ASSUM_TAC(REWRITE_RULE[Localization.deformation;IN_ELIM_THM;]); + BY(ASM_MESON_TAC[]); + INTRO_TAC (* Xbjrphc. *)REAL_CONTINUOUS_ATREAL_DIHV_COMPOSE [`\(t:real). (vec 0):real^3`;`f (w i)`;`f (w j)`;`f (w k)`;`&0`]; + ANTS_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[Localization.deformation;IN_ELIM_THM;pairwise]); + REWRITE_TAC[CONTINUOUS_CONST]; + FIRST_X_ASSUM (REPEAT o GMATCH_SIMP_TAC); + ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[IN_NUMSEG]); + TYPIFY_GOAL_THEN `k <= r + 2 /\ j <= r + 2 /\ i <= r + 2 ` (unlist REWRITE_TAC); + BY(ASM_ARITH_TAC); + REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THEN TRY ASM_ARITH_TAC; + BY(TYPIFY `i` EXISTS_TAC THEN ASM_ARITH_TAC); + BY(TYPIFY `j` EXISTS_TAC THEN ASM_ARITH_TAC); + BY(TYPIFY `k` EXISTS_TAC THEN ASM_ARITH_TAC); + REWRITE_TAC[real_continuous_atreal]; + DISCH_THEN (C INTRO_TAC [`e`]); + ASM_REWRITE_TAC[arith `abs (x' - &0) = abs x'`] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `d` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `i <= r + 2` (REPEAT o GMATCH_SIMP_TAC); + ASM_REWRITE_TAC[]; + RULE_ASSUM_TAC(REWRITE_RULE[IN_NUMSEG]); + ASM_SIMP_TAC[arith `i <= r + 1 ==> i <= r + 2`]; + BY(REAL_ARITH_TAC); + COMMENT "merge dih epsilon"; + TYPIFY `!e. &0 < e ==> (?d. !i. (&0 < d) /\ (i IN 1..r+1 ==> (!j k. j IN 1..r+1 /\ k IN 1..r+1 /\ ~(i = j) /\ ~(i=k) /\ dh(i,j,k)= &0 ==> (!t. abs t < d ==> dihV (vec 0) (f (w i) t) (f (w j) t) (f (w k) t) < e))))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC (GSYM SKOLEM_EPSILON); + REWRITE_TAC[FINITE_NUMSEG]; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`j`;`k`]); + ASM_REWRITE_TAC[]; + DISCH_THEN MATCH_MP_TAC; + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + GEN_TAC; + REWRITE_TAC[MESON[arith `&0 < &1`] `(?d. &0 < d /\ (p ==> (!j k. a j /\ r j k ==> u j k d))) <=> (p ==> (?d. !j. &0 < d /\ (a j ==> (!k. r j k ==> u j k d))))`]; + DISCH_TAC; + GMATCH_SIMP_TAC (GSYM SKOLEM_EPSILON); + REWRITE_TAC[FINITE_NUMSEG]; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`k`]); + ASM_REWRITE_TAC[]; + DISCH_THEN MATCH_MP_TAC; + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + GEN_TAC; + REWRITE_TAC[MESON[arith `&0 < &1`] `(?d. &0 < d /\ (p ==> (!k. a k /\ r k ==> u k d))) <=> (p ==> (?d. !k. &0 < d /\ (a k ==> (r k ==> u k d))))`]; + DISCH_TAC; + GMATCH_SIMP_TAC (GSYM SKOLEM_EPSILON); + REWRITE_TAC[FINITE_NUMSEG]; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `dihV` MP_TAC; + ASM_REWRITE_TAC[]; + DISCH_THEN MATCH_MP_TAC; + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + GEN_TAC; + REWRITE_TAC[MESON[arith `&0 < &1`] `(?d. &0 < d /\ (a ==> b ==> c d)) <=> (a /\ b ==> (?d. &0 < d /\ c d))`]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`i`;`j`;`k`;`e`]); + DISCH_THEN MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM MP_TAC; + FIRST_X_ASSUM kill; + REPEAT WEAKER_STRIP_TAC; + COMMENT "azim lb"; + TYPIFY `?c. !i. (&0 < c) /\ (i IN 1..r+1 ==> c < azim (vec 0) (w i) (w (i+1)) (w (i-1)))` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC (GSYM SKOLEM_EPSILON); + REWRITE_TAC[FINITE_NUMSEG]; + CONJ_TAC; + BY(REAL_ARITH_TAC); + GEN_TAC; + REWRITE_TAC[MESON[arith `&0 < &1`] `(?c. &0 < c /\ (b ==> r c)) <=> (b ==> (?c. &0 < c /\ r c))`]; + DISCH_TAC; + TYPIFY `azim (vec 0) (w i) (w (i+1)) (w (i-1)) / &2` EXISTS_TAC; + FIRST_X_ASSUM_ST `azim` (C INTRO_TAC [`i`]); + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM MP_TAC THEN REPEAT WEAKER_STRIP_TAC; + COMMENT "azim deform lower bound"; + TYPIFY `!i. i IN 1..r+1 ==> (?d. &0 < d /\ (!t. abs t < d ==> (c < azim (vec 0) (f (w i) t) (f (w(i+1)) t) (f (w(i-1)) t))))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!i. i <= r + 2 ==> f (w i) (&0) = w i` ((C SUBGOAL_THEN ASSUME_TAC)); + RULE_ASSUM_TAC(REWRITE_RULE[Localization.deformation;IN_ELIM_THM;]); + BY(ASM_MESON_TAC[]); + INTRO_TAC (* Xbjrphc. *)REAL_CONTINUOUS_ATREAL_AZIM_COMPOSE [`\(t:real). (vec 0):real^3`;`f (w i)`;`f (w (i+1))`;`f (w (i-1))`;`&0`]; + ANTS_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[Localization.deformation;IN_ELIM_THM;pairwise]); + REWRITE_TAC[CONTINUOUS_CONST]; + FIRST_X_ASSUM (REPEAT o GMATCH_SIMP_TAC); + ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[IN_NUMSEG]); + TYPIFY_GOAL_THEN `i - 1 <= r + 2 /\ i + 1 <= r + 2 /\ i <= r + 2` (unlist REWRITE_TAC); + BY(ASM_ARITH_TAC); + GMATCH_SIMP_TAC (GSYM Local_lemmas.AZIM_EQ_0_GE_ALT2); + REWRITE_TAC[GSYM azim_pos_iff_nz]; + TYPIFY_GOAL_THEN ` ~collinear {vec 0, w i, w (i - 1)}` (unlist REWRITE_TAC); + FIRST_X_ASSUM_ST `collinear` kill; + BY((FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[] THEN TRY ASM_ARITH_TAC); + REPEAT CONJ_TAC THEN (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[] THEN TRY ASM_ARITH_TAC; + BY(TYPIFY `i` EXISTS_TAC THEN ASM_ARITH_TAC); + BY(TYPIFY `i+1` EXISTS_TAC THEN ASM_ARITH_TAC); + BY(TYPIFY `i-1` EXISTS_TAC THEN ASM_ARITH_TAC); + REWRITE_TAC[real_continuous_atreal]; + FIRST_X_ASSUM (REPEAT o GMATCH_SIMP_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[IN_NUMSEG]); + TYPIFY_GOAL_THEN `i - 1 <= r + 2 /\ i + 1 <= r + 2 /\ i <= r + 2` (unlist REWRITE_TAC); + BY(ASM_ARITH_TAC); + DISCH_THEN (C INTRO_TAC [`abs(azim (vec 0) (w i) (w (i+1)) (w (i-1)) - c)`]); + FIRST_X_ASSUM (C INTRO_TAC [`i`]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `c < azim a1 a2 a3 a4` MP_TAC; + ASM_REWRITE_TAC[]; + DISCH_TAC; + FIRST_X_ASSUM_ST `abs` MP_TAC; + ANTS_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[arith `abs (x' - &0) = abs x'`] THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `d` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT "skolemize the azim delta"; + TYPIFY `?d. !i. &0 < d /\ (i IN 1..r+1 ==> (!t. abs t < d ==> c < azim (vec 0) (f (w i) t) (f (w (i + 1)) t) (f (w (i - 1)) t)))` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC (GSYM SKOLEM_EPSILON); + REWRITE_TAC[FINITE_NUMSEG]; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + DISCH_THEN MATCH_MP_TAC; + BY(REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[arith `&0< &1`]); + FIRST_X_ASSUM_ST `!i. i IN s ==> u` kill; + COMMENT "skolemize azim<=pi"; + TYPIFY `?d2. !i. &0 < d2 /\ (i IN 1..r+1 ==> (!t. abs t < d2 ==> azim (vec 0) (f (w i) t) (f (w (i + 1)) t) (f (w (i - 1)) t) <= pi))` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC (GSYM SKOLEM_EPSILON); + REWRITE_TAC[FINITE_NUMSEG]; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + DISCH_THEN MATCH_MP_TAC; + BY(REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(FIRST_X_ASSUM_ST `azim a b c d <= pi` MP_TAC THEN MESON_TAC[arith `&0< &1`]); + FIRST_X_ASSUM_ST `!i. i IN s ==> u` kill; + COMMENT "pick eps"; + TYPIFY `?e. &0 < e /\ &2 * e = c` (C SUBGOAL_THEN MP_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[MESON[] `(!i. a /\ b i) <=> (a /\ (!i. b i))`]); + TYPIFY `c / &2` EXISTS_TAC; + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE) o GSYM); + FIRST_X_ASSUM (C INTRO_TAC [`e`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `?d'3. !d''. (&0 < d'3) /\ (d'' IN {d,d',d2,dc} ==> d'3 <= d'')` (C SUBGOAL_THEN MP_TAC); + GMATCH_SIMP_TAC (GSYM SKOLEM_EPSILON); + REWRITE_TAC[FINITE_INSERT;FINITE_EMPTY]; + CONJ_TAC; + BY(REAL_ARITH_TAC); + GEN_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[MESON[] `(!i. a /\ b i) <=> (a /\ (!i. b i))`]); + TYPIFY `if (d'' IN {d,d',d2,dc}) then d'' else &1` EXISTS_TAC; + CONJ_TAC; + ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `&0 < d` MP_TAC) THEN REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY] THEN REAL_ARITH_TAC); + BY(REAL_ARITH_TAC); + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `d'3` EXISTS_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[MESON[] `(!i. a /\ b i) <=> (a /\ (!i. b i))`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Xivphks.XIVPHKS_SHIFT [`\i. wedge_ge (vec 0) (f (w (i)) t) (f (w (i + 1)) t) (f (w (i-1)) t)`;`\ (i,j,k). azim (vec 0) (f (w i) t) (f (w (j)) t) (f (w (k)) t)`;`\ (i,j,k). dihV (vec 0) (f (w i) t) (f (w j) t) (f (w k) t)`;`e`;`r`;`\i. f (w i) t`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + REWRITE_TAC[pairwise]; + RULE_ASSUM_TAC(REWRITE_RULE[pairwise]); + TYPIFY `!j. j IN 0..r+1 ==> j IN 0..r+2` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC); + TYPIFY `!t. abs t < d'3 ==> abs t < dc` (C SUBGOAL_THEN ASSUME_TAC); + REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`dc`]); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + CONJ_TAC; + REPEAT (FIRST_X_ASSUM_ST `azim` kill); + BY(ASM_MESON_TAC[]); + CONJ_TAC; + REPEAT (FIRST_X_ASSUM_ST `azim` kill); + TYPIFY `!j. j IN 1..r+2 ==> j IN 0..r+2` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC); + BY(ASM_MESON_TAC[]); + CONJ_TAC; + TYPIFY `abs t < d'` (C SUBGOAL_THEN ASSUME_TAC); + REPLICATE_TAC 6 (FIRST_X_ASSUM MP_TAC) THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `\/` (C INTRO_TAC [`d'`]); + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(ASM_MESON_TAC[]); + CONJ_TAC; + TYPIFY `abs t < d2` (C SUBGOAL_THEN ASSUME_TAC); + REPLICATE_TAC 6 (FIRST_X_ASSUM MP_TAC) THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `\/` (C INTRO_TAC [`d2`]); + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(ASM_MESON_TAC[]); + REPEAT (FIRST_X_ASSUM_ST `azim` kill); + TYPIFY `abs t < d` (C SUBGOAL_THEN ASSUME_TAC); + REPLICATE_TAC 6 (FIRST_X_ASSUM MP_TAC) THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `\/` (C INTRO_TAC [`d`]); + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `!i j k. {i,j,k} SUBSET 1..r+1 ==> i IN 1..r+1 /\ j IN 1..r+1 /\ k IN 1..r+1` (C SUBGOAL_THEN ASSUME_TAC); + BY(SET_TAC[]); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + REPEAT (FIRST_X_ASSUM_ST `collinear` kill); + BY(ASM_MESON_TAC[arith `~(p = p+1)`;arith `q > p+1 ==> ~(p = q)`]); + BY(ASM_MESON_TAC[arith `~(p = p+1)`;arith `q < p ==> ~(p+1 = q)`]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`r`;`1`]); + FIRST_X_ASSUM (C INTRO_TAC [`r`;`1`]); + REWRITE_TAC[arith `(r:num) <= r`;arith `1 + 1 = 2 /\ 1 - 1 = 0 /\ (1+r)+1 = r + 2 /\ 1 + r <= r + 1 /\ (1 + r) - 1 = r`]; + REWRITE_TAC[arith `1 + r = r + 1`]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let XIV_ECAU = prove_by_refinement( + `!f r w a b. + deformation f {w i | i <= r + 2} (a,b) /\ + (!i. i IN 2..r+1 ==> w i IN aff_gt {vec 0,w 1 } {w 2} ) /\ + cyclic_set {w i | i IN 1..r+1 } (vec 0) ((w 1) cross (w 2)) /\ + (!i. i IN 1..r ==> azim_cycle {w i | i IN 1..r+1} (vec 0) ((w 1) cross (w 2)) (w i) = w (i+1)) /\ + pairwise (\i j. ~collinear {vec 0, w i, w j}) (0..(r+1)) /\ + pairwise (\i j. ~collinear {vec 0, w i, w j}) (1..(r+2)) /\ + (!i. ?e2. i IN 1..r+1 ==> &0 < e2 /\ + (!t. abs t < e2 ==> azim (vec 0) (f (w i) t) (f (w (i+1)) t) (f (w (i-1)) t) <= pi)) /\ + (!i. i IN 1..r+1 ==> &0 < azim (vec 0) (w i) (w (i+1)) (w (i-1))) + ==> (?e. &0 < e /\ (!t. abs t < e ==> + f (w 1) t IN wedge_ge (vec 0) (f (w (r+1)) t) (f (w (r+2)) t) (f (w (r)) t) /\ + f (w (r+1)) t IN wedge_ge (vec 0) (f (w 1) t) (f (w (2)) t) (f (w (0)) t)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC XIV_DEFORMATION; + TYPED_ABBREV_TAC `dh = \ (i,j,k). dihV (vec 0) (w i) (w j) (w k)`; + GEXISTL_TAC [`dh`;`a`;`b`]; + ASM_REWRITE_TAC[]; + INTRO_TAC KCZXLLE_SYM [`w o SUC`;`r`]; + REWRITE_TAC[o_THM;arith `1 <= r+1 /\ SUC 0 = 1 /\ SUC 1 = 2`]; + TYPIFY `{w (SUC i) | i <= r } = {w i | i IN 1..r+1}` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG]; + BY(MESON_TAC[arith `i <= r ==> (1 <= SUC i /\ SUC i <= r + 1)`;arith `(1 <= i /\ i <= r+1) ==> (PRE i <= r /\ SUC (PRE i) = i)`]); + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `(!i j. i <= r /\ j <= r /\ ~(i = j) ==> ~collinear {vec 0, w (SUC i), w (SUC j)})` (unlist REWRITE_TAC); + REPEAT WEAKER_STRIP_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[pairwise]); + FIRST_X_ASSUM (C INTRO_TAC [`SUC i`;`SUC j`]); + REWRITE_TAC[SUC_INJ]; + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC); + TYPIFY_GOAL_THEN ` (!i. 1 <= i /\ i <= r ==> w (SUC i) IN aff_gt {vec 0, w 1} {w 2})` (unlist REWRITE_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC); + TYPIFY_GOAL_THEN `(!i. i < r ==> azim_cycle {w i | i IN 1..r + 1} (vec 0) (w 1 cross w 2) (w (SUC i)) = w (SUC (i + 1)))` (unlist REWRITE_TAC); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `SUC (i + 1) = SUC i + 1`]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC); + TYPIFY `!i j k. i IN 1..r+1 /\ j IN 1..r+1 /\ k IN 1..r+1 /\ ~(i = j) /\ ~(i = k) /\ azim (vec 0) (w i) (w j) (w k) = &0 ==> dihV (vec 0) (w i) (w j) (w k) = &0` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC (GSYM Polar_fan.AZIM_DIHV_SAME_STRONG); + RULE_ASSUM_TAC (REWRITE_RULE[pairwise]); + TYPIFY_GOAL_THEN `~collinear {vec 0, w i, w j} /\ ~collinear {vec 0, w i, w k}` (unlist REWRITE_TAC); + BY(CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN REPLICATE_TAC 8 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC); + ASM_REWRITE_TAC[]; + BY(MP_TAC PI_POS THEN REAL_ARITH_TAC); + DISCH_TAC; + EXPAND_TAC "dh" THEN REWRITE_TAC[]; + REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + FIRST_X_ASSUM MP_TAC; + TYPIFY_GOAL_THEN `(!i j k. k <= r /\ j <= r /\ 1 <= r /\ i <= r /\ (j < k /\ (i < j \/ k < i) \/ k < j /\ (i < k \/ j < i)) ==> azim (vec 0) (w (SUC i)) (w (SUC j)) (w (SUC k)) = &0) <=> (!i j k. k IN 1..r+1 /\ i IN 1..r+1 /\ j IN 1..r+1 /\ (j < k /\ (i < j \/ k < i) \/ k < j /\ (i < k \/ j < i)) ==> azim (vec 0) (w (i)) (w (j)) (w ( k)) = &0)` (unlist REWRITE_TAC); + REWRITE_TAC[IN_NUMSEG]; + MATCH_MP_TAC (TAUT `((a ==> b) /\ (b ==> a)) ==> (a <=> b)`); + CONJ_TAC THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`PRE i`;`PRE j`;`PRE k`]); + ASM_SIMP_TAC[arith `1 <= i ==> SUC (PRE i) = i`]; + DISCH_THEN MATCH_MP_TAC; + BY(FIRST_X_ASSUM DISJ_CASES_TAC THEN REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM DISJ_CASES_TAC THEN REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + DISCH_TAC; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM_ST `azim` GMATCH_SIMP_TAC; + FIRST_X_ASSUM_ST `IN` (unlist ASM_SIMP_TAC); + REPLICATE_TAC 2(FIRST_X_ASSUM MP_TAC); + BY(ARITH_TAC); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM_ST `azim` GMATCH_SIMP_TAC; + FIRST_X_ASSUM_ST `IN` (unlist ASM_SIMP_TAC); + BY(REPLICATE_TAC 1(FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM_ST `azim` GMATCH_SIMP_TAC; + FIRST_X_ASSUM_ST `IN` (unlist ASM_SIMP_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN ARITH_TAC) + ]);; + (* }}} *) + +(* was cycle_set_scale *) + +let cyclic_set_scale = prove_by_refinement( + `!U t (e:real^A). ~(t = &0) ==> (cyclic_set U (vec 0) (t % e) <=> cyclic_set U (vec 0) e)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.cyclic_set]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~FINITE U` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + ONCE_REWRITE_TAC[varith `vec 0 = a <=> a = vec 0`]; + ASM_REWRITE_TAC[VECTOR_MUL_EQ_0]; + TYPIFY `(e = vec 0)` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + RULE_ASSUM_TAC(REWRITE_RULE[]); + ASM_REWRITE_TAC[]; + TYPIFY `affine hull {vec 0, t % e} = affine hull {vec 0,e}` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[AFFINE_HULL_2_ALT]; + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_UNIV;arith `vec 0 + a = a /\ x - vec 0 = x`]; + GEN_TAC; + REWRITE_TAC[VECTOR_MUL_ASSOC]; + BY(ASM_MESON_TAC[arith `~(t = &0) ==> u = (u * inv t) * t`]); + TYPIFY `~(U INTER affine hull {vec 0, e} = {})` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + RULE_ASSUM_TAC(REWRITE_RULE[]) THEN ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `vec 0 - x = -- x`]; + REWRITE_TAC[arith `-- (t % e) = t % (-- e)`]; + REWRITE_TAC[VECTOR_MUL_ASSOC]; + BY(ASM_MESON_TAC[arith `~(t = &0) ==> u = (u * inv t) * t`]) + ]);; + (* }}} *) + +let projection_scale = prove_by_refinement( + `!e u t. (~(t = &0)) ==> projection (t % e) u = projection e u`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Sphere.projection]; + REWRITE_TAC[DOT_LMUL;DOT_RMUL]; + REWRITE_TAC[VECTOR_MUL_ASSOC]; + TYPIFY ` ((t * (u dot e)) / (t * t * (e dot e)) * t) = (u dot e) / (e dot e)` (C SUBGOAL_THEN SUBST1_TAC); + TYPIFY `e dot e = &0` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + Calc_derivative.CALC_ID_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let azim_cycle_scale = prove_by_refinement( + `!U t e . (&0 < t) ==> + azim_cycle U (vec 0) (t % e) = azim_cycle U (vec 0) e `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[FUN_EQ_THM]; + GEN_TAC; + TYPIFY `U SUBSET {x}` ASM_CASES_TAC; + BY(ASM_SIMP_TAC[Wrgcvdr_cizmrrh.W_SUBSET_SINGLETON_IMP_IDE]); + REWRITE_TAC[Trigonometry.YESEEWW]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `x - vec 0 = x`]; + TYPIFY `(!x u. azim (vec 0) (t % e) x u = azim (vec 0) e x u) /\ (!u. projection (t % e) u = projection e u)` ENOUGH_TO_SHOW_TAC; + BY(DISCH_THEN (unlist REWRITE_TAC)); + ASM_SIMP_TAC[AZIM_SPECIAL_SCALE]; + GEN_TAC; + BY(ASM_SIMP_TAC[projection_scale;arith `&0 < t ==> ~(t = &0)`]) + ]);; + (* }}} *) + +let AZIM_CYCLE_SING_ALT = prove_by_refinement( + `!x u v w. azim_cycle {v} x u w = v`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.azim_cycle]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `v = w` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[SUBSET_REFL]); + TYPIFY_GOAL_THEN `~({v} SUBSET {w})` (unlist REWRITE_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN SET_TAC[]); + TYPIFY_GOAL_THEN `!a b. {a} (b:real^3) <=> b IN {a}` (unlist REWRITE_TAC); + BY(MESON_TAC[IN]); + REWRITE_TAC[IN_SING]; + SELECT_TAC; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `azim` MP_TAC; + REWRITE_TAC[]; + TYPIFY `v` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]) + ]);; + (* }}} *) + +let IDENTIFY_AZIM_CYCLE_SIMPLE = prove_by_refinement( + `!W v w p u. ~(W SUBSET {p}) /\ p IN W /\ + cyclic_set W v w /\ + (~(u = p) /\ u IN W) /\ + (!q. ~(q = p) /\ q IN W /\ ~(q =u) ==> azim v w p u < azim v w p q) + ==> azim_cycle W v w p = u`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Wrgcvdr_cizmrrh.IDENTIFY_AZIM_CYCLE; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC [Wrgcvdr_cizmrrh.CYCLIC_SET_IMP_NOT_COLLINEAR]); + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `q = u` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + BY(MESON_TAC[arith `x<=x`]); + DISJ1_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_MESON_TAC[IN]) + ]);; + (* }}} *) + +let coplanar_cross_scale = prove_by_refinement( + `!u1 u2 v1 v2. coplanar {vec 0,u1,u2,v1,v2} /\ &0 < (v1 cross v2) dot (u1 cross u2) ==> + (?t. &0 < t /\ v1 cross v2 = t % (u1 cross u2))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~collinear {vec 0,u1,u2}` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM CROSS_EQ_0]; + DISCH_TAC; + FIRST_X_ASSUM_ST `dot` MP_TAC THEN ASM_REWRITE_TAC[]; + REWRITE_TAC[DOT_RZERO]; + BY(REAL_ARITH_TAC); + INTRO_TAC coplanar_in_affine_hull [`(vec 0):real^3`;`u1`;`u2`;`v1`]; + INTRO_TAC coplanar_in_affine_hull [`(vec 0):real^3`;`u1`;`u2`;`v2`]; + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `coplanar {v2,vec 0,u1,u2} /\ coplanar {v1,vec 0,u1,u2} ` (unlist REWRITE_TAC); + BY(ASM_MESON_TAC[COPLANAR_SUBSET;SET_RULE `{v2,v0,u1,u2} SUBSET {v0,u1,u2,v1,v2}`;SET_RULE `{v1,v0,u1,u2} SUBSET {v0,u1,u2,v1,v2}`]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Ckqowsa_4_points.in_affine_hull_lemma [`u1`;`u2`;`v1`]; + INTRO_TAC Ckqowsa_4_points.in_affine_hull_lemma [`u1`;`u2`;`v2`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `v1 cross v2 = (t1' * t2 - t2' * t1) % (u1 cross u2)` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[CROSS_RADD;CROSS_LADD;CROSS_RMUL;CROSS_LMUL;CROSS_REFL]; + TYPIFY `u2 cross u1 = -- (u1 cross u2)` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[CROSS_SKEW]); + BY(VECTOR_ARITH_TAC); + TYPIFY `t1' * t2 - t2' * t1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `dot` MP_TAC; + ASM_REWRITE_TAC[DOT_LMUL]; + GMATCH_SIMP_TAC (CONJUNCT2 Real_ext.REAL_PROP_POS_LMUL); + REWRITE_TAC[DOT_POS_LT]; + BY(ASM_MESON_TAC[CROSS_EQ_0]) + ]);; + (* }}} *) + +let azim_cycle_distinct = prove_by_refinement( + `!U e v w. FINITE U /\ v IN U /\ w IN U /\ ~(v = w) /\ + (!v. v IN U ==> ~(e dot (v cross azim_cycle U (vec 0) e v) = &0)) ==> + (&0 < azim (vec 0) e v w)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(e = vec 0)` (C SUBGOAL_THEN ASSUME_TAC); + DISCH_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`v`]); + BY(ASM_REWRITE_TAC[DOT_LZERO]); + TYPIFY `!v. v IN U ==> ~collinear {vec 0,e,v}` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC THEN DISCH_TAC; + ASM_REWRITE_TAC[COLLINEAR_LEMMA_ALT;DE_MORGAN_THM]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`v'`]); + ASM_REWRITE_TAC[CROSS_LMUL;DOT_RMUL;DOT_CROSS_SELF]; + BY(REAL_ARITH_TAC); + TYPIFY `~collinear {vec 0,e,azim_cycle U (vec 0) e v}` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Polar_fan.AZIM_CYCLE_BASIC_PROPERTIES]); + TYPIFY `&0 < azim (vec 0) e v (azim_cycle U (vec 0) e v)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[azim_pos_iff_nz]; + GMATCH_SIMP_TAC AZIM_EQ_0; + ASM_SIMP_TAC[]; + GMATCH_SIMP_TAC AFF_GT_2_1; + REWRITE_TAC[IN_ELIM_THM]; + CONJ_TAC; + BY(ASM_MESON_TAC[Fan.th3a]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `dot` (C INTRO_TAC [`v`]); + ASM_REWRITE_TAC[]; + TYPED_ABBREV_TAC `u = azim_cycle U (vec 0) e v`; + FIRST_X_ASSUM_ST `%` SUBST1_TAC; + REWRITE_TAC[DOT_RMUL;DOT_RADD;DOT_RZERO;CROSS_LADD;CROSS_LMUL;CROSS_LZERO;CROSS_REFL;DOT_CROSS_SELF]; + BY(REAL_ARITH_TAC); + TYPIFY `w = azim_cycle U (vec 0) e v` ASM_CASES_TAC; + BY(ASM_MESON_TAC[]); + INTRO_TAC Polar_fan.AZIM_CYCLE_BASIC_PROPERTIES [`U`;`(vec 0):real^3`;`e`;`v`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`w`]); + ASM_REWRITE_TAC[]; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + + +(* +let azim_cycle_nondeg = prove_by_refinement( + `!U uu r. + 1 < r /\ + U = {uu i | i IN 1..r+1 } /\ + (!i. i IN 1..r ==> u i IN aff_gt{vec 0,u (r+1)} {u (r)} /\ + (!i. i IN 1..r ==> azim_cycle U (vec 0) (uu 1 cross uu 2) (uu i) = (uu (i+1))) /\ + azim_cycle U (vec 0) (uu 1 cross uu 2) (uu (r+1)) = u 1 /\ + (!i. i IN 1..r ==> &0 < (uu i cross uu (i+1)) dot (uu 1 cross uu 2)) + ==> + ((!i. i IN 1..r ==> ~((uu 1 cross uu 2) dot (uu i cross uu (i+1)) = &0)) + (!i. + (`, + (* {{{ proof *) + [ + # + ]);; + (* }}} *) +*) + + +let azim_cycle_neg = prove_by_refinement( + `!U e v w. FINITE U /\ v IN U /\ azim_cycle U (vec 0) e v = w /\ + (!v. v IN U ==> ~(e dot (v cross azim_cycle U (vec 0) e v) = &0)) ==> + (azim_cycle U (vec 0) (-- e) w = v)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(e = vec 0)` (C SUBGOAL_THEN ASSUME_TAC); + DISCH_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`v`]); + BY(ASM_REWRITE_TAC[DOT_LZERO]); + TYPIFY `!v. v IN U ==> ~collinear {vec 0,e,v}` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC THEN DISCH_TAC; + ASM_REWRITE_TAC[COLLINEAR_LEMMA_ALT;DE_MORGAN_THM]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`v'`]); + ASM_REWRITE_TAC[CROSS_LMUL;DOT_RMUL;DOT_CROSS_SELF]; + BY(REAL_ARITH_TAC); + TYPIFY `w IN U` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Polar_fan.AZIM_CYCLE_BASIC_PROPERTIES]); + PROOF_BY_CONTR_TAC; + INTRO_TAC Polar_fan.AZIM_CYCLE_BASIC_PROPERTIES [`U`;`(vec 0):real^3`;`-- (e:real^3)`;`w`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(v = w)` (C SUBGOAL_THEN ASSUME_TAC); + DISCH_TAC; + FIRST_X_ASSUM_ST `dot` (C INTRO_TAC [`v`]); + BY(ASM_REWRITE_TAC[CROSS_REFL;DOT_RZERO]); + TYPIFY `&0 < azim (vec 0) e v w` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC azim_cycle_distinct; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM_ST `IN` (C INTRO_TAC [`v`]); + ASM_REWRITE_TAC[]; + TYPED_ABBREV_TAC `w' = azim_cycle U (vec 0) (-- e) w`; + TYPIFY `w' IN U` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Polar_fan.AZIM_CYCLE_BASIC_PROPERTIES]); + REPEAT (GMATCH_SIMP_TAC Yxionxl2.AZIM_COMPL_NEG); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + TYPIFY `azim (vec 0) e v w' + azim (vec 0) e w' w = azim (vec 0) e v w` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC (GSYM Fan.sum5_azim_fan); + BY(ASM_SIMP_TAC[]); + INTRO_TAC Polar_fan.AZIM_CYCLE_BASIC_PROPERTIES [`U`;`(vec 0):real^3`;`(e:real^3)`;`v`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (C INTRO_TAC [`w'`]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `azim (vec 0) e v w + azim (vec 0) e w w' = azim (vec 0) e v w'` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC (GSYM Fan.sum4_azim_fan); + BY(ASM_SIMP_TAC[]); + TYPIFY `&0 <= azim (vec 0) e w w' /\ &0 <= azim (vec 0) e w' w` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Counting_spheres.AZIM_NN]); + TYPIFY `azim (vec 0) e w w' = &0` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `(w' = w)` (C SUBGOAL_THEN ASSUME_TAC); + PROOF_BY_CONTR_TAC; + INTRO_TAC azim_cycle_distinct [`U`;` (e:real^3)`;`w`;`w'`]; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + INTRO_TAC (GEN_ALL Wrgcvdr_cizmrrh.AZIM_CYCLE_PROPERTIES) [`U`;`w`;`-- (e:real^3)`;`(vec 0):real^3`]; + ASM_REWRITE_TAC[]; + BY(ASM_TAC THEN SET_TAC[]) + ]);; + (* }}} *) + +(* +let azim_cycle_neg = prove_by_refinement( + `!U e v w. ~(U SUBSET {w}) /\ FINITE U /\ cyclic_set U (vec 0) e /\ v IN U /\ ~(e dot (v cross w) = &0) /\ + azim_cycle U (vec 0) (e ) v = w ==> + azim_cycle U (vec 0) (-- e) w = v`, + (* {{{ proof *) + [ +g/r +typ `U SUBSET {v}` asmcase + art[Sphere.azim_cycle] +amt[] +st/r +intro (GEN_ALL Wrgcvdr_cizmrrh.AZIM_CYCLE_PROPERTIES) [`U`;`v`;`e`;`(vec 0):real^3`] +art[] +st/r +mmp IDENTIFY_AZIM_CYCLE_SIMPLE +art[] +conj +art[IN] +conj +rt[arith `-- e = (-- &1) % e`] +gm cyclic_set_scale +art[] +rat +st/r +fxa (C intro [`q`]) +ants +amt[IN] +dt +repeat (gm Yxionxl2.AZIM_COMPL_NEG) +typ `~collinear {vec 0, e, w} /\ ~collinear {vec 0, e, q} /\ ~collinear {vec 0, e, v}` sat +ort[setr `{a,e,w} = {w,a,e}`] +repeat (gm Wrgcvdr_cizmrrh.CYCLIC_SET_IMP_NOT_COLLINEAR) +amt[IN] +art[] +rt[arith `x < y <=> ~(y <= x)`] +dt +(* COME BACK. TO HERE. still problems with degenerate cases. make azim progression condition on all of U *) + ]);; + (* }}} *) +*) + +let XIV_ECAU_BACK = prove_by_refinement( + `!f r w a b. + deformation f {w i | i <= r + 2} (a,b) /\ + 1 <= r /\ + (!i. i IN 1..r ==> w i IN aff_gt {vec 0,w (r+1) } {w r} ) /\ + cyclic_set {w i | i IN 1..r+1 } (vec 0) ((w 1) cross (w 2)) /\ + // &0 < (w r cross (w (r+1))) dot (w 1 cross w 2) /\ + (!i. i IN 1..r ==> &0 < (w i cross (w (i+1))) dot (w 1 cross w 2)) /\ + {w 1, w 2} SUBSET aff_gt {vec 0,w (r+1)} {w r} /\ + (!i. i IN 1..r ==> azim_cycle {w i | i IN 1..r+1} (vec 0) ((w 1) cross (w 2)) (w i) = w (i+1)) /\ + azim_cycle {w i | i IN 1..r+1} (vec 0) ((w 1) cross (w 2)) (w (r+1)) = w 1 /\ + pairwise (\i j. ~collinear {vec 0, w i, w j}) (0..(r+1)) /\ + pairwise (\i j. ~collinear {vec 0, w i, w j}) (1..(r+2)) /\ + (!i. ?e2. i IN 1..r+1 ==> &0 < e2 /\ + (!t. abs t < e2 ==> azim (vec 0) (f (w i) t) (f (w (i+1)) t) (f (w (i-1)) t) <= pi)) /\ + (!i. i IN 1..r+1 ==> &0 < azim (vec 0) (w i) (w (i+1)) (w (i-1))) + ==> (?e. &0 < e /\ (!t. abs t < e ==> + f (w 1) t IN wedge_ge (vec 0) (f (w (r+1)) t) (f (w (r+2)) t) (f (w (r)) t) /\ + f (w (r+1)) t IN wedge_ge (vec 0) (f (w 1) t) (f (w (2)) t) (f (w (0)) t)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `&0 < (w r cross (w (r+1))) dot (w 1 cross w 2)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + REWRITE_TAC[IN_NUMSEG]; + BY(ASM_REWRITE_TAC[arith `r <= (r:num)`]); + MATCH_MP_TAC XIV_DEFORMATION; + TYPED_ABBREV_TAC `dh = \ (i,j,k). dihV (vec 0) (w i) (w j) (w k)`; + GEXISTL_TAC [`dh`;`a`;`b`]; + ASM_REWRITE_TAC[]; + INTRO_TAC KCZXLLE_SYM [`\i. w((r+1)-i) `;`r`]; + REWRITE_TAC[arith `1 <= r+1 /\ ((r+1)-0 = (r+1)) /\ ((r+1)-1 = r)`]; + TYPIFY `{w ((r+1)-i) | i | i <= r } = {w i | i IN 1..r+1}` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG]; + GEN_TAC; + MATCH_MP_TAC (TAUT `((a ==> b) /\ (b ==> a)) ==> (a <=> b)`); + CONJ_TAC THEN REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `(r+1)-i` EXISTS_TAC; + REWRITE_TAC[]; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + ASM_REWRITE_TAC[]; + TYPIFY `(r+1)-i` EXISTS_TAC; + CONJ_TAC; + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + AP_TERM_TAC; + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + COMMENT "collinear"; + TYPIFY_GOAL_THEN `(!i j. i <= r /\ j <= r /\ ~(i = j) ==> ~collinear {vec 0, w ((r+1)-i), w ((r+1)-j)})` (unlist REWRITE_TAC); + REPEAT WEAKER_STRIP_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[pairwise]); + FIRST_X_ASSUM (C INTRO_TAC [`(r+1)-i`;`(r+1)-j`]); + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC); + COMMENT "aff_gt"; + TYPIFY_GOAL_THEN ` (!i. 1 <= i /\ i <= r ==> w ((r+1)-i) IN aff_gt {vec 0, w (r+1)} {w r})` (unlist REWRITE_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC); + COMMENT "cyclic set"; + INTRO_TAC coplanar_cross_scale [`w 1`;`w 2`;`w r`;`w (r+1)`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[coplanar]; + GEXISTL_TAC [`(vec 0):real^3`;`w r`;`w (r+1)`]; + TYPIFY `{vec 0,w r, w (r+1)} SUBSET affine hull {vec 0, w r, w (r + 1)} /\ {w 1, w 2} SUBSET affine hull {vec 0, w r, w (r + 1)}` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + CONJ_TAC; + BY(REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + MATCH_MP_TAC SUBSET_TRANS; + TYPIFY `aff_gt {vec 0,w(r+1)} {w r}` EXISTS_TAC; + CONJ_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `{vec 0,w r, w(r+1)} = {vec 0,w (r+1)} UNION {w (r)}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(REWRITE_TAC[ AFF_GT_SUBSET_AFFINE_HULL]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY ` cyclic_set {w i | i IN 1..r + 1} (vec 0) (w (r + 1) cross w r)` (C SUBGOAL_THEN ASSUME_TAC); + ONCE_REWRITE_TAC[CROSS_SKEW]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `-- (t % v) = (-- t) % v`]; + GMATCH_SIMP_TAC cyclic_set_scale; + ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM_ST `&0 < t` MP_TAC THEN REAL_ARITH_TAC); + COMMENT "azim_cycle"; + TYPIFY `(!i. i < r ==> azim_cycle {w i | i IN 1..r + 1} (vec 0) (w (r + 1) cross w r) (w ((r + 1) - i)) = w ((r + 1) - (i + 1)))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[CROSS_SKEW]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `-- (t % v) = t % (-- v)`]; + GMATCH_SIMP_TAC azim_cycle_scale; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC azim_cycle_neg; + ASM_REWRITE_TAC[]; + CONJ_TAC; + TYPIFY `{w i | i IN 1..r+1} = IMAGE w (1..r+1)` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + MATCH_MP_TAC FINITE_IMAGE; + BY(REWRITE_TAC[FINITE_NUMSEG]); + TYPIFY `(r+1)-(i+1) = r - i` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN ARITH_TAC); + CONJ_TAC; + REWRITE_TAC[IN_ELIM_THM;IN_NUMSEG]; + TYPIFY `r- (i:num)` EXISTS_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN ARITH_TAC); + CONJ_TAC; + TYPIFY `(r+1) - i = (r - i) + 1` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN ARITH_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REWRITE_TAC[IN_NUMSEG] THEN FIRST_X_ASSUM MP_TAC THEN ARITH_TAC); + REWRITE_TAC[IN_NUMSEG;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `(i':num) < r+1` ASM_CASES_TAC; + TYPIFY `azim_cycle {w i | 1 <= i /\ i <= r + 1} (vec 0) (w 1 cross w 2) (w i') = w (i'+1)` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[GSYM IN_NUMSEG]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC); + MATCH_MP_TAC (arith `&0 < x ==> ~(x = &0)`); + REWRITE_TAC[DOT_SYM]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REWRITE_TAC[IN_NUMSEG] THEN REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + TYPIFY `i' = r+1` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + ASM_REWRITE_TAC[GSYM IN_NUMSEG]; + TYPIFY `w 1 IN aff_gt {vec 0, w(r+1)} {w r}` (C SUBGOAL_THEN MP_TAC); + BY(FIRST_X_ASSUM_ST `aff_gt` MP_TAC THEN SET_TAC[]); + GMATCH_SIMP_TAC AFF_GT_2_1; + REWRITE_TAC[IN_ELIM_THM]; + CONJ_TAC; + MATCH_MP_TAC Fan.th3a; + RULE_ASSUM_TAC(REWRITE_RULE[pairwise]); + FIRST_X_ASSUM MATCH_MP_TAC; + REWRITE_TAC[IN_NUMSEG]; + BY(REPLICATE_TAC 6 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `e = w 1 cross w 2`; + FIRST_X_ASSUM_ST `dot` MP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[CROSS_RADD;CROSS_RMUL;CROSS_RZERO;CROSS_REFL;DOT_RMUL;DOT_RADD;DOT_RZERO]; + REWRITE_TAC[arith `t * &0 + x = x`]; + ONCE_REWRITE_TAC[CROSS_SKEW]; + REWRITE_TAC[DOT_RNEG;REAL_ENTIRE]; + ONCE_REWRITE_TAC[DOT_SYM]; + BY(REPEAT (FIRST_X_ASSUM_ST `&0 < x` MP_TAC) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `!i j k. P` MP_TAC; + ASM_REWRITE_TAC[]; + REPLICATE_TAC 4 (FIRST_X_ASSUM kill); + DISCH_TAC; + COMMENT "work on dihedral angles"; + TYPIFY `!i j k. k IN 1..r+1 /\ j IN 1..r+1 /\ i IN 1..r+1 /\ (j < k /\ (i < j \/ k < i) \/ k < j /\ (i < k \/ j < i)) ==> azim (vec 0) (w i) (w j) (w k) = &0` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[IN_NUMSEG]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`(r+1)-i`;`(r+1)-j`;`(r+1)-k`]); + ASM_SIMP_TAC[arith `i <= r+1 ==> (r+1)-((r+1)-i) = i`]; + DISCH_THEN MATCH_MP_TAC; + BY(REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + FIRST_X_ASSUM_ST `(r+1)-i` kill; + TYPIFY `!i j k. i IN 1..r+1 /\ j IN 1..r+1 /\ k IN 1..r+1 /\ ~(i = j) /\ ~(i = k) /\ azim (vec 0) (w i) (w j) (w k) = &0 ==> dihV (vec 0) (w i) (w j) (w k) = &0` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC (GSYM Polar_fan.AZIM_DIHV_SAME_STRONG); + RULE_ASSUM_TAC (REWRITE_RULE[pairwise]); + TYPIFY_GOAL_THEN `~collinear {vec 0, w i, w j} /\ ~collinear {vec 0, w i, w k}` (unlist REWRITE_TAC); + BY(CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN REPLICATE_TAC 8 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC); + ASM_REWRITE_TAC[]; + BY(MP_TAC PI_POS THEN REAL_ARITH_TAC); + EXPAND_TAC "dh" THEN REWRITE_TAC[]; + REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + FIRST_X_ASSUM MP_TAC; + DISCH_TAC; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM_ST `azim` GMATCH_SIMP_TAC; + FIRST_X_ASSUM_ST `IN` (unlist ASM_SIMP_TAC); + REPLICATE_TAC 2(FIRST_X_ASSUM MP_TAC); + BY(ARITH_TAC); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM_ST `azim` GMATCH_SIMP_TAC; + FIRST_X_ASSUM_ST `IN` (unlist ASM_SIMP_TAC); + BY(REPLICATE_TAC 1(FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM_ST `azim` GMATCH_SIMP_TAC; + FIRST_X_ASSUM_ST `IN` (unlist ASM_SIMP_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN ARITH_TAC) + ]);; + (* }}} *) + +let zlz_wedge_boundary = prove_by_refinement( + `!a b V E FF f. + convex_local_fan (V,E,FF) /\ + generic V E /\ + deformation f V (a,b) /\ + (!v t. v IN V /\ t IN real_interval (a,b) /\ interior_angle1 (vec 0) FF v = pi ==> + interior_angle1 (vec 0) ( IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) (f v t) <= pi) ==> + (!x v. ?e3. x IN FF /\ v IN V + ==> &0 < e3 /\ + (!t. --e3 < t /\ t < e3 + ==> (f v t) IN + wedge_in_fan_ge (f (FST x) t,f (SND x) t) + (IMAGE (IMAGE (\v. f v t)) E)))`, + (* {{{ proof *) + [ + COMMENT "start here"; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC (GEN_ALL Lunar_deform.XRECQNS_UPDATE) [`a`;`b`;`V`;`E`;`f`;`FF`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!t. IMAGE (\s. IMAGE (\v. f v t) s) E = IMAGE (IMAGE (\v. f v t)) E /\ IMAGE (\(u,v). f u t,f v t) FF = IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[EXTENSION;IN_IMAGE;EXISTS_PAIR_THM]); + REWRITE_TAC[RIGHT_EXISTS_IMP_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `w = FST x`; + TYPIFY `x = (w,rho_node1 FF w)` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `FST x,SND x = (w,rho_node1 FF w)` ENOUGH_TO_SHOW_TAC; + BY(REWRITE_TAC[PAIR]); + ASM_REWRITE_TAC[PAIR_EQ]; + MATCH_MP_TAC EQ_SYM; + MATCH_MP_TAC Local_lemmas.DETER_RHO_NODE; + BY(ASM_MESON_TAC[PAIR]); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + TYPIFY `w IN V` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_IMP_IN_V]); + TYPIFY `v IN {w, rho_node1 FF w, ivs_rho_node1 FF w}` ASM_CASES_TAC; + INTRO_TAC zlz_wedge_refl [`a`;`b`;`V`;`E`;`FF`;`f`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (C INTRO_TAC [`v`;`w`]); + BY(ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]); + TYPIFY `rho_node1 FF w IN V` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + BY(ASM_REWRITE_TAC[]); + TYPIFY `ivs_rho_node1 FF w IN V` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas1.LOCAL_FAN_IVS_IN_V; + BY(ASM_REWRITE_TAC[]); + TYPIFY `v IN wedge (vec 0) w (rho_node1 FF w) (ivs_rho_node1 FF w)` ASM_CASES_TAC; + INTRO_TAC zlz_wedge_open [`a`;`b`;`V`;`E`;`FF`;`f`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (C INTRO_TAC [`v`;`w`]); + BY(ASM_REWRITE_TAC[]); + TYPIFY `v IN wedge_ge (vec 0) w (rho_node1 FF w) (ivs_rho_node1 FF w)` (C SUBGOAL_THEN ASSUME_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[Localization.convex_local_fan]); + ASM_TAC THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `wedge_in_fan_ge` (C INTRO_TAC [`w,rho_node1 FF w`]); + ASM_REWRITE_TAC[]; + REWRITE_TAC[SUBSET]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`v`]); + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Local_lemmas1.WEDGE_IN_FAN_RHOND_IVS_RHOND; + BY(ASM_MESON_TAC[]); + TYPIFY `azim (vec 0) w (rho_node1 FF w) v = &0 \/ azim (vec 0) w (rho_node1 FF w) v = azim (vec 0) w (rho_node1 FF w) (ivs_rho_node1 FF w)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM MP_TAC; + BY(ASM_REWRITE_TAC[Reuhady.WEDGE_GE_WEDGE;IN_UNION;IN_ELIM_THM]); + TYPIFY `?r. r < CARD V /\ v = ITER r (rho_node1 FF) w` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC (GEN_ALL Local_lemmas.LOFA_IMP_LT_CARD_SET_V) [`E`;`FF`;`V`;`w`]; + REWRITE_TAC[EXTENSION;IN_ELIM_THM]; + ASM_REWRITE_TAC[]; + DISCH_THEN (C INTRO_TAC [`v`]); + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + TYPIFY `1 < r /\ r < CARD V - 1` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `~(r = 0) /\ ~(r = 1) /\ ~(r = CARD V - 1)` ENOUGH_TO_SHOW_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN ARITH_TAC); + REWRITE_TAC[GSYM DE_MORGAN_THM]; + DISCH_TAC; + FIRST_X_ASSUM_ST `~(ITER r f w IN s INSERT t)` MP_TAC; + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[ITER;ITER_1]; + BY(ASM_MESON_TAC[Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1]); + BY(ASM_MESON_TAC[Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1]); + INTRO_TAC (GEN_ALL Local_lemmas.EGHNAVX) [`E`;`V`;`(\i. azim (vec 0) w (rho_node1 FF w) (ITER i (rho_node1 FF) w))`;`FF`;`r`;`w`;`(\i. ITER i (rho_node1 FF) w)`;`CARD V` ]; + ASM_REWRITE_TAC[SUBSET;IN_ELIM_THM;ITER_1]; + ANTS_TAC; + MATCH_MP_TAC Nkezbfc_local.PROPERTIES_GENERIC_LOCAL_FAN; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[LEFT_IMP_EXISTS_THM]; + ASM_SIMP_TAC[arith `1 < r ==> 0 < r`]; + (REPEAT WEAKER_STRIP_TAC); + COMMENT "added material here"; + COMMENT "eliminate wedge_in_fan_ge"; + TYPIFY `?e3. &0 < e3 /\ (!t. --e3 < t /\ t < e3 ==> f (ITER r (rho_node1 FF) w) t IN wedge_ge (vec 0) (f w t) (f (rho_node1 FF w) t) (f (ivs_rho_node1 FF w) t))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `if (e <= e3) then e else e3` EXISTS_TAC; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `&0 < e` MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `abs t < e` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `local_fan` (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC deformation_rho_node1_equivariant1 [`f`;`V`;`E`;`FF`;`a`;`b`;`w`;`t`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC deformation_ivs_rho_node1_equivariant1 [`f`;`V`;`E`;`FF`;`a`;`b`;`w`;`t`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Local_lemmas1.WEDGE_IN_FAN_RHOND_IVS_RHOND; + CONJ_TAC; + TYPIFY `IMAGE (\v. f v t) V` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[IN_IMAGE]; + TYPIFY `w` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM_ST `wedge_ge` (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[]; + DISCH_THEN MATCH_MP_TAC; + BY(REPLICATE_TAC 6 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + INTRO_TAC zlz_azim [`a`;`b`;`V`;`E`;`FF`;`f`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + TYPIFY `!v. v IN V ==> &0 < azim (vec 0) v (rho_node1 FF v) (ivs_rho_node1 FF v)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GEN_ALL Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM_IVS) [`E`;`V`;`FF`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (GMATCH_SIMP_TAC o GSYM); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC Local_lemmas.INTERIOR_ANGLE1_POS; + BY(ASM_REWRITE_TAC[]); + COMMENT "azim_in_fan -> azim"; + TYPIFY `!v. ?e2. v IN V ==> &0 < e2 /\ (!t. --e2 < t /\ t < e2 ==> azim (vec 0) (f v t) (f (rho_node1 FF v) t) (f (ivs_rho_node1 FF v) t) <= pi)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[RIGHT_EXISTS_IMP_THM]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`v', rho_node1 FF v'`]); + REWRITE_TAC[RIGHT_EXISTS_IMP_THM]; + GMATCH_SIMP_TAC Lunar_deform.LOCAL_FAN_RHO_NODE_PROS2; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `if (e <= e2) then e else e2` EXISTS_TAC; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `&0 < e` MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `abs t < e /\ abs t < e2` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `local_fan` (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC deformation_rho_node1_equivariant1 [`f`;`V`;`E`;`FF`;`a`;`b`;`v'`;`t`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC deformation_ivs_rho_node1_equivariant1 [`f`;`V`;`E`;`FF`;`a`;`b`;`v'`;`t`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `azim_in_fan` (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[arith `-- e2 < t /\ t < e2 <=> abs t < e2`]; + MATCH_MP_TAC (arith `(a = b) ==> (a <= pi ==> b <= pi)`); + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Local_lemmas1.AZIM_IN_FAN_RHOND_IVS_RHOND; + TYPIFY `IMAGE (\v. f v t) V` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[IN_IMAGE]; + TYPIFY `v'` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPLICATE_TAC 2(FIRST_X_ASSUM MP_TAC THEN BURY_MP_TAC); + FIRST_X_ASSUM kill; + COMMENT "end added"; + COMMENT "MAIN BRANCH: follow forward azim = 0"; + FIRST_X_ASSUM DISJ_CASES_TAC; + FIRST_X_ASSUM MP_TAC; + FIRST_X_ASSUM kill; + DISCH_TAC; + FIRST_X_ASSUM_ST `interior_angle1` MP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MP_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM kill); + REPEAT WEAKER_STRIP_TAC; + COMMENT "add KOM"; + INTRO_TAC Local_lemmas.KOMWBWC [`E`;`V`;`affine hull {(vec 0),w,rho_node1 FF w}`;`r`;`FF`;`{ITER i (rho_node1 FF) w | i <= r}`;`w cross rho_node1 FF w`;`ITER r (rho_node1 FF) w`;`w`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + REWRITE_TAC[plane]; + CONJ_TAC; + GEXISTL_TAC [`(vec 0):real^3`;`w`;`rho_node1 FF w`]; + REWRITE_TAC[]; + BY(ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2]); + CONJ_TAC; + MATCH_MP_TAC Marchal_cells_2_new.IN_AFFINE_KY_LEMMA1; + BY(SET_TAC[]); + REWRITE_TAC[SUBSET;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + ASM_CASES_TAC `i=0`; + ASM_REWRITE_TAC[ITER]; + MATCH_MP_TAC Marchal_cells_2_new.IN_AFFINE_KY_LEMMA1; + BY(SET_TAC[]); + TYPIFY `aff_gt {vec 0,w} {rho_node1 FF w} SUBSET affine hull {vec 0,w,rho_node1 FF w}` ENOUGH_TO_SHOW_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`ITER i (rho_node1 FF) w`;`i`]); + ASM_SIMP_TAC[arith `~(i=0) ==> (0 < i)`]; + BY(SET_TAC[]); + TYPIFY `{vec 0,w,rho_node1 FF w } = {vec 0,w} UNION {rho_node1 FF w}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(REWRITE_TAC[AFF_GT_SUBSET_AFFINE_HULL]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "abbreviate uu"; + TYPIFY `ivs_rho_node1 FF w IN V` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas1.LOCAL_FAN_IVS_IN_V; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. ITER i (rho_node1 FF) (ivs_rho_node1 FF w) IN V` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V; + BY(ASM_REWRITE_TAC[]); + TYPED_ABBREV_TAC `w0 = ivs_rho_node1 FF w`; + TYPED_ABBREV_TAC `uu = (\i. ITER i (rho_node1 FF) w0)`; + TYPIFY `!i. ITER i (rho_node1 FF) w0 = uu i` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "uu"; + BY(REWRITE_TAC[]); + TYPIFY `w0 = uu 0 /\ w = uu 1 /\ rho_node1 FF w = uu 2 /\ (!i. ITER i (rho_node1 FF) w = uu (i+1))` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "uu"; + REWRITE_TAC[ITER;ITER_1]; + EXPAND_TAC "w0"; + REWRITE_TAC[arith `2 = 1+1`;GSYM ITER_ADD;ITER_1]; + REPEAT (GMATCH_SIMP_TAC Local_lemmas1.LOCAL_FAN_RHO_NODE_IVS); + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (fun t -> RULE_ASSUM_TAC(REWRITE_RULE[t]) THEN ASSUME_TAC t); + COMMENT "apply XIV_ECAU"; + TYPIFY `(?e3. &0 < e3 /\ (!t. abs t < e3 ==> f (uu 1) t IN wedge_ge (vec 0) (f (uu (r + 1)) t) (f (uu (r + 2)) t) (f (uu r) t) /\ f (uu (r + 1)) t IN wedge_ge (vec 0) (f (uu 1) t) (f (uu 2) t) (f (uu 0) t)))` ENOUGH_TO_SHOW_TAC; + REWRITE_TAC[arith `-- e < t /\ t < e <=> abs t < e`]; + BY(MESON_TAC[]); + MATCH_MP_TAC XIV_ECAU; + GEXISTL_TAC [`a`;`b`]; + COMMENT "cyclic set condition"; + TYPIFY `{uu i | i IN 1 .. r+1} = {uu (i+1) | i <= r}` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG]; + GEN_TAC; + MATCH_MP_TAC (TAUT `((a ==> b) /\ (b ==> a)) ==> (a <=> b)`); + CONJ_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `PRE i` EXISTS_TAC; + ASM_SIMP_TAC[arith `1 <= i ==> PRE i + 1 = i`]; + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + TYPIFY `i+1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 2(FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + ASM_REWRITE_TAC[]; + COMMENT "deformation condition"; + CONJ_TAC; + MATCH_MP_TAC deformation_subset; + TYPIFY `V` EXISTS_TAC; + ASM_REWRITE_TAC[SUBSET;IN_ELIM_THM]; + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + COMMENT "aff_gt"; + CONJ_TAC; + REWRITE_TAC[IN_NUMSEG]; + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC (arith `2 <= i ==> i = PRE i + 1`); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + TYPIFY `uu (PRE i + 1)` EXISTS_TAC; + BY(REWRITE_TAC[] THEN (REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC)); + COMMENT "azim_cycle"; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`uu i`;`PRE i`]); + DISCH_THEN GMATCH_SIMP_TAC; + CONJ_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN (REWRITE_TAC[IN_NUMSEG]) THEN MESON_TAC[arith `1 <= i ==> PRE i + 1 = i`;arith `i <= r /\ 1 <= i ==> PRE i < r`]); + TYPIFY `uu i = ITER i (rho_node1 FF) (uu 0) /\ uu (i+1) = ITER (i+1) (rho_node1 FF) (uu 0)` ENOUGH_TO_SHOW_TAC; + DISCH_THEN (unlist REWRITE_TAC); + REWRITE_TAC[arith `i + 1 = 1 +i`]; + BY(REWRITE_TAC[GSYM ITER_ADD;ITER_1]); + BY(REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + TYPIFY `!i. 1 <= i ==> rho_node1 FF (uu i) = uu (i+1) /\ ivs_rho_node1 FF (uu i) = (uu (i-1))` (C SUBGOAL_THEN ASSUME_TAC); + (FIRST_X_ASSUM_ST `ITER` kill); + FIRST_X_ASSUM_ST `ITER` ((unlist ONCE_REWRITE_TAC) o GSYM); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `i+1 = 1+i`]; + REWRITE_TAC[GSYM ITER_ADD;ITER_1]; + GMATCH_SIMP_TAC (arith `1 <= i ==> i = 1 + (i - 1)`); + ASM_REWRITE_TAC[GSYM ITER_ADD;ITER_1]; + GMATCH_SIMP_TAC Local_lemmas.IVS_RHO_IDD; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN ARITH_TAC); + COMMENT "0 < azim"; + TYPIFY_GOAL_THEN ` (!i. i IN 1..r + 1 ==> &0 < azim (vec 0) (uu i) (uu (i + 1)) (uu (i - 1)))` (unlist REWRITE_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `&0 < azim a b c d` (C INTRO_TAC [`uu i`]); + ANTS_TAC; + BY(ASM_MESON_TAC[]); + TYPIFY `rho_node1 FF (uu i) = uu (i+1) /\ ivs_rho_node1 FF (uu i) = (uu (i-1))` ENOUGH_TO_SHOW_TAC; + BY(DISCH_THEN (unlist REWRITE_TAC)); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[IN_NUMSEG] THEN MESON_TAC[]); + COMMENT "azim <= pi"; + TYPIFY_GOAL_THEN `(!i. ?e2. i IN 1..r + 1 ==> &0 < e2 /\ (!t. abs t < e2 ==> azim (vec 0) (f (uu i) t) (f (uu (i + 1)) t) (f (uu (i - 1)) t) <= pi))` (unlist REWRITE_TAC); + GEN_TAC; + REWRITE_TAC[RIGHT_EXISTS_IMP_THM]; + DISCH_TAC; + FIRST_X_ASSUM_ST `azim a b c d <= pi` (C INTRO_TAC [`uu i`]); + REWRITE_TAC[RIGHT_EXISTS_IMP_THM]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + (REPEAT WEAKER_STRIP_TAC); + TYPIFY `e2` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[arith `-- e < t /\ t < e <=> abs t < e`]; + TYPIFY `rho_node1 FF (uu i) = uu(i+1) /\ ivs_rho_node1 FF (uu i) = uu (i - 1)` ENOUGH_TO_SHOW_TAC; + BY(DISCH_THEN (unlist REWRITE_TAC)); + BY(REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[IN_NUMSEG] THEN MESON_TAC[]); + COMMENT "pairwise"; + REWRITE_TAC[pairwise]; + TYPIFY `!i. uu (i) IN V` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V]); + TYPIFY `(!i j. i IN 0..r+1 /\ j IN 0..r+1 /\ ~(i = j)==> ~(uu i = uu j)) /\ (!i j. i IN 1..r+2 /\ j IN 1..r+2 /\ ~(i=j) ==> ~(uu i = uu j))` ENOUGH_TO_SHOW_TAC; + REPEAT (FIRST_X_ASSUM_ST `azim` kill); + BY(ASM_MESON_TAC[PROPERTIES_GENERIC_LOCAL_FAN_ALT]); + CONJ_TAC; + REWRITE_TAC[IN_NUMSEG]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + FIRST_X_ASSUM_ST `ITER` kill; + REWRITE_TAC[]; + FIRST_X_ASSUM_ST `ITER` ((unlist ONCE_REWRITE_TAC) o GSYM); + BY(ASM_MESON_TAC[Local_lemmas1.LT_CARD_MONO_LOFA;arith `i <= r+1 /\ 1 < r /\ r < CARD V - 1 ==> i < CARD V`]); + TYPIFY `!i. 1 <= i ==> uu i = ITER (PRE i) (rho_node1 FF) (w)` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[]; + BY(MESON_TAC[arith `1 <= i ==> PRE i + 1 = i`]); + REWRITE_TAC[IN_NUMSEG]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[]; + FIRST_X_ASSUM_ST `ITER` (REPEAT o GMATCH_SIMP_TAC); + TYPIFY `w IN V` (C SUBGOAL_THEN MP_TAC); + BY(ASM_REWRITE_TAC[]); + TYPIFY `PRE i < CARD V /\ PRE j < CARD V` (C SUBGOAL_THEN MP_TAC); + BY(REPEAT (FIRST_X_ASSUM_ST `CARD` MP_TAC) THEN REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[arith `1<= i /\ i <= r+2 /\ 1 < r /\ r < CARD V - 1 ==> PRE i < CARD V`]); + REPEAT (FIRST_X_ASSUM_ST `local_fan` MP_TAC); + REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC); + BY(MESON_TAC[Local_lemmas1.LT_CARD_MONO_LOFA;arith `1 <= i /\ 1 <= j /\ PRE i = PRE j ==> (i = j)`]); + (COMMENT "SECOND MAIN BRANCH"); + FIRST_X_ASSUM_ST `azim a b c d = &0` kill; + TYPIFY `ITER (CARD V - 1) (rho_node1 FF) w = ivs_rho_node1 FF w` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM_ST `interior_angle1` MP_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `r' = CARD V - r`; + TYPED_ABBREV_TAC `w' = ITER r (rho_node1 FF) w`; + COMMENT "add KOM"; + INTRO_TAC Local_lemmas.KOMWBWC [`E`;`V`;`affine hull {(vec 0),w,ivs_rho_node1 FF w}`;`r'`;`FF`;`{ITER i (rho_node1 FF) w' | i <= r'}`;`w' cross rho_node1 FF w'`;`w`;`w'`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + REWRITE_TAC[plane]; + CONJ_TAC; + GEXISTL_TAC [`(vec 0):real^3`;`w`;`ivs_rho_node1 FF w`]; + REWRITE_TAC[]; + BY(ASM_MESON_TAC[Local_lemmas.LOFA_IMP_NOT_COLL_IVS]); + CONJ_TAC; + MATCH_MP_TAC Marchal_cells_2_new.IN_AFFINE_KY_LEMMA1; + BY(SET_TAC[]); + REWRITE_TAC[SUBSET;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + EXPAND_TAC "w'"; + REWRITE_TAC[ITER_ADD]; + ASM_CASES_TAC `(i:num)=r'`; + ASM_REWRITE_TAC[]; + TYPIFY `r' + r = CARD V` (C SUBGOAL_THEN SUBST1_TAC); + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN FIRST_X_ASSUM_ST `r < CARD V - 1` MP_TAC THEN ARITH_TAC); + GMATCH_SIMP_TAC Local_lemmas1.LOFA_IMP_ITER_RHO_NODE_ID2; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC Marchal_cells_2_new.IN_AFFINE_KY_LEMMA1; + BY(SET_TAC[]); + TYPIFY `aff_gt {vec 0,w} {ivs_rho_node1 FF w} SUBSET affine hull {vec 0,w,ivs_rho_node1 FF w}` ENOUGH_TO_SHOW_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`ITER (i+r) (rho_node1 FF) w`;`i+(r:num)`]); + ANTS_TAC; + ASM_REWRITE_TAC[arith `r <= (i:num) + r`]; + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN FIRST_X_ASSUM_ST `r < CARD V - 1` MP_TAC THEN ARITH_TAC); + BY(SET_TAC[]); + TYPIFY `{vec 0,w,ivs_rho_node1 FF w } = {vec 0,w} UNION {ivs_rho_node1 FF w}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(REWRITE_TAC[AFF_GT_SUBSET_AFFINE_HULL]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "abbreviate uu, forward order"; + TYPIFY `ivs_rho_node1 FF w' IN V` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas1.LOCAL_FAN_IVS_IN_V; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!i. ITER i (rho_node1 FF) (ivs_rho_node1 FF w') IN V` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V; + BY(ASM_REWRITE_TAC[]); + TYPED_ABBREV_TAC `w0 = ivs_rho_node1 FF w'`; + TYPED_ABBREV_TAC `uu = (\i. ITER i (rho_node1 FF) w0)`; + TYPIFY `!i. ITER i (rho_node1 FF) w0 = uu i` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "uu"; + BY(REWRITE_TAC[]); + TYPIFY `w0 = uu 0 /\ w' = uu 1 /\ rho_node1 FF w' = uu 2 /\ (!i. ITER i (rho_node1 FF) w' = uu (i+1))` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "uu"; + REWRITE_TAC[ITER;ITER_1]; + EXPAND_TAC "w0"; + REWRITE_TAC[arith `2 = 1+1`;GSYM ITER_ADD;ITER_1]; + REPEAT (GMATCH_SIMP_TAC Local_lemmas1.LOCAL_FAN_RHO_NODE_IVS); + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (fun t -> RULE_ASSUM_TAC(REWRITE_RULE[t]) THEN ASSUME_TAC t); + TYPIFY `1 < r' /\ r' < CARD V - 1` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "r'"; + BY(FIRST_X_ASSUM_ST `1 < r /\ r < CARD V - 1` MP_TAC THEN ARITH_TAC); + TYPIFY `ivs_rho_node1 FF w = uu(r')` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `r' = PRE r' + 1` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN ARITH_TAC); + TYPIFY `uu (PRE r' + 1) = ITER (PRE r') (rho_node1 FF) (ITER r (rho_node1 FF) w)` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[]); + REWRITE_TAC[ITER_ADD]; + TYPIFY `PRE r' + r = CARD V - 1` (C SUBGOAL_THEN SUBST1_TAC); + EXPAND_TAC "r'"; + BY(REPEAT (FIRST_X_ASSUM_ST `1 < r /\ r < CARD V-1` MP_TAC) THEN ARITH_TAC); + GMATCH_SIMP_TAC Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1; + BY(ASM_MESON_TAC[]); + TYPIFY `!i j. ITER i (rho_node1 FF) (uu j) = uu (i+j)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `ITER` kill; + FIRST_X_ASSUM_ST `ITER` ((unlist ONCE_REWRITE_TAC) o GSYM); + BY(REWRITE_TAC[ITER_ADD]); + TYPIFY `w = uu (r'+1)` (C SUBGOAL_THEN ASSUME_TAC); + ONCE_REWRITE_TAC[arith `r' + 1 = 1 + r'`]; + FIRST_X_ASSUM ((unlist ONCE_REWRITE_TAC) o GSYM); + REWRITE_TAC[ITER_1]; + FIRST_X_ASSUM ((unlist REWRITE_TAC) o GSYM); + BY(ASM_MESON_TAC[Local_lemmas1.LOCAL_FAN_RHO_NODE_IVS]); + TYPIFY `rho_node1 FF w = uu (r'+2)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM SUBST1_TAC; + REWRITE_TAC[arith `r' + 2 = 1 + (r' + 1)`]; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[ITER_1]); + ASM_REWRITE_TAC[]; + COMMENT "apply XIV_ECAU"; + TYPIFY `(?e3. &0 < e3 /\ (!t. abs t < e3 ==> f (uu 1) t IN wedge_ge (vec 0) (f (uu (r' + 1)) t) (f (uu (r' + 2)) t) (f (uu r') t) /\ f (uu (r' + 1)) t IN wedge_ge (vec 0) (f (uu 1) t) (f (uu 2) t) (f (uu 0) t)))` ENOUGH_TO_SHOW_TAC; + REWRITE_TAC[arith `-- e < t /\ t < e <=> abs t < e`]; + BY(MESON_TAC[]); + MATCH_MP_TAC XIV_ECAU_BACK; + GEXISTL_TAC [`a`;`b`]; + COMMENT "cyclic set condition"; + TYPIFY `{uu i | i IN 1 .. r'+1} = {uu (i+1) | i <= r'}` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG]; + GEN_TAC; + MATCH_MP_TAC (TAUT `((a ==> b) /\ (b ==> a)) ==> (a <=> b)`); + CONJ_TAC THEN REPEAT WEAKER_STRIP_TAC; + TYPIFY `PRE i` EXISTS_TAC; + ASM_SIMP_TAC[arith `1 <= i ==> PRE i + 1 = i`]; + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + TYPIFY `i+1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 2(FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + ASM_REWRITE_TAC[]; + COMMENT "deformation condition"; + CONJ_TAC; + MATCH_MP_TAC deformation_subset; + TYPIFY `V` EXISTS_TAC; + ASM_REWRITE_TAC[SUBSET;IN_ELIM_THM]; + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + ASM_SIMP_TAC[arith `1 < r' ==> 1 <= r'`]; + COMMENT "aff_gt"; + TYPIFY `!i. uu(i+ CARD V) = uu i` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + INTRO_TAC Localization.PERIODIC_RHO_NODE1 [`V`;`E`;`FF`;`uu 0`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[Oxl_def.periodic]; + ASM_REWRITE_TAC[]; + BY(MESON_TAC[]); + TYPIFY `!i. r <= i ==> ITER i (rho_node1 FF) w = uu (i - (r-1))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `ITER i = ITER ((i-r) + r)` (C SUBGOAL_THEN SUBST1_TAC); + AP_TERM_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN ARITH_TAC); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (C INTRO_TAC [`i - (r-1)`]); + DISCH_THEN (SUBST1_TAC o GSYM); + AP_TERM_TAC; + EXPAND_TAC "r'"; + BY(FIRST_X_ASSUM MP_TAC THEN REPEAT (FIRST_X_ASSUM_ST `1 < r /\ r < CARD V - 1` MP_TAC) THEN ARITH_TAC); + SUBCONJ_TAC; + REWRITE_TAC[IN_NUMSEG] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `aff_gt` (C INTRO_TAC [`ITER (i+(r-1)) (rho_node1 FF) w`;`(i+(r-1))`]); + ASM_REWRITE_TAC[]; + ANTS_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REPEAT (FIRST_X_ASSUM_ST `1 < r /\ r < CARD V - 1` MP_TAC); + EXPAND_TAC "r'"; + BY(ARITH_TAC); + TYPIFY `(i+r-1) + r'+ 1 = i+ CARD V` ENOUGH_TO_SHOW_TAC; + BY(DISCH_THEN SUBST1_TAC THEN ASM_REWRITE_TAC[]); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REPEAT (FIRST_X_ASSUM_ST `1 < r /\ r < CARD V - 1` MP_TAC) THEN EXPAND_TAC "r'" THEN ARITH_TAC); + DISCH_TAC; + TYPIFY_GOAL_THEN `{uu 1, uu 2} SUBSET aff_gt {vec 0, uu (r' + 1)} {uu r'}` (unlist REWRITE_TAC); + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY;SUBSET]; + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN REWRITE_TAC[IN_NUMSEG;arith `1 <= 1 /\ 1 <= 2`]; + BY(REPEAT (FIRST_X_ASSUM_ST `1 < r /\ r < CARD V - 1` MP_TAC) THEN EXPAND_TAC "r'" THEN ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM_ST `1 < r /\ r < CARD V - 1` MP_TAC) THEN EXPAND_TAC "r'" THEN ARITH_TAC); + COMMENT "cross"; + CONJ_TAC; + REWRITE_TAC[IN_NUMSEG] THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `&0 < (a cross b) dot c` (C INTRO_TAC [`PRE i`]); + TYPIFY `PRE i < r' /\ PRE i + 1 = i /\ (PRE i+1)+1 = i+1` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[]); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + COMMENT "azim_cycle"; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`uu i`;`PRE i`]); + DISCH_THEN GMATCH_SIMP_TAC; + CONJ_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN (REWRITE_TAC[IN_NUMSEG]) THEN MESON_TAC[arith `1 <= i ==> PRE i + 1 = i`;arith `i <= r' /\ 1 <= i ==> PRE i < r'`]); + FIRST_X_ASSUM (C INTRO_TAC [`1`;`i`]); + BY(REWRITE_TAC[ITER_1;arith `1 + i = i + 1`]); + CONJ_TAC; + FIRST_X_ASSUM_ST `azim_cycle` MP_TAC; + TYPIFY_GOAL_THEN `r' < CARD FF` (unlist REWRITE_TAC); + GMATCH_SIMP_TAC Local_lemmas.LOFA_IMP_CARD_FF_V_EQ; + TYPIFY `V` EXISTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + BY(FIRST_X_ASSUM_ST `r' < CARD V - 1` MP_TAC THEN ARITH_TAC); + BY(FIRST_X_ASSUM_ST `w = uu(r'+1)` MP_TAC THEN MESON_TAC[]); + COMMENT "0 < azim"; + TYPIFY `!i. rho_node1 FF (uu i) = uu(i+1)` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`1`;`i`]); + BY(REWRITE_TAC[ITER_1;arith `1+i = i+1`]); + TYPIFY `!i. 1 <= i ==> ivs_rho_node1 FF (uu i) = uu (i-1)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `a = uu(i-1)`; + TYPIFY `i = 1 + (i-1)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`1`;`i-1`]); + REWRITE_TAC[ITER_1]; + DISCH_THEN (SUBST1_TAC o GSYM); + EXPAND_TAC "a'"; + GMATCH_SIMP_TAC Local_lemmas.IVS_RHO_IDD; + BY(ASM_MESON_TAC[]); + TYPIFY_GOAL_THEN ` (!i. i IN 1..r' + 1 ==> &0 < azim (vec 0) (uu i) (uu (i + 1)) (uu (i - 1)))` (unlist REWRITE_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `&0 < azim a b c d` (C INTRO_TAC [`uu i`]); + ANTS_TAC; + BY(ASM_MESON_TAC[]); + TYPIFY `rho_node1 FF (uu i) = uu (i+1) /\ ivs_rho_node1 FF (uu i) = (uu (i-1))` ENOUGH_TO_SHOW_TAC; + BY(DISCH_THEN (unlist REWRITE_TAC)); + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[IN_NUMSEG] THEN MESON_TAC[]); + COMMENT "azim <= pi"; + TYPIFY_GOAL_THEN `(!i. ?e2. i IN 1..r' + 1 ==> &0 < e2 /\ (!t. abs t < e2 ==> azim (vec 0) (f (uu i) t) (f (uu (i + 1)) t) (f (uu (i - 1)) t) <= pi))` (unlist REWRITE_TAC); + GEN_TAC; + REWRITE_TAC[RIGHT_EXISTS_IMP_THM]; + DISCH_TAC; + FIRST_X_ASSUM_ST `azim a b c d <= pi` (C INTRO_TAC [`uu i`]); + REWRITE_TAC[RIGHT_EXISTS_IMP_THM]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + (REPEAT WEAKER_STRIP_TAC); + TYPIFY `e2` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t`]); + ASM_REWRITE_TAC[arith `-- e < t /\ t < e <=> abs t < e`]; + TYPIFY `ivs_rho_node1 FF (uu i) = uu (i - 1)` ENOUGH_TO_SHOW_TAC; + BY(DISCH_THEN (unlist REWRITE_TAC)); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[IN_NUMSEG] THEN MESON_TAC[]); + COMMENT "pairwise"; + REWRITE_TAC[pairwise]; + TYPIFY `!i. uu (i) IN V` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V]); + TYPIFY `(!i j. i IN 0..r'+1 /\ j IN 0..r'+1 /\ ~(i = j)==> ~(uu i = uu j)) /\ (!i j. i IN 1..r'+2 /\ j IN 1..r'+2 /\ ~(i=j) ==> ~(uu i = uu j))` ENOUGH_TO_SHOW_TAC; + REPEAT (FIRST_X_ASSUM_ST `azim` kill); + BY(ASM_MESON_TAC[PROPERTIES_GENERIC_LOCAL_FAN_ALT]); + CONJ_TAC; + REWRITE_TAC[IN_NUMSEG]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + (REPLICATE_TAC 3 (FIRST_X_ASSUM_ST `ITER` kill)); + REWRITE_TAC[]; + FIRST_X_ASSUM_ST `ITER` ((unlist ONCE_REWRITE_TAC) o GSYM); + BY(ASM_MESON_TAC[Local_lemmas1.LT_CARD_MONO_LOFA;arith `i <= r'+1 /\ 1 < r' /\ r' < CARD V - 1 ==> i < CARD V`]); + TYPIFY `!i. 1 <= i ==> uu i = ITER (PRE i) (rho_node1 FF) (w')` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[]; + BY(MESON_TAC[arith `1 <= i ==> PRE i + 1 = i`]); + REWRITE_TAC[IN_NUMSEG]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[]; + FIRST_X_ASSUM_ST `ITER` (REPEAT o GMATCH_SIMP_TAC); + TYPIFY `w' IN V` (C SUBGOAL_THEN MP_TAC); + BY(ASM_REWRITE_TAC[]); + TYPIFY `PRE i < CARD V /\ PRE j < CARD V` (C SUBGOAL_THEN MP_TAC); + BY(REPEAT (FIRST_X_ASSUM_ST `CARD` MP_TAC) THEN REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[arith `1<= i /\ i <= r'+2 /\ 1 < r' /\ r' < CARD V - 1 ==> PRE i < CARD V`]); + REPEAT (FIRST_X_ASSUM_ST `local_fan` MP_TAC); + REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC); + BY(MESON_TAC[Local_lemmas1.LT_CARD_MONO_LOFA;arith `1 <= i /\ 1 <= j /\ PRE i = PRE j ==> (i = j)`]) + ]);; + (* }}} *) + +(* +let ZLZTHIC_concl = +`!a b V E FF f. + convex_local_fan (V,E,FF) /\ + generic V E /\ + deformation f V (a,b) /\ + (!v t. v IN V /\ t IN real_interval (a,b) /\ interior_angle1 (vec 0) FF v = pi ==> + interior_angle1 (vec 0) ( IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) (f v t) <= pi) + ==> (?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> convex_local_fan + (IMAGE (\v. f v t) V, + IMAGE (IMAGE (\v. f v t)) E, + IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) /\ + generic (IMAGE (\v. f v t) V) + (IMAGE (IMAGE (\v. f v t)) E)))`;; +*) + +let ZLZTHIC = prove_by_refinement( +`!a b V E FF f. + convex_local_fan (V,E,FF) /\ + generic V E /\ + deformation f V (a,b) /\ + (!v t. v IN V /\ t IN real_interval (a,b) /\ interior_angle1 (vec 0) FF v = pi ==> + interior_angle1 (vec 0) ( IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) (f v t) <= pi) + ==> (?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> convex_local_fan + (IMAGE (\v. f v t) V, + IMAGE (IMAGE (\v. f v t)) E, + IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) /\ + generic (IMAGE (\v. f v t) V) + (IMAGE (IMAGE (\v. f v t)) E)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC zlz_reduction; + GEXISTL_TAC [`a`;`b`]; + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC zlz_generic; + GEXISTL_TAC [`a`;`b`;`E`]; + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + MATCH_MP_TAC zlz_wedge_skolem; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC zlz_wedge_boundary; + GEXISTL_TAC [`a`;`b`]; + BY(ASM_REWRITE_TAC[]); + MATCH_MP_TAC zlz_azim; + GEXISTL_TAC [`a`;`b`;`V`]; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + + +end;; + diff --git a/text_formalization/local/appendix_main_estimate.hl b/text_formalization/local/appendix_main_estimate.hl new file mode 100644 index 0000000..ac332e1 --- /dev/null +++ b/text_formalization/local/appendix_main_estimate.hl @@ -0,0 +1,1949 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Section: Conclusions *) +(* Chapter: Local Fan *) +(* Author: Thomas C. Hales *) +(* Date: 2013-02-26 *) +(* ========================================================================== *) + +(* +remaining conclusions from appendix to Local Fan chapter + +svn 3270 contains deprecated terminal SCS cases +*) + + +module Appendix = struct + + + open Hales_tactic;; + + + + (* Proved in Lunar_deform.MHAEYJN *) + + let MHAEYJN_concl = + `!a b V E FF f v w u. + convex_local_fan (V,E,FF) /\ + lunar (v,w) V E /\ + deformation f V (a,b) /\ + interior_angle1 (vec 0) FF v < pi /\ + u IN V /\ + ~(u = v) /\ + ~(u = w) /\ + (!u' t. u' IN V /\ ~(u = u') /\ t IN real_interval (a,b) ==> f u' t = u') /\ + (!t. t IN real_interval (a,b) ==> f u t IN affine hull {vec 0, v, w, u}) + ==> (?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> convex_local_fan + (IMAGE (\v. f v t) V, + IMAGE (IMAGE (\v. f v t)) E, + IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) /\ + lunar (v,w) (IMAGE (\v. f v t) V) + (IMAGE (IMAGE (\v. f v t)) E)))`;; + + let ZLZTHIC_concl = + `!a b V E FF f. + convex_local_fan (V,E,FF) /\ + generic V E /\ + deformation f V (a,b) /\ + (!v t. v IN V /\ t IN real_interval (a,b) /\ interior_angle1 (vec 0) FF v = pi ==> + interior_angle1 (vec 0) ( IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) (f v t) <= pi) + ==> (?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> convex_local_fan + (IMAGE (\v. f v t) V, + IMAGE (IMAGE (\v. f v t)) E, + IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) /\ + generic (IMAGE (\v. f v t) V) + (IMAGE (IMAGE (\v. f v t)) E)))`;; + + + let VPWSHTO_concl = + `!v x u w w1. + {v,x,u,w,w1} SUBSET ball_annulus /\ packing {v,x,u,w,w1} /\ ~(v = x) /\ ~(v = u) /\ ~(v=w)/\ ~(v=w1) /\ ~(x = u)/\ ~(x=w)/\ ~(x=w1)/\ ~(u=w)/\ ~(u=w1) /\ ~(w=w1) + /\ norm(v-x)= &2 + /\ norm(x-u)= &2 + /\ norm(u-w)= &2 + /\ norm(w-w1)= &2 + /\ norm(w1-v)= &2 + ==> ?v1 u1 w2. u1 IN {v,x,u,w,w1} + /\ u1 IN {v,x,u,w,w1} /\ w2 IN {v,x,u,w,w1}/\ ~(v1=u1)/\ ~(u1=w2) /\ ~(v1=w2) /\ + &2 < norm(v1-u1) /\ &2 < norm(v1 - w2) + /\ norm(v1-u1) <= &1 + sqrt(&5)/\ norm(v1-w2)<= &1 + sqrt(&5)`;; + + let arc1553_v39 = new_definition `arc1553_v39 = arclength (&2) (&2) (sqrt(#15.53))`;; + + + let cstab=new_definition ` cstab= #3.01`;; + + let rho_fun = new_definition `rho_fun y = &1 + (inv (&2 * h0 - &2)) * (inv pi) * sol0 * (y - &2)`;; + + let rho_rho_fun = prove_by_refinement( + `!y. rho_fun y = rho y`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.rho;rho_fun;Sphere.const1;Sphere.ly;Sphere.interp]; + REWRITE_TAC[GSYM Nonlinear_lemma.sol0_EQ_sol_y;Sphere.h0]; + REWRITE_TAC[arith `a + b = a + c <=> c = b`]; + GEN_TAC; + MATCH_MP_TAC (arith `(sol0/pi)*(&1 - a) = (sol0/pi)*(c*e) ==> sol0/pi - sol0/pi * a = c * inv pi * sol0 * e`); + AP_TERM_TAC; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + let tau_fun = new_definition `tau_fun V E f = sum (f) (\e. rho_fun(norm(FST e)) * (azim_in_fan e E)) - (pi + sol0) * &(CARD f -2)`;; + + let tau3 = new_definition `tau3 (v1:real^3) v2 v3 = + rho (norm v1) * dihV (vec 0) v1 v2 v3 + rho(norm v2) * dihV (vec 0) v2 v3 v1 + + rho(norm v3) * dihV (vec 0) v3 v1 v2 - (pi + sol0)`;; + + (* + let standard = new_definition + ` standard v w <=> &2 <= norm(v-w) /\ norm (v-w) <= &2 *h0 `;; + + let protracted = new_definition + ` protracted v w <=> &2 * h0 <= norm(v-w) /\ norm (v-w) <= sqrt (&8) `;; + + let diagonal0 = new_definition + ` (diagonal0 (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) <=> ~(v = w) /\ ~({v,w} IN E) `;; + + let diagonal1 = new_definition + ` diagonal1 (V,E) <=> !v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) + ==> &2 * h0 <= norm(v-w) `;; + + let main_estimate= new_definition + ` main_estimate(V,E,f) <=> + convex_local_fan(V,E,f) /\ + packing V /\ + V SUBSET ball_annulus /\ + diagonal1(V,E) /\ + CARD E= CARD f /\ + 3<= CARD E /\ + CARD E <= 6`;; + *) + + let torsor = new_definition + ` torsor (s:A->bool) k (f:A->A) <=> (!x. x IN s ==> (f x) IN s) /\ (!x1 x2. x1 IN s /\ x2 IN s /\ f x1 = f x2 ==> x1=x2) /\ (!i x. 0 < i /\ i < k /\ x IN s ==> ~((f POWER i) x = x)) /\ (!x. x IN s==> (f POWER k) x = x) + /\ s HAS_SIZE k`;; + + let tgt = new_definition `tgt = #1.541`;; + + let d_tame = new_definition `d_tame n = + if n = 3 then &0 else + if n = 4 then #0.206 else + if n = 5 then #0.4819 else + if n = 6 then #0.712 else tgt`;; + + (* rename d_tame2 -> tame_table_d, for compatibility with the rest of the project. *) + + (* + let d_tame2 = new_definition `d_tame2 r s = + if (r + 2 * s <= 3) then &0 + else + #0.103 * (&2 - &s) + #0.2759 * (&r + &2 * &s - &4)`;; + + let tame_table_d_tame2 = prove_by_refinement( + `!r s. tame_table_d r s = if (r + 2 * s <= 3) then &0 + else + #0.103 * (&2 - &s) + #0.2759 * (&r + &2 * &s - &4)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.tame_table_d]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `r + 2 * s > 3 <=> ~(r + 2 * s <= 3)`]; + COND_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + *) + + let JEJTVGB_std_concl = + `!V E FF. + convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + 4 <= CARD V /\ CARD V <= 6 /\ + (!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> &2 * h0 <= dist(v,w)) /\ + (!v w. {v,w} IN E ==> &2 <= dist(v,w) /\ dist(v,w) <= &2 * h0) ==> + d_tame (CARD V) <= tau_fun V E FF`;; + + let JEJTVGB_std3_concl = + `!v1 v2 v3. + &2 <= norm v1 /\ + &2 <= norm v2 /\ + &2 <= norm v3 /\ + norm v1 <= &2 * h0 /\ + norm v2 <= &2 * h0 /\ + norm v3 <= &2 * h0 /\ + &2 <= dist(v1,v2) /\ + &2 <= dist(v1,v3) /\ + &2 <= dist(v2,v3) /\ + dist(v1,v2) <= &2 * h0 /\ + dist(v1,v3) <= &2 * h0 /\ + dist(v2,v3) <= &2 * h0 ==> + &0 <= tau3 v1 v2 v3`;; + + let JEJTVGB_pent_diag_concl = + `!V E FF. + convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + CARD V = 5 /\ + (!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> sqrt8 <= dist(v,w)) /\ + (!v w. {v,w} IN E ==> &2 <= dist(v,w) /\ dist(v,w) <= &2 * h0) ==> + #0.616 <= tau_fun V E FF`;; + + let JEJTVGB_pent_pro_concl = + `!V E FF. + convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + CARD V = 5 /\ + (!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> &2 * h0 <= dist(v,w)) /\ + (?v0 w0. + (!v w. {v,w} IN E /\ ~({v,w} = {v0,w0}) ==> &2 <= dist(v,w) /\ dist(v,w) <= &2 * h0) /\ + {v0,w0} IN E /\ + &2 *h0 <= dist(v0,w0) /\ dist(v0,w0) <= sqrt8) + ==> + #0.616 <= tau_fun V E FF`;; + + let JEJTVGB_quad_pro_concl = + `!V E FF. + convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + CARD V = 4 /\ + (!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> sqrt8 <= dist(v,w)) /\ + (?v0 w0. + (!v w. {v,w} IN E /\ ~({v,w} = {v0,w0}) ==> &2 <= dist(v,w) /\ dist(v,w) <= &2 * h0) /\ + {v0,w0} IN E /\ + &2 *h0 <= dist(v0,w0) /\ dist(v0,w0) <= sqrt8) + ==> + #0.477 <= tau_fun V E FF`;; + + let JEJTVGB_quad_diag_concl = + `!V E FF. + convex_local_fan (V,E,FF) /\ + packing V /\ + V SUBSET ball_annulus /\ + CARD V = 4 /\ + (!v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) ==> &3 <= dist(v,w)) /\ + (!v w. {v,w} IN E ==> &2 <= dist(v,w) /\ dist(v,w) <= &2 * h0) ==> + #0.467 <= tau_fun V E FF`;; + + let JEJTVGB_concl = + let co = [JEJTVGB_std_concl;JEJTVGB_std3_concl;JEJTVGB_pent_diag_concl;JEJTVGB_pent_pro_concl; + JEJTVGB_quad_pro_concl;JEJTVGB_quad_diag_concl] in + list_mk_conj co;; + + let JEJTVGB_assume_v39 = new_definition (mk_eq (`JEJTVGB_assume_v39:bool`,JEJTVGB_concl));; + + (* I'll use periodic functions to SCSs for now *) + + let peropp = new_definition `peropp (f:num->A) k i = f (k - SUC(i MOD k))`;; + + let peropp2 = new_definition `peropp2 (f:num->num->A) k i j = f (k - SUC(i MOD k)) (k - SUC(j MOD k))`;; + + let peropp_periodic = prove_by_refinement( + `!(f:num->A) k. periodic (peropp f k) k`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Oxl_def.periodic;peropp]; + ONCE_REWRITE_TAC[arith `i + k = 1 * k + i`]; + BY(REWRITE_TAC[MOD_MULT_ADD]) + ]);; + (* }}} *) + + let scs_data = `(k:num,d:real,a,alpha,beta,b,J,lo,hi,str)`;; + + let scs_exists = MESON[] `?(x: ( + (num) # + (real) # + (num->num -> real) # + (num->num -> real) # + (num-> num-> real) # + (num -> num -> real) # + (num -> num -> bool) # + (num -> bool) # + (num -> bool) # + (num -> bool))). T`;; + + let scs_v39 = REWRITE_RULE[] (new_type_definition "scs_v39" ("scs_v39", "dest_scs_v39") scs_exists);; + + let scs_k_v39 = new_definition `scs_k_v39 s = part0 (dest_scs_v39 s)`;; + let scs_d_v39 = new_definition `scs_d_v39 s = part1 (dest_scs_v39 s)`;; + + let scs_a_v39 = new_definition `scs_a_v39 s = part2 (dest_scs_v39 s)`;; + let scs_am_v39 = new_definition `scs_am_v39 s = part3 (dest_scs_v39 s)`;; + let scs_bm_v39 = new_definition `scs_bm_v39 s = part4 (dest_scs_v39 s)`;; + let scs_b_v39 = new_definition `scs_b_v39 s = part5 (dest_scs_v39 s)`;; + + let scs_J_v39 = new_definition `scs_J_v39 s = part6 (dest_scs_v39 s)`;; + let scs_lo_v39 = new_definition `scs_lo_v39 s = part7 (dest_scs_v39 s)`;; + let scs_hi_v39 = new_definition `scs_hi_v39 s = part8 (dest_scs_v39 s)`;; + let scs_str_v39 = new_definition `scs_str_v39 s = SND(drop3(drop3 (dest_scs_v39 s)))`;; + + let arcmax_v39 = new_definition `arcmax_v39 s (p1,p2) = + arclength (&2) (&2) (scs_bm_v39 s p1 p2)`;; + + let scs_components = prove_by_refinement( + `!s. dest_scs_v39 s = (scs_k_v39 s,scs_d_v39 s,scs_a_v39 s,scs_am_v39 s ,scs_bm_v39 s,scs_b_v39 s,scs_J_v39 s, + scs_lo_v39 s,scs_hi_v39 s,scs_str_v39 s)`, + (* {{{ proof *) + [ + REWRITE_TAC[Wrgcvdr_cizmrrh.PAIR_EQ2;scs_k_v39;scs_d_v39;scs_a_v39;]; + REWRITE_TAC[scs_am_v39;scs_bm_v39;scs_b_v39;]; + REWRITE_TAC[scs_J_v39;scs_hi_v39;scs_lo_v39;]; + REWRITE_TAC[scs_str_v39]; + BY(REWRITE_TAC[Misc_defs_and_lemmas.part1;Misc_defs_and_lemmas.part2;Misc_defs_and_lemmas.part3;Misc_defs_and_lemmas.part4; Misc_defs_and_lemmas.part5;Misc_defs_and_lemmas.part6;Misc_defs_and_lemmas.part7;Misc_defs_and_lemmas.drop0;Misc_defs_and_lemmas.drop3;Misc_defs_and_lemmas.drop1;Misc_defs_and_lemmas.part0;Misc_defs_and_lemmas.part8;Misc_defs_and_lemmas.drop2]) + ]);; + (* }}} *) + + + + let scs_k_v39_explicit = prove_by_refinement( + `!k d a b alpha beta J lo str. scs_k_v39 (scs_v39 (k,d,a,alpha,beta,b,J,lo,hi,str)) = k`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[scs_k_v39;scs_v39;Misc_defs_and_lemmas.part0]) + ]);; + (* }}} *) + + let scs_d_v39_explicit = prove_by_refinement( + `!k d a b alpha beta J lo str. scs_d_v39 (scs_v39 (k,d,a,alpha,beta,b,J,lo,hi,str)) = d`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[scs_d_v39;scs_v39;Misc_defs_and_lemmas.part1;Misc_defs_and_lemmas.drop0;FST]) + ]);; + (* }}} *) + + let scs_a_v39_explicit = prove_by_refinement( + `!k d a b alpha beta J lo str. scs_a_v39 (scs_v39 (k,d,a,alpha,beta,b,J,lo,hi,str)) = a`, + (* {{{ proof *) + [ + BY((REWRITE_TAC[scs_a_v39;scs_v39;Misc_defs_and_lemmas.part2;Misc_defs_and_lemmas.part1;Misc_defs_and_lemmas.drop1;FST])) + ]);; + (* }}} *) + + let scs_am_v39_explicit = prove_by_refinement( + `!k d a b alpha beta J lo str. scs_am_v39 (scs_v39 (k,d,a,alpha,beta,b,J,lo,hi,str)) = alpha`, + (* {{{ proof *) + [ + BY((REWRITE_TAC[scs_am_v39;scs_v39;Misc_defs_and_lemmas.part3;Misc_defs_and_lemmas.drop2;FST])) + ]);; + (* }}} *) + + let scs_bm_v39_explicit = prove_by_refinement( + `!k d a b alpha beta J lo str. scs_bm_v39 (scs_v39 (k,d,a,alpha,beta,b,J,lo,hi,str)) = beta`, + (* {{{ proof *) + [ + ((REWRITE_TAC[scs_bm_v39;scs_v39;Misc_defs_and_lemmas.part4;Misc_defs_and_lemmas.drop3;FST])) + ]);; + (* }}} *) + + let scs_b_v39_explicit = prove_by_refinement( + `!k d a b alpha beta J lo str. scs_b_v39 (scs_v39 (k,d,a,alpha,beta,b,J,lo,hi,str)) = b`, + (* {{{ proof *) + [ + ((REWRITE_TAC[scs_b_v39;scs_v39;Misc_defs_and_lemmas.part5;Misc_defs_and_lemmas.drop3;FST])) + ]);; + (* }}} *) + + let scs_J_v39_explicit = prove_by_refinement( + `!k d a b alpha beta J lo str. scs_J_v39 (scs_v39 (k,d,a,alpha,beta,b,J,lo,hi,str)) = J`, + (* {{{ proof *) + [ + ((REWRITE_TAC[scs_J_v39;scs_v39;Misc_defs_and_lemmas.part6;Misc_defs_and_lemmas.drop3;FST])) + ]);; + (* }}} *) + + let scs_lo_v39_explicit = prove_by_refinement( + `!k d a b alpha beta J lo str. scs_lo_v39 (scs_v39 (k,d,a,alpha,beta,b,J,lo,hi,str)) = lo`, + (* {{{ proof *) + [ + ((REWRITE_TAC[scs_lo_v39;scs_v39;Misc_defs_and_lemmas.part7;Misc_defs_and_lemmas.drop3;FST])) + ]);; + (* }}} *) + + let scs_hi_v39_explicit = prove_by_refinement( + `!k d a b alpha beta J lo str. scs_hi_v39 (scs_v39 (k,d,a,alpha,beta,b,J,lo,hi,str)) = hi`, + (* {{{ proof *) + [ + ((REWRITE_TAC[scs_hi_v39;scs_v39;Misc_defs_and_lemmas.part8;Misc_defs_and_lemmas.drop3;FST])) + ]);; + (* }}} *) + + let scs_str_v39_explicit = prove_by_refinement( + `!k d a b alpha beta J lo str. scs_str_v39 (scs_v39 (k,d,a,alpha,beta,b,J,lo,hi,str)) = str`, + (* {{{ proof *) + [ + ((REWRITE_TAC[scs_str_v39;scs_v39;Misc_defs_and_lemmas.part7;Misc_defs_and_lemmas.drop3;FST])) + ]);; + (* }}} *) + + let scs_v39_explicit = end_itlist CONJ + [scs_k_v39_explicit;scs_d_v39_explicit; + scs_a_v39_explicit;scs_am_v39_explicit; + scs_b_v39_explicit;scs_bm_v39_explicit; + scs_J_v39_explicit;scs_lo_v39_explicit; + scs_hi_v39_explicit; + scs_str_v39_explicit];; + + let periodic2 = new_definition `periodic2 (f:num->num->A) k = (!i j. f (i + k) j = f i j /\ f i (j + k) = f i j)`;; + + (* This doesn't specify the form of : symmetric? + Let's make it symmetric periodic. is_ear_v... *) + + let is_scs_v39 = new_definition `is_scs_v39 s = ( + scs_d_v39 s < #0.9 /\ + 3 <= scs_k_v39 s /\ + scs_k_v39 s <= 6 /\ + periodic (scs_lo_v39 s) (scs_k_v39 s) /\ + periodic (scs_hi_v39 s) (scs_k_v39 s) /\ + periodic (scs_str_v39 s) (scs_k_v39 s) /\ + periodic (scs_str_v39 s) (scs_k_v39 s) /\ + periodic2 (scs_a_v39 s) (scs_k_v39 s) /\ + periodic2 (scs_am_v39 s) (scs_k_v39 s) /\ + periodic2 (scs_bm_v39 s) (scs_k_v39 s) /\ + periodic2 (scs_b_v39 s) (scs_k_v39 s) /\ + periodic2 (scs_J_v39 s) (scs_k_v39 s) /\ + (!i j. (scs_a_v39 s i j = scs_a_v39 s j i /\ scs_am_v39 s i j = scs_am_v39 s j i /\ + scs_bm_v39 s i j = scs_bm_v39 s j i /\ scs_b_v39 s i j = scs_b_v39 s j i /\ + scs_J_v39 s i j = scs_J_v39 s j i)) /\ + (!i j. scs_a_v39 s i j <= scs_am_v39 s i j /\ scs_am_v39 s i j <= scs_bm_v39 s i j /\ + scs_bm_v39 s i j <= scs_b_v39 s i j) /\ + (!i. scs_a_v39 s i i = &0) /\ + (!i j. (i < scs_k_v39 s) /\ (j < scs_k_v39 s) /\ ~(i = j) ==> &2 <= scs_a_v39 s i j) /\ + (!i. (scs_k_v39 s = 3) ==> (scs_b_v39 s i (SUC i) < &4)) /\ + (!i. (3 < scs_k_v39 s) ==> (scs_b_v39 s i (SUC i) <= cstab)) /\ + (!i j. scs_J_v39 s i j ==> ((j MOD scs_k_v39 s = (SUC i) MOD scs_k_v39 s) \/ + ((i MOD scs_k_v39 s = (SUC j) MOD scs_k_v39 s)))) /\ + (!i j. scs_J_v39 s i j ==> scs_a_v39 s i j = sqrt8 /\ scs_b_v39 s i j = cstab) /\ + CARD { i | i < scs_k_v39 s /\ (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i)) } + scs_k_v39 s <= 6)`;; + + (* + *) + + let unadorned_v39 = new_definition `unadorned_v39 s = + (scs_lo_v39 s = {} /\ scs_hi_v39 s = {} /\ scs_str_v39 s = {} /\ scs_a_v39 s = scs_am_v39 s /\ scs_b_v39 s = scs_bm_v39 s)`;; + + let periodic_empty = prove_by_refinement( + `!n. periodic {} n`, + (* {{{ proof *) + [ + REWRITE_TAC[Oxl_def.periodic]; + BY(ASM_MESON_TAC[NOT_IN_EMPTY;IN]) + ]);; + (* }}} *) + + let scs_unadorned = prove_by_refinement( + `!s. is_scs_v39 s ==> + is_scs_v39 (scs_v39 (scs_k_v39 s,scs_d_v39 s,scs_a_v39 s,scs_a_v39 s,scs_b_v39 s,scs_b_v39 s,scs_J_v39 s,{},{},{}))`, + (* {{{ proof *) + [ + REWRITE_TAC[is_scs_v39;scs_v39_explicit]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[arith `x <= x`;periodic_empty]; + BY(ASM_MESON_TAC[arith `x <= y /\ y <= z ==> x <= z`]) + ]);; + (* }}} *) + + let is_ear_v39 = new_definition `is_ear_v39 s <=> + is_scs_v39 s /\ + unadorned_v39 s /\ + scs_k_v39 s = 3 /\ + scs_d_v39 s = #0.11 /\ + (!i. scs_b_v39 s i i = &0) /\ + (?i. {i | i < 3 /\ scs_J_v39 s i (SUC i)} = {i} /\ + scs_a_v39 s i (SUC i) = sqrt8 /\ scs_b_v39 s i (SUC i) = cstab /\ + (!j. j < 3 /\ ~(j = i) ==> scs_a_v39 s j (SUC j) = &2 /\ scs_b_v39 s j (SUC j) = &2 * h0))`;; + + let BBs_v39 = new_definition `BBs_v39 s vv = + (let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + let FF = IMAGE (\i. (vv i,vv (SUC i))) (:num) in + (V SUBSET ball_annulus /\ + periodic vv (scs_k_v39 s) /\ + (!i j. scs_a_v39 s i j <= dist(vv i,vv j) /\ dist(vv i,vv j) <= scs_b_v39 s i j) /\ + (scs_k_v39 s <= 3 \/ (convex_local_fan (V,E,FF)))))`;; + + let dsv_v39 = new_definition `dsv_v39 s (vv:num->real^3) = + scs_d_v39 s + #0.1 * (if (is_ear_v39 s) then &1 else -- &1) * + sum {i | i < scs_k_v39 s /\ scs_J_v39 s i (SUC i)} (\i. cstab - dist(vv i,vv (SUC i)))`;; + + let dsv_J_empty = prove_by_refinement( + `!s vv. scs_J_v39 s = (\i j. F) ==> dsv_v39 s vv = scs_d_v39 s`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[dsv_v39;EMPTY_GSPEC;SUM_CLAUSES]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + let taustar_v39 = new_definition `taustar_v39 s vv = + (let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + let FF = IMAGE (\i. (vv i,vv (SUC i))) (:num) in + (if (scs_k_v39 s <= 3) then tau3 (vv 0) (vv 1) (vv 2) - dsv_v39 s vv + else tau_fun V E FF - dsv_v39 s vv))`;; + + let mk_unadorned_v39 = new_definition `mk_unadorned_v39 k d a b = + scs_v39 (k,d,a,a,b,b,(\i j. F),{},{},{})`;; + + let cs_adj = new_definition `cs_adj k a1 a2 i j = + (if (i MOD k = j MOD k) then &0 + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2))`;; + + let psort = new_definition `psort k (u:num#num) = + (let i = FST u MOD k in + let j = SND u MOD k in + if (i <= j) then (i,j) else (j,i))`;; + + (* + let ASSOCD = new_definition` ASSOCD (a:A) hs (d:D) = + if hs = [] then d else ASSOC a hs`;; + *) + + let ASSOCD_v39 = new_recursive_definition list_RECURSION + `ASSOCD_v39 (a:A) [] (d:D) = d /\ + ASSOCD_v39 a (CONS h t) d = if (a = FST h) then SND h else ASSOCD_v39 a t d`;; + + let funlist_v39 = new_definition `funlist_v39 data d k i j = + (let data' = MAP (\ (u, d). (psort k u,d)) data in + if (i MOD k = j MOD k) then (&0) + else ASSOCD_v39 (psort k (i,j)) data' d)`;; + + let funlistA_v39 = new_definition `funlistA_v39 data (diag:A) default k i j = + (let data' = MAP (\ (u, d). (psort k u,d)) data in + if (i MOD k = j MOD k) then diag + else ASSOCD_v39 (psort k (i,j)) data' default)`;; + + let override = new_definition `override a k u d i j = + if psort k u = psort k (i,j) then (d:A) else a i j`;; + + (* constant 0.467 corrected on 2013-06-03. *) + + let s_init_list_v39 = new_definition `s_init_list_v39 = + let upperbd = &6 in + let a_pro = (\k p a1 a2 i j. + (if (i MOD k = j MOD k) then &0 + else (if {(i MOD k),(j MOD k)}={0,1} then p + else (if (j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) then a1 else a2)))) in + [mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (&2 * h0)) (cs_adj 6 (&2 * h0) upperbd); // scs_6I1 + mk_unadorned_v39 5 (d_tame 5) (cs_adj 5 (&2) (&2 * h0)) (cs_adj 5 (&2 * h0) upperbd); // scs_5I1 + mk_unadorned_v39 4 (d_tame 4) (cs_adj 4 (&2) (&2 * h0)) (cs_adj 4 (&2 * h0) upperbd); // scs_4I1 + mk_unadorned_v39 3 (d_tame 3) (cs_adj 3 (&2) (&2 * h0)) (cs_adj 3 (&2 * h0) upperbd); // scs_3I1 + mk_unadorned_v39 5 (#0.616) (cs_adj 5 (&2) (sqrt8)) (cs_adj 5 (&2 * h0) upperbd); // scs_5I2 + mk_unadorned_v39 4 (#0.467) (cs_adj 4 (&2) (&3)) (cs_adj 4 (&2 * h0) upperbd); // scs_4I2 + mk_unadorned_v39 5 (#0.616) (a_pro 5 (&2 * h0) (&2) (&2 * h0)) (a_pro 5 sqrt8 (&2 * h0) upperbd); // scs_5I3 + mk_unadorned_v39 4 (#0.477) (a_pro 4 (&2 * h0) (&2) sqrt8) (a_pro 4 sqrt8 (&2 * h0) upperbd) // scs_4I3 + ]`;; + + let LENGTH_s_init_list = prove_by_refinement( + `LENGTH s_init_list_v39 = 8`, + (* {{{ proof *) + [ + REWRITE_TAC[s_init_list_v39;LET_DEF;LET_END_DEF;LENGTH]; + BY(ARITH_TAC) + ]);; + (* }}} *) + + (* terminal cases *) + + let scs_6T1 = + `mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (cstab)) (cs_adj 6 (&2) (&6))`;; + + let scs_5T1 = + `mk_unadorned_v39 5 (#0.616) (cs_adj 5 (&2) (cstab)) (cs_adj 5 (&2) (&6))`;; + + let scs_4T1 = (* terminal_adhoc_quad_5691615370 = *) + `mk_unadorned_v39 4 #0.467 (cs_adj 4 (&2) (&3)) + (cs_adj 4 (&2) (&6))`;; + + let scs_4T2 = (* terminal_adhoc_quad_9563139965B = *) + `mk_unadorned_v39 4 (#0.467) (cs_adj 4 (&2) (&3)) (cs_adj 4 (&2*h0) (&3))`;; + + let scs_4T3 = (* terminal_adhoc_quad_4680581274 = *) + `mk_unadorned_v39 4 (#0.513) + (funlist_v39 [(0,1),cstab ; (0,2),cstab ; (1,3),cstab ] (&2) 4) + (funlist_v39 [(0,1),cstab ; (0,2),(&6) ; (1,3),(&6) ] (&2) 4)`;; + + (* deprecated 2013-06-17 + let terminal_adhoc_quad_7697147739 = + `mk_unadorned_v39 4 (#0.616 - #0.11) (funlist_v39 [(0,1),sqrt8 ; (0,2),cstab ; (1,3),cstab ] (&2) 4) + (funlist_v39 [(0,1),sqrt8 ; (0,2),(&6) ; (1,3),(&6) ] (&2) 4)`;; + *) + + let scs_4T4 = + `mk_unadorned_v39 4 (#0.477) + (funlist_v39 [(0,1),(&2 * h0);(0,2),sqrt8;(1,3),sqrt8] (&2) 4) + (funlist_v39 [(0,1),sqrt8 ;(0,2),(&6); (1,3),cstab] (&2 * h0) 4)`;; + + let scs_4T5 = + `mk_unadorned_v39 4 (#0.513) + (funlist_v39 [(0,1),(&2 * h0);(0,2),cstab;(1,3),cstab] (&2) 4) + (funlist_v39 [(0,1),cstab ;(0,2),(&6); (1,3),cstab] (&2 * h0) 4)`;; + + (* deprecated 2013-06-17 + let terminal_tri_7720405539 = `mk_unadorned_v39 + 3 + (#0.5518 / #2.0 - #0.2) + (funlist_v39 [(0,1),cstab; (0,2), (&2 * h0); (1,2),(&2)] (&2) 3) + (funlist_v39 [(0,1),#3.41; (0,2), (&2 * h0); (1,2),(&2)] (&2) 3)`;; + + let terminal_tri_2739661360 = `mk_unadorned_v39 + 3 + (#0.5518 / #2.0 + #0.2) + (funlist_v39 [(0,1),cstab; (0,2),cstab; (1,2),(&2)] (&2) 3) + (funlist_v39 [(0,1), #3.41; (0,2),cstab; (1,2),(&2)] (&2) 3)`;; + + let terminal_tri_4922521904 = `mk_unadorned_v39 + 3 + (#0.5518 / #2.0) + (funlist_v39 [(0,1),cstab; (0,2),(&2)*h0; (1,2),(&2)] (&2) 3) + (funlist_v39 [(0,1),#3.339; (0,2),(&2)*h0; (1,2),(&2)] (&2) 3)`;; + + let ear_stab = `mk_unadorned_v39 + 3 + // (#0.11 + #0.1 *(cstab - sqrt8)) corrected 2013-4-20, see check_completeness djz. + (#0.11) + (funlist_v39 [(0,2),cstab] (&2) 3) + (funlist_v39 [(0,2),cstab] (&2*h0) 3)`;; + + let terminal_ear_3603097872 = ear_cs;; + + let terminal_tri_7881254908 = + `mk_unadorned_v39 3 (#0.696 - #2.0 * #0.11) + (funlist_v39 [(0,1),sqrt8;(1,2),sqrt8] (&2*h0) 3) + (funlist_v39 [(0,1),cstab;(1,2),cstab] (&2*h0) 3)`;; + + *) + + + let scs_3T1 = (* ear_jnull = *) + `scs_v39 (3, #0.11, + funlist_v39 [(0,1),sqrt8] (&2) 3, + funlist_v39 [(0,1),sqrt8] (&2) 3, + funlist_v39 [(0,1),cstab] (&2*h0) 3, + funlist_v39 [(0,1),cstab] ((&2)*h0) 3, + (\i j. F),{},{},{})`;; + + let scs_3T2 = (* terminal_std_tri_OMKYNLT_3336871894 = *) + `mk_unadorned_v39 + 3 + (&0) + (funlist_v39 [] (&2) 3) + (funlist_v39 [] (&2) 3)`;; + + (* 3 new additions 2013-06-04 3T3 3T4 3T5 *) + + let scs_3T3 = (* terminal_tri_4010906068 = *) + `mk_unadorned_v39 3 + (#0.476) + (funlist_v39 [] (&2*h0) 3) + (funlist_v39 [] (cstab) 3)`;; + + let scs_3T4 = (* terminal_tri_6833979866 = *) + `mk_unadorned_v39 3 + (#0.2759) + (funlist_v39 [(0,1),(&2)] (&2*h0) 3) + (funlist_v39 [(0,1),(&2 * h0)] (cstab) 3)`;; + + let scs_3T5 = (* terminal_tri_5541487347 = *) + `mk_unadorned_v39 3 + (#0.103) + (funlist_v39 [(0,1),(&2 * h0)] (&2) 3) + (funlist_v39 [(0,1),(sqrt8)] (&2 * h0) 3)`;; + + let scs_3T6 = (* terminal_tri_5026777310a = *) + `mk_unadorned_v39 3 + (#0.4348) + (funlist_v39 [(0,1),sqrt8;(1,2),sqrt8] (&2) 3) + (funlist_v39 [(0,1),cstab;(1,2),cstab] (&2*h0) 3)`;; + + let scs_3T7 = (* terminal_tri_9269152105 = 2468307358 *) + `mk_unadorned_v39 3 (#0.2565) + (funlist_v39 [(0,1),cstab; (0,2),cstab; (1,2),(&2)] (&2) 3) + (funlist_v39 [(0,1),#3.62; (0,2),cstab; (1,2),(&2)] (&2) 3)`;; + + let terminal_cs = [ + scs_6T1; + scs_5T1; + + (* quad cases *) + scs_4T1; + scs_4T2; + scs_4T3; + scs_4T4; + scs_4T5; + + (* triangle *) + scs_3T1; + scs_3T2; + scs_3T3; + scs_3T4; + scs_3T5; + scs_3T6; + scs_3T7];; + + (* terminal_adhoc_quad_7697147739; *) + + (* upper echelon cases *) + (* + terminal_tri_7720405539; + terminal_tri_2739661360; + scs_3T7; + terminal_tri_4922521904; + *) + + (* J cases + terminal_ear_3603097872; + scs_3T1; + terminal_tri_5405130650; + *) + + (* other triangles + terminal_tri_5026777310a; + terminal_tri_7881254908; + terminal_std_tri_OMKYNLT_3336871894; + terminal_tri_4010906068; + terminal_tri_6833979866; + terminal_tri_5541487347; + *) + + + + + (* nonterminal cases *) + + let ear_cs = + `scs_v39 (3, #0.11, + funlist_v39 [(0,1),sqrt8] (&2) 3, + funlist_v39 [(0,1),sqrt8] (&2) 3, + funlist_v39 [(0,1),cstab] ((&2)*h0) 3, + funlist_v39 [(0,1),cstab] (&2*h0) 3, + funlistA_v39 [(0,1),T] F F 3,{},{},{})`;; + + let terminal_tri_5405130650 = `scs_v39( + 3, + #0.477 - #0.11, + funlist_v39 [(0,1),sqrt8;(0,2),(&2*h0);(1,2),(&2)] (&2) 3, + funlist_v39 [(0,1),sqrt8;(0,2),(&2*h0);(1,2),(&2)] (&2) 3, + funlist_v39 [(0,1),cstab;(0,2),sqrt8;(1,2),(&2*h0)] (&2*h0) 3, + funlist_v39 [(0,1),cstab;(0,2),sqrt8;(1,2),(&2*h0)] (&2*h0) 3, + funlistA_v39 [(0,1),T] F F 3,{},{},{})`;; + + (* + let scs_terminal_v39 = new_definition (mk_eq (`scs_terminal_v39:(scs_v39)list`,(mk_flist terminal_cs)));; + + *) + + + + + + let ZITHLQN_concl = `(!s vv. MEM s s_init_list_v39 /\ vv IN + BBs_v39 s ==> + &0 <= taustar_v39 s vv) ==> JEJTVGB_assume_v39`;; + + (* + let ZITHLQN = prove_by_refinement( + `(!s vv. s IN set_of_list s_init_list_v39 /\ vv IN BBs_v39 s ==> &0 <= taustar_v39 s vv) ==> JEJTVGB_assume_v39`, + (* {{{ proof *) + [ + rt[s_init_list_v39;set_of_list;JEJTVGB_assume_v39] + st/r + conj + st/r + rule (rr [taustar_v39]) + typ `CARD V = 3 \/ CARD V = 4 \/ CARD V = 5 \/ CARD V = 6` (C gthen assume) + repeat (fxast `CARD` mp) then ARITH_TAC + ]);; + (* }}} *) + *) + + let BBprime_v39 = new_definition `BBprime_v39 s vv = (BBs_v39 s vv /\ + (!ww. BBs_v39 s ww ==> taustar_v39 s vv <= taustar_v39 s ww) /\ taustar_v39 s vv < &0)`;; + + let BBindex_v39 = new_definition `BBindex_v39 s (vv:num->real^3) = + CARD { i | i < scs_k_v39 s /\ scs_a_v39 s i (SUC i) = dist(vv i, vv (SUC i)) }`;; + + let BBindex_min_v39 = new_definition `BBindex_min_v39 s = + min_num (IMAGE (BBindex_v39 s) (BBprime_v39 s))`;; + + let BBprime2_v39 = new_definition `BBprime2_v39 s vv <=> + BBprime_v39 s vv /\ BBindex_v39 s vv = BBindex_min_v39 s`;; + + let MMs_v39 = new_definition `MMs_v39 s vv <=> + BBprime2_v39 s vv /\ + (!i. scs_str_v39 s i ==> azim (vec 0) (vv i) (vv (SUC i)) (vv (i + (scs_k_v39 s - 1)) ) = pi) /\ + (!i. scs_lo_v39 s i ==> norm (vv i) = &2) /\ + (!i. scs_hi_v39 s i ==> norm (vv i) = &2 * h0) /\ + (!i j. scs_am_v39 s i j <= dist(vv i,vv j)) /\ + (!i j. dist(vv i,vv j) <= scs_bm_v39 s i j)`;; + + let unadorned_MMs_concl = `!s. + unadorned_v39 s ==> (MMs_v39 s = BBprime2_v39 s)`;; + + let XWITCCN_concl = `!s vv. MEM s s_init_list_v39 /\ vv IN BBs_v39 s /\ + taustar_v39 s vv < &0 ==> ~(BBprime_v39 s = {})`;; + + let XWITCCN2_concl = `!s vv. MEM s s_init_list_v39 /\ vv IN BBs_v39 s /\ + taustar_v39 s vv < &0 ==> ~(BBprime2_v39 s = {})`;; + + let AYQJTMD_concl = `!s vv. MEM s s_init_list_v39 /\ vv IN BBs_v39 s /\ + taustar_v39 s vv < &0 ==> ~(MMs_v39 s = {})`;; + + let EAPGLE_concl = `(!s. MEM s s_init_list_v39 ==> MMs_v39 s = {}) ==> JEJTVGB_assume_v39`;; + + let JKQEWGV1_concl = `!s vv. is_scs_v39 s /\ BBs_v39 s vv /\ taustar_v39 s vv < &0 /\ + 3 < scs_k_v39 s ==> + (sol_local (IMAGE (\i. {vv i, vv (SUC i)}) (:num)) + (IMAGE (\i. (vv i,vv (SUC i))) (:num)) < pi)`;; + + let JKQEWGV2_concl = `!s vv. is_scs_v39 s /\ BBs_v39 s vv /\ taustar_v39 s vv < &0 /\ + 3 < scs_k_v39 s ==> + ( + let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + ~circular V E)`;; + + let JKQEWGV3_concl = `!s vv v w. + (let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + let FF = IMAGE (\i. (vv i,vv (SUC i))) (:num) in + (is_scs_v39 s /\ BBs_v39 s vv /\ taustar_v39 s vv < &0 /\ lunar (v,w) V E /\ + 3 < scs_k_v39 s ==> + (interior_angle1 (vec 0) FF v < pi / &2 )))`;; + + let HFNXPZA_concl = `!s vv. + is_scs_v39 s /\ BBs_v39 s vv /\ taustar_v39 s vv < &0 /\ scs_k_v39 s = 3 ==> + dihV (vec 0) (vv 0) (vv 1) (vv 2) + + dihV (vec 0) (vv 1) (vv 2) (vv 3) + + dihV (vec 0) (vv 2) (vv 3) (vv 1) < &2 * pi`;; + + let restriction_typ1_v39 = new_definition `restriction_typ1_v39 s = + (scs_v39 (scs_k_v39 s,scs_d_v39 s,scs_a_v39 s,scs_am_v39 s,scs_bm_v39 s,scs_bm_v39 s,scs_J_v39 s,scs_lo_v39 s,scs_hi_v39 s,scs_str_v39 s))`;; + + let restriction_typ2_v39 = new_definition `restriction_typ2_v39 s = + (scs_v39 (scs_k_v39 s,scs_d_v39 s,scs_am_v39 s,scs_am_v39 s, + scs_am_v39 s,scs_am_v39 s,scs_J_v39 s,scs_lo_v39 s,scs_hi_v39 s,scs_str_v39 s))`;; + + (* DEPRECATED + let restriction_typ3_v39 = new_definition `restriction_typ3_v39 s i j a b = + ((a <= scs_bm_v39 s i j /\ scs_am_v39 s i j <= b), + (let k = scs_k_v39 s in + let i' = i MOD k in + let j' = j MOD k in + let f = (\i'' j''. { i'' MOD k, j'' MOD k } = {i',j'}) in + let a1 = (\i'' j''. if f i'' j'' then a else scs_a_v39 s i j) in + let b1 = (\i'' j''. if f i'' j'' then b else scs_b_v39 s i j) in + let am = (\i'' j''. if f i'' j'' then max a (scs_am_v39 s i j) else scs_am_v39 s i j) in + let bm = (\i'' j''. if f i'' j'' then min b (scs_bm_v39 s i j) else scs_bm_v39 s i j)in + (scs_v39 (scs_k_v39 s,scs_d_v39 s,a1,am, + bm,b1,scs_J_v39 s,scs_lo_v39 s,scs_hi_v39 s,scs_str_v39 s))))`;; + + let subdivision_v39 = new_definition `subdivision_v39 c i j s = + (let precond = ((scs_a_v39 s i j <= c) /\ c <= scs_b_v39 s i j) in + let r1 = restriction_typ3_v39 s i j (scs_a_v39 s i j) c in + let r2 = restriction_typ3_v39 s i j c (scs_b_v39 s i j) in + let cons_if = (\b r rs. if b then CONS r rs else rs) in + if precond then (cons_if (FST r1) (SND r1) (cons_if (FST r2) (SND r2) [])) else [])`;; + *) + + let restriction_cs1_v39 = new_definition `restriction_cs1_v39 s p q c = + (let b1 = override (scs_b_v39 s) (scs_k_v39 s) (p,q) c in + let bm = if (c < scs_bm_v39 s p q) then + override (scs_bm_v39 s) (scs_k_v39 s) (p,q) c else scs_bm_v39 s in + (scs_v39 (scs_k_v39 s,scs_d_v39 s,scs_a_v39 s,scs_am_v39 s, + bm,b1,scs_J_v39 s,scs_lo_v39 s,scs_hi_v39 s,scs_str_v39 s)))`;; + + let restriction_cs2_v39 = new_definition `restriction_cs2_v39 s p q c = + (let a1 = override (scs_a_v39 s) (scs_k_v39 s) (p,q) c in + let am = if (scs_am_v39 s p q < c) then + override (scs_am_v39 s) (scs_k_v39 s) (p,q) c else scs_am_v39 s in + (scs_v39 (scs_k_v39 s,scs_d_v39 s,a1,am,scs_bm_v39 s,scs_b_v39 s, + scs_J_v39 s,scs_lo_v39 s,scs_hi_v39 s,scs_str_v39 s)))`;; + + let subdiv_v39 = new_definition `subdiv_v39 s p q c = + (if (c <= scs_a_v39 s p q) then [s] + else (if (c <= scs_am_v39 s p q) then [restriction_cs2_v39 s p q c] + else (if (c < scs_bm_v39 s p q) then [restriction_cs1_v39 s p q c;restriction_cs2_v39 s p q c] + else (if (c < scs_b_v39 s p q) then [restriction_cs1_v39 s p q c] + else [s]))))` + + let transfer_v39 = new_definition `transfer_v39 s s' <=> + (is_ear_v39 s ==> (s = s')) /\ + (is_scs_v39 s') /\ + (unadorned_v39 s') /\ + scs_d_v39 s <= scs_d_v39 s' /\ + (scs_k_v39 s' = scs_k_v39 s) /\ + (!i j. scs_a_v39 s' i j <= scs_a_v39 s i j) /\ + (!i j. scs_b_v39 s i j <= scs_b_v39 s' i j) /\ + (!i j. scs_J_v39 s' i j ==> scs_J_v39 s i j) + `;; + + let scs_prop_equ_v39 = new_definition `scs_prop_equ_v39 s i = + (let shift1 = \ (f:num->bool) j. f (i + j) in + let shift2 = \ (f:num->num-> real) j j'. (f (i + j) (i + j')) in + let shift2b = \ (f:num->num-> bool) j j'. (f (i + j) (i + j')) in + (scs_v39 (scs_k_v39 s,scs_d_v39 s,shift2 (scs_a_v39 s),shift2 (scs_am_v39 s),shift2 (scs_bm_v39 s), + shift2 (scs_b_v39 s), shift2b (scs_J_v39 s), shift1 (scs_lo_v39 s) , + shift1 (scs_hi_v39 s), shift1 (scs_str_v39 s))))`;; + + let scs_opp_v39 = new_definition `scs_opp_v39 s = + (let k = scs_k_v39 s in + scs_v39 (scs_k_v39 s,scs_d_v39 s, peropp2 (scs_a_v39 s) k, peropp2 (scs_am_v39 s) k, + peropp2 (scs_bm_v39 s) k,peropp2 (scs_b_v39 s) k, + peropp2 (scs_J_v39 s) k, peropp (scs_lo_v39 s) k, + peropp(scs_hi_v39 s) k, peropp (scs_str_v39 s) k))`;; + + (* 0--(p-1) slice: *) + + (* + let torsor_slice_v39 = new_definition `torsor_slice_v39 s p = + ( + let mod1 = \ (f:num->bool) j. f (j MOD p) in + let mod2 = \ (f:num->num->real) j j'. f (j MOD p) (j' MOD p) in + let mod2b = \ (f:num->num->bool) j j'. f (j MOD p) (j' MOD p) in + (scs_v39 (scs_k_v39 s,scs_d_v39 s,mod2 (scs_a_v39 s),mod2 (scs_am_v39 s),mod2 (scs_bm_v39 s), + mod2 (scs_b_v39 s), mod2b (scs_J_v39 s), mod1 (scs_lo_v39 s) , mod1 (scs_str_v39 s))))`;; + *) + + let scs_diag = new_definition `scs_diag k i j <=> + ~(i MOD k = j MOD k) /\ + ~(SUC i MOD k = j MOD k) /\ + ~(i MOD k = SUC j MOD k)`;; + + + let scs_half_slice_v39 = new_definition `scs_half_slice_v39 s p q d' mkj = + (let p' = p MOD (scs_k_v39 s) in + let k' = (q + 1 + (scs_k_v39 s - p')) MOD (scs_k_v39 s) in + let mod2 = \ (f:num->num->real) j j'. f ((j MOD k')+ p') ((j' MOD k') + p') in + let mod2b = \ (f:num->num->bool) j j'. f ((j MOD k')+ p') ((j' MOD k') + p') in + let a1 = \ i'' j''. if {i'' MOD k',j'' MOD k'} = {0,k'-1} + then scs_am_v39 s p q else mod2 (scs_a_v39 s) i'' j'' in + let b1 = \ i'' j''. if {i'' MOD k',j'' MOD k'} = {0,k'-1} + then scs_bm_v39 s p q else mod2 (scs_b_v39 s) i'' j'' in + let J = \ i'' j''. if {i'' MOD k',j'' MOD k'} = {0,k'-1} then mkj else mod2b (scs_J_v39 s) i'' j'' in + scs_v39 (k',d',a1,a1,b1,b1,J,{},{},{}))`;; + + let scs_slice_v39 = new_definition `scs_slice_v39 s p q d' d'' mkj = + (scs_half_slice_v39 s p q d' mkj, + scs_half_slice_v39 s q p d'' mkj)`;; + + let is_scs_slice_v39 = new_definition `is_scs_slice_v39 s s' s'' p q <=> + (let d' = scs_d_v39 s' in + let d'' = scs_d_v39 s'' in + let mkj = scs_J_v39 s' 0 (scs_k_v39 s' - 1) in + (((s',s'') = scs_slice_v39 s p q d' d'' mkj) /\ + d' < #0.9 /\ + d'' < #0.9 /\ + scs_d_v39 s <= d' + d'' /\ + scs_bm_v39 s p q < &4 /\ + ((scs_k_v39 s = 4) \/ scs_bm_v39 s p q <= cstab) /\ + (mkj ==> (is_ear_v39 s' \/ is_ear_v39 s''))))`;; + + let scs_arrow_v39 = new_definition `scs_arrow_v39 S1 S2 <=> + (!s. s IN S2 ==> is_scs_v39 s) /\ + ((!s. s IN S1 ==> MMs_v39 s = {}) \/ + (?s. s IN S2 /\ ~(MMs_v39 s = {})))`;; + + (* added definitions 2013-06-17 *) + + let xrr = new_definition `xrr y1 y2 y6 = &8 * (&1 - (y1 * y1 + y2*y2 - y6*y6)/(&2* y1 * y2))`;; + + let scs_basic3 = new_definition `scs_basic3 d a01 b01 a02 b02 a12 b12 = + (let a = funlist_v39 [(0,1),a01;(0,2),a02;(1,2),a12] (&0) 3 in + let b = funlist_v39 [(0,1),b01;(0,2),b02;(1,2),b12] (&0) 3 in + mk_unadorned_v39 3 d a b)`;; + + let scs_basic4 = new_definition `scs_basic4 d a01 b01 a02 b02 a03 b03 a12 b12 a13 b13 a23 b23 = + (let a = funlist_v39 [(0,1),a01;(0,2),a02;(0,3),a03;(1,2),a12;(1,3),a13;(2,3),a23] (&0) 4 in + let b = funlist_v39 [(0,1),b01;(0,2),b02;(0,3),b03;(1,2),b12;(1,3),b13;(2,3),b23] (&0) 4 in + mk_unadorned_v39 4 d a b)`;; + + (* renamed from scs_is_basic *) + + + let scs_generic = new_definition `scs_generic v <=> + generic (IMAGE v (:num)) + (IMAGE (\i. {v i, v (SUC i)}) (:num))`;; + + let scs_is_str = new_definition `scs_is_str s vv i <=> ( + azim (vec 0) (vv i) (vv (SUC i)) (vv (i + (scs_k_v39 s - 1)) ) = pi)`;; + + let scs_stab_diag_v39 = new_definition `scs_stab_diag_v39 s i j = + ( + let k = scs_k_v39 s in + let b' = (\i' j'. if psort k (i,j) = psort k (i',j') then cstab else scs_b_v39 s i' j') in + (mk_unadorned_v39 k (scs_d_v39 s) (scs_a_v39 s) b'))`;; + + let scs_basic = new_definition `scs_basic_v39 s <=> + unadorned_v39 s /\ (!i j. scs_J_v39 s i j = F)`;; + + let scs_inj = prove_by_refinement( + `!s s'. scs_basic_v39 s /\ scs_basic_v39 s' /\ + scs_d_v39 s = scs_d_v39 s' /\ + scs_k_v39 s = scs_k_v39 s' /\ + (scs_a_v39 s = scs_a_v39 s') /\ + (scs_b_v39 s = scs_b_v39 s') + ==> (s = s')`, + + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `scs_basic_v39` MP_TAC); + REWRITE_TAC[scs_basic;unadorned_v39]; + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + REWRITE_TAC[SET_RULE `{} = a <=> a = {}`]; + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[GSYM scs_v39]; + AP_TERM_TAC; + ASM_REWRITE_TAC[scs_components]; + TYPIFY `scs_J_v39 s = scs_J_v39 s'` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_REWRITE_TAC[FUN_EQ_THM]); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + + + (* deprecate: only used in Ocbicby.basic_examples: *) + + (* + let is_basic = new_definition `is_basic s <=> + is_scs_v39 s /\ unadorned_v39 s /\ (!i j. scs_J_v39 s i j = F)`;; + *) + + + (* + let mk_simplex = new_definition `mk_simplex v0 v1 v2 x1 x2 x3 x4 x5 x6 = + (let uinv = &1 / ups_x x1 x2 x6 in + let d = delta_x x1 x2 x3 x4 x5 x6 in + let d5 = delta_x5 x1 x2 x3 x4 x5 x6 in + let d6 = delta_x4 x1 x2 x3 x4 x5 x6 in + let vcross = (v1 - v0) cross (v2 - v0) in + v0 + uinv % ((&2 * sqrt d) % vcross + d5 % (v1 - v0) + d6 % (v2 - v0)))`;; + *) + + let mk_simplex1 = new_definition `mk_simplex1 v0 v1 v2 x1 x2 x3 x4 x5 x6 = + (let uinv = &1 / ups_x x1 x2 x6 in + let d = delta_x x1 x2 x3 x4 x5 x6 in + let d5 = delta_x5 x1 x2 x3 x4 x5 x6 in + let d4 = delta_x4 x1 x2 x3 x4 x5 x6 in + let vcross = (v1 - v0) cross (v2 - v0) in + v0 + uinv % ((&2 * sqrt d) % vcross + d5 % (v1 - v0) + d4 % (v2 - v0)))`;; + + let mk_planar2 = new_definition `mk_planar2 v0 v1 v2 x1 x2 x3 x5 x6 s = + (let vcross = (v1 - v0) cross ((v1 - v0) cross (v2 - v0)) in + v0 + ((x1 + x3 - x5) / (&2 * x1)) % (v1 - v0) + + ((s / x1) * sqrt (ups_x x1 x3 x5 / ups_x x1 x2 x6)) % vcross)`;; + + let scs_M = new_definition `scs_M s = + { i | i < scs_k_v39 s /\ (&2 * h0 < scs_b_v39 s i (SUC i) \/ &2 < scs_a_v39 s i (SUC i)) }`;; + + let scs_6I1 = new_definition `scs_6I1 = + mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (&2 * h0)) (cs_adj 6 (&2 * h0) (&6))`;; + + let scs_5I1 = new_definition `scs_5I1 = + mk_unadorned_v39 5 (d_tame 5) (cs_adj 5 (&2) (&2 * h0)) (cs_adj 5 (&2 * h0) (&6))`;; + + let scs_4I1 = new_definition `scs_4I1 = + mk_unadorned_v39 4 (d_tame 4) (cs_adj 4 (&2) (&2 * h0)) (cs_adj 4 (&2 * h0) (&6)) + `;; + + let scs_3I1 = new_definition `scs_3I1 = + mk_unadorned_v39 3 (d_tame 3) (cs_adj 3 (&2) (&2 * h0)) (cs_adj 3 (&2 * h0) (&6)) + `;; + + let scs_5I2 = new_definition `scs_5I2 = + mk_unadorned_v39 5 (#0.616) (cs_adj 5 (&2) (sqrt8)) (cs_adj 5 (&2 * h0) (&6)) + `;; + + let scs_4I2 = new_definition `scs_4I2 = + mk_unadorned_v39 4 (#0.467) (cs_adj 4 (&2) (&3)) (cs_adj 4 (&2 * h0) (&6)) + `;; + + let scs_5I3 = new_definition `scs_5I3 = + mk_unadorned_v39 5 (#0.616) + (funlist_v39 [(0,1),(&2*h0);(0,2),(&2*h0);(0,3),(&2*h0);(1,3),(&2*h0);(1,4),(&2*h0);(2,4),(&2*h0)] (&2) 5) + (funlist_v39 [(0,1),sqrt8;(0,2),(&6);(0,3),(&6);(1,3),(&6);(1,4),(&6);(2,4),(&6)] (&2*h0) 5)`;; + + let scs_4I3 = new_definition `scs_4I3 = + mk_unadorned_v39 4 (#0.477) + (funlist_v39 [(0,1),(&2*h0);(0,2),(sqrt8);(1,3),(sqrt8)] (&2) 4) + (funlist_v39 [(0,1),sqrt8;(0,2),(&6);(1,3),(&6)] (&2*h0) 4)`;; + + (* terminal cases *) + + let scs_6T1 = new_definition + `scs_6T1 = mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (cstab)) (cs_adj 6 (&2) (&6))`;; + + let scs_5T1 = new_definition + `scs_5T1 = mk_unadorned_v39 5 (#0.616) (cs_adj 5 (&2) (cstab)) (cs_adj 5 (&2) (&6))`;; + + let scs_4T1 = (* terminal_adhoc_quad_5691615370 = *) new_definition + `scs_4T1 = mk_unadorned_v39 4 #0.467 (cs_adj 4 (&2) (&3)) + (cs_adj 4 (&2) (&6))`;; + + let scs_4T2 = (* terminal_adhoc_quad_9563139965B = *) new_definition + `scs_4T2 = mk_unadorned_v39 4 (#0.467) (cs_adj 4 (&2) (&3)) (cs_adj 4 (&2*h0) (&3))`;; + + let scs_4T3 = (* terminal_adhoc_quad_4680581274 = *) new_definition + `scs_4T3 = mk_unadorned_v39 4 (#0.513) + (funlist_v39 [(0,1),cstab ; (0,2),cstab ; (1,3),cstab ] (&2) 4) + (funlist_v39 [(0,1),cstab ; (0,2),(&6) ; (1,3),(&6) ] (&2) 4)`;; + + let scs_4T4 = new_definition + `scs_4T4 = mk_unadorned_v39 4 (#0.477) + (funlist_v39 [(0,1),(&2 * h0);(0,2),sqrt8;(1,3),sqrt8] (&2) 4) + (funlist_v39 [(0,1),sqrt8 ;(0,2),(&6); (1,3),cstab] (&2 * h0) 4)`;; + + let scs_4T5 = new_definition + `scs_4T5 = mk_unadorned_v39 4 (#0.513) + (funlist_v39 [(0,1),(&2 * h0);(0,2),cstab;(1,3),cstab] (&2) 4) + (funlist_v39 [(0,1),cstab ;(0,2),(&6); (1,3),cstab] (&2 * h0) 4)`;; + + let scs_3T1_PRELIM = (* ear_jnull = *) new_definition + `scs_3T1 = scs_v39 (3, #0.11, + funlist_v39 [(0,1),sqrt8] (&2) 3, + funlist_v39 [(0,1),sqrt8] (&2) 3, + funlist_v39 [(0,1),cstab] (&2*h0) 3, + funlist_v39 [(0,1),cstab] ((&2)*h0) 3, + (\i j. F),{},{},{})`;; + + let scs_3T1 = prove_by_refinement( + `scs_3T1 = mk_unadorned_v39 3 (#0.11) + (funlist_v39 [(0,1),(sqrt8)] (&2) 3) + (funlist_v39 [(0,1),(cstab)] (&2 * h0) 3)`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[mk_unadorned_v39;scs_3T1_PRELIM]); + ]);; + (* }}} *) + + let scs_3T2 = (* terminal_std_tri_OMKYNLT_3336871894 = *) new_definition + `scs_3T2 = mk_unadorned_v39 + 3 + (&0) + (funlist_v39 [] (&2) 3) + (funlist_v39 [] (&2) 3)`;; + + let scs_3T3 = (* terminal_tri_4010906068 = *) new_definition + `scs_3T3 = mk_unadorned_v39 3 + (#0.476) + (funlist_v39 [] (&2*h0) 3) + (funlist_v39 [] (cstab) 3)`;; + + let scs_3T4 = (* terminal_tri_6833979866 = *) new_definition + `scs_3T4 = mk_unadorned_v39 3 + (#0.2759) + (funlist_v39 [(0,1),(&2)] (&2*h0) 3) + (funlist_v39 [(0,1),(&2 * h0)] (cstab) 3)`;; + + let scs_3T5 = (* terminal_tri_5541487347 = *) new_definition + `scs_3T5 = mk_unadorned_v39 3 + (#0.103) + (funlist_v39 [(0,1),(&2 * h0)] (&2) 3) + (funlist_v39 [(0,1),(sqrt8)] (&2 * h0) 3)`;; + + let scs_3T6 = (* terminal_tri_5026777310a = *) new_definition + `scs_3T6' = mk_unadorned_v39 3 + (#0.4348) + (funlist_v39 [(0,1),sqrt8;(1,2),sqrt8] (&2) 3) + (funlist_v39 [(0,1),cstab;(1,2),cstab] (&2*h0) 3)`;; + + let scs_3T7 = (* terminal_tri_9269152105 = 2468307358 *) new_definition + `scs_3T7 = mk_unadorned_v39 3 (#0.2565) + (funlist_v39 [(0,1),cstab; (0,2),cstab; (1,2),(&2)] (&2) 3) + (funlist_v39 [(0,1),#3.62; (0,2),cstab; (1,2),(&2)] (&2) 3)`;; + + let scs_6M1 = new_definition `scs_6M1 = + mk_unadorned_v39 6 (d_tame 6) (cs_adj 6 (&2) (cstab)) (cs_adj 6 (&2 * h0) (&6))`;; + + let scs_5M1 = new_definition + `scs_5M1 = mk_unadorned_v39 5 (#0.616) + (funlist_v39 [(0,1),(&2*h0);(0,2),(&2*h0);(0,3),(&2*h0);(1,3),(&2*h0);(1,4),(&2*h0);(2,4),(&2*h0)] (&2) 5) + (funlist_v39 [(0,1),cstab; (0,2),(&6); (0,3),(&6); (1,3),(&6); (1,4),(&6); (2,4),(&6)] (&2*h0) 5)`;; + + let scs_5M2 = new_definition + `scs_5M2 = mk_unadorned_v39 5 (#0.616) + (funlist_v39 [(0,1),(&2);(0,2),(cstab);(0,3),(cstab);(1,3),(cstab);(1,4),(cstab);(2,4),(cstab)] (&2) 5) + (funlist_v39 [(0,1),cstab;(0,2),(&6); (0,3),(&6); (1,3),(&6); (1,4),(&6); (2,4),(&6)] (&2*h0) 5)`;; + + let scs_4M1 = new_definition + `scs_4M1 = mk_unadorned_v39 4 (#0.3401) + (funlist_v39 [(0,1),(&2*h0);(0,2),(&2*h0);(1,3),(&2*h0)] (&2) 4) + (funlist_v39 [(0,1),cstab;(0,2),(&6);(1,3),(&6)] (&2*h0) 4)`;; + + let scs_4M2 = new_definition + `scs_4M2 = mk_unadorned_v39 4 (#0.3789) + (funlist_v39 [(0,1),(&2*h0);(0,2),(&2*h0);(1,3),(&2*h0)] (&2) 4) + (funlist_v39 [(0,1),cstab;(0,2),(&6);(1,3),(&6)] (&2*h0) 4)`;; + + (* + let scs_4M3' = new_definition + `scs_4M3' = mk_unadorned_v39 4 (#0.503) + (funlist_v39 [(0,1),(sqrt8);(0,2),(sqrt8);(1,3),(sqrt8)] (&2) 4) + (funlist_v39 [(0,1),cstab;(0,2),(&6);(1,3),(&6)] (&2*h0) 4)`;; + + let scs_4M4 = new_definition + `scs_4M4 = mk_unadorned_v39 4 (#0.503) + (funlist_v39 [(0,1),(&2*h0);(1,2),(&2*h0);(0,2),(&2*h0);(1,3),(&2*h0)] (&2) 4) + (funlist_v39 [(0,1),cstab;(1,2),cstab;(0,2),(&6);(1,3),(&6)] (&2*h0) 4)`;; + + let scs_4M5 = new_definition + `scs_4M5 = mk_unadorned_v39 4 (#0.503) + (funlist_v39 [(0,1),(&2*h0);(2,3),(&2*h0);(0,2),(&2*h0);(1,3),(&2*h0)] (&2) 4) + (funlist_v39 [(0,1),cstab;(2,3),cstab;(0,2),(&6);(1,3),(&6)] (&2*h0) 4)`;; + + let scs_4M6 = new_definition + `scs_4M6 = mk_unadorned_v39 4 (#0.503) + (funlist_v39 [(0,1),(&2*h0);(0,2),(cstab);(1,3),(cstab)] (&2) 4) + (funlist_v39 [(0,1),cstab;(0,2),(&6);(1,3),(&6)] (&2*h0) 4)`;; + *) + + let scs_4M3 = new_definition + `scs_4M3' = mk_unadorned_v39 4 (#0.513) + (funlist_v39 [(0,1),(sqrt8);(0,2),(sqrt8);(1,3),(sqrt8)] (&2) 4) + (funlist_v39 [(0,1),cstab;(0,2),(&6);(1,3),(&6)] (&2*h0) 4)`;; + + let scs_4M4 = new_definition + `scs_4M4' = mk_unadorned_v39 4 (#0.513) + (funlist_v39 [(0,1),(&2*h0);(1,2),(&2*h0);(0,2),(&2*h0);(1,3),(&2*h0)] (&2) 4) + (funlist_v39 [(0,1),cstab;(1,2),cstab;(0,2),(&6);(1,3),(&6)] (&2*h0) 4)`;; + + let scs_4M5 = new_definition + `scs_4M5' = mk_unadorned_v39 4 (#0.513) + (funlist_v39 [(0,1),(&2*h0);(2,3),(&2*h0);(0,2),(&2*h0);(1,3),(&2*h0)] (&2) 4) + (funlist_v39 [(0,1),cstab;(2,3),cstab;(0,2),(&6);(1,3),(&6)] (&2*h0) 4)`;; + + let scs_4M6 = new_definition + `scs_4M6' = mk_unadorned_v39 4 (#0.513) + (funlist_v39 [(0,1),(&2*h0);(0,2),(cstab);(1,3),(cstab)] (&2) 4) + (funlist_v39 [(0,1),cstab;(0,2),(&6);(1,3),(&6)] (&2*h0) 4)`;; + + let scs_4M7 = new_definition + `scs_4M7 = mk_unadorned_v39 4 (#0.513) + (funlist_v39 [(0,1),(&2*h0);(1,2),(&2*h0);(0,2),(cstab);(1,3),(cstab)] (&2) 4) + (funlist_v39 [(0,1),cstab;(1,2),cstab;(0,2),(&6);(1,3),(&6);(1,3),(&6)] (&2*h0) 4)`;; + + let scs_4M8 = new_definition + `scs_4M8 = mk_unadorned_v39 4 (#0.513) + (funlist_v39 [(0,1),(&2*h0);(2,3),(&2*h0);(0,2),(cstab);(1,3),(cstab)] (&2) 4) + (funlist_v39 [(0,1),cstab;(2,3),cstab;(0,2),(&6);(1,3),(&6);(1,3),(&6)] (&2*h0) 4)`;; + + let scs_3M1 = new_definition + `scs_3M1 = mk_unadorned_v39 3 (#0.103) + (funlist_v39 [(0,1),(&2 * h0)] (&2) 3) + (funlist_v39 [(0,1),(cstab)] (&2 * h0) 3)`;; + + + (* Some conclusions *) + + let QKNVMLB1_concl = `!s p q d' mkj vv. + (let s' = scs_half_slice_v39 s p q d' mkj in + let vv' = (\i. vv ((i+p) MOD (scs_k_v39 s'))) in + MMs_v39 s vv /\ + scs_bm_v39 s p q < &4 /\ + ((scs_k_v39 s = 4) \/ scs_bm_v39 s p q <= cstab) /\ + is_scs_v39 s /\ d' < #0.9 /\ scs_diag (scs_k_v39 s) p q ==> + BBs_v39 s' vv')`;; + + let QKNVMLB2_concl = `!s p q d' d'' mkj vv. + (let s' = FST (scs_slice_v39 s p q d' d'' mkj) in + let s'' = SND (scs_slice_v39 s p q d' d'' mkj) in + let vv' = (\i. vv ((i+p) MOD (scs_k_v39 s'))) in + let vv'' = (\i. vv ((i+q) MOD (scs_k_v39 s''))) in + MMs_v39 s vv /\ + is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q /\ + is_scs_slice_v39 s s' s'' p q /\ + scs_d_v39 s <= d' + d'' ==> + dsv_v39 s vv <= dsv_v39 s' vv' + dsv_v39 s'' vv'')`;; + + let QKNVMLB3_concl = `!s p q d' d'' mkj vv. + (let s' = FST (scs_slice_v39 s p q d' d'' mkj) in + let s'' = SND (scs_slice_v39 s p q d' d'' mkj) in + let vv' = (\i. vv ((i+p) MOD (scs_k_v39 s'))) in + let vv'' = (\i. vv ((i+q) MOD (scs_k_v39 s''))) in + MMs_v39 s vv /\ + is_scs_v39 s /\ scs_diag (scs_k_v39 s) p q /\ + is_scs_slice_v39 s s' s'' p q /\ + scs_d_v39 s <= d' + d'' ==> + taustar_v39 s' vv' + taustar_v39 s'' vv'' <= taustar_v39 s vv)`;; + + (* AZGJNZO *) + + + let FZIOTEF_REFL = prove_by_refinement( + `!S. (!s. s IN S ==> is_scs_v39 s) ==> scs_arrow_v39 S S`, + (* {{{ proof *) + [ + REWRITE_TAC[scs_arrow_v39]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + + let FZIOTEF_TRANS = prove_by_refinement( + `!S1 S2 S3. scs_arrow_v39 S1 S2 /\ scs_arrow_v39 S2 S3 ==> + scs_arrow_v39 S1 S3`, + (* {{{ proof *) + [ + REWRITE_TAC[scs_arrow_v39]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + + let EQTTNZI1_concl = `!s. is_scs_v39 s /\ + (!i j. scs_J_v39 s i j ==> scs_b_v39 s i j = scs_bm_v39 s i j) /\ + (scs_J_v39 s = (\i j. F) \/ 3 < scs_k_v39 s) + ==> scs_arrow_v39 {s} {restriction_typ1_v39 s}`;; + + let EQTTNZI2_concl = `!s t. is_scs_v39 s /\ + (scs_am_v39 s = scs_bm_v39 s) /\ + (t = restriction_typ2_v39 s) /\ (!i j. ~scs_J_v39 s i j) /\ + (!i. scs_am_v39 s i i = &0) /\ + CARD { i | i < scs_k_v39 t /\ (&2 * h0 < scs_b_v39 t i (SUC i) \/ &2 < scs_a_v39 t i (SUC i)) } + scs_k_v39 t <= 6 + ==> scs_arrow_v39 {s} {t}`;; + + let UAGHHBM_concl = `!s i j c . + (let k = scs_k_v39 s in + (is_scs_v39 s /\ + scs_a_v39 s i j <= c /\ c <= scs_b_v39 s i j /\ + 3 < k /\ + ~(i MOD k = j MOD k) /\ + ~(scs_J_v39 s i j) /\ + ((j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) ==> (~(c = scs_am_v39 s i j))) /\ + ((j MOD k = SUC i MOD k) \/ (SUC j MOD k = i MOD k) ==> (&2 < scs_a_v39 s i j \/ &2 * h0 < scs_b_v39 s i j)) + ==> + scs_arrow_v39 {s} (set_of_list (subdiv_v39 s i j c))))`;; + + let YXIONXL1_concl = `!s t. + is_scs_v39 s /\ + transfer_v39 s t ==> scs_arrow_v39 {s} {t}`;; + + let YXIONXL2_concl = `!s. + is_scs_v39 s ==> scs_arrow_v39 {s} {scs_opp_v39 s}`;; + + let YXIONXL3_concl = `!s i. + is_scs_v39 s ==> scs_arrow_v39 {s} {scs_prop_equ_v39 s i}`;; + + let LKGRQUI_concl = `!s s' s'' p q d' d'' mkj. + is_scs_v39 s /\ (s',s'') = scs_slice_v39 s p q d' d'' mkj ==> scs_arrow_v39 {s} {s',s''}`;; + + let HXHYTIJ_concl = `!s vv ww. + is_scs_v39 s /\ + BBprime2_v39 s vv /\ + BBs_v39 s ww ==> + (taustar_v39 s vv < taustar_v39 s ww \/ + BBindex_v39 s vv <= BBindex_v39 s ww)`;; + + let ODXLSTCv2_concl = `!s k w l. + is_scs_v39 s /\ + MMs_v39 s w /\ + k = scs_k_v39 s /\ + 3 < k /\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + ~(&2 = norm (w l)) /\ + (!i. ~(i MOD k = l MOD k) ==> scs_a_v39 s l i < dist(w l,w i)) /\ + (!i. ~(scs_J_v39 s l i)) /\ + (!V E v. + V = IMAGE w (:num) /\ + E = IMAGE (\i. {w i, w (SUC i)}) (:num) ==> + ~(lunar (v,(w l)) V E )) ==> F`;; + + let IMJXPHRv2_concl = `!s k w l. + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ + k = scs_k_v39 s /\ + 3 < k /\ + ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ + (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ + + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + ~(&2 = norm (w l)) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist(w l,w i)) /\ + (!i. ~(scs_J_v39 s l i)) /\ + (!V E v. + V = IMAGE w (:num) /\ + E = IMAGE (\i. {w i, w (SUC i)}) (:num) ==> + ~(lunar (v,(w l)) V E )) ==> + (scs_a_v39 s l (SUC l) = dist (w l, w (SUC l)) /\ + (scs_a_v39 s l (l + (k-1)) = dist (w l, w (l + (k-1)))))`;; + + let NUXCOEAv2_concl = `!s k w l j. + is_scs_v39 s /\ + MMs_v39 s w /\ + azim (vec 0) (w l) (w (SUC l)) (w (l + (scs_k_v39 s - 1)) ) = pi /\ + ~(collinear {vec 0,w (SUC l),w (l + (scs_k_v39 s - 1)) })/\ + (w l) IN aff_gt {vec 0} {w (SUC l),w (l + (scs_k_v39 s - 1)) }/\ + k = scs_k_v39 s /\ + 3 < k /\ + (j MOD k = SUC l MOD k \/ SUC j MOD k = l MOD k) /\ + (scs_a_v39 s j l = dist(w j,w l)) /\ + (scs_a_v39 s j l < scs_b_v39 s j l) /\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) /\ + (!i. scs_diag k l i ==> scs_a_v39 s l i < dist(w l,w i)) /\ + (!i. ~(scs_J_v39 s l i)) /\ + (!V E v. + V = IMAGE w (:num) /\ + E = IMAGE (\i. {w i, w (SUC i)}) (:num) ==> + ~(lunar (v,(w l)) V E )) ==> + (scs_a_v39 s l (SUC l) = dist (w l, w (SUC l)) /\ + (scs_a_v39 s l (l + (k-1)) = dist (w l, w (l + (k-1)))))`;; + + + (* + let deform_ODXLSTC_concl = `!s k l. + is_scs_v39 s /\ + ~(MMs_v39 s = {}) /\ + k = scs_k_v39 s /\ + 3 < k /\ + (!i. ~(scs_J_v39 s l i)) /\ + ~(scs_lo_v39 s l) /\ + (!j. ~(j MOD k = l MOD k) ==> scs_a_v39 s j l < scs_bm_v39 s j l) /\ + (!i. scs_diag k l i ==> &4 * h0 < scs_b_v39 s l i) + ==> + scs_arrow_v39 {s} + ({(scs_v39 (scs_k_v39 s,scs_d_v39 s,scs_a_v39 s,scs_am_v39 s,scs_bm_v39 s, + scs_b_v39 s, scs_J_v39 s, {j | j MOD k = l} UNION scs_lo_v39 s , + scs_hi_v39 s, scs_str_v39 s))} UNION + (IMAGE (\j. (scs_v39 (scs_k_v39 s,scs_d_v39 s,scs_a_v39 s,scs_am_v39 s, + (\i i'. if {i MOD k,i' MOD k} = {j MOD k,l MOD k} then scs_a_v39 s j l + else scs_bm_v39 s i i'), scs_b_v39 s,scs_J_v39 s, scs_lo_v39 s , scs_hi_v39 s, scs_str_v39 s))) + {j | ~(j = l) /\ j < scs_k_v39 s /\ (scs_a_v39 s l j = scs_am_v39 s l j) })) + `;; + + let deform_IMJXPHR_concl = `!s k p0 p1 p2. + is_scs_v39 s /\ + k = scs_k_v39 s /\ + 3 < k /\ + p1 = p0 + 1 /\ + p2 = p0 + 2 /\ + scs_str_v39 s p1 /\ + ~(scs_J_v39 s p0 p1) /\ + ~(scs_J_v39 s p1 p2) /\ + ~(scs_lo_v39 s p1) /\ + (!i. scs_diag k p1 i ==> &4 * h0 < scs_b_v39 s p1 i) /\ + (!i. scs_diag k p1 i ==> ~(scs_a_v39 s p1 i = scs_bm_v39 s p1 i)) /\ + (?q0 q2. ({p0,p2} = {q0,q2}) /\ + scs_a_v39 s p1 q0 = scs_bm_v39 s p1 q0 /\ + ~(scs_a_v39 s p1 q2 = scs_bm_v39 s p1 q2)) ==> + scs_arrow_v39 {s} + ({(scs_v39 (scs_k_v39 s,scs_d_v39 s,scs_a_v39 s,scs_am_v39 s,scs_bm_v39 s, + scs_b_v39 s, scs_J_v39 s, + {j | j MOD k = p1} UNION scs_lo_v39 s , scs_hi_v39 s, scs_str_v39 s))} UNION + (IMAGE (\j. (scs_v39 (scs_k_v39 s,scs_d_v39 s,scs_a_v39 s,scs_am_v39 s, + (\i i'. if {i MOD k,i' MOD k} = {j MOD k,p1 MOD k} then scs_a_v39 s j p1 + else scs_bm_v39 s i i'), scs_b_v39 s,scs_J_v39 s, scs_lo_v39 s , scs_hi_v39 s,scs_str_v39 s))) + {j | ~(j = p1) /\ j < scs_k_v39 s /\ (scs_a_v39 s p1 j = scs_am_v39 s p1 j) }))`;; + + let deform_NUXCOEA_concl = `!s k p0 p1 p2 p'. + is_scs_v39 s /\ + k = scs_k_v39 s /\ + 3 < k /\ + p1 = p0 + 1 /\ + p2 = p0 + 2 /\ + scs_str_v39 s p1 /\ + ~(scs_J_v39 s p0 p1) /\ + ~(scs_J_v39 s p1 p2) /\ + (!i. scs_diag k p1 i ==> &4 * h0 < scs_b_v39 s p1 i) /\ + (!i. scs_diag k p1 i ==> ~(scs_a_v39 s p1 i = scs_bm_v39 s p1 i)) /\ + (?p''. ({p0,p2} = {p',p''}) /\ + scs_a_v39 s p1 p' = scs_bm_v39 s p1 p' /\ + ~(scs_a_v39 s p1 p'' = scs_bm_v39 s p1 p'')) ==> + scs_arrow_v39 {s} + (IMAGE (\j. (scs_v39 (scs_k_v39 s,scs_d_v39 s,scs_a_v39 s,scs_am_v39 s, + (\i i'. if {i MOD k,i' MOD k} = {j MOD k,p1 MOD k} then scs_a_v39 s j p1 + else scs_bm_v39 s i i'), scs_b_v39 s,scs_J_v39 s, scs_lo_v39 s , scs_hi_v39 s,scs_str_v39 s))) + {j | ~(j = p1) /\ ~(j = p') /\ j < scs_k_v39 s /\ (scs_a_v39 s p1 j = scs_am_v39 s p1 j) })`;; + + let deform_2065952723_A1_single = `!s k p1 p2 p'. + is_scs_v39 s /\ + k = scs_k_v39 s /\ + p2 = p1 + 1 /\ + arcmax_v39 s (p1,p2) < arc1553_v39 /\ + ~(scs_J_v39 s p1 p2) /\ + ~(scs_str_v39 s p1) /\ + ~(scs_str_v39 s p2) /\ + (!i. scs_diag k p1 i ==> &4 * h0 < scs_b_v39 s p1 i) /\ + (!i. scs_diag k p1 i ==> ~(scs_a_v39 s p1 i = scs_bm_v39 s p1 i)) /\ + ~(scs_a_v39 s p1 p2 = scs_bm_v39 s p1 p2) /\ + ~(scs_b_v39 s p1 p2 = scs_am_v39 s p1 p2) /\ + (?p''. ({p0,p2} = {p',p''}) /\ + scs_a_v39 s p1 p' = scs_bm_v39 s p1 p' /\ + ~(scs_a_v39 s p1 p'' = scs_bm_v39 s p1 p'')) ==> + scs_arrow_v39 {s} + ({(scs_v39 (scs_k_v39 s,scs_d_v39 s,scs_a_v39 s,scs_am_v39 s,scs_bm_v39 s, + scs_b_v39 s,scs_J_v39 s, + ({j | j MOD k = p1 MOD k} UNION scs_lo_v39 s) , scs_hi_v39 s,scs_str_v39 s)), + (scs_v39 (scs_k_v39 s,scs_d_v39 s,scs_a_v39 s,scs_am_v39 s,scs_bm_v39 s, + scs_b_v39 s,scs_J_v39 s, + ({j | j MOD k = p2 MOD k} UNION scs_lo_v39 s) , scs_hi_v39 s,scs_str_v39 s))} + UNION + (IMAGE (\j. (scs_v39 (scs_k_v39 s,scs_d_v39 s,scs_a_v39 s,scs_am_v39 s, + (\i i'. if {i MOD k,i' MOD k} = {j MOD k,p1 MOD k} then scs_a_v39 s j p1 + else scs_bm_v39 s i i'), scs_b_v39 s,scs_J_v39 s, scs_lo_v39 s , scs_hi_v39 s, scs_str_v39 s))) + {j | j < scs_k_v39 s /\ (scs_a_v39 s p1 j = scs_am_v39 s p1 j) }) + UNION + (IMAGE (\j. (scs_v39 (scs_k_v39 s,scs_d_v39 s,scs_a_v39 s,scs_am_v39 s, + (\i i'. if {i MOD k,i' MOD k} = {j MOD k,p1 MOD k} then scs_a_v39 s j p1 + else scs_bm_v39 s i i'), scs_b_v39 s,scs_J_v39 s, scs_lo_v39 s , scs_hi_v39 s,scs_str_v39 s))) + {j | ~(j = p1) /\ ~(j = p') /\ j < scs_k_v39 s /\ (scs_a_v39 s p1 j = scs_am_v39 s p1 j) }))`;; + *) + + + (* new material 2013-06-17 *) + + + let DRNDRDV_concl = `!y1 y2 y6. + derived_form (&0 < y1 /\ &0 < y2) + (\q. xrr y1 y2 q) ((&8 * y6) / (y1 * y2)) y6 (:real)`;; + + let TBRMXRZ1_concl = `!f f' g h' x y. + derived_form T f f' y (:real) /\ + derived_form T (f o g) h' x (:real) /\ + g x = y ==> re_eqvl f' h'`;; + + (* + let PQCSXWG1_concl = `!v0 v1 v2 v3 x1 x2 x3 x4 x5 x6. + &0 < x1 /\ &0 < x2 /\ &0 < x3 /\ &0 < x4 /\ &0 < x5 /\ &0 < x6 /\ + ~collinear {v0,v1,v2} /\ + x1 = dist(v1,v0) pow 2 /\ + x2 = dist(v2,v0) pow 2 /\ + x6 = dist(v1,v2) pow 2 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 /\ + v3 = mk_simplex v0 v1 v2 x1 x2 x3 x4 x5 x6 ==> + (x3 = dist(v3,v0) pow 2 /\ + x5 = dist(v3,v1) pow 2 /\ + x4 = dist(v3,v2) pow 2 /\ + (v1 - v0) dot ((v2 - v0) cross (v3 - v0)) > &0)`;; + + (* some other continuities might be needed *) + + let PQCSXWG2_concl = `!(v0:real^3) v1 v2 v3 x1 x2 x3 x4 x5 x6. + &0 < x1 /\ &0 < x2 /\ &0 < x3 /\ &0 < x4 /\ &0 < x5 /\ &0 < x6 /\ + ~collinear {v0,v1,v2} /\ + x1 = dist(v1,v0) pow 2 /\ + x2 = dist(v2,v0) pow 2 /\ + x6 = dist(v1,v2) pow 2 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 /\ + v3 = mk_simplex v0 v1 v2 x1 x2 x3 x4 x5 x6 ==> + (\q. mk_simplex v0 v1 v2 x1 x2 x3 x4 q x6) continuous atreal x5`;; + *) + + let PQCSXWG1_concl = `!v0 v1 v2 v3 x1 x2 x3 x4 x5 x6. + &0 < x1 /\ &0 < x2 /\ &0 < x3 /\ &0 < x4 /\ &0 < x5 /\ &0 < x6 /\ + ~collinear {v0,v1,v2} /\ + x1 = dist(v1,v0) pow 2 /\ + x2 = dist(v2,v0) pow 2 /\ + x6 = dist(v1,v2) pow 2 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 /\ + v3 = mk_simplex1 v0 v1 v2 x1 x2 x3 x4 x5 x6 ==> + (x3 = dist(v3,v0) pow 2 /\ + x5 = dist(v3,v1) pow 2 /\ + x4 = dist(v3,v2) pow 2 /\ + (v1 - v0) dot ((v2 - v0) cross (v3 - v0)) > &0)`;; + + let PQCSXWG2_concl = `!(v0:real^3) v1 v2 v3 x1 x2 x3 x4 x5 x6. + &0 < x1 /\ &0 < x2 /\ &0 < x3 /\ &0 < x4 /\ &0 < x5 /\ &0 < x6 /\ + ~collinear {v0,v1,v2} /\ + x1 = dist(v1,v0) pow 2 /\ + x2 = dist(v2,v0) pow 2 /\ + x6 = dist(v1,v2) pow 2 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 /\ + v3 = mk_simplex1 v0 v1 v2 x1 x2 x3 x4 x5 x6 ==> + (\q. mk_simplex1 v0 v1 v2 x1 x2 x3 x4 q x6) continuous atreal x5`;; + + let EYYPQDW_concl = `!v0 v1 v2 v3 x1 x2 x3 x5 x6 s. + &0 < x1 /\ &0 < x2 /\ &0 < x3 /\ &0 < x5 /\ &0 < x6 /\ + ~collinear {v0,v1,v2} /\ + x1 = dist(v1,v0) pow 2 /\ + x2 = dist(v2,v0) pow 2 /\ + x6 = dist(v1,v2) pow 2 /\ + &0 < ups_x x1 x3 x5 /\ + (s = &1 \/ s = -- &1) /\ + v3 = mk_planar2 v0 v1 v2 x1 x2 x3 x5 x6 s ==> + (coplanar {v0,v1,v2,v3} /\ + x3 = dist(v3,v0) pow 2 /\ + x5 = dist(v3,v1) pow 2 /\ + ?t. &0 < t /\ + t % ((v3- v0) cross (v1- v0)) = ( s % ((v1 - v0) cross (v2 - v0))))`;; + + let EYYPQDW2_concl = `!(v0:real^3) v1 v2 x1 x2 x3 x5 x6 s. + &0 < x1 /\ &0 < x2 /\ &0 < x3 /\ &0 < x5 /\ &0 < x6 /\ + ~collinear {v0,v1,v2} /\ + x1 = dist(v1,v0) pow 2 /\ + x2 = dist(v2,v0) pow 2 /\ + x6 = dist(v1,v2) pow 2 /\ + &0 < ups_x x1 x3 x5 ==> + (\q. mk_planar v0 v1 v2 x1 x2 q x5 x6 s) continuous atreal x3`;; + + let EYYPQDW3_concl = `!(v0:real^3) v1 v2 x1 x2 x3 x5 x6 s. + &0 < x1 /\ &0 < x2 /\ &0 < x3 /\ &0 < x5 /\ &0 < x6 /\ + ~collinear {v0,v1,v2} /\ + x1 = dist(v1,v0) pow 2 /\ + x2 = dist(v2,v0) pow 2 /\ + x6 = dist(v1,v2) pow 2 /\ + &0 < ups_x x1 x3 x5 ==> + (\q. mk_planar v0 v1 q x1 x2 x3 x5 x6 s) continuous at v2`;; + + let FEKTYIY_concl = `!s v. + is_scs_v39 s /\ v IN MMs_v39 s /\ 3 < scs_k_v39 s ==> + ~coplanar ({vec 0} UNION IMAGE v (:num))`;; + + let AURSIPD_concl = `!s v. 3 < scs_k_v39 s /\ + is_scs_v39 s /\ scs_generic v /\ v IN MMs_v39 s ==> + 3 + CARD { i | i < scs_k_v39 s /\ scs_is_str s vv i} <= scs_k_v39 s`;; + + let PPBTYDQ_concl = `!(u:real^3) v p. ~collinear {vec 0,v,p} /\ ~collinear {vec 0,u,p} /\ + arcV (vec 0) u p + arcV (vec 0) p v < pi ==> ~(vec 0 IN conv {u,v})`;; + + let MXQTIED_concl = `!s s' v. + is_scs_v39 s /\ is_scs_v39 s' /\ scs_basic_v39 s /\ scs_basic_v39 s' /\ + scs_M s = scs_M s' /\ scs_k_v39 s = scs_k_v39 s' /\ + v IN MMs_v39 s /\ v IN BBs_v39 s' /\ scs_d_v39 s = scs_d_v39 s' /\ + (!i. scs_a_v39 s' i (SUC i) = scs_a_v39 s i (SUC i)) /\ + (!i j. scs_a_v39 s i j <= scs_a_v39 s' i j /\ scs_b_v39 s' i j <= scs_b_v39 s i j) ==> + v IN MMs_v39 s'`;; + + let SYNQIWN_concl = `!s v i. + is_scs_v39 s /\ v IN BBs_v39 s /\ + (norm (v i) = &2 \/ dist(v i,v (i+1)) = &2) /\ + (norm (v (i+2)) = &2 \/ dist(v (i+1),v(i+2)) = &2) /\ + cstab <= dist(v i,v(i+2)) ==> + pi/ &2 < azim (vec 0) (v (i+1)) (v (i+2)) (v i)`;; + + let XWNHLMD_concl = `!s s' v. + is_scs_v39 s /\ is_scs_v39 s' /\ scs_basic_v39 s /\ scs_basic_v39 s' /\ + scs_k_v39 s = scs_k_v39 s' /\ + v IN MMs_v39 s /\ v IN BBs_v39 s' ==> + scs_arrow_v39 {s} {s'}`;; + + let OIQKKEP_concl = `!u v c. + u IN ball_annulus /\ v IN ball_annulus /\ c < &4 /\ &2 <= dist(u,v) /\ dist(u,v) <= c ==> + arcV (vec 0) u v <= arclength (&2) (&2) c`;; + + let AXJRPNC_concl = `!s (v:num->real^3) i j. + is_scs_v39 s /\ scs_basic_v39 s /\ + MMs_v39 s v /\ + (!i. scs_b_v39 s i (SUC i) <= cstab) /\ + (lunar (v i,v j) (IMAGE v (:num)) + (IMAGE (\i. {v i, v (SUC i)}) (:num)) ) ==> + (scs_k_v39 s = 6 /\ v j = v (i + 3))`;; + + let RRCWNSJ_concl = `!s (v:num->real^3). + is_scs_v39 s /\ scs_basic_v39 s /\ 3 < scs_k_v39 s /\ + MMs_v39 s v /\ + (!i j. scs_diag (scs_k_v39 s) i j ==> &4 * h0 < scs_b_v39 s i j) /\ + (!i j. scs_diag (scs_k_v39 s) i j ==> (scs_a_v39 s i j <= cstab /\ cstab < dist(v i, v j))) /\ + (!i. scs_b_v39 s i (SUC i) <= cstab) ==> + scs_generic v`;; + + let JCYFMRP_concl = `!s (v:num->real^3). + is_scs_v39 s /\ v IN MMs_v39 s /\ scs_generic v /\ scs_basic_v39 s /\ + (!i j. scs_diag (scs_k_v39 s) i j ==> &4 * h0 < scs_b_v39 s i j) /\ + CARD (scs_M s) <= 1 /\ 3 < scs_k_v39 s /\ + (!i. scs_a_v39 s i (SUC i) = &2) /\ + (!i j. scs_diag (scs_k_v39 s) i j ==> (scs_a_v39 s i j <= cstab /\ cstab < dist(v i, v j))) ==> + (?i. dist(v i, v (i+1)) = &2)`;; + + let TFITSKC_concl = `!s (v:num->real^3) i. + is_scs_v39 s /\ 3 < scs_k_v39 s /\ v IN MMs_v39 s /\ scs_generic v /\ scs_basic_v39 s /\ + scs_a_v39 s (i+1) (i+2) = &2 /\ scs_b_v39 s (i+1) (i+2) = &2 * h0 /\ + dist(v i,v (i+1)) = &2 /\ + (!i j. scs_diag (scs_k_v39 s) i j ==> (scs_a_v39 s i j <= cstab /\ cstab < dist(v i, v j)) /\ + &4 * h0 < scs_b_v39 s i j) /\ + &2 < scs_b_v39 s i (i+1) /\ scs_a_v39 s (i+2) (i+3) < scs_b_v39 s (i+2) (i+3) ==> + dist(v (i+1),v(i+2)) = &2`;; + + + (* 3 < k, aij < bij *) + + let CQAOQLR_concl = + `!s (v:num->real^3) i. + is_scs_v39 s /\ v IN MMs_v39 s /\ scs_generic v /\ scs_basic_v39 s /\ + (!i j. scs_diag (scs_k_v39 s) i j ==> (scs_a_v39 s i j <= cstab /\ cstab < dist(v i, v j))) ==> + scs_a_v39 s (i) (i+1) = &2 /\ scs_b_v39 s (i) (i+1) = &2 * h0 /\ + scs_a_v39 s (i+1) (i+2) = &2 /\ scs_b_v39 s (i+1) (i+2) = &2 * h0 ==> + (dist(v i,v (i+1)) = &2 <=> dist(v(i+1),v(i+2)) = &2)`;; + + let JLXFDMJ_concl = `!s (v:num->real^3) i. + is_scs_v39 s /\ v IN MMs_v39 s /\ scs_generic v /\ scs_basic_v39 s /\ + dist(v i,v (i+1)) = &2 /\ + (!i j. scs_diag (scs_k_v39 s) i j ==> &4 * h0 < scs_b_v39 s i j) /\ + CARD (scs_M s) <= 1 /\ + (!i j. scs_diag (scs_k_v39 s) i j ==> (scs_a_v39 s i j <= cstab /\ cstab < dist(v i, v j))) /\ + (!i. scs_a_v39 s i (i+1) < scs_b_v39 s i (i+1)) /\ + scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1) <= &2 * h0 + ==> + (!j. ~(j IN scs_M s ) ==> dist(v j , v(j+1)) = &2)`;; + + let WKEIDFT_concl = `!s a b a' b' p q p' q'. + (let k = scs_k_v39 s in + (is_scs_v39 s /\ scs_basic_v39 s /\ + (!i. scs_a_v39 s i (i + 1) = a) /\ + (!i. scs_b_v39 s i (i + 1) = b) /\ + p' + q = p + q' /\ + (!i j. scs_diag k i j ==> scs_a_v39 s i j <= cstab) /\ + (!i j. scs_diag k i j ==> scs_a_v39 s i j = a') /\ + (!i j. scs_diag k i j ==> scs_b_v39 s i j = b') ==> + scs_arrow_v39 {scs_stab_diag_v39 s p q} {scs_stab_diag_v39 s p' q'}))`;; + + let PEDSLGV1_concl = `!v i j. + v IN MMs_v39 scs_6I1 /\ + scs_diag 6 i j /\ + dist(v i,v j) <= cstab ==> + v IN MMs_v39 (scs_stab_diag_v39 scs_6I1 i j)`;; + + let PEDSLGV2_concl = `!v. + v IN MMs_v39 scs_6I1 /\ + (!i j. scs_diag 6 i j ==> cstab <= dist(v i,v j)) ==> + v IN MMs_v39 (scs_6M1)`;; + + let AQICLXA_concl = `scs_arrow_v39 { scs_stab_diag_v39 scs_6I1 0 2 } { scs_5M1, scs_3M1 }`;; + + let FUNOUYH_concl = `scs_arrow_v39 { scs_stab_diag_v39 scs_6I1 0 3 } {scs_4M2 }`;; + + let OEHDBEN_concl = `scs_arrow_v39 { scs_6I1 } { scs_6T1, scs_5M1, scs_4M2, scs_3T1 }`;; + + let OTMTOTJ1_concl = `scs_arrow_v39 { scs_5I1 } { scs_stab_diag_v39 scs_5I1 0 2 , scs_5M2 }`;; + + let OTMTOTJ2_concl = `scs_arrow_v39 { scs_5I2 } { scs_stab_diag_v39 scs_5I2 0 2 , scs_5M2 }`;; + +(* corrected 2013/08/05 *) + let OTMTOTJ3_concl = `scs_arrow_v39 { scs_5I3 } { scs_stab_diag_v39 scs_5M1 0 2 , + scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4, scs_5M2 }`;; + + let OTMTOTJ4_concl = `scs_arrow_v39 { scs_5M1 } { scs_stab_diag_v39 scs_5M1 0 2 , + scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4, scs_5M2 }`;; + + let HIJQAHA_concl = `scs_arrow_v39 { scs_5M2 } { scs_3T1,scs_3T4,scs_4M6',scs_4M7,scs_4M8, + scs_5T1, scs_stab_diag_v39 scs_5I2 0 2 , + scs_stab_diag_v39 scs_5M1 0 2 , scs_stab_diag_v39 scs_5M1 0 3, scs_stab_diag_v39 scs_5M1 2 4 }`;; + + let CNICGSF1_concl = `scs_arrow_v39 { scs_stab_diag_v39 scs_5I1 0 2 } + {scs_4M2, scs_3M1 }`;; + + let CNICGSF2_concl = `scs_arrow_v39 { scs_stab_diag_v39 scs_5I2 0 2 } + {scs_4M3', scs_3T1 }`;; + + let CNICGSF3_concl = `scs_arrow_v39 { scs_stab_diag_v39 scs_5M1 0 2 } + {scs_4M2, scs_3T4 }`;; + + let CNICGSF4_concl = `scs_arrow_v39 { scs_stab_diag_v39 scs_5M1 0 3 } + {scs_4M4', scs_3M1 }`;; + + let CNICGSF5_concl = `scs_arrow_v39 { scs_stab_diag_v39 scs_5M1 2 4 } + {scs_4M5', scs_3M1 }`;; + + let ARDBZYE_concl = `scs_arrow_v39 { scs_4I2 } { scs_4T1, scs_4T2 }`;; + + let FYSSVEV_concl = `scs_arrow_v39 { scs_4I1 } {scs_4I2, scs_stab_diag_v39 scs_4I1 0 2 }`;; + + let AUEAHEH_concl = `scs_arrow_v39 { scs_stab_diag_v39 scs_4I1 0 2 } { scs_3M1 }`;; + + let ZNLLLDL_concl = `scs_arrow_v39 { scs_stab_diag_v39 scs_4I3 0 2 } { scs_4T4 }`;; + + let VQFYMZY_concl = `scs_arrow_v39 { scs_4I3 } { scs_4T4, scs_4M6' }`;; + + (* let CNFNTYP_concl = `scs_arrow_v39 { scs_4M1 } { scs_4M2, scs_4M6' }`;; *) + + let BNAWVNH_concl = `scs_arrow_v39 { scs_4M2 } { scs_3M1, scs_3T4, scs_4M6' }`;; + + let RAWZDIB_concl = `scs_arrow_v39 { scs_4M3' } { scs_3T1, scs_3T6', scs_4M6' }`;; + + let MFKLVDK_concl = `scs_arrow_v39 { scs_4M4' } { scs_3M1, scs_3T4, scs_3T3, scs_4M7 }`;; + + let RYPDIXT_concl = `scs_arrow_v39 { scs_4M5' } { scs_3T4, scs_4M8 }`;; + + let GSXRFWM_concl = `!s v. + is_scs_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s ==> scs_generic v`;; + + let WGDHPPI_concl = `!s v. + is_scs_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s ==> + CARD { i | i < scs_k_v39 s /\ scs_is_str s v i} <= 1`;; + + let ASSWPOW_concl = `!s v i. + is_scs_v39 s /\ v IN MMs_v39 s /\ scs_k_v39 s = 4 /\ scs_basic_v39 s /\ + scs_b_v39 s i (i+1) <= &2 * h0 /\ scs_b_v39 s (i+1) (i+2) <= &2 * h0 + ==> xrr (norm (v i)) (norm(v(i+2))) (dist(v i,v(i+2))) <= #15.53 `;; + + let YEBWJNG_concl = `!s v p. + is_scs_v39 s /\ scs_basic_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4*h0 < scs_b_v39 s i j) /\ + (!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/ + (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) /\ + ~scs_is_str s v p /\ ~scs_is_str s v (p+1) /\ scs_a_v39 s p (p+1) = &2 + ==> dist(v p,v(p+1)) = &2`;; + + let TUAPYYU_concl = `!s v p. + is_scs_v39 s /\ scs_basic_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4*h0 < scs_b_v39 s i j) /\ + (!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/ + (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) /\ + ~scs_is_str s v p /\ ~scs_is_str s v (p+1) + ==> dist(v p,v(p+1)) = scs_a_v39 s p (p+1) \/ dist(v p,v(p+1)) = scs_b_v39 s p (p+1)`;; + + let WKZZEEH_concl = `!s v p. + is_scs_v39 s /\ scs_basic_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4*h0 < scs_b_v39 s i j) /\ + (!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/ + (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) /\ + ~scs_is_str s v p /\ ~scs_is_str s v (p+1) /\ ~scs_is_str s v (p+3) + ==> (~(dist(v p,v(p+3)) = cstab /\ dist(v(p),v(p+1)) = cstab))`;; + + let PWEIWBZ_concl = `!s v p. + is_scs_v39 s /\ scs_basic_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4*h0 < scs_b_v39 s i j) /\ + (!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/ + (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) /\ + scs_a_v39 s p (p+1) = &2 + ==> dist(v p,v(p+1)) = &2`;; + + let VASYYAU_concl = `!s v p. + is_scs_v39 s /\ scs_basic_v39 s /\ scs_k_v39 s = 4 /\ v IN MMs_v39 s /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j <= cstab /\ cstab < dist(v i,v j) /\ &4*h0 < scs_b_v39 s i j) /\ + (!i. (scs_a_v39 s i (i+1) = &2 /\ scs_b_v39 s i (i+1)= &2*h0) \/ + (scs_a_v39 s i (i+1) = &2 * h0 /\ scs_b_v39 s i (i+1)= cstab)) /\ + scs_is_str s v p + ==> (dist(v p,v (p+1)) = scs_a_v39 s p (p+1) /\ dist(v p,v (p+3)) = scs_a_v39 s p (p+3))`;; + +(* + + let UFGHLP1_concl = `!s v i. + is_scs_v39 s /\ v IN MMs_v39 s /\ scs_k_v39 s = 4 /\ scs_basic_v39 s /\ + (!i. scs_b_v39 s i (i+1) <= cstab) /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j < dist(v i,v j)) /\ + (scs_is_str s v (i+1)) ==> + ((dist(v i,v(i+1)) = scs_a_v39 s i (i+1) <=> dist(v(i+1),v(i+2)) = scs_a_v39 s (i+1) (i+2)))`;; + + let UFGHLP2_concl = `!s v i. + is_scs_v39 s /\ v IN MMs_v39 s /\ scs_k_v39 s = 4 /\ scs_basic_v39 s /\ + (!i. scs_b_v39 s i (i+1) <= cstab) /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j < dist(v i,v j)) /\ + (scs_is_str s v (i+1)) ==> + ((dist(v i,v(i+1)) = scs_b_v39 s i (i+1) <=> dist(v(i+1),v(i+2)) = scs_b_v39 s (i+1) (i+2)))`;; + + let DSZPJSK_concl = `!s v i. + is_scs_v39 s /\ v IN MMs_v39 s /\ scs_k_v39 s = 4 /\ scs_basic_v39 s /\ + (!i. scs_b_v39 s i (i+1) <= cstab) /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j < dist(v i,v j)) /\ + (scs_is_str s v (i+1)) ==> + (~(dist(v i,v(i+1)) = &2 * h0 /\ dist(v(i+1),v(i+2)) = cstab) /\ + ~(dist(v i,v(i+1)) = cstab /\ dist(v(i+1),v(i+2)) = &2 *h0))`;; + + let RDLGWIE_concl = `!s v i. + is_scs_v39 s /\ v IN MMs_v39 s /\ scs_k_v39 s = 4 /\ scs_basic_v39 s /\ + (!i. scs_b_v39 s i (i+1) <= cstab) /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j < dist(v i,v j)) ==> + (~(dist(v i,v(i+1)) = &2 * h0 /\ dist(v(i+1),v(i+2)) = cstab) /\ + ~(dist(v i,v(i+1)) = cstab /\ dist(v(i+1),v(i+2)) = &2 *h0))`;; + + let LFYPZPI_concl = `!s v i. + is_scs_v39 s /\ v IN MMs_v39 s /\ scs_k_v39 s = 4 /\ scs_basic_v39 s /\ + (!i. scs_b_v39 s i (i+1) <= cstab) /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j < dist(v i,v j)) /\ + (dist(v i,v(i+1)) = &2 * h0) /\ + (dist(v (i+1),v(i+2)) = &2 * h0) /\ + (dist(v (i+2),v(i+3)) = &2 * h0) /\ + (scs_b_v39 s i (i+1) = &2 * h0) /\ + (scs_b_v39 s (i+1) (i+2) = &2 * h0) /\ + (scs_b_v39 s (i+2) (i+3) = &2 * h0) ==> F`;; + + let NZBSJXG_concl = `!s v i. + is_scs_v39 s /\ v IN MMs_v39 s /\ scs_k_v39 s = 4 /\ scs_basic_v39 s /\ + (!i. scs_b_v39 s i (i+1) <= cstab) /\ + CARD (scs_M s) <= 1 /\ + (!i j. scs_diag 4 i j ==> scs_a_v39 s i j < dist(v i,v j)) /\ + (!i. scs_b_v39 s i (i+1) <= &2 * h0 ==> dist(v i,v (i+1)) = &2)`;; +*) + + let NWDGKXH_concl = `scs_arrow_v39 {scs_4M6'} {scs_4T3,scs_4T5}`;; + + let EFLYGAU_concl = `(?v. v IN MMs_v39 scs_4M7 /\ + cstab < dist(v 0,v 2) /\ cstab < dist(v 1, v 3) ) + ==> scs_arrow_v39 {scs_4M7} {scs_4M6'}`;; + + let YOBIMPP_concl = ` scs_arrow_v39 {scs_4M7} {scs_3M1,scs_3T3,scs_3T4,scs_4M6'}`;; + + let BJTDWPS_concl = `(?v. v IN MMs_v39 scs_4M8 /\ + cstab < dist(v 0,v 2) /\ cstab < dist(v 1, v 3) ) ==> + scs_arrow_v39 {scs_4M8} {scs_4M6',scs_3T7}`;; + +(* + let MIQMCSN1_concl = `(?v. v IN MMs_v39 scs_4M8 /\ + (dist(v 0,v 2) = cstab \/ dist(v 1, v 3) = cstab )) ==> + scs_arrow_v39 {scs_4M7} {scs_3T4}`;; +*) + + let MIQMCSN_concl = `scs_arrow_v39 {scs_4M8} {scs_4M6',scs_3T7,scs_3T4}`;; + + let LFLACKU_concl = `scs_arrow_v39 {scs_3T1} {scs_3T2,scs_3T5}`;; + + let CUXVZOZ_concl = `main_nonlinear_terminal_v11 ==> + (!s FF k p1 v. + FF = IMAGE (\i. (v i,v (SUC i))) (:num) /\ + is_scs_v39 s /\ + k = scs_k_v39 s /\ + 3 < k /\ + MMs_v39 s v /\ + scs_basic_v39 s /\ + scs_generic v /\ + &3 <= dist(v (p1+k-1),v (p1+1)) /\ + (!i j. scs_diag k i j /\ ~(psort k (i, j) = psort k ((p1+k-1),(p1+1))) ==> scs_a_v39 s i j < dist(v i,v j)) /\ + (!i j. scs_diag k i j ==> &4 * h0 < scs_b_v39 s i j) /\ + interior_angle1 (vec 0) FF (v p1) < pi /\ + (pi/ &2 < interior_angle1 (vec 0) FF (v p1) \/ interior_angle1 (vec 0) FF (v (p1+1)) < pi) /\ + scs_a_v39 s p1 (p1+1) = &2 /\ + scs_b_v39 s p1 (p1+1) <= &2 * h0 /\ + &2 <= dist(v (p1+k-1),v p1) /\ + dist(v (p1+k-1), v p1) <= cstab ==> + dist(v p1,v (p1+1)) = &2)`;; + + let CJBDXXN_concl = `main_nonlinear_terminal_v11 ==> + (!s FF k p1 v. + FF = IMAGE (\i. (v i,v (SUC i))) (:num) /\ + is_scs_v39 s /\ + k = scs_k_v39 s /\ + 3 < k /\ + MMs_v39 s v /\ + scs_basic_v39 s /\ + scs_generic v /\ + &3 <= dist(v (p1+1),v (p1+k-1)) /\ + (!i j. scs_diag k i j /\ ~(psort k (i, j) = psort k ((p1+1),(p1+k-1))) ==> scs_a_v39 s i j < dist(v i,v j)) /\ + (!i j. scs_diag k i j ==> &4 * h0 < scs_b_v39 s i j) /\ + interior_angle1 (vec 0) FF (v p1) < pi /\ + (pi/ &2 < interior_angle1 (vec 0) FF (v p1) \/ interior_angle1 (vec 0) FF (v (p1+k-1)) < pi) /\ + scs_a_v39 s p1 (p1+k-1) = &2 /\ + scs_b_v39 s p1 (p1+k-1) <= &2 * h0 /\ + &2 <= dist(v (p1+1),v p1) /\ + dist(v (p1+1), v p1) <= cstab ==> + dist(v p1,v (p1+k-1)) = &2)`;; + + let YRTAFYH_concl = + `!s i j. + is_scs_v39 s /\ + scs_basic_v39 s /\ + 3 < scs_k_v39 s /\ + scs_diag (scs_k_v39 s) i j /\ + scs_a_v39 s i j <= cstab ==> + is_scs_v39 (scs_stab_diag_v39 s i j) /\ scs_basic_v39 (scs_stab_diag_v39 s i j) + `;; + + let BKOSSGE_concl = + `scs_arrow_v39 {scs_3M1} {scs_3T1,scs_3T5}`;; + +end;; + + + + diff --git a/text_formalization/local/deformation.hl b/text_formalization/local/deformation.hl new file mode 100644 index 0000000..7fff131 --- /dev/null +++ b/text_formalization/local/deformation.hl @@ -0,0 +1,1040 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Hypermap *) +(* Author: John Harrison *) +(* Date: 2012-09-16 *) +(* ========================================================================== *) + + +(* ------------------------------------------------------------------------- *) +(* Some lemmas that should probably go in the core. *) +(* ------------------------------------------------------------------------- *) + +module Deformation = struct + + open Fan;; + open Local_lemmas1;; + open Ckqowsa_4_points;; + open Hales_tactic;; + +let COMPACT_SPHERE_0 = prove + (`!a. compact {x | norm x = a}`, + ONCE_REWRITE_TAC[NORM_ARITH `norm x = norm(x - vec 0)`] THEN + REWRITE_TAC[COMPACT_SPHERE]);; + +let SEPARATE_CLOSED_CONES = prove + (`!c d:real^N->bool. + conic c /\ closed c /\ conic d /\ closed d /\ c INTER d SUBSET {vec 0} + ==> ?e. &0 < e /\ + !x y. x IN c /\ y IN d ==> dist(x,y) + >= e * max (norm x) (norm y)`, + SUBGOAL_THEN + `!c d:real^N->bool. + conic c /\ closed c /\ conic d /\ closed d /\ c INTER d SUBSET {vec 0} + ==> ?e. &0 < e /\ + !x y. x IN c /\ y IN d ==> dist(x,y) + >= e * norm x` + ASSUME_TAC THENL + [REPEAT STRIP_TAC THEN REWRITE_TAC[real_ge] THEN + MP_TAC(ISPECL [`c INTER {x:real^N | norm x = &1}`; `d:real^N->bool`] + SEPARATE_COMPACT_CLOSED) THEN + ASM_SIMP_TAC[CLOSED_INTER_COMPACT; COMPACT_SPHERE_0] THEN ANTS_TAC THENL + [FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (SET_RULE + `c INTER d SUBSET {a} ==> ~(a IN s) ==> (c INTER s) INTER d = {}`)) THEN + REWRITE_TAC[IN_ELIM_THM; NORM_0] THEN REAL_ARITH_TAC; + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `e:real` THEN + REWRITE_TAC[IN_INTER; IN_ELIM_THM] THEN STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + MAP_EVERY X_GEN_TAC [`x:real^N`; `y:real^N`] THEN STRIP_TAC THEN + ASM_CASES_TAC `x:real^N = vec 0` THEN + ASM_REWRITE_TAC[DIST_POS_LE; REAL_MUL_RZERO; NORM_0] THEN + FIRST_X_ASSUM(MP_TAC o SPECL + [`inv(norm x) % x:real^N`; `inv(norm(x:real^N)) % y:real^N`]) THEN + REWRITE_TAC[dist; NORM_MUL; GSYM VECTOR_SUB_LDISTRIB] THEN + REWRITE_TAC[REAL_ARITH `abs x * a = a * abs x`] THEN + REWRITE_TAC[REAL_ABS_INV; GSYM real_div; REAL_ABS_NORM] THEN + ASM_SIMP_TAC[REAL_LE_RDIV_EQ; NORM_POS_LT] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_SIMP_TAC[REAL_DIV_REFL; NORM_EQ_0] THEN + RULE_ASSUM_TAC(REWRITE_RULE[conic]) THEN + CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_SIMP_TAC[REAL_LE_INV_EQ; NORM_POS_LE]]; + REPEAT STRIP_TAC THEN FIRST_X_ASSUM(fun th -> + MP_TAC(SPECL [`c:real^N->bool`; `d:real^N->bool`] th) THEN + MP_TAC(SPECL [`d:real^N->bool`; `c:real^N->bool`] th)) THEN + ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[INTER_COMM] THEN + ASM_REWRITE_TAC[LEFT_IMP_EXISTS_THM; real_ge] THEN + X_GEN_TAC `d:real` THEN STRIP_TAC THEN + X_GEN_TAC `e:real` THEN STRIP_TAC THEN + EXISTS_TAC `min d e:real` THEN ASM_REWRITE_TAC[REAL_LT_MIN] THEN + MAP_EVERY X_GEN_TAC [`x:real^N`; `y:real^N`] THEN STRIP_TAC THEN + REWRITE_TAC[real_max] THEN COND_CASES_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THENL + [EXISTS_TAC `d * norm(y:real^N)` THEN ONCE_REWRITE_TAC[DIST_SYM]; + EXISTS_TAC `e * norm(x:real^N)`] THEN + ASM_SIMP_TAC[] THEN MATCH_MP_TAC REAL_LE_RMUL THEN NORM_ARITH_TAC]);; + +(* ------------------------------------------------------------------------- *) +(* More Flyspeck-specific lemmas. *) +(* ------------------------------------------------------------------------- *) + +let AFF_GE_1_2_0 = prove + (`!v w. + ~(v = vec 0) /\ ~(w = vec 0) + ==> aff_ge {vec 0} {v,w} = {a % v + b % w | &0 <= a /\ &0 <= b}`, + SIMP_TAC[Fan.AFF_GE_1_2; + SET_RULE `DISJOINT {a} {b,c} <=> ~(b = a) /\ ~(c = a)`] THEN + REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + ONCE_REWRITE_TAC[MESON[] + `(?a b c. P b c /\ Q b c /\ R a b c /\ S b c) <=> + (?b c. P b c /\ Q b c /\ S b c /\ ?a. R a b c)`] THEN + REWRITE_TAC[REAL_ARITH `t + s:real = &1 <=> t = &1 - s`; EXISTS_REFL] THEN + SET_TAC[]);; + +let AFF_GE_1_1_0 = prove + (`!v. ~(v = vec 0) ==> aff_ge {vec 0} {v} = {a % v | &0 <= a}`, + REPEAT STRIP_TAC THEN + GEN_REWRITE_TAC (LAND_CONV o RAND_CONV) [SET_RULE `{a} = {a,a}`] THEN + ASM_SIMP_TAC[AFF_GE_1_2_0; GSYM VECTOR_ADD_RDISTRIB] THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN + MESON_TAC[REAL_LE_ADD; REAL_ARITH + `&0 <= a ==> &0 <= a / &2 /\ a / &2 + a / &2 = a`]);; + +let CONIC_AFF_GE_0 = prove + (`!s:real^N->bool. FINITE s /\ ~(vec 0 IN s) ==> conic(aff_ge {vec 0} s)`, + REPEAT STRIP_TAC THEN ASM_SIMP_TAC[AFF_GE_0_N; conic] THEN + REWRITE_TAC[IN_ELIM_THM] THEN GEN_TAC THEN X_GEN_TAC `c:real` THEN + DISCH_THEN(CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN + DISCH_THEN(X_CHOOSE_THEN `u:real^N->real` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `\v. c * (u:real^N->real) v` THEN + REWRITE_TAC[GSYM VECTOR_MUL_ASSOC; VSUM_LMUL] THEN + ASM_MESON_TAC[REAL_LE_MUL]);; + +(* ------------------------------------------------------------------------- *) +(* More economical characterization of "fan7" *) +(* ------------------------------------------------------------------------- *) + +let GMLWKPK = prove + (`!x:real^N V E. + graph E + ==> (fan7(x,V,E) <=> + !e1 e2. e1 IN E UNION {{v} | v IN V} /\ + e2 IN E UNION {{v} | v IN V} + ==> (e1 INTER e2 = {} + ==> aff_ge {x} e1 INTER aff_ge {x} e2 = {x}) /\ + (!v. e1 INTER e2 = {v} + ==> aff_ge {x} e1 INTER aff_ge {x} e2 = + aff_ge {x} {v}))`, + REPEAT STRIP_TAC THEN REWRITE_TAC[Fan.fan7] THEN EQ_TAC THENL + [SIMP_TAC[AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING]; ALL_TAC] THEN + MATCH_MP_TAC MONO_FORALL THEN X_GEN_TAC `e1:real^N->bool` THEN + MATCH_MP_TAC MONO_FORALL THEN X_GEN_TAC `e2:real^N->bool` THEN + MATCH_MP_TAC(TAUT `(p ==> q ==> r) ==> (q ==> p) ==> q ==> r`) THEN + STRIP_TAC THEN DISCH_TAC THEN + SUBGOAL_THEN `e1 = e2 \/ e1 INTER e2 = {} \/ (?v:real^N. e1 INTER e2 = {v})` + MP_TAC THENL + [ALL_TAC; + STRIP_TAC THEN ASM_REWRITE_TAC[INTER_IDEMPOT] THEN + ASM_MESON_TAC[AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING]] THEN + SUBGOAL_THEN `?a b:real^N c d:real^N. e1 = {a,b} /\ e2 = {c,d}` MP_TAC THENL + [ALL_TAC; + DISCH_THEN(REPEAT_TCL CHOOSE_THEN (CONJUNCTS_THEN SUBST_ALL_TAC)) THEN + SET_TAC[]] THEN + FIRST_ASSUM(CONJUNCTS_THEN MP_TAC) THEN + REWRITE_TAC[IN_UNION; IN_ELIM_THM] THEN + SUBGOAL_THEN `!e:real^N->bool. e IN E ==> ?v w. ~(v = w) /\ e = {v,w}` + (LABEL_TAC "*") THENL + [FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [graph]) THEN + MATCH_MP_TAC MONO_FORALL THEN GEN_TAC THEN + MATCH_MP_TAC MONO_IMP THEN REWRITE_TAC[IN] THEN + CONV_TAC(LAND_CONV HAS_SIZE_CONV) THEN REWRITE_TAC[]; + ASM_MESON_TAC[SET_RULE `{v,v} = {v}`]]);; + +let GMLWKPK_ALT = prove + (`!x:real^N V E. + graph E /\ (!e. e IN E ==> ~(x IN e)) + ==> (fan7(x,V,E) <=> + (!e1 e2. e1 IN E UNION {{v} | v IN V} /\ + e2 IN E UNION {{v} | v IN V} /\ + e1 INTER e2 = {} + ==> aff_ge {x} e1 INTER aff_ge {x} e2 = {x}) /\ + (!e1 e2 v. e1 IN E /\ e2 IN E /\ e1 INTER e2 = {v} + ==> aff_ge {x} e1 INTER aff_ge {x} e2 = + aff_ge {x} {v}))`, + REPEAT STRIP_TAC THEN ASM_SIMP_TAC[GMLWKPK] THEN + EQ_TAC THEN SIMP_TAC[IN_UNION] THEN STRIP_TAC THEN + MATCH_MP_TAC(MESON[] + `(!x y. R x y ==> R y x) /\ + (!x y. P x /\ P y ==> R x y) /\ + (!x y. Q x /\ Q y ==> R x y) /\ + (!x y. P x /\ Q y ==> R x y) + ==> !x y. (P x \/ Q x) /\ (P y \/ Q y) ==> R x y`) THEN + CONJ_TAC THENL [REWRITE_TAC[INTER_ACI]; ASM_SIMP_TAC[]] THEN CONJ_TAC THEN + REWRITE_TAC[IMP_CONJ; RIGHT_FORALL_IMP_THM; FORALL_IN_GSPEC] THENL + [SIMP_TAC[SET_RULE `{a} INTER {b} = {c} <=> a = c /\ b = c`] THEN SET_TAC[]; + X_GEN_TAC `e1:real^N->bool` THEN DISCH_TAC THEN X_GEN_TAC `v:real^N`] THEN + SUBGOAL_THEN `(e1:real^N->bool) HAS_SIZE 2` MP_TAC THENL + [ASM_MESON_TAC[graph; IN]; CONV_TAC(LAND_CONV HAS_SIZE_CONV)] THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`u:real^N`; `w:real^N`] THEN + STRIP_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + SIMP_TAC[SET_RULE `{a,b} INTER {c} = {d} <=> d = c /\ (a = c \/ b = c)`] THEN + REWRITE_TAC[SET_RULE `s INTER t = t <=> t SUBSET s`] THEN + GEN_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC AFF_GE_MONO_RIGHT THEN ASM SET_TAC[]);; + +let GMLWKPK_SIMPLE = prove + (`!E V x:real^N. + UNIONS E SUBSET V /\ graph E /\ fan6(x,V,E) /\ + (!e. e IN E ==> ~(x IN e)) + ==> (fan7 (x,V,E) <=> + !e1 e2. + e1 IN E UNION {{v} | v IN V} /\ e2 IN E UNION {{v} | v IN V} /\ + e1 INTER e2 = {} + ==> aff_ge {x} e1 INTER aff_ge {x} e2 = {x})`, + let lemma = prove + (`!x u v w:real^N. + ~collinear{x,u,v} /\ ~collinear{x,v,w} + ==> (~(aff_ge {x} {u,v} INTER aff_ge {x} {v,w} = + aff_ge {x} {v}) <=> + u IN aff_ge {x} {v,w} \/ w IN aff_ge {x} {u,v})`, + REPEAT GEN_TAC THEN GEOM_ORIGIN_TAC `x:real^N` THEN + REPEAT GEN_TAC THEN + MAP_EVERY (fun t -> + ASM_CASES_TAC t THENL + [ASM_REWRITE_TAC[COLLINEAR_2; INSERT_AC]; ALL_TAC]) + [`u:real^N = v`; `w:real^N = v`; + `u:real^N = vec 0`; `v:real^N = vec 0`; `w:real^N = vec 0`] THEN + STRIP_TAC THEN EQ_TAC THENL + [DISCH_THEN(MP_TAC o MATCH_MP (SET_RULE + `~(s INTER s' = t) + ==> t SUBSET s /\ t SUBSET s' ==> t PSUBSET s INTER s'`)) THEN + ANTS_TAC THENL + [CONJ_TAC THEN MATCH_MP_TAC AFF_GE_MONO_RIGHT THEN ASM SET_TAC[]; + REWRITE_TAC[PSUBSET_ALT]] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + ASM_SIMP_TAC[AFF_GE_1_2_0; AFF_GE_1_1_0; LEFT_IMP_EXISTS_THM] THEN + REWRITE_TAC[IN_INTER; IMP_CONJ; FORALL_IN_GSPEC] THEN + MAP_EVERY X_GEN_TAC [`a:real`; `b:real`] THEN + DISCH_TAC THEN DISCH_TAC THEN + REWRITE_TAC[IN_ELIM_THM; LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`c:real`; `d:real`] THEN STRIP_TAC THEN + ASM_CASES_TAC `a = &0` THENL + [ASM_MESON_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID]; ALL_TAC] THEN + ASM_CASES_TAC `d = &0` THENL + [ASM_MESON_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID]; ALL_TAC] THEN + DISCH_THEN(K ALL_TAC) THEN DISJ_CASES_TAC + (REAL_ARITH `b <= c \/ c <= b`) + THENL + [FIRST_X_ASSUM(MP_TAC o MATCH_MP (VECTOR_ARITH + `a % u + b % v:real^N = c % v + d % w + ==> a % u = (c - b) % v + d % w`)) THEN + DISCH_THEN(MP_TAC o AP_TERM `(%) (inv a):real^N->real^N`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; VECTOR_MUL_LID] THEN + DISCH_THEN(K ALL_TAC) THEN DISJ1_TAC THEN + REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC] THEN + MAP_EVERY EXISTS_TAC [`inv a * (c - b):real`; `inv a * d:real`] THEN + ASM_SIMP_TAC[REAL_LE_MUL; REAL_LE_INV_EQ; REAL_SUB_LE]; + FIRST_X_ASSUM(MP_TAC o MATCH_MP (VECTOR_ARITH + `a % u + b % v:real^N = c % v + d % w + ==> d % w = (b - c) % v + a % u`)) THEN + DISCH_THEN(MP_TAC o AP_TERM `(%) (inv d):real^N->real^N`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; VECTOR_MUL_LID] THEN + DISCH_THEN(K ALL_TAC) THEN DISJ2_TAC THEN + REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC] THEN + MAP_EVERY EXISTS_TAC [`inv d * a:real`; `inv d * (b - c):real`] THEN + ASM_SIMP_TAC[REAL_LE_MUL; REAL_LE_INV_EQ; REAL_SUB_LE] THEN + REWRITE_TAC[VECTOR_ADD_SYM]]; + STRIP_TAC THEN MATCH_MP_TAC(SET_RULE + `(?x. x IN s /\ x IN t /\ ~(x IN u)) ==> ~(s INTER t = u)`) + THENL + [EXISTS_TAC `u:real^N` THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[AFF_GE_1_2_0; AFF_GE_1_1_0; IN_ELIM_THM] THEN + CONJ_TAC THENL + [MAP_EVERY EXISTS_TAC [`&1`; `&0`] THEN + REWRITE_TAC[REAL_POS] THEN VECTOR_ARITH_TAC; + DISCH_THEN(X_CHOOSE_THEN `a:real` + (CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC)) THEN + UNDISCH_TAC `~collinear{vec 0:real^N,a % v,v}` THEN + REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`] THEN + REWRITE_TAC[COLLINEAR_LEMMA] THEN MESON_TAC[]]; + EXISTS_TAC `w:real^N` THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[AFF_GE_1_2_0; AFF_GE_1_1_0; IN_ELIM_THM] THEN + CONJ_TAC THENL + [MAP_EVERY EXISTS_TAC [`&0`; `&1`] THEN + REWRITE_TAC[REAL_POS] THEN VECTOR_ARITH_TAC; + DISCH_THEN(X_CHOOSE_THEN `a:real` + (CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC)) THEN + UNDISCH_TAC `~collinear{vec 0:real^N,v,a % v}` THEN + REWRITE_TAC[COLLINEAR_LEMMA] THEN MESON_TAC[]]]]) in + REPEAT STRIP_TAC THEN ASM_SIMP_TAC[GMLWKPK] THEN + EQ_TAC THEN SIMP_TAC[] THEN DISCH_TAC THEN + REWRITE_TAC[IN_UNION] THEN MATCH_MP_TAC(MESON[] + `(!x y. R x y ==> R y x) /\ + (!x. Q x ==> !y. Q y ==> R x y) /\ + (!x. P x ==> (!y. Q y ==> R x y) /\ (!y. P y ==> R x y)) + ==> (!x y. (P x \/ Q x) /\ (P y \/ Q y) ==> R x y)`) THEN + CONJ_TAC THENL [SIMP_TAC[INTER_ACI]; ALL_TAC] THEN + REWRITE_TAC[FORALL_IN_GSPEC] THEN CONJ_TAC THENL + [SIMP_TAC[SET_RULE `{a} INTER {b} = {c} <=> c = a /\ b = a`] THEN + REWRITE_TAC[INTER_IDEMPOT]; + ALL_TAC] THEN + X_GEN_TAC `ee1:real^N->bool` THEN DISCH_TAC THEN CONJ_TAC THENL + [X_GEN_TAC `v:real^N` THEN DISCH_TAC THEN + REWRITE_TAC[SET_RULE `s INTER {a} = {b} <=> b = a /\ a IN s`] THEN + SIMP_TAC[IMP_CONJ; FORALL_UNWIND_THM2] THEN DISCH_TAC THEN + REWRITE_TAC[SET_RULE `s INTER t = t <=> t SUBSET s`] THEN + MATCH_MP_TAC AFF_GE_MONO_RIGHT THEN ASM SET_TAC[]; + ALL_TAC] THEN + X_GEN_TAC `ee2:real^N->bool` THEN DISCH_TAC THEN + SUBGOAL_THEN `(ee1:real^N->bool) HAS_SIZE 2` MP_TAC THENL + [ASM_MESON_TAC[graph; IN]; CONV_TAC(LAND_CONV HAS_SIZE_CONV)] THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`v1:real^N`; `w1:real^N`] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC) THEN + SUBGOAL_THEN `(ee2:real^N->bool) HAS_SIZE 2` MP_TAC THENL + [ASM_MESON_TAC[graph; IN]; CONV_TAC(LAND_CONV HAS_SIZE_CONV)] THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`v2:real^N`; `w2:real^N`] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC) THEN + ONCE_REWRITE_TAC[SET_RULE + `{a,b} INTER {c,d} = {v} <=> + v = a /\ {a,b} INTER {c,d} = {v} \/ + v = b /\ {a,b} INTER {c,d} = {v}`] THEN + REWRITE_TAC[TAUT + `p /\ q \/ r /\ q ==> t <=> (p ==> q ==> t) /\ (r ==> q ==> t)`] THEN + REWRITE_TAC[FORALL_AND_THM; FORALL_UNWIND_THM2] THEN + MAP_EVERY UNDISCH_TAC [`{v1:real^N,w1} IN E`; `~(v1:real^N = w1)`] THEN + MAP_EVERY (fun s -> SPEC_TAC(s,s)) + [`w1:real^N`; `v1:real^N`] THEN + REWRITE_TAC[IMP_IMP] THEN MATCH_MP_TAC(MESON[] + `(!v w. P v w ==> P w v) /\ + (!v w. R v w ==> Q w v) /\ + (!v w. P v w ==> R v w) + ==> (!v w. P v w ==> Q v w /\ R v w)`) THEN + REPEAT(CONJ_TAC THENL [SIMP_TAC[INSERT_AC]; ALL_TAC]) THEN + MAP_EVERY X_GEN_TAC [`u:real^N`; `v:real^N`] THEN STRIP_TAC THEN + ONCE_REWRITE_TAC[SET_RULE + `{a,b} INTER {c,d} = {v} <=> + v = c /\ {a,b} INTER {c,d} = {v} \/ + v = d /\ {a,b} INTER {c,d} = {v}`] THEN + REWRITE_TAC[TAUT + `p /\ q \/ r /\ q ==> t <=> (p ==> q ==> t) /\ (r ==> q ==> t)`] THEN + MAP_EVERY UNDISCH_TAC [`{v2:real^N,w2} IN E`; `~(v2:real^N = w2)`] THEN + MAP_EVERY (fun s -> SPEC_TAC(s,s)) [`w2:real^N`; `v2:real^N`] THEN + REWRITE_TAC[IMP_IMP] THEN MATCH_MP_TAC(MESON[] + `(!v w. P v w ==> P w v) /\ + (!v w. Q v w ==> R w v) /\ + (!v w. P v w ==> Q v w) + ==> (!v w. P v w ==> Q v w /\ R v w)`) THEN + REPEAT(CONJ_TAC THENL [SIMP_TAC[INSERT_AC]; ALL_TAC]) THEN + MAP_EVERY X_GEN_TAC [`v':real^N`; `w:real^N`] THEN STRIP_TAC THEN + ONCE_REWRITE_TAC[IMP_CONJ] THEN DISCH_THEN(SUBST_ALL_TAC o SYM) THEN + ASM_CASES_TAC `u:real^N = w` THENL [ASM SET_TAC[]; ALL_TAC] THEN + DISCH_TAC THEN W(MP_TAC o PART_MATCH (rand o lhand o rand) lemma o goal_concl) THEN + ANTS_TAC THENL + [REWRITE_TAC[SET_RULE `{x,v,w} = {x} UNION {v,w}`] THEN + ASM_MESON_TAC[fan6; INSERT_AC]; + ALL_TAC] THEN + MATCH_MP_TAC(TAUT `~q ==> (~p <=> q) ==> p`) THEN + REWRITE_TAC[DE_MORGAN_THM] THEN CONJ_TAC THEN MATCH_MP_TAC(SET_RULE + `aff_ge {x} {v} INTER aff_ge {x} s = {x} /\ + v IN aff_ge {x} {v} /\ ~(v = x) + ==> ~(v IN aff_ge {x} s)`) THEN + REPEAT CONJ_TAC THENL + [FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[IN_UNION] THEN + CONJ_TAC THENL [DISJ2_TAC; ASM SET_TAC[]] THEN + REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC `u:real^N` THEN + REWRITE_TAC[] THEN RULE_ASSUM_TAC(REWRITE_RULE[SUBSET]) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[IN_UNIONS] THEN EXISTS_TAC `{u:real^N,v}` THEN + ASM SET_TAC[]; + SUBGOAL_THEN `DISJOINT {x:real^N} {u:real^N}` ASSUME_TAC THENL + [REWRITE_TAC[SET_RULE `DISJOINT {a} {b} <=> ~(a = b)`] THEN + ASM_MESON_TAC[IN_INSERT]; + ASM_SIMP_TAC[Fan.AFF_GE_1_1; IN_ELIM_THM] THEN + MAP_EVERY EXISTS_TAC [`&0`; `&1`] THEN + REPEAT(CONJ_TAC THENL [REAL_ARITH_TAC; ALL_TAC]) THEN VECTOR_ARITH_TAC]; + ASM_MESON_TAC[IN_INSERT]; + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[IN_UNION] THEN + CONJ_TAC THENL [DISJ2_TAC; ASM SET_TAC[]] THEN + REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC `w:real^N` THEN + REWRITE_TAC[] THEN RULE_ASSUM_TAC(REWRITE_RULE[SUBSET]) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[IN_UNIONS] THEN EXISTS_TAC `{v:real^N,w}` THEN + ASM SET_TAC[]; + SUBGOAL_THEN `DISJOINT {x:real^N} {w:real^N}` ASSUME_TAC THENL + [REWRITE_TAC[SET_RULE `DISJOINT {a} {b} <=> ~(a = b)`] THEN + ASM_MESON_TAC[IN_INSERT]; + ASM_SIMP_TAC[Fan.AFF_GE_1_1; IN_ELIM_THM] THEN + MAP_EVERY EXISTS_TAC [`&0`; `&1`] THEN + REPEAT(CONJ_TAC THENL [REAL_ARITH_TAC; ALL_TAC]) THEN VECTOR_ARITH_TAC]; + ASM_MESON_TAC[IN_INSERT]]);; + +(* ------------------------------------------------------------------------- *) +(* Two major lemmas in the proof. *) +(* ------------------------------------------------------------------------- *) + +let lemma_1 = prove + (`!x:real^N e. + ~(x = vec 0) /\ &0 < e + ==> ?d. &0 < d /\ + !x'. dist(x,x') < d + ==> !z'. z' IN aff_ge {vec 0} {x'} + ==> ?z. z IN aff_ge {vec 0} {x} /\ + norm(z' - z) <= e * norm(z)`, + REPEAT STRIP_TAC THEN + EXISTS_TAC `min (e * norm(x:real^N)) (norm x)` THEN + ASM_SIMP_TAC[REAL_LT_MUL; REAL_LT_MIN; NORM_POS_LT] THEN + X_GEN_TAC `x':real^N` THEN + STRIP_TAC THEN FIRST_X_ASSUM(ASSUME_TAC o MATCH_MP + (NORM_ARITH `dist(x,x') < norm(x:real^N) ==> ~(x' = vec 0)`)) THEN + ASM_SIMP_TAC[AFF_GE_1_1_0; FORALL_IN_GSPEC; EXISTS_IN_GSPEC] THEN + X_GEN_TAC `a:real` THEN DISCH_TAC THEN EXISTS_TAC `a:real` THEN + ASM_REWRITE_TAC[GSYM VECTOR_SUB_LDISTRIB; NORM_MUL] THEN + ONCE_REWRITE_TAC[REAL_ARITH `a * b * c:real = b * a * c`] THEN + MATCH_MP_TAC REAL_LE_LMUL THEN REWRITE_TAC[REAL_ABS_POS] THEN + ASM_SIMP_TAC[ONCE_REWRITE_RULE[DIST_SYM] (GSYM dist); REAL_LT_IMP_LE]);; + +let lemma_2 = prove + (`!x y:real^N e. + ~collinear{vec 0,x,y} /\ &0 < e + ==> ?d. &0 < d /\ + !x' y'. dist(x,x') < d /\ dist(y,y') < d + ==> !z'. z' IN aff_ge {vec 0} {x',y'} + ==> ?z. z IN aff_ge {vec 0} {x,y} /\ + norm(z' - z) <= e * norm(z)`, + REPEAT GEN_TAC THEN ASM_CASES_TAC `x:real^N = vec 0` THENL + [ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_2]; ALL_TAC] THEN + ASM_CASES_TAC `y:real^N = vec 0` THENL + [ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_2]; ALL_TAC] THEN + ASM_CASES_TAC `x:real^N = y` THENL + [ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_2]; ALL_TAC] THEN + REPEAT STRIP_TAC THEN + MP_TAC(ISPEC `(\a. a$1 % x + a$2 % y):real^2->real^N` + LINEAR_INJECTIVE_BOUNDED_BELOW_POS) THEN + SIMP_TAC[IMP_CONJ; LINEAR_INJECTIVE_0] THEN ANTS_TAC THENL + [REWRITE_TAC[linear; VECTOR_ADD_COMPONENT; VECTOR_MUL_COMPONENT] THEN + VECTOR_ARITH_TAC; + REWRITE_TAC[FORALL_VECTOR_2; VECTOR_2]] THEN + ANTS_TAC THENL + [MAP_EVERY X_GEN_TAC [`a:real`; `b:real`] THEN + GEN_REWRITE_TAC RAND_CONV [CART_EQ] THEN + REWRITE_TAC[FORALL_2; VECTOR_2; VEC_COMPONENT; DIMINDEX_2] THEN + ASM_CASES_TAC `a = &0` THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID; VECTOR_MUL_EQ_0] THEN + ASM_CASES_TAC `b = &0` THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID; VECTOR_MUL_EQ_0] THEN + DISCH_THEN(MP_TAC o MATCH_MP (VECTOR_ARITH + `a + b:real^N = vec 0 ==> b = --a`)) THEN + DISCH_THEN(MP_TAC o AP_TERM `(%) (inv b) :real^N->real^N`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; VECTOR_MUL_LID; REAL_MUL_LINV] THEN + DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE RAND_CONV + [COLLINEAR_LEMMA]) THEN + ASM_REWRITE_TAC[VECTOR_MUL_RNEG; VECTOR_MUL_ASSOC] THEN + REWRITE_TAC[GSYM VECTOR_MUL_LNEG] THEN MESON_TAC[]; + DISCH_THEN(X_CHOOSE_THEN `B:real` STRIP_ASSUME_TAC)] THEN + EXISTS_TAC `min (e * B / &2) (min (norm(x:real^N)) (norm(y:real^N)))` THEN + ASM_SIMP_TAC[REAL_LT_MUL; REAL_HALF; REAL_LT_MIN; NORM_POS_LT] THEN + MAP_EVERY X_GEN_TAC [`x':real^N`; `y':real^N`] THEN + REPEAT(STRIP_TAC THEN FIRST_X_ASSUM(ASSUME_TAC o MATCH_MP + (NORM_ARITH `dist(x,x') < norm(x:real^N) ==> ~(x' = vec 0)`))) THEN + ASM_SIMP_TAC[AFF_GE_1_2_0; FORALL_IN_GSPEC; EXISTS_IN_GSPEC] THEN + MAP_EVERY X_GEN_TAC [`a:real`; `b:real`] THEN STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`a:real`; `b:real`] THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC(NORM_ARITH + `norm(x' - x:real^N) <= e / &2 /\ norm(y' - y) <= e / &2 + ==> norm((x' + y') - (x + y)) <= e`) THEN + REWRITE_TAC[GSYM VECTOR_SUB_LDISTRIB; NORM_MUL] THEN CONJ_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THENL + [EXISTS_TAC `abs a * e * B / &2`; EXISTS_TAC `abs b * e * B / &2`] THEN + ASM_SIMP_TAC[REAL_LE_LMUL; REAL_LT_IMP_LE; REAL_ABS_POS; + ONCE_REWRITE_RULE[DIST_SYM] (GSYM dist); + REAL_ARITH `a * x / &2 <= y / &2 <=> a * x <= y`] THEN + REWRITE_TAC[REAL_ARITH `a * e * B / &2 <= (e * n) / &2 <=> + e * a * B <= e * n`] THEN + ASM_SIMP_TAC[REAL_LE_LMUL_EQ] THEN MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `norm(vector[a;b]:real^2) * B` THEN + ASM_SIMP_TAC[REAL_LE_RMUL_EQ] THENL + [MP_TAC(ISPECL [`vector[a;b]:real^2`; `1`] COMPONENT_LE_NORM); + MP_TAC(ISPECL [`vector[a;b]:real^2`; `2`] COMPONENT_LE_NORM)] THEN + REWRITE_TAC[VECTOR_2; DIMINDEX_2; ARITH]);; + +(* ------------------------------------------------------------------------- *) +(* Convenient lemmas for choosing minima. *) +(* ------------------------------------------------------------------------- *) + +let MINIMIZE_OVER_MEMBERS = prove + (`!P s:A->bool. + FINITE s /\ + (!x. x IN s + ==> ?e. &0 < e /\ !t. abs(t) < e ==> P x t) + ==> ?e. &0 < e /\ !t. abs t < e ==> !x. x IN s ==> P x t`, + REPEAT GEN_TAC THEN DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + ASM_CASES_TAC `s:A->bool = {}` THENL + [ASM_REWRITE_TAC[NOT_IN_EMPTY] THEN MESON_TAC[REAL_LT_01]; ALL_TAC] THEN + GEN_REWRITE_TAC (LAND_CONV o BINDER_CONV) [RIGHT_IMP_EXISTS_THM] THEN + REWRITE_TAC[SKOLEM_THM; LEFT_IMP_EXISTS_THM] THEN + X_GEN_TAC `dd:A->real` THEN DISCH_TAC THEN + EXISTS_TAC `inf(IMAGE (dd:A->real) s)` THEN + ASM_SIMP_TAC[REAL_LT_INF_FINITE; FINITE_IMAGE; IMAGE_EQ_EMPTY] THEN + ASM_SIMP_TAC[FORALL_IN_IMAGE]);; + +let MINIMIZE_OVER_2 = prove + (`!P Q. (?e. &0 < e /\ !t. abs(t) < e ==> P t) /\ + (?e. &0 < e /\ !t. abs(t) < e ==> Q t) + ==> ?e. &0 < e /\ !t. abs(t) < e ==> P t /\ Q t`, + REPEAT GEN_TAC THEN DISCH_THEN + (CONJUNCTS_THEN2 (X_CHOOSE_TAC `d:real`) (X_CHOOSE_TAC `e:real`)) THEN + EXISTS_TAC `min d e:real` THEN + ASM_SIMP_TAC[REAL_MIN_LT; REAL_LT_MIN]);; + +let MINIMIZE_OVER_STRONGER = prove + (`!P Q. (!t. P t ==> Q t) /\ (?e. &0 < e /\ !t. abs(t) < e ==> P t) + ==> ?e. &0 < e /\ !t. abs(t) < e ==> Q t`, + MESON_TAC[]);; + +(* ------------------------------------------------------------------------- *) +(* The main theorem. *) +(* ------------------------------------------------------------------------- *) + +let deformation = new_definition + `deformation ff V (a,b) <=> (&0) IN real_interval (a,b) /\ + (!v r. v IN V /\ r IN real_interval (a,b) ==> (ff v) continuous atreal r) /\ + (!v. v IN V ==> ff v (&0) = v )`;; + +let FAN7_SMALL_DEFORMATION = prove + (`!V:real^N->bool E a b phii. + deformation phii V (a,b) /\ FAN (vec 0,V,E) + ==> ?e. &0 < e /\ + !t. --e < t /\ t < e + ==> fan7 + (vec 0, + IMAGE (\v. phii v t) V, + IMAGE (IMAGE (\v. phii v t)) E)`, + let lemma = prove + (`closed {z | collinear {vec 0:real^N,fstcart z,sndcart z}}`, + REWRITE_TAC[GSYM NORM_CAUCHY_SCHWARZ_EQUAL] THEN + ONCE_REWRITE_TAC[SET_RULE `{x | P x} = {x | x IN (:real^N) /\ P x}`] THEN + ONCE_REWRITE_TAC[GSYM REAL_SUB_0] THEN + REWRITE_TAC[GSYM LIFT_EQ; LIFT_NUM] THEN + MATCH_MP_TAC CONTINUOUS_CLOSED_PREIMAGE_CONSTANT THEN + REWRITE_TAC[CLOSED_UNIV; LIFT_SUB] THEN MATCH_MP_TAC CONTINUOUS_ON_SUB THEN + CONJ_TAC THENL + [REWRITE_TAC[GSYM NORM_LIFT] THEN + MATCH_MP_TAC CONTINUOUS_ON_LIFT_NORM_COMPOSE THEN + MATCH_MP_TAC CONTINUOUS_ON_LIFT_DOT2; + REWRITE_TAC[LIFT_CMUL] THEN MATCH_MP_TAC CONTINUOUS_ON_MUL THEN + REWRITE_TAC[o_DEF] THEN CONJ_TAC THEN + MATCH_MP_TAC CONTINUOUS_ON_LIFT_NORM_COMPOSE] THEN + SIMP_TAC[LINEAR_CONTINUOUS_ON; LINEAR_FSTCART; LINEAR_SNDCART]) in + REWRITE_TAC[deformation; FAN] THEN REPEAT STRIP_TAC THEN + SUBGOAL_THEN `FINITE(V:real^N->bool) /\ ~(V = {})` STRIP_ASSUME_TAC THENL + [ASM_MESON_TAC[fan1; SUBSET_EMPTY]; ALL_TAC] THEN + SUBGOAL_THEN `!e. e IN E ==> ~((vec 0:real^N) IN e)` ASSUME_TAC THENL + [RULE_ASSUM_TAC(REWRITE_RULE[fan2]) THEN ASM SET_TAC[]; ALL_TAC] THEN + SUBGOAL_THEN `FINITE(E:(real^N->bool)->bool)` ASSUME_TAC THENL + [MATCH_MP_TAC FINITE_SUBSET THEN + EXISTS_TAC `IMAGE (\(v:real^N,w). {v,w}) (V CROSS V)` THEN + ASM_SIMP_TAC[FINITE_IMAGE; FINITE_CROSS] THEN + REWRITE_TAC[SUBSET] THEN X_GEN_TAC `ee:real^N->bool` THEN DISCH_TAC THEN + SUBGOAL_THEN `(ee:real^N->bool) HAS_SIZE 2` MP_TAC THENL + [ASM_MESON_TAC[graph; IN]; CONV_TAC(LAND_CONV HAS_SIZE_CONV)] THEN + REWRITE_TAC[IN_IMAGE; EXISTS_PAIR_THM; IN_CROSS] THEN + REPEAT(MATCH_MP_TAC MONO_EXISTS THEN GEN_TAC) THEN ASM SET_TAC[]; + ALL_TAC] THEN + UNDISCH_TAC `fan7(vec 0:real^N,V,E)` THEN + ASM_SIMP_TAC[GMLWKPK_SIMPLE] THEN DISCH_THEN(LABEL_TAC "0") THEN + SUBGOAL_THEN + `!e. &0 < e + ==> ?d. &0 < d /\ + !v:real^N t. v IN V /\ abs(t) < d ==> norm(phii v t - v) < e` + MP_TAC THENL + [X_GEN_TAC `e:real` THEN DISCH_TAC THEN ONCE_REWRITE_TAC[MESON[] + `(!v t. P v /\ Q t ==> R v t) <=> (!t. Q t ==> !v. P v ==> R v t)`] THEN + MATCH_MP_TAC MINIMIZE_OVER_MEMBERS THEN ASM_REWRITE_TAC[] THEN + X_GEN_TAC `v:real^N` THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o ISPECL [`v:real^N`; `&0:real`]) THEN + REWRITE_TAC[continuous_atreal] THEN ASM_SIMP_TAC[] THEN + REWRITE_TAC[dist; REAL_SUB_RZERO] THEN ASM_MESON_TAC[]; + GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [RIGHT_IMP_EXISTS_THM] THEN + REWRITE_TAC[SKOLEM_THM; LEFT_IMP_EXISTS_THM] THEN + REWRITE_TAC[TAUT `p ==> q /\ r <=> (p ==> q) /\ (p ==> r)`] THEN + REWRITE_TAC[FORALL_AND_THM; RIGHT_IMP_FORALL_THM; IMP_IMP] THEN + X_GEN_TAC `dd:real->real` THEN STRIP_TAC] THEN + SUBGOAL_THEN + `?e1. &0 < e1 /\ + !t. abs(t) < e1 + ==> graph (IMAGE (IMAGE (\v. (phii:real^N->real->real^N) v t)) E)` + STRIP_ASSUME_TAC THENL + [ASM_REWRITE_TAC[Fan.GRAPH; FORALL_IN_IMAGE] THEN + MATCH_MP_TAC MINIMIZE_OVER_MEMBERS THEN ASM_REWRITE_TAC[] THEN + X_GEN_TAC `ee:real^N->bool` THEN DISCH_TAC THEN + SUBGOAL_THEN `(ee:real^N->bool) HAS_SIZE 2` MP_TAC THENL + [ASM_MESON_TAC[graph; IN]; CONV_TAC(LAND_CONV HAS_SIZE_CONV)] THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`v:real^N`; `w:real^N`] THEN STRIP_TAC THEN + SUBGOAL_THEN `(v:real^N) IN V /\ w IN V` STRIP_ASSUME_TAC THENL + [ASM SET_TAC[]; ALL_TAC] THEN + ASM_REWRITE_TAC[IMAGE_CLAUSES] THEN + EXISTS_TAC `dd(norm(v - w:real^N) / &2):real` THEN + ASM_SIMP_TAC[REAL_HALF; VECTOR_SUB_EQ; NORM_POS_LT] THEN + REWRITE_TAC[Local_lemmas1.SET2_HAS_SIZE2] THEN + GEN_TAC THEN DISCH_TAC THEN MATCH_MP_TAC(NORM_ARITH + `norm(phii v t - v) < norm(v - w) / &2 /\ + norm(phii w t - w) < norm(v - w) / &2 + ==> ~(phii v t = phii w t)`) THEN + ASM_SIMP_TAC[REAL_HALF; VECTOR_SUB_EQ; NORM_POS_LT]; + ALL_TAC] THEN + SUBGOAL_THEN + `?e2. &0 < e2 /\ + !t. abs(t) < e2 + ==> !e. e IN IMAGE (IMAGE (\v. (phii:real^N->real->real^N) v t)) E + ==> ~((vec 0) IN e)` + STRIP_ASSUME_TAC THENL + [REWRITE_TAC[FORALL_IN_IMAGE] THEN MATCH_MP_TAC MINIMIZE_OVER_MEMBERS THEN + ASM_REWRITE_TAC[] THEN X_GEN_TAC `ee:real^N->bool` THEN DISCH_TAC THEN + SUBGOAL_THEN `(ee:real^N->bool) HAS_SIZE 2` MP_TAC THENL + [ASM_MESON_TAC[graph; IN]; CONV_TAC(LAND_CONV HAS_SIZE_CONV)] THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`v:real^N`; `w:real^N`] THEN STRIP_TAC THEN + SUBGOAL_THEN `(v:real^N) IN V /\ w IN V` STRIP_ASSUME_TAC THENL + [ASM SET_TAC[]; ALL_TAC] THEN + SUBGOAL_THEN `~(v:real^N = vec 0) /\ ~(w:real^N = vec 0)` + STRIP_ASSUME_TAC THENL [ASM_MESON_TAC[fan2]; ALL_TAC] THEN + EXISTS_TAC `dd(min (norm(v:real^N)) (norm(w:real^N))):real` THEN + ASM_SIMP_TAC[REAL_HALF; VECTOR_SUB_EQ; NORM_POS_LT; REAL_LT_MIN] THEN + REWRITE_TAC[IMAGE_CLAUSES; IN_INSERT; DE_MORGAN_THM; NOT_IN_EMPTY] THEN + GEN_TAC THEN STRIP_TAC THEN MATCH_MP_TAC(NORM_ARITH + `norm(phii v t - v) < min (norm v) (norm w) /\ + norm(phii w t - w) < min (norm v) (norm w) + ==> ~(vec 0 = phii v t) /\ ~(vec 0 = phii w t)`) THEN + ASM_SIMP_TAC[REAL_HALF; VECTOR_SUB_EQ; NORM_POS_LT; REAL_LT_MIN]; + ALL_TAC] THEN + SUBGOAL_THEN + `?e3. &0 < e3 /\ + !t. abs(t) < e3 + ==> !e1 e2. + e1 IN + IMAGE (IMAGE (\v. (phii:real^N->real->real^N) v t)) E UNION + {{v} | v IN IMAGE (\v. phii v t) V} /\ + e2 IN + IMAGE (IMAGE (\v. phii v t)) E UNION + {{v} | v IN IMAGE (\v. phii v t) V} /\ + e1 INTER e2 = {} + ==> aff_ge {vec 0} e1 INTER aff_ge {vec 0} e2 = {vec 0}` + STRIP_ASSUME_TAC THENL + [REWRITE_TAC[IMP_CONJ; RIGHT_FORALL_IMP_THM] THEN + REWRITE_TAC[SET_RULE + `x IN s UNION t ==> P x <=> (x IN s ==> P x) /\ (x IN t ==> P x)`] THEN + REWRITE_TAC[FORALL_AND_THM; FORALL_IN_IMAGE; FORALL_IN_GSPEC] THEN + MATCH_MP_TAC MINIMIZE_OVER_2 THEN + CONJ_TAC THEN MATCH_MP_TAC MINIMIZE_OVER_MEMBERS THEN + ASM_REWRITE_TAC[] THENL + [X_GEN_TAC `ee1:real^N->bool`; X_GEN_TAC `v1:real^N`] THEN + (DISCH_TAC THEN MATCH_MP_TAC MINIMIZE_OVER_2 THEN CONJ_TAC THEN + MATCH_MP_TAC MINIMIZE_OVER_MEMBERS THEN ASM_REWRITE_TAC[] THENL + [X_GEN_TAC `ee2:real^N->bool`; X_GEN_TAC `v2:real^N`]) THEN + DISCH_TAC THENL + [SUBGOAL_THEN `(ee1:real^N->bool) HAS_SIZE 2` MP_TAC THENL + [ASM_MESON_TAC[graph; IN]; CONV_TAC(LAND_CONV HAS_SIZE_CONV)] THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`v1:real^N`; `w1:real^N`] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC) THEN + SUBGOAL_THEN `(ee2:real^N->bool) HAS_SIZE 2` MP_TAC THENL + [ASM_MESON_TAC[graph; IN]; CONV_TAC(LAND_CONV HAS_SIZE_CONV)] THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`v2:real^N`; `w2:real^N`] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC) THEN + ASM_CASES_TAC `{v1:real^N,w1} INTER {v2,w2} = {}` THENL + [ALL_TAC; + EXISTS_TAC `&1` THEN REWRITE_TAC[REAL_LT_01] THEN ASM SET_TAC[]] THEN + SUBGOAL_THEN `~collinear{vec 0:real^N,v1,w1} /\ + ~collinear{vec 0:real^N,v2,w2}` + MP_TAC THENL + [ASM_MESON_TAC[fan6; SET_RULE `{a} UNION {b,c} = {a,b,c}`]; + ALL_TAC] THEN + MAP_EVERY (fun t -> ASM_CASES_TAC t THENL + [ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_2]; ALL_TAC]) + [`v1:real^N = vec 0`; `w1:real^N = vec 0`; + `v2:real^N = vec 0`; `w2:real^N = vec 0`] THEN + STRIP_TAC THEN + MP_TAC(ISPECL + [`aff_ge {vec 0:real^N} {v1,w1}`; + `aff_ge {vec 0:real^N} {v2,w2}`] SEPARATE_CLOSED_CONES) THEN + ANTS_TAC THENL + [SIMP_TAC[CLOSED_AFF_GE; FINITE_INSERT; FINITE_EMPTY] THEN + ASM_SIMP_TAC[IN_UNION; SUBSET_REFL] THEN + CONJ_TAC THEN MATCH_MP_TAC CONIC_AFF_GE_0 THEN + REWRITE_TAC[FINITE_INSERT; FINITE_EMPTY] THEN ASM SET_TAC[]; + ALL_TAC] THEN + SUBGOAL_THEN `(v1:real^N) IN V /\ v2 IN V /\ w1 IN V /\ w2 IN V` + STRIP_ASSUME_TAC THENL + [REPEAT CONJ_TAC THEN + FIRST_X_ASSUM(MATCH_MP_TAC o GEN_REWRITE_RULE I [SUBSET]) THEN + REWRITE_TAC[IN_UNIONS] THEN ASM_MESON_TAC[IN_INSERT]; + ALL_TAC] THEN + DISCH_THEN(X_CHOOSE_THEN `d:real` + (CONJUNCTS_THEN2 ASSUME_TAC (LABEL_TAC "*"))) THEN + MP_TAC(ISPECL [`v1:real^N`; `w1:real^N`; `d / &3`] lemma_2) THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < d / &3 <=> &0 < d`] THEN + DISCH_THEN(X_CHOOSE_THEN `d1:real` + (CONJUNCTS_THEN2 ASSUME_TAC (LABEL_TAC "1"))) THEN + MP_TAC(ISPECL [`v2:real^N`; `w2:real^N`; `d / &3`] lemma_2) THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < d / &3 <=> &0 < d`] THEN + DISCH_THEN(X_CHOOSE_THEN `d2:real` + (CONJUNCTS_THEN2 ASSUME_TAC (LABEL_TAC "2"))) THEN + EXISTS_TAC `(dd:real->real) ((min d1 d2) / &3)` THEN + ASM_SIMP_TAC[REAL_ARITH `&0 < d / &3 <=> &0 < d`; REAL_LT_MIN] THEN + X_GEN_TAC `t:real` THEN DISCH_TAC THEN DISCH_THEN(K ALL_TAC) THEN + REWRITE_TAC[IMAGE_CLAUSES] THEN MATCH_MP_TAC(SET_RULE + `(v IN s /\ v IN t /\ !x. x IN s INTER t ==> x = v) + ==> s INTER t = {v}`) THEN + REWRITE_TAC[Ckqowsa_4_points.points_in_aff_ge_0_2; IN_INTER] THEN + X_GEN_TAC `x:real^N` THEN STRIP_TAC THEN + REMOVE_THEN "1" (MP_TAC o SPECL + [`(phii:real^N->real->real^N) v1 t`; + `(phii:real^N->real->real^N) w1 t`]) THEN + ANTS_TAC THENL + [CONJ_TAC THEN MATCH_MP_TAC REAL_LT_TRANS THEN + EXISTS_TAC `min d1 d2 / &3` THEN + (CONJ_TAC THENL [ALL_TAC; ASM_REAL_ARITH_TAC]) THEN + REWRITE_TAC[ONCE_REWRITE_RULE[NORM_SUB] dist] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_REAL_ARITH_TAC; + DISCH_THEN(MP_TAC o SPEC `x:real^N`) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN(X_CHOOSE_THEN `x1:real^N` STRIP_ASSUME_TAC)] THEN + REMOVE_THEN "2" (MP_TAC o SPECL + [`(phii:real^N->real->real^N) v2 t`; + `(phii:real^N->real->real^N) w2 t`]) THEN + ANTS_TAC THENL + [CONJ_TAC THEN MATCH_MP_TAC REAL_LT_TRANS THEN + EXISTS_TAC `min d1 d2 / &3` THEN + (CONJ_TAC THENL [ALL_TAC; ASM_REAL_ARITH_TAC]) THEN + REWRITE_TAC[ONCE_REWRITE_RULE[NORM_SUB] dist] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_REAL_ARITH_TAC; + DISCH_THEN(MP_TAC o SPEC `x:real^N`) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN(X_CHOOSE_THEN `x2:real^N` STRIP_ASSUME_TAC)]; + + SUBGOAL_THEN `(ee1:real^N->bool) HAS_SIZE 2` MP_TAC THENL + [ASM_MESON_TAC[graph; IN]; CONV_TAC(LAND_CONV HAS_SIZE_CONV)] THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`v1:real^N`; `w1:real^N`] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC) THEN + ASM_CASES_TAC `{v1:real^N,w1} INTER {v2} = {}` THENL + [ALL_TAC; + EXISTS_TAC `&1` THEN REWRITE_TAC[REAL_LT_01] THEN ASM SET_TAC[]] THEN + SUBGOAL_THEN `~collinear{vec 0:real^N,v1,w1}` + MP_TAC THENL + [ASM_MESON_TAC[fan6; SET_RULE `{a} UNION {b,c} = {a,b,c}`]; + ALL_TAC] THEN + MAP_EVERY (fun t -> ASM_CASES_TAC t THENL + [ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_2]; ALL_TAC]) + [`v1:real^N = vec 0`; `w1:real^N = vec 0`] THEN + STRIP_TAC THEN + SUBGOAL_THEN `~(v2:real^N = vec 0)` ASSUME_TAC THENL + [ASM_MESON_TAC[fan2]; ALL_TAC] THEN + MP_TAC(ISPECL + [`aff_ge {vec 0:real^N} {v1,w1}`; + `aff_ge {vec 0:real^N} {v2}`] SEPARATE_CLOSED_CONES) THEN + ANTS_TAC THENL + [SIMP_TAC[CLOSED_AFF_GE; FINITE_INSERT; FINITE_EMPTY] THEN + REWRITE_TAC[CONJ_ASSOC] THEN CONJ_TAC THENL + [CONJ_TAC THEN MATCH_MP_TAC CONIC_AFF_GE_0 THEN + REWRITE_TAC[FINITE_INSERT; FINITE_EMPTY] THEN ASM SET_TAC[]; + MATCH_MP_TAC(SET_RULE `s = t ==> s SUBSET t`) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM SET_TAC[]]; + ALL_TAC] THEN + SUBGOAL_THEN `(v1:real^N) IN V /\ w1 IN V` + STRIP_ASSUME_TAC THENL + [REPEAT CONJ_TAC THEN + FIRST_X_ASSUM(MATCH_MP_TAC o GEN_REWRITE_RULE I [SUBSET]) THEN + REWRITE_TAC[IN_UNIONS] THEN ASM_MESON_TAC[IN_INSERT]; + ALL_TAC] THEN + DISCH_THEN(X_CHOOSE_THEN `d:real` + (CONJUNCTS_THEN2 ASSUME_TAC (LABEL_TAC "*"))) THEN + MP_TAC(ISPECL [`v1:real^N`; `w1:real^N`; `d / &3`] lemma_2) THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < d / &3 <=> &0 < d`] THEN + DISCH_THEN(X_CHOOSE_THEN `d1:real` + (CONJUNCTS_THEN2 ASSUME_TAC (LABEL_TAC "1"))) THEN + MP_TAC(ISPECL [`v2:real^N`; `d / &3`] lemma_1) THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < d / &3 <=> &0 < d`] THEN + DISCH_THEN(X_CHOOSE_THEN `d2:real` + (CONJUNCTS_THEN2 ASSUME_TAC (LABEL_TAC "2"))) THEN + EXISTS_TAC `(dd:real->real) ((min d1 d2) / &3)` THEN + ASM_SIMP_TAC[REAL_ARITH `&0 < d / &3 <=> &0 < d`; REAL_LT_MIN] THEN + X_GEN_TAC `t:real` THEN DISCH_TAC THEN DISCH_THEN(K ALL_TAC) THEN + REWRITE_TAC[IMAGE_CLAUSES] THEN MATCH_MP_TAC(SET_RULE + `(v IN s /\ v IN t /\ !x. x IN s INTER t ==> x = v) + ==> s INTER t = {v}`) THEN + REWRITE_TAC[Ckqowsa_4_points.points_in_aff_ge_0_2; IN_INTER] THEN + CONJ_TAC THENL + [MESON_TAC[Ckqowsa_4_points.points_in_aff_ge_0_2; INSERT_AC]; + ALL_TAC] THEN + X_GEN_TAC `x:real^N` THEN STRIP_TAC THEN + REMOVE_THEN "1" (MP_TAC o SPECL + [`(phii:real^N->real->real^N) v1 t`; + `(phii:real^N->real->real^N) w1 t`]) THEN + ANTS_TAC THENL + [CONJ_TAC THEN MATCH_MP_TAC REAL_LT_TRANS THEN + EXISTS_TAC `min d1 d2 / &3` THEN + (CONJ_TAC THENL [ALL_TAC; ASM_REAL_ARITH_TAC]) THEN + REWRITE_TAC[ONCE_REWRITE_RULE[NORM_SUB] dist] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_REAL_ARITH_TAC; + DISCH_THEN(MP_TAC o SPEC `x:real^N`) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN(X_CHOOSE_THEN `x1:real^N` STRIP_ASSUME_TAC)] THEN + REMOVE_THEN "2" (MP_TAC o SPEC `(phii:real^N->real->real^N) v2 t`) THEN + ANTS_TAC THENL + [MATCH_MP_TAC REAL_LT_TRANS THEN + EXISTS_TAC `min d1 d2 / &3` THEN + (CONJ_TAC THENL [ALL_TAC; ASM_REAL_ARITH_TAC]) THEN + REWRITE_TAC[ONCE_REWRITE_RULE[NORM_SUB] dist] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_REAL_ARITH_TAC; + DISCH_THEN(MP_TAC o SPEC `x:real^N`) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN(X_CHOOSE_THEN `x2:real^N` STRIP_ASSUME_TAC)]; + + SUBGOAL_THEN `(ee2:real^N->bool) HAS_SIZE 2` MP_TAC THENL + [ASM_MESON_TAC[graph; IN]; CONV_TAC(LAND_CONV HAS_SIZE_CONV)] THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`v2:real^N`; `w2:real^N`] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC) THEN + ASM_CASES_TAC `{v1} INTER {v2:real^N,w2} = {}` THENL + [ALL_TAC; + EXISTS_TAC `&1` THEN REWRITE_TAC[REAL_LT_01] THEN ASM SET_TAC[]] THEN + SUBGOAL_THEN `~collinear{vec 0:real^N,v2,w2}` + MP_TAC THENL + [ASM_MESON_TAC[fan6; SET_RULE `{a} UNION {b,c} = {a,b,c}`]; + ALL_TAC] THEN + MAP_EVERY (fun t -> ASM_CASES_TAC t THENL + [ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_2]; ALL_TAC]) + [`v2:real^N = vec 0`; `w2:real^N = vec 0`] THEN + STRIP_TAC THEN + SUBGOAL_THEN `~(v1:real^N = vec 0)` ASSUME_TAC THENL + [ASM_MESON_TAC[fan2]; ALL_TAC] THEN + MP_TAC(ISPECL + [`aff_ge {vec 0:real^N} {v1}`; + `aff_ge {vec 0:real^N} {v2,w2}`] SEPARATE_CLOSED_CONES) THEN + ANTS_TAC THENL + [SIMP_TAC[CLOSED_AFF_GE; FINITE_INSERT; FINITE_EMPTY] THEN + REWRITE_TAC[CONJ_ASSOC] THEN CONJ_TAC THENL + [CONJ_TAC THEN MATCH_MP_TAC CONIC_AFF_GE_0 THEN + REWRITE_TAC[FINITE_INSERT; FINITE_EMPTY] THEN ASM SET_TAC[]; + MATCH_MP_TAC(SET_RULE `s = t ==> s SUBSET t`) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM SET_TAC[]]; + ALL_TAC] THEN + SUBGOAL_THEN `(v2:real^N) IN V /\ w2 IN V` + STRIP_ASSUME_TAC THENL + [REPEAT CONJ_TAC THEN + FIRST_X_ASSUM(MATCH_MP_TAC o GEN_REWRITE_RULE I [SUBSET]) THEN + REWRITE_TAC[IN_UNIONS] THEN ASM_MESON_TAC[IN_INSERT]; + ALL_TAC] THEN + DISCH_THEN(X_CHOOSE_THEN `d:real` + (CONJUNCTS_THEN2 ASSUME_TAC (LABEL_TAC "*"))) THEN + MP_TAC(ISPECL [`v2:real^N`; `w2:real^N`; `d / &3`] lemma_2) THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < d / &3 <=> &0 < d`] THEN + DISCH_THEN(X_CHOOSE_THEN `d2:real` + (CONJUNCTS_THEN2 ASSUME_TAC (LABEL_TAC "1"))) THEN + MP_TAC(ISPECL [`v1:real^N`; `d / &3`] lemma_1) THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < d / &3 <=> &0 < d`] THEN + DISCH_THEN(X_CHOOSE_THEN `d1:real` + (CONJUNCTS_THEN2 ASSUME_TAC (LABEL_TAC "2"))) THEN + EXISTS_TAC `(dd:real->real) ((min d1 d2) / &3)` THEN + ASM_SIMP_TAC[REAL_ARITH `&0 < d / &3 <=> &0 < d`; REAL_LT_MIN] THEN + X_GEN_TAC `t:real` THEN DISCH_TAC THEN DISCH_THEN(K ALL_TAC) THEN + REWRITE_TAC[IMAGE_CLAUSES] THEN MATCH_MP_TAC(SET_RULE + `(v IN s /\ v IN t /\ !x. x IN s INTER t ==> x = v) + ==> s INTER t = {v}`) THEN + REWRITE_TAC[Ckqowsa_4_points.points_in_aff_ge_0_2; IN_INTER] THEN + CONJ_TAC THENL + [MESON_TAC[Ckqowsa_4_points.points_in_aff_ge_0_2; INSERT_AC]; + ALL_TAC] THEN + X_GEN_TAC `x:real^N` THEN STRIP_TAC THEN + REMOVE_THEN "1" (MP_TAC o SPECL + [`(phii:real^N->real->real^N) v2 t`; + `(phii:real^N->real->real^N) w2 t`]) THEN + ANTS_TAC THENL + [CONJ_TAC THEN MATCH_MP_TAC REAL_LT_TRANS THEN + EXISTS_TAC `min d1 d2 / &3` THEN + (CONJ_TAC THENL [ALL_TAC; ASM_REAL_ARITH_TAC]) THEN + REWRITE_TAC[ONCE_REWRITE_RULE[NORM_SUB] dist] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_REAL_ARITH_TAC; + DISCH_THEN(MP_TAC o SPEC `x:real^N`) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN(X_CHOOSE_THEN `x1:real^N` STRIP_ASSUME_TAC)] THEN + REMOVE_THEN "2" (MP_TAC o SPEC `(phii:real^N->real->real^N) v1 t`) THEN + ANTS_TAC THENL + [MATCH_MP_TAC REAL_LT_TRANS THEN + EXISTS_TAC `min d1 d2 / &3` THEN + (CONJ_TAC THENL [ALL_TAC; ASM_REAL_ARITH_TAC]) THEN + REWRITE_TAC[ONCE_REWRITE_RULE[NORM_SUB] dist] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_REAL_ARITH_TAC; + DISCH_THEN(MP_TAC o SPEC `x:real^N`) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN(X_CHOOSE_THEN `x2:real^N` STRIP_ASSUME_TAC)]; + + ASM_CASES_TAC `{v1:real^N} INTER {v2} = {}` THENL + [ALL_TAC; + EXISTS_TAC `&1` THEN REWRITE_TAC[REAL_LT_01] THEN ASM SET_TAC[]] THEN + SUBGOAL_THEN `~(v1:real^N = vec 0) /\ ~(v2:real^N = vec 0)` + STRIP_ASSUME_TAC THENL + [ASM_MESON_TAC[fan2]; ALL_TAC] THEN + MP_TAC(ISPECL + [`aff_ge {vec 0:real^N} {v1}`; + `aff_ge {vec 0:real^N} {v2}`] SEPARATE_CLOSED_CONES) THEN + ANTS_TAC THENL + [SIMP_TAC[CLOSED_AFF_GE; FINITE_INSERT; FINITE_EMPTY] THEN + REWRITE_TAC[CONJ_ASSOC] THEN CONJ_TAC THENL + [CONJ_TAC THEN MATCH_MP_TAC CONIC_AFF_GE_0 THEN + REWRITE_TAC[FINITE_INSERT; FINITE_EMPTY] THEN ASM SET_TAC[]; + MATCH_MP_TAC(SET_RULE `s = t ==> s SUBSET t`) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM SET_TAC[]]; + ALL_TAC] THEN + DISCH_THEN(X_CHOOSE_THEN `d:real` + (CONJUNCTS_THEN2 ASSUME_TAC (LABEL_TAC "*"))) THEN + MP_TAC(ISPECL [`v1:real^N`; `d / &3`] lemma_1) THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < d / &3 <=> &0 < d`] THEN + DISCH_THEN(X_CHOOSE_THEN `d1:real` + (CONJUNCTS_THEN2 ASSUME_TAC (LABEL_TAC "1"))) THEN + MP_TAC(ISPECL [`v2:real^N`; `d / &3`] lemma_1) THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < d / &3 <=> &0 < d`] THEN + DISCH_THEN(X_CHOOSE_THEN `d2:real` + (CONJUNCTS_THEN2 ASSUME_TAC (LABEL_TAC "2"))) THEN + EXISTS_TAC `(dd:real->real) ((min d1 d2) / &3)` THEN + ASM_SIMP_TAC[REAL_ARITH `&0 < d / &3 <=> &0 < d`; REAL_LT_MIN] THEN + X_GEN_TAC `t:real` THEN DISCH_TAC THEN DISCH_THEN(K ALL_TAC) THEN + REWRITE_TAC[IMAGE_CLAUSES] THEN MATCH_MP_TAC(SET_RULE + `(v IN s /\ v IN t /\ !x. x IN s INTER t ==> x = v) + ==> s INTER t = {v}`) THEN + REWRITE_TAC[Ckqowsa_4_points.points_in_aff_ge_0_2; IN_INTER] THEN + REPEAT(CONJ_TAC THENL + [MESON_TAC[Ckqowsa_4_points.points_in_aff_ge_0_2; INSERT_AC]; + ALL_TAC]) THEN + X_GEN_TAC `x:real^N` THEN STRIP_TAC THEN + REMOVE_THEN "1" (MP_TAC o SPEC `(phii:real^N->real->real^N) v1 t`) THEN + ANTS_TAC THENL + [MATCH_MP_TAC REAL_LT_TRANS THEN + EXISTS_TAC `min d1 d2 / &3` THEN + (CONJ_TAC THENL [ALL_TAC; ASM_REAL_ARITH_TAC]) THEN + REWRITE_TAC[ONCE_REWRITE_RULE[NORM_SUB] dist] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_REAL_ARITH_TAC; + DISCH_THEN(MP_TAC o SPEC `x:real^N`) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN(X_CHOOSE_THEN `x1:real^N` STRIP_ASSUME_TAC)] THEN + REMOVE_THEN "2" (MP_TAC o SPEC `(phii:real^N->real->real^N) v2 t`) THEN + ANTS_TAC THENL + [MATCH_MP_TAC REAL_LT_TRANS THEN + EXISTS_TAC `min d1 d2 / &3` THEN + (CONJ_TAC THENL [ALL_TAC; ASM_REAL_ARITH_TAC]) THEN + REWRITE_TAC[ONCE_REWRITE_RULE[NORM_SUB] dist] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_REAL_ARITH_TAC; + DISCH_THEN(MP_TAC o SPEC `x:real^N`) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN(X_CHOOSE_THEN `x2:real^N` STRIP_ASSUME_TAC)]] THEN + + (SUBGOAL_THEN + `d * max (norm(x1:real^N)) (norm(x2:real^N)) + <= d * (norm x1 + norm x2) / &3` + MP_TAC THENL + [MATCH_MP_TAC(NORM_ARITH + `norm(x - x1) <= d / &3 * norm x1 /\ + norm(x - x2) <= d / &3 * norm x2 /\ + dist(x1,x2) >= a + ==> a <= d * (norm x1 + norm x2) / &3`) THEN + ASM_SIMP_TAC[] THEN ASM_MESON_TAC[DIST_SYM; REAL_MAX_SYM]; + ASM_SIMP_TAC[REAL_LE_LMUL_EQ] THEN + DISCH_THEN(MP_TAC o MATCH_MP (REAL_ARITH + `max x1 x2 <= (x1 + x2) / &3 + ==> &0 <= x1 /\ &0 <= x2 ==> x1 = &0 /\ x2 = &0`)) THEN + REWRITE_TAC[NORM_POS_LE; NORM_EQ_0] THEN + DISCH_THEN(CONJUNCTS_THEN SUBST_ALL_TAC) THEN + RULE_ASSUM_TAC(REWRITE_RULE[NORM_0; REAL_MUL_RZERO; + NORM_ARITH `norm(x - vec 0) <= &0 <=> x = vec 0`]) THEN + ASM_REWRITE_TAC[]]); + ALL_TAC] THEN + SUBGOAL_THEN + `?e4. &0 < e4 /\ + !t. abs(t) < e4 + ==> fan6(vec 0, + IMAGE (\v. (phii:real^N->real->real^N) v t) V, + IMAGE (IMAGE (\v. phii v t)) E)` + STRIP_ASSUME_TAC THENL + [REWRITE_TAC[fan6; FORALL_IN_IMAGE] THEN + MATCH_MP_TAC MINIMIZE_OVER_MEMBERS THEN + ASM_REWRITE_TAC[] THEN + X_GEN_TAC `ee:real^N->bool` THEN DISCH_TAC THEN + SUBGOAL_THEN `(ee:real^N->bool) HAS_SIZE 2` MP_TAC THENL + [ASM_MESON_TAC[graph; IN]; CONV_TAC(LAND_CONV HAS_SIZE_CONV)] THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`v:real^N`; `w:real^N`] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC) THEN + REWRITE_TAC[IMAGE_CLAUSES; SET_RULE `{a} UNION {b,c} = {a,b,c}`] THEN + MP_TAC(ISPEC `UNIV DIFF {z | collinear{vec 0:real^N,fstcart z,sndcart z}}` + open_def) THEN + REWRITE_TAC[lemma; GSYM closed] THEN + DISCH_THEN(MP_TAC o SPEC `pastecart (v:real^N) (w:real^N)`) THEN + REWRITE_TAC[IN_DIFF; IN_ELIM_THM; IN_UNIV; FSTCART_PASTECART; + SNDCART_PASTECART] THEN + ANTS_TAC THENL + [ASM_MESON_TAC[fan6; SET_RULE `{a} UNION {b,c} = {a,b,c}`]; ALL_TAC] THEN + REWRITE_TAC[FORALL_PASTECART; FSTCART_PASTECART; SNDCART_PASTECART] THEN + DISCH_THEN(X_CHOOSE_THEN `d:real` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `(dd:real->real) (d / &2)` THEN ASM_SIMP_TAC[REAL_HALF] THEN + X_GEN_TAC `t:real` THEN DISCH_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[dist; PASTECART_SUB] THEN + MATCH_MP_TAC(REAL_ARITH + `norm x < d / &2 /\ norm y < d / &2 /\ + norm(pastecart (x:real^N) (y:real^N)) <= norm x + norm y + ==> norm(pastecart x y) < d`) THEN + REWRITE_TAC[NORM_PASTECART_LE] THEN + CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_SIMP_TAC[REAL_HALF] THEN + FIRST_X_ASSUM(MATCH_MP_TAC o GEN_REWRITE_RULE I [SUBSET]) THEN + REWRITE_TAC[IN_UNIONS] THEN ASM_MESON_TAC[IN_INSERT]; + ALL_TAC] THEN + REWRITE_TAC[REAL_ARITH `--e < t /\ t < e <=> abs t < e`] THEN + EXISTS_TAC `min (e1:real) (min e2 (min e3 e4))` THEN + ASM_REWRITE_TAC[REAL_LT_MIN] THEN X_GEN_TAC `t:real` THEN STRIP_TAC THEN + W(MP_TAC o PART_MATCH (lhs o rand) GMLWKPK_SIMPLE o goal_concl) THEN + ASM_SIMP_TAC[] THEN ANTS_TAC THENL + [CONJ_TAC THENL [ALL_TAC; ASM_MESON_TAC[]] THEN + REWRITE_TAC[UNIONS_SUBSET; FORALL_IN_IMAGE] THEN ASM SET_TAC[]; + DISCH_THEN SUBST1_TAC THEN ASM_MESON_TAC[]]);; + +let XRECQNS = prove_by_refinement( + `!a b V E f. + deformation f V (a,b) /\ FAN (vec 0,V,E) ==> + (?e. &0 < e /\ (!t. --e < t /\ t < e ==> + FAN(vec 0, + IMAGE (\v. f (v:real^3) t) V, + IMAGE (IMAGE (\v. f v t)) E)))`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[Fan.FAN]; + INTRO_TAC Localization.ALL_TO_THE_NONPARALLEL_PART_ALT [`a`;`b`;`V`;`E`;`f`]; + ASM_REWRITE_TAC[]; + REPEAT STRIP_TAC; + INTRO_TAC FAN7_SMALL_DEFORMATION [`V`;`E`;`a`;`b`;`f`]; + ASM_REWRITE_TAC[]; + REPEAT STRIP_TAC; + TYPIFY `if (e < e') then e else e'` EXISTS_TAC; + COND_CASES_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[arith `&0 < e /\ e < e' /\ -- e < t /\ t < e ==> -- e' < t /\ t < e'`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[arith `&0 < e' /\ ~(e < e') /\ -- e' < t /\ t < e' ==> -- e < t /\ t < e`]) + ]);; + (* }}} *) + + +end;; diff --git a/text_formalization/local/dih2k.hl b/text_formalization/local/dih2k.hl new file mode 100755 index 0000000..33f1a0f --- /dev/null +++ b/text_formalization/local/dih2k.hl @@ -0,0 +1,3587 @@ + +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2010-04-01 *) +(* ========================================================================= *) + + + + +module Dih2k_hypermap = struct + + + + + + +open Polyhedron;; +open Sphere;; +open Fan_defs;; +open Hypermap;; +open Vol1;; +open Fan;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Sphere;; +open Hypermap;; +open Fan;; +open Topology;; +open Prove_by_refinement;; +open Pack_defs;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; + +parse_as_infix("has_orders",(12,"right"));; + +let cstab=new_definition ` cstab= #3.01`;; + +let rho_fun = new_definition `rho_fun y = &1 + (inv (&2 * h0 - &2)) * (inv pi) * sol0 * (y - &2)`;; + + +let tau_fun = new_definition `tau_fun V E f = sum (f) (\e. rho_fun(norm(FST e)) * (azim_in_fan e E)) - (pi + sol0) * &(CARD f -2)`;; + +(* deprecated 2013-02-26: +let standard = new_definition +` standard v w <=> &2 <= norm(v-w) /\ norm (v-w) <= &2 *h0 `;; + +let protracted = new_definition +` protracted v w <=> &2 * h0 <= norm(v-w) /\ norm (v-w) <= sqrt (&8) `;; + +let diagonal0 = new_definition +` (diagonal0 (E:(real^3->bool)->bool) (v:real^3) (w:real^3)) <=> ~(v = w) /\ ~({v,w} IN E) `;; + +let diagonal1 = new_definition +` diagonal1 (V,E) <=> !v w. ~(v = w) /\ v IN V /\ w IN V /\ ~({v,w} IN E) +==> &2 * h0 <= norm(v-w) `;; + +let main_estimate= new_definition +` main_estimate(V,E,f) <=> + convex_local_fan(V,E,f) /\ +packing V /\ +V SUBSET ball_annulus /\ +diagonal1(V,E) /\ + CARD E= CARD f /\ +3<= CARD E /\ +CARD E <= 6`;; +*) + + +let torsor = new_definition +` torsor (s:A->bool) k (f:A->A) <=> (!x. x IN s ==> (f x) IN s) /\ (!x1 x2. x1 IN s /\ x2 IN s /\ f x1 = f x2 ==> x1=x2) /\ (!i x. 0 < i /\ i < k /\ x IN s ==> ~((f POWER i) x = x)) /\ (!x. x IN s==> (f POWER k) x = x) +/\ s HAS_SIZE k`;; + + +let constraint_system=new_definition +`constraint_system k d (s:A->bool) (a:A#A->real) (b:A#A->real) J f<=> +3<=k /\ k<=6 /\ +torsor s k f/\ +(!i j. a(i,j)= a(j,i) /\ b(i,j)=b(j,i) /\ a(i,j)<= b(i,j)) +/\(!i j. a(i,j)= a(i,(f POWER k) j) /\ b(i,j)=b(i,(f POWER k) j)) +/\ J SUBSET {{i,f i}| i IN s} /\ +CARD J+k<=6`;; + +let stable_system=new_definition +`stable_system k d s a b J f<=> +constraint_system k d s a b J f /\ +(!i j. i IN s /\ j IN s /\ ~(i=j) ==> &2<= a(i,j)) /\ +(!i. i IN s==> a(i,i)= &0 /\ b(i,f i)<= cstab)/\ +(!i j. {i,j} IN J ==> a(i,j)= sqrt(&8) /\ b(i,j) =cstab)`;; + + + +let V_SY=new_definition +`V_SY (v:real^N^M) = rows v`;; + +let E_SY=new_definition +`E_SY (v:real^N^M) = { {row i v,row (SUC(i MOD dimindex(:M))) v } | 1<=i /\ i <= dimindex(:M)}`;; + +let F_SY=new_definition +`F_SY (v:real^N^M) = { (row i v,row (SUC(i MOD dimindex(:M))) v ) | 1<=i /\ i <= dimindex(:M)}`;; + +let CONDITION1_SY=new_definition +`CONDITION1_SY a b (v:real^N^M) +<=> +(!i j. 1<=i /\ i <= dimindex(:M) /\ 1<=j /\ j <= dimindex(:M) +==> +a(i,j)<= norm(row i v- row j v) /\ +norm(row i v- row j v)<= b(i,j)) `;; + + +let CONDITION2_SY=new_definition +`CONDITION2_SY (v:real^3^M) +<=> convex_local_fan(V_SY v,E_SY v,F_SY v)`;; + + + + + + +let finite_product_tybij = + let th = prove + (`?x. x IN 1..(dimindex(:A) * dimindex(:B))`, + EXISTS_TAC `1` THEN SIMP_TAC[IN_NUMSEG; LE_REFL; DIMINDEX_GE_1;] +THEN MRESA1_TAC DIMINDEX_GE_1`(:A)` +THEN MRESA1_TAC DIMINDEX_GE_1`(:B)` +THEN MRESAL_TAC LE_MULT2[`1`;`dimindex(:A)`;`1`;`dimindex(:B)`][ARITH_RULE `1 *1=1`]) + in + new_type_definition "finite_product" ("mk_finite_product","dest_finite_product") th;; + +let matvec = new_definition + `(matvec:(A^N)^M->A^(M,N)finite_product) f = + lambda i. f$ (if i MOD dimindex(:N)=0 then i DIV dimindex(:N) else SUC(i DIV dimindex(:N))) +$(if (i MOD dimindex(:N))=0 then dimindex(:N) else (i MOD dimindex(:N)))`;; + + +let vecmat = new_definition + `(vecmat:num->A^(M,N)finite_product ->A^N) j f = +lambda i. f$(j * dimindex(:N)+i)`;; + +let vecmats= new_definition + `(vecmats:A^(M,N)finite_product ->(A^N)^M) f = +lambda i j. f$((i-1) * dimindex(:N)+j)`;; + + +let B_SY1=new_definition +`B_SY1 a b = {matvec(v:real^3^M) |(!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus) +/\ CONDITION1_SY a b v /\ CONDITION2_SY v}`;; + + +let FINITE_PRODUCT_IMAGE = prove + (`UNIV:(A,B)finite_product->bool = + IMAGE mk_finite_product (1..(dimindex(:A)*dimindex(:B)))`, + REWRITE_TAC[EXTENSION; IN_UNIV; IN_IMAGE] THEN + MESON_TAC[finite_product_tybij]);; + + +let DIMINDEX_HAS_SIZE_FINITE_PRODUCT = prove + (`(UNIV:(M,N)finite_product->bool) HAS_SIZE (dimindex(:M) * dimindex(:N))`, + SIMP_TAC[FINITE_PRODUCT_IMAGE] THEN + MATCH_MP_TAC HAS_SIZE_IMAGE_INJ THEN + ONCE_REWRITE_TAC[DIMINDEX_UNIV] THEN REWRITE_TAC[HAS_SIZE_NUMSEG_1] THEN + MESON_TAC[finite_product_tybij]);; + + +let DIMINDEX_FINITE_PRODUCT = prove + (`dimindex(:(M,N)finite_product) = dimindex(:M) * dimindex(:N)`, + GEN_REWRITE_TAC LAND_CONV [dimindex] THEN + REWRITE_TAC[REWRITE_RULE[HAS_SIZE] DIMINDEX_HAS_SIZE_FINITE_PRODUCT]);; + + +let INDEX_VECMAT=prove(` i< dimindex(:M) /\ 1<= i' /\ i'<= dimindex (:N) ==> +1<= i * dimindex (:N) + i'/\ + i * dimindex (:N) + i'<= dimindex(:(M,N)finite_product) `, +REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`1<= i' ==> 1<=i * dimindex (:N) + i'`) +THEN RESA_TAC +THEN REWRITE_TAC[DIMINDEX_FINITE_PRODUCT] +THEN MRESAL_TAC LE_MULT2[`SUC i`;`dimindex(:M)`;`dimindex(:N)`;`dimindex(:N)`][ARITH_RULE `dimindex(:N)<=dimindex(:N)`;ADD1] +THEN ASM_TAC +THEN ARITH_TAC);; + + +let VECMAT_ROW=prove(` i< dimindex(:M)==> vecmat i (matvec (f:real^N^M))= row (SUC i) f`, +SIMP_TAC[vecmat;matvec;row;CART_EQ;LAMBDA_BETA;GSYM LE_SUC_LT] +THEN REPEAT STRIP_TAC +THEN MRESA1_TAC Hypermap.GE_1`i:num` +THEN ASM_SIMP_TAC[LAMBDA_BETA] +THEN MP_TAC(ARITH_RULE`1<= i' ==> 1<=i * dimindex (:N) + i'`) +THEN RESA_TAC +THEN SUBGOAL_THEN`i * dimindex (:N) + i'<= dimindex(:(M,N)finite_product)` ASSUME_TAC +THENL[ +REWRITE_TAC[DIMINDEX_FINITE_PRODUCT] +THEN MRESAL_TAC LE_MULT2[`SUC i`;`dimindex(:M)`;`dimindex(:N)`;`dimindex(:N)`][ARITH_RULE `dimindex(:N)<=dimindex(:N)`;ADD1] +THEN ASM_TAC +THEN ARITH_TAC; +ASM_SIMP_TAC[LAMBDA_BETA] +THEN MP_TAC(ARITH_RULE`i' <= dimindex (:N)==> i' = dimindex (:N)\/ i' < dimindex (:N)`) +THEN RESA_TAC +THENL[ +REWRITE_TAC[ARITH_RULE`A*B+B=(A+1)*B:num`] +THEN MP_TAC(ARITH_RULE`1<=dimindex (:N)==> 0 ~(i'=0)`) +THEN RESA_TAC +THEN MRESAL_TAC DIVMOD_UNIQ[`i * dimindex (:N) + i'`;`dimindex (:N)`;`i:num`;`i':num`][ARITH_RULE`A+0=A:num`;ADD1]]]);; + + +let VECMATS_MATVEC_ID=prove(`vecmats (matvec A)= A:real^N^M`, + ONCE_REWRITE_TAC[FUN_EQ_THM;CART_EQ;] +THEN SIMP_TAC[LAMBDA_BETA;vecmats;] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`1<= i/\ i<= dimindex (:M) ==> i-1 ASM_TAC THEN REWRITE_TAC[th]) +THEN ARITH_TAC; +MRESAL_TAC DIV_MULT[`dimindex (:N)`;` q:num`][DIMINDEX_NONZERO] +THEN ONCE_REWRITE_TAC[ ARITH_RULE`q * dimindex (:N)= dimindex (:N) * q`;] +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`1<= q==> q-1+1=q`) +THEN ASM_SIMP_TAC[LAMBDA_BETA;ARITH_RULE`a*b+a=a*(b+1)`]; +MRESAL_TAC DIVISION[`i:num`;`dimindex (:N)`][DIMINDEX_NONZERO] +THEN MP_TAC(ARITH_RULE`~(i MOD dimindex (:N) = 0) /\ i MOD dimindex (:N)< dimindex (:N) ==> 1<=i MOD dimindex (:N) /\ i MOD dimindex (:N)<= dimindex (:N) +/\ 1<=SUC (i DIV dimindex (:N))`) +THEN RESA_TAC +THEN MRESAL_TAC LE_LDIV[`dimindex (:N)`;`i:num`;`dimindex (:M)`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ ARITH_RULE`dimindex (:M) * dimindex (:N)= dimindex (:N) * dimindex (:M)`;] +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`i DIV dimindex (:N) <= dimindex (:M) ==> i DIV dimindex (:N) = dimindex (:M) \/ SUC(i DIV dimindex (:N)) <= dimindex (:M)`) + THEN RESA_TAC; +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN ARITH_TAC; +MP_TAC(ARITH_RULE` (SUC (i DIV dimindex (:N)))-1=i DIV dimindex (:N)`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[LAMBDA_BETA;ARITH_RULE`a*b+a=a*(b+1)`] +THEN ASM_MESON_TAC[]]);; + + + + + + + + +let LINEAR_VECMAT = prove + (`linear (vecmat i)`, + SIMP_TAC[linear; vecmat; CART_EQ; LAMBDA_BETA; VECTOR_ADD_COMPONENT; + VECTOR_MUL_COMPONENT; DIMINDEX_FINITE_PRODUCT;]);; + +let VECMAT_VEC = prove + (`!i n. i< dimindex(:M)==> ((vecmat i):real^(M,N)finite_product->real^N) (vec n) = vec n`, + SIMP_TAC[vec; vecmat; LAMBDA_BETA; CART_EQ;] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL INDEX_VECMAT)[`i:num`;`i':num`] +THEN ASM_SIMP_TAC[vec; vecmat; LAMBDA_BETA; CART_EQ;]);; + +let VECMAT_ADD = prove + (`!i x:real^(M,N)finite_product y. (vecmat i) (x + y) = (vecmat i) (x) + (vecmat i) (y)`, + REWRITE_TAC[REWRITE_RULE[linear] LINEAR_VECMAT]);; + + +let VECMAT_CMUL = prove + (`!i x:real^(M,N)finite_product c. (vecmat i)(c % x) = c % (vecmat i)(x)`, + REWRITE_TAC[REWRITE_RULE[linear] LINEAR_VECMAT]);; + +let VECMAT_NEG = prove + (`!i x:real^(M,N)finite_product. --((vecmat i) x) = (vecmat i)(--x)`, + ONCE_REWRITE_TAC[VECTOR_ARITH `--x = --(&1) % x`] THEN + REWRITE_TAC[VECMAT_CMUL]);; + +let VECMAT_SUB = prove + (`!i x:real^(M,N)finite_product y. (vecmat i)(x - y) = (vecmat i)(x) - (vecmat i)(y)`, + REWRITE_TAC[VECTOR_SUB; VECMAT_NEG; VECMAT_ADD]);; + +let FSTCART_VSUM = prove + (`!k x i. FINITE k ==> i< dimindex(:M) ==> ((vecmat i)(vsum k x) = vsum k (\i'. ((vecmat i):real^(M,N)finite_product->real^N)(x i')))`, + REWRITE_TAC[RIGHT_FORALL_IMP_THM] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG +THEN + SIMP_TAC[VSUM_CLAUSES; FINITE_RULES; VECMAT_ADD; VECMAT_VEC]);; + + +let MATVEC_ADD = prove(`matvec (x:real^N^M) + matvec y= matvec (x +y) `, +SIMP_TAC[matvec;LAMBDA_BETA;CART_EQ;matrix_add;vector_add;DIMINDEX_FINITE_PRODUCT] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`i MOD dimindex (:N) =0\/ ~(i MOD dimindex (:N)=0)`) +THENL[ +ASM_REWRITE_TAC[] +THEN MRESAL_TAC DIV_MULT[`dimindex (:N)`;`dimindex (:M)`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ARITH_RULE`dimindex (:N) * dimindex (:M)=dimindex (:M) * dimindex (:N)`] +THEN STRIP_TAC +THEN MRESAL_TAC MOD_EQ_0[`i:num`;`dimindex (:N)`][DIMINDEX_NONZERO] +THEN MRESAL_TAC DIV_MONO[`i:num`;`dimindex (:M)* dimindex (:N)`;`dimindex (:N)`][DIMINDEX_NONZERO] +THEN DISJ_CASES_TAC(ARITH_RULE`q= 0\/ 1<=q`) +THENL[POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;ARITH_RULE`0*A=0`]) +THEN ARITH_TAC; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ARITH_RULE`q * dimindex (:N)=dimindex (:N) * q`] +THEN MRESAL_TAC DIV_MULT[`dimindex (:N)`;`q:num`][DIMINDEX_NONZERO] +THEN MP_TAC(ARITH_RULE`dimindex (:N)<=dimindex (:N)`) +THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` +THEN ASM_SIMP_TAC[LAMBDA_BETA;]]; +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`1 <= SUC (i DIV dimindex (:N))` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`]; +MRESAL_TAC DIVISION[`i:num`;`dimindex (:N):num`][DIMINDEX_NONZERO] +THEN MP_TAC(ARITH_RULE`~(i MOD dimindex (:N) = 0) /\ i MOD dimindex (:N) < dimindex (:N) ==> 1<= i MOD dimindex (:N) /\ i MOD dimindex (:N) <= dimindex (:N) `) +THEN RESA_TAC +THEN MRESAL_TAC DIV_MULT[`dimindex (:N)`;`dimindex (:M)`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ARITH_RULE`dimindex (:N) * dimindex (:M)=dimindex (:M) * dimindex (:N)`] +THEN STRIP_TAC +THEN MRESAL_TAC MOD_EQ_0[`i:num`;`dimindex (:N)`][DIMINDEX_NONZERO] +THEN MRESAL_TAC DIV_MONO[`i:num`;`dimindex (:M)* dimindex (:N)`;`dimindex (:N)`][DIMINDEX_NONZERO] +THEN MP_TAC(ARITH_RULE`i DIV dimindex (:N)<= dimindex (:M)==> i DIV dimindex (:N)= dimindex (:M) \/ SUC(i DIV dimindex (:N))<= dimindex (:M)`) +THEN RESA_TAC +THENL[ +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(ARITH_RULE`i = dimindex (:M) * dimindex (:N) + i MOD dimindex (:N) /\ ~(i MOD dimindex (:N)= 0) +==> dimindex (:M) * dimindex (:N)< i`) +THEN ASM_SIMP_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[] +THEN ASM_TAC +THEN ARITH_TAC; +ASM_SIMP_TAC[LAMBDA_BETA;]]]]);; + + +let MATVEC_SUB = prove(`matvec (x:real^N^M) - matvec y= matvec (x -y) `, +SIMP_TAC[matvec;LAMBDA_BETA;CART_EQ;matrix_sub;vector_sub;DIMINDEX_FINITE_PRODUCT] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`i MOD dimindex (:N) =0\/ ~(i MOD dimindex (:N)=0)`) +THENL[ +ASM_REWRITE_TAC[] +THEN MRESAL_TAC DIV_MULT[`dimindex (:N)`;`dimindex (:M)`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ARITH_RULE`dimindex (:N) * dimindex (:M)=dimindex (:M) * dimindex (:N)`] +THEN STRIP_TAC +THEN MRESAL_TAC MOD_EQ_0[`i:num`;`dimindex (:N)`][DIMINDEX_NONZERO] +THEN MRESAL_TAC DIV_MONO[`i:num`;`dimindex (:M)* dimindex (:N)`;`dimindex (:N)`][DIMINDEX_NONZERO] +THEN DISJ_CASES_TAC(ARITH_RULE`q= 0\/ 1<=q`) +THENL[POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;ARITH_RULE`0*A=0`]) +THEN ARITH_TAC; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ARITH_RULE`q * dimindex (:N)=dimindex (:N) * q`] +THEN MRESAL_TAC DIV_MULT[`dimindex (:N)`;`q:num`][DIMINDEX_NONZERO] +THEN MP_TAC(ARITH_RULE`dimindex (:N)<=dimindex (:N)`) +THEN MRESA1_TAC DIMINDEX_GE_1`(:N)` +THEN ASM_SIMP_TAC[LAMBDA_BETA;]]; +ASM_REWRITE_TAC[] +THEN SUBGOAL_THEN`1 <= SUC (i DIV dimindex (:N))` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`]; +MRESAL_TAC DIVISION[`i:num`;`dimindex (:N):num`][DIMINDEX_NONZERO] +THEN MP_TAC(ARITH_RULE`~(i MOD dimindex (:N) = 0) /\ i MOD dimindex (:N) < dimindex (:N) ==> 1<= i MOD dimindex (:N) /\ i MOD dimindex (:N) <= dimindex (:N) `) +THEN RESA_TAC +THEN MRESAL_TAC DIV_MULT[`dimindex (:N)`;`dimindex (:M)`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ARITH_RULE`dimindex (:N) * dimindex (:M)=dimindex (:M) * dimindex (:N)`] +THEN STRIP_TAC +THEN MRESAL_TAC MOD_EQ_0[`i:num`;`dimindex (:N)`][DIMINDEX_NONZERO] +THEN MRESAL_TAC DIV_MONO[`i:num`;`dimindex (:M)* dimindex (:N)`;`dimindex (:N)`][DIMINDEX_NONZERO] +THEN MP_TAC(ARITH_RULE`i DIV dimindex (:N)<= dimindex (:M)==> i DIV dimindex (:N)= dimindex (:M) \/ SUC(i DIV dimindex (:N))<= dimindex (:M)`) +THEN RESA_TAC +THENL[ +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN MP_TAC(ARITH_RULE`i = dimindex (:M) * dimindex (:N) + i MOD dimindex (:N) /\ ~(i MOD dimindex (:N)= 0) +==> dimindex (:M) * dimindex (:N)< i`) +THEN ASM_SIMP_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN REWRITE_TAC[] +THEN ASM_TAC +THEN ARITH_TAC; +ASM_SIMP_TAC[LAMBDA_BETA;]]]]);; + + + + +let NORM_VECMAT = prove + (`!x. i< dimindex(:M) ==> norm(((vecmat i):real^(M,N)finite_product->real^N) x) <= norm x`, + GEN_TAC THEN + SIMP_TAC[SQRT_MONO_LE_EQ; DOT_POS_LE; vector_norm] +THEN + SIMP_TAC[vecmat; dot; DIMINDEX_FINITE_PRODUCT; LAMBDA_BETA; DIMINDEX_NONZERO; + SUM_ADD_SPLIT; REAL_LE_ADDR; SUM_POS_LE; FINITE_NUMSEG; + REAL_LE_SQUARE; ARITH_RULE `a+b = b+a:num`; + ARITH_RULE `~(d = 0) ==> 1 <= d + 1`;GSYM LE_SUC_LT] +THEN STRIP_TAC +THEN MRESA_TAC SUM_OFFSET[`i * dimindex (:N)`;`(\i:num. x$i * (x:real^(M,N)finite_product)$i)`;`1`;`dimindex (:N)`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;ARITH_RULE`A+ B*A=(B+1)*A`]) +THEN ASSUME_TAC(ARITH_RULE` 1<=1+i * dimindex (:N)/\ 0< 1+i * dimindex (:N)`) +THEN MRESAL_TAC LE_MULT2[`SUC i`;`dimindex(:M)`;`dimindex(:N)`;`dimindex(:N)`][ARITH_RULE `dimindex(:N)<=dimindex(:N)`;ADD1] +THEN MP_TAC(ARITH_RULE` +1<= dimindex (:N)/\ 0< 1+i * dimindex (:N)/\ +(i + 1) * dimindex (:N) <= dimindex (:M) * dimindex (:N) +==> 1 + i * dimindex (:N)<=dimindex (:M) * dimindex (:N)+1 +/\ (i + 1) * dimindex (:N) <= dimindex (:M) * dimindex (:N)+1/\ +1 + i * dimindex (:N)<= (i+1) * dimindex (:N)+1 +/\ 0< (i+1) * dimindex (:N)`) +THEN ASM_SIMP_TAC[DIMINDEX_GE_1] +THEN RESA_TAC +THEN MRESA_TAC SUM_COMBINE_L[`(\i:num. x$i * (x:real^(M,N)finite_product)$i)`;`1`;`1 + i * dimindex (:N)`;`dimindex (:M) * dimindex (:N)`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC SUM_COMBINE_R[`(\i:num. x$i * (x:real^(M,N)finite_product)$i)`;`1 + i * dimindex (:N)`;`(i+1) * dimindex (:N)`;`dimindex (:M) * dimindex (:N)`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MATCH_MP_TAC(REAL_ARITH`&0<= b /\ &0<=c==> a<=b+a+c`) +THEN STRIP_TAC +THEN SIMP_TAC[REAL_LE_SQUARE;REAL_LE_ADDR; SUM_POS_LE;FINITE_NUMSEG;]);; + + +let DIST_VECMAT = prove + (`!x y. i< dimindex(:M) ==> dist(((vecmat i):real^(M,N)finite_product->real^N) x,(vecmat i) y) <= dist(x,y)`, + REWRITE_TAC[dist; GSYM VECMAT_SUB; NORM_VECMAT]);; + + +let DOT_VECMAT = prove_by_refinement( `!x y:real^(M,N)finite_product. +sum (0..(dimindex(:M)-1)) (\i. ((vecmat i):real^(M,N)finite_product->real^N) x dot (vecmat i) y) = x dot y`, +[ SIMP_TAC[vecmat; dot; LAMBDA_BETA; DIMINDEX_FINITE_PRODUCT;ARITH_RULE `a+b = b+a:num`;] +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`(\i. sum (1..dimindex (:N)) + (\i'. (x:real^(M,N)finite_product)$(i' + i * dimindex (:N)) * y$(i' + i * dimindex (:N))))= (\i. sum (1+i * dimindex (:N) ..(i+1)*dimindex (:N)) + (\i'. x$i' * (y:real^(M,N)finite_product)$i'))`(fun th-> REWRITE_TAC[th]); +SIMP_TAC[FUN_EQ_THM;] +THEN STRIP_TAC +THEN MRESAL_TAC SUM_OFFSET[`x' * dimindex (:N)`;`(\i'. (x:real^(M,N)finite_product)$(i') * (y:real^(M,N)finite_product)$(i'))`;`1`;`dimindex (:N)`][ARITH_RULE`A+B*A=(B+1)*A`]; +ABBREV_TAC `n= dimindex (:N)` +THEN ABBREV_TAC `m= dimindex (:M)-1` +THEN SUBGOAL_THEN`dimindex (:M)= SUC m`(fun th-> REWRITE_TAC[th]); +SIMP_TAC[ADD1] +THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` +THEN EXPAND_TAC"m" +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +SPEC_TAC (`m:num`,`m:num`) +THEN INDUCT_TAC; + ASM_SIMP_TAC[SUM_SING_NUMSEG;ARITH_RULE`1+ 0*n=1 /\ (0+1) *n=n /\ 1 *n=n`;ADD1]; +MRESA1_TAC Hypermap.GE_1`m':num` +THEN MP_TAC(ARITH_RULE`1<= SUC m'==> 0<= SUC m'`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[SUM_CLAUSES_NUMSEG;ADD1;ARITH_RULE`a+b = b+a:num`] +THEN MRESAL_TAC SUM_COMBINE_R[`(\i:num. (x:real^(M,N)finite_product)$i * (y:real^(M,N)finite_product)$i)`;`1`;`(m'+1) * n`;`(1+ m' +1) *n`][ARITH_RULE`1<= A+1`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESAL_TAC LE_MULT2[`(m' + 1)`;`1+m' + 1`;`dimindex(:N)`;`dimindex(:N)`][ARITH_RULE `dimindex(:N)<=dimindex(:N)/\ a<= 1+a`;ADD1]]);; + + +let NORM_VECMAT_SUM = prove_by_refinement( + `!x:real^(M,N)finite_product. norm x <= sum (0..(dimindex(:M)-1)) (\i. norm(((vecmat i):real^(M,N)finite_product->real^N) x)) `, +[GEN_TAC +THEN SUBGOAL_THEN`&0<= sum (1..dimindex (:M) * dimindex (:N)) (\i. (x:real^(M,N)finite_product)$i * x$i)` ASSUME_TAC; +MATCH_MP_TAC SUM_POS_LE_NUMSEG +THEN REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[LAMBDA_BETA;REAL_LE_SQUARE]; +POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`!i. &0<=sum (1..dimindex (:N)) (\i'. vecmat i x$i' * vecmat i (x:real^(M,N)finite_product)$i')` ASSUME_TAC; +GEN_TAC +THEN MATCH_MP_TAC SUM_POS_LE_NUMSEG +THEN REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[LAMBDA_BETA;REAL_LE_SQUARE]; +POP_ASSUM MP_TAC +THEN MRESA_TAC DOT_VECMAT[`x:real^(M,N)finite_product`;`x:real^(M,N)finite_product`] +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[vector_norm;dot;DIMINDEX_FINITE_PRODUCT] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ABBREV_TAC `n= dimindex (:N)` +THEN ABBREV_TAC `m= dimindex (:M)-1` +THEN SUBGOAL_THEN`dimindex (:M)= SUC m`(fun th-> REWRITE_TAC[th] ); +SIMP_TAC[ADD1] +THEN MRESA1_TAC DIMINDEX_GE_1`(:M)` +THEN EXPAND_TAC"m" +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + SPEC_TAC (`m:num`,`m:num`) +THEN INDUCT_TAC; +STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`0`) +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[SUM_SING_NUMSEG;ARITH_RULE`1+ 0*n=1 /\ (0+1) *n=n /\ 1 *n=n /\ 0*n+i=i/\ 0+1=1`;ADD1;vecmat;] +THEN REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[SQRT_MONO_LE_EQ] +THEN MATCH_MP_TAC SUM_LE_NUMSEG +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC (GEN_ALL INDEX_VECMAT)[`0:num`;`i:num`][ARITH_RULE`0 * n +a=a /\ 0<1 `] +THEN ASM_SIMP_TAC[LAMBDA_BETA;REAL_LE_REFL]; +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`&0 <= + sum (0..m') (\i. sum (1..n) (\i'. vecmat i (x:real^(M,N)finite_product)$i' * vecmat i x$i'))` ASSUME_TAC; +MATCH_MP_TAC SUM_POS_LE_NUMSEG +THEN REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[LAMBDA_BETA;REAL_LE_SQUARE]; +REMOVE_THEN "THY" MP_TAC +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MRESA1_TAC Hypermap.GE_1`m':num` +THEN MP_TAC(ARITH_RULE`1<= SUC m'==> 0<= SUC m'`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[SUM_CLAUSES_NUMSEG] +THEN MATCH_MP_TAC REAL_LE_LSQRT +THEN STRIP_TAC; +MATCH_MP_TAC (REAL_ARITH`&0<=a /\ &0<= b==> &0<= a+b`) +THEN STRIP_TAC +THEN MATCH_MP_TAC SUM_POS_LE_NUMSEG +THEN REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[LAMBDA_BETA;REAL_LE_SQUARE]; +STRIP_TAC; +MATCH_MP_TAC (REAL_ARITH`&0<=a /\ &0<= b==> &0<= a+b`) +THEN STRIP_TAC; +MATCH_MP_TAC SUM_POS_LE_NUMSEG +THEN REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[LAMBDA_BETA;REAL_LE_SQUARE] +THEN MATCH_MP_TAC SQRT_POS_LE +THEN MATCH_MP_TAC SUM_POS_LE_NUMSEG +THEN REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[LAMBDA_BETA;REAL_LE_SQUARE]; +MATCH_MP_TAC SQRT_POS_LE +THEN MATCH_MP_TAC SUM_POS_LE_NUMSEG +THEN REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[LAMBDA_BETA;REAL_LE_SQUARE]; + SIMP_TAC[REAL_POW_2; REAL_ARITH + ` (x + y) * (x + y) =x*x + y*y + &2 * x * y`;REAL_ARITH + `&0 <= y * (y * x * x - x * d) - x * (y * d - x * y * y) <=> + x * y * d <= x * y * x * y`] +THEN SUBGOAL_THEN`&0<=sum (1..n) (\i'. vecmat (SUC m') x$i' * vecmat (SUC m') (x:real^(M,N)finite_product) +$i')` ASSUME_TAC; +MATCH_MP_TAC SUM_POS_LE_NUMSEG +THEN REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[LAMBDA_BETA;REAL_LE_SQUARE]; +ASM_SIMP_TAC[GSYM REAL_POW_2;SQRT_POW_2;REAL_ARITH`a+b<=c+b+d<=> a<=c+d` +;] +THEN MATCH_MP_TAC(REAL_ARITH`a<=b /\ &0<= c==> a<= b+ &2 * c`) +THEN ASM_SIMP_TAC[ REAL_LSQRT_LE;REAL_POW_2] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN STRIP_TAC; +MATCH_MP_TAC SUM_POS_LE_NUMSEG +THEN REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[LAMBDA_BETA;REAL_LE_SQUARE] +THEN MATCH_MP_TAC SQRT_POS_LE +THEN MATCH_MP_TAC SUM_POS_LE_NUMSEG +THEN REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[LAMBDA_BETA;REAL_LE_SQUARE]; +MATCH_MP_TAC SQRT_POS_LE +THEN MATCH_MP_TAC SUM_POS_LE_NUMSEG +THEN REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[LAMBDA_BETA;REAL_LE_SQUARE]]);; + + +let BOUNDED_MATVEC = prove + (`!s:num->real^N->bool. + (!i. 1<=i /\ i <= dimindex(:M) ==> bounded (s i)) ==> bounded {matvec(x:real^N^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i x IN s i)}`, + REPEAT GEN_TAC THEN REWRITE_TAC[bounded; IN_ELIM_THM;] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[RIGHT_IMP_EXISTS_THM] +THEN REWRITE_TAC[SKOLEM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN ABBREV_TAC`b=sum (0..(dimindex(:M)-1)) (\i. a (SUC i))` +THEN EXISTS_TAC`b:real` +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY1") +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESA1_TAC NORM_VECMAT_SUM`x:real^(M,N)finite_product` +THEN MATCH_MP_TAC(REAL_ARITH`!a B C. a<= B/\ B<= C==> a<= C`) +THEN EXISTS_TAC`sum (0..dimindex (:M) - 1) (\i. norm (vecmat i (matvec (x':real^N^M))))` +THEN ASM_REWRITE_TAC[] +THEN EXPAND_TAC"b" +THEN MATCH_MP_TAC SUM_LE_NUMSEG +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`i <= dimindex (:M) - 1 /\ 1 <= dimindex (:M) ==> i < dimindex (:M) /\ SUC i <= dimindex (:M) /\ 1<= SUC i`) +THEN SIMP_TAC[DIMINDEX_GE_1] +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`i:num`;`x':real^N^M`] +THEN REMOVE_THEN "THY1"(fun th-> MRESA1_TAC th`SUC i`) +THEN REMOVE_THEN "THY"(fun th-> MRESA1_TAC th`SUC i`) +THEN POP_ASSUM (fun th-> MRESA1_TAC th`row (SUC i) (x':real^N^M)`));; + + +let CLOSED_MATVEC = prove + (`!s:num->real^N->bool. + (!i. 1<=i /\ i <= dimindex(:M) ==> closed (s i)) ==> closed {matvec(x:real^N^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i x IN s i)}`, + REPEAT GEN_TAC THEN REWRITE_TAC[CLOSED_SEQUENTIAL_LIMITS] THEN REWRITE_TAC[LIM_SEQUENTIALLY; IN_ELIM_THM; dist] +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`vecmats (l:real^(M,N)finite_product)` +THEN SIMP_TAC[MATVEC_VECMATS_ID] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SKOLEM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY1") +THEN DISCH_THEN(LABEL_TAC"THY2") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THY"(fun th-> MRESA1_TAC th`i:num`) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY3") +THEN SUBGOAL_THEN`(!n. row i ((x':num->real^N^M) n) IN s i)`ASSUME_TAC +THENL[ +GEN_TAC +THEN REMOVE_THEN "THY1"(fun th-> MRESA1_TAC th`n:num`) +THEN ASM_SIMP_TAC[]; +SUBGOAL_THEN`(!e. &0 < e ==> (?N. !n. N <= n ==> norm (row i ((x':num->real^N^M) n) - row i (vecmats (l:real^(M,N)finite_product))) < e))`ASSUME_TAC +THENL[ +REPEAT STRIP_TAC +THEN REMOVE_THEN "THY2"(fun th-> MRESA1_TAC th`e:real`) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY2") +THEN EXISTS_TAC`N:num` +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THY2"(fun th-> MRESA1_TAC th`n:num`) +THEN MP_TAC(ARITH_RULE`1<=i /\ i <= dimindex (:M)==> i -1 < dimindex (:M)/\ SUC(i-1)=i`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`i-1`;`((x':num->real^N^M) n)`] +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`i-1`;`vecmats (l:real^(M,N)finite_product)`] +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[MATVEC_VECMATS_ID] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL NORM_VECMAT)[`i-1`;`matvec ((x':num->real^N^M) n) - (l:real^(M,N)finite_product)`][VECMAT_SUB] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +REMOVE_THEN "THY3"(fun th-> MRESA_TAC th[`(\n. row i ((x':num->real^N^M) n))`;`row i (vecmats (l:real^(M,N)finite_product))`])]]);; + + + +let COMPACT_MATVEC = prove + (`!s:num->real^N->bool. + (!i. 1<=i /\ i <= dimindex(:M) ==> compact (s i)) ==> compact {matvec(x:real^N^M) | (!i. 1<=i /\ i <= dimindex(:M)==> row i x IN s i)}`, + SIMP_TAC[COMPACT_EQ_BOUNDED_CLOSED; BOUNDED_MATVEC; CLOSED_MATVEC]);; + + + +let CLOSED_BALL_ANNULUS=prove(` closed ball_annulus`, +REWRITE_TAC[ball_annulus] +THEN MATCH_MP_TAC CLOSED_DIFF +THEN SIMP_TAC[CLOSED_CBALL;OPEN_BALL]);; + +let BOUNDED_BALL_ANNULUS=prove(` bounded ball_annulus`, +REWRITE_TAC[ball_annulus] +THEN MRESAL_TAC BOUNDED_SUBSET[`(cball (vec 0,&2 * h0) DIFF ball ((vec 0:real^3),&2))`;`cball ((vec 0:real^3),&2 * h0)`][BOUNDED_CBALL] +THEN POP_ASSUM MATCH_MP_TAC +THEN SET_TAC[]);; + + +let COMPACT_BALL_ANNULUS=prove(` compact ball_annulus`, + SIMP_TAC[COMPACT_EQ_BOUNDED_CLOSED; BOUNDED_BALL_ANNULUS; CLOSED_BALL_ANNULUS]);; + + +let COMPACT_BALL_ANNULUS_MATVEC=prove(` compact{matvec(v:real^3^M) |(!i. 1<=i /\ i <= dimindex(:M)==> row i v IN ball_annulus)}`, +SIMP_TAC[COMPACT_MATVEC;COMPACT_BALL_ANNULUS]);; + + +let CLOSED_CONDITION1_SY=prove(`closed {matvec(v:real^N^M) |CONDITION1_SY a b v }`, +REWRITE_TAC[CONDITION1_SY] +THEN REPEAT GEN_TAC THEN REWRITE_TAC[CLOSED_SEQUENTIAL_LIMITS] THEN REWRITE_TAC[LIM_SEQUENTIALLY; IN_ELIM_THM; dist] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`vecmats (l:real^(M,N)finite_product)` +THEN SIMP_TAC[MATVEC_VECMATS_ID] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SKOLEM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY1") +THEN DISCH_THEN(LABEL_TAC"THY2") +THEN REPEAT GEN_TAC +THEN STRIP_TAC +THEN SUBGOAL_THEN`((\n. row i (v n) - row j ((v:num->real^N^M) n)) --> row i (vecmats l) - row j (vecmats (l:real^(M,N)finite_product))) + sequentially`ASSUME_TAC +THENL[ +SIMP_TAC[EVENTUALLY_SEQUENTIALLY;TRIVIAL_LIMIT_SEQUENTIALLY;LIM_SEQUENTIALLY] +THEN REPEAT STRIP_TAC +THEN SIMP_TAC[dist;VECTOR_ARITH`A-B-(C-D)=(A-C)-(B-D):real^N`] +THEN MP_TAC(REAL_ARITH`&0< e==> &0< e/ &2`) +THEN RESA_TAC +THEN REMOVE_THEN "THY2"(fun th-> MRESA1_TAC th`e/ &2:real`) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY2") +THEN EXISTS_TAC`N:num` +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THY2"(fun th-> MRESA1_TAC th`n:num`) +THEN MP_TAC(ARITH_RULE`1<=i /\ i <= dimindex (:M)==> i -1 < dimindex (:M)/\ SUC(i-1)=i`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`1<=j /\ j <= dimindex (:M)==> j -1 < dimindex (:M)/\ SUC(j-1)=j`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`i-1`;`((v:num->real^N^M) n)`] +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`i-1`;`vecmats (l:real^(M,N)finite_product)`] +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[MATVEC_VECMATS_ID] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL NORM_VECMAT)[`i-1`;`matvec ((v:num->real^N^M) n) - (l:real^(M,N)finite_product)`][VECMAT_SUB] +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`j-1`;`((v:num->real^N^M) n)`] +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`j-1`;`vecmats (l:real^(M,N)finite_product)`] +THEN POP_ASSUM MP_TAC +THEN SIMP_TAC[MATVEC_VECMATS_ID] +THEN STRIP_TAC +THEN MRESAL_TAC (GEN_ALL NORM_VECMAT)[`j-1`;`matvec ((v:num->real^N^M) n) - (l:real^(M,N)finite_product)`][VECMAT_SUB] +THEN MRESAL_TAC NORM_TRIANGLE[`row i ((v:num->real^N^M) n) - row i (vecmats (l:real^(M,N)finite_product))`;`--(row j ((v:num->real^N^M) n) - row j (vecmats (l:real^(M,N)finite_product)))`][NORM_NEG;VECTOR_ARITH`A+ --B=A-B:real^N` ] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +STRIP_TAC +THENL[ +MRESA_TAC LIM_NORM_LBOUND[`sequentially`;`(\n. row i (v n) - row j ((v:num->real^N^M) n))`;`row i (vecmats l) - row j (vecmats (l:real^(M,N)finite_product))`;`(a:num#num->real)(i,j)`] +THEN POP_ASSUM MATCH_MP_TAC +THEN SIMP_TAC[EVENTUALLY_SEQUENTIALLY;TRIVIAL_LIMIT_SEQUENTIALLY;LIM_SEQUENTIALLY] +THEN EXISTS_TAC`0` +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THY1"(fun th-> MRESA1_TAC th`n:num`) +THEN ASM_SIMP_TAC[]; +MRESA_TAC LIM_NORM_UBOUND[`sequentially`;`(\n. row i (v n) - row j ((v:num->real^N^M) n))`;`row i (vecmats l) - row j (vecmats (l:real^(M,N)finite_product))`;`(b:num#num->real)(i,j)`] +THEN POP_ASSUM MATCH_MP_TAC +THEN SIMP_TAC[EVENTUALLY_SEQUENTIALLY;TRIVIAL_LIMIT_SEQUENTIALLY;LIM_SEQUENTIALLY] +THEN EXISTS_TAC`0` +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THY1"(fun th-> MRESA1_TAC th`n:num`) +THEN ASM_SIMP_TAC[]]]);; + + +let SUC_NOT=prove(`1 1 <= SUC (i MOD k) /\ + SUC (i MOD k) <= k /\ + ~(i = SUC (i MOD k))` , +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`1 < k==> ~(1=k) /\ ~(k=0)`) +THEN RESA_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`i MOD k < k==> SUC(i MOD k) <= k`) +THEN RESA_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`i k=i:num`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th]) +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC MOD_MULT[`m:num`;`1:num`][ARITH_RULE`m*1=m/\ SUC 0=1`]]);; + +let NONPARALLEL_BALL_ANNULUS=prove_by_refinement(`&2<= norm(v-w) /\ norm(v-w)<= cstab /\ v IN ball_annulus /\ w IN ball_annulus +==> ~(collinear ({vec 0} UNION {v,w}))`, +[REWRITE_TAC[SET_RULE`{A} UNION {B,C}={A,B,C}`;GSYM NORM_CAUCHY_SCHWARZ_EQUAL;NORM_LE_SQUARE;NORM_LT_SQUARE;] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A<=B <=> B >= A`] +THEN REWRITE_TAC[NORM_GE_SQUARE;REAL_ARITH`~(&2<= &0) /\ &0 < &2`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A>=B <=> B <= A`] +THEN REWRITE_TAC[DOT_RSUB;DOT_LSUB;DOT_SQUARE_NORM] +THEN DISJ_CASES_TAC(REAL_ARITH`&0<= v dot w \/ &0<= --(v dot (w:real^3))`); +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM REAL_ABS_REFL] +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC THEN MP_TAC th) +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] ) +THEN REWRITE_TAC[REAL_ARITH`A pow 2 -A*B-(A*B-B pow 2)=(A-B) pow 2`;GSYM REAL_LE_SQUARE_ABS;ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0 -A= --A`;NORM_NEG;REAL_ARITH`~(a b<=a`] +THEN DISJ_CASES_TAC(REAL_ARITH`&0<= norm (v:real^3) -norm w \/ &0<= --(norm v -norm (w:real^3))`); +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM REAL_ABS_REFL] +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`norm (v:real^3) <= &2 * h0 /\ &2 <= norm (w:real^3) ==> norm v - norm w <= &2*(h0 - &1)`) +THEN ASM_REWRITE_TAC[h0] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM REAL_ABS_REFL;REAL_ABS_NEG] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[REAL_ARITH`--(A-B)=B-A`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`norm (w:real^3) <= &2 * h0 /\ &2 <= norm (v:real^3) ==> norm w - norm v <= &2*(h0 - &1)`) +THEN ASM_REWRITE_TAC[h0] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM REAL_ABS_REFL;REAL_ABS_NEG] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[REAL_ARITH`--A=B<=> A= --B`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC THEN MP_TAC th) +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] ) +THEN REWRITE_TAC[REAL_ARITH`A pow 2 -(--(A*B))-(--(A*B)-B pow 2)=(A+B) pow 2`;GSYM REAL_LE_SQUARE_ABS;ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0 -A= --A`;NORM_NEG;REAL_ARITH`~(a b<=a`] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN MP_TAC(REAL_ARITH`&0<= norm (v:real^3) /\ &0<= norm (w:real^3)==> &0<= norm v + norm w`) +THEN SIMP_TAC[NORM_POS_LE] +THEN REWRITE_TAC[GSYM REAL_ABS_REFL] +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&2<=norm (w:real^3) /\ &2 <= norm (v:real^3) ==> &4<= norm v + norm w `) +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC]);; + +(* inserted by tch 2013-04-20 *) + +let NONPARALLEL_BALL_ANNULUS362 =prove_by_refinement(`&2<= norm(v-w) /\ norm(v-w)<= #3.62 /\ v IN ball_annulus /\ w IN ball_annulus +==> ~(collinear ({vec 0} UNION {v,w}))`, +[REWRITE_TAC[SET_RULE`{A} UNION {B,C}={A,B,C}`;GSYM NORM_CAUCHY_SCHWARZ_EQUAL;NORM_LE_SQUARE;NORM_LT_SQUARE;] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A<=B <=> B >= A`] +THEN REWRITE_TAC[NORM_GE_SQUARE;REAL_ARITH`~(&2<= &0) /\ &0 < &2`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A>=B <=> B <= A`] +THEN REWRITE_TAC[DOT_RSUB;DOT_LSUB;DOT_SQUARE_NORM] +THEN DISJ_CASES_TAC(REAL_ARITH`&0<= v dot w \/ &0<= --(v dot (w:real^3))`); +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM REAL_ABS_REFL] +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC THEN MP_TAC th) +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] ) +THEN REWRITE_TAC[REAL_ARITH`A pow 2 -A*B-(A*B-B pow 2)=(A-B) pow 2`;GSYM REAL_LE_SQUARE_ABS;ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0 -A= --A`;NORM_NEG;REAL_ARITH`~(a b<=a`] +THEN DISJ_CASES_TAC(REAL_ARITH`&0<= norm (v:real^3) -norm w \/ &0<= --(norm v -norm (w:real^3))`); +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM REAL_ABS_REFL] +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`norm (v:real^3) <= &2 * h0 /\ &2 <= norm (w:real^3) ==> norm v - norm w <= &2*(h0 - &1)`) +THEN ASM_REWRITE_TAC[h0] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM REAL_ABS_REFL;REAL_ABS_NEG] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[REAL_ARITH`--(A-B)=B-A`] +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`norm (w:real^3) <= &2 * h0 /\ &2 <= norm (v:real^3) ==> norm w - norm v <= &2*(h0 - &1)`) +THEN ASM_REWRITE_TAC[h0] +THEN ASM_TAC +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM REAL_ABS_REFL;REAL_ABS_NEG] +THEN RESA_TAC +THEN ONCE_REWRITE_TAC[REAL_ARITH`--A=B<=> A= --B`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC THEN MP_TAC th) +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[DOT_SYM] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] ) +THEN REWRITE_TAC[REAL_ARITH`A pow 2 -(--(A*B))-(--(A*B)-B pow 2)=(A+B) pow 2`;GSYM REAL_LE_SQUARE_ABS;ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0 -A= --A`;NORM_NEG;REAL_ARITH`~(a b<=a`] +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN MP_TAC(REAL_ARITH`&0<= norm (v:real^3) /\ &0<= norm (w:real^3)==> &0<= norm v + norm w`) +THEN SIMP_TAC[NORM_POS_LE] +THEN REWRITE_TAC[GSYM REAL_ABS_REFL] +THEN RESA_TAC +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&2<=norm (w:real^3) /\ &2 <= norm (v:real^3) ==> &4<= norm v + norm w `) +THEN ASM_REWRITE_TAC[] +THEN ASM_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC]);; + + +let VEC0_BALL_ANNULUS=prove_by_refinement(`&2<= norm(v-w) /\ ~(v= vec 0) /\ ~(w= vec 0) + /\ v IN ball_annulus /\ w IN ball_annulus +/\ z IN aff_ge {vec 0} {v} +/\ z IN aff_ge {vec 0} {w} +==> z= vec 0`, +[REWRITE_TAC[ball_annulus;dist;ball;cball;DIFF;IN_ELIM_THM;NORM_NEG;VECTOR_ARITH`vec 0 -A= --A`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC AFF_GE_1_1[`vec 0:real^3`;`v:real^3`] +THEN MRESA_TAC AFF_GE_1_1[`vec 0:real^3`;`w:real^3`] +THEN REWRITE_TAC[IN_ELIM_THM;VECTOR_ARITH`t % vec 0 + A=A`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(REAL_ARITH`&0<= t2'==> t2'= &0 \/ &0< t2'`) +THEN RESA_TAC; +VECTOR_ARITH_TAC; +MP_TAC(REAL_ARITH`&0<= t2 ==> t2= &0 \/ &0< t2`) +THEN RESA_TAC; +VECTOR_ARITH_TAC; +STRIP_TAC +THEN MP_TAC(SET_RULE`t2 % v = t2' % w:real^3==> inv t2 %(t2 % v)= inv t2 %(t2' %w)`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN MP_TAC(REAL_ARITH`&0< t2 ==> ~(t2= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t2:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C /\ &1 %v=v`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;VECTOR_ARITH`a%v- v=(a- &1) %v`;NORM_MUL;REAL_ARITH`~(a b<=a`]) +THEN REPEAT STRIP_TAC +THEN MRESA1_TAC REAL_LE_INV_EQ`t2:real` +THEN MRESA_TAC REAL_LE_MUL[`inv t2`;`t2':real`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM REAL_ABS_REFL] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;VECTOR_ARITH`a%v- v=(a- &1) %v`;NORM_MUL;REAL_ARITH`~(a b<=a`]) +THEN REPEAT STRIP_TAC +THEN MP_TAC(REAL_ARITH`&2 <= norm (w:real^3) /\ (inv t2 * t2') * norm w <= &2 * h0 ==> +(inv t2 * t2'- &1) * norm w <= &2 * h0 - &2 +`) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&2 <= (inv t2 * t2') * norm w /\ norm w <= &2 * h0 +==> (--(inv t2 * t2'- &1)) * norm (w:real^3) <= &2 * h0 - &2`) +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(REAL_ARITH`&0<= (inv t2 * t2' - &1)\/ &0<= --(inv t2 * t2' - &1)`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM REAL_ABS_REFL] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;h0]) +THEN REAL_ARITH_TAC]);; + + + + +let BALL_ANNULUS_3PONITS_ANGLE= prove_by_refinement(`~(v= vec 0) /\ ~(w= vec 0) /\ ~(v=w)/\ +&2<= norm(v-w) + /\ v IN ball_annulus /\ w IN ball_annulus +==> &0< cos( angle(v,w,vec 0))`, +[REWRITE_TAC[ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0 -A= --A`;NORM_NEG;REAL_ARITH`~(A< &2)<=> &2<= A`] +THEN REPEAT STRIP_TAC +THEN MRESAL_TAC LAW_OF_COSINES[`w:real^3`;`v:real^3`;`vec 0:real^3`;][dist;VECTOR_ARITH`A- vec 0= A`; +NORM_NEG;REAL_ARITH`A=(B+C)-D<=> B+C-A=D`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ VECTOR_ARITH`A-B= --(B-A:real^3)`;] +THEN REWRITE_TAC[NORM_NEG] +THEN STRIP_TAC +THEN MRESAL_TAC Trigonometry2.POW2_COND[`&2:real`;`norm(v-w:real^3)`][NORM_POS_LE;REAL_ARITH`&0<= &2`] +THEN MRESAL_TAC Trigonometry2.POW2_COND[`&2:real`;`norm(w:real^3)`][NORM_POS_LE;REAL_ARITH`&0<= &2`] +THEN SUBGOAL_THEN`&0<= &2 * h0` ASSUME_TAC; +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; + MRESAL_TAC Trigonometry2.POW2_COND[`norm(v:real^3)`;`&2 * h0:real`;][NORM_POS_LE;REAL_ARITH`&0<= &2`] +THEN MP_TAC(REAL_ARITH`&2 pow 2 <= norm (v - w) pow 2 /\ +&2 pow 2 <= norm (w) pow 2/\ norm v pow 2 <= (&2 * h0) pow 2 +==> &2 pow 2 + &2 pow 2 - (&2 * h0) pow 2 <= norm (v - w:real^3) pow 2 + norm w pow 2 - norm v pow 2`) +THEN RESA_TAC +THEN SUBGOAL_THEN`&0< &2 pow 2 + &2 pow 2 - (&2 * h0) pow 2`ASSUME_TAC; +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MP_TAC(REAL_ARITH`&0 < &2 pow 2 + &2 pow 2 - (&2 * h0) pow 2/\ &2 pow 2 + &2 pow 2 - (&2 * h0) pow 2 <= + &2 * norm (v - w) * norm w * cos (angle (v,w,vec 0:real^3)) +==> &0< norm (v - w) * norm w * cos (angle (v,w,vec 0:real^3))`) +THEN RESA_TAC +THEN MRESA_TAC Planarity.IMP_NORM_FAN[`v:real^3`;`w:real^3`] +THEN MRESAL_TAC REAL_LT_MUL[`inv(norm (v-w:real^3))`;`norm (v - w:real^3) * norm (w:real^3) * cos (angle(v, w, vec 0:real^3))`][REAL_ARITH`A*B*C*D=(A*B)*C*D/\ &1 *A=A`] +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`w:real^3`;`vec 0:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN MRESAL_TAC REAL_LT_MUL[`inv(norm (w:real^3))`;` norm (w:real^3) * cos (angle(v, w, vec 0:real^3))`][REAL_ARITH`A*B*C=(A*B)*C/\ &1 *A=A`]]);; + + + + + +let BALL_ANNULUS_3PONITS_NORM_MIN= prove_by_refinement(`~(v= vec 0) /\ ~(w= vec 0) /\ ~(v=w)/\ ~collinear{vec 0,v,w}/\ +&2<= norm(v-w) + /\ v IN ball_annulus /\ w IN ball_annulus +/\ t %w= z +/\ &0< t +/\ a= sqrt(&4 -h0 pow 2) +==> a <= norm(v-z)`, +[REWRITE_TAC[ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0 -A= --A`;NORM_NEG;REAL_ARITH`~(A< &2)<=> &2<= A`] +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`&0<= &4 -h0 pow 2` ASSUME_TAC; +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MRESA1_TAC SQRT_WORKS`&4 -h0 pow 2` +THEN MRESAL_TAC Trigonometry2.POW2_COND[`a:real`;`norm(v-z:real^3)`][NORM_POS_LE] +THEN DISJ_CASES_TAC(SET_RULE`z= vec 0 \/ ~((z:real^3)= vec 0)`); +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] +THEN REWRITE_TAC[VECTOR_MUL_EQ_0] +THEN REPEAT STRIP_TAC) +THEN ASM_TAC; + REAL_ARITH_TAC; + SET_TAC[]; +SUBGOAL_THEN`angle(v,vec 0,z) =angle(v,vec 0,w:real^3)` ASSUME_TAC; +ASM_SIMP_TAC[ANGLE_EQ;] +THEN EXPAND_TAC"z" +THEN SIMP_TAC[VECTOR_ARITH`A- vec 0=A`;DOT_RMUL;NORM_MUL] +THEN MP_TAC(REAL_ARITH`&0< t==> &0<=t`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_ABS_REFL`t:real` +THEN REAL_ARITH_TAC; + DISJ_CASES_TAC(REAL_ARITH`pi/ &2 < angle(v,vec 0,w:real^3)\/ angle(v,vec 0,w)<= pi/ &2 `); +MRESA_TAC ANGLE_RANGE[`v:real^3`;`vec 0:real^3`;`w:real^3`] +THEN MP_TAC(REAL_ARITH`pi/ &2 < angle(v,vec 0,w) /\ &0< pi +==> -- pi < angle(v,vec 0,w:real^3)`) +THEN REWRITE_TAC[PI_WORKS] +THEN RESA_TAC +THEN MRESA1_TAC Trigonometry1.COS_NEGPOS_PI`angle(v, vec 0, w:real^3)` +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN MP_TAC(REAL_ARITH`cos (angle (v,vec 0,w)) < &0 ==> &0<= -- cos (angle (v,vec 0,w:real^3)) `) +THEN RESA_TAC +THEN MRESAL_TAC LAW_OF_COSINES[`vec 0:real^3`;`v:real^3`;`z:real^3`][dist;VECTOR_ARITH`vec 0-A= --A`;NORM_NEG] +THEN MRESAL_TAC REAL_LE_MUL[`norm (z:real^3) `;`-- cos (angle (v,vec 0,w:real^3))`][NORM_POS_LE] +THEN MRESAL_TAC REAL_LE_MUL[`norm (v:real^3) `;`norm (z:real^3) * -- cos (angle (v,vec 0,w:real^3))`][NORM_POS_LE] +THEN MP_TAC(REAL_ARITH` +&0 <= norm v * norm z * --cos (angle (v,vec 0,w)) +/\ &0<= norm z pow 2 ==> norm v pow 2 <= (norm v pow 2 + norm z pow 2) - + &2 * norm (v:real^3) * norm (z:real^3) * cos (angle (v,vec 0,w:real^3))`) +THEN ASM_REWRITE_TAC[REAL_LE_POW_2] +THEN STRIP_TAC +THEN MATCH_MP_TAC(REAL_ARITH`!A B C. A<=B /\ B<=C==> A<= C`) +THEN EXISTS_TAC`norm (v:real^3) pow 2` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(REAL_ARITH`!A B C. A<=B /\ B<=C==> A<= C`) +THEN EXISTS_TAC`&4` +THEN STRIP_TAC; +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +REWRITE_TAC[REAL_ARITH`&4= &2 pow 2`] +THEN MRESAL_TAC Trigonometry2.POW2_COND[`&2:real`;`norm(v:real^3)`][NORM_POS_LE;REAL_ARITH`&0<= &2`]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[REAL_ARITH`A<=B <=> A=B \/ A A<=B `] +THEN MP_TAC(REAL_ARITH` + &0<= norm z pow 2 ==> norm v pow 2 <= (norm (v:real^3) pow 2 + norm (z:real^3) pow 2)`) +THEN ASM_REWRITE_TAC[REAL_LE_POW_2] +THEN STRIP_TAC +THEN MRESAL_TAC LAW_OF_COSINES[`vec 0:real^3`;`v:real^3`;`z:real^3`][dist;VECTOR_ARITH`vec 0-A= --A`;NORM_NEG;COS_PI2;REAL_ARITH`a * &0= &0 /\ A- &0=A`] +THEN MATCH_MP_TAC(REAL_ARITH`!A B C. A<=B /\ B<=C==> A<= C`) +THEN EXISTS_TAC`norm (v:real^3) pow 2` +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC(REAL_ARITH`!A B C. A<=B /\ B<=C==> A<= C`) +THEN EXISTS_TAC`&4` +THEN STRIP_TAC; +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +REWRITE_TAC[REAL_ARITH`&4= &2 pow 2`] +THEN MRESAL_TAC Trigonometry2.POW2_COND[`&2:real`;`norm(v:real^3)`][NORM_POS_LE;REAL_ARITH`&0<= &2`]; +REWRITE_TAC[REAL_ARITH` A=B \/ A A<=B `] +THEN ABBREV_TAC`t1=norm v * cos(angle(v:real^3,vec 0,w))` +THEN ABBREV_TAC`u= (t1* inv(norm w) ) % w:real^3` +THEN MRESA_TAC ANGLE_RANGE[`v:real^3`;`vec 0:real^3`;`w:real^3`] +THEN MP_TAC(REAL_ARITH`&0 <= angle(v,vec 0,w) /\ &0< pi +==> -- pi < angle(v,vec 0,w:real^3) /\ -- (pi/ &2) < angle(v,vec 0,w:real^3)`) +THEN REWRITE_TAC[PI_WORKS] +THEN RESA_TAC +THEN MRESA1_TAC Trigonometry1.COS_NEGPOS_PI`angle(v, vec 0, w:real^3)` +THEN MRESA1_TAC NORM_POS_LT`v:real^3` +THEN MRESA_TAC REAL_LT_MUL[`norm (v:real^3)`;`cos (angle(v, vec 0, w:real^3))`] +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`w:real^3`;`vec 0:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN MRESA_TAC REAL_LT_MUL[`t1:real`;`inv (norm (w:real^3))`] +THEN ABBREV_TAC`t2=norm (v-w) * cos(angle(v:real^3,w,vec 0))` +THEN MRESAL_TAC (GEN_ALL BALL_ANNULUS_3PONITS_ANGLE)[`v:real^3`;`w:real^3`][ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0 -A= --A`;NORM_NEG;REAL_ARITH`~(A< &2)<=> &2<= A`] +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`v:real^3`;`w:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN MRESA_TAC REAL_LT_MUL[`norm (v-w:real^3)`;`cos (angle(v,w, vec 0:real^3))`] +THEN SUBGOAL_THEN`~(u= vec 0:real^3)` ASSUME_TAC; +STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] +THEN REWRITE_TAC[VECTOR_MUL_EQ_0] +THEN REPEAT STRIP_TAC) +THEN ASM_TAC; + REAL_ARITH_TAC; + SET_TAC[]; +SUBGOAL_THEN`angle(v,vec 0,u) =angle(v,vec 0,w:real^3)` ASSUME_TAC; +ASM_SIMP_TAC[ANGLE_EQ;] +THEN EXPAND_TAC"u" +THEN SIMP_TAC[VECTOR_ARITH`A- vec 0=A`;DOT_RMUL;NORM_MUL] +THEN MP_TAC(REAL_ARITH`&0< t1 * inv(norm (w:real^3))==> &0<= t1 * inv(norm (w:real^3))`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_ABS_REFL`t1 * inv(norm(w:real^3)):real` +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`norm (v-u:real^3)= norm v * sin(angle(v, vec 0, w:real^3))` ASSUME_TAC; +MRESAL_TAC REAL_LE_MUL[`norm (v:real^3)`;`sin(angle(v, vec 0, w:real^3))`][SIN_ANGLE_POS;NORM_POS_LE] +THEN MRESAL_TAC Trigonometry2.EQ_POW2_COND[`norm (v-u:real^3)`;`norm v * sin(angle(v, vec 0, w:real^3))`][NORM_POS_LE] +THEN MRESAL_TAC LAW_OF_COSINES[`vec 0:real^3`;`v:real^3`;`u:real^3`][dist;VECTOR_ARITH`vec 0-A= --A`;NORM_NEG;COS_PI2;REAL_ARITH`a * &0= &0 /\ A- &0=A/\ (A*B) pow 2= A pow 2* B pow 2`] +THEN EXPAND_TAC"u" +THEN REWRITE_TAC[NORM_MUL] +THEN MP_TAC(REAL_ARITH`&0 < t1 * inv (norm w) ==> &0 <= t1 * inv (norm (w:real^3))`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_ABS_REFL`t1 * inv(norm(w:real^3)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`(A*B)*C=A*(B*C)/\ A * &1=A/\ A*B*C*D*E= A*B*E*(C*D)`] +THEN EXPAND_TAC"t1" +THEN REWRITE_TAC[REAL_ARITH`(norm v pow 2 + (norm v * cos (angle (v,vec 0,w))) pow 2) - + &2 * norm v * (norm v * cos (angle (v,vec 0,w))) * cos (angle (v,vec 0,w)) += norm v pow 2 *(&1 - cos (angle (v,vec 0,w)) pow 2)`] +THEN SIMP_TAC[Trigonometry2.COS_POW2_INTER] +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`angle(v,u,vec 0:real^3) =pi/ &2` ASSUME_TAC; +MRESAL_TAC LAW_OF_COSINES[`u:real^3`;`v:real^3`;`vec 0:real^3`;][dist;VECTOR_ARITH`A- vec 0= A`;NORM_NEG;COS_PI2;REAL_ARITH`a * &0= &0 /\ A- &0=A/\ (A*B) pow 2= A pow 2* B pow 2`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`A-B= --(B-A):real^3`] +THEN ASM_REWRITE_TAC[NORM_NEG] +THEN EXPAND_TAC"u" +THEN REWRITE_TAC[NORM_MUL] +THEN MP_TAC(REAL_ARITH`&0 < t1 * inv (norm w) ==> &0 <= t1 * inv (norm (w:real^3))`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_ABS_REFL`t1 * inv(norm(w:real^3)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`(A*B)*C=A*(B*C)/\ A * &1=A/\ A*B*C*D*E= A*B*E*(C*D)`] +THEN MRESAL_TAC Planarity.IMP_NORM_FAN[`v:real^3`;`vec 0:real^3`][VECTOR_ARITH`A- vec 0=A`] +THEN EXPAND_TAC"t1" +THEN SIMP_TAC[Trigonometry2.COS_POW2_INTER;REAL_ARITH`(A*B)pow 2=A pow 2 * B pow 2`;REAL_ARITH`norm v pow 2 = + (norm v pow 2 * sin (angle (v,vec 0,w)) pow 2 + + norm v pow 2 * (&1 - sin (angle (v,vec 0,w)) pow 2)) - + &2 * + norm v * + (norm v * cos (angle (v,vec 0,w))) * + cos (angle (v,u,vec 0)) * + sin (angle (v,vec 0,w)) +<=> + norm v * + (norm v * cos (angle (v,vec 0,w))) * + cos (angle (v,u,vec 0)) * + sin (angle (v,vec 0,w))= &0`;] +THEN ASM_REWRITE_TAC[REAL_ENTIRE] +THEN MP_TAC(REAL_ARITH`angle (v,vec 0,w) < pi / &2 /\ &0<= angle (v,vec 0,w) +==> ~((angle (v,vec 0,w) = --(pi / &2) \/ angle (v,vec 0,w:real^3) = pi / &2))`) +THEN RESA_TAC +THEN ASM_SIMP_TAC[SIN_ANGLE_EQ_0] +THEN MRESA_TAC COLLINEAR_ANGLE[`v:real^3`;`vec 0:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN MRESA_TAC ANGLE_RANGE[`v:real^3`;`u:real^3`;`vec 0:real^3`;] +THEN MP_TAC(REAL_ARITH`&0 <= angle(v,u,vec 0) /\ &0< pi +==> -- pi < angle(v,u,vec 0:real^3) /\ ~( angle(v,u,vec 0:real^3)= -- (pi/ &2))`) +THEN REWRITE_TAC[PI_WORKS] +THEN RESA_TAC +THEN MRESA1_TAC Trigonometry1.COS_NEGPOS_PI`angle(v, u,vec 0:real^3)`; +SUBGOAL_THEN`collinear{vec 0, u, w:real^3}` ASSUME_TAC; +ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[COLLINEAR_LEMMA] +THEN EXISTS_TAC`t1 * inv(norm (w:real^3))` +THEN ASM_SIMP_TAC[]; +SUBGOAL_THEN`~(u=w:real^3)` ASSUME_TAC; +STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] +THEN REPEAT STRIP_TAC) +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;COS_PI2]) +THEN REAL_ARITH_TAC; +SUBGOAL_THEN `angle(u, vec 0, w:real^3)= &0` ASSUME_TAC; +MRESA_TAC ANGLE_EQ[`u:real^3`;`vec 0:real^3`;`w:real^3`;`w:real^3`;`vec 0:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[VECTOR_ARITH`A- vec 0=A`] +THEN EXPAND_TAC"u" +THEN SIMP_TAC[DOT_LMUL;NORM_MUL] +THEN MP_TAC(REAL_ARITH`&0 < t1 * inv (norm w) ==> &0 <= t1 * inv (norm (w:real^3))`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_ABS_REFL`t1 * inv(norm(w:real^3)):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`(w dot w) * ((t1 * inv (norm w)) * norm w) * norm w = + ((t1 * inv (norm w)) * (w dot w)) * norm w * norm w`] +THEN RESA_TAC +THEN ASM_SIMP_TAC[ANGLE_REFL_MID]; +MRESA_TAC COLLINEAR_ANGLE[`vec 0:real^3`;`u:real^3`;`w:real^3`]; +MRESA_TAC (GEN_ALL ANGLE_EQ_0_LEFT)[`v:real^3`;`vec 0:real^3`;`u:real^3`;`w:real^3`;] +THEN POP_ASSUM(fun th -> ASSUME_TAC(SYM th) ) +THEN MRESA_TAC TRIANGLE_ANGLE_SUM[`v:real^3`;`u:real^3`;`w:real^3`;] +THEN MP_TAC(REAL_ARITH`pi / &2 = angle (v,u,w) +/\ &0<= angle (u,v,w) /\ &0<= angle (v,u,w) /\ &0<= angle (u,w,v)/\ +angle (u,v,w) + angle (v,u,w) + angle (u,w,v:real^3) = pi +==> angle (u,w,v) <= pi/ &2`) +THEN ASM_SIMP_TAC[ANGLE_RANGE] +THEN MRESAL_TAC TRIANGLE_ANGLE_SUM[`vec 0:real^3`;`u:real^3`;`w:real^3`;][REAL_ARITH`&0+ A=A`] +THEN MRESAL_TAC (GEN_ALL ANGLE_EQ_PI_LEFT)[`v:real^3`;`u:real^3`;`w:real^3`;`vec 0:real^3`][REAL_ARITH`A- B<= A/ &2 <=> A/ &2 <=B`] +THEN ONCE_REWRITE_TAC[ANGLE_SYM] +THEN MRESA_TAC ANGLE_RANGE[`v:real^3`;`w:real^3`;`vec 0:real^3`;] +THEN MP_TAC(REAL_ARITH`&0 <= angle(v,w,vec 0) /\ &0< pi +==> -- pi < angle(v,w,vec 0:real^3) /\ ~( angle(v,w,vec 0:real^3)= -- (pi/ &2))`) +THEN REWRITE_TAC[PI_WORKS] +THEN RESA_TAC +THEN MRESA1_TAC Trigonometry1.COS_NEGPOS_PI`angle(v, w:real^3, vec 0)` +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC; +MRESAL_TAC (GEN_ALL ANGLE_EQ_PI_LEFT)[`v:real^3`;`vec 0:real^3`;`u:real^3`;`w:real^3`][REAL_ARITH`A- B<= A/ &2 <=> A/ &2 <=B`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ANGLE_SYM] +THEN ASM_REWRITE_TAC[REAL_ARITH`A/ &2= A- B<=> B= A/ &2`] +THEN STRIP_TAC +THEN SUBGOAL_THEN`norm(v- u)<= norm(v-z:real^3)`ASSUME_TAC; +DISJ_CASES_TAC(SET_RULE`z=u \/ ~(u=z:real^3)`); +ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`collinear{vec 0, u,z:real^3}`ASSUME_TAC; +ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`] +THEN ASM_REWRITE_TAC[COLLINEAR_LEMMA] +THEN EXPAND_TAC"z" +THEN EXISTS_TAC`t1 * inv(norm (w:real^3)) * inv t` +THEN SIMP_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;REAL_ARITH`(A*B*C)*D=A*B*(C*D)`] +THEN MP_TAC(REAL_ARITH`&0< t==> ~(t= &0)`) +THEN RESA_TAC +THEN MRESAL1_TAC REAL_MUL_LINV`t:real`[REAL_ARITH`A* &1=A`]; +SUBGOAL_THEN`angle(v,u,z:real^3) = pi/ &2` ASSUME_TAC; +MRESA_TAC COLLINEAR_ANGLE[`vec 0:real^3`;`u:real^3`;`z:real^3`]; +MRESA_TAC (GEN_ALL ANGLE_EQ_0_LEFT)[`v:real^3`;`vec 0:real^3`;`u:real^3`;`z:real^3`;]; +MRESAL_TAC (GEN_ALL ANGLE_EQ_PI_LEFT)[`v:real^3`;`vec 0:real^3`;`u:real^3`;`z:real^3`][REAL_ARITH`A- B<= A/ &2 <=> A/ &2 <=B`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[ANGLE_SYM] +THEN ASM_REWRITE_TAC[REAL_ARITH`A/ &2= A-B<=> B=A/ &2`] +THEN STRIP_TAC +THEN ONCE_REWRITE_TAC[ANGLE_SYM] +THEN ASM_REWRITE_TAC[]; +MRESAL_TAC Collect_geom.POW2_COND[`norm(v- u:real^3)`;`norm(v-z:real^3)`][NORM_POS_LE] +THEN MRESAL_TAC LAW_OF_COSINES[`u:real^3`;`v:real^3`;`z:real^3`;][dist;VECTOR_ARITH`A- vec 0= A`;NORM_NEG;COS_PI2;REAL_ARITH`a * &0= &0 /\ A- &0=A/\ (A*B) pow 2= A pow 2* B pow 2`] +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`A-B= --(B-A):real^3`] +THEN ASM_REWRITE_TAC[NORM_NEG; REAL_ARITH`(A*B) pow 2= A pow 2 * B pow 2`;REAL_ARITH`A<=A+B<=> &0<=B`] +THEN MRESAL_TAC Collect_geom.POW2_COND[`&0`;`norm(z-u:real^3)`][NORM_POS_LE;REAL_ARITH`&0<= &0/\ &0 pow 2= &0`]; +MRESAL_TAC Collect_geom.POW2_COND[`norm(v-u:real^3)`;`norm(v-z:real^3)`][NORM_POS_LE] +THEN MATCH_MP_TAC(REAL_ARITH`!A B C. A<=B /\ B<= C==> A<= C`) +THEN EXISTS_TAC`norm(v- u:real^3) pow 2` +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC ANGLE_EQ_PI_DIST[`vec 0:real^3`;`u:real^3`;`w:real^3`][dist;VECTOR_ARITH`vec 0-A= -- A`;NORM_NEG] +THEN MP_TAC(REAL_ARITH`norm w = norm u + norm (u - w:real^3) +/\ &0<= norm u /\ &0<= norm (u - w:real^3) /\ norm w<= &2 * h0 +==> norm u<= h0 \/ norm (u - w:real^3)<= h0`) +THEN ASM_REWRITE_TAC[NORM_POS_LE] +THEN RESA_TAC; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC LAW_OF_COSINES[`u:real^3`;`v:real^3`;`vec 0:real^3`;][dist;VECTOR_ARITH`A- vec 0= A`;NORM_NEG;COS_PI2;REAL_ARITH`a * &0= &0 /\ A- &0=A/\ (A*B) pow 2= A pow 2* B pow 2 `;REAL_ARITH`A=B+C<=>B=A-C`] +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`A-B= --(B-A):real^3`;] +THEN ASM_REWRITE_TAC[NORM_NEG] +THEN MRESAL_TAC Collect_geom.POW2_COND[`&2`;`norm(v:real^3)`][NORM_POS_LE;REAL_ARITH`&0 <= &2 `] +THEN MRESAL_TAC Collect_geom.POW2_COND[`norm(u:real^3)`;`h0`][NORM_POS_LE;REAL_ARITH`&0 <= &2 `] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;] +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC) +THEN MRESAL_TAC LAW_OF_COSINES[`u:real^3`;`v:real^3`;`w:real^3`;][dist;VECTOR_ARITH`A- vec 0= A`;NORM_NEG;COS_PI2;REAL_ARITH`a * &0= &0 /\ A- &0=A/\ (A*B) pow 2= A pow 2* B pow 2 `;REAL_ARITH`A=B+C<=>B=A-C`] +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`A-B= --(B-A):real^3`;] +THEN ASM_REWRITE_TAC[NORM_NEG] +THEN MRESAL_TAC Collect_geom.POW2_COND[`&2`;`norm(v-w:real^3)`][NORM_POS_LE;REAL_ARITH`&0 <= &2 `] +THEN MRESAL_TAC Collect_geom.POW2_COND[`norm(u-w:real^3)`;`h0`][NORM_POS_LE;REAL_ARITH`&0 <= &2 `] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0;] +THEN REAL_ARITH_TAC]);; + +let BALL_ANNULUS_4PONITS_AFF_GT=prove(` ~collinear {vec 0, v, z} +/\ ~collinear {vec 0, w, z} /\ +&2<= norm(v-w) /\ norm(v-w)<= cstab /\ &2<= norm(z-v) /\ &2<= norm(z-w) + /\ v IN ball_annulus /\ w IN ball_annulus +/\ z IN ball_annulus +==> ~ (z IN aff_gt {vec 0} {v,w})`, +REWRITE_TAC[ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0 -A= --A`;NORM_NEG;REAL_ARITH`~(A< &2)<=> &2<= A`] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC th3[`vec 0:real^3`;`v:real^3`;`z:real^3`] +THEN MRESA_TAC th3[`v:real^3`;`vec 0:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN MRESA_TAC th3[`vec 0:real^3`;`w:real^3`;`z:real^3`] +THEN MRESA_TAC th3[`w:real^3`;`vec 0:real^3`;`z:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,A,C}`] +THEN RESA_TAC +THEN MRESAL_TAC Planarity.scale_in_edges_fan[`vec 0:real^3`;`v:real^3`;`w:real^3`;`z:real^3`][SET_RULE`DISJOINT {A}{B,C}<=> ~(B=A) /\ ~(C=A)`;VECTOR_ARITH`A-vec 0=A`] +THEN MRESA_TAC (GEN_ALL BALL_ANNULUS_3PONITS_NORM_MIN)[`z:real^3`;`a:real`;`sqrt (&4 - h0 pow 2)`;`v:real^3`;`a % z:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`A-B= --(B-A):real^3`] +THEN ASM_REWRITE_TAC[ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0 -A= --A`;NORM_NEG;REAL_ARITH`~(A< &2)<=> &2<= A`;VECTOR_ARITH`((&1 - t) % v + t % w) - v= t%(w-v)`;NORM_MUL] +THEN MRESA1_TAC (GEN_ALL Trigonometry2.LT_IMP_ABS_REFL)`t:real` +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`A-B= --(B-A):real^3`] +THEN REWRITE_TAC[NORM_NEG] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL BALL_ANNULUS_3PONITS_NORM_MIN)[`z:real^3`;`a:real`;`sqrt (&4 - h0 pow 2)`;`w:real^3`;`a % z:real^3`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ONCE_REWRITE_TAC[VECTOR_ARITH`A-B= --(B-A):real^3`] +THEN ASM_REWRITE_TAC[ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0 -A= --A`;NORM_NEG;REAL_ARITH`~(A< &2)<=> &2<= A`;VECTOR_ARITH`((&1 - t) % v + t % w) - w= (&1-t)%(v-w)`;NORM_MUL] +THEN MP_TAC(REAL_ARITH`t< &1==> &0< &1- t`) +THEN RESA_TAC +THEN MRESA1_TAC (GEN_ALL Trigonometry2.LT_IMP_ABS_REFL)`&1- t:real` +THEN STRIP_TAC +THEN MP_TAC(REAL_ARITH`sqrt (&4 - h0 pow 2) <= t * norm (v - w) +/\ sqrt (&4 - h0 pow 2) <= (&1 - t) * norm (v - w) +/\ norm (v - w:real^3) <=cstab +==> &2 * sqrt (&4 - h0 pow 2) <= cstab`) +THEN RESA_TAC +THEN SUBGOAL_THEN`&0<= cstab` ASSUME_TAC +THENL[REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; +SUBGOAL_THEN`&0<= &4 -h0 pow 2` ASSUME_TAC +THENL[ +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; +MRESA1_TAC SQRT_WORKS`&4 -h0 pow 2` +THEN MP_TAC(REAL_ARITH`&0<= sqrt(&4- h0 pow 2)==> &0<= &2 * sqrt(&4- h0 pow 2) `) +THEN RESA_TAC +THEN MRESAL_TAC Collect_geom.POW2_COND[`&2 * sqrt (&4 - h0 pow 2)`;`cstab`][REAL_ARITH`(A*B)pow 2= A pow 2 * B pow 2`] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[h0; cstab] +THEN REAL_ARITH_TAC]]);; + +let AFF_INTER_AFF_GT_EQ_EMPTY=prove(`~collinear {x,y,z:real^3} ==> aff {x,y} INTER aff_gt{x} {y,z}={}`, +REPEAT STRIP_TAC +THEN MRESA_TAC th3[`x:real^3`;`y:real^3`;`z:real^3`] +THEN ASM_SIMP_TAC[INTER;EXTENSION;IN_ELIM_THM;affine_hull_2_fan;AFF_GT_1_2] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v = t1' % x + t2' % v + t3 % w <=> t3 % w = (t1 - t1') % x + (t2 -t2') % v`] + THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th-> REWRITE_TAC[]) +THEN REMOVE_ASSUM_TAC + THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM(th);REAL_ARITH`a+b+c=d+e <=> c = (d-a)+ (e-b)`]) +THEN DISCH_TAC THEN MP_TAC(REAL_ARITH`&0 < (t3:real) ==> ~(t3= &0)`) + THEN ASM_REWRITE_TAC[]THEN DISCH_TAC + THEN MP_TAC(ISPEC`t3:real`REAL_MUL_LINV) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN DISCH_TAC + THEN MP_TAC(SET_RULE` (t3:real) = (t1- t1') + (t2-t2') ==> (inv t3) *(t3:real) = (inv t3) * ((t1- t1')+ (t2-t2'))`) + THEN ASM_REWRITE_TAC[REAL_ARITH`a*(b+c)= a *b + a*c`] THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) + THEN DISCH_TAC THEN DISCH_TAC + THEN MP_TAC(SET_RULE` (t3:real) % z= (t1- t1') % (x:real^3) + (t2-t2') % y ==> (inv t3) % ((t3:real)% z) = (inv t3) % ((t1- t1') %x+ (t2-t2') % y)`) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`m% (n% p)=a%(b % x + c % v)<=> (m*n) %p = (a *b)%x + (a*c)% v`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]) + THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)] THEN ASSUME_TAC(SYM(th))) THEN REWRITE_TAC[VECTOR_ARITH`&1 %w=w`] + THEN DISCH_TAC + THEN SUBGOAL_THEN`z IN aff{(x:real^3),y}` ASSUME_TAC +THENL[ + SIMP_TAC[INTER;EXTENSION;IN_ELIM_THM;affine_hull_2_fan;AFF_GT_1_2] + THEN EXISTS_TAC`inv t3 * (t1-t1')` THEN EXISTS_TAC`inv t3 * (t2-t2')` + THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) + THEN POP_ASSUM(fun th-> REWRITE_TAC[th]); +ASM_TAC +THEN SET_TAC[]]; +SET_TAC[]]);; + + +let AFF_GE_INTER_AFF_GT_EQ_EMPTY=prove_by_refinement(`~collinear {x,y,z:real^3}/\ ~(x=u)/\ ~(u IN aff_gt {x} {y,z}) ==> aff_ge {x} {u} INTER aff_gt{x} {y,z}={}`, +[REPEAT STRIP_TAC +THEN MRESA_TAC th3[`x:real^3`;`y:real^3`;`z:real^3`] +THEN ASM_SIMP_TAC[INTER;EXTENSION;IN_ELIM_THM;AFF_GE_1_1;AFF_GT_1_2] +THEN GEN_TAC +THEN EQ_TAC; +STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % u = t1' % x + t2' % v + t3 % w <=> t2 % u = (t1' - t1) % x + t2' % v +t3 %w`] + THEN MP_TAC(REAL_ARITH`&0 < (t3:real) ==> ~(t3= &0)`) +THEN RESA_TAC THEN MP_TAC(ISPEC`t3:real`REAL_MUL_LINV) +THEN RESA_TAC +THEN MP_TAC(REAL_ARITH`&0<= t2==> t2= &0 \/ &0< t2`) +THEN RESA_TAC; +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;VECTOR_ARITH`&0 % A= vec 0`;VECTOR_ARITH`vec 0=A+B+C<=> C= -- A -B`] THEN REPEAT STRIP_TAC) + THEN MP_TAC(SET_RULE` (t3:real) % z= --((t1'- t1) % (x:real^3)) - t2' % y ==> (inv t3) % ((t3:real)% z) = (inv t3) % (--((t1'- t1) %x) - t2' % y)`) + THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C) /\ &1 %C=C`] +THEN DISCH_TAC THEN SUBGOAL_THEN`z IN aff{(x:real^3),y}` ASSUME_TAC; + SIMP_TAC[INTER;EXTENSION;IN_ELIM_THM;affine_hull_2_fan;AFF_GT_1_2] + THEN EXISTS_TAC`-- inv t3 * (t1'-t1)` THEN EXISTS_TAC`-- inv t3 * t2'` +THEN ASM_REWRITE_TAC[REAL_ARITH`--inv t3 * (t1' - t1) + --inv t3 * t2' += (inv t3) *(t3 +(t1+ &0)-(t1'+t2'+t3)) /\ A+ &1 - &1=A`] +THEN VECTOR_ARITH_TAC; +POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[]; + MP_TAC(REAL_ARITH`&0 < (t2:real) ==> ~(t2= &0)`) +THEN RESA_TAC THEN MP_TAC(ISPEC`t2:real`REAL_MUL_LINV) +THEN RESA_TAC +THEN RESA_TAC + THEN MP_TAC(SET_RULE` t2 % u = (t1' - t1) % x + t2' % y + t3 % z ==> (inv t2) % ((t2:real)% u) = (inv t2) % ((t1' - t1) % x + t2' % y + t3 % z:real^3)`) + THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`(A%B%C=(A*B)%C) /\ &1 %C=C`] +THEN DISCH_TAC THEN SUBGOAL_THEN`u IN aff_gt{(x:real^3)}{y,z}` ASSUME_TAC; +POP_ASSUM(fun th-> REWRITE_TAC[th]) +THEN ASM_SIMP_TAC[INTER;EXTENSION;IN_ELIM_THM;affine_hull_2_fan;AFF_GT_1_2] +THEN EXISTS_TAC`inv t2 *(t1' - t1):real` +THEN EXISTS_TAC`inv t2 *t2':real` +THEN EXISTS_TAC`inv t2 *t3:real` +THEN ASM_REWRITE_TAC[VECTOR_ARITH`inv t2 % ((t1' - t1) % x + t2' % y + t3 % z) = + (inv t2 * (t1' - t1)) % x + (inv t2 * t2') % y + (inv t2 * t3) % z`; +REAL_ARITH`inv t2 * (t1' - t1) + inv t2 * t2' + inv t2 * t3 +=inv t2 * (t2+(t1'+t2'+t3) - (t1+t2))/\ A + &1 - &1=A`] +THEN MRESA1_TAC REAL_LT_INV`t2:real` +THEN ASM_SIMP_TAC[REAL_LT_MUL]; +POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[]; +SET_TAC[]]);; + + + + + +let CONTINUOUS_ON_LIFT_PRODUCT=prove(`!k:num. (!i. i IN 1..k==> (lift o (c i)) continuous_on s) +==> (lift o(\x. product (1..k) (\i. c i x))) continuous_on s`, +INDUCT_TAC +THENL[ +SIMP_TAC[PRODUCT_CLAUSES_NUMSEG;ARITH_RULE`~(1=0)`;LIFT_NUM; o_DEF;CONTINUOUS_ON_CONST;]; + ASM_SIMP_TAC[PRODUCT_CLAUSES_NUMSEG;FINITE_INSERT;ARITH_RULE`1<= SUC K`] +THEN ONCE_REWRITE_TAC[REAL_ARITH`A*B=B*A`] +THEN REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[o_DEF;LIFT_CMUL;IN_NUMSEG] +THEN MATCH_MP_TAC CONTINUOUS_ON_MUL +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[o_DEF;LIFT_CMUL;IN_NUMSEG] +THEN DISCH_THEN(LABEL_TAC"THY") +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESAL1_TAC th`SUC k`[ARITH_RULE`1<= SUC A /\ SUC A<= SUC A`] THEN ASSUME_TAC th) +THEN REMOVE_THEN "THY" MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN "THY" MATCH_MP_TAC +THEN ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC]);; + + +let CONTINUOUS_ON_DET= prove_by_refinement(`!s:real^(M,M)finite_product->bool. (lift o (\y. det(vecmats y))) continuous_on s`, +[REPEAT GEN_TAC +THEN SIMP_TAC[det;o_DEF;LIFT_SUM;LIFT_CMUL;FINITE_PERMUTATIONS;FINITE_NUMSEG;] +THEN MATCH_MP_TAC CONTINUOUS_ON_VSUM +THEN SIMP_TAC[FINITE_PERMUTATIONS;FINITE_NUMSEG;] +THEN X_GEN_TAC `p:num->num` +THEN REWRITE_TAC[IN_ELIM_THM] THEN DISCH_TAC +THEN DISJ_CASES_TAC(SET_RULE`evenperm (p:num->num) \/ ~(evenperm p)`) +THEN ASM_REWRITE_TAC[sign] +THEN MATCH_MP_TAC CONTINUOUS_ON_MUL +THEN SIMP_TAC[LIFT_NUM; o_DEF;CONTINUOUS_ON_CONST;] +THEN MRESAL_TAC (GEN_ALL CONTINUOUS_ON_LIFT_PRODUCT)[`(\i. (\x:real^(M,M)finite_product. vecmats (x)$i$p i))`;`s:real^(M,M)finite_product->bool`;`dimindex (:M)`][o_DEF;] +THEN POP_ASSUM MATCH_MP_TAC +THEN REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[vecmats;CONTINUOUS_ON_LIFT_COMPONENT;PERMUTES_IN_NUMSEG;LAMBDA_BETA;LAMBDA_BETA_PERM;] +THEN MRESA_TAC PERMUTES_IN_NUMSEG[`p:num->num`;`dimindex (:M)`;`i:num`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[IN_NUMSEG] +THEN REPEAT STRIP_TAC +THEN ASM_SIMP_TAC[vecmats;CONTINUOUS_ON_LIFT_COMPONENT;PERMUTES_IN_NUMSEG;LAMBDA_BETA;LAMBDA_BETA_PERM;] +THEN MATCH_MP_TAC CONTINUOUS_ON_LIFT_COMPONENT +THEN STRIP_TAC; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +REWRITE_TAC[DIMINDEX_FINITE_PRODUCT] +THEN MP_TAC(ARITH_RULE`i <= dimindex (:M) /\ 1<= i==> i -1<= dimindex (:M)-1 /\ ~(dimindex (:M)=0)/\ 1<= dimindex (:M)`) +THEN RESA_TAC +THEN MRESA_TAC LE_MULT_RCANCEL[`i-1:num`;`dimindex (:M)-1`;`dimindex (:M)`] +THEN MP_TAC(ARITH_RULE`1<= dimindex (:M)==> dimindex (:M)-1+1=dimindex (:M)`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`(i-1)* dimindex (:M) <= (dimindex (:M) - 1) * dimindex (:M) /\ p i <= dimindex (:M)/\ 1<= dimindex (:M) ==> (i -1)* dimindex (:M) + p i <= (dimindex (:M)-1+1) * dimindex (:M)`) +THEN RESA_TAC; +POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +REWRITE_TAC[DIMINDEX_FINITE_PRODUCT] +THEN MP_TAC(ARITH_RULE`i <= dimindex (:M) /\ 1<= i==> i -1<= dimindex (:M)-1 /\ ~(dimindex (:M)=0)/\ 1<= dimindex (:M)`) +THEN RESA_TAC +THEN MRESA_TAC LE_MULT_RCANCEL[`i-1:num`;`dimindex (:M)-1`;`dimindex (:M)`] +THEN MP_TAC(ARITH_RULE`1<= dimindex (:M)==> dimindex (:M)-1+1=dimindex (:M)`) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`(i-1)* dimindex (:M) <= (dimindex (:M) - 1) * dimindex (:M) /\ p i <= dimindex (:M)/\ 1<= dimindex (:M) ==> (i -1)* dimindex (:M) + p i <= (dimindex (:M)-1+1) * dimindex (:M)`) +THEN RESA_TAC]);; + +let ROW_SUB=prove(`1<=i /\ i<= dimindex (:M)==> row i (x-y:real^N^M)= row i x - row i y`, +SIMP_TAC[row;LAMBDA_BETA;CART_EQ;vector_sub;matrix_sub]);; + + +let LIM_MATVEC=prove_by_refinement(` (!i. 1<=i /\ i <= dimindex(:M) ==> ((\n:num. row i (x n)) --> row i l) sequentially) ==> ((\n:num. matvec(x n )) --> matvec (l:real^K^M)) sequentially`, +[REWRITE_TAC[LIM_SEQUENTIALLY; IN_ELIM_THM; dist;] +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM RIGHT_FORALL_IMP_THM] +THEN REWRITE_TAC[SET_RULE`A==>B==>C <=> B /\A ==>C`] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SWAP_FORALL_THM] +THEN REWRITE_TAC[SET_RULE`A/\B/\C==>D <=> A==> B/\C ==>D`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`inv(&(dimindex (:M))) * e/ &2:real`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[GSYM RIGHT_EXISTS_IMP_THM;SKOLEM_THM;MATVEC_SUB] +THEN REWRITE_TAC[RIGHT_EXISTS_IMP_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN EXISTS_TAC`nsum (1..dimindex (:M)) (\i:num. (N i):num)` +THEN REPEAT STRIP_TAC +THEN MRESA1_TAC NORM_VECMAT_SUM`matvec ((x:num->real^K^M) n - l:real^K^M)` +THEN SUBGOAL_THEN`&0 < inv (&(dimindex (:M))) * e / &2` ASSUME_TAC; +ONCE_REWRITE_TAC[REAL_ARITH`&0< a*b/ &2 <=> &0< a*b`] +THEN MATCH_MP_TAC REAL_LT_MUL +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC REAL_LT_INV +THEN MRESAL_TAC REAL_OF_NUM_LT[`0`;`dimindex (:M)`][ARITH_RULE`0 1<=A`;DIMINDEX_GE_1]; +SUBGOAL_THEN`sum (0..dimindex (:M) - 1) (\i. norm (vecmat i (matvec ((x:num->real^K^M) n - l:real^K^M))))< e`ASSUME_TAC; +MP_TAC(ARITH_RULE`1<= dimindex (:M) ==> dimindex (:M)-1+1 = dimindex (:M)/\ ~(dimindex (:M) =0)`) +THEN ASM_SIMP_TAC[DIMINDEX_GE_1] +THEN RESA_TAC +THEN MRESA_TAC REAL_OF_NUM_EQ[`(dimindex (:M))`;`0`] +THEN MRESA1_TAC REAL_MUL_LINV`&(dimindex (:M))` +THEN MRESAL_TAC SUM_LE_NUMSEG[`(\i:num. norm (vecmat i (matvec ((x:num->real^K^M) n - l:real^K^M))))`;`(\i:num. inv (&(dimindex (:M))) * (e:real) / &2)`;`0`;`dimindex (:M)-1`][SUM_CONST_NUMSEG;ARITH_RULE`A-0=A`;REAL_ARITH` a*b*c/ &2=(b*a)*c/ &2 /\ &1*A=A`] +THEN MATCH_MP_TAC(REAL_ARITH`&0< a /\ b<= a/ &2 ==> b +1 <= SUC i /\ SUC i <= dimindex (:M)-1+1 /\ i < dimindex (:M)-1+1`) +THEN RESA_TAC +THEN REMOVE_THEN "THY"(fun th-> MRESA1_TAC th`SUC i:num`) +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`i:num`;`(x:num-> real^K^M) n- l`] +THEN MRESA_TAC (GEN_ALL ROW_SUB)[`(x:num-> real^K^M) n`;`SUC i`;`l:real^K^M`] +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN MATCH_MP_TAC(REAL_ARITH`a a<=b`) +THEN POP_ASSUM MATCH_MP_TAC +THEN MATCH_MP_TAC(ARITH_RULE`!a b c:num. a<=b/\ b<= c ==> a<=c`) +THEN EXISTS_TAC`nsum (1..dimindex (:M)) (\i:num. (N i):num)` +THEN ASM_REWRITE_TAC[] +THEN REMOVE_ASSUM_TAC +THEN REWRITE_TAC[GSYM REAL_OF_NUM_LE;REAL_OF_NUM_SUM_NUMSEG;ADD1] +THEN MP_TAC(ARITH_RULE`0 <= i/\ i <= dimindex (:M) - 1 ==> +1 <= i+1 /\ i+1 <= dimindex (:M)-1+1 /\ i <= dimindex (:M)-1+1`) +THEN RESA_TAC +THEN MRESA_TAC SUM_CLAUSES_LEFT[`(\i:num. &(N i))`;`i+1:num`;`dimindex (:M)`] +THEN MRESA_TAC SUM_COMBINE_R[`(\i:num. &(N i))`;`1`;`i:num`;`dimindex (:M)`] +THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th]) +THEN MATCH_MP_TAC (REAL_ARITH`&0<=a /\ &0<=b ==> c<= a+c+b`) +THEN REWRITE_TAC[REAL_OF_NUM_LE;GSYM REAL_OF_NUM_SUM_NUMSEG;] +THEN MRESAL_TAC NSUM_LE_NUMSEG[`(\i:num. 0)`;`N:num->num`;`1`;`i:num`][ARITH_RULE`0<=A:num`]; +POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN REAL_ARITH_TAC]);; + +let LIM_VECMAT=prove(`((\n:num. matvec(x n )) --> matvec (l:real^K^M)) sequentially==> (!i. 1<=i /\ i <= dimindex(:M) ==> ((\n:num. row i (x n)) --> row i l) sequentially) `, +REWRITE_TAC[LIM_SEQUENTIALLY; IN_ELIM_THM; dist;] +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"THY"(fun th-> MRESA1_TAC th`e:real`) +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN EXISTS_TAC`N:num` +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"THY"(fun th-> MRESA1_TAC th`n:num`) +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<=i /\ i <= dimindex (:M)==> i -1 < dimindex (:M)`) +THEN RESA_TAC +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`i-1:num`;`(x:num-> real^K^M) n`] +THEN MRESA_TAC (GEN_ALL VECMAT_ROW)[`i-1:num`;`(l:real^K^M)`] +THEN MRESAL_TAC (GEN_ALL DIST_VECMAT)[`i-1:num`;`matvec ((x:num-> real^K^M) n)`;`matvec (l:real^K^M)`][dist;] +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<=i /\ i <= dimindex (:M)==> SUC (i -1)= i `) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REAL_ARITH_TAC);; + + + +let CROSS_DOT_SEQUENTIALLY=prove(`((\n:num. f n) --> a) sequentially /\ ((\n:num. g n) --> b) sequentially /\ ((\n:num. h n) --> c) sequentially +==> ((lift o (\n:num. (f(n) cross g(n)) dot h(n)))--> lift ((a cross b) dot c)) sequentially`, +ONCE_REWRITE_TAC[DOT_SYM] +THEN REWRITE_TAC[DOT_CROSS_DET] +THEN REPEAT STRIP_TAC +THEN ABBREV_TAC`x=(\n:num. (vector [(h:num->real^3) n; f n; g n]:real^3^3))` +THEN ABBREV_TAC`l= vector [c;a;b:real^3]:real^3^3` +THEN SUBGOAL_THEN`(!i. 1 <= i /\ i <= dimindex (:3) + ==> ((\n. row i ((x:num->real^3^3) n)) --> row i (l:real^3^3)) sequentially)` ASSUME_TAC +THENL[ +EXPAND_TAC"x" +THEN EXPAND_TAC"l" +THEN SIMP_TAC[DIMINDEX_3;row] +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`1<= i /\ i<= 3==> i=1 \/ i=2 \/ i=3`) +THEN RESA_TAC +THEN EXPAND_TAC"l" +THEN SIMP_TAC[VECTOR_3;] +THEN ASM_SIMP_TAC[LAMBDA_ETA] +THEN ASM_MESON_TAC[]; +MRESA_TAC(GEN_ALL LIM_MATVEC)[`x:num->real^3^3`;`l:real^3^3`] +THEN MRESAL1_TAC CONTINUOUS_ON_DET`(:real^(3,3)finite_product)`[CONTINUOUS_ON_SEQUENTIALLY] +THEN POP_ASSUM(fun th-> MRESAL_TAC th[`(\n. matvec ((x:num->real^3^3) n))`;`matvec (l:real^3^3)`][SET_RULE`(a:A) IN(:A)`;o_DEF;VECMATS_MATVEC_ID]) +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"x" +THEN REWRITE_TAC[]]);; + +let ABS_LT_EPSI=prove(`!a b. abs(a-b)< b/ &4 /\ &0< b==> &0 l) sequentially + ==> (s o r --> l) sequentially`, + REWRITE_TAC[LIM_SEQUENTIALLY; o_THM] THEN + MESON_TAC[MONOTONE_BIGGER; LE_TRANS]);; + +let SEQUENTIALLY_EQ_2POINT=prove(`!(h:num->A) f g. (!n:num. ((h:num->A) n) IN {f n, g n}) ==> (?r. !n. n<= r n/\ h (r n)= f (r n))\/ ?r. !n. n<= r n/\ h (r n)= g (r n)`, +REPEAT GEN_TAC THEN REWRITE_TAC[SET_RULE`a IN {B,C}<=> a=B \/ a=C`] +THEN MRESA1_TAC (SET_RULE`!A. ~A\/ A`)`?r. !n:num. n<= r n/\ (h:num->A) (r n)= f (r n)` +THENL[ +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_EXISTS_THM;NOT_FORALL_THM;GSYM SKOLEM_THM;DE_MORGAN_THM;NOT_IMP] +THEN DISCH_THEN(LABEL_TAC"THY1") +THEN DISCH_THEN(LABEL_TAC"THY2") +THEN GEN_TAC +THEN REMOVE_THEN"THY1"(fun th-> MRESA1_TAC th`(\m:num. n+SUC m:num)`) +THENL[POP_ASSUM MP_TAC +THEN ARITH_TAC; +REMOVE_THEN"THY2"(fun th-> MRESA1_TAC th`n+SUC n':num`) +THEN EXISTS_TAC`n+SUC n'` +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC]; +POP_ASSUM MP_TAC +THEN MESON_TAC[]]);; + + + +let LIM_IN_SET=prove(`!f g (h:num->real^N) a b c. ((\n. f n)--> a) sequentially /\ ((\n. g n)--> b) sequentially +/\ ((\n. h n)--> c) sequentially /\ (!n. (h n) IN {f n, g n}) +==> c IN {a,b}`, +REPEAT STRIP_TAC +THEN MRESA_TAC SEQUENTIALLY_EQ_2POINT[`h:num-> real^N`;`f:num-> real^N`;`g:num-> real^N`] +THENL[ +MRESAL_TAC (GEN_ALL LIM_SUBSEQUENCE1)[`c:real^N`;`(\n. (h:num->real^N) n)`;`r:num->num`][o_DEF] +THEN MRESAL_TAC (GEN_ALL LIM_SUBSEQUENCE1)[`a:real^N`;`(\n. (f:num->real^N) n)`;`r:num->num`][o_DEF] +THEN MRESAL_TAC LIM_UNIQUE[`sequentially`;`(\n:num. (f:num->real^N) (r(n)))`;`a:real^N`;`c:real^N`][TRIVIAL_LIMIT_SEQUENTIALLY;SET_RULE`a IN {a,b}`]; +MRESAL_TAC (GEN_ALL LIM_SUBSEQUENCE1)[`c:real^N`;`(\n. (h:num->real^N) n)`;`r:num->num`][o_DEF] +THEN MRESAL_TAC (GEN_ALL LIM_SUBSEQUENCE1)[`b:real^N`;`(\n. (g:num->real^N) n)`;`r:num->num`][o_DEF] +THEN MRESAL_TAC LIM_UNIQUE[`sequentially`;`(\n:num. (g:num->real^N) (r(n)))`;`b:real^N`;`c:real^N`][TRIVIAL_LIMIT_SEQUENTIALLY;SET_RULE`b IN {a,b}`]]);; + +let POINT_COM_AFF_GT_INTER=prove(`!y z z1 w. ~collinear{vec 0,y,z:real^3} /\ ~collinear{ vec 0,y,z1} +/\ w IN aff_gt {vec 0} {y,z} INTER aff_gt{vec 0}{y,z1} +==> z1 IN aff_ge {vec 0,y} {z}`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_SIMP_TAC[th3; AFF_GT_1_2;AFF_GE_2_1;IN_ELIM_THM;INTER;VECTOR_ARITH`a % vec 0+A=A`] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[VECTOR_ARITH`t2 % y + t3 % z = t2' % y + t3' % z1 +<=> t3' % z1= (t2- t2') % y + t3 % z`] +THEN MP_TAC(REAL_ARITH`&0< t3' ==> ~(t3'= &0)`) +THEN RESA_TAC +THEN MRESA1_TAC REAL_MUL_LINV`t3':real` +THEN STRIP_TAC +THEN MP_TAC(SET_RULE`t3' % z1= (t2- t2') % y + t3 % z +==> inv t3' %(t3' % z1)= inv(t3') % ((t2- t2') % y + t3 % z:real^3)`) +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th]) +THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B %C=(A*B)%C /\ &1 %C=C/\ A%(C+D)=A%C+A%D`;] +THEN RESA_TAC +THEN EXISTS_TAC`&1-(inv t3' * (t2 - t2'))-(inv t3' * t3):real` +THEN EXISTS_TAC`(inv t3' * (t2 - t2')):real` +THEN EXISTS_TAC`(inv t3' * t3):real` +THEN ASM_REWRITE_TAC[REAL_ARITH`&1-A-B+A+B= &1`] +THEN MATCH_MP_TAC REAL_LE_MUL +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC REAL_LE_INV +THEN ASM_TAC +THEN REAL_ARITH_TAC; +ASM_TAC +THEN REAL_ARITH_TAC]);; + + + + + + +let DART_FAN_SY=prove(`FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1<= i /\ i<= dimindex (:M) +/\ x = (row i (vecmats l),row (SUC (i MOD dimindex (:M))) (vecmats l)) +==> x IN dart (hypermap (HYP (vec 0,V_SY (vecmats l),E_SY (vecmats l))))`, +REPEAT STRIP_TAC +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN SIMP_TAC[darts_of_hyp;ord_pairs;E_SY;] +THEN MATCH_MP_TAC(SET_RULE`A IN B ==> A IN B UNION C`) +THEN REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`row i (vecmats (l:real^(M,3)finite_product))` +THEN EXISTS_TAC`row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`i:num` +THEN ASM_SIMP_TAC[]);; + +let DART_FAN_SY1=prove(`FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1<= i /\ i<= dimindex (:M) +/\ x = (row (SUC (i MOD dimindex (:M))) (vecmats l),row i (vecmats l)) +==> x IN dart (hypermap (HYP (vec 0,V_SY (vecmats l),E_SY (vecmats l))))`, +REPEAT STRIP_TAC +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN SIMP_TAC[darts_of_hyp;ord_pairs;E_SY;] +THEN MATCH_MP_TAC(SET_RULE`A IN B ==> A IN B UNION C`) +THEN REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC`row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))` +THEN EXISTS_TAC`row i (vecmats (l:real^(M,3)finite_product))` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`i:num` +THEN ASM_SIMP_TAC[SET_RULE`{A,B}={B,A}`]);; + + +let EDGE_IN_E_SY=prove(`!(l:real^(M,3)finite_product). 1<= i /\ i<= dimindex (:M) +/\ u = row i (vecmats l) +/\ v= row (SUC (i MOD dimindex (:M))) (vecmats l) +==> {u,v} IN E_SY (vecmats l)`, + +REPEAT STRIP_TAC +THEN REWRITE_TAC[E_SY;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]);; + + + +let EQ_EDGE_E_SY=prove(`!(l:real^(M,3)finite_product).FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1 i=j) +==> x=w`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +DISJ_CASES_TAC(SET_RULE`~(x=w:real^3) \/ x=w`) +THENL[ +MP_TAC(SET_RULE`{v, x} = {v, w} /\ ~(x=w:real^3)==> x= v`) +THEN RESA_TAC +THEN REMOVE_THEN "THY"(fun th-> MRESA_TAC th[`(SUC (i MOD dimindex (:M))):num`;`i:num`]) +THEN MRESA_TAC (GEN_ALL SUC_NOT)[`i:num`;`dimindex (:M):num`]; +ASM_REWRITE_TAC[]]]);; + + + +let EQ_EDGE_E_SY1=prove(`!(l:real^(M,3)finite_product). 1 i=j) +==> v=w`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +DISJ_CASES_TAC(SET_RULE`~(v=w:real^3) \/ v=w`) +THENL[ +MP_TAC(SET_RULE`{v, x} = {w,x} /\ ~(v=w:real^3)==> x= v`) +THEN RESA_TAC +THEN REMOVE_THEN "THY"(fun th-> MRESA_TAC th[`(SUC (i MOD dimindex (:M))):num`;`i:num`]) +THEN MRESA_TAC (GEN_ALL SUC_NOT)[`i:num`;`dimindex (:M):num`]; +ASM_REWRITE_TAC[]]]);; + +let MOD_IMP_EQ=prove_by_refinement(`!i j. 1<= i /\ i<= k /\ 1<= j /\ j<= k +/\ (i MOD k)= (j MOD k) +==> i=j`, +[REWRITE_TAC[ARITH_RULE`SUC i= SUC j<=> i= j`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`i<=k ==> i=k \/ i< k:num`) +THEN RESA_TAC; +MP_TAC(ARITH_RULE`1<= i /\ i<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT[`k:num`;`1`][ARITH_RULE`k*1=k`] +THEN ONCE_REWRITE_TAC[SET_RULE`A=B <=> B=A`] +THEN MRESA_TAC MOD_EQ_0[`j:num`;`k:num`] +THEN STRIP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN DISJ_CASES_TAC(ARITH_RULE`1< q \/ q=0 \/ q=1`); +MRESAL_TAC LT_LMULT[`k:num`;`1`;`q:num`][ARITH_RULE` A*1 =A`] +THEN ASM_TAC +THEN ARITH_TAC; +POP_ASSUM MP_TAC +THEN STRIP_TAC; +POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;ARITH_RULE`0*A=0`]) +THEN ARITH_TAC; +ASM_REWRITE_TAC[] +THEN ARITH_TAC; +MRESA_TAC MOD_LT[`i:num`;`k:num`] +THEN MP_TAC(ARITH_RULE`j<=k ==> j=k \/ j< k:num`) +THEN RESA_TAC; + MP_TAC(ARITH_RULE`1<= i /\ i<=k ==> ~(k=0)`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_MULT[`k:num`;`1`][ARITH_RULE`k*1=k`] +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;]) +THEN ARITH_TAC; +MRESA_TAC MOD_LT[`j:num`;`k:num`]]);; + +let SET_OF_EDGE_CARD_EQ2=prove_by_refinement(`!(l:real^(M,3)finite_product). 1 i=j) +==> set_of_edge v (V_SY (vecmats l)) (E_SY (vecmats l)) ={u,w}`, +[REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN ASM_REWRITE_TAC[set_of_edge;IN_ELIM_THM;EXTENSION] +THEN SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +GEN_TAC +THEN EQ_TAC; +REWRITE_TAC[E_SY;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN MP_TAC(SET_RULE` +{v, x} = + {row i' (vecmats l), row (SUC (i' MOD dimindex (:M))) (vecmats l)} +==> v = row i' (vecmats l) \/ v= row (SUC (i' MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`) +THEN RESA_TAC; +REMOVE_THEN "THY"(fun th-> MRESA_TAC th[`(SUC (i MOD dimindex (:M))):num`;`i':num`] +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC THEN ASSUME_TAC th) +THEN ASSUME_TAC th) +THEN MRESA_TAC (GEN_ALL EQ_EDGE_E_SY)[`i':num`;`v:real^3`;`row (SUC (i' MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`;`x:real^3`;`l:real^(M,3)finite_product`] +THEN SET_TAC[]; +REMOVE_THEN "THY"(fun th-> MRESA_TAC th[`(SUC (i MOD dimindex (:M))):num`;`(SUC (i' MOD dimindex (:M))):num`] +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC) +THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC THEN ASSUME_TAC (SYM th)) +THEN ASSUME_TAC (th)) +THEN MRESAL_TAC (GEN_ALL EQ_EDGE_E_SY1)[`i':num`;`v:real^3`;`row i' (vecmats (l:real^(M,3)finite_product))`;`x:real^3`;`l:real^(M,3)finite_product`][SET_RULE`{A,B}={B,A}`] +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SUBGOAL_THEN`1 <= SUC (i' MOD dimindex (:M)) /\ + SUC (i' MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i':num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +STRIP_TAC +THEN POP_ASSUM (fun th-> MRESAL_TAC th[`(SUC (i MOD dimindex (:M))):num`;`(SUC (i' MOD dimindex (:M))):num`][ARITH_RULE`SUC i= SUC j<=> i=j`] ) +THEN MRESA_TAC (GEN_ALL MOD_IMP_EQ)[`dimindex (:M)`;`i':num`;`i:num`] +THEN SET_TAC[]; +REWRITE_TAC[SET_RULE`a IN {b,c}<=> a=b \/ a=c`] +THEN RESA_TAC; +ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN STRIP_TAC; +REWRITE_TAC[E_SY;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; +REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; +STRIP_TAC; +REWRITE_TAC[E_SY;IN_ELIM_THM] +THEN EXISTS_TAC`SUC (i MOD dimindex (:M)):num` +THEN ASM_REWRITE_TAC[]; +REWRITE_TAC[V_SY;rows;IN_ELIM_THM] +THEN EXISTS_TAC`(SUC (SUC (i MOD dimindex (:M)) MOD dimindex (:M))):num` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`SUC (i MOD dimindex (:M)):num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC]);; + + + +let INV_AZIM_CYCLE_EQ=prove_by_refinement(`!(l:real^(M,3)finite_product).FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1 < dimindex (:M) +/\ 1<= i /\ i<= dimindex (:M) +/\ row i (vecmats l)=u +/\ row (SUC (i MOD dimindex (:M))) (vecmats l)=v +/\ (row (SUC ((SUC (i MOD dimindex (:M))) MOD dimindex (:M))) (vecmats l))=w +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> ivs_azim_cycle (EE v (E_SY (vecmats l))) (vec 0) v u =w`, +[REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`i:num`;`u:real^3`;`v:real^3`;`(l:real^(M,3)finite_product)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`(SUC (i MOD dimindex (:M))):num`;`v:real^3`;`w:real^3`;`(l:real^(M,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL Wrgcvdr_cizmrrh.IVS_AZIM_EQ_INVERSE_SIGMA_FAN)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.SIG_AND_INVERSE1_SIG) +[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`v:real^3`;`u:real^3`;`w:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC(GEN_ALL SET_OF_EDGE_CARD_EQ2)[`i:num`;`v:real^3`;`u:real^3`;`w:real^3`;`l:real^(M,3)finite_product`] +THEN MRESA_TAC Fan.sigma_fan_in_set_of_edge[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`u=w \/ ~({u,w}={w:real^3})`); +ASM_REWRITE_TAC[] +THEN SET_TAC[]; +MRESA_TAC SIGMA_FAN [`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`v:real^3`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]);; + +let INV_AZIM_CYCLE_EQ1=prove_by_refinement( +`!(l:real^(M,3)finite_product).FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1 < dimindex (:M) +/\ 1<= i /\ i<= dimindex (:M) +/\ row i (vecmats l)=u +/\ row (SUC (i MOD dimindex (:M))) (vecmats l)=v +/\ (row (SUC ((SUC (i MOD dimindex (:M))) MOD dimindex (:M))) (vecmats l))=w +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> ivs_azim_cycle (EE v (E_SY (vecmats l))) (vec 0) v w =u`, +[REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`i:num`;`u:real^3`;`v:real^3`;`(l:real^(M,3)finite_product)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`(SUC (i MOD dimindex (:M))):num`;`v:real^3`;`w:real^3`;`(l:real^(M,3)finite_product)`] +THEN MRESA_TAC (GEN_ALL Wrgcvdr_cizmrrh.IVS_AZIM_EQ_INVERSE_SIGMA_FAN)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.SIG_AND_INVERSE1_SIG) +[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`v:real^3`;`w:real^3`;`u:real^3`] +THEN POP_ASSUM MATCH_MP_TAC +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`u:real^3`;`v:real^3`] +THEN MRESA_TAC(GEN_ALL SET_OF_EDGE_CARD_EQ2)[`i:num`;`v:real^3`;`u:real^3`;`w:real^3`;`l:real^(M,3)finite_product`] +THEN MRESA_TAC Fan.sigma_fan_in_set_of_edge[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`u=w \/ ~({u,w}={u:real^3})`); +ASM_REWRITE_TAC[] +THEN SET_TAC[]; +MRESA_TAC SIGMA_FAN [`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`v:real^3`;`u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]);; + + + + +let FF_OF_HYP_EQ=prove(`FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1< dimindex (:M) +/\ 1<= i /\ i<= dimindex (:M) +/\ row i (vecmats l)=u +/\ row (SUC (i MOD dimindex (:M))) (vecmats l)=v +/\ (row (SUC ((SUC (i MOD dimindex (:M))) MOD dimindex (:M))) (vecmats l))=w +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> v,w = + (ff_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l))) (u,v)`, +REWRITE_TAC[ff_of_hyp] +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC +THENL[ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN MRESAL_TAC (GEN_ALL DART_FAN_SY)[`i:num`;`(u:real^3,v:real^3)`;`l:real^(M,3)finite_product`][PAIR_EQ] +THEN MRESA_TAC(GEN_ALL INV_AZIM_CYCLE_EQ)[`i:num`;`v:real^3`;`u:real^3`;`w:real^3`;`l:real^(M,3)finite_product`]]);; + + + + + + +let POWER_FF_OF_HYP_EQ=prove(`!i u v l x. FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1< dimindex (:M) +/\ 1<= i /\ i<= dimindex (:M) +/\ row i (vecmats l)=u +/\ row (SUC (i MOD dimindex (:M))) (vecmats l)=v +/\ x= (row 1 (vecmats l),row (SUC (1 MOD dimindex (:M))) (vecmats l)) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> (u,v) = + (ff_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l)) POWER (i - 1)) x`, +INDUCT_TAC +THENL[ARITH_TAC; +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(ARITH_RULE`i=0\/ 1<= i`) +THENL[ +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN ASM_TAC +THEN ONCE_REWRITE_TAC[ARITH_RULE`SUC 0=1 /\ SUC 0 -1=0`] +THEN REPEAT RESA_TAC +THEN REWRITE_TAC[POWER;I_DEF]; +MP_TAC(ARITH_RULE`SUC i <= dimindex (:M)==> i <= dimindex (:M) /\ i < dimindex (:M)`) +THEN RESA_TAC +THEN REMOVE_THEN"THY"(fun th-> MRESA_TAC th[`row i (vecmats (l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`;`(l:real^(M,3)finite_product)`;`row 1 (vecmats (l:real^(M,3)finite_product)),row (SUC (1 MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`]) +THEN MP_TAC(ARITH_RULE`1<=i ==> SUC i-1= SUC (i-1)`) +THEN RESA_TAC +THEN ASM_REWRITE_TAC[Hypermap.COM_POWER;o_DEF] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC(GEN_ALL FF_OF_HYP_EQ)[`i:num`;`(row (SUC ((SUC (i MOD dimindex (:M))) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(l:real^(M,3)finite_product)`;`row i (vecmats (l:real^(M,3)finite_product))`;`row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`;] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC MOD_LT[`i:num`;`dimindex (:M)`]]]);; + + + +let POWER_FF_HYP_ID=prove(`!k l x. FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1< k +/\ dimindex (:M)= k +/\ (row 1 (vecmats l),row (SUC (1 MOD dimindex (:M))) (vecmats l))= x +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> x = + (ff_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l)) POWER k) x`, +REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`1 ~(k=0)/\ 1<= k /\ k <= k/\ k= SUC (k-1)`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN REWRITE_TAC[Hypermap.COM_POWER;o_DEF] +THEN MRESAL_TAC POWER_FF_OF_HYP_EQ[`k:num`;`(row (k:num) (vecmats (l:real^(M,3)finite_product)))`;`row (SUC ((k) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`;`(l:real^(M,3)finite_product)`;`x:real^3#real^3`][ARITH_RULE`dimindex (:M)<=dimindex (:M)`] +THEN POP_ASSUM MP_TAC +THEN EXPAND_TAC"k" +THEN REWRITE_TAC[ARITH_RULE`dimindex (:M)<=dimindex (:M)`] +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESA_TAC(GEN_ALL FF_OF_HYP_EQ)[`k:num`;`(row (SUC ((SUC (k MOD dimindex (:M))) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(l:real^(M,3)finite_product)`;`row k (vecmats (l:real^(M,3)finite_product))`;`row (SUC (k MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`;] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC MOD_MULT[`k:num`;`1`][ARITH_RULE`k*1=k`;ARITH_RULE`SUC 0=1`] +THEN MRESA_TAC MOD_LT[`1:num`;`dimindex (:M)`] +THEN EXPAND_TAC"x" +THEN REWRITE_TAC[PAIR_EQ] +THEN ASM_REWRITE_TAC[]);; + + + +let FACE_HYP_FAN_SY=prove(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1< dimindex (:M) +/\ (row 1 (vecmats l),row (SUC (1 MOD dimindex (:M))) (vecmats l))=x +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> F_SY (vecmats l) = + face (hypermap (HYP (vec 0,V_SY (vecmats l),E_SY (vecmats l)))) x`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[face;EXTENSION;IN_ELIM_THM;F_SY;] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +MRESAL_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`][orbit_map;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`i-1:num` +THEN MP_TAC(ARITH_RULE`1<= i==> i-1>= 0`) +THEN RESA_TAC +THEN MATCH_MP_TAC POWER_FF_OF_HYP_EQ +THEN ASM_REWRITE_TAC[]; +MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN MP_TAC(ARITH_RULE`1 ~(dimindex (:M)=0)`) +THEN RESA_TAC +THEN MRESA_TAC POWER_FF_HYP_ID[`dimindex (:M)`;`(l:real^(M,3)finite_product)`;`x:real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A=B <=> B=A`] +THEN RESA_TAC +THEN MRESA_TAC Hypermap.orbit_cyclic [`(face_map (hypermap (HYP (vec 0,V_SY (vecmats l),E_SY (vecmats (l:real^(M,3)finite_product))))))`;`dimindex (:M)`;`x:real^3#real^3`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`k SUC k<= dimindex (:M) /\ SUC(SUC k -1)= SUC k/\ k = SUC k -1`) +THEN RESA_TAC +THEN EXISTS_TAC`SUC k` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC k`] +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN MATCH_MP_TAC POWER_FF_OF_HYP_EQ +THEN ASM_REWRITE_TAC[] +THEN ARITH_TAC]);; + + +let CARD_F_SY_EQ=prove(`1< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats (l:real^(M,3)finite_product)) +==> i=j) +==> CARD (F_SY (vecmats l))= dimindex (:M)`, +REWRITE_TAC[F_SY] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN SUBGOAL_THEN`{y | ?x. x IN 1..dimindex (:M) /\ + y = + row x (vecmats l), + row (SUC (x MOD dimindex (:M))) (vecmats l)} +={row i (vecmats l),row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)) | 1 <= i /\ + i <= + dimindex + (:M)}`ASSUME_TAC +THENL[ +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG]; +MRESAL_TAC CARD_IMAGE_INJ[`(\i:num. (row i (vecmats l),row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))))`;`1..dimindex (:M)`] +[FINITE_NUMSEG;IMAGE;CARD_NUMSEG_1] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[IN_NUMSEG;PAIR_EQ] +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"THY"(fun th-> MRESA_TAC th[`x:num`;`y:num`])]);; + + + +let AZIM_CYCLE_EQ1=prove_by_refinement( `!(l:real^(M,3)finite_product).FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1 < dimindex (:M) +/\ 1<= i /\ i<= dimindex (:M) +/\ row i (vecmats l)=u +/\ row (SUC (i MOD dimindex (:M))) (vecmats l)=v +/\ (row (SUC ((SUC (i MOD dimindex (:M))) MOD dimindex (:M))) (vecmats l))=w +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> azim_cycle (EE v (E_SY (vecmats l))) (vec 0) v w =u`, +[REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`i:num`;`u:real^3`;`v:real^3`;`(l:real^(M,3)finite_product)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`(SUC (i MOD dimindex (:M))):num`;`v:real^3`;`w:real^3`;`(l:real^(M,3)finite_product)`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Wrgcvdr_cizmrrh.AZIM_CYCLE_EQ_SIGMA_FAN)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`v:real^3`;`w:real^3`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`u:real^3`;`v:real^3`] +THEN MRESA_TAC(GEN_ALL SET_OF_EDGE_CARD_EQ2)[`i:num`;`v:real^3`;`u:real^3`;`w:real^3`;`l:real^(M,3)finite_product`] +THEN MRESA_TAC Fan.sigma_fan_in_set_of_edge[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`v:real^3`;`w:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`u=w \/ ~({u,w}={w:real^3})`); +ASM_REWRITE_TAC[] +THEN SET_TAC[]; +MRESA_TAC SIGMA_FAN [`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`v:real^3`;`w:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]);; + + +let AZIM_CYCLE_EQ=prove_by_refinement( `!(l:real^(M,3)finite_product).FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1 < dimindex (:M) +/\ 1<= i /\ i<= dimindex (:M) +/\ row i (vecmats l)=u +/\ row (SUC (i MOD dimindex (:M))) (vecmats l)=v +/\ (row (SUC ((SUC (i MOD dimindex (:M))) MOD dimindex (:M))) (vecmats l))=w +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> azim_cycle (EE v (E_SY (vecmats l))) (vec 0) v u =w`, +[REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`i:num`;`u:real^3`;`v:real^3`;`(l:real^(M,3)finite_product)`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] +THEN RESA_TAC +THEN SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MRESA_TAC (GEN_ALL EDGE_IN_E_SY)[`(SUC (i MOD dimindex (:M))):num`;`v:real^3`;`w:real^3`;`(l:real^(M,3)finite_product)`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`u:real^3`;`v:real^3`] +THEN MRESA_TAC (GEN_ALL Wrgcvdr_cizmrrh.AZIM_CYCLE_EQ_SIGMA_FAN)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`v:real^3`;`u:real^3`] +THEN MRESA_TAC remark1_fan[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`w:real^3`;`v:real^3`] +THEN MRESA_TAC(GEN_ALL SET_OF_EDGE_CARD_EQ2)[`i:num`;`v:real^3`;`u:real^3`;`w:real^3`;`l:real^(M,3)finite_product`] +THEN MRESA_TAC Fan.sigma_fan_in_set_of_edge[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`v:real^3`;`u:real^3`] +THEN POP_ASSUM MP_TAC +THEN DISJ_CASES_TAC(SET_RULE`u=w \/ ~({u,w}={u:real^3})`); +ASM_REWRITE_TAC[] +THEN SET_TAC[]; +MRESA_TAC SIGMA_FAN [`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`;`v:real^3`;`u:real^3`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN SET_TAC[]]);; + +let NN_OF_HYP_EQ1=prove(`FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1< dimindex (:M) +/\ 1<= i /\ i<= dimindex (:M) +/\ row i (vecmats l)=u +/\ row (SUC (i MOD dimindex (:M))) (vecmats l)=v +/\ (row (SUC ((SUC (i MOD dimindex (:M))) MOD dimindex (:M))) (vecmats l))=w +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> v,u = + (nn_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l))) (v,w)`, +REWRITE_TAC[nn_of_hyp] +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN MRESAL_TAC (GEN_ALL DART_FAN_SY)[`(SUC (i MOD dimindex (:M)))`;`(v:real^3,w:real^3)`;`l:real^(M,3)finite_product`][PAIR_EQ] +THEN MRESA_TAC(GEN_ALL AZIM_CYCLE_EQ1)[`i:num`;`v:real^3`;`w:real^3`;`u:real^3`;`l:real^(M,3)finite_product`]]);; + + + +let NN_OF_HYP_EQ=prove(`FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1< dimindex (:M) +/\ 1<= i /\ i<= dimindex (:M) +/\ row i (vecmats l)=u +/\ row (SUC (i MOD dimindex (:M))) (vecmats l)=v +/\ (row (SUC ((SUC (i MOD dimindex (:M))) MOD dimindex (:M))) (vecmats l))=w +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> v,w = + (nn_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l))) (v,u)`, +REWRITE_TAC[nn_of_hyp] +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN MRESAL_TAC (GEN_ALL DART_FAN_SY1)[`i:num`;`(v:real^3,u:real^3)`;`l:real^(M,3)finite_product`][PAIR_EQ] +THEN MRESA_TAC(GEN_ALL AZIM_CYCLE_EQ)[`i:num`;`v:real^3`;`u:real^3`;`w:real^3`;`l:real^(M,3)finite_product`]]);; + + +let DART_OF_HYP_SY_EQ=prove_by_refinement(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> darts_of_hyp (E_SY (vecmats l)) (V_SY (vecmats l)) = (F_SY (vecmats l)) UNION (IMAGE (nn_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l))) (F_SY (vecmats l)))`, +[REPEAT STRIP_TAC +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN REWRITE_TAC[EXTENSION;] +THEN GEN_TAC +THEN EQ_TAC; +REWRITE_TAC[darts_of_hyp;UNION;IN_ELIM_THM;ord_pairs;self_pairs] +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[E_SY;] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN REPEAT STRIP_TAC; +MP_TAC(SET_RULE`{a, b} = + {row i (vecmats l), row (SUC (i MOD dimindex (:M))) (vecmats l)} +==> a = row i (vecmats (l:real^(M,3)finite_product))\/ a= row (SUC (i MOD dimindex (:M))) (vecmats l)`) +THEN RESA_TAC; +MRESA_TAC (GEN_ALL EQ_EDGE_E_SY)[`i:num`;`a:real^3`;`row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`;`b:real^3`;`l:real^(M,3)finite_product`] +THEN MATCH_MP_TAC(SET_RULE`A IN B==> A IN B \/ A IN C`) +THEN REWRITE_TAC[F_SY;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; +MRESAL_TAC (GEN_ALL EQ_EDGE_E_SY1)[`i:num`;`a:real^3`;`row i (vecmats (l:real^(M,3)finite_product))`;`b:real^3`;`l:real^(M,3)finite_product`][SET_RULE`{A,B}={B,A}`] +THEN MATCH_MP_TAC(SET_RULE`A IN C==> A IN B \/ A IN C`) +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM] +THEN EXISTS_TAC`a:real^3,(row (SUC ((SUC (i MOD dimindex (:M))) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))` +THEN STRIP_TAC; +REWRITE_TAC[F_SY;IN_ELIM_THM] +THEN EXISTS_TAC`(SUC (i MOD dimindex (:M)))` +THEN ASM_REWRITE_TAC[] +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MRESA_TAC(GEN_ALL NN_OF_HYP_EQ1)[`i:num`;`b:real^3`;`l:real^(M,3)finite_product`;`a:real^3`;`(row (SUC ((SUC (i MOD dimindex (:M))) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`]; +MRESA_TAC (GEN_ALL Wrgcvdr_cizmrrh.FAN_IMP_EE_EQ_SET_OF_EDGE) +[`vec 0:real^3`;`v:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN POP_ASSUM MP_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[V_SY;] +THEN REWRITE_TAC[IN_ELIM_THM;rows] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`1<= i==> i=1 \/ 1<= i-1`) +THEN RESA_TAC; +MRESAL_TAC MOD_MULT[`dimindex (:M)`;`1`][ARITH_RULE`k*1=k`;ARITH_RULE`SUC 0=1`;DIMINDEX_NONZERO] +THEN MRESA_TAC MOD_LT[`1:num`;`dimindex (:M)`] +THEN MRESAL_TAC(GEN_ALL SET_OF_EDGE_CARD_EQ2)[`dimindex (:M):num`;`(row +1 (vecmats (l:real^(M,3)finite_product)))`;`(row (dimindex (:M)) (vecmats (l:real^(M,3)finite_product)))`;`(row +(SUC 1) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1] +THEN SET_TAC[]; +MP_TAC(ARITH_RULE`1<= i /\ i<= dimindex (:M) ==> i-1 < dimindex (:M)/\ i-1 <= dimindex (:M)/\ i= SUC (i-1)`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN MRESAL_TAC MOD_LT[`i-1:num`;`dimindex (:M):num`][ARITH_RULE`0<1`] +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL SET_OF_EDGE_CARD_EQ2)[`i-1:num`;`(row +(SUC ((i - 1) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(row (i-1) (vecmats (l:real^(M,3)finite_product)))`;`(row +(SUC (SUC ((i - 1) MOD dimindex (:M)) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1] +THEN SET_TAC[]; + REWRITE_TAC[UNION;IN_ELIM_THM] +THEN STRIP_TAC; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[F_SY;IN_ELIM_THM] +THEN STRIP_TAC; +MRESA_TAC (GEN_ALL DART_FAN_SY)[`i:num`;`x:real^3#real^3`;`l:real^(M,3)finite_product`]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;F_SY] +THEN STRIP_TAC +THEN MP_TAC(ARITH_RULE`1<= i==> i=1 \/ 1<= i-1`) +THEN RESA_TAC; +MRESAL_TAC MOD_MULT[`dimindex (:M)`;`1`][ARITH_RULE`k*1=k`;ARITH_RULE`SUC 0=1`;DIMINDEX_NONZERO] +THEN MRESA_TAC MOD_LT[`1:num`;`dimindex (:M)`] +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ1)[`dimindex (:M):num`;`(row +(dimindex (:M)) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row 1 (vecmats (l:real^(M,3)finite_product)))`;`(row +(SUC 1) (vecmats (l:real^(M,3)finite_product)))`;][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC (GEN_ALL DART_FAN_SY1)[`dimindex (:M):num`;`row 1 (vecmats l),row (dimindex (:M)) (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1]; +MP_TAC(ARITH_RULE`1<= i /\ i<= dimindex (:M) ==> i-1 < dimindex (:M)/\ i-1 <= dimindex (:M)/\ i= SUC (i-1)`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN MRESAL_TAC MOD_LT[`i-1:num`;`dimindex (:M):num`][ARITH_RULE`0<1`] +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ1)[`i-1:num`;`(row +(i-1) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row (SUC ((i - 1) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(row +(SUC (SUC ((i - 1) MOD dimindex (:M)) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC (GEN_ALL DART_FAN_SY1)[`i-1:num`;`row (SUC ((i-1) MOD dimindex (:M))) (vecmats l),row (i-1) (vecmats (l:real^(M,3)finite_product))`;`l:real^(M,3)finite_product`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1]]);; + + +let IMAGE_NN_OF_HYP_F_SY=prove_by_refinement(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> (IMAGE (nn_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l))) (F_SY (vecmats l)))={row (SUC (i MOD dimindex (:M))) (vecmats l),row i (vecmats l) | 1 <= i /\ + i <= dimindex (:M)}`, +[REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;EXTENSION; F_SY] +THEN GEN_TAC +THEN EQ_TAC; +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`1<= i==> i=1 \/ 1<= i-1`) +THEN RESA_TAC; +MRESAL_TAC MOD_MULT[`dimindex (:M)`;`1`][ARITH_RULE`k*1=k`;ARITH_RULE`SUC 0=1`;DIMINDEX_NONZERO] +THEN MRESA_TAC MOD_LT[`1:num`;`dimindex (:M)`] +THEN EXISTS_TAC`dimindex (:M)` +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ1)[`dimindex (:M):num`;`(row +(dimindex (:M)) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row 1 (vecmats (l:real^(M,3)finite_product)))`;`(row +(SUC 1) (vecmats (l:real^(M,3)finite_product)))`;][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1]; +MP_TAC(ARITH_RULE`1<= i /\ i<= dimindex (:M) ==> i-1 < dimindex (:M)/\ i-1 <= dimindex (:M)/\ i= SUC (i-1)`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN MRESAL_TAC MOD_LT[`i-1:num`;`dimindex (:M):num`][ARITH_RULE`0<1`] +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN EXISTS_TAC`i-1:num` +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ1)[`i-1:num`;`(row +(i-1) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row (SUC ((i - 1) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(row +(SUC (SUC ((i - 1) MOD dimindex (:M)) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1]; +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)),row (SUC (SUC (i MOD dimindex (:M)) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))` +THEN STRIP_TAC; +EXISTS_TAC`(SUC (i MOD dimindex (:M)))` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ1)[`i:num`;`(row +(i) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row (SUC ((i) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(row +(SUC (SUC ((i) MOD dimindex (:M)) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1]]);; + + +let CARD_IMAGE_F_SY_EQ=prove(`1< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats (l:real^(M,3)finite_product)) +==> i=j) +==> CARD ({row (SUC (i MOD dimindex (:M))) (vecmats l),row i (vecmats l) | 1 <= i /\ + i <= dimindex (:M)})= dimindex (:M)`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN SUBGOAL_THEN`{y | ?x. x IN 1..dimindex (:M) /\ + y = + row (SUC (x MOD dimindex (:M))) (vecmats l), +row x (vecmats l)} +={row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)),row i (vecmats l) | 1 <= i /\ + i <= + dimindex + (:M)}`ASSUME_TAC +THENL[ +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG]; +MRESAL_TAC CARD_IMAGE_INJ[`(\i:num. row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)),(row i (vecmats l)))`;`1..dimindex (:M)`] +[FINITE_NUMSEG;IMAGE;CARD_NUMSEG_1] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[IN_NUMSEG;PAIR_EQ] +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"THY"(fun th-> MRESA_TAC th[`x:num`;`y:num`])]);; + + +let SUC_POWER2_NOT=prove_by_refinement(`2< k /\ i<=k ==> ~(i= SUC(SUC(i MOD k) MOD k))`, +[REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`i<=k/\ 2 i=k \/ SUC i=k\/ SUC i< k`) +THEN RESA_TAC; +MP_TAC(ARITH_RULE`2 ~(k=0)/\ 1 i ASM_TAC THEN REWRITE_TAC[th;ARITH_RULE`SUC 1=2`]) +THEN ARITH_TAC; +MP_TAC(ARITH_RULE`SUC i i i=j) +==> F_SY(vecmats l) INTER {row (SUC (i MOD dimindex (:M))) (vecmats l),row i (vecmats l) | 1 <= i /\ + i <= dimindex (:M)}= {}`, +REWRITE_TAC[F_SY;INTER;EXTENSION;EMPTY;IN_ELIM_THM] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PAIR_EQ] +THEN STRIP_TAC +THEN SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +SUBGOAL_THEN`1 <= SUC (i' MOD dimindex (:M)) /\ + SUC (i' MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i':num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +REMOVE_THEN"THY"(fun th-> MRESA_TAC th[`i:num `;`(SUC (i' MOD dimindex (:M)))`] THEN MRESA_TAC th[`i':num `;`(SUC (i MOD dimindex (:M)))`]) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL SUC_POWER2_NOT)[`i':num`;`dimindex (:M)`]]]);; + +let FINITE_F_SY=prove(` FINITE (F_SY(vecmats (l:real^(M,N)finite_product)))`, +REWRITE_TAC[F_SY] +THEN SUBGOAL_THEN`{y | ?x. x IN 1..dimindex (:M) /\ + y = + row x (vecmats l), + row (SUC (x MOD dimindex (:M))) (vecmats l)} +={row i (vecmats l),row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,N)finite_product)) | 1 <= i /\ + i <= + dimindex + (:M)}`ASSUME_TAC +THENL[ +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG]; +MRESAL_TAC FINITE_IMAGE +[`(\i:num. (row i (vecmats l),row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,N)finite_product))))`;`1..dimindex (:M)`] +[FINITE_NUMSEG;IMAGE;CARD_NUMSEG_1] +THEN POP_ASSUM MATCH_MP_TAC]);; + + + +let FINITE_IMAGE_F_SY=prove(`1< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats (l:real^(M,3)finite_product)) +==> i=j) +==> FINITE({row (SUC (i MOD dimindex (:M))) (vecmats l),row i (vecmats l) | 1 <= i /\ + i <= dimindex (:M)})`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN SUBGOAL_THEN`{y | ?x. x IN 1..dimindex (:M) /\ + y = + row (SUC (x MOD dimindex (:M))) (vecmats l), +row x (vecmats l)} +={row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)),row i (vecmats l) | 1 <= i /\ + i <= + dimindex + (:M)}`ASSUME_TAC +THENL[ +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG]; +MRESAL_TAC FINITE_IMAGE[`(\i:num. row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)),(row i (vecmats l)))`;`1..dimindex (:M)`] +[FINITE_NUMSEG;IMAGE;CARD_NUMSEG_1] +THEN POP_ASSUM MATCH_MP_TAC +THEN REWRITE_TAC[IN_NUMSEG;PAIR_EQ] +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"THY"(fun th-> MRESA_TAC th[`x:num`;`y:num`])]);; + + + + + + +let CARD_DART_OF_HYP=prove(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 2< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> CARD (darts_of_hyp (E_SY (vecmats l)) (V_SY (vecmats l))) = 2 * dimindex (:M)`, +REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`2< dimindex(:M)==> 1< dimindex(:M)`) +THEN RESA_TAC +THEN MRESA1_TAC (GEN_ALL DART_OF_HYP_SY_EQ)`l:real^(M,3)finite_product` +THEN MRESA1_TAC (GEN_ALL IMAGE_NN_OF_HYP_F_SY)`l:real^(M,3)finite_product` +THEN MRESA1_TAC(GEN_ALL F_SY_INTER_IMAGE_NN_EMPTY)`l:real^(M,3)finite_product` +THEN MRESA1_TAC(GEN_ALL FINITE_F_SY)`l:real^(M,3)finite_product` +THEN MRESA1_TAC(GEN_ALL FINITE_IMAGE_F_SY)`l:real^(M,3)finite_product` +THEN MRESA_TAC CARD_UNION[`F_SY (vecmats (l:real^(M,3)finite_product))`;`IMAGE (nn_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l))) + (F_SY (vecmats (l:real^(M,3)finite_product)))`] +THEN MRESA1_TAC(GEN_ALL CARD_IMAGE_F_SY_EQ)`l:real^(M,3)finite_product` +THEN MRESA1_TAC(GEN_ALL CARD_F_SY_EQ)`l:real^(M,3)finite_product` +THEN ARITH_TAC);; + + +let IMAGE_NN_OF_HYP_EQ_F_SY=prove_by_refinement(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> IMAGE (nn_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l))) {row (SUC (i MOD dimindex (:M))) (vecmats l),row i (vecmats l) | 1 <= i /\ + i <= dimindex (:M)} +=F_SY (vecmats l)`, +[REPEAT STRIP_TAC +THEN REWRITE_TAC[IMAGE;IN_ELIM_THM;EXTENSION; F_SY] +THEN GEN_TAC +THEN EQ_TAC; +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`(SUC (i MOD dimindex (:M)))` +THEN MRESA_TAC(GEN_ALL NN_OF_HYP_EQ)[`i:num`;`(row +(SUC (SUC (i MOD dimindex (:M)) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row +(SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(row i (vecmats (l:real^(M,3)finite_product)))`] +THEN ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i':num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN MP_TAC(ARITH_RULE`1<= i==> i=1 \/ 1<= i-1`) +THEN RESA_TAC; +MRESAL_TAC MOD_MULT[`dimindex (:M)`;`1`][ARITH_RULE`k*1=k`;ARITH_RULE`SUC 0=1`;DIMINDEX_NONZERO] +THEN MRESA_TAC MOD_LT[`1:num`;`dimindex (:M)`] +THEN EXISTS_TAC`row 1 (vecmats l),row (dimindex (:M)) (vecmats (l:real^(M,3)finite_product))` +THEN STRIP_TAC; +EXISTS_TAC`dimindex (:M)` +THEN ASM_REWRITE_TAC[ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1]; +MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ)[`dimindex (:M):num`;`(row +(SUC 1) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row 1 (vecmats (l:real^(M,3)finite_product)))`;`(row +(dimindex (:M)) (vecmats (l:real^(M,3)finite_product)))`;][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1]; +MP_TAC(ARITH_RULE`1<= i /\ i<= dimindex (:M) ==> i-1 < dimindex (:M)/\ i-1 <= dimindex (:M)/\ i= SUC (i-1)`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN MRESAL_TAC MOD_LT[`i-1:num`;`dimindex (:M):num`][ARITH_RULE`0<1`] +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN EXISTS_TAC`row (SUC ((i - 1) MOD dimindex (:M))) (vecmats l),row (i-1) (vecmats (l:real^(M,3)finite_product))` +THEN STRIP_TAC; +EXISTS_TAC`i-1:num` +THEN ASM_REWRITE_TAC[]; +MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ)[`i-1:num`;`(row +(SUC (SUC ((i - 1) MOD dimindex (:M)) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row (SUC ((i - 1) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(row +(i-1) (vecmats (l:real^(M,3)finite_product)))`;][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1]]);; + + +let DART_OF_HYP_SY_EQ1=prove(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +/\ {row (SUC (i MOD dimindex (:M))) (vecmats l),row i (vecmats l) | 1 <= i /\ + i <= dimindex (:M)}=S +==> darts_of_hyp (E_SY (vecmats l)) (V_SY (vecmats l)) = S UNION (IMAGE (nn_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l))) S)`, +REPEAT STRIP_TAC +THEN MRESA1_TAC (GEN_ALL IMAGE_NN_OF_HYP_EQ_F_SY)`l:real^(M,3)finite_product` +THEN MRESA1_TAC (GEN_ALL IMAGE_NN_OF_HYP_F_SY)`l:real^(M,3)finite_product` +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN ONCE_REWRITE_TAC[SET_RULE`A UNION B=B UNION A`] +THEN MATCH_MP_TAC DART_OF_HYP_SY_EQ +THEN ASM_REWRITE_TAC[]);; + +let F_SY_EQ_FACE=prove(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1< dimindex (:M) +/\ 1<= i /\ i<= dimindex (:M) +/\ (row i (vecmats l),row (SUC (i MOD dimindex (:M))) (vecmats l))=x +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> F_SY (vecmats l) = + face (hypermap (HYP (vec 0,V_SY (vecmats l),E_SY (vecmats l)))) x`, +REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL FACE_HYP_FAN_SY)[`l:real^(M,3)finite_product`;`row 1 (vecmats l),row (SUC (1 MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`] +THEN MATCH_MP_TAC lemma_face_identity +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[F_SY;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]);; + + +let FF_OF_HYP_EQ1=prove(`FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1< dimindex (:M) +/\ 1<= i /\ i<= dimindex (:M) +/\ row i (vecmats l)=u +/\ row (SUC (i MOD dimindex (:M))) (vecmats l)=v +/\ (row (SUC ((SUC (i MOD dimindex (:M))) MOD dimindex (:M))) (vecmats l))=w +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> v,u = + (ff_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l))) (w,v)`, +REWRITE_TAC[ff_of_hyp] +THEN REPEAT STRIP_TAC +THEN SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC +THENL[ +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN MRESAL_TAC (GEN_ALL DART_FAN_SY1)[`(SUC (i MOD dimindex (:M))):num`;`(w:real^3,v:real^3)`;`l:real^(M,3)finite_product`][PAIR_EQ] +THEN MRESA_TAC(GEN_ALL INV_AZIM_CYCLE_EQ1)[`i:num`;`v:real^3`;`w:real^3`;`u:real^3`;`l:real^(M,3)finite_product`]]);; + + + + + + +let POWER_FF_OF_HYP_EQ1=prove(`!j i u v l x. FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1< dimindex (:M) +/\ 1<= i /\ i<= dimindex (:M) +/\ j= (dimindex (:M)-i + 1) +/\ row i (vecmats l)=u +/\ row (SUC (i MOD dimindex (:M))) (vecmats l)=v +/\ x= row (SUC (1 MOD dimindex (:M))) (vecmats l),row 1 (vecmats l) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> (v,u)= + (ff_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l)) POWER j) x`, +INDUCT_TAC +THENL[ +ARITH_TAC; +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`i<= dimindex (:M)==> i= dimindex (:M)\/ i< dimindex (:M)`) +THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`i<= dimindex (:M)` +THEN STRIP_TAC +THENL[ +POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN ASM_REWRITE_TAC[ARITH_RULE`dimindex (:M) - dimindex (:M) + 1=1`;POWER_1] +THEN MRESAL_TAC MOD_MULT[`dimindex (:M)`;`1`][ARITH_RULE`k*1=k`;ARITH_RULE`SUC 0=1`;DIMINDEX_NONZERO] +THEN MRESA_TAC MOD_LT[`1:num`;`dimindex (:M)`] +THEN MRESAL_TAC(GEN_ALL FF_OF_HYP_EQ1)[`dimindex (:M):num`;`row (dimindex (:M)) (vecmats (l:real^(M,3)finite_product))`;`(l:real^(M,3)finite_product)`;`row (SUC (1 MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`;`row (SUC (dimindex (:M) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`;][ARITH_RULE`SUC 0=1`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM (fun th-> SUBST_ALL_TAC(th)) +THEN ASM_REWRITE_TAC[ARITH_RULE`1= SUC 0`]; + ASM_REWRITE_TAC[Hypermap.COM_POWER;o_DEF] +THEN MP_TAC(ARITH_RULE`SUC j = dimindex (:M) - i + 1 /\ i< dimindex (:M)==> dimindex (:M) - j + 1= SUC i/\ SUC i<= dimindex (:M) /\ 1<= SUC i/\ j = dimindex (:M) - SUC i + 1`) +THEN RESA_TAC +THEN MRESA_TAC MOD_LT[`i:num`;`dimindex (:M)`] +THEN REMOVE_THEN"THY"(fun th-> MRESA_TAC th[`dimindex (:M) -j +1`;`row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`;`row (SUC ((SUC (i MOD dimindex (:M))) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`;`(l:real^(M,3)finite_product)`;`x:real^3#real^3`]) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC(GEN_ALL FF_OF_HYP_EQ1)[`i:num`;`row i (vecmats (l:real^(M,3)finite_product))`;`(l:real^(M,3)finite_product)`;`row (SUC (SUC (i MOD dimindex (:M)) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`;`v:real^3`;]]]);; + + + + +let POWER_FF_HYP_ID1=prove(`!k l x. FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1< k +/\ dimindex (:M)= k +/\ row (SUC (1 MOD dimindex (:M))) (vecmats l),row 1 (vecmats l)= x +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> x = + (ff_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l)) POWER k) x`, +REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`1 k=k-1+1/\ 1<=k`) +THEN RESA_TAC +THEN MRESAL_TAC POWER_FF_OF_HYP_EQ1[`k:num`;`1`;`(row (1:num) (vecmats (l:real^(M,3)finite_product)))`;`row (SUC (1 MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`;`(l:real^(M,3)finite_product)`;`x:real^3#real^3`][ARITH_RULE`dimindex (:M)<=dimindex (:M)/\ 1<=1`] +THEN POP_ASSUM MATCH_MP_TAC +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC);; + + +let FACE_HYP_FAN_SY1=prove(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1< dimindex (:M) +/\ row (SUC (1 MOD dimindex (:M))) (vecmats l),row 1 (vecmats l)=x +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +/\ S={row (SUC (i MOD dimindex (:M))) (vecmats l),row i (vecmats l) | 1 <= i /\ + i <= dimindex (:M)} +==> S = + face (hypermap (HYP (vec 0,V_SY (vecmats l),E_SY (vecmats l)))) x`, +REPEAT STRIP_TAC +THEN ASM_REWRITE_TAC[face;EXTENSION;IN_ELIM_THM;F_SY;] +THEN GEN_TAC +THEN EQ_TAC +THENL[ +MRESAL_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`][orbit_map;IN_ELIM_THM] +THEN REPEAT STRIP_TAC +THEN EXISTS_TAC`(dimindex (:M)-i + 1):num` +THEN MP_TAC(ARITH_RULE`1<= i /\ i<= dimindex (:M) ==> dimindex (:M) - i + 1 >= 0`) +THEN RESA_TAC +THEN MATCH_MP_TAC POWER_FF_OF_HYP_EQ1 +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]; +MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN MP_TAC(ARITH_RULE`1 ~(dimindex (:M)=0)`) +THEN RESA_TAC +THEN MRESA_TAC POWER_FF_HYP_ID1[`dimindex (:M)`;`(l:real^(M,3)finite_product)`;`x:real^3#real^3`] +THEN POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[SET_RULE`A=B <=> B=A`] +THEN RESA_TAC +THEN MRESA_TAC Hypermap.orbit_cyclic [`(face_map (hypermap (HYP (vec 0,V_SY (vecmats l),E_SY (vecmats (l:real^(M,3)finite_product))))))`;`dimindex (:M)`;`x:real^3#real^3`] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`k< dimindex (:M) ==> 1 <= dimindex (:M) - k + 1 `) +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`k< dimindex (:M) ==> k=0\/ dimindex (:M) - k + 1 <= dimindex (:M)`) +THEN RESA_TAC +THENL[ +REWRITE_TAC[POWER;I_DEF] +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<=1`;DIMINDEX_GE_1]; +EXISTS_TAC`(dimindex (:M)-k + 1):num` +THEN ASM_REWRITE_TAC[] +THEN MRESAL_TAC POWER_FF_OF_HYP_EQ1[`k:num`;`dimindex (:M) - k + 1`;`(row (dimindex (:M) - k + 1:num) (vecmats (l:real^(M,3)finite_product)))`;`row (SUC ((dimindex (:M) - k + 1) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))`;`(l:real^(M,3)finite_product)`;`x:real^3#real^3`][ARITH_RULE`dimindex (:M)<=dimindex (:M)/\ 1<=1`] +THEN POP_ASSUM MATCH_MP_TAC +THEN ASM_TAC +THEN ARITH_TAC]]);; + + + +let F_SY_EQ_FACE1=prove(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 1< dimindex (:M) +/\ 1<= i /\ i<= dimindex (:M) +/\ row (SUC (i MOD dimindex (:M))) (vecmats l),row i (vecmats l)=x +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +/\ S={row (SUC (i MOD dimindex (:M))) (vecmats l),row i (vecmats l) | 1 <= i /\ + i <= dimindex (:M)} +==> S = + face (hypermap (HYP (vec 0,V_SY (vecmats l),E_SY (vecmats l)))) x`, +REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL FACE_HYP_FAN_SY1)[`S:(real^3#real^3->bool)`;`l:real^(M,3)finite_product`;`row (SUC (1 MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)),row 1 (vecmats l)`] +THEN MATCH_MP_TAC lemma_face_identity +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN REWRITE_TAC[F_SY;IN_ELIM_THM] +THEN EXISTS_TAC`i:num` +THEN ASM_REWRITE_TAC[]);; + + + +let DART_OF_HYP_EQ_FACE_SY=prove(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 2< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) + /\ x IN darts_of_hyp (E_SY (vecmats l)) (V_SY (vecmats l)) +/\ S= face (hypermap (HYP (vec 0,V_SY (vecmats l),E_SY (vecmats l)))) x +==> darts_of_hyp (E_SY (vecmats l)) (V_SY (vecmats l))= S UNION IMAGE (nn_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l))) S`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`2< dimindex (:M)==> 1< dimindex (:M)`) +THEN RESA_TAC +THEN MRESA1_TAC (GEN_ALL DART_OF_HYP_SY_EQ)`l:real^(M,3)finite_product` +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN GEN_REWRITE_TAC( LAND_CONV o DEPTH_CONV)[UNION;IN_ELIM_THM] +THEN STRIP_TAC +THENL[ +POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC( LAND_CONV o ONCE_DEPTH_CONV)[F_SY;] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC +THEN REMOVE_THEN"THY"(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC (GEN_ALL F_SY_EQ_FACE)[`i:num`;`l:real^(M,3)finite_product`;`x:real^3#real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN RESA_TAC +THEN MATCH_MP_TAC DART_OF_HYP_SY_EQ +THEN ASM_REWRITE_TAC[]; +POP_ASSUM MP_TAC +THEN REMOVE_THEN"THY"(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA1_TAC (GEN_ALL IMAGE_NN_OF_HYP_F_SY)`l:real^(M,3)finite_product` +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL F_SY_EQ_FACE1)[`i:num`;`{row (SUC (i MOD dimindex (:M))) (vecmats l),row i (vecmats (l:real^(M,3)finite_product)) | + 1 <= i /\ + i <= dimindex (:M)}`;`l:real^(M,3)finite_product`;`x:real^3#real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN RESA_TAC +THEN MATCH_MP_TAC DART_OF_HYP_SY_EQ1 +THEN ASM_REWRITE_TAC[]]);; + +let ID_FF_OF_HYP_NOT_DARTS=prove(`!n. FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 2< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +/\ ~(v,u IN darts_of_hyp (E_SY (vecmats l)) (V_SY (vecmats l))) +==>(ff_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l)) POWER n) (v,u) = + v,u`, +INDUCT_TAC +THENL[ +REWRITE_TAC[POWER;I_DEF]; +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"THY"MP_TAC +THEN ASM_REWRITE_TAC[Hypermap.COM_POWER;o_DEF] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[ff_of_hyp]]);; + + + +let CARD_FACE_SY=prove(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 2< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) + /\ x IN darts_of_hyp (E_SY (vecmats l)) (V_SY (vecmats l)) +/\ S= face (hypermap (HYP (vec 0,V_SY (vecmats l),E_SY (vecmats l)))) x +==> CARD S= dimindex (:M)`, +REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`2< dimindex (:M)==> 1< dimindex (:M)`) +THEN RESA_TAC +THEN MRESA1_TAC (GEN_ALL DART_OF_HYP_SY_EQ)`l:real^(M,3)finite_product` +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN GEN_REWRITE_TAC( LAND_CONV o DEPTH_CONV)[UNION;IN_ELIM_THM] +THEN STRIP_TAC +THENL[ +POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC( LAND_CONV o ONCE_DEPTH_CONV)[F_SY;] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC +THEN REMOVE_THEN"THY"(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA_TAC (GEN_ALL F_SY_EQ_FACE)[`i:num`;`l:real^(M,3)finite_product`;`x:real^3#real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN RESA_TAC +THEN MRESA1_TAC(GEN_ALL CARD_F_SY_EQ)`l:real^(M,3)finite_product`; +POP_ASSUM MP_TAC +THEN REMOVE_THEN"THY"(fun th-> REWRITE_TAC[SYM th]) +THEN MRESA1_TAC (GEN_ALL IMAGE_NN_OF_HYP_F_SY)`l:real^(M,3)finite_product` +THEN REWRITE_TAC[IN_ELIM_THM] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL F_SY_EQ_FACE1)[`i:num`;`{row (SUC (i MOD dimindex (:M))) (vecmats l),row i (vecmats (l:real^(M,3)finite_product)) | + 1 <= i /\ + i <= dimindex (:M)}`;`l:real^(M,3)finite_product`;`x:real^3#real^3`] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN RESA_TAC +THEN MRESA1_TAC(GEN_ALL CARD_IMAGE_F_SY_EQ)`l:real^(M,3)finite_product`]);; + + + +let FF_OF_HYP_POWER_EQ_ID=prove(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 2< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==>ff_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l)) POWER dimindex (:M) = + I`, + REWRITE_TAC[FUN_EQ_THM;I_DEF] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(x IN darts_of_hyp (E_SY (vecmats l)) (V_SY (vecmats l))) \/ x IN darts_of_hyp (E_SY (vecmats l)) (V_SY (vecmats (l:real^(M,3)finite_product)))`) +THENL[ +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[GSYM PAIR] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL ID_FF_OF_HYP_NOT_DARTS)[`l:real^(M,3)finite_product`;`FST (x:real^3#real^3)`;`SND (x:real^3#real^3)`;`dimindex (:M)`]; +MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN MRESAL_TAC (Hypermap.lemma_in_face)[`(hypermap (HYP (vec 0,V_SY (vecmats l),E_SY (vecmats (l:real^(M,3)finite_product)))))`;`x:real^3#real^3`;`0`][POWER;I_DEF] +THEN MRESA_TAC (GEN_ALL CARD_FACE_SY)[`l:real^(M,3)finite_product`;`x:real^3#real^3`;`face (hypermap (HYP (vec 0,V_SY (vecmats l),E_SY (vecmats (l:real^(M,3)finite_product))))) x`] +THEN MRESA_TAC (Lvducxu.FACE_CYCLE_CARD)[`x:real^3#real^3`;`x:real^3#real^3`;`(hypermap (HYP (vec 0,V_SY (vecmats l),E_SY (vecmats (l:real^(M,3)finite_product)))))`]]);; + + + + +let EXISTS_POINT_DART_OF_HYP=prove(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 2< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> ?x. x IN darts_of_hyp (E_SY (vecmats l)) (V_SY (vecmats l))`, +REPEAT STRIP_TAC +THEN MP_TAC(ARITH_RULE`2< dimindex (:M)==> 1< dimindex (:M)`) +THEN RESA_TAC +THEN MRESA1_TAC (GEN_ALL DART_OF_HYP_SY_EQ)`l:real^(M,3)finite_product` +THEN EXISTS_TAC`row 1 (vecmats l), row (SUC (1 MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))` +THEN MATCH_MP_TAC(SET_RULE`a IN A ==> a IN A UNION B`) +THEN REWRITE_TAC[F_SY;IN_ELIM_THM] +THEN EXISTS_TAC`1` +THEN ASM_REWRITE_TAC[ARITH_RULE`1<=1`] +THEN MP_TAC(ARITH_RULE`2< dimindex (:M)==> 1<= dimindex (:M)`) +THEN RESA_TAC);; + +let FF_OF_HYP_NOT_EQ_ID=prove(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 2< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==>(!i. 0 < i /\ i < dimindex (:M) + ==> ~(ff_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l)) POWER i = + I))`, +REWRITE_TAC[FUN_EQ_THM;I_DEF] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MRESA1_TAC (GEN_ALL EXISTS_POINT_DART_OF_HYP)`l:real^(M,3)finite_product` +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x:real^3#real^3`) +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN MRESA_TAC (GEN_ALL CARD_FACE_SY)[`l:real^(M,3)finite_product`;`x:real^3#real^3`;`face (hypermap (HYP (vec 0,V_SY (vecmats l),E_SY (vecmats (l:real^(M,3)finite_product))))) x`] +THEN MRESAL_TAC (Hypermap.lemma_congruence_on_face)[`(hypermap (HYP (vec 0,V_SY (vecmats l),E_SY (vecmats (l:real^(M,3)finite_product)))))`;`x:real^3#real^3`;`i:num`;`0`][POWER;I_DEF] +THEN POP_ASSUM MP_TAC +THEN FIND_ASSUM MP_TAC`0< i` +THEN ARITH_TAC);; + + +let FF_OF_HYP_HAS_ORDERS=prove(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 2< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> ff_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l)) has_orders (dimindex (:M))`, +REWRITE_TAC[has_orders;GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN STRIP_TAC THEN STRIP_TAC +THEN MRESA1_TAC (GEN_ALL FF_OF_HYP_NOT_EQ_ID)`l:real^(M,3)finite_product` +THEN MRESA1_TAC (GEN_ALL FF_OF_HYP_POWER_EQ_ID)`l:real^(M,3)finite_product`);; + + + + +let CARD_NODE_SY=prove_by_refinement(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 2< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) + /\ x IN darts_of_hyp (E_SY (vecmats l)) (V_SY (vecmats l)) +==> CARD (node (hypermap (HYP (vec 0,V_SY (vecmats l),E_SY (vecmats l)))) x)= 2`, +[REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THYGIANG") +THEN MP_TAC(ARITH_RULE`2< dimindex (:M)==> 1< dimindex (:M) /\ 1<= dimindex (:M)/\ SUC 1 <= dimindex (:M) /\ ~(SUC 1= dimindex(:M))`) +THEN RESA_TAC +THEN MRESA1_TAC (GEN_ALL DART_OF_HYP_SY_EQ)`l:real^(M,3)finite_product` +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REWRITE_TAC[Hypermap.NODE_OF_SIZE_2] +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN GEN_REWRITE_TAC( LAND_CONV o DEPTH_CONV)[UNION;IN_ELIM_THM] +THEN STRIP_TAC; +POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC( LAND_CONV o ONCE_DEPTH_CONV)[F_SY;] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC +THEN ABBREV_TAC`u=row i (vecmats (l:real^(M,3)finite_product))` +THEN ABBREV_TAC`v=row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= i==> i=1 \/ 1<= i-1`) +THEN RESA_TAC; +MRESAL_TAC MOD_MULT[`dimindex (:M)`;`1`][ARITH_RULE`k*1=k`;ARITH_RULE`SUC 0=1`;DIMINDEX_NONZERO] +THEN MRESA_TAC MOD_LT[`1:num`;`dimindex (:M)`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ1)[`dimindex (:M):num`;`(row +(dimindex (:M)) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row 1 (vecmats (l:real^(M,3)finite_product)))`;`(row +(SUC 1) (vecmats (l:real^(M,3)finite_product)))`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ)[`dimindex (:M):num`;`(row +(SUC 1) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row 1 (vecmats (l:real^(M,3)finite_product)))`;`(row +(dimindex (:M)) (vecmats (l:real^(M,3)finite_product)))`;][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;PAIR_EQ]) +THEN STRIP_TAC +THEN REMOVE_THEN"THYGIANG"(fun th-> MRESAL_TAC th[`SUC 1`;`dimindex(:M)`][ARITH_RULE`1<= SUC 1/\ dimindex (:M)<= dimindex(:M)`]); +MP_TAC(ARITH_RULE`1<= i /\ i<= dimindex (:M) ==> i-1 < dimindex (:M)/\ i-1 <= dimindex (:M)/\ i= SUC (i-1)`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN MRESAL_TAC MOD_LT[`i-1:num`;`dimindex (:M):num`][ARITH_RULE`0<1`] +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ1)[`i-1:num`;`(row +(i-1) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row (SUC ((i - 1) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(row +(SUC (SUC ((i - 1) MOD dimindex (:M)) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ)[`i-1:num`;`(row +(SUC (SUC ((i - 1) MOD dimindex (:M)) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row (SUC ((i - 1) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(row +(i-1) (vecmats (l:real^(M,3)finite_product)))`;][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;PAIR_EQ]) +THEN MP_TAC(ARITH_RULE`1<= i /\ i<= dimindex (:M) ==> SUC (i-1)= i`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_LT[`i-1:num`;`dimindex (:M):num`][ARITH_RULE`0<1`] +THEN MRESA_TAC (GEN_ALL SUC_POWER2_NOT)[`i-1:num`;`dimindex (:M)`] +THEN SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +REMOVE_THEN"THYGIANG"(fun th-> MRESAL_TAC th[`i-1`;`(SUC (SUC ((i - 1) MOD dimindex (:M)) MOD dimindex (:M)))`][ARITH_RULE`1<= SUC i/\ dimindex (:M)<= dimindex(:M)`]); +POP_ASSUM MP_TAC +THEN MRESAL1_TAC (GEN_ALL IMAGE_NN_OF_HYP_F_SY)`l:real^(M,3)finite_product`[IN_ELIM_THM] +THEN RESA_TAC +THEN ABBREV_TAC`u=row i (vecmats (l:real^(M,3)finite_product))` +THEN ABBREV_TAC`v=row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))` +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ)[`i:num`;`(row +(SUC (SUC ((i) MOD dimindex (:M)) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row (SUC ((i) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(row +(i) (vecmats (l:real^(M,3)finite_product)))`;][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ1)[`i:num`;`(row +(i) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row (SUC ((i ) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(row +(SUC (SUC ((i) MOD dimindex (:M)) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;PAIR_EQ]) +THEN SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (SUC (i MOD dimindex (:M)) MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`SUC (i MOD dimindex (:M)):num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MRESA_TAC (GEN_ALL SUC_POWER2_NOT)[`i:num`;`dimindex (:M)`] +THEN REMOVE_THEN"THYGIANG"(fun th-> MRESAL_TAC th[`i:num`;`(SUC (SUC ((i) MOD dimindex (:M)) MOD dimindex (:M)))`][ARITH_RULE`1<= SUC i/\ dimindex (:M)<= dimindex(:M)`])]);; + + + + + + +let NODE_SY_POWER_ID=prove_by_refinement(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 2< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) + /\ x IN darts_of_hyp (E_SY (vecmats l)) (V_SY (vecmats l)) +==> node_map (hypermap (HYP (vec 0,V_SY (vecmats l),E_SY (vecmats l)))) + (node_map (hypermap (HYP (vec 0,V_SY (vecmats l),E_SY (vecmats l)))) x) = + x`, +[REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THYGIANG") +THEN MP_TAC(ARITH_RULE`2< dimindex (:M)==> 1< dimindex (:M) /\ 1<= dimindex (:M)/\ SUC 1 <= dimindex (:M) /\ ~(SUC 1= dimindex(:M))`) +THEN RESA_TAC +THEN MRESA1_TAC (GEN_ALL DART_OF_HYP_SY_EQ)`l:real^(M,3)finite_product` +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REWRITE_TAC[Hypermap.NODE_OF_SIZE_2] +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN GEN_REWRITE_TAC( LAND_CONV o DEPTH_CONV)[UNION;IN_ELIM_THM] +THEN STRIP_TAC; +POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC( LAND_CONV o ONCE_DEPTH_CONV)[F_SY;] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC +THEN ABBREV_TAC`u=row i (vecmats (l:real^(M,3)finite_product))` +THEN ABBREV_TAC`v=row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= i==> i=1 \/ 1<= i-1`) +THEN RESA_TAC; +MRESAL_TAC MOD_MULT[`dimindex (:M)`;`1`][ARITH_RULE`k*1=k`;ARITH_RULE`SUC 0=1`;DIMINDEX_NONZERO] +THEN MRESA_TAC MOD_LT[`1:num`;`dimindex (:M)`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ1)[`dimindex (:M):num`;`(row +(dimindex (:M)) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row 1 (vecmats (l:real^(M,3)finite_product)))`;`(row +(SUC 1) (vecmats (l:real^(M,3)finite_product)))`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ)[`dimindex (:M):num`;`(row +(SUC 1) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row 1 (vecmats (l:real^(M,3)finite_product)))`;`(row +(dimindex (:M)) (vecmats (l:real^(M,3)finite_product)))`;][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1]; +MP_TAC(ARITH_RULE`1<= i /\ i<= dimindex (:M) ==> i-1 < dimindex (:M)/\ i-1 <= dimindex (:M)/\ i= SUC (i-1)`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN MRESAL_TAC MOD_LT[`i-1:num`;`dimindex (:M):num`][ARITH_RULE`0<1`] +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ1)[`i-1:num`;`(row +(i-1) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row (SUC ((i - 1) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(row +(SUC (SUC ((i - 1) MOD dimindex (:M)) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ)[`i-1:num`;`(row +(SUC (SUC ((i - 1) MOD dimindex (:M)) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row (SUC ((i - 1) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(row +(i-1) (vecmats (l:real^(M,3)finite_product)))`;][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1]; +POP_ASSUM MP_TAC +THEN MRESAL1_TAC (GEN_ALL IMAGE_NN_OF_HYP_F_SY)`l:real^(M,3)finite_product`[IN_ELIM_THM] +THEN RESA_TAC +THEN ABBREV_TAC`u=row i (vecmats (l:real^(M,3)finite_product))` +THEN ABBREV_TAC`v=row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))` +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ)[`i:num`;`(row +(SUC (SUC ((i) MOD dimindex (:M)) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row (SUC ((i) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(row +(i) (vecmats (l:real^(M,3)finite_product)))`;][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ1)[`i:num`;`(row +(i) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row (SUC ((i ) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(row +(SUC (SUC ((i) MOD dimindex (:M)) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;PAIR_EQ]) +]);; + + + + + + + + + + + +let ID_NN_OF_HYP_NOT_DARTS=prove(`!n. FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 2< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +/\ ~(v,u IN darts_of_hyp (E_SY (vecmats l)) (V_SY (vecmats l))) +==>(nn_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l)) POWER n) (v,u) = + v,u`, +INDUCT_TAC +THENL[ +REWRITE_TAC[POWER;I_DEF]; +POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REPEAT STRIP_TAC +THEN REMOVE_THEN"THY"MP_TAC +THEN ASM_REWRITE_TAC[Hypermap.COM_POWER;o_DEF] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[nn_of_hyp]]);; + + + + + +let NN_OF_HYP_POWER_EQ_ID=prove(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 2< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==>nn_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l)) POWER 2 = + I`, + REWRITE_TAC[FUN_EQ_THM;I_DEF] +THEN REPEAT STRIP_TAC +THEN DISJ_CASES_TAC(SET_RULE`~(x IN darts_of_hyp (E_SY (vecmats l)) (V_SY (vecmats l))) \/ x IN darts_of_hyp (E_SY (vecmats l)) (V_SY (vecmats (l:real^(M,3)finite_product)))`) +THENL[ +POP_ASSUM MP_TAC +THEN ONCE_REWRITE_TAC[GSYM PAIR] +THEN STRIP_TAC +THEN MRESA_TAC (GEN_ALL ID_NN_OF_HYP_NOT_DARTS)[`l:real^(M,3)finite_product`;`FST (x:real^3#real^3)`;`SND (x:real^3#real^3)`;`2`]; +REWRITE_TAC[ARITH_RULE`2=SUC(SUC 0)`;POWER;I_DEF;o_DEF] +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN MRESA_TAC (GEN_ALL NODE_SY_POWER_ID)[`l:real^(M,3)finite_product`;`x:real^3#real^3`]]);; + + + + + + +let NODE_SY_NOT_ID=prove_by_refinement(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 2< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) + /\ x IN darts_of_hyp (E_SY (vecmats l)) (V_SY (vecmats l)) +==> ~(node_map (hypermap (HYP (vec 0,V_SY (vecmats l),E_SY (vecmats l)))) x = + x)`, + +[REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THYGIANG") +THEN MP_TAC(ARITH_RULE`2< dimindex (:M)==> 1< dimindex (:M) /\ 1<= dimindex (:M)/\ SUC 1 <= dimindex (:M) /\ ~(SUC 1= dimindex(:M))`) +THEN RESA_TAC +THEN MRESA1_TAC (GEN_ALL DART_OF_HYP_SY_EQ)`l:real^(M,3)finite_product` +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THY") +THEN REWRITE_TAC[Hypermap.NODE_OF_SIZE_2] +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN GEN_REWRITE_TAC( LAND_CONV o DEPTH_CONV)[UNION;IN_ELIM_THM] +THEN STRIP_TAC; +POP_ASSUM MP_TAC +THEN GEN_REWRITE_TAC( LAND_CONV o ONCE_DEPTH_CONV)[F_SY;] +THEN REWRITE_TAC[IN_ELIM_THM] +THEN RESA_TAC +THEN ABBREV_TAC`u=row i (vecmats (l:real^(M,3)finite_product))` +THEN ABBREV_TAC`v=row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`1<= i==> i=1 \/ 1<= i-1`) +THEN RESA_TAC; +MRESAL_TAC MOD_MULT[`dimindex (:M)`;`1`][ARITH_RULE`k*1=k`;ARITH_RULE`SUC 0=1`;DIMINDEX_NONZERO] +THEN MRESA_TAC MOD_LT[`1:num`;`dimindex (:M)`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ1)[`dimindex (:M):num`;`(row +(dimindex (:M)) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row 1 (vecmats (l:real^(M,3)finite_product)))`;`(row +(SUC 1) (vecmats (l:real^(M,3)finite_product)))`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ)[`dimindex (:M):num`;`(row +(SUC 1) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row 1 (vecmats (l:real^(M,3)finite_product)))`;`(row +(dimindex (:M)) (vecmats (l:real^(M,3)finite_product)))`;][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;PAIR_EQ]) +THEN STRIP_TAC +THEN REMOVE_THEN"THYGIANG"(fun th-> MRESAL_TAC th[`SUC 1`;`dimindex(:M)`][ARITH_RULE`1<= SUC 1/\ dimindex (:M)<= dimindex(:M)`]); +MP_TAC(ARITH_RULE`1<= i /\ i<= dimindex (:M) ==> i-1 < dimindex (:M)/\ i-1 <= dimindex (:M)/\ i= SUC (i-1)`) +THEN RESA_TAC +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th]) +THEN MRESAL_TAC MOD_LT[`i-1:num`;`dimindex (:M):num`][ARITH_RULE`0<1`] +THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[SYM th]) +THEN STRIP_TAC +THEN STRIP_TAC +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ1)[`i-1:num`;`(row +(i-1) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row (SUC ((i - 1) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(row +(SUC (SUC ((i - 1) MOD dimindex (:M)) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ)[`i-1:num`;`(row +(SUC (SUC ((i - 1) MOD dimindex (:M)) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row (SUC ((i - 1) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(row +(i-1) (vecmats (l:real^(M,3)finite_product)))`;][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;PAIR_EQ]) +THEN MP_TAC(ARITH_RULE`1<= i /\ i<= dimindex (:M) ==> SUC (i-1)= i`) +THEN RESA_TAC +THEN MRESAL_TAC MOD_LT[`i-1:num`;`dimindex (:M):num`][ARITH_RULE`0<1`] +THEN MRESA_TAC (GEN_ALL SUC_POWER2_NOT)[`i-1:num`;`dimindex (:M)`] +THEN SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +REMOVE_THEN"THYGIANG"(fun th-> MRESAL_TAC th[`i-1`;`(SUC (SUC ((i - 1) MOD dimindex (:M)) MOD dimindex (:M)))`][ARITH_RULE`1<= SUC i/\ dimindex (:M)<= dimindex(:M)`]); +POP_ASSUM MP_TAC +THEN MRESAL1_TAC (GEN_ALL IMAGE_NN_OF_HYP_F_SY)`l:real^(M,3)finite_product`[IN_ELIM_THM] +THEN RESA_TAC +THEN ABBREV_TAC`u=row i (vecmats (l:real^(M,3)finite_product))` +THEN ABBREV_TAC`v=row (SUC (i MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product))` +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ)[`i:num`;`(row +(SUC (SUC ((i) MOD dimindex (:M)) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row (SUC ((i) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(row +(i) (vecmats (l:real^(M,3)finite_product)))`;][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]) +THEN MRESAL_TAC(GEN_ALL NN_OF_HYP_EQ1)[`i:num`;`(row +(i) (vecmats (l:real^(M,3)finite_product)))`;`l:real^(M,3)finite_product`;`(row (SUC ((i ) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`;`(row +(SUC (SUC ((i) MOD dimindex (:M)) MOD dimindex (:M))) (vecmats (l:real^(M,3)finite_product)))`][ARITH_RULE`SUC 0=1/\ dimindex (:M) <= dimindex (:M)`;DIMINDEX_GE_1] +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;PAIR_EQ]) +THEN SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (i MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i:num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +SUBGOAL_THEN`1 <= SUC (i MOD dimindex (:M)) /\ + SUC (SUC (i MOD dimindex (:M)) MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`SUC (i MOD dimindex (:M)):num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; +MRESA_TAC (GEN_ALL SUC_POWER2_NOT)[`i:num`;`dimindex (:M)`] +THEN REMOVE_THEN"THYGIANG"(fun th-> MRESAL_TAC th[`i:num`;`(SUC (SUC ((i) MOD dimindex (:M)) MOD dimindex (:M)))`][ARITH_RULE`1<= SUC i/\ dimindex (:M)<= dimindex(:M)`])]);; + + + + + + + +let NN_OF_HYP_NOT_EQ_ID=prove(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 2< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==>(!i. 0 < i /\ i < 2 + ==> ~(nn_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l)) POWER i = + I))`, +REWRITE_TAC[FUN_EQ_THM;I_DEF;ARITH_RULE`0 i=1`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[POWER_1] +THEN MRESA1_TAC (GEN_ALL EXISTS_POINT_DART_OF_HYP)`l:real^(M,3)finite_product` +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x:real^3#real^3`) +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN MRESA_TAC (GEN_ALL NODE_SY_NOT_ID)[`l:real^(M,3)finite_product`;`x:real^3#real^3`]);; + + + + +let NN_OF_HYP_HAS_ORDERS=prove(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 2< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> nn_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l)) has_orders 2`, +REWRITE_TAC[has_orders;GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER] +THEN STRIP_TAC THEN STRIP_TAC +THEN MRESA1_TAC (GEN_ALL NN_OF_HYP_NOT_EQ_ID)`l:real^(M,3)finite_product` +THEN MRESA1_TAC (GEN_ALL NN_OF_HYP_POWER_EQ_ID)`l:real^(M,3)finite_product`);; + + +let EE_OF_HYP_HAS_ORDERS=prove_by_refinement(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 2< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> ee_of_hyp (vec 0,V_SY (vecmats l),E_SY (vecmats l)) has_orders 2`, +[REWRITE_TAC[has_orders;GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER;ARITH_RULE`2= SUC(SUC 0)`;POWER;I_DEF;o_DEF] +THEN REWRITE_TAC[ARITH_RULE`SUC(SUC 0)=2`] +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THYGIANG") +THEN MRESAL_TAC(GEN_ALL Lvducxu.FIRST_AAUHTVE2)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`][o_DEF;I_DEF] +THEN STRIP_TAC; +REWRITE_TAC[FUN_EQ_THM;I_DEF;ARITH_RULE`0 i=1`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[POWER_1] +THEN MRESA1_TAC (GEN_ALL EXISTS_POINT_DART_OF_HYP)`l:real^(M,3)finite_product` +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`FST (x:real^3#real^3),SND x`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ASM_REWRITE_TAC[ee_of_hyp2;PAIR_EQ] +THEN MRESA_TAC PAIR_EQ[`SND (x:real^3#real^3)`;`FST (x:real^3#real^3)`;`FST (x:real^3#real^3)`;`SND (x:real^3#real^3)`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`2< dimindex (:M)==> 1< dimindex (:M) /\ 1<= dimindex (:M)/\ SUC 1 <= dimindex (:M) /\ ~(SUC 1= dimindex(:M))`) +THEN RESA_TAC +THEN MRESA1_TAC (GEN_ALL DART_OF_HYP_SY_EQ)`l:real^(M,3)finite_product` +THEN REWRITE_TAC[UNION;IN_ELIM_THM] +THEN STRIP_TAC; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[F_SY;IN_ELIM_THM] +THEN RESA_TAC +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN SUBGOAL_THEN`1 <= SUC (i' MOD dimindex (:M)) /\ + SUC (i' MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i':num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + REMOVE_THEN"THYGIANG"(fun th-> MRESA_TAC th[`i':num`;`(SUC (i' MOD dimindex (:M)))`]) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL SUC_NOT)[`i':num`;`dimindex (:M):num`]; +POP_ASSUM MP_TAC +THEN MRESAL1_TAC (GEN_ALL IMAGE_NN_OF_HYP_F_SY)`l:real^(M,3)finite_product`[IN_ELIM_THM] +THEN RESA_TAC +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN SUBGOAL_THEN`1 <= SUC (i' MOD dimindex (:M)) /\ + SUC (i' MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i':num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + REMOVE_THEN"THYGIANG"(fun th-> MRESA_TAC th[`i':num`;`(SUC (i' MOD dimindex (:M)))`]) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL SUC_NOT)[`i':num`;`dimindex (:M):num`]; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[FUN_EQ_THM;I_DEF;ARITH_RULE`0 i=1`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`x:real^3#real^3`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[ee_of_hyp2]]);; + + +let DIH2K_FAN_HYP_SY=prove_by_refinement(` FAN (vec 0,V_SY (vecmats (l:real^(M,3)finite_product)),E_SY (vecmats l)) +/\ 2< dimindex (:M) +/\ (!i j. 1<= i /\ i<= dimindex (:M) /\ 1<= j /\ j<= dimindex (:M) +/\ row i (vecmats l)= row j (vecmats l) +==> i=j) +==> dih2k (hypermap (HYP (vec 0,V_SY (vecmats l),E_SY (vecmats l)))) + (CARD (F_SY (vecmats l)))`, +[REWRITE_TAC[dih2k] +THEN STRIP_TAC +THEN MRESA_TAC(GEN_ALL Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`] +THEN MP_TAC(ARITH_RULE`2< dimindex (:M)==> 1< dimindex (:M) /\ 1<= dimindex (:M)/\ SUC 1 <= dimindex (:M) /\ ~(SUC 1= dimindex(:M))`) +THEN RESA_TAC +THEN MRESA1_TAC (GEN_ALL FF_OF_HYP_HAS_ORDERS)`l:real^(M,3)finite_product` +THEN MRESA1_TAC (GEN_ALL NN_OF_HYP_HAS_ORDERS)`l:real^(M,3)finite_product` +THEN MRESA1_TAC (GEN_ALL EE_OF_HYP_HAS_ORDERS)`l:real^(M,3)finite_product` +THEN MRESA1_TAC (GEN_ALL CARD_DART_OF_HYP)`l:real^(M,3)finite_product` +THEN MRESA1_TAC (GEN_ALL CARD_F_SY_EQ)`l:real^(M,3)finite_product` +THEN STRIP_TAC ; +CONV_TAC(TOP_DEPTH_CONV let_CONV) +THEN REPEAT STRIP_TAC +THEN MRESA_TAC (GEN_ALL DART_OF_HYP_EQ_FACE_SY)[`x:real^3#real^3`;`l:real^(M,3)finite_product`;`face (hypermap (HYP (vec 0,V_SY (vecmats l),E_SY (vecmats (l:real^(M,3)finite_product))))) x`]; +REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN REMOVE_ASSUM_TAC +THEN ASM_TAC +THEN REWRITE_TAC[has_orders;GSYM Wrgcvdr_cizmrrh.POWER_TO_ITER;ARITH_RULE`2= SUC(SUC 0)`;POWER;I_DEF;o_DEF] +THEN REWRITE_TAC[ARITH_RULE`SUC(SUC 0)=2`] +THEN STRIP_TAC +THEN STRIP_TAC +THEN STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN DISCH_THEN(LABEL_TAC"THYGIANG") +THEN MRESAL_TAC(GEN_ALL Lvducxu.FIRST_AAUHTVE2)[`vec 0:real^3`;`V_SY (vecmats (l:real^(M,3)finite_product))`;`E_SY (vecmats (l:real^(M,3)finite_product))`][o_DEF;I_DEF] +THEN STRIP_TAC; +REWRITE_TAC[FUN_EQ_THM;I_DEF;ARITH_RULE`0 i=1`] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[POWER_1] +THEN MRESA1_TAC (GEN_ALL EXISTS_POINT_DART_OF_HYP)`l:real^(M,3)finite_product` +THEN STRIP_TAC +THEN POP_ASSUM(fun th-> MRESA1_TAC th`FST (x:real^3#real^3),SND x`) +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[] +THEN ASM_REWRITE_TAC[ee_of_hyp2;PAIR_EQ] +THEN MRESA_TAC PAIR_EQ[`SND (x:real^3#real^3)`;`FST (x:real^3#real^3)`;`FST (x:real^3#real^3)`;`SND (x:real^3#real^3)`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(ARITH_RULE`2< dimindex (:M)==> 1< dimindex (:M) /\ 1<= dimindex (:M)/\ SUC 1 <= dimindex (:M) /\ ~(SUC 1= dimindex(:M))`) +THEN RESA_TAC +THEN MRESA1_TAC (GEN_ALL DART_OF_HYP_SY_EQ)`l:real^(M,3)finite_product` +THEN REWRITE_TAC[UNION;IN_ELIM_THM] +THEN STRIP_TAC; +POP_ASSUM MP_TAC +THEN REWRITE_TAC[F_SY;IN_ELIM_THM] +THEN RESA_TAC +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN SUBGOAL_THEN`1 <= SUC (i' MOD dimindex (:M)) /\ + SUC (i' MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i':num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + REMOVE_THEN"THYGIANG"(fun th-> MRESA_TAC th[`i':num`;`(SUC (i' MOD dimindex (:M)))`]) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL SUC_NOT)[`i':num`;`dimindex (:M):num`]; +POP_ASSUM MP_TAC +THEN MRESAL1_TAC (GEN_ALL IMAGE_NN_OF_HYP_F_SY)`l:real^(M,3)finite_product`[IN_ELIM_THM] +THEN RESA_TAC +THEN STRIP_TAC +THEN REMOVE_ASSUM_TAC +THEN SUBGOAL_THEN`1 <= SUC (i' MOD dimindex (:M)) /\ + SUC (i' MOD dimindex (:M)) <= dimindex (:M)` ASSUME_TAC; +ASM_REWRITE_TAC[ARITH_RULE`1<= SUC a`] +THEN MRESAL_TAC DIVISION[`i':num`;`dimindex (:M):num`][DIMINDEX_NONZERO] +THEN POP_ASSUM MP_TAC +THEN ARITH_TAC; + REMOVE_THEN"THYGIANG"(fun th-> MRESA_TAC th[`i':num`;`(SUC (i' MOD dimindex (:M)))`]) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC (GEN_ALL SUC_NOT)[`i':num`;`dimindex (:M):num`]]);; + + + + + + + + + + + +end;; + + diff --git a/text_formalization/local/hexagons.hl b/text_formalization/local/hexagons.hl new file mode 100644 index 0000000..6e39aea --- /dev/null +++ b/text_formalization/local/hexagons.hl @@ -0,0 +1,2188 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Hoang Le Truong *) +(* Date: 2012-04-01 *) +(* ========================================================================= *) + + +(* +remaining conclusions from appendix to Local Fan chapter +*) + + +module Hexagons = struct + + +open Polyhedron;; +open Sphere;; +open Topology;; +open Fan_misc;; +open Planarity;; +open Conforming;; +open Hypermap;; +open Fan;; +open Topology;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Collect_geom;; +open Dih2k_hypermap;; +open Wjscpro;; +open Tecoxbm;; +open Hdplygy;; +open Nkezbfc_local;; +open Flyspeck_constants;; +open Gbycpxs;; +open Pcrttid;; +open Local_lemmas1;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + + + + +open Hypermap;; +open Fan;; +open Wrgcvdr_cizmrrh;; +open Local_lemmas;; +open Flyspeck_constants;; +open Pack_defs;; + +open Hales_tactic;; + +open Appendix;; + + +open Zithlqn;; + + +open Xwitccn;; + +open Ayqjtmd;; + +open Jkqewgv;; + + +open Mtuwlun;; + + +open Uxckfpe;; +open Sgtrnaf;; + +open Yxionxl;; + +open Qknvmlb;; +open Odxlstcv2;; + +open Yxionxl2;; +open Eyypqdw;; +open Ocbicby;; +open Imjxphr;; + +open Nuxcoea;; +open Aursipd;; +open Cuxvzoz;; +open Rrcwnsj;; +open Tfitskc;; + + + + +let PSORT_5_EXPLICIT=prove(` +psort 5 (0,0)= (0,0)/\ +psort 5 (1,1)= (1,1)/\ +psort 5 (2,2)= (2,2)/\ +psort 5 (3,3)= (3,3)/\ +psort 5 (4,4)= (4,4)/\ +psort 5 (0,1)= (0,1)/\ +psort 5 (0,2)= (0,2)/\ +psort 5 (0,3)= (0,3)/\ +psort 5 (0,4)= (0,4)/\ +psort 5 (1,0)= (0,1)/\ +psort 5 (1,2)= (1,2)/\ +psort 5 (1,3)= (1,3)/\ +psort 5 (1,4)= (1,4)/\ +psort 5 (2,0)= (0,2)/\ +psort 5 (2,1)= (1,2)/\ +psort 5 (2,3)= (2,3)/\ +psort 5 (2,4)= (2,4)/\ +psort 5 (3,0)= (0,3)/\ +psort 5 (3,1)= (1,3)/\ +psort 5 (3,2)= (2,3)/\ +psort 5 (3,4)= (3,4)/\ +psort 5 (4,0)= (0,4)/\ +psort 5 (4,1)= (1,4)/\ +psort 5 (4,2)= (2,4)/\ +psort 5 (4,3)= (3,4)/\ +psort 5 (4,5)= (0,4)/\ +psort 4 (3,4)= (0,3)/\ +psort 3 (2,0)= (0,2)/\ +psort 3 (2,1)= (1,2)/\ +psort 3 (1,0)= (0,1)`, +REWRITE_TAC[psort;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_5_TAC;Uxckfpe.ARITH_4_TAC;LET_DEF;LET_END_DEF;MOD_5_EXPLICIT;ARITH_RULE`0<=a/\ ~(1<= 0)/\ ~(2<=0)/\ ~(3<=0)/\ ~(4<=0)/\a<=a/\ ~(2<=1)/\ ~(3<=2)/\ ~(4<=3)/\ ~(3<=1)/\ ~(4<=1)/\ ~(4<=2)/\ 2<=3`]);; + + +let scs_5M3 = new_definition`scs_5M3 = mk_unadorned_v39 5 (#0.616) + (funlist_v39 [(0,1),(&2*h0);(0,2),(cstab);(0,3),(cstab);(1,3),(cstab);(1,4),(cstab);(2,4),(cstab)] (&2) 5) + (funlist_v39 [(0,1),cstab;(0,2),(&6); (0,3),(&6); (1,3),(&6); (1,4),(&6); (2,4),(&6)] (&2*h0) 5)`;; + + +let SCS_TAC= ASM_SIMP_TAC[scs_basic;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;d_tame;REAL_ARITH`#0.712 < #0.9`;periodic;SET_RULE`{} j <=> {} i`;periodic2;scs_basic;unadorned_v39;scs_prop_equ_v39;LET_DEF;LET_END_DEF;scs_stab_diag_v39;scs_half_slice_v39; +Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_5_TAC; +scs_5M1;scs_3M1;scs_6I1;scs_3T1;scs_4M2;scs_6M1;scs_6T1;scs_5I1;scs_5I2;scs_5I3;scs_5M2;scs_4M6;scs_3T4;scs_5M3; +Terminal.FUNLIST_EXPLICIT;Yrtafyh.PSORT_PERIODIC;PSORT_5_EXPLICIT; +ARITH_RULE`SUC 0=1/\ SUC 1=2/\ SUC 2=3/\ SUC 3=4/\ SUC 4=5/\ SUC 5=6/\ SUC 6=7/\ SUC 7=8`];; + + + +let sqrt8_LE_6=prove(`sqrt8<= &6`, +REWRITE_TAC[sqrt8] +THEN MATCH_MP_TAC REAL_LE_LSQRT +THEN REAL_ARITH_TAC);; + +let sqrt8_LE_CSTAB=prove(`sqrt8<= #3.01`, +REWRITE_TAC[sqrt8] +THEN MATCH_MP_TAC REAL_LE_LSQRT +THEN REAL_ARITH_TAC);; + + +let LE_sqrt8_2=prove(`&2<=sqrt8`, +REWRITE_TAC[sqrt8] +THEN MATCH_MP_TAC REAL_LE_RSQRT +THEN REAL_ARITH_TAC);; + +let LE_sqrt8_2h0=prove(`&2* #1.26<=sqrt8`, +REWRITE_TAC[sqrt8] +THEN MATCH_MP_TAC REAL_LE_RSQRT +THEN REAL_ARITH_TAC);; + + +let LT_sqrt8_2h0=prove(`&2* #1.26 (i+k) MOD k = i MOD k/\ SUC (i+k) MOD k= SUC i MOD k`, +STRIP_TAC +THEN ONCE_REWRITE_TAC[ARITH_RULE`i+k= 1*k+i`;] +THEN SIMP_TAC[MOD_MULT_ADD;ARITH_RULE`SUC (1 * k + i) =(1 * k + SUC i)`]);; + + +let SCS_6I1_IS_SCS=prove_by_refinement(`is_scs_v39 scs_6I1`, +[ +REWRITE_TAC[scs_6I1;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<6/\ ~(6=0)`;d_tame;REAL_ARITH`#0.712 < #0.9`;periodic;SET_RULE`{} (i + 6) <=> {} i`;periodic2;] +THEN SIMP_TAC[ARITH_RULE`~(6=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC +; + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + +REAL_ARITH_TAC; + +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; + +REWRITE_TAC[h0] +THEN REAL_ARITH_TAC; + +ASM_SIMP_TAC[ARITH_RULE`~(6=0)`;MOD_LT;h0] +THEN REAL_ARITH_TAC; + +REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +ASM_SIMP_TAC[ARITH_RULE`1<6`;Qknvmlb.SUC_MOD_NOT_EQ;REAL_ARITH`~(a scs_a_v39 s i j<= a`, +REWRITE_TAC[LET_DEF;LET_END_DEF;BBs_v39] +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC 2[`i`;`j`] +THEN DICH_TAC 1 +THEN DICH_TAC 1 +THEN REAL_ARITH_TAC);; + + + +let SCS_3M1_IS_SCS=prove_by_refinement(`is_scs_v39 scs_3M1`, +[SIMP_TAC[scs_3M1;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<6/\a<=a/\ ~(6=0)`;d_tame;REAL_ARITH`#0.103 < #0.9`;periodic;SET_RULE`{} (i + j) <=> {} i`;periodic2;ARITH_RULE`~(3=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +ARITH_TAC; + +SCS_TAC; +SCS_TAC; +SCS_TAC; +SCS_TAC; +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+3= 1*3+i/\ ~(3=0)`;MOD_MULT_ADD]; +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 3= j MOD 3\/ ~(i MOD 3= j MOD 3)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;h0] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN REAL_ARITH_TAC; +SCS_TAC +THEN ASM_SIMP_TAC[MOD_LT;cstab;h0] +THEN REAL_ARITH_TAC; + +MRESAS_TAC CARD_SUBSET[`{i | i < 3 /\ + (&2 * h0 < funlist_v39 [(0,1),cstab] (&2 * h0) 3 i (SUC i) \/ + &2 < funlist_v39 [(0,1),&2 * h0] (&2) 3 i (SUC i))}`;`0..2`][FINITE_NUMSEG;CARD_NUMSEG;ARITH_RULE`(2+1)-0=3/\ (a+3<=6 <=> a<=3)`] +THEN MATCH_DICH_TAC 0 +THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;IN_NUMSEG] +THEN ARITH_TAC]);; + + +let SCS_5M1_IS_SCS=prove_by_refinement(`is_scs_v39 scs_5M1`, +[ +SIMP_TAC[scs_5M1;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<=5/\ 5<=6/\a<=a/\ ~(6=0)`;d_tame;REAL_ARITH`#0.616 < #0.9`;periodic;SET_RULE`{} (i + 5) <=> {} i`;periodic2;ARITH_RULE`~(3=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; +POP_ASSUM MP_TAC +THEN ARITH_TAC; +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`3`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`4`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`2`;`4`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN REAL_ARITH_TAC; +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`3`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`4`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`2`;`4`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<5`] +THEN SUBGOAL_THEN`{i | i < 5 /\ + (&2 * #1.26 < (if psort 5 (i,SUC i) = 0,1 then #3.01 else &2 * #1.26) \/ + &2 < (if psort 5 (i,SUC i) = 0,1 then &2 * #1.26 else &2))} ={0}`ASSUME_TAC; + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;ARITH_RULE`x<5<=> x=0\/ x=1\/x=2\/ x=3\/ x=4`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PSORT_5_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_5_TAC;REAL_ARITH`~(a {} i`;periodic2;ARITH_RULE`~(3=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + +ASM_SIMP_TAC[ARITH_RULE`1<5`;Qknvmlb.SUC_MOD_NOT_EQ;REAL_ARITH`~(a {} i`;periodic2;ARITH_RULE`~(3=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN SIMP_TAC[h0;cstab;sqrt8_LE_6;REAL_ARITH`&2<= &2 * #1.26/\ a<=a`] +THEN MP_TAC(SET_RULE`(j MOD 5 = SUC i MOD 5 \/ SUC j MOD 5 = i MOD 5)\/ ~(j MOD 5 = SUC i MOD 5 \/ SUC j MOD 5 = i MOD 5)`) +THEN RESA_TAC +THEN SIMP_TAC[h0;cstab;sqrt8_LE_6;REAL_ARITH`&2<= &2 * #1.26/\ a<=a`]; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN MP_TAC(SET_RULE`(j = SUC i MOD 5 \/ SUC j MOD 5 = i )\/ ~(j = SUC i MOD 5 \/ SUC j MOD 5 = i)`) +THEN RESA_TAC +THEN SIMP_TAC[h0;cstab;sqrt8_LE_6;REAL_ARITH`&2<= &2 * #1.26/\ a<=a`;LE_sqrt8_2]; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + +ASM_SIMP_TAC[ARITH_RULE`1<5`;Qknvmlb.SUC_MOD_NOT_EQ;REAL_ARITH`~(a {} i`;periodic2;ARITH_RULE`~(3=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)/\ SUC (1 * 5 + i)= 1*5+ SUC i`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN MRESA_TAC Terminal.psort_sym[`5`;`i`;`j`]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN MRESA_TAC Terminal.psort_sym[`5`;`i`;`j`]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN MRESA_TAC Terminal.psort_sym[`5`;`i`;`j`]; + +SCS_TAC +THEN SIMP_TAC[h0;cstab;sqrt8_LE_6;REAL_ARITH`&2<= &2 * #1.26/\ a<=a`] +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN SIMP_TAC[h0;cstab;sqrt8_LE_6;REAL_ARITH`&2<= &2 * #1.26/\ a<=a`;LE_sqrt8_2h0] +THEN MP_TAC(SET_RULE`psort 5 (i,j) = 0,1\/ ~(psort 5 (i,j) = 0,1)`) +THEN RESA_TAC +THEN SIMP_TAC[h0;cstab;sqrt8_LE_6;REAL_ARITH`&2<= &2 * #1.26/\ a<=a`;LE_sqrt8_2h0] +THEN REAL_ARITH_TAC; + +SCS_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;sqrt8_LE_6;REAL_ARITH`&2<= &2 * #1.26/\ a<=a`;LE_sqrt8_2h0;MOD_LT] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;sqrt8_LE_6;REAL_ARITH`&2<= &2 * #1.26/\ a<=a`;LE_sqrt8_2h0;MOD_LT] +THEN MP_TAC(SET_RULE`i MOD 5 = SUC i MOD 5\/ ~(i MOD 5 = SUC i MOD 5)`) +THEN RESA_TAC +THEN REWRITE_TAC[REAL_ARITH`&0 <= #3.01`] +THEN MP_TAC(SET_RULE`psort 5 (i,SUC i) = 0,1\/ ~(psort 5 (i,SUC i) = 0,1)`) +THEN RESA_TAC +THEN REWRITE_TAC[sqrt8_LE_CSTAB] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`3`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`4`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`2`;`4`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`3`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`4`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`2`;`4`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<5`] +THEN SUBGOAL_THEN`{i | i < 5 /\ + (&2 * #1.26 < (if psort 5 (i,SUC i) = 0,1 then sqrt8 else &2 * #1.26) \/ + &2 < (if psort 5 (i,SUC i) = 0,1 then &2 * #1.26 else &2))} +={0}`ASSUME_TAC; + + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;ARITH_RULE`x<5<=> x=0\/ x=1\/x=2\/ x=3\/ x=4`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PSORT_5_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_5_TAC;REAL_ARITH`~(a {} i`;periodic2;ARITH_RULE`~(3=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+5= 1*5+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 5= j MOD 5\/ ~(i MOD 5= j MOD 5)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`3`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`4`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`2`;`4`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`3`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`4`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`2`;`4`;`5`][scs_diag;Uxckfpe.ARITH_5_TAC;PSORT_5_EXPLICIT;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<5`] +THEN SUBGOAL_THEN`{i | i < 5 /\ + (&2 * #1.26 < (if psort 5 (i,SUC i) = 0,1 then #3.01 else &2 * #1.26) \/ + &2 < (if psort 5 (i,SUC i) = 0,1 then &2 else &2))} ={0}`ASSUME_TAC; + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;ARITH_RULE`x<5<=> x=0\/ x=1\/x=2\/ x=3\/ x=4`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PSORT_5_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_5_TAC;REAL_ARITH`~(a {} i`;periodic2;ARITH_RULE`~(4=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`i+4= 1*4+i/\ ~(3=0)`;MOD_MULT_ADD]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN MP_TAC(SET_RULE`i MOD 4= j MOD 4\/ ~(i MOD 4= j MOD 4)`) +THEN RESA_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]; + + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN ARITH_TAC; + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN REAL_ARITH_TAC; + + +SCS_TAC +THEN ASM_SIMP_TAC[h0;cstab;] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`0`;`2`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT] +THEN MRESAS_TAC Yrtafyh.DIAG_NOT_PSORT[`1`;`3`;`4`][scs_diag;Uxckfpe.ARITH_4_TAC;Terminal.FUNLIST_EXPLICIT;Qknvmlb.SUC_MOD_NOT_EQ;ARITH_RULE`1<4`] +THEN SUBGOAL_THEN`{i | i < 4 /\ + (&2 * #1.26 < (if psort 4 (i,SUC i) = 0,1 then #3.01 else &2 * #1.26) \/ + &2 < (if psort 4 (i,SUC i) = 0,1 then &2 * #1.26 else &2))} ={0}`ASSUME_TAC; + + +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;ARITH_RULE`x<4<=> x=0\/ x=1\/x=2\/ x=3`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[Terminal.FUNLIST_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;REAL_ARITH`~(a {} i`;periodic2;] +THEN SIMP_TAC[ARITH_RULE`~(6=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + +REAL_ARITH_TAC; + +REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +ASM_SIMP_TAC[ARITH_RULE`~(6=0)`;MOD_LT;h0;cstab] +THEN REAL_ARITH_TAC; + +REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +ASM_SIMP_TAC[ARITH_RULE`1<6`;Qknvmlb.SUC_MOD_NOT_EQ;REAL_ARITH`~(a {} i` +;periodic2;ARITH_RULE`~(6=0)`;MOD_PERIODIC] +THEN REPEAT RESA_TAC; + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + + +GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a=b<=> b=a`] +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`a\/b<=> b\/a`] +THEN REWRITE_TAC[]; + + +REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + + +ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + + +ASM_SIMP_TAC[h0;cstab;MOD_LT] +THEN REAL_ARITH_TAC; + + +ASM_SIMP_TAC[ARITH_RULE`1<6`;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN REWRITE_TAC[REAL_ARITH`~(a MMs_v39 s = BBprime2_v39 s `, +SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;MMs_v39;Ayqjtmd.unadorned_MMs]);; + + +let BASIC_MM_EQ_BBPRIME2_POINT=prove(`scs_basic_v39 s ==> MMs_v39 s v= BBprime2_v39 s v`, +SIMP_TAC [BASIC_MM_EQ_BBPRIME2]);; + + +let DIST_PSORT=prove(`periodic v (k)/\ ~(k=0) /\ psort (k) (i,j) = psort (k) (i',j') +==> dist (v i',v j')= dist (v i,v j)`, +REWRITE_TAC[psort;LET_DEF;LET_END_DEF;] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN MP_TAC(SET_RULE`i MOD k<= j MOD k\/ ~(i MOD k<= j MOD k)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`i' MOD k<= j' MOD k\/ ~(i' MOD k<= j' MOD k)`) +THEN RESA_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN RESA_TAC +THEN MRESAL_TAC(GEN_ALL PERIODIC_PROPERTY)[`k`;`v`][ARITH_RULE`~(4=0)`;periodic] +THEN THAYTHEL_ASM_TAC 0[`i`][] +THEN THAYTHEL_ASM_TAC 0[`i'`][] +THEN THAYTHEL_ASM_TAC 0[`j`][] +THEN THAYTHEL_ASM_TAC 0[`j'`][] +THEN SIMP_TAC[DIST_SYM]);; + + +let STAB_BB=prove(`is_scs_v39 s/\ dist(v i,v j) <= cstab/\ +BBs_v39 s v +==> +BBs_v39 (scs_stab_diag_v39 s i j) v`, +SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39] +THEN REPEAT RESA_TAC +THEN THAYTHE_TAC 1[`i'`;`j'`] +THEN DICH_TAC 0 +THEN DICH_TAC 4 +THEN MP_TAC(SET_RULE`psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j')\/ ~(psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (i',j'))`) +THEN RESA_TAC +THEN MP_TAC Wkeidft.PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN ABBREV_TAC`k= scs_k_v39 s` +THEN MRESA_TAC DIST_PSORT[`k`;`i'`;`j'`;`i`;`v`;`j`] +THEN RESA_TAC);; + + +let SCS_K_D_A_STAB_EQ=prove(`scs_d_v39 (scs_stab_diag_v39 s i j) =scs_d_v39 s +/\ scs_k_v39 (scs_stab_diag_v39 s i j) =scs_k_v39 s +/\(!i' j'. scs_a_v39 (scs_stab_diag_v39 s i j) i' j'= scs_a_v39 s i' j')`, +SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39]);; + + +let DIAG_SCS_M_EQ=prove(`is_scs_v39 s/\ scs_diag (scs_k_v39 s) i j==> scs_M s = scs_M (scs_stab_diag_v39 s i j)`, +SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_M;] +THEN STRIP_TAC +THEN MP_TAC Wkeidft.PROPERTY_OF_K_SCS +THEN RESA_TAC +THEN ASM_SIMP_TAC[Yrtafyh.DIAG_NOT_PSORT]);; + + +let DIAD_PSORT_IMP_DIAD=prove_by_refinement(`scs_diag k i j /\ ~(k=0) +/\ psort k (i',j') = psort k (i,j) +==> scs_diag k i' j'`, +[REWRITE_TAC[scs_diag;psort;LET_DEF;LET_END_DEF] +THEN STRIP_TAC +THEN DICH_TAC 0 +THEN MP_TAC(SET_RULE`i MOD k<= j MOD k\/ ~(i MOD k<= j MOD k)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`i' MOD k<= j' MOD k\/ ~(i' MOD k<= j' MOD k)`) +THEN RESA_TAC +THEN REWRITE_TAC[PAIR_EQ] +THEN RESA_TAC; + +MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i'`;`i`;`k`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j'`;`j`;`k`] ; + +MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i'`;`j`;`k`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j'`;`i`;`k`] ; + + +MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i'`;`j`;`k`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j'`;`i`;`k`] ; + +MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`i'`;`i`;`k`] +THEN MRESA_TAC Zithlqn.IMP_SUC_MOD_EQ[`j'`;`j`;`k`] ]);; + +let PEDSLGV1= prove( `!v i j. + v IN MMs_v39 scs_6I1 /\ + scs_diag 6 i j /\ + dist(v i,v j) <= cstab ==> + v IN MMs_v39 (scs_stab_diag_v39 scs_6I1 i j)`, +REWRITE_TAC[IN] +THEN REPEAT STRIP_TAC +THEN MP_TAC SCS_6I1_IS_SCS +THEN STRIP_TAC +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_6I1`;`v`] +THEN MRESA_TAC DIST_LE_IMP_A_LE[`v`;`scs_6I1`;`i`;`j`;`cstab`] +THEN ASSUME_TAC SCS_6I1_BASIC +THEN ASSUME_TAC K_SCS_6I1 +THEN MRESAL_TAC Yrtafyh.YRTAFYH[`scs_6I1`;`i`;`j`][ARITH_RULE`3<6`;] +THEN MP_TAC Ppbtydq.MXQTIED +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN EXISTS_TAC`scs_6I1` +THEN ASM_SIMP_TAC[STAB_BB;SCS_K_D_A_STAB_EQ;DIAG_SCS_M_EQ;REAL_ARITH`a<=a`] +THEN REPEAT GEN_TAC +THEN REWRITE_TAC[scs_stab_diag_v39;scs_6I1;scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_M;CS_ADJ] +THEN MP_TAC(SET_RULE`psort 6 (i,j) = psort 6 (i',j')\/ ~(psort 6 (i,j) = psort 6 (i',j'))`) +THEN RESA_TAC +THENL[ +MRESAL_TAC DIAD_PSORT_IMP_DIAD[`i`;`j`;`6`;`i'`;`j'`][ARITH_RULE`~(6=0)`] +THEN DICH_TAC 0 +THEN REWRITE_TAC[scs_diag;cstab] +THEN RESA_TAC +THEN REAL_ARITH_TAC; +REAL_ARITH_TAC]);; + + +(****************************) +(****************************) +(****************************) +(****************************) + + + + +let K_SCS_6M1=prove(`scs_k_v39 scs_6M1=6/\ scs_d_v39 scs_6M1 = scs_d_v39 scs_6I1`, +REWRITE_TAC[scs_6I1;scs_6M1;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<6/\ ~(6=0)`;d_tame;REAL_ARITH`#0.712 < #0.9`;periodic;SET_RULE`{} (i + 6) <=> {} i`;periodic2;scs_basic;unadorned_v39]);; + + +let D_6M1_EQ_6I1=prove(` scs_d_v39 scs_6M1 = scs_d_v39 scs_6I1 +`, +REWRITE_TAC[scs_6I1;scs_6M1;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<6/\ ~(6=0)`;d_tame;REAL_ARITH`#0.712 < #0.9`;periodic;SET_RULE`{} (i + 6) <=> {} i`;periodic2;scs_basic;unadorned_v39]);; + + +let A_6M1_EQ_6I1_EDGE=prove(`(!i j. scs_a_v39 scs_6M1 i (SUC i) = scs_a_v39 scs_6I1 i (SUC i))`, +REWRITE_TAC[scs_6I1;scs_6M1;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<6/\ ~(6=0)`;d_tame;REAL_ARITH`#0.712 < #0.9`;periodic;SET_RULE`{} (i + 6) <=> {} i`;periodic2;scs_basic;unadorned_v39]);; + +let SCS_M_6I1_EQ_6M1=prove(`scs_M scs_6I1 = scs_M scs_6M1`, +REWRITE_TAC[scs_6I1;scs_6M1;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<6/\ ~(6=0)`;d_tame;REAL_ARITH`#0.712 < #0.9`;periodic;SET_RULE`{} (i + 6) <=> {} i`;periodic2;scs_basic;unadorned_v39;scs_M]);; + + + +let BB_6I1_IS_BB_6M1=prove_by_refinement(`BBs_v39 scs_6I1 v/\ (!i j. scs_diag 6 i j ==> cstab <= dist(v i,v j)) ==> BBs_v39 scs_6M1 v`, +[ +SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;scs_6I1;scs_6M1;CS_ADJ;scs_diag] +THEN REPEAT RESA_TAC +THEN MP_TAC(SET_RULE`i MOD 6= j MOD 6\/ ~(i MOD 6= j MOD 6)`) +THEN RESA_TAC; + +THAYTHE_TAC (5-2)[`i`;`j`]; + +MP_TAC(SET_RULE`SUC i MOD 6= j MOD 6\/ ~(SUC i MOD 6= j MOD 6)`) +THEN RESA_TAC; + +THAYTHE_TAC (6-2)[`i`;`j`]; + +MP_TAC(SET_RULE`i MOD 6= SUC j MOD 6\/ ~(i MOD 6= SUC j MOD 6)`) +THEN RESA_TAC; + +THAYTHE_TAC (7-2)[`i`;`j`]; + +THAYTHE_TAC (7-4)[`i`;`j`]; + +THAYTHE_TAC (5-2)[`i`;`j`]; + +MP_TAC(SET_RULE`SUC i MOD 6= j MOD 6\/ ~(SUC i MOD 6= j MOD 6)`) +THEN RESA_TAC; + +THAYTHE_TAC (6-2)[`i`;`j`]; + +MP_TAC(SET_RULE`i MOD 6= SUC j MOD 6\/ ~(i MOD 6= SUC j MOD 6)`) +THEN RESA_TAC; + +THAYTHE_TAC (7-2)[`i`;`j`]; + +THAYTHE_TAC (7-4)[`i`;`j`]]);; + +let A_6I1_LE_A_6M1=prove(`scs_a_v39 scs_6I1 i j <= scs_a_v39 scs_6M1 i j`, +REWRITE_TAC[scs_6I1;scs_6M1;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<6/\ ~(6=0)`;d_tame;REAL_ARITH`#0.712 < #0.9`;periodic;SET_RULE`{} (i + 6) <=> {} i`;periodic2;scs_basic;unadorned_v39;h0;cstab] +THEN REAL_ARITH_TAC);; + +let B_6I1_LE_B_6M1=prove(`scs_b_v39 scs_6M1 i j = scs_b_v39 scs_6I1 i j`, +REWRITE_TAC[scs_6I1;scs_6M1;is_scs_v39;mk_unadorned_v39;scs_v39_explicit;CS_ADJ;ARITH_RULE`~(6=3)/\ 6-1=5/\ 3<=6/\ 6<=6/\ ~(6=4)/\ ~(6=5)/\ 3<6/\ ~(6=0)`;d_tame;REAL_ARITH`#0.712 < #0.9`;periodic;SET_RULE`{} (i + 6) <=> {} i`;periodic2;scs_basic;unadorned_v39;h0;cstab] +THEN REAL_ARITH_TAC);; + + + + let PEDSLGV2= prove(`!v. + v IN MMs_v39 scs_6I1 /\ + (!i j. scs_diag 6 i j ==> cstab <= dist(v i,v j)) ==> + v IN MMs_v39 (scs_6M1)`, +REWRITE_TAC[IN] +THEN REPEAT STRIP_TAC +THEN MP_TAC SCS_6I1_IS_SCS +THEN STRIP_TAC +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_6I1`;`v`] +THEN ASSUME_TAC SCS_6I1_BASIC +THEN ASSUME_TAC K_SCS_6I1 +THEN ASSUME_TAC SCS_6M1_BASIC +THEN ASSUME_TAC K_SCS_6M1 +THEN MP_TAC SCS_6M1_IS_SCS +THEN STRIP_TAC +THEN MP_TAC Ppbtydq.MXQTIED +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN EXISTS_TAC`scs_6I1` +THEN ASM_SIMP_TAC[D_6M1_EQ_6I1;A_6M1_EQ_6I1_EDGE;SCS_M_6I1_EQ_6M1;BB_6I1_IS_BB_6M1;A_6I1_LE_A_6M1;B_6I1_LE_B_6M1;REAL_ARITH`a<=a`]);; + + + + + +(****************************) +(****************************) +(****************************) +(****************************) + + +let STAB_6I1_SCS=prove(` scs_diag (scs_k_v39 scs_6I1) i j +==> is_scs_v39 (scs_stab_diag_v39 scs_6I1 i j)/\ scs_basic_v39 (scs_stab_diag_v39 scs_6I1 i j)`, +STRIP_TAC +THEN MATCH_MP_TAC Yrtafyh.YRTAFYH +THEN ASM_REWRITE_TAC[SCS_K_D_A_STAB_EQ;SCS_6I1_IS_SCS;SCS_6I1_BASIC;K_SCS_6I1; +ARITH_RULE`3<6`;LET_DEF;LET_END_DEF;scs_6I1;scs_v39_explicit;mk_unadorned_v39;CS_ADJ;h0;cstab] +THEN REAL_ARITH_TAC);; + + + +let SCS_DIAG_SCS_6I1_02=prove(`scs_diag (scs_k_v39 scs_6I1) 0 2`, +REWRITE_TAC[K_SCS_6I1;scs_diag] +THEN ARITH_TAC);; + + +let SCS_DIAG_SCS_6I1_03=prove(`scs_diag (scs_k_v39 scs_6I1) 0 3`, +REWRITE_TAC[K_SCS_6I1;scs_diag] +THEN ARITH_TAC);; + + + +let BASIC_HALF_SLICE_STAB=prove(`scs_basic_v39 s +==> scs_basic_v39 (scs_half_slice_v39 (scs_stab_diag_v39 s i j) p q d' F)`, +ASM_SIMP_TAC[scs_half_slice_v39;scs_5M1;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_6I1;scs_basic;unadorned_v39;scs_stab_diag_v39] +THEN SET_TAC[]);; + + + + + + + + +let D_HALF_SLICE=prove(`scs_d_v39 (scs_half_slice_v39 (scs_stab_diag_v39 s i j) p q d' mkj)=d'`, +SCS_TAC);; + +let BAISC_PROP_EQU=prove(`scs_basic_v39 s ==> scs_basic_v39 (scs_prop_equ_v39 s i)`, +SCS_TAC +THEN SET_TAC[]);; + +let K_SCS_PROP_EUQ=prove(`scs_k_v39 (scs_prop_equ_v39 s i)= scs_k_v39 s`, +SCS_TAC);; + + + + + + +let AQICLXA_SLICE=prove_by_refinement(`scs_arrow_v39 { scs_stab_diag_v39 scs_6I1 0 2 } { scs_prop_equ_v39 scs_3M1 1, scs_prop_equ_v39 scs_5M1 1}`, +[MATCH_MP_TAC (GEN_ALL Lkgrqui.LKGRQUI) +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_6I1_02;STAB_6I1_SCS;SCS_K_D_A_STAB_EQ;] +THEN EXISTS_TAC`0` +THEN EXISTS_TAC`2` +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_6I1_02] +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ] +THEN REPEAT RESA_TAC; + +REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ;scs_slice_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC scs_inj +THEN ASM_SIMP_TAC[SCS_3M1_BASIC;SCS_5M1_BASIC;SCS_6I1_BASIC;J_SCS_5M1;BASIC_HALF_SLICE_STAB;J_SCS_3M1;D_HALF_SLICE;BAISC_PROP_EQU;K_SCS_PROP_EUQ] +THEN STRIP_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;scs_5M1;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_6I1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_3M1] +THEN ARITH_TAC; + +STRIP_TAC; + +ASM_SIMP_TAC[scs_half_slice_v39;scs_5M1;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_6I1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_3M1;scs_6I1;scs_3M1; +ARITH_RULE`(2 + 1 + 6 - 0) MOD 6= 3/\ 0 MOD 6=0/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ASM_SIMP_TAC[funlist_v39;LET_DEF;LET_END_DEF;CS_ADJ;Uxckfpe.ARITH_6_TAC;psort] +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION;] +THEN RESA_TAC +THEN ASM_SIMP_TAC[Ocbicby.MOD_EQ_MOD_SHIFT;Uxckfpe.ARITH_3_TAC] +THEN SIMP_TAC[ARITH_RULE`~(0=2)/\ ~(0=1)/\ 0<=1/\ ~(1=2)`;SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`1`][Uxckfpe.ARITH_3_TAC] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`1`][Uxckfpe.ARITH_3_TAC] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`1`][Uxckfpe.ARITH_3_TAC] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`1`][Uxckfpe.ARITH_3_TAC] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`1`][Uxckfpe.ARITH_3_TAC] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`1`][Uxckfpe.ARITH_3_TAC] +THEN ASM_SIMP_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2`;PAIR_EQ;Uxckfpe.ARITH_3_TAC]; + + +ASM_SIMP_TAC[scs_half_slice_v39;scs_5M1;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_6I1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_3M1;scs_6I1;scs_3M1; +ARITH_RULE`(2 + 1 + 6 - 0) MOD 6= 3/\ 0 MOD 6=0/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ASM_SIMP_TAC[funlist_v39;LET_DEF;LET_END_DEF;CS_ADJ;Uxckfpe.ARITH_6_TAC;psort] +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 3<3==> x MOD 3=0\/ x MOD 3=1\/ x MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 3<3==> x' MOD 3=0\/ x' MOD 3=1\/ x' MOD 3=2`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_3_TAC;DIVISION;] +THEN RESA_TAC +THEN ASM_SIMP_TAC[Ocbicby.MOD_EQ_MOD_SHIFT;Uxckfpe.ARITH_3_TAC] +THEN SIMP_TAC[ARITH_RULE`~(0=2)/\ ~(0=1)/\ 0<=1/\ ~(1=2)/\ 0<=2/\ 0<=0`;SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_3_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`0`;`1`][Uxckfpe.ARITH_3_TAC] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`1`;`1`][Uxckfpe.ARITH_3_TAC] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x`;`2`;`1`][Uxckfpe.ARITH_3_TAC] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`0`;`1`][Uxckfpe.ARITH_3_TAC] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`1`;`1`][Uxckfpe.ARITH_3_TAC] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`3`;`x'`;`2`;`1`][Uxckfpe.ARITH_3_TAC] +THEN ASM_SIMP_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2`;PAIR_EQ;Uxckfpe.ARITH_3_TAC]; + + + +ASM_SIMP_TAC[scs_half_slice_v39;scs_5M1;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_6I1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_3M1] +THEN ARITH_TAC; + +STRIP_TAC +THEN ASM_REWRITE_TAC[scs_half_slice_v39;scs_5M1;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_6I1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_3M1;scs_6I1;scs_3M1; +ARITH_RULE`(0 + 1 + 6 - 2) MOD 6= 5/\ 2 MOD 6=2/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ASM_SIMP_TAC[funlist_v39;LET_DEF;LET_END_DEF;CS_ADJ;Uxckfpe.ARITH_6_TAC;psort] +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 5<5==> x MOD 5=0\/ x MOD 5=1\/ x MOD 5=2\/ x MOD 5=3\/ x MOD 5=4`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_5_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 5<5==> x' MOD 5=0\/ x' MOD 5=1\/ x' MOD 5=2\/ x' MOD 5=3\/ x' MOD 5=4`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_5_TAC;DIVISION;ARITH_RULE`5-1=4`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_5_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`5`;`x`;`0`;`1`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`5`;`x`;`1`;`1`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`5`;`x`;`2`;`1`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`5`;`x`;`3`;`1`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`5`;`x`;`4`;`1`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`5`;`x'`;`0`;`1`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`5`;`x'`;`1`;`1`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`5`;`x'`;`2`;`1`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`5`;`x'`;`3`;`1`][ARITH_RULE`~(5=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`5`;`x'`;`4`;`1`][ARITH_RULE`~(5=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_5_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_5_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_5_TAC;Uxckfpe.ARITH_6_TAC]; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[J_SCS_3M1]]);; + + + +let FZIOTEF_UNION = prove_by_refinement( + `!S1 S2 S3 S4. scs_arrow_v39 S1 S2 /\ scs_arrow_v39 S3 S4 ==> + scs_arrow_v39 (S1 UNION S3) (S2 UNION S4)`, + (* {{{ proof *) + [ + REWRITE_TAC[scs_arrow_v39;UNION;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let PROP_EQU_IS_SCS=prove(`is_scs_v39 s ==> is_scs_v39 (scs_prop_equ_v39 s i)`, +MRESA_TAC PROP_EQU_IS_SCS[`scs_k_v39 s`;`s`;`i`;`scs_prop_equ_v39 s i`]);; + + +let AQICLXA=prove(`scs_arrow_v39 { scs_stab_diag_v39 scs_6I1 0 2 } { scs_3M1, scs_5M1 }`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{ scs_prop_equ_v39 scs_3M1 1, scs_prop_equ_v39 scs_5M1 1}` +THEN ASM_SIMP_TAC[AQICLXA_SLICE] +THEN REWRITE_TAC[SET_RULE`{a,b}= {a}UNION {b}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC +THENL[ + +MRESAS_TAC PRO_EQU_ID[`scs_3M1`;`3`;`2`][PROP_EQU_IS_SCS;PROP_EQU_IS_SCS;SCS_3M1_IS_SCS;K_SCS_3M1;ARITH_RULE`3-2 MOD 3=1`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_3M1 1`;`2`][PROP_EQU_IS_SCS;PROP_EQU_IS_SCS;SCS_3M1_IS_SCS;K_SCS_3M1;ARITH_RULE`3-1=2`] +THEN DICH_TAC 0 +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]); + +MRESAS_TAC PRO_EQU_ID[`scs_5M1`;`5`;`4`][PROP_EQU_IS_SCS;PROP_EQU_IS_SCS;SCS_5M1_IS_SCS;K_SCS_5M1;ARITH_RULE`5-4 MOD 5=1`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_5M1 1`;`4`][PROP_EQU_IS_SCS;PROP_EQU_IS_SCS;SCS_5M1_IS_SCS;K_SCS_5M1;ARITH_RULE`3-1=2`] +THEN DICH_TAC 0 +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])]);; + + +(****************************) +(****************************) +(****************************) +(****************************) + +let FUNOUYH_SLICE=prove_by_refinement(`scs_arrow_v39 { scs_stab_diag_v39 scs_6I1 0 3 } { scs_prop_equ_v39 scs_4M2 1, scs_prop_equ_v39 scs_4M2 1}`, +[ +MATCH_MP_TAC (GEN_ALL Lkgrqui.LKGRQUI) +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_6I1_03;STAB_6I1_SCS;SCS_K_D_A_STAB_EQ;] +THEN EXISTS_TAC`0` +THEN EXISTS_TAC`3` +THEN ASM_SIMP_TAC[SCS_DIAG_SCS_6I1_03] +THEN REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ] +THEN REPEAT RESA_TAC; + +REWRITE_TAC[is_scs_slice_v39;LET_DEF;LET_END_DEF;PAIR_EQ;scs_slice_v39;] +THEN STRIP_TAC +THEN MATCH_MP_TAC scs_inj +THEN ASM_SIMP_TAC[BAISC_PROP_EQU;K_SCS_PROP_EUQ;BASIC_HALF_SLICE_STAB;SCS_4M2_BASIC;J_SCS_4M2;D_HALF_SLICE;SCS_6I1_BASIC;K_SCS_4M2] +THEN STRIP_TAC; + + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M2;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_6I1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_3M1] +THEN ARITH_TAC; + + +STRIP_TAC +THEN ASM_REWRITE_TAC[scs_half_slice_v39;scs_4M2;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_6I1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M2;scs_6I1;scs_3M1; +ARITH_RULE`(3 + 1 + 6 - 0) MOD 6= 4/\ 0 MOD 6=0/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ASM_SIMP_TAC[funlist_v39;LET_DEF;LET_END_DEF;CS_ADJ;Uxckfpe.ARITH_6_TAC;psort] +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 4<4==> x MOD 4=0\/ x MOD 4=1\/ x MOD 4=2\/ x MOD 4=3`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 4<4==> x' MOD 4=0\/ x' MOD 4=1\/ x' MOD 4=2\/ x' MOD 4=3`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_5_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`0`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`1`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`2`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`3`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`0`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`1`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`2`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`3`;`1`][ARITH_RULE`~(4=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC]; + + + +ASM_SIMP_TAC[scs_half_slice_v39;scs_4M2;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_6I1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_3M1] +THEN ARITH_TAC; + + +STRIP_TAC +THEN ASM_REWRITE_TAC[scs_half_slice_v39;scs_4M2;mk_unadorned_v39;scs_v39_explicit;LET_DEF;LET_END_DEF;SCS_K_D_A_STAB_EQ;K_SCS_6I1;scs_basic;unadorned_v39;scs_stab_diag_v39;scs_stab_diag_v39;K_SCS_4M2;scs_6I1;scs_3M1; +ARITH_RULE`(0 + 1 + 6 - 3) MOD 6= 4/\ 3 MOD 6=3/\ a+0=a`;scs_prop_equ_v39] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ONCE_REWRITE_TAC[FUN_EQ_THM] +THEN ASM_SIMP_TAC[funlist_v39;LET_DEF;LET_END_DEF;CS_ADJ;Uxckfpe.ARITH_6_TAC;psort] +THEN REPEAT GEN_TAC +THEN MP_TAC(ARITH_RULE`x MOD 4<4==> x MOD 4=0\/ x MOD 4=1\/ x MOD 4=2\/ x MOD 4=3`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`x' MOD 4<4==> x' MOD 4=0\/ x' MOD 4=1\/ x' MOD 4=2\/ x' MOD 4=3`) +THEN ASM_SIMP_TAC[Uxckfpe.ARITH_4_TAC;DIVISION;ARITH_RULE`4-1=3`] +THEN RESA_TAC +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_5_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`0`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`1`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`2`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x`;`3`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`0`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`1`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`2`;`1`][ARITH_RULE`~(4=0)`] +THEN MRESAL_TAC Ocbicby.MOD_EQ_MOD_SHIFT[`4`;`x'`;`3`;`1`][ARITH_RULE`~(4=0)`] +THEN ASM_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\1+4=5/\ 1<=5/\ +2<=3/\ 0+a=a`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC] +THEN ASM_REWRITE_TAC[SET_RULE`{a,b}={c,d}<=> (a=c/\ b=d)\/ (a=d/\ +b=c)`;ASSOCD_v39;MAP;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC;PAIR_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[ARITH_RULE`1+1=2/\ 1+2=3/\ ~(1<=0)/\ ~(2<=1)/\ ~(2<=0) /\ 0<=1/\ 0<=2/\ 2<=2/\ 0<=3/\2+2=4/\ 3+2=5/\4+2=6/\ 5+2=7/\ 1<=2/\2<=3/\ ~(3<=1) +/\ ~(4<=0)/\ ~(4<=3)/\ ~(4<=2)/\ ~(4<=1)/\ ~(3<=0) /\ ~(3<=2)/\0+a=a/\a<=a +/\ ~(5<=0)/\ ~(5<=1)/\ ~(5<=4)/\ ~(5<=3)/\ ~(5<=2) +/\ 0<=5/\ 1<=5/\ 2<=5/\ 3<=5/\ 4<=5/\ +3+3=6/\ 2+3=5 /\ 0<=4`;PAIR_EQ;Uxckfpe.ARITH_4_TAC;Uxckfpe.ARITH_6_TAC]; + + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC; + +SCS_TAC +THEN REWRITE_TAC[cstab;h0] +THEN REAL_ARITH_TAC; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[J_SCS_4M2]]);; + + + + + + +let FZIOTEF=prove(`scs_arrow_v39 { scs_stab_diag_v39 scs_6I1 0 3 } { scs_4M2}`, +MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{ scs_prop_equ_v39 scs_4M2 1, scs_prop_equ_v39 scs_4M2 1}` +THEN ASM_SIMP_TAC[FUNOUYH_SLICE] +THEN REWRITE_TAC[SET_RULE`{a,a}= {a}`] +THEN MRESAS_TAC PRO_EQU_ID[`scs_4M2`;`4`;`3`][PROP_EQU_IS_SCS;PROP_EQU_IS_SCS;SCS_4M2_IS_SCS;K_SCS_4M2;ARITH_RULE`4-3 MOD 4=1`] +THEN MRESAS_TAC YXIONXL3[`scs_prop_equ_v39 scs_4M2 1`;`3`][PROP_EQU_IS_SCS;PROP_EQU_IS_SCS;SCS_4M2_IS_SCS;K_SCS_4M2;ARITH_RULE`3-1=2`] +THEN DICH_TAC 0 +THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th]));; + + +(****************************) +(****************************) +(****************************) +(****************************) + + + +let h0_LT_B_SCS_6M1=prove(` +(!i j. scs_diag 6 i j ==> &4 * h0 < scs_b_v39 scs_6M1 i j) +/\ (!i j. scs_diag 6 i j ==> scs_a_v39 scs_6M1 i j <= cstab)`, +SCS_TAC +THEN REWRITE_TAC[h0;scs_diag] +THEN REPEAT RESA_TAC +THEN REAL_ARITH_TAC);; + + + +let h0_LT_B_SCS_6I1=prove( +`(!i j. scs_diag 6 i j ==> &4 * h0 < scs_b_v39 scs_6I1 i j) +/\ (!i j. scs_diag 6 i j ==> scs_a_v39 scs_6I1 i j <= cstab)`, +SCS_TAC +THEN REWRITE_TAC[h0;scs_diag;cstab] +THEN REPEAT RESA_TAC +THEN REAL_ARITH_TAC);; + + +let h0_LT_B_SCS_5I1=prove(` +(!i j. scs_diag 5 i j ==> &4 * h0 < scs_b_v39 scs_5I1 i j) +/\ (!i j. scs_diag 5 i j ==> scs_a_v39 scs_5I1 i j <= cstab)`, +SCS_TAC +THEN REWRITE_TAC[h0;scs_diag;cstab] +THEN REPEAT RESA_TAC +THEN REAL_ARITH_TAC);; + + +let h0_LT_B_SCS_5I2=prove(` +(!i j. scs_diag 5 i j ==> &4 * h0 < scs_b_v39 scs_5I2 i j) +/\ (!i j. scs_diag 5 i j ==> scs_a_v39 scs_5I2 i j <= cstab)`, +SCS_TAC +THEN REWRITE_TAC[h0;scs_diag;cstab] +THEN REPEAT RESA_TAC +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC);; + +let h0_LT_B_SCS_5M2=prove(` + (!i j. scs_diag 5 i j ==> scs_a_v39 scs_5M2 i j <= cstab)`, +SCS_TAC +THEN REWRITE_TAC[h0;scs_diag;cstab] +THEN REPEAT RESA_TAC +THEN REAL_ARITH_TAC);; + +let h0_LT_B_SCS_5M1=prove(` (!i j. scs_diag 5 i j ==> scs_a_v39 scs_5M1 i j <= cstab)`, +SCS_TAC +THEN REWRITE_TAC[h0;scs_diag;cstab] +THEN REPEAT RESA_TAC +THEN MP_TAC sqrt8_LE_CSTAB +THEN REAL_ARITH_TAC);; + + +(***************) + + +let h0_EQ_B_SCS_6I1=prove( +`(!i j. scs_diag 6 i j ==> scs_b_v39 scs_6I1 i j= &6) +/\ (!i j. scs_diag 6 i j ==> scs_a_v39 scs_6I1 i j= &2 *h0)`, +SCS_TAC +THEN REWRITE_TAC[h0;scs_diag;cstab] +THEN REPEAT RESA_TAC);; + + + +let h0_EQ_B_SCS_5I1=prove( +`(!i j. scs_diag 5 i j ==> scs_b_v39 scs_5I1 i j= &6) +/\ (!i j. scs_diag 5 i j ==> scs_a_v39 scs_5I1 i j= &2 *h0)`, +SCS_TAC +THEN REWRITE_TAC[h0;scs_diag;cstab] +THEN REPEAT RESA_TAC);; + +let h0_EQ_B_SCS_5I2=prove( +`(!i j. scs_diag 5 i j ==> scs_b_v39 scs_5I2 i j= &6) +/\ (!i j. scs_diag 5 i j ==> scs_a_v39 scs_5I2 i j= sqrt8)`, +SCS_TAC +THEN REWRITE_TAC[h0;scs_diag;cstab] +THEN REPEAT RESA_TAC);; + + + + + + +let B_LE_CSTAB_6M1=prove(` +(!i. scs_b_v39 scs_6M1 i (SUC i) <= cstab)/\ +(!i. scs_b_v39 scs_6M1 i (SUC i) <= &2*h0)/\ + (!i. &2< scs_b_v39 scs_6M1 i (SUC i) )/\ +(!i. scs_a_v39 scs_6M1 i (SUC i) = &2)`, +SCS_TAC +THEN SIMP_TAC[ARITH_RULE`1<6`;Qknvmlb.SUC_MOD_NOT_EQ;h0;cstab] +THEN REAL_ARITH_TAC);; + + +let B_LE_CSTAB_5I1=prove(` +(!i. scs_b_v39 scs_5I1 i (SUC i) <= cstab)/\ +(!i. scs_b_v39 scs_5I1 i (SUC i) <= &2*h0)/\ + (!i. &2< scs_b_v39 scs_5I1 i (SUC i) )/\ +(!i. scs_a_v39 scs_5I1 i (SUC i) = &2) +`, +SCS_TAC +THEN SIMP_TAC[ARITH_RULE`1<5`;Qknvmlb.SUC_MOD_NOT_EQ;h0;cstab] +THEN REAL_ARITH_TAC);; + +(*********CARD scs_M <=1**************) + +let CARD_SCS_M_6M1=prove(`CARD (scs_M scs_6M1) <= 1`, +ASM_SIMP_TAC[ARITH_RULE`1<6`;Qknvmlb.SUC_MOD_NOT_EQ;REAL_ARITH`~(a x=0\/ x=1\/x=2\/ x=3\/ x=4`] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN ASM_REWRITE_TAC[PSORT_5_EXPLICIT;ARITH_RULE`SUC 1=2`;PAIR_EQ;Uxckfpe.ARITH_5_TAC;REAL_ARITH`~(a(!v. + v IN MMs_v39 scs_6M1 /\ + (!i j. scs_diag 6 i j ==> cstab < dist(v i,v j)) ==> + v IN MMs_v39 (scs_6T1))`, +[REWRITE_TAC[IN] +THEN REPEAT STRIP_TAC +THEN MP_TAC SCS_6M1_IS_SCS +THEN STRIP_TAC +THEN MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_6M1`;`v`] +THEN ASSUME_TAC SCS_6M1_BASIC +THEN ASSUME_TAC K_SCS_6M1 +THEN ASSUME_TAC SCS_6T1_BASIC +THEN ASSUME_TAC K_SCS_6T1 +THEN ASSUME_TAC SCS_6T1_IS_SCS +THEN MP_TAC RRCWNSJ +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_6M1`;`v`][ARITH_RULE`3<6`;h0_LT_B_SCS_6M1;B_LE_CSTAB_6M1] +THEN MP_TAC Jcyfmrp.JCYFMRP +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_6M1`;`v`][ARITH_RULE`3<6`;h0_LT_B_SCS_6M1;B_LE_CSTAB_6M1;IN;CARD_SCS_M_6M1] +THEN MP_TAC Jlxfdmj.JLXFDMJ +THEN RESA_TAC +THEN THAYTHES_TAC 0[`scs_6M1`;`v`;`i`][ARITH_RULE`3<6`;h0_LT_B_SCS_6M1;B_LE_CSTAB_6M1;IN;CARD_SCS_M_6M1;SCS_M_6M1;SET_RULE`(~{} a==> B)<=> B`;ARITH_RULE`i+1=SUC i`] +THEN MP_TAC Ppbtydq.MXQTIED +THEN REWRITE_TAC[IN] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN EXISTS_TAC`scs_6M1` +THEN ASM_SIMP_TAC[SCS_M_6M1;SCS_M_6T1] +THEN STRIP_TAC; + +SCS_TAC; + + +STRIP_TAC; + +DICH_TAC(12-4) +THEN ASM_SIMP_TAC[scs_basic;LET_DEF;LET_END_DEF;BBs_v39;scs_stab_diag_v39;scs_v39_explicit;mk_unadorned_v39;ARITH_RULE`~(6<=3)`] +THEN RESA_TAC; + +REPEAT GEN_TAC +THEN THAYTHE_TAC 1[`i'`;`j`] +THEN DICH_TAC 0 +THEN DICH_TAC 0 +THEN SCS_TAC +THEN MP_TAC(SET_RULE`i' MOD 6= j MOD 6\/ ~(i' MOD 6= j MOD 6)`) +THEN RESA_TAC +THEN MP_TAC(SET_RULE`SUC i' MOD 6= j MOD 6\/ ~(SUC i' MOD 6= j MOD 6)`) +THEN RESA_TAC; + +MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_6M1`;`v`] +THEN MRESA_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_6M1`;`j`;`v:num->real^3`;`SUC i':num`] +THEN REAL_ARITH_TAC; + +MP_TAC(SET_RULE`i' MOD 6=SUC j MOD 6\/ ~( i' MOD 6=SUC j MOD 6)`) +THEN RESA_TAC; + +MRESA_TAC Nuxcoea.MMS_IMP_BBS[`scs_6M1`;`v`] +THEN MRESA_TAC CHANGE_W_IN_BBS_MOD_IS_SCS[`scs_6M1`;`i'`;`v:num->real^3`;`SUC j:num`] +THEN ONCE_REWRITE_TAC[DIST_SYM] +THEN ASM_REWRITE_TAC[] +THEN REAL_ARITH_TAC; + +STRIP_TAC; + +SCS_TAC; + +SCS_TAC +THEN REWRITE_TAC[h0;scs_diag] +THEN REAL_ARITH_TAC]);; + +let SCS_6I1_IMP_SCS_6T1=prove(`main_nonlinear_terminal_v11 +==>(!v. + v IN MMs_v39 scs_6I1 /\ + (!i j. scs_diag 6 i j ==> cstab < dist(v i,v j)) ==> + v IN MMs_v39 (scs_6T1))`, +REPEAT STRIP_TAC +THEN MP_TAC SCS_6M1_IMP_SCS_6T1 +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_REWRITE_TAC[] +THEN MATCH_MP_TAC PEDSLGV2 +THEN ASM_REWRITE_TAC[] +THEN REPEAT STRIP_TAC +THEN THAYTHE_TAC 1[`i`;`j`] +THEN DICH_TAC 0 +THEN REAL_ARITH_TAC);; + + + +let SCS_6I1_BERAK_BY_CSTAB= prove_by_refinement(`main_nonlinear_terminal_v11 +==> +scs_arrow_v39 { scs_6I1 } ({ scs_6T1}UNION { scs_stab_diag_v39 scs_6I1 i j| scs_diag 6 i j })`, +[REPEAT GEN_TAC +THEN REWRITE_TAC[scs_arrow_v39;IN_SING;PAIR_EQ;LET_DEF;LET_END_DEF;IN_ELIM_THM;UNION] +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN REPEAT RESA_TAC; + +REWRITE_TAC[SCS_6T1_IS_SCS]; + +MATCH_MP_TAC Yrtafyh.STAB_IS_SCS +THEN ASM_SIMP_TAC[SCS_6I1_IS_SCS;K_SCS_6I1;SCS_6I1_BASIC;ARITH_RULE`3<6`] +THEN SCS_TAC +THEN REWRITE_TAC[h0;cstab] +THEN REAL_ARITH_TAC; + +DISJ_CASES_TAC(SET_RULE`(!s. s = scs_6I1 ==> MMs_v39 s = {}) \/ ~((!s. s = scs_6I1 ==> MMs_v39 s = {}))`); + +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[] +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP] +THEN REPEAT STRIP_TAC +THEN POP_ASSUM MP_TAC +THEN RESA_TAC +THEN POP_ASSUM MP_TAC +THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?v. v IN A`;IN] +THEN STRIP_TAC; + + +MP_TAC(SET_RULE`(!i j. scs_diag 6 i j ==> cstab < dist(v i,v j))\/ ~((!i j. scs_diag 6 i j ==> cstab < dist((v:num->real^3) i,v j)))`) +THEN RESA_TAC; + +EXISTS_TAC`scs_6T1` +THEN ASM_REWRITE_TAC[] +THEN EXISTS_TAC`v:num->real^3` +THEN MP_TAC SCS_6I1_IMP_SCS_6T1 +THEN REWRITE_TAC[IN] +THEN RESA_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_REWRITE_TAC[]; + +POP_ASSUM MP_TAC +THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;REAL_ARITH`~(a b<=a`] +THEN STRIP_TAC +THEN MRESAL_TAC PEDSLGV1[`v`;`i`;`j`][IN] +THEN EXISTS_TAC`scs_stab_diag_v39 scs_6I1 i j` +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC; + +MATCH_MP_TAC(SET_RULE`A==> B\/A`) +THEN EXISTS_TAC`i:num` +THEN EXISTS_TAC`j:num` +THEN ASM_REWRITE_TAC[]; + +EXISTS_TAC`v:num->real^3` +THEN ASM_REWRITE_TAC[]]);; + + +let PSORT_MOD=prove(`~(k=0)==> psort k (i MOD k,j MOD k)= psort k (i,j)`, +SIMP_TAC[psort;MOD_REFL]);; + + + +(****************************) +(****************************) +(****************************) +(****************************) + + + +let STAB_MOD=prove(`is_scs_v39 s +==> scs_stab_diag_v39 s (i MOD (scs_k_v39 s)) (j MOD (scs_k_v39 s))=scs_stab_diag_v39 s i j`, +SCS_TAC +THEN STRIP_TAC +THEN ABBREV_TAC`k=scs_k_v39 s` +THEN ASM_SIMP_TAC[PSORT_MOD;ARITH_RULE`3<=k==> ~(k=0)`]);; + +let DIAG_MOD=prove(`~(k=0)==> scs_diag k (i MOD k) (j MOD k)= scs_diag k i j`, +SIMP_TAC[scs_diag;MOD_REFL;Hypermap.lemma_suc_mod]);; + +let SET_STAB_6I1=prove(`{ scs_stab_diag_v39 scs_6I1 i j| scs_diag 6 i j }= { scs_stab_diag_v39 scs_6I1 (i MOD 6) (j MOD 6)| scs_diag 6 (i MOD 6) (j MOD 6) }`, + ASM_SIMP_TAC[STAB_MOD;DIAG_MOD;EXTENSION;IN_ELIM_THM;ARITH_RULE`~(6=0)`;] +THEN MRESAL_TAC STAB_MOD[`scs_6I1`][SCS_6I1_IS_SCS;K_SCS_6I1]);; + + +let DIAG_EQ_ADD=prove(`scs_diag 6 (i MOD 6) (j MOD 6)<=> +((i MOD 6= (j MOD 6+ 2) MOD 6)\/ (i MOD 6= (j MOD 6+ 3) MOD 6)\/ +(j MOD 6=(i MOD 6+2) MOD 6)\/ (j MOD 6= (i MOD 6+ 3) MOD 6))`, +REWRITE_TAC[scs_diag] +THEN MP_TAC(ARITH_RULE`i MOD 6<6==> i MOD 6= 0 \/ i MOD 6= 1 \/i MOD 6= 2 \/ +i MOD 6= 3 \/i MOD 6= 4 \/i MOD 6= 5 +`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(6=0)`] +THEN RESA_TAC +THEN MP_TAC(ARITH_RULE`j MOD 6<6==> j MOD 6= 0 \/ j MOD 6= 1 \/j MOD 6= 2 \/ +j MOD 6= 3 \/j MOD 6= 4 \/j MOD 6= 5 +`) +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(6=0)`] +THEN RESA_TAC +THEN ARITH_TAC);; + + +let PSORT_EQ_SYM=prove(`psort (scs_k_v39 s) (j,i) = psort (scs_k_v39 s) (j',i') +<=> psort (scs_k_v39 s) (i,j) = psort (scs_k_v39 s) (j',i')`, +GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]);; + +let PSORT_EQ_SYM1=prove(`psort (scs_k_v39 s) (j,i) = (j',i') +<=> psort (scs_k_v39 s) (i,j) = (j',i')`, +GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[Terminal.psort_sym] +THEN REWRITE_TAC[]);; + + +let STAB_SYM=prove(`scs_stab_diag_v39 s i j = + scs_stab_diag_v39 s j i`, +SCS_TAC +THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[PSORT_EQ_SYM] +THEN REWRITE_TAC[]);; + + +let EXPAND_STAB_DIAG=prove_by_refinement(`{scs_stab_diag_v39 scs_6I1 (i MOD 6) (j MOD 6) | i MOD 6 = + (j MOD 6 + 2) MOD 6 \/ + i MOD 6 = + (j MOD 6 + 3) MOD 6 \/ + j MOD 6 = + (i MOD 6 + 2) MOD 6 \/ + j MOD 6 = + (i MOD 6 + 3) MOD 6}= +{scs_stab_diag_v39 scs_6I1 (i+2) i| i<6} UNION +{scs_stab_diag_v39 scs_6I1 (i+3) i|i<6} `, +[ +REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_SING;UNION] +THEN GEN_TAC +THEN EQ_TAC +THEN RESA_TAC; + +MRESAS_TAC STAB_MOD[`scs_6I1`;`j MOD 6 + 2`;`j MOD 6`][SCS_6I1_IS_SCS;K_SCS_6I1;MOD_REFL;ARITH_RULE`~(6=0)`] +THEN MATCH_MP_TAC (SET_RULE`A==> A\/B`) +THEN EXISTS_TAC`j MOD 6` +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(6=0)`]; + +MRESAS_TAC STAB_MOD[`scs_6I1`;`j MOD 6 + 3`;`j MOD 6`][SCS_6I1_IS_SCS;K_SCS_6I1;MOD_REFL;ARITH_RULE`~(6=0)`] +THEN MATCH_MP_TAC (SET_RULE`A==> B\/A`) +THEN EXISTS_TAC`j MOD 6` +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(6=0)`]; + +MRESAS_TAC STAB_MOD[`scs_6I1`;`i MOD 6`;`i MOD 6 + 2`][SCS_6I1_IS_SCS;K_SCS_6I1;MOD_REFL;ARITH_RULE`~(6=0)`] +THEN MATCH_MP_TAC (SET_RULE`A==> A\/B`) +THEN EXISTS_TAC`i MOD 6` +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(6=0)`;STAB_SYM]; + +MRESAS_TAC STAB_MOD[`scs_6I1`;`i MOD 6`;`i MOD 6 + 3`][SCS_6I1_IS_SCS;K_SCS_6I1;MOD_REFL;ARITH_RULE`~(6=0)`] +THEN MATCH_MP_TAC (SET_RULE`A==> B\/A`) +THEN EXISTS_TAC`i MOD 6` +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(6=0)`;STAB_SYM]; + +EXISTS_TAC`i+2` +THEN EXISTS_TAC`i:num` +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(6=0)`;MOD_LT] +THEN MRESAS_TAC STAB_MOD[`scs_6I1`;`i MOD 6 + 2`;`i MOD 6`][SCS_6I1_IS_SCS;K_SCS_6I1;MOD_REFL;ARITH_RULE`~(6=0)`;MOD_LT]; + +EXISTS_TAC`i+3` +THEN EXISTS_TAC`i:num` +THEN ASM_SIMP_TAC[DIVISION;ARITH_RULE`~(6=0)`;MOD_LT] +THEN MRESAS_TAC STAB_MOD[`scs_6I1`;`i MOD 6 + 3`;`i MOD 6`][SCS_6I1_IS_SCS;K_SCS_6I1;MOD_REFL;ARITH_RULE`~(6=0)`;MOD_LT]]);; + + +let EQ_DIAG_STAB_6I1_02=prove(` +scs_arrow_v39 + {scs_stab_diag_v39 scs_6I1 (i + 2) i } + {scs_stab_diag_v39 scs_6I1 0 2}`, +MRESA_TAC STAB_SYM[`scs_6I1`;`2`;`0`] +THEN MP_TAC (GEN_ALL Wkeidft.WKEIDFT) +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_SIMP_TAC[ARITH_RULE`2 + i = (i + 2) + 0/\ 3<6/\ i+1= SUC i`;K_SCS_6I1;h0_LT_B_SCS_6I1;h0_EQ_B_SCS_6I1;SCS_6I1_IS_SCS;SCS_6I1_BASIC] +THEN SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`1<6`;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&2` +THEN EXISTS_TAC`&2 *h0` +THEN EXISTS_TAC`&2 *h0` +THEN EXISTS_TAC`&6` +THEN ASM_SIMP_TAC[scs_diag;ARITH_RULE`SUC (i + 2)= i+3/\ SUC i= i+1/\ 2+1=3`;ARITH_RULE`1<6/\ ~(6=0)`;Qknvmlb.SUC_MOD_NOT_EQ;Ocbicby.MOD_EQ_MOD_SHIFT] +THEN SCS_TAC +THEN MP_TAC(SET_RULE`i= i+0==> i MOD 6= (i+0) MOD 6`) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[ARITH_RULE`x+0=x`] +THEN RESA_TAC +THEN ASM_SIMP_TAC[Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`1<6/\ ~(6=0)`] +THEN SCS_TAC);; + + +let EQ_DIAG_STAB_6I1_03=prove(` +scs_arrow_v39 + {scs_stab_diag_v39 scs_6I1 (i + 3) i } + {scs_stab_diag_v39 scs_6I1 0 3}`, +MRESA_TAC STAB_SYM[`scs_6I1`;`3`;`0`] +THEN MP_TAC (GEN_ALL Wkeidft.WKEIDFT) +THEN REWRITE_TAC[LET_DEF;LET_END_DEF] +THEN STRIP_TAC +THEN MATCH_DICH_TAC 0 +THEN ASM_SIMP_TAC[ARITH_RULE`3 + i = (i + 3) + 0/\ 3<6/\ i+1= SUC i`;K_SCS_6I1;h0_LT_B_SCS_6I1;h0_EQ_B_SCS_6I1;SCS_6I1_IS_SCS;SCS_6I1_BASIC] +THEN SCS_TAC +THEN ASM_SIMP_TAC[ARITH_RULE`1<6`;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN EXISTS_TAC`&0` +THEN EXISTS_TAC`&2` +THEN EXISTS_TAC`&2 *h0` +THEN EXISTS_TAC`&2 *h0` +THEN EXISTS_TAC`&6` +THEN ASM_SIMP_TAC[scs_diag;ARITH_RULE`SUC (i + 3)= i+4/\ SUC i= i+1/\ 3+1=4`;ARITH_RULE`1<6/\ ~(6=0)`;Qknvmlb.SUC_MOD_NOT_EQ;] +THEN SCS_TAC +THEN MP_TAC(SET_RULE`i= i+0==> i MOD 6= (i+0) MOD 6`) +THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[ARITH_RULE`x+0=x`] +THEN RESA_TAC +THEN ASM_SIMP_TAC[Ocbicby.MOD_EQ_MOD_SHIFT;ARITH_RULE`1<6/\ ~(6=0)`] +THEN SCS_TAC);; + + +let SET_EQ_DIAG_STAB_6I1_02=prove(` +scs_arrow_v39 + {scs_stab_diag_v39 scs_6I1 (i + 2) i |i<6} + {scs_stab_diag_v39 scs_6I1 0 2}`, +REWRITE_TAC[ARITH_RULE`i<6<=> i=0\/i=1\/i=2\/i=3\/i=4\/i=5`;SET_RULE`{scs_stab_diag_v39 scs_6I1 (i + 2) i |i=0\/i=1\/i=2\/i=3\/i=4\/i=5} += {scs_stab_diag_v39 scs_6I1 (0 + 2) 0} UNION +{scs_stab_diag_v39 scs_6I1 (1 + 2) 1} UNION +{scs_stab_diag_v39 scs_6I1 (2 + 2) 2} UNION +{scs_stab_diag_v39 scs_6I1 (3 + 2) 3} UNION +{scs_stab_diag_v39 scs_6I1 (4 + 2) 4} UNION +{scs_stab_diag_v39 scs_6I1 (5 + 2) 5} +`;] +THEN ONCE_REWRITE_TAC[SET_RULE`{scs_stab_diag_v39 scs_6I1 0 2}={scs_stab_diag_v39 scs_6I1 0 2} UNION {scs_stab_diag_v39 scs_6I1 0 2}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[EQ_DIAG_STAB_6I1_02] +THEN ONCE_REWRITE_TAC[SET_RULE`{scs_stab_diag_v39 scs_6I1 0 2}={scs_stab_diag_v39 scs_6I1 0 2} UNION {scs_stab_diag_v39 scs_6I1 0 2}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[EQ_DIAG_STAB_6I1_02] +THEN ONCE_REWRITE_TAC[SET_RULE`{scs_stab_diag_v39 scs_6I1 0 2}={scs_stab_diag_v39 scs_6I1 0 2} UNION {scs_stab_diag_v39 scs_6I1 0 2}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[EQ_DIAG_STAB_6I1_02] +THEN ONCE_REWRITE_TAC[SET_RULE`{scs_stab_diag_v39 scs_6I1 0 2}={scs_stab_diag_v39 scs_6I1 0 2} UNION {scs_stab_diag_v39 scs_6I1 0 2}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[EQ_DIAG_STAB_6I1_02] +THEN ONCE_REWRITE_TAC[SET_RULE`{scs_stab_diag_v39 scs_6I1 0 2}={scs_stab_diag_v39 scs_6I1 0 2} UNION {scs_stab_diag_v39 scs_6I1 0 2}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[EQ_DIAG_STAB_6I1_02]);; + + + + +let SET_EQ_DIAG_STAB_6I1_03=prove(` +scs_arrow_v39 + {scs_stab_diag_v39 scs_6I1 (i + 3) i |i<6} + {scs_stab_diag_v39 scs_6I1 0 3}`, +REWRITE_TAC[ARITH_RULE`i<6<=> i=0\/i=1\/i=2\/i=3\/i=4\/i=5`;SET_RULE`{scs_stab_diag_v39 scs_6I1 (i + 3) i |i=0\/i=1\/i=2\/i=3\/i=4\/i=5} += {scs_stab_diag_v39 scs_6I1 (0 + 3) 0} UNION +{scs_stab_diag_v39 scs_6I1 (1 + 3) 1} UNION +{scs_stab_diag_v39 scs_6I1 (2 + 3) 2} UNION +{scs_stab_diag_v39 scs_6I1 (3 + 3) 3} UNION +{scs_stab_diag_v39 scs_6I1 (4 + 3) 4} UNION +{scs_stab_diag_v39 scs_6I1 (5 + 3) 5} +`;] +THEN ONCE_REWRITE_TAC[SET_RULE`{scs_stab_diag_v39 scs_6I1 0 3}={scs_stab_diag_v39 scs_6I1 0 3} UNION {scs_stab_diag_v39 scs_6I1 0 3}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[EQ_DIAG_STAB_6I1_03] +THEN ONCE_REWRITE_TAC[SET_RULE`{scs_stab_diag_v39 scs_6I1 0 3}={scs_stab_diag_v39 scs_6I1 0 3} UNION {scs_stab_diag_v39 scs_6I1 0 3}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[EQ_DIAG_STAB_6I1_03] +THEN ONCE_REWRITE_TAC[SET_RULE`{scs_stab_diag_v39 scs_6I1 0 3}={scs_stab_diag_v39 scs_6I1 0 3} UNION {scs_stab_diag_v39 scs_6I1 0 3}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[EQ_DIAG_STAB_6I1_03] +THEN ONCE_REWRITE_TAC[SET_RULE`{scs_stab_diag_v39 scs_6I1 0 3}={scs_stab_diag_v39 scs_6I1 0 3} UNION {scs_stab_diag_v39 scs_6I1 0 3}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[EQ_DIAG_STAB_6I1_03] +THEN ONCE_REWRITE_TAC[SET_RULE`{scs_stab_diag_v39 scs_6I1 0 3}={scs_stab_diag_v39 scs_6I1 0 3} UNION {scs_stab_diag_v39 scs_6I1 0 3}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[EQ_DIAG_STAB_6I1_03]);; + +let SET_EQ_DIAG_STAB_6I1=prove( `scs_arrow_v39 { scs_stab_diag_v39 scs_6I1 i j| scs_diag 6 i j } +{ scs_stab_diag_v39 scs_6I1 0 2, scs_stab_diag_v39 scs_6I1 0 3}`, +ONCE_REWRITE_TAC[SET_STAB_6I1] +THEN REWRITE_TAC[DIAG_EQ_ADD;EXPAND_STAB_DIAG;SET_RULE`{scs_stab_diag_v39 scs_6I1 0 2, scs_stab_diag_v39 scs_6I1 0 3} +={scs_stab_diag_v39 scs_6I1 0 2}UNION{ scs_stab_diag_v39 scs_6I1 0 3}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_SIMP_TAC[SET_EQ_DIAG_STAB_6I1_02;SET_EQ_DIAG_STAB_6I1_03]);; + + + + + +let OEHDBEN_PRIME=prove( ` +main_nonlinear_terminal_v11 +==> +scs_arrow_v39 { scs_6I1 } { scs_6T1, scs_stab_diag_v39 scs_6I1 0 2, scs_stab_diag_v39 scs_6I1 0 3}`, +STRIP_TAC +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{ scs_6T1}UNION { scs_stab_diag_v39 scs_6I1 i j| scs_diag 6 i j }` +THEN ASM_SIMP_TAC[SCS_6I1_BERAK_BY_CSTAB;SET_RULE`{scs_6T1, scs_stab_diag_v39 scs_6I1 0 2, scs_stab_diag_v39 scs_6I1 0 3} +={scs_6T1}UNION{ scs_stab_diag_v39 scs_6I1 0 2, scs_stab_diag_v39 scs_6I1 0 3}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_REWRITE_TAC[SET_EQ_DIAG_STAB_6I1;] +THEN MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[SCS_6T1_IS_SCS]);; + + + +let OEHDBEN= prove(`main_nonlinear_terminal_v11 +==> +scs_arrow_v39 { scs_6I1 } { scs_6T1, scs_5M1, scs_4M2, scs_3M1 }`, +STRIP_TAC +THEN MATCH_MP_TAC FZIOTEF_TRANS +THEN EXISTS_TAC`{ scs_6T1, scs_stab_diag_v39 scs_6I1 0 2, scs_stab_diag_v39 scs_6I1 0 3}` +THEN ASM_SIMP_TAC[OEHDBEN_PRIME;SET_RULE`{scs_6T1, scs_stab_diag_v39 scs_6I1 0 2, scs_stab_diag_v39 scs_6I1 0 3} += {scs_6T1} UNION {scs_stab_diag_v39 scs_6I1 0 2} UNION{ scs_stab_diag_v39 scs_6I1 0 3}`; +SET_RULE`{ scs_6T1, scs_5M1, scs_4M2, scs_3M1 }={scs_6T1} UNION{ scs_3M1,scs_5M1}UNION {scs_4M2}`] +THEN MATCH_MP_TAC FZIOTEF_UNION +THEN STRIP_TAC +THENL[ +MATCH_MP_TAC FZIOTEF_REFL +THEN REWRITE_TAC[IN_SING] +THEN REPEAT RESA_TAC +THEN ASM_REWRITE_TAC[SCS_6T1_IS_SCS]; + + +MATCH_MP_TAC FZIOTEF_UNION +THEN ASM_REWRITE_TAC[AQICLXA;FZIOTEF]]);; + + + + + + + end;; + + +(* +let check_completeness_claimA_concl = + Ineq.mk_tplate `\x. scs_arrow_v13 (set_of_list x) +*) + + + + diff --git a/text_formalization/local/local_lemmas1.hl b/text_formalization/local/local_lemmas1.hl new file mode 100644 index 0000000..6e754cf --- /dev/null +++ b/text_formalization/local/local_lemmas1.hl @@ -0,0 +1,7266 @@ + +(* ============================================================= *) +(* ============================================================= *) +(* ============================================================= *) +(* ============================================================= +#use "/home/user1/flyspeck/working/boot.hl";; +needs "/home/user1/flyspeck/working/local_lemmas1.hl";; + ============================================================= *) + +(* + +let build_sequence = + ["general/sphere.hl"; + "leg/geomdetail.hl"; + "leg/affprops.hl"; + "leg/cayleyR_def.hl"; + "leg/enclosed_def.hl"; + "leg/collect_geom.hl"; +(* flyspeck_needs "leg/collect_geom2.hl";*) (* slow and rarely needed *) + + "jordan/refinement.hl"; + "jordan/lib_ext.hl"; + "jordan/hash_term.hl"; + "jordan/parse_ext_override_interface.hl"; + "jordan/goal_printer.hl"; + "jordan/real_ext.hl"; + "jordan/tactics_jordan.hl"; + "jordan/num_ext_nabs.hl"; + "jordan/taylor_atn.hl"; + "jordan/float.hl"; + "jordan/flyspeck_constants.hl"; + "jordan/misc_defs_and_lemmas.hl"; + + "nonlinear/ineqdata3q1h.hl"; + "nonlinear/ineq.hl"; + "nonlinear/parse_ineq.hl"; + "nonlinear/vukhacky_tactics.hl" ; + + "trigonometry/trig1.hl"; + "trigonometry/trig2.hl"; + "nonlinear/compute_2158872499.hl"; (* need trig1.hl trig2.hl *) + + "trigonometry/trigonometry.hl"; + "trigonometry/delta_x.hl"; + "trigonometry/euler_complement.hl"; + "trigonometry/euler_multivariate.hl"; + "trigonometry/euler_main_theorem.hl"; + + "volume/vol1.hl"; + "hypermap/hypermap.hl"; (* svn 1898 not compatible with other files *) + + "fan/fan_defs.hl"; + "fan/introduction.hl"; + "fan/topology.hl"; + "fan/fan_misc.hl"; + "fan/planarity.hl"; (* svn 1717 -- 1792 has errors. Build fails. *) + "fan/polyhedron.hl"; + "fan/HypermapAndFan.hl"; + "fan/Conforming.hl"; + + "packing/pack1.hl"; + "packing/pack2.hl"; + "packing/pack_defs.hl"; + "packing/pack_concl.hl"; + "packing/pack3.hl"; (* needs pack_defs.hl *) + "packing/Rogers.hl"; + + "packing/TARJJUW.hl"; (* weakly_saturated def. modified in svn 1912. *) + "packing/TIWWFYQ.hl"; + "packing/RHWVGNP.hl"; + "packing/DRUQUFE.hl"; + "packing/BBDTRGC_def.hl"; + "packing/NOPZSEH_def.hl"; + "packing/JNRJQSM_def.hl"; + "packing/KHEJKCI.hl"; + "packing/IDBEZAL.hl"; + "packing/JJGTQMN_def.hl"; + "packing/PHZVPFY_def.hl"; + + (* ky's stuff *) + "packing/beta_pair_thm.hl"; + "packing/lemma_negligible.hl"; + + + (* "local/local_defs.hl"; *) + "local/WRGCVDR_CIZMRRH.hl"; + "local/LVDUCXU.hl"; + "local/LDURDPN.hl"; + "local/LOCAL_LEMMAS.hl"];; + +(* 1897 has an error Unbound value ivs_rho_node1*) + +let build_all() = + (* (needs "Multivariate/flyspeck.ml"; *) + map flyspeck_needs build_sequence;; +build_all();; + +*) + +(* ============================================================== *) +(* ============================================================== *) +(* ============================================================== *) + +module Local_lemmas1 = struct + +open Ldurdpn;; +open Lvducxu;; +open Sphere;; +open Trigonometry1;; +open Trigonometry2;; +open Hypermap;; +open Fan;; +open Prove_by_refinement;; +open Wrgcvdr_cizmrrh;; +open Aff_sgn_tac;; +open Fan_misc;; +open Fan_defs;; +open Planarity;; +open Topology;; +open Local_lemmas;; + + +(* deprecated 2013-02-22: + +let spherical_map = new_definition ` spherical_map (e1,e2,e3) (r,theta, phi) = +(r * cos theta * sin phi) % e1 + +(r * sin theta * sin phi ) % e2 + (r * cos phi) % e3 `;; + +` spherical_coor v0 (e1,e2,e3) v = (dist (v0,v), azim v0 (v0 + e3) (v0 + e1) v, arcV v0 (v0 + e3) v)`;; + +*) + +let lunar_deform = new_definition ` lunar_deform (e1,e2,e3) t x = +(norm x * cos (( &1 - t) * (azim (vec 0) e3 e1 x )) * sin (arcV (vec 0) e3 x)) % e1 + +(norm x * sin ( ( &1 - t ) * (azim (vec 0) e3 e1 x )) * sin (arcV (vec 0) e3 x)) % e2 + +(norm x * cos (arcV (vec 0) e3 x )) % e3`;; + +let normize = new_definition` normize (v:real^N) = (&1 / norm v) % v`;; + +let deformation = new_definition +` deformation ff V (a,b) <=> (&0) IN real_interval (a,b) /\ +(! v r. v IN V /\ r IN real_interval (a,b) ==> (ff v) continuous atreal r) /\ +(!v. v IN V ==> ff v (&0) = v )`;; + +let localization = new_definition `localization (V, E) FF = (v_prime V FF, e_prime E FF) `;; + + + +(* deprecated 2013-02-22: +let v_slice = new_definition ` v_slice f (v,w) = +{ ITER i f v | ! j. j < i ==> ~( ITER j f v = w ) }`;; + + +let e_slice = new_definition ` e_slice f (v,w) = +{w,v} INSERT +{ {ITER i f v, ITER (i + 1) f v} | ! j. j < i + 1 ==> ~( ITER j f v = w)} `;; + + +let f_slice = new_definition ` f_slice f (v,w) = +(w,v) INSERT +{ (ITER i f v, ITER (i + 1) f v) | ! j. j < i + 1 ==> ~ (ITER j f v = w)} `;; +*) + + + + +let LUNAR_DEFORM_PRESERVE_NORM = prove(`orthonormal e1 e2 e3 ==> +norm (lunar_deform (e1,e2,e3) t x) = norm x `, +SIMP_TAC[NORM_EQ; lunar_deform; orthonormal; DOT_RADD; DOT_LADD; DOT_RMUL; +DOT_LMUL; DOT_SYM; REAL_MUL_RZERO; Collect_geom.ZERO_NEUTRAL] THEN +ABBREV_TAC` aa = ((&1 - t) * azim (vec 0) e3 e1 x) ` THEN +ABBREV_TAC` bb = arcV (vec 0) e3 (x:real^3)` THEN REWRITE_TAC[ +REAL_ARITH` (norm x * cos aa * sin bb) * (norm x * cos aa * sin bb) * &1 + + (norm x * sin aa * sin bb) * (norm x * sin aa * sin bb) * &1 + + (norm x * cos bb) * (norm x * cos bb) * &1 = +(norm x pow 2 ) * (sin bb pow 2 * ( sin aa pow 2 + cos aa pow 2 ) + cos bb pow 2 )`] THEN +REWRITE_TAC[SIN_CIRCLE; REAL_MUL_RID; DOT_SQUARE_NORM]);; + + + + +let ACR_REFL = prove(` ~( u = v ) ==> arcV u v v = &0 `, +REWRITE_TAC[arcV; DOT_SQUARE_NORM; GSYM POW_2] THEN +NHANH (NORM_ARITH` ~( u = v ) ==> ~(norm (v - u) = &0)`) THEN +SIMP_TAC[REAL_FIELD` ~(x = &0) ==> x pow 2 / x pow 2 = &1 `; ACS_1]);; + + + + +let ARC_OPPOSITE = prove(` ~(u = v) ==> arcV u v (&2 % u - v ) = pi `, +REWRITE_TAC[arcV; VECTOR_ARITH` &2 % u - v - u = -- (v - u)`; DOT_RNEG; + NORM_NEG; DOT_SQUARE_NORM; GSYM POW_2] THEN +NHANH (NORM_ARITH` ~(u = v) ==> ~( norm (v - u)= &0 )`) THEN +SIMP_TAC[ACS_NEG_1; REAL_FIELD` ~( x = &0 ) ==> -- ( x pow 2) / ( x pow 2 ) = -- &1 `]);; + + + + + + +let ARCV_EQ_0 = prove(` ~(u = v) /\ &0 < t ==> arcV u v (u + t % (v - u)) = &0`, +NHANH ACR_REFL THEN ONCE_REWRITE_TAC[Trigonometry2.ARCV_VEC0_FORM] THEN +SIMP_TAC[VECTOR_ARITH`(a + b) - a:real^N = b`; GSYM + Trigonometry2.WHEN_K_POS_ARCV_STABLE]);; + +let ARCV_EQ_0_ORIGIN = prove(`~( u = vec 0) /\ &0 < t ==> arcV (vec 0) u (t % u) = &0`, +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN NHANH ARCV_EQ_0 THEN +SIMP_TAC[VECTOR_ARITH` vec 0 + t % (u - vec 0) = t % u`]);; + + +let ARCV_PI_OPPOSITE = prove(`~(u = v) /\ t < &0 ==> arcV u v (u + t % (v - u)) = pi`, +NHANH ARC_OPPOSITE THEN ONCE_REWRITE_TAC[Trigonometry2.ARCV_VEC0_FORM] THEN +SIMP_TAC[VECTOR_ARITH`(a + b) - a:real^N = b`; VECTOR_ARITH` &2 % u - v - u = -- (v - u)`] THEN +ONCE_REWRITE_TAC[VECTOR_ARITH` a % x = (-- a) % ( -- x)`] THEN +SIMP_TAC[GSYM Trigonometry2.WHEN_K_POS_ARCV_STABLE; REAL_ARITH` t < &0 <=> &0 < -- t `]);; + + + + + + + +let DOT_0_ARCV = prove(` (v - u) dot (w - u) = &0 ==> arcV u v w = pi / &2 `, +SIMP_TAC[arcV; Collect_geom.REAL_DIV_LZERO; ACS_0]);; + +let ARCV_DEGENERATE = prove(` arcV u u v = pi / &2 /\ arcV u v u = pi / &2 `, +CONJ_TAC THENL [MATCH_MP_TAC DOT_0_ARCV THEN +REWRITE_TAC[VECTOR_SUB_REFL; DOT_LZERO]; +MATCH_MP_TAC DOT_0_ARCV THEN +REWRITE_TAC[VECTOR_SUB_REFL; DOT_RZERO]]);; + + + + + +let ARCV_DIRECTIONS = prove(`~( u = v) ==> +(arcV u v (u + t % (v - u)) = &0 <=> &0 < t) /\ +(arcV u v (u + t % (v - u)) = pi <=> t < &0)`, +ASM_CASES_TAC` t = &0` THENL [ +ASM_REWRITE_TAC[REAL_LT_REFL; VECTOR_MUL_LZERO; VECTOR_ADD_RID; ARCV_DEGENERATE] +THEN STRIP_TAC THEN MP_TAC PI_NZ THEN REAL_ARITH_TAC; +DOWN THEN REWRITE_TAC[REAL_ARITH` ~(a = &0) <=> &0 < a \/ a < &0`] THEN +MESON_TAC[ARCV_EQ_0; ARCV_PI_OPPOSITE; PI_NZ]]);; + + + + + +let ARCV_ORI_DIRECTIONS = prove(` ~( v = vec 0) ==> +(arcV (vec 0) v (t % v) = &0 <=> &0 < t) /\ + (arcV (vec 0) v (t % v) = pi <=> t < &0)`, +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN NHANH ARCV_DIRECTIONS THEN +SIMP_TAC[EQ_SYM_EQ; VECTOR_ADD_LID; VECTOR_SUB_RZERO]);; + + + + +let REAL_NEG_MUL_EQ = prove(` a < &0 ==> ( a * x < &0 <=> &0 < x ) /\ +(&0 < a * x <=> x < &0) `, +REWRITE_TAC[REAL_ARITH` a < &0 <=> &0 < -- a `; REAL_ARITH` -- ( a * x) = -- a * x `] THEN +SIMP_TAC[REAL_LT_MUL_EQ] THEN +ONCE_REWRITE_TAC[REAL_ARITH` a * b = -- a * -- b `] THEN +SIMP_TAC[REAL_LT_MUL_EQ]);; + + + + + +let NOT_EQ_0 = REAL_ARITH` ~( x = &0 ) <=> &0 < x \/ x < &0 `;; + + +let SIN_ARCV_EQ_0 = prove(` ~( u = v) /\ ~( t = &0) ==> sin (arcV u v (u + t % (v - u))) = &0`, +REWRITE_TAC[NOT_EQ_0] THEN STRIP_TAC THENL [ +ASM_SIMP_TAC[ARCV_EQ_0; SIN_0]; +ASM_SIMP_TAC[ARCV_PI_OPPOSITE; SIN_PI]]);; + + +let COLLINEAR_SIN_ARCV_0 = prove(` collinear {u,v,x} /\ ~(u = x) /\ ~(u = v) ==> sin (arcV u v (x:real^N)) = &0`, +REWRITE_TAC[Local_lemmas.collinear_fan22; AFF2; IN_ELIM_THM] THEN +STRIP_TAC THENL [ + +ASM_REWRITE_TAC[] THEN UNDISCH_TAC` x = t % u + (&1 - t) % (v:real^N)` THEN +ASM_CASES_TAC` t = &1 ` THENL [ +ASM_REWRITE_TAC[REAL_SUB_REFL; VECTOR_ADD_RID; VECTOR_MUL_LZERO; VECTOR_MUL_LID]; + +REWRITE_TAC[VECTOR_ARITH` t % u + (&1 - t) % v = u + (&1 - t) % ( v - u)`] THEN +STRIP_TAC THEN MATCH_MP_TAC SIN_ARCV_EQ_0 THEN +ASM_REWRITE_TAC[REAL_ARITH` a - b = &0 <=> b = a`]]; + +DOWN THEN ASM_REWRITE_TAC[]]);; + + + + + + + + + + + +let COLL_AFF_GT_2_1 = prove(`!x v w:real^N. + ~collinear {x, v, w} + ==> aff_gt {x, v} {w} = + {y | ?t1 t2 t3. + &0 < t3 /\ + t1 + t2 + t3 = &1 /\ + y = t1 % x + t2 % v + t3 % w}`, +NHANH Fan.th3a THEN SIMP_TAC[AFF_GT_2_1]);; + + + + +let COLL_EQ_DEPENDENT = prove_by_refinement ( +` collinear {vec 0, x, y:real^N} <=> ? tx ty. ~( tx = &0 /\ ty = &0) /\ tx % x + ty % y = vec 0`, +[EQ_TAC; +REWRITE_TAC[COLLINEAR_LEMMA_ALT]; +STRIP_TAC; +EXISTS_TAC` &1 `; +EXISTS_TAC` &0`; +ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +REAL_ARITH_TAC; + +EXISTS_TAC` -- (c:real)`; +EXISTS_TAC` &1 `; +ASM_REWRITE_TAC[VECTOR_MUL_LID; REAL_ARITH` ~( &1 = &0)`]; +VECTOR_ARITH_TAC; + +SPEC_TAC (`y:real^N`,`y:real^N`); +SPEC_TAC (`x:real^N`,`x:real^N`); +MATCH_MP_TAC ( +MESON[]` (!x y tx ty. P x y tx ty ==> P y x ty tx) /\ + (!x y. Q x y ==> Q y x) /\ + (!x y tx ty. ~(ty = &0) /\ P x y tx ty ==> Q x y) + ==> ! x y. (?tx ty. ~(tx = &0 /\ ty = &0) /\ P x y tx ty) + ==> Q x y `); +SIMP_TAC[VECTOR_ADD_SYM; INSERT_COMM]; +REWRITE_TAC[SIMP_RULE[INSERT_COMM] COLLINEAR_LEMMA_ALT]; +REPEAT STRIP_TAC; +DISJ2_TAC; +EXISTS_TAC` ( -- tx ) / ty `; +DOWN; +NHANH_PAT`\x. x ==> y` (MESON[]` x = y ==> &1 / ty % x = &1 / ty % y`); +REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; VECTOR_MUL_RZERO]; +ASM_SIMP_TAC[REAL_FIELD` ~(x = &0) ==> &1 / x * x = &1 `; VECTOR_MUL_LID]; +SIMP_TAC[VECTOR_ARITH` a + b = vec 0 <=> b = -- a `]; +STRIP_TAC; +VECTOR_ARITH_TAC]);; + + + + + + + + +let NOT_COLL_ORTHONORMAL = prove_by_refinement ( +` ~ collinear {vec 0, x, y:real^N} ==> ?u. u IN aff {vec 0, x, y} /\ + norm u = &1 /\ x dot u = &0 `, +[NHANH Fan.th3b; +REWRITE_TAC[COLL_EQ_DEPENDENT; NOT_EXISTS_THM; DE_MORGAN_THM]; +STRIP_TAC; +EXISTS_TAC` normize ((x dot y) % x + -- (x dot x) % (y:real^N))`; +REWRITE_TAC[aff; AFFINE_HULL_3; IN_ELIM_THM]; +CONJ_TAC; +REWRITE_TAC[normize; Local_lemmas.VECTOR_ADD_LDISTRIB1; VECTOR_MUL_RZERO; +VECTOR_ADD_LID]; +MESON_TAC[REAL_ARITH`&1 - a + a = &1 `]; + +REWRITE_TAC[normize; GSYM Trigonometry2.NOT_VEC0_UNITABLE]; +CONJ_TAC; +SUBGOAL_THEN` ~(x dot (x:real^N) = &0)` MP_TAC; +ASM_REWRITE_TAC[DOT_EQ_0]; +ONCE_REWRITE_TAC[REAL_ARITH` a = &0 <=> -- a = &0`]; +ASM_MESON_TAC[]; + +REWRITE_TAC[DOT_RADD; DOT_RMUL; REAL_ARITH` a * b + -- b * a = &0`; REAL_MUL_RZERO]]);; + + + + + + + + + +let NORM1_NOT_0 = prove(` norm x = &1 ==> ~( x = vec 0) `, +NHANH (REAL_ARITH` x = &1 ==> &0 < x `) THEN SIMP_TAC[NORM_POS_LT]);; + + + + +let ARCV_DETER_DIRECTION = prove_by_refinement ( +` (x:real^N) = tu % u + ty % y /\ &0 < ty /\ +~( collinear {vec 0, u, y}) /\ norm x = &1 /\ norm y = &1 /\ +arcV (vec 0) u x = arcV (vec 0) u y ==> x = y`, +[NHANH NOT_COLL_ORTHONORMAL; +NHANH Fan.th3b; +NHANH NORM1_NOT_0; +STRIP_TAC; +MP_TAC (ISPECL [`u' :real^N`;` u:real^N` ] Rogers.IN_PLANE_NOT_COLLINEAR); +ANTS_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; + +UNDISCH_TAC` u' IN aff {vec 0, u, y:real^N}`; +REWRITE_TAC[aff; AFFINE_HULL_3; IN_ELIM_THM]; +STRIP_TAC; +ASM_CASES_TAC` w = &0`; +UNDISCH_TAC` u dot (u':real^N) = &0`; +ASM_REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_MUL_LZERO; VECTOR_ADD_LID; +VECTOR_ADD_RID; DOT_RMUL; REAL_ENTIRE; DOT_EQ_0]; +DISCH_THEN SUBST_ALL_TAC; +UNDISCH_TAC` u' = u'' % vec 0 + &0 % u + w % (y:real^N)`; +ASM_REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_MUL_LZERO; VECTOR_ADD_LID; +VECTOR_ADD_RID]; + +UNDISCH_TAC`u' = u'' % vec 0 + v % u + w % (y:real^N) `; +REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +ONCE_REWRITE_TAC[VECTOR_ARITH` a = u % x + (y:real^N) <=> y = ( -- u) % x + a`]; +ABBREV_TAC` tt <=> x = (y:real^N)`; +ASM_SIMP_TAC[Ldurdpn.VECTOR_SCALE_CHANGE; VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC]; +STRIP_TAC; +UNDISCH_TAC` x = tu % u + ty % (y:real^N)`; +ASM_SIMP_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; VECTOR_ARITH` a % x + b % x + c = (a + b) % x + c`]; +ABBREV_TAC` x1 = tu + ty * &1 / w * --v `; +ABBREV_TAC` x2 = ty * &1 / w `; +STRIP_TAC; +UNDISCH_TAC` arcV (vec 0) u x = arcV (vec 0) u (y:real^N)`; +NHANH (MESON[]` a = b ==> cos a = cos b `); +SWITCH_TAC` ~(y:real^N = vec 0)`; +ASSUME_TAC2 (ISPEC`x:real^N` (GEN_ALL NORM1_NOT_0)); +SWITCH_TAC` ~(x:real^N = vec 0)`; +SWITCH_TAC` x = x1 % u + x2 % (u':real^N)`; +SWITCH_TAC` (y:real^N) = (&1 / w * --v) % u + &1 / w % u'`; +ASM_SIMP_TAC[Trigonometry2.NOT_EQ_IMPCOS_ARC; VECTOR_SUB_RZERO; REAL_MUL_RID]; + +SUBGOAL_THEN` &0 < norm (u:real^N)` MP_TAC; +ASM_REWRITE_TAC[NORM_POS_LT]; +SIMP_TAC[REAL_FIELD` &0 < x ==> (a / x = b / x <=> a = b )`]; +EXPAND_TAC "x"; +EXPAND_TAC "y"; +REWRITE_TAC[DOT_RADD; DOT_RMUL]; +ASM_REWRITE_TAC[REAL_MUL_RZERO; REAL_ADD_RID]; + + + +SIMP_TAC[NORM_POS_LT; GSYM DOT_EQ_0; REAL_EQ_MUL_RCANCEL]; +REPEAT STRIP_TAC; +SUBGOAL_THEN` x dot (x:real^N) = y dot (y:real^N)` MP_TAC; +ASM_REWRITE_TAC[DOT_SQUARE_NORM]; + + +EXPAND_TAC "x"; +EXPAND_TAC "y"; +REWRITE_TAC[DOT_LADD; DOT_RADD; DOT_LMUL; DOT_RMUL]; +ASM_REWRITE_TAC[DOT_SYM; REAL_MUL_RZERO; REAL_ADD_LID; REAL_ADD_RID; + REAL_ARITH` a + b = a + c <=> b = c`]; +ASM_REWRITE_TAC[REAL_EQ_MUL_RCANCEL; REAL_RING`a * b * c = (a*b)*c`; + DOT_EQ_0]; +REWRITE_TAC[REAL_ARITH` a * a = b * b <=> (a - b) * ( a + b ) = &0`; REAL_ENTIRE; REAL_SUB_0]; +STRIP_TAC; +EXPAND_TAC "tt"; +EXPAND_TAC "x"; +EXPAND_TAC "y"; +REPLICATE_TAC 2 (FIRST_X_ASSUM SUBST1_TAC); +REWRITE_TAC[]; + + +DOWN; +EXPAND_TAC "x2"; +REWRITE_TAC[REAL_ARITH` a * x + x = ( a + &1) * x `; REAL_ENTIRE]; +ASM_SIMP_TAC[REAL_ARITH` &0 < a ==> ~( a + &1 = &0) `; REAL_FIELD` ~( x = &0) + ==> ~( &1 / x = &0) `]]);; + + + + + + + + +let NORM_NORMIZE = REWRITE_RULE[GSYM normize] Trigonometry2.NOT_VEC0_UNITABLE;; + + + +let ARCV_EQ_IMP_NORMIZE = prove_by_refinement ( +` (x:real^N) IN aff_gt {vec 0, u} {y} /\ ~ collinear {vec 0, u, y} /\ +arcV (vec 0) u x = arcV (vec 0) u y ==> normize x = normize y `, +[NHANH COLL_AFF_GT_2_1; +STRIP_TAC; +UNDISCH_TAC` x IN aff_gt {vec 0, u} {y:real^N} `; +ASM_REWRITE_TAC[IN_ELIM_THM; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +NHANH_PAT`\x. x ==> y` (MESON[]` x = y ==> (&1 /norm x) % x = (&1 / norm x) % y `); +STRIP_TAC; +MP_TAC (ISPECL [`&1 `;` &1 / norm (y:real^N)`;`u:real^N`;` y:real^N`] COLLINEAR_SCALE_ALL); +SUBGOAL_THEN` &0 < norm (y:real^N) /\ &0 < norm (x:real^N)` ASSUME_TAC; +REWRITE_TAC[NORM_POS_LT]; +UNDISCH_TAC` ~ collinear {vec 0, u, y:real^N}`; +NHANH Trigonometry2.NOT_COLLINEAR_IMP_2_UNEQUAL; +SIMP_TAC[]; +REPEAT STRIP_TAC; +UNDISCH_TAC` x = t2 % u + t3 % (y:real^N)`; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (REAL_ARITH` &0 < t3 ==> ~( t3 = &0) `); +ASM_MESON_TAC[COLL_EQ_DEPENDENT]; + + +ANTS_TAC; +DOWN; +CONV_TAC REAL_FIELD; + +SUBGOAL_THEN `&0 < &1 / norm (x:real^N) * t3 ` MP_TAC; +REWRITE_TAC[REAL_ARITH` &1 / a * b = b / a `]; +MATCH_MP_TAC REAL_LT_DIV; +ASM_REWRITE_TAC[]; + + + +REWRITE_TAC[VECTOR_MUL_LID]; +STRIP_TAC; +DISCH_THEN (ASSUME_TAC o SYM); +DOWN THEN DOWN THEN DOWN; +ONCE_REWRITE_TAC[Collect_geom.POS_EQ_INV_POS]; +NHANH (ISPECL [`u:real^N`;` &1 / norm (v:real^N)`;`v:real^N`] (GEN_ALL + Trigonometry2.WHEN_K_POS_ARCV_STABLE)); +REWRITE_TAC[GSYM Collect_geom.POS_EQ_INV_POS]; +DOWN; +REWRITE_TAC[NORM_POS_LT; Trigonometry2.NOT_VEC0_UNITABLE; VECTOR_ADD_LDISTRIB; + VECTOR_MUL_ASSOC]; +REPEAT STRIP_TAC; +REWRITE_TAC[normize]; +MATCH_MP_TAC (GEN_ALL ARCV_DETER_DIRECTION); +EXISTS_TAC` (&1 / norm (x:real^N) * t2)`; +EXISTS_TAC` (&1 / norm (x:real^N) * t3) * (norm (y:real^N)) `; +EXISTS_TAC` u:real^N`; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ABBREV_TAC` nx = &1 / norm x % (x:real^N)`; +ABBREV_TAC` ny = &1 / norm y % (y:real^N)`; +SWITCH_TAC` x = t2 % u + t3 % (y:real^N)`; +SWITCH_TAC` nx = (&1 / norm (x:real^N) * t2) % u + (&1 / norm x * t3) % (y:real^N)`; +ASM_REWRITE_TAC[]; + +CONJ_TAC; +EXPAND_TAC "ny"; +REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH` (a*b)*c = a*b*c`]; +SUBGOAL_THEN` norm (y:real^N) * &1 / norm y = &1 ` SUBST1_TAC; +MATCH_MP_TAC (REAL_FIELD` &0 < a ==> a * &1 / a = &1 `); +UNDISCH_TAC` norm (ny:real^N) = &1 `; +EXPAND_TAC "ny"; +REWRITE_TAC[NORM_POS_LT; GSYM normize; NORM_NORMIZE]; +ASM_REWRITE_TAC[REAL_MUL_RID]; + +CONJ_TAC; +MATCH_MP_TAC REAL_LT_MUL; +UNDISCH_TAC` norm (ny:real^N) = &1 `; +EXPAND_TAC "ny"; +SIMP_TAC[NORM_POS_LT; GSYM normize; NORM_NORMIZE]; +ASM_REWRITE_TAC[]; +ASM_MESON_TAC[]]);; + + + + + + +let AZIM_AND_ARCV_EQ_IMP_PARA = prove_by_refinement ( +` ~ collinear {v0,u,v} /\ azim v0 u v x = azim v0 u v y /\ +arcV v0 u x = arcV v0 u y ==> y = v0 \/ (? t. &0 <= t /\ x - v0 = t % (y - v0)) `, +[ASM_CASES_TAC` collinear {v0,u,y:real^3}`; +ASM_SIMP_TAC[AZIM_DEGENERATE]; +ASM_CASES_TAC` collinear {v0,u,x:real^3}`; +NHANH Fan.th3b; +NHANH (REWRITE_RULE[GSYM RIGHT_IMP_FORALL_THM] + Trigonometry2.NOT_EQ_IMP_AFF_AND_COLL3); +STRIP_TAC; +SWITCH_TAC` !u'. u' IN aff {v0, u} <=> collinear {v0, u, u':real^3}`; +UNDISCH_TAC` collinear {v0, u, y:real^3}`; +UNDISCH_TAC` collinear {v0, u, x:real^3}`; +ASM_REWRITE_TAC[Trigonometry2.AFF2; IN_ELIM_THM]; +REPEAT STRIP_TAC; +ASM_REWRITE_TAC[VECTOR_ARITH` (t % v0 + (&1 - t) % u) - v0 = (&1 - t) % ( u - v0)`]; + +ASM_CASES_TAC` t' = &1 `; +DISJ1_TAC; +ASM_REWRITE_TAC[REAL_SUB_REFL; VECTOR_MUL_LZERO; VECTOR_MUL_LID; VECTOR_ADD_RID]; + + +DISJ2_TAC; +EXISTS_TAC` ( &1 - t ) / ( &1 - t')`; +ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_FIELD` ~(t' = &1) ==> +((&1 - t) / (&1 - t')) * (&1 - t') = &1 - t `]; +UNDISCH_TAC` arcV v0 u x = arcV v0 (u:real^3) y `; +ONCE_REWRITE_TAC[Trigonometry2.ARCV_VEC0_FORM]; +ASM_REWRITE_TAC[VECTOR_ARITH` (t % v0 + (&1 - t) % u) - v0 = (&1 - t) % (u - v0)`]; + +ASSUME_TAC2 (REAL_FIELD` ~( t' = &1 ) ==> +&1 - t = ((&1 - t)/ (&1 - t')) * ( &1 - t')`); +ABBREV_TAC` tt = (&1 - t) / (&1 - t') `; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (REAL_ARITH`~( t' = &1 ) ==> &0 < &1 - t' \/ &1 - t' < &0 `); +FIRST_X_ASSUM DISJ_CASES_TAC; +SUBGOAL_THEN` arcV (vec 0) (u:real^3 - v0) ((&1 - t') % (u - v0)) = &0` SUBST1_TAC; +MATCH_MP_TAC ARCV_EQ_0_ORIGIN; +ASM_REWRITE_TAC[VECTOR_ARITH` a - b = vec 0 <=> b = a `]; +UNDISCH_TAC` ~(v0 = u:real^3)`; +ONCE_REWRITE_TAC[VECTOR_ARITH`a = b <=> b - a = vec 0`]; +SIMP_TAC[ARCV_ORI_DIRECTIONS]; +STRIP_TAC; +UNDISCH_TAC` &0 < &1 - t'`; +SIMP_TAC[REAL_LT_MUL_EQ; REAL_LT_IMP_LE]; +ASSUME_TAC2 (ISPECL [`&1 - t'`;` u:real^3`;`v0:real^3`] (GEN_ALL + ( ONCE_REWRITE_RULE[Trigonometry2.ARCV_VEC0_FORM] ARCV_PI_OPPOSITE))); +DOWN; +SIMP_TAC[VECTOR_ARITH`(a + b:real^N) - a = b `]; +STRIP_TAC; +UNDISCH_TAC` ~( v0 = u:real^3)`; +ONCE_REWRITE_TAC[VECTOR_ARITH` a = b <=> b - a = vec 0`]; +SIMP_TAC[ARCV_ORI_DIRECTIONS]; +STRIP_TAC; +UNDISCH_TAC` &1 - t' < &0 `; +SIMP_TAC[ONCE_REWRITE_RULE[REAL_MUL_SYM] REAL_NEG_MUL_EQ; REAL_LT_IMP_LE]; + + + + + + + +UNDISCH_TAC` collinear {v0, u, y:real^3}`; +NHANH Fan.th3b; +ASM_CASES_TAC` y = v0:real^3`; +ASM_REWRITE_TAC[]; + + +REPEAT STRIP_TAC; +SUBGOAL_THEN` sin (arcV v0 u (y:real^3)) = &0` MP_TAC; +MATCH_MP_TAC COLLINEAR_SIN_ARCV_0; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` ~(sin (arcV v0 u (x:real^3)) = &0 )` MP_TAC; +MATCH_MP_TAC Trigonometry2.NOT_COLLINEAR_IMP_NOT_SIN0; +ASM_REWRITE_TAC[]; +ASM_SIMP_TAC[]; + + +ASM_CASES_TAC` x = v0:real^3`; +STRIP_TAC; +DISJ2_TAC; +EXISTS_TAC` &0 `; +ASM_REWRITE_TAC[REAL_LE_REFL; VECTOR_SUB_REFL; VECTOR_MUL_LZERO]; + + +ASM_CASES_TAC` collinear {v0, u, x:real^3}`; +STRIP_TAC; +SUBGOAL_THEN` sin (arcV v0 u (x:real^3)) = &0` MP_TAC; +MATCH_MP_TAC COLLINEAR_SIN_ARCV_0; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC Fan.th3b; +EXISTS_TAC` v:real^3`; +FIRST_ASSUM ACCEPT_TAC; +UNDISCH_TAC` ~collinear {v0, u, y:real^3}`; +ASM_SIMP_TAC[Trigonometry2.NOT_COLLINEAR_IMP_NOT_SIN0]; +STRIP_TAC; + +ASSUME_TAC2 (ISPECL [`v0:real^3`;` u:real^3`;`v:real^3`; ` x:real^3`;` + y:real^3`] AZIM_EQ_ALT); +UNDISCH_TAC` ~collinear {v0, u, y:real^3}`; +NHANH COLL_AFF_GT_2_1; +STRIP_TAC; +DISJ2_TAC; +UNDISCH_TAC` azim v0 u v x = azim v0 u v (y:real^3)`; +ASM_REWRITE_TAC[IN_ELIM_THM; REAL_ARITH` a + b = &1 <=> a = &1 - b`]; +STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[VECTOR_ARITH` x = (&1 - (t2 + t3)) % v0 + t2 % u + t3 % y <=> +x - v0 = t2 % ( u - v0) + t3 % (y - v0) `]; +ABBREV_TAC` xx = x - v0:real^3`; +ABBREV_TAC` uu = u - v0:real^3 `; +ABBREV_TAC` yy = y - v0:real^3`; +STRIP_TAC; +EXISTS_TAC` t3:real`; + +UNDISCH_TAC` arcV v0 u x = arcV v0 u (y:real^3)`; +NHANH (MESON[]`arcV v0 u x = arcV v0 u y ==> cos (arcV v0 u x) = cos (arcV v0 u y)`); +ASSUME_TAC2 (ISPECL [`v0:real^3`;`u:real^3`;` x:real^3`] + Collect_geom.NOT_COL3_IMP_DIFF); +ASSUME_TAC2 (ISPECL [`v0:real^3`;`u:real^3`;` y:real^3`] + Collect_geom.NOT_COL3_IMP_DIFF); +DOWN THEN DOWN; +REWRITE_TAC[DE_MORGAN_THM]; +ASM_SIMP_TAC[Trigonometry2.NOT_EQ_IMPCOS_ARC]; + +STRIP_TAC THEN STRIP_TAC; +SUBGOAL_THEN` &0 < norm (xx:real^3) /\ &0 < norm (uu:real^3) /\ +&0 < norm (yy:real^3)` MP_TAC; +REWRITE_TAC[NORM_POS_LT]; +EXPAND_TAC "xx"; +EXPAND_TAC "uu"; +EXPAND_TAC "yy"; +REWRITE_TAC[VECTOR_SUB_EQ]; +ASM_REWRITE_TAC[]; + +REPEAT STRIP_TAC; +ASM_SIMP_TAC[REAL_LT_IMP_LE]; + +SUBGOAL_THEN` normize (xx:real^3) = normize (yy:real^3)` MP_TAC; +MATCH_MP_TAC (GEN_ALL ARCV_EQ_IMP_NORMIZE); +EXISTS_TAC` uu:real^3`; +CONJ_TAC; +UNDISCH_TAC` ~collinear {v0, u, y:real^3}`; +ONCE_REWRITE_TAC[Trigonometry2.COLLINEAR_TRANSABLE]; +NHANH_PAT`\x. x ==> y` COLL_AFF_GT_2_1; +ASM_SIMP_TAC[]; +STRIP_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` t1:real`; +EXISTS_TAC` t2:real`; +EXISTS_TAC` t3:real`; +ASM_REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +REAL_ARITH_TAC; + +UNDISCH_TAC` ~ collinear {v0, u, y:real^3}`; +UNDISCH_TAC` arcV v0 u x = arcV v0 u (y:real^3)`; +ONCE_REWRITE_TAC[Trigonometry2.ARCV_VEC0_FORM]; +ONCE_REWRITE_TAC[Trigonometry2.COLLINEAR_TRANSABLE]; +ASM_SIMP_TAC[VECTOR_SUB_RZERO]; + + + +ASM_REWRITE_TAC[normize; VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC]; +ONCE_REWRITE_TAC[VECTOR_ARITH` a + x % b = y % b <=> a + (x - y) % b = vec 0`]; + +ASM_CASES_TAC` ~( (&1 / norm (t2 % uu + t3 % (yy:real^3)) * t2) = &0)`; +STRIP_TAC; +SUBGOAL_THEN` collinear {vec 0, uu, yy:real^3}` MP_TAC; +REWRITE_TAC[COLL_EQ_DEPENDENT]; +DOWN THEN DOWN THEN MESON_TAC[]; + + + +UNDISCH_TAC` ~ collinear {v0, u, y:real^3}`; +ONCE_REWRITE_TAC[Trigonometry2.COLLINEAR_TRANSABLE]; +ASM_SIMP_TAC[VECTOR_SUB_RZERO]; + + + +DOWN; +SIMP_TAC[REAL_ENTIRE]; +ASSUME_TAC2 (REAL_FIELD` &0 < norm (xx:real^3) ==> ~( &1 / norm xx = &0) `); +DOWN; +ASM_SIMP_TAC[VECTOR_MUL_LZERO; REAL_SUB_REFL; VECTOR_ADD_LID]]);; + + + + + + + +let NORM_CAUCHY_SCHWARZ_FRAC2 = prove(` -- &1 <= (u dot v) / (norm u * norm v) /\ + (u dot v) / (norm u * norm (v:real^N)) <= &1 `, +ASM_CASES_TAC`~((u:real^N) = vec 0) /\ ~((v: real^N) = vec 0)` THEN +ASM_SIMP_TAC[Trigonometry1.NORM_CAUCHY_SCHWARZ_FRAC] THEN +DOWN THEN REWRITE_TAC[DE_MORGAN_THM] THEN STRIP_TAC THENL [ +ASM_REWRITE_TAC[DOT_LZERO] THEN REAL_ARITH_TAC; +ASM_REWRITE_TAC[DOT_RZERO] THEN REAL_ARITH_TAC]);; + + +let COS_ARCV_EQ_ARCV = prove( +` cos (arcV x y z) = cos (arcV xx yy zz) <=> arcV x y z = arcV xx yy zz `, +EQ_TAC THENL [REWRITE_TAC[arcV] THEN STRIP_TAC THEN MATCH_MP_TAC COS_INJ_PI THEN +DOWN THEN MESON_TAC[ACS_BOUNDS; NORM_CAUCHY_SCHWARZ_FRAC2];SIMP_TAC[]]);; + + + +let ARCV_BOUNDS = prove(` &0 <= arcV (x:real^N) y z /\ arcV x y z <= pi `, +REWRITE_TAC[arcV] THEN MATCH_MP_TAC ACS_BOUNDS THEN +REWRITE_TAC[NORM_CAUCHY_SCHWARZ_FRAC2]);; + + + + + +let SIN_ARCV_EQ_0_EQ_LAP = prove( +` sin (arcV x y (z:real^N)) = &0 <=> arcV x y z = &0 \/ arcV x y z = pi `, +MP_TAC ARCV_BOUNDS THEN MP_TAC PI_POS THEN +MESON_TAC[REAL_ARITH` &0 < x /\ &0 <= a ==> -- x < a`; Trigonometry1.SIN_NEGPOS_PI]);; + + + + + + +let ORTHONORMAL_NOT_COLLINEAR = prove( +` orthonormal e1 e2 e3 ==> ~ collinear {vec 0, e3, e1} `, +REWRITE_TAC[orthonormal; GSYM CROSS_EQ_0] THEN +ONCE_REWRITE_TAC[GSYM CROSS_TRIPLE] THEN REPEAT STRIP_TAC THEN +FIRST_X_ASSUM SUBST_ALL_TAC THEN DOWN THEN +REWRITE_TAC[DOT_LZERO; REAL_LT_REFL]);; + + + + +let LUNAR_DEFORM_INJ = prove_by_refinement ( +` orthonormal e1 e2 e3 /\ &0 <= t /\ t < &1 ==> +(! x y. lunar_deform (e1,e2,e3) t x = lunar_deform (e1,e2,e3) t y ==> x = y )`, +[REPEAT STRIP_TAC; +ASM_CASES_TAC` (x:real^3) = vec 0`; +ASSUME_TAC2 (SPEC` y:real^3 ` (GEN `x:real^3 ` LUNAR_DEFORM_PRESERVE_NORM)); +ASSUME_TAC2 LUNAR_DEFORM_PRESERVE_NORM; +DOWN; +DOWN; +ASM_SIMP_TAC[NORM_0; NORM_EQ_0]; + + +DOWN THEN DOWN; +NHANH_PAT`\a. a ==> b ` (MESON[]` a = b ==> norm a = norm b `); +ASM_SIMP_TAC[LUNAR_DEFORM_PRESERVE_NORM]; +REWRITE_TAC[lunar_deform]; +ASM_SIMP_TAC[ORTHONORMAL_IMP_INDEPENDENT_EXPLICIT; GSYM NORM_POS_LT]; +REPEAT STRIP_TAC; +UNDISCH_TAC` norm (x:real^3) * cos (arcV (vec 0) e3 x) = norm y * cos (arcV (vec 0) e3 (y:real^3))`; +ASM_SIMP_TAC[REAL_EQ_MUL_LCANCEL; REAL_POS_NZ; COS_ARCV_EQ_ARCV]; +STRIP_TAC; +ASM_CASES_TAC` sin (arcV (vec 0) e3 (x:real^3)) = &0`; +DOWN; + + +NHANH (REWRITE_RULE[CONTRAPOS_THM] Trigonometry2.NOT_COLLINEAR_IMP_NOT_SIN0); +ASM_REWRITE_TAC[]; +NHANH (REWRITE_RULE[CONTRAPOS_THM] Trigonometry2.NOT_COLLINEAR_IMP_NOT_SIN0); +REWRITE_TAC[COLLINEAR_LEMMA_ALT]; +SUBGOAL_THEN` ~(e3:real^3 = vec 0) ` MP_TAC; +UNDISCH_TAC` orthonormal e1 e2 e3`; +REWRITE_TAC[orthonormal]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +UNDISCH_TAC` vec 0 dot (vec 0: real^3) = &1`; +REWRITE_TAC[DOT_LZERO]; +REAL_ARITH_TAC; +SIMP_TAC[SIN_ARCV_EQ_0_EQ_LAP]; +STRIP_TAC THEN STRIP_TAC; +REPEAT STRIP_TAC; +SUBGOAL_THEN` arcV (vec 0) e3 (x:real^3) = &0` MP_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` arcV (vec 0) e3 (y:real^3) = &0`; +PHA; +UNDISCH_TAC` ~( (e3:real^3) = vec 0) `; +DOWN THEN DOWN; +SIMP_TAC[ARCV_ORI_DIRECTIONS]; +REPEAT STRIP_TAC; +UNDISCH_TAC` norm (x:real^3) = norm (y:real^3)`; +ASM_SIMP_TAC[NORM_MUL; Trigonometry2.LT_IMP_ABS_REFL; REAL_EQ_MUL_RCANCEL; NORM_EQ_0]; + +SUBGOAL_THEN` arcV (vec 0) e3 (x:real^3) = pi` MP_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` arcV (vec 0) e3 (y:real^3) = pi`; +PHA; +UNDISCH_TAC` ~( (e3:real^3) = vec 0) `; +DOWN THEN DOWN; +SIMP_TAC[ARCV_ORI_DIRECTIONS]; +REPEAT STRIP_TAC; +UNDISCH_TAC` norm (x:real^3) = norm (y:real^3)`; +ASM_REWRITE_TAC[NORM_MUL]; +ONCE_REWRITE_TAC[GSYM REAL_ABS_NEG]; +DOWN THEN DOWN; +REWRITE_TAC[REAL_ARITH` a < &0 <=> &0 < -- a `]; +ASM_SIMP_TAC[NORM_MUL; Trigonometry2.LT_IMP_ABS_REFL; REAL_EQ_MUL_RCANCEL; NORM_EQ_0]; +SIMP_TAC[REAL_ARITH` -- a = -- b <=> a = b `]; + +UNDISCH_TAC` norm x * + sin ((&1 - t) * azim (vec 0) e3 e1 x) * + sin (arcV (vec 0) e3 x) = + norm y * + sin ((&1 - t) * azim (vec 0) e3 e1 y) * + sin (arcV (vec 0) e3 y)`; +UNDISCH_TAC` norm x * + cos ((&1 - t) * azim (vec 0) e3 e1 x) * + sin (arcV (vec 0) e3 x) = + norm y * + cos ((&1 - t) * azim (vec 0) e3 e1 y) * + sin (arcV (vec 0) e3 y)`; +DOWN; +ASM_SIMP_TAC[REAL_EQ_MUL_RCANCEL; REAL_EQ_MUL_LCANCEL; REAL_POS_NZ]; +REPEAT STRIP_TAC; +SUBGOAL_THEN` (&1 - t) * azim (vec 0) e3 e1 x = (&1 - t) * azim (vec 0) e3 e1 y` MP_TAC; +MATCH_MP_TAC SIN_COS_INJ; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC (REAL_FIELD` &0 <= x /\ x < a /\ &0 <= y /\ y < a ==> abs ( x - y) < a `); +SPEC_TAC (`x:real^3`,`x:real^3`); +SPEC_TAC (`y:real^3`,`y:real^3`); + +MATCH_MP_TAC (MESON[]`(! x. P x /\ L x ) ==> (! y x. P x /\ L x /\ P y /\ L y)`); +GEN_TAC; +CONJ_TAC; +MATCH_MP_TAC REAL_LE_MUL; +REWRITE_TAC[AZIM_RANGE]; +UNDISCH_TAC` t < &1 ` THEN REAL_ARITH_TAC; +REWRITE_TAC[REAL_SUB_RDISTRIB; REAL_MUL_LID]; +MATCH_MP_TAC ( +REAL_FIELD` azim (vec 0) e3 e1 x' < &2 * pi /\ &0 <= t * azim (vec 0) e3 e1 x' +==> azim (vec 0) e3 e1 x' - t * azim (vec 0) e3 e1 x' < &2 * pi`); +REWRITE_TAC[AZIM_RANGE]; +MATCH_MP_TAC REAL_LE_MUL; +ASM_REWRITE_TAC[AZIM_RANGE]; + +ASM_SIMP_TAC[REAL_EQ_MUL_LCANCEL; REAL_ARITH` t < a ==> ~( a - t = &0)`]; +ASSUME_TAC2 ORTHONORMAL_NOT_COLLINEAR; +STRIP_TAC; +ASSUME_TAC2 ( +SPECL[`e1:real^3`;`e3:real^3`;`x:real^3`;`y:real^3`;` vec 0:real^3`] + (GEN_ALL AZIM_AND_ARCV_EQ_IMP_PARA)); +DOWN; +ASM_SIMP_TAC[GSYM NORM_EQ_0; REAL_POS_NZ; VECTOR_SUB_RZERO]; +STRIP_TAC; + +UNDISCH_TAC` norm (x:real^3) = norm (y:real^3)`; +ASM_SIMP_TAC[NORM_MUL; REAL_ARITH` a * x = x <=> ( a - &1 ) * x = &0`; REAL_ENTIRE; REAL_POS_NZ]; +UNDISCH_TAC` &0 <= t'`; +SIMP_TAC[GSYM REAL_ABS_REFL; REAL_SUB_0; VECTOR_MUL_LID]]);; + + + + + +let GRAPH_IMAGE_IMAGE = prove_by_refinement ( +`graph E /\ (! x y. (f:real^N -> real^M) x = f y ==> x = y) +==> graph (IMAGE (IMAGE f) E)`, +[REWRITE_TAC[graph; HAS_SIZE_2_EXISTS; IMAGE; IN_ELIM_THM; IN]; +IMP_TAC; +DISCH_THEN NHANH; +REPEAT STRIP_TAC; +EXISTS_TAC` (f:real^N -> real^M) x' `; +EXISTS_TAC` (f:real^N -> real^M) y `; +CONJ_TAC; +ASM_MESON_TAC[]; +STRIP_TAC; +ASM_REWRITE_TAC[IN_ELIM_THM]; +MESON_TAC[]]);; + + + + + + +let LUNAR_DEFORM_ORIGIN = prove(` lunar_deform (e1,e2,e3) t (vec 0) = vec 0`, +REWRITE_TAC[lunar_deform; NORM_0; REAL_MUL_LZERO; VECTOR_MUL_LZERO; + VECTOR_ADD_RID]);; + + + + + +let orthonormal1 = prove(`!e1 e2 e3. + orthonormal e1 e2 e3 <=> + norm e1 = &1 /\ + norm e2 = &1 /\ + norm e3 = &1 /\ + e1 dot e2 = &0 /\ + e1 dot e3 = &0 /\ + e2 dot e3 = &0 /\ + &0 < (e1 cross e2) dot e3 `, +REWRITE_TAC[orthonormal; NORM_EQ_1]);; + + + + + + + +let ORTHO_SPHERICAL_AZIM = prove_by_refinement(`orthonormal e1 e2 e3 /\ +x = ( r * cos theta) % e1 + (r * sin theta) % e2 + h % e3 /\ +&0 < r /\ +&0 <= theta /\ theta < &2 * pi +==> azim (vec 0) e3 e1 x = theta `, +[STRIP_TAC; +MP_TAC (ISPECL [` vec 0:real^3 `;` e3: real^3 `;` e1: real^3 `;` x:real^3 `;` &0 `; +`h:real`;` &1 `;` r:real`;` e1:real^3 `;` e2: real^3`;` e3:real^3`;` &0`; +`theta: real`] AZIM_UNIQUE); +ANTS_TAC; +ASM_REWRITE_TAC[VECTOR_SUB_RZERO; dist; SIN_0; COS_0; REAL_ADD_LID; + VECTOR_MUL_LZERO; REAL_MUL_RZERO; VECTOR_ADD_RID; REAL_MUL_RID; VECTOR_MUL_LID]; +REWRITE_TAC[REAL_ARITH` &0 < &1 `]; +DOWN_TAC; +SIMP_TAC[orthonormal1; VECTOR_MUL_LID; GSYM NORM_EQ_0; REAL_ARITH` ~(&1 = &0)`]; + +SIMP_TAC[]]);; + + + + +let COS_ARCV = prove_by_refinement(`cos (arcV v0 u (w:real^N)) = + ((u - v0) dot (w - v0)) / (norm (u - v0) * norm (w - v0))`, +[ASM_CASES_TAC` ~(v0 = u) /\ ~(v0 = w:real^N)`; +DOWN THEN REWRITE_TAC[Trigonometry2.NOT_EQ_IMPCOS_ARC]; DOWN; +REWRITE_TAC[DE_MORGAN_THM]; STRIP_TAC; +ASM_SIMP_TAC[VECTOR_SUB_REFL; arcV; DOT_LZERO; REAL_ARITH` &0 / x = &0`; ACS_0; +COS_PI2]; +ASM_SIMP_TAC[VECTOR_SUB_REFL; arcV; DOT_RZERO; REAL_ARITH` &0 / x = &0`; ACS_0; +COS_PI2]]);; + + + + + + +let LUNAR_DEFORM_ARCV_PRESERVED = prove(`orthonormal e1 e2 e3 ==> +arcV (vec 0) e3 x = arcV (vec 0) e3 (lunar_deform (e1,e2,e3) t x) `, +ASM_CASES_TAC` (x:real^3) = vec 0 ` THENL [ +ASM_REWRITE_TAC[LUNAR_DEFORM_ORIGIN]; +SIMP_TAC[LUNAR_DEFORM_PRESERVE_NORM; arcV; orthonormal; VECTOR_SUB_RZERO] THEN +SIMP_TAC[lunar_deform; DOT_RADD; DOT_RMUL; DOT_SYM; REAL_MUL_RZERO; REAL_ADD_LID; REAL_MUL_RID; COS_ARCV; VECTOR_SUB_RZERO; GSYM NORM_EQ_1; REAL_MUL_LID] THEN +DOWN THEN SIMP_TAC[GSYM NORM_EQ_0; REAL_FIELD` ~( a = &0) ==> a * b / a = b`; NORM_EQ_1; REAL_MUL_RID]]);; + + + +(* ========================================================================= *) +(* ========================================================================= *) + + + +Local_lemmas.LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI;; +Local_lemmas.interior_angle1;; +Wrgcvdr_cizmrrh.lunar;; +Local_lemmas.HKIRPEP;; + +(* because interior_angle1 (vec 0) FF v <= pi and +interior_angle1 x FF v = azim x v (rho_node1 FF v) (@a. a,v IN FF) +, the condition theta (ivs_rho_node1 FF v) <= &0 +is satisfied automatically *) + + +g ` convex_local_fan (V,E,FF) /\ lunar (v,w) V E /\ +orthonormal e1 e2 e3 /\ v = a % e3 /\ &0 < a /\ +rho_node1 FF v IN aff_gt {vec 0, e3} {e1} /\ +lunar_deform (e1,e2,e3) t = f /\ &0 <= t /\ t < &1 +==> +convex_local_fan (IMAGE f V, IMAGE (\S. IMAGE f S) E, IMAGE (\ (m,n). f m, f n) FF) + /\ +lunar (v,w) (IMAGE f V) (IMAGE (\S. IMAGE f S) E) /\ +CARD (IMAGE f V) = CARD V`;; + + + + +g ` convex_local_fan (V,E,FF) /\ lunar (v,w) V E /\ +orthonormal e1 e2 e3 /\ v = a % e3 /\ &0 < a /\ +rho_node1 FF v IN aff_gt {vec 0, e3} {e1} /\ +lunar_deform (e1,e2,e3) t = f /\ &0 <= t /\ t < &1 +==> FAN (vec 0,IMAGE f V,IMAGE ( IMAGE f ) E) `;; +e (REWRITE_TAC[convex_local_fan]);; +e (NHANH Local_lemmas.LOCAL_FAN_ORBIT_MAP_V);; +e (REWRITE_TAC[local_fan; FAN]);; +e (LET_TAC);; +e (STRIP_TAC);; +e (CONJ_TAC);; +e (UNDISCH_TAC` UNIONS E SUBSET (V:real^3 -> bool) `);; +e (REWRITE_TAC[GSYM IMAGE_UNIONS]);; +e (SET_TAC[]);; + +e (CONJ_TAC);; +e (MATCH_MP_TAC GRAPH_IMAGE_IMAGE);; +e (ASM_REWRITE_TAC[]);; +e (EXPAND_TAC "f");; +e (MATCH_MP_TAC LUNAR_DEFORM_INJ);; +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[fan1; fan2; fan6; fan7]);; +e (CONJ_TAC);; + +e (UNDISCH_TAC` fan1 ((vec 0:real^3),(V:real^3 -> bool),(E:(real^3 -> bool) -> bool))`);; +e (REWRITE_TAC[fan1]);; +e (SIMP_TAC[FINITE_IMAGE]);; +e (SET_TAC[]);; +e (ASSUME_TAC2 LUNAR_DEFORM_INJ);; + +e (CONJ_TAC);; +e (UNDISCH_TAC` fan2 (vec 0,V: real^3 -> bool,(E:(real^3 -> bool) -> bool)) `);; +e (REWRITE_TAC[fan2]);; +e (DOWN);; +e (MP_TAC LUNAR_DEFORM_ORIGIN);; +e (ASM_REWRITE_TAC[IN_IMAGE]);; +e (MESON_TAC[]);; + +e (CONJ_TAC);; +e (GEN_TAC);; +e (UNDISCH_TAC` fan6 (vec 0,V:real^3 -> bool,E:(real^3 -> bool) -> bool ) `);; +e (REWRITE_TAC[IN_IMAGE; IMAGE; fan6]);; +e (STRIP_TAC);; +e (FIRST_ASSUM NHANH);; +e (STRIP_TAC);; +e (MP_TAC Local_lemmas.HKIRPEP);; +e (ANTS_TAC);; +e (ASM_REWRITE_TAC[convex_local_fan; local_fan]);; +e (CONV_TAC (ONCE_DEPTH_CONV let_CONV));; +e (SWITCH_TAC ` FF = face H (x:real^3 # real^3 )`);; +e (ASM_REWRITE_TAC[FAN; fan6]);; +e (EXISTS_TAC `x:(real^3 #real^3)`);; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (UNDISCH_TAC` graph (E: (real^3 -> bool) -> bool) `);; +e (REWRITE_TAC[graph]);; +e (STRIP_TAC);; +e (UNDISCH_TAC`(x': real^3 -> bool) IN E `);; +e (REWRITE_TAC[IN]);; +e (FIRST_ASSUM NHANH);; +e (REWRITE_TAC[HAS_SIZE]);; +e (NHANH Rogers.CARD_2_IMP_DOUBLE);; +e (STRIP_TAC);; + +e (UNDISCH_TAC` v = ITER j (rho_node1 FF) w`);; +e (USE_FIRST `w = ITER i (rho_node1 FF) v` (fun x -> REWRITE_TAC[x; ITER_ADD]));; +e (ASSUME_TAC2 (ARITH_RULE` ~(j = 0) ==> 0 < j + i `));; +e (DOWN THEN PHA);; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (NHANH Lvducxu.ITER_CYCLIC_ORBIT);; + + +(* + ` special_fan (V,E,FF,S) <=> +packing V /\ +V SUBSET ball (vec 0, &1) /\ +convex_local_fan (V,E,FF) /\ +S SUBSET E /\ +(! v w. {v,w} IN S ==> dist (v,w) = &2 * t0 ) /\ +(! v w. {v,w} IN E ==> dist (v,w) <= &2 * t0 ) /\ +(! v w. + v IN V /\ w IN V /\ ~( v = w ) /\ ~( {v,w} IN E ) + ==> &2 * t0 <= dist (v,w)) /\ +let r = CARD E - CARD S in +CARD S <= 3 /\ +3 - CARD S <= r /\ r <= 6 - 2 * (CARD S)`;; +*) + +(* ================================================== *) +(* LEMMA YOLCBTG *) +(* ============= *) + + + + + +let AFF_CONV0_INTERSECTION_LEMMA = prove_by_refinement +(`! u x y (z:real^3). +coplanar {u,x,y,z} /\ +~ collinear {u,x,y} /\ +~ collinear {u,y,z} /\ +~ collinear {u,z,x} +==> ~ ( aff {u,x} INTER conv0 {y,z} = {} /\ + aff {u,y} INTER conv0 {x,z} = {} /\ + aff {u,z} INTER conv0 {x,y} = {} ) `, +[REWRITE_TAC[coplanar]; +REPEAT STRIP_TAC; +SUBGOAL_THEN` affine hull {u', v, w} = affine hull {u,x,y:real^3}` MP_TAC; +MATCH_MP_TAC Local_lemmas.SUBSET_NOT_COLLINEAR_AFFINE_HULL_EQ; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC SUBSET_TRANS; +EXISTS_TAC` {u,x,y,z:real^3}` ; +ASM_REWRITE_TAC[INSERT_SUBSET; IN_INSERT; EMPTY_SUBSET]; +STRIP_TAC; +SUBGOAL_THEN` {z:real^3} SUBSET affine hull {u', v, w} ` MP_TAC; +MATCH_MP_TAC SUBSET_TRANS; +EXISTS_TAC` {u,x,y,z:real^3}`; +ASM_REWRITE_TAC[INSERT_SUBSET; IN_INSERT; EMPTY_SUBSET]; + +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; AFFINE_HULL_3; IN_ELIM_THM]; +STRIP_TAC; +ASM_CASES_TAC` &0 < v' /\ &0 < w' `; +ABBREV_TAC` tt = &0 % u + &1 % (z:real^3) `; +SUBGOAL_THEN` (?tt. tt IN aff {u, z:real^3} /\ tt IN conv0 {x, y})` MP_TAC; +MATCH_MP_TAC (GEN_ALL Local_lemmas.CONDS_FOR_INTER_AFF_CONV0); +EXISTS_TAC` u'': real` ; +EXISTS_TAC` v': real `; +EXISTS_TAC` w': real`; +EXISTS_TAC` &1 `; +EXISTS_TAC` tt: real^3 `; +EXISTS_TAC`&0 `; +EXISTS_TAC` &1 `; +ASM_REWRITE_TAC[REAL_ADD_LID]; +EXPAND_TAC "tt"; +REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO; VECTOR_ADD_LID]; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` aff {u, z} INTER conv0 {x, y:real^3} = {}`; +REWRITE_TAC[Local_lemmas.INTER_EQ_EM_EXPAND]; + +DOWN_TAC; +SPEC_TAC (`v':real`,`v':real`); +SPEC_TAC (`w':real`,`w':real`); +SPEC_TAC (`x:real^3`,` x:real^3 `); +SPEC_TAC (`y:real^3`,` y:real^3`); +MATCH_MP_TAC (MESON[REAL_ARITH` a <= b \/ b <= a`]` (! y x b a. P y x b a +==> P x y a b) /\ (! y x b a. b <= a ==> P y x b a) ==> + (! y x b a. P y x b a) `); +SIMP_TAC[INSERT_COMM; REAL_ADD_SYM; VECTOR_ADD_SYM; CONJ_SYM]; +CONJ_TAC; +MESON_TAC[]; + +REPEAT STRIP_TAC; +ASM_CASES_TAC` &0 < w' `; +UNDISCH_TAC` w' <= v':real`; +DOWN THEN DOWN THEN PHA; +REAL_ARITH_TAC; + +ASM_CASES_TAC` w' = &0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN_TAC; +REWRITE_TAC[REAL_ADD_RID; VECTOR_MUL_LZERO; VECTOR_ADD_RID; + Local_lemmas.collinear_fan22; Collect_geom.AFF_2POINTS_INTERPRET; + IN_ELIM_THM]; +STRIP_TAC; +UNDISCH_TAC` z = u'' % u + v' % (x:real^3)`; +UNDISCH_TAC` u'' + v' = &1 `; +UNDISCH_TAC` ~((?ta tb. ta + tb = &1 /\ z = ta % u + tb % x) \/ u = (x:real^3))`; +MESON_TAC[]; + +ASM_CASES_TAC` v' = &0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN_TAC; +REWRITE_TAC[REAL_ADD_LID; VECTOR_MUL_LZERO; VECTOR_ADD_LID; + Local_lemmas.collinear_fan22; Collect_geom.AFF_2POINTS_INTERPRET; + IN_ELIM_THM]; +MESON_TAC[]; + + +DOWN; +REWRITE_TAC[REAL_ARITH` a = &0 <=> ~( &0 < a \/ a < &0 )`]; +STRIP_TAC; +UNDISCH_TAC` z = u'' % u + v' % x + w' % (y:real^3)`; +PURE_ONCE_REWRITE_TAC[VECTOR_ARITH` z = a % x + b + w' % (y:real^N) <=> +b = ( -- a) % x + ( -- w') % y + &1 % z `]; +STRIP_TAC; +SUBGOAL_THEN` (?tt. tt IN aff {u, x:real^3} /\ tt IN conv0 {y, z})` MP_TAC; +MATCH_MP_TAC (GEN_ALL Local_lemmas.CONDS_FOR_INTER_AFF_CONV0); +EXISTS_TAC` -- u'':real `; +EXISTS_TAC` -- w':real `; +EXISTS_TAC` &1 `; +EXISTS_TAC` v': real `; +EXISTS_TAC` v' % x:real^3 `; +EXISTS_TAC` &0 `; +EXISTS_TAC` v':real`; +ASM_REWRITE_TAC[REAL_ARITH` &0 < &1 `; REAL_ADD_LID; VECTOR_MUL_LZERO; + VECTOR_ADD_LID]; +ASM_REAL_ARITH_TAC; +UNDISCH_TAC` aff {u, x} INTER conv0 {y, z:real^3} = {}`; +REWRITE_TAC[Local_lemmas.INTER_EQ_EM_EXPAND]; + + + + +UNDISCH_TAC` z = u'' % u + v' % x + w' % (y:real^3)`; +PURE_ONCE_REWRITE_TAC[VECTOR_ARITH` z = u'' % u + v' % x + w' % y <=> +-- z = ( -- u'') % u + ( -- v') % x + ( -- w') % y `]; +STRIP_TAC; +SUBGOAL_THEN` (?tt. tt IN aff {u, z:real^3} /\ tt IN conv0 {x, y})` MP_TAC; +MATCH_MP_TAC (GEN_ALL Local_lemmas.CONDS_FOR_INTER_AFF_CONV0); +EXISTS_TAC` -- u'':real `; +EXISTS_TAC` -- v':real `; +EXISTS_TAC` -- w' `; +EXISTS_TAC` -- &1 `; +EXISTS_TAC` -- z :real^3 `; +EXISTS_TAC` &0 `; +EXISTS_TAC` -- &1`; +ASM_REWRITE_TAC[REAL_ADD_LID; VECTOR_MUL_LZERO; VECTOR_ADD_LID]; +ASM_REWRITE_TAC[VECTOR_ARITH` -- &1 % x = -- (x:real^N)`]; +ASM_REAL_ARITH_TAC; +UNDISCH_TAC` aff {u, z} INTER conv0 {x, y:real^3} = {}`; +REWRITE_TAC[Local_lemmas.INTER_EQ_EM_EXPAND]]);; + + + + + + + + + +let CVLF_COLLINEAR_CIRCULAR_LUNAR = prove( +` convex_local_fan (V,E,FF) /\ {v,w} SUBSET V /\ collinear {vec 0, v, w} /\ +~ (v = w) ==> circular V E \/ lunar (v,w) V E `, +ASM_CASES_TAC` circular (V:real^3 -> bool) E` THENL [ +ASM_REWRITE_TAC[]; STRIP_TAC THEN DISJ2_TAC THEN +REWRITE_TAC[lunar] THEN ASM_REWRITE_TAC[]]);; + + + + + +let CVLF_FLAT_ANGLE_LEMMA = prove_by_refinement( +` convex_local_fan (V,E,FF) /\ + {v, w} SUBSET V /\ + collinear {vec 0, v, w} /\ + ~(v = w) ==> +! z. z IN V /\ ~( z = v ) /\ ~( z = w ) ==> +interior_angle1 (vec 0) FF z = pi `, +[NHANH CVLF_COLLINEAR_CIRCULAR_LUNAR; +STRIP_TAC; +ASSUME_TAC2 Local_lemmas.KCHMAMG; +DOWN THEN IMP_TAC; +DISCH_TAC THEN REMOVE_TAC; +ASM_SIMP_TAC[]; +ASSUME_TAC2 Local_lemmas.HKIRPEP; +DOWN; +SIMP_TAC[IN_DIFF; IN_INSERT; DE_MORGAN_THM; NOT_IN_EMPTY]]);; + + + + +(* ============================================================== *) + + + + +let TOW_REAL_EXISTS_COMBINED = prove_by_refinement +(` (? e1. &0 < e1 /\ (! t. -- e1 < t /\ t < e1 ==> P t )) /\ +(? e1. &0 < e1 /\ (! t. -- e1 < t /\ t < e1 ==> Q t )) +==> (? e1. &0 < e1 /\ (! t. -- e1 < t /\ t < e1 ==> P t /\ Q t ))`, +[STRIP_TAC; +ASM_CASES_TAC` e1 < e1':real `; +EXISTS_TAC` e1:real `; +ASM_REWRITE_TAC[]; +GEN_TAC; +ASM_SIMP_TAC[]; +SUBGOAL_THEN` -- e1' < -- (e1:real) ` MP_TAC; +DOWN; +REAL_ARITH_TAC; +ASM_MESON_TAC[REAL_LT_TRANS]; + +EXISTS_TAC` e1':real`; +ASM_REWRITE_TAC[]; +GEN_TAC; +ASM_SIMP_TAC[]; +SUBGOAL_THEN` ~(-- e1' < -- e1:real) ` MP_TAC; +DOWN; +REAL_ARITH_TAC; +ASM_MESON_TAC[REAL_ARITH` ~( a < b) /\ a < c ==> b < (c:real) `]]);; + + + + + + + + +let CONTINUOUS_FUNS_DISTINCT_POINTS = prove_by_refinement +(`f continuous atreal r /\ g continuous atreal rr /\ ~ ((f:real -> real^N) r = g rr) +==> ? d. &0 < d /\ +(! x y. abs (x - r) < d /\ abs ( y - rr) < d ==> ~( f x = g y) )`, +[REWRITE_TAC[continuous_atreal]; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` dist ((f:real -> real^N) r, g (rr:real)) / &2`)); +FIRST_X_ASSUM (MP_TAC o (SPEC` dist ((f:real -> real^N) r, g (rr:real)) / &2`)); +SUBGOAL_THEN` &0 < dist ((f:real -> real^N) r,g (rr:real)) / &2 ` ASSUME_TAC; +ASM_REWRITE_TAC[REAL_ARITH` &0 < a / &2 <=> &0 < a `; GSYM DIST_NZ]; + +ANTS_TAC; +FIRST_ASSUM ACCEPT_TAC; + +STRIP_TAC; +ANTS_TAC; +FIRST_ASSUM ACCEPT_TAC; + +STRIP_TAC; +EXISTS_TAC` min d d' `; +ASM_REWRITE_TAC[REAL_LT_MIN]; +FIRST_X_ASSUM NHANH; +FIRST_X_ASSUM NHANH; +REPEAT STRIP_TAC; + +MP_TAC (SPECL [` (f:real -> real^N) r`; `(f:real -> real^N) x`; +`(g:real -> real^N) rr `] DIST_TRIANGLE); +MP_TAC (SPECL [` (f:real -> real^N) x`; `(g:real -> real^N) y`; +`(g:real -> real^N) rr `] DIST_TRIANGLE); +PHA; +NHANH (REAL_ARITH` a <= b + c /\ x <= y + a ==> x - y - c <= b `); +STRIP_TAC; + +SUBGOAL_THEN` &0 < dist ((f:real -> real^N) x,(g:real -> real^N) y)` MP_TAC; +DOWN; +MATCH_MP_TAC (REAL_ARITH` &0 < b ==> b <= a ==> &0 < a `); +MATCH_MP_TAC (REAL_ARITH` a < x / &2 /\ b < x / &2 ==> &0 < x - a - b `); +UNDISCH_TAC` dist ((f:real -> real^N) x,f (r:real)) < dist ((f:real -> + real^N) r,g (rr:real)) / &2`; +ASM_REWRITE_TAC[DIST_SYM]; + +ASM_REWRITE_TAC[GSYM DIST_NZ]]);; + + + + +let CONTINUOUS_TWO_POINTS_DISTINCT = +MESON[CONTINUOUS_FUNS_DISTINCT_POINTS] +` ff (v1:real^N) continuous atreal r /\ ff v2 continuous atreal r /\ +~(ff v1 r = ff v2 r ) ==> +? d. &0 < d /\ +(! t. abs ( t - r ) < d ==> ~( ff v1 t = ((ff v2 t ):real^M))) `;; + + + + + + +let CONTINUOUS_FUN_DISTINCT_FINITE_SET = prove_by_refinement +(`! V. FINITE (V:real^N -> bool) ==> +(! v1. v1 IN V /\ ~( v0 = v1) ==> ~ (ff v0 r = ff v1 r)) /\ +(! v. v IN v0 INSERT V ==> ff v continuous atreal r ) +==> ? d. &0 < d /\ +(! t. abs (t - r) < d ==> + (! v1. v1 IN V /\ ~(v0 = v1 ) ==> + ~( ff v0 t = ((ff v1 t):real^M))))`, +[MATCH_MP_TAC FINITE_INDUCT_STRONG; +REWRITE_TAC[NOT_IN_EMPTY]; + +CONJ_TAC; +DISCH_TAC; +EXISTS_TAC` &1 `; +REAL_ARITH_TAC; + +REPEAT STRIP_TAC; +UNDISCH_TAC` (!v1. (v1:real^N) IN V /\ ~(v0 = v1) ==> ~((ff v0 r):real^M = ff v1 r)) /\ + (!v. v IN v0 INSERT V ==> ff v continuous atreal r) + ==> (?d. &0 < d /\ + (!t. abs (t - r) < d + ==> (!v1. v1 IN V /\ ~(v0 = v1) ==> ~(ff v0 t = ff v1 t)))) `; +ANTS_TAC; +DOWN THEN DOWN THEN PHA; +SIMP_TAC[IN_INSERT]; +MESON_TAC[]; +STRIP_TAC; + +ASM_CASES_TAC` v0 = x:real^N `; +EXISTS_TAC` d:real `; +ASM_REWRITE_TAC[IN_INSERT]; +DOWN THEN DOWN THEN PHA; +MESON_TAC[]; +SUBGOAL_THEN` ff (v0:real^N) continuous atreal r /\ + ff x continuous atreal r /\ + ~(ff v0 r = (ff x r):real^M) ` MP_TAC; +DOWN_TAC; +REWRITE_TAC[IN_INSERT]; +MESON_TAC[]; + +NHANH CONTINUOUS_TWO_POINTS_DISTINCT; +STRIP_TAC; +EXISTS_TAC` min d d'`; +ASM_REWRITE_TAC[REAL_LT_MIN; IN_INSERT]; +ASM_MESON_TAC[]]);; + + + + + + + +let CONTINUOUS_ATREAL_INJ_PRESERVED = prove_by_refinement +(`! V. FINITE (V:real^N -> bool) ==> +(! v1 v2. v1 IN V /\ v2 IN V /\ ~( v1 = v2) ==> ~ (ff v1 r = ff v2 r)) /\ +(! v. v IN V ==> ff v continuous atreal r ) +==> ? d. &0 < d /\ +(! t. abs (t - r) < d ==> + (! v1 v2. v1 IN V /\ v2 IN V /\ ~(v1 = v2 ) ==> + ~( ff v1 t = ((ff v2 t):real^M))))`, +[MATCH_MP_TAC FINITE_INDUCT_STRONG; +REWRITE_TAC[NOT_IN_EMPTY]; +CONJ_TAC; +EXISTS_TAC` &1 `; +REAL_ARITH_TAC; + +REPEAT STRIP_TAC; +SUBGOAL_THEN` (!v1 v2. (v1:real^N) IN V /\ v2 IN V /\ ~(v1 = v2) ==> ~(ff v1 r = (ff v2 r):real^M)) /\ + (!v. v IN V ==> ff v continuous atreal r) ` MP_TAC; +DOWN THEN DOWN THEN PHA; +SIMP_TAC[IN_INSERT]; + +DISCH_TAC; +SUBGOAL_THEN` (?d. &0 < d /\ + (!t. abs (t - r) < d + ==> (!v1 v2. + v1 IN V /\ v2 IN V /\ ~(v1 = (v2:real^N)) + ==> ~(ff v1 t = (ff v2 t):real^M))))` MP_TAC; +DOWN; +FIRST_X_ASSUM ACCEPT_TAC; +STRIP_TAC; + +MP_TAC (SPEC_ALL ( +ISPECL [`r:real `;` x:real^N `] (GEN_ALL CONTINUOUS_FUN_DISTINCT_FINITE_SET))); +PHA; +ANTS_TAC; +UNDISCH_TAC `!(v1:real^N) v2. + v1 IN x INSERT V /\ v2 IN x INSERT V /\ ~(v1 = v2) + ==> ~(ff v1 (r:real) = (ff v2 r):real^M) `; +ASM_SIMP_TAC[IN_INSERT]; +STRIP_TAC; + +EXISTS_TAC` min d d' `; +REWRITE_TAC[REAL_LT_MIN]; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM NHANH; +DOWN; +FIRST_X_ASSUM NHANH; +SIMP_TAC[IN_INSERT]; +MESON_TAC[]]);; + + + + + + + +let CONTINUOUS_ATREAL_DISTINCT = prove_by_refinement +(`ff v continuous atreal r /\ ~((ff: real^N -> real -> real^M) v r = v0) + ==> (?d. &0 < d /\ (!t. abs (t - r) < d ==> ~(ff v t = v0)))`, +[REWRITE_TAC[continuous_atreal; DIST_NZ]; +IMP_TAC; +DISCH_THEN (NHANH_PAT`\x. x ==> y `); +STRIP_TAC; +EXISTS_TAC` d:real `; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM NHANH; +REPEAT STRIP_TAC; + +MP_TAC (ISPECL[` (ff:real^N -> real -> real^M ) v r `;` +(ff:real^N -> real -> real^M ) v t `; `v0:real^M `] DIST_TRIANGLE); +DOWN; +REWRITE_TAC[DIST_SYM]; +REAL_ARITH_TAC]);; + + + + + +let CONTINUOUS_ATREAL_DISTINCT_FINITE = prove_by_refinement +(`! V. FINITE (V:real^N -> bool) + ==> (!v1. v1 IN V ==> ~(ff v1 r = (v0:real^M))) /\ + (!v. v IN V ==> ff v continuous atreal r) + ==> (?d. &0 < d /\ + (!t. abs (t - r) < d + ==> (!v1. v1 IN V ==> ~(ff v1 t = v0))))`, +[MATCH_MP_TAC FINITE_INDUCT; +REWRITE_TAC[NOT_IN_EMPTY]; +CONJ_TAC; +EXISTS_TAC ` &1 `; +REAL_ARITH_TAC; +REPEAT STRIP_TAC; +UNDISCH_TAC ` (!v1. (v1:real^N) IN s ==> ~(ff v1 r = (v0:real^M))) /\ + (!v. v IN s ==> ff v continuous atreal r) + ==> (?d. &0 < d /\ + (!t. abs (t - r) < d ==> (!v1. v1 IN s ==> ~(ff v1 t = v0)))) `; +ANTS_TAC; +DOWN_TAC; +SIMP_TAC[IN_INSERT]; +STRIP_TAC; +MP_TAC (SPEC`x:real^N ` (GEN`v:real^N` CONTINUOUS_ATREAL_DISTINCT)); +ANTS_TAC; +DOWN_TAC; +SIMP_TAC[IN_INSERT]; +STRIP_TAC; +EXISTS_TAC` min d d' `; +ASM_REWRITE_TAC[REAL_LT_MIN]; +FIRST_X_ASSUM NHANH; +DOWN; +FIRST_X_ASSUM NHANH; +SIMP_TAC[IN_INSERT]; +MESON_TAC[]]);; + + + + + + +let REAL_CONTINUOUS_SUM_FUNS = prove_by_refinement +(` f real_continuous at x /\ g real_continuous at x +==> (\x. f x + g x) real_continuous at x `, +[REWRITE_TAC[real_continuous_at]; +STRIP_TAC; +STRIP_TAC; +PAT_ONCE_REWRITE_TAC`\x. x ==> y `[REAL_ARITH` &0 < a <=> &0 < a / &2 `]; +FIRST_X_ASSUM (NHANH_PAT`\x. x ==> y `); +FIRST_X_ASSUM (NHANH_PAT`\x. x /\ z ==> y `); +STRIP_TAC; +EXISTS_TAC` min d d' `; +ASM_REWRITE_TAC[REAL_LT_MIN]; +FIRST_X_ASSUM NHANH; +DOWN; +FIRST_X_ASSUM NHANH; +STRIP_TAC THEN GEN_TAC; +REAL_ARITH_TAC]);; + + +let REAL_CON_IMP_OPP_FUN_TOO = prove_by_refinement( +` f real_continuous at (x:real^N) ==> (\x. -- f x) real_continuous at x`, +[REWRITE_TAC[real_continuous_at]; +REPEAT STRIP_TAC; +SUBGOAL_THEN` (?d. &0 < d /\ (!x'. dist (x',(x:real^N)) < d ==> abs (f x' - f x) < e))` MP_TAC; +DOWN; ASM_REWRITE_TAC[]; STRIP_TAC; EXISTS_TAC` d:real `; +ASM_REWRITE_TAC[REAL_ARITH` -- x - -- y = -- (x - y ) `; REAL_ABS_NEG]]);; + + +let REAL_CONTINUOUS_SUB_FUNS = prove( +` f real_continuous at (x:real^N) /\ +g real_continuous at x ==> +(\x. f x - g x) real_continuous at x `, +STRIP_TAC THEN DOWN THEN NHANH_PAT`\x. x ==> y ` REAL_CON_IMP_OPP_FUN_TOO THEN +STRIP_TAC THEN REWRITE_TAC[REAL_ARITH` a - b = a + -- b `] THEN +MATCH_MP_TAC REAL_CONTINUOUS_SUM_FUNS THEN ASM_REWRITE_TAC[]);; + + + + + +let INV_VNI = prove(` inv x = &1 / x `, +PAT_ONCE_REWRITE_TAC `\x. inv x = y` [REAL_ARITH` x = x / &1 `] +THEN REWRITE_TAC[REAL_INV_DIV]);; + + + + + +let INV_INEQUAL_GENERAL = prove( +` &0 < e /\ &0 < x /\ x < y ==> e / y < e / x `, +NHANH REAL_LT_INV2 THEN ONCE_REWRITE_TAC[REAL_ARITH` a / b = a * ( &1 / b ) `] +THEN REWRITE_TAC[INV_VNI] THEN STRIP_TAC THEN MATCH_MP_TAC REAL_LT_LMUL THEN +ASM_REWRITE_TAC[]);; + + + + + +let REAL_CONTINUOUS_IMP_MUL_FUN = prove_by_refinement +(` f real_continuous at (x:real^N) /\ +g real_continuous at x ==> +(\x. (f x) * (g x)) real_continuous at x `, +[REWRITE_TAC[real_continuous_at]; +REPEAT STRIP_TAC; +ONCE_REWRITE_TAC[REAL_RING` a * b - x * y = (a - x ) * b + (b - y) * x`]; + + + + + + +FIRST_X_ASSUM (MP_TAC o (SPEC` e / (&2 * max (abs (f (x:real^N))) (&1))`)); +ANTS_TAC; +MATCH_MP_TAC REAL_LT_DIV; +ASM_REWRITE_TAC[REAL_LT_MAX; REAL_ARITH` &0 < &2 * z <=> &0 < z `]; +REAL_ARITH_TAC; +STRIP_TAC; + +FIRST_X_ASSUM (MP_TAC o (SPEC` e / (&2 * (abs (g (x:real^N)) + e / (&2 * max (abs (f (x:real^N))) (&1))) )`)); +ANTS_TAC; +MATCH_MP_TAC REAL_LT_DIV; +ASM_REWRITE_TAC[REAL_LT_MAX; REAL_ARITH` &0 < &2 * z <=> &0 < z `]; +MATCH_MP_TAC (REAL_ARITH` &0 < x ==> &0 < abs a + x `); +MATCH_MP_TAC REAL_LT_DIV; +ASM_REWRITE_TAC[REAL_LT_MAX; REAL_ARITH` &0 < &2 * z <=> &0 < z `]; +REAL_ARITH_TAC; + + + +STRIP_TAC; +EXISTS_TAC `min d d'`; +ASM_REWRITE_TAC[REAL_LT_MIN]; +GEN_TAC; +FIRST_X_ASSUM NHANH; +FIRST_X_ASSUM NHANH; +STRIP_TAC; +SUBGOAL_THEN` abs (g (x':real^N)) < abs (g x) + e / (&2 * max (abs (f (x:real^N))) (&1))` MP_TAC; +ASM_REAL_ARITH_TAC; +ASM_CASES_TAC` f (x:real^N) = &0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN; +SIMP_TAC[REAL_MUL_RZERO; REAL_ADD_RID; REAL_SUB_RZERO]; +UNDISCH_TAC` &0 < e `; +REWRITE_TAC[REAL_ABS_MUL]; +REPEAT STRIP_TAC; +SUBGOAL_THEN` abs (f (x':real^N)) * abs (g (x':real^N)) < ( e / (&2 * (abs (g x) + e / (&2 * max (abs (&0)) (&1))))) * (abs (g x) + e / (&2 * max (abs (&0)) (&1)))` MP_TAC; + +MATCH_MP_TAC REAL_LT_MUL2; +ASM_REWRITE_TAC[REAL_ABS_POS; REAL_ABS_0; real_max; REAL_ARITH` &0 <= &1 `; REAL_MUL_RID]; +ASSUME_TAC2 (REAL_ARITH` &0 < e ==> &0 < abs (g (x:real^N)) + e / &2`); +DOWN; +UNDISCH_TAC` &0 < e `; +SIMP_TAC[REAL_FIELD` &0 < a ==> e / (&2 * a) * a = e / &2 `; REAL_ABS_0; real_max; REAL_ARITH` &0 <= &1 `; REAL_MUL_RID]; + +REAL_ARITH_TAC; + +STRIP_TAC; +MATCH_MP_TAC (REAL_ARITH` abs a + abs b < e ==> abs ( a + b ) < e `); +REWRITE_TAC[REAL_ABS_MUL]; +MATCH_MP_TAC (REAL_ARITH` a < e / &2 /\ b < e / &2 ==> a + b < e `); +CONJ_TAC; +SUBGOAL_THEN` abs (f x' - f (x:real^N)) * abs (g x') < ( e / (&2 * (abs (g x) + +e / (&2 * max (abs (f x)) (&1))))) * (abs (g x) + e / (&2 * max (abs (f x)) (&1)))` MP_TAC; +MATCH_MP_TAC REAL_LT_MUL2; +ASM_REWRITE_TAC[REAL_ABS_POS]; +SUBGOAL_THEN` &0 < abs (g (x:real^N)) + e / (&2 * max (abs (f x)) (&1))` MP_TAC; +MATCH_MP_TAC (REAL_ARITH` &0 < b ==> &0 < abs a + b `); +MATCH_MP_TAC REAL_LT_DIV; +ASM_REWRITE_TAC[]; +REAL_ARITH_TAC; + +SIMP_TAC[REAL_FIELD` &0 < a ==> e / ( &2 * a ) * a = e / &2 `]; +ASM_CASES_TAC` max (abs (f x)) (&1) = abs (f (x:real^N)) `; + + + + +UNDISCH_TAC` ~( f (x:real^N) = &0) `; +REWRITE_TAC[REAL_ABS_NZ]; +UNDISCH_TAC` abs (g x' - g (x:real^N)) < e / (&2 * max (abs (f (x:real^N))) (&1))`; +PHA; +NHANH REAL_LT_RMUL; +ASM_REWRITE_TAC[]; +IMP_TAC; +SIMP_TAC[REAL_FIELD` &0 < a ==> x / (&2 * a ) * a = x / &2 `]; + + + + + +SUBGOAL_THEN` e / &2 / max (abs (f x)) (&1) < e / &2 / abs (f (x:real^N))` MP_TAC; +MATCH_MP_TAC INV_INEQUAL_GENERAL; +ASM_REWRITE_TAC[REAL_ARITH`&0 < a / &2 <=> &0 < a `; GSYM REAL_ABS_NZ]; +DOWN; +REAL_ARITH_TAC; +UNDISCH_TAC` abs (g x' - g (x:real^N)) < e / (&2 * max (abs (f (x:real^N))) (&1))`; +PHA; +REWRITE_TAC[REAL_FIELD` a / &2 / c = a / ( &2 * c ) `]; +NHANH (REAL_ARITH` a < b /\ b < c ==> a < c `); +STRIP_TAC; +UNDISCH_TAC` ~( f (x:real^N) = &0)`; +REWRITE_TAC[REAL_ABS_NZ]; +DOWN THEN PHA; +NHANH REAL_LT_RMUL; +IMP_TAC; +SIMP_TAC[REAL_FIELD` &0 < a ==> e / (&2 * a ) * a = e / &2 `]]);; + + + + + + + +(* tch 2013/07/27. renamed variables t0 -> t in CON_ATREAL_REAL_CON CON_ATREAL_REAL_CON2 + to avoid clash with constant t0 in Geomdetail. *) + +let CON_ATREAL_REAL_CON = prove(`! f (v0:real^N). f continuous atreal t ==> + (\t. dist ( f t, v0)) real_continuous atreal t `, +REWRITE_TAC[continuous_atreal; real_continuous_atreal] THEN +REPEAT STRIP_TAC THEN DOWN THEN +FIRST_X_ASSUM (NHANH_PAT `\x. x ==> y `) THEN STRIP_TAC THEN +EXISTS_TAC` d:real` THEN ASM_REWRITE_TAC[] THEN +FIRST_X_ASSUM NHANH THEN STRIP_TAC THEN CONV_TAC NORM_ARITH);; + + + +let CON_ATREAL_REAL_CON2 = prove( +`! f (v0:real^N). f continuous atreal t /\ g continuous atreal t ==> + (\t. dist ( f t, g t)) real_continuous atreal t `, +REWRITE_TAC[continuous_atreal; real_continuous_atreal] THEN +REPEAT STRIP_TAC THEN DOWN THEN +PAT_ONCE_REWRITE_TAC`\x. x ==> y `[REAL_ARITH` &0 < a <=> &0 < a / &2 `] THEN +REPEAT (FIRST_X_ASSUM (NHANH_PAT `\x. x ==> y `)) THEN +STRIP_TAC THEN EXISTS_TAC `min d d'` THEN ASM_REWRITE_TAC[REAL_LT_MIN] THEN +REPEAT (FIRST_X_ASSUM NHANH) THEN STRIP_TAC THEN CONV_TAC NORM_ARITH);; + + + +(* ============================================================== *) + + + + + + + + + + + + + + +let SET2_HAS_SIZE2 = prove_by_refinement (` {(a: A),b} HAS_SIZE 2 <=> ~( a = b) `, +[REWRITE_TAC[HAS_SIZE_2_EXISTS; IN_INSERT; NOT_IN_EMPTY]; +(* !s. s HAS_SIZE 2 <=> + (?x y. ~(x = y) /\ (!z. z IN s <=> z = x \/ z = y))) *) +EQ_TAC; STRIP_TAC; DOWN_TAC; MESON_TAC[]; STRIP_TAC; +EXISTS_TAC` a: A`; EXISTS_TAC` b:A`; ASM_REWRITE_TAC[]]);; + + + + + + + + + + + +let DIJ_AFF_GE_PARTITION = prove_by_refinement (` DISJOINT {u,v} {w} ==> +aff_ge {u,v} {w} = aff {u,v} UNION aff_gt {u, v} {w} `, +[SIMP_TAC[Fan.AFF_GE_2_1; AFF2; AFF_GT_2_1]; +STRIP_TAC; +REWRITE_TAC[FUN_EQ_THM; IN_ELIM_THM; REWRITE_RULE[IN] IN_UNION]; +STRIP_TAC; +EQ_TAC; +STRIP_TAC; +ASM_CASES_TAC` t3 = &0 `; +DISJ1_TAC; +EXISTS_TAC `t1: real `; +ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID]; +UNDISCH_TAC` t1 + t2 + t3 = &1 `; +ASM_SIMP_TAC[REAL_ADD_RID; REAL_ARITH` a + b = &1 <=> b = &1 - a `]; +DISJ2_TAC; +ASM_MESON_TAC[REAL_ARITH` &0 <= a /\ ~( a = &0) ==> &0 < a `]; + +STRIP_TAC; +EXISTS_TAC` t: real `; +EXISTS_TAC` &1 - t `; +EXISTS_TAC` &0 `; +ASM_REWRITE_TAC[REAL_LE_REFL; VECTOR_MUL_LZERO; VECTOR_ADD_RID]; +REAL_ARITH_TAC; +ASM_MESON_TAC[REAL_LT_IMP_LE]]);; + + + + + + + +let AFF_GE_WEDGE_DISJOINTION = prove_by_refinement ( +` aff_ge {v0, v1} {w1} INTER wedge v0 v1 w1 w2 = {} /\ +aff_ge {v0, v1} {w2} INTER wedge v0 v1 w1 w2 = {}`, +[ASM_CASES_TAC` collinear {v0, v1, w1:real^3} `; +ASM_SIMP_TAC[WEDGE_DEGENERATE; INTER_EMPTY]; + +REWRITE_TAC[wedge]; +CONJ_TAC; +DOWN; +ASM_SIMP_TAC[Local_lemmas.INTER_EQ_EM_EXPAND; GSYM Local_lemmas.AZIM_EQ_0_GE_ALT2]; +REWRITE_TAC[IN_ELIM_THM]; +REPEAT STRIP_TAC; +DOWN THEN DOWN; +ASM_REWRITE_TAC[]; +REAL_ARITH_TAC; + +ASM_CASES_TAC` collinear {v0, v1, w2:real^3 } `; +ASM_SIMP_TAC[AZIM_DEGENERATE; Local_lemmas.INTER_EQ_EM_EXPAND; IN_ELIM_THM]; +REWRITE_TAC[REAL_ARITH` ~( a < x /\ x < a )`]; + +DOWN; +NHANH Fan.th3a; +NHANH DIJ_AFF_GE_PARTITION; +SIMP_TAC[IN_UNION; Local_lemmas.INTER_EQ_EM_EXPAND; IN_ELIM_THM]; +NHANH (REWRITE_RULE[CONTRAPOS_THM] Fan.th3c); +REPEAT STRIP_TAC; +DOWN THEN DOWN; +ASM_SIMP_TAC[AZIM_DEGENERATE]; +REAL_ARITH_TAC; +ASSUME_TAC2 (SPECL [`v0:real^3 `;` v1:real^3`;` w1: real^3 `;`x:real^3 `;` w2: real^3 `]AZIM_EQ_ALT); +ASM_MESON_TAC[REAL_ARITH` ~( a < a ) `]]);; + + + + + + + + +let HAS_SIZE_2_EXISTS2 = prove( +` S HAS_SIZE 2 <=> ? x y. ~( x = y) /\ S = {x,y} `, +REWRITE_TAC[HAS_SIZE_2_EXISTS] THEN SET_TAC[]);; + + + + + + +let FAN_E_SUB_V = prove( +` FAN (vec 0, V, E) /\ {x,y} IN E ==> x IN V /\ y IN V `, +REWRITE_TAC[FAN; UNIONS_SUBSET; SUBSET] THEN STRIP_TAC THEN +DOWN THEN FIRST_ASSUM NHANH THEN SIMP_TAC[IN_INSERT]);; + + +let LOCAL_E_SUB_V = prove( +` local_fan (V,E,FF) /\ {x,y} IN E ==> x IN V /\ y IN V `, +REWRITE_TAC[local_fan] THEN LET_TAC THEN MESON_TAC[FAN_E_SUB_V]);; + + + + + +let EDGE_NOT_INTER_WITH_WEDGE += prove(` aff {v0, v1} INTER wedge v0 v1 w1 w2 = {} `, +REWRITE_TAC[wedge; Local_lemmas.INTER_EQ_EM_EXPAND; IN_ELIM_THM] +THEN NHANH Fan.th3c THEN MESON_TAC[]);; + + + + + + +let AFF_GE11_SUB_AFF2 = prove(` aff_ge {v0} {v1} SUBSET aff {v0, v1} `, +REWRITE_TAC[HALFLINE; AFF2; SUBSET; IN_ELIM_THM] THEN +REPEAT STRIP_TAC THEN EXISTS_TAC` &1 - t ` THEN +ASM_REWRITE_TAC[REAL_ARITH` a - (a - b) = b `]);; + + + + + + +let PROVE_SLICING_FAN = prove_by_refinement +(`local_fan (V,E,FF) /\ +v IN V /\ w IN V /\ ~( v = w) /\ +(! z t. z IN {v, w} /\ t IN (V DIFF {z}) ==> ~ collinear {vec 0, z, t}) /\ +(! x. x IN FF ==> aff_gt {vec 0} {v,w} SUBSET wedge_in_fan_gt x E) +==> FAN (vec 0, V, E UNION {{v,w}}) `, +[REWRITE_TAC[FAN; local_fan; UNIONS_UNION; UNIONS_1; UNION_SUBSET]; +LET_TAC; +SIMP_TAC[INSERT_SUBSET; EMPTY_SUBSET; graph; SET_RULE` (A UNION B) x <=> +A x \/ B x `; MESON[]`(!x. P x \/ Q x ==> L x) <=> (! x. P x ==> L x ) /\ +(! x. Q x ==> L x )`]; + +SIMP_TAC[SET2_HAS_SIZE2; Geomdetail.IN_ACT_SING]; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[SET2_HAS_SIZE2; fan1; fan2; fan6; fan7; IN_UNION; MESON[]` +(!x. P x \/ Q x ==> L x) <=> (! x. P x ==> L x) /\ (!x. Q x ==> L x) `; Geomdetail.IN_ACT_SING]; +STRIP_TAC; +CONJ_TAC; +GEN_TAC; +SIMP_TAC[Local_lemmas.INSERT_UNION2; UNION_EMPTY]; + +STRIP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[IN_INSERT; IN_DIFF; NOT_IN_EMPTY]; + +ONCE_REWRITE_TAC[TAUT` (a \/ b) \/ c <=> b \/ a \/ c `]; +ONCE_REWRITE_TAC[TAUT` (a \/ b) /\ (x \/ y) ==> l <=> ( a /\ x ==> l) /\ +( a /\ y ==> l ) /\ ( b /\ x ==> l) /\ (b /\ y ==> l) `]; +ASM_SIMP_TAC[INTER_IDEMPOT]; + +MATCH_MP_TAC ( +MESON[]` (! e1 e2. L e1 e2 ==> L e2 e1) /\ (! e1 e2. e1 = x /\ Q e2 ==> L x e2) +==> (! e1 e2. (e1 = x /\ Q e2 ==> L x e2) /\ (Q e1 /\ e2 = x ==> L e1 x))`); +SIMP_TAC[INTER_COMM]; + + +REPEAT STRIP_TAC; +SUBGOAL_THEN` (e2: real^3 -> bool) HAS_SIZE 2` ASSUME_TAC; +DOWN; +ASM_REWRITE_TAC[IN]; + +DOWN; +REWRITE_TAC[HAS_SIZE_2_EXISTS2]; +STRIP_TAC; + +SUBGOAL_THEN` (x':real^3, y:real^3) IN FF \/ (y,x') IN FF ` MP_TAC; +MATCH_MP_TAC Local_lemmas.LOFA_IN_E_IMP_IN_FF; +ASM_REWRITE_TAC[local_fan]; +LET_TAC; +ASM_REWRITE_TAC[FAN; graph; fan1; fan6; fan7; fan2; IN_UNION]; +CONJ_TAC; +EXISTS_TAC` x:real^3 # real^3 `; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +FIRST_ASSUM ACCEPT_TAC; + +ASM_REWRITE_TAC[]; + +DOWN THEN DOWN THEN PHA; +SPEC_TAC (`x':real^3 `,` x': real^3 `); +SPEC_TAC (`y:real^3 `,` y: real^3 `); +REWRITE_TAC[TAUT` a /\ b /\ c <=> (a/\b) /\ c `]; +MATCH_MP_TAC (MESON[]`(! x y. Q x y ==> Q y x) /\ +(! x y. Q x y /\ P x y ==> L x y ) /\ (! x y. L x y ==> L y x) +==> (! (x:real^3) (y:real^3). Q x y /\ (P x y \/ P y x) ==> L x y )`); +SIMP_TAC[INSERT_COMM]; +REPEAT STRIP_TAC; + +SUBGOAL_THEN `~collinear {vec 0, v, w:real^3}` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[IN_INSERT; IN_DIFF; DE_MORGAN_THM; NOT_IN_EMPTY]; +DOWN; +NHANH Planarity.aff_ge_eq_aff_gt_union_aff_ge; +SIMP_TAC[UNION_OVER_INTER]; +STRIP_TAC; + +UNDISCH_TAC `y':real^3, y:real^3 IN FF `; +FIRST_ASSUM NHANH; +REWRITE_TAC[wedge_in_fan_gt]; + +SUBGOAL_THEN` local_fan (V,E,FF)` MP_TAC; +ASM_REWRITE_TAC[IN_UNION; local_fan; FAN; fan1; fan2; fan6; fan7; graph]; +LET_TAC; +ASM_REWRITE_TAC[]; +EXISTS_TAC` x:real^3 # real^3 `; +ASM_REWRITE_TAC[]; +STRIP_TAC; +STRIP_TAC; +ASSUME_TAC2 (SPEC`y': real^3 ` (GEN `x:real^3 ` + Local_lemmas.LOCAL_FAN_IMP_IN_V)); + +SUBGOAL_THEN` CARD (EE (y':real^3) E) = 2 ` ASSUME_TAC; +MATCH_MP_TAC Local_lemmas.LOFA_CARD_EE_V_1; +ASM_SIMP_TAC[]; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN THEN DOWN THEN PHA; +REWRITE_TAC[ARITH_RULE` 2 > 1 `]; + +STRIP_TAC; +MP_TAC (REWRITE_RULE[EMPTY_SUBSET; INSERT_SUBSET; IN_INSERT] +(ISPECL [` {y':real^3} `;` {vec 0, y':real^3}`; `{y:real^3 }`] +(GEN_ALL Local_lemmas.AFF_GE_MONO_TRANS))); +SUBGOAL_THEN` ~ (y':real^3 = vec 0 )` MP_TAC; +UNDISCH_TAC` y':real^3 IN V `; +UNDISCH_TAC` ~( vec 0 IN (V:real^3 -> bool)) `; +MESON_TAC[]; + +SIMP_TAC[SET_RULE` ~( y' = vec 0) ==> {vec 0, y'} DIFF {y'} = {vec 0} `]; +REWRITE_TAC[Local_lemmas.INSERT_UNION2; UNION_EMPTY]; +REPEAT STRIP_TAC; + +MP_TAC (SPECL [` vec 0:real^3 `;` y':real^3`;` y:real^3 `; +` (azim_cycle (EE y' E) (vec 0) y' y) `] (GEN_ALL AFF_GE_WEDGE_DISJOINTION)); +STRIP_TAC; +SUBGOAL_THEN` aff_ge {vec 0} {y:real^3, y'} INTER aff_gt {vec 0} {v, w} = {} ` MP_TAC; +REPLICATE_TAC 3 DOWN THEN PHA; +SET_TAC[]; + +SIMP_TAC[UNION_EMPTY]; +STRIP_TAC; + + +UNDISCH_TAC` !e1 e2. + (e1 IN E \/ e1 IN {{v:real^3} | v IN V}) /\ + (e2 IN E \/ e2 IN {{v} | v IN V}) + ==> aff_ge {vec 0} e1 INTER aff_ge {vec 0} e2 = + aff_ge {vec 0} (e1 INTER e2) `; +STRIP_TAC; +SUBGOAL_THEN` ({y, y'} IN E \/ {y, y'} IN {{v:real^3} | v IN V}) /\ + ({v} IN E \/ {v} IN {{v} | v IN V})` MP_TAC; +UNDISCH_TAC` (e2:real^3 -> bool) IN E `; +ASM_SIMP_TAC[IN_ELIM_THM]; + +STRIP_TAC; +DISJ2_TAC; +EXISTS_TAC` v:real^3 `; +ASM_REWRITE_TAC[]; +FIRST_ASSUM NHANH; +SIMP_TAC[]; + +REMOVE_TAC; +SUBGOAL_THEN` ({y, y'} IN E \/ {y, y'} IN {{v:real^3} | v IN V}) /\ + ({w} IN E \/ {w} IN {{v} | v IN V})` MP_TAC; +UNDISCH_TAC` (e2:real^3 -> bool) IN E `; +ASM_SIMP_TAC[IN_ELIM_THM]; +STRIP_TAC; +DISJ2_TAC; +EXISTS_TAC` w:real^3 `; +ASM_REWRITE_TAC[]; +FIRST_ASSUM NHANH; +SIMP_TAC[]; +REMOVE_TAC; + +ASM_CASES_TAC` {y, y'} INTER {v, w:real^3} = {} `; +DOWN; +NHANH (SET_RULE` S INTER {a,b} = {} ==> S INTER {a} = {} /\ S INTER {b} = {}`); + +SIMP_TAC[UNION_IDEMPOT]; + + + + +ASM_CASES_TAC` {y, y': real^3} INTER {v} = {} \/ +{y, y': real^3} INTER {w} = {}`; +DOWN THEN DOWN; +SPEC_TAC (`w:real^3 `,` w:real^ 3 `); +SPEC_TAC (`v:real^3 `,` v:real^ 3 `); +MATCH_MP_TAC (MESON[]` (! x y. A x y ==> A y x) /\ +(! x y. B x y ==> B y x ) /\ +(! x y. A x y ==> M x ==> B x y) +==> (! x y. A x y ==> M x \/ M y ==> B x y ) `); + +SIMP_TAC[INSERT_COMM; UNION_COMM]; + +PHA; +NHANH (SET_RULE` ~({y, y'} INTER {v, w} = {}) /\ {y, y'} INTER {v} = {} +==> {y, y'} INTER {v, w} = {w} /\ {y, y'} INTER {w} = {w}`); +SIMP_TAC[]; +REPEAT STRIP_TAC; +REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING]; +MATCH_MP_TAC (SET_RULE` x IN S ==> {x} UNION S = S `); +REWRITE_TAC[IN_ELIM_THM; HALFLINE]; +EXISTS_TAC ` &0 `; +REWRITE_TAC[REAL_LE_REFL]; +VECTOR_ARITH_TAC; + +DOWN THEN DOWN THEN PHA; +UNDISCH_TAC` ~ ( w = v:real^3)`; +PHA; + +NHANH (SET_RULE `~(w = v) /\ + ~({y, y'} INTER {v, w} = {}) /\ + ~({y, y'} INTER {v} = {} \/ {y, y'} INTER {w} = {}) +==> {y,y'} = {v, w} `); +STRIP_TAC; +UNDISCH_TAC` aff_ge {vec 0} {y, y'} INTER aff_gt {vec 0} {v:real^3, w} = {}`; +ASM_REWRITE_TAC[]; +NHANH (SET_RULE` (A UNION B) INTER A = {} ==> A = {} `); + +SUBGOAL_THEN` DISJOINT {vec 0} {v, w:real^3 }` MP_TAC; +UNDISCH_TAC` ~( vec 0 IN (V:real^3 -> bool)) `; +UNDISCH_TAC` (v:real^3) IN V `; +UNDISCH_TAC` (w:real^3) IN V `; +REWRITE_TAC[DISJOINT; Trigonometry2.INSERT_INTER_EMPTY; IN_INSERT; NOT_IN_EMPTY]; +MESON_TAC[]; + +NHANH Planarity.AFF_GT_1_2; +SIMP_TAC[]; +REPEAT STRIP_TAC; +DOWN; +REWRITE_TAC[EXTENSION; IN_ELIM_THM; NOT_IN_EMPTY]; +DISCH_THEN (MP_TAC o (SPEC` (&1 / &2) % v + (&1 / &2 ) % (w:real^3)`)); +REWRITE_TAC[NOT_EXISTS_THM]; +DISCH_THEN (MP_TAC o (SPECL [` &0 `;` &1 / &2`;` &1 / &2 `])); +REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID; REAL_ARITH` &0 < &1 / &2 /\ +&0 + &1 / &2 + &1 / &2 = &1`]; + + + + + + + + + +DOWN; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +SUBGOAL_THEN` local_fan (V,E, FF) ` MP_TAC; +ASM_REWRITE_TAC[local_fan; FAN; fan1; fan2; fan6; fan7; graph]; +LET_TAC; +ASM_REWRITE_TAC[IN_UNION]; +EXISTS_TAC` x: real^3 # real^3 `; +ASM_REWRITE_TAC[]; +NHANH Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2; +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC`v': real^3`)); +UNDISCH_TAC` !x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E`; +DISCH_THEN (ASSUME_TAC2 o (SPEC `v',rho_node1 FF v' `)); + +SUBGOAL_THEN` ~((v:real^3 ) = vec 0)/\ ~( (w:real^3) = vec 0) ` MP_TAC; +UNDISCH_TAC` v:real^3 IN V `; +UNDISCH_TAC` w:real^3 IN V `; +UNDISCH_TAC` ~( vec 0 IN (V:real^3 -> bool)) `; +MESON_TAC[]; +NHANH Wrgcvdr_cizmrrh.AFF_GE_TO_AFF_GT2_GE1; + +DOWN; +REWRITE_TAC[wedge_in_fan_gt]; + +ASSUME_TAC2 ( +SPEC` v':real^3 ` (GEN `v:real^3 ` Local_lemmas.LOFA_CARD_EE_V_1)); +ASM_REWRITE_TAC[ARITH_RULE` 2 > 1 `]; + +MP_TAC (SPECL [` vec 0: real^3 `;` v': real^3 `; ` rho_node1 FF v' `; +`(azim_cycle (EE v' E) (vec 0) v' (rho_node1 FF v')) `] +(GEN_ALL EDGE_NOT_INTER_WITH_WEDGE)); +MP_TAC (ISPECL [` vec 0:real^3 `;` v':real^3`] (GEN_ALL AFF_GE11_SUB_AFF2)); +PHA; +NHANH (SET_RULE` a SUBSET B /\ B INTER S = {} /\ l ==> a INTER S = {} `); +STRIP_TAC; +ASM_REWRITE_TAC[UNION_OVER_INTER]; + +SUBGOAL_THEN` aff_ge {vec 0} {v'} INTER aff_gt {vec 0} {v, w:real^3} = {}` ASSUME_TAC; +DOWN; +MATCH_MP_TAC (SET_RULE` a SUBSET b ==> x INTER b = {} ==> x INTER a = {} `); +FIRST_X_ASSUM ACCEPT_TAC; +ASM_REWRITE_TAC[UNION_EMPTY]; + +UNDISCH_TAC` !e1 e2. + (e1 IN E \/ e1 IN {{v:real^3} | v IN V}) /\ + (e2 IN E \/ e2 IN {{v} | v IN V}) + ==> aff_ge {vec 0} e1 INTER aff_ge {vec 0} e2 = + aff_ge {vec 0} (e1 INTER e2)`; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPECL [` {v':real^3} `;` {v:real^3}`])); +ANTS_TAC; +ASM_REWRITE_TAC[IN_ELIM_THM]; +UNDISCH_TAC` v:real^3 IN V `; +UNDISCH_TAC` v':real^3 IN V `; +MESON_TAC[]; + + +FIRST_ASSUM (MP_TAC o (SPECL [` {v':real^3} `;` {w:real^3}`])); +ANTS_TAC; +ASM_REWRITE_TAC[IN_ELIM_THM]; +UNDISCH_TAC` w:real^3 IN V `; +UNDISCH_TAC` v':real^3 IN V `; +MESON_TAC[]; + +SIMP_TAC[]; +REPEAT STRIP_TAC; + +ASM_CASES_TAC` {v'} INTER {v, w} = {v':real^3} `; +DOWN; +SIMP_TAC[]; +UNDISCH_TAC` ~( w = (v:real^3) )`; +PHA; +NHANH (SET_RULE`{v'} INTER {v, w} = {v'} +==> v = v' \/ w = v' `); +NHANH (SET_RULE` ~( a = b ) ==> {a} INTER {b} = {} `); +STRIP_TAC; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN THEN DOWN THEN PHA; +SIMP_TAC[INTER_IDEMPOT; INTER_COMM; AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING]; +STRIP_TAC; + +MP_TAC (ISPECL [` {vec 0:real^3 }`;` {v': real^3 }`] + AFFINE_HULL_SUBSET_AFF_GE); +ANTS_TAC; +UNDISCH_TAC` ~((v':real^3) = vec 0) `; +REWRITE_TAC[DISJOINT]; +SET_TAC[]; + +REWRITE_TAC[AFFINE_HULL_SING]; +SET_TAC[]; + + +FIRST_X_ASSUM SUBST_ALL_TAC; +ASM_REWRITE_TAC[]; +DOWN THEN DOWN THEN PHA; +SIMP_TAC[INTER_IDEMPOT; INTER_COMM; AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING]; + + +MP_TAC (ISPECL [` {vec 0:real^3 }`;` {v': real^3 }`] + AFFINE_HULL_SUBSET_AFF_GE); +ANTS_TAC; +UNDISCH_TAC` ~((v':real^3) = vec 0) `; +REWRITE_TAC[DISJOINT]; +SET_TAC[]; +REWRITE_TAC[AFFINE_HULL_SING]; +SET_TAC[]; + + +DOWN; +NHANH (SET_RULE` ~({v'} INTER {v, w} = {v'}) +==> {v'} INTER {v} = {} /\ {v'} INTER {w} = {} /\ {v, w} INTER {v'} = {}`); +SIMP_TAC[UNION_IDEMPOT; INTER_COMM]]);; + + + + + + + + +let FACE_MAP_ADD_SET2_EQ = prove_by_refinement +(` (x,y) IN darts_of_hyp ( E UNION {{a,b}}) V /\ +~( y = a) /\ ~ ( y = b ) /\ +FAN (vec 0, V, E) /\ +FAN (vec 0, V, E UNION {{a,b}} ) +==> (face_map (hypermap ( HYP (vec 0, V, (E UNION {{a,b}}))))) (x,y) = +(face_map (hypermap (HYP (vec 0, V, E)))) (x,y) `, +[NHANH Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP; +SIMP_TAC[]; +STRIP_TAC; + +SUBGOAL_THEN` (x,y) IN darts_of_hyp ( E UNION {{a,b:real^3}}) V ` MP_TAC; +ASM_REWRITE_TAC[]; +REWRITE_TAC[darts_of_hyp; IN_UNION]; +DISCH_TAC; +SUBGOAL_THEN` (x,y) IN darts_of_hyp E (V:real^3 -> bool) ` MP_TAC; +REWRITE_TAC[darts_of_hyp; IN_UNION]; +DOWN THEN STRIP_TAC; +DISJ1_TAC; +DOWN; +REWRITE_TAC[ord_pairs; IN_ELIM_THM; IN_UNION]; +STRIP_TAC; +EXISTS_TAC` a': real^3 `; +EXISTS_TAC` b': real^3 `; +ASM_REWRITE_TAC[]; + + +DOWN THEN DOWN; +REWRITE_TAC[IN_SING; PAIR_EQ; Collect_geom.PAIR_EQ_EXPAND]; +REPEAT STRIP_TAC; +UNDISCH_TAC` ~( y = b:real^3 ) `; +ASM_REWRITE_TAC[]; + +UNDISCH_TAC` ~( y = a:real^3) `; +ASM_REWRITE_TAC[]; +DOWN; +REWRITE_TAC[self_pairs; IN_ELIM_THM]; +STRIP_TAC; +DISJ2_TAC; +EXISTS_TAC` v:real^3 `; +ASM_REWRITE_TAC[]; +DOWN THEN DOWN; +SIMP_TAC[EE; IN_UNION]; +SET_TAC[]; + + +ASM_SIMP_TAC[ff_of_hyp]; +SUBGOAL_THEN` (EE y (E UNION {{a, b}})) = (EE (y:real^3) E)` SUBST1_TAC; +REWRITE_TAC[EE; EXTENSION; IN_ELIM_THM; IN_UNION]; +GEN_TAC; +MATCH_MP_TAC (TAUT` (a ==> b) ==> ( b \/ a <=> b )`); +REWRITE_TAC[IN_SING; Collect_geom.PAIR_EQ_EXPAND]; +ASM_REWRITE_TAC[]; + +PHA]);; + + +(* ========================================================== *) +(* ========================================================== *) + + + + + +let LOCAL_FACE_MAP_RHO_NODE1 = prove_by_refinement +(` local_fan (V,E,FF) /\ +(x,y) IN FF +==> face_map ( hypermap (HYP (vec 0,V,E))) (x,y) = +(rho_node1 FF x, rho_node1 FF y ) `, +[NHANH Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN; +NHANH Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP; +SIMP_TAC[]; +NHANH Local_lemmas.LOFA_DARTS_FF_UNION_SWITCH_FF; +STRIP_TAC; +SUBGOAL_THEN` x,y IN darts_of_hyp E (V:real^3 -> bool) ` MP_TAC; +ASM_REWRITE_TAC[IN_UNION]; + +SIMP_TAC[ff_of_hyp]; + +ASSUME_TAC2 (SPECL [` x:real^3 `;` y:real^3 `] ( +GENL [`v: real^3 `;` w:real^3 `] Local_lemmas.DETER_RHO_NODE)); +ASM_REWRITE_TAC[PAIR_EQ]; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_IMP_IN_V; +DOWN THEN STRIP_TAC; +ASSUME_TAC2 (SPECL [`x:real^3 `;` y:real^3 `] ( +GENL [`vv: real^ 3 `;` v: real^3 `] Local_lemmas.LOFA_IMP_EE_TWO_ELMS)); +ASM_REWRITE_TAC[ivs_azim_cycle; SET_RULE` ~( x INSERT S = {} )`]; +ABBREV_TAC` tt = (@x'. x' IN {rho_node1 FF y, x} /\ + azim_cycle {rho_node1 FF y, x} (vec 0) y x' = x)` ; +SUBGOAL_THEN`tt IN {rho_node1 FF y, x} /\ +azim_cycle {rho_node1 FF y, x} (vec 0) y tt = x` MP_TAC; +EXPAND_TAC "tt"; +REWRITE_TAC[MESON[EXISTS_THM]` (@x'. x' IN {rho_node1 FF y, x} /\ + azim_cycle {rho_node1 FF y, x} (vec 0) y x' = x) IN + {rho_node1 FF y, x} /\ + azim_cycle {rho_node1 FF y, x} (vec 0) y + (@x'. x' IN {rho_node1 FF y, x} /\ + azim_cycle {rho_node1 FF y, x} (vec 0) y x' = x) = + x + +<=> ? x'. x' IN {rho_node1 FF y, x} /\ + azim_cycle {rho_node1 FF y, x} (vec 0) y x' = x `]; +EXISTS_TAC` rho_node1 FF y `; +REWRITE_TAC[IN_INSERT; Local_lemmas.AZIM_CYCLE_TWO_POINT_SET; IN_INSERT; NOT_IN_EMPTY]; + +REWRITE_TAC[IN_INSERT; Local_lemmas.AZIM_CYCLE_TWO_POINT_SET; IN_INSERT; NOT_IN_EMPTY]; + +STRIP_TAC; +ASM_REWRITE_TAC[]; + +DOWN; +ASM_REWRITE_TAC[INSERT_COMM; Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]; +ASSUME_TAC2 (SPEC `y:real^3 ` (GEN `v:real^3 ` Local_lemmas.LOFA_CARD_EE_V_1)); +DOWN; +ASM_SIMP_TAC[Geomdetail.CARD2]]);; + + + + + + +let IN_DARTS_EXTENSION = prove( +` {x:A,y} IN E ==> x,y IN darts_of_hyp (E UNION S) V `, +REWRITE_TAC[darts_of_hyp; IN_UNION; ord_pairs; IN_ELIM_THM; PAIR_EQ] THEN +STRIP_TAC THEN DISJ1_TAC THEN EXISTS_TAC` x:A` THEN EXISTS_TAC` y:A ` THEN +ASM_REWRITE_TAC[]);; + + + + + + +let LOCAL_RHO_NODE_PAIR_E = prove( +`! v. local_fan (V,E,FF) /\ v IN V +==> {v, rho_node1 FF v} IN E `, +NHANH Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2 THEN +REPEAT STRIP_TAC THEN DOWN THEN FIRST_X_ASSUM NHANH THEN +ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_IN_FF_IN_ORD_PAIRS2]);; + + + + + +let LOFA_HYP_UNION_CARD_GT2 = prove_by_refinement +(`(local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E)) /\ + HS = hypermap ( HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v, rho_node1 FF v) + ==> 2 < CARD fv `, +[NHANH PROVE_SLICING_FAN; +NHANH Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE; +NHANH Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2; +STRIP_TAC; +SUBGOAL_THEN` ~(rho_node1 FF v = w) ` ASSUME_TAC; +USE_FIRST ` !x. x IN V ==> x,rho_node1 FF x IN FF ` (ASSUME_TAC2 o (SPEC`v: real^3 `)); +DOWN; +USE_FIRST` !x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E ` NHANH; +REWRITE_TAC[wedge_in_fan_gt]; +ASSUME_TAC2 Local_lemmas.LOFA_CARD_EE_V_1; +ASM_REWRITE_TAC[ARITH_RULE` 2 > 1 `]; + + + +MP_TAC (ISPECL [` {v:real^3} `; ` {vec 0, v:real^3} `;` {rho_node1 FF v} `] + (GEN_ALL Local_lemmas.AFF_GE_MONO_TRANS)); +ANTS_TAC; +SIMP_TAC[SUBSET; IN_SING; IN_INSERT]; + +SUBGOAL_THEN` FAN (vec 0,V,E UNION {{v:real^3, w}}) ` MP_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +REWRITE_TAC[FAN; fan1; fan2]; +STRIP_TAC; +SUBGOAL_THEN ` ~( v:real^3 = vec 0) ` MP_TAC; +ASM_MESON_TAC[]; +SIMP_TAC[SET_RULE` ~( a = b) ==> {b,a} DIFF {a} = {b} `; SET_RULE` {a} UNION {b} = {b,a}`]; +REPEAT STRIP_TAC; + +MP_TAC (SPECL [`vec 0: real^3 `;` v: real^3 `;` rho_node1 FF v `; +` (azim_cycle (EE v E) (vec 0) v (rho_node1 FF v)) ` ] +(GEN_ALL AFF_GE_WEDGE_DISJOINTION)); +ABBREV_TAC` tv = azim_cycle (EE v E) (vec 0) v (rho_node1 FF v) `; +STRIP_TAC; +UNDISCH_TAC` aff_gt {vec 0} {v, w} SUBSET wedge (vec 0) v (rho_node1 FF v) tv `; +UNDISCH_TAC` aff_ge {vec 0, v} {rho_node1 FF v} INTER + wedge (vec 0) v (rho_node1 FF v) tv = + {} `; +MP_TAC (ISPECL [` {vec 0: real^ 3} `; ` {v, w:real^3} `] AFF_GT_SUBSET_AFF_GE); +ASM_REWRITE_TAC[]; + +MATCH_MP_TAC ( +SET_RULE` ge12 SUBSET ge21 /\ ~( gt = {} ) ==> +gt SUBSET ge12 ==> ge21 INTER we = {} ==> ~( gt SUBSET we ) `); +UNDISCH_TAC` aff_ge {vec 0} {v, rho_node1 FF v} SUBSET + aff_ge {vec 0, v} {rho_node1 FF v}`; +ASM_SIMP_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` DISJOINT {vec 0} {v, w:real^3}` MP_TAC; +REWRITE_TAC[SET_RULE` DISJOINT {a} {x,y} <=> ~( x = a) /\ ~( y = a) `]; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` ~( vec 0:real^3 IN V ) `; +UNDISCH_TAC` w:real^3 IN V `; +MESON_TAC[]; + +SIMP_TAC[Planarity.AFF_GT_1_2; EXTENSION; IN_ELIM_THM; NOT_IN_EMPTY]; +REPEAT STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPEC` &1 / &2 % v + &1 / &2 % (w:real^3) `)); +REWRITE_TAC[]; +EXISTS_TAC` &0 `; +EXISTS_TAC` &1 / &2 `; +EXISTS_TAC` &1 / &2 `; +REWRITE_TAC[REAL_ARITH` &0 < &1 / &2 /\ + &0 < &1 / &2 /\ + &0 + &1 / &2 + &1 / &2 = &1 `]; +REWRITE_TAC[VECTOR_ARITH` &0 % v + x = x `]; + + + +ASM_CASES_TAC` rho_node1 FF ( rho_node1 FF v) = v `; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ORBIT_MAP_V; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC `v:real^3 `)); +REPLICATE_TAC 3 DOWN; +NHANH (GEN_ALL Local_lemmas.ORD2_ORBIT_MAP); +SIMP_TAC[]; +REPEAT STRIP_TAC; +UNDISCH_TAC` w IN (V:real^3 -> bool) `; +EXPAND_TAC "V"; +REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY]; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (SPEC_ALL LOCAL_RHO_NODE_PAIR_E); + +DOWN; +NHANH (ISPEC ` {{v, w:real^3}} ` (GEN `S: (A -> bool) -> bool` IN_DARTS_EXTENSION)); +DOWN THEN STRIP_TAC; +ASSUME_TAC2 Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN; +NHANH (ONCE_REWRITE_RULE[TAUT` a /\ b ==> c <=> a ==> b ==> c `] FACE_MAP_ADD_SET2_EQ); +STRIP_TAC; +DOWN; +ANTS_TAC; +USE_FIRST` !v. v IN V + ==> ~(rho_node1 FF v = v) /\ + v,rho_node1 FF v IN ord_pairs E /\ + ~collinear {vec 0, v, rho_node1 FF v} ` (ASSUME_TAC2 o SPEC_ALL); +ASM_REWRITE_TAC[]; +USE_FIRST` !x. x IN V ==> x,rho_node1 FF x IN FF ` (ASSUME_TAC2 o (SPEC` v:real^3 `)); + +ASSUME_TAC2 ( +SPECL [` v:real^3 `;` rho_node1 FF v `] ( +GENL [`x:real^3`;` y:real^3 `] LOCAL_FACE_MAP_RHO_NODE1)); + + +SWITCH_TAC` HS = hypermap (HYP (vec 0,V,E UNION {{v, w:real^3}})) `; +SWITCH_TAC` fv = face HS (v,rho_node1 FF (v:real^3))`; +ASM_REWRITE_TAC[]; + +ASSUME_TAC2 Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; +ASSUME_TAC2 (SPEC ` rho_node1 FF v` LOCAL_RHO_NODE_PAIR_E); +DOWN; +NHANH (ISPEC ` {{v, w:real^3}} ` (GEN `S: (A -> bool) -> bool` IN_DARTS_EXTENSION)); +REPEAT STRIP_TAC; + +SUBGOAL_THEN` v, rho_node1 FF v IN fv /\ +rho_node1 FF v,rho_node1 FF (rho_node1 FF v) IN fv /\ +face_map HS (rho_node1 FF v,rho_node1 FF (rho_node1 FF v)) IN fv ` MP_TAC; + +SUBGOAL_THEN` v,rho_node1 FF v IN fv /\ + rho_node1 FF v,rho_node1 FF (rho_node1 FF v) IN fv ` MP_TAC; +EXPAND_TAC "fv"; +REWRITE_TAC[face; orbit_map; IN_ELIM_THM]; +CONJ_TAC; +EXISTS_TAC `0`; +REWRITE_TAC[ARITH_RULE` 0 >= 0`; POWER; I_THM]; + +EXISTS_TAC` 1 `; +ASM_REWRITE_TAC[POWER_TO_ITER; ITER12; ARITH_RULE` 1 >= 0 `]; +SIMP_TAC[]; + +EXPAND_TAC "fv"; +SIMP_TAC[face; Wrgcvdr_cizmrrh.IN_ORBIT_MAP_IMP_F_Y]; +UNDISCH_TAC` FAN (vec 0,V,E UNION {{v, w:real^3}})`; +NHANH Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP; +ASM_SIMP_TAC[]; +STRIP_TAC; +UNDISCH_TAC` rho_node1 FF v,rho_node1 FF (rho_node1 FF v) IN + darts_of_hyp (E UNION {{v, w}}) V `; +SIMP_TAC[ff_of_hyp]; +ABBREV_TAC` rh1 = rho_node1 FF v `; +ABBREV_TAC` rr2 = ivs_azim_cycle (EE (rho_node1 FF rh1) (E UNION {{v, w}})) (vec 0) + (rho_node1 FF rh1) + rh1 `; + +REPEAT STRIP_TAC; +SUBGOAL_THEN` ~((v:real^3, rh1 :real^3) = rh1,rho_node1 FF rh1) /\ +~( rh1,rho_node1 FF rh1 = rho_node1 FF rh1, rr2 ) /\ +~( v, rh1 = rho_node1 FF rh1, rr2 ) ` MP_TAC; +ASM_REWRITE_TAC[PAIR_EQ]; + +USE_FIRST` !v. v IN V + ==> ~(rho_node1 FF v = v) /\ + v,rho_node1 FF v IN ord_pairs E /\ + ~collinear {vec 0, v, rho_node1 FF v} ` (MP_TAC o SPEC_ALL); +ANTS_TAC; +FIRST_ASSUM ACCEPT_TAC; + +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` rh1: real^3 `)); +ASM_SIMP_TAC[]; +STRIP_TAC; +MP_TAC (ISPECL [` HS: (real^3#real^3)hypermap `; ` (v:real^3, rh1: real^3) `] Hypermap.FACE_FINITE); +STRIP_TAC; +SUBGOAL_THEN` CARD {(v,rh1), (rh1,rho_node1 FF rh1), (rho_node1 FF rh1,rr2)} <= CARD (fv:real^3 # real^3 -> bool) ` MP_TAC; +MATCH_MP_TAC CARD_SUBSET; +DOWN; +ASM_SIMP_TAC[INSERT_SUBSET; EMPTY_SUBSET]; + +SUBGOAL_THEN` CARD {(v,rh1), (rh1,rho_node1 FF rh1), (rho_node1 FF rh1,rr2)} = 3 ` SUBST1_TAC; +ASM_REWRITE_TAC[Geomdetail.CARD3]; +ARITH_TAC]);; + + +(* = *) + + +let LOCAL_FAN_SIMPLE_HYP = prove_by_refinement +(` local_fan (V,E,FF) ==> simple_hypermap (hypermap (HYP (vec 0, V,E))) `, +[REWRITE_TAC[local_fan]; +LET_TAC; +STRIP_TAC; +ASM_CASES_TAC` CARD (FF:real^3 # real^3 -> bool) = 0 `; +DOWN; +ASM_REWRITE_TAC[]; +REWRITE_TAC[MATCH_MP (ISPEC` face H (x:A)` CARD_EQ_0) (SPEC_ALL Hypermap.FACE_FINITE)]; +REWRITE_TAC[EXTENSION; NOT_IN_EMPTY]; +MESON_TAC[Hypermap.face_refl]; +DOWN THEN DOWN THEN PHA; +REWRITE_TAC[Lvducxu.DIH2K_IMP_SIMPLE_HYPERMAP2]]);; +(* RITE_TAC[Lvducxu.DIH2K_IMP_SIMPLE_HYPERMAP2];; *) + + + + + + +let EE_UNION = prove(` EE v ( E UNION S) = EE v E UNION EE v S `, +REWRITE_TAC[EE; IN_UNION; EXTENSION; IN_ELIM_THM]);; + + + + + + + +let EE_SING_SING = prove(` EE v {{v,w}} = {w} `, +REWRITE_TAC[EE; EXTENSION; IN_ELIM_THM; IN_SING; IN_INSERT] THEN MESON_TAC[]);; + + + + + + + +let CROSS_PAIR_NOT_IN_FF = prove_by_refinement +(` local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E) +==> ~((v,w) IN FF) `, +[STRIP_TAC; +FIRST_ASSUM NHANH; +REWRITE_TAC[wedge_in_fan_gt]; +ASSUME_TAC2 Local_lemmas.LOFA_CARD_EE_V_1; +ASM_REWRITE_TAC[ARITH_RULE` 2 > 1 `]; +MP_TAC (SPECL [` vec 0: real^3 `;` v:real^3 `;`w:real^3 `; +` azim_cycle (EE v E) (vec 0) v w`] (GEN_ALL AFF_GE_WEDGE_DISJOINTION)); + +SUBGOAL_THEN` &1 / &2 % v + &1 / &2 % (w:real^3) IN aff_ge {vec 0, v} {w} /\ +&1 / &2 % v + &1 / &2 % (w:real^3) IN aff_gt {vec 0} {v, w} ` MP_TAC; +SUBGOAL_THEN` DISJOINT {vec 0, v:real^3} {w} /\ +DISJOINT {vec 0} {v, w:real^3} ` MP_TAC; +REWRITE_TAC[DISJOINT]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_V_DIFF; +REWRITE_TAC[EXTENSION; NOT_IN_EMPTY; IN_INTER; IN_INSERT]; +ASM_MESON_TAC[]; + +SIMP_TAC[Fan.AFF_GE_2_1; Planarity.AFF_GT_1_2; IN_ELIM_THM]; +STRIP_TAC; +CONJ_TAC; +EXISTS_TAC` &0 `; +EXISTS_TAC` &1 / &2 `; +EXISTS_TAC` &1 / &2 `; +REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID]; +REAL_ARITH_TAC; + +EXISTS_TAC` &0 `; +EXISTS_TAC` &1 / &2 `; +EXISTS_TAC` &1 / &2 `; +REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID]; +REAL_ARITH_TAC; +SET_TAC[]]);; + + +(* = *) + + +let AZ_REFL11 = +REWRITE_RULE[] (SPECL [`v:real^3`;` v:real^3`] (CONJUNCT1 AZIM_DEGENERATE));; + + + + +let AZIM_POS_IMP_CYCLIC_SET = prove_by_refinement +(` &0 < azim v0 v1 w1 w2 ==> cyclic_set {w1, w2} v0 v1 `, +[REWRITE_TAC[cyclic_set]; +STRIP_TAC; +CONJ_TAC; +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN; +REWRITE_TAC[AZ_REFL11]; +REAL_ARITH_TAC; + +REWRITE_TAC[Geomdetail.FINITE6]; +ASM_CASES_TAC` v0 = v1:real^3 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN; +REWRITE_TAC[AZ_REFL11; REAL_ARITH` ~( a < a ) `]; + +ASM_CASES_TAC` w1 IN affine hull {v0, v1:real^3}`; +DOWN; +NHANH (REWRITE_RULE[CONTRAPOS_THM; aff] Fan.th3c); +STRIP_TAC; +UNDISCH_TAC` &0 < azim v0 v1 w1 w2 `; +ASM_SIMP_TAC[AZIM_DEGENERATE; REAL_ARITH` ~( a < a ) `]; + + +ASM_CASES_TAC` w2 IN affine hull {v0, v1:real^3}`; +DOWN; +NHANH (REWRITE_RULE[CONTRAPOS_THM; aff] Fan.th3c); +STRIP_TAC; +UNDISCH_TAC` &0 < azim v0 v1 w1 w2 `; +ASM_SIMP_TAC[AZIM_DEGENERATE; REAL_ARITH` ~( a < a ) `]; + +REWRITE_TAC[EXTENSION; IN_ELIM_THM; NOT_IN_EMPTY; IN_INSERT; IN_INTER]; +CONJ_TAC; +REWRITE_TAC[SET_RULE` ( {w1, w2} p /\ {w1, w2} q /\ L ==> p = q ) <=> +( p = w1 /\ q = w2 /\ L ==> p = q ) /\ +(p = w2 /\ q = w1 /\ L ==> p = q )`]; + +MATCH_MP_TAC ( +MESON[]` ( ! h. w1 = w2 + h % (v0 - v1) ==> w1 = w2 ) /\ +(! h. w2 = w1 + h % (v0 - v1) ==> w1 = w2 + ( -- h) % ( v0 - v1 )) +==> +!p q h. + (p = w1 /\ q = w2 /\ p = q + h % (v0 - v1) ==> p = q) /\ + (p = w2 /\ q = w1 /\ p = q + h % (v0 - v1) ==> p = q)`); +CONJ_TAC; +REPEAT STRIP_TAC; +SUBGOAL_THEN` w1 IN aff_ge {v0, v1} {w2:real^3} ` MP_TAC; + +DOWN; +ASSUME_TAC2 (ISPECL [` v0:real^3 `;` v1:real^3 `; `w2:real^3 `] COLLINEAR_3_AFFINE_HULL); +UNDISCH_TAC` ~(w2 IN affine hull {v0, v1: real^3})`; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +NHANH Fan.th3a; +NHANH Collect_geom.simp_def_ge; +SIMP_TAC[IN_ELIM_THM]; +REPEAT STRIP_TAC; +EXISTS_TAC` h:real` ; +EXISTS_TAC` -- h:real` ; +EXISTS_TAC` &1 `; +REWRITE_TAC[REAL_ARITH` a + -- a + b = b /\ &0 <= &1 `]; +VECTOR_ARITH_TAC; +ASSUME_TAC2 (ISPECL [` v1:real^3 `;` v0: real^3 `; ` w2:real ^3 `] (GSYM COLLINEAR_3_AFFINE_HULL)); +UNDISCH_TAC ` ~(w2 IN affine hull {v0, v1:real^3})`; +DOWN; +ASM_SIMP_TAC[INSERT_COMM]; +SIMP_TAC[ GSYM Local_lemmas.AZIM_EQ_0_GE_ALT2]; +FIRST_X_ASSUM (SUBST_ALL_TAC o SYM); +REPEAT STRIP_TAC; +UNDISCH_TAC` &0 < azim v0 v1 w1 w2 `; +DOWN; +ASM_SIMP_TAC[Local_lemmas.AZIM_EQ_0_SYM2; REAL_ARITH` ~( a < a ) `]; +GEN_TAC; +VECTOR_ARITH_TAC; +GEN_TAC; +REWRITE_TAC[DE_MORGAN_THM]; + +ASM_MESON_TAC[]]);; + + + + + + + +let AZIM_POS_IMP_SUM_2PI = prove( +` &0 < azim a b c d ==> azim a b c d + azim a b d c = &2 * pi `, +NHANH AZIM_POS_IMP_CYCLIC_SET THEN NHANH Trigonometry2.YVREJIS THEN +MESON_TAC[REAL_ARITH` a < b ==> ~( b = a ) `]);; + +(* = *) + + + + +let FACE_MAP_AT_TURNING_DART = prove_by_refinement +(` (local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E)) /\ +(x,v) IN FF +==> face_map (hypermap (HYP (vec 0,V,E UNION {{v, w}}))) (x,v) += (v, w)`, +[NHANH PROVE_SLICING_FAN; +NHANH Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP; +SIMP_TAC[]; +STRIP_TAC; +ASSUME_TAC2 (SPECL [`x:real^3 `;` v:real^3 `] ( +GENL [`x:real^3 `;` y:real^3 `] Local_lemmas.LOCAL_FAN_IN_FF_IN_ORD_PAIRS2)); + +DOWN THEN NHANH (ISPEC `{{v, w:real^3}} ` (GEN` S: (A -> bool) -> bool ` IN_DARTS_EXTENSION)); +SIMP_TAC[ff_of_hyp; PAIR_EQ]; +STRIP_TAC; +ASSUME_TAC2 (SET_RULE` {x,v:real^3} IN E ==> {x,v} IN E UNION {{v,w}} `); +DOWN; +PAT_ONCE_REWRITE_TAC`\x. x IN Y ==> L ` [INSERT_COMM]; +UNDISCH_TAC` FAN (vec 0,V,E UNION {{v, w:real^3}})`; +PHA; +NHANH Wrgcvdr_cizmrrh.IVS_AZIM_EQ_INVERSE_SIGMA_FAN; +SIMP_TAC[]; +NHANH (GSYM Wrgcvdr_cizmrrh.FAN_IMP_EE_EQ_SET_OF_EDGE); +STRIP_TAC; +MATCH_MP_TAC (REWRITE_RULE[TAUT` a ==> b ==> c <=> a /\ b ==> c `] Wrgcvdr_cizmrrh.SIG_AND_INVERSE1_SIG); +ASM_REWRITE_TAC[IN_UNION; IN_SING]; +MATCH_MP_TAC Fan.UNIQUE_SIGMA_FAN; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (SPECL [` x:real^3 `;` v:real^3 `] +(GENL [` v:real^3 `;` w:real^3 `] Local_lemmas.DETER_RHO_NODE)); + +SUBGOAL_THEN` x:real^3 IN V /\ v IN V ` MP_TAC; +MATCH_MP_TAC Local_lemmas.LOCAL_FAN_IMP_IN_V; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASSUME_TAC2 (SPEC` x:real^3 ` (GEN `vv:real^3 ` Local_lemmas.LOFA_IMP_EE_TWO_ELMS)); +ASM_REWRITE_TAC[EE_UNION; EE_SING_SING; IN_UNION; IN_SING; IN_INSERT]; + + +SUBGOAL_THEN` ~( x = w:real^3 ) ` MP_TAC; +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2; +DOWN THEN STRIP_TAC; + + + +UNDISCH_TAC` w:real^3 IN V `; +PHA; +FIRST_ASSUM NHANH; +STRIP_TAC; +DOWN THEN PHA; + +MATCH_MP_TAC CROSS_PAIR_NOT_IN_FF; +ASM_REWRITE_TAC[]; +ONCE_REWRITE_TAC[INSERT_COMM]; +FIRST_ASSUM ACCEPT_TAC; + +SIMP_TAC[]; +STRIP_TAC; +CONJ_TAC; +DOWN THEN SET_TAC[]; + +REPEAT STRIP_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2; +DOWN THEN STRIP_TAC; +UNDISCH_TAC` v:real^3 IN V `; +FIRST_ASSUM NHANH; +USE_FIRST` !x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E` +NHANH; + +STRIP_TAC; +DOWN; +ASSUME_TAC2 Local_lemmas.LOFA_CARD_EE_V_1; +DOWN THEN SIMP_TAC[wedge_in_fan_gt]; +REWRITE_TAC[ARITH_RULE` 2 > 1 `]; +ASSUME_TAC2 (SPECL [` x:real^3 `] +(GENL [` vv:real^3 `] Local_lemmas.LOFA_IMP_EE_TWO_ELMS)); +ASM_REWRITE_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]; + + +SUBGOAL_THEN` &1 / &2 % v + &1 / &2 % w IN aff_gt {vec 0} {v, w:real^3}` ASSUME_TAC; +SUBGOAL_THEN` DISJOINT {vec 0} {v, w:real^3} ` MP_TAC; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_V_DIFF; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` v:real^3`)); +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` w:real^3`)); +DOWN THEN DOWN THEN PHA; +REWRITE_TAC[DISJOINT; EXTENSION; NOT_IN_EMPTY; IN_INTER; IN_INSERT]; +MESON_TAC[]; + +SIMP_TAC[Planarity.AFF_GT_1_2; IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC` &0 `; +EXISTS_TAC` &1 / &2 `; +EXISTS_TAC` &1 / &2 `; +REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID]; +REAL_ARITH_TAC; +ABBREV_TAC` vw: real^3 = &1 / &2 % v + &1 / &2 % w `; + + +REWRITE_TAC[SUBSET]; +REPEAT STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` vw: real^3 `)); +DOWN; +REWRITE_TAC[wedge; IN_ELIM_THM]; + + +SUBGOAL_THEN` vw IN aff_gt {vec 0, v} {w:real^3} ` MP_TAC; +SUBGOAL_THEN` DISJOINT {vec 0, v} {w:real^3} ` MP_TAC; +ASM_REWRITE_TAC[DISJOINT; EXTENSION; IN_INSERT; IN_INTER; NOT_IN_EMPTY]; + +UNDISCH_TAC` ~( v = w:real^3 ) `; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_V_DIFF; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` w:real^3 `)); +DOWN; +MESON_TAC[]; + +SIMP_TAC[AFF_GT_2_1; IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC` &0 `; +EXISTS_TAC` &1 / &2 `; +EXISTS_TAC` &1 / &2 `; +EXPAND_TAC "vw"; +REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID]; +REAL_ARITH_TAC; + +REPEAT STRIP_TAC; +SUBGOAL_THEN` ~ collinear {vec 0, v, rho_node1 FF v} /\ +~ collinear {vec 0, v, vw} /\ +~ collinear {vec 0, v, w} ` MP_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` v:real^3 `)); +ASM_REWRITE_TAC[]; + +USE_FIRST ` !z t. z IN {v:real^3, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}` MATCH_MP_TAC; +ASM_REWRITE_TAC[IN_INSERT; IN_DIFF; NOT_IN_EMPTY]; +NHANH AZIM_EQ_ALT; +ASM_REWRITE_TAC[]; +STRIP_TAC; + +UNDISCH_TAC` azim (vec 0) v (rho_node1 FF v) vw < azim (vec 0) v (rho_node1 FF v) x `; +NHANH REAL_LT_IMP_LE; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` azim (vec 0) v (rho_node1 FF v) x = +azim (vec 0) v (rho_node1 FF v) w + azim (vec 0) v w x ` MP_TAC; +MATCH_MP_TAC Fan.sum4_azim_fan; +ASM_REWRITE_TAC[]; + +ASSUME_TAC2 (SPEC` x:real^3 ` (GEN` v:real^3 ` Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2)); +DOWN; +ASM_SIMP_TAC[INSERT_COMM]; + + +STRIP_TAC; +UNDISCH_TAC` &0 < azim (vec 0) v (rho_node1 FF v) vw `; +UNDISCH_TAC` azim (vec 0) v (rho_node1 FF v) w < azim (vec 0) v (rho_node1 FF v) x `; +PHA; +ASM_REWRITE_TAC[]; +NHANH (REAL_ARITH` a < b /\ &0 < a ==> &0 < b `); +FIRST_ASSUM (SUBST1_TAC o SYM); +NHANH AZIM_POS_IMP_SUM_2PI; +SIMP_TAC[REAL_ARITH` a + b = c <=> b = c - a `]; +STRIP_TAC; +UNDISCH_TAC` azim (vec 0) v (rho_node1 FF v) x = + azim (vec 0) v (rho_node1 FF v) w + azim (vec 0) v w x`; +SIMP_TAC[REAL_ARITH` a = b + c <=> c = a - b `]; +STRIP_TAC; +UNDISCH_TAC` azim (vec 0) v x (rho_node1 FF v) = + &2 * pi - azim (vec 0) v (rho_node1 FF v) x `; +SIMP_TAC[REAL_ARITH` a = b - c <=> c = b + -- a `]; +STRIP_TAC; +MATCH_MP_TAC (REAL_ARITH` &0 <= a ==> ( x + -- a ) - y <= x - y `); +REWRITE_TAC[AZIM_RANGE]; + +ASM_REWRITE_TAC[REAL_LE_REFL]; + +DOWN; +ASM_REWRITE_TAC[]]);; + + +(* = *) + + +let WEDGE_IN_FAN_LOFA_DETER = prove_by_refinement +(`local_fan (V,E,FF) /\ v IN V /\ rho_node1 FF v = w +==> wedge_in_fan_gt (w, rho_node1 FF w) E = wedge (vec 0) w (rho_node1 FF w) v`, +[REWRITE_TAC[wedge_in_fan_gt]; +NHANH Local_lemmas.LOFA_IMP_EE_TWO_ELMS; +STRIP_TAC; +ASSUME_TAC2 Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; +DOWN; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASSUME_TAC2 (SPEC` w:real^3 ` (GEN` v: real^3 ` Local_lemmas.LOFA_CARD_EE_V_1)); +DOWN; +ASM_SIMP_TAC[ARITH_RULE` 2 > 1 `]; +REWRITE_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]]);; + + + + + + + +let FACE_MAP_SLICING_HYP_TRANS_POINT = prove_by_refinement +( `(local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E)) + ==> face_map (hypermap (HYP (vec 0,V,E UNION {{v, w}}))) (v,w) = w, rho_node1 FF w `, +[NHANH PROVE_SLICING_FAN; +NHANH Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP; +SIMP_TAC[]; +STRIP_TAC; +REPLICATE_TAC 4 (DOWN THEN REMOVE_TAC); +REWRITE_TAC[ff_of_hyp]; +SUBGOAL_THEN` v,w IN darts_of_hyp (E UNION {{v, w:real^3}}) V ` MP_TAC; +MATCH_MP_TAC (ONCE_REWRITE_RULE[UNION_COMM] IN_DARTS_EXTENSION); +REWRITE_TAC[IN_SING]; +SIMP_TAC[PAIR_EQ]; +STRIP_TAC; +SUBGOAL_THEN` {v,w:real^3} IN E UNION {{v, w}} ` MP_TAC; +REWRITE_TAC[IN_UNION; IN_SING]; +UNDISCH_TAC` FAN (vec 0,V,E UNION {{v, w:real^3}})`; +PHA; +NHANH (ONCE_REWRITE_RULE[INSERT_COMM] Wrgcvdr_cizmrrh.IVS_AZIM_EQ_INVERSE_SIGMA_FAN); +SIMP_TAC[]; +STRIP_TAC; +MATCH_MP_TAC (REWRITE_RULE[TAUT` a ==> b ==> c <=> a /\ b ==> c `] Wrgcvdr_cizmrrh.SIG_AND_INVERSE1_SIG); +ASSUME_TAC2 (SPEC `w:real^3 ` LOCAL_RHO_NODE_PAIR_E); + +ASM_REWRITE_TAC[IN_UNION]; + +ASSUME_TAC2 Local_lemmas.LOFA_IMAGE_RHO_NODE_IDE; +DOWN; +REWRITE_TAC[IMAGE]; +STRIP_TAC; +UNDISCH_TAC` w:real^3 IN V `; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +MP_TAC (SPECL [`x:real^3 `;` w:real^3 `] +(GENL [`vv:real^3 `;` v:real^3 `] Local_lemmas.LOFA_IMP_EE_TWO_ELMS)); +ANTS_TAC; +ASM_REWRITE_TAC[]; + +STRIP_TAC; +SWITCH_TAC` w = rho_node1 FF x`; +SUBGOAL_THEN` EE w ( E UNION {{v,w:real^3}}) = {v, x, rho_node1 FF w}` MP_TAC; +ASM_SIMP_TAC[EE_UNION]; +ONCE_REWRITE_TAC[INSERT_COMM]; +REWRITE_TAC[EE_SING_SING]; +ASM_REWRITE_TAC[SET_RULE` S UNION {x} = x INSERT S`; INSERT_COMM]; + +STRIP_TAC; +ASM_REWRITE_TAC[]; + + +SUBGOAL_THEN` rho_node1 FF w IN set_of_edge w V (E UNION {{v,w}})` MP_TAC; +UNDISCH_TAC` FAN (vec 0,V,E UNION {{v, w:real^3}}) `; +NHANH (ISPEC `w:real^3 ` +(GEN`v:real^N` (GSYM Wrgcvdr_cizmrrh.FAN_IMP_EE_EQ_SET_OF_EDGE))); +ASM_SIMP_TAC[IN_INSERT]; +UNDISCH_TAC` FAN (vec 0,V,E UNION {{v, w:real^3}})`; +PHA; +NHANH (GSYM Wrgcvdr_cizmrrh.AZIM_CYCLE_EQ_SIGMA_FAN); +ASM_SIMP_TAC[]; +STRIP_TAC; + +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` x:real^3 `)); +SUBGOAL_THEN` ~( {v, x, rho_node1 FF w} SUBSET {rho_node1 FF w}) /\ +FINITE {v, x, rho_node1 FF w}` MP_TAC; +DOWN; +ASM_REWRITE_TAC[Geomdetail.FINITE6]; +CONV_TAC SET_RULE; +NHANH (SPEC` vec 0: real^3` (GEN` v:real^3 ` Wrgcvdr_cizmrrh.AZIM_CYCLE_PROPERTIES)); +ABBREV_TAC` W = {v, x, rho_node1 FF w} `; +ABBREV_TAC` az = azim_cycle W (vec 0) w (rho_node1 FF w) `; +STRIP_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2; +DOWN THEN STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC`w: real^3 `)); +DOWN; +USE_FIRST` !x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E` NHANH; +ASSUME_TAC2 (SPEC` x:real^3` (GEN` v:real^3 ` WEDGE_IN_FAN_LOFA_DETER)); +ASM_REWRITE_TAC[SUBSET]; +SUBGOAL_THEN` DISJOINT {vec 0} {v, w:real^3}` MP_TAC; +REWRITE_TAC[DISJOINT; EXTENSION; IN_INTER; NOT_IN_EMPTY; IN_INSERT]; +ASSUME_TAC2 (SPEC` x:real^3 ` (GEN` v:real^3 ` Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V)); +GEN_TAC; +DOWN; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_V_DIFF; +UNDISCH_TAC` v:real^3 IN V `; +FIRST_ASSUM NHANH; +MESON_TAC[]; + +REPEAT STRIP_TAC; +SUBGOAL_THEN` &1 / &2 % v + &1 / &2 % (w:real^3) IN aff_gt { vec 0} {v, w}` MP_TAC; +ASSUME_TAC2 (ISPEC` vec 0:real^3 ` Planarity.AFF_GT_1_2); +FIRST_X_ASSUM SUBST1_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` &0 `; +EXISTS_TAC` &1 / &2 `; +EXISTS_TAC` &1 / &2 `; +REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +REAL_ARITH_TAC; + +FIRST_X_ASSUM NHANH; +REWRITE_TAC[wedge; IN_ELIM_THM]; +STRIP_TAC; +SUBGOAL_THEN` ~ collinear {vec 0, w, rho_node1 FF w} /\ +~ collinear {vec 0, v, w}` MP_TAC; + +ASSUME_TAC2 (SPEC` w:real^3` (GEN` v:real^3 ` Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2)); +ASM_REWRITE_TAC[]; +USE_FIRST` !z t. z IN {v:real^3, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}` MATCH_MP_TAC; +ASM_REWRITE_TAC[IN_DIFF; IN_SING; IN_INSERT; NOT_IN_EMPTY]; +EXPAND_TAC "w"; +MATCH_MP_TAC Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; +ASM_REWRITE_TAC[]; + +STRIP_TAC; + +MP_TAC (SPECL [` vec 0: real^3 `;` w:real^3 `;` rho_node1 FF w `; +` &1 / &2 % v + &1 / &2 % (w:real^3) `; `v:real^3 ` ] AZIM_EQ_ALT); +ANTS_TAC; +DOWN; +ASM_REWRITE_TAC[INSERT_COMM]; +ABBREV_TAC` vw = &1 / &2 % v + &1 / &2 % (w:real^3) `; +DOWN THEN DOWN; +ONCE_REWRITE_TAC[SET_RULE` {a,b,c} = {a,c,b} `]; +NHANH COLL_AFF_GT_2_1; +REPEAT STRIP_TAC; + +SUBGOAL_THEN` vw IN aff_gt {vec 0, w} {v:real^3} ` MP_TAC; +ASM_REWRITE_TAC[IN_ELIM_THM]; +EXPAND_TAC "vw"; +EXISTS_TAC` &0 `; +EXISTS_TAC` &1 / &2 `; +EXISTS_TAC` &1 / &2 `; +REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID; VECTOR_ADD_SYM]; +REAL_ARITH_TAC; + +FIRST_X_ASSUM (SUBST1_TAC o SYM); + + +STRIP_TAC; + + + + +UNDISCH_TAC` (W:real^3 -> bool) (az:real^3)`; +EXPAND_TAC "W"; +REWRITE_TAC[SET_RULE` (x INSERT s) y <=> y = x \/ y IN s`; IN_INSERT; NOT_IN_EMPTY]; +STRIP_TAC; + +USE_FIRST` !q. ~(q = rho_node1 FF w) /\ W q + ==> azim (vec 0) w (rho_node1 FF w) az < + azim (vec 0) w (rho_node1 FF w) q \/ + azim (vec 0) w (rho_node1 FF w) az = + azim (vec 0) w (rho_node1 FF w) q /\ + norm (projection (w - vec 0) (az - vec 0)) <= + norm (projection (w - vec 0) (q - vec 0)) ` (MP_TAC o (SPEC` v:real^3 `)); + +ANTS_TAC; +CONJ_TAC; +STRIP_TAC; +MP_TAC (SPECL [`w:real^3 `;` v:real^3 `] +(GENL [` v:real^3 `;` w:real^3 `] CROSS_PAIR_NOT_IN_FF)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +CONJ_TAC; +EXPAND_TAC "w"; +MATCH_MP_TAC Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; +ASM_REWRITE_TAC[]; + + +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[INSERT_COMM]; + + +ASM_REWRITE_TAC[]; + +EXPAND_TAC "W"; +REWRITE_TAC[SET_RULE` (x INSERT S) y <=> y = x \/ y IN S`; IN_INSERT]; + +ASM_REWRITE_TAC[]; +UNDISCH_TAC` azim (vec 0) w (rho_node1 FF w) vw < azim (vec 0) w (rho_node1 FF w) x `; +ASM_SIMP_TAC[REAL_ARITH` a < b ==> ~( b < a ) /\ ~( b = a)`]; + + +DOWN; +ASM_SIMP_TAC[]]);; + + +(* = *) + + +let FACE_MAP_AT_TURNING_DART1 = prove( +` (local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E)) /\ + x,w IN FF + ==> face_map (hypermap (HYP (vec 0,V,E UNION {{v, w}}))) (x,w) = w, v`, +STRIP_TAC THEN ONCE_REWRITE_TAC[INSERT_COMM] THEN +MATCH_MP_TAC FACE_MAP_AT_TURNING_DART THEN DOWN_TAC THEN SIMP_TAC[INSERT_COMM]);; + + + + + + + +let LOCAL_FAN_ORBIT_MAP_VITERFF = prove( +`local_fan (V,E,FF) /\ v IN V ==> (!n. ITER n (rho_node1 FF) v, ITER (n + 1) (rho_node1 FF) v IN FF)`, +NHANH Local_lemmas.LOCAL_FAN_ORBIT_MAP_VITER THEN +NHANH Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2 THEN +REPEAT STRIP_TAC THEN REWRITE_TAC[GSYM ADD1; ITER] THEN +ASM_MESON_TAC[]);; + + + + + + + +let DETERMINE_FV = prove_by_refinement +(`(local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E)) /\ + HS = hypermap ( HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v, rho_node1 FF v) +==> fv = (w,v) INSERT +{ (ITER n (rho_node1 FF) v, ITER (n + 1) (rho_node1 FF) v) | n | +! m. m < n + 1 ==> ~(ITER m (rho_node1 FF) v = w)} `, +[NHANH FACE_MAP_SLICING_HYP_TRANS_POINT; + +NHANH ( +REWRITE_RULE[RIGHT_FORALL_IMP_THM ] ( +GEN`x: real^3 ` +(ONCE_REWRITE_RULE[TAUT` a /\ b ==> c <=> a ==> b ==> c`] FACE_MAP_AT_TURNING_DART))); +STRIP_TAC; +DOWN THEN DOWN THEN PHA; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +STRIP_TAC; +REWRITE_TAC[EXTENSION; IN_INSERT]; +GEN_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ORBIT_MAP_V; +DOWN; +NHANH Local_lemmas.LOOP_SET_DETER_FIRTS_ELMS; +STRIP_TAC; +EQ_TAC; +SUBGOAL_THEN` {ITER n (rho_node1 FF) v,ITER (n + 1) (rho_node1 FF) v | n | !m. m < n + 1 + ==> ~ + (ITER m + (rho_node1 + FF) + v = + w)} +SUBSET fv ` ASSUME_TAC; +REWRITE_TAC[SUBSET; IN_ELIM_THM]; +REPEAT STRIP_TAC; + +FIRST_ASSUM (ASSUME_TAC2 o (SPEC`v:real^3`)); +UNDISCH_TAC` w:real^3 IN V `; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; + + + + + +SUBGOAL_THEN` ! j. j < n + 1 ==> ITER j (face_map HS) (v,rho_node1 FF v) = +ITER j (rho_node1 FF) v,ITER (j + 1) (rho_node1 FF) v ` ASSUME_TAC; +INDUCT_TAC; +REWRITE_TAC[ITER; GSYM ADD1]; + +NHANH (ARITH_RULE` SUC a < b + 1 ==> a < b + 1 `); +FIRST_X_ASSUM NHANH; +SIMP_TAC[ITER]; +STRIP_TAC; + +ABBREV_TAC` xi = ITER j (rho_node1 FF) v `; +ABBREV_TAC` yi = ITER (j + 1) (rho_node1 FF) v`; + +SUBGOAL_THEN` xi,yi IN darts_of_hyp (E UNION {{v:real^3, w}}) V /\ + ~(yi = v) /\ + ~(yi = w) /\ + FAN (vec 0,V,E) /\ + FAN (vec 0,V,E UNION {{v, w}}) ` MP_TAC; +CONJ_TAC; +UNDISCH_TAC` !v. v IN V ==> orbit_map (rho_node1 FF) v = V `; +DISCH_THEN (ASSUME_TAC2 o SPEC_ALL); +MP_TAC (ISPECL [`rho_node1 FF `; `j:num `; `v:real^3` ] Local_lemmas.lemma_in_orbit_iter); +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASSUME_TAC2 (SPEC` xi:real^3 ` LOCAL_RHO_NODE_PAIR_E); +EXPAND_TAC "yi"; +REWRITE_TAC[ITER; GSYM ADD1]; +ASM_REWRITE_TAC[]; +DOWN; +REWRITE_TAC[IN_DARTS_EXTENSION]; + +UNDISCH_TAC` SUC j < n + 1 `; +FIRST_ASSUM NHANH; +SWITCH_TAC` w = ITER n' (rho_node1 FF) v `; +ASM_SIMP_TAC[ADD1]; +ASSUME_TAC2 (Local_lemmas.LOFA_IMP_DIS_ELMS23); +FIRST_X_ASSUM (MP_TAC o (SPECL [` 0 `;` j + 1 `])); +ANTS_TAC; +ARITH_TAC; +STRIP_TAC THEN STRIP_TAC; +ASM_CASES_TAC` n' < j + 1 `; +ASSUME_TAC2 (ARITH_RULE` j + 1 < n + 1 /\ n' < j + 1 ==> n' < n + 1 `); +DOWN; +FIRST_X_ASSUM NHANH; +FIRST_X_ASSUM NHANH; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (ARITH_RULE` n' < CARD (V:real^3 -> bool) /\ ~( n' < j + 1) ==> j + 1 < CARD V `); +DOWN; +FIRST_X_ASSUM NHANH; +ASM_SIMP_TAC[ITER]; +STRIP_TAC; +ASSUME_TAC2 Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC PROVE_SLICING_FAN; +ASM_REWRITE_TAC[]; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC`n':num`; +ASM_REWRITE_TAC[]; + + + + +NHANH FACE_MAP_ADD_SET2_EQ; +ASM_SIMP_TAC[]; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V; +FIRST_X_ASSUM (MP_TAC o (SPEC` j:num `)); +ASM_REWRITE_TAC[]; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2; +DOWN THEN STRIP_TAC; +FIRST_ASSUM NHANH; +STRIP_TAC THEN STRIP_TAC; +ASSUME_TAC2 (SPECL [` xi:real^3 `;` rho_node1 FF xi `] (GENL [`x:real^3 `;` y:real^3 `] LOCAL_FACE_MAP_RHO_NODE1)); +DOWN; +EXPAND_TAC "xi"; +REWRITE_TAC[GSYM ITER; ADD1]; +ASM_REWRITE_TAC[]; + + + + + +FIRST_ASSUM (MP_TAC o (SPEC` n:num`)); +ANTS_TAC; +ARITH_TAC; +ASM_REWRITE_TAC[]; +DISCH_THEN (SUBST1_TAC o SYM); +EXPAND_TAC "fv"; +REWRITE_TAC[face; orbit_map; Wrgcvdr_cizmrrh.POWER_TO_ITER; IN_ELIM_THM]; + + +EXISTS_TAC`n:num`; +REWRITE_TAC[ARITH_RULE` a >= 0 `]; + + + + + + +STRIP_TAC; +UNDISCH_TAC` w:real^3 IN V `; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` v:real^3 `)); +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +ABBREV_TAC` SS = {ITER n (rho_node1 FF) v,ITER (n + 1) (rho_node1 FF) v | n | !m. m < + n + 1 + ==> ~ + (ITER m + (rho_node1 + FF) + v = + w)} `; +SUBGOAL_THEN` ITER (n - 1) (rho_node1 FF) v, (w:real^3) IN SS ` MP_TAC; +EXPAND_TAC "SS"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` n - 1 `; +REWRITE_TAC[PAIR_EQ]; +ASM_CASES_TAC` n = 0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN THEN DOWN; +ASM_REWRITE_TAC[ITER]; +DOWN; +ASM_SIMP_TAC[ARITH_RULE` ~( n = 0) ==> n - 1 + 1 = n `]; + +STRIP_TAC; +GEN_TAC; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_DIS_ELMS23; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPECL [`m:num `;` n:num`])); +PHA; +ANTS_TAC; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +ASM_CASES_TAC` n = 0`; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN THEN DOWN; +ASM_REWRITE_TAC[ITER]; +ABBREV_TAC` lp = ITER (n - 1) (rho_node1 FF) v `; +SUBGOAL_THEN` lp IN (V:real^3 -> bool) ` MP_TAC; +EXPAND_TAC "V"; +EXPAND_TAC "lp"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` n - 1 `; +REWRITE_TAC[]; +UNDISCH_TAC` n < CARD (V:real^3 -> bool) `; +ARITH_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2; +DOWN THEN STRIP_TAC; +FIRST_ASSUM NHANH; +EXPAND_TAC "lp"; +REWRITE_TAC[GSYM ITER; ADD1]; +SWITCH_TAC` w = ITER n (rho_node1 FF) v`; +ASM_SIMP_TAC[ARITH_RULE` ~(n = 0) ==> n - 1 + 1 = n `]; +REPEAT STRIP_TAC; +MP_TAC (SPEC` lp:real^3` (GEN `x:real^3` FACE_MAP_AT_TURNING_DART1)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +EXPAND_TAC "w"; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC `n:num`; +ASM_REWRITE_TAC[]; +DISCH_THEN (SUBST1_TAC o SYM); +EXPAND_TAC "fv"; +REWRITE_TAC[face]; +EXPAND_TAC "HS"; +MATCH_MP_TAC Wrgcvdr_cizmrrh.IN_ORBIT_MAP_IMP_F_Y; +MATCH_MP_TAC Hypermap.lemma_in_subset; +EXISTS_TAC` SS:real^3 # real^3 -> bool`; +ASM_REWRITE_TAC[GSYM face]; +DOWN THEN DOWN THEN PHA; +REWRITE_TAC[Hypermap.lemma_in_subset]; + + + +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC`v:real^3 `)); +SUBGOAL_THEN` w:real^3 IN V ` MP_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +STRIP_TAC; +SUBGOAL_THEN` ! j. j < n ==> ITER j (face_map HS ) (v, rho_node1 FF v) = +ITER j (rho_node1 FF) v, ITER (j + 1) (rho_node1 FF) v` MP_TAC; +INDUCT_TAC; +REWRITE_TAC[ITER; GSYM ADD1]; +NHANH (ARITH_RULE` SUC j < n ==> j < n `); +FIRST_X_ASSUM NHANH; +SIMP_TAC[ITER]; +ABBREV_TAC` vi = ITER j (rho_node1 FF) v `; +ABBREV_TAC` vj = ITER (j + 1) (rho_node1 FF) v`; +STRIP_TAC; + + + +SUBGOAL_THEN` face_map (hypermap (HYP (vec 0,V,E UNION {{v, w:real^3}}))) (vi, vj) = + face_map (hypermap (HYP (vec 0,V,E))) (vi, vj:real^3)` MP_TAC; +MATCH_MP_TAC FACE_MAP_ADD_SET2_EQ; +ASSUME_TAC2 LOCAL_FAN_ORBIT_MAP_VITERFF; +FIRST_X_ASSUM (MP_TAC o (SPEC` j: num`)); +ASM_REWRITE_TAC[]; +UNDISCH_TAC` local_fan (V,E,FF) `; +PHA; +NHANH Local_lemmas.LOCAL_FAN_IN_FF_IN_ORD_PAIRS2; +SIMP_TAC[IN_DARTS_EXTENSION]; +STRIP_TAC; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_DIS_ELMS23; +FIRST_ASSUM (MP_TAC o (SPECL [`j + 1 `;` n: num `])); +PHA; +ANTS_TAC; +ASM_REWRITE_TAC[GSYM ADD1]; +ASM_SIMP_TAC[]; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPECL [` 0`;` j + 1 `])); +ANTS_TAC; +ARITH_TAC; +ANTS_TAC; +MATCH_MP_TAC LT_TRANS; +EXISTS_TAC` n:num`; +ASM_REWRITE_TAC[GSYM ADD1]; +ASM_SIMP_TAC[ITER]; +STRIP_TAC; +ASSUME_TAC2 Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC PROVE_SLICING_FAN; +SWITCH_TAC` w = ITER n (rho_node1 FF) v `; +ASM_REWRITE_TAC[]; + + +ASM_SIMP_TAC[]; +ASSUME_TAC2 LOCAL_FAN_ORBIT_MAP_VITERFF; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` j:num `)); +UNDISCH_TAC` local_fan (V,E,FF) `; +PHA; +NHANH LOCAL_FACE_MAP_RHO_NODE1; +ASM_SIMP_TAC[GSYM ADD1]; +EXPAND_TAC "vj"; +REWRITE_TAC[GSYM ADD1; ITER]; + + + + +SUBGOAL_THEN` face_map (hypermap (HYP (vec 0,V,E UNION {{v, w}}))) (w,v) = + v,rho_node1 FF v` MP_TAC; +ONCE_REWRITE_TAC[INSERT_COMM]; +MATCH_MP_TAC FACE_MAP_SLICING_HYP_TRANS_POINT; +SWITCH_TAC` w = ITER n (rho_node1 FF) v `; +ONCE_REWRITE_TAC[INSERT_COMM]; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` !z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t:real^3}`; +SIMP_TAC[INSERT_COMM]; + + + + +SWITCH_TAC` w = ITER n (rho_node1 FF) v `; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +ASSUME_TAC2 LOCAL_FAN_ORBIT_MAP_VITERFF; +FIRST_ASSUM (MP_TAC o (SPEC `n - 1 `)); +ASM_CASES_TAC` n = 0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +REPLICATE_TAC 4 DOWN; +ASM_REWRITE_TAC[ITER]; +ASSUME_TAC2 (ARITH_RULE` ~( n = 0) ==> n - 1 + 1 = n `); +FIRST_ASSUM SUBST1_TAC; +ASM_REWRITE_TAC[]; +ABBREV_TAC` xx = ITER (n - 1) (rho_node1 FF) v `; +STRIP_TAC; +MP_TAC (SPEC` xx:real^3 ` (GEN`x:real^3 ` FACE_MAP_AT_TURNING_DART1)); +ANTS_TAC; +ASM_REWRITE_TAC[]; + + +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` ITER (n + 1) (face_map HS) (v, rho_node1 FF v) = (v, rho_node1 FF v ) ` MP_TAC; +SUBGOAL_THEN` ITER (n - 1) (face_map HS) (v,rho_node1 FF v) = + ITER (n - 1) (rho_node1 FF) v,ITER (n - 1 + 1) (rho_node1 FF) v` MP_TAC; +FIRST_ASSUM MATCH_MP_TAC; +MATCH_MP_TAC (ARITH_RULE` ~( n = 0) ==> n - 1 < n `); +FIRST_X_ASSUM ACCEPT_TAC; +ASM_REWRITE_TAC[GSYM ADD1]; +STRIP_TAC; +EXPAND_TAC "n"; +REWRITE_TAC[GSYM ADD1; ITER]; +ASM_REWRITE_TAC[]; + + + +MP_TAC (ARITH_RULE` 0 < n + 1 `); +PHA; +NHANH Lvducxu.ITER_CYCLIC_ORBIT; +ASM_REWRITE_TAC[GSYM face]; + +STRIP_TAC; +UNDISCH_TAC` x:real^3 # real^3 IN fv `; +ASM_REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; + +ASM_CASES_TAC` n' = n:num `; +DISJ1_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; + +ASM_REWRITE_TAC[]; +EXPAND_TAC "n"; +REWRITE_TAC[GSYM ADD1; ITER]; +ASSUME_TAC2 (ARITH_RULE`~( n = 0) ==> n - 1 < n `); +DOWN; +FIRST_X_ASSUM NHANH; +ASM_SIMP_TAC[]; + + +DISJ2_TAC; +EXISTS_TAC` n':num`; +ASSUME_TAC2 (ARITH_RULE` n' < n + 1 /\ ~(n' = n) ==> n' < n `); +DOWN; +FIRST_ASSUM NHANH; +ASM_SIMP_TAC[]; +REPEAT STRIP_TAC; + +ASSUME_TAC2 Local_lemmas.LOFA_IMP_DIS_ELMS23; +FIRST_X_ASSUM (MP_TAC o SPECL[`m:num `;` n:num `]); +ANTS_TAC; +UNDISCH_TAC` n' < n + 1 `; +UNDISCH_TAC` m< n' + 1 `; +UNDISCH_TAC` ~( n' = n:num) `; +ARITH_TAC; +ANTS_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +ASM_REWRITE_TAC[]]);; + + + + + + +let TWO_EQ_SYSTEM_THM = prove_by_refinement ( +` FAN (vec 0,V,E) /\ graph E /\ UNIONS E SUBSET V ==> + dart_of_fan (V,E), + res (e_fan_pair (V,E)) (dart1_of_fan (V,E)), + res (n_fan_pair (V,E)) (dart1_of_fan (V,E)), + res (f_fan_pair (V,E)) (dart1_of_fan (V,E)) = + darts_of_hyp E V, + ee_of_hyp (vec 0,V,E), + nn_of_hyp (vec 0,V,E), + ff_of_hyp (vec 0,V,E)`, +[REWRITE_TAC[PAIR_EQ]; +STRIP_TAC; +SUBGOAL_THEN` dart_of_fan (V,E) = darts_of_hyp E V ` MP_TAC; +REWRITE_TAC[dart_of_fan; darts_of_hyp; ord_pairs; self_pairs]; +DOWN; +NHANH (REWRITE_RULE[RIGHT_FORALL_IMP_THM] (GEN `v: A` Wrgcvdr_cizmrrh.UNI_E_IMP_EE_EQ_SET_OF_EDGE)); +SIMP_TAC[EXTENSION; IN_UNION]; +MESON_TAC[]; +SIMP_TAC[]; + +STRIP_TAC; +REWRITE_TAC[res; FUN_EQ_THM; ee_of_hyp2]; +CONJ_TAC; +GEN_TAC; +REWRITE_TAC[dart1_of_fan; darts_of_hyp; IN_UNION; ord_pairs]; +ASM_CASES_TAC` x IN {a,b | {a, b:real^3} IN E}`; +ASM_REWRITE_TAC[]; +PAT_ONCE_REWRITE_TAC`\p. P p = PP `[GSYM PAIR]; +PURE_ONCE_REWRITE_TAC[e_fan_pair]; +REWRITE_TAC[]; + + +ASM_REWRITE_TAC[self_pairs; IN_ELIM_THM]; +MESON_TAC[PAIR_EQ; FST; SND]; + + + +CONJ_TAC; +REWRITE_TAC[nn_of_hyp3; dart1_of_fan]; +GEN_TAC; +ASM_CASES_TAC` x IN {v,w | {v:real^3, w} IN E}`; +ASM_REWRITE_TAC[darts_of_hyp; ord_pairs; self_pairs; IN_UNION; EE]; +DOWN; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +ASM_REWRITE_TAC[n_fan_pair]; +DOWN_TAC; +REWRITE_TAC[graph]; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` {v, w:real^3}`)); +ANTS_TAC; +DOWN_TAC; +SIMP_TAC[IN]; + +REWRITE_TAC[SET2_HAS_SIZE2]; +STRIP_TAC; +SUBGOAL_THEN` ~( {w | {v, w:real^3} IN E} = {} ) ` MP_TAC; +UNDISCH_TAC` {v:real^3,w} IN E `; +SET_TAC[]; + + + + +SIMP_TAC[]; +NHANH (MESON[PAIR_EQ]` (?v'. v' IN V /\ {w | {v', w} IN E} = {} /\ v,w = v',v') +==> {w | {v, w} IN E} = {} `); +SIMP_TAC[PAIR_EQ]; +STRIP_TAC; +UNDISCH_TAC` {v, w:real^3} IN E `; +UNDISCH_TAC` FAN (vec 0, V:real^3 -> bool, E) `; +PHA; +NHANH Wrgcvdr_cizmrrh.ITER_AZIM_CYCLE_EQ_ITER_SIGMA; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` w:real^3 `)); +ANTS_TAC; +REWRITE_TAC[EE; IN_ELIM_THM]; +FIRST_ASSUM ACCEPT_TAC; +DISCH_THEN (MP_TAC o (SPEC` 1 `)); +SIMP_TAC[ITER12; EE]; + + + + +ASM_REWRITE_TAC[darts_of_hyp; IN_UNION; TAUT`~( a \/ b) \/ b <=> ~ a \/ b`]; +ASM_REWRITE_TAC[ord_pairs]; +(* ------------------ *) +GEN_TAC; +REWRITE_TAC[dart1_of_fan; f_fan_pair; Wrgcvdr_cizmrrh.ff_of_hyp3; f_fan_pair]; +ASM_CASES_TAC` (x:real^3#real^3) IN {v,w | {v, w} IN E}`; +ASM_REWRITE_TAC[darts_of_hyp; IN_UNION; TAUT` ~(a \/ b) \/ b <=> ~ a \/ b `; ord_pairs]; + +DOWN_TAC; +REWRITE_TAC[graph; IN_ELIM_THM]; +STRIP_TAC; +SUBGOAL_THEN` ~ ( x IN self_pairs E (V:real^3 -> bool))` MP_TAC; +REWRITE_TAC[self_pairs; IN_ELIM_THM]; +DOWN THEN DOWN THEN PHA; +REWRITE_TAC[IN]; +FIRST_X_ASSUM NHANH; +SIMP_TAC[SET2_HAS_SIZE2; PAIR_EQ]; +MESON_TAC[]; + + +ASM_SIMP_TAC[f_fan_pair; PAIR_EQ]; +STRIP_TAC; +UNDISCH_TAC` {v, w:real^3} IN E `; +UNDISCH_TAC` FAN (vec 0, V:real^3 -> bool, E) `; +ONCE_REWRITE_TAC[INSERT_COMM]; +PHA; +NHANH Fan_misc.INVERSE_SIGMA_FAN_EQ_INVERSE1_SIGMA_FAN; +NHANH Wrgcvdr_cizmrrh.IVS_AZIM_EQ_INVERSE_SIGMA_FAN; +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[darts_of_hyp; IN_UNION; TAUT` ~( a \/ b) \/ b <=> ~ a \/ b `]; +ASM_REWRITE_TAC[ord_pairs]]);; + + + + + +let LOFA_FST_IDENTIFY = prove( +` local_fan (V,E,FF) /\ x IN FF /\ y IN FF /\ FST x = FST y ==> x = y `, +NHANH Local_lemmas.LOFA_IMP_BIJ_FF_V THEN REWRITE_TAC[BIJ; INJ] THEN +MESON_TAC[]);; + + + +let CARD_IS_LEAST_CYCLE = prove_by_refinement ( +` local_fan (V,E,FF) /\ v IN V /\ +ITER n (rho_node1 FF) v = v /\ ~( n = 0) +==> CARD V <= n`, +[STRIP_TAC; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_DIS_ELMS23; +ASM_CASES_TAC` n < CARD (V:real^3 -> bool) `; +FIRST_X_ASSUM (MP_TAC o (SPECL [`0`;` n:num`])); +PHA; +ANTS_TAC; +ASM_REWRITE_TAC[]; +ASM_ARITH_TAC; +ASM_REWRITE_TAC[ITER]; +DOWN; +ARITH_TAC]);; + + +(* = *) +(* = *) + + +let HAFL_CIRCLE_FORM_LOCAL_FAN = prove_by_refinement +(`(local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E)) /\ + HS = hypermap ( HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v, rho_node1 FF v) + ==> local_fan (v_prime V fv, e_prime (E UNION {{v, w}}) fv, fv) `, +[NHANH PROVE_SLICING_FAN; +STRIP_TAC; +SUBGOAL_THEN` (v,rho_node1 FF v) IN darts_of_hyp (E UNION {{v,w}}) V` ASSUME_TAC; +REWRITE_TAC[darts_of_hyp]; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2; +DOWN THEN STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` v:real^3 `)); +DOWN; +UNDISCH_TAC` local_fan (V,E,FF) `; +PHA; +NHANH Local_lemmas.LOCAL_FAN_IN_FF_IN_ORD_PAIRS2; +REWRITE_TAC[IN_ELIM_THM; IN_UNION; ord_pairs]; +STRIP_TAC; +DISJ1_TAC; +EXISTS_TAC` v:real^3 `; +EXISTS_TAC` rho_node1 FF v `; +ASM_REWRITE_TAC[]; + +MP_TAC LOFA_HYP_UNION_CARD_GT2; +ANTS_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; + + + +SUBGOAL_THEN` simple_hypermap (hypermap (HYP (vec 0, v_prime V fv, e_prime (E UNION {{v, w}} ) fv)))` MP_TAC; +REWRITE_TAC[simple_hypermap]; +SUBGOAL_THEN` FAN (vec 0:real^3,v_prime (V:real^3 -> bool) fv,e_prime (E UNION {{v,w}} ) fv) ` MP_TAC; +MATCH_MP_TAC Wrgcvdr_cizmrrh.IMP_FAN_V_PRIME_E_PRIME; +ASM_REWRITE_TAC[]; +EXISTS_TAC` (v, rho_node1 FF v) `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC `FAN (vec 0, V:real^3 -> bool, E UNION {{v, w}})`; +NHANH Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP; +ASM_SIMP_TAC[]; + + +SWITCH_TAC` HS = hypermap (HYP (vec 0,V,E UNION {{v, w: real^3}})) `; +SWITCH_TAC` fv = face HS (v,rho_node1 FF v) `; + +STRIP_TAC; +SUBGOAL_THEN` 1 < CARD (fv:real^3 # real^3 -> bool) ` MP_TAC; +ASM_ARITH_TAC; +SUBGOAL_THEN` fv = face (hypermap (HYP (vec 0,V,(E UNION {{v,w:real^3}})))) (v,rho_node1 FF v)` MP_TAC; +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN` FAN (vec 0, V, E UNION {{v,w:real^3}}) ` MP_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +PHA; +NHANH Lvducxu.DARTS_E_PRIME_GT1_SWITCH; +STRIP_TAC; +UNDISCH_TAC` FAN (vec 0,v_prime V fv,e_prime (E UNION {{v:real^3, w}}) fv) `; +NHANH Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP; +SIMP_TAC[]; +STRIP_TAC; +SWITCH_TAC` fv = + face (hypermap (HYP (vec 0,V,E UNION {{v, w}}))) (v,rho_node1 FF v)`; +ASM_REWRITE_TAC[]; + + +REWRITE_TAC[IN_UNION]; +GEN_TAC THEN STRIP_TAC; +DOWN; +ASSUME_TAC2 LOCAL_FAN_SIMPLE_HYP; + +MP_TAC DETERMINE_FV; +ANTS_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +REWRITE_TAC[IN_ELIM_THM; IN_INSERT]; +FIRST_X_ASSUM (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; + +MP_TAC (SPECL [`E UNION {{v,w:real^3 }} `; ` fv: real^3 # real^3 -> bool `;` v, rho_node1 FF v`;` vec 0: real^3 `] ( +GENL [`E:(real^3 -> bool) -> bool `;` FF: real^3 # real^3 -> bool`; `x:real^3 # real^3`;`v:real^3`] Lvducxu.LOCALIZE_PRESERVE_FACE)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` v,rho_node1 FF v IN darts_of_hyp (E UNION {{v, w}}) V`; +UNDISCH_TAC` FAN (vec 0,V,E UNION {{v, w:real^3}})`; +NHANH Lvducxu.FAN_DART_DARTS; +ASM_SIMP_TAC[]; +STRIP_TAC; +DISCH_TAC; +SUBGOAL_THEN` x IN face + (hypermap (HYP (vec 0,v_prime V fv,e_prime (E UNION {{v, w}}) fv))) + (v,rho_node1 FF v) ` MP_TAC; +UNDISCH_TAC` fv = + face + (hypermap (HYP (vec 0,v_prime V fv,e_prime (E UNION {{v, w}}) fv))) + (v,rho_node1 FF v) `; +DISCH_THEN (SUBST1_TAC o SYM); +EXPAND_TAC "fv"; +REWRITE_TAC[IN_ELIM_THM; IN_INSERT]; +ASM_REWRITE_TAC[]; + +NHANH Hypermap.lemma_face_identity; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +ASM_SIMP_TAC[]; +STRIP_TAC; +REWRITE_TAC[EXTENSION; IN_INSERT; NOT_IN_EMPTY]; +GEN_TAC; +SWITCH_TAC` fv = + face + (hypermap (HYP (vec 0,v_prime V fv,e_prime (E UNION {{v, w}}) fv))) + (v,rho_node1 FF v) `; +ASM_REWRITE_TAC[]; +EQ_TAC; +DOWN THEN DOWN; +SIMP_TAC[IN_INTER; Wrgcvdr_cizmrrh.X_IN_HYP_ORBITS]; +MESON_TAC[Wrgcvdr_cizmrrh.X_IN_HYP_ORBITS]; +UNDISCH_TAC` x = w,v \/ + (?n. (!m. m < n + 1 ==> ~(ITER m (rho_node1 FF) v = w)) /\ + x = ITER n (rho_node1 FF) v,ITER (n + 1) (rho_node1 FF) v)`; +STRIP_TAC; +REWRITE_TAC[IN_INTER]; +UNDISCH_TAC` FAN (vec 0,v_prime V fv,e_prime (E UNION {{v, w:real^3}}) fv) `; +PHA; +NGOAC; +NHANH Wrgcvdr_cizmrrh.IN_NODE_IMP_FIRST_EQ; +STRIP_TAC; +DOWN; +USE_FIRST` (w,v) INSERT + {ITER n (rho_node1 FF) v,ITER (n + 1) (rho_node1 FF) v | n | !m. m < + n + 1 + ==> ~ + (ITER m + (rho_node1 + FF) + v = + w)} = + fv ` (SUBST1_TAC o SYM); +REWRITE_TAC[IN_INSERT; IN_ELIM_THM]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` FST (x':real^3 # real^3) = FST (x:real^3 # real^3)`; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM (MP_TAC o (SPEC` n:num`)); +ANTS_TAC; +ARITH_TAC; +SIMP_TAC[]; + + +REWRITE_TAC[IN_INTER]; +UNDISCH_TAC` FAN (vec 0,v_prime V fv,e_prime (E UNION {{v, w:real^3}}) fv) `; +PHA; +NGOAC; +NHANH Wrgcvdr_cizmrrh.IN_NODE_IMP_FIRST_EQ; +STRIP_TAC; +DOWN; +USE_FIRST` (w,v) INSERT + {ITER n (rho_node1 FF) v,ITER (n + 1) (rho_node1 FF) v | n | !m. m < + n + 1 + ==> ~ + (ITER m + (rho_node1 + FF) + v = + w)} = + fv ` (SUBST1_TAC o SYM); +REWRITE_TAC[IN_INSERT; IN_ELIM_THM]; +STRIP_TAC; +UNDISCH_TAC` FST (x':real^3 # real^3) = FST (x:real^3 # real^3)`; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM (MP_TAC o (SPEC` n:num`)); +ANTS_TAC; +ARITH_TAC; +SIMP_TAC[]; + +UNDISCH_TAC` FST (x':real^3 # real^3) = FST (x:real^3 # real^3)`; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ORBIT_MAP_V; +DOWN; +NHANH Local_lemmas.LOOP_SET_DETER_FIRTS_ELMS; +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC`v: real^3 `)); +UNDISCH_TAC` w:real^3 IN V `; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +ASM_CASES_TAC` ~( n < CARD (V:real^3 -> bool))`; +ASSUME_TAC2 (ARITH_RULE` ~( n < CARD (V:real^3 -> bool)) /\ n'' < CARD V ==> n'' < n + 1 `); +USE_FIRST` !m. m < n + 1 ==> ~(ITER m (rho_node1 FF) v = w) ` (ASSUME_TAC2 o (SPEC`n'': num `)); +DOWN; +ASM_REWRITE_TAC[]; + + +ASM_CASES_TAC` ~( n' < CARD (V:real^3 -> bool)) `; +ASSUME_TAC2 (ARITH_RULE` ~( n' < CARD (V:real^3 -> bool)) /\ n'' < CARD V ==> n'' < n' + 1 `); +USE_FIRST` !m. m < n' + 1 ==> ~(ITER m (rho_node1 FF) v = w) ` (ASSUME_TAC2 o (SPEC`n'': num `)); +DOWN; +ASM_REWRITE_TAC[]; +DOWN THEN DOWN; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_DIS_ELMS23; +PHA; +ASM_CASES_TAC` n < n':num `; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPECL[` n:num`;` n':num`])); +DISCH_THEN ASSUME_TAC2; +DOWN; +ASM_REWRITE_TAC[]; +ASM_CASES_TAC` n' < n:num `; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPECL[` n':num `;` n:num`])); +DISCH_THEN ASSUME_TAC2; +DOWN THEN ASM_REWRITE_TAC[]; +ASSUME_TAC2 (ARITH_RULE` ~( n < n':num) /\ ~(n' < n) ==> n' = n `); +ASM_REWRITE_TAC[]; + +(* ================================== *) + + + + + + + + + + + + +MP_TAC DETERMINE_FV; +ANTS_TAC; +ASM_REWRITE_TAC[]; +DISCH_THEN (ASSUME_TAC o SYM); + +(* ================================== *) + + + + +UNDISCH_TAC` x IN {v,w | w,v IN (fv:real^3 # real^3 -> bool)} `; +EXPAND_TAC "fv"; +REWRITE_TAC[IN_ELIM_THM; IN_INSERT]; +ASM_REWRITE_TAC[]; +STRIP_TAC; + + + + + + + +SUBGOAL_THEN `x IN dart (hypermap (HYP (vec 0,v_prime V fv,e_prime (E UNION {{v, w}}) fv))) ` MP_TAC; +ASM_REWRITE_TAC[IN_UNION; IN_ELIM_THM]; +DISJ2_TAC; +EXISTS_TAC` v:real^3`; +EXISTS_TAC` w:real^3 `; +DOWN THEN DOWN; +SIMP_TAC[PAIR_EQ]; +EXPAND_TAC "fv"; +REWRITE_TAC[IN_INSERT]; + + + + +NHANH Hypermap.lemma_node_subset; +ASM_REWRITE_TAC[]; +STRIP_TAC; +REWRITE_TAC[EXTENSION; IN_INTER]; +GEN_TAC; +EQ_TAC; +STRIP_TAC; +MP_TAC ( +ISPECL [`vec 0: real^3 `; ` v_prime (V:real^3 -> bool) (fv:real^3#real^3->bool) `; +`e_prime (E UNION {{v:real^3, w}}) (fv: real^3#real^3->bool) `;` x': real^3#real^3`; +`(v':real^3, w':real^3) `] (GEN_ALL Wrgcvdr_cizmrrh.IN_NODE_IMP_FIRST_EQ)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +REPLICATE_TAC 3 DOWN; +REWRITE_TAC[SUBSET]; +STRIP_TAC; +FIRST_ASSUM NHANH; +REWRITE_TAC[IN_UNION]; +STRIP_TAC; +UNDISCH_TAC` w':real^3, v':real^3 = w:real^3, v:real^3 `; +SIMP_TAC[PAIR_EQ]; +REPEAT STRIP_TAC; +UNDISCH_TAC` x':real^3#real^3 IN fv `; +UNDISCH_TAC` face (hypermap (HYP (vec 0,V,E UNION {{v, w}}))) (v,rho_node1 FF v) = + fv`; +STRIP_TAC; +EXPAND_TAC "fv"; +NHANH Hypermap.lemma_face_identity; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` x' IN + face + (hypermap (HYP (vec 0,v_prime V fv,e_prime (E UNION {{v, w}}) fv))) + (v,w) `; +NHANH Hypermap.lemma_face_identity; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +SUBGOAL_THEN` fv = +face (hypermap (HYP (vec 0,v_prime V fv,e_prime (E UNION {{v, w}}) fv))) x'` MP_TAC; +MATCH_MP_TAC Lvducxu.LOCALIZE_PRESERVE_FACE; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` v, rho_node1 FF v IN dart HS ` MP_TAC; +EXPAND_TAC "HS"; +UNDISCH_TAC` FAN (vec 0,V,E UNION {{v, w:real^3}})`; +NHANH Lvducxu.FAN_DART_DARTS; +SIMP_TAC[]; +STRIP_TAC; +MATCH_MP_TAC IN_DARTS_EXTENSION; +MATCH_MP_TAC LOCAL_RHO_NODE_PAIR_E; +ASM_REWRITE_TAC[]; +NHANH_PAT`\x. x ==> y ` Hypermap.lemma_face_subset; +ASM_REWRITE_TAC[SUBSET]; +DOWN THEN DOWN; +MESON_TAC[]; +STRIP_TAC; +SUBGOAL_THEN ` (v:real^3, w:real^3) IN +face + (hypermap (HYP (vec 0,v_prime V fv,e_prime (E UNION {{v, w}}) fv))) + (v,w)` MP_TAC; +REWRITE_TAC[Hypermap.face_refl]; + +DOWN THEN DOWN; +DISCH_THEN (ASSUME_TAC o SYM); +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +UNDISCH_TAC` (w,v) INSERT + {ITER n (rho_node1 FF) v,ITER (n + 1) (rho_node1 FF) v | n | !m. m < + n + 1 + ==> ~ + (ITER m + (rho_node1 + FF) + v = + w)} = + fv`; +DISCH_TAC; +EXPAND_TAC "fv"; +ASM_REWRITE_TAC[IN_INSERT; PAIR_EQ]; + +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +SUBGOAL_THEN` ~((v:real^3,w:real^3) IN FF) ` MP_TAC; +MATCH_MP_TAC CROSS_PAIR_NOT_IN_FF; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 LOCAL_FAN_ORBIT_MAP_VITERFF; +DOWN THEN DOWN; +MESON_TAC[]; +(* ======================= *) + + +STRIP_TAC THEN STRIP_TAC; +UNDISCH_TAC` x' IN {(v:real^3 ,w:real^3) | w,v IN fv}`; +EXPAND_TAC "fv"; +REWRITE_TAC[IN_ELIM_THM; IN_INSERT]; +STRIP_TAC; +DOWN THEN DOWN; +UNDISCH_TAC` w',v' = (w:real^3,v:real^3) `; +ASM_SIMP_TAC[PAIR_EQ]; + +UNDISCH_TAC` w'',v'' = ITER n (rho_node1 FF) v,ITER (n + 1) (rho_node1 FF) v`; +UNDISCH_TAC` FST (x':real^3#real^3) = v'`; +ASM_SIMP_TAC[PAIR_EQ]; +UNDISCH_TAC` w',v' = w:real^3, v:real^3 `; +SIMP_TAC[PAIR_EQ]; + +ASSUME_TAC2 Local_lemmas.LOFA_IMP_LT_CARD_SET_V; +REPEAT STRIP_TAC; +ASSUME_TAC (ARITH_RULE` ~( n + 1 = 0) `); +MP_TAC (SPEC` n + 1 ` (GEN `n:num ` CARD_IS_LEAST_CYCLE)); +ANTS_TAC; +DOWN THEN DOWN; +ASM_REWRITE_TAC[]; +SIMP_TAC[EQ_SYM_EQ]; +MESON_TAC[]; + + +STRIP_TAC; +UNDISCH_TAC` w:real^3 IN V `; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; + +ASSUME_TAC2 (ARITH_RULE` CARD (V:real^3 -> bool) <= n + 1 /\ n' < CARD V +==> n' < n + 1 `); +ASM_MESON_TAC[]; + +SIMP_TAC[IN_INSERT; NOT_IN_EMPTY; Wrgcvdr_cizmrrh.X_IN_HYP_ORBITS]; + + + + + + + + + + + + +(* =============================== *) + +REWRITE_TAC[EXTENSION; IN_INSERT; NOT_IN_EMPTY; IN_INTER]; +GEN_TAC; +EQ_TAC; +ONCE_REWRITE_TAC[CONJ_SYM]; +STRIP_TAC; +DOWN; +UNDISCH_TAC` FAN (vec 0,v_prime V fv,e_prime (E UNION {{v:real^3, w}}) fv)`; +PHA; +NHANH Wrgcvdr_cizmrrh.IN_NODE_IMP_FIRST_EQ; + + + + +SUBGOAL_THEN` x IN dart + (hypermap (HYP (vec 0,v_prime V fv,e_prime (E UNION {{v:real^3, w}}) fv)))` MP_TAC; +ASM_REWRITE_TAC[IN_UNION]; +DISJ2_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` ITER (n + 1) (rho_node1 FF) v `; +EXISTS_TAC` ITER n (rho_node1 FF) v `; +UNDISCH_TAC` w',v' = ITER n (rho_node1 FF) v,ITER (n + 1) (rho_node1 FF) v `; +SIMP_TAC[PAIR_EQ]; +EXPAND_TAC "fv"; +STRIP_TAC; +REWRITE_TAC[IN_INSERT; IN_ELIM_THM]; +DISJ2_TAC; +EXISTS_TAC`n:num`; +ASM_REWRITE_TAC[]; +NHANH Hypermap.lemma_node_subset; +REWRITE_TAC[SUBSET]; +STRIP_TAC; +FIRST_ASSUM NHANH; +ASM_REWRITE_TAC[IN_UNION]; +STRIP_TAC; + + +SUBGOAL_THEN` (v,rho_node1 FF v) IN dart (hypermap (HYP (vec 0,V,E UNION {{v, w}})))` MP_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` FAN (vec 0,V,E UNION {{v, w:real^3}}) `; +NHANH Lvducxu.FAN_DART_DARTS; +ASM_SIMP_TAC[]; + +STRIP_TAC; +UNDISCH_TAC` face HS (v,rho_node1 FF v) = fv `; +DISCH_THEN (MP_TAC o SYM); +DOWN; +UNDISCH_TAC` FAN (vec 0,V,E UNION {{v, w:real^3}})`; +PHA; +ASM_REWRITE_TAC[]; +EXPAND_TAC "HS"; +NHANH Lvducxu.LOCALIZE_PRESERVE_FACE; +ASM_REWRITE_TAC[]; + +STRIP_TAC; +UNDISCH_TAC` x':real^3#real^3 IN fv `; +FIRST_ASSUM (SUBST1_TAC); +NHANH Hypermap.lemma_face_identity; + +FIRST_X_ASSUM (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` x' IN + face + (hypermap (HYP (vec 0,v_prime V fv,e_prime (E UNION {{v, w}}) fv))) + x`; +NHANH Hypermap.lemma_face_identity; +STRIP_TAC; +STRIP_TAC; +MP_TAC (ISPECL [` (hypermap (HYP (vec 0,v_prime V fv,e_prime (E UNION {{v, w:real^3}}) fv))) `;` x:real^3# real^3 `] Hypermap.face_refl); +ASM_REWRITE_TAC[]; +FIRST_ASSUM (SUBST1_TAC o SYM); +UNDISCH_TAC` (w,v) INSERT + {ITER n (rho_node1 FF) v,ITER (n + 1) (rho_node1 FF) v | n | !m. m < + n + 1 + ==> ~ + (ITER m + (rho_node1 + FF) + v = + w)} = + fv `; +STRIP_TAC; +FIRST_ASSUM (SUBST1_TAC o SYM); +REWRITE_TAC[IN_INSERT]; +STRIP_TAC; +UNDISCH_TAC`w',v' = ITER n (rho_node1 FF) v,ITER (n + 1) (rho_node1 FF) v `; +DOWN; +SIMP_TAC[PAIR_EQ]; +STRIP_TAC THEN STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[GSYM ADD1; ITER]; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2; +DOWN THEN STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC`v: real^3`)); +STRIP_TAC; + +ASSUME_TAC2 CROSS_PAIR_NOT_IN_FF; +DOWN; +UNDISCH_TAC` v,rho_node1 FF v IN FF `; +ASM_REWRITE_TAC[]; +REPLICATE_TAC 3 DOWN; +MESON_TAC[]; + +(* ============================ *) +(* ============================ *) + + + + +DOWN; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +DOWN; +UNDISCH_TAC` w',v' = ITER n (rho_node1 FF) v,ITER (n + 1) (rho_node1 FF) v `; +REWRITE_TAC[PAIR_EQ; GSYM ADD1; ITER]; +STRIP_TAC; + +(* 33 [`v' = rho_node1 FF (ITER n (rho_node1 FF) v)`] + +`v' = ITER n' (rho_node1 FF) v /\ + w' = rho_node1 FF (ITER n' (rho_node1 FF) v) + ==> x' = v',w'` + +*) + + +IMP_TAC; +DISCH_THEN (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[]; + + +(* *) + + +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE; +FIRST_X_ASSUM (MP_TAC o (SPEC` ITER n (rho_node1 FF) v `)); +ANTS_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ORBIT_MAP_VITER; +FIRST_X_ASSUM MATCH_MP_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +MESON_TAC[]; + + + + + + + + +(* =============== *) +(* =============== *) + +DOWN THEN DOWN; +REWRITE_TAC[IN_ELIM_THM]; +EXPAND_TAC "fv"; +REWRITE_TAC[IN_ELIM_THM; IN_INSERT]; +STRIP_TAC; +DOWN THEN DOWN; +UNDISCH_TAC` w',v' = ITER n (rho_node1 FF) v,ITER (n + 1) (rho_node1 FF) v `; + +SIMP_TAC[PAIR_EQ]; +REPEAT STRIP_TAC; +MP_TAC (SPEC` n + 1 ` (GEN `n:num ` CARD_IS_LEAST_CYCLE)); +ANTS_TAC; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[ARITH_RULE` ~( n + 1 = 0) `]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_LT_CARD_SET_V; +UNDISCH_TAC` (w:real^3) IN V `; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` !m. m < n + 1 ==> ~(ITER m (rho_node1 FF) v = w) `; +MESON_TAC[ARITH_RULE` a < b /\ b <= c ==> a < (c:num) `]; + + + + + +(* OK *) + +ASM_CASES_TAC` CARD (V:real^3 -> bool) <= n + 1 `; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_LT_CARD_SET_V; +UNDISCH_TAC` w:real^3 IN V `; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +UNDISCH_TAC` !m. m < n + 1 ==> ~(ITER m (rho_node1 FF) v = w)`; +UNDISCH_TAC` CARD (V:real^3 -> bool) <= n + 1 `; +MESON_TAC[ARITH_RULE` a < b /\ b <= n + 1 ==> a < n + 1 `]; + + +(* ???? *) +ASSUME_TAC2 Local_lemmas.LOFA_IMP_DIS_ELMS23; +FIRST_X_ASSUM (MP_TAC o (SPECL[` 0`; `n + 1 `])); +ANTS_TAC; +ARITH_TAC; +ANTS_TAC; +DOWN THEN ARITH_TAC; +DOWN THEN DOWN; +REWRITE_TAC[ITER]; +MESON_TAC[]; + +(* ok *) + + +ASM_CASES_TAC` CARD (V:real^3 -> bool) <= n' + 1 `; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_LT_CARD_SET_V; +UNDISCH_TAC` w:real^3 IN V `; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +UNDISCH_TAC` !m. m < n' + 1 ==> ~(ITER m (rho_node1 FF) v = w)`; +UNDISCH_TAC` CARD (V:real^3 -> bool) <= n' + 1 `; +MESON_TAC[ARITH_RULE` a < b /\ b <= n + 1 ==> a < n + 1 `]; + +(* * *) +ASM_CASES_TAC` CARD (V:real^3 -> bool) <= n + 1 `; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_LT_CARD_SET_V; +UNDISCH_TAC` w:real^3 IN V `; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +UNDISCH_TAC` !m. m < n + 1 ==> ~(ITER m (rho_node1 FF) v = w)`; +UNDISCH_TAC` CARD (V:real^3 -> bool) <= n + 1 `; +MESON_TAC[ARITH_RULE` a < b /\ b <= n + 1 ==> a < n + 1 `]; + + + + + + + + +DOWN THEN DOWN; +REWRITE_TAC[ARITH_RULE` ~( a <= n + 1 ) <=> n + 1 < a `]; +DOWN THEN DOWN; +UNDISCH_TAC` w',v' = ITER n (rho_node1 FF) v,ITER (n + 1) (rho_node1 FF) v `; +SIMP_TAC[PAIR_EQ]; + +REPEAT STRIP_TAC; +ASM_CASES_TAC` n + 1 < n' + 1 \/ n' + 1 < n + 1 `; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_DIS_ELMS23; +REPLICATE_TAC 5 DOWN; +MESON_TAC[]; + +DOWN; +REWRITE_TAC[DE_MORGAN_THM; ARITH_RULE` ~( a < b) /\ ~( b < a:num) <=> a = b `; ARITH_RULE` a + 1 = b + 1 <=> a = b `]; +SIMP_TAC[]; + + + +SIMP_TAC[Wrgcvdr_cizmrrh.X_IN_HYP_ORBITS]; + + + + + +DOWN; +PHA; +MATCH_MP_TAC (prove(`!x. FAN (vec 0,V,E) /\ + x IN darts_of_hyp E V /\ + FF = face (hypermap (HYP (vec 0,V,E))) x + ==> 2 < CARD FF /\ + simple_hypermap (hypermap (HYP (vec 0,v_prime V FF,e_prime E FF))) + ==> local_fan (v_prime V FF,e_prime E FF,FF)`, +NHANH Lvducxu.LVDUCXU THEN SIMP_TAC[])); +EXISTS_TAC` v, rho_node1 FF v `; +ASM_REWRITE_TAC[]]);; + + + + +let HAFL_CIRCLE_FORM_LOCAL_FAN2 = prove_by_refinement +(` (local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E)) /\ + HS = hypermap (HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v,rho_node1 FF v) /\ + fw = face HS (w,rho_node1 FF w) + ==> local_fan (v_prime V fv,e_prime (E UNION {{v, w}}) fv,fv) /\ +local_fan (v_prime V fw,e_prime (E UNION {{w, v}}) fw,fw) `, +[STRIP_TAC; +CONJ_TAC; +MATCH_MP_TAC HAFL_CIRCLE_FORM_LOCAL_FAN; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC HAFL_CIRCLE_FORM_LOCAL_FAN; +ASM_REWRITE_TAC[INSERT_COMM]; +UNDISCH_TAC` !z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t:real^3} `; +DISCH_THEN NHANH; +SIMP_TAC[INSERT_COMM]]);; + + + + + +let LOCAL_FAN_RHO_NODE_IVS = prove_by_refinement ( +` local_fan (V,E,FF) /\ v IN V +==> rho_node1 FF (ivs_rho_node1 FF v ) = v `, +[NHANH Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1; +STRIP_TAC; +DOWN; +FIRST_X_ASSUM NHANH; +STRIP_TAC; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +REWRITE_TAC[GSYM ITER]; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_FINITE_V; +DOWN THEN DOWN THEN PHA; +REWRITE_TAC[SET_RULE` a IN X <=> {a} SUBSET X `]; +NHANH CARD_SUBSET; +STRIP_TAC; +DOWN; +SUBST1_TAC (ISPEC`v:real^3` Trigonometry2.CARD_SING); +NHANH (ARITH_RULE` 1 <= a ==> SUC (a - 1) = a`); +SIMP_TAC[]; +STRIP_TAC; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID; +FIRST_X_ASSUM MATCH_MP_TAC; +DOWN_TAC; +SIMP_TAC[INSERT_SUBSET]]);; + + + + + +let LOCAL_FAN_IVS_IN_V = prove(` local_fan (V,E,FF) /\ v IN V +==> ivs_rho_node1 FF v IN V `, +NHANH Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V THEN +NHANH Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1 THEN +MESON_TAC[]);; + + + + + +let LF_AZIM_CYCLE_EQ_IVS_ND = prove(` local_fan (V,E,FF) /\ v IN V +==> azim_cycle (EE v E) (vec 0) v (rho_node1 FF v) = ivs_rho_node1 FF v `, +NHANH LOCAL_FAN_RHO_NODE_IVS THEN +NHANH LOCAL_FAN_IVS_IN_V THEN +ABBREV_TAC` vv = ivs_rho_node1 FF v ` THEN +STRIP_TAC THEN ASSUME_TAC2 Local_lemmas.LOFA_IMP_EE_TWO_ELMS THEN +ASM_REWRITE_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]);; + + + + + + +let AZIM_IN_FAN_RHOND_IVS_RHOND = prove(` local_fan (V,E,FF) /\ v IN V +==> azim_in_fan (v, rho_node1 FF v) E = azim (vec 0) v (rho_node1 FF v) (ivs_rho_node1 FF v) `, STRIP_TAC THEN +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2 THEN DOWN THEN STRIP_TAC +THEN FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC`v:real^3`)) THEN +DOWN THEN UNDISCH_TAC` local_fan (V,E,FF)` THEN +PHA THEN NHANH Local_lemmas.LOFA_DETERMINE_AZIM_IN_FA THEN +SIMP_TAC[] THEN STRIP_TAC THEN +ASSUME_TAC2 LF_AZIM_CYCLE_EQ_IVS_ND THEN ASM_REWRITE_TAC[]);; + + + + + + +let LOFA_IMP_EE_TWO_ELMS_INS_ND = prove(` local_fan (V,E,FF) /\ v IN V +==> EE v E = {rho_node1 FF v, ivs_rho_node1 FF v} `, +NHANH LOCAL_FAN_IVS_IN_V THEN NHANH LOCAL_FAN_RHO_NODE_IVS THEN +STRIP_TAC THEN ABBREV_TAC `vv = ivs_rho_node1 FF v ` THEN +ASSUME_TAC2 Local_lemmas.LOFA_IMP_EE_TWO_ELMS THEN +FIRST_X_ASSUM ACCEPT_TAC);; + + + + +let WEDGE_IN_FAN_RHOND_IVS_RHOND = prove(` local_fan (V,E,FF) /\ v IN V + ==> wedge_in_fan_ge (v,rho_node1 FF v) E = + wedge_ge (vec 0) v (rho_node1 FF v) (ivs_rho_node1 FF v) `, +NHANH Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2 THEN STRIP_TAC THEN +DOWN THEN FIRST_X_ASSUM NHANH THEN STRIP_TAC THEN +DOWN THEN UNDISCH_TAC `local_fan (V,E,FF) ` THEN PHA THEN +NHANH Local_lemmas.DETERMINE_WEDGE_IN_FAN THEN SIMP_TAC[] THEN +STRIP_TAC THEN ASSUME_TAC2 LOFA_IMP_EE_TWO_ELMS_INS_ND THEN +ASM_SIMP_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]);; + + + + + +let FST_LST_IN_WEDGE_GE = prove(` w1 IN wedge_ge v0 v1 w1 w2 /\ +w2 IN wedge_ge v0 v1 w1 w2`, +REWRITE_TAC[wedge_ge; IN_ELIM_THM; AZIM_REFL; Local_lemmas.AZIM_RANGE] THEN +REWRITE_TAC[REAL_LE_REFL]);; + + + + +let IVS_RHO_NODE_DIFF_ID = prove(`!v. local_fan (V,E,FF) /\ v IN V + ==> ~(ivs_rho_node1 FF v = v)`, +NHANH LOCAL_FAN_IVS_IN_V THEN NHANH Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE THEN +REPEAT STRIP_TAC THEN FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` ivs_rho_node1 FF v `)) THEN +ASSUME_TAC2 LOCAL_FAN_RHO_NODE_IVS THEN FIRST_X_ASSUM SUBST_ALL_TAC THEN +DOWN THEN ASM_REWRITE_TAC[]);; + + + + + +let POINT_PRESENTED_IN_RHOND1 = prove( +` local_fan (V,E,FF) /\ v IN V /\ w IN V ==> ? n. n < CARD V /\ +ITER n (rho_node1 FF) v = w /\ (! m. m < n ==> ~( ITER m (rho_node1 FF) v = w )) `, +STRIP_TAC THEN ASSUME_TAC2 Local_lemmas.LOFA_IMP_LT_CARD_SET_V THEN +UNDISCH_TAC ` w:real^3 IN V ` THEN EXPAND_TAC "V" THEN +REWRITE_TAC[IN_ELIM_THM] THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN +EXISTS_TAC `n:num` THEN ASM_REWRITE_TAC[] THEN +ASSUME_TAC2 Local_lemmas.LOFA_IMP_DIS_ELMS23 THEN GEN_TAC THEN +STRIP_TAC THEN FIRST_X_ASSUM (MP_TAC o (SPECL [`m:num `;` n:num`])) THEN PHA +THEN PHA THEN ANTS_TAC THENL [ASM_REWRITE_TAC[]; SIMP_TAC[]]);; + + + + + + + +let POINTS_IN_HAFL_CIRCLE = prove_by_refinement +(` (local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E)) /\ + HS = hypermap (HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v,rho_node1 FF v) +==> v_prime V fv = {ITER n (rho_node1 FF) v| n | ! m . m < n ==> ~(ITER m (rho_node1 FF ) v = w)} `, +[NHANH DETERMINE_FV; +REWRITE_TAC[v_prime]; +STRIP_TAC; +REWRITE_TAC[EXTENSION]; +GEN_TAC; +EQ_TAC; +REWRITE_TAC[IN_ELIM_THM]; +FIRST_X_ASSUM (ASSUME_TAC o SYM); +EXPAND_TAC "fv"; +REWRITE_TAC[IN_INSERT; IN_ELIM_THM]; +STRIP_TAC; + +ASSUME_TAC2 POINT_PRESENTED_IN_RHOND1; + +DOWN THEN STRIP_TAC; +EXISTS_TAC `n:num`; +REPLICATE_TAC 4 DOWN THEN PHA; +REWRITE_TAC[PAIR_EQ]; +ASM_SIMP_TAC[]; + + +DOWN; +REWRITE_TAC[PAIR_EQ]; +STRIP_TAC; +EXISTS_TAC` n:num `; + +ASM_REWRITE_TAC[]; +GEN_TAC; +NHANH (ARITH_RULE` a < (b:num) ==> a < b + 1 `); +FIRST_X_ASSUM NHANH; +SIMP_TAC[]; + + +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V; +FIRST_X_ASSUM (MP_TAC o (SPEC` n:num `)); +ASM_SIMP_TAC[]; +STRIP_TAC; +UNDISCH_TAC` fv = face HS (v,rho_node1 FF v) `; +DISCH_THEN (ASSUME_TAC o SYM); +UNDISCH_TAC` HS = hypermap (HYP (vec 0,V,E UNION {{v, w:real^3}}))`; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +REWRITE_TAC[IN_INSERT; IN_ELIM_THM]; +ASM_CASES_TAC` x = (w:real^3) `; +EXISTS_TAC `v:real^3 `; +DISJ1_TAC; +FIRST_X_ASSUM (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; + + +EXISTS_TAC` ITER (n + 1) (rho_node1 FF) v`; +DISJ2_TAC; +EXISTS_TAC` n:num`; +REWRITE_TAC[]; +GEN_TAC; +ASM_CASES_TAC` m = n:num `; +UNDISCH_TAC` x = ITER n (rho_node1 FF) v `; +ASM_REWRITE_TAC[]; +DISCH_THEN (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[]; +DOWN THEN PHA; +REWRITE_TAC[ARITH_RULE` ~(m = n) /\ m < n + 1 <=> m < n `]; +FIRST_X_ASSUM NHANH; +SIMP_TAC[]]);; + + + +let COVEX_OF_LOFA_HALF_CIRCLE = prove_by_refinement +(`convex_local_fan (V,E,FF) /\ + (local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E)) /\ + HS = hypermap (HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v,rho_node1 FF v) + ==> convex_local_fan (v_prime V fv,e_prime (E UNION {{v, w}}) fv,fv) `, +[NHANH HAFL_CIRCLE_FORM_LOCAL_FAN; +REWRITE_TAC[convex_local_fan]; +NHANH DETERMINE_FV; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[]; +STRIP_TAC; + +EXPAND_TAC "fv"; +REWRITE_TAC[IN_ELIM_THM; IN_INSERT]; +ASM_REWRITE_TAC[]; +GEN_TAC; +STRIP_TAC; + +SUBGOAL_THEN ` (w:real^3,v:real^3) IN fv ` MP_TAC; +EXPAND_TAC "fv"; +REWRITE_TAC[IN_INSERT]; +UNDISCH_TAC` local_fan (v_prime V fv,e_prime (E UNION {{v, w:real^3}}) fv,fv)`; +PHA; +NHANH Local_lemmas.LOFA_DETERMINE_AZIM_IN_FA; +ASM_SIMP_TAC[]; +STRIP_TAC; + +SUBGOAL_THEN ` e_prime (E UNION {{v, w}}) fv = {{v,w:real^3} | v,w IN fv }` MP_TAC; +REWRITE_TAC[EXTENSION]; +GEN_TAC; +REWRITE_TAC[e_prime; IN_ELIM_THM]; +EQ_TAC; +MESON_TAC[]; + + +STRIP_TAC; +EXISTS_TAC` v':real^3`; +EXISTS_TAC` w': real^3 `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` v':real^3, w': real^3 IN fv `; +EXPAND_TAC "fv"; +REWRITE_TAC[IN_INSERT; IN_ELIM_THM]; + + +STRIP_TAC; +DOWN; +SIMP_TAC[PAIR_EQ; INSERT_COMM; IN_UNION; IN_INSERT]; +ASSUME_TAC2 LOCAL_FAN_ORBIT_MAP_VITERFF; +FIRST_X_ASSUM (ASSUME_TAC o (SPEC`n: num`)); +DOWN; +UNDISCH_TAC` local_fan (V,E,FF) `; +PHA; +NHANH Local_lemmas.LOCAL_FAN_IN_FF_IN_ORD_PAIRS2; +DOWN; +SIMP_TAC[PAIR_EQ; IN_UNION]; +STRIP_TAC; +ASM_REWRITE_TAC[]; + + + + + +SUBGOAL_THEN` EE w {{v, w} | v,w IN fv} = {v:real^3, ivs_rho_node1 FF w}` MP_TAC; +REWRITE_TAC[EE; EXTENSION]; +GEN_TAC; +EQ_TAC; +REWRITE_TAC[IN_ELIM_THM; IN_INSERT; NOT_IN_EMPTY]; +EXPAND_TAC "fv"; +REWRITE_TAC[IN_INSERT; IN_ELIM_THM]; +STRIP_TAC; +DOWN THEN DOWN THEN PHA; +REWRITE_TAC[PAIR_EQ]; +SET_TAC[]; + +DOWN THEN REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; +DOWN; +REWRITE_TAC[PAIR_EQ]; +FIRST_ASSUM (MP_TAC o (SPEC` n: num `)); +ANTS_TAC; +ARITH_TAC; +SIMP_TAC[]; +REPEAT STRIP_TAC; +DISJ2_TAC; + +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V; +FIRST_X_ASSUM (MP_TAC o (SPEC` n:num `)); +UNDISCH_TAC ` local_fan (V,E,FF) `; +PHA; +NHANH Local_lemmas.IVS_RHO_IDD; +REWRITE_TAC[GSYM ITER; ADD1]; +SIMP_TAC[]; + + +REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC` w:real^3 `; +EXISTS_TAC` v:real^3 `; +EXPAND_TAC "fv"; +REWRITE_TAC[IN_INSERT]; +FIRST_X_ASSUM SUBST1_TAC; +REWRITE_TAC[]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_LT_CARD_SET_V; +UNDISCH_TAC` w:real^3 IN V `; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; + + + +ASM_CASES_TAC` n = 0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN THEN REWRITE_TAC[ITER]; +ASM_REWRITE_TAC[]; + + +EXISTS_TAC` ITER (n - 1) (rho_node1 FF) v `; +EXISTS_TAC` ITER (n - 1 + 1) (rho_node1 FF) v `; +EXPAND_TAC "fv"; +REWRITE_TAC[IN_INSERT; IN_ELIM_THM]; +CONJ_TAC; +DISJ2_TAC; +EXISTS_TAC `n - 1 `; +DOWN; +REWRITE_TAC[]; +NHANH (ARITH_RULE` ~( n = 0) ==> n - 1 + 1 = n `); +SIMP_TAC[]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_DIS_ELMS23; +ASM_REWRITE_TAC[]; +DOWN; +UNDISCH_TAC` n < CARD (V:real^3 -> bool) `; +PHA THEN MESON_TAC[]; + + +MATCH_MP_TAC (SET_RULE` a = d /\ b = c ==> {a,b} = {c,d} `); +ASM_REWRITE_TAC[]; +DOWN; +NHANH (ARITH_RULE` ~( n = 0) ==> n - 1 + 1 = n `); +SIMP_TAC[]; + + +ASSUME_TAC2 Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V; +FIRST_X_ASSUM (MP_TAC o (SPEC` n:num `)); +FIRST_X_ASSUM NHANH; +REWRITE_TAC[ITER_ADD]; + + +ASM_CASES_TAC` n = 0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN; +ASM_REWRITE_TAC[ITER]; + + +ASSUME_TAC2 (SPEC` CARD (V:real^3 -> bool)` (ARITH_RULE`!m. n < m /\ ~( n = 0) + ==> m - 1 + n = m + n - 1 `)); +ASM_REWRITE_TAC[]; +REWRITE_TAC[GSYM ITER_ADD]; + +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V; +FIRST_X_ASSUM (ASSUME_TAC o (SPEC` n - 1 `)); +REPEAT STRIP_TAC; +UNDISCH_TAC` ITER (n - 1) (rho_node1 FF) v IN V `; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID; +FIRST_X_ASSUM NHANH; +ASM_SIMP_TAC[]; + +SIMP_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]; + + + + +STRIP_TAC; +ASSUME_TAC2 (SPEC` w:real^3 ` (GEN`v: real^3 ` WEDGE_IN_FAN_RHOND_IVS_RHOND)); +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2; +DOWN THEN STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` w:real^3`)); +DOWN; +UNDISCH_TAC` !x. (x:real^3#real^3) IN FF ==> azim_in_fan x E <= pi /\ V SUBSET wedge_in_fan_ge x E`; +STRIP_TAC; +FIRST_ASSUM NHANH; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (SPEC` w:real^3` (GEN `v:real^3` AZIM_IN_FAN_RHOND_IVS_RHOND)); +ASM_REWRITE_TAC[]; + +REWRITE_TAC[wedge_ge; SUBSET]; +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` v:real^3 `)); +DOWN; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; + +MP_TAC (SPECL [` vec 0: real^3 `;` w:real^3 `;` rho_node1 FF w `;` ivs_rho_node1 FF w`; + ` v:real^3 `; ` ivs_rho_node1 FF w `] +(GEN_ALL Local_lemmas.IN_WEDGE_IMP_AZIM_LE)); +ANTS_TAC; +ASM_REWRITE_TAC[FST_LST_IN_WEDGE_GE]; +UNDISCH_TAC` !z t. z IN {v:real^3, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}`; +DISCH_THEN (ASSUME_TAC o (SPEC` w:real^3 `)); +FIRST_ASSUM (MP_TAC o (SPEC` v:real^3 `)); +ANTS_TAC; +ASM_REWRITE_TAC[IN_INSERT; IN_DIFF; NOT_IN_EMPTY]; + + +FIRST_ASSUM (MP_TAC o (SPEC` ivs_rho_node1 FF w `)); +ANTS_TAC; +REWRITE_TAC[IN_INSERT; IN_DIFF; NOT_IN_EMPTY]; +ASSUME_TAC2 (SPEC` w:real^3` (GEN `v:real^3 ` LOCAL_FAN_IVS_IN_V)); +ASSUME_TAC2 (SPEC` w: real^3 ` IVS_RHO_NODE_DIFF_ID); +ASM_REWRITE_TAC[]; + + +FIRST_ASSUM (MP_TAC o (SPEC`rho_node1 FF w `)); +ANTS_TAC; +REWRITE_TAC[IN_INSERT; IN_DIFF; NOT_IN_EMPTY]; +ASSUME_TAC2 (SPEC` w:real^3 ` (GEN`v: real^3 ` Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V)); +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` w:real^3 `)); +ASM_REWRITE_TAC[]; + +SIMP_TAC[]; + + +STRIP_TAC; +CONJ_TAC; +UNDISCH_TAC` azim (vec 0) w (rho_node1 FF w) (ivs_rho_node1 FF w) <= pi `; +DOWN; +PHA THEN REWRITE_TAC[REAL_LE_TRANS]; + +SUBGOAL_THEN `(w:real^3) IN v_prime V (fv: real^3#real^3 -> bool)` MP_TAC; +MP_TAC POINTS_IN_HAFL_CIRCLE; +ANTS_TAC; +ASM_REWRITE_TAC[]; +SIMP_TAC[IN_ELIM_THM]; +ASSUME_TAC2 POINT_PRESENTED_IN_RHOND1; +DOWN THEN STRIP_TAC; +STRIP_TAC; +EXISTS_TAC` n: num `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` local_fan (v_prime V fv,e_prime (E UNION {{v:real^3, w}}) fv,fv) `; +PHA; +NHANH WEDGE_IN_FAN_RHOND_IVS_RHOND; +STRIP_TAC; +UNDISCH_TAC` (w:real^3,v:real^3) IN fv`; +UNDISCH_TAC` local_fan (v_prime V fv,e_prime (E UNION {{v:real^3, w}}) fv,fv)`; +PHA; +NHANH Local_lemmas.DETER_RHO_NODE; +STRIP_TAC; +UNDISCH_TAC` wedge_in_fan_ge (w,rho_node1 fv w) (e_prime (E UNION {{v, w}}) fv) = + wedge_ge (vec 0) w (rho_node1 fv w) (ivs_rho_node1 fv w) `; +ASM_SIMP_TAC[]; +STRIP_TAC; + +SUBGOAL_THEN` ivs_rho_node1 FF w, w IN fv ` MP_TAC; +ASSUME_TAC2 POINT_PRESENTED_IN_RHOND1; +DOWN THEN STRIP_TAC; +EXPAND_TAC "fv"; +REWRITE_TAC[IN_INSERT; IN_ELIM_THM]; +DISJ2_TAC; +EXISTS_TAC` n - 1 `; +ASM_CASES_TAC` n = 0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN THEN DOWN; +ASM_REWRITE_TAC[ITER]; +ASSUME_TAC2 (ARITH_RULE` ~( n = 0) ==> n - 1 + 1 = n `); +ASM_REWRITE_TAC[PAIR_EQ]; +EXPAND_TAC "w"; +EXPAND_TAC "n"; +REWRITE_TAC[GSYM ADD1; ITER]; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V; +FIRST_X_ASSUM (MP_TAC o (SPEC` n - 1 `)); +UNDISCH_TAC` local_fan (V,E,FF) `; +PHA; +NHANH Local_lemmas.IVS_RHO_IDD; +SIMP_TAC[ADD1; ARITH_RULE` (a + 1) - 1 = a `]; +UNDISCH_TAC` local_fan (v_prime V fv,e_prime (E UNION {{v, w}}) fv,fv) `; +PHA; +NHANH Local_lemmas.IVS_RHO_NODE1_DETE; +SIMP_TAC[] THEN STRIP_TAC; + +MP_TAC (REWRITE_RULE[] ( +SPECL [` w:real^3 `;` CARD (V:real^3 -> bool) `;` \i. ITER i (rho_node1 FF) w `;` \i. azim (vec 0) w (ITER 1 (rho_node1 FF) w) + (ITER i (rho_node1 FF) w) `] +(GENL [` v0:real^3 `;` k: num `;` vv: num -> real^3 `;` bta: num -> real`] Local_lemmas.MONO_AZIM_AS_BTA_I))); +ANTS_TAC; +ASM_REWRITE_TAC[convex_local_fan]; + + +UNDISCH_TAC` !z t. z IN {v, w} /\ t IN V DIFF {z:real^3} ==> ~collinear {vec 0, z, t} `; +DISCH_THEN (MP_TAC o (SPEC` w:real^3 `)); +REWRITE_TAC[IN_INSERT; IN_DIFF; NOT_IN_EMPTY]; + +MP_TAC POINTS_IN_HAFL_CIRCLE; +ANTS_TAC; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +REWRITE_TAC[IN_ELIM_THM]; +REPEAT STRIP_TAC; +MP_TAC (SPECL [` w:real^3 `;` v:real^3 `] (GENL [` v:real^3`;` w:real^3 `] + POINT_PRESENTED_IN_RHOND1)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; + +ASM_CASES_TAC` CARD (V:real^3 -> bool) < n + n' `; +DOWN; +UNDISCH_TAC` n' < CARD (V:real^3 -> bool) `; +PHA; +NHANH (ARITH_RULE` (c:num) < a /\ a < b + c ==> a - c < b `); +UNDISCH_TAC` !m. m < n ==> ~(ITER m (rho_node1 FF) v = w) `; +STRIP_TAC; +FIRST_ASSUM NHANH; +EXPAND_TAC "v"; +SIMP_TAC[ITER_ADD]; +NHANH ( ARITH_RULE` b < CARD (V:real^3 -> bool) ==> CARD V - b + b = CARD V`); +STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` w:real^3 `)); +ASM_REWRITE_TAC[]; + + +ASM_CASES_TAC` n + n' = CARD (V:real^3 -> bool) `; +ASM_REWRITE_TAC[]; +EXPAND_TAC "v"; +REWRITE_TAC[ITER_ADD]; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` w:real^3 `)); +ASM_REWRITE_TAC[wedge_ge; IN_ELIM_THM; Local_lemmas.AZIM_SPEC_DEGENERATE]; +REWRITE_TAC[REAL_LE_REFL; Local_lemmas.AZIM_RANGE]; + +ASM_CASES_TAC` n = 0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +UNDISCH_TAC` x' = ITER 0 (rho_node1 FF) v `; +REWRITE_TAC[ITER]; +SIMP_TAC[wedge_ge; IN_ELIM_THM; AZIM_REFL; REAL_LE_REFL; Local_lemmas.AZIM_RANGE]; + + + +FIRST_ASSUM (MP_TAC o (SPECL[` n':num `;` n + (n':num) `])); +ANTS_TAC; +REPLICATE_TAC 3 DOWN THEN PHA; +ARITH_TAC; + +ASM_REWRITE_TAC[GSYM ITER_ADD]; +UNDISCH_TAC` x' = ITER n (rho_node1 FF) v `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[Wrgcvdr_cizmrrh.ITER1]; + + +REWRITE_TAC[wedge_ge; IN_ELIM_THM; Local_lemmas.AZIM_RANGE]; +STRIP_TAC; +ASM_CASES_TAC` n + n' = CARD (V:real^3 -> bool) - 1`; +EXPAND_TAC "x'"; +EXPAND_TAC "v"; +REWRITE_TAC[ITER_ADD]; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` w: real^3 `)); +FIRST_X_ASSUM SUBST1_TAC; +REWRITE_TAC[REAL_LE_REFL]; + + +FIRST_ASSUM (MP_TAC o (SPECL [` n + n':num `;` CARD (V:real^3 -> bool) - 1 `])); +ANTS_TAC; +DOWN; +UNDISCH_TAC` ~(CARD (V:real^3 -> bool) < n + n')`; +UNDISCH_TAC` ~(n + n' = CARD (V:real^3 -> bool))`; +ARITH_TAC; +REWRITE_TAC[Wrgcvdr_cizmrrh.ITER1]; + +ASSUME_TAC2 Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC`w:real^3 `)); +ASM_REWRITE_TAC[GSYM ITER_ADD]; +STRIP_TAC; + +SUBGOAL_THEN` ~ (collinear {vec 0, w, v:real^3}) /\ +~( collinear {vec 0, w, x'}) /\ ~( collinear {vec 0, w, rho_node1 FF w})` MP_TAC; +CONJ_TAC; +FIRST_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[IN_INSERT; IN_DIFF; NOT_IN_EMPTY]; + +CONJ_TAC; +FIRST_ASSUM MATCH_MP_TAC; +REWRITE_TAC[IN_INSERT; IN_DIFF; NOT_IN_EMPTY]; +EXPAND_TAC "x'"; +EXPAND_TAC "v"; +REWRITE_TAC[ITER_ADD]; +ASSUME_TAC2 (SPEC` w:real^3 ` (GEN` v:real^3 ` + Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V)); +FIRST_X_ASSUM (MP_TAC o (SPEC` n + n': num `)); +SIMP_TAC[]; +STRIP_TAC; +MP_TAC (SPEC` w:real^3` (GEN` v:real^3 ` Local_lemmas.LOFA_IMP_DIS_ELMS23)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +DISCH_THEN (MP_TAC o (SPECL [`0 `;` n + n': num `])); +ANTS_TAC; +UNDISCH_TAC` ~( n = 0) `; +UNDISCH_TAC` ~(CARD (V:real^3 -> bool) < n + n')`; +UNDISCH_TAC` ~(n + n' = CARD (V:real^3 -> bool))`; +ARITH_TAC; +SIMP_TAC[ITER]; +ASSUME_TAC2 (SPEC` w:real^3` (GEN` v:real^3 ` Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2)); +FIRST_X_ASSUM ACCEPT_TAC; + + + +UNDISCH_TAC` azim (vec 0) w (rho_node1 FF w) v <= azim (vec 0) w (rho_node1 FF w) x' `; +PHA; +NHANH Fan.sum4_azim_fan; + +STRIP_TAC; +SUBGOAL_THEN` ~ collinear {vec 0, w, v:real^3} /\ +~ collinear {vec 0, w, ivs_rho_node1 FF w} /\ +~ collinear {vec 0, w, rho_node1 FF w} ` MP_TAC; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (SPEC` w:real^3 ` Local_lemmas.LOFA_IMP_NOT_COLL_IVS); +FIRST_X_ASSUM ACCEPT_TAC; +SUBGOAL_THEN` azim (vec 0) w (rho_node1 FF w) v <= azim (vec 0) w (rho_node1 FF w) (ivs_rho_node1 FF w)` MP_TAC; +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC` azim (vec 0) w (rho_node1 FF w) x' `; +ASM_REWRITE_TAC[]; + +PHA; +NHANH Fan.sum4_azim_fan; +STRIP_TAC; +UNDISCH_TAC` azim (vec 0) w (rho_node1 FF w) x' <= + azim (vec 0) w (rho_node1 FF w) (ivs_rho_node1 FF w) `; +ASM_REWRITE_TAC[]; +REAL_ARITH_TAC; + + +ASM_CASES_TAC` n = 0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +MP_TAC POINTS_IN_HAFL_CIRCLE; +ANTS_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` (v:real^3) IN v_prime V (fv:real^3 #real^3 -> bool) ` MP_TAC; +ASM_REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC `0`; +REWRITE_TAC[ITER; LT]; +UNDISCH_TAC` local_fan (v_prime V fv,e_prime (E UNION {{v:real^3, w}}) fv,fv)`; +PHA; +NHANH AZIM_IN_FAN_RHOND_IVS_RHOND; +DOWN THEN DOWN; +REWRITE_TAC[ITER; ADD; Lvducxu.ITER12]; +DISCH_THEN (ASSUME_TAC o SYM); +DISCH_THEN (ASSUME_TAC o SYM); +STRIP_TAC; + +SUBGOAL_THEN` v,rho_node1 FF v IN fv ` MP_TAC; +EXPAND_TAC "fv"; +REWRITE_TAC[IN_INSERT; IN_ELIM_THM]; +DISJ2_TAC; +EXISTS_TAC` 0 `; +ASM_REWRITE_TAC[]; +EXPAND_TAC "x"; +REWRITE_TAC[ITER; ADD; Lvducxu.ITER12]; +UNDISCH_TAC` local_fan (v_prime V fv,e_prime (E UNION {{v, w:real^3}}) fv,fv) `; +PHA; +NHANH Local_lemmas.DETER_RHO_NODE; +STRIP_TAC; +SUBGOAL_THEN` (w:real^3, v:real^3) IN fv ` MP_TAC; +EXPAND_TAC "fv"; +REWRITE_TAC[IN_INSERT]; +UNDISCH_TAC` local_fan (v_prime V fv,e_prime (E UNION {{v:real^3, w}}) fv,fv) `; +PHA; +NHANH Local_lemmas.IVS_RHO_NODE1_DETE; +STRIP_TAC; +UNDISCH_TAC` azim_in_fan (v,rho_node1 fv v) (e_prime (E UNION {{v, w}}) fv) = + azim (vec 0) v (rho_node1 fv v) (ivs_rho_node1 fv v) `; +ASM_SIMP_TAC[]; +STRIP_TAC; + +UNDISCH_TAC` !x. (x:real^3#real^3) IN FF ==> azim_in_fan x E <= pi /\ V SUBSET wedge_in_fan_ge x E `; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2; +DOWN THEN STRIP_TAC; +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` v:real^3 `)); +DOWN; +FIRST_ASSUM NHANH; +ASSUME_TAC2 AZIM_IN_FAN_RHOND_IVS_RHOND; +ASSUME_TAC2 WEDGE_IN_FAN_RHOND_IVS_RHOND; +ASM_REWRITE_TAC[SUBSET]; +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` w:real^3 `)); +DOWN; +REWRITE_TAC[wedge_ge; IN_ELIM_THM]; +STRIP_TAC; +CONJ_TAC; +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC` azim (vec 0) v (rho_node1 FF v) (ivs_rho_node1 FF v) `; +ASM_REWRITE_TAC[]; + +GEN_TAC; +STRIP_TAC; +UNDISCH_TAC` v IN v_prime V (fv:real^3#real^3 -> bool) `; +UNDISCH_TAC` local_fan (v_prime V fv,e_prime (E UNION {{v, w:real^3}}) fv,fv) `; +PHA; +NHANH WEDGE_IN_FAN_RHOND_IVS_RHOND; +ASM_SIMP_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` (x':real^3) IN {ITER n (rho_node1 FF) v | n | !m. m < n + ==> ~(ITER m (rho_node1 FF) v = w)}` MP_TAC; +ASM_REWRITE_TAC[]; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +ASSUME_TAC2 POINT_PRESENTED_IN_RHOND1; +DOWN THEN STRIP_TAC; +ASM_CASES_TAC` n'' < (n':num) `; +DOWN; +UNDISCH_TAC` !m. m < n' ==> ~(ITER m (rho_node1 FF) v = w)`; +DISCH_THEN NHANH; +ASM_REWRITE_TAC[]; +ASM_CASES_TAC` n'' = (n': num) `; +FIRST_X_ASSUM SUBST_ALL_TAC; +ASM_REWRITE_TAC[FST_LST_IN_WEDGE_GE]; + +MP_TAC ( +SPEC` CARD (V:real^3 -> bool) ` ( +GEN `k: num ` ( +REWRITE_RULE[] ( +SPECL [`v:real^3 `; `\i. ITER i (rho_node1 FF) v `; `\i. azim (vec 0) v (rho_node1 FF v) ( ITER i (rho_node1 FF) v) `] +(GENL [` v0:real^3`; ` vv: num -> real^3 `;` bta: num -> real`] Local_lemmas.MONO_AZIM_AS_BTA_I))))); +ANTS_TAC; +ASM_REWRITE_TAC[convex_local_fan; Lvducxu.ITER12]; +GEN_TAC THEN STRIP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[IN_INSERT; IN_DIFF; NOT_IN_EMPTY]; + +DISCH_THEN (MP_TAC o (SPECL [` n':num `;` n'': num `])); +ANTS_TAC; +ASM_REWRITE_TAC[]; +DOWN THEN DOWN THEN ARITH_TAC; +ASM_SIMP_TAC[wedge_ge; IN_ELIM_THM; Local_lemmas.AZIM_RANGE]; + + +DOWN THEN DOWN; +DISCH_THEN (ASSUME_TAC o SYM); +STRIP_TAC; +MP_TAC POINTS_IN_HAFL_CIRCLE; +ANTS_TAC; +ASM_REWRITE_TAC[]; +DISCH_THEN (ASSUME_TAC o SYM); +SUBGOAL_THEN` ITER n (rho_node1 FF) v IN {ITER n (rho_node1 FF) v | n | !m. m < n + ==> ~(ITER m (rho_node1 FF) v = w)} ` MP_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` n: num `; +REWRITE_TAC[]; +NHANH (ARITH_RULE` m < n:num ==> m < n + 1 `); +FIRST_ASSUM NHANH; +SIMP_TAC[]; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` local_fan (v_prime V fv,e_prime (E UNION {{v:real^3, w}}) fv,fv) `; +PHA; +NHANH AZIM_IN_FAN_RHOND_IVS_RHOND; +STRIP_TAC; +SUBGOAL_THEN` (x:real^3 # real^3) IN fv ` MP_TAC; +EXPAND_TAC "fv"; +REWRITE_TAC[IN_INSERT; IN_ELIM_THM]; +DISJ2_TAC; +EXISTS_TAC` n:num `; +ASM_REWRITE_TAC[]; + +EXPAND_TAC "x"; +UNDISCH_TAC` local_fan (v_prime V fv,e_prime (E UNION {{v, w:real^3}}) fv,fv) `; +PHA; +NHANH Local_lemmas.DETER_RHO_NODE; +ASM_REWRITE_TAC[]; +STRIP_TAC; + +SUBGOAL_THEN` (ivs_rho_node1 FF (ITER n (rho_node1 FF) v)), ITER n (rho_node1 FF) v IN fv ` MP_TAC; +EXPAND_TAC "fv"; +REWRITE_TAC[IN_INSERT; IN_ELIM_THM]; +DISJ2_TAC; +EXISTS_TAC` n - 1 `; +ASSUME_TAC2 (ARITH_RULE` ~( n = 0) ==> n - 1 + 1 = n `); +ASM_REWRITE_TAC[]; +NHANH (ARITH_RULE` m < n ==> m < n + 1 `); +FIRST_ASSUM NHANH; +SIMP_TAC[]; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V; +REWRITE_TAC[PAIR_EQ]; +EXPAND_TAC "n"; +ONCE_REWRITE_TAC[ADD_SYM]; +REWRITE_TAC[GSYM ITER_ADD; Lvducxu.ITER12]; +FIRST_ASSUM (ASSUME_TAC o (SPEC` n - 1 `)); +ASSUME_TAC2 ( +SPEC` ITER (n - 1) (rho_node1 FF) v ` (GEN`v: real^3 ` Local_lemmas.IVS_RHO_IDD)); +ONCE_REWRITE_TAC[ADD_SYM]; +ASM_REWRITE_TAC[]; + +UNDISCH_TAC` local_fan (v_prime V fv,e_prime (E UNION {{v, w:real^3}}) fv,fv) `; +PHA; +NHANH Local_lemmas.IVS_RHO_NODE1_DETE; +STRIP_TAC; +UNDISCH_TAC` azim_in_fan + (ITER n (rho_node1 FF) v,rho_node1 fv (ITER n (rho_node1 FF) v)) + (e_prime (E UNION {{v, w}}) fv) = + azim (vec 0) (ITER n (rho_node1 FF) v) + (rho_node1 fv (ITER n (rho_node1 FF) v)) + (ivs_rho_node1 fv (ITER n (rho_node1 FF) v)) `; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; + +STRIP_TAC; +ASSUME_TAC2 LOCAL_FAN_ORBIT_MAP_VITERFF; +FIRST_ASSUM (MP_TAC o (SPEC` n:num `)); +UNDISCH_TAC` !x. (x:real^3#real^3) IN FF ==> azim_in_fan x E <= pi /\ V SUBSET wedge_in_fan_ge x E`; +STRIP_TAC; +FIRST_ASSUM NHANH; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPEC` n:num `)); +UNDISCH_TAC` local_fan (V,E,FF) `; +PHA; +NHANH AZIM_IN_FAN_RHOND_IVS_RHOND; +REWRITE_TAC[GSYM ITER; ADD1]; +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC o SYM); +UNDISCH_TAC` azim_in_fan (ITER n (rho_node1 FF) v,ITER (n + 1) (rho_node1 FF) v) E <= pi `; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +STRIP_TAC; +MP_TAC POINTS_IN_HAFL_CIRCLE; +ANTS_TAC; +ASM_REWRITE_TAC[]; +DISCH_THEN (ASSUME_TAC o SYM); +SUBGOAL_THEN ` ITER n (rho_node1 FF) v IN v_prime V (fv:real^3#real^3 -> bool) ` MP_TAC; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` n:num `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` !m. m < n + 1 ==> ~(ITER m (rho_node1 FF) v = w) `; +MESON_TAC[ARITH_RULE` m < n ==> m < n + 1 `]; +UNDISCH_TAC` local_fan (v_prime V fv,e_prime (E UNION {{v:real^3, w}}) fv,fv) `; +PHA; +NHANH WEDGE_IN_FAN_RHOND_IVS_RHOND; +ASM_SIMP_TAC[]; +STRIP_TAC; +ASSUME_TAC2 (SPEC` ITER n (rho_node1 FF) v ` (GEN`v:real^3 ` WEDGE_IN_FAN_RHOND_IVS_RHOND)); +FIRST_X_ASSUM (MP_TAC o SYM); + + +ASM_REWRITE_TAC[GSYM ITER; ADD1]; +SIMP_TAC[]; +STRIP_TAC; +MATCH_MP_TAC SUBSET_TRANS; +EXISTS_TAC` V:real^3 -> bool` ; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` V SUBSET + wedge_in_fan_ge (ITER n (rho_node1 FF) v,ITER (n + 1) (rho_node1 FF) v) + E `; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; + +UNDISCH_TAC` {ITER n (rho_node1 FF) v | n | !m. m < n + ==> ~(ITER m (rho_node1 FF) v = w)} = + v_prime V (fv:real^3#real^3 -> bool) `; +DISCH_THEN (SUBST1_TAC o SYM); +REWRITE_TAC[SUBSET; IN_ELIM_THM]; +REPEAT STRIP_TAC; +ASM_REWRITE_TAC[]]);; + + + + + +let COVEX_OF_LOFA_HALF_CIRCLE2 = prove( +` convex_local_fan (V,E,FF) /\ + (local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E)) /\ + HS = hypermap (HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v,rho_node1 FF v) /\ +fw = face HS (w, rho_node1 FF w) + ==> convex_local_fan (v_prime V fv,e_prime (E UNION {{v, w}}) fv,fv) /\ +convex_local_fan (v_prime V fw,e_prime (E UNION {{w, v}}) fw,fw)`, +STRIP_TAC THEN CONJ_TAC THENL [MATCH_MP_TAC COVEX_OF_LOFA_HALF_CIRCLE THEN +ASM_REWRITE_TAC[]; MATCH_MP_TAC COVEX_OF_LOFA_HALF_CIRCLE THEN DOWN_TAC THEN +SIMP_TAC[INSERT_COMM]]);; + + +(* ======================================================================== *) + + +let CARD_V_TWO_HAFL_CIRCLE = prove_by_refinement +(` local_fan (V,E,FF) /\ v IN V /\ w IN V /\ +~ (v = w) /\ +ITER n (rho_node1 FF) v = w /\ +ITER n' (rho_node1 FF) w = v /\ +n < CARD V /\ n' < CARD V +==> n + n' = CARD V `, +[STRIP_TAC; +MP_TAC (SPEC` w:real^3 ` (GEN` v: real^3 ` Local_lemmas.LOFA_IMP_DIS_ELMS23)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +UNDISCH_TAC` ITER n (rho_node1 FF) v = w `; +EXPAND_TAC "v"; +REWRITE_TAC[ITER_ADD]; +ASM_CASES_TAC` n + n': num = 0 `; +DOWN; +REWRITE_TAC[ADD_EQ_0]; +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN_TAC; +REWRITE_TAC[ITER]; +MESON_TAC[]; +STRIP_TAC; +ASSUME_TAC2 (SPECL [` w:real^3 `;` n + n':num` ] (GENL [` v:real^3 `;` n: num `] + CARD_IS_LEAST_CYCLE)); +ASM_CASES_TAC` CARD (V:real^3 -> bool) = n + n' `; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM (MP_TAC o (SPECL [` 0`;` (n + n') - CARD (V:real^3 -> bool) `])); +ANTS_TAC; +DOWN THEN DOWN; +UNDISCH_TAC` n < CARD (V:real^3 -> bool) `; +UNDISCH_TAC` n' < CARD (V:real^3 -> bool) `; +PHA THEN ARITH_TAC; +ASM_REWRITE_TAC[ITER]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ORBIT_MAP_VITER; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPECL [` w:real^3 `;` (n + n') - CARD (V:real^3 -> bool) `])); +DOWN; +FIRST_X_ASSUM NHANH; +REWRITE_TAC[ITER_ADD]; +ASSUME_TAC2 (ARITH_RULE` CARD (V:real^3 -> bool) <= n + n' ==> CARD V + (n + n') - CARD V = n + n'`); +ASM_REWRITE_TAC[]; +MESON_TAC[]]);; + + + + + + +let DIFFERENCE_IMP_LT_CARDV = prove_by_refinement +(` local_fan (V,E,FF) /\ v IN V /\ w IN V /\ +(! n. n < m ==> ~(ITER n (rho_node1 FF) v = w)) +==> m < CARD V `, +[STRIP_TAC; +ASM_CASES_TAC` m < CARD (V:real^3 -> bool) `; +FIRST_ASSUM ACCEPT_TAC; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_LT_CARD_SET_V; +UNDISCH_TAC` (w:real^3) IN V `; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +DOWN; +REWRITE_TAC[]; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +FIRST_X_ASSUM MATCH_MP_TAC; +DOWN; +UNDISCH_TAC` ~(m < CARD (V:real^3 -> bool)) `; +ARITH_TAC]);; + + + + + +let LT_CARD_MONO_LOFA = prove(`local_fan (V,E,FF) /\ v IN V +==> (! i j. i < CARD V /\ j < CARD V /\ +ITER i (rho_node1 FF) v = ITER j (rho_node1 FF) v +==> i = j )`, +NHANH Local_lemmas.LOFA_IMP_DIS_ELMS23 THEN REPEAT STRIP_TAC THEN +ASM_CASES_TAC` i = (j:num) ` THENL [FIRST_X_ASSUM ACCEPT_TAC; DOWN] THEN +REWRITE_TAC[ARITH_RULE` ~( a = (b:num)) <=> a < b \/ b < a `] THEN +DOWN_TAC THEN PHA THEN MESON_TAC[]);; + + + + + +let CONDS_IN_V_PRIME_NUM = prove_by_refinement +(` (local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E)) /\ + HS = hypermap (HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v,rho_node1 FF v) +==> n < CARD V /\ +ITER n (rho_node1 FF) v = w +==> ! i. i < CARD V /\ ITER i (rho_node1 FF) v IN v_prime V fv <=> i < n + 1 `, +[NHANH POINTS_IN_HAFL_CIRCLE; +STRIP_TAC THEN STRIP_TAC; +GEN_TAC; +EQ_TAC; +ASM_REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V; +ASSUME_TAC2 (SPECL [` n': num `] (GENL [` m:num `] DIFFERENCE_IMP_LT_CARDV)); +ASSUME_TAC2 LT_CARD_MONO_LOFA; +FIRST_X_ASSUM (MP_TAC o (SPECL [`i:num `;` n': num `])); +PHA; +ANTS_TAC; +ASM_REWRITE_TAC[]; +DISCH_THEN (SUBST_ALL_TAC o SYM); +ASM_CASES_TAC` i < n + 1 `; +FIRST_X_ASSUM ACCEPT_TAC; +ASSUME_TAC2 (ARITH_RULE` ~(i < n + 1) ==> n < i `); +DOWN; +FIRST_X_ASSUM NHANH; +ASM_REWRITE_TAC[]; + +STRIP_TAC; +CONJ_TAC; +REPLICATE_TAC 3 DOWN THEN PHA; +ARITH_TAC; +ASM_REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC`i: num `; +REWRITE_TAC[]; +REPEAT STRIP_TAC; +ASSUME_TAC2 (ARITH_RULE` i < n + 1 /\ m < i ==> m < n `); +MP_TAC Local_lemmas.LOFA_IMP_DIS_ELMS23; +ANTS_TAC; +ASM_REWRITE_TAC[]; +ASM_MESON_TAC[]]);; + + + +let LOFA_IMP_ITER_RHO_NODE_ID2 = MESON[ +Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID]` +local_fan (V,E,FF) /\ v IN V ==> ITER (CARD V) (rho_node1 FF) v = v`;; + + + + + +let CONDS_IN_V_PRIME_NUM2 = prove_by_refinement +(`(local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E)) /\ + HS = hypermap (HYP (vec 0,V,E UNION {{v, w}})) /\ + fw = face HS (w,rho_node1 FF w) + ==> n < CARD V /\ ITER n (rho_node1 FF) v = w + ==> (!i. i < CARD V /\ ITER i (rho_node1 FF) v IN v_prime V fw <=> + i = 0 \/ n <= i /\ i < CARD V )`, +[STRIP_TAC; +ASSUME_TAC2 (SPECL [` w:real^3 `;` v:real^3 `] (GENL [`v:real^3 `;` w:real^3 `] POINT_PRESENTED_IN_RHOND1)); +DOWN THEN STRIP_TAC; + + +MP_TAC (SPECL [` w:real^3 `;` v:real^3 `; ` fw: real^3#real^3 -> bool`;` n': num `] (GENL [` v: real^3`;` w:real^3 `;` fv: real^3#real^3 -> bool`; `n:num `] CONDS_IN_V_PRIME_NUM)); +ANTS_TAC; +DOWN_TAC; +SIMP_TAC[INSERT_COMM]; +ANTS_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +STRIP_TAC; +GEN_TAC; +UNDISCH_TAC` !i. i < CARD (V:real^3 -> bool) /\ ITER i (rho_node1 FF) w IN v_prime V (fw:real^3 # real^3 -> bool) <=> + i < n' + 1 `; +EXPAND_TAC "w"; +REWRITE_TAC[ITER_ADD]; +ASSUME_TAC2 CARD_V_TWO_HAFL_CIRCLE; +ASM_CASES_TAC` i = 0 `; +UNDISCH_TAC` HS = hypermap (HYP (vec 0,V,E UNION {{v:real^3, w}}))`; +DISCH_THEN (ASSUME_TAC o SYM); +UNDISCH_TAC` fw = face HS (w,rho_node1 FF w) `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[ITER]; + +STRIP_TAC; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` v:real^3 `)); +EXPAND_TAC "v"; +UNDISCH_TAC` n + n' = CARD (V:real^3 -> bool) `; +DISCH_THEN (ASSUME_TAC o SYM); +FIRST_ASSUM SUBST1_TAC; +ONCE_REWRITE_TAC[ADD_SYM]; + +CONJ_TAC; +DOWN; +UNDISCH_TAC` n < CARD (V:real^3 -> bool) `; +ARITH_TAC; + + +UNDISCH_TAC` n' < CARD (V:real^3 -> bool) `; +UNDISCH_TAC` !i. i < CARD V /\ ITER (i + n) (rho_node1 FF) v IN v_prime V + (fw:real^3#real^3 -> bool) <=> i < n' + 1 `; +MP_TAC (ARITH_RULE` n' < n' + 1 `); +MESON_TAC[]; + + + +ASM_CASES_TAC` i < CARD (V:real^3 -> bool) `; +UNDISCH_TAC` HS = hypermap (HYP (vec 0,V,E UNION {{v:real^3, w}}))`; +DISCH_THEN (ASSUME_TAC o SYM); +UNDISCH_TAC` fw = face HS (w,rho_node1 FF w) `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; + +STRIP_TAC; + +MP_TAC (SPECL [`w:real^3 `;` v:real^3 `;` fw: real^3 #real^3 -> bool`] + ( GENL [`v:real^3 `;` w:real^3 `;` fv: real^3 #real^3 -> bool` ] POINTS_IN_HAFL_CIRCLE)); +ANTS_TAC; +DOWN_TAC; +SIMP_TAC[INSERT_COMM]; +DISCH_THEN (ASSUME_TAC o SYM); + + + + +ASM_REWRITE_TAC[]; +ASM_CASES_TAC` n <= (i:num) `; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (ARITH_RULE` n <= (i:num) ==> i = (i - n) + n `); +ABBREV_TAC` nn = i - (n:num) `; + +SUBGOAL_THEN` nn + n < n + (n':num) ` MP_TAC; +ASM_REWRITE_TAC[]; +DOWN; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[]; + +NHANH (ARITH_RULE` a + b < b + (c:num) ==> a < c + 1 `); +UNDISCH_TAC` !i. i < CARD V /\ ITER (i + n) (rho_node1 FF) v IN v_prime V +(fw:real^3 #real^3 -> bool) <=> i < n' + 1`; +DISCH_THEN (fun x -> REWRITE_TAC[GSYM x]); +ASM_REWRITE_TAC[]; +SIMP_TAC[]; + +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (ARITH_RULE` ~(i = 0) ==> ~( i + n' < n' + 1 ) `); +DOWN; +UNDISCH_TAC` !i. i < CARD V /\ ITER (i + n) (rho_node1 FF) v IN v_prime V +(fw:real^3 #real^3 -> bool) <=> i < n' + 1`; +DISCH_THEN (fun x -> REWRITE_TAC[GSYM x]); +SUBGOAL_THEN` i + n' < n + (n':num) ` MP_TAC; +DOWN THEN ARITH_TAC; +ASM_SIMP_TAC[]; + +ASM_SIMP_TAC[ARITH_RULE` (a + b) + (c:num) = a + c + b `]; +REWRITE_TAC[GSYM ITER_ADD]; +ASSUME_TAC2 LOFA_IMP_ITER_RHO_NODE_ID2; +ASM_SIMP_TAC[]; +ASM_REWRITE_TAC[]]);; + + + + + +let DETERMINE_FV2 = prove_by_refinement +(`(local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E)) /\ + HS = hypermap (HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v,rho_node1 FF v) + ==> n < CARD V /\ ITER n (rho_node1 FF) v = w +==> fv = + (w,v) INSERT + {ITER m (rho_node1 FF) v,ITER (m + 1) (rho_node1 FF) v | m | + m < n} `, +[NHANH DETERMINE_FV; +SIMP_TAC[]; +REPEAT STRIP_TAC; +MATCH_MP_TAC (SET_RULE` X = Y ==> a INSERT X = a INSERT Y `); +REWRITE_TAC[EXTENSION; IN_ELIM_THM]; +GEN_TAC; +EQ_TAC; +STRIP_TAC; +EXISTS_TAC` n':num`; +ASM_REWRITE_TAC[]; +ASM_CASES_TAC` n' < (n:num) `; +FIRST_ASSUM ACCEPT_TAC; +ASSUME_TAC2 (ARITH_RULE` ~(n' < (n:num)) ==> n < n' + 1 `); +DOWN; +FIRST_X_ASSUM NHANH; +ASM_REWRITE_TAC[]; + +STRIP_TAC; +EXISTS_TAC` m:num`; +ASM_REWRITE_TAC[]; +GEN_TAC; +STRIP_TAC; + +ASSUME_TAC2 Local_lemmas.LOFA_IMP_DIS_ELMS23; +FIRST_X_ASSUM (MP_TAC o (SPECL [`m': num `;` n:num`])); +PHA; +ANTS_TAC; +ASM_REWRITE_TAC[]; +DOWN; +UNDISCH_TAC` m < n:num`; +ARITH_TAC; +ASM_SIMP_TAC[]]);; + + + + + + + +let INTERIOR_ANGLE_LEM_SLICING_FAN = prove_by_refinement +(`convex_local_fan (V,E,FF) /\ +(local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E)) /\ + HS = hypermap (HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v,rho_node1 FF v) /\ + fw = face HS (w,rho_node1 FF w) +==> interior_angle1 (vec 0) fv v + interior_angle1 (vec 0) fw v = interior_angle1 (vec 0) FF v `, + + +[REWRITE_TAC[convex_local_fan] THEN +STRIP_TAC THEN ASSUME_TAC2 POINT_PRESENTED_IN_RHOND1 THEN +DOWN THEN STRIP_TAC THEN MP_TAC DETERMINE_FV2 THEN PHA THEN +ANTS_TAC THENL [ASM_REWRITE_TAC[]; DISCH_THEN (ASSUME_TAC o SYM)] THEN +ASSUME_TAC2 (SPECL [` w:real^3 `;` v:real^3 `] (GENL [` v:real^3 `;` w:real^3 `] POINT_PRESENTED_IN_RHOND1)) THEN DOWN THEN STRIP_TAC THEN + +MP_TAC (SPECL [` w:real^3`;` v:real^3 `;`n': num`;` fw: real^3 #real^3 -> bool`] +(GENL [` v:real^3`;` w:real^3 `;`n: num`;` fv: real^3 #real^3 -> bool`] DETERMINE_FV2)) THEN +PHA THEN +ANTS_TAC THENL [ASM_REWRITE_TAC[INSERT_COMM] THEN +UNDISCH_TAC` !z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z:real^3, t} ` THEN +DISCH_THEN NHANH THEN +SIMP_TAC[INSERT_COMM]; + +DISCH_THEN (ASSUME_TAC o SYM)] THEN +REWRITE_TAC[interior_angle1; GSYM ivs_rho_node1] THEN +MP_TAC2 HAFL_CIRCLE_FORM_LOCAL_FAN2 THEN +STRIP_TAC; +SUBGOAL_THEN ` v, rho_node1 FF v IN fv /\ (w,v) IN fv ` MP_TAC; + +EXPAND_TAC "fv" THEN +REWRITE_TAC[IN_INSERT; IN_ELIM_THM] THEN +DISJ2_TAC THEN +EXISTS_TAC` 0` THEN +REWRITE_TAC[ITER; GSYM ADD1] THEN + +ASM_CASES_TAC` 0 < n ` THENL [FIRST_X_ASSUM ACCEPT_TAC; DOWN] THEN +REWRITE_TAC[ARITH_RULE` ~( 0 < n) <=> n = 0 `] THEN +DISCH_THEN SUBST_ALL_TAC THEN +UNDISCH_TAC` ITER 0 (rho_node1 FF) v = w ` THEN +ASM_REWRITE_TAC[ITER]; +STRIP_TAC; +DOWN; +UNDISCH_TAC` local_fan (v_prime V fv,e_prime (E UNION {{v, w}}) fv,fv) `; +PHA; +NHANH Local_lemmas.IVS_RHO_NODE1_DETE; +STRIP_TAC; +UNDISCH_TAC` v,rho_node1 FF v IN fv `; +UNDISCH_TAC` local_fan (v_prime V fv,e_prime (E UNION {{v, w}}) fv,fv) `; +PHA; +NHANH Local_lemmas.DETER_RHO_NODE; +STRIP_TAC; +UNDISCH_TAC` fw = face HS (w,rho_node1 FF w) `; +DISCH_THEN (ASSUME_TAC o SYM); +UNDISCH_TAC` fv = face HS (v,rho_node1 FF v) `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; + + + + +SUBGOAL_THEN` (v,w) IN fw /\ ivs_rho_node1 FF v, v IN fw ` MP_TAC; +UNDISCH_TAC`(v,w) INSERT + {ITER m (rho_node1 FF) w,ITER (m + 1) (rho_node1 FF) w | m < n'} = + fw `; +STRIP_TAC; +ASM_REWRITE_TAC[]; +EXPAND_TAC "fw"; +REWRITE_TAC[IN_INSERT; IN_ELIM_THM]; +DISJ2_TAC; +EXISTS_TAC` n' - 1 `; +ASM_CASES_TAC` n' = 0`; +FIRST_X_ASSUM SUBST_ALL_TAC; +UNDISCH_TAC` ITER 0 (rho_node1 FF) w = v `; +ASM_REWRITE_TAC[ITER]; +ASSUME_TAC2 (ARITH_RULE` ~(n' = 0) ==> n' - 1 < n' /\ n' - 1 + 1 = n' `); +ASM_REWRITE_TAC[PAIR_EQ]; +UNDISCH_TAC` ITER n (rho_node1 FF) v = w`; +STRIP_TAC; +EXPAND_TAC "w"; +REWRITE_TAC[ITER_ADD]; +ASSUME_TAC2 (ARITH_RULE` ~( n' = 0) ==> n' - 1 + n = (n + n') - 1`); +ASM_REWRITE_TAC[]; +ASSUME_TAC2 Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC`v:real^3 `)); +ASSUME_TAC2 CARD_V_TWO_HAFL_CIRCLE; +ASM_REWRITE_TAC[]; + + +STRIP_TAC; +DOWN; +UNDISCH_TAC` local_fan (v_prime V fw,e_prime (E UNION {{w, v}}) fw,fw) `; +PHA; +NHANH Local_lemmas.IVS_RHO_NODE1_DETE; +STRIP_TAC; +UNDISCH_TAC` (v:real^3,w:real^3) IN fw`; +UNDISCH_TAC` local_fan (v_prime V fw,e_prime (E UNION {{w, v}}) fw,fw) `; +PHA; +NHANH Local_lemmas.IVS_RHO_NODE1_DETE; +NHANH Local_lemmas.DETER_RHO_NODE; +STRIP_TAC; +ASM_REWRITE_TAC[]; + +ASSUME_TAC2 WEDGE_IN_FAN_RHOND_IVS_RHOND; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2; +DOWN THEN STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC`v:real^3 `)); +DOWN; +UNDISCH_TAC` !x. x IN FF ==> azim_in_fan (x:real^3#real^3) E <= pi /\ V SUBSET wedge_in_fan_ge x E`; +DISCH_THEN NHANH; +ASM_REWRITE_TAC[SUBSET]; +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` w:real^3 `)); +DOWN; +REWRITE_TAC[wedge_ge; IN_ELIM_THM]; +STRIP_TAC; +SUBGOAL_THEN` ~ collinear {vec 0, v, w} /\ ~ collinear {vec 0, v, ivs_rho_node1 FF v} /\ ~ collinear {vec 0, v, rho_node1 FF v} ` MP_TAC; +CONJ_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[IN_INSERT; IN_DIFF; NOT_IN_EMPTY]; +ASSUME_TAC2 (SPEC` v:real^3 ` Local_lemmas.LOFA_IMP_NOT_COLL_IVS); +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2; +ASM_REWRITE_TAC[]; +DOWN THEN PHA; +NHANH Fan.sum4_azim_fan; +SIMP_TAC[]]);; + + + +let INTERIOR_ANGLE_LEM_SLICING_FAN2 = prove_by_refinement +(`convex_local_fan (V,E,FF) /\ +(local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E)) /\ + HS = hypermap (HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v,rho_node1 FF v) /\ + fw = face HS (w,rho_node1 FF w) +==> interior_angle1 (vec 0) fv v + interior_angle1 (vec 0) fw v = interior_angle1 (vec 0) FF v /\ +interior_angle1 (vec 0) fw w + interior_angle1 (vec 0) fv w = interior_angle1 (vec 0) FF w`, +[NHANH INTERIOR_ANGLE_LEM_SLICING_FAN; +STRIP_TAC; +CONJ_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +MATCH_MP_TAC (GENL [`w:real^3`] INTERIOR_ANGLE_LEM_SLICING_FAN); +EXISTS_TAC` v:real^3 `; +ASM_REWRITE_TAC[INSERT_COMM]; +FIRST_X_ASSUM NHANH; +FIRST_X_ASSUM NHANH; +SIMP_TAC[INSERT_COMM]]);; + + + + +let INTERIOR_AGL_EQ = prove_by_refinement +(`(local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E)) /\ + HS = hypermap (HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v,rho_node1 FF v) + ==> n < CARD V /\ ITER n (rho_node1 FF) v = w +==> ! i. 0 < i /\ i < n + ==> interior_angle1 (vec 0) fv (ITER i (rho_node1 FF) v) + = interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) v) `, +[REPEAT STRIP_TAC; +MP_TAC DETERMINE_FV2; +PHA; +ANTS_TAC; +ASM_REWRITE_TAC[]; +DISCH_THEN (ASSUME_TAC o SYM); +REWRITE_TAC[interior_angle1; GSYM ivs_rho_node1]; +SUBGOAL_THEN` ITER i (rho_node1 FF) v, rho_node1 FF (ITER i (rho_node1 FF) v) IN fv ` MP_TAC; +EXPAND_TAC "fv"; +REWRITE_TAC[IN_INSERT; IN_ELIM_THM]; +DISJ2_TAC; +EXISTS_TAC` i:num`; +ASM_REWRITE_TAC[ITER; GSYM ADD1]; +MP_TAC HAFL_CIRCLE_FORM_LOCAL_FAN; +ANTS_TAC; +ASM_REWRITE_TAC[]; +PHA; +NHANH Local_lemmas.DETER_RHO_NODE; +SIMP_TAC[]; +STRIP_TAC; + +SUBGOAL_THEN` ivs_rho_node1 FF (ITER i (rho_node1 FF) v), ITER i (rho_node1 FF) v IN fv ` MP_TAC; +EXPAND_TAC "fv"; +REWRITE_TAC[IN_INSERT; IN_ELIM_THM]; +DISJ2_TAC; +EXISTS_TAC` i - 1 `; +ABBREV_TAC ` i' = i - 1 `; +ASSUME_TAC2 (ARITH_RULE` 0 < i ==> i = i - 1 + 1 `); +DOWN; +ASM_REWRITE_TAC[]; +SIMP_TAC[GSYM ADD1; ITER; PAIR_EQ]; +STRIP_TAC; +CONJ_TAC; +UNDISCH_TAC` i < (n:num) `; +DOWN; +ARITH_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V; +FIRST_X_ASSUM (MP_TAC o (SPEC` i': num`)); +UNDISCH_TAC` local_fan (V,E,FF)`; +PHA; +NHANH Local_lemmas.IVS_RHO_IDD; +SIMP_TAC[]; +UNDISCH_TAC` local_fan (v_prime V fv,e_prime (E UNION {{v, w}}) fv,fv) `; +PHA; +NHANH Local_lemmas.IVS_RHO_NODE1_DETE; +SIMP_TAC[]]);; + + + + + +let SUM_INTERIOR_AGL_LEMMA = prove_by_refinement +(`convex_local_fan (V,E,FF) /\ + (local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E)) /\ + HS = hypermap (HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v,rho_node1 FF v) /\ +fw = face HS (w, rho_node1 FF w) +==> ! ff. sum {i | i < CARD V } (\i. (ff i) * (interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) v))) = +sum { i | i < CARD V /\ ITER i (rho_node1 FF) v IN v_prime V fv} (\i. ff i * interior_angle1 (vec 0) fv (ITER i (rho_node1 FF) v)) + +sum { i | i < CARD V /\ ITER i (rho_node1 FF) v IN v_prime V fw} (\i. ff i * interior_angle1 (vec 0) fw (ITER i (rho_node1 FF) v)) `, +[STRIP_TAC; +GEN_TAC; +ASSUME_TAC2 POINT_PRESENTED_IN_RHOND1; +DOWN THEN STRIP_TAC; +MP_TAC POINTS_IN_HAFL_CIRCLE; +ANTS_TAC; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (SPECL [`w:real^3 `;` v:real^3` ] (GENL [` v:real^3 `;` w:real^3 `] + POINT_PRESENTED_IN_RHOND1)); +DOWN THEN STRIP_TAC; +STRIP_TAC; + +MP_TAC (SPECL [` w:real^3 `;` v:real^3`;` fw:real^3#real^3 -> bool` ] (GENL +[` v:real^3 `;` w:real^3 `; `fv:real^3#real^3 -> bool`] POINTS_IN_HAFL_CIRCLE)); +ANTS_TAC; +ASM_REWRITE_TAC[INSERT_COMM]; +UNDISCH_TAC` !z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t:real^3}`; +DISCH_THEN NHANH; +SIMP_TAC[INSERT_COMM]; +STRIP_TAC; + +MP_TAC CONDS_IN_V_PRIME_NUM; +ANTS_TAC; +ASM_REWRITE_TAC[]; +ANTS_TAC; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; + +STRIP_TAC; + +MP_TAC CONDS_IN_V_PRIME_NUM2; +PHA; +ANTS_TAC; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; + +STRIP_TAC; + +SUBGOAL_THEN` {i | i < n + 1} = {i | 0 < i /\ i < n} UNION {0, n} ` MP_TAC; +REWRITE_TAC[EXTENSION]; +REWRITE_TAC[IN_UNION; IN_INSERT; NOT_IN_EMPTY; IN_ELIM_THM]; +GEN_TAC; +ARITH_TAC; +SIMP_TAC[]; +STRIP_TAC; + +SUBGOAL_THEN` {i | i = 0 \/ n <= i /\ i < CARD V} = {i | n < i /\ i < CARD (V:real^3 -> bool) } +UNION {0, n} ` MP_TAC; +REWRITE_TAC[EXTENSION; IN_UNION; IN_INSERT; NOT_IN_EMPTY; IN_ELIM_THM]; +GEN_TAC; +SIMP_TAC[ARITH_RULE` (n:num) <= x <=> n < x \/ x = n `]; +UNDISCH_TAC` n < CARD (V:real^3 -> bool) `; +MESON_TAC[]; + +SIMP_TAC[]; +STRIP_TAC; +MP_TAC (SPEC` n + 1 ` FINITE_NUMSEG_LT); +ASM_REWRITE_TAC[]; +UNDISCH_TAC` fv = face HS (v,rho_node1 FF v) `; +UNDISCH_TAC` fw = face HS (w,rho_node1 FF w) `; +DISCH_THEN (ASSUME_TAC o SYM); +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[FINITE_UNION]; +SUBGOAL_THEN` {i | n < i /\ i < CARD (V:real^3 -> bool)} = +{i | n < i } INTER {i | i < CARD V} ` MP_TAC; +SET_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` FINITE {i | n < i /\ i < CARD (V:real^3 -> bool)}` MP_TAC; +ASM_REWRITE_TAC[]; + +MATCH_MP_TAC FINITE_INTER; +DISJ2_TAC; +REWRITE_TAC[FINITE_NUMSEG_LT]; +DISCH_TAC; +STRIP_TAC; +SUBGOAL_THEN` DISJOINT {m | 0 < m /\ m < n } {0, n} ` ASSUME_TAC; +REWRITE_TAC[DISJOINT; EXTENSION; IN_INTER; NOT_IN_EMPTY; IN_INSERT; IN_ELIM_THM]; +GEN_TAC; +ARITH_TAC; + +SUBGOAL_THEN` DISJOINT {i | n < i /\ i < CARD (V:real^3 -> bool)} {0, n}` ASSUME_TAC; +REWRITE_TAC[DISJOINT; EXTENSION; IN_INTER; NOT_IN_EMPTY; IN_INSERT; IN_ELIM_THM]; +GEN_TAC; +ARITH_TAC; + +MP_TAC (ISPECL [` (\i. ff i * interior_angle1 (vec 0) fv (ITER i (rho_node1 FF) + v)) `; `{i | 0 < i /\ i < n} `; ` {0, n} `] SUM_UNION); +ANTS_TAC; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; + +MP_TAC (ISPECL [` (\i. ff i * interior_angle1 (vec 0) fw (ITER i (rho_node1 FF) + v)) `; `{i | n < i /\ i < CARD (V:real^3 -> bool)}`; ` {0, n} `] SUM_UNION); +ANTS_TAC; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +STRIP_TAC THEN STRIP_TAC; + + +SUBGOAL_THEN` sum {i | n < i /\ i < CARD (V:real^3 -> bool)} + (\i. ff i * interior_angle1 (vec 0) fw (ITER i (rho_node1 FF) v)) = +sum {i | n < i /\ i < CARD V} + (\i. ff i * interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) v)) ` MP_TAC; +MATCH_MP_TAC SUM_EQ; +GEN_TAC; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +REWRITE_TAC[REAL_EQ_MUL_LCANCEL]; +DISJ2_TAC; + +REWRITE_TAC[Local_lemmas.interior_angle1; GSYM ivs_rho_node1]; + +MP_TAC HAFL_CIRCLE_FORM_LOCAL_FAN2; +ANTS_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; + +MP_TAC (SPECL [` w:real^3 `;` v:real^3 `;` n':num`; `fw:real^3#real^3 -> bool`] +(GENL [` v:real^3`;` w:real^3 `;` n:num`;` fv:real^3#real^3 -> bool`] DETERMINE_FV2)); +PHA; +ANTS_TAC; +ASM_REWRITE_TAC[]; +DOWN_TAC; +SIMP_TAC[INSERT_COMM]; + +DISCH_THEN (ASSUME_TAC o SYM); +SUBGOAL_THEN` ITER x (rho_node1 FF) v, rho_node1 FF (ITER x (rho_node1 FF) v) IN fw ` MP_TAC; +EXPAND_TAC "fw"; +REWRITE_TAC[IN_INSERT; IN_ELIM_THM]; +DISJ2_TAC; +EXISTS_TAC`(x:num) - n `; +EXPAND_TAC "w"; +REWRITE_TAC[ITER_ADD]; +ASSUME_TAC2 (ARITH_RULE` n < (x:num) ==> x - n + n = x `); +ASM_REWRITE_TAC[ARITH_RULE`(x - n + 1) + n = (x - n + n ) + 1 `; GSYM ITER; ADD1]; +ASSUME_TAC2 CARD_V_TWO_HAFL_CIRCLE; +DOWN; +UNDISCH_TAC` x < CARD (V:real^3 -> bool) `; +UNDISCH_TAC` n < x:num `; +ARITH_TAC; +UNDISCH_TAC` local_fan (v_prime V fw,e_prime (E UNION {{w, v}}) fw,fw) `; +PHA; +NHANH Local_lemmas.DETER_RHO_NODE; +SIMP_TAC[]; + +STRIP_TAC; +SUBGOAL_THEN` ivs_rho_node1 FF (ITER x (rho_node1 FF) v), ITER x (rho_node1 FF) v IN fw ` MP_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V; +FIRST_X_ASSUM (MP_TAC o (SPEC` x:num`)); +ASSUME_TAC2 Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1; +FIRST_X_ASSUM NHANH; +STRIP_TAC; +FIRST_ASSUM (SUBST1_TAC o SYM); +REWRITE_TAC[ITER_ADD]; +ASSUME_TAC2 (ARITH_RULE` n < x /\ x < CARD (V:real^3 -> bool) ==> CARD V - 1 + x = x - 1 + CARD V `); +ASM_REWRITE_TAC[]; +REWRITE_TAC[GSYM ITER_ADD]; +ASSUME_TAC2 LOFA_IMP_ITER_RHO_NODE_ID2; +ASM_REWRITE_TAC[]; +EXPAND_TAC "fw"; +REWRITE_TAC[IN_INSERT; IN_ELIM_THM]; +DISJ2_TAC; +EXISTS_TAC` x - ( n + 1) `; +EXPAND_TAC "w"; +REWRITE_TAC[ITER_ADD]; +ASSUME_TAC2 (ARITH_RULE` n < x ==> x - (n + 1) + n = x - 1 /\ (x - (n + 1) + 1) + n = x`); +ASM_REWRITE_TAC[]; +ASSUME_TAC2 CARD_V_TWO_HAFL_CIRCLE; +DOWN; +UNDISCH_TAC` n < (x:num) `; +UNDISCH_TAC` x < CARD (V:real^3 -> bool) `; +ARITH_TAC; + + + + + + + +UNDISCH_TAC` local_fan (v_prime V fw,e_prime (E UNION {{w, v}}) fw,fw) `; +PHA; +NHANH Local_lemmas.IVS_RHO_NODE1_DETE; +SIMP_TAC[]; + + +ASM_REWRITE_TAC[]; +UNDISCH_TAC` HS = hypermap (HYP (vec 0,V,E UNION {{v, w:real^3}}))`; +DISCH_THEN (ASSUME_TAC o SYM); +UNDISCH_TAC` {i | n < i /\ i < CARD V} = {i | n < i} INTER {i | i < CARD (V:real^3 -> bool)} `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_SIMP_TAC[]; + + +SUBGOAL_THEN` sum {i | 0 < i /\ i < n} + (\i. ff i * interior_angle1 (vec 0) fv (ITER i (rho_node1 FF) v)) = +sum {i | 0 < i /\ i < n} + (\i. ff i * interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) v))` MP_TAC; +MATCH_MP_TAC SUM_EQ; +GEN_TAC; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +REWRITE_TAC[REAL_EQ_MUL_LCANCEL]; +DISJ2_TAC; +REWRITE_TAC[interior_angle1; GSYM ivs_rho_node1]; +MP_TAC HAFL_CIRCLE_FORM_LOCAL_FAN2; +ANTS_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; + +MP_TAC DETERMINE_FV2; +PHA; +ANTS_TAC; +ASM_REWRITE_TAC[]; +DISCH_THEN (ASSUME_TAC o SYM); +SUBGOAL_THEN` ITER x (rho_node1 FF) v, rho_node1 FF (ITER x (rho_node1 FF) v) IN fv ` MP_TAC; +EXPAND_TAC "fv"; +REWRITE_TAC[IN_INSERT; IN_ELIM_THM]; +DISJ2_TAC; +EXISTS_TAC`x:num `; +REWRITE_TAC[GSYM ITER; ADD1]; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` local_fan (v_prime V fv,e_prime (E UNION {{v, w}}) fv,fv) `; +PHA; +NHANH Local_lemmas.DETER_RHO_NODE; +SIMP_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` ivs_rho_node1 FF (ITER x (rho_node1 FF) v), ITER x (rho_node1 FF) v IN fv ` MP_TAC; +EXPAND_TAC "fv"; +REWRITE_TAC[IN_INSERT; IN_ELIM_THM]; +DISJ2_TAC; +EXISTS_TAC` x - 1 `; +ASSUME_TAC2 (ARITH_RULE` 0 < x ==> x - 1 + 1 = x `); +EXPAND_TAC "x"; +REWRITE_TAC[ITER; GSYM ADD1]; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V; +FIRST_X_ASSUM (ASSUME_TAC o (SPEC ` x - 1 `)); +ASSUME_TAC2 (SPEC` ITER (x - 1) (rho_node1 FF) v ` (GEN`v: real^3 ` Local_lemmas.IVS_RHO_IDD)); +FIRST_X_ASSUM SUBST1_TAC; +ASM_REWRITE_TAC[ADD1]; +UNDISCH_TAC` x < (n:num) `; +UNDISCH_TAC` 0 < x `; +ARITH_TAC; +UNDISCH_TAC` local_fan (v_prime V fv,e_prime (E UNION {{v, w}}) fv,fv) `; +PHA; +NHANH Local_lemmas.IVS_RHO_NODE1_DETE; +SIMP_TAC[]; + + +SIMP_TAC[]; +REPEAT STRIP_TAC THEN +ASM_CASES_TAC` 0 = n ` THEN +UNDISCH_TAC` ITER n (rho_node1 FF) v = w ` THEN +FIRST_X_ASSUM (SUBST_ALL_TAC o SYM) THEN +ASM_REWRITE_TAC[ITER]; + +DOWN THEN NHANH (REWRITE_RULE[RIGHT_FORALL_IMP_THM] Collect_geom.SUM_DIS2) THEN +STRIP_TAC THEN ASM_REWRITE_TAC[]; +SIMP_TAC[ITER]; +STRIP_TAC; +SUBGOAL_THEN` interior_angle1 (vec 0) fv v + interior_angle1 (vec 0) fw v = interior_angle1 (vec 0) FF v /\ +interior_angle1 (vec 0) fv w + interior_angle1 (vec 0) fw w = interior_angle1 (vec 0) FF w ` MP_TAC; +REWRITE_TAC[interior_angle1; GSYM ivs_rho_node1]; + +MP_TAC INTERIOR_ANGLE_LEM_SLICING_FAN2; +ANTS_TAC; +ASM_REWRITE_TAC[]; +SIMP_TAC[REAL_ADD_SYM; interior_angle1; GSYM ivs_rho_node1]; + + +REWRITE_TAC[REAL_ARITH` (a + b) + c = a + b + c `]; +REWRITE_TAC[REAL_ARITH` a + b + c + aa + bb + cc = a + aa + (b + bb) + (c + cc)`]; +SIMP_TAC[GSYM REAL_ADD_LDISTRIB]; +STRIP_TAC; +SUBGOAL_THEN` ff 0 * interior_angle1 (vec 0) FF v + + ff n * interior_angle1 (vec 0) FF w = sum {0, n} + (\i. ff i * interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) v))` MP_TAC; +ASM_REWRITE_TAC[ITER]; +SIMP_TAC[]; +STRIP_TAC; + +UNDISCH_TAC` DISJOINT {i | n < i /\ i < CARD (V:real^3 -> bool)} {0, n} `; +UNDISCH_TAC` FINITE {0, n} `; +UNDISCH_TAC` FINITE {i | n < i /\ i < CARD (V:real^3 -> bool)}`; +PHA; +NHANH (MESON[SUM_UNION]` FINITE s /\ FINITE t /\ DISJOINT s t +==> ! f. sum (s UNION t) f = sum s f + sum t f `); +STRIP_TAC; + + + +SUBGOAL_THEN` !i. n < i /\ i < CARD (V:real^3 -> bool) ==> + interior_angle1 (vec 0) fw (ITER i (rho_node1 FF) v) = + interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) v) ` MP_TAC; +MP_TAC (SPECL [` w:real^3 `;` v:real^3 `;`n':num `;` fw:real^3#real^3 -> bool`] +(GENL [` v:real^3 `;` w:real^3 `;` n: num `; `fv:real^3 # real^3 -> bool`] INTERIOR_AGL_EQ)); +PHA; +ANTS_TAC; +ASM_REWRITE_TAC[INSERT_COMM]; +UNDISCH_TAC` !z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t:real^3} `; +DISCH_THEN NHANH; +SIMP_TAC[INSERT_COMM]; +ASSUME_TAC2 CARD_V_TWO_HAFL_CIRCLE; +STRIP_TAC; +ONCE_REWRITE_TAC[ARITH_RULE` n < i /\ i < m <=> 0 < i - n /\ i - n < m - n `]; +ASSUME_TAC2 (ARITH_RULE` n + n' = CARD (V:real^3 -> bool) ==> CARD V - n = n'`); +FIRST_X_ASSUM SUBST1_TAC; +FIRST_X_ASSUM NHANH; +EXPAND_TAC "w"; +REWRITE_TAC[ITER_ADD]; +NHANH (ARITH_RULE` 0 < i - n ==> i - n + n = i `); +MESON_TAC[]; + +STRIP_TAC; +SUBGOAL_THEN` sum {i | n < i /\ i < CARD (V:real^3 -> bool)} + (\i. ff i * interior_angle1 (vec 0) fw (ITER i (rho_node1 FF) v)) = +sum {i | n < i /\ i < CARD V} + (\i. ff i * interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) v))` MP_TAC; +MATCH_MP_TAC SUM_EQ; +REWRITE_TAC[IN_ELIM_THM]; +FIRST_X_ASSUM NHANH; +SIMP_TAC[]; +DISCH_THEN SUBST1_TAC; +DOWN THEN DOWN; +DISCH_THEN (ASSUME_TAC o GSYM); +UNDISCH_TAC` !f. sum {0, n} f = f 0 + f n `; +DISCH_THEN (ASSUME_TAC o GSYM); +ASM_REWRITE_TAC[]; +STRIP_TAC; +UNDISCH_TAC` FINITE {0, n} `; +UNDISCH_TAC` FINITE {i | n < i /\ i < CARD (V:real^3 -> bool)} `; +PHA; +REWRITE_TAC[GSYM FINITE_UNION]; +STRIP_TAC; +SUBGOAL_THEN` DISJOINT {x | 0 < x /\ x < n} ({i | n < i /\ i < CARD (V:real^3 -> bool)} UNION {0, n}) ` MP_TAC; +REWRITE_TAC[DISJOINT; EXTENSION; NOT_IN_EMPTY; IN_INTER; IN_ELIM_THM; IN_UNION; IN_INSERT]; +GEN_TAC; +ARITH_TAC; +DOWN; +UNDISCH_TAC` FINITE {m | 0 < m /\ m < n} `; +PHA; +NHANH (MESON[SUM_UNION]` FINITE s /\ FINITE t /\ DISJOINT s t + ==> ! f. sum (s UNION t) f = sum s f + sum t f`); +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC o GSYM); +ASM_SIMP_TAC[]; + +MATCH_MP_TAC (MESON[]` s = ss ==> sum s f = sum ss f `); +REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_UNION; IN_INSERT; NOT_IN_EMPTY]; +GEN_TAC; +UNDISCH_TAC` n < CARD (V:real^3 -> bool) `; +ARITH_TAC]);; + + + +let THE_SLICING_INTO_2_LEMMA = prove(` convex_local_fan (V,E,FF) /\ + (local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E)) /\ + HS = hypermap (HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v,rho_node1 FF v) /\ + fw = face HS (w,rho_node1 FF w) + ==> convex_local_fan (v_prime V fv,e_prime (E UNION {{v, w}}) fv,fv) /\ + convex_local_fan (v_prime V fw,e_prime (E UNION {{w, v}}) fw,fw) /\ + (!ff. sum {i | i < CARD V} + (\i. ff i * + interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) v)) = + sum + {i | i < CARD V /\ ITER i (rho_node1 FF) v IN v_prime V fv} + (\i. ff i * + interior_angle1 (vec 0) fv (ITER i (rho_node1 FF) v)) + + sum + {i | i < CARD V /\ ITER i (rho_node1 FF) v IN v_prime V fw} + (\i. ff i * + interior_angle1 (vec 0) fw (ITER i (rho_node1 FF) v)))`, +NHANH COVEX_OF_LOFA_HALF_CIRCLE2 THEN +NHANH SUM_INTERIOR_AGL_LEMMA THEN SIMP_TAC[]);; + + + + +let WEDGE_IN_FAN_LOFA_DETER2 = prove(`local_fan (V,E,FF) /\ v IN V + ==> wedge_in_fan_gt (v,rho_node1 FF v) E = + wedge (vec 0) v (rho_node1 FF v) (ivs_rho_node1 FF v)`, +NHANH LOCAL_FAN_IVS_IN_V THEN +NHANH LOCAL_FAN_RHO_NODE_IVS THEN +ABBREV_TAC` vv = ivs_rho_node1 FF v` THEN +MESON_TAC[WEDGE_IN_FAN_LOFA_DETER]);; + + + + +let AZIM_COND_FOR_COPLANAR = prove_by_refinement +(`azim v0 v1 w1 w2 = &0 \/ azim v0 v1 w1 w2 = pi + <=> coplanar {v0, v1, w1, w2} `, +[EQ_TAC; +REWRITE_TAC[AZIM_EQ_0_PI_IMP_COPLANAR]; +ASM_CASES_TAC` collinear {v0, v1, w1:real^3} `; +STRIP_TAC; +DISJ1_TAC; +UNDISCH_TAC` collinear {v0, v1, w1:real^3}`; +REWRITE_TAC[AZIM_DEGENERATE]; +STRIP_TAC; +ASM_CASES_TAC` collinear {v0, v1, w2:real^3}`; +DISJ1_TAC; +DOWN; +REWRITE_TAC[AZIM_DEGENERATE]; +DOWN_TAC; +MESON_TAC[AZIM_EQ_0_PI_EQ_COPLANAR]]);; + + + +let AFF_SUB_PLANE = prove(`plane P /\ S SUBSET P ==> aff S SUBSET P `, +REWRITE_TAC[plane; aff] THEN +MESON_TAC[AFFINE_AFFINE_HULL; HULL_MINIMAL]);; + + + + +let PROVE_THE_SLICE_ASSUMPTION = prove_by_refinement +(`! v w. convex_local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E) +==> (!z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t})`, +[REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY]; +MATCH_MP_TAC (MESON[]`(!v w. P v w ==> P w v) /\ + (!v w. P v w ==> (!z t. z = v /\ Q z t ==> R z t)) + ==> (!v w. P v w ==> (!z t. (z = v \/ z = w) /\ Q z t ==> R z t))`); +SIMP_TAC[INSERT_COMM; IN_DIFF; IN_SING]; +REPEAT STRIP_TAC; +MP_TAC (SPEC` t:real^3 ` (GEN`w:real^3 ` CVLF_COLLINEAR_CIRCULAR_LUNAR)); +ANTS_TAC; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; INSERT_COMM]; +UNDISCH_TAC` ~(t = z:real^3)`; +ASM_SIMP_TAC[]; + +STRIP_TAC; +ASSUME_TAC2 Local_lemmas.KCHMAMG; +DOWN THEN STRIP_TAC; +SUBGOAL_THEN` interior_angle1 (vec 0) FF v = pi` MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +FIRST_ASSUM ACCEPT_TAC; +SUBGOAL_THEN` convex_local_fan (V,E,FF) ` MP_TAC; +ASM_REWRITE_TAC[]; + +REWRITE_TAC[convex_local_fan]; +STRIP_TAC; +ASSUME_TAC2 WEDGE_IN_FAN_LOFA_DETER2; + +SUBGOAL_THEN` aff {vec 0, v, w:real^3} SUBSET A` MP_TAC; +MATCH_MP_TAC AFF_SUB_PLANE; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +UNDISCH_TAC` (V:real^3 -> bool) SUBSET A `; +REWRITE_TAC[SUBSET]; +STRIP_TAC; +CONJ_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +FIRST_ASSUM ACCEPT_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +FIRST_ASSUM ACCEPT_TAC; + +MP_TAC (ISPECL[`{vec 0: real^3}`;` {v,w:real^3}`] (GEN_ALL Local_lemmas.AFF_GT_SUB_AFF_UNION)); +REWRITE_TAC[SET_RULE` {a} UNION S = a INSERT S `]; +PHA; +NHANH (SUBSET_TRANS); +STRIP_TAC; +DOWN; +REWRITE_TAC[SUBSET]; +SUBGOAL_THEN` DISJOINT {vec 0} {v,w:real^3} ` MP_TAC; +ASM_REWRITE_TAC[SET_RULE` DISJOINT {a} S <=> ~( a IN S) `; IN_INSERT; NOT_IN_EMPTY; DE_MORGAN_THM]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_V_DIFF; +UNDISCH_TAC` v:real^3 IN V `; +UNDISCH_TAC` w:real^3 IN V `; +FIRST_X_ASSUM NHANH; +SIMP_TAC[]; +NHANH Planarity.exists_in_aff_gt_disjoint; +STRIP_TAC; +DISCH_THEN (ASSUME_TAC2 o (SPEC` y:real^3 `)); + +SUBGOAL_THEN` coplanar {vec 0, v, rho_node1 FF v, y} ` MP_TAC; +UNDISCH_TAC` plane (A:real^3 -> bool) `; +REWRITE_TAC[coplanar; plane]; +STRIP_TAC; +EXISTS_TAC` u:real^3 `; +EXISTS_TAC` v':real^3 `; +EXISTS_TAC` w':real^3 `; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +ASSUME_TAC2 Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; +DOWN; +UNDISCH_TAC` v:real^3 IN V `; +UNDISCH_TAC` (V:real^3 -> bool) SUBSET A `; +REWRITE_TAC[SUBSET]; +DISCH_THEN NHANH; +SIMP_TAC[]; + +REWRITE_TAC[ GSYM AZIM_COND_FOR_COPLANAR]; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2; +DOWN THEN STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` v:real^3 `)); +DOWN; +UNDISCH_TAC` !x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E `; +DISCH_THEN NHANH; +ASM_REWRITE_TAC[SUBSET]; +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC`y: real^3 `)); +DOWN; +REWRITE_TAC[wedge; IN_ELIM_THM; interior_angle1; GSYM ivs_rho_node1]; +REAL_ARITH_TAC; + +MP_TAC (SPEC`t:real^3 ` (GEN` w:real^3 ` Local_lemmas.HKIRPEP)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASSUME_TAC2 Local_lemmas.CVX_LO_IMP_LO; +ASSUME_TAC2 WEDGE_IN_FAN_LOFA_DETER2; + +SUBGOAL_THEN` i + j = CARD (V:real^3 -> bool) ` MP_TAC; +MATCH_MP_TAC (GEN`w:real^3 ` CARD_V_TWO_HAFL_CIRCLE); +EXISTS_TAC` t: real^3 `; +SWITCH_TAC` t = ITER i (rho_node1 FF) v `; +SWITCH_TAC` v = ITER j (rho_node1 FF) t `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` ~(t = (z:real^3))`; +ASM_REWRITE_TAC[EQ_SYM_EQ]; +ASSUME_TAC2 POINT_PRESENTED_IN_RHOND1; +DOWN THEN STRIP_TAC; +ASM_CASES_TAC` n = 0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN THEN DOWN; +SWITCH_TAC` t = ITER i (rho_node1 FF) v `; +SWITCH_TAC` v = ITER j (rho_node1 FF) t `; +ASM_REWRITE_TAC[ITER]; +ASM_CASES_TAC` n < (i:num) `; +SUBGOAL_THEN` w IN {ITER l (rho_node1 FF) v | 0 < l /\ l < i} ` MP_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC`n:num `; +ASM_REWRITE_TAC[]; +DOWN THEN DOWN; +ARITH_TAC; +SWITCH_TAC` t = ITER i (rho_node1 FF) v `; +SWITCH_TAC` v = ITER j (rho_node1 FF) t `; +ASM_REWRITE_TAC[IN_INTER]; +STRIP_TAC; +SUBGOAL_THEN` aff_gt {vec 0, v} {rho_node1 FF v} = aff_gt {vec 0, v} {w}` MP_TAC; +MATCH_MP_TAC Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2; +ASM_REWRITE_TAC[]; +MP_TAC (REWRITE_RULE[SING_SUBSET; IN_INSERT] ( +ISPECL [`{v:real^3}`;` {vec 0, v:real^3}`; `{w:real^3}`] (GEN_ALL Local_lemmas.AFF_GT_MONO_TRANS))); +REWRITE_TAC[Packing3.SING_UNION_EQ_INSERT]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_V_DIFF; +SUBGOAL_THEN` {vec 0, v} DIFF {v:real^3} = {vec 0}` MP_TAC; +REWRITE_TAC[DIFF; EXTENSION; IN_ELIM_THM; IN_INSERT; NOT_IN_EMPTY]; +GEN_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` v:real^3`)); +DOWN; +MESON_TAC[]; +SIMP_TAC[]; +PHA THEN STRIP_TAC; +SUBGOAL_THEN` DISJOINT {vec 0} {w, v:real^3}` MP_TAC; +REWRITE_TAC[SET_RULE` DISJOINT {a} S <=> ~( a IN S)`; IN_INSERT; NOT_IN_EMPTY; DE_MORGAN_THM]; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` v:real^3 `)); +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` w:real^3 `)); +DOWN THEN DOWN; +SIMP_TAC[]; + +NHANH Planarity.exists_in_aff_gt_disjoint; +STRIP_TAC; + +SUBGOAL_THEN` y IN aff_gt {vec 0, v} {rho_node1 FF v}` MP_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` aff_gt {vec 0} {w, v} SUBSET aff_gt {vec 0, v} {w:real^3} `; +REWRITE_TAC[SUBSET]; +DISCH_THEN MATCH_MP_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2; +STRIP_TAC; +SUBGOAL_THEN` ~collinear {vec 0, v, y:real^3}` MP_TAC; +MATCH_MP_TAC (GEN_ALL Local_lemmas.COLL_IN_AFF_GT_TOO); +EXISTS_TAC` rho_node1 FF v `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` ~collinear {vec 0, v, rho_node1 FF v}`; +PHA; +NHANH AZIM_EQ_0_ALT; +STRIP_TAC; +FIRST_X_ASSUM (SUBST_ALL_TAC o SYM); +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2; +DOWN THEN STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` v:real^3 `)); +DOWN; + +UNDISCH_TAC` !x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E `; +DISCH_THEN NHANH; +REWRITE_TAC[SUBSET]; +ONCE_REWRITE_TAC[INSERT_COMM]; +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC`y: real^3 `)); +DOWN; +ASM_REWRITE_TAC[wedge; IN_ELIM_THM]; +REAL_ARITH_TAC; + + +SWITCH_TAC` v = ITER j (rho_node1 FF) t `; +SWITCH_TAC` t = ITER i (rho_node1 FF) v `; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2; +DOWN THEN STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` v:real^3 `)); +DOWN; +UNDISCH_TAC` !x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E `; +STRIP_TAC; +PHA; +FIRST_ASSUM NHANH; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_V_DIFF; +SUBGOAL_THEN` DISJOINT {vec 0} {v, w:real^3} ` MP_TAC; +REWRITE_TAC[DISJOINT; INTER; EXTENSION; IN_ELIM_THM; IN_INSERT; NOT_IN_EMPTY]; +DOWN; +UNDISCH_TAC` (v:real^3) IN V `; +UNDISCH_TAC` (w:real^3) IN V `; +MESON_TAC[]; +PHA; +NHANH Planarity.exists_in_aff_gt_disjoint; +STRIP_TAC; + +ASM_CASES_TAC` n = (i:num) `; +UNDISCH_TAC` collinear {t, v:real^3, vec 0} `; +FIRST_X_ASSUM SUBST_ALL_TAC; +ASM_REWRITE_TAC[]; +ONCE_REWRITE_TAC[GSYM COLLINEAR_AFFINE_HULL_COLLINEAR]; +REWRITE_TAC[GSYM aff]; + +SUBGOAL_THEN` {vec 0, v, (y:real^3)} SUBSET aff {t,v, vec 0} ` MP_TAC; +MP_TAC (ISPECL [` {t, v:real^3, vec 0} `] (ISPECL [` affine` ] HULL_SUBSET)); +SIMP_TAC[GSYM aff; INSERT_SUBSET; EMPTY_SUBSET]; +SUBGOAL_THEN` t = (w:real^3) ` SUBST_ALL_TAC; +EXPAND_TAC "t"; +EXPAND_TAC "w"; +REWRITE_TAC[]; +DOWN; +MP_TAC (ISPECL [` {vec 0:real^3} `; `{v, w:real^3 }`] (GEN_ALL Local_lemmas.AFF_GT_SUB_AFF_UNION)); +REWRITE_TAC[SUBSET]; +DISCH_THEN NHANH; +SIMP_TAC[SET_RULE` {a} UNION S = a INSERT S`; INSERT_COMM]; + +REPEAT STRIP_TAC; +SUBGOAL_THEN` collinear {vec 0, v, y:real^3} ` MP_TAC; +MATCH_MP_TAC COLLINEAR_SUBSET; +EXISTS_TAC` aff {t, v:real^3, vec 0} `; +ASM_REWRITE_TAC[]; + +STRIP_TAC; +SUBGOAL_THEN` azim (vec 0) v (rho_node1 FF v) y = &0 ` MP_TAC; +DOWN; +REWRITE_TAC[AZIM_DEGENERATE]; +UNDISCH_TAC` y IN aff_gt {vec 0} {v, w:real^3} `; +PHA; +UNDISCH_TAC` aff_gt {vec 0} {v, w} SUBSET + wedge (vec 0) v (rho_node1 FF v) (ivs_rho_node1 FF v) `; +REWRITE_TAC[SUBSET]; +DISCH_THEN NHANH; +ASM_REWRITE_TAC[wedge; IN_ELIM_THM]; + + +SUBGOAL_THEN` w IN {ITER l (rho_node1 FF) t | 0 < l /\ l < j} ` MP_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` n - (i:num) `; +EXPAND_TAC "t"; +REWRITE_TAC[ITER_ADD]; +UNDISCH_TAC` ~( n < (i:num)) `; +NHANH (ARITH_RULE` ~( a < (b:num)) ==> a - b + b = a `); +ASM_SIMP_TAC[]; +STRIP_TAC; +CONJ_TAC; +REPLICATE_TAC 3 DOWN; +PHA; +ARITH_TAC; +ASSUME_TAC2 (ARITH_RULE`~(n < i ) ==> (n - i < (j:num) <=> n < i + j) `); +ASM_REWRITE_TAC[]; + + + +ASM_REWRITE_TAC[IN_INTER]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_NOT_COLL_IVS; +STRIP_TAC; +UNDISCH_TAC` ~( n = (i:num)) `; +PHA; +DOWN THEN DOWN THEN PHA; +NHANH Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; +STRIP_TAC; + +MP_TAC ( +REWRITE_RULE[INSERT_SUBSET; EMPTY_SUBSET; IN_INSERT] ( +ISPECL [`{vec 0: real^3}`;`{v, w:real^3}`; ` {v:real^3} `] (GEN_ALL Local_lemmas.AFF_GT_MONO))); +SUBGOAL_THEN` {v,w} DIFF {v:real^3} = {w} ` SUBST1_TAC; +UNDISCH_TAC` ~( v = w:real^3) `; +SET_TAC[]; + +REWRITE_TAC[Packing3.SING_UNION_EQ_INSERT]; +STRIP_TAC; +SUBGOAL_THEN` y IN aff_gt {vec 0, v} {ivs_rho_node1 FF v} ` MP_TAC; +DOWN; +ASM_REWRITE_TAC[SUBSET]; +DISCH_THEN MATCH_MP_TAC; +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN` ~ collinear {vec 0, v, rho_node1 FF v} /\ +~ collinear {vec 0, v, y} /\ +~ collinear {vec 0, v, ivs_rho_node1 FF v } ` MP_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC (GEN_ALL Local_lemmas.COLL_IN_AFF_GT_TOO); +EXISTS_TAC` ivs_rho_node1 FF v `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` aff_gt {vec 0} {v, w} SUBSET aff_gt {vec 0, v} {w:real^3} `; +REWRITE_TAC[SUBSET]; +DISCH_THEN MATCH_MP_TAC; +ASM_REWRITE_TAC[]; + +NHANH AZIM_EQ_ALT; +STRIP_TAC; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +UNDISCH_TAC` y IN aff_gt {vec 0} {v, w:real^3} `; +UNDISCH_TAC` aff_gt {vec 0} {v, w} SUBSET + wedge (vec 0) v (rho_node1 FF v) (ivs_rho_node1 FF v) `; +REWRITE_TAC[SUBSET]; +DISCH_THEN NHANH; +REWRITE_TAC[IN_ELIM_THM; wedge]; +STRIP_TAC; +DOWN; +REAL_ARITH_TAC]);; + + + + +let EJRCFJD = prove(` convex_local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E) /\ + HS = hypermap (HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v,rho_node1 FF v) /\ + fw = face HS (w,rho_node1 FF w) + ==> convex_local_fan (v_prime V fv,e_prime (E UNION {{v, w}}) fv,fv) /\ + convex_local_fan (v_prime V fw,e_prime (E UNION {{w, v}}) fw,fw) /\ + (!ff. sum {i | i < CARD V} + (\i. ff i * + interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) v)) = + sum + {i | i < CARD V /\ ITER i (rho_node1 FF) v IN v_prime V fv} + (\i. ff i * + interior_angle1 (vec 0) fv (ITER i (rho_node1 FF) v)) + + sum + {i | i < CARD V /\ ITER i (rho_node1 FF) v IN v_prime V fw} + (\i. ff i * + interior_angle1 (vec 0) fw (ITER i (rho_node1 FF) v)))`, +STRIP_TAC THEN +ASSUME_TAC2 PROVE_THE_SLICE_ASSUMPTION THEN +MATCH_MP_TAC THE_SLICING_INTO_2_LEMMA THEN +ASSUME_TAC2 Local_lemmas.CVX_LO_IMP_LO THEN +ASM_REWRITE_TAC[] THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN +DOWN THEN +FIRST_X_ASSUM MATCH_MP_TAC THEN +FIRST_X_ASSUM ACCEPT_TAC);; + + + + +let DIST_TRIANGLE_AS_ABS = prove(` abs ( dist (x,y) - dist (x,z:real^N)) <= dist (y,z) `, +REWRITE_TAC[REAL_ABS_BOUNDS] THEN CONJ_TAC THENL [ +REWRITE_TAC[REAL_ARITH` -- a <= b - c <=> c <= b + a `; DIST_TRIANGLE]; +REWRITE_TAC[REAL_ARITH` a - b <= c <=> a <= b + c `] THEN +MESON_TAC[DIST_TRIANGLE; DIST_SYM]]);; + + + + +let CON_ATREAL_REAL_CON2_REDO = prove_by_refinement +(` (f:real -> real^N) continuous atreal r /\ g continuous atreal r + ==> (\t. dist (f t,g t)) real_continuous atreal r`, +[REWRITE_TAC[real_continuous_atreal; continuous_atreal]; +REPEAT STRIP_TAC; +SUBGOAL_THEN` &0 < e / &2 ` ASSUME_TAC; +DOWN; +REAL_ARITH_TAC; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM (MP_TAC o (SPEC` e / &2 `)); +ANTS_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` e / &2 `)); +ANTS_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +STRIP_TAC; +STRIP_TAC; +EXISTS_TAC` min d d'`; +ASM_REWRITE_TAC[REAL_LT_MIN]; +GEN_TAC; +FIRST_X_ASSUM NHANH; +FIRST_X_ASSUM NHANH; +STRIP_TAC; +SUBST1_TAC (REAL_ARITH` dist ((f:real -> real^N) x',g x') - dist (f r,g r) = + (dist (f x',g x') - dist (f x', g r)) + ( dist (f x', g r) - dist (f r,g r))`); +MP_TAC (SPECL [` dist ((f:real -> real^N) x',g x') - dist (f x',g r)`; ` dist ((f:real -> real^N) x',g r) - dist (f r,g r) `] REAL_ABS_TRIANGLE); + +SUBGOAL_THEN` abs (dist ((f:real -> real^N) x',g x') - dist (f x',g r)) + + abs (dist (f x',g r) - dist (f r,g r)) < e ` MP_TAC; +MATCH_MP_TAC REAL_LET_TRANS; +EXISTS_TAC`dist (g x',(g:real -> real^N) r) + dist (f x',(f:real -> real^N) r)`; +CONJ_TAC; +MATCH_MP_TAC (REAL_ARITH` a <= b /\ d <= c ==> a + d <= b + c `); +REWRITE_TAC[DIST_TRIANGLE_AS_ABS]; + + +REWRITE_TAC[DIST_SYM]; +ONCE_REWRITE_TAC[DIST_SYM]; +REWRITE_TAC[DIST_TRIANGLE_AS_ABS]; + +ASM_REAL_ARITH_TAC; +REAL_ARITH_TAC]);; + + + + + +let REAL_POS_LT_MUL = prove( +` &0 <= a /\ a < b /\ &0 <= x /\ x < y ==> a * x < b * y `, +NHANH REAL_LET_TRANS THEN STRIP_TAC THEN +ASSUME_TAC2 (SPECL [` a:real`;` b:real`;` y:real `] REAL_LT_RMUL) THEN +MATCH_MP_TAC REAL_LET_TRANS THEN EXISTS_TAC` a * (y:real) ` THEN +ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LE_LMUL THEN +ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LT_IMP_LE THEN +FIRST_X_ASSUM ACCEPT_TAC);; + + + + + +let REAL_CONTINUOUS_ATREAL_IMP_MUL_FUN = prove_by_refinement +(` f real_continuous atreal r /\ g real_continuous atreal r +==> (\t. (f t) * (g t)) real_continuous atreal r `, +[REWRITE_TAC[real_continuous_atreal]; +STRIP_TAC; +GEN_TAC; +STRIP_TAC; +SUBGOAL_THEN` &0 < e / (&2 * ( abs (f (r:real)) + &1)) ` MP_TAC; +MATCH_MP_TAC REAL_LT_DIV; +ASM_REWRITE_TAC[]; +REAL_ARITH_TAC; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` e / (&2 * (abs (f (r:real)) + &1))`)); +ANTS_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +STRIP_TAC; +ABBREV_TAC` dd = e / (&2 * (abs (f (r:real)) + &1)) `; +SUBGOAL_THEN` &0 < e / (&2 * (abs (g (r:real)) + dd)) ` ASSUME_TAC; +MATCH_MP_TAC REAL_LT_DIV; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` &0 < dd `; +REAL_ARITH_TAC; +UNDISCH_TAC` !e. &0 < e + ==> (?d. &0 < d /\ (!x'. abs (x' - r) < d ==> abs (f x' - f (r:real)) < e))`; +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` e / (&2 * (abs (g (r:real)) + dd))`)); +DOWN THEN STRIP_TAC; +EXISTS_TAC` min d d' `; +ASM_REWRITE_TAC[REAL_LT_MIN]; +GEN_TAC; +FIRST_X_ASSUM NHANH; +FIRST_X_ASSUM NHANH; +STRIP_TAC; +SUBST1_TAC (REAL_ARITH` f (x':real) * g x' - f r * g r = (f x' - f r) * g x' + ( g x' - g r) * f r `); +MATCH_MP_TAC REAL_LET_TRANS; +EXISTS_TAC` abs ((f x' - f r) * g x') + abs ((g x' - g r) * f (r:real)) `; +REWRITE_TAC[REAL_ABS_TRIANGLE; REAL_ABS_MUL]; +MP_TAC (SPECL[`abs (g x' - g (r:real)) `;` dd:real `; ` abs (f (r:real))`] REAL_LE_RMUL); +ANTS_TAC; +REWRITE_TAC[ REAL_ABS_POS]; +MATCH_MP_TAC REAL_LT_IMP_LE; +FIRST_X_ASSUM ACCEPT_TAC; +MP_TAC (SPECL [`(g:real -> real) x' `; `(g:real -> real) r`] REAL_SUB_ABS); +REWRITE_TAC[REAL_ARITH` a - b <= c <=> a <= b + c `]; +STRIP_TAC; +ASSUME_TAC2 (REAL_ARITH` abs (g x' - g (r:real)) < dd /\ +abs (g x') <= abs (g r) + abs (g x' - g r) ==> abs (g x') < abs (g r) + dd`); +STRIP_TAC; +MP_TAC (ISPECL [`abs (f x' - f (r:real)) `;` abs ( g (x':real)) `; +` e / (&2 * (abs (g (r:real)) + dd)) `;` abs (g (r:real)) + dd`] (GEN_ALL REAL_POS_LT_MUL)); +ANTS_TAC; +ASM_REWRITE_TAC[REAL_ABS_POS]; +DOWN THEN PHA; +NHANH (REAL_ARITH` a <= b /\ c < d ==> c + a < b + d `); +STRIP_TAC; +DOWN; +SUBGOAL_THEN` e / (&2 * (abs (g r) + dd)) * (abs (g (r:real)) + dd) = e / &2 ` SUBST1_TAC; +UNDISCH_TAC` &0 < dd `; +CONV_TAC REAL_FIELD; +EXPAND_TAC "dd"; +SUBST1_TAC (REAL_FIELD` e / (&2 * (abs (f (r:real)) + &1)) * abs (f r) = (e / &2) * (abs (f r) / ( abs (f r) + &1))`); +SUBGOAL_THEN` abs (f r) / (abs (f (r:real)) + &1) < &1 ` MP_TAC; +MATCH_MP_TAC Real_ext.REAL_PROP_LT_LCANCEL; +EXISTS_TAC` abs (f (r:real)) + &1`; +SUBGOAL_THEN` &0 < abs (f (r:real)) + &1 ` MP_TAC; +REAL_ARITH_TAC; +SIMP_TAC[REAL_FIELD` &0 < a ==> a * x / a = x `; REAL_MUL_RID]; +REAL_ARITH_TAC; + +DISCH_TAC; +MP_TAC (SPECL [` e / &2 `;` abs (f r) / (abs (f (r:real)) + &1)`; `&1 `] REAL_LT_LMUL); +ANTS_TAC; +ASM_REWRITE_TAC[REAL_ARITH` &0 < e / &2 <=> &0 < e `]; +ABBREV_TAC` dx = abs (f x' - f r) * abs (g x') + abs (g x' - g r) * abs (f (r:real))`; +REAL_ARITH_TAC]);; + + + + + +let REAL_CONTINUOUS_ATREAL_POW_2 = +REWRITE_RULE[CONJ_ACI; GSYM POW_2] ( +SPEC` f:real -> real ` (GEN`g:real -> real ` REAL_CONTINUOUS_ATREAL_IMP_MUL_FUN));; + + + + +let CONSTANCE_FUN_CONTINUOUS = prove(` ! c. (\t. c) real_continuous atreal r `, +REWRITE_TAC[real_continuous_atreal] THEN +REPEAT STRIP_TAC THEN EXISTS_TAC ` e:real ` THEN +ASM_REWRITE_TAC[REAL_SUB_REFL; REAL_ABS_0]);; + + +let REAL_CONS_IMP_SCALAR_MUL = prove( +` f real_continuous atreal r ==> ! c. (\t. c * f t) real_continuous atreal r `, +STRIP_TAC THEN GEN_TAC THEN +MP_TAC (SPEC_ALL CONSTANCE_FUN_CONTINUOUS) THEN +DOWN THEN PHA THEN NHANH REAL_CONTINUOUS_ATREAL_IMP_MUL_FUN THEN +SIMP_TAC[BETA_THM; REAL_MUL_SYM]);; + + +let CONS_IMP_SO_IVS = prove(` f real_continuous atreal r ==> (\t. -- f t) real_continuous atreal r `, +MP_TAC (SPEC` -- &1 ` CONSTANCE_FUN_CONTINUOUS) THEN +PHA THEN +NHANH REAL_CONTINUOUS_ATREAL_IMP_MUL_FUN THEN +SIMP_TAC[BETA_THM; GSYM REAL_NEG_MINUS1]);; + + + +let REAL_CONS_IMP_SUM_CONS = prove_by_refinement( +` f real_continuous atreal r /\ g real_continuous atreal r +==> (\t. f t + g t) real_continuous atreal r `, +[REWRITE_TAC[real_continuous_atreal] ; +REPEAT STRIP_TAC ; +ASSUME_TAC2 (REAL_ARITH` &0 < e ==> &0 < e / &2 `) ; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` e / &2 `)) ; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` e / &2 `)) ; +DOWN THEN DOWN ; +PHA THEN STRIP_TAC ; +EXISTS_TAC` min d d' ` ; +REWRITE_TAC[REAL_LT_MIN] ; +ASM_REWRITE_TAC[] ; +GEN_TAC ; +FIRST_X_ASSUM NHANH ; +FIRST_X_ASSUM NHANH ; +STRIP_TAC ; +MATCH_MP_TAC REAL_LET_TRANS ; +EXISTS_TAC` abs (g x' - g r) + abs (f x' - f (r:real))` ; +CONJ_TAC ; +REAL_ARITH_TAC ; +REPLICATE_TAC 3 DOWN THEN PHA ; +REAL_ARITH_TAC]);; + + + + +let REAL_CONS_IMP_SCALAR_MUL_ALT = +REWRITE_RULE[RIGHT_IMP_FORALL_THM] REAL_CONS_IMP_SCALAR_MUL;; + + +let UPS_X_CONTS_FUNC = prove_by_refinement +(` (f:real -> real^N) continuous atreal r /\ +(g: real -> real^N) continuous atreal r /\ +(h: real -> real^N) continuous atreal r + ==> (\r. ups_x (dist (f r,g r) pow 2) (dist (h r,f r) pow 2) (dist (g r, h r) pow 2)) real_continuous atreal r `, +[REWRITE_TAC[ups_x]; +STRIP_TAC; +ASSUME_TAC2 CON_ATREAL_REAL_CON2_REDO; +ASSUME_TAC2 (SPECL [` g:real -> real^N `;` h:real -> real^N`;` r:real `] (GEN_ALL CON_ATREAL_REAL_CON2_REDO)); +ASSUME_TAC2 (SPECL [` h:real -> real^N `;` f:real -> real^N`;` r:real `] (GEN_ALL CON_ATREAL_REAL_CON2_REDO)); +REPLICATE_TAC 3 DOWN THEN PHA; +NHANH_PAT `\x. x ==> y ` REAL_CONTINUOUS_ATREAL_POW_2; +REWRITE_TAC[BETA_THM]; +NHANH_PAT `\x. x ==> y ` REAL_CONTINUOUS_ATREAL_POW_2; +REWRITE_TAC[BETA_THM]; +STRIP_TAC; +SUBGOAL_THEN`(\r. dist ((f:real -> real^N) r,g r) pow 2 * dist (g r,h r) pow 2) real_continuous atreal r ` ASSUME_TAC; +MATCH_MP_TAC REAL_CONTINUOUS_ATREAL_IMP_MUL_FUN; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN `(\r. dist ((f:real -> real^N) r,g r) pow 2 * dist (h r,f r) pow 2) real_continuous atreal r ` ASSUME_TAC; +MATCH_MP_TAC REAL_CONTINUOUS_ATREAL_IMP_MUL_FUN; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN`(\r. dist ((h:real -> real^N) r,f r) pow 2 * dist (g r,h r) pow 2) real_continuous atreal r ` ASSUME_TAC; +MATCH_MP_TAC REAL_CONTINUOUS_ATREAL_IMP_MUL_FUN; +ASM_REWRITE_TAC[]; + +REWRITE_TAC[REAL_ARITH` a - b = a + -- b `]; +MATCH_MP_TAC REAL_CONS_IMP_SUM_CONS; +CONJ_TAC; +MATCH_MP_TAC REAL_CONS_IMP_SUM_CONS; +CONJ_TAC; +MATCH_MP_TAC REAL_CONS_IMP_SUM_CONS; +CONJ_TAC; +REWRITE_TAC[REAL_ARITH` -- a * b = -- ( a * b) `]; +MATCH_MP_TAC CONS_IMP_SO_IVS; +ASM_REWRITE_TAC[GSYM REAL_POW_2]; +MATCH_MP_TAC CONS_IMP_SO_IVS; +ASM_REWRITE_TAC[GSYM REAL_POW_2]; +MATCH_MP_TAC CONS_IMP_SO_IVS; +ASM_REWRITE_TAC[GSYM REAL_POW_2]; +MATCH_MP_TAC REAL_CONS_IMP_SUM_CONS; +CONJ_TAC; +MATCH_MP_TAC REAL_CONS_IMP_SCALAR_MUL_ALT; +FIRST_X_ASSUM ACCEPT_TAC; +MATCH_MP_TAC REAL_CONS_IMP_SUM_CONS; +CONJ_TAC; +MATCH_MP_TAC REAL_CONS_IMP_SCALAR_MUL_ALT; +FIRST_X_ASSUM ACCEPT_TAC; +MATCH_MP_TAC REAL_CONS_IMP_SCALAR_MUL_ALT; +FIRST_X_ASSUM ACCEPT_TAC]);; + + + + +let CONTS_FUN_CONTINUOUS_ATREAL = prove( +`! v0. (\t. (v0: real^N)) continuous atreal r `, +SIMP_TAC[continuous_atreal; DIST_REFL] THEN MESON_TAC[]);; + + + + +let REAL_CONS_STILL_DIFF = prove(` f real_continuous atreal r /\ ~( f r = a) +==> ?d. &0 < d /\ (! rr. abs (rr - r) < d ==> ~( f rr = a)) `, +ONCE_REWRITE_TAC[REAL_ARITH` a = b <=> a - b = &0 `] THEN +REWRITE_TAC[real_continuous_atreal; REAL_ABS_NZ] THEN +STRIP_TAC THEN +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` abs ((f:real -> real) r - a)`)) THEN +DOWN THEN STRIP_TAC THEN +EXISTS_TAC` d:real ` THEN +ASM_REWRITE_TAC[] THEN +GEN_TAC THEN FIRST_X_ASSUM NHANH THEN +REAL_ARITH_TAC);; + + + + +let CONTINUOUS_PRESERVE_COLLINEAR = prove_by_refinement +(` f continuous atreal r /\ +g continuous atreal r /\ +~ collinear {v0:real^3, f r, g r} + ==> ? e. &0 < e /\ + (! r'. abs ( r - r') < e + ==> ~ collinear {v0, f r', g r'} ) `, +[REWRITE_TAC[Collect_geom.COL_EQ_UPS_0]; +MP_TAC (ISPECL [` (f:real -> real^3) r `;` v0:real^3 `; +`(g:real -> real^3) r `] (GEN_ALL Collect_geom.TROI_OI_DAT_HOI)); +PHA; +REWRITE_TAC[Collect_geom.UPS_X_SYM]; +STRIP_TAC; +MP_TAC (ISPEC` v0:real^3` CONTS_FUN_CONTINUOUS_ATREAL); +UNDISCH_TAC` (g:real -> real^3) continuous atreal r `; +UNDISCH_TAC` (f:real -> real^3) continuous atreal r `; +PHA; +NHANH UPS_X_CONTS_FUNC; +REWRITE_TAC[BETA_THM]; +STRIP_TAC; +MP_TAC (ISPECL [` r:real `; `(\r. ups_x (dist ((f:real -> real^3) r,g r) pow 2) (dist (v0,f r) pow 2) + (dist (v0,g r) pow 2)) `; ` &0 `] +(GEN_ALL REAL_CONS_STILL_DIFF)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +DOWN; +REWRITE_TAC[DIST_SYM]; +SIMP_TAC[REAL_ARITH` abs ( a - b) = abs ( b - a) `]]);; + + + + +let EACH_ELM_PRESERVED_IMP_ALL = prove_by_refinement +(` (!x. x IN (E: A -> bool) + ==> (?e. &0 < e /\ + (!t. abs t < e + ==> P x t))) /\ + FINITE E + ==> (?e. &0 < e /\ + (!t. abs t < e + ==> ! x. x IN E ==> P x t))`, +[ABBREV_TAC` n = CARD (E: A -> bool) `; +DOWN; +SPEC_TAC (` E: A -> bool `,` E:A -> bool `); +SPEC_TAC (`n:num `,` n:num `); +INDUCT_TAC; +NHANH CARD_EQ_0; +STRIP_TAC THEN STRIP_TAC THEN STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +ASM_REWRITE_TAC[IMAGE_CLAUSES; NOT_IN_EMPTY]; +EXISTS_TAC` &1 `; +REAL_ARITH_TAC; + +GEN_TAC; +ASM_CASES_TAC` (E: A -> bool) = {} `; +ASM_REWRITE_TAC[CARD_CLAUSES; ADD1]; +REWRITE_TAC[ARITH_RULE` ~( 0 = n + 1) `]; +DOWN; +REWRITE_TAC[Local_lemmas.EMPTY_NOT_EXISTS_IN]; +REPEAT STRIP_TAC; +UNDISCH_TAC` (x:A) IN E `; +FIRST_ASSUM NHANH; +STRIP_TAC; +UNDISCH_TAC` !E. CARD (E: A -> bool) = n + ==> (!x. x IN E ==> (?e. &0 < e /\ (!t. abs t < e ==> P x t))) /\ + FINITE E + ==> (?e. &0 < e /\ (!t. abs t < e ==> (!x. x IN E ==> P x t))) `; + +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` E DELETE (x:A)`)); +PHA; +ANTS_TAC; +ASSUME_TAC2 (ISPECL [` x:A `;` E: A -> bool `] CARD_DELETE); +ASM_REWRITE_TAC[ARITH_RULE` SUC n - 1 = n `; IN_DELETE; FINITE_DELETE]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +STRIP_TAC; +EXISTS_TAC` min e e' `; +REWRITE_TAC[REAL_LT_MIN]; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM NHANH; +FIRST_X_ASSUM NHANH; +GEN_TAC; +SET_TAC[]]);; + + +let EACH_ELM_PRESERVED_IMP_ALLL = +prove_by_refinement ( +` (! x. (x:real^3 -> bool) IN E ==> (? e. &0 < e /\ (! t. abs t < e ==> ~collinear ({vec 0} UNION (IMAGE (\v. (phii: real ^3 -> real -> real^3) v t) x))))) /\ +FINITE E +==> ?e. &0 < e /\ + (!t. abs t < e + ==> (!e. e IN IMAGE (IMAGE (\v. phii v t)) E + ==> ~collinear ({vec 0} UNION e))) `, +[ABBREV_TAC` n = CARD (E:(real^3 -> bool) -> bool) `; +DOWN; +SPEC_TAC (` E:(real^3 -> bool) -> bool `,` E:(real^3 -> bool) -> bool `); +SPEC_TAC (`n:num `,` n:num `); +INDUCT_TAC; +NHANH CARD_EQ_0; +STRIP_TAC THEN STRIP_TAC THEN STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +ASM_REWRITE_TAC[IMAGE_CLAUSES; NOT_IN_EMPTY]; +EXISTS_TAC` &1 `; +REAL_ARITH_TAC; + +GEN_TAC; +ASM_CASES_TAC` (E:(real^3 -> bool) -> bool) = {} `; +ASM_REWRITE_TAC[CARD_CLAUSES; ADD1]; +REWRITE_TAC[ARITH_RULE` ~( 0 = n + 1) `]; +DOWN; +REWRITE_TAC[Local_lemmas.EMPTY_NOT_EXISTS_IN]; +REPEAT STRIP_TAC; +UNDISCH_TAC` (x:real^3 -> bool) IN E `; +FIRST_ASSUM NHANH; +STRIP_TAC; +UNDISCH_TAC` !E. CARD (E: (real^3 -> bool) -> bool) = n + ==> (!x. x IN E + ==> (?e. &0 < e /\ + (!t. abs t < e + ==> ~collinear + ({vec 0} UNION IMAGE (\v. (phii:real^3 -> real -> real^3) v t ) x)))) /\ + FINITE E + ==> (?e. &0 < e /\ + (!t. abs t < e + ==> (!e. e IN IMAGE (IMAGE (\v. phii v t)) E + ==> ~collinear ({vec 0} UNION e)))) `; + +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` E DELETE (x:real^3 -> bool)`)); +PHA; +ANTS_TAC; +ASSUME_TAC2 (ISPECL [` x:real ^3 -> bool `;` E: (real^3 -> bool) -> bool `] CARD_DELETE); +ASM_REWRITE_TAC[ARITH_RULE` SUC n - 1 = n `; IN_DELETE; FINITE_DELETE]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +STRIP_TAC; +EXISTS_TAC` min e e' `; +REWRITE_TAC[REAL_LT_MIN]; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM NHANH; +FIRST_X_ASSUM NHANH; +GEN_TAC; +SET_TAC[]]);; + + + +let ALL_TO_THE_NONPARALLEL_PART = prove_by_refinement +(` deformation phii (V:real^3 -> bool) (a,b) /\ FAN (vec 0, V,E) +==> (?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> UNIONS (IMAGE (IMAGE (\v. phii v t)) E) SUBSET + IMAGE (\v. phii v t) V /\ + graph (IMAGE (IMAGE (\v. phii v t)) E) /\ + fan1 + (vec 0, + IMAGE (\v. phii v t) V, + IMAGE (IMAGE (\v. phii v t)) E) /\ + fan2 + (vec 0, + IMAGE (\v. phii v t) V, + IMAGE (IMAGE (\v. phii v t)) E) /\ + fan6 + (vec 0, + IMAGE (\v. phii v t) V, + IMAGE (IMAGE (\v. phii v t)) E) ))`, +[REWRITE_TAC[FAN]; +STRIP_TAC; +MATCH_MP_TAC (GEN_ALL TOW_REAL_EXISTS_COMBINED); +CONJ_TAC; + +EXISTS_TAC` &1 `; +REWRITE_TAC[REAL_ARITH` &0 < &1 `]; +GEN_TAC; +STRIP_TAC; +REWRITE_TAC[GSYM IMAGE_UNIONS]; +MATCH_MP_TAC IMAGE_SUBSET; +ASM_REWRITE_TAC[]; + +MATCH_MP_TAC (GEN_ALL TOW_REAL_EXISTS_COMBINED); +CONJ_TAC; +DOWN_TAC; +REWRITE_TAC[deformation; graph; fan1; fan2]; + +STRIP_TAC; +MP_TAC (ISPECL [` &0 `;`phii:real^3 -> real -> real^3 `;`V:real^3 -> bool`] + (GEN_ALL CONTINUOUS_ATREAL_INJ_PRESERVED)); +PHA; +ANTS_TAC; +ASM_SIMP_TAC[]; + +ASM_SIMP_TAC[REAL_SUB_RZERO]; +STRIP_TAC; +EXISTS_TAC `d:real `; +ASM_REWRITE_TAC[REAL_BOUNDS_LT; IMAGE; IN_ELIM_THM]; +FIRST_X_ASSUM NHANH; +DOWN_TAC; +REWRITE_TAC[HAS_SIZE_2_EXISTS; IN]; +REPEAT STRIP_TAC; +SUBGOAL_THEN` (?xx y. ~(xx = y) /\ (!z. x (z:real^3) <=> z = xx \/ z = y))` +MP_TAC; +UNDISCH_TAC` (E:(real^3 -> bool) -> bool) x `; +ASM_REWRITE_TAC[]; +STRIP_TAC; +EXISTS_TAC` (phii: real^3 -> (real -> real^3)) xx t `; +EXISTS_TAC` (phii: real^3 -> (real -> real^3)) y t `; + +CONJ_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (SET_RULE` UNIONS E SUBSET (V:real^3 -> bool) /\ +E x ==> (! z. x z ==> V z) `); +DOWN THEN DOWN; +MESON_TAC[]; +ASM_REWRITE_TAC[IN_ELIM_THM]; +MESON_TAC[]; + + +MATCH_MP_TAC (GEN_ALL TOW_REAL_EXISTS_COMBINED); +CONJ_TAC; +REWRITE_TAC[fan1]; +EXISTS_TAC` &1 `; +REWRITE_TAC[REAL_ARITH` &0 < &1 `]; +REPEAT STRIP_TAC; +MATCH_MP_TAC FINITE_IMAGE; +DOWN_TAC; +SIMP_TAC[fan1]; + +DOWN_TAC; +SIMP_TAC[SET_RULE` s SUBSET {} <=> s = {} `; fan1; IMAGE_EQ_EMPTY]; +CONV_TAC TAUT; + + +MATCH_MP_TAC (GEN_ALL TOW_REAL_EXISTS_COMBINED); +CONJ_TAC; +DOWN_TAC; +REWRITE_TAC[fan2; deformation]; + +STRIP_TAC; +MP_TAC (ISPECL [`&0`;` phii:real^3 -> real -> real^ 3 `;` vec 0:real^3 `; +` V:real^3 -> bool `] (GEN_ALL CONTINUOUS_ATREAL_DISTINCT_FINITE)); +ANTS_TAC; +DOWN_TAC; +SIMP_TAC[fan2; fan1]; +ANTS_TAC; +DOWN_TAC; +SIMP_TAC[fan2; fan1]; +STRIP_TAC; +UNDISCH_TAC` ~( vec 0 IN (V:real^3 -> bool)) `; +MESON_TAC[]; + + +REWRITE_TAC[REAL_SUB_RZERO; REAL_BOUNDS_LT; IN_IMAGE]; +MESON_TAC[]; + +REWRITE_TAC[fan6]; +UNDISCH_TAC` graph (E:(real^3 -> bool) -> bool) `; +REWRITE_TAC[Fan.GRAPH]; +DOWN_TAC; +REWRITE_TAC[fan1; fan2]; +STRIP_TAC; + +ASSUME_TAC2 (ISPECL [` UNIONS (E:(real^3 -> bool) -> bool) `;` V:real^3 -> bool`] FINITE_SUBSET); +DOWN; +REWRITE_TAC[FINITE_UNIONS; REAL_BOUNDS_LT]; +STRIP_TAC; +MATCH_MP_TAC EACH_ELM_PRESERVED_IMP_ALLL; + +ASM_REWRITE_TAC[]; +GEN_TAC; +STRIP_TAC; +SUBGOAL_THEN` (x:real^3 -> bool) HAS_SIZE 2 ` MP_TAC; +DOWN; +ASM_REWRITE_TAC[]; +DOWN_TAC; +REWRITE_TAC[fan6; deformation; HAS_SIZE_2_EXISTS2]; +STRIP_TAC; +SUBGOAL_THEN` ~collinear ({vec 0: real^3} UNION x)` MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +ASM_REWRITE_TAC[IMAGE_CLAUSES; Local_lemmas.INSERT_UNION2; UNION_EMPTY]; +ONCE_REWRITE_TAC[REAL_ARITH` abs t = abs (&0 - t) `]; +STRIP_TAC; +MATCH_MP_TAC CONTINUOUS_PRESERVE_COLLINEAR; +ASSUME_TAC2 (SET_RULE` UNIONS E SUBSET V /\ (x:real^3 -> bool) IN E ==> x SUBSET V `); +DOWN; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +UNDISCH_TAC` !v. (v:real^3) IN V ==> phii v (&0) = v`; +DISCH_THEN NHANH; +ASM_SIMP_TAC[ETA_AX]]);; + + + + + + +(* ================================================================== *) +(* ================================================================== *) + + +end;; diff --git a/text_formalization/local/localization.hl b/text_formalization/local/localization.hl new file mode 100644 index 0000000..df8cbd4 --- /dev/null +++ b/text_formalization/local/localization.hl @@ -0,0 +1,1644 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Section: Introduction *) +(* Chapter: Local Fan *) +(* Author: Thomas C. Hales *) +(* Date: 2013-02-18 *) +(* ========================================================================== *) + +(* +Various odds and ends from the first part of the Local fan chapter +*) + +module Localization = struct + + open Hales_tactic;; + +parse_as_infix("has_orders",(12,"right"));; +parse_as_infix("cyclic_on",(13,"right"));; + +let has_orders = new_definition ` (f: A -> A) has_orders k <=> +(! i. 0 < i /\ i < k ==> ~( ITER i f = I )) /\ +ITER k f = I `;; + +let order = new_definition ` order f x y = (@n. ITER n f x =y /\ (!i. 0< i /\ i< n ==> ~(ITER i f x= y)))`;; + + +let cyclic_on = new_definition` f cyclic_on (S:A -> bool) <=> +(! x. x IN S ==> S = {z | ?n. z = ITER n f x }) `;; + +let dih2k = new_definition` dih2k (H: (A) hypermap) k <=> +CARD (dart H) = 2 * k +/\ (! x. x IN (dart H) ==> let S = face H x in + dart H = S UNION (IMAGE (node_map H) S )) +/\ (face_map H ) has_orders k /\ +(edge_map H ) has_orders 2 /\ +(node_map H) has_orders 2 `;; + +let EE = new_definition` EE v S = {w | {v,w} IN S }`;; + +let ord_pairs = new_definition` ord_pairs E = { a,b | {a,b} IN E } `;; + +let self_pairs = new_definition` self_pairs E V = { (v,v) | v IN V /\ + EE v E = {} } `;; + +let darts_of_hyp = new_definition` darts_of_hyp E V = ord_pairs E UNION +self_pairs E V `;; + +let ee_of_hyp = new_definition` ee_of_hyp (x,V,E) ((a:real^3),(b:real^3)) = +if (a,b) IN darts_of_hyp E V then (b,a) else (a,b)`;; + +let nn_of_hyp = new_definition` nn_of_hyp (x,V,E) (v,u) = +if (v,u) IN darts_of_hyp E V then +(v, azim_cycle (EE v E) x v u) else (v,u)`;; + +let ivs_azim_cycle = new_definition`ivs_azim_cycle W v0 v w = +if W = {} then w else +(@x. x IN W /\ azim_cycle W v0 v x = w ) `;; + +let ff_of_hyp = new_definition` ff_of_hyp (x,V,E) (v,u) = +if (v,u) IN darts_of_hyp E V then +(u, ivs_azim_cycle (EE u E) x u v) else (v,u)`;; + +let HYP = new_definition` HYP (x,V,E) = (darts_of_hyp E V, +ee_of_hyp (x,V,E), nn_of_hyp (x,V,E), ff_of_hyp (x,V,E)) `;; + +let local_fan = new_definition ` local_fan (V,E,FF ) <=> + let H = hypermap ( HYP (vec 0, (V: real^3 -> bool), E)) in + FAN (vec 0, V, E) /\ + (?x. x IN ( dart H) /\ FF = face H x ) /\ +dih2k H (CARD FF ) `;; + +let rho_node1 = new_definition `!(v:real^3) FF. rho_node1 FF v = (@w. v,w IN FF)`;; + +let azim_in_fan = new_definition` azim_in_fan (v:real^3,w:real^3) E = +let d = (azim_cycle (EE v E) ( vec 0 ) v w) in + if CARD ( EE v E ) > 1 then + azim (vec 0 ) v w d else &2 * pi `;; + +let wedge_in_fan_gt = new_definition`wedge_in_fan_gt (v,w) E = + if CARD (EE v E) > 1 then +wedge (vec 0) v w (azim_cycle (EE v E) (vec 0 ) v w ) else if +EE v E = {w} then { x | ~ ( x IN aff_ge {vec 0, v} {w} ) } else +{ x | ~ ( x IN aff {vec 0, v} )} `;; + +let wedge_ge = new_definition `wedge_ge v0 v1 w1 w2 = { z | +&0 <= azim v0 v1 w1 z /\ azim v0 v1 w1 z <= azim v0 v1 w1 w2 }`;; + +let wedge_in_fan_ge = new_definition` wedge_in_fan_ge ((v:real^3),w) E = + if CARD (EE v E) > 1 then +wedge_ge (vec 0) v w (azim_cycle (EE v E) (vec 0 ) v w ) else { x:real^3 | T } `;; + +let convex_local_fan = new_definition + `convex_local_fan (V,E,FF) <=> + local_fan (V,E,FF) /\ + (!x. x IN FF ==> azim_in_fan x E <= pi /\ V SUBSET wedge_in_fan_ge x E)`;; + +let v_prime = new_definition `v_prime V FF = {v| v IN V /\ + (?w. (v,w) IN FF )} `;; + +let e_prime = new_definition ` e_prime E FF = {{v,w} | {v,w} IN E /\ +(v,w) IN FF } `;; + +let generic = new_definition` generic V E <=> +(! v w u. {v,w} IN E /\ u IN V ==> aff_ge { vec 0 } {v,w} INTER +aff_lt {vec 0} {u} = {} )`;; + +let circular = new_definition ` circular V E <=> +(? v w u. {v,w} IN E /\ u IN V /\ ~(aff_gt { vec 0 } {v,w} INTER +aff_lt {vec 0} {u} = {}) )`;; + +let lunar = new_definition +` lunar (v,w) V E <=> ~(circular V E) /\ {v,w} SUBSET V /\ +~( v = w ) /\ collinear {vec 0, v, w } `;; + +let rho_node1 = new_definition ` rho_node1 (FF:real^3 # real^3 -> bool) v = (@w. (v,w) IN FF)`;; + +let ivs_rho_node1 = new_definition ` ivs_rho_node1 (FF:real^3 # real^3 -> bool) v = (@a. a,v IN FF )`;; + +let interior_angle1 = new_definition +` interior_angle1 x FF v = azim x v (rho_node1 FF v) (@a. a,v IN FF)`;; + +let sol_local = new_definition ` sol_local E f= &2 * pi+ sum f (\e. azim_in_fan e E- pi)`;; + +let rho_fun = new_definition `rho_fun y = &1 + (inv (&2 * h0 - &2)) * (inv pi) * sol0 * (y - &2)`;; + +let tau_fun = new_definition `tau_fun V E f = sum (f) (\e. rho_fun(norm(FST e)) * (azim_in_fan e E)) - (pi + sol0) * &(CARD f -2)`;; + +let deformation = new_definition +` deformation ff V (a,b) <=> (&0) IN real_interval (a,b) /\ +(! v r. v IN V /\ r IN real_interval (a,b) ==> (ff v) continuous atreal r) /\ +(!v. v IN V ==> ff v (&0) = v )`;; + +let localization = new_definition `localization (V, E) FF = (v_prime V FF, e_prime E FF) `;; + +let a_ear0=new_definition`a_ear0 J (i,j)=( if i MOD 3=j MOD 3 then &0 else + (if {i MOD 3,j MOD 3} IN J then sqrt(&8) else &2)) `;; + +let b_ear0=new_definition`b_ear0 J (i,j)=( if i MOD 3=j MOD 3 then &0 else + (if {i MOD 3,j MOD 3} IN J then cstab else &2* h0)) `;; + +let JNVXCRC = new_definition + `polar_fan(V,(E:(real^3->bool)->bool),FF) = + let r = rho_node1 FF in + let prime = \v. v cross (r v) in + ({ prime v | v IN V}, + { {prime v,prime(r v)} | v IN V}, + { (prime v,prime(r v)) | v IN V})`;; + + + + +(* deprecated: +let v_slice = new_definition ` v_slice f (v,w) = +{ ITER i f v | ! j. j < i ==> ~( ITER j f v = w ) }`;; + + +let e_slice = new_definition ` e_slice f (v,w) = +{w,v} INSERT +{ {ITER i f v, ITER (i + 1) f v} | ! j. j < i + 1 ==> ~( ITER j f v = w)} `;; + + +let f_slice = new_definition ` f_slice f (v,w) = +(w,v) INSERT +{ (ITER i f v, ITER (i + 1) f v) | ! j. j < i + 1 ==> ~ (ITER j f v = w)} `;; +*) + + +let slicev = new_definition ` slicev E FF v w = {u| ?n. 0<= n /\ n<= order (rho_node1 FF) v w /\ u= ITER n (rho_node1 FF) v}`;; + +let slicee = new_definition ` slicee E FF v w = {e| ?u. u IN (slicev E FF v w) DELETE w /\ e={u,rho_node1 FF u} } UNION {{w,v}}`;; + +let slicef = new_definition ` slicef E FF v w = {f| ?u. u IN (slicev E FF v w) DELETE w /\ f=(u,rho_node1 FF u) } UNION {(w,v)}`;; + +let FAN_EDGE_SUBSET_V = prove_by_refinement( + `!V E e. FAN(vec 0, V, E) /\ e IN E ==> e SUBSET V`, + (* {{{ proof *) + [ + REWRITE_TAC[Fan_defs.FAN;UNIONS_SUBSET]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let FAN_EDGE_EL_V = prove_by_refinement( + `!V E u v. FAN(vec 0,V,E) /\ {u,v} IN E ==> v IN V`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `v IN {u,v}` (C SUBGOAL_THEN ASSUME_TAC); + BY(SET_TAC[]); + BY(ASM_MESON_TAC[FAN_EDGE_SUBSET_V;SUBSET]) + ]);; + (* }}} *) + +(* renamed from FAN_EE, EE_EQ_set_of_edge *) + +let EE_elim = prove_by_refinement( + `!V E (v:real^3). FAN(vec 0,V,E) ==> EE v E = set_of_edge v V E`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[EE;Fan_defs.set_of_edge]; + REWRITE_TAC[EXTENSION;IN_ELIM_THM]; + BY(ASM_MESON_TAC[FAN_EDGE_EL_V]) + ]);; + (* }}} *) + +(* renamed from darts_of_hyp_EQ_dart_of_fan *) + +let darts_of_hyp_elim = prove_by_refinement( + `!V E. FAN(vec 0,V,E) ==> darts_of_hyp E V = dart_of_fan (V,E)`, + (* {{{ proof *) + [ + REWRITE_TAC[darts_of_hyp;Fan_defs.dart_of_fan;ord_pairs;self_pairs;SUBSET]; + REPEAT WEAKER_STRIP_TAC; + ASM_SIMP_TAC[GSYM EE_elim]; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let dart_of_fan_eq = prove_by_refinement( + `!V E. + dart_of_fan (V,E) = + dart1_of_fan (V,E) UNION {v,v | v IN V /\ set_of_edge v V E = {}}`, + (* {{{ proof *) + [ + REWRITE_TAC[Fan_defs.dart_of_fan;EXTENSION;IN_UNION;Fan_defs.dart1_of_fan]; + BY(SET_TAC[]) + ]);; + (* }}} *) + + +(* renamed from ee_of_hyp_EQ_e_fan_pair_ext *) + +let ee_of_hyp_elim = prove_by_refinement( + `!V E (x:A). FAN(vec 0,V,E) ==> ee_of_hyp(x,V,E) = e_fan_pair_ext(V,E)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[FUN_EQ_THM;FORALL_PAIR_THM]; + REWRITE_TAC[ee_of_hyp;Fan_defs.e_fan_pair_ext;Fan_defs.e_fan_pair]; + ASM_SIMP_TAC[darts_of_hyp_elim;dart_of_fan_eq;IN_UNION;IN_ELIM_THM;PAIR_EQ]; + REWRITE_TAC[TAUT `a /\ b /\ c <=> (a /\ b) /\ c`;Misc_defs_and_lemmas.GSPEC_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `p1,p2 IN dart1_of_fan(V,E)` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + COND_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let AZIM_CYCLE_EQ_SIGMA_FAN_ALT = prove_by_refinement( + `!V E u v. FAN (vec 0,V,E) /\ u IN set_of_edge v V E + ==> azim_cycle (set_of_edge v V E) (vec 0) v u = sigma_fan (vec 0) V E v u`, + (* {{{ proof *) + [ + BY(ASM_MESON_TAC[EE_elim;Wrgcvdr_cizmrrh.AZIM_CYCLE_EQ_SIGMA_FAN]) + ]);; + (* }}} *) + +(* renamed from nn_of_hyp_EQ_n_fan_pair_ext : *) + +let nn_of_hyp_elim = prove_by_refinement( + `!V E. FAN(vec 0,V,E) ==> nn_of_hyp((vec 0),V,E) = n_fan_pair_ext(V,E)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[FUN_EQ_THM;FORALL_PAIR_THM]; + REWRITE_TAC[nn_of_hyp;Fan_defs.n_fan_pair_ext;Fan_defs.n_fan_pair]; + ASM_SIMP_TAC[EE_elim;darts_of_hyp_elim;dart_of_fan_eq;IN_UNION;IN_ELIM_THM;PAIR_EQ]; + REWRITE_TAC[TAUT `a /\ b /\ c <=> (a /\ b) /\ c`;Misc_defs_and_lemmas.GSPEC_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `p1,p2 IN dart1_of_fan(V,E)` ASM_CASES_TAC; + (ASM_REWRITE_TAC[PAIR_EQ]); + GMATCH_SIMP_TAC AZIM_CYCLE_EQ_SIGMA_FAN_ALT; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Fan_defs.dart1_of_fan;Fan_defs.set_of_edge]; + REWRITE_TAC[IN_ELIM_PAIR_THM]; + REWRITE_TAC[IN_ELIM_THM]; + BY(ASM_MESON_TAC[FAN_EDGE_EL_V]); + ASM_REWRITE_TAC[]; + TYPIFY`~(p1 = p2)` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM (ASSUME_TAC o (REWRITE_RULE[])); + ASM_REWRITE_TAC[]; + COND_CASES_TAC; + ASM_REWRITE_TAC[PAIR_EQ]; + INTRO_TAC Wrgcvdr_cizmrrh.W_SUBSET_SINGLETON_IMP_IDE [`{}:real^3->bool`;`p2`]; + ANTS_TAC; + BY(SET_TAC[]); + BY(MESON_TAC[]); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +(* renamed from ivs_azim_cycle_EQ_inverse_sigma_fan *) + +let ivs_azim_cycle_elim = prove_by_refinement( + `!V E p1 p2. FAN(vec 0,V,E) /\ {p1,p2} IN E + ==> ivs_azim_cycle (set_of_edge p1 V E) (vec 0) p1 p2 = inverse_sigma_fan (vec 0) V E p1 p2`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_SIMP_TAC[GSYM Fan_misc.INVERSE_SIGMA_FAN_EQ_INVERSE1_SIGMA_FAN]; + ASM_SIMP_TAC[ (GSYM Wrgcvdr_cizmrrh.IVS_AZIM_EQ_INVERSE_SIGMA_FAN)]; + BY(ASM_MESON_TAC[EE_elim]) + ]);; + (* }}} *) + +(* renamed from ff_of_hyp_EQ_f_fan_pair_ext: *) + +let ff_of_hyp_elim = prove_by_refinement( + `!V E. FAN(vec 0,V,E) ==> ff_of_hyp(vec 0,V,E) = f_fan_pair_ext(V,E)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[FUN_EQ_THM;FORALL_PAIR_THM]; + REWRITE_TAC[ff_of_hyp;Fan_defs.f_fan_pair_ext;Fan_defs.f_fan_pair]; + ASM_SIMP_TAC[darts_of_hyp_elim;dart_of_fan_eq;IN_UNION;IN_ELIM_THM;PAIR_EQ]; + REWRITE_TAC[TAUT `a /\ b /\ c <=> (a /\ b) /\ c`;Misc_defs_and_lemmas.GSPEC_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `p1,p2 IN dart1_of_fan(V,E)` ASM_CASES_TAC; + (ASM_REWRITE_TAC[PAIR_EQ]); + ASM_SIMP_TAC[EE_elim]; + GMATCH_SIMP_TAC ivs_azim_cycle_elim; + ASM_REWRITE_TAC[]; + RULE_ASSUM_TAC (REWRITE_RULE[Fan_defs.dart1_of_fan;IN_ELIM_PAIR_THM]); + BY(ASM_MESON_TAC[Collect_geom.PER_SET2]); + ASM_REWRITE_TAC[]; + COND_CASES_TAC THEN REWRITE_TAC[]; + ASM_REWRITE_TAC[PAIR_EQ]; + ASM_SIMP_TAC[EE_elim]; + BY(REWRITE_TAC[Wrgcvdr_cizmrrh.IVS_AZIM_EMPTY_IDE]) + ]);; + (* }}} *) + +let HYP_elim = prove_by_refinement( + `!V E. FAN (vec 0, V, E) ==> HYP ((vec 0),V,E) = (dart_of_fan (V,E), + e_fan_pair_ext(V,E),n_fan_pair_ext(V,E),f_fan_pair_ext(V,E))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + BY(ASM_SIMP_TAC[HYP;darts_of_hyp_elim;ee_of_hyp_elim;nn_of_hyp_elim;ff_of_hyp_elim]) + ]);; + (* }}} *) + +let hypermap_HYP_elim = prove_by_refinement( + `!V E. FAN(vec 0,V,E) ==> hypermap ( HYP (vec 0, (V: real^3 -> bool), E)) = hypermap_of_fan (V,E) `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + BY(ASM_SIMP_TAC[Fan_defs.HYPERMAP_OF_FAN_ALT;HYP_elim]) + ]);; + (* }}} *) + +let local_fan2 = prove_by_refinement( + `!V E FF. local_fan (V,E,FF ) <=> + let H = hypermap_of_fan (V,E) in + FAN (vec 0, V, E) /\ + FF IN face_set H /\ + dih2k H (CARD FF ) `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[local_fan;LET_DEF;LET_END_DEF]; + TYPIFY `FAN(vec 0,V,E)` ASM_CASES_TAC; + ASM_SIMP_TAC[hypermap_HYP_elim]; + BY(ASM_MESON_TAC[Hypermap.lemma_in_face_set;Hypermap.lemma_face_representation]); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let WRGCVDR_BIJ = prove_by_refinement( + `!V E FF. local_fan (V,E,FF) + ==> BIJ FST FF V`, + (* {{{ proof *) + [ + BY(ASM_MESON_TAC[Wrgcvdr_cizmrrh.WRGCVDR;FUN_EQ_THM]) + ]);; + (* }}} *) + +let WRGCVDR_ORBIT = prove_by_refinement( + `!V E FF. local_fan (V,E,FF) ==> + (!v. v IN V ==> orbit_map (rho_node1 FF) v = V) `, + (* {{{ proof *) + [ + BY(MESON_TAC[ Local_lemmas.LOCAL_FAN_ORBIT_MAP_V]) + ]);; + (* }}} *) + +let ALL_TO_THE_NONPARALLEL_PART_ALT = prove_by_refinement( + `!a b V E phii. deformation phii V (a,b) /\ FAN (vec 0,V,E) + ==> (?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> UNIONS (IMAGE (IMAGE (\v. phii v t)) E) SUBSET + IMAGE (\v. phii v t) V /\ + graph (IMAGE (IMAGE (\v. phii v t)) E) /\ + fan1 + ((vec 0):real^3, + IMAGE (\v. phii (v:real^3) t) V, + IMAGE (IMAGE (\v. phii v t)) E) /\ + fan2 + ((vec 0):real^3, + IMAGE (\v. phii v t) V, + IMAGE (IMAGE (\v. phii v t)) E) /\ + fan6 + (vec 0, + IMAGE (\v. phii v t) V, + IMAGE (IMAGE (\v. phii v t)) E)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Local_lemmas1.ALL_TO_THE_NONPARALLEL_PART; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +(* moved to deformation.hl +let XRECQNS = prove_by_refinement( + `!a b V E f. + deformation f V (a,b) /\ FAN (vec 0,V,E) ==> + (?e. &0 < e /\ (!t. --e < t /\ t < e ==> + FAN(vec 0, + IMAGE (\v. f (v:real^3) t) V, + IMAGE (IMAGE (\v. f v t)) E)))`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[Fan.FAN]; + INTRO_TAC ALL_TO_THE_NONPARALLEL_PART_ALT [`a`;`b`;`V`;`E`;`f`]; + ASM_REWRITE_TAC[]; + REPEAT STRIP_TAC; + INTRO_TAC Deformation.FAN7_SMALL_DEFORMATION [`V`;`E`;`a`;`b`;`f`]; + ASM_REWRITE_TAC[]; + REPEAT STRIP_TAC; + TYPIFY `if (e < e') then e else e'` EXISTS_TAC; + COND_CASES_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[arith `&0 < e /\ e < e' /\ -- e < t /\ t < e ==> -- e' < t /\ t < e'`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[arith `&0 < e' /\ ~(e < e') /\ -- e' < t /\ t < e' ==> -- e < t /\ t < e`]) + ]);; + (* }}} *) +*) + +let COMPATIBLE_BW_TWO_LEMMAS2_ALT = prove_by_refinement( + `!V E FF HS fv fw v w. (convex_local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E) /\ + HS = hypermap (HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v,rho_node1 FF v)) /\ + fw = face HS (w,rho_node1 FF w) + ==> (v_prime V fv = slicev E FF v w /\ + e_prime (E UNION {{v, w}}) fv = slicee E FF v w /\ + fv = slicef E FF v w) /\ + v_prime V fw = slicev E FF w v /\ + e_prime (E UNION {{w, v}}) fw = slicee E FF w v /\ + fw = slicef E FF w v`, + (* {{{ proof *) + [ + MESON_TAC[Nkezbfc_local.COMPATIBLE_BW_TWO_LEMMAS2] + ]);; + (* }}} *) + +let EJRCFJD_ALT = prove_by_refinement( + `!V E FF HS fv fw v w. convex_local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E) /\ + HS = hypermap (HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v,rho_node1 FF v) /\ + fw = face HS (w,rho_node1 FF w) + ==> convex_local_fan (v_prime V fv,e_prime (E UNION {{v, w}}) fv,fv) /\ + convex_local_fan (v_prime V fw,e_prime (E UNION {{w, v}}) fw,fw) /\ + (!ff. sum {i | i < CARD V} + (\i. ff i * + interior_angle1 (vec 0) FF (ITER i (rho_node1 FF) v)) = + sum + {i | i < CARD V /\ ITER i (rho_node1 FF) v IN v_prime V fv} + (\i. ff i * + interior_angle1 (vec 0) fv (ITER i (rho_node1 FF) v)) + + sum + {i | i < CARD V /\ ITER i (rho_node1 FF) v IN v_prime V fw} + (\i. ff i * + interior_angle1 (vec 0) fw (ITER i (rho_node1 FF) v)))`, + (* {{{ proof *) + [ + MESON_TAC[Local_lemmas1.EJRCFJD] + ]);; + (* }}} *) + +let WEDGE_VV = prove_by_refinement( + `!a b c d. ~(b IN wedge a b c d) `, + (* {{{ proof *) + [ + REWRITE_TAC[wedge;IN_ELIM_THM]; + REPEAT GEN_TAC; + TYPIFY `{a,b,b} = {a,b}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(REWRITE_TAC[COLLINEAR_2]) + ]);; + (* }}} *) + +let ejr_distinct = prove_by_refinement( + `!V E FF v w. convex_local_fan (V,E,FF) /\ + v IN V /\ + (!e. e IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt e E) ==> + ~(w = v)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `aff_gt` MP_TAC; + REWRITE_TAC[NOT_FORALL_THM]; + TYPIFY `(v,rho_node1 FF v)` EXISTS_TAC; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.CVX_LO_IMP_LO]); + DISCH_THEN MP_TAC THEN ANTS_TAC; + BY(ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_RHO_NODE_PROS]); + ASM_REWRITE_TAC[]; + TYPIFY `{v,v} = {v}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + TYPIFY `CARD(EE v E) > 1` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.LOFA_CARD_EE_V_1;arith `2 > 1`]); + ASM_REWRITE_TAC[wedge_in_fan_gt]; + TYPIFY `v IN aff_gt {vec 0} {v}` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC AFF_GT_1_1; + REWRITE_TAC[DISJOINT;IN_ELIM_THM]; + REWRITE_TAC[EXTENSION;IN_INTER;IN_SING;NOT_IN_EMPTY]; + CONJ_TAC; + RULE_ASSUM_TAC (REWRITE_RULE[local_fan;Fan_defs.FAN]); + RULE_ASSUM_TAC (REWRITE_RULE[local_fan;Fan_defs.FAN;LET_DEF;LET_END_DEF;Fan_defs.fan2]); + BY(ASM_MESON_TAC[]); + GEXISTL_TAC [`&0`;`&1`]; + REWRITE_TAC[arith `&0 < &1`;arith `&0 + &1 = &1`]; + BY(VECTOR_ARITH_TAC); + REWRITE_TAC[SUBSET]; + BY(ASM_MESON_TAC[WEDGE_VV]) + ]);; + (* }}} *) + +(* + TYPIFY `CARD(EE v E) > 1` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.LOFA_CARD_EE_V_1;arith `2 > 1`]); + FIRST_X_ASSUM_ST `wedge_in_fan_gt` MP_TAC; +*) + +let WEDGE_EDGE_NOT_ADJ = prove_by_refinement( + `!V E FF v . local_fan (V,E,FF) /\ + v IN V ==> + ~(aff_gt {vec 0} {v, rho_node1 FF v} SUBSET wedge_in_fan_gt (v,rho_node1 FF v) E) `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `CARD(EE v E) > 1` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.LOFA_CARD_EE_V_1;arith `2 > 1`]); + FIRST_X_ASSUM_ST `wedge_in_fan_gt` MP_TAC; + ASM_REWRITE_TAC[wedge_in_fan_gt]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Nkezbfc_local.AFF_GT_SUBSET_WEDGE_IMP_VERTEX [`(vec 0):real^3`;`v`;`rho_node1 FF v`;`rho_node1 FF v`;`azim_cycle (EE v E) (vec 0) v (rho_node1 FF v)`]; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Local_lemmas1.LF_AZIM_CYCLE_EQ_IVS_ND; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + DISCH_THEN MP_TAC THEN ANTS_TAC; + BY(ASM_MESON_TAC[Local_lemmas.LOFA_IMP_NOT_COLL_IVS;Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2]); + BY(REWRITE_TAC[wedge;IN_ELIM_THM;AZIM_REFL;arith `~(&0 < &0)`]) + ]);; + (* }}} *) + +let PERIODIC_RHO_NODE1 = prove_by_refinement( + `!V E FF v. local_fan (V,E,FF) /\ v IN V ==> periodic (\i. ITER i (rho_node1 FF) v) (CARD V)`, + (* {{{ proof *) + [ + REWRITE_TAC[Oxl_def.periodic;GSYM ITER_ADD]; + REPEAT WEAKER_STRIP_TAC; + AP_TERM_TAC; + MATCH_MP_TAC Local_lemmas1.LOFA_IMP_ITER_RHO_NODE_ID2; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let V_PRIME_SUBSET_V = prove_by_refinement( + `!V f. v_prime (V:real^3->bool) (f:real^3 # real^3 -> bool) SUBSET V`, + (* {{{ proof *) + [ + REWRITE_TAC[v_prime;SUBSET;IN_ELIM_THM]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let SLICEV_IMAGE = prove_by_refinement( + `!V E FF v w i. + convex_local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + (!u u1. + u IN {v, w} /\ u1 IN V /\ ~(u = u1) ==> ~collinear {vec 0, u, u1}) /\ + (!e. e IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt e E) /\ + (i < CARD V) /\ + (w = ITER i (rho_node1 FF) v) + ==> + slicev E FF v w = IMAGE (\j. ITER j (rho_node1 FF) v) {j | j < i+1 } `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ejr_distinct [`V`;`E`;`FF`;`v`;`w`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + TYPED_ABBREV_TAC `HS = hypermap (HYP (vec 0,V,E UNION {{v, w}}))` ; + TYPED_ABBREV_TAC `fv = face HS (v,rho_node1 FF v)` ; + TYPED_ABBREV_TAC `fw = face HS (w,rho_node1 FF w)` ; + INTRO_TAC EJRCFJD_ALT [`V`;`E`;`FF`;`HS`;`fv`;`fw`;`v`;`w`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GSYM COMPATIBLE_BW_TWO_LEMMAS2_ALT) [`V`;`E`;`FF`;`HS`;`fv`;`fw`;`v`;`w`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.CVX_LO_IMP_LO]); + TYPIFY `!i. ITER i (rho_node1 FF) v IN V` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_ORBIT_MAP_VITER;]); + COMMENT "remove a many lines here"; + TYPIFY `!j. j < CARD V /\ ITER j (rho_node1 FF) v IN v_prime V fv <=> j < i+1` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC (REWRITE_RULE[TAUT `(a ==> b ==> c) <=> (a /\ b ==> c)`] Local_lemmas1.CONDS_IN_V_PRIME_NUM); + ASM_REWRITE_TAC[IN_DIFF;IN_SING]; + BY(ASM_MESON_TAC[]); + COMMENT "v_prime as image"; + TYPIFY `v_prime V fv = IMAGE (\j. ITER j (rho_node1 FF) v) {j | j < i+1 }` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC Local_lemmas1.POINTS_IN_HAFL_CIRCLE; + GEXISTL_TAC [`w`;`FF`;`v`]; + CONJ_TAC; + GEXISTL_TAC [`E`;`HS`]; + ASM_REWRITE_TAC[IN_DIFF;IN_SING]; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_IMAGE]; + X_GEN_TAC `u:real^3`; + REWRITE_TAC[Geomdetail.EQ_EXPAND]; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `n` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `n < i+1 <=> ~(i < n)`]; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `x` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `m < CARD V` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM_ST `(a:num) < b` MP_TAC) THEN ARITH_TAC); + TYPIFY `m = i` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas1.LT_CARD_MONO_LOFA]); + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let LOCAL_FAN_ORBIT_MAP_EXPLICIT = prove + (`!V E FF v w. + local_fan(V,E,FF) /\ v IN V /\ w IN V + ==> ?i. i < CARD V /\ w = ITER i (rho_node1 FF) v`, + REPEAT STRIP_TAC THEN FIRST_ASSUM(MP_TAC o SPEC `v:real^3` o + MATCH_MP Local_lemmas.LOCAL_FAN_ORBIT_MAP_V) THEN + REWRITE_TAC[Wrgcvdr_cizmrrh.POWER_TO_ITER; Hypermap.orbit_map] THEN + ASM_REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN + DISCH_THEN(MP_TAC o SPEC `w:real^3`) THEN ASM_REWRITE_TAC[GE; LE_0] THEN + DISCH_THEN(X_CHOOSE_THEN `n:num` SUBST1_TAC) THEN + EXISTS_TAC `n MOD (CARD(V:real^3->bool))` THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP Local_lemmas.LOCAL_FAN_FINITE_V) THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP Local_lemmas.LOFA_V_NOT_EMP) THEN + MP_TAC(ISPECL [`n:num`; `CARD(V:real^3->bool)`] DIVISION) THEN + ABBREV_TAC `i = n MOD (CARD(V:real^3->bool))` THEN + ABBREV_TAC `m = n DIV (CARD(V:real^3->bool))` THEN + ASM_SIMP_TAC[CARD_EQ_0] THEN DISCH_THEN(K ALL_TAC) THEN + SPEC_TAC(`m:num`,`p:num`) THEN + INDUCT_TAC THEN REWRITE_TAC[MULT_CLAUSES; ADD_CLAUSES] THEN + ONCE_REWRITE_TAC[ARITH_RULE `(a + b) + c:num = (a + c) + b`] THEN + ONCE_REWRITE_TAC[GSYM ITER_ADD] THEN + FIRST_ASSUM(MP_TAC o MATCH_MP Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID) THEN + ASM_SIMP_TAC[]);; + +let SLICEW_IMAGE = prove_by_refinement( + `!V E FF v w n. + convex_local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + (!u u1. + u IN {v, w} /\ u1 IN V /\ ~(u = u1) ==> ~collinear {vec 0, u, u1}) /\ + (!e. e IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt e E) /\ + (n < CARD V) /\ + (w = ITER n (rho_node1 FF) v) + ==> + slicev E FF w v = IMAGE (\j. ITER j (rho_node1 FF) v) {j | j = 0 \/ (n <= j /\ j < CARD V) }`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ejr_distinct [`V`;`E`;`FF`;`v`;`w`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + TYPED_ABBREV_TAC `HS = hypermap (HYP (vec 0,V,E UNION {{v, w}}))` ; + TYPED_ABBREV_TAC `fv = face HS (v,rho_node1 FF v)` ; + TYPED_ABBREV_TAC `fw = face HS (w,rho_node1 FF w)` ; + INTRO_TAC EJRCFJD_ALT [`V`;`E`;`FF`;`HS`;`fv`;`fw`;`v`;`w`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GSYM COMPATIBLE_BW_TWO_LEMMAS2_ALT) [`V`;`E`;`FF`;`HS`;`fv`;`fw`;`v`;`w`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.CVX_LO_IMP_LO]); + TYPIFY `!i. ITER i (rho_node1 FF) v IN V` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_ORBIT_MAP_VITER;]); + TYPIFY `!j. j < CARD V /\ ITER j (rho_node1 FF) v IN v_prime V fw <=> (j =0) \/ (n <= j /\ j < CARD V)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC (REWRITE_RULE[TAUT `(a ==> b ==> c) <=> (a /\ b ==> c)`] Local_lemmas1.CONDS_IN_V_PRIME_NUM2); + ASM_REWRITE_TAC[IN_DIFF;IN_SING]; + BY(ASM_MESON_TAC[]); + COMMENT "v_prime as image"; + TYPIFY `v_prime V fw = IMAGE (\j. ITER j (rho_node1 FF) v) {j | j = 0 \/ (n <= j /\ j < CARD V) }` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[EXTENSION;IN_IMAGE]; + X_GEN_TAC `u:real^3`; + TYPIFY `u IN v_prime V fw` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC V_PRIME_SUBSET_V [`V`;`fw`]; + REWRITE_TAC[SUBSET]; + DISCH_THEN (C INTRO_TAC [`u`]); + DISCH_TAC; + INTRO_TAC LOCAL_FAN_ORBIT_MAP_EXPLICIT [`V`;`E`;`FF`;`v`;`u`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `i` EXISTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[]; + REWRITE_TAC[NOT_EXISTS_THM;IN_ELIM_THM]; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +(* Might extract things like the exact card of slicev, and the fact that 3 < CARD V *) + +let CARD_SLICEV_LT = prove_by_refinement( + `!V E FF v w. + convex_local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + (!u u1. + u IN {v, w} /\ u1 IN V /\ ~(u = u1) ==> ~collinear {vec 0, u, u1}) /\ + (!e. e IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt e E) ==> + CARD (slicev E FF v w) < CARD V`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ejr_distinct [`V`;`E`;`FF`;`v`;`w`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + TYPED_ABBREV_TAC `HS = hypermap (HYP (vec 0,V,E UNION {{v, w}}))` ; + TYPED_ABBREV_TAC `fv = face HS (v,rho_node1 FF v)` ; + TYPED_ABBREV_TAC `fw = face HS (w,rho_node1 FF w)` ; + INTRO_TAC EJRCFJD_ALT [`V`;`E`;`FF`;`HS`;`fv`;`fw`;`v`;`w`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GSYM COMPATIBLE_BW_TWO_LEMMAS2_ALT) [`V`;`E`;`FF`;`HS`;`fv`;`fw`;`v`;`w`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.CVX_LO_IMP_LO]); + TYPIFY `!i. ITER i (rho_node1 FF) v IN V` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_ORBIT_MAP_VITER;]); + INTRO_TAC LOCAL_FAN_ORBIT_MAP_EXPLICIT [`V`;`E`;`FF`;`v`;`w`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `1 < CARD V` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Local_lemmas1.DIFFERENCE_IMP_LT_CARDV; + ASM_REWRITE_TAC[arith `n < 1 <=> n = 0`]; + BY(ASM_MESON_TAC[ITER]); + TYPIFY `~(i = CARD V - 1)` (C SUBGOAL_THEN ASSUME_TAC); + DISCH_TAC; + TYPIFY `w = ivs_rho_node1 FF v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1]); + INTRO_TAC WEDGE_EDGE_NOT_ADJ [`V`;`E`;`FF`;`w`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[]; + RULE_ASSUM_TAC (ONCE_REWRITE_RULE[Collect_geom.PER_SET2]); + TYPIFY `w,rho_node1 FF w IN FF` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_RHO_NODE_PROS]); + TYPIFY `rho_node1 FF w = v` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas1.LOCAL_FAN_RHO_NODE_IVS]); + BY(ASM_MESON_TAC[]); + TYPIFY `!j. j < CARD V /\ ITER j (rho_node1 FF) v IN v_prime V fv <=> j < i+1` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC (REWRITE_RULE[TAUT `(a ==> b ==> c) <=> (a /\ b ==> c)`] Local_lemmas1.CONDS_IN_V_PRIME_NUM); + ASM_REWRITE_TAC[IN_DIFF;IN_SING]; + BY(ASM_MESON_TAC[]); + COMMENT "v_prime as image"; + TYPIFY `v_prime V fv = IMAGE (\j. ITER j (rho_node1 FF) v) {j | j < i+1 }` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC Local_lemmas1.POINTS_IN_HAFL_CIRCLE; + GEXISTL_TAC [`w`;`FF`;`v`]; + CONJ_TAC; + GEXISTL_TAC [`E`;`HS`]; + ASM_REWRITE_TAC[IN_DIFF;IN_SING]; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_IMAGE]; + X_GEN_TAC `u:real^3`; + REWRITE_TAC[Geomdetail.EQ_EXPAND]; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `n` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `n < i+1 <=> ~(i < n)`]; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `x` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `m < CARD V` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + TYPIFY `m = i` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas1.LT_CARD_MONO_LOFA]); + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + COMMENT "now use IMAGE CARD"; + FIRST_X_ASSUM (SUBST1_TAC); + MATCH_MP_TAC LET_TRANS; + TYPIFY `CARD {j | j < i + 1}` EXISTS_TAC; + CONJ_TAC; + MATCH_MP_TAC CARD_IMAGE_LE; + BY(REWRITE_TAC[FINITE_NUMSEG_LT]); + REWRITE_TAC[CARD_NUMSEG_LT]; + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC) + ]);; + (* }}} *) + +let SLICEW_BIJ = prove_by_refinement( + `!V E FF v w n. + convex_local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + (!u u1. + u IN {v, w} /\ u1 IN V /\ ~(u = u1) + ==> ~collinear {vec 0, u, u1}) /\ + (!e. e IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt e E) /\ + n < CARD V /\ + w = ITER n (rho_node1 FF) v + ==> + BIJ (\j. ITER j (rho_node1 FF) v) + {j | j = 0 \/ n <= j /\ j < CARD V} (slicev E FF w v)`, + (* {{{ proof *) + [ + REWRITE_TAC[BIJ]; + REPEAT WEAKER_STRIP_TAC; + SUBCONJ2_TAC; + INTRO_TAC SLICEW_IMAGE [`V`;`E`;`FF`;`v`;`w`;`n`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[Misc_defs_and_lemmas.IMAGE_SURJ]); + REWRITE_TAC[SURJ;INJ]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.CVX_LO_IMP_LO]); + TYPIFY `FINITE V` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_FINITE_V]); + TYPIFY `0 < CARD V` (C SUBGOAL_THEN ASSUME_TAC); + ASM_SIMP_TAC[ arith `0 < x <=> ~(x = 0)`;CARD_EQ_0;EXTENSION;NOT_IN_EMPTY;NOT_FORALL_THM]; + BY(ASM_MESON_TAC[]); + INTRO_TAC Local_lemmas1.LT_CARD_MONO_LOFA []; + ASM_REWRITE_TAC[]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let SLICEV_BIJ = prove_by_refinement( + `!V E FF v w n. + convex_local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + (!u u1. + u IN {v, w} /\ u1 IN V /\ ~(u = u1) + ==> ~collinear {vec 0, u, u1}) /\ + (!e. e IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt e E) /\ + n < CARD V /\ + w = ITER n (rho_node1 FF) v + ==> + BIJ (\j. ITER j (rho_node1 FF) v) + {j | j < n + 1} (slicev E FF v w)`, + (* {{{ proof *) + [ + REWRITE_TAC[BIJ]; + REPEAT WEAKER_STRIP_TAC; + SUBCONJ2_TAC; + INTRO_TAC SLICEV_IMAGE [`V`;`E`;`FF`;`v`;`w`;`n`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[Misc_defs_and_lemmas.IMAGE_SURJ]); + REWRITE_TAC[SURJ;INJ]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.CVX_LO_IMP_LO]); + TYPIFY `FINITE V` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_FINITE_V]); + TYPIFY `0 < CARD V` (C SUBGOAL_THEN ASSUME_TAC); + ASM_SIMP_TAC[ arith `0 < x <=> ~(x = 0)`;CARD_EQ_0;EXTENSION;NOT_IN_EMPTY;NOT_FORALL_THM]; + BY(ASM_MESON_TAC[]); + INTRO_TAC Local_lemmas1.LT_CARD_MONO_LOFA []; + ASM_REWRITE_TAC[]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_MESON_TAC[arith `x < n+1 /\ n < c==> x < c`]) + ]);; + (* }}} *) + +let CARD_SLICEV = prove_by_refinement( + `!V E FF v w . + convex_local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + (!u u1. + u IN {v, w} /\ u1 IN V /\ ~(u = u1) + ==> ~collinear {vec 0, u, u1}) /\ + (!e. e IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt e E) + ==> CARD (slicev E FF v w) + CARD(slicev E FF w v) = CARD V + 2`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?n. n < CARD V /\ w = ITER n (rho_node1 FF) v` (C SUBGOAL_THEN MP_TAC); + COMMENT "insert"; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.CVX_LO_IMP_LO]); + MATCH_MP_TAC LOCAL_FAN_ORBIT_MAP_EXPLICIT; + TYPIFY `E` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC SLICEV_BIJ [`V`;`E`;`FF`;`v`;`w`;`n`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC SLICEW_BIJ [`V`;`E`;`FF`;`v`;`w`;`n`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPED_ABBREV_TAC `f = (\j. ITER j (rho_node1 FF) v)` ; + TYPIFY `CARD {j | j < n + 1} = CARD (slicev E FF v (ITER n (rho_node1 FF) v))` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC Misc_defs_and_lemmas.BIJ_CARD; + ASM_REWRITE_TAC[FINITE_NUMSEG_LT]; + BY(ASM_MESON_TAC[]); + DISCH_THEN (SUBST1_TAC o GSYM); + TYPIFY `CARD {j | j =0 \/ ( n <= j /\ j < CARD V)} = CARD (slicev E FF w v)` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC Misc_defs_and_lemmas.BIJ_CARD; + TYPIFY `f` EXISTS_TAC; + CONJ2_TAC; + BY(ASM_REWRITE_TAC[]); + MATCH_MP_TAC FINITE_SUBSET; + TYPIFY `{0} UNION {j | j < CARD V}` EXISTS_TAC; + CONJ_TAC; + MATCH_MP_TAC FINITE_UNION_IMP; + BY(ASM_REWRITE_TAC[FINITE_INSERT;FINITE_EMPTY;FINITE_NUMSEG_LT]); + BY(SET_TAC[]); + ASM_REWRITE_TAC[]; + DISCH_THEN (SUBST1_TAC o GSYM); + REWRITE_TAC[CARD_NUMSEG_LT]; + TYPIFY `{j | j = 0 \/ n <= j /\ j < CARD V } = {0} UNION {j | n <= j /\ j < CARD V}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + INTRO_TAC Geomdetail.CARD_EQUATION [`{0}`;`{j | n <= j /\ j < CARD V}`]; + ANTS_TAC; + REWRITE_TAC[FINITE_INSERT;FINITE_EMPTY]; + MATCH_MP_TAC FINITE_SUBSET; + TYPIFY ` {j | j < CARD V}` EXISTS_TAC; + ASM_REWRITE_TAC[FINITE_NUMSEG_LT]; + BY(SET_TAC[]); + TYPIFY `({0} INTER {j | n <= j /\ j < CARD V}) = {}` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[EXTENSION;NOT_IN_EMPTY;IN_INTER;IN_SING;IN_ELIM_THM]; + TYPIFY `~(n=0)` ENOUGH_TO_SHOW_TAC; + BY(ARITH_TAC); + DISCH_TAC; + FIRST_X_ASSUM_ST `w = ITER n r v` MP_TAC; + ASM_REWRITE_TAC[ITER]; + INTRO_TAC ejr_distinct [`V`;`E`;`FF`;`v`;`w`]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[CARD_CLAUSES;arith `x + 0 = x`]; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[Geomdetail.CARD_SING]; + TYPIFY `{j | n <= j /\ j < CARD V} = (n.. (CARD V - 1))` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[EXTENSION;IN_NUMSEG;IN_ELIM_THM]; + BY(REPEAT (FIRST_X_ASSUM_ST `n < CARD V` MP_TAC) THEN ARITH_TAC); + REWRITE_TAC[CARD_NUMSEG]; + BY(REPEAT (FIRST_X_ASSUM_ST `n < CARD V` MP_TAC) THEN ARITH_TAC) + ]);; + (* }}} *) + +let HAFL_CIRCLE_FORM_LOCAL_FAN_ALT = prove_by_refinement( + `!V E FF v w HS fv. (local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E)) /\ + HS = hypermap (HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v,rho_node1 FF v) + ==> local_fan (v_prime V fv,e_prime (E UNION {{v, w}}) fv,fv)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GEN_ALL Local_lemmas1.HAFL_CIRCLE_FORM_LOCAL_FAN) []; + DISCH_THEN MATCH_MP_TAC; + GEXISTL_TAC [`HS`;`FF`]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let HAFL_CIRCLE_FORM_LOCAL_FAN2_ALT = prove_by_refinement( + `!V E FF v w HS fv. (local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + ~(v = w) /\ + (!z t. z IN {v, w} /\ t IN V DIFF {z} ==> ~collinear {vec 0, z, t}) /\ + (!x. x IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt x E)) /\ + HS = hypermap (HYP (vec 0,V,E UNION {{v, w}})) /\ + fv = face HS (v,rho_node1 FF v) /\ + fw = face HS (w,rho_node1 FF w) + ==> local_fan (v_prime V fv,e_prime (E UNION {{v, w}}) fv,fv) /\ + local_fan (v_prime V fw,e_prime (E UNION {{w, v}}) fw,fw)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GEN_ALL Local_lemmas1.HAFL_CIRCLE_FORM_LOCAL_FAN2) []; + DISCH_THEN MATCH_MP_TAC; + GEXISTL_TAC [`HS`;`FF`]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let CARD_SLICEF = prove_by_refinement( + `!V E FF v w . + convex_local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + (!u u1. + u IN {v, w} /\ u1 IN V /\ ~(u = u1) + ==> ~collinear {vec 0, u, u1}) /\ + (!e. e IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt e E) + ==> CARD (slicef E FF v w) + CARD(slicef E FF w v) = CARD FF + 2`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ejr_distinct [`V`;`E`;`FF`;`v`;`w`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + TYPED_ABBREV_TAC `HS = hypermap (HYP (vec 0,V,E UNION {{v, w}}))` ; + TYPED_ABBREV_TAC `fv = face HS (v,rho_node1 FF v)` ; + TYPED_ABBREV_TAC `fw = face HS (w,rho_node1 FF w)` ; + INTRO_TAC EJRCFJD_ALT [`V`;`E`;`FF`;`HS`;`fv`;`fw`;`v`;`w`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GSYM COMPATIBLE_BW_TWO_LEMMAS2_ALT) [`V`;`E`;`FF`;`HS`;`fv`;`fw`;`v`;`w`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.CVX_LO_IMP_LO]); + TYPIFY` local_fan (v_prime V fv,e_prime (E UNION {{v, w}}) fv,fv) /\ local_fan (v_prime V fw,e_prime (E UNION {{w, v}}) fw,fw)` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC HAFL_CIRCLE_FORM_LOCAL_FAN2_ALT; + GEXISTL_TAC [`FF`;`HS`]; + ASM_REWRITE_TAC[IN_DIFF;IN_SING]; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `FINITE FF /\ FINITE fv /\ FINITE fw` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Wrgcvdr_cizmrrh.LOCAL_FAN_FINITE_FF]); + REPEAT (FIRST_X_ASSUM (MP_TAC o (MATCH_MP Local_lemmas.LOFA_IMP_BIJ_FF_V))); + INTRO_TAC CARD_SLICEV [`V`;`E`;`FF`;`v`;`w`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MP_TAC; + BY(MESON_TAC[Local_lemmas.BIJ_IMP_CARD_EQ]) + ]);; + (* }}} *) + +let aff_ge_INTER_aff_lt = prove_by_refinement( + `! (y:real^A). ~(y = vec 0) ==> aff_ge {vec 0} {y} INTER aff_lt {vec 0} {y} = {}`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_SIMP_TAC[AFF_GE_1_1_0]; + GMATCH_SIMP_TAC AFF_LT_1_1; + REWRITE_TAC[DISJOINT;IN_SING;EXTENSION;IN_INTER;IN_ELIM_THM;NOT_IN_EMPTY]; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[VECTOR_MUL_RZERO]; + REWRITE_TAC[varith `a % y = vec 0 + t2 % (y:real^A) <=> (a - t2) % y = vec 0`]; + ASM_REWRITE_TAC[VECTOR_MUL_EQ_0]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let ejr_generic = prove_by_refinement( + `!V E FF v w. + convex_local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + (!u u1. + u IN {v, w} /\ u1 IN V /\ ~(u = u1) ==> ~collinear {vec 0, u, u1}) /\ + (!e. e IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt e E) /\ + generic V E + ==> generic (slicev E FF v w) (slicee E FF v w)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[generic]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ejr_distinct [`V`;`E`;`FF`;`v`;`w`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + TYPED_ABBREV_TAC `HS = hypermap (HYP (vec 0,V,E UNION {{v, w}}))` ; + TYPED_ABBREV_TAC `fv = face HS (v,rho_node1 FF v)` ; + TYPED_ABBREV_TAC `fw = face HS (w,rho_node1 FF w)` ; + INTRO_TAC EJRCFJD_ALT [`V`;`E`;`FF`;`HS`;`fv`;`fw`;`v`;`w`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GSYM COMPATIBLE_BW_TWO_LEMMAS2_ALT) [`V`;`E`;`FF`;`HS`;`fv`;`fw`;`v`;`w`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.CVX_LO_IMP_LO]); + TYPIFY `e_prime (E UNION {{v,w}}) fv SUBSET (E UNION {{v,w}})` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Wrgcvdr_cizmrrh.E_PRIME_SUBSET_E]); + TYPIFY `{v',w'} IN E \/ {v',w'} = {v,w}` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `x IN slicee E FF v w` MP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[SUBSET;IN_UNION;IN_SING]; + BY(MESON_TAC[]); + FIRST_X_ASSUM (DISJ_CASES_TAC); + FIRST_X_ASSUM_ST `generic` MP_TAC; + REWRITE_TAC[generic]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_MESON_TAC[V_PRIME_SUBSET_V;SUBSET]); + FIRST_X_ASSUM (fun t -> REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[t]) THEN REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC Planarity.aff_ge_eq_aff_gt_union_aff_ge; + CONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]); + REWRITE_TAC[GSYM SUBSET_EMPTY]; + MATCH_MP_TAC SUBSET_TRANS; + TYPIFY `(aff_gt {vec 0} {v,w} INTER aff_lt {vec 0} {u}) UNION (aff_ge {vec 0} {v} INTER aff_lt {vec 0} {u}) UNION (aff_ge {vec 0} {w} INTER aff_lt {vec 0} {u})` EXISTS_TAC; + CONJ_TAC; + BY(SET_TAC[]); + REWRITE_TAC[UNION_SUBSET;SUBSET_EMPTY]; + TYPIFY `u IN V` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[V_PRIME_SUBSET_V;SUBSET]); + TYPIFY `~(v = vec 0) /\ ~(w = vec 0) /\ ~(u = vec 0)` (C SUBGOAL_THEN ASSUME_TAC); + RULE_ASSUM_TAC (REWRITE_RULE[local_fan;Fan_defs.FAN;Fan_defs.fan2;LET_DEF;LET_END_DEF]); + BY(ASM_MESON_TAC[]); + CONJ2_TAC; + CONJ_TAC; + PROOF_BY_CONTR_TAC; + TYPIFY `collinear {vec 0,u,v}` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Wrgcvdr_cizmrrh.AFF_GE_INTER_AFF_LT_IMP_NOT_EQ_COL]); + TYPIFY `u = v` ASM_CASES_TAC; + BY(ASM_MESON_TAC[aff_ge_INTER_aff_lt]); + BY(ASM_MESON_TAC[Collect_geom.PER_SET3;IN_INSERT]); + PROOF_BY_CONTR_TAC; + TYPIFY `collinear {vec 0,u,w}` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Wrgcvdr_cizmrrh.AFF_GE_INTER_AFF_LT_IMP_NOT_EQ_COL]); + TYPIFY `u = w` ASM_CASES_TAC; + BY(ASM_MESON_TAC[aff_ge_INTER_aff_lt]); + BY(ASM_MESON_TAC[Collect_geom.PER_SET3;IN_INSERT]); + TYPIFY `aff_gt {vec 0} {v,w} SUBSET wedge_in_fan_gt (u,rho_node1 FF u) E /\ aff_lt {vec 0} {u} INTER wedge_in_fan_gt (u,rho_node1 FF u) E = {}` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + CONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_RHO_NODE_PROS]); + REWRITE_TAC[EXTENSION;NOT_IN_EMPTY;IN_INTER]; + GEN_TAC; + GMATCH_SIMP_TAC Local_lemmas1.WEDGE_IN_FAN_LOFA_DETER2; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[TAUT `~(a /\ b) <=> ( a ==> ~b)`]; + ASM_SIMP_TAC[Nkezbfc_local.AFF_LT_1_1;IN_ELIM_THM;wedge]; + REWRITE_TAC[VECTOR_MUL_RZERO;VECTOR_ADD_LID]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `collinear` MP_TAC; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[Local_lemmas.COLLINEAR_ONCE_VEC_0]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let LOFA_IMP_LT_CARD_SET_V_ALT = prove_by_refinement( + `!V E FF v. local_fan (V,E,FF) /\ v IN V + ==> {ITER n (rho_node1 FF) v | n < CARD V} = V`, + (* {{{ proof *) + [ + BY(MESON_TAC[Local_lemmas.LOFA_IMP_LT_CARD_SET_V]) + ]);; + (* }}} *) + +let ejr_sum = prove_by_refinement( + `!V E FF HS v w f fv fw. + convex_local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + hypermap (HYP (vec 0,V,E UNION {{v, w}})) = HS /\ + face HS (v,rho_node1 FF v) = fv /\ + face HS (w,rho_node1 FF w) = fw /\ + (!u u1. + u IN {v, w} /\ u1 IN V /\ ~(u = u1) ==> ~collinear {vec 0, u, u1}) /\ + (!e. e IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt e E) // /\ + ==> sum FF (\e. f (FST e) * azim_in_fan e E) = + sum fv + (\e. f (FST e) * azim_in_fan e (e_prime (E UNION {{v, w}}) fv)) + + sum fw + (\e. f (FST e) * azim_in_fan e (e_prime (E UNION {{w, v}}) fw))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[generic]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ejr_distinct [`V`;`E`;`FF`;`v`;`w`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + INTRO_TAC EJRCFJD_ALT [`V`;`E`;`FF`;`HS`;`fv`;`fw`;`v`;`w`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GSYM COMPATIBLE_BW_TWO_LEMMAS2_ALT) [`V`;`E`;`FF`;`HS`;`fv`;`fw`;`v`;`w`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.CVX_LO_IMP_LO]); + TYPIFY `?n. n < CARD V /\ w = ITER n (rho_node1 FF) v` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC LOCAL_FAN_ORBIT_MAP_EXPLICIT; + TYPIFY `E` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`(\i. f (ITER i (rho_node1 FF) v))`]); + REWRITE_TAC[]; + COMMENT "replace first index set"; + TYPIFY `{i | i < CARD V /\ ITER i (rho_node1 FF) v IN v_prime V fv } = {i | i < n + 1}` (C SUBGOAL_THEN SUBST1_TAC); + INTRO_TAC SLICEV_IMAGE [`V`;`E`;`FF`;`v`;`w`;`n`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[IN_IMAGE;IN_ELIM_THM]; + REWRITE_TAC[EXTENSION;IN_ELIM_THM]; + X_GEN_TAC `i:num`; + REWRITE_TAC[Geomdetail.EQ_EXPAND]; + CONJ2_TAC; + REPEAT WEAKER_STRIP_TAC; + SUBCONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `(a:num) < b` MP_TAC) THEN ARITH_TAC); + DISCH_TAC; + TYPIFY `i` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `i = x'` ENOUGH_TO_SHOW_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `(a:num) < b` MP_TAC) THEN ARITH_TAC); + BY(ASM_MESON_TAC[ Local_lemmas1.LT_CARD_MONO_LOFA;arith `x' < n+1 /\ n < c ==> x' < c`]); + COMMENT "n not 0"; + TYPIFY `~(n=0)` (C SUBGOAL_THEN ASSUME_TAC); + DISCH_TAC; + FIRST_X_ASSUM_ST `w = ITER n r v` MP_TAC; + BY(ASM_REWRITE_TAC[ITER]); + COMMENT "replace second index set"; + TYPIFY `{i | i < CARD V /\ ITER i (rho_node1 FF) v IN v_prime V fw } = {i | i = 0 \/ n <= i /\ i < CARD V}` (C SUBGOAL_THEN SUBST1_TAC); + INTRO_TAC SLICEW_IMAGE [`V`;`E`;`FF`;`v`;`w`;`n`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[IN_IMAGE;IN_ELIM_THM]; + REWRITE_TAC[EXTENSION;IN_ELIM_THM]; + X_GEN_TAC `i:num`; + REWRITE_TAC[Geomdetail.EQ_EXPAND]; + CONJ2_TAC; + REPEAT WEAKER_STRIP_TAC; + SUBCONJ_TAC; + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + DISCH_TAC; + TYPIFY `i` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `i = x'` ENOUGH_TO_SHOW_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `(a:num) < b` MP_TAC) THEN ARITH_TAC); + TYPIFY `x' < CARD V` (C SUBGOAL_THEN MP_TAC); + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(ASM_MESON_TAC[ Local_lemmas1.LT_CARD_MONO_LOFA]); + MATCH_MP_TAC (arith `(a = a' /\ b = b' /\ c = c') ==> (a = b + c ==> a' = b' + c')`); + COMMENT "match summands"; + TYPIFY `!fu. ((\u. f u * interior_angle1 (vec 0) fu u) o (\i. ITER i (rho_node1 FF) v)) = (\i. f (ITER i (rho_node1 FF) v) * interior_angle1 (vec 0) fu (ITER i (rho_node1 FF) v))` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[FUN_EQ_THM;o_THM]); + COMMENT "first sum"; + CONJ_TAC; + TYPIFY `BIJ (\i. (ITER i (rho_node1 FF) v)) {i | i < CARD V} V` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[BIJ]; + SUBCONJ2_TAC; + TYPIFY `IMAGE (\i. (ITER i (rho_node1 FF) v)) {i | i < CARD V} = V` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[Misc_defs_and_lemmas.IMAGE_SURJ]); + INTRO_TAC LOFA_IMP_LT_CARD_SET_V_ALT [`V`;`E`;`FF`;`v`]; + ASM_REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_IMAGE]; + BY(MESON_TAC[]); + REWRITE_TAC[SURJ;INJ]; + DISCH_TAC; + ASM_REWRITE_TAC[]; + ASM_REWRITE_TAC[IN_ELIM_THM]; + BY(ASM_MESON_TAC[ Local_lemmas1.LT_CARD_MONO_LOFA]); + FIRST_X_ASSUM (MP_TAC o (MATCH_MP Basics.BIJ_SUM)); + DISCH_THEN (C INTRO_TAC [`\u. f u * interior_angle1 (vec 0) FF u`]); + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + TYPIFY `BIJ FST FF V` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC WRGCVDR_BIJ; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM (MP_TAC o (MATCH_MP Basics.BIJ_SUM)); + DISCH_THEN (C INTRO_TAC [ `\u. f u * interior_angle1 (vec 0) FF u`]); + DISCH_THEN (SUBST1_TAC o GSYM); + MATCH_MP_TAC SUM_EQ; + REWRITE_TAC[o_THM]; + GEN_TAC; + DISCH_TAC; + TYPIFY `FST x IN V` ENOUGH_TO_SHOW_TAC; + DISCH_TAC; + AP_TERM_TAC; + BY(ASM_MESON_TAC[Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM;Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2]); + BY(ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_IMP_IN_V2]); + COMMENT "prep for slice cases"; + TYPIFY `local_fan (v_prime V fv,e_prime (E UNION {{v, w}}) fv,fv) /\ local_fan (v_prime V fw,e_prime (E UNION {{w, v}}) fw,fw)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC HAFL_CIRCLE_FORM_LOCAL_FAN2_ALT; + GEXISTL_TAC [`FF`;`HS`]; + ASM_REWRITE_TAC[IN_DIFF;IN_SING]; + BY(ASM_MESON_TAC[]); + COMMENT "second sum"; + CONJ_TAC; + INTRO_TAC SLICEV_BIJ [`V`;`E`;`FF`;`v`;`w`;`n`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP Basics.BIJ_SUM)); + DISCH_THEN (C INTRO_TAC [`\u. f u * interior_angle1 (vec 0) fv u`]); + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + TYPIFY `BIJ FST fv (v_prime V fv)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC WRGCVDR_BIJ; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + FIRST_X_ASSUM (MP_TAC o (MATCH_MP Basics.BIJ_SUM)); + DISCH_THEN (C INTRO_TAC [ `\u. f u * interior_angle1 (vec 0) fv u`]); + DISCH_THEN (SUBST1_TAC o GSYM); + MATCH_MP_TAC SUM_EQ; + REWRITE_TAC[o_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `FST x IN v_prime V fv` ENOUGH_TO_SHOW_TAC; + DISCH_TAC; + AP_TERM_TAC; + BY(ASM_MESON_TAC[Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM;Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2]); + BY(ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_IMP_IN_V2]); + COMMENT "last case"; + INTRO_TAC SLICEW_BIJ [`V`;`E`;`FF`;`v`;`w`;`n`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP Basics.BIJ_SUM)); + DISCH_THEN (C INTRO_TAC [`\u. f u * interior_angle1 (vec 0) fw u`]); + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + TYPIFY `BIJ FST fw (v_prime V fw)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC WRGCVDR_BIJ; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + FIRST_X_ASSUM (MP_TAC o (MATCH_MP Basics.BIJ_SUM)); + DISCH_THEN (C INTRO_TAC [ `\u. f u * interior_angle1 (vec 0) fw u`]); + DISCH_THEN (SUBST1_TAC o GSYM); + MATCH_MP_TAC SUM_EQ; + REWRITE_TAC[o_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `FST x IN v_prime V fw` ENOUGH_TO_SHOW_TAC; + DISCH_TAC; + AP_TERM_TAC; + BY(ASM_MESON_TAC[Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM;Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2]); + BY(ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_IMP_IN_V2]) + ]);; + (* }}} *) + +let EJRCFJD_ALT2 = prove_by_refinement( + `!V E FF v w. + convex_local_fan (V,E,FF) /\ + v IN V /\ + w IN V /\ + (!u u1. + u IN {v, w} /\ u1 IN V /\ ~(u = u1) ==> ~collinear {vec 0, u, u1}) /\ + (!e. e IN FF ==> aff_gt {vec 0} {v, w} SUBSET wedge_in_fan_gt e E) + ==> convex_local_fan (slicev E FF v w,slicee E FF v w,slicef E FF v w) /\ + convex_local_fan (slicev E FF w v,slicee E FF w v,slicef E FF w v) /\ + tau_fun V E FF >= + tau_fun (slicev E FF v w) (slicee E FF v w) (slicef E FF v w) + + tau_fun (slicev E FF w v) (slicee E FF w v) (slicef E FF w v) /\ + sol_local E FF = + sol_local (slicee E FF v w) (slicef E FF v w) + + sol_local (slicee E FF w v) (slicef E FF w v) /\ + CARD (slicev E FF v w) < CARD V /\ + CARD (slicev E FF w v) < CARD V /\ + (generic V E + ==> generic (slicev E FF v w) (slicee E FF v w) /\ + generic (slicev E FF w v) (slicee E FF w v))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ejr_distinct [`V`;`E`;`FF`;`v`;`w`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + TYPED_ABBREV_TAC `HS = hypermap (HYP (vec 0,V,E UNION {{v, w}}))` ; + TYPED_ABBREV_TAC `fv = face HS (v,rho_node1 FF v)` ; + TYPED_ABBREV_TAC `fw = face HS (w,rho_node1 FF w)` ; + INTRO_TAC EJRCFJD_ALT [`V`;`E`;`FF`;`HS`;`fv`;`fw`;`v`;`w`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC (GSYM COMPATIBLE_BW_TWO_LEMMAS2_ALT) [`V`;`E`;`FF`;`HS`;`fv`;`fw`;`v`;`w`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `CARD (v_prime V fv) < CARD V /\ CARD (v_prime V fw) < CARD V` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `v_prime` (SUBST1_TAC o GSYM)); + CONJ_TAC; + MATCH_MP_TAC CARD_SLICEV_LT; + BY(ASM_REWRITE_TAC[]); + MATCH_MP_TAC CARD_SLICEV_LT; + ONCE_REWRITE_TAC[Collect_geom.PER_SET2]; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[Collect_geom.PER_SET3]); + TYPIFY `(generic V E ==> generic (v_prime V fv) (e_prime (E UNION {{v, w}}) fv) /\ generic (v_prime V fw) (e_prime (E UNION {{w, v}}) fw))` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + DISCH_TAC; + CONJ_TAC; + INTRO_TAC ejr_generic [`V`;`E`;`FF`;`v`;`w`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY(ASM_MESON_TAC[]); + INTRO_TAC ejr_generic [`V`;`E`;`FF`;`w`;`v`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[Collect_geom.PER_SET2]; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[Collect_geom.PER_SET3]); + BY(ASM_MESON_TAC[]); + COMMENT "now tau and sol"; + REWRITE_TAC[sol_local;tau_fun]; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.CVX_LO_IMP_LO]); + TYPIFY` local_fan (v_prime V fv,e_prime (E UNION {{v, w}}) fv,fv) /\ local_fan (v_prime V fw,e_prime (E UNION {{w, v}}) fw,fw)` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC HAFL_CIRCLE_FORM_LOCAL_FAN2_ALT; + GEXISTL_TAC [`FF`;`HS`]; + ASM_REWRITE_TAC[IN_DIFF;IN_SING]; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "insert"; + TYPIFY ` CARD FF + 2 = CARD fv + CARD fw` (C SUBGOAL_THEN ASSUME_TAC); + COMMENT "cut insert to here"; + INTRO_TAC CARD_SLICEF [`V`;`E`;`FF`;`v`;`w`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[]); + COMMENT "tau sum"; + INTRO_TAC ejr_sum [`V`;` E`;` FF`;` HS`;` v`;` w`;`rho_fun o (norm: (real^3-> real))`;` fv`;` fw`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[o_THM]; + DISCH_THEN SUBST1_TAC; + CONJ_TAC; + MATCH_MP_TAC (arith `c1 = c2 + c3 ==> ((a + b) - c1 >= a - c2 + b - c3)`); + REWRITE_TAC[arith `a * b + a * c = a * (b + c)`]; + AP_TERM_TAC; + REWRITE_TAC[REAL_OF_NUM_ADD]; + REWRITE_TAC[REAL_OF_NUM_EQ]; + TYPIFY `(2 <= CARD FF /\ 2 <= CARD fv /\ 2 <= CARD fw) /\ CARD FF + 2 = CARD fv + CARD fw` ENOUGH_TO_SHOW_TAC; + BY(ARITH_TAC); + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Local_lemmas.LOFA_IMP_CARD_FF_V_EQ; + TYPIFY`V` EXISTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + MATCH_MP_TAC Hypermap.CARD_ATLEAST_2; + GEXISTL_TAC [`v`;`w`]; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_FINITE_V]); + REPEAT (GMATCH_SIMP_TAC (arith `2 < x ==> 2 <= x`)); + REPEAT (GMATCH_SIMP_TAC (Local_lemmas1.LOFA_HYP_UNION_CARD_GT2)); + REWRITE_TAC[IN_DIFF;IN_SING]; + CONJ_TAC; + GEXISTL_TAC [`V`;`E`;`w`;`HS`;`FF`;`v`]; + BY(ASM_MESON_TAC[]); + GEXISTL_TAC [`V`;`E`;`v`;`HS`;`FF`;`w`]; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[Collect_geom.PER_SET2]; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[Collect_geom.PER_SET3]); + COMMENT "final sum"; + INTRO_TAC ejr_sum [`V`;` E`;` FF`;` HS`;` v`;` w`;`\ (v:real^3). &1`;` fv`;` fw`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[o_THM;arith `&1 * x = x`]; + TYPIFY `FINITE fv /\ FINITE fw /\ FINITE FF` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Wrgcvdr_cizmrrh.LOCAL_FAN_FINITE_FF]); + ASM_SIMP_TAC[SUM_SUB]; + ASM_SIMP_TAC[SUM_CONST]; + DISCH_THEN kill; + MATCH_MP_TAC (arith `cf + t2 = cv + c2 ==>t2 + (tv + tw) - cf = (t2 + tv - cv) + (t2 + tw - c2)`); + MATCH_MP_TAC (arith `cf + &2 = cv + cw ==> cf * pi + &2 * pi = cv * pi + cw * pi`); + REWRITE_TAC[REAL_OF_NUM_ADD]; + REWRITE_TAC[REAL_OF_NUM_EQ]; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let NKEZBFC = prove_by_refinement( + `!V E FF. convex_local_fan(V,E,FF) /\ generic V E + ==> &0 <= sol_local E FF`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MP_TAC Nkezbfc_local.NKEZBFC_PREP; + ANTS_TAC; + BY(REWRITE_TAC[EJRCFJD_ALT2 ]); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let azim_dart_azim_in_fan = prove_by_refinement( + `!V E x. FAN((vec 0),V,E) /\ ({FST x,SND x} IN E) + ==> azim_dart (V,E) x = azim_in_fan x E`, + (* {{{ proof *) + [ + REWRITE_TAC[FORALL_PAIR_THM;FST;SND]; + REWRITE_TAC[Fan_defs.azim_dart;(* L *)azim_in_fan;Fan_defs.azim_fan]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[LET_DEF;LET_END_DEF]; + TYPIFY `~(p1 = p2)` (C SUBGOAL_THEN ASSUME_TAC); + DISCH_TAC; + RULE_ASSUM_TAC (REWRITE_RULE[Fan.FAN;Fan.graph]); + REPEAT (FIRST_X_ASSUM MP_TAC) THEN REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`{p1,p2}`]); + REWRITE_TAC[Local_lemmas1.SET2_HAS_SIZE2]; + BY(ASM_MESON_TAC[IN]); + ASM_SIMP_TAC[GSYM (* L *)EE_elim]; + COND_CASES_TAC THEN ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Wrgcvdr_cizmrrh.AZIM_CYCLE_EQ_SIGMA_FAN; + TYPIFY `V` EXISTS_TAC; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[GSYM (* L *)EE_elim]; + BY(ASM_REWRITE_TAC[(* L *)EE;IN_ELIM_THM]) + ]);; + (* }}} *) + +let rho_fun = new_definition `rho_fun y = &1 + (inv (&2 * h0 - &2)) * (inv pi) * sol0 * (y - &2)`;; + +let rho_rho_fun = prove_by_refinement( + `!y. rho_fun y = rho y`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.rho;rho_fun;Sphere.const1;Sphere.ly;Sphere.interp]; + REWRITE_TAC[GSYM Nonlinear_lemma.sol0_EQ_sol_y;Sphere.h0]; + REWRITE_TAC[arith `a + b = a + c <=> c = b`]; + GEN_TAC; + MATCH_MP_TAC (arith `(sol0/pi)*(&1 - a) = (sol0/pi)*(c*e) ==> sol0/pi - sol0/pi * a = c * inv pi * sol0 * e`); + AP_TERM_TAC; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let h_dart = new_definition `h_dart (x:real^3#B) = norm (FST x) / &2`;; + +let tauVEF = new_definition `tauVEF (V,E,f) = + sum f ( \ x. azim_dart (V,E) x * (&1 + (sol0/pi) * (&1 - lmfun (h_dart x)))) + (pi + sol0)*(&2 - &(CARD(f)))`;; + +let tau_fun = new_definition `tau_fun V E f = sum (f) (\e. rho_fun(norm(FST e)) * (azim_in_fan e E)) - (pi + sol0) * &(CARD f -2)`;; + +let ly_EQ_lmfun = prove(`!x:real^3#real^3. norm (FST x) <= &2 * h0 ==> lmfun (h_dart x) = ly (norm (FST x))`, + REWRITE_TAC[Pack_defs.lmfun; Sphere.ly; Sphere.interp; h_dart; Pack_defs.h0] THEN + REAL_ARITH_TAC);; + +let tauVEF_tau_fun = prove_by_refinement( + `!V E f. FAN ((vec 0),V,E) /\ + 2 <= CARD f /\ + (!x. x IN f ==> norm(FST x) <= &2 * h0) /\ + (!x. x IN f ==> {FST x,SND x} IN E) + ==> tau_fun V E f = tauVEF (V,E,f)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[tauVEF;tau_fun]; + GMATCH_SIMP_TAC (GSYM REAL_OF_NUM_SUB); + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `x - u * (v - w) = x' + u * (w - v) <=> x = x'`]; + MATCH_MP_TAC SUM_EQ; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[]; + MATCH_MP_TAC (arith `x = x' /\ y = y' ==> x*y' = y*x'`); + REWRITE_TAC[rho_rho_fun;Sphere.rho;Nonlinear_lemma.sol0_over_pi_EQ_const1]; + CONJ_TAC; + MATCH_MP_TAC (arith `(l = l') ==> &1 + c - c * l = &1 + c *(&1 - l')`); + BY(ASM_SIMP_TAC[ly_EQ_lmfun]); + GMATCH_SIMP_TAC azim_dart_azim_in_fan; + BY(ASM_SIMP_TAC[]) + ]);; + (* }}} *) + + + end;; diff --git a/text_formalization/local/lp_details.hl b/text_formalization/local/lp_details.hl new file mode 100644 index 0000000..c99e693 --- /dev/null +++ b/text_formalization/local/lp_details.hl @@ -0,0 +1,1235 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Section: Conclusions *) +(* Chapter: Tame (Linear Programs) *) +(* Author: Thomas C. Hales *) +(* Date: 2013-06-19 *) +(* ========================================================================== *) + +(* +Treatment of two special inequalities for the linear programs. + +The main results are + +LEMMA_8673686234 (uses inequalities "6170936724","8673686234 a","8673686234 b","8673686234 c") +see head.mod:yapex_sup_flat 'ID[8673686234]' + +LEMMA_5691615370 (uses inequalities "5584033259","6170936724","5691615370") +see head.mod:perimZ 'ID[5691615370]' + +*) + +module Lp_details = struct + + open Hales_tactic;; +(* start 867 *) + +let quadratic_root_plus_disc = prove_by_refinement( + `!a b c x. &0 < a /\ a * x pow 2 + b * x + c <= &0 ==> + &0 <= b pow 2 - &4 * a * c`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + TYPIFY `a * x pow 2 + b * x + c = a * (x + b /(&2 * a)) pow 2 - (b pow 2 - &4 * a*c)/(&4 * a)` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + ONCE_REWRITE_TAC[arith `u - v <= &0 <=> u <= v`]; + GMATCH_SIMP_TAC REAL_LE_RDIV_EQ; + CONJ_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + TYPIFY `&0 <= (a * (x + b / (&2 * a)) pow 2) * &4 * a` ENOUGH_TO_SHOW_TAC; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LE_MUL; + CONJ_TAC; + GMATCH_SIMP_TAC REAL_LE_MUL; + ASM_REWRITE_TAC[REAL_LE_POW_2]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let quadratic_root_exists = prove_by_refinement( + `!a b c x. &0 < a /\ a * x pow 2 + b * x + c <= &0 ==> + (?y. x <= y /\ a * y pow 2 + b *y + c = &0)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `(h:real) = quadratic_root_plus (a, b + &2 * a *x, a * x pow 2 + b * x + c)`; + TYPIFY `x + h` EXISTS_TAC; + REWRITE_TAC[arith `a * (x + h) pow 2 + b * (x + h) +c = a * h pow 2 + (b + &2 * a *x) * h + (a * x pow 2 + b * x + c)`]; + TYPIFY `(b + &2 * a * x) pow 2 <= (b + &2 * a * x) pow 2 - &4 * a * (a * x pow 2 + b * x + c)` (C SUBGOAL_THEN ASSUME_TAC); + ONCE_REWRITE_TAC[arith `v <= v - &4 * a * x <=> &0 <= a * (-- x)`]; + GMATCH_SIMP_TAC REAL_LE_MUL; + BY(ASM_TAC THEN REAL_ARITH_TAC); + CONJ2_TAC; + EXPAND_TAC "h"; + MATCH_MP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] Tame_lemmas.quadratic_root_plus_works); + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM MP_TAC; + BY(MESON_TAC[REAL_LE_TRANS;REAL_LE_POW_2]); + MATCH_MP_TAC (arith `&0 <= h ==> x <= x + h`); + EXPAND_TAC "h"; + REWRITE_TAC[Sphere.quadratic_root_plus]; + GMATCH_SIMP_TAC REAL_LE_RDIV_EQ; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + ENOUGH_TO_SHOW_TAC `(b + &2 * a * x) <= sqrt((b + &2 * a*x) pow 2) /\ sqrt((b+ &2 * a*x) pow 2) <= sqrt((b + &2 * a * x) pow 2 - &4 * a * (a * x pow 2 + b * x + c))`; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC SQRT_MONO_LE_EQ; + REWRITE_TAC[POW_2_SQRT_ABS]; + ASM_REWRITE_TAC[]; + CONJ2_TAC; + BY(REAL_ARITH_TAC); + SUBCONJ_TAC; + BY(REWRITE_TAC[REAL_LE_POW_2]); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let quadratic_root_pos_exists = prove_by_refinement( + `!a b c x. a < &0 /\ &0 <= a * x pow 2 + b * x + c ==> + (?y. x <= y /\ a * y pow 2 + b *y + c = &0)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC quadratic_root_exists [`--a`;`--b`;`--c`;`x`]; + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `y` EXISTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let delta_x_root_exists = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + &0 <= delta_x x1 x2 x3 x4 x5 x6 /\ &0 < x1 ==> + (?x4'. x4 <= x4' /\ delta_x x1 x2 x3 x4' x5 x6 = &0)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `b = ( delta_x4 x1 x2 x3 (&0) x5 x6)` ; + TYPED_ABBREV_TAC `c = delta_x x1 x2 x3 (&0) x5 x6` ; + TYPIFY `!z. delta_x x1 x2 x3 z x5 x6 = (-- x1) * z pow 2 + b * z + c` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "c"; + EXPAND_TAC "b"; + REWRITE_TAC[Sphere.delta_x;Sphere.delta_x4]; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC quadratic_root_pos_exists; + FIRST_X_ASSUM ((unlist REWRITE_TAC) o GSYM); + ASM_REWRITE_TAC[]; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let delta_y_root_exists = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + &0 <= delta_y y1 y2 y3 y4 y5 y6 /\ &0 < y1 /\ &0 < y4 ==> + (?y4'. y4 <= y4' /\ delta_y y1 y2 y3 y4' y5 y6 = &0)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_y]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC delta_x_root_exists [`y1*y1`;`y2*y2`;`y3*y3`;`y4*y4`;`y5*y5`;`y6*y6`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `sqrt(x4')` EXISTS_TAC; + TYPIFY `&0 <= x4'` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `<=` MP_TAC; + BY(MESON_TAC[REAL_LE_POW_2;REAL_LE_TRANS;arith `x*x = x pow 2`]); + TYPIFY `sqrt(x4') * sqrt(x4') = x4'` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC (GSYM SQRT_MUL); + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `y4 * y4 <= x4'` MP_TAC; + FIRST_ASSUM_ST `(=)` (SUBST1_TAC o GSYM); + REWRITE_TAC[arith `~(x <= y) <=> y < x`]; + MATCH_MP_TAC Misc_defs_and_lemmas.ABS_SQUARE; + TYPIFY `&0 <= sqrt x4'` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC SQRT_POS_LE; + BY(ASM_REWRITE_TAC[]); + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let edge2_flatD_x1_quadratic_root_plus = prove_by_refinement( + `!d x2 x3 x4 x5 x6. + edge2_flatD_x1 d x2 x3 x4 x5 x6 = + quadratic_root_plus(x4, + -- delta_x1 (&0) x2 x3 x4 x5 x6, + d - delta_x (&0) x2 x3 x4 x5 x6 )`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.edge2_flatD_x1]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `b = (-- delta_x1 (&0) x2 x3 x4 x5 x6)`; + TYPED_ABBREV_TAC `c = (d - delta_x (&0) x2 x3 x4 x5 x6)`; + TYPIFY `!z. d - delta_x z x2 x3 x4 x5 x6 = x4 * z pow 2 + b * z + c` ((C SUBGOAL_THEN ASSUME_TAC)); + EXPAND_TAC "c"; + EXPAND_TAC "b"; + REWRITE_TAC[Sphere.delta_x;Nonlin_def.delta_x1]; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[Nonlinear_lemma.abc_quadratic]; + ]);; + (* }}} *) + +let edge2_flatD_x1_expanded = prove_by_refinement( + `!d x2 x3 x4 x5 x6. + edge2_flatD_x1 d x2 x3 x4 x5 x6 = (delta_x1 (&0) x2 x3 x4 x5 x6 + + sqrt (ups_x x2 x3 x4 * ups_x x4 x5 x6 - &4 * x4 * d)) / (&2 * x4) + `, + (* {{{ proof *) + [ + REWRITE_TAC[edge2_flatD_x1_quadratic_root_plus]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `b = (-- delta_x1 (&0) x2 x3 x4 x5 x6)`; + TYPED_ABBREV_TAC `c = (d - delta_x (&0) x2 x3 x4 x5 x6)`; + REWRITE_TAC[Sphere.quadratic_root_plus]; + TYPIFY `b pow 2 - &4 * x4 * c = ups_x x2 x3 x4 * ups_x x4 x5 x6 - &4 * x4 * d` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "b"; + EXPAND_TAC "c"; + REWRITE_TAC[Sphere.delta_x;Nonlin_def.delta_x1;Sphere.ups_x]; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + EXPAND_TAC "b"; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let derived_form_edge2_flatD_x1 = prove_by_refinement( + `!x2 x3 x4 x5 x6. (&0 < ups_x x2 x3 x4 /\ &0 < ups_x x4 x5 x6 /\ &0 < x4) + ==> (?f'. + derived_form T + (\q. edge2_flatD_x1 (&0) q x3 x4 x5 x6) f' x2 (:real))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[edge2_flatD_x1_expanded]; + REWRITE_TAC[Nonlin_def.delta_x1;Sphere.ups_x;arith `x - &4 * x4 * &0 = x`]; + TYPIFY `((((x5 - x6 + x4) + (((--x2 + -- &1 * x2) + &2 * x4 + &2 * x3) * (--x4 * x4 - x5 * x5 - x6 * x6 + &2 * x4 * x6 + &2 * x4 * x5 + &2 * x5 * x6)) * inv (&2 * sqrt ((--x2 * x2 - x3 * x3 - x4 * x4 + &2 * x2 * x4 + &2 * x2 * x3 + &2 * x3 * x4) * (--x4 * x4 - x5 * x5 - x6 * x6 + &2 * x4 * x6 + &2 * x4 * x5 + &2 * x5 * x6)))) * &2 * x4) / (&2 * x4) pow 2)` EXISTS_TAC; + Pent_hex.DERIVED_TAC MP_TAC; + REWRITE_TAC[GSYM Sphere.ups_x]; + TYPIFY_GOAL_THEN `(&0 < ups_x x2 x3 x4 * ups_x x4 x5 x6 /\ ~(&2 = &0) /\ ~(x4 = &0))` (unlist REWRITE_TAC); + REWRITE_TAC[REAL_OF_NUM_EQ]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ARITH_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let edge2_flatD_x1_continuous = prove_by_refinement( + `!x2 x3 x4 x5 x6. (&0 < ups_x x2 x3 x4 /\ &0 < ups_x x4 x5 x6 /\ &0 < x4 ==> + (\q. edge2_flatD_x1 (&0) q x3 x4 x5 x6) real_continuous atreal x2)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL; + INTRO_TAC derived_form_edge2_flatD_x1 [`x2`;`x3`;`x4`;`x5`;`x6`]; + BY(ASM_REWRITE_TAC[Calc_derivative.derived_form;WITHINREAL_UNIV]) + ]);; + (* }}} *) + +let IVT_edge2_flatD_x1 = prove_by_refinement( + `!x1m x1M x2m x2M x3 x4 x5 x6. + (!x2. x2m <= x2 /\ x2 <= x2M ==> &0 < ups_x x2 x3 x4) /\ + (&0 < ups_x x4 x5 x6) /\ + (&0 < x4) /\ + (x1m <= x1M) /\ + (x2m <= x2M) /\ + (delta_x x1M x2M x3 x4 x5 x6 = &0) /\ + (!x1 x2. x1m <= x1 /\ x1 <= x1M /\ x2m <= x2 /\ x2 <= x2M ==> + delta_x1 x1 x2 x3 x4 x5 x6 < &0) ==> + ((?x2. x2m <= x2 /\ x2 <= x2M /\ edge2_flatD_x1 (&0) x2 x3 x4 x5 x6 = x1m) \/ + (x1m < edge2_flatD_x1 (&0) x2m x3 x4 x5 x6))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!x2. x2m <= x2 /\ x2 <= x2M ==> x1m < edge2_flatD_x1 (&0) x2 x3 x4 x5 x6` ASM_CASES_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`x2m`]); + ASM_REWRITE_TAC[arith `x <= x`]; + BY(MESON_TAC[]); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[NOT_FORALL_THM]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[TAUT `~(a ==> b) <=> (a /\ ~b)`]; + REWRITE_TAC[arith `~(x < b) <=> b <= x`]; + REPEAT WEAKER_STRIP_TAC; + DISJ1_TAC; + INTRO_TAC REAL_IVT_INCREASING [`(\q. edge2_flatD_x1 (&0) q x3 x4 x5 x6)`;`x2`;`x2M`;`x1m`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ2_TAC; + ENOUGH_TO_SHOW_TAC `edge2_flatD_x1 (&0) x2M x3 x4 x5 x6 = x1M`; + BY(ASM_TAC THEN REAL_ARITH_TAC); + MATCH_MP_TAC Pent_hex.edge2_flatD_x1_delta_lemma2; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[REAL_CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN]; + REWRITE_TAC[IN_REAL_INTERVAL]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC REAL_CONTINUOUS_ATREAL_WITHINREAL; + MATCH_MP_TAC edge2_flatD_x1_continuous; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[IN_REAL_INTERVAL]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `x` EXISTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let edge2_flatD_x1_works = prove_by_refinement( + `!x2 x3 x4 x5 x6. + &0 <= ups_x x2 x3 x4 /\ &0 <= ups_x x4 x5 x6 /\ ~(x4 = &0) ==> + delta_x (edge2_flatD_x1 (&0) x2 x3 x4 x5 x6) x2 x3 x4 x5 x6 = &0`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[edge2_flatD_x1_quadratic_root_plus]; + TYPED_ABBREV_TAC `b = (-- delta_x1 (&0) x2 x3 x4 x5 x6)`; + TYPED_ABBREV_TAC `c = (&0 - delta_x (&0) x2 x3 x4 x5 x6)`; + ONCE_REWRITE_TAC[arith `d = &0 <=> &0 - d = &0`]; + TYPIFY `!z. &0 - delta_x z x2 x3 x4 x5 x6 = x4 * z pow 2 + b * z + c` ((C SUBGOAL_THEN ASSUME_TAC)); + EXPAND_TAC "c"; + EXPAND_TAC "b"; + REWRITE_TAC[Sphere.delta_x;Nonlin_def.delta_x1]; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] Tame_lemmas.quadratic_root_plus_works); + TYPIFY `b pow 2 - &4 * x4 * c = ups_x x2 x3 x4 * ups_x x4 x5 x6 ` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "b"; + EXPAND_TAC "c"; + REWRITE_TAC[Sphere.delta_x;Nonlin_def.delta_x1;Sphere.ups_x]; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LE_MUL; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let delta_x1_decreasing = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6 x1'. + x1 <= x1' /\ &0 <= x4 ==> + delta_x1 x1' x2 x3 x4 x5 x6 <= delta_x1 x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ENOUGH_TO_SHOW_TAC `delta_x1 x1 x2 x3 x4 x5 x6 - delta_x1 x1' x2 x3 x4 x5 x6 = &2 * x4 * (x1' - x1)`; + ONCE_REWRITE_TAC[arith `d' <= d <=> &0 <= d - d'`]; + DISCH_THEN SUBST1_TAC; + GMATCH_SIMP_TAC REAL_LE_MUL; + CONJ_TAC; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LE_MUL; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[Nonlin_def.delta_x1]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let IVT_delta_x = prove_by_refinement( + `!x1m x1M x2m x2M x3 x4 x5 x6. + (!x2. x2m <= x2 /\ x2 <= x2M ==> &0 < ups_x x2 x3 x4) /\ + &0 < ups_x x4 x5 x6 /\ + &0 < x4 /\ + x1m <= x1M /\ + x2m <= x2M /\ + delta_x x1M x2M x3 x4 x5 x6 = &0 /\ + (!x2. x2m <= x2 /\ x2 <= x2M + ==> delta_x1 x1m x2 x3 x4 x5 x6 < &0) + ==> (?x2. x2m <= x2 /\ + x2 <= x2M /\ delta_x x1m x2 x3 x4 x5 x6 = &0) \/ + (?x1. x1m < x1 /\ delta_x x1 x2m x3 x4 x5 x6 = &0)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC IVT_edge2_flatD_x1 [`x1m`;`x1M`;`x2m`;`x2M`;`x3`;`x4`;`x5`;`x6`]; + ANTS_TAC; + (ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ENOUGH_TO_SHOW_TAC `delta_x1 x1 x2 x3 x4 x5 x6 <= delta_x1 x1m x2 x3 x4 x5 x6`; + MATCH_MP_TAC (arith `x < &0 ==> (y <= x ==> y< &0)`); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + MATCH_MP_TAC delta_x1_decreasing; + BY(ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`]); + STRIP_TAC; + DISJ1_TAC; + TYPIFY `x2` EXISTS_TAC; + ASM_REWRITE_TAC[]; + EXPAND_TAC "x1m"; + MATCH_MP_TAC edge2_flatD_x1_works; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`;arith `&0 < x ==> ~(x = &0)`]); + DISJ2_TAC; + TYPIFY `edge2_flatD_x1 (&0) x2m x3 x4 x5 x6` EXISTS_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC edge2_flatD_x1_works; + ASM_SIMP_TAC[arith `x < y ==> x <= y`;arith `&0 < x ==> ~(x = &0)`]; + MATCH_MP_TAC (arith `x < y ==> x <= y`); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let delta_x1_sym = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + delta_x1 x1 x3 x2 x4 x6 x5 = delta_x1 x1 x2 x3 x4 x5 x6 /\ + delta_x1 x1 x5 x6 x4 x2 x3 = delta_x1 x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.delta_x1]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let IVT_delta_x_3 = prove_by_refinement( + `!x1m x1M x2 x3m x3M x4 x5 x6. + (!x3. x3m <= x3 /\ x3 <= x3M ==> &0 < ups_x x2 x3 x4) /\ + &0 < ups_x x4 x5 x6 /\ + &0 < x4 /\ + x1m <= x1M /\ + x3m <= x3M /\ + delta_x x1M x2 x3M x4 x5 x6 = &0 /\ + (!x3. x3m <= x3 /\ x3 <= x3M + ==> delta_x1 x1m x2 x3 x4 x5 x6 < &0) + ==> (?x3. x3m <= x3 /\ + x3 <= x3M /\ delta_x x1m x2 x3 x4 x5 x6 = &0) \/ + (?x1. x1m < x1 /\ delta_x x1 x2 x3m x4 x5 x6 = &0)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC IVT_delta_x [`x1m`;`x1M`;`x3m`;`x3M`;`x2`;`x4`;`x6`;`x5`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[Merge_ineq.ups_x_sym]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + FIRST_X_ASSUM_ST `ups_x` MP_TAC; + BY(MESON_TAC[Collect_geom.UPS_X_SYM]); + CONJ_TAC; + BY(ASM_MESON_TAC[Merge_ineq.delta_x_sym]); + BY(ASM_MESON_TAC[delta_x1_sym]); + BY(MESON_TAC[Merge_ineq.delta_x_sym]) + ]);; + (* }}} *) + +let IVT_delta_x_5 = prove_by_refinement( + `!x1m x1M x2 x3 x4 x5m x5M x6. + (!x5. x5m <= x5 /\ x5 <= x5M ==> &0 < ups_x x4 x5 x6) /\ + &0 < ups_x x2 x3 x4 /\ + &0 < x4 /\ + x1m <= x1M /\ + x5m <= x5M /\ + delta_x x1M x2 x3 x4 x5M x6 = &0 /\ + (!x5. x5m <= x5 /\ x5 <= x5M + ==> delta_x1 x1m x2 x3 x4 x5 x6 < &0) + ==> (?x5. x5m <= x5 /\ + x5 <= x5M /\ delta_x x1m x2 x3 x4 x5 x6 = &0) \/ + (?x1. x1m < x1 /\ delta_x x1 x2 x3 x4 x5m x6 = &0)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC IVT_delta_x [`x1m`;`x1M`;`x5m`;`x5M`;`x6`;`x4`;`x2`;`x3`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[Collect_geom.UPS_X_SYM]); + CONJ_TAC; + BY(ASM_MESON_TAC[Collect_geom.UPS_X_SYM]); + CONJ_TAC; + BY(ASM_MESON_TAC[Merge_ineq.delta_x_sym]); + BY(ASM_MESON_TAC[delta_x1_sym]); + BY(MESON_TAC[Merge_ineq.delta_x_sym]) + ]);; + (* }}} *) + +let IVT_delta_x_6 = prove_by_refinement( + `!x1m x1M x2 x3 x4 x5 x6m x6M. + (!x6. x6m <= x6 /\ x6 <= x6M ==> &0 < ups_x x4 x5 x6) /\ + &0 < ups_x x2 x3 x4 /\ + &0 < x4 /\ + x1m <= x1M /\ + x6m <= x6M /\ + delta_x x1M x2 x3 x4 x5 x6M = &0 /\ + (!x6. x6m <= x6 /\ x6 <= x6M + ==> delta_x1 x1m x2 x3 x4 x5 x6 < &0) + ==> (?x6. x6m <= x6 /\ + x6 <= x6M /\ delta_x x1m x2 x3 x4 x5 x6 = &0) \/ + (?x1. x1m < x1 /\ delta_x x1 x2 x3 x4 x5 x6m = &0)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC IVT_delta_x [`x1m`;`x1M`;`x6m`;`x6M`;`x5`;`x4`;`x3`;`x2`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[Collect_geom.UPS_X_SYM]); + CONJ_TAC; + BY(ASM_MESON_TAC[Collect_geom.UPS_X_SYM]); + CONJ_TAC; + BY(ASM_MESON_TAC[Merge_ineq.delta_x_sym]); + BY(ASM_MESON_TAC[delta_x1_sym]); + BY(MESON_TAC[Merge_ineq.delta_x_sym]) + ]);; + (* }}} *) + +let IVT_delta_x_full = prove_by_refinement( + `!x1m x1M x2m x2M x3m x3M x4 x5m x5M x6m x6M. + &0 < x4 /\ + (!x2 x3. x2m <= x2 /\ x2 <= x2M /\ x3m <= x3 /\ x3 <= x3M ==> &0 < ups_x x2 x3 x4) /\ + (!x5 x6. x5m <= x5 /\ x5 <= x5M /\ x6m <= x6 /\ x6 <= x6M ==> &0 < ups_x x4 x5 x6) /\ + x1m <= x1M /\ x2m <= x2M /\ x3m <= x3M /\ x5m <= x5M /\ x6m <= x6M /\ + delta_x x1M x2M x3M x4 x5M x6M = &0 /\ + (! x2 x3 x5 x6. + x2m <= x2 /\ x2 <= x2M /\ x3m <= x3 /\ x3 <= x3M /\ + x5m <= x5 /\ x5 <= x5M /\ x6m <= x6 /\ x6 <= x6M ==> + delta_x1 x1m x2 x3 x4 x5 x6 < &0) ==> + (?x2 x3 x5 x6. x2m <= x2 /\ x2 <= x2M /\ x3m <= x3 /\ x3 <= x3M /\ + x5m <= x5 /\ x5 <= x5M /\ x6m <= x6 /\ x6 <= x6M /\ + delta_x x1m x2 x3 x4 x5 x6 = &0) \/ + (?x1. x1m < x1 /\ delta_x x1 x2m x3m x4 x5m x6m = &0) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + RULE_ASSUM_TAC (REWRITE_RULE[DE_MORGAN_THM;NOT_EXISTS_THM;TAUT `~(a /\ b) <=> a ==> ~b`;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]); + FIRST_X_ASSUM MP_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC IVT_delta_x [`x1m`;`x1M`;`x2m`;`x2M`;`x3M`;`x4`;`x5M`;`x6M`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + CONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + INTRO_TAC IVT_delta_x_3 [`x1m`;`x1`;`x2m`;`x3m`;`x3M`;`x4`;`x5M`;`x6M`]; + ASM_REWRITE_TAC[]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + CONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + CONJ_TAC; + BY(FIRST_X_ASSUM_ST `<` MP_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + INTRO_TAC IVT_delta_x_5 [`x1m`;`x1'`;`x2m`;`x3m`;`x4`;`x5m`;`x5M`;`x6M`]; + ASM_REWRITE_TAC[]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + CONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + CONJ_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `<` MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + INTRO_TAC IVT_delta_x_6 [`x1m`;`x1''`;`x2m`;`x3m`;`x4`;`x5m`;`x6m`;`x6M`]; + ASM_REWRITE_TAC[]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + CONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + CONJ_TAC; + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM_ST `<` MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPLICATE_TAC 4 (FIRST_X_ASSUM_ST `<` MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let FORALL_BIJ_SQUARE = prove_by_refinement( + `!P ym yM. &0 <= ym /\ &0 <= yM ==> + ((!x. ym*ym <= x /\ x <= yM*yM ==> P x) <=> + (!y. ym <= y /\ y <= yM ==> P (y*y)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (TAUT `(a ==> b) /\ (b ==> a) ==> (a <=> b)`); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `&0 <= x` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `y*y <= x` MP_TAC; + BY(MESON_TAC[REAL_LE_POW_2;arith `x*x = x pow 2`;REAL_LE_TRANS]); + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `*` MP_TAC); + TYPIFY_GOAL_THEN `x = sqrt x * sqrt x` (unlist ONCE_REWRITE_TAC); + GMATCH_SIMP_TAC (GSYM SQRT_MUL); + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[arith `x * x = x pow 2`]; + GMATCH_SIMP_TAC (GSYM Trigonometry2.POW2_COND); + GMATCH_SIMP_TAC (GSYM Trigonometry2.POW2_COND); + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC SQRT_POS_LE; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `x pow 2 = x*x`]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let EXISTS_BIJ_SQUARE = prove_by_refinement( + `!P ym yM. &0 <= ym /\ &0 <= yM ==> + ((?x. ym*ym <= x /\ x <= yM*yM /\ P x) <=> + (?y. ym <= y /\ y <= yM /\ P (y*y)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[TAUT `(a <=> b) <=> (~a <=> ~b)`]; + REWRITE_TAC[NOT_EXISTS_THM;DE_MORGAN_THM]; + REWRITE_TAC[TAUT `~a \/ ~b \/ ~c <=> (a /\ b ==> ~c)`]; + MATCH_MP_TAC FORALL_BIJ_SQUARE; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let IVT_delta_y_full = prove_by_refinement( + `!y1m y1M y2m y2M y3m y3M y4 y5m y5M y6m y6M. + &0 < y4 /\ + &0 <= y1m /\ &0 <= y2m /\ &0 <= y3m /\ &0 <= y5m /\ &0 <= y6m /\ + (!y2 y3. y2m <= y2 /\ y2 <= y2M /\ y3m <= y3 /\ y3 <= y3M ==> &0 < ups_x (y2*y2) (y3*y3) (y4*y4)) /\ + (!y5 y6. y5m <= y5 /\ y5 <= y5M /\ y6m <= y6 /\ y6 <= y6M ==> &0 < ups_x (y4*y4) (y5*y5) (y6*y6)) /\ + y1m <= y1M /\ y2m <= y2M /\ y3m <= y3M /\ y5m <= y5M /\ y6m <= y6M /\ + delta_y y1M y2M y3M y4 y5M y6M = &0 /\ + (! y2 y3 y5 y6. + y2m <= y2 /\ y2 <= y2M /\ y3m <= y3 /\ y3 <= y3M /\ + y5m <= y5 /\ y5 <= y5M /\ y6m <= y6 /\ y6 <= y6M ==> + y_of_x delta_x1 y1m y2 y3 y4 y5 y6 < &0) ==> + (?y2 y3 y5 y6. y2m <= y2 /\ y2 <= y2M /\ y3m <= y3 /\ y3 <= y3M /\ + y5m <= y5 /\ y5 <= y5M /\ y6m <= y6 /\ y6 <= y6M /\ + delta_y y1m y2 y3 y4 y5 y6 = &0) \/ + (?y1. y1m < y1 /\ delta_y y1 y2m y3m y4 y5m y6m = &0) +`, + (* {{{ proof *) + [ + + REPEAT WEAKER_STRIP_TAC; + TYPIFY `&0 <= y2M /\ &0 <= y3M /\ &0 <= y5M /\ &0 <= y6M` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT (FIRST_X_ASSUM_ST `!` kill); + BY(ASM_TAC THEN REAL_ARITH_TAC); + INTRO_TAC IVT_delta_x_full [`y1m * y1m`;`y1M * y1M`;`y2m*y2m`;`y2M*y2M`;`y3m*y3m`;`y3M*y3M`;`y4*y4`;`y5m*y5m`;`y5M*y5M`;`y6m*y6m`;`y6M*y6M`]; + ANTS_TAC; + ASM_REWRITE_TAC[GSYM Sphere.delta_y]; + CONJ_TAC; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + TYPIFY `!x2. y2m * y2m <= x2 /\ x2 <= y2M * y2M ==> !x3. y3m * y3m <= x3 /\ x3 <= y3M * y3M ==> &0 < ups_x x2 x3 (y4 * y4)` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[]); + REPEAT (GMATCH_SIMP_TAC FORALL_BIJ_SQUARE THEN ASM_REWRITE_TAC[] THEN REPEAT GEN_TAC THEN DISCH_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + CONJ_TAC; + TYPIFY `!x5. y5m * y5m <= x5 /\ x5 <= y5M * y5M ==> !x6. y6m * y6m <= x6 /\ x6 <= y6M * y6M ==> &0 < ups_x (y4 * y4) x5 x6` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[]); + REPEAT (GMATCH_SIMP_TAC FORALL_BIJ_SQUARE THEN ASM_REWRITE_TAC[] THEN REPEAT GEN_TAC THEN DISCH_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPEAT (GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE); + ASM_SIMP_TAC[arith `&0 <= y ==> abs y = y`]; + TYPIFY `!x2 . y2m * y2m <= x2 /\ x2 <= y2M * y2M ==> !x3. y3m * y3m <= x3 /\ x3 <= y3M * y3M ==> !x5. y5m * y5m <= x5 /\ x5 <= y5M * y5M ==> !x6. y6m * y6m <= x6 /\ x6 <= y6M * y6M ==> delta_x1 (y1m * y1m) x2 x3 (y4 * y4) x5 x6 < &0` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[]); + REPEAT (GMATCH_SIMP_TAC FORALL_BIJ_SQUARE THEN ASM_REWRITE_TAC[] THEN REPEAT GEN_TAC THEN DISCH_TAC); + REWRITE_TAC[GSYM Sphere.y_of_x]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + STRIP_TAC; + DISJ1_TAC; + TYPIFY `?y2. y2m <= y2 /\ y2 <= y2M /\ ?y3. y3m <= y3 /\ y3 <= y3M /\ ?y5. y5m <= y5 /\ y5 <= y5M /\ ?y6. y6m <= y6 /\ y6 <= y6M /\ delta_y y1m y2 y3 y4 y5 y6 = &0` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[]); + REWRITE_TAC[Sphere.delta_y]; + GMATCH_SIMP_TAC (GSYM EXISTS_BIJ_SQUARE); + ASM_REWRITE_TAC[]; + TYPIFY `x2` EXISTS_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC (GSYM EXISTS_BIJ_SQUARE); + ASM_REWRITE_TAC[]; + TYPIFY `x3` EXISTS_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC (GSYM EXISTS_BIJ_SQUARE); + ASM_REWRITE_TAC[]; + TYPIFY `x5` EXISTS_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC (GSYM EXISTS_BIJ_SQUARE); + ASM_REWRITE_TAC[]; + TYPIFY `x6` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISJ2_TAC; + REWRITE_TAC[Sphere.delta_y]; + TYPIFY `sqrt x1` EXISTS_TAC; + GMATCH_SIMP_TAC (GSYM SQRT_MUL); + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_RSQRT; + ASM_REWRITE_TAC[arith `y pow 2 = y*y`]; + FIRST_X_ASSUM_ST `<` MP_TAC; + BY(MESON_TAC[arith `a < y ==> a <= y`;arith `y*y = y pow 2`;REAL_LE_POW_2;REAL_LE_TRANS]) + ]);; + (* }}} *) + +let REAL_WLOG_DS_LEMMA = prove_by_refinement( + `!P. (!(y1:A) y2 y3 (y4:A) y5 y6. P y1 y2 y3 y4 y5 y6 = P y1 y3 y2 y4 y6 y5) /\ + (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y1 y5 y6 y4 y2 y3) /\ + (!y1 y2 y3 y4 y5 y6. (y3 <= y2) /\ (y5 <= y2) /\ (y6 <= y2) + ==> + P y1 y2 y3 y4 y5 y6) ==> + (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `?a. a IN {y2,y3,y5,y6} /\ (!x. x IN {y2,y3,y5,y6} ==> x <= a)` MP_TAC; + MATCH_MP_TAC Merge_ineq.REAL_FINITE_MAX_EXISTS; + BY(REWRITE_TAC[ FINITE_INSERT ; FINITE_EMPTY;NOT_INSERT_EMPTY]); + REPEAT WEAK_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `IN` MP_TAC); + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[MESON[] `(!x. x = y2 \/ x = y3 \/ x = y5 \/ x = y6 ==> x <= a) = (y2 <= a /\ y3 <= a /\ y5 <= a /\ y6 <= a)`]; + BY(DISCH_THEN STRIP_ASSUME_TAC THEN ASM_MESON_TAC[]) + ]);; + (* }}} *) + +(* +let REAL_WLOG_DS2_LEMMA = prove_by_refinement( +`!P. (!(y1:A) y2 y3 (y4:A) y5 y6. P y1 y2 y3 y4 y5 y6 = P y1 y3 y2 y4 y6 y5) /\ + (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y1 y5 y6 y4 y2 y3) /\ + (!y1 y2 y3 y4 y5 y6. (y3 <= y2) /\ (y5 <= y2) /\ (y6 <= y2) /\ + (y6 <= y3) + ==> + P y1 y2 y3 y4 y5 y6) ==> + (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + GEN_TAC; + DISCH_TAC; + MATCH_MP_TAC REAL_WLOG_DS_LEMMA; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[arith `y3 <= y6 \/ y6 <= y3`;arith `y3 <= y3`]) + ]);; + (* }}} *) +*) + +let WLOG_8673686234 = prove_by_refinement( + `(!y1 y2 y3 y4 y5 y6. + y3 <= y2 /\ y5 <= y2 /\ y6 <= y2 ==> + ineq [ + (sqrt8,y1,#3.0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (sqrt8,y4,&4 * h0); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) + ] + ((y2 + y3 + y5 + y6 - #7.99 > #2.75 * (y1 - sqrt8)) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ + (y4 < y1))) ==> (!y1 y2 y3 y4 y5 y6. ineq [ + (sqrt8,y1,#3.0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (sqrt8,y4,&4 * h0); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) + ] + ((y2 + y3 + y5 + y6 - #7.99 > #2.75 * (y1 - sqrt8)) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ + (y4 < y1)))`, + (* {{{ proof *) + [ + DISCH_TAC; + MATCH_MP_TAC REAL_WLOG_DS_LEMMA; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM kill; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Sphere.ineq]; + REWRITE_TAC[Merge_ineq.delta_y_sym]; + BY(REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Sphere.ineq]; + TYPIFY `delta_y y1 y5 y6 y4 y2 y3 = delta_y y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* Prove "8673686234" using inequalities +"6170936724", "8673686234 a", "8673686234 b", "8673686234 c" *) + +let LEMMA_8673686234 = prove_by_refinement( + ` +(!y1 y2 y3 y4 y5 y6. ineq [ + (&3,y1,&3); + (&2,y2,#2.52); + (&2,y3,#2.52); + (sqrt8,y4,&4 * h0); + (&2,y5,#2.52); + (&2,y6,#2.52) + ] + ( y_of_x delta_x1 y1 y2 y3 y4 y5 y6 < &0)) /\ + +(!y1 y2 y3 y4 y5 y6. ineq [ + (sqrt8,y1,#3.0); + (&2,y2,#2.07); + (&2,y3,#2.07); + (sqrt8,y4,&4 * h0); + (&2,y5,#2.07); + (&2,y6,#2.07) + ] + ((y2 + y3 + y5 + y6 - #7.99 - #0.00385 * delta_y y1 y2 y3 y4 y5 y6 > #2.75 * ((y1 + y4)/ &2 - sqrt8)) + ) ) /\ + +(!y1 y2 y3 y4 y5 y6. ineq [ + (sqrt8,y1,#3.0); + (#2.07,y2,&2 * h0); + (&2,y3,&2 * h0); + (#3.0,y4,#3.0); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) + ] + ((y2 + y3 + y5 + y6 - #7.99 > #2.75 * (y1 - sqrt8)) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) ) ) /\ + +(!y1 y2 y3 y4 y5 y6. ineq [ + (sqrt8,y1,#3.0); + (#2.07,y2,&2 * h0); + (&2,y3,&2 * h0); + (sqrt8,y4,#3.0); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) + ] + ((y2 + y3 + y5 + y6 - #7.99 > #2.75 * ((y1 + y4)/ &2 - sqrt8)) \/ + (y2 + y3 + y5 + y6 - #7.99 - #0.00385 * delta_y y1 y2 y3 y4 y5 y6 > #2.75 * ((y1 + y4)/ &2 - sqrt8)) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) ) ) +==> (!y1 y2 y3 y4 y5 y6. ineq [ + (sqrt8,y1,#3.0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (sqrt8,y4,&4 * h0); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) + ] + ((y2 + y3 + y5 + y6 - #7.99 > #2.75 * (y1 - sqrt8)) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ + (y4 < y1)) ) + +`, + (* {{{ proof *) + [ + DISCH_TAC; + MATCH_MP_TAC WLOG_8673686234; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `delta_y` MP_TAC THEN REPEAT WEAKER_STRIP_TAC; + COMMENT "case a"; + ASM_CASES_TAC `y2 <= #2.07`; + FIRST_X_ASSUM_ST `&2,y2,#2.07` MP_TAC; + DISCH_THEN (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]); + REWRITE_TAC[Sphere.ineq]; + REPEAT (FIRST_X_ASSUM_ST `y <= y2` MP_TAC); + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `&2,y2,#2.07` kill; + COMMENT "case c"; + ASM_CASES_TAC `y4 <= #3.0`; + FIRST_X_ASSUM_ST `ineq` MP_TAC; + DISCH_THEN (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]); + REWRITE_TAC[Sphere.ineq]; + REPEAT (FIRST_X_ASSUM_ST `y <= y2` MP_TAC); + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `ineq` kill; + COMMENT "case b"; + ASM_CASES_TAC `delta_y y1 y2 y3 y4 y5 y6 < &0`; + BY(ASM_REWRITE_TAC[Sphere.ineq]); + ASM_CASES_TAC `y4 < y1`; + BY(ASM_REWRITE_TAC[Sphere.ineq]); + ASM_REWRITE_TAC[]; + COMMENT "ups"; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `&0 < ups_x (y1*y1) (y2*y2) (y6*y6)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Merge_ineq.UPS_X_POS; + REPLICATE_TAC 14 (FIRST_X_ASSUM MP_TAC); + MP_TAC Flyspeck_constants.bounds; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + TYPIFY `&0 < ups_x (y1*y1) (y3*y3) (y5*y5)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Merge_ineq.UPS_X_POS; + REPLICATE_TAC 14 (FIRST_X_ASSUM MP_TAC); + MP_TAC Flyspeck_constants.bounds; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + COMMENT "construct y4'"; + TYPIFY `?y4'. y4 <= y4' /\ delta_y y1 y2 y3 y4' y5 y6 = &0` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC delta_y_root_exists; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + MP_TAC Flyspeck_constants.bounds; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC IVT_delta_y_full [`#3.0`;`y4'`;`#2.07`;`y2`;`&2`;`y6`;`y1`;`&2`;`y5`;`&2`;`y3`]; + ASM_REWRITE_TAC[arith `&0 <= #3.0 /\ &0 <= #2.07 /\ &0 <= &2`]; + ANTS_TAC; + FIRST_X_ASSUM_ST `ineq` kill; + TYPIFY_GOAL_THEN `(!y2' y3' y5' y6'. #2.07 <= y2' /\ y2' <= y2 /\ &2 <= y3' /\ y3' <= y6 /\ &2 <= y5' /\ y5' <= y5 /\ &2 <= y6' /\ y6' <= y3 ==> y_of_x delta_x1 #3.0 y2' y3' y1 y5' y6' < &0)` (unlist REWRITE_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`#3.0`;`y2'`;`y3'`;`y1`;`y5'`;`y6'`]); + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + TYPIFY `delta_y y4' y2 y6 y1 y5 y3 = delta_y y1 y2 y3 y4' y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `ineq` kill; + CONJ_TAC; + BY(ASM_TAC THEN MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Merge_ineq.UPS_X_POS; + ASM_REWRITE_TAC[]; + BY(MP_TAC Flyspeck_constants.bounds THEN ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Merge_ineq.UPS_X_POS; + ASM_REWRITE_TAC[]; + BY(MP_TAC Flyspeck_constants.bounds THEN ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + DISCH_THEN DISJ_CASES_TAC; + FIRST_X_ASSUM (X_CHOOSE_THEN `y2':real` ASSUME_TAC); + FIRST_X_ASSUM (X_CHOOSE_THEN `y6':real` ASSUME_TAC); + FIRST_X_ASSUM (X_CHOOSE_THEN `y5':real` ASSUME_TAC); + FIRST_X_ASSUM (X_CHOOSE_THEN `y3':real` ASSUME_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`y1`;`y2'`;`y3'`;`#3.0`;`y5'`;`y6'`]); + ASM_REWRITE_TAC[Sphere.ineq;arith `~(&0 < &0)`;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + TYPIFY `delta_y y1 y2' y3' #3.0 y5' y6' = delta_y #3.0 y2' y6' y1 y5' y3'` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(MP_TAC Flyspeck_constants.bounds THEN ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + COMMENT "second case: long diags"; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `delta_y` MP_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Sphere.delta_y;arith `&2 * &2 = &4`]; + TYPED_ABBREV_TAC `u = y1' * y1' - &9` ; + TYPIFY `y1' * y1' = &9 + u` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + TYPED_ABBREV_TAC `v = y1 * y1 - &8` ; + TYPIFY `y1 * y1 = &8 + v` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + TYPIFY `&0 <= u` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "u"; + REWRITE_TAC[arith `&0 <= x - &9 <=> &3 * &3 <= x`]; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + BY(FIRST_X_ASSUM_ST `#3.0` MP_TAC THEN REAL_ARITH_TAC); + TYPIFY `&0 <= v` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "v"; + TYPIFY_GOAL_THEN `!x. &0 <= x - &8 <=> sqrt8 * sqrt8 <= x` (unlist REWRITE_TAC); + REWRITE_TAC[Nonlinear_lemma.sqrt8_2]; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + REPLICATE_TAC 3 (FIRST_X_ASSUM_ST `sqrt8` MP_TAC); + BY(MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC); + MATCH_MP_TAC (arith `&0 < -- x ==> ~(x = &0)`); + TYPIFY `-- delta_x (&9 + u) (#2.07 * #2.07) (&4) (&8 + v) (&4) (&4) = #51.81187204 + #77.7208*u + &8* u pow 2 + #78.4359*v + #17.7151*u*v + u pow 2 *v + &9*v pow 2 + u* v pow 2` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[Sphere.delta_x]; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC (arith `&0 < x /\ &0 <= y ==> &0 < x + y`); + CONJ_TAC; + BY(REAL_ARITH_TAC); + REWRITE_TAC[arith `v pow 2 = v*v`]; + REPEAT (GMATCH_SIMP_TAC (arith `&0 <= x /\ &0 <= y ==> &0 <= x + y`)); + GMATCH_SIMP_TAC REAL_LE_MUL; + REPEAT (GMATCH_SIMP_TAC REAL_LE_MUL); + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let WLOG_5691615370 = prove_by_refinement( + `(!y1 y2 y3 y4 y5 y6. ineq + [ + (#3.0,y1,#3.0); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.0,y4,#3.0); + (&2,y5,#2.52); + (&2,y6,#2.52) + ] + ((delta_y y1 y2 y3 y4 y5 y6 < &0) \/ (y2 + y3 + y5 + y6 > #8.472) \/ + (y2 < y3) \/ (y2 < y5) \/ (y2 < y6 ) \/ (y3 < y6))) ==> + (!y1 y2 y3 y4 y5 y6. ineq + [ + (#3.0,y1,#3.0); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.0,y4,#3.0); + (&2,y5,#2.52); + (&2,y6,#2.52) + ] + ((delta_y y1 y2 y3 y4 y5 y6 < &0) \/ (y2 + y3 + y5 + y6 > #8.472)))`, + (* {{{ proof *) + [ + ONCE_REWRITE_TAC[MESON[] `!P. (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6) <=> (!y2 y3 y5 y6 y1 y4. P y1 y2 y3 y4 y5 y6)`]; + DISCH_TAC; + MATCH_MP_TAC Terminal.REAL_WLOG_SQUARE2_LEMMA; + CONJ_TAC; + REPEAT GEN_TAC; + REWRITE_TAC[Sphere.ineq;Merge_ineq.delta_y_sym]; + TYPIFY `delta_y y1 y5 y6 y4 y2 y2' = delta_y y1 y2 y2' y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + REWRITE_TAC[REAL_ADD_AC]; + BY(MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Sphere.ineq]; + RULE_ASSUM_TAC (REWRITE_RULE[Sphere.ineq]); + BY(ASM_MESON_TAC[arith `x <= y ==> ~(y < x)`]) + ]);; + (* }}} *) + + +(* Use 5584033259 and 6170936724 and 5691615370 to prove the lemma. *) + +let LEMMA_5691615370 = prove_by_refinement( + ` +(!y1 y2 y3 y4 y5 y6. ineq [ + (&3,y1,&4 * h0); + (&2,y2,#2.472); + (&2,y3,#2.472); + (&3,y4,&4 * h0); + (&2,y5,#2.472); + (&2,y6,#2.472) + ] + ( y1 < &4 \/ delta_y y1 y2 y3 y4 y5 y6 < &0 )) /\ + + (!y1 y2 y3 y4 y5 y6. ineq [ + (&3,y1,&3); + (&2,y2,#2.52); + (&2,y3,#2.52); + (sqrt8,y4,&4 * h0); + (&2,y5,#2.52); + (&2,y6,#2.52) + ] + ( y_of_x delta_x1 y1 y2 y3 y4 y5 y6 < &0)) /\ + +(!y1 y2 y3 y4 y5 y6. ineq + [ + (#3.0,y1,#3.0); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.0,y4,#3.0); + (&2,y5,#2.52); + (&2,y6,#2.52) + ] + ((delta_y y1 y2 y3 y4 y5 y6 < &0) \/ (y2 + y3 + y5 + y6 > #8.472) \/ + (y2 < y3) \/ (y2 < y5) \/ (y2 < y6 ) \/ (y3 < y6))) ==> + +(!y1 y2 y3 y4 y5 y6. ineq + [ + (#3.0,y1,&4 * h0); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.0,y4,&4 * h0); + (&2,y5,#2.52); + (&2,y6,#2.52) + ] + ((delta_y y1 y2 y3 y4 y5 y6 < &0) \/ (y2 + y3 + y5 + y6 > #8.472))) + `, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.y_of_x;Functional_equation.nonf_ups_126]; + STRIP_TAC; + FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP WLOG_5691615370)); + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAKER_STRIP_TAC; + ASM_CASES_TAC `delta_y y1 y2 y3 y4 y5 y6 < &0`; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + COMMENT "construct y4'"; + TYPIFY `?y4'. y4 <= y4' /\ delta_y y1 y2 y3 y4' y5 y6 = &0` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC delta_y_root_exists; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + COMMENT "bound 4 on diagonal"; + PROOF_BY_CONTR_TAC; + TYPIFY `y2 <= #2.472 /\ y3 <= #2.472 /\ y5 <= #2.472 /\ y6 <= #2.472` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 14 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `y1 < &4` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `y1 < &4` (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]); + ASM_REWRITE_TAC[Sphere.y_of_x;Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + DISCH_THEN MATCH_MP_TAC; + BY(REPLICATE_TAC 17 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + INTRO_TAC IVT_delta_y_full [`#3.0`;`y4'`;`&2`;`y2`;`&2`;`y6`;`y1`;`&2`;`y5`;`&2`;`y3`]; + ASM_REWRITE_TAC[arith `&0 <= #3.0 /\ &0 <= &2`]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + FIRST_X_ASSUM_ST `ineq` kill; + TYPIFY_GOAL_THEN `(!y2' y3' y5' y6'. &2 <= y2' /\ y2' <= y2 /\ &2 <= y3' /\ y3' <= y6 /\ &2 <= y5' /\ y5' <= y5 /\ &2 <= y6' /\ y6' <= y3 ==> y_of_x delta_x1 #3.0 y2' y3' y1 y5' y6' < &0)` (unlist REWRITE_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`#3.0`;`y2'`;`y3'`;`y1`;`y5'`;`y6'`]); + REWRITE_TAC[Sphere.y_of_x;Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC); + TYPIFY `delta_y y4' y2 y6 y1 y5 y3 = delta_y y1 y2 y3 y4' y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `ineq` kill; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + CONJ_TAC; + GEN_TAC; + X_GEN_TAC `y6':real`; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Merge_ineq.UPS_X_POS; + BY(REPLICATE_TAC 22 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + CONJ_TAC; + GEN_TAC; + X_GEN_TAC `y3':real`; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Merge_ineq.UPS_X_POS; + BY(REPLICATE_TAC 22 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(REPLICATE_TAC 15 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `!z1 z4. #3.0 <= z1 /\ #3.0 <= z4 ==> delta_y z1 (&2) (&2) z4 (&2) (&2) < &0` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[Sphere.delta_y;arith `&2 * &2 = &4`]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `u = z1 * z1 - &9` ; + TYPIFY `z1 * z1 = &9 + u` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + TYPED_ABBREV_TAC `v = z4 * z4 - &9` ; + TYPIFY `z4 * z4 = &9 + v` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + TYPIFY `&0 <= u` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "u"; + REWRITE_TAC[arith `&0 <= x - &9 <=> &3 * &3 <= x`]; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `#3.0` MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `&0 <= v` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "v"; + REWRITE_TAC[arith `&0 <= x - &9 <=> &3 * &3 <= x`]; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `#3.0` MP_TAC) THEN REAL_ARITH_TAC); + MATCH_MP_TAC (arith `&0 < -- x ==> x < &0`); + TYPIFY `-- delta_x (&9 + u) (&4) (&4) (&9 + v) (&4) (&4) = &162 + &99*u + &9*u*u + &99*v + &20*u*v + u*u*v + &9*v*v + u*v*v` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[Sphere.delta_x]; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC (arith `&0 < x /\ &0 <= y ==> &0 < x + y`); + CONJ_TAC; + BY(REAL_ARITH_TAC); + REPEAT (GMATCH_SIMP_TAC (arith `&0 <= x /\ &0 <= y ==> &0 <= x + y`)); + REPEAT (GMATCH_SIMP_TAC REAL_LE_MUL); + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + REWRITE_TAC[DE_MORGAN_THM;NOT_EXISTS_THM]; + CONJ2_TAC; + GEN_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`y1'`;`y1`]); + ASM_REWRITE_TAC[]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + GEN_TAC; + X_GEN_TAC `y6':real`; + GEN_TAC; + X_GEN_TAC `y3':real`; + REWRITE_TAC[GSYM DE_MORGAN_THM]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC IVT_delta_y_full [`#3.0`;`y1`;`&2`;`y2'`;`&2`;`y3'`;`#3.0`;`&2`;`y5'`;`&2`;`y6'`]; + ASM_REWRITE_TAC[arith `&0 <= #3.0 /\ &0 <= &2 /\ &0 < #3.0`]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + FIRST_X_ASSUM_ST `ineq` kill; + TYPIFY_GOAL_THEN `(!y2 y3 y5 y6. &2 <= y2 /\ y2 <= y2' /\ &2 <= y3 /\ y3 <= y3' /\ &2 <= y5 /\ y5 <= y5' /\ &2 <= y6 /\ y6 <= y6' ==> y_of_x delta_x1 #3.0 y2 y3 #3.0 y5 y6 < &0)` (unlist REWRITE_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`#3.0`;`y2''`;`y3''`;`#3.0`;`y5''`;`y6''`]); + REWRITE_TAC[Sphere.y_of_x;Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC); + TYPIFY `delta_y y1 y2' y3' #3.0 y5' y6' = delta_y #3.0 y2' y6' y1 y5' y3'` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `ineq` kill; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Merge_ineq.UPS_X_POS; + BY(REPLICATE_TAC 22 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Merge_ineq.UPS_X_POS; + BY(REPLICATE_TAC 22 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY_GOAL_THEN `~(?y1. #3.0 < y1 /\ delta_y y1 (&2) (&2) #3.0 (&2) (&2) = &0)` (unlist REWRITE_TAC); + REWRITE_TAC[NOT_EXISTS_THM]; + GEN_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`y1'`;`#3.0`]); + BY(REPLICATE_TAC 22 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REWRITE_TAC[NOT_EXISTS_THM]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`#3.0`;`y2''`;`y3''`;`#3.0`;`y5''`;`y6''`]); + ASM_REWRITE_TAC[Sphere.y_of_x;Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + BY(REPLICATE_TAC 37 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + + +end;; diff --git a/text_formalization/local/lunar_deform.hl b/text_formalization/local/lunar_deform.hl new file mode 100644 index 0000000..734b45b --- /dev/null +++ b/text_formalization/local/lunar_deform.hl @@ -0,0 +1,5421 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Local Fan *) +(* Author: Nguyen Quang Truong *) +(* Date: 2013 - 5 - 31 *) +(* ========================================================================== *) + + +(* ================================================================ *) + + + + +module Lunar_deform = struct + + +open Hales_tactic;; +open Localization;; +open Wrgcvdr_cizmrrh;; +open Fan;; +open Fan_defs;; +open Localization;; +open Hypermap;; +open Hypermap_iso;; +open Conforming;; +open Sphere;; + + +(* ================================== *) + + + + +(* +let asms_search0 sths = + let rec immediatesublist l1 l2 = + match (l1,l2) with + [],_ -> true + | _,[] -> false + | (h1::t1,h2::t2) -> h1 = h2 & immediatesublist t1 t2 in + let rec sublist l1 l2 = + match (l1,l2) with + [],_ -> true + | _,[] -> false + | (h1::t1,h2::t2) -> immediatesublist l1 l2 or sublist l1 t2 in + let exists_subterm_satisfying p (n,th) = can (find_term p) (concl th) + and name_contains s (n,th) = sublist (explode s) (explode n) in + let rec filterpred tm = + match tm with + Comb(Var("",_),t) -> not o filterpred t + | Comb(Var("",_),Var(pat,_)) -> name_contains pat + | Comb(Var("",_),pat) -> exists_subterm_satisfying (aconv pat) + | pat -> exists_subterm_satisfying (can (term_match [] pat)) in + fun pats -> + let triv,nontriv = partition is_var pats in + (if triv <> [] then + warn true + ("Ignoring plain variables in search: "^ + end_itlist (fun s t -> s^", "^t) (map (fst o dest_var) triv)) + else ()); + (if nontriv = [] & triv <> [] then [] + else itlist (filter o filterpred) pats sths);; + +let asms_search tms = + let gstk = !current_goalstack in + match gstk with + [] -> [] + | (meta,gl::_,just)::_ + -> let (sths,_) = gl in + map snd (asms_search0 sths tms) + | _ -> failwith "asm_searchs: Invalid goal state";; + +let ASMS_SEARCH_TCL (tms:(term)list) (thstac:(thm)list->tactic) : tactic = + fun (gl:goal) -> + let (sths,tm) = gl in + let ths1 = map snd (asms_search0 sths tms) in + thstac ths1 gl;; + +let ASM_SEARCH_TCL (tms:(term)list) (thstac:thm->tactic) : tactic = + let foo ths = match ths with + [] -> failwith "ASM_SEARCH_TCL: No matching asms found" + | _ -> thstac (hd ths) in + ASMS_SEARCH_TCL tms foo;; + +let ASM_SEARCH_TC = asms_search;; +*) + +let ATTACH thm = MATCH_MP (MESON[]` ! a b. ( a ==> b ) ==> ( a <=> a /\ b )`) thm;; + +let NHANH tm = ONCE_REWRITE_TAC[ ATTACH (SPEC_ALL ( tm ))];; + +let PHA = REWRITE_TAC[ MESON[] ` (a/\b)/\c <=> a/\ b /\ c `; MESON[]` +a ==> b ==> c <=> a /\ b ==> c `];; + +let DOWN_TAC = REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[IMP_IMP] THEN PHA;; + + +let DOWN = FIRST_X_ASSUM MP_TAC;; + +let DOWNS n = REPLICATE_TAC n DOWN THEN PHA;; + +let REMOVE_TAC = FIRST_X_ASSUM MP_TAC THEN MATCH_MP_TAC (TAUT` a ==> b ==> a`);; + + +(* +let types_thm th = let cl = concl th in +List.map dest_var (frees cl );; + +let seans_fn () = +let (tms,tm) = top_goal () in +let vss = map frees (tm::tms) in +let vs = setify (flat vss) in +map dest_var vs;; +*) + + + + +let PAT_REWRITE_TAC tm thms = +(CONV_TAC (PAT_CONV tm (REWRITE_CONV thms )));; + +let FOR_ASM th = +let th1 = REWRITE_RULE[MESON[]` a /\ b ==> c <=> +a ==> b ==> c `] th in +let th2 = SPEC_ALL th1 in UNDISCH_ALL th2;; + +(* change a th having form |- A ==> t to the form A |- t +to get ready to some other commands + + +|- A ==> t +----------- FOR_ASM +A |- t +*) + +let ASSUME_TAC2 = ASSUME_TAC o FOR_ASM;; + + +let PAT_ONCE_REWRITE_TAC tm thms = +(CONV_TAC (PAT_CONV tm (ONCE_REWRITE_CONV thms )));; + +let ASM_PAT_RW_TAC tm thms = EVERY_ASSUM (fun th -> +(CONV_TAC (PAT_CONV tm (ONCE_REWRITE_CONV +( th ::[ thms ] )))));; + +let PAT_TH_TAC tm th = +(CONV_TAC (PAT_CONV tm (REWRITE_CONV[th] )));; + + +let IMP_TO_EQ_RULE th = MATCH_MP (TAUT` (a ==> b ) ==> +( a <=> a /\ b )`) (SPEC_ALL th);; + +let NHANH_PAT tm th = PAT_ONCE_REWRITE_TAC tm +[ IMP_TO_EQ_RULE th ];; + + +let MAKE_FIRST_TAC tm = UNDISCH_TAC tm THEN DISCH_TAC;; + + +(* ---------- BG TEST ------------- *) + + +(* +let rec els L = match L with +[] -> p () +| (x::l) -> e x; els l;; + +let rec bls L = match L with +[] -> p () +| (x::l) -> b (); bls l;; +*) + +(* ============================================= *) + + + +let CONS_IMP_CONTINUOUS_ATREAL = prove_by_refinement(` (! t. t IN real_interval (a,b) ==> f t = (u:real^N) ) +==> (! t. t IN real_interval (a,b) ==> f continuous atreal t ) `, +[REWRITE_TAC[continuous_atreal; real_interval; IN_ELIM_THM]; +REPEAT STRIP_TAC; +EXISTS_TAC` min (b - t ) ( t - a ) ` ; +CONJ_TAC; +REWRITE_TAC[REAL_LT_MIN]; +ASM_REAL_ARITH_TAC; +GEN_TAC; +REWRITE_TAC[REAL_LT_MIN]; +STRIP_TAC; +ASSUME_TAC2 (REAL_ARITH` a < t /\ t < b /\ abs (x' - t) < b - t /\ abs (x' - t) < t - a ==> x' < b /\ a < x' `); +SUBGOAL_THEN ` f (x':real) = (u:real^N) ` MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +ASM_SIMP_TAC[DIST_REFL]]);; + + +let AFF_GT_SUBSET_AFFINE_HULL21 = ISPECL [` {u, v:real^N} `;` {w:real^N } `] AFF_GT_SUBSET_AFFINE_HULL;; + + + +let DISJTINCT_PROPERTY = prove_by_refinement ( +` FINITE V /\ +(f : real^N -> real -> real^N) u continuous atreal (&0) /\ + f u (&0) = u /\ + a < &0 /\ + &0 < b /\ + (!u' t. u' IN V /\ ~(u = u') /\ t IN real_interval (a,b) ==> f u' t = u') + ==> (?e. &0 < e /\ + (!t u'. + --e < t /\ t < e /\ u' IN V /\ ~(u' = u) ==> ~(f u t = f u' t)))`, [ +STRIP_TAC; +SUBGOAL_THEN`!u'. u' IN V /\ ~(u = u') ==> (!t. t IN real_interval (a,b) ==> +(f: real^N -> real -> real^N) u' continuous atreal t )` ASSUME_TAC; +GEN_TAC THEN STRIP_TAC; +MATCH_MP_TAC (GEN`u: real^N ` CONS_IMP_CONTINUOUS_ATREAL); +EXISTS_TAC` u': real^N `; +REPEAT STRIP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +MP_TAC (ISPECL [` &0 `;` u:real^N `;` f: real^N -> real -> real^N `; +` V:real^N -> bool `] (GEN_ALL Local_lemmas1.CONTINUOUS_FUN_DISTINCT_FINITE_SET)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +ANTS_TAC; +CONJ_TAC; +REPEAT STRIP_TAC; +SUBGOAL_THEN` &0 IN real_interval (a,b) ` MP_TAC; +ASM_REWRITE_TAC[real_interval; IN_ELIM_THM]; +ASM_MESON_TAC[]; +GEN_TAC; +REWRITE_TAC[IN_INSERT]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` &0 IN real_interval (a,b) ` MP_TAC; +ASM_REWRITE_TAC[real_interval; IN_ELIM_THM]; +ASM_MESON_TAC[]; + +REWRITE_TAC[REAL_SUB_RZERO; GSYM REAL_BOUNDS_LT]; +MESON_TAC[]]);; + + + + + +let EDGE_FORM_IN_LOCAL_FAN = prove_by_refinement( +` local_fan (V,E,FF) /\ x IN E ==> ? u v. ~( u = v ) /\ {u, v} = x `, +[REWRITE_TAC[local_fan; FAN; graph; IN]; +LET_TAC; STRIP_TAC; FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` x:real^3 -> bool `)); +DOWN; REWRITE_TAC[Local_lemmas1.HAS_SIZE_2_EXISTS2]; MESON_TAC[]]);; + + + + + +let EDGE_IN_LOCAL_FAN_DET_RHO_NODE = prove_by_refinement +(` local_fan (V,E,FF) /\ x IN E ==> (?v. v IN V /\ {v, rho_node1 FF v} = x) `, +[NHANH EDGE_FORM_IN_LOCAL_FAN; +STRIP_TAC; +UNDISCH_TAC` (x:real^3 -> bool) IN E `; +UNDISCH_TAC` local_fan (V,E,FF) `; +PHA; +EXPAND_TAC "x"; +NHANH Local_lemmas.LOFA_IN_E_IMP_IN_FF; +STRIP_TAC; +DOWN; +UNDISCH_TAC` local_fan (V,E,FF) `; +PHA; +NHANH Local_lemmas.DETER_RHO_NODE; +STRIP_TAC; +EXISTS_TAC `u: real^3 `; + +ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_IMP_IN_V; Local_lemmas.DETER_RHO_NODE; INSERT_COMM]; +ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_IMP_IN_V; Local_lemmas.DETER_RHO_NODE; INSERT_COMM]]);; + + + + + +let TOW_POINTS_IN_IMP_AFF_GT_SUBSET = prove_by_refinement +(` DISJOINT {x, u} {v:real^N } /\ +a IN aff_gt {x,u} {v} /\ +b IN aff_gt {x, u} {v} /\ +DISJOINT {x} {a,b} +==> aff_gt {x} {a,b} SUBSET aff_gt {x,u} {v} `, +[NHANH AFF_GT_2_1; +NHANH AFF_GT_1_2; +STRIP_TAC; +UNDISCH_TAC` a IN aff_gt {x, u} {v:real^N }`; +UNDISCH_TAC` b IN aff_gt {x, u} {v:real^N }`; +ASM_REWRITE_TAC[IN_ELIM_THM; SUBSET]; +STRIP_TAC; +STRIP_TAC; +GEN_TAC; +STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[]; +REWRITE_TAC[VECTOR_ARITH` t1'' % x + + + t2'' % (t1' % x + t2' % u + t3' % v) + + t3'' % (t1 % x + t2 % u + t3 % v) = +(t1'' + t2'' * t1' + t3'' * t1 ) % x + (t2'' * t2' + t3'' * t2) % u + +(t2'' * t3' + t3'' * t3 ) % v `]; +STRIP_TAC; +EXISTS_TAC` (t1'' + t2'' * t1' + t3'' * t1:real) `; +EXISTS_TAC` t2'' * t2' + t3'' * t2:real `; +EXISTS_TAC` t2'' * t3' + t3'' * t3 `; +CONJ_TAC; +MATCH_MP_TAC Real_ext.REAL_PROP_POS_ADD2; +ASM_MESON_TAC[REAL_LT_MUL]; +ASM_REWRITE_TAC[]; + +UNDISCH_TAC` t1' + t2' + t3' = &1 `; +UNDISCH_TAC` t1 + t2 + t3 = &1 `; +UNDISCH_TAC` t1'' + t2'' + t3'' = &1 `; +PHA; +CONV_TAC REAL_RING]);; + + + + +let REAL_LT_MUL12 = prove(` &0 < b /\ a < &0 ==> a * b < &0 `, +REWRITE_TAC[REAL_ARITH` a * b < &0 <=> &0 < (-- a) * (b ) `] THEN +STRIP_TAC THEN +MATCH_MP_TAC REAL_LT_MUL THEN +DOWN_TAC THEN +REAL_ARITH_TAC);; + + +let COLL_IN_AFF_GT_INTER_EMPTY = prove_by_refinement +(` ~ collinear {a,b,x: real^N} /\ u IN aff_gt {a,b} {x} ==> +aff_gt {a, b} {x} INTER aff_lt {a} {u} = {} `, +[NHANH Local_lemmas.COLL_IN_AFF_GT_TOO; +NHANH Fan.th3a; +STRIP_TAC; +DOWN; +NHANH (SET_RULE` DISJOINT {a, b} {u} ==> DISJOINT {a} {u} `); +NHANH AFF_LT_1_1; +STRIP_TAC; +UNDISCH_TAC` DISJOINT {a, b} {x: real^N} `; +NHANH AFF_GT_2_1; +STRIP_TAC; +UNDISCH_TAC` u IN aff_gt {a, b} {x: real^N} `; +ASM_REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +REWRITE_TAC[SET_RULE` A INTER B = {} <=> (! x. x IN B ==> ~( x IN A)) `]; +REWRITE_TAC[IN_ELIM_THM]; +GEN_TAC THEN STRIP_TAC; +ASM_REWRITE_TAC[]; + +REWRITE_TAC[Local_lemmas.VECTOR_ADD_LDISTRIB1]; +STRIP_TAC; +SUBGOAL_THEN` (t1' + t2' * t1 ) + (t2' * t2 ) + (t2' * t3) = &1 ` ASSUME_TAC; +ASM_REWRITE_TAC[REAL_RING` (t1' + t2' * t1) + t2' * t2 + t2' * t3 = t1' + t2' * (t1 + t2 + t3 ) `; REAL_ARITH` a * &1 = a `]; +ABBREV_TAC` vv: real^N = t1'' % a + t2'' % b + t3' % x ` ; +SUBGOAL_THEN` (vv: real^N) IN affine hull {a, b, x} ` ASSUME_TAC; +ASM_REWRITE_TAC[AFFINE_HULL_3; IN_ELIM_THM]; +ASM_MESON_TAC[]; +UNDISCH_TAC` ~collinear {a, b, x:real^N} `; +DOWN THEN PHA; +NHANH Collect_geom.lemma11; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPECL [` t1'': real `;` t2'': real `;` t3': real `])); +ANTS_TAC; +ASM_REWRITE_TAC[]; +FIRST_ASSUM (MP_TAC o (SPECL [` (t1': real) + t2' * t1`;`( t2': real ) * t2 `;` (t2': real) * t3 `])); +ANTS_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` t1' % a + (t2' * t1) % a + (t2' * t2) % b + (t2' * t3) % x = (vv: real^N) `; +ASM_REWRITE_TAC[]; +DISCH_THEN (SUBST1_TAC o SYM); +CONV_TAC VECTOR_ARITH; +STRIP_TAC; +STRIP_TAC; +DOWN; +EXPAND_TAC "t3''"; +ASSUME_TAC2 (SPECL [` t2': real `;` t3: real `] (GEN_ALL REAL_LT_MUL12)); +DOWN; +UNDISCH_TAC` &0 < t3' `; +REAL_ARITH_TAC]);; + + + + + + +let HKIRPEP_ALT = prove(` convex_local_fan (V,E,FF) /\ lunar (v,w) V E + ==> (!u. u IN V DIFF {v, w} ==> interior_angle1 (vec 0) FF u = pi) /\ + &0 < interior_angle1 (vec 0) FF v /\ + interior_angle1 (vec 0) FF v <= pi /\ + interior_angle1 (vec 0) FF v = interior_angle1 (vec 0) FF w /\ + (?i j. i + j = CARD V /\ i < CARD V /\ + ~(i = 0) /\ + ~(i = 1) /\ + w = ITER i (rho_node1 FF) v /\ + {ITER l (rho_node1 FF) v | 0 < l /\ l < i} = + aff_gt {vec 0, v} {rho_node1 FF v} INTER V /\ + j < CARD V /\ + ~(j = 0) /\ + ~(j = 1) /\ + v = ITER j (rho_node1 FF) w /\ + {ITER l (rho_node1 FF) w | 0 < l /\ l < j} = + aff_gt {vec 0, v} {ivs_rho_node1 FF v} INTER V) `, +NHANH Local_lemmas.HKIRPEP THEN +STRIP_TAC THEN +UNDISCH_TAC` v = ITER j (rho_node1 FF) w ` THEN +UNDISCH_TAC` w = ITER i (rho_node1 FF) v ` THEN +DISCH_THEN (ASSUME_TAC o SYM) THEN +DISCH_THEN (ASSUME_TAC o SYM) THEN +ASM_REWRITE_TAC[] THEN +EXISTS_TAC` i: num ` THEN +EXISTS_TAC` j:num ` THEN +ASM_REWRITE_TAC[] THEN +MATCH_MP_TAC (GEN_ALL Local_lemmas1.CARD_V_TWO_HAFL_CIRCLE) THEN +EXISTS_TAC` E: (real^3 -> bool) -> bool ` THEN +EXISTS_TAC` FF: real^3 # real^3 -> bool ` THEN +EXISTS_TAC` w:real^3 ` THEN +EXISTS_TAC` v: real^3 ` THEN +ASM_REWRITE_TAC[] THEN +UNDISCH_TAC` convex_local_fan (V,E,FF)` THEN +UNDISCH_TAC ` lunar (v,w:real^3) V E ` THEN +SIMP_TAC[convex_local_fan; lunar; INSERT_SUBSET]);; + + + + + + +let LUNAR_IMP_IN_TWO_HAFLS_PLANE = prove_by_refinement (` convex_local_fan (V,E,FF) /\ lunar (v,w) V E ==> +(! u. u IN V /\ ~( u = v ) /\ ~( u = w) ==> u IN aff_gt {vec 0, v} {rho_node1 FF v} \/ u IN aff_gt {vec 0, v} {ivs_rho_node1 FF v} ) `, +[NHANH HKIRPEP_ALT; +STRIP_TAC; +ASSUME_TAC2 Local_lemmas.CVX_LO_IMP_LO; +SUBGOAL_THEN` lunar (v,w:real^3) V E ` MP_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +REWRITE_TAC[lunar; circular; INSERT_SUBSET]; +STRIP_TAC; +ASSUME_TAC2 (SPEC_ALL Localization.LOFA_IMP_LT_CARD_SET_V_ALT); +GEN_TAC THEN STRIP_TAC; +UNDISCH_TAC` (u:real^3) IN V `; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +ASM_CASES_TAC` n = 0 `; +FIRST_X_ASSUM (SUBST_ALL_TAC); +DOWN; +UNDISCH_TAC` v = ITER j (rho_node1 FF) w `; +UNDISCH_TAC` w = ITER i (rho_node1 FF) v `; +DISCH_THEN (ASSUME_TAC o SYM); +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[ITER]; +ASM_CASES_TAC` n < (i:num) `; +DISJ1_TAC; + +UNDISCH_TAC` v = ITER j (rho_node1 FF) w `; +UNDISCH_TAC` w = ITER i (rho_node1 FF) v `; +DISCH_THEN (ASSUME_TAC o SYM); +DISCH_THEN (ASSUME_TAC o SYM); + + +SUBGOAL_THEN` u IN {ITER l (rho_node1 FF) v | 0 < l /\ l < i} ` MP_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` n: num `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` ~( n = 0) `; +ARITH_TAC; +ASM_SIMP_TAC[IN_INTER]; + +ASM_CASES_TAC` n = (i:num) `; +UNDISCH_TAC` u = ITER n (rho_node1 FF) v `; +UNDISCH_TAC` v = ITER j (rho_node1 FF) w `; +UNDISCH_TAC` w = ITER i (rho_node1 FF) v `; +DISCH_THEN (ASSUME_TAC o SYM); +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; + +DISJ2_TAC; +SUBGOAL_THEN`u IN {ITER l (rho_node1 FF) w | 0 < l /\ l < j} ` MP_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` n - (i:num ) `; + +UNDISCH_TAC` v = ITER j (rho_node1 FF) w `; +UNDISCH_TAC` w = ITER i (rho_node1 FF) v `; +DISCH_THEN (ASSUME_TAC o SYM); +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +EXPAND_TAC "w"; +REWRITE_TAC[ITER_ADD]; +ASSUME_TAC2 (ARITH_RULE` ~( n < i) ==> n - i + i = (n:num ) `); +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (ARITH_RULE` ~(n < i) ==> (n - i < j <=> (n:num) < i + j ) `); +ASM_REWRITE_TAC[ARITH_RULE` 0 < n - i <=> ~( n < i ) /\ ~( n = (i:num)) `]; + +UNDISCH_TAC` v = ITER j (rho_node1 FF) w `; +UNDISCH_TAC` w = ITER i (rho_node1 FF) v `; +DISCH_THEN (ASSUME_TAC o SYM); +DISCH_THEN (ASSUME_TAC o SYM); + +ASM_SIMP_TAC[IN_INTER]]);; + + + + + +let IN_CONV0_IMP_AFF_EQ1 = prove(` a IN conv0 {x, y} ==> aff {a, x} = aff {a, y} `, +NHANH Local_lemmas.IN_CONV0_IMP_AFF_EQ THEN +ONCE_REWRITE_TAC[INSERT_COMM] THEN +NHANH Local_lemmas.IN_CONV0_IMP_AFF_EQ THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +SIMP_TAC[INSERT_COMM]);; + + + + +let AFF_LT_SUBSET_AFF11 = prove_by_refinement ( +` DISJOINT {a} {b} ==> aff_lt {a} {b} SUBSET aff {a,b:real^N} `, +[NHANH AFF_LT_1_1; +SIMP_TAC[Collect_geom.AFF_2POINTS_INTERPRET; SUBSET; IN_ELIM_THM]; +STRIP_TAC; +GEN_TAC; +STRIP_TAC; +EXISTS_TAC` t1: real `; +EXISTS_TAC` t2: real `; +ASM_REWRITE_TAC[]]);; + + + + +let IN_AFF_LT_STILL_NOT_COLLINEAR = prove_by_refinement +(` ~ collinear {x: real^N,y,a} /\ b IN aff_lt {x, y} {a} ==> +~ collinear {x,y,b} `, +[REPEAT STRIP_TAC; +UNDISCH_TAC` b IN aff_lt {x, y} {a: real^N} `; +PHA; +UNDISCH_TAC ` ~collinear {x, y, a: real^N} `; +NHANH Fan.th3a; +NHANH AFF_LT_2_1; +SIMP_TAC[IN_ELIM_THM]; +REPEAT STRIP_TAC; +UNDISCH_TAC` ~collinear {x, y, a:real^N} `; +PHA; +UNDISCH_TAC` collinear {x,y,b:real^N} `; +REWRITE_TAC[Local_lemmas.collinear_fan22; Collect_geom.AFF_2POINTS_INTERPRET; IN_ELIM_THM]; +STRIP_TAC; +DISJ1_TAC; +DOWN; +ASM_REWRITE_TAC[]; +REWRITE_TAC[ +VECTOR_ARITH` t1 % x + t2 % y + t3 % a = ta % x + tb % y <=> t3 % a = (ta - t1) % x + (tb - t2) % y `]; +NHANH_PAT`\x. x ==> y ` (MESON[]` a = b ==> ( &1 / t3) % a = (&1 / t3) % b `); +REWRITE_TAC[Local_lemmas.VECTOR_ADD_LDISTRIB1]; +ASSUME_TAC2 (REAL_FIELD` t3 < &0 ==> &1 / t3 * t3 = &1 `); +ASM_REWRITE_TAC[VECTOR_MUL_LID]; +SIMP_TAC[]; +STRIP_TAC; +EXISTS_TAC` (&1 / t3 * (ta - t1)) `; +EXISTS_TAC` (&1 / t3 * (tb - t2)) `; +ASM_REWRITE_TAC[GSYM REAL_ADD_LDISTRIB; REAL_ARITH` a - x + b - y = (a + b ) - ( x + y )`]; +UNDISCH_TAC`t1 + t2 + t3 = &1 `; +ASM_SIMP_TAC[REAL_ARITH` a + b + c = &1 <=> &1 - ( a + b ) = c `]; + +ASM_REWRITE_TAC[]]);; + + + + + +let AZIM_PI_LEMMA = prove_by_refinement +(` ~(aff_gt {u} s INTER aff_lt {u} {a} = {} ) /\ +aff_gt {u} s SUBSET aff_gt {u, v} {y} /\ +a IN aff_gt {u, v} {x} /\ +~ collinear {u, v, x} /\ +~ collinear {u, v, y} +==> azim u v x y = pi `, +[MP_TAC ( +ISPECL [`{u: real^3} `;` {u, v:real^3} `; `{a: real^3 }`] AFF_LT_MONO_LEFT); +ANTS_TAC; +CONV_TAC SET_RULE; +REPEAT STRIP_TAC; +SUBGOAL_THEN` aff_gt {u,v} {x} = aff_gt {u,v} {a:real^3} ` MP_TAC; +MATCH_MP_TAC Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; +ASM_REWRITE_TAC[]; +DISCH_THEN (ASSUME_TAC o SYM); +ASSUME_TAC2 ( +SET_RULE` ~(aff_gt {u: real^3} s INTER aff_lt {u} {a} = {}) /\ +aff_lt {u} {a} SUBSET aff_lt {u, v} {a} /\ +aff_gt {u} s SUBSET aff_gt {u, v} {y} +==> ~ ( aff_gt {u, v} {y} INTER aff_lt {u, v} {a} = {} ) `); +DOWN; +REWRITE_TAC[SET_RULE` ~( A INTER B = {} ) <=> ? x. x IN A /\ x IN B `]; +STRIP_TAC; +UNDISCH_TAC` x' IN aff_gt {u, v} {y:real^3} `; +UNDISCH_TAC` ~ collinear {u, v, y:real^3} `; +PHA; +NHANH Local_lemmas.COLL_IN_AFF_GT_TOO; +STRIP_TAC; +SUBGOAL_THEN` ~ collinear {u, v, a: real^3} ` ASSUME_TAC; +MATCH_MP_TAC (GEN_ALL Local_lemmas.COLL_IN_AFF_GT_TOO); +EXISTS_TAC` x: real ^3 `; +ASM_REWRITE_TAC[]; + +UNDISCH_TAC` ~collinear {u, v, x' : real^3} `; +UNDISCH_TAC` ~collinear {u, v, a: real^3} `; +PHA; +NHANH AZIM_EQ_PI_ALT; +STRIP_TAC; + + +SUBGOAL_THEN` azim u v a x' = azim u v a y ` MP_TAC; +MATCH_MP_TAC AZIM_EQ_IMP; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM (ASSUME_TAC o SYM); + +STRIP_TAC; +UNDISCH_TAC` x' IN aff_lt {u, v} {a:real^3} `; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` azim u v a y = azim u v x y ` MP_TAC; +ONCE_REWRITE_TAC[ Rogers.AZIM_EQ_SYM]; +MATCH_MP_TAC (* Polar_fan. *) AZIM_EQ_IMP; +ASM_REWRITE_TAC[]; +SIMP_TAC[]]);; + + + + +(* ================================================== *) + + + + + + + + + + +let SUB_LUNAR_DEFORM_LEMMA = prove_by_refinement(` FINITE V /\ convex_local_fan (V,E,FF) /\ lunar (v,w) V E /\ +(! x. x IN E ==> x SUBSET V) /\ +f (u:real^3) (&0 ) = u /\ +f u continuous atreal (&0) /\ +interior_angle1 (vec 0) FF v < pi /\ +a < &0 /\ &0 < b /\ + u IN V /\ + ~(u = v) /\ + ~(u = w) /\ + (!u' t. u' IN V /\ ~(u = u') /\ t IN real_interval (a,b) ==> f u' t = u') /\ + (!t. t IN real_interval (a,b) ==> f u t IN affine hull {vec 0, v, w, u}) + +==> (?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> + lunar (v,w) (IMAGE (\v. f v t) V) + (IMAGE (IMAGE (\v. f v t)) E)))`, +[ +STRIP_TAC; +ASSUME_TAC2 Local_lemmas.HKIRPEP; +DOWN_TAC; +REWRITE_TAC[lunar; circular]; +STRIP_TAC; +SUBGOAL_THEN` ! t. t IN real_interval (a,b) ==> {v, w} SUBSET IMAGE (\v. (f:real^3->real->real^3) v t) V ` ASSUME_TAC; + +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_IMAGE]; +REPEAT STRIP_TAC; +EXISTS_TAC` v:real^3` ; +SUBGOAL_THEN` (v:real^3) IN V ` MP_TAC; +MATCH_MP_TAC (SET_RULE` {v, w:real^3} SUBSET V ==> v IN V`); +FIRST_X_ASSUM ACCEPT_TAC; +SIMP_TAC[]; +FIRST_X_ASSUM (ASSUME_TAC o (SPEC ` &0 `)); +FIRST_X_ASSUM (ASSUME_TAC o (ISPECL[ ` v:real^3`; ` t:real `])); +STRIP_TAC; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +EXISTS_TAC` w:real^3 `; + + + +SUBGOAL_THEN` (w:real^3) IN V ` ASSUME_TAC; +MATCH_MP_TAC (SET_RULE` {v, w} SUBSET V ==> w IN V ` ); +FIRST_X_ASSUM ACCEPT_TAC; +UNDISCH_TAC` w = ITER i (rho_node1 FF) v `; +DISCH_THEN (ASSUME_TAC o GSYM); +ASM_REWRITE_TAC[]; + + + +FIRST_X_ASSUM (ASSUME_TAC o (SPEC ` &0 `)) THEN +FIRST_X_ASSUM (ASSUME_TAC o (SPECL[ ` w:real^3 `; ` t:real `])); + + + +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +FIRST_X_ASSUM MATCH_MP_TAC THEN +ASM_REWRITE_TAC[]; + +ABBREV_TAC` CONCL = ?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> ~(?v w u. + {v, w} IN IMAGE (IMAGE (\v. (f:real^3 -> real -> real^3) v t)) E /\ + u IN IMAGE (\v. f v t) V /\ + ~(aff_gt {vec 0} {v, w} INTER aff_lt {vec 0} {u} = {})) /\ + {v, w} SUBSET IMAGE (\v. f v t) V /\ + ~(v = w) /\ + collinear {vec 0, v, w}) `; + + +MP_TAC (ISPEC`V: real^3 -> bool ` (GEN`V: real^N -> bool ` DISJTINCT_PROPERTY)); + +ANTS_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; + +SUBGOAL_THEN` t IN real_interval (a,b) /\ --e < t /\ t < e + ==> (!v w u'. + {v, w} IN IMAGE (IMAGE (\v. (f:real^3 -> real -> real^3) v t)) E /\ + u' IN IMAGE (\v. f v t) V /\ + ~( f u t IN {u' ,v, w} ) +==> (aff_gt {vec 0} {v, w} INTER aff_lt {vec 0} {u'} = + {})) ` ASSUME_TAC; +REWRITE_TAC[IN_IMAGE]; +REPEAT STRIP_TAC; + +SUBGOAL_THEN` x SUBSET (V:real^3 -> bool ) ` ASSUME_TAC; +FIRST_ASSUM MATCH_MP_TAC; +FIRST_ASSUM ACCEPT_TAC; +ASM_CASES_TAC` (u:real^3) IN x `; +SUBGOAL_THEN` (f:real^3 -> real -> real^3) u t IN {v', w'} ` ASSUME_TAC; +UNDISCH_TAC` {v': real^3, w'} = IMAGE (\v. (f:real^3 -> real -> real^3) v t) x `; +SIMP_TAC[IN_IMAGE]; +STRIP_TAC; + +EXISTS_TAC` u:real^3 `; +ASM_REWRITE_TAC[]; +DOWN; +REPLICATE_TAC 3 DOWN; +SIMP_TAC[IN_INSERT]; +MESON_TAC[]; +SUBGOAL_THEN` t IN real_interval (a, b) ==> IMAGE (\v. (f:real^3 -> real -> real^3) v t ) x = x ` MP_TAC; +STRIP_TAC; +MATCH_MP_TAC Counting_spheres.pad2d3d_dropout_lemma; +EXISTS_TAC` \x. (x:real^3) IN V /\ ~( x = u ) ` ; +CONJ_TAC; +GEN_TAC; +REWRITE_TAC[BETA_THM]; +DOWN THEN DOWN THEN DOWN; +REWRITE_TAC[SUBSET]; +MESON_TAC[]; +GEN_TAC; +REWRITE_TAC[BETA_THM]; +STRIP_TAC; +UNDISCH_TAC` !u' t. u' IN V /\ ~(u = u') /\ t IN real_interval (a,b) ==> (f: real^3 -> real -> real^3) u' t = u' `; +DISCH_THEN MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +DISCH_THEN ASSUME_TAC2; +FIRST_X_ASSUM SUBST_ALL_TAC; + +ASM_CASES_TAC` x' = (u:real^3) `; +FIRST_X_ASSUM SUBST_ALL_TAC; +UNDISCH_TAC` ~((f:real^3 -> real -> real^3 ) u t IN {u', v', w'}) ` ; +ASM_REWRITE_TAC[IN_INSERT]; +SUBGOAL_THEN` (f: real^3 -> real -> real^3) x' t = x' ` MP_TAC; +UNDISCH_TAC` !u' t. u' IN V /\ ~(u = u') /\ t IN real_interval (a,b) ==> (f: real^3 -> real -> real^3 ) u' t = u' ` ; +DISCH_THEN MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +DISCH_THEN SUBST_ALL_TAC; +UNDISCH_TAC` ~(?v w u. + {v, w} IN E /\ + u IN V /\ + ~(aff_gt {vec 0} {v, w: real^3} INTER aff_lt {vec 0} {u} = {})) `; + +UNDISCH_TAC` x': real^3 IN V `; +UNDISCH_TAC` (x: real^3 -> bool) IN E `; +EXPAND_TAC "x'"; +EXPAND_TAC "x"; +MESON_TAC[]; + +ASSUME_TAC2 Local_lemmas.CVX_LO_IMP_LO; +MP_TAC (SPECL [` i:num `;` j:num `] (GENL[` n:num `;` n': num `] Local_lemmas1.CARD_V_TWO_HAFL_CIRCLE)); +ANTS_TAC; +UNDISCH_TAC` w = ITER i (rho_node1 FF) v `; +DISCH_THEN (ASSUME_TAC o SYM); +UNDISCH_TAC` v = ITER j (rho_node1 FF) w `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[SET_RULE` x IN A /\ y IN A <=> {x,y} SUBSET A `]; +STRIP_TAC; +ASSUME_TAC2 (SET_RULE` {v, w:real^3} SUBSET V ==> v IN V `); +ASSUME_TAC2 Localization.LOFA_IMP_LT_CARD_SET_V_ALT; +UNDISCH_TAC` (u:real^3) IN V `; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +UNDISCH_TAC` v = ITER j (rho_node1 FF) w ` ; +DOWN; +DISCH_THEN (ASSUME_TAC o SYM); +DISCH_THEN (ASSUME_TAC o SYM); +UNDISCH_TAC` w = ITER i (rho_node1 FF) v `; +DISCH_THEN (ASSUME_TAC o SYM); +MP_TAC Local_lemmas.AFF_IVS_RHO_NODE_EQQ; +ANTS_TAC; +ASM_REWRITE_TAC[lunar; circular]; +DISCH_THEN (ASSUME_TAC o SYM); +FIRST_X_ASSUM SUBST_ALL_TAC; +SUBGOAL_THEN` u IN aff_gt {vec 0, v} {rho_node1 FF v} \/ u IN aff_gt {vec 0, w} {rho_node1 FF w} ` MP_TAC; + +ASM_CASES_TAC` (n:num) < i ` ; +DISJ1_TAC; +ASM_CASES_TAC` n = 0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +REPLICATE_TAC 4 DOWN THEN PHA; +ASM_REWRITE_TAC[ITER]; +SUBGOAL_THEN` u IN {ITER l (rho_node1 FF) v | 0 < l /\ l < i} ` ASSUME_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` n: num `; +ASM_REWRITE_TAC[]; +DOWN THEN DOWN; +ARITH_TAC; +DOWN; +ASM_SIMP_TAC[IN_INTER]; +ASM_CASES_TAC` (n:num) = i ` ; +FIRST_X_ASSUM SUBST_ALL_TAC; +REPLICATE_TAC 2 DOWN THEN PHA; +ASM_REWRITE_TAC[]; +DISJ2_TAC; +ASSUME_TAC2 (ARITH_RULE` ~( n:num < i) ==> i + ( n - i ) = n`); +SUBGOAL_THEN` u IN {ITER l (rho_node1 FF) w | 0 < l /\ l < j}` MP_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` (n: num) - i `; +EXPAND_TAC "w"; +ASM_REWRITE_TAC[ITER_ADD; ADD_SYM]; +REPLICATE_TAC 3 DOWN THEN PHA; +SIMP_TAC[ (ARITH_RULE` ~((n:num) < i) ==> ( n - i < j <=> n < i + j ) `)]; +ASM_REWRITE_TAC[]; +ARITH_TAC; +ASM_SIMP_TAC[IN_INTER]; + +ASSUME_TAC2 (SET_RULE` {v, w:real^3} SUBSET V ==> w IN V `); +MP_TAC (SPEC` w:real^3 ` Local_lemmas.LOFA_IMP_LT_CARD_SET_V); +ANTS_TAC; +ASM_SIMP_TAC[SET_RULE` {a,b} SUBSET V ==> b IN V `]; +STRIP_TAC; +SUBGOAL_THEN` u IN {ITER n (rho_node1 FF) v | n < CARD (V:real^3 -> bool)} ` ASSUME_TAC; +EXPAND_TAC "u"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` n:num `; +ASM_REWRITE_TAC[]; +DOWN; +ASM_REWRITE_TAC[]; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; + +DOWN; +DISCH_THEN (ASSUME_TAC o SYM); + +DOWN_TAC; +REWRITE_TAC[TAUT` a /\ b /\ c <=> (a /\ b) /\ c `]; +SPEC_TAC (`n':num `,` n': num ` ); +SPEC_TAC (`n:num `,` n: num ` ); + +SPEC_TAC (`v:real^3 `, ` v:real^3 `); +SPEC_TAC (`i: num `,` i:num ` ); +SPEC_TAC (`w:real^3 `, ` w:real^3 `); +SPEC_TAC (`j: num `,` j:num ` ); + + + + +MATCH_MP_TAC ( +MESON[]` (! j w i v n n'. P j w i v n n' ==> P i v j w n' n) /\ (! j w i v n n'. P j w i v n n' /\ u IN Q v ==> concl ) ==> +(! j w i v n n'. P j w i v n n'/\ (u IN Q v \/ u IN Q w ) ==> concl )`); +CONJ_TAC; +SIMP_TAC[]; +SIMP_TAC[INSERT_COMM; ADD_SYM]; +REPEAT GEN_TAC; +STRIP_TAC; +CONJ_TAC; +UNDISCH_TAC` interior_angle1 (vec 0) FF v = interior_angle1 (vec 0) FF w ` ; +DISCH_THEN (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[]; +UNDISCH_TAC`(?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> ((~(?v w u. + ({v, w} IN IMAGE (IMAGE (\v. f v t)) E /\ + u IN IMAGE (\v. f v t) V) /\ + ~(aff_gt {vec 0} {v, w} INTER aff_lt {vec 0} {u} = + {})) /\ + {v, w} SUBSET IMAGE (\v. (f:real^3 -> real -> real^3) v t) V) /\ + ~(v = w)) /\ + collinear {v, w, vec 0})) <=> + CONCL`; +ASM_REWRITE_TAC[]; +PHA; +REPEAT STRIP_TAC; + + + + + +(* ==================================== + +prove_by_refinement (`FINITE V /\ + convex_local_fan (V,E,FF) /\ + ~(?v w u. + {v, w} IN E /\ + u IN V /\ + ~(aff_gt {vec 0} {v, w} INTER aff_lt {vec 0} {u} = {})) /\ + {v, w} SUBSET V /\ + ~(v = w) /\ + collinear {vec 0, v, w} /\ + (!x. x IN E ==> x SUBSET V) /\ + f u (&0) = u /\ + f u continuous atreal (&0) /\ + interior_angle1 (vec 0) FF v < pi /\ + a < &0 /\ + &0 < b /\ + ~(u = v) /\ + ~(u = w) /\ + (!u' t. u' IN V /\ ~(u = u') /\ t IN real_interval (a,b) ==> f u' t = u') /\ + (!t. t IN real_interval (a,b) ==> f u t IN affine hull {vec 0, v, w, u}) /\ + (!u. u IN V DIFF {v, w} ==> interior_angle1 (vec 0) FF u = pi) /\ + &0 < interior_angle1 (vec 0) FF v /\ + interior_angle1 (vec 0) FF v <= pi /\ + interior_angle1 (vec 0) FF v = interior_angle1 (vec 0) FF w /\ + i < CARD V /\ + ~(i = 0) /\ + ~(i = 1) /\ + {ITER l (rho_node1 FF) v | 0 < l /\ l < i} = + aff_gt {vec 0, v} {rho_node1 FF v} INTER V /\ + j < CARD V /\ + ~(j = 0) /\ + ~(j = 1) /\ + {ITER l (rho_node1 FF) w | 0 < l /\ l < j} = + aff_gt {vec 0, w} {rho_node1 FF w} INTER V /\ + (!t. t IN real_interval (a,b) ==> {v, w} SUBSET IMAGE (\v. f v t) V) /\ + ((?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> ~(?v w u. + {v, w} IN IMAGE (IMAGE (\v. f v t)) E /\ + u IN IMAGE (\v. f v t) V /\ + ~(aff_gt {vec 0} {v, w} INTER aff_lt {vec 0} {u} = {})) /\ + {v, w} SUBSET IMAGE (\v. f v t) V /\ + ~(v = w) /\ + collinear {vec 0, v, w})) <=> + CONCL) /\ + &0 < e /\ + (!t u'. --e < t /\ t < e /\ u' IN V /\ ~(u' = u) ==> ~(f u t = f u' t)) /\ + (t IN real_interval (a,b) /\ --e < t /\ t < e + ==> (!v w u'. + {v, w} IN IMAGE (IMAGE (\v. f v t)) E /\ + u' IN IMAGE (\v. f v t) V /\ + ~(f u t IN {u', v, w}) + ==> aff_gt {vec 0} {v, w} INTER aff_lt {vec 0} {u'} = {})) /\ + local_fan (V,E,FF) /\ + i + j = CARD V /\ + v IN V /\ + {ITER n (rho_node1 FF) v | n < CARD V} = V /\ + n < CARD V /\ + ITER n (rho_node1 FF) v = u /\ + ITER j (rho_node1 FF) w = v /\ + ITER i (rho_node1 FF) v = w /\ + w IN V /\ + {ITER n (rho_node1 FF) w | n < CARD V} = V /\ + n' < CARD V /\ + ITER n' (rho_node1 FF) w = u /\ + u IN aff_gt {vec 0, v} {rho_node1 FF v} + ==> CONCL`, + + [STRIP_TAC ; + + +================================= *) + + +SUBGOAL_THEN` aff_gt {vec 0, v} {rho_node1 FF v} = aff_gt {vec 0, v} {u} ` MP_TAC; +MATCH_MP_TAC Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2 ; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ABBREV_TAC` u1 = ( (u dot v ) / ( v dot v )) % (v:real^3)`; +ABBREV_TAC` uh = u - (u1:real^3) `; +SUBGOAL_THEN` uh dot (v:real^3) = &0 ` ASSUME_TAC; +EXPAND_TAC "uh"; +EXPAND_TAC "u1"; +REWRITE_TAC[DOT_LSUB; DOT_LMUL]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_V_DIFF; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` v:real^3 ` )); +DOWN; +REWRITE_TAC[GSYM DOT_EQ_0]; +CONV_TAC REAL_FIELD; +SUBGOAL_THEN` (f:real^3 -> real -> real^3) u continuous atreal (&0) ` MP_TAC; +ASM_REWRITE_TAC[]; +REWRITE_TAC[continuous_atreal]; +DISCH_THEN (MP_TAC o (SPEC` norm (uh: real ^3)`)); +ANTS_TAC; +REWRITE_TAC[NORM_POS_LT]; +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +UNDISCH_TAC` (u:real^3) - u1 = vec 0 ` ; +REWRITE_TAC[VECTOR_SUB_EQ]; +EXPAND_TAC "u1"; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_V_DIFF; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` v:real^3 `)); +ASSUME_TAC2 (ISPEC` v:real^3 ` (GEN_ALL Local_lemmas.COLLINEAR_ONCE_VEC_0)); +FIRST_X_ASSUM (MP_TAC o (SPEC` u: real^3 `)); +STRIP_TAC; +STRIP_TAC; +SUBGOAL_THEN` collinear {vec 0, v, u:real^3 } ` MP_TAC; +ASM_REWRITE_TAC[]; +DOWN THEN MESON_TAC[]; +REWRITE_TAC[]; +MATCH_MP_TAC (GEN_ALL Local_lemmas.COLL_IN_AFF_GT_TOO); +EXISTS_TAC` rho_node1 FF v `; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2; +SUBGOAL_THEN` ~ collinear {vec 0, v, u:real^3} ` MP_TAC; +MATCH_MP_TAC (GEN_ALL Local_lemmas.COLL_IN_AFF_GT_TOO); +EXISTS_TAC` rho_node1 FF v `; +ASM_REWRITE_TAC[]; +NHANH Fan.th3a; +NHANH AFF_GT_2_1; +STRIP_TAC; + +SUBGOAL_THEN` (uh: real^3) IN aff_gt {vec 0, v} {u} ` MP_TAC; +ASM_REWRITE_TAC[IN_ELIM_THM]; +EXPAND_TAC "uh"; +EXPAND_TAC "u1"; +EXISTS_TAC` (u dot v) / (v dot (v:real^3))`; +EXISTS_TAC` -- ((u dot v) / (v dot (v:real^3)))`; +EXISTS_TAC` &1 `; +CONJ_TAC; +REAL_ARITH_TAC; +CONJ_TAC; +REAL_ARITH_TAC; +CONV_TAC VECTOR_ARITH; + +UNDISCH_TAC` ~collinear {vec 0, v, (u:real^3)}`; +PHA; +NHANH Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; +STRIP_TAC; +MP_TAC (ISPEC` {vec 0, v, u:real^3} ` Qzksykg.SET_SUBSET_AFFINE_HULL); +ASSUME_TAC (ISPECL [` vec 0: real^3`;`u:real^3`] (GENL [` u:real^N `;` w:real^N `] AFF_GT_SUBSET_AFFINE_HULL21)); + +SUBGOAL_THEN` {vec 0, v , uh:real^3} SUBSET affine hull {vec 0, v, u}` MP_TAC; +MP_TAC (ISPEC` {vec 0, v, u:real^3} ` Qzksykg.SET_SUBSET_AFFINE_HULL); +SIMP_TAC[INSERT_SUBSET]; +STRIP_TAC; +UNDISCH_TAC` aff_gt {vec 0, v} {u} SUBSET affine hull ({vec 0, v} UNION {u:real^3}) ` ; +REWRITE_TAC[SET_RULE` {a,b} UNION {c} = {a,b,c} `; SUBSET]; +DISCH_THEN MATCH_MP_TAC; +FIRST_ASSUM ACCEPT_TAC; +REPEAT STRIP_TAC; +UNDISCH_TAC` uh IN aff_gt {vec 0, v} {u:real^3} `; +UNDISCH_TAC` ~collinear {vec 0, v, u:real^3} `; +PHA; +NHANH Local_lemmas.COLL_IN_AFF_GT_TOO; +STRIP_TAC; +DOWN; +UNDISCH_TAC` {vec 0, v, uh} SUBSET affine hull {vec 0, v, u:real^3} `; +PHA; +NHANH Local_lemmas.SUBSET_NOT_COLLINEAR_AFFINE_HULL_EQ; +STRIP_TAC; +SUBGOAL_THEN` affine hull {vec 0, v, w, u:real^3} = affine hull {vec 0, v, u } ` ASSUME_TAC; +MP_TAC (SPECL [` w:real^3 `;` {vec 0, v, u:real^3} `] Marchal_cells_3.AFFINE_HULL_3_INSERT); +ANTS_TAC; + +MP_TAC (ISPECL [` vec 0: real^3 `;` v:real^3 `; ` w:real^3 `] COLLINEAR_3_AFFINE_HULL); +ANTS_TAC; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_V_DIFF; +FIRST_ASSUM MATCH_MP_TAC; +FIRST_ASSUM ACCEPT_TAC; +STRIP_TAC; +SUBGOAL_THEN` collinear {vec 0, v, w:real^3} ` MP_TAC; +ASM_REWRITE_TAC[]; +FIRST_ASSUM SUBST1_TAC; +SPEC_TAC (`w:real^3 `,` w:real^3 `); +REWRITE_TAC[GSYM SUBSET]; +MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA ; +REWRITE_TAC[INSERT_SUBSET; IN_INSERT; EMPTY_SUBSET]; +REWRITE_TAC[INSERT_COMM]; + + + + +SUBGOAL_THEN` ! t. -- d < t /\ t < d /\ t IN real_interval (a,b) ==> f u t IN aff_gt {vec 0, v} {u:real^3} ` ASSUME_TAC; +GEN_TAC THEN STRIP_TAC; +UNDISCH_TAC` !t. t IN real_interval (a,b) ==> f u t IN affine hull {vec 0, v, w, u:real^3} ` ; +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` t':real `)); +DOWN; +ASM_REWRITE_TAC[]; + +REWRITE_TAC[AFFINE_HULL_3; IN_ELIM_THM]; +STRIP_TAC; +ASM_CASES_TAC` w' = &0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +UNDISCH_TAC` !x'. abs (x' - &0) < d ==> dist ((f: real^3 -> real -> real^3) u x',f u (&0)) < norm (uh: real^3) ` ; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPEC` t': real `)); +REWRITE_TAC[REAL_SUB_RZERO; GSYM REAL_BOUNDS_LT]; +DISCH_THEN ASSUME_TAC2; +DOWN; +SUBST_ALL_TAC (VECTOR_ARITH` u - u1 = (uh: real^3) <=> u = uh + u1 `); +ASM_REWRITE_TAC[VECTOR_ARITH` u' % vec 0 + v' % v + &0 % uh = v' % v `]; +EXPAND_TAC "u1"; +REWRITE_TAC[dist; Pack1.norm_ineq_lt; VECTOR_ARITH` a % v - ( u + b % v ) = ( a - b ) % v - u `]; +REWRITE_TAC[DOT_LSUB; DOT_RSUB; DOT_LMUL; DOT_RMUL]; +ABBREV_TAC` con1 = v' - (u dot v) / ((v:real^3) dot v) `; +ASM_REWRITE_TAC[DOT_SYM; Collect_geom.ZERO_NEUTRAL; REAL_ARITH` a - ( &0 - x ) = a + x `]; +MP_TAC (ISPEC` v:real^3 ` DOT_POS_LE); +REWRITE_TAC[REAL_ARITH` a + x < x <=> a < &0 `]; +MP_TAC (SPEC` con1: real` REAL_LE_SQUARE ); +STRIP_TAC; +STRIP_TAC; +ASSUME_TAC2 (SPECL [` con1 * (con1:real)`;` v dot (v:real^3) `] REAL_LE_MUL); +DOWN; +REAL_ARITH_TAC; +ASM_CASES_TAC` w' < &0 `; +UNDISCH_TAC` !x'. abs (x' - &0) < d ==> dist ((f:real^3 -> real -> real^3) u x',f u (&0)) < norm (uh: real^3) `; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPEC` t': real `)); +REWRITE_TAC[REAL_SUB_RZERO; GSYM REAL_BOUNDS_LT]; +DISCH_THEN ASSUME_TAC2; +DOWN; +SUBST_ALL_TAC (VECTOR_ARITH` u - u1 = uh <=> u = uh + (u1: real^3) `); +ASM_REWRITE_TAC[dist]; + + +REWRITE_TAC[Pack1.norm_ineq_lt] ; +EXPAND_TAC "u1" ; +REWRITE_TAC[VECTOR_ARITH` (u' % vec 0 + v' % v + w' % uh) - (uh + uv % v) += (v' - uv ) % v + (w' - &1) % uh `] ; +ABBREV_TAC` con1 = (u dot v) / (v dot (v:real^3)) ` ; +ASM_REWRITE_TAC[DOT_LADD; DOT_RADD; DOT_LMUL; DOT_RMUL; DOT_SYM; Collect_geom.ZERO_NEUTRAL] ; +ASSUME_TAC (ISPEC` v:real^ 3 ` DOT_POS_LE) ; +ASSUME_TAC (SPEC` v' - con1:real ` REAL_LE_SQUARE) ; +ASSUME_TAC (ISPEC` uh:real^ 3 ` DOT_POS_LE) ; +STRIP_TAC ; +MP_TAC (ISPECL [` &1 `;` -- w' + &1 `] Collect_geom.POW2_COND) ; +ANTS_TAC ; +UNDISCH_TAC` w' < &0 ` ; +REAL_ARITH_TAC ; +STRIP_TAC ; +SUBGOAL_THEN` &1 <= -- w' + &1 ` MP_TAC ; +UNDISCH_TAC` w' < &0 ` ; +REAL_ARITH_TAC ; +ASM_REWRITE_TAC[] ; + +REWRITE_TAC[REAL_ARITH` &1 pow 2 <= (--w' + &1) pow 2 <=> &0 <= (w' - &1 ) * (w' - &1 ) - &1 `] ; +STRIP_TAC ; +ASSUME_TAC2 (ISPECL[`(w' - &1) * (w' - &1) - &1 `;` (uh:real^3 ) dot uh `] REAL_LE_MUL) ; +ASSUME_TAC2 (ISPECL[`(v' - con1) * (v' - con1)`;` (v:real^3 ) dot v `] REAL_LE_MUL) ; +UNDISCH_TAC` (v' - con1) * (v' - con1) * ((v:real^3) dot v) + + (w' - &1) * (w' - &1) * (uh dot uh) < + uh dot (uh: real^3) ` ; +DOWN THEN DOWN ; +REAL_ARITH_TAC ; +SUBGOAL_THEN` f u (t': real) IN aff_gt {vec 0, v} {u:real^3} ` MP_TAC ; +UNDISCH_TAC` aff_gt {vec 0, v} {u} = aff_gt {vec 0, v} {uh:real^3} ` ; +DISCH_THEN SUBST1_TAC ; +UNDISCH_TAC` ~collinear {vec 0, v, uh:real^3} ` ; +NHANH Fan.th3a ; +NHANH AFF_GT_2_1 ; +SIMP_TAC[IN_ELIM_THM] ; +STRIP_TAC ; +EXISTS_TAC` u': real ` ; +EXISTS_TAC` v':real ` ; +EXISTS_TAC` w': real ` ; +ASM_REWRITE_TAC[]; + + +UNDISCH_TAC` ~( w' = &0 ) `; +UNDISCH_TAC` ~( w' < &0 ) `; +REAL_ARITH_TAC; + +ASM_REWRITE_TAC[IN_ELIM_THM]; + + +SUBGOAL_THEN` ! t u. abs t < d /\ t IN real_interval (a,b) /\ (u:real^3) IN V ==> f u t IN aff_gt {vec 0, v} {u} ` MP_TAC; +REPEAT STRIP_TAC; +ASM_CASES_TAC` ~(u = u':real^3 )`; +UNDISCH_TAC` !u' t. u' IN V /\ ~(u: real^3 = u') /\ t IN real_interval (a,b) ==> f u' t = u' `; +DISCH_THEN (MP_TAC o (SPECL [` u':real^3 `;` t': real`])); +ANTS_TAC; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +MP_TAC (ISPECL [` {vec 0, v:real^3} `;` {u':real^3} `] (GEN_ALL Local_lemmas.CONV0_SUBSET_AFF_GT)); +SIMP_TAC[Geomdetail.CONV0_SING; INSERT_SUBSET]; +DOWN; + +REWRITE_TAC[]; +DISCH_THEN SUBST_ALL_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[REAL_BOUNDS_LT]; +STRIP_TAC; + + +SUBGOAL_THEN` ! t. abs t < d /\ t IN real_interval (a,b) ==> (! s. s IN IMAGE (IMAGE (\v. f (v:real^3) t)) E ==> aff_gt {vec 0} s SUBSET aff_gt { vec 0, v} {rho_node1 FF v } \/ +aff_gt {vec 0} s SUBSET aff_gt { vec 0, w} {rho_node1 FF w })` MP_TAC; + + + + +REWRITE_TAC[GSYM REAL_BOUNDS_LT]; +PHA; +DOWN; +FIRST_ASSUM NHANH; +STRIP_TAC; +GEN_TAC THEN STRIP_TAC; +GEN_TAC; +REWRITE_TAC[IN_IMAGE]; +STRIP_TAC; +DOWN; +UNDISCH_TAC` local_fan (V,E, FF) `; +PHA; +NHANH EDGE_IN_LOCAL_FAN_DET_RHO_NODE; +STRIP_TAC; +UNDISCH_TAC` (v': real^3) IN V `; +EXPAND_TAC "V"; + + +REWRITE_TAC[IN_ELIM_THM]; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +STRIP_TAC; +ASM_CASES_TAC` n'' < (j:num ) `; +ASM_CASES_TAC` n'' = 0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN THEN DOWN; +REWRITE_TAC[ITER]; +DISCH_THEN (SUBST_ALL_TAC o SYM); +STRIP_TAC; +DISJ2_TAC; +UNDISCH_TAC` !u' t. u' IN V /\ ~(u = u') /\ t IN real_interval (a,b) ==> f u' t = (u': real^3) `; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPECL [` w:real^3 `;` t': real `])); +ANTS_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPECL [` t': real `;` rho_node1 FF w `])); +ANTS_TAC; +ASM_REWRITE_TAC[GSYM REAL_BOUNDS_LT]; +MATCH_MP_TAC Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; +ASM_REWRITE_TAC[]; +MP_TAC Local_lemmas.AFF_GT_SAME_WITH_ENDS; +ANTS_TAC; +ASM_REWRITE_TAC[lunar; circular]; +SIMP_TAC[]; +STRIP_TAC THEN STRIP_TAC; +ASSUME_TAC2 (SPEC`w: real^3 ` (GEN`v: real^3 ` Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2)); +SUBGOAL_THEN` aff_gt {vec 0, w} {rho_node1 FF w} = aff_gt {vec 0, w} { f (rho_node1 FF w) (t':real)} ` MP_TAC; +MATCH_MP_TAC Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; +ASM_REWRITE_TAC[]; +DISCH_THEN (ASSUME_TAC o SYM); + + + +MP_TAC (ISPECL [` {w:real^3} `;` {vec 0, w:real^3} `;` {(f (rho_node1 FF w) (t': real)): real^3 } `] + (GEN_ALL Local_lemmas.AFF_GT_MONO_TRANS)); +ANTS_TAC; +REWRITE_TAC[IN_INSERT; INSERT_SUBSET; EMPTY_SUBSET]; +REWRITE_TAC[SET_RULE` A UNION {a} = a INSERT A `]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_V_DIFF; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` w:real^3 `)); +ASSUME_TAC2 (SET_RULE` ~((w:real^3) = vec 0) ==> {vec 0, w} DIFF {w} = {vec 0} `); +UNDISCH_TAC` s = IMAGE (\v. (f:real^3 -> real -> real^3) v t') x `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_SIMP_TAC[]; + +SUBGOAL_THEN` {w, f (rho_node1 FF w) (t':real)} = s ` MP_TAC; +EXPAND_TAC "s"; +EXPAND_TAC "x"; +REWRITE_TAC[EXTENSION; IN_IMAGE]; +GEN_TAC; +EQ_TAC; +REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY]; +STRIP_TAC; +EXISTS_TAC `w:real^3 `; +ASM_REWRITE_TAC[]; + +EXISTS_TAC` rho_node1 FF w `; +ASM_REWRITE_TAC[]; +REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY]; +STRIP_TAC; +DISJ1_TAC; +ASM_REWRITE_TAC[]; +DISJ2_TAC; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; + + + +ASM_CASES_TAC` n'' = j - 1 `; +ASSUME_TAC2 (ARITH_RULE` ~( j = 0 ) ==> j - 1 + 1 = j`); +SUBGOAL_THEN` rho_node1 FF v' = v ` MP_TAC; +EXPAND_TAC "v'"; +UNDISCH_TAC` n'' = j - 1 `; +SIMP_TAC[GSYM ITER; ADD1]; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` v' IN {ITER l (rho_node1 FF) w | 0 < l /\ l < j} ` MP_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` n'':num `; +ASM_REWRITE_TAC[ARITH_RULE` 0 < n <=> ~( n = 0) `]; +ASM_REWRITE_TAC[]; +STRIP_TAC; +DISJ2_TAC; +DOWN; +ASM_REWRITE_TAC[]; +REWRITE_TAC[IN_INTER]; +STRIP_TAC; + + + + + + + +SUBGOAL_THEN` IMAGE (\v. f v t') x = { f (v':real^3) (t':real), v:real^3} ` MP_TAC; +REWRITE_TAC[EXTENSION]; +GEN_TAC; +EQ_TAC; +EXPAND_TAC "x"; +REWRITE_TAC[IN_IMAGE; IN_INSERT; NOT_IN_EMPTY]; +STRIP_TAC; +ASM_REWRITE_TAC[]; + + +ASM_REWRITE_TAC[]; +DISJ2_TAC; + +UNDISCH_TAC` !u' t. u' IN V /\ ~(u = u') /\ t IN real_interval (a,b) ==> f u' t = (u': real^3) `; +DISCH_TAC; +FIRST_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; + +EXPAND_TAC "x"; +REWRITE_TAC[IN_IMAGE; IN_INSERT; NOT_IN_EMPTY]; +STRIP_TAC; +EXISTS_TAC `v': real^3 `; +ASM_REWRITE_TAC[]; +EXISTS_TAC` v: real^3 `; +ASM_REWRITE_TAC[]; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +FIRST_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +STRIP_TAC; + +FIRST_ASSUM (MP_TAC o (SPECL [` t': real`;` v': real^3 `])); +ANTS_TAC; +ASM_REWRITE_TAC[GSYM REAL_BOUNDS_LT]; +STRIP_TAC; +MP_TAC (ISPECL [` {v:real^3 } `; `{ vec 0, v:real^3 } `; +` { (f: real^3 -> real -> real^3) v' t' } `] (GEN_ALL Local_lemmas.AFF_GT_MONO_TRANS)); +ANTS_TAC; +REWRITE_TAC[IN_INSERT; INSERT_SUBSET; EMPTY_SUBSET]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_V_DIFF; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` v:real^3 `)); +ASSUME_TAC2 ( +SET_RULE` ~((v:real^3) = vec 0 ) ==> {vec 0, v} DIFF {v} = {vec 0 } `); +ASM_REWRITE_TAC[SET_RULE` {a} UNION {b} = {a,b} `]; + +MP_TAC Local_lemmas.LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI; +ANTS_TAC; +ASM_REWRITE_TAC[lunar; circular]; +STRIP_TAC; + +ASSUME_TAC2 ( +SPEC` w:real^3 ` (GEN` v:real^3 ` Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2)); + +MP_TAC (GSYM Local_lemmas.AFF_GT_SAME_WITH_ENDS); +ANTS_TAC; +ASM_REWRITE_TAC[lunar; circular]; + +STRIP_TAC; +SUBGOAL_THEN` lunar (v,w:real^3) V E ` ASSUME_TAC; +ASM_REWRITE_TAC[lunar; circular]; +ASSUME_TAC2 Local_lemmas.NOT_COLL_RHONODE_SND_POINT; +UNDISCH_TAC` v' IN aff_gt {vec 0, w} {rho_node1 FF w} `; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` ~ collinear {vec 0, v, v':real^3 } ` MP_TAC; +MATCH_MP_TAC (GEN_ALL Local_lemmas.COLL_IN_AFF_GT_TOO); +EXISTS_TAC` rho_node1 FF w `; +ASM_REWRITE_TAC[]; +STRIP_TAC; + +STRIP_TAC; +UNDISCH_TAC` v' IN aff_gt {vec 0, v} {rho_node1 FF w} `; +UNDISCH_TAC` ~collinear {vec 0, v, rho_node1 FF w} `; +PHA; +NHANH Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; +STRIP_TAC; +SUBGOAL_THEN` aff_gt {vec 0, v} {f v' (t':real)} = aff_gt {vec 0, v} {v': real^3}` ASSUME_TAC; +MATCH_MP_TAC (GSYM Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ); +ASM_REWRITE_TAC[]; +UNDISCH_TAC` aff_gt {vec 0} {f v' t', v} SUBSET aff_gt {vec 0, v} {(f: real^3 -> real -> real^3) v' t'} `; +ASM_REWRITE_TAC[]; + + + +SUBGOAL_THEN` lunar (v, (w:real^3)) V E` ASSUME_TAC; +ASM_REWRITE_TAC[lunar; circular]; + +SUBGOAL_THEN` v' IN {ITER l (rho_node1 FF) w | 0 < l /\ l < j} /\ +rho_node1 FF v' IN {ITER l (rho_node1 FF) w | 0 < l /\ l < j} ` MP_TAC; +EXPAND_TAC "v'"; +REWRITE_TAC[IN_ELIM_THM]; +CONJ_TAC; +EXISTS_TAC`n'': num `; +ASM_REWRITE_TAC[ARITH_RULE` 0 < n <=> ~( n = 0) `]; +EXISTS_TAC` n'' + 1 `; +REWRITE_TAC[GSYM ITER; ADD1; ARITH_RULE` 0 < a + 1 `]; +MATCH_MP_TAC (ARITH_RULE` n'' < j /\ ~(n'' = j - 1) +==> n'' + 1 < j `); +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[]; +UNDISCH_TAC` aff_gt {vec 0, v} {u: real^3} = + {y | ?t1 t2 t3. + &0 < t3 /\ + t1 + t2 + t3 = &1 /\ + y = t1 % vec 0 + t2 % v + t3 % u} `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[IN_INTER]; +STRIP_TAC; +DISJ2_TAC; +EXPAND_TAC "x"; +REWRITE_TAC[IMAGE_CLAUSES]; + +ASSUME_TAC2 ( +SPEC` w:real^3 ` (GEN` v: real^3 ` Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2)); +SUBGOAL_THEN` aff_gt {vec 0, w} {rho_node1 FF w } = aff_gt { vec 0, w} {v'} ` ASSUME_TAC; +MATCH_MP_TAC Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` aff_gt {vec 0, w} {rho_node1 FF w } = aff_gt { vec 0, w} {rho_node1 FF v'} ` ASSUME_TAC; +MATCH_MP_TAC Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; +ASM_REWRITE_TAC[]; +DOWN; +DOWN; +ASSUME_TAC2 (GSYM Local_lemmas.AFF_GT_SAME_WITH_ENDS); +ASSUME_TAC2 Local_lemmas.NOT_COLL_RHONODE_SND_POINT; +UNDISCH_TAC` v' IN aff_gt {vec 0, w} {rho_node1 FF w} `; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` aff_gt {vec 0, v} {rho_node1 FF w} = aff_gt {vec 0, v} {v'} ` ASSUME_TAC; +MATCH_MP_TAC Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; +ASM_REWRITE_TAC[]; + + +SUBGOAL_THEN` f (v':real^3) (t': real) IN aff_gt {vec 0, w} {rho_node1 FF w} ` MP_TAC; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[GSYM REAL_BOUNDS_LT]; +SUBGOAL_THEN` f (rho_node1 FF v') (t': real) IN aff_gt {vec 0, w} {rho_node1 FF w} ` MP_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` rho_node1 FF v' IN aff_gt {vec 0, w} {rho_node1 FF w} `; +DOWN; +ASM_REWRITE_TAC[]; +STRIP_TAC; +UNDISCH_TAC` ~collinear {vec 0, v, rho_node1 FF w} `; +PHA; +NHANH Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; +ASM_SIMP_TAC[]; +STRIP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[GSYM REAL_BOUNDS_LT]; +REPEAT STRIP_TAC; + +ASSUME_TAC2 ( +let tt = GEN_ALL Local_lemmas.COLL_IN_AFF_GT_TOO in +ISPECL [` rho_node1 FF w` ;` vec 0: real^3 `;` w:real^3 `; +` (f:real^3 -> real -> real^3) v' t' `] tt); +ASSUME_TAC2 ( +let tt = GEN_ALL Local_lemmas.COLL_IN_AFF_GT_TOO in +ISPECL [` rho_node1 FF w` ;` vec 0: real^3 `;` w:real^3 `; +` (f:real^3 -> real -> real^3) (rho_node1 FF v') t' `] tt); +DOWN THEN DOWN; +NHANH Fan.th3b1; +PHA; +NHANH (SET_RULE` ~( a = x ) /\ t /\ ~( a = y ) ==> DISJOINT {a} {x,y} `); +STRIP_TAC; +UNDISCH_TAC` ~collinear {vec 0, v, rho_node1 FF w} `; +NHANH Fan.th3a; +STRIP_TAC; +MATCH_MP_TAC TOW_POINTS_IN_IMP_AFF_GT_SUBSET; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` (f: real^3 -> real -> real^3) v' t' IN aff_gt {vec 0, w} {rho_node1 FF w} `; +UNDISCH_TAC` (f: real^3 -> real -> real^3) (rho_node1 FF v') t' IN aff_gt {vec 0, w} {rho_node1 FF w} `; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; + +ASM_CASES_TAC` n'' = (j:num) ` ; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN THEN DOWN; +ASM_REWRITE_TAC[]; +EXPAND_TAC "x"; +REWRITE_TAC[IMAGE_CLAUSES]; +DISCH_THEN (SUBST_ALL_TAC o SYM); +STRIP_TAC; +SUBGOAL_THEN` (f:real^3 -> real -> real^3) v t' = v ` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[]; + + +MP_TAC ( +let tt = GEN_ALL Local_lemmas.AFF_GT_MONO_TRANS in +ISPECL [` {v:real^3 } `; `{vec 0, v:real^3} ` ;` { (f: real^3 -> real -> real^3) (rho_node1 FF v) t' }` ] tt); +ANTS_TAC; +REWRITE_TAC[INSERT_SUBSET; IN_INSERT; EMPTY_SUBSET]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_V_DIFF; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` v: real^3 `)); +ASSUME_TAC2 (SET_RULE` ~( v = vec 0) ==> {vec 0, v} DIFF {v} = {vec 0: real^3 }`); +ASM_REWRITE_TAC[SET_RULE` {a} UNION {b} = {b,a} `]; +FIRST_ASSUM (MP_TAC o (ISPECL [` t': real `;` rho_node1 FF v `])); +ANTS_TAC; +ASSUME_TAC2 Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + +ASM_REWRITE_TAC[GSYM REAL_BOUNDS_LT]; +STRIP_TAC; +ASSUME_TAC2 ( +let tt = GEN_ALL Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ in +ISPECL [` rho_node1 FF v `;` vec 0: real^3 `;` v:real^3 `;` (f:real^3 -> real -> real^3) (rho_node1 FF v) t' `] tt); +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[]; +SIMP_TAC[]; + + + +ASM_CASES_TAC` n'' = CARD (V: real^3 -> bool) - 1 `; +SUBGOAL_THEN` rho_node1 FF v' = w ` ASSUME_TAC; +EXPAND_TAC "v'"; +DOWN THEN SIMP_TAC[]; +STRIP_TAC; +REWRITE_TAC[GSYM ITER; ADD1]; +ASSUME_TAC2 (ARITH_RULE` n'' < CARD (V:real^3 -> bool) ==> CARD V - 1 + 1 = CARD V `); +ASM_REWRITE_TAC[]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` w:real^3 `)); +ASM_REWRITE_TAC[]; + + + + + + +ASSUME_TAC2 Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` w:real^3 `)); +UNDISCH_TAC` ITER n'' (rho_node1 FF) w = v' `; +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (GSYM ( +SPECL [` w:real^3 `;` v:real^3 `] (GENL [` v: real^3 `;` w:real^3 `] + Local_lemmas.AFF_IVS_RHO_NODE_EQQ))); +ANTS_TAC; +ASM_REWRITE_TAC[Local_lemmas.LUNAR_COMM; lunar; circular; INSERT_SUBSET; EMPTY_SUBSET]; +UNDISCH_TAC` collinear {vec 0, v, w:real^3} `; +SIMP_TAC[INSERT_COMM]; + + + +STRIP_TAC; +EXPAND_TAC "x"; +ASM_REWRITE_TAC[IMAGE_CLAUSES]; +SUBGOAL_THEN` (f:real^3 -> real -> real^3 ) w t' = w ` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[]; +FIRST_ASSUM (MP_TAC o (SPECL [` t': real `;` v': real^3 `])); +ANTS_TAC; +ASM_REWRITE_TAC[GSYM REAL_BOUNDS_LT]; +EXPAND_TAC "v'"; +ASSUME_TAC2 Polar_fan.IVS_RHO_NODE1_IN_V; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` w:real^3 `)); +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` lunar (v,w:real^3) V E ` ASSUME_TAC; +ASM_REWRITE_TAC[lunar; circular]; +MP_TAC Local_lemmas.IVS_RNODE_IN_AFF_V; + +ANTS_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC THEN STRIP_TAC; +MP_TAC ( +let tt = GEN_ALL Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ in +ISPECL [` rho_node1 FF v `;` vec 0: real^3 `;` v: real^3 `;` v': real^3 `] tt); +ANTS_TAC; + + +UNDISCH_TAC ` ivs_rho_node1 FF w IN aff_gt {vec 0, v} {rho_node1 FF v} ` ; +ASM_REWRITE_TAC[]; +DISCH_THEN (SUBST_ALL_TAC o SYM); +DOWN; +ASM_REWRITE_TAC[]; +UNDISCH_TAC ` aff_gt {vec 0, v} {u: real^3} = + {y | ?t1 t2 t3. + &0 < t3 /\ + t1 + t2 + t3 = &1 /\ + y = t1 % vec 0 + t2 % v + t3 % u}`; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` aff_gt {vec 0, v} {uh: real^3} = aff_gt {vec 0, w} {ivs_rho_node1 FF w} ` MP_TAC; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; + +ASSUME_TAC2 (SPEC` w: real^3 ` Local_lemmas.LOFA_IMP_NOT_COLL_IVS); +REPEAT STRIP_TAC; +SUBGOAL_THEN` aff_gt {vec 0, w} {ivs_rho_node1 FF w} = aff_gt {vec 0, w} {(f: real^3 -> real -> real^3) v' t' } ` ASSUME_TAC; +MATCH_MP_TAC Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; +REPLICATE_TAC 3 DOWN THEN PHA; + +SIMP_TAC[]; +FIRST_X_ASSUM SUBST1_TAC; + +DISJ1_TAC; +MP_TAC ( +let tt = GEN_ALL Local_lemmas.AFF_GT_MONO_TRANS in +ISPECL [` {w:real^3 } `;` {vec 0, w:real^3} `; `{(f: real^3 -> real -> real^3) v' t' } `] tt); +ANTS_TAC; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_INSERT]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_V_DIFF; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` w:real^3 `)); +DOWN; +SIMP_TAC[SET_RULE` ~(w = vec 0) ==> {vec 0, w} DIFF {w} = {vec 0 } `; SET_RULE` {a} UNION {b} = {a,b} `]; + +SUBGOAL_THEN` x SUBSET {ITER l (rho_node1 FF) v | 0 < l /\ l < i} ` MP_TAC; +EXPAND_TAC "x"; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_ELIM_THM]; +ABBREV_TAC `i' = n'' - (j:num ) `; +ASSUME_TAC2 (ARITH_RULE` ~( n'' < j) ==> (n'' - j) + j = (n'': num) `); +SUBGOAL_THEN` ITER i' (rho_node1 FF) v = v' ` ASSUME_TAC; +EXPAND_TAC "v"; +REWRITE_TAC[ITER_ADD]; +EXPAND_TAC "i'"; +FIRST_ASSUM SUBST1_TAC; +ASM_REWRITE_TAC[]; +CONJ_TAC; +EXISTS_TAC` i': num `; +ASM_REWRITE_TAC[]; +CONJ_TAC; +EXPAND_TAC "i'"; +UNDISCH_TAC` ~(n'' < j:num) `; +UNDISCH_TAC` ~(n'' = j:num) `; +ARITH_TAC; + +EXPAND_TAC "i'"; +UNDISCH_TAC` ~( n'' < j: num) `; +SIMP_TAC[ARITH_RULE`~( n'' < j) ==> (n'' - j < i <=> n'' < i + (j:num))`]; +ASM_REWRITE_TAC[]; + +EXISTS_TAC` i' + 1 `; +ASM_REWRITE_TAC[GSYM ADD1; ITER; ARITH_RULE` 0 < SUC a `]; + + +EXPAND_TAC "i'"; +UNDISCH_TAC` ~( n'' < j: num) `; +SIMP_TAC[ARITH_RULE`~( n'' < j) ==> (SUC (n'' - j) < i <=> n'' < (i + (j:num)) - 1 )`]; +ASM_REWRITE_TAC[]; +STRIP_TAC; +MATCH_MP_TAC (ARITH_RULE` n < x /\ ~( n = x - 1) ==> n < x - 1 `); +ASM_REWRITE_TAC[]; + +UNDISCH_TAC` aff_gt {vec 0, v} {rho_node1 FF v} = aff_gt {vec 0, v} {u} `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +EXPAND_TAC "x"; +REWRITE_TAC[IMAGE_CLAUSES; INSERT_SUBSET; EMPTY_SUBSET; IN_INTER]; +STRIP_TAC; +ASSUME_TAC2 ( +let tt = GEN_ALL Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ in +ISPECL [` rho_node1 FF v `;` vec 0: real^3 `;` v:real^3 `;` v': real^3 `] tt); +ASSUME_TAC2 ( +let tt = GEN_ALL Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ in +ISPECL [` rho_node1 FF v `;` vec 0: real^3 `;` v:real^3 `;` rho_node1 FF v'`] tt); +DOWN THEN DOWN; +DISCH_THEN (ASSUME_TAC o SYM); +DISCH_THEN (ASSUME_TAC o SYM); +FIRST_ASSUM (MP_TAC o (SPECL [` t':real `;` v': real^3 `])); +ANTS_TAC; +ASM_REWRITE_TAC[GSYM REAL_BOUNDS_LT]; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPECL [` t':real `;` rho_node1 FF v' `])); +ANTS_TAC; +ASM_REWRITE_TAC[GSYM REAL_BOUNDS_LT]; +STRIP_TAC; + +DOWN THEN DOWN; +ASM_REWRITE_TAC[]; +STRIP_TAC; +UNDISCH_TAC` ~ collinear {vec 0, v, rho_node1 FF v } `; +PHA; +NHANH Local_lemmas.COLL_IN_AFF_GT_TOO; +NHANH Fan.th3a; + +NHANH Fan.th3b1; + + +STRIP_TAC; +UNDISCH_TAC` (f: real^3 -> real -> real^3) v' t' IN aff_gt {vec 0, v} {rho_node1 FF v} `; +UNDISCH_TAC` ~ collinear {vec 0, v, rho_node1 FF v } `; +PHA; +NHANH Local_lemmas.COLL_IN_AFF_GT_TOO; +NHANH Fan.th3b1; +STRIP_TAC; + +DISJ1_TAC; +MATCH_MP_TAC TOW_POINTS_IN_IMP_AFF_GT_SUBSET; +ASM_REWRITE_TAC[SET_RULE` DISJOINT {a} {x,y} <=> ~( a = x ) /\ ~( a = y) `]; + +STRIP_TAC; + +SUBGOAL_THEN` !t. abs t < d /\ t IN real_interval (a,b) + ==> (!s u. s IN IMAGE (IMAGE (\v. f v t)) E /\ +u IN IMAGE (\v. (f:real^3 -> real -> real^3) v t) V ==> + (aff_gt {vec 0} s INTER aff_lt {vec 0} {u} = + {})) ` ASSUME_TAC; + +FIRST_ASSUM NHANH; +GEN_TAC THEN STRIP_TAC; +FIRST_ASSUM NHANH; +GEN_TAC THEN GEN_TAC; +ABBREV_TAC` vw = (aff_gt {vec 0} s SUBSET aff_gt {vec 0, v} {rho_node1 FF v} \/ + aff_gt {vec 0} s SUBSET aff_gt {vec 0, w} {rho_node1 FF w})`; + +STRIP_TAC; +DOWN; +REWRITE_TAC[IN_IMAGE]; +STRIP_TAC; + + +FIRST_ASSUM (MP_TAC o (SPECL [` t': real `;` x: real^3 `])); +ANTS_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; + +ASSUME_TAC2 Local_lemmas1.LOCAL_RHO_NODE_PAIR_E; +DOWN; +SUBGOAL_THEN` FAN (vec 0: real^3,V,E)` MP_TAC; +UNDISCH_TAC` local_fan (V: real^3 -> bool,E,FF) `; +SIMP_TAC[local_fan]; +LET_TAC; +SIMP_TAC[]; +PHA; +NHANH Topology.disjoint_fan3; +STRIP_TAC; + +ASSUME_TAC2 (SPEC` w: real^3 ` Local_lemmas1.LOCAL_RHO_NODE_PAIR_E); +DOWN; +SUBGOAL_THEN` FAN (vec 0: real^3,V,E)` MP_TAC; +UNDISCH_TAC` local_fan (V: real^3 -> bool,E,FF) `; +SIMP_TAC[local_fan]; +LET_TAC; +SIMP_TAC[]; +PHA; +NHANH Topology.disjoint_fan3; +STRIP_TAC; +SUBGOAL_THEN` lunar (v,w:real^3) V E ` ASSUME_TAC; +ASM_REWRITE_TAC[lunar; circular]; +ASSUME_TAC2 Local_lemmas.LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI; +DOWN THEN STRIP_TAC; +UNDISCH_TAC` vec 0 IN conv0 {v, w:real^3} `; +NHANH IN_CONV0_IMP_AFF_EQ1; +STRIP_TAC; +ASM_CASES_TAC ` x = v:real^3 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +SUBGOAL_THEN` (f:real^3 -> real -> real^3) v t' = v ` MP_TAC; +FIRST_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +STRIP_TAC; + +ASSUME_TAC2 Local_lemmas.LOFA_IMP_V_DIFF; +FIRST_ASSUM (ASSUME_TAC2 o SPEC_ALL); +DOWN; +REWRITE_TAC[SET_RULE` ~( a = b) <=> DISJOINT {b} {a} `]; +NHANH AFF_LT_SUBSET_AFF11; +UNDISCH_TAC` aff {vec 0, v} = aff {vec 0, w:real^3} `; +UNDISCH_TAC` aff {vec 0, w} INTER aff_gt {vec 0, w} {rho_node1 FF w} = {} `; +UNDISCH_TAC` aff {vec 0, v} INTER aff_gt {vec 0, v} {rho_node1 FF v} = {} `; +UNDISCH_TAC` vw: bool `; +EXPAND_TAC "vw"; +DISCH_TAC; +PHA THEN STRIP_TAC; +MATCH_MP_TAC (SET_RULE`!A. a SUBSET A /\ x INTER A = {} ==> x INTER a = {} `); + +EXISTS_TAC` aff {vec 0, v:real^3} `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` aff_gt {vec 0} s SUBSET aff_gt {vec 0, v} {rho_node1 FF v} \/ + aff_gt {vec 0} s SUBSET aff_gt {vec 0, w} {rho_node1 FF w} `; +STRIP_TAC; +MATCH_MP_TAC (SET_RULE`!A. a SUBSET A /\ x INTER A = {} ==> a INTER x = {} `); + +EXISTS_TAC` aff_gt {vec 0, v} {rho_node1 FF v} `; +UNDISCH_TAC` aff_gt {vec 0, v} {u:real^3} = + {y | ?t1 t2 t3. + &0 < t3 /\ + t1 + t2 + t3 = &1 /\ + y = t1 % vec 0 + t2 % v + t3 % u} `; +DISCH_THEN (ASSUME_TAC o SYM); +UNDISCH_TAC` aff_gt {vec 0, v} {rho_node1 FF v} = aff_gt {vec 0, v} {u} `; +DISCH_THEN (ASSUME_TAC o SYM); +UNDISCH_TAC` aff_gt {vec 0, v} {u} = aff_gt {vec 0, v} {uh: real^3} `; +DISCH_THEN (ASSUME_TAC o SYM); + + +ASM_REWRITE_TAC[]; +UNDISCH_TAC` aff {vec 0, v} = aff {vec 0, w:real^3} `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +DOWN; +UNDISCH_TAC` aff {vec 0, w} INTER aff_gt {vec 0, w} {rho_node1 FF w} = {} `; +CONV_TAC SET_RULE; + + +ASM_CASES_TAC` x = (w:real^3) `; +FIRST_X_ASSUM SUBST_ALL_TAC; +SUBGOAL_THEN` (f:real^3 -> real -> real^3) w t' = w ` MP_TAC; +FIRST_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +STRIP_TAC; +UNDISCH_TAC` aff {vec 0, v} = aff {vec 0, w: real^3} `; +UNDISCH_TAC` aff {vec 0, w} INTER aff_gt {vec 0, w} {rho_node1 FF w} = {} `; +UNDISCH_TAC` aff {vec 0, v} INTER aff_gt {vec 0, v} {rho_node1 FF v} = {} `; +ASSUME_TAC2 (Local_lemmas.LOFA_IMP_V_DIFF); +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC ` w:real^3 `)); +DOWN; +NHANH (SET_RULE` ~( a = b) ==> DISJOINT {b} {a} `); +NHANH AFF_LT_SUBSET_AFF11; +STRIP_TAC; +DOWN; +UNDISCH_TAC` vw: bool `; +EXPAND_TAC "vw"; +CONV_TAC SET_RULE; + + +ASSUME_TAC2 LUNAR_IMP_IN_TWO_HAFLS_PLANE; +FIRST_X_ASSUM (MP_TAC o (SPEC` x: real^3 `)); +PHA; +ANTS_TAC; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (GSYM Local_lemmas.AFF_IVS_RHO_NODE_EQQ); +FIRST_ASSUM SUBST1_TAC; +DISCH_TAC; +UNDISCH_TAC` aff_gt {vec 0, v} {rho_node1 FF v} = aff_gt {vec 0, v} {u} `; +DISCH_THEN (ASSUME_TAC o SYM); +ASSUME_TAC2 (GSYM Local_lemmas.AFF_GT_SAME_WITH_ENDS); +UNDISCH_TAC` x IN aff_gt {vec 0, v} {rho_node1 FF v} \/ + x IN aff_gt {vec 0, w} {rho_node1 FF w} `; +STRIP_TAC; +UNDISCH_TAC` vw: bool `; +EXPAND_TAC "vw"; +STRIP_TAC; +UNDISCH_TAC` x IN aff_gt {vec 0, v} {rho_node1 FF v} ` ; +UNDISCH_TAC` ~ collinear {vec 0, v, rho_node1 FF v } `; +PHA; +NHANH Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC o SYM); +FIRST_ASSUM (MP_TAC o (SPECL [` t': real`;` x: real^3 `])); +ANTS_TAC; +ASM_REWRITE_TAC[]; +FIRST_ASSUM SUBST1_TAC; +STRIP_TAC; +MATCH_MP_TAC (SET_RULE` ! s. a SUBSET s /\ s INTER b = {} ==> a INTER b = {} `); +EXISTS_TAC` aff_gt {vec 0, v} {rho_node1 FF v} `; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC COLL_IN_AFF_GT_INTER_EMPTY; +ASM_REWRITE_TAC[]; + +ASM_CASES_TAC` aff_gt {vec 0} s INTER aff_lt {vec 0} {u': real^3} = {} `; +FIRST_X_ASSUM ACCEPT_TAC; +MP_TAC (ISPECL [` s: real^3 -> bool `; `u': real^3 `; `vec 0: real^3 `; + `v:real^3 `; `rho_node1 FF v `; ` ivs_rho_node1 FF v `] +(GEN_ALL AZIM_PI_LEMMA)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +DOWN THEN DOWN; +ASM_SIMP_TAC[]; +STRIP_TAC THEN STRIP_TAC; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_NOT_COLL_IVS; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN ` aff_gt {vec 0, v} {rho_node1 FF v} = aff_gt {vec 0, v} {x} ` ASSUME_TAC; +MATCH_MP_TAC Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[]; +UNDISCH_TAC` interior_angle1 (vec 0) FF v < pi `; +ASSUME_TAC2 Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM_IVS; +UNDISCH_TAC` interior_angle1 (vec 0) FF v = interior_angle1 (vec 0) FF w `; +ASM_SIMP_TAC[]; +STRIP_TAC; +REAL_ARITH_TAC; + +UNDISCH_TAC` vw: bool `; +EXPAND_TAC "vw"; +STRIP_TAC; + +ASM_CASES_TAC` aff_gt {vec 0} s INTER aff_lt {vec 0} {u': real^3} = {} `; +FIRST_X_ASSUM ACCEPT_TAC; + +MP_TAC ( +let tt = GEN_ALL AZIM_PI_LEMMA in +ISPECL [` s: real^3 -> bool `; `u': real^3 `;` vec 0: real^3 `;` w: real^3 `; + ` rho_node1 FF w `;` ivs_rho_node1 FF w `] tt); +ANTS_TAC; +ASM_REWRITE_TAC[]; + + +SUBGOAL_THEN` aff_gt {vec 0, v} {rho_node1 FF v} = + aff_gt {vec 0, w} {ivs_rho_node1 FF w} ` ASSUME_TAC; +MATCH_MP_TAC Local_lemmas.AFF_IVS_RHO_NODE_EQQ; +ASM_REWRITE_TAC[Local_lemmas.LUNAR_COMM]; +FIRST_X_ASSUM (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; + + +ASSUME_TAC2 Local_lemmas.AFF_GT_SAME_WITH_ENDS; +UNDISCH_TAC` x IN aff_gt {vec 0, w} {rho_node1 FF w} `; +FIRST_X_ASSUM SUBST1_TAC; +UNDISCH_TAC` aff_gt {vec 0, v} {ivs_rho_node1 FF v} = + aff_gt {vec 0, w} {rho_node1 FF w} `; +DISCH_THEN (SUBST1_TAC o SYM ); +ASSUME_TAC2 Local_lemmas.LOFA_IMP_NOT_COLL_IVS; +ASSUME_TAC2 (SPEC` w: real^3 ` Local_lemmas.LOFA_IMP_NOT_COLL_IVS); +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` aff_gt {vec 0, v} {ivs_rho_node1 FF v} = aff_gt {vec 0, v} {x} ` ASSUME_TAC; +MATCH_MP_TAC Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[]; +MATCH_MP_TAC Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2; +ASM_REWRITE_TAC[]; + +UNDISCH_TAC` interior_angle1 (vec 0) FF v < pi `; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM_IVS; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` w: real^ 3 `)); +ASM_REWRITE_TAC[]; +REAL_ARITH_TAC; +MATCH_MP_TAC (SET_RULE` ! A. a SUBSET A /\ A INTER b = {} ==> a INTER b = {} `); +EXISTS_TAC` aff_gt {vec 0, w} {rho_node1 FF w} `; +CONJ_TAC; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC COLL_IN_AFF_GT_INTER_EMPTY; +CONJ_TAC; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` aff_gt {vec 0, w} {rho_node1 FF w} = aff_gt {vec 0, v} {rho_node1 FF w}`; +ASSUME_TAC2 Local_lemmas.AFF_IVS_RHO_NODE_EQQ; + +FIRST_X_ASSUM SUBST1_TAC; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; + +UNDISCH_TAC ` x IN aff_gt {vec 0, w} {rho_node1 FF w} `; +UNDISCH_TAC` aff_gt {vec 0, v} {ivs_rho_node1 FF v} = + aff_gt {vec 0, w} {rho_node1 FF w} `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_NOT_COLL_IVS; +DOWN; +PHA; +NHANH Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; +SIMP_TAC[]; +ASM_REWRITE_TAC[]; + + + + + +EXPAND_TAC "CONCL"; +ABBREV_TAC` e1 = min ( -- a) b `; +EXISTS_TAC` min e1 d `; + +CONJ_TAC; +EXPAND_TAC "e1"; +REWRITE_TAC[REAL_LT_MIN]; +ASM_REWRITE_TAC[REAL_ARITH` &0 < -- a <=> a < &0 `]; +GEN_TAC; + +REWRITE_TAC[REAL_BOUNDS_LT]; +EXPAND_TAC "e1"; +REWRITE_TAC[REAL_LT_MIN]; +STRIP_TAC; +CONJ_TAC; +REWRITE_TAC[MESON[] ` +~(?v w u. P v w u /\ Q v w u /\ ~ R v w u ) <=> +(! v w u. P v w u /\ Q v w u ==> R v w u ) `]; +REPEAT GEN_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` t': real `)); +ANTS_TAC; +ASM_REWRITE_TAC[real_interval; IN_ELIM_THM]; +DOWN THEN DOWN THEN DOWN; +REAL_ARITH_TAC; + + +SIMP_TAC[]; + + +CONJ_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +DOWN THEN DOWN THEN DOWN; +REWRITE_TAC[real_interval; IN_ELIM_THM]; +REAL_ARITH_TAC; +ASM_REWRITE_TAC[]]);; + + + +let LOCAL_FAN_SET_E = prove_by_refinement(` local_fan (V,E,FF) ==> {{v, rho_node1 FF v} | v IN V } = E `, +[REWRITE_TAC[EXTENSION; IN_ELIM_THM]; +STRIP_TAC; +GEN_TAC; +EQ_TAC; +STRIP_TAC; +DOWN; +SIMP_TAC[GSYM EXTENSION]; +STRIP_TAC; +MATCH_MP_TAC Local_lemmas1.LOCAL_RHO_NODE_PAIR_E; +ASM_REWRITE_TAC[]; +REWRITE_TAC[GSYM EXTENSION]; +DOWN THEN PHA; +NHANH EDGE_IN_LOCAL_FAN_DET_RHO_NODE; +SIMP_TAC[EQ_SYM_EQ]]);; + + + + + +let LOCAL_FAN_FACE_FF = prove_by_refinement(` local_fan (V,E,FF) ==> { v, rho_node1 FF v | v IN V } = FF `, +[REWRITE_TAC[EXTENSION; IN_ELIM_THM]; +STRIP_TAC; +GEN_TAC; +EQ_TAC; +STRIP_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_RHO_NODE_PROS; +DOWN THEN STRIP_TAC; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM MATCH_MP_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2; +DOWN THEN PHA THEN STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` x: real^3 # real^3 `)); +EXISTS_TAC` FST (x: real^3 # real^3 ) `; +CONJ_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_IMP_IN_V2; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM ACCEPT_TAC]);; + + + + + + +let ORD_PAIRS_INJ_IMAGE = prove_by_refinement(` (! s. s IN E ==> INJ f s (IMAGE f s )) ==> + ord_pairs (IMAGE (\s. IMAGE f s) E) = IMAGE (\ (x:real^N,y). (f: real^N -> real^M) x, f y) (ord_pairs E ) `, +[REWRITE_TAC[EXTENSION]; +STRIP_TAC; +GEN_TAC THEN EQ_TAC; +REWRITE_TAC[ord_pairs; IN_ELIM_THM; IN_IMAGE]; +NHANH_PAT `\x. x ==> y ` (SET_RULE` {a,b} = S ==> a IN S /\ b IN S `); +REWRITE_TAC[IN_IMAGE]; +STRIP_TAC; +EXISTS_TAC` (x'': real^N, x''': real^N) `; +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN` {x'', x''': real^N} = x' ` MP_TAC; +ASM_REWRITE_TAC[GSYM SUBSET_ANTISYM_EQ; INSERT_SUBSET; EMPTY_SUBSET]; +DOWN THEN DOWN; +FIRST_X_ASSUM NHANH; +REWRITE_TAC[SUBSET; INJ]; +STRIP_TAC; +REPEAT STRIP_TAC; +UNDISCH_TAC` !x. (x:real^N) IN x' ==> (f x):real^M IN IMAGE f x' `; +DISCH_THEN (ASSUME_TAC2 o (SPEC` x'''': real^N `)); +DOWN_TAC; +CONV_TAC SET_RULE; +DOWN THEN DOWN; +MESON_TAC[]; + + +REWRITE_TAC[IN_IMAGE; ord_pairs; IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC` (f: real^N -> real^M ) a `; +EXISTS_TAC` (f: real^N -> real^M ) b `; +ASM_REWRITE_TAC[]; +EXISTS_TAC` {a, b: real^N } `; +ASM_REWRITE_TAC[IMAGE_CLAUSES]]);; + + + + + +let SET2_DETER = +prove(` s = {x,y} /\ a IN s /\ b IN s /\ ~( a = b) ==> s = {a, b} `, +STRIP_TAC THEN +REPLICATE_TAC 3 DOWN THEN PHA THEN +ASM_REWRITE_TAC[] THEN +CONV_TAC SET_RULE);; + + + +let INSERT_UNION_CLAUSES = +prove(` x INSERT S UNION U = S UNION x INSERT U /\ {} UNION U = U `, +REWRITE_TAC[Local_lemmas.INSERT_UNION2; UNION_EMPTY]);; + + + +let INJ_IMP_BIJ_IMAGE = prove(` INJ f S S' ==> BIJ f S (IMAGE f S) `, +SIMP_TAC[BIJ; INJ; SURJ; FUN_IN_IMAGE] THEN +STRIP_TAC THEN +REWRITE_TAC[IN_IMAGE] THEN ASM_MESON_TAC[]);; + + + + + +let BIJ_AND_MAP_COMM = prove_by_refinement(` local_fan (V,E,FF) /\ +BIJ (f: real^3 -> real^3) V V' /\ +IMAGE (\s. IMAGE f s) E = E' /\ +FAN (vec 0, V', E') /\ +(\(x,y). f x, f y ) = ff +==> BIJ ff ( darts_of_hyp E V) (darts_of_hyp E' V') /\ + (!x. x IN darts_of_hyp E V + ==> ff_of_hyp (vec 0,V',E') (ff x) = ff (ff_of_hyp (vec 0,V,E) x)) + +`, + +[REWRITE_TAC[hyp_iso; local_fan]; +LET_TAC; +NHANH Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` local_fan (V,E,FF) ` ASSUME_TAC; +REWRITE_TAC[local_fan]; +LET_TAC; +ASM_REWRITE_TAC[]; +DOWN; +ASM_SIMP_TAC[]; +STRIP_TAC; +CONJ_TAC; +EXISTS_TAC` (x: real^3 # real^3) `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` dart H = darts_of_hyp E (V: real^3 -> bool) `; +DISCH_THEN SUBST_ALL_TAC; +ASM_SIMP_TAC[]; +UNDISCH_TAC` dih2k (H:(real^3 # real^3) hypermap) (CARD (FF: real^3 # real^3 -> bool)) ` ; +ASM_SIMP_TAC[]; + +ASSUME_TAC2 LOCAL_FAN_SET_E; +ASSUME_TAC2 Local_lemmas.LOFA_DARTS_FF_UNION_SWITCH_FF; +ASSUME_TAC2 LOCAL_FAN_FACE_FF; +SUBST_ALL_TAC ( +MESON[] ` FF = face H x <=> face H x = (FF: real^3 # real^3 -> bool) `); +ASM_REWRITE_TAC[]; + + +SUBGOAL_THEN` {{(f: real^3 -> real^3) v, f (rho_node1 FF v)} | v IN V} = E' ` ASSUME_TAC; +EXPAND_TAC "E'"; +REWRITE_TAC[EXTENSION]; +GEN_TAC; +EXPAND_TAC "E"; +REWRITE_TAC[IN_ELIM_THM; IN_IMAGE]; +EQ_TAC; +STRIP_TAC; +EXISTS_TAC` {v, rho_node1 FF v} `; +REWRITE_TAC[IMAGE_CLAUSES]; +ASM_REWRITE_TAC[]; +EXISTS_TAC` v: real^3 `; +ASM_REWRITE_TAC[]; + +STRIP_TAC; +EXISTS_TAC` v: real^3 `; +ASM_REWRITE_TAC[IMAGE_CLAUSES]; +UNDISCH_TAC` BIJ (f: real^3 -> real^3) V V' `; +PAT_REWRITE_TAC `\x. x ==> y ` [BIJ]; +NHANH Wrgcvdr_cizmrrh.SURJ_IMP_S2_EQ_IMAGE_S1; +STRIP_TAC; + +SUBGOAL_THEN` self_pairs E' (V': real^3 -> bool) = {} ` MP_TAC; +REWRITE_TAC[self_pairs]; +EXPAND_TAC "V'"; +EXPAND_TAC "E'"; +REWRITE_TAC[IN_IMAGE]; + + +MATCH_MP_TAC (SET_RULE` (! x. ~ P x ) ==> {x,x | P x } = {} `); +GEN_TAC; +STRIP_TAC; +DOWN; +PHA; +REWRITE_TAC[SET_RULE` ~( x = {} ) <=> ? a. a IN x `; EE; IN_ELIM_THM]; +EXISTS_TAC` (f: real^3 -> real^3) (rho_node1 FF x') `; +EXISTS_TAC` x': real^3 `; +ASM_REWRITE_TAC[]; + +STRIP_TAC; +SUBGOAL_THEN` darts_of_hyp E' V' = IMAGE (ff: real^3 # real^3 -> real^3 # real^3) (darts_of_hyp E V ) ` MP_TAC; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[darts_of_hyp; UNION_EMPTY; ord_pairs]; + +SUBGOAL_THEN` (! s. s IN E ==> INJ (f:real^3 -> real^3) s (IMAGE f s)) ` MP_TAC; +REWRITE_TAC[INJ]; +REPEAT STRIP_TAC; +REWRITE_TAC[IN_IMAGE]; +EXISTS_TAC` x': real^3 `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` (s: real^3 -> bool) IN E `; +EXPAND_TAC "E"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; + +ASM_CASES_TAC` x' = (y:real^3) `; +DOWN THEN SIMP_TAC[]; +REPLICATE_TAC 6 DOWN THEN PHA; +NHANH ( +MESON[SET2_DETER]` x' IN s /\ + y IN s /\ + f x' = f y /\ + v IN V /\ + s = {v, rho_node1 FF v} /\ + ~(x' = y) ==> s = {x', y} `); +STRIP_TAC; +SUBGOAL_THEN` IMAGE (f: real^3 -> real^3 ) s IN E' ` ASSUME_TAC; +DOWN; +ASM_REWRITE_TAC[IMAGE_CLAUSES]; +EXPAND_TAC "E'"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC `v: real^3 `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` FAN (vec 0,V': real^3 -> bool,E') `; +REWRITE_TAC[FAN; fan6]; +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` IMAGE (f:real^3 -> real^3) s `)); +DOWN; +UNDISCH_TAC` s = {x', y:real^3} `; +SIMP_TAC[IMAGE_CLAUSES; Local_lemmas.INSERT_UNION2; UNION_EMPTY]; +ASM_REWRITE_TAC[INSERT_INSERT; COLLINEAR_2]; +NHANH ORD_PAIRS_INJ_IMAGE; +REWRITE_TAC[GSYM ord_pairs]; + + + + + + + + + + +SUBGOAL_THEN` (IMAGE (\s. IMAGE (f:real^3 -> real^3) s) E) = E': (real^3 -> bool) -> bool ` MP_TAC; +REWRITE_TAC[EXTENSION; IN_IMAGE]; +GEN_TAC; +EQ_TAC; +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC o (SPEC` a: real^3 `)); +EXPAND_TAC "E'"; +REWRITE_TAC[IN_ELIM_THM]; +DOWN THEN DOWN; +EXPAND_TAC "E"; +REWRITE_TAC[IN_ELIM_THM]; +REPEAT STRIP_TAC; +EXISTS_TAC` v: real^3 `; +ASM_REWRITE_TAC[]; +REPLICATE_TAC 4 DOWN THEN PHA; +CONV_TAC SET_RULE; + + + + +EXPAND_TAC "E'"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC` {v, rho_node1 FF v }`; +ASM_REWRITE_TAC[]; +EXPAND_TAC "E"; +DOWN THEN DOWN; +CONV_TAC SET_RULE; +SIMP_TAC[]; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` self_pairs E (V:real^3 -> bool) = {} ` MP_TAC; +REWRITE_TAC[self_pairs; EE; SET_RULE` s = {} <=> ! x. ~ ( x IN s) `; IN_ELIM_THM]; +GEN_TAC; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` rho_node1 FF v `)); +PHA; +EXPAND_TAC "E"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` v: real^3 `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` darts_of_hyp E V = FF UNION {(v:real^3),w | w,v IN FF} `; +DISCH_THEN (SUBST1_TAC o SYM); +SIMP_TAC[darts_of_hyp; UNION_EMPTY]; + + +(* ============ *) + +ASM_SIMP_TAC[]; +STRIP_TAC; +CONJ_TAC; +MATCH_MP_TAC (GEN_ALL INJ_IMP_BIJ_IMAGE); +EXISTS_TAC` IMAGE (ff: real^3 # real^3 -> real^3 # real^3) (FF UNION {(v:real^3,w: real^3) | w,v IN FF} )`; +REWRITE_TAC[INJ; FUN_IN_IMAGE]; +EXPAND_TAC "ff"; + + +SUBGOAL_THEN` !x. x IN FF UNION {v,w | w,v IN FF} ==> (? a b. x = (a,b) /\ a IN V /\ b IN (V: real^3 -> bool)) ` MP_TAC; +REWRITE_TAC[IN_UNION]; +REPEAT STRIP_TAC; +DOWN; +EXPAND_TAC "FF"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC` v: real^3 `; +EXISTS_TAC` rho_node1 FF v `; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; +ASM_REWRITE_TAC[]; +DOWN; +EXPAND_TAC "FF"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC` rho_node1 FF v' `; +EXISTS_TAC` v': real^ 3 `; +DOWN THEN DOWN; +ASM_SIMP_TAC[PAIR_EQ]; +REPEAT STRIP_TAC; +MATCH_MP_TAC Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; +ASM_REWRITE_TAC[]; +DISCH_THEN NHANH; +REPEAT STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[]; +EXPAND_TAC "ff"; +REWRITE_TAC[PAIR_EQ]; +UNDISCH_TAC` INJ (f:real^3 -> real^3) V V' `; +DOWN THEN DOWN; +UNDISCH_TAC` (a:real^3) IN V `; +UNDISCH_TAC` (b: real^3) IN V `; +REWRITE_TAC[INJ]; +MESON_TAC[]; + +UNDISCH_TAC` darts_of_hyp E V = FF UNION {v:real^3,w | w,v IN FF} `; +DISCH_THEN (ASSUME_TAC2 o SYM); +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +SUBGOAL_THEN` (ff: real^3 # real^3 -> real^3 # real^3) x' IN darts_of_hyp E' V' ` MP_TAC; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC FUN_IN_IMAGE; +FIRST_ASSUM ACCEPT_TAC; +DOWN; +SIMP_TAC[Wrgcvdr_cizmrrh.ff_of_hyp2]; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +REWRITE_TAC[]; +REWRITE_TAC[IN_UNION]; +STRIP_TAC THEN STRIP_TAC; +UNDISCH_TAC` (x': real^3 # real^3 ) IN FF `; +EXPAND_TAC "FF"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +EXPAND_TAC "ff"; +REWRITE_TAC[PAIR_EQ]; +SUBGOAL_THEN` rho_node1 FF v IN V ` MP_TAC; +MATCH_MP_TAC Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` local_fan (V,E,FF) `; +PHA; +NHANH Local_lemmas1.LOFA_IMP_EE_TWO_ELMS_INS_ND; +ASSUME_TAC2 Local_lemmas.IVS_RHO_IDD; +ASM_SIMP_TAC[]; +ONCE_REWRITE_TAC[INSERT_COMM]; +REWRITE_TAC[Polar_fan.IVS_AZIM_CYCLE_TWO_POINT_SET]; +STRIP_TAC; + +SUBGOAL_THEN` EE ((f:real^3 -> real^3) (rho_node1 FF v)) E' = { f v, f (rho_node1 FF (rho_node1 FF v )) } ` MP_TAC; +REWRITE_TAC[EE; GSYM SUBSET_ANTISYM_EQ; SUBSET]; +CONJ_TAC; +GEN_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXPAND_TAC "E'"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +DOWN; +REWRITE_TAC[Collect_geom.PAIR_EQ_EXPAND]; +STRIP_TAC; +UNDISCH_TAC` INJ (f: real^3 -> real ^3) V V' `; +REWRITE_TAC[INJ]; +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPECL [`rho_node1 FF v `;` v': real^3 `])); +ASM_REWRITE_TAC[]; +CONV_TAC SET_RULE; + +UNDISCH_TAC` INJ (f: real^3 -> real ^3) V V' `; +REWRITE_TAC[INJ]; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPECL [`rho_node1 FF v `;` rho_node1 FF v'`])); +ANTS_TAC; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 Polar_fan.RHO_NODE1_INJECTIVE; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPECL[` v: real^3 `;` v': real^3 `])); +ASM_SIMP_TAC[]; +REWRITE_TAC[IN_INSERT]; +GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM]; +REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +EXPAND_TAC "E'"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC `v: real^3 `; +ASM_REWRITE_TAC[INSERT_COMM]; +ASM_REWRITE_TAC[]; +EXPAND_TAC "E'"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` rho_node1 FF v `; +ASM_REWRITE_TAC[]; +SIMP_TAC[Polar_fan.IVS_AZIM_CYCLE_TWO_POINT_SET]; + + + +UNDISCH_TAC` (x': real^3 # real^3) IN {v,w | w,v IN FF} `; +EXPAND_TAC "FF"; +REWRITE_TAC[IN_ELIM_THM; PAIR_EQ]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +EXPAND_TAC "ff"; +REWRITE_TAC[PAIR_EQ]; +ASSUME_TAC2 ( +SPEC` v': real^3 ` ( +GEN`v: real^3 ` Local_lemmas1.LOFA_IMP_EE_TWO_ELMS_INS_ND)); +ASM_REWRITE_TAC[Polar_fan.IVS_AZIM_CYCLE_TWO_POINT_SET]; +SUBGOAL_THEN` EE ((f:real^3 -> real^3) v') E'= { f (rho_node1 FF v'), f (ivs_rho_node1 FF v' )} ` MP_TAC; +REWRITE_TAC[EE; GSYM SUBSET_ANTISYM_EQ; SUBSET]; + +UNDISCH_TAC` INJ (f: real^3 -> real^3) V V' `; +REWRITE_TAC[INJ]; +STRIP_TAC; + + +CONJ_TAC; +EXPAND_TAC "E'"; +REWRITE_TAC[IN_ELIM_THM; Collect_geom.PAIR_EQ_EXPAND]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPECL [` v': real^3 `;` v'': real^3 `])); +ASM_REWRITE_TAC[IN_INSERT]; + +FIRST_X_ASSUM (MP_TAC o (SPECL [` v': real^3 `;` rho_node1 FF v'' `])); +ANTS_TAC; +ASM_REWRITE_TAC[IN_INSERT]; +MATCH_MP_TAC Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 ( +SPEC ` v'': real^3 ` ( +GEN`v: real^3 ` Local_lemmas.IVS_RHO_IDD)); +ASM_REWRITE_TAC[IN_INSERT]; + +REWRITE_TAC[IN_ELIM_THM; IN_INSERT; NOT_IN_EMPTY]; +REPEAT STRIP_TAC; +ASM_REWRITE_TAC[]; +EXPAND_TAC "E'"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` v': real^3 `; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[]; +EXPAND_TAC "E'"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` ivs_rho_node1 FF v' `; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 Polar_fan.IVS_RHO_NODE1_IN_V; +CONJ_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +FIRST_ASSUM ACCEPT_TAC; +ASSUME_TAC2 ( +SPEC` v': real ^3 ` ( +GEN`v: real^3 ` Local_lemmas1.LOCAL_FAN_RHO_NODE_IVS )); +ASM_REWRITE_TAC[INSERT_COMM]; +SIMP_TAC[Polar_fan.IVS_AZIM_CYCLE_TWO_POINT_SET]]);; + + + +let NODE_EDGE_COMM_LEMMA = prove_by_refinement (` local_fan (V,E,FF) /\ + BIJ f V V' /\ + IMAGE (\s. IMAGE f s) E = E' /\ + FAN (vec 0,V',E') /\ + (\(x,y). f x,f y) = ff + ==> + (!x. x IN darts_of_hyp E V + ==> nn_of_hyp (vec 0,V',E') (ff x) = + ff (nn_of_hyp (vec 0,V,E) x) /\ + ee_of_hyp (vec 0,V',E') (ff x) = + ff (ee_of_hyp (vec 0,V,E) x) ) `, + + + +[REWRITE_TAC[hyp_iso; local_fan]; +LET_TAC; +NHANH Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` local_fan (V,E,FF) ` ASSUME_TAC; +REWRITE_TAC[local_fan]; +LET_TAC; +ASM_REWRITE_TAC[]; +DOWN; +ASM_SIMP_TAC[]; +STRIP_TAC; +CONJ_TAC; +EXISTS_TAC` (x: real^3 # real^3) `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` dart H = darts_of_hyp E (V: real^3 -> bool) `; +DISCH_THEN SUBST_ALL_TAC; +ASM_SIMP_TAC[]; +UNDISCH_TAC` dih2k (H:(real^3 # real^3) hypermap) (CARD (FF: real^3 # real^3 -> bool)) ` ; +ASM_SIMP_TAC[]; + +ASSUME_TAC2 LOCAL_FAN_SET_E; +ASSUME_TAC2 Local_lemmas.LOFA_DARTS_FF_UNION_SWITCH_FF; +ASSUME_TAC2 LOCAL_FAN_FACE_FF; +SUBST_ALL_TAC ( +MESON[] ` FF = face H x <=> face H x = (FF: real^3 # real^3 -> bool) `); +ASM_REWRITE_TAC[]; + + +SUBGOAL_THEN` {{(f: real^3 -> real^3) v, f (rho_node1 FF v)} | v IN V} = E' ` ASSUME_TAC; +EXPAND_TAC "E'"; +REWRITE_TAC[EXTENSION]; +GEN_TAC; +EXPAND_TAC "E"; +REWRITE_TAC[IN_ELIM_THM; IN_IMAGE]; +EQ_TAC; +STRIP_TAC; +EXISTS_TAC` {v, rho_node1 FF v} `; +REWRITE_TAC[IMAGE_CLAUSES]; +ASM_REWRITE_TAC[]; +EXISTS_TAC` v: real^3 `; +ASM_REWRITE_TAC[]; + +STRIP_TAC; +EXISTS_TAC` v: real^3 `; +ASM_REWRITE_TAC[IMAGE_CLAUSES]; +UNDISCH_TAC` BIJ (f: real^3 -> real^3) V V' `; +PAT_REWRITE_TAC `\x. x ==> y ` [BIJ]; +NHANH Wrgcvdr_cizmrrh.SURJ_IMP_S2_EQ_IMAGE_S1; +STRIP_TAC; + +SUBGOAL_THEN` self_pairs E' (V': real^3 -> bool) = {} ` MP_TAC; +REWRITE_TAC[self_pairs]; +EXPAND_TAC "V'"; +EXPAND_TAC "E'"; +REWRITE_TAC[IN_IMAGE]; + + +MATCH_MP_TAC (SET_RULE` (! x. ~ P x ) ==> {x,x | P x } = {} `); +GEN_TAC; +STRIP_TAC; +DOWN; +PHA; +REWRITE_TAC[SET_RULE` ~( x = {} ) <=> ? a. a IN x `; EE; IN_ELIM_THM]; +EXISTS_TAC` (f: real^3 -> real^3) (rho_node1 FF x') `; +EXISTS_TAC` x': real^3 `; +ASM_REWRITE_TAC[]; + +STRIP_TAC; +SUBGOAL_THEN` darts_of_hyp E' V' = IMAGE (ff: real^3 # real^3 -> real^3 # real^3) (darts_of_hyp E V ) ` MP_TAC; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[darts_of_hyp; UNION_EMPTY; ord_pairs]; + +SUBGOAL_THEN` (! s. s IN E ==> INJ (f:real^3 -> real^3) s (IMAGE f s)) ` MP_TAC; +REWRITE_TAC[INJ]; +REPEAT STRIP_TAC; +REWRITE_TAC[IN_IMAGE]; +EXISTS_TAC` x': real^3 `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` (s: real^3 -> bool) IN E `; +EXPAND_TAC "E"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; + +ASM_CASES_TAC` x' = (y:real^3) `; +DOWN THEN SIMP_TAC[]; +REPLICATE_TAC 6 DOWN THEN PHA; +NHANH ( +MESON[SET2_DETER]` x' IN s /\ + y IN s /\ + f x' = f y /\ + v IN V /\ + s = {v, rho_node1 FF v} /\ + ~(x' = y) ==> s = {x', y} `); +STRIP_TAC; +SUBGOAL_THEN` IMAGE (f: real^3 -> real^3 ) s IN E' ` ASSUME_TAC; +DOWN; +ASM_REWRITE_TAC[IMAGE_CLAUSES]; +EXPAND_TAC "E'"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC `v: real^3 `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` FAN (vec 0,V': real^3 -> bool,E') `; +REWRITE_TAC[FAN; fan6]; +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` IMAGE (f:real^3 -> real^3) s `)); +DOWN; +UNDISCH_TAC` s = {x', y:real^3} `; +SIMP_TAC[IMAGE_CLAUSES; Local_lemmas.INSERT_UNION2; UNION_EMPTY]; +ASM_REWRITE_TAC[INSERT_INSERT; COLLINEAR_2]; +NHANH ORD_PAIRS_INJ_IMAGE; +REWRITE_TAC[GSYM ord_pairs]; + + + + + + + + + + +SUBGOAL_THEN` (IMAGE (\s. IMAGE (f:real^3 -> real^3) s) E) = E': (real^3 -> bool) -> bool ` MP_TAC; +REWRITE_TAC[EXTENSION; IN_IMAGE]; +GEN_TAC; +EQ_TAC; +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC o (SPEC` a: real^3 `)); +EXPAND_TAC "E'"; +REWRITE_TAC[IN_ELIM_THM]; +DOWN THEN DOWN; +EXPAND_TAC "E"; +REWRITE_TAC[IN_ELIM_THM]; +REPEAT STRIP_TAC; +EXISTS_TAC` v: real^3 `; +ASM_REWRITE_TAC[]; +REPLICATE_TAC 4 DOWN THEN PHA; +CONV_TAC SET_RULE; + + + + +EXPAND_TAC "E'"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC` {v, rho_node1 FF v }`; +ASM_REWRITE_TAC[]; +EXPAND_TAC "E"; +DOWN THEN DOWN; +CONV_TAC SET_RULE; +SIMP_TAC[]; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` self_pairs E (V:real^3 -> bool) = {} ` MP_TAC; +REWRITE_TAC[self_pairs; EE; SET_RULE` s = {} <=> ! x. ~ ( x IN s) `; IN_ELIM_THM]; +GEN_TAC; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` rho_node1 FF v `)); +PHA; +EXPAND_TAC "E"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` v: real^3 `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` darts_of_hyp E V = FF UNION {(v:real^3),w | w,v IN FF} `; +DISCH_THEN (SUBST1_TAC o SYM); +SIMP_TAC[darts_of_hyp; UNION_EMPTY]; + +STRIP_TAC; +REWRITE_TAC[Wrgcvdr_cizmrrh.nn_of_hyp2]; +UNDISCH_TAC` darts_of_hyp E V = FF UNION {v:real^3,w | w,v IN FF} `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_SIMP_TAC[]; +SUBGOAL_THEN`(! x. x IN darts_of_hyp E (V:real^3 -> bool) ==> ((ff x): real^3 # real^3) IN darts_of_hyp E' V' )` MP_TAC; +ASM_REWRITE_TAC[FUN_IN_IMAGE]; +STRIP_TAC; +FIRST_ASSUM NHANH; +ASM_SIMP_TAC[]; + +SUBGOAL_THEN` ! v. v IN V ==> ivs_rho_node1 FF (rho_node1 FF v) = v ` ASSUME_TAC; +GEN_TAC THEN STRIP_TAC; +MATCH_MP_TAC Local_lemmas.IVS_RHO_IDD; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` ! v. v IN V ==> rho_node1 FF (ivs_rho_node1 FF v) = v ` ASSUME_TAC; +GEN_TAC THEN STRIP_TAC; +MATCH_MP_TAC Local_lemmas1.LOCAL_FAN_RHO_NODE_IVS; +ASM_REWRITE_TAC[]; + + +SUBGOAL_THEN` !v . v IN V ==> rho_node1 FF v IN V ` ASSUME_TAC; +GEN_TAC THEN STRIP_TAC; +MATCH_MP_TAC Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; +ASM_SIMP_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]; + + +SUBGOAL_THEN` !v . v IN V ==> ivs_rho_node1 FF v IN V ` ASSUME_TAC; +MATCH_MP_TAC Polar_fan.IVS_RHO_NODE1_IN_V; +EXISTS_TAC` E: (real^3 -> bool) -> bool `; +ASM_REWRITE_TAC[]; + + + +UNDISCH_TAC` INJ (f: real^3 -> real^3) V V' `; +REWRITE_TAC[INJ]; +STRIP_TAC; + + +SUBGOAL_THEN` !v. v IN V + ==> EE v E = {rho_node1 FF v, (ivs_rho_node1 FF v)} ` ASSUME_TAC; +REPEAT STRIP_TAC; +MATCH_MP_TAC Local_lemmas1.LOFA_IMP_EE_TWO_ELMS_INS_ND; +ASM_REWRITE_TAC[]; + + + + + +SUBGOAL_THEN`!v. v IN V ==> EE ((f:real^3 -> real^3) v ) E' = {f (rho_node1 FF v), f (ivs_rho_node1 FF v ) } ` ASSUME_TAC; +REPEAT STRIP_TAC; +REWRITE_TAC[EE; GSYM SUBSET_ANTISYM_EQ; SUBSET]; +EXPAND_TAC "E'"; +REWRITE_TAC[IN_ELIM_THM]; +CONJ_TAC; +GEN_TAC THEN STRIP_TAC; +DOWN; +REWRITE_TAC[Collect_geom.PAIR_EQ_EXPAND]; +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPECL [` v: real^3 `;` v': real^3 `])); +ASM_REWRITE_TAC[IN_INSERT]; +FIRST_X_ASSUM (MP_TAC o (SPECL [` v: real^3 `;` rho_node1 FF v' `])); +ANTS_TAC; +ASM_REWRITE_TAC[IN_INSERT]; +MATCH_MP_TAC Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; +ASM_REWRITE_TAC[]; +STRIP_TAC; + +ASM_SIMP_TAC[IN_INSERT]; +REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY]; +GEN_TAC THEN STRIP_TAC; +EXISTS_TAC` v: real^3 `; +ASM_REWRITE_TAC[]; +EXISTS_TAC` ivs_rho_node1 FF v `; +ASM_SIMP_TAC[INSERT_COMM]; + +GEN_TAC THEN STRIP_TAC; +SUBGOAL_THEN` x' IN FF UNION {v:real^3,w | w,v IN FF} ` MP_TAC; +ASM_REWRITE_TAC[]; +REWRITE_TAC[IN_UNION]; +STRIP_TAC; +DOWN; +EXPAND_TAC "FF"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +EXPAND_TAC "ff"; +REWRITE_TAC[]; + +CONJ_TAC; +ASM_SIMP_TAC[PAIR_EQ]; +REWRITE_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]; + +REWRITE_TAC[Wrgcvdr_cizmrrh.ee_of_hyp2]; +UNDISCH_TAC` x' IN darts_of_hyp E (V: real^3 -> bool) `; +UNDISCH_TAC` (ff: real^3 # real^3 -> real^3 # real^3 ) x' IN IMAGE ff (darts_of_hyp E V) `; +ASM_REWRITE_TAC[]; +EXPAND_TAC "ff"; +SIMP_TAC[]; + +DOWN; +EXPAND_TAC "FF"; +REWRITE_TAC[IN_ELIM_THM; PAIR_EQ]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +EXPAND_TAC "ff"; +REWRITE_TAC[PAIR_EQ]; +ASM_SIMP_TAC[]; +ONCE_REWRITE_TAC[INSERT_COMM]; +REWRITE_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]; + +REWRITE_TAC[Wrgcvdr_cizmrrh.ee_of_hyp2]; +UNDISCH_TAC` x' IN darts_of_hyp E (V: real^3 -> bool) `; +UNDISCH_TAC` (ff: real^3 # real^3 -> real^3 # real^3 ) x' IN IMAGE ff (darts_of_hyp E V) `; +ASM_REWRITE_TAC[]; +EXPAND_TAC "ff"; +SIMP_TAC[]]);; + + + + + +let HYP_ISO_LEMMAA = prove_by_refinement (` local_fan (V,E,FF) /\ + BIJ f V V' /\ + IMAGE (\s. IMAGE f s) E = E' /\ + FAN (vec 0,V',E') /\ + (\(x,y). f x,f y) = ff +==> hyp_iso ff (hypermap (HYP (vec 0, V, E)), hypermap (HYP (vec 0, V', E')))`, +[REWRITE_TAC[hyp_iso; local_fan]; +LET_TAC; +NHANH Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` local_fan (V,E,FF) ` ASSUME_TAC; +REWRITE_TAC[local_fan]; +LET_TAC; +ASM_REWRITE_TAC[]; +DOWN; +ASM_SIMP_TAC[]; +STRIP_TAC; +CONJ_TAC; +EXISTS_TAC` (x: real^3 # real^3) `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` dart H = darts_of_hyp E (V: real^3 -> bool) `; +DISCH_THEN SUBST_ALL_TAC; +ASM_SIMP_TAC[]; +UNDISCH_TAC` dih2k (H:(real^3 # real^3) hypermap) (CARD (FF: real^3 # real^3 -> bool)) ` ; +ASM_SIMP_TAC[]; + +ASSUME_TAC2 LOCAL_FAN_SET_E; +ASSUME_TAC2 Local_lemmas.LOFA_DARTS_FF_UNION_SWITCH_FF; +ASSUME_TAC2 LOCAL_FAN_FACE_FF; +SUBST_ALL_TAC ( +MESON[] ` FF = face H x <=> face H x = (FF: real^3 # real^3 -> bool) `); +ASM_REWRITE_TAC[]; + + +SUBGOAL_THEN` {{(f: real^3 -> real^3) v, f (rho_node1 FF v)} | v IN V} = E' ` ASSUME_TAC; +EXPAND_TAC "E'"; +REWRITE_TAC[EXTENSION]; +GEN_TAC; +EXPAND_TAC "E"; +REWRITE_TAC[IN_ELIM_THM; IN_IMAGE]; +EQ_TAC; +STRIP_TAC; +EXISTS_TAC` {v, rho_node1 FF v} `; +REWRITE_TAC[IMAGE_CLAUSES]; +ASM_REWRITE_TAC[]; +EXISTS_TAC` v: real^3 `; +ASM_REWRITE_TAC[]; + +STRIP_TAC; +EXISTS_TAC` v: real^3 `; +ASM_REWRITE_TAC[IMAGE_CLAUSES]; +UNDISCH_TAC` BIJ (f: real^3 -> real^3) V V' `; +PAT_REWRITE_TAC `\x. x ==> y ` [BIJ]; +NHANH Wrgcvdr_cizmrrh.SURJ_IMP_S2_EQ_IMAGE_S1; +STRIP_TAC; + +SUBGOAL_THEN` self_pairs E' (V': real^3 -> bool) = {} ` MP_TAC; +REWRITE_TAC[self_pairs]; +EXPAND_TAC "V'"; +EXPAND_TAC "E'"; +REWRITE_TAC[IN_IMAGE]; + + +MATCH_MP_TAC (SET_RULE` (! x. ~ P x ) ==> {x,x | P x } = {} `); +GEN_TAC; +STRIP_TAC; +DOWN; +PHA; +REWRITE_TAC[SET_RULE` ~( x = {} ) <=> ? a. a IN x `; EE; IN_ELIM_THM]; +EXISTS_TAC` (f: real^3 -> real^3) (rho_node1 FF x') `; +EXISTS_TAC` x': real^3 `; +ASM_REWRITE_TAC[]; + +STRIP_TAC; +SUBGOAL_THEN` darts_of_hyp E' V' = IMAGE (ff: real^3 # real^3 -> real^3 # real^3) (darts_of_hyp E V ) ` MP_TAC; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[darts_of_hyp; UNION_EMPTY; ord_pairs]; + +SUBGOAL_THEN` (! s. s IN E ==> INJ (f:real^3 -> real^3) s (IMAGE f s)) ` MP_TAC; +REWRITE_TAC[INJ]; +REPEAT STRIP_TAC; +REWRITE_TAC[IN_IMAGE]; +EXISTS_TAC` x': real^3 `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` (s: real^3 -> bool) IN E `; +EXPAND_TAC "E"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; + +ASM_CASES_TAC` x' = (y:real^3) `; +DOWN THEN SIMP_TAC[]; +REPLICATE_TAC 6 DOWN THEN PHA; +NHANH ( +MESON[SET2_DETER]` x' IN s /\ + y IN s /\ + f x' = f y /\ + v IN V /\ + s = {v, rho_node1 FF v} /\ + ~(x' = y) ==> s = {x', y} `); +STRIP_TAC; +SUBGOAL_THEN` IMAGE (f: real^3 -> real^3 ) s IN E' ` ASSUME_TAC; +DOWN; +ASM_REWRITE_TAC[IMAGE_CLAUSES]; +EXPAND_TAC "E'"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC `v: real^3 `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` FAN (vec 0,V': real^3 -> bool,E') `; +REWRITE_TAC[FAN; fan6]; +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` IMAGE (f:real^3 -> real^3) s `)); +DOWN; +UNDISCH_TAC` s = {x', y:real^3} `; +SIMP_TAC[IMAGE_CLAUSES; Local_lemmas.INSERT_UNION2; UNION_EMPTY]; +ASM_REWRITE_TAC[INSERT_INSERT; COLLINEAR_2]; +NHANH ORD_PAIRS_INJ_IMAGE; +REWRITE_TAC[GSYM ord_pairs]; + + + + + + + + + + +SUBGOAL_THEN` (IMAGE (\s. IMAGE (f:real^3 -> real^3) s) E) = E': (real^3 -> bool) -> bool ` MP_TAC; +REWRITE_TAC[EXTENSION; IN_IMAGE]; +GEN_TAC; +EQ_TAC; +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC o (SPEC` a: real^3 `)); +EXPAND_TAC "E'"; +REWRITE_TAC[IN_ELIM_THM]; +DOWN THEN DOWN; +EXPAND_TAC "E"; +REWRITE_TAC[IN_ELIM_THM]; +REPEAT STRIP_TAC; +EXISTS_TAC` v: real^3 `; +ASM_REWRITE_TAC[]; +REPLICATE_TAC 4 DOWN THEN PHA; +CONV_TAC SET_RULE; + + + + +EXPAND_TAC "E'"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +EXISTS_TAC` {v, rho_node1 FF v }`; +ASM_REWRITE_TAC[]; +EXPAND_TAC "E"; +DOWN THEN DOWN; +CONV_TAC SET_RULE; +SIMP_TAC[]; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` self_pairs E (V:real^3 -> bool) = {} ` MP_TAC; +REWRITE_TAC[self_pairs; EE; SET_RULE` s = {} <=> ! x. ~ ( x IN s) `; IN_ELIM_THM]; +GEN_TAC; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` rho_node1 FF v `)); +PHA; +EXPAND_TAC "E"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` v: real^3 `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` darts_of_hyp E V = FF UNION {(v:real^3),w | w,v IN FF} `; +DISCH_THEN (SUBST1_TAC o SYM); +SIMP_TAC[darts_of_hyp; UNION_EMPTY]; + + +MP_TAC BIJ_AND_MAP_COMM; +ANTS_TAC; +ASM_REWRITE_TAC[BIJ]; + +MP_TAC NODE_EDGE_COMM_LEMMA; +ANTS_TAC; +ASM_REWRITE_TAC[BIJ]; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +REPEAT STRIP_TAC; +DOWN; +NHANH (ISPEC `ff: real^3 # real^3 -> real^3 # real^3 ` FUN_IN_IMAGE); +STRIP_TAC; +ASM_REWRITE_TAC[Wrgcvdr_cizmrrh.ee_of_hyp2]; +UNDISCH_TAC` x' IN FF UNION {v,w | w:real^3,v IN FF} `; +REWRITE_TAC[IN_ELIM_THM]; +SUBGOAL_THEN` x' IN FF UNION {v:real^3,w | w,v IN FF} ==> ? a b. x' = (a,b) ` MP_TAC; +EXPAND_TAC "FF"; +REWRITE_TAC[IN_UNION; IN_ELIM_THM]; +MESON_TAC[]; +DISCH_THEN NHANH; +STRIP_TAC; +DOWN; +SIMP_TAC[]; +EXPAND_TAC "ff"; +SIMP_TAC[]]);; + + + + +let POWER_COMM = +REWRITE_RULE[IN_UNIV] (SPEC` (:A) ` Hypermap_iso.power_comm);; + +let ITER_COMM = +REWRITE_RULE[Wrgcvdr_cizmrrh.POWER_TO_ITER] POWER_COMM;; + + + + +let IMAGE_FACE_F = prove_by_refinement( +` hyp_iso (f: A -> B) (H,HH) ==> ! x . x IN dart H ==> IMAGE f (face H x ) = face HH ( f x ) `, +[REWRITE_TAC[hyp_iso]; +STRIP_TAC THEN GEN_TAC THEN STRIP_TAC; +REWRITE_TAC[EXTENSION; face; orbit_map; IN_ELIM_THM]; +SUBGOAL_THEN`! x n. x IN dart H ==> (face_map HH POWER n) ((f:A -> B) x) = +f ((face_map H POWER n) (x)) ` ASSUME_TAC; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +MATCH_MP_TAC ( +REWRITE_RULE[TAUT` a ==> b ==> c <=> a /\ b ==> c `] Hypermap_iso.power_comm); +ASM_SIMP_TAC[Hypermap.lemma_dart_invariant]; + + +ASM_SIMP_TAC[IN_IMAGE; IN_ELIM_THM]; +MESON_TAC[]]);; + + + + + +let COMM_BIJ_HAS_SAME_ORDS = prove_by_refinement(`BIJ f (:A) (:B) /\ + (! x. (f o h) x = (g o (f: A -> B)) x ) +/\ has_orders h k +==> has_orders g k`, +[REWRITE_TAC[has_orders]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` i: num `)); +DOWN; +PHA; +REWRITE_TAC[FUN_EQ_THM]; +GEN_TAC; +UNDISCH_TAC` BIJ f (:A) (:B) `; +REWRITE_TAC[BIJ; INJ]; +STRIP_TAC; +FIRST_ASSUM MATCH_MP_TAC; +REWRITE_TAC[IN_UNIV]; +UNDISCH_TAC` !x. (f o h) x = (g o (f:A -> B)) x `; +REWRITE_TAC[o_THM]; +NHANH ITER_COMM; +SIMP_TAC[]; +STRIP_TAC; +ASM_REWRITE_TAC[I_THM]; + +DOWN_TAC; +REWRITE_TAC[o_THM]; +NHANH ITER_COMM; +STRIP_TAC; +SIMP_TAC[FUN_EQ_THM]; +UNDISCH_TAC` BIJ f (:A) (:B) `; +REWRITE_TAC[BIJ; INJ; SURJ]; +STRIP_TAC; +GEN_TAC; +SUBGOAL_THEN` x IN (:B) ` MP_TAC; +REWRITE_TAC[IN_UNIV]; +FIRST_X_ASSUM NHANH; +STRIP_TAC; +EXPAND_TAC "x"; +UNDISCH_TAC` !x n. f (ITER n h x) = ITER n g ((f: A -> B) x) `; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +SIMP_TAC[]; +STRIP_TAC; +ASM_REWRITE_TAC[I_THM]]);; + + + + + + +let DIH2K_HYP_ISO_LEMMA = prove_by_refinement +(` BIJ f (:A) (:B) /\ +FINITE (dart (H: (A) hypermap) ) /\ dih2k H k /\ hyp_iso (f: A -> B) (H, HH) +==> dih2k HH k `, +[NHANH IMAGE_FACE_F; +REWRITE_TAC[dih2k; hyp_iso]; +STRIP_TAC; +CONJ_TAC; +SUBGOAL_THEN` CARD (dart (H: (A) hypermap )) = CARD (dart (HH:(B) hypermap)) ` MP_TAC; +MATCH_MP_TAC (Local_lemmas.BIJ_IMP_CARD_EQ); +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +CONJ_TAC; +GEN_TAC; +LET_TAC; +STRIP_TAC; +UNDISCH_TAC` BIJ (f: A -> B) (dart H) (dart HH) `; +NHANH Add_triangle.BIJ_IMAGE; +REWRITE_TAC[BIJ; SURJ]; +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` x: B `)); +DOWN THEN STRIP_TAC; + + +SUBGOAL_THEN` (let S = face (H: (A) hypermap) y in dart H = S UNION IMAGE (node_map H) S) ` MP_TAC; +FIRST_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +LET_TAC; + +SUBGOAL_THEN` IMAGE f (face H (y:A)) = face HH ((f: A -> B) (y:A)) ` MP_TAC; +FIRST_ASSUM MATCH_MP_TAC; +FIRST_X_ASSUM ACCEPT_TAC; + +ASM_REWRITE_TAC[]; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[GSYM IMAGE_o]; +UNDISCH_TAC` (y:A) IN dart H ` ; +NHANH Hypermap.lemma_face_subset; +STRIP_TAC; + +SUBGOAL_THEN` IMAGE (node_map HH o (f: A -> B)) S' = IMAGE (f o (node_map H )) S' ` ASSUME_TAC; +MATCH_MP_TAC Lvducxu.IDE_ON_S_IMP_SAME_IMAGE; +GEN_TAC THEN DOWN; +ASM_SIMP_TAC[SUBSET]; +DISCH_THEN NHANH; +ASM_SIMP_TAC[o_THM]; +ASM_REWRITE_TAC[]; + +REWRITE_TAC[IMAGE_o; GSYM IMAGE_UNION]; +SIMP_TAC[]; + +SUBGOAL_THEN`!x. (x:A) IN dart H <=> ((f x): B) IN dart HH ` ASSUME_TAC; +UNDISCH_TAC` BIJ (f: A -> B) (dart H ) (dart HH ) ` ; +UNDISCH_TAC ` BIJ f (:A) (:B) ` ; +REWRITE_TAC[BIJ; INJ; SURJ]; +STRIP_TAC THEN STRIP_TAC; +GEN_TAC THEN EQ_TAC; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM NHANH; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPECL [` y: A `;` x: A `])); +FIRST_X_ASSUM (MP_TAC o (SPECL [` y: A `;` x: A `])); +ANTS_TAC; +ASM_REWRITE_TAC[IN_UNIV]; +ASM_SIMP_TAC[]; +DISCH_THEN SUBST_ALL_TAC; +FIRST_ASSUM ACCEPT_TAC; + +CONJ_TAC; +MATCH_MP_TAC (GEN_ALL COMM_BIJ_HAS_SAME_ORDS); +EXISTS_TAC` f: A -> B `; +EXISTS_TAC` face_map (H: (A) hypermap)`; +ASM_REWRITE_TAC[]; +GEN_TAC; +ASM_CASES_TAC` (x:A) IN dart H `; +ASM_SIMP_TAC[o_THM]; + +DOWN; +NHANH Lvducxu.NOT_IN_DART_IMP_IDE; +ASM_REWRITE_TAC[]; +NHANH Lvducxu.NOT_IN_DART_IMP_IDE; +SIMP_TAC[o_THM]; + +CONJ_TAC; +MATCH_MP_TAC (GEN_ALL COMM_BIJ_HAS_SAME_ORDS); +EXISTS_TAC` f: A -> B `; +EXISTS_TAC` edge_map (H: (A) hypermap)`; + +ASM_REWRITE_TAC[]; +GEN_TAC; +ASM_CASES_TAC` (x:A) IN dart H `; +ASM_SIMP_TAC[o_THM]; + +DOWN; +NHANH Lvducxu.NOT_IN_DART_IMP_IDE; +ASM_REWRITE_TAC[]; +NHANH Lvducxu.NOT_IN_DART_IMP_IDE; +SIMP_TAC[o_THM]; + +MATCH_MP_TAC (GEN_ALL COMM_BIJ_HAS_SAME_ORDS); +EXISTS_TAC` f: A -> B `; +EXISTS_TAC` node_map (H: (A) hypermap)`; + +ASM_REWRITE_TAC[]; +GEN_TAC; +ASM_CASES_TAC` (x:A) IN dart H `; +ASM_SIMP_TAC[o_THM]; + +DOWN; +NHANH Lvducxu.NOT_IN_DART_IMP_IDE; +ASM_REWRITE_TAC[]; +NHANH Lvducxu.NOT_IN_DART_IMP_IDE; +SIMP_TAC[o_THM]]);; + + + + + + +let AUTOMAP_IMP_ALL_ITER_IN2 = +MESON[IN; Trigonometry2.AUTOMAP_IMP_ALL_ITER_IN] ` +p IN W /\ (!x. x IN W ==> f x IN W) ==> ITER N f p IN W `;; + + +let ITER_COMM_RESTRICTED = prove_by_refinement(` (!(x:A). x IN V ==> f x IN V') /\ + (!x. h x IN V <=> x IN V) /\ + (!(y:B). g y IN V' <=> y IN V') /\ +(!x. x IN V ==> f (h x) = g (f x)) +==> ! x. x IN V ==> f (ITER n h x) = ITER n g ( f x ) `, +[ +STRIP_TAC; +SPEC_TAC (`n:num `,`n:num `); +INDUCT_TAC; +REWRITE_TAC[ITER]; + +GEN_TAC THEN STRIP_TAC; +REWRITE_TAC[ITER]; +SUBGOAL_THEN` ITER n h (x:A) IN V ` ASSUME_TAC; +MATCH_MP_TAC AUTOMAP_IMP_ALL_ITER_IN2; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` x:A `)); +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` ITER n h (x:A) `)); +ASM_REWRITE_TAC[]]);; + + + +let HAS_THE_SAME_ORD_LEM = prove_by_refinement(` (! x. ~( x IN V ) ==> h x = x ) /\ +(! y. ~( y IN V') ==> g y = y ) /\ +BIJ (f: A -> B) V V' /\ +(! x. (h x IN V) <=> x IN V ) /\ +(! y. (g y IN V') <=> y IN V' ) /\ +(!x. x IN V ==> (f (h x )) = (g (f x ))) /\ has_orders h k + ==> has_orders g k `, +[REWRITE_TAC[BIJ; INJ; SURJ; has_orders]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` i:num `)); +DOWN; +PHA; +REWRITE_TAC[FUN_EQ_THM]; +GEN_TAC; +ASM_CASES_TAC` (x:A) IN V `; +UNDISCH_TAC` !x y. x IN V /\ y IN V /\ (f: A -> B) x = f y ==> x = y ` ; +DISCH_THEN MATCH_MP_TAC; +ASM_REWRITE_TAC[I_THM]; +CONJ_TAC; +MATCH_MP_TAC AUTOMAP_IMP_ALL_ITER_IN2; +ASM_REWRITE_TAC[]; +MP_TAC (SPEC `i:num ` (GEN `n:num ` ITER_COMM_RESTRICTED)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +DISCH_THEN (ASSUME_TAC2 o (SPEC` x: A `)); +ASM_REWRITE_TAC[I_THM]; + +REWRITE_TAC[I_THM]; +MATCH_MP_TAC ITER_FIXPOINT; +DOWN; +ASM_REWRITE_TAC[]; + +REWRITE_TAC[FUN_EQ_THM; I_THM]; +GEN_TAC; +ASM_CASES_TAC` x IN (V': B -> bool) `; + + +DOWN; +UNDISCH_TAC` !x. x IN V' ==> (?y. y IN V /\ (f: A -> B) y = x) `; +DISCH_THEN NHANH; +STRIP_TAC; + +MP_TAC (let tt = GEN` n: num ` ITER_COMM_RESTRICTED in SPEC` k: num ` tt); +ANTS_TAC; +ASM_REWRITE_TAC[]; +DISCH_THEN (ASSUME_TAC2 o (SPEC` y: A `)); +DOWN; +ASM_REWRITE_TAC[I_THM]; +MESON_TAC[]; +MATCH_MP_TAC ITER_FIXPOINT; +ASM_SIMP_TAC[]]);; + + + + +let COMM_THEN_IMAGE_IMAGE_EQ = +SET_RULE ` (! x. x IN S ==> f ( g x ) = h ( f x )) /\ A SUBSET S +==> IMAGE f ( IMAGE g A ) = IMAGE h ( IMAGE f A ) `;; + + +let IN_DART_PRESERVED = prove(` (!x: A. face_map H x IN dart H <=> x IN dart H) /\ +(!x: A. node_map H x IN dart H <=> x IN dart H) /\ +(!x: A. edge_map H x IN dart H <=> x IN dart H)`, +MESON_TAC [Hypermap_iso.h_map_outside; Hypermap.lemma_dart_invariant]);; + + +let HYP_ISO_DIH2K_PRESERVED = prove_by_refinement +(`FINITE (dart H) /\ dih2k H k /\ hyp_iso (f: A -> B) (H,HH) + ==> dih2k HH k `, +[NHANH Hypermap_iso.iso_components; +REWRITE_TAC[dih2k; hyp_iso]; +STRIP_TAC; +CONJ_TAC; +ASSUME_TAC2 ( +let tt = GEN_ALL Local_lemmas.BIJ_IMP_CARD_EQ in +ISPECL [` f: A -> B `;` dart (H: (A) hypermap) `;` dart (HH: (B) hypermap) `] tt); +DOWN; +ASM_SIMP_TAC[]; + +CONJ_TAC; +GEN_TAC THEN STRIP_TAC; +DOWN; +UNDISCH_TAC ` BIJ (f: A -> B) ( dart H ) ( dart HH ) `; +REWRITE_TAC[BIJ; SURJ]; +STRIP_TAC; +FIRST_ASSUM NHANH; +STRIP_TAC; +LET_TAC; +SUBGOAL_THEN` (let S = face H (y:A) in dart H = S UNION IMAGE (node_map H) S) ` MP_TAC; +FIRST_ASSUM MATCH_MP_TAC; +FIRST_ASSUM ACCEPT_TAC; +LET_TAC; +SUBGOAL_THEN` node HH (f y) = IMAGE f (node H y) /\ + face HH (f y) = IMAGE f (face H y) /\ + edge HH ((f: A -> B) y) = IMAGE f (edge H y) ` MP_TAC; +FIRST_ASSUM MATCH_MP_TAC; +FIRST_ASSUM ACCEPT_TAC; +ASM_REWRITE_TAC[]; + +SIMP_TAC[]; +PHA THEN STRIP_TAC; +SUBGOAL_THEN` IMAGE (f: A -> B) (IMAGE (node_map H) S') = IMAGE (node_map HH) (IMAGE f S') ` ASSUME_TAC; +MATCH_MP_TAC (GEN_ALL COMM_THEN_IMAGE_IMAGE_EQ); +EXISTS_TAC` dart (H: (A) hypermap ) `; +UNDISCH_TAC` !x. x IN dart H + ==> edge_map HH ((f: A -> B) x) = f (edge_map H x) /\ + node_map HH (f x) = f (node_map H x) /\ + face_map HH (f x) = f (face_map H x) `; +SIMP_TAC[]; +STRIP_TAC; +EXPAND_TAC "S'"; +MATCH_MP_TAC Hypermap.lemma_face_subset; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +REWRITE_TAC[GSYM IMAGE_UNION]; +SUBGOAL_THEN` BIJ (f: A -> B) (dart H ) (dart HH ) ` MP_TAC; +ASM_REWRITE_TAC[BIJ; SURJ]; +NHANH Add_triangle.BIJ_IMAGE; +SIMP_TAC[]; +ASM_REWRITE_TAC[]; + +ASSUME_TAC Hypermap_iso.h_map_outside; + +CONJ_TAC; +MATCH_MP_TAC (GEN_ALL HAS_THE_SAME_ORD_LEM); +EXISTS_TAC` dart (HH: (B) hypermap) `; +EXISTS_TAC` dart (H: (A) hypermap) `; +EXISTS_TAC` f: A -> B `; +EXISTS_TAC` face_map (H: (A) hypermap ) `; +ASM_REWRITE_TAC[]; +DOWN THEN SIMP_TAC[]; +DISCH_THEN NHANH; + +NHANH ( +ISPECL [` HH: (B) hypermap `;` y:B `] Hypermap_iso.h_map_outside); +SIMP_TAC[IN_DART_PRESERVED]; +ASM_SIMP_TAC[]; + + +CONJ_TAC; +MATCH_MP_TAC (GEN_ALL HAS_THE_SAME_ORD_LEM); +EXISTS_TAC` dart (HH: (B) hypermap) `; +EXISTS_TAC` dart (H: (A) hypermap) `; +EXISTS_TAC` f: A -> B `; +EXISTS_TAC` edge_map (H: (A) hypermap ) `; +ASM_REWRITE_TAC[]; +DOWN THEN SIMP_TAC[]; +DISCH_THEN NHANH; + +NHANH ( +ISPECL [` HH: (B) hypermap `;` y:B `] Hypermap_iso.h_map_outside); +SIMP_TAC[IN_DART_PRESERVED]; +ASM_SIMP_TAC[]; + +MATCH_MP_TAC (GEN_ALL HAS_THE_SAME_ORD_LEM); +EXISTS_TAC` dart (HH: (B) hypermap) `; +EXISTS_TAC` dart (H: (A) hypermap) `; +EXISTS_TAC` f: A -> B `; +EXISTS_TAC` node_map (H: (A) hypermap ) `; +ASM_REWRITE_TAC[]; +DOWN THEN SIMP_TAC[]; +DISCH_THEN NHANH; + +NHANH ( +ISPECL [` HH: (B) hypermap `;` y:B `] Hypermap_iso.h_map_outside); +SIMP_TAC[IN_DART_PRESERVED]; +ASM_SIMP_TAC[]]);; + + + + + +let CONT_ATREAL_INJ_PRESERVED = prove_by_refinement( +` FINITE V /\ (!v. v IN V ==> (ff: real^N -> real -> real^M) v continuous atreal r) /\ +INJ (\v. ff v r ) V (IMAGE (\v. ff v r ) V ) +==> ? e. &0 < e /\ (! t. abs ( t - r) < e ==> +INJ (\v. ff v t ) V (IMAGE (\v. ff v t ) V )) `, +[REWRITE_TAC[INJ]; +STRIP_TAC; +MP_TAC (SPEC_ALL Local_lemmas1.CONTINUOUS_ATREAL_INJ_PRESERVED); +ANTS_TAC; +ASM_REWRITE_TAC[]; +ANTS_TAC; +ASM_REWRITE_TAC[]; +DOWN; +MESON_TAC[]; +STRIP_TAC; +EXISTS_TAC` d : real `; +ASM_REWRITE_TAC[]; +GEN_TAC; +FIRST_X_ASSUM NHANH; +REWRITE_TAC[IN_IMAGE]; +MESON_TAC[]]);; + + +let INJ_BIJ_IMAGE = prove(` INJ f S S' /\ A SUBSET S ==> BIJ f A (IMAGE f A) `, +REWRITE_TAC[BIJ; INJ; SURJ] THEN CONV_TAC SET_RULE);; + + + + + +let XRECQNS_UPDATE = prove_by_refinement(` deformation f V (a,b) /\ local_fan (V,E,FF) + ==> (?e. &0 < e /\ + (!t. abs t < e + ==> local_fan (IMAGE (\v. f v t) V, +IMAGE (\s. IMAGE (\v. f v t) s ) E , +IMAGE (\(u,v). (f u t, f v t )) FF) )) `, + +[NHANH_PAT `\x. x ==> y ` Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN; +STRIP_TAC; +ASSUME_TAC2 Deformation.XRECQNS; +DOWN THEN PHA; +REWRITE_TAC[REAL_BOUNDS_LT]; +STRIP_TAC; +DOWN_TAC; +REWRITE_TAC[deformation]; +STRIP_TAC; +UNDISCH_TAC` FAN (vec 0, V:real^3 -> bool, E ) `; +REWRITE_TAC[FAN; fan1; fan2]; +STRIP_TAC; +SUBGOAL_THEN` FINITE V /\ + (!v. v IN V ==> (f: real^3 -> real -> real^3) v continuous atreal (&0)) /\ + INJ (\v. f v (&0)) V (IMAGE (\v. f v (&0)) V) ` MP_TAC; +ASM_REWRITE_TAC[]; +CONJ_TAC; +GEN_TAC THEN STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPECL [` v:real^3 `;` &0 `])); +DOWN THEN SIMP_TAC[]; +UNDISCH_TAC` !v. v IN V ==> f v (&0) = v:real^3 `; +REWRITE_TAC[INJ; IN_IMAGE]; +MESON_TAC[]; +NHANH ( +ISPECL [` f: real^3 -> real -> real^3 `;` &0 `] ( +GENL [` ff: real^N -> real -> real^M `;` r: real `] CONT_ATREAL_INJ_PRESERVED)); +STRIP_TAC; +DOWN THEN REWRITE_TAC[REAL_ARITH` a - &0 = a `]; +STRIP_TAC; +EXISTS_TAC ` min e e' `; +ASM_REWRITE_TAC[REAL_LT_MIN]; +FIRST_ASSUM NHANH; +SUBGOAL_THEN` ! f s. INJ (f:real^3 -> real^3) s (IMAGE f s) <=> BIJ f s (IMAGE f s ) ` ASSUME_TAC; +REWRITE_TAC[BIJ; SURJ; IN_IMAGE]; +MESON_TAC[]; + + +ASM_REWRITE_TAC[]; +GEN_TAC THEN STRIP_TAC; +ABBREV_TAC` V' = IMAGE (\v. (f:real^3 -> real -> real^3) v t) V `; +ABBREV_TAC` E' = IMAGE (\s. IMAGE (\v. (f: real^3 -> real -> real^3) v t) s) E `; +ABBREV_TAC` ff = (\(x,y). (f:real^3 -> real -> real^3) x t, f y t) `; + +MP_TAC (SPEC` (\v. (f:real^3 -> real -> real^3) v t ) ` ( +GEN ` f: real^3 -> real^3 ` HYP_ISO_LEMMAA)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` FAN (vec 0,IMAGE (\v. (f: real^3 -> real -> real^3) v t) V,IMAGE (IMAGE (\v. f v t)) E) ` MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; + +EXPAND_TAC "V'"; +EXPAND_TAC "E'"; +SIMP_TAC[ETA_AX]; + +SUBGOAL_THEN` FAN (vec 0,IMAGE (\v. (f: real^3 -> real -> real^3) v t) V,IMAGE (IMAGE (\v. f v t)) E) ` MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +DOWN THEN DOWN THEN DOWN; +SIMP_TAC[ETA_AX; local_fan]; +REPEAT STRIP_TAC; + + +LET_TAC; +UNDISCH_TAC` local_fan (V,E,FF) `; +REWRITE_TAC[local_fan]; +LET_TAC; +STRIP_TAC; +UNDISCH_TAC` hyp_iso (ff: real^3 # real^3 -> real^3 # real^3) (H',H) `; +NHANH IMAGE_FACE_F; +STRIP_TAC; +CONJ_TAC; +EXISTS_TAC ` (ff: real^3 # real^3 -> real^3 # real^3) x `; +DOWN THEN DOWN; +REWRITE_TAC[hyp_iso; BIJ; INJ]; +ASM_SIMP_TAC[]; + +MATCH_MP_TAC ( +let tt = GEN_ALL HYP_ISO_DIH2K_PRESERVED in +ISPECL [` (ff: real^3 # real^3 -> real^3 # real^3 ) `;` H': (real^3 #real^3) hypermap `; ` H: (real^3 #real^3) hypermap `; ` k: num `] tt); +ASM_REWRITE_TAC[]; + +ASSUME_TAC2 (ISPEC` vec 0: real^3 ` ( +GEN` x: real^N ` Wrgcvdr_cizmrrh.FAN_IMP_FIMITE_DARTS)); +UNDISCH_TAC` FAN (vec 0, V:real^3 -> bool , E ) `; +NHANH Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP; +ASM_SIMP_TAC[]; +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` x: real^3 # real^3 `)); +FIRST_X_ASSUM (SUBST1_TAC o SYM); +UNDISCH_TAC` (x: real^3 # real^3) IN dart H' `; +NHANH Hypermap.lemma_face_subset; +STRIP_TAC; +SUBGOAL_THEN` FINITE (face H' (x:real^3 # real^3 )) ` MP_TAC; +REWRITE_TAC[Hypermap.FACE_FINITE]; +UNDISCH_TAC` hyp_iso (ff: real^3 # real^3 -> real^3 # real^3 ) (H', H) `; +REWRITE_TAC[hyp_iso; BIJ]; +NHANH INJ_IMP_BIJ_IMAGE; +STRIP_TAC; +STRIP_TAC; + +UNDISCH_TAC` face H' (x: real^3 # real^3) SUBSET dart H' `; +UNDISCH_TAC` INJ (ff: real^3 # real^3 -> real^3 # real^3 ) (dart H') (dart H) `; +PHA; +NHANH INJ_BIJ_IMAGE; +STRIP_TAC; +DOWN; +UNDISCH_TAC` FINITE (face H' (x: real^3 # real^3)) `; +PHA; +NHANH Misc_defs_and_lemmas.BIJ_CARD; +STRIP_TAC; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +UNDISCH_TAC` dih2k (H': (real^3 # real^3) hypermap) (CARD (FF: real^3 # real^3 -> bool)) `; +ASM_REWRITE_TAC[]]);; + + + + + + +let NORM_CROSS_LE = prove_by_refinement(` norm ( u cross v) <= norm u * norm v `, +[MP_TAC (SPEC_ALL Trigonometry1.cross_mag); +SIMP_TAC[]; +MP_TAC SIN_BOUNDS; +ONCE_REWRITE_TAC[REAL_ARITH` a <= b <=> &0 <= b - a `]; +REWRITE_TAC[REAL_ARITH` a * b - a * b * c = a * b * ( &1 - c ) `]; +MP_TAC NORM_POS_LE; +REPEAT STRIP_TAC; +ASM_MESON_TAC[REAL_LE_MUL; NORM_POS_LE]]);; + + + + + +let CONT_ATREAL_REAL_CONTS = prove_by_refinement (` f continuous atreal r +==> (\r. ((f r) cross y ) dot ( x cross y)) real_continuous atreal r `, +[REWRITE_TAC[real_continuous_atreal; continuous_atreal]; +REPEAT STRIP_TAC; +REWRITE_TAC[GSYM DOT_LSUB]; +REWRITE_TAC[VEC3_RULE` x cross y - z cross y = ( x - z) cross y `]; +ASM_CASES_TAC` (y:real^3) = vec 0 `; +ASM_REWRITE_TAC[CROSS_RZERO; DOT_RZERO; REAL_ABS_0]; +EXISTS_TAC` e: real `; +ASM_REWRITE_TAC[]; +ASM_CASES_TAC` (x:real^3) = vec 0 `; +ASM_REWRITE_TAC[CROSS_LZERO; DOT_RZERO; REAL_ABS_0]; +EXISTS_TAC` e:real `; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM (MP_TAC o (SPEC` e / (norm (x:real^3) * norm (y:real^3) * norm (y:real^3) ) `)); +ANTS_TAC; +MATCH_MP_TAC REAL_LT_DIV; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC REAL_LT_MUL; +ASM_REWRITE_TAC[NORM_POS_LT]; +MATCH_MP_TAC REAL_LT_MUL; +ASM_REWRITE_TAC[NORM_POS_LT]; +STRIP_TAC; +EXISTS_TAC` d:real `; +FIRST_X_ASSUM NHANH; +ASM_REWRITE_TAC[]; + +REPEAT STRIP_TAC; +MP_TAC (ISPECL [` ( f (x': real) - f r ) cross y `;` x cross y `] NORM_CAUCHY_SCHWARZ_ABS); +ASSUME_TAC (SPECL [` (f:real -> real^3) x' - f r `;` y: real^3 `] (GEN_ALL NORM_CROSS_LE)); +MATCH_MP_TAC (REAL_ARITH` b < c ==> a <= b ==> a < c `); + +SUBGOAL_THEN` norm ((f (x':real) - f r) cross y) * norm (x cross y) <= (norm ( f x' - f r) * norm y ) * norm (x cross y ) ` ASSUME_TAC; +MATCH_MP_TAC REAL_LE_RMUL; +ASM_REWRITE_TAC[NORM_POS_LE]; + +DOWN; +MATCH_MP_TAC (REAL_ARITH` b < c ==> a <= b ==> a < c `); + +MP_TAC ( +SPECL [` x:real^3 `;` y: real^3 `] (GEN_ALL NORM_CROSS_LE)); +STRIP_TAC; +SUBGOAL_THEN` &0 <= norm ((f: real -> real^3) x' - f r) * norm (y:real^3) ` ASSUME_TAC; +MATCH_MP_TAC REAL_LE_MUL; +REWRITE_TAC[NORM_POS_LE]; +UNDISCH_TAC` norm (x cross y) <= norm x * norm y `; +DOWN THEN PHA; +NHANH Real_ext.REAL_LE_RMUL_IMP; +DOWN THEN DOWN; +REWRITE_TAC[dist]; +REPEAT STRIP_TAC; +ONCE_REWRITE_TAC[REAL_MUL_SYM]; +DOWN; +MATCH_MP_TAC (REAL_ARITH` b < c ==> a <= b ==> a < c `); +SUBGOAL_THEN ` &0 < norm (x:real^3) /\ &0 < norm (y:real^3) ` MP_TAC; +ASM_REWRITE_TAC[NORM_POS_LT]; +STRIP_TAC; +ONCE_REWRITE_TAC[REAL_ARITH` (x * y ) * a * y = a * x * y * y `]; +SUBGOAL_THEN` &0 < norm (x:real^3) * norm y * norm (y:real^3) ` MP_TAC; +DOWN THEN DOWN; +MESON_TAC[REAL_LT_MUL]; +UNDISCH_TAC` norm ((f:real -> real^3) x' - f r) < e / (norm (x:real^3) * norm y * norm (y:real^3)) `; +PHA; +NHANH REAL_LT_RMUL; +STRIP_TAC THEN DOWN; +ASM_SIMP_TAC[REAL_FIELD` &0 < a ==> e / a * a = e `]]);; + + + + + + + + +let CONTINUOUS_POS_PRES = prove_by_refinement ( +` ~ collinear {(x:real^3),y, vec 0} /\ f r = a % x + b % y /\ &0 < a /\ +f continuous atreal r +==> ? e. &0 < e /\ ! t. abs t < e ==> ! t1 t2. f ( r + t ) = t1 % x + t2 % y ==> &0 < t1 `, +[NHANH CONT_ATREAL_REAL_CONTS; +REWRITE_TAC[real_continuous_atreal]; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPEC` a * norm ( x cross y ) * norm ( x cross y ) `)); +ANTS_TAC; +MATCH_MP_TAC REAL_LT_MUL; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC REAL_LT_MUL; +REWRITE_TAC[TAUT` a /\ a <=> a `]; +REWRITE_TAC[NORM_POS_LT; CROSS_EQ_0]; +UNDISCH_TAC` ~collinear {x, y:real^3, vec 0} `; +SIMP_TAC[INSERT_COMM]; +STRIP_TAC; +EXISTS_TAC` d: real `; ASM_REWRITE_TAC[] ; +GEN_TAC; +REPEAT STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPEC` r + (t:real) `)); +ANTS_TAC; +ASM_REWRITE_TAC[REAL_ARITH` (a + b) - a = b `]; + +ASM_REWRITE_TAC[GSYM DOT_LSUB; VEC3_RULE` x cross z - y cross z = ( x - y) cross z `]; +REWRITE_TAC[VECTOR_ARITH` (t1 % x + t2 % y) - (a % x + b % y) = ( t1 - a ) % x + ( t2 - b ) % y `; CROSS_LADD; CROSS_LMUL; CROSS_REFL]; +REWRITE_TAC[VECTOR_ARITH` x + a % vec 0 = x `; DOT_LMUL; REAL_ABS_MUL; DOT_SQUARE_NORM]; +SUBGOAL_THEN` &0 <= norm (x cross y) pow 2 ` MP_TAC; +REWRITE_TAC[REAL_LE_POW_2]; + +REWRITE_TAC[GSYM REAL_ABS_REFL]; +SIMP_TAC[REAL_POW_2]; + +REWRITE_TAC[REAL_ABS_REFL]; +REWRITE_TAC[REAL_ARITH` &0 <= a <=> a = &0 \/ &0 < a `]; +STRIP_TAC; +ASM_SIMP_TAC[]; +REAL_ARITH_TAC; +ASM_SIMP_TAC[REAL_LT_RMUL_EQ]; +UNDISCH_TAC` &0 < a `; +REAL_ARITH_TAC]);; + + + + + +let IVS_RHO_NODE_V_IN_FF = prove_by_refinement(` local_fan (V,E,FF) /\ v IN V ==> ivs_rho_node1 FF v, v IN FF `, +[NHANH Local_lemmas.LOCAL_FAN_RHO_NODE_PROS2; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC`ivs_rho_node1 FF v `)); +ANTS_TAC; +MATCH_MP_TAC Local_lemmas1.LOCAL_FAN_IVS_IN_V; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 Local_lemmas1.LOCAL_FAN_RHO_NODE_IVS; +ASM_REWRITE_TAC[]]);; + + + + + +let IN_AFF_GT_IMP_AZIMEQ = prove_by_refinement( +` x IN aff_gt {u,v} {y} ==> azim u v w x = azim u v w y `, +[ +ASM_CASES_TAC` collinear {u,v,w:real^3} `; +ASM_SIMP_TAC[AZIM_DEGENERATE]; +ASM_CASES_TAC` collinear {u,v,y:real^3} `; +ASM_SIMP_TAC[AZIM_DEGENERATE]; +DOWN_TAC; +NHANH Fan.th3b; +STRIP_TAC; +DOWN THEN DOWN; +ASM_SIMP_TAC[COLLINEAR_3_AFFINE_HULL]; +MP_TAC (ISPECL [` {u, v:real^3} `;` {y:real^3} `] AFF_GT_SUBSET_AFFINE_HULL); +REWRITE_TAC[SUBSET]; +DISCH_THEN NHANH; +REPEAT STRIP_TAC; +SUBGOAL_THEN` affine hull ({u, v:real^3} UNION {y}) = affine hull {u,v} ` ASSUME_TAC; +MATCH_MP_TAC AFFINE_HULLS_EQ; +REWRITE_TAC[SET_RULE` {a,b} UNION {c} = {c,a,b} `]; +CONJ_TAC; +ONCE_REWRITE_TAC[INSERT_SUBSET]; +ASM_REWRITE_TAC[]; +REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]; +MP_TAC (SPEC` {u,v:real^3} ` Qzksykg.SET_SUBSET_AFFINE_HULL); +MATCH_MP_TAC (SET_RULE` a SUBSET b ==> c SUBSET a ==> c SUBSET b `); +MATCH_MP_TAC HULL_MONO; +CONV_TAC SET_RULE; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN; +ASM_SIMP_TAC[GSYM COLLINEAR_3_AFFINE_HULL; AZIM_DEGENERATE]; +DOWN_TAC; +REWRITE_TAC[AZIM_EQ_IMP]]);; + + + + +let IN_AFF_GT_IMP_AZIMEQ2 = +MESON[IN_AFF_GT_IMP_AZIMEQ]` x IN aff_gt {u, v} {y} ==> +! w. azim u v w x = azim u v w y `;; + + + + + +let NOT_COLL_IMP_ZERO_DETER = prove_by_refinement(` ~ collinear {vec 0, u, v } ==> +(! a b. a % u + b % v = vec 0 <=> a = &0 /\ b = &0) `, +[REWRITE_TAC[Local_lemmas1.COLL_EQ_DEPENDENT]; +STRIP_TAC; +GEN_TAC THEN GEN_TAC; +EQ_TAC; +DOWN; +MESON_TAC[]; +SIMP_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID]]);; + + + +let CROSS_IN_SAME_DIRECTION = prove_by_refinement (` local_fan (V,E,FF) /\ + v IN V /\ + {ITER n (rho_node1 FF) v | n <= l} = U /\ + plane P /\ + vec 0 IN P /\ + U SUBSET P /\ +v cross rho_node1 FF v = e + ==> (!i. i < l + ==> ? k. &0 < k /\ +ITER i (rho_node1 FF) v cross ITER ( i + 1) (rho_node1 FF ) v = k % e ) `, +[NHANH Local_lemmas.RHO_NODE_SET_IN_A_PLANE_IMP_POS_DIRECT; +ASM_CASES_TAC` l = 0 `; +ASM_REWRITE_TAC[ARITH_RULE` ~( n < 0) `]; +STRIP_TAC; +SUBGOAL_THEN` {vec 0, v, rho_node1 FF v } SUBSET P ` ASSUME_TAC; +ONCE_REWRITE_TAC[INSERT_SUBSET]; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC SUBSET_TRANS; +EXISTS_TAC` U: real^3 -> bool `; +ASM_REWRITE_TAC[]; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +EXPAND_TAC "U"; +REWRITE_TAC[IN_ELIM_THM]; +CONJ_TAC; +EXISTS_TAC` 0 `; +REWRITE_TAC[ITER; ARITH_RULE` 0 <= l `]; +EXISTS_TAC` 1 `; +REWRITE_TAC[ITER1]; +MATCH_MP_TAC (ARITH_RULE` ~( l = 0) ==> 1 <= l `); +ASM_REWRITE_TAC[]; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2; +DOWN THEN DOWN; +PHA; +UNDISCH_TAC` plane (P: real^3 -> bool) `; +PHA; +NHANH Local_lemmas.THREE_NOT_COLL_DETER_PLANE; +STRIP_TAC; +NHANH (ARITH_RULE` i < (l:num) ==> i <= l /\ i + 1 <= l `); +GEN_TAC THEN STRIP_TAC; +SUBGOAL_THEN` ITER i (rho_node1 FF) v IN U /\ ITER (i + 1) (rho_node1 FF) v IN U` ASSUME_TAC; +EXPAND_TAC "U"; +REWRITE_TAC[IN_ELIM_THM]; +DOWN THEN DOWN; +MESON_TAC[]; + +DOWN; +UNDISCH_TAC` U SUBSET (P: real^3 -> bool) `; +REWRITE_TAC[SUBSET]; +DISCH_THEN NHANH ; +EXPAND_TAC "P"; +REWRITE_TAC[IN_ELIM_THM; AFFINE_HULL_3]; +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC ` i:num `)); +DOWN; +ASM_REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID; CROSS_LADD; CROSS_RADD]; +REWRITE_TAC[CROSS_LMUL; CROSS_RMUL; CROSS_REFL; VECTOR_MUL_LZERO; VECTOR_MUL_RZERO]; +REWRITE_TAC[VECTOR_ADD_LID; VECTOR_ADD_RID]; +ASM_REWRITE_TAC[VECTOR_MUL_ASSOC]; +ONCE_REWRITE_TAC[CROSS_SKEW]; +ASM_REWRITE_TAC[VECTOR_ARITH` (v' * w') % e + (w * v'') % --e = ((v' * w') - (w * v'')) % e `]; +REWRITE_TAC[DOT_LMUL]; +UNDISCH_TAC` ~collinear {vec 0, v, rho_node1 FF v} `; +ASM_REWRITE_TAC[GSYM CROSS_EQ_0]; +REWRITE_TAC[GSYM DOT_POS_LT]; +SIMP_TAC[REAL_LT_MUL_EQ]; +STRIP_TAC; +MESON_TAC[]]);; + + + + + +let ITER_CROSS_SAME_DIRECTION = prove_by_refinement +(`local_fan (V,E,FF) /\ + v IN V /\ + {ITER n (rho_node1 FF) v | n <= l} = U /\ + plane P /\ + vec 0 IN P /\ + U SUBSET P + ==> (!i j. i < l /\ j < l + ==> ? k. &0 < k /\ +ITER i (rho_node1 FF) v cross ITER ( i + 1) (rho_node1 FF ) v = +k % (ITER j (rho_node1 FF) v cross ITER ( j + 1) (rho_node1 FF ) v) ) `, +[STRIP_TAC; +ABBREV_TAC ` e = v cross rho_node1 FF v `; +ASSUME_TAC2 CROSS_IN_SAME_DIRECTION; +FIRST_X_ASSUM NHANH; +REPEAT STRIP_TAC; +ASM_REWRITE_TAC[]; +EXISTS_TAC` k / (k': real) `; +CONJ_TAC; +MATCH_MP_TAC REAL_LT_DIV; +ASM_REWRITE_TAC[]; +ASM_SIMP_TAC[REAL_FIELD` &0 < a ==> x / a * a = x `; VECTOR_MUL_ASSOC]]);; + + + +let ITER_IN_AFF_GT_2_1 = prove_by_refinement(` local_fan (V,E,FF) /\ + v IN V /\ + {ITER n (rho_node1 FF) v | n <= l} = U /\ + plane P /\ + vec 0 IN P /\ + U SUBSET P +==> (! i. i < l - 1 ==> +ITER ( i + 2) (rho_node1 FF) v IN aff_lt {vec 0, ITER (i + 1) (rho_node1 FF) v } {ITER i (rho_node1 FF ) v } ) `, +[STRIP_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE3; +GEN_TAC; +FIRST_X_ASSUM (ASSUME_TAC o (SPEC` i:num `)); +STRIP_TAC; +SUBGOAL_THEN` {vec 0, ITER i (rho_node1 FF) v, ITER ( i + 1) (rho_node1 FF) v} SUBSET P` ASSUME_TAC; +ONCE_REWRITE_TAC[INSERT_SUBSET]; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC SUBSET_TRANS; +EXISTS_TAC` U: real^3 -> bool`; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +EXPAND_TAC "U"; +REWRITE_TAC[IN_ELIM_THM]; +CONJ_TAC; +EXISTS_TAC` i:num `; +ASM_REWRITE_TAC[]; +DOWN; +ARITH_TAC; + +EXISTS_TAC` i + 1 `; +ASM_REWRITE_TAC[]; +DOWN; +ARITH_TAC; +UNDISCH_TAC` ~collinear + {vec 0, ITER i (rho_node1 FF) v, ITER (i + 1) (rho_node1 FF) v} `; +UNDISCH_TAC` {vec 0, ITER i (rho_node1 FF) v, ITER (i + 1) (rho_node1 FF) v} SUBSET + P `; +UNDISCH_TAC` plane (P:real^3 -> bool) `; +PHA; +NHANH Local_lemmas.THREE_NOT_COLL_DETER_PLANE; +STRIP_TAC; +SUBGOAL_THEN` ITER (i + 2) (rho_node1 FF) v IN U ` MP_TAC; +EXPAND_TAC "U"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` i + 2 `; +REWRITE_TAC[]; +UNDISCH_TAC` i < l - 1 `; +ARITH_TAC; +UNDISCH_TAC` (U:real^3 -> bool) SUBSET P `; +REWRITE_TAC[SUBSET]; +STRIP_TAC; +FIRST_ASSUM NHANH; +EXPAND_TAC "P"; +REWRITE_TAC[IN_ELIM_THM; AFFINE_HULL_3]; +STRIP_TAC; +MP_TAC ITER_CROSS_SAME_DIRECTION; +ANTS_TAC; +ASM_REWRITE_TAC[SUBSET]; +DISCH_THEN (MP_TAC o (SPECL [` i + 1`;` i:num `])); +ASSUME_TAC2 (ARITH_RULE` i < l - 1 ==> i + 1 < l `); +ASSUME_TAC2 (ARITH_RULE` i < l - 1 ==> i < l `); +ANTS_TAC; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[ARITH_RULE` (a + 1) + 1 = a + 2 `; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +REWRITE_TAC[CROSS_RADD; CROSS_RMUL; CROSS_REFL; VECTOR_MUL_RZERO; VECTOR_ADD_RID]; +STRIP_TAC; +DOWN; +ABBREV_TAC` e1 = ITER i (rho_node1 FF) v cross ITER (i + 1) (rho_node1 FF) v `; +ONCE_REWRITE_TAC[CROSS_SKEW; VECTOR_ARITH` a % -- x = ( -- a ) % x `]; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` ~( e1:real^3 = vec 0) ` MP_TAC; +EXPAND_TAC "e1"; +REWRITE_TAC[CROSS_EQ_0]; +ASM_REWRITE_TAC[]; +SIMP_TAC[VECTOR_MUL_RCANCEL; VECTOR_ARITH` a % -- x = ( -- a ) % x `]; +STRIP_TAC THEN STRIP_TAC; + + +UNDISCH_TAC` ~collinear + {vec 0, ITER i (rho_node1 FF) v, ITER (i + 1) (rho_node1 FF) v} `; +ONCE_REWRITE_TAC[Collect_geom.PER_SET2]; +NHANH Fan.th3a; +NHANH AFF_LT_2_1; +SIMP_TAC[Collect_geom.PER_SET2]; +STRIP_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC `u: real `; +EXISTS_TAC` w: real `; +EXISTS_TAC` v':real`; +ASM_REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +CONJ_TAC; +UNDISCH_TAC` --v' = (k: real) `; +UNDISCH_TAC ` &0 < k `; +REAL_ARITH_TAC; +CONJ_TAC; +UNDISCH_TAC` u + v' + w = &1 `; +REAL_ARITH_TAC; +CONV_TAC VECTOR_ARITH]);; + + + +(* +search[` v cross rho_node1 FF v `];; +*) + +let AZIM_PI_ITER_LOCAL_FAN = prove_by_refinement +(`local_fan (V,E,FF) /\ + v IN V /\ + {ITER n (rho_node1 FF) v | n <= l} = U /\ + plane P /\ + vec 0 IN P /\ + U SUBSET P +==> (!i. i < l - 1 + ==> azim (vec 0) (ITER (i + 1) (rho_node1 FF ) v ) (ITER (i) (rho_node1 FF ) v ) (ITER (i + 2) (rho_node1 FF ) v ) = pi ) `, +[NHANH ITER_IN_AFF_GT_2_1; +STRIP_TAC; +GEN_TAC; +FIRST_X_ASSUM NHANH; +STRIP_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE3; +FIRST_ASSUM (MP_TAC o (SPEC` i: num `)); +FIRST_ASSUM (MP_TAC o (SPEC` i + 1`)); +STRIP_TAC; +ONCE_REWRITE_TAC[Collect_geom.PER_SET2]; +DOWN THEN DOWN; +DOWN; +REWRITE_TAC[ARITH_RULE` (a + 1) + 1 = a + 2 `]; +MESON_TAC[AZIM_EQ_PI_ALT]]);; + + + + +let LOCAL_CONVEX_NOT_COLLINEAR = prove_by_refinement +(`convex_local_fan (V,E,FF) /\ lunar (v,w) V E + ==> (!u. u IN V /\ ~(u = v) /\ ~(u = w) + ==> ~ collinear {vec 0, v, u}) `, +[NHANH LUNAR_IMP_IN_TWO_HAFLS_PLANE; +REWRITE_TAC[lunar; INSERT_SUBSET]; +NHANH Local_lemmas.CVX_LO_IMP_LO; +STRIP_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_NOT_COLL_IVS; +FIRST_X_ASSUM NHANH; +GEN_TAC; +DOWN THEN DOWN; +MESON_TAC[Planarity.aff_gt_imp_not_collinear]]);; + + +let LOCAL_CONVEX_NOT_COLLINEAR2 = prove(` convex_local_fan (V,E,FF) /\ lunar (v,w) V E + ==> (!u. u IN V /\ ~(u = v) /\ ~(u = w) ==> ~collinear {vec 0, w, u})`, +ONCE_REWRITE_TAC[Local_lemmas.LUNAR_COMM] THEN +NHANH LOCAL_CONVEX_NOT_COLLINEAR THEN MESON_TAC[]);; + + + +let LOCAL_FAN_RHO_NODE_PROS2 = prove(` local_fan (V,E,FF) + ==> (!x. x IN V ==> x,rho_node1 FF x IN FF) `, NHANH Local_lemmas.LOCAL_FAN_RHO_NODE_PROS THEN SIMP_TAC[]);; + + + +(* ============================= +-====================================== +================================ + +*) + +let MHAEYJN_CONVEX_LOCAL_FAN = prove_by_refinement ( +`!a b V E FF f v w u. + convex_local_fan (V,E,FF) /\ + lunar (v,w) V E /\ + deformation f V (a,b) /\ + interior_angle1 (vec 0) FF v < pi /\ + u IN V /\ + ~(u = v) /\ + ~(u = w) /\ + (!u' t. u' IN V /\ ~(u = u') /\ t IN real_interval (a,b) ==> f u' t = u') /\ + (!t. t IN real_interval (a,b) ==> f u t IN affine hull {vec 0, v, w, u}) + ==> (?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> convex_local_fan + (IMAGE (\v. f v t) V, + IMAGE (IMAGE (\v. f v t)) E, + IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) + ))`, +[REPEAT GEN_TAC; +NHANH_PAT`\x. x ==> y ` Local_lemmas.CVX_LO_IMP_LO; +NHANH_PAT`\x. x ==> y ` Local_lemmas.LOCAL_FAN_FINITE_V; +NHANH Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN; +REWRITE_TAC[FAN; UNIONS_SUBSET]; +STRIP_TAC; +MP_TAC SUB_LUNAR_DEFORM_LEMMA; +ANTS_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` deformation f (V:real^3 -> bool) (a,b) `; +REWRITE_TAC[deformation; real_interval; IN_ELIM_THM]; +ASM_SIMP_TAC[]; +REWRITE_TAC[REAL_BOUNDS_LT]; +STRIP_TAC; +ASSUME_TAC2 XRECQNS_UPDATE; +ASSUME_TAC2 HKIRPEP_ALT; +DOWN THEN DOWN THEN STRIP_TAC; +STRIP_TAC; + +SUBGOAL_THEN` ! x y. x IN V /\ y IN V /\ ~ collinear {vec 0, x, y} /\ +(? a b . +(f:real^3 -> real -> real^3) u (&0) = a % x + b % y /\ &0 < a ) ==> +(?e. &0 < e /\ + (!t. abs t < e + ==> (!t1 t2. f u (t) = t1 % x + t2 % y ==> &0 < t1))) ` ASSUME_TAC; + +SUBGOAL_THEN` deformation (f:real^3 -> real -> real^3) V (a,b) ` MP_TAC; +ASM_REWRITE_TAC[]; +REWRITE_TAC[deformation]; +STRIP_TAC; +REPEAT GEN_TAC THEN STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPECL [`u: real^3 `;` &0 `])); +REPEAT GEN_TAC; + +ONCE_REWRITE_TAC[MESON[REAL_ARITH` t = &0 + t `]` f u t = A <=> f u ( &0 + t ) = A `]; +MATCH_MP_TAC (GEN_ALL CONTINUOUS_POS_PRES); +EXISTS_TAC` b': real `; +EXISTS_TAC` a': real `; +UNDISCH_TAC` ~ collinear {vec 0, x, y:real^3} `; +ASM_REWRITE_TAC[INSERT_COMM]; +ABBREV_TAC` ss = { (x,y) | x IN V /\ + y IN V /\ + ~collinear {vec 0, x, y} /\ + (?a b. (f:real^3 -> real -> real^3) u (&0) = a % x + b % y /\ &0 < a) } ` ; +SUBGOAL_THEN` ss SUBSET { (x,y) | x IN (V:real^3 -> bool) /\ y IN V} ` MP_TAC; +EXPAND_TAC "ss"; +CONV_TAC SET_RULE; +STRIP_TAC; +SUBGOAL_THEN` FINITE {x,y | x IN (V:real^3 -> bool) /\ y IN V} ` ASSUME_TAC; +MATCH_MP_TAC FINITE_PRODUCT; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` ss SUBSET {x,y | x IN V /\ (y:real^3) IN V} `; +UNDISCH_TAC` FINITE {x,y | x IN V /\ y:real^3 IN V} `; +PHA; +NHANH FINITE_SUBSET; +STRIP_TAC; + +SUBGOAL_THEN` (!x. (x:real^3 # real^3) IN ss ==> +(?e. &0 < e /\ (!t. abs t < e + ==> (!t1 t2. (f:real^3 -> real -> real^3) u t = t1 % (FST x) + t2 % (SND x) ==> &0 < t1))))` MP_TAC; +EXPAND_TAC "ss"; +REWRITE_TAC[IN_ELIM_THM]; +GEN_TAC; +STRIP_TAC; +ASM_SIMP_TAC[]; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +EXISTS_TAC` a': real `; +EXISTS_TAC` b': real `; +ASM_REWRITE_TAC[]; +DOWN; +PHA; +NHANH Deformation.MINIMIZE_OVER_MEMBERS; +STRIP_TAC; +EXISTS_TAC` min b ( min (-- a) ( min e (min e' e''))) `; +SUBGOAL_THEN` deformation f (V: real^3 -> bool) (a,b) ` MP_TAC; +ASM_REWRITE_TAC[]; +REWRITE_TAC[deformation; real_interval; IN_ELIM_THM]; +STRIP_TAC; +REWRITE_TAC[REAL_LT_MIN]; +CONJ_TAC; +ASM_REWRITE_TAC[REAL_ARITH` &0 < -- a <=> a < &0 `]; + +REWRITE_TAC[convex_local_fan]; +GEN_TAC THEN STRIP_TAC; +ABBREV_TAC` IV = IMAGE (\v. (f:real^3 -> real -> real^3) v t) V `; +ABBREV_TAC` IE = IMAGE (IMAGE (\v. (f: real^3 -> real -> real^3) v t)) E`; +ABBREV_TAC` IF = IMAGE (\uv. (f: real^3 -> real -> real^3) (FST uv) t,f (SND uv) t) FF `; +SUBGOAL_THEN` local_fan (IV, IE , IF) ` MP_TAC; +UNDISCH_TAC` !t. abs t < e' + ==> local_fan + (IMAGE (\v. f v t) V, + IMAGE (\s. IMAGE (\v. f v t) s) E, + IMAGE (\(u,v). (f: real^3 -> real -> real^3) u t,f v t) FF) `; +DISCH_THEN (ASSUME_TAC2 o SPEC_ALL); +DOWN; +UNDISCH_TAC` v = ITER j (rho_node1 FF) w `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[ETA_AX]; +SUBGOAL_THEN`! (fg: real^3 -> real^3). (\(u:real^3,v:real^3). fg u,fg v) = (\uv. fg (FST uv),fg (SND uv)) ` ASSUME_TAC; +REWRITE_TAC[FUN_EQ_THM; BETA_THM]; +GEN_TAC THEN GEN_TAC; +PAT_ONCE_REWRITE_TAC`\x. f x = y ` [GSYM PAIR]; +PURE_ONCE_REWRITE_TAC[BETA_THM]; +ABBREV_TAC` x1 = FST (x:real^3 # real^3) `; +ABBREV_TAC` x2 = SND (x:real^3 # real^3) `; +REWRITE_TAC[BETA_THM]; +ASM_REWRITE_TAC[]; + +SIMP_TAC[] THEN STRIP_TAC; +GEN_TAC; + +UNDISCH_TAC` local_fan (IV, IE, IF) `; +PHA; PAT_ONCE_REWRITE_TAC`\x. y /\ x ==> z ` [GSYM PAIR]; +ABBREV_TAC` xx = FST (x:real^3 # real^3) `; +NHANH Local_lemmas.LOCAL_FAN_IMP_IN_V; +NHANH Local_lemmas.DETER_RHO_NODE; +STRIP_TAC; +ONCE_REWRITE_TAC[GSYM PAIR]; +ABBREV_TAC` xy = SND (x:real^3 # real^3) `; +UNDISCH_TAC` xx:real^3 IN IV `; +UNDISCH_TAC` local_fan (IV,IE,IF) `; +PHA; +UNDISCH_TAC` rho_node1 IF xx = xy `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; + + +NHANH Local_lemmas1.AZIM_IN_FAN_RHOND_IVS_RHOND; +NHANH Local_lemmas1.WEDGE_IN_FAN_RHOND_IVS_RHOND; +SIMP_TAC[]; +STRIP_TAC; +ASSUME_TAC2 LOCAL_FAN_FACE_FF; +SUBGOAL_THEN` lunar (v:real^3,w) V E ` MP_TAC; +FIRST_ASSUM ACCEPT_TAC; +REWRITE_TAC[lunar; INSERT_SUBSET]; +STRIP_TAC; +ASSUME_TAC2 Localization.LOFA_IMP_LT_CARD_SET_V_ALT; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` u: real^3 `)); +DOWN THEN STRIP_TAC; +ASSUME_TAC2 (SPEC`u: real^3 ` Local_lemmas1.IVS_RHO_NODE_DIFF_ID); +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` u: real^3 `)); +SUBGOAL_THEN`! v:real^3. v IN V ==> ivs_rho_node1 FF (rho_node1 FF v) = v ` ASSUME_TAC; +GEN_TAC; +STRIP_TAC; +MATCH_MP_TAC Local_lemmas.IVS_RHO_IDD; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN`!v. v IN V ==> rho_node1 FF (ivs_rho_node1 FF v) = v ` MP_TAC; +GEN_TAC; +STRIP_TAC; +MATCH_MP_TAC Local_lemmas1.LOCAL_FAN_RHO_NODE_IVS; +ASM_REWRITE_TAC[]; +STRIP_TAC; + +SUBGOAL_THEN` ! v. v: real^3 IN V ==> rho_node1 FF v IN V ` ASSUME_TAC; +GEN_TAC THEN STRIP_TAC; +MATCH_MP_TAC Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; +ASM_SIMP_TAC[]; +SUBGOAL_THEN` deformation f (V: real^3 -> bool) (a,b) ` MP_TAC; +ASM_REWRITE_TAC[]; +REWRITE_TAC[deformation]; +STRIP_TAC; +SUBGOAL_THEN` t IN real_interval (a,b) ` ASSUME_TAC; +REWRITE_TAC[IN_ELIM_THM; real_interval]; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` abs t < b `; +UNDISCH_TAC` abs t < -- a `; +REAL_ARITH_TAC; +ASSUME_TAC2 Polar_fan.IVS_RHO_NODE1_IN_V; +SUBGOAL_THEN` (f:real^3 -> real -> real^3) (rho_node1 FF u) t = rho_node1 FF u ` ASSUME_TAC; +FIRST_ASSUM MATCH_MP_TAC; +ASM_SIMP_TAC[]; +SUBGOAL_THEN` (f:real^3 -> real -> real^3) (rho_node1 FF (rho_node1 FF u)) t = rho_node1 FF (rho_node1 FF u )` ASSUME_TAC; +FIRST_ASSUM MATCH_MP_TAC; +ASM_SIMP_TAC[]; +SUBGOAL_THEN` (f:real^3 -> real -> real^3) (ivs_rho_node1 FF u) t = ivs_rho_node1 FF u ` ASSUME_TAC; +FIRST_ASSUM MATCH_MP_TAC; +ASM_SIMP_TAC[]; + +ASSUME_TAC2 Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM_IVS; +DOWN THEN DISCH_THEN (ASSUME_TAC o GSYM); +UNDISCH_TAC` xx: real^3 IN IV `; +EXPAND_TAC "IV"; +REWRITE_TAC[IN_IMAGE]; +STRIP_TAC; +SUBGOAL_THEN` ! (v:real^3). v IN V ==> (f:real^3 -> real -> real^3) v t, f (rho_node1 FF v) t IN IF ` ASSUME_TAC; +EXPAND_TAC "IF"; +REWRITE_TAC[IN_IMAGE]; +EXPAND_TAC "FF"; +REWRITE_TAC[IN_ELIM_THM]; +GEN_TAC THEN STRIP_TAC; +EXISTS_TAC` v', rho_node1 FF v' `; +UNDISCH_TAC` w = ITER i (rho_node1 FF) v `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +EXISTS_TAC` v': real^3 `; +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN` ! (v:real^3). v IN V ==> rho_node1 IF ((f:real^3 -> real -> +real^3) v t ) = f ( rho_node1 FF v ) t ` ASSUME_TAC; +GEN_TAC THEN STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC2 o (SPEC` v': real^3 `)); +DOWN; +UNDISCH_TAC` local_fan (IV, IE, IF) `; +PHA; +NHANH Local_lemmas.DETER_RHO_NODE; +SIMP_TAC[]; +SUBGOAL_THEN` ! (v:real^3). v IN V ==> ivs_rho_node1 IF ((f:real^3 -> real -> +real^3) v t ) = f ( ivs_rho_node1 FF v ) t ` ASSUME_TAC; +GEN_TAC THEN STRIP_TAC; +SUBGOAL_THEN` f (ivs_rho_node1 FF v') t, (f:real^3 -> real -> real^3) v' t IN IF ` ASSUME_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` ivs_rho_node1 FF v' `)); +FIRST_X_ASSUM (MP_TAC o (SPEC` ivs_rho_node1 FF v' `)); +ANTS_TAC; +ASM_SIMP_TAC[]; +ASM_SIMP_TAC[]; +DOWN; +UNDISCH_TAC` local_fan (IV, IE, IF) `; +PHA; +NHANH Local_lemmas.IVS_RHO_NODE1_DETE; +SIMP_TAC[]; +SUBGOAL_THEN` IV SUBSET (f:real^3 -> real -> real^3) u t INSERT V ` ASSUME_TAC; +REWRITE_TAC[SUBSET]; +EXPAND_TAC "IV"; +REWRITE_TAC[IN_IMAGE]; +GEN_TAC THEN STRIP_TAC; +ASM_CASES_TAC` x''' = (u: real^3) `; +ASM_REWRITE_TAC[IN_INSERT]; +ASM_SIMP_TAC[IN_INSERT]; + +UNDISCH_TAC` x': real^3 IN V `; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` (f:real^3 -> real -> real^3) (ivs_rho_node1 FF (ivs_rho_node1 FF u)) t = ivs_rho_node1 FF (ivs_rho_node1 FF u) ` ASSUME_TAC; +FIRST_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +CONJ_TAC; +ASM_SIMP_TAC[]; +ASM_SIMP_TAC[]; +UNDISCH_TAC` !v. v IN V ==> ~(rho_node1 FF (rho_node1 FF v) = v) `; +DISCH_THEN (MP_TAC o (SPEC` ivs_rho_node1 FF (ivs_rho_node1 FF u) `)); +ANTS_TAC; +ASM_SIMP_TAC[]; +ASM_SIMP_TAC[]; + +SUBGOAL_THEN` convex_local_fan (V,E,FF) ` MP_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +REWRITE_TAC[convex_local_fan]; +STRIP_TAC; + + +ASSUME_TAC2 LOCAL_FAN_RHO_NODE_PROS2; +SUBGOAL_THEN` ! v. v IN V + ==> wedge_in_fan_ge (v ,rho_node1 FF v) E = + wedge_ge (vec 0) v (rho_node1 FF v) (ivs_rho_node1 FF v) ` ASSUME_TAC; +GEN_TAC; +STRIP_TAC; +MATCH_MP_TAC Local_lemmas1.WEDGE_IN_FAN_RHOND_IVS_RHOND; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` ! v. v IN V + ==> azim_in_fan (v,rho_node1 FF v) E = + azim (vec 0) v (rho_node1 FF v) (ivs_rho_node1 FF v) ` ASSUME_TAC; +GEN_TAC; +STRIP_TAC; +MATCH_MP_TAC Local_lemmas1.AZIM_IN_FAN_RHOND_IVS_RHOND; +ASM_REWRITE_TAC[]; + +(* ----- *) +ASSUME_TAC2 Local_lemmas.LUNAR_IMP_INTERIOR_ANGLE1_EQ_PI; +DOWN; +NHANH IN_CONV0_IMP_AFF_EQ1; +STRIP_TAC; +SUBGOAL_THEN` w IN aff {vec 0, v:real^3 } ` ASSUME_TAC; +UNDISCH_TAC` w = ITER i (rho_node1 FF ) v `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +MP_TAC (SPEC` {vec 0, w:real^3} ` Qzksykg.SET_SUBSET_AFFINE_HULL); +REWRITE_TAC[SUBSET; Sphere.aff]; +DISCH_THEN MATCH_MP_TAC; +REWRITE_TAC[IN_INSERT]; + + +SUBGOAL_THEN` ! v:real^3. v IN V ==> ~collinear {vec 0, v, ivs_rho_node1 FF v} ` ASSUME_TAC; +UNDISCH_TAC` v = ITER j (rho_node1 FF ) w `; +DISCH_THEN (ASSUME_TAC o SYM); +GEN_TAC THEN STRIP_TAC; +MATCH_MP_TAC Local_lemmas.LOFA_IMP_NOT_COLL_IVS; +ASM_REWRITE_TAC[]; + + +ASSUME_TAC2 LUNAR_IMP_IN_TWO_HAFLS_PLANE; +SUBGOAL_THEN` ! x. x IN V /\ ~( x = v ) /\ ~( x = w:real^3) ==> +~ collinear {vec 0, v, x} ` ASSUME_TAC; +DOWN THEN PHA; +STRIP_TAC; +FIRST_ASSUM NHANH; +GEN_TAC; + + + +SUBGOAL_THEN` ~collinear {vec 0, v, ivs_rho_node1 FF v} /\ +~collinear {vec 0, v, rho_node1 FF v} ` MP_TAC; +ASM_SIMP_TAC[]; +MESON_TAC[Planarity.aff_gt_imp_not_collinear]; +ASM_SIMP_TAC[]; + + + + + + +SUBGOAL_THEN` ! x. x IN V /\ ~( x = v ) /\ ~( x = w:real^3) ==> +rho_node1 FF x IN aff_ge {vec 0, v} {x} /\ ivs_rho_node1 FF x IN aff_ge {vec 0, v} {x} ` ASSUME_TAC; +DOWN THEN DOWN THEN PHA THEN STRIP_TAC; +GEN_TAC; +FIRST_ASSUM NHANH; +STRIP_TAC; +SUBGOAL_THEN` x'': real^3 IN V ` MP_TAC; +FIRST_ASSUM ACCEPT_TAC; +EXPAND_TAC "V"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +UNDISCH_TAC` ~collinear {vec 0, v, x'':real^3} `; +NHANH Fan.th3a; +STRIP_TAC; +DOWN; +MP_TAC (SET_RULE` {} SUBSET {x'':real^3}`); +PHA; +NHANH AFF_GE_MONO_RIGHT; +REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL; GSYM aff]; +STRIP_TAC; +ASM_CASES_TAC` n = 0 `; +UNDISCH_TAC` x'' = ITER n (rho_node1 FF) v `; +UNDISCH_TAC` v = ITER j (rho_node1 FF ) w `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[ITER]; +UNDISCH_TAC` v = ITER j (rho_node1 FF ) w `; +DISCH_THEN (ASSUME_TAC o SYM); +UNDISCH_TAC` w = ITER i (rho_node1 FF ) v `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_CASES_TAC` n = (i:num) `; +UNDISCH_TAC` x'' = ITER n (rho_node1 FF) v `; +ASM_REWRITE_TAC[]; +ASSUME_TAC AFF_GT_SUBSET_AFF_GE; + + +ASM_CASES_TAC` n < (i:num) `; +SUBGOAL_THEN` x'' IN {ITER l (rho_node1 FF) v | 0 < l /\ l < i} ` MP_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` n: num` ; +ASM_REWRITE_TAC[ARITH_RULE` 0 < n <=> ~( n = 0) `]; + +ASM_REWRITE_TAC[IN_INTER]; +UNDISCH_TAC` x'' = ITER n (rho_node1 FF) v `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN` ~ collinear {vec 0, v, rho_node1 FF v} ` MP_TAC; +ASM_SIMP_TAC[]; +NHANH Fan.th3a; +NHANH Local_lemmas1.DIJ_AFF_GE_PARTITION; +STRIP_TAC; +UNDISCH_TAC` ~collinear {vec 0, v, rho_node1 FF v} `; +PHA; +NHANH Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` ~ collinear {vec 0, v, x'': real^3} ` MP_TAC; +ASM_SIMP_TAC[]; +NHANH Fan.th3a; +NHANH Local_lemmas1.DIJ_AFF_GE_PARTITION; +ASM_SIMP_TAC[]; + + +STRIP_TAC; +UNDISCH_TAC` aff {vec 0, v} = aff {vec 0, w: real^3} `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +CONJ_TAC; +ASM_CASES_TAC` n = (i - 1) `; +EXPAND_TAC "x''"; +REWRITE_TAC[GSYM ITER]; +ASM_SIMP_TAC[ARITH_RULE` ~( i = 0) ==> SUC ( i - 1) = i `; IN_UNION]; +SUBGOAL_THEN` rho_node1 FF x'' IN {ITER l (rho_node1 FF) v | 0 < l /\ l < i} ` MP_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` SUC n `; +EXPAND_TAC "x''"; +REWRITE_TAC[GSYM ITER]; +REWRITE_TAC[ARITH_RULE` 0 < SUC n `]; +MATCH_MP_TAC (ARITH_RULE` n < i /\ ~( n = i - 1) ==> SUC n < i `); +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[IN_UNION; IN_INTER]; +SIMP_TAC[]; +ASM_CASES_TAC` n = 1`; +DOWN; +EXPAND_TAC "x''"; +SIMP_TAC[ITER1]; +ASM_SIMP_TAC[]; +SIMP_TAC[IN_UNION]; +REWRITE_TAC[aff]; +STRIP_TAC; +DISJ1_TAC; +MESON_TAC[HULL_SUBSET; IN_INSERT; SUBSET]; + +SUBGOAL_THEN` ivs_rho_node1 FF x'' IN {ITER l (rho_node1 FF) v | 0 < l /\ l < i} ` MP_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` n - 1 `; +EXPAND_TAC "x''"; +ASSUME_TAC2 (ARITH_RULE`~( n = 0) ==> SUC ( n - 1) = n `); +EXPAND_TAC "n"; +REWRITE_TAC[ITER]; +SUBGOAL_THEN` ITER (n - 1) (rho_node1 FF) v IN V ` ASSUME_TAC; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ORBIT_MAP_VITER; +ASM_SIMP_TAC[]; + +ASM_SIMP_TAC[]; +UNDISCH_TAC` ~( n = 0) `; +UNDISCH_TAC` ~( n = 1) `; +UNDISCH_TAC` n < (i:num) `; +ARITH_TAC; +ASM_REWRITE_TAC[IN_INTER; IN_UNION]; +SIMP_TAC[]; + +ASSUME_TAC2 (ARITH_RULE` ~( n < (i:num) ) ==> (n - i) + i = n `); +SUBGOAL_THEN` x'' IN {ITER l (rho_node1 FF) w | 0 < l /\ l < j} ` MP_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` n - (i:num) `; +ASM_REWRITE_TAC[]; +EXPAND_TAC "n"; +REWRITE_TAC[GSYM ITER_ADD]; +ASM_REWRITE_TAC[]; +CONJ_TAC; +UNDISCH_TAC` ~( n = (i:num)) `; +UNDISCH_TAC` ~( n < (i:num)) `; +ARITH_TAC; +ASM_SIMP_TAC[ARITH_RULE` ~( n < (i:num)) ==> ( n - i < j <=> n < i + j )`]; + +UNDISCH_TAC` x'' = ITER n (rho_node1 FF) v `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[IN_INTER]; + +SUBGOAL_THEN` ~ collinear {vec 0, v, ivs_rho_node1 FF v}` MP_TAC; +ASM_SIMP_TAC[]; +PHA; +NHANH Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +STRIP_TAC; +SUBGOAL_THEN` ~ collinear {vec 0, v, x'':real^3} ` MP_TAC; +ASM_SIMP_TAC[]; +NHANH Fan.th3a; +NHANH Local_lemmas1.DIJ_AFF_GE_PARTITION; +SIMP_TAC[]; +STRIP_TAC; +CONJ_TAC; +ASM_REWRITE_TAC[]; +ASM_CASES_TAC` n = (i + j) - 1 `; +EXPAND_TAC "x''"; +REWRITE_TAC[GSYM ITER]; +ASM_SIMP_TAC[]; +ASSUME_TAC2 (ARITH_RULE` n < CARD (V:real^3 -> bool) ==> SUC (CARD V - 1) = CARD V `); +ASM_REWRITE_TAC[]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID; +FIRST_ASSUM (ASSUME_TAC2 o SPEC_ALL); +ASM_REWRITE_TAC[IN_UNION]; +UNDISCH_TAC` aff {vec 0, v:real^3} = aff {vec 0, w} `; +DISCH_THEN (SUBST1_TAC o SYM); +REWRITE_TAC[aff]; +MESON_TAC[HULL_SUBSET; IN_INSERT; SUBSET]; + + +SUBGOAL_THEN` rho_node1 FF x'' IN {ITER l (rho_node1 FF) w | 0 < l /\ l < j} ` MP_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXPAND_TAC "x''"; +REWRITE_TAC[GSYM ITER]; +ASM_SIMP_TAC[ARITH_RULE` ~( n < i ) ==> SUC n = SUC ( n - i ) + i `]; +REWRITE_TAC[GSYM ITER_ADD]; +ASM_REWRITE_TAC[]; +EXISTS_TAC ` SUC ( n - i ) `; +REWRITE_TAC[]; +UNDISCH_TAC` n < CARD (V:real^3 -> bool) `; +UNDISCH_TAC` i + j = CARD (V: real^3 -> bool) `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +UNDISCH_TAC` ~( n < (i:num)) `; +UNDISCH_TAC` ~ ( n = ( i + j ) - 1) `; +ARITH_TAC; +ASM_REWRITE_TAC[IN_INTER; IN_UNION]; +SIMP_TAC[]; + +ASM_CASES_TAC` n = i + 1 `; +REWRITE_TAC[IN_UNION]; +EXPAND_TAC "x''"; +FIRST_ASSUM SUBST1_TAC; +REWRITE_TAC[GSYM ADD1; ITER]; +ASM_SIMP_TAC[aff]; +MESON_TAC[HULL_SUBSET; SUBSET; IN_INSERT]; + + +SUBGOAL_THEN` ivs_rho_node1 FF x'' IN {ITER l (rho_node1 FF) w | 0 < l /\ l < j} ` ASSUME_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXPAND_TAC "x''"; +ASSUME_TAC2 (ARITH_RULE` ~( n < (i:num) ) /\ ~(n = i + 1) /\ ~( n = i ) ==> SUC ( n - 1 - i ) + i = n `); +EXPAND_TAC "n"; +REWRITE_TAC[GSYM ITER_ADD; ITER]; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` ITER (n - 1 - i) (rho_node1 FF) w IN V ` ASSUME_TAC; +ASM_SIMP_TAC[]; +ASSUME_TAC2 Local_lemmas.LOCAL_FAN_ORBIT_MAP_VITER; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; + + +ASM_SIMP_TAC[]; +EXISTS_TAC` n - 1 - i `; +ASM_REWRITE_TAC[]; +CONJ_TAC; +UNDISCH_TAC` ~(n = i + 1) `; +UNDISCH_TAC` ~( n < (i:num) ) `; +UNDISCH_TAC` ~( n = (i:num)) `; +ARITH_TAC; +UNDISCH_TAC` n < CARD (V:real^3 -> bool) `; +UNDISCH_TAC` i + j = CARD (V:real^3 -> bool) `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +UNDISCH_TAC` ~( n < i:num ) `; +UNDISCH_TAC` ~( n = i:num ) `; +ARITH_TAC; +DOWN; +ASM_REWRITE_TAC[IN_INTER; IN_UNION]; +SIMP_TAC[]; + +SUBGOAL_THEN` ! u:real^3. affine hull {vec 0, v, w, u} = affine hull {vec 0, v, u} ` ASSUME_TAC; +GEN_TAC; +REWRITE_TAC[GSYM SUBSET_ANTISYM_EQ]; +CONJ_TAC; +MATCH_MP_TAC HULL_MINIMAL; +REWRITE_TAC[AFFINE_AFFINE_HULL]; +MP_TAC (SPEC` {vec 0, v, u': real^3} ` Qzksykg.SET_SUBSET_AFFINE_HULL); +SIMP_TAC[INSERT_SUBSET]; +STRIP_TAC; +SUBGOAL_THEN` affine hull {vec 0, v:real^3} SUBSET affine hull {vec 0, v, u'}` MP_TAC; +MATCH_MP_TAC HULL_MONO; +CONV_TAC SET_RULE; +REWRITE_TAC[SUBSET]; +DISCH_THEN MATCH_MP_TAC; +UNDISCH_TAC` w = ITER i (rho_node1 FF ) v `; +ASM_REWRITE_TAC[GSYM aff]; +DISCH_THEN (ASSUME_TAC o SYM); +UNDISCH_TAC` v = ITER j (rho_node1 FF ) w `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +UNDISCH_TAC` aff {vec 0, v} = aff { vec 0, w:real^3} `; +DISCH_THEN (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[]; + + +MATCH_MP_TAC HULL_MONO; +CONV_TAC SET_RULE; + + + +SUBGOAL_THEN`! x'. x' IN V ==> (f:real^3 -> real -> real^3) u t IN +wedge_ge (vec 0) (x') (rho_node1 FF x') + (ivs_rho_node1 FF x') ` ASSUME_TAC; +GEN_TAC; +STRIP_TAC; +ASM_CASES_TAC` x'' = (v:real^3) `; +UNDISCH_TAC` w = ITER i (rho_node1 FF ) v `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +UNDISCH_TAC` v = ITER j (rho_node1 FF ) w `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[wedge_ge; IN_ELIM_THM]; +FIRST_ASSUM (MP_TAC o (SPEC` v, rho_node1 FF v ` )); +ANTS_TAC; +ASM_SIMP_TAC[]; +REWRITE_TAC[SUBSET]; +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` u: real^3 `)); +DOWN; +UNDISCH_TAC` !v. v IN V + ==> wedge_in_fan_ge (v,rho_node1 FF v) E = + wedge_ge (vec 0) v (rho_node1 FF v) (ivs_rho_node1 FF v) `; +DISCH_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` v:real^3 `)); +ASM_REWRITE_TAC[wedge_ge; IN_ELIM_THM]; +SUBGOAL_THEN` ~ collinear {vec 0, v , u:real^3 } ` MP_TAC; +ASM_SIMP_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` (!x. x IN (ss:real^3 # real^3 -> bool) + ==> (!t1 t2. (f:real^3 -> real -> real^3) u t = t1 % FST x + t2 % SND x ==> &0 < t1)) ` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +FIRST_ASSUM (MP_TAC o (SPEC` (u:real^3, v:real^3) `)); +ANTS_TAC; +EXPAND_TAC "ss"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` u:real^3 `; +EXISTS_TAC` v: real^3 `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` ~collinear {vec 0, v, u:real^3} `; +SIMP_TAC[INSERT_COMM]; +STRIP_TAC; + +ASM_SIMP_TAC[]; +EXISTS_TAC` &1 `; +EXISTS_TAC` &0 `; +CONJ_TAC; +CONV_TAC VECTOR_ARITH; +REAL_ARITH_TAC; +REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` (f:real^3 -> real -> real^3) u t IN affine hull {vec 0, v, w, u} ` MP_TAC; +FIRST_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[]; +REWRITE_TAC[IN_ELIM_THM; AFFINE_HULL_3]; +STRIP_TAC; +DOWN; +REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +ONCE_REWRITE_TAC[VECTOR_ADD_SYM]; +FIRST_ASSUM NHANH; +STRIP_TAC; +UNDISCH_TAC` ~collinear {vec 0, v, u:real^3} `; +NHANH Fan.th3a; +NHANH AFF_GT_2_1; +STRIP_TAC; +SUBGOAL_THEN` (f:real^3 -> real -> real^3) u t IN aff_gt {vec 0, v} {u} ` ASSUME_TAC; +ASM_REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` u': real `; +EXISTS_TAC` v': real `; +EXISTS_TAC` w': real`; +ASM_REWRITE_TAC[]; +CONV_TAC VECTOR_ARITH; +DOWN; +NHANH IN_AFF_GT_IMP_AZIMEQ2; +SIMP_TAC[]; +ASM_CASES_TAC` x'' = w:real^3 `; +UNDISCH_TAC` w = ITER i (rho_node1 FF) v `; +DISCH_THEN (ASSUME_TAC o SYM); +UNDISCH_TAC` v = ITER j (rho_node1 FF) w `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[wedge_ge; IN_ELIM_THM]; +FIRST_ASSUM (MP_TAC o (SPEC` w, rho_node1 FF w `)); +ANTS_TAC; +ASM_SIMP_TAC[]; + +UNDISCH_TAC` !v. v IN V + ==> wedge_in_fan_ge (v,rho_node1 FF v) E = + wedge_ge (vec 0) v (rho_node1 FF v) (ivs_rho_node1 FF v) `; +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` w: real^3 `)); +DOWN; +SIMP_TAC[]; +STRIP_TAC; +REWRITE_TAC[SUBSET]; +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` u:real^3 `)); +DOWN; +REWRITE_TAC[wedge_ge; IN_ELIM_THM]; +SUBGOAL_THEN` ~collinear {vec 0, v, u:real^3} ` MP_TAC; +ASM_SIMP_TAC[]; +ASM_REWRITE_TAC[Fan.collinear_fan]; +PHA THEN STRIP_TAC; +SUBGOAL_THEN` ~( w = vec 0: real^3) ` MP_TAC; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_V_DIFF; +ASM_SIMP_TAC[]; +ASSUME_TAC2 Local_lemmas.LOFA_IMP_V_DIFF; +ONCE_REWRITE_TAC[EQ_SYM_EQ]; +UNDISCH_TAC` ~(u IN aff {vec 0, w: real^3}) `; +PHA; +REWRITE_TAC[GSYM Fan.collinear_fan]; +NHANH Fan.th3a; +NHANH AFF_GT_2_1; +STRIP_TAC; +SUBGOAL_THEN` (!x. x IN ss + ==> (!t1 t2. (f: real^3 -> real -> real^3) u t = t1 % FST x + t2 % SND x ==> &0 < t1)) ` MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPEC` (u:real^3, w:real^3) `)); +ANTS_TAC; +EXPAND_TAC "ss"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` u:real^3 `; +EXISTS_TAC` w:real^3 `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` ~collinear {vec 0, w, u: real^3} `; +SIMP_TAC[INSERT_COMM]; +ASM_SIMP_TAC[]; +STRIP_TAC; +EXISTS_TAC` &1 `; +EXISTS_TAC` &0 `; + + +CONJ_TAC; +CONV_TAC VECTOR_ARITH; +REAL_ARITH_TAC; + + +REWRITE_TAC[]; +STRIP_TAC; + +SUBGOAL_THEN` (f:real^3 -> real -> real^3) u t IN affine hull {vec 0, v, w, u }` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` affine hull {vec 0, v, w, u} SUBSET affine hull {vec 0, w, u:real^3} ` MP_TAC; +MATCH_MP_TAC HULL_MINIMAL; +REWRITE_TAC[AFFINE_AFFINE_HULL]; +MP_TAC (ISPEC` {vec 0, w, u: real^3} ` Qzksykg.SET_SUBSET_AFFINE_HULL); +SIMP_TAC[INSERT_SUBSET]; +STRIP_TAC; +MP_TAC (SET_RULE` {vec 0, w:real^3} SUBSET {vec 0, w, u} `); +NHANH (ISPEC` affine ` HULL_MONO); +REWRITE_TAC[SUBSET]; +STRIP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +UNDISCH_TAC` aff {vec 0, v} = aff {vec 0, w:real^3} `; +REWRITE_TAC[aff]; +DISCH_THEN (SUBST1_TAC o SYM); + + +MESON_TAC[HULL_SUBSET; IN_INSERT; SUBSET]; +REWRITE_TAC[SUBSET]; +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` (f:real^3 -> real -> real^3) u t `)); +DOWN; +REWRITE_TAC[IN_ELIM_THM; AFFINE_HULL_3; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPECL [` w': real `;` v': real `])); +ANTS_TAC; +ASM_REWRITE_TAC[]; +CONV_TAC VECTOR_ARITH; +STRIP_TAC; +SUBGOAL_THEN` (f:real^3 -> real -> real^3) u t IN aff_gt {vec 0, w} {u} ` MP_TAC; +ASM_REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` u': real `; +EXISTS_TAC` v': real `; +EXISTS_TAC` w': real `; +ASM_REWRITE_TAC[]; +CONV_TAC VECTOR_ARITH; +STRIP_TAC; +UNDISCH_TAC` &0 <= azim (vec 0) w (rho_node1 FF w) u `; +UNDISCH_TAC` azim (vec 0) w (rho_node1 FF w) u <= + azim (vec 0) w (rho_node1 FF w) (ivs_rho_node1 FF w) `; +PHA; +DOWN; +NHANH IN_AFF_GT_IMP_AZIMEQ2; +SIMP_TAC[]; +SUBGOAL_THEN` interior_angle1 (vec 0) FF x'' = pi /\ + rho_node1 FF x'' IN aff {x'', v, w} /\ + ivs_rho_node1 FF x'' IN aff {x'', v, w} ` MP_TAC; +FIRST_ASSUM MATCH_MP_TAC; +REWRITE_TAC[IN_DIFF; IN_INSERT; NOT_IN_EMPTY]; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` w = ITER i (rho_node1 FF) v `; +DISCH_THEN (ASSUME_TAC o SYM); +UNDISCH_TAC` v = ITER j (rho_node1 FF) w `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` azim (vec 0) x'' (rho_node1 FF x'') (ivs_rho_node1 FF x'') = + interior_angle1 (vec 0) FF x'' ` MP_TAC; +ASM_SIMP_TAC[]; +DISCH_THEN (SUBST1_TAC o SYM); +NHANH Local_lemmas.AZIM_PI_WEDGE_GE_CROSS_DOT; +SIMP_TAC[]; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPEC` x'', rho_node1 FF x'' `)); +ANTS_TAC; +ASM_SIMP_TAC[]; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` !v. v IN V + ==> wedge_in_fan_ge (v,rho_node1 FF v) E = + wedge_ge (vec 0) v (rho_node1 FF v) (ivs_rho_node1 FF v) `; +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` x'': real^3 `)); +ASM_REWRITE_TAC[VECTOR_ARITH` x - vec 0 = x `; SUBSET; IN_ELIM_THM]; +STRIP_TAC; +ABBREV_TAC` e1 = x'' cross rho_node1 FF x'' `; +SUBGOAL_THEN` e1 dot v = &0 /\ e1 dot (w:real^3) = &0 ` MP_TAC; +UNDISCH_TAC` vec 0 IN conv0 {v, w:real^3} `; +REWRITE_TAC[Collect_geom.CONV0_SET2; IN_ELIM_THM]; +STRIP_TAC; +MP_TAC (ISPEC` e1: real^3 ` DOT_RZERO); +ASM_REWRITE_TAC[DOT_RADD; DOT_RMUL]; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` v:real^3 `)); +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` w:real^3 `)); +DOWN THEN DOWN; +UNDISCH_TAC` &0 < a' `; +UNDISCH_TAC` &0 < b' `; +REWRITE_TAC[REAL_ARITH` &0 <= a <=> a = &0 \/ &0 < a `]; +MESON_TAC[REAL_LT_ADD; REAL_LT_MUL; REAL_ARITH` &0 < a ==> ~(a = &0) `; REAL_ARITH` &0 < a ==> ~( a + x * &0 = &0 \/ x * &0 + a = &0) `]; +STRIP_TAC; +UNDISCH_TAC` !u. u IN V + ==> ~(u = v) + ==> ~(u = w) + ==> u IN aff_gt {vec 0, v} {rho_node1 FF v} \/ + u IN aff_gt {vec 0, v} {ivs_rho_node1 FF v} `; +PHA THEN STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` u:real^3 `)); +SUBGOAL_THEN` rho_node1 FF v IN V /\ ivs_rho_node1 FF v IN V ` MP_TAC; +ASM_SIMP_TAC[]; +SUBGOAL_THEN` ~ collinear { vec 0, v, rho_node1 FF v } /\ ~ collinear {vec 0, v, ivs_rho_node1 FF v } ` MP_TAC; +ASM_SIMP_TAC[]; +NHANH Fan.th3a; +NHANH AFF_GT_2_1; +DOWN THEN STRIP_TAC; +STRIP_TAC; +STRIP_TAC; +UNDISCH_TAC` u IN aff_gt {vec 0, v} {rho_node1 FF v} `; +ASM_REWRITE_TAC[IN_ELIM_THM; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +STRIP_TAC; +SUBGOAL_THEN` (!x. x IN ss + ==> (!t1 t2. (f:real^3 -> real -> real^3) u t = t1 % FST x + t2 % SND x ==> &0 < t1)) ` MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; + + +ASM_REWRITE_TAC[]; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` rho_node1 FF v, v `)); +ANTS_TAC; +EXPAND_TAC "ss"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` rho_node1 FF v `; +EXISTS_TAC` v: real^3 `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` ~collinear {vec 0, v, rho_node1 FF v} `; +SIMP_TAC[INSERT_COMM]; +STRIP_TAC; +UNDISCH_TAC` u = t2 % v + t3 % rho_node1 FF v `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_SIMP_TAC[]; +EXISTS_TAC` t3: real `; +EXISTS_TAC` t2:real `; +ASM_REWRITE_TAC[]; +EXPAND_TAC "u"; +CONV_TAC VECTOR_ARITH; +REWRITE_TAC[]; +SUBGOAL_THEN` (f:real^3 -> real -> real^3) u t IN affine hull {vec 0, v, w, u } ` MP_TAC; +ASM_SIMP_TAC[]; +FIRST_X_ASSUM (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +REWRITE_TAC[IN_ELIM_THM; AFFINE_HULL_3]; +EXPAND_TAC "u"; +REWRITE_TAC[VECTOR_ARITH` u % vec 0 + v % v' + w % (t2 % v' + t3 % ax) = ( v + w * t2 ) % v' + ( w * t3) % ax`]; +ASM_REWRITE_TAC[]; +ONCE_REWRITE_TAC[VECTOR_ARITH` a + b = b + (a:real^N) `]; +PHA THEN STRIP_TAC; +UNDISCH_TAC` (f:real^3 -> real -> real^3) u t = (w' * t3) % rho_node1 FF v + (v' + w' * t2) % v `; +ONCE_REWRITE_TAC[VECTOR_ARITH` a + b = b + (a:real^N) `]; +FIRST_ASSUM NHANH; +SIMP_TAC[DOT_RADD; DOT_RMUL]; +ASM_REWRITE_TAC[REAL_ARITH` a * &0 + x = x `]; +STRIP_TAC; +SUBGOAL_THEN` &0 <= e1 dot rho_node1 FF v ` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC REAL_LE_MUL; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` &0 < w' * t3 `; +REAL_ARITH_TAC; STRIP_TAC; +STRIP_TAC; +UNDISCH_TAC` u IN aff_gt {vec 0, v} {ivs_rho_node1 FF v} `; +ASM_REWRITE_TAC[IN_ELIM_THM; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +STRIP_TAC; +SUBGOAL_THEN` (f:real^3 -> real -> real^3) u t IN affine hull {vec 0, v, w, u} ` MP_TAC; +FIRST_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[AFFINE_HULL_3; IN_ELIM_THM]; +REWRITE_TAC[VECTOR_ARITH` u % vec 0 + v % vv + w % (t2 % vv + t3 % vc) = +( v + w * t2 ) % vv + (w * t3 ) % vc `]; +FIRST_X_ASSUM (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` (!x. x IN ss + ==> (!t1 t2. (f:real^3 -> real -> real^3) u t = t1 % FST x + t2 % SND x ==> &0 < t1)) ` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM (MP_TAC o (SPEC` ivs_rho_node1 FF v, v `)); +ANTS_TAC; +EXPAND_TAC "ss"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` ivs_rho_node1 FF v `; +EXISTS_TAC` v: real^3 `; +ASM_REWRITE_TAC[]; +ASM_SIMP_TAC[]; +UNDISCH_TAC` ~collinear {vec 0, v, ivs_rho_node1 FF v} `; +SIMP_TAC[INSERT_COMM]; +STRIP_TAC; +EXISTS_TAC` t3: real`; +EXISTS_TAC` t2: real `; +ASM_REWRITE_TAC[]; +EXPAND_TAC "u"; +CONV_TAC VECTOR_ARITH; +REWRITE_TAC[]; +ONCE_REWRITE_TAC[VECTOR_ADD_SYM]; +DISCH_THEN (ASSUME_TAC2 o (SPECL [` w' * t3: real `; ` v' + w' * t2: real`])); +ASM_REWRITE_TAC[DOT_RADD; DOT_RMUL; REAL_MUL_RZERO; REAL_ADD_LID]; +UNDISCH_TAC` !x. x IN V ==> &0 <= e1 dot (x: real^3) `; +DISCH_THEN (ASSUME_TAC2 o (SPEC` ivs_rho_node1 FF v `)); +MATCH_MP_TAC REAL_LE_MUL; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` &0 < w' * t3 `; +CONV_TAC REAL_ARITH; +ASM_CASES_TAC` ~( x' = (u:real^3)) /\ ~( rho_node1 FF x' = u ) /\ ~( ivs_rho_node1 FF x' = u ) ` ; +DOWN THEN STRIP_TAC; +UNDISCH_TAC` w = ITER i (rho_node1 FF ) v `; +DISCH_THEN (ASSUME_TAC o SYM); +UNDISCH_TAC` v = ITER j (rho_node1 FF ) w `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_SIMP_TAC[]; +STRIP_TAC; +UNDISCH_TAC` !x. (x:real^3 # real^3) IN FF ==> azim_in_fan x E <= pi /\ V SUBSET wedge_in_fan_ge x E `; +DISCH_THEN (MP_TAC o (SPEC` x', rho_node1 FF x' `)); +ANTS_TAC; +ASM_SIMP_TAC[]; +ASM_SIMP_TAC[]; +STRIP_TAC; +MATCH_MP_TAC SUBSET_TRANS; +EXISTS_TAC` (f:real^3 -> real -> real^3) u t INSERT V `; +ASM_REWRITE_TAC[INSERT_SUBSET]; +ASM_SIMP_TAC[]; + +STRIP_TAC; +ASM_CASES_TAC` x' = u:real^3 `; +ASM_SIMP_TAC[]; +SUBGOAL_THEN` rho_node1 FF u IN aff_ge {vec 0, v} {u} /\ + ivs_rho_node1 FF u IN aff_ge {vec 0, v} {u} ` ASSUME_TAC; +ASM_SIMP_TAC[]; +SUBGOAL_THEN` ~collinear {vec 0, v, u:real^3} ` ASSUME_TAC; +ASM_SIMP_TAC[]; +SUBGOAL_THEN` (f: real^3 -> real -> real^3) (ivs_rho_node1 FF u) t IN IV ` ASSUME_TAC; +EXPAND_TAC "IV"; +REWRITE_TAC[IN_IMAGE]; +EXISTS_TAC` ivs_rho_node1 FF u `; +ASM_SIMP_TAC[]; +ABBREV_TAC` UU = {ITER n (rho_node1 IF) ( (f: real^3 -> real -> real^3) (ivs_rho_node1 FF u) t ) | n <= 2} `; +ABBREV_TAC` P = affine hull {vec 0, v, u:real^3} `; +ASSUME_TAC (ISPECL [` {vec 0, v:real^3 }`;` {u:real^3} `] AFF_GE_SUBSET_AFFINE_HULL); +SUBGOAL_THEN` plane (P:real^3 -> bool) ` ASSUME_TAC; +REWRITE_TAC[plane]; +EXISTS_TAC` vec 0: real^3 `; +EXISTS_TAC` v: real^3 `; +EXISTS_TAC` u: real^3 `; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` vec 0 IN (P:real^3 -> bool) ` ASSUME_TAC; +MP_TAC ( +prove(` {vec 0, v, u:real^3} SUBSET affine hull {vec 0, v, u} `, +REWRITE_TAC[HULL_SUBSET])); +UNDISCH_TAC` w = ITER i (rho_node1 FF ) v ` ; +DISCH_THEN (ASSUME_TAC o SYM); +UNDISCH_TAC` v = ITER j (rho_node1 FF ) w ` ; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[SUBSET]; +DISCH_THEN MATCH_MP_TAC; +REWRITE_TAC[IN_INSERT]; +SUBGOAL_THEN` UU SUBSET (P: real^3 -> bool) ` ASSUME_TAC; +EXPAND_TAC "UU"; +REWRITE_TAC[SUBSET; IN_ELIM_THM]; +GEN_TAC; +REWRITE_TAC[ARITH_RULE` n <= 2 <=> n = 0 \/ n = 1 \/ n = 2 `]; +STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[ITER]; +STRIP_TAC; +UNDISCH_TAC` aff_ge {vec 0, v:real^3} {u} SUBSET affine hull ({vec 0, v} UNION {u}) `; +UNDISCH_TAC` w = ITER i (rho_node1 FF) v `; +DISCH_THEN (ASSUME_TAC o SYM); +UNDISCH_TAC` v = ITER j (rho_node1 FF) w `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[SET_RULE` {a,b} UNION {c} = {a,b,c} `; SUBSET]; +DISCH_THEN MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +DOWN; +DOWN; +SIMP_TAC[ITER1]; +SUBGOAL_THEN` rho_node1 IF ((f: real^3 -> real -> real^3) (ivs_rho_node1 FF u) t) = f (rho_node1 FF (ivs_rho_node1 FF u)) t` MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_SIMP_TAC[]; +SIMP_TAC[]; +ASM_SIMP_TAC[]; + + +SUBGOAL_THEN` (f:real^3 -> real -> real^3) u t IN affine hull {vec 0, v, w, u} ` MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +UNDISCH_TAC` x'' = ITER n (rho_node1 IF) ((f: real^3 -> real -> real^3) (ivs_rho_node1 FF u) t) ` ; +DOWN THEN SIMP_TAC[]; +REWRITE_TAC[Lvducxu.ITER12]; +SUBGOAL_THEN` rho_node1 IF (f (ivs_rho_node1 FF u) (t:real)) = f (rho_node1 FF (ivs_rho_node1 FF u)) t ` MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_SIMP_TAC[]; +SIMP_TAC[]; +PHA THEN STRIP_TAC; +ASM_SIMP_TAC[]; +UNDISCH_TAC` aff_ge {vec 0, v} {u} SUBSET affine hull ({vec 0, v} UNION {u:real^3}) `; +UNDISCH_TAC` w = ITER i (rho_node1 FF ) v `; +DISCH_THEN (ASSUME_TAC o SYM); +UNDISCH_TAC` v = ITER j (rho_node1 FF ) w `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[SET_RULE` {a,b} UNION {c} = {a,b,c} `; SUBSET]; +DISCH_THEN MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 ( +SPECL [` IE: (real^3 -> bool) -> bool `;` IV: real^3 -> bool `;` UU: real^3 -> + bool `;` P: real^3 -> bool `;` 2 `;` IF: real^3 # real^3 -> bool `; `((f:real + ^3 -> real -> real^3) (ivs_rho_node1 FF u) t) `] (GEN_ALL + AZIM_PI_ITER_LOCAL_FAN)); +FIRST_X_ASSUM (MP_TAC o (SPEC` 0 `)); +ANTS_TAC; +ARITH_TAC; + +UNDISCH_TAC` w = ITER i (rho_node1 FF ) v `; +UNDISCH_TAC` v = ITER j (rho_node1 FF ) w `; +DISCH_THEN (ASSUME_TAC o SYM); +DISCH_THEN (ASSUME_TAC o SYM); +REWRITE_TAC[ADD; ITER; ITER1; Lvducxu.ITER12]; +SUBGOAL_THEN` rho_node1 IF (f (ivs_rho_node1 FF u) (t:real)) = f (rho_node1 FF (ivs_rho_node1 FF u)) t ` MP_TAC; +ASM_SIMP_TAC[]; +SIMP_TAC[]; +ASM_SIMP_TAC[]; +NHANH (MESON[PI_POS]` x = pi ==> &0 < x `); +NHANH Local_lemmas1.AZIM_POS_IMP_SUM_2PI; +STRIP_TAC; +DOWN; +ASM_REWRITE_TAC[REAL_ARITH` a + x = &2 * a <=> x = a `]; +SIMP_TAC[REAL_LE_REFL]; +STRIP_TAC; + + + +SUBGOAL_THEN` wedge_ge (vec 0) (f u (t:real)) (rho_node1 FF u) (ivs_rho_node1 FF u) = +wedge_ge (vec 0) u (rho_node1 FF u) (ivs_rho_node1 FF u) ` ASSUME_TAC; +DOWN; +SUBGOAL_THEN` interior_angle1 (vec 0) FF u = pi ` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[IN_DIFF; IN_INSERT; NOT_IN_EMPTY]; +SUBGOAL_THEN` azim (vec 0) u (rho_node1 FF u) (ivs_rho_node1 FF u) = pi ` MP_TAC; +DOWN; +ASM_SIMP_TAC[]; +NHANH Local_lemmas.AZIM_PI_WEDGE_GE_CROSS_DOT; +SIMP_TAC[VECTOR_SUB_RZERO]; +PHA THEN STRIP_TAC; +SUBGOAL_THEN` affine hull {vec 0, v, u} = affine hull {vec 0, u, rho_node1 FF u } ` ASSUME_TAC; +MATCH_MP_TAC Local_lemmas.SUBSET_NOT_COLLINEAR_AFFINE_HULL_EQ ; +ASM_SIMP_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +CONJ_TAC; +EXPAND_TAC "P"; +MP_TAC (ISPECL [` affine: (real^3 -> bool) -> bool `; +` { vec 0, v, u:real^3} `] HULL_SUBSET); +REWRITE_TAC[SUBSET]; +DISCH_THEN MATCH_MP_TAC; +REWRITE_TAC[IN_INSERT]; +UNDISCH_TAC` aff_ge {vec 0, v} {u} SUBSET affine hull ({vec 0, v} UNION {u:real^3}) `; +REWRITE_TAC[SUBSET;SET_RULE` {a,b} UNION {c} = {a,b,c} `]; +ASM_REWRITE_TAC[]; +DISCH_THEN MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` f u (t:real) IN affine hull {vec 0, v, w, u:real^3} ` MP_TAC; +FIRST_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +DOWN; +ASM_REWRITE_TAC[]; +SIMP_TAC[IN_ELIM_THM; AFFINE_HULL_3]; +PHA THEN STRIP_TAC; +SUBGOAL_THEN` (!x. x IN ss + ==> (!t1 t2. (f:real^3 -> real -> real^3) u t = t1 % FST x + t2 % SND x ==> &0 < t1)) ` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +FIRST_ASSUM (MP_TAC o (SPEC` u, rho_node1 FF u `)); +ANTS_TAC; +EXPAND_TAC "ss"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` u: real^3 `; +EXISTS_TAC` rho_node1 FF u `; +ASM_REWRITE_TAC[]; +ASM_SIMP_TAC[]; +EXISTS_TAC` &1 `; +EXISTS_TAC` &0 `; +CONJ_TAC; +CONV_TAC VECTOR_ARITH; +REAL_ARITH_TAC; +REWRITE_TAC[]; +DISCH_THEN (MP_TAC o (SPECL [` v': real `;` w': real `])); +ANTS_TAC; +ASM_REWRITE_TAC[]; +CONV_TAC VECTOR_ARITH; +ASM_REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID; CROSS_LADD; CROSS_LMUL; CROSS_REFL; VECTOR_ADD_RID; DOT_LMUL]; +SIMP_TAC[REAL_LE_MUL_EQ]; + + +ASM_REWRITE_TAC[]; +FIRST_ASSUM (MP_TAC o (SPEC` u, rho_node1 FF u `)); +ANTS_TAC; +ASM_SIMP_TAC[]; +ASM_SIMP_TAC[]; +UNDISCH_TAC` !v. v IN V + ==> wedge_in_fan_ge (v,rho_node1 FF v) E = + wedge_ge (vec 0) v (rho_node1 FF v) (ivs_rho_node1 FF v) `; +DISCH_THEN (ASSUME_TAC2 o (SPEC` u:real^3 `)); +DOWN; +SIMP_TAC[]; + +STRIP_TAC; +MATCH_MP_TAC SUBSET_TRANS; +EXISTS_TAC` (f:real^3 -> real -> real^3) u t INSERT V `; +ASM_REWRITE_TAC[]; +ASM_SIMP_TAC[INSERT_SUBSET]; +SUBGOAL_THEN` azim_in_fan (u, rho_node1 FF u) E <= pi /\ V SUBSET wedge_in_fan_ge (u, rho_node1 FF u) E ` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_SIMP_TAC[]; +DOWN THEN STRIP_TAC; +DOWN; +UNDISCH_TAC` wedge_in_fan_ge (u,rho_node1 FF u) E = + wedge_ge (vec 0) u (rho_node1 FF u) (ivs_rho_node1 FF u) `; +SIMP_TAC[]; + +SUBGOAL_THEN` (!x. (x :real^3 # real^3) IN ss + ==> (!t1 t2. (f:real^3 -> real -> real^3) u t = t1 % FST x + t2 % SND x ==> &0 < t1)) ` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; + +UNDISCH_TAC` w = ITER i (rho_node1 FF ) v ` ; +UNDISCH_TAC` v = ITER j (rho_node1 FF ) w ` ; +DISCH_THEN (ASSUME_TAC o SYM); +DISCH_THEN (ASSUME_TAC o SYM); +ASM_CASES_TAC` rho_node1 FF x' = u `; +ASM_SIMP_TAC[]; +SUBGOAL_THEN` ~(rho_node1 FF (rho_node1 FF ( ivs_rho_node1 FF x')) = (ivs_rho_node1 FF x')) ` MP_TAC; +FIRST_ASSUM MATCH_MP_TAC; +ASM_SIMP_TAC[]; + +SUBGOAL_THEN` rho_node1 FF (ivs_rho_node1 FF x') = x' ` SUBST1_TAC; +ASM_SIMP_TAC[]; +ASM_SIMP_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` affine hull {vec 0, v, u} = affine hull {vec 0, u, ivs_rho_node1 FF u }` MP_TAC; +MATCH_MP_TAC Local_lemmas.SUBSET_NOT_COLLINEAR_AFFINE_HULL_EQ; +ASM_SIMP_TAC[]; +ASSUME_TAC2 (ISPECL [` {vec 0, v:real^3} `;` {u:real^3} `] AFF_GE_SUBSET_AFFINE_HULL); +MP_TAC (ISPECL [` affine: (real^3 -> bool) -> bool `;` {vec 0, v, u:real^3} `] HULL_SUBSET); +SIMP_TAC[INSERT_SUBSET]; +STRIP_TAC; +UNDISCH_TAC` aff_ge {vec 0, v} {u} SUBSET affine hull ({vec 0, v} UNION {u: real^3}) `; +REWRITE_TAC[SET_RULE` {a,b} UNION {c} = {a,b,c} `; SUBSET]; +DISCH_THEN MATCH_MP_TAC; +ASM_SIMP_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` (f:real^3 -> real -> real^3) u t IN affine hull {vec 0, v, w, u} ` MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[IN_ELIM_THM; AFFINE_HULL_3; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +STRIP_TAC; + +SUBGOAL_THEN` ~ collinear {vec 0, u, ivs_rho_node1 FF u } ` ASSUME_TAC; +ASM_SIMP_TAC[]; +FIRST_ASSUM (MP_TAC o (SPEC` u, ivs_rho_node1 FF u ` )); +ANTS_TAC; +EXPAND_TAC "ss"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` u:real^3 `; +EXISTS_TAC` ivs_rho_node1 FF u `; +ASM_REWRITE_TAC[]; +ASM_SIMP_TAC[]; +EXISTS_TAC` &1 `; +EXISTS_TAC` &0 `; +CONJ_TAC; +CONV_TAC VECTOR_ARITH; +REAL_ARITH_TAC; +REWRITE_TAC[]; +DISCH_THEN (ASSUME_TAC2 o (SPECL [` v': real `;` w': real `])); +DOWN THEN DOWN; +ONCE_REWRITE_TAC[SET_RULE` {a,b} = {b,a} `]; +DOWN; +SUBGOAL_THEN` ivs_rho_node1 FF u = x' ` ASSUME_TAC; +EXPAND_TAC "u"; +ASM_SIMP_TAC[]; +ASM_REWRITE_TAC[]; +PHA THEN STRIP_TAC; +SUBGOAL_THEN` (f:real^3 -> real -> real^3) u t IN aff_gt {vec 0, x'} {u:real^3} ` MP_TAC; +DOWN THEN DOWN; +NHANH Fan.th3a; +NHANH AFF_GT_2_1; +SIMP_TAC[IN_ELIM_THM]; +STRIP_TAC; +STRIP_TAC; +EXISTS_TAC` u': real `; +EXISTS_TAC` w': real `; +EXISTS_TAC` v': real` ; +ASM_REWRITE_TAC[]; +CONJ_TAC; +UNDISCH_TAC` u' + v' + w' = &1 `; +REAL_ARITH_TAC; +CONV_TAC VECTOR_ARITH; +NHANH IN_AFF_GT_IMP_AZIMEQ2; +REWRITE_TAC[GSYM Rogers.AZIM_EQ_SYM]; +SIMP_TAC[wedge_ge]; +STRIP_TAC; +UNDISCH_TAC` !x. x IN FF ==> azim_in_fan x E <= pi /\ V SUBSET wedge_in_fan_ge x E `; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPEC` x', rho_node1 FF x' `)); +ANTS_TAC; +ASM_SIMP_TAC[]; +DOWN THEN PHA; +ASM_SIMP_TAC[GSYM wedge_ge]; +UNDISCH_TAC` !v. v IN V + ==> azim (vec 0) v (rho_node1 FF v) (ivs_rho_node1 FF v) = + interior_angle1 (vec 0) FF v `; +DISCH_THEN (ASSUME_TAC o GSYM); +ASM_SIMP_TAC[]; +STRIP_TAC; + +MATCH_MP_TAC SUBSET_TRANS; +EXISTS_TAC` (f:real^3 -> real -> real^3) u t INSERT V `; +UNDISCH_TAC` (f: real^3 -> real -> real^3) u t = v' % u + w' % x' `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_SIMP_TAC[]; +UNDISCH_TAC` rho_node1 FF x' = u `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_SIMP_TAC[INSERT_SUBSET]; +SUBGOAL_THEN` (f: real^3 -> real -> real^3) u t IN + wedge_ge (vec 0) x' (rho_node1 FF x') (ivs_rho_node1 FF x') ` MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +FIRST_ASSUM ACCEPT_TAC; +DOWN; +SIMP_TAC[]; + +ASM_CASES_TAC` ivs_rho_node1 FF x' = u `; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` x' = rho_node1 FF u ` ASSUME_TAC; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ASM_SIMP_TAC[]; +ASM_SIMP_TAC[]; +UNDISCH_TAC`!x. x IN FF ==> azim_in_fan x E <= pi /\ V SUBSET wedge_in_fan_ge x E `; +DISCH_THEN (MP_TAC o (SPEC` x', rho_node1 FF x' `)); +ANTS_TAC; +ASM_SIMP_TAC[]; +ASM_SIMP_TAC[]; +UNDISCH_TAC` !v. v IN V + ==> azim (vec 0) v (rho_node1 FF v) (ivs_rho_node1 FF v) = + interior_angle1 (vec 0) FF v `; +DISCH_THEN (ASSUME_TAC2 o (SPEC` x': real^3 `)); +FIRST_X_ASSUM (MP_TAC o SYM); +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` u, rho_node1 FF u `)); +ANTS_TAC; +EXPAND_TAC "ss"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` u: real^3 `; +EXISTS_TAC` rho_node1 FF u `; +ASM_SIMP_TAC[]; + + + +EXISTS_TAC` &1 `; +EXISTS_TAC` &0 `; +CONJ_TAC; +CONV_TAC VECTOR_ARITH; +REAL_ARITH_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` affine hull {vec 0, v, u} = affine hull {vec 0, u, rho_node1 FF u } ` ASSUME_TAC; +MATCH_MP_TAC Local_lemmas.SUBSET_NOT_COLLINEAR_AFFINE_HULL_EQ; +ASM_SIMP_TAC[]; +MP_TAC (ISPEC ` {vec 0, v, u:real^3} ` Qzksykg.SET_SUBSET_AFFINE_HULL); +SIMP_TAC[INSERT_SUBSET]; +ASM_SIMP_TAC[]; +STRIP_TAC; +MP_TAC (ISPECL [` {vec 0, v:real^3} `;` {u: real^3} `] AFF_GE_SUBSET_AFFINE_HULL); +REWRITE_TAC[SET_RULE` {a,b} UNION {c} = {a,b,c} `; SUBSET]; +DISCH_THEN MATCH_MP_TAC; +ASM_SIMP_TAC[]; +SUBGOAL_THEN` (f:real^3 -> real -> real^3) u t IN affine hull {vec 0, v, w, u} ` MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +FIRST_ASSUM ACCEPT_TAC; +ASM_REWRITE_TAC[AFFINE_HULL_3; IN_ELIM_THM; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +STRIP_TAC; +SUBGOAL_THEN` &0 < v' ` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +EXISTS_TAC` w': real`; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` ~ collinear {vec 0, u, rho_node1 FF u } ` MP_TAC; +ASM_SIMP_TAC[]; +ONCE_REWRITE_TAC[Collect_geom.PER_SET2]; +NHANH Fan.th3a; +NHANH AFF_GT_2_1; +STRIP_TAC; +SUBGOAL_THEN` (f:real ^3 -> real -> real^3) u t IN aff_gt {vec 0, rho_node1 FF u } {u} ` MP_TAC; +ASM_REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` u': real `; +EXISTS_TAC` w': real `; +EXISTS_TAC` v': real `; +ASM_REWRITE_TAC[]; +CONJ_TAC; +UNDISCH_TAC` u' + v' + w' = &1 `; +REAL_ARITH_TAC; +CONV_TAC VECTOR_ARITH; +NHANH IN_AFF_GT_IMP_AZIMEQ2; +SIMP_TAC[]; +STRIP_TAC THEN STRIP_TAC; +MATCH_MP_TAC SUBSET_TRANS; +EXISTS_TAC` (f: real^3 -> real -> real^3) u t INSERT V `; +UNDISCH_TAC` (f: real^3 -> real -> real^3) u t = v' % u + w' % rho_node1 FF u `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[INSERT_SUBSET; wedge_ge]; +ASM_SIMP_TAC[GSYM wedge_ge]; +UNDISCH_TAC` !x'. x' IN V + ==> (f: real^3 -> real -> real^3) u t IN + wedge_ge (vec 0) x' (rho_node1 FF x') (ivs_rho_node1 FF x') `; +DISCH_THEN (MP_TAC o (SPEC` rho_node1 FF u `)); +ANTS_TAC; +ASM_SIMP_TAC[]; +ASM_SIMP_TAC[]; +UNDISCH_TAC` ~(~(x' = u) /\ ~(rho_node1 FF x' = u) /\ ~(ivs_rho_node1 FF x' = u)) `; +ASM_REWRITE_TAC[]]);; + +let MHAEYJN = prove_by_refinement( +`!a b V E FF f v w u. + convex_local_fan (V,E,FF) /\ + lunar (v,w) V E /\ + deformation f V (a,b) /\ + interior_angle1 (vec 0) FF v < pi /\ + u IN V /\ + ~(u = v) /\ + ~(u = w) /\ + (!u' t. u' IN V /\ ~(u = u') /\ t IN real_interval (a,b) ==> f u' t = u') /\ + (!t. t IN real_interval (a,b) ==> f u t IN affine hull {vec 0, v, w, u}) + ==> (?e. &0 < e /\ + (!t. --e < t /\ t < e + ==> convex_local_fan + (IMAGE (\v. f v t) V, + IMAGE (IMAGE (\v. f v t)) E, + IMAGE (\uv. f (FST uv) t,f (SND uv) t) FF) /\ + lunar (v,w) (IMAGE (\v. f v t) V) + (IMAGE (IMAGE (\v. f v t)) E)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (GEN_ALL SUB_LUNAR_DEFORM_LEMMA) [`FF`;`a`;`b`;`u`;`v`;`w`;`V`;`f`;`E`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + RULE_ASSUM_TAC(REWRITE_RULE[Localization.deformation;IN_REAL_INTERVAL]); + ASM_SIMP_TAC[]; + TYPIFY `local_fan (V,E,FF)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_SIMP_TAC[Local_lemmas.CVX_LO_IMP_LO]); + CONJ_TAC; + MATCH_MP_TAC Local_lemmas.LOCAL_FAN_FINITE_V; + BY(ASM_REWRITE_TAC[]); + RULE_ASSUM_TAC(REWRITE_RULE[Localization.local_fan;Fan.FAN;LET_DEF;LET_END_DEF]); + FIRST_X_ASSUM MP_TAC THEN REPEAT WEAKER_STRIP_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM_ST `UNIONS` MP_TAC THEN SET_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MHAEYJN_CONVEX_LOCAL_FAN [`a`;`b`;`V`;`E`;`FF`;`f`;`v`;`w`;`u`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `if e < e' then e else e'` EXISTS_TAC; + REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + BY(COND_CASES_TAC THEN ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + + + +end;; diff --git a/text_formalization/local/pent_hex.hl b/text_formalization/local/pent_hex.hl new file mode 100644 index 0000000..172c8f8 --- /dev/null +++ b/text_formalization/local/pent_hex.hl @@ -0,0 +1,3123 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Section: Main Estimate - Appendix - Terminal Cases *) +(* Chapter: Local Fan *) +(* Author: Thomas C. Hales *) +(* Date: 2013-05-10 *) +(* ========================================================================== *) + +(* Terminal Pent and Hex cases. *) + +(* pent with 5 top edges=2 *) + + + + +module Pent_hex = struct + + + open Hales_tactic;; + +(* eventually combine this with the one in Appendix. *) + +(* +let pent_hex_get_main_nonlinear = + let is_main = function + | Main_estimate -> true + | _ -> false in + let has_main ind = + exists (is_main) ind.tags in + let main_ineq_data1 = + filter has_main (!Ineq.ineqs) in + let id = map (fun t-> t.idv) main_ineq_data1 in + let main_ineq_data = map (fun t -> hd(Ineq.getexact t)) id in + let ineql = map (fun ind -> ind.ineq) main_ineq_data in + let sl = map (fun ind -> ind.idv) main_ineq_data in + let main_ineq_conj = end_itlist (curry mk_conj) ineql in + let th = new_definition (mk_eq (`main_nonlinear_terminal_v11:bool`,main_ineq_conj)) in + let th1 = UNDISCH (MATCH_MP (TAUT `(a <=> b) ==> (a ==> b)`) th) in + let co1 thm = if (is_conj (concl thm)) then CONJUNCT1 thm else thm in + let tryindex s sl = try index s sl with _ -> report s; failwith s in + fun s -> + let i = tryindex s sl in + let th2 = funpow i CONJUNCT2 th1 in + co1 th2;; +*) + + +let UNDISCH2 = repeat UNDISCH;; + +let yys = [`y1:real`;`y2:real`;`y3:real`;`y4:real`;`y5:real`;`y6:real`];; + + +let sqrt_secant_approx = prove_by_refinement( + `!x1 x2 x. &0 <= x1 /\ x1 <= x /\ x <= x2 ==> + (&1 / (sqrt(x1) + sqrt(x2))) * (x - x1) + sqrt(x1) <= sqrt(x)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_CASES_TAC `x2 = &0`; + TYPIFY `x1 = &0 /\ x = &0` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + TYPIFY `&0 < sqrt x2` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SQRT_POS_LT; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `&0 <= sqrt x1` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SQRT_POS_LE; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `&1 / (sqrt x1 + sqrt x2) * (x - x1) = ((sqrt x + sqrt x1)/(sqrt x2 + sqrt x1)) * (sqrt x - sqrt x1)` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + CONJ2_TAC; + REWRITE_TAC[REAL_DIFFSQ]; + REPEAT (GMATCH_SIMP_TAC Functional_equation.sqrt_sqrt); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `x + y <= z <=> x <= &1 * (z - y)`]; + MATCH_MP_TAC Real_ext.REAL_PROP_LE_RMUL; + CONJ2_TAC; + REWRITE_TAC[arith `&0 <= x - y <=> y <= x`]; + GMATCH_SIMP_TAC SQRT_MONO_LE_EQ; + BY(ASM_TAC THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LE_LDIV_EQ; + CONJ2_TAC; + REWRITE_TAC[arith `&1 * x = x`;arith `x + y <= z + y <=> x <= z`]; + GMATCH_SIMP_TAC SQRT_MONO_LE_EQ; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let flat_term_neg = prove_by_refinement( + `!y. y <= &2 * h0 ==> flat_term y <= &0`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.flat_term]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `a * b / c <= &0 <=> &0 <= a * (--b) / c `]; + GMATCH_SIMP_TAC REAL_LE_MUL; + GMATCH_SIMP_TAC REAL_LE_RDIV_EQ; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Sphere.h0]; + MP_TAC Flyspeck_constants.bounds; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let mu_y_ft_combine = prove_by_refinement( + `!y y2 y3 sd. + mu_y y y2 y3 * sd + flat_term y = + mu_y (&2 * h0) y2 y3 * sd + (&1 - (&2 * h0 - &2) * #0.07 * sd / sol0) * flat_term y`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.mu_y;Sphere.flat_term]; + REPEAT WEAKER_STRIP_TAC; + Calc_derivative.CALC_ID_TAC; + MP_TAC Flyspeck_constants.bounds; + REWRITE_TAC[Sphere.h0]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let mu_y_ft_combine2 = prove_by_refinement( + `!y y2 y3. y <= &2 * h0 ==> + mu_y (&2 * h0) y2 y3 * sqrt(&20) + #0.705 * flat_term y <= + mu_y y y2 y3 * sqrt(&20) + flat_term y + `, + (* {{{ proof *) + [ + REWRITE_TAC[mu_y_ft_combine]; + REWRITE_TAC[arith `x + y <= x + z <=> y <= z`]; + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[arith `a * b = (-- a) * (-- b)`]; + MATCH_MP_TAC Real_ext.REAL_PROP_LE_RMUL; + CONJ2_TAC; + REWRITE_TAC[arith `&0 <= -- f <=> f <= &0`]; + BY(ASM_SIMP_TAC[flat_term_neg]); + REWRITE_TAC[arith `-- x <= -- (&1 - u) <=> &1 - x <= u`]; + TYPIFY `#4.472135 <= sqrt(&20)` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC REAL_LE_RSQRT; + BY(REAL_ARITH_TAC); + TYPIFY `#0.551285 < sol0 /\ sol0 < #0.551286` (C SUBGOAL_THEN MP_TAC); + BY(REWRITE_TAC[ Flyspeck_constants.bounds]); + REWRITE_TAC[Sphere.h0]; + REWRITE_TAC[arith `a * b * c /d = ((a * b) * c) / d`]; + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC REAL_LE_RDIV_EQ; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let nonfunctional_mu6_x = prove_by_refinement( + `!x1 x2 x3 a b c. mu6_x x1 x2 x3 a b c = mu_y (sqrt x1) (sqrt x2) (sqrt x3)`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.mu6_x;Nonlin_def.mu_y;]; + BY(Functional_equation.F_REWRITE_TAC) + ]);; + (* }}} *) + +let tau_x_tau_residual_x_general = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + &4 <= x1 /\ + sqrt(x1) <= &2 * h0 /\ + &0 < x1 /\ &0 < x2 /\ &0 < x3 /\ &0 < x4 /\ &0 < x5 /\ &0 < x6 /\ + delta_x4 x1 x2 x3 x4 x5 x6 < &0 /\ + &0 < delta_x4 x2 x3 x1 x5 x6 x4 /\ + &0 < delta_x4 x3 x1 x2 x6 x4 x5 /\ + &0 <= delta_x x1 x2 x3 x4 x5 x6 ==> + taum_x x1 x2 x3 x4 x5 x6 = sqrt(delta_x x1 x2 x3 x4 x5 x6) * + tau_residual_x x1 x2 x3 x4 x5 x6 + flat_term_x x1`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[arith `&0 <= x <=> (&0 = x \/ &0 < x)`]; + DISCH_THEN DISJ_CASES_TAC; + REWRITE_TAC[Sphere.taum_x;Sphere.rhazim_x;Sphere.rhazim2_x;Sphere.rhazim3_x;Sphere.rhazim;Sphere.rhazim2;Sphere.rhazim3;Sphere.node2_y;Sphere.node3_y;Sphere.dih_y;LET_DEF;LET_END_DEF;Sphere.dih_x]; + ASM_SIMP_TAC[arith `x * x = x pow 2`;SQRT_POW_2;arith `&0 < x ==> &0 <= x`]; + SUBGOAL_THEN `delta_x x2 x3 x1 x5 x6 x4 = &0` SUBST1_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.delta_x] THEN REAL_ARITH_TAC); + SUBGOAL_THEN `delta_x x3 x1 x2 x6 x4 x5 = &0` SUBST1_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.delta_x] THEN REAL_ARITH_TAC); + FIRST_X_ASSUM (fun t -> SUBST1_TAC (GSYM t)); + REWRITE_TAC[arith `x * &0 = &0`;arith `&0 * x = &0`;SQRT_0]; + ASM_SIMP_TAC[Merge_ineq.atn2_0;arith `(-- y < &0 <=> &0 < y) /\ ( &0 < -- y <=> y < &0)`]; + REWRITE_TAC[Sphere.h0;Nonlinear_lemma.rho_alt;arith `pi/ &2 + pi/ &2 = pi /\ x + -- x = &0 /\ x * &0 = &0`]; + REWRITE_TAC[Sphere.flat_term_x;Sphere.flat_term;Nonlinear_lemma.sol0_const1;Sphere.h0]; + BY(REAL_ARITH_TAC); + REWRITE_TAC[Sphere.taum_x;Sphere.rhazim_x;Sphere.rhazim2_x;Sphere.rhazim3_x;Sphere.rhazim;Sphere.rhazim2;Sphere.rhazim3;Sphere.node2_y;Sphere.node3_y;Sphere.dih_y;LET_DEF;LET_END_DEF]; + ASM_SIMP_TAC[arith `x * x = x pow 2`;SQRT_POW_2;arith `&0 < x ==> &0 <= x`]; + REWRITE_TAC[Nonlin_def.tau_residual_x]; + REWRITE_TAC[Nonlin_def.tau_residual_x;Nonlin_def.rhazim_x_div_sqrtdelta_posbranch;Nonlin_def.rhazim2_x_div_sqrtdelta_posbranch;Nonlin_def.rhazim3_x_div_sqrtdelta_posbranch;Sphere.rotate2;Sphere.rotate3]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `a + b + c - d = (a - d) + b + c`]; + REWRITE_TAC[arith `a * (b + c) = a * b + a * c`]; + ONCE_REWRITE_TAC[arith `(a + b + c) +d = (a + d) + b + c`]; + BINOP_TAC; + ASM_SIMP_TAC[Merge_ineq.dih_x_dih_x_div_sqrtdelta_negbranch]; + REWRITE_TAC[Sphere.h0;Nonlinear_lemma.rho_alt;Sphere.flat_term;Sphere.flat_term_x;Nonlinear_lemma.sol0_const1;]; + BY(REAL_ARITH_TAC); + BINOP_TAC; + ONCE_REWRITE_TAC[arith `a * b * c = b * (a * c)`]; + AP_TERM_TAC; + GMATCH_SIMP_TAC Merge_ineq.dih_x_dih_x_div_sqrtdelta_posbranch; + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `delta_x x2 x3 x1 x5 x6 x4 = delta_x x1 x2 x3 x4 x5 x6` SUBST1_TAC; + BY(REWRITE_TAC[Sphere.delta_x] THEN REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[]); + ONCE_REWRITE_TAC[arith `a * b * c = b * (a * c)`]; + AP_TERM_TAC; + GMATCH_SIMP_TAC Merge_ineq.dih_x_dih_x_div_sqrtdelta_posbranch; + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `delta_x x3 x1 x2 x6 x4 x5 = delta_x x1 x2 x3 x4 x5 x6` SUBST1_TAC; + BY(REWRITE_TAC[Sphere.delta_x] THEN REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let OWZLKVY4 = prove_by_refinement( + ` main_nonlinear_terminal_v11 ==> ( !y1 y2 y3 y4 y5 y6. + &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + cstab <= y4 /\ y4 <= #3.915 /\ + y5 = &2 /\ + y6 = &2 /\ + &0 <= delta_y y1 y2 y3 y4 y5 y6 ==> + taud y1 y2 y3 y4 y5 y6 <= taum y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_CASES_TAC `&80 <= delta_y y1 y2 y3 y4 y5 y6`; + INTRO_TAC ((*--*)Terminal.get_main_nonlinear "2314572187") yys; + REWRITE_TAC[Sphere.ineq;TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0;Sphere.cstab] THEN REAL_ARITH_TAC); + ASM_SIMP_TAC[arith `n <= d ==> ~(d < n)`;arith `x > y <=> y < x`]; + MATCH_MP_TAC (arith `u = v ==> (u < t ==> v <= t)`); + MATCH_MP_TAC Functional_equation.taud_x_taud; + BY(ASM_TAC THEN REAL_ARITH_TAC); + RULE_ASSUM_TAC (REWRITE_RULE[arith `~(n <= d) <=> d < n`]); + GMATCH_SIMP_TAC Terminal.taum_taum_x; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Appendix.cstab] THEN REAL_ARITH_TAC); + REWRITE_TAC[Sphere.y_of_x]; + GMATCH_SIMP_TAC tau_x_tau_residual_x_general; + TYPIFY `&0 <= delta_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `&0 <= d` MP_TAC; + BY(REWRITE_TAC[Sphere.delta_y] THEN REAL_ARITH_TAC); + COMMENT "residue hypotheses"; + CONJ_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL_EQ); + INTRO_TAC (UNDISCH Terminal.EAR_DELTA_X4) yys; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist REWRITE_TAC); + REWRITE_TAC[arith `&4 = &2 * &2`]; + REWRITE_TAC[ REAL_OF_NUM_LT]; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + REWRITE_TAC[arith `0 < 2`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.delta_y;Sphere.h0;Appendix.cstab] THEN REAL_ARITH_TAC); + REWRITE_TAC[Nonlin_def.taud;Sphere.flat_term_x;Sphere.flat_term]; + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `v + u <= w + v <=> u <= w`]; + REWRITE_TAC[GSYM Sphere.delta_y]; + GMATCH_SIMP_TAC Real_ext.REAL_LE_LMUL_IMP; + CONJ_TAC; + GMATCH_SIMP_TAC SQRT_POS_LE; + BY(ASM_REWRITE_TAC[Sphere.delta_y]); + INTRO_TAC ((*--*)Terminal.get_main_nonlinear "7796879304") yys; + REWRITE_TAC[Sphere.ineq;Sphere.y_of_x]; + REWRITE_TAC[TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Appendix.cstab;Sphere.h0] THEN REAL_ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let OPEN_REAL_INTERVAL_SING = prove_by_refinement( + `!a b c. ~(real_interval(a,b) = {c})`, + (* {{{ proof *) + [ + REWRITE_TAC[EXTENSION;IN_SING;IN_REAL_INTERVAL]; + REPEAT WEAKER_STRIP_TAC; + ASM_CASES_TAC `a < b`; + FIRST_ASSUM (C INTRO_TAC [`(a + b)/ &2`]); + FIRST_X_ASSUM (C INTRO_TAC [`(&3 * a + &1 * b)/ &4`]); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `!` MP_TAC; + DISCH_THEN (C INTRO_TAC [`c:real`]); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* DERIVATIVES *) + + let diff tm rw x s = + let cv rw t = rhs(concl (REWRITE_CONV rw t)) in + let tm2 = cv rw tm in + ( (REWRITE_RULE (map GSYM rw) (Calc_derivative.differentiate tm2 x s)));; + + +let DERIVED_TAC ttac = + fun gl -> + let (_,[b;f;f';y;s]) = strip_comb (goal_concl gl) in + ttac (Calc_derivative.differentiate f y s) gl;; + +let derived_form_F = prove_by_refinement( + `!f f' x s. derived_form F f f' x s`, + (* {{{ proof *) + [ + REWRITE_TAC[Calc_derivative.derived_form] + ]);; + (* }}} *) + +let derived_form_delta_y = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. derived_form T (\q. delta_y q y2 y3 y4 y5 y6) + (y_of_x delta_x1 y1 y2 y3 y4 y5 y6 * &2 * y1) y1 (:real) `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Sphere.delta_y;Sphere.delta_x]; + DERIVED_TAC MP_TAC; + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + REWRITE_TAC[Nonlin_def.delta_x1;Sphere.y_of_x]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + let derived_form_delta_x = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6 .derived_form T (\q. delta_x q x2 x3 x4 x5 x6) + (delta_x1 x1 x2 x3 x4 x5 x6) + x1 + (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MP_TAC (diff `(\q. delta_x q x2 x3 x4 x5 x6)` [Sphere.delta_x] `x1:real` `(:real)`); + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + REWRITE_TAC[Nonlin_def.delta_x1]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let derived_form_delta_x1 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. derived_form T (\q. delta_x1 q x2 x3 x4 x5 x6) + ( -- &2 * x4) + x1 + (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MP_TAC (diff `(\q. delta_x1 q x2 x3 x4 x5 x6)` [Nonlin_def.delta_x1] `x1:real` `(:real)`); + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + REWRITE_TAC[Nonlin_def.delta_x1]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let deriv_form_taud = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. derived_form (&0 < delta_y y1 y2 y3 y4 y5 y6) + (\q. taud q y2 y3 y4 y5 y6) + ((-- #0.07 * delta_y y1 y2 y3 y4 y5 y6 + mu_y y1 y2 y3 * y_of_x delta_x1 y1 y2 y3 y4 y5 y6 * y1 + + (sol0 / (&2 * h0 - &2)) * sqrt(delta_y y1 y2 y3 y4 y5 y6))/ sqrt(delta_y y1 y2 y3 y4 y5 y6)) + y1 + (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Nonlin_def.taud;Nonlin_def.mu_y]; + DERIVED_TAC (MP_TAC o GEN_ALL o (GENL [`y1:real`;`y2:real`;`y3:real`;`y4:real`;`y5:real`;`y6:real`])); + DISCH_THEN (C INTRO_TAC [`(y_of_x delta_x1 y1 y2 y3 y4 y5 y6 * &2 * y1)`;`y1:real`;`y2:real`;`y3:real`;`y4:real`;`y5:real`;`y6:real`]); + REWRITE_TAC[derived_form_delta_y]; + TYPIFY `~(&2 * h0 - &2 = &0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + ASM_CASES_TAC `(&0 < delta_y y1 y2 y3 y4 y5 y6)`; + ASM_REWRITE_TAC[]; + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + Calc_derivative.CALC_ID_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `~(&2 = &0)`]; + CONJ_TAC; + GMATCH_SIMP_TAC SQRT_EQ_0; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + TYPED_ABBREV_TAC `a = sqrt(delta_y y1 y2 y3 y4 y5 y6)`; + TYPED_ABBREV_TAC `b = y_of_x delta_x1 y1 y2 y3 y4 y5 y6`; + TYPIFY `delta_y y1 y2 y3 y4 y5 y6 = a*a` (C SUBGOAL_THEN SUBST1_TAC); + EXPAND_TAC "a"; + GMATCH_SIMP_TAC (GSYM SQRT_MUL); + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[GSYM Nonlin_def.mu_y]; + TYPED_ABBREV_TAC `c = mu_y y1 y2 y3`; + TYPED_ABBREV_TAC `d = (&2 * h0 - &2)`; + TYPED_ABBREV_TAC `e = #0.07`; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[Calc_derivative.derived_form]) + ]);; + (* }}} *) + +(* renamed from deriv_form_taud_ALT *) + +let derived_form_taud_ALT = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. derived_form ((&0 < delta_y y1 y2 y3 y4 y5 y6) /\ (&0 <= y1 /\ &0 <= y2 /\ &0 <= y3)) + (\q. taud q y2 y3 y4 y5 y6) + (y_of_x taud_D1_num_x y1 y2 y3 y4 y5 y6 / sqrt(delta_y y1 y2 y3 y4 y5 y6)) + y1 + (:real)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.y_of_x;Functional_equation.nonfunctional_taud_D1;LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + ASM_CASES_TAC `&0 <= y1 /\ &0 <= y2 /\ &0 <= y3`; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[GSYM Functional_equation.mu6_x_mu_y]; + INTRO_TAC deriv_form_taud yys; + ASM_CASES_TAC `(&0 < delta_y y1 y2 y3 y4 y5 y6)`; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + Calc_derivative.CALC_ID_TAC; + SUBCONJ_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + DISCH_TAC; + REWRITE_TAC[GSYM Sphere.delta_y]; + REWRITE_TAC[GSYM Sphere.y_of_x]; + REWRITE_TAC[Sphere.h0]; + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[Calc_derivative.derived_form]); + BY(ASM_REWRITE_TAC[Calc_derivative.derived_form]) + ]);; + (* }}} *) + +let deriv_form_taud_D2 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. derived_form ((&0 < delta_y y1 y2 y3 y4 y5 y6) /\ (&0 < y1 /\ &0 <= y2 /\ &0 <= y3)) + (\q. (y_of_x taud_D1_num_x q y2 y3 y4 y5 y6 / sqrt(delta_y q y2 y3 y4 y5 y6))) + (y_of_x taud_D2_num_x y1 y2 y3 y4 y5 y6 / (sqrt(delta_y y1 y2 y3 y4 y5 y6) pow 3)) y1 (:real)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.y_of_x;Functional_equation.nonfunctional_taud_D2;Functional_equation.nonfunctional_taud_D1;LET_DEF;LET_END_DEF]; + REWRITE_TAC[Calc_derivative.derived_form;WITHINREAL_UNIV]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `(~(sqrt (delta_y y1 y2 y3 y4 y5 y6) = &0))` ((C SUBGOAL_THEN ASSUME_TAC)); + GMATCH_SIMP_TAC SQRT_EQ_0; + BY(ASM_TAC THEN REAL_ARITH_TAC); + MATCH_MP_TAC Arc_properties.HAS_REAL_DERIVATIVE_LOCAL; + TYPIFY `(\q. (-- #0.07 * delta_x (q * q) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6) + &1 / &2 * mu_y q y2 y3 * delta_x1 (q * q) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6) * &2 * q + sol0 / #0.52 * sqrt (delta_x (q * q) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6))) / sqrt (delta_y q y2 y3 y4 y5 y6))` EXISTS_TAC; + CONJ2_TAC; + TYPIFY `{q | &0 < q}` EXISTS_TAC; + ASM_REWRITE_TAC[arith `!q. &0 < q <=> q > &0`;IN_ELIM_THM]; + REWRITE_TAC[REAL_OPEN_HALFSPACE_GT]; + REPEAT WEAKER_STRIP_TAC; + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[arith `y > &0 <=> &0 < y`]); + GMATCH_SIMP_TAC (GSYM Functional_equation.mu6_x_mu_y); + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + BY(ASM_TAC THEN REAL_ARITH_TAC); + INTRO_TAC Calc_derivative.derived_form [`T`;`((\q. (-- #0.07 * delta_x (q * q) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6) + &1 / &2 * mu_y q y2 y3 * delta_x1 (q * q) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6) * &2 * q + sol0 / #0.52 * sqrt (delta_x (q * q) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6))) / sqrt (delta_y q y2 y3 y4 y5 y6)))`;`((-- #0.07 * delta_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6) * delta_x1 (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6) * &2 * sqrt (y1 * y1) - &1 / &4 * mu6_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6) * (delta_x1 (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6) * &2 * sqrt (y1 * y1)) pow 2 + &1 / &2 * mu6_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6) * delta_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6) * (-- &8 * (y1 * y1) * y4 * y4 + delta_x1 (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6) * &2)) / sqrt (delta_y y1 y2 y3 y4 y5 y6) pow 3)`;`y1:real`;`(:real)`]; + REWRITE_TAC[WITHINREAL_UNIV]; + DISCH_THEN ((unlist REWRITE_TAC) o GSYM); + DERIVED_TAC (MP_TAC o GEN_ALL o (GENL [`y1:real`;`y2:real`;`y3:real`;`y4:real`;`y5:real`;`y6:real`])); + ASM_REWRITE_TAC[GSYM Sphere.delta_y]; + DISCH_THEN (C INTRO_TAC [`y_of_x delta_x1 y1 y2 y3 y4 y5 y6 * &2 * y1`;`-- &4 * (y4 pow 2) * y1`;`-- #0.07`;`y_of_x delta_x1 y1 y2 y3 y4 y5 y6 * &2 * y1`;`y_of_x delta_x1 y1 y2 y3 y4 y5 y6 * &2 * y1`;`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]); + REWRITE_TAC[derived_form_delta_y]; + TYPIFY_GOAL_THEN `derived_form T (\q. mu_y q y2 y3) (-- #0.07) y1 (:real)` (unlist REWRITE_TAC); + REWRITE_TAC[Nonlin_def.mu_y]; + DERIVED_TAC MP_TAC; + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + TYPIFY_GOAL_THEN `derived_form T (\q. delta_x1 (q * q) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6)) (-- &4 * (y4 pow 2) * y1) y1 (:real)` (unlist REWRITE_TAC); + REWRITE_TAC[Nonlin_def.delta_x1]; + DERIVED_TAC MP_TAC; + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + BY(REAL_ARITH_TAC); + MATCH_MP_TAC (TAUT `(x <=> y) ==> (x ==> y)`); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + REWRITE_TAC[GSYM Sphere.y_of_x]; + TYPED_ABBREV_TAC `a = sqrt(delta_y y1 y2 y3 y4 y5 y6)`; + TYPED_ABBREV_TAC `b = y_of_x delta_x1 y1 y2 y3 y4 y5 y6`; + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + ASM_SIMP_TAC[arith `&0 < y ==> &0 <= y`]; + TYPIFY `y_of_x mu6_x y1 y2 y3 y4 y5 y6 = mu_y y1 y2 y3` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[Sphere.y_of_x]; + GMATCH_SIMP_TAC (GSYM Functional_equation.mu6_x_mu_y); + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `delta_y y1 y2 y3 y4 y5 y6 = a * a` (C SUBGOAL_THEN SUBST1_TAC); + EXPAND_TAC "a"; + GMATCH_SIMP_TAC (GSYM SQRT_MUL); + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + BY(ASM_TAC THEN REAL_ARITH_TAC); + Calc_derivative.CALC_ID_TAC; + TYPIFY_GOAL_THEN `~(a = &0)` (unlist REWRITE_TAC); + BY(ASM_REWRITE_TAC[]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let thD3 = + let th1 = (diff `((\q. (-- #0.07 * + delta_y q y2 y3 y4 y5 y6 * + (--(q * q) * y4 * y4 + + (y2 * y2) * y5 * y5 - (y3 * y3) * y5 * y5 - (y2 * y2) * y6 * y6 + + (y3 * y3) * y6 * y6 + + (y4 * y4) * + (--(q * q) + y2 * y2 + y3 * y3 - y4 * y4 + y5 * y5 + y6 * y6)) * + &2 * + sqrt (q * q) - + &1 / &4 * + ( #0.012 + + #0.07 * ( #2.52 - sqrt (q * q)) + + #0.01 * ( #2.52 * &2 - sqrt (y2 * y2) - sqrt (y3 * y3))) * + ((--(q * q) * y4 * y4 + + (y2 * y2) * y5 * y5 - + (y3 * y3) * y5 * y5 - + (y2 * y2) * y6 * y6 + + (y3 * y3) * y6 * y6 + + (y4 * y4) * + (--(q * q) + y2 * y2 + y3 * y3 - y4 * y4 + y5 * y5 + y6 * y6)) * + &2 * + sqrt (q * q)) pow + 2 + + &1 / &2 * + ( #0.012 + + #0.07 * ( #2.52 - sqrt (q * q)) + + #0.01 * ( #2.52 * &2 - sqrt (y2 * y2) - sqrt (y3 * y3))) * + delta_y q y2 y3 y4 y5 y6 * + (-- &8 * (q * q) * y4 * y4 + + (--(q * q) * y4 * y4 + + (y2 * y2) * y5 * y5 - + (y3 * y3) * y5 * y5 - + (y2 * y2) * y6 * y6 + + (y3 * y3) * y6 * y6 + + (y4 * y4) * + (--(q * q) + y2 * y2 + y3 * y3 - y4 * y4 + y5 * y5 + y6 * y6)) * + &2)) / + sqrt (delta_y q y2 y3 y4 y5 y6) pow 3)) ` [] `y1:real` `(:real)`) in + let fr = frees (concl(GENL [`y1:real`;`y2:real`;`y3:real`;`y4:real`;`y5:real`;`y6:real`] th1)) in + let th2 = GENL fr th1 in + let ddelta_y = `(y_of_x delta_x1 y1 y2 y3 y4 y5 y6 * &2 * y1)` in + let th3 = SPECL [ddelta_y;ddelta_y;ddelta_y] th2 in + let th4 = REWRITE_RULE[derived_form_delta_y] th3 in + let (h,[b;f;f';y;s]) = strip_comb (concl th4) in + let tm = list_mk_comb (h,[b;f;`f':real`;y;s]) in + GENL [`y1:real`;`y2:real`;`y3:real`;`y4:real`;`y5:real`;`y6:real`] ( EXISTS (mk_exists (`f':real`,tm),f') th4);; + +let derived_form_taud_D3 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. ?f'. derived_form ((&0 < delta_y y1 y2 y3 y4 y5 y6) /\ (&0 < y1 /\ &0 <= y2 /\ &0 <= y3)) + (\q. (y_of_x taud_D2_num_x q y2 y3 y4 y5 y6 / (sqrt(delta_y q y2 y3 y4 y5 y6) pow 3))) + f' y1 (:real)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.y_of_x;Functional_equation.nonfunctional_taud_D2;Nonlin_def.delta_x1;GSYM Sphere.delta_y;nonfunctional_mu6_x;Nonlin_def.mu_y;Functional_equation.nonfunctional_taud_D1;LET_DEF;LET_END_DEF]; + REWRITE_TAC[Calc_derivative.derived_form;WITHINREAL_UNIV]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[RIGHT_EXISTS_IMP_THM]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC thD3 yys; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `f'` EXISTS_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Calc_derivative.derived_form]; + ANTS_TAC; + TYPIFY_GOAL_THEN `&0 < y1 * y1` (unlist REWRITE_TAC); + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC SQRT_EQ_0; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[WITHINREAL_UNIV]) + ]);; + (* }}} *) + +let SECOND_DERIVATIVE_TEST = prove_by_refinement( + `!f f' f'' z s. + z IN s /\ real_open s /\ + (!x. x IN s ==> (f has_real_derivative f' x) (atreal x)) /\ + (!x. x IN s ==> (f' has_real_derivative f'' x) (atreal x)) /\ + (f'' real_continuous atreal z) /\ + (!x. x IN s ==> f z <= f x) ==> + (f' z = &0 /\ &0 <= f'' z)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + SUBCONJ_TAC; + INTRO_TAC REAL_DERIVATIVE_ZERO_MAXMIN [`f`;`f' z`;`z`;`s`]; + DISCH_THEN MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + REWRITE_TAC[arith `&0 <= r <=> ~(r < &0)`]; + DISCH_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[real_continuous_atreal]); + FIRST_X_ASSUM_ST `abs` (C INTRO_TAC [`-- f'' z`]); + ANTS_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `s' = s INTER {x | abs(x - z) < d}` ; + TYPIFY `z IN s'` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "s'"; + BY(ASM_REWRITE_TAC[IN_INTER;IN_ELIM_THM;arith `z - z = &0`;REAL_ABS_0]); + TYPIFY `real_open s'` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "s'"; + MATCH_MP_TAC REAL_OPEN_INTER; + ASM_REWRITE_TAC[]; + REWRITE_TAC[real_open;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `d - abs (x - z)` EXISTS_TAC; + CONJ_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT "restrict to an interval"; + TYPIFY `?a b. real_interval (a,b) SUBSET s' /\ z IN real_interval(a,b)` (C SUBGOAL_THEN MP_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[real_open]); + FIRST_X_ASSUM (C INTRO_TAC [`z`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + GEXISTL_TAC [`z - e`;`z + e`]; + REWRITE_TAC[SUBSET;IN_REAL_INTERVAL]; + REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC REAL_OPEN_REAL_INTERVAL [`a`;`b`]; + DISCH_TAC; + TYPIFY `!x. x IN s' ==> f'' x < &0` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`x`]); + ANTS_TAC; + FIRST_X_ASSUM MP_TAC; + EXPAND_TAC "s'"; + BY(REWRITE_TAC[IN_INTER;IN_ELIM_THM] THEN REAL_ARITH_TAC); + BY(REAL_ARITH_TAC); + INTRO_TAC Counting_spheres.REAL_CONVEX_ON_SECOND_SECANT [`(\x. -- f x)`;`(\x. -- f' x)`;`(\x. -- f'' x)`;`real_interval (a,b)`]; + ANTS_TAC; + REWRITE_TAC[IS_REALINTERVAL_INTERVAL;OPEN_REAL_INTERVAL_SING]; + TYPIFY `!x. x IN real_interval(a,b) ==> x IN s` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_TAC THEN SET_TAC[]); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_NEG; + GMATCH_SIMP_TAC HAS_REAL_DERIVATIVE_WITHIN_REAL_OPEN; + BY(ASM_SIMP_TAC[REAL_OPEN_REAL_INTERVAL]); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_NEG; + GMATCH_SIMP_TAC HAS_REAL_DERIVATIVE_WITHIN_REAL_OPEN; + BY(ASM_SIMP_TAC[REAL_OPEN_REAL_INTERVAL]); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (arith `f < &0 ==> &0 <= -- f`); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + DISCH_TAC; + TYPIFY `!x. x IN real_interval(a,b) ==> f x = f z` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`x`;`z`]); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `fz <= fx` (C INTRO_TAC [`x`]); + ANTS_TAC; + BY(ASM_TAC THEN SET_TAC[]); + BY(REAL_ARITH_TAC); + TYPIFY `!x. x IN real_interval (a,b) ==> (f has_real_derivative &0) (atreal x)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Arc_properties.HAS_REAL_DERIVATIVE_LOCAL; + TYPIFY `(\ (x:real). f z)` EXISTS_TAC; + REWRITE_TAC[]; + CONJ_TAC; + BY(REWRITE_TAC[HAS_REAL_DERIVATIVE_CONST]); + TYPIFY `real_interval(a,b)` EXISTS_TAC; + BY(ASM_REWRITE_TAC[REAL_OPEN_REAL_INTERVAL]); + COMMENT "show f' is zero"; + TYPIFY `!x. x IN real_interval(a,b) ==> (f' x = &0)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC REAL_DERIVATIVE_UNIQUE_ATREAL; + GEXISTL_TAC [`f`;`x`]; + ASM_SIMP_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + COMMENT "show f' has zero derivative"; + TYPIFY `!x. x IN real_interval (a,b) ==> (f' has_real_derivative &0) (atreal x)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Arc_properties.HAS_REAL_DERIVATIVE_LOCAL; + TYPIFY `(\ (x:real). &0)` EXISTS_TAC; + REWRITE_TAC[]; + CONJ_TAC; + BY(REWRITE_TAC[HAS_REAL_DERIVATIVE_CONST]); + TYPIFY `real_interval(a,b)` EXISTS_TAC; + BY(ASM_REWRITE_TAC[REAL_OPEN_REAL_INTERVAL]); + COMMENT "show f'' is zero"; + TYPIFY `!x. x IN real_interval(a,b) ==> (f'' x = &0)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC REAL_DERIVATIVE_UNIQUE_ATREAL; + GEXISTL_TAC [`f'`;`x`]; + ASM_SIMP_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + FIRST_X_ASSUM (C INTRO_TAC [`z`]); + ASM_REWRITE_TAC[]; + REPLICATE_TAC 12 (FIRST_X_ASSUM kill); + FIRST_X_ASSUM_ST `f'' z < &0` MP_TAC; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* END OF DERIVATIVES *) + + +(* CONTINUITY *) + +let continuous_preimage_closed = prove_by_refinement( + `!f s t. real_closed s /\ real_closed t /\ f real_continuous_on s ==> + real_closed { x | x IN s /\ f x IN t }`, + (* {{{ proof *) + [ + REWRITE_TAC[real_continuous_on]; + REWRITE_TAC[real_closed;real_open;IN_DIFF;IN_UNIV;IN_ELIM_THM;DE_MORGAN_THM]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM DISJ_CASES_TAC; + BY(ASM_MESON_TAC[]); + TYPIFY `~(x IN s)` ASM_CASES_TAC; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM (C INTRO_TAC [`x`]); + RULE_ASSUM_TAC(REWRITE_RULE[TAUT `~ ~ x = x`]); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (C INTRO_TAC [`f x`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`e`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `d` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `(x' IN s)` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let continuous_preimage_open = prove_by_refinement( + `!f s t. real_open s /\ real_open t /\ f real_continuous_on s ==> + real_open { x | x IN s /\ f x IN t }`, + (* {{{ proof *) + [ + REWRITE_TAC[real_continuous_on]; + REWRITE_TAC[real_closed;real_open;IN_DIFF;IN_UNIV;IN_ELIM_THM;DE_MORGAN_THM]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`x`]); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (C INTRO_TAC [`f x`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `x IN s ==> p` (C INTRO_TAC [`x`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `?` (C INTRO_TAC [`e`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `min d e'` EXISTS_TAC; + CONJ_TAC; + REWRITE_TAC[real_min]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + SUBCONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[real_min] THEN REAL_ARITH_TAC); + DISCH_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[real_min] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let delta_y_continuous = prove_by_refinement( + `!y2 y3 y4 y5 y6. (\q. delta_y q y2 y3 y4 y5 y6) real_continuous_on (:real)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT; + REWRITE_TAC[REAL_OPEN_UNIV;IN_UNIV]; + GEN_TAC; + INTRO_TAC derived_form_delta_y [`x`;`y2`;`y3`;`y4`;`y5`;`y6`]; + REWRITE_TAC[Calc_derivative.derived_form;WITHINREAL_UNIV]; + DISCH_THEN (MP_TAC o (MATCH_MP HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL)); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let taud_continuous = prove_by_refinement( + `!y2 y3 y4 y5 y6. (\q. taud q y2 y3 y4 y5 y6) real_continuous_on {q | &0 <= delta_y q y2 y3 y4 y5 y6}`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[REAL_CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Nonlin_def.taud]; + REWRITE_TAC[arith `!q. a * (q - b)/ r = (a * inv r) * q + a * (-- b) * inv r`]; + REWRITE_TAC[arith `!q. a + b * (c - q) + d = (-- b) * q + (a + b*c + d)`]; + REPEAT (TRY CONJ_TAC THEN REWRITE_TAC[REAL_CONTINUOUS_CONST;REAL_CONTINUOUS_WITHIN_ID] THEN ((GMATCH_SIMP_TAC REAL_CONTINUOUS_ADD) ORELSE (GMATCH_SIMP_TAC REAL_CONTINUOUS_LMUL) ORELSE (GMATCH_SIMP_TAC REAL_CONTINUOUS_MUL))); + CONJ_TAC; + REWRITE_TAC[MESON [o_THM;FUN_EQ_THM] `(\q. sqrt (delta_y q y2 y3 y4 y5 y6)) = sqrt o (\q. delta_y q y2 y3 y4 y5 y6)`]; + MATCH_MP_TAC REAL_CONTINUOUS_WITHINREAL_COMPOSE; + REWRITE_TAC[IMAGE;IN_ELIM_THM]; + CONJ_TAC; + MATCH_MP_TAC REAL_CONTINUOUS_WITHINREAL_SUBSET; + TYPIFY `(:real)` EXISTS_TAC; + REWRITE_TAC[delta_y_continuous;SUBSET;IN_UNIV]; + INTRO_TAC delta_y_continuous [`y2`;`y3`;`y4`;`y5`;`y6`]; + REWRITE_TAC[REAL_CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN]; + DISCH_THEN MATCH_MP_TAC; + BY(REWRITE_TAC[IN_UNIV]); + TYPED_ABBREV_TAC `u = delta_y x y2 y3 y4 y5 y6` ; + MATCH_MP_TAC REAL_CONTINUOUS_WITHINREAL_SUBSET; + TYPIFY `{u | &0 <= u}` EXISTS_TAC; + REWRITE_TAC[REAL_CONTINUOUS_WITHIN_SQRT_STRONG]; + REWRITE_TAC[SUBSET;IN_ELIM_THM]; + BY(MESON_TAC[]); + BY(REPEAT (TRY CONJ_TAC THEN REWRITE_TAC[REAL_CONTINUOUS_CONST;REAL_CONTINUOUS_WITHIN_ID] THEN ((GMATCH_SIMP_TAC REAL_CONTINUOUS_ADD) ORELSE (GMATCH_SIMP_TAC REAL_CONTINUOUS_LMUL) ORELSE (GMATCH_SIMP_TAC REAL_CONTINUOUS_MUL)))) + ]);; + (* }}} *) + +let taud_minimizer = prove_by_refinement( + `!a b d y2 y3 y4 y5 y6. + (let s = real_interval [a,b] INTER { q | d <= delta_y q y2 y3 y4 y5 y6} in + (&0 <= d /\ ~(s = {}) ==> + (?z1. z1 IN s /\ (!y1. y1 IN s ==> taud z1 y2 y3 y4 y5 y6 <= taud y1 y2 y3 y4 y5 y6))))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC REAL_CONTINUOUS_ATTAINS_INF; + ASM_REWRITE_TAC[]; + CONJ2_TAC; + MATCH_MP_TAC REAL_CONTINUOUS_ON_SUBSET; + TYPIFY `{q | &0 <= delta_y q y2 y3 y4 y5 y6}` EXISTS_TAC; + REWRITE_TAC[taud_continuous]; + REWRITE_TAC[SUBSET;IN_INTER;IN_ELIM_THM]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[REAL_COMPACT_EQ_BOUNDED_CLOSED]; + CONJ_TAC; + MATCH_MP_TAC REAL_BOUNDED_SUBSET; + TYPIFY `real_interval[a,b]` EXISTS_TAC; + REWRITE_TAC[REAL_BOUNDED_REAL_INTERVAL]; + BY(SET_TAC[]); + MATCH_MP_TAC REAL_CLOSED_INTER; + REWRITE_TAC[REAL_CLOSED_REAL_INTERVAL]; + TYPIFY_GOAL_THEN `!q. d <= delta_y q y2 y3 y4 y5 y6 <=> q IN (:real) /\ ((\q. delta_y q y2 y3 y4 y5 y6) q IN { t | d <= t})` (unlist REWRITE_TAC); + BY(REWRITE_TAC[IN_UNIV;IN_ELIM_THM]); + MATCH_MP_TAC continuous_preimage_closed; + REWRITE_TAC[delta_y_continuous]; + REWRITE_TAC[REAL_CLOSED_UNIV]; + BY(REWRITE_TAC[arith `d <= t <=> t >= d`;REAL_CLOSED_HALFSPACE_GE]) + ]);; + (* }}} *) + +let taud_minimizer_cases = prove_by_refinement( + `!a b d z1 y2 y3 y4 y5 y6. + (let s = real_interval [a,b] INTER { q | d <= delta_y q y2 y3 y4 y5 y6} in + (&0 <= d /\ &0 <= a /\ &0 <= y2 /\ &0 <= y3 /\ z1 IN s /\ + (!y1. y1 IN s ==> taud z1 y2 y3 y4 y5 y6 <= taud y1 y2 y3 y4 y5 y6) ==> + ( z1 = a \/ z1 = b \/ d = delta_y z1 y2 y3 y4 y5 y6 \/ + (y_of_x taud_D1_num_x z1 y2 y3 y4 y5 y6 = &0 /\ + &0 <= y_of_x taud_D2_num_x z1 y2 y3 y4 y5 y6) )))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `z1 = a` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `z1 = b` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `d = delta_y z1 y2 y3 y4 y5 y6` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + TYPIFY `a < z1 /\ z1 < b /\ d < delta_y z1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN ASSUME_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[IN_REAL_INTERVAL;IN_INTER;IN_ELIM_THM]); + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPED_ABBREV_TAC `s' = (real_interval (a,b) INTER {q | d < delta_y q y2 y3 y4 y5 y6})` ; + TYPIFY `real_open s'` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY_GOAL_THEN `s' = { q | q IN real_interval (a,b) /\ (delta_y q y2 y3 y4 y5 y6 IN { t | d < t}) }` (unlist ONCE_REWRITE_TAC); + EXPAND_TAC "s'"; + BY(REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INTER]); + MATCH_MP_TAC continuous_preimage_open; + REWRITE_TAC[REAL_OPEN_REAL_INTERVAL]; + CONJ_TAC; + BY(REWRITE_TAC[REAL_OPEN_HALFSPACE_GT;arith `d < t <=> t > d`]); + MATCH_MP_TAC REAL_CONTINUOUS_ON_SUBSET; + TYPIFY `(:real)` EXISTS_TAC; + REWRITE_TAC[delta_y_continuous]; + BY(SET_TAC[]); + INTRO_TAC SECOND_DERIVATIVE_TEST [`(\q. taud q y2 y3 y4 y5 y6)`;`(\q. y_of_x taud_D1_num_x q y2 y3 y4 y5 y6 / sqrt(delta_y q y2 y3 y4 y5 y6))`;`(\q. y_of_x taud_D2_num_x q y2 y3 y4 y5 y6 / (sqrt(delta_y q y2 y3 y4 y5 y6)) pow 3)`;`z1`;`s'`]; + ASM_REWRITE_TAC[]; + COMMENT "big ants"; + ANTS_TAC; + SUBCONJ_TAC; + EXPAND_TAC "s'"; + REWRITE_TAC[IN_INTER;IN_ELIM_THM;IN_REAL_INTERVAL]; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC derived_form_taud_ALT [`x`;`y2`;`y3`;`y4`;`y5`;`y6`]; + REWRITE_TAC[Calc_derivative.derived_form;WITHINREAL_UNIV]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MP_TAC; + EXPAND_TAC "s'"; + REWRITE_TAC[IN_INTER;IN_ELIM_THM;IN_REAL_INTERVAL]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[]); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC deriv_form_taud_D2 [`x`;`y2`;`y3`;`y4`;`y5`;`y6`]; + REWRITE_TAC[Calc_derivative.derived_form;WITHINREAL_UNIV]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MP_TAC; + EXPAND_TAC "s'"; + REWRITE_TAC[IN_INTER;IN_ELIM_THM;IN_REAL_INTERVAL]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[]); + CONJ2_TAC; + EXPAND_TAC "s'"; + REWRITE_TAC[IN_INTER;IN_ELIM_THM;IN_REAL_INTERVAL]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + REWRITE_TAC[IN_INTER;IN_ELIM_THM;IN_REAL_INTERVAL]; + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT "last ant"; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_ATREAL; + INTRO_TAC derived_form_taud_D3 [`z1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Calc_derivative.derived_form]; + ANTS_TAC; + FIRST_X_ASSUM MP_TAC; + EXPAND_TAC "s'"; + REWRITE_TAC[IN_INTER;IN_ELIM_THM;IN_REAL_INTERVAL]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[WITHINREAL_UNIV]; + BY(MESON_TAC[]); + COMMENT "down to 1"; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `&0 < sqrt(delta_y z1 y2 y3 y4 y5 y6)` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC REAL_LT_RSQRT; + BY(ASM_TAC THEN REAL_ARITH_TAC); + CONJ_TAC; + FIRST_X_ASSUM_ST `taud_D1_num_x` MP_TAC; + REWRITE_TAC[REAL_DIV_EQ_0]; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `taud_D2_num_x` MP_TAC; + GMATCH_SIMP_TAC REAL_LE_RDIV_EQ; + CONJ_TAC; + MATCH_MP_TAC REAL_POW_LT; + BY(ASM_REWRITE_TAC[]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let taud_minimizer_terminal_pent_cases = prove_by_refinement( + ` main_nonlinear_terminal_v11 ==> (!d y1 y2 y3 y4 y5 y6. + (let s = real_interval [&2,&2 * h0] INTER { q | d <= delta_y q y2 y3 y4 y5 y6} in + (&0 <= d /\ y1 IN s /\ &2 <= y2 /\ y2 <= &2 * h0 /\ &2 <= y3 /\ y3 <= &2 * h0 /\ + #3.01 <= y4 /\ y4 <= #3.237 /\ y5 = &2 /\ y6 = &2 ==> + (?z1. z1 IN s /\ taud z1 y2 y3 y4 y5 y6 <= taud y1 y2 y3 y4 y5 y6 /\ + ( z1 = &2 \/ z1 = &2 * h0 \/ d = delta_y z1 y2 y3 y4 y5 y6 \/ + #0.12 <= taud z1 y2 y3 y4 y5 y6)))))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF;IN_INTER;IN_REAL_INTERVAL;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC taud_minimizer [`&2`;`&2 * h0`;`d`;`y2`;`y3`;`y4`;`y5`;`y6`]; + REWRITE_TAC[LET_DEF;LET_END_DEF;IN_INTER;IN_REAL_INTERVAL;IN_ELIM_THM;EXTENSION;IN_INTER;NOT_IN_EMPTY;IN_REAL_INTERVAL;IN_ELIM_THM]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `z1` EXISTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_MESON_TAC[]); + INTRO_TAC taud_minimizer_cases [`&2`;`&2 * h0`;`d`;`z1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + REWRITE_TAC[LET_DEF;LET_END_DEF;IN_INTER;IN_REAL_INTERVAL;IN_ELIM_THM;EXTENSION;IN_INTER;NOT_IN_EMPTY;IN_REAL_INTERVAL;IN_ELIM_THM]; + ANTS_TAC; + BY(ASM_MESON_TAC[arith `&0 <= &2`;arith `&2 <= y ==> &0 <= y`]); + ASM_CASES_TAC `z1 = &2` THEN FIRST_ASSUM (unlist REWRITE_TAC); + ASM_CASES_TAC `z1 = &2 * h0` THEN FIRST_ASSUM (unlist REWRITE_TAC); + ASM_CASES_TAC `d = delta_y z1 y2 y3 y4 y5 y6` THEN FIRST_ASSUM (unlist REWRITE_TAC); + ASM_CASES_TAC `~(delta_y z1 y2 y3 y4 y5 y6 < &20)`; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((*--*)Terminal.get_main_nonlinear "1347067436") [`z1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC (GSYM Functional_equation.taud_x_taud); + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(REPLICATE_TAC 3(FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT "second get"; + DISCH_TAC; + INTRO_TAC ((*--*)Terminal.get_main_nonlinear "6601228004") [`z1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let taud_mud_126_x = prove_by_refinement( + `!y3' y4' y5' y1 y2 y3 y4 y5 y6. + &0 <= y1 /\ &0 <= y2 ==> + y_of_x (mud_126_x_v1 y3 y4 y5) y1 y2 y3' y4' y5' y6 = taud y3 y1 y2 y6 y4 y5 - flat_term y3 + `, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.mud_126_x;Nonlin_def.taud;Sphere.flat_term;]; + Functional_equation.F_REWRITE_TAC; + REWRITE_TAC[Sphere.delta_126_x;GSYM Sphere.delta_y]; + REPEAT WEAKER_STRIP_TAC; + REPEAT (GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx); + ASM_REWRITE_TAC[]; + TYPIFY `delta_y y3 y1 y2 y6 y4 y5 = delta_y y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let taud_mud_135_x = prove_by_refinement( + `!y2' y4' y6' y1 y2 y3 y4 y5 y6. + &0 <= y1 /\ &0 <= y3 ==> + y_of_x (mud_135_x_v1 y2 y4 y6) y1 y2' y3 y4' y5 y6' = taud y2 y1 y3 y5 y4 y6 - flat_term y2 + `, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.mud_135_x;Nonlin_def.taud;Sphere.flat_term;]; + Functional_equation.F_REWRITE_TAC; + REWRITE_TAC[Sphere.delta_135_x;GSYM Sphere.delta_y]; + REPEAT WEAKER_STRIP_TAC; + REPEAT (GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx); + ASM_REWRITE_TAC[]; + TYPIFY `delta_y y2 y1 y3 y5 y4 y6 = delta_y y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let mud_126_135 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6 y3' y4' y5'. mud_126_x_v1 y3' y4' y5' y1 y2 y3 y4 y5 y6 = + mud_135_x_v1 y3' y4' y5' y1 y3 y2 y4 y6 y5`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.mud_135_x;Nonlin_def.mud_126_x;]; + Functional_equation.F_REWRITE_TAC; + REWRITE_TAC[Sphere.delta_135_x;Sphere.delta_126_x;GSYM Sphere.delta_y]; + BY(MESON_TAC[Merge_ineq.delta_x_sym]); + ]);; + (* }}} *) + +let flat_term_2 = prove_by_refinement( + `flat_term(&2) = -- sol0`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.flat_term]; + Calc_derivative.CALC_ID_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let flat_term_2h0 = prove_by_refinement( + `flat_term(&2 * h0) = &0`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.flat_term]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let flat_term_sol0 = prove_by_refinement( + `!y. &2 <= y ==> --sol0 <= flat_term y`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.flat_term]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `sol0 * (y - &2 * h0)/(&2 * h0 - &2) = -- sol0 + sol0 * (y - &2) / (&2 * h0 - &2)` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + MATCH_MP_TAC (arith `&0 <= x ==> h <= h + x`); + GMATCH_SIMP_TAC REAL_LE_MUL; + GMATCH_SIMP_TAC REAL_LE_RDIV_EQ; + MP_TAC Flyspeck_constants.bounds; + BY(REWRITE_TAC[Sphere.h0] THEN FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let taud_2h0 = prove_by_refinement( + `!y2 y3 y4 y5 y6. + &0 <= delta_y (&2 * h0) y2 y3 y4 y5 y6 /\ + y2 <= &2 * h0 /\ y3 <= &2 * h0 ==> + &0 <= taud (&2 * h0) y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.taud;arith `x - x = &0 /\ &0 / x = &0 /\ x * &0 = &0 /\ &0 + x = x`]; + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC REAL_LE_MUL; + CONJ_TAC; + GMATCH_SIMP_TAC SQRT_POS_LE; + BY(ASM_REWRITE_TAC[]); + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let quadratic_root_minus_works = prove_by_refinement( + `!a b c. + ~(a = &0) /\ &0 <= b pow 2 - &4 * a * c + ==> (let x = -- ( b + sqrt(b pow 2 - &4 * a * c))/ (&2 * a) in + a * x pow 2 + b * x + c = &0)`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + Calc_derivative.CALC_ID_TAC; + ASM_REWRITE_TAC[arith `~(&2 = &0)`]; + TYPED_ABBREV_TAC `d = b pow 2 - &4 * a * c`; + TYPIFY `sqrt d * sqrt d = d` (C SUBGOAL_THEN MP_TAC); + GMATCH_SIMP_TAC (GSYM SQRT_MUL); + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM MP_TAC; + BY(CONV_TAC REAL_RING) + ]);; + (* }}} *) + +let quadratic_root_imp_discr_nn = prove_by_refinement( + `!a b c x. (a * x pow 2 + b * x + c = &0) ==> + &0 <= b pow 2 - &4 * a * c`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `b pow 2 - &4 * a * c = (&2 * a * x + b ) pow 2` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM MP_TAC; + BY(CONV_TAC REAL_RING); + BY(REWRITE_TAC[ REAL_LE_POW_2]) + ]);; + (* }}} *) + +let quadratic_root_plus_eq = prove_by_refinement( + `!a b c m x. + (&0 < a) /\ (m <= x) /\ a * x pow 2 + b * x + c = &0 /\ + (&0 < &2 * m * a + b \/ (&2 * m * a + b) pow 2 < b pow 2 - &4 * a * c) ==> + quadratic_root_plus (a,b,c) = x`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Tame_lemmas.quadratic_root_plus_gt_eq; + TYPED_ABBREV_TAC `y = -- (b + sqrt( b pow 2 - &4 * a * c)) / (&2 * a)` ; + TYPIFY `y` EXISTS_TAC; + ASM_REWRITE_TAC[]; + SUBCONJ_TAC; + MATCH_MP_TAC quadratic_root_imp_discr_nn; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + CONJ_TAC; + EXPAND_TAC "y"; + MATCH_MP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] quadratic_root_minus_works); + BY(ASM_REWRITE_TAC[] THEN ASM_TAC THEN REAL_ARITH_TAC); + COMMENT "both cases"; + TYPIFY `y < m` ENOUGH_TO_SHOW_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `&2 * a * y + b < &2 * a * m + b` ENOUGH_TO_SHOW_TAC; + REWRITE_TAC[arith `&2 * a * y + b < &2 * a * m + b <=> a * y < a * m`]; + GMATCH_SIMP_TAC REAL_LT_LMUL_EQ; + BY(ASM_REWRITE_TAC[]); + TYPIFY `&2 * a * y + b = -- sqrt(b pow 2 - &4 * a *c)` (C SUBGOAL_THEN SUBST1_TAC); + EXPAND_TAC "y"; + Calc_derivative.CALC_ID_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + COMMENT "first case"; + ASM_CASES_TAC `&0 < &2 * m * a + b`; + MATCH_MP_TAC REAL_LET_TRANS; + TYPIFY `&0` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `-- x <= &0 <=> &0 <= x`]; + GMATCH_SIMP_TAC SQRT_POS_LE; + BY(ASM_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM DISJ_CASES_TAC; + BY(ASM_MESON_TAC[]); + TYPIFY `(&2 * m * a + b) pow 2 < sqrt (b pow 2 - &4 * a * c) pow 2` (C SUBGOAL_THEN MP_TAC); + GMATCH_SIMP_TAC SQRT_POW_2; + BY(ASM_REWRITE_TAC[]); + TYPED_ABBREV_TAC `d = sqrt(b pow 2 - &4 * a * c) `; + ONCE_REWRITE_TAC[arith `-- d < &2 * a * m + b <=> --d < &2 * m * a +b`]; + REWRITE_TAC[GSYM REAL_LT_SQUARE_ABS]; + TYPIFY `&0 <= d` (C SUBGOAL_THEN MP_TAC); + EXPAND_TAC "d"; + GMATCH_SIMP_TAC SQRT_POS_LE; + BY(ASM_REWRITE_TAC[]); + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let edge2_flatD_x1_delta_lemma2 = prove_by_refinement( + `!d x1 x2 x3 x4 x5 x6. + delta_x x1 x2 x3 x4 x5 x6 = d /\ + &0 < x4 /\ + (delta_x1 x1 x2 x3 x4 x5 x6 < &0) + ==> + edge2_flatD_x1 d x2 x3 x4 x5 x6 = x1`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.edge2_flatD_x1]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `b = (-- delta_x1 (&0) x2 x3 x4 x5 x6)`; + TYPED_ABBREV_TAC `c = (d - delta_x (&0) x2 x3 x4 x5 x6)`; + TYPIFY `!z. d - delta_x z x2 x3 x4 x5 x6 = x4 * z pow 2 + b * z + c` ((C SUBGOAL_THEN ASSUME_TAC)); + EXPAND_TAC "c"; + EXPAND_TAC "b"; + REWRITE_TAC[Sphere.delta_x;Nonlin_def.delta_x1]; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[Nonlinear_lemma.abc_quadratic]; + TYPIFY `b pow 2 - &4 * x4 * c = ups_x x2 x3 x4 * ups_x x4 x5 x6 - &4 * x4 * d` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "b"; + EXPAND_TAC "c"; + REWRITE_TAC[Sphere.delta_x;Nonlin_def.delta_x1;Sphere.ups_x]; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC quadratic_root_plus_eq; + TYPIFY `x1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `x <= x`]; + CONJ_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`x1`]); + BY(ASM_TAC THEN REAL_ARITH_TAC); + DISJ1_TAC; + EXPAND_TAC "b"; + FIRST_X_ASSUM_ST `d < &0` MP_TAC; + REWRITE_TAC[Nonlin_def.delta_x1]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let edge2_flatD_x1_delta_lemma3 = prove_by_refinement( + ` main_nonlinear_terminal_v11 ==> (!d y1 y2 y3 y4 y5 y6. + delta_y y1 y2 y3 y4 y5 y6 = d /\ + &0 <= d /\ d <= &20 ==> + (ineq [(&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] + ( edge2_flatD_x1 d (y2*y2) (y3*y3) (y4*y4) (y5*y5) (y6*y6) = y1*y1)))`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC edge2_flatD_x1_delta_lemma2; + INTRO_TAC ((*--*)Terminal.get_main_nonlinear "3078028960") yys; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[arith `&0 <= d ==> ~(d < &0)`;arith `d <= &20 ==> ~(d > &20)`]; + REWRITE_TAC[Sphere.y_of_x;arith `y1 pow 2 = y1 * y1`]; + DISCH_THEN (unlist REWRITE_TAC); + REWRITE_TAC[GSYM Sphere.delta_y]; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let delta_diff = prove_by_refinement( + `!x1 z1 x2 x3 x4 x5 x6. + delta_x x1 x2 x3 x4 x5 x6 = delta_x z1 x2 x3 x4 x5 x6 + + delta_x1 x1 x2 x3 x4 x5 x6 * (x1 - z1) + x4 * (x1 - z1) pow 2`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Sphere.delta_x;Nonlin_def.delta_x1] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let delta_2_nn = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!z1 y2 y3 y4. + &2 <= z1 /\ z1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + #3.01 <= y4 /\ y4 <= #3.915 /\ + delta_y z1 y2 y3 y4 (&2) (&2) = &0 ==> + &0 <= delta_y (&2) y2 y3 y4 (&2) (&2)) + `, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_y]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (UNDISCH2 (Terminal.get_main_nonlinear "3078028960")) [`&2`;`y2`;`y3`;`y4`;`&2`;`&2`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`;LET_DEF;LET_END_DEF]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + REWRITE_TAC[Sphere.y_of_x;Sphere.delta_y]; + ASM_REWRITE_TAC[arith `~(&0 > &20)`]; + DISCH_TAC; + FIRST_X_ASSUM DISJ_CASES_TAC; + INTRO_TAC delta_diff [`&2* &2`;`z1 * z1`;`y2*y2`;`y3*y3`;`y4*y4`;`&2* &2`;`&2 * &2`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + MATCH_MP_TAC (arith `&0 <= x /\ &0 <= y ==> &0 <= &0 + x + y`); + CONJ_TAC; + ONCE_REWRITE_TAC[arith `&0 <= a * b <=> &0 <= (--a) *(--b)`]; + GMATCH_SIMP_TAC REAL_LE_MUL; + CONJ_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + TYPIFY `&2 * &2 <= z1 * z1` ENOUGH_TO_SHOW_TAC; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + BY(ASM_TAC THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LE_MUL; + REWRITE_TAC[ REAL_LE_POW_2]; + BY(REWRITE_TAC[ REAL_LE_SQUARE]); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let delta_mono = prove_by_refinement( + ` main_nonlinear_terminal_v11 ==> (!z1 y1 y2 y3 y4 y5 y6. + &2 <= y1 /\ y1 <= z1 /\ z1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + #3.01 <= y4 /\ y4 <= #3.915 /\ + &2 <= y5 /\ y5 <= &2 /\ + &2 <= y6 /\ y6 <= &2 /\ + &0 <= delta_y y1 y2 y3 y4 y5 y6 /\ + delta_y y1 y2 y3 y4 y5 y6 <= &20 ==> + delta_y z1 y2 y3 y4 y5 y6 <= delta_y y1 y2 y3 y4 y5 y6) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Sphere.delta_y]; + INTRO_TAC delta_diff [`y1*y1`;`z1*z1`;`y2*y2`;`y3*y3`;`y4*y4`;`y5*y5`;`y6*y6`]; + DISCH_THEN SUBST1_TAC; + MATCH_MP_TAC (arith `&0 <= b /\ &0 <= c ==> a <= a + b + c`); + CONJ2_TAC; + GMATCH_SIMP_TAC REAL_LE_MUL; + REWRITE_TAC[ REAL_LE_POW_2]; + BY(REWRITE_TAC[ REAL_LE_SQUARE]); + INTRO_TAC ((*--*)Terminal.get_main_nonlinear "3078028960") yys; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`;LET_DEF;LET_END_DEF]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + ASM_SIMP_TAC[arith `&0 <= d ==> ~(d < &0)`;arith `d <= d1 ==> ~(d > d1)`]; + REWRITE_TAC[Sphere.y_of_x]; + ONCE_REWRITE_TAC[arith `&0 <= x * y <=> &0 <= (-- x) * (-- y)`]; + DISCH_TAC; + GMATCH_SIMP_TAC REAL_LE_MUL; + CONJ_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + MATCH_MP_TAC (arith `y1 * y1 <= z1 * z1 ==> &0 <= -- (y1 * y1 - z1 * z1)`); + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let flat_term2_126_x_eval = prove_by_refinement( + ` main_nonlinear_terminal_v11 ==> (!d z y1 y2 y3 y4 y5 y6. + delta_y z y1 y2 y6 (&2) (&2) = d /\ &0 <= d /\ d <= &20 /\ + &2 <= z /\ z <= &2 * h0 /\ &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + #3.01 <= y6 /\ y6 <= #3.915 ==> + y_of_x (flat_term2_126_x d (&4) (&4)) y1 y2 y3 y4 y5 y6 = flat_term z)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.y_of_x;Sphere.delta_126_x;Nonlin_def.flat_term2_126_x;Nonlin_def.edge2_126_x]; + REWRITE_TAC[Functional_equation.uni;Functional_equation.compose6;Functional_equation.constant6;Functional_equation.proj_x1;Functional_equation.proj_x2;Functional_equation.proj_x6]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (UNDISCH2 edge2_flatD_x1_delta_lemma3) [`d`;`z`;`y1`;`y2`;`y6`;`&2`;`&2`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`;LET_DEF;LET_END_DEF]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `&2 * &2 = &4`]; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[Sphere.flat_term_x]; + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let flat_term2_135_x_eval = prove_by_refinement( + ` main_nonlinear_terminal_v11 ==> (!d z y1 y2 y3 y4 y5 y6. + delta_y z y1 y3 y5 (&2) (&2) = d /\ &0 <= d /\ d <= &20 /\ + &2 <= z /\ z <= &2 * h0 /\ &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + #3.01 <= y5 /\ y5 <= #3.915 ==> + y_of_x (flat_term2_135_x d (&4) (&4)) y1 y2 y3 y4 y5 y6 = flat_term z)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.y_of_x;Sphere.delta_126_x;Nonlin_def.flat_term2_135_x;Nonlin_def.edge2_135_x]; + REWRITE_TAC[Functional_equation.uni;Functional_equation.compose6;Functional_equation.constant6;Functional_equation.proj_x1;Functional_equation.proj_x2;Functional_equation.proj_x6;Functional_equation.proj_x5;Functional_equation.proj_x3]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (UNDISCH2 edge2_flatD_x1_delta_lemma3) [`d`;`z`;`y1`;`y3`;`y5`;`&2`;`&2`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`;LET_DEF;LET_END_DEF]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `&2 * &2 = &4`]; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[Sphere.flat_term_x]; + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let delta_126_135 = prove_by_refinement( + `!a b c y1 y2 y3 y4 y5 y6. + delta_126_x a b c y1 y2 y3 y4 y5 y6 = delta_135_x a b c y1 y3 y2 y4 y6 y5`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_126_x;Sphere.delta_135_x]; + BY(MESON_TAC[Merge_ineq.delta_x_sym]) + ]);; + (* }}} *) + +let delta_126_x_2h0_le_d = prove_by_refinement( + ` main_nonlinear_terminal_v11 ==> (!d z1 y1 y2 y3 y4 y5 y6. + &2 <= z1 /\ + z1 <= &2 * h0 /\ + z1 <= &2 * h0 /\ + &2 <= y1 /\ + y1 <= &2 * h0 /\ + &2 <= y2 /\ + y2 <= &2 * h0 /\ + #3.01 <= y6 /\ + y6 <= #3.915 /\ + &0 <= d /\ d <= &20 /\ + delta_y z1 y1 y2 y6 (&2) (&2) = d ==> + y_of_x (delta_126_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 <= d)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Sphere.y_of_x;Sphere.delta_126_x]; + REWRITE_TAC[arith `&4 * h0 * h0 = (&2 * h0) * (&2 * h0)`]; + REWRITE_TAC[arith `&4 = &2 * &2`;GSYM Sphere.delta_y]; + TYPIFY `delta_y y1 y2 (&2 * h0) (&2) (&2) y6 = delta_y (&2 * h0) y1 y2 y6 (&2) (&2)` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + INTRO_TAC (UNDISCH delta_mono) [`&2 * h0`;`z1`;`y1`;`y2`;`y6`;`&2`;`&2`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let delta_135_x_2h0_le_d = prove_by_refinement( + ` main_nonlinear_terminal_v11 ==> (!d z1 y1 y2 y3 y4 y5 y6. + &2 <= z1 /\ + z1 <= &2 * h0 /\ + z1 <= &2 * h0 /\ + &2 <= y1 /\ + y1 <= &2 * h0 /\ + &2 <= y3 /\ + y3 <= &2 * h0 /\ + #3.01 <= y5 /\ + y5 <= #3.915 /\ + &0 <= d /\ d <= &20 /\ + delta_y z1 y1 y3 y5 (&2) (&2) = d ==> + y_of_x (delta_135_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 <= d)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Sphere.y_of_x;Sphere.delta_135_x]; + REWRITE_TAC[arith `&4 * h0 * h0 = (&2 * h0) * (&2 * h0)`]; + REWRITE_TAC[arith `&4 = &2 * &2`;GSYM Sphere.delta_y]; + TYPIFY `delta_y y1 (&2 * h0) y3 (&2) y5 (&2) = delta_y (&2 * h0) y1 y3 y5 (&2) (&2)` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + INTRO_TAC (UNDISCH delta_mono) [`&2 * h0`;`z1`;`y1`;`y3`;`y5`;`&2`;`&2`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let lemma_5546286427 = prove_by_refinement( + ` main_nonlinear_terminal_v11 ==> (!z1 y1 y2 y3 y4 y5 y6. ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237); + (&2,z1,#2.52) + ] +( + &0 = delta_y z1 y1 y2 y6 (&2) (&2) ==> + (taum y1 y2 y3 y4 y5 y6 + flat_term z1 + #0.12 > #0.616)))`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`;LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((*--*)Terminal.get_main_nonlinear "5546286427") yys; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`;LET_DEF;LET_END_DEF]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC flat_term2_126_x_eval; + TYPIFY `z1` EXISTS_TAC; + CONJ_TAC; + BY(ASM_REWRITE_TAC[] THEN ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + COMMENT "remove delta_126_x"; + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC (UNDISCH2 delta_126_x_2h0_le_d) [`&0`;`z1`;`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let taud_ge_flat_term = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. y1 <= &2 * h0 /\ y2 <= &2 * h0 /\ y3 <= &2 * h0 /\ + &0 <= delta_y y1 y2 y3 y4 y5 y6 ==> + flat_term y1 <= taud y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.taud;Sphere.flat_term]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `a <= a + b <=> &0 <= b`]; + GMATCH_SIMP_TAC REAL_LE_MUL; + GMATCH_SIMP_TAC SQRT_POS_LE; + ASM_REWRITE_TAC[]; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_pent_taum126_012 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6 y126 y135. + #0.12 <= taud y126 y1 y2 y6 (&2) (&2) /\ + &0 <= delta_y y135 y1 y3 y5 (&2) (&2) ==> + (ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237); + (&2,y126,&2 * h0); + (&2,y135,&2 * h0) + ] + (#0.616 < taud y126 y1 y2 y6 (&2) (&2) + taum y1 y2 y3 y4 y5 y6 + taud y135 y1 y3 y5 (&2) (&2)))) + `, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (UNDISCH taud_minimizer_terminal_pent_cases) [`&0`;`y135`;`y1`;`y3`;`y5`;`(&2)`;`&2`]; + REWRITE_TAC[LET_DEF;LET_END_DEF;IN_INTER;IN_REAL_INTERVAL;IN_ELIM_THM]; + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((*--*)Terminal.get_main_nonlinear "3665919985") yys; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `x > y <=> y < x`]; + DISCH_TAC; + INTRO_TAC (UNDISCH OWZLKVY4) [`y135`;`y1`;`y3`;`y5`;`&2`;`&2`]; + ANTS_TAC; + BY(REWRITE_TAC[Sphere.cstab] THEN ASM_TAC THEN REAL_ARITH_TAC); + DISCH_TAC; + INTRO_TAC ((*--*)Terminal.get_main_nonlinear "3665919985") yys; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + DISCH_TAC; + COMMENT "case y=2"; + FIRST_X_ASSUM (DISJ_CASES_TAC); + INTRO_TAC ((*--*)Terminal.get_main_nonlinear "7903347843") [`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + REWRITE_TAC[Sphere.y_of_x;mud_126_135]; + REWRITE_TAC[GSYM Sphere.y_of_x]; + TYPIFY `taum y1 y3 y2 y4 y6 y5 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[Terminal.taum_sym]); + GMATCH_SIMP_TAC taud_mud_135_x; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + MATCH_MP_TAC (arith `x <= a + b ==> t + x > #0.616 ==> #0.616 < a + t + b`); + MATCH_MP_TAC (arith `t2 <= t135 /\ -- s <= f /\ #0.12 <= t126 ==> t2 - f - s + #0.12 <= t126+t135`); + ASM_REWRITE_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM_ST `<=` MP_TAC THEN ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + MATCH_MP_TAC flat_term_sol0; + BY(REAL_ARITH_TAC); + COMMENT "case &0 <= tau"; + ASM_CASES_TAC `&0 <= taud y135 y1 y3 y5 (&2) (&2)`; + BY(ASM_TAC THEN REAL_ARITH_TAC); + COMMENT "case y=&2*h0"; + FIRST_X_ASSUM (DISJ_CASES_TAC); + INTRO_TAC taud_2h0 [`y1`;`y3`;`y5`;`&2`;`&2`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + BY(REPLICATE_TAC 6 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT "case delta=0"; + FIRST_X_ASSUM DISJ_CASES_TAC; + INTRO_TAC (UNDISCH lemma_5546286427) [`z1`;`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`;LET_DEF;LET_END_DEF]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + TYPIFY `taum y1 y3 y2 y4 y6 y5 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[Terminal.taum_sym]); + DISCH_TAC; + INTRO_TAC taud_ge_flat_term [`z1`;`y1`;`y3`;`y5`;`&2`;`&2`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + COMMENT "final case"; + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_pent_tau135_012 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6 y126 y135. + #0.12 <= taud y135 y1 y3 y5 (&2) (&2) /\ + &0 <= delta_y y126 y1 y2 y6 (&2) (&2) ==> + (ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237); + (&2,y126,&2 * h0); + (&2,y135,&2 * h0) + ] + (#0.616 < taud y126 y1 y2 y6 (&2) (&2) + taum y1 y2 y3 y4 y5 y6 + taud y135 y1 y3 y5 (&2) (&2)))) + `, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (UNDISCH2 terminal_pent_taum126_012) [`y1`;`y3`;`y2`;`y4`;`y6`;`y5`;`y135`;`y126`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + TYPIFY `taum y1 y3 y2 y4 y6 y5 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[Terminal.taum_sym]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let sqrt20 = prove_by_refinement( + `#4.47 <= sqrt(&20)`, + (* {{{ proof *) + [ + MATCH_MP_TAC REAL_LE_RSQRT; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let taud_053 = prove_by_refinement( + `! y2 y3 y4 y5 y6. + y2 <= &2 * h0 /\ + y3 <= &2 * h0 /\ + &20 <= delta_y (&2 * h0) y2 y3 y4 y5 y6 ==> + #0.053 <= taud (&2 * h0) y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.taud]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `sol0 * (&2 * h0 - &2 * h0) / (&2 * h0 - &2) = &0` (C SUBGOAL_THEN SUBST1_TAC); + BY(REAL_ARITH_TAC); + TYPIFY `#0.053 = #4.47 * (#0.053 / #4.47)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REAL_ARITH_TAC); + REWRITE_TAC[arith `&0 + x= x`]; + MATCH_MP_TAC REAL_LE_MUL2; + CONJ_TAC; + BY(REAL_ARITH_TAC); + CONJ_TAC; + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `sqrt(&20)` EXISTS_TAC; + REWRITE_TAC[sqrt20]; + GMATCH_SIMP_TAC SQRT_MONO_LE_EQ; + BY(ASM_TAC THEN REAL_ARITH_TAC); + CONJ_TAC; + BY(REAL_ARITH_TAC); + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_pent_tau126_2 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6 y126 y135. + y126 = &2 /\ + &0 <= delta_y y126 y1 y2 y6 (&2) (&2) /\ + &0 <= delta_y y135 y1 y3 y5 (&2) (&2) ==> + (ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237); + (&2,y126,&2 * h0); + (&2,y135,&2 * h0) + ] + (#0.616 < taud y126 y1 y2 y6 (&2) (&2) + taum y1 y2 y3 y4 y5 y6 + taud y135 y1 y3 y5 (&2) (&2)))) + `, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (UNDISCH taud_minimizer_terminal_pent_cases) [`&0`;`y135`;`y1`;`y3`;`y5`;`(&2)`;`&2`]; + REWRITE_TAC[LET_DEF;LET_END_DEF;IN_INTER;IN_REAL_INTERVAL;IN_ELIM_THM]; + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `taum y1 y3 y2 y4 y6 y5 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[Terminal.taum_sym]); + COMMENT "case tau >= 0.12"; + ASM_CASES_TAC `#0.12 <= taud z1 y1 y3 y5 (&2) (&2)`; + INTRO_TAC (UNDISCH2 terminal_pent_tau135_012) [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`;`y126`;`y135`]; + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[]); + COMMENT "case z1= &2"; + ASM_CASES_TAC `z1 = &2`; + INTRO_TAC ((*--*)Terminal.get_main_nonlinear "7997589055") yys; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC taud_mud_126_x; + GMATCH_SIMP_TAC taud_mud_135_x; + REWRITE_TAC[flat_term_2]; + TYPIFY_GOAL_THEN ` &0 <= y1 /\ &0 <= y2 /\ &0 <= y3` (unlist REWRITE_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `x = &2` (RULE_ASSUM_TAC o (unlist REWRITE_RULE))); + BY(ASM_TAC THEN REAL_ARITH_TAC); + COMMENT "case delta=0"; + ASM_CASES_TAC `&0 = delta_y z1 y1 y3 y5 (&2) (&2)`; + INTRO_TAC ((*--*)Terminal.get_main_nonlinear "2565248885") [`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]; + REWRITE_TAC[Sphere.ineq;LET_DEF;LET_END_DEF;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `x > &0 <=> ~(x <= &0)`]; + GMATCH_SIMP_TAC (UNDISCH2 delta_126_x_2h0_le_d); + CONJ_TAC; + TYPIFY `z1` EXISTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC taud_mud_135_x; + REWRITE_TAC[flat_term_2]; + GMATCH_SIMP_TAC (UNDISCH2 flat_term2_126_x_eval); + TYPIFY `z1` EXISTS_TAC; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + INTRO_TAC taud_ge_flat_term [`z1`;`y1`;`y3`;`y5`;`&2`;`&2`]; + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + COMMENT "case delta>=20"; + TYPIFY `z1 = &2 * h0` (C SUBGOAL_THEN MP_TAC); + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + DISCH_TAC; + ASM_CASES_TAC `&20 <= delta_y z1 y1 y3 y5 (&2) (&2)`; + INTRO_TAC ((*--*)Terminal.get_main_nonlinear "2320951108") [`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]; + REWRITE_TAC[Sphere.ineq;LET_DEF;LET_END_DEF;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC taud_mud_135_x; + REWRITE_TAC[flat_term_2]; + INTRO_TAC taud_053 [`y1`;`y3`;`y5`;`&2`;`&2`]; + ANTS_TAC; + FIRST_X_ASSUM MP_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `z = c` (RULE_ASSUM_TAC o (unlist REWRITE_RULE))); + DISCH_TAC; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC); + BY(REAL_ARITH_TAC); + COMMENT "case delta <= 20"; + INTRO_TAC ((*--*)Terminal.get_main_nonlinear "5429238960") [`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]; + REWRITE_TAC[Sphere.ineq;LET_DEF;LET_END_DEF;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC taud_mud_135_x; + REWRITE_TAC[flat_term_2]; + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + INTRO_TAC (UNDISCH2 delta_126_x_2h0_le_d) [`delta_y z1 y1 y3 y5 (&2) (&2)`;`z1`;`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]; + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + INTRO_TAC taud_2h0 [`y1`;`y3`;`y5`;`&2`;`&2`]; + ANTS_TAC; + FIRST_X_ASSUM_ST `z = c` (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + BY(ASM_TAC THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `z = c` (RULE_ASSUM_TAC o (unlist REWRITE_RULE))); + BY(REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_pent_tau135_2 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6 y126 y135. + y135 = &2 /\ + &0 <= delta_y y126 y1 y2 y6 (&2) (&2) /\ + &0 <= delta_y y135 y1 y3 y5 (&2) (&2) ==> + (ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237); + (&2,y126,&2 * h0); + (&2,y135,&2 * h0) + ] + (#0.616 < taud y126 y1 y2 y6 (&2) (&2) + taum y1 y2 y3 y4 y5 y6 + taud y135 y1 y3 y5 (&2) (&2)))) + `, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (UNDISCH2 terminal_pent_tau126_2) [`y1`;`y3`;`y2`;`y4`;`y6`;`y5`;`y135`;`y126`]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + TYPIFY `taum y1 y3 y2 y4 y6 y5 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[Terminal.taum_sym]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_pent_tau126_2h0 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6 y126 y135. + y126 = &2 * h0 /\ + &20 <= delta_y y126 y1 y2 y6 (&2) (&2) /\ + &0 <= delta_y y135 y1 y3 y5 (&2) (&2) ==> + (ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237); + (&2,y126,&2 * h0); + (&2,y135,&2 * h0) + ] + (#0.616 < taud y126 y1 y2 y6 (&2) (&2) + taum y1 y2 y3 y4 y5 y6 + taud y135 y1 y3 y5 (&2) (&2)))) + `, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (UNDISCH taud_minimizer_terminal_pent_cases) [`&0`;`y135`;`y1`;`y3`;`y5`;`(&2)`;`&2`]; + REWRITE_TAC[LET_DEF;LET_END_DEF;IN_INTER;IN_REAL_INTERVAL;IN_ELIM_THM]; + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `taum y1 y3 y2 y4 y6 y5 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[Terminal.taum_sym]); + COMMENT "case tau >= 0.12"; + ASM_CASES_TAC `#0.12 <= taud z1 y1 y3 y5 (&2) (&2)`; + INTRO_TAC (UNDISCH2 terminal_pent_tau135_012) [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`;`y126`;`y135`]; + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[]); + COMMENT "case z1= &2"; + ASM_CASES_TAC `z1 = &2`; + INTRO_TAC (UNDISCH2 terminal_pent_tau135_2) [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`;`y126`;`z1`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + COMMENT "case delta = 0"; + ASM_CASES_TAC `&0 = delta_y z1 y1 y3 y5 (&2) (&2)`; + INTRO_TAC ((*--*)Terminal.get_main_nonlinear "1948775510") [`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC (taud_mud_135_x); + CONJ_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[flat_term_2h0]; + GMATCH_SIMP_TAC flat_term2_126_x_eval; + TYPIFY `z1` EXISTS_TAC; + CONJ_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + INTRO_TAC taud_ge_flat_term [`z1`;`y1`;`y3`;`y5`;`&2`;`&2`]; + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + INTRO_TAC (UNDISCH2 delta_126_x_2h0_le_d) [`&0`;`z1`;`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]; + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `x > &0 <=> ~(x <= &0)`] THEN DISCH_THEN (unlist REWRITE_TAC); + REWRITE_TAC[Sphere.delta_135_x;Sphere.y_of_x;arith `&4 * h0 * h0 = (&2 * h0) * (&2 * h0)`]; + REWRITE_TAC[arith `&4 = &2 * &2`;GSYM Sphere.delta_y]; + TYPIFY `delta_y y1 (&2 * h0) y2 (&2) y6 (&2) = delta_y y126 y1 y2 y6 (&2) (&2)` (C SUBGOAL_THEN SUBST1_TAC); + ASM_REWRITE_TAC[]; + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + FIRST_X_ASSUM kill; + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `z = c` (RULE_ASSUM_TAC o (unlist REWRITE_RULE))); + BY(ASM_TAC THEN REAL_ARITH_TAC); + COMMENT "case z1=2h0, delta>=20"; + TYPIFY `z1 = &2 * h0` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[]); + DISCH_TAC; + INTRO_TAC taud_053 [`y1`;`y2`;`y6`;`&2`;`&2`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM_ST `&20 <= d` MP_TAC THEN ASM_REWRITE_TAC[]); + DISCH_TAC; + ASM_CASES_TAC `&20 <= delta_y z1 y1 y3 y5 (&2) (&2)`; + INTRO_TAC taud_053 [`y1`;`y3`;`y5`;`&2`;`&2`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(REPEAT (FIRST_X_ASSUM_ST `&20 <= d` MP_TAC) THEN ASM_REWRITE_TAC[]); + DISCH_TAC; + INTRO_TAC ((*--*)Terminal.get_main_nonlinear "3665919985") yys; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `z = c` (RULE_ASSUM_TAC o (unlist REWRITE_RULE))); + REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + COMMENT "case z1=2h0, delta<=20"; + INTRO_TAC ((*--*)Terminal.get_main_nonlinear "5708641738") [`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`;LET_DEF;LET_END_DEF]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + INTRO_TAC (UNDISCH2 delta_126_x_2h0_le_d) [`delta_y z1 y1 y3 y5 (&2) (&2)`;`z1`;`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]; + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `z = c` (RULE_ASSUM_TAC o (unlist REWRITE_RULE))); + INTRO_TAC taud_2h0 [`y1`;`y3`;`y5`;`&2`;`&2`]; + ANTS_TAC; + BY(ASM_TAC THEN ASM_MESON_TAC[]); + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let taud_sqrt20 = prove_by_refinement( + ` main_nonlinear_terminal_v11 ==> (!z1 y1 y2 y3 y4 y5 y6. + &0 <= &20 /\ + &20 <= &20 /\ + &2 <= z1 /\ + z1 <= &2 * h0 /\ + &2 <= y1 /\ + y1 <= &2 * h0 /\ + &2 <= y3 /\ + y3 <= &2 * h0 /\ + #3.01 <= y5 /\ + y5 <= #3.915 /\ + delta_y z1 y1 y3 y5 (&2) (&2) = &20 ==> + y_of_x (flat_term2_135_x (&20) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + (#0.012 + #0.01 * (#2.52 * &2 - y1 - y3 )) * #4.47 <= taud z1 y1 y3 y5 (&2) (&2))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC flat_term2_135_x_eval; + TYPIFY `z1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[Nonlin_def.taud;Sphere.flat_term]; + REWRITE_TAC[ (arith `u + c * s <= u + s' * c' <=> c * s <= c' * s'`)]; + MATCH_MP_TAC REAL_LE_MUL2; + CONJ_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[sqrt20]; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_pent_tau126_delta20 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6 y126 y135. + delta_y y126 y1 y2 y6 (&2) (&2) = &20 /\ + &0 <= delta_y y135 y1 y3 y5 (&2) (&2) ==> + (ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237); + (&2,y126,&2 * h0); + (&2,y135,&2 * h0) + ] + (#0.616 < taud y126 y1 y2 y6 (&2) (&2) + taum y1 y2 y3 y4 y5 y6 + taud y135 y1 y3 y5 (&2) (&2)))) + `, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (UNDISCH taud_minimizer_terminal_pent_cases) [`&0`;`y135`;`y1`;`y3`;`y5`;`(&2)`;`&2`]; + REWRITE_TAC[LET_DEF;LET_END_DEF;IN_INTER;IN_REAL_INTERVAL;IN_ELIM_THM]; + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `taum y1 y3 y2 y4 y6 y5 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[Terminal.taum_sym]); + COMMENT "case tau >= 0.12"; + ASM_CASES_TAC `#0.12 <= taud z1 y1 y3 y5 (&2) (&2)`; + INTRO_TAC (UNDISCH2 terminal_pent_tau135_012) [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`;`y126`;`y135`]; + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[]); + COMMENT "case z1= &2"; + ASM_CASES_TAC `z1 = &2`; + INTRO_TAC (UNDISCH2 terminal_pent_tau135_2) [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`;`y126`;`z1`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + BY(ASM_TAC THEN REAL_ARITH_TAC); + COMMENT "delta issue"; + TYPIFY `~( y_of_x (delta_135_x (&4 * h0 * h0) (&4) (&4)) y1 y3 y2 y4 y6 y5 > &20 )` (C SUBGOAL_THEN MP_TAC); + REWRITE_TAC[arith `~(x > d) <=> (x<=d)`]; + GMATCH_SIMP_TAC delta_135_x_2h0_le_d; + TYPIFY `y126` EXISTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + DISCH_TAC; + COMMENT "case delta = 0"; + ASM_CASES_TAC `&0 = delta_y z1 y1 y3 y5 (&2) (&2)`; + INTRO_TAC ((*--*)Terminal.get_main_nonlinear "1008824382") [`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC flat_term2_126_x_eval; + TYPIFY `z1` EXISTS_TAC; + CONJ_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC flat_term2_135_x_eval; + TYPIFY `y126` EXISTS_TAC; + CONJ_TAC; + FIRST_X_ASSUM_ST `d = &20` SUBST1_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + INTRO_TAC mu_y_ft_combine2 [`y126`;`y1`;`y2`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `mu_y y126 y1 y2 * sqrt(&20) + flat_term y126 <= taud y126 y1 y2 y6 (&2) (&2)` (C SUBGOAL_THEN MP_TAC); + REWRITE_TAC[Nonlin_def.taud;Nonlin_def.mu_y;Sphere.flat_term]; + REWRITE_TAC[ (arith `c * s + u <= u + s' * c <=> c * s <= c * s'`)]; + GMATCH_SIMP_TAC Real_ext.REAL_LE_LMUL_IMP; + CONJ_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC SQRT_MONO_LE_EQ; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `(#0.012 + #0.01 * ( #2.52 * &2 - y1 - y2)) * #4.47 <= mu_y (&2 * h0) y1 y2 * sqrt(&20)` (C SUBGOAL_THEN MP_TAC); + REWRITE_TAC[Nonlin_def.mu_y]; + MATCH_MP_TAC REAL_LE_MUL2; + CONJ_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + REWRITE_TAC[sqrt20]; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + INTRO_TAC taud_ge_flat_term [`z1`;`y1`;`y3`;`y5`;`&2`;`&2`]; + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `~` (unlist REWRITE_TAC); + REWRITE_TAC[arith `x > &0 <=> ~(x <= &0)`]; + GMATCH_SIMP_TAC delta_126_x_2h0_le_d; + CONJ_TAC; + TYPIFY `z1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `z = c` (RULE_ASSUM_TAC o (unlist REWRITE_RULE))); + REWRITE_TAC[flat_term_2h0]; + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT "z1=2h0 and delta <=20"; + TYPIFY `z1 = &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + ASM_CASES_TAC `delta_y z1 y1 y3 y5 (&2) (&2) <= &20`; + INTRO_TAC ((*--*)Terminal.get_main_nonlinear "1586903463") [`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + INTRO_TAC taud_2h0 [`y1`;`y3`;`y5`;`&2`;`&2`]; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `<=` MP_TAC) THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + INTRO_TAC (UNDISCH2 taud_sqrt20) [`y126`;`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]; + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[Sphere.y_of_x;Sphere.delta_126_x;arith `&4 * h0 * h0 = (&2 * h0) * (&2 * h0)`]; + REWRITE_TAC[arith `&4 = &2 * &2`;GSYM Sphere.delta_y]; + TYPIFY `delta_y y1 y3 (&2 * h0) (&2) (&2) y5 = delta_y z1 y1 y3 y5 (&2) (&2)` (C SUBGOAL_THEN SUBST1_TAC); + ASM_REWRITE_TAC[]; + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `z = c` (RULE_ASSUM_TAC o (unlist REWRITE_RULE))); + BY(ASM_TAC THEN REAL_ARITH_TAC); + COMMENT "z1=2h0 and delta> 20"; + INTRO_TAC ((*--*)Terminal.get_main_nonlinear "8875146520") [`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC taud_mud_126_x; + REWRITE_TAC[flat_term_2h0]; + INTRO_TAC (UNDISCH2 taud_sqrt20) [`y126`;`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]; + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `y_of_x` (unlist REWRITE_TAC); + REWRITE_TAC[Sphere.y_of_x;Sphere.delta_126_x;arith `&4 * h0 * h0 = (&2 * h0) * (&2 * h0)`]; + REWRITE_TAC[arith `&4 = &2 * &2`;GSYM Sphere.delta_y]; + TYPIFY `delta_y y1 y3 (&2 * h0) (&2) (&2) y5 = delta_y z1 y1 y3 y5 (&2) (&2)` (C SUBGOAL_THEN SUBST1_TAC); + ASM_REWRITE_TAC[]; + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `z = c` (RULE_ASSUM_TAC o (unlist REWRITE_RULE))); + BY(ASM_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_pent_taum = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6 y126 y135. + &20 <= delta_y y126 y1 y2 y6 (&2) (&2) /\ + &0 <= delta_y y135 y1 y3 y5 (&2) (&2) ==> + (ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237); + (&2,y126,&2 * h0); + (&2,y135,&2 * h0) + ] + (#0.616 < taum y126 y1 y2 y6 (&2) (&2) + taum y1 y2 y3 y4 y5 y6 + taum y135 y1 y3 y5 (&2) (&2)))) + `, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (UNDISCH taud_minimizer_terminal_pent_cases) [`&20`;`y126`;`y1`;`y2`;`y6`;`(&2)`;`&2`]; + REWRITE_TAC[LET_DEF;LET_END_DEF;IN_INTER;IN_REAL_INTERVAL;IN_ELIM_THM]; + ANTS_TAC; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (UNDISCH2 OWZLKVY4) [`y126`;`y1`;`y2`;`y6`;`&2`;`&2`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.cstab] THEN REAL_ARITH_TAC); + INTRO_TAC (UNDISCH2 OWZLKVY4) [`y135`;`y1`;`y3`;`y5`;`&2`;`&2`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.cstab] THEN REAL_ARITH_TAC); + TYPIFY `#0.616 < taud z1 y1 y2 y6 (&2) (&2) + taum y1 y2 y3 y4 y5 y6 + taud y135 y1 y3 y5 (&2) (&2)` ENOUGH_TO_SHOW_TAC; + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT "case z1=2"; + FIRST_X_ASSUM DISJ_CASES_TAC; + INTRO_TAC (UNDISCH2 terminal_pent_tau126_2) [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`;`z1`;`y135`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[]); + COMMENT "case z1=2h0"; + FIRST_X_ASSUM DISJ_CASES_TAC; + INTRO_TAC (UNDISCH2 terminal_pent_tau126_2h0) [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`;`z1`;`y135`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[]); + COMMENT "case delta=20"; + FIRST_X_ASSUM DISJ_CASES_TAC; + INTRO_TAC (UNDISCH2 terminal_pent_tau126_delta20) [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`;`z1`;`y135`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[]); + COMMENT "case tau012"; + INTRO_TAC (UNDISCH2 terminal_pent_taum126_012) [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`;`z1`;`y135`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +(* HEXAGON SECTION terminal_hex *) + +let taud_minimizer_terminal_hex_cases = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4. + (&0 <= delta_y y1 y2 y3 y4 (&2) (&2) /\ + &2 <= y1 /\ y1 <= &2 * h0 /\ &2 <= y2 /\ y2 <= &2 * h0 /\ &2 <= y3 /\ y3 <= &2 * h0 /\ + #3.01 <= y4 /\ y4 <= #3.915 /\ taum y1 y2 y3 y4 (&2) (&2) < &0 ==> + (?z1. &0 <= delta_y z1 y2 y3 y4 (&2) (&2) /\ + &2 <= z1 /\ z1 <= &2 * h0 /\ taud z1 y2 y3 y4 (&2) (&2) <= taud y1 y2 y3 y4 (&2) (&2) /\ + ( z1 = &2 \/ &0 = delta_y z1 y2 y3 y4 (&2) (&2) ))))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC taud_minimizer [`&2`;`&2 * h0`;`&0`;`y2`;`y3`;`y4`;`&2`;`&2`]; + REWRITE_TAC[LET_DEF;LET_END_DEF;IN_INTER;IN_REAL_INTERVAL;IN_ELIM_THM;EXTENSION;IN_INTER;NOT_IN_EMPTY;IN_REAL_INTERVAL;IN_ELIM_THM]; + ANTS_TAC; + REWRITE_TAC[arith `&0 <= &0`;NOT_FORALL_THM]; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `z1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + REPEAT (FIRST_X_ASSUM_ST `z = c` (RULE_ASSUM_TAC o (unlist REWRITE_RULE))); + BY(ASM_MESON_TAC[]); + INTRO_TAC taud_minimizer_cases [`&2`;`&2 * h0`;`&0`;`z1`;`y2`;`y3`;`y4`;`&2`;`&2`]; + REWRITE_TAC[LET_DEF;LET_END_DEF;IN_INTER;IN_REAL_INTERVAL;IN_ELIM_THM;EXTENSION;IN_INTER;NOT_IN_EMPTY;IN_REAL_INTERVAL;IN_ELIM_THM]; + ANTS_TAC; + BY(ASM_MESON_TAC[arith `&0 <= &2 /\ &0 <= &0`;arith `&2 <= y ==> &0 <= y`]); + ASM_CASES_TAC `z1 = &2` THEN FIRST_ASSUM (unlist REWRITE_TAC); + ASM_CASES_TAC `&0 = delta_y z1 y2 y3 y4 (&2) (&2)` THEN FIRST_ASSUM (unlist ASM_REWRITE_TAC); + ASM_CASES_TAC `z1 = &2 * h0` THEN ASM_REWRITE_TAC[]; + INTRO_TAC (UNDISCH OWZLKVY4 ) [`y1`;`y2`;`y3`;`y4`;`&2`;`&2`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.cstab] THEN REAL_ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`y1`]); + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `taum` MP_TAC; + INTRO_TAC taud_2h0 [`y2`;`y3`;`y4`;`&2`;`&2`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + BY(REAL_ARITH_TAC); + COMMENT "derviative cases"; + ASM_CASES_TAC `~(delta_y z1 y2 y3 y4 (&2) (&2) < &15)`; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (Terminal.get_main_nonlinear "6877738680") [`z1`;`y2`;`y3`;`y4`;`&2`;`&2`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Functional_equation.taud_x_taud; + INTRO_TAC (UNDISCH OWZLKVY4) [`y1`;`y2`;`y3`;`y4`;`&2`;`&2`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[Sphere.cstab]); + FIRST_X_ASSUM (C INTRO_TAC [`y1`]); + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + INTRO_TAC (Terminal.get_main_nonlinear "9692636487") [`z1`;`y2`;`y3`;`y4`;`&2`;`&2`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM_ST `delta_y` MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* next, de-symmetrize everything, + then combine delta ranges. *) + +let REAL_WLOG_S3_SIMPLEX = prove_by_refinement( + `!(P:A->A->A->real->real->real->bool). (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y3 y1 y2 y6 y4 y5 /\ + P y1 y2 y3 y4 y5 y6 = P y2 y1 y3 y5 y4 y6) /\ + (!y1 y2 y3 y4 y5 y6. y4 <= y6 /\ y6 <= y5 ==> P y1 y2 y3 y4 y5 y6) ==> + (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `(y4 <= y5 /\ y5 <= y6) \/ (y4 <= y6 /\ y6 <= y5) \/ (y5 <= y4 /\ y4 <= y6) \/ (y5 <= y6 /\ y6 <= y4) \/ (y6 <= y5 /\ y5 <= y4) \/ (y6 <= y4 /\ y4 <= y5)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REAL_ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let REAL_WLOG_AAB_SIMPLEX = prove_by_refinement( + `!(P:A->A->A->real->real->real->bool). (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y3 y2 y1 y6 y5 y4) /\ + (!y1 y2 y3 y4 y5 y6. y4 <= y6 ==> P y1 y2 y3 y4 y5 y6) ==> + (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `(y4 <= y6 \/ y6 <= y4)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REAL_ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let REAL_WLOG_ABB_SIMPLEX = prove_by_refinement( + `!(P:A->A->A->real->real->real->bool). (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y1 y3 y2 y4 y6 y5) /\ + (!y1 y2 y3 y4 y5 y6. y6 <= y5 ==> P y1 y2 y3 y4 y5 y6) ==> + (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `(y5 <= y6 \/ y6 <= y5)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REAL_ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_MESON_TAC[]) + ]);; + (* }}} *) + + let delta_y_hex_cases = prove_by_refinement( + `!y1 y2 y3 y5 y6 a b. (delta_y y1 y2 a (&2) (&2) y6 = delta_y a y1 y2 y6 (&2) (&2) /\ + (delta_y y1 b y3 (&2) y5 (&2) = delta_y b y1 y3 y5 (&2) (&2)))`, + (* {{{ proof *) + [ + BY(MESON_TAC[Merge_ineq.delta_y_sym]) + ]);; + (* }}} *) + +let delta_y_sym_cases2 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6 a. delta_y a y3 y1 y5 (&2) (&2) = delta_y a y1 y3 y5 (&2) (&2) /\ + delta_y a y3 y2 y4 (&2) (&2) = delta_y a y2 y3 y4 (&2) (&2) /\ + delta_y a y2 y1 y6 (&2) (&2) = delta_y a y1 y2 y6 (&2) (&2)`, + (* {{{ proof *) + [ + BY(MESON_TAC[Merge_ineq.delta_y_sym]) + ]);; + (* }}} *) + +let taum_sym_cases2 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. taum y2 y1 y3 y5 y4 y6 = taum y1 y2 y3 y4 y5 y6 /\ + taum y1 y3 y2 y4 y6 y5 = taum y1 y2 y3 y4 y5 y6 /\ + taum y3 y1 y2 y6 y4 y5 = taum y1 y2 y3 y4 y5 y6 /\ + taum y3 y2 y1 y6 y5 y4 = taum y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + BY(MESON_TAC[Terminal.taum_sym]) + ]);; + (* }}} *) + +let edge2_flatD_sym = prove_by_refinement( + `!d y1 y2 y3 a. edge2_flatD_x1 d y1 y2 y3 a a = edge2_flatD_x1 d y2 y1 y3 a a`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Nonlin_def.edge2_flatD_x1;Merge_ineq.delta_x_sym]) + ]);; + (* }}} *) + +let edge2_flatD_x1_sym_cases = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + edge2_flatD_x1 (&0) (y3 * y3) (y2 * y2) (y4*y4) (&2 * &2) (&2* &2) = + edge2_flatD_x1 (&0) (y2 * y2) (y3 * y3) (y4*y4) (&2 * &2) (&2* &2) /\ + edge2_flatD_x1 (&0) (y3 * y3) (y1 * y1) (y5*y5) (&2 * &2) (&2* &2) = + edge2_flatD_x1 (&0) (y1 * y1) (y3 * y3) (y5*y5) (&2 * &2) (&2* &2) /\ + edge2_flatD_x1 (&0) (y2 * y2) (y1 * y1) (y6*y6) (&2 * &2) (&2* &2) = + edge2_flatD_x1 (&0) (y1 * y1) (y2 * y2) (y6*y6) (&2 * &2) (&2* &2) +`, + (* {{{ proof *) + [ +BY(REWRITE_TAC[edge2_flatD_sym]) + ]);; + (* }}} *) + +let eulerA_x_sym_cases = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + eulerA_x (y2 * y2) (y1 * y1) (y3 * y3) (y5 * y5) (y4 * y4) (y6 * y6) = + eulerA_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6) /\ + eulerA_x (y3 * y3) (y1 * y1) (y2 * y2) (y6 * y6) (y4 * y4) (y5 * y5) = + eulerA_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6) /\ + eulerA_x (y3 * y3) (y2 * y2) (y1 * y1) (y6 * y6) (y5 * y5) (y4 * y4) = + eulerA_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6) /\ + eulerA_x (y1 * y1) (y3 * y3) (y2 * y2) (y4 * y4) (y6 * y6) (y5 * y5) = + eulerA_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6) `, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.eulerA_x]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let mu_y_sym = prove_by_refinement( + `!y1 y2 y3. mu_y y1 y2 y3 = mu_y y1 y3 y2`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.mu_y]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let mu_y_sym_cases = prove_by_refinement( + `!y1 y2 y3. mu_y (&2) (sqrt(y2 * y2)) (sqrt(y1*y1)) = + mu_y (&2) (sqrt(y1 * y1)) (sqrt(y2*y2)) /\ + mu_y (&2) (sqrt(y3 * y3)) (sqrt(y2*y2)) = + mu_y (&2) (sqrt(y2 * y2)) (sqrt(y3*y3)) /\ + mu_y (&2) (sqrt(y3 * y3)) (sqrt(y1*y1)) = + mu_y (&2) (sqrt(y1 * y1)) (sqrt(y3*y3)) +`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[mu_y_sym]) + ]);; + (* }}} *) + +let nonfunctional_mud_126 = prove_by_refinement( + `! a b c y1 y2 y3 y4 y5 y6. y_of_x (mud_126_x_v1 a b c) y1 y2 y3 y4 y5 y6 = + mu_y a (sqrt(y1 * y1)) (sqrt(y2 * y2)) * sqrt(delta_y a y1 y2 y6 b c)`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.mud_126_x;]; + Functional_equation.F_REWRITE_TAC; + REWRITE_TAC[GSYM Nonlin_def.mu_y;Sphere.delta_126_x;GSYM Sphere.delta_y]; + BY(MESON_TAC[Merge_ineq.delta_y_sym]) + ]);; + (* }}} *) + +let nonfunctional_mud_234 = prove_by_refinement( + `! a b c y1 y2 y3 y4 y5 y6. y_of_x (mud_234_x_v1 a b c) y1 y2 y3 y4 y5 y6 = + mu_y a (sqrt(y2 * y2)) (sqrt(y3 * y3)) * sqrt(delta_y a y2 y3 y4 b c)`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.mud_234_x;]; + Functional_equation.F_REWRITE_TAC; + REWRITE_TAC[GSYM Nonlin_def.mu_y;Sphere.delta_234_x;GSYM Sphere.delta_y]; + ]);; + (* }}} *) + +let nonfunctional_mud_135 = prove_by_refinement( + `! a b c y1 y2 y3 y4 y5 y6. y_of_x (mud_135_x_v1 a b c) y1 y2 y3 y4 y5 y6 = + mu_y a (sqrt(y1 * y1)) (sqrt(y3 * y3)) * sqrt(delta_y a y1 y3 y5 b c)`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.mud_135_x;]; + Functional_equation.F_REWRITE_TAC; + REWRITE_TAC[GSYM Nonlin_def.mu_y;Sphere.delta_135_x;GSYM Sphere.delta_y]; + REWRITE_TAC[mu_y_sym]; + BY(MESON_TAC[Merge_ineq.delta_y_sym]) + ]);; + (* }}} *) + +let nonfunctional_flat_term2_126 = prove_by_refinement( + `! d a b x1 x2 x3 x4 x5 x6. (flat_term2_126_x d a b) x1 x2 x3 x4 x5 x6 = + flat_term (sqrt (edge2_flatD_x1 d x1 x2 x6 a b))`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.flat_term2_126_x]; + BY(REWRITE_TAC[Functional_equation.uni;Sphere.flat_term_x;Nonlin_def.edge2_126_x;Functional_equation.constant6;Functional_equation.proj_x1;Functional_equation.proj_x2;Functional_equation.proj_x6;Functional_equation.compose6]) + ]);; + (* }}} *) + +let nonfunctional_flat_term2_234 = prove_by_refinement( + `! d a b x1 x2 x3 x4 x5 x6. (flat_term2_234_x d a b) x1 x2 x3 x4 x5 x6 = + flat_term (sqrt (edge2_flatD_x1 d x2 x3 x4 a b))`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.flat_term2_234_x]; + BY(REWRITE_TAC[Functional_equation.uni;Sphere.flat_term_x;Nonlin_def.edge2_234_x;Functional_equation.constant6;Functional_equation.proj_x2;Functional_equation.proj_x3;Functional_equation.proj_x4;Functional_equation.compose6]) + ]);; + (* }}} *) + +let nonfunctional_flat_term2_135 = prove_by_refinement( + `! d a b x1 x2 x3 x4 x5 x6. (flat_term2_135_x d a b) x1 x2 x3 x4 x5 x6 = + flat_term (sqrt (edge2_flatD_x1 d x1 x3 x5 a b))`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.flat_term2_135_x]; + BY(REWRITE_TAC[Functional_equation.uni;Sphere.flat_term_x;Nonlin_def.edge2_135_x;Functional_equation.constant6;Functional_equation.proj_x1;Functional_equation.proj_x3;Functional_equation.proj_x5;Functional_equation.compose6]) + ]);; + (* }}} *) + +let nonfunctional_mudLs_126 = prove_by_refinement( + `! y1 y2 x3 x4 x5 y6. mudLs_126_x (&4) (&10) (&2) (&2) (&2) (y1*y1) (y2*y2) x3 x4 x5 (y6*y6) = + mu_y (&2) (sqrt (y1 * y1)) (sqrt (y2 * y2)) * + (&1 / &14 * (delta_y (&2) y1 y2 y6 (&2) (&2) - &16) + &4)`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.mudLs_126_x]; + Functional_equation.F_REWRITE_TAC; + REWRITE_TAC[GSYM Nonlin_def.mu_y;Sphere.delta_126_x;GSYM Sphere.delta_y;delta_y_hex_cases]; + REWRITE_TAC[arith `&4 * &4 = &16`;arith `&4 + &10 = &14`]; + TYPIFY `sqrt(&2 * &2) = &2` (C SUBGOAL_THEN SUBST1_TAC); + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + BY(REAL_ARITH_TAC); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let nonfunctional_mudLs_234 = prove_by_refinement( + `! x1 y2 y3 y4 x5 x6. mudLs_234_x (&4) (&10) (&2) (&2) (&2) x1 (y2*y2) (y3*y3) (y4*y4) x5 x6 = + mu_y (&2) (sqrt (y2 * y2)) (sqrt (y3 * y3)) * + (&1 / &14 * (delta_y (&2) y2 y3 y4 (&2) (&2) - &16) + &4)`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.mudLs_234_x]; + Functional_equation.F_REWRITE_TAC; + REWRITE_TAC[GSYM Nonlin_def.mu_y;Sphere.delta_234_x;GSYM Sphere.delta_y;delta_y_hex_cases]; + REWRITE_TAC[arith `&4 * &4 = &16`;arith `&4 + &10 = &14`]; + TYPIFY `sqrt(&2 * &2) = &2` (C SUBGOAL_THEN SUBST1_TAC); + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + BY(REAL_ARITH_TAC); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let nonfunctional_mudLs_135 = prove_by_refinement( + `! y1 x2 y3 x4 y5 x6. mudLs_135_x (&4) (&10) (&2) (&2) (&2) (y1*y1) x2 (y3*y3) x4 (y5*y5) x6 = + mu_y (&2) (sqrt (y1 * y1)) (sqrt (y3 * y3)) * + (&1 / &14 * (delta_y (&2) y1 y3 y5 (&2) (&2) - &16) + &4)`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.mudLs_135_x]; + Functional_equation.F_REWRITE_TAC; + REWRITE_TAC[GSYM Nonlin_def.mu_y;Sphere.delta_135_x;GSYM Sphere.delta_y;delta_y_hex_cases]; + REWRITE_TAC[arith `&4 * &4 = &16`;arith `&4 + &10 = &14`]; + TYPIFY `sqrt(&2 * &2) = &2` (C SUBGOAL_THEN SUBST1_TAC); + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + BY(REAL_ARITH_TAC); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let ineq_sym_s3 = prove_by_refinement( + `!y4 y5 y6 p r . + ineq p (r \/ y6 < y4 \/ y5 < y6) ==> + ((y4 <= y6 /\ y6 <= y5) ==> ineq p r)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `ineq` MP_TAC; + BY(ASM_SIMP_TAC [arith `x <= y ==> ~(y < x)`]) + ]);; + (* }}} *) + +let ineq_sym_s2_aab = prove_by_refinement( + `!y4 y6 p r. ineq p (r \/ y6 < y4) ==> + ((y4 <= y6) ==> ineq p r)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `ineq` MP_TAC; + BY(ASM_SIMP_TAC [arith `x <= y ==> ~(y < x)`]) + ]);; + (* }}} *) + +let ineq_sym_s2_abb = prove_by_refinement( + `!y5 y6 p r. ineq p (r \/ y5 < y6) ==> + ((y6 <= y5) ==> ineq p r)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `ineq` MP_TAC; + BY(ASM_SIMP_TAC [arith `x <= y ==> ~(y < x)`]) + ]);; + (* }}} *) + +let clean_ineq = PURE_REWRITE_RULE[Sphere.y_of_x;Sphere.delta_234_x;Sphere.delta_126_x;Sphere.delta_135_x; + arith `#2.52 pow 2 = #2.52 * #2.52 /\ &4 = &2 * &2`;GSYM Sphere.delta_y;delta_y_hex_cases; + nonfunctional_mud_126;nonfunctional_mud_234;nonfunctional_mud_135; + nonfunctional_flat_term2_126; nonfunctional_flat_term2_234; nonfunctional_flat_term2_135; + nonfunctional_mudLs_135 ;nonfunctional_mudLs_126 ;nonfunctional_mudLs_234];; + +let mk_ineq_hex conv i234 i126 i135 = + let nth = List.nth in + let d234 = nth [` y_of_x (flat_term2_234_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 `; + `&0`; + `y_of_x (mud_234_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0`; + `y_of_x (mudLs_234_x (&4) (&10) (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0`; + `&0 - sol0`] i234 in + let d126 = nth [` y_of_x (flat_term2_126_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 `; + `&0`; + `y_of_x (mud_126_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0`; + `y_of_x (mudLs_126_x (&4) (&10) (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0`; + `&0 - sol0`] i126 in + let d135 = nth [` y_of_x (flat_term2_135_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 `; + `&0`; + `y_of_x (mud_135_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0`; + `y_of_x (mudLs_135_x (&4) (&10) (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0`; + `&0 - sol0`] i135 in + let c234 = nth [`y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0`; + `F`; + `y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &100`; + `y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &16 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &100`; + `y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &16`;] i234 in + let c126 = nth [`y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0`; + `F`; + `y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &100`; + `y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &16 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &100`; + `y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &16`;] i126 in + let c135 = nth [`y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0`; + `F`; + `y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &100`; + `y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &16 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &100`; + `y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &16`;] i135 in + let s45 = if (i234= i126) then `y6 < y4` else `F` in + let s56 = if (i126= i135) then `y5 < y6` else `F` in + rhs(concl(conv (Ineq.mk_tplate Main_estimate_ineq.template_hex [d234;d126;d135;c234;c126;c135;s45;s56])));; + +(* +let tmgg a b c = + let g = mk_ineq_hex (PURE_REWRITE_CONV[]) a b c in + let g' = (mk_imp (`main_nonlinear_terminal_v11`,concl (clean_ineq (ASSUME g)))) in + g';; +*) + +let get_ineq (a,b,c) = + clean_ineq (Terminal.get_main_nonlinear (Printf.sprintf "7550003505 %d %d %d" a b c));; + +let get_ineq_term(a,b,c) = + let g = mk_ineq_hex (PURE_REWRITE_CONV[]) a b c in + concl (clean_ineq (ASSUME g));; + +let get_ineq'(a,b,c) = + let g' = mk_imp(`main_nonlinear_terminal_v11`,get_ineq_term(a,b,c)) in + repeat UNDISCH (prove_by_refinement(g',[ + DISCH_TAC; + BY(REWRITE_TAC[get_ineq(a,b,c)])]));; + +let r755_0 i = + let (yys,tm) = (strip_forall (concl(get_ineq' (i,i,i)))) in + let tm0 = rhs(concl(PURE_REWRITE_CONV [ASSUME (`y6 < y4 <=> F`);ASSUME (`y5 < y6 <=> F`)] tm)) in + let tm1 = list_mk_forall (yys, tm0) in + let tm2 = mk_imp (`main_nonlinear_terminal_v11`,tm1) in +prove_by_refinement(tm2, + (* {{{ proof *) + [ + DISCH_TAC; + MATCH_MP_TAC REAL_WLOG_S3_SIMPLEX; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC delta_y_sym_cases2 yys; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC taum_sym_cases2 yys; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC edge2_flatD_x1_sym_cases yys; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC eulerA_x_sym_cases yys; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC mu_y_sym_cases [`y1`;`y2`;`y3`]; + DISCH_THEN (unlist REWRITE_TAC); + TYPIFY_GOAL_THEN `!f. f y1 y2 y6 + f y1 y3 y5 + f y2 y3 y4 = f y2 y3 y4 + f y1 y2 y6 + f y1 y3 y5 /\ f y1 y3 y5 + f y1 y2 y6 + f y2 y3 y4 = f y2 y3 y4 + f y1 y2 y6 + f y1 y3 y5` (unlist ONCE_REWRITE_TAC); + BY(REAL_ARITH_TAC); + BY(REWRITE_TAC[Sphere.ineq] THEN MESON_TAC[]); + REPEAT GEN_TAC; + MATCH_MP_TAC ineq_sym_s3; + INTRO_TAC (get_ineq(i,i,i)) yys; + BY(REWRITE_TAC[TAUT `(a \/ b) \/ c <=> a \/ b \/ c`]) + ]);; + (* }}} *) + +let r755_diag = map (fun i -> (i, r755_0 i)) [0;1;2;3;4];; + + +let r755_aab i j= + let (yys,tm) = (strip_forall (concl(get_ineq' (i,i,j)))) in + let tm0 = rhs(concl(PURE_REWRITE_CONV [ASSUME (`(y6 < y4) <=> F`)] tm)) in + let tm1 = list_mk_forall (yys, tm0) in + let tm2 = mk_imp (`main_nonlinear_terminal_v11`,tm1) in +prove_by_refinement(tm2, + (* {{{ proof *) + [ + DISCH_TAC; + MATCH_MP_TAC REAL_WLOG_AAB_SIMPLEX; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC delta_y_sym_cases2 yys; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC taum_sym_cases2 yys; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC edge2_flatD_x1_sym_cases yys; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC eulerA_x_sym_cases yys; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC mu_y_sym_cases [`y1`;`y2`;`y3`]; + DISCH_THEN (unlist REWRITE_TAC); + TYPIFY_GOAL_THEN `!f b. f y1 y2 y6 + f y2 y3 y4 + b = f y2 y3 y4 + f y1 y2 y6 + b` (unlist ONCE_REWRITE_TAC); + BY(REAL_ARITH_TAC); + BY(REWRITE_TAC[Sphere.ineq] THEN MESON_TAC[]); + REPEAT GEN_TAC; + MATCH_MP_TAC ineq_sym_s2_aab; + INTRO_TAC (get_ineq(i,i,j)) yys; + BY(REWRITE_TAC[TAUT `(a \/ b) \/ c <=> a \/ b \/ c`]) + ]);; + (* }}} *) + +let r755_aab_list = map (fun (i,j) -> ((i,j),r755_aab i j)) [(0,1);(0,2);(0,3);(0,4);(1,2);(1,3);(1,4); + (2,3);(2,4);(3,4)];; + +let r755_abb i j= + let (yys,tm) = (strip_forall (concl(get_ineq' (i,j,j)))) in + let tm0 = rhs(concl(PURE_REWRITE_CONV [ASSUME (`(y5 < y6) <=> F`)] tm)) in + let tm1 = list_mk_forall (yys, tm0) in + let tm2 = mk_imp (`main_nonlinear_terminal_v11`,tm1) in +prove_by_refinement(tm2, + (* {{{ proof *) + [ + DISCH_TAC; + MATCH_MP_TAC REAL_WLOG_ABB_SIMPLEX; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC delta_y_sym_cases2 yys; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC taum_sym_cases2 yys; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC edge2_flatD_x1_sym_cases yys; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC eulerA_x_sym_cases yys; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC mu_y_sym_cases [`y1`;`y2`;`y3`]; + DISCH_THEN (unlist REWRITE_TAC); + TYPIFY_GOAL_THEN `!f. f y1 y2 y6 + f y1 y3 y5 = f y1 y3 y5 + f y1 y2 y6` (unlist ONCE_REWRITE_TAC); + BY(REAL_ARITH_TAC); + BY(REWRITE_TAC[Sphere.ineq] THEN MESON_TAC[]); + REPEAT GEN_TAC; + MATCH_MP_TAC ineq_sym_s2_abb; + INTRO_TAC (get_ineq(i,j,j)) yys; + BY(REWRITE_TAC[TAUT `(a \/ b) \/ c <=> a \/ b \/ c`]) + ]);; + (* }}} *) + +let r755_abb_list = map (fun (i,j) -> ((i,j),r755_abb i j)) [(0,1);(0,2);(0,3);(0,4);(1,2);(1,3);(1,4); + (2,3);(2,4);(3,4)];; + +let get_ineq2( i, j, k) = + let _ = (i <= j && j <= k) or failwith "get2 out of range" in + if (i = j && j = k) then UNDISCH (assoc i r755_diag) + else if (i = j) then UNDISCH (assoc (i,k) r755_aab_list) + else if (j = k) then UNDISCH (assoc (i,j) r755_abb_list) + else get_ineq'(i,j,k);; + +(* +let tmg i j = + let (yys,tm) = (strip_forall (concl(get_ineq (i,j,j)))) in + let tm0 = rhs(concl(REWRITE_CONV [ASSUME (`~(y5 < y6) /\ ~(y6 < y4)`)] tm)) in + let tm1 = list_mk_forall (yys, tm0) in + let tm2 = mk_imp (`main_nonlinear_terminal_v11`,tm1) in + tm2;; +*) + +let g755_ i j k = +(* let inq = (Main_estimate_ineq.make_hex_ear i j k).ineq in + let inq' = concl(clean_ineq (ASSUME inq)) in +*) + let inq' = get_ineq_term (i,j,k) in + let (yys,tm) = strip_forall inq' in + let tm0 = rhs(concl(PURE_REWRITE_CONV [ASSUME `(y5 < y6) <=> F`;ASSUME `(y6 < y4) <=> F`] tm)) in + let tm1 = list_mk_forall (yys, tm0) in + let tm2 = mk_imp (`main_nonlinear_terminal_v11`,tm1) in + tm2;; + +let r755_ikj getter i j k = prove_by_refinement( + (g755_ i j k), + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ( (getter (i, k, j))) [`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]; + INTRO_TAC delta_y_sym_cases2 yys; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC taum_sym_cases2 yys; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC edge2_flatD_x1_sym_cases yys; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC eulerA_x_sym_cases yys; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC mu_y_sym_cases [`y1`;`y2`;`y3`]; + DISCH_THEN (unlist REWRITE_TAC); + REWRITE_TAC[REAL_ADD_AC]; + BY(REWRITE_TAC[Sphere.ineq] THEN MESON_TAC[]) + ]);; + (* }}} *) + +let rec cross a = function + | [] -> [] + | b::bs -> (map (fun i -> (i,b)) a) @ cross a bs;; + +let triples = map (fun ((i,j),k)-> (i,j,k)) (cross (cross (0--4) (0--4)) (0--4));; + +let r755_ikj_list = + let ls = map (fun (i,j,k) -> ((i,j,k), + if (i > j or i > k) then TRUTH + else if (j<= k) then get_ineq2 (i,j,k) + else r755_ikj get_ineq2 i j k)) in + ls triples;; + +let get_ineq3( i, j, k) = + let _ = (i <= j && i <= k) or failwith (Printf.sprintf "get3 out of range %d %d %d" i j k) in + repeat UNDISCH (assoc (i,j,k) r755_ikj_list);; + +let r755_jik i j k = prove_by_refinement( + (g755_ i j k), + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ( (get_ineq3 (j, i, k))) [`y3`;`y2`;`y1`;`y6`;`y5`;`y4`]; + INTRO_TAC delta_y_sym_cases2 yys; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC taum_sym_cases2 yys; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC edge2_flatD_x1_sym_cases yys; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC eulerA_x_sym_cases yys; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC mu_y_sym_cases [`y1`;`y2`;`y3`]; + DISCH_THEN (unlist REWRITE_TAC); + REWRITE_TAC[REAL_ADD_AC]; + BY(REWRITE_TAC[Sphere.ineq] THEN MESON_TAC[]) + ]);; + (* }}} *) + +let r755_jik_list = + let ls = map (fun (i,j,k) -> ((i,j,k), + if (k < i && k < j) then TRUTH + else if (i<= j) then get_ineq3 (i,j,k) + else r755_jik i j k)) in + ls triples;; + +let get_ineq4( i, j, k) = + let thm = repeat UNDISCH (assoc (i,j,k) r755_jik_list) in + let _ = (not(thm = TRUTH)) or failwith (Printf.sprintf "get4 out of range %d %d %d" i j k) in + thm;; + + +let get_ineq5 = + let ls = map (fun (i,j,k) -> ((i,j,k), + if (k < i && k < j) then r755_ikj get_ineq4 i j k + else get_ineq4 (i,j,k))) in + let r755_ikj_list2 = ls triples in + fun ( i, j, k) -> + repeat UNDISCH (assoc (i,j,k) r755_ikj_list2);; + +(* +let _ = (125 = List.length (filter (fun t -> not (snd t = TRUTH)) r755_ikj_list2));; +*) + +let taud_mu_clauses = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y2 y3 y4. + (&2 <= y2 /\ y2 <= #2.52 /\ &2 <= y3 /\ y3 <= #2.52 /\ #3.01 <= y4 /\ y4 <= #3.915) ==> + (let d = delta_y (&2) y2 y3 y4 (&2) (&2) in + let t = taud (&2) y2 y3 y4 (&2) (&2) in + ((&0 <= d /\ d <= &16 ==> -- sol0 <= t) /\ + (&16 <= d /\ d <= &100 ==> mu_y (&2) (sqrt (y2 * y2)) (sqrt (y3 * y3)) * + (&1 / &14 * (delta_y (&2) y2 y3 y4 (&2) (&2) - &16) + &2 * &2) - + sol0 <= t) /\ + (&100 <= d ==> mu_y (&2) (sqrt (y2 * y2)) (sqrt (y3 * y3)) * + sqrt (delta_y (&2) y2 y3 y4 (&2) (&2)) - + sol0 <= t))))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + DISCH_TAC; + INTRO_TAC (taud_ge_flat_term) [`&2`;`y2`;`y3`;`y4`;`&2`;`&2`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.cstab;Sphere.h0] THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[flat_term_2]); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Nonlin_def.taud;GSYM Nonlin_def.mu_y;GSYM Sphere.flat_term;flat_term_2]; + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + ASM_SIMP_TAC[arith `&2 <= y ==> &0 <= y`]; + TYPED_ABBREV_TAC `d = delta_y (&2) y2 y3 y4 (&2) (&2)`; + MATCH_MP_TAC (arith `m* a <= m * a' ==> m * a - s <= --s + a' * m`); + GMATCH_SIMP_TAC Real_ext.REAL_LE_LMUL_IMP; + CONJ_TAC; + REWRITE_TAC[Nonlin_def.mu_y]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + TYPIFY `&2 * &2 = sqrt(&16)` (C SUBGOAL_THEN SUBST1_TAC); + MATCH_MP_TAC Upfzbzm_support_lemmas.SQRT_RULE_Euler_lemma; + BY(REAL_ARITH_TAC); + TYPIFY `&14 = sqrt(&16) + sqrt(&100)` (C SUBGOAL_THEN SUBST1_TAC); + TYPIFY `&4 = sqrt(&16) /\ &10 = sqrt(&100)` ENOUGH_TO_SHOW_TAC; + BY(REAL_ARITH_TAC); + CONJ_TAC; + MATCH_MP_TAC Upfzbzm_support_lemmas.SQRT_RULE_Euler_lemma; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC Upfzbzm_support_lemmas.SQRT_RULE_Euler_lemma; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC sqrt_secant_approx; + BY(ASM_TAC THEN REAL_ARITH_TAC); + COMMENT "final case"; + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + ASM_SIMP_TAC[arith `&2 <= y ==> &0 <= y`]; + DISCH_TAC; + REWRITE_TAC[Nonlin_def.taud;GSYM Nonlin_def.mu_y;GSYM Sphere.flat_term;flat_term_2]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_hex_234_reduction = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6 y234 f1 f2 b1 b2. + (let dom = [&2,y1, #2.52; &2,y2, #2.52; &2,y3, #2.52; #3.01,y4, #3.915; + #3.01, + y5, + #3.915; #3.01,y6, #3.915] in + (ineq dom (f1 + flat_term + (sqrt + (edge2_flatD_x1 (&0) (y2 * y2) (y3 * y3) (y4 * y4) (&2 * &2) + (&2 * &2))) + f2 > #0.712 \/ b1 \/ (delta_y (&2) y2 y3 y4 (&2) (&2) < &0 \/ + delta_y #2.52 y2 y3 y4 (&2) (&2) > &0) \/ b2)) /\ +(ineq dom (f1 + &0 + f2 > #0.712 \/ b1 \/ F \/ b2)) /\ +(ineq dom (f1 + ( + mu_y (&2) (sqrt (y2 * y2)) (sqrt (y3 * y3)) * + sqrt (delta_y (&2) y2 y3 y4 (&2) (&2)) - + sol0) + f2 > #0.712 \/ b1 \/ delta_y (&2) y2 y3 y4 (&2) (&2) < &100 \/ b2)) /\ +(ineq dom (f1 + ( mu_y (&2) (sqrt (y2 * y2)) (sqrt (y3 * y3)) * + (&1 / &14 * (delta_y (&2) y2 y3 y4 (&2) (&2) - &16) + &2 * &2) - + sol0) + f2 > #0.712 \/ + b1 \/ (delta_y (&2) y2 y3 y4 (&2) (&2) < &16 \/ + delta_y (&2) y2 y3 y4 (&2) (&2) > &100) \/ b2)) /\ +(ineq dom (f1 + ( &0 - sol0) + f2 > #0.712 \/ + b1 \/ (delta_y (&2) y2 y3 y4 (&2) (&2) < &0 \/ + delta_y (&2) y2 y3 y4 (&2) (&2) > &16) \/ b2))) ==> + (ineq [&2,y1, #2.52; &2,y2, #2.52; &2,y3, #2.52; #3.01,y4, #3.915; + #3.01, + y5, + #3.915; #3.01,y6, #3.915;&2,y234,#2.52] ((f1 + taum y234 y2 y3 y4 (&2) (&2)) + f2 > #0.712 \/ + (delta_y y234 y2 y3 y4 (&2) (&2) < &0 \/ b1) \/ b2)))`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.ineq;LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `\/` MP_TAC) THEN ASM_REWRITE_TAC[]; + ASM_CASES_TAC `b1:bool`; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + ASM_CASES_TAC `b2:bool`; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `f1 + t + f2 > #0.712 <=> t > #0.712 - f1 - f2`;arith `(f1 + t) + f2 > #0.712 <=> t > #0.712 - f1 - f2`]; + TYPED_ABBREV_TAC `c = #0.712 - f1 - f2`; + REPEAT WEAKER_STRIP_TAC; + ASM_CASES_TAC `&0 <= taum y234 y2 y3 y4 (&2) (&2)`; + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + ASM_CASES_TAC `delta_y y234 y2 y3 y4 (&2) (&2) < &0`; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + INTRO_TAC (UNDISCH taud_minimizer_terminal_hex_cases) [`y234`;`y2`;`y3`;`y4`]; + ASM_SIMP_TAC[arith `~(d < &0) ==> &0 <= d`;arith `~(&0 <= t) ==> t < &0`]; + ANTS_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN ASM_TAC THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (UNDISCH OWZLKVY4) [`y234`;`y2`;`y3`;`y4`;`&2`;`&2`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.cstab;Sphere.h0] THEN REAL_ARITH_TAC); + DISCH_TAC; + FIRST_X_ASSUM DISJ_CASES_TAC; + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + INTRO_TAC (UNDISCH taud_mu_clauses) [`y2`;`y3`;`y4`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[LET_DEF;LET_END_DEF]; + BY(ASM_TAC THEN REAL_ARITH_TAC); + REPEAT (FIRST_X_ASSUM_ST `mu_y` kill); + INTRO_TAC taud_ge_flat_term [`z1`;`y2`;`y3`;`y4`;`&2`;`&2`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + DISCH_TAC; + INTRO_TAC (UNDISCH edge2_flatD_x1_delta_lemma3) [`&0`;`z1`;`y2`;`y3`;`y4`;`&2`;`&2`]; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + DISCH_TAC; + FIRST_X_ASSUM_ST `sqrt` MP_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + ASM_SIMP_TAC [arith `&2 <= z1 ==> &0 <= z1`]; + INTRO_TAC (UNDISCH delta_mono) [`&2 * h0`;`z1`;`y2`;`y3`;`y4`;`&2`;`&2`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + INTRO_TAC (UNDISCH delta_2_nn) [`z1`;`y2`;`y3`;`y4`]; + ANTS_TAC; + BY(ASM_TAC THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0;arith `#2.52 = &2 * #1.26`] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let mk_25 j k = + let get_spec i j k = ISPECL yys (get_ineq5(i,j,k)) in + let aa i = get_spec i j k in + let rule = PURE_REWRITE_RULE[LET_DEF;LET_END_DEF;BETA_THM] in + GENL yys (MATCH_MP (rule (UNDISCH terminal_hex_234_reduction)) (end_itlist CONJ (map aa (0--4))));; + +(* +let terminal_hex_25 = map (fun (j,k) -> mk_25 j k) (cross (0--4) (0--4));; +*) + +let terminal_hex_126_reduction = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6 y234 y126 f1 f2 b1 b2. + (let dom = [&2,y1, #2.52; &2,y2, #2.52; &2,y3, #2.52; #3.01,y4, #3.915; + #3.01, + y5, + #3.915; #3.01,y6, #3.915;&2,y234,#2.52 ] in + (ineq dom (f1 + flat_term + (sqrt + (edge2_flatD_x1 (&0) (y1 * y1) (y2 * y2) (y6 * y6) (&2 * &2) + (&2 * &2))) + f2 > #0.712 \/ b1 \/ (delta_y (&2) y1 y2 y6 (&2) (&2) < &0 \/ + delta_y #2.52 y1 y2 y6 (&2) (&2) > &0) \/ b2)) /\ +(ineq dom (f1 + &0 + f2 > #0.712 \/ b1 \/ F \/ b2)) /\ +(ineq dom (f1 + ( + mu_y (&2) (sqrt (y1 * y1)) (sqrt (y2 * y2)) * + sqrt (delta_y (&2) y1 y2 y6 (&2) (&2)) - + sol0) + f2 > #0.712 \/ b1 \/ delta_y (&2) y1 y2 y6 (&2) (&2) < &100 \/ b2)) /\ +(ineq dom (f1 + ( mu_y (&2) (sqrt (y1 * y1)) (sqrt (y2 * y2)) * + (&1 / &14 * (delta_y (&2) y1 y2 y6 (&2) (&2) - &16) + &2 * &2) - + sol0) + f2 > #0.712 \/ + b1 \/ (delta_y (&2) y1 y2 y6 (&2) (&2) < &16 \/ + delta_y (&2) y1 y2 y6 (&2) (&2) > &100) \/ b2)) /\ +(ineq dom (f1 + ( &0 - sol0) + f2 > #0.712 \/ + b1 \/ (delta_y (&2) y1 y2 y6 (&2) (&2) < &0 \/ + delta_y (&2) y1 y2 y6 (&2) (&2) > &16) \/ b2))) ==> + (ineq [&2,y1, #2.52; &2,y2, #2.52; &2,y3, #2.52; #3.01,y4, #3.915; + #3.01, + y5, + #3.915; #3.01,y6, #3.915;&2,y234,#2.52;&2,y126,#2.52] ((f1 + taum y126 y1 y2 y6 (&2) (&2)) + f2 > #0.712 \/ + (delta_y y126 y1 y2 y6 (&2) (&2) < &0 \/ b1) \/ b2)))`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.ineq;LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `\/` MP_TAC) THEN ASM_REWRITE_TAC[]; + ASM_CASES_TAC `b1:bool`; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + ASM_CASES_TAC `b2:bool`; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (UNDISCH terminal_hex_234_reduction) [`y3`;`y1`;`y2`;`y6`;`y4`;`y5`;`y126`;`f1`;`f2`;`b1`;`b2`]; + BY(ASM_REWRITE_TAC[Sphere.ineq;LET_DEF;LET_END_DEF]) + ]);; + (* }}} *) + +let mk_5 k = + let yys' = yys @ [`y234:real`] in + let get_spec j k = ISPECL (yys') (mk_25 j k) in + let aa j = get_spec j k in + let rule = PURE_REWRITE_RULE[LET_DEF;LET_END_DEF;BETA_THM] in + GENL yys' (MATCH_MP (rule (UNDISCH terminal_hex_126_reduction)) (end_itlist CONJ (map aa (0--4))));; + +let terminal_hex_135_reduction = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6 y234 y126 y135 f1 b1 b2. + (let dom = [&2,y1, #2.52; &2,y2, #2.52; &2,y3, #2.52; #3.01,y4, #3.915; + #3.01, + y5, + #3.915; #3.01,y6, #3.915;&2,y234,#2.52; &2,y126,#2.52 ] in + (ineq dom (f1 + flat_term + (sqrt + (edge2_flatD_x1 (&0) (y1 * y1) (y3 * y3) (y5 * y5) (&2 * &2) + (&2 * &2))) > #0.712 \/ b1 \/ (delta_y (&2) y1 y3 y5 (&2) (&2) < &0 \/ + delta_y #2.52 y1 y3 y5 (&2) (&2) > &0) \/ b2)) /\ +(ineq dom (f1 + &0 > #0.712 \/ b1 \/ F \/ b2)) /\ +(ineq dom (f1 + ( + mu_y (&2) (sqrt (y1 * y1)) (sqrt (y3 * y3)) * + sqrt (delta_y (&2) y1 y3 y5 (&2) (&2)) - + sol0) > #0.712 \/ b1 \/ delta_y (&2) y1 y3 y5 (&2) (&2) < &100 \/ b2)) /\ +(ineq dom (f1 + ( mu_y (&2) (sqrt (y1 * y1)) (sqrt (y3 * y3)) * + (&1 / &14 * (delta_y (&2) y1 y3 y5 (&2) (&2) - &16) + &2 * &2) - + sol0) > #0.712 \/ + b1 \/ (delta_y (&2) y1 y3 y5 (&2) (&2) < &16 \/ + delta_y (&2) y1 y3 y5 (&2) (&2) > &100) \/ b2)) /\ +(ineq dom (f1 + ( &0 - sol0) > #0.712 \/ + b1 \/ (delta_y (&2) y1 y3 y5 (&2) (&2) < &0 \/ + delta_y (&2) y1 y3 y5 (&2) (&2) > &16) \/ b2))) ==> + (ineq [&2,y1, #2.52; &2,y2, #2.52; &2,y3, #2.52; #3.01,y4, #3.915; + #3.01, + y5, + #3.915; #3.01,y6, #3.915;&2,y234,#2.52;&2,y126,#2.52;&2,y135,#2.52] ((f1 + taum y135 y1 y3 y5 (&2) (&2)) > #0.712 \/ + (delta_y y135 y1 y3 y5 (&2) (&2) < &0 \/ b1) \/ b2)))`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.ineq;LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `==>` MP_TAC) THEN ASM_REWRITE_TAC[]; + ASM_CASES_TAC `b1:bool`; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + ASM_CASES_TAC `b2:bool`; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (UNDISCH terminal_hex_234_reduction) [`y2`;`y1`;`y3`;`y5`;`y4`;`y6`;`y135`;`f1`;`&0`;`b1`;`b2`]; + ASM_REWRITE_TAC[Sphere.ineq;LET_DEF;LET_END_DEF]; + RULE_ASSUM_TAC (REWRITE_RULE[arith `a + &0 = a`]); + BY(ASM_REWRITE_TAC[arith `a + &0 = a`]) + ]);; + (* }}} *) + +let terminal_hex_taum = + let yys' = (yys @ [`y234:real`;`y126:real`]) in + let aa k = ISPECL yys' (mk_5 k) in + let rule1 = PURE_REWRITE_RULE[LET_DEF;LET_END_DEF;BETA_THM] in + let rule2 = REWRITE_RULE[REAL_ADD_AC] in + GENL yys' (rule2(MATCH_MP (rule1 (UNDISCH terminal_hex_135_reduction)) (end_itlist CONJ (map aa (0--4)))));; + +end;; diff --git a/text_formalization/local/polar_fan.hl b/text_formalization/local/polar_fan.hl new file mode 100644 index 0000000..2a31ddf --- /dev/null +++ b/text_formalization/local/polar_fan.hl @@ -0,0 +1,3365 @@ +(* ========================================================================= *) +(* Flyspeck "polar fan" formalization. *) +(* ========================================================================= *) + +(* ------------------------------------------------------------------------- *) +(* Some natural lemmas that I should perhaps put in Multivariate/flyspeck.ml *) +(* ------------------------------------------------------------------------- *) + +module Polar_fan = struct + +let DIHV_ARCV = prove + (`!e u v w:real^N. + orthogonal (e - u) (v - u) /\ orthogonal (e - u) (w - u) /\ ~(e = u) + ==> dihV u e v w = arcV u v w`, + GEOM_ORIGIN_TAC `u:real^N` THEN + REWRITE_TAC[dihV; orthogonal; VECTOR_SUB_RZERO] THEN + CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN + SIMP_TAC[DOT_SYM; VECTOR_MUL_LZERO; VECTOR_SUB_RZERO] THEN + REWRITE_TAC[ARCV_ANGLE; angle; VECTOR_SUB_RZERO] THEN + REWRITE_TAC[VECTOR_ANGLE_LMUL; VECTOR_ANGLE_RMUL] THEN + SIMP_TAC[DOT_POS_LE; DOT_EQ_0]);; + +let AZIM_DIHV_SAME_STRONG = prove + (`!v w v1 v2:real^3. + ~collinear {v,w,v1} /\ ~collinear {v,w,v2} /\ + azim v w v1 v2 <= pi + ==> azim v w v1 v2 = dihV v w v1 v2`, + REWRITE_TAC[REAL_LE_LT] THEN + MESON_TAC[AZIM_DIHV_SAME; AZIM_DIHV_EQ_PI]);; + +let AZIM_ARCV = prove + (`!e u v w:real^3. + orthogonal (e - u) (v - u) /\ orthogonal (e - u) (w - u) /\ + ~collinear{u,e,v} /\ ~collinear{u,e,w} /\ + azim u e v w <= pi + ==> azim u e v w = arcV u v w`, + REPEAT GEN_TAC THEN ASM_CASES_TAC `u:real^3 = e` THENL + [ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_2]; ALL_TAC] THEN + STRIP_TAC THEN ASM_SIMP_TAC[GSYM DIHV_ARCV] THEN + MATCH_MP_TAC AZIM_DIHV_SAME_STRONG THEN ASM_REWRITE_TAC[]);; + +let PLANE_AFFINE_HULL_3 = prove + (`!a b c:real^N. plane(affine hull {a,b,c}) <=> ~collinear{a,b,c}`, + REWRITE_TAC[plane] THEN MESON_TAC[COLLINEAR_AFFINE_HULL_COLLINEAR]);; + +let AFFINE_HULL_3_GENERATED = prove + (`!s u v w:real^N. + s SUBSET affine hull {u,v,w} /\ ~collinear s + ==> affine hull {u,v,w} = affine hull s`, + REWRITE_TAC[COLLINEAR_AFF_DIM; INT_NOT_LE] THEN REPEAT STRIP_TAC THEN + CONV_TAC SYM_CONV THEN + GEN_REWRITE_TAC RAND_CONV [GSYM HULL_HULL] THEN + MATCH_MP_TAC AFF_DIM_EQ_AFFINE_HULL THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC INT_LE_TRANS THEN EXISTS_TAC `&2:int` THEN + CONJ_TAC THENL [ALL_TAC; ASM_INT_ARITH_TAC] THEN + REWRITE_TAC[AFF_DIM_AFFINE_HULL] THEN + W(MP_TAC o PART_MATCH (lhand o rand) AFF_DIM_LE_CARD o lhand o goal_concl) THEN + REWRITE_TAC[FINITE_INSERT; FINITE_EMPTY] THEN + MATCH_MP_TAC(REWRITE_RULE[IMP_CONJ_ALT] INT_LE_TRANS) THEN + REWRITE_TAC[INT_LE_SUB_RADD; INT_OF_NUM_ADD; INT_OF_NUM_LE] THEN + SIMP_TAC[CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY] THEN ARITH_TAC);; + +let COLLINEAR_AZIM_0_OR_PI = prove + (`!u e v w. collinear {u,v,w} ==> azim u e v w = &0 \/ azim u e v w = pi`, + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `collinear{u:real^3,e,v}` THEN + ASM_SIMP_TAC[AZIM_DEGENERATE] THEN + ASM_CASES_TAC `collinear{u:real^3,e,w}` THEN + ASM_SIMP_TAC[AZIM_DEGENERATE] THEN + ASM_SIMP_TAC[AZIM_EQ_0_PI_EQ_COPLANAR] THEN + ONCE_REWRITE_TAC[SET_RULE `{u,e,v,w} = {u,v,w,e}`] THEN + ASM_MESON_TAC[NOT_COPLANAR_NOT_COLLINEAR]);; + +let ANGLES_ADD_AFF_GE = prove + (`!u v w x:real^N. + ~(v = u) /\ ~(w = u) /\ ~(x = u) /\ x IN aff_ge {u} {v,w} + ==> angle(v,u,x) + angle(x,u,w) = angle(v,u,w)`, + GEOM_ORIGIN_TAC `u:real^N` THEN REPEAT GEN_TAC THEN + REPEAT(DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + ASM_SIMP_TAC[AFF_GE_1_2_0] THEN + REWRITE_TAC[IN_ELIM_THM; LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`a:real`; `b:real`] THEN + DISCH_THEN(CONJUNCTS_THEN2 STRIP_ASSUME_TAC MP_TAC) THEN + SUBGOAL_THEN `a = &0 /\ b = &0 \/ &0 < a + b` STRIP_ASSUME_TAC THENL + [ASM_REAL_ARITH_TAC; + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID]; + ALL_TAC] THEN + DISCH_TAC THEN MP_TAC(ISPECL + [`v:real^N`; `w:real^N`; `inv(a + b) % x:real^N`; `vec 0:real^N`] + ANGLES_ADD_BETWEEN) THEN + ASM_REWRITE_TAC[angle; VECTOR_SUB_RZERO] THEN + ASM_SIMP_TAC[VECTOR_ANGLE_RMUL; VECTOR_ANGLE_LMUL; + REAL_INV_EQ_0; REAL_LE_INV_EQ; REAL_LT_IMP_NZ; REAL_LT_IMP_LE] THEN + DISCH_THEN MATCH_MP_TAC THEN + REWRITE_TAC[BETWEEN_IN_SEGMENT; CONVEX_HULL_2; SEGMENT_CONVEX_HULL] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + MAP_EVERY EXISTS_TAC [`a / (a + b):real`; `b / (a + b):real`] THEN + ASM_SIMP_TAC[REAL_LE_DIV; REAL_LT_IMP_LE; VECTOR_ADD_LDISTRIB] THEN + REWRITE_TAC[VECTOR_MUL_ASSOC; real_div; REAL_MUL_AC] THEN + UNDISCH_TAC `&0 < a + b` THEN CONV_TAC REAL_FIELD);; + +let AFF_GE_SCALE_LEMMA = prove + (`!a u v:real^N. + &0 < a /\ ~(v = vec 0) + ==> aff_ge {vec 0} {a % u,v} = aff_ge {vec 0} {u,v}`, + REPEAT STRIP_TAC THEN ASM_CASES_TAC `u:real^N = vec 0` THEN + ASM_REWRITE_TAC[VECTOR_MUL_RZERO] THEN + ASM_SIMP_TAC[AFF_GE_1_2_0; VECTOR_MUL_EQ_0; REAL_LT_IMP_NZ; + SET_RULE `DISJOINT {a} {b,c} <=> ~(b = a) /\ ~(c = a)`] THEN + REWRITE_TAC[GSYM SUBSET_ANTISYM_EQ; SUBSET; FORALL_IN_GSPEC] THEN + CONJ_TAC THEN MAP_EVERY X_GEN_TAC [`b:real`; `c:real`] THEN + REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THENL + [EXISTS_TAC `a * b:real`; EXISTS_TAC `b / a:real`] THEN + EXISTS_TAC `c:real` THEN + ASM_SIMP_TAC[REAL_LE_DIV; REAL_LE_MUL; REAL_LT_IMP_LE] THEN + REWRITE_TAC[VECTOR_MUL_ASSOC] THEN + REPLICATE_TAC 2 (AP_THM_TAC THEN AP_TERM_TAC) THEN + UNDISCH_TAC `&0 < a` THEN CONV_TAC REAL_FIELD);; + +let AZIM_SAME_WITHIN_AFF_GE = prove + (`!a u v w z. + v IN aff_ge {a} {u,w} /\ ~collinear{a,u,v} /\ ~collinear{a,u,w} + ==> azim a u v z = azim a u w z`, + GEOM_ORIGIN_TAC `a:real^3` THEN + GEOM_BASIS_MULTIPLE_TAC 3 `u:real^3` THEN + X_GEN_TAC `u:real` THEN ASM_CASES_TAC `u = &0` THEN + ASM_SIMP_TAC[AZIM_DEGENERATE; VECTOR_MUL_LZERO; REAL_LE_LT] THEN + ASM_SIMP_TAC[AZIM_SPECIAL_SCALE; COLLINEAR_SPECIAL_SCALE] THEN + DISCH_TAC THEN REPEAT GEN_TAC THEN + ASM_CASES_TAC `w:real^3 = vec 0` THENL + [ASM_REWRITE_TAC[COLLINEAR_2; INSERT_AC]; ALL_TAC] THEN + ASM_SIMP_TAC[AFF_GE_SCALE_LEMMA] THEN + REWRITE_TAC[COLLINEAR_BASIS_3; AZIM_ARG] THEN + ASM_SIMP_TAC[AFF_GE_1_2_0; BASIS_NONZERO; ARITH; DIMINDEX_3; + SET_RULE `DISJOINT {a} {b,c} <=> ~(b = a) /\ ~(c = a)`] THEN + REWRITE_TAC[IMP_CONJ; LEFT_IMP_EXISTS_THM; IN_ELIM_THM] THEN + MAP_EVERY X_GEN_TAC [`a:real`; `b:real`] THEN DISCH_TAC THEN DISCH_TAC THEN + DISCH_THEN(MP_TAC o AP_TERM `dropout 3:real^3->real^2`) THEN + REWRITE_TAC[DROPOUT_ADD; DROPOUT_MUL; DROPOUT_BASIS_3] THEN + REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + DISCH_THEN SUBST1_TAC THEN REPEAT DISCH_TAC THEN + REWRITE_TAC[COMPLEX_CMUL] THEN + REWRITE_TAC[complex_div; COMPLEX_INV_MUL; GSYM CX_INV] THEN + ONCE_REWRITE_TAC[COMPLEX_RING `a * b * c:complex = b * a * c`] THEN + MATCH_MP_TAC ARG_MUL_CX THEN REWRITE_TAC[REAL_LT_INV_EQ] THEN + ASM_REWRITE_TAC[REAL_LT_LE] THEN ASM_MESON_TAC[VECTOR_MUL_LZERO]);; + +let AZIM_SAME_WITHIN_AFF_GE_ALT = prove + (`!a u v w z. + v IN aff_ge {a} {u,w} /\ ~collinear{a,u,v} /\ ~collinear{a,u,w} + ==> azim a u z v = azim a u z w`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP AZIM_SAME_WITHIN_AFF_GE) THEN + ASM_CASES_TAC `collinear {a:real^3,u,z}` THEN + ASM_SIMP_TAC[AZIM_DEGENERATE] THEN + W(MP_TAC o PART_MATCH (lhs o rand) AZIM_COMPL o lhand o goal_concl) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN SUBST1_TAC THEN + W(MP_TAC o PART_MATCH (lhs o rand) AZIM_COMPL o rand o goal_concl) THEN + ASM_SIMP_TAC[]);; + +let COLLINEAR_WITHIN_AFF_GE_COLLINEAR = prove + (`!a u v w:real^N. + v IN aff_ge {a} {u,w} /\ collinear{a,u,w} ==> collinear{a,v,w}`, + GEOM_ORIGIN_TAC `a:real^N` THEN REPEAT GEN_TAC THEN + ASM_CASES_TAC `w:real^N = vec 0` THENL + [ASM_REWRITE_TAC[COLLINEAR_2; INSERT_AC]; ALL_TAC] THEN + ASM_CASES_TAC `u:real^N = vec 0` THENL + [ONCE_REWRITE_TAC[AFF_GE_DISJOINT_DIFF] THEN + ASM_REWRITE_TAC[SET_RULE `{a} DIFF {a,b} = {}`] THEN + REWRITE_TAC[GSYM CONVEX_HULL_AFF_GE] THEN + ONCE_REWRITE_TAC[SET_RULE `{z,v,w} = {z,w,v}`] THEN + ASM_SIMP_TAC[COLLINEAR_3_AFFINE_HULL] THEN + MESON_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL; SUBSET]; + ONCE_REWRITE_TAC[SET_RULE `{z,v,w} = {z,w,v}`] THEN + ASM_REWRITE_TAC[COLLINEAR_LEMMA_ALT] THEN + DISCH_THEN(CONJUNCTS_THEN2 MP_TAC (X_CHOOSE_TAC `a:real`)) THEN + ASM_SIMP_TAC[AFF_GE_1_2_0; SET_RULE + `DISJOINT {a} {b,c} <=> ~(b = a) /\ ~(c = a)`] THEN + REWRITE_TAC[IN_ELIM_THM; LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`b:real`; `c:real`] THEN STRIP_TAC THEN + ASM_REWRITE_TAC[GSYM VECTOR_ADD_RDISTRIB; VECTOR_MUL_ASSOC] THEN + MESON_TAC[]]);; + +(* ------------------------------------------------------------------------- *) +(* Borderline case. *) +(* ------------------------------------------------------------------------- *) + +let GENERIC_LOCAL_FAN_STRAIGHT_AFF_GE = prove + (`!u v w. + ~collinear{vec 0,v,u} /\ ~collinear{vec 0,v,w} /\ + azim (vec 0) v w u = pi /\ + aff_ge {vec 0} {v, w} INTER aff_lt {vec 0} {u} = {} + ==> v IN aff_ge {vec 0} {u,w}`, + REPEAT GEN_TAC THEN + MAP_EVERY (fun t -> + ASM_CASES_TAC t THENL [ASM_REWRITE_TAC[INSERT_AC; COLLINEAR_2]; ALL_TAC]) + [`v:real^3 = vec 0`; `u:real^3 = vec 0`; `w:real^3 = vec 0`; + `u:real^3 = v`; `v:real^3 = w`] THEN + REPLICATE_TAC 2 (DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + ASM_SIMP_TAC[AZIM_EQ_PI] THEN + ASM_SIMP_TAC[AFF_LT_2_1; AFF_LT_1_1; AFF_GE_1_2; DISJOINT_INSERT; + DISJOINT_EMPTY; IN_INSERT; NOT_IN_EMPTY] THEN + REWRITE_TAC[TAUT `p /\ x = &1 /\ q <=> x = &1 /\ p /\ q`] THEN + REWRITE_TAC[VECTOR_MUL_RZERO; REAL_ARITH + `t1 + x = &1 <=> t1 = &1 - x`] THEN + REWRITE_TAC[RIGHT_EXISTS_AND_THM; VECTOR_ADD_LID] THEN + ONCE_REWRITE_TAC[MESON[] `(?a b c. P a b c) <=> (?c b a. P a b c)`] THEN + REWRITE_TAC[UNWIND_THM2] THEN ONCE_REWRITE_TAC[SWAP_EXISTS_THM] THEN + REWRITE_TAC[UNWIND_THM2; IN_ELIM_THM] THEN + REWRITE_TAC[IMP_CONJ; LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`s:real`; `t:real`] THEN REPEAT STRIP_TAC THEN + DISJ_CASES_TAC(REAL_ARITH `&0 < s \/ s <= &0`) THENL + [MAP_EVERY EXISTS_TAC [`--t / s:real`; `&1 / s`] THEN + ASM_SIMP_TAC[REAL_LE_DIV; REAL_POS; REAL_LT_IMP_LE; + REAL_ARITH `t < &0 ==> &0 <= --t`] THEN + REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC] THEN + ASM_SIMP_TAC[REAL_DIV_RMUL; REAL_LT_IMP_NZ] THEN VECTOR_ARITH_TAC; + FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (SET_RULE + `s INTER t = {} ==> !x. x IN s /\ x IN t ==> P`)) THEN + EXISTS_TAC `t % u:real^3` THEN REWRITE_TAC[IN_ELIM_THM] THEN + CONJ_TAC THENL [ALL_TAC; ASM_MESON_TAC[]] THEN + MAP_EVERY EXISTS_TAC [`--s:real`; `&1`] THEN + REPEAT(CONJ_TAC THENL [ASM_REAL_ARITH_TAC; ALL_TAC]) THEN + ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC]);; + +let UNION_AFF_GE_1_2 = prove + (`!a u v w:real^N. + v IN aff_ge {a} {u,w} /\ ~(u = a) /\ ~(v = a) /\ ~(w = a) + ==> aff_ge {a} {u,v} UNION aff_ge {a} {v,w} = aff_ge {a} {u,w}`, + GEOM_ORIGIN_TAC `a:real^N` THEN REPEAT STRIP_TAC THEN + UNDISCH_TAC `(v:real^N) IN aff_ge {vec 0} {u,w}` THEN + ASM_SIMP_TAC[AFF_GE_1_2_0; SET_RULE + `a UNION b = c <=> a SUBSET c /\ b SUBSET c /\ c SUBSET a UNION b`] THEN + REWRITE_TAC[SUBSET; FORALL_IN_GSPEC] THEN + REWRITE_TAC[IN_ELIM_THM; IN_UNION; LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`m:real`; `n:real`] THEN STRIP_TAC THEN + REPEAT CONJ_TAC THEN MAP_EVERY X_GEN_TAC [`a:real`; `b:real`] THEN + STRIP_TAC THENL + [MAP_EVERY EXISTS_TAC [`a + b * m:real`; `b * n:real`] THEN + ASM_SIMP_TAC[REAL_LE_ADD; REAL_LE_MUL] THEN VECTOR_ARITH_TAC; + MAP_EVERY EXISTS_TAC [`a * m:real`; `a * n + b:real`] THEN + ASM_SIMP_TAC[REAL_LE_ADD; REAL_LE_MUL] THEN VECTOR_ARITH_TAC; + ALL_TAC] THEN + DISJ_CASES_TAC(REAL_ARITH `b * m <= a * n \/ a * n <= b * m`) THENL + [DISJ1_TAC; DISJ2_TAC] THEN + ASM_REWRITE_TAC[] THENL + [MAP_EVERY EXISTS_TAC [`a - b / n * m:real`; `b / n:real`] THEN + ASM_SIMP_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; VECTOR_ADD_ASSOC] THEN + ASM_REWRITE_TAC[GSYM VECTOR_ADD_RDISTRIB; REAL_SUB_ADD; VECTOR_MUL_RCANCEL; + VECTOR_ARITH `a + x:real^N = a + y <=> x = y`] THEN + ASM_SIMP_TAC[REAL_SUB_LE; REAL_LE_DIV] THEN ASM_CASES_TAC `n = &0` THENL + [MAP_EVERY UNDISCH_TAC [`v:real^N = m % u + n % w`; `b * m <= a * n`] THEN + ASM_SIMP_TAC[REAL_MUL_RZERO; REAL_LE_MUL; REAL_ENTIRE; + REAL_ARITH `&0 <= x ==> (x <= &0 <=> x = &0)`] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID] THEN + ASM_REWRITE_TAC[real_div; REAL_MUL_LZERO]; + ASM_SIMP_TAC[REAL_DIV_RMUL] THEN + REWRITE_TAC[REAL_ARITH `b / n * m:real = (b * m) / n`] THEN + ASM_SIMP_TAC[REAL_LE_LDIV_EQ; REAL_LT_LE]]; + MAP_EVERY EXISTS_TAC [`a / m:real`; `b - a / m * n:real`] THEN + REWRITE_TAC[VECTOR_ADD_LDISTRIB; GSYM VECTOR_ADD_ASSOC] THEN + REWRITE_TAC[VECTOR_MUL_ASSOC; GSYM VECTOR_ADD_RDISTRIB] THEN + ASM_REWRITE_TAC[REAL_SUB_ADD2; VECTOR_MUL_RCANCEL; + VECTOR_ARITH `x + a:real^N = y + a <=> x = y`] THEN + ASM_SIMP_TAC[REAL_SUB_LE; REAL_LE_DIV] THEN ASM_CASES_TAC `m = &0` THENL + [MAP_EVERY UNDISCH_TAC [`v:real^N = m % u + n % w`; `a * n <= b * m`] THEN + ASM_SIMP_TAC[REAL_MUL_RZERO; REAL_LE_MUL; REAL_ENTIRE; + REAL_ARITH `&0 <= x ==> (x <= &0 <=> x = &0)`] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID] THEN + ASM_REWRITE_TAC[real_div; REAL_MUL_LZERO]; + ASM_SIMP_TAC[REAL_DIV_RMUL] THEN + REWRITE_TAC[REAL_ARITH `b / n * m:real = (b * m) / n`] THEN + ASM_SIMP_TAC[REAL_LE_LDIV_EQ; REAL_LT_LE]]]);; + +(* ------------------------------------------------------------------------- *) +(* More specialist lemmas. *) +(* ------------------------------------------------------------------------- *) + +let AZIM_CYCLE_BASIC_PROPERTIES = prove + (`!W v w p. + FINITE W /\ p IN W + ==> (azim_cycle W v w p) IN W /\ + !q. q IN W /\ ~(q = p) + ==> azim v w p (azim_cycle W v w p) <= azim v w p q`, + REPEAT GEN_TAC THEN ASM_CASES_TAC `W SUBSET {p:real^3}` THENL + [ASM_SIMP_TAC[Sphere.azim_cycle; AZIM_REFL; azim]; ALL_TAC] THEN + UNDISCH_TAC `~(W SUBSET {p:real^3})` THEN + ONCE_REWRITE_TAC[TAUT `p ==> q /\ r ==> s <=> p /\ q ==> r ==> s`] THEN + DISCH_THEN(MP_TAC o MATCH_MP Wrgcvdr_cizmrrh.AZIM_CYCLE_PROPERTIES) THEN + SIMP_TAC[IN] THEN MESON_TAC[REAL_LE_LT]);; + +let AZIM_CYCLE_TWO_POINT_SET_ALT = prove + (`!W x u v w. W = {v,w} ==> azim_cycle W x u v = w`, + MESON_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]);; + +let IVS_AZIM_CYCLE_TWO_POINT_SET = prove + (`!a b. ivs_azim_cycle {a, b} v w a = b`, + REWRITE_TAC[Wrgcvdr_cizmrrh.ivs_azim_cycle; NOT_INSERT_EMPTY] THEN + SIMP_TAC[SET_RULE `x IN {a,b} /\ P x <=> x = a /\ P a \/ x = b /\ P b`] THEN + REWRITE_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET] THEN + ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`] THEN + REWRITE_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET] THEN + MESON_TAC[]);; + +let IVS_AZIM_CYCLE_TWO_POINT_SET_ALT = prove + (`!W x u v w. W = {v,w} ==> ivs_azim_cycle W x u v = w`, + MESON_TAC[IVS_AZIM_CYCLE_TWO_POINT_SET]);; + +let AZIM_CYCLE_SING = prove + (`!x u v. azim_cycle {v} x u v = v`, + REWRITE_TAC[Sphere.azim_cycle; SUBSET_REFL]);; + +let IVS_AZIM_CYCLE_SING = prove + (`!x u v. ivs_azim_cycle {v} x u v = v`, + ONCE_REWRITE_TAC[SET_RULE `{v} = {v,v}`] THEN + REWRITE_TAC[IVS_AZIM_CYCLE_TWO_POINT_SET]);; + +let RHO_NODE1_INJECTIVE = prove + (`!V E FF. + local_fan(V,E,FF) + ==> !v w. v IN V /\ w IN V + ==> (rho_node1 FF v = rho_node1 FF w <=> v = w)`, + MESON_TAC[Local_lemmas.IVS_RHO_IDD]);; + +let IVS_RHO_NODE1_IN_V = prove + (`!V E FF. local_fan (V,E,FF) ==> !v. v IN V ==> ivs_rho_node1 FF v IN V`, + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V; + Local_lemmas.ITER_CARD_MINUS1_EQ_IVS_RN1]);; + +let LOCAL_FAN_ITER_IVS_RHO_NODE_IN_V = prove + (`!V E FF. local_fan (V,E,FF) /\ v IN V + ==> !i. ITER i (ivs_rho_node1 FF) v IN V`, + REPEAT GEN_TAC THEN STRIP_TAC THEN INDUCT_TAC THEN + ASM_SIMP_TAC[ITER] THEN ASM_MESON_TAC[IVS_RHO_NODE1_IN_V]);; + +let LOCAL_FAN_ORBIT_MAP_EXPLICIT = prove + (`!V E FF v w. + local_fan(V,E,FF) /\ v IN V /\ w IN V + ==> ?i. i < CARD V /\ w = ITER i (rho_node1 FF) v`, + REPEAT STRIP_TAC THEN FIRST_ASSUM(MP_TAC o SPEC `v:real^3` o + MATCH_MP Local_lemmas.LOCAL_FAN_ORBIT_MAP_V) THEN + REWRITE_TAC[Wrgcvdr_cizmrrh.POWER_TO_ITER; Hypermap.orbit_map] THEN + ASM_REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN + DISCH_THEN(MP_TAC o SPEC `w:real^3`) THEN ASM_REWRITE_TAC[GE; LE_0] THEN + DISCH_THEN(X_CHOOSE_THEN `n:num` SUBST1_TAC) THEN + EXISTS_TAC `n MOD (CARD(V:real^3->bool))` THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP Local_lemmas.LOCAL_FAN_FINITE_V) THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP Local_lemmas.LOFA_V_NOT_EMP) THEN + MP_TAC(ISPECL [`n:num`; `CARD(V:real^3->bool)`] DIVISION) THEN + ABBREV_TAC `i = n MOD (CARD(V:real^3->bool))` THEN + ABBREV_TAC `m = n DIV (CARD(V:real^3->bool))` THEN + ASM_SIMP_TAC[CARD_EQ_0] THEN DISCH_THEN(K ALL_TAC) THEN + SPEC_TAC(`m:num`,`p:num`) THEN + INDUCT_TAC THEN REWRITE_TAC[MULT_CLAUSES; ADD_CLAUSES] THEN + ONCE_REWRITE_TAC[ARITH_RULE `(a + b) + c:num = (a + c) + b`] THEN + ONCE_REWRITE_TAC[GSYM ITER_ADD] THEN + FIRST_ASSUM(MP_TAC o MATCH_MP Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID) THEN + ASM_SIMP_TAC[]);; + +let LOCAL_FAN_ORBIT_MAP_EXPLICIT_IVS = prove + (`!V E FF v w. + local_fan(V,E,FF) /\ v IN V /\ w IN V + ==> ?i. i < CARD V /\ w = ITER i (ivs_rho_node1 FF) v`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM(MP_TAC o SPECL [`w:real^3`; `v:real^3`] o + MATCH_MP (REWRITE_RULE[IMP_CONJ] LOCAL_FAN_ORBIT_MAP_EXPLICIT)) THEN + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC MONO_EXISTS THEN + X_GEN_TAC `i:num` THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + CONV_TAC SYM_CONV THEN + UNDISCH_TAC `(w:real^3) IN V` THEN SPEC_TAC(`w:real^3`,`w:real^3`) THEN + SPEC_TAC(`i:num`,`n:num`) THEN INDUCT_TAC THENL + [REWRITE_TAC[ITER]; ALL_TAC] THEN + X_GEN_TAC `x:real^3` THEN DISCH_TAC THEN + ONCE_REWRITE_TAC[ITER_ALT] THEN REWRITE_TAC[ITER] THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `ITER n (ivs_rho_node1 FF) (ITER n (rho_node1 FF) x)` THEN + CONJ_TAC THENL [AP_TERM_TAC; ASM_SIMP_TAC[]] THEN + ASM_MESON_TAC[Local_lemmas.IVS_RHO_IDD; + Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V]);; + +let ITER_IVS_RHO_IDD = prove + (`!V E FF v n. + local_fan (V,E,FF) /\ v IN V + ==> ITER n (ivs_rho_node1 FF) (ITER n (rho_node1 FF) v) = v`, + REWRITE_TAC[RIGHT_FORALL_IMP_THM; IMP_CONJ] THEN + REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[RIGHT_IMP_FORALL_THM] THEN + ONCE_REWRITE_TAC[SWAP_FORALL_THM] THEN INDUCT_TAC THENL + [REWRITE_TAC[ITER]; ONCE_REWRITE_TAC[ITER_ALT] THEN REWRITE_TAC[ITER]] THEN + ASM_MESON_TAC[Local_lemmas.IVS_RHO_IDD; + Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V]);; + +let ITER_RHO_IVS_IDD = prove + (`!V E FF v n. + local_fan (V,E,FF) /\ v IN V + ==> ITER n (rho_node1 FF) (ITER n (ivs_rho_node1 FF) v) = v`, + REWRITE_TAC[RIGHT_FORALL_IMP_THM; IMP_CONJ] THEN + REPEAT GEN_TAC THEN STRIP_TAC THEN REWRITE_TAC[RIGHT_IMP_FORALL_THM] THEN + ONCE_REWRITE_TAC[SWAP_FORALL_THM] THEN INDUCT_TAC THENL + [REWRITE_TAC[ITER]; ONCE_REWRITE_TAC[ITER_ALT] THEN REWRITE_TAC[ITER]] THEN + ASM_MESON_TAC[Tecoxbm.RHO_IVS_IDD; LOCAL_FAN_ITER_IVS_RHO_NODE_IN_V]);; + +let LOFA_IMP_ITER_IVS_RHO_NODE_ID = prove + (`!V E FF'. + local_fan (V,E,FF) + ==> (!v. v IN V ==> ITER (CARD V) (ivs_rho_node1 FF) v = v)`, + MESON_TAC[Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID; ITER_IVS_RHO_IDD]);; + +let GENERIC_LOCAL_FAN_AZIM_POS = prove + (`!V E FF v w. + convex_local_fan(V,E,FF) /\ generic V E /\ + (!v. v IN V ==> interior_angle1 (vec 0) FF v < pi) /\ + v IN V /\ w IN V /\ ~(w = v) /\ ~(w = rho_node1 FF v) + ==> &0 < sin(azim (vec 0) v (rho_node1 FF v) w)`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM(STRIP_ASSUME_TAC o GEN_REWRITE_RULE I + [Wrgcvdr_cizmrrh.convex_local_fan]) THEN + MATCH_MP_TAC SIN_POS_PI THEN REWRITE_TAC[REAL_LT_LE] THEN + REWRITE_TAC[Local_lemmas.AZIM_RANGE] THEN + ONCE_REWRITE_TAC[MESON[] `~(z = a) /\ p /\ q <=> p /\ ~(a = z) /\ q`] THEN + CONJ_TAC THENL + [ASM_MESON_TAC[Local_lemmas.IN_V_IMP_AZIM_LESS_PI]; ALL_TAC] THEN + FIRST_ASSUM(MP_TAC o SPECL [`v:real^3`; `w:real^3`] o + MATCH_MP (REWRITE_RULE[IMP_CONJ] LOCAL_FAN_ORBIT_MAP_EXPLICIT)) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN(X_CHOOSE_THEN `m:num` (STRIP_ASSUME_TAC o GSYM)) THEN + ASM_CASES_TAC `m = 0` THENL [ASM_MESON_TAC[ITER]; ALL_TAC] THEN + ASM_CASES_TAC `m = 1` THENL [ASM_MESON_TAC[Lvducxu.ITER12]; ALL_TAC] THEN + FIRST_ASSUM(MP_TAC o GEN_ALL o MATCH_MP + (REWRITE_RULE[IMP_CONJ] Local_lemmas.EGHNAVX)) THEN + DISCH_THEN(MP_TAC o SPECL + [`\i. azim (vec 0) v (rho_node1 FF v) (ITER i (rho_node1 FF) v)`; + `m:num`; `v:real^3`; `\i. ITER i (rho_node1 FF) (v:real^3)`; + `CARD(V:real^3->bool)`]) THEN + ASM_REWRITE_TAC[IMP_IMP; Lvducxu.ITER12] THEN + ANTS_TAC THENL + [ASM_MESON_TAC[IN_INSERT; Nkezbfc_local.PROPERTIES_GENERIC1]; ALL_TAC] THEN + REWRITE_TAC[TAUT `p ==> ~q /\ ~r <=> q \/ r ==> ~p`] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [DISCH_THEN(MP_TAC o SPEC `1` o el 3 o CONJUNCTS) THEN + ASM_REWRITE_TAC[Lvducxu.ITER12; NOT_IMP] THEN CONJ_TAC THENL + [ASM_ARITH_TAC; + ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; REAL_LT_REFL]]; + REPLICATE_TAC 3 (DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + DISCH_THEN(MP_TAC o CONJUNCT2) THEN REWRITE_TAC[NOT_IMP] THEN + FIRST_ASSUM(MP_TAC o MATCH_MP (ARITH_RULE + `m < CARD V ==> m < CARD V - 1 \/ m = CARD V - 1`)) THEN + DISCH_THEN DISJ_CASES_TAC THENL + [REWRITE_TAC[NOT_IMP] THEN CONJ_TAC THENL + [ASM_SIMP_TAC[LE_1] THEN FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP + (REAL_ARITH `x = pi ==> x <= y /\ y <= pi ==> pi = y`)) THEN + ASM_REWRITE_TAC[] THEN EXPAND_TAC "w" THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; + DISCH_THEN(MP_TAC o SPEC `CARD(V:real^3->bool) - 1` o CONJUNCT1) THEN + REWRITE_TAC[NOT_IMP] THEN CONJ_TAC THENL [ASM_ARITH_TAC; ALL_TAC] THEN + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V; + REAL_LT_REFL]]; + MATCH_MP_TAC(TAUT `F ==> p`) THEN + FIRST_ASSUM(MP_TAC o SPEC `v:real^3` o MATCH_MP + Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM_IVS) THEN + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC(REAL_ARITH + `x < pi /\ y = pi ==> ~(x = y)`) THEN + ASM_SIMP_TAC[] THEN + SUBGOAL_THEN `ivs_rho_node1 FF v = w` (fun t -> ASM_REWRITE_TAC[t]) THEN + SUBGOAL_THEN `v = rho_node1 FF w` MP_TAC THENL + [ALL_TAC; ASM_MESON_TAC[Local_lemmas.IVS_RHO_IDD]] THEN + EXPAND_TAC "w" THEN REWRITE_TAC[GSYM(CONJUNCT2 ITER)] THEN + SUBGOAL_THEN `SUC m = CARD(V:real^3->bool)` SUBST1_TAC THENL + [ASM_ARITH_TAC; + ASM_MESON_TAC[Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID]]]]);; + +let nn_of_hyp3 = prove + (`!x V E. nn_of_hyp (x,V,E) = + \(v,w). if (v,w) IN darts_of_hyp E V + then (v,azim_cycle (EE v E) x v w) else (v,w)`, + REWRITE_TAC[FUN_EQ_THM; FORALL_PAIR_THM; Wrgcvdr_cizmrrh.nn_of_hyp]);; + +let ff_of_hyp3 = prove + (`!x V E. ff_of_hyp (x,V,E) = + \(v,w). if (v,w) IN darts_of_hyp E V + then (w,ivs_azim_cycle (EE w E) x w v) else (v,w)`, + REWRITE_TAC[FUN_EQ_THM; FORALL_PAIR_THM; Wrgcvdr_cizmrrh.ff_of_hyp]);; + +let ee_of_hyp3 = prove + (`!x V E. ee_of_hyp (x,V,E) = + \(v,w). if (v,w) IN darts_of_hyp E V then (w,v) else (v,w)`, + REWRITE_TAC[FUN_EQ_THM; FORALL_PAIR_THM; Wrgcvdr_cizmrrh.ee_of_hyp]);; + +let ORDER_AZIM_SUM2Pi_0 = prove + (`!x y z n g. + ~collinear {x, y, z} /\ + (!i. i IN 0..n ==> ~collinear {x, y, g i}) /\ + g(n+1) = g 0 /\ + 0 < n /\ + (!j k. + j IN 0..n /\ k IN 0..n /\ j < k + ==> azim x y z (g j) < azim x y z (g k)) + ==> sum (0..n) (\i. azim x y (g i) (g (i + 1))) = &2 * pi`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPECL + [`x:real^3`; `y:real^3`; `z:real^3`; `n + 1`; `\i. (g:num->real^3) (i - 1)`] + Counting_spheres.ORDER_AZIM_SUM2Pi) THEN + ASM_REWRITE_TAC[] THEN ANTS_TAC THENL + [ASM_REWRITE_TAC[ADD_SUB; SUB_REFL; ARITH_RULE `1 < n + 1 <=> 0 < n`] THEN + REWRITE_TAC[IN_NUMSEG] THEN CONJ_TAC THEN REPEAT GEN_TAC THEN + STRIP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN + ASM_ARITH_TAC; + GEN_REWRITE_TAC (funpow 4 LAND_CONV) + [ARITH_RULE `1 = 0 + 1`] THEN + REWRITE_TAC[SUM_OFFSET; ADD_SUB]]);; + +let LOCAL_FAN_NOT_EMPTY_FF = prove + (`!V E FF. local_fan (V,E,FF) ==> ~(FF = {})`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM(MP_TAC o GEN_ALL o MATCH_MP + (REWRITE_RULE[IMP_CONJ] Wrgcvdr_cizmrrh.BIJ_BETWEEN_FF_AND_V)) THEN + DISCH_THEN(MP_TAC o SPEC `FST:real^3#real^3->real^3`) THEN + ASM_REWRITE_TAC[BIJ; INJ; SURJ; NOT_IN_EMPTY; ETA_AX] THEN + FIRST_ASSUM(MP_TAC o MATCH_MP Local_lemmas.LOFA_V_NOT_EMP) THEN + SET_TAC[]);; + +let LOCAL_FAN_NOT_CARD_FF_GE_2 = prove + (`!V E FF. local_fan (V,E,FF) ==> 2 <= CARD FF`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[ARITH_RULE `2 <= n <=> ~(n = 0) /\ ~(n = 1)`] THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP Wrgcvdr_cizmrrh.LOCAL_FAN_FINITE_FF) THEN + ASM_SIMP_TAC[MESON[HAS_SIZE] + `FINITE s ==> (CARD s = n <=> s HAS_SIZE n)`] THEN + CONJ_TAC THEN CONV_TAC(RAND_CONV HAS_SIZE_CONV) THEN + ASM_MESON_TAC[LOCAL_FAN_NOT_EMPTY_FF; + Local_lemmas.LOCAL_FAN_NOT_SING_FF]);; + +let SIN_AZIM_MUTUAL_CROSS = prove + (`(sin (azim (vec 0) u v w) < &0 <=> (u cross v) dot w < &0) /\ + (&0 < sin (azim (vec 0) u v w) <=> &0 < (u cross v) dot w) /\ + (sin (azim (vec 0) u v w) <= &0 <=> (u cross v) dot w <= &0) /\ + (&0 <= sin (azim (vec 0) u v w) <=> &0 <= (u cross v) dot w) /\ + (sin (azim (vec 0) u v w) = &0 <=> (u cross v) dot w = &0)`, + REWRITE_TAC[Local_lemmas.SIN_AZIM_MUTUAL_SROSS; + GSYM REAL_LE_ANTISYM; GSYM REAL_NOT_LT]);; + +let CROSS_POSITIVE_MULTIPLE_AZIM_AXIS = prove + (`!x y z. ~(x = vec 0) /\ orthogonal x y /\ orthogonal x z /\ + &0 < azim (vec 0) x y z /\ azim (vec 0) x y z < pi + ==> ?a. &0 < a /\ y cross z = a % x`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `collinear{vec 0,x,y cross z}` MP_TAC THENL + [REPEAT(POP_ASSUM MP_TAC) THEN REWRITE_TAC[GSYM CROSS_EQ_0] THEN VEC3_TAC; + ALL_TAC] THEN + ASM_REWRITE_TAC[COLLINEAR_LEMMA_ALT] THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `a:real` THEN + DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `&0 < sin(azim (vec 0) x y z)` MP_TAC THENL + [ASM_SIMP_TAC[SIN_POS_PI]; REWRITE_TAC[SIN_AZIM_MUTUAL_CROSS]] THEN + ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN + ASM_SIMP_TAC[REAL_LT_MUL_EQ; DOT_LMUL; DOT_POS_LT]);; + +let CROSS_POSITIVE_MULTIPLE_AZIM_AXIS_ALT = prove + (`!x y z. ~(x = vec 0) /\ orthogonal x y /\ orthogonal x z /\ + &0 < azim (vec 0) x y z /\ azim (vec 0) x y z < pi + ==> ?a. &0 < a /\ x = a % (y cross z)`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + FIRST_ASSUM(MP_TAC o MATCH_MP CROSS_POSITIVE_MULTIPLE_AZIM_AXIS) THEN + DISCH_THEN(X_CHOOSE_THEN `a:real` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `inv(a):real` THEN ASM_REWRITE_TAC[REAL_LT_INV_EQ] THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; REAL_LT_IMP_NZ; + VECTOR_MUL_LID]);; + +(* ------------------------------------------------------------------------- *) +(* Equivalences for fan7 and so for FAN. *) +(* ------------------------------------------------------------------------- *) + +let GMLWKPK = prove + (`!x:real^N V E. + graph E + ==> (fan7(x,V,E) <=> + !e1 e2. e1 IN E UNION {{v} | v IN V} /\ + e2 IN E UNION {{v} | v IN V} + ==> (e1 INTER e2 = {} + ==> aff_ge {x} e1 INTER aff_ge {x} e2 = {x}) /\ + (!v. e1 INTER e2 = {v} + ==> aff_ge {x} e1 INTER aff_ge {x} e2 = + aff_ge {x} {v}))`, + REPEAT STRIP_TAC THEN REWRITE_TAC[Fan.fan7] THEN EQ_TAC THENL + [SIMP_TAC[AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING]; ALL_TAC] THEN + MATCH_MP_TAC MONO_FORALL THEN X_GEN_TAC `e1:real^N->bool` THEN + MATCH_MP_TAC MONO_FORALL THEN X_GEN_TAC `e2:real^N->bool` THEN + MATCH_MP_TAC(TAUT `(p ==> q ==> r) ==> (q ==> p) ==> q ==> r`) THEN + STRIP_TAC THEN DISCH_TAC THEN + SUBGOAL_THEN `e1 = e2 \/ e1 INTER e2 = {} \/ (?v:real^N. e1 INTER e2 = {v})` + MP_TAC THENL + [ALL_TAC; + STRIP_TAC THEN ASM_REWRITE_TAC[INTER_IDEMPOT] THEN + ASM_MESON_TAC[AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING]] THEN + SUBGOAL_THEN `?a b:real^N c d:real^N. e1 = {a,b} /\ e2 = {c,d}` MP_TAC THENL + [ALL_TAC; + DISCH_THEN(REPEAT_TCL CHOOSE_THEN (CONJUNCTS_THEN SUBST_ALL_TAC)) THEN + SET_TAC[]] THEN + FIRST_ASSUM(CONJUNCTS_THEN MP_TAC) THEN + REWRITE_TAC[IN_UNION; IN_ELIM_THM] THEN + SUBGOAL_THEN `!e:real^N->bool. e IN E ==> ?v w. ~(v = w) /\ e = {v,w}` + (LABEL_TAC "*") THENL + [FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [Fan.graph]) THEN + MATCH_MP_TAC MONO_FORALL THEN GEN_TAC THEN + MATCH_MP_TAC MONO_IMP THEN REWRITE_TAC[IN] THEN + CONV_TAC(LAND_CONV HAS_SIZE_CONV) THEN REWRITE_TAC[]; + ASM_MESON_TAC[SET_RULE `{v,v} = {v}`]]);; + +let GMLWKPK_ALT = prove + (`!x:real^N V E. + graph E /\ (!e. e IN E ==> ~(x IN e)) + ==> (fan7(x,V,E) <=> + (!e1 e2. e1 IN E UNION {{v} | v IN V} /\ + e2 IN E UNION {{v} | v IN V} /\ + e1 INTER e2 = {} + ==> aff_ge {x} e1 INTER aff_ge {x} e2 = {x}) /\ + (!e1 e2 v. e1 IN E /\ e2 IN E /\ e1 INTER e2 = {v} + ==> aff_ge {x} e1 INTER aff_ge {x} e2 = + aff_ge {x} {v}))`, + REPEAT STRIP_TAC THEN ASM_SIMP_TAC[GMLWKPK] THEN + EQ_TAC THEN SIMP_TAC[IN_UNION] THEN STRIP_TAC THEN + MATCH_MP_TAC(MESON[] + `(!x y. R x y ==> R y x) /\ + (!x y. P x /\ P y ==> R x y) /\ + (!x y. Q x /\ Q y ==> R x y) /\ + (!x y. P x /\ Q y ==> R x y) + ==> !x y. (P x \/ Q x) /\ (P y \/ Q y) ==> R x y`) THEN + CONJ_TAC THENL [REWRITE_TAC[INTER_ACI]; ASM_SIMP_TAC[]] THEN CONJ_TAC THEN + REWRITE_TAC[IMP_CONJ; RIGHT_FORALL_IMP_THM; FORALL_IN_GSPEC] THENL + [SIMP_TAC[SET_RULE `{a} INTER {b} = {c} <=> a = c /\ b = c`] THEN SET_TAC[]; + X_GEN_TAC `e1:real^N->bool` THEN DISCH_TAC THEN X_GEN_TAC `v:real^N`] THEN + SUBGOAL_THEN `(e1:real^N->bool) HAS_SIZE 2` MP_TAC THENL + [ASM_MESON_TAC[Fan.graph; IN]; CONV_TAC(LAND_CONV HAS_SIZE_CONV)] THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`u:real^N`; `w:real^N`] THEN + STRIP_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + SIMP_TAC[SET_RULE `{a,b} INTER {c} = {d} <=> d = c /\ (a = c \/ b = c)`] THEN + REWRITE_TAC[SET_RULE `s INTER t = t <=> t SUBSET s`] THEN + GEN_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC AFF_GE_MONO_RIGHT THEN ASM SET_TAC[]);; + +let FAN_ECONOMIZED = prove + (`!x:real^N V E. + FAN (x,V,E) <=> + UNIONS E SUBSET V /\ + graph E /\ + fan1 (x,V,E) /\ + fan2 (x,V,E) /\ + fan6 (x,V,E) /\ + (!e1 e2. e1 IN E UNION {{v} | v IN V} /\ + e2 IN E UNION {{v} | v IN V} + ==> (e1 INTER e2 = {} + ==> aff_ge {x} e1 INTER aff_ge {x} e2 = {x}) /\ + (!v. e1 INTER e2 = {v} + ==> aff_ge {x} e1 INTER aff_ge {x} e2 = + aff_ge {x} {v}))`, + REPEAT GEN_TAC THEN REWRITE_TAC[Fan.FAN] THEN + AP_TERM_TAC THEN + MATCH_MP_TAC(TAUT `(p ==> (q <=> r)) ==> (p /\ q <=> p /\ r)`) THEN + DISCH_TAC THEN REPEAT AP_TERM_TAC THEN ASM_SIMP_TAC[GMLWKPK]);; + +let FAN7_AFF_GT_CONDITION = prove + (`!x:real^N V E. + graph E /\ ~(x IN V) /\ (!e. e IN E ==> e SUBSET V /\ ~(x IN e)) /\ + (!v w. v IN V /\ w IN V + ==> aff_ge {x} {v} INTER aff_ge {x} {w} = + aff_ge {x} ({v} INTER {w})) /\ + (!v e. v IN V /\ e IN E + ==> aff_gt {x} {v} INTER aff_gt {x} e = {}) /\ + (!e1 e2. e1 IN E /\ e2 IN E /\ ~(e1 = e2) + ==> aff_gt {x} e1 INTER aff_gt {x} e2 = {}) + ==> fan7(x,V,E)`, + let lemma1 = prove + (`!x v:real^N. ~(v = x) ==> aff_ge {x} {v} = aff_gt {x} {v} UNION {x}`, + REPEAT STRIP_TAC THEN + W(MP_TAC o PART_MATCH (lhs o rand) AFF_GE_AFF_GT_DECOMP o lhand o goal_concl) THEN + REWRITE_TAC[FINITE_INSERT; FINITE_EMPTY] THEN + ANTS_TAC THENL [ASM SET_TAC[]; DISCH_THEN SUBST1_TAC] THEN + REWRITE_TAC[SET_RULE `{f x | x IN {a}} = {f a}`; UNIONS_1] THEN + REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL; SET_RULE `{v} DELETE v = {}`] THEN + REWRITE_TAC[AFFINE_HULL_SING]) + and lemma2 = prove + (`!x v w:real^N. + ~(v = x) /\ ~(w = x) + ==> aff_ge {x} {v,w} = + aff_gt {x} {v,w} UNION aff_ge {x} {v} UNION aff_ge {x} {w}`, + REPEAT STRIP_TAC THEN ASM_CASES_TAC `w:real^N = v` THENL + [ASM_REWRITE_TAC[INSERT_AC; AFF_GT_SUBSET_AFF_GE; SET_RULE + `s = t UNION s UNION s <=> t SUBSET s`]; + W(MP_TAC o PART_MATCH (lhs o rand) AFF_GE_AFF_GT_DECOMP o + lhand o goal_concl) THEN + REWRITE_TAC[FINITE_INSERT; FINITE_EMPTY] THEN + ANTS_TAC THENL [ASM SET_TAC[]; DISCH_THEN SUBST1_TAC] THEN + REWRITE_TAC[SET_RULE `{f x | x IN {a,b}} = {f a,f b}`; UNIONS_2] THEN + ASM_SIMP_TAC[SET_RULE `~(v = w) ==> {v,w} DELETE v = {w}`; + SET_RULE `~(v = w) ==> {v,w} DELETE w = {v}`] THEN + REWRITE_TAC[UNION_ACI]]) + and slemma = prove + (`!P:(A->bool)->(A->bool)->bool. + (!v w. ~(v = w) ==> P {v,w} {v,w}) /\ + (!v w y z. ~(v = w) /\ ~(y = z) /\ {v,w} INTER {y,z} = {} + ==> P {v,w} {y,z}) /\ + (!v w y. ~(v = w) /\ ~(w = y) /\ ~(v = y) ==> P {v,w} {w,y}) + ==> !v w y z. ~(v = w) /\ ~(y = z) ==> P {v,w} {y,z}`, + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `{v:A,w} = {y,z}` THEN ASM_SIMP_TAC[] THEN + ASM_CASES_TAC `{v:A,w} INTER {y,z} = {}` THEN ASM_SIMP_TAC[] THEN + SUBGOAL_THEN `v:A = y \/ v = z \/ w = y \/ w = z` MP_TAC THENL + [ASM SET_TAC[]; ALL_TAC] THEN + DISCH_THEN(REPEAT_TCL DISJ_CASES_THEN SUBST_ALL_TAC) THEN + ASM_MESON_TAC[SET_RULE `{a,b} = {b,a}`]) in + REPEAT STRIP_TAC THEN REWRITE_TAC[Fan.fan7] THEN + SUBGOAL_THEN + `!v:real^N e. v IN V /\ e IN E ==> aff_gt {x} e INTER aff_gt {x} {v} = {}` + ASSUME_TAC THENL [ASM_MESON_TAC[INTER_COMM]; ALL_TAC] THEN + REWRITE_TAC[IN_UNION] THEN MATCH_MP_TAC(MESON[] + `(!e1 e2. R e1 e2 <=> R e2 e1) /\ + (!e1. Q e1 ==> !e2. Q e2 ==> R e1 e2) /\ + (!e1. P e1 ==> (!e2. P e2 ==> R e1 e2) /\ (!e2. Q e2 ==> R e1 e2)) + ==> !e1 e2. (P e1 \/ Q e1) /\ (P e2 \/ Q e2) ==> R e1 e2`) THEN + CONJ_TAC THENL [REWRITE_TAC[INTER_ACI]; ALL_TAC] THEN + ASM_SIMP_TAC[FORALL_IN_GSPEC] THEN X_GEN_TAC `e1:real^N->bool` THEN + DISCH_TAC THEN + SUBGOAL_THEN `(e1:real^N->bool) HAS_SIZE 2` MP_TAC THENL + [ASM_MESON_TAC[Fan.graph; IN]; CONV_TAC(LAND_CONV HAS_SIZE_CONV)] THEN + DISCH_THEN(X_CHOOSE_THEN `v:real^N` (X_CHOOSE_THEN `w:real^N` + (CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC))) THEN + SUBGOAL_THEN `{v:real^N,w} SUBSET V /\ ~(x IN {v,w})` STRIP_ASSUME_TAC THENL + [ASM MESON_TAC[]; ALL_TAC] THEN + CONJ_TAC THENL + [X_GEN_TAC `e2:real^N->bool` THEN DISCH_TAC THEN + SUBGOAL_THEN `(e2:real^N->bool) HAS_SIZE 2` MP_TAC THENL + [ASM_MESON_TAC[Fan.graph; IN]; CONV_TAC(LAND_CONV HAS_SIZE_CONV)] THEN + DISCH_THEN(X_CHOOSE_THEN `y:real^N` (X_CHOOSE_THEN `z:real^N` + (CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC))) THEN + SUBGOAL_THEN `{y:real^N,z} SUBSET V /\ ~(x IN {y,z})` STRIP_ASSUME_TAC THENL + [ASM MESON_TAC[]; ALL_TAC] THEN + MAP_EVERY UNDISCH_TAC + [`{v:real^N, w} IN E`; `{y:real^N, z} IN E`; + `{v:real^N, w} SUBSET V`; `{y:real^N, z} SUBSET V`; + `~((x:real^N) IN {v,w})`; `~((x:real^N) IN {y,z})`; + `~(y:real^N = z)`; `~(v:real^N = w)`] THEN + GEN_REWRITE_TAC I [IMP_IMP] THEN MAP_EVERY (fun t -> SPEC_TAC(t,t)) + [`z:real^N`; `y:real^N`; `w:real^N`; `v:real^N`] THEN + MATCH_MP_TAC slemma THEN + CONJ_TAC THENL [REWRITE_TAC[INTER_IDEMPOT]; ALL_TAC] THEN + REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] THEN + SIMP_TAC[SET_RULE `~(y = v) ==> {v,w} INTER {w,y} = {w}`] THEN + REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; DE_MORGAN_THM] THEN + REWRITE_TAC[SET_RULE + `{a,b} INTER {c,d} = {} <=> + ~(a = c) /\ ~(a = d) /\ ~(b = c) /\ ~(b = d)`] THEN + REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET] THEN REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[lemma2; UNION_OVER_INTER] THEN + REWRITE_TAC[ONCE_REWRITE_RULE[INTER_COMM] UNION_OVER_INTER] THEN + ASM_SIMP_TAC[SET_RULE `~(a = b) ==> {a} INTER {b} = {}`] THEN + ASM_SIMP_TAC[lemma1; UNION_OVER_INTER] THEN + REWRITE_TAC[ONCE_REWRITE_RULE[INTER_COMM] UNION_OVER_INTER] THEN + ASM_SIMP_TAC[SET_RULE `~(v = y) ==> ~({v,w} = {w,y})`; + SET_RULE `~(v = y) /\ ~(v = z) ==> ~({v,w} = {y,z})`] THEN + REWRITE_TAC[UNION_EMPTY; UNION_ASSOC; INTER_IDEMPOT] THEN + ASM_SIMP_TAC[GSYM lemma1] THEN + MATCH_MP_TAC SUBSET_ANTISYM THEN + (CONJ_TAC THENL [REWRITE_TAC[UNION_SUBSET]; SET_TAC[]]) THEN + REWRITE_TAC[SUBSET_REFL] THENL + [REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING] THEN SET_TAC[]; + ALL_TAC] THEN + REPEAT CONJ_TAC THEN TRY(MATCH_MP_TAC AFF_GE_MONO_RIGHT) THEN + ASM_REWRITE_TAC[SET_RULE `DISJOINT {a} {b} <=> ~(a = b)`] THEN + REWRITE_TAC[EMPTY_SUBSET] THEN + MATCH_MP_TAC SUBSET_TRANS THEN EXISTS_TAC `{x:real^N}` THEN + (CONJ_TAC THENL [SET_TAC[]; ALL_TAC]) THEN + GEN_REWRITE_TAC LAND_CONV [GSYM AFFINE_HULL_SING] THEN + REWRITE_TAC[GSYM AFF_GE_EQ_AFFINE_HULL] THEN + MATCH_MP_TAC AFF_GE_MONO_RIGHT THEN ASM SET_TAC[]; + RULE_ASSUM_TAC(REWRITE_RULE[INSERT_SUBSET; EMPTY_SUBSET]) THEN + RULE_ASSUM_TAC(REWRITE_RULE[IN_INSERT; NOT_IN_EMPTY; DE_MORGAN_THM]) THEN + X_GEN_TAC `y:real^N` THEN DISCH_TAC THEN + SUBGOAL_THEN `~(y:real^N = x)` ASSUME_TAC THENL + [ASM_MESON_TAC[]; ALL_TAC] THEN + ASM_SIMP_TAC[lemma2] THEN ASM_SIMP_TAC[SET_RULE + `(s UNION t) INTER u = s INTER u UNION t INTER u`] THEN + ASM_SIMP_TAC[lemma1; UNION_OVER_INTER; UNION_EMPTY] THEN + ASM_CASES_TAC `y:real^N = v` THENL + [ASM_REWRITE_TAC[INTER_IDEMPOT] THEN + SUBGOAL_THEN `{w:real^N} INTER {v} = {} /\ {v,w} INTER {v} = {v}` + (CONJUNCTS_THEN SUBST1_TAC) THENL [ASM SET_TAC[]; ALL_TAC] THEN + MATCH_MP_TAC(SET_RULE + `{x} SUBSET t /\ u SUBSET t ==> (s INTER {x}) UNION t UNION u = t`) THEN + GEN_REWRITE_TAC (LAND_CONV o LAND_CONV) [GSYM AFFINE_HULL_SING] THEN + REWRITE_TAC[GSYM AFF_GE_EQ_AFFINE_HULL] THEN + MATCH_MP_TAC AFF_GE_MONO_RIGHT THEN ASM SET_TAC[]; + ALL_TAC] THEN + ASM_CASES_TAC `y:real^N = w` THENL + [ASM_REWRITE_TAC[INTER_IDEMPOT] THEN + SUBGOAL_THEN `{v:real^N} INTER {w} = {} /\ {v,w} INTER {w} = {w}` + (CONJUNCTS_THEN SUBST1_TAC) THENL [ASM SET_TAC[]; ALL_TAC] THEN + MATCH_MP_TAC(SET_RULE + `{x} SUBSET t /\ t SUBSET u ==> (s INTER {x}) UNION t UNION u = u`) THEN + GEN_REWRITE_TAC (LAND_CONV o LAND_CONV) [GSYM AFFINE_HULL_SING] THEN + REWRITE_TAC[GSYM AFF_GE_EQ_AFFINE_HULL] THEN CONJ_TAC THEN + MATCH_MP_TAC AFF_GE_MONO_RIGHT THEN ASM SET_TAC[]; + ALL_TAC] THEN + SUBGOAL_THEN `{v:real^N} INTER {y} = {} /\ {w} INTER {y} = {} /\ + {v, w} INTER {y} = {}` + (REPEAT_TCL CONJUNCTS_THEN SUBST1_TAC) THENL [ASM SET_TAC[]; ALL_TAC] THEN + MATCH_MP_TAC(SET_RULE + `{x} SUBSET s ==> a INTER {x} UNION s UNION s = s`) THEN + GEN_REWRITE_TAC LAND_CONV [GSYM AFFINE_HULL_SING] THEN + REWRITE_TAC[GSYM AFF_GE_EQ_AFFINE_HULL] THEN + MATCH_MP_TAC AFF_GE_MONO_RIGHT THEN ASM SET_TAC[]]);; + +let FAN_AFF_GT_CONDITION = prove + (`!x:real^N V E. + UNIONS E SUBSET V /\ + graph E /\ + fan1 (x,V,E) /\ + fan2 (x,V,E) /\ + fan6 (x,V,E) /\ + (!v w. v IN V /\ w IN V + ==> aff_ge {x} {v} INTER aff_ge {x} {w} = + aff_ge {x} ({v} INTER {w})) /\ + (!v e. v IN V /\ e IN E + ==> aff_gt {x} {v} INTER aff_gt {x} e = {}) /\ + (!e1 e2. e1 IN E /\ e2 IN E /\ ~(e1 = e2) + ==> aff_gt {x} e1 INTER aff_gt {x} e2 = {}) + ==> FAN (x,V,E)`, + REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[Fan.FAN] THEN + MATCH_MP_TAC FAN7_AFF_GT_CONDITION THEN ASM_REWRITE_TAC[] THEN + RULE_ASSUM_TAC(REWRITE_RULE[Fan.fan2; UNIONS_SUBSET]) THEN + ASM_SIMP_TAC[] THEN ASM SET_TAC[]);; + +let GMLWKPK_SIMPLE = prove + (`!E V x:real^N. + UNIONS E SUBSET V /\ graph E /\ fan6(x,V,E) /\ + (!e. e IN E ==> ~(x IN e)) + ==> (fan7 (x,V,E) <=> + !e1 e2. + e1 IN E UNION {{v} | v IN V} /\ e2 IN E UNION {{v} | v IN V} /\ + e1 INTER e2 = {} + ==> aff_ge {x} e1 INTER aff_ge {x} e2 = {x})`, + let lemma = prove + (`!x u v w:real^N. + ~collinear{x,u,v} /\ ~collinear{x,v,w} + ==> (~(aff_ge {x} {u,v} INTER aff_ge {x} {v,w} = + aff_ge {x} {v}) <=> + u IN aff_ge {x} {v,w} \/ w IN aff_ge {x} {u,v})`, + REPEAT GEN_TAC THEN GEOM_ORIGIN_TAC `x:real^N` THEN + REPEAT GEN_TAC THEN + MAP_EVERY (fun t -> + ASM_CASES_TAC t THENL + [ASM_REWRITE_TAC[COLLINEAR_2; INSERT_AC]; ALL_TAC]) + [`u:real^N = v`; `w:real^N = v`; + `u:real^N = vec 0`; `v:real^N = vec 0`; `w:real^N = vec 0`] THEN + STRIP_TAC THEN EQ_TAC THENL + [DISCH_THEN(MP_TAC o MATCH_MP (SET_RULE + `~(s INTER s' = t) + ==> t SUBSET s /\ t SUBSET s' ==> t PSUBSET s INTER s'`)) THEN + ANTS_TAC THENL + [CONJ_TAC THEN MATCH_MP_TAC AFF_GE_MONO_RIGHT THEN ASM SET_TAC[]; + REWRITE_TAC[PSUBSET_ALT]] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + ASM_SIMP_TAC[AFF_GE_1_2_0; AFF_GE_1_1_0; LEFT_IMP_EXISTS_THM] THEN + REWRITE_TAC[IN_INTER; IMP_CONJ; FORALL_IN_GSPEC] THEN + MAP_EVERY X_GEN_TAC [`a:real`; `b:real`] THEN + DISCH_TAC THEN DISCH_TAC THEN + REWRITE_TAC[IN_ELIM_THM; LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`c:real`; `d:real`] THEN STRIP_TAC THEN + ASM_CASES_TAC `a = &0` THENL + [ASM_MESON_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID]; ALL_TAC] THEN + ASM_CASES_TAC `d = &0` THENL + [ASM_MESON_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID]; ALL_TAC] THEN + DISCH_THEN(K ALL_TAC) THEN DISJ_CASES_TAC + (REAL_ARITH `b <= c \/ c <= b`) + THENL + [FIRST_X_ASSUM(MP_TAC o MATCH_MP (VECTOR_ARITH + `a % u + b % v:real^N = c % v + d % w + ==> a % u = (c - b) % v + d % w`)) THEN + DISCH_THEN(MP_TAC o AP_TERM `(%) (inv a):real^N->real^N`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; VECTOR_MUL_LID] THEN + DISCH_THEN(K ALL_TAC) THEN DISJ1_TAC THEN + REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC] THEN + MAP_EVERY EXISTS_TAC [`inv a * (c - b):real`; `inv a * d:real`] THEN + ASM_SIMP_TAC[REAL_LE_MUL; REAL_LE_INV_EQ; REAL_SUB_LE]; + FIRST_X_ASSUM(MP_TAC o MATCH_MP (VECTOR_ARITH + `a % u + b % v:real^N = c % v + d % w + ==> d % w = (b - c) % v + a % u`)) THEN + DISCH_THEN(MP_TAC o AP_TERM `(%) (inv d):real^N->real^N`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; VECTOR_MUL_LID] THEN + DISCH_THEN(K ALL_TAC) THEN DISJ2_TAC THEN + REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC] THEN + MAP_EVERY EXISTS_TAC [`inv d * a:real`; `inv d * (b - c):real`] THEN + ASM_SIMP_TAC[REAL_LE_MUL; REAL_LE_INV_EQ; REAL_SUB_LE] THEN + REWRITE_TAC[VECTOR_ADD_SYM]]; + STRIP_TAC THEN MATCH_MP_TAC(SET_RULE + `(?x. x IN s /\ x IN t /\ ~(x IN u)) ==> ~(s INTER t = u)`) + THENL + [EXISTS_TAC `u:real^N` THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[AFF_GE_1_2_0; AFF_GE_1_1_0; IN_ELIM_THM] THEN + CONJ_TAC THENL + [MAP_EVERY EXISTS_TAC [`&1`; `&0`] THEN + REWRITE_TAC[REAL_POS] THEN VECTOR_ARITH_TAC; + DISCH_THEN(X_CHOOSE_THEN `a:real` + (CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC)) THEN + UNDISCH_TAC `~collinear{vec 0:real^N,a % v,v}` THEN + REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`] THEN + REWRITE_TAC[COLLINEAR_LEMMA] THEN MESON_TAC[]]; + EXISTS_TAC `w:real^N` THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[AFF_GE_1_2_0; AFF_GE_1_1_0; IN_ELIM_THM] THEN + CONJ_TAC THENL + [MAP_EVERY EXISTS_TAC [`&0`; `&1`] THEN + REWRITE_TAC[REAL_POS] THEN VECTOR_ARITH_TAC; + DISCH_THEN(X_CHOOSE_THEN `a:real` + (CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC)) THEN + UNDISCH_TAC `~collinear{vec 0:real^N,v,a % v}` THEN + REWRITE_TAC[COLLINEAR_LEMMA] THEN MESON_TAC[]]]]) in + REPEAT STRIP_TAC THEN ASM_SIMP_TAC[GMLWKPK] THEN + EQ_TAC THEN SIMP_TAC[] THEN DISCH_TAC THEN + REWRITE_TAC[IN_UNION] THEN MATCH_MP_TAC(MESON[] + `(!x y. R x y ==> R y x) /\ + (!x. Q x ==> !y. Q y ==> R x y) /\ + (!x. P x ==> (!y. Q y ==> R x y) /\ (!y. P y ==> R x y)) + ==> (!x y. (P x \/ Q x) /\ (P y \/ Q y) ==> R x y)`) THEN + CONJ_TAC THENL [SIMP_TAC[INTER_ACI]; ALL_TAC] THEN + REWRITE_TAC[FORALL_IN_GSPEC] THEN CONJ_TAC THENL + [SIMP_TAC[SET_RULE `{a} INTER {b} = {c} <=> c = a /\ b = a`] THEN + REWRITE_TAC[INTER_IDEMPOT]; + ALL_TAC] THEN + X_GEN_TAC `ee1:real^N->bool` THEN DISCH_TAC THEN CONJ_TAC THENL + [X_GEN_TAC `v:real^N` THEN DISCH_TAC THEN + REWRITE_TAC[SET_RULE `s INTER {a} = {b} <=> b = a /\ a IN s`] THEN + SIMP_TAC[IMP_CONJ; FORALL_UNWIND_THM2] THEN DISCH_TAC THEN + REWRITE_TAC[SET_RULE `s INTER t = t <=> t SUBSET s`] THEN + MATCH_MP_TAC AFF_GE_MONO_RIGHT THEN ASM SET_TAC[]; + ALL_TAC] THEN + X_GEN_TAC `ee2:real^N->bool` THEN DISCH_TAC THEN + SUBGOAL_THEN `(ee1:real^N->bool) HAS_SIZE 2` MP_TAC THENL + [ASM_MESON_TAC[Fan.graph; IN]; CONV_TAC(LAND_CONV HAS_SIZE_CONV)] THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`v1:real^N`; `w1:real^N`] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC) THEN + SUBGOAL_THEN `(ee2:real^N->bool) HAS_SIZE 2` MP_TAC THENL + [ASM_MESON_TAC[Fan.graph; IN]; CONV_TAC(LAND_CONV HAS_SIZE_CONV)] THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`v2:real^N`; `w2:real^N`] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC) THEN + ONCE_REWRITE_TAC[SET_RULE + `{a,b} INTER {c,d} = {v} <=> + v = a /\ {a,b} INTER {c,d} = {v} \/ + v = b /\ {a,b} INTER {c,d} = {v}`] THEN + REWRITE_TAC[TAUT + `p /\ q \/ r /\ q ==> t <=> (p ==> q ==> t) /\ (r ==> q ==> t)`] THEN + REWRITE_TAC[FORALL_AND_THM; FORALL_UNWIND_THM2] THEN + MAP_EVERY UNDISCH_TAC [`{v1:real^N,w1} IN E`; `~(v1:real^N = w1)`] THEN + MAP_EVERY (fun s -> SPEC_TAC(s,s)) + [`w1:real^N`; `v1:real^N`] THEN + REWRITE_TAC[IMP_IMP] THEN MATCH_MP_TAC(MESON[] + `(!v w. P v w ==> P w v) /\ + (!v w. R v w ==> Q w v) /\ + (!v w. P v w ==> R v w) + ==> (!v w. P v w ==> Q v w /\ R v w)`) THEN + REPEAT(CONJ_TAC THENL [SIMP_TAC[INSERT_AC]; ALL_TAC]) THEN + MAP_EVERY X_GEN_TAC [`u:real^N`; `v:real^N`] THEN STRIP_TAC THEN + ONCE_REWRITE_TAC[SET_RULE + `{a,b} INTER {c,d} = {v} <=> + v = c /\ {a,b} INTER {c,d} = {v} \/ + v = d /\ {a,b} INTER {c,d} = {v}`] THEN + REWRITE_TAC[TAUT + `p /\ q \/ r /\ q ==> t <=> (p ==> q ==> t) /\ (r ==> q ==> t)`] THEN + MAP_EVERY UNDISCH_TAC [`{v2:real^N,w2} IN E`; `~(v2:real^N = w2)`] THEN + MAP_EVERY (fun s -> SPEC_TAC(s,s)) [`w2:real^N`; `v2:real^N`] THEN + REWRITE_TAC[IMP_IMP] THEN MATCH_MP_TAC(MESON[] + `(!v w. P v w ==> P w v) /\ + (!v w. Q v w ==> R w v) /\ + (!v w. P v w ==> Q v w) + ==> (!v w. P v w ==> Q v w /\ R v w)`) THEN + REPEAT(CONJ_TAC THENL [SIMP_TAC[INSERT_AC]; ALL_TAC]) THEN + MAP_EVERY X_GEN_TAC [`v':real^N`; `w:real^N`] THEN STRIP_TAC THEN + ONCE_REWRITE_TAC[IMP_CONJ] THEN DISCH_THEN(SUBST_ALL_TAC o SYM) THEN + ASM_CASES_TAC `u:real^N = w` THENL [ASM SET_TAC[]; ALL_TAC] THEN + DISCH_TAC THEN W(MP_TAC o PART_MATCH (rand o lhand o rand) lemma o goal_concl) THEN + ANTS_TAC THENL + [REWRITE_TAC[SET_RULE `{x,v,w} = {x} UNION {v,w}`] THEN + ASM_MESON_TAC[Fan.fan6; INSERT_AC]; + ALL_TAC] THEN + MATCH_MP_TAC(TAUT `~q ==> (~p <=> q) ==> p`) THEN + REWRITE_TAC[DE_MORGAN_THM] THEN CONJ_TAC THEN MATCH_MP_TAC(SET_RULE + `aff_ge {x} {v} INTER aff_ge {x} s = {x} /\ + v IN aff_ge {x} {v} /\ ~(v = x) + ==> ~(v IN aff_ge {x} s)`) THEN + REPEAT CONJ_TAC THENL + [FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[IN_UNION] THEN + CONJ_TAC THENL [DISJ2_TAC; ASM SET_TAC[]] THEN + REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC `u:real^N` THEN + REWRITE_TAC[] THEN RULE_ASSUM_TAC(REWRITE_RULE[SUBSET]) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[IN_UNIONS] THEN EXISTS_TAC `{u:real^N,v}` THEN + ASM SET_TAC[]; + SUBGOAL_THEN `DISJOINT {x:real^N} {u:real^N}` ASSUME_TAC THENL + [REWRITE_TAC[SET_RULE `DISJOINT {a} {b} <=> ~(a = b)`] THEN + ASM_MESON_TAC[IN_INSERT]; + ASM_SIMP_TAC[Fan.AFF_GE_1_1; IN_ELIM_THM] THEN + MAP_EVERY EXISTS_TAC [`&0`; `&1`] THEN + REPEAT(CONJ_TAC THENL [REAL_ARITH_TAC; ALL_TAC]) THEN VECTOR_ARITH_TAC]; + ASM_MESON_TAC[IN_INSERT]; + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[IN_UNION] THEN + CONJ_TAC THENL [DISJ2_TAC; ASM SET_TAC[]] THEN + REWRITE_TAC[IN_ELIM_THM] THEN EXISTS_TAC `w:real^N` THEN + REWRITE_TAC[] THEN RULE_ASSUM_TAC(REWRITE_RULE[SUBSET]) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[IN_UNIONS] THEN EXISTS_TAC `{v:real^N,w}` THEN + ASM SET_TAC[]; + SUBGOAL_THEN `DISJOINT {x:real^N} {w:real^N}` ASSUME_TAC THENL + [REWRITE_TAC[SET_RULE `DISJOINT {a} {b} <=> ~(a = b)`] THEN + ASM_MESON_TAC[IN_INSERT]; + ASM_SIMP_TAC[Fan.AFF_GE_1_1; IN_ELIM_THM] THEN + MAP_EVERY EXISTS_TAC [`&0`; `&1`] THEN + REPEAT(CONJ_TAC THENL [REAL_ARITH_TAC; ALL_TAC]) THEN VECTOR_ARITH_TAC]; + ASM_MESON_TAC[IN_INSERT]]);; + +let FAN_ECONOMIZED_SIMPLE = prove + (`!x:real^N V E. + FAN (x,V,E) <=> + UNIONS E SUBSET V /\ + graph E /\ + fan1 (x,V,E) /\ + fan2 (x,V,E) /\ + fan6 (x,V,E) /\ + (!e1 e2. e1 IN E UNION {{v} | v IN V} /\ e2 IN E UNION {{v} | v IN V} /\ + e1 INTER e2 = {} + ==> aff_ge {x} e1 INTER aff_ge {x} e2 = {x})`, + REPEAT GEN_TAC THEN REWRITE_TAC[Fan.FAN] THEN + REWRITE_TAC[CONJ_ASSOC] THEN + MATCH_MP_TAC(TAUT `(p ==> (q <=> r)) ==> (p /\ q <=> p /\ r)`) THEN + REWRITE_TAC[GSYM CONJ_ASSOC] THEN + STRIP_TAC THEN MATCH_MP_TAC GMLWKPK_SIMPLE THEN + ASM_REWRITE_TAC[] THEN X_GEN_TAC `e:real^N->bool` THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `e:real^N->bool` o + GEN_REWRITE_RULE I [Fan.fan6]) THEN + ASM_REWRITE_TAC[CONTRAPOS_THM] THEN DISCH_TAC THEN + ASM_SIMP_TAC[SET_RULE `x IN u ==> {x} UNION u = u`] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [Fan.GRAPH]) THEN + DISCH_THEN(MP_TAC o SPEC `e:real^N->bool`) THEN ASM_REWRITE_TAC[] THEN + CONV_TAC(LAND_CONV HAS_SIZE_CONV) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[COLLINEAR_2]);; + +(* ------------------------------------------------------------------------- *) +(* Definition of the polar fan. *) +(* ------------------------------------------------------------------------- *) + +let JNVXCRC = new_definition + `polar_fan(V,(E:(real^3->bool)->bool),FF) = + let r = rho_node1 FF in + let prime = \v. v cross (r v) in + ({ prime v | v IN V}, + { {prime v,prime(r v)} | v IN V}, + { (prime v,prime(r v)) | v IN V})`;; + +(* ------------------------------------------------------------------------- *) +(* Properties of the polar fan. *) +(* ------------------------------------------------------------------------- *) + +let BGMIFTE = prove + (`!V E FF V' E' FF'. + convex_local_fan(V,E,FF) /\ generic V E /\ + (!v. v IN V ==> interior_angle1 (vec 0) FF v < pi) /\ + (V',E',FF') = polar_fan (V,E,FF) + ==> convex_local_fan(V',E',FF') /\ + generic V' E' /\ + CARD V' = CARD V /\ + let r = rho_node1 FF in + let prime = \v. v cross (r v) in + (!v. v IN V + ==> arcV (vec 0) (prime v) (prime(r v)) = + pi - interior_angle1 (vec 0) FF (r v) /\ + &0 < arcV (vec 0) (prime v) (prime(r v)) /\ + arcV (vec 0) (prime v) (prime(r v)) < pi) /\ + (!v. v IN V + ==> arcV (vec 0) v (r v) = + pi - interior_angle1 (vec 0) FF' (prime v) /\ + &0 < arcV (vec 0) v (r v) /\ + arcV (vec 0) v (r v) < pi)`, + let lemma1 = prove + (`((v0 cross v1) cross (v1 cross v2)) dot (w0 cross w1) = + ((v1 cross v2) dot v0) * ((w0 cross w1) dot v1)`, + VEC3_TAC) + and lemma2 = prove + (`(v cross v') cross (w cross w') = + ((w cross w') dot v) % v' - ((w cross w') dot v') % v`, + VEC3_TAC) + and lemma3 = prove + (`a % v:real^N = b % w ==> a = &0 /\ b = &0 \/ collinear{vec 0,w,v}`, + ASM_CASES_TAC `a = &0` THEN ASM_CASES_TAC `b = &0` THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_MUL_EQ_0; VECTOR_ARITH + `vec 0:real^N = a % b <=> a % b = vec 0`] THEN + TRY(SIMP_TAC[INSERT_AC; COLLINEAR_2] THEN NO_TAC) THEN + REWRITE_TAC[COLLINEAR_LEMMA] THEN + DISCH_THEN(MP_TAC o AP_TERM `(%) (inv a) :real^N->real^N`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; VECTOR_MUL_LID] THEN + MESON_TAC[]) + and lemma4 = prove + (`(v1 cross v2) cross (v0 cross v1) = --(((v0 cross v1) dot v2) % v1)`, + VEC3_TAC) + and lemma5 = prove + (`(v0 cross v1) cross (v1 cross v2) = ((v0 cross v1) dot v2) % v1`, + VEC3_TAC) + and lemma6 = prove + (`(x cross y) dot z = (z cross x) dot y`, + VEC3_TAC) + and lemma7 = prove + (`!a b c d:real^N. + ~(aff_gt {a,b,c} {d} INTER affine hull {a,b,c} = {}) + ==> d IN affine hull {a,b,c}`, + REPEAT GEN_TAC THEN DISJ_CASES_TAC + (SET_RULE `(d:real^N) IN {a,b,c} \/ DISJOINT {a,b,c} {d}`) THEN + ASM_SIMP_TAC[HULL_INC] THEN ASM_SIMP_TAC[AFF_GT_3_1; AFFINE_HULL_3] THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY; IN_INTER] THEN + ONCE_REWRITE_TAC[CONJ_SYM] THEN REWRITE_TAC[EXISTS_IN_GSPEC] THEN + REWRITE_TAC[IN_ELIM_THM; RIGHT_AND_EXISTS_THM; LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`xa:real`; `xb:real`; `xc:real`; + `ya:real`; `yb:real`; `yc:real`; `u:real`] THEN + REPEAT(DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + REWRITE_TAC[VECTOR_ARITH + `xa % a + xb % b + xc % c :real^N = ya % a + yb % b + yc % c + d <=> + d = (xa - ya) % a + (xb - yb) % b + (xc - yc) % c`] THEN + DISCH_TAC THEN + MAP_EVERY EXISTS_TAC + [`(xa - ya) / u:real`; `(xb - yb) / u:real`; `(xc - yc) / u:real`] THEN + ASM_SIMP_TAC[REAL_FIELD + `&0 < u ==> (a / u + b / u + c / u = &1 <=> a + b + c = u)`] THEN + CONJ_TAC THENL [ASM_REAL_ARITH_TAC; ALL_TAC] THEN + FIRST_X_ASSUM(MP_TAC o AP_TERM `(%) (inv u) :real^N->real^N`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_LT_IMP_NZ; REAL_MUL_LINV] THEN + REWRITE_TAC[VECTOR_MUL_LID] THEN DISCH_THEN SUBST1_TAC THEN + VECTOR_ARITH_TAC) in + REPEAT GEN_TAC THEN STRIP_TAC THEN REPEAT LET_TAC THEN + FIRST_ASSUM(STRIP_ASSUME_TAC o GEN_REWRITE_RULE I + [Wrgcvdr_cizmrrh.convex_local_fan]) THEN + SUBGOAL_THEN `!v. v IN V ==> ~((prime:real^3->real^3) v = vec 0)` + ASSUME_TAC THENL + [GEN_TAC THEN STRIP_TAC THEN + EXPAND_TAC "prime" THEN REWRITE_TAC[CROSS_EQ_0] THEN + EXPAND_TAC "r" THEN + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE]; + ALL_TAC] THEN + SUBGOAL_THEN + `!v w. v IN V /\ w IN V /\ ~(v = w) + ==> ~collinear{vec 0,(prime:real^3->real^3) v,prime w}` + ASSUME_TAC THENL + [REPEAT GEN_TAC THEN STRIP_TAC THEN + REWRITE_TAC[GSYM CROSS_EQ_0] THEN EXPAND_TAC "prime" THEN + REWRITE_TAC[lemma2; VECTOR_SUB_EQ] THEN + DISCH_THEN(MP_TAC o MATCH_MP lemma3) THEN + REWRITE_TAC[DE_MORGAN_THM] THEN CONJ_TAC THENL + [ALL_TAC; + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE]] THEN + SUBGOAL_THEN `~(v:real^3 = r w /\ w = r v)` MP_TAC THENL + [EXPAND_TAC "r" THEN + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE]; + REWRITE_TAC[DE_MORGAN_THM] THEN MATCH_MP_TAC MONO_OR THEN + CONJ_TAC THEN DISCH_TAC THEN MATCH_MP_TAC REAL_LT_IMP_NZ THEN + REWRITE_TAC[GSYM Local_lemmas.SIN_AZIM_MUTUAL_SROSS] THEN + EXPAND_TAC "r" THEN MATCH_MP_TAC GENERIC_LOCAL_FAN_AZIM_POS THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `E:(real^3->bool)->bool`] THEN + ASM_REWRITE_TAC[] THEN EXPAND_TAC "r" THEN + ASM_MESON_TAC[RHO_NODE1_INJECTIVE; + Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]]; + ALL_TAC] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE RAND_CONV [JNVXCRC]) THEN + ASM_REWRITE_TAC[] THEN CONV_TAC(ONCE_DEPTH_CONV let_CONV) THEN + ASM_REWRITE_TAC[] THEN CONV_TAC(ONCE_DEPTH_CONV let_CONV) THEN + REWRITE_TAC[PAIR_EQ] THEN DISCH_THEN(STRIP_ASSUME_TAC o GSYM) THEN + SUBGOAL_THEN + `!v w. v IN V /\ w IN V + ==> ((prime:real^3->real^3) v = prime w <=> v = w)` + ASSUME_TAC THENL [ASM_MESON_TAC[COLLINEAR_2; INSERT_AC]; ALL_TAC] THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP Local_lemmas.LOCAL_FAN_FINITE_V) THEN + SUBGOAL_THEN `CARD(V':real^3->bool) = CARD(V:real^3->bool)` ASSUME_TAC THENL + [EXPAND_TAC "V'" THEN REWRITE_TAC[SIMPLE_IMAGE] THEN + MATCH_MP_TAC CARD_IMAGE_INJ THEN ASM_MESON_TAC[]; + ASM_REWRITE_TAC[]] THEN + SUBGOAL_THEN + `!v w:real^3. v IN V /\ w IN V /\ ~(w = v) /\ ~(w = r v) + ==> &0 < sin(azim (vec 0) (prime v) (prime(r v)) (prime w))` + ASSUME_TAC THENL + [REPEAT STRIP_TAC THEN REWRITE_TAC[Local_lemmas.SIN_AZIM_MUTUAL_SROSS] THEN + EXPAND_TAC "prime" THEN REWRITE_TAC[lemma1] THEN + MATCH_MP_TAC REAL_LT_MUL THEN + REWRITE_TAC[GSYM Local_lemmas.SIN_AZIM_MUTUAL_SROSS] THEN CONJ_TAC THENL + [FIRST_ASSUM(MP_TAC o SPEC `(r:real^3->real^3) v` o + MATCH_MP Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM_IVS) THEN + ASM_REWRITE_TAC[] THEN ANTS_TAC THENL + [EXPAND_TAC "r" THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]; + ALL_TAC] THEN + MATCH_MP_TAC(MESON[] `(c' = c /\ d = d') /\ &0 < sin i + ==> i = azim a b c d ==> &0 < sin(azim a b c' d')`) THEN + REWRITE_TAC[] THEN CONJ_TAC THENL + [EXPAND_TAC "r" THEN MATCH_MP_TAC Local_lemmas.IVS_RHO_IDD THEN + ASM_MESON_TAC[]; + MATCH_MP_TAC SIN_POS_PI THEN EXPAND_TAC "r" THEN + ASM_MESON_TAC[Local_lemmas.INTERIOR_ANGLE1_POS; + Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]]; + EXPAND_TAC "r" THEN MATCH_MP_TAC GENERIC_LOCAL_FAN_AZIM_POS THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `E:(real^3->bool)->bool`] THEN + ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[RHO_NODE1_INJECTIVE; + Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]]; + ALL_TAC] THEN + SUBGOAL_THEN + `!v w:real^3. v IN V /\ w IN V /\ ~(w = v) /\ ~(w = r v) + ==> &0 < azim (vec 0) (prime v) (prime(r v)) (prime w) /\ + azim (vec 0) (prime v) (prime(r v)) (prime w) < pi` + ASSUME_TAC THENL + [REPEAT GEN_TAC THEN STRIP_TAC THEN MATCH_MP_TAC SIN_POS_PI_REV THEN + ASM_SIMP_TAC[azim; REAL_LT_IMP_LE]; + ALL_TAC] THEN + ONCE_REWRITE_TAC[TAUT `p /\ q /\ r /\ s <=> r /\ s /\ p /\ q`] THEN + CONJ_TAC THENL + [X_GEN_TAC `v:real^3` THEN DISCH_TAC THEN + MP_TAC(ISPECL + [`vec 0:real^3`; `(r:real^3->real^3) v`; `v:real^3`; + `(r:real^3->real^3) (r v)`] + Hvihvec.HVIHVEC) THEN + CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN + REWRITE_TAC[VECTOR_SUB_RZERO] THEN ANTS_TAC THENL + [EXPAND_TAC "r" THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IMP_V_DIFF; + Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]; + ALL_TAC] THEN + EXPAND_TAC "prime" THEN + SUBST1_TAC(ISPECL [`v:real^3`; `(r:real^3->real^3) v`] CROSS_SKEW) THEN + REWRITE_TAC[ARCV_ANGLE; angle; VECTOR_SUB_RZERO; VECTOR_ANGLE_LNEG] THEN + DISCH_THEN(SUBST1_TAC o SYM) THEN MATCH_MP_TAC(REAL_ARITH + `x = y /\ &0 < x /\ x < pi + ==> pi - x = pi - y /\ &0 < pi - x /\ pi - x < pi`) THEN + FIRST_ASSUM(MP_TAC o SPEC `(r:real^3->real^3) v` o + MATCH_MP Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM_IVS) THEN + ANTS_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]; ALL_TAC] THEN + MATCH_MP_TAC(REAL_ARITH + `&0 < i /\ i < pi /\ + (&0 < a /\ a < pi ==> d = a) + ==> i = a ==> d = i /\ &0 < d /\ d < pi`) THEN + REPEAT(CONJ_TAC THENL + [ASM_MESON_TAC[Local_lemmas.INTERIOR_ANGLE1_POS; + Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]; + ALL_TAC]) THEN + SUBGOAL_THEN `ivs_rho_node1 FF (r v) = v` SUBST1_TAC THENL + [ASM_MESON_TAC[Local_lemmas.IVS_RHO_IDD]; ALL_TAC] THEN + ONCE_REWRITE_TAC[DIHV_SYM] THEN ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN CONV_TAC SYM_CONV THEN MATCH_MP_TAC AZIM_DIHV_SAME THEN + ASM_REWRITE_TAC[] THEN + GEN_REWRITE_TAC (funpow 3 RAND_CONV) [SET_RULE `{a,c,b} = {a,b,c}`] THEN + EXPAND_TAC "r" THEN + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2; + Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]; + ALL_TAC] THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP Local_lemmas.LOFA_V_NOT_EMP) THEN + SUBGOAL_THEN + `!v w. v IN V /\ w IN V /\ + ~(w = v) /\ ~(w = r v) /\ ~(w = ivs_rho_node1 FF v) + ==> &0 < azim (vec 0) (prime v) (prime (r v)) (prime w) /\ + azim (vec 0) (prime v) (prime (r v)) (prime w) < + azim (vec 0) (prime v) (prime (r v)) + (prime (ivs_rho_node1 FF v))` + ASSUME_TAC THENL + [REPEAT STRIP_TAC THEN ASM_SIMP_TAC[] THEN + SUBGOAL_THEN + `~(prime w = prime v) /\ + ~(prime w = prime(r v)) /\ + ~(prime w:real^3 = prime(ivs_rho_node1 FF v))` + STRIP_ASSUME_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + IVS_RHO_NODE1_IN_V]; + ALL_TAC] THEN + MP_TAC(ISPECL [`vec 0:real^3`; `(prime:real^3->real^3) v`; + `prime(r(v:real^3):real^3):real^3`; + `(prime:real^3->real^3) w`; + `(prime:real^3->real^3) (ivs_rho_node1 FF v)`] + Fan.sum3_azim_fan) THEN + ANTS_TAC THENL + [CONJ_TAC THENL + [MATCH_MP_TAC(REAL_ARITH + `(&0 < x /\ x < pi) /\ (&0 < y /\ y < pi) ==> x + y < &2 * pi`) THEN + ASM_SIMP_TAC[]; + REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE; + IVS_RHO_NODE1_IN_V; Tecoxbm.RHO_IVS_IDD; + Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]]; + DISCH_THEN SUBST1_TAC THEN REWRITE_TAC[REAL_LT_ADDR] THEN + MATCH_MP_TAC(REAL_ARITH `&0 < x /\ x < pi ==> &0 < x`)] THEN + MATCH_MP_TAC SIN_POS_PI_REV THEN + SIMP_TAC[azim; REAL_LT_IMP_LE] THEN + REWRITE_TAC[Local_lemmas.SIN_AZIM_MUTUAL_SROSS] THEN + ONCE_REWRITE_TAC[lemma6] THEN + REWRITE_TAC[GSYM Local_lemmas.SIN_AZIM_MUTUAL_SROSS] THEN + ABBREV_TAC `u = ivs_rho_node1 FF v` THEN + (SUBGOAL_THEN `v = (r:real^3->real^3) u` ASSUME_TAC THENL + [ASM_MESON_TAC[Tecoxbm.RHO_IVS_IDD; IVS_RHO_NODE1_IN_V]; ALL_TAC]) THEN + ASM_REWRITE_TAC[] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_MESON_TAC[IVS_RHO_NODE1_IN_V]; + ALL_TAC] THEN + SUBGOAL_THEN + `!v. v IN V + ==> arcV (vec 0) v (r v) = + pi - azim (vec 0) (prime v) + (prime(r v)) (prime(ivs_rho_node1 FF v)) /\ + &0 < arcV (vec 0) v (r v) /\ + arcV (vec 0) v (r v) < pi` + ASSUME_TAC THENL + [X_GEN_TAC `v:real^3` THEN DISCH_TAC THEN + MATCH_MP_TAC(REAL_ARITH + `!d. (&0 < a /\ a < pi) /\ + (&0 < a /\ a < pi ==> d = a) /\ + d = pi - v + ==> v = pi - a /\ &0 < v /\ v < pi`) THEN + EXISTS_TAC `dihV (vec 0:real^3) (prime v) (prime (r v)) + (prime (ivs_rho_node1 FF v))` THEN + CONJ_TAC THENL + [FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE; + Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE; + IVS_RHO_NODE1_IN_V; Tecoxbm.RHO_IVS_IDD]; + ALL_TAC] THEN + CONJ_TAC THENL + [STRIP_TAC THEN CONV_TAC SYM_CONV THEN MATCH_MP_TAC AZIM_DIHV_SAME THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE; + Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE; + IVS_RHO_NODE1_IN_V; Tecoxbm.RHO_IVS_IDD]; + ALL_TAC] THEN + W(MP_TAC o PART_MATCH (lhs o rand) Hvihvec.HVIHVEC o lhand o goal_concl) THEN + ANTS_TAC THENL [ASM_MESON_TAC[]; DISCH_THEN SUBST1_TAC] THEN + REWRITE_TAC[VECTOR_SUB_RZERO] THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN + EXPAND_TAC "prime" THEN + SUBGOAL_THEN `r (ivs_rho_node1 FF v) = v` SUBST1_TAC THENL + [ASM_MESON_TAC[Tecoxbm.RHO_IVS_IDD]; ALL_TAC] THEN + ONCE_REWRITE_TAC[VECTOR_ANGLE_SYM] THEN + REWRITE_TAC[lemma4; lemma5; VECTOR_ANGLE_LNEG] THEN AP_TERM_TAC THEN + SUBGOAL_THEN + `&0 < (ivs_rho_node1 FF v cross v) dot r v /\ + &0 < ((v cross r v) dot r (r v))` + STRIP_ASSUME_TAC THENL + [REWRITE_TAC[GSYM Local_lemmas.SIN_AZIM_MUTUAL_SROSS] THEN CONJ_TAC THENL + [ABBREV_TAC `w = ivs_rho_node1 FF v` THEN + SUBGOAL_THEN `(w:real^3) IN V` ASSUME_TAC THENL + [ASM_MESON_TAC[IVS_RHO_NODE1_IN_V]; ALL_TAC] THEN + SUBGOAL_THEN `v = (r:real^3->real^3) w` SUBST1_TAC THENL + [ASM_MESON_TAC[Tecoxbm.RHO_IVS_IDD]; ALL_TAC]; + ALL_TAC] THEN + EXPAND_TAC "r" THEN MATCH_MP_TAC GENERIC_LOCAL_FAN_AZIM_POS THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `E:(real^3->bool)->bool`] THEN + ASM_REWRITE_TAC[] THEN EXPAND_TAC "r" THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE; + Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE]; + REWRITE_TAC[ARCV_ANGLE; angle; VECTOR_SUB_RZERO] THEN + REWRITE_TAC[VECTOR_ANGLE_LMUL; VECTOR_ANGLE_RMUL] THEN + REPEAT(COND_CASES_TAC THEN ASM_REWRITE_TAC[]) THEN ASM_REAL_ARITH_TAC]; + ALL_TAC] THEN + SUBGOAL_THEN `FAN(vec 0:real^3,V',E')` ASSUME_TAC THENL + [MATCH_MP_TAC FAN_AFF_GT_CONDITION THEN + REPLICATE_TAC 4 (GEN_REWRITE_TAC I [CONJ_ASSOC]) THEN CONJ_TAC THENL + [REWRITE_TAC[Fan.fan1; Fan.fan2; Fan.fan6; Polyhedron.GRAPH; + UNIONS_SUBSET] THEN + MAP_EVERY EXPAND_TAC ["V'"; "E'"] THEN REWRITE_TAC[FORALL_IN_GSPEC] THEN + REPEAT CONJ_TAC THENL + [REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_ELIM_THM] THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]; + X_GEN_TAC `v:real^3` THEN DISCH_TAC THEN + REWRITE_TAC[HAS_SIZE_2_EXISTS] THEN MAP_EVERY EXISTS_TAC + [`(prime:real^3->real^3) (v:real^3)`; + `(prime:real^3->real^3) ((r:real^3->real^3) v)`] THEN + CONJ_TAC THENL [ALL_TAC; ASM SET_TAC[]] THEN + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE; + Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]; + ONCE_REWRITE_TAC[SIMPLE_IMAGE] THEN MATCH_MP_TAC FINITE_IMAGE THEN + ASM_REWRITE_TAC[]; + UNDISCH_TAC `~(V:real^3->bool = {})` THEN SET_TAC[]; + ASM SET_TAC[]; + X_GEN_TAC `v:real^3` THEN DISCH_TAC THEN + REWRITE_TAC[SET_RULE `{a} UNION {b,c} = {a,b,c}`] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE; + Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]]; + ALL_TAC] THEN + REWRITE_TAC[IMP_CONJ; RIGHT_FORALL_IMP_THM] THEN + MAP_EVERY EXPAND_TAC ["V'"; "E'"] THEN REWRITE_TAC[FORALL_IN_GSPEC] THEN + REWRITE_TAC[IMP_IMP; RIGHT_IMP_FORALL_THM] THEN CONJ_TAC THENL + [MAP_EVERY X_GEN_TAC [`v:real^3`; `w:real^3`] THEN STRIP_TAC THEN + ASM_CASES_TAC `w:real^3 = v` THEN ASM_REWRITE_TAC[INTER_IDEMPOT] THEN + ASM_SIMP_TAC[SET_RULE `~(x = y) ==> {x} INTER {y} = {}`] THEN + MATCH_MP_TAC SUBSET_ANTISYM THEN CONJ_TAC THENL + [REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING] THEN + MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `(affine hull ({vec 0:real^3} UNION {prime v})) INTER + (affine hull ({vec 0} UNION {prime(w:real^3)}))` THEN + SIMP_TAC[AFF_GE_SUBSET_AFFINE_HULL; SET_RULE + `s SUBSET s' /\ t SUBSET t' ==> s INTER t SUBSET s' INTER t'`] THEN + W(MP_TAC o PART_MATCH (lhs o rand) AFFINE_HULL_INTER o + lhand o goal_concl) THEN + REWRITE_TAC[SET_RULE + `({z} UNION {a}) UNION ({z} UNION {b}) = {z,a,b}`] THEN + ANTS_TAC THENL + [DISCH_THEN(MP_TAC o MATCH_MP AFFINE_DEPENDENT_IMP_COLLINEAR_3) THEN + ASM_SIMP_TAC[]; + DISCH_THEN SUBST1_TAC] THEN + SUBGOAL_THEN + `({vec 0} UNION {(prime:real^3->real^3) v}) INTER + ({vec 0} UNION {prime w}) = {vec 0}` + (fun th -> SIMP_TAC[th; AFFINE_HULL_SING; SUBSET_REFL]) THEN + ASM SET_TAC[]; + REWRITE_TAC[SUBSET_INTER] THEN CONJ_TAC THEN + MATCH_MP_TAC AFF_GE_MONO_RIGHT THEN ASM SET_TAC[]]; + ALL_TAC] THEN + MATCH_MP_TAC(SET_RULE + `(!a b. P a /\ P b /\ f a = f b ==> a = b) /\ + (!a b. R a b ==> R b a) /\ + Q /\ (!a b. P a /\ P b /\ ~({f a,g a} = {f b,g b}) /\ + ~(b = a) /\ ~(f b = f a) /\ ~(f b = g a) + ==> R a b) + ==> Q /\ !a b. (P a /\ P b) /\ ~({f a,g a} = {f b,g b}) ==> R a b`) THEN + CONJ_TAC THENL [ASM_MESON_TAC[]; ALL_TAC] THEN + CONJ_TAC THENL [SIMP_TAC[INTER_COMM]; ALL_TAC] THEN + GEN_REWRITE_TAC LAND_CONV [SWAP_FORALL_THM] THEN + GEN_REWRITE_TAC I [CONJ_SYM] THEN + GEN_REWRITE_TAC I [AND_FORALL_THM] THEN X_GEN_TAC `v:real^3` THEN + ASM_CASES_TAC `(v:real^3) IN V` THEN ASM_REWRITE_TAC[] THEN + GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [INTER_COMM] THEN + SUBGOAL_THEN + `aff_gt {vec 0} {(prime:real^3->real^3) v, prime (r v)} SUBSET + affine hull {vec 0, prime v,prime(r v)}` + ASSUME_TAC THENL + [MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `aff_ge {vec 0} {(prime:real^3->real^3) v, prime (r v)}` THEN + REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] THEN + REWRITE_TAC[GSYM AFF_GE_EQ_AFFINE_HULL; aff_ge_def] THEN + MATCH_MP_TAC AFFSIGN_MONO_SHUFFLE THEN SET_TAC[]; + ALL_TAC] THEN + SUBGOAL_THEN + `aff_gt {vec 0,prime v, prime (r v)} {prime(ivs_rho_node1 FF v)} INTER + affine hull {vec 0, (prime:real^3->real^3) v,prime(r v)} = {}` + ASSUME_TAC THENL + [GEN_REWRITE_TAC I [TAUT `p <=> ~ ~ p`] THEN + DISCH_THEN(ASSUME_TAC o MATCH_MP lemma7) THEN + SUBGOAL_THEN + `coplanar {vec 0,(prime:real^3->real^3) v, prime (r v), + prime(ivs_rho_node1 FF v)}` + MP_TAC THENL + [MATCH_MP_TAC(MESON[coplanar] + `{a,b,c,d} SUBSET affine hull {a,b,c} ==> coplanar {a,b,c,d}`) THEN + ASM_SIMP_TAC[INSERT_SUBSET; HULL_INC; IN_INSERT; EMPTY_SUBSET]; + ALL_TAC] THEN + W(MP_TAC o PART_MATCH (rhs o rand) AZIM_EQ_0_PI_EQ_COPLANAR o + lhand o goal_concl) THEN + ANTS_TAC THENL + [CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC; + DISCH_THEN(SUBST1_TAC o SYM) THEN + MATCH_MP_TAC(REAL_ARITH + `&0 < x /\ x < pi ==> x = &0 \/ x = pi ==> F`) THEN + FIRST_X_ASSUM MATCH_MP_TAC] THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + IVS_RHO_NODE1_IN_V; Tecoxbm.RHO_IVS_IDD; + Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE; + Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE]; + ALL_TAC] THEN + SUBGOAL_THEN + `!w z. {w,z} SUBSET + aff_gt {vec 0,prime v, prime (r v)} {prime(ivs_rho_node1 FF v)} + ==> aff_gt {vec 0} {(prime:real^3->real^3) v, prime (r v)} INTER + aff_gt {vec 0} {w,z} = {}` + ASSUME_TAC THENL + [REPEAT GEN_TAC THEN + FIRST_ASSUM(MATCH_MP_TAC o MATCH_MP(SET_RULE + `t SUBSET a + ==> ap INTER a = {} /\ + (s SUBSET ap ==> aff_gt {vec 0} s SUBSET ap) + ==> s SUBSET ap ==> t INTER aff_gt {vec 0} s = {}`)) THEN + MATCH_MP_TAC(TAUT `p /\ (p ==> q) ==> p /\ q`) THEN + CONJ_TAC THENL [FIRST_ASSUM ACCEPT_TAC; ALL_TAC] THEN + MATCH_MP_TAC(SET_RULE + `!z. z IN a /\ (DISJOINT {z} p /\ p SUBSET g ==> q SUBSET g) + ==> g INTER a = {} ==> p SUBSET g ==> q SUBSET g`) THEN + EXISTS_TAC `vec 0:real^3` THEN + SIMP_TAC[HULL_INC; IN_INSERT; AFF_GT_1_2] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + W(MP_TAC o PART_MATCH (lhs o rand) AFF_GT_3_1 o rand o lhand o goal_concl) THEN + ANTS_TAC THENL + [REWRITE_TAC[SET_RULE + `DISJOINT {a,b,c} {d} <=> ~(d = a) /\ ~(d = b) /\ ~(d = c)`] THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + IVS_RHO_NODE1_IN_V; Tecoxbm.RHO_IVS_IDD; + Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE; + Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE]; + REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + REWRITE_TAC[TAUT `p /\ t = &1 /\ q <=> t = &1 /\ p /\ q`] THEN + REWRITE_TAC[REAL_ARITH `t + s = &1 <=> t = &1 - s`] THEN + ONCE_REWRITE_TAC[MESON[] + `(?a b c d. P a b c d) <=> (?d b c a. P a b c d)`] THEN + REWRITE_TAC[UNWIND_THM2] THEN + ONCE_REWRITE_TAC[MESON[] + `(?a b c. P a b c) <=> (?b c a. P a b c)`] THEN + REWRITE_TAC[UNWIND_THM2] THEN DISCH_THEN SUBST1_TAC THEN + REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET] THEN + REWRITE_TAC[SUBSET; IN_ELIM_THM; LEFT_AND_EXISTS_THM] THEN + REWRITE_TAC[RIGHT_AND_EXISTS_THM; LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`x1:real`; `x2:real`; `x3:real`] THEN + MAP_EVERY X_GEN_TAC [`y1:real`; `y2:real`; `y3:real`] THEN + STRIP_TAC THEN MAP_EVERY X_GEN_TAC + [`p:real^3`; `z1:real`; `z2:real`] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + EXISTS_TAC `z1 * x1 + z2 * y1:real` THEN + EXISTS_TAC `z1 * x2 + z2 * y2:real` THEN + EXISTS_TAC `z1 * x3 + z2 * y3:real` THEN + ASM_SIMP_TAC[REAL_LT_MUL; REAL_LT_ADD] THEN VECTOR_ARITH_TAC]; + ALL_TAC] THEN + SUBGOAL_THEN + `!w. w IN V /\ ~(w = v) /\ ~(w = r v) + ==> prime w IN aff_gt {vec 0, prime v, prime(r v)} + {(prime:real^3->real^3)(ivs_rho_node1 FF v)}` + ASSUME_TAC THENL + [REPEAT STRIP_TAC THEN ASM_CASES_TAC `w = ivs_rho_node1 FF v` THENL + [W(MP_TAC o PART_MATCH (lhs o rand) AFF_GT_3_1 o rand o goal_concl) THEN + ANTS_TAC THENL + [REWRITE_TAC[SET_RULE + `DISJOINT {a,b,c} {d} <=> ~(d = a) /\ ~(d = b) /\ ~(d = c)`] THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + IVS_RHO_NODE1_IN_V; Tecoxbm.RHO_IVS_IDD; + Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE; + Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE]; + DISCH_THEN SUBST1_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN + MAP_EVERY EXISTS_TAC [`&0`; `&0`; `&0`; `&1`] THEN + CONV_TAC REAL_RAT_REDUCE_CONV THEN VECTOR_ARITH_TAC]; + ALL_TAC] THEN + SUBGOAL_THEN + `~(prime w = prime v) /\ + ~(prime w = prime(r v)) /\ + ~(prime w:real^3 = prime(ivs_rho_node1 FF v))` + STRIP_ASSUME_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + IVS_RHO_NODE1_IN_V]; + ALL_TAC] THEN + MP_TAC(ISPECL + [`vec 0:real^3`; + `(prime:real^3->real^3) v`; + `(prime:real^3->real^3) (r(v:real^3))`; + `(prime:real^3->real^3) (ivs_rho_node1 FF v)`] + WEDGE_LUNE_GT) THEN + REWRITE_TAC[wedge] THEN ANTS_TAC THENL + [REPEAT(FIRST_ASSUM MATCH_MP_TAC ORELSE CONJ_TAC) THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + IVS_RHO_NODE1_IN_V; Tecoxbm.RHO_IVS_IDD; + Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE; + Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE]; + ALL_TAC] THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN + DISCH_THEN(MP_TAC o SPEC `(prime:real^3->real^3) w`) THEN + MATCH_MP_TAC(TAUT `(q ==> r) /\ p ==> (p <=> q) ==> r`) THEN + REPEAT CONJ_TAC THENL + [MATCH_MP_TAC(SET_RULE `s SUBSET t ==> x IN s ==> x IN t`) THEN + REWRITE_TAC[aff_gt_def] THEN MATCH_MP_TAC AFFSIGN_MONO_SHUFFLE THEN + SET_TAC[]; + FIRST_ASSUM MATCH_MP_TAC THEN ASM_MESON_TAC[]; + ASM_MESON_TAC[]; + ASM_MESON_TAC[]]; + ALL_TAC] THEN + ONCE_REWRITE_TAC[CONJ_SYM] THEN CONJ_TAC THEN X_GEN_TAC `w:real^3` THENL + [DISCH_TAC THEN ASM_CASES_TAC `w:real^3 = v` THENL + [ASM_REWRITE_TAC[] THEN + W(MP_TAC o PART_MATCH (lhs o rand) AFF_GT_1_1 o + rand o lhand o goal_concl) THEN + ANTS_TAC THENL [ASM SET_TAC[]; DISCH_THEN SUBST1_TAC] THEN + W(MP_TAC o PART_MATCH (lhs o rand) AFF_GT_1_2 o + lhand o lhand o goal_concl) THEN + REWRITE_TAC[SET_RULE + `DISJOINT {a} {b,c} <=> ~(b = a) /\ ~(c = a)`] THEN + ANTS_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]; + DISCH_THEN SUBST1_TAC] THEN + REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + REWRITE_TAC[TAUT `p /\ t = &1 /\ q <=> t = &1 /\ p /\ q`] THEN + REWRITE_TAC[REAL_ARITH `t + s = &1 <=> t = &1 - s`] THEN + ONCE_REWRITE_TAC[MESON[] + `(?a b c. P a b c) <=> (?c b a. P a b c)`] THEN + REWRITE_TAC[UNWIND_THM2] THEN + ONCE_REWRITE_TAC[SWAP_EXISTS_THM] THEN + REWRITE_TAC[UNWIND_THM2] THEN + SIMP_TAC[SET_RULE `s INTER t = {} <=> !x. x IN s ==> ~(x IN t)`] THEN + X_GEN_TAC `p:real^3` THEN + REWRITE_TAC[IN_ELIM_THM; LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`t1:real`; `t2:real`] THEN STRIP_TAC THEN + DISCH_THEN(X_CHOOSE_THEN `t3:real` MP_TAC) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + REWRITE_TAC[VECTOR_ARITH + `a % v + b % w:real^N = c % v <=> b % w = (c - a) % v`] THEN + DISCH_THEN(MP_TAC o AP_TERM `(%) (inv t2) :real^3->real^3`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; REAL_LT_IMP_NZ] THEN + SUBGOAL_THEN `~collinear{vec 0,(prime:real^3->real^3) v,prime(r v)}` + MP_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE]; + REWRITE_TAC[COLLINEAR_LEMMA_ALT; VECTOR_MUL_LID] THEN + ASM_MESON_TAC[]]; + ALL_TAC] THEN + ASM_CASES_TAC `w:real^3 = (r:real^3->real^3) v` THENL + [ASM_REWRITE_TAC[] THEN + W(MP_TAC o PART_MATCH (lhs o rand) AFF_GT_1_1 o + rand o lhand o goal_concl) THEN + ANTS_TAC THENL [ASM SET_TAC[]; DISCH_THEN SUBST1_TAC] THEN + W(MP_TAC o PART_MATCH (lhs o rand) AFF_GT_1_2 o + lhand o lhand o goal_concl) THEN + REWRITE_TAC[SET_RULE + `DISJOINT {a} {b,c} <=> ~(b = a) /\ ~(c = a)`] THEN + ANTS_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]; + DISCH_THEN SUBST1_TAC] THEN + REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + REWRITE_TAC[TAUT `p /\ t = &1 /\ q <=> t = &1 /\ p /\ q`] THEN + REWRITE_TAC[REAL_ARITH `t + s = &1 <=> t = &1 - s`] THEN + ONCE_REWRITE_TAC[MESON[] + `(?a b c. P a b c) <=> (?c b a. P a b c)`] THEN + REWRITE_TAC[UNWIND_THM2] THEN + ONCE_REWRITE_TAC[SWAP_EXISTS_THM] THEN + REWRITE_TAC[UNWIND_THM2] THEN + SIMP_TAC[SET_RULE `s INTER t = {} <=> !x. x IN s ==> ~(x IN t)`] THEN + X_GEN_TAC `p:real^3` THEN + REWRITE_TAC[IN_ELIM_THM; LEFT_IMP_EXISTS_THM] THEN + MAP_EVERY X_GEN_TAC [`t1:real`; `t2:real`] THEN STRIP_TAC THEN + DISCH_THEN(X_CHOOSE_THEN `t3:real` MP_TAC) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + REWRITE_TAC[VECTOR_ARITH + `a % v + b % w:real^N = c % w <=> a % v = (c - b) % w`] THEN + DISCH_THEN(MP_TAC o AP_TERM `(%) (inv t1) :real^3->real^3`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; REAL_LT_IMP_NZ] THEN + SUBGOAL_THEN `~collinear{vec 0,prime(r v),(prime:real^3->real^3) v}` + + MP_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE]; + REWRITE_TAC[COLLINEAR_LEMMA_ALT; VECTOR_MUL_LID] THEN + ASM_MESON_TAC[]]; + ALL_TAC] THEN + SUBST1_TAC(SET_RULE + `{(prime:real^3->real^3) w} = {prime w,prime w}`) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[SET_RULE `{w,w} SUBSET s <=> w IN s`] THEN + ASM_MESON_TAC[]; + ALL_TAC] THEN + STRIP_TAC THEN + ASM_CASES_TAC `(r:real^3->real^3) w = v` THENL + [ALL_TAC; + FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET] THEN + CONJ_TAC THEN FIRST_ASSUM MATCH_MP_TAC THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + Local_lemmas.IVS_RHO_IDD]] THEN + MATCH_MP_TAC(SET_RULE + `!f. (!x. x IN s ==> f x = &0) /\ (!x. x IN t ==> ~(f x = &0)) + ==> s INTER t = {}`) THEN + EXISTS_TAC `\p. azim (vec 0) (prime(v:real^3)) (prime (r v)) p` THEN + REWRITE_TAC[] THEN CONJ_TAC THENL + [REPEAT STRIP_TAC THEN MATCH_MP_TAC AZIM_EQ_0_GE_IMP THEN + MATCH_MP_TAC(SET_RULE `!s. x IN s /\ s SUBSET t ==> x IN t`) THEN + EXISTS_TAC `aff_gt {vec 0} {(prime:real^3->real^3) v,prime(r v)}` THEN + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `aff_ge {vec 0} {(prime:real^3->real^3) v,prime(r v)}` THEN + REWRITE_TAC[AFF_GT_SUBSET_AFF_GE] THEN REWRITE_TAC[aff_ge_def] THEN + MATCH_MP_TAC AFFSIGN_MONO_SHUFFLE THEN SET_TAC[]; + ALL_TAC] THEN + X_GEN_TAC `x:real^3` THEN DISCH_TAC THEN + SUBGOAL_THEN + `azim (vec 0) (prime(v:real^3)) (prime (r v)) x = + azim (vec 0) (prime v) (prime (r v)) (prime w)` + SUBST1_TAC THENL + [MATCH_MP_TAC AZIM_EQ_IMP THEN + REPEAT(CONJ_TAC THENL + [FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE]; + ALL_TAC]) THEN + FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (SET_RULE + `x IN s ==> s SUBSET t ==> x IN t`)) THEN + ASM_REWRITE_TAC[aff_gt_def] THEN MATCH_MP_TAC AFFSIGN_MONO_SHUFFLE THEN + SET_TAC[]; + ALL_TAC] THEN + SUBGOAL_THEN `w = ivs_rho_node1 FF v` SUBST1_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + Local_lemmas.IVS_RHO_IDD]; + ASM_MESON_TAC[REAL_ARITH + `a = pi - z /\ &0 < a /\ a < pi ==> ~(z = &0)`]]; + ALL_TAC] THEN + SUBGOAL_THEN `local_fan(V':real^3->bool,E',FF')` ASSUME_TAC THENL + [ASM_REWRITE_TAC[Wrgcvdr_cizmrrh.local_fan] THEN + LET_TAC THEN EXPAND_TAC "H" THEN REWRITE_TAC[Wrgcvdr_cizmrrh.dih2k] THEN + REWRITE_TAC[Hypermap.face; Hypermap.face_map] THEN FIRST_ASSUM + (fun th -> REWRITE_TAC[MATCH_MP Wrgcvdr_cizmrrh.HYP_LEMMA th] THEN + REWRITE_TAC[MATCH_MP Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP th]) THEN + REWRITE_TAC[Wrgcvdr_cizmrrh.HYP] THEN + ABBREV_TAC `FF'' = { ((prime:real^3->real^3)(r v),prime v) | v IN V}` THEN + SUBGOAL_THEN `darts_of_hyp E' (V':real^3->bool) = FF' UNION FF''` + (fun th -> SUBST1_TAC th THEN ASSUME_TAC th) + THENL + [REWRITE_TAC[Wrgcvdr_cizmrrh.darts_of_hyp; Wrgcvdr_cizmrrh.ord_pairs; + Wrgcvdr_cizmrrh.self_pairs; Wrgcvdr_cizmrrh.EE] THEN + MATCH_MP_TAC(SET_RULE `t = {} /\ s = u ==> s UNION t = u`) THEN + CONJ_TAC THENL + [PURE_REWRITE_TAC[SET_RULE `s = {} <=> !x. x IN s ==> F`] THEN + PURE_REWRITE_TAC[FORALL_IN_GSPEC] THEN + REWRITE_TAC[TAUT `~(p /\ q) <=> p ==> ~q`] THEN + EXPAND_TAC "V'" THEN REWRITE_TAC[FORALL_IN_GSPEC] THEN + EXPAND_TAC "E'" THEN ASM SET_TAC[]; + MAP_EVERY EXPAND_TAC ["E'"; "FF'"; "FF''"] THEN + GEN_REWRITE_TAC I [EXTENSION] THEN + REWRITE_TAC[FORALL_PAIR_THM; IN_UNION; IN_ELIM_PAIR_THM] THEN + REWRITE_TAC[IN_ELIM_THM; PAIR_EQ] THEN + REWRITE_TAC[SET_RULE + `{a,b} = {c,d} <=> a = c /\ b = d \/ a = d /\ b = c`] THEN + MESON_TAC[]]; + ALL_TAC] THEN + SUBGOAL_THEN + `!v:real^3. + v IN V + ==> EE (prime v) E' = {prime(r v):real^3,prime(ivs_rho_node1 FF v)}` + ASSUME_TAC THENL + [X_GEN_TAC `v:real^3 ` THEN DISCH_TAC THEN + REWRITE_TAC[PAIR_EQ; Wrgcvdr_cizmrrh.EE] THEN EXPAND_TAC "E'" THEN + REWRITE_TAC[IN_ELIM_THM; SET_RULE + `{a,b} = {c,d} <=> a = c /\ b = d \/ a = d /\ b = c`] THEN + REWRITE_TAC[EXTENSION; IN_INSERT; NOT_IN_EMPTY; IN_ELIM_THM] THEN + GEN_TAC THEN REWRITE_TAC[EXISTS_OR_THM; LEFT_OR_DISTRIB] THEN + BINOP_TAC THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + Tecoxbm.RHO_IVS_IDD; + Local_lemmas.IVS_RHO_IDD; IVS_RHO_NODE1_IN_V]; + ALL_TAC] THEN + SUBGOAL_THEN `!n v. v IN V ==> ITER n (r:real^3->real^3) v IN V` + ASSUME_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V]; + ALL_TAC] THEN + SUBGOAL_THEN `!n v. v IN V ==> ITER n (ivs_rho_node1 FF) v IN V` + ASSUME_TAC THENL + [ASM_MESON_TAC[LOCAL_FAN_ITER_IVS_RHO_NODE_IN_V]; + ALL_TAC] THEN + SUBGOAL_THEN + `!n v. v IN V + ==> ITER n (ff_of_hyp (vec 0,V',E')) (prime v,prime (r v)) = + ((prime:real^3->real^3)(ITER n r v),prime(r(ITER n r v)))` + ASSUME_TAC THENL + [ONCE_REWRITE_TAC[SWAP_FORALL_THM] THEN + REWRITE_TAC[RIGHT_FORALL_IMP_THM] THEN GEN_TAC THEN DISCH_TAC THEN + INDUCT_TAC THEN ASM_REWRITE_TAC[ITER] THEN + ASM_REWRITE_TAC[ff_of_hyp3; IN_UNION] THEN + COND_CASES_TAC THENL + [SUBGOAL_THEN `r(ITER n (r:real^3->real^3) v) IN V` ASSUME_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]; + ASM_SIMP_TAC[PAIR_EQ]] THEN + MATCH_MP_TAC IVS_AZIM_CYCLE_TWO_POINT_SET_ALT THEN + MATCH_MP_TAC(SET_RULE `a = a' /\ b = b' ==> {a,b} = {b',a'}`) THEN + ASM_MESON_TAC[Local_lemmas.IVS_RHO_IDD]; + FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (TAUT + `~(a \/ b) ==> a ==> c`)) THEN + EXPAND_TAC "FF'" THEN REWRITE_TAC[IN_ELIM_THM] THEN + ASM_MESON_TAC[]]; + ALL_TAC] THEN + SUBGOAL_THEN + `!n v. v IN V + ==> ITER n (ff_of_hyp (vec 0,V',E')) (prime(r v),prime v) = + ((prime:real^3->real^3) (r(ITER n (ivs_rho_node1 FF) v)), + prime(ITER n (ivs_rho_node1 FF) v))` + ASSUME_TAC THENL + [ONCE_REWRITE_TAC[SWAP_FORALL_THM] THEN + REWRITE_TAC[RIGHT_FORALL_IMP_THM] THEN GEN_TAC THEN DISCH_TAC THEN + INDUCT_TAC THEN ASM_REWRITE_TAC[ITER] THEN + ASM_REWRITE_TAC[ff_of_hyp3; IN_UNION] THEN + COND_CASES_TAC THENL + [ASM_SIMP_TAC[PAIR_EQ] THEN + CONJ_TAC THENL [ASM_MESON_TAC[Tecoxbm.RHO_IVS_IDD]; ALL_TAC] THEN + ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`] THEN + MATCH_MP_TAC IVS_AZIM_CYCLE_TWO_POINT_SET_ALT THEN + ASM_SIMP_TAC[PAIR_EQ] THEN REWRITE_TAC[INSERT_AC]; + FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (TAUT + `~(a \/ b) ==> b ==> c`)) THEN + EXPAND_TAC "FF''" THEN REWRITE_TAC[IN_ELIM_THM] THEN + ASM_MESON_TAC[]]; + ALL_TAC] THEN + SUBGOAL_THEN + `!x. x IN FF' ==> orbit_map (ff_of_hyp (vec 0,V',E')) x = FF'` + ASSUME_TAC THENL + [EXPAND_TAC "FF'" THEN REWRITE_TAC[FORALL_IN_GSPEC] THEN + X_GEN_TAC `v:real^3` THEN DISCH_TAC THEN + REWRITE_TAC[Hypermap.orbit_map; Wrgcvdr_cizmrrh.POWER_TO_ITER] THEN + ASM_SIMP_TAC[] THEN + SUBGOAL_THEN + `(!n. ITER n (r:real^3->real^3) v IN V) /\ + (!w. w IN V ==> ?n. w = ITER n r v)` + MP_TAC THENL + [ASM_MESON_TAC[LOCAL_FAN_ORBIT_MAP_EXPLICIT]; + REWRITE_TAC[GE; LE_0] THEN EXPAND_TAC "FF'" THEN SET_TAC[]]; + ALL_TAC] THEN + CONJ_TAC THENL + [FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [GSYM MEMBER_NOT_EMPTY]) THEN + DISCH_THEN(X_CHOOSE_TAC `v:real^3`) THEN REWRITE_TAC[IN_UNION] THEN + MATCH_MP_TAC(SET_RULE + `(?x. P x) /\ (!x. P x ==> R x) ==> ?x. (P x \/ Q x) /\ R x`) THEN + ASM_SIMP_TAC[] THEN EXPAND_TAC "FF'" THEN ASM SET_TAC[]; + ALL_TAC] THEN + SUBGOAL_THEN + `CARD(FF':real^3#real^3->bool) = CARD(V:real^3->bool) /\ + CARD(FF'':real^3#real^3->bool) = CARD V` + STRIP_ASSUME_TAC THENL + [MAP_EVERY EXPAND_TAC ["FF'"; "FF''"] THEN + REWRITE_TAC[SIMPLE_IMAGE] THEN + CONJ_TAC THEN MATCH_MP_TAC CARD_IMAGE_INJ THEN + ASM_REWRITE_TAC[PAIR_EQ] THEN ASM_MESON_TAC[]; + ALL_TAC] THEN + CONJ_TAC THENL + [REWRITE_TAC[MULT_2] THEN MATCH_MP_TAC(MESON[CARD_UNION] + `CARD t = CARD s /\ FINITE s /\ FINITE t /\ s INTER t = {} + ==> CARD(s UNION t) = CARD s + CARD s`) THEN + ASM_REWRITE_TAC[] THEN MAP_EVERY EXPAND_TAC ["FF'"; "FF''"] THEN + REWRITE_TAC[SIMPLE_IMAGE] THEN ASM_SIMP_TAC[FINITE_IMAGE] THEN + REWRITE_TAC[SET_RULE `IMAGE f s INTER IMAGE g s = {} <=> + !x y. x IN s /\ y IN s ==> ~(f x = g y)`] THEN + REWRITE_TAC[PAIR_EQ] THEN + MAP_EVERY(fun th -> FIRST_ASSUM(MP_TAC o GEN_ALL o MATCH_MP + (REWRITE_RULE[IMP_CONJ] th))) + [Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE] THEN + ASM_MESON_TAC[]; + ALL_TAC] THEN + SUBGOAL_THEN + `!x. x IN FF'' ==> orbit_map (ff_of_hyp (vec 0,V',E')) x = FF''` + ASSUME_TAC THENL + [EXPAND_TAC "FF''" THEN REWRITE_TAC[FORALL_IN_GSPEC] THEN + X_GEN_TAC `v:real^3` THEN DISCH_TAC THEN + REWRITE_TAC[Hypermap.orbit_map; Wrgcvdr_cizmrrh.POWER_TO_ITER] THEN + ASM_SIMP_TAC[] THEN + SUBGOAL_THEN + `(!n. ITER n (ivs_rho_node1 FF) v IN V) /\ + (!w. w IN V ==> ?n. w = ITER n (ivs_rho_node1 FF) v)` + MP_TAC THENL + [ASM_MESON_TAC[LOCAL_FAN_ORBIT_MAP_EXPLICIT_IVS]; + REWRITE_TAC[GE; LE_0] THEN EXPAND_TAC "FF''" THEN SET_TAC[]]; + ALL_TAC] THEN + REWRITE_TAC[Lvducxu.HAS_ORD2_INTERPRET] THEN + SUBGOAL_THEN + `(!x. x IN FF' ==> nn_of_hyp (vec 0,V',E') x IN FF'') /\ + (!x. x IN FF'' ==> nn_of_hyp (vec 0,V',E') x IN FF')` + STRIP_ASSUME_TAC THENL + [ASM_SIMP_TAC[nn_of_hyp3; FORALL_PAIR_THM; IN_UNION] THEN + MAP_EVERY EXPAND_TAC ["FF'"; "FF''"] THEN + REWRITE_TAC[IN_ELIM_THM; PAIR_EQ] THEN CONJ_TAC THEN + REPEAT GEN_TAC THEN + DISCH_THEN(X_CHOOSE_THEN `v:real^3` STRIP_ASSUME_TAC) THENL + [EXISTS_TAC `ivs_rho_node1 FF v` THEN ASM_SIMP_TAC[] THEN + REPEAT CONJ_TAC THENL + [ASM_MESON_TAC[IVS_RHO_NODE1_IN_V]; + ASM_MESON_TAC[Tecoxbm.RHO_IVS_IDD]; + ASM_MESON_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]]; + EXISTS_TAC `rho_node1 FF v` THEN ASM_SIMP_TAC[] THEN + MATCH_MP_TAC(TAUT `p /\ (p ==> q) ==> p /\ q`) THEN + CONJ_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]; ALL_TAC] THEN + ASM_SIMP_TAC[] THEN DISCH_TAC THEN + ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`] THEN + ASM_MESON_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET; + Local_lemmas.IVS_RHO_IDD]]; + ALL_TAC] THEN + SUBGOAL_THEN `nn_of_hyp (vec 0,V',E') o nn_of_hyp (vec 0,V',E') = I` + ASSUME_TAC THENL + [ASM_REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM; FORALL_PAIR_THM] THEN + MAP_EVERY X_GEN_TAC [`w:real^3`; `z:real^3`] THEN + ASM_CASES_TAC `(w:real^3,z:real^3) IN FF' UNION FF''` THENL + [ALL_TAC; ASM_REWRITE_TAC[nn_of_hyp3]] THEN + FIRST_X_ASSUM(DISJ_CASES_TAC o GEN_REWRITE_RULE I [IN_UNION]) THEN + ONCE_REWRITE_TAC[Wrgcvdr_cizmrrh.nn_of_hyp2] THEN + ASM_SIMP_TAC[IN_UNION] THEN + ASM_REWRITE_TAC[Wrgcvdr_cizmrrh.nn_of_hyp2; IN_UNION; PAIR_EQ] THENL + [UNDISCH_TAC `(w:real^3,z:real^3) IN FF'` THEN EXPAND_TAC "FF'"; + UNDISCH_TAC `(w:real^3,z:real^3) IN FF''` THEN EXPAND_TAC "FF''"] THEN + REWRITE_TAC[IN_ELIM_THM; PAIR_EQ] THEN + DISCH_THEN(X_CHOOSE_THEN `v:real^3` STRIP_ASSUME_TAC) THEN + ASM_SIMP_TAC[] THEN MATCH_MP_TAC AZIM_CYCLE_TWO_POINT_SET_ALT THEN + REWRITE_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET] THENL + [SET_TAC[]; ALL_TAC] THEN + SUBGOAL_THEN `(r:real^3->real^3) v IN V` ASSUME_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]; ALL_TAC] THEN + ASM_SIMP_TAC[] THEN + SUBGOAL_THEN `ivs_rho_node1 FF (r v) = v` SUBST1_TAC THENL + [ASM_MESON_TAC[Local_lemmas.IVS_RHO_IDD]; ALL_TAC] THEN + MATCH_MP_TAC(SET_RULE `a' = a ==> {a,b} = {a',b}`) THEN + ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`] THEN + REWRITE_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]; + ALL_TAC] THEN + ASM_REWRITE_TAC[] THEN CONJ_TAC THENL + [REWRITE_TAC[IN_UNION; MESON[] + `(!x. P x \/ Q x ==> R x) <=> + (!x. P x ==> R x) /\ (!x. Q x ==> R x)`] THEN + CONV_TAC(ONCE_DEPTH_CONV let_CONV) THEN ASM_SIMP_TAC[] THEN + SUBGOAL_THEN + `IMAGE (nn_of_hyp (vec 0,V',E')) FF' = FF'' /\ + IMAGE (nn_of_hyp (vec 0,V',E')) FF'' = FF'` + MP_TAC THENL [ALL_TAC; SET_TAC[]] THEN + MATCH_MP_TAC(SET_RULE + `(!x. f(f x) = x) /\ + (!x. x IN s ==> f x IN t) /\ (!x. x IN t ==> f x IN s) + ==> IMAGE f s = t /\ IMAGE f t = s`) THEN + RULE_ASSUM_TAC(REWRITE_RULE[FUN_EQ_THM; o_THM; I_THM]) THEN + ASM_REWRITE_TAC[]; + ALL_TAC] THEN + REWRITE_TAC[Wrgcvdr_cizmrrh.has_orders] THEN CONJ_TAC THENL + [CONJ_TAC THENL + [X_GEN_TAC `i:num` THEN STRIP_TAC THEN + REWRITE_TAC[FUN_EQ_THM; I_THM; NOT_FORALL_THM] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [GSYM MEMBER_NOT_EMPTY]) THEN + DISCH_THEN(X_CHOOSE_THEN `v:real^3` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `((prime:real^3->real^3) v,prime(r v))` THEN + ASM_SIMP_TAC[PAIR_EQ] THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IMP_DIS_ELMS23; ITER]; + REWRITE_TAC[FUN_EQ_THM; I_THM] THEN + MATCH_MP_TAC(MESON[IN_UNION] + `!FF' FF''. + (!x. x IN FF' ==> P x) /\ (!x. x IN FF'' ==> P x) /\ + (!x. ~(x IN FF' UNION FF'') ==> P x) + ==> !x. P x`) THEN + MAP_EVERY EXISTS_TAC + [`FF':real^3#real^3->bool`; `FF'':real^3#real^3->bool`] THEN + REPEAT CONJ_TAC THENL + [EXPAND_TAC "FF'" THEN REWRITE_TAC[FORALL_IN_GSPEC] THEN + ASM_SIMP_TAC[PAIR_EQ] THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID]; + EXPAND_TAC "FF''" THEN REWRITE_TAC[FORALL_IN_GSPEC] THEN + ASM_SIMP_TAC[PAIR_EQ] THEN + ASM_MESON_TAC[LOFA_IMP_ITER_IVS_RHO_NODE_ID]; + ASM_REWRITE_TAC[FORALL_PAIR_THM; ff_of_hyp3] THEN + REPEAT GEN_TAC THEN DISCH_TAC THEN + SPEC_TAC(`CARD(V:real^3->bool)`,`k:num`) THEN + INDUCT_TAC THEN ASM_REWRITE_TAC[ITER]]]; + ALL_TAC] THEN + REPEAT CONJ_TAC THENL + [REWRITE_TAC[ee_of_hyp3; FUN_EQ_THM; o_THM; I_THM; FORALL_PAIR_THM] THEN + MAP_EVERY X_GEN_TAC [`v:real^3`; `w:real^3`] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `(v:real^3,w) IN darts_of_hyp E' V'` THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN + `(!v w:real^3. (v,w) IN FF' ==> (w,v) IN FF'') /\ + (!v w:real^3. (v,w) IN FF'' ==> (w,v) IN FF')` + MP_TAC THENL [ALL_TAC; REWRITE_TAC[IN_UNION] THEN MESON_TAC[]] THEN + MAP_EVERY EXPAND_TAC ["FF'"; "FF''"] THEN + REWRITE_TAC[IN_ELIM_THM; PAIR_EQ] THEN MESON_TAC[]; + REWRITE_TAC[ee_of_hyp3; FUN_EQ_THM; I_THM] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [GSYM MEMBER_NOT_EMPTY]) THEN + DISCH_THEN(X_CHOOSE_TAC `v:real^3`) THEN + DISCH_THEN(MP_TAC o SPEC `(prime:real^3->real^3) v,prime(r v)`) THEN + ASM_REWRITE_TAC[IN_UNION] THEN EXPAND_TAC "FF'" THEN + REWRITE_TAC[IN_ELIM_THM] THEN + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE; PAIR_EQ; + Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]; + REWRITE_TAC[nn_of_hyp3; FUN_EQ_THM; I_THM] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [GSYM MEMBER_NOT_EMPTY]) THEN + DISCH_THEN(X_CHOOSE_TAC `v:real^3`) THEN + DISCH_THEN(MP_TAC o SPEC `(prime:real^3->real^3) v,prime(r v)`) THEN + ASM_REWRITE_TAC[IN_UNION] THEN EXPAND_TAC "FF'" THEN + REWRITE_TAC[IN_ELIM_THM] THEN + COND_CASES_TAC THENL [ALL_TAC; ASM_MESON_TAC[]] THEN + ASM_SIMP_TAC[PAIR_EQ; Local_lemmas.AZIM_CYCLE_TWO_POINT_SET] THEN + ASM_MESON_TAC[IVS_RHO_NODE1_IN_V; Tecoxbm.RHO_IVS_IDD; + Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE]]; + ALL_TAC] THEN + SUBGOAL_THEN `convex_local_fan(V':real^3->bool,E',FF')` ASSUME_TAC THENL + [ASM_REWRITE_TAC[Wrgcvdr_cizmrrh.convex_local_fan] THEN + EXPAND_TAC "FF'" THEN REWRITE_TAC[FORALL_IN_GSPEC] THEN + SIMP_TAC[Wrgcvdr_cizmrrh.azim_in_fan; Wrgcvdr_cizmrrh.wedge_in_fan_ge] THEN + X_GEN_TAC `v:real^3` THEN DISCH_TAC THEN ABBREV_TAC + `d = azim_cycle (EE (prime(v:real^3)) E') + (vec 0) (prime v) (prime (r v))` THEN + CONV_TAC(ONCE_DEPTH_CONV let_CONV) THEN + SUBGOAL_THEN `CARD (EE (prime(v:real^3):real^3) E') = 2` SUBST1_TAC THENL + [MATCH_MP_TAC(GEN_ALL Local_lemmas.LOFA_CARD_EE_V_1) THEN + MAP_EVERY EXISTS_TAC [`FF':real^3#real^3->bool`; `V':real^3->bool`] THEN + ASM_REWRITE_TAC[] THEN EXPAND_TAC "V'" THEN ASM SET_TAC[]; + CONV_TAC NUM_REDUCE_CONV] THEN + SUBGOAL_THEN `d:real^3 = prime(ivs_rho_node1 FF v)` SUBST1_TAC THENL + [EXPAND_TAC "d" THEN + SUBGOAL_THEN `EE (prime v:real^3) E' = + {prime(r v),prime(ivs_rho_node1 FF v)}` + (fun th -> REWRITE_TAC[th; Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]) THEN + FIRST_ASSUM(fun th -> REWRITE_TAC + [MATCH_MP Wrgcvdr_cizmrrh.FAN_IMP_EE_EQ_SET_OF_EDGE th]) THEN + REWRITE_TAC[Fan.set_of_edge] THEN MAP_EVERY EXPAND_TAC ["V'"; "E'"] THEN + REWRITE_TAC[IN_ELIM_THM; SET_RULE + `{w | P w /\ (?v. v IN V /\ w = prime v)} = + IMAGE prime {v | v IN V /\ P(prime v)}`] THEN + REWRITE_TAC[SET_RULE `{f a,f b} = IMAGE f {a,b}`] THEN AP_TERM_TAC THEN + REWRITE_TAC[RIGHT_AND_EXISTS_THM; IMAGE_CLAUSES] THEN + SUBGOAL_THEN + `!w z. w IN V /\ z IN V /\ + {prime v:real^3,prime w} = {prime z,prime(r z)} <=> + (w:real^3) IN V /\ z IN V /\ {v,w} = {z,r z}` + (fun th -> REWRITE_TAC[th]) + THENL + [REWRITE_TAC[SET_RULE + `{a,b} = {c,d} <=> a = c /\ b = d \/ a = d /\ b = c`] THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]; + ALL_TAC] THEN + REWRITE_TAC[SET_RULE + `{a,b} = {c,d} <=> a = c /\ b = d \/ a = d /\ b = c`] THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_INSERT; NOT_IN_EMPTY] THEN + X_GEN_TAC `w:real^3` THEN ASM_CASES_TAC `(w:real^3) IN V` THENL + [ASM_REWRITE_TAC[]; + ASM_MESON_TAC[IVS_RHO_NODE1_IN_V; + Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]] THEN + REWRITE_TAC[MESON[] `(?v. P v /\ (x = v /\ Q v \/ R v /\ y = v)) <=> + P x /\ Q x \/ P y /\ R y`] THEN + ASM_CASES_TAC `w = (r:real^3->real^3) v` THEN ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[Local_lemmas.IVS_RHO_IDD; Tecoxbm.RHO_IVS_IDD]; + ALL_TAC] THEN + CONJ_TAC THENL + [MATCH_MP_TAC(REAL_ARITH `&0 < x /\ x < pi ==> x <= pi`) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE; + IVS_RHO_NODE1_IN_V; Tecoxbm.RHO_IVS_IDD]; + ALL_TAC] THEN + EXPAND_TAC "V'" THEN REWRITE_TAC[SUBSET; FORALL_IN_GSPEC] THEN + X_GEN_TAC `w:real^3` THEN DISCH_TAC THEN + REWRITE_TAC[Wrgcvdr_cizmrrh.wedge_ge; IN_ELIM_THM; azim] THEN + ASM_CASES_TAC `(prime:real^3->real^3) w = prime v` THEN + ASM_REWRITE_TAC[Local_lemmas.AZIM_SPEC_DEGENERATE; azim] THEN + ASM_CASES_TAC `w:real^3 = v` THENL [ASM_MESON_TAC[]; ALL_TAC] THEN + ASM_CASES_TAC `(prime:real^3->real^3) w = prime(ivs_rho_node1 FF v)` THEN + ASM_REWRITE_TAC[REAL_LE_REFL] THEN + ASM_CASES_TAC `w = ivs_rho_node1 FF v` THENL + [ASM_MESON_TAC[]; ALL_TAC] THEN + ASM_CASES_TAC `(prime:real^3->real^3) w = prime(r(v:real^3))` THEN + ASM_REWRITE_TAC[AZIM_REFL; azim] THEN + ASM_CASES_TAC `w = (r:real^3->real^3) v` THENL + [ASM_MESON_TAC[]; ALL_TAC] THEN + MP_TAC(ISPECL [`vec 0:real^3`; `(prime:real^3->real^3) v`; + `prime(r(v:real^3):real^3):real^3`; + `(prime:real^3->real^3) w`; + `(prime:real^3->real^3) (ivs_rho_node1 FF v)`] + Fan.sum3_azim_fan) THEN + ANTS_TAC THENL [ALL_TAC; SIMP_TAC[REAL_LE_ADDR; azim]] THEN + CONJ_TAC THENL + [ALL_TAC; + REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE; + IVS_RHO_NODE1_IN_V; Tecoxbm.RHO_IVS_IDD; + Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]] THEN + MATCH_MP_TAC(REAL_ARITH + `(&0 < x /\ x < pi) /\ (&0 < y /\ y < pi) ==> x + y < &2 * pi`) THEN + ASM_SIMP_TAC[] THEN MATCH_MP_TAC SIN_POS_PI_REV THEN + SIMP_TAC[azim; REAL_LT_IMP_LE] THEN + REWRITE_TAC[Local_lemmas.SIN_AZIM_MUTUAL_SROSS] THEN + ONCE_REWRITE_TAC[lemma6] THEN + REWRITE_TAC[GSYM Local_lemmas.SIN_AZIM_MUTUAL_SROSS] THEN + ABBREV_TAC `u = ivs_rho_node1 FF v` THEN + SUBGOAL_THEN `v = (r:real^3->real^3) u` ASSUME_TAC THENL + [ASM_MESON_TAC[Tecoxbm.RHO_IVS_IDD; IVS_RHO_NODE1_IN_V]; ALL_TAC] THEN + ASM_REWRITE_TAC[] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_MESON_TAC[IVS_RHO_NODE1_IN_V]; + ALL_TAC] THEN + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC(TAUT `p /\ (p ==> q) ==> p /\ q`) THEN + CONJ_TAC THENL + [SUBGOAL_THEN + `!v. v IN V + ==> interior_angle1 (vec 0) FF' (prime v) = + azim (vec 0) (prime v) + (prime(rho_node1 FF v)) (prime(ivs_rho_node1 FF v))` + (fun th -> ASM_SIMP_TAC[th]) THEN + REWRITE_TAC[Local_lemmas.interior_angle1; Local_lemmas.rho_node1] THEN + X_GEN_TAC `v:real^3` THEN DISCH_TAC THEN EXPAND_TAC "FF'" THEN + REWRITE_TAC[IN_ELIM_THM; PAIR_EQ] THEN + MATCH_MP_TAC(MESON[] + `c = c' /\ d = d' ==> azim a b c d = azim a b c' d'`) THEN + CONJ_TAC THEN MATCH_MP_TAC SELECT_UNIQUE THEN + ASM_REWRITE_TAC[GSYM Local_lemmas.rho_node1] THEN + ASM_MESON_TAC[Local_lemmas.IVS_RHO_IDD; + Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + IVS_RHO_NODE1_IN_V; Tecoxbm.RHO_IVS_IDD]; + DISCH_TAC] THEN + FIRST_ASSUM(MP_TAC o MATCH_MP Wrgcvdr_cizmrrh.CIZMRRH) THEN + REWRITE_TAC[DE_MORGAN_THM] THEN + DISCH_THEN(REPEAT_TCL DISJ_CASES_THEN MP_TAC) THENL + [SIMP_TAC[]; + DISCH_THEN(MP_TAC o GEN_ALL o MATCH_MP (REWRITE_RULE[IMP_CONJ_ALT] + Local_lemmas.KCHMAMG) o CONJUNCT1) THEN + DISCH_THEN(MP_TAC o SPEC `FF':(real^3#real^3)->bool`) THEN + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC(TAUT `~p ==> p /\ q ==> r`) THEN + EXPAND_TAC "V'" THEN REWRITE_TAC[FORALL_IN_GSPEC] THEN + RULE_ASSUM_TAC(REWRITE_RULE[GSYM MEMBER_NOT_EMPTY]) THEN + ASM_MESON_TAC[REAL_ARITH `a = pi - i /\ &0 < a /\ a < pi ==> ~(i = pi)`]; + + REWRITE_TAC[Wrgcvdr_cizmrrh.lunar; RIGHT_EXISTS_AND_THM] THEN + MATCH_MP_TAC(TAUT `~q ==> (p /\ q) /\ r ==> s`) THEN + REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; RIGHT_EXISTS_AND_THM; + GSYM CONJ_ASSOC] THEN + EXPAND_TAC "V'" THEN REWRITE_TAC[EXISTS_IN_GSPEC] THEN + ASM_MESON_TAC[]]);; + +(* ------------------------------------------------------------------------- *) +(* Perimeter and its bound of 2 pi *) +(* ------------------------------------------------------------------------- *) + +let IQCPCGW = new_definition + `fan_perimeter(V,(E:(real^3->bool)->bool),FF) = + let v = @v. v IN V in + sum(0..CARD(FF)-1) + (\i. arcV (vec 0) (ITER i (rho_node1 FF) v) + (ITER (i+1) (rho_node1 FF) v))`;; + +let FAN_PERIMETER_INVARIANT = prove + (`!V E FF v. + local_fan(V,E,FF) /\ v IN V + ==> fan_perimeter(V,E,FF) = + sum (0..CARD(FF)-1) + (\i. arcV (vec 0) (ITER i (rho_node1 FF) v) + (ITER (i+1) (rho_node1 FF) v))`, + let lemma = prove + (`!i j k. i < k /\ j < k + ==> (i + j) MOD k = if i + j < k then i + j else (i + j) - k`, + REPEAT STRIP_TAC THEN COND_CASES_TAC THEN MATCH_MP_TAC MOD_UNIQ THENL + [EXISTS_TAC `0`; EXISTS_TAC `1`] THEN ASM_ARITH_TAC) in + REPEAT STRIP_TAC THEN REWRITE_TAC[IQCPCGW] THEN + FIRST_ASSUM(SUBST_ALL_TAC o MATCH_MP Local_lemmas.LOFA_IMP_CARD_FF_V_EQ) THEN + ABBREV_TAC `w:real^3 = @v. v IN V` THEN + CONV_TAC(ONCE_DEPTH_CONV let_CONV) THEN + SUBGOAL_THEN `(w:real^3) IN V` ASSUME_TAC THENL + [ASM_MESON_TAC[]; ALL_TAC] THEN + FIRST_ASSUM(MP_TAC o SPECL [`v:real^3`; `w:real^3`] o + MATCH_MP (REWRITE_RULE[IMP_CONJ] LOCAL_FAN_ORBIT_MAP_EXPLICIT)) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN(X_CHOOSE_THEN `m:num` + (CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC)) THEN + MATCH_MP_TAC SUM_EQ_GENERAL THEN + EXISTS_TAC `\i. (i + m) MOD (CARD(V:real^3->bool))` THEN + REWRITE_TAC[ITER_ADD] THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP (ARITH_RULE `m < n ==> 0 < n`)) THEN + ABBREV_TAC `k = CARD(V:real^3->bool)` THEN + ASM_SIMP_TAC[IN_NUMSEG; LE_0; + ARITH_RULE `0 < k ==> (n <= k - 1 <=> n < k)`] THEN + CONJ_TAC THEN X_GEN_TAC `i:num` THEN DISCH_TAC THENL + [REWRITE_TAC[EXISTS_UNIQUE_THM] THEN CONJ_TAC THENL + [EXISTS_TAC `((k - m) + i) MOD k` THEN ASM_SIMP_TAC[DIVISION; LE_1] THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `((k - m + i) + m) MOD k` THEN CONJ_TAC THENL + [FIRST_ASSUM(fun th -> + ONCE_REWRITE_TAC[GSYM(MATCH_MP MOD_ADD_MOD + (MATCH_MP (ARITH_RULE `0 < k ==> ~(k = 0)`) th))]) THEN + ASM_MESON_TAC[MOD_MOD_REFL; LE_1]; + MATCH_MP_TAC MOD_UNIQ THEN EXISTS_TAC `1` THEN ASM_ARITH_TAC]; + MAP_EVERY X_GEN_TAC [`p:num`; `q:num`] THEN + DISCH_THEN(CONJUNCTS_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + ASM_SIMP_TAC[lemma] THEN ASM_ARITH_TAC]; + ASM_SIMP_TAC[DIVISION; LE_1; lemma] THEN COND_CASES_TAC THEN + ASM_REWRITE_TAC[ARITH_RULE `(x + 1) + y = (x + y) + 1`] THEN + FIRST_ASSUM(fun th -> GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) + [MATCH_MP(ARITH_RULE + `~(i + m:num < k) ==> i + m = ((i + m) - k) + k`) th]) THEN + REWRITE_TAC[ARITH_RULE `(x + k) + 1 = (x + 1) + k`] THEN + REWRITE_TAC[GSYM ADD1] THEN REWRITE_TAC[GSYM ITER_ADD] THEN + BINOP_TAC THEN AP_TERM_TAC THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID]]);; + +let FAN_PERIMETER_INVARIANT_CARD_V = prove + (`!V E FF v. + local_fan(V,E,FF) /\ v IN V + ==> fan_perimeter(V,E,FF) = + sum (0..CARD V - 1) + (\i. arcV (vec 0) (ITER i (rho_node1 FF) v) + (ITER (i+1) (rho_node1 FF) v))`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + FIRST_ASSUM(SUBST1_TAC o MATCH_MP FAN_PERIMETER_INVARIANT) THEN + FIRST_ASSUM(SUBST1_TAC o MATCH_MP Local_lemmas.LOFA_IMP_CARD_FF_V_EQ o + CONJUNCT1) THEN + REWRITE_TAC[]);; + +let FAN_PERIMETER = prove + (`!V E FF. + local_fan(V,E,FF) + ==> fan_perimeter(V,E,FF) = sum V (\v. arcV (vec 0) v (rho_node1 FF v))`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `FINITE V /\ ~(V:real^3->bool = {})` + (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THENL + [RULE_ASSUM_TAC(REWRITE_RULE + [Localization.local_fan2; Fan.FAN; Fan.fan1; LET_DEF; LET_END_DEF]) THEN + ASM SET_TAC[]; + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY; LEFT_IMP_EXISTS_THM] THEN + X_GEN_TAC `v:real^3` THEN DISCH_TAC] THEN + FIRST_ASSUM(MP_TAC o SPEC `v:real^3` o MATCH_MP (REWRITE_RULE[IMP_CONJ] + FAN_PERIMETER_INVARIANT_CARD_V)) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN SUBST1_TAC THEN + MATCH_MP_TAC SUM_EQ_GENERAL THEN + EXISTS_TAC `\i. ITER i (rho_node1 FF) v` THEN + REWRITE_TAC[GSYM ADD1; ITER] THEN CONJ_TAC THENL + [ALL_TAC; ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V]] THEN + X_GEN_TAC `w:real^3` THEN + ASM_CASES_TAC `V:real^3->bool = {}` THEN ASM_REWRITE_TAC[NOT_IN_EMPTY] THEN + DISCH_TAC THEN + SUBGOAL_THEN `~(CARD(V:real^3->bool) = 0)` ASSUME_TAC THENL + [ASM_SIMP_TAC[CARD_EQ_0]; ALL_TAC] THEN + ASM_SIMP_TAC[IN_NUMSEG; EXISTS_UNIQUE_DEF; LE_0; ARITH_RULE + `~(n = 0) ==> (i <= n - 1 <=> i < n)`] THEN + ASM_MESON_TAC[Local_lemmas1.LT_CARD_MONO_LOFA; + Local_lemmas1.POINT_PRESENTED_IN_RHOND1]);; + +let WSEWPCH = prove + (`!V E FF. convex_local_fan(V,E,FF) ==> fan_perimeter(V,E,FF) <= &2 * pi`, + let lemma1 = prove + (`!u v x. x IN affine hull {vec 0,u,v} ==> orthogonal (u cross v) x`, + REWRITE_TAC[AFFINE_HULL_3; FORALL_IN_GSPEC; orthogonal] THEN + REWRITE_TAC[DOT_RADD; DOT_RMUL; DOT_RZERO; DOT_CROSS_SELF] THEN + REAL_ARITH_TAC) in + let lemma2 = prove + (`!u v x. + x IN affine hull {vec 0,u,v} /\ ~collinear{vec 0,u,v} /\ ~(x = vec 0) + ==> ~collinear{vec 0,u cross v,x}`, + REPEAT GEN_TAC THEN + MATCH_MP_TAC(TAUT `(s /\ p ==> q \/ r) ==> p /\ ~q /\ ~r ==> ~s`) THEN + STRIP_TAC THEN REWRITE_TAC[GSYM CROSS_EQ_0] THEN + REWRITE_TAC[GSYM NORM_AND_CROSS_EQ_0] THEN + ASM_SIMP_TAC[CROSS_EQ_0; GSYM orthogonal; lemma1]) + and lemma3 = prove + (`(v cross v') cross (w cross w') = + ((w cross w') dot v) % v' - ((w cross w') dot v') % v`, + VEC3_TAC) + and lemma4 = prove + (`a % v:real^N = b % w ==> a = &0 /\ b = &0 \/ collinear{vec 0,w,v}`, + ASM_CASES_TAC `a = &0` THEN ASM_CASES_TAC `b = &0` THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_MUL_EQ_0; VECTOR_ARITH + `vec 0:real^N = a % b <=> a % b = vec 0`] THEN + TRY(SIMP_TAC[INSERT_AC; COLLINEAR_2] THEN NO_TAC) THEN + REWRITE_TAC[COLLINEAR_LEMMA] THEN + DISCH_THEN(MP_TAC o AP_TERM `(%) (inv a) :real^N->real^N`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; VECTOR_MUL_LID] THEN + MESON_TAC[]) + and lemma5 = prove + (`(a INTER a = {} ==> f a INTER f a = z) /\ + (!e1 e2. (e1 IN E \/ e1 IN V) /\ (e2 IN E \/ e2 IN V) /\ e1 INTER e2 = {} + ==> f e1 INTER f e2 = z) /\ + (!e. (e IN E /\ e IN E' \/ e IN V) /\ + e INTER a = {} ==> f e INTER f a = z) + ==> (!e. e IN E' ==> e = a \/ e IN E) + ==> (!e1 e2. (e1 IN E' \/ e1 IN V) /\ (e2 IN E' \/ e2 IN V) /\ + e1 INTER e2 = {} + ==> f e1 INTER f e2 = z)`, + STRIP_TAC THEN DISCH_THEN(fun th -> + MP_TAC th THEN MATCH_MP_TAC MONO_FORALL THEN GEN_TAC THEN + DISCH_THEN(fun th' -> MP_TAC th THEN + MATCH_MP_TAC MONO_FORALL THEN GEN_TAC THEN MP_TAC th')) THEN + ONCE_REWRITE_TAC[IMP_IMP] THEN + DISCH_THEN(fun th -> STRIP_TAC THEN MP_TAC th) THEN ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[INTER_COMM]) in + GEN_TAC THEN WF_INDUCT_TAC `CARD(V:real^3->bool)` THEN + RULE_ASSUM_TAC(REWRITE_RULE[RIGHT_IMP_FORALL_THM; IMP_IMP]) THEN + REPEAT STRIP_TAC THEN FIRST_ASSUM(STRIP_ASSUME_TAC o GEN_REWRITE_RULE I + [Wrgcvdr_cizmrrh.convex_local_fan]) THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP Wrgcvdr_cizmrrh.LOCAL_FAN_IMP_FAN) THEN + FIRST_ASSUM(MP_TAC o MATCH_MP Local_lemmas.LOFA_V_NOT_EMP) THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY; LEFT_IMP_EXISTS_THM] THEN + X_GEN_TAC `v:real^3` THEN DISCH_TAC THEN + FIRST_ASSUM(MP_TAC o SPEC `v:real^3` o MATCH_MP (REWRITE_RULE[IMP_CONJ] + FAN_PERIMETER_INVARIANT)) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + FIRST_ASSUM(MP_TAC o MATCH_MP Wrgcvdr_cizmrrh.CIZMRRH) THEN + ASM_CASES_TAC `circular (V:real^3->bool) E` THEN ASM_REWRITE_TAC[] THENL + [REWRITE_TAC[DE_MORGAN_THM; NOT_EXISTS_THM] THEN STRIP_TAC THEN + FIRST_ASSUM(MP_TAC o MATCH_MP (REWRITE_RULE[IMP_CONJ] + Local_lemmas.KCHMAMG)) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + DISCH_THEN(X_CHOOSE_THEN `A:real^3->bool` MP_TAC) THEN + REPEAT(DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + DISCH_THEN(X_CHOOSE_THEN `pl:real^3` STRIP_ASSUME_TAC) THEN + MATCH_MP_TAC REAL_EQ_IMP_LE THEN MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC + `sum (0..CARD FF - 1) + (\i. azim (vec 0) pl (ITER i (rho_node1 FF) v) + (ITER (i + 1) (rho_node1 FF) v))` THEN + CONJ_TAC THENL + [MATCH_MP_TAC SUM_EQ_NUMSEG THEN REWRITE_TAC[GSYM ADD1; ITER] THEN + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V]; + ALL_TAC] THEN + MATCH_MP_TAC ORDER_AZIM_SUM2Pi_0 THEN + FIRST_ASSUM(MP_TAC o MATCH_MP + Wrgcvdr_cizmrrh.CYCLIC_SET_IMP_NOT_COLLINEAR) THEN + GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) + [SET_RULE `{a,b,c} = {b,c,a}`] THEN + DISCH_TAC THEN + FIRST_ASSUM(ASSUME_TAC o MATCH_MP LOCAL_FAN_NOT_CARD_FF_GE_2) THEN + EXISTS_TAC `v:real^3` THEN ASM_SIMP_TAC[] THEN + ASM_SIMP_TAC[ARITH_RULE `2 <= f ==> 0 < f - 1 /\ (f - 1 + 1 = f)`] THEN + REWRITE_TAC[IN_NUMSEG; LE_0] THEN REPEAT CONJ_TAC THENL + [X_GEN_TAC `i:num` THEN DISCH_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V]; + FIRST_ASSUM(SUBST1_TAC o + MATCH_MP Local_lemmas.LOFA_IMP_CARD_FF_V_EQ) THEN + REWRITE_TAC[ITER] THEN + ASM_MESON_TAC[Local_lemmas1.LOFA_IMP_ITER_RHO_NODE_ID2]; + SUBGOAL_THEN + `?a. &0 < a /\ pl:real^3 = a % (v cross rho_node1 FF v)` + STRIP_ASSUME_TAC THENL + [MATCH_MP_TAC CROSS_POSITIVE_MULTIPLE_AZIM_AXIS_ALT THEN + ASM_SIMP_TAC[orthogonal] THEN + FIRST_ASSUM(MP_TAC o GEN_REWRITE_RULE I [Fan.CYCLIC_SET]) THEN + ASM_CASES_TAC `pl:real^3 = vec 0` THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN(K ALL_TAC) THEN + REPEAT(CONJ_TAC THENL + [ASM_MESON_TAC[SUBSET; Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]; + ALL_TAC]) THEN + REWRITE_TAC[REAL_LT_LE; Local_lemmas1.ARCV_BOUNDS] THEN + DISCH_THEN(MP_TAC o AP_TERM `sin` o SYM) THEN + REWRITE_TAC[SIN_0] THEN + MATCH_MP_TAC Trigonometry2.NOT_COLLINEAR_IMP_NOT_SIN0 THEN + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2]; + ASM_SIMP_TAC[AZIM_SPECIAL_SCALE]] THEN + ASM_SIMP_TAC[ARITH_RULE + `2 <= f ==> (j <= f - 1 /\ k <= f - 1 /\ j < k <=> + j < k /\ k < f /\ k <= f - 1)`] THEN + FIRST_ASSUM(SUBST1_TAC o + MATCH_MP Local_lemmas.LOFA_IMP_CARD_FF_V_EQ) THEN + MATCH_MP_TAC(GEN_ALL Local_lemmas.RHO_NODE1_MONO_WITH_AZIM) THEN + MAP_EVERY EXISTS_TAC + [`E:(real^3->bool)->bool`; + `{ITER j (rho_node1 FF) v | j <= CARD(V:real^3->bool) - 1}`; + `A:real^3->bool`] THEN + ASM_SIMP_TAC[SUBSET; FORALL_IN_GSPEC] THEN + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V; SUBSET]]; + ALL_TAC] THEN + ASM_CASES_TAC `?v w:real^3. lunar (v,w) V E` THEN ASM_REWRITE_TAC[] THENL + [DISCH_TAC THEN FIRST_X_ASSUM(X_CHOOSE_THEN `w:real^3` MP_TAC) THEN + DISCH_THEN(X_CHOOSE_TAC `z:real^3`) THEN + FIRST_ASSUM(MP_TAC o MATCH_MP (GEN_ALL (ONCE_REWRITE_RULE[IMP_CONJ_ALT] + Local_lemmas.HKIRPEP))) THEN + DISCH_THEN(MP_TAC o SPEC `FF:real^3#real^3->bool`) THEN + ASM_REWRITE_TAC[] THEN + REPLICATE_TAC 4 (DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + DISCH_THEN(CONJUNCTS_THEN2 + (X_CHOOSE_THEN `n:num` MP_TAC) (X_CHOOSE_THEN `m:num` MP_TAC)) THEN + REPEAT + (REPLICATE_TAC 3 (DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + DISCH_THEN(CONJUNCTS_THEN2 (ASSUME_TAC o SYM) ASSUME_TAC)) THEN + FIRST_X_ASSUM(fun th -> GEN_REWRITE_TAC LAND_CONV [SYM th]) THEN + FIRST_ASSUM(MP_TAC o GEN_REWRITE_RULE I [Localization.lunar]) THEN + REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET] THEN STRIP_TAC THEN + FIRST_ASSUM(MP_TAC o SPEC `w:real^3` o MATCH_MP + (ONCE_REWRITE_RULE[IMP_CONJ] FAN_PERIMETER_INVARIANT)) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN SUBST1_TAC THEN + FIRST_ASSUM(SUBST1_TAC o MATCH_MP Local_lemmas.LOFA_IMP_CARD_FF_V_EQ) THEN + SUBGOAL_THEN `CARD(V:real^3->bool) = m + n` SUBST1_TAC THENL + [REWRITE_TAC[GSYM LE_ANTISYM] THEN CONJ_TAC THENL + [FIRST_ASSUM(MATCH_MP_TAC o MATCH_MP (ONCE_REWRITE_RULE[IMP_CONJ] + (GEN_ALL Local_lemmas1.CARD_IS_LEAST_CYCLE))) THEN + EXISTS_TAC `w:real^3` THEN ASM_REWRITE_TAC[GSYM ITER_ADD; ADD_EQ_0]; + ALL_TAC] THEN + ONCE_REWRITE_TAC[GSYM NOT_LT] THEN DISCH_TAC THEN + SUBGOAL_THEN `CARD(V:real^3->bool) <= (m + n) - CARD V` MP_TAC THENL + [ALL_TAC; ASM_ARITH_TAC] THEN + FIRST_ASSUM(MATCH_MP_TAC o MATCH_MP (ONCE_REWRITE_RULE[IMP_CONJ] + (GEN_ALL Local_lemmas1.CARD_IS_LEAST_CYCLE))) THEN + EXISTS_TAC `w:real^3` THEN ASM_REWRITE_TAC[SUB_EQ_0; NOT_LE] THEN + SUBGOAL_THEN `ITER (CARD(V:real^3->bool)) (rho_node1 FF) w = w` + (fun th -> GEN_REWRITE_TAC (LAND_CONV o RAND_CONV) [SYM th]) + THENL + [ASM_MESON_TAC[Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID]; ALL_TAC] THEN + ASM_SIMP_TAC[ITER_ADD; ARITH_RULE `p:num < n ==> n - p + p = n`] THEN + ASM_REWRITE_TAC[GSYM ITER_ADD]; + ALL_TAC] THEN + ASM_SIMP_TAC[ARITH_RULE `~(n = 0) ==> (m + n) - 1 = (n - 1) + m`] THEN + SIMP_TAC[SUM_ADD_SPLIT; LE_0] THEN + ASM_SIMP_TAC[SUB_REFL; ARITH_EQ; ARITH_RULE + `~(m = 0) /\ ~(n = 0) ==> m - 1 + n = m + (n - 1)`] THEN + REWRITE_TAC[ONCE_REWRITE_RULE[ADD_SYM] SUM_OFFSET] THEN + REWRITE_TAC[GSYM ADD_ASSOC] THEN + GEN_REWRITE_TAC (LAND_CONV o RAND_CONV o ONCE_DEPTH_CONV) + [ONCE_REWRITE_RULE[ADD_SYM] (GSYM ITER_ADD)] THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `~(w:real^3 = vec 0) /\ ~(z:real^3 = vec 0)` + STRIP_ASSUME_TAC THENL [ASM_MESON_TAC[Fan.FAN; Fan.fan2]; ALL_TAC] THEN + SUBGOAL_THEN + `(!i. i <= n + ==> ITER i (rho_node1 FF) w IN + affine hull {vec 0,w,rho_node1 FF w}) /\ + (!i. i <= m + ==> ITER i (rho_node1 FF) z IN + affine hull {vec 0,w,ivs_rho_node1 FF w})` + STRIP_ASSUME_TAC THENL + [SIMP_TAC[ARITH_RULE `i <= n <=> i = 0 \/ i = n \/ 0 < i /\ i < n`] THEN + CONJ_TAC THEN UNDISCH_TAC `collinear {vec 0:real^3, w, z}` THEN + ASM_SIMP_TAC[COLLINEAR_3_AFFINE_HULL] THEN DISCH_TAC THEN + (X_GEN_TAC `i:num` THEN STRIP_TAC THEN + ASM_SIMP_TAC[ITER; HULL_INC; IN_INSERT] THENL + [FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (SET_RULE + `z IN P hull s ==> P hull s SUBSET P hull t ==> z IN P hull t`)) THEN + MATCH_MP_TAC HULL_MONO THEN SET_TAC[]; + FIRST_ASSUM(MATCH_MP_TAC o MATCH_MP (SET_RULE + `{f i | P i} = s INTER t + ==> P k /\ s SUBSET s' ==> f k IN s'`)) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC(GEN_ALL(ISPECL [`sgn_gt`; `u:real^3->bool`] + AFFSIGN_EQ_AFFINE_HULL)) THEN REWRITE_TAC[aff_gt_def] THEN + DISCH_THEN(fun th -> REWRITE_TAC[GSYM th]) THEN + MATCH_MP_TAC AFFSIGN_MONO_SHUFFLE THEN SET_TAC[]]); + ALL_TAC] THEN + FIRST_ASSUM(MP_TAC o MATCH_MP (GEN_ALL (ONCE_REWRITE_RULE[IMP_CONJ] + Local_lemmas.RHO_NODE1_MONO_WITH_AZIM))) THEN + DISCH_THEN(fun th -> + MP_TAC(SPECL [`{ITER i (rho_node1 FF) z | i <= m}`; + `affine hull {vec 0, w, ivs_rho_node1 FF w}`; + `m:num`; `z cross rho_node1 FF z`; `z:real^3`] th) THEN + MP_TAC(SPECL [`{ITER i (rho_node1 FF) w | i <= n}`; + `affine hull {vec 0, w, rho_node1 FF w}`; + `n:num`; `w cross rho_node1 FF w`; `w:real^3`] th)) THEN + ASM_REWRITE_TAC[PLANE_AFFINE_HULL_3; SUBSET; FORALL_IN_GSPEC] THEN + SIMP_TAC[HULL_INC; IN_INSERT] THEN ANTS_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2]; + DISCH_THEN(LABEL_TAC "W")] THEN + ANTS_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOFA_IMP_NOT_COLL_IVS]; + DISCH_THEN(LABEL_TAC "Z")] THEN + SUBGOAL_THEN + `!i. i <= m + ==> ITER i (rho_node1 FF) z IN affine hull {vec 0,z,rho_node1 FF z}` + ASSUME_TAC THENL + [FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (SET_RULE + `(!x. P x ==> f x IN s) + ==> P 0 /\ P(SUC 0) /\ (f 0 IN s /\ f(SUC 0) IN s ==> s = t) + ==> (!x. P x ==> f x IN t)`)) THEN + REPEAT(CONJ_TAC THENL [ASM_ARITH_TAC; ALL_TAC]) THEN + REWRITE_TAC[ITER] THEN STRIP_TAC THEN + MATCH_MP_TAC AFFINE_HULL_3_GENERATED THEN + ASM_SIMP_TAC[INSERT_SUBSET; EMPTY_SUBSET; HULL_INC; IN_INSERT] THEN + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2]; + ALL_TAC] THEN + SUBGOAL_THEN + `(!i. i <= n - 1 + ==> azim (vec 0) (w cross rho_node1 FF w) + (ITER i (rho_node1 FF) w) + (ITER (i + 1) (rho_node1 FF) w) = + azim (vec 0) (w cross rho_node1 FF w) + w (ITER (i + 1) (rho_node1 FF) w) - + azim (vec 0) (w cross rho_node1 FF w) + w (ITER i (rho_node1 FF) w)) /\ + (!i. i <= m - 1 + ==> azim (vec 0) (z cross rho_node1 FF z) + (ITER i (rho_node1 FF) z) + (ITER (i + 1) (rho_node1 FF) z) = + azim (vec 0) (z cross rho_node1 FF z) + z (ITER (i + 1) (rho_node1 FF) z) - + azim (vec 0) (z cross rho_node1 FF z) + z (ITER i (rho_node1 FF) z))` + STRIP_ASSUME_TAC THENL + [CONJ_TAC THEN + (REWRITE_TAC[REAL_ARITH `a:real = b - c <=> b = c + a`] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC Fan.sum4_azim_fan THEN + CONJ_TAC THENL + [MATCH_MP_TAC REAL_LT_IMP_LE THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_ARITH_TAC; + REPEAT CONJ_TAC THEN MATCH_MP_TAC lemma2 THEN + ASM_SIMP_TAC[HULL_INC; IN_INSERT] THEN + TRY + (CONJ_TAC THENL + [FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; ALL_TAC] THEN + CONJ_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2]; + ALL_TAC] THEN + MATCH_MP_TAC(MESON[] + `!V. ~(z IN V) /\ w IN V ==> ~(w = z)`) THEN + EXISTS_TAC `V:real^3->bool` THEN CONJ_TAC THENL + [ASM_MESON_TAC[Fan.fan2; Fan.FAN]; + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V]]) THEN + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2]]); + ALL_TAC] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC + `sum (0..n - 1) + (\i. azim (vec 0) (w cross rho_node1 FF w) + (ITER i (rho_node1 FF) w) + (ITER (i + 1) (rho_node1 FF) w)) + + sum (0..m - 1) + (\i. azim (vec 0) (z cross rho_node1 FF z) + (ITER i (rho_node1 FF) z) + (ITER (i + 1) (rho_node1 FF) z))` THEN + CONJ_TAC THENL + [MATCH_MP_TAC REAL_EQ_IMP_LE THEN BINOP_TAC THEN + MATCH_MP_TAC SUM_EQ_NUMSEG THEN X_GEN_TAC `i:num` THEN + STRIP_TAC THEN REWRITE_TAC[] THEN CONV_TAC SYM_CONV THEN + MATCH_MP_TAC AZIM_ARCV THEN REWRITE_TAC[VECTOR_SUB_RZERO] THEN + (REPEAT CONJ_TAC THENL + [MATCH_MP_TAC lemma1 THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; + MATCH_MP_TAC lemma1 THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; + MATCH_MP_TAC lemma2 THEN CONJ_TAC THENL + [FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; ALL_TAC] THEN + CONJ_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2]; + ALL_TAC] THEN + MATCH_MP_TAC(MESON[] + `!V. ~(z IN V) /\ w IN V ==> ~(w = z)`) THEN + EXISTS_TAC `V:real^3->bool` THEN CONJ_TAC THENL + [ASM_MESON_TAC[Fan.fan2; Fan.FAN]; + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V]]; + MATCH_MP_TAC lemma2 THEN CONJ_TAC THENL + [FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_ARITH_TAC; ALL_TAC] THEN + CONJ_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2]; + ALL_TAC] THEN + MATCH_MP_TAC(MESON[] + `!V. ~(z IN V) /\ w IN V ==> ~(w = z)`) THEN + EXISTS_TAC `V:real^3->bool` THEN CONJ_TAC THENL + [ASM_MESON_TAC[Fan.fan2; Fan.FAN]; + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V]]; + ALL_TAC]) THEN + ASM_SIMP_TAC[] THEN MATCH_MP_TAC(REAL_ARITH + `&0 <= y /\ x <= pi ==> x - y <= pi`) THEN + REWRITE_TAC[azim] THEN MATCH_MP_TAC REAL_LE_TRANS THENL + [EXISTS_TAC + `azim (vec 0) (w cross rho_node1 FF w) + w (ITER n (rho_node1 FF) w)`; + EXISTS_TAC + `azim (vec 0) (z cross rho_node1 FF z) + z (ITER m (rho_node1 FF) z)`] THEN + (CONJ_TAC THENL + [FIRST_ASSUM(MP_TAC o MATCH_MP (ARITH_RULE + `i <= n - 1 ==> ~(n = 0) ==> i + 1 = n \/ i + 1 < n`)) THEN + ANTS_TAC THENL [ASM_REWRITE_TAC[]; ALL_TAC] THEN + STRIP_TAC THENL [ASM_REWRITE_TAC[REAL_LE_REFL]; ALL_TAC] THEN + MATCH_MP_TAC REAL_LT_IMP_LE THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_ARITH_TAC; + ASM_REWRITE_TAC[]]) THEN + MATCH_MP_TAC(REAL_ARITH + `&0 < pi /\ (x = &0 \/ x = pi) ==> x <= pi`); + ASM_SIMP_TAC[] THEN REWRITE_TAC[SUM_DIFFS_ALT; LE_0] THEN + REWRITE_TAC[ITER; AZIM_REFL] THEN + ASM_SIMP_TAC[SUB_ADD; LE_1; REAL_SUB_RZERO] THEN + MATCH_MP_TAC(REAL_ARITH + `&0 < pi /\ (x = &0 \/ x = pi) /\ (y = &0 \/ y = pi) + ==> x + y <= &2 * pi`)] THEN + REWRITE_TAC[PI_POS] THEN REPEAT CONJ_TAC THEN + MATCH_MP_TAC COLLINEAR_AZIM_0_OR_PI THEN + ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC] THEN + DISCH_TAC THEN + ASM_CASES_TAC `!v. v IN V ==> interior_angle1 (vec 0) FF v < pi` THENL + [SUBGOAL_THEN `?vef. vef = polar_fan(V,E,FF)` MP_TAC THENL + [REWRITE_TAC[EXISTS_REFL]; REWRITE_TAC[EXISTS_PAIR_THM]] THEN + FIRST_ASSUM(MP_TAC o MATCH_MP (ONCE_REWRITE_RULE[IMP_CONJ] BGMIFTE)) THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN + MATCH_MP_TAC MONO_FORALL THEN X_GEN_TAC `V':real^3->bool` THEN + MATCH_MP_TAC MONO_FORALL THEN X_GEN_TAC `E':(real^3->bool)->bool` THEN + MATCH_MP_TAC MONO_FORALL THEN X_GEN_TAC `FF':real^3#real^3->bool` THEN + DISCH_THEN(fun th -> DISCH_THEN(ASSUME_TAC o SYM) THEN MP_TAC th) THEN + ASM_REWRITE_TAC[] THEN + REPEAT LET_TAC THEN STRIP_TAC THEN MP_TAC(ISPECL + [`V':real^3->bool`; `E':(real^3->bool)->bool`; `FF':real^3#real^3->bool`] + Localization.NKEZBFC) THEN + ASM_REWRITE_TAC[] THEN + FIRST_ASSUM(SUBST1_TAC o + MATCH_MP Nkezbfc_local.SOL_LOFA_EQ_SUM_INANGLE) THEN + MATCH_MP_TAC(REAL_ARITH + `--s = t ==> &0 <= &2 * pi + s ==> t <= &2 * pi`) THEN + REWRITE_TAC[GSYM SUM_NEG; REAL_NEG_SUB] THEN + SUBGOAL_THEN `V' = IMAGE (prime:real^3->real^3) V` SUBST1_TAC THENL + [FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE LAND_CONV [JNVXCRC]) THEN + CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN + ASM_REWRITE_TAC[PAIR_EQ] THEN ASM SET_TAC[]; + ALL_TAC] THEN + W(MP_TAC o PART_MATCH (lhand o rand) SUM_IMAGE o lhand o goal_concl) THEN + ANTS_TAC THENL + [SUBGOAL_THEN + `!x y. x IN V /\ y IN V /\ ~(x = y) + ==> ~collinear{vec 0,(prime:real^3->real^3) x,prime y}` + MP_TAC THENL + [ALL_TAC; ASM_MESON_TAC[INSERT_AC; COLLINEAR_2]] THEN + REPEAT GEN_TAC THEN STRIP_TAC THEN + REWRITE_TAC[GSYM CROSS_EQ_0] THEN EXPAND_TAC "prime" THEN + REWRITE_TAC[lemma3; VECTOR_SUB_EQ] THEN + DISCH_THEN(MP_TAC o MATCH_MP lemma4) THEN + REWRITE_TAC[DE_MORGAN_THM] THEN CONJ_TAC THENL + [ALL_TAC; + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE]] THEN + SUBGOAL_THEN `~(x:real^3 = r y /\ y = r x)` MP_TAC THENL + [EXPAND_TAC "r" THEN + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE]; + REWRITE_TAC[DE_MORGAN_THM] THEN MATCH_MP_TAC MONO_OR THEN + CONJ_TAC THEN DISCH_TAC THEN MATCH_MP_TAC REAL_LT_IMP_NZ THEN + REWRITE_TAC[GSYM Local_lemmas.SIN_AZIM_MUTUAL_SROSS] THEN + EXPAND_TAC "r" THEN MATCH_MP_TAC GENERIC_LOCAL_FAN_AZIM_POS THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `E:(real^3->bool)->bool`] THEN + ASM_REWRITE_TAC[] THEN EXPAND_TAC "r" THEN + ASM_MESON_TAC[RHO_NODE1_INJECTIVE; + Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]]; + ALL_TAC] THEN + DISCH_THEN SUBST1_TAC THEN REWRITE_TAC[o_DEF] THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `sum V (\v:real^3. arcV (vec 0) v (r v))` THEN CONJ_TAC THENL + [MATCH_MP_TAC SUM_EQ THEN ASM_MESON_TAC[]; ALL_TAC] THEN + FIRST_ASSUM(SUBST1_TAC o MATCH_MP Local_lemmas.LOFA_IMP_CARD_FF_V_EQ) THEN + CONV_TAC SYM_CONV THEN MATCH_MP_TAC SUM_EQ_GENERAL THEN + EXISTS_TAC `\i. ITER i r (v:real^3)` THEN + REWRITE_TAC[GSYM ADD1; ITER] THEN + UNDISCH_THEN `rho_node1 FF = r` (SUBST_ALL_TAC o SYM) THEN CONJ_TAC THENL + [ALL_TAC; ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_ITER_RHO_NODE_IN_V]] THEN + X_GEN_TAC `w:real^3` THEN + ASM_CASES_TAC `V:real^3->bool = {}` THEN ASM_REWRITE_TAC[NOT_IN_EMPTY] THEN + DISCH_TAC THEN + SUBGOAL_THEN `~(CARD(V:real^3->bool) = 0)` ASSUME_TAC THENL + [FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [Fan.FAN]) THEN + ASM_SIMP_TAC[Fan.fan1; CARD_EQ_0]; + ALL_TAC] THEN + ASM_SIMP_TAC[IN_NUMSEG; EXISTS_UNIQUE_DEF; LE_0; ARITH_RULE + `~(n = 0) ==> (i <= n - 1 <=> i < n)`] THEN + ASM_MESON_TAC[Local_lemmas1.LT_CARD_MONO_LOFA; + Local_lemmas1.POINT_PRESENTED_IN_RHOND1]; + ALL_TAC] THEN + UNDISCH_THEN `(v:real^3) IN V` (K ALL_TAC) THEN + FIRST_X_ASSUM(fun th -> GEN_REWRITE_TAC LAND_CONV [SYM th]) THEN + POP_ASSUM_LIST(MP_TAC o end_itlist CONJ o rev) THEN STRIP_TAC THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [NOT_FORALL_THM]) THEN + REWRITE_TAC[NOT_IMP] THEN + DISCH_THEN(X_CHOOSE_THEN `v:real^3` STRIP_ASSUME_TAC) THEN + FIRST_X_ASSUM(MP_TAC o MATCH_MP (REAL_ARITH + `~(a < pi) ==> a <= pi ==> a = pi`)) THEN + ANTS_TAC THENL + [ASM_MESON_TAC[Local_lemmas.CONVEX_LOFA_IMP_INANGLE_LE_PI]; DISCH_TAC] THEN + SUBGOAL_THEN `FINITE(V:real^3->bool)` ASSUME_TAC THENL + [ASM_MESON_TAC[Fan.FAN; Fan.fan1]; ALL_TAC] THEN + DISJ_CASES_TAC(ARITH_RULE `CARD(V:real^3->bool) <= 2 \/ 3 <= CARD V`) THENL + [FIRST_ASSUM(MP_TAC o SPEC `v:real^3` o MATCH_MP + (ONCE_REWRITE_RULE[IMP_CONJ] FAN_PERIMETER_INVARIANT)) THEN + FIRST_ASSUM(SUBST1_TAC o MATCH_MP Local_lemmas.LOFA_IMP_CARD_FF_V_EQ) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN SUBST1_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `sum (0..CARD(V:real^3->bool) - 1) (\i. pi)` THEN + CONJ_TAC THENL + [MATCH_MP_TAC SUM_LE_NUMSEG THEN + REWRITE_TAC[Local_lemmas1.ARCV_BOUNDS]; + SIMP_TAC[SUM_CONST_NUMSEG; REAL_LE_RMUL_EQ; PI_POS] THEN + REWRITE_TAC[REAL_OF_NUM_LE] THEN ASM_ARITH_TAC]; + ALL_TAC] THEN + ABBREV_TAC `V' = V DIFF {v:real^3}` THEN + ABBREV_TAC `r = \u. if rho_node1 FF u = v then rho_node1 FF v + else rho_node1 FF u` THEN + ABBREV_TAC `E' = {{v,r v} | (v:real^3) IN V'}` THEN + ABBREV_TAC `FF' = {(v,(r:real^3->real^3) v) | v IN V'}` THEN + SUBGOAL_THEN `!w:real^3. w IN V' ==> r w IN V'` ASSUME_TAC THENL + [EXPAND_TAC "V'" THEN REWRITE_TAC[IN_DIFF; IN_SING] THEN + GEN_TAC THEN STRIP_TAC THEN EXPAND_TAC "r" THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE; + Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]; + ALL_TAC] THEN + SUBGOAL_THEN + `!x y. x IN V' /\ y IN V' ==> ((r:real^3->real^3) x = r y <=> x = y)` + ASSUME_TAC THENL + [EXPAND_TAC "V'" THEN REWRITE_TAC[IN_DIFF; IN_SING] THEN + REPEAT STRIP_TAC THEN EQ_TAC THEN SIMP_TAC[] THEN + EXPAND_TAC "r" THEN + REPEAT(COND_CASES_TAC THEN ASM_REWRITE_TAC[]) THEN + ASM_MESON_TAC[RHO_NODE1_INJECTIVE]; + ALL_TAC] THEN + SUBGOAL_THEN `!w:real^3. w IN V' ==> ~(r w = w)` ASSUME_TAC THENL + [EXPAND_TAC "V'" THEN REWRITE_TAC[IN_DIFF; IN_SING] THEN + GEN_TAC THEN STRIP_TAC THEN EXPAND_TAC "r" THEN + COND_CASES_TAC THEN + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE; + Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE]; + ALL_TAC] THEN + SUBGOAL_THEN `!w. w IN V' ==> rho_node1 FF' w = r w` ASSUME_TAC THENL + [EXPAND_TAC "FF'" THEN REWRITE_TAC[Localization.rho_node1] THEN + REWRITE_TAC[IN_ELIM_THM; PAIR_EQ] THEN ASM_MESON_TAC[]; + ALL_TAC] THEN + SUBGOAL_THEN `FINITE V' /\ CARD(V':real^3->bool) + 1 = CARD(V:real^3->bool)` + STRIP_ASSUME_TAC THENL + [EXPAND_TAC "V'" THEN REWRITE_TAC[SET_RULE `s DIFF {a} = s DELETE a`] THEN + ASM_SIMP_TAC[FINITE_DELETE; CARD_DELETE] THEN + ASM_SIMP_TAC[ARITH_RULE `v - 1 + 1 = v <=> ~(v = 0)`; CARD_EQ_0] THEN + ASM SET_TAC[]; + ALL_TAC] THEN + SUBGOAL_THEN `CARD(V':real^3->bool) < CARD(V:real^3->bool)` ASSUME_TAC THENL + [ASM_ARITH_TAC; ASM_REWRITE_TAC[]] THEN + UNDISCH_TAC `interior_angle1 (vec 0) FF v = pi` THEN + FIRST_ASSUM(fun th -> + W(MP_TAC o PART_MATCH (lhand o rand) + (MATCH_MP Nkezbfc_local.CONVEX_LOFA_IMP_INANGLE_EQ_AZIM_IVS th) o + lhand o lhand o goal_concl)) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN SUBST1_TAC THEN DISCH_TAC THEN + SUBGOAL_THEN `v IN aff_ge {vec 0} {ivs_rho_node1 FF v, rho_node1 FF v}` + ASSUME_TAC THENL + [MATCH_MP_TAC GENERIC_LOCAL_FAN_STRAIGHT_AFF_GE THEN + CONJ_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOFA_IMP_NOT_COLL_IVS]; ALL_TAC] THEN + CONJ_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2]; + ASM_REWRITE_TAC[]] THEN + FIRST_X_ASSUM(MATCH_MP_TAC o GEN_REWRITE_RULE I + [Localization.generic]) THEN + CONJ_TAC THENL + [ASM_MESON_TAC[Local_lemmas1.LOCAL_RHO_NODE_PAIR_E; IN_DIFF]; + ASM_MESON_TAC[IVS_RHO_NODE1_IN_V]]; + ALL_TAC] THEN + SUBGOAL_THEN + `fan_perimeter (V,E,FF) = + sum V' (\v. arcV (vec 0) v (rho_node1 FF' v))` + SUBST1_TAC THENL + [MP_TAC(ISPECL + [`V:real^3->bool`; `E:(real^3->bool)->bool`; `FF:real^3#real^3->bool`] + FAN_PERIMETER) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN SUBST1_TAC THEN + SUBGOAL_THEN `V = (v:real^3) INSERT V'` SUBST1_TAC THENL + [ASM SET_TAC[]; ALL_TAC] THEN + ASM_SIMP_TAC[SUM_CLAUSES] THEN + COND_CASES_TAC THENL [ASM SET_TAC[]; ALL_TAC] THEN + ABBREV_TAC `u = ivs_rho_node1 FF v` THEN + SUBGOAL_THEN `(u:real^3) IN V'` ASSUME_TAC THENL + [EXPAND_TAC "V'" THEN REWRITE_TAC[IN_DIFF; IN_SING] THEN + EXPAND_TAC "u" THEN + ASM_MESON_TAC[Local_lemmas1.IVS_RHO_NODE_DIFF_ID; + IVS_RHO_NODE1_IN_V]; + ALL_TAC] THEN + SUBGOAL_THEN `V' = (u:real^3) INSERT (V' DELETE u)` SUBST1_TAC THENL + [ASM SET_TAC[]; ASM_SIMP_TAC[SUM_CLAUSES; FINITE_DELETE]] THEN + REWRITE_TAC[IN_DELETE] THEN MATCH_MP_TAC(REAL_ARITH + `s' = s /\ a + b = c + ==> b + a + s' = c + s`) THEN + CONJ_TAC THENL + [MATCH_MP_TAC SUM_EQ THEN ASM_SIMP_TAC[IN_DELETE] THEN + X_GEN_TAC `w:real^3` THEN STRIP_TAC THEN EXPAND_TAC "r" THEN + COND_CASES_TAC THEN REWRITE_TAC[] THEN + MAP_EVERY UNDISCH_TAC [`(u:real^3) IN V'`; `(w:real^3) IN V'`] THEN + EXPAND_TAC "V'" THEN REWRITE_TAC[IN_DIFF; IN_SING] THEN + REPEAT STRIP_TAC THEN + ASM_MESON_TAC[RHO_NODE1_INJECTIVE; + Local_lemmas1.LOCAL_FAN_RHO_NODE_IVS]; + ALL_TAC] THEN + EXPAND_TAC "r" THEN REWRITE_TAC[] THEN COND_CASES_TAC THENL + [ALL_TAC; ASM_MESON_TAC[Local_lemmas1.LOCAL_FAN_RHO_NODE_IVS]] THEN + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[ARCV_ANGLE] THEN MATCH_MP_TAC ANGLES_ADD_AFF_GE THEN + REPEAT(CONJ_TAC THENL + [RULE_ASSUM_TAC(REWRITE_RULE[Fan.fan2; Fan.FAN]) THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; IN_DIFF]; + ALL_TAC]) THEN + ASM_MESON_TAC[]; + ALL_TAC] THEN + DISJ_CASES_TAC(ARITH_RULE `CARD(V':real^3->bool) <= 2 \/ 3 <= CARD V'`) THENL + [MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `sum (V':real^3->bool) (\i. pi)` THEN CONJ_TAC THENL + [MATCH_MP_TAC SUM_LE THEN ASM_SIMP_TAC[Local_lemmas1.ARCV_BOUNDS]; + ASM_SIMP_TAC[SUM_CONST; REAL_LE_RMUL_EQ; PI_POS] THEN + REWRITE_TAC[REAL_OF_NUM_LE] THEN ASM_ARITH_TAC]; + ALL_TAC] THEN + SUBGOAL_THEN `convex_local_fan (V',E',FF')` ASSUME_TAC THENL + [ALL_TAC; + MP_TAC(ISPECL + [`V':real^3->bool`; `E':(real^3->bool)->bool`; `FF':real^3#real^3->bool`] + FAN_PERIMETER) THEN + ASM_SIMP_TAC[Local_lemmas.CVX_LO_IMP_LO] THEN + DISCH_THEN(SUBST1_TAC o SYM) THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]] THEN + FIRST_ASSUM(MP_TAC o MATCH_MP (ARITH_RULE `3 <= n ==> ~(n = 0)`)) THEN + ASM_SIMP_TAC[CARD_EQ_0] THEN DISCH_TAC THEN + SUBGOAL_THEN `~((vec 0:real^3) IN V')` ASSUME_TAC THENL + [EXPAND_TAC "V'" THEN REWRITE_TAC[IN_DIFF] THEN + ASM_MESON_TAC[Fan.FAN; Fan.fan2]; + ALL_TAC] THEN + SUBGOAL_THEN `FAN(vec 0:real^3,V',E')` ASSUME_TAC THENL + [REWRITE_TAC[FAN_ECONOMIZED_SIMPLE] THEN REPEAT CONJ_TAC THENL + [EXPAND_TAC "E'" THEN REWRITE_TAC[UNIONS_SUBSET; FORALL_IN_GSPEC] THEN + ASM_SIMP_TAC[INSERT_SUBSET; EMPTY_SUBSET]; + EXPAND_TAC "E'" THEN REWRITE_TAC[Fan.GRAPH; FORALL_IN_GSPEC] THEN + ASM_SIMP_TAC[Local_lemmas1.SET2_HAS_SIZE2]; + REWRITE_TAC[Fan.fan1] THEN ASM SET_TAC[]; + ASM_REWRITE_TAC[Fan.fan2]; + EXPAND_TAC "E'" THEN REWRITE_TAC[Fan.fan6; FORALL_IN_GSPEC] THEN + X_GEN_TAC `u:real^3` THEN REWRITE_TAC[INSERT_UNION_EQ; UNION_EMPTY] THEN + EXPAND_TAC "V'" THEN REWRITE_TAC[IN_DIFF; IN_SING] THEN STRIP_TAC THEN + EXPAND_TAC "r" THEN COND_CASES_TAC THENL + [ALL_TAC; + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2]] THEN + DISCH_TAC THEN + FIRST_ASSUM(MP_TAC o MATCH_MP (ONCE_REWRITE_RULE[IMP_CONJ] + (GEN_ALL Local_lemmas.FAN_SUB_NOT_EQ_COLL_IN_CONV0))) THEN + DISCH_THEN(MP_TAC o SPECL [`u:real^3`; `rho_node1 FF v`]) THEN + ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; NOT_IMP] THEN + CONJ_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE; + Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]; + ALL_TAC] THEN + REWRITE_TAC[Collect_geom.CONV0_SET2; IN_ELIM_THM] THEN + FIRST_X_ASSUM(MP_TAC o + SPECL [`v:real^3`; `rho_node1 FF v`; `u:real^3`] o + GEN_REWRITE_RULE I [Localization.generic]) THEN + ANTS_TAC THENL + [ASM_MESON_TAC[Local_lemmas1.LOCAL_RHO_NODE_PAIR_E]; ALL_TAC] THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[LEFT_IMP_EXISTS_THM; GSYM MEMBER_NOT_EMPTY] THEN + MAP_EVERY X_GEN_TAC [`a:real`; `b:real`] THEN + REPEAT(DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + DISCH_THEN(ASSUME_TAC o SYM) THEN + SUBGOAL_THEN + `~(u:real^3 = vec 0) /\ ~(v = vec 0) /\ ~(rho_node1 FF v = vec 0)` + STRIP_ASSUME_TAC THENL + [FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [Fan.FAN]) THEN + REWRITE_TAC[Fan.fan2] THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]; + ASM_SIMP_TAC[AFF_GE_1_2_0; IN_INTER; EXISTS_IN_GSPEC] THEN + MAP_EVERY EXISTS_TAC [`&0`; `b:real`] THEN + ASM_SIMP_TAC[REAL_LE_REFL; REAL_LT_IMP_LE] THEN + ASM_SIMP_TAC[AFF_LT_1_1; SET_RULE `DISJOINT {a} {b} <=> ~(a = b)`] THEN + REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_MUL_RZERO; IN_ELIM_THM] THEN + MAP_EVERY EXISTS_TAC [`&1 + a`; `--a`] THEN + REPEAT(CONJ_TAC THENL [ASM_REAL_ARITH_TAC; ALL_TAC]) THEN + ASM_REWRITE_TAC[VECTOR_ARITH + `vec 0 + a:real^N = vec 0 + --x % b <=> x % b + a = vec 0`]]; + SUBGOAL_THEN + `E' SUBSET {ivs_rho_node1 FF v,rho_node1 FF v} INSERT E` + MP_TAC THENL + [EXPAND_TAC "E'" THEN REWRITE_TAC[FORALL_IN_GSPEC; SUBSET] THEN + X_GEN_TAC `w:real^3` THEN EXPAND_TAC "V'" THEN + REWRITE_TAC[IN_DIFF; IN_SING] THEN STRIP_TAC THEN + REWRITE_TAC[IN_INSERT] THEN + EXPAND_TAC "r" THEN COND_CASES_TAC THENL + [DISJ1_TAC THEN BINOP_TAC THEN REWRITE_TAC[] THEN + ASM_MESON_TAC[Local_lemmas.IVS_RHO_IDD]; + DISJ2_TAC THEN ASM_MESON_TAC[Local_lemmas1.LOCAL_RHO_NODE_PAIR_E]]; + REWRITE_TAC[SUBSET; IN_INSERT; IN_UNION]] THEN + MATCH_MP_TAC lemma5 THEN CONJ_TAC THENL [SET_TAC[]; ALL_TAC] THEN + CONJ_TAC THENL + [FIRST_ASSUM(MP_TAC o GEN_REWRITE_RULE I [FAN_ECONOMIZED_SIMPLE]) THEN + DISCH_THEN(MP_TAC o last o CONJUNCTS) THEN EXPAND_TAC "V'" THEN + SET_TAC[]; + ALL_TAC] THEN + X_GEN_TAC `e:real^3->bool` THEN + SIMP_TAC[SET_RULE `s INTER {a,b} = {} <=> ~(a IN s) /\ ~(b IN s)`] THEN + SUBGOAL_THEN + `aff_ge {vec 0} {ivs_rho_node1 FF v, rho_node1 FF v} = + aff_ge {vec 0} {ivs_rho_node1 FF v, v} UNION + aff_ge {vec 0} {v, rho_node1 FF v}` + SUBST1_TAC THENL + [CONV_TAC SYM_CONV THEN MATCH_MP_TAC UNION_AFF_GE_1_2 THEN + ASM_REWRITE_TAC[] THEN + RULE_ASSUM_TAC(REWRITE_RULE[Fan.fan2; Fan.FAN]) THEN + ASM_MESON_TAC[IVS_RHO_NODE1_IN_V; + Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V]; + ALL_TAC] THEN + DISCH_THEN(REPEAT_TCL CONJUNCTS_THEN ASSUME_TAC) THEN + MATCH_MP_TAC(SET_RULE + `s INTER t = u /\ s INTER t' = u ==> s INTER (t UNION t') = u`) THEN + FIRST_ASSUM(MP_TAC o GEN_REWRITE_RULE I [FAN_ECONOMIZED_SIMPLE]) THEN + DISCH_THEN(MP_TAC o last o CONJUNCTS) THEN + DISCH_THEN(fun th -> CONJ_TAC THEN MATCH_MP_TAC th) THEN + (CONJ_TAC THENL [ASM SET_TAC[]; ALL_TAC]) THEN + ASM_REWRITE_TAC[SET_RULE + `s INTER {a,b} = {} <=> ~(a IN s) /\ ~(b IN s)`] THEN + (CONJ_TAC THENL + [REWRITE_TAC[IN_UNION] THEN DISJ1_TAC THEN + ASM_MESON_TAC[Tecoxbm.IVS_RHO_NODE_IN_EDGE; + Local_lemmas1.LOCAL_RHO_NODE_PAIR_E; + SET_RULE `{a,b} = {b,a}`]; + ALL_TAC]) THEN + FIRST_X_ASSUM(DISJ_CASES_THEN MP_TAC) THEN + SIMP_TAC[IN_ELIM_THM; LEFT_IMP_EXISTS_THM] THEN + EXPAND_TAC "V'" THEN SIMP_TAC[IN_SING; IN_DIFF] THEN + EXPAND_TAC "E'" THEN REWRITE_TAC[IN_ELIM_THM] THEN + EXPAND_TAC "V'" THEN REWRITE_TAC[IN_DIFF; IN_SING] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY] THEN + EXPAND_TAC "r" THEN COND_CASES_TAC THEN + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE]]; + ALL_TAC] THEN + MP_TAC(ISPECL [`V':real^3->bool`; `r:real^3->real^3`] + SURJECTIVE_IFF_INJECTIVE) THEN + ANTS_TAC THENL [ASM SET_TAC[]; ALL_TAC] THEN + DISCH_THEN(MP_TAC o snd o EQ_IMP_RULE) THEN + ANTS_TAC THENL [ASM_MESON_TAC[]; REWRITE_TAC[RIGHT_IMP_EXISTS_THM]] THEN + REWRITE_TAC[SKOLEM_THM; LEFT_IMP_EXISTS_THM] THEN + X_GEN_TAC `r':real^3->real^3` THEN + REWRITE_TAC[TAUT `p ==> q /\ r <=> (p ==> q) /\ (p ==> r)`] THEN + REWRITE_TAC[FORALL_AND_THM] THEN STRIP_TAC THEN + SUBGOAL_THEN + `!x y. x IN V' /\ y IN V' ==> ((r':real^3->real^3) x = r' y <=> x = y)` + ASSUME_TAC THENL [ASM_MESON_TAC[]; ALL_TAC] THEN + SUBGOAL_THEN + `!x. x IN V' ==> (r':real^3->real^3)(r x) = x` + ASSUME_TAC THENL [ASM_MESON_TAC[]; ALL_TAC] THEN + SUBGOAL_THEN `local_fan(V':real^3->bool,E',FF')` ASSUME_TAC THENL + [ASM_REWRITE_TAC[Wrgcvdr_cizmrrh.local_fan] THEN + LET_TAC THEN EXPAND_TAC "H" THEN REWRITE_TAC[Wrgcvdr_cizmrrh.dih2k] THEN + REWRITE_TAC[Hypermap.face; Hypermap.face_map] THEN FIRST_ASSUM + (fun th -> REWRITE_TAC[MATCH_MP Wrgcvdr_cizmrrh.HYP_LEMMA th] THEN + REWRITE_TAC[MATCH_MP Wrgcvdr_cizmrrh.ELMS_OF_HYPERMAP_HYP th]) THEN + REWRITE_TAC[Wrgcvdr_cizmrrh.HYP] THEN + ABBREV_TAC `FF'' = { ((r:real^3->real^3) v,v) | v IN V'}` THEN + SUBGOAL_THEN `darts_of_hyp E' (V':real^3->bool) = FF' UNION FF''` + (fun th -> SUBST1_TAC th THEN ASSUME_TAC th) + THENL + [REWRITE_TAC[Wrgcvdr_cizmrrh.darts_of_hyp; Wrgcvdr_cizmrrh.ord_pairs; + Wrgcvdr_cizmrrh.self_pairs; Wrgcvdr_cizmrrh.EE] THEN + MATCH_MP_TAC(SET_RULE `t = {} /\ s = u ==> s UNION t = u`) THEN + CONJ_TAC THENL + [PURE_REWRITE_TAC[SET_RULE `s = {} <=> !x. x IN s ==> F`] THEN + PURE_REWRITE_TAC[FORALL_IN_GSPEC] THEN + X_GEN_TAC `w:real^3` THEN DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC + (MP_TAC o SPEC `(r:real^3->real^3) w`)) THEN + EXPAND_TAC "E'" THEN ASM SET_TAC[]; + EXPAND_TAC "E'" THEN REWRITE_TAC[IN_ELIM_THM] THEN + REWRITE_TAC[SET_RULE + `{a,b} = {c,d} <=> a = c /\ b = d \/ a = d /\ b = c`] THEN + MAP_EVERY EXPAND_TAC ["FF'"; "FF''"] THEN SET_TAC[]]; + ASM_REWRITE_TAC[]] THEN + SUBGOAL_THEN + `!w:real^3. w IN V' ==> EE w E' = {r w,(r':real^3->real^3) w}` + ASSUME_TAC THENL + [X_GEN_TAC `w:real^3 ` THEN DISCH_TAC THEN + REWRITE_TAC[PAIR_EQ; Wrgcvdr_cizmrrh.EE] THEN EXPAND_TAC "E'" THEN + REWRITE_TAC[IN_ELIM_THM; SET_RULE + `{a,b} = {c,d} <=> a = c /\ b = d \/ a = d /\ b = c`] THEN + ASM SET_TAC[]; + ALL_TAC] THEN + SUBGOAL_THEN `!n w. w IN V' ==> ITER n (r:real^3->real^3) w IN V'` + ASSUME_TAC THENL + [INDUCT_TAC THEN REWRITE_TAC[ITER] THEN ASM SET_TAC[]; ALL_TAC] THEN + SUBGOAL_THEN `!n w. w IN V' ==> ITER n (r':real^3->real^3) w IN V'` + ASSUME_TAC THENL + [INDUCT_TAC THEN REWRITE_TAC[ITER] THEN ASM SET_TAC[]; ALL_TAC] THEN + SUBGOAL_THEN + `!n w. w IN V' + ==> ITER n (ff_of_hyp (vec 0,V',E')) (w,r w) = + (ITER n r w,r(ITER n r w))` + ASSUME_TAC THENL + [ONCE_REWRITE_TAC[SWAP_FORALL_THM] THEN + REWRITE_TAC[RIGHT_FORALL_IMP_THM] THEN GEN_TAC THEN DISCH_TAC THEN + INDUCT_TAC THEN ASM_REWRITE_TAC[ITER] THEN + ASM_REWRITE_TAC[ff_of_hyp3; IN_UNION] THEN + COND_CASES_TAC THENL + [SUBGOAL_THEN `r(ITER n (r:real^3->real^3) w) IN V'` ASSUME_TAC THENL + [ASM_MESON_TAC[]; ALL_TAC] THEN + AP_TERM_TAC THEN MATCH_MP_TAC IVS_AZIM_CYCLE_TWO_POINT_SET_ALT THEN + ASM_SIMP_TAC[] THEN + MATCH_MP_TAC(SET_RULE `a = a' /\ b = b' ==> {a,b} = {b',a'}`) THEN + ASM_MESON_TAC[]; + FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (TAUT + `~(a \/ b) ==> a ==> c`)) THEN + EXPAND_TAC "FF'" THEN REWRITE_TAC[IN_ELIM_THM] THEN + ASM_MESON_TAC[]]; + ALL_TAC] THEN + SUBGOAL_THEN + `!n w. w IN V' + ==> ITER n (ff_of_hyp (vec 0,V',E')) (r w,w) = + r(ITER n r' w),ITER n r' w` + ASSUME_TAC THENL + [ONCE_REWRITE_TAC[SWAP_FORALL_THM] THEN + REWRITE_TAC[RIGHT_FORALL_IMP_THM] THEN GEN_TAC THEN DISCH_TAC THEN + INDUCT_TAC THEN ASM_REWRITE_TAC[ITER] THEN + ASM_REWRITE_TAC[ff_of_hyp3; IN_UNION] THEN + COND_CASES_TAC THENL + [SUBGOAL_THEN `(r:real^3->real^3) + (ITER n (r':real^3->real^3) w) IN V'` ASSUME_TAC THENL + [ASM_MESON_TAC[]; ASM_SIMP_TAC[]] THEN + AP_TERM_TAC THEN MATCH_MP_TAC IVS_AZIM_CYCLE_TWO_POINT_SET_ALT THEN + ASM_SIMP_TAC[] THEN + MATCH_MP_TAC(SET_RULE `a = a' /\ b = b' ==> {a,b} = {b',a'}`) THEN + ASM_MESON_TAC[]; + FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (TAUT + `~(a \/ b) ==> b ==> c`)) THEN + EXPAND_TAC "FF''" THEN REWRITE_TAC[IN_ELIM_THM] THEN + ASM_MESON_TAC[]]; + ALL_TAC] THEN + SUBGOAL_THEN + `(!x:real^3 k. x IN V' /\ 0 < k /\ k < CARD V' ==> ~(ITER k r x = x)) /\ + (!x y:real^3. + x IN V' /\ y IN V' ==> ?i. i < CARD V' /\ y = ITER i r x) /\ + (!x. x IN V' ==> ITER (CARD V') r x = x) /\ + (!x. x IN V' ==> ITER (CARD V') r' x = x)` + MP_TAC THENL + [SUBGOAL_THEN + `!k. k < CARD(V':real^3->bool) + ==> ITER k r (rho_node1 FF v) = ITER (k + 1) (rho_node1 FF) v` + ASSUME_TAC THENL + [REWRITE_TAC[GSYM ITER_ADD; num_CONV `1`; ITER] THEN + MATCH_MP_TAC num_INDUCTION THEN + SIMP_TAC[ITER; ARITH_RULE `SUC k < n ==> k < n`] THEN + X_GEN_TAC `i:num` THEN DISCH_THEN(K ALL_TAC) THEN DISCH_TAC THEN + EXPAND_TAC "r" THEN + REWRITE_TAC[GSYM(CONJUNCT2 ITER); GSYM(CONJUNCT2 ITER_ALT)] THEN + COND_CASES_TAC THEN REWRITE_TAC[] THEN + FIRST_ASSUM(MP_TAC o MATCH_MP (ARITH_RULE + `SUC i < V ==> ~(V + 1 <= SUC(SUC i))`)) THEN + MATCH_MP_TAC(TAUT `p ==> ~p ==> q`) THEN ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[Local_lemmas1.CARD_IS_LEAST_CYCLE; NOT_SUC]; + ALL_TAC] THEN + SUBGOAL_THEN + `ITER (CARD(V':real^3->bool)) r (rho_node1 FF v) = rho_node1 FF v` + ASSUME_TAC THENL + [FIRST_ASSUM(SUBST1_TAC o MATCH_MP (ARITH_RULE + `3 <= n ==> n = SUC(n - 1)`)) THEN + ASM_SIMP_TAC[ITER; + ARITH_RULE `3 <= n ==> n - 1 < n /\ n - 1 + 1 = n`] THEN + EXPAND_TAC "r" THEN REWRITE_TAC[GSYM(CONJUNCT2 ITER)] THEN + ASM_REWRITE_TAC[ADD1] THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID]; + ALL_TAC] THEN + SUBGOAL_THEN + `!x. x IN V' ==> ?k. k < CARD V' /\ ITER k r (rho_node1 FF v) = x` + (LABEL_TAC "Reach") THENL + [EXPAND_TAC "V'" THEN REWRITE_TAC[IN_DIFF; IN_SING] THEN + X_GEN_TAC `x:real^3` THEN STRIP_TAC THEN + MP_TAC(ISPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; + `FF:real^3#real^3->bool`; `rho_node1 FF v`; `x:real^3`] + LOCAL_FAN_ORBIT_MAP_EXPLICIT) THEN + EXPAND_TAC "V'" THEN REWRITE_TAC[IN_DIFF; IN_SING] THEN + ASM_REWRITE_TAC[] THEN ANTS_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE]; + MATCH_MP_TAC MONO_EXISTS] THEN + X_GEN_TAC `i:num` THEN FIRST_ASSUM(fun th -> + GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o RAND_CONV) [SYM th]) THEN + REWRITE_TAC[ARITH_RULE `i < v + 1 <=> i < v \/ i = v`] THEN + DISCH_THEN(CONJUNCTS_THEN2 STRIP_ASSUME_TAC MP_TAC) THEN + ASM_SIMP_TAC[GSYM ITER_ADD; num_CONV `1`; ITER] THEN + ASM_REWRITE_TAC[GSYM(CONJUNCT2 ITER_ALT); ADD1] THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IMP_ITER_RHO_NODE_ID]; + ALL_TAC] THEN + MATCH_MP_TAC(TAUT `p /\ (p ==> q) ==> p /\ q`) THEN CONJ_TAC THENL + [MAP_EVERY X_GEN_TAC [`x:real^3`; `i:num`] THEN STRIP_TAC THEN + REMOVE_THEN "Reach" (MP_TAC o SPEC `x:real^3`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN(X_CHOOSE_THEN `j:num` (STRIP_ASSUME_TAC o GSYM)) THEN + ASM_REWRITE_TAC[ITER_ADD] THEN ONCE_REWRITE_TAC[ADD_SYM] THEN + REWRITE_TAC[GSYM ITER_ADD] THEN + SUBGOAL_THEN + `!j x y:real^3. + x IN V' /\ y IN V' /\ ~(x = y) + ==> ~(ITER j r x = ITER j r y)` + MATCH_MP_TAC THENL + [INDUCT_TAC THEN REWRITE_TAC[ITER] THEN ASM_MESON_TAC[]; ALL_TAC] THEN + REPEAT CONJ_TAC THENL + [FIRST_X_ASSUM MATCH_MP_TAC; + ALL_TAC; + ASM_SIMP_TAC[GSYM ITER_ADD; num_CONV `1`; ITER] THEN + DISCH_TAC THEN UNDISCH_TAC `i < CARD(V':real^3->bool)` THEN + MATCH_MP_TAC(ARITH_RULE `V + 1 <= i ==> i < V ==> F`) THEN + ASM_REWRITE_TAC[] THEN + FIRST_ASSUM(MATCH_MP_TAC o MATCH_MP (ONCE_REWRITE_RULE[IMP_CONJ] + (GEN_ALL Local_lemmas1.CARD_IS_LEAST_CYCLE))) THEN + EXISTS_TAC `rho_node1 FF v` THEN ASM_SIMP_TAC[LE_1]] THEN + EXPAND_TAC "V'" THEN REWRITE_TAC[IN_DIFF; IN_SING] THEN + ASM_MESON_TAC[Local_lemmas.LOFA_IN_V_SO_DO_RHO_NODE_V; + Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE]; + DISCH_THEN(LABEL_TAC "Rdistinct")] THEN + CONJ_TAC THENL + [REPEAT STRIP_TAC THEN MP_TAC(ISPECL + [`IMAGE (\i. ITER i r (x:real^3)) {i | i < CARD(V':real^3->bool)}`; + `V':real^3->bool`] SUBSET_CARD_EQ) THEN + ASM_SIMP_TAC[SUBSET; FORALL_IN_IMAGE; IN_ELIM_THM] THEN + MATCH_MP_TAC(TAUT `(q ==> r) /\ p ==> (p <=> q) ==> r`) THEN + CONJ_TAC THENL [ASM SET_TAC[]; ALL_TAC] THEN + GEN_REWRITE_TAC RAND_CONV [GSYM CARD_NUMSEG_LT] THEN + MATCH_MP_TAC CARD_IMAGE_INJ THEN REWRITE_TAC[FINITE_NUMSEG_LT] THEN + MATCH_MP_TAC WLOG_LT THEN REWRITE_TAC[IN_ELIM_THM] THEN + CONJ_TAC THENL [MESON_TAC[]; ALL_TAC] THEN + MAP_EVERY X_GEN_TAC [`i:num`; `j:num`] THEN REPEAT STRIP_TAC THEN + REMOVE_THEN "Rdistinct" + (MP_TAC o SPECL [`ITER i (r:real^3->real^3) x`; `j - i:num`]) THEN + ASM_SIMP_TAC[ITER_ADD; LT_IMP_LE; SUB_ADD] THEN ASM_ARITH_TAC; + ALL_TAC] THEN + MATCH_MP_TAC(TAUT `p /\ (p ==> q) ==> p /\ q`) THEN CONJ_TAC THENL + [X_GEN_TAC `x:real^3` THEN DISCH_TAC THEN + REMOVE_THEN "Reach" (MP_TAC o SPEC `x:real^3`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN(X_CHOOSE_THEN `j:num` (STRIP_ASSUME_TAC o GSYM)) THEN + ASM_REWRITE_TAC[ITER_ADD] THEN ONCE_REWRITE_TAC[ADD_SYM] THEN + REWRITE_TAC[GSYM ITER_ADD] THEN ASM_MESON_TAC[]; + ALL_TAC] THEN + MATCH_MP_TAC MONO_FORALL THEN X_GEN_TAC `x:real^3` THEN + DISCH_THEN(fun th -> DISCH_TAC THEN MP_TAC th) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN(SUBST1_TAC o SYM o AP_TERM + `ITER (CARD(V':real^3->bool)) (r':real^3->real^3)`) THEN + SPEC_TAC(`CARD(V':real^3->bool)`,`j:num`) THEN + INDUCT_TAC THEN ONCE_REWRITE_TAC[ITER_ALT] THEN ASM_SIMP_TAC[ITER]; + DISCH_THEN(CONJUNCTS_THEN2 (LABEL_TAC "Rdistinct") MP_TAC) THEN + DISCH_THEN(CONJUNCTS_THEN2 (LABEL_TAC "Rorbit") STRIP_ASSUME_TAC)] THEN + SUBGOAL_THEN + `!x. x IN FF' ==> orbit_map (ff_of_hyp (vec 0,V',E')) x = FF'` + ASSUME_TAC THENL + [EXPAND_TAC "FF'" THEN REWRITE_TAC[FORALL_IN_GSPEC] THEN + X_GEN_TAC `x:real^3` THEN DISCH_TAC THEN + REWRITE_TAC[Hypermap.orbit_map; Wrgcvdr_cizmrrh.POWER_TO_ITER] THEN + ASM_SIMP_TAC[GE; LE_0] THEN EXPAND_TAC "FF'" THEN ASM SET_TAC[]; + ALL_TAC] THEN + CONJ_TAC THENL + [FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [GSYM MEMBER_NOT_EMPTY]) THEN + DISCH_THEN(X_CHOOSE_TAC `w:real^3`) THEN REWRITE_TAC[IN_UNION] THEN + MATCH_MP_TAC(SET_RULE + `(?x. P x) /\ (!x. P x ==> R x) ==> ?x. (P x \/ Q x) /\ R x`) THEN + ASM_SIMP_TAC[] THEN EXPAND_TAC "FF'" THEN ASM SET_TAC[]; + ALL_TAC] THEN + SUBGOAL_THEN + `CARD(FF':real^3#real^3->bool) = CARD(V':real^3->bool) /\ + CARD(FF'':real^3#real^3->bool) = CARD V'` + STRIP_ASSUME_TAC THENL + [MAP_EVERY EXPAND_TAC ["FF'"; "FF''"] THEN + REWRITE_TAC[SIMPLE_IMAGE] THEN + CONJ_TAC THEN MATCH_MP_TAC CARD_IMAGE_INJ THEN + ASM_REWRITE_TAC[PAIR_EQ] THEN ASM_MESON_TAC[]; + ALL_TAC] THEN + CONJ_TAC THENL + [REWRITE_TAC[MULT_2] THEN MATCH_MP_TAC(MESON[CARD_UNION] + `CARD t = CARD s /\ FINITE s /\ FINITE t /\ s INTER t = {} + ==> CARD(s UNION t) = CARD s + CARD s`) THEN + ASM_REWRITE_TAC[] THEN MAP_EVERY EXPAND_TAC ["FF'"; "FF''"] THEN + REWRITE_TAC[SIMPLE_IMAGE] THEN ASM_SIMP_TAC[FINITE_IMAGE] THEN + REWRITE_TAC[SET_RULE `IMAGE f s INTER IMAGE g s = {} <=> + !x y. x IN s /\ y IN s ==> ~(f x = g y)`] THEN + REWRITE_TAC[PAIR_EQ] THEN + MAP_EVERY X_GEN_TAC [`x:real^3`; `y:real^3`] THEN STRIP_TAC THEN + REMOVE_THEN "Rdistinct" (MP_TAC o SPECL [`x:real^3`; `SUC(SUC 0)`]) THEN + ASM_SIMP_TAC[ITER; ARITH; ARITH_RULE `3 <= V ==> SUC(SUC 0) < V`] THEN + MESON_TAC[]; + ALL_TAC] THEN + SUBGOAL_THEN + `!x. x IN FF'' ==> orbit_map (ff_of_hyp (vec 0,V',E')) x = FF''` + ASSUME_TAC THENL + [EXPAND_TAC "FF''" THEN REWRITE_TAC[FORALL_IN_GSPEC] THEN + X_GEN_TAC `x:real^3` THEN DISCH_TAC THEN + REWRITE_TAC[Hypermap.orbit_map; Wrgcvdr_cizmrrh.POWER_TO_ITER] THEN + ASM_SIMP_TAC[GE; LE_0] THEN EXPAND_TAC "FF''" THEN + SUBGOAL_THEN `!y:real^3. y IN V' ==> ?i. ITER i r' x = y` MP_TAC THENL + [ALL_TAC; ASM SET_TAC[]] THEN + X_GEN_TAC `y:real^3` THEN DISCH_TAC THEN + REMOVE_THEN "Rorbit" (MP_TAC o SPECL [`y:real^3`; `x:real^3`]) THEN + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC MONO_EXISTS THEN + X_GEN_TAC `i:num` THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + SPEC_TAC(`i:num`,`j:num`) THEN + INDUCT_TAC THEN ONCE_REWRITE_TAC[ITER_ALT] THEN ASM_SIMP_TAC[ITER]; + ALL_TAC] THEN + REWRITE_TAC[Lvducxu.HAS_ORD2_INTERPRET] THEN + SUBGOAL_THEN + `(!x. x IN FF' ==> nn_of_hyp (vec 0,V',E') x IN FF'') /\ + (!x. x IN FF'' ==> nn_of_hyp (vec 0,V',E') x IN FF')` + STRIP_ASSUME_TAC THENL + [ASM_SIMP_TAC[nn_of_hyp3; FORALL_PAIR_THM; IN_UNION] THEN + MAP_EVERY EXPAND_TAC ["FF'"; "FF''"] THEN + REWRITE_TAC[IN_ELIM_THM; PAIR_EQ] THEN CONJ_TAC THEN + REPEAT GEN_TAC THEN + DISCH_THEN(X_CHOOSE_THEN `w:real^3` STRIP_ASSUME_TAC) THENL + [EXISTS_TAC `(r':real^3->real^3) w` THEN ASM_SIMP_TAC[] THEN + REWRITE_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]; + EXISTS_TAC `(r:real^3->real^3) w` THEN ASM_SIMP_TAC[] THEN + ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`] THEN + REWRITE_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]]; + ALL_TAC] THEN + SUBGOAL_THEN `nn_of_hyp (vec 0,V',E') o nn_of_hyp (vec 0,V',E') = I` + ASSUME_TAC THENL + [ASM_REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM; FORALL_PAIR_THM] THEN + MAP_EVERY X_GEN_TAC [`w:real^3`; `z:real^3`] THEN + ASM_CASES_TAC `(w:real^3,z:real^3) IN FF' UNION FF''` THENL + [ALL_TAC; ASM_REWRITE_TAC[nn_of_hyp3]] THEN + FIRST_X_ASSUM(DISJ_CASES_TAC o GEN_REWRITE_RULE I [IN_UNION]) THEN + ONCE_REWRITE_TAC[Wrgcvdr_cizmrrh.nn_of_hyp2] THEN + ASM_SIMP_TAC[IN_UNION] THEN + ASM_REWRITE_TAC[Wrgcvdr_cizmrrh.nn_of_hyp2; IN_UNION; PAIR_EQ] THENL + [UNDISCH_TAC `(w:real^3,z:real^3) IN FF'` THEN EXPAND_TAC "FF'"; + UNDISCH_TAC `(w:real^3,z:real^3) IN FF''` THEN EXPAND_TAC "FF''"] THEN + REWRITE_TAC[IN_ELIM_THM; PAIR_EQ] THEN + DISCH_THEN(X_CHOOSE_THEN `y:real^3` STRIP_ASSUME_TAC) THEN + ASM_SIMP_TAC[] THEN MATCH_MP_TAC AZIM_CYCLE_TWO_POINT_SET_ALT THEN + REWRITE_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET] THENL + [SET_TAC[]; ALL_TAC] THEN + BINOP_TAC THEN + ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`] THEN + REWRITE_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]; + ALL_TAC] THEN + ASM_REWRITE_TAC[] THEN CONJ_TAC THENL + [REWRITE_TAC[IN_UNION; MESON[] + `(!x. P x \/ Q x ==> R x) <=> + (!x. P x ==> R x) /\ (!x. Q x ==> R x)`] THEN + CONV_TAC(ONCE_DEPTH_CONV let_CONV) THEN ASM_SIMP_TAC[] THEN + SUBGOAL_THEN + `IMAGE (nn_of_hyp (vec 0,V',E')) FF' = FF'' /\ + IMAGE (nn_of_hyp (vec 0,V',E')) FF'' = FF'` + MP_TAC THENL [ALL_TAC; SET_TAC[]] THEN + MATCH_MP_TAC(SET_RULE + `(!x. f(f x) = x) /\ + (!x. x IN s ==> f x IN t) /\ (!x. x IN t ==> f x IN s) + ==> IMAGE f s = t /\ IMAGE f t = s`) THEN + RULE_ASSUM_TAC(REWRITE_RULE[FUN_EQ_THM; o_THM; I_THM]) THEN + ASM_REWRITE_TAC[]; + ALL_TAC] THEN + REWRITE_TAC[Wrgcvdr_cizmrrh.has_orders] THEN CONJ_TAC THENL + [CONJ_TAC THENL + [X_GEN_TAC `i:num` THEN STRIP_TAC THEN + REWRITE_TAC[FUN_EQ_THM; I_THM; NOT_FORALL_THM] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [GSYM MEMBER_NOT_EMPTY]) THEN + DISCH_THEN(X_CHOOSE_THEN `w:real^3` STRIP_ASSUME_TAC) THEN + EXISTS_TAC `(w,(r:real^3->real^3) w)` THEN + ASM_SIMP_TAC[PAIR_EQ]; + REWRITE_TAC[FUN_EQ_THM; I_THM] THEN + MATCH_MP_TAC(MESON[IN_UNION] + `!FF' FF''. + (!x. x IN FF' ==> P x) /\ (!x. x IN FF'' ==> P x) /\ + (!x. ~(x IN FF' UNION FF'') ==> P x) + ==> !x. P x`) THEN + MAP_EVERY EXISTS_TAC + [`FF':real^3#real^3->bool`; `FF'':real^3#real^3->bool`] THEN + REPEAT CONJ_TAC THENL + [EXPAND_TAC "FF'" THEN REWRITE_TAC[FORALL_IN_GSPEC] THEN + ASM_SIMP_TAC[PAIR_EQ]; + EXPAND_TAC "FF''" THEN REWRITE_TAC[FORALL_IN_GSPEC] THEN + ASM_SIMP_TAC[PAIR_EQ]; + ASM_REWRITE_TAC[FORALL_PAIR_THM; ff_of_hyp3] THEN + REPEAT GEN_TAC THEN DISCH_TAC THEN + SPEC_TAC(`CARD(V':real^3->bool)`,`k:num`) THEN + INDUCT_TAC THEN ASM_REWRITE_TAC[ITER]]]; + ALL_TAC] THEN + REPEAT CONJ_TAC THENL + [REWRITE_TAC[ee_of_hyp3; FUN_EQ_THM; o_THM; I_THM; FORALL_PAIR_THM] THEN + MAP_EVERY X_GEN_TAC [`x:real^3`; `y:real^3`] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `(x:real^3,y) IN darts_of_hyp E' V'` THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN + `(!x y:real^3. (x,y) IN FF' ==> (y,x) IN FF'') /\ + (!x y:real^3. (x,y) IN FF'' ==> (y,x) IN FF')` + MP_TAC THENL [ALL_TAC; REWRITE_TAC[IN_UNION] THEN MESON_TAC[]] THEN + MAP_EVERY EXPAND_TAC ["FF'"; "FF''"] THEN + REWRITE_TAC[IN_ELIM_THM; PAIR_EQ] THEN MESON_TAC[]; + REWRITE_TAC[ee_of_hyp3; FUN_EQ_THM; I_THM] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [GSYM MEMBER_NOT_EMPTY]) THEN + DISCH_THEN(X_CHOOSE_TAC `x:real^3`) THEN + DISCH_THEN(MP_TAC o SPEC `x,(r:real^3->real^3) x`) THEN + ASM_REWRITE_TAC[IN_UNION] THEN EXPAND_TAC "FF'" THEN + REWRITE_TAC[IN_ELIM_THM] THEN REWRITE_TAC[PAIR_EQ] THEN + REMOVE_THEN "Rdistinct" (MP_TAC o SPECL [`x:real^3`; `SUC 0`]) THEN + ASM_SIMP_TAC[ITER; ARITH; ARITH_RULE `3 <= V ==> 1 < V`] THEN + ASM_MESON_TAC[PAIR_EQ]; + REWRITE_TAC[nn_of_hyp3; FUN_EQ_THM; I_THM] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [GSYM MEMBER_NOT_EMPTY]) THEN + DISCH_THEN(X_CHOOSE_TAC `x:real^3`) THEN + DISCH_THEN(MP_TAC o SPEC `x,(r:real^3->real^3) x`) THEN + ASM_REWRITE_TAC[IN_UNION] THEN EXPAND_TAC "FF'" THEN + REWRITE_TAC[IN_ELIM_THM] THEN + COND_CASES_TAC THENL [ALL_TAC; ASM_MESON_TAC[]] THEN + ASM_SIMP_TAC[PAIR_EQ; Local_lemmas.AZIM_CYCLE_TWO_POINT_SET] THEN + REMOVE_THEN "Rdistinct" (MP_TAC o SPECL [`x:real^3`; `SUC(SUC 0)`]) THEN + ASM_SIMP_TAC[ITER; ARITH; ARITH_RULE `3 <= V ==> 2 < V`] THEN + ASM_MESON_TAC[]]; + ALL_TAC] THEN + ASM_REWRITE_TAC[Wrgcvdr_cizmrrh.convex_local_fan] THEN + EXPAND_TAC "FF'" THEN REWRITE_TAC[FORALL_IN_GSPEC] THEN + SIMP_TAC[Wrgcvdr_cizmrrh.azim_in_fan; Wrgcvdr_cizmrrh.wedge_in_fan_ge] THEN + X_GEN_TAC `u:real^3` THEN DISCH_TAC THEN ABBREV_TAC + `d = azim_cycle (EE u E') (vec 0) u (r u)` THEN + CONV_TAC(ONCE_DEPTH_CONV let_CONV) THEN + SUBGOAL_THEN `CARD (EE (u:real^3) E') = 2` SUBST1_TAC THENL + [MATCH_MP_TAC(GEN_ALL Local_lemmas.LOFA_CARD_EE_V_1) THEN + MAP_EVERY EXISTS_TAC [`FF':real^3#real^3->bool`; `V':real^3->bool`] THEN + ASM_REWRITE_TAC[] THEN EXPAND_TAC "V'" THEN ASM SET_TAC[]; + CONV_TAC NUM_REDUCE_CONV] THEN + SUBGOAL_THEN `d = (r':real^3->real^3) u` SUBST1_TAC THENL + [EXPAND_TAC "d" THEN + SUBGOAL_THEN `EE (u:real^3) E' = {r u,r' u}` + (fun th -> REWRITE_TAC[th; Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]) THEN + FIRST_ASSUM(fun th -> REWRITE_TAC + [MATCH_MP Wrgcvdr_cizmrrh.FAN_IMP_EE_EQ_SET_OF_EDGE th]) THEN + REWRITE_TAC[Fan.set_of_edge] THEN + EXPAND_TAC "E'" THEN REWRITE_TAC[IN_ELIM_THM] THEN + REWRITE_TAC[SET_RULE + `{a,b} = {c,d} <=> a = c /\ b = d \/ a = d /\ b = c`] THEN + ASM SET_TAC[]; + ALL_TAC] THEN + SUBGOAL_THEN + `!z. azim (vec 0) u (r u) z = azim (vec 0) u (rho_node1 FF u) z` + ASSUME_TAC THENL + [X_GEN_TAC `z:real^3` THEN EXPAND_TAC "r" THEN + COND_CASES_TAC THEN REWRITE_TAC[] THEN + CONV_TAC SYM_CONV THEN MATCH_MP_TAC AZIM_SAME_WITHIN_AFF_GE THEN + ASM_REWRITE_TAC[] THEN REPEAT CONJ_TAC THENL + [SUBGOAL_THEN `u = ivs_rho_node1 FF v` + (fun th -> ASM_REWRITE_TAC[th]) THEN + ASM_MESON_TAC[Local_lemmas.IVS_RHO_IDD; IN_DIFF]; + EXPAND_TAC "v" THEN + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2; IN_DIFF]; + DISCH_THEN(MP_TAC o SPEC `v:real^3` o MATCH_MP + (ONCE_REWRITE_RULE[IMP_CONJ_ALT] COLLINEAR_WITHIN_AFF_GE_COLLINEAR)) THEN + REWRITE_TAC[NOT_IMP] THEN CONJ_TAC THENL + [SUBGOAL_THEN `u = ivs_rho_node1 FF v` + (fun th -> ASM_REWRITE_TAC[th]) THEN + ASM_MESON_TAC[Local_lemmas.IVS_RHO_IDD; IN_DIFF]; + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2]]]; + ALL_TAC] THEN + CONJ_TAC THENL + [FIRST_ASSUM(MP_TAC o SPEC `u:real^3` o GEN_ALL o MATCH_MP + (ONCE_REWRITE_RULE[IMP_CONJ] Local_lemmas.IN_V_IMP_AZIM_LESS_PI)) THEN + ANTS_TAC THENL [ASM SET_TAC[]; ASM_REWRITE_TAC[]] THEN + DISCH_THEN MATCH_MP_TAC THEN ASM SET_TAC[]; + ALL_TAC] THEN + FIRST_ASSUM(MP_TAC o CONJUNCT2 o GEN_REWRITE_RULE I + [Wrgcvdr_cizmrrh.convex_local_fan]) THEN + DISCH_THEN(MP_TAC o SPEC `u,rho_node1 FF u`) THEN ANTS_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_RHO_NODE_PROS; IN_DIFF]; + DISCH_THEN(MP_TAC o CONJUNCT2)] THEN + MP_TAC(GEN_ALL(MATCH_MP(ONCE_REWRITE_RULE[IMP_CONJ] + Local_lemmas1.WEDGE_IN_FAN_RHOND_IVS_RHOND) + (ASSUME `local_fan (V:real^3->bool,E,FF)`))) THEN + DISCH_THEN(MP_TAC o SPEC `u:real^3`) THEN + ANTS_TAC THENL [ASM SET_TAC[]; DISCH_THEN SUBST1_TAC] THEN + ASM_CASES_TAC `rho_node1 FF v = u` THENL + [ABBREV_TAC `w = ivs_rho_node1 FF v` THEN + EXPAND_TAC "r" THEN COND_CASES_TAC THENL + [ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_IMP_NOT_SEMI_IDE]; ALL_TAC] THEN + SUBGOAL_THEN `(r':real^3->real^3) u = w` SUBST1_TAC THENL + [SUBGOAL_THEN `(r:real^3->real^3) (r'(u:real^3)) = r w` MP_TAC THENL + [ASM_SIMP_TAC[] THEN EXPAND_TAC "r" THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[Local_lemmas1.LOCAL_FAN_RHO_NODE_IVS; IN_DIFF]; + MATCH_MP_TAC EQ_IMP THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_SIMP_TAC[] THEN EXPAND_TAC "V'" THEN + REWRITE_TAC[IN_DIFF; IN_SING] THEN + ASM_MESON_TAC[IN_DIFF; IN_SING; Local_lemmas1.LOCAL_FAN_IVS_IN_V; + Local_lemmas1.IVS_RHO_NODE_DIFF_ID]]; + ALL_TAC] THEN + SUBGOAL_THEN `ivs_rho_node1 FF u = v` SUBST1_TAC THENL + [ASM_MESON_TAC[Local_lemmas.IVS_RHO_IDD; IN_DIFF]; + REWRITE_TAC[Localization.wedge_ge; azim]] THEN + MATCH_MP_TAC(SET_RULE + `v' SUBSET v /\ s = t ==> v SUBSET s ==> v' SUBSET t`) THEN + CONJ_TAC THENL [ASM SET_TAC[]; ALL_TAC] THEN + MATCH_MP_TAC(SET_RULE + `a = b ==> {x | f x <= a} = {x | f x <= b}`) THEN + MATCH_MP_TAC AZIM_SAME_WITHIN_AFF_GE_ALT THEN REPEAT CONJ_TAC THENL + [ASM_MESON_TAC[INSERT_AC]; + ASM_MESON_TAC[Local_lemmas.LOCAL_FAN_CHARACTER_OF_RHO_NODE2; INSERT_AC]; + DISCH_THEN(MP_TAC o SPEC `v:real^3` o MATCH_MP + (ONCE_REWRITE_RULE[IMP_CONJ_ALT] COLLINEAR_WITHIN_AFF_GE_COLLINEAR)) THEN + REWRITE_TAC[NOT_IMP] THEN CONJ_TAC THENL + [ASM_MESON_TAC[INSERT_AC]; + ASM_MESON_TAC[Local_lemmas.LOFA_IMP_NOT_COLL_IVS]]]; + ASM_REWRITE_TAC[Localization.wedge_ge; azim] THEN + SUBGOAL_THEN `(r':real^3->real^3) u = ivs_rho_node1 FF u` + (fun th -> REWRITE_TAC[th] THEN ASM SET_TAC[]) THEN + SUBGOAL_THEN + `(r:real^3->real^3)((r':real^3->real^3) u) = r(ivs_rho_node1 FF u)` + MP_TAC THENL + [ASM_SIMP_TAC[] THEN EXPAND_TAC "r" THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[IN_DIFF; IN_SING; Local_lemmas1.LOCAL_FAN_RHO_NODE_IVS]; + MATCH_MP_TAC EQ_IMP THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_SIMP_TAC[] THEN EXPAND_TAC "V'" THEN + REWRITE_TAC[IN_DIFF; IN_SING] THEN + ASM_MESON_TAC[IN_DIFF; IN_SING; Local_lemmas1.LOCAL_FAN_IVS_IN_V; + Local_lemmas1.LOCAL_FAN_RHO_NODE_IVS]]]);; + +end;; diff --git a/text_formalization/local/terminal.hl b/text_formalization/local/terminal.hl new file mode 100644 index 0000000..faec1f3 --- /dev/null +++ b/text_formalization/local/terminal.hl @@ -0,0 +1,4432 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Section: Conclusions *) +(* Chapter: Local Fan *) +(* Author: Thomas C. Hales *) +(* Date: 2013-04-17 *) +(* ========================================================================== *) + +(* +Terminal cases of main estimate. +*) + +flyspeck_needs "local/appendix_main_estimate.hl";; + +module Terminal = struct + + +open Hales_tactic;; + +(* +let filter_flypaper tl = + List.flatten (map (function + | Flypaper s -> s + | _ -> []) tl);; + +let has_flypaper_tag sl ind = + let tl = ind.tags in + List.length (intersect (filter_flypaper tl) sl) > 0;; + +let main_ineq_data = + filter (fun ind -> + has_flypaper_tag ["UPONLFY";"SAUZWSD";"EDZEPIH";"OMKYNLT";"FHOLLLW";"TNNOPSI"] ind) (!Ineq.ineqs);; + +let main_nonlinear = + let ineql = map (fun idv -> idv.ineq) main_ineq_data in + let main_ineq_conj = end_itlist (curry mk_conj) ineql in + let _ = new_definition (mk_eq (`main_nonlinear_v39:bool`,main_ineq_conj)) in + ();; + +let is_main = function + | Main_estimate -> true + | _ -> false;; + +let has_main ind = + exists (is_main) ind.tags;; + +let main_ineq_data = + filter has_main (!Ineq.ineqs);; + +let get_main_nonlinear = + let ineql = map (fun ind -> ind.ineq) main_ineq_data in + let sl = map (fun ind -> ind.idv) main_ineq_data in + let main_ineq_conj = end_itlist (curry mk_conj) ineql in + let th = new_definition (mk_eq (`main_nonlinear_v39:bool`,main_ineq_conj)) in + let th1 = UNDISCH (MATCH_MP (TAUT `(a <=> b) ==> (a ==> b)`) th) in + let co1 thm = if (is_conj (concl thm)) then CONJUNCT1 thm else thm in + fun s -> + let i = index s sl in + let th2 = funpow i CONJUNCT2 th1 in + co1 th2;; + +*) + + +let get_main_nonlinear = + let is_main = function + | Main_estimate -> true + | _ -> false in + let has_main ind = + exists (is_main) ind.tags in + let main_ineq_data1 = + filter has_main (!Ineq.ineqs) in + let id = map (fun t-> t.idv) main_ineq_data1 in + let main_ineq_data = map (fun t -> hd(Ineq.getexact t)) id in + let ineql = map (fun ind -> ind.ineq) main_ineq_data in + let sl = map (fun ind -> ind.idv) main_ineq_data in + let main_ineq_conj = end_itlist (curry mk_conj) ineql in + let th = new_definition (mk_eq (`main_nonlinear_terminal_v11:bool`,main_ineq_conj)) in + let th1 = UNDISCH (MATCH_MP (TAUT `(a <=> b) ==> (a ==> b)`) th) in + let co1 thm = if (is_conj (concl thm)) then CONJUNCT1 thm else thm in + let tryindex s sl = try index s sl with _ -> report s; failwith s in + fun s -> + let i = tryindex s sl in + let th2 = funpow i CONJUNCT2 th1 in + co1 th2;; + + +(* Start with OWZLKVY. *) +let LET_THM = CONJ LET_DEF LET_END_DEF;; + +let sqrt8_flyspeck = prove_by_refinement( + `#2.828427 < sqrt8 /\ + sqrt8 < #2.828428`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Flyspeck_constants.bounds]) + ]);; + (* }}} *) + +let SOL_SOLID_TRIANGLE_ALT = prove_by_refinement( + `!v0 v1 v2 v3. + ~coplanar {v0, v1, v2, v3} + ==> sol v0 (convex hull {v0, v1, v2, v3}) = dihV v0 v1 v2 v3 + dihV v0 v2 v3 v1 + dihV v0 v3 v1 v2 - pi`, + (* {{{ proof *) + [ + BY(MESON_TAC[Tskajxy_lemmas.SOL_SOLID_TRIANGLE]) + ]);; + (* }}} *) + +let sol_x_nn = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + &0 < x1 /\ &0 < x2 /\ &0 < x3 /\ + &0 < ups_x x1 x2 x6 /\ + &0 < ups_x x2 x3 x4 /\ + &0 < ups_x x1 x3 x5 /\ + &0 < eulerA_x x1 x2 x3 x4 x5 x6 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 ==> + &0 < sol_x x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC Merge_ineq.sol_x_sol_euler_x; + ASM_REWRITE_TAC[Sphere.sol_euler_x;LET_DEF;LET_END_DEF]; + REPEAT (GMATCH_SIMP_TAC SQRT_MUL); + REWRITE_TAC[GSYM Sphere.eulerA_x]; + GMATCH_SIMP_TAC REAL_LE_MUL; + ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`]; + MATCH_MP_TAC (arith `&0 < x ==> &0 < &2 * x `); + GMATCH_SIMP_TAC Merge_ineq.ATN2_POS; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LT_RSQRT; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + + +let DIH_X_NN = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. &0 < x1 /\ &0 <= delta_x x1 x2 x3 x4 x5 x6 + ==> &0 <= dih_x x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_CASES_TAC `&0 < delta_x x1 x2 x3 x4 x5 x6`; + MATCH_MP_TAC Merge_ineq.dih_x_nn; + BY(ASM_REWRITE_TAC[]); + TYPIFY `delta_x x1 x2 x3 x4 x5 x6 = &0` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[Sphere.dih_x;LET_DEF;LET_END_DEF]; + REWRITE_TAC[arith `x * &0 = &0`;SQRT_0]; + TYPED_ABBREV_TAC `d4 = -- delta_x4 x1 x2 x3 x4 x5 x6`; + INTRO_TAC Merge_ineq.atn2_0 [`d4`]; + REPEAT WEAKER_STRIP_TAC; + ASSUME_TAC PI_POS; + MP_TAC (arith `&0 < d4 \/ d4 < &0 \/ d4 = &0`); + DISCH_THEN DISJ_CASES_TAC; + ASM_SIMP_TAC[]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM DISJ_CASES_TAC; + ASM_SIMP_TAC[]; + BY(REAL_ARITH_TAC); + ASM_SIMP_TAC[]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let DIH_Y_NN = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + &0 < y1 /\ &0 <= delta_y y1 y2 y3 y4 y5 y6 ==> + &0 <= dih_y y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF]; + MATCH_MP_TAC DIH_X_NN; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MP_TAC; + BY(REWRITE_TAC[Sphere.delta_y]) + ]);; + (* }}} *) + +let RHO_LB = prove_by_refinement( + `!y. &2 <= y ==> &1 <= rho y`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Nonlinear_lemma.rho_alt]; + MATCH_MP_TAC (arith `&0 <= x ==> &1 <= &1 + x `); + GMATCH_SIMP_TAC REAL_LE_MUL; + REWRITE_TAC[GSYM Nonlinear_lemma.sol0_over_pi_EQ_const1]; + GMATCH_SIMP_TAC REAL_LE_RDIV_EQ; + GMATCH_SIMP_TAC REAL_LE_RDIV_EQ; + REWRITE_TAC[arith `&0 * x = &0`]; + REWRITE_TAC[PI_POS]; + INTRO_TAC Flyspeck_constants.bounds []; + FIRST_X_ASSUM MP_TAC; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let DIH_Y_LT_RHAZIM = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + &2 <= y1 /\ &0 <= delta_y y1 y2 y3 y4 y5 y6 ==> + dih_y y1 y2 y3 y4 y5 y6 <= rhazim y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Sphere.rhazim]; + MATCH_MP_TAC (arith `&0 <= (r - &1) * d ==> d <= r * d`); + GMATCH_SIMP_TAC REAL_LE_MUL; + CONJ2_TAC; + MATCH_MP_TAC DIH_Y_NN; + ASM_REWRITE_TAC[]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + MATCH_MP_TAC (arith `&1 <= r ==> &0 <= r - &1`); + MATCH_MP_TAC RHO_LB; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let taum_taum_x = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + &0 <= y1 /\ &0 <= y2 /\ &0 <= y3 /\ &0 <= y4 /\ &0 <= y5 /\ &0 <= y6 ==> + taum y1 y2 y3 y4 y5 y6 = y_of_x taum_x y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.y_of_x;Sphere.taum_x;Sphere.rhazim_x;Sphere.rhazim2_x;Sphere.rhazim3_x]; + REWRITE_TAC[Nonlinear_lemma.taum_123]; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_SIMP_TAC[Nonlinear_lemma.sqrtxx]) + ]);; + (* }}} *) + +(* Now do OCBICBY *) + +let BBs_terminal = `!s vv. MEM s scs_terminal_v116 /\ BBs_v39 s vv ==> &0 <= taustar_v39 s vv`;; + +let scs_unadorned_explicit = prove_by_refinement( + `(!k d a b. + scs_k_v39 (mk_unadorned_v39 k d a b) = k) /\ + (!k d a b . + scs_d_v39 (mk_unadorned_v39 k d a b) = d) /\ + (!k d a b . + scs_a_v39 (mk_unadorned_v39 k d a b) = a) /\ + (!k d a b . + scs_am_v39 (mk_unadorned_v39 k d a b) = a) /\ + (!k d a b . + scs_b_v39 (mk_unadorned_v39 k d a b) = b) /\ + (!k d a b . + scs_bm_v39 (mk_unadorned_v39 k d a b) = b) /\ + (!k d a b . + scs_J_v39 (mk_unadorned_v39 k d a b) = (\ i j. F)) /\ + (!k d a b . + scs_lo_v39 (mk_unadorned_v39 k d a b) = {}) /\ + (!k d a b . + scs_hi_v39 (mk_unadorned_v39 k d a b) = {}) /\ + (!k d a b . + scs_str_v39 (mk_unadorned_v39 k d a b) = {})`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Appendix.scs_v39_explicit;Appendix.mk_unadorned_v39]) + ]);; + (* }}} *) + +let UNADORNED_NOT_EAR = prove_by_refinement( + `!k d a b. + ~(is_ear_v39 (mk_unadorned_v39 k d a b))`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.is_ear_v39;scs_unadorned_explicit;EMPTY_GSPEC]; + BY(MESON_TAC[NOT_IN_EMPTY;IN_SING]) + ]);; + (* }}} *) + +let dsv_unadorned = prove_by_refinement( + `!k d a b vv. + dsv_v39 (mk_unadorned_v39 k d a b) vv = d `, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.dsv_v39;UNADORNED_NOT_EAR;scs_unadorned_explicit;EMPTY_GSPEC;SUM_CLAUSES]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let dsv_F = prove_by_refinement( + `!k d a a' b' b s s' s'' vv. + dsv_v39 (scs_v39 (k, d, a, a', b', b, (\i j. F), s, s',s'')) vv = d `, + (* {{{ proof *) + [ + ASM_REWRITE_TAC[Appendix.dsv_v39;Appendix.scs_v39_explicit;EMPTY_GSPEC;SUM_CLAUSES]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let SUM_INTER = prove_by_refinement( + `!(A:A->bool) B f. sum (A INTER B) f = sum A (\i. if (i IN B) then f i else &0)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC SUM_SUPERSET [`(\i. if (i IN B) then f i else &0)`;`A INTER B`;`A`]; + ANTS_TAC; + CONJ_TAC; + BY(SET_TAC[]); + BY(SET_TAC[]); + DISCH_THEN SUBST1_TAC; + MATCH_MP_TAC SUM_EQ; + REWRITE_TAC[IN_INTER]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let dsv_fun3 = prove_by_refinement( + `! d a a' b' b f s s' s'' vv. + dsv_v39 (scs_v39 (3, d, a, a', b', b, f , s, s',s'')) vv = + d + + #0.1 * + (if is_ear_v39 (scs_v39 (3,d,a,a',b',b,f ,s,s',s'')) + then &1 + else -- &1) * + ((if f 0 1 then cstab - dist (vv 0,vv 1) else &0) + + (if f 1 2 then cstab - dist (vv 1,vv 2) else &0) + + (if f 2 3 then cstab - dist (vv 2,vv 3) else &0) + + &0) `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[Appendix.dsv_v39;Appendix.scs_v39_explicit;EMPTY_GSPEC;SUM_CLAUSES]; + TYPIFY `{i | i < 3 /\ f i (SUC i) } = {0,1,2} INTER {i | f i (SUC i) }` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INTER;IN_INSERT;NOT_IN_EMPTY]; + BY(REWRITE_TAC[arith `x < 3 <=> (x = 0 \/ x = 1 \/ x = 2)`]); + REWRITE_TAC[SUM_INTER;IN_ELIM_THM]; + REPEAT (GMATCH_SIMP_TAC (CONJUNCT2 SUM_CLAUSES)); + REWRITE_TAC[NOT_IN_EMPTY;IN_INSERT;FINITE_EMPTY;FINITE_INSERT;arith `~(0 = 1) /\ ~(0=2) /\ ~(1 = 2)`;SUM_CLAUSES]; + BY(REWRITE_TAC[arith `SUC 0 = 1 /\ SUC 1 = 2 /\ SUC 2 = 3`]) + ]);; + (* }}} *) + +let dsv_fun4 = prove_by_refinement( + `! d a a' b' b f s s' s'' vv. + dsv_v39 (scs_v39 (4, d, a, a', b', b, f , s, s',s'')) vv = + d - + #0.1 * + ((if f 0 1 then cstab - dist (vv 0,vv 1) else &0) + + (if f 1 2 then cstab - dist (vv 1,vv 2) else &0) + + (if f 2 3 then cstab - dist (vv 2,vv 3) else &0) + + (if f 3 4 then cstab - dist (vv 3,vv 4) else &0) + + &0) `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[Appendix.dsv_v39;Appendix.scs_v39_explicit;EMPTY_GSPEC;SUM_CLAUSES]; + REWRITE_TAC[Appendix.is_ear_v39;Appendix.scs_v39_explicit;arith `~(4 = 3)`]; + MATCH_MP_TAC (arith `(s = s') ==> d + a * -- &1 * s = d - a * s'`); + TYPIFY `{i | i < 4 /\ f i (SUC i) } = {0,1,2,3} INTER {i | f i (SUC i) }` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INTER;IN_INSERT;NOT_IN_EMPTY]; + BY(REWRITE_TAC[arith `x < 4 <=> (x = 0 \/ x = 1 \/ x = 2 \/ x = 3)`]); + REWRITE_TAC[SUM_INTER;IN_ELIM_THM]; + REPEAT (GMATCH_SIMP_TAC (CONJUNCT2 SUM_CLAUSES)); + REWRITE_TAC[NOT_IN_EMPTY;IN_INSERT;FINITE_EMPTY;FINITE_INSERT;arith `~(0 = 1) /\ ~(0=2) /\ ~(1 = 2) /\ ~(2 = 3) /\ ~(0=3) /\ ~(1 = 3)`;SUM_CLAUSES]; + BY(REWRITE_TAC[arith `SUC 0 = 1 /\ SUC 1 = 2 /\ SUC 2 = 3 /\ SUC 3 = 4`]) + ]);; + (* }}} *) + +let IMAGE_SUBSET_IN = prove_by_refinement( + `!(f:A->B) A B. IMAGE f A SUBSET B <=> (!a. a IN A ==> f a IN B)`, + (* {{{ proof *) + [ + SET_TAC[] + ]);; + (* }}} *) + +let taustar3 = prove_by_refinement( + `!d a b. + (let s = mk_unadorned_v39 3 d a b in + ((!v0 v1 v2. + &2 <= norm v0 /\ norm v0 <= &2 * h0 /\ + &2 <= norm v1 /\ norm v1 <= &2 * h0 /\ + &2 <= norm v2 /\ norm v2 <= &2 * h0 /\ + a 0 1 <= dist(v0,v1) /\ dist(v0,v1) <= b 0 1 /\ + a 1 2 <= dist(v1,v2) /\ dist(v1,v2) <= b 1 2 /\ + a 0 2 <= dist(v0,v2) /\ dist(v0,v2) <= b 0 2 ==> + d <= tau3 v0 v1 v2) ==> + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv)))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Appendix.taustar_v39;scs_unadorned_explicit;arith `3 <= 3`]; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REWRITE_TAC[dsv_unadorned]; + REWRITE_TAC[arith `&0 <= t - d <=> d <= t`]; + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Appendix.BBs_v39;scs_unadorned_explicit;arith `3 <= 3`]; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REWRITE_TAC[IMAGE_SUBSET_IN;IN_UNIV;Fnjlbxs.in_ball_annulus]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let taustar3_fun = prove_by_refinement( + `!d a b f. + (let s = scs_v39 (3,d,a,a,b,b,f,{},{},{}) in + ((!v0 v1 v2. + &2 <= norm v0 /\ norm v0 <= &2 * h0 /\ + &2 <= norm v1 /\ norm v1 <= &2 * h0 /\ + &2 <= norm v2 /\ norm v2 <= &2 * h0 /\ + a 0 1 <= dist(v0,v1) /\ dist(v0,v1) <= b 0 1 /\ + a 1 2 <= dist(v1,v2) /\ dist(v1,v2) <= b 1 2 /\ + a 0 2 <= dist(v0,v2) /\ dist(v0,v2) <= b 0 2 ==> + d + + #0.1 * + (if is_ear_v39 s + then &1 + else -- &1) * + ((if f 0 1 then cstab - dist (v0,v1) else &0) + + (if f 1 2 then cstab - dist (v1,v2) else &0) + + (if f 2 3 then cstab - dist (v2,v0) else &0) + + &0) <= tau3 v0 v1 v2) ==> + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))) `, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Appendix.taustar_v39;Appendix.scs_v39_explicit;arith `3 <= 3`]; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REWRITE_TAC[dsv_fun3]; + REWRITE_TAC[arith `&0 <= t - d <=> d <= t`]; + TYPIFY `vv 3 = vv 0` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Appendix.BBs_v39]; + REWRITE_TAC[Appendix.scs_v39_explicit]; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REWRITE_TAC[Oxl_def.periodic]; + BY(MESON_TAC[arith `0 + 3 = 3`]); + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Appendix.BBs_v39;Appendix.scs_v39_explicit;arith `3 <= 3`]; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REWRITE_TAC[IMAGE_SUBSET_IN;IN_UNIV;Fnjlbxs.in_ball_annulus]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let NONPARALLEL_BALL_ANNULUS40 =prove_by_refinement(`!v w. &2<= norm(v-w) /\ norm(v-w)< &4 /\ v IN ball_annulus /\ w IN ball_annulus +==> ~(collinear ({vec 0} UNION {v,w}))`, +[ + REPEAT GEN_TAC; + REWRITE_TAC[SET_RULE`{A} UNION {B,C}={A,B,C}`;GSYM NORM_CAUCHY_SCHWARZ_EQUAL;NORM_LE_SQUARE;NORM_LT_SQUARE;]; + ONCE_REWRITE_TAC[REAL_ARITH`A<=B <=> B >= A`]; + REWRITE_TAC[NORM_GE_SQUARE;REAL_ARITH`~(&2<= &0) /\ &0 < &2`]; + ONCE_REWRITE_TAC[REAL_ARITH`A>=B <=> B <= A`]; + REWRITE_TAC[DOT_RSUB;DOT_LSUB;DOT_SQUARE_NORM]; + DISJ_CASES_TAC(REAL_ARITH`&0<= v dot w \/ &0<= --(v dot (w:real^3))`); + POP_ASSUM MP_TAC; + REWRITE_TAC[GSYM REAL_ABS_REFL]; + RESA_TAC; + REPEAT STRIP_TAC; + POP_ASSUM(fun t-> ASM_TAC THEN REWRITE_TAC[t] THEN REPEAT STRIP_TAC THEN MP_TAC t); + REWRITE_TAC[]; + ONCE_REWRITE_TAC[DOT_SYM]; + STRIP_TAC; + POP_ASSUM(fun t-> ASM_TAC THEN REWRITE_TAC[t] ); + REWRITE_TAC[REAL_ARITH`A pow 2 -A*B-(A*B-B pow 2)=(A-B) pow 2`;GSYM REAL_LE_SQUARE_ABS;Pack_defs.ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0 -A= --A`;NORM_NEG;REAL_ARITH`~(a b<=a`]; + DISJ_CASES_TAC(REAL_ARITH`&0<= norm (v:real^3) -norm w \/ &0<= --(norm v -norm (w:real^3))`); + POP_ASSUM MP_TAC; + REWRITE_TAC[GSYM REAL_ABS_REFL]; + RESA_TAC; + REPEAT STRIP_TAC; + MP_TAC(REAL_ARITH`norm (v:real^3) <= &2 * h0 /\ &2 <= norm (w:real^3) ==> norm v - norm w <= &2*(h0 - &1)`); + ASM_REWRITE_TAC[Sphere.h0]; + ASM_TAC; + BY(REAL_ARITH_TAC); + POP_ASSUM MP_TAC; + REWRITE_TAC[GSYM REAL_ABS_REFL;REAL_ABS_NEG]; + RESA_TAC; + ONCE_REWRITE_TAC[REAL_ARITH`--(A-B)=B-A`]; + REPEAT STRIP_TAC; + MP_TAC(REAL_ARITH`norm (w:real^3) <= &2 * h0 /\ &2 <= norm (v:real^3) ==> norm w - norm v <= &2*(h0 - &1)`); + ASM_REWRITE_TAC[Sphere.h0]; + ASM_TAC; + BY(REAL_ARITH_TAC); + POP_ASSUM MP_TAC; + REWRITE_TAC[GSYM REAL_ABS_REFL;REAL_ABS_NEG]; + RESA_TAC; + ONCE_REWRITE_TAC[REAL_ARITH`--A=B<=> A= --B`]; + REPEAT STRIP_TAC; + POP_ASSUM(fun t-> ASM_TAC THEN REWRITE_TAC[t] THEN REPEAT STRIP_TAC THEN MP_TAC t); + REWRITE_TAC[]; + ONCE_REWRITE_TAC[DOT_SYM]; + STRIP_TAC; + POP_ASSUM(fun t-> ASM_TAC THEN REWRITE_TAC[t] ); + REWRITE_TAC[REAL_ARITH`A pow 2 -(--(A*B))-(--(A*B)-B pow 2)=(A+B) pow 2`;GSYM REAL_LE_SQUARE_ABS;Pack_defs.ball_annulus;IN_ELIM_THM;DIFF;ball;cball;dist;VECTOR_ARITH`vec 0 -A= --A`;NORM_NEG;REAL_ARITH`~(a b<=a`]; + STRIP_TAC; + REMOVE_ASSUM_TAC; + MP_TAC(REAL_ARITH`&0<= norm (v:real^3) /\ &0<= norm (w:real^3)==> &0<= norm v + norm w`); + SIMP_TAC[NORM_POS_LE]; + REWRITE_TAC[GSYM REAL_ABS_REFL]; + RESA_TAC; + REPEAT STRIP_TAC; + MP_TAC(REAL_ARITH`&2<=norm (w:real^3) /\ &2 <= norm (v:real^3) ==> &4<= norm v + norm w `); + ASM_REWRITE_TAC[]; + DISCH_TAC; + FIRST_X_ASSUM_ST `pow` MP_TAC; + REWRITE_TAC[]; + REWRITE_TAC[arith `~(x2 < y2) <=> y2 <= x2`]; + MATCH_MP_TAC Collect_geom2.POS_IMP_POW2; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) +] +);; + +let NONPARALLEL_BALL_ANNULUS_ALT = prove_by_refinement( + `!v w. &2 <= dist(v,w) /\ + dist(v,w) <= #3.62 /\ // was cstab. + v IN ball_annulus /\ + w IN ball_annulus + ==> ~collinear ({vec 0,v, w})`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + TYPIFY `{vec 0,v,w} = {vec 0} UNION {v,w}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + REWRITE_TAC[]; + MATCH_MP_TAC Dih2k_hypermap.NONPARALLEL_BALL_ANNULUS362; + REWRITE_TAC[GSYM dist]; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let NONPARALLEL_BALL_ANNULUS40_ALT = prove_by_refinement( + `!v w. &2 <= dist(v,w) /\ + dist(v,w) < &4 /\ + v IN ball_annulus /\ + w IN ball_annulus + ==> ~collinear ({vec 0,v, w})`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + TYPIFY `{vec 0,v,w} = {vec 0} UNION {v,w}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + REWRITE_TAC[]; + MATCH_MP_TAC NONPARALLEL_BALL_ANNULUS40; + REWRITE_TAC[GSYM dist]; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let tau3_taum = prove_by_refinement( + `!(v0:real^3) v1 v2. + v0 IN ball_annulus /\ v1 IN ball_annulus /\ v2 IN ball_annulus /\ + &2 <= dist(v0,v1) /\ &2 <= dist(v0,v2) /\ &2 <= dist(v1,v2) /\ + dist(v0,v1) <= #3.62 /\ dist(v0,v2) <= #3.62 /\ dist(v1,v2) <= #3.62 ==> + tau3 v0 v1 v2 = taum (norm v0) (norm v1) (norm v2) (dist(v1,v2)) (dist(v0,v2)) (dist(v0,v1))`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.tau3;Nonlinear_lemma.taum_123;Sphere.rhazim2;Sphere.rhazim3;Sphere.node2_y;Sphere.node3_y]; + REWRITE_TAC[Sphere.rhazim;Nonlinear_lemma.sol0_const1]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `dihV (vec 0) v0 v1 v2 = dih_y (norm v0) (norm v1) (norm v2) (dist (v1,v2)) (dist (v0,v2)) (dist (v0,v1)) /\ dihV (vec 0) v1 v2 v0 = dih_y (norm v1) (norm v2) (norm v0) (dist (v0,v2)) (dist (v0,v1)) (dist (v1,v2)) /\ dihV (vec 0) v2 v0 v1 = dih_y (norm v2) (norm v0) (norm v1) (dist (v0,v1)) (dist (v1,v2)) (dist (v0,v2))` ENOUGH_TO_SHOW_TAC; + DISCH_THEN (unlist REWRITE_TAC); + BY(REAL_ARITH_TAC); + REPEAT (GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] Merge_ineq.DIHV_EQ_DIH_Y)); + REWRITE_TAC[DIST_0]; + TYPIFY `dist(v2,v0) = dist(v0,v2) /\ dist(v2,v1) = dist(v1,v2) /\ dist(v1,v0) = dist(v0,v1)` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[DIST_SYM]); + ASM_REWRITE_TAC[]; + REPEAT (GMATCH_SIMP_TAC NONPARALLEL_BALL_ANNULUS_ALT); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let tau3_taum_40 = prove_by_refinement( + `!(v0:real^3) v1 v2. + v0 IN ball_annulus /\ v1 IN ball_annulus /\ v2 IN ball_annulus /\ + &2 <= dist(v0,v1) /\ &2 <= dist(v0,v2) /\ &2 <= dist(v1,v2) /\ + dist(v0,v1) < &4 /\ dist(v0,v2) < &4 /\ dist(v1,v2) < &4 ==> + tau3 v0 v1 v2 = taum (norm v0) (norm v1) (norm v2) (dist(v1,v2)) (dist(v0,v2)) (dist(v0,v1))`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.tau3;Nonlinear_lemma.taum_123;Sphere.rhazim2;Sphere.rhazim3;Sphere.node2_y;Sphere.node3_y]; + REWRITE_TAC[Sphere.rhazim;Nonlinear_lemma.sol0_const1]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `dihV (vec 0) v0 v1 v2 = dih_y (norm v0) (norm v1) (norm v2) (dist (v1,v2)) (dist (v0,v2)) (dist (v0,v1)) /\ dihV (vec 0) v1 v2 v0 = dih_y (norm v1) (norm v2) (norm v0) (dist (v0,v2)) (dist (v0,v1)) (dist (v1,v2)) /\ dihV (vec 0) v2 v0 v1 = dih_y (norm v2) (norm v0) (norm v1) (dist (v0,v1)) (dist (v1,v2)) (dist (v0,v2))` ENOUGH_TO_SHOW_TAC; + DISCH_THEN (unlist REWRITE_TAC); + BY(REAL_ARITH_TAC); + REPEAT (GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] Merge_ineq.DIHV_EQ_DIH_Y)); + REWRITE_TAC[DIST_0]; + TYPIFY `dist(v2,v0) = dist(v0,v2) /\ dist(v2,v1) = dist(v1,v2) /\ dist(v1,v0) = dist(v0,v1)` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[DIST_SYM]); + ASM_REWRITE_TAC[]; + REPEAT (GMATCH_SIMP_TAC NONPARALLEL_BALL_ANNULUS40_ALT); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let DELTA_Y_POS_4POINTS = prove_by_refinement( + `!v0 v1 v2 (v3:real^3). + &0 <= delta_y (dist(v0,v1)) (dist(v0,v2)) (dist(v0,v3)) (dist(v2,v3)) (dist(v1,v3)) (dist(v1,v2))`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_y;arith `x * x = x pow 2`]; + REWRITE_TAC[GSYM Merge_ineq.delta_delta_x]; + BY(REWRITE_TAC[Collect_geom.DELTA_POS_4POINTS]) + ]);; + (* }}} *) + +let tau3_taum_d = prove_by_refinement( + `!d a01 a12 a02 b01 b12 b02. + (&2 <= a01 /\ &2 <= a12 /\ &2 <= a02 /\ b01 <= #3.62 /\ b12 <= #3.62 /\ b02 <= #3.62 /\ + (!y1 y2 y3 y4 y5 y6. + &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + a01 <= y6 /\ y6 <= b01 /\ + a12 <= y4 /\ y4 <= b12 /\ + a02 <= y5 /\ y5 <= b02 /\ + &0 <= delta_y y1 y2 y3 y4 y5 y6 ==> + d <= taum y1 y2 y3 y4 y5 y6) ==> + (!v0 v1 v2. + &2 <= norm v0 /\ norm v0 <= &2 * h0 /\ + &2 <= norm v1 /\ norm v1 <= &2 * h0 /\ + &2 <= norm v2 /\ norm v2 <= &2 * h0 /\ + a01 <= dist(v0,v1) /\ dist(v0,v1) <= b01 /\ + a12 <= dist(v1,v2) /\ dist(v1,v2) <= b12 /\ + a02 <= dist(v0,v2) /\ dist(v0,v2) <= b02 ==> + d <= tau3 v0 v1 v2))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC tau3_taum; + CONJ_TAC; + REWRITE_TAC[Fnjlbxs.in_ball_annulus]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + TYPIFY `&0 <= delta_y (norm v0) (norm v1) (norm v2) (dist (v1,v2)) (dist (v0,v2)) (dist (v0,v1))` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + REWRITE_TAC[GSYM Trigonometry1.DIST_L_ZERO]; + BY(REWRITE_TAC[DELTA_Y_POS_4POINTS]); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let tau3_taum_dfun = prove_by_refinement( + `!d a01 a12 a02 b01 b12 b02 f. + (&2 <= a01 /\ &2 <= a12 /\ &2 <= a02 /\ b01 <= #3.62 /\ b12 <= #3.62 /\ b02 <= #3.62 /\ + (!y1 y2 y3 y4 y5 y6. + &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + a01 <= y6 /\ y6 <= b01 /\ + a12 <= y4 /\ y4 <= b12 /\ + a02 <= y5 /\ y5 <= b02 /\ + &0 <= delta_y y1 y2 y3 y4 y5 y6 ==> + d + f y4 y5 y6 <= taum y1 y2 y3 y4 y5 y6) ==> + (!v0 v1 v2. + &2 <= norm v0 /\ norm v0 <= &2 * h0 /\ + &2 <= norm v1 /\ norm v1 <= &2 * h0 /\ + &2 <= norm v2 /\ norm v2 <= &2 * h0 /\ + a01 <= dist(v0,v1) /\ dist(v0,v1) <= b01 /\ + a12 <= dist(v1,v2) /\ dist(v1,v2) <= b12 /\ + a02 <= dist(v0,v2) /\ dist(v0,v2) <= b02 ==> + d + f (dist(v1,v2)) (dist(v0,v2)) (dist(v0,v1)) <= tau3 v0 v1 v2))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC tau3_taum; + CONJ_TAC; + REWRITE_TAC[Fnjlbxs.in_ball_annulus]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + TYPIFY `&0 <= delta_y (norm v0) (norm v1) (norm v2) (dist (v1,v2)) (dist (v0,v2)) (dist (v0,v1))` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + REWRITE_TAC[GSYM Trigonometry1.DIST_L_ZERO]; + BY(REWRITE_TAC[DELTA_Y_POS_4POINTS]); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let taustar_taum = prove_by_refinement( + `!d a b. + (&2 <= a 0 1 /\ &2 <= a 1 2 /\ &2 <= a 0 2 /\ b 0 1 <= #3.62 /\ b 1 2 <= #3.62 /\ b 0 2 <= #3.62 /\ + (!y1 y2 y3 y4 y5 y6. + &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + a 0 1 <= y6 /\ y6 <= b 0 1 /\ + a 1 2 <= y4 /\ y4 <= b 1 2 /\ + a 0 2 <= y5 /\ y5 <= b 0 2 /\ + &0 <= delta_y y1 y2 y3 y4 y5 y6 ==> + d <= taum y1 y2 y3 y4 y5 y6) ==> + (let s = mk_unadorned_v39 3 d a b in (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + MATCH_MP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] taustar3); + MATCH_MP_TAC tau3_taum_d; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let taustar_taum_dfun = prove_by_refinement( + `!d a b f. (let s = scs_v39 (3,d,a,a,b,b,f,{},{},{}) in + (&2 <= a 0 1 /\ &2 <= a 1 2 /\ &2 <= a 0 2 /\ b 0 1 <= #3.62 /\ b 1 2 <= #3.62 /\ b 0 2 <= #3.62 /\ + (!y1 y2 y3 y4 y5 y6. + &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + a 0 1 <= y6 /\ y6 <= b 0 1 /\ + a 1 2 <= y4 /\ y4 <= b 1 2 /\ + a 0 2 <= y5 /\ y5 <= b 0 2 /\ + &0 <= delta_y y1 y2 y3 y4 y5 y6 ==> + d + #0.1 * + (if is_ear_v39 s + then &1 + else -- &1) * + ((if f 0 1 then cstab - y6 else &0) + + (if f 1 2 then cstab - y4 else &0) + + (if f 2 3 then cstab - y5 else &0) + + &0) <= taum y1 y2 y3 y4 y5 y6) ==> + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))) +`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT GEN_TAC; + DISCH_TAC; + MATCH_MP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] taustar3_fun); + REPEAT GEN_TAC; + TYPIFY `dist(v2,(v0:real^3)) = dist(v0,v2)` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[DIST_SYM]); + REPEAT WEAKER_STRIP_TAC; + REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[TAUT `(a ==> b ==> c) <=> (a /\ b) ==> c` ]; + REWRITE_TAC[TAUT `(a /\ b) /\ c <=> (a /\ b /\ c)`]; + SPEC_TAC (`v2:real^3`,`v2:real^3`); + SPEC_TAC (`v1:real^3`,`v1:real^3`); + SPEC_TAC (`v0:real^3`,`v0:real^3`); + MATCH_MP_TAC tau3_taum_dfun; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let taum_sym = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. taum y1 y2 y3 y4 y5 y6 = taum y2 y1 y3 y5 y4 y6 /\ + taum y1 y2 y3 y4 y5 y6 = taum y1 y3 y2 y4 y6 y5`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlinear_lemma.taum_123;Sphere.rhazim2;Sphere.rhazim3;Sphere.node2_y;Sphere.node3_y]; + REWRITE_TAC[Sphere.rhazim]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (REAL_RING `((e1:real) = e1' /\ e2 = e2' /\ e3 = e3' /\ e1 = e1'' /\ e2 = e2'' /\ e3 = e3'') ==> ((r1 * e1 + r2 * e2 + r3 * e3 - c = r2 * e2' + r1 * e1' + r3 * e3' - c) /\ (r1 * e1 + r2 * e2 + r3 * e3 - c = r1 * e1'' + r3 * e3'' + r2 * e2'' - c))`); + BY(MESON_TAC[Nonlinear_lemma.dih_y_sym;Nonlinear_lemma.dih_y_sym2]) + ]);; + (* }}} *) + +let MOD_4_EXPLICIT = prove_by_refinement( + `0 MOD 4 = 0 /\ 1 MOD 4 = 1 /\ 2 MOD 4 = 2 /\ 3 MOD 4 = 3 /\ 4 MOD 4 = 0 /\ + 5 MOD 4 = 1 /\ 6 MOD 4 = 2`, + (* {{{ proof *) + [ + ASM_SIMP_TAC[MOD_LT;MOD_MULT_ADD;arith `0 < 4 /\ 1 < 4 /\ 2 < 4 /\ 3 < 4 /\ 5 = 1*4 + 1 /\ 6 = 1*4 + 2`]; + BY(ASM_SIMP_TAC[Oxlzlez.MOD_REFL_ALT;arith `~(4 =0)`]) + ]);; + (* }}} *) + +let FUNLIST_EXPLICIT = prove_by_refinement( +`(!data d k i j. + funlist_v39 data d k i j = + (if i MOD k = j MOD k + then &0 + else ASSOCD_v39 (psort k (i,j)) (MAP (\ (u,d). psort k u,d) data) d)) /\ + (!data u u' k i j. funlistA_v39 data (u:A) u' k i j = (if i MOD k = j MOD k + then u + else ASSOCD_v39 (psort k (i,j)) (MAP (\ (u,d). psort k u,d) data) u')) /\ + 0 MOD 3 = 0 /\ + 1 MOD 3 = 1 /\ + 2 MOD 3 = 2 /\ + 3 MOD 3 = 0 /\ + (! (x:real) . x = x) /\ + ~(0 = 1) /\ + ~(0 = 2) /\ + ~(1 = 2) /\ + ~(0 = 3) /\ + ~(1 = 3) /\ + ~(2 = 3) /\ + psort 3 (0,1) = 0,1 /\ + psort 3 (0,2) = 0,2 /\ + psort 3 (1,2) = 1,2 /\ + psort 3 (2,3) = 0,2 /\ + psort 4 (0,1) = 0,1 /\ + psort 4 (0,2) = 0,2 /\ + psort 4 (0,3) = 0,3 /\ + psort 4 (1,2) = (1,2) /\ + psort 4 (1,3) = (1,3) /\ + psort 4 (2,3) = (2,3) /\ + psort 4 (1,0) = (0,1) /\ + psort 4 (2,0) = (0,2) /\ + psort 4 (3,0) = (0,3) /\ + psort 4 (2,1) = (1,2) /\ + psort 4 (3,1) = (1,3) /\ + psort 4 (3,2) = (2,3) /\ + (!(a:A) (b:B) c d. (a,b) = (c,d) <=> (a = c) /\ (b = d)) /\ + (!(a:A) (d:B). ASSOCD_v39 a [] d = d) /\ + (!(a:A) (d:B) h t. ASSOCD_v39 a (CONS h t) d = + (if a = FST h then SND h else ASSOCD_v39 a t d)) /\ + (!k. MAP (\ (u,(d:B)). psort k u,d) [] = []) /\ + (!p d. ASSOCD_v39 (p:A) [] (d:B) = d) /\ + (!k i j r t. + MAP (\ (u,(d:B)). psort k u,d) (CONS ((i,j),r) t) = + CONS (psort k (i,j),r) (MAP (\ (u,d). psort k u,d) t)) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Appendix.funlist_v39;Appendix.funlistA_v39;Appendix.ASSOCD_v39;PAIR_EQ]; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REWRITE_TAC[arith `~(0 = 1) /\ ~(0=2) /\ ~(1=2) /\ ~(0 = 3) /\ ~(1 = 3) /\ ~(2 = 3)`]; + REWRITE_TAC[MAP]; + REWRITE_TAC[Appendix.psort;LET_DEF;LET_END_DEF]; + REWRITE_TAC[MOD_4_EXPLICIT;PAIR_EQ]; + TYPIFY `0 MOD 3 = 0 /\ 1 MOD 3 = 1 /\ 2 MOD 3 = 2` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT (GMATCH_SIMP_TAC MOD_LT); + BY(ARITH_TAC); + ASM_REWRITE_TAC[]; + TYPIFY `3 MOD 3 = 0` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_SIMP_TAC[Oxlzlez.MOD_REFL_ALT;arith `~(3 = 0)`]); + ARITH_TAC + ]);; + (* }}} *) + +let periodic2_funlist = prove_by_refinement( + `!a a0 k. periodic2 (funlist_v39 a a0 k) k`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.periodic2;Appendix.funlist_v39]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + TYPIFY `!i. (i + k) MOD k = i MOD k` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + ONCE_REWRITE_TAC[arith `i + (k:num) = 1 * k + i`]; + BY(REWRITE_TAC[MOD_MULT_ADD]); + TYPIFY `psort k (i + k,j) = psort k (i,j) /\ psort k (i,j+k) = psort k (i,j)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(ASM_REWRITE_TAC[Appendix.psort]); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let periodic2_funlistA = prove_by_refinement( + `!j1 j' j'' k. periodic2 (funlistA_v39 j1 j' (j'':A) k) k`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.periodic2;Appendix.funlistA_v39]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + TYPIFY `!i. (i + k) MOD k = i MOD k` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + ONCE_REWRITE_TAC[arith `i + (k:num) = 1 * k + i`]; + BY(REWRITE_TAC[MOD_MULT_ADD]); + TYPIFY `psort k (i + k,j) = psort k (i,j) /\ psort k (i,j+k) = psort k (i,j)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(ASM_REWRITE_TAC[Appendix.psort]); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let psort_sym = prove_by_refinement( + `!k i j. psort k (i,j) = psort k (j,i)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Appendix.psort]; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + BY(REPEAT COND_CASES_TAC THEN REWRITE_TAC[PAIR_EQ] THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN ARITH_TAC) + ]);; + (* }}} *) + +let funlist_sym = prove_by_refinement( + `!k a a0 i j. funlist_v39 a a0 k i j = funlist_v39 a a0 k j i`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.funlist_v39]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `psort k (i,j) = psort k (j,i)` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[psort_sym]); + REWRITE_TAC[LET_DEF;LET_END_DEF]; + BY(COND_CASES_TAC THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let funlistA_sym = prove_by_refinement( + `!k a (a0:A) a1 i j. funlistA_v39 a a0 a1 k i j = funlistA_v39 a a0 a1 k j i`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.funlistA_v39]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `psort k (i,j) = psort k (j,i)` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[psort_sym]); + REWRITE_TAC[LET_DEF;LET_END_DEF]; + BY(COND_CASES_TAC THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let funlist_diag = prove_by_refinement( + `!a (a0) k i. funlist_v39 a a0 k i i = &0`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Appendix.funlist_v39;LET_DEF;LET_END_DEF]) + ]);; + (* }}} *) + +let funlistA_diag = prove_by_refinement( + `!j1 j2 j3 k i. funlistA_v39 j1 j2 j3 k i i = (j2:A)`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Appendix.funlistA_v39;LET_DEF;LET_END_DEF]) + ]);; + (* }}} *) + +let funlistA_empty = prove_by_refinement( + `!k. funlistA_v39 [] F F k = ( \ i j. F) `, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.funlistA_v39;FUN_EQ_THM;MAP;LET_DEF;LET_END_DEF;Appendix.ASSOCD_v39]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let funlist_kik = prove_by_refinement( + `!b b0 k i. funlist_v39 b b0 k i k = funlist_v39 b b0 k 0 i`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `k MOD k = 0 MOD k` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[arith `k = 1*k + 0`;MOD_MULT_ADD]); + REWRITE_TAC[Appendix.funlist_v39;LET_DEF;LET_END_DEF]; + TYPIFY `psort k (i,k) = psort k (0,i)` (C SUBGOAL_THEN SUBST1_TAC); + ASM_REWRITE_TAC[Appendix.psort;LET_DEF;LET_END_DEF]; + BY(COND_CASES_TAC THEN COND_CASES_TAC THEN REWRITE_TAC[PAIR_EQ] THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN ARITH_TAC); + ASM_REWRITE_TAC[]; + BY(COND_CASES_TAC THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let periodic_mod_reduce = prove_by_refinement( + `!P k. ~(k = 0) /\ periodic P k /\ (!i. i < k ==> P i) ==> (!i. P i)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC Oxl_def.periodic_mod; + TYPIFY `k` EXISTS_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_MESON_TAC[DIVISION]) + ]);; + (* }}} *) + +let periodic2_mod_reduce = prove_by_refinement( + `!P k. ~(k = 0) /\ periodic2 P k /\ (!i j. i < k /\ j < k ==> P i j) ==> (!i j. P i j)`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.periodic2]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!i. periodic (P i) k` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[Oxl_def.periodic]; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!j. periodic (\i. P i j) k` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[Oxl_def.periodic]; + BY(ASM_REWRITE_TAC[]); + TYPIFY `(\ i. P i j) i = (\ i. P i j) (i MOD k)` ((C SUBGOAL_THEN MP_TAC)); + MATCH_MP_TAC Oxl_def.periodic_mod; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + TYPIFY `P (i MOD k) j = P (i MOD k) (j MOD k)` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC Oxl_def.periodic_mod; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN SUBST1_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_MESON_TAC[DIVISION]) + ]);; + (* }}} *) + +let periodic2_mod_sym_reduce = prove_by_refinement( + `!P k. ~(k = 0) /\ periodic2 P k /\ (!i. P i i) /\ + (!i j. P i j = P j i) /\ (!i j. i < j /\ j < k ==> P i j) ==> (!i j. P i j)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC periodic2_mod_reduce; + TYPIFY `k` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `(i:num) < j` ASM_CASES_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `(j:num) < i \/ (j = i)` (C SUBGOAL_THEN MP_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN ARITH_TAC); + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let periodic2_SUC_periodic = prove_by_refinement( + `!f i. periodic2 (f:num->num->A) k ==> periodic (\i. f i (SUC i)) k`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.periodic2;Oxl_def.periodic]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `SUC (i + k) = SUC i + k` (C SUBGOAL_THEN SUBST1_TAC); + BY(ARITH_TAC); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let periodic_vv_inj = prove_by_refinement( + `!vv k. periodic (vv:num->A) k /\ ~(k = 0) /\ + (!i j. i < k /\ j < k /\ vv i = vv j ==> (i = j)) ==> + (!i j. (vv i = vv j) <=> (i MOD k = j MOD k)) + `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Geomdetail.EQ_EXPAND]; + CONJ2_TAC; + BY(ASM_MESON_TAC[Oxl_def.periodic_mod]); + INTRO_TAC Oxl_def.periodic_mod [`vv`;`k`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist ONCE_REWRITE_TAC); + BY(ASM_MESON_TAC[DIVISION]) + ]);; + (* }}} *) + +let I_LT_J_LT_3_EXPLICIT = prove_by_refinement( + `!i j. (i < j /\ j < 3) <=> ((i = 0 /\ j = 1) \/ (i = 0 /\ j = 2) \/ (i = 1 /\ j = 2))`, + (* {{{ proof *) + [ + BY(ARITH_TAC) + ]);; + (* }}} *) + +let I_LT_J_LT_4_EXPLICIT = prove_by_refinement( + `!i j. (i < j /\ j < 4) <=> ((i = 0 /\ j = 1) \/ (i = 0 /\ j = 2) \/ (i = 0 /\ j = 3) \/ (i = 1 /\ j = 2) \/ + (i = 1 /\ j = 3) \/ (i = 2 /\ j = 3))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Geomdetail.EQ_EXPAND]; + CONJ2_TAC; + BY(ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `j = 1 \/ j = 2 \/ j = 3` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[] THEN REPEAT (FIRST_X_ASSUM MP_TAC); + BY(ARITH_TAC); + BY(ARITH_TAC); + BY(ARITH_TAC) + ]);; + (* }}} *) + +let is_scs_funlist = prove_by_refinement( + `!k d a0 b0 j0 a b j1 u u' u''. d < #0.9 /\ 3 <= k /\ k <= 6 /\ + periodic u k /\ periodic u' k /\ periodic u'' k /\ + (!i j. i < j /\ j < k ==> funlist_v39 a a0 k i j <= funlist_v39 b b0 k i j) /\ + (!i j. i < j /\ j < k ==> &2 <= funlist_v39 a a0 k i j) /\ + (!i. i < 3 /\ k = 3 ==> funlist_v39 b b0 k i (SUC i) < &4) /\ + (!i. i < k /\ 3 < k ==> funlist_v39 b b0 k i (SUC i) <= cstab) /\ + (!i j. i < j /\ j < k /\ + funlistA_v39 j1 F j0 k i j + ==> funlist_v39 a a0 k i j = sqrt8 /\ funlist_v39 b b0 k i j = cstab) /\ + (!i j. i < j /\ j < k /\ + funlistA_v39 j1 F j0 k i j + ==> j = SUC i \/ (i = 0 /\ SUC j = k)) /\ + CARD + {i | i < k /\ + (&2 * h0 < funlist_v39 b b0 k i (SUC i) \/ + &2 < funlist_v39 a a0 k i (SUC i))} + + k <= 6 ==> + is_scs_v39 (scs_v39 (k,d, + funlist_v39 a a0 k,funlist_v39 a a0 k, + funlist_v39 b b0 k,funlist_v39 b b0 k, + funlistA_v39 j1 F j0 k,u,u',u''))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[Appendix.is_scs_v39;Appendix.scs_v39_explicit;arith `x <= x`;Appendix.periodic_empty]; + REWRITE_TAC[periodic2_funlist;periodic2_funlistA]; + REWRITE_TAC[funlist_sym;funlistA_sym;funlist_diag]; + CONJ_TAC; + MATCH_MP_TAC periodic2_mod_sym_reduce; + TYPIFY `k` EXISTS_TAC; + ASM_REWRITE_TAC[TAUT `(a /\ a' ==> b ==> c) <=> (a /\ a' /\ b ==> c)` ]; + ASM_SIMP_TAC[arith `3 <= k ==> ~(k=0)`]; + REWRITE_TAC[funlist_diag;arith `&0 <= &0`]; + CONJ_TAC; + REWRITE_TAC[Appendix.periodic2]; + BY(MESON_TAC[periodic2_funlist;Appendix.periodic2]); + BY(MESON_TAC[funlist_sym]); + COMMENT "next goal"; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `i < (j:num)` ASM_CASES_TAC; + BY(ASM_MESON_TAC[]); + ONCE_REWRITE_TAC[funlist_sym]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_SIMP_TAC[arith `~(i = j) /\ ~(i < j) ==> (j < (i:num))`]); + COMMENT "next goal again"; + CONJ_TAC; + REWRITE_TAC[RIGHT_FORALL_IMP_THM]; + DISCH_TAC; + MATCH_MP_TAC periodic_mod_reduce; + TYPIFY `k` EXISTS_TAC; + ASM_SIMP_TAC [arith `k=3 ==> ~(k=0)`]; + REWRITE_TAC[Oxl_def.periodic]; + BY(ASM_MESON_TAC[periodic2_funlist;periodic2_SUC_periodic;Oxl_def.periodic]); + COMMENT "next"; + CONJ_TAC; + REWRITE_TAC[RIGHT_FORALL_IMP_THM]; + DISCH_TAC; + MATCH_MP_TAC periodic_mod_reduce; + TYPIFY `k` EXISTS_TAC; + ASM_SIMP_TAC [arith `3 < k ==> ~(k=0)`]; + REWRITE_TAC[Oxl_def.periodic]; + BY(ASM_MESON_TAC[periodic2_funlist;periodic2_SUC_periodic;Oxl_def.periodic]); + COMMENT "pentultimate"; + CONJ2_TAC; + MATCH_MP_TAC periodic2_mod_sym_reduce; + TYPIFY `k` EXISTS_TAC; + ASM_SIMP_TAC [arith `3 <= k ==> ~(k=0)`]; + CONJ_TAC; + REWRITE_TAC[Appendix.periodic2]; + BY(REWRITE_TAC[ (REWRITE_RULE[Appendix.periodic2] periodic2_funlist); (REWRITE_RULE[Appendix.periodic2] periodic2_funlistA)]); + REWRITE_TAC[funlistA_diag]; + BY(MESON_TAC[funlistA_sym;funlist_sym]); + COMMENT "final"; + MATCH_MP_TAC periodic2_mod_sym_reduce; + TYPIFY `k` EXISTS_TAC; + ASM_SIMP_TAC [arith `3 <= k ==> ~(k=0)`]; + CONJ_TAC; + REWRITE_TAC[Appendix.periodic2]; + (REWRITE_TAC[ (REWRITE_RULE[Appendix.periodic2] periodic2_funlist); (REWRITE_RULE[Appendix.periodic2] periodic2_funlistA)]); + REWRITE_TAC[arith `SUC (i + k) = SUC i + k`]; + ONCE_REWRITE_TAC[arith `(i + k) = (1 * k + i)`]; + BY(REWRITE_TAC[MOD_MULT_ADD]); + REWRITE_TAC[funlistA_diag]; + CONJ_TAC; + BY(MESON_TAC[funlistA_sym;funlist_sym]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`i`;`j`]); + ASM_REWRITE_TAC[]; + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + TYPIFY `k MOD k = (1 * k + 0) MOD k` (C SUBGOAL_THEN SUBST1_TAC); + AP_THM_TAC; + AP_TERM_TAC; + BY(ARITH_TAC); + BY(REWRITE_TAC[MOD_MULT_ADD]) + ]);; + (* }}} *) + +let is_ear_scs3 = prove_by_refinement( + `!a b jf. is_ear_v39 (scs_v39 (3, #0.11, a, a, b, b, jf, {}, {},{})) <=> + is_scs_v39 (scs_v39 (3, #0.11, a,a,b,b,jf, {},{},{})) /\ + (!i. b i i = &0) /\ + (?i. {i | i < 3 /\ jf i (SUC i)} = {i} /\ + a i (SUC i) = sqrt8 /\ b i (SUC i) = cstab /\ + (!j. j < 3 /\ ~(j = i) ==> a j (SUC j) = &2 /\ b j (SUC j) = &2 * h0))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Appendix.is_ear_v39;Appendix.scs_v39_explicit]; + ASM_CASES_TAC `~is_scs_v39 (scs_v39 (3, #0.11,a,a,b,b,jf,{},{},{}))`; + BY(ASM_REWRITE_TAC[]); + RULE_ASSUM_TAC (REWRITE_RULE[ (TAUT `~ ~ x = x`)]); + ASM_REWRITE_TAC[]; + ASM_CASES_TAC `~(?i. {i | i < 3 /\ jf i (SUC i)} = {i} /\ a i (SUC i) = sqrt8 /\ b i (SUC i) = cstab /\ (!j. j < 3 /\ ~(j = i) ==> a j (SUC j) = &2 /\ b j (SUC j) = &2 * h0))`; + BY(ASM_REWRITE_TAC[]); + RULE_ASSUM_TAC (REWRITE_RULE[ (TAUT `~ ~ x = x`)]); + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[Appendix.unadorned_v39;Appendix.scs_v39_explicit]) + ]);; + (* }}} *) + +let is_scs_scs3 = prove_by_refinement( + `! d a a0 b b0 jf j0 . d < #0.9 /\ + funlist_v39 a a0 3 0 1 <= funlist_v39 b b0 3 0 1 /\ + funlist_v39 a a0 3 0 2 <= funlist_v39 b b0 3 0 2 /\ + funlist_v39 a a0 3 1 2 <= funlist_v39 b b0 3 1 2 /\ + &2 <= funlist_v39 a a0 3 0 1 /\ + &2 <= funlist_v39 a a0 3 1 2 /\ + &2 <= funlist_v39 a a0 3 0 2 /\ + funlist_v39 b b0 3 0 1 < &4 /\ + funlist_v39 b b0 3 0 2 < &4 /\ + funlist_v39 b b0 3 1 2 < &4 /\ + (!i j. + i < j /\ j < 3 /\ funlistA_v39 jf F j0 3 i j + ==> funlist_v39 a a0 3 i j = sqrt8 /\ funlist_v39 b b0 3 i j = cstab) + ==> + is_scs_v39 + (scs_v39 + (3, + d, + funlist_v39 a a0 3, + funlist_v39 a a0 3, + funlist_v39 b b0 3, + funlist_v39 b b0 3, + funlistA_v39 jf F j0 3, + {},{}, + {}))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC is_scs_funlist; + ASM_REWRITE_TAC[Appendix.periodic_empty;arith `3 <= 3 /\ 3 <= 6 /\ ~(3 < 3)`]; + REWRITE_TAC[arith `x + 3 <= 6 <=> x <= 3`]; + TYPIFY `CARD {i | i < 3 /\ (&2 * h0 < funlist_v39 b b0 3 i (SUC i) \/ &2 < funlist_v39 a a0 3 i (SUC i))} <= 3` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + ENOUGH_TO_SHOW_TAC `CARD {i | i < 3 /\ (&2 * h0 < funlist_v39 b b0 3 i (SUC i) \/ &2 < funlist_v39 a a0 3 i (SUC i))} <= CARD {i | i < 3}`; + TYPIFY `{i | i < 3} = (0..2)` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[IN_NUMSEG;EXTENSION;IN_ELIM_THM]; + BY(ARITH_TAC); + BY(REWRITE_TAC[CARD_NUMSEG;arith `2 + 1 = 3 /\ 3 - 0 = 3`]); + MATCH_MP_TAC CARD_SUBSET; + CONJ_TAC; + BY(SET_TAC[]); + BY(REWRITE_TAC[FINITE_NUMSEG_LT]); + REWRITE_TAC[I_LT_J_LT_3_EXPLICIT]; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + BY(REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[]); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + BY(REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[]); + CONJ_TAC; + REWRITE_TAC[arith `i < 3 <=> (i = 0 \/ i = 1 \/ i = 2)`]; + REPEAT WEAKER_STRIP_TAC; + BY(REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[arith `SUC 0 = 1 /\ SUC 1 = 2 /\ SUC 2 = 3`;funlist_kik]); + REWRITE_TAC[TAUT `(a /\ b /\ c ==> d) <=> (a /\ b ==> (c ==> d))`]; + REWRITE_TAC[I_LT_J_LT_3_EXPLICIT]; + REPEAT WEAKER_STRIP_TAC; + BY(REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[arith `SUC 0 = 1 /\ SUC 1 = 2 /\ SUC 2 = 3`]) + ]);; + (* }}} *) + +let is_scs_ear_3603097872 = prove_by_refinement( + `is_scs_v39 (scs_v39 + (3, + #0.11, + funlist_v39 [(0,1),sqrt8] (&2) 3, + funlist_v39 [(0,1),sqrt8] (&2) 3, + funlist_v39 [(0,1),cstab] (&2 * h0) 3, + funlist_v39 [(0,1),cstab] (&2 * h0) 3, + funlistA_v39 [(0,1),T] F F 3, + {},{}, + {}))`, + (* {{{ proof *) + [ + MATCH_MP_TAC is_scs_scs3; + TYPIFY `(!i j. i < j /\ j < 3 /\ funlistA_v39 [(0,1),T] F F 3 i j ==> funlist_v39 [(0,1),sqrt8] (&2) 3 i j = sqrt8 /\ funlist_v39 [(0,1),cstab] (&2 * h0) 3 i j = cstab)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + REWRITE_TAC[TAUT `(a /\ b /\ c ==> d) <=> (a /\ b ==> (c ==> d))`]; + REWRITE_TAC[I_LT_J_LT_3_EXPLICIT]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + BY((REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[FUNLIST_EXPLICIT])); + REWRITE_TAC[FUNLIST_EXPLICIT;arith `#0.11 < #0.9`]; + REWRITE_TAC[Appendix.cstab;Sphere.h0]; + INTRO_TAC Flyspeck_constants.bounds []; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let is_ear_3603097872 = prove_by_refinement( + `is_ear_v39 (scs_v39 + (3, + #0.11, + funlist_v39 [(0,1),sqrt8] (&2) 3, + funlist_v39 [(0,1),sqrt8] (&2) 3, + funlist_v39 [(0,1),cstab] (&2 * h0) 3, + funlist_v39 [(0,1),cstab] (&2 * h0) 3, + funlistA_v39 [(0,1),T] F F 3, + {},{}, + {})) `, + (* {{{ proof *) + [ + REWRITE_TAC[ is_ear_scs3;is_scs_ear_3603097872;funlist_diag]; + EXISTS_TAC `0`; + REWRITE_TAC[arith `SUC 0 = 1`;arith `!j. (j < 3 /\ ~(j = 0) <=> (j = 1 \/ j = 2))`]; + CONJ_TAC; + REWRITE_TAC[EXTENSION;IN_SING;IN_ELIM_THM]; + GEN_TAC; + MP_TAC (arith `x = 0 \/ x = 1 \/ x = 2 \/ ~(x < 3)`); + DISCH_TAC; + BY(REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_SIMP_TAC[arith `0 < 3 /\ 1 < 3 /\ 2 < 3 /\ (~(x < 3 ) ==> ~(x = 0))`;FUNLIST_EXPLICIT;arith `SUC 0 = 1 /\ SUC 1 = 2 /\ SUC 2 = 3`]); + TYPIFY `(!j. j = 1 \/ j = 2 ==> funlist_v39 [(0,1),sqrt8] (&2) 3 j (SUC j) = &2 /\ funlist_v39 [(0,1),cstab] (&2 * h0) 3 j (SUC j) = &2 * h0)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + REPEAT WEAKER_STRIP_TAC; + BY(REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_SIMP_TAC[arith `SUC 1 = 2 /\ SUC 2 = 3`;FUNLIST_EXPLICIT;funlist_kik]); + BY(REWRITE_TAC[FUNLIST_EXPLICIT]) + ]);; + (* }}} *) + +let REAL_FINITE_MIN_EXISTS = +prove(`!S:real->bool. FINITE S /\ ~(S = {}) ==> ?m. m IN S /\ (!x. x IN S ==> m <= x)`, + MESON_TAC[INF_FINITE]);; + +let REAL_WLOG_SQUARE_LEMMA = prove_by_refinement( + `!P. (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y2 y3 y4 y1 y6 y5) /\ + (!y1 y2 y3 y4 y5 y6. (y2 <= y1) /\ (y3 <= y1) /\ (y4 <= y1) + ==> + P y1 y2 y3 y4 y5 y6) ==> + (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `?a. a IN {y1,y2,y3,y4} /\ (!x. x IN {y1,y2,y3,y4} ==> x <= a)` MP_TAC; + MATCH_MP_TAC Merge_ineq.REAL_FINITE_MAX_EXISTS; + BY(REWRITE_TAC[ FINITE_INSERT ; FINITE_EMPTY;NOT_INSERT_EMPTY]); + REPEAT WEAK_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `IN` MP_TAC); + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[MESON[] `(!x. x = y1 \/ x = y2 \/ x = y3 \/ x = y4 ==> x <= a) = (y1 <= a /\ y2 <= a /\ y3 <= a /\ y4 <= a)`]; + BY(DISCH_THEN STRIP_ASSUME_TAC THEN ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let REAL_WLOG_SQUARE2_LEMMA = prove_by_refinement( +`!P. (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y2 y3 y4 y1 y6 y5 + /\ P y1 y2 y3 y4 y5 y6 = P y1 y4 y3 y2 y6 y5) /\ + (!y1 y2 y3 y4 y5 y6. (y2 <= y1) /\ (y3 <= y1) /\ (y4 <= y1) /\ (y4 <= y2) + ==> + P y1 y2 y3 y4 y5 y6) ==> + (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + GEN_TAC; + DISCH_TAC; + MATCH_MP_TAC REAL_WLOG_SQUARE_LEMMA; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[arith `y2 <= y4 \/ y4 <= y2`]) + ]);; + (* }}} *) + +let EE_vv = prove_by_refinement( + `!vv k i. + periodic (vv:num->A) k /\ 3 <= k /\ + (!i (j:num). i < k /\ j < k /\ vv i = vv j ==> i = j) ==> + (EE (vv i) (IMAGE (\i. {vv i, vv (SUC i)}) (:num))) = { vv (SUC i) , vv (i + (k -1)) }`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(k=0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + REWRITE_TAC[Lvducxu.IN_EE_IFF_IN_E;EXTENSION;IN_INSERT;NOT_IN_EMPTY]; + X_GEN_TAC `ww:A`; + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + REWRITE_TAC[Geomdetail.EQ_EXPAND]; + CONJ2_TAC; + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_MESON_TAC[]); + TYPIFY `i + k - 1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; + DISJ2_TAC; + ASM_SIMP_TAC[arith `3 <= k ==> SUC(i + k - 1) = i +k`]; + BY(ASM_MESON_TAC[Oxl_def.periodic]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; + DISCH_THEN DISJ_CASES_TAC; + ASM_REWRITE_TAC[]; + DISJ1_TAC; + FIRST_X_ASSUM MP_TAC; + INTRO_TAC Oxl_def.periodic_mod [`vv`;`k`]; + REWRITE_TAC[GSYM RIGHT_IMP_FORALL_THM]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN (unlist ONCE_REWRITE_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `i MOD k = x MOD k` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[DIVISION]); + AP_TERM_TAC; + REWRITE_TAC[arith `SUC x = x + 1`]; + GMATCH_SIMP_TAC (GSYM MOD_ADD_MOD); + FIRST_X_ASSUM (SUBST1_TAC o GSYM); + GMATCH_SIMP_TAC MOD_ADD_MOD; + BY(ASM_REWRITE_TAC[]); + COMMENT "last case"; + ASM_REWRITE_TAC[]; + DISJ2_TAC; + FIRST_X_ASSUM MP_TAC; + INTRO_TAC Oxl_def.periodic_mod [`vv`;`k`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist ONCE_REWRITE_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `i MOD k = SUC x MOD k` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[DIVISION]); + AP_TERM_TAC; + GMATCH_SIMP_TAC (GSYM MOD_ADD_MOD); + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC MOD_ADD_MOD; + ASM_SIMP_TAC[arith `3 <= k ==> (SUC x + k - 1 = 1 * k + x)`]; + BY(REWRITE_TAC[MOD_MULT_ADD]) + ]);; + (* }}} *) + +let tau_fun_azim = prove_by_refinement( + `!vv k . + (let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + let f = IMAGE (\i. vv i,vv (SUC i)) (:num) in + (periodic vv k /\ 3 <= k /\ + (!i j. i < k /\ j < k /\ vv i = vv j ==> (i = j)) ==> + tau_fun V E f = sum {i | i < k} (\i. rho_fun (norm (vv i)) * + azim (vec 0) (vv i) (vv (i+1)) (vv (i + (k-1)))) - (pi + sol0) * (&k - &2)))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF;Appendix.tau_fun]; + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC (GSYM Oxlzlez.PERIODIC_IMAGE); + TYPIFY `k` EXISTS_TAC; + CONJ_TAC; + ASM_SIMP_TAC[arith `3 <= k ==> ~(0 = k)`]; + FIRST_X_ASSUM_ST `periodic` MP_TAC; + REWRITE_TAC[Oxl_def.periodic;PAIR_EQ]; + BY(MESON_TAC[arith `SUC (i + k) = SUC i + k`]); + MATCH_MP_TAC (arith `s = s' /\ b = b' ==> s - (pi+sol0) * b = s' - (pi+sol0) * b'`); + GMATCH_SIMP_TAC CARD_IMAGE_INJ; + ASM_REWRITE_TAC[IN_ELIM_THM;PAIR_EQ;FINITE_NUMSEG_LT;CARD_NUMSEG_LT]; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + CONJ2_TAC; + GMATCH_SIMP_TAC REAL_OF_NUM_SUB; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + GMATCH_SIMP_TAC SUM_IMAGE; + ASM_REWRITE_TAC[IN_ELIM_THM;PAIR_EQ;FINITE_NUMSEG_LT;CARD_NUMSEG_LT]; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC SUM_EQ; + REWRITE_TAC[IN_ELIM_THM;o_THM]; + REPEAT WEAKER_STRIP_TAC; + AP_TERM_TAC; + REWRITE_TAC[Localization.azim_in_fan;LET_DEF;LET_END_DEF]; + GMATCH_SIMP_TAC EE_vv; + TYPIFY `k` EXISTS_TAC; + ASM_REWRITE_TAC[]; + COND_CASES_TAC; + REWRITE_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]; + BY(REWRITE_TAC[arith `SUC x = x + 1`]); + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `CARD` MP_TAC; + TYPIFY `~(k = 0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + REWRITE_TAC[]; + MATCH_MP_TAC (arith `c = 2 ==> c > 1`); + MATCH_MP_TAC Hypermap.CARD_TWO_ELEMENTS; + INTRO_TAC Oxl_def.periodic_mod [`vv`;`k`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist ONCE_REWRITE_TAC); + DISCH_TAC; + TYPIFY `SUC x MOD k = (x + k - 1) MOD k` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[DIVISION]); + INTRO_TAC Oxlzlez.MOD_INJ1_ALT [`k-2`;`k`]; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `3 <= k` MP_TAC) THEN ARITH_TAC); + DISCH_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`SUC x`]); + ASM_REWRITE_TAC[]; + BY(ASM_SIMP_TAC[arith `3 <= k ==> SUC x + k - 2 = x + k - 1`]) + ]);; + (* }}} *) + +let vv_rho_node1 = prove_by_refinement( + `!vv k . + (let V = IMAGE vv (:num) in + let f = IMAGE (\i. vv i,vv (SUC i)) (:num) in + (periodic vv k /\ 3 <= k /\ + (!i j. i < k /\ j < k /\ vv i = vv j ==> (i = j)) ==> + (!i. rho_node1 f (vv i) = vv (SUC i))))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Local_lemmas.rho_node1]; + TYPIFY `~( k = 0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + SELECT_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[IN_IMAGE;IN_UNIV;PAIR_EQ]); + REPEAT (FIRST_X_ASSUM MP_TAC) THEN REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC); + INTRO_TAC periodic_vv_inj [`vv`;`k`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist ONCE_REWRITE_TAC); + REWRITE_TAC[arith `SUC u = u + 1`]; + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC [GSYM MOD_ADD_MOD]; + GMATCH_SIMP_TAC (GSYM MOD_ADD_MOD); + TYPIFY `x' MOD k = i MOD k` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC MOD_ADD_MOD; + BY(ASM_REWRITE_TAC[]); + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `IMAGE` MP_TAC; + REWRITE_TAC[]; + TYPIFY `vv(SUC i)` EXISTS_TAC; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let ITER_vv_rho_node1 = prove_by_refinement( + `!vv k j. (let V = IMAGE vv (:num) in + let f = IMAGE (\i. vv i,vv (SUC i)) (:num) in + (periodic vv k /\ 3 <= k /\ + (!i j. i < k /\ j < k /\ vv i = vv j ==> (i = j)) ==> + (!i. ITER j (rho_node1 f) (vv i) = vv (i+j))))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + SPEC_TAC (`j:num`,`j:num`); + INDUCT_TAC; + BY(REWRITE_TAC[ITER;arith `i + 0 = i`]); + ASM_SIMP_TAC[ITER]; + INTRO_TAC vv_rho_node1 [`vv`;`k`]; + ASM_REWRITE_TAC[LET_DEF;LET_END_DEF]; + DISCH_THEN (unlist REWRITE_TAC); + AP_TERM_TAC; + BY(ARITH_TAC) + ]);; + (* }}} *) + +let PRIOR_TO_LESS_THAN_PI_LEMMA_ALT = prove_by_refinement( + `!V E FF v. convex_local_fan (V,E,FF) /\ v IN V + ==> (!w. w IN V + ==> azim (vec 0) v (rho_node1 FF v) w <= + azim (vec 0) v (rho_node1 FF v) + (azim_cycle (EE v E) (vec 0) v (rho_node1 FF v)))`, + (* {{{ proof *) + [ + MESON_TAC[Local_lemmas.PRIOR_TO_LESS_THAN_PI_LEMMA] + ]);; + (* }}} *) + +let vv_azim_le = prove_by_refinement( + `!vv k i j. + (let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + let f = IMAGE (\i. vv i,vv (SUC i)) (:num) in + (periodic vv k /\ 3 <= k /\ + V SUBSET ball_annulus /\ + dist(vv i, vv (SUC i)) < &4 /\ + dist(vv i, vv (i+k - 1)) < &4 /\ + dist(vv i, vv j) < &4 /\ + ~(i MOD k = j MOD k) /\ + (!i j. ~(vv i = vv j) ==> &2 <= dist(vv i,vv j) ) /\ + convex_local_fan (V,E,f) /\ + (!i j. i < k /\ j < k /\ vv i = vv j ==> (i = j)) + ==> azim (vec 0) (vv i) (vv (SUC i)) (vv j) <= azim (vec 0) (vv i) (vv (SUC i)) (vv (i + k - 1))))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(k=0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + INTRO_TAC PRIOR_TO_LESS_THAN_PI_LEMMA_ALT [`IMAGE vv (:num)`; `IMAGE (\i. {vv i, vv (SUC i)}) (:num)`; `IMAGE (\i. vv i,vv (SUC i)) (:num)`;`vv i`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(SET_TAC[]); + DISCH_THEN (C INTRO_TAC [`vv j`]); + ANTS_TAC; + BY(SET_TAC[]); + INTRO_TAC vv_rho_node1 [`vv`;`k`]; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN (unlist REWRITE_TAC); + GMATCH_SIMP_TAC EE_vv; + TYPIFY `k` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]; + ]);; + (* }}} *) + +let vv_split_azim = prove_by_refinement( + `!vv k i j. + (let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + let f = IMAGE (\i. vv i,vv (SUC i)) (:num) in + (periodic vv k /\ 3 <= k /\ + V SUBSET ball_annulus /\ + dist(vv i, vv (SUC i)) < &4 /\ + dist(vv i, vv (i+k - 1)) < &4 /\ + dist(vv i, vv j) < &4 /\ + ~(i MOD k = j MOD k) /\ + (!i j. ~(vv i = vv j) ==> &2 <= dist(vv i,vv j) ) /\ + convex_local_fan (V,E,f) /\ + (!i j. i < k /\ j < k /\ vv i = vv j ==> (i = j)) + ==> azim (vec 0) (vv i) (vv (SUC i)) (vv (i + k - 1)) = + azim (vec 0) (vv i) (vv (SUC i)) (vv j) + + azim (vec 0) (vv i) (vv j) (vv (i + k - 1))))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(k=0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + INTRO_TAC vv_azim_le [`vv`;`k`;`i`;`j`]; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + MATCH_MP_TAC Fan.sum4_azim_fan; + ASM_REWRITE_TAC[]; + REPEAT (GMATCH_SIMP_TAC NONPARALLEL_BALL_ANNULUS40_ALT); + ASM_REWRITE_TAC[]; + RULE_ASSUM_TAC (REWRITE_RULE[IMAGE_SUBSET_IN;IN_UNIV]); + ASM_REWRITE_TAC[]; + REPEAT (FIRST_ASSUM_ST `dist` GMATCH_SIMP_TAC); + INTRO_TAC periodic_vv_inj [`vv`;`k`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN (unlist ASM_REWRITE_TAC); + REWRITE_TAC[arith `SUC i = (i +1)`]; + BY(ASM_MESON_TAC[Oxlzlez.MOD_INJ1_ALT;arith `3 <= k ==> (k - 1 < k)`;arith `3 <=k ==> 1 < k`;arith `3 <=k ==> ~(k- 1=0)`;arith `~(1 = 0)`]) + ]);; + (* }}} *) + +let EGHNAVX1_ALT = prove_by_refinement( + `!V E FF bta v0 ww k. convex_local_fan (V,E,FF) /\ + v0 IN V /\ + CARD V = k /\ + (!v. v IN V /\ ~(v = v0) ==> ~collinear {vec 0, v0, v}) /\ + (!i. ITER i (rho_node1 FF) v0 = ww i) /\ + (!i. azim (vec 0) v0 (ww 1) (ww i) = bta i) + ==> (!i j. i < j /\ j < k ==> bta i <= bta j)`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + DISCH_THEN (MP_TAC o (MATCH_MP Local_lemmas.EGHNAVX)); + BY(DISCH_THEN (unlist REWRITE_TAC)) + ]);; + (* }}} *) + +let vv_split_azim_generic = prove_by_refinement( + `!vv k i j j'. + (let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + let f = IMAGE (\i. vv i,vv (SUC i)) (:num) in + (periodic vv k /\ 3 <= k /\ + (0< j) /\ (j < j') /\ (j' < k) /\ + generic V E /\ + convex_local_fan (V,E,f) /\ + (!i j. i < k /\ j < k /\ vv i = vv j ==> (i = j)) + ==> azim (vec 0) (vv i) (vv (SUC i)) (vv (i+j')) = + azim (vec 0) (vv i) (vv (SUC i)) (vv (i+j)) + + azim (vec 0) (vv i) (vv (i+j)) (vv (i+j'))))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(k=0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + TYPIFY `!i. vv i IN IMAGE vv (:num)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(ASM_MESON_TAC[]); + INTRO_TAC EGHNAVX1_ALT [`IMAGE vv (:num)`; `IMAGE (\i. {vv i, vv (SUC i)}) (:num)`; `IMAGE (\i. vv i,vv (SUC i)) (:num)`;`\j. azim (vec 0) (vv i) (vv (SUC i)) (vv (i + j))`;`vv i`;`\j. ITER j (rho_node1 (IMAGE (\i. vv i,vv (SUC i)) (:num))) (vv i)`;`k`]; + ASM_REWRITE_TAC[]; + INTRO_TAC ITER_vv_rho_node1 [`vv`;`k`]; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist REWRITE_TAC); + REWRITE_TAC[arith `i + 1 = SUC i`]; + INTRO_TAC Nkezbfc_local.PROPERTIES_GENERIC_LOCAL_FAN [`IMAGE vv (:num)`;`IMAGE (\i. {vv i, vv (SUC i)}) (:num)`;`IMAGE (\i. vv i,vv (SUC i)) (:num)`;`vv i`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + MATCH_MP_TAC Local_lemmas.CVX_LO_IMP_LO; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + ASM_REWRITE_TAC[]; + ANTS_TAC; + GMATCH_SIMP_TAC (GSYM Oxlzlez.PERIODIC_IMAGE); + TYPIFY `k` EXISTS_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC CARD_IMAGE_INJ; + BY(ASM_REWRITE_TAC[IN_ELIM_THM;CARD_NUMSEG_LT;FINITE_NUMSEG_LT ]); + DISCH_THEN (C INTRO_TAC [`j`;`j'`]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + MATCH_MP_TAC Fan.sum4_azim_fan; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `IMAGE` (REPEAT o GMATCH_SIMP_TAC); + ASM_REWRITE_TAC[]; + INTRO_TAC periodic_vv_inj [`vv`;`k`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN (unlist REWRITE_TAC); + REWRITE_TAC[arith `SUC i = i + 1`]; + BY(REPEAT CONJ_TAC THEN MATCH_MP_TAC (REWRITE_RULE[GSYM RIGHT_FORALL_IMP_THM] (GSYM Oxlzlez.MOD_INJ1_ALT)) THEN ASM_REWRITE_TAC[] THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC) + ]);; + (* }}} *) + +let muR_ALT = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6 y7 y8 y9. muR y1 y2 y3 y4 y5 y6 y7 y8 y9 = + cayleyR (y6 * y6) (y5 * y5) (y1 * y1) (y7 * y7) (y4 * y4) (y2 * y2) + (y8 * y8) + (y3 * y3) + (y9 * y9) + `, + (* {{{ proof *) + [ + BY(REWRITE_TAC[FUN_EQ_THM;Mur.muR]) + ]);; + (* }}} *) + +let enclosed4_lemma = prove_by_refinement( + `!(v0:real^3) v1 v2 v3. + (let y1 = norm (v1) in + let y2 = norm (v2) in + let y3 = norm (v0) in + let y4 = dist(v0, v2) in + let y5 = dist(v0, v1) in + let y6 = dist(v1, v2) in + let y7 = norm (v3) in + let y8 = dist(v0,v3) in + let y9 = dist(v2,v3) in + ( + &0 < ups_x (norm (v0) * norm (v0)) (norm (v2) * norm (v2)) (dist(v0,v2) * dist(v0,v2)) /\ + chi_msb [(vec 0);v0;v2] v1 * chi_msb [(vec 0);v0;v2] v3 <= &0 + ==> dist(v1 ,v3) = + enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Enclosed.enclosed]; + INTRO_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] Collect_geom2.CAYLEYR_5POINTS) [`(vec 0):real^3`;`v0`;`v2`;`v1`;`v3`]; + REWRITE_TAC[DIST_0]; + TYPIFY `dist(v2,v1) = dist(v1,v2)` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[DIST_SYM]); + DISCH_TAC; + TYPED_ABBREV_TAC `p = muR (norm (v1:real^3)) (dist (v0,v1)) (dist (v1,v2)) (dist (v0,v2)) (norm v2) (norm v0) (norm v3) (dist (v0,v3)) (dist (v2,v3))`; + TYPIFY `quadratic_root_plus (abc_of_quadratic p) = dist (v1,v3) pow 2` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + GMATCH_SIMP_TAC POW_2_SQRT; + BY(REWRITE_TAC[DIST_POS_LE]); + FIRST_X_ASSUM_ST `muR` MP_TAC; + REWRITE_TAC[muR_ALT]; + DISCH_THEN (SUBST1_TAC o GSYM); + TYPED_ABBREV_TAC `a = ups_x (norm (v0) * norm (v0)) (norm (v2) * norm (v2)) (dist(v0,v2) * dist(v0,v2))` ; + TYPED_ABBREV_TAC `b = cayleytr (norm v0 * norm v0) (norm v2 * norm v2) (norm v1 * norm v1) (norm v3 * norm v3) (dist (v0,v2) * dist (v0,v2)) (dist (v0,v1) * dist (v0,v1)) (dist (v0,v3) * dist (v0,v3)) (dist (v1,v2) * dist (v1,v2)) (dist (v2,v3) * dist (v2,v3)) (&0)` ; + TYPED_ABBREV_TAC `c = cayleyR (norm v0 * norm v0) (norm v2 * norm v2) (norm v1 * norm v1) (norm v3 * norm v3) (dist (v0,v2) * dist (v0,v2)) (dist (v0,v1) * dist (v0,v1)) (dist (v0,v3) * dist (v0,v3)) (dist (v1,v2) * dist (v1,v2)) (dist (v2,v3) * dist (v2,v3)) (&0)` ; + TYPIFY ` cayleyR (norm v0 * norm v0) (norm v2 * norm v2) (norm v1 * norm v1) (norm v3 * norm v3) (dist (v0,v2) * dist (v0,v2)) (dist (v0,v1) * dist (v0,v1)) (dist (v0,v3) * dist (v0,v3)) (dist (v1,v2) * dist (v1,v2)) (dist (v2,v3) * dist (v2,v3)) = (\x. a * x pow 2 + b * x + c)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[FUN_EQ_THM]; + ONCE_REWRITE_TAC[Collect_geom.LTCTBAN]; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[Nonlinear_lemma.abc_quadratic]; + TYPIFY `b pow 2 - &4 * a * c = &16 * delta_y (norm v0) (norm v2) (norm v1) (dist (v2,v1)) (dist (v0,v1)) (dist (v0,v2)) * delta_y (norm v0) (norm v2) (norm v3) (dist (v2,v3)) (dist (v0,v3)) (dist (v0,v2))` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "a"; + EXPAND_TAC "b"; + EXPAND_TAC "c"; + REWRITE_TAC[Collect_geom.DISCRIMINANT_OF_CAY]; + REWRITE_TAC[Merge_ineq.delta_delta_x;GSYM Sphere.delta_y]; + BY(MESON_TAC[DIST_SYM]); + TYPIFY `&0 <= delta_y (norm v0) (norm v2) (norm v1) (dist (v2,v1)) (dist (v0,v1)) (dist (v0,v2))` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[REWRITE_RULE[LET_DEF;LET_END_DEF] Tame_lemmas.delta_y_pos]); + TYPIFY `&0 <= delta_y (norm v0) (norm v2) (norm v3) (dist (v2,v3)) (dist (v0,v3)) (dist (v0,v2))` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[REWRITE_RULE[LET_DEF;LET_END_DEF] Tame_lemmas.delta_y_pos]); + TYPIFY `&0 <= b pow 2 - &4 * a * c` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LE_MUL; + CONJ_TAC; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LE_MUL; + BY(ASM_REWRITE_TAC[]); + TYPED_ABBREV_TAC `(x:real) = dist(v1,v3) pow 2` ; + TYPIFY `a * x pow 2 + b * x + c = &0` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `cayleyR` MP_TAC; + REWRITE_TAC[FUN_EQ_THM]; + DISCH_THEN (C INTRO_TAC [`x`]); + DISCH_THEN (SUBST1_TAC o GSYM); + FIRST_X_ASSUM kill; + BY(ASM_REWRITE_TAC[arith ` x * x = x pow 2`]); + ASM_CASES_TAC `b pow 2 - &4 * a * c = &0`; + MATCH_MP_TAC Tame_lemmas.quadratic_root_plus_disc0_eq; + FIRST_X_ASSUM_ST `&0 < a` MP_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); + BY(REAL_ARITH_TAC); + COMMENT "pos discr. case"; + MATCH_MP_TAC Tame_lemmas.quadratic_root_plus_gt_eq; + TYPED_ABBREV_TAC `(n:real^3) = v0 cross v2`; + TYPED_ABBREV_TAC `(v1':real^3) = reflection n v1` ; + TYPED_ABBREV_TAC `(y:real) = dist(v1',v3) pow 2` ; + TYPIFY `y` EXISTS_TAC; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + CONJ_TAC; + FIRST_X_ASSUM_ST `&0 <= x` MP_TAC; + BY(REWRITE_TAC[]); + FIRST_X_ASSUM_ST `a * x pow 2` MP_TAC; + DISCH_THEN (SUBST1_TAC); + REWRITE_TAC[]; + COMMENT "cayleyR again"; + INTRO_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] Collect_geom2.CAYLEYR_5POINTS) [`(vec 0):real^3`;`v0`;`v2`;`v1'`;`v3`]; + ASM_REWRITE_TAC[]; + EXPAND_TAC "v1'"; + TYPIFY `!v. dist(v,reflection n v1) =dist(reflection n v1,v)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(MESON_TAC[DIST_SYM]); + REPEAT (GMATCH_SIMP_TAC Tame_lemmas.dist_reflection_special); + EXPAND_TAC "n"; + REWRITE_TAC[DOT_LZERO]; + REWRITE_TAC[Collect_geom2.ORTHOGONAL_CROSS_PRODUCT]; + REWRITE_TAC[DIST_0]; + TYPIFY `dist(v1,v0) = dist(v0,v1)` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[DIST_SYM]); + ASM_REWRITE_TAC[arith `x pow 2 = x * x`]; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[]; + COMMENT "y < x"; + EXPAND_TAC "x"; + EXPAND_TAC "y"; + EXPAND_TAC "v1'"; + REWRITE_TAC[Tame_lemmas.dist_reflection_lemma]; + MATCH_MP_TAC (arith `&0 < ( --r )/ nn ==> d + &4 * r / nn < d`); + GMATCH_SIMP_TAC REAL_LT_DIV; + TYPIFY `~(n = vec 0)` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "n"; + FIRST_X_ASSUM_ST `&0 < a` MP_TAC; + EXPAND_TAC "a"; + REWRITE_TAC[GSYM DIST_0;arith `x * x = x pow 2`]; + REWRITE_TAC[GSYM Collect_geom2.NORM_CROSS_PRODUCT_UPS_X]; + REWRITE_TAC[arith `&0 < &4 * x <=> &0 < x`;arith `(v0:real^3) - vec 0 = v0`]; + REWRITE_TAC[GSYM NORM_POS_LT]; + REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; + BY(MESON_TAC[NORM_POS_LE;arith `&0 <= x /\ ~(x = &0) ==> &0 < x`]); + CONJ2_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[DOT_POS_LT]); + REWRITE_TAC[arith `&0 < -- r <=> r < &0`]; + EXPAND_TAC "n"; + TYPIFY `!v. v dot (v0 cross v2) = chi_msb [vec 0;v0;v2] v` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + REWRITE_TAC[Leaf_cell.chi_msb;Basics.EL_EXPLICIT]; + REWRITE_TAC[arith `(v:real^3) - vec 0 = v`]; + BY(MESON_TAC[DOT_SYM]); + FIRST_X_ASSUM_ST `chi_msb` MP_TAC; + TYPIFY `~(chi_msb [vec 0;v0;v2] v1 * chi_msb [vec 0;v0;v2] v3 = &0)` ENOUGH_TO_SHOW_TAC; + BY(REAL_ARITH_TAC); + REWRITE_TAC[REAL_ENTIRE;DE_MORGAN_THM]; + REWRITE_TAC[GSYM Leaf_cell.CHI_MSB_COPLANAR]; + REWRITE_TAC[Oxlzlez.coplanar_delta_y;DIST_0]; + REWRITE_TAC[arith `&0 < x <=> (&0 <= x /\ ~(x = &0))`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[GSYM DE_MORGAN_THM;GSYM REAL_ENTIRE]; + DISCH_TAC; + REPEAT (FIRST_X_ASSUM_ST `b pow 2 - &4 * a *c` MP_TAC); + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let IN_V_IMP_AZIM_LESS_PI_ALT = prove_by_refinement( + `!V E FF v. (convex_local_fan (V,E,FF) /\ v IN V + ==> (!w. w IN V ==> azim (vec 0) v (rho_node1 FF v) w <= pi))`, + (* {{{ proof *) + [ + BY(MESON_TAC[Local_lemmas.IN_V_IMP_AZIM_LESS_PI]) + ]);; + (* }}} *) + +let vv_enclosed4 = prove_by_refinement( + `!vv i. + (let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + let f = IMAGE (\i. vv i,vv (SUC i)) (:num) in + let y1 = norm (vv (i+1)) in + let y2 = norm (vv (i+2)) in + let y3 = norm (vv (i)) in + let y4 = dist(vv (i), vv (i+2)) in + let y5 = dist(vv (i), vv (i+1)) in + let y6 = dist(vv (i+1), vv (i+2)) in + let y7 = norm (vv (i+3)) in + let y8 = dist(vv (i),vv (i+3)) in + let y9 = dist(vv (i+2),vv (i+3)) in + (periodic vv 4 /\ + dist (vv i,vv ( i+1)) < &4 /\ + dist (vv i,vv (i + 3)) < &4 /\ + (!i j. ~(vv i = vv j) ==> &2 <= dist (vv i,vv j)) /\ + V SUBSET ball_annulus /\ + dist (vv i,vv (i+2)) < &4 /\ + convex_local_fan (V,E,f) /\ + (!i j. i < 4 /\ j < 4 /\ vv i = vv j ==> i = j) + ==> dist (vv (i+1), vv(i+3)) = enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_THM]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] enclosed4_lemma); + TYPIFY `!i. vv i IN ball_annulus` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `ball_annulus` MP_TAC; + BY(SET_TAC[IN_UNIV]); + TYPIFY `!i. vv i IN IMAGE vv (:num)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + SUBCONJ_TAC; + REWRITE_TAC[GSYM DIST_0]; + REWRITE_TAC[GSYM Collect_geom2.NOT_COL_EQ_UPS_X_POS;arith `x * x = x pow 2`]; + MATCH_MP_TAC NONPARALLEL_BALL_ANNULUS40_ALT; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + GMATCH_SIMP_TAC periodic_vv_inj; + TYPIFY `4` EXISTS_TAC; + ASM_REWRITE_TAC[arith `~(4 = 0)`]; + BY(ASM_MESON_TAC[ Oxlzlez.MOD_INJ1_ALT;arith `~(4 = 0) /\ ~(2 = 0) /\ (2 < 4)`]); + DISCH_TAC; + COMMENT "case delta=0"; + TYPIFY `chi_msb [vec 0; vv i; vv (i + 2)] (vv (i + 1)) = &0` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[arith `&0 * x <= &0`]); + TYPIFY `chi_msb [vec 0; vv i; vv (i + 2)] (vv (i + 3)) = &0` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[arith ` x * &0 <= &0`]); + TYPIFY `~coplanar {vec 0, vv i, vv (i + 2), vv (i + 1)} /\ ~coplanar {vec 0, vv i, vv (i + 2), vv (i + 3)}` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_REWRITE_TAC[ Leaf_cell.CHI_MSB_COPLANAR]); + TYPIFY `~collinear {vec 0, vv i, vv (i+1)} /\ ~collinear {vec 0,vv i, vv (i+3)} /\ ~collinear {vec 0,vv i, vv(i+2)}` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Planarity.notcoplanar_imp_notcollinear_fan]); + COMMENT "angle 0"; + INTRO_TAC IN_V_IMP_AZIM_LESS_PI_ALT [ `IMAGE vv (:num)`;`IMAGE (\i. {vv i, vv (SUC i)}) (:num)`;`IMAGE (\i. vv i,vv (SUC i)) (:num)`;`vv i`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (C INTRO_TAC [`vv (i +3)`]); + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] vv_rho_node1); + CONJ_TAC; + TYPIFY `4` EXISTS_TAC; + BY(ASM_REWRITE_TAC[arith `3 <= 4`]); + DISCH_TAC; + COMMENT "v2 in wedge"; + TYPIFY `vv (i +2) IN wedge_ge (vec 0) (vv i) (vv ( i+1)) (vv (i + 3))` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[Local_lemmas.WEDGE_GE_AZIM_LE]; + REWRITE_TAC[arith `i + 1 = SUC i /\ i + 3 = i + 4 -1`]; + INTRO_TAC (REWRITE_RULE[LET_THM] vv_azim_le) [`vv`;`4`;`i`;`i + 2`]; + ANTS_TAC; + ASM_REWRITE_TAC[arith `3 <= 4`]; + REWRITE_TAC[arith `SUC i = i + 1 /\ i + 4 -1 = i + 3`]; + ASM_REWRITE_TAC[]; + BY(MESON_TAC[ Oxlzlez.MOD_INJ1_ALT;arith `~(4 = 0) /\ ~(2 = 0) /\ (2 < 4)`]); + BY(REWRITE_TAC[]); + COMMENT " < pi "; + TYPIFY `azim (vec 0) (vv i) (vv (SUC i)) (vv (i + 3)) < pi` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `wedge_ge` MP_TAC; + GMATCH_SIMP_TAC Local_lemmas.WEDGE_GE_EQ_AFF_GE; + ASM_REWRITE_TAC[arith `i + 1 = SUC i`]; + GMATCH_SIMP_TAC Marchal_cells_2_new.AFF_GE_2_2; + CONJ_TAC; + TYPIFY `DISJOINT {vec 0, vv i} {vv (SUC i)} /\ DISJOINT {vec 0, vv i} {vv (i + 3)}` ENOUGH_TO_SHOW_TAC; + REWRITE_TAC[DISJOINT]; + BY(SET_TAC[]); + BY(ASM_MESON_TAC[Fan.th3a;arith `SUC i = i + 1`]); + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[Leaf_cell.chi_msb_swap_23]; + GMATCH_SIMP_TAC Leaf_cell.chi_msb_additive_d; + TYPIFY `t3 % vv (SUC i) + t4 % vv (i + 3) = t4 % vv (i + 3) + t3 % vv (SUC i)` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + GMATCH_SIMP_TAC Leaf_cell.chi_msb_additive_d; + CONJ_TAC; + BY(FIRST_X_ASSUM_ST `&1` MP_TAC THEN REAL_ARITH_TAC); + CONJ_TAC; + BY(FIRST_X_ASSUM_ST `&1` MP_TAC THEN REAL_ARITH_TAC); + TYPIFY `chi_msb [vec 0; vv i; vv (SUC i)] (vv (i + 3)) = -- chi_msb [vec 0; vv i; vv (i + 3)] (vv (SUC i))` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[Leaf_cell.chi_msb_swap_23]); + REWRITE_TAC[arith `-- (t4 * -- c) * -- (t3 * c) <= &0 <=> &0 <= t4 * t3 * c pow 2`]; + GMATCH_SIMP_TAC REAL_LE_MUL; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LE_MUL; + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[ REAL_LE_POW_2]); + COMMENT "azim = pi"; + TYPIFY `azim (vec 0) (vv i) (vv (SUC i)) (vv (i + 3)) = pi` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `azim` MP_TAC) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM MP_TAC; + GMATCH_SIMP_TAC Ldurdpn.LDURDPN; + ASM_REWRITE_TAC[arith `SUC i = i + 1`]; + REWRITE_TAC[EXTENSION;NOT_IN_EMPTY;NOT_FORALL_THM]; + REWRITE_TAC[IN_INTER;Geomdetail.CONV0_SET2;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Leaf_cell.AFFINE_IMP_CHI_MSB_0 [`[vec 0;vv i; vv (i+2)]`;`x`]; + REWRITE_TAC[LENGTH;arith `SUC(SUC(SUC 0)) = 3`]; + REWRITE_TAC[Bump.set_of_list3_explicit]; + ANTS_TAC; + TYPIFY `aff {vec 0, vv i} SUBSET affine hull {vec 0, vv i, vv (i + 2)}` ENOUGH_TO_SHOW_TAC; + BY(FIRST_X_ASSUM_ST `aff` MP_TAC THEN SET_TAC[]); + MATCH_MP_TAC Collect_geom.AFFINE_CONTAIN_LINE; + REWRITE_TAC[AFFINE_AFFINE_HULL]; + MATCH_MP_TAC SUBSET_TRANS; + TYPIFY `{vec 0, vv i, vv (i + 2)}` EXISTS_TAC; + CONJ_TAC; + BY(SET_TAC[]); + BY(REWRITE_TAC[HULL_SUBSET]); + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Leaf_cell.CHI_MSB_ADDITIVE; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `!c c'. ((c':real) = (-- a/b) * c) ==> c * c' <= &0` (C SUBGOAL_THEN MATCH_MP_TAC); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[ (arith `c * -- a /b * c <= &0 <=> &0 <= (a / b) * c pow 2`) ]; + GMATCH_SIMP_TAC REAL_LE_MUL; + GMATCH_SIMP_TAC REAL_LE_RDIV_EQ; + ASM_REWRITE_TAC[]; + REWRITE_TAC[ REAL_LE_POW_2]; + BY(REPEAT (FIRST_X_ASSUM_ST `&0 < x` MP_TAC) THEN REAL_ARITH_TAC); + MATCH_MP_TAC REAL_EQ_LCANCEL_IMP; + TYPIFY `b` EXISTS_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[arith `a + b = &0 <=> b = --a`]; + DISCH_THEN SUBST1_TAC; + CONJ_TAC; + BY(FIRST_X_ASSUM_ST `&0 < b` MP_TAC THEN REAL_ARITH_TAC); + Calc_derivative.CALC_ID_TAC; + BY(FIRST_X_ASSUM_ST `&0 < b` MP_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let enclosed_sym = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6 y7 y8 y0. enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 = + enclosed y1 y6 y5 y4 y3 y2 y7 y9 y8`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Enclosed.enclosed]; + REPLICATE_TAC 3 AP_TERM_TAC; + REWRITE_TAC[muR_ALT]; + REWRITE_TAC[FUN_EQ_THM]; + GEN_TAC; + REWRITE_TAC[Collect_geom2.cayleyR]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let enclosed_sym2 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6 y7 y8 y0. enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 = + enclosed y7 y8 y9 y4 y2 y3 y1 y5 y6`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Enclosed.enclosed]; + REPLICATE_TAC 3 AP_TERM_TAC; + REWRITE_TAC[muR_ALT]; + REWRITE_TAC[FUN_EQ_THM]; + GEN_TAC; + REWRITE_TAC[Collect_geom2.cayleyR]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let convex_local_fan_azim_le_pi = prove_by_refinement( + `!vv k i. (let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + let f = IMAGE (\i. vv i,vv (SUC i)) (:num) in + (periodic vv k /\ + 3 <= k /\ (!i j. i < k /\ j < k /\ vv i = vv j ==> i = j) /\ + convex_local_fan (V,E,f) /\ + V SUBSET ball_annulus + ==> + (azim (vec 0) (vv i) (vv (SUC i)) (vv (i + k - 1)) <= pi)))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_THM]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Localization.convex_local_fan [`IMAGE (\i. vv i,vv (SUC i)) (:num)`;`IMAGE vv (:num)`;`IMAGE (\i. {vv i, vv (SUC i)}) (:num)`;]; + ASM_REWRITE_TAC[IN_IMAGE;IN_UNIV]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [ `vv i, vv (SUC i)`]); + ANTS_TAC; + BY(MESON_TAC[]); + GMATCH_SIMP_TAC Local_lemmas.LOFA_DETERMINE_AZIM_IN_FA; + CONJ_TAC; + GEXISTL_TAC [`IMAGE vv (:num)`;`IMAGE (\i. vv i,vv (SUC i)) (:num)`]; + ASM_REWRITE_TAC[]; + BY(MESON_TAC[IN_IMAGE;IN_UNIV]); + GMATCH_SIMP_TAC EE_vv; + TYPIFY `k` EXISTS_TAC; + CONJ_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[Local_lemmas.AZIM_CYCLE_TWO_POINT_SET]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let vv_quad_split012 = prove_by_refinement( + `!vv. + (let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + let f = IMAGE (\i. vv i,vv (SUC i)) (:num) in + (periodic vv 4 /\ + V SUBSET ball_annulus /\ + dist(vv 0, vv 1) < &4 /\ + dist(vv 0, vv 2) < &4 /\ + dist(vv 0, vv 3) < &4 /\ + dist(vv 1,vv 2) < &4 /\ + dist(vv 2,vv 3) < &4 /\ + (!i j. ~(vv i = vv j) ==> &2 <= dist(vv i,vv j) ) /\ + convex_local_fan (V,E,f) /\ + (!i j. i < 4 /\ j < 4 /\ vv i = vv j ==> (i = j)) + ==> (rho_fun (norm (vv 0)) * azim (vec 0) (vv 0) (vv 1) (vv 3) + + rho_fun (norm (vv 1)) * azim (vec 0) (vv 1) (vv 2) (vv 0) + + rho_fun (norm (vv 2)) * azim (vec 0) (vv 2) (vv 3) (vv 1) + + rho_fun (norm (vv 3)) * azim (vec 0) (vv 3) (vv 0) (vv 2)) - + (pi + sol0) * &2 = + tau3 (vv 0) (vv 1) (vv 2) + tau3 (vv 2) (vv 3) (vv 0)))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY ` azim (vec 0) (vv 0) (vv (SUC 0)) (vv (0 + 4 - 1)) <= pi /\ azim (vec 0) (vv 1) (vv (SUC 1)) (vv (1 + 4 - 1)) <= pi /\ azim (vec 0) (vv 2) (vv (SUC 2)) (vv (2 + 4 - 1)) <= pi /\ azim (vec 0) (vv 3) (vv (SUC 3)) (vv (3 + 4 -1)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT CONJ_TAC THEN MATCH_MP_TAC (REWRITE_RULE[LET_THM] convex_local_fan_azim_le_pi) THEN ASM_REWRITE_TAC[arith `3 <= 4`]); + REWRITE_TAC[Appendix.tau3]; + TYPIFY `vv 6 = vv 2 /\ vv 5 = vv 1 /\ vv 4 = vv 0` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (CONJ_TAC) THEN GMATCH_SIMP_TAC periodic_vv_inj THEN TYPIFY `4` EXISTS_TAC THEN ASM_REWRITE_TAC[MOD_4_EXPLICIT;arith `~(4 = 0)`]); + TYPIFY `azim (vec 0) ((vv 0)) ((vv (SUC 0))) ((vv (0 + 4 - 1))) = azim (vec 0) ((vv 0)) ((vv (SUC 0))) ((vv 2)) + azim(vec 0) ((vv 0)) ((vv 2)) ((vv (0 + 4 - 1))) /\ (azim (vec 0) ((vv 2)) ((vv (SUC 2))) ((vv (2 + 4 - 1))) = azim (vec 0) ((vv 2)) ((vv (SUC 2))) ((vv 0)) + azim(vec 0) ((vv 2)) ((vv 0)) ((vv (2 + 4 -1))))` (C SUBGOAL_THEN ASSUME_TAC); + CONJ_TAC THEN MATCH_MP_TAC (REWRITE_RULE[LET_THM] vv_split_azim) THEN ASM_REWRITE_TAC[arith `3 <= 4 /\ ~( 0 = 2)`;MOD_4_EXPLICIT;arith `SUC 0 = 1 /\ 0 + 4 - 1 = 3`;arith `SUC 2 = 3 /\ 2 + 4 - 1 = 5`]; + BY(ASM_MESON_TAC[DIST_SYM]); + RULE_ASSUM_TAC (REWRITE_RULE[arith `SUC 0 = 1 /\ SUC 1 = 2 /\ SUC 2 = 3 /\ SUC 3 = 4 /\ 0+4-1 = 3 /\ 1+4-1=4 /\ 2+4-1=5 /\ 3+4-1=6`]); + FIRST_X_ASSUM_ST `6` (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + ASM_REWRITE_TAC[]; + TYPIFY `azim (vec 0) (vv 0) (vv 1) (vv 2) <= pi /\ azim (vec 0) (vv 0) (vv 2) (vv 3) <= pi /\ azim (vec 0) (vv 2 ) (vv 3) (vv 0) <= pi /\ azim (vec 0) (vv 2) (vv 0) (vv 1) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Counting_spheres.AZIM_NN;arith `&0 <= x /\ &0 <= y /\ x + y <= pi ==> (x <= pi /\ y <= pi)`]); + COMMENT "azim to dih"; + TYPIFY `~collinear {vec 0,vv 0,vv 1} /\ ~collinear {vec 0,vv 0, vv 2} /\ ~collinear {vec 0,vv 0,vv 3} /\ ~collinear {vec 0,vv 1,vv 2} /\ ~collinear {vec 0,vv 2, vv 3}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT (GMATCH_SIMP_TAC NONPARALLEL_BALL_ANNULUS40_ALT); + RULE_ASSUM_TAC (REWRITE_RULE[IMAGE_SUBSET_IN;IN_UNIV]); + ASM_REWRITE_TAC[]; + BY(REPEAT CONJ_TAC THEN (FIRST_X_ASSUM_ST `dist` MATCH_MP_TAC) THEN GMATCH_SIMP_TAC periodic_vv_inj THEN (TYPIFY `4` EXISTS_TAC) THEN ASM_REWRITE_TAC[arith `~(4 = 0)`;MOD_4_EXPLICIT;arith `~(2 = 3) /\ ~(1 = 2) /\ ~(0=3) /\ ~(0=1) /\ ~(0=2)`]); + COMMENT "azim to dih"; + TYPIFY `azim (vec 0) (vv 0) (vv 1) (vv 2) = dihV (vec 0) (vv 0) (vv 1) (vv 2) /\ azim (vec 0) (vv 0) (vv 2) (vv 3) = dihV (vec 0) (vv 0) (vv 2) (vv 3) /\ azim (vec 0) (vv 1) (vv 2) (vv 0) = dihV (vec 0) (vv 1) (vv 2) (vv 0) /\ azim (vec 0) (vv 2) (vv 3) (vv 0) = dihV (vec 0) (vv 2) (vv 3) (vv 0) /\ azim (vec 0) (vv 2) (vv 0) (vv 1) = dihV (vec 0) (vv 2) (vv 0) (vv 1) /\ azim (vec 0) (vv 3) (vv 0) (vv 2) = dihV (vec 0) (vv 3) (vv 0) (vv 2)` ENOUGH_TO_SHOW_TAC; + DISCH_THEN (unlist REWRITE_TAC); + REWRITE_TAC[Appendix.rho_rho_fun]; + BY(REAL_ARITH_TAC); + BY(REPEAT CONJ_TAC THEN MATCH_MP_TAC (REWRITE_RULE[TAUT `(a ==> b ==> c) <=> (a /\ b ==> c)`] Local_lemmas.AZIM_LE_PI_EQ_DIHV) THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE `{a,b,c}={a,c,b}`] THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let vv_quad_split123 = prove_by_refinement( + `!vv. + (let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + let f = IMAGE (\i. vv i,vv (SUC i)) (:num) in + (periodic vv 4 /\ + V SUBSET ball_annulus /\ + dist(vv 0, vv 1) < &4 /\ + dist(vv 0, vv 3) < &4 /\ + dist(vv 1,vv 2) < &4 /\ + dist(vv 1,vv 3) < &4 /\ + dist(vv 2,vv 3) < &4 /\ + (!i j. ~(vv i = vv j) ==> &2 <= dist(vv i,vv j) ) /\ + convex_local_fan (V,E,f) /\ + (!i j. i < 4 /\ j < 4 /\ vv i = vv j ==> (i = j)) + ==> (rho_fun (norm (vv 0)) * azim (vec 0) (vv 0) (vv 1) (vv 3) + + rho_fun (norm (vv 1)) * azim (vec 0) (vv 1) (vv 2) (vv 0) + + rho_fun (norm (vv 2)) * azim (vec 0) (vv 2) (vv 3) (vv 1) + + rho_fun (norm (vv 3)) * azim (vec 0) (vv 3) (vv 0) (vv 2)) - + (pi + sol0) * &2 = + tau3 (vv 1) (vv 2) (vv 3) + tau3 (vv 3) (vv 0) (vv 1)))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY ` azim (vec 0) (vv 0) (vv (SUC 0)) (vv (0 + 4 - 1)) <= pi /\ azim (vec 0) (vv 1) (vv (SUC 1)) (vv (1 + 4 - 1)) <= pi /\ azim (vec 0) (vv 2) (vv (SUC 2)) (vv (2 + 4 - 1)) <= pi /\ azim (vec 0) (vv 3) (vv (SUC 3)) (vv (3 + 4 -1)) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT CONJ_TAC THEN MATCH_MP_TAC (REWRITE_RULE[LET_THM] convex_local_fan_azim_le_pi) THEN ASM_REWRITE_TAC[arith `3 <= 4`]); + REWRITE_TAC[Appendix.tau3]; + TYPIFY `vv 6 = vv 2 /\ vv 5 = vv 1 /\ vv 4 = vv 0` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (CONJ_TAC) THEN GMATCH_SIMP_TAC periodic_vv_inj THEN TYPIFY `4` EXISTS_TAC THEN ASM_REWRITE_TAC[MOD_4_EXPLICIT;arith `~(4 = 0)`]); + TYPIFY `azim (vec 0) ((vv 1)) ((vv (SUC 1))) ((vv (1 + 4 - 1))) = azim (vec 0) ((vv 1)) ((vv (SUC 1))) ((vv 3)) + azim(vec 0) ((vv 1)) ((vv 3)) ((vv (1 + 4 - 1))) /\ (azim (vec 0) ((vv 3)) ((vv (SUC 3))) ((vv (3 + 4 - 1))) = azim (vec 0) ((vv 3)) ((vv (SUC 3))) ((vv 1)) + azim(vec 0) ((vv 3)) ((vv 1)) ((vv (3 + 4 -1))))` (C SUBGOAL_THEN ASSUME_TAC); + CONJ_TAC THEN MATCH_MP_TAC (REWRITE_RULE[LET_THM] vv_split_azim) THEN ASM_REWRITE_TAC[arith `3 <= 4 /\ ~( 1 = 3)`;MOD_4_EXPLICIT;arith `SUC 1 = 2 /\ 1 + 4 - 1 = 4`;arith `SUC 3 = 4 /\ 3 + 4 - 1 = 6`]; + BY(ASM_MESON_TAC[DIST_SYM]); + BY(ASM_MESON_TAC[DIST_SYM]); + RULE_ASSUM_TAC (REWRITE_RULE[arith `SUC 0 = 1 /\ SUC 1 = 2 /\ SUC 2 = 3 /\ SUC 3 = 4 /\ 0+4-1 = 3 /\ 1+4-1=4 /\ 2+4-1=5 /\ 3+4-1=6`]); + FIRST_X_ASSUM_ST `vv 6 = vv 2` (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + ASM_REWRITE_TAC[]; + TYPIFY `azim (vec 0) (vv 1) (vv 2) (vv 3) <= pi /\ azim (vec 0) (vv 1) (vv 3) (vv 0) <= pi /\ azim (vec 0) (vv 3 ) (vv 0) (vv 1) <= pi /\ azim (vec 0) (vv 3) (vv 1) (vv 2) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Counting_spheres.AZIM_NN;arith `&0 <= x /\ &0 <= y /\ x + y <= pi ==> (x <= pi /\ y <= pi)`]); + COMMENT "collinearity"; + TYPIFY `~collinear {vec 0,vv 0,vv 1} /\ ~collinear {vec 0,vv 0, vv 3} /\ ~collinear {vec 0,vv 1,vv 3} /\ ~collinear {vec 0,vv 1,vv 2} /\ ~collinear {vec 0,vv 2, vv 3}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT (GMATCH_SIMP_TAC NONPARALLEL_BALL_ANNULUS40_ALT); + RULE_ASSUM_TAC (REWRITE_RULE[IMAGE_SUBSET_IN;IN_UNIV]); + ASM_REWRITE_TAC[]; + BY(REPEAT CONJ_TAC THEN (FIRST_X_ASSUM_ST `dist` MATCH_MP_TAC) THEN GMATCH_SIMP_TAC periodic_vv_inj THEN (TYPIFY `4` EXISTS_TAC) THEN ASM_REWRITE_TAC[arith `~(4 = 0)`;MOD_4_EXPLICIT;arith `~(2 = 3) /\ ~(1 = 2) /\ ~(0=3) /\ ~(0=1) /\ ~(1=3)`]); + COMMENT "azim to dih"; + TYPIFY `azim (vec 0) (vv 0) (vv 1) (vv 3) = dihV (vec 0) (vv 0) (vv 1) (vv 3) /\ azim (vec 0) (vv 1) (vv 2) (vv 3) = dihV (vec 0) (vv 1) (vv 2) (vv 3) /\ azim (vec 0) (vv 1) (vv 3) (vv 0) = dihV (vec 0) (vv 1) (vv 3) (vv 0) /\ azim (vec 0) (vv 2) (vv 3) (vv 1) = dihV (vec 0) (vv 2) (vv 3) (vv 1) /\ azim (vec 0) (vv 3) (vv 0) (vv 1) = dihV (vec 0) (vv 3) (vv 0) (vv 1) /\ azim (vec 0) (vv 3) (vv 1) (vv 2) = dihV (vec 0) (vv 3) (vv 1) (vv 2)` ENOUGH_TO_SHOW_TAC; + DISCH_THEN (unlist REWRITE_TAC); + REWRITE_TAC[Appendix.rho_rho_fun]; + BY(REAL_ARITH_TAC); + BY(REPEAT CONJ_TAC THEN MATCH_MP_TAC (REWRITE_RULE[TAUT `(a ==> b ==> c) <=> (a /\ b ==> c)`] Local_lemmas.AZIM_LE_PI_EQ_DIHV) THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE `{a,b,c}={a,c,b}`] THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let vv_quad_split_short = prove_by_refinement( + `!vv. (let V = IMAGE vv (:num) in + let E = IMAGE (\i. {vv i, vv (SUC i)}) (:num) in + let f = IMAGE (\i. vv i,vv (SUC i)) (:num) in + (periodic vv 4 /\ + V SUBSET ball_annulus /\ + dist (vv 0,vv 1) < &4 /\ + dist (vv 0,vv 3) < &4 /\ + dist (vv 0,vv 2) < &4 /\ + dist (vv 1,vv 2) < &4 /\ + dist (vv 1,vv 3) < &4 /\ + dist (vv 2,vv 3) < &4 /\ + (!i j. ~(vv i = vv j) ==> &2 <= dist (vv i,vv j)) /\ + convex_local_fan (V,E,f) /\ + (!i j. i < 4 /\ j < 4 /\ vv i = vv j ==> i = j) + ==> (?i. i < 2 /\ (dist(vv i,vv (i+2)) <= dist(vv (i+1),vv(i+3))) /\ + (rho_fun (norm (vv 0)) * azim (vec 0) (vv 0) (vv 1) (vv 3) + + rho_fun (norm (vv 1)) * azim (vec 0) (vv 1) (vv 2) (vv 0) + + rho_fun (norm (vv 2)) * azim (vec 0) (vv 2) (vv 3) (vv 1) + + rho_fun (norm (vv 3)) * azim (vec 0) (vv 3) (vv 0) (vv 2)) - + (pi + sol0) * &2 = + tau3 (vv i) (vv (i+1)) (vv (i+2)) + tau3 (vv (i+2)) (vv (i+3)) (vv i))))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `dist(vv 0,vv 2) <= dist(vv 1,vv 3)` ASM_CASES_TAC; + TYPIFY `0` EXISTS_TAC; + ASM_REWRITE_TAC[arith `0+x = x /\ 0 < 2`]; + MATCH_MP_TAC (REWRITE_RULE[LET_THM] vv_quad_split012); + BY(ASM_REWRITE_TAC[]); + TYPIFY `1` EXISTS_TAC; + REWRITE_TAC[arith `1+2 = 3 /\ 1+1 = 2 /\ 1 + 3 = 4 /\ 1 < 2`]; + TYPIFY `vv 4 = vv 0` (C SUBGOAL_THEN SUBST1_TAC); + BY( GMATCH_SIMP_TAC periodic_vv_inj THEN TYPIFY `4` EXISTS_TAC THEN ASM_REWRITE_TAC[MOD_4_EXPLICIT;arith `~(4 = 0)`]); + CONJ_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[DIST_SYM;arith `~(x <= y) ==> y <= x`]); + MATCH_MP_TAC (REWRITE_RULE[LET_THM] vv_quad_split123); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let SUC_EXPLICIT = prove_by_refinement( + `SUC 0 = 1 /\ SUC 1 = 2 /\ SUC 2 = 3 /\ SUC 3 = 4 /\ SUC 4 = 5 /\ SUC 5 = 6 /\ SUC 6 = 7 /\ SUC 7 = 8 /\ SUC 8 = 9`, + (* {{{ proof *) + [ + ARITH_TAC + ]);; + (* }}} *) + +let cs_adj4_EXPLICIT = prove_by_refinement( + `!a b. + cs_adj 4 a b 0 0 = &0 /\ + cs_adj 4 a b 0 1 = a /\ + cs_adj 4 a b 0 2 = b /\ + cs_adj 4 a b 0 3 = a /\ + cs_adj 4 a b 1 0 = a /\ + cs_adj 4 a b 1 1 = &0 /\ + cs_adj 4 a b 1 2 = a /\ + cs_adj 4 a b 1 3 = b /\ + cs_adj 4 a b 2 0 = b /\ + cs_adj 4 a b 2 1 = a /\ + cs_adj 4 a b 2 2 = &0 /\ + cs_adj 4 a b 2 3 = a /\ + cs_adj 4 a b 3 0 = a /\ + cs_adj 4 a b 3 1 = b /\ + cs_adj 4 a b 3 2 = a /\ + cs_adj 4 a b 3 3 = &0 +`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.cs_adj;MOD_4_EXPLICIT;SUC_EXPLICIT]; + BY(ARITH_TAC) + ]);; + (* }}} *) + +let delta_4680581274 = prove_by_refinement( + `!y1 y4. cstab <= y1 /\ &4 <= y4 ==> + delta_y y1 (&2) (&2) y4 (&2) cstab < &0`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_y;Sphere.delta_x;arith `&2 * &2 = &4`]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `y = y1 * y1` ; + TYPED_ABBREV_TAC `z = y4 * y4` ; + TYPED_ABBREV_TAC `c = cstab * cstab` ; + TYPIFY `y * z * (--y + &4 + &4 - z + &4 + c) + &4 * &4 * (y - &4 + &4 + z - &4 + c) + &4 * c * (y + &4 - &4 + z + &4 - c) - &4 * &4 * z - y * &4 * &4 - y * &4 * c - z * &4 * c = (-- &64 + &32 * c - &4 * c pow 2) - y * z * (-- &12 - c + y + z)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REAL_ARITH_TAC); + REWRITE_TAC[arith `x - y < &0 <=> x < y`]; + MATCH_MP_TAC REAL_LT_TRANS; + TYPIFY ` &0` EXISTS_TAC; + CONJ_TAC; + EXPAND_TAC "c"; + REWRITE_TAC[Appendix.cstab]; + BY(REAL_ARITH_TAC); + EXPAND_TAC "y"; + EXPAND_TAC "z"; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL_EQ); + TYPIFY `&0 < y1 /\ &0 < y4` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Appendix.cstab] THEN REAL_ARITH_TAC); + TYPIFY `&9 <= y1 * y1` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[arith `&9 = &3 * &3`]; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Appendix.cstab] THEN REAL_ARITH_TAC); + TYPIFY `&16 <= y4 * y4` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[arith `&16 = &4 * &4`]; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Appendix.cstab] THEN REAL_ARITH_TAC); + EXPAND_TAC "c"; + REWRITE_TAC[Appendix.cstab]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let delta_7697147739 = prove_by_refinement( + `!y1 y4. cstab <= y1 /\ &4 <= y4 ==> + delta_y y1 (&2) (&2) y4 (&2) sqrt8 < &0`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_y;Sphere.delta_x;arith `&2 * &2 = &4`;Nonlinear_lemma.sqrt8_2;arith `#8.0 = &8`]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `y = y1 * y1` ; + TYPED_ABBREV_TAC `z = y4 * y4` ; + TYPIFY `y * z * (--y + &4 + &4 - z + &4 + &8) + &4 * &4 * (y - &4 + &4 + z - &4 + &8) + &4 * &8 * (y + &4 - &4 + z + &4 - &8) - &4 * &4 * z - y * &4 * &4 - y * &4 * &8 - z * &4 * &8 = -- &64 - y * z * (-- &20 + y + z)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REAL_ARITH_TAC); + REWRITE_TAC[arith `x - y < &0 <=> x < y`]; + MATCH_MP_TAC REAL_LT_TRANS; + TYPIFY ` &0` EXISTS_TAC; + CONJ_TAC; + BY(REAL_ARITH_TAC); + EXPAND_TAC "y"; + EXPAND_TAC "z"; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL_EQ); + TYPIFY `&0 < y1 /\ &0 < y4` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Appendix.cstab] THEN REAL_ARITH_TAC); + TYPIFY `&9 <= y1 * y1` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[arith `&9 = &3 * &3`]; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Appendix.cstab] THEN REAL_ARITH_TAC); + TYPIFY `&16 <= y4 * y4` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[arith `&16 = &4 * &4`]; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Appendix.cstab] THEN REAL_ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let tau3_sym = prove_by_refinement( + `!v0 v1 v2. tau3 v0 v1 v2 = tau3 v0 v2 v1 /\ tau3 v0 v1 v2 = tau3 v1 v0 v2`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.tau3]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[DIHV_SYM]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let INSERT_SUBSET = prove_by_refinement( + `!(a:A) A S. a INSERT A SUBSET S <=> (a IN S) /\ A SUBSET S`, + (* {{{ proof *) + [ + BY(SET_TAC[]) + ]);; + (* }}} *) + +(* INEQUALITY MATERIAL STARTS HERE *) + +let OWZLKVY0 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (!y1 y2 y3 y4 y5 y6. + &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y1 /\ y2 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + cstab <= y4 /\ y4 <= #3.915 /\ + y5 = &2 /\ + y6 = &2 /\ &200 <= delta_y y1 y2 y3 y4 y5 y6 ==> + &0 <= taum y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.cstab]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "6762190381") []; + DISCH_THEN (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]); + REWRITE_TAC[Sphere.ineq]; + REPEAT (FIRST_X_ASSUM MP_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* was EAR_ANGLE_ACUTE *) + +let EAR_DELTA_X4 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6. &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + cstab <= y4 /\ y4 <= #3.915 /\ + y5 = &2 /\ + y6 = &2 /\ + delta_y y1 y2 y3 y4 y5 y6 <= &200 ==> + (delta_x4 (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6) < + &0 /\ + &0 < delta_x4 (y2 * y2) (y3 * y3) (y1 * y1) (y5 * y5) (y6 * y6) (y4 * y4) + /\ + &0 < delta_x4 (y3 * y3) (y1 * y1) (y2 * y2) (y6 * y6) (y4 * y4) (y5 * y5) + ) )`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "8346775862") []; + DISCH_THEN (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]); + REWRITE_TAC[Sphere.ineq;Sphere.delta_y;Sphere.y_of_x]; + REWRITE_TAC[TAUT `a ==> b ==> c <=> a /\ b ==> c`]; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Appendix.cstab] THEN REAL_ARITH_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.delta_y] THEN REAL_ARITH_TAC); + CONJ_TAC; + TYPIFY `delta_x4 (y2 * y2) (y3 * y3) (y1 * y1) (y5 * y5) (y6 * y6) (y4 * y4) = delta_x4 (y2 * y2) (y1 * y1) (y3 * y3) (y5 * y5) (y4 * y4) (y6 * y6)` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[Sphere.delta_x4]; + BY(REAL_ARITH_TAC); + INTRO_TAC ((* Appendix. *) get_main_nonlinear "8631418063") []; + DISCH_THEN (C INTRO_TAC [`y2`;`y1`;`y3`;`y5`;`y4`;`y6`]); + REWRITE_TAC[Sphere.ineq;Sphere.delta_y;Sphere.y_of_x]; + REWRITE_TAC[arith `x > &0 <=> &0 < x`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Appendix.cstab] THEN REAL_ARITH_TAC); + INTRO_TAC ((* Appendix. *) get_main_nonlinear "8631418063") []; + DISCH_THEN (C INTRO_TAC [`y3`;`y1`;`y2`;`y6`;`y4`;`y5`]); + REWRITE_TAC[Sphere.ineq;Sphere.delta_y;Sphere.y_of_x]; + REWRITE_TAC[arith `x > &0 <=> &0 < x`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Appendix.cstab] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let EAR_DIH1_DELTA_0 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6. &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + cstab <= y4 /\ y4 <= #3.915 /\ + y5 = &2 /\ + y6 = &2 /\ + delta_y y1 y2 y3 y4 y5 y6 = &0 ==> + dih_y y1 y2 y3 y4 y5 y6 = pi)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (UNDISCH EAR_DELTA_X4) [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Appendix.cstab] THEN REAL_ARITH_TAC); + DISCH_TAC; + FIRST_X_ASSUM_ST `delta_y` MP_TAC; + REWRITE_TAC[Sphere.dih_y;Sphere.dih_x;LET_DEF;LET_END_DEF;Sphere.delta_y]; + DISCH_THEN (unlist REWRITE_TAC); + REWRITE_TAC[arith `x * &0 = &0`;SQRT_0]; + TYPED_ABBREV_TAC `d = delta_x4 (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6)`; + INTRO_TAC Merge_ineq.atn2_0 [`-- d`]; + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let OWZLKVY3 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> ( !y1 y2 y3 y4 y5 y6. + &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + cstab <= y4 /\ y4 <= #3.915 /\ + y5 = &2 /\ + y6 = &2 /\ + &0 <= delta_y y1 y2 y3 y4 y5 y6 /\ + dih_y y1 y2 y3 y4 y5 y6 = pi ==> + sol0 * (y1 - &2 * h0) / (&2 * h0 - &2) <= taum y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_CASES_TAC `&200 <= delta_y y1 y2 y3 y4 y5 y6`; + INTRO_TAC OWZLKVY0 []; + ASM_REWRITE_TAC[]; + DISCH_THEN (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `&0 <= s * (-- u) /v ==> (&0 <= t ==> s * u / v <= t)`); + GMATCH_SIMP_TAC REAL_LE_MUL; + CONJ_TAC; + INTRO_TAC Flyspeck_constants.bounds []; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LE_RDIV_EQ; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + RULE_ASSUM_TAC (REWRITE_RULE[arith `~(x <= y) <=> y < x`]); + REWRITE_TAC[Nonlinear_lemma.taum_123;Sphere.rhazim2;Sphere.rhazim3;Sphere.node2_y;Sphere.node3_y]; + REWRITE_TAC[Sphere.rhazim]; + TYPIFY `delta_y y1 y2 y3 y4 y5 y6 = &0` (C SUBGOAL_THEN ASSUME_TAC); + PROOF_BY_CONTR_TAC; + INTRO_TAC Oxlzlez.DIH_X_LT_PI [`y1 * y1`;`y2*y2`;`y3*y3`;`y4*y4`;`y5*y5`;`y6*y6`]; + ANTS_TAC; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.delta_y]; + MP_TAC (arith `&2 <= y1 ==> &0 < y1`); + BY(REAL_ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF] THEN REAL_ARITH_TAC); + COMMENT "..."; + INTRO_TAC (UNDISCH EAR_DELTA_X4) [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `dih_y y2 y3 y1 y5 y6 y4 = &0` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[Sphere.dih_y;Sphere.dih_x;LET_DEF;LET_END_DEF]; + REPEAT (FIRST_X_ASSUM_ST `x = &2` kill); + RULE_ASSUM_TAC (REWRITE_RULE[Sphere.delta_y]); + TYPIFY `delta_x (y2 * y2) (y3 * y3) (y1 * y1) (y5 * y5) (y6 * y6) (y4 * y4) = &0` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM_ST `x = &0` MP_TAC; + BY(MESON_TAC[Merge_ineq.delta_x_sym]); + REWRITE_TAC[arith `x * &0 = &0`;SQRT_0]; + TYPED_ABBREV_TAC `d = delta_x4 (y2 * y2) (y3 * y3) (y1 * y1) (y5 * y5) (y6 * y6) (y4 * y4)`; + INTRO_TAC Merge_ineq.atn2_0 [`-- d`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT ".."; + TYPIFY `dih_y y3 y1 y2 y6 y4 y5 = &0` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[Sphere.dih_y;Sphere.dih_x;LET_DEF;LET_END_DEF]; + REPEAT (FIRST_X_ASSUM_ST `x = &2` kill); + RULE_ASSUM_TAC (REWRITE_RULE[Sphere.delta_y]); + TYPIFY `delta_x (y3 * y3) (y1 * y1) (y2 * y2) (y6 * y6) (y4 * y4) (y5 * y5) = &0` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM_ST `x = &0` MP_TAC; + BY(MESON_TAC[Merge_ineq.delta_x_sym]); + REWRITE_TAC[arith `x * &0 = &0`;SQRT_0]; + TYPED_ABBREV_TAC `d = delta_x4 (y3 * y3) (y1 * y1) (y2 * y2) (y6 * y6) (y4 * y4) (y5 * y5)`; + INTRO_TAC Merge_ineq.atn2_0 [`-- d`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT "A"; + TYPIFY `dih_y y1 y2 y3 y4 y5 y6 = pi` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[Sphere.dih_y;Sphere.dih_x;LET_DEF;LET_END_DEF]; + REPEAT (FIRST_X_ASSUM_ST `x = &2` kill); + RULE_ASSUM_TAC (REWRITE_RULE[Sphere.delta_y]); + TYPIFY `delta_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6) = &0` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM_ST `x = &0` MP_TAC; + BY(MESON_TAC[Merge_ineq.delta_x_sym]); + REWRITE_TAC[arith `x * &0 = &0`;SQRT_0]; + TYPED_ABBREV_TAC `d = delta_x4 (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6)`; + INTRO_TAC Merge_ineq.atn2_0 [`-- d`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `x * &0 = &0 /\ x + &0 = x`]; + REWRITE_TAC[Nonlinear_lemma.rho_alt;Nonlinear_lemma.sol0_const1]; + MATCH_MP_TAC (arith `x = y ==> x <= y`); + Calc_derivative.CALC_ID_TAC; + REWRITE_TAC[Sphere.h0]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let OWZLKVY1 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> ( !y1 y2 y3 y4 y5 y6. + &2 <= y1 /\ y1 <= &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + cstab <= y4 /\ y4 <= #3.915 /\ + y5 = &2 /\ + y6 = &2 /\ + &0 <= delta_y y1 y2 y3 y4 y5 y6 ==> + -- sol0 <= taum y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_CASES_TAC `&200 <= delta_y y1 y2 y3 y4 y5 y6`; + INTRO_TAC OWZLKVY0 []; + ASM_REWRITE_TAC[]; + DISCH_THEN (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `&0 <= s ==> (&0 <= t ==> -- s <= t)`); + INTRO_TAC Flyspeck_constants.bounds []; + BY(REAL_ARITH_TAC); + COMMENT "delta=0"; + ASM_CASES_TAC `delta_y y1 y2 y3 y4 y5 y6 = &0`; + INTRO_TAC (UNDISCH EAR_DIH1_DELTA_0) [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + DISCH_TAC; + MATCH_MP_TAC REAL_LE_TRANS; + EXISTS_TAC `sol0 * (y1 - &2 * h0) / (&2 * h0 - &2)`; + CONJ_TAC; + MATCH_MP_TAC (arith `&0 <= s * (&1 + y /z) ==> --s <= s * y /z`); + GMATCH_SIMP_TAC REAL_LE_MUL; + CONJ_TAC; + INTRO_TAC Flyspeck_constants.bounds []; + BY(REAL_ARITH_TAC); + TYPIFY `&1 + (y1 - &2 * h0) / (&2 * h0 - &2) = (y1 - &2) / (&2 * h0 - &2)` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LE_RDIV_EQ; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + MATCH_MP_TAC (UNDISCH OWZLKVY3); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT "replace taum with solid angle"; + TYPIFY `&0 < delta_y y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN MP_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + DISCH_TAC; + REWRITE_TAC[Nonlinear_lemma.taum_123;Sphere.rhazim2;Sphere.rhazim3;Sphere.node2_y;Sphere.node3_y]; + REWRITE_TAC[arith `-- sol0 <= r1 + r2 + r3 - (&1 + c)*pi <=> (-- sol0 + c * pi) + pi <= (r1 + r2 + r3)`]; + MATCH_MP_TAC REAL_LE_TRANS; + EXISTS_TAC `dih_y y1 y2 y3 y4 y5 y6 + dih_y y2 y3 y1 y5 y6 y4 + dih_y y3 y1 y2 y6 y4 y5`; + CONJ2_TAC; + MATCH_MP_TAC (arith `d1 <= r1 /\ d2 <= r2 /\ d3x <= r3 ==> d1 + d2 + d3x <= r1 + r2 + r3`); + REPEAT (GMATCH_SIMP_TAC DIH_Y_LT_RHAZIM); + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[Merge_ineq.delta_y_sym]); + REWRITE_TAC[Nonlinear_lemma.sol0_const1;arith `(-- (pi * c) + c * pi) + pi = pi`]; + RULE_ASSUM_TAC(REWRITE_RULE[arith `~(x <= d) <=> (d < x)`]); + ENOUGH_TO_SHOW_TAC `&0 < sol_y y1 y2 y3 y4 y5 y6`; + REWRITE_TAC[Sphere.sol_y]; + BY(REAL_ARITH_TAC); + REWRITE_TAC[Merge_ineq.sol_y_sol_x]; + MATCH_MP_TAC sol_x_nn; + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL_EQ); + REWRITE_TAC[Trigonometry1.UPS_X_SQUARES]; + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL_EQ); + TYPIFY `&0 < eulerA_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + INTRO_TAC ((* Appendix. *) get_main_nonlinear "4821120729") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + REWRITE_TAC[Sphere.ineq;Sphere.y_of_x;arith `x > &0 <=> &0 < x`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Appendix.cstab] THEN REAL_ARITH_TAC); + TYPIFY `&0 < delta_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + FIRST_X_ASSUM MP_TAC; + BY(REWRITE_TAC[Sphere.delta_y]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN (REWRITE_TAC[Appendix.cstab;Sphere.h0]) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let OWZLKVY2 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> ( !y1 y2 y3 y4 y5 y6. + y1 = &2 * h0 /\ + &2 <= y2 /\ y2 <= &2 * h0 /\ + &2 <= y3 /\ y3 <= &2 * h0 /\ + cstab <= y4 /\ y4 <= #3.915 /\ + y5 = &2 /\ + y6 = &2 /\ + &0 <= delta_y y1 y2 y3 y4 y5 y6 ==> + &0 <= taum y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_CASES_TAC `&200 <= delta_y y1 y2 y3 y4 y5 y6`; + INTRO_TAC OWZLKVY0 []; + ASM_REWRITE_TAC[]; + DISCH_THEN (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]); + ASM_REWRITE_TAC[]; + DISCH_THEN MATCH_MP_TAC; + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + TYPIFY `&0 <= delta_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `&0 <= d` MP_TAC; + BY(REWRITE_TAC[Sphere.delta_y] THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC taum_taum_x; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Appendix.cstab] THEN REAL_ARITH_TAC); + REWRITE_TAC[Sphere.y_of_x]; + GMATCH_SIMP_TAC Merge_ineq.tau_x_tau_residual_x; + COMMENT "residue hypotheses"; + CONJ_TAC; + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL_EQ); + INTRO_TAC (UNDISCH EAR_DELTA_X4) [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + DISCH_THEN (unlist REWRITE_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.delta_y;Sphere.h0;Appendix.cstab] THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LE_MUL; + CONJ_TAC; + GMATCH_SIMP_TAC SQRT_POS_LE; + BY(FIRST_X_ASSUM (unlist REWRITE_TAC)); + INTRO_TAC ((* Appendix. *) get_main_nonlinear "5202826650 a") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + REWRITE_TAC[Sphere.ineq;Sphere.y_of_x]; + REWRITE_TAC[TAUT `a ==> b ==> c <=> (a /\ b ==> c)`]; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Appendix.cstab;Sphere.h0] THEN REAL_ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* was sqrt2_bounds *) + +let sqrt8_bounds = prove_by_refinement( + `sqrt8 <= #3.01 /\ &2 <= sqrt8 /\ sqrt8 <= #3.62`, + (* {{{ proof *) + [ + INTRO_TAC Flyspeck_constants.bounds []; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* renamed from terminal_std_tri_OMKYNLT_3336871894_empty *) + +(* +let empty_3T2 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = mk_unadorned_v39 3 (&0) (funlist_v39 [] (&2) 3) (funlist_v39 [] (&2) 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;arith `&2 <= &2 /\ &2 <= #3.01 /\ &2 <= #3.62`]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "OMKYNLT 3336871894") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + REWRITE_TAC[Sphere.ineq;arith `x >= #0.0 <=> &0 <= x`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) +*) + +let empty_3T2 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = scs_3T2 in (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_3T2]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;arith `&2 <= &2 /\ &2 <= #3.01 /\ &2 <= #3.62`]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ( get_main_nonlinear "OMKYNLT 3336871894") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + REWRITE_TAC[Sphere.ineq;arith `x >= #0.0 <=> &0 <= x`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + + +(* renamed from terminal_std_tri_4010906068_empty *) +let empty_3T3 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = mk_unadorned_v39 3 + (#0.476) + (funlist_v39 [] (&2*h0) 3) + (funlist_v39 [] (cstab) 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "4010906068") [`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]; + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`]; + TYPIFY `taum y1 y3 y2 y4 y6 y5 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let empty_3T3 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = scs_3T3 in (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_3T3]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "4010906068") [`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]; + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`]; + TYPIFY `taum y1 y3 y2 y4 y6 y5 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* renamed from terminal_std_tri_6833979866_empty *) +let empty_3T4 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = scs_3T4 in + //mk_unadorned_v39 + //3 + //(#0.2759) + //(funlist_v39 [(0,1),(&2)] (&2*h0) 3) + //(funlist_v39 [(0,1),(&2 * h0)] (cstab) 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_3T4]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "6833979866") [`y3`;`y1`;`y2`;`y6`;`y4`;`y5`]; + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`]; + TYPIFY `taum y3 y1 y2 y6 y4 y5 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* renamed from terminal_std_tri_5541487347_empty *) +let empty_3T5 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = scs_3T5 in + //mk_unadorned_v39 + //3 + //(#0.103) + //(funlist_v39 [(0,1),(&2 * h0)] (&2) 3) + //(funlist_v39 [(0,1),(sqrt8)] (&2 * h0) 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_3T5]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "5541487347") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* +let terminal_std_tri_4528012043_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = mk_unadorned_v39 3 (tame_table_d 0 3 + #3.0 * (tame_table_d 2 1 - #0.11)) + (funlist_v39 [] cstab 3) + (funlist_v39 [] cstab 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;arith `x <= x /\ &2 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62`]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "4528012043") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_std_tri_7459553847_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = mk_unadorned_v39 3 + (tame_table_d 0 3 + #3.0 * (tame_table_d 2 1 - #0.11)) + (funlist_v39 [(0,1),&2 * h0] cstab 3) + (funlist_v39 [(0,1),&2 * h0] cstab 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62`]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "7459553847") [`y3`;`y2`;`y1`;`y6`;`y5`;`y4`]; + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`]; + TYPIFY `taum y3 y2 y1 y6 y5 y4 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_std_tri_4143829594_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = mk_unadorned_v39 3 + (tame_table_d 0 3 + #3.0 * (tame_table_d 2 1 - #0.11)) + (funlist_v39 [(0,1),cstab] (&2 * h0) 3) + (funlist_v39 [(0,1),cstab] (&2 * h0) 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62`]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "4143829594") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_std_tri_1080462150_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = mk_unadorned_v39 3 + (tame_table_d 0 3 + #3.0 * (tame_table_d 2 1 - #0.11)) + (funlist_v39 [] (&2 * h0) 3) + (funlist_v39 [] (&2 * h0) 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62`]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "1080462150") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_std_tri_9816718044_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = mk_unadorned_v39 3 + (tame_table_d 1 2 + #2.0 * (tame_table_d 2 1 - #0.11)) + (funlist_v39 [(0,1),&2] cstab 3) + (funlist_v39 [(0,1),&2] cstab 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62`]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "9816718044") [`y3`;`y2`;`y1`;`y6`;`y5`;`y4`]; + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`]; + TYPIFY `taum y3 y2 y1 y6 y5 y4 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_std_tri_3106201101_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = mk_unadorned_v39 3 + (tame_table_d 1 2 + #2.0 * (tame_table_d 2 1 - #0.11)) + (funlist_v39 [(0,1),&2; (0,2),cstab] sqrt8 3) + (funlist_v39 [(0,1),&2; (0,2),cstab] sqrt8 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "3106201101") [`y3`;`y1`;`y2`;`y6`;`y4`;`y5`]; + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`]; + TYPIFY `taum y3 y1 y2 y6 y4 y5 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_std_tri_2200527225_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = mk_unadorned_v39 3 + (tame_table_d 1 2 + #2.0 * (tame_table_d 2 1 - #0.11)) + (funlist_v39 [(0,1),&2] sqrt8 3) + (funlist_v39 [(0,1),&2] sqrt8 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "2200527225") [`y3`;`y1`;`y2`;`y6`;`y4`;`y5`]; + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`]; + TYPIFY `taum y3 y1 y2 y6 y4 y5 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_std_tri_2900061606_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = mk_unadorned_v39 3 (tame_table_d 1 2 + tame_table_d 2 1 - #0.11) + (funlist_v39 [(0,1),&2 * h0; (0,2),cstab] (&2) 3) + (funlist_v39 [(0,1),&2 * h0; (0,2),cstab] (&2) 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62`]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "2900061606") [`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]; + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`]; + TYPIFY `taum y1 y3 y2 y4 y6 y5 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_std_tri_7097350062a_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = mk_unadorned_v39 3 (tame_table_d 1 2) + (funlist_v39 [(0,1),&2 * h0; (0,2),sqrt8] (&2) 3) + (funlist_v39 [(0,1),&2 * h0; (0,2),sqrt8] (&2) 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "7097350062a") [`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]; + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`]; + TYPIFY `taum y1 y3 y2 y4 y6 y5 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_std_tri_OMKYNLT_1_2_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = mk_unadorned_v39 3 (tame_table_d 1 2) (funlist_v39 [(0,1),&2] (&2 * h0) 3) + (funlist_v39 [(0,1),&2] (&2 * h0) 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "OMKYNLT 1 2") [`y3`;`y2`;`y1`;`y6`;`y5`;`y4`]; + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`]; + TYPIFY `taum y3 y2 y1 y6 y5 y4 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_std_tri_7645170609_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = mk_unadorned_v39 3 (tame_table_d 2 1) (funlist_v39 [(0,1),sqrt8] (&2) 3) + (funlist_v39 [(0,1),sqrt8] (&2) 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "7645170609") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_std_tri_OMKYNLT_2_1_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = mk_unadorned_v39 3 (tame_table_d 2 1) (funlist_v39 [(0,1),&2 * h0] (&2) 3) + (funlist_v39 [(0,1),&2 * h0] (&2) 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "OMKYNLT 2 1") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) +*) + +let terminal_std_tri_7881254908_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = mk_unadorned_v39 3 ( #0.696 - #2.0 * #0.11) + (funlist_v39 [(0,1),sqrt8; (1,2),sqrt8] (&2 * h0) 3) + (funlist_v39 [(0,1),cstab; (1,2),cstab] (&2 * h0) 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "7881254908") [`y2`;`y1`;`y3`;`y5`;`y4`;`y6`]; + TYPIFY `taum y2 y1 y3 y5 y4 y6 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* renamed from terminal_std_tri_5026777310a_empty *) +let empty_3T6 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = scs_3T6' in + //mk_unadorned_v39 3 ( #0.6548 - #2.0 * #0.11) + //(funlist_v39 [(0,1),sqrt8; (1,2),sqrt8] (&2) 3) + //(funlist_v39 [(0,1),cstab; (1,2),cstab] (&2 * h0) 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_3T6]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "5026777310a") [`y3`;`y1`;`y2`;`y6`;`y4`;`y5`]; + TYPIFY `taum y3 y1 y2 y6 y4 y5 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`;Sphere.tame_table_d]; + REWRITE_TAC[arith `4 + 2 * 1 > 3`]; + TYPIFY `delta_y y3 y1 y2 y6 y4 y5 = delta_y y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* deprecated 2013-06-17 +let terminal_std_tri_7720405539_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = mk_unadorned_v39 3 ( #0.5518 / #2.0 - #0.2) + (funlist_v39 [(0,1),cstab; (0,2),&2 * h0; (1,2),&2] (&2) 3) + (funlist_v39 [(0,1), #3.41; (0,2),&2 * h0; (1,2),&2] (&2) 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62 /\ #3.41 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "7720405539") [`y3`;`y2`;`y1`;`y6`;`y5`;`y4`]; + TYPIFY `taum y3 y2 y1 y6 y5 y4 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`;Sphere.tame_table_d]; + REWRITE_TAC[arith `2 + 2 * 2 > 3`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_std_tri_2739661360_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = mk_unadorned_v39 3 ( #0.5518 / #2.0 + #0.2) + (funlist_v39 [(0,1),cstab; (0,2),cstab; (1,2),&2] (&2) 3) + (funlist_v39 [(0,1), #3.41; (0,2),cstab; (1,2),&2] (&2) 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62 /\ #3.41 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "2739661360") [`y3`;`y2`;`y1`;`y6`;`y5`;`y4`]; + TYPIFY `taum y3 y2 y1 y6 y5 y4 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`;Sphere.tame_table_d]; + REWRITE_TAC[arith `2 + 2 * 2 > 3`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_std_tri_4922521904_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = mk_unadorned_v39 3 ( #0.5518 / #2.0) + (funlist_v39 [(0,1),cstab; (0,2),&2 * h0; (1,2),&2] (&2) 3) + (funlist_v39 [(0,1), #3.339; (0,2),&2 * h0; (1,2),&2] (&2) 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62 /\ #3.41 <= #3.62 /\ #3.339 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "4922521904") [`y3`;`y2`;`y1`;`y6`;`y5`;`y4`]; + TYPIFY `taum y3 y2 y1 y6 y5 y4 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`;Sphere.tame_table_d]; + REWRITE_TAC[arith `2 + 2 * 2 > 3`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) +*) + +(* renamed from terminal_std_tri_2468307358_empty *) +let empty_3T7 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = scs_3T7 in +// mk_unadorned_v39 3 ( #0.2565) +// (funlist_v39 [(0,1),cstab; (0,2),cstab; (1,2),&2] (&2) 3) +// (funlist_v39 [(0,1), #3.62; (0,2),cstab; (1,2),&2] (&2) 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_3T7]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62 /\ #3.41 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "2468307358") [`y3`;`y2`;`y1`;`y6`;`y5`;`y4`]; + (* INTRO_TAC ((* Appendix. *) get_main_nonlinear "2739661360") [`y3`;`y2`;`y1`;`y6`;`y5`;`y4`]; edited 2013-06-17. *) + TYPIFY `taum y3 y2 y1 y6 y5 y4 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`;Sphere.tame_table_d]; + REWRITE_TAC[arith `2 + 2 * 2 > 3`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_std_tri_ear_stab_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = + mk_unadorned_v39 3 #0.11 (funlist_v39 [(0,2),cstab] (&2) 3) + (funlist_v39 [(0,2),cstab] (&2 * h0) 3) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC taustar_taum; + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62 /\ #3.41 <= #3.62 /\ #3.339 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "3603097872") [`y2`;`y1`;`y3`;`y5`;`y4`;`y6`]; + TYPIFY `taum y2 y1 y3 y5 y4 y6 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + TYPIFY `delta_y y2 y1 y3 y5 y4 y6 = delta_y y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`;Sphere.tame_table_d]; + MP_TAC sqrt8_bounds; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + + +(* +let terminal_std_ear_3603097872_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = scs_v39 + (3, + #0.11, + funlist_v39 [(0,1),sqrt8] (&2) 3, + funlist_v39 [(0,1),sqrt8] (&2) 3, + funlist_v39 [(0,1),cstab] (&2 * h0) 3, + funlist_v39 [(0,1),cstab] (&2 * h0) 3, + funlistA_v39 [(0,1),T] F F 3, + {},{}, + {}) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + DISCH_TAC; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + MATCH_MP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] taustar_taum_dfun); + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[is_ear_3603097872]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62 /\ #3.41 <= #3.62 /\ #3.339 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "3603097872") [`y3`;`y2`;`y1`;`y6`;`y5`;`y4`]; + TYPIFY `taum y3 y2 y1 y6 y5 y4 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + TYPIFY `delta_y y3 y2 y1 y6 y5 y4 = delta_y y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`;Sphere.tame_table_d]; + MP_TAC sqrt8_bounds; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + + +let terminal_std_ear_jnull_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = scs_v39 + (3, + #0.11, + funlist_v39 [(0,1),sqrt8] (&2) 3, + funlist_v39 [(0,1),sqrt8] (&2) 3, + funlist_v39 [(0,1),cstab] (&2 * h0) 3, + funlist_v39 [(0,1),cstab] (&2 * h0) 3, + (\i j. F), + {},{}, + {}) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + DISCH_TAC; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + MATCH_MP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] taustar_taum_dfun); + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.is_ear_v39;Appendix.scs_v39_explicit;EMPTY_GSPEC;NOT_INSERT_EMPTY]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62 /\ #3.41 <= #3.62 /\ #3.339 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "3603097872") [`y3`;`y2`;`y1`;`y6`;`y5`;`y4`]; + TYPIFY `taum y3 y2 y1 y6 y5 y4 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + TYPIFY `delta_y y3 y2 y1 y6 y5 y4 = delta_y y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`;Sphere.tame_table_d]; + MP_TAC sqrt8_bounds; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +*) + +let empty_3T1 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = scs_3T1 in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_3T1;Appendix.mk_unadorned_v39]; + DISCH_TAC; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + MATCH_MP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] taustar_taum_dfun); + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.is_ear_v39;Appendix.scs_v39_explicit;EMPTY_GSPEC;NOT_INSERT_EMPTY]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62 /\ #3.41 <= #3.62 /\ #3.339 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "3603097872") [`y3`;`y2`;`y1`;`y6`;`y5`;`y4`]; + TYPIFY `taum y3 y2 y1 y6 y5 y4 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + TYPIFY `delta_y y3 y2 y1 y6 y5 y4 = delta_y y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`;Sphere.tame_table_d]; + MP_TAC sqrt8_bounds; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_tri_5405130650_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = scs_v39 (3, + #0.477 - #0.11, + funlist_v39 [(0,1),sqrt8; (0,2),&2 * h0; (1,2),&2] (&2) 3, + funlist_v39 [(0,1),sqrt8; (0,2),&2 * h0; (1,2),&2] (&2) 3, + funlist_v39 [(0,1),cstab; (0,2),sqrt8; (1,2),&2 * h0] (&2 * h0) 3, + funlist_v39 [(0,1),cstab; (0,2),sqrt8; (1,2),&2 * h0] (&2 * h0) 3, + funlistA_v39 [(0,1),T] F F 3, + {},{}, + {}) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + DISCH_TAC; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + MATCH_MP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] taustar_taum_dfun); + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.is_ear_v39;Appendix.scs_v39_explicit;arith `~(#0.477 - #0.11 = #0.11)`]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62 /\ #3.41 <= #3.62 /\ #3.339 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "5405130650") [`y3`;`y2`;`y1`;`y6`;`y5`;`y4`]; + TYPIFY `taum y3 y2 y1 y6 y5 y4 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + TYPIFY `delta_y y3 y2 y1 y6 y5 y4 = delta_y y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`;Sphere.tame_table_d]; + MP_TAC sqrt8_bounds; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* +let terminal_tri_5766053833_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = scs_v39 (3, + #0.696 - #2.0 * #0.11, + funlist_v39 [(0,1),sqrt8; (1,2),sqrt8] (&2) 3, + funlist_v39 [(0,1),sqrt8; (1,2),sqrt8] (&2) 3, + funlist_v39 [(0,1),cstab; (1,2),cstab] (&2) 3, + funlist_v39 [(0,1),cstab; (1,2),cstab] (&2) 3, + funlistA_v39 [(0,1),T; (1,2),T] F F 3, + {},{}, + {}) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + DISCH_TAC; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + MATCH_MP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] taustar_taum_dfun); + REWRITE_TAC[FUNLIST_EXPLICIT]; + REWRITE_TAC[Appendix.is_ear_v39;Appendix.scs_v39_explicit;arith `~(#0.696 - #2.0* #0.11 = #0.11)`]; + REWRITE_TAC[Appendix.cstab;Sphere.h0;arith `x <= x /\ &2 <= #3.01 /\ &2 <= &2 * #1.26 /\ &2 * #1.26 <= #3.01 /\ &2 <= #3.62 /\ #3.01 <= #3.62 /\ &2 * #1.26 <= #3.62 /\ #3.41 <= #3.62 /\ #3.339 <= #3.62`]; + REWRITE_TAC[sqrt8_bounds]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "5766053833") [`y2`;`y1`;`y3`;`y5`;`y4`;`y6`]; + TYPIFY `taum y2 y1 y3 y5 y4 y6 = taum y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + TYPIFY `delta_y y2 y1 y3 y5 y4 y6 = delta_y y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[Merge_ineq.delta_y_sym]); + REWRITE_TAC[Sphere.ineq;arith `x >= y <=> y <= x`;arith `x > y <=> y < x`;Sphere.tame_table_d]; + MP_TAC sqrt8_bounds; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) +*) + +(* ************************************************************************** *) +(* START OF QUAD CASES *) +(* ************************************************************************** *) + +(* renamed from terminal__adhoc_quad_5691615370_empty *) +let empty_4T1 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = scs_4T1 in +//mk_unadorned_v39 4 #0.467 (cs_adj 4 (&2) (&3)) (cs_adj 4 (&2) (&6)) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))` , + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_4T1]; + DISCH_TAC; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REWRITE_TAC[Appendix.BBs_v39;Appendix.mk_unadorned_v39;Appendix.cs_adj;Appendix.scs_v39_explicit]; + REWRITE_TAC[LET_DEF;LET_END_DEF;arith `~(4 <= 3)`]; + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM kill); + ASSUME_TAC MOD_4_EXPLICIT; + ASSUME_TAC (arith `SUC 0 = 1 /\ SUC 1 = 2 /\ SUC 2 = 3 /\ SUC 3 = 4`); + FIRST_ASSUM (C INTRO_TAC [`0`;`1`]); + FIRST_ASSUM (C INTRO_TAC [`0`;`2`]); + FIRST_ASSUM (C INTRO_TAC [`0`;`3`]); + FIRST_ASSUM (C INTRO_TAC [`1`;`2`]); + FIRST_ASSUM (C INTRO_TAC [`1`;`3`]); + FIRST_X_ASSUM (C INTRO_TAC [`2`;`3`]); + ASM_REWRITE_TAC[arith `~(1 = 3) /\ ~(2 = 3) /\ ~(1 = 2) /\ ~(0 = 1) /\ ~(0=2) /\ ~(0=3)`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `dist(vv 2,vv 3) = &2 /\ dist(vv 1,vv 2) = &2 /\ dist(vv 0, vv 3) = &2 /\ dist(vv 0,vv 1) = &2` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + INTRO_TAC DELTA_Y_POS_4POINTS [`vv 0 `;`vv 1`;`vv 2`;`vv 3`]; + ASM_REWRITE_TAC[Sphere.delta_y;Sphere.delta_x]; + TYPIFY `&9 <= dist(vv 1, vv 3) * dist(vv 1, vv 3) /\ &9 <= dist(vv 0 , vv 2) * dist(vv 0,vv 2)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[arith `&9 = &3 * &3`]; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPED_ABBREV_TAC `y2 = dist(vv 1,vv 3) * dist(vv 1,vv 3)` ; + TYPED_ABBREV_TAC `z2 = dist(vv 0,vv 2) * dist(vv 0,vv 2)` ; + REWRITE_TAC[arith `&2 * &2 = &4`]; + REWRITE_TAC[arith `&4 * &4 * (-- &4 + z2 + &4 - &4 + y2 + &4) + z2 * y2 * (&4 - z2 + &4 + &4 - y2 + &4) + &4 * &4 * (&4 + z2 - &4 + &4 + y2 - &4) - z2 * &4 * &4 - &4 * &4 * y2 - &4 * z2 * &4 - &4 * y2 * &4 = -- ( y2 *z2 *( y2 + z2 - &16))`]; + REWRITE_TAC[arith `~(&0 <= -- x ) <=> (&0 < x)`]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let ineq_5691615370_asym = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y1 y2 y3 y4 y5 y6. ineq + [ + (#3.0,y1,#3.0); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.0,y4,#3.0); + (&2,y5,#2.52); + (&2,y6,#2.52) + ] + ((delta_y y1 y2 y3 y4 y5 y6 < &0) \/ (y2 + y3 + y5 + y6 > #8.472)))`, + (* {{{ proof *) + [ + DISCH_TAC; + ONCE_REWRITE_TAC[MESON[] `(!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6) <=> (! y2 y3 y5 y6 y1 y4. P y1 y2 y3 y4 y5 y6)`]; + MATCH_MP_TAC REAL_WLOG_SQUARE2_LEMMA; + CONJ_TAC; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `y2' + y5 + y6 + y2 = y2 + y2' + y5 + y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(REAL_ARITH_TAC); + TYPIFY `y2 + y6 + y5 + y2' = y2 + y2' + y5 + y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(REAL_ARITH_TAC); + TYPIFY `delta_y y4 y2' y5 y1 y6 y2 = delta_y y1 y2 y2' y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[Sphere.delta_y;Sphere.delta_x] THEN REAL_ARITH_TAC); + CONJ_TAC; + BY(REWRITE_TAC[Sphere.delta_y;Sphere.delta_x] THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[Sphere.delta_y;Sphere.delta_x] THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "5691615370") [`y1`;`y2`;`y2'`;`y4`;`y5`;`y6`]; + REWRITE_TAC[Sphere.ineq]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let terminal_quad_lemma = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (!d a b . + (let s = mk_unadorned_v39 4 d a b in + (!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> &0 < a i j) /\ + (!vv. IMAGE vv (:num) SUBSET ball_annulus /\ + periodic vv 4 /\ + (!i j. a i j <= dist (vv i,vv j) /\ dist (vv i,vv j) <= b i j) /\ + (convex_local_fan + (IMAGE vv (:num), + IMAGE (\i. {vv i, vv (SUC i)}) (:num), + IMAGE (\i. vv i,vv (SUC i)) (:num))) ==> + (d <= + (rho_fun (norm (vv 0)) * azim (vec 0) (vv 0) (vv 1) (vv 3) + + rho_fun (norm (vv 1)) * azim (vec 0) (vv 1) (vv 2) (vv 4) + + rho_fun (norm (vv 2)) * azim (vec 0) (vv 2) (vv 3) (vv 5) + + rho_fun (norm (vv 3)) * azim (vec 0) (vv 3) (vv 4) (vv 6) + + &0) - + (pi + sol0) * (&4 - &2) + )) ==> + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv)))` , + (* {{{ proof *) + [ + DISCH_TAC; + REWRITE_TAC[LET_THM]; + REWRITE_TAC[Appendix.BBs_v39;Appendix.mk_unadorned_v39;Appendix.scs_v39_explicit;Appendix.taustar_v39]; + REWRITE_TAC[LET_THM;arith `~(4 <= 3)`;dsv_fun4]; + REWRITE_TAC[arith `d - #0.1 * (&0 + &0 + &0 + &0 + &0) = d`]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "expand tau_fun"; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] tau_fun_azim); + TYPIFY `4` EXISTS_TAC; + ASM_SIMP_TAC[arith `3 <= 4`]; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`i`;`j`]); + ASM_REWRITE_TAC[DIST_REFL]; + REWRITE_TAC[DE_MORGAN_THM;arith `~(a <= &0) <=> &0 < a`]; + BY(ASM_MESON_TAC[]); + TYPIFY `{i | i < 4 } = {0,1,2,3}` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; + BY(ARITH_TAC); + REPEAT (GMATCH_SIMP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt); + REWRITE_TAC[SUM_CLAUSES;IN_INSERT;NOT_IN_EMPTY;arith `~(2 = 3) /\ ~(0 = 1) /\ ~(0 = 2) /\ ~(0 = 3) /\ ~(1 = 2) /\ ~(1 = 3) /\ ~(1 = 2) /\ ~(1 = 3)`;FINITE_INSERT;FINITE_EMPTY]; + REWRITE_TAC[arith `0 + 1 = 1 /\ 1 + 1 = 2 /\ 2 + 1 = 3 /\ 3 + 1 = 4 /\ 0 + 4 -1 = 3 /\ 1 + 4 -1 = 4 /\ 2 + 4 - 1 = 5 /\ 3 + 4 - 1 = 6`]; + COMMENT "next"; + REWRITE_TAC[arith `&0 <= r - d <=> d <= r`]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +(* renamed from terminal_adhoc_quad_9563139965B_empty *) +let empty_4T2 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = scs_4T2 in // mk_unadorned_v39 4 #0.467 (cs_adj 4 (&2) (&3)) (cs_adj 4 (&2 * h0) (&3)) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_4T2]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[LET_THM]; + MATCH_MP_TAC (REWRITE_RULE[LET_THM] (UNDISCH terminal_quad_lemma)); + COMMENT "digression"; + TYPIFY `(!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> &2 <= cs_adj 4 (&2) (&3) i j) ` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[arith `i < 4 <=> (i = 0 \/ i = 1 \/ i = 2 \/ i = 3)`]; + REWRITE_TAC[TAUT `(a \/ b) /\ c <=> a /\ c \/ b /\ c`;TAUT `a /\ (b \/ c) <=> (a /\ b) \/ a /\ c`]; + REWRITE_TAC[Appendix.cs_adj]; + REPEAT WEAKER_STRIP_TAC; + BY(REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[arith `SUC 0 = 1 /\ SUC 1 = 2 /\ SUC 2 = 3 /\ SUC 3 = 4`;MOD_4_EXPLICIT;arith `&2 <= &2 /\ &2 <= &3`;arith `~(0=1) /\ ~(0=2) /\ ~(0=3) /\ ~(1 =2) /\ ~(1 = 3) /\ ~(2 = 3)`] THEN ASM_MESON_TAC[]); + COMMENT "digress2"; + TYPIFY `!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> cs_adj 4 (&2 * h0) (&3) i j < &4` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[arith `i < 4 <=> (i = 0 \/ i = 1 \/ i = 2 \/ i = 3)`]; + REWRITE_TAC[TAUT `(a \/ b) /\ c <=> a /\ c \/ b /\ c`;TAUT `a /\ (b \/ c) <=> (a /\ b) \/ a /\ c`]; + REWRITE_TAC[Appendix.cs_adj;Sphere.h0]; + REPEAT WEAKER_STRIP_TAC; + BY(REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[arith `SUC 0 = 1 /\ SUC 1 = 2 /\ SUC 2 = 3 /\ SUC 3 = 4`;MOD_4_EXPLICIT;arith `&2 * #1.26 < &4 /\ &3 < &4`;arith `~(0=1) /\ ~(0=2) /\ ~(0=3) /\ ~(1 =2) /\ ~(1 = 3) /\ ~(2 = 3)`] THEN ASM_MESON_TAC[]); + CONJ_TAC; + BY(ASM_MESON_TAC[arith `&2 <= x ==> &0 < x`]); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `x + &0 = x /\ &4 - &2 = &2`]; + TYPIFY `(!i j. i < 4 /\ j < 4 /\ vv i = vv j ==> i = j)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + BY(ASM_MESON_TAC[DIST_REFL;REAL_LE_TRANS;arith `~(&2 <= &0)`]); + COMMENT "vv"; + TYPIFY `vv 4 = vv 0 /\ vv 5 = vv 1 /\ vv 6 = vv 2` (C SUBGOAL_THEN ASSUME_TAC); + BY((REPEAT CONJ_TAC) THEN GMATCH_SIMP_TAC periodic_vv_inj THEN TYPIFY `4` EXISTS_TAC THEN ASM_REWRITE_TAC[MOD_4_EXPLICIT;arith `~(4 = 0)`]); + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] vv_quad_split012); + ASM_REWRITE_TAC[]; + COMMENT "dist"; + SUBCONJ_TAC; + TYPIFY `(!i j. ~(vv i = vv j) ==> &2 <= dist (vv i,vv j))` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC periodic2_mod_reduce; + TYPIFY `4` EXISTS_TAC; + REWRITE_TAC[Appendix.periodic2;arith `~(4 = 0)`]; + TYPIFY `!i. vv (i + 4) = vv i` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(ASM_MESON_TAC[Oxl_def.periodic;arith `~(4 = 0)`]); + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[REAL_LE_TRANS]); + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[REAL_LET_TRANS;arith `0 < 4 /\ 1 < 4 /\ 2 < 4 /\ 3 < 4 /\ ~(0=1) /\ ~(0=2) /\ ~(0=3) /\ ~(1=2) /\ ~(2 =3)`]); + COMMENT "tau3"; + REPEAT WEAKER_STRIP_TAC; + REPEAT (GMATCH_SIMP_TAC tau3_taum_40); + ASM_REWRITE_TAC[]; + RULE_ASSUM_TAC(REWRITE_RULE[IMAGE_SUBSET_IN;IN_UNIV]); + ASM_REWRITE_TAC[]; + TYPIFY `dist (vv 2,vv 0) < &4 /\ dist (vv 3,vv 0) < &4 ` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + ONCE_REWRITE_TAC[DIST_SYM]; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[TAUT `a /\ b /\ c <=> (a /\ b) /\ c`]; + CONJ_TAC; + BY(ASM_MESON_TAC[REAL_LE_TRANS;arith `1 < 4 /\ 2 < 4 /\ 3 < 4 /\ 0 < 4 /\ ~(2=3) /\ ~(2 =0) /\ ~(3 =0) /\ ~(0 = 1) /\ ~(0=2) /\ ~(1 = 2)`]); + TYPIFY `dist(vv 3,vv 0) = dist(vv 0,vv 3) /\ dist(vv 2, vv 0) = dist(vv 0,vv 2)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(MESON_TAC[DIST_SYM]); + COMMENT "prep dist"; + TYPIFY `(!i j d. d <= cs_adj 4 (&2) (&3) i j ==> d <= dist (vv i,vv j)) /\ (!i j d. cs_adj 4 (&2 * h0) (&3) i j <= d ==> dist (vv i,vv j) <= d)` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[REAL_LE_TRANS]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC cs_adj4_EXPLICIT [`&2`;`&3`]; + INTRO_TAC cs_adj4_EXPLICIT [`&2 * h0`;`&3`]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "fist get"; + INTRO_TAC (UNDISCH ineq_5691615370_asym) [`dist (vv 0,vv 2)`;`dist(vv 0, vv 1)`;`dist(vv 0, vv 3)`;`dist(vv 1,vv 3)`;`dist(vv 2,vv 3)`;`dist(vv 2,vv 1)`]; + TYPIFY `~(delta_y (dist (vv 0,vv 2)) (dist (vv 0,vv 1)) (dist (vv 0,vv 3)) (dist (vv 1,vv 3)) (dist (vv 2,vv 3)) (dist (vv 2,vv 1)) < &0)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + MATCH_MP_TAC (arith `&0 <= d ==> ~(d < &0)`); + BY(REWRITE_TAC[DELTA_Y_POS_4POINTS]); + REWRITE_TAC[]; + TYPIFY `dist(vv 2,vv 1) = dist(vv 1, vv 2)` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[DIST_SYM]); + REWRITE_TAC[Sphere.ineq]; + REWRITE_TAC[TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + ANTS_TAC; + BY(REPEAT CONJ_TAC THEN (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[Sphere.h0] THEN TRY REAL_ARITH_TAC); + DISCH_TAC; + COMMENT "norms"; + RULE_ASSUM_TAC(REWRITE_RULE[Fnjlbxs.in_ball_annulus]); + COMMENT "second get"; + TYPIFY `dist (vv 0,vv 1) <= #2.472 /\ dist(vv 1,vv 2) <= #2.472 /\ dist(vv 2,vv 3) <= #2.472 /\ dist(vv 0,vv 3) <= #2.472` ASM_CASES_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "9563139965 d") [`norm(vv 1)`;`norm (vv 2)`;`norm (vv 0)`;`dist(vv 0,vv 2)`;`dist(vv 0,vv 1)`;`dist(vv 1,vv 2)`]; + REWRITE_TAC[Sphere.ineq]; + REWRITE_TAC[TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(REPEAT CONJ_TAC THEN (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[Sphere.h0] THEN TRY REAL_ARITH_TAC); + DISCH_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "9563139965 d") [`norm(vv 3)`;`norm (vv 2)`;`norm (vv 0)`;`dist(vv 0,vv 2)`;`dist(vv 0,vv 3)`;`dist(vv 2,vv 3)`]; + REWRITE_TAC[Sphere.ineq]; + REWRITE_TAC[TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(REPEAT CONJ_TAC THEN (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[Sphere.h0] THEN TRY REAL_ARITH_TAC); + DISCH_TAC; + TYPIFY `taum (norm (vv 0)) (norm (vv 1)) (norm (vv 2)) (dist (vv 1,vv 2)) (dist (vv 0,vv 2)) (dist (vv 0,vv 1)) = taum (norm (vv 1)) (norm (vv 2)) (norm (vv 0)) (dist (vv 0,vv 2)) (dist (vv 0,vv 1)) (dist (vv 1,vv 2)) /\ taum (norm (vv 2)) (norm (vv 3)) (norm (vv 0)) (dist (vv 0,vv 3)) (dist (vv 0,vv 2)) (dist (vv 2,vv 3)) = taum (norm (vv 3)) (norm (vv 2)) (norm (vv 0)) (dist (vv 0,vv 2)) (dist (vv 0,vv 3)) (dist (vv 2,vv 3))` ENOUGH_TO_SHOW_TAC; + DISCH_THEN (unlist REWRITE_TAC); + BY(REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(MESON_TAC[taum_sym]); + COMMENT "third get"; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "9563139965 f") [`norm(vv 1)`;`norm (vv 2)`;`norm (vv 0)`;`dist(vv 0,vv 2)`;`dist(vv 0,vv 1)`;`dist(vv 1,vv 2)`]; + REWRITE_TAC[Sphere.ineq]; + REWRITE_TAC[TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(REPEAT CONJ_TAC THEN (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[Sphere.h0] THEN TRY REAL_ARITH_TAC); + TYPIFY `taum (norm (vv 1)) (norm (vv 2)) (norm (vv 0)) (dist (vv 0,vv 2)) (dist (vv 0,vv 1)) (dist (vv 1,vv 2)) = taum (norm (vv 0)) (norm (vv 1)) (norm (vv 2)) (dist (vv 1,vv 2)) (dist (vv 0,vv 2)) (dist (vv 0,vv 1))` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + DISCH_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "9563139965 f") [`norm(vv 3)`;`norm (vv 2)`;`norm (vv 0)`;`dist(vv 0,vv 2)`;`dist(vv 0,vv 3)`;`dist(vv 2,vv 3)`]; + REWRITE_TAC[Sphere.ineq]; + REWRITE_TAC[TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(REPEAT CONJ_TAC THEN (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[Sphere.h0] THEN TRY REAL_ARITH_TAC); + TYPIFY `taum (norm (vv 3)) (norm (vv 2)) (norm (vv 0)) (dist (vv 0,vv 2)) (dist (vv 0,vv 3)) (dist (vv 2,vv 3)) = taum (norm (vv 2)) (norm (vv 3)) (norm (vv 0)) (dist (vv 0,vv 3)) (dist (vv 0,vv 2)) (dist (vv 2,vv 3))` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + DISCH_TAC; + FIRST_X_ASSUM_ST `~` MP_TAC; + REWRITE_TAC[DE_MORGAN_THM]; + COMMENT "four cases on top edge"; + DISCH_TAC THEN REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC); + INTRO_TAC ((* Appendix. *) get_main_nonlinear "9563139965 e") [`norm(vv 1)`;`norm (vv 2)`;`norm (vv 0)`;`dist(vv 0,vv 2)`;`dist(vv 0,vv 1)`;`dist(vv 1,vv 2)`]; + REWRITE_TAC[Sphere.ineq]; + REWRITE_TAC[TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `#2.467 <= dist(vv 0,vv 1)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + BY(REPEAT CONJ_TAC THEN (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[Sphere.h0] THEN FIRST_X_ASSUM MP_TAC THEN TRY REAL_ARITH_TAC); + TYPIFY `taum (norm (vv 1)) (norm (vv 2)) (norm (vv 0)) (dist (vv 0,vv 2)) (dist (vv 0,vv 1)) (dist (vv 1,vv 2)) = taum (norm (vv 0)) (norm (vv 1)) (norm (vv 2)) (dist (vv 1,vv 2)) (dist (vv 0,vv 2)) (dist (vv 0,vv 1))` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT "3 left"; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "9563139965 e") [`norm(vv 1)`;`norm (vv 0)`;`norm (vv 2)`;`dist(vv 0,vv 2)`;`dist(vv 1,vv 2)`;`dist(vv 0,vv 1)`]; + REWRITE_TAC[Sphere.ineq]; + REWRITE_TAC[TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `#2.467 <= dist(vv 1,vv 2)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + BY(REPEAT CONJ_TAC THEN (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[Sphere.h0] THEN FIRST_X_ASSUM MP_TAC THEN TRY REAL_ARITH_TAC); + TYPIFY `taum (norm (vv 1)) (norm (vv 0)) (norm (vv 2)) (dist (vv 0,vv 2)) (dist (vv 1,vv 2)) (dist (vv 0,vv 1)) = taum (norm (vv 0)) (norm (vv 1)) (norm (vv 2)) (dist (vv 1,vv 2)) (dist (vv 0,vv 2)) (dist (vv 0,vv 1))` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT "2 left"; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "9563139965 e") [`norm(vv 3)`;`norm (vv 0)`;`norm (vv 2)`;`dist(vv 0,vv 2)`;`dist(vv 2,vv 3)`;`dist(vv 0,vv 3)`]; + REWRITE_TAC[Sphere.ineq]; + REWRITE_TAC[TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `#2.467 <= dist(vv 2,vv 3)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + BY(REPEAT CONJ_TAC THEN (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[Sphere.h0] THEN FIRST_X_ASSUM MP_TAC THEN TRY REAL_ARITH_TAC); + TYPIFY `taum (norm (vv 3)) (norm (vv 0)) (norm (vv 2)) (dist (vv 0,vv 2)) (dist (vv 2,vv 3)) (dist (vv 0,vv 3)) = taum (norm (vv 2)) (norm (vv 3)) (norm (vv 0)) (dist (vv 0,vv 3)) (dist (vv 0,vv 2)) (dist (vv 2,vv 3))` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT "1 left"; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "9563139965 e") [`norm(vv 3)`;`norm (vv 2)`;`norm (vv 0)`;`dist(vv 0,vv 2)`;`dist(vv 0,vv 3)`;`dist(vv 2,vv 3)`]; + REWRITE_TAC[Sphere.ineq]; + REWRITE_TAC[TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `#2.467 <= dist(vv 0,vv 3)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + BY(REPEAT CONJ_TAC THEN (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[Sphere.h0] THEN FIRST_X_ASSUM MP_TAC THEN TRY REAL_ARITH_TAC); + TYPIFY `taum (norm (vv 3)) (norm (vv 2)) (norm (vv 0)) (dist (vv 0,vv 2)) (dist (vv 0,vv 3)) (dist (vv 2,vv 3)) = taum (norm (vv 2)) (norm (vv 3)) (norm (vv 0)) (dist (vv 0,vv 3)) (dist (vv 0,vv 2)) (dist (vv 2,vv 3))` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[taum_sym]); + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let quad_4680581274_derived = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y0 y1 y2 y3 y4 y5 y6 y7 y8 y9. ineq [ + (#3.01,y0,&4); + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,&4); + (#2.0,y5,&2); + (#2.0,y6,&2); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (#3.01,y9,#3.01)] +( + (enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 = y0) /\ + ( y4 <= y0 ) /\ &0 <= delta_y y0 y9 y8 y4 y5 y6 ==> + // #0.616 - #0.11 + #0.513 + < tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 )) +`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.ineq;TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `y4 <= #3.166` (C SUBGOAL_THEN ASSUME_TAC); + PROOF_BY_CONTR_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "4680581274 delta top issue") [`y0`;`y9`;`y8`;`y4`;`y5`;`y6`]; + REWRITE_TAC[Sphere.ineq;TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + INTRO_TAC ((* Appendix. *) get_main_nonlinear "4559601669") [`y1`;`y5`;`y6`;`y4`;`y2`;`y3`]; + REWRITE_TAC[Sphere.ineq;TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + ANTS_TAC; + BY(REPEAT CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN TRY REAL_ARITH_TAC); + TYPIFY `delta4_y y1 y5 y6 y4 y2 y3 = delta4_y y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[Sphere.delta4_y;Sphere.y_of_x;Sphere.delta_x4]; + BY(REAL_ARITH_TAC); + DISCH_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "4680581274 delta issue") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`;`y7`;`y8`;`y9`]; + REWRITE_TAC[Sphere.ineq;TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + ANTS_TAC; + BY(REPEAT CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN TRY REAL_ARITH_TAC); + ASM_SIMP_TAC[arith `d4 < &0 ==> ~(d4 > &0)`;arith `c <= y0 ==> ~(y0 < c)`]; + REWRITE_TAC[arith `x > y <=> y < x`]; + DISCH_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "4680581274 a") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`;`y7`;`y8`;`y9`]; + REWRITE_TAC[Sphere.ineq;TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + ANTS_TAC; + BY(REPEAT CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN TRY REAL_ARITH_TAC); + ASM_SIMP_TAC[arith `d4 < &0 ==> ~(d4 > &0)`;arith `c <= y0 ==> ~(y0 < c)`;arith `c < d ==> ~(d < c)`]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* deprecated 2013-06-17 +let quad_7697147739_derived = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> (!y0 y1 y2 y3 y4 y5 y6 y7 y8 y9. ineq [ + (#3.01,y0,&4); + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,&4); + (#2.0,y5,&2); + (#2.0,y6,&2); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (sqrt8,y9,sqrt8)] +( + (enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 = y0) /\ + ( y4 <= y0 ) /\ &0 <= delta_y y0 y9 y8 y4 y5 y6 ==> + #0.616 - #0.11 < tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 )) +`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.ineq;TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `y4 <= #3.108` (C SUBGOAL_THEN ASSUME_TAC); + PROOF_BY_CONTR_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "7697147739 delta top issue") [`y0`;`y9`;`y8`;`y4`;`y5`;`y6`]; + REWRITE_TAC[Sphere.ineq;TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + INTRO_TAC ((* Appendix. *) get_main_nonlinear "4559601669") [`y1`;`y5`;`y6`;`y4`;`y2`;`y3`]; + REWRITE_TAC[Sphere.ineq;TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + ANTS_TAC; + BY(REPEAT CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN TRY REAL_ARITH_TAC); + TYPIFY `delta4_y y1 y5 y6 y4 y2 y3 = delta4_y y1 y2 y3 y4 y5 y6` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[Sphere.delta4_y;Sphere.y_of_x;Sphere.delta_x4]; + BY(REAL_ARITH_TAC); + DISCH_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "7697147739 delta issue") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`;`y7`;`y8`;`y9`]; + REWRITE_TAC[Sphere.ineq;TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + ANTS_TAC; + BY(REPEAT CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN TRY REAL_ARITH_TAC); + ASM_SIMP_TAC[arith `d4 < &0 ==> ~(d4 > &0)`;arith `c <= y0 ==> ~(y0 < c)`]; + REWRITE_TAC[arith `x > y <=> y < x`]; + DISCH_TAC; + INTRO_TAC ((* Appendix. *) get_main_nonlinear "7697147739 a") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`;`y7`;`y8`;`y9`]; + REWRITE_TAC[Sphere.ineq;TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + ANTS_TAC; + BY(REPEAT CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN TRY REAL_ARITH_TAC); + ASM_SIMP_TAC[arith `d4 < &0 ==> ~(d4 > &0)`;arith `c <= y0 ==> ~(y0 < c)`;arith `c < d ==> ~(d < c)`]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) +*) + + +(* renamed from terminal_adhoc_quad_4680581274_empty, 2013-06-26, constant #0.616- #0.11 -> #0.513 *) +let empty_4T3 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = scs_4T3 in + //mk_unadorned_v39 4 ( #0.616 - #0.11) + // (funlist_v39 [(0,1),cstab; (0,2),cstab; (1,3),cstab] (&2) 4) + // (funlist_v39 [(0,1),cstab; (0,2),&6; (1,3),&6] (&2) 4) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_4T3]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[LET_THM]; + MATCH_MP_TAC (REWRITE_RULE[LET_THM] (UNDISCH terminal_quad_lemma)); + COMMENT "digression"; + TYPIFY `(!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> &2 <= funlist_v39 [(0,1),cstab; (0,2),cstab; (1,3),cstab] (&2) 4 i j) ` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[arith `i < 4 <=> (i = 0 \/ i = 1 \/ i = 2 \/ i = 3)`]; + REWRITE_TAC[TAUT `(a \/ b) /\ c <=> a /\ c \/ b /\ c`;TAUT `a /\ (b \/ c) <=> (a /\ b) \/ a /\ c`]; + REPEAT WEAKER_STRIP_TAC; + BY((REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[arith `SUC 0 = 1 /\ SUC 1 = 2 /\ SUC 2 = 3 /\ SUC 3 = 4`;MOD_4_EXPLICIT;FUNLIST_EXPLICIT;arith `&2 <= &2 /\ &2 <= &3`;arith `~(0=1) /\ ~(0=2) /\ ~(0=3) /\ ~(1 =2) /\ ~(1 = 3) /\ ~(2 = 3)`;Appendix.cstab;arith `&2 <= #3.01`]) THEN ASM_MESON_TAC[]); + COMMENT "conj1"; + CONJ_TAC; + BY(ASM_MESON_TAC[arith `&2 <= x ==> &0 < x`]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "prep dist"; + TYPIFY `(!i j d. d <= funlist_v39 [(0,1),cstab; (0,2),cstab; (1,3),cstab] (&2) 4 i j ==> d <= dist (vv i,vv j)) /\ (!i j d. funlist_v39 [(0,1),cstab; (0,2),&6; (1,3),&6] (&2) 4 i j <= d ==> dist (vv i,vv j) <= d)` ((C SUBGOAL_THEN MP_TAC)); + BY(ASM_MESON_TAC[REAL_LE_TRANS]); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `x + &0 = x /\ &4 - &2 = &2`]; + TYPIFY `(!i j. i < 4 /\ j < 4 /\ vv i = vv j ==> i = j)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + BY(ASM_MESON_TAC[DIST_REFL;REAL_LE_TRANS;arith `~(&2 <= &0)`]); + COMMENT "vv"; + TYPIFY `vv 4 = vv 0 /\ vv 5 = vv 1 /\ vv 6 = vv 2` (C SUBGOAL_THEN ASSUME_TAC); + BY((REPEAT CONJ_TAC) THEN GMATCH_SIMP_TAC periodic_vv_inj THEN TYPIFY `4` EXISTS_TAC THEN ASM_REWRITE_TAC[MOD_4_EXPLICIT;arith `~(4 = 0)`]); + ASM_REWRITE_TAC[]; + INTRO_TAC vv_quad_split_short [`vv`]; + ASM_REWRITE_TAC[LET_THM]; + COMMENT "dist"; + TYPIFY `(!i j. ~(vv i = vv j) ==> &2 <= dist (vv i,vv j))` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC periodic2_mod_reduce; + TYPIFY `4` EXISTS_TAC; + REWRITE_TAC[Appendix.periodic2;arith `~(4 = 0)`]; + TYPIFY `!i. vv (i + 4) = vv i` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(ASM_MESON_TAC[Oxl_def.periodic;arith `~(4 = 0)`]); + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[REAL_LE_TRANS]); + ASM_REWRITE_TAC[]; + COMMENT "edge lengths"; + TYPIFY `I(dist(vv 0,vv 1) = cstab /\ dist(vv 1,vv 2) = &2 /\ dist(vv 2, vv 3) = &2 /\ dist(vv 0,vv 3) = &2)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[I_DEF]; + REWRITE_TAC[arith `d = c <=> d <= c /\ c <= d`]; + FIRST_X_ASSUM kill; + BY(REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN REWRITE_TAC[FUNLIST_EXPLICIT;MOD_4_EXPLICIT;Appendix.cstab] THEN TRY REAL_ARITH_TAC); + TYPIFY `dist(vv 1,vv 0) = dist(vv 0,vv 1) /\ dist (vv 2, vv 0) = dist(vv 0,vv 2) /\ dist(vv 3,vv 0) = dist (vv 0, vv 3) /\ dist (vv 2,vv 1) = dist (vv 1, vv 2) /\ dist (vv 3,vv 2) = dist (vv 2, vv 3) /\ dist(vv 3,vv 1)=dist(vv 1,vv 3)` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[DIST_SYM]); + DISCH_TAC; + COMMENT "diags"; + TYPIFY `dist(vv 0,vv 2) < &4` (C SUBGOAL_THEN ASSUME_TAC); + PROOF_BY_CONTR_TAC; + INTRO_TAC delta_4680581274 [`dist(vv 1,vv 3)`;`dist(vv 0,vv 2)`]; + ANTS_TAC; + CONJ_TAC; + (FIRST_X_ASSUM MATCH_MP_TAC) THEN REWRITE_TAC[FUNLIST_EXPLICIT;Appendix.cstab;MOD_4_EXPLICIT;arith `~(1 = 3)`]; + BY(REAL_ARITH_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `~(d < &0) <=> &0 <= d`]; + TYPIFY `delta_y (dist (vv 1,vv 3)) (&2) (&2) (dist (vv 0,vv 2)) (&2) cstab = delta_y (dist(vv 3,vv 1)) (dist(vv 3,vv 0)) (dist(vv 3,vv 2)) (dist(vv 0,vv 2)) (dist (vv 1, vv 2)) (dist (vv 1, vv 0))` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[ DELTA_Y_POS_4POINTS]); + RULE_ASSUM_TAC (REWRITE_RULE[I_THM]); + BY(ASM_REWRITE_TAC[]); + COMMENT "second diag"; + TYPIFY `dist(vv 1,vv 3) < &4` (C SUBGOAL_THEN ASSUME_TAC); + PROOF_BY_CONTR_TAC; + INTRO_TAC delta_4680581274 [`dist(vv 2,vv 0)`;`dist(vv 1,vv 3)`]; + ANTS_TAC; + CONJ_TAC; + (FIRST_X_ASSUM MATCH_MP_TAC) THEN REWRITE_TAC[FUNLIST_EXPLICIT;Appendix.cstab;MOD_4_EXPLICIT;arith `~(0=2)`]; + BY(REAL_ARITH_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `~(d < &0) <=> &0 <= d`]; + TYPIFY `delta_y (dist (vv 2,vv 0)) (&2) (&2) (dist (vv 1,vv 3)) (&2) cstab = delta_y (dist(vv 2,vv 0)) (dist(vv 2,vv 1)) (dist(vv 2,vv 3)) (dist(vv 1,vv 3)) (dist (vv 0, vv 3)) (dist (vv 0, vv 1))` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[ DELTA_Y_POS_4POINTS]); + RULE_ASSUM_TAC (REWRITE_RULE[I_THM]); + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM_ST `rho_fun` MP_TAC; + ANTS_TAC; + RULE_ASSUM_TAC (REWRITE_RULE[I_THM]) THEN ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[Appendix.cstab] THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + COMMENT "enclosed"; + INTRO_TAC vv_enclosed4 [`vv`;`i`]; + REWRITE_TAC[LET_THM]; + ASM_REWRITE_TAC[]; + RULE_ASSUM_TAC(REWRITE_RULE[arith `i < 2 <=> i = 0 \/ i = 1`]); + ANTS_TAC; + FIRST_X_ASSUM DISJ_CASES_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[I_THM]); + ASM_REWRITE_TAC[arith `0+x = x`;Appendix.cstab]; + BY(REAL_ARITH_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[I_THM]); + ASM_REWRITE_TAC[arith `1+x = SUC x`;Appendix.cstab;SUC_EXPLICIT]; + BY(REAL_ARITH_TAC); + DISCH_THEN (ASSUME_TAC o GSYM); + COMMENT "relabel vars"; + TYPIFY `?v1 v2 v3 v4. ( let y1 = norm v1 in let y2 = norm v2 in let y3 = norm v3 in let y4 = dist(v2,v3) in let y5 = dist(v1,v3) in let y6 = dist(v1,v2) in let y7 = norm v4 in let y8 = dist(v3,v4) in let y9 = dist(v2,v4) in let y0 = enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 in ({v1,v2,v3,v4} SUBSET ball_annulus /\ tau3 (vv i) (vv (i + 1)) (vv (i + 2)) + tau3 (vv (i + 2)) (vv (i + 3)) (vv i) = tau3 v1 v2 v3 + tau3 v4 v2 v3 /\ y4 <= y0 /\ cstab <= y4 /\ y0 < &4 /\ y9 = cstab /\ y8 = &2 /\ y5 = &2 /\ y6 = &2 /\ y0 = dist(v1,v4)))` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM DISJ_CASES_TAC; + ASM_REWRITE_TAC[LET_THM;arith `0+x = x`]; + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + RULE_ASSUM_TAC (REWRITE_RULE[arith `0 + x = x`]); + GEXISTL_TAC [`vv 3`;`vv 0`;`vv 2`;`vv 1`]; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[enclosed_sym2]; + ONCE_REWRITE_TAC[enclosed_sym]; + ASM_REWRITE_TAC[]; + CONJ_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[IMAGE_SUBSET_IN;IN_UNIV]); + ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + BY(FIRST_X_ASSUM_ST `ball_annulus` MP_TAC THEN MESON_TAC[]); + CONJ_TAC; + BY(ASM_MESON_TAC[tau3_sym;arith `a + b = b + a`]); + RULE_ASSUM_TAC(REWRITE_RULE[I_THM]); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + REWRITE_TAC[FUNLIST_EXPLICIT;MOD_4_EXPLICIT]; + BY(REAL_ARITH_TAC); + COMMENT "second case relabel"; + ASM_REWRITE_TAC[LET_THM;arith `1+x = SUC x`;SUC_EXPLICIT]; + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + RULE_ASSUM_TAC (REWRITE_RULE[arith `1 + x = SUC x`;SUC_EXPLICIT]); + FIRST_X_ASSUM_ST `vv 4 = vv 0` (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + GEXISTL_TAC [`vv 2`;`vv 1`;`vv 3`;`vv 0`]; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[enclosed_sym]; + FIRST_X_ASSUM_ST `enclosed` MP_TAC; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + CONJ_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[IMAGE_SUBSET_IN;IN_UNIV]); + ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + BY(FIRST_X_ASSUM_ST `ball_annulus` MP_TAC THEN MESON_TAC[]); + CONJ_TAC; + BY(MESON_TAC[tau3_sym]); + FIRST_X_ASSUM_ST `<=` MP_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[I_THM]); + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist REWRITE_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + REWRITE_TAC[FUNLIST_EXPLICIT;MOD_4_EXPLICIT]; + BY(REAL_ARITH_TAC); + COMMENT "final kill"; + FIRST_X_ASSUM_ST `main_nonlinear_terminal_v11` MP_TAC; + REPEAT (FIRST_X_ASSUM kill); + REWRITE_TAC[LET_THM]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + RULE_ASSUM_TAC(ONCE_REWRITE_RULE[ISPEC `(a:real) = b` (GSYM I_THM)]); + REPEAT (GMATCH_SIMP_TAC tau3_taum_40); + RULE_ASSUM_TAC(REWRITE_RULE[INSERT_SUBSET]) THEN ASM_REWRITE_TAC[DIST_SYM]; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Appendix.cstab;I_THM] THEN REAL_ARITH_TAC); + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Appendix.cstab;I_THM] THEN REAL_ARITH_TAC); + MATCH_MP_TAC (arith `x < y ==> x <= y`); + COMMENT "get"; + MP_TAC (UNDISCH quad_4680581274_derived); + REWRITE_TAC[Sphere.ineq;TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + REWRITE_TAC[Sphere.tauq]; + DISCH_THEN MATCH_MP_TAC; + TYPIFY `dist(v1,v4)` EXISTS_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[I_THM] THEN DISCH_THEN (fun t -> RULE_ASSUM_TAC(REWRITE_RULE[t]) THEN SUBST1_TAC t); + TYPIFY `&0 <= delta_y (dist (v1,v4)) (dist (v2,v4)) (dist (v3,v4)) (dist (v2,v3)) (dist (v1,v3)) (dist (v1,v2))` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + TYPIFY `dist (v1,v4) = dist(v4,v1) /\ dist(v2,v4) = dist(v4,v2) /\ dist(v3,v4) = dist(v4,v3)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(MESON_TAC[DIST_SYM]); + BY(REWRITE_TAC[DELTA_Y_POS_4POINTS]); + RULE_ASSUM_TAC(REWRITE_RULE[I_THM;Appendix.cstab;Fnjlbxs.in_ball_annulus]) THEN ASM_REWRITE_TAC[Appendix.cstab;arith `#2.0= &2`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* deprecated 2013-06-17: +let terminal_adhoc_quad_7697147739_empty = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = mk_unadorned_v39 4 ( #0.616 - #0.11) + (funlist_v39 [(0,1),sqrt8; (0,2),cstab; (1,3),cstab] (&2) 4) + (funlist_v39 [(0,1),sqrt8; (0,2),&6; (1,3),&6] (&2) 4) in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[LET_THM]; + MATCH_MP_TAC (REWRITE_RULE[LET_THM] (UNDISCH terminal_quad_lemma)); + COMMENT "sqrt8 bounds"; + TYPIFY `#2.828427 < sqrt8 /\ sqrt8 < #2.828428` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Flyspeck_constants.bounds]); + TYPIFY `&2 <= sqrt8` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT "digression"; + TYPIFY `(!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> &2 <= funlist_v39 [(0,1),sqrt8; (0,2),cstab; (1,3),cstab] (&2) 4 i j) ` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[arith `i < 4 <=> (i = 0 \/ i = 1 \/ i = 2 \/ i = 3)`]; + REWRITE_TAC[TAUT `(a \/ b) /\ c <=> a /\ c \/ b /\ c`;TAUT `a /\ (b \/ c) <=> (a /\ b) \/ a /\ c`]; + REPEAT WEAKER_STRIP_TAC; + BY(((REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[arith `SUC 0 = 1 /\ SUC 1 = 2 /\ SUC 2 = 3 /\ SUC 3 = 4`;MOD_4_EXPLICIT;FUNLIST_EXPLICIT;arith `&2 <= &2 /\ &2 <= &3`;arith `~(0=1) /\ ~(0=2) /\ ~(0=3) /\ ~(1 =2) /\ ~(1 = 3) /\ ~(2 = 3)`;Appendix.cstab;arith `&2 <= #3.01`])) THEN TRY (ASM_MESON_TAC[])); + COMMENT "conj1"; + CONJ_TAC; + BY(ASM_MESON_TAC[arith `&2 <= x ==> &0 < x`]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "prep dist"; + TYPIFY `(!i j d. d <= funlist_v39 [(0,1),sqrt8; (0,2),cstab; (1,3),cstab] (&2) 4 i j ==> d <= dist (vv i,vv j)) /\ (!i j d. funlist_v39 [(0,1),sqrt8; (0,2),&6; (1,3),&6] (&2) 4 i j <= d ==> dist (vv i,vv j) <= d)` ((C SUBGOAL_THEN MP_TAC)); + BY(ASM_MESON_TAC[REAL_LE_TRANS]); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `x + &0 = x /\ &4 - &2 = &2`]; + TYPIFY `(!i j. i < 4 /\ j < 4 /\ vv i = vv j ==> i = j)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + BY(ASM_MESON_TAC[DIST_REFL;REAL_LE_TRANS;arith `~(&2 <= &0)`]); + COMMENT "vv"; + TYPIFY `vv 4 = vv 0 /\ vv 5 = vv 1 /\ vv 6 = vv 2` (C SUBGOAL_THEN ASSUME_TAC); + BY((REPEAT CONJ_TAC) THEN GMATCH_SIMP_TAC periodic_vv_inj THEN TYPIFY `4` EXISTS_TAC THEN ASM_REWRITE_TAC[MOD_4_EXPLICIT;arith `~(4 = 0)`]); + ASM_REWRITE_TAC[]; + INTRO_TAC vv_quad_split_short [`vv`]; + ASM_REWRITE_TAC[LET_THM]; + COMMENT "dist"; + TYPIFY `(!i j. ~(vv i = vv j) ==> &2 <= dist (vv i,vv j))` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC periodic2_mod_reduce; + TYPIFY `4` EXISTS_TAC; + REWRITE_TAC[Appendix.periodic2;arith `~(4 = 0)`]; + TYPIFY `!i. vv (i + 4) = vv i` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(ASM_MESON_TAC[Oxl_def.periodic;arith `~(4 = 0)`]); + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[REAL_LE_TRANS]); + ASM_REWRITE_TAC[]; + COMMENT "edge lengths"; + TYPIFY `I(dist(vv 0,vv 1) = sqrt8 /\ dist(vv 1,vv 2) = &2 /\ dist(vv 2, vv 3) = &2 /\ dist(vv 0,vv 3) = &2)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[I_DEF]; + REWRITE_TAC[arith `d = c <=> d <= c /\ c <= d`]; + FIRST_X_ASSUM kill; + BY((REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN REWRITE_TAC[FUNLIST_EXPLICIT;MOD_4_EXPLICIT;Appendix.cstab] THEN TRY REAL_ARITH_TAC)); + TYPIFY `dist(vv 1,vv 0) = dist(vv 0,vv 1) /\ dist (vv 2, vv 0) = dist(vv 0,vv 2) /\ dist(vv 3,vv 0) = dist (vv 0, vv 3) /\ dist (vv 2,vv 1) = dist (vv 1, vv 2) /\ dist (vv 3,vv 2) = dist (vv 2, vv 3) /\ dist(vv 3,vv 1)=dist(vv 1,vv 3)` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[DIST_SYM]); + DISCH_TAC; + COMMENT "diags"; + TYPIFY `dist(vv 0,vv 2) < &4` (C SUBGOAL_THEN ASSUME_TAC); + PROOF_BY_CONTR_TAC; + INTRO_TAC delta_7697147739 [`dist(vv 1,vv 3)`;`dist(vv 0,vv 2)`]; + ANTS_TAC; + CONJ_TAC; + (FIRST_X_ASSUM MATCH_MP_TAC) THEN REWRITE_TAC[FUNLIST_EXPLICIT;Appendix.cstab;MOD_4_EXPLICIT;arith `~(1 = 3)`]; + BY(REAL_ARITH_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `~(d < &0) <=> &0 <= d`]; + TYPIFY `delta_y (dist (vv 1,vv 3)) (&2) (&2) (dist (vv 0,vv 2)) (&2) sqrt8 = delta_y (dist(vv 3,vv 1)) (dist(vv 3,vv 0)) (dist(vv 3,vv 2)) (dist(vv 0,vv 2)) (dist (vv 1, vv 2)) (dist (vv 1, vv 0))` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[ DELTA_Y_POS_4POINTS]); + RULE_ASSUM_TAC (REWRITE_RULE[I_THM]); + BY(ASM_REWRITE_TAC[]); + COMMENT "second diag"; + TYPIFY `dist(vv 1,vv 3) < &4` (C SUBGOAL_THEN ASSUME_TAC); + PROOF_BY_CONTR_TAC; + INTRO_TAC delta_7697147739 [`dist(vv 2,vv 0)`;`dist(vv 1,vv 3)`]; + ANTS_TAC; + CONJ_TAC; + (FIRST_X_ASSUM MATCH_MP_TAC) THEN REWRITE_TAC[FUNLIST_EXPLICIT;Appendix.cstab;MOD_4_EXPLICIT;arith `~(0=2)`]; + BY(REAL_ARITH_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `~(d < &0) <=> &0 <= d`]; + TYPIFY `delta_y (dist (vv 2,vv 0)) (&2) (&2) (dist (vv 1,vv 3)) (&2) sqrt8 = delta_y (dist(vv 2,vv 0)) (dist(vv 2,vv 1)) (dist(vv 2,vv 3)) (dist(vv 1,vv 3)) (dist (vv 0, vv 3)) (dist (vv 0, vv 1))` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[ DELTA_Y_POS_4POINTS]); + RULE_ASSUM_TAC (REWRITE_RULE[I_THM]); + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM_ST `rho_fun` MP_TAC; + ANTS_TAC; + RULE_ASSUM_TAC (REWRITE_RULE[I_THM]) THEN ASM_REWRITE_TAC[]; + BY(REPEAT (FIRST_X_ASSUM_ST `sqrt8 < c` MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + COMMENT "enclosed"; + INTRO_TAC vv_enclosed4 [`vv`;`i`]; + REWRITE_TAC[LET_THM]; + ASM_REWRITE_TAC[]; + RULE_ASSUM_TAC(REWRITE_RULE[arith `i < 2 <=> i = 0 \/ i = 1`]); + ANTS_TAC; + FIRST_X_ASSUM DISJ_CASES_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[I_THM]); + ASM_REWRITE_TAC[arith `0+x = x`;Appendix.cstab]; + BY(REPEAT (FIRST_X_ASSUM_ST `sqrt8 < c` MP_TAC) THEN REAL_ARITH_TAC); + RULE_ASSUM_TAC(REWRITE_RULE[I_THM]); + ASM_REWRITE_TAC[arith `1+x = SUC x`;Appendix.cstab;SUC_EXPLICIT]; + BY(REPEAT (FIRST_X_ASSUM_ST `sqrt8 < c` MP_TAC) THEN REAL_ARITH_TAC); + DISCH_THEN (ASSUME_TAC o GSYM); + COMMENT "relabel vars"; + TYPIFY `?v1 v2 v3 v4. ( let y1 = norm v1 in let y2 = norm v2 in let y3 = norm v3 in let y4 = dist(v2,v3) in let y5 = dist(v1,v3) in let y6 = dist(v1,v2) in let y7 = norm v4 in let y8 = dist(v3,v4) in let y9 = dist(v2,v4) in let y0 = enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 in ({v1,v2,v3,v4} SUBSET ball_annulus /\ tau3 (vv i) (vv (i + 1)) (vv (i + 2)) + tau3 (vv (i + 2)) (vv (i + 3)) (vv i) = tau3 v1 v2 v3 + tau3 v4 v2 v3 /\ y4 <= y0 /\ cstab <= y4 /\ y0 < &4 /\ y9 = sqrt8 /\ y8 = &2 /\ y5 = &2 /\ y6 = &2 /\ y0 = dist(v1,v4)))` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM DISJ_CASES_TAC; + ASM_REWRITE_TAC[LET_THM;arith `0+x = x`]; + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + RULE_ASSUM_TAC (REWRITE_RULE[arith `0 + x = x`]); + GEXISTL_TAC [`vv 3`;`vv 0`;`vv 2`;`vv 1`]; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[enclosed_sym2]; + ONCE_REWRITE_TAC[enclosed_sym]; + ASM_REWRITE_TAC[]; + CONJ_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[IMAGE_SUBSET_IN;IN_UNIV]); + ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + BY(FIRST_X_ASSUM_ST `ball_annulus` MP_TAC THEN MESON_TAC[]); + CONJ_TAC; + BY(ASM_MESON_TAC[tau3_sym;arith `a + b = b + a`]); + RULE_ASSUM_TAC(REWRITE_RULE[I_THM]); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + REWRITE_TAC[FUNLIST_EXPLICIT;MOD_4_EXPLICIT]; + BY(REAL_ARITH_TAC); + COMMENT "second case relabel"; + ASM_REWRITE_TAC[LET_THM;arith `1+x = SUC x`;SUC_EXPLICIT]; + FIRST_X_ASSUM (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + RULE_ASSUM_TAC (REWRITE_RULE[arith `1 + x = SUC x`;SUC_EXPLICIT]); + FIRST_X_ASSUM_ST `vv 4 = vv 0` (RULE_ASSUM_TAC o (unlist REWRITE_RULE)); + GEXISTL_TAC [`vv 2`;`vv 1`;`vv 3`;`vv 0`]; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[enclosed_sym]; + FIRST_X_ASSUM_ST `enclosed` MP_TAC; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + CONJ_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[IMAGE_SUBSET_IN;IN_UNIV]); + ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + BY(FIRST_X_ASSUM_ST `ball_annulus` MP_TAC THEN MESON_TAC[]); + CONJ_TAC; + BY(MESON_TAC[tau3_sym]); + FIRST_X_ASSUM_ST `<=` MP_TAC; + RULE_ASSUM_TAC(REWRITE_RULE[I_THM]); + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist REWRITE_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + REWRITE_TAC[FUNLIST_EXPLICIT;MOD_4_EXPLICIT]; + BY(REAL_ARITH_TAC); + COMMENT "final kill"; + FIRST_X_ASSUM_ST `main_nonlinear_terminal_v11` MP_TAC; + FIRST_X_ASSUM_ST `sqrt8 < c` MP_TAC; + REPEAT (FIRST_X_ASSUM kill); + REWRITE_TAC[LET_THM]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + RULE_ASSUM_TAC(ONCE_REWRITE_RULE[ISPEC `(a:real) = b` (GSYM I_THM)]); + REPEAT (GMATCH_SIMP_TAC tau3_taum_40); + RULE_ASSUM_TAC(REWRITE_RULE[INSERT_SUBSET]) THEN ASM_REWRITE_TAC[DIST_SYM]; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Appendix.cstab;I_THM] THEN REAL_ARITH_TAC); + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Appendix.cstab;I_THM] THEN REAL_ARITH_TAC); + MATCH_MP_TAC (arith `x < y ==> x <= y`); + COMMENT "get"; + MP_TAC (UNDISCH quad_7697147739_derived); + REWRITE_TAC[Sphere.ineq;TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + REWRITE_TAC[Sphere.tauq]; + DISCH_THEN MATCH_MP_TAC; + TYPIFY `dist(v1,v4)` EXISTS_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[I_THM] THEN DISCH_THEN (fun t -> RULE_ASSUM_TAC(REWRITE_RULE[t]) THEN SUBST1_TAC t); + TYPIFY `&0 <= delta_y (dist (v1,v4)) (dist (v2,v4)) (dist (v3,v4)) (dist (v2,v3)) (dist (v1,v3)) (dist (v1,v2))` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + TYPIFY `dist (v1,v4) = dist(v4,v1) /\ dist(v2,v4) = dist(v4,v2) /\ dist(v3,v4) = dist(v4,v3)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(MESON_TAC[DIST_SYM]); + BY(REWRITE_TAC[DELTA_Y_POS_4POINTS]); + RULE_ASSUM_TAC(REWRITE_RULE[I_THM;Appendix.cstab;Fnjlbxs.in_ball_annulus]) THEN ASM_REWRITE_TAC[Appendix.cstab;arith `#2.0= &2`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) +*) + +let empty_4T4 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = scs_4T4 in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_4T4]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[LET_THM]; + MATCH_MP_TAC (REWRITE_RULE[LET_THM] (UNDISCH terminal_quad_lemma)); + COMMENT "digression"; + TYPIFY `(!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> &2 <= funlist_v39 [(0,1),&2 * h0; (0,2),sqrt8; (1,3),sqrt8] (&2) 4 i j)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[arith `i < 4 <=> (i = 0 \/ i = 1 \/ i = 2 \/ i = 3)`]; + REWRITE_TAC[TAUT `(a \/ b) /\ c <=> a /\ c \/ b /\ c`;TAUT `a /\ (b \/ c) <=> (a /\ b) \/ a /\ c`]; + REWRITE_TAC[TAUT `(a \/ b) \/ c <=> a \/ b \/ c`;arith `~(i = k /\ j = k /\ ~(i = (j:num)))`]; + REPEAT WEAKER_STRIP_TAC; + BY((REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[FUNLIST_EXPLICIT;arith `SUC 0 = 1 /\ SUC 1 = 2 /\ SUC 2 = 3 /\ SUC 3 = 4`;MOD_4_EXPLICIT;arith `&2 <= &2 /\ &2 <= &3`;arith `~(0=1) /\ ~(0=2) /\ ~(0=3) /\ ~(1 =2) /\ ~(1 = 3) /\ ~(2 = 3)`;Sphere.h0] THEN MP_TAC sqrt8_flyspeck THEN TRY REAL_ARITH_TAC)); + COMMENT "digress2"; + TYPIFY `!i j. (i=0 /\ j=1) \/ (i=0 /\ j=3) \/ (i=1 /\ j=2) \/ (i=1 /\ j=3) \/ (i=2 /\ j=3) ==> funlist_v39 [(0,1),sqrt8; (0,2),&6; (1,3),cstab] (&2 * h0) 4 i j < &4` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[arith `i < 4 <=> (i = 0 \/ i = 1 \/ i = 2 \/ i = 3)`]; + REWRITE_TAC[TAUT `(a \/ b) /\ c <=> a /\ c \/ b /\ c`;TAUT `a /\ (b \/ c) <=> (a /\ b) \/ a /\ c`]; + REWRITE_TAC[TAUT `(a \/ b) \/ c <=> a \/ b \/ c`;arith `~(i = k /\ j = k /\ ~(i = (j:num)))`]; + REWRITE_TAC[Appendix.cs_adj;Sphere.h0]; + REPEAT WEAKER_STRIP_TAC; + BY((REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[FUNLIST_EXPLICIT;arith `SUC 0 = 1 /\ SUC 1 = 2 /\ SUC 2 = 3 /\ SUC 3 = 4`;MOD_4_EXPLICIT;arith `&2 * #1.26 < &4 /\ &3 < &4`;arith `~(0=1) /\ ~(0=2) /\ ~(0=3) /\ ~(1 =2) /\ ~(1 = 3) /\ ~(2 = 3)`;Sphere.cstab] THEN MP_TAC sqrt8_flyspeck THEN TRY REAL_ARITH_TAC)); + CONJ_TAC; + BY(ASM_MESON_TAC[arith `&2 <= x ==> &0 < x`]); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `x + &0 = x /\ &4 - &2 = &2`]; + TYPIFY `(!i j. i < 4 /\ j < 4 /\ vv i = vv j ==> i = j)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + BY(ASM_MESON_TAC[DIST_REFL;REAL_LE_TRANS;arith `~(&2 <= &0)`]); + COMMENT "vv"; + TYPIFY `vv 4 = vv 0 /\ vv 5 = vv 1 /\ vv 6 = vv 2` (C SUBGOAL_THEN ASSUME_TAC); + BY((REPEAT CONJ_TAC) THEN GMATCH_SIMP_TAC periodic_vv_inj THEN TYPIFY `4` EXISTS_TAC THEN ASM_REWRITE_TAC[MOD_4_EXPLICIT;arith `~(4 = 0)`]); + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] vv_quad_split123); + ASM_REWRITE_TAC[]; + COMMENT "dist"; + SUBCONJ_TAC; + TYPIFY `(!i j. ~(vv i = vv j) ==> &2 <= dist (vv i,vv j))` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC periodic2_mod_reduce; + TYPIFY `4` EXISTS_TAC; + REWRITE_TAC[Appendix.periodic2;arith `~(4 = 0)`]; + TYPIFY `!i. vv (i + 4) = vv i` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(ASM_MESON_TAC[Oxl_def.periodic;arith `~(4 = 0)`]); + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[REAL_LE_TRANS]); + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[REAL_LET_TRANS]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "tau3"; + REPEAT (GMATCH_SIMP_TAC tau3_taum_40); + ASM_REWRITE_TAC[]; + RULE_ASSUM_TAC(REWRITE_RULE[IMAGE_SUBSET_IN;IN_UNIV]); + ASM_REWRITE_TAC[DIST_SYM]; + TYPIFY `dist (vv 3,vv 0) < &4 ` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + ONCE_REWRITE_TAC[DIST_SYM]; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[TAUT `a /\ b /\ c <=> (a /\ b) /\ c`]; + CONJ_TAC; + FIRST_X_ASSUM (REPEAT o GMATCH_SIMP_TAC); + FIRST_X_ASSUM_ST `i < 4` MP_TAC; + BY(MESON_TAC[arith `1 < 4 /\ 2 < 4 /\ 3 < 4 /\ 0 < 4 /\ ~(2=3) /\ ~(2 =1) /\ ~(1 =0) /\ ~(1 = 3) /\ ~(3=0 ) /\ ~(1 = 2)`]); + COMMENT "prep dist"; + TYPED_ABBREV_TAC `a = funlist_v39 [(0,1),&2 * h0; (0,2),sqrt8; (1,3),sqrt8] (&2) 4`; + TYPED_ABBREV_TAC `b = funlist_v39 [(0,1),sqrt8; (0,2),&6; (1,3),cstab] (&2 * h0) 4`; + TYPIFY `(!i j d. d <= a i j ==> d <= dist (vv i,vv j)) /\ (!i j d. b i j <= d ==> dist (vv i,vv j) <= d)` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[REAL_LE_TRANS]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `a 1 0 = &2 * h0 /\ a 2 1 = &2 /\ a 2 3 = &2 /\ a 3 0 = &2 /\ a 1 3 = sqrt8 /\ b 1 0 = sqrt8 /\ b 2 1 = &2 * h0 /\ b 2 3 = &2 * h0 /\ b 3 0 = &2 * h0 /\ b 1 3 = cstab` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "a"; + EXPAND_TAC "b"; + BY(REWRITE_TAC[FUNLIST_EXPLICIT;MOD_4_EXPLICIT]); + RULE_ASSUM_TAC(REWRITE_RULE[Fnjlbxs.in_ball_annulus]); + TYPIFY `#2.52 = &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + COMMENT "fist get"; + INTRO_TAC (get_main_nonlinear "5405130650") [`norm (vv 0)`;`norm (vv 3)`;`norm (vv 1)`;`dist(vv 3,vv 1)`;`dist(vv 0,vv 1)`;`dist(vv 0,vv 3)`]; + REWRITE_TAC[Sphere.ineq]; + REWRITE_TAC[TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + REWRITE_TAC[arith `(d < &0) <=> ~(&0 <= d)`]; + REWRITE_TAC[REWRITE_RULE[LET_THM] Tame_lemmas.delta_y_pos]; + ASM_REWRITE_TAC[DIST_SYM;arith `#2.0 = &2`]; + ANTS_TAC; + BY((REPEAT CONJ_TAC THEN (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[Sphere.h0;Sphere.cstab] THEN TRY REAL_ARITH_TAC)); + DISCH_TAC; + COMMENT "second get"; + INTRO_TAC (get_main_nonlinear "3603097872") [`norm (vv 2)`;`norm (vv 3)`;`norm (vv 1)`;`dist(vv 3,vv 1)`;`dist(vv 2,vv 1)`;`dist(vv 2,vv 3)`]; + REWRITE_TAC[Sphere.ineq]; + REWRITE_TAC[TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + REWRITE_TAC[arith `(d < &0) <=> ~(&0 <= d)`]; + REWRITE_TAC[REWRITE_RULE[LET_THM] Tame_lemmas.delta_y_pos]; + ASM_REWRITE_TAC[DIST_SYM;arith `#2.0 = &2`]; + ANTS_TAC; + BY((REPEAT CONJ_TAC THEN (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[Sphere.h0;Sphere.cstab] THEN TRY REAL_ARITH_TAC)); + COMMENT "final kill"; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[DIST_SYM]; + TYPIFY `taum (norm (vv 0)) (norm (vv 3)) (norm (vv 1)) (dist (vv 1,vv 3)) (dist (vv 1,vv 0)) (dist (vv 3,vv 0)) = taum (norm (vv 3)) (norm (vv 0)) (norm (vv 1)) (dist (vv 1,vv 0)) (dist (vv 1,vv 3)) (dist (vv 3,vv 0)) /\ taum (norm (vv 2)) (norm (vv 3)) (norm (vv 1)) (dist (vv 1,vv 3)) (dist (vv 2,vv 1)) (dist (vv 2,vv 3)) = taum (norm (vv 1)) (norm (vv 2)) (norm (vv 3)) (dist (vv 2,vv 3)) (dist (vv 1,vv 3)) (dist (vv 2,vv 1))` ENOUGH_TO_SHOW_TAC; + DISCH_THEN (unlist REWRITE_TAC); + BY(REAL_ARITH_TAC); + BY(REWRITE_TAC[(* Terminal. *) taum_sym]) + ]);; + (* }}} *) + +let empty_4T5 = prove_by_refinement( + `main_nonlinear_terminal_v11 ==> + (let s = scs_4T5 in + (!vv. BBs_v39 s vv ==> &0 <= taustar_v39 s vv))`, + (* {{{ proof *) + [ + REWRITE_TAC[Appendix.scs_4T5]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[LET_THM]; + MATCH_MP_TAC (REWRITE_RULE[LET_THM] (UNDISCH terminal_quad_lemma)); + COMMENT "digression"; + TYPED_ABBREV_TAC `a = funlist_v39 [(0,1),&2 * h0; (0,2),cstab; (1,3),cstab] (&2) 4`; + TYPED_ABBREV_TAC `b = funlist_v39 [(0,1),cstab; (0,2),&6; (1,3),cstab] (&2 * h0) 4`; + TYPIFY `(!i j. i < 4 /\ j < 4 /\ ~(i = j) ==> &2 <= a i j)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[arith `i < 4 <=> (i = 0 \/ i = 1 \/ i = 2 \/ i = 3)`]; + REWRITE_TAC[TAUT `(a \/ b) /\ c <=> a /\ c \/ b /\ c`;TAUT `a /\ (b \/ c) <=> (a /\ b) \/ a /\ c`]; + REWRITE_TAC[TAUT `(a \/ b) \/ c <=> a \/ b \/ c`;arith `~(i = k /\ j = k /\ ~(i = (j:num)))`]; + REPEAT WEAKER_STRIP_TAC; + EXPAND_TAC "a"; + BY((REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[FUNLIST_EXPLICIT;arith `SUC 0 = 1 /\ SUC 1 = 2 /\ SUC 2 = 3 /\ SUC 3 = 4`;MOD_4_EXPLICIT;arith `&2 <= &2 /\ &2 <= &3`;arith `~(0=1) /\ ~(0=2) /\ ~(0=3) /\ ~(1 =2) /\ ~(1 = 3) /\ ~(2 = 3)`;Sphere.h0;Sphere.cstab] THEN MP_TAC sqrt8_flyspeck THEN TRY REAL_ARITH_TAC)); + COMMENT "digress2"; + TYPIFY `!i j. (i=0 /\ j=1) \/ (i=0 /\ j=3) \/ (i=1 /\ j=2) \/ (i=1 /\ j=3) \/ (i=2 /\ j=3) ==> b i j < &4` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[arith `i < 4 <=> (i = 0 \/ i = 1 \/ i = 2 \/ i = 3)`]; + REWRITE_TAC[TAUT `(a \/ b) /\ c <=> a /\ c \/ b /\ c`;TAUT `a /\ (b \/ c) <=> (a /\ b) \/ a /\ c`]; + REWRITE_TAC[TAUT `(a \/ b) \/ c <=> a \/ b \/ c`;arith `~(i = k /\ j = k /\ ~(i = (j:num)))`]; + EXPAND_TAC "b"; + REPEAT WEAKER_STRIP_TAC; + BY((REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC) THEN ASM_REWRITE_TAC[FUNLIST_EXPLICIT;arith `SUC 0 = 1 /\ SUC 1 = 2 /\ SUC 2 = 3 /\ SUC 3 = 4`;MOD_4_EXPLICIT;arith `&2 * #1.26 < &4 /\ &3 < &4`;arith `~(0=1) /\ ~(0=2) /\ ~(0=3) /\ ~(1 =2) /\ ~(1 = 3) /\ ~(2 = 3)`;Sphere.cstab;Sphere.h0] THEN MP_TAC sqrt8_flyspeck THEN TRY REAL_ARITH_TAC)); + CONJ_TAC; + BY(ASM_MESON_TAC[arith `&2 <= x ==> &0 < x`]); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `x + &0 = x /\ &4 - &2 = &2`]; + TYPIFY `(!i j. i < 4 /\ j < 4 /\ vv i = vv j ==> i = j)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + BY(ASM_MESON_TAC[DIST_REFL;REAL_LE_TRANS;arith `~(&2 <= &0)`]); + COMMENT "vv"; + TYPIFY `vv 4 = vv 0 /\ vv 5 = vv 1 /\ vv 6 = vv 2` (C SUBGOAL_THEN ASSUME_TAC); + BY((REPEAT CONJ_TAC) THEN GMATCH_SIMP_TAC periodic_vv_inj THEN TYPIFY `4` EXISTS_TAC THEN ASM_REWRITE_TAC[MOD_4_EXPLICIT;arith `~(4 = 0)`]); + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC (REWRITE_RULE[LET_THM] vv_quad_split123); + ASM_REWRITE_TAC[]; + COMMENT "dist"; + SUBCONJ_TAC; + TYPIFY `(!i j. ~(vv i = vv j) ==> &2 <= dist (vv i,vv j))` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC periodic2_mod_reduce; + TYPIFY `4` EXISTS_TAC; + REWRITE_TAC[Appendix.periodic2;arith `~(4 = 0)`]; + TYPIFY `!i. vv (i + 4) = vv i` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(ASM_MESON_TAC[Oxl_def.periodic;arith `~(4 = 0)`]); + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[REAL_LE_TRANS]); + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[REAL_LET_TRANS]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "tau3"; + REPEAT (GMATCH_SIMP_TAC tau3_taum_40); + ASM_REWRITE_TAC[]; + RULE_ASSUM_TAC(REWRITE_RULE[IMAGE_SUBSET_IN;IN_UNIV]); + ASM_REWRITE_TAC[DIST_SYM]; + TYPIFY `dist (vv 3,vv 0) < &4 ` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + ONCE_REWRITE_TAC[DIST_SYM]; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[TAUT `a /\ b /\ c <=> (a /\ b) /\ c`]; + CONJ_TAC; + FIRST_X_ASSUM (REPEAT o GMATCH_SIMP_TAC); + FIRST_X_ASSUM_ST `i < 4` MP_TAC; + BY(MESON_TAC[arith `1 < 4 /\ 2 < 4 /\ 3 < 4 /\ 0 < 4 /\ ~(2=3) /\ ~(2 =1) /\ ~(1 =0) /\ ~(1 = 3) /\ ~(3=0 ) /\ ~(1 = 2)`]); + COMMENT "prep dist"; + TYPIFY `(!i j d. d <= a i j ==> d <= dist (vv i,vv j)) /\ (!i j d. b i j <= d ==> dist (vv i,vv j) <= d)` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[REAL_LE_TRANS]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `a 1 0 = &2 * h0 /\ a 2 1 = &2 /\ a 2 3 = &2 /\ a 3 0 = &2 /\ a 1 3 = cstab /\ b 1 0 = cstab /\ b 2 1 = &2 * h0 /\ b 2 3 = &2 * h0 /\ b 3 0 = &2 * h0 /\ b 1 3 = cstab` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "a"; + EXPAND_TAC "b"; + BY(REWRITE_TAC[FUNLIST_EXPLICIT;MOD_4_EXPLICIT]); + RULE_ASSUM_TAC(REWRITE_RULE[Fnjlbxs.in_ball_annulus]); + TYPIFY `#2.52 = &2 * h0` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC); + INTRO_TAC (get_main_nonlinear "9096461391") [`norm (vv 1)`;`norm (vv 3)`;`norm (vv 0)`;`dist(vv 3,vv 0)`;`dist(vv 1,vv 0)`;`dist(vv 1,vv 3)`]; + REWRITE_TAC[Sphere.ineq]; + REWRITE_TAC[TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + ASM_REWRITE_TAC[DIST_SYM;arith `#2.0 = &2`]; + ANTS_TAC; + BY((REPEAT CONJ_TAC THEN (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[Sphere.h0;Sphere.cstab] THEN TRY REAL_ARITH_TAC)); + DISCH_TAC; + COMMENT "second get"; + INTRO_TAC (get_main_nonlinear "2445657182") [`norm (vv 1)`;`norm (vv 3)`;`norm (vv 2)`;`dist(vv 3,vv 2)`;`dist(vv 1,vv 2)`;`dist(vv 1,vv 3)`]; + REWRITE_TAC[Sphere.ineq]; + REWRITE_TAC[TAUT `(a ==> b==> c) <=> (a /\ b) ==> c `;TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + ASM_REWRITE_TAC[DIST_SYM;arith `#2.0 = &2`]; + ANTS_TAC; + BY((REPEAT CONJ_TAC THEN (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[Sphere.h0;Sphere.cstab] THEN TRY REAL_ARITH_TAC)); + COMMENT "final kill"; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[DIST_SYM]; + TYPIFY `taum (norm (vv 1)) (norm (vv 3)) (norm (vv 0)) (dist (vv 3,vv 0)) (dist (vv 1,vv 0)) (dist (vv 1,vv 3)) = taum (norm (vv 3)) (norm (vv 0)) (norm (vv 1)) (dist (vv 1,vv 0)) (dist (vv 1,vv 3)) (dist (vv 3,vv 0)) /\ taum (norm (vv 1)) (norm (vv 3)) (norm (vv 2)) (dist (vv 2,vv 3)) (dist (vv 2,vv 1)) (dist (vv 1,vv 3)) = taum (norm (vv 1)) (norm (vv 2)) (norm (vv 3)) (dist (vv 2,vv 3)) (dist (vv 1,vv 3)) (dist (vv 2,vv 1))` ENOUGH_TO_SHOW_TAC; + DISCH_THEN (unlist REWRITE_TAC); + BY(REAL_ARITH_TAC); + BY(REWRITE_TAC[(* Terminal. *)taum_sym]) + ]);; + (* }}} *) + + + + end;; + + + + + diff --git a/text_formalization/nonlinear/auto_lib.hl b/text_formalization/nonlinear/auto_lib.hl new file mode 100644 index 0000000..106cdbe --- /dev/null +++ b/text_formalization/nonlinear/auto_lib.hl @@ -0,0 +1,441 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: nonlinear inequalities *) +(* Author: Thomas Hales *) +(* Date: 2012-06-02 *) +(* ========================================================================= *) + +(* + Generates + ocaml function module (Sphere2). + C++ Functions from HOL-Light specs. + C++ Interval code for inequalities from HOL-Light specs. + + It uses many lemmas from functional_equation.hl + +*) + + +(* to fix: + proj_y1 = sqrt_x1 ,etc. + + to reorganize: + move optimize.hl material on C++ generation here. + Leave optimize.hl as the preprocessing module. +*) + + +flyspeck_needs "general/flyspeck_lib.hl";; +flyspeck_needs "nonlinear/functional_equation.hl";; +flyspeck_needs "nonlinear/optimize.hl";; +flyspeck_needs "nonlinear/parse_ineq.hl";; +flyspeck_needs "nonlinear/function_list.hl";; + +module Auto_lib = struct + + let join_comma = Flyspeck_lib.join_comma;; + let join_space = Flyspeck_lib.join_space;; + let join_lines = Flyspeck_lib.join_lines;; + let functions = Function_list.functions();; + +let ocaml_code = + let strip_all b = snd(strip_forall (concl (Nonlinear_lemma.strip_let b))) in + let ocam f = Parse_ineq.ocaml_function (strip_all f) in + let header = + "(* code automatically generated from Parse_ineq.ocaml_code *)\n\n"^ + "module Sphere2 = struct\n\n"^ + "let sqrt = Pervasives.sqrt;;\n\n" ^ + "let safesqrt = Pervasives.sqrt;;\n\n" ^ + "let cos = Pervasives.cos;;\n\n" ^ + "let sin = Pervasives.sin;;\n\n" ^ + "let log = Pervasives.log;;\n\n" ^ + "let asn = Pervasives.asin;;\n\n" ^ + "let atn = Pervasives.atan;;\n\n" ^ + "let hminus = 1.2317544220903043901;;\n\n" ^ + "let pow2 x = x ** (2.0);;\n\n" in + let tailer = "end;;\n" in + header ^ + (Flyspeck_lib.join_lines (map ocam functions)) ^ tailer;; + + +(* Load module Sphere2 *) + +let sphere2_ml = Filename.temp_file "sphere2" ".ml";; + +Flyspeck_lib.output_filestring sphere2_ml ocaml_code;; + +loadt sphere2_ml;; + + +let break_functional_lemma thm = + let strip_all b = snd(strip_forall (concl (Nonlinear_lemma.strip_let b))) in + let (h,ts) = strip_comb (strip_all thm) in + let isdomain h = (fst(dest_const h) = "domain6") in + let namebody = if isdomain h then tl ts else ts in + (List.nth namebody 0),List.nth namebody 1;; + +let break_term x = break_functional_lemma (ASSUME x);; + +let rec real_arity ty = + let real_ty = `:real` in + if (is_vartype ty) then 0 + else if (ty = real_ty) then 1 else + let (a,b) = dest_type ty in + if not(a = "fun" && hd b = real_ty && List.length b = 2) then 0 + else 1 + real_arity (hd(tl b));; + +let mk_testing_string thm = + let native = Optimize.native_fun in + let (name,body') = break_functional_lemma thm in + let name' = fst (strip_comb name) in + let name' = fst (dest_const name') in + let cname = Lib.assocd name' native name' in + let _ = not(cname="NOT_IMPLEMENTED") or failwith "mk_testing:excluded" in + let evalname = + let s = Printf.sprintf "Sphere2.%s 6.36 4.2 4.3 4.4 4.5 4.6" name' in + let (b,s')= Flyspeck_lib.eval_command s in + let _ = b or failwith ("evalname: "^name') in + let split = Str.split (Str.regexp "[ \n]") in + let r = hd (List.rev (split s')) in + let f = float_of_string r in + let _ = not(0=Pervasives.compare nan f) or failwith "nan" in + f in + let mk_string = + Printf.sprintf " epsValue(\"%s\",%s,%12.12f);" name' cname evalname in + mk_string;; + +let mk_n_testing_string thm = + let native = Optimize.native_fun in + let (name,body') = break_functional_lemma thm in + let name' = fst (strip_comb name) in + let (name',ty) = dest_const name' in + let rarity = real_arity ty in + let nargs = rarity - 7 in + let _ = (rarity >= 8) or failwith "mk_n_testing_string" in + let args = map (fun i -> 0.04 +. (float_of_int i)/. 10.0) (1--nargs) in + let os = join_space (map (Printf.sprintf "%f") args) in + (* was interval::interval(".."). Changed 2013/08/14. *) + let sargs = join_comma (map (Printf.sprintf "interval(\"%f\")") args) in + let cname = Lib.assocd name' native name' in + let _ = not(cname="NOT_IMPLEMENTED") or failwith "mk_testing:excluded" in + let evalname = + let s = Printf.sprintf "Sphere2.%s %s 6.36 4.2 4.3 4.4 4.5 4.6" name' os in + let (b,s')= Flyspeck_lib.eval_command s in + let _ = b or failwith ("evalname: "^name') in + let split = Str.split (Str.regexp "[ \n]") in + let r = hd (List.rev (split s')) in + let f = float_of_string r in + let _ = not(0=Pervasives.compare nan f) or failwith "nan" in + f in + let mk_string = + Printf.sprintf " epsValue(\"%s\",%s(%s),%12.12f);" name' cname sargs evalname in + mk_string;; + +let all_testing_string = + let can_test = filter (can mk_testing_string) functions in + let can_test_n = filter (can mk_n_testing_string) functions in + Flyspeck_lib.join_lines ( + (map mk_testing_string can_test) @ (map mk_n_testing_string can_test_n));; + +let testing_code = + Printf.sprintf + "\nvoid selfTest() { + cout << \" -- loading test_auto test\" << endl << flush;\n + %s + cout << \" -- done loading test_auto test\" << endl << flush; }\n" + all_testing_string;; + +let not_tested = filter (fun t -> + not (can mk_testing_string t) && + not (can mk_n_testing_string t)) functions;; + +(* following is copied and adapted from optimize.hl *) + +let paren s = "("^s^")";; +let i_mk = Optimize.i_mk;; +let string_of_num' = Optimize.string_of_num';; +let dest_decimal = Optimize.dest_decimal;; + +let real_ty = `:real`;; + +let f1_ty = `:real->real`;; + +let f6_ty = `:real->real->real->real->real->real->real` ;; + + +let f7_ty = `:real->real->real->real->real->real->real->real` ;; +let f8_ty = `:real->real->real->real->real->real->real->real->real` ;; +let f9_ty = `:real->real->real->real->real->real->real->real->real->real` ;; + + +real_arity `:real->real->real->real->real` = 5;; + +let f6to6_ty = `:(real->real->real->real->real->real->real) -> + (real->real->real->real->real->real->real)`;; + +let infix6_ty = `:(real->real->real->real->real->real->real) -> + (real->real->real->real->real->real->real) -> + (real->real->real->real->real->real->real)` ;; + +let scalar6_ty = `:(real->real->real->real->real->real->real) -> + (real) -> + (real->real->real->real->real->real->real)` ;; + +let tyvar_inst = + let realty = `:real` in + let u = + setify(List.flatten (map (type_vars_in_term o concl) functions)) in + map (fun t-> (realty,t)) u;; + +type_of (inst [(`:real`,`:A`)] `x:A`);; + +let nonnative_functional_terms = + let f = map ((inst tyvar_inst)o concl) functions in + let native = map fst Optimize.native_fun in + let name t = fst(dest_const(fst(strip_comb(fst(break_term t))))) in + let m t = not (mem (name t) native) in + filter m f ;; + +let real_types = setify(map (type_of o fst o strip_comb o fst o break_term) + nonnative_functional_terms);; + +List.length real_types;; + +let terms_with_type ty = + filter (fun t -> ty = type_of(fst(strip_comb( + fst(break_term t))))) nonnative_functional_terms;; + +let terms_with_real_arity_ge8 = + filter (fun t -> 8 <= real_arity (type_of(fst(strip_comb( + fst(break_term t)))))) nonnative_functional_terms;; + +let f0_terms = (terms_with_type real_ty);; + +let f0_code = + let f0_template = Printf.sprintf + "static const interval %s (\"%20.20f\");" in + let f0_mk thm = + let (name,body') = break_functional_lemma thm in + let name' = fst (strip_comb name) in + let name' = fst (dest_const name') in + let s = Printf.sprintf "Sphere2.%s" name' in + let (b,s')= Flyspeck_lib.eval_command s in + let _ = b or failwith ("evalname: "^name') in + let split = Str.split (Str.regexp "[ \n]") in + let r = hd (List.rev (split s')) in + let warn = "// Warning: "^name'^" computed by floating point\n" in + let r' = float_of_string r in + warn^(f0_template name' r') in + Flyspeck_lib.join_lines (map (f0_mk o ASSUME) f0_terms);; + +let native_fun = Optimize.native_fun;; + +let native_infix = [ + ("add6","+"); + ("mul6","*"); + ("sub6","-"); + ("div6","/"); + ("scalar6","*"); +];; + +let native_interval = [ + ("hminus","hminus") +];; + +let f0_name = + let f0_auto = map (fst o dest_const o fst o break_term) f0_terms in + fun s -> + if (mem s f0_auto) then s + else + try (Lib.assoc s native_interval) with + Failure _ -> failwith (s^" find: real_name") ;; + +let fun_name = + let fun_auto = map (fst o dest_const o fst o strip_comb o fst o break_term) + nonnative_functional_terms in + fun s-> + try (Lib.assoc s native_fun) with + Failure _ -> + if (mem s fun_auto) then s else failwith ("fun_name not found: "^s);; + +let is_comma = + let c = "," in + fun t -> + let (t,_) = strip_comb t in + (is_const t && fst (dest_const t) = c);; + +let cpp_string_of_term = + let rec soh t = + if is_var t then fst (dest_var t) else + let (f,xs) = strip_comb t in + let ifix i = let [a;b] = xs in paren(soh a ^ " " ^ i ^ " " ^ soh b) in + let (fv,ty) = + if is_var f + then + let (fv,ty) = (dest_var f) in + let _ = warn true ("variable function name: "^fv) in + (fv,ty) + else if (is_const f) then (dest_const f) + else + failwith ("var/const expected:" ^ string_of_term f) in + match fv with + | "real_add" -> ifix "+" + | "real_mul" -> ifix "*" + | "real_div" -> ifix "/" + | "real_sub" -> ifix "-" + | "," -> ifix "," + | "\\/" -> ifix "\\/" + | "real_neg" -> let [a] = xs in "(-" ^ soh a ^ ")" + | "real_of_num" -> let [a] = xs in i_mk(soh a) + | "NUMERAL" -> let [_] = xs in string_of_num' (dest_numeral t) + | "<" -> let [a;b] = xs in paren(soh a ^ " < " ^ soh b) + | ">" -> let [a;b] = xs in paren(soh a ^ " > " ^ soh b) + | "+" -> let [a;b] = xs in paren(soh a ^ " + " ^ soh b) + | "*" -> let [a;b] = xs in paren(soh a ^ " * " ^ soh b) + | "DECIMAL" -> i_mk(string_of_num' (dest_decimal t)) + | _ -> + if (ty = real_ty) + then paren(f0_name fv) + else if (ty= infix6_ty) or (ty=scalar6_ty) + then + let op = + (try Lib.assoc fv native_infix + with Failure _ -> failwith ("parse infix6 "^fv)) in + ifix op + else + (let name = fun_name fv in + if (xs=[]) then paren name else + let p = if (List.length xs = 1 && is_comma (hd xs)) + then I else paren in + let args = p (join_comma (map soh xs)) in + paren (name^args)) in + fun t -> + try (soh t) + with Failure s -> failwith (s^" ....... "^string_of_term t);; + +(* make functions of 6 variables *) + + +let f6_code = + let f6_template = Printf.sprintf + "static const Function %s = %s;\n" in + let f6_terms = (terms_with_type f6_ty) in + let f6_auto = + let b = (fst o dest_const o fst o strip_comb o fst o break_term) in + let nat = map fst native_fun in + filter (fun t -> not (mem (b t) nat)) f6_terms in + let f6_mk tt = + let (name1,body') = break_term tt in + let name' = fst (strip_comb name1) in + let name' = fst (dest_const name') in + f6_template name' (cpp_string_of_term body') in + join_lines (map f6_mk f6_auto);; + +let fn_code = + let fn_template = Printf.sprintf + "static const Function %s(%s) { return (%s); }\n" in + let fn_arg_template = Printf.sprintf + "const interval& %s" in + let fn_terms = terms_with_real_arity_ge8 in (* (terms_with_type f7_ty)@ + (terms_with_type f8_ty) @ (terms_with_type f9_ty) in *) + let fn_auto = + let b = (fst o dest_const o fst o strip_comb o fst o break_term) in + let nat = map fst native_fun in + filter (fun t -> not (mem (b t) nat)) fn_terms in + let fn_mk tt = + let (name1,body') = break_term tt in + let (name',args) = (strip_comb name1) in + let ags = join_comma (map (fn_arg_template o fst o dest_var) args) in + let name' = fst (dest_const name') in + fn_template name' ags (cpp_string_of_term body') in + join_lines (map fn_mk fn_auto);; + +(* make 6 to 6 *) + +let f6to6_template = Printf.sprintf + "static const Function %s(const Function& %s) { + return %s; + }\n";; + +let f6to6_terms = terms_with_type f6to6_ty;; + +let f6to6_mk tt = + let (name1,body') = break_term tt in + let (name',param) = strip_comb name1 in + let _ = List.length param = 1 or + failwith ("one parameter expected "^ string_of_term tt) in + let name' = fst (dest_const name') in + let param = fst (dest_var (hd param)) in + f6to6_template name' param (cpp_string_of_term body');; + +let f6to6_code = join_lines (map f6to6_mk f6to6_terms);; + +let tmpfile = flyspeck_dir^"/../interval_code/test_auto.cc";; + +let interval_code = + f0_code ^ f6to6_code ^ f6_code ^ fn_code^ + testing_code;; + +(* based on optimize, but is enhanced with autogenerated code interval_code. *) + +let mkfile_code t s tags = + let cpp_header = Optimize.cpp_header() in + let cpp_tail = Optimize.cpp_tail() in + let isquad = Optimize.is_quad_cluster tags in + let p = if isquad then Optimize.mk_cppq_proc else Optimize.mk_cpp_proc in + Flyspeck_lib.output_filestring tmpfile + (join_lines [cpp_header;interval_code;(p t s tags);cpp_tail]);; + +(* +let testid = "9563139965 d";; + +let idq = hd(Ineq.getexact testid);; + +let [(_,tags,post)] = Optimize.preprocess_split_idq idq;; + +mkfile_code false post testid tags;; +*) + +(* + This is an enhanced version of what is in optimize.hl. + It uses mkfile_code, which adds autogenerated interval_code to what is in Optimize.mkfile_cppq. +*) + +let execute_interval ex tags s testineq = + let interval_dir = flyspeck_dir^"/../interval_code" in + let _ = mkfile_code testineq s tags in + let _ = Optimize.compile_cpp() in + let _ = (not ex) or (0= Sys.command(interval_dir^"/test_auto")) or + failwith "interval execution error" in + ();; + +let testsplit_idq ex idq = + let splits = Optimize.preprocess_split_idq idq in + map (fun (s,tags,testineq) -> execute_interval ex tags s testineq) splits;; + +let testsplit ex s = testsplit_idq ex (hd (Ineq.getexact s));; + + +(* *************************************************************************** *) +(* Prep.prep_ineqs cases. *) +(* no further processing for these. *) +(* *************************************************************************** *) + +let test_noprocessing_idq ex idq = + let (s,tags,testineq) = Optimize.idq_fields idq in + execute_interval ex tags s testineq;; + +(* let ineqs = !Prep.pre_ineqs *) + +let test_prep ineqs ex s = + let idq = filter (fun idq -> idq.idv = s) ineqs in + test_noprocessing_idq ex (hd idq);; + +let test_prep_case_split ineqs ex (s,case,t) = + let s' = Printf.sprintf "%s split(%d/%d)" s case t in +(* let _ = Sys.command("sleep 3") in *) + test_prep ineqs ex s';; + + + end;; diff --git a/text_formalization/nonlinear/break_case_exec.hl b/text_formalization/nonlinear/break_case_exec.hl new file mode 100644 index 0000000..82caa13 --- /dev/null +++ b/text_formalization/nonlinear/break_case_exec.hl @@ -0,0 +1,377 @@ + +flyspeck_needs "nonlinear/prep.hl";; +flyspeck_needs "nonlinear/scripts.hl";; + +module Break_case_exec = struct + +(* open Sphere2;; *) + + +(* PRELIMINARIES *) + +let ( MSEC_INC ) = 1000;; (* global parameter for msec target size *) +let ERROR_TOLERANCE = 0.3;; (* try for times within MSEC_INC * (1 +/- ERROR_TOLERANCE ). *) +let verbose = true;; + +(* + +The type iargs is used to record a partition of a nonlinear inequality domain into pieces. +The code in this file is used to make the pieces all take approximately MSEC_INC milliseconds +to run. The field 'a records the interval arithmetic C++ runtime in milliseconds. + +The partition is determined from the data and the original domain determined by (x,z), where +x and z are lists of real numbers giving the lower left and upper right hand corners of the domain. + +Iarg_leaf represents a domain with no subpartition. The domain is all of (x,z). + +Iarg_bisect (i,left,right) is a cut exactly in the middle along the ith variable. +The fields left and right give the further partition of the left and right sides. +For example if i=1 and (x,z) = [1.0;1.0;1.0],[3.0;3.0;3.0] then the partition goes +into (xleft,zleft) = [1.0;1.0;1.0],[3.0;2.0;3.0] and (xright,zright)=[1.0;2.0;1.0],[3.0;3.0;3.0]. + +Iarg_facet ((i,side),frac,msec,residual) breaks the domain in two unequal parts along the ith coordinate +specified by a fraction 0.0 <= frac <= 1.0. +The fraction is measured from the left if side=false, and from the right otherwise. + +For example, if i,side=1,false frac=0.25 and (x,z)= [x0;x1;x2],[z0;z1;z2], then +(xleft,rleft)= x,[z0;0.75 * x1+0.25 *z1;z2] and (xright,zright)=[x0;0.75*x1+0.25*z1,z]. +The number msec is the C++ runtime for (xleft,rleft), and residual is the recursively defined +partition on (xright,zright). + +For example, if we change side=true and keep the rest of the data the same, then +(xleft,rleft)= x,[z0;0.25 * x1+0.75 *z1;z2] and (xright,zright)=[x0;0.25*x1+0.75*z1,z]. +The number msec is now the C++ runtime for (xright,right), and residual is the recursively defined +partition on (xleft,zleft). So changing the side exchanges right and left all the way along. + + +*) + + +type ('a) iargs = Iarg_facet of ((int * bool) * float * 'a * ('a) iargs) + | Iarg_leaf of 'a + | Iarg_bisect of (int * ('a) iargs * ('a) iargs);; + +let rec string_of_iargs = function + | Iarg_leaf msec -> Printf.sprintf "\n Iarg_leaf %d" msec + | Iarg_facet ((i,b),frac,msec,a) -> Printf.sprintf "\n Iarg_facet ((%d,%s),%3.4f,%d,%s)" + i (string_of_bool b) frac msec (string_of_iargs a) + | Iarg_bisect(idx,a,b) -> Printf.sprintf "\n Iarg_bisect (%d,%s,%s)" + idx (string_of_iargs a) (string_of_iargs b);; + +let output_case s iargs = + let sfull = Printf.sprintf "\nadd_case (\"%s\",%s);;\n" s (string_of_iargs iargs) in + let oc = open_out_gen [Open_append;Open_text] 436 (fullpath "nonlinear/break_case_log_more.hl") in + (Pervasives.output_string oc (sfull); close_out oc);; + +let sprintf = Printf.sprintf;; + +Random.init 0;; + +let getprep s = hd(filter (fun t -> t.idv = s) (!Prep.prep_ineqs));; + +(* omit the quad cases for now: *) + +let idvlist = + let nonquad = filter (fun t -> not(Optimize.is_quad_cluster t.tags)) (!Prep.prep_ineqs) in + map (fun t -> t.idv) nonquad;; + +let nth = List.nth;; + +let rec cart a b = + match a with + | [] -> [] + | a::rest -> (map (fun x -> (a,x)) b) @ cart rest b;; + +let maxlist xs = List.fold_right max xs (nth xs 0);; + +let rec trim s = + let white c = mem c [' '; '\012'; '\n'; '\r'; '\t'] in + let n = String.length s in + let subs k = String.sub s k (n-1) in + if (n > 0 && white (s.[0])) then trim (subs 1) + else if (n > 1 && white (s.[n-1])) then trim (subs 0) + else s;; + +let msec_inc = float_of_int MSEC_INC;; + +let float_cache = ref (fun() -> 0.0);; + +let eval_float s = + let (b,r) = Flyspeck_lib.eval_command ~silent:false + ("float_cache := (fun () -> ("^s^"));;") in + let _ = b or (print_string (r^"\n"^s^"\n"); failwith "bad input string") in + let t= (!float_cache)() in + t;; + +(* C++ CODE GENERATION. *) + +let cpp_template_arg = sprintf " + const char svn[] = %s; + const char ineq_id[] = %s; + + int testRun(double x1[6],double z1[6]) // autogenerated code + { + // Warning: not rigorous. The rounding is off by epsilon. Use this only for experiments. + interval tx[6]={interval(x1[0],x1[0]),interval(x1[1],x1[1]),interval(x1[2],x1[2]), + interval(x1[3],x1[3]),interval(x1[4],x1[4]),interval(x1[5],x1[5]) }; + interval tz[6]={interval(z1[0],z1[0]),interval(z1[1],z1[1]),interval(z1[2],z1[2]), + interval(z1[3],z1[3]),interval(z1[4],z1[4]),interval(z1[5],z1[5])}; + domain x = domain::lowerD(tx); + domain z = domain::upperD(tz); + domain x0=x; + domain z0=z; + %s + const Function* I[%d] = {%s}; // len ... + cellOption opt; + opt.allowSharp = %d; // sharp + opt.onlyCheckDeriv1Negative = %d; // checkderiv + %s // other options. + return prove::recursiveVerifier(0,x,z,x0,z0,I,%d,opt); // len + }";; + +let mk_cpp_arg_proc t s tags = + let sharp = if mem Sharp tags then 1 else 0 in + let checkderiv = if mem Onlycheckderiv1negative tags then 1 else 0 in + let ifd b s = if b then s else "" in + let (b,f) = Optimize.widthCut tags in + let sWidth = ifd b (sprintf "\topt.widthCutoff = %8.16f;\n" f) in + let c = map Optimize.cpp_string_of_term in + let f (x,y,z) = (c x,c y,c z) in + let (aas,bbs,iis) = f (Optimize.dest_nonlin t) in + let len = length iis in + let sq = Optimize.quoted s in + let svn = (Optimize.quoted(Optimize.svn_version())) in + cpp_template_arg svn sq (Optimize.cpp_template_t "" iis) + len (Optimize.cpp_template_Fc "" len) sharp checkderiv sWidth len;; + +let mkfile_arg = + let cpp_tail = Optimize.join_lines (Optimize.load_file (flyspeck_dir^"/../interval_code/arg_tail.txt")) in + let cpp_header = Optimize.cpp_header() in + fun t s tags -> + Flyspeck_lib.output_filestring Optimize.tmpfile + (Optimize.join_lines [cpp_header;Auto_lib.interval_code;(mk_cpp_arg_proc t s tags);cpp_tail]);; + +let execute_args ex tags s testineq xlist zlist = + let x = List.nth xlist in + let z = List.nth zlist in + let args = sprintf " %f %f %f %f %f %f %f %f %f %f %f %f" + (x 0) (x 1) (x 2) (x 3) (x 4) (x 5) (z 0) (z 1) (z 2) (z 3) (z 4) (z 5) in + let interval_dir = flyspeck_dir^"/../interval_code" in + let _ = mkfile_arg testineq s tags in + let _ = Optimize.compile_cpp() in + let _ = (not ex) or (0= Sys.command(interval_dir^"/test_auto"^args)) or failwith "interval execution error" in + ();; + +let process_and_prep_args ex (s,tags,case) = + let _ = report ("process and prep args: "^s) in + let (s,tags,testineq) = (* preprocess debug *) (s,tags,case) in + let (x,y,_) = Optimize.dest_nonlin testineq in + (execute_args ex tags s testineq , x, y);; + +let rerun_timer = + let run_out = Filename.temp_file "run" ".out" in + fun xlist zlist timer -> + let x = List.nth xlist in + let z = List.nth zlist in + let args = sprintf " %f %f %f %f %f %f %f %f %f %f %f %f %f" + (x 0) (x 1) (x 2) (x 3) (x 4) (x 5) (z 0) (z 1) (z 2) (z 3) (z 4) (z 5) (float_of_int timer) in + let interval_dir = flyspeck_dir^"/../interval_code" in + let _ = (0= Sys.command(interval_dir^"/test_auto"^args^" | tee "^run_out)) or + failwith "interval execution error" in + let outs = trim (process_to_string ("grep msecs "^run_out^" | sed 's/^.*msecs=//' | sed 's/;.*$//' ")) in + (* let _ = report (":"^outs^":") in *) + let msecs = try (int_of_string (outs)) with _ -> timer in + (msecs);; + +(* DOMAIN CONSTANTS *) + +let scrub_c t = + let th = REWRITE_CONV [Sphere.h0; + GSYM Nonlinear_lemma.sol0_over_pi_EQ_const1; + ASSUME `hminus = #1.2317544220903216`; + ASSUME `pi = #3.1415926535897932385`; + ASSUME `sol0 = #0.55128559843253080794`] t in + rhs(concl th);; + +let get_constants_xy s = + let (s,tags,case) = Optimize.idq_fields (getprep s) in + let (x,y,_) = Optimize.dest_nonlin case in + (map scrub_c x,map scrub_c y);; + +let get_constants s = + let (x,y) = get_constants_xy s in x @ y;; + +let get_float_domain s = + let m = map (eval_float o Parse_ineq.ocaml_string_of_term) in + let (x,y) = get_constants_xy s in + (m x,m y);; + +(* they all check out on 2013/7/31 +find (fun s -> not(can get_float_domain s)) (snd (chop_list 650 idvlist));; +*) + + +(* interpolate along edge *) + +let index_max_width (x ,z) avoid = + let w = map (fun (xi,zi) -> zi -. xi) (zip x z) in + let avoid_filter = map (fun i -> (mem i avoid)) (0--(List.length x - 1)) in + let w' = map (fun (t,b) -> if b then 0.0 else t) (zip w avoid_filter) in + let wm = maxlist w' in + index wm w';; + +let facet_opp (i,side)= (i,not side);; + +let invert_side (_,side) (x,z) = + if side then (z,x) else (x,z);; + +let invert_interpolate (i,side) frac (x,z) = + let _ = (0.0 <= frac && frac <= 1.0) or failwith "invert_interpolate: frac out of range " in + let _ = List.length x = List.length z or failwith "invert_interpolate: length mismatch" in + let n = List.length x in + let rg = (0--(n-1)) in + let (x,z) = invert_side (i,side) (x,z) in + let c = nth x i *. (1.0-. frac) +. nth z i *. frac in + let modi (xi,j) = if (i=j) then c else xi in + let xm = map modi (zip x rg) in + let zm = map modi (zip z rg) in + (* partition will be x--zm, xm--z *) + invert_side(i,side) (xm,zm);; + +let interpolate_frac (f1,t1) (f2,t2) = + let _ = (0.0 <= f1 && f1 < f2 && f2 <= 1.0 && t1 <= msec_inc && msec_inc <= t2) + or failwith "interpolate: out of range" in + (msec_inc -. t1) *. (f2 -. f1) /. (t2 -. t1) +. f1;; + +let run_frac frac facet (x1,z1) timeout = + let (xm,zm) = invert_interpolate facet frac (x1,z1) in + let m3 = if (not(snd facet)) then rerun_timer x1 zm timeout else rerun_timer xm z1 timeout in + ((xm,zm),m3);; + +let rec recursive_find_frac facet x1 z1 (f1,t1) (f2,t2) = + (* last case in a batch may have a small t2, so dont use abs_float in the following line *) + if (t2/. msec_inc -. 1.0) < ERROR_TOLERANCE then (f2,int_of_float t2) + else if abs_float(t1/. msec_inc -. 1.0) < ERROR_TOLERANCE then (f1,int_of_float t1) + else + + let minwidth = 0.001 in + if (f2 <= f1 +. minwidth && t2 < 1.99 *. msec_inc) then (f2,int_of_float t2) + else if (f2 <= f1 +. minwidth && t1 > 0.25 *. msec_inc) then (f1,int_of_float t1) + else + let _ = f1+. minwidth <= f2 or failwith "find_frac width underflow" in + + let f3 = interpolate_frac (f1,t1) (f2,t2) in + let f3 = if (Random.int 4 = 0 && t2 > 1.9*. msec_inc) then + (f1+.f2)/. 2.0 +. Random.float (f2 -. f1) /. 2.0 else f3 in + let f3 = if (Random.int 3 = 0 && t1 < 0.5*. msec_inc) then + f1 +. Random.float (f2 -. f1)/. 2.0 else f3 in + let _ = (f1 <= f3 && f3 <= f2) or failwith "recursive_find_frac: out of range" in + let ((xm,zm),m3) = run_frac f3 facet (x1,z1) (2 * MSEC_INC) in + let _ = if verbose then report (sprintf "recursing fracs %3.3f,%3.3f,%3.3f msecs %d,%d,%d" f1 f3 f2 (int_of_float t1) m3 (int_of_float t2)) in + + let t3 = float_of_int m3 in + if abs_float(t3/. msec_inc -. 1.0) < ERROR_TOLERANCE then (f3,m3) + else + let ((f1',t1'),(f2',t2')) = if (t3 <= msec_inc) then ((f3,t3),(f2,t2)) else ((f1,t1),(f3,t3)) in + recursive_find_frac facet x1 z1 (f1',t1') (f2',t2');; + +(* DEBUG *) + +let rec pass_time = function + Iarg_bisect (_,a,b) -> pass_time a + pass_time b + | Iarg_leaf msec -> msec + | Iarg_facet (_,_,msec,c) -> msec + pass_time c;; + +let rec recheck_pass timeout domain iarg = match iarg with + | Iarg_leaf msec -> + let (x,z) = domain in + let msec' = rerun_timer x z timeout in + Iarg_leaf (msec,msec') + | Iarg_facet(facet,frac,msec,b) -> + let (x,z) = domain in + let (xm,zm) = invert_interpolate facet frac domain in + let residual = if (not(snd facet)) then (xm,z) else (x,zm) in + let (_,msec') = run_frac frac facet domain timeout in + Iarg_facet(facet,frac,(msec,msec'), recheck_pass timeout residual b) + | Iarg_bisect(idx,a,b) -> + let (x,z) = domain in + let facet = (idx,false) in + let (xm,zm) = invert_interpolate facet 0.5 domain in + let partA,partB = ((x,zm),(xm,z)) in + Iarg_bisect(idx,recheck_pass timeout partA a,recheck_pass timeout partB b);; + + +(* MAIN PROCEDURES *) + +let initial_msec = + let ft_sec = Scripts.finalize Scripts.finished_times in + let ft_msec = Scripts.finalize Scripts.finished_times_msecs in + fun s -> + try assoc s ft_msec + with _ -> 1000 * (assoc s ft_sec );; + +let initialize s = + let msec = initial_msec s in + let (x1,z1)=get_float_domain s in + let stc = Optimize.idq_fields (getprep s) in + let (compile,_,_) = process_and_prep_args false stc in + let _ = compile x1 z1 in + (x1,z1,msec);; + +let rec pass_revised avoid ((x,z),msec) = + let left = false in + let idx = index_max_width (x,z) avoid in + let fi = float_of_int in + let timeout = 2 * MSEC_INC in + let (s0,s1,s2) = (0,1,2) in + let facet = (idx,left) in + let sz m = + let t = fi m /. fi MSEC_INC in + if t < 1.0 -. ERROR_TOLERANCE then s0 else if t < 1.999 then s1 else s2 in + if msec < timeout then + let _ = if verbose then report "FOUND leaf..." in + (Iarg_leaf msec) + else + let (_,m3A) = run_frac 0.5 facet (x,z) timeout in + let (_,m3B) = run_frac 0.5 (facet_opp facet) (x,z) timeout in + let (m3min,facet,swap) = if m3A<=m3B then (m3A,facet,false) else (m3B,facet_opp facet,true) in + let smin = sz m3min in + if (smin=s2) then + let (xm,zm) = invert_interpolate (idx,left) 0.5 (x,z) in + let partA,partB = ((x,zm),(xm,z)) in + let _ = if verbose then report "FOUND bisection..." in + Iarg_bisect (idx,pass_revised [] (partA,m3A),pass_revised [] (partB,m3B)) + else if (smin = s1) then + let (xm,zm) = invert_interpolate facet 0.5 (x,z) in + let residual= if (snd facet=left) then (xm,z) else (x,zm) in + let m3max = if swap then m3A else m3B in + let _ = if verbose then report "FOUND 0.5 facet..." in + Iarg_facet(facet,0.5,m3min,pass_revised [] (residual,m3max)) + else (* smin=s0 *) + try ( + let (fracC,mC) = recursive_find_frac facet x z (0.5,fi m3min) (1.0,fi msec) in + let (xm,zm) = invert_interpolate facet fracC (x,z) in + let residual= if (snd facet=left) then (xm,z) else (x,zm) in + let mD = rerun_timer (fst residual) (snd residual) timeout in + let _ = if verbose then report (sprintf "FOUND %3.3f,%d facet..." fracC mC) in + Iarg_facet (facet,fracC,mC,pass_revised [] (residual,mD))) + with Failure fail -> + let _ = report ("failure "^fail) in + pass_revised (idx::avoid) ((x,z),msec);; + +let run_one save s = + let (x1,z1,msec1) = initialize s in + let iarg = (pass_revised [] ((x1,z1),msec1)) in + let _ = if (save) then output_case s iarg in + iarg;; + +let run_all_over2sec save = + let preptimes = map (fun s -> try s,initial_msec s with _ -> failwith s) (idvlist) in + let over2sec = (sort (fun (_,s) (_,t) -> s < t) (filter (fun (s,t) -> t > 2000) preptimes)) in + let over2 = map fst over2sec in + let alldata = map (fun s -> try s,run_one save s with Failure msg -> report s; failwith msg) over2 in + alldata;; + + + +end;; diff --git a/text_formalization/nonlinear/break_case_log.hl b/text_formalization/nonlinear/break_case_log.hl new file mode 100644 index 0000000..b109c67 --- /dev/null +++ b/text_formalization/nonlinear/break_case_log.hl @@ -0,0 +1,29271 @@ +(* auto generated data. See explanation of the data structure + in the comments of break_case_exec.hl. *) + + +(* START HERE *) + +module Break_case_log = struct + + +add_case ("8657368829", + Iarg_facet ((0,true),0.5000,716, + Iarg_leaf 1311));; + +add_case ("GLFVCVK4 2477216213 split(51/64)", + Iarg_facet ((2,true),0.6625,908, + Iarg_leaf 1253));; + +add_case ("GLFVCVK4 2477216213 split(57/64)", + Iarg_facet ((3,true),0.6389,815, + Iarg_leaf 1320));; + +add_case ("TSKAJXY-XLLIPLS", + Iarg_facet ((0,false),0.9501,1146, + Iarg_leaf 1041));; + +add_case ("ZTGIJCF4 0 1 0 1 1821661595 split(6/8)", + Iarg_facet ((1,true),0.5000,720, + Iarg_leaf 1543));; + +add_case ("ZTGIJCF4 1 1 0 0 1821661595 split(5/8)", + Iarg_facet ((1,true),0.5000,703, + Iarg_leaf 1617));; + +add_case ("1248932983", + Iarg_facet ((3,true),0.6418,774, + Iarg_leaf 1372));; + +add_case ("ZTGIJCF4 0 1 1 0 1821661595 split(6/8)", + Iarg_facet ((1,true),0.5999,854, + Iarg_leaf 1284));; + +add_case ("5298513205", + Iarg_facet ((3,true),0.6110,817, + Iarg_leaf 1474));; + +add_case ("QITNPEA1 1 2 9063653052 A split(2/4)", + Iarg_facet ((1,true),0.6008,837, + Iarg_leaf 1464));; + +add_case ("ZTGIJCF4 1 0 1 0 1821661595 split(5/8)", + Iarg_facet ((1,true),0.6227,923, + Iarg_leaf 1396));; + +add_case ("ZTGIJCF4 1 0 1 0 1821661595 split(6/8)", + Iarg_facet ((1,true),0.6160,889, + Iarg_leaf 1464));; + +add_case ("GLFVCVK4 2477216213 split(43/64)", + Iarg_facet ((1,true),0.6335,814, + Iarg_leaf 1326));; + +add_case ("ZTGIJCF4 1 0 1 1 1821661595 split(15/16)", + Iarg_facet ((1,true),0.6288,866, + Iarg_leaf 1530));; + +add_case ("9641946727", + Iarg_facet ((1,true),0.5000,958, + Iarg_leaf 1227));; + +add_case ("GLFVCVK4 2477216213 split(58/64)", + Iarg_facet ((3,true),0.6266,792, + Iarg_leaf 1445));; + +add_case ("OXLZLEZ 6346351218 4 31", + Iarg_facet ((1,true),0.6106,815, + Iarg_leaf 1577));; + +add_case ("OXLZLEZ 6346351218 2 31", + Iarg_facet ((1,true),0.6099,816, + Iarg_leaf 1574));; + +add_case ("QZECFIC wt1 split(0/2)", + Iarg_facet ((4,true),0.8596,805, + Iarg_leaf 1296));; + +add_case ("7743522046", + Iarg_facet ((3,false),0.5000,1101, + Iarg_leaf 1286));; + +add_case ("2320951108", + Iarg_facet ((0,true),0.5000,753, + Iarg_leaf 1820));; + +add_case ("ZTGIJCF4 1 0 0 1 1821661595 split(1/8)", + Iarg_facet ((1,true),0.6062,782, + Iarg_leaf 1769));; + +add_case ("ZTGIJCF4 1 0 0 1 1821661595 split(2/8)", + Iarg_facet ((1,true),0.6045,752, + Iarg_leaf 1798));; + +add_case ("9414951439", + Iarg_facet ((0,true),0.5000,753, + Iarg_leaf 1562));; + +add_case ("OXLZLEZ 6346351218 1 43", + Iarg_facet ((1,true),0.7753,1132, + Iarg_leaf 1516));; + +add_case ("5943578801", + Iarg_facet ((0,true),0.5000,999, + Iarg_leaf 1225));; + +add_case ("OXLZLEZ 6346351218 3 29", + Iarg_facet ((1,true),0.5000,748, + Iarg_facet ((2,true),0.6647,758, + Iarg_leaf 1247)));; + +add_case ("9185711902", + Iarg_facet ((3,false),0.5839,823, + Iarg_facet ((4,true),0.7158,810, + Iarg_leaf 1245)));; + +add_case ("OXLZLEZ 6346351218 1 7", + Iarg_facet ((1,true),0.6487,841, + Iarg_leaf 1862));; + +add_case ("3425739813", + Iarg_facet ((0,true),0.5000,1061, + Iarg_leaf 1194));; + +add_case ("9291937879", + Iarg_facet ((0,true),0.5000,978, + Iarg_leaf 1804));; + +add_case ("9096461391", + Iarg_facet ((4,true),0.5917,786, + Iarg_leaf 1789));; + +add_case ("QITNPEA1 1 1 9063653052 A split(7/8)", + Iarg_facet ((1,true),0.6154,919, + Iarg_leaf 1880));; + +add_case ("GLFVCVK4 2477216213 y4crit split(7/8)", + Iarg_facet ((2,true),0.6209,920, + Iarg_leaf 1847));; + +add_case ("3665919985", + Iarg_facet ((0,true),0.5000,1234, + Iarg_leaf 1554));; + +add_case ("3137600529", + Iarg_facet ((1,true),0.5000,964, + Iarg_leaf 1672));; + +add_case ("ZTGIJCF4 0 0 1 1 1821661595 split(3/8)", + Iarg_facet ((1,true),0.5000,966, + Iarg_leaf 1942));; + +add_case ("OXLZLEZ 6346351218 1 40", + Iarg_facet ((1,true),0.6570,914, + Iarg_leaf 1991));; + +add_case ("7718591733", + Iarg_facet ((0,true),0.5000,926, + Iarg_leaf 1692));; + +add_case ("7997589055", + Iarg_facet ((0,true),0.5000,736, + Iarg_facet ((1,true),0.5000,869, + Iarg_leaf 1437)));; + +add_case ("9922699028", + Iarg_facet ((0,true),0.5000,864, + Iarg_leaf 1550));; + +add_case ("ZTGIJCF4 0 1 0 1 1821661595 split(3/8)", + Iarg_facet ((1,true),0.5000,955, + Iarg_facet ((2,true),0.6582,889, + Iarg_leaf 1328)));; + +add_case ("QITNPEA1 2 2 9063653052 A split(1/2)", + Iarg_facet ((1,true),0.5000,844, + Iarg_facet ((4,true),0.7652,1250, + Iarg_leaf 1216)));; + +add_case ("ZTGIJCF4 0 1 1 0 1821661595 split(3/8)", + Iarg_facet ((1,true),0.5000,811, + Iarg_facet ((2,true),0.6398,980, + Iarg_leaf 1307)));; + +add_case ("OXLZLEZ 6346351218 2 21", + Iarg_facet ((1,true),0.5000,861, + Iarg_facet ((2,true),0.6670,876, + Iarg_leaf 1467)));; + +add_case ("9563139965 f", + Iarg_facet ((0,true),0.5000,1341, + Iarg_leaf 1877));; + +add_case ("OXLZLEZ 6346351218 4 27", + Iarg_facet ((1,true),0.5000,842, + Iarg_facet ((2,true),0.6474,832, + Iarg_leaf 1580)));; + +add_case ("OXLZLEZ 6346351218 4 20", + Iarg_facet ((1,true),0.5000,867, + Iarg_facet ((2,true),0.6364,828, + Iarg_leaf 1563)));; + +add_case ("OXLZLEZ 6346351218 2 20", + Iarg_facet ((1,true),0.5000,867, + Iarg_facet ((2,true),0.6361,826, + Iarg_leaf 1573)));; + +add_case ("ZTGIJCF4 1 1 0 0 1821661595 split(3/8)", + Iarg_facet ((1,true),0.5000,1013, + Iarg_facet ((4,true),0.6283,923, + Iarg_leaf 1358)));; + +add_case ("ZTGIJCF4 1 0 0 1 1821661595 split(5/8)", + Iarg_facet ((1,true),0.5000,767, + Iarg_facet ((3,true),0.6879,750, + Iarg_leaf 1725)));; + +add_case ("OXLZLEZ 6346351218 1 26", + Iarg_facet ((1,true),0.5803,709, + Iarg_facet ((2,true),0.7808,805, + Iarg_leaf 1617)));; + +add_case ("OXLZLEZ 6346351218 2 28", + Iarg_facet ((1,true),0.5000,835, + Iarg_facet ((2,true),0.6439,801, + Iarg_leaf 1669)));; + +add_case ("GLFVCVK4 2477216213 split(3/64)", + Iarg_facet ((1,true),0.5000,1118, + Iarg_facet ((2,true),0.5000,743, + Iarg_leaf 1494)));; + +add_case ("OXLZLEZ 6346351218 2 19", + Iarg_facet ((1,true),0.5000,920, + Iarg_facet ((2,true),0.6266,861, + Iarg_leaf 1746)));; + +add_case ("OXLZLEZ 6346351218 3 43", + Iarg_facet ((1,true),0.5000,923, + Iarg_facet ((2,true),0.6243,858, + Iarg_leaf 1762)));; + +add_case ("ZTGIJCF4 1 0 0 1 1821661595 split(6/8)", + Iarg_facet ((1,true),0.5000,787, + Iarg_facet ((3,true),0.7137,837, + Iarg_leaf 1778)));; + +add_case ("OXLZLEZ 6346351218 4 28", + Iarg_facet ((1,true),0.5000,937, + Iarg_facet ((2,true),0.6310,863, + Iarg_leaf 1754)));; + +add_case ("GLFVCVK4 2477216213 split(24/64)", + Iarg_facet ((3,true),0.5000,1307, + Iarg_facet ((4,true),0.5000,764, + Iarg_leaf 1516)));; + +add_case ("OXLZLEZ 6346351218 4 41", + Iarg_facet ((1,true),0.5000,907, + Iarg_facet ((2,true),0.6296,883, + Iarg_leaf 1813)));; + +add_case ("OXLZLEZ 6346351218 2 42", + Iarg_facet ((1,true),0.5000,942, + Iarg_facet ((2,true),0.6227,887, + Iarg_facet ((4,true),0.7771,788, + Iarg_leaf 1200))));; + +add_case ("OXLZLEZ 6346351218 3 17", + Iarg_facet ((1,true),0.5000,942, + Iarg_facet ((2,true),0.6241,887, + Iarg_facet ((4,true),0.7768,789, + Iarg_leaf 1200))));; + +add_case ("OXLZLEZ 6346351218 1 18", + Iarg_facet ((1,true),0.5000,711, + Iarg_facet ((2,true),0.6658,773, + Iarg_facet ((4,true),0.8164,708, + Iarg_leaf 1467))));; + +add_case ("OXLZLEZ 6346351218 1 17", + Iarg_facet ((1,true),0.5000,713, + Iarg_facet ((2,true),0.6664,766, + Iarg_facet ((4,true),0.8236,724, + Iarg_leaf 1419))));; + +add_case ("OXLZLEZ 6346351218 1 16", + Iarg_facet ((1,true),0.5000,712, + Iarg_facet ((2,true),0.6664,768, + Iarg_facet ((4,true),0.8432,792, + Iarg_leaf 1492))));; + +add_case ("QITNPEA1 1 2 9063653052 A split(3/4)", + Iarg_facet ((1,true),0.5000,1094, + Iarg_facet ((4,true),0.5000,810, + Iarg_facet ((5,true),0.6506,826, + Iarg_leaf 1133))));; + +add_case ("GLFVCVK4 2477216213 split(17/64)", + Iarg_facet ((2,true),0.5000,1146, + Iarg_facet ((3,true),0.5000,781, + Iarg_leaf 1757)));; + +add_case ("OXLZLEZ 6346351218 1 25", + Iarg_facet ((1,true),0.5648,740, + Iarg_facet ((2,true),0.7816,896, + Iarg_facet ((4,true),0.8876,771, + Iarg_leaf 1365))));; + +add_case ("OXLZLEZ 6346351218 3 18", + Iarg_facet ((1,true),0.5000,1009, + Iarg_facet ((2,true),0.5000,718, + Iarg_facet ((4,true),0.7025,793, + Iarg_leaf 1508))));; + +add_case ("OXLZLEZ 6346351218 4 42", + Iarg_facet ((1,true),0.5000,1010, + Iarg_facet ((2,true),0.5000,716, + Iarg_facet ((4,true),0.7292,859, + Iarg_leaf 1455))));; + +add_case ("ZTGIJCF4 1 0 0 0 1821661595 split(0/4)", + Iarg_facet ((1,true),0.5000,1092, + Iarg_facet ((3,true),0.6348,843, + Iarg_facet ((4,true),0.6198,851, + Iarg_leaf 1216))));; + +add_case ("ZTGIJCF4 0 0 1 0 1821661595 split(0/4)", + Iarg_facet ((1,true),0.5000,1263, + Iarg_facet ((2,true),0.5000,1025, + Iarg_leaf 1919)));; + +add_case ("ZTGIJCF4 0 0 0 1 1821661595 split(0/4)", + Iarg_facet ((1,true),0.5000,1460, + Iarg_facet ((2,true),0.5000,850, + Iarg_leaf 1956)));; + +add_case ("7819193535", + Iarg_facet ((1,true),0.5000,1562, + Iarg_facet ((2,true),0.5000,1164, + Iarg_leaf 1200)));; + +add_case ("2151506422", + Iarg_facet ((3,true),0.5000,1624, + Iarg_facet ((4,true),0.6673,727, + Iarg_leaf 1663)));; + +add_case ("8384511215", + Iarg_facet ((0,true),0.5000,1408, + Iarg_leaf 1996));; + +add_case ("ZTGIJCF4 0 0 1 1 1821661595 split(7/8)", + Iarg_facet ((1,true),0.5000,1275, + Iarg_facet ((2,true),0.5000,937, + Iarg_leaf 1889)));; + +add_case ("2445657182", + Iarg_facet ((0,true),0.5000,1370, + Iarg_facet ((1,true),0.6157,904, + Iarg_leaf 1513)));; + +add_case ("5026777310a", + Iarg_facet ((0,true),0.5000,1462, + Iarg_facet ((1,true),0.5000,1128, + Iarg_leaf 1772)));; + +add_case ("1948775510", + Iarg_facet ((0,true),0.8264,921, + Iarg_facet ((1,true),0.8211,1052, + Iarg_facet ((2,true),0.7263,881, + Iarg_leaf 1848))));; + +add_case ("7291663656", + Iarg_facet ((0,true),0.5000,1211, + Iarg_facet ((1,true),0.5000,1024, + Iarg_leaf 1507)));; + +add_case ("QITNPEA1 1 0 9063653052 A split(0/4)", + Iarg_facet ((1,true),0.5000,1118, + Iarg_facet ((3,true),0.5000,853, + Iarg_facet ((4,true),0.5000,809, + Iarg_facet ((5,true),0.7678,771, + Iarg_leaf 1269)))));; + +add_case ("ZTGIJCF4 0 1 0 0 1821661595 split(0/4)", + Iarg_facet ((1,true),0.5000,1358, + Iarg_facet ((2,true),0.5000,1008, + Iarg_facet ((4,true),0.5000,716, + Iarg_leaf 1704))));; + +add_case ("5760733457", + Iarg_facet ((0,true),0.5000,1421, + Iarg_facet ((1,true),0.5000,703, + Iarg_facet ((2,true),0.6426,801, + Iarg_leaf 1415))));; + +add_case ("5202826650 a", + Iarg_facet ((3,true),0.7453,882, + Iarg_facet ((1,false),0.5000,1110, + Iarg_facet ((2,false),0.5000,761, + Iarg_leaf 1948))));; + +add_case ("9995621667", + Iarg_bisect (0, + Iarg_facet ((1,true),0.7051,735, + Iarg_leaf 1453), + Iarg_facet ((1,true),0.7614,1148, + Iarg_leaf 1066)));; + +add_case ("6725783616", + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,926, + Iarg_leaf 1489), + Iarg_facet ((1,true),0.6395,890, + Iarg_leaf 1280)));; + +add_case ("QITNPEA 5400790175 a split(0/4)", + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,707, + Iarg_facet ((4,true),0.6556,829, + Iarg_leaf 1477)), + Iarg_facet ((2,true),0.6857,823, + Iarg_leaf 1429)));; + +add_case ("ZTGIJCF4 1 0 1 0 1821661595 split(3/8)", + Iarg_facet ((1,true),0.5000,1649, + Iarg_facet ((3,true),0.5000,922, + Iarg_facet ((5,true),0.5000,803, + Iarg_leaf 1897))));; + +add_case ("GLFVCVK4 2477216213 split(20/64)", + Iarg_facet ((2,true),0.5000,1491, + Iarg_facet ((4,true),0.5000,782, + Iarg_facet ((5,true),0.6033,998, + Iarg_facet ((1,true),0.5000,735, + Iarg_leaf 1291)))));; + +add_case ("181212899 1", + Iarg_facet ((0,true),0.5000,1801, + Iarg_facet ((1,true),0.6172,953, + Iarg_leaf 1943)));; + +add_case ("181212899 0", + Iarg_facet ((0,true),0.5000,1887, + Iarg_facet ((1,true),0.5000,918, + Iarg_leaf 1959)));; + +add_case ("MKFKQWU halfwt", + Iarg_facet ((2,true),0.5000,1100, + Iarg_facet ((4,true),0.5000,1316, + Iarg_facet ((5,true),0.7331,983, + Iarg_leaf 1940))));; + +add_case ("5000076558", + Iarg_facet ((0,true),0.5000,1455, + Iarg_facet ((1,true),0.5000,1476, + Iarg_facet ((2,true),0.7344,844, + Iarg_leaf 1235))));; + +add_case ("3526497018", + Iarg_facet ((0,true),0.5000,1282, + Iarg_facet ((1,true),0.5000,1566, + Iarg_facet ((2,true),0.5000,900, + Iarg_leaf 1306))));; + +add_case ("OXLZLEZ 6346351218 2 41", + Iarg_facet ((1,true),0.5000,1648, + Iarg_facet ((2,true),0.5000,1159, + Iarg_facet ((4,true),0.5000,788, + Iarg_facet ((5,true),0.6407,829, + Iarg_facet ((1,true),0.6744,772, + Iarg_leaf 1272))))));; + +add_case ("OXLZLEZ 6346351218 2 27", + Iarg_facet ((1,true),0.5000,1475, + Iarg_facet ((2,true),0.5000,1063, + Iarg_facet ((4,true),0.6248,971, + Iarg_facet ((5,true),0.8454,1147, + Iarg_leaf 1183)))));; + +add_case ("OXLZLEZ 6346351218 3 26", + Iarg_facet ((1,true),0.5000,1625, + Iarg_facet ((2,true),0.5000,1171, + Iarg_facet ((4,true),0.5000,750, + Iarg_facet ((5,true),0.6617,813, + Iarg_leaf 1994)))));; + +add_case ("GLFVCVK4 2477216213 split(5/64)", + Iarg_facet ((1,true),0.5000,1313, + Iarg_facet ((2,true),0.5000,792, + Iarg_facet ((4,true),0.5000,752, + Iarg_facet ((3,false),0.5000,1099, + Iarg_leaf 1131)))));; + +add_case ("GLFVCVK4 2477216213 split(6/64)", + Iarg_facet ((1,true),0.5000,1143, + Iarg_facet ((2,true),0.5000,948, + Iarg_facet ((5,true),0.5000,734, + Iarg_facet ((3,false),0.5000,1093, + Iarg_leaf 1132)))));; + +add_case ("GLFVCVK4 2477216213 split(10/64)", + Iarg_facet ((1,true),0.5000,1569, + Iarg_facet ((3,true),0.5000,1024, + Iarg_facet ((5,true),0.5000,729, + Iarg_leaf 1925))));; + +add_case ("GLFVCVK4 2477216213 split(12/64)", + Iarg_facet ((1,true),0.5000,1535, + Iarg_facet ((4,true),0.5000,968, + Iarg_facet ((5,true),0.6516,900, + Iarg_facet ((2,true),0.5000,765, + Iarg_leaf 1438)))));; + +add_case ("GLFVCVK4 2477216213 split(35/64)", + Iarg_facet ((1,true),0.5000,1734, + Iarg_facet ((2,true),0.5000,1224, + Iarg_facet ((3,true),0.5000,906, + Iarg_leaf 1652))));; + +add_case ("GLFVCVK4 2477216213 split(56/64)", + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1228, + Iarg_facet ((5,true),0.5000,812, + Iarg_leaf 1759)), + Iarg_facet ((4,true),0.6408,886, + Iarg_leaf 1004)));; + +add_case ("ZTGIJCF4 0 1 1 0 1821661595 split(7/8)", + Iarg_facet ((1,true),0.5000,1558, + Iarg_facet ((2,true),0.5000,1343, + Iarg_facet ((5,true),0.5000,923, + Iarg_facet ((3,true),0.5000,1110, + Iarg_leaf 1415)))));; + +add_case ("ZTGIJCF4 0 0 0 1 1821661595 split(2/4)", + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1272, + Iarg_facet ((3,true),0.5000,881, + Iarg_facet ((4,true),0.6608,838, + Iarg_leaf 1680))), + Iarg_facet ((2,true),0.6385,867, + Iarg_leaf 1344)));; + +add_case ("2563100177", + Iarg_facet ((0,true),0.5000,1900, + Iarg_facet ((1,true),0.5000,985, + Iarg_facet ((2,true),0.5000,826, + Iarg_leaf 1947))));; + +add_case ("OXLZLEZ 6346351218 1 44", + Iarg_facet ((1,true),0.5000,1777, + Iarg_facet ((2,true),0.5000,1258, + Iarg_facet ((4,true),0.5000,898, + Iarg_facet ((5,true),0.6416,946, + Iarg_facet ((1,true),0.6871,922, + Iarg_leaf 1445))))));; + +add_case ("OXLZLEZ 6346351218 3 40", + Iarg_facet ((1,true),0.5000,1823, + Iarg_facet ((2,true),0.5000,1329, + Iarg_facet ((4,true),0.5000,854, + Iarg_facet ((5,true),0.6293,891, + Iarg_facet ((1,true),0.6549,828, + Iarg_leaf 1436))))));; + +add_case ("OXLZLEZ 6346351218 3 16", + Iarg_facet ((1,true),0.5000,1824, + Iarg_facet ((2,true),0.5000,1328, + Iarg_facet ((4,true),0.5000,858, + Iarg_facet ((5,true),0.6353,906, + Iarg_facet ((1,true),0.6578,834, + Iarg_leaf 1425))))));; + +add_case ("ZTGIJCF4 1 1 0 0 1821661595 split(7/8)", + Iarg_facet ((1,true),0.5000,1962, + Iarg_facet ((4,true),0.5000,1407, + Iarg_facet ((5,true),0.5000,813, + Iarg_facet ((2,true),0.5000,1235, + Iarg_leaf 1664)))));; + +add_case ("ZTGIJCF4 1 0 0 0 1821661595 split(2/4)", + Iarg_facet ((1,true),0.5000,1775, + Iarg_facet ((3,true),0.5000,1280, + Iarg_facet ((4,true),0.5000,1263, + Iarg_facet ((5,true),0.6369,890, + Iarg_leaf 1679)))));; + +add_case ("ZTGIJCF4 0 1 0 1 1821661595 split(7/8)", + Iarg_facet ((1,true),0.5000,1987, + Iarg_facet ((2,true),0.5000,1140, + Iarg_facet ((4,true),0.5000,1010, + Iarg_facet ((3,true),0.5000,1195, + Iarg_leaf 1478)))));; + +add_case ("ZTGIJCF4 0 0 1 0 1821661595 split(2/4)", + Iarg_facet ((1,true),0.5000,1927, + Iarg_facet ((2,true),0.5000,1674, + Iarg_facet ((3,true),0.5000,853, + Iarg_facet ((5,true),0.6631,802, + Iarg_leaf 1643)))));; + +add_case ("8082208587", + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1696, + Iarg_facet ((2,true),0.5000,1282, + Iarg_leaf 1777)), + Iarg_facet ((1,true),0.5000,941, + Iarg_facet ((2,true),0.5000,713, + Iarg_leaf 1328))));; + +add_case ("9756015945", + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1892, + Iarg_facet ((2,true),0.6274,872, + Iarg_leaf 1934)), + Iarg_facet ((1,true),0.5000,842, + Iarg_leaf 1314)));; + +add_case ("3318775219", + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1147, + Iarg_facet ((2,true),0.5000,883, + Iarg_facet ((4,true),0.6456,847, + Iarg_leaf 1444))), + Iarg_facet ((1,true),0.5000,1123, + Iarg_facet ((2,true),0.5000,821, + Iarg_leaf 1600))));; + +add_case ("4240815464 a reduced", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,787, + Iarg_leaf 1319), + Iarg_facet ((2,true),0.5000,929, + Iarg_leaf 1862)), + Iarg_facet ((1,false),0.5000,1079, + Iarg_leaf 1294)));; + +add_case ("4652969746 2", + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1673, + Iarg_facet ((2,true),0.5000,1078, + Iarg_facet ((4,true),0.6606,777, + Iarg_leaf 1196))), + Iarg_facet ((1,true),0.5000,976, + Iarg_leaf 1908)));; + +add_case ("OXLZLEZ 6346351218 1 31", + Iarg_facet ((1,true),0.5000,1465, + Iarg_facet ((2,true),0.5000,1022, + Iarg_facet ((4,true),0.5000,708, + Iarg_facet ((5,true),0.6734,816, + Iarg_facet ((1,true),0.6768,784, + Iarg_facet ((2,true),0.8750,1047, + Iarg_leaf 1187)))))));; + +add_case ("OXLZLEZ 6346351218 3 25", + Iarg_facet ((1,true),0.5000,1697, + Iarg_facet ((2,true),0.5000,1221, + Iarg_facet ((4,true),0.5000,797, + Iarg_facet ((5,true),0.6375,810, + Iarg_facet ((1,true),0.6676,786, + Iarg_leaf 1427))))));; + +add_case ("GLFVCVK4 2477216213 y4subcrit split(0/4)", + Iarg_facet ((2,true),0.5000,1100, + Iarg_facet ((3,true),0.5000,820, + Iarg_facet ((4,true),0.6494,814, + Iarg_leaf 1815))));; + +add_case ("GLFVCVK4 2477216213 split(49/64)", + Iarg_facet ((2,true),0.5000,1997, + Iarg_facet ((3,true),0.5000,1593, + Iarg_facet ((4,true),0.5000,884, + Iarg_facet ((1,false),0.5000,1512, + Iarg_leaf 1556)))));; + +add_case ("5405130650", + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1349, + Iarg_facet ((2,true),0.5000,1312, + Iarg_leaf 1985)), + Iarg_facet ((1,true),0.5000,761, + Iarg_facet ((2,true),0.5000,822, + Iarg_leaf 1764))));; + +add_case ("QITNPEA1 1 0 9063653052 A split(1/4)", + Iarg_facet ((1,true),0.5000,1928, + Iarg_facet ((3,true),0.5000,1424, + Iarg_facet ((4,true),0.5000,1385, + Iarg_facet ((5,true),0.5000,1028, + Iarg_facet ((1,true),0.6454,882, + Iarg_leaf 1939))))));; + +add_case ("BIXPCGW 7274157868 a split(1/2)", + Iarg_facet ((1,true),0.7846,779, + Iarg_facet ((2,true),0.8514,747, + Iarg_facet ((4,true),0.8970,1200, + Iarg_facet ((5,true),0.9055,1147, + Iarg_facet ((3,false),0.7783,985, + Iarg_facet ((0,false),0.6160,1151, + Iarg_facet ((1,true),0.6813,763, + Iarg_leaf 1339))))))));; + +add_case ("QITNPEA1 1 0 9063653052 A split(2/4)", + Iarg_facet ((1,true),0.5000,1983, + Iarg_facet ((3,true),0.5000,1935, + Iarg_facet ((4,true),0.5000,1385, + Iarg_facet ((5,true),0.6291,924, + Iarg_facet ((1,true),0.6536,760, + Iarg_leaf 1747))))));; + +add_case ("QITNPEA1 2 0 9063653052 A split(0/2)", + Iarg_bisect (1, + Iarg_facet ((3,true),0.5000,1550, + Iarg_facet ((4,true),0.5000,1538, + Iarg_facet ((5,true),0.5000,1401, + Iarg_facet ((1,true),0.5000,700, + Iarg_leaf 1988)))), + Iarg_facet ((3,true),0.6543,893, + Iarg_leaf 1223)));; + +add_case ("4047599236", + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1635, + Iarg_facet ((2,true),0.5000,1266, + Iarg_leaf 1809)), + Iarg_facet ((1,true),0.5000,922, + Iarg_leaf 1699)));; + +add_case ("3862621143 front", + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1228, + Iarg_facet ((2,true),0.5000,756, + Iarg_leaf 1570)), + Iarg_facet ((1,true),0.5000,1180, + Iarg_facet ((2,true),0.5000,746, + Iarg_leaf 1800))));; + +add_case ("GLFVCVK4a 8328676778 split(0/4)", + Iarg_facet ((1,true),0.5000,1761, + Iarg_facet ((2,true),0.5000,1346, + Iarg_facet ((4,true),0.5000,1037, + Iarg_facet ((5,true),0.5000,792, + Iarg_facet ((1,true),0.5000,920, + Iarg_facet ((2,true),0.6296,959, + Iarg_leaf 1959)))))));; + +add_case ("ZTGIJCF4 1 0 1 0 1821661595 split(7/8)", + Iarg_bisect (1, + Iarg_facet ((3,true),0.5000,1535, + Iarg_facet ((5,true),0.5000,1353, + Iarg_facet ((2,true),0.5000,1950, + Iarg_facet ((4,true),0.5000,932, + Iarg_leaf 1065)))), + Iarg_facet ((3,true),0.6521,984, + Iarg_leaf 1512)));; + +add_case ("6601228004", + Iarg_facet ((0,false),0.8224,774, + Iarg_facet ((1,true),0.6333,795, + Iarg_facet ((2,true),0.6468,910, + Iarg_facet ((3,false),0.5000,959, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1020, + Iarg_facet ((3,false),0.5000,772, + Iarg_leaf 1301)), + Iarg_facet ((2,true),0.5000,736, + Iarg_facet ((3,false),0.5936,959, + Iarg_leaf 1026))))))));; + +add_case ("4750199435", + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1273, + Iarg_facet ((2,true),0.5000,876, + Iarg_facet ((4,true),0.6697,845, + Iarg_leaf 1501))), + Iarg_facet ((1,true),0.5000,944, + Iarg_facet ((2,true),0.5000,1425, + Iarg_leaf 1565))));; + +add_case ("4652969746 1", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1423, + Iarg_facet ((4,true),0.6324,946, + Iarg_leaf 1466)), + Iarg_facet ((2,true),0.5000,857, + Iarg_leaf 1388)), + Iarg_facet ((1,true),0.5000,1059, + Iarg_facet ((2,true),0.5000,705, + Iarg_leaf 1426))));; + +add_case ("OXLZLEZ 6346351218 4 32", + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1664, + Iarg_facet ((4,true),0.5000,1080, + Iarg_facet ((5,true),0.5000,769, + Iarg_facet ((1,true),0.5000,973, + Iarg_facet ((2,true),0.5000,706, + Iarg_facet ((4,true),0.7824,1174, + Iarg_leaf 1680)))))), + Iarg_facet ((2,true),0.5000,707, + Iarg_leaf 1617)));; + +add_case ("OXLZLEZ 6346351218 2 24", + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1556, + Iarg_facet ((4,true),0.5000,1064, + Iarg_facet ((5,true),0.5000,803, + Iarg_facet ((1,true),0.5000,1000, + Iarg_facet ((2,true),0.5000,726, + Iarg_facet ((4,true),0.6671,864, + Iarg_facet ((5,true),0.7973,823, + Iarg_leaf 1350))))))), + Iarg_facet ((2,true),0.6398,796, + Iarg_leaf 1195)));; + +add_case ("OXLZLEZ 6346351218 3 23", + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1548, + Iarg_facet ((4,true),0.5000,1066, + Iarg_facet ((5,true),0.5000,803, + Iarg_facet ((1,true),0.5000,1001, + Iarg_facet ((2,true),0.5000,723, + Iarg_facet ((4,true),0.6671,864, + Iarg_facet ((5,true),0.8792,1197, + Iarg_leaf 1023))))))), + Iarg_facet ((2,true),0.8348,1251, + Iarg_leaf 726)));; + +add_case ("GLFVCVK4 2477216213 split(9/64)", + Iarg_bisect (1, + Iarg_facet ((3,true),0.5000,1856, + Iarg_facet ((4,true),0.5000,1316, + Iarg_facet ((2,true),0.5000,1456, + Iarg_leaf 1864))), + Iarg_facet ((3,true),0.5000,719, + Iarg_facet ((4,true),0.7754,1132, + Iarg_leaf 838))));; + +add_case ("GLFVCVK4 2477216213 split(18/64)", + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1851, + Iarg_facet ((5,true),0.5000,1367, + Iarg_facet ((1,true),0.5000,1621, + Iarg_leaf 1868))), + Iarg_facet ((3,true),0.5000,713, + Iarg_facet ((5,true),0.6576,837, + Iarg_leaf 1128))));; + +add_case ("ZTGIJCF4 1 0 0 1 1821661595 split(3/8)", + Iarg_bisect (1, + Iarg_facet ((3,true),0.5000,1930, + Iarg_facet ((4,true),0.5000,1467, + Iarg_facet ((2,true),0.5000,1423, + Iarg_facet ((5,true),0.5000,900, + Iarg_leaf 1785)))), + Iarg_facet ((3,true),0.5000,755, + Iarg_facet ((4,true),0.6348,953, + Iarg_leaf 1312))));; + +add_case ("ZTGIJCF4 0 1 0 0 1821661595 split(2/4)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1535, + Iarg_facet ((5,true),0.5000,1028, + Iarg_facet ((1,true),0.5000,785, + Iarg_leaf 1457))), + Iarg_facet ((4,true),0.6385,859, + Iarg_leaf 1238)), + Iarg_facet ((2,true),0.5000,836, + Iarg_facet ((4,true),0.6461,874, + Iarg_leaf 1235))));; + +add_case ("5957966880", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1756, + Iarg_facet ((3,true),0.5000,801, + Iarg_leaf 1465)), + Iarg_facet ((2,true),0.7965,1088, + Iarg_leaf 1102)), + Iarg_facet ((1,true),0.5000,1186, + Iarg_leaf 1743)));; + +add_case ("3862621143 back", + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1633, + Iarg_facet ((2,true),0.5000,1088, + Iarg_facet ((4,true),0.6635,819, + Iarg_facet ((5,true),0.7983,786, + Iarg_leaf 1452)))), + Iarg_facet ((1,true),0.5000,1119, + Iarg_facet ((2,true),0.5000,760, + Iarg_facet ((4,true),0.6671,789, + Iarg_leaf 1660)))));; + +add_case ("OXLZLEZ 6346351218 4 24", + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1788, + Iarg_facet ((4,true),0.5000,1156, + Iarg_facet ((5,true),0.5000,825, + Iarg_facet ((1,true),0.5000,1019, + Iarg_facet ((2,true),0.5000,734, + Iarg_facet ((4,true),0.6617,837, + Iarg_leaf 1858)))))), + Iarg_facet ((2,true),0.5000,770, + Iarg_leaf 1730)));; + +add_case ("OXLZLEZ 6346351218 1 22", + Iarg_facet ((1,true),0.5000,1900, + Iarg_facet ((2,true),0.5000,1420, + Iarg_facet ((4,true),0.5000,1002, + Iarg_facet ((5,true),0.5000,737, + Iarg_facet ((1,true),0.5000,909, + Iarg_facet ((2,true),0.6315,1005, + Iarg_facet ((4,true),0.6705,760, + Iarg_facet ((5,true),0.7950,863, + Iarg_facet ((3,false),0.5000,884, + Iarg_leaf 1247))))))))));; + +add_case ("OXLZLEZ 6346351218 1 21", + Iarg_facet ((1,true),0.5000,1991, + Iarg_facet ((2,true),0.5000,1458, + Iarg_facet ((4,true),0.5000,982, + Iarg_facet ((5,true),0.6157,1034, + Iarg_facet ((1,true),0.5000,741, + Iarg_facet ((2,true),0.6540,886, + Iarg_facet ((4,true),0.7577,861, + Iarg_facet ((5,true),0.8033,780, + Iarg_facet ((1,true),0.8313,723, + Iarg_leaf 1371))))))))));; + +add_case ("OXLZLEZ 6346351218 1 20", + Iarg_facet ((1,true),0.5000,1998, + Iarg_facet ((2,true),0.5000,1460, + Iarg_facet ((4,true),0.5000,980, + Iarg_facet ((5,true),0.5000,702, + Iarg_facet ((1,true),0.5000,908, + Iarg_facet ((2,true),0.6260,996, + Iarg_facet ((4,true),0.7150,889, + Iarg_facet ((5,true),0.8005,814, + Iarg_facet ((1,true),0.7920,780, + Iarg_leaf 1604))))))))));; + +add_case ("GLFVCVK4 2477216213 split(42/64)", + Iarg_bisect (1, + Iarg_facet ((3,true),0.5000,1912, + Iarg_facet ((5,true),0.5000,1348, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1026, + Iarg_leaf 1262), + Iarg_facet ((4,false),0.5000,994, + Iarg_leaf 1079)))), + Iarg_facet ((3,true),0.6163,950, + Iarg_leaf 1535)));; + +add_case ("QZECFIC wt0", + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,1808, + Iarg_facet ((4,true),0.5000,852, + Iarg_leaf 1920)), + Iarg_facet ((3,true),0.6589,711, + Iarg_leaf 1383)), + Iarg_facet ((5,true),0.5000,717, + Iarg_facet ((3,true),0.7143,854, + Iarg_leaf 1250))));; + +add_case ("OXLZLEZ 6346351218 1 23", + Iarg_facet ((1,true),0.5000,1899, + Iarg_facet ((2,true),0.5000,1419, + Iarg_facet ((4,true),0.5000,999, + Iarg_facet ((5,true),0.5000,736, + Iarg_facet ((1,true),0.5000,918, + Iarg_facet ((2,true),0.6299,1023, + Iarg_facet ((4,true),0.7937,1282, + Iarg_facet ((5,true),0.8232,848, + Iarg_facet ((3,false),0.5000,843, + Iarg_leaf 1229))))))))));; + +add_case ("GLFVCVK4 2477216213 split(38/64)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((5,true),0.5000,1728, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1016, + Iarg_leaf 1794), + Iarg_facet ((4,true),0.5000,1047, + Iarg_leaf 1481))), + Iarg_facet ((5,true),0.6706,864, + Iarg_leaf 1344)), + Iarg_facet ((2,true),0.6364,955, + Iarg_leaf 1409)));; + +add_case ("TSKAJXY-TADIAMB", + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,752, + Iarg_leaf 1598), + Iarg_facet ((5,true),0.7048,1188, + Iarg_facet ((2,true),0.5000,1012, + Iarg_leaf 1282))), + Iarg_facet ((4,true),0.5000,984, + Iarg_facet ((5,true),0.6787,982, + Iarg_facet ((2,true),0.5000,864, + Iarg_leaf 1185)))), + Iarg_facet ((3,true),0.5000,1640, + Iarg_leaf 1725)));; + +add_case ("8875146520", + Iarg_facet ((0,true),0.7397,730, + Iarg_facet ((1,true),0.6312,1267, + Iarg_facet ((2,true),0.6427,1056, + Iarg_facet ((4,false),0.5000,1335, + Iarg_facet ((5,false),0.5000,867, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1412, + Iarg_facet ((4,true),0.5000,989, + Iarg_leaf 1146)), + Iarg_facet ((2,true),0.5000,1346, + Iarg_leaf 1935))))))));; + +add_case ("2763799127", + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1269, + Iarg_facet ((2,true),0.5000,1494, + Iarg_facet ((4,true),0.5000,957, + Iarg_facet ((5,true),0.6644,779, + Iarg_facet ((0,true),0.5000,1006, + Iarg_leaf 1441))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1431, + Iarg_facet ((4,true),0.5000,899, + Iarg_leaf 1965)), + Iarg_facet ((2,true),0.5000,716, + Iarg_leaf 1653))));; + +add_case ("6988401556", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1523, + Iarg_facet ((4,true),0.6456,930, + Iarg_facet ((5,true),0.7250,730, + Iarg_leaf 1408))), + Iarg_facet ((2,true),0.5000,860, + Iarg_leaf 1477)), + Iarg_facet ((1,true),0.5000,1493, + Iarg_facet ((2,true),0.5000,1033, + Iarg_facet ((4,true),0.6566,969, + Iarg_leaf 1333)))));; + +add_case ("GLFVCVK4 2477216213 split(37/64)", + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1804, + Iarg_facet ((4,true),0.5000,1748, + Iarg_bisect (3, + Iarg_facet ((5,true),0.5000,1024, + Iarg_leaf 1810), + Iarg_facet ((5,true),0.5000,1062, + Iarg_leaf 1430)))), + Iarg_facet ((2,true),0.6334,1010, + Iarg_leaf 1854)));; + +add_case ("GLFVCVK4 2477216213 split(52/64)", + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1763, + Iarg_facet ((5,true),0.5000,1691, + Iarg_bisect (1, + Iarg_facet ((3,true),0.5000,1439, + Iarg_leaf 1999), + Iarg_facet ((3,false),0.5000,1058, + Iarg_leaf 1085)))), + Iarg_facet ((4,true),0.6324,983, + Iarg_leaf 1955)));; + +add_case ("3603097872", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1450, + Iarg_facet ((4,true),0.6251,914, + Iarg_facet ((5,true),0.6992,717, + Iarg_facet ((0,true),0.5000,1097, + Iarg_leaf 1781)))), + Iarg_facet ((2,true),0.6260,894, + Iarg_leaf 1165)), + Iarg_facet ((1,true),0.5000,1375, + Iarg_facet ((2,true),0.5000,965, + Iarg_facet ((4,true),0.6587,954, + Iarg_facet ((5,true),0.7793,843, + Iarg_leaf 1416))))));; + +add_case ("1085358243", + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1482, + Iarg_facet ((2,true),0.5000,1224, + Iarg_facet ((4,true),0.5000,857, + Iarg_facet ((5,true),0.5000,725, + Iarg_facet ((0,true),0.5000,1219, + Iarg_facet ((1,true),0.6159,953, + Iarg_leaf 1588)))))), + Iarg_facet ((1,true),0.5000,1471, + Iarg_facet ((2,true),0.5000,1184, + Iarg_facet ((4,true),0.6209,908, + Iarg_leaf 1495)))));; + +add_case ("GLFVCVK4 2477216213 y4subcrit split(2/4)", + Iarg_facet ((2,true),0.5000,1939, + Iarg_facet ((3,true),0.5000,1865, + Iarg_facet ((4,true),0.5000,947, + Iarg_facet ((5,true),0.5000,957, + Iarg_facet ((2,true),0.6449,895, + Iarg_leaf 1977))))));; + +add_case ("5541487347", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.6338,911, + Iarg_facet ((4,true),0.7617,860, + Iarg_leaf 1373)), + Iarg_facet ((3,true),0.6257,1157, + Iarg_leaf 1487)), + Iarg_facet ((2,true),0.5000,1315, + Iarg_leaf 1540)), + Iarg_facet ((1,true),0.5000,1473, + Iarg_facet ((2,true),0.5000,1314, + Iarg_leaf 1483))));; + +add_case ("QITNPEA1 1 0 9063653052 A split(3/4)", + Iarg_bisect (1, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1543, + Iarg_facet ((1,true),0.5000,1077, + Iarg_facet ((3,true),0.5000,864, + Iarg_facet ((4,true),0.5000,909, + Iarg_facet ((5,true),0.6776,731, + Iarg_leaf 1552))))), + Iarg_facet ((5,true),0.6479,849, + Iarg_leaf 1368)), + Iarg_facet ((4,true),0.5000,874, + Iarg_facet ((5,true),0.8274,1138, + Iarg_leaf 915))), + Iarg_facet ((3,true),0.5000,1043, + Iarg_facet ((4,true),0.5000,873, + Iarg_leaf 1661))));; + +add_case ("QITNPEA1 2 0 9063653052 A split(1/2)", + Iarg_bisect (1, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1160, + Iarg_facet ((3,true),0.5000,804, + Iarg_facet ((4,true),0.5000,728, + Iarg_leaf 1414))), + Iarg_facet ((1,true),0.5000,792, + Iarg_leaf 1449)), + Iarg_facet ((5,true),0.5000,835, + Iarg_leaf 1970)), + Iarg_facet ((4,true),0.5000,872, + Iarg_leaf 1899)), + Iarg_facet ((3,true),0.5000,1031, + Iarg_facet ((4,true),0.5000,845, + Iarg_leaf 1837))));; + +add_case ("4667071578", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1623, + Iarg_facet ((3,false),0.5000,1521, + Iarg_leaf 1626)), + Iarg_facet ((2,true),0.5000,994, + Iarg_leaf 1537)), + Iarg_facet ((1,true),0.5000,1740, + Iarg_facet ((2,true),0.5000,1169, + Iarg_facet ((3,false),0.5000,1037, + Iarg_leaf 1887)))));; + +add_case ("OXLZLEZ 6346351218 4 45", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1620, + Iarg_facet ((5,true),0.5000,1176, + Iarg_facet ((1,true),0.5000,1408, + Iarg_facet ((2,true),0.5000,1012, + Iarg_facet ((4,true),0.5000,728, + Iarg_facet ((5,true),0.6542,970, + Iarg_facet ((3,false),0.5000,1330, + Iarg_leaf 1546))))))), + Iarg_facet ((4,true),0.5000,760, + Iarg_leaf 1692)), + Iarg_facet ((2,true),0.5000,1041, + Iarg_facet ((4,true),0.6290,902, + Iarg_leaf 1494))));; + +add_case ("OXLZLEZ 6346351218 1 6", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1590, + Iarg_facet ((5,true),0.5000,1276, + Iarg_facet ((1,true),0.5000,1557, + Iarg_facet ((2,true),0.5000,1148, + Iarg_facet ((4,true),0.5000,839, + Iarg_facet ((5,true),0.6392,986, + Iarg_facet ((1,true),0.6252,936, + Iarg_facet ((2,true),0.6921,720, + Iarg_leaf 1365)))))))), + Iarg_facet ((4,true),0.6833,706, + Iarg_leaf 1265)), + Iarg_facet ((2,true),0.6461,839, + Iarg_leaf 1682)));; + +add_case ("GLFVCVK4 2477216213 split(44/64)", + Iarg_bisect (1, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1329, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1501, + Iarg_facet ((1,true),0.6277,906, + Iarg_leaf 1140)), + Iarg_facet ((3,false),0.5000,1070, + Iarg_leaf 1109))), + Iarg_facet ((5,true),0.6827,814, + Iarg_leaf 1286)), + Iarg_facet ((4,true),0.6218,1013, + Iarg_leaf 1990)));; + +add_case ("9251360200", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.6305,912, + Iarg_facet ((5,true),0.6797,709, + Iarg_facet ((3,false),0.5000,1052, + Iarg_leaf 1151))), + Iarg_facet ((4,true),0.7837,826, + Iarg_leaf 1255)), + Iarg_facet ((2,true),0.6398,942, + Iarg_leaf 1815)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1903, + Iarg_facet ((4,true),0.6556,888, + Iarg_leaf 1249)), + Iarg_facet ((2,true),0.6631,869, + Iarg_leaf 1620))));; + +add_case ("OXLZLEZ 6346351218 2 45", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1621, + Iarg_facet ((5,true),0.5000,1179, + Iarg_facet ((1,true),0.5000,1410, + Iarg_facet ((2,true),0.5000,1011, + Iarg_facet ((4,true),0.5000,728, + Iarg_facet ((5,true),0.6545,968, + Iarg_facet ((3,false),0.5000,1330, + Iarg_leaf 1549))))))), + Iarg_facet ((4,true),0.5000,760, + Iarg_leaf 1694)), + Iarg_facet ((2,true),0.5000,1041, + Iarg_facet ((4,true),0.6369,907, + Iarg_leaf 1460))));; + +add_case ("OXLZLEZ 6346351218 2 39", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1915, + Iarg_facet ((5,true),0.5000,1471, + Iarg_facet ((1,true),0.5000,1353, + Iarg_facet ((2,true),0.5000,961, + Iarg_facet ((4,true),0.6296,898, + Iarg_leaf 1803))))), + Iarg_facet ((4,true),0.5000,931, + Iarg_facet ((5,true),0.6653,741, + Iarg_leaf 1173))), + Iarg_facet ((2,true),0.5000,1087, + Iarg_facet ((4,true),0.5000,747, + Iarg_facet ((5,true),0.6257,917, + Iarg_leaf 1234)))));; + +add_case ("OXLZLEZ 6346351218 3 7", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1699, + Iarg_facet ((5,true),0.5000,1160, + Iarg_facet ((1,true),0.5000,1430, + Iarg_facet ((2,true),0.5000,1044, + Iarg_facet ((4,true),0.5000,751, + Iarg_facet ((5,true),0.6449,905, + Iarg_facet ((3,true),0.5000,1287, + Iarg_leaf 1373))))))), + Iarg_facet ((4,true),0.5000,871, + Iarg_leaf 1749)), + Iarg_facet ((2,true),0.5000,1139, + Iarg_facet ((4,true),0.6120,929, + Iarg_leaf 1611))));; + +add_case ("OXLZLEZ 6346351218 4 3", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1763, + Iarg_facet ((5,true),0.5000,1195, + Iarg_facet ((1,true),0.5000,1481, + Iarg_facet ((2,true),0.5000,1075, + Iarg_facet ((4,true),0.5000,770, + Iarg_facet ((5,true),0.6294,934, + Iarg_facet ((3,true),0.5000,1498, + Iarg_leaf 1660))))))), + Iarg_facet ((4,true),0.5000,894, + Iarg_leaf 1803)), + Iarg_facet ((2,true),0.5000,1151, + Iarg_facet ((4,true),0.5000,705, + Iarg_leaf 1892))));; + +add_case ("GLFVCVK4 2477216213 split(41/64)", + Iarg_bisect (1, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (2, + Iarg_facet ((5,true),0.5000,1490, + Iarg_leaf 1921), + Iarg_facet ((5,true),0.5000,878, + Iarg_leaf 1480)), + Iarg_facet ((2,true),0.5000,1097, + Iarg_leaf 1162)), + Iarg_facet ((4,true),0.5000,728, + Iarg_facet ((2,false),0.5000,1023, + Iarg_leaf 1160))), + Iarg_facet ((3,true),0.5000,1031, + Iarg_facet ((4,true),0.5000,781, + Iarg_facet ((2,true),0.5000,1218, + Iarg_leaf 1289)))));; + +add_case ("ZTGIJCF4 1 0 0 1 1821661595 split(7/8)", + Iarg_bisect (1, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (2, + Iarg_facet ((5,true),0.5000,1444, + Iarg_facet ((1,true),0.5000,806, + Iarg_leaf 1673)), + Iarg_facet ((5,true),0.6235,982, + Iarg_leaf 1144)), + Iarg_facet ((2,true),0.5000,1043, + Iarg_leaf 1366)), + Iarg_facet ((4,true),0.5000,734, + Iarg_facet ((2,false),0.5000,1046, + Iarg_leaf 1078))), + Iarg_facet ((3,true),0.5000,1027, + Iarg_facet ((4,true),0.5000,899, + Iarg_facet ((2,true),0.5000,1170, + Iarg_leaf 1500)))));; + +add_case ("ZTGIJCF4 0 0 0 1 1821661595 split(1/4)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1452, + Iarg_facet ((4,true),0.5000,1151, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,997, + Iarg_leaf 1975), + Iarg_facet ((1,true),0.6345,913, + Iarg_leaf 1154)))), + Iarg_facet ((3,true),0.5000,844, + Iarg_facet ((4,true),0.5000,796, + Iarg_facet ((5,true),0.5000,1420, + Iarg_leaf 1519)))), + Iarg_facet ((2,true),0.5000,1582, + Iarg_facet ((3,true),0.5000,755, + Iarg_facet ((4,true),0.6635,865, + Iarg_leaf 1352)))));; + +add_case ("4010906068", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1814, + Iarg_facet ((1,true),0.5000,1215, + Iarg_facet ((2,true),0.5000,783, + Iarg_leaf 1343))), + Iarg_facet ((0,true),0.5000,732, + Iarg_leaf 1408)), + Iarg_facet ((5,true),0.5000,1432, + Iarg_facet ((0,true),0.5000,740, + Iarg_leaf 1408))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1391, + Iarg_facet ((0,true),0.6215,913, + Iarg_leaf 1148)), + Iarg_facet ((5,false),0.5000,1382, + Iarg_leaf 1402))));; + +add_case ("8611785756", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1470, + Iarg_facet ((5,true),0.5000,1075, + Iarg_facet ((0,true),0.5000,909, + Iarg_leaf 1185))), + Iarg_facet ((4,true),0.7042,968, + Iarg_leaf 1106)), + Iarg_facet ((3,true),0.6500,885, + Iarg_leaf 1559)), + Iarg_facet ((5,true),0.7947,1259, + Iarg_leaf 1662)), + Iarg_facet ((4,true),0.5000,757, + Iarg_facet ((5,true),0.6582,855, + Iarg_facet ((4,true),0.6777,824, + Iarg_leaf 1298)))));; + +add_case ("OXLZLEZ 6346351218 1 42", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1892, + Iarg_facet ((5,true),0.5000,1414, + Iarg_facet ((1,true),0.5000,1640, + Iarg_facet ((2,true),0.5000,1178, + Iarg_facet ((4,true),0.5000,882, + Iarg_facet ((5,true),0.6189,966, + Iarg_facet ((1,true),0.5000,745, + Iarg_facet ((2,true),0.6549,861, + Iarg_leaf 1503)))))))), + Iarg_facet ((4,true),0.6229,918, + Iarg_leaf 1652)), + Iarg_facet ((2,true),0.5000,926, + Iarg_facet ((4,true),0.6405,858, + Iarg_leaf 1663))));; + +add_case ("OXLZLEZ 6346351218 1 36", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1605, + Iarg_facet ((5,true),0.5000,1262, + Iarg_facet ((1,true),0.5000,1588, + Iarg_facet ((2,true),0.5000,1212, + Iarg_facet ((4,true),0.5000,931, + Iarg_facet ((5,true),0.5000,716, + Iarg_facet ((1,true),0.5000,996, + Iarg_facet ((2,true),0.5000,708, + Iarg_facet ((4,true),0.6930,881, + Iarg_leaf 1491))))))))), + Iarg_facet ((4,true),0.6599,799, + Iarg_leaf 1319)), + Iarg_facet ((2,true),0.5000,702, + Iarg_facet ((4,true),0.6582,798, + Iarg_leaf 1312))));; + +add_case ("OXLZLEZ 6346351218 2 3", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1761, + Iarg_facet ((5,true),0.5000,1197, + Iarg_facet ((1,true),0.5000,1477, + Iarg_facet ((2,true),0.5000,1075, + Iarg_facet ((4,true),0.5000,771, + Iarg_facet ((5,true),0.6421,964, + Iarg_facet ((3,true),0.5000,1469, + Iarg_leaf 1597))))))), + Iarg_facet ((4,true),0.5000,893, + Iarg_leaf 1801)), + Iarg_facet ((2,true),0.5000,1153, + Iarg_facet ((4,true),0.5000,706, + Iarg_leaf 1893))));; + +add_case ("GLFVCVK4 2477216213 split(50/64)", + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((4,true),0.5000,1506, + Iarg_leaf 1935), + Iarg_facet ((4,true),0.5000,1066, + Iarg_leaf 1537)), + Iarg_facet ((1,true),0.5000,1150, + Iarg_leaf 1180)), + Iarg_facet ((5,true),0.5000,734, + Iarg_facet ((1,false),0.5000,1028, + Iarg_leaf 1183))), + Iarg_facet ((3,true),0.5000,1028, + Iarg_facet ((5,true),0.5000,776, + Iarg_facet ((1,true),0.5000,1264, + Iarg_leaf 1325)))));; + +add_case ("2314572187", + Iarg_bisect (3, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1287, + Iarg_facet ((2,true),0.5000,856, + Iarg_leaf 1636)), + Iarg_facet ((1,true),0.5000,757, + Iarg_facet ((2,true),0.6405,1039, + Iarg_leaf 1381))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1811, + Iarg_facet ((2,true),0.5000,1228, + Iarg_leaf 1297)), + Iarg_facet ((1,false),0.5000,1642, + Iarg_facet ((2,true),0.5000,760, + Iarg_leaf 1310)))), + Iarg_facet ((3,true),0.7989,1027, + Iarg_facet ((0,true),0.6518,871, + Iarg_leaf 1017))));; + +add_case ("OXLZLEZ 6346351218 3 44", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1772, + Iarg_facet ((1,true),0.5000,1322, + Iarg_facet ((2,true),0.5000,956, + Iarg_facet ((4,true),0.6373,947, + Iarg_facet ((5,true),0.7671,842, + Iarg_leaf 1402))))), + Iarg_facet ((5,true),0.6610,703, + Iarg_leaf 1479)), + Iarg_facet ((4,true),0.5000,1623, + Iarg_facet ((5,true),0.6708,747, + Iarg_leaf 1542))), + Iarg_facet ((2,true),0.5000,1329, + Iarg_facet ((4,true),0.5000,778, + Iarg_facet ((5,true),0.5000,1295, + Iarg_leaf 1846)))));; + +add_case ("OXLZLEZ 6346351218 1 38", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1605, + Iarg_facet ((5,true),0.5000,1262, + Iarg_facet ((1,true),0.5000,1586, + Iarg_facet ((2,true),0.5000,1214, + Iarg_facet ((4,true),0.5000,929, + Iarg_facet ((5,true),0.5000,718, + Iarg_facet ((1,true),0.5000,994, + Iarg_facet ((2,true),0.5000,708, + Iarg_facet ((4,true),0.6921,875, + Iarg_leaf 1496))))))))), + Iarg_facet ((4,true),0.6594,795, + Iarg_leaf 1316)), + Iarg_facet ((2,true),0.5000,704, + Iarg_facet ((4,true),0.6580,798, + Iarg_leaf 1315))));; + +add_case ("OXLZLEZ 6346351218 1 37", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1603, + Iarg_facet ((5,true),0.5000,1262, + Iarg_facet ((1,true),0.5000,1588, + Iarg_facet ((2,true),0.5000,1216, + Iarg_facet ((4,true),0.5000,929, + Iarg_facet ((5,true),0.5000,717, + Iarg_facet ((1,true),0.5000,992, + Iarg_facet ((2,true),0.5000,706, + Iarg_facet ((4,true),0.6678,814, + Iarg_leaf 1530))))))))), + Iarg_facet ((4,true),0.6601,799, + Iarg_leaf 1314)), + Iarg_facet ((2,true),0.5000,703, + Iarg_facet ((4,true),0.6856,856, + Iarg_leaf 1307))));; + +add_case ("OXLZLEZ 6346351218 3 22", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1490, + Iarg_facet ((1,true),0.5000,1754, + Iarg_facet ((2,true),0.5000,1251, + Iarg_facet ((4,true),0.5000,883, + Iarg_facet ((5,true),0.5977,980, + Iarg_facet ((3,true),0.5000,1159, + Iarg_leaf 1729)))))), + Iarg_facet ((5,true),0.6582,764, + Iarg_leaf 1218)), + Iarg_facet ((4,true),0.5000,990, + Iarg_facet ((5,true),0.6559,787, + Iarg_leaf 1267))), + Iarg_facet ((2,true),0.5000,1355, + Iarg_facet ((4,true),0.5000,831, + Iarg_facet ((5,true),0.6206,962, + Iarg_leaf 1290)))));; + +add_case ("OXLZLEZ 6346351218 4 21", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1462, + Iarg_facet ((2,true),0.5000,1091, + Iarg_facet ((4,true),0.5000,746, + Iarg_facet ((5,true),0.8107,1215, + Iarg_leaf 1226)))), + Iarg_facet ((1,true),0.6450,914, + Iarg_leaf 1054)), + Iarg_facet ((5,true),0.7384,845, + Iarg_leaf 1577)), + Iarg_facet ((4,true),0.5000,1567, + Iarg_facet ((5,true),0.6664,762, + Iarg_leaf 1749))), + Iarg_facet ((2,true),0.5000,1194, + Iarg_facet ((4,true),0.5000,776, + Iarg_facet ((5,true),0.5000,1240, + Iarg_facet ((1,false),0.5000,991, + Iarg_leaf 1125))))));; + +add_case ("GLFVCVK4a 8328676778 split(1/4)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1580, + Iarg_facet ((1,true),0.5000,1802, + Iarg_facet ((2,true),0.5000,1266, + Iarg_facet ((4,true),0.5000,932, + Iarg_facet ((5,true),0.5000,702, + Iarg_facet ((3,true),0.5000,1244, + Iarg_leaf 1847)))))), + Iarg_facet ((5,true),0.6619,818, + Iarg_leaf 1324)), + Iarg_facet ((4,true),0.5000,750, + Iarg_facet ((5,true),0.6568,860, + Iarg_leaf 1347))), + Iarg_facet ((2,true),0.5000,1021, + Iarg_facet ((4,true),0.5000,704, + Iarg_facet ((5,true),0.6427,860, + Iarg_leaf 1382)))));; + +add_case ("ZTGIJCF4 1 0 0 0 1821661595 split(1/4)", + Iarg_bisect (1, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (2, + Iarg_facet ((1,true),0.6305,917, + Iarg_leaf 1925), + Iarg_facet ((1,true),0.6195,944, + Iarg_leaf 1797)), + Iarg_facet ((2,false),0.5000,1467, + Iarg_leaf 1594)), + Iarg_facet ((5,true),0.5000,947, + Iarg_facet ((2,true),0.5000,1025, + Iarg_leaf 1254))), + Iarg_facet ((4,true),0.5000,784, + Iarg_leaf 1803)), + Iarg_facet ((3,true),0.5000,1115, + Iarg_facet ((4,true),0.5000,1010, + Iarg_facet ((5,true),0.5000,890, + Iarg_leaf 1326)))));; + +add_case ("ZTGIJCF4 0 0 1 0 1821661595 split(1/4)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1427, + Iarg_facet ((5,true),0.5000,1176, + Iarg_bisect (4, + Iarg_facet ((1,true),0.5000,894, + Iarg_facet ((2,true),0.5000,709, + Iarg_leaf 1376)), + Iarg_facet ((1,true),0.5000,897, + Iarg_leaf 1917)))), + Iarg_facet ((3,true),0.5000,771, + Iarg_facet ((5,true),0.6232,930, + Iarg_facet ((4,true),0.5000,965, + Iarg_leaf 1145)))), + Iarg_facet ((2,true),0.5000,1880, + Iarg_facet ((3,true),0.5000,849, + Iarg_facet ((5,true),0.5000,839, + Iarg_facet ((4,false),0.5000,1530, + Iarg_leaf 1564))))));; + +add_case ("6833979866", + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1376, + Iarg_facet ((2,true),0.5000,1071, + Iarg_leaf 1525)), + Iarg_facet ((1,true),0.5000,726, + Iarg_leaf 1756)), + Iarg_facet ((0,true),0.5000,1536, + Iarg_facet ((1,true),0.5000,783, + Iarg_facet ((2,false),0.5000,984, + Iarg_leaf 1176)))), + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1543, + Iarg_facet ((1,false),0.5000,1409, + Iarg_leaf 1492)), + Iarg_facet ((0,true),0.5000,890, + Iarg_leaf 1817))));; + +add_case ("1642527039", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1799, + Iarg_facet ((4,true),0.5000,818, + Iarg_facet ((5,true),0.6283,896, + Iarg_facet ((0,true),0.5000,1552, + Iarg_facet ((1,true),0.5000,757, + Iarg_leaf 1832))))), + Iarg_facet ((2,true),0.5000,826, + Iarg_leaf 1760)), + Iarg_facet ((1,true),0.5000,1632, + Iarg_facet ((2,true),0.5000,1140, + Iarg_facet ((4,true),0.6224,1108, + Iarg_facet ((5,true),0.6778,794, + Iarg_leaf 1947))))));; + +add_case ("OXLZLEZ 6346351218 4 43", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1480, + Iarg_facet ((2,true),0.5000,1107, + Iarg_facet ((4,true),0.5000,745, + Iarg_facet ((5,true),0.6501,777, + Iarg_leaf 1662)))), + Iarg_facet ((1,true),0.6232,871, + Iarg_leaf 1088)), + Iarg_facet ((5,true),0.7334,808, + Iarg_leaf 1628)), + Iarg_facet ((4,true),0.5000,1533, + Iarg_facet ((5,true),0.6700,754, + Iarg_leaf 1769))), + Iarg_facet ((2,true),0.5000,1146, + Iarg_facet ((4,true),0.5000,752, + Iarg_facet ((5,true),0.5000,1195, + Iarg_facet ((1,false),0.5000,1008, + Iarg_leaf 1135))))));; + +add_case ("OXLZLEZ 6346351218 4 40", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1990, + Iarg_facet ((1,true),0.5000,1645, + Iarg_facet ((2,true),0.5000,1214, + Iarg_facet ((4,true),0.5000,833, + Iarg_facet ((5,true),0.7562,1201, + Iarg_leaf 1881))))), + Iarg_facet ((5,true),0.7405,838, + Iarg_leaf 1524)), + Iarg_facet ((4,true),0.5000,1169, + Iarg_facet ((5,true),0.7132,846, + Iarg_leaf 1589))), + Iarg_facet ((2,true),0.5000,1142, + Iarg_facet ((4,true),0.5000,737, + Iarg_facet ((5,true),0.5000,880, + Iarg_facet ((1,true),0.5000,1002, + Iarg_leaf 1076))))));; + +add_case ("OXLZLEZ 6346351218 3 21", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1447, + Iarg_facet ((2,true),0.5000,1077, + Iarg_facet ((4,true),0.5000,730, + Iarg_facet ((5,true),0.6511,797, + Iarg_leaf 1692)))), + Iarg_facet ((1,true),0.6315,880, + Iarg_leaf 1073)), + Iarg_facet ((5,true),0.7112,768, + Iarg_leaf 1620)), + Iarg_facet ((4,true),0.5000,1569, + Iarg_facet ((5,true),0.6667,764, + Iarg_leaf 1746))), + Iarg_facet ((2,true),0.5000,1188, + Iarg_facet ((4,true),0.5000,776, + Iarg_facet ((5,true),0.5000,1236, + Iarg_facet ((1,false),0.5000,980, + Iarg_leaf 1124))))));; + +add_case ("OXLZLEZ 6346351218 3 20", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1462, + Iarg_facet ((2,true),0.5000,1091, + Iarg_facet ((4,true),0.5000,734, + Iarg_facet ((5,true),0.6513,789, + Iarg_leaf 1687)))), + Iarg_facet ((1,true),0.6206,869, + Iarg_leaf 1096)), + Iarg_facet ((5,true),0.7521,867, + Iarg_leaf 1731)), + Iarg_facet ((4,true),0.5000,1566, + Iarg_facet ((5,true),0.6667,764, + Iarg_leaf 1753))), + Iarg_facet ((2,true),0.5000,1190, + Iarg_facet ((4,true),0.5000,776, + Iarg_facet ((5,true),0.5000,1238, + Iarg_facet ((1,false),0.5000,994, + Iarg_leaf 1126))))));; + +add_case ("OXLZLEZ 6346351218 4 19", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1478, + Iarg_facet ((2,true),0.5000,1106, + Iarg_facet ((4,true),0.5000,746, + Iarg_facet ((5,true),0.6501,777, + Iarg_leaf 1663)))), + Iarg_facet ((1,true),0.6232,870, + Iarg_leaf 1091)), + Iarg_facet ((5,true),0.8117,1021, + Iarg_leaf 1434)), + Iarg_facet ((4,true),0.5000,1535, + Iarg_facet ((5,true),0.7239,873, + Iarg_leaf 1628))), + Iarg_facet ((2,true),0.5000,1147, + Iarg_facet ((4,true),0.5000,752, + Iarg_facet ((5,true),0.5000,1197, + Iarg_facet ((1,false),0.5000,1009, + Iarg_leaf 1136))))));; + +add_case ("OXLZLEZ 6346351218 3 19", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1480, + Iarg_facet ((2,true),0.5000,1106, + Iarg_facet ((4,true),0.5000,745, + Iarg_facet ((5,true),0.6501,777, + Iarg_leaf 1661)))), + Iarg_facet ((1,true),0.6235,871, + Iarg_leaf 1088)), + Iarg_facet ((5,true),0.7625,870, + Iarg_leaf 1699)), + Iarg_facet ((4,true),0.5000,1533, + Iarg_facet ((5,true),0.6702,756, + Iarg_leaf 1769))), + Iarg_facet ((2,true),0.5000,1147, + Iarg_facet ((4,true),0.5000,754, + Iarg_facet ((5,true),0.5000,1196, + Iarg_facet ((1,false),0.5000,1010, + Iarg_leaf 1133))))));; + +add_case ("OXLZLEZ 6346351218 2 18", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1988, + Iarg_facet ((1,true),0.5000,1643, + Iarg_facet ((2,true),0.5000,1214, + Iarg_facet ((4,true),0.5000,832, + Iarg_facet ((5,true),0.7653,1253, + Iarg_leaf 1824))))), + Iarg_facet ((5,true),0.7344,819, + Iarg_leaf 1535)), + Iarg_facet ((4,true),0.5000,1170, + Iarg_facet ((5,true),0.6697,740, + Iarg_leaf 1711))), + Iarg_facet ((2,true),0.5000,1142, + Iarg_facet ((4,true),0.5000,737, + Iarg_facet ((5,true),0.5000,882, + Iarg_facet ((1,true),0.5000,1002, + Iarg_leaf 1078))))));; + +add_case ("OXLZLEZ 6346351218 4 16", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1988, + Iarg_facet ((1,true),0.5000,1644, + Iarg_facet ((2,true),0.5000,1217, + Iarg_facet ((4,true),0.5000,830, + Iarg_facet ((5,true),0.6369,865, + Iarg_facet ((1,true),0.6612,792, + Iarg_leaf 1259)))))), + Iarg_facet ((5,true),0.6768,703, + Iarg_leaf 1662)), + Iarg_facet ((4,true),0.5000,1169, + Iarg_facet ((5,true),0.7558,940, + Iarg_leaf 1680))), + Iarg_facet ((2,true),0.5000,1140, + Iarg_facet ((4,true),0.5000,738, + Iarg_facet ((5,true),0.5000,882, + Iarg_facet ((1,true),0.5000,1002, + Iarg_leaf 1079))))));; + +add_case ("QZECFIC wt1 split(1/2)", + Iarg_facet ((4,true),0.5000,778, + Iarg_facet ((5,true),0.7761,1068, + Iarg_facet ((4,true),0.6673,968, + Iarg_facet ((3,false),0.5000,1593, + Iarg_facet ((5,true),0.6120,894, + Iarg_facet ((4,true),0.6644,865, + Iarg_leaf 1692)))))));; + +add_case ("GLFVCVK4 2477216213 split(1/64)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1319, + Iarg_facet ((5,true),0.5000,1916, + Iarg_facet ((1,true),0.5000,883, + Iarg_leaf 1653))), + Iarg_facet ((4,true),0.6556,850, + Iarg_leaf 1183)), + Iarg_facet ((3,true),0.5000,1089, + Iarg_facet ((4,true),0.5000,861, + Iarg_facet ((5,true),0.5000,1476, + Iarg_leaf 1523)))), + Iarg_facet ((2,true),0.5000,1758, + Iarg_facet ((3,true),0.5000,953, + Iarg_facet ((4,true),0.6444,905, + Iarg_leaf 1280)))));; + +add_case ("GLFVCVK4 2477216213 split(16/64)", + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1699, + Iarg_facet ((1,true),0.5000,1942, + Iarg_facet ((2,true),0.6382,913, + Iarg_leaf 1461))), + Iarg_facet ((5,true),0.5000,900, + Iarg_facet ((1,true),0.5000,1501, + Iarg_leaf 1530))), + Iarg_facet ((4,true),0.5000,1081, + Iarg_facet ((5,true),0.6280,925, + Iarg_leaf 1241))), + Iarg_facet ((3,true),0.5000,1531, + Iarg_facet ((4,true),0.5000,1298, + Iarg_facet ((5,true),0.6249,881, + Iarg_leaf 1065)))));; + +add_case ("8519146937", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,753, + Iarg_facet ((5,true),0.6898,787, + Iarg_leaf 1207)), + Iarg_facet ((4,true),0.6782,706, + Iarg_leaf 1342)), + Iarg_facet ((3,true),0.5000,914, + Iarg_leaf 1447)), + Iarg_facet ((2,true),0.5000,1292, + Iarg_facet ((3,true),0.5000,894, + Iarg_leaf 1450))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1454, + Iarg_facet ((3,false),0.5000,1682, + Iarg_leaf 1748)), + Iarg_facet ((2,true),0.5000,732, + Iarg_leaf 1390))));; + +add_case ("OXLZLEZ 6346351218 2 43", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1478, + Iarg_facet ((2,true),0.5000,1106, + Iarg_facet ((4,true),0.5000,744, + Iarg_facet ((5,true),0.6315,769, + Iarg_leaf 1722)))), + Iarg_facet ((1,true),0.6232,870, + Iarg_leaf 1091)), + Iarg_facet ((5,true),0.7439,829, + Iarg_leaf 1592)), + Iarg_facet ((4,true),0.5000,1532, + Iarg_facet ((5,true),0.6609,731, + Iarg_leaf 1787))), + Iarg_facet ((2,true),0.5000,1147, + Iarg_facet ((4,true),0.5000,753, + Iarg_facet ((5,true),0.5000,1196, + Iarg_facet ((1,false),0.5000,1008, + Iarg_leaf 1136))))));; + +add_case ("TXQTPVC split(0/2)", + Iarg_facet ((3,false),0.5000,1823, + Iarg_facet ((1,true),0.5000,1967, + Iarg_facet ((2,true),0.5000,1369, + Iarg_facet ((4,true),0.5000,1134, + Iarg_facet ((5,true),0.5000,837, + Iarg_facet ((3,false),0.5741,1119, + Iarg_facet ((1,true),0.6728,708, + Iarg_leaf 1348))))))));; + +add_case ("GLFVCVK4 2477216213 split(2/64)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((5,true),0.5000,1305, + Iarg_bisect (4, + Iarg_facet ((1,true),0.5000,804, + Iarg_leaf 1735), + Iarg_facet ((1,true),0.5000,786, + Iarg_leaf 1620))), + Iarg_facet ((5,true),0.6552,838, + Iarg_leaf 1162)), + Iarg_facet ((3,true),0.5000,1034, + Iarg_facet ((5,true),0.5000,739, + Iarg_facet ((4,true),0.5000,1036, + Iarg_leaf 1242)))), + Iarg_facet ((2,true),0.5000,1953, + Iarg_facet ((3,true),0.5000,1120, + Iarg_facet ((5,true),0.5000,887, + Iarg_facet ((4,true),0.5000,1477, + Iarg_leaf 1518))))));; + +add_case ("GLFVCVK4 2477216213 split(8/64)", + Iarg_bisect (1, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (2, + Iarg_facet ((1,true),0.6348,902, + Iarg_leaf 1511), + Iarg_facet ((1,true),0.7809,1276, + Iarg_leaf 1042)), + Iarg_facet ((2,true),0.5000,1491, + Iarg_leaf 1525)), + Iarg_facet ((5,true),0.5000,1032, + Iarg_facet ((2,true),0.5000,1033, + Iarg_leaf 1232))), + Iarg_facet ((4,true),0.5000,1089, + Iarg_facet ((5,true),0.5000,815, + Iarg_leaf 1537))), + Iarg_facet ((3,true),0.5000,1566, + Iarg_facet ((4,true),0.5000,1183, + Iarg_facet ((5,true),0.5000,978, + Iarg_leaf 1393)))));; + +add_case ("OXLZLEZ 6346351218 2 30", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1992, + Iarg_facet ((1,true),0.5000,1384, + Iarg_facet ((2,true),0.5000,992, + Iarg_facet ((4,true),0.6209,942, + Iarg_facet ((5,true),0.6770,704, + Iarg_leaf 1814))))), + Iarg_facet ((5,true),0.6423,802, + Iarg_leaf 1743)), + Iarg_facet ((4,true),0.5000,1843, + Iarg_facet ((5,true),0.6530,811, + Iarg_leaf 1770))), + Iarg_facet ((2,true),0.5000,1496, + Iarg_facet ((4,true),0.5000,914, + Iarg_facet ((5,true),0.5000,1472, + Iarg_facet ((1,false),0.5000,980, + Iarg_leaf 1128))))));; + +add_case ("OXLZLEZ 6346351218 4 29", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1456, + Iarg_facet ((2,true),0.5000,1078, + Iarg_facet ((4,true),0.5000,726, + Iarg_facet ((5,true),0.6518,819, + Iarg_leaf 1834)))), + Iarg_facet ((1,true),0.5000,708, + Iarg_leaf 1399)), + Iarg_facet ((5,true),0.6580,746, + Iarg_leaf 1814)), + Iarg_facet ((4,true),0.5000,1749, + Iarg_facet ((5,true),0.7512,1003, + Iarg_leaf 1835))), + Iarg_facet ((2,true),0.5000,1373, + Iarg_facet ((4,true),0.5000,867, + Iarg_facet ((5,true),0.5000,1430, + Iarg_facet ((1,false),0.5000,1029, + Iarg_leaf 1209))))));; + +add_case ("OXLZLEZ 6346351218 2 29", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1453, + Iarg_facet ((2,true),0.5000,1065, + Iarg_facet ((4,true),0.5000,728, + Iarg_facet ((5,true),0.6518,819, + Iarg_leaf 1835)))), + Iarg_facet ((1,true),0.5000,706, + Iarg_leaf 1397)), + Iarg_facet ((5,true),0.6582,747, + Iarg_leaf 1813)), + Iarg_facet ((4,true),0.5000,1751, + Iarg_facet ((5,true),0.6573,799, + Iarg_leaf 1834))), + Iarg_facet ((2,true),0.5000,1377, + Iarg_facet ((4,true),0.5000,868, + Iarg_facet ((5,true),0.5000,1429, + Iarg_facet ((1,false),0.5000,1029, + Iarg_leaf 1209))))));; + +add_case ("OXLZLEZ 6346351218 1 19", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1881, + Iarg_facet ((5,true),0.5000,1387, + Iarg_facet ((1,true),0.5000,1848, + Iarg_facet ((2,true),0.5000,1392, + Iarg_facet ((4,true),0.5000,1066, + Iarg_facet ((5,true),0.5000,839, + Iarg_facet ((1,true),0.5000,1220, + Iarg_facet ((2,true),0.5000,910, + Iarg_facet ((4,true),0.5000,700, + Iarg_facet ((5,true),0.6523,903, + Iarg_facet ((3,true),0.5000,1285, + Iarg_facet ((1,true),0.7751,839, + Iarg_leaf 1153)))))))))))), + Iarg_facet ((4,true),0.5000,701, + Iarg_leaf 1957)), + Iarg_facet ((2,true),0.5000,982, + Iarg_facet ((4,true),0.6296,868, + Iarg_leaf 1681))));; + +add_case ("GLFVCVK4a 8328676778 split(2/4)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1705, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1551, + Iarg_facet ((4,true),0.5000,1129, + Iarg_facet ((5,true),0.5000,885, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6580,782, + Iarg_leaf 1121), + Iarg_facet ((1,true),0.6271,875, + Iarg_leaf 1537))))), + Iarg_facet ((2,true),0.6508,851, + Iarg_leaf 1153))), + Iarg_facet ((5,true),0.6603,855, + Iarg_leaf 1429)), + Iarg_facet ((4,true),0.5000,775, + Iarg_facet ((5,true),0.6528,873, + Iarg_leaf 1459))), + Iarg_facet ((2,true),0.5000,1056, + Iarg_facet ((4,true),0.5000,732, + Iarg_facet ((5,true),0.6476,895, + Iarg_leaf 1489)))));; + +add_case ("OXLZLEZ 6346351218 1 45", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1514, + Iarg_facet ((4,true),0.5000,1095, + Iarg_facet ((5,true),0.5000,794, + Iarg_facet ((1,true),0.5000,1008, + Iarg_facet ((2,true),0.5000,713, + Iarg_facet ((4,true),0.8064,1267, + Iarg_leaf 1059)))))), + Iarg_facet ((2,true),0.6299,938, + Iarg_leaf 1270)), + Iarg_facet ((1,true),0.6243,944, + Iarg_leaf 1177)), + Iarg_facet ((5,true),0.5000,717, + Iarg_facet ((1,true),0.6313,921, + Iarg_leaf 1187))), + Iarg_facet ((4,true),0.5000,877, + Iarg_facet ((5,true),0.6523,949, + Iarg_leaf 1792))), + Iarg_facet ((2,true),0.5000,1253, + Iarg_facet ((4,true),0.5000,744, + Iarg_facet ((5,true),0.6243,956, + Iarg_leaf 1883)))));; + +add_case ("OXLZLEZ 6346351218 3 38", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1862, + Iarg_facet ((2,true),0.5000,1313, + Iarg_facet ((4,true),0.5000,896, + Iarg_facet ((5,true),0.6280,932, + Iarg_leaf 1532)))), + Iarg_facet ((1,true),0.6252,884, + Iarg_leaf 1070)), + Iarg_facet ((5,true),0.6400,819, + Iarg_leaf 1700)), + Iarg_facet ((4,true),0.5000,1288, + Iarg_facet ((5,true),0.6249,904, + Iarg_leaf 1738))), + Iarg_facet ((2,true),0.5000,1568, + Iarg_facet ((4,true),0.5000,1052, + Iarg_facet ((5,true),0.5000,879, + Iarg_facet ((1,true),0.5000,906, + Iarg_leaf 1167))))));; + +add_case ("OXLZLEZ 6346351218 4 30", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1989, + Iarg_facet ((1,true),0.5000,1381, + Iarg_facet ((2,true),0.5000,991, + Iarg_facet ((4,true),0.6032,896, + Iarg_facet ((5,true),0.7342,867, + Iarg_leaf 1827))))), + Iarg_facet ((5,true),0.6879,905, + Iarg_leaf 1606)), + Iarg_facet ((4,true),0.5000,1844, + Iarg_facet ((5,true),0.6528,811, + Iarg_leaf 1766))), + Iarg_facet ((2,true),0.5000,1499, + Iarg_facet ((4,true),0.5000,914, + Iarg_facet ((5,true),0.5000,1471, + Iarg_facet ((1,false),0.5000,982, + Iarg_leaf 1130))))));; + +add_case ("OXLZLEZ 6346351218 4 26", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1699, + Iarg_facet ((2,true),0.5000,1283, + Iarg_facet ((4,true),0.5000,885, + Iarg_facet ((5,true),0.5955,874, + Iarg_facet ((1,true),0.6356,950, + Iarg_leaf 1787))))), + Iarg_facet ((1,true),0.6332,870, + Iarg_leaf 1056)), + Iarg_facet ((5,true),0.6580,747, + Iarg_leaf 1693)), + Iarg_facet ((4,true),0.5000,1334, + Iarg_facet ((5,true),0.6615,796, + Iarg_leaf 1707))), + Iarg_facet ((2,true),0.5000,1321, + Iarg_facet ((4,true),0.5000,828, + Iarg_facet ((5,true),0.5000,975, + Iarg_facet ((1,true),0.5000,1051, + Iarg_leaf 1088))))));; + +add_case ("GLFVCVK4 2477216213 y4supercrit split(0/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1682, + Iarg_facet ((5,false),0.5000,1660, + Iarg_facet ((1,true),0.6201,946, + Iarg_leaf 1383))), + Iarg_facet ((4,true),0.5000,754, + Iarg_leaf 1732)), + Iarg_facet ((2,true),0.5000,1618, + Iarg_facet ((4,true),0.5000,1152, + Iarg_facet ((5,true),0.5000,748, + Iarg_facet ((1,true),0.5000,890, + Iarg_leaf 1387))))));; + +add_case ("ZTGIJCF4 0 1 0 0 1821661595 split(1/4)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1003, + Iarg_leaf 1847), + Iarg_facet ((1,true),0.5000,927, + Iarg_facet ((2,true),0.6405,877, + Iarg_leaf 1241))), + Iarg_facet ((3,true),0.5000,905, + Iarg_leaf 1278)), + Iarg_facet ((5,true),0.5000,928, + Iarg_facet ((3,true),0.5000,959, + Iarg_leaf 1345))), + Iarg_facet ((4,true),0.5000,1405, + Iarg_facet ((5,true),0.5000,1069, + Iarg_facet ((3,true),0.5000,1023, + Iarg_leaf 1401)))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1457, + Iarg_facet ((5,true),0.5000,1023, + Iarg_facet ((3,true),0.5000,986, + Iarg_leaf 1372))), + Iarg_facet ((4,true),0.6626,778, + Iarg_leaf 1149))));; + +add_case ("1347067436", + Iarg_facet ((0,false),0.5000,1202, + Iarg_facet ((1,true),0.5633,799, + Iarg_facet ((2,true),0.5728,743, + Iarg_bisect (3, + Iarg_facet ((0,false),0.8070,884, + Iarg_leaf 1221), + Iarg_bisect (0, + Iarg_facet ((1,true),0.6340,1148, + Iarg_facet ((2,true),0.6230,1010, + Iarg_leaf 1019)), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1528, + Iarg_facet ((0,false),0.5000,1473, + Iarg_leaf 1991)), + Iarg_facet ((3,false),0.5000,862, + Iarg_facet ((0,false),0.5000,1401, + Iarg_facet ((1,true),0.5000,1065, + Iarg_leaf 1289)))), + Iarg_facet ((2,true),0.6065,738, + Iarg_facet ((3,false),0.5000,818, + Iarg_facet ((0,false),0.5000,1278, + Iarg_facet ((1,false),0.5000,1027, + Iarg_leaf 1074)))))))))));; + +add_case ("OXLZLEZ 6346351218 3 42", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1904, + Iarg_facet ((2,true),0.5000,1425, + Iarg_facet ((4,true),0.5000,959, + Iarg_facet ((5,true),0.5000,723, + Iarg_facet ((1,true),0.6241,965, + Iarg_leaf 1564))))), + Iarg_facet ((1,true),0.5000,804, + Iarg_leaf 1742)), + Iarg_facet ((5,true),0.6686,779, + Iarg_facet ((1,true),0.6811,739, + Iarg_leaf 1433))), + Iarg_facet ((4,true),0.5000,1770, + Iarg_facet ((5,true),0.6479,845, + Iarg_facet ((1,true),0.6847,737, + Iarg_leaf 1475)))), + Iarg_facet ((2,true),0.5000,1339, + Iarg_facet ((4,true),0.5000,915, + Iarg_facet ((5,true),0.5000,1441, + Iarg_facet ((1,false),0.5000,1289, + Iarg_leaf 1371))))));; + +add_case ("OXLZLEZ 6346351218 4 17", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1903, + Iarg_facet ((2,true),0.5000,1423, + Iarg_facet ((4,true),0.5000,958, + Iarg_facet ((5,true),0.5000,724, + Iarg_facet ((1,true),0.6243,965, + Iarg_leaf 1567))))), + Iarg_facet ((1,true),0.5000,804, + Iarg_leaf 1741)), + Iarg_facet ((5,true),0.6568,762, + Iarg_facet ((1,true),0.7358,886, + Iarg_leaf 1286))), + Iarg_facet ((4,true),0.5000,1767, + Iarg_facet ((5,true),0.6479,845, + Iarg_facet ((1,true),0.6912,774, + Iarg_leaf 1461)))), + Iarg_facet ((2,true),0.5000,1338, + Iarg_facet ((4,true),0.5000,915, + Iarg_facet ((5,true),0.5000,1444, + Iarg_facet ((1,false),0.5000,1289, + Iarg_leaf 1390))))));; + +add_case ("OXLZLEZ 6346351218 3 37", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1993, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1502, + Iarg_facet ((4,true),0.5000,1058, + Iarg_facet ((5,true),0.5000,798, + Iarg_facet ((1,true),0.5000,964, + Iarg_facet ((2,true),0.6174,874, + Iarg_leaf 1478))))), + Iarg_facet ((2,true),0.6575,843, + Iarg_leaf 1189))), + Iarg_facet ((5,true),0.6642,819, + Iarg_leaf 1607)), + Iarg_facet ((4,true),0.5000,1006, + Iarg_facet ((5,true),0.6494,848, + Iarg_leaf 1644))), + Iarg_facet ((2,true),0.5000,1210, + Iarg_facet ((4,true),0.5000,814, + Iarg_facet ((5,true),0.5000,718, + Iarg_facet ((1,true),0.5000,874, + Iarg_leaf 1164))))));; + +add_case ("OXLZLEZ 6346351218 4 18", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1906, + Iarg_facet ((2,true),0.5000,1423, + Iarg_facet ((4,true),0.5000,957, + Iarg_facet ((5,true),0.5000,725, + Iarg_facet ((1,true),0.6238,964, + Iarg_leaf 1565))))), + Iarg_facet ((1,true),0.5000,803, + Iarg_leaf 1743)), + Iarg_facet ((5,true),0.6568,763, + Iarg_facet ((1,true),0.6989,786, + Iarg_leaf 1404))), + Iarg_facet ((4,true),0.5000,1770, + Iarg_facet ((5,true),0.6476,845, + Iarg_facet ((1,true),0.7203,865, + Iarg_leaf 1395)))), + Iarg_facet ((2,true),0.5000,1339, + Iarg_facet ((4,true),0.5000,913, + Iarg_facet ((5,true),0.5000,1442, + Iarg_facet ((1,false),0.5000,1290, + Iarg_leaf 1375))))));; + +add_case ("ZTGIJCF4 0 0 0 1 1821661595 split(3/4)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1835, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1420, + Iarg_facet ((2,true),0.5000,810, + Iarg_facet ((3,true),0.6908,701, + Iarg_leaf 1328))), + Iarg_facet ((1,true),0.5000,886, + Iarg_leaf 1602))), + Iarg_facet ((4,true),0.6201,1030, + Iarg_leaf 1600)), + Iarg_facet ((3,true),0.5000,1226, + Iarg_facet ((4,true),0.5000,1212, + Iarg_facet ((5,true),0.5000,1851, + Iarg_facet ((1,true),0.5000,745, + Iarg_leaf 1343))))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1277, + Iarg_facet ((4,true),0.5000,951, + Iarg_facet ((5,true),0.5000,1161, + Iarg_leaf 1536))), + Iarg_facet ((3,true),0.6578,838, + Iarg_leaf 1215))));; + +add_case ("QITNPEA 5400790175 a split(1/4)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,1359, + Iarg_leaf 1395), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,877, + Iarg_leaf 1862), + Iarg_facet ((1,true),0.6218,933, + Iarg_leaf 1382))), + Iarg_facet ((5,false),0.5000,1304, + Iarg_leaf 1511)), + Iarg_facet ((4,true),0.5000,1043, + Iarg_facet ((5,false),0.5000,1338, + Iarg_leaf 1610))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1523, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1213, + Iarg_leaf 1594), + Iarg_facet ((1,true),0.5000,952, + Iarg_leaf 1454))), + Iarg_facet ((5,true),0.6708,834, + Iarg_leaf 1201)), + Iarg_facet ((4,true),0.6203,952, + Iarg_leaf 1968))));; + +add_case ("QITNPEA 5400790175 a split(2/4)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1547, + Iarg_facet ((4,true),0.5000,1168, + Iarg_facet ((5,true),0.5000,1399, + Iarg_facet ((0,false),0.7262,750, + Iarg_facet ((1,true),0.5000,1012, + Iarg_facet ((2,true),0.6385,923, + Iarg_facet ((4,true),0.7632,886, + Iarg_leaf 1487))))))), + Iarg_facet ((2,true),0.5000,795, + Iarg_facet ((4,true),0.6721,875, + Iarg_leaf 1476))), + Iarg_facet ((1,true),0.5000,760, + Iarg_leaf 1849)), + Iarg_facet ((5,true),0.6269,963, + Iarg_leaf 1581)), + Iarg_facet ((4,true),0.5000,902, + Iarg_facet ((5,true),0.6160,953, + Iarg_leaf 1625))), + Iarg_facet ((2,true),0.5000,1241, + Iarg_facet ((4,true),0.5000,885, + Iarg_facet ((5,true),0.5000,705, + Iarg_facet ((1,true),0.5000,1048, + Iarg_leaf 1671))))));; + +add_case ("OXLZLEZ 6346351218 1 41", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1802, + Iarg_facet ((4,true),0.5000,1316, + Iarg_facet ((5,true),0.5000,990, + Iarg_facet ((1,true),0.5000,1277, + Iarg_facet ((2,true),0.5000,924, + Iarg_facet ((4,true),0.6048,923, + Iarg_leaf 1778)))))), + Iarg_facet ((2,true),0.6180,942, + Iarg_leaf 1456)), + Iarg_facet ((1,true),0.5000,702, + Iarg_leaf 1573)), + Iarg_facet ((5,true),0.5000,731, + Iarg_facet ((1,true),0.6185,897, + Iarg_leaf 1386))), + Iarg_facet ((4,true),0.5000,985, + Iarg_facet ((5,true),0.6394,936, + Iarg_leaf 1939))), + Iarg_facet ((2,true),0.5000,1360, + Iarg_facet ((4,true),0.5000,846, + Iarg_facet ((5,true),0.5000,741, + Iarg_facet ((1,true),0.5000,1078, + Iarg_leaf 1339))))));; + +add_case ("OXLZLEZ 6346351218 1 28", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1944, + Iarg_facet ((5,true),0.5000,1418, + Iarg_facet ((1,true),0.5000,1927, + Iarg_facet ((2,true),0.5000,1469, + Iarg_facet ((4,true),0.5000,1167, + Iarg_facet ((5,true),0.5000,917, + Iarg_facet ((1,true),0.5000,1423, + Iarg_facet ((2,true),0.5000,1067, + Iarg_facet ((4,true),0.5000,872, + Iarg_facet ((5,true),0.6186,1099, + Iarg_facet ((3,false),0.5000,1901, + Iarg_facet ((1,true),0.6793,747, + Iarg_leaf 1416)))))))))))), + Iarg_facet ((4,true),0.5000,707, + Iarg_facet ((5,true),0.6658,729, + Iarg_leaf 1176))), + Iarg_facet ((2,true),0.5000,1031, + Iarg_facet ((4,true),0.6122,890, + Iarg_leaf 1713))));; + +add_case ("ZTGIJCF4 1 0 0 0 1821661595 split(3/4)", + Iarg_bisect (1, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (2, + Iarg_facet ((1,true),0.5000,1024, + Iarg_facet ((3,true),0.6299,978, + Iarg_facet ((4,true),0.5000,757, + Iarg_leaf 1595))), + Iarg_facet ((1,true),0.5000,1036, + Iarg_facet ((3,true),0.6277,966, + Iarg_leaf 1720))), + Iarg_facet ((2,false),0.5000,1943, + Iarg_facet ((1,true),0.5000,734, + Iarg_leaf 1529))), + Iarg_facet ((5,true),0.5000,1470, + Iarg_facet ((2,true),0.5000,1834, + Iarg_facet ((1,true),0.6218,873, + Iarg_leaf 1159)))), + Iarg_facet ((4,true),0.5000,1408, + Iarg_facet ((5,true),0.5000,897, + Iarg_facet ((2,true),0.5000,890, + Iarg_leaf 1347)))), + Iarg_facet ((3,true),0.5000,1707, + Iarg_facet ((4,true),0.5000,1740, + Iarg_facet ((5,true),0.5000,1278, + Iarg_facet ((2,true),0.5000,943, + Iarg_leaf 1217))))));; + +add_case ("PEMKWKU split(0/2)", + Iarg_bisect (1, + Iarg_facet ((3,true),0.5000,1651, + Iarg_bisect (5, + Iarg_facet ((2,true),0.5000,1246, + Iarg_leaf 1526), + Iarg_facet ((2,true),0.5000,1776, + Iarg_facet ((4,true),0.5000,1127, + Iarg_leaf 1161)))), + Iarg_facet ((3,true),0.5000,911, + Iarg_facet ((5,true),0.5000,898, + Iarg_facet ((2,true),0.5000,1564, + Iarg_facet ((4,false),0.5000,1084, + Iarg_leaf 1481))))));; + +add_case ("ZTGIJCF4 0 0 1 0 1821661595 split(3/4)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((5,true),0.5000,1929, + Iarg_bisect (4, + Iarg_facet ((1,true),0.5000,1277, + Iarg_facet ((2,true),0.5000,1023, + Iarg_facet ((3,true),0.7723,902, + Iarg_leaf 1178))), + Iarg_facet ((1,true),0.5000,1372, + Iarg_facet ((2,true),0.5000,840, + Iarg_leaf 1450)))), + Iarg_facet ((5,true),0.6366,1006, + Iarg_leaf 1550)), + Iarg_facet ((3,true),0.5000,1308, + Iarg_facet ((5,true),0.5000,1171, + Iarg_facet ((4,true),0.5000,1937, + Iarg_leaf 1974)))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1265, + Iarg_facet ((5,true),0.5000,1249, + Iarg_bisect (4, + Iarg_facet ((1,false),0.5000,1004, + Iarg_leaf 1093), + Iarg_facet ((1,false),0.5000,1077, + Iarg_leaf 1223)))), + Iarg_facet ((3,true),0.6552,873, + Iarg_leaf 1717))));; + +add_case ("3296257235", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,876, + Iarg_facet ((4,true),0.5000,1958, + Iarg_facet ((5,true),0.5000,1410, + Iarg_leaf 1950))), + Iarg_facet ((3,true),0.5000,737, + Iarg_facet ((4,true),0.5000,1463, + Iarg_facet ((5,false),0.5000,1422, + Iarg_facet ((0,true),0.6353,833, + Iarg_leaf 1199))))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,736, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,870, + Iarg_leaf 1422), + Iarg_facet ((5,true),0.6592,922, + Iarg_leaf 1667))), + Iarg_facet ((3,true),0.6610,910, + Iarg_leaf 1872))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1804, + Iarg_facet ((3,true),0.7329,819, + Iarg_leaf 1201)), + Iarg_facet ((2,true),0.5000,1019, + Iarg_leaf 1778))));; + +add_case ("9563139965 d", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1021, + Iarg_facet ((1,true),0.6277,937, + Iarg_leaf 1367)), + Iarg_facet ((0,true),0.5000,874, + Iarg_leaf 1383)), + Iarg_facet ((5,true),0.5000,1667, + Iarg_facet ((0,true),0.5000,880, + Iarg_leaf 1368))), + Iarg_facet ((4,false),0.5000,1364, + Iarg_facet ((5,false),0.5000,1226, + Iarg_leaf 1353))), + Iarg_facet ((2,true),0.5000,1878, + Iarg_facet ((4,false),0.5000,1988, + Iarg_facet ((5,false),0.6315,871, + Iarg_leaf 1158)))), + Iarg_facet ((1,true),0.5000,1873, + Iarg_facet ((2,true),0.5000,1392, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,983, + Iarg_leaf 1335), + Iarg_facet ((5,false),0.5000,1008, + Iarg_leaf 1049))))));; + +add_case ("OXLZLEZ 6346351218 3 41", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1613, + Iarg_facet ((4,true),0.5000,1096, + Iarg_facet ((5,true),0.5000,823, + Iarg_facet ((1,true),0.5000,778, + Iarg_facet ((2,true),0.6463,822, + Iarg_leaf 1407))))), + Iarg_facet ((2,true),0.6417,813, + Iarg_leaf 1325)), + Iarg_facet ((1,true),0.5000,947, + Iarg_facet ((2,true),0.6837,715, + Iarg_leaf 1421))), + Iarg_facet ((5,true),0.6489,868, + Iarg_facet ((1,true),0.6635,858, + Iarg_leaf 1922))), + Iarg_facet ((4,true),0.5000,1956, + Iarg_facet ((5,true),0.6365,924, + Iarg_facet ((1,true),0.6638,846, + Iarg_leaf 1978)))), + Iarg_facet ((2,true),0.5000,1456, + Iarg_facet ((4,true),0.5000,971, + Iarg_facet ((5,true),0.5000,1588, + Iarg_facet ((1,false),0.5000,1507, + Iarg_leaf 1753))))));; + +add_case ("OXLZLEZ 6346351218 3 31", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1888, + Iarg_facet ((2,true),0.5000,1396, + Iarg_facet ((4,true),0.5000,981, + Iarg_facet ((5,true),0.5000,748, + Iarg_facet ((1,true),0.5000,807, + Iarg_facet ((2,true),0.6454,893, + Iarg_facet ((4,true),0.7806,835, + Iarg_leaf 1241))))))), + Iarg_facet ((1,true),0.5000,871, + Iarg_leaf 1736)), + Iarg_facet ((5,true),0.5000,709, + Iarg_facet ((1,true),0.6550,886, + Iarg_leaf 1737))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.6263,901, + Iarg_facet ((1,true),0.6582,832, + Iarg_leaf 1557)), + Iarg_facet ((5,true),0.8113,863, + Iarg_leaf 1355))), + Iarg_facet ((2,true),0.5000,1761, + Iarg_facet ((4,true),0.5000,1056, + Iarg_facet ((5,true),0.5000,1868, + Iarg_facet ((1,false),0.5000,1267, + Iarg_leaf 1482))))));; + +add_case ("GLFVCVK4 2477216213 y4subcrit split(1/4)", + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1519, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6280,936, + Iarg_facet ((3,true),0.6807,747, + Iarg_leaf 1546)), + Iarg_facet ((2,true),0.6400,829, + Iarg_leaf 1161))), + Iarg_facet ((5,true),0.5000,761, + Iarg_facet ((1,true),0.5000,1145, + Iarg_leaf 1286))), + Iarg_facet ((4,true),0.5000,907, + Iarg_leaf 1957)), + Iarg_facet ((3,true),0.5000,1220, + Iarg_facet ((4,true),0.5000,1030, + Iarg_leaf 1790))));; + +add_case ("OXLZLEZ 6346351218 3 28", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1937, + Iarg_facet ((2,true),0.5000,1434, + Iarg_facet ((4,true),0.5000,996, + Iarg_facet ((5,true),0.5000,766, + Iarg_facet ((1,true),0.5000,783, + Iarg_facet ((2,true),0.6523,810, + Iarg_leaf 1428)))))), + Iarg_facet ((1,true),0.5000,875, + Iarg_leaf 1869)), + Iarg_facet ((5,true),0.6369,901, + Iarg_facet ((1,true),0.6695,809, + Iarg_leaf 1614))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.6086,895, + Iarg_facet ((1,true),0.6617,847, + Iarg_leaf 1706)), + Iarg_facet ((5,true),0.7944,760, + Iarg_leaf 1340))), + Iarg_facet ((2,true),0.5000,1596, + Iarg_facet ((4,true),0.5000,1032, + Iarg_facet ((5,true),0.5000,1691, + Iarg_facet ((1,false),0.5000,1314, + Iarg_leaf 1576))))));; + +add_case ("OXLZLEZ 6346351218 3 15", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1790, + Iarg_facet ((4,true),0.5000,1201, + Iarg_facet ((5,true),0.5000,903, + Iarg_facet ((1,true),0.5000,820, + Iarg_leaf 1769)))), + Iarg_facet ((2,true),0.6183,877, + Iarg_leaf 1525)), + Iarg_facet ((1,true),0.5000,1079, + Iarg_facet ((2,true),0.6585,778, + Iarg_leaf 1353))), + Iarg_facet ((5,true),0.5000,770, + Iarg_facet ((1,true),0.5000,838, + Iarg_facet ((2,true),0.5000,818, + Iarg_leaf 1724)))), + Iarg_facet ((4,true),0.5000,1987, + Iarg_facet ((5,true),0.5000,954, + Iarg_facet ((1,true),0.5000,777, + Iarg_facet ((2,false),0.5000,1314, + Iarg_leaf 1349))))), + Iarg_facet ((2,true),0.5000,1883, + Iarg_facet ((4,true),0.5000,1380, + Iarg_facet ((5,true),0.5000,1514, + Iarg_facet ((1,true),0.5000,1720, + Iarg_leaf 1737))))));; + +add_case ("PEMKWKU split(1/2)", + Iarg_bisect (1, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_facet ((2,true),0.5000,1207, + Iarg_leaf 1990), + Iarg_facet ((2,true),0.5000,1558, + Iarg_facet ((4,true),0.5000,1252, + Iarg_leaf 1436))), + Iarg_facet ((5,true),0.5000,1090, + Iarg_leaf 1643)), + Iarg_facet ((3,true),0.5000,1321, + Iarg_facet ((5,true),0.5000,725, + Iarg_facet ((2,true),0.5000,1406, + Iarg_facet ((4,false),0.5000,1407, + Iarg_leaf 1470))))));; + +add_case ("QITNPEAv2 4003532128 split(0/2)", + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6975,1002, + Iarg_facet ((4,true),0.7712,792, + Iarg_leaf 1248)), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1923, + Iarg_facet ((5,true),0.7675,979, + Iarg_leaf 1163)), + Iarg_facet ((4,true),0.6591,947, + Iarg_leaf 1440))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.7356,1022, + Iarg_facet ((4,true),0.7930,763, + Iarg_leaf 1686)), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1931, + Iarg_facet ((5,true),0.7495,787, + Iarg_leaf 847)), + Iarg_facet ((4,true),0.6676,1117, + Iarg_leaf 1312)))));; + +add_case ("FHBVYXZ a split(0/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1772, + Iarg_facet ((1,true),0.5000,1192, + Iarg_facet ((2,true),0.6545,915, + Iarg_leaf 1235))), + Iarg_facet ((5,false),0.5000,962, + Iarg_leaf 1139)), + Iarg_facet ((4,true),0.5000,1131, + Iarg_facet ((5,false),0.5000,1470, + Iarg_leaf 1918))), + Iarg_facet ((3,true),0.5000,1766, + Iarg_facet ((4,true),0.5000,1177, + Iarg_facet ((5,false),0.5000,1024, + Iarg_leaf 1202)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1864, + Iarg_facet ((5,true),0.5000,1650, + Iarg_facet ((1,true),0.5000,1694, + Iarg_leaf 1906))), + Iarg_facet ((4,true),0.5000,847, + Iarg_facet ((5,true),0.6163,959, + Iarg_leaf 1740))), + Iarg_facet ((3,true),0.5000,1415, + Iarg_facet ((4,true),0.5000,955, + Iarg_facet ((5,true),0.6271,933, + Iarg_leaf 1072))))));; + +add_case ("3862621143 side", + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1730, + Iarg_facet ((3,true),0.5000,1729, + Iarg_facet ((5,true),0.6651,853, + Iarg_facet ((4,true),0.6290,901, + Iarg_leaf 1102)))), + Iarg_facet ((2,true),0.5000,970, + Iarg_facet ((3,true),0.5000,806, + Iarg_leaf 1253))), + Iarg_facet ((1,true),0.5000,1660, + Iarg_facet ((2,true),0.5000,1224, + Iarg_facet ((3,true),0.5000,1205, + Iarg_leaf 1880)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1396, + Iarg_facet ((3,true),0.5000,1137, + Iarg_facet ((5,true),0.6403,911, + Iarg_leaf 1467))), + Iarg_facet ((2,true),0.5000,1115, + Iarg_facet ((3,true),0.5000,780, + Iarg_leaf 1420))), + Iarg_facet ((1,true),0.5000,1939, + Iarg_facet ((2,true),0.5000,762, + Iarg_leaf 1810)))));; + +add_case ("7439076204", + Iarg_facet ((3,true),0.5000,1224, + Iarg_bisect (4, + Iarg_facet ((5,false),0.6728,938, + Iarg_facet ((3,true),0.5000,1514, + Iarg_bisect (4, + Iarg_facet ((0,true),0.9261,968, + Iarg_leaf 1199), + Iarg_facet ((0,true),0.8231,869, + Iarg_facet ((1,true),0.8116,834, + Iarg_leaf 1535))))), + Iarg_bisect (5, + Iarg_facet ((4,false),0.5000,1131, + Iarg_facet ((3,true),0.5000,1524, + Iarg_bisect (5, + Iarg_facet ((0,true),0.8913,734, + Iarg_leaf 1456), + Iarg_facet ((0,true),0.8336,881, + Iarg_facet ((1,false),0.6601,968, + Iarg_leaf 1793))))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1636, + Iarg_facet ((3,true),0.6575,956, + Iarg_facet ((0,true),0.7801,851, + Iarg_leaf 1675))), + Iarg_bisect (5, + Iarg_facet ((3,true),0.6575,955, + Iarg_facet ((0,true),0.7983,932, + Iarg_leaf 1507)), + Iarg_facet ((3,true),0.5926,776, + Iarg_facet ((0,true),0.5000,716, + Iarg_facet ((1,false),0.5000,1003, + Iarg_leaf 1930)))))))));; + +add_case ("GLFVCVK4 2477216213 split(33/64)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1535, + Iarg_facet ((2,true),0.5000,869, + Iarg_facet ((3,true),0.6483,893, + Iarg_leaf 1428))), + Iarg_facet ((1,true),0.5000,1013, + Iarg_leaf 1806)), + Iarg_facet ((5,true),0.5000,944, + Iarg_leaf 1280)), + Iarg_facet ((4,true),0.5000,992, + Iarg_facet ((5,true),0.5000,1177, + Iarg_facet ((1,true),0.5000,738, + Iarg_leaf 1492)))), + Iarg_facet ((3,true),0.5000,1719, + Iarg_facet ((4,true),0.5000,1404, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,821, + Iarg_leaf 1603), + Iarg_facet ((1,true),0.5000,817, + Iarg_leaf 1554))))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1815, + Iarg_facet ((4,true),0.5000,1174, + Iarg_facet ((5,true),0.5000,1298, + Iarg_leaf 1713))), + Iarg_facet ((3,true),0.5000,762, + Iarg_facet ((4,true),0.6596,790, + Iarg_leaf 1338)))));; + +add_case ("GLFVCVK4 2477216213 split(48/64)", + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1124, + Iarg_facet ((3,true),0.5000,921, + Iarg_facet ((4,true),0.6180,912, + Iarg_leaf 1672))), + Iarg_facet ((2,true),0.5000,998, + Iarg_leaf 1968)), + Iarg_facet ((1,true),0.5000,1341, + Iarg_leaf 1815)), + Iarg_facet ((5,true),0.5000,1473, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,754, + Iarg_leaf 1645), + Iarg_facet ((2,true),0.5000,845, + Iarg_leaf 1612)))), + Iarg_facet ((4,true),0.5000,1788, + Iarg_facet ((5,true),0.5000,1311, + Iarg_facet ((1,true),0.5000,1221, + Iarg_facet ((2,true),0.5000,727, + Iarg_leaf 1527))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1271, + Iarg_facet ((1,true),0.5000,1052, + Iarg_leaf 1337)), + Iarg_facet ((5,true),0.6807,839, + Iarg_leaf 1152)), + Iarg_facet ((4,true),0.5000,713, + Iarg_leaf 1935))));; + +add_case ("OXLZLEZ 6346351218 3 27", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1712, + Iarg_facet ((4,true),0.5000,1203, + Iarg_facet ((5,true),0.5000,923, + Iarg_facet ((1,true),0.5000,973, + Iarg_facet ((2,true),0.6203,973, + Iarg_leaf 1954))))), + Iarg_facet ((2,true),0.6506,836, + Iarg_leaf 1362)), + Iarg_facet ((1,true),0.5000,994, + Iarg_facet ((2,true),0.6803,722, + Iarg_leaf 1576))), + Iarg_facet ((5,true),0.5000,718, + Iarg_facet ((1,true),0.6014,898, + Iarg_facet ((2,true),0.5000,758, + Iarg_leaf 1763)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,723, + Iarg_facet ((1,true),0.5000,701, + Iarg_facet ((2,false),0.5000,1201, + Iarg_leaf 1573))), + Iarg_facet ((5,true),0.7858,765, + Iarg_leaf 1497))), + Iarg_facet ((2,true),0.5000,1759, + Iarg_facet ((4,true),0.5000,1121, + Iarg_facet ((5,true),0.5000,1874, + Iarg_facet ((1,false),0.5000,1560, + Iarg_leaf 1920))))));; + +add_case ("OXLZLEZ 6346351218 4 15", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1365, + Iarg_facet ((5,true),0.5000,1013, + Iarg_facet ((1,true),0.5000,884, + Iarg_leaf 1851))), + Iarg_facet ((4,true),0.6310,869, + Iarg_leaf 1124)), + Iarg_facet ((2,true),0.5000,749, + Iarg_facet ((4,true),0.6521,813, + Iarg_leaf 1191))), + Iarg_facet ((1,true),0.5000,1275, + Iarg_facet ((2,true),0.6364,853, + Iarg_leaf 1766))), + Iarg_facet ((5,true),0.5000,870, + Iarg_facet ((1,true),0.5000,959, + Iarg_facet ((2,true),0.5000,978, + Iarg_facet ((4,false),0.5000,1007, + Iarg_leaf 1100))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1093, + Iarg_facet ((1,true),0.5000,847, + Iarg_facet ((2,false),0.5000,1569, + Iarg_leaf 1687))), + Iarg_facet ((5,true),0.7472,885, + Iarg_leaf 1329))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1577, + Iarg_facet ((5,true),0.5000,1893, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6749,725, + Iarg_leaf 1226), + Iarg_facet ((2,true),0.7681,860, + Iarg_leaf 1282)))), + Iarg_facet ((4,true),0.5000,754, + Iarg_leaf 1380))));; + +add_case ("OXLZLEZ 6346351218 2 15", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1358, + Iarg_facet ((5,true),0.5000,1008, + Iarg_facet ((1,true),0.5000,842, + Iarg_leaf 1553))), + Iarg_facet ((4,true),0.6310,870, + Iarg_leaf 1118)), + Iarg_facet ((2,true),0.5000,748, + Iarg_facet ((4,true),0.6537,821, + Iarg_leaf 1180))), + Iarg_facet ((1,true),0.5000,1274, + Iarg_facet ((2,true),0.6361,854, + Iarg_leaf 1742))), + Iarg_facet ((5,true),0.5000,871, + Iarg_facet ((1,true),0.5000,957, + Iarg_facet ((2,true),0.5000,979, + Iarg_facet ((4,false),0.5000,1003, + Iarg_leaf 1077))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1092, + Iarg_facet ((1,true),0.5000,846, + Iarg_facet ((2,false),0.5000,1564, + Iarg_leaf 1663))), + Iarg_facet ((5,true),0.7651,915, + Iarg_leaf 1472))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1578, + Iarg_facet ((5,true),0.5000,1886, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6965,774, + Iarg_leaf 1175), + Iarg_facet ((2,true),0.7755,869, + Iarg_leaf 1191)))), + Iarg_facet ((4,true),0.5000,753, + Iarg_leaf 1383))));; + +add_case ("OXLZLEZ 6346351218 4 5", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1387, + Iarg_facet ((5,true),0.5000,1058, + Iarg_facet ((3,true),0.5000,712, + Iarg_facet ((1,true),0.5000,872, + Iarg_facet ((2,true),0.6866,903, + Iarg_leaf 1078))))), + Iarg_facet ((4,true),0.6533,824, + Iarg_leaf 1141)), + Iarg_facet ((2,true),0.5000,798, + Iarg_facet ((4,true),0.6549,797, + Iarg_leaf 1134))), + Iarg_facet ((1,true),0.5000,1105, + Iarg_leaf 1984)), + Iarg_facet ((5,true),0.5000,1214, + Iarg_facet ((1,true),0.5000,1011, + Iarg_facet ((2,true),0.5000,733, + Iarg_leaf 1383)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1312, + Iarg_facet ((1,true),0.5000,1028, + Iarg_facet ((2,true),0.5000,938, + Iarg_leaf 1236))), + Iarg_facet ((5,true),0.6476,832, + Iarg_leaf 1229))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1955, + Iarg_facet ((5,true),0.5000,1600, + Iarg_facet ((1,true),0.5000,1420, + Iarg_leaf 1765))), + Iarg_facet ((4,true),0.5000,938, + Iarg_leaf 1991))));; + +add_case ("OXLZLEZ 6346351218 3 36", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1961, + Iarg_facet ((4,true),0.5000,1307, + Iarg_facet ((5,true),0.5000,951, + Iarg_facet ((3,true),0.5000,764, + Iarg_leaf 1859)))), + Iarg_facet ((2,true),0.5000,854, + Iarg_leaf 1966)), + Iarg_facet ((1,true),0.5000,1111, + Iarg_facet ((2,true),0.6494,925, + Iarg_leaf 1126))), + Iarg_facet ((5,true),0.5000,980, + Iarg_facet ((1,true),0.5000,1012, + Iarg_facet ((2,true),0.5000,754, + Iarg_leaf 1400)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1072, + Iarg_facet ((1,true),0.5000,1004, + Iarg_facet ((2,true),0.5000,989, + Iarg_leaf 1248))), + Iarg_facet ((5,true),0.6547,731, + Iarg_leaf 1130))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1678, + Iarg_facet ((5,true),0.5000,1405, + Iarg_facet ((1,true),0.5000,1418, + Iarg_leaf 1797))), + Iarg_facet ((4,true),0.5000,868, + Iarg_leaf 1659))));; + +add_case ("OXLZLEZ 6346351218 2 13", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1507, + Iarg_facet ((5,true),0.5000,1074, + Iarg_facet ((1,true),0.5000,1035, + Iarg_leaf 1912))), + Iarg_facet ((4,true),0.6174,929, + Iarg_leaf 1274)), + Iarg_facet ((2,true),0.5000,910, + Iarg_facet ((4,true),0.6255,874, + Iarg_leaf 1320))), + Iarg_facet ((1,true),0.5000,1270, + Iarg_facet ((2,true),0.5000,720, + Iarg_leaf 1886))), + Iarg_facet ((5,true),0.5000,973, + Iarg_facet ((1,true),0.5000,1086, + Iarg_facet ((2,true),0.5000,888, + Iarg_leaf 1904)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1137, + Iarg_facet ((1,true),0.5000,998, + Iarg_facet ((2,true),0.5000,1458, + Iarg_leaf 1531))), + Iarg_facet ((5,true),0.7500,876, + Iarg_leaf 1082))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1621, + Iarg_facet ((5,true),0.5000,1542, + Iarg_facet ((1,true),0.5000,1886, + Iarg_facet ((2,true),0.6554,825, + Iarg_leaf 1221)))), + Iarg_facet ((4,true),0.5000,764, + Iarg_leaf 1488))));; + +add_case ("OXLZLEZ 6346351218 3 6", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1433, + Iarg_facet ((5,true),0.5000,1089, + Iarg_facet ((3,true),0.5000,723, + Iarg_facet ((1,true),0.5000,893, + Iarg_facet ((2,true),0.6366,807, + Iarg_leaf 1165))))), + Iarg_facet ((4,true),0.7545,1091, + Iarg_leaf 960)), + Iarg_facet ((2,true),0.5000,807, + Iarg_facet ((4,true),0.6503,809, + Iarg_leaf 1160))), + Iarg_facet ((1,true),0.5000,1131, + Iarg_facet ((2,true),0.6826,897, + Iarg_leaf 1006))), + Iarg_facet ((5,true),0.5000,1256, + Iarg_facet ((1,true),0.5000,1035, + Iarg_facet ((2,true),0.5000,756, + Iarg_leaf 1423)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1342, + Iarg_facet ((1,true),0.5000,1066, + Iarg_facet ((2,true),0.5000,969, + Iarg_leaf 1268))), + Iarg_facet ((5,true),0.7651,1148, + Iarg_leaf 1023))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1619, + Iarg_facet ((1,true),0.5000,1464, + Iarg_leaf 1818)), + Iarg_facet ((5,true),0.7868,1146, + Iarg_leaf 723)), + Iarg_facet ((4,true),0.5000,981, + Iarg_facet ((5,true),0.6266,896, + Iarg_leaf 1057)))));; + +add_case ("OXLZLEZ 6346351218 4 39", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1412, + Iarg_facet ((5,true),0.5000,1059, + Iarg_facet ((1,true),0.5000,1016, + Iarg_facet ((2,true),0.5000,714, + Iarg_leaf 1813)))), + Iarg_facet ((4,true),0.6291,892, + Iarg_leaf 1180)), + Iarg_facet ((2,true),0.5000,779, + Iarg_facet ((4,true),0.6494,839, + Iarg_leaf 1258))), + Iarg_facet ((1,true),0.5000,1299, + Iarg_facet ((2,true),0.6390,865, + Iarg_leaf 1788))), + Iarg_facet ((5,true),0.5000,914, + Iarg_facet ((1,true),0.5000,942, + Iarg_facet ((2,true),0.5000,1009, + Iarg_facet ((4,false),0.5000,1027, + Iarg_leaf 1128))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1077, + Iarg_facet ((1,true),0.5000,866, + Iarg_facet ((2,false),0.5000,1594, + Iarg_leaf 1736))), + Iarg_facet ((5,true),0.6680,725, + Iarg_leaf 1663))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1564, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6713,747, + Iarg_leaf 1245), + Iarg_facet ((2,true),0.7654,853, + Iarg_leaf 1297)), + Iarg_facet ((1,false),0.5000,997, + Iarg_leaf 1036))), + Iarg_facet ((4,true),0.5000,780, + Iarg_leaf 1443))));; + +add_case ("OXLZLEZ 6346351218 1 35", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1988, + Iarg_facet ((5,true),0.5000,1527, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,900, + Iarg_facet ((2,true),0.6324,979, + Iarg_facet ((4,true),0.7660,864, + Iarg_leaf 1134))), + Iarg_facet ((1,true),0.5000,1216, + Iarg_facet ((2,true),0.5000,907, + Iarg_facet ((4,true),0.6271,997, + Iarg_facet ((5,true),0.6849,764, + Iarg_leaf 1603))))))), + Iarg_facet ((4,true),0.6462,956, + Iarg_leaf 1559)), + Iarg_facet ((2,true),0.5000,882, + Iarg_facet ((4,true),0.6464,901, + Iarg_leaf 1593))), + Iarg_facet ((1,true),0.5000,844, + Iarg_leaf 1908)), + Iarg_facet ((5,true),0.5000,711, + Iarg_facet ((1,true),0.5000,860, + Iarg_leaf 1908))), + Iarg_facet ((4,true),0.5000,1062, + Iarg_facet ((5,true),0.5000,801, + Iarg_facet ((1,true),0.5000,850, + Iarg_leaf 1974)))), + Iarg_facet ((2,true),0.5000,1369, + Iarg_facet ((4,true),0.5000,1016, + Iarg_facet ((5,true),0.5000,805, + Iarg_facet ((1,true),0.5000,1133, + Iarg_leaf 1685))))));; + +add_case ("OXLZLEZ 6346351218 1 34", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1986, + Iarg_facet ((5,true),0.5000,1526, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,902, + Iarg_facet ((2,true),0.6324,982, + Iarg_facet ((4,true),0.7409,800, + Iarg_leaf 1222))), + Iarg_facet ((1,true),0.5000,1218, + Iarg_facet ((2,true),0.5000,908, + Iarg_facet ((4,true),0.6269,997, + Iarg_facet ((5,true),0.6857,755, + Iarg_leaf 1574))))))), + Iarg_facet ((4,true),0.6353,914, + Iarg_leaf 1585)), + Iarg_facet ((2,true),0.5000,882, + Iarg_facet ((4,true),0.6461,900, + Iarg_leaf 1594))), + Iarg_facet ((1,true),0.5000,844, + Iarg_leaf 1910)), + Iarg_facet ((5,true),0.5000,711, + Iarg_facet ((1,true),0.5000,860, + Iarg_leaf 1908))), + Iarg_facet ((4,true),0.5000,1060, + Iarg_facet ((5,true),0.5000,801, + Iarg_facet ((1,true),0.5000,850, + Iarg_leaf 1977)))), + Iarg_facet ((2,true),0.5000,1368, + Iarg_facet ((4,true),0.5000,1019, + Iarg_facet ((5,true),0.5000,805, + Iarg_facet ((1,true),0.5000,1132, + Iarg_leaf 1685))))));; + +add_case ("GLFVCVK4 2477216213 split(40/64)", + Iarg_bisect (1, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (2, + Iarg_facet ((1,true),0.5000,1133, + Iarg_facet ((3,true),0.5000,921, + Iarg_facet ((4,true),0.5000,860, + Iarg_leaf 1998))), + Iarg_facet ((1,true),0.5000,1079, + Iarg_facet ((3,true),0.5000,757, + Iarg_facet ((4,true),0.5000,757, + Iarg_leaf 1424)))), + Iarg_bisect (2, + Iarg_facet ((1,true),0.5000,722, + Iarg_leaf 1646), + Iarg_facet ((1,true),0.5000,817, + Iarg_leaf 1732))), + Iarg_facet ((5,true),0.5000,1712, + Iarg_bisect (2, + Iarg_facet ((1,true),0.5000,800, + Iarg_leaf 1574), + Iarg_facet ((1,true),0.6326,854, + Iarg_leaf 1121)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1274, + Iarg_facet ((2,true),0.5000,1283, + Iarg_facet ((1,true),0.5000,761, + Iarg_leaf 1544))), + Iarg_facet ((5,true),0.6622,737, + Iarg_leaf 977))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1557, + Iarg_facet ((2,true),0.5000,1096, + Iarg_leaf 1367)), + Iarg_facet ((5,true),0.6533,779, + Iarg_leaf 1047)), + Iarg_facet ((4,true),0.5000,806, + Iarg_leaf 1894))));; + +add_case ("7175074394", + Iarg_facet ((0,true),0.7673,911, + Iarg_bisect (1, + Iarg_facet ((2,true),0.9979,925, + Iarg_leaf 1997), + Iarg_facet ((2,true),0.8040,1065, + Iarg_facet ((4,false),0.5000,1448, + Iarg_bisect (1, + Iarg_facet ((4,false),0.5000,1120, + Iarg_bisect (1, + Iarg_facet ((0,true),0.7670,885, + Iarg_facet ((2,true),0.7503,881, + Iarg_facet ((4,false),0.5000,1043, + Iarg_bisect (1, + Iarg_facet ((4,false),0.5000,1105, + Iarg_bisect (1, + Iarg_facet ((0,true),0.7374,966, + Iarg_facet ((2,true),0.7332,892, + Iarg_facet ((4,false),0.5000,1195, + Iarg_facet ((1,true),0.6397,1280, + Iarg_facet ((4,false),0.5000,974, + Iarg_facet ((0,true),0.6165,957, + Iarg_leaf 1238)))))), + Iarg_facet ((0,true),0.5000,775, + Iarg_facet ((2,true),0.6163,1033, + Iarg_leaf 1337)))), + Iarg_facet ((4,true),0.5000,826, + Iarg_facet ((1,true),0.6471,946, + Iarg_leaf 1102)))))), + Iarg_facet ((0,true),0.5000,746, + Iarg_facet ((2,true),0.5000,835, + Iarg_facet ((4,true),0.5000,1372, + Iarg_facet ((1,true),0.5000,899, + Iarg_leaf 1825)))))), + Iarg_facet ((4,true),0.5000,1804, + Iarg_facet ((1,true),0.5000,1252, + Iarg_facet ((0,true),0.7467,937, + Iarg_leaf 1429)))))))));; + +add_case ("OXLZLEZ 6346351218 3 39", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1414, + Iarg_facet ((5,true),0.5000,1059, + Iarg_facet ((1,true),0.5000,1015, + Iarg_facet ((2,true),0.5000,713, + Iarg_leaf 1813)))), + Iarg_facet ((4,true),0.6465,941, + Iarg_leaf 1138)), + Iarg_facet ((2,true),0.5000,778, + Iarg_facet ((4,true),0.6494,838, + Iarg_leaf 1259))), + Iarg_facet ((1,true),0.5000,1301, + Iarg_facet ((2,true),0.6395,868, + Iarg_leaf 1785))), + Iarg_facet ((5,true),0.5000,911, + Iarg_facet ((1,true),0.5000,941, + Iarg_facet ((2,true),0.5000,1009, + Iarg_facet ((4,false),0.5000,1024, + Iarg_leaf 1126))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1077, + Iarg_facet ((1,true),0.5000,868, + Iarg_facet ((2,false),0.5000,1594, + Iarg_leaf 1734))), + Iarg_facet ((5,true),0.6680,726, + Iarg_leaf 1659))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1563, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6711,748, + Iarg_leaf 1245), + Iarg_facet ((2,true),0.7654,852, + Iarg_leaf 1299)), + Iarg_facet ((1,false),0.5000,995, + Iarg_leaf 1036))), + Iarg_facet ((4,true),0.5000,782, + Iarg_leaf 1442))));; + +add_case ("GLFVCVK4 2477216213 split(34/64)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_facet ((1,true),0.5000,1340, + Iarg_facet ((2,true),0.5000,1129, + Iarg_facet ((3,true),0.6434,874, + Iarg_leaf 1441))), + Iarg_facet ((1,true),0.5000,1407, + Iarg_facet ((2,true),0.5000,926, + Iarg_leaf 1734))), + Iarg_facet ((4,true),0.5000,982, + Iarg_leaf 1268)), + Iarg_facet ((5,true),0.5000,988, + Iarg_facet ((4,true),0.5000,1237, + Iarg_facet ((1,true),0.6479,892, + Iarg_leaf 1235)))), + Iarg_bisect (3, + Iarg_facet ((5,true),0.5000,1429, + Iarg_bisect (4, + Iarg_facet ((1,true),0.5000,749, + Iarg_leaf 1562), + Iarg_facet ((1,true),0.5000,762, + Iarg_leaf 1329))), + Iarg_facet ((5,true),0.6578,791, + Iarg_leaf 1040))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1765, + Iarg_facet ((5,true),0.5000,1438, + Iarg_bisect (4, + Iarg_facet ((1,false),0.5000,1069, + Iarg_leaf 1314), + Iarg_facet ((1,false),0.5000,1220, + Iarg_leaf 1365)))), + Iarg_facet ((3,true),0.5000,755, + Iarg_facet ((5,true),0.6533,829, + Iarg_leaf 1556)))));; + +add_case ("OXLZLEZ 6346351218 2 40", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1471, + Iarg_facet ((5,true),0.5000,1099, + Iarg_facet ((1,true),0.5000,1006, + Iarg_facet ((2,true),0.6203,938, + Iarg_leaf 1569)))), + Iarg_facet ((4,true),0.6218,913, + Iarg_leaf 1232)), + Iarg_facet ((2,true),0.5000,793, + Iarg_facet ((4,true),0.6483,830, + Iarg_leaf 1290))), + Iarg_facet ((1,true),0.5000,1307, + Iarg_facet ((2,true),0.6418,842, + Iarg_leaf 1732))), + Iarg_facet ((5,true),0.5000,1059, + Iarg_facet ((1,true),0.5000,940, + Iarg_facet ((2,true),0.5000,1000, + Iarg_facet ((4,false),0.5000,1026, + Iarg_leaf 1072))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1124, + Iarg_facet ((1,true),0.5000,957, + Iarg_facet ((2,false),0.5000,1554, + Iarg_leaf 1627))), + Iarg_facet ((5,true),0.6421,808, + Iarg_leaf 1898))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1717, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6644,753, + Iarg_leaf 1226), + Iarg_facet ((2,true),0.7037,731, + Iarg_leaf 1255)), + Iarg_facet ((1,false),0.5000,1041, + Iarg_leaf 1231))), + Iarg_facet ((4,true),0.5000,927, + Iarg_leaf 1658))));; + +add_case ("OXLZLEZ 6346351218 1 27", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1686, + Iarg_facet ((5,true),0.5000,1306, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1619, + Iarg_facet ((4,true),0.5000,1292, + Iarg_facet ((5,true),0.5000,1039, + Iarg_bisect (3, + Iarg_facet ((1,true),0.6229,901, + Iarg_leaf 1718), + Iarg_facet ((1,true),0.5000,718, + Iarg_facet ((2,true),0.8134,1242, + Iarg_leaf 1204)))))), + Iarg_facet ((2,true),0.6545,804, + Iarg_leaf 1338)))), + Iarg_facet ((4,true),0.6626,768, + Iarg_leaf 1320)), + Iarg_facet ((2,true),0.5000,727, + Iarg_facet ((4,true),0.6768,747, + Iarg_leaf 1388))), + Iarg_facet ((1,true),0.6269,944, + Iarg_leaf 1275)), + Iarg_facet ((5,true),0.5000,816, + Iarg_facet ((1,true),0.6511,949, + Iarg_leaf 1291))), + Iarg_facet ((4,true),0.5000,1018, + Iarg_facet ((5,true),0.6203,926, + Iarg_leaf 1948))), + Iarg_facet ((2,true),0.5000,1537, + Iarg_facet ((4,true),0.5000,930, + Iarg_facet ((5,true),0.5000,723, + Iarg_facet ((1,true),0.5000,997, + Iarg_leaf 1340))))));; + +add_case ("OXLZLEZ 6346351218 2 17", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1472, + Iarg_facet ((5,true),0.5000,1097, + Iarg_facet ((1,true),0.5000,1007, + Iarg_facet ((2,true),0.6301,956, + Iarg_leaf 1555)))), + Iarg_facet ((4,true),0.6221,913, + Iarg_leaf 1232)), + Iarg_facet ((2,true),0.5000,793, + Iarg_facet ((4,true),0.6718,883, + Iarg_leaf 1262))), + Iarg_facet ((1,true),0.5000,1308, + Iarg_facet ((2,true),0.6413,844, + Iarg_leaf 1735))), + Iarg_facet ((5,true),0.5000,1057, + Iarg_facet ((1,true),0.5000,942, + Iarg_facet ((2,true),0.5000,1000, + Iarg_facet ((4,false),0.5000,1025, + Iarg_leaf 1074))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1122, + Iarg_facet ((1,true),0.5000,958, + Iarg_facet ((2,false),0.5000,1555, + Iarg_leaf 1628))), + Iarg_facet ((5,true),0.6658,838, + Iarg_leaf 1831))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1715, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6640,754, + Iarg_leaf 1228), + Iarg_facet ((2,true),0.7500,862, + Iarg_leaf 1172)), + Iarg_facet ((1,false),0.5000,1041, + Iarg_leaf 1230))), + Iarg_facet ((4,true),0.5000,928, + Iarg_leaf 1657))));; + +add_case ("OXLZLEZ 6346351218 2 16", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1468, + Iarg_facet ((5,true),0.5000,1096, + Iarg_facet ((1,true),0.5000,1006, + Iarg_facet ((2,true),0.6383,962, + Iarg_leaf 1542)))), + Iarg_facet ((4,true),0.6265,913, + Iarg_leaf 1219)), + Iarg_facet ((2,true),0.5000,792, + Iarg_facet ((4,true),0.8128,1293, + Iarg_leaf 876))), + Iarg_facet ((1,true),0.5000,1305, + Iarg_facet ((2,true),0.6418,842, + Iarg_leaf 1733))), + Iarg_facet ((5,true),0.5000,1057, + Iarg_facet ((1,true),0.5000,942, + Iarg_facet ((2,true),0.5000,1000, + Iarg_facet ((4,false),0.5000,1026, + Iarg_leaf 1072))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1124, + Iarg_facet ((1,true),0.5000,956, + Iarg_facet ((2,false),0.5000,1553, + Iarg_leaf 1632))), + Iarg_facet ((5,true),0.6421,809, + Iarg_leaf 1894))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1716, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6642,755, + Iarg_leaf 1223), + Iarg_facet ((2,true),0.7597,880, + Iarg_leaf 1228)), + Iarg_facet ((1,false),0.5000,1040, + Iarg_leaf 1232))), + Iarg_facet ((4,true),0.5000,927, + Iarg_leaf 1658))));; + +add_case ("OXLZLEZ 6346351218 3 12", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1789, + Iarg_facet ((5,true),0.5000,1323, + Iarg_facet ((1,true),0.5000,1363, + Iarg_facet ((2,true),0.5000,926, + Iarg_facet ((4,true),0.6441,836, + Iarg_leaf 1134))))), + Iarg_facet ((4,true),0.5000,761, + Iarg_leaf 1873)), + Iarg_facet ((2,true),0.5000,945, + Iarg_facet ((4,true),0.6172,982, + Iarg_leaf 1603))), + Iarg_facet ((1,true),0.5000,1243, + Iarg_facet ((2,true),0.5000,724, + Iarg_facet ((4,true),0.6801,762, + Iarg_leaf 1271)))), + Iarg_facet ((5,true),0.5000,878, + Iarg_facet ((1,true),0.5000,1067, + Iarg_facet ((2,true),0.5000,900, + Iarg_facet ((4,true),0.5000,1018, + Iarg_leaf 1096))))), + Iarg_facet ((4,true),0.5000,1878, + Iarg_facet ((5,true),0.5000,1028, + Iarg_facet ((1,true),0.5000,977, + Iarg_facet ((2,true),0.5000,1514, + Iarg_leaf 1695))))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1456, + Iarg_facet ((5,true),0.5000,1473, + Iarg_facet ((1,true),0.5000,1951, + Iarg_facet ((2,true),0.6547,865, + Iarg_leaf 1343)))), + Iarg_facet ((4,true),0.6195,852, + Iarg_leaf 1108))));; + +add_case ("7550003505 4 4 4", + Iarg_bisect (3, + Iarg_facet ((4,false),0.6731,876, + Iarg_leaf 1155), + Iarg_facet ((4,false),0.5761,1096, + Iarg_facet ((5,false),0.5819,1164, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6242,1260, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,792, + Iarg_facet ((2,true),0.5000,1034, + Iarg_facet ((3,true),0.5000,760, + Iarg_leaf 1304))), + Iarg_facet ((1,true),0.7257,804, + Iarg_facet ((2,true),0.7297,1015, + Iarg_leaf 1183)))), + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1145, + Iarg_facet ((1,true),0.7162,1109, + Iarg_facet ((2,true),0.5000,1284, + Iarg_leaf 1447))), + Iarg_facet ((0,false),0.7818,1041, + Iarg_leaf 1605))), + Iarg_facet ((4,false),0.5026,706, + Iarg_facet ((5,false),0.5000,1175, + Iarg_facet ((0,false),0.5000,848, + Iarg_facet ((1,false),0.5000,1184, + Iarg_facet ((2,false),0.6454,1020, + Iarg_leaf 963))))))))));; + +add_case ("QITNPEA 5400790175 b split(0/4)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,731, + Iarg_facet ((1,true),0.5000,939, + Iarg_facet ((2,true),0.5000,1765, + Iarg_facet ((4,true),0.5000,1023, + Iarg_facet ((5,true),0.8000,733, + Iarg_leaf 1249))))), + Iarg_facet ((5,true),0.8452,821, + Iarg_leaf 870)), + Iarg_facet ((4,true),0.5000,995, + Iarg_facet ((5,true),0.8479,835, + Iarg_leaf 858))), + Iarg_facet ((2,true),0.5000,826, + Iarg_leaf 1538)), + Iarg_facet ((1,true),0.5000,930, + Iarg_leaf 1950)), + Iarg_facet ((5,true),0.5000,1724, + Iarg_facet ((1,true),0.5000,1042, + Iarg_facet ((2,true),0.5000,1236, + Iarg_facet ((4,true),0.5000,930, + Iarg_leaf 1122))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1658, + Iarg_facet ((1,true),0.5000,1038, + Iarg_facet ((2,true),0.5000,1451, + Iarg_leaf 1856))), + Iarg_facet ((5,true),0.5000,1271, + Iarg_facet ((1,true),0.5000,757, + Iarg_leaf 1680)))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1923, + Iarg_facet ((5,true),0.7111,929, + Iarg_facet ((1,true),0.5000,1002, + Iarg_leaf 1170))), + Iarg_facet ((4,true),0.5000,1409, + Iarg_leaf 1985))));; + +add_case ("QITNPEA 2134082733 split(0/4)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1941, + Iarg_facet ((5,true),0.5000,1381, + Iarg_facet ((1,true),0.5000,1221, + Iarg_facet ((2,true),0.5000,835, + Iarg_leaf 1698)))), + Iarg_facet ((4,true),0.5000,882, + Iarg_facet ((5,true),0.6421,871, + Iarg_leaf 1115))), + Iarg_facet ((2,true),0.5000,1239, + Iarg_facet ((4,true),0.5000,914, + Iarg_facet ((5,true),0.8021,1262, + Iarg_leaf 751)))), + Iarg_facet ((1,true),0.5000,1258, + Iarg_facet ((2,true),0.5000,940, + Iarg_facet ((4,true),0.6342,953, + Iarg_leaf 1627)))), + Iarg_facet ((5,true),0.5000,816, + Iarg_facet ((1,true),0.5000,1248, + Iarg_facet ((2,true),0.5000,941, + Iarg_facet ((4,false),0.5000,1340, + Iarg_leaf 1354))))), + Iarg_facet ((4,true),0.5000,1257, + Iarg_facet ((5,true),0.5000,890, + Iarg_facet ((1,true),0.5000,1214, + Iarg_facet ((2,true),0.5000,1877, + Iarg_facet ((4,true),0.6513,842, + Iarg_leaf 1088)))))), + Iarg_facet ((2,true),0.5000,1519, + Iarg_facet ((4,true),0.5000,1146, + Iarg_facet ((5,true),0.5000,973, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,719, + Iarg_facet ((4,true),0.6496,823, + Iarg_leaf 1109)), + Iarg_facet ((2,true),0.6664,819, + Iarg_leaf 1464)))))));; + +add_case ("OXLZLEZ 6346351218 4 4", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1796, + Iarg_facet ((4,true),0.5000,1318, + Iarg_facet ((5,true),0.5000,1038, + Iarg_facet ((3,true),0.5000,1825, + Iarg_facet ((1,true),0.5000,710, + Iarg_facet ((2,true),0.7023,824, + Iarg_leaf 1319)))))), + Iarg_facet ((2,true),0.6516,844, + Iarg_leaf 1420)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1596, + Iarg_facet ((4,true),0.5000,1144, + Iarg_facet ((5,true),0.5000,858, + Iarg_facet ((3,true),0.5000,1337, + Iarg_leaf 1368)))), + Iarg_facet ((2,true),0.6571,893, + Iarg_leaf 1208))), + Iarg_facet ((3,true),0.5000,1721, + Iarg_leaf 1807)), + Iarg_facet ((5,true),0.5000,912, + Iarg_facet ((3,true),0.5000,1740, + Iarg_leaf 1862))), + Iarg_facet ((4,true),0.5000,1517, + Iarg_facet ((5,true),0.5000,963, + Iarg_facet ((3,true),0.5000,1830, + Iarg_leaf 1911)))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1368, + Iarg_facet ((5,true),0.5000,1112, + Iarg_facet ((3,true),0.5000,1801, + Iarg_leaf 1906))), + Iarg_facet ((4,true),0.6575,792, + Iarg_leaf 1102))));; + +add_case ("OXLZLEZ 6346351218 1 32", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1805, + Iarg_facet ((5,true),0.5000,1387, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1697, + Iarg_facet ((4,true),0.5000,1321, + Iarg_facet ((5,true),0.5000,1055, + Iarg_bisect (0, + Iarg_facet ((3,false),0.5000,1243, + Iarg_facet ((1,true),0.6799,728, + Iarg_leaf 1468)), + Iarg_facet ((3,false),0.5000,1235, + Iarg_facet ((1,true),0.6787,730, + Iarg_leaf 1559)))))), + Iarg_facet ((2,true),0.6516,816, + Iarg_leaf 1314)))), + Iarg_facet ((4,true),0.6678,940, + Iarg_leaf 1344)), + Iarg_facet ((2,true),0.5000,864, + Iarg_facet ((4,true),0.6425,815, + Iarg_leaf 1490))), + Iarg_facet ((1,true),0.5000,869, + Iarg_leaf 1850)), + Iarg_facet ((5,true),0.5000,934, + Iarg_facet ((1,true),0.5000,825, + Iarg_leaf 1882))), + Iarg_facet ((4,true),0.5000,1183, + Iarg_facet ((5,true),0.5000,826, + Iarg_facet ((1,true),0.5000,899, + Iarg_leaf 1898)))), + Iarg_facet ((2,true),0.5000,1617, + Iarg_facet ((4,true),0.5000,1058, + Iarg_facet ((5,true),0.5000,900, + Iarg_facet ((1,true),0.5000,1183, + Iarg_leaf 1621))))));; + +add_case ("IXPOTPA split(1/2)", + Iarg_facet ((3,true),0.7959,788, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1123, + Iarg_leaf 1951), + Iarg_facet ((4,true),0.5000,924, + Iarg_leaf 1138)), + Iarg_facet ((2,true),0.5000,833, + Iarg_facet ((4,true),0.7446,719, + Iarg_leaf 1833))), + Iarg_facet ((1,false),0.5000,1252, + Iarg_leaf 1719)), + Iarg_facet ((3,true),0.5000,1619, + Iarg_facet ((1,true),0.6841,1141, + Iarg_leaf 1675))), + Iarg_facet ((5,true),0.5000,1369, + Iarg_facet ((3,true),0.5000,1251, + Iarg_leaf 1938))), + Iarg_facet ((4,true),0.7056,1073, + Iarg_facet ((5,true),0.5000,1098, + Iarg_facet ((3,true),0.5000,1047, + Iarg_leaf 1787)))), + Iarg_facet ((2,true),0.5000,1503, + Iarg_facet ((4,true),0.5000,1395, + Iarg_facet ((5,true),0.8053,1114, + Iarg_facet ((3,true),0.5000,1024, + Iarg_leaf 1980))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1906, + Iarg_facet ((5,true),0.5000,1031, + Iarg_leaf 1043)), + Iarg_facet ((4,true),0.7297,958, + Iarg_leaf 1472)), + Iarg_facet ((2,true),0.5000,1165, + Iarg_facet ((4,false),0.5000,1084, + Iarg_leaf 1168))))));; + +add_case ("7726998381", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1385, + Iarg_facet ((0,true),0.5000,1510, + Iarg_facet ((1,true),0.5000,898, + Iarg_facet ((2,true),0.6549,801, + Iarg_leaf 1155)))), + Iarg_facet ((5,true),0.5000,748, + Iarg_leaf 1382)), + Iarg_facet ((4,true),0.5000,1484, + Iarg_facet ((5,true),0.5000,751, + Iarg_leaf 1377))), + Iarg_facet ((3,true),0.5000,1568, + Iarg_facet ((4,true),0.5000,1028, + Iarg_facet ((5,true),0.5000,1232, + Iarg_leaf 1811)))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1568, + Iarg_facet ((4,true),0.5000,1426, + Iarg_facet ((5,true),0.6313,939, + Iarg_leaf 1430))), + Iarg_facet ((3,true),0.5000,1075, + Iarg_facet ((4,true),0.5000,770, + Iarg_facet ((5,true),0.7520,977, + Iarg_leaf 1112))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1884, + Iarg_facet ((4,true),0.5000,1005, + Iarg_facet ((5,true),0.6263,918, + Iarg_leaf 1438))), + Iarg_facet ((3,true),0.5000,997, + Iarg_facet ((4,true),0.5000,778, + Iarg_facet ((5,true),0.6501,744, + Iarg_leaf 1194)))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,970, + Iarg_facet ((4,true),0.5000,759, + Iarg_facet ((5,true),0.6439,894, + Iarg_leaf 1149))), + Iarg_facet ((3,true),0.5000,707, + Iarg_facet ((4,true),0.6626,836, + Iarg_leaf 1918))))));; + +add_case ("OXLZLEZ 6346351218 3 13", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1812, + Iarg_facet ((5,true),0.5000,1361, + Iarg_facet ((1,true),0.5000,1176, + Iarg_facet ((2,true),0.5000,759, + Iarg_leaf 1398)))), + Iarg_facet ((4,true),0.5000,848, + Iarg_leaf 1938)), + Iarg_facet ((2,true),0.5000,974, + Iarg_facet ((4,true),0.5000,777, + Iarg_facet ((5,true),0.6369,895, + Iarg_leaf 1084)))), + Iarg_facet ((1,true),0.5000,1552, + Iarg_facet ((2,true),0.5000,775, + Iarg_facet ((4,true),0.7840,1104, + Iarg_leaf 1425)))), + Iarg_facet ((5,true),0.5000,1055, + Iarg_facet ((1,true),0.5000,1149, + Iarg_facet ((2,true),0.5000,1160, + Iarg_facet ((4,false),0.5000,1261, + Iarg_leaf 1289))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1290, + Iarg_facet ((1,true),0.5000,1026, + Iarg_facet ((2,false),0.5000,1966, + Iarg_leaf 1983))), + Iarg_facet ((5,true),0.6189,817, + Iarg_leaf 1799))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1906, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6533,899, + Iarg_leaf 1567), + Iarg_facet ((2,true),0.6713,730, + Iarg_leaf 1641)), + Iarg_facet ((1,false),0.5000,1110, + Iarg_leaf 1131))), + Iarg_facet ((4,true),0.5000,949, + Iarg_leaf 1723))));; + +add_case ("OXLZLEZ 6346351218 4 11", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1995, + Iarg_facet ((5,true),0.5000,1474, + Iarg_facet ((1,true),0.5000,1455, + Iarg_facet ((2,true),0.5000,976, + Iarg_facet ((4,true),0.6275,851, + Iarg_leaf 1196))))), + Iarg_facet ((4,true),0.5000,863, + Iarg_facet ((5,true),0.6483,811, + Iarg_leaf 1200))), + Iarg_facet ((2,true),0.5000,1079, + Iarg_facet ((4,true),0.5000,810, + Iarg_facet ((5,true),0.6361,913, + Iarg_leaf 1206)))), + Iarg_facet ((1,true),0.5000,1445, + Iarg_facet ((2,true),0.5000,820, + Iarg_facet ((4,true),0.6839,851, + Iarg_leaf 1515)))), + Iarg_facet ((5,true),0.5000,976, + Iarg_facet ((1,true),0.5000,1183, + Iarg_facet ((2,true),0.5000,1056, + Iarg_facet ((4,false),0.5000,1233, + Iarg_leaf 1234))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1150, + Iarg_facet ((1,true),0.5000,1077, + Iarg_facet ((2,true),0.5000,1873, + Iarg_leaf 1924))), + Iarg_facet ((5,true),0.7495,876, + Iarg_leaf 1179))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1625, + Iarg_facet ((5,true),0.5000,1673, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6423,923, + Iarg_leaf 1578), + Iarg_facet ((2,true),0.6695,758, + Iarg_leaf 1515)))), + Iarg_facet ((4,true),0.5000,764, + Iarg_leaf 1493))));; + + +(* RESTART HERE *) + +add_case ("QITNPEAv2 4003532128 split(1/2)", + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5587,869, + Iarg_facet ((4,true),0.5000,706, + Iarg_facet ((5,true),0.6687,1445, + Iarg_bisect (3, + Iarg_facet ((1,false),0.5000,1292, + Iarg_facet ((4,true),0.5000,1083, + Iarg_leaf 1110)), + Iarg_facet ((1,false),0.5000,1184, + Iarg_facet ((4,true),0.5000,1064, + Iarg_leaf 1171)))))), + Iarg_facet ((2,true),0.5000,1421, + Iarg_facet ((4,true),0.5000,1353, + Iarg_facet ((5,true),0.8238,1099, + Iarg_leaf 1585)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5717,835, + Iarg_facet ((4,true),0.6209,961, + Iarg_facet ((5,true),0.6331,853, + Iarg_bisect (3, + Iarg_facet ((1,false),0.5000,1468, + Iarg_facet ((3,false),0.5000,1036, + Iarg_leaf 1109)), + Iarg_bisect (1, + Iarg_facet ((3,false),0.5000,1371, + Iarg_facet ((2,true),0.8587,1252, + Iarg_facet ((4,true),0.9560,844, + Iarg_leaf 552))), + Iarg_bisect (3, + Iarg_facet ((2,true),0.8293,701, + Iarg_leaf 801), + Iarg_facet ((2,true),0.9416,1058, + Iarg_leaf 312))))))), + Iarg_facet ((2,true),0.5000,1322, + Iarg_facet ((4,true),0.5000,1262, + Iarg_facet ((5,true),0.8097,1052, + Iarg_facet ((3,false),0.5000,883, + Iarg_leaf 1460)))))));; + +add_case ("IXPOTPA split(0/2)", + Iarg_facet ((3,true),0.7636,1108, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,930, + Iarg_leaf 1673), + Iarg_facet ((3,true),0.5000,1041, + Iarg_leaf 1042)), + Iarg_facet ((5,true),0.5000,1686, + Iarg_facet ((3,true),0.5000,1018, + Iarg_leaf 1020))), + Iarg_facet ((4,true),0.5000,727, + Iarg_facet ((5,true),0.5000,1535, + Iarg_facet ((3,false),0.5000,1033, + Iarg_leaf 1040)))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1735, + Iarg_facet ((5,true),0.7472,862, + Iarg_leaf 1008)), + Iarg_facet ((4,true),0.7569,1226, + Iarg_leaf 1025))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1371, + Iarg_facet ((5,false),0.5000,1081, + Iarg_leaf 1618)), + Iarg_facet ((4,true),0.5000,776, + Iarg_facet ((5,false),0.5000,1103, + Iarg_leaf 1756))), + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1311, + Iarg_facet ((5,true),0.6896,914, + Iarg_leaf 1259)), + Iarg_facet ((4,true),0.6401,917, + Iarg_leaf 1487))))));; + +add_case ("GLFVCVK4a 8328676778 split(3/4)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1985, + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,1669, + Iarg_facet ((1,true),0.6313,951, + Iarg_leaf 1556)), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,803, + Iarg_facet ((2,true),0.6496,912, + Iarg_leaf 1576)), + Iarg_facet ((1,true),0.6224,922, + Iarg_leaf 1372)))), + Iarg_facet ((5,true),0.6619,951, + Iarg_leaf 1558)), + Iarg_facet ((4,true),0.5000,745, + Iarg_facet ((5,true),0.6702,892, + Iarg_leaf 1600))), + Iarg_facet ((2,true),0.5000,1120, + Iarg_facet ((4,true),0.5000,700, + Iarg_facet ((5,true),0.6580,956, + Iarg_leaf 1650)))), + Iarg_facet ((1,true),0.5000,1144, + Iarg_facet ((2,true),0.5000,736, + Iarg_leaf 1561))), + Iarg_facet ((5,true),0.5000,1219, + Iarg_facet ((1,true),0.5000,1232, + Iarg_facet ((2,true),0.5000,751, + Iarg_leaf 1565)))), + Iarg_facet ((4,true),0.5000,1809, + Iarg_facet ((5,true),0.5000,1395, + Iarg_facet ((1,true),0.5000,1262, + Iarg_facet ((2,true),0.5000,920, + Iarg_leaf 1443))))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1821, + Iarg_facet ((5,true),0.5000,1314, + Iarg_facet ((1,true),0.5000,1436, + Iarg_facet ((2,true),0.5000,702, + Iarg_leaf 1460)))), + Iarg_facet ((4,true),0.6556,879, + Iarg_leaf 1484))));; + +add_case ("OXLZLEZ 6346351218 2 26", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1625, + Iarg_facet ((5,true),0.5000,1249, + Iarg_facet ((1,true),0.5000,1236, + Iarg_facet ((2,true),0.5000,855, + Iarg_facet ((4,true),0.6486,834, + Iarg_leaf 1509))))), + Iarg_facet ((4,true),0.6396,964, + Iarg_leaf 1325)), + Iarg_facet ((2,true),0.5000,825, + Iarg_facet ((4,true),0.6474,854, + Iarg_leaf 1420))), + Iarg_facet ((1,true),0.5000,1419, + Iarg_facet ((2,true),0.6302,885, + Iarg_leaf 1936))), + Iarg_facet ((5,true),0.5000,1244, + Iarg_facet ((1,true),0.5000,1025, + Iarg_facet ((2,true),0.5000,1077, + Iarg_facet ((4,false),0.5000,1047, + Iarg_leaf 1218))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1300, + Iarg_facet ((1,true),0.5000,1057, + Iarg_facet ((2,false),0.5000,1589, + Iarg_leaf 1861))), + Iarg_facet ((5,true),0.5000,703, + Iarg_facet ((1,true),0.6340,899, + Iarg_leaf 1801)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6864,843, + Iarg_leaf 1184), + Iarg_facet ((2,true),0.6483,743, + Iarg_leaf 1526)), + Iarg_facet ((1,false),0.5000,1204, + Iarg_leaf 1465)), + Iarg_facet ((5,true),0.6201,867, + Iarg_leaf 1045)), + Iarg_facet ((4,true),0.5000,1051, + Iarg_leaf 1944))));; + +add_case ("QITNPEA 2134082733 split(2/4)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1470, + Iarg_facet ((0,true),0.5000,1117, + Iarg_facet ((1,true),0.5000,853, + Iarg_leaf 1506))), + Iarg_facet ((5,true),0.6489,898, + Iarg_leaf 1135)), + Iarg_facet ((4,true),0.5000,951, + Iarg_facet ((5,true),0.6756,945, + Iarg_leaf 1100))), + Iarg_facet ((2,true),0.5000,1358, + Iarg_facet ((4,true),0.5000,903, + Iarg_facet ((5,true),0.6372,957, + Iarg_leaf 1196)))), + Iarg_facet ((1,true),0.5000,1684, + Iarg_facet ((2,true),0.5000,1136, + Iarg_facet ((4,true),0.5000,707, + Iarg_leaf 1763)))), + Iarg_facet ((5,true),0.5000,1420, + Iarg_facet ((1,true),0.5000,1648, + Iarg_facet ((2,true),0.5000,1146, + Iarg_facet ((4,true),0.5000,1194, + Iarg_leaf 1318))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1534, + Iarg_facet ((1,true),0.5000,1567, + Iarg_facet ((2,true),0.5000,1800, + Iarg_facet ((4,true),0.6337,924, + Iarg_leaf 1088)))), + Iarg_facet ((5,true),0.7608,884, + Iarg_leaf 1176))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1975, + Iarg_facet ((5,true),0.5000,1670, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,889, + Iarg_facet ((4,true),0.7587,1158, + Iarg_leaf 893)), + Iarg_facet ((2,true),0.6192,977, + Iarg_leaf 1543)))), + Iarg_facet ((4,true),0.6418,826, + Iarg_leaf 1642))));; + +add_case ("GLFVCVK4 2477216213 y4subcrit split(3/4)", + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1157, + Iarg_facet ((3,true),0.5000,954, + Iarg_facet ((4,true),0.5000,724, + Iarg_facet ((5,true),0.6172,997, + Iarg_leaf 1736)))), + Iarg_facet ((2,true),0.5000,954, + Iarg_leaf 1855)), + Iarg_facet ((1,true),0.5000,1178, + Iarg_leaf 1651)), + Iarg_facet ((5,true),0.5000,1220, + Iarg_facet ((1,true),0.5000,1764, + Iarg_leaf 1925))), + Iarg_facet ((4,true),0.5000,1448, + Iarg_facet ((5,true),0.5000,1123, + Iarg_facet ((1,true),0.5000,1112, + Iarg_leaf 1856)))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1652, + Iarg_facet ((5,true),0.5000,1074, + Iarg_facet ((1,true),0.5000,947, + Iarg_leaf 1223))), + Iarg_facet ((4,true),0.6568,822, + Iarg_leaf 1003))));; + +add_case ("OXLZLEZ 6346351218 2 25", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1760, + Iarg_facet ((5,true),0.5000,1338, + Iarg_facet ((1,true),0.5000,1332, + Iarg_facet ((2,true),0.5000,908, + Iarg_facet ((4,true),0.6337,884, + Iarg_leaf 1991))))), + Iarg_facet ((4,true),0.5000,743, + Iarg_leaf 1800)), + Iarg_facet ((2,true),0.5000,894, + Iarg_facet ((4,true),0.6361,899, + Iarg_leaf 1593))), + Iarg_facet ((1,true),0.5000,1454, + Iarg_facet ((2,true),0.6288,884, + Iarg_facet ((4,true),0.7757,846, + Iarg_leaf 1247)))), + Iarg_facet ((5,true),0.5000,1166, + Iarg_facet ((1,true),0.5000,1012, + Iarg_facet ((2,true),0.5000,1120, + Iarg_facet ((4,false),0.5000,1131, + Iarg_leaf 1250))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1259, + Iarg_facet ((1,true),0.5000,1043, + Iarg_facet ((2,false),0.5000,1686, + Iarg_leaf 1899))), + Iarg_facet ((5,true),0.6029,825, + Iarg_facet ((1,true),0.6592,725, + Iarg_leaf 1578)))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1933, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6543,803, + Iarg_leaf 1381), + Iarg_facet ((2,true),0.6662,749, + Iarg_leaf 1516)), + Iarg_facet ((1,false),0.5000,1202, + Iarg_leaf 1450))), + Iarg_facet ((4,true),0.5000,1019, + Iarg_leaf 1839))));; + +add_case ("OXLZLEZ 6346351218 2 14", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1980, + Iarg_facet ((5,true),0.5000,1473, + Iarg_facet ((1,true),0.5000,1146, + Iarg_leaf 1813))), + Iarg_facet ((4,true),0.5000,953, + Iarg_facet ((5,true),0.6385,846, + Iarg_leaf 1113))), + Iarg_facet ((2,true),0.5000,1080, + Iarg_facet ((4,true),0.5000,855, + Iarg_facet ((5,true),0.5000,719, + Iarg_leaf 1505)))), + Iarg_facet ((1,true),0.5000,1816, + Iarg_facet ((2,true),0.5000,896, + Iarg_facet ((4,true),0.6606,886, + Iarg_leaf 1896)))), + Iarg_facet ((5,true),0.5000,1261, + Iarg_facet ((1,true),0.5000,1360, + Iarg_facet ((2,true),0.5000,1374, + Iarg_facet ((4,true),0.5000,1361, + Iarg_leaf 1414))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1587, + Iarg_facet ((1,true),0.5000,1227, + Iarg_bisect (2, + Iarg_facet ((4,true),0.6163,932, + Iarg_leaf 1209), + Iarg_facet ((4,true),0.5000,735, + Iarg_leaf 1465)))), + Iarg_facet ((5,true),0.5000,780, + Iarg_facet ((1,true),0.6296,915, + Iarg_leaf 1812)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6189,947, + Iarg_leaf 1890), + Iarg_facet ((2,true),0.6540,865, + Iarg_leaf 1857)), + Iarg_facet ((1,false),0.5000,1321, + Iarg_leaf 1398)), + Iarg_facet ((5,true),0.5000,769, + Iarg_leaf 1607)), + Iarg_facet ((4,true),0.5000,1121, + Iarg_facet ((5,true),0.5000,775, + Iarg_leaf 1265)))));; + +add_case ("OXLZLEZ 6346351218 4 13", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1931, + Iarg_facet ((5,true),0.5000,1438, + Iarg_facet ((1,true),0.5000,1189, + Iarg_facet ((2,true),0.5000,774, + Iarg_leaf 1386)))), + Iarg_facet ((4,true),0.5000,929, + Iarg_facet ((5,true),0.7834,1202, + Iarg_leaf 861))), + Iarg_facet ((2,true),0.5000,1073, + Iarg_facet ((4,true),0.5000,855, + Iarg_facet ((5,true),0.6172,978, + Iarg_leaf 1192)))), + Iarg_facet ((1,true),0.5000,1790, + Iarg_facet ((2,true),0.5000,880, + Iarg_facet ((4,true),0.6516,882, + Iarg_facet ((5,false),0.5000,942, + Iarg_leaf 1104))))), + Iarg_facet ((5,true),0.5000,1156, + Iarg_facet ((1,true),0.5000,1308, + Iarg_facet ((2,true),0.5000,1389, + Iarg_facet ((4,false),0.5000,1464, + Iarg_leaf 1550))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1496, + Iarg_facet ((1,true),0.5000,1158, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,702, + Iarg_leaf 1592), + Iarg_facet ((4,true),0.5000,736, + Iarg_leaf 1661)))), + Iarg_facet ((5,true),0.5000,732, + Iarg_facet ((1,true),0.6298,883, + Iarg_leaf 1770)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6313,946, + Iarg_leaf 1890), + Iarg_facet ((2,true),0.6612,868, + Iarg_leaf 1963)), + Iarg_facet ((1,false),0.5000,1300, + Iarg_leaf 1337)), + Iarg_facet ((5,true),0.5000,713, + Iarg_leaf 1512)), + Iarg_facet ((4,true),0.5000,1054, + Iarg_leaf 1872))));; + +add_case ("ZTGIJCF4 0 1 0 0 1821661595 split(3/4)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1913, + Iarg_facet ((2,true),0.5000,1224, + Iarg_facet ((4,true),0.5000,836, + Iarg_facet ((5,true),0.6449,876, + Iarg_leaf 1303)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1736, + Iarg_facet ((4,true),0.5000,1258, + Iarg_facet ((5,true),0.5000,923, + Iarg_facet ((3,false),0.5000,1058, + Iarg_leaf 1664)))), + Iarg_facet ((2,true),0.5000,735, + Iarg_leaf 1739))), + Iarg_facet ((3,true),0.5000,1930, + Iarg_facet ((1,true),0.5000,965, + Iarg_leaf 1418))), + Iarg_facet ((5,true),0.5000,1876, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1047, + Iarg_leaf 1453), + Iarg_facet ((1,true),0.6206,897, + Iarg_leaf 1193)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1060, + Iarg_leaf 1500), + Iarg_facet ((1,true),0.5000,780, + Iarg_leaf 1360)), + Iarg_facet ((3,true),0.5000,944, + Iarg_leaf 1323)), + Iarg_facet ((5,true),0.5000,765, + Iarg_facet ((3,true),0.5000,869, + Iarg_leaf 1340)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1156, + Iarg_leaf 1359), + Iarg_facet ((1,true),0.5000,849, + Iarg_leaf 1243)), + Iarg_facet ((3,true),0.5000,850, + Iarg_leaf 1209)), + Iarg_facet ((5,true),0.5000,804, + Iarg_facet ((3,true),0.5000,943, + Iarg_leaf 1335))), + Iarg_facet ((4,true),0.5000,1136, + Iarg_facet ((5,true),0.5000,909, + Iarg_facet ((3,true),0.5000,1026, + Iarg_leaf 1390))))));; + +add_case ("OXLZLEZ 6346351218 2 38", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1541, + Iarg_facet ((1,true),0.5000,1629, + Iarg_facet ((2,true),0.5000,1084, + Iarg_facet ((4,true),0.5000,719, + Iarg_leaf 1912)))), + Iarg_facet ((5,true),0.6599,811, + Iarg_leaf 1215)), + Iarg_facet ((4,true),0.5000,879, + Iarg_facet ((5,true),0.6476,834, + Iarg_leaf 1253))), + Iarg_facet ((2,true),0.5000,1076, + Iarg_facet ((4,true),0.5000,807, + Iarg_facet ((5,true),0.6310,937, + Iarg_leaf 1278)))), + Iarg_facet ((1,true),0.5000,1437, + Iarg_facet ((2,true),0.5000,822, + Iarg_facet ((4,true),0.6597,858, + Iarg_leaf 1536)))), + Iarg_facet ((5,true),0.5000,994, + Iarg_facet ((1,true),0.5000,1200, + Iarg_facet ((2,true),0.5000,1040, + Iarg_facet ((4,true),0.5000,1199, + Iarg_leaf 1266))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1114, + Iarg_facet ((1,true),0.5000,1098, + Iarg_facet ((2,true),0.5000,1787, + Iarg_leaf 1957))), + Iarg_facet ((5,true),0.7483,887, + Iarg_leaf 1196))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1590, + Iarg_facet ((5,true),0.5000,1684, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6400,932, + Iarg_leaf 1553), + Iarg_facet ((2,true),0.6336,726, + Iarg_leaf 1508)))), + Iarg_facet ((4,true),0.5000,791, + Iarg_leaf 1515))));; + +add_case ("OXLZLEZ 6346351218 4 36", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1542, + Iarg_facet ((1,true),0.5000,1629, + Iarg_facet ((2,true),0.5000,1085, + Iarg_facet ((4,true),0.5000,718, + Iarg_leaf 1913)))), + Iarg_facet ((5,true),0.7743,1063, + Iarg_leaf 978)), + Iarg_facet ((4,true),0.5000,879, + Iarg_facet ((5,true),0.6476,833, + Iarg_leaf 1252))), + Iarg_facet ((2,true),0.5000,1074, + Iarg_facet ((4,true),0.5000,805, + Iarg_facet ((5,true),0.6338,944, + Iarg_leaf 1264)))), + Iarg_facet ((1,true),0.5000,1436, + Iarg_facet ((2,true),0.5000,820, + Iarg_facet ((4,true),0.6669,856, + Iarg_leaf 1512)))), + Iarg_facet ((5,true),0.5000,993, + Iarg_facet ((1,true),0.5000,1199, + Iarg_facet ((2,true),0.5000,1036, + Iarg_facet ((4,true),0.5000,1193, + Iarg_leaf 1266))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1114, + Iarg_facet ((1,true),0.5000,1095, + Iarg_facet ((2,true),0.5000,1785, + Iarg_leaf 1955))), + Iarg_facet ((5,true),0.7479,888, + Iarg_leaf 1196))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1591, + Iarg_facet ((5,true),0.5000,1683, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6400,931, + Iarg_leaf 1553), + Iarg_facet ((2,true),0.6678,767, + Iarg_leaf 1386)))), + Iarg_facet ((4,true),0.5000,795, + Iarg_leaf 1520))));; + +add_case ("OXLZLEZ 6346351218 4 25", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1767, + Iarg_facet ((5,true),0.5000,1343, + Iarg_facet ((1,true),0.5000,1330, + Iarg_facet ((2,true),0.5000,910, + Iarg_facet ((4,true),0.6211,847, + Iarg_facet ((5,true),0.7519,766, + Iarg_leaf 1238)))))), + Iarg_facet ((4,true),0.5000,741, + Iarg_leaf 1803)), + Iarg_facet ((2,true),0.5000,892, + Iarg_facet ((4,true),0.6254,892, + Iarg_leaf 1632))), + Iarg_facet ((1,true),0.5000,1456, + Iarg_facet ((2,true),0.6288,885, + Iarg_facet ((4,true),0.7757,847, + Iarg_leaf 1247)))), + Iarg_facet ((5,true),0.5000,1165, + Iarg_facet ((1,true),0.5000,1013, + Iarg_facet ((2,true),0.5000,1120, + Iarg_facet ((4,false),0.5000,1133, + Iarg_leaf 1256))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1255, + Iarg_facet ((1,true),0.5000,1044, + Iarg_facet ((2,false),0.5000,1686, + Iarg_leaf 1898))), + Iarg_facet ((5,true),0.6282,879, + Iarg_facet ((1,true),0.7409,942, + Iarg_leaf 1337)))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1936, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.7809,1148, + Iarg_leaf 1089), + Iarg_facet ((2,true),0.6664,749, + Iarg_leaf 1520)), + Iarg_facet ((1,false),0.5000,1201, + Iarg_leaf 1451))), + Iarg_facet ((4,true),0.5000,1018, + Iarg_leaf 1838))));; + +add_case ("OXLZLEZ 6346351218 4 12", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1928, + Iarg_facet ((5,true),0.5000,1439, + Iarg_facet ((1,true),0.5000,1196, + Iarg_facet ((2,true),0.5000,773, + Iarg_leaf 1383)))), + Iarg_facet ((4,true),0.5000,934, + Iarg_facet ((5,true),0.6334,847, + Iarg_leaf 1198))), + Iarg_facet ((2,true),0.5000,1074, + Iarg_facet ((4,true),0.5000,855, + Iarg_facet ((5,true),0.6166,978, + Iarg_leaf 1196)))), + Iarg_facet ((1,true),0.5000,1792, + Iarg_facet ((2,true),0.5000,882, + Iarg_facet ((4,true),0.6612,908, + Iarg_facet ((5,false),0.5000,923, + Iarg_leaf 1087))))), + Iarg_facet ((5,true),0.5000,1157, + Iarg_facet ((1,true),0.5000,1314, + Iarg_facet ((2,true),0.5000,1388, + Iarg_facet ((4,false),0.5000,1471, + Iarg_leaf 1559))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1500, + Iarg_facet ((1,true),0.5000,1161, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,706, + Iarg_leaf 1600), + Iarg_facet ((4,true),0.5000,737, + Iarg_leaf 1665)))), + Iarg_facet ((5,true),0.5000,734, + Iarg_facet ((1,true),0.6387,908, + Iarg_leaf 1749)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6310,947, + Iarg_leaf 1896), + Iarg_facet ((2,true),0.6615,868, + Iarg_leaf 1962)), + Iarg_facet ((1,false),0.5000,1298, + Iarg_leaf 1341)), + Iarg_facet ((5,true),0.5000,716, + Iarg_leaf 1517)), + Iarg_facet ((4,true),0.5000,1063, + Iarg_leaf 1878))));; + +add_case ("OXLZLEZ 6346351218 2 5", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1433, + Iarg_facet ((4,true),0.5000,1027, + Iarg_facet ((5,true),0.5000,806, + Iarg_facet ((1,true),0.5000,865, + Iarg_facet ((2,true),0.6444,799, + Iarg_leaf 1155))))), + Iarg_facet ((3,true),0.6398,817, + Iarg_leaf 1191)), + Iarg_facet ((2,true),0.5000,819, + Iarg_facet ((3,true),0.6423,824, + Iarg_leaf 1190))), + Iarg_facet ((1,true),0.5000,1057, + Iarg_leaf 1967)), + Iarg_facet ((5,true),0.5000,1091, + Iarg_facet ((1,true),0.5000,976, + Iarg_facet ((2,true),0.5000,756, + Iarg_leaf 1412)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1562, + Iarg_facet ((1,true),0.5000,1582, + Iarg_facet ((2,true),0.5000,1049, + Iarg_facet ((3,true),0.5000,1030, + Iarg_leaf 1190)))), + Iarg_facet ((5,true),0.6721,784, + Iarg_leaf 1185))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1200, + Iarg_facet ((1,true),0.5000,1080, + Iarg_facet ((2,true),0.5000,976, + Iarg_leaf 1294))), + Iarg_facet ((5,true),0.6474,850, + Iarg_leaf 1133)), + Iarg_facet ((4,true),0.5000,792, + Iarg_facet ((5,true),0.7643,1058, + Iarg_leaf 1139)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1846, + Iarg_facet ((5,true),0.5000,1476, + Iarg_facet ((1,true),0.5000,1425, + Iarg_leaf 1840))), + Iarg_facet ((4,true),0.5000,727, + Iarg_facet ((5,true),0.6421,881, + Iarg_leaf 1380))), + Iarg_facet ((3,true),0.5000,1157, + Iarg_facet ((4,true),0.5000,936, + Iarg_facet ((5,true),0.6274,923, + Iarg_leaf 1034))))));; + +add_case ("OXLZLEZ 6346351218 2 4", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1461, + Iarg_facet ((4,true),0.5000,1080, + Iarg_facet ((5,true),0.5000,837, + Iarg_facet ((1,true),0.5000,904, + Iarg_facet ((2,true),0.6405,808, + Iarg_leaf 1185))))), + Iarg_facet ((3,true),0.6358,824, + Iarg_leaf 1253)), + Iarg_facet ((2,true),0.5000,859, + Iarg_facet ((3,true),0.6385,830, + Iarg_leaf 1262))), + Iarg_facet ((1,true),0.5000,1091, + Iarg_facet ((2,true),0.6423,819, + Iarg_leaf 1169))), + Iarg_facet ((5,true),0.5000,1116, + Iarg_facet ((1,true),0.5000,1008, + Iarg_facet ((2,true),0.5000,770, + Iarg_leaf 1496)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1578, + Iarg_facet ((1,true),0.5000,1616, + Iarg_facet ((2,true),0.5000,1071, + Iarg_facet ((3,true),0.5000,1049, + Iarg_leaf 1199)))), + Iarg_facet ((5,true),0.7148,873, + Iarg_leaf 1098))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1230, + Iarg_facet ((1,true),0.5000,1115, + Iarg_facet ((2,true),0.5000,1028, + Iarg_leaf 1345))), + Iarg_facet ((5,true),0.6456,863, + Iarg_leaf 1203)), + Iarg_facet ((4,true),0.5000,808, + Iarg_facet ((5,true),0.6594,788, + Iarg_leaf 1358)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1895, + Iarg_facet ((5,true),0.5000,1503, + Iarg_facet ((1,true),0.5000,1494, + Iarg_leaf 1911))), + Iarg_facet ((4,true),0.5000,746, + Iarg_facet ((5,true),0.6374,888, + Iarg_leaf 1409))), + Iarg_facet ((3,true),0.5000,1213, + Iarg_facet ((4,true),0.5000,956, + Iarg_facet ((5,true),0.6500,990, + Iarg_leaf 1018))))));; + +add_case ("QITNPEA 5653753305 split(0/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1915, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,830, + Iarg_facet ((5,true),0.6269,956, + Iarg_facet ((1,true),0.6449,850, + Iarg_leaf 1245))), + Iarg_facet ((4,true),0.7998,1103, + Iarg_leaf 890))), + Iarg_facet ((2,true),0.5000,725, + Iarg_leaf 1898)), + Iarg_facet ((1,true),0.5000,854, + Iarg_leaf 1651)), + Iarg_facet ((5,true),0.5000,904, + Iarg_facet ((1,true),0.5000,806, + Iarg_leaf 1775))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1940, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1831, + Iarg_bisect (3, + Iarg_facet ((4,true),0.6558,880, + Iarg_leaf 1448), + Iarg_facet ((4,true),0.5000,784, + Iarg_facet ((5,true),0.6484,903, + Iarg_facet ((1,true),0.6573,817, + Iarg_leaf 1346))))), + Iarg_facet ((2,true),0.5000,712, + Iarg_leaf 1826))), + Iarg_facet ((5,true),0.6669,819, + Iarg_leaf 1582))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1812, + Iarg_facet ((5,true),0.5000,941, + Iarg_facet ((1,true),0.5000,909, + Iarg_leaf 1866))), + Iarg_facet ((4,true),0.5000,829, + Iarg_facet ((5,true),0.6589,820, + Iarg_leaf 1658)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1508, + Iarg_facet ((5,true),0.5000,1266, + Iarg_facet ((1,true),0.5000,1182, + Iarg_leaf 1553))), + Iarg_facet ((4,true),0.5000,784, + Iarg_facet ((5,true),0.6288,951, + Iarg_leaf 1835))), + Iarg_facet ((3,true),0.5000,1263, + Iarg_facet ((4,true),0.5000,769, + Iarg_leaf 1712)))));; + +add_case ("BIXPCGW 9455898160 split(0/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1808, + Iarg_facet ((4,true),0.5000,1032, + Iarg_facet ((5,true),0.5000,801, + Iarg_facet ((1,true),0.5000,868, + Iarg_facet ((2,true),0.6426,816, + Iarg_leaf 1332))))), + Iarg_facet ((3,true),0.6246,875, + Iarg_leaf 1161)), + Iarg_facet ((2,true),0.5000,805, + Iarg_facet ((3,true),0.6257,887, + Iarg_leaf 1153))), + Iarg_facet ((1,true),0.5000,986, + Iarg_leaf 1866)), + Iarg_facet ((5,true),0.5000,1005, + Iarg_facet ((1,true),0.5000,880, + Iarg_facet ((2,true),0.5000,700, + Iarg_leaf 1386)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1755, + Iarg_facet ((1,true),0.5000,1990, + Iarg_facet ((2,true),0.5000,1384, + Iarg_facet ((3,false),0.5000,1705, + Iarg_leaf 1877)))), + Iarg_facet ((5,true),0.8056,1155, + Iarg_leaf 1003))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1060, + Iarg_facet ((1,true),0.5000,979, + Iarg_facet ((2,true),0.5000,919, + Iarg_leaf 1234))), + Iarg_facet ((5,true),0.6596,796, + Iarg_leaf 1103)), + Iarg_facet ((4,true),0.5000,845, + Iarg_facet ((5,true),0.6552,800, + Iarg_leaf 1470)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1662, + Iarg_facet ((5,true),0.5000,1387, + Iarg_facet ((1,true),0.5000,1331, + Iarg_leaf 1741))), + Iarg_facet ((4,true),0.5000,759, + Iarg_facet ((5,true),0.6340,909, + Iarg_leaf 1554))), + Iarg_facet ((3,true),0.5000,1218, + Iarg_facet ((4,true),0.5000,888, + Iarg_leaf 1882)))));; + +add_case ("OXLZLEZ 6346351218 3 35", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1979, + Iarg_facet ((5,true),0.5000,1409, + Iarg_facet ((3,true),0.5000,1009, + Iarg_facet ((0,true),0.6269,894, + Iarg_leaf 1954)))), + Iarg_facet ((4,true),0.5000,983, + Iarg_facet ((5,true),0.6240,957, + Iarg_leaf 1161))), + Iarg_facet ((2,true),0.5000,1572, + Iarg_facet ((4,true),0.5000,987, + Iarg_facet ((5,true),0.5000,737, + Iarg_leaf 1517)))), + Iarg_facet ((1,true),0.5000,1980, + Iarg_facet ((2,true),0.5000,1215, + Iarg_facet ((4,true),0.5000,733, + Iarg_leaf 1755)))), + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1854, + Iarg_facet ((2,true),0.5000,1433, + Iarg_facet ((4,true),0.5000,954, + Iarg_leaf 1374))), + Iarg_facet ((1,true),0.5000,834, + Iarg_leaf 1198))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1913, + Iarg_facet ((2,true),0.5000,1566, + Iarg_facet ((4,true),0.5000,785, + Iarg_leaf 1452))), + Iarg_facet ((1,true),0.5000,804, + Iarg_leaf 1279)), + Iarg_facet ((5,true),0.5000,1031, + Iarg_facet ((1,true),0.5000,996, + Iarg_leaf 1732)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,969, + Iarg_facet ((4,true),0.6269,873, + Iarg_leaf 1135)), + Iarg_facet ((2,true),0.5000,758, + Iarg_leaf 1545)), + Iarg_facet ((1,true),0.5000,1191, + Iarg_leaf 1332)), + Iarg_facet ((5,true),0.5000,1037, + Iarg_facet ((1,true),0.5000,986, + Iarg_leaf 1174))), + Iarg_facet ((4,true),0.5000,1592, + Iarg_facet ((5,true),0.5000,1115, + Iarg_facet ((1,true),0.5000,946, + Iarg_leaf 1173))))));; + +add_case ("OXLZLEZ 6346351218 3 14", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1964, + Iarg_facet ((1,true),0.5000,1618, + Iarg_facet ((2,true),0.5000,1179, + Iarg_facet ((4,true),0.6209,899, + Iarg_leaf 1328)))), + Iarg_facet ((5,true),0.6606,946, + Iarg_leaf 1464)), + Iarg_facet ((4,true),0.5000,1115, + Iarg_facet ((5,true),0.5000,748, + Iarg_leaf 1982))), + Iarg_facet ((2,true),0.5000,1289, + Iarg_facet ((4,true),0.5000,967, + Iarg_facet ((5,true),0.5000,868, + Iarg_facet ((2,true),0.6203,873, + Iarg_leaf 1057))))), + Iarg_facet ((1,true),0.5000,1861, + Iarg_facet ((2,true),0.5000,893, + Iarg_facet ((4,true),0.6444,956, + Iarg_facet ((5,true),0.5000,1235, + Iarg_leaf 1288))))), + Iarg_facet ((5,true),0.5000,1227, + Iarg_facet ((1,true),0.5000,1306, + Iarg_facet ((2,true),0.5000,1529, + Iarg_facet ((4,true),0.5000,1662, + Iarg_leaf 1708))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1434, + Iarg_facet ((1,true),0.5000,1317, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,812, + Iarg_leaf 1990), + Iarg_facet ((4,true),0.5000,829, + Iarg_leaf 1864)))), + Iarg_facet ((5,true),0.5000,774, + Iarg_facet ((1,true),0.6430,994, + Iarg_leaf 1821)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,751, + Iarg_facet ((4,true),0.6580,975, + Iarg_leaf 1665)), + Iarg_facet ((2,true),0.6471,926, + Iarg_facet ((4,true),0.6989,722, + Iarg_leaf 1486))), + Iarg_facet ((1,false),0.5000,1263, + Iarg_leaf 1415)), + Iarg_facet ((5,true),0.5000,733, + Iarg_leaf 1538)), + Iarg_facet ((4,true),0.5000,1040, + Iarg_leaf 1949))));; + +add_case ("7394240696", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1179, + Iarg_facet ((1,true),0.5000,799, + Iarg_facet ((2,true),0.6521,878, + Iarg_leaf 1812))), + Iarg_facet ((0,true),0.5000,943, + Iarg_facet ((1,true),0.6310,887, + Iarg_leaf 1622))), + Iarg_facet ((5,true),0.5000,1206, + Iarg_facet ((0,true),0.5000,964, + Iarg_facet ((1,true),0.5000,1020, + Iarg_leaf 1543)))), + Iarg_facet ((4,true),0.5000,1901, + Iarg_facet ((5,true),0.5000,1237, + Iarg_facet ((0,true),0.5000,1408, + Iarg_facet ((1,true),0.6361,838, + Iarg_leaf 1295))))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1779, + Iarg_facet ((5,false),0.5000,1177, + Iarg_facet ((0,true),0.5000,712, + Iarg_facet ((1,true),0.7562,1030, + Iarg_leaf 1180)))), + Iarg_facet ((4,true),0.5000,839, + Iarg_leaf 1830))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,869, + Iarg_leaf 1235), + Iarg_facet ((5,true),0.5000,893, + Iarg_facet ((0,true),0.6288,931, + Iarg_leaf 1948))), + Iarg_facet ((4,true),0.5000,1200, + Iarg_leaf 1537)), + Iarg_facet ((3,true),0.5000,1031, + Iarg_leaf 1631))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1487, + Iarg_facet ((5,true),0.5000,941, + Iarg_leaf 1284)), + Iarg_facet ((4,true),0.5000,1189, + Iarg_facet ((5,true),0.5000,824, + Iarg_facet ((1,true),0.6115,924, + Iarg_facet ((2,true),0.6787,775, + Iarg_leaf 1257))))), + Iarg_facet ((3,true),0.5000,1118, + Iarg_leaf 1505)), + Iarg_facet ((2,true),0.5000,991, + Iarg_facet ((3,true),0.5000,1102, + Iarg_leaf 1617)))));; + +add_case ("QITNPEA 5814748276 split(0/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1744, + Iarg_facet ((4,true),0.5000,1067, + Iarg_facet ((5,true),0.5000,822, + Iarg_facet ((1,true),0.5000,886, + Iarg_facet ((2,true),0.6398,831, + Iarg_leaf 1306))))), + Iarg_facet ((3,true),0.6229,883, + Iarg_leaf 1199)), + Iarg_facet ((2,true),0.5000,833, + Iarg_facet ((3,true),0.6252,889, + Iarg_leaf 1196))), + Iarg_facet ((1,true),0.5000,1029, + Iarg_leaf 1957)), + Iarg_facet ((5,true),0.5000,1039, + Iarg_facet ((1,true),0.5000,925, + Iarg_facet ((2,true),0.5000,733, + Iarg_leaf 1443)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1770, + Iarg_facet ((1,true),0.5000,1989, + Iarg_facet ((2,true),0.5000,1373, + Iarg_facet ((3,false),0.5000,1669, + Iarg_leaf 1786)))), + Iarg_facet ((5,true),0.6757,828, + Iarg_leaf 1381))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1105, + Iarg_facet ((1,true),0.5000,1008, + Iarg_facet ((2,true),0.5000,983, + Iarg_leaf 1282))), + Iarg_facet ((5,true),0.6685,860, + Iarg_leaf 1112)), + Iarg_facet ((4,true),0.5000,858, + Iarg_facet ((5,true),0.6540,810, + Iarg_leaf 1490)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1710, + Iarg_facet ((5,true),0.5000,1473, + Iarg_facet ((1,true),0.5000,1405, + Iarg_leaf 1803))), + Iarg_facet ((4,true),0.5000,777, + Iarg_facet ((5,true),0.6313,927, + Iarg_leaf 1567))), + Iarg_facet ((3,true),0.5000,1255, + Iarg_facet ((4,true),0.5000,937, + Iarg_leaf 1948)))));; + +add_case ("QITNPEA 6206775865 split(0/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1914, + Iarg_facet ((4,true),0.5000,1038, + Iarg_facet ((5,true),0.5000,807, + Iarg_facet ((1,true),0.5000,871, + Iarg_facet ((2,true),0.6426,837, + Iarg_leaf 1366))))), + Iarg_facet ((3,true),0.6163,886, + Iarg_leaf 1179)), + Iarg_facet ((2,true),0.5000,815, + Iarg_facet ((3,true),0.6192,900, + Iarg_leaf 1170))), + Iarg_facet ((1,true),0.5000,981, + Iarg_leaf 1888)), + Iarg_facet ((5,true),0.5000,1022, + Iarg_facet ((1,true),0.5000,878, + Iarg_facet ((2,true),0.5000,702, + Iarg_leaf 1399)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1816, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1475, + Iarg_facet ((3,false),0.5000,1831, + Iarg_facet ((4,true),0.6759,931, + Iarg_leaf 1149))), + Iarg_facet ((2,true),0.6334,847, + Iarg_leaf 1177))), + Iarg_facet ((5,true),0.6667,811, + Iarg_leaf 1445))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1075, + Iarg_facet ((1,true),0.5000,990, + Iarg_facet ((2,true),0.5000,924, + Iarg_leaf 1238))), + Iarg_facet ((5,true),0.6585,795, + Iarg_leaf 1089)), + Iarg_facet ((4,true),0.5000,855, + Iarg_facet ((5,true),0.6533,811, + Iarg_leaf 1546)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1664, + Iarg_facet ((5,true),0.5000,1367, + Iarg_facet ((1,true),0.5000,1343, + Iarg_leaf 1744))), + Iarg_facet ((4,true),0.5000,777, + Iarg_facet ((5,true),0.6302,926, + Iarg_leaf 1628))), + Iarg_facet ((3,true),0.5000,1254, + Iarg_facet ((4,true),0.5000,899, + Iarg_leaf 1917)))));; + +add_case ("OXLZLEZ 6346351218 4 22", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1980, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1483, + Iarg_facet ((4,true),0.5000,1040, + Iarg_facet ((5,true),0.5000,760, + Iarg_facet ((3,true),0.5000,1804, + Iarg_facet ((0,false),0.5000,1010, + Iarg_leaf 1028))))), + Iarg_facet ((2,true),0.7666,1177, + Iarg_leaf 887))), + Iarg_facet ((5,true),0.6307,937, + Iarg_leaf 1638)), + Iarg_facet ((4,true),0.5000,1072, + Iarg_facet ((5,true),0.5000,717, + Iarg_leaf 1999))), + Iarg_facet ((2,true),0.5000,1299, + Iarg_facet ((4,true),0.5000,955, + Iarg_facet ((5,true),0.5000,782, + Iarg_facet ((2,true),0.7875,1299, + Iarg_leaf 719))))), + Iarg_facet ((1,true),0.5000,1536, + Iarg_facet ((2,true),0.5000,803, + Iarg_facet ((4,true),0.6416,962, + Iarg_leaf 1811)))), + Iarg_facet ((5,true),0.5000,1224, + Iarg_facet ((1,true),0.5000,1187, + Iarg_facet ((2,true),0.5000,1132, + Iarg_facet ((4,true),0.5000,1288, + Iarg_leaf 1557))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1221, + Iarg_facet ((1,true),0.5000,1232, + Iarg_facet ((2,true),0.5000,1846, + Iarg_facet ((4,true),0.6347,897, + Iarg_leaf 1284)))), + Iarg_facet ((5,true),0.6326,806, + Iarg_leaf 1513))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1864, + Iarg_facet ((5,true),0.5000,1882, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6172,1001, + Iarg_leaf 1911), + Iarg_facet ((2,true),0.6549,821, + Iarg_leaf 1463)))), + Iarg_facet ((4,true),0.5000,1002, + Iarg_leaf 1886))));; + +add_case ("GLFVCVK4 2477216213 split(4/64)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1667, + Iarg_facet ((4,true),0.5000,1212, + Iarg_facet ((5,true),0.5000,868, + Iarg_bisect (3, + Iarg_facet ((1,true),0.6559,858, + Iarg_leaf 1471), + Iarg_facet ((1,true),0.8030,1229, + Iarg_leaf 848))))), + Iarg_facet ((2,true),0.6195,984, + Iarg_leaf 1414)), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1601, + Iarg_facet ((5,true),0.5000,1236, + Iarg_bisect (3, + Iarg_facet ((1,true),0.6215,934, + Iarg_leaf 1557), + Iarg_facet ((1,true),0.5000,1051, + Iarg_facet ((2,true),0.5000,745, + Iarg_facet ((4,true),0.6470,885, + Iarg_leaf 1481)))))), + Iarg_facet ((4,true),0.6778,782, + Iarg_leaf 1225)), + Iarg_facet ((2,true),0.6257,963, + Iarg_leaf 1673))), + Iarg_facet ((3,true),0.5000,1888, + Iarg_facet ((1,true),0.5000,723, + Iarg_leaf 1489))), + Iarg_facet ((5,true),0.5000,1378, + Iarg_facet ((3,true),0.5000,1878, + Iarg_facet ((1,true),0.5000,718, + Iarg_leaf 1477)))), + Iarg_facet ((4,true),0.5000,1855, + Iarg_facet ((5,true),0.5000,1303, + Iarg_facet ((3,true),0.5000,1982, + Iarg_facet ((1,true),0.5000,738, + Iarg_leaf 1572))))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1737, + Iarg_facet ((5,true),0.5000,1357, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,978, + Iarg_leaf 1366), + Iarg_facet ((1,true),0.5000,792, + Iarg_leaf 1226)))), + Iarg_facet ((4,true),0.6488,880, + Iarg_leaf 1550))));; + +add_case ("OXLZLEZ 6346351218 1 11", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1829, + Iarg_facet ((3,true),0.5000,1224, + Iarg_facet ((1,true),0.5000,1108, + Iarg_leaf 1811))), + Iarg_facet ((5,true),0.5000,723, + Iarg_leaf 1853)), + Iarg_facet ((4,true),0.5000,1103, + Iarg_facet ((5,true),0.5000,730, + Iarg_leaf 1884))), + Iarg_facet ((2,true),0.5000,1609, + Iarg_facet ((4,true),0.5000,1051, + Iarg_facet ((5,true),0.5000,797, + Iarg_leaf 1887)))), + Iarg_facet ((1,true),0.5000,1867, + Iarg_facet ((2,true),0.5000,1142, + Iarg_facet ((4,true),0.6206,968, + Iarg_leaf 1432)))), + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1815, + Iarg_facet ((2,true),0.5000,1178, + Iarg_facet ((4,true),0.5000,998, + Iarg_leaf 1424))), + Iarg_facet ((1,true),0.5000,736, + Iarg_leaf 1343))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1770, + Iarg_facet ((2,true),0.5000,1672, + Iarg_facet ((4,true),0.6399,948, + Iarg_leaf 1150))), + Iarg_facet ((1,true),0.5000,814, + Iarg_leaf 1563)), + Iarg_facet ((5,true),0.5000,743, + Iarg_facet ((1,true),0.5000,826, + Iarg_leaf 1522)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,975, + Iarg_facet ((4,true),0.6382,882, + Iarg_leaf 1215)), + Iarg_facet ((2,true),0.5000,803, + Iarg_leaf 1678)), + Iarg_facet ((1,true),0.5000,1000, + Iarg_leaf 1295)), + Iarg_facet ((5,true),0.5000,724, + Iarg_facet ((1,true),0.5000,1048, + Iarg_leaf 1372))), + Iarg_facet ((4,true),0.5000,992, + Iarg_facet ((5,true),0.5000,787, + Iarg_facet ((1,true),0.5000,956, + Iarg_leaf 1219))))));; + +add_case ("OXLZLEZ 6346351218 1 3", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1967, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,974, + Iarg_facet ((2,true),0.6229,931, + Iarg_leaf 1727)), + Iarg_facet ((1,true),0.5000,1772, + Iarg_facet ((2,true),0.5000,1331, + Iarg_facet ((4,true),0.5000,1033, + Iarg_facet ((5,true),0.5000,793, + Iarg_facet ((3,false),0.5000,1739, + Iarg_facet ((0,true),0.5000,1779, + Iarg_leaf 1874)))))))), + Iarg_facet ((5,true),0.6252,996, + Iarg_leaf 1617)), + Iarg_facet ((4,true),0.5000,893, + Iarg_facet ((5,true),0.6594,914, + Iarg_leaf 1583))), + Iarg_facet ((2,true),0.5000,1425, + Iarg_facet ((4,true),0.5000,833, + Iarg_facet ((5,true),0.6361,947, + Iarg_leaf 1665)))), + Iarg_facet ((1,true),0.5000,1400, + Iarg_facet ((2,true),0.5000,871, + Iarg_facet ((4,true),0.6177,988, + Iarg_leaf 1178)))), + Iarg_facet ((5,true),0.5000,1550, + Iarg_facet ((1,true),0.5000,1342, + Iarg_facet ((2,true),0.5000,953, + Iarg_facet ((4,true),0.5000,874, + Iarg_leaf 1229))))), + Iarg_facet ((4,true),0.5000,1908, + Iarg_facet ((5,true),0.5000,1241, + Iarg_facet ((1,true),0.5000,1504, + Iarg_facet ((2,true),0.5000,1232, + Iarg_leaf 1764))))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1662, + Iarg_facet ((5,true),0.5000,1416, + Iarg_facet ((1,true),0.5000,1876, + Iarg_facet ((2,true),0.5000,861, + Iarg_leaf 1789)))), + Iarg_facet ((4,true),0.6414,891, + Iarg_leaf 1764))));; + +add_case ("ZTGIJCF4 0 0 0 0 1821661595 split(0/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1594, + Iarg_facet ((4,true),0.5000,1250, + Iarg_facet ((5,true),0.5000,935, + Iarg_facet ((1,true),0.5000,982, + Iarg_facet ((2,true),0.6235,874, + Iarg_leaf 1356))))), + Iarg_facet ((3,true),0.6285,877, + Iarg_leaf 1450)), + Iarg_facet ((2,true),0.5000,945, + Iarg_facet ((3,true),0.6310,886, + Iarg_leaf 1426))), + Iarg_facet ((1,true),0.5000,1253, + Iarg_facet ((2,true),0.6255,886, + Iarg_leaf 1421))), + Iarg_facet ((5,true),0.5000,1198, + Iarg_facet ((1,true),0.5000,1118, + Iarg_facet ((2,true),0.5000,894, + Iarg_leaf 1763)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1687, + Iarg_facet ((1,true),0.5000,1726, + Iarg_facet ((2,true),0.5000,1153, + Iarg_facet ((3,true),0.5000,1217, + Iarg_leaf 1299)))), + Iarg_facet ((5,true),0.6617,805, + Iarg_leaf 1344))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1317, + Iarg_facet ((1,true),0.5000,1157, + Iarg_facet ((2,true),0.5000,1262, + Iarg_leaf 1544))), + Iarg_facet ((5,true),0.6288,924, + Iarg_leaf 1470)), + Iarg_facet ((4,true),0.5000,896, + Iarg_facet ((5,true),0.6501,827, + Iarg_leaf 1411)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1861, + Iarg_facet ((1,true),0.5000,1764, + Iarg_facet ((2,true),0.6392,805, + Iarg_leaf 1187))), + Iarg_facet ((5,true),0.6266,905, + Iarg_leaf 1073)), + Iarg_facet ((4,true),0.5000,813, + Iarg_facet ((5,true),0.6141,914, + Iarg_leaf 1545))), + Iarg_facet ((3,true),0.5000,1356, + Iarg_facet ((4,true),0.5000,1075, + Iarg_facet ((5,true),0.5000,718, + Iarg_leaf 1507))))));; + +add_case ("3636849632", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1591, + Iarg_facet ((3,true),0.7659,889, + Iarg_leaf 1166)), + Iarg_facet ((2,true),0.5000,1042, + Iarg_leaf 1586)), + Iarg_facet ((1,true),0.5000,1151, + Iarg_leaf 1534)), + Iarg_facet ((0,true),0.5000,930, + Iarg_leaf 1153)), + Iarg_facet ((5,true),0.5000,707, + Iarg_facet ((0,true),0.5000,946, + Iarg_leaf 1205))), + Iarg_facet ((4,true),0.5000,947, + Iarg_facet ((5,true),0.6203,965, + Iarg_leaf 1825))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1789, + Iarg_facet ((5,true),0.5000,1243, + Iarg_facet ((0,true),0.5000,826, + Iarg_leaf 1348))), + Iarg_facet ((4,true),0.6299,934, + Iarg_leaf 1181))), + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,926, + Iarg_facet ((4,true),0.6243,1040, + Iarg_facet ((5,false),0.5000,1104, + Iarg_leaf 1156))), + Iarg_facet ((3,true),0.5000,877, + Iarg_facet ((4,true),0.5000,740, + Iarg_facet ((5,false),0.5000,1087, + Iarg_leaf 1391))))), + Iarg_facet ((5,true),0.5000,1957, + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,910, + Iarg_facet ((5,true),0.5977,934, + Iarg_facet ((4,false),0.5000,1138, + Iarg_leaf 1199))), + Iarg_facet ((3,true),0.5000,854, + Iarg_facet ((5,true),0.5000,710, + Iarg_facet ((4,false),0.5000,1077, + Iarg_leaf 1475)))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1967, + Iarg_bisect (0, + Iarg_facet ((4,true),0.5000,1186, + Iarg_facet ((5,true),0.5000,910, + Iarg_facet ((3,false),0.5000,1756, + Iarg_facet ((0,true),0.5000,1065, + Iarg_leaf 1546)))), + Iarg_facet ((4,true),0.5000,1236, + Iarg_facet ((5,true),0.5000,868, + Iarg_leaf 1978)))), + Iarg_facet ((5,true),0.6900,841, + Iarg_leaf 1566))));; + +add_case ("OXLZLEZ 6346351218 4 38", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1626, + Iarg_facet ((1,true),0.5000,1350, + Iarg_facet ((2,true),0.5000,889, + Iarg_leaf 1834))), + Iarg_facet ((5,true),0.7965,1189, + Iarg_leaf 894)), + Iarg_facet ((4,true),0.5000,1021, + Iarg_facet ((5,true),0.6307,897, + Iarg_leaf 1323))), + Iarg_facet ((2,true),0.5000,1186, + Iarg_facet ((4,true),0.5000,898, + Iarg_facet ((5,true),0.5000,758, + Iarg_leaf 1678)))), + Iarg_facet ((1,true),0.5000,1899, + Iarg_facet ((2,true),0.5000,909, + Iarg_facet ((4,true),0.6511,941, + Iarg_facet ((5,false),0.5000,1022, + Iarg_leaf 1175))))), + Iarg_facet ((5,true),0.5000,1223, + Iarg_facet ((1,true),0.5000,1336, + Iarg_facet ((2,true),0.5000,1484, + Iarg_facet ((4,false),0.5000,1574, + Iarg_leaf 1651))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1493, + Iarg_facet ((1,true),0.5000,1250, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,735, + Iarg_leaf 1694), + Iarg_facet ((4,true),0.5000,790, + Iarg_leaf 1742)))), + Iarg_facet ((5,true),0.5000,764, + Iarg_facet ((1,true),0.6324,921, + Iarg_leaf 1973)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,701, + Iarg_facet ((4,true),0.6533,871, + Iarg_leaf 1475)), + Iarg_facet ((2,true),0.6528,909, + Iarg_facet ((4,true),0.7615,785, + Iarg_leaf 1351))), + Iarg_facet ((1,false),0.5000,1397, + Iarg_leaf 1526)), + Iarg_facet ((5,true),0.5000,750, + Iarg_leaf 1502)), + Iarg_facet ((4,true),0.5000,1120, + Iarg_leaf 1986))));; + +add_case ("OXLZLEZ 6346351218 1 12", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1930, + Iarg_facet ((3,true),0.5000,1224, + Iarg_facet ((1,true),0.5000,1250, + Iarg_facet ((2,true),0.5000,789, + Iarg_leaf 1289)))), + Iarg_facet ((5,true),0.5000,776, + Iarg_leaf 1952)), + Iarg_facet ((4,true),0.5000,1170, + Iarg_facet ((5,true),0.5000,769, + Iarg_leaf 1984))), + Iarg_facet ((2,true),0.5000,1674, + Iarg_facet ((4,true),0.5000,1103, + Iarg_facet ((5,true),0.5000,838, + Iarg_leaf 1992)))), + Iarg_facet ((1,true),0.5000,1913, + Iarg_facet ((2,true),0.5000,1188, + Iarg_facet ((4,true),0.5000,734, + Iarg_leaf 1804)))), + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1871, + Iarg_facet ((2,true),0.5000,1225, + Iarg_facet ((4,true),0.5000,1069, + Iarg_leaf 1498))), + Iarg_facet ((1,true),0.5000,737, + Iarg_leaf 1366))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1837, + Iarg_facet ((2,true),0.5000,1754, + Iarg_facet ((4,true),0.6201,931, + Iarg_leaf 1267))), + Iarg_facet ((1,true),0.5000,813, + Iarg_leaf 1575)), + Iarg_facet ((5,true),0.5000,744, + Iarg_facet ((1,true),0.5000,826, + Iarg_leaf 1558)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1001, + Iarg_facet ((4,true),0.6296,903, + Iarg_leaf 1306)), + Iarg_facet ((2,true),0.5000,840, + Iarg_leaf 1760)), + Iarg_facet ((1,true),0.5000,1019, + Iarg_leaf 1322)), + Iarg_facet ((5,true),0.5000,724, + Iarg_facet ((1,true),0.5000,1050, + Iarg_leaf 1379))), + Iarg_facet ((4,true),0.5000,992, + Iarg_facet ((5,true),0.5000,788, + Iarg_facet ((1,true),0.5000,965, + Iarg_leaf 1229))))));; + +add_case ("OXLZLEZ 6346351218 3 11", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1676, + Iarg_facet ((3,true),0.5000,716, + Iarg_facet ((1,true),0.5000,1179, + Iarg_facet ((2,true),0.5000,762, + Iarg_leaf 1405)))), + Iarg_facet ((5,true),0.6416,907, + Iarg_leaf 1324)), + Iarg_facet ((4,true),0.5000,1118, + Iarg_facet ((5,true),0.5000,749, + Iarg_leaf 1694))), + Iarg_facet ((2,true),0.5000,1376, + Iarg_facet ((4,true),0.5000,1042, + Iarg_facet ((5,true),0.5000,797, + Iarg_leaf 1727)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1106, + Iarg_facet ((4,true),0.5982,864, + Iarg_facet ((5,false),0.5000,1122, + Iarg_leaf 1160))), + Iarg_facet ((2,true),0.6459,848, + Iarg_leaf 1233))), + Iarg_facet ((5,true),0.5000,1584, + Iarg_facet ((1,true),0.5000,1694, + Iarg_facet ((2,true),0.5000,1530, + Iarg_facet ((4,false),0.5000,1560, + Iarg_leaf 1605))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1865, + Iarg_facet ((1,true),0.5000,1563, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,795, + Iarg_leaf 1684), + Iarg_facet ((4,true),0.5000,803, + Iarg_leaf 1709)))), + Iarg_facet ((5,true),0.5000,929, + Iarg_facet ((1,true),0.5000,826, + Iarg_facet ((2,false),0.5000,1110, + Iarg_leaf 1111))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,840, + Iarg_facet ((4,true),0.6236,936, + Iarg_leaf 1582)), + Iarg_facet ((2,true),0.5000,716, + Iarg_facet ((4,true),0.6587,865, + Iarg_leaf 1589))), + Iarg_facet ((1,true),0.5000,1461, + Iarg_leaf 1498)), + Iarg_facet ((5,true),0.5000,894, + Iarg_leaf 1903)), + Iarg_facet ((4,true),0.5000,1401, + Iarg_facet ((5,true),0.5000,946, + Iarg_leaf 1669)))));; + +add_case ("6224332984", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,982, + Iarg_leaf 1964), + Iarg_facet ((0,true),0.5000,904, + Iarg_facet ((1,true),0.6379,869, + Iarg_leaf 1483))), + Iarg_facet ((5,true),0.5000,1642, + Iarg_facet ((0,true),0.5000,914, + Iarg_facet ((1,true),0.5000,986, + Iarg_leaf 1444)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1644, + Iarg_facet ((0,true),0.5000,1350, + Iarg_facet ((1,true),0.6423,814, + Iarg_leaf 1176))), + Iarg_facet ((5,true),0.5000,917, + Iarg_leaf 1704))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1103, + Iarg_facet ((0,true),0.6157,906, + Iarg_leaf 1782)), + Iarg_facet ((5,false),0.5000,899, + Iarg_leaf 1090)), + Iarg_facet ((4,true),0.5000,1052, + Iarg_facet ((5,false),0.5000,907, + Iarg_leaf 1084)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,896, + Iarg_leaf 1124), + Iarg_facet ((5,true),0.5000,1006, + Iarg_facet ((0,true),0.6372,883, + Iarg_leaf 1719))), + Iarg_facet ((4,true),0.5000,1432, + Iarg_leaf 1583)), + Iarg_facet ((3,true),0.5000,1169, + Iarg_leaf 1704))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1531, + Iarg_leaf 1996), + Iarg_facet ((4,true),0.5000,1416, + Iarg_facet ((5,true),0.5000,1014, + Iarg_facet ((1,true),0.6441,901, + Iarg_leaf 1695)))), + Iarg_facet ((3,true),0.5000,1189, + Iarg_leaf 1656)), + Iarg_facet ((2,true),0.5000,1150, + Iarg_facet ((3,true),0.5000,1166, + Iarg_leaf 1664)))));; + +add_case ("TXQTPVC split(1/2)", + Iarg_facet ((3,false),0.5000,1861, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,802, + Iarg_facet ((2,true),0.5000,856, + Iarg_leaf 1989)), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1560, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5001,1525, + Iarg_leaf 756), + Iarg_facet ((0,true),0.6940,1183, + Iarg_leaf 571))), + Iarg_facet ((5,true),0.9013,771, + Iarg_leaf 857)), + Iarg_facet ((4,true),0.5000,1365, + Iarg_facet ((5,true),0.8967,773, + Iarg_leaf 1375))), + Iarg_facet ((2,true),0.5000,1006, + Iarg_facet ((4,true),0.8906,1218, + Iarg_leaf 1846)))), + Iarg_facet ((3,false),0.6955,1035, + Iarg_facet ((1,true),0.6933,1160, + Iarg_leaf 1407))), + Iarg_facet ((5,true),0.5000,717, + Iarg_facet ((3,false),0.6324,948, + Iarg_facet ((1,true),0.6215,775, + Iarg_leaf 1893)))), + Iarg_facet ((4,true),0.8124,1245, + Iarg_facet ((5,true),0.6942,976, + Iarg_facet ((3,false),0.7107,878, + Iarg_leaf 1423)))), + Iarg_facet ((2,true),0.5000,917, + Iarg_facet ((4,true),0.5000,758, + Iarg_facet ((5,true),0.8024,826, + Iarg_leaf 1769))))));; + +add_case ("FHBVYXZv2 a split(0/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,899, + Iarg_leaf 1867), + Iarg_facet ((5,true),0.5000,1271, + Iarg_facet ((1,true),0.5000,1217, + Iarg_facet ((2,true),0.5000,1077, + Iarg_facet ((3,true),0.6429,863, + Iarg_leaf 1242))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.6274,1024, + Iarg_leaf 1251), + Iarg_facet ((5,true),0.6208,869, + Iarg_leaf 1956))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1360, + Iarg_facet ((1,true),0.5000,1283, + Iarg_facet ((2,true),0.5000,1601, + Iarg_leaf 1722))), + Iarg_facet ((5,true),0.6324,909, + Iarg_leaf 1532)), + Iarg_facet ((4,true),0.5000,1041, + Iarg_facet ((5,true),0.6257,917, + Iarg_leaf 1973)))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1974, + Iarg_facet ((4,false),0.5000,1617, + Iarg_facet ((5,true),0.6274,906, + Iarg_leaf 1099))), + Iarg_facet ((3,true),0.5000,1541, + Iarg_facet ((4,true),0.5000,1057, + Iarg_facet ((5,true),0.5000,723, + Iarg_leaf 1575))))));; + +add_case ("OXLZLEZ 6346351218 4 37", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1627, + Iarg_facet ((1,true),0.5000,1350, + Iarg_facet ((2,true),0.5000,888, + Iarg_leaf 1833))), + Iarg_facet ((5,true),0.6573,833, + Iarg_leaf 1244)), + Iarg_facet ((4,true),0.5000,1023, + Iarg_facet ((5,true),0.6307,898, + Iarg_leaf 1311))), + Iarg_facet ((2,true),0.5000,1198, + Iarg_facet ((4,true),0.5000,899, + Iarg_facet ((5,true),0.5000,757, + Iarg_leaf 1679)))), + Iarg_facet ((1,true),0.5000,1904, + Iarg_facet ((2,true),0.5000,910, + Iarg_facet ((4,true),0.6511,941, + Iarg_facet ((5,false),0.5000,1023, + Iarg_leaf 1175))))), + Iarg_facet ((5,true),0.5000,1226, + Iarg_facet ((1,true),0.5000,1338, + Iarg_facet ((2,true),0.5000,1484, + Iarg_facet ((4,false),0.5000,1572, + Iarg_leaf 1650))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1496, + Iarg_facet ((1,true),0.5000,1251, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,734, + Iarg_leaf 1701), + Iarg_facet ((4,true),0.5000,791, + Iarg_leaf 1744)))), + Iarg_facet ((5,true),0.5000,766, + Iarg_facet ((1,true),0.6145,907, + Iarg_facet ((2,false),0.5000,970, + Iarg_leaf 1101))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,703, + Iarg_facet ((4,true),0.6525,878, + Iarg_leaf 1485)), + Iarg_facet ((2,true),0.6521,907, + Iarg_facet ((4,true),0.8774,1283, + Iarg_leaf 802))), + Iarg_facet ((1,false),0.5000,1401, + Iarg_leaf 1527)), + Iarg_facet ((5,true),0.5000,753, + Iarg_leaf 1506)), + Iarg_facet ((4,true),0.5000,1122, + Iarg_leaf 1990))));; + +add_case ("OXLZLEZ 6346351218 4 14", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1973, + Iarg_facet ((1,true),0.5000,1650, + Iarg_facet ((2,true),0.5000,1075, + Iarg_facet ((4,true),0.6252,924, + Iarg_leaf 1110)))), + Iarg_facet ((5,true),0.6330,922, + Iarg_leaf 1562)), + Iarg_facet ((4,true),0.5000,1190, + Iarg_facet ((5,true),0.5000,766, + Iarg_leaf 1995))), + Iarg_facet ((2,true),0.5000,1276, + Iarg_facet ((4,true),0.5000,1040, + Iarg_facet ((5,true),0.5000,904, + Iarg_facet ((2,true),0.6255,859, + Iarg_leaf 1015))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1029, + Iarg_facet ((4,true),0.6446,1033, + Iarg_facet ((5,false),0.5000,1246, + Iarg_leaf 1446))), + Iarg_facet ((2,true),0.6684,750, + Iarg_leaf 1339))), + Iarg_facet ((5,true),0.5000,1279, + Iarg_facet ((1,true),0.5000,1548, + Iarg_facet ((2,true),0.5000,1737, + Iarg_facet ((4,false),0.5000,1882, + Iarg_leaf 1971))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1645, + Iarg_facet ((1,true),0.5000,1351, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,853, + Iarg_facet ((5,true),0.6759,717, + Iarg_leaf 1155)), + Iarg_facet ((4,true),0.5000,949, + Iarg_facet ((5,true),0.7798,852, + Iarg_leaf 1160))))), + Iarg_facet ((5,true),0.5000,780, + Iarg_facet ((1,true),0.6296,947, + Iarg_facet ((2,false),0.5000,1074, + Iarg_leaf 1160))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,759, + Iarg_facet ((4,true),0.6332,940, + Iarg_leaf 1871)), + Iarg_facet ((2,true),0.6434,968, + Iarg_facet ((4,true),0.6847,772, + Iarg_leaf 1712))), + Iarg_facet ((1,false),0.5000,1533, + Iarg_leaf 1605)), + Iarg_facet ((5,true),0.5000,769, + Iarg_leaf 1670)), + Iarg_facet ((4,true),0.5000,1125, + Iarg_facet ((5,true),0.5000,775, + Iarg_leaf 1268)))));; + +add_case ("OXLZLEZ 6346351218 3 1", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1709, + Iarg_facet ((3,true),0.5000,1795, + Iarg_facet ((1,true),0.5000,1182, + Iarg_facet ((2,true),0.5000,833, + Iarg_facet ((4,true),0.6489,857, + Iarg_leaf 1514))))), + Iarg_facet ((5,true),0.6580,850, + Iarg_leaf 1316)), + Iarg_facet ((4,true),0.5000,791, + Iarg_facet ((5,true),0.6337,837, + Iarg_leaf 1396))), + Iarg_facet ((2,true),0.5000,1021, + Iarg_facet ((4,true),0.5000,782, + Iarg_facet ((5,true),0.6377,931, + Iarg_leaf 1403)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1907, + Iarg_facet ((4,true),0.5000,1290, + Iarg_facet ((5,true),0.5000,899, + Iarg_facet ((3,true),0.5000,981, + Iarg_leaf 1171)))), + Iarg_facet ((2,true),0.5000,786, + Iarg_leaf 1910))), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1036, + Iarg_facet ((2,true),0.6310,907, + Iarg_leaf 1685)), + Iarg_facet ((1,true),0.6177,978, + Iarg_leaf 1501))), + Iarg_facet ((5,true),0.5000,1433, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,993, + Iarg_facet ((2,true),0.5000,759, + Iarg_facet ((4,true),0.5000,901, + Iarg_leaf 1235))), + Iarg_facet ((1,true),0.5000,709, + Iarg_leaf 1765)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1653, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,960, + Iarg_facet ((2,true),0.5000,1331, + Iarg_leaf 1737)), + Iarg_facet ((1,true),0.5000,755, + Iarg_leaf 1787))), + Iarg_facet ((5,true),0.6350,866, + Iarg_leaf 1468))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1839, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1716, + Iarg_facet ((2,true),0.7838,1165, + Iarg_leaf 1039)), + Iarg_facet ((1,true),0.5000,1013, + Iarg_leaf 1516))), + Iarg_facet ((5,true),0.6265,912, + Iarg_leaf 1333)), + Iarg_facet ((4,true),0.5000,988, + Iarg_facet ((5,true),0.5000,730, + Iarg_leaf 1786)))));; + +add_case ("OXLZLEZ 6346351218 1 15", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1536, + Iarg_facet ((3,true),0.6877,1016, + Iarg_facet ((1,true),0.5000,871, + Iarg_leaf 1405))), + Iarg_facet ((5,true),0.6263,905, + Iarg_leaf 1219)), + Iarg_facet ((4,true),0.5000,955, + Iarg_facet ((5,true),0.6294,907, + Iarg_leaf 1221))), + Iarg_facet ((2,true),0.5000,1292, + Iarg_facet ((4,true),0.5000,914, + Iarg_facet ((5,true),0.6114,930, + Iarg_leaf 1263)))), + Iarg_facet ((1,true),0.5000,1126, + Iarg_facet ((2,true),0.5000,739, + Iarg_leaf 1933))), + Iarg_facet ((5,true),0.5000,795, + Iarg_facet ((1,true),0.5000,1047, + Iarg_facet ((2,true),0.5000,834, + Iarg_leaf 1975)))), + Iarg_facet ((4,true),0.5000,1171, + Iarg_facet ((5,true),0.5000,820, + Iarg_facet ((1,true),0.5000,1054, + Iarg_facet ((4,true),0.5000,832, + Iarg_leaf 1949))))), + Iarg_facet ((2,true),0.5000,1384, + Iarg_facet ((4,true),0.5000,1069, + Iarg_facet ((5,true),0.5000,937, + Iarg_facet ((2,true),0.5000,1055, + Iarg_facet ((4,true),0.5000,749, + Iarg_facet ((5,true),0.6423,867, + Iarg_leaf 1116))))))), + Iarg_facet ((1,true),0.5000,1236, + Iarg_facet ((2,true),0.5000,814, + Iarg_facet ((4,true),0.6585,933, + Iarg_facet ((5,true),0.5000,1025, + Iarg_leaf 1464))))), + Iarg_facet ((5,true),0.5000,962, + Iarg_facet ((1,true),0.5000,1171, + Iarg_facet ((2,true),0.5000,930, + Iarg_facet ((4,true),0.5000,1391, + Iarg_facet ((5,true),0.8354,1040, + Iarg_leaf 1011)))))), + Iarg_facet ((4,true),0.5000,1502, + Iarg_facet ((5,true),0.5000,1102, + Iarg_facet ((1,true),0.5000,1149, + Iarg_facet ((2,true),0.5000,1909, + Iarg_facet ((4,true),0.6501,887, + Iarg_leaf 1755)))))), + Iarg_facet ((2,true),0.5000,1741, + Iarg_facet ((4,true),0.5000,1412, + Iarg_facet ((5,true),0.5000,1197, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6183,954, + Iarg_facet ((4,true),0.7235,850, + Iarg_leaf 1500)), + Iarg_facet ((2,true),0.6730,810, + Iarg_leaf 1630)))))));; + +add_case ("QITNPEA 9939613598 split(0/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1797, + Iarg_facet ((2,true),0.5000,1371, + Iarg_facet ((4,true),0.5000,1052, + Iarg_facet ((5,true),0.5000,832, + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,866, + Iarg_facet ((1,true),0.7333,795, + Iarg_leaf 1247)), + Iarg_facet ((0,false),0.5000,894, + Iarg_facet ((1,true),0.8497,1287, + Iarg_leaf 863))))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1917, + Iarg_facet ((5,true),0.5000,1551, + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1183, + Iarg_facet ((1,true),0.6491,893, + Iarg_leaf 1894)), + Iarg_facet ((0,false),0.5000,1913, + Iarg_facet ((1,true),0.5000,981, + Iarg_facet ((2,true),0.5000,717, + Iarg_facet ((4,true),0.6596,939, + Iarg_facet ((5,true),0.6997,714, + Iarg_facet ((3,false),0.5000,758, + Iarg_leaf 1277))))))))), + Iarg_facet ((4,true),0.7089,950, + Iarg_leaf 1384)), + Iarg_facet ((2,true),0.5000,719, + Iarg_facet ((4,true),0.6717,817, + Iarg_leaf 1451)))), + Iarg_facet ((3,false),0.5000,1071, + Iarg_leaf 1593)), + Iarg_facet ((5,true),0.6321,991, + Iarg_facet ((3,false),0.5000,893, + Iarg_leaf 1357))), + Iarg_facet ((4,true),0.5000,782, + Iarg_facet ((5,true),0.6451,923, + Iarg_facet ((3,false),0.5000,910, + Iarg_leaf 1362)))), + Iarg_facet ((2,true),0.5000,1105, + Iarg_facet ((4,true),0.5000,753, + Iarg_facet ((5,true),0.6361,987, + Iarg_facet ((3,false),0.5000,916, + Iarg_leaf 1380))))), + Iarg_facet ((1,true),0.5000,776, + Iarg_facet ((2,true),0.6689,799, + Iarg_leaf 1168))), + Iarg_facet ((5,true),0.5000,863, + Iarg_facet ((1,true),0.5000,782, + Iarg_facet ((2,true),0.6642,786, + Iarg_leaf 1201)))), + Iarg_facet ((4,true),0.5000,1219, + Iarg_facet ((5,true),0.5000,909, + Iarg_facet ((1,true),0.5000,841, + Iarg_facet ((2,true),0.6226,919, + Iarg_leaf 1102))))), + Iarg_facet ((2,true),0.5000,1881, + Iarg_facet ((4,true),0.5000,1250, + Iarg_facet ((5,true),0.5000,855, + Iarg_facet ((1,true),0.5000,1032, + Iarg_leaf 1875))))));; + +add_case ("OXLZLEZ 6346351218 2 12", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1820, + Iarg_facet ((3,true),0.5000,719, + Iarg_facet ((1,true),0.5000,1228, + Iarg_facet ((2,true),0.5000,795, + Iarg_leaf 1416)))), + Iarg_facet ((5,true),0.6305,948, + Iarg_leaf 1497)), + Iarg_facet ((4,true),0.5000,1237, + Iarg_facet ((5,true),0.5000,795, + Iarg_leaf 1861))), + Iarg_facet ((2,true),0.5000,1510, + Iarg_facet ((4,true),0.5000,1129, + Iarg_facet ((5,true),0.5000,887, + Iarg_leaf 1883)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1253, + Iarg_facet ((4,true),0.5000,732, + Iarg_facet ((5,false),0.5000,1449, + Iarg_leaf 1575))), + Iarg_facet ((2,true),0.6425,955, + Iarg_leaf 1462))), + Iarg_facet ((5,true),0.5000,1701, + Iarg_facet ((1,true),0.5000,1888, + Iarg_facet ((2,true),0.5000,1798, + Iarg_facet ((4,false),0.5000,1827, + Iarg_leaf 1897))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1726, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,928, + Iarg_leaf 1983), + Iarg_facet ((4,true),0.5000,941, + Iarg_facet ((5,true),0.7287,764, + Iarg_leaf 1145)))), + Iarg_facet ((1,true),0.5000,763, + Iarg_leaf 1395)), + Iarg_facet ((5,true),0.5000,1034, + Iarg_facet ((1,true),0.5000,920, + Iarg_facet ((2,false),0.5000,1315, + Iarg_leaf 1377))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,937, + Iarg_facet ((4,true),0.5000,735, + Iarg_facet ((5,true),0.6226,952, + Iarg_leaf 1153))), + Iarg_facet ((2,true),0.5000,787, + Iarg_facet ((4,true),0.6374,946, + Iarg_leaf 1970))), + Iarg_facet ((1,true),0.5000,1754, + Iarg_leaf 1758)), + Iarg_facet ((5,true),0.5000,1008, + Iarg_facet ((1,true),0.5000,1024, + Iarg_leaf 1183))), + Iarg_facet ((4,true),0.5000,1535, + Iarg_facet ((5,true),0.5000,1043, + Iarg_leaf 1796)))));; + +add_case ("QITNPEA 2134082733 split(1/4)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1868, + Iarg_facet ((5,true),0.5000,1330, + Iarg_facet ((3,true),0.5000,831, + Iarg_facet ((1,true),0.5000,836, + Iarg_leaf 1320)))), + Iarg_facet ((4,true),0.5000,849, + Iarg_leaf 1910)), + Iarg_facet ((2,true),0.5000,1300, + Iarg_facet ((4,true),0.5000,830, + Iarg_leaf 1930))), + Iarg_facet ((1,true),0.5000,1595, + Iarg_facet ((2,true),0.5000,1055, + Iarg_facet ((4,true),0.5000,718, + Iarg_leaf 1602)))), + Iarg_facet ((3,true),0.5000,1759, + Iarg_facet ((1,true),0.5000,1636, + Iarg_facet ((2,true),0.5000,1114, + Iarg_facet ((4,true),0.6157,977, + Iarg_leaf 1248))))), + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,1831, + Iarg_facet ((1,true),0.5000,1682, + Iarg_facet ((2,true),0.5000,1064, + Iarg_facet ((4,true),0.5000,1078, + Iarg_leaf 1193)))), + Iarg_facet ((3,true),0.5000,827, + Iarg_leaf 1649))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,1817, + Iarg_facet ((1,true),0.5000,1642, + Iarg_facet ((2,true),0.5000,1661, + Iarg_leaf 1839))), + Iarg_facet ((3,true),0.5000,982, + Iarg_leaf 1788)), + Iarg_facet ((5,true),0.5000,851, + Iarg_facet ((3,true),0.5000,957, + Iarg_leaf 1816)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,1819, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,923, + Iarg_leaf 1879), + Iarg_facet ((2,true),0.5000,736, + Iarg_leaf 1672))), + Iarg_facet ((3,true),0.5000,866, + Iarg_leaf 1759)), + Iarg_facet ((5,true),0.5000,841, + Iarg_facet ((3,true),0.5000,1012, + Iarg_leaf 1758))), + Iarg_facet ((4,true),0.5000,1233, + Iarg_facet ((5,true),0.5000,969, + Iarg_facet ((3,true),0.5000,1037, + Iarg_leaf 1750))))));; + +add_case ("OXLZLEZ 6346351218 2 11", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1793, + Iarg_facet ((3,true),0.5000,712, + Iarg_facet ((1,true),0.5000,1214, + Iarg_facet ((2,true),0.5000,786, + Iarg_leaf 1404)))), + Iarg_facet ((5,true),0.6310,942, + Iarg_leaf 1481)), + Iarg_facet ((4,true),0.5000,1225, + Iarg_facet ((5,true),0.5000,791, + Iarg_leaf 1848))), + Iarg_facet ((2,true),0.5000,1501, + Iarg_facet ((4,true),0.5000,1134, + Iarg_facet ((5,true),0.5000,886, + Iarg_leaf 1871)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1240, + Iarg_facet ((4,true),0.5000,733, + Iarg_facet ((5,false),0.5000,1448, + Iarg_leaf 1572))), + Iarg_facet ((2,true),0.6313,920, + Iarg_leaf 1470))), + Iarg_facet ((5,true),0.5000,1701, + Iarg_facet ((1,true),0.5000,1897, + Iarg_facet ((2,true),0.5000,1797, + Iarg_facet ((4,false),0.5000,1839, + Iarg_leaf 1922))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1727, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,921, + Iarg_leaf 1979), + Iarg_facet ((4,true),0.5000,936, + Iarg_facet ((5,true),0.7653,912, + Iarg_leaf 1108)))), + Iarg_facet ((1,true),0.5000,766, + Iarg_leaf 1390)), + Iarg_facet ((5,true),0.5000,1028, + Iarg_facet ((1,true),0.5000,922, + Iarg_facet ((2,false),0.5000,1323, + Iarg_leaf 1379))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,931, + Iarg_facet ((4,true),0.5000,735, + Iarg_facet ((5,true),0.6224,949, + Iarg_leaf 1148))), + Iarg_facet ((2,true),0.5000,788, + Iarg_facet ((4,true),0.6379,946, + Iarg_leaf 1954))), + Iarg_facet ((1,false),0.5000,1757, + Iarg_leaf 1758)), + Iarg_facet ((5,true),0.5000,1013, + Iarg_facet ((1,true),0.5000,1023, + Iarg_leaf 1196))), + Iarg_facet ((4,true),0.5000,1546, + Iarg_facet ((5,true),0.5000,1047, + Iarg_leaf 1805)))));; + +add_case ("OXLZLEZ 6346351218 1 9", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1600, + Iarg_facet ((0,true),0.6479,1016, + Iarg_facet ((3,true),0.5000,902, + Iarg_leaf 1823))), + Iarg_facet ((5,true),0.6131,964, + Iarg_leaf 1354)), + Iarg_facet ((4,true),0.5000,1099, + Iarg_facet ((5,true),0.6218,970, + Iarg_leaf 1349))), + Iarg_facet ((2,true),0.5000,1717, + Iarg_facet ((4,true),0.5000,1042, + Iarg_facet ((5,true),0.5000,728, + Iarg_leaf 1664)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1544, + Iarg_facet ((4,true),0.5000,848, + Iarg_leaf 1702)), + Iarg_facet ((2,true),0.5000,962, + Iarg_leaf 1497))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1509, + Iarg_facet ((4,true),0.5000,1182, + Iarg_leaf 1397)), + Iarg_facet ((2,true),0.5000,984, + Iarg_leaf 1550)), + Iarg_facet ((1,true),0.5000,1016, + Iarg_leaf 1862))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,787, + Iarg_leaf 1461), + Iarg_facet ((4,true),0.5000,761, + Iarg_leaf 1278)), + Iarg_facet ((2,true),0.5000,1166, + Iarg_leaf 1289)), + Iarg_facet ((1,true),0.5000,1130, + Iarg_facet ((2,true),0.5000,899, + Iarg_leaf 1217))), + Iarg_facet ((5,true),0.5000,1017, + Iarg_facet ((1,true),0.5000,1183, + Iarg_facet ((2,true),0.5000,959, + Iarg_leaf 1173))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1279, + Iarg_facet ((4,true),0.5000,792, + Iarg_leaf 1472)), + Iarg_facet ((2,true),0.5000,1161, + Iarg_facet ((4,true),0.5000,784, + Iarg_leaf 1250))), + Iarg_facet ((1,true),0.5000,1368, + Iarg_leaf 1775)), + Iarg_facet ((5,true),0.5000,999, + Iarg_facet ((1,true),0.5000,1354, + Iarg_leaf 1908))), + Iarg_facet ((4,true),0.5000,1381, + Iarg_facet ((5,true),0.5000,1110, + Iarg_facet ((1,true),0.5000,1353, + Iarg_leaf 1791))))));; + +add_case ("7550003505 2 4 4", + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,843, + Iarg_bisect (5, + Iarg_facet ((4,true),0.6243,1160, + Iarg_facet ((3,true),0.5000,900, + Iarg_leaf 1538)), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1794, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6418,784, + Iarg_leaf 1345), + Iarg_facet ((5,true),0.5000,1277, + Iarg_leaf 1450)), + Iarg_facet ((4,false),0.7190,1076, + Iarg_leaf 1273)), + Iarg_facet ((2,true),0.5000,1090, + Iarg_leaf 1615))), + Iarg_facet ((0,true),0.5000,1334, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1703, + Iarg_leaf 1945), + Iarg_facet ((4,false),0.7462,1070, + Iarg_leaf 1155)), + Iarg_facet ((2,true),0.5000,870, + Iarg_leaf 1644)))), + Iarg_facet ((3,true),0.5000,1858, + Iarg_facet ((0,false),0.5000,1002, + Iarg_leaf 1012))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1109, + Iarg_facet ((2,false),0.5961,1204, + Iarg_leaf 1980)), + Iarg_facet ((1,true),0.7555,1043, + Iarg_leaf 1916)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1006, + Iarg_facet ((2,false),0.6747,1189, + Iarg_leaf 1739)), + Iarg_facet ((1,true),0.7921,867, + Iarg_leaf 1244))), + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1555, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1390, + Iarg_leaf 1630), + Iarg_facet ((2,false),0.5000,1308, + Iarg_leaf 1403))), + Iarg_facet ((0,false),0.5000,1365, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1159, + Iarg_leaf 1514), + Iarg_facet ((2,true),0.5000,1207, + Iarg_leaf 1252)))))))), + Iarg_facet ((4,false),0.7397,1248, + Iarg_facet ((5,false),0.6761,1234, + Iarg_facet ((3,true),0.7455,795, + Iarg_facet ((0,false),0.5000,977, + Iarg_leaf 1383))))));; + +add_case ("OXLZLEZ 6346351218 2 2", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1755, + Iarg_facet ((3,true),0.5000,1916, + Iarg_facet ((1,true),0.5000,1231, + Iarg_facet ((2,true),0.5000,890, + Iarg_facet ((4,true),0.7607,1222, + Iarg_leaf 1321))))), + Iarg_facet ((5,true),0.6436,871, + Iarg_leaf 1440)), + Iarg_facet ((4,true),0.5000,868, + Iarg_facet ((5,true),0.6277,880, + Iarg_leaf 1518))), + Iarg_facet ((2,true),0.5000,1122, + Iarg_facet ((4,true),0.5000,877, + Iarg_facet ((5,true),0.6195,962, + Iarg_leaf 1549)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1955, + Iarg_facet ((4,true),0.5000,1357, + Iarg_facet ((5,true),0.5000,966, + Iarg_facet ((3,true),0.5000,1000, + Iarg_leaf 1193)))), + Iarg_facet ((2,true),0.5000,811, + Iarg_leaf 1979))), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1163, + Iarg_facet ((2,true),0.5000,746, + Iarg_facet ((4,true),0.6687,806, + Iarg_leaf 1447))), + Iarg_facet ((1,true),0.5000,762, + Iarg_leaf 1868))), + Iarg_facet ((5,true),0.5000,1535, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1082, + Iarg_facet ((2,true),0.5000,843, + Iarg_facet ((4,true),0.5000,1046, + Iarg_leaf 1335))), + Iarg_facet ((1,true),0.5000,752, + Iarg_leaf 1884)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1751, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1066, + Iarg_facet ((2,true),0.5000,1521, + Iarg_leaf 1926)), + Iarg_facet ((1,true),0.5000,768, + Iarg_leaf 1942))), + Iarg_facet ((5,true),0.6252,905, + Iarg_leaf 1686))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1976, + Iarg_facet ((2,true),0.6476,863, + Iarg_leaf 1504)), + Iarg_facet ((1,true),0.5000,1107, + Iarg_leaf 1619)), + Iarg_facet ((3,true),0.5000,767, + Iarg_leaf 1250)), + Iarg_facet ((5,true),0.6189,984, + Iarg_leaf 1467)), + Iarg_facet ((4,true),0.5000,1048, + Iarg_facet ((5,true),0.5000,778, + Iarg_leaf 1916)))));; + +add_case ("OXLZLEZ 6346351218 4 0", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1755, + Iarg_facet ((3,true),0.5000,1919, + Iarg_facet ((1,true),0.5000,1236, + Iarg_facet ((2,true),0.5000,888, + Iarg_facet ((4,true),0.6475,938, + Iarg_leaf 1599))))), + Iarg_facet ((5,true),0.6601,920, + Iarg_leaf 1373)), + Iarg_facet ((4,true),0.5000,869, + Iarg_facet ((5,true),0.6283,882, + Iarg_leaf 1514))), + Iarg_facet ((2,true),0.5000,1118, + Iarg_facet ((4,true),0.5000,864, + Iarg_facet ((5,true),0.6195,964, + Iarg_leaf 1547)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1955, + Iarg_facet ((4,true),0.5000,1357, + Iarg_facet ((5,true),0.5000,964, + Iarg_facet ((3,true),0.5000,1004, + Iarg_leaf 1196)))), + Iarg_facet ((2,true),0.5000,811, + Iarg_leaf 1979))), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1159, + Iarg_facet ((2,true),0.5000,742, + Iarg_facet ((4,true),0.6849,836, + Iarg_leaf 1407))), + Iarg_facet ((1,true),0.5000,756, + Iarg_leaf 1856))), + Iarg_facet ((5,true),0.5000,1526, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1086, + Iarg_facet ((2,true),0.5000,842, + Iarg_facet ((4,true),0.5000,1047, + Iarg_leaf 1336))), + Iarg_facet ((1,true),0.5000,750, + Iarg_leaf 1891)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1743, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1055, + Iarg_facet ((2,true),0.5000,1518, + Iarg_leaf 1922)), + Iarg_facet ((1,true),0.5000,764, + Iarg_leaf 1934))), + Iarg_facet ((5,true),0.6269,922, + Iarg_leaf 1652))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1967, + Iarg_facet ((2,true),0.6491,856, + Iarg_leaf 1488)), + Iarg_facet ((1,true),0.5000,1103, + Iarg_leaf 1609)), + Iarg_facet ((3,true),0.5000,761, + Iarg_leaf 1243)), + Iarg_facet ((5,true),0.6315,1008, + Iarg_leaf 1414)), + Iarg_facet ((4,true),0.5000,1045, + Iarg_facet ((5,true),0.5000,773, + Iarg_leaf 1904)))));; + +add_case ("7550003505 2 2 2", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1324, + Iarg_facet ((3,true),0.5000,1594, + Iarg_facet ((4,false),0.5000,835, + Iarg_leaf 1190))), + Iarg_facet ((2,true),0.5000,808, + Iarg_leaf 1289)), + Iarg_facet ((1,true),0.5000,1302, + Iarg_facet ((2,true),0.5000,798, + Iarg_leaf 1397))), + Iarg_facet ((0,true),0.5000,860, + Iarg_leaf 1246)), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1659, + Iarg_facet ((2,true),0.5000,1582, + Iarg_facet ((3,true),0.5000,1034, + Iarg_leaf 1109))), + Iarg_facet ((1,true),0.5000,1138, + Iarg_facet ((2,true),0.5000,1085, + Iarg_leaf 1747))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1697, + Iarg_facet ((2,true),0.5000,1109, + Iarg_facet ((3,false),0.5000,882, + Iarg_leaf 1148))), + Iarg_facet ((1,true),0.5000,1729, + Iarg_facet ((2,true),0.5000,1131, + Iarg_facet ((3,false),0.5000,1361, + Iarg_leaf 1476)))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1575, + Iarg_leaf 1667), + Iarg_facet ((5,false),0.5000,1889, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1573, + Iarg_leaf 1777), + Iarg_facet ((2,true),0.5000,1203, + Iarg_leaf 1315)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1288, + Iarg_leaf 1646), + Iarg_facet ((2,true),0.5000,788, + Iarg_leaf 1243)))))), + Iarg_facet ((5,true),0.9984,1726, + Iarg_leaf 1166)), + Iarg_bisect (5, + Iarg_facet ((4,true),0.5961,753, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_facet ((0,false),0.6274,959, + Iarg_leaf 1336), + Iarg_facet ((0,false),0.5969,1091, + Iarg_facet ((1,true),0.6398,793, + Iarg_leaf 1409))), + Iarg_facet ((5,false),0.6350,886, + Iarg_facet ((0,false),0.5619,892, + Iarg_facet ((1,true),0.5000,756, + Iarg_leaf 1851))))), + Iarg_facet ((4,true),0.7392,1004, + Iarg_facet ((5,true),0.8553,710, + Iarg_leaf 1392)))), + Iarg_facet ((4,false),0.5000,1543, + Iarg_facet ((5,false),0.6345,1088, + Iarg_leaf 251))));; + +add_case ("OXLZLEZ 6346351218 3 2", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1887, + Iarg_facet ((3,true),0.5888,833, + Iarg_facet ((1,true),0.5000,1223, + Iarg_facet ((2,true),0.5000,821, + Iarg_leaf 1761)))), + Iarg_facet ((5,true),0.6366,910, + Iarg_leaf 1541)), + Iarg_facet ((4,true),0.5000,1140, + Iarg_facet ((5,true),0.5000,741, + Iarg_leaf 1916))), + Iarg_facet ((2,true),0.5000,1474, + Iarg_facet ((4,true),0.5000,1089, + Iarg_facet ((5,true),0.5000,811, + Iarg_leaf 1936)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1279, + Iarg_facet ((4,true),0.5000,741, + Iarg_facet ((5,false),0.5000,1371, + Iarg_leaf 1550))), + Iarg_facet ((2,true),0.6180,864, + Iarg_leaf 1431))), + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1985, + Iarg_facet ((2,true),0.5000,1751, + Iarg_facet ((4,false),0.5000,1767, + Iarg_leaf 1899))), + Iarg_facet ((1,true),0.5000,856, + Iarg_leaf 1296))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1814, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,859, + Iarg_leaf 1870), + Iarg_facet ((4,true),0.5000,933, + Iarg_facet ((5,true),0.7375,860, + Iarg_leaf 1116)))), + Iarg_facet ((1,true),0.5000,900, + Iarg_leaf 1695)), + Iarg_facet ((5,true),0.5000,1166, + Iarg_facet ((1,true),0.5000,1093, + Iarg_facet ((2,false),0.5000,1340, + Iarg_leaf 1475))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,988, + Iarg_facet ((4,true),0.5000,701, + Iarg_facet ((5,true),0.6340,883, + Iarg_leaf 1135))), + Iarg_facet ((2,true),0.5000,824, + Iarg_facet ((4,true),0.6203,890, + Iarg_leaf 1985))), + Iarg_facet ((1,false),0.5000,1840, + Iarg_leaf 1904)), + Iarg_facet ((5,true),0.5000,1161, + Iarg_facet ((1,true),0.5000,1334, + Iarg_leaf 1394))), + Iarg_facet ((4,true),0.5000,1775, + Iarg_facet ((5,true),0.5000,1192, + Iarg_facet ((1,true),0.5000,1040, + Iarg_leaf 1215))))));; + +add_case ("OXLZLEZ 6346351218 2 37", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1714, + Iarg_facet ((3,true),0.5000,917, + Iarg_facet ((1,true),0.5000,1075, + Iarg_leaf 1876))), + Iarg_facet ((5,true),0.6288,929, + Iarg_leaf 1363)), + Iarg_facet ((4,true),0.5000,1189, + Iarg_facet ((5,true),0.5000,747, + Iarg_leaf 1769))), + Iarg_facet ((2,true),0.5000,1506, + Iarg_facet ((4,true),0.5000,1075, + Iarg_facet ((5,true),0.5000,857, + Iarg_leaf 1752)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1233, + Iarg_facet ((4,true),0.5000,750, + Iarg_facet ((5,false),0.5000,1290, + Iarg_leaf 1335))), + Iarg_facet ((2,true),0.6263,922, + Iarg_leaf 1431))), + Iarg_facet ((5,true),0.5000,1868, + Iarg_facet ((1,true),0.5000,1894, + Iarg_facet ((2,true),0.5000,1728, + Iarg_facet ((4,true),0.5000,1678, + Iarg_leaf 1719))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1798, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,890, + Iarg_leaf 1819), + Iarg_facet ((4,true),0.5000,888, + Iarg_leaf 1760))), + Iarg_facet ((1,true),0.5000,807, + Iarg_leaf 1399)), + Iarg_facet ((5,true),0.5000,1112, + Iarg_facet ((1,true),0.5000,967, + Iarg_facet ((2,false),0.5000,1259, + Iarg_leaf 1373))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,993, + Iarg_facet ((4,true),0.5000,725, + Iarg_leaf 1993)), + Iarg_facet ((2,true),0.5000,808, + Iarg_facet ((4,true),0.6461,908, + Iarg_leaf 1714))), + Iarg_facet ((1,false),0.5000,1754, + Iarg_leaf 1808)), + Iarg_facet ((5,true),0.5000,1096, + Iarg_facet ((1,true),0.5000,1044, + Iarg_leaf 1215))), + Iarg_facet ((4,true),0.5000,1661, + Iarg_facet ((5,true),0.5000,1127, + Iarg_leaf 1953)))));; + +add_case ("OXLZLEZ 6346351218 3 24", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1376, + Iarg_facet ((4,true),0.5000,902, + Iarg_facet ((5,true),0.6369,991, + Iarg_leaf 1852))), + Iarg_facet ((2,true),0.6189,909, + Iarg_leaf 1131)), + Iarg_facet ((1,true),0.5000,846, + Iarg_leaf 1465)), + Iarg_facet ((5,true),0.5000,717, + Iarg_facet ((1,true),0.5000,767, + Iarg_leaf 1600))), + Iarg_facet ((4,true),0.5000,1262, + Iarg_facet ((5,true),0.5000,812, + Iarg_facet ((1,true),0.5000,780, + Iarg_leaf 1596)))), + Iarg_facet ((2,true),0.5000,1493, + Iarg_facet ((4,true),0.5000,1111, + Iarg_facet ((5,true),0.5000,939, + Iarg_facet ((2,true),0.5000,777, + Iarg_leaf 1584))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1109, + Iarg_facet ((4,true),0.5000,803, + Iarg_facet ((5,false),0.5000,1539, + Iarg_leaf 1734))), + Iarg_facet ((2,true),0.6494,795, + Iarg_leaf 1517))), + Iarg_facet ((5,true),0.5000,1754, + Iarg_facet ((1,true),0.5000,1675, + Iarg_facet ((2,true),0.5000,1876, + Iarg_facet ((4,false),0.5000,1979, + Iarg_facet ((5,true),0.7268,708, + Iarg_leaf 1323)))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1838, + Iarg_facet ((1,true),0.5000,1707, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,905, + Iarg_facet ((5,true),0.7439,855, + Iarg_leaf 1075)), + Iarg_facet ((4,true),0.5000,1036, + Iarg_facet ((5,true),0.7433,773, + Iarg_leaf 1311))))), + Iarg_facet ((5,true),0.5000,1007, + Iarg_facet ((1,true),0.5000,892, + Iarg_facet ((2,false),0.5000,1431, + Iarg_leaf 1962))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,907, + Iarg_facet ((4,true),0.6208,939, + Iarg_leaf 1976)), + Iarg_facet ((2,true),0.5000,833, + Iarg_facet ((4,true),0.6461,846, + Iarg_facet ((5,true),0.5000,745, + Iarg_leaf 1532)))), + Iarg_facet ((1,false),0.5000,1883, + Iarg_facet ((2,true),0.6962,754, + Iarg_leaf 1558))), + Iarg_facet ((5,true),0.5000,1016, + Iarg_leaf 1854)), + Iarg_facet ((4,true),0.5000,1504, + Iarg_facet ((5,true),0.5000,1005, + Iarg_leaf 1774)))));; + +add_case ("OXLZLEZ 6346351218 4 23", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1375, + Iarg_facet ((4,true),0.5000,902, + Iarg_facet ((5,true),0.6364,992, + Iarg_leaf 1860))), + Iarg_facet ((2,true),0.6192,911, + Iarg_leaf 1133)), + Iarg_facet ((1,true),0.5000,846, + Iarg_leaf 1467)), + Iarg_facet ((5,true),0.5000,719, + Iarg_facet ((1,true),0.5000,768, + Iarg_leaf 1600))), + Iarg_facet ((4,true),0.5000,1262, + Iarg_facet ((5,true),0.5000,810, + Iarg_facet ((1,true),0.5000,780, + Iarg_leaf 1594)))), + Iarg_facet ((2,true),0.5000,1492, + Iarg_facet ((4,true),0.5000,1112, + Iarg_facet ((5,true),0.5000,939, + Iarg_facet ((2,true),0.5000,777, + Iarg_leaf 1584))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1111, + Iarg_facet ((4,true),0.5000,803, + Iarg_facet ((5,false),0.5000,1541, + Iarg_leaf 1737))), + Iarg_facet ((2,true),0.6542,800, + Iarg_leaf 1498))), + Iarg_facet ((5,true),0.5000,1751, + Iarg_facet ((1,true),0.5000,1677, + Iarg_facet ((2,true),0.5000,1875, + Iarg_facet ((4,false),0.5000,1981, + Iarg_facet ((5,true),0.7741,846, + Iarg_leaf 1264)))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1837, + Iarg_facet ((1,true),0.5000,1711, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,903, + Iarg_facet ((5,true),0.7501,864, + Iarg_leaf 1205)), + Iarg_facet ((4,true),0.5000,1036, + Iarg_facet ((5,true),0.7697,842, + Iarg_leaf 1356))))), + Iarg_facet ((5,true),0.5000,1013, + Iarg_facet ((1,true),0.5000,894, + Iarg_facet ((2,false),0.5000,1427, + Iarg_leaf 1939))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,906, + Iarg_facet ((4,true),0.6326,970, + Iarg_leaf 1918)), + Iarg_facet ((2,true),0.5000,828, + Iarg_facet ((4,true),0.6466,850, + Iarg_facet ((5,true),0.5000,732, + Iarg_leaf 1516)))), + Iarg_facet ((1,false),0.5000,1877, + Iarg_facet ((2,true),0.7519,866, + Iarg_leaf 1609))), + Iarg_facet ((5,true),0.5000,1016, + Iarg_leaf 1852)), + Iarg_facet ((4,true),0.5000,1503, + Iarg_facet ((5,true),0.5000,1007, + Iarg_leaf 1774)))));; + +add_case ("TEWNSCJ split(0/2)", + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1922, + Iarg_facet ((5,false),0.5000,1555, + Iarg_leaf 1705)), + Iarg_facet ((4,true),0.5000,1172, + Iarg_facet ((5,false),0.5000,1489, + Iarg_leaf 1712))), + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1592, + Iarg_facet ((5,true),0.6535,842, + Iarg_leaf 1298)), + Iarg_facet ((4,true),0.5000,756, + Iarg_facet ((5,true),0.6542,839, + Iarg_leaf 1224)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,988, + Iarg_facet ((5,false),0.5000,945, + Iarg_leaf 1191)), + Iarg_facet ((4,true),0.5000,1095, + Iarg_facet ((5,false),0.5000,927, + Iarg_leaf 1251))), + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1030, + Iarg_leaf 1706), + Iarg_facet ((4,true),0.6174,776, + Iarg_leaf 1224)))));; + +add_case ("OXLZLEZ 6346351218 4 2", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1896, + Iarg_facet ((3,true),0.6313,916, + Iarg_facet ((1,true),0.5000,1146, + Iarg_facet ((2,true),0.5000,768, + Iarg_leaf 1593)))), + Iarg_facet ((5,true),0.6366,920, + Iarg_leaf 1539)), + Iarg_facet ((4,true),0.5000,1178, + Iarg_facet ((5,true),0.5000,768, + Iarg_leaf 1945))), + Iarg_facet ((2,true),0.5000,1492, + Iarg_facet ((4,true),0.5000,1114, + Iarg_facet ((5,true),0.5000,836, + Iarg_leaf 1953)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1359, + Iarg_facet ((4,true),0.5000,784, + Iarg_facet ((5,false),0.5000,1461, + Iarg_leaf 1702))), + Iarg_facet ((2,true),0.5000,727, + Iarg_leaf 1885))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1892, + Iarg_facet ((4,false),0.5000,1890, + Iarg_facet ((5,true),0.7913,910, + Iarg_leaf 1099))), + Iarg_facet ((2,true),0.5000,733, + Iarg_leaf 1374)), + Iarg_facet ((1,true),0.5000,888, + Iarg_leaf 1369))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1961, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,914, + Iarg_facet ((5,true),0.6680,731, + Iarg_leaf 1104)), + Iarg_facet ((4,true),0.5000,1021, + Iarg_facet ((5,true),0.6678,769, + Iarg_leaf 1350)))), + Iarg_facet ((1,true),0.5000,942, + Iarg_leaf 1849)), + Iarg_facet ((5,true),0.5000,1250, + Iarg_facet ((1,true),0.5000,1110, + Iarg_facet ((2,false),0.5000,1485, + Iarg_leaf 1691))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1058, + Iarg_facet ((4,true),0.5000,734, + Iarg_facet ((5,true),0.6232,917, + Iarg_leaf 1162))), + Iarg_facet ((2,true),0.5000,897, + Iarg_facet ((4,true),0.5000,731, + Iarg_facet ((5,true),0.5000,789, + Iarg_leaf 1780)))), + Iarg_facet ((1,false),0.5000,1980, + Iarg_facet ((2,true),0.6592,786, + Iarg_leaf 1309))), + Iarg_facet ((5,true),0.5000,1240, + Iarg_facet ((1,true),0.5000,1443, + Iarg_leaf 1479))), + Iarg_facet ((4,true),0.5000,1885, + Iarg_facet ((5,true),0.5000,1261, + Iarg_facet ((1,true),0.5000,1088, + Iarg_leaf 1282))))));; + +add_case ("OXLZLEZ 6346351218 4 1", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1906, + Iarg_facet ((3,true),0.6057,878, + Iarg_facet ((1,true),0.5000,1212, + Iarg_facet ((2,true),0.5000,807, + Iarg_leaf 1681)))), + Iarg_facet ((5,true),0.6144,872, + Iarg_leaf 1609)), + Iarg_facet ((4,true),0.5000,1185, + Iarg_facet ((5,true),0.5000,766, + Iarg_leaf 1950))), + Iarg_facet ((2,true),0.5000,1504, + Iarg_facet ((4,true),0.5000,1113, + Iarg_facet ((5,true),0.5000,836, + Iarg_leaf 1953)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1363, + Iarg_facet ((4,true),0.5000,786, + Iarg_facet ((5,false),0.5000,1464, + Iarg_leaf 1700))), + Iarg_facet ((2,true),0.5000,723, + Iarg_leaf 1887))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1897, + Iarg_facet ((4,false),0.5000,1889, + Iarg_facet ((5,true),0.7587,785, + Iarg_leaf 1285))), + Iarg_facet ((2,true),0.5000,735, + Iarg_leaf 1377)), + Iarg_facet ((1,true),0.5000,887, + Iarg_leaf 1368))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1950, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,915, + Iarg_facet ((5,true),0.6927,775, + Iarg_leaf 1092)), + Iarg_facet ((4,true),0.5000,1019, + Iarg_facet ((5,true),0.6678,767, + Iarg_leaf 1339)))), + Iarg_facet ((1,true),0.5000,939, + Iarg_leaf 1837)), + Iarg_facet ((5,true),0.5000,1253, + Iarg_facet ((1,true),0.5000,1112, + Iarg_facet ((2,false),0.5000,1461, + Iarg_leaf 1665))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1058, + Iarg_facet ((4,true),0.5000,735, + Iarg_facet ((5,true),0.6229,913, + Iarg_leaf 1156))), + Iarg_facet ((2,true),0.5000,902, + Iarg_facet ((4,true),0.5000,734, + Iarg_facet ((5,true),0.5000,789, + Iarg_leaf 1793)))), + Iarg_facet ((1,false),0.5000,1971, + Iarg_facet ((2,true),0.6594,787, + Iarg_leaf 1307))), + Iarg_facet ((5,true),0.5000,1236, + Iarg_facet ((1,true),0.5000,1443, + Iarg_leaf 1484))), + Iarg_facet ((4,true),0.5000,1876, + Iarg_facet ((5,true),0.5000,1249, + Iarg_facet ((1,true),0.5000,1083, + Iarg_leaf 1276))))));; + +add_case ("QITNPEA 3848804089 split(0/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1358, + Iarg_facet ((4,true),0.5000,1868, + Iarg_facet ((5,true),0.5000,1364, + Iarg_facet ((1,true),0.5000,1373, + Iarg_facet ((2,true),0.5000,963, + Iarg_facet ((3,true),0.7854,831, + Iarg_leaf 1307)))))), + Iarg_facet ((3,true),0.6318,908, + Iarg_facet ((4,true),0.6221,900, + Iarg_leaf 1418))), + Iarg_facet ((2,true),0.5000,1330, + Iarg_facet ((3,true),0.6307,908, + Iarg_facet ((4,true),0.6591,900, + Iarg_leaf 1359)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1111, + Iarg_facet ((3,true),0.6649,820, + Iarg_facet ((4,true),0.8639,1262, + Iarg_leaf 844))), + Iarg_facet ((2,true),0.6540,774, + Iarg_leaf 1118))), + Iarg_facet ((5,true),0.5000,1645, + Iarg_facet ((1,true),0.5000,1716, + Iarg_facet ((2,true),0.5000,1508, + Iarg_facet ((3,true),0.6635,824, + Iarg_facet ((4,false),0.5000,1027, + Iarg_leaf 1124)))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1527, + Iarg_facet ((1,true),0.5000,1379, + Iarg_facet ((2,true),0.5000,881, + Iarg_leaf 1604))), + Iarg_facet ((5,true),0.6617,803, + Iarg_leaf 1176))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1659, + Iarg_bisect (2, + Iarg_facet ((3,true),0.6749,715, + Iarg_leaf 1516), + Iarg_facet ((3,true),0.7707,888, + Iarg_leaf 1703))), + Iarg_facet ((1,true),0.6350,857, + Iarg_leaf 1069)), + Iarg_facet ((5,true),0.5000,874, + Iarg_facet ((1,true),0.5000,870, + Iarg_facet ((2,false),0.5000,1145, + Iarg_leaf 1264)))), + Iarg_facet ((4,true),0.5000,912, + Iarg_facet ((5,true),0.6441,843, + Iarg_leaf 1302)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,897, + Iarg_facet ((3,true),0.7011,762, + Iarg_leaf 1452)), + Iarg_facet ((2,true),0.5000,740, + Iarg_facet ((3,true),0.7688,886, + Iarg_leaf 1750))), + Iarg_facet ((1,false),0.5000,1510, + Iarg_leaf 1582)), + Iarg_facet ((5,true),0.5000,868, + Iarg_facet ((1,true),0.5000,1058, + Iarg_leaf 1119))), + Iarg_facet ((4,true),0.5000,868, + Iarg_facet ((5,true),0.6243,943, + Iarg_leaf 1359))), + Iarg_facet ((3,true),0.5000,1420, + Iarg_facet ((4,true),0.5000,1463, + Iarg_facet ((5,true),0.5000,925, + Iarg_leaf 1912))))));; + +add_case ("OXLZLEZ 6346351218 2 36", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,1113, + Iarg_facet ((1,true),0.5000,1388, + Iarg_facet ((2,true),0.5000,914, + Iarg_leaf 1863))), + Iarg_facet ((3,true),0.7351,799, + Iarg_leaf 1066)), + Iarg_facet ((5,true),0.5000,760, + Iarg_facet ((3,true),0.8627,1184, + Iarg_leaf 712))), + Iarg_facet ((4,true),0.5000,1381, + Iarg_facet ((5,true),0.5000,837, + Iarg_facet ((3,true),0.8512,1144, + Iarg_leaf 760)))), + Iarg_facet ((2,true),0.5000,1692, + Iarg_facet ((4,true),0.5000,1208, + Iarg_facet ((5,true),0.5000,1004, + Iarg_facet ((3,true),0.7214,782, + Iarg_leaf 1128))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1334, + Iarg_facet ((4,true),0.5000,814, + Iarg_facet ((5,false),0.5000,1585, + Iarg_leaf 1686))), + Iarg_facet ((2,true),0.6226,965, + Iarg_leaf 1643))), + Iarg_facet ((5,true),0.5000,1867, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1968, + Iarg_bisect (4, + Iarg_facet ((5,true),0.7427,890, + Iarg_leaf 1088), + Iarg_facet ((5,true),0.7543,793, + Iarg_leaf 1276))), + Iarg_facet ((2,true),0.6203,917, + Iarg_leaf 1074)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1901, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1001, + Iarg_facet ((5,true),0.6596,841, + Iarg_leaf 1231)), + Iarg_facet ((4,true),0.5000,1025, + Iarg_facet ((5,true),0.6945,708, + Iarg_leaf 1313)))), + Iarg_facet ((1,true),0.5000,806, + Iarg_leaf 1441)), + Iarg_facet ((5,true),0.5000,1111, + Iarg_facet ((1,true),0.5000,970, + Iarg_facet ((2,false),0.5000,1410, + Iarg_leaf 1540))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1049, + Iarg_facet ((4,true),0.5000,796, + Iarg_facet ((5,true),0.5000,743, + Iarg_leaf 1682))), + Iarg_facet ((2,true),0.5000,848, + Iarg_facet ((4,true),0.6315,988, + Iarg_facet ((5,true),0.5000,702, + Iarg_leaf 1483)))), + Iarg_facet ((1,false),0.5000,1898, + Iarg_leaf 1965)), + Iarg_facet ((5,true),0.5000,1085, + Iarg_facet ((1,true),0.5000,1065, + Iarg_leaf 1235))), + Iarg_facet ((4,true),0.5000,1664, + Iarg_facet ((5,true),0.5000,1128, + Iarg_leaf 1961)))));; + +add_case ("OXLZLEZ 6346351218 1 4", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1617, + Iarg_bisect (0, + Iarg_facet ((3,false),0.5000,1023, + Iarg_leaf 1090), + Iarg_facet ((3,false),0.5000,1121, + Iarg_leaf 1199))), + Iarg_facet ((5,true),0.8284,1192, + Iarg_leaf 754)), + Iarg_facet ((4,true),0.5000,750, + Iarg_facet ((5,true),0.6719,736, + Iarg_leaf 1121))), + Iarg_facet ((2,true),0.5000,1032, + Iarg_facet ((4,true),0.6174,867, + Iarg_leaf 1539))), + Iarg_facet ((1,true),0.5000,959, + Iarg_facet ((2,true),0.6379,837, + Iarg_leaf 1187))), + Iarg_facet ((5,true),0.5000,1035, + Iarg_facet ((1,true),0.5000,910, + Iarg_facet ((2,true),0.6177,868, + Iarg_leaf 1224)))), + Iarg_facet ((4,true),0.5000,1553, + Iarg_facet ((5,true),0.5000,1027, + Iarg_facet ((1,true),0.5000,949, + Iarg_facet ((4,true),0.6221,865, + Iarg_leaf 1192))))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1492, + Iarg_facet ((5,true),0.5000,1067, + Iarg_facet ((2,true),0.5000,948, + Iarg_facet ((4,true),0.8162,1299, + Iarg_leaf 775)))), + Iarg_facet ((4,true),0.6451,854, + Iarg_leaf 1139))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1480, + Iarg_facet ((4,true),0.5000,1099, + Iarg_facet ((5,false),0.5000,1843, + Iarg_facet ((1,true),0.6310,817, + Iarg_leaf 1352)))), + Iarg_facet ((2,true),0.6723,788, + Iarg_leaf 1211))), + Iarg_facet ((5,true),0.5000,1406, + Iarg_facet ((1,true),0.5000,1965, + Iarg_facet ((2,true),0.5000,1633, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6347,917, + Iarg_leaf 1509), + Iarg_facet ((5,true),0.6658,814, + Iarg_leaf 1854)))))), + Iarg_facet ((4,true),0.5000,1968, + Iarg_facet ((5,true),0.5000,1316, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,965, + Iarg_facet ((5,true),0.6249,896, + Iarg_leaf 1594)), + Iarg_facet ((4,true),0.5000,726, + Iarg_facet ((5,true),0.7885,1253, + Iarg_leaf 1543))), + Iarg_facet ((2,true),0.5000,908, + Iarg_leaf 1227))))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1698, + Iarg_facet ((5,true),0.5000,1649, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1224, + Iarg_facet ((4,true),0.5000,912, + Iarg_facet ((5,true),0.5000,725, + Iarg_facet ((2,true),0.6203,848, + Iarg_leaf 1018)))), + Iarg_facet ((2,true),0.5000,936, + Iarg_facet ((4,true),0.6232,919, + Iarg_facet ((5,true),0.6649,806, + Iarg_leaf 1699)))))), + Iarg_facet ((4,true),0.6560,796, + Iarg_leaf 1552))));; + +add_case ("OXLZLEZ 6346351218 2 33", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1391, + Iarg_facet ((5,true),0.5000,989, + Iarg_facet ((0,true),0.6326,891, + Iarg_leaf 1833))), + Iarg_facet ((4,true),0.6584,986, + Iarg_leaf 1114)), + Iarg_facet ((3,true),0.5000,1026, + Iarg_facet ((4,true),0.6324,894, + Iarg_leaf 1174))), + Iarg_facet ((2,true),0.5000,1471, + Iarg_facet ((3,true),0.5000,1024, + Iarg_facet ((4,true),0.7597,1202, + Iarg_leaf 905)))), + Iarg_facet ((1,true),0.5000,1796, + Iarg_facet ((2,true),0.5000,1013, + Iarg_facet ((3,true),0.5000,758, + Iarg_leaf 1493)))), + Iarg_facet ((5,true),0.5000,1695, + Iarg_facet ((1,true),0.5000,1717, + Iarg_facet ((2,true),0.5000,1271, + Iarg_facet ((3,true),0.5000,776, + Iarg_leaf 1499))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1799, + Iarg_facet ((3,true),0.5000,1474, + Iarg_leaf 1822)), + Iarg_facet ((2,true),0.5000,1092, + Iarg_leaf 1779)), + Iarg_facet ((1,true),0.5000,1149, + Iarg_facet ((2,true),0.5000,771, + Iarg_leaf 1330))), + Iarg_facet ((5,true),0.5000,981, + Iarg_facet ((1,true),0.5000,1216, + Iarg_facet ((2,true),0.5000,811, + Iarg_leaf 1415))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1936, + Iarg_facet ((1,true),0.5000,1846, + Iarg_facet ((2,true),0.5000,1646, + Iarg_facet ((3,true),0.5000,734, + Iarg_leaf 1360)))), + Iarg_facet ((5,true),0.5000,968, + Iarg_facet ((1,true),0.5000,910, + Iarg_leaf 1731))), + Iarg_facet ((4,true),0.5000,1603, + Iarg_facet ((5,true),0.5000,1090, + Iarg_facet ((1,true),0.5000,1306, + Iarg_facet ((2,true),0.5000,1054, + Iarg_leaf 1342)))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,980, + Iarg_facet ((3,true),0.5000,704, + Iarg_leaf 1341)), + Iarg_facet ((2,true),0.5000,761, + Iarg_leaf 1580)), + Iarg_facet ((1,true),0.5000,1120, + Iarg_leaf 1289)), + Iarg_facet ((5,true),0.5000,991, + Iarg_leaf 1999)), + Iarg_facet ((4,true),0.5000,1485, + Iarg_facet ((5,true),0.5000,1269, + Iarg_facet ((1,true),0.5000,1518, + Iarg_facet ((2,true),0.5000,750, + Iarg_leaf 1286))))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1565, + Iarg_facet ((5,true),0.5000,1103, + Iarg_facet ((1,true),0.5000,979, + Iarg_leaf 1231))), + Iarg_facet ((4,true),0.6571,866, + Iarg_leaf 1246)))));; + +add_case ("OXLZLEZ 6346351218 2 6", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1977, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1244, + Iarg_facet ((2,true),0.5000,907, + Iarg_facet ((4,true),0.6366,935, + Iarg_facet ((5,true),0.7692,842, + Iarg_leaf 1011)))), + Iarg_facet ((1,true),0.5000,874, + Iarg_leaf 1926))), + Iarg_facet ((5,true),0.6398,961, + Iarg_leaf 1596)), + Iarg_facet ((4,true),0.5000,900, + Iarg_facet ((5,true),0.5000,701, + Iarg_facet ((3,true),0.5000,949, + Iarg_leaf 1154)))), + Iarg_facet ((2,true),0.5000,1142, + Iarg_facet ((4,true),0.5000,915, + Iarg_facet ((5,true),0.5000,722, + Iarg_facet ((3,true),0.5000,948, + Iarg_leaf 1160))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1445, + Iarg_facet ((3,false),0.5000,1956, + Iarg_leaf 1982)), + Iarg_facet ((5,true),0.6547,879, + Iarg_leaf 1046)), + Iarg_facet ((4,true),0.5000,766, + Iarg_facet ((5,true),0.6554,846, + Iarg_leaf 1081))), + Iarg_facet ((2,true),0.5000,1049, + Iarg_facet ((4,true),0.5000,750, + Iarg_facet ((5,true),0.6474,907, + Iarg_leaf 1121))))), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1216, + Iarg_facet ((2,true),0.5000,744, + Iarg_facet ((4,true),0.6617,840, + Iarg_leaf 1545))), + Iarg_facet ((1,true),0.5000,897, + Iarg_facet ((2,true),0.6416,885, + Iarg_leaf 1422)))), + Iarg_facet ((5,true),0.5000,1735, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1072, + Iarg_facet ((2,true),0.5000,898, + Iarg_facet ((4,true),0.5000,1109, + Iarg_leaf 1412))), + Iarg_facet ((1,true),0.5000,898, + Iarg_facet ((2,true),0.6266,969, + Iarg_leaf 1519))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1844, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1105, + Iarg_facet ((2,true),0.5000,1578, + Iarg_facet ((4,true),0.6651,795, + Iarg_leaf 1117))), + Iarg_facet ((1,true),0.5000,954, + Iarg_facet ((2,true),0.5000,1089, + Iarg_leaf 1534)))), + Iarg_facet ((5,true),0.5000,730, + Iarg_facet ((3,true),0.5000,945, + Iarg_leaf 1417)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6421,884, + Iarg_leaf 1579), + Iarg_facet ((2,true),0.6721,729, + Iarg_leaf 1185)), + Iarg_facet ((1,true),0.5000,1445, + Iarg_facet ((2,true),0.6501,840, + Iarg_leaf 1224))), + Iarg_facet ((3,true),0.5000,887, + Iarg_leaf 1284)), + Iarg_facet ((5,true),0.5000,771, + Iarg_leaf 1948)), + Iarg_facet ((4,true),0.5000,1160, + Iarg_facet ((5,true),0.5000,845, + Iarg_facet ((3,true),0.5000,917, + Iarg_leaf 1166))))));; + +add_case ("OXLZLEZ 6346351218 3 0", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1384, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1468, + Iarg_facet ((1,true),0.5000,1362, + Iarg_facet ((2,true),0.5000,942, + Iarg_leaf 1990))), + Iarg_facet ((5,true),0.6644,800, + Iarg_leaf 1125))), + Iarg_facet ((3,true),0.6203,969, + Iarg_facet ((4,true),0.5000,755, + Iarg_leaf 1856))), + Iarg_facet ((2,true),0.5000,1508, + Iarg_facet ((3,true),0.6065,964, + Iarg_facet ((4,true),0.5000,721, + Iarg_leaf 1949)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1284, + Iarg_facet ((3,true),0.6513,891, + Iarg_facet ((4,true),0.6732,756, + Iarg_leaf 1583))), + Iarg_facet ((2,true),0.6334,850, + Iarg_leaf 1335))), + Iarg_facet ((5,true),0.5000,1891, + Iarg_facet ((1,true),0.5000,1992, + Iarg_facet ((2,true),0.5000,1728, + Iarg_facet ((3,true),0.6476,881, + Iarg_facet ((4,false),0.5000,1161, + Iarg_leaf 1293)))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1717, + Iarg_facet ((1,true),0.5000,1553, + Iarg_facet ((2,true),0.5000,987, + Iarg_leaf 1707))), + Iarg_facet ((5,true),0.6451,862, + Iarg_leaf 1369))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1904, + Iarg_bisect (2, + Iarg_facet ((3,true),0.6608,790, + Iarg_leaf 1734), + Iarg_facet ((3,true),0.7149,830, + Iarg_leaf 1800))), + Iarg_facet ((1,true),0.5000,789, + Iarg_leaf 1622)), + Iarg_facet ((5,true),0.5000,1025, + Iarg_facet ((1,true),0.5000,1023, + Iarg_facet ((2,false),0.5000,1318, + Iarg_leaf 1444)))), + Iarg_facet ((4,true),0.5000,1047, + Iarg_facet ((5,true),0.6224,913, + Iarg_leaf 1529)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1024, + Iarg_facet ((3,true),0.6619,793, + Iarg_leaf 1742)), + Iarg_facet ((2,true),0.5000,850, + Iarg_facet ((3,true),0.7284,870, + Iarg_leaf 1847))), + Iarg_facet ((1,false),0.5000,1746, + Iarg_leaf 1817)), + Iarg_facet ((5,true),0.5000,1006, + Iarg_facet ((1,true),0.5000,1260, + Iarg_leaf 1316))), + Iarg_facet ((4,true),0.5000,978, + Iarg_facet ((5,true),0.5000,765, + Iarg_leaf 1917))), + Iarg_facet ((3,true),0.5000,1601, + Iarg_facet ((4,true),0.5000,1716, + Iarg_facet ((5,true),0.5000,1086, + Iarg_facet ((1,true),0.5000,1029, + Iarg_leaf 1209)))))));; + +add_case ("OXLZLEZ 6346351218 1 24", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1682, + Iarg_facet ((4,true),0.5000,1285, + Iarg_facet ((5,true),0.5000,1014, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1080, + Iarg_leaf 1137), + Iarg_facet ((0,true),0.5000,1443, + Iarg_leaf 1490))))), + Iarg_facet ((2,true),0.6471,883, + Iarg_leaf 1326)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1904, + Iarg_facet ((4,true),0.5000,1521, + Iarg_facet ((5,true),0.5000,1208, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1675, + Iarg_leaf 1679), + Iarg_facet ((0,false),0.5000,1675, + Iarg_leaf 1746))))), + Iarg_facet ((2,true),0.6229,947, + Iarg_leaf 1657))), + Iarg_facet ((3,false),0.5000,1483, + Iarg_leaf 1795)), + Iarg_facet ((5,true),0.5000,943, + Iarg_facet ((3,false),0.5000,1495, + Iarg_leaf 1796))), + Iarg_facet ((4,true),0.5000,1296, + Iarg_facet ((5,true),0.5000,866, + Iarg_facet ((3,false),0.5000,1497, + Iarg_leaf 1806)))), + Iarg_facet ((2,true),0.5000,1870, + Iarg_facet ((4,true),0.5000,1212, + Iarg_facet ((5,true),0.5000,973, + Iarg_facet ((3,false),0.5000,1504, + Iarg_leaf 1805))))), + Iarg_facet ((1,true),0.5000,1813, + Iarg_facet ((2,true),0.5000,1120, + Iarg_facet ((4,true),0.5000,873, + Iarg_facet ((5,true),0.5000,760, + Iarg_leaf 1263))))), + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1730, + Iarg_facet ((2,true),0.5000,1203, + Iarg_facet ((4,true),0.5000,1122, + Iarg_leaf 1788))), + Iarg_facet ((1,true),0.6340,895, + Iarg_leaf 1166))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1768, + Iarg_facet ((1,true),0.5000,1911, + Iarg_facet ((2,true),0.5000,1676, + Iarg_facet ((4,true),0.6221,956, + Iarg_leaf 1433)))), + Iarg_facet ((5,true),0.6521,839, + Iarg_leaf 1666))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1917, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1089, + Iarg_facet ((4,true),0.6400,944, + Iarg_leaf 1425)), + Iarg_facet ((2,true),0.5000,841, + Iarg_leaf 1709))), + Iarg_facet ((5,true),0.6566,880, + Iarg_leaf 1492)), + Iarg_facet ((4,true),0.5000,792, + Iarg_facet ((5,true),0.6332,916, + Iarg_leaf 1842)))));; + +add_case ("OXLZLEZ 6346351218 3 5", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1289, + Iarg_facet ((2,true),0.5000,921, + Iarg_facet ((4,true),0.6035,873, + Iarg_facet ((5,true),0.6877,703, + Iarg_leaf 1246)))), + Iarg_facet ((1,true),0.5000,898, + Iarg_leaf 1932)), + Iarg_facet ((3,true),0.5000,895, + Iarg_leaf 1133)), + Iarg_facet ((5,true),0.6326,969, + Iarg_leaf 1675)), + Iarg_facet ((4,true),0.5000,984, + Iarg_facet ((5,true),0.5000,715, + Iarg_facet ((3,true),0.5000,963, + Iarg_leaf 1182)))), + Iarg_facet ((2,true),0.5000,1199, + Iarg_facet ((4,true),0.5000,935, + Iarg_facet ((5,true),0.5000,784, + Iarg_facet ((3,true),0.5000,960, + Iarg_leaf 1183))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1469, + Iarg_facet ((3,true),0.5000,1978, + Iarg_facet ((1,true),0.5000,713, + Iarg_leaf 1414))), + Iarg_facet ((5,true),0.6512,891, + Iarg_leaf 1061)), + Iarg_facet ((4,true),0.5000,780, + Iarg_facet ((5,true),0.6525,848, + Iarg_leaf 1113))), + Iarg_facet ((2,true),0.5000,1072, + Iarg_facet ((4,true),0.5000,782, + Iarg_facet ((5,true),0.6436,920, + Iarg_leaf 1154))))), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1267, + Iarg_facet ((2,true),0.5000,788, + Iarg_facet ((4,true),0.6528,877, + Iarg_leaf 1671))), + Iarg_facet ((1,true),0.5000,911, + Iarg_facet ((2,true),0.6377,930, + Iarg_leaf 1497)))), + Iarg_facet ((5,true),0.5000,1756, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1131, + Iarg_facet ((2,true),0.5000,927, + Iarg_facet ((4,true),0.5000,1170, + Iarg_leaf 1472))), + Iarg_facet ((1,true),0.5000,918, + Iarg_facet ((2,true),0.6226,1000, + Iarg_leaf 1592))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1901, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1157, + Iarg_facet ((2,true),0.5000,1673, + Iarg_facet ((4,true),0.6684,841, + Iarg_leaf 1172))), + Iarg_facet ((1,true),0.5000,985, + Iarg_facet ((2,true),0.5000,1104, + Iarg_leaf 1579)))), + Iarg_facet ((5,true),0.5000,735, + Iarg_facet ((3,true),0.5000,949, + Iarg_leaf 1468)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6345,900, + Iarg_leaf 1676), + Iarg_facet ((2,true),0.6649,756, + Iarg_leaf 1254)), + Iarg_facet ((1,true),0.5000,1470, + Iarg_facet ((2,true),0.6484,867, + Iarg_leaf 1250))), + Iarg_facet ((3,true),0.5000,896, + Iarg_leaf 1335)), + Iarg_facet ((5,true),0.5000,772, + Iarg_leaf 1981)), + Iarg_facet ((4,true),0.5000,1202, + Iarg_facet ((5,true),0.5000,889, + Iarg_facet ((3,true),0.5000,971, + Iarg_leaf 1190))))));; + +add_case ("OXLZLEZ 6346351218 1 5", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1928, + Iarg_facet ((5,true),0.5000,1472, + Iarg_facet ((0,false),0.5000,1520, + Iarg_facet ((3,true),0.5000,1183, + Iarg_leaf 1184)))), + Iarg_facet ((4,true),0.6221,921, + Iarg_leaf 1513)), + Iarg_facet ((2,true),0.5000,970, + Iarg_facet ((4,true),0.6288,903, + Iarg_leaf 1516))), + Iarg_facet ((1,true),0.5000,976, + Iarg_facet ((2,true),0.6296,849, + Iarg_leaf 1164))), + Iarg_facet ((5,true),0.5000,1064, + Iarg_facet ((1,true),0.5000,955, + Iarg_facet ((2,true),0.5000,700, + Iarg_leaf 1517)))), + Iarg_facet ((4,true),0.5000,1606, + Iarg_facet ((5,true),0.5000,1065, + Iarg_facet ((1,true),0.5000,978, + Iarg_facet ((4,true),0.6160,858, + Iarg_leaf 1187))))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1550, + Iarg_facet ((5,true),0.5000,1123, + Iarg_facet ((2,true),0.5000,975, + Iarg_facet ((4,true),0.6260,851, + Iarg_leaf 1182)))), + Iarg_facet ((4,true),0.6364,872, + Iarg_leaf 1196))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1577, + Iarg_facet ((4,true),0.5000,1183, + Iarg_facet ((5,false),0.5000,1941, + Iarg_facet ((1,true),0.6174,888, + Iarg_leaf 1527)))), + Iarg_facet ((2,true),0.6658,839, + Iarg_leaf 1330))), + Iarg_facet ((5,true),0.5000,1510, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1788, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6197,936, + Iarg_leaf 1631), + Iarg_facet ((5,true),0.6589,848, + Iarg_facet ((1,true),0.6615,834, + Iarg_leaf 1280)))), + Iarg_facet ((2,true),0.6988,914, + Iarg_leaf 1145)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1436, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1028, + Iarg_facet ((5,true),0.5000,718, + Iarg_facet ((1,true),0.5000,718, + Iarg_leaf 1433))), + Iarg_facet ((4,true),0.5000,830, + Iarg_facet ((5,true),0.6549,840, + Iarg_facet ((1,true),0.6481,841, + Iarg_leaf 1332)))), + Iarg_facet ((2,true),0.5000,964, + Iarg_leaf 1309))), + Iarg_facet ((5,true),0.7780,793, + Iarg_leaf 1233))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1846, + Iarg_facet ((5,true),0.5000,1792, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1301, + Iarg_facet ((4,true),0.5000,951, + Iarg_facet ((5,true),0.5000,769, + Iarg_facet ((2,true),0.5000,708, + Iarg_leaf 1401)))), + Iarg_facet ((2,true),0.5000,988, + Iarg_facet ((4,true),0.5000,729, + Iarg_facet ((5,true),0.6246,991, + Iarg_facet ((1,false),0.5000,899, + Iarg_leaf 1390))))))), + Iarg_facet ((4,true),0.6429,814, + Iarg_leaf 1710))));; + +add_case ("OXLZLEZ 6346351218 3 32", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1914, + Iarg_facet ((4,true),0.5000,1329, + Iarg_facet ((5,true),0.5000,983, + Iarg_facet ((3,true),0.5000,946, + Iarg_facet ((0,true),0.5000,1587, + Iarg_leaf 1664))))), + Iarg_facet ((2,true),0.5000,849, + Iarg_leaf 1915)), + Iarg_facet ((1,true),0.5000,963, + Iarg_leaf 1741)), + Iarg_facet ((5,true),0.5000,822, + Iarg_facet ((1,true),0.5000,893, + Iarg_leaf 1864))), + Iarg_facet ((4,true),0.5000,1443, + Iarg_facet ((5,true),0.5000,897, + Iarg_facet ((1,true),0.5000,885, + Iarg_leaf 1902)))), + Iarg_facet ((2,true),0.5000,1685, + Iarg_facet ((4,true),0.5000,1234, + Iarg_facet ((5,true),0.5000,1076, + Iarg_facet ((2,true),0.5000,881, + Iarg_leaf 1865))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1220, + Iarg_facet ((4,true),0.5000,879, + Iarg_facet ((5,false),0.5000,1742, + Iarg_facet ((1,true),0.5000,745, + Iarg_leaf 1357)))), + Iarg_facet ((2,true),0.6439,928, + Iarg_leaf 1755))), + Iarg_facet ((5,true),0.5000,1875, + Iarg_facet ((1,true),0.5000,1807, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6780,757, + Iarg_leaf 1412), + Iarg_facet ((5,true),0.7579,911, + Iarg_leaf 1631)), + Iarg_facet ((4,false),0.5000,1003, + Iarg_leaf 1169))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1961, + Iarg_facet ((1,true),0.5000,1866, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1027, + Iarg_facet ((5,true),0.6706,741, + Iarg_leaf 1452)), + Iarg_facet ((4,true),0.5000,1195, + Iarg_facet ((5,true),0.7574,920, + Iarg_leaf 1752))))), + Iarg_facet ((5,true),0.5000,1064, + Iarg_facet ((1,true),0.5000,985, + Iarg_facet ((2,false),0.5000,1702, + Iarg_facet ((4,false),0.5000,960, + Iarg_leaf 1288)))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,972, + Iarg_facet ((4,true),0.6085,986, + Iarg_facet ((5,true),0.5000,715, + Iarg_leaf 1666))), + Iarg_facet ((2,true),0.5000,894, + Iarg_facet ((4,true),0.6044,878, + Iarg_facet ((5,true),0.5000,919, + Iarg_leaf 1985)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.7445,859, + Iarg_leaf 1202), + Iarg_facet ((2,true),0.6700,743, + Iarg_leaf 1829))), + Iarg_facet ((5,true),0.5000,1063, + Iarg_leaf 1985)), + Iarg_facet ((4,true),0.5000,1562, + Iarg_facet ((5,true),0.5000,1054, + Iarg_leaf 1914)))));; + +add_case ("OXLZLEZ 6346351218 2 1", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1366, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1449, + Iarg_facet ((1,true),0.5000,1343, + Iarg_facet ((2,true),0.5000,922, + Iarg_leaf 1866))), + Iarg_facet ((5,true),0.6623,815, + Iarg_leaf 1128))), + Iarg_facet ((3,true),0.5975,918, + Iarg_facet ((4,true),0.5000,830, + Iarg_leaf 1956))), + Iarg_facet ((2,true),0.5000,1546, + Iarg_facet ((3,true),0.6226,974, + Iarg_facet ((4,true),0.5000,707, + Iarg_leaf 1940)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1373, + Iarg_facet ((3,true),0.6376,875, + Iarg_facet ((4,true),0.6664,819, + Iarg_leaf 1772))), + Iarg_facet ((2,true),0.6224,893, + Iarg_leaf 1487))), + Iarg_facet ((5,true),0.5000,1971, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1841, + Iarg_facet ((3,true),0.6469,906, + Iarg_facet ((4,false),0.5000,1206, + Iarg_leaf 1423))), + Iarg_facet ((2,true),0.6157,892, + Iarg_leaf 1101)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1729, + Iarg_facet ((1,true),0.5000,1561, + Iarg_facet ((2,true),0.5000,983, + Iarg_leaf 1705))), + Iarg_facet ((5,true),0.6395,871, + Iarg_leaf 1392))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.6592,793, + Iarg_leaf 1835), + Iarg_facet ((3,true),0.6816,773, + Iarg_facet ((4,true),0.6332,887, + Iarg_leaf 1167))), + Iarg_facet ((2,true),0.5000,953, + Iarg_leaf 1067)), + Iarg_facet ((1,true),0.5000,831, + Iarg_leaf 1782)), + Iarg_facet ((5,true),0.5000,1058, + Iarg_facet ((1,true),0.5000,1066, + Iarg_facet ((2,false),0.5000,1455, + Iarg_leaf 1610)))), + Iarg_facet ((4,true),0.5000,1066, + Iarg_facet ((5,true),0.6174,922, + Iarg_leaf 1564)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1078, + Iarg_facet ((3,true),0.6606,801, + Iarg_leaf 1822)), + Iarg_facet ((2,true),0.5000,926, + Iarg_facet ((3,true),0.6801,763, + Iarg_facet ((4,true),0.6785,727, + Iarg_leaf 1292)))), + Iarg_facet ((1,false),0.5000,1914, + Iarg_facet ((2,true),0.7914,1055, + Iarg_leaf 886))), + Iarg_facet ((5,true),0.5000,1050, + Iarg_facet ((1,true),0.5000,1400, + Iarg_leaf 1422))), + Iarg_facet ((4,true),0.5000,1009, + Iarg_facet ((5,true),0.5000,778, + Iarg_leaf 1918))), + Iarg_facet ((3,true),0.5000,1659, + Iarg_facet ((4,true),0.5000,1777, + Iarg_facet ((5,true),0.5000,1133, + Iarg_facet ((1,true),0.5000,1061, + Iarg_leaf 1266)))))));; + +add_case ("OXLZLEZ 6346351218 4 6", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,947, + Iarg_facet ((1,true),0.5000,1575, + Iarg_facet ((2,true),0.5000,1050, + Iarg_facet ((4,true),0.6180,854, + Iarg_leaf 1248)))), + Iarg_facet ((3,true),0.6799,708, + Iarg_leaf 1222)), + Iarg_facet ((5,true),0.5000,736, + Iarg_facet ((3,true),0.7313,795, + Iarg_leaf 1141))), + Iarg_facet ((4,true),0.5000,1331, + Iarg_facet ((5,true),0.5000,877, + Iarg_facet ((3,true),0.7590,899, + Iarg_leaf 1204)))), + Iarg_facet ((2,true),0.5000,1704, + Iarg_facet ((4,true),0.5000,1244, + Iarg_facet ((5,true),0.5000,935, + Iarg_facet ((3,true),0.7776,967, + Iarg_leaf 1146))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1473, + Iarg_facet ((4,true),0.5000,927, + Iarg_facet ((5,false),0.5000,1639, + Iarg_facet ((3,true),0.8174,779, + Iarg_leaf 1013)))), + Iarg_facet ((2,true),0.5000,818, + Iarg_facet ((4,true),0.6684,728, + Iarg_leaf 1324)))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6695,754, + Iarg_leaf 1285), + Iarg_facet ((5,true),0.7068,778, + Iarg_leaf 1508)), + Iarg_facet ((4,false),0.5000,1017, + Iarg_leaf 1176)), + Iarg_facet ((2,true),0.5000,824, + Iarg_leaf 1486)), + Iarg_facet ((1,true),0.5000,983, + Iarg_leaf 1540))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1051, + Iarg_facet ((5,true),0.6603,795, + Iarg_leaf 1290)), + Iarg_facet ((4,true),0.5000,1217, + Iarg_facet ((5,true),0.6559,814, + Iarg_leaf 1615))), + Iarg_facet ((2,true),0.5000,1052, + Iarg_leaf 1153)), + Iarg_facet ((1,true),0.5000,1069, + Iarg_facet ((2,false),0.5000,1010, + Iarg_leaf 1019))), + Iarg_facet ((5,true),0.5000,1407, + Iarg_facet ((1,true),0.5000,1255, + Iarg_facet ((2,false),0.5000,1728, + Iarg_facet ((4,false),0.5000,945, + Iarg_leaf 1175)))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1151, + Iarg_facet ((4,true),0.5000,790, + Iarg_facet ((5,true),0.5000,774, + Iarg_leaf 1698))), + Iarg_facet ((2,true),0.5000,1049, + Iarg_facet ((4,true),0.5000,806, + Iarg_facet ((5,true),0.5000,954, + Iarg_facet ((3,true),0.8025,753, + Iarg_leaf 1154))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.6366,835, + Iarg_leaf 1435), + Iarg_facet ((2,true),0.6446,831, + Iarg_leaf 1717))), + Iarg_facet ((5,true),0.5000,1399, + Iarg_facet ((1,true),0.5000,1584, + Iarg_leaf 1615))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1420, + Iarg_facet ((1,true),0.5000,1207, + Iarg_leaf 1396)), + Iarg_facet ((5,true),0.6444,837, + Iarg_leaf 1092)))));; + +add_case ("OXLZLEZ 6346351218 2 0", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1363, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1455, + Iarg_facet ((1,true),0.5000,1347, + Iarg_facet ((2,true),0.5000,922, + Iarg_leaf 1866))), + Iarg_facet ((5,true),0.8073,1131, + Iarg_leaf 800))), + Iarg_facet ((3,true),0.6201,967, + Iarg_facet ((4,true),0.5000,792, + Iarg_leaf 1865))), + Iarg_facet ((2,true),0.5000,1542, + Iarg_facet ((3,true),0.6224,975, + Iarg_facet ((4,true),0.5000,707, + Iarg_leaf 1942)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1366, + Iarg_facet ((3,true),0.6165,783, + Iarg_facet ((4,true),0.6603,842, + Iarg_leaf 1869))), + Iarg_facet ((2,true),0.6215,887, + Iarg_leaf 1496))), + Iarg_facet ((5,true),0.5000,1976, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1846, + Iarg_facet ((3,true),0.6471,909, + Iarg_facet ((4,false),0.5000,1204, + Iarg_leaf 1433))), + Iarg_facet ((2,true),0.5000,704, + Iarg_leaf 1405)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1726, + Iarg_facet ((1,true),0.5000,1540, + Iarg_facet ((2,true),0.5000,985, + Iarg_leaf 1683))), + Iarg_facet ((5,true),0.6390,867, + Iarg_leaf 1393))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.6592,794, + Iarg_leaf 1834), + Iarg_facet ((3,true),0.6774,756, + Iarg_facet ((4,true),0.6302,895, + Iarg_leaf 1181))), + Iarg_facet ((2,true),0.5000,955, + Iarg_leaf 1067)), + Iarg_facet ((1,true),0.5000,830, + Iarg_leaf 1786)), + Iarg_facet ((5,true),0.5000,1058, + Iarg_facet ((1,true),0.5000,1067, + Iarg_facet ((2,false),0.5000,1462, + Iarg_leaf 1617)))), + Iarg_facet ((4,true),0.5000,1067, + Iarg_facet ((5,true),0.6166,924, + Iarg_leaf 1572)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1079, + Iarg_facet ((3,true),0.6606,808, + Iarg_leaf 1831)), + Iarg_facet ((2,true),0.5000,940, + Iarg_facet ((3,true),0.6789,766, + Iarg_facet ((4,true),0.8364,1213, + Iarg_leaf 880)))), + Iarg_facet ((1,false),0.5000,1928, + Iarg_facet ((2,true),0.6728,749, + Iarg_leaf 1212))), + Iarg_facet ((5,true),0.5000,1057, + Iarg_facet ((1,true),0.5000,1390, + Iarg_leaf 1425))), + Iarg_facet ((4,true),0.5000,1013, + Iarg_facet ((5,true),0.5000,781, + Iarg_leaf 1924))), + Iarg_facet ((3,true),0.5000,1656, + Iarg_facet ((4,true),0.5000,1778, + Iarg_facet ((5,true),0.5000,1135, + Iarg_facet ((1,true),0.5000,1064, + Iarg_leaf 1262)))))));; + +add_case ("OXLZLEZ 6346351218 1 13", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,1677, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1878, + Iarg_facet ((4,true),0.5000,1231, + Iarg_facet ((5,true),0.5000,809, + Iarg_leaf 1526))), + Iarg_facet ((2,true),0.5000,971, + Iarg_leaf 1877))), + Iarg_facet ((3,true),0.5000,788, + Iarg_facet ((1,true),0.5000,968, + Iarg_leaf 1928))), + Iarg_facet ((5,true),0.5000,1192, + Iarg_facet ((3,true),0.5000,808, + Iarg_facet ((1,true),0.5000,932, + Iarg_facet ((2,true),0.5000,704, + Iarg_leaf 1316))))), + Iarg_facet ((4,true),0.5000,1768, + Iarg_facet ((5,true),0.5000,1186, + Iarg_facet ((3,true),0.5000,820, + Iarg_facet ((1,true),0.5000,954, + Iarg_facet ((4,true),0.6163,894, + Iarg_leaf 1065)))))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1707, + Iarg_facet ((5,true),0.5000,1343, + Iarg_facet ((3,true),0.5000,827, + Iarg_facet ((2,true),0.5000,973, + Iarg_facet ((4,true),0.6285,901, + Iarg_leaf 1105))))), + Iarg_facet ((4,true),0.5000,701, + Iarg_leaf 1694))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1551, + Iarg_facet ((4,true),0.5000,990, + Iarg_facet ((5,true),0.5000,1415, + Iarg_leaf 1926))), + Iarg_facet ((2,true),0.5000,769, + Iarg_leaf 1666))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1671, + Iarg_facet ((4,true),0.5000,1851, + Iarg_facet ((5,true),0.6298,854, + Iarg_leaf 1639))), + Iarg_facet ((2,true),0.5000,769, + Iarg_leaf 1554)), + Iarg_facet ((1,true),0.5000,761, + Iarg_leaf 1554))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,988, + Iarg_facet ((5,true),0.6405,895, + Iarg_leaf 1650)), + Iarg_facet ((4,true),0.5000,759, + Iarg_leaf 1983)), + Iarg_facet ((2,true),0.5000,995, + Iarg_leaf 1290)), + Iarg_facet ((1,true),0.5000,845, + Iarg_leaf 1782)), + Iarg_facet ((5,true),0.5000,749, + Iarg_facet ((1,true),0.5000,873, + Iarg_leaf 1834)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1294, + Iarg_facet ((4,true),0.5000,884, + Iarg_facet ((5,true),0.5000,703, + Iarg_facet ((3,true),0.6728,801, + Iarg_leaf 1351)))), + Iarg_facet ((2,true),0.5000,996, + Iarg_facet ((4,true),0.5000,736, + Iarg_facet ((5,true),0.6594,838, + Iarg_leaf 1194)))), + Iarg_facet ((1,true),0.5000,1146, + Iarg_leaf 1535)), + Iarg_facet ((5,true),0.5000,730, + Iarg_facet ((1,true),0.5000,1128, + Iarg_leaf 1553))), + Iarg_facet ((4,true),0.5000,1000, + Iarg_facet ((5,true),0.5000,790, + Iarg_facet ((1,true),0.5000,1029, + Iarg_leaf 1388))))));; + +add_case ("OXLZLEZ 6346351218 2 10", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1675, + Iarg_facet ((0,true),0.5000,835, + Iarg_facet ((3,true),0.5000,1288, + Iarg_facet ((1,true),0.5000,739, + Iarg_leaf 1345)))), + Iarg_facet ((5,true),0.6177,952, + Iarg_leaf 1373)), + Iarg_facet ((4,true),0.5000,1080, + Iarg_facet ((5,true),0.5000,713, + Iarg_leaf 1721))), + Iarg_facet ((2,true),0.5000,1524, + Iarg_facet ((4,true),0.5000,1039, + Iarg_facet ((5,true),0.5000,757, + Iarg_leaf 1725)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1458, + Iarg_facet ((5,true),0.5000,984, + Iarg_facet ((0,true),0.6491,828, + Iarg_leaf 1421))), + Iarg_facet ((4,true),0.5000,788, + Iarg_leaf 1491)), + Iarg_facet ((2,true),0.5000,1202, + Iarg_facet ((4,true),0.5000,779, + Iarg_leaf 1516)))), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1667, + Iarg_facet ((2,true),0.5000,1059, + Iarg_facet ((4,true),0.6198,934, + Iarg_leaf 1550))), + Iarg_facet ((1,true),0.5000,1358, + Iarg_facet ((2,true),0.5000,892, + Iarg_leaf 1753)))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1647, + Iarg_facet ((2,true),0.5000,1150, + Iarg_facet ((4,true),0.5000,1138, + Iarg_leaf 1396))), + Iarg_facet ((1,true),0.5000,1385, + Iarg_facet ((2,true),0.5000,933, + Iarg_leaf 1763))), + Iarg_facet ((3,true),0.5000,1192, + Iarg_leaf 1413))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1621, + Iarg_facet ((2,true),0.5000,1726, + Iarg_facet ((4,true),0.6308,901, + Iarg_leaf 1207))), + Iarg_facet ((1,true),0.5000,1406, + Iarg_facet ((2,true),0.5000,1222, + Iarg_leaf 1517))), + Iarg_facet ((3,true),0.5000,1314, + Iarg_leaf 1625)), + Iarg_facet ((5,true),0.5000,995, + Iarg_facet ((3,true),0.5000,1496, + Iarg_facet ((1,true),0.6283,889, + Iarg_leaf 1157))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,892, + Iarg_facet ((4,true),0.6310,867, + Iarg_leaf 1228)), + Iarg_facet ((2,true),0.6099,864, + Iarg_leaf 1449)), + Iarg_facet ((1,true),0.5000,1794, + Iarg_facet ((2,true),0.5000,792, + Iarg_leaf 1520))), + Iarg_facet ((3,true),0.5000,1408, + Iarg_leaf 1869)), + Iarg_facet ((5,true),0.5000,1041, + Iarg_facet ((3,true),0.5000,1352, + Iarg_leaf 1696))), + Iarg_facet ((4,true),0.5000,1496, + Iarg_facet ((5,true),0.5000,1158, + Iarg_facet ((3,true),0.5000,1437, + Iarg_leaf 1706))))));; + +add_case ("7550003505 3 4 4", + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1495, + Iarg_bisect (5, + Iarg_facet ((4,true),0.7183,1072, + Iarg_leaf 1679), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1898, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,907, + Iarg_facet ((1,true),0.8163,1045, + Iarg_leaf 1876)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1561, + Iarg_facet ((2,true),0.5000,1931, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,700, + Iarg_facet ((3,false),0.5000,1453, + Iarg_leaf 1472)), + Iarg_facet ((5,true),0.5000,1392, + Iarg_leaf 1781)))), + Iarg_facet ((1,true),0.8991,1271, + Iarg_leaf 878)))), + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,898, + Iarg_bisect (0, + Iarg_facet ((1,true),0.7508,891, + Iarg_leaf 1659), + Iarg_facet ((1,true),0.8059,797, + Iarg_leaf 1633))), + Iarg_facet ((3,false),0.5812,996, + Iarg_facet ((0,false),0.5972,1287, + Iarg_facet ((1,true),0.6390,917, + Iarg_leaf 1396))))))), + Iarg_facet ((4,false),0.5595,1088, + Iarg_bisect (5, + Iarg_facet ((3,true),0.6984,899, + Iarg_leaf 1037), + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1332, + Iarg_facet ((5,true),0.5000,819, + Iarg_leaf 1752)), + Iarg_facet ((3,false),0.5000,1949, + Iarg_facet ((5,true),0.5000,885, + Iarg_leaf 1507))), + Iarg_facet ((2,true),0.5000,1215, + Iarg_leaf 1879)), + Iarg_facet ((1,true),0.7922,987, + Iarg_leaf 1152)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1032, + Iarg_facet ((2,false),0.6231,716, + Iarg_facet ((3,false),0.5000,968, + Iarg_leaf 1229))), + Iarg_facet ((1,true),0.7546,1166, + Iarg_facet ((2,false),0.5000,754, + Iarg_leaf 1519)))), + Iarg_bisect (4, + Iarg_facet ((0,false),0.5000,1123, + Iarg_leaf 1313), + Iarg_facet ((0,false),0.5000,1471, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1564, + Iarg_leaf 1913), + Iarg_facet ((2,true),0.5000,1191, + Iarg_leaf 1467))))), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_facet ((0,true),0.6841,932, + Iarg_facet ((1,false),0.5000,1484, + Iarg_leaf 1648)), + Iarg_facet ((0,true),0.5000,1283, + Iarg_facet ((1,true),0.5000,1072, + Iarg_leaf 1157))), + Iarg_facet ((4,false),0.5000,1202, + Iarg_facet ((0,false),0.5000,1417, + Iarg_facet ((1,false),0.5000,1259, + Iarg_facet ((2,false),0.5000,810, + Iarg_leaf 1683))))))))));; + +add_case ("4491491732", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1934, + Iarg_facet ((4,true),0.5000,1303, + Iarg_facet ((5,true),0.5000,882, + Iarg_leaf 1795))), + Iarg_facet ((3,true),0.5000,1153, + Iarg_leaf 1437)), + Iarg_facet ((2,true),0.5000,1327, + Iarg_facet ((3,true),0.5000,1154, + Iarg_leaf 1442))), + Iarg_facet ((1,true),0.5000,1927, + Iarg_facet ((2,true),0.5000,1332, + Iarg_facet ((3,true),0.5000,791, + Iarg_leaf 1817)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,939, + Iarg_facet ((3,true),0.5000,729, + Iarg_facet ((4,true),0.6603,827, + Iarg_leaf 1591))), + Iarg_facet ((2,true),0.5000,760, + Iarg_facet ((3,true),0.5000,852, + Iarg_facet ((4,true),0.6883,784, + Iarg_leaf 1623)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,759, + Iarg_facet ((3,true),0.6481,964, + Iarg_facet ((4,true),0.6387,876, + Iarg_leaf 1544))), + Iarg_facet ((2,true),0.6411,1037, + Iarg_facet ((3,true),0.6599,879, + Iarg_leaf 1843))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1781, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,746, + Iarg_facet ((4,false),0.5000,1022, + Iarg_leaf 1383)), + Iarg_facet ((3,true),0.5000,870, + Iarg_facet ((4,false),0.5000,810, + Iarg_leaf 1575)))), + Iarg_facet ((1,true),0.5000,1406, + Iarg_bisect (2, + Iarg_facet ((3,true),0.6444,949, + Iarg_facet ((4,false),0.5000,782, + Iarg_leaf 1500)), + Iarg_facet ((3,true),0.5000,717, + Iarg_facet ((4,false),0.6180,947, + Iarg_leaf 1547))))), + Iarg_facet ((0,false),0.5000,1915, + Iarg_facet ((1,true),0.5000,884, + Iarg_leaf 1563)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1453, + Iarg_leaf 1778), + Iarg_facet ((3,false),0.5000,1225, + Iarg_facet ((4,true),0.6772,749, + Iarg_leaf 1300))), + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1216, + Iarg_facet ((4,true),0.7994,862, + Iarg_leaf 1141)), + Iarg_facet ((3,false),0.5000,984, + Iarg_facet ((4,true),0.7511,883, + Iarg_leaf 1353)))), + Iarg_facet ((1,true),0.5000,1411, + Iarg_leaf 1766)), + Iarg_facet ((0,true),0.5000,1686, + Iarg_facet ((1,false),0.5000,1177, + Iarg_leaf 1588))), + Iarg_facet ((5,true),0.5000,1421, + Iarg_facet ((0,true),0.5000,1815, + Iarg_facet ((1,true),0.5000,1160, + Iarg_leaf 1743))))));; + +add_case ("OXLZLEZ 6346351218 1 2", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,1368, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1872, + Iarg_facet ((4,true),0.5000,1289, + Iarg_facet ((5,true),0.5000,894, + Iarg_leaf 1793))), + Iarg_facet ((2,true),0.5000,886, + Iarg_leaf 1870))), + Iarg_facet ((3,true),0.6302,1022, + Iarg_facet ((1,true),0.5000,890, + Iarg_leaf 1779))), + Iarg_facet ((5,true),0.5000,1153, + Iarg_facet ((3,true),0.6283,1028, + Iarg_facet ((1,true),0.5000,879, + Iarg_leaf 1840)))), + Iarg_facet ((4,true),0.5000,1749, + Iarg_facet ((5,true),0.5000,1164, + Iarg_facet ((3,true),0.6198,1023, + Iarg_facet ((1,true),0.5000,924, + Iarg_leaf 1871))))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1704, + Iarg_facet ((5,true),0.5000,1229, + Iarg_facet ((3,true),0.6192,1013, + Iarg_facet ((2,true),0.5000,919, + Iarg_leaf 1866)))), + Iarg_facet ((4,true),0.5000,771, + Iarg_leaf 1746))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1924, + Iarg_facet ((4,true),0.5000,1278, + Iarg_facet ((5,true),0.5000,1802, + Iarg_leaf 1924))), + Iarg_facet ((2,true),0.5000,786, + Iarg_leaf 1937))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1938, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6183,1003, + Iarg_leaf 1635), + Iarg_facet ((5,true),0.6443,849, + Iarg_leaf 1541))), + Iarg_facet ((2,true),0.5000,796, + Iarg_leaf 1976)), + Iarg_facet ((1,true),0.6266,926, + Iarg_leaf 1382))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1087, + Iarg_facet ((5,true),0.5000,781, + Iarg_facet ((3,true),0.6767,785, + Iarg_leaf 1421))), + Iarg_facet ((4,true),0.5000,900, + Iarg_facet ((5,true),0.6198,923, + Iarg_leaf 1645))), + Iarg_facet ((2,true),0.5000,1166, + Iarg_leaf 1513)), + Iarg_facet ((1,true),0.5000,704, + Iarg_leaf 1675)), + Iarg_facet ((5,true),0.6441,871, + Iarg_facet ((1,true),0.6435,909, + Iarg_leaf 1298)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1508, + Iarg_facet ((4,true),0.5000,1112, + Iarg_facet ((5,true),0.5000,769, + Iarg_facet ((3,true),0.8694,1270, + Iarg_leaf 786)))), + Iarg_facet ((2,true),0.5000,1186, + Iarg_facet ((4,true),0.5000,912, + Iarg_facet ((5,true),0.6229,943, + Iarg_leaf 1660)))), + Iarg_facet ((1,true),0.5000,992, + Iarg_leaf 1504)), + Iarg_facet ((5,true),0.6436,933, + Iarg_facet ((1,true),0.5000,780, + Iarg_leaf 1332))), + Iarg_facet ((4,true),0.5000,854, + Iarg_facet ((5,true),0.6260,941, + Iarg_facet ((1,true),0.5000,832, + Iarg_leaf 1274))))));; + +add_case ("OXLZLEZ 6346351218 1 1", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,1375, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1873, + Iarg_facet ((4,true),0.5000,1289, + Iarg_facet ((5,true),0.5000,896, + Iarg_leaf 1788))), + Iarg_facet ((2,true),0.5000,886, + Iarg_leaf 1868))), + Iarg_facet ((3,true),0.6296,1019, + Iarg_facet ((1,true),0.5000,890, + Iarg_leaf 1787))), + Iarg_facet ((5,true),0.5000,1159, + Iarg_facet ((3,true),0.6274,1028, + Iarg_facet ((1,true),0.5000,882, + Iarg_leaf 1836)))), + Iarg_facet ((4,true),0.5000,1749, + Iarg_facet ((5,true),0.5000,1167, + Iarg_facet ((3,true),0.6201,1023, + Iarg_facet ((1,true),0.5000,926, + Iarg_leaf 1876))))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1703, + Iarg_facet ((5,true),0.5000,1230, + Iarg_facet ((3,true),0.5827,889, + Iarg_facet ((2,true),0.5000,816, + Iarg_leaf 1698)))), + Iarg_facet ((4,true),0.5000,772, + Iarg_leaf 1747))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1924, + Iarg_facet ((4,true),0.5000,1278, + Iarg_facet ((5,true),0.5000,1809, + Iarg_leaf 1929))), + Iarg_facet ((2,true),0.5000,786, + Iarg_leaf 1943))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1936, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6100,967, + Iarg_leaf 1662), + Iarg_facet ((5,true),0.6474,862, + Iarg_leaf 1537))), + Iarg_facet ((2,true),0.5000,797, + Iarg_leaf 1977)), + Iarg_facet ((1,true),0.6154,884, + Iarg_leaf 1408))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1083, + Iarg_facet ((5,true),0.5000,783, + Iarg_facet ((3,true),0.6947,814, + Iarg_leaf 1350))), + Iarg_facet ((4,true),0.5000,898, + Iarg_facet ((5,true),0.6206,920, + Iarg_leaf 1634))), + Iarg_facet ((2,true),0.5000,1173, + Iarg_leaf 1511)), + Iarg_facet ((1,true),0.5000,705, + Iarg_leaf 1680)), + Iarg_facet ((5,true),0.6439,874, + Iarg_facet ((1,true),0.6358,898, + Iarg_leaf 1325)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1516, + Iarg_facet ((4,true),0.5000,1108, + Iarg_facet ((5,true),0.5000,771, + Iarg_facet ((3,true),0.6921,827, + Iarg_leaf 1396)))), + Iarg_facet ((2,true),0.5000,1194, + Iarg_facet ((4,true),0.5000,915, + Iarg_facet ((5,true),0.6224,945, + Iarg_leaf 1666)))), + Iarg_facet ((1,true),0.5000,992, + Iarg_leaf 1504)), + Iarg_facet ((5,true),0.6159,873, + Iarg_facet ((1,true),0.5000,796, + Iarg_leaf 1354))), + Iarg_facet ((4,true),0.5000,856, + Iarg_facet ((5,true),0.6252,940, + Iarg_facet ((1,true),0.5000,844, + Iarg_leaf 1286))))));; + +add_case ("OXLZLEZ 6346351218 1 0", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,1373, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1869, + Iarg_facet ((4,true),0.5000,1289, + Iarg_facet ((5,true),0.5000,898, + Iarg_leaf 1791))), + Iarg_facet ((2,true),0.5000,888, + Iarg_leaf 1871))), + Iarg_facet ((3,true),0.6307,1020, + Iarg_facet ((1,true),0.5000,892, + Iarg_leaf 1777))), + Iarg_facet ((5,true),0.5000,1156, + Iarg_facet ((3,true),0.6040,933, + Iarg_facet ((1,true),0.5000,791, + Iarg_leaf 1756)))), + Iarg_facet ((4,true),0.5000,1749, + Iarg_facet ((5,true),0.5000,1169, + Iarg_facet ((3,true),0.6124,987, + Iarg_facet ((1,true),0.5000,806, + Iarg_leaf 1747))))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1702, + Iarg_facet ((5,true),0.5000,1231, + Iarg_facet ((3,true),0.6192,1014, + Iarg_facet ((2,true),0.5000,919, + Iarg_leaf 1868)))), + Iarg_facet ((4,true),0.5000,775, + Iarg_leaf 1769))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1926, + Iarg_facet ((4,true),0.5000,1280, + Iarg_facet ((5,true),0.5000,1805, + Iarg_leaf 1927))), + Iarg_facet ((2,true),0.5000,785, + Iarg_leaf 1938))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1934, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6183,1004, + Iarg_leaf 1638), + Iarg_facet ((5,true),0.6479,861, + Iarg_leaf 1536))), + Iarg_facet ((2,true),0.5000,793, + Iarg_leaf 1972)), + Iarg_facet ((1,true),0.6263,927, + Iarg_leaf 1380))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1084, + Iarg_facet ((5,true),0.5000,781, + Iarg_facet ((3,true),0.6815,791, + Iarg_leaf 1400))), + Iarg_facet ((4,true),0.5000,898, + Iarg_facet ((5,true),0.6221,921, + Iarg_leaf 1622))), + Iarg_facet ((2,true),0.5000,1167, + Iarg_leaf 1512)), + Iarg_facet ((1,true),0.5000,705, + Iarg_leaf 1680)), + Iarg_facet ((5,true),0.6441,872, + Iarg_facet ((1,true),0.6364,901, + Iarg_leaf 1319)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1508, + Iarg_facet ((4,true),0.5000,1108, + Iarg_facet ((5,true),0.5000,772, + Iarg_facet ((3,true),0.6776,792, + Iarg_leaf 1450)))), + Iarg_facet ((2,true),0.5000,1194, + Iarg_facet ((4,true),0.5000,913, + Iarg_facet ((5,true),0.6224,946, + Iarg_leaf 1659)))), + Iarg_facet ((1,true),0.5000,991, + Iarg_leaf 1502)), + Iarg_facet ((5,true),0.6441,941, + Iarg_facet ((1,true),0.5000,781, + Iarg_leaf 1332))), + Iarg_facet ((4,true),0.5000,854, + Iarg_facet ((5,true),0.6263,943, + Iarg_facet ((1,true),0.5000,834, + Iarg_leaf 1278))))));; + +add_case ("OXLZLEZ 6346351218 2 32", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1916, + Iarg_facet ((4,true),0.5000,1328, + Iarg_facet ((5,true),0.5000,983, + Iarg_facet ((3,true),0.5000,946, + Iarg_facet ((0,true),0.5000,1588, + Iarg_leaf 1660))))), + Iarg_facet ((2,true),0.5000,850, + Iarg_leaf 1907)), + Iarg_facet ((1,true),0.5000,959, + Iarg_leaf 1734)), + Iarg_facet ((5,true),0.5000,821, + Iarg_facet ((1,true),0.5000,893, + Iarg_leaf 1865))), + Iarg_facet ((4,true),0.5000,1447, + Iarg_facet ((5,true),0.5000,886, + Iarg_facet ((1,true),0.5000,888, + Iarg_leaf 1878)))), + Iarg_facet ((2,true),0.5000,1685, + Iarg_facet ((4,true),0.5000,1231, + Iarg_facet ((5,true),0.5000,1075, + Iarg_facet ((2,true),0.5000,877, + Iarg_leaf 1861))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1216, + Iarg_facet ((4,true),0.5000,881, + Iarg_facet ((5,false),0.5000,1744, + Iarg_facet ((1,true),0.5000,745, + Iarg_leaf 1354)))), + Iarg_facet ((2,true),0.6537,881, + Iarg_leaf 1721))), + Iarg_facet ((5,true),0.5000,1878, + Iarg_facet ((1,true),0.5000,1818, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6785,757, + Iarg_leaf 1404), + Iarg_facet ((5,true),0.7114,772, + Iarg_leaf 1627)), + Iarg_facet ((4,false),0.5000,993, + Iarg_leaf 1171))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1958, + Iarg_facet ((1,true),0.5000,1866, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1023, + Iarg_facet ((5,true),0.6717,747, + Iarg_leaf 1453)), + Iarg_facet ((4,true),0.5000,1200, + Iarg_facet ((5,true),0.7572,923, + Iarg_leaf 1699))))), + Iarg_facet ((5,true),0.5000,1067, + Iarg_facet ((1,true),0.5000,985, + Iarg_facet ((2,false),0.5000,1703, + Iarg_facet ((4,false),0.5000,960, + Iarg_leaf 1290)))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,978, + Iarg_facet ((4,true),0.6163,1018, + Iarg_facet ((5,true),0.5000,703, + Iarg_leaf 1654))), + Iarg_facet ((2,true),0.5000,902, + Iarg_facet ((4,true),0.5998,860, + Iarg_facet ((5,true),0.5000,941, + Iarg_facet ((1,false),0.5000,844, + Iarg_leaf 1159))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.7191,810, + Iarg_leaf 1281), + Iarg_facet ((2,true),0.6700,741, + Iarg_leaf 1831))), + Iarg_facet ((5,true),0.5000,1059, + Iarg_leaf 1977)), + Iarg_facet ((4,true),0.5000,1562, + Iarg_facet ((5,true),0.5000,1061, + Iarg_leaf 1930)))));; + +add_case ("OXLZLEZ 6346351218 1 39", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1918, + Iarg_facet ((2,true),0.5000,1390, + Iarg_facet ((4,true),0.5000,1024, + Iarg_facet ((5,true),0.5000,788, + Iarg_facet ((0,false),0.5000,1429, + Iarg_leaf 1663))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1686, + Iarg_facet ((4,true),0.5000,1259, + Iarg_facet ((5,true),0.5000,976, + Iarg_facet ((0,false),0.5000,1706, + Iarg_leaf 1950)))), + Iarg_facet ((2,true),0.6620,950, + Iarg_leaf 1138))), + Iarg_facet ((3,false),0.5000,1533, + Iarg_leaf 1681)), + Iarg_facet ((5,true),0.5000,946, + Iarg_facet ((3,false),0.5000,1514, + Iarg_leaf 1653))), + Iarg_facet ((4,true),0.5000,1273, + Iarg_facet ((5,true),0.5000,882, + Iarg_facet ((3,false),0.5000,1538, + Iarg_leaf 1718)))), + Iarg_facet ((2,true),0.5000,1573, + Iarg_facet ((4,true),0.5000,1146, + Iarg_facet ((5,true),0.5000,1014, + Iarg_facet ((3,false),0.5000,1523, + Iarg_leaf 1676))))), + Iarg_facet ((1,true),0.5000,985, + Iarg_facet ((2,true),0.6422,972, + Iarg_leaf 1834))), + Iarg_facet ((5,true),0.5000,702, + Iarg_facet ((1,true),0.5000,861, + Iarg_facet ((2,true),0.5000,739, + Iarg_facet ((5,true),0.6957,849, + Iarg_leaf 1447))))), + Iarg_facet ((4,true),0.5000,1042, + Iarg_facet ((5,true),0.5821,879, + Iarg_facet ((1,true),0.5000,839, + Iarg_facet ((4,true),0.6299,974, + Iarg_leaf 1766))))), + Iarg_facet ((2,true),0.5000,1249, + Iarg_facet ((4,true),0.5000,897, + Iarg_facet ((5,true),0.5000,815, + Iarg_facet ((2,true),0.5000,902, + Iarg_facet ((4,true),0.6382,976, + Iarg_leaf 1986)))))), + Iarg_facet ((1,true),0.5000,1232, + Iarg_facet ((2,true),0.5000,776, + Iarg_facet ((4,true),0.6568,879, + Iarg_facet ((5,true),0.5000,972, + Iarg_leaf 1262))))), + Iarg_facet ((5,true),0.5000,884, + Iarg_facet ((1,true),0.5000,1105, + Iarg_facet ((2,true),0.5000,943, + Iarg_facet ((4,true),0.5000,1377, + Iarg_leaf 1799))))), + Iarg_facet ((4,true),0.5000,1406, + Iarg_facet ((5,true),0.5000,933, + Iarg_facet ((1,true),0.5000,1128, + Iarg_facet ((2,true),0.5000,1888, + Iarg_facet ((4,true),0.6540,818, + Iarg_leaf 1512)))))), + Iarg_facet ((2,true),0.5000,1606, + Iarg_facet ((4,true),0.5000,1217, + Iarg_facet ((5,true),0.5000,1153, + Iarg_bisect (1, + Iarg_facet ((2,true),0.6285,937, + Iarg_facet ((4,true),0.7771,834, + Iarg_leaf 1132)), + Iarg_facet ((2,true),0.6399,726, + Iarg_leaf 1571)))))));; + +add_case ("OXLZLEZ 6346351218 3 34", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,1812, + Iarg_facet ((1,true),0.5000,744, + Iarg_facet ((2,true),0.6583,802, + Iarg_leaf 1467))), + Iarg_facet ((3,true),0.5000,1939, + Iarg_facet ((1,true),0.5000,854, + Iarg_facet ((2,true),0.6524,912, + Iarg_leaf 1667)))), + Iarg_facet ((0,false),0.5000,1041, + Iarg_leaf 1156)), + Iarg_facet ((5,true),0.6269,1005, + Iarg_leaf 1849)), + Iarg_facet ((4,true),0.5000,1017, + Iarg_facet ((5,true),0.6291,1013, + Iarg_leaf 1911))), + Iarg_facet ((2,true),0.5000,1311, + Iarg_facet ((4,true),0.5000,906, + Iarg_facet ((5,true),0.5000,766, + Iarg_facet ((0,false),0.5000,1100, + Iarg_leaf 1200))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1745, + Iarg_bisect (0, + Iarg_facet ((3,false),0.5000,1533, + Iarg_leaf 1560), + Iarg_facet ((3,false),0.5000,1663, + Iarg_leaf 1759))), + Iarg_facet ((5,true),0.6405,904, + Iarg_leaf 1364)), + Iarg_facet ((4,true),0.5000,885, + Iarg_facet ((5,true),0.6479,917, + Iarg_leaf 1341))), + Iarg_facet ((2,true),0.5000,1255, + Iarg_facet ((4,true),0.5000,831, + Iarg_facet ((5,true),0.6372,943, + Iarg_leaf 1402))))), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1228, + Iarg_facet ((2,true),0.5000,789, + Iarg_facet ((4,true),0.6622,833, + Iarg_leaf 1304))), + Iarg_facet ((1,true),0.5000,1227, + Iarg_facet ((2,true),0.5000,828, + Iarg_leaf 1957)))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1232, + Iarg_facet ((2,true),0.5000,869, + Iarg_facet ((4,true),0.5000,851, + Iarg_leaf 1350))), + Iarg_facet ((1,true),0.5000,1255, + Iarg_facet ((2,true),0.5000,862, + Iarg_leaf 1953))), + Iarg_facet ((3,true),0.5000,1002, + Iarg_leaf 1011))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1256, + Iarg_facet ((2,true),0.5000,1255, + Iarg_leaf 1918)), + Iarg_facet ((1,true),0.5000,1282, + Iarg_facet ((2,true),0.5000,1211, + Iarg_leaf 1702))), + Iarg_facet ((3,true),0.5000,1067, + Iarg_leaf 1131)), + Iarg_facet ((5,true),0.5000,731, + Iarg_facet ((3,true),0.5000,1218, + Iarg_leaf 1383)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1740, + Iarg_facet ((2,true),0.5000,723, + Iarg_leaf 1930)), + Iarg_facet ((1,true),0.5000,1676, + Iarg_facet ((2,true),0.5000,756, + Iarg_leaf 1712))), + Iarg_facet ((3,true),0.5000,1170, + Iarg_leaf 1292)), + Iarg_facet ((5,true),0.5000,738, + Iarg_facet ((3,true),0.5000,1087, + Iarg_leaf 1168))), + Iarg_facet ((4,true),0.5000,1033, + Iarg_facet ((5,true),0.5000,802, + Iarg_facet ((3,true),0.5000,1224, + Iarg_leaf 1257))))));; + +add_case ("OXLZLEZ 6346351218 4 33", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,1818, + Iarg_facet ((1,true),0.5000,744, + Iarg_facet ((2,true),0.7810,1154, + Iarg_leaf 1163))), + Iarg_facet ((3,true),0.5000,1950, + Iarg_facet ((1,true),0.5000,854, + Iarg_facet ((2,true),0.6222,831, + Iarg_leaf 1750)))), + Iarg_facet ((0,false),0.5000,1048, + Iarg_leaf 1159)), + Iarg_facet ((5,true),0.6269,1017, + Iarg_leaf 1870)), + Iarg_facet ((4,true),0.5000,1019, + Iarg_facet ((5,true),0.6291,1012, + Iarg_leaf 1910))), + Iarg_facet ((2,true),0.5000,1315, + Iarg_facet ((4,true),0.5000,908, + Iarg_facet ((5,true),0.5000,766, + Iarg_facet ((0,false),0.5000,1104, + Iarg_leaf 1198))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1751, + Iarg_bisect (0, + Iarg_facet ((3,false),0.5000,1535, + Iarg_leaf 1568), + Iarg_facet ((3,false),0.5000,1673, + Iarg_leaf 1769))), + Iarg_facet ((5,true),0.6400,906, + Iarg_leaf 1377)), + Iarg_facet ((4,true),0.5000,884, + Iarg_facet ((5,true),0.6479,917, + Iarg_leaf 1341))), + Iarg_facet ((2,true),0.5000,1257, + Iarg_facet ((4,true),0.5000,834, + Iarg_facet ((5,true),0.6342,934, + Iarg_leaf 1417))))), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1227, + Iarg_facet ((2,true),0.5000,790, + Iarg_facet ((4,true),0.6622,834, + Iarg_leaf 1304))), + Iarg_facet ((1,true),0.5000,1207, + Iarg_facet ((2,true),0.5000,826, + Iarg_leaf 1948)))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1234, + Iarg_facet ((2,true),0.5000,866, + Iarg_facet ((4,true),0.5000,852, + Iarg_leaf 1349))), + Iarg_facet ((1,true),0.5000,1254, + Iarg_facet ((2,true),0.5000,864, + Iarg_leaf 1951))), + Iarg_facet ((3,true),0.5000,1003, + Iarg_leaf 1010))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1266, + Iarg_facet ((2,true),0.5000,1257, + Iarg_leaf 1911)), + Iarg_facet ((1,true),0.5000,1291, + Iarg_facet ((2,true),0.5000,1194, + Iarg_leaf 1702))), + Iarg_facet ((3,true),0.5000,1063, + Iarg_leaf 1127)), + Iarg_facet ((5,true),0.5000,735, + Iarg_facet ((3,true),0.5000,1216, + Iarg_leaf 1389)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1733, + Iarg_facet ((2,true),0.5000,723, + Iarg_leaf 1929)), + Iarg_facet ((1,true),0.5000,1676, + Iarg_facet ((2,true),0.5000,757, + Iarg_leaf 1704))), + Iarg_facet ((3,true),0.5000,1168, + Iarg_leaf 1292)), + Iarg_facet ((5,true),0.5000,741, + Iarg_facet ((3,true),0.5000,1091, + Iarg_leaf 1173))), + Iarg_facet ((4,true),0.5000,1042, + Iarg_facet ((5,true),0.5000,798, + Iarg_facet ((3,true),0.5000,1229, + Iarg_leaf 1264))))));; + +add_case ("GLFVCVK4 2477216213 split(0/64)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1650, + Iarg_facet ((5,true),0.5000,1288, + Iarg_facet ((1,true),0.5000,1851, + Iarg_facet ((2,true),0.5000,1365, + Iarg_facet ((3,true),0.5000,1001, + Iarg_facet ((4,true),0.5000,781, + Iarg_facet ((5,true),0.6361,1026, + Iarg_facet ((1,true),0.5000,903, + Iarg_facet ((2,true),0.6235,934, + Iarg_leaf 1494))))))))), + Iarg_facet ((4,true),0.5000,801, + Iarg_facet ((5,true),0.6426,900, + Iarg_leaf 1503))), + Iarg_facet ((3,true),0.5000,1159, + Iarg_facet ((4,true),0.6361,904, + Iarg_leaf 1422))), + Iarg_facet ((2,true),0.5000,1218, + Iarg_facet ((3,true),0.5000,1171, + Iarg_facet ((4,true),0.6525,845, + Iarg_leaf 1463)))), + Iarg_facet ((1,true),0.5000,1642, + Iarg_facet ((2,true),0.5000,842, + Iarg_facet ((3,true),0.6235,881, + Iarg_leaf 1285)))), + Iarg_facet ((5,true),0.5000,1744, + Iarg_facet ((1,true),0.5000,1342, + Iarg_facet ((2,true),0.5000,1104, + Iarg_facet ((3,true),0.6263,886, + Iarg_leaf 1369))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,842, + Iarg_facet ((5,true),0.6337,923, + Iarg_leaf 1394)), + Iarg_facet ((4,true),0.5000,1039, + Iarg_facet ((5,true),0.5000,733, + Iarg_facet ((1,true),0.5000,751, + Iarg_leaf 1871)))), + Iarg_facet ((3,false),0.5000,1187, + Iarg_leaf 1530)), + Iarg_facet ((2,true),0.5000,1035, + Iarg_facet ((3,false),0.5000,1185, + Iarg_leaf 1541))), + Iarg_facet ((1,true),0.5000,883, + Iarg_facet ((2,true),0.6469,827, + Iarg_leaf 1160))), + Iarg_facet ((5,true),0.5000,813, + Iarg_facet ((1,true),0.5000,828, + Iarg_facet ((2,true),0.6324,845, + Iarg_leaf 1160))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1861, + Iarg_facet ((1,true),0.5000,1359, + Iarg_facet ((2,true),0.5000,1661, + Iarg_leaf 1995))), + Iarg_facet ((5,true),0.5000,828, + Iarg_facet ((1,true),0.5000,818, + Iarg_leaf 1628))), + Iarg_facet ((4,true),0.5000,1311, + Iarg_facet ((5,true),0.5000,796, + Iarg_facet ((1,true),0.5000,957, + Iarg_facet ((2,true),0.5000,863, + Iarg_leaf 1396)))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,750, + Iarg_leaf 1989), + Iarg_facet ((2,true),0.6390,820, + Iarg_leaf 1348)), + Iarg_facet ((1,true),0.5000,1224, + Iarg_leaf 1271)), + Iarg_facet ((5,true),0.5000,791, + Iarg_leaf 1901)), + Iarg_facet ((4,true),0.5000,1122, + Iarg_facet ((5,true),0.5000,928, + Iarg_facet ((1,true),0.5000,1248, + Iarg_leaf 1931)))), + Iarg_facet ((3,true),0.5000,1852, + Iarg_facet ((4,true),0.5000,1336, + Iarg_facet ((5,true),0.5000,881, + Iarg_leaf 1767))))));; + +add_case ("7796879304", + Iarg_bisect (3, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.7383,1274, + Iarg_facet ((2,true),0.7082,871, + Iarg_facet ((3,false),0.5000,1718, + Iarg_bisect (0, + Iarg_facet ((3,false),0.5000,1080, + Iarg_leaf 1927), + Iarg_facet ((3,true),0.5000,1599, + Iarg_facet ((2,true),0.5000,826, + Iarg_leaf 1386)))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1912, + Iarg_bisect (0, + Iarg_facet ((3,false),0.5000,1573, + Iarg_leaf 1593), + Iarg_facet ((3,true),0.5000,842, + Iarg_leaf 1563))), + Iarg_facet ((2,true),0.8532,1099, + Iarg_leaf 980)), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((0,true),0.5000,701, + Iarg_leaf 1354), + Iarg_facet ((0,true),0.5000,902, + Iarg_leaf 1676)), + Iarg_facet ((2,true),0.5000,1289, + Iarg_facet ((0,true),0.5000,864, + Iarg_leaf 1623)))), + Iarg_facet ((3,false),0.7874,948, + Iarg_leaf 1038)), + Iarg_facet ((2,true),0.8632,728, + Iarg_leaf 1358))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1861, + Iarg_facet ((2,true),0.5000,1620, + Iarg_leaf 1748)), + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,828, + Iarg_leaf 1263), + Iarg_facet ((2,true),0.5000,820, + Iarg_leaf 1264))), + Iarg_facet ((0,true),0.5000,1813, + Iarg_facet ((1,false),0.5000,1477, + Iarg_leaf 1999))), + Iarg_facet ((3,false),0.5000,1501, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6466,852, + Iarg_leaf 1421), + Iarg_facet ((1,true),0.5000,866, + Iarg_leaf 1291)))), + Iarg_facet ((2,true),0.6359,869, + Iarg_facet ((3,false),0.5000,1620, + Iarg_facet ((0,true),0.5000,1692, + Iarg_facet ((1,true),0.6277,965, + Iarg_leaf 1214))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1310, + Iarg_facet ((1,false),0.5000,1623, + Iarg_facet ((2,false),0.5000,942, + Iarg_leaf 1066))), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1092, + Iarg_leaf 1974), + Iarg_facet ((1,true),0.5000,1013, + Iarg_leaf 1024))), + Iarg_facet ((2,true),0.5000,1474, + Iarg_bisect (3, + Iarg_facet ((2,true),0.5000,1085, + Iarg_leaf 1972), + Iarg_facet ((2,true),0.5000,1019, + Iarg_leaf 1027)))))), + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.6751,1049, + Iarg_leaf 1635), + Iarg_facet ((3,true),0.5000,1551, + Iarg_facet ((0,true),0.5000,1097, + Iarg_facet ((1,false),0.5000,1223, + Iarg_leaf 1377)))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1559, + Iarg_facet ((0,true),0.5000,1090, + Iarg_facet ((2,false),0.5000,1221, + Iarg_leaf 1398))), + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,883, + Iarg_leaf 1052), + Iarg_facet ((0,true),0.5000,715, + Iarg_leaf 1816)))), + Iarg_facet ((1,false),0.5000,1539, + Iarg_facet ((2,false),0.5000,1339, + Iarg_leaf 1918))), + Iarg_facet ((0,true),0.7405,844, + Iarg_leaf 1799))));; + +add_case ("7550003505 1 4 4", + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1556, + Iarg_bisect (5, + Iarg_facet ((4,true),0.5968,865, + Iarg_facet ((3,true),0.5000,1079, + Iarg_leaf 1236)), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1457, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.7469,708, + Iarg_leaf 883), + Iarg_facet ((5,true),0.5000,1015, + Iarg_leaf 1116)), + Iarg_facet ((4,false),0.7716,1271, + Iarg_leaf 1130)), + Iarg_facet ((2,true),0.5000,1281, + Iarg_leaf 1343))), + Iarg_facet ((0,true),0.5000,1988, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.8445,1231, + Iarg_leaf 552), + Iarg_facet ((5,true),0.5000,955, + Iarg_leaf 1234)), + Iarg_facet ((4,false),0.7423,1112, + Iarg_leaf 1114)), + Iarg_facet ((2,true),0.5000,921, + Iarg_leaf 1605)))), + Iarg_facet ((3,true),0.5000,1881, + Iarg_facet ((0,true),0.5000,1148, + Iarg_leaf 1271))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1542, + Iarg_facet ((2,false),0.6115,1271, + Iarg_facet ((5,true),0.5000,1219, + Iarg_leaf 1289))), + Iarg_facet ((1,true),0.7202,1282, + Iarg_facet ((2,false),0.5000,992, + Iarg_leaf 1324))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,967, + Iarg_facet ((2,false),0.5964,1110, + Iarg_leaf 1671)), + Iarg_facet ((1,true),0.7888,923, + Iarg_leaf 1543))), + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1959, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1346, + Iarg_leaf 1934), + Iarg_facet ((2,false),0.5000,1434, + Iarg_facet ((3,true),0.5000,883, + Iarg_facet ((4,true),0.5000,1140, + Iarg_leaf 1238))))), + Iarg_facet ((0,false),0.5000,1308, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1303, + Iarg_leaf 1366), + Iarg_facet ((2,false),0.5000,1061, + Iarg_leaf 1317)))))))), + Iarg_facet ((4,false),0.5474,961, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,797, + Iarg_leaf 1250), + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1182, + Iarg_leaf 1912), + Iarg_facet ((3,false),0.5000,1353, + Iarg_leaf 1459)), + Iarg_facet ((2,true),0.5000,921, + Iarg_leaf 1510)), + Iarg_facet ((1,true),0.7764,816, + Iarg_leaf 1200)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,918, + Iarg_facet ((2,false),0.6992,1056, + Iarg_leaf 1347)), + Iarg_facet ((1,true),0.7936,1059, + Iarg_leaf 1721))), + Iarg_facet ((4,false),0.5000,1882, + Iarg_facet ((0,false),0.5000,1243, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1511, + Iarg_leaf 1523), + Iarg_facet ((2,true),0.5000,1097, + Iarg_leaf 1271))))), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_facet ((0,true),0.5000,1506, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,869, + Iarg_facet ((5,true),0.5000,1043, + Iarg_leaf 1439)), + Iarg_facet ((2,true),0.5000,1183, + Iarg_leaf 1354))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1056, + Iarg_facet ((2,false),0.7982,914, + Iarg_leaf 1159)), + Iarg_facet ((1,true),0.7919,1025, + Iarg_leaf 1475))), + Iarg_facet ((4,false),0.5000,1791, + Iarg_facet ((0,false),0.5000,1514, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,969, + Iarg_leaf 1902), + Iarg_facet ((2,true),0.5000,1122, + Iarg_leaf 1437))))))))));; + +add_case ("QITNPEA 2134082733 split(3/4)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1821, + Iarg_facet ((3,true),0.5000,1358, + Iarg_facet ((0,true),0.5000,994, + Iarg_leaf 1668))), + Iarg_facet ((5,true),0.5000,740, + Iarg_leaf 1840)), + Iarg_facet ((4,true),0.5000,1136, + Iarg_facet ((5,true),0.5000,743, + Iarg_leaf 1896))), + Iarg_facet ((2,true),0.5000,1758, + Iarg_facet ((4,true),0.5000,1107, + Iarg_facet ((5,true),0.5000,782, + Iarg_leaf 1908)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1511, + Iarg_facet ((5,true),0.5000,1054, + Iarg_facet ((3,false),0.5000,1159, + Iarg_leaf 1387))), + Iarg_facet ((4,true),0.6263,944, + Iarg_leaf 1254)), + Iarg_facet ((2,true),0.5000,1002, + Iarg_facet ((4,true),0.6366,973, + Iarg_leaf 1253)))), + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1474, + Iarg_facet ((4,true),0.5000,864, + Iarg_leaf 1822)), + Iarg_facet ((2,true),0.5000,927, + Iarg_leaf 1473)), + Iarg_facet ((1,true),0.5000,1066, + Iarg_facet ((2,true),0.6291,895, + Iarg_leaf 1178)))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1466, + Iarg_facet ((4,true),0.5000,1174, + Iarg_leaf 1488)), + Iarg_facet ((2,true),0.5000,945, + Iarg_leaf 1475)), + Iarg_facet ((1,true),0.5000,1102, + Iarg_facet ((2,true),0.5000,711, + Iarg_leaf 1360))), + Iarg_facet ((3,true),0.5000,1299, + Iarg_facet ((1,true),0.5000,1012, + Iarg_leaf 1828)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1956, + Iarg_facet ((4,true),0.5000,790, + Iarg_leaf 1521)), + Iarg_facet ((2,true),0.5000,1099, + Iarg_leaf 1264)), + Iarg_facet ((1,true),0.5000,1173, + Iarg_facet ((2,true),0.5000,816, + Iarg_leaf 1232))), + Iarg_facet ((3,true),0.5000,1598, + Iarg_facet ((1,true),0.5000,1147, + Iarg_facet ((2,true),0.5000,901, + Iarg_leaf 1156)))), + Iarg_facet ((5,true),0.5000,1689, + Iarg_facet ((3,true),0.5000,1528, + Iarg_facet ((1,true),0.5000,1165, + Iarg_leaf 1982))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1264, + Iarg_facet ((4,true),0.5000,761, + Iarg_leaf 1575)), + Iarg_facet ((2,true),0.5000,1101, + Iarg_leaf 1981)), + Iarg_facet ((1,true),0.5000,1308, + Iarg_leaf 1871)), + Iarg_facet ((3,true),0.5000,1340, + Iarg_facet ((1,true),0.5000,1316, + Iarg_leaf 1714))), + Iarg_facet ((5,true),0.5000,1672, + Iarg_facet ((3,true),0.5000,1634, + Iarg_facet ((1,true),0.5000,1376, + Iarg_leaf 1831)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1868, + Iarg_facet ((3,true),0.5000,1634, + Iarg_facet ((1,true),0.5000,1321, + Iarg_leaf 1683))), + Iarg_facet ((5,true),0.6810,834, + Iarg_leaf 1332)))));; + +add_case ("7550003505 2 2 4", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6111,734, + Iarg_facet ((3,true),0.6854,833, + Iarg_leaf 1336)), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1526, + Iarg_bisect (4, + Iarg_facet ((3,true),0.5000,796, + Iarg_leaf 1573), + Iarg_facet ((3,true),0.5000,727, + Iarg_leaf 1300))), + Iarg_facet ((2,true),0.6439,1027, + Iarg_facet ((4,true),0.5000,906, + Iarg_leaf 1157))), + Iarg_facet ((1,true),0.6366,869, + Iarg_leaf 1267)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1140, + Iarg_facet ((4,true),0.5000,1732, + Iarg_leaf 1734)), + Iarg_facet ((2,true),0.5000,789, + Iarg_facet ((4,true),0.5000,1987, + Iarg_facet ((3,true),0.5000,1044, + Iarg_leaf 1163)))), + Iarg_facet ((1,true),0.5000,924, + Iarg_leaf 1705))), + Iarg_facet ((5,false),0.5000,1598, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,956, + Iarg_facet ((4,false),0.5000,997, + Iarg_leaf 1030)), + Iarg_facet ((2,true),0.5000,967, + Iarg_facet ((4,true),0.5000,1305, + Iarg_leaf 1318))), + Iarg_facet ((1,true),0.5000,984, + Iarg_leaf 1126)))), + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,730, + Iarg_leaf 1844), + Iarg_facet ((1,true),0.5000,739, + Iarg_facet ((2,true),0.5000,905, + Iarg_leaf 1493))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1121, + Iarg_leaf 1851), + Iarg_facet ((1,true),0.5000,1267, + Iarg_facet ((2,true),0.5000,1260, + Iarg_leaf 1618)))), + Iarg_facet ((5,false),0.5000,1049, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1161, + Iarg_leaf 1312), + Iarg_facet ((1,true),0.5000,1531, + Iarg_facet ((2,false),0.5000,1066, + Iarg_leaf 1243)))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.7437,897, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1020, + Iarg_leaf 1136), + Iarg_facet ((0,true),0.5000,1000, + Iarg_leaf 1080))), + Iarg_facet ((5,true),0.7071,1182, + Iarg_bisect (3, + Iarg_facet ((0,false),0.7177,1033, + Iarg_leaf 1250), + Iarg_facet ((0,false),0.5666,803, + Iarg_leaf 1376)))))), + Iarg_facet ((4,false),0.7328,1064, + Iarg_facet ((5,false),0.5000,917, + Iarg_leaf 1618))));; + +add_case ("OXLZLEZ 6346351218 3 4", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1982, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1579, + Iarg_facet ((1,true),0.5000,1486, + Iarg_facet ((2,true),0.5000,1017, + Iarg_facet ((3,true),0.7512,853, + Iarg_leaf 1464)))), + Iarg_facet ((5,true),0.6454,857, + Iarg_leaf 1285))), + Iarg_facet ((3,true),0.5000,954, + Iarg_facet ((4,true),0.5000,1046, + Iarg_facet ((5,true),0.6225,920, + Iarg_leaf 1334)))), + Iarg_facet ((2,true),0.5000,1783, + Iarg_facet ((3,true),0.5000,964, + Iarg_facet ((4,true),0.5000,961, + Iarg_facet ((5,true),0.5000,757, + Iarg_leaf 1669))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1479, + Iarg_facet ((3,true),0.5000,775, + Iarg_facet ((4,true),0.5000,739, + Iarg_facet ((5,false),0.5000,1217, + Iarg_leaf 1556)))), + Iarg_facet ((2,true),0.5000,745, + Iarg_facet ((3,true),0.7666,879, + Iarg_leaf 1231)))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,768, + Iarg_facet ((4,false),0.5000,1645, + Iarg_leaf 1965)), + Iarg_facet ((3,true),0.7373,782, + Iarg_leaf 1225)), + Iarg_facet ((2,true),0.5000,789, + Iarg_leaf 1518)), + Iarg_facet ((1,true),0.5000,843, + Iarg_leaf 1416))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1374, + Iarg_facet ((3,true),0.5000,1297, + Iarg_leaf 1491)), + Iarg_facet ((2,true),0.5000,718, + Iarg_leaf 1382)), + Iarg_facet ((1,true),0.5000,787, + Iarg_leaf 1487)), + Iarg_facet ((5,true),0.5000,747, + Iarg_facet ((1,true),0.5000,815, + Iarg_leaf 1580)))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.6310,894, + Iarg_facet ((4,true),0.6299,885, + Iarg_leaf 1166)), + Iarg_facet ((3,true),0.6456,849, + Iarg_facet ((4,true),0.5000,790, + Iarg_leaf 1796))), + Iarg_facet ((2,true),0.5000,1075, + Iarg_leaf 1184)), + Iarg_facet ((1,true),0.5000,916, + Iarg_leaf 1957)), + Iarg_facet ((5,true),0.5000,1160, + Iarg_facet ((1,true),0.5000,1265, + Iarg_facet ((2,false),0.5000,1728, + Iarg_leaf 1997)))), + Iarg_facet ((4,true),0.5000,1416, + Iarg_facet ((5,true),0.5000,887, + Iarg_facet ((1,true),0.5000,895, + Iarg_leaf 1669))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1173, + Iarg_facet ((3,true),0.6381,910, + Iarg_facet ((4,true),0.7320,863, + Iarg_leaf 1063))), + Iarg_facet ((2,true),0.5000,1054, + Iarg_facet ((3,true),0.6489,862, + Iarg_facet ((4,true),0.6638,759, + Iarg_leaf 1682)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.6444,814, + Iarg_leaf 1306), + Iarg_facet ((2,true),0.6499,782, + Iarg_leaf 1489))), + Iarg_facet ((5,true),0.5000,1146, + Iarg_facet ((1,true),0.5000,1491, + Iarg_leaf 1547))), + Iarg_facet ((4,true),0.5000,1247, + Iarg_facet ((5,true),0.5000,1000, + Iarg_facet ((1,true),0.5000,1070, + Iarg_leaf 1392)))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1259, + Iarg_facet ((1,true),0.5000,1179, + Iarg_leaf 1425)), + Iarg_leaf 1999), + Iarg_facet ((4,true),0.6387,788, + Iarg_leaf 1066)))));; + +add_case ("TSKAJXY-IYOUOBF sym", + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1675, + Iarg_bisect (1, + Iarg_bisect (0, + Iarg_facet ((2,true),0.5000,1001, + Iarg_facet ((3,true),0.5000,1002, + Iarg_facet ((4,true),0.7851,1198, + Iarg_leaf 1734))), + Iarg_facet ((2,true),0.5000,1169, + Iarg_facet ((3,true),0.5000,1305, + Iarg_facet ((4,true),0.7184,771, + Iarg_facet ((5,true),0.7836,883, + Iarg_leaf 1582))))), + Iarg_facet ((0,false),0.5000,1153, + Iarg_leaf 1390))), + Iarg_facet ((5,true),0.6997,895, + Iarg_leaf 1067)), + Iarg_facet ((4,true),0.5000,1312, + Iarg_facet ((5,true),0.5000,1063, + Iarg_facet ((1,true),0.5000,1542, + Iarg_bisect (0, + Iarg_facet ((2,true),0.7747,1077, + Iarg_leaf 800), + Iarg_facet ((2,true),0.5000,759, + Iarg_leaf 1494)))))), + Iarg_facet ((3,true),0.5000,1862, + Iarg_facet ((4,true),0.5000,819, + Iarg_leaf 1816))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1354, + Iarg_facet ((5,true),0.5000,1144, + Iarg_facet ((1,true),0.5000,1031, + Iarg_leaf 1290))), + Iarg_facet ((4,true),0.5000,763, + Iarg_leaf 1663)), + Iarg_facet ((3,true),0.5000,1122, + Iarg_leaf 1795))), + Iarg_facet ((1,false),0.5000,1253, + Iarg_facet ((2,true),0.5000,1229, + Iarg_facet ((3,true),0.5000,952, + Iarg_leaf 1788)))), + Iarg_facet ((5,true),0.5000,1594, + Iarg_facet ((1,false),0.5000,1037, + Iarg_facet ((2,true),0.5000,1187, + Iarg_leaf 1974)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1285, + Iarg_facet ((5,true),0.5000,953, + Iarg_facet ((1,true),0.5000,1242, + Iarg_facet ((0,false),0.5000,1692, + Iarg_facet ((2,true),0.8579,1245, + Iarg_leaf 661))))), + Iarg_facet ((4,true),0.5000,1246, + Iarg_facet ((5,true),0.5000,947, + Iarg_facet ((1,true),0.5000,1467, + Iarg_bisect (0, + Iarg_facet ((2,true),0.6318,844, + Iarg_leaf 1237), + Iarg_facet ((2,true),0.5000,882, + Iarg_facet ((3,false),0.5000,813, + Iarg_leaf 1296))))))), + Iarg_facet ((3,true),0.5000,1784, + Iarg_leaf 1835)), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.6177,951, + Iarg_leaf 1364), + Iarg_facet ((4,true),0.5000,725, + Iarg_leaf 1439)), + Iarg_facet ((3,false),0.5000,1059, + Iarg_leaf 1102))), + Iarg_facet ((1,false),0.5000,1046, + Iarg_facet ((2,true),0.5000,821, + Iarg_leaf 1538))), + Iarg_facet ((5,true),0.5000,1120, + Iarg_facet ((1,false),0.5000,874, + Iarg_facet ((2,true),0.5000,936, + Iarg_leaf 1555))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1475, + Iarg_facet ((1,false),0.5000,835, + Iarg_facet ((2,true),0.5000,977, + Iarg_leaf 1806))), + Iarg_facet ((5,true),0.6246,890, + Iarg_leaf 1271)), + Iarg_facet ((4,true),0.5000,1464, + Iarg_facet ((5,true),0.5000,1024, + Iarg_facet ((1,false),0.5000,720, + Iarg_facet ((2,true),0.5000,778, + Iarg_leaf 1413)))))));; + +add_case ("OXLZLEZ 6346351218 2 23", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1400, + Iarg_facet ((4,true),0.5000,934, + Iarg_facet ((5,true),0.6329,1004, + Iarg_leaf 1887))), + Iarg_facet ((2,true),0.6332,919, + Iarg_leaf 1127)), + Iarg_facet ((1,true),0.5000,977, + Iarg_leaf 1922)), + Iarg_facet ((3,true),0.5000,1043, + Iarg_facet ((1,true),0.5000,860, + Iarg_leaf 1515))), + Iarg_facet ((5,true),0.5000,1149, + Iarg_facet ((3,true),0.5000,1073, + Iarg_facet ((1,true),0.5000,798, + Iarg_leaf 1623)))), + Iarg_facet ((4,true),0.5000,1922, + Iarg_facet ((5,true),0.5000,1251, + Iarg_facet ((3,true),0.5000,1100, + Iarg_facet ((1,true),0.5000,804, + Iarg_leaf 1622))))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1734, + Iarg_facet ((5,true),0.5000,1439, + Iarg_facet ((3,true),0.5000,1086, + Iarg_facet ((2,true),0.5000,801, + Iarg_leaf 1615)))), + Iarg_facet ((4,true),0.6100,925, + Iarg_leaf 1371))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1701, + Iarg_facet ((4,true),0.5000,1212, + Iarg_bisect (5, + Iarg_facet ((3,true),0.6198,929, + Iarg_leaf 1195), + Iarg_facet ((3,true),0.6444,815, + Iarg_leaf 1344)))), + Iarg_facet ((2,true),0.5000,884, + Iarg_facet ((4,true),0.6533,857, + Iarg_leaf 1724)))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6337,975, + Iarg_leaf 1836), + Iarg_facet ((5,true),0.6521,858, + Iarg_leaf 1926)), + Iarg_facet ((4,false),0.5000,1297, + Iarg_leaf 1371)), + Iarg_facet ((2,true),0.5000,883, + Iarg_leaf 1705)), + Iarg_facet ((1,true),0.5000,1078, + Iarg_leaf 1692))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1330, + Iarg_facet ((5,true),0.6011,899, + Iarg_facet ((3,true),0.6434,814, + Iarg_leaf 1069))), + Iarg_facet ((4,true),0.5000,1404, + Iarg_facet ((5,true),0.6518,817, + Iarg_leaf 1964))), + Iarg_facet ((2,true),0.5000,1229, + Iarg_leaf 1419)), + Iarg_facet ((1,true),0.5000,1081, + Iarg_leaf 1769)), + Iarg_facet ((5,true),0.5000,1568, + Iarg_facet ((1,true),0.5000,1401, + Iarg_facet ((2,false),0.5000,1959, + Iarg_facet ((4,false),0.5000,1067, + Iarg_leaf 1369)))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1407, + Iarg_facet ((4,true),0.5000,993, + Iarg_facet ((5,true),0.5000,1029, + Iarg_facet ((3,true),0.5000,718, + Iarg_leaf 1635)))), + Iarg_facet ((2,true),0.5000,1228, + Iarg_facet ((4,true),0.5000,857, + Iarg_facet ((5,true),0.5000,1122, + Iarg_facet ((3,true),0.6353,889, + Iarg_leaf 1468))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.6333,931, + Iarg_leaf 1624), + Iarg_facet ((2,true),0.6127,863, + Iarg_facet ((4,true),0.7844,869, + Iarg_leaf 1327)))), + Iarg_facet ((5,true),0.5000,1540, + Iarg_facet ((1,true),0.5000,1355, + Iarg_leaf 1531))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1571, + Iarg_facet ((1,true),0.5000,1298, + Iarg_leaf 1538)), + Iarg_facet ((5,true),0.5000,735, + Iarg_leaf 1671)))));; + +add_case ("OXLZLEZ 6346351218 2 22", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1400, + Iarg_facet ((4,true),0.5000,924, + Iarg_facet ((5,true),0.6329,1003, + Iarg_leaf 1887))), + Iarg_facet ((2,true),0.6163,914, + Iarg_leaf 1158)), + Iarg_facet ((1,true),0.5000,978, + Iarg_leaf 1921)), + Iarg_facet ((3,true),0.5000,1043, + Iarg_facet ((1,true),0.5000,860, + Iarg_leaf 1516))), + Iarg_facet ((5,true),0.5000,1149, + Iarg_facet ((3,true),0.5000,1073, + Iarg_facet ((1,true),0.5000,797, + Iarg_leaf 1629)))), + Iarg_facet ((4,true),0.5000,1924, + Iarg_facet ((5,true),0.5000,1253, + Iarg_facet ((3,true),0.5000,1098, + Iarg_facet ((1,true),0.5000,803, + Iarg_leaf 1626))))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1732, + Iarg_facet ((5,true),0.5000,1441, + Iarg_facet ((3,true),0.5000,1086, + Iarg_facet ((2,true),0.5000,798, + Iarg_leaf 1616)))), + Iarg_facet ((4,true),0.6174,947, + Iarg_leaf 1346))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1703, + Iarg_facet ((4,true),0.5000,1212, + Iarg_bisect (5, + Iarg_facet ((3,true),0.6467,980, + Iarg_leaf 1128), + Iarg_facet ((3,true),0.6441,813, + Iarg_leaf 1344)))), + Iarg_facet ((2,true),0.5000,887, + Iarg_facet ((4,true),0.6533,857, + Iarg_leaf 1719)))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6332,976, + Iarg_leaf 1836), + Iarg_facet ((5,true),0.6523,856, + Iarg_leaf 1917)), + Iarg_facet ((4,false),0.5000,1296, + Iarg_leaf 1370)), + Iarg_facet ((2,true),0.5000,885, + Iarg_leaf 1702)), + Iarg_facet ((1,true),0.5000,1078, + Iarg_leaf 1696))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1330, + Iarg_facet ((5,true),0.6224,962, + Iarg_leaf 1956)), + Iarg_facet ((4,true),0.5000,1402, + Iarg_facet ((5,true),0.7544,1129, + Iarg_leaf 1913))), + Iarg_facet ((2,true),0.5000,1230, + Iarg_leaf 1404)), + Iarg_facet ((1,true),0.5000,1080, + Iarg_leaf 1776)), + Iarg_facet ((5,true),0.5000,1570, + Iarg_facet ((1,true),0.5000,1400, + Iarg_facet ((2,false),0.5000,1958, + Iarg_facet ((4,false),0.5000,1069, + Iarg_leaf 1368)))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1407, + Iarg_facet ((4,true),0.5000,994, + Iarg_facet ((5,true),0.5000,1028, + Iarg_facet ((3,true),0.5000,718, + Iarg_leaf 1640)))), + Iarg_facet ((2,true),0.5000,1232, + Iarg_facet ((4,true),0.5000,858, + Iarg_facet ((5,true),0.5000,1122, + Iarg_facet ((3,true),0.6356,891, + Iarg_leaf 1469))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.6180,872, + Iarg_leaf 1682), + Iarg_facet ((2,true),0.6218,887, + Iarg_facet ((4,true),0.7562,768, + Iarg_leaf 1484)))), + Iarg_facet ((5,true),0.5000,1540, + Iarg_facet ((1,true),0.5000,1356, + Iarg_leaf 1531))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1572, + Iarg_facet ((1,true),0.5000,1304, + Iarg_leaf 1539)), + Iarg_facet ((5,true),0.5000,734, + Iarg_leaf 1672)))));; + +add_case ("OXLZLEZ 6346351218 2 8", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1819, + Iarg_facet ((4,true),0.5000,1780, + Iarg_facet ((5,true),0.5000,1220, + Iarg_facet ((0,true),0.6728,857, + Iarg_leaf 1559)))), + Iarg_facet ((3,true),0.5000,1087, + Iarg_facet ((4,true),0.5000,975, + Iarg_leaf 1921))), + Iarg_facet ((2,true),0.5000,1976, + Iarg_facet ((3,true),0.5000,1074, + Iarg_facet ((4,true),0.5000,952, + Iarg_leaf 1959)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1631, + Iarg_facet ((3,true),0.5000,911, + Iarg_facet ((4,true),0.6212,953, + Iarg_leaf 1607))), + Iarg_facet ((2,true),0.5000,955, + Iarg_facet ((3,true),0.6566,818, + Iarg_leaf 1146)))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,942, + Iarg_facet ((4,true),0.5000,1250, + Iarg_leaf 1329)), + Iarg_facet ((3,true),0.6695,866, + Iarg_leaf 1106)), + Iarg_facet ((2,true),0.5000,1021, + Iarg_leaf 1692)), + Iarg_facet ((1,true),0.5000,1012, + Iarg_leaf 1599))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1653, + Iarg_facet ((3,true),0.5000,1111, + Iarg_leaf 1363)), + Iarg_facet ((2,true),0.5000,1073, + Iarg_leaf 1642)), + Iarg_facet ((1,true),0.5000,1232, + Iarg_facet ((2,true),0.5000,799, + Iarg_leaf 1272))), + Iarg_facet ((5,true),0.5000,1131, + Iarg_facet ((1,true),0.5000,1290, + Iarg_facet ((2,true),0.5000,860, + Iarg_leaf 1367))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,859, + Iarg_facet ((4,true),0.5000,777, + Iarg_leaf 1456)), + Iarg_facet ((3,true),0.5000,764, + Iarg_facet ((4,true),0.5000,767, + Iarg_leaf 1324))), + Iarg_facet ((2,true),0.5000,1234, + Iarg_leaf 1430)), + Iarg_facet ((1,true),0.5000,1135, + Iarg_leaf 1996)), + Iarg_facet ((5,true),0.5000,1547, + Iarg_facet ((1,true),0.5000,1470, + Iarg_facet ((2,true),0.5000,1544, + Iarg_leaf 1560)))), + Iarg_facet ((4,true),0.5000,1915, + Iarg_facet ((5,true),0.5000,1312, + Iarg_facet ((1,true),0.5000,1393, + Iarg_facet ((2,true),0.5000,1099, + Iarg_leaf 1320)))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1402, + Iarg_facet ((3,true),0.5000,843, + Iarg_facet ((4,true),0.6269,902, + Iarg_leaf 1246))), + Iarg_facet ((2,true),0.5000,1172, + Iarg_facet ((3,true),0.5000,725, + Iarg_facet ((4,true),0.6855,922, + Iarg_leaf 1110)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,722, + Iarg_leaf 1502), + Iarg_facet ((2,true),0.6236,871, + Iarg_leaf 1273))), + Iarg_facet ((5,true),0.5000,1541, + Iarg_facet ((1,true),0.5000,1539, + Iarg_leaf 1749))), + Iarg_facet ((4,true),0.5000,1812, + Iarg_facet ((5,true),0.5000,1451, + Iarg_facet ((1,true),0.5000,1603, + Iarg_facet ((2,true),0.5000,767, + Iarg_leaf 1247))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1670, + Iarg_facet ((1,true),0.5000,1413, + Iarg_leaf 1735)), + Iarg_facet ((5,true),0.5000,867, + Iarg_leaf 1727)), + Iarg_facet ((4,true),0.5000,710, + Iarg_facet ((5,true),0.6580,785, + Iarg_leaf 1085))))));; + +add_case ("FHBVYXZ a split(1/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1540, + Iarg_facet ((5,true),0.5000,1693, + Iarg_facet ((0,false),0.7121,850, + Iarg_facet ((1,true),0.6340,826, + Iarg_leaf 1001)))), + Iarg_facet ((4,true),0.5000,834, + Iarg_facet ((5,true),0.5000,784, + Iarg_leaf 1278))), + Iarg_facet ((3,true),0.5000,1279, + Iarg_facet ((4,true),0.5000,721, + Iarg_leaf 1661))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1714, + Iarg_facet ((4,true),0.5000,963, + Iarg_facet ((5,true),0.5000,900, + Iarg_leaf 1774))), + Iarg_facet ((3,true),0.5000,788, + Iarg_leaf 1304))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1436, + Iarg_facet ((3,true),0.5000,1261, + Iarg_facet ((4,true),0.6382,980, + Iarg_leaf 1834))), + Iarg_facet ((2,true),0.5000,768, + Iarg_leaf 1819))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1483, + Iarg_facet ((3,true),0.5000,928, + Iarg_leaf 1645)), + Iarg_facet ((2,true),0.5000,830, + Iarg_leaf 1444)), + Iarg_facet ((1,true),0.5000,806, + Iarg_leaf 1314))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,799, + Iarg_leaf 1799), + Iarg_facet ((4,true),0.5000,817, + Iarg_leaf 1956)), + Iarg_facet ((3,false),0.5000,1216, + Iarg_leaf 1292)), + Iarg_facet ((2,true),0.5000,1577, + Iarg_facet ((3,false),0.5000,1585, + Iarg_leaf 1689))), + Iarg_facet ((1,true),0.5000,1609, + Iarg_facet ((2,true),0.5000,1059, + Iarg_facet ((3,false),0.5000,1107, + Iarg_leaf 1178)))), + Iarg_facet ((5,true),0.5000,1346, + Iarg_facet ((1,true),0.5000,1661, + Iarg_facet ((2,true),0.5000,1077, + Iarg_leaf 1784))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1846, + Iarg_facet ((3,true),0.5000,874, + Iarg_leaf 1495)), + Iarg_facet ((2,true),0.5000,1024, + Iarg_leaf 1308)), + Iarg_facet ((1,true),0.5000,861, + Iarg_leaf 1438)), + Iarg_facet ((5,true),0.5000,1110, + Iarg_facet ((1,true),0.5000,1118, + Iarg_facet ((2,true),0.5000,984, + Iarg_leaf 1108)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1494, + Iarg_facet ((1,true),0.5000,1756, + Iarg_facet ((2,true),0.5000,1302, + Iarg_leaf 1643))), + Iarg_facet ((5,true),0.7916,1035, + Iarg_leaf 821)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1328, + Iarg_facet ((3,true),0.5000,1125, + Iarg_facet ((4,true),0.6516,939, + Iarg_leaf 1468))), + Iarg_facet ((2,true),0.5000,970, + Iarg_facet ((3,true),0.5000,829, + Iarg_leaf 1811))), + Iarg_facet ((1,true),0.5000,1443, + Iarg_leaf 1734)), + Iarg_facet ((5,true),0.5000,1113, + Iarg_facet ((1,true),0.5000,1041, + Iarg_leaf 1354))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1655, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,992, + Iarg_facet ((3,false),0.5000,1006, + Iarg_leaf 1056)), + Iarg_facet ((2,true),0.5000,750, + Iarg_leaf 1429))), + Iarg_leaf 1999)), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1873, + Iarg_facet ((5,true),0.5000,1245, + Iarg_facet ((1,true),0.5000,1140, + Iarg_leaf 1480))), + Iarg_facet ((4,true),0.6199,977, + Iarg_leaf 1814)))));; + +add_case ("QITNPEA 5814748276 split(1/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1668, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,979, + Iarg_facet ((2,true),0.6218,882, + Iarg_leaf 1483)), + Iarg_facet ((1,true),0.5000,746, + Iarg_leaf 1627))), + Iarg_facet ((5,true),0.6835,896, + Iarg_leaf 1239)), + Iarg_facet ((4,true),0.5000,1003, + Iarg_facet ((5,true),0.5000,734, + Iarg_facet ((0,true),0.5000,1063, + Iarg_leaf 1141)))), + Iarg_facet ((3,true),0.5000,1520, + Iarg_facet ((4,true),0.5000,907, + Iarg_facet ((5,true),0.6423,903, + Iarg_leaf 1383)))), + Iarg_facet ((2,true),0.5000,1861, + Iarg_facet ((3,true),0.5000,1537, + Iarg_facet ((4,true),0.5000,852, + Iarg_facet ((5,true),0.6235,984, + Iarg_leaf 1406))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1221, + Iarg_facet ((3,true),0.5000,1013, + Iarg_facet ((4,true),0.6978,874, + Iarg_leaf 1298))), + Iarg_facet ((2,true),0.6174,910, + Iarg_leaf 1284))), + Iarg_facet ((5,true),0.5000,1887, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1534, + Iarg_facet ((3,true),0.5000,1026, + Iarg_facet ((4,true),0.5000,912, + Iarg_leaf 1228))), + Iarg_facet ((2,true),0.5000,739, + Iarg_leaf 1268)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1011, + Iarg_facet ((5,true),0.5000,748, + Iarg_leaf 1838)), + Iarg_facet ((4,true),0.5000,975, + Iarg_facet ((5,true),0.6180,1013, + Iarg_leaf 1713))), + Iarg_facet ((3,true),0.5000,1467, + Iarg_leaf 1475)), + Iarg_facet ((2,true),0.5000,1377, + Iarg_facet ((3,true),0.5000,1483, + Iarg_leaf 1499))), + Iarg_facet ((1,true),0.5000,1414, + Iarg_facet ((2,true),0.5000,917, + Iarg_leaf 1845))), + Iarg_facet ((5,true),0.5000,1190, + Iarg_facet ((1,true),0.5000,1473, + Iarg_facet ((2,true),0.5000,1004, + Iarg_leaf 1891))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,928, + Iarg_leaf 1902), + Iarg_facet ((3,true),0.5000,730, + Iarg_leaf 1438)), + Iarg_facet ((2,true),0.5000,925, + Iarg_leaf 1140)), + Iarg_facet ((1,true),0.5000,780, + Iarg_leaf 1283)), + Iarg_facet ((5,true),0.5000,1037, + Iarg_facet ((1,true),0.5000,1010, + Iarg_facet ((2,true),0.5000,959, + Iarg_leaf 1087)))), + Iarg_facet ((4,true),0.5000,1986, + Iarg_facet ((5,true),0.5000,1341, + Iarg_facet ((1,true),0.5000,1587, + Iarg_facet ((2,true),0.5000,1291, + Iarg_leaf 1706)))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1114, + Iarg_facet ((3,true),0.5000,907, + Iarg_leaf 1909)), + Iarg_facet ((2,true),0.5000,864, + Iarg_facet ((3,true),0.6189,911, + Iarg_leaf 1120))), + Iarg_facet ((1,true),0.5000,1274, + Iarg_leaf 1483)), + Iarg_facet ((5,true),0.5000,1038, + Iarg_facet ((1,true),0.5000,941, + Iarg_leaf 1209))), + Iarg_facet ((4,true),0.5000,1796, + Iarg_facet ((5,true),0.5000,1514, + Iarg_facet ((1,true),0.5000,1891, + Iarg_facet ((2,true),0.5000,897, + Iarg_leaf 1702))))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1726, + Iarg_facet ((5,true),0.5000,1160, + Iarg_facet ((1,true),0.5000,1042, + Iarg_leaf 1321))), + Iarg_facet ((4,true),0.6342,923, + Iarg_leaf 1608)))));; + +add_case ("QITNPEA 6206775865 split(1/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1649, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,986, + Iarg_facet ((2,true),0.6180,895, + Iarg_leaf 1599)), + Iarg_facet ((1,true),0.5000,760, + Iarg_leaf 1781))), + Iarg_facet ((5,true),0.7505,1061, + Iarg_leaf 1134)), + Iarg_facet ((4,true),0.5000,1045, + Iarg_facet ((5,true),0.5000,779, + Iarg_facet ((0,true),0.5000,1183, + Iarg_leaf 1240)))), + Iarg_facet ((3,true),0.5000,1550, + Iarg_facet ((4,true),0.5000,887, + Iarg_facet ((5,true),0.6423,893, + Iarg_leaf 1349)))), + Iarg_facet ((2,true),0.5000,1837, + Iarg_facet ((3,true),0.5000,1568, + Iarg_facet ((4,true),0.5000,839, + Iarg_facet ((5,true),0.6366,997, + Iarg_leaf 1372))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1192, + Iarg_facet ((3,true),0.5000,1030, + Iarg_facet ((4,true),0.6726,791, + Iarg_leaf 1269))), + Iarg_facet ((2,true),0.6167,896, + Iarg_leaf 1248))), + Iarg_facet ((5,true),0.5000,1821, + Iarg_facet ((1,true),0.5000,1949, + Iarg_facet ((2,true),0.5000,1484, + Iarg_facet ((3,true),0.5000,1038, + Iarg_facet ((4,true),0.5000,868, + Iarg_leaf 1207)))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1068, + Iarg_facet ((5,true),0.5000,781, + Iarg_facet ((0,true),0.5000,952, + Iarg_leaf 1120))), + Iarg_facet ((4,true),0.5000,1102, + Iarg_facet ((5,true),0.5000,791, + Iarg_facet ((0,true),0.5000,1234, + Iarg_leaf 1374)))), + Iarg_facet ((3,false),0.5000,1528, + Iarg_leaf 1629)), + Iarg_facet ((2,true),0.5000,1430, + Iarg_facet ((3,false),0.5000,1560, + Iarg_leaf 1640))), + Iarg_facet ((1,true),0.5000,1444, + Iarg_facet ((2,true),0.5000,944, + Iarg_leaf 1937))), + Iarg_facet ((5,true),0.5000,1218, + Iarg_facet ((1,true),0.5000,1497, + Iarg_facet ((2,true),0.5000,1017, + Iarg_leaf 1975))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,941, + Iarg_leaf 1838), + Iarg_facet ((3,true),0.5000,726, + Iarg_leaf 1342)), + Iarg_facet ((2,true),0.5000,916, + Iarg_leaf 1129)), + Iarg_facet ((1,true),0.5000,767, + Iarg_leaf 1261)), + Iarg_facet ((5,true),0.5000,1013, + Iarg_facet ((1,true),0.5000,982, + Iarg_leaf 1976))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1349, + Iarg_facet ((1,true),0.5000,1597, + Iarg_facet ((2,true),0.5000,1326, + Iarg_leaf 1783))), + Iarg_facet ((5,true),0.7561,844, + Iarg_leaf 1080)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1094, + Iarg_facet ((3,true),0.5000,920, + Iarg_leaf 1847)), + Iarg_facet ((2,true),0.5000,846, + Iarg_facet ((3,true),0.6201,905, + Iarg_leaf 1071))), + Iarg_facet ((1,true),0.5000,1229, + Iarg_leaf 1439)), + Iarg_facet ((5,true),0.5000,1018, + Iarg_facet ((1,true),0.5000,917, + Iarg_leaf 1176))), + Iarg_facet ((4,true),0.5000,1807, + Iarg_facet ((5,true),0.5000,1523, + Iarg_facet ((1,true),0.5000,1938, + Iarg_facet ((2,true),0.5000,910, + Iarg_leaf 1776))))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1675, + Iarg_facet ((5,true),0.5000,1139, + Iarg_facet ((1,true),0.5000,1012, + Iarg_leaf 1305))), + Iarg_facet ((4,true),0.6334,917, + Iarg_leaf 1623)))));; + +add_case ("BIXPCGW 9455898160 split(1/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1655, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,999, + Iarg_facet ((2,true),0.6174,899, + Iarg_leaf 1594)), + Iarg_facet ((1,true),0.5000,755, + Iarg_leaf 1728))), + Iarg_facet ((5,true),0.6679,857, + Iarg_leaf 1274)), + Iarg_facet ((4,true),0.5000,1021, + Iarg_facet ((5,true),0.5000,755, + Iarg_facet ((0,true),0.5000,1079, + Iarg_leaf 1207)))), + Iarg_facet ((3,true),0.5000,1536, + Iarg_facet ((4,true),0.5000,895, + Iarg_facet ((5,true),0.6421,897, + Iarg_leaf 1364)))), + Iarg_facet ((2,true),0.5000,1878, + Iarg_facet ((3,true),0.5000,1555, + Iarg_facet ((4,true),0.5000,847, + Iarg_facet ((5,true),0.6249,986, + Iarg_leaf 1404))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1224, + Iarg_facet ((3,true),0.5000,1038, + Iarg_facet ((4,true),0.7382,989, + Iarg_leaf 1204))), + Iarg_facet ((2,true),0.6163,916, + Iarg_leaf 1298))), + Iarg_facet ((5,true),0.5000,1855, + Iarg_facet ((1,true),0.5000,1966, + Iarg_facet ((2,true),0.5000,1518, + Iarg_facet ((3,true),0.5000,1027, + Iarg_facet ((4,true),0.5000,894, + Iarg_leaf 1221)))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1026, + Iarg_facet ((5,true),0.5000,750, + Iarg_leaf 1982)), + Iarg_facet ((4,true),0.5000,1039, + Iarg_facet ((5,true),0.5000,734, + Iarg_facet ((0,true),0.5000,1105, + Iarg_leaf 1197)))), + Iarg_facet ((3,false),0.5000,1497, + Iarg_leaf 1520)), + Iarg_facet ((2,true),0.5000,1402, + Iarg_facet ((3,false),0.5000,1522, + Iarg_leaf 1534))), + Iarg_facet ((1,true),0.5000,1419, + Iarg_facet ((2,true),0.5000,923, + Iarg_leaf 1867))), + Iarg_facet ((5,true),0.5000,1200, + Iarg_facet ((1,true),0.5000,1471, + Iarg_facet ((2,true),0.5000,1004, + Iarg_leaf 1902))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,930, + Iarg_leaf 1871), + Iarg_facet ((3,true),0.5000,723, + Iarg_leaf 1403)), + Iarg_facet ((2,true),0.5000,917, + Iarg_leaf 1132)), + Iarg_facet ((1,true),0.5000,763, + Iarg_leaf 1264)), + Iarg_facet ((5,true),0.5000,1017, + Iarg_facet ((1,true),0.5000,985, + Iarg_facet ((2,true),0.5000,947, + Iarg_leaf 1062)))), + Iarg_facet ((4,true),0.5000,1989, + Iarg_facet ((5,true),0.5000,1333, + Iarg_facet ((1,true),0.5000,1579, + Iarg_facet ((2,true),0.5000,1291, + Iarg_leaf 1712)))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1093, + Iarg_facet ((3,true),0.5000,912, + Iarg_leaf 1880)), + Iarg_facet ((2,true),0.5000,852, + Iarg_facet ((3,true),0.6201,913, + Iarg_leaf 1087))), + Iarg_facet ((1,true),0.5000,1251, + Iarg_leaf 1450)), + Iarg_facet ((5,true),0.5000,1034, + Iarg_facet ((1,true),0.5000,919, + Iarg_leaf 1188))), + Iarg_facet ((4,true),0.5000,1794, + Iarg_facet ((5,true),0.5000,1508, + Iarg_facet ((1,true),0.5000,1897, + Iarg_facet ((2,true),0.5000,893, + Iarg_leaf 1715))))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1680, + Iarg_facet ((5,true),0.5000,1137, + Iarg_facet ((1,true),0.5000,1030, + Iarg_leaf 1300))), + Iarg_facet ((4,true),0.6364,920, + Iarg_leaf 1601)))));; + +add_case ("ZTGIJCF4 0 0 0 0 1821661595 split(1/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1752, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1020, + Iarg_facet ((2,true),0.6348,926, + Iarg_leaf 1313)), + Iarg_facet ((1,true),0.5000,717, + Iarg_leaf 1387))), + Iarg_facet ((5,true),0.6423,929, + Iarg_leaf 1421)), + Iarg_facet ((4,true),0.5000,928, + Iarg_facet ((5,true),0.6283,950, + Iarg_leaf 1396))), + Iarg_facet ((3,true),0.5000,1409, + Iarg_facet ((4,true),0.5000,1038, + Iarg_facet ((5,true),0.5000,717, + Iarg_leaf 1854)))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1431, + Iarg_facet ((4,true),0.5000,1003, + Iarg_facet ((5,true),0.5000,784, + Iarg_leaf 1836))), + Iarg_facet ((3,true),0.6203,896, + Iarg_leaf 1051))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1391, + Iarg_facet ((3,true),0.5000,1016, + Iarg_facet ((4,true),0.6455,938, + Iarg_leaf 1650))), + Iarg_facet ((2,true),0.5000,751, + Iarg_leaf 1749))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1786, + Iarg_facet ((3,true),0.5000,1020, + Iarg_facet ((4,true),0.5000,1134, + Iarg_leaf 1442))), + Iarg_facet ((2,true),0.5000,821, + Iarg_leaf 1430)), + Iarg_facet ((1,true),0.5000,806, + Iarg_leaf 1305))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,828, + Iarg_leaf 1940), + Iarg_facet ((4,true),0.5000,753, + Iarg_leaf 1642)), + Iarg_facet ((3,true),0.5000,1203, + Iarg_leaf 1258)), + Iarg_facet ((2,true),0.5000,1311, + Iarg_facet ((3,true),0.5000,1210, + Iarg_leaf 1261))), + Iarg_facet ((1,true),0.5000,1366, + Iarg_facet ((2,true),0.5000,886, + Iarg_leaf 1646))), + Iarg_facet ((5,true),0.5000,1180, + Iarg_facet ((1,true),0.5000,1433, + Iarg_facet ((2,true),0.5000,955, + Iarg_leaf 1687))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,931, + Iarg_facet ((4,true),0.6191,951, + Iarg_leaf 1280)), + Iarg_facet ((3,true),0.5000,760, + Iarg_leaf 1793)), + Iarg_facet ((2,true),0.5000,1007, + Iarg_leaf 1258)), + Iarg_facet ((1,true),0.5000,877, + Iarg_leaf 1465)), + Iarg_facet ((5,true),0.5000,1148, + Iarg_facet ((1,true),0.5000,1143, + Iarg_facet ((2,true),0.5000,1160, + Iarg_leaf 1258)))), + Iarg_facet ((4,true),0.5000,1997, + Iarg_facet ((5,true),0.5000,1338, + Iarg_facet ((1,true),0.5000,1533, + Iarg_facet ((2,true),0.5000,1204, + Iarg_leaf 1560)))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1237, + Iarg_facet ((3,true),0.5000,917, + Iarg_facet ((4,true),0.6540,843, + Iarg_leaf 1295))), + Iarg_facet ((2,true),0.5000,952, + Iarg_facet ((3,true),0.5000,719, + Iarg_leaf 1808))), + Iarg_facet ((1,true),0.5000,1530, + Iarg_leaf 1750)), + Iarg_facet ((5,true),0.5000,1146, + Iarg_facet ((1,true),0.5000,1097, + Iarg_leaf 1382))), + Iarg_facet ((4,true),0.5000,1813, + Iarg_facet ((5,true),0.5000,1502, + Iarg_facet ((1,true),0.5000,1793, + Iarg_facet ((2,true),0.5000,846, + Iarg_leaf 1530))))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1938, + Iarg_facet ((5,true),0.5000,1290, + Iarg_facet ((1,true),0.5000,1141, + Iarg_leaf 1448))), + Iarg_facet ((4,true),0.6277,932, + Iarg_leaf 1625)))));; + +add_case ("QITNPEA 5653753305 split(1/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1908, + Iarg_facet ((5,true),0.5000,1456, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,861, + Iarg_facet ((2,true),0.6441,833, + Iarg_leaf 1295)), + Iarg_facet ((1,true),0.5000,707, + Iarg_leaf 1737)))), + Iarg_facet ((4,true),0.5000,1093, + Iarg_facet ((5,true),0.5000,820, + Iarg_facet ((0,false),0.5000,1393, + Iarg_leaf 1401)))), + Iarg_facet ((3,true),0.5000,1600, + Iarg_facet ((4,true),0.5000,758, + Iarg_facet ((5,true),0.6612,769, + Iarg_leaf 1118)))), + Iarg_facet ((2,true),0.5000,1638, + Iarg_facet ((3,true),0.5000,1614, + Iarg_facet ((4,true),0.5000,726, + Iarg_facet ((5,true),0.6494,850, + Iarg_leaf 1202))))), + Iarg_facet ((1,true),0.5000,1864, + Iarg_facet ((2,true),0.5000,1074, + Iarg_facet ((3,true),0.5000,1016, + Iarg_leaf 1740)))), + Iarg_facet ((5,true),0.5000,1681, + Iarg_facet ((1,true),0.5000,1765, + Iarg_facet ((2,true),0.5000,1320, + Iarg_facet ((3,true),0.5000,1010, + Iarg_leaf 1726))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1230, + Iarg_facet ((5,true),0.5000,926, + Iarg_facet ((0,true),0.5000,1407, + Iarg_leaf 1637))), + Iarg_facet ((4,true),0.5000,1589, + Iarg_facet ((5,true),0.5000,1167, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,797, + Iarg_facet ((2,true),0.6456,837, + Iarg_leaf 1649)), + Iarg_facet ((1,true),0.5000,740, + Iarg_facet ((2,true),0.6533,804, + Iarg_leaf 1312)))))), + Iarg_facet ((3,false),0.5000,1737, + Iarg_facet ((4,true),0.6411,900, + Iarg_leaf 1224))), + Iarg_facet ((2,true),0.5000,1580, + Iarg_facet ((3,false),0.5000,1733, + Iarg_facet ((4,true),0.6454,883, + Iarg_leaf 1243)))), + Iarg_facet ((1,true),0.5000,1493, + Iarg_facet ((2,true),0.5000,993, + Iarg_facet ((3,false),0.5000,984, + Iarg_leaf 1225)))), + Iarg_facet ((5,true),0.5000,1216, + Iarg_facet ((1,true),0.5000,1540, + Iarg_facet ((2,true),0.5000,1064, + Iarg_facet ((3,false),0.5000,1000, + Iarg_leaf 1220)))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1813, + Iarg_facet ((1,true),0.5000,1861, + Iarg_facet ((2,true),0.5000,1754, + Iarg_facet ((3,true),0.5000,921, + Iarg_leaf 1558)))), + Iarg_facet ((5,true),0.5000,922, + Iarg_facet ((1,true),0.5000,853, + Iarg_leaf 1710))), + Iarg_facet ((4,true),0.5000,1995, + Iarg_facet ((5,true),0.5000,1350, + Iarg_facet ((1,true),0.5000,1667, + Iarg_facet ((2,true),0.5000,1390, + Iarg_facet ((3,false),0.5000,904, + Iarg_leaf 1125))))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1020, + Iarg_facet ((3,true),0.5000,903, + Iarg_leaf 1569)), + Iarg_facet ((2,true),0.5000,778, + Iarg_leaf 1717)), + Iarg_facet ((1,true),0.5000,1080, + Iarg_leaf 1273)), + Iarg_facet ((5,true),0.5000,940, + Iarg_leaf 1874)), + Iarg_facet ((4,true),0.5000,1800, + Iarg_facet ((5,true),0.5000,1523, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,941, + Iarg_facet ((3,false),0.5000,909, + Iarg_leaf 1117)), + Iarg_facet ((2,true),0.5000,702, + Iarg_leaf 1351))))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1503, + Iarg_facet ((5,true),0.5000,1033, + Iarg_facet ((1,true),0.5000,940, + Iarg_leaf 1217))), + Iarg_facet ((4,true),0.6400,911, + Iarg_leaf 1592)))));; + +add_case ("OXLZLEZ 6346351218 4 7", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1940, + Iarg_facet ((2,true),0.5000,1313, + Iarg_facet ((4,true),0.5000,888, + Iarg_facet ((5,true),0.6356,861, + Iarg_leaf 1612)))), + Iarg_facet ((1,true),0.5000,1369, + Iarg_facet ((2,true),0.5000,946, + Iarg_facet ((4,true),0.6366,901, + Iarg_leaf 1759)))), + Iarg_facet ((3,true),0.5000,1330, + Iarg_facet ((1,true),0.5000,735, + Iarg_leaf 1328))), + Iarg_facet ((5,true),0.5000,1140, + Iarg_facet ((3,true),0.5000,1354, + Iarg_facet ((1,true),0.6212,884, + Iarg_leaf 1099)))), + Iarg_facet ((4,true),0.5000,1927, + Iarg_facet ((5,true),0.5000,1232, + Iarg_facet ((3,true),0.5000,1362, + Iarg_facet ((1,true),0.5000,708, + Iarg_leaf 1432))))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1712, + Iarg_facet ((5,true),0.5000,1415, + Iarg_facet ((3,true),0.5000,1359, + Iarg_facet ((2,true),0.5000,701, + Iarg_leaf 1414)))), + Iarg_facet ((4,true),0.5000,724, + Iarg_leaf 1751))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1789, + Iarg_facet ((4,true),0.5000,1369, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,787, + Iarg_leaf 1386), + Iarg_facet ((3,true),0.6238,917, + Iarg_leaf 1335)))), + Iarg_facet ((2,true),0.5000,944, + Iarg_facet ((4,true),0.6285,876, + Iarg_leaf 1854)))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6163,967, + Iarg_leaf 1862), + Iarg_facet ((5,true),0.6296,931, + Iarg_facet ((3,true),0.6916,836, + Iarg_leaf 1047))), + Iarg_facet ((4,false),0.5000,1343, + Iarg_leaf 1496)), + Iarg_facet ((2,true),0.5000,942, + Iarg_leaf 1785)), + Iarg_facet ((1,true),0.5000,1283, + Iarg_facet ((2,true),0.5000,753, + Iarg_leaf 1366)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1368, + Iarg_facet ((5,true),0.6012,833, + Iarg_facet ((3,true),0.5000,711, + Iarg_leaf 1337))), + Iarg_facet ((4,true),0.5000,1518, + Iarg_facet ((5,true),0.6408,860, + Iarg_facet ((3,true),0.6554,794, + Iarg_leaf 1162)))), + Iarg_facet ((2,true),0.5000,1411, + Iarg_leaf 1549)), + Iarg_facet ((1,true),0.5000,1255, + Iarg_facet ((2,true),0.5000,981, + Iarg_leaf 1030))), + Iarg_facet ((5,true),0.5000,1809, + Iarg_facet ((1,true),0.5000,1624, + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1036, + Iarg_leaf 1262), + Iarg_facet ((4,false),0.5000,1227, + Iarg_leaf 1725)))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1561, + Iarg_facet ((4,true),0.5000,1027, + Iarg_facet ((5,true),0.5000,1056, + Iarg_facet ((3,true),0.5000,839, + Iarg_leaf 1469)))), + Iarg_facet ((2,true),0.5000,1416, + Iarg_facet ((4,true),0.5000,925, + Iarg_facet ((5,true),0.5000,1224, + Iarg_facet ((3,true),0.5000,727, + Iarg_leaf 1856))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,791, + Iarg_facet ((4,true),0.6619,768, + Iarg_leaf 1350)), + Iarg_facet ((2,true),0.5000,826, + Iarg_facet ((4,true),0.7117,915, + Iarg_leaf 1766)))), + Iarg_facet ((5,true),0.5000,1791, + Iarg_facet ((1,true),0.5000,1583, + Iarg_leaf 1722))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1810, + Iarg_facet ((1,true),0.5000,1577, + Iarg_leaf 1858)), + Iarg_facet ((5,true),0.5000,854, + Iarg_leaf 1905)))));; + +add_case ("OXLZLEZ 6346351218 2 7", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1944, + Iarg_facet ((2,true),0.5000,1318, + Iarg_facet ((4,true),0.5000,888, + Iarg_facet ((5,true),0.6400,876, + Iarg_leaf 1597)))), + Iarg_facet ((1,true),0.5000,1370, + Iarg_facet ((2,true),0.5000,947, + Iarg_facet ((4,true),0.6416,901, + Iarg_leaf 1759)))), + Iarg_facet ((3,true),0.5000,1328, + Iarg_facet ((1,true),0.5000,739, + Iarg_leaf 1329))), + Iarg_facet ((5,true),0.5000,1140, + Iarg_facet ((3,true),0.5000,1352, + Iarg_facet ((1,true),0.6201,884, + Iarg_leaf 1110)))), + Iarg_facet ((4,true),0.5000,1925, + Iarg_facet ((5,true),0.5000,1232, + Iarg_facet ((3,true),0.5000,1363, + Iarg_facet ((1,true),0.5000,720, + Iarg_leaf 1434))))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1715, + Iarg_facet ((5,true),0.5000,1413, + Iarg_facet ((3,true),0.5000,1358, + Iarg_facet ((2,true),0.5000,702, + Iarg_leaf 1412)))), + Iarg_facet ((4,true),0.5000,725, + Iarg_leaf 1751))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1790, + Iarg_facet ((4,true),0.5000,1368, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,787, + Iarg_leaf 1384), + Iarg_facet ((3,true),0.6238,917, + Iarg_leaf 1335)))), + Iarg_facet ((2,true),0.5000,942, + Iarg_facet ((4,true),0.6270,876, + Iarg_leaf 1857)))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6160,967, + Iarg_leaf 1862), + Iarg_facet ((5,true),0.6170,908, + Iarg_facet ((3,true),0.6578,791, + Iarg_leaf 1154))), + Iarg_facet ((4,false),0.5000,1345, + Iarg_leaf 1494)), + Iarg_facet ((2,true),0.5000,940, + Iarg_leaf 1786)), + Iarg_facet ((1,true),0.5000,1285, + Iarg_facet ((2,true),0.5000,755, + Iarg_leaf 1368)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1369, + Iarg_facet ((5,true),0.6055,848, + Iarg_facet ((3,true),0.5000,709, + Iarg_leaf 1319))), + Iarg_facet ((4,true),0.5000,1519, + Iarg_facet ((5,true),0.6403,858, + Iarg_facet ((3,true),0.6554,796, + Iarg_leaf 1161)))), + Iarg_facet ((2,true),0.5000,1411, + Iarg_leaf 1540)), + Iarg_facet ((1,true),0.5000,1255, + Iarg_facet ((2,true),0.5000,982, + Iarg_leaf 1030))), + Iarg_facet ((5,true),0.5000,1811, + Iarg_facet ((1,true),0.5000,1624, + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1038, + Iarg_leaf 1260), + Iarg_facet ((4,false),0.5000,1228, + Iarg_leaf 1722)))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1559, + Iarg_facet ((4,true),0.5000,1028, + Iarg_facet ((5,true),0.5000,1056, + Iarg_facet ((3,true),0.5000,839, + Iarg_leaf 1469)))), + Iarg_facet ((2,true),0.5000,1416, + Iarg_facet ((4,true),0.5000,924, + Iarg_facet ((5,true),0.5000,1224, + Iarg_facet ((3,true),0.5000,730, + Iarg_leaf 1855))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,792, + Iarg_facet ((4,true),0.6617,769, + Iarg_leaf 1350)), + Iarg_facet ((2,true),0.5000,826, + Iarg_facet ((4,true),0.7605,1086, + Iarg_leaf 1947)))), + Iarg_facet ((5,true),0.5000,1791, + Iarg_facet ((1,true),0.5000,1588, + Iarg_leaf 1723))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1807, + Iarg_facet ((1,true),0.5000,1572, + Iarg_leaf 1860)), + Iarg_facet ((5,true),0.5000,854, + Iarg_leaf 1907)))));; + +add_case ("TEWNSCJ split(1/2)", + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1385, + Iarg_leaf 1983), + Iarg_facet ((1,true),0.5000,1263, + Iarg_facet ((2,false),0.5000,1092, + Iarg_leaf 1184))), + Iarg_facet ((3,true),0.5000,1073, + Iarg_leaf 1187)), + Iarg_facet ((5,true),0.5000,1675, + Iarg_facet ((3,false),0.5000,1600, + Iarg_leaf 1689))), + Iarg_facet ((4,true),0.6534,1041, + Iarg_facet ((5,true),0.5000,1426, + Iarg_facet ((3,false),0.5000,1227, + Iarg_leaf 1402)))), + Iarg_facet ((2,true),0.5000,1875, + Iarg_facet ((4,true),0.5000,1836, + Iarg_facet ((5,true),0.7230,713, + Iarg_leaf 1447)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1176, + Iarg_facet ((2,true),0.5000,1555, + Iarg_leaf 1756)), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1380, + Iarg_facet ((3,false),0.5000,1897, + Iarg_facet ((1,true),0.5000,1039, + Iarg_facet ((2,true),0.5000,1847, + Iarg_facet ((0,true),0.6602,1772, + Iarg_leaf 27))))), + Iarg_facet ((3,false),0.5000,1001, + Iarg_leaf 1133)), + Iarg_facet ((4,true),0.5000,1236, + Iarg_facet ((3,false),0.5000,1003, + Iarg_leaf 1135))), + Iarg_facet ((2,true),0.9993,525, + Iarg_leaf 634))), + Iarg_facet ((3,false),0.5000,992, + Iarg_leaf 1341)), + Iarg_facet ((5,true),0.5000,1385, + Iarg_facet ((3,false),0.5000,1736, + Iarg_facet ((1,true),0.9533,702, + Iarg_leaf 490)))), + Iarg_facet ((4,true),0.6618,1132, + Iarg_facet ((5,true),0.5000,1143, + Iarg_facet ((3,false),0.5000,1485, + Iarg_leaf 1850)))), + Iarg_facet ((2,true),0.5000,1616, + Iarg_facet ((4,true),0.5000,1583, + Iarg_facet ((5,true),0.7236,772, + Iarg_facet ((3,false),0.5000,772, + Iarg_leaf 1526)))))));; + +add_case ("TEWNSCJ split(1/2)", + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1381, + Iarg_leaf 1987), + Iarg_facet ((1,true),0.5000,1262, + Iarg_facet ((2,false),0.5000,1094, + Iarg_leaf 1189))), + Iarg_facet ((3,true),0.5000,1071, + Iarg_leaf 1175)), + Iarg_facet ((5,true),0.5000,1655, + Iarg_facet ((3,false),0.5000,1575, + Iarg_leaf 1667))), + Iarg_facet ((4,true),0.6520,1012, + Iarg_facet ((5,true),0.5000,1398, + Iarg_facet ((3,false),0.5000,1218, + Iarg_leaf 1382)))), + Iarg_facet ((2,true),0.5000,1893, + Iarg_facet ((4,true),0.5000,1868, + Iarg_facet ((5,true),0.7228,716, + Iarg_leaf 1456)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1182, + Iarg_facet ((2,true),0.5000,1569, + Iarg_leaf 1774)), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1380, + Iarg_facet ((3,false),0.5000,1895, + Iarg_facet ((1,true),0.5000,1037, + Iarg_facet ((2,true),0.5000,1868, + Iarg_facet ((0,true),0.5037,1888, + Iarg_leaf 471))))), + Iarg_facet ((3,false),0.5000,999, + Iarg_leaf 1131)), + Iarg_facet ((4,true),0.5000,1235, + Iarg_facet ((3,false),0.5000,1004, + Iarg_leaf 1138))), + Iarg_facet ((2,true),0.9998,525, + Iarg_leaf 636))), + Iarg_facet ((3,false),0.5000,993, + Iarg_leaf 1343)), + Iarg_facet ((5,true),0.5000,1394, + Iarg_facet ((3,false),0.5000,1737, + Iarg_facet ((1,true),0.9995,742, + Iarg_leaf 452)))), + Iarg_facet ((4,true),0.6622,1129, + Iarg_facet ((5,true),0.5000,1165, + Iarg_facet ((3,false),0.5000,1485, + Iarg_leaf 1965)))), + Iarg_facet ((2,true),0.5000,1618, + Iarg_facet ((4,true),0.5000,1584, + Iarg_facet ((5,true),0.7236,771, + Iarg_facet ((3,false),0.5000,773, + Iarg_leaf 1528)))))));; + +add_case ("4840774900", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1819, + Iarg_facet ((4,true),0.5000,903, + Iarg_facet ((5,true),0.6263,1011, + Iarg_leaf 1742))), + Iarg_facet ((2,true),0.5000,827, + Iarg_leaf 1828)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1492, + Iarg_facet ((4,true),0.5000,938, + Iarg_facet ((5,true),0.6377,1014, + Iarg_leaf 1474))), + Iarg_facet ((2,true),0.5000,741, + Iarg_leaf 1506))), + Iarg_facet ((0,false),0.5000,1869, + Iarg_facet ((1,true),0.5000,948, + Iarg_leaf 1416))), + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1861, + Iarg_facet ((1,true),0.5000,801, + Iarg_leaf 1553)), + Iarg_facet ((0,true),0.5000,1156, + Iarg_leaf 1227))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1931, + Iarg_facet ((1,true),0.5000,873, + Iarg_leaf 1337)), + Iarg_facet ((0,true),0.5000,889, + Iarg_leaf 1153)), + Iarg_facet ((5,true),0.5000,1608, + Iarg_facet ((0,true),0.5000,1378, + Iarg_leaf 1639)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1924, + Iarg_facet ((2,true),0.5000,860, + Iarg_leaf 1338)), + Iarg_facet ((0,true),0.5000,1369, + Iarg_leaf 1646)), + Iarg_facet ((5,true),0.5000,1546, + Iarg_facet ((0,true),0.5000,894, + Iarg_leaf 1154))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1668, + Iarg_facet ((0,true),0.5000,749, + Iarg_leaf 1268)), + Iarg_facet ((5,true),0.5000,911, + Iarg_leaf 1708)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1613, + Iarg_bisect (0, + Iarg_facet ((3,false),0.6601,939, + Iarg_leaf 1488), + Iarg_facet ((3,false),0.6163,1122, + Iarg_facet ((1,true),0.6382,924, + Iarg_leaf 1839)))), + Iarg_facet ((5,true),0.5000,725, + Iarg_leaf 1621)), + Iarg_facet ((4,true),0.5000,966, + Iarg_leaf 1673)), + Iarg_facet ((2,true),0.5000,1154, + Iarg_facet ((4,true),0.5000,886, + Iarg_leaf 1770))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1108, + Iarg_facet ((4,true),0.5000,847, + Iarg_leaf 1417)), + Iarg_facet ((2,true),0.5000,719, + Iarg_leaf 1447))), + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1830, + Iarg_facet ((2,true),0.5000,1427, + Iarg_facet ((5,true),0.5000,844, + Iarg_leaf 1409))), + Iarg_facet ((1,true),0.5000,1154, + Iarg_leaf 1912))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1953, + Iarg_facet ((1,true),0.5000,1203, + Iarg_facet ((4,true),0.5000,913, + Iarg_leaf 1139))), + Iarg_facet ((5,true),0.5000,1569, + Iarg_facet ((1,true),0.5000,985, + Iarg_leaf 1741)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((2,true),0.5000,1223, + Iarg_facet ((4,true),0.5000,828, + Iarg_leaf 1252)), + Iarg_facet ((2,true),0.5000,959, + Iarg_leaf 1751)), + Iarg_facet ((5,true),0.5000,1531, + Iarg_leaf 1970)), + Iarg_facet ((4,true),0.5000,1790, + Iarg_facet ((5,true),0.5000,1049, + Iarg_leaf 1311))))));; + +add_case ("QITNPEA 5400790175 b split(2/4)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1369, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1884, + Iarg_facet ((5,true),0.6990,721, + Iarg_leaf 1875)), + Iarg_facet ((4,true),0.5000,784, + Iarg_leaf 1888))), + Iarg_facet ((1,true),0.5000,1706, + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1976, + Iarg_facet ((5,true),0.9669,880, + Iarg_leaf 176)), + Iarg_bisect (4, + Iarg_facet ((5,true),0.9173,783, + Iarg_leaf 205), + Iarg_facet ((5,true),0.9991,649, + Iarg_leaf 143))))), + Iarg_facet ((0,false),0.5000,1475, + Iarg_leaf 1598)), + Iarg_facet ((5,true),0.5000,1394, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6644,836, + Iarg_leaf 1412), + Iarg_facet ((1,true),0.5574,814, + Iarg_bisect (2, + Iarg_facet ((5,true),0.7955,749, + Iarg_leaf 1205), + Iarg_facet ((5,true),0.9499,703, + Iarg_leaf 96)))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1359, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6561,855, + Iarg_leaf 1433), + Iarg_facet ((1,true),0.5000,754, + Iarg_bisect (4, + Iarg_facet ((5,true),0.8616,761, + Iarg_leaf 486), + Iarg_facet ((5,true),0.9589,834, + Iarg_leaf 120))))), + Iarg_facet ((5,true),0.6459,746, + Iarg_facet ((0,false),0.5000,1074, + Iarg_leaf 1289)))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1643, + Iarg_facet ((5,true),0.5000,811, + Iarg_facet ((0,false),0.5000,1430, + Iarg_leaf 1465))), + Iarg_facet ((4,true),0.5000,909, + Iarg_leaf 1743))), + Iarg_facet ((1,true),0.6930,1224, + Iarg_facet ((2,true),0.5000,812, + Iarg_leaf 1363))), + Iarg_facet ((5,true),0.5000,1858, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,752, + Iarg_facet ((0,false),0.5000,1403, + Iarg_facet ((1,true),0.7582,1178, + Iarg_facet ((2,true),0.6349,1278, + Iarg_leaf 1593)))), + Iarg_facet ((5,true),0.6678,764, + Iarg_leaf 1937)), + Iarg_bisect (4, + Iarg_facet ((5,true),0.6861,708, + Iarg_leaf 1925), + Iarg_facet ((5,true),0.8297,710, + Iarg_leaf 1268))), + Iarg_facet ((2,true),0.5000,1355, + Iarg_leaf 1809)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1790, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,735, + Iarg_facet ((0,false),0.5000,1454, + Iarg_facet ((1,true),0.6942,862, + Iarg_leaf 1551))), + Iarg_facet ((5,true),0.7354,738, + Iarg_facet ((0,false),0.6785,1016, + Iarg_leaf 1344))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.7224,807, + Iarg_leaf 1943), + Iarg_facet ((5,true),0.9097,866, + Iarg_leaf 621))), + Iarg_facet ((2,true),0.5000,1443, + Iarg_leaf 1749))), + Iarg_facet ((5,true),0.5000,1220, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1300, + Iarg_facet ((5,true),0.8737,708, + Iarg_leaf 1236)), + Iarg_facet ((4,true),0.5000,755, + Iarg_leaf 1317)), + Iarg_facet ((2,true),0.5000,948, + Iarg_leaf 1174))))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1843, + Iarg_facet ((5,true),0.8141,752, + Iarg_facet ((1,true),0.6692,740, + Iarg_leaf 1149))), + Iarg_facet ((4,true),0.5000,1277, + Iarg_leaf 1899))));; + +add_case ("GLFVCVK4 2477216213 y4supercrit split(1/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,false),0.7362,1172, + Iarg_facet ((1,true),0.5000,928, + Iarg_facet ((2,true),0.6202,937, + Iarg_leaf 1461))), + Iarg_facet ((0,false),0.6797,1126, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1387, + Iarg_facet ((4,true),0.5000,972, + Iarg_facet ((5,true),0.5000,954, + Iarg_leaf 1897))), + Iarg_facet ((2,true),0.6451,903, + Iarg_leaf 1331)))), + Iarg_facet ((3,false),0.5000,1883, + Iarg_facet ((0,false),0.5000,908, + Iarg_facet ((1,true),0.6426,874, + Iarg_leaf 1294)))), + Iarg_facet ((5,true),0.5000,1403, + Iarg_facet ((3,false),0.5000,1077, + Iarg_leaf 1690))), + Iarg_facet ((4,true),0.5000,1281, + Iarg_facet ((5,true),0.5000,1310, + Iarg_facet ((3,false),0.5000,1094, + Iarg_leaf 1726)))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1492, + Iarg_facet ((5,true),0.5000,1395, + Iarg_facet ((3,false),0.5000,1703, + Iarg_facet ((0,false),0.5000,827, + Iarg_leaf 1818)))), + Iarg_facet ((4,true),0.6559,865, + Iarg_leaf 1344))), + Iarg_facet ((1,true),0.5000,1548, + Iarg_facet ((2,true),0.5000,1104, + Iarg_facet ((4,true),0.5000,885, + Iarg_facet ((5,true),0.5000,795, + Iarg_leaf 1968))))), + Iarg_facet ((5,true),0.5000,1748, + Iarg_facet ((1,true),0.5000,1527, + Iarg_facet ((2,true),0.5000,941, + Iarg_facet ((4,true),0.5000,784, + Iarg_leaf 1552))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1906, + Iarg_facet ((1,true),0.5000,1679, + Iarg_facet ((2,true),0.5000,1123, + Iarg_facet ((4,true),0.6518,853, + Iarg_leaf 1219)))), + Iarg_facet ((5,true),0.5000,714, + Iarg_leaf 1854))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1621, + Iarg_facet ((1,true),0.5000,1842, + Iarg_facet ((2,true),0.5000,961, + Iarg_facet ((4,true),0.7589,1265, + Iarg_leaf 1453)))), + Iarg_facet ((5,true),0.6130,994, + Iarg_leaf 1529)), + Iarg_facet ((4,true),0.5000,982, + Iarg_facet ((5,true),0.5000,762, + Iarg_leaf 1886)))));; + +add_case ("7550003505 0 4 4", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.9743,1295, + Iarg_leaf 6), + Iarg_bisect (5, + Iarg_facet ((4,true),0.6463,919, + Iarg_facet ((3,false),0.6166,934, + Iarg_leaf 1335)), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,887, + Iarg_facet ((1,true),0.7947,802, + Iarg_facet ((2,true),0.7494,747, + Iarg_leaf 1330))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,849, + Iarg_facet ((3,false),0.5000,1814, + Iarg_leaf 1972)), + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,1088, + Iarg_leaf 1202), + Iarg_facet ((3,false),0.5000,903, + Iarg_leaf 1199))), + Iarg_facet ((4,false),0.6902,1152, + Iarg_leaf 1437)), + Iarg_facet ((2,true),0.7196,1038, + Iarg_leaf 1232)), + Iarg_facet ((1,true),0.7933,1008, + Iarg_facet ((2,true),0.8541,886, + Iarg_leaf 1307)))), + Iarg_facet ((3,false),0.6834,751, + Iarg_leaf 1470)), + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,1152, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6559,1010, + Iarg_facet ((2,false),0.5502,891, + Iarg_leaf 1743)), + Iarg_facet ((1,true),0.7188,940, + Iarg_facet ((2,true),0.5000,1299, + Iarg_leaf 1976)))), + Iarg_facet ((3,false),0.5000,709, + Iarg_facet ((0,false),0.5381,812, + Iarg_facet ((1,true),0.5000,1320, + Iarg_facet ((2,true),0.5000,1194, + Iarg_facet ((3,false),0.5000,917, + Iarg_leaf 1305))))))))), + Iarg_facet ((4,false),0.5210,1126, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,986, + Iarg_facet ((5,false),0.8285,851, + Iarg_facet ((4,true),0.6857,1101, + Iarg_leaf 1189))), + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((5,true),0.5000,1585, + Iarg_facet ((4,true),0.5000,1177, + Iarg_leaf 1866)), + Iarg_facet ((5,true),0.5000,1122, + Iarg_facet ((4,true),0.5000,735, + Iarg_leaf 1040))), + Iarg_bisect (3, + Iarg_facet ((5,true),0.5000,1073, + Iarg_leaf 1733), + Iarg_facet ((5,true),0.5000,1138, + Iarg_facet ((4,false),0.6849,1132, + Iarg_leaf 1298)))), + Iarg_facet ((2,true),0.5000,1448, + Iarg_facet ((3,false),0.5000,1365, + Iarg_leaf 1654))), + Iarg_facet ((1,true),0.6751,820, + Iarg_facet ((2,true),0.6220,847, + Iarg_facet ((3,true),0.5000,859, + Iarg_facet ((5,false),0.6962,986, + Iarg_leaf 818))))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1511, + Iarg_facet ((2,false),0.5000,772, + Iarg_facet ((3,false),0.5000,1986, + Iarg_facet ((5,true),0.5000,1188, + Iarg_leaf 1540)))), + Iarg_facet ((1,true),0.6815,855, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1214, + Iarg_leaf 1360), + Iarg_facet ((3,false),0.5000,1144, + Iarg_leaf 1704))))), + Iarg_bisect (4, + Iarg_facet ((0,false),0.5000,1602, + Iarg_leaf 1991), + Iarg_bisect (0, + Iarg_facet ((1,false),0.6580,1080, + Iarg_leaf 1075), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1521, + Iarg_leaf 1538), + Iarg_facet ((3,false),0.5000,1214, + Iarg_leaf 1660)), + Iarg_facet ((2,true),0.5000,1725, + Iarg_facet ((3,false),0.5000,922, + Iarg_leaf 1337)))))), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_facet ((0,true),0.5000,720, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,776, + Iarg_facet ((5,true),0.5000,1170, + Iarg_leaf 1872)), + Iarg_facet ((2,false),0.5000,1746, + Iarg_facet ((5,false),0.6914,1183, + Iarg_leaf 1338)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.8104,975, + Iarg_leaf 1812), + Iarg_facet ((2,false),0.7211,750, + Iarg_leaf 1304)), + Iarg_facet ((1,true),0.7477,1205, + Iarg_leaf 1189))), + Iarg_bisect (4, + Iarg_facet ((0,true),0.5000,726, + Iarg_leaf 1317), + Iarg_bisect (0, + Iarg_facet ((1,false),0.6502,1020, + Iarg_leaf 1868), + Iarg_bisect (1, + Iarg_facet ((2,false),0.6047,829, + Iarg_leaf 1677), + Iarg_facet ((2,false),0.5000,1694, + Iarg_facet ((3,false),0.5000,1472, + Iarg_facet ((5,true),0.5000,922, + Iarg_leaf 1290))))))))))));; + +add_case ("OXLZLEZ 6346351218 3 45", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1584, + Iarg_facet ((4,true),0.5000,1063, + Iarg_facet ((5,true),0.5000,760, + Iarg_facet ((3,true),0.5000,1043, + Iarg_leaf 1985)))), + Iarg_facet ((2,true),0.5000,758, + Iarg_leaf 1582)), + Iarg_facet ((1,true),0.5000,1713, + Iarg_facet ((2,true),0.5000,1222, + Iarg_facet ((4,true),0.5000,854, + Iarg_facet ((5,true),0.6366,1033, + Iarg_facet ((3,false),0.5000,808, + Iarg_leaf 1862)))))), + Iarg_facet ((3,true),0.5000,1591, + Iarg_facet ((1,true),0.5000,892, + Iarg_leaf 1582))), + Iarg_facet ((5,true),0.5000,1315, + Iarg_facet ((3,true),0.5000,1602, + Iarg_facet ((1,true),0.5000,813, + Iarg_leaf 1709)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1448, + Iarg_facet ((3,true),0.5000,1610, + Iarg_facet ((1,true),0.5000,836, + Iarg_leaf 1701))), + Iarg_facet ((5,true),0.6907,897, + Iarg_leaf 1202))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1978, + Iarg_facet ((5,true),0.5000,1654, + Iarg_facet ((3,true),0.5000,1620, + Iarg_facet ((2,true),0.5000,835, + Iarg_leaf 1695)))), + Iarg_facet ((4,true),0.5000,767, + Iarg_facet ((5,true),0.7036,904, + Iarg_leaf 965)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1841, + Iarg_facet ((4,true),0.5000,1437, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,924, + Iarg_leaf 1651), + Iarg_facet ((3,true),0.5000,747, + Iarg_leaf 1764)))), + Iarg_facet ((2,true),0.5000,953, + Iarg_facet ((4,true),0.6387,1004, + Iarg_leaf 1999)))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,737, + Iarg_facet ((3,true),0.5000,980, + Iarg_leaf 1685)), + Iarg_facet ((5,true),0.6334,968, + Iarg_facet ((3,true),0.6340,861, + Iarg_leaf 1220))), + Iarg_facet ((4,false),0.5000,1465, + Iarg_leaf 1533)), + Iarg_facet ((2,true),0.5000,948, + Iarg_leaf 1831)), + Iarg_facet ((1,true),0.5000,1173, + Iarg_leaf 1913))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1511, + Iarg_facet ((5,true),0.5000,751, + Iarg_facet ((3,true),0.5000,1013, + Iarg_leaf 1717))), + Iarg_facet ((4,true),0.5000,1575, + Iarg_facet ((5,true),0.6459,862, + Iarg_facet ((3,true),0.6215,849, + Iarg_leaf 1279)))), + Iarg_facet ((2,true),0.5000,1383, + Iarg_leaf 1592)), + Iarg_facet ((1,true),0.5000,1155, + Iarg_leaf 1858)), + Iarg_facet ((5,true),0.5000,1711, + Iarg_facet ((1,true),0.5000,1530, + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1042, + Iarg_leaf 1210), + Iarg_facet ((4,false),0.5000,1235, + Iarg_leaf 1543)))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1597, + Iarg_facet ((4,true),0.5000,1110, + Iarg_facet ((5,true),0.5000,1157, + Iarg_facet ((3,true),0.5000,999, + Iarg_leaf 1723)))), + Iarg_facet ((2,true),0.5000,1389, + Iarg_facet ((4,true),0.5000,886, + Iarg_facet ((5,true),0.5000,1274, + Iarg_facet ((3,true),0.5000,818, + Iarg_leaf 1874))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,778, + Iarg_facet ((4,true),0.6684,736, + Iarg_leaf 1410)), + Iarg_facet ((2,true),0.5000,735, + Iarg_facet ((4,true),0.6715,774, + Iarg_leaf 1922)))), + Iarg_facet ((5,true),0.5000,1679, + Iarg_facet ((1,true),0.5000,1413, + Iarg_leaf 1640))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1708, + Iarg_facet ((1,true),0.5000,1442, + Iarg_leaf 1713)), + Iarg_facet ((5,true),0.5000,820, + Iarg_leaf 1789)))));; + +add_case ("7550003505 3 3 3", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1645, + Iarg_facet ((5,false),0.5000,1538, + Iarg_facet ((0,true),0.5000,1679, + Iarg_facet ((1,true),0.8311,1043, + Iarg_leaf 1072)))), + Iarg_facet ((4,false),0.5637,949, + Iarg_facet ((5,false),0.5612,770, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1262, + Iarg_facet ((2,true),0.5000,1291, + Iarg_facet ((3,true),0.5000,1826, + Iarg_facet ((5,true),0.5000,1018, + Iarg_leaf 1404)))), + Iarg_facet ((1,true),0.7266,953, + Iarg_leaf 1294))))), + Iarg_facet ((5,true),0.9984,1319, + Iarg_leaf 1717)), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,742, + Iarg_facet ((0,true),0.5000,1379, + Iarg_facet ((1,true),0.8576,994, + Iarg_leaf 988))), + Iarg_facet ((5,false),0.5715,822, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1277, + Iarg_facet ((2,true),0.5000,1741, + Iarg_facet ((4,true),0.5000,1437, + Iarg_facet ((3,true),0.5000,1490, + Iarg_leaf 1599)))), + Iarg_facet ((1,true),0.7185,1105, + Iarg_facet ((2,true),0.5000,1172, + Iarg_leaf 1791))))), + Iarg_facet ((3,false),0.6337,1165, + Iarg_leaf 1980)), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1646, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1479, + Iarg_leaf 1675), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1863, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1818, + Iarg_facet ((5,true),0.6849,713, + Iarg_leaf 1383)), + Iarg_facet ((4,false),0.5000,887, + Iarg_leaf 1117))), + Iarg_facet ((1,true),0.5000,1702, + Iarg_facet ((2,true),0.5000,1632, + Iarg_facet ((4,false),0.5000,1716, + Iarg_facet ((5,false),0.5000,1242, + Iarg_leaf 1403))))))), + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,965, + Iarg_bisect (0, + Iarg_facet ((1,true),0.7635,1018, + Iarg_leaf 857), + Iarg_facet ((1,true),0.5000,760, + Iarg_facet ((2,true),0.5000,1339, + Iarg_leaf 1979)))), + Iarg_facet ((3,false),0.7110,1111, + Iarg_leaf 1822))))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1784, + Iarg_facet ((3,true),0.9202,1099, + Iarg_leaf 793)), + Iarg_bisect (5, + Iarg_facet ((4,true),0.5000,1012, + Iarg_facet ((3,true),0.9982,1409, + Iarg_leaf 1565)), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1194, + Iarg_facet ((4,true),0.5000,1355, + Iarg_leaf 1780)), + Iarg_facet ((3,true),0.5000,1363, + Iarg_leaf 1885)), + Iarg_facet ((2,true),0.5000,1454, + Iarg_facet ((3,true),0.5000,1301, + Iarg_leaf 1576))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1715, + Iarg_facet ((3,true),0.5000,1097, + Iarg_facet ((4,false),0.5000,1028, + Iarg_leaf 1778))), + Iarg_facet ((2,true),0.5000,1419, + Iarg_leaf 1530))), + Iarg_facet ((0,false),0.5000,908, + Iarg_leaf 1712)), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1228, + Iarg_facet ((2,false),0.6995,809, + Iarg_leaf 1198)), + Iarg_facet ((1,true),0.5000,1842, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,722, + Iarg_leaf 1315), + Iarg_facet ((3,true),0.5000,1158, + Iarg_leaf 1330)))), + Iarg_facet ((0,false),0.5000,1236, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1042, + Iarg_leaf 1344), + Iarg_facet ((2,true),0.5000,941, + Iarg_leaf 1158))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1333, + Iarg_leaf 1948), + Iarg_facet ((5,false),0.5000,1282, + Iarg_facet ((0,false),0.5000,1102, + Iarg_facet ((1,false),0.5000,999, + Iarg_leaf 1555)))))))));; + +add_case ("9692636487", + Iarg_bisect (3, + Iarg_bisect (3, + Iarg_facet ((0,false),0.8633,1076, + Iarg_facet ((1,true),0.7389,1217, + Iarg_facet ((2,true),0.7397,1194, + Iarg_leaf 1738))), + Iarg_facet ((0,false),0.5000,1242, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1633, + Iarg_bisect (1, + Iarg_facet ((2,false),0.6908,794, + Iarg_leaf 1360), + Iarg_facet ((2,false),0.5000,1722, + Iarg_facet ((0,false),0.8057,799, + Iarg_leaf 1942)))), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,724, + Iarg_facet ((0,false),0.8172,999, + Iarg_facet ((2,true),0.5000,751, + Iarg_leaf 1930))), + Iarg_bisect (1, + Iarg_facet ((0,false),0.5000,760, + Iarg_facet ((2,false),0.6372,1260, + Iarg_facet ((3,true),0.5000,1019, + Iarg_leaf 1945))), + Iarg_facet ((0,false),0.6979,1138, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,969, + Iarg_facet ((1,false),0.5000,1093, + Iarg_leaf 1270)), + Iarg_facet ((3,false),0.5941,901, + Iarg_facet ((1,true),0.5000,1436, + Iarg_leaf 1532))))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((2,true),0.5000,736, + Iarg_facet ((0,false),0.8128,994, + Iarg_facet ((1,true),0.5000,759, + Iarg_leaf 1936))), + Iarg_bisect (2, + Iarg_facet ((0,false),0.5000,767, + Iarg_facet ((1,false),0.6022,1050, + Iarg_facet ((3,true),0.5000,1031, + Iarg_facet ((2,false),0.5000,1000, + Iarg_leaf 1081)))), + Iarg_facet ((0,false),0.7032,1189, + Iarg_bisect (1, + Iarg_facet ((3,true),0.5000,950, + Iarg_facet ((1,false),0.5000,1087, + Iarg_leaf 1283)), + Iarg_facet ((3,false),0.5975,910, + Iarg_facet ((2,true),0.5000,1437, + Iarg_leaf 1534)))))), + Iarg_facet ((3,false),0.8271,1142, + Iarg_facet ((0,false),0.8509,775, + Iarg_facet ((1,true),0.6986,1164, + Iarg_leaf 1590))))))), + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,924, + Iarg_leaf 1449), + Iarg_facet ((2,true),0.5000,865, + Iarg_leaf 1453)), + Iarg_bisect (1, + Iarg_facet ((2,false),0.7228,754, + Iarg_facet ((3,true),0.7151,824, + Iarg_facet ((1,false),0.6467,732, + Iarg_facet ((0,false),0.7167,786, + Iarg_leaf 1834)))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.6996,841, + Iarg_facet ((2,false),0.6787,960, + Iarg_facet ((0,false),0.6952,944, + Iarg_facet ((1,false),0.8774,1000, + Iarg_leaf 1009)))), + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1146, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.7098,975, + Iarg_facet ((1,false),0.6695,969, + Iarg_leaf 1164)), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1804, + Iarg_facet ((0,false),0.7448,851, + Iarg_facet ((2,false),0.5000,1035, + Iarg_leaf 1390))), + Iarg_facet ((1,false),0.5000,1216, + Iarg_facet ((0,false),0.6403,1060, + Iarg_facet ((2,false),0.6513,1158, + Iarg_facet ((3,true),0.5000,875, + Iarg_leaf 1217)))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((2,true),0.5000,1808, + Iarg_facet ((0,false),0.7141,840, + Iarg_facet ((1,false),0.5000,1061, + Iarg_leaf 1446))), + Iarg_facet ((2,false),0.5000,1223, + Iarg_facet ((0,false),0.6400,1065, + Iarg_facet ((1,false),0.6516,1156, + Iarg_facet ((3,true),0.5000,875, + Iarg_leaf 1218))))), + Iarg_facet ((3,false),0.5956,716, + Iarg_facet ((0,false),0.7027,1043, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.6669,816, + Iarg_leaf 1090), + Iarg_facet ((3,false),0.6732,926, + Iarg_leaf 1350)), + Iarg_facet ((2,true),0.7222,1125, + Iarg_leaf 1869))))))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,728, + Iarg_leaf 1451), + Iarg_facet ((1,false),0.5965,985, + Iarg_facet ((2,false),0.5648,756, + Iarg_facet ((3,true),0.5000,706, + Iarg_facet ((0,false),0.5000,1298, + Iarg_bisect (2, + Iarg_facet ((1,false),0.7148,847, + Iarg_leaf 1798), + Iarg_bisect (1, + Iarg_facet ((3,true),0.7177,942, + Iarg_leaf 1768), + Iarg_bisect (3, + Iarg_facet ((0,false),0.8177,928, + Iarg_leaf 1715), + Iarg_facet ((0,false),0.5000,836, + Iarg_facet ((2,false),0.6975,904, + Iarg_leaf 1233)))))))))))))), + Iarg_facet ((0,true),0.6595,1040, + Iarg_leaf 1484))));; + +add_case ("7550003505 2 3 4", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,1144, + Iarg_facet ((4,false),0.8742,1233, + Iarg_leaf 1284)), + Iarg_facet ((5,true),0.6788,946, + Iarg_leaf 1611)), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_facet ((0,true),0.8002,720, + Iarg_facet ((1,true),0.7492,907, + Iarg_leaf 1775)), + Iarg_facet ((0,true),0.5000,1633, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1660, + Iarg_bisect (4, + Iarg_facet ((3,true),0.5000,1404, + Iarg_leaf 1627), + Iarg_facet ((3,true),0.5000,1156, + Iarg_leaf 1448))), + Iarg_facet ((2,true),0.6266,1231, + Iarg_facet ((4,true),0.5000,1219, + Iarg_leaf 1446))))), + Iarg_facet ((5,false),0.5000,1956, + Iarg_facet ((0,true),0.5000,1152, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1641, + Iarg_facet ((4,true),0.5000,1607, + Iarg_leaf 1734)), + Iarg_facet ((2,true),0.5000,896, + Iarg_facet ((4,true),0.5000,990, + Iarg_leaf 1177)))))), + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,1100, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,906, + Iarg_facet ((2,false),0.6255,1101, + Iarg_leaf 1230)), + Iarg_facet ((1,true),0.7125,837, + Iarg_leaf 1739))), + Iarg_facet ((5,false),0.5000,710, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1014, + Iarg_leaf 1966), + Iarg_facet ((1,true),0.7110,752, + Iarg_leaf 1386))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1374, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,764, + Iarg_leaf 1578), + Iarg_facet ((5,true),0.5000,779, + Iarg_leaf 1280))), + Iarg_facet ((2,true),0.5000,834, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,963, + Iarg_leaf 1170), + Iarg_facet ((5,true),0.5000,990, + Iarg_leaf 1134)))), + Iarg_facet ((1,true),0.5000,1182, + Iarg_facet ((2,true),0.9030,968, + Iarg_leaf 412))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1562, + Iarg_facet ((4,true),0.5000,1678, + Iarg_leaf 1717)), + Iarg_facet ((2,true),0.5000,1042, + Iarg_facet ((4,true),0.5000,1921, + Iarg_facet ((5,false),0.5000,1001, + Iarg_leaf 1043)))), + Iarg_facet ((1,true),0.5000,1122, + Iarg_leaf 1737))), + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,false),0.7223,871, + Iarg_leaf 1645), + Iarg_facet ((1,false),0.5000,1046, + Iarg_leaf 1109)), + Iarg_bisect (0, + Iarg_facet ((1,false),0.7534,1291, + Iarg_leaf 1227), + Iarg_facet ((1,false),0.5000,954, + Iarg_leaf 1260)))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1247, + Iarg_facet ((2,false),0.6468,1095, + Iarg_leaf 1309)), + Iarg_facet ((1,true),0.5000,1568, + Iarg_facet ((2,true),0.5000,1443, + Iarg_facet ((5,true),0.5000,1072, + Iarg_leaf 1098)))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1574, + Iarg_facet ((2,false),0.6478,969, + Iarg_leaf 1234)), + Iarg_facet ((1,true),0.5000,1521, + Iarg_facet ((2,false),0.5000,1631, + Iarg_leaf 1691)))), + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1184, + Iarg_facet ((1,true),0.5000,1698, + Iarg_facet ((2,false),0.5000,1058, + Iarg_leaf 1097))), + Iarg_facet ((0,false),0.5000,1232, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,918, + Iarg_leaf 1176), + Iarg_facet ((2,true),0.5000,838, + Iarg_leaf 1183)))))))), + Iarg_facet ((4,false),0.5779,878, + Iarg_bisect (5, + Iarg_facet ((3,true),0.7444,737, + Iarg_facet ((5,false),0.6847,954, + Iarg_leaf 1807)), + Iarg_facet ((3,true),0.6546,945, + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_facet ((0,true),0.6224,770, + Iarg_leaf 1889), + Iarg_facet ((0,false),0.5000,1253, + Iarg_leaf 1493)), + Iarg_facet ((4,false),0.5000,1659, + Iarg_leaf 1779)))))));; + +add_case ("QITNPEA 3848804089 split(1/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1875, + Iarg_facet ((1,true),0.5000,1251, + Iarg_facet ((2,true),0.5000,852, + Iarg_leaf 1751))), + Iarg_facet ((0,true),0.5000,869, + Iarg_leaf 1357)), + Iarg_facet ((5,true),0.5000,809, + Iarg_facet ((0,true),0.5000,891, + Iarg_leaf 1384))), + Iarg_facet ((4,true),0.5000,775, + Iarg_leaf 1716)), + Iarg_facet ((3,true),0.5000,1233, + Iarg_facet ((4,true),0.5000,1404, + Iarg_facet ((5,true),0.5000,965, + Iarg_facet ((0,true),0.5000,904, + Iarg_leaf 1412))))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1255, + Iarg_facet ((4,true),0.5000,1320, + Iarg_facet ((5,true),0.5000,1058, + Iarg_facet ((0,true),0.5000,906, + Iarg_leaf 1404)))), + Iarg_facet ((3,true),0.6263,909, + Iarg_leaf 1376))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1886, + Iarg_facet ((3,true),0.5000,1025, + Iarg_facet ((4,true),0.5000,837, + Iarg_facet ((5,false),0.5000,1600, + Iarg_leaf 1628)))), + Iarg_facet ((2,true),0.5000,956, + Iarg_facet ((3,true),0.6556,854, + Iarg_leaf 1588)))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1023, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6741,774, + Iarg_leaf 1252), + Iarg_facet ((5,true),0.8493,1149, + Iarg_leaf 805))), + Iarg_facet ((3,true),0.6444,879, + Iarg_leaf 1570)), + Iarg_facet ((2,true),0.5000,1027, + Iarg_leaf 1928)), + Iarg_facet ((1,true),0.5000,977, + Iarg_leaf 1586))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1679, + Iarg_facet ((3,true),0.5000,1231, + Iarg_leaf 1678)), + Iarg_facet ((2,true),0.5000,1059, + Iarg_leaf 1665)), + Iarg_facet ((1,true),0.5000,1209, + Iarg_facet ((2,true),0.5000,780, + Iarg_leaf 1330))), + Iarg_facet ((5,true),0.5000,1092, + Iarg_facet ((1,true),0.5000,1278, + Iarg_facet ((2,true),0.5000,864, + Iarg_leaf 1386))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,914, + Iarg_facet ((4,true),0.5000,1026, + Iarg_facet ((5,true),0.6528,869, + Iarg_leaf 1303))), + Iarg_facet ((3,true),0.5000,787, + Iarg_facet ((4,true),0.5000,1049, + Iarg_facet ((5,true),0.6755,753, + Iarg_leaf 1323)))), + Iarg_facet ((2,true),0.5000,1283, + Iarg_leaf 1520)), + Iarg_facet ((1,true),0.5000,1077, + Iarg_facet ((2,true),0.5000,964, + Iarg_leaf 1090))), + Iarg_facet ((5,true),0.5000,1409, + Iarg_facet ((1,true),0.5000,1425, + Iarg_facet ((2,false),0.5000,1891, + Iarg_leaf 1918)))), + Iarg_facet ((4,true),0.5000,1894, + Iarg_facet ((5,true),0.5000,1280, + Iarg_facet ((1,true),0.5000,1390, + Iarg_facet ((2,true),0.5000,1069, + Iarg_leaf 1329)))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1496, + Iarg_facet ((3,true),0.5000,893, + Iarg_facet ((4,true),0.5000,812, + Iarg_facet ((5,true),0.5000,785, + Iarg_leaf 1710)))), + Iarg_facet ((2,true),0.5000,1277, + Iarg_facet ((3,true),0.5000,783, + Iarg_facet ((4,true),0.5898,918, + Iarg_facet ((5,true),0.5000,743, + Iarg_leaf 1580))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,716, + Iarg_leaf 1852), + Iarg_facet ((2,true),0.6361,911, + Iarg_leaf 1558))), + Iarg_facet ((5,true),0.5000,1386, + Iarg_facet ((1,true),0.5000,1520, + Iarg_leaf 1796))), + Iarg_facet ((4,true),0.5000,1756, + Iarg_facet ((5,true),0.5000,1407, + Iarg_facet ((1,true),0.5000,1592, + Iarg_facet ((2,true),0.5000,779, + Iarg_leaf 1276))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1538, + Iarg_facet ((1,true),0.5000,1356, + Iarg_leaf 1678)), + Iarg_facet ((5,true),0.5000,778, + Iarg_leaf 1608)), + Iarg_facet ((4,true),0.6271,943, + Iarg_leaf 1536)))));; + +add_case ("8282573160", + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.6405,991, + Iarg_facet ((5,true),0.6853,809, + Iarg_facet ((3,true),0.6654,841, + Iarg_leaf 1323))), + Iarg_facet ((4,true),0.6660,821, + Iarg_leaf 1401)), + Iarg_facet ((2,true),0.5000,1156, + Iarg_facet ((4,true),0.7674,926, + Iarg_leaf 1269))), + Iarg_facet ((1,true),0.5000,1791, + Iarg_facet ((2,true),0.5000,1151, + Iarg_leaf 1812))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1401, + Iarg_facet ((2,true),0.5000,864, + Iarg_leaf 1222)), + Iarg_facet ((1,true),0.5000,920, + Iarg_leaf 1332))), + Iarg_facet ((3,true),0.5000,1226, + Iarg_facet ((0,false),0.5000,1385, + Iarg_leaf 1492))), + Iarg_facet ((5,true),0.5000,1324, + Iarg_facet ((3,true),0.5000,1264, + Iarg_facet ((0,false),0.5000,1423, + Iarg_leaf 1531)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1185, + Iarg_facet ((1,true),0.5000,868, + Iarg_leaf 1394)), + Iarg_facet ((0,true),0.5000,890, + Iarg_leaf 1315)), + Iarg_facet ((3,true),0.5000,1035, + Iarg_facet ((0,true),0.5000,817, + Iarg_leaf 1272))), + Iarg_facet ((5,true),0.5000,1601, + Iarg_facet ((3,true),0.5000,1034, + Iarg_facet ((0,true),0.5000,836, + Iarg_leaf 1312))))), + Iarg_bisect (0, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1352, + Iarg_leaf 1815), + Iarg_facet ((1,true),0.5000,820, + Iarg_leaf 1226)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1321, + Iarg_facet ((4,true),0.8129,794, + Iarg_leaf 1224)), + Iarg_facet ((2,true),0.5000,994, + Iarg_leaf 1327)), + Iarg_facet ((1,true),0.5000,1344, + Iarg_facet ((2,true),0.5000,879, + Iarg_leaf 1966)))), + Iarg_facet ((3,false),0.5000,997, + Iarg_leaf 1025)), + Iarg_facet ((5,true),0.6169,975, + Iarg_leaf 1723)), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1833, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1127, + Iarg_leaf 1407), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,926, + Iarg_facet ((2,true),0.6377,879, + Iarg_leaf 1273)), + Iarg_facet ((1,true),0.5000,735, + Iarg_leaf 1790)))), + Iarg_facet ((5,true),0.5000,807, + Iarg_leaf 1829)))), + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((4,true),0.5000,1323, + Iarg_facet ((5,true),0.5000,1611, + Iarg_facet ((3,true),0.7602,1246, + Iarg_leaf 976))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,755, + Iarg_facet ((0,true),0.5000,979, + Iarg_leaf 1084)), + Iarg_facet ((3,true),0.5000,734, + Iarg_facet ((0,false),0.5000,1066, + Iarg_leaf 1505))), + Iarg_facet ((5,true),0.5000,989, + Iarg_leaf 1172))), + Iarg_bisect (0, + Iarg_facet ((4,true),0.6423,857, + Iarg_leaf 1248), + Iarg_facet ((4,true),0.5000,886, + Iarg_leaf 1803)))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((5,true),0.5000,1308, + Iarg_facet ((4,true),0.5000,1640, + Iarg_facet ((3,true),0.6260,927, + Iarg_leaf 1384))), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_facet ((3,true),0.5000,734, + Iarg_facet ((0,true),0.5000,1005, + Iarg_leaf 1125)), + Iarg_facet ((3,true),0.5954,935, + Iarg_facet ((0,false),0.5000,979, + Iarg_leaf 1346))), + Iarg_facet ((4,true),0.5000,972, + Iarg_leaf 1161))), + Iarg_bisect (0, + Iarg_facet ((5,true),0.6434,862, + Iarg_leaf 1238), + Iarg_facet ((5,true),0.5000,884, + Iarg_leaf 1747))), + Iarg_facet ((3,true),0.5000,1363, + Iarg_facet ((0,false),0.5000,1116, + Iarg_leaf 1948)))));; + +(* one insert here *) + +add_case ("TSKAJXY-RIBCYXU sym", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1880, + Iarg_facet ((5,true),0.5000,1727, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1543, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,901, + Iarg_facet ((5,true),0.5000,740, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,798, + Iarg_facet ((3,true),0.6262,757, + Iarg_facet ((4,true),0.8438,790, + Iarg_leaf 965))), + Iarg_facet ((2,true),0.5000,810, + Iarg_leaf 1348)), + Iarg_facet ((1,true),0.5000,1347, + Iarg_leaf 1929)))), + Iarg_facet ((4,true),0.8730,1257, + Iarg_leaf 803))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1354, + Iarg_facet ((5,true),0.5000,1038, + Iarg_facet ((0,false),0.7697,1061, + Iarg_leaf 622))), + Iarg_facet ((4,true),0.6249,850, + Iarg_leaf 1019)), + Iarg_facet ((3,true),0.5000,1170, + Iarg_facet ((4,true),0.5000,750, + Iarg_leaf 1486)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1216, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,703, + Iarg_facet ((5,true),0.7136,915, + Iarg_facet ((0,false),0.5000,1447, + Iarg_facet ((1,true),0.5000,917, + Iarg_facet ((2,true),0.7923,771, + Iarg_leaf 950))))), + Iarg_facet ((4,true),0.7872,1098, + Iarg_leaf 1446))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1358, + Iarg_facet ((5,true),0.5000,1023, + Iarg_facet ((0,false),0.5000,1080, + Iarg_leaf 1205))), + Iarg_facet ((4,true),0.6083,902, + Iarg_leaf 1206)), + Iarg_facet ((3,true),0.5000,1118, + Iarg_facet ((4,true),0.5000,766, + Iarg_leaf 1392))))))), + Iarg_facet ((4,true),0.5000,946, + Iarg_facet ((5,true),0.5000,766, + Iarg_facet ((0,false),0.5000,1539, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,830, + Iarg_bisect (3, + Iarg_facet ((4,true),0.7859,1062, + Iarg_leaf 1472), + Iarg_facet ((4,true),0.7951,1063, + Iarg_leaf 1186))), + Iarg_facet ((2,true),0.5000,1813, + Iarg_facet ((3,false),0.5000,1790, + Iarg_leaf 1904))))))), + Iarg_facet ((3,true),0.5000,1027, + Iarg_facet ((4,true),0.6658,836, + Iarg_leaf 1145))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.9912,1677, + Iarg_leaf 1319), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1393, + Iarg_facet ((4,true),0.5000,883, + Iarg_facet ((5,true),0.5000,727, + Iarg_leaf 1467))), + Iarg_facet ((3,true),0.5000,830, + Iarg_leaf 1458)), + Iarg_facet ((2,true),0.5000,1362, + Iarg_facet ((3,true),0.5000,839, + Iarg_leaf 1754)))), + Iarg_facet ((0,false),0.6269,757, + Iarg_facet ((1,true),0.5000,1588, + Iarg_leaf 1807))), + Iarg_bisect (5, + Iarg_facet ((0,false),0.7103,1006, + Iarg_facet ((1,true),0.5000,1142, + Iarg_leaf 1268)), + Iarg_facet ((0,false),0.8346,1051, + Iarg_leaf 660))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,false),0.7008,927, + Iarg_facet ((1,true),0.5000,1251, + Iarg_facet ((2,true),0.5000,747, + Iarg_leaf 1310))), + Iarg_facet ((0,false),0.7514,968, + Iarg_leaf 1082)), + Iarg_facet ((5,true),0.5000,1078, + Iarg_facet ((0,false),0.7520,898, + Iarg_leaf 1034)))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,false),0.6299,747, + Iarg_facet ((1,true),0.5000,1369, + Iarg_leaf 1575)), + Iarg_facet ((0,false),0.8185,900, + Iarg_leaf 772)), + Iarg_facet ((5,true),0.5000,1088, + Iarg_facet ((0,false),0.7924,930, + Iarg_leaf 862))), + Iarg_facet ((4,true),0.5000,1741, + Iarg_facet ((5,true),0.5000,1135, + Iarg_facet ((0,false),0.8368,1151, + Iarg_leaf 806)))))));; + +add_case ("OXLZLEZ 6346351218 3 10", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,1449, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1480, + Iarg_facet ((2,true),0.5000,981, + Iarg_leaf 1814)), + Iarg_facet ((1,true),0.5000,1384, + Iarg_facet ((2,true),0.5000,921, + Iarg_leaf 1820)))), + Iarg_facet ((3,true),0.6304,910, + Iarg_facet ((0,true),0.5000,1293, + Iarg_leaf 1313))), + Iarg_facet ((5,true),0.5000,1283, + Iarg_facet ((3,true),0.6313,904, + Iarg_facet ((0,true),0.5000,1302, + Iarg_leaf 1327)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1559, + Iarg_facet ((3,true),0.6127,869, + Iarg_facet ((0,false),0.5000,1376, + Iarg_leaf 1380))), + Iarg_facet ((5,true),0.6366,922, + Iarg_leaf 1436))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1736, + Iarg_facet ((3,true),0.6291,920, + Iarg_facet ((0,true),0.5000,1332, + Iarg_leaf 1335))), + Iarg_facet ((5,true),0.6340,914, + Iarg_leaf 1268)), + Iarg_facet ((4,true),0.5000,939, + Iarg_facet ((5,true),0.8000,1230, + Iarg_leaf 696)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1405, + Iarg_bisect (5, + Iarg_facet ((3,true),0.6966,821, + Iarg_leaf 1650), + Iarg_facet ((3,true),0.6815,779, + Iarg_leaf 1734))), + Iarg_facet ((4,true),0.6201,897, + Iarg_leaf 1352)), + Iarg_facet ((2,true),0.5000,1236, + Iarg_facet ((4,true),0.5000,726, + Iarg_facet ((5,false),0.5000,1268, + Iarg_leaf 1367))))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,751, + Iarg_facet ((3,true),0.6768,814, + Iarg_leaf 1757)), + Iarg_facet ((5,true),0.6345,956, + Iarg_facet ((3,true),0.7765,794, + Iarg_leaf 1574))), + Iarg_facet ((4,false),0.5000,1680, + Iarg_leaf 1698)), + Iarg_facet ((2,true),0.5000,1244, + Iarg_facet ((4,true),0.5000,1075, + Iarg_leaf 1309))), + Iarg_facet ((1,true),0.5000,1367, + Iarg_facet ((2,true),0.5000,829, + Iarg_leaf 1294)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1734, + Iarg_facet ((5,true),0.5000,935, + Iarg_facet ((3,true),0.6602,785, + Iarg_leaf 1879))), + Iarg_facet ((4,true),0.5000,1759, + Iarg_facet ((5,true),0.5000,782, + Iarg_facet ((3,true),0.7040,793, + Iarg_leaf 1822)))), + Iarg_facet ((2,true),0.5000,1488, + Iarg_leaf 1810)), + Iarg_facet ((1,true),0.5000,1509, + Iarg_facet ((2,true),0.5000,1292, + Iarg_leaf 1427))), + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1839, + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1215, + Iarg_leaf 1246), + Iarg_facet ((4,false),0.5000,1257, + Iarg_leaf 1273))), + Iarg_facet ((1,true),0.5000,774, + Iarg_leaf 1270)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1804, + Iarg_facet ((4,true),0.5000,1384, + Iarg_facet ((5,true),0.5000,1288, + Iarg_facet ((3,true),0.6575,795, + Iarg_leaf 1867)))), + Iarg_facet ((2,true),0.5000,1479, + Iarg_facet ((4,true),0.5000,1196, + Iarg_facet ((5,true),0.5000,1369, + Iarg_facet ((3,true),0.6791,776, + Iarg_leaf 1878))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,911, + Iarg_facet ((4,true),0.6476,874, + Iarg_leaf 1440)), + Iarg_facet ((2,true),0.5000,860, + Iarg_facet ((4,true),0.8254,1256, + Iarg_leaf 1053)))), + Iarg_facet ((5,true),0.5000,1996, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,849, + Iarg_leaf 1444), + Iarg_facet ((2,true),0.5000,736, + Iarg_leaf 1309)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1650, + Iarg_facet ((2,true),0.5000,924, + Iarg_leaf 1091)), + Iarg_facet ((1,true),0.5000,972, + Iarg_leaf 1138)), + Iarg_facet ((5,true),0.5000,896, + Iarg_facet ((1,true),0.5000,949, + Iarg_leaf 1238))))));; + +add_case ("OXLZLEZ 6346351218 3 3", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1676, + Iarg_facet ((4,true),0.5000,1160, + Iarg_facet ((5,true),0.5000,847, + Iarg_facet ((3,true),0.5000,1070, + Iarg_facet ((0,false),0.5000,819, + Iarg_leaf 1478))))), + Iarg_facet ((2,true),0.5000,745, + Iarg_leaf 1673)), + Iarg_facet ((1,true),0.5000,1694, + Iarg_facet ((2,true),0.5000,1160, + Iarg_facet ((4,true),0.5000,810, + Iarg_facet ((5,true),0.6496,889, + Iarg_facet ((3,false),0.5000,738, + Iarg_leaf 1495)))))), + Iarg_facet ((3,true),0.5000,1538, + Iarg_facet ((1,true),0.5000,853, + Iarg_leaf 1543))), + Iarg_facet ((5,true),0.5000,1245, + Iarg_facet ((3,true),0.5000,1546, + Iarg_facet ((1,true),0.5000,781, + Iarg_leaf 1674)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1353, + Iarg_facet ((3,true),0.5000,1555, + Iarg_facet ((1,true),0.5000,814, + Iarg_leaf 1663))), + Iarg_facet ((5,true),0.8287,1237, + Iarg_leaf 758))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1907, + Iarg_facet ((5,true),0.5000,1580, + Iarg_facet ((3,true),0.5000,1542, + Iarg_facet ((2,true),0.5000,805, + Iarg_leaf 1653)))), + Iarg_facet ((4,true),0.5000,780, + Iarg_leaf 1912))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1970, + Iarg_facet ((4,true),0.5000,1494, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,873, + Iarg_leaf 1648), + Iarg_facet ((3,true),0.5000,754, + Iarg_facet ((1,true),0.5000,794, + Iarg_leaf 1416))))), + Iarg_facet ((2,true),0.5000,1011, + Iarg_facet ((4,true),0.5000,703, + Iarg_facet ((5,false),0.5000,1170, + Iarg_leaf 1338))))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,764, + Iarg_facet ((3,true),0.5000,927, + Iarg_leaf 1685)), + Iarg_facet ((5,true),0.6198,999, + Iarg_facet ((3,true),0.6379,856, + Iarg_leaf 1482))), + Iarg_facet ((4,false),0.5000,1522, + Iarg_leaf 1702)), + Iarg_facet ((2,true),0.5000,1003, + Iarg_leaf 1970)), + Iarg_facet ((1,true),0.5000,1332, + Iarg_facet ((2,true),0.5000,782, + Iarg_leaf 1498)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1528, + Iarg_facet ((5,true),0.5000,756, + Iarg_facet ((3,true),0.5000,963, + Iarg_leaf 1717))), + Iarg_facet ((4,true),0.5000,1733, + Iarg_facet ((5,true),0.6221,895, + Iarg_facet ((3,true),0.6177,880, + Iarg_leaf 1576)))), + Iarg_facet ((2,true),0.5000,1546, + Iarg_leaf 1683)), + Iarg_facet ((1,true),0.5000,1293, + Iarg_facet ((2,true),0.5000,1070, + Iarg_leaf 1140))), + Iarg_facet ((5,true),0.5000,1866, + Iarg_facet ((1,true),0.5000,1714, + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1169, + Iarg_leaf 1401), + Iarg_facet ((4,false),0.5000,1417, + Iarg_leaf 1908)))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1681, + Iarg_facet ((4,true),0.5000,1100, + Iarg_facet ((5,true),0.5000,1184, + Iarg_facet ((3,true),0.5000,938, + Iarg_leaf 1730)))), + Iarg_facet ((2,true),0.5000,1550, + Iarg_facet ((4,true),0.5000,1010, + Iarg_facet ((5,true),0.5000,1384, + Iarg_facet ((3,true),0.5000,812, + Iarg_facet ((1,false),0.5000,865, + Iarg_leaf 1375)))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,856, + Iarg_facet ((4,true),0.6542,818, + Iarg_leaf 1584)), + Iarg_facet ((2,true),0.5000,853, + Iarg_facet ((4,true),0.6516,831, + Iarg_facet ((5,false),0.5000,943, + Iarg_leaf 1413))))), + Iarg_facet ((5,true),0.5000,1859, + Iarg_facet ((1,true),0.5000,1678, + Iarg_leaf 1864))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1858, + Iarg_facet ((1,true),0.5000,1696, + Iarg_leaf 1995)), + Iarg_facet ((5,true),0.5000,894, + Iarg_leaf 1951)))));; + +add_case ("OXLZLEZ 6346351218 2 34", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1738, + Iarg_facet ((0,true),0.5000,773, + Iarg_facet ((1,true),0.5000,1105, + Iarg_leaf 1754))), + Iarg_facet ((5,true),0.6206,970, + Iarg_leaf 1422)), + Iarg_facet ((4,true),0.5000,895, + Iarg_leaf 1832)), + Iarg_facet ((3,true),0.5000,1443, + Iarg_facet ((4,true),0.5000,1231, + Iarg_facet ((5,true),0.5000,798, + Iarg_leaf 1790)))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1451, + Iarg_facet ((4,true),0.5000,1154, + Iarg_facet ((5,true),0.5000,874, + Iarg_leaf 1786))), + Iarg_facet ((3,true),0.5000,798, + Iarg_leaf 1632))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1912, + Iarg_facet ((3,true),0.5000,1189, + Iarg_facet ((4,true),0.5000,812, + Iarg_facet ((5,true),0.5000,1291, + Iarg_leaf 1315)))), + Iarg_facet ((2,true),0.5000,1105, + Iarg_facet ((3,true),0.6215,929, + Iarg_leaf 1519)))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1210, + Iarg_facet ((4,true),0.5000,1672, + Iarg_leaf 1762)), + Iarg_facet ((3,true),0.5000,716, + Iarg_leaf 1806)), + Iarg_facet ((2,true),0.5000,1158, + Iarg_leaf 1979)), + Iarg_facet ((1,true),0.5000,1172, + Iarg_leaf 1914))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1874, + Iarg_facet ((4,true),0.5000,765, + Iarg_leaf 1492)), + Iarg_facet ((3,true),0.5000,1140, + Iarg_leaf 1206)), + Iarg_facet ((2,true),0.5000,1431, + Iarg_facet ((3,true),0.5000,1142, + Iarg_leaf 1212))), + Iarg_facet ((1,true),0.5000,1648, + Iarg_facet ((2,true),0.5000,1047, + Iarg_leaf 1828))), + Iarg_facet ((5,true),0.5000,1487, + Iarg_facet ((1,true),0.5000,1708, + Iarg_facet ((2,true),0.5000,1163, + Iarg_leaf 1884))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1071, + Iarg_facet ((4,true),0.5000,939, + Iarg_leaf 1877)), + Iarg_facet ((3,true),0.5000,964, + Iarg_facet ((4,true),0.5000,979, + Iarg_leaf 1787))), + Iarg_facet ((2,true),0.5000,1454, + Iarg_leaf 1656)), + Iarg_facet ((1,true),0.5000,1301, + Iarg_facet ((2,true),0.5000,1062, + Iarg_leaf 1206))), + Iarg_facet ((5,true),0.5000,1715, + Iarg_facet ((1,true),0.5000,1680, + Iarg_facet ((2,false),0.5000,1987, + Iarg_facet ((3,true),0.7346,859, + Iarg_leaf 1113))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1679, + Iarg_facet ((1,true),0.5000,1839, + Iarg_facet ((2,true),0.5000,1441, + Iarg_leaf 1728))), + Iarg_facet ((5,true),0.6449,848, + Iarg_leaf 1415)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1634, + Iarg_facet ((3,true),0.5000,1061, + Iarg_facet ((4,true),0.5000,750, + Iarg_facet ((5,true),0.6186,952, + Iarg_leaf 1109)))), + Iarg_facet ((2,true),0.5000,1370, + Iarg_facet ((3,true),0.5000,914, + Iarg_facet ((4,true),0.6266,968, + Iarg_leaf 1713)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,816, + Iarg_leaf 1892), + Iarg_facet ((2,true),0.5000,743, + Iarg_leaf 1977))), + Iarg_facet ((5,true),0.5000,1727, + Iarg_facet ((1,true),0.5000,1728, + Iarg_facet ((2,true),0.5000,755, + Iarg_leaf 1274)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1847, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1018, + Iarg_leaf 1674), + Iarg_facet ((2,true),0.5000,789, + Iarg_leaf 1374))), + Iarg_facet ((5,true),0.6382,935, + Iarg_leaf 1302))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1857, + Iarg_facet ((1,true),0.5000,1624, + Iarg_leaf 1995)), + Iarg_facet ((5,true),0.5000,945, + Iarg_leaf 1931)), + Iarg_facet ((4,true),0.5000,917, + Iarg_facet ((5,true),0.6072,885, + Iarg_leaf 1562))))));; + +add_case ("OXLZLEZ 6346351218 3 9", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,1889, + Iarg_facet ((1,true),0.5000,1168, + Iarg_facet ((2,true),0.5000,840, + Iarg_facet ((4,true),0.6461,983, + Iarg_leaf 1577)))), + Iarg_facet ((3,true),0.5000,1917, + Iarg_facet ((1,true),0.5000,1447, + Iarg_facet ((2,true),0.5000,1031, + Iarg_facet ((4,true),0.5000,711, + Iarg_facet ((5,true),0.6546,824, + Iarg_leaf 1372)))))), + Iarg_facet ((0,false),0.5000,1688, + Iarg_leaf 1934)), + Iarg_facet ((5,true),0.5000,1159, + Iarg_facet ((0,false),0.5000,1741, + Iarg_leaf 1997))), + Iarg_facet ((4,true),0.5000,1757, + Iarg_facet ((5,true),0.5000,1209, + Iarg_facet ((0,false),0.5000,1786, + Iarg_facet ((3,true),0.5000,774, + Iarg_leaf 1257))))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1668, + Iarg_facet ((5,true),0.5000,1351, + Iarg_facet ((0,false),0.5000,1787, + Iarg_leaf 1999))), + Iarg_facet ((4,true),0.6361,922, + Iarg_leaf 1282))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1828, + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,943, + Iarg_leaf 1172), + Iarg_facet ((3,true),0.5000,1190, + Iarg_leaf 1273))), + Iarg_facet ((5,true),0.5000,752, + Iarg_leaf 1802)), + Iarg_facet ((4,true),0.5000,1137, + Iarg_facet ((5,true),0.5000,763, + Iarg_leaf 1874))), + Iarg_facet ((2,true),0.5000,1626, + Iarg_facet ((4,true),0.5000,1107, + Iarg_facet ((5,true),0.5000,800, + Iarg_leaf 1903))))), + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1486, + Iarg_facet ((4,true),0.5000,951, + Iarg_facet ((5,true),0.5000,1557, + Iarg_leaf 1910))), + Iarg_facet ((2,true),0.6313,939, + Iarg_leaf 1363)), + Iarg_facet ((1,true),0.5000,1672, + Iarg_facet ((2,true),0.5000,1104, + Iarg_facet ((4,true),0.5000,750, + Iarg_leaf 1861))))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1690, + Iarg_facet ((4,true),0.5000,1925, + Iarg_facet ((5,true),0.6491,921, + Iarg_leaf 1519))), + Iarg_facet ((2,true),0.6305,913, + Iarg_leaf 1212)), + Iarg_facet ((1,true),0.5000,1674, + Iarg_facet ((2,true),0.5000,1188, + Iarg_facet ((4,true),0.5000,1107, + Iarg_leaf 1488)))), + Iarg_facet ((3,true),0.5000,1386, + Iarg_leaf 1690))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,990, + Iarg_facet ((5,true),0.6241,944, + Iarg_leaf 1565)), + Iarg_facet ((4,true),0.5000,757, + Iarg_facet ((5,true),0.6811,720, + Iarg_leaf 1111))), + Iarg_facet ((2,true),0.5000,854, + Iarg_leaf 1191)), + Iarg_facet ((1,true),0.5000,1708, + Iarg_facet ((2,true),0.5000,1624, + Iarg_facet ((4,true),0.6232,992, + Iarg_leaf 1225)))), + Iarg_facet ((3,true),0.5000,1514, + Iarg_leaf 1934)), + Iarg_facet ((5,true),0.5000,1112, + Iarg_facet ((3,true),0.5000,1777, + Iarg_facet ((1,true),0.5000,772, + Iarg_leaf 1774))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1164, + Iarg_facet ((4,true),0.5000,931, + Iarg_facet ((5,true),0.5000,739, + Iarg_facet ((0,false),0.5000,1012, + Iarg_leaf 1044)))), + Iarg_facet ((2,true),0.5000,845, + Iarg_facet ((4,true),0.6372,983, + Iarg_leaf 1682))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,994, + Iarg_facet ((4,true),0.6224,969, + Iarg_leaf 1238)), + Iarg_facet ((2,true),0.6169,906, + Iarg_leaf 1390))), + Iarg_facet ((3,true),0.5000,1644, + Iarg_facet ((1,true),0.5000,1009, + Iarg_leaf 1341))), + Iarg_facet ((5,true),0.5000,1186, + Iarg_facet ((3,true),0.5000,1574, + Iarg_facet ((1,true),0.5000,837, + Iarg_leaf 1186)))), + Iarg_facet ((4,true),0.5000,1685, + Iarg_facet ((5,true),0.5000,1291, + Iarg_facet ((3,true),0.5000,1662, + Iarg_leaf 1970))))));; + +add_case ("OXLZLEZ 6346351218 1 14", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((3,true),0.6933,989, + Iarg_facet ((1,true),0.5000,858, + Iarg_leaf 1280)), + Iarg_facet ((3,true),0.6820,944, + Iarg_facet ((1,true),0.5000,953, + Iarg_leaf 1262))), + Iarg_facet ((0,false),0.5000,1510, + Iarg_leaf 1658)), + Iarg_facet ((5,true),0.5000,1453, + Iarg_facet ((0,false),0.5000,1488, + Iarg_leaf 1645))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1415, + Iarg_facet ((0,false),0.5000,1518, + Iarg_leaf 1680)), + Iarg_facet ((5,true),0.6466,896, + Iarg_leaf 1159))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1992, + Iarg_facet ((5,true),0.5000,1522, + Iarg_facet ((0,false),0.5000,1507, + Iarg_leaf 1661))), + Iarg_facet ((4,true),0.5000,836, + Iarg_facet ((5,true),0.6466,895, + Iarg_leaf 1129)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1617, + Iarg_facet ((4,true),0.5000,1188, + Iarg_facet ((5,true),0.5000,1212, + Iarg_leaf 1737))), + Iarg_facet ((2,true),0.5000,713, + Iarg_leaf 1759))), + Iarg_facet ((5,true),0.5000,1891, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1772, + Iarg_facet ((5,true),0.5000,1188, + Iarg_facet ((4,true),0.5000,1194, + Iarg_leaf 1746))), + Iarg_facet ((2,true),0.5000,724, + Iarg_leaf 1626)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1873, + Iarg_bisect (1, + Iarg_facet ((4,true),0.5000,1759, + Iarg_facet ((5,true),0.5000,1151, + Iarg_facet ((2,true),0.5000,1212, + Iarg_leaf 1864))), + Iarg_facet ((4,true),0.5000,743, + Iarg_leaf 1665))), + Iarg_facet ((5,true),0.6454,818, + Iarg_leaf 1749))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1645, + Iarg_facet ((5,true),0.5000,1259, + Iarg_facet ((1,true),0.5000,1211, + Iarg_leaf 1884))), + Iarg_facet ((4,true),0.5000,703, + Iarg_leaf 1710)), + Iarg_facet ((2,true),0.6277,850, + Iarg_leaf 1197)), + Iarg_facet ((5,true),0.6389,814, + Iarg_leaf 1558)), + Iarg_facet ((4,true),0.5000,755, + Iarg_facet ((5,true),0.6528,850, + Iarg_leaf 1582)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1664, + Iarg_facet ((4,true),0.5000,1237, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1095, + Iarg_facet ((2,true),0.5000,731, + Iarg_leaf 1872)), + Iarg_facet ((1,true),0.6260,929, + Iarg_leaf 1440)))), + Iarg_facet ((2,true),0.6124,876, + Iarg_leaf 1656))), + Iarg_facet ((5,true),0.5000,1883, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1927, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,800, + Iarg_facet ((1,true),0.5000,1015, + Iarg_facet ((2,true),0.5000,839, + Iarg_leaf 1929))), + Iarg_facet ((5,true),0.6747,816, + Iarg_facet ((1,true),0.6678,842, + Iarg_leaf 1232)))), + Iarg_facet ((2,true),0.6340,903, + Iarg_leaf 1394)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1204, + Iarg_facet ((5,true),0.5000,808, + Iarg_facet ((1,true),0.5000,1076, + Iarg_facet ((4,true),0.5000,825, + Iarg_leaf 1903)))), + Iarg_facet ((4,true),0.5000,788, + Iarg_facet ((5,true),0.6673,817, + Iarg_facet ((1,true),0.6594,865, + Iarg_leaf 1232)))), + Iarg_facet ((2,true),0.5000,974, + Iarg_leaf 1444)), + Iarg_facet ((1,true),0.6302,907, + Iarg_leaf 1249)), + Iarg_facet ((5,true),0.6511,853, + Iarg_leaf 1928))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1447, + Iarg_facet ((4,true),0.5000,1057, + Iarg_facet ((5,true),0.5000,934, + Iarg_facet ((2,true),0.5000,1078, + Iarg_facet ((4,true),0.5000,752, + Iarg_leaf 1990))))), + Iarg_facet ((2,true),0.5000,970, + Iarg_facet ((4,true),0.5906,909, + Iarg_facet ((5,true),0.6587,867, + Iarg_leaf 1949)))), + Iarg_facet ((1,true),0.5000,917, + Iarg_leaf 1342)), + Iarg_facet ((5,true),0.6559,882, + Iarg_leaf 1894)), + Iarg_facet ((4,true),0.5000,731, + Iarg_facet ((5,true),0.6668,972, + Iarg_leaf 1606)))));; + +add_case ("OXLZLEZ 6346351218 4 10", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,1436, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1561, + Iarg_facet ((2,true),0.5000,1009, + Iarg_leaf 1830)), + Iarg_facet ((1,true),0.5000,1372, + Iarg_facet ((2,true),0.5000,906, + Iarg_leaf 1678)))), + Iarg_facet ((3,true),0.6291,936, + Iarg_facet ((0,true),0.5000,1299, + Iarg_leaf 1373))), + Iarg_facet ((5,true),0.5000,1373, + Iarg_facet ((3,true),0.6313,935, + Iarg_facet ((0,true),0.5000,1300, + Iarg_leaf 1381)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1678, + Iarg_facet ((3,true),0.6305,936, + Iarg_facet ((0,true),0.5000,1338, + Iarg_leaf 1417))), + Iarg_facet ((5,true),0.6257,944, + Iarg_leaf 1567))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1850, + Iarg_facet ((3,true),0.6271,938, + Iarg_facet ((0,true),0.5000,1362, + Iarg_leaf 1443))), + Iarg_facet ((5,true),0.6241,946, + Iarg_leaf 1375)), + Iarg_facet ((4,true),0.5000,993, + Iarg_facet ((5,true),0.6209,911, + Iarg_leaf 1181)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1500, + Iarg_bisect (5, + Iarg_facet ((3,true),0.6960,832, + Iarg_leaf 1789), + Iarg_facet ((3,true),0.6494,745, + Iarg_facet ((0,false),0.5000,1026, + Iarg_leaf 1107)))), + Iarg_facet ((4,true),0.5000,727, + Iarg_leaf 1841)), + Iarg_facet ((2,true),0.5000,1321, + Iarg_facet ((4,true),0.5000,806, + Iarg_facet ((5,false),0.5000,1362, + Iarg_leaf 1532))))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,819, + Iarg_facet ((3,true),0.7004,847, + Iarg_leaf 1821)), + Iarg_facet ((5,true),0.6229,1003, + Iarg_facet ((3,true),0.6944,702, + Iarg_leaf 1789))), + Iarg_facet ((4,false),0.5000,1812, + Iarg_leaf 1917)), + Iarg_facet ((2,true),0.5000,1332, + Iarg_facet ((4,true),0.5000,1180, + Iarg_leaf 1410))), + Iarg_facet ((1,true),0.5000,1452, + Iarg_facet ((2,true),0.5000,894, + Iarg_leaf 1358)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1883, + Iarg_facet ((5,true),0.5000,1003, + Iarg_facet ((3,true),0.6695,826, + Iarg_facet ((0,false),0.5000,985, + Iarg_leaf 1022)))), + Iarg_facet ((4,true),0.5000,1976, + Iarg_facet ((5,true),0.5000,845, + Iarg_facet ((3,true),0.6680,793, + Iarg_facet ((0,false),0.5000,1127, + Iarg_leaf 1182))))), + Iarg_facet ((2,true),0.5000,1633, + Iarg_leaf 1949)), + Iarg_facet ((1,true),0.5000,1612, + Iarg_facet ((2,true),0.5000,1413, + Iarg_leaf 1538))), + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1963, + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1314, + Iarg_leaf 1426), + Iarg_facet ((4,true),0.5000,1427, + Iarg_leaf 1450))), + Iarg_facet ((1,true),0.5000,829, + Iarg_leaf 1371)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1940, + Iarg_facet ((4,true),0.5000,1483, + Iarg_facet ((5,true),0.5000,1391, + Iarg_facet ((3,true),0.6673,830, + Iarg_leaf 1971)))), + Iarg_facet ((2,true),0.5000,1632, + Iarg_facet ((4,true),0.5000,1273, + Iarg_facet ((5,true),0.5000,1563, + Iarg_facet ((3,true),0.6749,823, + Iarg_facet ((0,false),0.5000,1094, + Iarg_leaf 1138)))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,978, + Iarg_facet ((4,true),0.6386,907, + Iarg_leaf 1724)), + Iarg_facet ((2,true),0.5000,917, + Iarg_facet ((4,true),0.7962,1287, + Iarg_leaf 1526)))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,894, + Iarg_leaf 1580), + Iarg_facet ((2,true),0.5000,784, + Iarg_leaf 1443)), + Iarg_facet ((1,true),0.5000,1000, + Iarg_leaf 1157))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1751, + Iarg_facet ((2,true),0.5000,981, + Iarg_leaf 1145)), + Iarg_facet ((1,true),0.5000,1025, + Iarg_leaf 1221)), + Iarg_facet ((5,true),0.5000,962, + Iarg_facet ((1,true),0.5000,1003, + Iarg_leaf 1342))))));; + +add_case ("OXLZLEZ 6346351218 4 9", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,1436, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1559, + Iarg_facet ((2,true),0.5000,1007, + Iarg_leaf 1831)), + Iarg_facet ((1,true),0.5000,1374, + Iarg_facet ((2,true),0.5000,907, + Iarg_leaf 1682)))), + Iarg_facet ((3,true),0.6288,938, + Iarg_facet ((0,true),0.5000,1297, + Iarg_leaf 1374))), + Iarg_facet ((5,true),0.5000,1377, + Iarg_facet ((3,true),0.6315,941, + Iarg_facet ((0,true),0.5000,1301, + Iarg_leaf 1385)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1679, + Iarg_facet ((3,true),0.6299,932, + Iarg_facet ((0,true),0.5000,1339, + Iarg_leaf 1419))), + Iarg_facet ((5,true),0.6314,951, + Iarg_leaf 1558))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1850, + Iarg_facet ((3,true),0.6078,885, + Iarg_facet ((0,true),0.5000,1431, + Iarg_leaf 1503))), + Iarg_facet ((5,true),0.6246,946, + Iarg_leaf 1375)), + Iarg_facet ((4,true),0.5000,992, + Iarg_facet ((5,true),0.6361,929, + Iarg_leaf 1140)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1498, + Iarg_bisect (5, + Iarg_facet ((3,true),0.6964,831, + Iarg_leaf 1787), + Iarg_facet ((3,true),0.7186,873, + Iarg_leaf 1883))), + Iarg_facet ((4,true),0.5000,727, + Iarg_leaf 1845)), + Iarg_facet ((2,true),0.5000,1321, + Iarg_facet ((4,true),0.5000,806, + Iarg_facet ((5,false),0.5000,1362, + Iarg_leaf 1532))))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,820, + Iarg_facet ((3,true),0.6834,837, + Iarg_leaf 1889)), + Iarg_facet ((5,true),0.6235,1005, + Iarg_facet ((3,true),0.7737,881, + Iarg_leaf 1860))), + Iarg_facet ((4,false),0.5000,1813, + Iarg_leaf 1917)), + Iarg_facet ((2,true),0.5000,1342, + Iarg_facet ((4,true),0.5000,1201, + Iarg_leaf 1419))), + Iarg_facet ((1,true),0.5000,1455, + Iarg_facet ((2,true),0.5000,896, + Iarg_leaf 1357)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1883, + Iarg_facet ((5,true),0.5000,1005, + Iarg_facet ((3,true),0.7147,929, + Iarg_leaf 1830))), + Iarg_facet ((4,true),0.5000,1975, + Iarg_facet ((5,true),0.5000,845, + Iarg_facet ((3,true),0.6774,821, + Iarg_facet ((0,false),0.5000,1104, + Iarg_leaf 1156))))), + Iarg_facet ((2,true),0.5000,1634, + Iarg_leaf 1948)), + Iarg_facet ((1,true),0.5000,1612, + Iarg_facet ((2,true),0.5000,1412, + Iarg_leaf 1541))), + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1965, + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1313, + Iarg_leaf 1425), + Iarg_facet ((4,true),0.5000,1427, + Iarg_leaf 1451))), + Iarg_facet ((1,true),0.5000,829, + Iarg_leaf 1375)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1939, + Iarg_facet ((4,true),0.5000,1485, + Iarg_facet ((5,true),0.5000,1391, + Iarg_facet ((3,true),0.6673,829, + Iarg_leaf 1971)))), + Iarg_facet ((2,true),0.5000,1633, + Iarg_facet ((4,true),0.5000,1273, + Iarg_facet ((5,true),0.5000,1562, + Iarg_facet ((3,true),0.6747,825, + Iarg_facet ((0,false),0.5000,1090, + Iarg_leaf 1139)))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,979, + Iarg_facet ((4,true),0.6434,912, + Iarg_leaf 1701)), + Iarg_facet ((2,true),0.5000,920, + Iarg_facet ((4,true),0.6476,878, + Iarg_leaf 1865)))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,895, + Iarg_leaf 1579), + Iarg_facet ((2,true),0.5000,783, + Iarg_leaf 1439)), + Iarg_facet ((1,true),0.5000,998, + Iarg_leaf 1158))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1755, + Iarg_facet ((2,true),0.5000,983, + Iarg_leaf 1146)), + Iarg_facet ((1,true),0.5000,1028, + Iarg_leaf 1220)), + Iarg_facet ((5,true),0.5000,961, + Iarg_facet ((1,true),0.5000,1003, + Iarg_leaf 1342))))));; + +add_case ("OXLZLEZ 6346351218 4 8", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,1921, + Iarg_facet ((1,true),0.5000,1254, + Iarg_facet ((2,true),0.5000,894, + Iarg_facet ((4,true),0.6405,993, + Iarg_leaf 1671)))), + Iarg_facet ((3,true),0.5000,1960, + Iarg_facet ((1,true),0.5000,1548, + Iarg_facet ((2,true),0.5000,1111, + Iarg_facet ((4,true),0.5000,771, + Iarg_facet ((5,true),0.6528,915, + Iarg_leaf 1445)))))), + Iarg_facet ((0,false),0.5000,1796, + Iarg_facet ((3,true),0.5000,768, + Iarg_leaf 1316))), + Iarg_facet ((5,true),0.5000,1250, + Iarg_facet ((0,false),0.5000,1843, + Iarg_facet ((3,true),0.5000,796, + Iarg_leaf 1331)))), + Iarg_facet ((4,true),0.5000,1915, + Iarg_facet ((5,true),0.5000,1301, + Iarg_facet ((0,false),0.5000,1879, + Iarg_facet ((3,true),0.5000,824, + Iarg_leaf 1341))))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1794, + Iarg_facet ((5,true),0.5000,1460, + Iarg_facet ((0,false),0.5000,1862, + Iarg_facet ((3,true),0.5000,808, + Iarg_leaf 1342)))), + Iarg_facet ((4,true),0.6229,968, + Iarg_leaf 1434))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1873, + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,954, + Iarg_leaf 1233), + Iarg_facet ((3,true),0.5000,1194, + Iarg_leaf 1317))), + Iarg_facet ((5,true),0.5000,777, + Iarg_leaf 1868)), + Iarg_facet ((4,true),0.5000,1181, + Iarg_facet ((5,true),0.5000,791, + Iarg_leaf 1944))), + Iarg_facet ((2,true),0.5000,1665, + Iarg_facet ((4,true),0.5000,1135, + Iarg_facet ((5,true),0.5000,841, + Iarg_leaf 1967))))), + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1618, + Iarg_facet ((4,true),0.5000,1067, + Iarg_facet ((5,true),0.5000,1755, + Iarg_facet ((0,false),0.5000,1006, + Iarg_leaf 1054)))), + Iarg_facet ((2,true),0.5000,711, + Iarg_leaf 1842)), + Iarg_facet ((1,true),0.5000,1755, + Iarg_facet ((2,true),0.5000,1175, + Iarg_facet ((4,true),0.5000,790, + Iarg_leaf 1978))))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1835, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6387,983, + Iarg_leaf 1639), + Iarg_facet ((5,true),0.7157,824, + Iarg_leaf 1190))), + Iarg_facet ((2,true),0.5000,734, + Iarg_leaf 1621)), + Iarg_facet ((1,true),0.5000,1768, + Iarg_facet ((2,true),0.5000,1250, + Iarg_facet ((4,true),0.5000,1177, + Iarg_leaf 1562)))), + Iarg_facet ((3,true),0.5000,1464, + Iarg_leaf 1794))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1075, + Iarg_facet ((5,true),0.5000,712, + Iarg_facet ((0,false),0.5000,1074, + Iarg_leaf 1132))), + Iarg_facet ((4,true),0.5000,860, + Iarg_facet ((5,true),0.6709,781, + Iarg_leaf 1276))), + Iarg_facet ((2,true),0.5000,974, + Iarg_leaf 1314)), + Iarg_facet ((1,true),0.5000,1805, + Iarg_facet ((2,true),0.5000,1742, + Iarg_facet ((4,true),0.5000,766, + Iarg_leaf 1648)))), + Iarg_facet ((3,true),0.5000,1589, + Iarg_facet ((1,true),0.5000,709, + Iarg_leaf 1373))), + Iarg_facet ((5,true),0.5000,1187, + Iarg_facet ((3,true),0.5000,1879, + Iarg_facet ((1,true),0.5000,838, + Iarg_leaf 1927))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1268, + Iarg_facet ((4,true),0.5000,1007, + Iarg_facet ((5,true),0.5000,811, + Iarg_facet ((0,false),0.5000,1086, + Iarg_leaf 1156)))), + Iarg_facet ((2,true),0.5000,932, + Iarg_facet ((4,true),0.6018,960, + Iarg_facet ((5,true),0.7541,1037, + Iarg_leaf 1080)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1038, + Iarg_facet ((4,true),0.5000,705, + Iarg_leaf 1654)), + Iarg_facet ((2,true),0.5000,739, + Iarg_leaf 1742))), + Iarg_facet ((3,true),0.5000,1739, + Iarg_facet ((1,true),0.5000,1110, + Iarg_leaf 1456))), + Iarg_facet ((5,true),0.5000,1241, + Iarg_facet ((3,true),0.5000,1644, + Iarg_facet ((1,true),0.5000,896, + Iarg_leaf 1268)))), + Iarg_facet ((4,true),0.5000,1805, + Iarg_facet ((5,true),0.5000,1386, + Iarg_facet ((3,true),0.5000,1733, + Iarg_facet ((1,true),0.5000,871, + Iarg_leaf 1217)))))));; + +add_case ("OXLZLEZ 6346351218 1 33", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1783, + Iarg_facet ((5,true),0.5000,1349, + Iarg_facet ((0,true),0.5000,1733, + Iarg_facet ((3,false),0.5000,1063, + Iarg_leaf 1104)))), + Iarg_facet ((4,true),0.6235,905, + Iarg_leaf 1397)), + Iarg_facet ((2,true),0.5000,942, + Iarg_facet ((4,true),0.6353,912, + Iarg_leaf 1394))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((3,false),0.5000,996, + Iarg_leaf 1093), + Iarg_facet ((3,false),0.5000,1772, + Iarg_leaf 1936)), + Iarg_facet ((0,false),0.5000,805, + Iarg_leaf 1368)), + Iarg_facet ((5,true),0.6183,975, + Iarg_leaf 1711)), + Iarg_facet ((4,true),0.5000,966, + Iarg_facet ((5,true),0.6271,975, + Iarg_leaf 1688))), + Iarg_facet ((2,true),0.5000,1320, + Iarg_facet ((4,true),0.5000,905, + Iarg_facet ((5,true),0.5000,714, + Iarg_facet ((0,false),0.5000,805, + Iarg_leaf 1362)))))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,870, + Iarg_leaf 1859), + Iarg_facet ((1,true),0.5000,1150, + Iarg_facet ((2,true),0.5000,722, + Iarg_leaf 1925)))), + Iarg_facet ((5,true),0.5000,1776, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,820, + Iarg_leaf 1944), + Iarg_facet ((1,true),0.5000,1057, + Iarg_facet ((2,true),0.5000,834, + Iarg_leaf 1961))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1784, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,861, + Iarg_leaf 1920), + Iarg_facet ((1,true),0.5000,1084, + Iarg_facet ((4,true),0.5000,822, + Iarg_leaf 1947)))), + Iarg_facet ((5,true),0.6215,961, + Iarg_leaf 1676))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1991, + Iarg_bisect (0, + Iarg_facet ((2,true),0.5000,857, + Iarg_leaf 1933), + Iarg_facet ((2,true),0.5000,1085, + Iarg_facet ((4,true),0.5000,739, + Iarg_facet ((5,true),0.6540,802, + Iarg_leaf 1121))))), + Iarg_facet ((5,true),0.6166,991, + Iarg_leaf 1495)), + Iarg_facet ((4,true),0.5000,972, + Iarg_facet ((5,true),0.5000,707, + Iarg_leaf 1977)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1689, + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1406, + Iarg_leaf 1746), + Iarg_facet ((0,true),0.5000,1314, + Iarg_leaf 1331))), + Iarg_facet ((4,true),0.6299,987, + Iarg_leaf 1453)), + Iarg_facet ((2,true),0.5000,942, + Iarg_facet ((4,true),0.6238,1008, + Iarg_leaf 1671)))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,947, + Iarg_facet ((0,false),0.5000,1451, + Iarg_leaf 1767)), + Iarg_facet ((5,true),0.5870,1023, + Iarg_facet ((0,false),0.5000,1257, + Iarg_leaf 1281))), + Iarg_facet ((4,true),0.5000,1167, + Iarg_leaf 1553)), + Iarg_facet ((2,true),0.5000,943, + Iarg_facet ((4,true),0.5000,1061, + Iarg_leaf 1387))), + Iarg_facet ((1,true),0.5000,748, + Iarg_facet ((2,true),0.6582,852, + Iarg_leaf 1135)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1597, + Iarg_facet ((5,true),0.5000,1030, + Iarg_facet ((0,false),0.5000,1487, + Iarg_leaf 1796))), + Iarg_facet ((4,true),0.5000,1236, + Iarg_facet ((5,true),0.5000,814, + Iarg_facet ((0,true),0.5000,1463, + Iarg_leaf 1484)))), + Iarg_facet ((2,true),0.5000,1451, + Iarg_facet ((4,true),0.6535,874, + Iarg_leaf 1089))), + Iarg_facet ((1,true),0.5000,799, + Iarg_leaf 1957)), + Iarg_facet ((5,true),0.6260,947, + Iarg_facet ((1,true),0.5000,732, + Iarg_facet ((2,true),0.5000,880, + Iarg_leaf 1289))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1464, + Iarg_facet ((5,true),0.5000,1197, + Iarg_facet ((0,false),0.5000,1491, + Iarg_leaf 1803))), + Iarg_facet ((4,true),0.6582,849, + Iarg_leaf 1083)), + Iarg_facet ((2,true),0.5000,1458, + Iarg_facet ((4,true),0.5000,1116, + Iarg_facet ((5,true),0.5000,989, + Iarg_facet ((0,true),0.5000,1466, + Iarg_leaf 1498))))), + Iarg_facet ((1,true),0.5000,1340, + Iarg_facet ((2,true),0.6619,818, + Iarg_leaf 1172))), + Iarg_facet ((5,true),0.6277,982, + Iarg_facet ((1,true),0.5000,884, + Iarg_leaf 1537))), + Iarg_facet ((4,true),0.5000,934, + Iarg_facet ((5,true),0.5000,724, + Iarg_facet ((1,true),0.5000,1131, + Iarg_leaf 1771))))));; + +add_case ("QITNPEA 5400790175 a split(3/4)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,false),0.7228,871, + Iarg_facet ((1,true),0.5000,1511, + Iarg_facet ((2,true),0.5000,945, + Iarg_facet ((4,true),0.6232,890, + Iarg_facet ((5,true),0.6374,951, + Iarg_leaf 1864))))), + Iarg_facet ((0,false),0.7649,769, + Iarg_facet ((1,true),0.5000,1023, + Iarg_facet ((2,true),0.5954,1009, + Iarg_leaf 1911)))), + Iarg_facet ((3,true),0.5000,1873, + Iarg_leaf 1947)), + Iarg_facet ((5,true),0.5000,1049, + Iarg_facet ((3,true),0.5000,1022, + Iarg_leaf 1035))), + Iarg_facet ((4,true),0.5000,1030, + Iarg_facet ((5,true),0.5000,938, + Iarg_facet ((3,true),0.5000,1022, + Iarg_leaf 1037)))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1312, + Iarg_facet ((5,true),0.5000,1351, + Iarg_facet ((3,true),0.5000,1878, + Iarg_leaf 1953))), + Iarg_facet ((4,true),0.6518,878, + Iarg_leaf 1116))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,false),0.7724,1100, + Iarg_facet ((1,true),0.5000,1446, + Iarg_facet ((2,true),0.5000,943, + Iarg_facet ((4,true),0.6215,1003, + Iarg_leaf 1723)))), + Iarg_facet ((0,false),0.6928,1065, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1833, + Iarg_facet ((4,true),0.5000,1298, + Iarg_facet ((5,true),0.5000,1504, + Iarg_facet ((3,false),0.5000,1124, + Iarg_leaf 1941)))), + Iarg_facet ((2,true),0.5000,774, + Iarg_facet ((4,true),0.6587,901, + Iarg_leaf 1562))))), + Iarg_bisect (3, + Iarg_facet ((0,false),0.6161,1126, + Iarg_leaf 1361), + Iarg_facet ((0,false),0.5000,817, + Iarg_facet ((1,true),0.5000,758, + Iarg_leaf 1994)))), + Iarg_facet ((5,true),0.5000,1496, + Iarg_facet ((3,false),0.5000,1248, + Iarg_leaf 1886))), + Iarg_facet ((4,true),0.5000,1351, + Iarg_facet ((5,true),0.5000,1407, + Iarg_facet ((3,false),0.5000,1254, + Iarg_leaf 1911)))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1860, + Iarg_facet ((5,true),0.5000,1810, + Iarg_bisect (3, + Iarg_facet ((0,false),0.6318,1163, + Iarg_leaf 1231), + Iarg_facet ((0,false),0.5000,829, + Iarg_facet ((2,true),0.5000,779, + Iarg_facet ((4,true),0.6635,814, + Iarg_leaf 1166)))))), + Iarg_facet ((4,true),0.6398,952, + Iarg_leaf 1700)))), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1810, + Iarg_facet ((2,true),0.5000,1180, + Iarg_facet ((4,true),0.5000,775, + Iarg_facet ((5,true),0.5000,762, + Iarg_leaf 1629)))), + Iarg_facet ((1,true),0.5000,1595, + Iarg_facet ((2,true),0.5000,1027, + Iarg_facet ((4,true),0.5000,886, + Iarg_facet ((5,true),0.5000,825, + Iarg_facet ((3,false),0.5000,919, + Iarg_leaf 1320))))))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1827, + Iarg_facet ((2,true),0.5000,948, + Iarg_leaf 1956)), + Iarg_facet ((1,true),0.5000,1519, + Iarg_facet ((2,true),0.5000,910, + Iarg_facet ((4,true),0.5000,799, + Iarg_leaf 1670)))), + Iarg_facet ((3,true),0.5000,1444, + Iarg_leaf 1970))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1857, + Iarg_facet ((2,true),0.5000,1172, + Iarg_leaf 1779)), + Iarg_facet ((1,true),0.5000,1755, + Iarg_facet ((2,true),0.5000,1120, + Iarg_facet ((4,true),0.6537,858, + Iarg_leaf 1299)))), + Iarg_facet ((3,true),0.5000,1559, + Iarg_facet ((1,true),0.5000,742, + Iarg_leaf 1354))), + Iarg_facet ((5,true),0.5000,1187, + Iarg_facet ((3,true),0.5000,1550, + Iarg_leaf 1999)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1048, + Iarg_facet ((4,true),0.6235,1006, + Iarg_leaf 1936)), + Iarg_facet ((2,true),0.5000,804, + Iarg_leaf 1632)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1152, + Iarg_facet ((4,true),0.6174,1063, + Iarg_facet ((5,true),0.6653,860, + Iarg_leaf 1634))), + Iarg_facet ((2,true),0.6492,875, + Iarg_leaf 1230))), + Iarg_facet ((3,true),0.5000,1430, + Iarg_facet ((1,true),0.5000,848, + Iarg_leaf 1174))), + Iarg_facet ((5,true),0.5000,1194, + Iarg_facet ((3,true),0.5000,1608, + Iarg_facet ((1,true),0.5000,869, + Iarg_leaf 1269)))), + Iarg_facet ((4,true),0.5000,1721, + Iarg_facet ((5,true),0.5000,1382, + Iarg_facet ((3,true),0.5000,1751, + Iarg_facet ((1,true),0.5000,933, + Iarg_leaf 1282)))))));; + +add_case ("GLFVCVK4 2477216213 split(36/64)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,795, + Iarg_facet ((2,true),0.6537,839, + Iarg_leaf 1555)), + Iarg_facet ((1,true),0.5000,756, + Iarg_facet ((2,true),0.6635,808, + Iarg_leaf 1379))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,778, + Iarg_facet ((2,true),0.6592,837, + Iarg_leaf 1401)), + Iarg_facet ((1,true),0.5000,841, + Iarg_facet ((2,true),0.6486,862, + Iarg_leaf 1322)))), + Iarg_facet ((3,false),0.5000,1193, + Iarg_leaf 1283)), + Iarg_facet ((5,true),0.5000,770, + Iarg_facet ((3,false),0.5000,1256, + Iarg_leaf 1330))), + Iarg_facet ((4,true),0.5000,1072, + Iarg_facet ((5,true),0.5000,733, + Iarg_facet ((3,false),0.5000,1336, + Iarg_leaf 1423)))), + Iarg_facet ((2,true),0.5000,1591, + Iarg_facet ((4,true),0.5000,1037, + Iarg_facet ((5,true),0.5000,802, + Iarg_facet ((3,false),0.5000,1352, + Iarg_leaf 1428))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1069, + Iarg_facet ((2,true),0.5000,753, + Iarg_facet ((4,true),0.6575,869, + Iarg_leaf 1415))), + Iarg_facet ((1,true),0.5000,1192, + Iarg_facet ((2,true),0.5000,838, + Iarg_facet ((4,true),0.6416,963, + Iarg_leaf 1653)))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1703, + Iarg_facet ((2,true),0.5000,1241, + Iarg_facet ((4,true),0.5000,958, + Iarg_facet ((5,true),0.5000,736, + Iarg_facet ((3,false),0.5000,1099, + Iarg_leaf 1669))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1691, + Iarg_facet ((4,true),0.5000,1319, + Iarg_facet ((5,true),0.5000,1020, + Iarg_facet ((3,false),0.5000,1400, + Iarg_facet ((0,false),0.5000,980, + Iarg_leaf 1269))))), + Iarg_facet ((2,true),0.6461,889, + Iarg_leaf 1290)))), + Iarg_facet ((3,false),0.5000,1615, + Iarg_facet ((0,false),0.5000,1113, + Iarg_leaf 1347))), + Iarg_facet ((5,true),0.5000,1076, + Iarg_facet ((3,false),0.5000,1671, + Iarg_facet ((0,false),0.5000,1137, + Iarg_leaf 1367)))), + Iarg_facet ((4,true),0.5000,1347, + Iarg_facet ((5,true),0.5000,976, + Iarg_facet ((3,false),0.5000,1736, + Iarg_facet ((0,false),0.5000,1169, + Iarg_leaf 1402))))), + Iarg_facet ((2,true),0.5000,1912, + Iarg_facet ((4,true),0.5000,1279, + Iarg_facet ((5,true),0.5000,1102, + Iarg_facet ((3,false),0.5000,1726, + Iarg_facet ((0,false),0.5000,1164, + Iarg_leaf 1389))))))), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1587, + Iarg_facet ((2,true),0.5000,1027, + Iarg_facet ((4,true),0.6358,936, + Iarg_leaf 1204))), + Iarg_facet ((1,true),0.5000,1311, + Iarg_facet ((2,true),0.5000,807, + Iarg_facet ((4,true),0.6372,966, + Iarg_leaf 1531))))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1603, + Iarg_facet ((2,true),0.5000,1006, + Iarg_facet ((4,true),0.5000,868, + Iarg_leaf 1259))), + Iarg_facet ((1,true),0.5000,1259, + Iarg_facet ((2,true),0.5000,848, + Iarg_facet ((4,true),0.5000,820, + Iarg_leaf 1765)))), + Iarg_facet ((3,true),0.5000,1515, + Iarg_leaf 1723))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1609, + Iarg_facet ((2,true),0.5000,1343, + Iarg_leaf 1871)), + Iarg_facet ((1,true),0.5000,1407, + Iarg_facet ((2,true),0.5000,1158, + Iarg_facet ((4,true),0.6610,844, + Iarg_leaf 1407)))), + Iarg_facet ((3,true),0.5000,1557, + Iarg_leaf 1643)), + Iarg_facet ((5,true),0.5000,1009, + Iarg_facet ((3,true),0.5000,1579, + Iarg_leaf 1806)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,888, + Iarg_leaf 1911), + Iarg_facet ((2,true),0.5000,710, + Iarg_leaf 1347)), + Iarg_facet ((1,true),0.5000,1699, + Iarg_facet ((2,true),0.5000,826, + Iarg_facet ((4,true),0.6702,825, + Iarg_leaf 1409)))), + Iarg_facet ((3,true),0.5000,1456, + Iarg_leaf 1744)), + Iarg_facet ((5,true),0.5000,1030, + Iarg_facet ((3,true),0.5000,1587, + Iarg_leaf 1646))), + Iarg_facet ((4,true),0.5000,1404, + Iarg_facet ((5,true),0.5000,1177, + Iarg_facet ((3,true),0.5000,1653, + Iarg_leaf 1825))))));; + +add_case ("OXLZLEZ 6346351218 4 34", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1686, + Iarg_facet ((2,true),0.5000,1122, + Iarg_facet ((4,true),0.5000,713, + Iarg_leaf 1769))), + Iarg_facet ((1,true),0.5000,1611, + Iarg_facet ((2,true),0.5000,1089, + Iarg_facet ((4,true),0.6180,953, + Iarg_leaf 1357)))), + Iarg_facet ((0,false),0.5000,983, + Iarg_leaf 1164)), + Iarg_facet ((3,true),0.5000,921, + Iarg_facet ((0,true),0.5000,1846, + Iarg_leaf 1895))), + Iarg_facet ((5,true),0.5000,1569, + Iarg_facet ((3,true),0.5000,914, + Iarg_facet ((0,true),0.5000,1867, + Iarg_leaf 1917)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1825, + Iarg_facet ((3,true),0.5000,947, + Iarg_facet ((0,true),0.5000,1886, + Iarg_leaf 1933))), + Iarg_facet ((5,true),0.5000,723, + Iarg_facet ((3,true),0.6780,757, + Iarg_leaf 1176)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,953, + Iarg_facet ((0,true),0.5000,1876, + Iarg_leaf 1925)), + Iarg_facet ((3,true),0.7304,856, + Iarg_leaf 1079)), + Iarg_facet ((5,true),0.5000,724, + Iarg_leaf 1847)), + Iarg_facet ((4,true),0.5000,1075, + Iarg_facet ((5,true),0.5000,735, + Iarg_leaf 1648)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1655, + Iarg_bisect (5, + Iarg_facet ((3,true),0.6416,942, + Iarg_facet ((0,false),0.5000,1006, + Iarg_leaf 1046)), + Iarg_facet ((3,true),0.6530,934, + Iarg_facet ((0,false),0.5000,1125, + Iarg_leaf 1180)))), + Iarg_facet ((4,true),0.5000,774, + Iarg_leaf 1936)), + Iarg_facet ((2,true),0.5000,1429, + Iarg_facet ((4,true),0.5000,873, + Iarg_facet ((5,false),0.5000,1509, + Iarg_leaf 1687))))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,928, + Iarg_facet ((3,true),0.6292,912, + Iarg_facet ((0,false),0.5000,1056, + Iarg_leaf 1093))), + Iarg_facet ((5,true),0.5000,739, + Iarg_facet ((3,true),0.6545,914, + Iarg_facet ((0,false),0.5000,1163, + Iarg_leaf 1210)))), + Iarg_facet ((4,false),0.5000,1990, + Iarg_facet ((5,true),0.7638,816, + Iarg_leaf 1295))), + Iarg_facet ((2,true),0.5000,1435, + Iarg_facet ((4,true),0.5000,1206, + Iarg_leaf 1511))), + Iarg_facet ((1,true),0.5000,1564, + Iarg_facet ((2,true),0.5000,969, + Iarg_leaf 1533)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1084, + Iarg_facet ((3,true),0.6387,937, + Iarg_facet ((0,false),0.5000,1066, + Iarg_leaf 1122))), + Iarg_facet ((5,true),0.6642,764, + Iarg_leaf 1114)), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,872, + Iarg_facet ((3,true),0.6849,1018, + Iarg_facet ((0,false),0.5000,1180, + Iarg_leaf 1216))), + Iarg_facet ((5,true),0.7537,851, + Iarg_leaf 1340))), + Iarg_facet ((2,true),0.5000,1782, + Iarg_facet ((4,true),0.5000,727, + Iarg_leaf 1418))), + Iarg_facet ((1,true),0.5000,1731, + Iarg_facet ((2,true),0.5000,1456, + Iarg_leaf 1613))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1406, + Iarg_leaf 1609), + Iarg_facet ((4,false),0.5000,1616, + Iarg_leaf 1725)), + Iarg_facet ((2,true),0.5000,999, + Iarg_leaf 1054)), + Iarg_facet ((1,true),0.5000,894, + Iarg_leaf 1512)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1612, + Iarg_facet ((5,true),0.5000,1541, + Iarg_facet ((3,true),0.6334,948, + Iarg_facet ((0,false),0.5000,1053, + Iarg_leaf 1103)))), + Iarg_facet ((4,true),0.5000,708, + Iarg_leaf 1443)), + Iarg_facet ((2,true),0.5000,1758, + Iarg_facet ((4,true),0.5000,1327, + Iarg_facet ((5,true),0.5000,1713, + Iarg_facet ((3,true),0.6411,950, + Iarg_facet ((0,false),0.5000,1231, + Iarg_leaf 1289)))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1027, + Iarg_facet ((4,true),0.6294,950, + Iarg_facet ((5,false),0.5000,904, + Iarg_leaf 1144))), + Iarg_facet ((2,true),0.5000,965, + Iarg_facet ((4,true),0.6416,925, + Iarg_facet ((5,false),0.5000,1068, + Iarg_leaf 1199))))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,951, + Iarg_leaf 1634), + Iarg_facet ((2,true),0.5000,846, + Iarg_leaf 1475)), + Iarg_facet ((1,true),0.5000,1085, + Iarg_leaf 1257))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1900, + Iarg_facet ((2,true),0.5000,1071, + Iarg_leaf 1263)), + Iarg_facet ((1,true),0.5000,1128, + Iarg_leaf 1313)), + Iarg_facet ((5,true),0.5000,1070, + Iarg_facet ((1,true),0.5000,1080, + Iarg_leaf 1466))))));; + +add_case ("7550003505 2 3 3", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6542,717, + Iarg_leaf 1216), + Iarg_bisect (5, + Iarg_facet ((0,true),0.7492,901, + Iarg_facet ((1,true),0.7492,900, + Iarg_leaf 1961)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1416, + Iarg_facet ((3,false),0.5000,1776, + Iarg_facet ((4,false),0.5000,921, + Iarg_leaf 1120))), + Iarg_facet ((2,true),0.6676,786, + Iarg_leaf 1189)), + Iarg_facet ((1,true),0.7614,1047, + Iarg_leaf 1543)))), + Iarg_facet ((4,false),0.5000,1309, + Iarg_bisect (5, + Iarg_facet ((0,true),0.8141,1215, + Iarg_facet ((1,true),0.8362,1289, + Iarg_leaf 859)), + Iarg_facet ((0,true),0.5000,1717, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1224, + Iarg_facet ((4,false),0.5000,903, + Iarg_leaf 1152)), + Iarg_facet ((3,false),0.5000,1056, + Iarg_leaf 1216)), + Iarg_facet ((2,true),0.5000,1051, + Iarg_leaf 1909)))))), + Iarg_facet ((3,false),0.5000,1868, + Iarg_leaf 1975)), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_facet ((0,true),0.7205,932, + Iarg_facet ((1,true),0.7431,1085, + Iarg_facet ((2,true),0.5000,982, + Iarg_leaf 1145))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1521, + Iarg_facet ((3,true),0.5000,1269, + Iarg_leaf 1399)), + Iarg_facet ((4,false),0.5000,876, + Iarg_leaf 1291)), + Iarg_facet ((2,true),0.5000,871, + Iarg_facet ((4,true),0.5000,796, + Iarg_leaf 1573))), + Iarg_facet ((1,true),0.6665,793, + Iarg_facet ((2,true),0.5000,981, + Iarg_leaf 1766)))), + Iarg_bisect (5, + Iarg_facet ((0,true),0.7492,762, + Iarg_leaf 1812), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1045, + Iarg_leaf 1848), + Iarg_facet ((4,true),0.5000,1399, + Iarg_leaf 1461)), + Iarg_facet ((2,true),0.5000,1367, + Iarg_leaf 1689)), + Iarg_facet ((1,true),0.6875,1032, + Iarg_facet ((2,false),0.5000,1302, + Iarg_leaf 1538))))), + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,733, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,901, + Iarg_leaf 1856), + Iarg_facet ((1,true),0.7141,828, + Iarg_leaf 1461))), + Iarg_facet ((5,false),0.6206,1284, + Iarg_facet ((0,true),0.5000,1751, + Iarg_facet ((1,true),0.5000,811, + Iarg_leaf 1482))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1229, + Iarg_leaf 1720), + Iarg_facet ((4,false),0.5000,1149, + Iarg_leaf 1219)), + Iarg_facet ((2,true),0.5000,751, + Iarg_facet ((4,true),0.5000,1056, + Iarg_leaf 1291))), + Iarg_facet ((1,true),0.5000,1722, + Iarg_facet ((2,true),0.5000,1235, + Iarg_facet ((4,false),0.5000,1004, + Iarg_leaf 1453)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1170, + Iarg_leaf 1449), + Iarg_facet ((4,false),0.5000,1092, + Iarg_leaf 1338)), + Iarg_facet ((2,true),0.5000,1357, + Iarg_facet ((4,true),0.5000,880, + Iarg_leaf 1182))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1734, + Iarg_facet ((4,false),0.5000,1108, + Iarg_leaf 1489)), + Iarg_facet ((2,true),0.5000,888, + Iarg_leaf 1579)))), + Iarg_facet ((3,false),0.5000,1505, + Iarg_leaf 1698)), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1212, + Iarg_leaf 1753), + Iarg_facet ((1,true),0.5000,1444, + Iarg_facet ((2,true),0.5000,1207, + Iarg_leaf 1690))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1512, + Iarg_leaf 1850), + Iarg_facet ((1,true),0.5000,1498, + Iarg_facet ((2,false),0.5000,1408, + Iarg_leaf 1556)))), + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1060, + Iarg_facet ((1,true),0.5000,1128, + Iarg_leaf 1724)), + Iarg_facet ((0,false),0.5000,1122, + Iarg_facet ((1,true),0.5000,1651, + Iarg_leaf 1685))))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,747, + Iarg_facet ((3,true),0.8139,1230, + Iarg_facet ((4,false),0.8229,882, + Iarg_leaf 984))), + Iarg_bisect (5, + Iarg_facet ((3,true),0.7521,1050, + Iarg_facet ((4,true),0.5000,1430, + Iarg_facet ((5,false),0.6839,964, + Iarg_leaf 1967))), + Iarg_facet ((3,true),0.6103,848, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,809, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1127, + Iarg_facet ((2,false),0.5000,961, + Iarg_leaf 1268)), + Iarg_facet ((1,false),0.5000,869, + Iarg_leaf 1770))), + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1452, + Iarg_facet ((1,false),0.5000,1023, + Iarg_leaf 1192)), + Iarg_facet ((0,false),0.8080,856, + Iarg_leaf 561))))))));; + +add_case ("OXLZLEZ 6346351218 3 8", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1360, + Iarg_facet ((2,true),0.5000,918, + Iarg_leaf 1790)), + Iarg_facet ((1,true),0.5000,1324, + Iarg_facet ((2,true),0.5000,909, + Iarg_leaf 1859))), + Iarg_facet ((0,false),0.5000,1464, + Iarg_leaf 1468)), + Iarg_facet ((5,true),0.5000,1043, + Iarg_facet ((0,true),0.5000,1503, + Iarg_leaf 1519))), + Iarg_facet ((4,true),0.5000,960, + Iarg_facet ((5,true),0.6263,948, + Iarg_leaf 1174))), + Iarg_facet ((3,true),0.5000,1492, + Iarg_facet ((4,true),0.5000,1836, + Iarg_facet ((5,true),0.5000,1261, + Iarg_facet ((0,true),0.5000,1544, + Iarg_leaf 1552))))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1501, + Iarg_facet ((4,true),0.5000,1713, + Iarg_facet ((5,true),0.5000,1373, + Iarg_facet ((0,true),0.5000,1527, + Iarg_leaf 1534)))), + Iarg_facet ((3,true),0.5000,786, + Iarg_facet ((4,true),0.6263,924, + Iarg_leaf 1290)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1227, + Iarg_facet ((4,true),0.5000,1060, + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1055, + Iarg_leaf 1135), + Iarg_facet ((0,false),0.5000,1050, + Iarg_leaf 1184)))), + Iarg_facet ((3,true),0.6398,880, + Iarg_leaf 1358)), + Iarg_facet ((2,true),0.5000,1162, + Iarg_facet ((3,true),0.6291,994, + Iarg_facet ((4,true),0.6861,711, + Iarg_leaf 1405))))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1224, + Iarg_bisect (4, + Iarg_facet ((5,true),0.7692,1293, + Iarg_leaf 1448), + Iarg_facet ((5,true),0.6956,892, + Iarg_leaf 1747))), + Iarg_facet ((3,true),0.5000,704, + Iarg_facet ((4,false),0.5000,1270, + Iarg_leaf 1299))), + Iarg_facet ((2,true),0.5000,1230, + Iarg_facet ((3,true),0.6296,877, + Iarg_leaf 1407))), + Iarg_facet ((1,true),0.5000,1150, + Iarg_leaf 1875))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1963, + Iarg_facet ((3,true),0.5000,1407, + Iarg_leaf 1982)), + Iarg_facet ((2,true),0.5000,1221, + Iarg_leaf 1933)), + Iarg_facet ((1,true),0.5000,1386, + Iarg_facet ((2,true),0.5000,914, + Iarg_leaf 1522))), + Iarg_facet ((5,true),0.5000,1268, + Iarg_facet ((1,true),0.5000,1507, + Iarg_facet ((2,true),0.5000,997, + Iarg_leaf 1590))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1098, + Iarg_facet ((4,true),0.5000,1356, + Iarg_facet ((5,true),0.5000,729, + Iarg_facet ((0,false),0.5000,1118, + Iarg_leaf 1198)))), + Iarg_facet ((3,true),0.5000,955, + Iarg_facet ((4,true),0.5000,1385, + Iarg_facet ((5,true),0.6387,959, + Iarg_leaf 1978)))), + Iarg_facet ((2,true),0.5000,1555, + Iarg_leaf 1867)), + Iarg_facet ((1,true),0.5000,1301, + Iarg_facet ((2,true),0.5000,1184, + Iarg_leaf 1375))), + Iarg_facet ((5,true),0.5000,1680, + Iarg_facet ((1,true),0.5000,1694, + Iarg_bisect (2, + Iarg_facet ((3,true),0.6573,766, + Iarg_leaf 1432), + Iarg_facet ((3,true),0.6851,743, + Iarg_leaf 1600))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1492, + Iarg_facet ((1,true),0.5000,1618, + Iarg_facet ((2,true),0.5000,1242, + Iarg_leaf 1520))), + Iarg_facet ((5,true),0.6603,795, + Iarg_leaf 1186)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1852, + Iarg_facet ((3,true),0.5000,1088, + Iarg_facet ((4,true),0.5000,1050, + Iarg_facet ((5,true),0.5000,1063, + Iarg_facet ((0,false),0.5000,1096, + Iarg_leaf 1184))))), + Iarg_facet ((2,true),0.5000,1491, + Iarg_facet ((3,true),0.5000,929, + Iarg_facet ((4,true),0.5000,895, + Iarg_facet ((5,true),0.5000,1141, + Iarg_facet ((0,false),0.5000,1145, + Iarg_leaf 1278)))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,843, + Iarg_facet ((3,true),0.7859,1061, + Iarg_leaf 1205)), + Iarg_facet ((2,true),0.5000,744, + Iarg_facet ((3,true),0.7628,882, + Iarg_leaf 1434)))), + Iarg_facet ((5,true),0.5000,1651, + Iarg_facet ((1,true),0.5000,1860, + Iarg_facet ((2,true),0.5000,766, + Iarg_leaf 1414)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1632, + Iarg_facet ((1,true),0.5000,1830, + Iarg_facet ((2,true),0.5000,888, + Iarg_leaf 1480))), + Iarg_facet ((5,true),0.6568,844, + Iarg_leaf 1120))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1816, + Iarg_facet ((1,true),0.5000,1606, + Iarg_facet ((2,true),0.5000,909, + Iarg_leaf 1101))), + Iarg_facet ((5,true),0.5000,922, + Iarg_leaf 1908)), + Iarg_facet ((4,true),0.5000,779, + Iarg_facet ((5,true),0.6432,829, + Iarg_leaf 1261))))));; + +add_case ("OXLZLEZ 6346351218 2 35", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1261, + Iarg_facet ((2,true),0.5000,889, + Iarg_facet ((4,true),0.6372,995, + Iarg_leaf 1928))), + Iarg_facet ((1,true),0.5000,843, + Iarg_leaf 1836)), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1494, + Iarg_facet ((2,true),0.5000,1077, + Iarg_facet ((4,true),0.5000,745, + Iarg_facet ((5,true),0.6564,876, + Iarg_leaf 1656)))), + Iarg_facet ((1,true),0.5000,901, + Iarg_facet ((2,true),0.6405,842, + Iarg_leaf 1080)))), + Iarg_facet ((0,false),0.5000,1901, + Iarg_facet ((3,true),0.5000,884, + Iarg_leaf 1229))), + Iarg_facet ((5,true),0.5000,1277, + Iarg_facet ((0,false),0.5000,1971, + Iarg_facet ((3,true),0.5000,922, + Iarg_leaf 1252)))), + Iarg_facet ((4,true),0.5000,1903, + Iarg_facet ((5,true),0.5000,1298, + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,886, + Iarg_leaf 1137), + Iarg_facet ((3,true),0.5000,940, + Iarg_leaf 1262))))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1758, + Iarg_facet ((5,true),0.5000,1489, + Iarg_facet ((0,false),0.5000,1998, + Iarg_facet ((3,true),0.5000,930, + Iarg_leaf 1254)))), + Iarg_facet ((4,true),0.6332,973, + Iarg_leaf 1424))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((3,false),0.5000,1983, + Iarg_facet ((1,true),0.6241,861, + Iarg_leaf 1210)), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,739, + Iarg_leaf 1529), + Iarg_facet ((1,true),0.5000,755, + Iarg_leaf 1610))), + Iarg_facet ((0,false),0.5000,1345, + Iarg_leaf 1421)), + Iarg_facet ((5,true),0.5000,1053, + Iarg_facet ((0,false),0.5000,1351, + Iarg_leaf 1439))), + Iarg_facet ((4,true),0.5000,1526, + Iarg_facet ((5,true),0.5000,1018, + Iarg_facet ((0,false),0.5000,1399, + Iarg_leaf 1493)))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1480, + Iarg_facet ((5,true),0.5000,1117, + Iarg_facet ((0,false),0.5000,1385, + Iarg_leaf 1459))), + Iarg_facet ((4,true),0.6277,921, + Iarg_leaf 1147)))), + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1550, + Iarg_facet ((4,true),0.5000,1027, + Iarg_facet ((5,true),0.5000,1652, + Iarg_facet ((0,false),0.5000,1054, + Iarg_leaf 1059)))), + Iarg_facet ((2,true),0.6186,950, + Iarg_leaf 1469)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1347, + Iarg_facet ((4,true),0.5000,942, + Iarg_facet ((5,true),0.5000,1202, + Iarg_leaf 1444))), + Iarg_facet ((2,true),0.6395,887, + Iarg_leaf 1177)))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1791, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6366,985, + Iarg_leaf 1623), + Iarg_facet ((5,true),0.7038,810, + Iarg_leaf 1188))), + Iarg_facet ((2,true),0.5000,713, + Iarg_leaf 1554)), + Iarg_facet ((1,true),0.5000,1987, + Iarg_facet ((2,true),0.5000,1467, + Iarg_facet ((4,true),0.5000,1542, + Iarg_leaf 1969)))), + Iarg_facet ((3,true),0.5000,1657, + Iarg_leaf 1824))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1034, + Iarg_facet ((5,true),0.6163,962, + Iarg_leaf 1737)), + Iarg_facet ((4,true),0.5000,806, + Iarg_facet ((5,true),0.7196,830, + Iarg_leaf 1113))), + Iarg_facet ((2,true),0.5000,909, + Iarg_leaf 1282)), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,881, + Iarg_facet ((5,true),0.6512,890, + Iarg_leaf 1128)), + Iarg_facet ((4,true),0.6672,964, + Iarg_leaf 1147)), + Iarg_facet ((2,true),0.5000,842, + Iarg_leaf 1199))), + Iarg_facet ((3,true),0.5000,1745, + Iarg_facet ((1,true),0.5000,708, + Iarg_leaf 1306))), + Iarg_facet ((5,true),0.5000,1266, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,840, + Iarg_leaf 1882), + Iarg_facet ((1,true),0.6350,901, + Iarg_leaf 1159))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1269, + Iarg_facet ((4,true),0.5000,965, + Iarg_facet ((5,true),0.5000,771, + Iarg_facet ((0,true),0.5000,1131, + Iarg_leaf 1142)))), + Iarg_facet ((2,true),0.5000,888, + Iarg_facet ((4,true),0.6315,976, + Iarg_leaf 1841))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1200, + Iarg_facet ((4,true),0.5000,818, + Iarg_facet ((5,true),0.6342,925, + Iarg_leaf 1220))), + Iarg_facet ((2,true),0.5000,832, + Iarg_facet ((4,true),0.6889,931, + Iarg_leaf 1109)))), + Iarg_facet ((3,true),0.5000,1915, + Iarg_facet ((1,true),0.5000,1068, + Iarg_leaf 1435))), + Iarg_facet ((5,true),0.5000,1317, + Iarg_facet ((3,true),0.5000,1764, + Iarg_facet ((1,true),0.5000,866, + Iarg_leaf 1227)))), + Iarg_facet ((4,true),0.5000,1909, + Iarg_facet ((5,true),0.5000,1483, + Iarg_facet ((3,true),0.5000,1952, + Iarg_facet ((1,true),0.5000,888, + Iarg_leaf 1245)))))));; + +add_case ("OXLZLEZ 6346351218 2 9", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1425, + Iarg_facet ((2,true),0.5000,950, + Iarg_leaf 1805)), + Iarg_facet ((1,true),0.5000,1303, + Iarg_facet ((2,true),0.5000,881, + Iarg_leaf 1717))), + Iarg_facet ((0,true),0.5000,1477, + Iarg_leaf 1552)), + Iarg_facet ((5,true),0.5000,1098, + Iarg_facet ((0,true),0.5000,1516, + Iarg_leaf 1603))), + Iarg_facet ((4,true),0.5000,964, + Iarg_facet ((5,true),0.6407,954, + Iarg_leaf 1135))), + Iarg_facet ((3,true),0.5000,1559, + Iarg_facet ((4,true),0.5000,1950, + Iarg_facet ((5,true),0.5000,1336, + Iarg_facet ((0,true),0.5000,1555, + Iarg_leaf 1633))))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1574, + Iarg_facet ((4,true),0.5000,1823, + Iarg_facet ((5,true),0.5000,1462, + Iarg_facet ((0,true),0.5000,1548, + Iarg_leaf 1639)))), + Iarg_facet ((3,true),0.5000,796, + Iarg_facet ((4,true),0.6169,961, + Iarg_leaf 1402)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1318, + Iarg_facet ((4,true),0.5000,1141, + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1147, + Iarg_leaf 1175), + Iarg_facet ((0,false),0.5000,1225, + Iarg_leaf 1280)))), + Iarg_facet ((3,true),0.6321,910, + Iarg_leaf 1562)), + Iarg_facet ((2,true),0.5000,1275, + Iarg_facet ((3,true),0.6177,1007, + Iarg_facet ((4,true),0.7936,1141, + Iarg_leaf 1397))))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1320, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6326,1025, + Iarg_facet ((0,false),0.5000,986, + Iarg_leaf 1021)), + Iarg_facet ((5,true),0.6638,911, + Iarg_facet ((0,false),0.5000,993, + Iarg_leaf 1061)))), + Iarg_facet ((3,true),0.5000,731, + Iarg_facet ((4,false),0.5000,1378, + Iarg_leaf 1475))), + Iarg_facet ((2,true),0.5000,1349, + Iarg_facet ((3,true),0.6224,903, + Iarg_leaf 1582))), + Iarg_facet ((1,true),0.5000,1229, + Iarg_facet ((2,true),0.5000,773, + Iarg_leaf 1289)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1972, + Iarg_facet ((3,true),0.5000,1432, + Iarg_leaf 1968)), + Iarg_facet ((2,true),0.5000,1264, + Iarg_leaf 1963)), + Iarg_facet ((1,true),0.5000,1449, + Iarg_facet ((2,true),0.5000,936, + Iarg_leaf 1550))), + Iarg_facet ((5,true),0.5000,1309, + Iarg_facet ((1,true),0.5000,1536, + Iarg_facet ((2,true),0.5000,1025, + Iarg_leaf 1628))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1137, + Iarg_facet ((4,true),0.5000,1488, + Iarg_facet ((5,true),0.5000,804, + Iarg_facet ((0,false),0.5000,1233, + Iarg_leaf 1238)))), + Iarg_facet ((3,true),0.5000,1015, + Iarg_facet ((4,true),0.5000,1580, + Iarg_facet ((5,true),0.6260,1023, + Iarg_facet ((0,false),0.5000,1065, + Iarg_leaf 1128))))), + Iarg_facet ((2,true),0.5000,1663, + Iarg_facet ((3,true),0.8245,1224, + Iarg_leaf 663))), + Iarg_facet ((1,true),0.5000,1379, + Iarg_facet ((2,true),0.5000,1302, + Iarg_leaf 1484))), + Iarg_facet ((5,true),0.5000,1813, + Iarg_facet ((1,true),0.5000,1814, + Iarg_bisect (2, + Iarg_facet ((3,true),0.6469,865, + Iarg_leaf 1733), + Iarg_facet ((3,true),0.6660,759, + Iarg_leaf 1823))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1568, + Iarg_facet ((1,true),0.5000,1655, + Iarg_facet ((2,true),0.5000,1265, + Iarg_leaf 1546))), + Iarg_facet ((5,true),0.6575,826, + Iarg_leaf 1240)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1124, + Iarg_facet ((4,true),0.5000,1150, + Iarg_facet ((5,true),0.5000,1223, + Iarg_facet ((0,true),0.5000,1258, + Iarg_leaf 1272)))), + Iarg_facet ((3,true),0.6489,799, + Iarg_leaf 1053)), + Iarg_facet ((2,true),0.5000,1616, + Iarg_facet ((3,true),0.5000,995, + Iarg_facet ((4,true),0.5000,972, + Iarg_facet ((5,true),0.5000,1265, + Iarg_facet ((0,false),0.5000,1330, + Iarg_leaf 1359)))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,885, + Iarg_facet ((3,true),0.6651,793, + Iarg_leaf 1643)), + Iarg_facet ((2,true),0.5000,785, + Iarg_facet ((3,true),0.6829,746, + Iarg_leaf 1926)))), + Iarg_facet ((5,true),0.5000,1780, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,809, + Iarg_leaf 1567), + Iarg_facet ((2,true),0.6252,851, + Iarg_leaf 1120)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1697, + Iarg_facet ((1,true),0.5000,1880, + Iarg_facet ((2,true),0.5000,907, + Iarg_leaf 1500))), + Iarg_facet ((5,true),0.6574,886, + Iarg_leaf 1168))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1952, + Iarg_facet ((1,true),0.5000,1692, + Iarg_facet ((2,true),0.5000,970, + Iarg_leaf 1173))), + Iarg_facet ((5,true),0.5000,977, + Iarg_facet ((1,true),0.5000,876, + Iarg_leaf 1181))), + Iarg_facet ((4,true),0.5000,805, + Iarg_facet ((5,true),0.6374,861, + Iarg_leaf 1325))))));; + +add_case ("OXLZLEZ 6346351218 4 35", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1692, + Iarg_facet ((2,true),0.5000,1125, + Iarg_facet ((4,true),0.5000,714, + Iarg_leaf 1778))), + Iarg_facet ((1,true),0.5000,1611, + Iarg_facet ((2,true),0.5000,1096, + Iarg_facet ((4,true),0.6085,937, + Iarg_leaf 1370)))), + Iarg_facet ((0,false),0.5000,982, + Iarg_leaf 1164)), + Iarg_facet ((3,true),0.5000,920, + Iarg_facet ((0,true),0.5000,1846, + Iarg_leaf 1901))), + Iarg_facet ((5,true),0.5000,1568, + Iarg_facet ((3,true),0.5000,913, + Iarg_facet ((0,true),0.5000,1864, + Iarg_leaf 1913)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1823, + Iarg_facet ((3,true),0.5000,947, + Iarg_facet ((0,true),0.5000,1883, + Iarg_leaf 1931))), + Iarg_facet ((5,true),0.5000,722, + Iarg_facet ((3,true),0.6782,757, + Iarg_leaf 1174)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,954, + Iarg_facet ((0,true),0.5000,1883, + Iarg_leaf 1924)), + Iarg_facet ((3,true),0.6770,767, + Iarg_leaf 1144)), + Iarg_facet ((5,true),0.5000,725, + Iarg_leaf 1848)), + Iarg_facet ((4,true),0.5000,1076, + Iarg_facet ((5,true),0.5000,735, + Iarg_leaf 1649)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1654, + Iarg_bisect (5, + Iarg_facet ((3,true),0.6408,946, + Iarg_facet ((0,false),0.5000,1017, + Iarg_leaf 1048)), + Iarg_facet ((3,true),0.6521,936, + Iarg_facet ((0,false),0.5000,1135, + Iarg_leaf 1191)))), + Iarg_facet ((4,true),0.5000,772, + Iarg_leaf 1933)), + Iarg_facet ((2,true),0.5000,1430, + Iarg_facet ((4,true),0.5000,871, + Iarg_facet ((5,false),0.5000,1508, + Iarg_leaf 1687))))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,928, + Iarg_facet ((3,true),0.6423,924, + Iarg_facet ((0,false),0.5000,1044, + Iarg_leaf 1081))), + Iarg_facet ((5,true),0.5000,739, + Iarg_facet ((3,true),0.6250,862, + Iarg_facet ((0,false),0.5000,1225, + Iarg_leaf 1302)))), + Iarg_facet ((4,false),0.5000,1986, + Iarg_facet ((5,true),0.7550,809, + Iarg_leaf 1346))), + Iarg_facet ((2,true),0.5000,1432, + Iarg_facet ((4,true),0.5000,1204, + Iarg_leaf 1512))), + Iarg_facet ((1,true),0.5000,1562, + Iarg_facet ((2,true),0.5000,967, + Iarg_leaf 1533)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1082, + Iarg_facet ((3,true),0.6387,934, + Iarg_facet ((0,false),0.5000,1066, + Iarg_leaf 1121))), + Iarg_facet ((5,true),0.6640,764, + Iarg_leaf 1114)), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,871, + Iarg_facet ((3,true),0.6456,944, + Iarg_facet ((0,false),0.5000,1242, + Iarg_leaf 1281))), + Iarg_facet ((5,true),0.7538,850, + Iarg_leaf 1339))), + Iarg_facet ((2,true),0.5000,1782, + Iarg_facet ((4,true),0.5000,726, + Iarg_leaf 1418))), + Iarg_facet ((1,true),0.5000,1730, + Iarg_facet ((2,true),0.5000,1454, + Iarg_leaf 1612))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1407, + Iarg_leaf 1612), + Iarg_facet ((4,false),0.5000,1613, + Iarg_leaf 1724)), + Iarg_facet ((2,true),0.5000,999, + Iarg_leaf 1055)), + Iarg_facet ((1,true),0.5000,893, + Iarg_leaf 1510)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1612, + Iarg_facet ((5,true),0.5000,1541, + Iarg_facet ((3,true),0.6332,949, + Iarg_facet ((0,false),0.5000,1053, + Iarg_leaf 1105)))), + Iarg_facet ((4,true),0.5000,707, + Iarg_leaf 1444)), + Iarg_facet ((2,true),0.5000,1757, + Iarg_facet ((4,true),0.5000,1327, + Iarg_facet ((5,true),0.5000,1708, + Iarg_facet ((3,true),0.6413,951, + Iarg_facet ((0,false),0.5000,1233, + Iarg_leaf 1286)))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1027, + Iarg_facet ((4,true),0.6291,950, + Iarg_facet ((5,false),0.5000,904, + Iarg_leaf 1148))), + Iarg_facet ((2,true),0.5000,964, + Iarg_facet ((4,true),0.6416,925, + Iarg_facet ((5,false),0.5000,1068, + Iarg_leaf 1200))))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,951, + Iarg_leaf 1633), + Iarg_facet ((2,true),0.5000,846, + Iarg_leaf 1474)), + Iarg_facet ((1,true),0.5000,1085, + Iarg_leaf 1259))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1900, + Iarg_facet ((2,true),0.5000,1067, + Iarg_leaf 1259)), + Iarg_facet ((1,true),0.5000,1128, + Iarg_leaf 1309)), + Iarg_facet ((5,true),0.5000,1075, + Iarg_facet ((1,true),0.5000,1080, + Iarg_leaf 1465))))));; + +add_case ("QITNPEA 9939613598 split(1/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1594, + Iarg_facet ((5,true),0.5000,1317, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1582, + Iarg_facet ((1,true),0.6690,750, + Iarg_leaf 1694)), + Iarg_facet ((0,true),0.5000,1803, + Iarg_facet ((1,true),0.6390,886, + Iarg_leaf 1657))))), + Iarg_facet ((4,true),0.7904,1063, + Iarg_leaf 951)), + Iarg_facet ((2,true),0.5000,705, + Iarg_facet ((4,true),0.6839,753, + Iarg_leaf 1347))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1512, + Iarg_facet ((5,true),0.5000,1382, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1329, + Iarg_leaf 1420), + Iarg_facet ((0,false),0.5000,1563, + Iarg_leaf 1761)))), + Iarg_facet ((4,true),0.6653,875, + Iarg_leaf 1366)), + Iarg_facet ((2,true),0.5000,719, + Iarg_leaf 1915))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,735, + Iarg_facet ((2,true),0.6615,850, + Iarg_leaf 1927)), + Iarg_facet ((1,true),0.7513,1217, + Iarg_leaf 1201)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1279, + Iarg_facet ((2,true),0.5000,940, + Iarg_facet ((4,true),0.5000,720, + Iarg_facet ((5,true),0.6537,1030, + Iarg_facet ((3,false),0.5000,1236, + Iarg_facet ((0,true),0.5000,746, + Iarg_leaf 1378)))))), + Iarg_facet ((1,true),0.5000,1059, + Iarg_facet ((2,true),0.5000,757, + Iarg_facet ((4,true),0.6501,941, + Iarg_leaf 1918))))), + Iarg_facet ((3,false),0.5000,924, + Iarg_leaf 1483)), + Iarg_facet ((5,true),0.6508,991, + Iarg_leaf 1893)), + Iarg_facet ((4,true),0.5000,722, + Iarg_facet ((5,true),0.6434,882, + Iarg_leaf 1955))), + Iarg_facet ((2,true),0.5000,1024, + Iarg_facet ((4,true),0.5000,713, + Iarg_facet ((5,true),0.6587,960, + Iarg_leaf 1913)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6480,927, + Iarg_leaf 1303), + Iarg_facet ((1,true),0.5000,709, + Iarg_leaf 1772)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1127, + Iarg_facet ((2,true),0.5000,788, + Iarg_facet ((4,true),0.6503,950, + Iarg_leaf 1726))), + Iarg_facet ((1,true),0.5000,1387, + Iarg_facet ((2,true),0.5000,984, + Iarg_facet ((4,true),0.5000,717, + Iarg_facet ((5,true),0.6587,899, + Iarg_leaf 1548)))))), + Iarg_facet ((3,false),0.5000,992, + Iarg_leaf 1754)), + Iarg_facet ((5,true),0.6229,1070, + Iarg_facet ((3,false),0.5000,818, + Iarg_leaf 1448))), + Iarg_facet ((4,true),0.5000,886, + Iarg_facet ((5,true),0.6332,1046, + Iarg_facet ((3,false),0.5000,809, + Iarg_leaf 1469)))), + Iarg_facet ((2,true),0.5000,1228, + Iarg_facet ((4,true),0.5000,858, + Iarg_facet ((5,true),0.6269,1065, + Iarg_facet ((3,false),0.5000,829, + Iarg_leaf 1476))))))), + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1420, + Iarg_leaf 1506), + Iarg_bisect (0, + Iarg_facet ((1,true),0.6277,891, + Iarg_leaf 1388), + Iarg_facet ((1,true),0.5000,758, + Iarg_leaf 1925)))), + Iarg_facet ((5,true),0.5000,1787, + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1402, + Iarg_leaf 1494), + Iarg_bisect (0, + Iarg_facet ((1,true),0.6366,884, + Iarg_leaf 1380), + Iarg_facet ((1,true),0.5000,725, + Iarg_leaf 1961))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1643, + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1407, + Iarg_leaf 1500), + Iarg_bisect (0, + Iarg_facet ((1,true),0.6215,887, + Iarg_leaf 1391), + Iarg_facet ((1,true),0.5000,774, + Iarg_leaf 1918)))), + Iarg_facet ((5,true),0.6770,805, + Iarg_leaf 1312))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1780, + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1407, + Iarg_leaf 1492), + Iarg_bisect (0, + Iarg_facet ((2,true),0.6119,872, + Iarg_leaf 1394), + Iarg_facet ((2,true),0.5000,774, + Iarg_leaf 1904)))), + Iarg_facet ((5,true),0.6768,798, + Iarg_leaf 1230)), + Iarg_facet ((4,true),0.6348,980, + Iarg_leaf 1901))), + Iarg_facet ((1,true),0.5000,1677, + Iarg_facet ((2,true),0.5000,1088, + Iarg_facet ((4,true),0.5000,886, + Iarg_facet ((5,true),0.5000,814, + Iarg_facet ((3,false),0.5000,852, + Iarg_leaf 1301)))))), + Iarg_facet ((5,true),0.5000,1708, + Iarg_facet ((1,true),0.5000,1645, + Iarg_facet ((2,true),0.5000,1188, + Iarg_facet ((4,true),0.5000,1152, + Iarg_facet ((5,true),0.6290,967, + Iarg_leaf 1794)))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1853, + Iarg_facet ((1,true),0.5000,1850, + Iarg_facet ((2,true),0.5000,1607, + Iarg_facet ((4,true),0.5000,774, + Iarg_facet ((5,true),0.6556,854, + Iarg_leaf 1829))))), + Iarg_facet ((5,true),0.5000,731, + Iarg_leaf 1880))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1725, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1150, + Iarg_facet ((4,true),0.5000,720, + Iarg_facet ((5,true),0.6349,944, + Iarg_leaf 1931))), + Iarg_facet ((2,true),0.6221,903, + Iarg_leaf 1337))), + Iarg_facet ((5,true),0.5000,736, + Iarg_leaf 1887)), + Iarg_facet ((4,true),0.5000,1048, + Iarg_facet ((5,true),0.5000,841, + Iarg_facet ((1,true),0.5000,887, + Iarg_leaf 1130))))));; + +add_case ("7550003505 3 3 4", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,1148, + Iarg_leaf 1792), + Iarg_facet ((5,true),0.7770,1044, + Iarg_leaf 1437)), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,1068, + Iarg_facet ((0,true),0.5000,740, + Iarg_facet ((1,true),0.8124,936, + Iarg_leaf 1685))), + Iarg_facet ((5,false),0.5932,702, + Iarg_facet ((0,true),0.5000,1562, + Iarg_facet ((1,true),0.5000,1511, + Iarg_facet ((2,true),0.5000,1114, + Iarg_bisect (4, + Iarg_facet ((3,true),0.5000,1481, + Iarg_leaf 1720), + Iarg_facet ((3,true),0.5000,1095, + Iarg_leaf 1242))))))), + Iarg_facet ((3,false),0.5000,706, + Iarg_facet ((5,false),0.7384,736, + Iarg_facet ((0,false),0.5000,957, + Iarg_leaf 1345)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1153, + Iarg_facet ((1,true),0.7492,824, + Iarg_leaf 1822)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1343, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1086, + Iarg_facet ((3,false),0.5000,1061, + Iarg_leaf 1324)), + Iarg_facet ((5,true),0.5000,964, + Iarg_leaf 1728))), + Iarg_facet ((2,true),0.8123,1253, + Iarg_leaf 1526)), + Iarg_facet ((1,true),0.5000,966, + Iarg_facet ((2,true),0.8204,812, + Iarg_leaf 1555)))), + Iarg_facet ((3,false),0.5733,1079, + Iarg_facet ((0,false),0.5000,1841, + Iarg_leaf 1956))), + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,1334, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6951,725, + Iarg_leaf 1546), + Iarg_facet ((1,true),0.5000,776, + Iarg_facet ((2,true),0.5000,1391, + Iarg_facet ((5,false),0.5000,1179, + Iarg_leaf 1491))))), + Iarg_facet ((3,false),0.5912,935, + Iarg_facet ((0,false),0.6542,799, + Iarg_leaf 1906)))))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.6425,915, + Iarg_leaf 1020), + Iarg_bisect (5, + Iarg_facet ((3,true),0.9979,1859, + Iarg_facet ((4,true),0.5000,704, + Iarg_leaf 1393)), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1508, + Iarg_facet ((4,true),0.5000,1787, + Iarg_facet ((5,true),0.5000,743, + Iarg_leaf 1406))), + Iarg_facet ((3,true),0.5000,913, + Iarg_leaf 1292)), + Iarg_facet ((2,true),0.5000,1088, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1325, + Iarg_leaf 1514), + Iarg_facet ((4,true),0.5000,1255, + Iarg_leaf 1436)))), + Iarg_facet ((1,true),0.5000,1403, + Iarg_facet ((2,true),0.7212,1049, + Iarg_facet ((3,true),0.5939,727, + Iarg_leaf 1388)))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.6334,814, + Iarg_facet ((2,true),0.6721,864, + Iarg_leaf 1449)), + Iarg_facet ((1,false),0.5000,1429, + Iarg_facet ((2,true),0.8617,797, + Iarg_leaf 867)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1412, + Iarg_facet ((2,false),0.6358,1200, + Iarg_leaf 1675)), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1047, + Iarg_facet ((5,false),0.5000,818, + Iarg_leaf 1190)), + Iarg_facet ((3,true),0.5000,1459, + Iarg_leaf 1471)), + Iarg_facet ((2,true),0.5000,1082, + Iarg_leaf 1098))), + Iarg_facet ((0,false),0.5000,1397, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1415, + Iarg_leaf 1754), + Iarg_facet ((2,true),0.5000,1180, + Iarg_leaf 1794))))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1673, + Iarg_facet ((0,true),0.5000,1373, + Iarg_facet ((1,false),0.8245,1038, + Iarg_leaf 768))), + Iarg_facet ((5,false),0.5000,1688, + Iarg_facet ((0,false),0.5000,1345, + Iarg_facet ((1,false),0.5000,1228, + Iarg_facet ((2,false),0.5000,1021, + Iarg_leaf 1269))))))))));; + +add_case ("5451229371", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1370, + Iarg_facet ((5,true),0.5000,1016, + Iarg_facet ((3,false),0.5000,1092, + Iarg_facet ((0,true),0.5000,961, + Iarg_leaf 1075)))), + Iarg_facet ((4,true),0.5000,700, + Iarg_leaf 1931)), + Iarg_facet ((2,true),0.5000,1201, + Iarg_facet ((4,true),0.6461,936, + Iarg_leaf 1637))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1946, + Iarg_facet ((4,true),0.5000,1284, + Iarg_facet ((5,true),0.5000,867, + Iarg_facet ((3,false),0.5000,779, + Iarg_leaf 1949)))), + Iarg_facet ((2,true),0.5000,976, + Iarg_leaf 1966))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1398, + Iarg_leaf 1598), + Iarg_facet ((1,true),0.5000,1436, + Iarg_facet ((2,true),0.6195,991, + Iarg_leaf 1158)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1222, + Iarg_leaf 1783), + Iarg_facet ((1,true),0.5000,1175, + Iarg_facet ((2,true),0.5000,972, + Iarg_leaf 1379))), + Iarg_facet ((0,false),0.5000,1627, + Iarg_leaf 1726))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1188, + Iarg_leaf 1964), + Iarg_facet ((1,true),0.5000,870, + Iarg_leaf 1633)), + Iarg_facet ((0,true),0.5000,1293, + Iarg_leaf 1624)), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1225, + Iarg_leaf 1742), + Iarg_facet ((1,true),0.5000,844, + Iarg_leaf 1436)), + Iarg_facet ((0,true),0.5000,1255, + Iarg_leaf 1437)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((2,true),0.5000,1182, + Iarg_leaf 1955), + Iarg_facet ((2,true),0.5000,864, + Iarg_leaf 1632)), + Iarg_bisect (0, + Iarg_facet ((2,true),0.5000,1235, + Iarg_leaf 1750), + Iarg_facet ((2,true),0.5000,832, + Iarg_leaf 1446))), + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1303, + Iarg_leaf 1624), + Iarg_facet ((0,true),0.5000,1244, + Iarg_leaf 1434))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,964, + Iarg_leaf 1607), + Iarg_facet ((0,true),0.5000,1014, + Iarg_leaf 1507)), + Iarg_facet ((5,true),0.5000,1820, + Iarg_facet ((0,true),0.5000,1016, + Iarg_leaf 1505))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((3,false),0.5949,1045, + Iarg_facet ((0,false),0.5000,1034, + Iarg_leaf 1235)), + Iarg_facet ((3,false),0.5000,869, + Iarg_facet ((1,true),0.5000,869, + Iarg_facet ((2,true),0.6342,960, + Iarg_facet ((4,true),0.6537,865, + Iarg_leaf 1634))))), + Iarg_facet ((0,false),0.5000,912, + Iarg_leaf 1294)), + Iarg_facet ((5,true),0.5000,1016, + Iarg_facet ((0,false),0.5000,909, + Iarg_leaf 1305))), + Iarg_facet ((4,true),0.5000,1313, + Iarg_facet ((5,true),0.6206,991, + Iarg_leaf 1176))), + Iarg_facet ((2,true),0.5000,1483, + Iarg_facet ((4,true),0.5000,1195, + Iarg_facet ((5,true),0.5000,818, + Iarg_leaf 1429)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1670, + Iarg_facet ((4,true),0.5000,1317, + Iarg_facet ((0,false),0.5000,1022, + Iarg_leaf 1141))), + Iarg_facet ((2,true),0.5000,1095, + Iarg_facet ((4,true),0.5000,902, + Iarg_leaf 1379)))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((5,true),0.5000,1313, + Iarg_facet ((0,false),0.5000,1014, + Iarg_leaf 1118)), + Iarg_facet ((5,true),0.5000,896, + Iarg_leaf 1358)), + Iarg_facet ((2,true),0.5000,1083, + Iarg_leaf 1665)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1209, + Iarg_leaf 1799), + Iarg_facet ((2,true),0.5000,759, + Iarg_leaf 1209)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1472, + Iarg_facet ((4,true),0.5000,1179, + Iarg_leaf 1361)), + Iarg_facet ((1,true),0.5000,1155, + Iarg_leaf 1574)), + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1449, + Iarg_facet ((5,true),0.5000,1124, + Iarg_leaf 1702)), + Iarg_facet ((1,true),0.5000,1151, + Iarg_leaf 1788)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((2,true),0.5000,1471, + Iarg_facet ((4,true),0.5000,1026, + Iarg_leaf 1528)), + Iarg_facet ((2,true),0.5000,1422, + Iarg_facet ((4,true),0.5000,1127, + Iarg_leaf 1708))), + Iarg_bisect (5, + Iarg_facet ((2,true),0.5000,1165, + Iarg_leaf 1570), + Iarg_facet ((2,true),0.5000,1154, + Iarg_leaf 1784))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1513, + Iarg_leaf 1600), + Iarg_facet ((5,true),0.5000,1395, + Iarg_leaf 1542))))));; + +add_case ("7550003505 0 2 2", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1127, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6445,864, + Iarg_facet ((0,true),0.6340,1023, + Iarg_leaf 1557)), + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1066, + Iarg_leaf 1419), + Iarg_facet ((0,false),0.5000,989, + Iarg_leaf 1806))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1910, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1595, + Iarg_facet ((2,true),0.5000,1531, + Iarg_facet ((3,true),0.5000,1882, + Iarg_facet ((4,false),0.5000,710, + Iarg_leaf 1299)))), + Iarg_facet ((1,true),0.5000,734, + Iarg_facet ((2,true),0.6337,832, + Iarg_leaf 1491)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1273, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1581, + Iarg_leaf 1636), + Iarg_facet ((3,false),0.5000,1162, + Iarg_leaf 1842))), + Iarg_facet ((1,true),0.5000,732, + Iarg_facet ((2,true),0.5000,1130, + Iarg_facet ((3,false),0.5000,987, + Iarg_leaf 1332)))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1698, + Iarg_facet ((2,true),0.5000,1952, + Iarg_facet ((3,true),0.5000,1157, + Iarg_leaf 1515))), + Iarg_facet ((1,true),0.5000,1359, + Iarg_facet ((2,true),0.5000,1257, + Iarg_facet ((3,true),0.5000,1213, + Iarg_leaf 1486)))))))), + Iarg_facet ((5,true),0.5000,1615, + Iarg_facet ((4,true),0.6774,942, + Iarg_facet ((3,false),0.5480,1239, + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,721, + Iarg_leaf 1563), + Iarg_facet ((0,false),0.5000,708, + Iarg_facet ((1,true),0.6772,1143, + Iarg_leaf 1700))))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1293, + Iarg_leaf 1554), + Iarg_facet ((4,false),0.5000,1217, + Iarg_leaf 1598)), + Iarg_facet ((3,false),0.5000,966, + Iarg_leaf 1517)), + Iarg_facet ((2,true),0.5000,1229, + Iarg_facet ((3,false),0.5000,970, + Iarg_leaf 1588))), + Iarg_facet ((1,true),0.5000,1206, + Iarg_facet ((2,true),0.5000,940, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,768, + Iarg_leaf 1333), + Iarg_facet ((4,false),0.5000,838, + Iarg_leaf 1436))))), + Iarg_facet ((0,true),0.5000,1300, + Iarg_leaf 1670)), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,783, + Iarg_leaf 1369), + Iarg_facet ((4,true),0.5000,838, + Iarg_leaf 1468)), + Iarg_facet ((3,false),0.5000,1500, + Iarg_leaf 1535)), + Iarg_facet ((2,true),0.5000,1424, + Iarg_leaf 1842)), + Iarg_facet ((1,true),0.5000,1741, + Iarg_facet ((2,true),0.5000,1523, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1378, + Iarg_leaf 1517), + Iarg_facet ((4,false),0.5000,1556, + Iarg_leaf 1567))))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1346, + Iarg_leaf 1503), + Iarg_facet ((3,true),0.5000,1178, + Iarg_leaf 1225)), + Iarg_facet ((2,false),0.5000,1901, + Iarg_facet ((3,false),0.5000,1065, + Iarg_leaf 1144))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1706, + Iarg_facet ((3,false),0.5000,1682, + Iarg_facet ((4,false),0.5000,861, + Iarg_leaf 1159))), + Iarg_facet ((2,true),0.5000,997, + Iarg_leaf 1676))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1490, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.6231,1226, + Iarg_leaf 1609), + Iarg_facet ((2,true),0.5000,1703, + Iarg_facet ((3,true),0.5871,1055, + Iarg_leaf 1821))), + Iarg_facet ((1,false),0.5000,1403, + Iarg_facet ((2,true),0.5000,878, + Iarg_leaf 1161)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5764,1214, + Iarg_leaf 1642), + Iarg_facet ((2,false),0.5000,1996, + Iarg_facet ((3,false),0.6334,999, + Iarg_leaf 1052))), + Iarg_facet ((1,false),0.5000,1894, + Iarg_facet ((2,true),0.5000,1059, + Iarg_leaf 1483))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1859, + Iarg_facet ((2,false),0.5000,1399, + Iarg_leaf 1979)), + Iarg_facet ((1,false),0.5000,1666, + Iarg_facet ((2,true),0.5000,1150, + Iarg_leaf 1435)))))), + Iarg_facet ((3,true),0.5000,1051, + Iarg_leaf 1806)), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((4,true),0.6545,924, + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1416, + Iarg_facet ((1,true),0.6028,865, + Iarg_facet ((2,true),0.5000,1104, + Iarg_leaf 1482))), + Iarg_facet ((0,false),0.5000,1794, + Iarg_facet ((1,true),0.5000,1319, + Iarg_facet ((2,false),0.5000,1377, + Iarg_leaf 1469))))), + Iarg_facet ((4,true),0.6567,874, + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1638, + Iarg_facet ((1,true),0.5000,1211, + Iarg_leaf 1509)), + Iarg_facet ((0,false),0.5000,1421, + Iarg_facet ((1,false),0.5000,1076, + Iarg_leaf 1463))))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.7441,873, + Iarg_facet ((5,true),0.8918,1027, + Iarg_leaf 950)), + Iarg_facet ((4,true),0.8093,1265, + Iarg_leaf 1001))))));; + +add_case ("7550003505 0 2 4", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.7034,756, + Iarg_facet ((3,false),0.6372,867, + Iarg_leaf 1318)), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1076, + Iarg_facet ((1,true),0.7492,784, + Iarg_leaf 1664)), + Iarg_facet ((0,true),0.5000,761, + Iarg_leaf 1389)), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1265, + Iarg_bisect (4, + Iarg_facet ((3,false),0.5000,1563, + Iarg_leaf 1758), + Iarg_facet ((3,false),0.5000,1392, + Iarg_leaf 1483))), + Iarg_facet ((2,true),0.7252,1041, + Iarg_facet ((4,true),0.5000,1205, + Iarg_leaf 1613))), + Iarg_facet ((1,true),0.5000,762, + Iarg_facet ((2,true),0.8583,773, + Iarg_leaf 929))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,943, + Iarg_facet ((4,true),0.5000,1915, + Iarg_leaf 1939)), + Iarg_facet ((2,true),0.7275,775, + Iarg_leaf 1702)), + Iarg_facet ((1,true),0.5000,994, + Iarg_facet ((2,true),0.8882,749, + Iarg_leaf 679))))), + Iarg_facet ((3,false),0.5000,1857, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6906,889, + Iarg_leaf 1392), + Iarg_facet ((1,true),0.5000,930, + Iarg_facet ((2,true),0.5000,1178, + Iarg_facet ((3,false),0.5000,1055, + Iarg_leaf 1074)))), + Iarg_facet ((0,false),0.5000,1610, + Iarg_facet ((1,true),0.5000,1094, + Iarg_facet ((2,true),0.5000,1226, + Iarg_leaf 1997)))))), + Iarg_facet ((4,true),0.5000,1845, + Iarg_facet ((5,true),0.8293,967, + Iarg_leaf 1611)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.7036,1188, + Iarg_facet ((3,true),0.6523,1117, + Iarg_leaf 1711)), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1800, + Iarg_facet ((5,false),0.5000,1374, + Iarg_leaf 1395)), + Iarg_facet ((4,true),0.5000,1708, + Iarg_facet ((5,false),0.5000,991, + Iarg_leaf 1047))), + Iarg_facet ((3,false),0.5000,990, + Iarg_leaf 1267)), + Iarg_facet ((2,true),0.5000,1273, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1224, + Iarg_leaf 1291), + Iarg_facet ((4,true),0.5000,1282, + Iarg_leaf 1448)))), + Iarg_facet ((1,true),0.5000,1488, + Iarg_facet ((2,true),0.7128,714, + Iarg_facet ((3,true),0.5000,1040, + Iarg_leaf 1279)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1656, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1296, + Iarg_leaf 1536), + Iarg_facet ((4,true),0.5000,1217, + Iarg_leaf 1329))), + Iarg_facet ((2,true),0.5000,1202, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1040, + Iarg_leaf 1062), + Iarg_facet ((4,true),0.5000,1299, + Iarg_leaf 1364)))), + Iarg_facet ((1,true),0.5000,1581, + Iarg_facet ((2,true),0.7213,1004, + Iarg_facet ((3,true),0.5000,1039, + Iarg_leaf 1322))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1684, + Iarg_facet ((2,false),0.5515,814, + Iarg_leaf 1976)), + Iarg_facet ((1,true),0.5000,1838, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1621, + Iarg_leaf 1888), + Iarg_facet ((3,false),0.5000,854, + Iarg_leaf 1267)))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1401, + Iarg_facet ((2,false),0.5859,1125, + Iarg_leaf 1428)), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1573, + Iarg_leaf 1783), + Iarg_facet ((3,false),0.5000,928, + Iarg_leaf 1216)), + Iarg_facet ((2,true),0.5000,910, + Iarg_leaf 1455))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,740, + Iarg_leaf 1804), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1856, + Iarg_facet ((3,true),0.5731,732, + Iarg_leaf 1706)), + Iarg_facet ((4,false),0.7020,979, + Iarg_leaf 1068))), + Iarg_facet ((1,false),0.6512,1182, + Iarg_leaf 1556)), + Iarg_facet ((0,true),0.5000,1873, + Iarg_facet ((1,false),0.5000,1888, + Iarg_facet ((2,true),0.5000,1842, + Iarg_facet ((4,true),0.5000,1630, + Iarg_leaf 1845))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1970, + Iarg_facet ((2,false),0.6925,1089, + Iarg_leaf 1432)), + Iarg_bisect (1, + Iarg_facet ((2,false),0.6847,1279, + Iarg_leaf 1600), + Iarg_facet ((2,false),0.5000,1568, + Iarg_facet ((3,false),0.7639,1213, + Iarg_leaf 800)))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1525, + Iarg_facet ((2,false),0.5824,851, + Iarg_leaf 1269)), + Iarg_bisect (1, + Iarg_facet ((2,false),0.5965,1160, + Iarg_leaf 1335), + Iarg_facet ((2,false),0.5000,1332, + Iarg_leaf 1666)))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.7772,744, + Iarg_facet ((0,true),0.5000,1585, + Iarg_leaf 1693)), + Iarg_facet ((5,true),0.7461,800, + Iarg_facet ((0,false),0.6825,1031, + Iarg_facet ((1,true),0.5000,883, + Iarg_leaf 1395)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.8379,1212, + Iarg_leaf 1538), + Iarg_facet ((5,true),0.7461,924, + Iarg_facet ((0,false),0.5000,723, + Iarg_facet ((1,false),0.5000,773, + Iarg_leaf 1533)))))))));; + +add_case ("7550003505 2 2 3", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.7492,988, + Iarg_facet ((1,true),0.6299,917, + Iarg_leaf 1760)), + Iarg_facet ((0,true),0.7492,1090, + Iarg_leaf 1774)), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1907, + Iarg_facet ((2,true),0.5000,1197, + Iarg_facet ((3,true),0.5000,1471, + Iarg_leaf 1787))), + Iarg_facet ((1,true),0.6131,778, + Iarg_leaf 1379)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,909, + Iarg_facet ((3,false),0.5000,1332, + Iarg_leaf 1643)), + Iarg_facet ((2,true),0.6491,873, + Iarg_leaf 1541)), + Iarg_facet ((1,true),0.5000,1122, + Iarg_facet ((2,true),0.7147,767, + Iarg_facet ((3,false),0.5000,958, + Iarg_leaf 1152)))))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.6728,1196, + Iarg_leaf 1724), + Iarg_facet ((5,false),0.5000,1617, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1323, + Iarg_facet ((3,true),0.5000,735, + Iarg_leaf 1801)), + Iarg_facet ((2,true),0.5000,1058, + Iarg_facet ((3,true),0.5000,1213, + Iarg_leaf 1249))), + Iarg_facet ((1,true),0.5000,1272, + Iarg_leaf 1698))))), + Iarg_facet ((5,true),0.7423,1178, + Iarg_bisect (3, + Iarg_facet ((4,false),0.7690,1168, + Iarg_leaf 1017), + Iarg_facet ((4,false),0.6896,1128, + Iarg_leaf 1944)))), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1112, + Iarg_facet ((3,true),0.5000,736, + Iarg_leaf 1324)), + Iarg_facet ((4,false),0.5000,835, + Iarg_leaf 1213)), + Iarg_facet ((2,true),0.5000,734, + Iarg_leaf 1659)), + Iarg_facet ((1,true),0.5000,908, + Iarg_facet ((2,true),0.5000,1092, + Iarg_facet ((4,false),0.5000,844, + Iarg_leaf 1163)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1514, + Iarg_facet ((4,true),0.5000,1159, + Iarg_leaf 1718)), + Iarg_facet ((2,true),0.5000,939, + Iarg_facet ((4,true),0.5000,962, + Iarg_leaf 1731))), + Iarg_facet ((1,true),0.5000,1649, + Iarg_facet ((2,true),0.5000,1283, + Iarg_facet ((4,true),0.5000,1253, + Iarg_leaf 1323))))), + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1021, + Iarg_leaf 1319), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1767, + Iarg_leaf 1924), + Iarg_facet ((2,true),0.5000,1440, + Iarg_leaf 1913)), + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1953, + Iarg_facet ((4,false),0.5000,970, + Iarg_leaf 1056)), + Iarg_facet ((2,true),0.5000,897, + Iarg_leaf 1317))))), + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,753, + Iarg_leaf 1415), + Iarg_facet ((1,true),0.5000,731, + Iarg_leaf 1921)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1088, + Iarg_leaf 1554), + Iarg_facet ((1,true),0.5000,1238, + Iarg_facet ((2,true),0.5000,1074, + Iarg_leaf 1263)))), + Iarg_facet ((5,false),0.5000,976, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1076, + Iarg_leaf 1233), + Iarg_facet ((1,true),0.5000,1408, + Iarg_facet ((2,false),0.5000,939, + Iarg_leaf 1271)))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.6593,773, + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1238, + Iarg_facet ((1,true),0.5000,1185, + Iarg_leaf 1246)), + Iarg_facet ((0,false),0.5000,1347, + Iarg_facet ((1,false),0.5000,1680, + Iarg_leaf 1801)))), + Iarg_facet ((5,true),0.7421,1194, + Iarg_facet ((3,false),0.5000,1783, + Iarg_facet ((0,false),0.7679,861, + Iarg_leaf 883)))))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1008, + Iarg_leaf 1460), + Iarg_bisect (5, + Iarg_facet ((3,true),0.9982,1584, + Iarg_leaf 1121), + Iarg_facet ((3,true),0.7678,1247, + Iarg_facet ((4,true),0.5000,1014, + Iarg_facet ((5,true),0.8296,1088, + Iarg_leaf 1085)))))));; + +add_case ("7550003505 1 2 4", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6285,864, + Iarg_facet ((3,true),0.5000,1338, + Iarg_leaf 1734)), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1624, + Iarg_facet ((4,true),0.5000,1940, + Iarg_facet ((3,true),0.5000,1007, + Iarg_leaf 1328))), + Iarg_facet ((2,true),0.6332,1149, + Iarg_facet ((4,true),0.5000,1159, + Iarg_leaf 1227))), + Iarg_facet ((1,true),0.6334,956, + Iarg_leaf 1225)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,977, + Iarg_facet ((4,false),0.5000,1357, + Iarg_leaf 1367)), + Iarg_facet ((2,true),0.5000,748, + Iarg_facet ((4,true),0.5000,1674, + Iarg_leaf 1917))), + Iarg_facet ((1,true),0.5000,835, + Iarg_leaf 1464))), + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1901, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1177, + Iarg_facet ((4,true),0.5000,1760, + Iarg_leaf 1895)), + Iarg_facet ((2,true),0.6195,1153, + Iarg_facet ((4,false),0.5000,1335, + Iarg_leaf 1341)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,865, + Iarg_facet ((4,false),0.5000,1183, + Iarg_leaf 1212)), + Iarg_facet ((2,true),0.5000,835, + Iarg_facet ((4,false),0.5000,1156, + Iarg_leaf 1158))), + Iarg_facet ((1,true),0.5000,849, + Iarg_leaf 1257)))), + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,763, + Iarg_leaf 1936), + Iarg_facet ((1,true),0.5000,754, + Iarg_facet ((2,true),0.5000,968, + Iarg_leaf 1567))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1058, + Iarg_leaf 1541), + Iarg_facet ((1,true),0.5000,1178, + Iarg_facet ((2,true),0.5000,1207, + Iarg_leaf 1353)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,910, + Iarg_leaf 1517), + Iarg_facet ((1,true),0.5000,1017, + Iarg_facet ((2,true),0.5000,974, + Iarg_leaf 1277))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1024, + Iarg_leaf 1236), + Iarg_facet ((1,true),0.5000,1327, + Iarg_facet ((2,true),0.5000,1066, + Iarg_leaf 1219)))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.7754,908, + Iarg_facet ((3,true),0.5000,1638, + Iarg_leaf 1838)), + Iarg_facet ((5,true),0.7432,1109, + Iarg_facet ((3,true),0.5000,1622, + Iarg_leaf 1745))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.6509,842, + Iarg_facet ((3,false),0.5000,1521, + Iarg_facet ((4,false),0.8742,842, + Iarg_leaf 1374))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1111, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,879, + Iarg_leaf 1129), + Iarg_facet ((4,true),0.5000,1044, + Iarg_leaf 1558))), + Iarg_facet ((2,true),0.5000,757, + Iarg_facet ((3,true),0.5000,1074, + Iarg_leaf 1394))), + Iarg_facet ((1,true),0.6624,875, + Iarg_leaf 1249)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,952, + Iarg_facet ((3,false),0.5000,1430, + Iarg_leaf 1668)), + Iarg_facet ((2,true),0.5000,758, + Iarg_facet ((3,false),0.5000,1197, + Iarg_leaf 1207))), + Iarg_facet ((1,true),0.5000,766, + Iarg_leaf 1937))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1027, + Iarg_leaf 1500), + Iarg_facet ((1,true),0.5000,860, + Iarg_facet ((2,true),0.5000,877, + Iarg_leaf 1539))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,869, + Iarg_leaf 1337), + Iarg_facet ((1,true),0.5000,1309, + Iarg_facet ((2,true),0.5000,944, + Iarg_leaf 1663))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1531, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_facet ((5,true),0.5000,1005, + Iarg_leaf 1293), + Iarg_facet ((5,true),0.5000,1037, + Iarg_leaf 1783)), + Iarg_facet ((3,false),0.5000,1403, + Iarg_leaf 1771))), + Iarg_facet ((2,true),0.6585,1165, + Iarg_leaf 1911)), + Iarg_facet ((1,true),0.5000,860, + Iarg_facet ((2,true),0.7210,730, + Iarg_facet ((4,false),0.6243,1252, + Iarg_facet ((3,false),0.5000,1092, + Iarg_facet ((5,true),0.5000,1135, + Iarg_leaf 1369)))))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1079, + Iarg_facet ((4,true),0.5000,1460, + Iarg_leaf 1700)), + Iarg_facet ((2,true),0.6231,1086, + Iarg_facet ((4,true),0.5000,1309, + Iarg_leaf 1361))), + Iarg_facet ((1,true),0.5000,1063, + Iarg_facet ((2,true),0.7251,768, + Iarg_facet ((4,false),0.5896,716, + Iarg_facet ((3,false),0.5000,1061, + Iarg_leaf 1179)))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,838, + Iarg_leaf 1866), + Iarg_facet ((1,true),0.5000,1082, + Iarg_facet ((2,true),0.5000,1682, + Iarg_facet ((3,false),0.5000,1401, + Iarg_facet ((4,true),0.7250,1022, + Iarg_leaf 1856))))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,806, + Iarg_leaf 1618), + Iarg_facet ((1,true),0.5000,1368, + Iarg_facet ((2,true),0.5000,1554, + Iarg_facet ((3,false),0.5000,1429, + Iarg_leaf 1825))))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.8108,853, + Iarg_leaf 1605), + Iarg_facet ((5,true),0.8297,1220, + Iarg_leaf 1263)), + Iarg_bisect (4, + Iarg_facet ((5,true),0.8712,972, + Iarg_leaf 1391), + Iarg_facet ((5,true),0.8108,1273, + Iarg_leaf 1903)))))));; + +add_case ("FHBVYXZ b split(0/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1247, + Iarg_facet ((1,true),0.5000,1366, + Iarg_facet ((2,true),0.5000,1871, + Iarg_facet ((3,true),0.5000,943, + Iarg_leaf 1911)))), + Iarg_facet ((5,true),0.7957,1117, + Iarg_leaf 1945)), + Iarg_facet ((4,true),0.5000,1644, + Iarg_facet ((5,true),0.6238,881, + Iarg_facet ((1,true),0.6622,797, + Iarg_leaf 1929)))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1549, + Iarg_facet ((5,true),0.6542,765, + Iarg_leaf 1843)), + Iarg_facet ((4,true),0.5000,1039, + Iarg_leaf 1676))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1587, + Iarg_facet ((4,true),0.5000,869, + Iarg_leaf 1824)), + Iarg_facet ((3,true),0.5000,974, + Iarg_leaf 1340))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1442, + Iarg_facet ((4,true),0.5000,761, + Iarg_leaf 1365)), + Iarg_facet ((3,true),0.5000,983, + Iarg_leaf 1321)), + Iarg_facet ((2,true),0.5000,1337, + Iarg_leaf 1712))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1567, + Iarg_leaf 1812), + Iarg_facet ((4,true),0.5000,1056, + Iarg_leaf 1269)), + Iarg_facet ((3,true),0.5000,1559, + Iarg_facet ((4,true),0.5000,1181, + Iarg_leaf 1301))), + Iarg_facet ((2,true),0.5000,1562, + Iarg_leaf 1943)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1645, + Iarg_leaf 1946), + Iarg_facet ((2,true),0.5000,1237, + Iarg_leaf 1267)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1580, + Iarg_facet ((5,true),0.6342,936, + Iarg_facet ((1,true),0.6642,786, + Iarg_leaf 1733))), + Iarg_facet ((4,true),0.5000,1725, + Iarg_facet ((5,true),0.5000,720, + Iarg_facet ((1,true),0.6255,964, + Iarg_leaf 1731)))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,942, + Iarg_leaf 1629), + Iarg_facet ((4,true),0.5000,1029, + Iarg_leaf 1776))), + Iarg_facet ((2,true),0.5000,1892, + Iarg_facet ((3,false),0.5000,1520, + Iarg_leaf 1714))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1830, + Iarg_facet ((3,false),0.5000,1293, + Iarg_leaf 1412)), + Iarg_facet ((2,true),0.5000,1245, + Iarg_leaf 1441))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1918, + Iarg_facet ((4,true),0.5000,920, + Iarg_leaf 1183)), + Iarg_facet ((3,false),0.5000,1303, + Iarg_leaf 1312)), + Iarg_facet ((2,true),0.5000,1065, + Iarg_leaf 1606)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1383, + Iarg_leaf 1623), + Iarg_facet ((2,true),0.5000,1118, + Iarg_leaf 1241))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1308, + Iarg_leaf 1880), + Iarg_facet ((4,true),0.5000,827, + Iarg_leaf 1306)), + Iarg_facet ((3,true),0.5000,1826, + Iarg_facet ((4,true),0.5000,1195, + Iarg_leaf 1599))), + Iarg_facet ((2,true),0.5000,1678, + Iarg_leaf 1837)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1817, + Iarg_leaf 1896), + Iarg_facet ((2,true),0.5000,1245, + Iarg_leaf 1248))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1245, + Iarg_facet ((4,true),0.5000,985, + Iarg_leaf 1020)), + Iarg_facet ((3,true),0.5000,999, + Iarg_leaf 1978)), + Iarg_facet ((2,true),0.5000,1256, + Iarg_leaf 1387)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1460, + Iarg_leaf 1539), + Iarg_facet ((2,true),0.5000,1162, + Iarg_leaf 1214)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1837, + Iarg_leaf 1968), + Iarg_facet ((3,false),0.5000,1466, + Iarg_leaf 1535)), + Iarg_facet ((2,true),0.5000,1284, + Iarg_leaf 1509)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1458, + Iarg_leaf 1576), + Iarg_facet ((2,true),0.5000,1159, + Iarg_leaf 1230))), + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1115, + Iarg_facet ((2,true),0.5000,911, + Iarg_leaf 1316)), + Iarg_facet ((1,true),0.5000,1652, + Iarg_leaf 1999))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,918, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1284, + Iarg_facet ((4,true),0.5000,703, + Iarg_leaf 1325)), + Iarg_facet ((3,true),0.5000,883, + Iarg_leaf 1156)), + Iarg_facet ((2,true),0.5000,1637, + Iarg_facet ((3,true),0.5000,934, + Iarg_leaf 1272)))), + Iarg_facet ((5,true),0.5000,919, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1592, + Iarg_leaf 1795), + Iarg_facet ((2,true),0.5000,1300, + Iarg_leaf 1536)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,930, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1725, + Iarg_facet ((3,false),0.5000,1176, + Iarg_leaf 1264)), + Iarg_facet ((2,true),0.5000,1381, + Iarg_leaf 1720))), + Iarg_facet ((5,true),0.5000,917, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1244, + Iarg_leaf 1589), + Iarg_facet ((2,true),0.5000,1216, + Iarg_leaf 1231))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,911, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1635, + Iarg_leaf 1730), + Iarg_facet ((2,true),0.5000,1337, + Iarg_leaf 1417))), + Iarg_facet ((5,true),0.5000,916, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1368, + Iarg_leaf 1483), + Iarg_facet ((2,true),0.5000,1211, + Iarg_leaf 1231)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,917, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1356, + Iarg_leaf 1527), + Iarg_facet ((2,true),0.5000,1239, + Iarg_leaf 1257))), + Iarg_facet ((5,true),0.5000,802, + Iarg_facet ((1,false),0.5000,1355, + Iarg_facet ((2,true),0.5000,966, + Iarg_leaf 1116))))))));; + +add_case ("8673686234 c", + Iarg_facet ((2,true),0.5000,834, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,801, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (0, + Iarg_facet ((3,false),0.5000,1252, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1225, + Iarg_leaf 1576), + Iarg_facet ((5,true),0.5000,1209, + Iarg_facet ((1,false),0.5000,1633, + Iarg_leaf 1706))), + Iarg_facet ((4,true),0.5000,1346, + Iarg_facet ((5,true),0.5000,1163, + Iarg_leaf 1529)))), + Iarg_bisect (3, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1213, + Iarg_leaf 1512), + Iarg_facet ((5,true),0.5000,1200, + Iarg_facet ((1,false),0.5000,1632, + Iarg_leaf 1679))), + Iarg_facet ((4,true),0.5000,1348, + Iarg_facet ((5,true),0.5000,1158, + Iarg_leaf 1585))), + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1826, + Iarg_bisect (5, + Iarg_facet ((1,false),0.5000,754, + Iarg_facet ((0,true),0.5000,1158, + Iarg_facet ((3,true),0.5000,997, + Iarg_leaf 1272))), + Iarg_bisect (1, + Iarg_facet ((0,true),0.5000,756, + Iarg_leaf 1359), + Iarg_facet ((0,false),0.5000,1181, + Iarg_leaf 1832)))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1541, + Iarg_bisect (1, + Iarg_facet ((0,true),0.5000,807, + Iarg_leaf 1410), + Iarg_facet ((0,false),0.5000,817, + Iarg_leaf 1258))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((0,true),0.5000,761, + Iarg_leaf 1367), + Iarg_facet ((0,false),0.5000,1172, + Iarg_leaf 1844)), + Iarg_facet ((1,true),0.5000,1313, + Iarg_facet ((0,false),0.5000,1070, + Iarg_leaf 1930))))))), + Iarg_bisect (0, + Iarg_facet ((3,false),0.8807,951, + Iarg_leaf 1013), + Iarg_bisect (3, + Iarg_facet ((2,true),0.7978,904, + Iarg_leaf 1066), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,false),0.5000,1110, + Iarg_leaf 1518), + Iarg_facet ((1,true),0.5000,884, + Iarg_leaf 1632)), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (0, + Iarg_facet ((3,false),0.5000,707, + Iarg_facet ((2,true),0.5000,856, + Iarg_leaf 1357)), + Iarg_facet ((3,true),0.5000,1894, + Iarg_facet ((2,true),0.5000,852, + Iarg_leaf 1350))), + Iarg_facet ((0,false),0.5000,835, + Iarg_facet ((3,false),0.5000,806, + Iarg_facet ((2,true),0.5000,994, + Iarg_leaf 1831)))), + Iarg_facet ((1,true),0.7173,948, + Iarg_leaf 1395))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1208, + Iarg_facet ((1,true),0.5000,885, + Iarg_leaf 1606)), + Iarg_facet ((5,true),0.7196,770, + Iarg_leaf 1858)))))), + Iarg_facet ((1,true),0.5000,1168, + Iarg_facet ((0,false),0.5000,1243, + Iarg_facet ((3,false),0.5000,1243, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,false),0.5000,1519, + Iarg_leaf 1786), + Iarg_facet ((1,true),0.5000,764, + Iarg_leaf 1606)), + Iarg_facet ((5,true),0.5000,824, + Iarg_facet ((1,true),0.5000,1120, + Iarg_facet ((0,false),0.5000,989, + Iarg_leaf 1670)))), + Iarg_facet ((4,true),0.5000,1306, + Iarg_facet ((5,true),0.5000,1539, + Iarg_facet ((1,true),0.5000,1104, + Iarg_facet ((0,false),0.5000,1134, + Iarg_facet ((3,false),0.5000,1101, + Iarg_leaf 1257)))))))))), + Iarg_facet ((5,true),0.5000,1102, + Iarg_bisect (1, + Iarg_bisect (0, + Iarg_facet ((3,false),0.8425,872, + Iarg_leaf 1906), + Iarg_bisect (3, + Iarg_facet ((2,true),0.7928,945, + Iarg_leaf 1684), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((0,true),0.5000,1262, + Iarg_facet ((3,true),0.5000,1011, + Iarg_leaf 1318)), + Iarg_bisect (0, + Iarg_facet ((3,false),0.5000,723, + Iarg_facet ((2,true),0.5000,871, + Iarg_facet ((4,false),0.5000,920, + Iarg_leaf 1224))), + Iarg_bisect (3, + Iarg_facet ((2,true),0.5000,872, + Iarg_facet ((4,false),0.5000,917, + Iarg_leaf 1227)), + Iarg_facet ((2,false),0.5000,1447, + Iarg_leaf 1734)))), + Iarg_bisect (1, + Iarg_facet ((0,false),0.5000,1045, + Iarg_leaf 1905), + Iarg_facet ((0,false),0.7200,769, + Iarg_leaf 1275))), + Iarg_facet ((5,true),0.5000,1435, + Iarg_bisect (1, + Iarg_facet ((0,false),0.5000,1792, + Iarg_facet ((3,false),0.5000,1430, + Iarg_leaf 1810)), + Iarg_facet ((0,false),0.5000,893, + Iarg_facet ((3,false),0.5000,879, + Iarg_facet ((2,true),0.5000,1354, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,774, + Iarg_leaf 1722), + Iarg_facet ((5,true),0.8132,1064, + Iarg_leaf 829)))))))), + Iarg_facet ((4,true),0.5000,1526, + Iarg_facet ((5,true),0.5000,1150, + Iarg_bisect (1, + Iarg_facet ((0,false),0.5000,1056, + Iarg_leaf 1904), + Iarg_facet ((0,false),0.7546,915, + Iarg_leaf 1202))))))), + Iarg_facet ((0,false),0.7182,913, + Iarg_facet ((3,false),0.7189,951, + Iarg_facet ((2,true),0.5989,926, + Iarg_facet ((4,true),0.5000,1902, + Iarg_facet ((5,true),0.6248,891, + Iarg_facet ((1,true),0.5000,1715, + Iarg_bisect (4, + Iarg_facet ((0,false),0.5000,1286, + Iarg_leaf 1332), + Iarg_facet ((0,false),0.5000,1053, + Iarg_facet ((3,false),0.5000,927, + Iarg_leaf 1570)))))))))))), + Iarg_facet ((4,true),0.5000,1118, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1209, + Iarg_facet ((0,false),0.5000,1180, + Iarg_facet ((3,false),0.5000,1220, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,false),0.5000,1236, + Iarg_leaf 1398), + Iarg_facet ((1,true),0.5000,1049, + Iarg_facet ((0,false),0.5000,1124, + Iarg_facet ((3,false),0.5000,968, + Iarg_leaf 1096)))), + Iarg_facet ((5,true),0.5000,1170, + Iarg_facet ((1,true),0.5000,978, + Iarg_leaf 1991))), + Iarg_facet ((4,true),0.5000,786, + Iarg_facet ((5,true),0.5000,1336, + Iarg_leaf 1888)))))), + Iarg_facet ((1,true),0.9011,841, + Iarg_leaf 1472)))), + Iarg_facet ((2,true),0.8565,730, + Iarg_facet ((4,true),0.7433,808, + Iarg_leaf 1222)))), + Iarg_facet ((5,true),0.9525,917, + Iarg_facet ((1,true),0.9042,1038, + Iarg_leaf 1330)))));; + +add_case ("OXLZLEZ 6346351218 1 10", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,1504, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1339, + Iarg_facet ((5,true),0.5000,899, + Iarg_leaf 1759)), + Iarg_facet ((4,true),0.6232,892, + Iarg_leaf 1104)), + Iarg_facet ((2,true),0.5000,965, + Iarg_facet ((4,true),0.6277,889, + Iarg_leaf 1121)))), + Iarg_facet ((3,true),0.5000,1827, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1641, + Iarg_facet ((5,true),0.5000,1109, + Iarg_facet ((3,true),0.7703,801, + Iarg_leaf 1194))), + Iarg_facet ((4,true),0.5000,846, + Iarg_leaf 1632)), + Iarg_facet ((2,true),0.5000,1224, + Iarg_facet ((4,true),0.5000,811, + Iarg_leaf 1676))))), + Iarg_bisect (0, + Iarg_facet ((3,true),0.5933,968, + Iarg_facet ((1,true),0.5000,840, + Iarg_leaf 1727)), + Iarg_facet ((3,true),0.5000,867, + Iarg_facet ((1,true),0.5000,1223, + Iarg_facet ((2,true),0.5000,800, + Iarg_leaf 1712))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,708, + Iarg_facet ((1,true),0.5000,914, + Iarg_facet ((2,true),0.6209,895, + Iarg_leaf 1132))), + Iarg_facet ((3,true),0.5000,902, + Iarg_facet ((1,true),0.5000,1186, + Iarg_facet ((2,true),0.5000,873, + Iarg_leaf 1730)))), + Iarg_facet ((0,false),0.5000,1136, + Iarg_leaf 1413))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,714, + Iarg_facet ((1,true),0.5000,932, + Iarg_facet ((4,true),0.6198,890, + Iarg_leaf 1139))), + Iarg_facet ((3,true),0.5000,913, + Iarg_facet ((1,true),0.5000,1213, + Iarg_facet ((4,true),0.5000,867, + Iarg_leaf 1731)))), + Iarg_facet ((0,false),0.5000,1133, + Iarg_leaf 1419)), + Iarg_facet ((5,true),0.5000,943, + Iarg_facet ((0,false),0.5000,1230, + Iarg_leaf 1597)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,711, + Iarg_facet ((2,true),0.5000,936, + Iarg_facet ((4,true),0.6337,893, + Iarg_leaf 1132))), + Iarg_facet ((3,true),0.5000,904, + Iarg_facet ((2,true),0.5000,1200, + Iarg_facet ((4,true),0.5000,812, + Iarg_leaf 1790)))), + Iarg_facet ((0,false),0.5000,1218, + Iarg_leaf 1587)), + Iarg_facet ((5,true),0.5000,951, + Iarg_facet ((0,false),0.5000,1148, + Iarg_leaf 1434))), + Iarg_facet ((4,true),0.5000,1402, + Iarg_facet ((5,true),0.5000,963, + Iarg_facet ((0,false),0.5000,1158, + Iarg_leaf 1459))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1891, + Iarg_facet ((3,true),0.6976,962, + Iarg_leaf 1569)), + Iarg_facet ((0,false),0.5000,1506, + Iarg_leaf 1815)), + Iarg_facet ((5,true),0.5000,983, + Iarg_leaf 1270)), + Iarg_facet ((4,true),0.5000,1027, + Iarg_facet ((5,true),0.5000,1162, + Iarg_leaf 1345))), + Iarg_facet ((2,true),0.5000,1609, + Iarg_facet ((4,true),0.5000,1026, + Iarg_facet ((5,true),0.5000,1179, + Iarg_leaf 1473))))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1270, + Iarg_facet ((0,false),0.5000,1910, + Iarg_facet ((3,true),0.7660,1113, + Iarg_leaf 1340))), + Iarg_facet ((5,true),0.5000,978, + Iarg_facet ((0,false),0.5000,1535, + Iarg_leaf 1870))), + Iarg_facet ((4,true),0.5000,1640, + Iarg_facet ((5,true),0.6511,891, + Iarg_leaf 1160))), + Iarg_facet ((2,true),0.5000,1618, + Iarg_facet ((4,true),0.5000,1640, + Iarg_leaf 1938))), + Iarg_facet ((1,true),0.5000,1558, + Iarg_facet ((2,true),0.5000,1074, + Iarg_facet ((4,true),0.5000,956, + Iarg_leaf 1270))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1378, + Iarg_facet ((0,false),0.5000,1996, + Iarg_facet ((3,true),0.6668,916, + Iarg_leaf 1753))), + Iarg_facet ((5,true),0.6476,899, + Iarg_leaf 1170)), + Iarg_facet ((4,true),0.5000,1713, + Iarg_facet ((5,true),0.5000,1190, + Iarg_facet ((0,false),0.5000,1641, + Iarg_leaf 1961)))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,880, + Iarg_leaf 1937), + Iarg_facet ((4,true),0.6146,938, + Iarg_leaf 1220))), + Iarg_facet ((1,true),0.5000,1712, + Iarg_facet ((2,true),0.5000,1569, + Iarg_facet ((4,true),0.6180,938, + Iarg_leaf 1286)))), + Iarg_facet ((5,true),0.5000,1442, + Iarg_facet ((1,true),0.5000,1743, + Iarg_facet ((2,true),0.5000,1701, + Iarg_facet ((4,true),0.5000,982, + Iarg_leaf 1245)))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1981, + Iarg_facet ((5,true),0.5000,1510, + Iarg_bisect (0, + Iarg_facet ((3,true),0.6793,772, + Iarg_leaf 1373), + Iarg_facet ((3,true),0.6580,883, + Iarg_leaf 1811)))), + Iarg_facet ((4,true),0.5000,877, + Iarg_leaf 1948)), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1712, + Iarg_facet ((5,true),0.5000,1219, + Iarg_facet ((0,false),0.5000,1672, + Iarg_facet ((3,true),0.7415,879, + Iarg_leaf 1181)))), + Iarg_facet ((4,true),0.5000,709, + Iarg_leaf 1530))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1001, + Iarg_facet ((4,true),0.6224,940, + Iarg_leaf 1279)), + Iarg_facet ((2,true),0.6114,916, + Iarg_leaf 1458))), + Iarg_facet ((5,true),0.5000,1412, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1032, + Iarg_facet ((4,true),0.5000,986, + Iarg_leaf 1279)), + Iarg_facet ((2,true),0.5000,708, + Iarg_leaf 1566)))), + Iarg_facet ((4,true),0.5000,1938, + Iarg_facet ((5,true),0.5000,1533, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1246, + Iarg_leaf 1694), + Iarg_facet ((2,true),0.5000,866, + Iarg_leaf 1251)))))));; + +add_case ("OXLZLEZ 6346351218 1 8", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,1505, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1338, + Iarg_facet ((5,true),0.5000,900, + Iarg_leaf 1759)), + Iarg_facet ((4,true),0.6229,892, + Iarg_leaf 1101)), + Iarg_facet ((2,true),0.5000,965, + Iarg_facet ((4,true),0.7679,1264, + Iarg_leaf 763)))), + Iarg_facet ((3,true),0.5000,1833, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1643, + Iarg_facet ((5,true),0.5000,1106, + Iarg_facet ((3,true),0.7257,760, + Iarg_leaf 1360))), + Iarg_facet ((4,true),0.5000,847, + Iarg_leaf 1638)), + Iarg_facet ((2,true),0.5000,1212, + Iarg_facet ((4,true),0.5000,817, + Iarg_leaf 1686))))), + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,702, + Iarg_facet ((1,true),0.5000,951, + Iarg_leaf 1962)), + Iarg_facet ((3,true),0.5000,869, + Iarg_facet ((1,true),0.5000,1221, + Iarg_facet ((2,true),0.5000,808, + Iarg_leaf 1718))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,711, + Iarg_facet ((1,true),0.5000,922, + Iarg_facet ((2,true),0.6218,894, + Iarg_leaf 1131))), + Iarg_facet ((3,true),0.5000,905, + Iarg_facet ((1,true),0.5000,1189, + Iarg_facet ((2,true),0.5000,874, + Iarg_leaf 1734)))), + Iarg_facet ((0,false),0.5000,1134, + Iarg_leaf 1409))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,715, + Iarg_facet ((1,true),0.5000,934, + Iarg_facet ((4,true),0.6366,921, + Iarg_leaf 1112))), + Iarg_facet ((3,true),0.5000,912, + Iarg_facet ((1,true),0.5000,1211, + Iarg_facet ((4,true),0.5000,875, + Iarg_leaf 1736)))), + Iarg_facet ((0,false),0.5000,1134, + Iarg_leaf 1425)), + Iarg_facet ((5,true),0.5000,944, + Iarg_facet ((0,false),0.5000,1230, + Iarg_leaf 1601)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,717, + Iarg_facet ((2,true),0.5000,933, + Iarg_facet ((4,true),0.6575,923, + Iarg_leaf 1092))), + Iarg_facet ((3,true),0.5000,905, + Iarg_facet ((2,true),0.5000,1208, + Iarg_facet ((4,true),0.5000,815, + Iarg_leaf 1794)))), + Iarg_facet ((0,false),0.5000,1219, + Iarg_leaf 1595)), + Iarg_facet ((5,true),0.5000,955, + Iarg_facet ((0,false),0.5000,1152, + Iarg_leaf 1445))), + Iarg_facet ((4,true),0.5000,1403, + Iarg_facet ((5,true),0.5000,963, + Iarg_facet ((0,false),0.5000,1161, + Iarg_leaf 1467))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1869, + Iarg_facet ((3,true),0.6680,869, + Iarg_leaf 1713)), + Iarg_facet ((0,false),0.5000,1506, + Iarg_leaf 1812)), + Iarg_facet ((5,true),0.5000,981, + Iarg_leaf 1270)), + Iarg_facet ((4,true),0.5000,1028, + Iarg_facet ((5,true),0.5000,1163, + Iarg_leaf 1347))), + Iarg_facet ((2,true),0.5000,1618, + Iarg_facet ((4,true),0.5000,1029, + Iarg_facet ((5,true),0.5000,1180, + Iarg_leaf 1475))))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1266, + Iarg_facet ((0,false),0.5000,1908, + Iarg_facet ((3,true),0.6653,882, + Iarg_leaf 1721))), + Iarg_facet ((5,true),0.5000,976, + Iarg_facet ((0,false),0.5000,1540, + Iarg_leaf 1867))), + Iarg_facet ((4,true),0.5000,1635, + Iarg_facet ((5,true),0.6508,889, + Iarg_leaf 1158))), + Iarg_facet ((2,true),0.5000,1621, + Iarg_facet ((4,true),0.5000,1638, + Iarg_leaf 1937))), + Iarg_facet ((1,true),0.5000,1555, + Iarg_facet ((2,true),0.5000,1074, + Iarg_facet ((4,true),0.5000,955, + Iarg_leaf 1270))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1375, + Iarg_bisect (0, + Iarg_leaf 1999, + Iarg_facet ((3,true),0.6610,901, + Iarg_leaf 1770))), + Iarg_facet ((5,true),0.6471,897, + Iarg_leaf 1163)), + Iarg_facet ((4,true),0.5000,1711, + Iarg_facet ((5,true),0.5000,1187, + Iarg_facet ((0,false),0.5000,1655, + Iarg_leaf 1981)))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,881, + Iarg_leaf 1937), + Iarg_facet ((4,true),0.6255,966, + Iarg_leaf 1184))), + Iarg_facet ((1,true),0.5000,1699, + Iarg_facet ((2,true),0.5000,1557, + Iarg_facet ((4,true),0.6172,940, + Iarg_leaf 1292)))), + Iarg_facet ((5,true),0.5000,1440, + Iarg_facet ((1,true),0.5000,1743, + Iarg_facet ((2,true),0.5000,1707, + Iarg_facet ((4,true),0.5000,987, + Iarg_leaf 1249)))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1985, + Iarg_facet ((5,true),0.5000,1510, + Iarg_bisect (0, + Iarg_facet ((3,true),0.6857,797, + Iarg_leaf 1363), + Iarg_facet ((3,true),0.6806,947, + Iarg_leaf 1714)))), + Iarg_facet ((4,true),0.5000,878, + Iarg_leaf 1954)), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1707, + Iarg_facet ((5,true),0.5000,1219, + Iarg_facet ((0,false),0.5000,1655, + Iarg_leaf 1997))), + Iarg_facet ((4,true),0.5000,713, + Iarg_leaf 1540))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1006, + Iarg_facet ((4,true),0.6206,932, + Iarg_leaf 1290)), + Iarg_facet ((2,true),0.6120,919, + Iarg_leaf 1474))), + Iarg_facet ((5,true),0.5000,1417, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1035, + Iarg_facet ((4,true),0.5000,988, + Iarg_leaf 1285)), + Iarg_facet ((2,true),0.5000,711, + Iarg_leaf 1574)))), + Iarg_facet ((4,true),0.5000,1948, + Iarg_facet ((5,true),0.5000,1533, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1252, + Iarg_leaf 1696), + Iarg_facet ((2,true),0.5000,869, + Iarg_leaf 1257)))))));; + +add_case ("6877738680", + Iarg_bisect (3, + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,979, + Iarg_facet ((1,true),0.6647,804, + Iarg_facet ((2,true),0.7064,1151, + Iarg_facet ((3,false),0.5906,877, + Iarg_facet ((0,false),0.5000,1563, + Iarg_facet ((1,false),0.5000,1018, + Iarg_leaf 1171)))))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1734, + Iarg_facet ((0,false),0.7789,738, + Iarg_leaf 1170)), + Iarg_facet ((3,false),0.6734,909, + Iarg_leaf 1491)), + Iarg_facet ((2,true),0.7076,902, + Iarg_leaf 1908)), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,false),0.6353,1267, + Iarg_facet ((0,true),0.5000,1284, + Iarg_leaf 1696)), + Iarg_bisect (2, + Iarg_facet ((0,true),0.5000,1513, + Iarg_facet ((3,true),0.5000,897, + Iarg_leaf 1159)), + Iarg_facet ((0,false),0.5000,1454, + Iarg_facet ((3,false),0.6362,929, + Iarg_leaf 1350)))), + Iarg_facet ((1,false),0.6563,751, + Iarg_facet ((2,false),0.7141,864, + Iarg_facet ((0,true),0.5000,740, + Iarg_leaf 1537)))), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5810,793, + Iarg_facet ((0,false),0.5000,1514, + Iarg_facet ((2,true),0.6747,1009, + Iarg_leaf 1310))), + Iarg_bisect (1, + Iarg_bisect (0, + Iarg_bisect (2, + Iarg_facet ((3,true),0.6927,985, + Iarg_leaf 1297), + Iarg_facet ((3,false),0.5000,1427, + Iarg_facet ((0,false),0.5000,897, + Iarg_leaf 1870))), + Iarg_facet ((2,false),0.5000,866, + Iarg_facet ((3,true),0.5000,1465, + Iarg_leaf 1888))), + Iarg_bisect (0, + Iarg_facet ((2,true),0.5000,1086, + Iarg_facet ((3,false),0.5000,1241, + Iarg_facet ((0,false),0.5000,1090, + Iarg_facet ((1,false),0.5000,794, + Iarg_leaf 1308)))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1673, + Iarg_leaf 1803), + Iarg_facet ((3,false),0.7196,792, + Iarg_leaf 1464)))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((2,true),0.5651,717, + Iarg_facet ((0,false),0.5000,1528, + Iarg_facet ((1,true),0.6558,926, + Iarg_leaf 1452))), + Iarg_bisect (2, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((3,true),0.6927,985, + Iarg_leaf 1317), + Iarg_facet ((3,false),0.5000,1435, + Iarg_facet ((0,false),0.5000,904, + Iarg_leaf 1875))), + Iarg_facet ((1,false),0.5000,880, + Iarg_facet ((3,true),0.5000,1498, + Iarg_leaf 1909))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1090, + Iarg_facet ((3,false),0.5000,1245, + Iarg_facet ((0,false),0.5000,1100, + Iarg_facet ((1,false),0.5000,838, + Iarg_leaf 1264)))), + Iarg_bisect (1, + Iarg_facet ((3,true),0.5000,1684, + Iarg_leaf 1819), + Iarg_facet ((3,false),0.7297,830, + Iarg_leaf 1401))))), + Iarg_facet ((3,false),0.8501,892, + Iarg_facet ((0,false),0.5000,895, + Iarg_leaf 1755)))))), + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,965, + Iarg_facet ((3,true),0.5000,953, + Iarg_facet ((0,false),0.6780,720, + Iarg_leaf 1399))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,956, + Iarg_facet ((0,false),0.7869,1135, + Iarg_leaf 1202)), + Iarg_facet ((3,false),0.5000,1529, + Iarg_facet ((0,false),0.5744,779, + Iarg_facet ((1,false),0.5000,924, + Iarg_leaf 1196))))), + Iarg_bisect (1, + Iarg_facet ((2,false),0.7269,1254, + Iarg_facet ((3,true),0.6459,882, + Iarg_facet ((1,false),0.5000,940, + Iarg_bisect (0, + Iarg_bisect (2, + Iarg_facet ((0,false),0.5000,721, + Iarg_leaf 1311), + Iarg_facet ((0,false),0.5000,716, + Iarg_leaf 1845)), + Iarg_facet ((2,false),0.5000,982, + Iarg_facet ((1,false),0.5000,895, + Iarg_leaf 1670)))))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.6383,829, + Iarg_facet ((2,false),0.5000,1037, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1130, + Iarg_facet ((0,false),0.5000,1488, + Iarg_facet ((2,false),0.5000,1302, + Iarg_leaf 1837))), + Iarg_facet ((1,false),0.7197,996, + Iarg_facet ((2,false),0.5000,863, + Iarg_leaf 1710))))), + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1648, + Iarg_facet ((0,false),0.5000,1015, + Iarg_facet ((1,true),0.5000,1212, + Iarg_leaf 1313))), + Iarg_facet ((3,false),0.5953,766, + Iarg_facet ((0,false),0.6315,937, + Iarg_leaf 1398))), + Iarg_facet ((2,true),0.7230,1078, + Iarg_facet ((3,false),0.6859,1138, + Iarg_leaf 1352))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.6100,906, + Iarg_facet ((1,false),0.5000,1000, + Iarg_leaf 1638)), + Iarg_bisect (3, + Iarg_facet ((1,true),0.7042,931, + Iarg_leaf 1093), + Iarg_facet ((1,false),0.5000,1745, + Iarg_facet ((0,true),0.5000,1099, + Iarg_leaf 1606)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((2,true),0.7630,1100, + Iarg_leaf 888), + Iarg_facet ((2,false),0.5000,1746, + Iarg_facet ((0,true),0.5000,1099, + Iarg_leaf 1611))), + Iarg_facet ((3,false),0.8335,793, + Iarg_leaf 1227)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.7519,761, + Iarg_leaf 1515), + Iarg_bisect (2, + Iarg_facet ((3,true),0.7247,744, + Iarg_leaf 1380), + Iarg_facet ((3,true),0.5000,1987, + Iarg_facet ((0,false),0.7016,892, + Iarg_leaf 1114)))), + Iarg_facet ((1,false),0.5000,790, + Iarg_facet ((2,false),0.5000,764, + Iarg_facet ((3,true),0.5000,946, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1471, + Iarg_leaf 1572), + Iarg_facet ((1,false),0.5000,734, + Iarg_leaf 1482)))))))))), + Iarg_facet ((0,true),0.6112,775, + Iarg_leaf 1737))));; + +add_case ("OXLZLEZ 6346351218 3 33", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1600, + Iarg_facet ((2,true),0.5000,1060, + Iarg_facet ((3,true),0.7567,859, + Iarg_leaf 1517))), + Iarg_facet ((1,true),0.5000,1563, + Iarg_facet ((2,true),0.5000,1046, + Iarg_facet ((3,true),0.7601,851, + Iarg_leaf 1576)))), + Iarg_facet ((0,true),0.5000,1642, + Iarg_leaf 1706)), + Iarg_facet ((5,true),0.5000,1201, + Iarg_facet ((0,true),0.5000,1686, + Iarg_leaf 1771))), + Iarg_facet ((4,true),0.5000,1336, + Iarg_facet ((5,true),0.5000,949, + Iarg_facet ((0,false),0.5000,1009, + Iarg_leaf 1151)))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1448, + Iarg_facet ((0,true),0.5000,1721, + Iarg_leaf 1806)), + Iarg_facet ((5,true),0.6568,815, + Iarg_leaf 1248)), + Iarg_facet ((4,true),0.6221,927, + Iarg_leaf 1105))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1986, + Iarg_facet ((5,true),0.5000,1610, + Iarg_facet ((0,true),0.5000,1705, + Iarg_leaf 1776))), + Iarg_facet ((4,true),0.6329,927, + Iarg_leaf 1109)), + Iarg_facet ((3,true),0.5000,979, + Iarg_facet ((4,true),0.5000,760, + Iarg_leaf 1851)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1606, + Iarg_facet ((4,true),0.5000,1259, + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1246, + Iarg_leaf 1246), + Iarg_facet ((0,false),0.5000,1341, + Iarg_leaf 1398)))), + Iarg_facet ((3,true),0.5000,754, + Iarg_facet ((4,true),0.6678,779, + Iarg_leaf 1130))), + Iarg_facet ((2,true),0.5000,1398, + Iarg_facet ((3,true),0.5000,859, + Iarg_facet ((4,true),0.6486,1017, + Iarg_facet ((5,false),0.5000,971, + Iarg_leaf 1144)))))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1617, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,710, + Iarg_facet ((0,false),0.5000,1301, + Iarg_leaf 1310)), + Iarg_facet ((5,true),0.6297,935, + Iarg_facet ((0,false),0.5000,1166, + Iarg_leaf 1226)))), + Iarg_facet ((3,true),0.5000,885, + Iarg_facet ((4,false),0.5000,1454, + Iarg_leaf 1602))), + Iarg_facet ((2,true),0.5000,1452, + Iarg_facet ((3,true),0.5000,776, + Iarg_facet ((4,true),0.5000,900, + Iarg_leaf 1136)))), + Iarg_facet ((1,true),0.5000,1348, + Iarg_facet ((2,true),0.5000,860, + Iarg_leaf 1469)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1069, + Iarg_facet ((5,true),0.5000,752, + Iarg_leaf 1520)), + Iarg_facet ((4,true),0.5000,894, + Iarg_leaf 1751)), + Iarg_facet ((3,true),0.5000,1413, + Iarg_leaf 1605)), + Iarg_facet ((2,true),0.5000,1609, + Iarg_facet ((3,true),0.5000,1418, + Iarg_leaf 1612))), + Iarg_facet ((1,true),0.5000,1880, + Iarg_facet ((2,true),0.5000,1189, + Iarg_facet ((3,true),0.5000,1091, + Iarg_leaf 1134)))), + Iarg_facet ((5,true),0.5000,1682, + Iarg_facet ((1,true),0.5000,1946, + Iarg_facet ((2,true),0.5000,1302, + Iarg_facet ((3,true),0.5000,1115, + Iarg_leaf 1150)))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1384, + Iarg_facet ((4,true),0.5000,1577, + Iarg_facet ((5,true),0.5000,842, + Iarg_facet ((0,false),0.5000,1360, + Iarg_leaf 1375)))), + Iarg_facet ((3,true),0.5000,1225, + Iarg_facet ((4,true),0.5000,1702, + Iarg_facet ((5,true),0.6041,994, + Iarg_facet ((0,false),0.5000,1263, + Iarg_leaf 1370))))), + Iarg_facet ((2,true),0.5000,1855, + Iarg_facet ((3,true),0.5000,700, + Iarg_leaf 1537))), + Iarg_facet ((1,true),0.5000,1508, + Iarg_facet ((2,true),0.5000,1365, + Iarg_leaf 1549))), + Iarg_facet ((5,true),0.5000,1951, + Iarg_facet ((1,true),0.5000,1988, + Iarg_bisect (2, + Iarg_facet ((3,true),0.6280,961, + Iarg_leaf 1974), + Iarg_facet ((3,true),0.6469,903, + Iarg_facet ((4,false),0.5000,1020, + Iarg_leaf 1183)))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1919, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1666, + Iarg_facet ((3,true),0.5000,996, + Iarg_leaf 1018)), + Iarg_facet ((2,true),0.5000,900, + Iarg_leaf 1157))), + Iarg_facet ((5,true),0.6266,897, + Iarg_leaf 1703)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1391, + Iarg_facet ((4,true),0.5000,1218, + Iarg_facet ((5,true),0.5000,1244, + Iarg_facet ((0,false),0.5000,1342, + Iarg_leaf 1354)))), + Iarg_facet ((3,true),0.6224,868, + Iarg_leaf 1166)), + Iarg_facet ((2,true),0.5000,1796, + Iarg_facet ((3,true),0.5000,1205, + Iarg_facet ((4,true),0.5000,998, + Iarg_facet ((5,true),0.5000,1358, + Iarg_facet ((0,false),0.5000,1412, + Iarg_leaf 1475)))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,946, + Iarg_facet ((3,true),0.6471,925, + Iarg_leaf 1882)), + Iarg_facet ((2,true),0.5000,873, + Iarg_facet ((3,true),0.6710,843, + Iarg_facet ((4,true),0.7806,826, + Iarg_leaf 1302))))), + Iarg_facet ((5,true),0.5000,1921, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,880, + Iarg_leaf 1633), + Iarg_facet ((2,true),0.5000,721, + Iarg_leaf 1438)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1123, + Iarg_leaf 1965), + Iarg_facet ((2,true),0.5000,893, + Iarg_leaf 1604)), + Iarg_facet ((1,true),0.5000,914, + Iarg_leaf 1203)), + Iarg_facet ((5,true),0.5000,701, + Iarg_leaf 1954))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1877, + Iarg_facet ((2,true),0.5000,1085, + Iarg_leaf 1281)), + Iarg_facet ((1,true),0.5000,1016, + Iarg_leaf 1114)), + Iarg_facet ((5,true),0.5000,1052, + Iarg_facet ((1,true),0.5000,980, + Iarg_leaf 1283))), + Iarg_facet ((4,true),0.5000,1040, + Iarg_facet ((5,true),0.5000,765, + Iarg_facet ((1,true),0.5000,907, + Iarg_leaf 1288)))))));; + +add_case ("QITNPEA 5400790175 b split(1/4)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1890, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1202, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1334, + Iarg_facet ((5,true),0.7029,817, + Iarg_leaf 1965)), + Iarg_facet ((4,true),0.6532,1026, + Iarg_leaf 1180))), + Iarg_facet ((1,true),0.5000,1184, + Iarg_facet ((2,true),0.5000,1839, + Iarg_facet ((4,true),0.5000,1099, + Iarg_facet ((5,true),0.7088,740, + Iarg_leaf 1306)))))), + Iarg_facet ((5,true),0.5000,893, + Iarg_facet ((3,true),0.5000,1978, + Iarg_facet ((1,true),0.6907,783, + Iarg_leaf 1396)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,873, + Iarg_bisect (3, + Iarg_facet ((1,true),0.7230,878, + Iarg_leaf 1255), + Iarg_facet ((1,true),0.6799,753, + Iarg_leaf 1311))), + Iarg_facet ((5,true),0.6484,828, + Iarg_leaf 1304))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1477, + Iarg_facet ((5,true),0.5000,797, + Iarg_leaf 1973)), + Iarg_facet ((4,true),0.5000,883, + Iarg_leaf 1480))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1337, + Iarg_facet ((2,true),0.5000,1950, + Iarg_facet ((4,true),0.5000,1203, + Iarg_facet ((5,true),0.7289,969, + Iarg_leaf 1444)))), + Iarg_facet ((1,true),0.5000,1795, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1711, + Iarg_facet ((5,true),0.6518,1020, + Iarg_facet ((3,false),0.5000,1044, + Iarg_leaf 1459))), + Iarg_facet ((4,true),0.5000,797, + Iarg_leaf 1693)))), + Iarg_facet ((3,false),0.5000,1107, + Iarg_leaf 1456)), + Iarg_facet ((5,true),0.5000,1037, + Iarg_bisect (3, + Iarg_facet ((1,true),0.6764,796, + Iarg_leaf 1393), + Iarg_facet ((1,true),0.6392,914, + Iarg_facet ((2,true),0.5000,799, + Iarg_leaf 1281))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,981, + Iarg_bisect (3, + Iarg_facet ((1,true),0.6481,770, + Iarg_leaf 1621), + Iarg_facet ((1,true),0.6249,944, + Iarg_facet ((4,true),0.5000,841, + Iarg_leaf 1273)))), + Iarg_facet ((5,true),0.8119,1004, + Iarg_leaf 1305))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1482, + Iarg_facet ((5,true),0.5000,913, + Iarg_facet ((3,false),0.5000,1146, + Iarg_leaf 1497))), + Iarg_facet ((4,true),0.5000,713, + Iarg_leaf 1564)))), + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1400, + Iarg_leaf 1870), + Iarg_facet ((4,true),0.5000,1038, + Iarg_leaf 1404)), + Iarg_facet ((2,true),0.5000,1125, + Iarg_leaf 1489)), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1333, + Iarg_leaf 1938), + Iarg_facet ((4,true),0.5000,792, + Iarg_leaf 1297)), + Iarg_facet ((2,true),0.5000,951, + Iarg_leaf 1382)))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6318,920, + Iarg_facet ((3,true),0.5000,928, + Iarg_leaf 1134)), + Iarg_facet ((5,true),0.6656,808, + Iarg_leaf 909)), + Iarg_facet ((4,true),0.5000,1260, + Iarg_leaf 1710)), + Iarg_facet ((2,true),0.5000,1001, + Iarg_leaf 1745)), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1835, + Iarg_facet ((5,true),0.6398,938, + Iarg_leaf 1884)), + Iarg_facet ((4,true),0.5000,829, + Iarg_leaf 1455)), + Iarg_facet ((2,true),0.5000,841, + Iarg_leaf 1363))), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1461, + Iarg_facet ((2,true),0.5000,1051, + Iarg_facet ((4,true),0.5000,862, + Iarg_leaf 1183))), + Iarg_facet ((1,true),0.5000,1341, + Iarg_facet ((2,true),0.5000,883, + Iarg_leaf 1609))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1709, + Iarg_facet ((5,true),0.6299,896, + Iarg_facet ((3,true),0.5000,957, + Iarg_leaf 1160))), + Iarg_facet ((4,true),0.5000,1264, + Iarg_facet ((5,true),0.8797,1133, + Iarg_leaf 589))), + Iarg_facet ((2,true),0.5000,1205, + Iarg_leaf 1558)), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1443, + Iarg_facet ((5,true),0.6575,883, + Iarg_leaf 1761)), + Iarg_facet ((4,true),0.5000,825, + Iarg_leaf 1838)), + Iarg_facet ((2,true),0.5000,995, + Iarg_leaf 1331))), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1430, + Iarg_facet ((2,true),0.5000,1102, + Iarg_leaf 1749)), + Iarg_facet ((1,true),0.5000,1320, + Iarg_facet ((2,true),0.5000,974, + Iarg_leaf 1431)))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1507, + Iarg_facet ((2,true),0.5000,1368, + Iarg_facet ((4,true),0.5000,899, + Iarg_leaf 1111))), + Iarg_facet ((1,true),0.5000,1475, + Iarg_facet ((2,true),0.5000,846, + Iarg_leaf 1242))), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,888, + Iarg_leaf 1345), + Iarg_facet ((1,true),0.5000,1093, + Iarg_leaf 1497))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,952, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1327, + Iarg_leaf 1717), + Iarg_facet ((4,true),0.5000,805, + Iarg_leaf 1333)), + Iarg_facet ((2,true),0.5000,1439, + Iarg_leaf 1785)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1789, + Iarg_facet ((4,true),0.5000,1174, + Iarg_leaf 1910)), + Iarg_facet ((2,true),0.5000,1289, + Iarg_leaf 1637)))), + Iarg_facet ((5,true),0.5000,926, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1964, + Iarg_facet ((2,true),0.5000,854, + Iarg_leaf 1487)), + Iarg_facet ((1,true),0.5000,1821, + Iarg_leaf 1943)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,929, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,999, + Iarg_leaf 1451), + Iarg_facet ((2,true),0.5000,919, + Iarg_leaf 1206)), + Iarg_facet ((1,true),0.5000,1816, + Iarg_facet ((2,true),0.5000,910, + Iarg_leaf 1195)))), + Iarg_facet ((5,true),0.6353,933, + Iarg_facet ((3,false),0.5000,1691, + Iarg_leaf 1964))))));; + +add_case ("GLFVCVK4 2477216213 split(32/64)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1796, + Iarg_facet ((3,true),0.5000,1201, + Iarg_facet ((4,true),0.5000,1057, + Iarg_facet ((5,true),0.5000,857, + Iarg_facet ((0,true),0.5000,1117, + Iarg_leaf 1790))))), + Iarg_facet ((2,true),0.7717,1280, + Iarg_leaf 1105)), + Iarg_facet ((1,true),0.5000,1704, + Iarg_facet ((2,true),0.5000,1186, + Iarg_facet ((3,true),0.5000,813, + Iarg_facet ((4,true),0.6340,991, + Iarg_facet ((5,true),0.7040,818, + Iarg_leaf 1827)))))), + Iarg_facet ((0,true),0.5000,1367, + Iarg_leaf 1694)), + Iarg_facet ((5,true),0.5000,914, + Iarg_facet ((0,true),0.5000,1502, + Iarg_leaf 1781))), + Iarg_facet ((4,true),0.5000,1825, + Iarg_facet ((5,true),0.5000,1374, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,765, + Iarg_leaf 1473), + Iarg_facet ((1,true),0.5000,704, + Iarg_leaf 1359))))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1603, + Iarg_facet ((5,true),0.5000,1089, + Iarg_facet ((0,true),0.5000,1567, + Iarg_leaf 1839))), + Iarg_facet ((4,true),0.5000,732, + Iarg_facet ((5,true),0.6633,778, + Iarg_leaf 1098)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1465, + Iarg_facet ((5,true),0.5000,1262, + Iarg_facet ((0,true),0.5000,1539, + Iarg_leaf 1807))), + Iarg_facet ((4,true),0.5000,716, + Iarg_facet ((5,true),0.6582,856, + Iarg_leaf 1146))), + Iarg_facet ((3,true),0.5000,982, + Iarg_leaf 1950))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1882, + Iarg_facet ((3,true),0.5000,1719, + Iarg_facet ((4,true),0.5000,809, + Iarg_facet ((5,true),0.5000,1359, + Iarg_leaf 1754)))), + Iarg_facet ((2,true),0.5000,968, + Iarg_facet ((3,true),0.5000,798, + Iarg_leaf 1868)))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1676, + Iarg_facet ((4,true),0.5000,1766, + Iarg_facet ((5,true),0.6693,790, + Iarg_leaf 1348))), + Iarg_facet ((3,true),0.5000,798, + Iarg_leaf 1790)), + Iarg_facet ((2,true),0.5000,1013, + Iarg_leaf 1896)), + Iarg_facet ((1,true),0.5000,1113, + Iarg_leaf 1964))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1889, + Iarg_facet ((5,true),0.5000,1410, + Iarg_facet ((0,true),0.5000,1746, + Iarg_facet ((1,true),0.5000,745, + Iarg_leaf 1369)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1575, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1005, + Iarg_facet ((2,true),0.6192,919, + Iarg_leaf 1640)), + Iarg_facet ((1,true),0.5000,935, + Iarg_facet ((2,true),0.6318,886, + Iarg_leaf 1355)))), + Iarg_facet ((5,true),0.6486,859, + Iarg_leaf 1179))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,734, + Iarg_facet ((5,true),0.6667,808, + Iarg_leaf 1139)), + Iarg_facet ((4,true),0.5000,863, + Iarg_facet ((5,true),0.6434,827, + Iarg_leaf 1284)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,714, + Iarg_facet ((5,true),0.6545,881, + Iarg_leaf 1189)), + Iarg_facet ((4,true),0.5000,854, + Iarg_facet ((5,true),0.6340,892, + Iarg_leaf 1331))), + Iarg_facet ((3,false),0.5000,1006, + Iarg_leaf 1250))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1430, + Iarg_facet ((3,false),0.5000,1594, + Iarg_leaf 1900)), + Iarg_facet ((2,true),0.6189,895, + Iarg_leaf 1253))), + Iarg_facet ((5,true),0.5000,1889, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1502, + Iarg_facet ((3,false),0.5000,1559, + Iarg_leaf 1859)), + Iarg_facet ((2,true),0.5000,722, + Iarg_leaf 1423))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1496, + Iarg_facet ((4,true),0.5000,1011, + Iarg_facet ((5,true),0.6617,789, + Iarg_leaf 1492))), + Iarg_facet ((3,true),0.5000,1123, + Iarg_facet ((4,true),0.5000,880, + Iarg_facet ((5,true),0.7680,796, + Iarg_leaf 1120)))), + Iarg_facet ((2,true),0.5000,1240, + Iarg_leaf 1642)), + Iarg_facet ((1,true),0.5000,1138, + Iarg_facet ((2,true),0.5000,1074, + Iarg_leaf 1113))), + Iarg_facet ((5,true),0.5000,1574, + Iarg_facet ((1,true),0.5000,1532, + Iarg_facet ((2,true),0.5000,1558, + Iarg_leaf 1712)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1854, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1440, + Iarg_leaf 1674), + Iarg_facet ((3,false),0.5000,915, + Iarg_leaf 1146)), + Iarg_facet ((2,true),0.5000,917, + Iarg_leaf 1269))), + Iarg_facet ((5,true),0.6372,852, + Iarg_leaf 1771)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1612, + Iarg_facet ((3,true),0.5000,1522, + Iarg_facet ((4,true),0.5000,747, + Iarg_facet ((5,true),0.5000,840, + Iarg_leaf 1983)))), + Iarg_facet ((2,true),0.5000,1239, + Iarg_facet ((3,true),0.5000,1145, + Iarg_facet ((4,true),0.6501,834, + Iarg_leaf 1806)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,713, + Iarg_leaf 1768), + Iarg_facet ((2,true),0.6282,907, + Iarg_leaf 1150))), + Iarg_facet ((5,true),0.5000,1496, + Iarg_facet ((1,true),0.5000,1609, + Iarg_leaf 1751))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1285, + Iarg_facet ((3,false),0.5000,1486, + Iarg_leaf 1712)), + Iarg_facet ((2,true),0.5000,910, + Iarg_facet ((3,false),0.5000,942, + Iarg_leaf 1169))), + Iarg_facet ((1,true),0.5000,876, + Iarg_leaf 1250)), + Iarg_facet ((5,true),0.6345,930, + Iarg_leaf 1457))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1663, + Iarg_facet ((1,true),0.5000,1471, + Iarg_leaf 1767)), + Iarg_facet ((5,true),0.5000,784, + Iarg_leaf 1771)), + Iarg_facet ((4,true),0.5000,1002, + Iarg_facet ((5,true),0.5000,738, + Iarg_facet ((1,true),0.5000,926, + Iarg_leaf 1340)))))));; + +add_case ("7550003505 1 3 4", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,1811, + Iarg_leaf 1853), + Iarg_facet ((5,true),0.6926,800, + Iarg_leaf 1653)), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_facet ((0,true),0.8107,891, + Iarg_facet ((1,true),0.8014,837, + Iarg_leaf 1031)), + Iarg_facet ((0,true),0.5000,1423, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1514, + Iarg_bisect (4, + Iarg_facet ((3,true),0.5000,1147, + Iarg_leaf 1364), + Iarg_facet ((3,true),0.5000,930, + Iarg_leaf 1194))), + Iarg_facet ((2,true),0.6305,1163, + Iarg_facet ((4,true),0.5000,1021, + Iarg_leaf 1235))))), + Iarg_bisect (5, + Iarg_facet ((0,true),0.8140,929, + Iarg_leaf 1684), + Iarg_facet ((0,true),0.5000,1274, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1304, + Iarg_bisect (4, + Iarg_facet ((3,false),0.5000,1278, + Iarg_leaf 1446), + Iarg_facet ((3,false),0.5000,966, + Iarg_leaf 1067))), + Iarg_facet ((2,true),0.5000,746, + Iarg_leaf 1682))))), + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,993, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,836, + Iarg_facet ((2,false),0.6404,1030, + Iarg_leaf 1256)), + Iarg_facet ((1,true),0.7177,752, + Iarg_leaf 1467))), + Iarg_facet ((5,false),0.5689,1032, + Iarg_facet ((0,true),0.5000,1951, + Iarg_facet ((1,true),0.5000,814, + Iarg_leaf 1444))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1318, + Iarg_facet ((4,true),0.5000,1714, + Iarg_leaf 1968)), + Iarg_facet ((2,true),0.5000,872, + Iarg_facet ((4,true),0.5000,1818, + Iarg_leaf 1931))), + Iarg_facet ((1,true),0.5000,1102, + Iarg_leaf 1778)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1223, + Iarg_facet ((4,true),0.5000,1985, + Iarg_facet ((5,true),0.5000,803, + Iarg_leaf 1618))), + Iarg_facet ((2,true),0.5000,868, + Iarg_facet ((4,true),0.5000,1533, + Iarg_leaf 1622))), + Iarg_facet ((1,true),0.5000,899, + Iarg_facet ((2,true),0.8765,770, + Iarg_leaf 810)))), + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,false),0.7400,1023, + Iarg_leaf 1469), + Iarg_facet ((1,false),0.5000,891, + Iarg_leaf 1165)), + Iarg_facet ((0,true),0.5000,1958, + Iarg_facet ((1,false),0.8155,1219, + Iarg_leaf 643)))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1184, + Iarg_leaf 1788), + Iarg_facet ((1,true),0.5000,1494, + Iarg_facet ((2,true),0.5000,1436, + Iarg_leaf 1830))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1321, + Iarg_leaf 1708), + Iarg_facet ((1,true),0.5000,1235, + Iarg_facet ((2,true),0.5000,1336, + Iarg_leaf 1917)))), + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1085, + Iarg_facet ((1,true),0.5000,1869, + Iarg_leaf 1916)), + Iarg_facet ((0,false),0.5000,1024, + Iarg_facet ((1,true),0.5000,1695, + Iarg_leaf 1841))))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,1801, + Iarg_facet ((4,false),0.8354,1127, + Iarg_leaf 1413)), + Iarg_facet ((3,true),0.5000,1030, + Iarg_leaf 1428)), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.7772,859, + Iarg_facet ((1,true),0.8128,822, + Iarg_leaf 1310)), + Iarg_facet ((0,true),0.5000,1998, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1770, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1179, + Iarg_leaf 1533), + Iarg_facet ((4,true),0.5000,1156, + Iarg_leaf 1553))), + Iarg_facet ((2,true),0.6249,961, + Iarg_leaf 1632)))), + Iarg_facet ((5,false),0.6241,1194, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6575,798, + Iarg_leaf 1415), + Iarg_facet ((1,true),0.8149,805, + Iarg_leaf 1058)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.7494,937, + Iarg_facet ((1,true),0.7410,922, + Iarg_facet ((2,true),0.5000,738, + Iarg_leaf 1373))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1794, + Iarg_facet ((3,true),0.5000,933, + Iarg_leaf 1324)), + Iarg_facet ((4,false),0.6988,958, + Iarg_leaf 1076)), + Iarg_facet ((2,true),0.6660,1172, + Iarg_leaf 1845)), + Iarg_facet ((1,true),0.7214,708, + Iarg_facet ((2,true),0.8163,777, + Iarg_leaf 776)))), + Iarg_facet ((5,false),0.5000,961, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6466,1095, + Iarg_leaf 1985), + Iarg_facet ((1,true),0.7899,1089, + Iarg_leaf 1975))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1837, + Iarg_facet ((3,true),0.5000,1792, + Iarg_facet ((4,true),0.5000,1079, + Iarg_leaf 1325))), + Iarg_facet ((2,true),0.5000,911, + Iarg_facet ((3,false),0.5000,1799, + Iarg_facet ((4,true),0.5000,935, + Iarg_leaf 1109)))), + Iarg_facet ((1,true),0.5000,851, + Iarg_facet ((2,true),0.8273,1083, + Iarg_leaf 1335))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.7042,828, + Iarg_leaf 1620), + Iarg_facet ((1,false),0.5000,1093, + Iarg_leaf 1342))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1067, + Iarg_facet ((2,false),0.6499,1045, + Iarg_leaf 1487)), + Iarg_facet ((1,true),0.5000,1407, + Iarg_facet ((2,true),0.5000,1990, + Iarg_facet ((3,false),0.5000,1233, + Iarg_leaf 1382)))), + Iarg_facet ((0,false),0.5000,970, + Iarg_facet ((1,true),0.5000,1899, + Iarg_facet ((2,true),0.5000,1079, + Iarg_leaf 1106))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1465, + Iarg_leaf 1922), + Iarg_facet ((2,true),0.5000,1252, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1127, + Iarg_leaf 1232), + Iarg_facet ((5,false),0.5000,954, + Iarg_leaf 1080)))), + Iarg_facet ((1,true),0.5000,1237, + Iarg_facet ((2,true),0.7804,959, + Iarg_leaf 1172))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.7903,1216, + Iarg_leaf 998), + Iarg_facet ((1,false),0.5000,727, + Iarg_leaf 1651))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1579, + Iarg_facet ((2,false),0.7446,952, + Iarg_leaf 1485)), + Iarg_facet ((1,true),0.5000,1723, + Iarg_bisect (2, + Iarg_facet ((5,true),0.5000,1150, + Iarg_leaf 1398), + Iarg_facet ((5,false),0.5000,1167, + Iarg_leaf 1571)))), + Iarg_facet ((0,false),0.5000,1178, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,815, + Iarg_leaf 1338), + Iarg_facet ((2,true),0.5000,738, + Iarg_leaf 1575))))))))));; + +add_case ("1395142356", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1081, + Iarg_facet ((4,true),0.5000,808, + Iarg_facet ((5,true),0.6390,990, + Iarg_facet ((0,true),0.5000,1395, + Iarg_leaf 1631)))), + Iarg_facet ((3,true),0.5000,976, + Iarg_facet ((4,true),0.5000,702, + Iarg_facet ((5,true),0.7753,905, + Iarg_leaf 1481)))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,974, + Iarg_facet ((4,true),0.6277,715, + Iarg_facet ((5,true),0.6732,798, + Iarg_leaf 1407))), + Iarg_facet ((3,true),0.5000,898, + Iarg_leaf 1948))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5879,877, + Iarg_facet ((4,true),0.6048,907, + Iarg_facet ((5,true),0.6975,769, + Iarg_leaf 1256))), + Iarg_facet ((3,true),0.6449,885, + Iarg_leaf 1772)), + Iarg_facet ((2,true),0.5000,1786, + Iarg_facet ((3,true),0.7530,1208, + Iarg_leaf 1540)))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1623, + Iarg_leaf 1654), + Iarg_facet ((1,true),0.5000,1612, + Iarg_leaf 1620))), + Iarg_facet ((5,true),0.5000,1813, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1384, + Iarg_leaf 1931), + Iarg_facet ((1,true),0.5000,1195, + Iarg_facet ((2,false),0.5000,980, + Iarg_leaf 1065))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1832, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1929, + Iarg_facet ((2,false),0.5000,980, + Iarg_leaf 1059)), + Iarg_facet ((1,true),0.5000,1172, + Iarg_leaf 1371))), + Iarg_facet ((5,true),0.5000,850, + Iarg_leaf 1865))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((3,true),0.5000,1301, + Iarg_facet ((4,true),0.5000,916, + Iarg_leaf 1956)), + Iarg_facet ((3,true),0.5000,1103, + Iarg_leaf 1692)), + Iarg_facet ((1,true),0.5000,1772, + Iarg_facet ((3,true),0.5000,826, + Iarg_leaf 1958))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1199, + Iarg_leaf 1557), + Iarg_facet ((1,true),0.5000,817, + Iarg_leaf 1203))), + Iarg_facet ((5,true),0.5000,1815, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1025, + Iarg_leaf 1706), + Iarg_facet ((1,true),0.5000,995, + Iarg_facet ((3,true),0.6392,753, + Iarg_leaf 1233))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1830, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1722, + Iarg_facet ((4,true),0.6387,750, + Iarg_leaf 1183)), + Iarg_facet ((1,false),0.5000,1019, + Iarg_leaf 1027))), + Iarg_facet ((5,true),0.6530,884, + Iarg_leaf 1779)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1304, + Iarg_facet ((4,true),0.6431,867, + Iarg_leaf 1787)), + Iarg_facet ((3,true),0.5000,1106, + Iarg_leaf 1735)), + Iarg_facet ((2,true),0.5000,1758, + Iarg_facet ((3,true),0.5000,827, + Iarg_leaf 1959))), + Iarg_bisect (0, + Iarg_facet ((2,true),0.5000,1025, + Iarg_leaf 1769), + Iarg_facet ((2,true),0.5000,906, + Iarg_facet ((3,true),0.6392,749, + Iarg_leaf 1312)))), + Iarg_facet ((5,true),0.5000,1679, + Iarg_bisect (0, + Iarg_facet ((2,true),0.5000,1195, + Iarg_leaf 1534), + Iarg_facet ((2,true),0.5000,863, + Iarg_leaf 1202)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1983, + Iarg_facet ((2,false),0.5000,1746, + Iarg_facet ((4,true),0.6564,704, + Iarg_leaf 1206))), + Iarg_facet ((0,true),0.5000,1001, + Iarg_leaf 1370)), + Iarg_facet ((5,true),0.6494,894, + Iarg_leaf 1398))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,1607, + Iarg_leaf 1769), + Iarg_facet ((3,true),0.5000,1061, + Iarg_leaf 1163)), + Iarg_facet ((0,true),0.5000,1139, + Iarg_leaf 1669)), + Iarg_facet ((5,true),0.5000,808, + Iarg_facet ((0,true),0.5000,1248, + Iarg_leaf 1684))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1525, + Iarg_facet ((0,true),0.5000,1932, + Iarg_facet ((4,true),0.5000,1121, + Iarg_facet ((5,true),0.5000,738, + Iarg_facet ((1,false),0.5000,1645, + Iarg_leaf 1783))))), + Iarg_facet ((5,true),0.7544,839, + Iarg_leaf 1061))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,903, + Iarg_facet ((4,true),0.5000,1006, + Iarg_facet ((5,true),0.5000,725, + Iarg_leaf 1496))), + Iarg_facet ((3,true),0.5000,710, + Iarg_facet ((4,true),0.5000,848, + Iarg_leaf 1272))), + Iarg_facet ((2,true),0.5000,1766, + Iarg_facet ((3,true),0.5000,714, + Iarg_facet ((4,true),0.6459,851, + Iarg_leaf 1185)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1020, + Iarg_leaf 1777), + Iarg_facet ((2,true),0.5000,911, + Iarg_facet ((3,true),0.6552,702, + Iarg_leaf 1309)))), + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1955, + Iarg_facet ((2,false),0.5000,1744, + Iarg_facet ((3,true),0.6549,701, + Iarg_leaf 1236))), + Iarg_facet ((1,true),0.5000,930, + Iarg_leaf 1376))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1709, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1178, + Iarg_leaf 1530), + Iarg_facet ((2,true),0.5000,899, + Iarg_leaf 1180))), + Iarg_facet ((5,true),0.6499,901, + Iarg_leaf 1332))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((3,true),0.5000,1054, + Iarg_facet ((4,true),0.5000,1136, + Iarg_leaf 1183)), + Iarg_facet ((3,true),0.5000,869, + Iarg_leaf 1368)), + Iarg_facet ((1,true),0.5000,1125, + Iarg_leaf 1664)), + Iarg_facet ((5,true),0.5000,1386, + Iarg_facet ((1,true),0.5000,1892, + Iarg_facet ((3,true),0.5000,1127, + Iarg_facet ((5,true),0.5000,730, + Iarg_facet ((0,false),0.5000,1634, + Iarg_leaf 1747)))))), + Iarg_facet ((4,true),0.5000,1945, + Iarg_facet ((5,true),0.5000,823, + Iarg_facet ((1,true),0.5000,1278, + Iarg_leaf 1680))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1049, + Iarg_facet ((4,true),0.5000,722, + Iarg_leaf 1636)), + Iarg_facet ((3,true),0.5000,821, + Iarg_leaf 1356)), + Iarg_facet ((2,true),0.5000,1722, + Iarg_facet ((3,true),0.5000,1126, + Iarg_facet ((4,true),0.5000,737, + Iarg_facet ((0,false),0.5000,1691, + Iarg_leaf 1817))))), + Iarg_facet ((5,true),0.5000,1381, + Iarg_facet ((2,true),0.5000,1145, + Iarg_leaf 1665))), + Iarg_facet ((4,true),0.5000,1237, + Iarg_facet ((5,true),0.5000,1480, + Iarg_facet ((2,true),0.5000,1233, + Iarg_leaf 1680)))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1655, + Iarg_facet ((3,true),0.5000,1310, + Iarg_leaf 1715)), + Iarg_facet ((5,true),0.5000,787, + Iarg_leaf 1731)), + Iarg_facet ((4,true),0.5000,1107, + Iarg_facet ((5,true),0.5000,781, + Iarg_leaf 1844)))))));; + +add_case ("FHBVYXZv2 a split(1/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1225, + Iarg_facet ((0,false),0.7054,1181, + Iarg_facet ((1,true),0.5000,996, + Iarg_facet ((2,true),0.5000,870, + Iarg_facet ((3,true),0.6695,765, + Iarg_leaf 1647))))), + Iarg_facet ((5,true),0.5000,777, + Iarg_facet ((0,false),0.5000,882, + Iarg_leaf 1613))), + Iarg_facet ((4,true),0.5000,1435, + Iarg_facet ((5,true),0.7729,1236, + Iarg_leaf 989))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1584, + Iarg_facet ((5,true),0.5000,865, + Iarg_facet ((0,false),0.5000,886, + Iarg_leaf 1640))), + Iarg_facet ((4,true),0.6241,943, + Iarg_leaf 1145))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1482, + Iarg_facet ((4,true),0.5000,1194, + Iarg_leaf 1798)), + Iarg_facet ((3,true),0.5000,915, + Iarg_leaf 1657))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1665, + Iarg_facet ((3,true),0.5000,1003, + Iarg_facet ((4,true),0.6192,967, + Iarg_leaf 1068))), + Iarg_facet ((2,true),0.5000,896, + Iarg_leaf 1522))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1551, + Iarg_facet ((4,true),0.5000,1608, + Iarg_facet ((5,true),0.6791,785, + Iarg_leaf 1412))), + Iarg_facet ((3,true),0.5000,723, + Iarg_leaf 1573)), + Iarg_facet ((2,true),0.5000,938, + Iarg_leaf 1764)), + Iarg_facet ((1,true),0.5000,879, + Iarg_leaf 1497))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1348, + Iarg_leaf 1860), + Iarg_facet ((4,true),0.5000,1327, + Iarg_facet ((5,true),0.6585,891, + Iarg_leaf 1270))), + Iarg_facet ((3,false),0.5000,1974, + Iarg_facet ((4,true),0.6263,953, + Iarg_leaf 1054))), + Iarg_facet ((2,true),0.5000,1829, + Iarg_facet ((3,false),0.5000,1413, + Iarg_leaf 1422))), + Iarg_facet ((1,true),0.5000,1601, + Iarg_facet ((2,true),0.5000,1179, + Iarg_leaf 1818))), + Iarg_facet ((5,true),0.5000,1485, + Iarg_facet ((1,true),0.5000,1854, + Iarg_facet ((2,true),0.5000,1243, + Iarg_facet ((3,false),0.5000,1256, + Iarg_leaf 1382)))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1377, + Iarg_facet ((4,true),0.5000,902, + Iarg_facet ((5,true),0.7186,961, + Iarg_leaf 1345))), + Iarg_facet ((3,true),0.5000,1008, + Iarg_facet ((4,true),0.5000,717, + Iarg_leaf 1730))), + Iarg_facet ((2,true),0.5000,1170, + Iarg_leaf 1555)), + Iarg_facet ((1,true),0.5000,956, + Iarg_leaf 1667)), + Iarg_facet ((5,true),0.5000,1194, + Iarg_facet ((1,true),0.5000,1235, + Iarg_facet ((2,true),0.5000,1246, + Iarg_leaf 1456)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1651, + Iarg_facet ((1,true),0.5000,1916, + Iarg_facet ((2,true),0.5000,1634, + Iarg_facet ((3,false),0.5000,1150, + Iarg_leaf 1260)))), + Iarg_facet ((5,true),0.6635,768, + Iarg_leaf 1323)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1478, + Iarg_facet ((3,true),0.5000,931, + Iarg_leaf 1785)), + Iarg_facet ((2,true),0.5000,1107, + Iarg_facet ((3,true),0.5000,708, + Iarg_leaf 1341))), + Iarg_facet ((1,true),0.5000,1414, + Iarg_leaf 1674)), + Iarg_facet ((5,true),0.5000,1205, + Iarg_facet ((1,true),0.5000,1202, + Iarg_leaf 1549))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1760, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1104, + Iarg_leaf 1682), + Iarg_facet ((2,true),0.5000,812, + Iarg_leaf 1226))), + Iarg_facet ((5,true),0.6596,848, + Iarg_leaf 1244))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1995, + Iarg_facet ((5,true),0.5000,1361, + Iarg_facet ((1,true),0.5000,1265, + Iarg_leaf 1661))), + Iarg_facet ((4,true),0.5000,738, + Iarg_facet ((5,true),0.6451,837, + Iarg_leaf 1467))))));; + +add_case ("7550003505 0 3 4", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,1055, + Iarg_facet ((4,false),0.8291,1613, + Iarg_facet ((5,false),0.6416,739, + Iarg_leaf 1266))), + Iarg_facet ((5,true),0.7908,1228, + Iarg_leaf 1689)), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,1020, + Iarg_facet ((0,true),0.6229,1138, + Iarg_facet ((1,true),0.8415,889, + Iarg_leaf 1303))), + Iarg_bisect (5, + Iarg_facet ((0,true),0.7492,859, + Iarg_facet ((1,true),0.7492,815, + Iarg_facet ((2,true),0.6631,1013, + Iarg_leaf 1165))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1951, + Iarg_facet ((2,true),0.5000,1547, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,925, + Iarg_leaf 1210), + Iarg_facet ((5,false),0.5000,1241, + Iarg_leaf 1545)), + Iarg_facet ((3,false),0.5000,1472, + Iarg_leaf 1870)))), + Iarg_facet ((1,true),0.8124,898, + Iarg_leaf 1042)))), + Iarg_facet ((3,false),0.6291,1271, + Iarg_facet ((5,false),0.6008,789, + Iarg_facet ((0,false),0.5000,1183, + Iarg_leaf 1779)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1120, + Iarg_facet ((1,true),0.7882,982, + Iarg_leaf 1607)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1508, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1319, + Iarg_facet ((3,false),0.5000,1261, + Iarg_leaf 1603)), + Iarg_facet ((5,true),0.5000,1112, + Iarg_facet ((3,false),0.5000,897, + Iarg_leaf 1114)))), + Iarg_facet ((2,true),0.7752,1081, + Iarg_facet ((4,true),0.5000,929, + Iarg_leaf 1279))), + Iarg_facet ((1,true),0.5000,1046, + Iarg_facet ((2,true),0.7800,812, + Iarg_facet ((4,false),0.6865,1147, + Iarg_leaf 1046))))), + Iarg_facet ((3,false),0.6203,1140, + Iarg_bisect (0, + Iarg_facet ((1,false),0.7602,1193, + Iarg_leaf 624), + Iarg_facet ((1,true),0.5000,859, + Iarg_leaf 1325)))), + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,1140, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6791,827, + Iarg_leaf 1847), + Iarg_facet ((1,true),0.5000,836, + Iarg_facet ((2,true),0.5000,1565, + Iarg_facet ((5,false),0.5000,1411, + Iarg_leaf 1782))))), + Iarg_facet ((3,false),0.5482,842, + Iarg_facet ((0,false),0.6780,810, + Iarg_facet ((1,true),0.6326,1173, + Iarg_leaf 944))))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.6218,1059, + Iarg_facet ((4,false),0.8289,1739, + Iarg_facet ((5,false),0.5000,926, + Iarg_leaf 1737))), + Iarg_facet ((3,true),0.5000,896, + Iarg_facet ((5,true),0.6735,868, + Iarg_leaf 1513))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.7492,1226, + Iarg_facet ((1,true),0.6595,804, + Iarg_facet ((2,true),0.5000,1130, + Iarg_facet ((3,true),0.5000,1247, + Iarg_leaf 1701)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1672, + Iarg_leaf 1859), + Iarg_facet ((5,false),0.5000,1067, + Iarg_leaf 1228)), + Iarg_facet ((4,true),0.5000,1913, + Iarg_facet ((5,false),0.5000,1183, + Iarg_leaf 1275))), + Iarg_facet ((3,false),0.5000,1461, + Iarg_facet ((4,false),0.7111,927, + Iarg_leaf 992))), + Iarg_facet ((2,true),0.5000,1063, + Iarg_facet ((3,false),0.5000,1602, + Iarg_facet ((4,true),0.5000,952, + Iarg_leaf 1218)))), + Iarg_facet ((1,true),0.7392,1254, + Iarg_facet ((2,true),0.8052,740, + Iarg_leaf 1038)))), + Iarg_facet ((5,false),0.5000,1302, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1001, + Iarg_facet ((2,false),0.5000,785, + Iarg_facet ((3,false),0.5000,1291, + Iarg_leaf 1753))), + Iarg_facet ((1,true),0.7055,1011, + Iarg_facet ((2,true),0.5000,1494, + Iarg_leaf 1892))))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1192, + Iarg_facet ((0,true),0.6566,1264, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5693,948, + Iarg_leaf 1494), + Iarg_facet ((2,true),0.5000,1000, + Iarg_facet ((4,true),0.5000,1013, + Iarg_leaf 1126))))), + Iarg_facet ((5,false),0.5000,839, + Iarg_facet ((0,true),0.5000,1970, + Iarg_facet ((1,true),0.5000,1446, + Iarg_facet ((2,false),0.7710,937, + Iarg_leaf 1419)))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1908, + Iarg_facet ((5,true),0.5000,825, + Iarg_leaf 1742)), + Iarg_facet ((4,true),0.5000,1491, + Iarg_leaf 1725)), + Iarg_facet ((3,false),0.5000,1466, + Iarg_facet ((4,false),0.7177,1037, + Iarg_leaf 1054))), + Iarg_facet ((2,true),0.5000,1440, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1380, + Iarg_leaf 1789), + Iarg_facet ((4,true),0.5000,1829, + Iarg_facet ((5,false),0.5000,1035, + Iarg_leaf 1310))))), + Iarg_facet ((1,true),0.5000,1822, + Iarg_facet ((2,true),0.6707,789, + Iarg_facet ((3,true),0.5000,1619, + Iarg_facet ((4,false),0.6080,819, + Iarg_facet ((5,false),0.5000,893, + Iarg_leaf 1165)))))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.6238,854, + Iarg_facet ((2,true),0.6741,937, + Iarg_leaf 1611)), + Iarg_facet ((1,false),0.5000,1816, + Iarg_facet ((2,true),0.8109,714, + Iarg_leaf 1318)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1655, + Iarg_facet ((2,false),0.5000,785, + Iarg_facet ((3,false),0.5000,1408, + Iarg_facet ((5,true),0.5000,789, + Iarg_leaf 1276)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,1078, + Iarg_leaf 1391), + Iarg_facet ((5,false),0.5000,1124, + Iarg_leaf 1296)), + Iarg_facet ((3,false),0.5000,1665, + Iarg_facet ((5,false),0.5000,1018, + Iarg_leaf 1343))), + Iarg_facet ((2,true),0.5000,1246, + Iarg_leaf 1400))), + Iarg_facet ((0,false),0.5000,1432, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1929, + Iarg_leaf 1941), + Iarg_facet ((2,true),0.5000,1246, + Iarg_facet ((3,false),0.5000,891, + Iarg_leaf 1226)))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,731, + Iarg_facet ((4,false),0.7698,1260, + Iarg_leaf 1224)), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1205, + Iarg_leaf 1462), + Iarg_facet ((5,false),0.5000,1087, + Iarg_leaf 1289)), + Iarg_facet ((4,false),0.6731,934, + Iarg_leaf 1515))), + Iarg_facet ((1,false),0.6580,1277, + Iarg_leaf 1136)), + Iarg_bisect (0, + Iarg_facet ((1,false),0.7177,704, + Iarg_facet ((2,true),0.5000,925, + Iarg_leaf 1684)), + Iarg_facet ((1,false),0.7108,799, + Iarg_leaf 1330))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.7329,767, + Iarg_facet ((5,true),0.5000,827, + Iarg_leaf 1205)), + Iarg_facet ((2,false),0.5832,966, + Iarg_leaf 1977)), + Iarg_bisect (1, + Iarg_facet ((2,false),0.5725,1047, + Iarg_facet ((5,false),0.5000,993, + Iarg_leaf 1306)), + Iarg_facet ((2,false),0.5000,1375, + Iarg_leaf 1918))), + Iarg_facet ((0,false),0.5000,1988, + Iarg_facet ((1,false),0.5000,1840, + Iarg_facet ((2,false),0.5000,1884, + Iarg_facet ((3,false),0.5000,1024, + Iarg_leaf 1609)))))))))));; + +add_case ("7931207804", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1032, + Iarg_facet ((4,true),0.5000,1072, + Iarg_leaf 1448)), + Iarg_facet ((3,true),0.5000,883, + Iarg_leaf 1516)), + Iarg_facet ((2,true),0.5000,1335, + Iarg_facet ((3,true),0.5000,893, + Iarg_leaf 1571))), + Iarg_facet ((1,true),0.5000,1571, + Iarg_facet ((2,true),0.5000,1120, + Iarg_leaf 1885))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,912, + Iarg_facet ((4,true),0.5000,840, + Iarg_facet ((5,false),0.5000,840, + Iarg_leaf 1283))), + Iarg_facet ((3,true),0.5000,780, + Iarg_leaf 1840)), + Iarg_facet ((2,true),0.5000,1627, + Iarg_facet ((3,true),0.5000,738, + Iarg_facet ((4,true),0.6429,846, + Iarg_leaf 1685)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1690, + Iarg_facet ((3,true),0.6364,893, + Iarg_facet ((4,true),0.6464,800, + Iarg_leaf 1260))), + Iarg_facet ((2,true),0.5000,788, + Iarg_facet ((3,true),0.6825,809, + Iarg_leaf 1311))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,918, + Iarg_facet ((5,true),0.5000,840, + Iarg_facet ((4,false),0.5000,834, + Iarg_leaf 1293))), + Iarg_facet ((3,true),0.5000,743, + Iarg_facet ((5,true),0.6461,830, + Iarg_leaf 1521))), + Iarg_facet ((2,true),0.5000,1609, + Iarg_facet ((3,true),0.5000,789, + Iarg_leaf 1877))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.6542,927, + Iarg_facet ((5,true),0.6494,788, + Iarg_leaf 1260)), + Iarg_facet ((3,true),0.6801,817, + Iarg_leaf 1296)), + Iarg_facet ((2,true),0.5000,788, + Iarg_leaf 1710))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1683, + Iarg_facet ((2,true),0.5000,1086, + Iarg_leaf 1367)), + Iarg_facet ((1,true),0.5000,1085, + Iarg_leaf 1779)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1333, + Iarg_leaf 1695), + Iarg_facet ((2,false),0.5000,1715, + Iarg_facet ((3,false),0.6177,1029, + Iarg_leaf 1249))), + Iarg_facet ((1,true),0.5000,1103, + Iarg_leaf 1283)), + Iarg_facet ((0,true),0.5000,1439, + Iarg_facet ((1,false),0.5000,1505, + Iarg_leaf 1576))), + Iarg_facet ((5,true),0.5000,1963, + Iarg_facet ((0,true),0.5000,1462, + Iarg_facet ((1,false),0.5000,1493, + Iarg_leaf 1604))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1790, + Iarg_facet ((1,true),0.5000,1383, + Iarg_facet ((3,true),0.5000,1622, + Iarg_leaf 1972))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1870, + Iarg_facet ((3,true),0.5000,1334, + Iarg_facet ((2,true),0.5000,1082, + Iarg_leaf 1337))), + Iarg_facet ((1,true),0.5000,815, + Iarg_leaf 1799))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1525, + Iarg_facet ((3,true),0.5000,1314, + Iarg_facet ((2,true),0.5000,1000, + Iarg_leaf 1526))), + Iarg_facet ((1,true),0.6461,1075, + Iarg_leaf 1462)), + Iarg_facet ((0,true),0.5000,1802, + Iarg_facet ((1,true),0.5000,861, + Iarg_leaf 1972)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1674, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,796, + Iarg_leaf 1251), + Iarg_facet ((3,false),0.5000,776, + Iarg_leaf 1263)), + Iarg_facet ((2,true),0.5000,1814, + Iarg_facet ((3,false),0.6460,1004, + Iarg_leaf 1452)))), + Iarg_facet ((0,true),0.5000,1166, + Iarg_facet ((1,false),0.5000,1658, + Iarg_leaf 1684))), + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1518, + Iarg_facet ((1,true),0.5000,1738, + Iarg_facet ((2,false),0.5000,901, + Iarg_leaf 1130))), + Iarg_facet ((0,true),0.5000,798, + Iarg_leaf 1346))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1724, + Iarg_facet ((2,true),0.5000,1336, + Iarg_facet ((3,true),0.5000,1615, + Iarg_facet ((1,true),0.5000,945, + Iarg_leaf 1087)))), + Iarg_bisect (0, + Iarg_facet ((2,true),0.5000,1512, + Iarg_facet ((3,true),0.5000,1314, + Iarg_facet ((1,true),0.5000,1034, + Iarg_leaf 1573))), + Iarg_facet ((2,true),0.6459,1062, + Iarg_leaf 1425))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((2,true),0.5000,1829, + Iarg_facet ((3,true),0.5000,1329, + Iarg_facet ((1,true),0.5000,1079, + Iarg_leaf 1343))), + Iarg_facet ((2,true),0.5000,755, + Iarg_leaf 1743)), + Iarg_facet ((0,true),0.5000,1735, + Iarg_facet ((2,true),0.5000,810, + Iarg_leaf 1884)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1591, + Iarg_bisect (2, + Iarg_bisect (1, + Iarg_facet ((3,false),0.5000,797, + Iarg_leaf 1266), + Iarg_facet ((3,false),0.5000,768, + Iarg_leaf 1288)), + Iarg_facet ((1,true),0.5000,1831, + Iarg_facet ((3,false),0.6404,1004, + Iarg_leaf 1490)))), + Iarg_facet ((0,true),0.5000,1450, + Iarg_facet ((2,true),0.5000,1692, + Iarg_leaf 1983))), + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1135, + Iarg_facet ((2,false),0.5000,1625, + Iarg_leaf 1656)), + Iarg_facet ((0,true),0.5000,792, + Iarg_leaf 1260)))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1339, + Iarg_leaf 1995), + Iarg_facet ((5,true),0.5000,1183, + Iarg_leaf 1927)), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,732, + Iarg_facet ((1,true),0.5000,1754, + Iarg_facet ((2,true),0.5000,1139, + Iarg_leaf 1892))), + Iarg_facet ((0,true),0.6243,1054, + Iarg_facet ((1,true),0.5000,872, + Iarg_leaf 1154))), + Iarg_facet ((5,true),0.5000,1173, + Iarg_facet ((0,true),0.6246,1079, + Iarg_facet ((1,true),0.5000,867, + Iarg_leaf 1183))))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1024, + Iarg_leaf 1957), + Iarg_facet ((1,true),0.5000,1840, + Iarg_facet ((2,true),0.5000,1118, + Iarg_facet ((3,true),0.6843,861, + Iarg_leaf 1615)))), + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1579, + Iarg_facet ((2,true),0.5000,1354, + Iarg_facet ((3,true),0.6835,865, + Iarg_leaf 1613))), + Iarg_facet ((1,true),0.5000,1212, + Iarg_facet ((2,true),0.5000,837, + Iarg_leaf 1261)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1449, + Iarg_leaf 1584), + Iarg_facet ((5,true),0.5000,1209, + Iarg_leaf 1429))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1194, + Iarg_leaf 1835), + Iarg_facet ((5,true),0.5000,1729, + Iarg_leaf 1746)), + Iarg_facet ((4,false),0.5000,1937, + Iarg_facet ((5,true),0.5000,766, + Iarg_leaf 1290)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1190, + Iarg_leaf 1750), + Iarg_facet ((5,true),0.5000,1686, + Iarg_leaf 1776)), + Iarg_facet ((4,true),0.5000,1691, + Iarg_facet ((5,false),0.5000,1064, + Iarg_leaf 1291))), + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,969, + Iarg_leaf 1049), + Iarg_facet ((4,true),0.5000,969, + Iarg_leaf 1077))))));; + +add_case ("7550003505 1 1 4", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,881, + Iarg_leaf 1655), + Iarg_facet ((5,false),0.5000,1925, + Iarg_facet ((3,true),0.5000,813, + Iarg_leaf 1444))), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1145, + Iarg_facet ((4,true),0.5000,1289, + Iarg_leaf 1526)), + Iarg_facet ((2,true),0.5000,745, + Iarg_facet ((4,true),0.5000,988, + Iarg_leaf 1280))), + Iarg_facet ((1,true),0.5000,822, + Iarg_leaf 1243)), + Iarg_facet ((0,true),0.5000,1733, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,910, + Iarg_facet ((4,true),0.5000,1353, + Iarg_leaf 1484)), + Iarg_facet ((2,true),0.6496,1085, + Iarg_leaf 1780)))), + Iarg_facet ((5,false),0.5000,1024, + Iarg_facet ((0,true),0.5000,1463, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,738, + Iarg_facet ((4,true),0.5000,1143, + Iarg_leaf 1480)), + Iarg_facet ((2,true),0.6461,836, + Iarg_leaf 944))))), + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,793, + Iarg_leaf 1343), + Iarg_facet ((1,true),0.5000,1198, + Iarg_facet ((2,true),0.5000,1020, + Iarg_leaf 1147))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,784, + Iarg_leaf 1295), + Iarg_facet ((1,true),0.5000,958, + Iarg_leaf 1855))), + Iarg_facet ((5,false),0.6565,953, + Iarg_facet ((0,false),0.5000,1193, + Iarg_leaf 1511)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1622, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1017, + Iarg_facet ((4,true),0.5000,1358, + Iarg_leaf 1849)), + Iarg_facet ((2,true),0.6938,789, + Iarg_leaf 1262))), + Iarg_facet ((0,true),0.5000,1855, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1146, + Iarg_facet ((4,true),0.5000,1528, + Iarg_leaf 1973)), + Iarg_facet ((2,true),0.7555,889, + Iarg_leaf 1058)))), + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1721, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((3,true),0.5000,1422, + Iarg_facet ((5,false),0.5000,954, + Iarg_leaf 1314)), + Iarg_facet ((3,true),0.5000,961, + Iarg_leaf 1355)), + Iarg_facet ((4,false),0.6676,1211, + Iarg_facet ((3,true),0.5000,1068, + Iarg_leaf 1193))), + Iarg_facet ((2,true),0.6513,1133, + Iarg_leaf 1303))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1259, + Iarg_leaf 1581), + Iarg_facet ((4,false),0.7095,1130, + Iarg_leaf 1423)), + Iarg_facet ((2,true),0.6277,1059, + Iarg_leaf 1675)), + Iarg_facet ((1,true),0.6881,718, + Iarg_leaf 1140)))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1852, + Iarg_facet ((1,true),0.5000,896, + Iarg_leaf 1645)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,751, + Iarg_leaf 1348), + Iarg_facet ((1,true),0.5000,813, + Iarg_leaf 1798))), + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6128,1006, + Iarg_facet ((2,false),0.7105,840, + Iarg_leaf 1909)), + Iarg_facet ((1,true),0.6332,952, + Iarg_leaf 1587)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.6226,1059, + Iarg_leaf 1893), + Iarg_facet ((1,true),0.5000,796, + Iarg_facet ((2,true),0.5000,981, + Iarg_leaf 1403)))))))), + Iarg_facet ((4,false),0.5000,1736, + Iarg_facet ((5,false),0.5000,1704, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1333, + Iarg_facet ((3,true),0.5000,770, + Iarg_leaf 1703)), + Iarg_facet ((2,true),0.7374,893, + Iarg_leaf 1165)), + Iarg_facet ((1,true),0.6552,923, + Iarg_leaf 1193)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1095, + Iarg_leaf 1519), + Iarg_facet ((2,true),0.5000,708, + Iarg_facet ((3,false),0.5000,1317, + Iarg_leaf 1437))), + Iarg_facet ((1,true),0.5000,845, + Iarg_leaf 1703))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6503,936, + Iarg_leaf 1224), + Iarg_facet ((1,true),0.5000,889, + Iarg_facet ((2,true),0.5000,1023, + Iarg_leaf 1391))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,829, + Iarg_leaf 1648), + Iarg_facet ((1,true),0.5000,1098, + Iarg_facet ((2,true),0.5000,1443, + Iarg_leaf 1632))))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1037, + Iarg_facet ((0,true),0.5000,1947, + Iarg_facet ((1,false),0.5000,803, + Iarg_facet ((2,true),0.5000,952, + Iarg_facet ((4,true),0.5000,956, + Iarg_leaf 1123))))), + Iarg_facet ((5,false),0.5000,776, + Iarg_facet ((0,false),0.5000,1819, + Iarg_facet ((1,true),0.5000,1385, + Iarg_facet ((2,false),0.5000,773, + Iarg_leaf 1759))))))))));; + +add_case ("7550003505 1 1 1", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1096, + Iarg_facet ((0,true),0.5000,1910, + Iarg_facet ((1,true),0.5000,1156, + Iarg_facet ((2,true),0.5000,723, + Iarg_leaf 1785)))), + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1976, + Iarg_facet ((1,true),0.5000,923, + Iarg_facet ((2,true),0.5000,774, + Iarg_leaf 1425))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1053, + Iarg_facet ((2,true),0.6201,900, + Iarg_leaf 1096)), + Iarg_facet ((1,true),0.5000,795, + Iarg_leaf 1767)))), + Iarg_facet ((4,false),0.5000,1715, + Iarg_facet ((5,false),0.5000,999, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1371, + Iarg_facet ((2,true),0.5000,834, + Iarg_leaf 1716)), + Iarg_facet ((1,true),0.5000,928, + Iarg_leaf 1556))))), + Iarg_facet ((5,true),0.9979,1610, + Iarg_leaf 1153)), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1715, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,835, + Iarg_facet ((4,false),0.5000,860, + Iarg_leaf 1284)), + Iarg_facet ((2,true),0.7875,803, + Iarg_leaf 1410))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,784, + Iarg_facet ((4,false),0.5000,997, + Iarg_leaf 1475)), + Iarg_facet ((2,true),0.6889,889, + Iarg_leaf 1839)), + Iarg_facet ((1,true),0.5000,714, + Iarg_leaf 1590))), + Iarg_facet ((5,false),0.5000,1211, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1698, + Iarg_facet ((2,true),0.5000,914, + Iarg_facet ((4,false),0.5000,1138, + Iarg_leaf 1288))), + Iarg_facet ((1,true),0.5000,930, + Iarg_leaf 1865)))), + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1550, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1535, + Iarg_facet ((5,true),0.5000,1850, + Iarg_facet ((0,true),0.6263,927, + Iarg_facet ((1,false),0.6599,849, + Iarg_facet ((2,true),0.7076,773, + Iarg_leaf 1432))))), + Iarg_facet ((4,false),0.6382,889, + Iarg_leaf 1145))), + Iarg_facet ((2,true),0.6374,1226, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1741, + Iarg_bisect (5, + Iarg_facet ((0,true),0.6263,781, + Iarg_bisect (1, + Iarg_facet ((2,true),0.7067,704, + Iarg_facet ((4,false),0.5000,804, + Iarg_facet ((3,true),0.5000,727, + Iarg_leaf 1431))), + Iarg_facet ((2,true),0.7248,942, + Iarg_facet ((4,false),0.7716,1196, + Iarg_leaf 1478)))), + Iarg_facet ((0,true),0.6684,1135, + Iarg_bisect (1, + Iarg_facet ((2,true),0.8321,1290, + Iarg_leaf 1392), + Iarg_facet ((2,true),0.7762,918, + Iarg_facet ((4,false),0.7009,873, + Iarg_facet ((5,true),0.5000,994, + Iarg_leaf 1427))))))), + Iarg_facet ((4,false),0.5000,1033, + Iarg_facet ((5,false),0.5000,945, + Iarg_facet ((0,true),0.5000,701, + Iarg_facet ((1,false),0.5000,1215, + Iarg_facet ((2,true),0.6987,745, + Iarg_facet ((3,true),0.5000,910, + Iarg_leaf 1840))))))))), + Iarg_facet ((1,true),0.6126,918, + Iarg_leaf 1602)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1848, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1370, + Iarg_facet ((5,true),0.5000,1344, + Iarg_leaf 1385)), + Iarg_facet ((4,false),0.5000,1105, + Iarg_leaf 1873))), + Iarg_facet ((2,true),0.5000,989, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1455, + Iarg_bisect (5, + Iarg_facet ((0,true),0.6278,765, + Iarg_facet ((2,true),0.7062,748, + Iarg_facet ((1,false),0.6835,1164, + Iarg_leaf 1560))), + Iarg_facet ((0,true),0.6843,797, + Iarg_leaf 1486))), + Iarg_facet ((4,false),0.5000,1124, + Iarg_facet ((5,true),0.5000,1281, + Iarg_facet ((0,true),0.6599,823, + Iarg_facet ((2,true),0.6992,750, + Iarg_leaf 1493))))))), + Iarg_facet ((1,true),0.5000,1083, + Iarg_leaf 1628))), + Iarg_facet ((5,false),0.5000,1742, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1084, + Iarg_facet ((3,true),0.5000,1172, + Iarg_facet ((4,false),0.5000,1012, + Iarg_leaf 1321))), + Iarg_facet ((2,true),0.5000,891, + Iarg_facet ((3,true),0.5000,1285, + Iarg_facet ((4,false),0.6186,977, + Iarg_facet ((5,true),0.5000,880, + Iarg_leaf 1173))))), + Iarg_facet ((1,true),0.5000,1045, + Iarg_leaf 1501))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1990, + Iarg_facet ((1,true),0.5000,1960, + Iarg_facet ((2,true),0.5000,1210, + Iarg_facet ((4,false),0.5000,792, + Iarg_leaf 1703)))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1863, + Iarg_facet ((2,true),0.5000,1146, + Iarg_facet ((4,false),0.5000,1062, + Iarg_leaf 1577))), + Iarg_facet ((1,true),0.5000,1021, + Iarg_facet ((2,true),0.6192,903, + Iarg_leaf 970)))), + Iarg_facet ((3,false),0.5000,1214, + Iarg_leaf 1263)), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1648, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,1212, + Iarg_leaf 1807), + Iarg_facet ((3,true),0.5000,903, + Iarg_leaf 1413))), + Iarg_facet ((2,true),0.5000,748, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,1739, + Iarg_facet ((4,false),0.5000,727, + Iarg_leaf 1843)), + Iarg_facet ((3,true),0.5000,1567, + Iarg_leaf 1890)))), + Iarg_facet ((1,true),0.5000,1222, + Iarg_leaf 1800)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1781, + Iarg_facet ((5,true),0.5000,1184, + Iarg_leaf 1528)), + Iarg_facet ((2,true),0.5000,927, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,962, + Iarg_leaf 1292), + Iarg_facet ((3,true),0.5000,900, + Iarg_leaf 1272)))), + Iarg_facet ((1,true),0.5000,763, + Iarg_facet ((2,true),0.7587,835, + Iarg_leaf 1242)))), + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1043, + Iarg_leaf 1774), + Iarg_facet ((3,true),0.5000,1548, + Iarg_facet ((4,false),0.6963,801, + Iarg_leaf 815))), + Iarg_facet ((2,true),0.5000,830, + Iarg_facet ((3,true),0.5000,1941, + Iarg_facet ((4,false),0.6215,786, + Iarg_leaf 1793)))), + Iarg_facet ((1,true),0.5000,1047, + Iarg_facet ((2,true),0.6235,882, + Iarg_leaf 1154))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1052, + Iarg_facet ((3,true),0.5000,1152, + Iarg_leaf 1362)), + Iarg_facet ((2,true),0.5000,825, + Iarg_facet ((3,true),0.5000,1257, + Iarg_leaf 1595))), + Iarg_facet ((1,true),0.5000,1053, + Iarg_facet ((2,true),0.6403,1111, + Iarg_leaf 1534)))))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1035, + Iarg_leaf 1063), + Iarg_bisect (5, + Iarg_facet ((3,true),0.9985,1677, + Iarg_leaf 1472), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1469, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1472, + Iarg_leaf 1938), + Iarg_facet ((2,true),0.7556,894, + Iarg_leaf 1001)), + Iarg_facet ((1,true),0.5000,1125, + Iarg_facet ((2,true),0.6456,961, + Iarg_leaf 1174)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1071, + Iarg_facet ((3,true),0.5000,866, + Iarg_leaf 1146)), + Iarg_facet ((2,true),0.6405,1222, + Iarg_leaf 1798)), + Iarg_facet ((1,true),0.5000,953, + Iarg_facet ((2,true),0.5000,776, + Iarg_facet ((3,true),0.5000,901, + Iarg_leaf 1255)))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1975, + Iarg_facet ((2,true),0.5000,1112, + Iarg_leaf 1862)), + Iarg_facet ((1,true),0.5000,1488, + Iarg_facet ((2,true),0.5000,1073, + Iarg_leaf 1904))))), + Iarg_facet ((4,false),0.5000,1831, + Iarg_facet ((5,false),0.5000,1025, + Iarg_bisect (0, + Iarg_facet ((1,false),0.6271,1095, + Iarg_leaf 1434), + Iarg_facet ((1,true),0.5000,1633, + Iarg_facet ((2,false),0.5000,714, + Iarg_leaf 1320))))))))));; + +add_case ("7863247282", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1521, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1051, + Iarg_leaf 1230), + Iarg_facet ((0,true),0.5000,1004, + Iarg_leaf 1121))), + Iarg_facet ((5,true),0.6513,812, + Iarg_leaf 1177)), + Iarg_facet ((4,true),0.5000,1128, + Iarg_facet ((5,true),0.6441,994, + Iarg_leaf 1620))), + Iarg_facet ((2,true),0.5000,1832, + Iarg_facet ((4,true),0.5000,870, + Iarg_facet ((5,true),0.5000,859, + Iarg_facet ((3,false),0.5000,1080, + Iarg_leaf 1105))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1876, + Iarg_facet ((5,true),0.5000,1270, + Iarg_facet ((3,false),0.5000,1419, + Iarg_leaf 1894))), + Iarg_facet ((4,true),0.5000,1001, + Iarg_leaf 1619)), + Iarg_facet ((2,true),0.5000,1279, + Iarg_facet ((4,true),0.5000,856, + Iarg_leaf 1826)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,910, + Iarg_leaf 1458), + Iarg_facet ((2,true),0.5000,979, + Iarg_leaf 1291)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,971, + Iarg_leaf 1964), + Iarg_facet ((2,true),0.5000,775, + Iarg_leaf 1498)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1836, + Iarg_facet ((2,true),0.5000,1266, + Iarg_leaf 1466)), + Iarg_facet ((1,true),0.5000,1734, + Iarg_facet ((2,true),0.5000,1461, + Iarg_leaf 1942))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1074, + Iarg_leaf 1078), + Iarg_facet ((1,true),0.5000,1024, + Iarg_leaf 1242)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1817, + Iarg_facet ((4,true),0.5000,1248, + Iarg_leaf 1775)), + Iarg_facet ((1,true),0.5000,1138, + Iarg_facet ((4,true),0.5000,985, + Iarg_leaf 1220))), + Iarg_facet ((0,true),0.5000,1946, + Iarg_facet ((1,false),0.5000,1202, + Iarg_leaf 1245))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((5,true),0.5000,840, + Iarg_facet ((2,false),0.5000,1126, + Iarg_leaf 1438)), + Iarg_facet ((5,true),0.5000,708, + Iarg_leaf 1413)), + Iarg_facet ((1,true),0.5000,1356, + Iarg_facet ((5,true),0.5000,781, + Iarg_leaf 1632))), + Iarg_facet ((0,true),0.5000,1890, + Iarg_facet ((1,true),0.5000,991, + Iarg_leaf 1060))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((2,true),0.5000,1814, + Iarg_facet ((4,true),0.5000,881, + Iarg_facet ((5,true),0.5000,887, + Iarg_leaf 1295))), + Iarg_facet ((2,true),0.5000,1134, + Iarg_facet ((4,true),0.5000,759, + Iarg_leaf 1449))), + Iarg_bisect (0, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,843, + Iarg_facet ((1,false),0.5000,1139, + Iarg_leaf 1441)), + Iarg_facet ((4,true),0.5000,707, + Iarg_leaf 1478)), + Iarg_facet ((2,true),0.5000,1352, + Iarg_facet ((4,true),0.5000,781, + Iarg_leaf 1689)))), + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1940, + Iarg_facet ((2,false),0.5000,1194, + Iarg_leaf 1247)), + Iarg_facet ((0,true),0.5000,1822, + Iarg_facet ((2,true),0.5000,991, + Iarg_leaf 1061)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1242, + Iarg_facet ((4,true),0.5000,1115, + Iarg_leaf 1201)), + Iarg_facet ((0,true),0.5000,1477, + Iarg_facet ((4,true),0.5000,1037, + Iarg_leaf 1359))), + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1490, + Iarg_facet ((5,true),0.5000,1037, + Iarg_leaf 1356)), + Iarg_facet ((0,true),0.5000,1186, + Iarg_leaf 1612))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((3,false),0.5000,1109, + Iarg_facet ((0,false),0.5000,1105, + Iarg_leaf 1295)), + Iarg_facet ((3,false),0.5000,1238, + Iarg_facet ((1,true),0.5000,875, + Iarg_facet ((2,true),0.6366,960, + Iarg_facet ((4,true),0.6689,882, + Iarg_leaf 1453))))), + Iarg_facet ((0,false),0.5000,1183, + Iarg_leaf 1551)), + Iarg_facet ((5,true),0.5000,1424, + Iarg_facet ((0,false),0.5000,1191, + Iarg_leaf 1570))), + Iarg_facet ((4,true),0.5000,1731, + Iarg_facet ((5,true),0.5000,863, + Iarg_leaf 1665))), + Iarg_facet ((2,true),0.5000,1942, + Iarg_facet ((4,true),0.5000,1536, + Iarg_facet ((5,true),0.5000,1077, + Iarg_leaf 1691)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1844, + Iarg_facet ((0,false),0.5000,1487, + Iarg_leaf 1612)), + Iarg_facet ((4,true),0.5000,1019, + Iarg_leaf 1294)), + Iarg_facet ((2,true),0.5000,1611, + Iarg_facet ((4,true),0.5000,1322, + Iarg_facet ((0,true),0.5000,969, + Iarg_leaf 1150))))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((5,true),0.5000,1847, + Iarg_facet ((0,false),0.5000,1465, + Iarg_leaf 1566)), + Iarg_facet ((5,true),0.5000,1310, + Iarg_facet ((0,true),0.5000,929, + Iarg_leaf 1111))), + Iarg_facet ((2,true),0.5000,1612, + Iarg_facet ((5,true),0.5000,1019, + Iarg_leaf 1292))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1652, + Iarg_facet ((0,false),0.5000,1104, + Iarg_leaf 1452)), + Iarg_facet ((2,true),0.5000,1161, + Iarg_leaf 1652)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1865, + Iarg_facet ((4,true),0.5000,1612, + Iarg_leaf 1707)), + Iarg_facet ((1,true),0.5000,1581, + Iarg_facet ((4,true),0.5000,1103, + Iarg_leaf 1117))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((5,true),0.5000,1709, + Iarg_facet ((0,true),0.5000,1180, + Iarg_leaf 1473)), + Iarg_facet ((5,true),0.5000,971, + Iarg_leaf 1135)), + Iarg_facet ((1,true),0.5000,1692, + Iarg_facet ((0,false),0.5000,1160, + Iarg_leaf 1323))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((2,true),0.5000,1864, + Iarg_facet ((4,true),0.5000,1386, + Iarg_leaf 1956)), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1717, + Iarg_facet ((0,true),0.5000,1227, + Iarg_leaf 1534)), + Iarg_facet ((4,true),0.5000,961, + Iarg_leaf 1137))), + Iarg_bisect (5, + Iarg_facet ((2,true),0.5000,1604, + Iarg_facet ((5,true),0.5000,1100, + Iarg_leaf 1118)), + Iarg_facet ((2,true),0.5000,1685, + Iarg_facet ((0,false),0.5000,1151, + Iarg_leaf 1328)))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1959, + Iarg_facet ((4,true),0.5000,998, + Iarg_leaf 1085)), + Iarg_bisect (5, + Iarg_facet ((5,true),0.5000,999, + Iarg_leaf 1088), + Iarg_facet ((0,true),0.5000,1019, + Iarg_leaf 1091)))))));; + +add_case ("8673686234 b", + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((0,false),0.7345,839, + Iarg_bisect (2, + Iarg_facet ((4,false),0.8245,1258, + Iarg_leaf 1844), + Iarg_bisect (4, + Iarg_facet ((5,false),0.8088,969, + Iarg_leaf 1468), + Iarg_bisect (5, + Iarg_facet ((1,false),0.7186,921, + Iarg_facet ((2,false),0.5000,817, + Iarg_leaf 1592)), + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1120, + Iarg_facet ((4,false),0.5000,928, + Iarg_leaf 1578)), + Iarg_facet ((2,true),0.5000,1752, + Iarg_facet ((4,false),0.5000,1405, + Iarg_leaf 1459))))))), + Iarg_facet ((0,false),0.7912,743, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,781, + Iarg_facet ((1,false),0.5000,1134, + Iarg_facet ((2,false),0.5000,1209, + Iarg_leaf 1288))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,false),0.6580,957, + Iarg_leaf 1510), + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,951, + Iarg_facet ((5,true),0.5000,1413, + Iarg_leaf 1479)), + Iarg_facet ((4,false),0.5000,1587, + Iarg_leaf 1698))), + Iarg_facet ((1,true),0.5000,1344, + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,947, + Iarg_leaf 1738), + Iarg_facet ((4,true),0.5000,789, + Iarg_leaf 1327))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,false),0.5000,1136, + Iarg_facet ((2,true),0.5000,1197, + Iarg_leaf 1302)), + Iarg_facet ((1,true),0.5000,707, + Iarg_facet ((2,true),0.5000,1303, + Iarg_leaf 1636))), + Iarg_facet ((5,true),0.5000,734, + Iarg_facet ((1,true),0.5000,1350, + Iarg_facet ((2,true),0.5000,1898, + Iarg_facet ((4,false),0.5000,1088, + Iarg_leaf 1827)))))))), + Iarg_bisect (1, + Iarg_facet ((0,false),0.8419,1256, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1387, + Iarg_facet ((1,false),0.5000,1507, + Iarg_facet ((2,true),0.5000,1002, + Iarg_leaf 1053))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,false),0.6838,910, + Iarg_leaf 1187), + Iarg_facet ((2,true),0.5000,1302, + Iarg_leaf 1729)), + Iarg_facet ((1,true),0.6261,729, + Iarg_leaf 1884))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,703, + Iarg_facet ((4,false),0.5000,746, + Iarg_leaf 1536)), + Iarg_facet ((2,true),0.5000,1389, + Iarg_leaf 1789)), + Iarg_facet ((1,true),0.6230,1054, + Iarg_facet ((2,true),0.5000,1626, + Iarg_leaf 1796))), + Iarg_facet ((5,true),0.7110,1177, + Iarg_facet ((1,true),0.6891,1202, + Iarg_leaf 1958))))), + Iarg_facet ((0,false),0.9397,858, + Iarg_facet ((2,true),0.6684,1161, + Iarg_facet ((4,true),0.6496,1092, + Iarg_leaf 1444))))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((0,false),0.8220,1103, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,false),0.7144,874, + Iarg_facet ((2,false),0.5000,946, + Iarg_facet ((4,false),0.5989,989, + Iarg_leaf 1460))), + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,750, + Iarg_facet ((4,false),0.6136,1005, + Iarg_leaf 1077)), + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1527, + Iarg_leaf 1795), + Iarg_facet ((4,true),0.6481,923, + Iarg_leaf 1123)))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1006, + Iarg_facet ((4,false),0.5000,812, + Iarg_leaf 1733)), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1220, + Iarg_leaf 1973), + Iarg_facet ((5,true),0.5000,1054, + Iarg_facet ((1,false),0.5000,967, + Iarg_facet ((0,false),0.8912,785, + Iarg_leaf 1335)))), + Iarg_facet ((4,true),0.5000,1106, + Iarg_facet ((5,true),0.5000,805, + Iarg_leaf 1980)))), + Iarg_facet ((1,true),0.5000,792, + Iarg_facet ((2,true),0.5000,1304, + Iarg_facet ((4,true),0.5000,1195, + Iarg_leaf 1376))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,871, + Iarg_leaf 1956), + Iarg_facet ((2,true),0.5000,1891, + Iarg_facet ((4,false),0.5000,1702, + Iarg_leaf 1880))), + Iarg_facet ((1,true),0.6606,1212, + Iarg_facet ((2,true),0.5000,1025, + Iarg_leaf 1689))), + Iarg_facet ((5,true),0.7064,1259, + Iarg_facet ((1,true),0.5000,804, + Iarg_facet ((2,true),0.5000,1002, + Iarg_leaf 1705)))))), + Iarg_facet ((0,false),0.9113,889, + Iarg_facet ((2,true),0.5000,1283, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1273, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,false),0.6658,1016, + Iarg_leaf 1169), + Iarg_facet ((5,true),0.5000,1644, + Iarg_facet ((1,false),0.5000,833, + Iarg_facet ((2,true),0.5000,1008, + Iarg_leaf 1325)))), + Iarg_facet ((4,true),0.5000,1787, + Iarg_facet ((5,true),0.5000,1006, + Iarg_leaf 1655))), + Iarg_facet ((2,true),0.6743,1269, + Iarg_facet ((4,true),0.5000,1141, + Iarg_facet ((5,true),0.6342,940, + Iarg_leaf 1814))))), + Iarg_facet ((5,true),0.8291,800, + Iarg_facet ((1,true),0.7520,996, + Iarg_facet ((2,true),0.7101,1011, + Iarg_leaf 1908))))))), + Iarg_facet ((1,true),0.8080,949, + Iarg_facet ((0,false),0.9732,1290, + Iarg_leaf 1837)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((0,false),0.8095,754, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1522, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,879, + Iarg_facet ((4,false),0.5000,755, + Iarg_leaf 1502)), + Iarg_facet ((2,true),0.5000,1322, + Iarg_facet ((4,false),0.5000,1000, + Iarg_leaf 1054)))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,716, + Iarg_leaf 1533), + Iarg_facet ((2,true),0.5000,1144, + Iarg_facet ((4,false),0.5000,1010, + Iarg_leaf 1067))), + Iarg_facet ((1,true),0.6766,1212, + Iarg_facet ((2,true),0.5000,1110, + Iarg_leaf 1793)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,false),0.5000,1713, + Iarg_facet ((2,true),0.5000,849, + Iarg_leaf 1355)), + Iarg_facet ((1,true),0.6827,1288, + Iarg_facet ((2,true),0.5000,1401, + Iarg_leaf 1892))), + Iarg_facet ((5,true),0.7160,1121, + Iarg_leaf 1764)))), + Iarg_facet ((0,false),0.9358,787, + Iarg_facet ((2,true),0.6458,888, + Iarg_facet ((4,true),0.6464,1150, + Iarg_leaf 1832)))), + Iarg_facet ((1,true),0.7791,799, + Iarg_facet ((0,false),0.9409,751, + Iarg_facet ((2,true),0.5769,929, + Iarg_facet ((4,true),0.6257,879, + Iarg_facet ((5,true),0.5765,947, + Iarg_facet ((5,false),0.5000,1476, + Iarg_leaf 1709))))))), + Iarg_facet ((5,true),0.8247,821, + Iarg_facet ((1,true),0.8380,1201, + Iarg_facet ((0,false),0.9670,785, + Iarg_leaf 1402))))), + Iarg_facet ((2,true),0.7135,774, + Iarg_facet ((4,true),0.5910,773, + Iarg_facet ((5,true),0.7470,1055, + Iarg_facet ((1,true),0.6248,754, + Iarg_facet ((0,false),0.9210,876, + Iarg_bisect (4, + Iarg_facet ((1,false),0.5000,1103, + Iarg_leaf 1306), + Iarg_facet ((1,true),0.5000,774, + Iarg_facet ((2,true),0.6321,1037, + Iarg_leaf 1632))))))))), + Iarg_facet ((1,true),0.9189,873, + Iarg_facet ((2,true),0.8372,1088, + Iarg_leaf 1478))), + Iarg_facet ((5,true),0.9041,1215, + Iarg_facet ((1,true),0.8362,984, + Iarg_facet ((2,true),0.7983,894, + Iarg_facet ((4,true),0.7775,1209, + Iarg_facet ((0,false),0.9411,864, + Iarg_bisect (1, + Iarg_facet ((4,false),0.5000,757, + Iarg_leaf 1264), + Iarg_facet ((4,true),0.5000,1049, + Iarg_facet ((2,true),0.5000,749, + Iarg_leaf 1429))))))))), + Iarg_facet ((4,true),0.9224,884, + Iarg_facet ((5,true),0.9072,933, + Iarg_leaf 1691))));; + +add_case ("7550003505 0 3 3", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1611, + Iarg_facet ((5,false),0.5000,1595, + Iarg_facet ((0,true),0.5000,1554, + Iarg_facet ((1,true),0.8349,911, + Iarg_leaf 997)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.6277,860, + Iarg_leaf 1103), + Iarg_bisect (5, + Iarg_facet ((0,true),0.7209,902, + Iarg_facet ((1,true),0.7431,1184, + Iarg_facet ((2,true),0.5000,1485, + Iarg_leaf 1870))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1198, + Iarg_leaf 1805), + Iarg_facet ((4,false),0.5000,1171, + Iarg_facet ((5,false),0.5000,939, + Iarg_leaf 1373))), + Iarg_facet ((3,false),0.5000,773, + Iarg_leaf 1396)), + Iarg_facet ((2,true),0.7221,1021, + Iarg_leaf 1145)), + Iarg_facet ((1,true),0.7420,1191, + Iarg_leaf 1634))))), + Iarg_facet ((5,true),0.9980,1356, + Iarg_leaf 1842)), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,736, + Iarg_facet ((0,true),0.5000,1337, + Iarg_leaf 1880)), + Iarg_bisect (5, + Iarg_facet ((0,true),0.7399,1091, + Iarg_facet ((1,true),0.7492,750, + Iarg_facet ((2,true),0.5000,892, + Iarg_leaf 1141))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1661, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1843, + Iarg_facet ((3,false),0.5000,1771, + Iarg_facet ((5,false),0.5000,982, + Iarg_leaf 1408))), + Iarg_facet ((4,true),0.5000,1240, + Iarg_leaf 1384))), + Iarg_facet ((1,true),0.6354,904, + Iarg_facet ((2,true),0.5000,1681, + Iarg_facet ((4,true),0.5000,932, + Iarg_leaf 1108)))))), + Iarg_facet ((3,false),0.6491,1188, + Iarg_facet ((5,false),0.6898,1023, + Iarg_leaf 1798))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1769, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1473, + Iarg_leaf 1687), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6335,722, + Iarg_leaf 1759), + Iarg_facet ((5,true),0.5000,807, + Iarg_leaf 1254)), + Iarg_facet ((4,false),0.5000,979, + Iarg_leaf 1204)), + Iarg_facet ((2,true),0.7197,739, + Iarg_leaf 1376)), + Iarg_facet ((1,true),0.5000,1852, + Iarg_facet ((2,true),0.5000,1782, + Iarg_facet ((4,false),0.5000,1921, + Iarg_facet ((5,false),0.5000,1399, + Iarg_leaf 1590))))))), + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,927, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6751,789, + Iarg_leaf 1664), + Iarg_facet ((1,true),0.5000,833, + Iarg_facet ((2,true),0.5000,1453, + Iarg_facet ((5,false),0.5000,1036, + Iarg_leaf 1183))))), + Iarg_facet ((3,false),0.5887,701, + Iarg_facet ((0,false),0.7663,1025, + Iarg_leaf 962)))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,706, + Iarg_leaf 1451), + Iarg_bisect (5, + Iarg_facet ((0,true),0.7492,972, + Iarg_facet ((1,true),0.7492,1276, + Iarg_facet ((2,true),0.5000,1016, + Iarg_facet ((3,true),0.5000,928, + Iarg_leaf 1403)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1494, + Iarg_facet ((5,false),0.5000,1247, + Iarg_leaf 1661)), + Iarg_facet ((4,false),0.5000,1174, + Iarg_facet ((5,false),0.5000,966, + Iarg_leaf 1174))), + Iarg_facet ((3,true),0.5000,1361, + Iarg_leaf 1397)), + Iarg_facet ((2,true),0.5000,1760, + Iarg_facet ((3,false),0.5000,1191, + Iarg_leaf 1224))), + Iarg_facet ((1,true),0.7443,1079, + Iarg_leaf 1243)))), + Iarg_facet ((4,false),0.7292,1276, + Iarg_facet ((5,false),0.6513,1256, + Iarg_facet ((0,true),0.7131,1034, + Iarg_leaf 1689)))), + Iarg_facet ((3,true),0.5000,1435, + Iarg_facet ((5,true),0.9981,1542, + Iarg_facet ((4,false),0.9983,1361, + Iarg_leaf 1199)))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.7075,872, + Iarg_facet ((1,true),0.6829,710, + Iarg_facet ((2,true),0.5000,1617, + Iarg_facet ((3,true),0.5000,1170, + Iarg_leaf 1790)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1483, + Iarg_facet ((5,false),0.5000,1380, + Iarg_leaf 1653)), + Iarg_facet ((4,true),0.5000,1410, + Iarg_facet ((5,false),0.5000,1051, + Iarg_leaf 1296))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1259, + Iarg_leaf 1270), + Iarg_facet ((4,false),0.5000,1353, + Iarg_leaf 1653))), + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1096, + Iarg_leaf 1392), + Iarg_facet ((3,false),0.5000,919, + Iarg_leaf 1099))), + Iarg_facet ((1,true),0.5887,732, + Iarg_facet ((2,true),0.5000,1730, + Iarg_facet ((3,false),0.5000,1680, + Iarg_leaf 1949))))), + Iarg_facet ((5,false),0.5000,975, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,994, + Iarg_facet ((2,false),0.7389,1039, + Iarg_leaf 1320)), + Iarg_facet ((1,true),0.7090,913, + Iarg_facet ((2,true),0.5000,1291, + Iarg_leaf 1385))))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1497, + Iarg_facet ((0,true),0.5000,1675, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,802, + Iarg_facet ((4,false),0.5000,1555, + Iarg_leaf 1898)), + Iarg_facet ((2,false),0.5000,1750, + Iarg_leaf 1833)))), + Iarg_facet ((5,false),0.6573,1292, + Iarg_facet ((0,true),0.5000,1066, + Iarg_leaf 1835)))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1547, + Iarg_facet ((5,true),0.9418,1201, + Iarg_leaf 594)), + Iarg_facet ((4,true),0.5000,1313, + Iarg_leaf 1651)), + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,954, + Iarg_leaf 1181), + Iarg_facet ((4,false),0.5000,1104, + Iarg_leaf 1802))), + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1786, + Iarg_facet ((4,true),0.5000,1037, + Iarg_leaf 1257)), + Iarg_facet ((3,false),0.5000,741, + Iarg_leaf 1306))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1328, + Iarg_facet ((5,false),0.5000,1042, + Iarg_leaf 1293)), + Iarg_facet ((4,false),0.5000,1200, + Iarg_facet ((5,false),0.5000,951, + Iarg_leaf 1183))), + Iarg_facet ((3,true),0.5000,1119, + Iarg_leaf 1174)), + Iarg_facet ((2,true),0.5000,1759, + Iarg_leaf 1887))), + Iarg_facet ((0,false),0.5000,954, + Iarg_facet ((1,true),0.5000,848, + Iarg_leaf 1217))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1542, + Iarg_facet ((2,false),0.7275,1132, + Iarg_leaf 1577)), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1589, + Iarg_leaf 1636), + Iarg_facet ((3,false),0.5000,1505, + Iarg_leaf 1833)), + Iarg_facet ((2,false),0.5000,1111, + Iarg_leaf 1184))), + Iarg_facet ((0,false),0.5000,1347, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1343, + Iarg_leaf 1520), + Iarg_facet ((2,true),0.5000,1056, + Iarg_leaf 1306))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1877, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,747, + Iarg_facet ((4,false),0.5000,1353, + Iarg_facet ((5,true),0.5000,901, + Iarg_leaf 1365))), + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1477, + Iarg_leaf 1514), + Iarg_facet ((4,false),0.5000,1247, + Iarg_facet ((5,false),0.5000,1015, + Iarg_leaf 1313)))), + Iarg_bisect (1, + Iarg_facet ((2,false),0.5879,1144, + Iarg_leaf 1047), + Iarg_facet ((2,false),0.5000,1531, + Iarg_leaf 1553)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1947, + Iarg_facet ((2,false),0.7744,1121, + Iarg_leaf 893)), + Iarg_bisect (1, + Iarg_facet ((2,false),0.6881,1062, + Iarg_leaf 1730), + Iarg_facet ((2,false),0.5000,1002, + Iarg_leaf 1529))), + Iarg_facet ((0,false),0.5000,1614, + Iarg_facet ((1,false),0.5000,1466, + Iarg_facet ((2,false),0.5000,1019, + Iarg_leaf 1551))))))))));; + +add_case ("7550003505 0 0 0", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1366, + Iarg_facet ((5,false),0.5000,1578, + Iarg_facet ((0,true),0.5000,1819, + Iarg_facet ((1,true),0.8224,1033, + Iarg_leaf 1326)))), + Iarg_facet ((4,false),0.5000,707, + Iarg_facet ((5,false),0.6224,1004, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1418, + Iarg_facet ((2,true),0.5000,1380, + Iarg_facet ((3,true),0.5000,1930, + Iarg_facet ((4,false),0.5000,772, + Iarg_leaf 1867)))), + Iarg_facet ((1,true),0.7145,991, + Iarg_leaf 1560))))), + Iarg_facet ((5,true),0.9982,1530, + Iarg_facet ((3,false),0.7077,706, + Iarg_leaf 1065))), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,1103, + Iarg_facet ((0,true),0.5000,1592, + Iarg_facet ((1,true),0.7492,849, + Iarg_facet ((2,true),0.7492,854, + Iarg_facet ((4,true),0.5000,763, + Iarg_leaf 1266))))), + Iarg_facet ((5,false),0.5359,705, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,1258, + Iarg_leaf 1533), + Iarg_facet ((5,false),0.7599,1101, + Iarg_leaf 1023)), + Iarg_facet ((3,true),0.5000,1791, + Iarg_leaf 1943)), + Iarg_facet ((4,false),0.5000,1319, + Iarg_leaf 1337)), + Iarg_facet ((2,true),0.7043,1040, + Iarg_leaf 1457)), + Iarg_facet ((1,true),0.5986,1162, + Iarg_facet ((2,true),0.5000,1819, + Iarg_facet ((4,true),0.5000,1271, + Iarg_leaf 1361)))))), + Iarg_facet ((3,false),0.5000,957, + Iarg_facet ((5,false),0.7346,1109, + Iarg_facet ((0,false),0.5000,1680, + Iarg_facet ((1,true),0.6520,768, + Iarg_leaf 1841))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.7492,1129, + Iarg_facet ((2,true),0.7579,1276, + Iarg_facet ((4,true),0.5000,924, + Iarg_leaf 1231))), + Iarg_facet ((1,true),0.9151,1073, + Iarg_leaf 556)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1118, + Iarg_facet ((3,false),0.5000,1978, + Iarg_facet ((0,true),0.5000,980, + Iarg_leaf 1310))), + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,1389, + Iarg_leaf 1613), + Iarg_facet ((3,false),0.5000,1107, + Iarg_leaf 1188))), + Iarg_facet ((4,false),0.5000,1549, + Iarg_facet ((5,true),0.5000,1119, + Iarg_leaf 1332))), + Iarg_facet ((2,true),0.7047,1182, + Iarg_facet ((4,false),0.5000,1130, + Iarg_leaf 1167))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.7492,1177, + Iarg_leaf 858), + Iarg_facet ((5,false),0.5000,1820, + Iarg_facet ((3,false),0.5000,928, + Iarg_leaf 1405))), + Iarg_facet ((4,false),0.5000,889, + Iarg_leaf 1350)), + Iarg_facet ((2,true),0.7113,1211, + Iarg_leaf 1365)))), + Iarg_facet ((3,false),0.6745,810, + Iarg_leaf 1820)), + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,1773, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6277,1274, + Iarg_facet ((2,false),0.5000,926, + Iarg_facet ((5,false),0.5000,1260, + Iarg_leaf 1374))), + Iarg_facet ((1,true),0.5000,1607, + Iarg_bisect (2, + Iarg_facet ((5,false),0.5000,1980, + Iarg_facet ((3,false),0.5000,1088, + Iarg_leaf 1480)), + Iarg_facet ((5,false),0.5000,1227, + Iarg_leaf 1366))))), + Iarg_facet ((3,false),0.5000,932, + Iarg_facet ((0,false),0.5000,877, + Iarg_facet ((1,true),0.5000,1786, + Iarg_facet ((2,true),0.5000,1857, + Iarg_facet ((3,false),0.5000,1281, + Iarg_leaf 1716))))))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.9985,1154, + Iarg_leaf 1497), + Iarg_facet ((3,true),0.8747,1370, + Iarg_leaf 1125)), + Iarg_bisect (5, + Iarg_facet ((4,true),0.5000,1653, + Iarg_facet ((3,true),0.9987,1689, + Iarg_facet ((5,false),0.9981,1526, + Iarg_leaf 1362))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.7475,816, + Iarg_leaf 1211), + Iarg_facet ((5,true),0.5000,1157, + Iarg_leaf 1630)), + Iarg_facet ((4,false),0.5000,962, + Iarg_leaf 1272)), + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1429, + Iarg_facet ((5,true),0.5000,968, + Iarg_leaf 1238)), + Iarg_facet ((4,false),0.5000,915, + Iarg_leaf 1841))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1575, + Iarg_leaf 1873), + Iarg_facet ((4,false),0.5000,1039, + Iarg_leaf 1782)), + Iarg_facet ((3,false),0.5000,1085, + Iarg_leaf 1183))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1642, + Iarg_facet ((5,false),0.5000,1292, + Iarg_leaf 1786)), + Iarg_facet ((4,false),0.5000,835, + Iarg_leaf 1990)), + Iarg_facet ((3,true),0.5000,1158, + Iarg_leaf 1548)), + Iarg_facet ((2,true),0.5000,1857, + Iarg_facet ((3,true),0.5000,1076, + Iarg_leaf 1273)))), + Iarg_facet ((0,false),0.5000,1947, + Iarg_facet ((1,true),0.5000,1108, + Iarg_leaf 1859))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,965, + Iarg_bisect (3, + Iarg_facet ((5,true),0.5000,1198, + Iarg_leaf 1387), + Iarg_facet ((5,false),0.7480,1239, + Iarg_leaf 874))), + Iarg_facet ((2,false),0.5561,978, + Iarg_leaf 1390)), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,1470, + Iarg_leaf 1944), + Iarg_facet ((5,false),0.7593,1279, + Iarg_leaf 923)), + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,1138, + Iarg_leaf 1353), + Iarg_facet ((5,false),0.7497,1094, + Iarg_leaf 1024))), + Iarg_facet ((2,false),0.5000,1953, + Iarg_facet ((3,false),0.5000,942, + Iarg_leaf 1062)))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,831, + Iarg_facet ((2,false),0.6545,1204, + Iarg_leaf 1320)), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1997, + Iarg_facet ((4,true),0.6810,862, + Iarg_leaf 977)), + Iarg_facet ((3,false),0.5000,1622, + Iarg_facet ((4,false),0.5000,967, + Iarg_leaf 1306))), + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1211, + Iarg_leaf 1658), + Iarg_facet ((3,false),0.5000,1055, + Iarg_leaf 1528)))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1561, + Iarg_leaf 1706), + Iarg_facet ((0,false),0.5000,1249, + Iarg_leaf 1323)), + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,945, + Iarg_leaf 1794), + Iarg_bisect (0, + Iarg_facet ((1,false),0.6594,1233, + Iarg_facet ((2,false),0.6860,1097, + Iarg_leaf 1323)), + Iarg_bisect (1, + Iarg_facet ((2,false),0.5831,1000, + Iarg_facet ((3,true),0.6951,924, + Iarg_leaf 1189)), + Iarg_bisect (2, + Iarg_facet ((3,true),0.6908,1081, + Iarg_leaf 1150), + Iarg_facet ((3,false),0.5000,1930, + Iarg_facet ((4,false),0.6307,795, + Iarg_leaf 981))))))))))));; + +add_case ("7550003505 1 2 2", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1768, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1686, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1919, + Iarg_facet ((2,true),0.5000,1329, + Iarg_facet ((3,false),0.5000,1706, + Iarg_leaf 1809))), + Iarg_facet ((1,true),0.5000,1048, + Iarg_leaf 1915))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1409, + Iarg_facet ((2,true),0.5000,1502, + Iarg_facet ((3,false),0.5000,919, + Iarg_leaf 1083))), + Iarg_facet ((1,true),0.5000,950, + Iarg_facet ((2,true),0.5000,934, + Iarg_leaf 1536))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1402, + Iarg_facet ((2,true),0.5000,936, + Iarg_leaf 1667)), + Iarg_facet ((1,true),0.5000,1395, + Iarg_facet ((2,true),0.5000,921, + Iarg_facet ((3,false),0.5000,1087, + Iarg_leaf 1179)))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1834, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1381, + Iarg_facet ((3,true),0.5000,1040, + Iarg_leaf 1389)), + Iarg_facet ((2,true),0.5000,882, + Iarg_leaf 1291)), + Iarg_facet ((1,true),0.5000,904, + Iarg_leaf 1571))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1944, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1029, + Iarg_leaf 1146), + Iarg_facet ((3,false),0.5000,1273, + Iarg_leaf 1303))), + Iarg_facet ((1,true),0.5000,1051, + Iarg_facet ((2,true),0.5000,988, + Iarg_leaf 1464))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1713, + Iarg_leaf 1985), + Iarg_facet ((2,true),0.5000,1112, + Iarg_leaf 1258)), + Iarg_facet ((1,true),0.5000,1706, + Iarg_facet ((2,true),0.5000,1109, + Iarg_leaf 1933))))))), + Iarg_bisect (5, + Iarg_facet ((4,true),0.6297,903, + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,1797, + Iarg_facet ((0,false),0.7744,1244, + Iarg_leaf 1066)), + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,898, + Iarg_leaf 1641), + Iarg_facet ((0,false),0.5000,1019, + Iarg_facet ((1,true),0.5000,797, + Iarg_facet ((2,false),0.5000,833, + Iarg_leaf 1393)))))), + Iarg_facet ((4,true),0.7712,982, + Iarg_leaf 1542))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1981, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1340, + Iarg_facet ((3,false),0.5000,1513, + Iarg_facet ((4,false),0.5000,1133, + Iarg_leaf 1146))), + Iarg_facet ((2,true),0.5000,859, + Iarg_leaf 1371)), + Iarg_facet ((1,true),0.6283,898, + Iarg_facet ((2,true),0.7266,1120, + Iarg_facet ((3,false),0.6489,901, + Iarg_leaf 1429))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1822, + Iarg_facet ((3,false),0.5000,1195, + Iarg_leaf 1523)), + Iarg_facet ((2,true),0.5000,1020, + Iarg_leaf 1055)), + Iarg_facet ((1,true),0.5000,1060, + Iarg_facet ((2,true),0.5000,870, + Iarg_facet ((3,false),0.5000,1476, + Iarg_facet ((4,false),0.5000,1409, + Iarg_leaf 1418))))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1506, + Iarg_leaf 1907), + Iarg_facet ((2,false),0.5000,1231, + Iarg_leaf 1614)), + Iarg_facet ((1,true),0.5000,1682, + Iarg_facet ((2,true),0.5000,1026, + Iarg_facet ((3,false),0.5000,880, + Iarg_leaf 1236)))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1925, + Iarg_facet ((5,true),0.8093,927, + Iarg_leaf 738)), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,774, + Iarg_facet ((0,false),0.5000,1874, + Iarg_facet ((1,true),0.5000,786, + Iarg_facet ((2,true),0.6274,959, + Iarg_facet ((3,false),0.5000,1043, + Iarg_facet ((4,true),0.5000,845, + Iarg_leaf 1435)))))), + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1225, + Iarg_facet ((1,true),0.6479,854, + Iarg_leaf 1306)), + Iarg_facet ((0,false),0.5000,976, + Iarg_leaf 1446)))), + Iarg_facet ((3,false),0.5000,932, + Iarg_leaf 1902)), + Iarg_facet ((2,true),0.6260,896, + Iarg_facet ((3,false),0.5000,875, + Iarg_leaf 1754))), + Iarg_facet ((1,true),0.5000,1316, + Iarg_facet ((2,true),0.5000,1144, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1714, + Iarg_facet ((5,false),0.5000,1751, + Iarg_leaf 1795)), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1492, + Iarg_facet ((1,true),0.5000,727, + Iarg_facet ((2,true),0.5704,931, + Iarg_bisect (0, + Iarg_facet ((3,false),0.5000,1617, + Iarg_facet ((4,false),0.5000,1958, + Iarg_facet ((5,true),0.5000,1287, + Iarg_leaf 1618))), + Iarg_facet ((3,false),0.5000,855, + Iarg_facet ((4,false),0.5000,1511, + Iarg_facet ((5,true),0.5000,1493, + Iarg_leaf 1797))))))), + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,970, + Iarg_facet ((2,true),0.5000,800, + Iarg_bisect (0, + Iarg_facet ((3,false),0.5000,1540, + Iarg_facet ((4,true),0.5000,1558, + Iarg_facet ((5,true),0.5000,1194, + Iarg_leaf 1553))), + Iarg_facet ((3,false),0.5000,1319, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1524, + Iarg_leaf 1892), + Iarg_facet ((5,true),0.5000,1366, + Iarg_leaf 1528)))))), + Iarg_facet ((1,true),0.5000,1176, + Iarg_facet ((2,true),0.5000,1032, + Iarg_facet ((0,false),0.5000,1744, + Iarg_facet ((3,false),0.5000,1422, + Iarg_facet ((4,false),0.5000,1699, + Iarg_facet ((5,true),0.5000,968, + Iarg_leaf 1300)))))))))))), + Iarg_facet ((0,false),0.5000,1301, + Iarg_leaf 1645)), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1875, + Iarg_facet ((4,true),0.5000,785, + Iarg_facet ((5,true),0.5000,1189, + Iarg_leaf 1293))), + Iarg_facet ((3,false),0.5000,826, + Iarg_leaf 1311)), + Iarg_facet ((2,true),0.5000,945, + Iarg_facet ((3,false),0.5000,855, + Iarg_leaf 1450))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1869, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1286, + Iarg_leaf 1480), + Iarg_facet ((5,true),0.5000,884, + Iarg_leaf 1162)), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,855, + Iarg_facet ((2,true),0.5000,909, + Iarg_facet ((0,false),0.5000,1424, + Iarg_facet ((3,false),0.5000,1383, + Iarg_facet ((4,true),0.5000,1579, + Iarg_facet ((5,true),0.5000,1013, + Iarg_leaf 1274)))))), + Iarg_facet ((1,true),0.5000,876, + Iarg_facet ((2,true),0.5000,802, + Iarg_facet ((0,false),0.5000,817, + Iarg_facet ((3,false),0.5000,880, + Iarg_facet ((4,true),0.5000,710, + Iarg_leaf 1485)))))), + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,895, + Iarg_facet ((2,true),0.6201,847, + Iarg_leaf 1812)), + Iarg_facet ((1,true),0.6592,859, + Iarg_leaf 1089))))), + Iarg_facet ((2,true),0.6946,800, + Iarg_leaf 1611))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1369, + Iarg_facet ((3,false),0.5000,1034, + Iarg_leaf 1573)), + Iarg_facet ((2,true),0.5000,1034, + Iarg_leaf 1251)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1610, + Iarg_facet ((3,false),0.5000,1880, + Iarg_bisect (4, + Iarg_facet ((5,true),0.7514,1279, + Iarg_leaf 1660), + Iarg_facet ((5,true),0.5000,1266, + Iarg_leaf 1562)))), + Iarg_facet ((2,true),0.6684,973, + Iarg_leaf 1404)))))), + Iarg_facet ((3,true),0.5000,1051, + Iarg_leaf 1274)), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((4,true),0.6807,1084, + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,848, + Iarg_leaf 1941), + Iarg_facet ((0,false),0.5000,1238, + Iarg_facet ((1,true),0.5000,797, + Iarg_leaf 1591)))), + Iarg_facet ((4,true),0.6798,1275, + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1131, + Iarg_facet ((1,true),0.5000,742, + Iarg_facet ((2,true),0.5000,1452, + Iarg_leaf 1938))), + Iarg_facet ((0,false),0.5000,909, + Iarg_facet ((1,true),0.5000,1007, + Iarg_leaf 1829))))), + Iarg_facet ((3,true),0.5000,1383, + Iarg_facet ((4,true),0.8123,1210, + Iarg_leaf 1028))))));; + +add_case ("8248508703", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1625, + Iarg_facet ((5,true),0.5000,1237, + Iarg_facet ((3,true),0.5000,1513, + Iarg_facet ((0,true),0.5000,1184, + Iarg_facet ((1,true),0.5000,1361, + Iarg_leaf 1441))))), + Iarg_facet ((4,true),0.5000,1787, + Iarg_facet ((5,true),0.5000,836, + Iarg_facet ((3,true),0.5000,1357, + Iarg_facet ((0,true),0.5000,768, + Iarg_leaf 1935))))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1079, + Iarg_facet ((5,true),0.5000,1246, + Iarg_facet ((3,true),0.5000,1235, + Iarg_facet ((0,true),0.5000,800, + Iarg_leaf 1923)))), + Iarg_facet ((4,true),0.5000,1063, + Iarg_facet ((5,true),0.5000,858, + Iarg_facet ((3,true),0.5000,1181, + Iarg_leaf 1650))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1097, + Iarg_facet ((5,true),0.5000,815, + Iarg_leaf 1707)), + Iarg_facet ((4,true),0.5000,888, + Iarg_leaf 1580)), + Iarg_facet ((2,true),0.5000,1381, + Iarg_facet ((4,true),0.5000,768, + Iarg_leaf 1735)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,715, + Iarg_facet ((5,true),0.7570,1189, + Iarg_facet ((3,false),0.5000,973, + Iarg_leaf 1351))), + Iarg_facet ((4,true),0.6068,782, + Iarg_facet ((5,true),0.7881,927, + Iarg_leaf 1450))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.6575,984, + Iarg_facet ((5,true),0.6917,737, + Iarg_leaf 1733)), + Iarg_facet ((4,true),0.6535,881, + Iarg_facet ((5,true),0.8612,1058, + Iarg_leaf 985)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1883, + Iarg_facet ((4,true),0.6332,1048, + Iarg_leaf 1763)), + Iarg_facet ((2,true),0.5000,1090, + Iarg_leaf 1931)))), + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,814, + Iarg_leaf 1308), + Iarg_facet ((2,true),0.5000,1064, + Iarg_leaf 1689)), + Iarg_facet ((1,false),0.5000,1909, + Iarg_facet ((2,true),0.5000,708, + Iarg_leaf 1500))), + Iarg_facet ((0,true),0.5000,1821, + Iarg_facet ((1,false),0.5000,937, + Iarg_leaf 1037)))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1691, + Iarg_facet ((2,false),0.5000,1273, + Iarg_leaf 1710)), + Iarg_facet ((1,true),0.5000,1306, + Iarg_facet ((2,false),0.5000,1273, + Iarg_leaf 1442))), + Iarg_facet ((0,true),0.5000,1840, + Iarg_leaf 1994)), + Iarg_facet ((3,true),0.5000,1622, + Iarg_facet ((0,true),0.5000,1432, + Iarg_leaf 1520)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((4,true),0.5000,1985, + Iarg_facet ((5,true),0.5941,899, + Iarg_facet ((2,true),0.5000,862, + Iarg_facet ((3,true),0.5000,840, + Iarg_leaf 1190)))), + Iarg_facet ((4,true),0.5000,1202, + Iarg_facet ((5,true),0.6549,937, + Iarg_leaf 1470))), + Iarg_facet ((1,true),0.5000,1258, + Iarg_facet ((4,true),0.5000,989, + Iarg_leaf 1227))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((4,true),0.5000,1069, + Iarg_facet ((5,true),0.7833,1241, + Iarg_leaf 1879)), + Iarg_facet ((4,true),0.5000,846, + Iarg_facet ((5,true),0.6658,869, + Iarg_facet ((2,true),0.5000,841, + Iarg_leaf 1257)))), + Iarg_facet ((1,true),0.5000,1120, + Iarg_leaf 1682))), + Iarg_facet ((3,true),0.5000,1913, + Iarg_facet ((0,true),0.5000,1170, + Iarg_leaf 1787))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((5,true),0.6302,999, + Iarg_facet ((2,false),0.5000,1280, + Iarg_leaf 1688)), + Iarg_facet ((5,true),0.6594,823, + Iarg_leaf 1305)), + Iarg_facet ((1,true),0.5000,1179, + Iarg_facet ((5,true),0.6508,901, + Iarg_leaf 1887))), + Iarg_facet ((0,true),0.5000,1454, + Iarg_leaf 1794)), + Iarg_facet ((3,true),0.5000,888, + Iarg_facet ((0,true),0.5000,925, + Iarg_leaf 1327))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,954, + Iarg_facet ((5,true),0.5000,1596, + Iarg_facet ((1,true),0.5000,879, + Iarg_leaf 1936))), + Iarg_facet ((4,true),0.5000,847, + Iarg_facet ((5,true),0.5000,925, + Iarg_leaf 1851))), + Iarg_facet ((2,true),0.5000,1243, + Iarg_facet ((4,true),0.6385,924, + Iarg_leaf 1276))), + Iarg_bisect (0, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,720, + Iarg_facet ((5,true),0.5000,844, + Iarg_facet ((1,true),0.5000,1121, + Iarg_leaf 1623))), + Iarg_facet ((4,true),0.5000,714, + Iarg_facet ((5,true),0.6372,965, + Iarg_facet ((1,true),0.5000,890, + Iarg_leaf 1263)))), + Iarg_facet ((2,true),0.5000,1104, + Iarg_leaf 1672))), + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (2, + Iarg_facet ((4,true),0.6305,1003, + Iarg_facet ((1,false),0.5000,1317, + Iarg_leaf 1735)), + Iarg_facet ((4,true),0.6603,834, + Iarg_leaf 1351)), + Iarg_facet ((2,true),0.5000,1180, + Iarg_facet ((4,true),0.6513,901, + Iarg_leaf 1964))), + Iarg_facet ((0,true),0.5000,1434, + Iarg_leaf 1802))), + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,1922, + Iarg_facet ((0,true),0.5000,1181, + Iarg_leaf 1780)), + Iarg_facet ((3,true),0.5000,859, + Iarg_facet ((0,true),0.5000,884, + Iarg_leaf 1322)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1341, + Iarg_facet ((4,true),0.5000,1359, + Iarg_facet ((5,true),0.5000,857, + Iarg_leaf 1693))), + Iarg_facet ((0,true),0.5000,1462, + Iarg_facet ((4,true),0.5000,1152, + Iarg_facet ((5,true),0.5000,816, + Iarg_facet ((1,true),0.5000,1546, + Iarg_facet ((2,true),0.5000,945, + Iarg_leaf 1273)))))), + Iarg_facet ((3,true),0.5000,1801, + Iarg_facet ((0,true),0.5000,997, + Iarg_leaf 1893))), + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,1876, + Iarg_facet ((0,true),0.5000,1047, + Iarg_leaf 1899)), + Iarg_facet ((3,true),0.5000,758, + Iarg_leaf 1541))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1414, + Iarg_facet ((5,true),0.5000,861, + Iarg_leaf 1232)), + Iarg_facet ((4,true),0.5000,1118, + Iarg_leaf 1328)), + Iarg_facet ((2,true),0.5000,1529, + Iarg_facet ((4,true),0.5000,971, + Iarg_leaf 1479))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1882, + Iarg_facet ((4,true),0.5000,994, + Iarg_facet ((5,true),0.6224,1021, + Iarg_leaf 1385))), + Iarg_facet ((2,true),0.5000,1188, + Iarg_leaf 1893))), + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1407, + Iarg_facet ((4,true),0.5000,843, + Iarg_leaf 1690)), + Iarg_facet ((2,true),0.5000,1089, + Iarg_facet ((4,true),0.6160,911, + Iarg_leaf 1461))), + Iarg_facet ((1,true),0.5000,1610, + Iarg_leaf 1871))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((5,true),0.5000,842, + Iarg_leaf 1687), + Iarg_facet ((5,true),0.6163,907, + Iarg_leaf 1413)), + Iarg_facet ((2,true),0.5000,1097, + Iarg_leaf 1406)), + Iarg_facet ((1,true),0.5000,1447, + Iarg_facet ((2,true),0.5000,941, + Iarg_leaf 1093))), + Iarg_facet ((3,true),0.5000,1576, + Iarg_facet ((1,true),0.5000,1172, + Iarg_leaf 1778)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1668, + Iarg_facet ((4,true),0.5000,1448, + Iarg_leaf 1572)), + Iarg_facet ((1,true),0.5000,1427, + Iarg_facet ((4,true),0.5000,976, + Iarg_leaf 1294))), + Iarg_facet ((3,true),0.5000,1687, + Iarg_facet ((1,true),0.5000,827, + Iarg_leaf 1193))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1482, + Iarg_facet ((5,true),0.5000,1050, + Iarg_facet ((0,true),0.5000,1217, + Iarg_leaf 1549))), + Iarg_facet ((1,true),0.5000,1013, + Iarg_leaf 1681)), + Iarg_facet ((3,true),0.5000,799, + Iarg_leaf 1585)))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((2,true),0.5000,1655, + Iarg_facet ((4,true),0.5000,1143, + Iarg_leaf 1868)), + Iarg_facet ((2,true),0.5000,1414, + Iarg_facet ((4,true),0.5000,825, + Iarg_leaf 1422))), + Iarg_bisect (3, + Iarg_facet ((2,true),0.5000,1454, + Iarg_facet ((4,true),0.5000,1054, + Iarg_facet ((0,true),0.5000,1253, + Iarg_leaf 1644))), + Iarg_facet ((2,true),0.5000,913, + Iarg_leaf 1690))), + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,1689, + Iarg_leaf 1996), + Iarg_facet ((3,true),0.5000,794, + Iarg_leaf 1536))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,1647, + Iarg_leaf 1680), + Iarg_facet ((3,true),0.5000,982, + Iarg_leaf 1185)), + Iarg_facet ((5,true),0.5000,1248, + Iarg_facet ((3,true),0.5000,920, + Iarg_leaf 1148)))))));; + +add_case ("7550003505 0 0 4", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,1071, + Iarg_facet ((4,false),0.8865,1179, + Iarg_leaf 1352)), + Iarg_facet ((5,true),0.6222,786, + Iarg_facet ((3,false),0.5000,1075, + Iarg_facet ((4,false),0.9001,1143, + Iarg_leaf 1433)))), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,847, + Iarg_facet ((0,true),0.5752,896, + Iarg_facet ((1,true),0.8287,922, + Iarg_leaf 1497))), + Iarg_facet ((5,false),0.6211,820, + Iarg_facet ((0,true),0.5000,1865, + Iarg_facet ((1,true),0.5000,1671, + Iarg_facet ((2,true),0.5000,1374, + Iarg_bisect (4, + Iarg_facet ((3,true),0.5000,1898, + Iarg_facet ((5,false),0.5000,992, + Iarg_leaf 1189)), + Iarg_facet ((3,true),0.5000,1374, + Iarg_leaf 1503))))))), + Iarg_facet ((3,false),0.6229,1261, + Iarg_facet ((5,false),0.7492,723, + Iarg_facet ((0,false),0.5000,1068, + Iarg_leaf 1596)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1312, + Iarg_facet ((1,true),0.7492,1126, + Iarg_facet ((2,true),0.8323,1213, + Iarg_leaf 1343))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,1768, + Iarg_facet ((0,true),0.5000,816, + Iarg_leaf 1171)), + Iarg_facet ((3,false),0.5000,1166, + Iarg_leaf 1300)), + Iarg_facet ((5,true),0.5000,1881, + Iarg_facet ((3,false),0.5000,1103, + Iarg_leaf 1279))), + Iarg_facet ((4,false),0.6799,742, + Iarg_leaf 1269)), + Iarg_facet ((2,true),0.7215,1003, + Iarg_facet ((4,true),0.5000,865, + Iarg_leaf 1511))), + Iarg_facet ((1,true),0.5000,1117, + Iarg_facet ((2,true),0.7900,968, + Iarg_facet ((4,false),0.6615,1230, + Iarg_leaf 1382))))), + Iarg_facet ((3,false),0.5000,1042, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1034, + Iarg_facet ((2,true),0.7244,838, + Iarg_leaf 1816)), + Iarg_facet ((1,true),0.5000,1625, + Iarg_facet ((2,true),0.8655,938, + Iarg_leaf 1228))))), + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,1311, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6708,943, + Iarg_facet ((2,false),0.5790,1105, + Iarg_leaf 1403)), + Iarg_facet ((1,true),0.5000,894, + Iarg_facet ((2,true),0.5000,1816, + Iarg_facet ((5,false),0.5000,1473, + Iarg_facet ((3,false),0.5000,829, + Iarg_leaf 1143)))))), + Iarg_facet ((3,false),0.5000,732, + Iarg_facet ((0,false),0.5376,831, + Iarg_facet ((1,true),0.5000,1449, + Iarg_facet ((2,true),0.5000,1251, + Iarg_facet ((3,false),0.5000,934, + Iarg_leaf 1255))))))))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.6462,1100, + Iarg_leaf 1997), + Iarg_bisect (5, + Iarg_facet ((3,true),0.9980,1766, + Iarg_facet ((4,true),0.5000,746, + Iarg_leaf 1538)), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1262, + Iarg_leaf 1988), + Iarg_facet ((5,true),0.5000,970, + Iarg_leaf 1390)), + Iarg_facet ((4,true),0.5000,1066, + Iarg_leaf 1242)), + Iarg_facet ((3,true),0.5000,1683, + Iarg_facet ((4,false),0.7079,1006, + Iarg_leaf 1160))), + Iarg_facet ((2,true),0.5000,1480, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1457, + Iarg_facet ((5,false),0.5000,864, + Iarg_leaf 1166)), + Iarg_facet ((4,true),0.5000,1381, + Iarg_leaf 1922)))), + Iarg_facet ((1,true),0.5000,1755, + Iarg_facet ((2,true),0.6887,827, + Iarg_facet ((3,true),0.5000,1208, + Iarg_facet ((4,false),0.6577,958, + Iarg_leaf 1612))))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1134, + Iarg_facet ((2,true),0.5000,1328, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1078, + Iarg_leaf 1285), + Iarg_facet ((4,true),0.5000,1324, + Iarg_leaf 1680)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.7167,1022, + Iarg_facet ((3,true),0.5000,1010, + Iarg_leaf 1373)), + Iarg_facet ((2,true),0.7760,1018, + Iarg_facet ((3,false),0.5000,956, + Iarg_leaf 1343))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1626, + Iarg_facet ((2,false),0.5000,728, + Iarg_facet ((3,true),0.5000,1725, + Iarg_facet ((5,true),0.5000,964, + Iarg_leaf 1058)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1822, + Iarg_facet ((5,false),0.5000,1122, + Iarg_leaf 1510)), + Iarg_facet ((3,false),0.5000,1901, + Iarg_facet ((5,false),0.7684,1100, + Iarg_leaf 821))), + Iarg_facet ((2,true),0.5000,1226, + Iarg_leaf 1274))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5674,1006, + Iarg_leaf 1293), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1679, + Iarg_leaf 1774), + Iarg_facet ((3,false),0.5000,1338, + Iarg_leaf 1880)), + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1242, + Iarg_leaf 1819), + Iarg_facet ((3,false),0.5000,834, + Iarg_leaf 1273)))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.6274,878, + Iarg_leaf 1525), + Iarg_bisect (0, + Iarg_facet ((1,false),0.6168,1215, + Iarg_facet ((2,true),0.5000,1381, + Iarg_facet ((4,true),0.5000,1308, + Iarg_leaf 1433))), + Iarg_facet ((1,false),0.6829,1285, + Iarg_leaf 1934))), + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,740, + Iarg_leaf 1423), + Iarg_bisect (0, + Iarg_facet ((1,false),0.6845,1173, + Iarg_leaf 1597), + Iarg_bisect (1, + Iarg_facet ((2,false),0.5518,803, + Iarg_facet ((3,true),0.6904,945, + Iarg_leaf 1058)), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5870,1273, + Iarg_facet ((4,true),0.7004,1290, + Iarg_leaf 1356)), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1095, + Iarg_leaf 1252), + Iarg_facet ((4,true),0.5000,1189, + Iarg_leaf 1305))))))))))));; + +add_case ("7550003505 0 2 3", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1022, + Iarg_facet ((0,true),0.8261,873, + Iarg_leaf 1235)), + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,866, + Iarg_facet ((1,true),0.8461,962, + Iarg_leaf 1210)), + Iarg_facet ((0,false),0.5000,1512, + Iarg_leaf 1838))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.7199,891, + Iarg_facet ((1,true),0.5000,941, + Iarg_facet ((2,true),0.7295,781, + Iarg_leaf 1744))), + Iarg_facet ((0,true),0.7492,1185, + Iarg_facet ((1,false),0.5000,1129, + Iarg_leaf 1758))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1952, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1115, + Iarg_leaf 1256), + Iarg_facet ((4,true),0.5000,1168, + Iarg_leaf 1314)), + Iarg_facet ((3,false),0.5000,999, + Iarg_leaf 1491))), + Iarg_facet ((1,true),0.6638,848, + Iarg_leaf 1745)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1649, + Iarg_facet ((3,true),0.5000,1857, + Iarg_facet ((4,true),0.5000,1000, + Iarg_leaf 1131))), + Iarg_facet ((2,true),0.7040,1228, + Iarg_leaf 1911)), + Iarg_facet ((1,true),0.5000,1191, + Iarg_facet ((2,true),0.7120,961, + Iarg_leaf 1951)))))), + Iarg_facet ((5,true),0.7652,742, + Iarg_facet ((3,false),0.6883,920, + Iarg_leaf 1972))), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1340, + Iarg_leaf 1646), + Iarg_facet ((0,false),0.5000,1090, + Iarg_leaf 1465)), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1575, + Iarg_facet ((3,false),0.5000,1307, + Iarg_leaf 1454)), + Iarg_facet ((4,true),0.5000,1047, + Iarg_leaf 1203)), + Iarg_facet ((2,true),0.7148,1122, + Iarg_facet ((4,true),0.5000,741, + Iarg_leaf 1344))), + Iarg_facet ((1,true),0.5000,1085, + Iarg_facet ((2,true),0.5000,1183, + Iarg_facet ((4,false),0.5000,1124, + Iarg_leaf 1447)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1854, + Iarg_facet ((4,true),0.5000,1170, + Iarg_facet ((3,false),0.5000,970, + Iarg_leaf 1024))), + Iarg_facet ((2,true),0.7125,1075, + Iarg_leaf 1397)), + Iarg_facet ((1,true),0.5000,1603, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1540, + Iarg_leaf 1812), + Iarg_facet ((4,false),0.5000,997, + Iarg_leaf 1075)))))), + Iarg_facet ((3,false),0.5000,1375, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.8430,1224, + Iarg_leaf 657), + Iarg_facet ((1,true),0.5000,886, + Iarg_facet ((2,true),0.5000,1007, + Iarg_leaf 1554))), + Iarg_facet ((0,false),0.5000,1595, + Iarg_facet ((1,true),0.5000,973, + Iarg_facet ((2,true),0.5000,1246, + Iarg_leaf 1551)))))), + Iarg_facet ((4,true),0.5000,1823, + Iarg_facet ((5,true),0.7626,888, + Iarg_facet ((3,false),0.6891,862, + Iarg_facet ((0,false),0.6781,980, + Iarg_leaf 1327)))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.7094,881, + Iarg_facet ((1,true),0.5000,1568, + Iarg_facet ((2,true),0.7889,755, + Iarg_leaf 1690))), + Iarg_facet ((0,true),0.7492,1091, + Iarg_facet ((1,false),0.5000,1264, + Iarg_leaf 1453))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1714, + Iarg_leaf 1796), + Iarg_facet ((4,false),0.5000,1766, + Iarg_leaf 1832)), + Iarg_facet ((3,true),0.5000,1194, + Iarg_leaf 1229)), + Iarg_facet ((2,true),0.5000,1168, + Iarg_facet ((3,false),0.5000,1090, + Iarg_leaf 1586))), + Iarg_facet ((1,true),0.5000,1184, + Iarg_facet ((2,true),0.7178,1059, + Iarg_facet ((3,true),0.5000,1573, + Iarg_facet ((4,false),0.5000,766, + Iarg_leaf 1261))))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1921, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1070, + Iarg_leaf 1157), + Iarg_facet ((4,false),0.5000,1015, + Iarg_leaf 1127))), + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1670, + Iarg_leaf 1673), + Iarg_facet ((3,false),0.5000,989, + Iarg_leaf 1043))), + Iarg_facet ((1,true),0.5000,1698, + Iarg_facet ((2,true),0.7174,858, + Iarg_facet ((3,true),0.5000,969, + Iarg_leaf 1076)))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1003, + Iarg_leaf 1674), + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1720, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5498,884, + Iarg_leaf 1102), + Iarg_facet ((2,true),0.5000,1606, + Iarg_facet ((3,true),0.5870,1242, + Iarg_facet ((4,true),0.5000,965, + Iarg_leaf 1145))))), + Iarg_facet ((0,true),0.5000,1714, + Iarg_facet ((1,false),0.5000,1473, + Iarg_facet ((2,true),0.5000,1734, + Iarg_facet ((3,true),0.6471,1039, + Iarg_leaf 1235))))))), + Iarg_bisect (3, + Iarg_facet ((5,true),0.7637,881, + Iarg_facet ((4,false),0.6517,1046, + Iarg_facet ((0,false),0.5000,1113, + Iarg_leaf 1376))), + Iarg_facet ((5,true),0.8335,1012, + Iarg_leaf 1675))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,974, + Iarg_leaf 1977), + Iarg_facet ((4,true),0.5000,1006, + Iarg_leaf 1719)), + Iarg_facet ((3,false),0.5000,1551, + Iarg_leaf 1760)), + Iarg_facet ((2,true),0.5000,1581, + Iarg_facet ((3,true),0.5000,1513, + Iarg_leaf 1648))), + Iarg_facet ((1,true),0.5000,1508, + Iarg_facet ((2,true),0.5000,1851, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1148, + Iarg_leaf 1335), + Iarg_facet ((4,true),0.5000,1568, + Iarg_leaf 1654))))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,841, + Iarg_leaf 1399), + Iarg_facet ((4,true),0.5000,844, + Iarg_leaf 1278)), + Iarg_facet ((3,true),0.5000,1592, + Iarg_leaf 1647)), + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1411, + Iarg_leaf 1618), + Iarg_facet ((3,false),0.5000,955, + Iarg_leaf 1172))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1218, + Iarg_leaf 1226), + Iarg_facet ((4,false),0.5000,1347, + Iarg_leaf 1566)), + Iarg_facet ((3,true),0.5000,1086, + Iarg_leaf 1249)), + Iarg_facet ((2,true),0.5000,1041, + Iarg_leaf 1896)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1509, + Iarg_facet ((2,false),0.7512,994, + Iarg_leaf 828)), + Iarg_facet ((1,true),0.5000,1523, + Iarg_facet ((2,true),0.5000,1519, + Iarg_facet ((3,false),0.5000,983, + Iarg_leaf 1211)))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1319, + Iarg_facet ((2,false),0.8699,972, + Iarg_leaf 257)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1730, + Iarg_facet ((3,false),0.5000,1007, + Iarg_leaf 1234)), + Iarg_facet ((2,true),0.5000,893, + Iarg_leaf 1213))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5668,1174, + Iarg_facet ((4,true),0.5000,1072, + Iarg_leaf 1085)), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,832, + Iarg_leaf 1393), + Iarg_facet ((4,false),0.5000,1002, + Iarg_leaf 1149))), + Iarg_bisect (1, + Iarg_facet ((2,false),0.5705,1056, + Iarg_leaf 1373), + Iarg_facet ((2,true),0.5000,1097, + Iarg_leaf 1506))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5672,1071, + Iarg_leaf 1681), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,830, + Iarg_leaf 1387), + Iarg_facet ((4,false),0.5000,1094, + Iarg_leaf 1123))), + Iarg_facet ((1,false),0.5000,1839, + Iarg_facet ((2,true),0.5000,1356, + Iarg_leaf 1765)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1353, + Iarg_leaf 1667), + Iarg_facet ((1,false),0.5000,1759, + Iarg_leaf 1909)), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1221, + Iarg_leaf 1647), + Iarg_facet ((1,false),0.5000,1672, + Iarg_facet ((2,false),0.5000,902, + Iarg_leaf 1216)))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6893,1223, + Iarg_facet ((0,false),0.5000,1887, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,820, + Iarg_leaf 1459), + Iarg_facet ((2,true),0.5000,1034, + Iarg_leaf 1101)))), + Iarg_facet ((5,true),0.7475,782, + Iarg_facet ((0,false),0.7715,924, + Iarg_leaf 1365))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.7461,1042, + Iarg_facet ((0,false),0.5000,1622, + Iarg_facet ((1,false),0.5606,949, + Iarg_leaf 1224))), + Iarg_facet ((5,true),0.7206,781, + Iarg_facet ((0,false),0.6198,1230, + Iarg_leaf 1278))))))));; + +add_case ("5691615370", + Iarg_bisect (1, + Iarg_facet ((2,true),0.6646,926, + Iarg_facet ((4,true),0.5758,1129, + Iarg_facet ((5,true),0.7676,740, + Iarg_facet ((1,false),0.5000,892, + Iarg_bisect (4, + Iarg_bisect (2, + Iarg_facet ((1,false),0.7071,990, + Iarg_leaf 1957), + Iarg_bisect (1, + Iarg_bisect (5, + Iarg_facet ((4,false),0.7967,937, + Iarg_leaf 1169), + Iarg_facet ((4,false),0.5000,1786, + Iarg_facet ((2,true),0.6308,1112, + Iarg_leaf 1692))), + Iarg_facet ((5,true),0.5000,1608, + Iarg_facet ((4,false),0.5000,1183, + Iarg_facet ((2,true),0.6644,1051, + Iarg_leaf 1582))))), + Iarg_bisect (2, + Iarg_bisect (1, + Iarg_facet ((5,true),0.5000,911, + Iarg_bisect (4, + Iarg_facet ((2,false),0.7466,1012, + Iarg_leaf 1723), + Iarg_facet ((2,false),0.5000,836, + Iarg_facet ((1,false),0.8175,1038, + Iarg_leaf 1205)))), + Iarg_facet ((5,true),0.6493,853, + Iarg_bisect (4, + Iarg_bisect (2, + Iarg_facet ((1,false),0.5000,1085, + Iarg_facet ((4,false),0.5000,841, + Iarg_facet ((2,false),0.5000,1487, + Iarg_facet ((5,true),0.5000,766, + Iarg_facet ((1,false),0.5000,1207, + Iarg_leaf 1854))))), + Iarg_bisect (1, + Iarg_facet ((4,false),0.5000,1061, + Iarg_facet ((2,true),0.5000,768, + Iarg_leaf 1796)), + Iarg_facet ((4,true),0.5000,863, + Iarg_leaf 1660))), + Iarg_facet ((2,true),0.5000,1580, + Iarg_bisect (1, + Iarg_bisect (4, + Iarg_facet ((2,false),0.5000,1637, + Iarg_facet ((5,true),0.5000,1264, + Iarg_facet ((1,false),0.5000,1246, + Iarg_facet ((4,false),0.5000,1141, + Iarg_facet ((2,true),0.6755,910, + Iarg_leaf 1167))))), + Iarg_bisect (2, + Iarg_facet ((5,true),0.6828,790, + Iarg_facet ((1,false),0.5000,1080, + Iarg_bisect (4, + Iarg_bisect (2, + Iarg_facet ((1,false),0.7495,960, + Iarg_facet ((4,false),0.7804,923, + Iarg_leaf 1214)), + Iarg_bisect (1, + Iarg_facet ((4,false),0.6585,907, + Iarg_leaf 1140), + Iarg_facet ((4,true),0.5000,1486, + Iarg_leaf 1567))), + Iarg_bisect (2, + Iarg_bisect (1, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6474,1186, + Iarg_leaf 845), + Iarg_facet ((5,true),0.7501,938, + Iarg_facet ((2,true),0.5000,1492, + Iarg_leaf 1624))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.6725,744, + Iarg_bisect (2, + Iarg_facet ((1,false),0.5000,999, + Iarg_facet ((4,false),0.5000,1279, + Iarg_bisect (2, + Iarg_facet ((5,true),0.6541,868, + Iarg_facet ((1,false),0.7655,767, + Iarg_leaf 1520)), + Iarg_facet ((5,true),0.6640,1047, + Iarg_leaf 1976)))), + Iarg_facet ((1,true),0.5000,1496, + Iarg_facet ((4,false),0.5000,769, + Iarg_leaf 1359)))), + Iarg_facet ((5,true),0.8210,774, + Iarg_facet ((2,true),0.5559,822, + Iarg_bisect (1, + Iarg_bisect (4, + Iarg_facet ((2,false),0.5000,1534, + Iarg_facet ((1,false),0.5000,887, + Iarg_leaf 1893)), + Iarg_facet ((2,true),0.5000,1576, + Iarg_bisect (1, + Iarg_facet ((4,false),0.5000,994, + Iarg_facet ((2,true),0.5000,1768, + Iarg_leaf 1950)), + Iarg_bisect (4, + Iarg_facet ((2,true),0.5000,1868, + Iarg_facet ((5,true),0.7556,855, + Iarg_leaf 1874)), + Iarg_facet ((2,true),0.6988,940, + Iarg_facet ((5,true),0.8915,942, + Iarg_facet ((1,true),0.5000,1080, + Iarg_leaf 1478))))))), + Iarg_bisect (4, + Iarg_facet ((2,true),0.5000,990, + Iarg_bisect (1, + Iarg_facet ((4,false),0.5000,1679, + Iarg_facet ((2,true),0.5000,1517, + Iarg_facet ((5,true),0.7861,1038, + Iarg_facet ((1,false),0.7010,896, + Iarg_leaf 1464)))), + Iarg_bisect (4, + Iarg_facet ((2,true),0.5000,1112, + Iarg_facet ((5,true),0.7961,996, + Iarg_facet ((1,false),0.5970,957, + Iarg_leaf 1713))), + Iarg_facet ((2,true),0.8609,934, + Iarg_leaf 1255)))), + Iarg_facet ((2,true),0.8987,1084, + Iarg_facet ((1,true),0.7737,724, + Iarg_leaf 1416)))))))), + Iarg_facet ((1,true),0.7444,1002, + Iarg_leaf 1120))))), + Iarg_facet ((5,true),0.7948,861, + Iarg_facet ((1,true),0.5000,792, + Iarg_leaf 1265)))), + Iarg_bisect (4, + Iarg_bisect (2, + Iarg_facet ((5,true),0.7035,934, + Iarg_bisect (1, + Iarg_facet ((4,false),0.5000,762, + Iarg_bisect (2, + Iarg_facet ((1,false),0.6845,1031, + Iarg_facet ((4,false),0.6925,832, + Iarg_leaf 1577)), + Iarg_facet ((1,true),0.5000,1919, + Iarg_facet ((4,false),0.6423,934, + Iarg_leaf 1080)))), + Iarg_bisect (4, + Iarg_bisect (2, + Iarg_facet ((1,false),0.6567,899, + Iarg_leaf 1739), + Iarg_facet ((1,true),0.5000,940, + Iarg_leaf 1461)), + Iarg_facet ((2,true),0.5599,868, + Iarg_bisect (1, + Iarg_facet ((4,false),0.5000,1918, + Iarg_facet ((5,true),0.7883,878, + Iarg_facet ((2,true),0.5000,1095, + Iarg_facet ((1,false),0.5000,1172, + Iarg_facet ((4,false),0.5000,1023, + Iarg_leaf 1731))))), + Iarg_facet ((4,true),0.5000,1328, + Iarg_facet ((5,true),0.8259,824, + Iarg_facet ((2,true),0.6619,1066, + Iarg_leaf 1628)))))))), + Iarg_facet ((5,true),0.8618,852, + Iarg_leaf 1436)), + Iarg_facet ((2,true),0.7494,1212, + Iarg_facet ((5,true),0.8697,875, + Iarg_bisect (1, + Iarg_bisect (4, + Iarg_bisect (1, + Iarg_facet ((4,false),0.5000,1998, + Iarg_bisect (2, + Iarg_facet ((1,false),0.5000,1789, + Iarg_facet ((4,false),0.5000,1749, + Iarg_facet ((5,true),0.7416,1269, + Iarg_facet ((2,true),0.5000,1376, + Iarg_facet ((1,false),0.6653,1132, + Iarg_facet ((4,false),0.6486,971, + Iarg_leaf 1195)))))), + Iarg_facet ((1,true),0.5000,859, + Iarg_facet ((4,true),0.5000,1030, + Iarg_leaf 1057)))), + Iarg_bisect (4, + Iarg_facet ((2,true),0.5000,1829, + Iarg_bisect (1, + Iarg_facet ((4,false),0.7040,738, + Iarg_leaf 1273), + Iarg_facet ((4,false),0.5000,1658, + Iarg_facet ((5,true),0.7952,915, + Iarg_facet ((2,true),0.6599,1128, + Iarg_leaf 1760))))), + Iarg_facet ((2,true),0.7225,913, + Iarg_facet ((1,true),0.5000,1980, + Iarg_bisect (4, + Iarg_facet ((5,true),0.7555,836, + Iarg_facet ((1,false),0.5000,833, + Iarg_facet ((4,false),0.5000,836, + Iarg_leaf 1726))), + Iarg_facet ((5,true),0.9092,994, + Iarg_facet ((1,true),0.6266,1090, + Iarg_leaf 1873))))))), + Iarg_facet ((1,true),0.5841,784, + Iarg_facet ((4,true),0.5000,1169, + Iarg_facet ((2,true),0.6392,979, + Iarg_bisect (4, + Iarg_bisect (1, + Iarg_facet ((5,true),0.6841,941, + Iarg_facet ((2,false),0.5000,1051, + Iarg_leaf 1976)), + Iarg_facet ((5,true),0.8220,874, + Iarg_facet ((2,true),0.5000,812, + Iarg_bisect (4, + Iarg_facet ((1,false),0.6090,809, + Iarg_leaf 1946), + Iarg_facet ((1,true),0.5000,1010, + Iarg_facet ((2,true),0.5000,886, + Iarg_leaf 1835)))))), + Iarg_facet ((1,true),0.5000,1045, + Iarg_facet ((5,true),0.8138,731, + Iarg_facet ((2,true),0.5000,919, + Iarg_bisect (4, + Iarg_facet ((1,false),0.5000,710, + Iarg_facet ((2,true),0.5000,980, + Iarg_leaf 1981)), + Iarg_facet ((1,true),0.5000,1059, + Iarg_facet ((2,true),0.5000,1068, + Iarg_facet ((4,false),0.5000,762, + Iarg_leaf 1628)))))))))))), + Iarg_facet ((4,true),0.8744,853, + Iarg_facet ((1,true),0.8091,781, + Iarg_facet ((2,true),0.8474,1142, + Iarg_leaf 1168)))))))))))), + Iarg_facet ((1,true),0.5000,702, + Iarg_facet ((5,true),0.6266,1291, + Iarg_facet ((4,true),0.6602,936, + Iarg_facet ((2,true),0.5950,968, + Iarg_leaf 1369)))))))))), + Iarg_facet ((2,true),0.8051,812, + Iarg_facet ((4,true),0.6589,917, + Iarg_facet ((5,true),0.9065,808, + Iarg_facet ((1,true),0.5698,767, + Iarg_bisect (4, + Iarg_bisect (1, + Iarg_facet ((2,false),0.6513,1059, + Iarg_leaf 1055), + Iarg_facet ((2,true),0.6489,1103, + Iarg_leaf 955)), + Iarg_facet ((1,true),0.5000,1370, + Iarg_facet ((2,true),0.5371,909, + Iarg_bisect (4, + Iarg_bisect (1, + Iarg_facet ((5,true),0.6713,1120, + Iarg_leaf 980), + Iarg_facet ((5,true),0.7394,729, + Iarg_leaf 1965)), + Iarg_facet ((1,true),0.5000,1547, + Iarg_facet ((5,true),0.7632,904, + Iarg_facet ((2,true),0.5000,790, + Iarg_bisect (4, + Iarg_facet ((1,false),0.5000,835, + Iarg_facet ((2,true),0.5000,867, + Iarg_leaf 1175)), + Iarg_facet ((1,true),0.5000,1739, + Iarg_facet ((2,true),0.5000,926, + Iarg_facet ((4,false),0.5000,1579, + Iarg_facet ((1,true),0.5000,1391, + Iarg_facet ((2,true),0.5000,887, + Iarg_leaf 1686)))))))))))))))))));; + +add_case ("TSKAJXY-WKGUESB sym", + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,1678, + Iarg_facet ((2,true),0.5000,1185, + Iarg_facet ((4,true),0.5000,773, + Iarg_facet ((5,true),0.6160,715, + Iarg_facet ((1,true),0.6375,875, + Iarg_leaf 1521))))), + Iarg_bisect (3, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1680, + Iarg_facet ((5,true),0.5000,1271, + Iarg_bisect (1, + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,970, + Iarg_leaf 1788), + Iarg_facet ((0,false),0.5000,1661, + Iarg_facet ((2,true),0.5000,947, + Iarg_facet ((4,true),0.6329,1052, + Iarg_leaf 1810)))), + Iarg_facet ((3,false),0.5000,824, + Iarg_leaf 1565)))), + Iarg_facet ((4,true),0.6285,888, + Iarg_leaf 1438)), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,1489, + Iarg_facet ((2,true),0.5000,937, + Iarg_facet ((4,true),0.6342,990, + Iarg_leaf 1645))), + Iarg_bisect (3, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1588, + Iarg_facet ((5,true),0.5000,1180, + Iarg_facet ((1,true),0.5000,1721, + Iarg_facet ((0,false),0.5000,1845, + Iarg_facet ((3,false),0.5000,1313, + Iarg_facet ((2,true),0.5000,1085, + Iarg_facet ((4,true),0.6157,916, + Iarg_leaf 1170))))))), + Iarg_facet ((4,true),0.6318,847, + Iarg_leaf 1325)), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (0, + Iarg_bisect (3, + Iarg_facet ((2,true),0.5000,1087, + Iarg_facet ((4,true),0.5000,703, + Iarg_leaf 1413)), + Iarg_facet ((2,true),0.5000,775, + Iarg_leaf 1833)), + Iarg_bisect (3, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1615, + Iarg_facet ((1,true),0.5000,1157, + Iarg_facet ((0,false),0.5000,1014, + Iarg_facet ((3,false),0.5000,741, + Iarg_facet ((2,true),0.6198,893, + Iarg_leaf 1071))))), + Iarg_facet ((5,true),0.6238,922, + Iarg_leaf 1315)), + Iarg_facet ((4,true),0.5000,1011, + Iarg_facet ((5,true),0.6238,922, + Iarg_leaf 1336))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (0, + Iarg_bisect (3, + Iarg_facet ((2,true),0.6212,887, + Iarg_leaf 1071), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1365, + Iarg_facet ((5,true),0.5000,922, + Iarg_facet ((1,true),0.6241,913, + Iarg_leaf 1429))), + Iarg_facet ((4,true),0.5000,700, + Iarg_leaf 1379))), + Iarg_bisect (3, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1362, + Iarg_facet ((5,true),0.5000,925, + Iarg_facet ((1,true),0.6246,915, + Iarg_leaf 1425))), + Iarg_facet ((4,true),0.5000,700, + Iarg_leaf 1371)), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (0, + Iarg_facet ((3,false),0.5000,975, + Iarg_facet ((2,true),0.5000,945, + Iarg_leaf 1867)), + Iarg_bisect (3, + Iarg_facet ((2,true),0.5000,947, + Iarg_leaf 1872), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1614, + Iarg_facet ((1,true),0.5000,1138, + Iarg_facet ((0,false),0.5000,866, + Iarg_facet ((3,false),0.6361,971, + Iarg_leaf 1511)))), + Iarg_facet ((5,true),0.6198,904, + Iarg_leaf 1263)), + Iarg_facet ((4,true),0.5000,1026, + Iarg_facet ((5,true),0.6186,901, + Iarg_leaf 1270))))), + Iarg_facet ((0,false),0.5000,1112, + Iarg_facet ((3,false),0.5000,803, + Iarg_facet ((2,true),0.5000,850, + Iarg_leaf 1619)))), + Iarg_facet ((1,true),0.5000,1343, + Iarg_facet ((0,false),0.5000,1045, + Iarg_facet ((3,false),0.5000,764, + Iarg_facet ((2,true),0.5000,842, + Iarg_leaf 1562))))), + Iarg_facet ((5,true),0.5000,1835, + Iarg_facet ((1,true),0.5000,1337, + Iarg_facet ((0,false),0.5000,1042, + Iarg_facet ((3,false),0.5000,763, + Iarg_facet ((2,true),0.5000,841, + Iarg_leaf 1558)))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1834, + Iarg_facet ((1,true),0.5000,1342, + Iarg_facet ((0,false),0.5000,1048, + Iarg_facet ((3,false),0.5000,765, + Iarg_facet ((2,true),0.5000,844, + Iarg_leaf 1564))))), + Iarg_facet ((5,true),0.5000,753, + Iarg_leaf 1844))))), + Iarg_bisect (0, + Iarg_facet ((3,false),0.6451,920, + Iarg_leaf 6), + Iarg_facet ((3,false),0.5000,1657, + Iarg_facet ((2,true),0.5000,1712, + Iarg_facet ((4,true),0.5000,1136, + Iarg_facet ((5,true),0.5000,791, + Iarg_leaf 1889)))))), + Iarg_bisect (1, + Iarg_bisect (0, + Iarg_facet ((3,false),0.6671,945, + Iarg_leaf 6), + Iarg_facet ((3,false),0.5000,1618, + Iarg_facet ((2,true),0.5000,1662, + Iarg_facet ((4,true),0.5000,1120, + Iarg_facet ((5,true),0.5000,766, + Iarg_leaf 1852))))), + Iarg_facet ((0,false),0.6758,1090, + Iarg_leaf 1377))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (0, + Iarg_facet ((3,false),0.6476,879, + Iarg_leaf 6), + Iarg_facet ((3,false),0.5000,1617, + Iarg_facet ((2,true),0.5000,1662, + Iarg_facet ((4,true),0.5000,1120, + Iarg_facet ((5,true),0.5000,758, + Iarg_leaf 1847))))), + Iarg_facet ((0,false),0.6315,946, + Iarg_leaf 1449)), + Iarg_facet ((1,true),0.5000,769, + Iarg_facet ((0,false),0.6334,926, + Iarg_leaf 1430)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (0, + Iarg_facet ((3,false),0.6479,896, + Iarg_leaf 6), + Iarg_facet ((3,false),0.5000,1620, + Iarg_facet ((2,true),0.5000,1671, + Iarg_facet ((4,true),0.5000,1118, + Iarg_facet ((5,true),0.5000,758, + Iarg_leaf 1855))))), + Iarg_facet ((0,false),0.6288,960, + Iarg_leaf 1466)), + Iarg_facet ((1,true),0.5000,786, + Iarg_facet ((0,false),0.6348,924, + Iarg_leaf 1416))), + Iarg_facet ((5,true),0.5000,1086, + Iarg_facet ((1,true),0.5000,778, + Iarg_facet ((0,false),0.6337,935, + Iarg_leaf 1430))))))), + Iarg_facet ((0,false),0.5000,1559, + Iarg_bisect (3, + Iarg_facet ((2,true),0.5000,803, + Iarg_leaf 1590), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1668, + Iarg_facet ((5,true),0.5000,1176, + Iarg_facet ((1,true),0.5000,841, + Iarg_facet ((0,false),0.6172,978, + Iarg_leaf 1562)))), + Iarg_facet ((4,true),0.5000,771, + Iarg_leaf 1691))))), + Iarg_bisect (1, + Iarg_facet ((0,false),0.7661,1192, + Iarg_leaf 1349), + Iarg_facet ((0,false),0.6373,732, + Iarg_leaf 1884))), + Iarg_facet ((5,true),0.5000,1478, + Iarg_bisect (1, + Iarg_facet ((0,false),0.7664,1188, + Iarg_leaf 1349), + Iarg_facet ((0,false),0.6601,747, + Iarg_leaf 1789)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1484, + Iarg_bisect (1, + Iarg_facet ((0,false),0.7667,1192, + Iarg_leaf 1347), + Iarg_facet ((0,false),0.6578,754, + Iarg_leaf 1815))), + Iarg_facet ((5,true),0.6907,867, + Iarg_leaf 1041))))), + Iarg_facet ((0,false),0.5000,1679, + Iarg_bisect (3, + Iarg_facet ((2,true),0.5000,831, + Iarg_leaf 1801), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1823, + Iarg_facet ((5,true),0.5000,1348, + Iarg_facet ((1,true),0.5000,1045, + Iarg_facet ((0,false),0.6556,760, + Iarg_leaf 1917)))), + Iarg_facet ((4,true),0.5000,745, + Iarg_leaf 1872))))), + Iarg_facet ((1,false),0.5000,1366, + Iarg_facet ((0,false),0.7399,894, + Iarg_leaf 1446))), + Iarg_facet ((5,true),0.5000,1166, + Iarg_facet ((1,false),0.5000,1340, + Iarg_facet ((0,false),0.7507,1149, + Iarg_leaf 1293)))), + Iarg_facet ((4,true),0.5000,1627, + Iarg_facet ((5,true),0.5000,1159, + Iarg_facet ((1,false),0.5000,1351, + Iarg_facet ((0,false),0.7296,881, + Iarg_leaf 1614))))))), + Iarg_bisect (0, + Iarg_facet ((3,true),0.5000,719, + Iarg_leaf 1522), + Iarg_bisect (3, + Iarg_facet ((2,true),0.5000,928, + Iarg_facet ((4,true),0.6184,838, + Iarg_leaf 1397)), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1636, + Iarg_facet ((5,true),0.5000,1271, + Iarg_facet ((1,true),0.5000,1007, + Iarg_facet ((0,false),0.6513,708, + Iarg_facet ((3,false),0.6552,890, + Iarg_leaf 960))))), + Iarg_facet ((4,true),0.6246,926, + Iarg_leaf 1450))))), + Iarg_facet ((1,false),0.5000,1611, + Iarg_facet ((0,false),0.6266,796, + Iarg_leaf 1863))), + Iarg_facet ((5,true),0.5000,1207, + Iarg_facet ((1,false),0.5000,1427, + Iarg_facet ((0,false),0.6294,751, + Iarg_leaf 1699)))), + Iarg_facet ((4,true),0.5000,1583, + Iarg_facet ((5,true),0.5000,1161, + Iarg_facet ((1,false),0.5000,1377, + Iarg_facet ((0,false),0.6180,809, + Iarg_leaf 1881))))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1686, + Iarg_facet ((5,true),0.5000,1400, + Iarg_facet ((1,true),0.5000,1303, + Iarg_facet ((0,false),0.5000,781, + Iarg_facet ((3,false),0.5000,856, + Iarg_leaf 1872))))), + Iarg_facet ((4,true),0.6180,960, + Iarg_leaf 1710))), + Iarg_facet ((1,false),0.5000,798, + Iarg_leaf 1920)), + Iarg_facet ((5,true),0.5000,1046, + Iarg_facet ((1,false),0.6926,1096, + Iarg_leaf 974))), + Iarg_facet ((4,true),0.5000,1468, + Iarg_facet ((5,true),0.5000,974, + Iarg_facet ((1,false),0.6993,1142, + Iarg_leaf 1003)))));; + +add_case ("7761782916", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1885, + Iarg_facet ((1,true),0.5000,1166, + Iarg_facet ((2,true),0.5000,731, + Iarg_leaf 1235))), + Iarg_facet ((0,true),0.5000,1108, + Iarg_leaf 1526)), + Iarg_facet ((5,true),0.6533,914, + Iarg_facet ((0,true),0.5000,938, + Iarg_leaf 1345))), + Iarg_facet ((4,true),0.5000,755, + Iarg_facet ((5,true),0.6506,932, + Iarg_facet ((0,true),0.5000,723, + Iarg_leaf 1597)))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1643, + Iarg_facet ((5,true),0.5000,704, + Iarg_leaf 1726)), + Iarg_facet ((4,true),0.6431,889, + Iarg_leaf 1285))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,986, + Iarg_facet ((5,true),0.5000,1267, + Iarg_leaf 1719)), + Iarg_facet ((4,true),0.7531,850, + Iarg_leaf 1362)), + Iarg_facet ((3,true),0.5000,1204, + Iarg_leaf 1505))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1376, + Iarg_facet ((4,true),0.5000,1766, + Iarg_facet ((5,true),0.5000,1242, + Iarg_leaf 1710))), + Iarg_facet ((3,true),0.5000,812, + Iarg_leaf 1894)), + Iarg_facet ((2,true),0.5000,1271, + Iarg_facet ((3,true),0.5000,803, + Iarg_leaf 1901)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1550, + Iarg_facet ((3,true),0.6140,827, + Iarg_facet ((4,true),0.6927,718, + Iarg_leaf 1970))), + Iarg_facet ((2,true),0.5000,1124, + Iarg_facet ((3,true),0.6210,846, + Iarg_facet ((4,true),0.8639,1082, + Iarg_leaf 1076)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1103, + Iarg_facet ((3,true),0.6738,787, + Iarg_facet ((4,true),0.7755,840, + Iarg_leaf 1368))), + Iarg_facet ((2,true),0.5000,781, + Iarg_facet ((3,true),0.6697,784, + Iarg_leaf 1740))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.6418,917, + Iarg_facet ((5,true),0.7531,850, + Iarg_leaf 1966)), + Iarg_facet ((3,true),0.6333,857, + Iarg_facet ((5,true),0.8046,802, + Iarg_leaf 1328))), + Iarg_facet ((2,true),0.5000,1084, + Iarg_leaf 1500)), + Iarg_facet ((1,true),0.5000,1859, + Iarg_bisect (2, + Iarg_facet ((3,true),0.6880,815, + Iarg_facet ((5,true),0.7822,831, + Iarg_leaf 1269)), + Iarg_facet ((3,true),0.6702,773, + Iarg_leaf 1812)))), + Iarg_facet ((0,false),0.5000,1741, + Iarg_leaf 1781))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.6385,905, + Iarg_facet ((5,true),0.7677,897, + Iarg_leaf 1875)), + Iarg_facet ((4,true),0.6471,886, + Iarg_facet ((5,true),0.8132,799, + Iarg_leaf 1224))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.6755,781, + Iarg_facet ((5,true),0.8732,1168, + Iarg_leaf 864)), + Iarg_facet ((4,true),0.7176,857, + Iarg_leaf 1667))), + Iarg_facet ((1,true),0.5000,1836, + Iarg_facet ((2,true),0.5000,1078, + Iarg_leaf 1500))), + Iarg_facet ((0,true),0.5000,1513, + Iarg_facet ((1,false),0.5000,955, + Iarg_leaf 1080))), + Iarg_facet ((5,true),0.5000,1515, + Iarg_facet ((0,true),0.5000,1540, + Iarg_facet ((1,true),0.5000,971, + Iarg_leaf 1144))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((3,true),0.5000,1654, + Iarg_facet ((4,true),0.5000,1058, + Iarg_leaf 1288)), + Iarg_facet ((3,true),0.5000,1015, + Iarg_leaf 1062)), + Iarg_facet ((1,true),0.5000,1173, + Iarg_facet ((3,true),0.5000,811, + Iarg_leaf 1284))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1382, + Iarg_facet ((3,true),0.5000,711, + Iarg_leaf 1423)), + Iarg_facet ((1,true),0.5000,838, + Iarg_leaf 1386))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1303, + Iarg_facet ((3,true),0.5000,923, + Iarg_facet ((5,true),0.6801,726, + Iarg_leaf 1782))), + Iarg_facet ((1,true),0.5000,1058, + Iarg_facet ((3,true),0.5000,832, + Iarg_facet ((5,true),0.6835,702, + Iarg_leaf 1580)))), + Iarg_facet ((0,true),0.5000,1088, + Iarg_leaf 1510))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((4,true),0.5000,907, + Iarg_facet ((5,true),0.6971,746, + Iarg_leaf 1778)), + Iarg_facet ((4,true),0.5000,806, + Iarg_facet ((5,true),0.7635,887, + Iarg_leaf 1566))), + Iarg_facet ((1,true),0.5000,1069, + Iarg_leaf 1296)), + Iarg_facet ((0,true),0.5000,862, + Iarg_leaf 1775)), + Iarg_facet ((5,true),0.5000,921, + Iarg_facet ((0,true),0.5000,1600, + Iarg_facet ((1,true),0.5000,999, + Iarg_leaf 1272)))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1650, + Iarg_facet ((4,true),0.6169,933, + Iarg_leaf 1407)), + Iarg_facet ((3,true),0.5000,1010, + Iarg_leaf 1083)), + Iarg_facet ((2,true),0.5000,1163, + Iarg_facet ((3,true),0.5000,799, + Iarg_leaf 1291))), + Iarg_bisect (0, + Iarg_facet ((2,true),0.5000,1314, + Iarg_facet ((3,true),0.5000,941, + Iarg_facet ((4,true),0.6797,730, + Iarg_leaf 1854))), + Iarg_facet ((2,true),0.5000,978, + Iarg_facet ((3,true),0.5000,829, + Iarg_facet ((4,true),0.7605,927, + Iarg_leaf 1588))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((2,true),0.5000,1370, + Iarg_facet ((3,true),0.5000,714, + Iarg_leaf 1368)), + Iarg_facet ((2,true),0.5000,852, + Iarg_leaf 1384)), + Iarg_facet ((0,true),0.5000,1038, + Iarg_leaf 1504))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (2, + Iarg_facet ((4,true),0.6252,884, + Iarg_facet ((5,true),0.6486,860, + Iarg_leaf 1581)), + Iarg_facet ((4,true),0.6198,861, + Iarg_facet ((5,true),0.6671,743, + Iarg_leaf 1301))), + Iarg_facet ((2,true),0.5000,1029, + Iarg_leaf 1289)), + Iarg_facet ((0,true),0.5000,1421, + Iarg_facet ((2,true),0.5000,1000, + Iarg_leaf 1269))), + Iarg_facet ((5,true),0.5000,923, + Iarg_facet ((0,true),0.5000,844, + Iarg_leaf 1785)))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1418, + Iarg_facet ((3,false),0.5000,1085, + Iarg_leaf 1217)), + Iarg_facet ((0,true),0.5000,980, + Iarg_leaf 1656)), + Iarg_facet ((5,true),0.5000,895, + Iarg_facet ((0,true),0.5000,1005, + Iarg_leaf 1692))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1820, + Iarg_facet ((0,true),0.5000,1628, + Iarg_facet ((4,true),0.5000,1270, + Iarg_facet ((5,true),0.5000,805, + Iarg_facet ((1,true),0.5000,1058, + Iarg_leaf 1624))))), + Iarg_facet ((5,true),0.6444,860, + Iarg_leaf 1361))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1087, + Iarg_facet ((4,true),0.5000,1265, + Iarg_leaf 1648)), + Iarg_facet ((3,true),0.5000,721, + Iarg_leaf 1405)), + Iarg_facet ((2,true),0.5000,1160, + Iarg_facet ((3,true),0.5000,716, + Iarg_leaf 1421))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1306, + Iarg_facet ((3,true),0.6174,877, + Iarg_facet ((4,true),0.6374,875, + Iarg_leaf 1720))), + Iarg_facet ((2,true),0.5000,978, + Iarg_facet ((3,true),0.6186,865, + Iarg_facet ((4,true),0.6619,762, + Iarg_leaf 1484))))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.6168,863, + Iarg_facet ((5,true),0.6377,875, + Iarg_leaf 1673)), + Iarg_facet ((3,true),0.5970,821, + Iarg_facet ((5,true),0.6573,781, + Iarg_leaf 1432))), + Iarg_facet ((2,true),0.5000,1018, + Iarg_leaf 1300)), + Iarg_facet ((1,true),0.5000,1393, + Iarg_facet ((2,true),0.5000,1012, + Iarg_leaf 1267)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1359, + Iarg_leaf 1983), + Iarg_facet ((2,true),0.5000,868, + Iarg_leaf 1354)), + Iarg_facet ((1,true),0.5000,1072, + Iarg_leaf 1511)), + Iarg_facet ((5,true),0.5000,907, + Iarg_facet ((1,true),0.5000,823, + Iarg_leaf 1797)))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,1378, + Iarg_facet ((3,true),0.5000,913, + Iarg_leaf 1407)), + Iarg_facet ((1,true),0.5000,960, + Iarg_leaf 1670)), + Iarg_facet ((5,true),0.5000,1693, + Iarg_facet ((1,true),0.5000,1586, + Iarg_facet ((3,true),0.5000,1287, + Iarg_facet ((5,true),0.5000,822, + Iarg_facet ((0,true),0.5000,1079, + Iarg_leaf 1626)))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,906, + Iarg_facet ((1,true),0.5000,1030, + Iarg_leaf 1679)), + Iarg_facet ((5,true),0.6466,866, + Iarg_leaf 1327)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((2,true),0.5000,1345, + Iarg_facet ((3,true),0.5000,901, + Iarg_leaf 1393)), + Iarg_facet ((2,true),0.5000,1457, + Iarg_facet ((3,true),0.5000,1287, + Iarg_facet ((4,true),0.5000,826, + Iarg_facet ((0,true),0.5000,1143, + Iarg_leaf 1695))))), + Iarg_facet ((5,true),0.5000,1655, + Iarg_facet ((2,true),0.5000,937, + Iarg_leaf 1657))), + Iarg_facet ((4,true),0.5000,1488, + Iarg_facet ((5,true),0.5000,1788, + Iarg_facet ((2,true),0.5000,1013, + Iarg_leaf 1684)))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1944, + Iarg_facet ((5,true),0.5000,1246, + Iarg_leaf 1662)), + Iarg_facet ((4,true),0.5000,1048, + Iarg_leaf 1987))))));; + +add_case ("7550003505 1 3 3", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.7173,1119, + Iarg_leaf 584), + Iarg_bisect (5, + Iarg_facet ((0,true),0.7492,770, + Iarg_facet ((1,true),0.7492,788, + Iarg_leaf 1664)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1776, + Iarg_facet ((2,true),0.5000,1278, + Iarg_facet ((3,false),0.5000,1527, + Iarg_leaf 1724))), + Iarg_facet ((1,true),0.7919,1049, + Iarg_leaf 1096)))), + Iarg_facet ((4,false),0.5000,1652, + Iarg_bisect (5, + Iarg_facet ((0,true),0.7492,708, + Iarg_facet ((1,true),0.7181,862, + Iarg_facet ((2,true),0.5000,1158, + Iarg_leaf 1185))), + Iarg_facet ((0,true),0.5000,1931, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1869, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,849, + Iarg_leaf 1263), + Iarg_facet ((4,false),0.5000,746, + Iarg_leaf 1417))), + Iarg_facet ((2,true),0.5000,868, + Iarg_leaf 1557)))))), + Iarg_facet ((3,false),0.5000,1651, + Iarg_facet ((5,true),0.9985,1145, + Iarg_leaf 1203))), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_facet ((0,true),0.7492,815, + Iarg_facet ((1,true),0.7249,790, + Iarg_leaf 1774)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1921, + Iarg_facet ((4,true),0.5000,1329, + Iarg_facet ((3,true),0.5000,1081, + Iarg_leaf 1254))), + Iarg_facet ((2,true),0.5000,798, + Iarg_facet ((4,true),0.5696,1077, + Iarg_leaf 1392))), + Iarg_facet ((1,true),0.7066,1037, + Iarg_facet ((2,true),0.5000,701, + Iarg_leaf 1400)))), + Iarg_bisect (5, + Iarg_facet ((0,true),0.7533,774, + Iarg_facet ((1,true),0.7494,728, + Iarg_leaf 1623)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1271, + Iarg_facet ((3,false),0.5000,1262, + Iarg_leaf 1458)), + Iarg_facet ((4,true),0.5000,1150, + Iarg_leaf 1198)), + Iarg_facet ((2,true),0.5000,1158, + Iarg_leaf 1394)), + Iarg_facet ((1,true),0.6986,940, + Iarg_facet ((2,true),0.5000,1255, + Iarg_leaf 1559))))), + Iarg_bisect (3, + Iarg_facet ((5,false),0.5600,1241, + Iarg_facet ((0,true),0.5000,1930, + Iarg_facet ((1,true),0.5000,785, + Iarg_leaf 1458))), + Iarg_facet ((5,false),0.6174,1118, + Iarg_facet ((0,true),0.5000,1640, + Iarg_leaf 1956)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1089, + Iarg_leaf 1487), + Iarg_facet ((4,false),0.5000,1017, + Iarg_leaf 1114)), + Iarg_facet ((2,true),0.5000,706, + Iarg_facet ((4,true),0.5000,962, + Iarg_leaf 1164))), + Iarg_facet ((1,true),0.5000,1510, + Iarg_facet ((2,true),0.5000,1087, + Iarg_facet ((4,false),0.5000,862, + Iarg_leaf 1293)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1439, + Iarg_facet ((5,true),0.7848,1254, + Iarg_leaf 882)), + Iarg_facet ((4,false),0.5000,923, + Iarg_leaf 1117)), + Iarg_facet ((2,true),0.5000,1127, + Iarg_leaf 1774)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1415, + Iarg_facet ((4,false),0.5000,1299, + Iarg_facet ((5,false),0.5000,936, + Iarg_leaf 1087))), + Iarg_facet ((2,true),0.5000,733, + Iarg_leaf 1301)))), + Iarg_facet ((3,false),0.5000,1374, + Iarg_leaf 1554)), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1142, + Iarg_leaf 1584), + Iarg_facet ((1,true),0.5000,1328, + Iarg_facet ((2,true),0.5000,1127, + Iarg_leaf 1483))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1311, + Iarg_leaf 1605), + Iarg_facet ((1,true),0.5000,1276, + Iarg_facet ((2,true),0.5000,1284, + Iarg_leaf 1573)))), + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1015, + Iarg_facet ((1,true),0.5000,1132, + Iarg_leaf 1585)), + Iarg_facet ((0,false),0.5000,969, + Iarg_facet ((1,true),0.5000,1411, + Iarg_leaf 1574))))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1388, + Iarg_bisect (5, + Iarg_facet ((0,true),0.7492,704, + Iarg_facet ((1,true),0.7739,799, + Iarg_facet ((2,true),0.7757,935, + Iarg_leaf 1081))), + Iarg_facet ((0,true),0.5000,1647, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1680, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,846, + Iarg_leaf 1588), + Iarg_facet ((4,false),0.5000,1014, + Iarg_leaf 1782))), + Iarg_facet ((2,true),0.5000,1277, + Iarg_leaf 1451))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,770, + Iarg_facet ((0,true),0.8222,982, + Iarg_facet ((1,true),0.8803,753, + Iarg_leaf 1482))), + Iarg_bisect (5, + Iarg_facet ((0,true),0.6497,968, + Iarg_facet ((1,true),0.7520,1115, + Iarg_facet ((2,true),0.6644,1030, + Iarg_facet ((3,true),0.5000,1169, + Iarg_leaf 1198)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1756, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1313, + Iarg_leaf 1979), + Iarg_facet ((4,false),0.5000,1791, + Iarg_leaf 1940))), + Iarg_facet ((2,true),0.5000,792, + Iarg_leaf 1757)), + Iarg_facet ((1,true),0.8108,999, + Iarg_facet ((2,true),0.8598,881, + Iarg_facet ((3,false),0.6371,929, + Iarg_leaf 1324))))))), + Iarg_bisect (3, + Iarg_facet ((5,true),0.9985,1181, + Iarg_leaf 1314), + Iarg_facet ((5,true),0.9980,1114, + Iarg_leaf 1482))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.7896,1164, + Iarg_facet ((1,true),0.8385,1102, + Iarg_leaf 1117)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,847, + Iarg_leaf 1721), + Iarg_facet ((4,true),0.5000,900, + Iarg_leaf 1716)), + Iarg_facet ((3,false),0.5000,1664, + Iarg_leaf 1721)), + Iarg_facet ((2,true),0.5000,1431, + Iarg_leaf 1463)), + Iarg_facet ((1,true),0.7285,1231, + Iarg_facet ((2,true),0.5000,894, + Iarg_facet ((3,false),0.5000,833, + Iarg_leaf 1286))))), + Iarg_facet ((5,false),0.5742,1079, + Iarg_facet ((0,true),0.5000,1884, + Iarg_facet ((1,true),0.6358,849, + Iarg_leaf 1258)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5537,804, + Iarg_facet ((1,true),0.7379,769, + Iarg_facet ((2,true),0.5000,1346, + Iarg_facet ((4,true),0.6091,737, + Iarg_leaf 1295)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1736, + Iarg_facet ((3,true),0.5000,1400, + Iarg_leaf 1678)), + Iarg_facet ((4,false),0.5000,1726, + Iarg_facet ((3,false),0.5000,997, + Iarg_leaf 1183))), + Iarg_facet ((2,true),0.5000,824, + Iarg_facet ((4,true),0.5617,1040, + Iarg_leaf 1504))), + Iarg_facet ((1,true),0.7020,1124, + Iarg_facet ((2,true),0.5000,734, + Iarg_bisect (4, + Iarg_facet ((3,false),0.5000,1230, + Iarg_facet ((5,false),0.5000,811, + Iarg_leaf 1300)), + Iarg_facet ((3,false),0.5000,1315, + Iarg_leaf 1380)))))), + Iarg_facet ((5,false),0.5000,730, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6334,1069, + Iarg_leaf 1571), + Iarg_facet ((1,true),0.7653,845, + Iarg_leaf 1813))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1892, + Iarg_facet ((4,true),0.5000,932, + Iarg_leaf 1291)), + Iarg_facet ((3,false),0.5000,1414, + Iarg_leaf 1680)), + Iarg_facet ((2,true),0.5000,1441, + Iarg_facet ((3,false),0.5000,1184, + Iarg_leaf 1348))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1386, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,743, + Iarg_leaf 1313), + Iarg_facet ((4,false),0.5000,888, + Iarg_leaf 1476))), + Iarg_facet ((2,false),0.5000,1175, + Iarg_leaf 1245))), + Iarg_facet ((0,false),0.5000,702, + Iarg_leaf 1371)), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1118, + Iarg_leaf 1983), + Iarg_facet ((1,true),0.5000,1457, + Iarg_facet ((2,true),0.5000,1973, + Iarg_facet ((3,false),0.5000,968, + Iarg_leaf 1099)))), + Iarg_facet ((0,false),0.5000,972, + Iarg_facet ((1,true),0.5000,1598, + Iarg_leaf 1859)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1806, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1936, + Iarg_facet ((4,false),0.5000,1538, + Iarg_facet ((5,true),0.5000,853, + Iarg_leaf 1414))), + Iarg_facet ((2,true),0.5000,1811, + Iarg_facet ((4,true),0.5000,1486, + Iarg_leaf 1683))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1481, + Iarg_bisect (4, + Iarg_facet ((5,true),0.8178,1276, + Iarg_leaf 803), + Iarg_facet ((5,true),0.5000,1461, + Iarg_leaf 1632))), + Iarg_facet ((2,true),0.9030,1290, + Iarg_leaf 471)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1524, + Iarg_leaf 1926), + Iarg_facet ((1,true),0.5000,1592, + Iarg_bisect (2, + Iarg_facet ((5,true),0.5000,996, + Iarg_leaf 1112), + Iarg_facet ((5,false),0.5000,1082, + Iarg_leaf 1426)))), + Iarg_facet ((0,false),0.5000,1125, + Iarg_facet ((1,true),0.5000,1657, + Iarg_leaf 1916)))))))));; + +add_case ("7550003505 0 1 4", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,900, + Iarg_facet ((4,false),0.8285,789, + Iarg_facet ((5,false),0.5000,1004, + Iarg_leaf 1168))), + Iarg_facet ((5,true),0.5000,1921, + Iarg_facet ((3,false),0.5000,819, + Iarg_leaf 1631))), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,984, + Iarg_leaf 1940), + Iarg_facet ((0,true),0.5948,945, + Iarg_leaf 1844)), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1123, + Iarg_bisect (4, + Iarg_facet ((3,false),0.5000,1356, + Iarg_leaf 1608), + Iarg_facet ((3,false),0.5000,1189, + Iarg_leaf 1264))), + Iarg_facet ((2,true),0.7231,932, + Iarg_facet ((4,true),0.5000,1031, + Iarg_leaf 1452))), + Iarg_facet ((1,true),0.5000,791, + Iarg_facet ((2,true),0.9215,1138, + Iarg_leaf 693))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1119, + Iarg_bisect (4, + Iarg_facet ((3,false),0.5000,1502, + Iarg_leaf 1981), + Iarg_facet ((3,false),0.5000,1095, + Iarg_leaf 1365))), + Iarg_facet ((2,true),0.7975,791, + Iarg_leaf 1092)), + Iarg_facet ((1,true),0.5000,852, + Iarg_leaf 1789)))), + Iarg_facet ((3,false),0.5000,1667, + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1946, + Iarg_facet ((1,true),0.5000,853, + Iarg_facet ((2,true),0.5000,1115, + Iarg_facet ((3,false),0.5000,980, + Iarg_leaf 1030)))), + Iarg_facet ((0,false),0.5000,1599, + Iarg_facet ((1,true),0.5000,934, + Iarg_facet ((2,true),0.5000,1015, + Iarg_leaf 1671)))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,722, + Iarg_facet ((1,true),0.7651,724, + Iarg_facet ((2,true),0.7494,772, + Iarg_leaf 1364))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1800, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1840, + Iarg_leaf 1881), + Iarg_facet ((5,true),0.5000,1333, + Iarg_leaf 1413))), + Iarg_facet ((2,true),0.8150,859, + Iarg_leaf 1114)), + Iarg_facet ((1,true),0.5000,776, + Iarg_facet ((2,true),0.8756,794, + Iarg_leaf 1006)))), + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1074, + Iarg_facet ((1,true),0.7745,925, + Iarg_leaf 1663)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((3,true),0.5000,1066, + Iarg_leaf 1575), + Iarg_facet ((3,true),0.5000,881, + Iarg_leaf 1140)), + Iarg_facet ((4,false),0.6721,898, + Iarg_leaf 1660)), + Iarg_facet ((2,true),0.7180,967, + Iarg_facet ((4,true),0.5000,859, + Iarg_leaf 1375))), + Iarg_facet ((1,true),0.6209,1170, + Iarg_facet ((2,true),0.8182,836, + Iarg_leaf 1316))))), + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,788, + Iarg_bisect (0, + Iarg_facet ((1,true),0.7033,703, + Iarg_leaf 1646), + Iarg_facet ((1,true),0.6307,1165, + Iarg_facet ((2,true),0.5706,913, + Iarg_leaf 1301)))), + Iarg_facet ((3,false),0.5000,1009, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6746,797, + Iarg_facet ((2,false),0.7054,978, + Iarg_leaf 1850)), + Iarg_facet ((1,true),0.5818,1067, + Iarg_facet ((2,true),0.5000,1010, + Iarg_facet ((3,false),0.5000,980, + Iarg_leaf 1276))))))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,957, + Iarg_bisect (5, + Iarg_facet ((4,false),0.8303,1028, + Iarg_leaf 1552), + Iarg_facet ((4,false),0.9027,991, + Iarg_leaf 1136))), + Iarg_facet ((3,true),0.5000,827, + Iarg_facet ((5,true),0.5000,1035, + Iarg_leaf 1668))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1623, + Iarg_facet ((5,true),0.5000,1211, + Iarg_leaf 1324)), + Iarg_facet ((4,true),0.5000,1580, + Iarg_leaf 1849)), + Iarg_facet ((3,false),0.5000,886, + Iarg_leaf 1195)), + Iarg_facet ((2,true),0.5000,1194, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1165, + Iarg_leaf 1225), + Iarg_facet ((4,true),0.5000,1243, + Iarg_leaf 1516)))), + Iarg_facet ((1,true),0.5000,1849, + Iarg_facet ((2,true),0.7538,1045, + Iarg_facet ((3,true),0.5000,1066, + Iarg_leaf 1295)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1717, + Iarg_facet ((5,true),0.5000,1272, + Iarg_leaf 1306)), + Iarg_facet ((4,true),0.5000,1482, + Iarg_leaf 1852)), + Iarg_facet ((3,false),0.5000,1048, + Iarg_leaf 1473)), + Iarg_facet ((2,true),0.5000,975, + Iarg_facet ((3,false),0.5000,1753, + Iarg_facet ((4,true),0.5000,1060, + Iarg_leaf 1217)))), + Iarg_facet ((1,true),0.5000,1438, + Iarg_facet ((2,true),0.7148,817, + Iarg_facet ((3,true),0.5000,889, + Iarg_leaf 1175))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1613, + Iarg_facet ((2,false),0.5819,1080, + Iarg_leaf 1622)), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1600, + Iarg_leaf 1877), + Iarg_facet ((3,false),0.5000,874, + Iarg_leaf 1432)), + Iarg_facet ((2,true),0.6345,1101, + Iarg_leaf 1081))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1172, + Iarg_facet ((2,false),0.5683,953, + Iarg_leaf 1780)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1839, + Iarg_facet ((3,false),0.5000,1357, + Iarg_leaf 1489)), + Iarg_facet ((2,true),0.5000,782, + Iarg_leaf 1307))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5677,1076, + Iarg_leaf 1291), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1965, + Iarg_facet ((3,true),0.6089,844, + Iarg_leaf 1763)), + Iarg_facet ((4,false),0.7026,1174, + Iarg_leaf 1411))), + Iarg_facet ((1,false),0.6942,1162, + Iarg_leaf 1894)), + Iarg_facet ((0,true),0.5000,1649, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5538,857, + Iarg_leaf 1449), + Iarg_facet ((2,true),0.5000,1598, + Iarg_facet ((4,true),0.5000,1398, + Iarg_leaf 1603))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1916, + Iarg_facet ((2,false),0.7034,1154, + Iarg_leaf 1660)), + Iarg_bisect (1, + Iarg_facet ((2,false),0.6221,1282, + Iarg_leaf 1650), + Iarg_bisect (2, + Iarg_facet ((3,true),0.6589,1136, + Iarg_leaf 1074), + Iarg_facet ((3,false),0.5000,945, + Iarg_facet ((4,true),0.5000,1712, + Iarg_leaf 1755))))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1814, + Iarg_leaf 1827), + Iarg_bisect (1, + Iarg_facet ((2,false),0.7034,935, + Iarg_leaf 1126), + Iarg_facet ((2,false),0.5000,1248, + Iarg_leaf 1728)))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1446, + Iarg_leaf 1949), + Iarg_facet ((4,true),0.5000,1069, + Iarg_leaf 1265)), + Iarg_facet ((3,false),0.5000,1415, + Iarg_leaf 1740)), + Iarg_facet ((2,true),0.5000,910, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,938, + Iarg_leaf 1170), + Iarg_facet ((4,true),0.5000,1275, + Iarg_leaf 1573)))), + Iarg_facet ((1,true),0.5000,1355, + Iarg_facet ((2,true),0.7103,792, + Iarg_facet ((3,true),0.5000,978, + Iarg_leaf 1476)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1728, + Iarg_facet ((3,true),0.5000,1197, + Iarg_leaf 1463)), + Iarg_facet ((2,true),0.5000,1301, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1142, + Iarg_leaf 1361), + Iarg_facet ((4,true),0.5000,1285, + Iarg_leaf 1551)))), + Iarg_facet ((1,true),0.5000,1876, + Iarg_facet ((2,true),0.7004,843, + Iarg_leaf 1897)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1121, + Iarg_facet ((2,false),0.5822,938, + Iarg_facet ((3,false),0.5000,1027, + Iarg_leaf 1344))), + Iarg_facet ((1,true),0.5000,1975, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1669, + Iarg_leaf 1698), + Iarg_facet ((3,false),0.5000,1083, + Iarg_leaf 1514)))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1548, + Iarg_facet ((2,false),0.7182,838, + Iarg_facet ((3,true),0.5000,984, + Iarg_leaf 1148))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1485, + Iarg_leaf 1679), + Iarg_facet ((3,false),0.5000,1297, + Iarg_leaf 1879)), + Iarg_facet ((2,true),0.5620,918, + Iarg_leaf 1268))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1579, + Iarg_bisect (1, + Iarg_facet ((2,false),0.6166,1126, + Iarg_leaf 1061), + Iarg_facet ((2,true),0.5000,1900, + Iarg_facet ((4,true),0.5000,1623, + Iarg_leaf 1847)))), + Iarg_facet ((0,true),0.5000,1848, + Iarg_facet ((1,false),0.5000,1068, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1469, + Iarg_leaf 1644), + Iarg_facet ((4,false),0.6953,1008, + Iarg_leaf 1168))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.8163,1024, + Iarg_leaf 1112), + Iarg_facet ((2,false),0.7018,1068, + Iarg_leaf 1238)), + Iarg_bisect (1, + Iarg_facet ((2,false),0.6925,1110, + Iarg_leaf 1267), + Iarg_facet ((2,false),0.5000,1056, + Iarg_leaf 1403))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1184, + Iarg_facet ((2,false),0.6881,1067, + Iarg_leaf 1655)), + Iarg_bisect (1, + Iarg_facet ((2,false),0.6885,1162, + Iarg_leaf 1665), + Iarg_facet ((2,true),0.5000,1320, + Iarg_leaf 1396))))))))));; + +add_case ("7550003505 0 0 2", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1742, + Iarg_facet ((0,true),0.5000,941, + Iarg_facet ((1,true),0.7442,769, + Iarg_leaf 1793))), + Iarg_facet ((5,false),0.5000,797, + Iarg_facet ((0,false),0.5000,1603, + Iarg_leaf 1956))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5661,827, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1591, + Iarg_facet ((3,true),0.5000,1748, + Iarg_facet ((4,false),0.5000,1027, + Iarg_leaf 1258))), + Iarg_facet ((2,true),0.8692,1208, + Iarg_leaf 980)), + Iarg_facet ((1,true),0.7108,1087, + Iarg_leaf 1616))), + Iarg_facet ((5,false),0.5973,788, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1632, + Iarg_facet ((2,true),0.5000,1799, + Iarg_facet ((3,true),0.5000,1289, + Iarg_facet ((4,true),0.5000,709, + Iarg_leaf 1301)))), + Iarg_facet ((1,true),0.5804,979, + Iarg_facet ((2,true),0.5000,870, + Iarg_facet ((3,true),0.5000,970, + Iarg_leaf 1328))))))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((0,true),0.5000,1632, + Iarg_facet ((1,true),0.8458,1175, + Iarg_leaf 1243)), + Iarg_facet ((0,false),0.5000,1426, + Iarg_leaf 1584)), + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,1690, + Iarg_leaf 1917), + Iarg_facet ((3,false),0.5000,1576, + Iarg_leaf 1622)), + Iarg_facet ((5,true),0.5000,1942, + Iarg_facet ((3,false),0.5000,820, + Iarg_leaf 1459))), + Iarg_facet ((2,true),0.7078,1253, + Iarg_leaf 1972)), + Iarg_facet ((1,true),0.5000,1402, + Iarg_facet ((2,true),0.5000,1143, + Iarg_facet ((5,false),0.5000,1291, + Iarg_leaf 1761)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,1098, + Iarg_leaf 1200), + Iarg_facet ((3,false),0.5000,1003, + Iarg_leaf 1164)), + Iarg_facet ((5,false),0.5000,1330, + Iarg_leaf 1342)), + Iarg_facet ((2,true),0.6073,833, + Iarg_leaf 1323)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1588, + Iarg_facet ((5,true),0.5000,1838, + Iarg_leaf 1952)), + Iarg_facet ((2,true),0.7876,1127, + Iarg_leaf 1298))))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1010, + Iarg_leaf 1552), + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1105, + Iarg_facet ((2,true),0.7230,846, + Iarg_leaf 1230)), + Iarg_facet ((1,true),0.5000,1977, + Iarg_facet ((2,true),0.5000,1273, + Iarg_facet ((3,true),0.5000,1348, + Iarg_leaf 1507)))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,806, + Iarg_leaf 1326), + Iarg_facet ((1,true),0.5000,1987, + Iarg_facet ((2,true),0.5000,1402, + Iarg_facet ((3,false),0.5000,1190, + Iarg_leaf 1201)))))))), + Iarg_bisect (5, + Iarg_facet ((4,true),0.7732,827, + Iarg_facet ((3,false),0.6048,809, + Iarg_leaf 1794)), + Iarg_facet ((4,true),0.6805,962, + Iarg_bisect (5, + Iarg_facet ((3,false),0.5744,770, + Iarg_facet ((0,false),0.5000,822, + Iarg_facet ((1,true),0.5000,752, + Iarg_facet ((2,true),0.5000,1036, + Iarg_leaf 1287)))), + Iarg_facet ((3,false),0.7098,836, + Iarg_leaf 1410))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_facet ((3,true),0.9983,1447, + Iarg_leaf 1410), + Iarg_facet ((3,true),0.9979,1368, + Iarg_leaf 1443)), + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((5,true),0.5000,1956, + Iarg_facet ((4,false),0.5000,1397, + Iarg_leaf 1507)), + Iarg_facet ((5,false),0.5000,802, + Iarg_leaf 1919)), + Iarg_facet ((3,true),0.5000,1778, + Iarg_facet ((5,false),0.5000,1340, + Iarg_leaf 1444))), + Iarg_facet ((2,true),0.5000,1702, + Iarg_facet ((3,true),0.5000,1409, + Iarg_leaf 1809))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1359, + Iarg_bisect (3, + Iarg_facet ((5,true),0.5000,1466, + Iarg_leaf 1647), + Iarg_facet ((5,false),0.7483,1118, + Iarg_leaf 923))), + Iarg_facet ((2,true),0.7142,957, + Iarg_leaf 1206))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1950, + Iarg_facet ((5,true),0.5000,1511, + Iarg_leaf 1775)), + Iarg_facet ((3,true),0.5000,1777, + Iarg_facet ((5,false),0.5000,1102, + Iarg_leaf 1114))), + Iarg_facet ((2,true),0.5000,1918, + Iarg_facet ((3,true),0.5000,1253, + Iarg_leaf 1752))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1799, + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,1421, + Iarg_leaf 1501), + Iarg_facet ((5,false),0.7382,725, + Iarg_leaf 949))), + Iarg_facet ((2,true),0.5000,1011, + Iarg_facet ((3,true),0.5000,900, + Iarg_leaf 1309))))), + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1489, + Iarg_facet ((2,true),0.5000,1889, + Iarg_facet ((3,false),0.5000,1495, + Iarg_leaf 1617))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1904, + Iarg_facet ((4,true),0.5000,1000, + Iarg_leaf 1201)), + Iarg_facet ((3,false),0.5000,869, + Iarg_leaf 1170)), + Iarg_facet ((2,true),0.5000,1289, + Iarg_facet ((3,false),0.5000,1228, + Iarg_leaf 1646)))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1319, + Iarg_facet ((2,true),0.5000,1482, + Iarg_facet ((3,false),0.5000,984, + Iarg_leaf 1246))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1778, + Iarg_facet ((4,true),0.5000,1016, + Iarg_leaf 1054)), + Iarg_facet ((3,false),0.5000,1012, + Iarg_leaf 1047)), + Iarg_facet ((2,true),0.5000,1457, + Iarg_facet ((3,false),0.5000,1328, + Iarg_leaf 1512)))))), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_facet ((0,true),0.5000,1210, + Iarg_leaf 1594), + Iarg_facet ((0,true),0.5000,1171, + Iarg_leaf 1468)), + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5529,1077, + Iarg_facet ((2,true),0.5000,1855, + Iarg_leaf 1868)), + Iarg_bisect (1, + Iarg_facet ((2,false),0.6014,1147, + Iarg_leaf 1605), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5555,857, + Iarg_facet ((4,true),0.5000,1053, + Iarg_leaf 1232)), + Iarg_facet ((3,false),0.5000,915, + Iarg_leaf 1792)))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5507,779, + Iarg_facet ((2,false),0.5000,1441, + Iarg_leaf 1624)), + Iarg_facet ((1,false),0.5000,1960, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5915,1190, + Iarg_leaf 1677), + Iarg_facet ((3,false),0.5000,876, + Iarg_leaf 1131)))))))), + Iarg_facet ((5,false),0.5000,723, + Iarg_bisect (3, + Iarg_facet ((4,true),0.6325,764, + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1970, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1397, + Iarg_leaf 1475), + Iarg_facet ((2,false),0.5000,907, + Iarg_leaf 1177))), + Iarg_facet ((0,false),0.5000,758, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1093, + Iarg_leaf 1131), + Iarg_facet ((2,true),0.5000,1080, + Iarg_leaf 1202))))), + Iarg_facet ((4,true),0.6740,1292, + Iarg_facet ((5,false),0.5000,1041, + Iarg_facet ((0,false),0.5000,833, + Iarg_facet ((1,false),0.5000,969, + Iarg_leaf 1908)))))))));; + +add_case ("7550003505 1 2 3", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.7492,878, + Iarg_facet ((1,true),0.6366,875, + Iarg_leaf 1632)), + Iarg_facet ((0,true),0.7492,872, + Iarg_leaf 1440)), + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1879, + Iarg_facet ((1,true),0.5000,1685, + Iarg_facet ((2,true),0.5000,1148, + Iarg_facet ((3,false),0.5000,1518, + Iarg_leaf 1621)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,792, + Iarg_facet ((3,false),0.5000,1101, + Iarg_leaf 1292)), + Iarg_facet ((2,true),0.7344,941, + Iarg_leaf 1102)), + Iarg_facet ((1,true),0.5000,890, + Iarg_facet ((2,true),0.7281,752, + Iarg_leaf 1608))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.8155,1001, + Iarg_leaf 1641), + Iarg_facet ((0,true),0.7299,795, + Iarg_facet ((1,false),0.5000,798, + Iarg_leaf 1478))), + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1887, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1521, + Iarg_leaf 1658), + Iarg_facet ((3,false),0.5000,1021, + Iarg_leaf 1025)), + Iarg_facet ((2,true),0.5000,797, + Iarg_leaf 1479))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1445, + Iarg_facet ((3,true),0.5000,1234, + Iarg_leaf 1541)), + Iarg_facet ((2,true),0.5000,974, + Iarg_facet ((3,false),0.5000,996, + Iarg_leaf 1219))), + Iarg_facet ((1,true),0.5000,1080, + Iarg_leaf 1981))))), + Iarg_facet ((5,true),0.7433,954, + Iarg_facet ((3,false),0.5000,1650, + Iarg_facet ((4,false),0.7057,1183, + Iarg_leaf 1532)))), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1902, + Iarg_facet ((4,true),0.5000,1132, + Iarg_facet ((3,true),0.5000,923, + Iarg_leaf 1128))), + Iarg_facet ((2,true),0.6345,1004, + Iarg_leaf 1440)), + Iarg_facet ((1,true),0.5000,786, + Iarg_facet ((2,true),0.5000,916, + Iarg_leaf 1807))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1327, + Iarg_facet ((4,true),0.5000,952, + Iarg_leaf 1435)), + Iarg_facet ((2,true),0.5000,821, + Iarg_facet ((4,true),0.5000,823, + Iarg_leaf 1499))), + Iarg_facet ((1,true),0.5000,1373, + Iarg_facet ((2,true),0.5000,1034, + Iarg_facet ((4,true),0.5000,1041, + Iarg_leaf 1059))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1967, + Iarg_facet ((4,true),0.5000,1063, + Iarg_leaf 1770)), + Iarg_facet ((2,true),0.5000,988, + Iarg_facet ((4,true),0.5000,794, + Iarg_leaf 1385))), + Iarg_facet ((1,true),0.5000,1110, + Iarg_facet ((2,true),0.5000,989, + Iarg_leaf 1592))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1718, + Iarg_facet ((4,true),0.5000,806, + Iarg_leaf 1397)), + Iarg_facet ((2,true),0.5000,1246, + Iarg_leaf 1782)), + Iarg_facet ((1,true),0.5000,1861, + Iarg_facet ((2,true),0.5000,1764, + Iarg_facet ((4,true),0.5000,1030, + Iarg_leaf 1197)))))), + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,753, + Iarg_leaf 1402), + Iarg_facet ((1,true),0.5000,720, + Iarg_leaf 1817)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,977, + Iarg_leaf 1350), + Iarg_facet ((1,true),0.5000,1052, + Iarg_facet ((2,true),0.5000,947, + Iarg_leaf 1111)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,883, + Iarg_leaf 1358), + Iarg_facet ((1,true),0.5000,988, + Iarg_leaf 1932)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1009, + Iarg_leaf 1205), + Iarg_facet ((1,true),0.5000,1242, + Iarg_facet ((2,false),0.5000,1056, + Iarg_leaf 1117)))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.6959,1133, + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,912, + Iarg_leaf 1785), + Iarg_facet ((0,false),0.5000,962, + Iarg_facet ((1,true),0.5000,1289, + Iarg_leaf 1357)))), + Iarg_facet ((5,true),0.7498,1016, + Iarg_facet ((3,false),0.5000,1540, + Iarg_leaf 1632))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.7492,919, + Iarg_facet ((1,true),0.5000,751, + Iarg_leaf 1415)), + Iarg_facet ((0,true),0.7846,722, + Iarg_leaf 1241)), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1452, + Iarg_facet ((3,false),0.5000,1834, + Iarg_facet ((4,false),0.5000,1287, + Iarg_leaf 1556))), + Iarg_facet ((2,true),0.5000,833, + Iarg_leaf 1469)), + Iarg_facet ((1,true),0.6169,997, + Iarg_facet ((2,true),0.7310,717, + Iarg_facet ((3,false),0.5000,853, + Iarg_leaf 1580)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1226, + Iarg_facet ((3,false),0.5000,1365, + Iarg_leaf 1554)), + Iarg_facet ((2,true),0.5000,1436, + Iarg_leaf 1956)), + Iarg_facet ((1,true),0.5000,1022, + Iarg_leaf 1856)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.6242,1122, + Iarg_facet ((1,true),0.5000,1833, + Iarg_facet ((2,true),0.8222,828, + Iarg_facet ((3,false),0.5000,900, + Iarg_facet ((4,false),0.5000,838, + Iarg_facet ((5,true),0.5000,851, + Iarg_leaf 1187)))))), + Iarg_facet ((0,true),0.7492,1234, + Iarg_leaf 1732)), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1488, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1016, + Iarg_leaf 1235), + Iarg_facet ((5,true),0.5000,1227, + Iarg_leaf 1520)), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1984, + Iarg_facet ((0,false),0.5000,1361, + Iarg_leaf 1484)), + Iarg_facet ((5,true),0.5000,1718, + Iarg_facet ((0,false),0.5000,1302, + Iarg_leaf 1598))))), + Iarg_facet ((2,true),0.5000,807, + Iarg_facet ((3,false),0.5000,1237, + Iarg_facet ((4,true),0.5000,899, + Iarg_leaf 1139)))), + Iarg_facet ((1,true),0.5000,1923, + Iarg_facet ((2,true),0.6506,873, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,806, + Iarg_leaf 1858), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,798, + Iarg_leaf 1158), + Iarg_facet ((5,true),0.5000,1743, + Iarg_facet ((1,true),0.5000,1035, + Iarg_facet ((0,false),0.5000,780, + Iarg_leaf 1593)))))))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,957, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,952, + Iarg_leaf 1156), + Iarg_facet ((4,true),0.5000,1325, + Iarg_leaf 1528))), + Iarg_facet ((2,true),0.5000,927, + Iarg_facet ((3,false),0.5000,943, + Iarg_leaf 1405))), + Iarg_facet ((1,true),0.5000,1722, + Iarg_facet ((2,true),0.7951,1078, + Iarg_facet ((3,false),0.5000,1096, + Iarg_facet ((4,false),0.5000,1298, + Iarg_facet ((5,true),0.5000,938, + Iarg_leaf 1275))))))))), + Iarg_bisect (3, + Iarg_facet ((5,true),0.7910,1213, + Iarg_facet ((4,false),0.7157,968, + Iarg_leaf 1324)), + Iarg_facet ((5,true),0.8557,978, + Iarg_leaf 1583))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1846, + Iarg_facet ((3,false),0.5000,1583, + Iarg_facet ((4,true),0.5000,700, + Iarg_leaf 1513))), + Iarg_facet ((2,true),0.5000,1054, + Iarg_leaf 1876)), + Iarg_facet ((1,true),0.5000,812, + Iarg_facet ((2,true),0.5000,1055, + Iarg_facet ((3,false),0.5000,1259, + Iarg_facet ((4,true),0.5000,1006, + Iarg_leaf 1362))))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1367, + Iarg_leaf 1581), + Iarg_facet ((3,true),0.5000,993, + Iarg_leaf 1136)), + Iarg_facet ((2,true),0.5000,1493, + Iarg_leaf 1764)), + Iarg_facet ((1,true),0.5000,1828, + Iarg_facet ((2,true),0.5000,1460, + Iarg_facet ((3,false),0.5000,1245, + Iarg_leaf 1948))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1027, + Iarg_leaf 1419), + Iarg_facet ((1,true),0.5000,866, + Iarg_facet ((2,true),0.5000,845, + Iarg_leaf 1204))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,901, + Iarg_leaf 1373), + Iarg_facet ((1,true),0.5000,1281, + Iarg_facet ((2,true),0.5000,964, + Iarg_leaf 1272))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_facet ((5,true),0.5000,1106, + Iarg_leaf 1344), + Iarg_facet ((5,true),0.5000,1358, + Iarg_facet ((0,false),0.5000,835, + Iarg_leaf 1384))), + Iarg_facet ((3,false),0.5000,981, + Iarg_leaf 1412)), + Iarg_facet ((4,false),0.5000,1421, + Iarg_leaf 1463)), + Iarg_facet ((2,true),0.5000,924, + Iarg_facet ((4,true),0.5738,1224, + Iarg_leaf 1422))), + Iarg_facet ((1,true),0.5000,1954, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_facet ((5,true),0.5000,1108, + Iarg_leaf 1386), + Iarg_bisect (5, + Iarg_facet ((1,true),0.5000,921, + Iarg_facet ((2,true),0.6575,801, + Iarg_leaf 1778)), + Iarg_facet ((1,true),0.6501,1057, + Iarg_leaf 1227))), + Iarg_facet ((3,false),0.5000,1924, + Iarg_bisect (5, + Iarg_facet ((1,true),0.7960,1219, + Iarg_leaf 1463), + Iarg_facet ((1,true),0.6801,739, + Iarg_leaf 1864)))), + Iarg_facet ((4,false),0.5000,914, + Iarg_leaf 1233)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1934, + Iarg_facet ((4,true),0.5000,1324, + Iarg_facet ((3,true),0.5000,1082, + Iarg_leaf 1116))), + Iarg_facet ((2,true),0.5000,930, + Iarg_facet ((4,true),0.5000,751, + Iarg_leaf 1594))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1056, + Iarg_bisect (4, + Iarg_facet ((3,false),0.5000,1554, + Iarg_facet ((5,true),0.5000,1239, + Iarg_leaf 1931)), + Iarg_facet ((3,false),0.5000,1862, + Iarg_facet ((5,true),0.5000,1048, + Iarg_leaf 1634)))), + Iarg_facet ((2,true),0.6601,879, + Iarg_leaf 1542)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,855, + Iarg_leaf 1627), + Iarg_facet ((1,true),0.5000,998, + Iarg_facet ((2,true),0.5000,1818, + Iarg_facet ((3,false),0.5000,855, + Iarg_leaf 1490)))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,844, + Iarg_leaf 1444), + Iarg_facet ((1,true),0.5000,1354, + Iarg_facet ((2,true),0.5000,1456, + Iarg_facet ((3,false),0.5000,987, + Iarg_leaf 1322))))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.7465,898, + Iarg_facet ((0,false),0.5000,1081, + Iarg_facet ((1,true),0.5000,1154, + Iarg_leaf 1207))), + Iarg_facet ((5,true),0.8163,1286, + Iarg_leaf 1405)), + Iarg_bisect (4, + Iarg_facet ((5,true),0.7629,802, + Iarg_facet ((0,false),0.5000,1327, + Iarg_facet ((1,true),0.5000,931, + Iarg_leaf 1805))), + Iarg_facet ((5,true),0.8236,1253, + Iarg_leaf 1375)))))));; + +add_case ("9225295803", + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1762, + Iarg_facet ((2,true),0.5000,1044, + Iarg_leaf 1582)), + Iarg_facet ((1,true),0.5000,1181, + Iarg_leaf 1761)), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1760, + Iarg_facet ((2,true),0.6635,827, + Iarg_leaf 1295)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.6656,823, + Iarg_leaf 1272), + Iarg_facet ((2,true),0.6838,864, + Iarg_leaf 1507)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1115, + Iarg_facet ((2,false),0.5000,1303, + Iarg_leaf 1666)), + Iarg_facet ((1,true),0.5000,1030, + Iarg_facet ((2,false),0.5000,1649, + Iarg_leaf 1946))), + Iarg_facet ((0,false),0.5000,1090, + Iarg_leaf 1437))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1330, + Iarg_leaf 1661), + Iarg_facet ((2,false),0.5000,1662, + Iarg_leaf 1952)), + Iarg_facet ((1,true),0.5000,1063, + Iarg_leaf 1133)), + Iarg_facet ((0,true),0.5000,1168, + Iarg_leaf 1557)), + Iarg_facet ((5,true),0.5000,1018, + Iarg_facet ((0,true),0.5000,1213, + Iarg_leaf 1679)))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1487, + Iarg_facet ((0,true),0.5000,1243, + Iarg_leaf 1932)), + Iarg_facet ((5,true),0.5000,1406, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,950, + Iarg_facet ((2,true),0.5000,1288, + Iarg_leaf 1624)), + Iarg_facet ((1,true),0.5000,813, + Iarg_facet ((2,true),0.5000,1248, + Iarg_leaf 1819))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1451, + Iarg_facet ((0,true),0.5000,1751, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1231, + Iarg_leaf 1599), + Iarg_facet ((2,true),0.5000,1239, + Iarg_leaf 1795)))), + Iarg_facet ((5,true),0.5000,764, + Iarg_facet ((0,true),0.5000,1862, + Iarg_facet ((1,true),0.5000,1165, + Iarg_leaf 1635)))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1250, + Iarg_leaf 1852), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1620, + Iarg_facet ((2,true),0.6871,833, + Iarg_leaf 1190)), + Iarg_facet ((1,true),0.5000,1568, + Iarg_facet ((2,true),0.6803,776, + Iarg_leaf 1427)))), + Iarg_facet ((5,true),0.5000,1403, + Iarg_leaf 1491)), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1622, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1568, + Iarg_leaf 1777), + Iarg_facet ((2,false),0.5000,1191, + Iarg_leaf 1208))), + Iarg_facet ((0,true),0.5000,1687, + Iarg_facet ((1,false),0.5000,1153, + Iarg_leaf 1406))), + Iarg_facet ((5,true),0.5000,779, + Iarg_leaf 1455))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1856, + Iarg_facet ((5,true),0.5000,1201, + Iarg_leaf 1332)), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1783, + Iarg_facet ((0,true),0.5000,1122, + Iarg_facet ((1,true),0.5000,1643, + Iarg_facet ((2,true),0.5000,985, + Iarg_leaf 1510)))), + Iarg_facet ((5,true),0.6329,963, + Iarg_leaf 1429))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1218, + Iarg_leaf 1876), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1987, + Iarg_facet ((2,true),0.7038,835, + Iarg_leaf 1329)), + Iarg_facet ((1,true),0.5000,1535, + Iarg_leaf 1590))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,868, + Iarg_facet ((2,false),0.5000,1582, + Iarg_leaf 1772)), + Iarg_facet ((1,true),0.5000,706, + Iarg_facet ((2,false),0.5000,1195, + Iarg_leaf 1204))), + Iarg_facet ((0,false),0.5000,1846, + Iarg_facet ((1,true),0.5000,891, + Iarg_leaf 1405)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1443, + Iarg_leaf 1553), + Iarg_facet ((5,true),0.5000,784, + Iarg_leaf 1439))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1166, + Iarg_leaf 1341), + Iarg_facet ((5,true),0.5000,1706, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6277,967, + Iarg_facet ((2,true),0.5000,881, + Iarg_leaf 1334)), + Iarg_facet ((1,true),0.6704,841, + Iarg_leaf 1329)))), + Iarg_facet ((4,false),0.5000,1865, + Iarg_facet ((5,true),0.6332,965, + Iarg_leaf 1464)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1344, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1279, + Iarg_leaf 1839), + Iarg_facet ((1,true),0.5000,904, + Iarg_leaf 1264))), + Iarg_facet ((5,false),0.5000,1163, + Iarg_leaf 1721)), + Iarg_facet ((4,true),0.5000,1263, + Iarg_facet ((5,false),0.5000,1213, + Iarg_leaf 1825))), + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1411, + Iarg_leaf 1433), + Iarg_facet ((4,true),0.5000,1114, + Iarg_leaf 1430))))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1969, + Iarg_facet ((5,true),0.5000,774, + Iarg_facet ((0,true),0.5000,1594, + Iarg_leaf 1964))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,747, + Iarg_facet ((0,true),0.5000,1005, + Iarg_facet ((1,true),0.5000,1156, + Iarg_leaf 1374))), + Iarg_facet ((5,true),0.6454,947, + Iarg_facet ((0,true),0.5000,1470, + Iarg_facet ((1,true),0.5000,954, + Iarg_leaf 1581))))), + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1070, + Iarg_leaf 1976), + Iarg_facet ((4,false),0.5000,1925, + Iarg_facet ((5,true),0.6843,761, + Iarg_facet ((0,true),0.5000,808, + Iarg_leaf 1357))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1085, + Iarg_leaf 1162), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,769, + Iarg_facet ((0,true),0.6523,870, + Iarg_leaf 1272)), + Iarg_facet ((5,true),0.6450,711, + Iarg_leaf 1310))), + Iarg_facet ((3,false),0.5000,1314, + Iarg_facet ((4,false),0.5000,1232, + Iarg_leaf 1349)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1075, + Iarg_facet ((5,true),0.5000,769, + Iarg_facet ((0,true),0.5000,917, + Iarg_leaf 1225))), + Iarg_facet ((4,false),0.5000,1160, + Iarg_facet ((5,true),0.6795,756, + Iarg_leaf 1280))), + Iarg_facet ((3,false),0.5000,1909, + Iarg_facet ((4,false),0.6172,973, + Iarg_leaf 1121))), + Iarg_facet ((2,true),0.5000,1529, + Iarg_facet ((3,false),0.5000,1340, + Iarg_leaf 1604))))), + Iarg_bisect (2, + Iarg_bisect (0, + Iarg_bisect (2, + Iarg_bisect (1, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1373, + Iarg_facet ((5,false),0.5000,1363, + Iarg_facet ((0,true),0.5000,1612, + Iarg_leaf 1932))), + Iarg_facet ((4,true),0.5000,1334, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,980, + Iarg_facet ((1,true),0.5000,917, + Iarg_leaf 1492)), + Iarg_facet ((0,true),0.5000,1676, + Iarg_facet ((1,true),0.5000,1277, + Iarg_leaf 1447))))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,822, + Iarg_facet ((5,false),0.6302,939, + Iarg_leaf 1224)), + Iarg_facet ((4,true),0.5000,826, + Iarg_facet ((5,false),0.5000,1425, + Iarg_facet ((0,true),0.5000,1021, + Iarg_leaf 1596))))), + Iarg_bisect (1, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,835, + Iarg_leaf 1459), + Iarg_facet ((4,true),0.5000,1231, + Iarg_facet ((5,true),0.5000,1642, + Iarg_facet ((0,true),0.6521,855, + Iarg_leaf 1246)))), + Iarg_facet ((3,false),0.5000,1354, + Iarg_facet ((4,true),0.6258,980, + Iarg_leaf 1620)))), + Iarg_bisect (2, + Iarg_bisect (1, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1204, + Iarg_facet ((5,false),0.6307,958, + Iarg_leaf 1819)), + Iarg_facet ((4,true),0.5000,805, + Iarg_facet ((5,false),0.5000,799, + Iarg_leaf 1693))), + Iarg_facet ((3,false),0.5000,1911, + Iarg_facet ((4,true),0.6606,878, + Iarg_leaf 1213))), + Iarg_facet ((1,true),0.5000,1553, + Iarg_facet ((3,false),0.5000,1376, + Iarg_leaf 1630)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1092, + Iarg_facet ((4,true),0.5000,951, + Iarg_leaf 1711)), + Iarg_facet ((3,false),0.6364,899, + Iarg_leaf 1148)), + Iarg_facet ((2,true),0.5000,1163, + Iarg_facet ((3,false),0.6580,953, + Iarg_leaf 1120))), + Iarg_facet ((1,true),0.5000,1513, + Iarg_facet ((2,true),0.5000,880, + Iarg_leaf 1478))))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (0, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1346, + Iarg_facet ((0,true),0.5000,1355, + Iarg_facet ((1,true),0.5000,962, + Iarg_leaf 1121))), + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1301, + Iarg_facet ((1,true),0.6542,866, + Iarg_leaf 1236)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,890, + Iarg_leaf 1466), + Iarg_facet ((1,true),0.5000,759, + Iarg_leaf 1296)))), + Iarg_facet ((4,true),0.5000,1332, + Iarg_leaf 1374)), + Iarg_facet ((3,true),0.5000,1606, + Iarg_bisect (4, + Iarg_facet ((5,false),0.6302,924, + Iarg_leaf 1168), + Iarg_facet ((5,false),0.5000,1404, + Iarg_facet ((1,true),0.5000,967, + Iarg_leaf 1540))))), + Iarg_bisect (0, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1455, + Iarg_facet ((5,true),0.5000,1594, + Iarg_facet ((0,true),0.5000,803, + Iarg_leaf 1277))), + Iarg_facet ((4,false),0.5000,834, + Iarg_leaf 1240)), + Iarg_facet ((3,true),0.5000,1111, + Iarg_facet ((4,false),0.5000,841, + Iarg_leaf 1903)))), + Iarg_bisect (2, + Iarg_bisect (0, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.6277,974, + Iarg_leaf 1784), + Iarg_facet ((5,false),0.5000,798, + Iarg_leaf 1605)), + Iarg_facet ((4,true),0.5000,843, + Iarg_leaf 1211)), + Iarg_facet ((3,true),0.5000,1124, + Iarg_facet ((4,false),0.5000,1229, + Iarg_leaf 1536))), + Iarg_facet ((0,true),0.5000,1608, + Iarg_facet ((3,true),0.5000,1141, + Iarg_leaf 1902)))), + Iarg_bisect (1, + Iarg_bisect (0, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1450, + Iarg_facet ((4,false),0.6364,912, + Iarg_leaf 1449)), + Iarg_facet ((3,true),0.5000,924, + Iarg_leaf 1130)), + Iarg_facet ((2,true),0.5000,1192, + Iarg_facet ((3,true),0.5000,763, + Iarg_leaf 1321))), + Iarg_facet ((0,true),0.5000,1525, + Iarg_facet ((2,true),0.5000,886, + Iarg_leaf 1528)))), + Iarg_bisect (2, + Iarg_bisect (2, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((3,true),0.5000,1466, + Iarg_facet ((4,true),0.5000,963, + Iarg_leaf 1404)), + Iarg_facet ((3,true),0.5000,947, + Iarg_leaf 1147)), + Iarg_facet ((1,true),0.5000,1236, + Iarg_facet ((3,true),0.5000,772, + Iarg_leaf 1356))), + Iarg_facet ((0,true),0.5000,1514, + Iarg_facet ((1,true),0.5000,919, + Iarg_leaf 1525))), + Iarg_facet ((0,true),0.5000,1746, + Iarg_facet ((1,true),0.5000,1021, + Iarg_leaf 1545))))));; + +add_case ("7550003505 0 0 3", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1235, + Iarg_leaf 1736), + Iarg_facet ((5,false),0.5000,1325, + Iarg_facet ((0,true),0.5000,1780, + Iarg_facet ((1,true),0.8178,952, + Iarg_leaf 1323)))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.6300,746, + Iarg_facet ((0,true),0.7492,954, + Iarg_facet ((1,true),0.5000,1153, + Iarg_leaf 1162))), + Iarg_facet ((5,false),0.5487,848, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1615, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1655, + Iarg_leaf 1792), + Iarg_facet ((4,false),0.5000,1302, + Iarg_leaf 1728))), + Iarg_facet ((2,true),0.7170,928, + Iarg_leaf 1495)), + Iarg_facet ((1,true),0.6986,1209, + Iarg_leaf 1677))))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1145, + Iarg_facet ((0,true),0.5000,1399, + Iarg_facet ((1,true),0.8155,881, + Iarg_leaf 1771))), + Iarg_bisect (4, + Iarg_facet ((0,true),0.6975,713, + Iarg_facet ((1,true),0.5000,1381, + Iarg_facet ((2,true),0.7492,810, + Iarg_facet ((5,true),0.5000,807, + Iarg_leaf 1585)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1060, + Iarg_leaf 1270), + Iarg_facet ((4,false),0.5000,1348, + Iarg_leaf 1683)), + Iarg_facet ((3,false),0.5000,1567, + Iarg_facet ((4,false),0.5000,931, + Iarg_leaf 1150))), + Iarg_facet ((5,true),0.5000,951, + Iarg_leaf 1072)), + Iarg_facet ((2,true),0.7198,1171, + Iarg_facet ((5,false),0.5000,1086, + Iarg_leaf 1099))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.7009,827, + Iarg_facet ((5,false),0.5000,1196, + Iarg_leaf 1285)), + Iarg_facet ((2,true),0.8148,780, + Iarg_leaf 1207))))), + Iarg_facet ((3,false),0.5000,889, + Iarg_facet ((4,false),0.5000,903, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,811, + Iarg_leaf 1822), + Iarg_facet ((1,true),0.5000,1505, + Iarg_leaf 1947)))))), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_facet ((5,false),0.6356,1177, + Iarg_facet ((0,true),0.5000,1235, + Iarg_leaf 1380)), + Iarg_facet ((5,false),0.5636,861, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1487, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1639, + Iarg_facet ((3,false),0.5000,1804, + Iarg_leaf 1832)), + Iarg_facet ((4,false),0.5000,1029, + Iarg_leaf 1045))), + Iarg_facet ((1,true),0.6236,984, + Iarg_facet ((2,true),0.5000,1483, + Iarg_leaf 1964))))), + Iarg_facet ((3,false),0.6494,1162, + Iarg_facet ((5,false),0.8481,1074, + Iarg_leaf 1057))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1909, + Iarg_facet ((1,true),0.8084,831, + Iarg_leaf 1873)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,1381, + Iarg_leaf 1689), + Iarg_facet ((3,false),0.5000,993, + Iarg_leaf 1220)), + Iarg_facet ((5,true),0.5000,1256, + Iarg_leaf 1451)), + Iarg_facet ((4,false),0.5000,1726, + Iarg_leaf 1948)), + Iarg_facet ((2,true),0.7936,1181, + Iarg_leaf 1226)), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1458, + Iarg_leaf 1554), + Iarg_facet ((5,false),0.5000,1452, + Iarg_leaf 1822)), + Iarg_facet ((4,false),0.5000,992, + Iarg_leaf 1119)), + Iarg_facet ((2,true),0.7116,1181, + Iarg_leaf 1397)))), + Iarg_facet ((3,false),0.5000,1295, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1123, + Iarg_leaf 1951), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1092, + Iarg_facet ((4,false),0.5000,1606, + Iarg_leaf 1964)), + Iarg_facet ((2,true),0.7482,896, + Iarg_leaf 1385))))), + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,1013, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6704,871, + Iarg_leaf 1818), + Iarg_facet ((1,true),0.5000,842, + Iarg_facet ((2,true),0.5000,1606, + Iarg_facet ((5,false),0.5000,1078, + Iarg_leaf 1250))))), + Iarg_facet ((3,false),0.6664,950, + Iarg_facet ((0,false),0.6873,774, + Iarg_leaf 1914)))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.9979,1356, + Iarg_facet ((4,false),0.7297,909, + Iarg_leaf 874)), + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_facet ((0,true),0.6518,931, + Iarg_facet ((1,true),0.5000,1247, + Iarg_facet ((2,true),0.7983,1257, + Iarg_facet ((3,true),0.5000,725, + Iarg_leaf 1443)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_facet ((4,false),0.5000,1720, + Iarg_leaf 1917), + Iarg_facet ((4,false),0.5000,1196, + Iarg_leaf 1347)), + Iarg_facet ((5,false),0.5000,968, + Iarg_facet ((4,false),0.5000,1016, + Iarg_leaf 1081))), + Iarg_facet ((3,true),0.5000,1408, + Iarg_leaf 1691)), + Iarg_facet ((2,true),0.5000,1735, + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,1304, + Iarg_leaf 1440), + Iarg_facet ((5,false),0.7481,1147, + Iarg_leaf 1019)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.7150,777, + Iarg_facet ((3,true),0.5000,875, + Iarg_leaf 1782)), + Iarg_facet ((2,true),0.7161,777, + Iarg_leaf 1321)))), + Iarg_facet ((4,false),0.5000,1605, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1302, + Iarg_facet ((2,true),0.5000,1119, + Iarg_facet ((3,false),0.5000,1532, + Iarg_facet ((4,false),0.5000,892, + Iarg_leaf 1186)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.7178,766, + Iarg_facet ((3,true),0.5000,974, + Iarg_leaf 1172)), + Iarg_facet ((2,true),0.7892,980, + Iarg_leaf 1358))))), + Iarg_bisect (5, + Iarg_facet ((4,false),0.6480,881, + Iarg_leaf 1624), + Iarg_facet ((4,false),0.5000,973, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5549,841, + Iarg_facet ((2,true),0.5000,1114, + Iarg_facet ((3,true),0.7041,862, + Iarg_leaf 1138))), + Iarg_facet ((1,false),0.7026,1023, + Iarg_leaf 1191)))))), + Iarg_bisect (5, + Iarg_facet ((4,true),0.5000,1095, + Iarg_facet ((3,true),0.9979,1482, + Iarg_leaf 1812)), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1755, + Iarg_facet ((5,true),0.5000,1309, + Iarg_leaf 1898)), + Iarg_facet ((4,true),0.5000,918, + Iarg_leaf 1492)), + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1503, + Iarg_leaf 1774), + Iarg_facet ((4,false),0.5000,1204, + Iarg_leaf 1504))), + Iarg_facet ((2,true),0.5000,1989, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,772, + Iarg_leaf 1661), + Iarg_facet ((4,true),0.5000,852, + Iarg_leaf 1613)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,968, + Iarg_leaf 1146), + Iarg_facet ((5,false),0.5000,1061, + Iarg_leaf 1394)), + Iarg_facet ((4,false),0.5000,1383, + Iarg_leaf 1665)), + Iarg_facet ((3,true),0.5000,1054, + Iarg_leaf 1367)), + Iarg_facet ((2,true),0.5000,1739, + Iarg_facet ((3,true),0.5000,1011, + Iarg_leaf 1244)))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1524, + Iarg_facet ((2,true),0.5000,1650, + Iarg_facet ((3,false),0.5000,1683, + Iarg_facet ((4,true),0.5000,908, + Iarg_leaf 1503)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1862, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1236, + Iarg_leaf 1550), + Iarg_facet ((4,false),0.5000,1291, + Iarg_leaf 1446))), + Iarg_facet ((2,true),0.5000,1802, + Iarg_facet ((3,false),0.5000,1988, + Iarg_facet ((4,false),0.5000,1159, + Iarg_leaf 1531)))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1448, + Iarg_facet ((2,false),0.7132,1077, + Iarg_leaf 1868)), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1206, + Iarg_leaf 1655), + Iarg_facet ((3,true),0.5000,1480, + Iarg_leaf 1600)), + Iarg_facet ((2,false),0.5000,1036, + Iarg_leaf 1134))), + Iarg_facet ((0,false),0.5000,1857, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1045, + Iarg_leaf 1079), + Iarg_facet ((3,false),0.5000,1008, + Iarg_leaf 1376)), + Iarg_facet ((2,true),0.5000,1760, + Iarg_leaf 1985))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1726, + Iarg_facet ((1,false),0.5000,906, + Iarg_leaf 1389)), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5552,1087, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1030, + Iarg_leaf 1586), + Iarg_facet ((4,false),0.5000,921, + Iarg_leaf 1156))), + Iarg_bisect (1, + Iarg_facet ((2,false),0.6537,1162, + Iarg_leaf 1210), + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1419, + Iarg_leaf 1841), + Iarg_facet ((4,false),0.5000,968, + Iarg_leaf 1301))))), + Iarg_facet ((5,false),0.5000,1725, + Iarg_facet ((0,false),0.5000,1869, + Iarg_bisect (1, + Iarg_facet ((2,false),0.6034,823, + Iarg_leaf 1554), + Iarg_facet ((2,false),0.5000,1552, + Iarg_facet ((3,false),0.5000,1008, + Iarg_leaf 1275)))))))))));; + +add_case ("FHBVYXZ b split(1/2)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1866, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1357, + Iarg_facet ((4,true),0.5000,909, + Iarg_leaf 1489)), + Iarg_facet ((3,true),0.5000,871, + Iarg_leaf 1550))), + Iarg_facet ((1,true),0.5000,1957, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1127, + Iarg_leaf 1148), + Iarg_facet ((4,false),0.5000,1103, + Iarg_leaf 1202)), + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1115, + Iarg_leaf 1310), + Iarg_facet ((4,false),0.5000,1205, + Iarg_leaf 1865))))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.6490,891, + Iarg_leaf 1088), + Iarg_facet ((1,true),0.7475,1279, + Iarg_leaf 798))), + Iarg_facet ((5,true),0.5000,1689, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,763, + Iarg_facet ((2,true),0.5000,1121, + Iarg_leaf 1503)), + Iarg_facet ((1,true),0.5000,863, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1494, + Iarg_leaf 1843), + Iarg_facet ((3,false),0.5000,1899, + Iarg_facet ((5,true),0.9995,505, + Iarg_leaf 375))))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,955, + Iarg_facet ((2,true),0.5000,1178, + Iarg_leaf 1623)), + Iarg_facet ((1,true),0.5000,1154, + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1643, + Iarg_leaf 1911), + Iarg_facet ((4,false),0.5000,1901, + Iarg_facet ((5,true),0.9992,546, + Iarg_leaf 374))))), + Iarg_facet ((0,false),0.5000,948, + Iarg_leaf 1245)), + Iarg_facet ((5,true),0.5000,1009, + Iarg_facet ((0,false),0.5000,1500, + Iarg_facet ((1,true),0.6841,778, + Iarg_leaf 1859))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1861, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,774, + Iarg_facet ((3,true),0.5000,1119, + Iarg_leaf 1641)), + Iarg_facet ((1,true),0.5000,885, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1473, + Iarg_leaf 1897), + Iarg_facet ((4,false),0.5000,1830, + Iarg_facet ((5,true),1.0000,506, + Iarg_leaf 37)))))), + Iarg_facet ((5,true),0.5000,934, + Iarg_facet ((0,false),0.5000,1487, + Iarg_facet ((1,true),0.7591,1244, + Iarg_facet ((3,true),0.7313,900, + Iarg_leaf 1611))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1021, + Iarg_facet ((0,false),0.5000,1503, + Iarg_facet ((1,true),0.6795,761, + Iarg_facet ((4,true),0.6917,1199, + Iarg_leaf 763)))), + Iarg_facet ((5,true),0.5000,735, + Iarg_facet ((0,false),0.5000,777, + Iarg_facet ((1,true),0.9286,771, + Iarg_leaf 121)))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1168, + Iarg_facet ((0,true),0.5000,1919, + Iarg_facet ((2,true),0.5000,830, + Iarg_leaf 1139))), + Iarg_facet ((5,true),0.5000,708, + Iarg_leaf 1745)), + Iarg_facet ((4,true),0.5000,1625, + Iarg_facet ((5,true),0.5000,771, + Iarg_facet ((0,false),0.5000,1022, + Iarg_leaf 1087)))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1530, + Iarg_facet ((5,true),0.5000,707, + Iarg_leaf 1634)), + Iarg_facet ((4,true),0.5000,1251, + Iarg_leaf 1602)))), + Iarg_facet ((1,true),0.5000,1310, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1814, + Iarg_facet ((4,true),0.5000,973, + Iarg_facet ((5,true),0.7959,705, + Iarg_leaf 700))), + Iarg_facet ((3,true),0.5000,1369, + Iarg_leaf 1657)))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1061, + Iarg_bisect (0, + Iarg_facet ((1,true),0.7291,983, + Iarg_leaf 1227), + Iarg_facet ((1,true),0.6631,889, + Iarg_leaf 1957))), + Iarg_facet ((5,true),0.5000,857, + Iarg_facet ((0,false),0.5000,1608, + Iarg_facet ((1,true),0.6898,805, + Iarg_facet ((2,true),0.5611,738, + Iarg_leaf 1307))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,770, + Iarg_facet ((0,false),0.5000,924, + Iarg_facet ((1,true),0.8519,847, + Iarg_leaf 168))), + Iarg_facet ((5,true),0.6157,862, + Iarg_facet ((0,false),0.5000,1639, + Iarg_leaf 1641)))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,739, + Iarg_facet ((0,false),0.5000,938, + Iarg_facet ((1,true),0.8266,928, + Iarg_leaf 216))), + Iarg_facet ((5,true),0.6177,866, + Iarg_facet ((0,true),0.5000,1749, + Iarg_leaf 1795))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.8283,1205, + Iarg_facet ((0,true),0.8778,751, + Iarg_leaf 88)), + Iarg_facet ((5,true),0.7337,887, + Iarg_facet ((0,true),0.5024,757, + Iarg_leaf 298))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1468, + Iarg_leaf 1677), + Iarg_facet ((4,true),0.5000,1162, + Iarg_leaf 1342)), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1180, + Iarg_leaf 1307), + Iarg_facet ((4,true),0.5000,987, + Iarg_leaf 1059)))), + Iarg_facet ((1,true),0.5000,1125, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1296, + Iarg_leaf 1396), + Iarg_facet ((3,true),0.5000,1022, + Iarg_leaf 1301))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,895, + Iarg_facet ((2,true),0.5000,1036, + Iarg_leaf 1412)), + Iarg_facet ((1,true),0.5000,999, + Iarg_bisect (2, + Iarg_facet ((4,false),0.5000,1332, + Iarg_leaf 1760), + Iarg_facet ((4,false),0.5000,1749, + Iarg_leaf 1990)))), + Iarg_facet ((0,false),0.5000,909, + Iarg_leaf 1100)), + Iarg_facet ((5,true),0.5000,969, + Iarg_facet ((0,false),0.5000,1284, + Iarg_facet ((1,true),0.7740,1216, + Iarg_leaf 1434)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,922, + Iarg_facet ((2,true),0.5000,1151, + Iarg_leaf 1737)), + Iarg_facet ((1,true),0.5000,1030, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1308, + Iarg_facet ((4,false),0.5000,997, + Iarg_leaf 1073)), + Iarg_facet ((3,false),0.5000,1509, + Iarg_facet ((4,false),0.5000,1079, + Iarg_leaf 1237))))), + Iarg_facet ((0,false),0.5000,931, + Iarg_leaf 1101)), + Iarg_facet ((5,true),0.5000,997, + Iarg_facet ((0,false),0.5000,1349, + Iarg_facet ((1,true),0.7681,1144, + Iarg_leaf 1717))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,982, + Iarg_facet ((0,false),0.5000,1350, + Iarg_facet ((1,true),0.6827,715, + Iarg_leaf 1545))), + Iarg_facet ((5,true),0.6206,845, + Iarg_facet ((0,false),0.5000,1490, + Iarg_leaf 1661))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,997, + Iarg_facet ((0,false),0.5000,1397, + Iarg_facet ((1,true),0.7289,897, + Iarg_leaf 1152))), + Iarg_facet ((5,true),0.5000,723, + Iarg_facet ((0,false),0.5000,780, + Iarg_facet ((1,true),0.9828,908, + Iarg_leaf 104)))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1568, + Iarg_facet ((5,true),0.5000,727, + Iarg_facet ((0,false),0.5000,998, + Iarg_leaf 1027))), + Iarg_facet ((4,true),0.5000,1595, + Iarg_facet ((5,true),0.5000,772, + Iarg_leaf 1976))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1151, + Iarg_leaf 1556), + Iarg_facet ((4,true),0.5000,1180, + Iarg_leaf 1600)))), + Iarg_facet ((1,true),0.5000,1201, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1707, + Iarg_leaf 1737), + Iarg_facet ((3,false),0.5000,1299, + Iarg_leaf 1318)))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,725, + Iarg_facet ((0,false),0.5000,822, + Iarg_facet ((1,true),0.9554,1290, + Iarg_leaf 116))), + Iarg_facet ((5,true),0.6277,772, + Iarg_facet ((0,true),0.5000,898, + Iarg_leaf 1174))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,766, + Iarg_facet ((0,false),0.5000,861, + Iarg_facet ((1,true),0.8935,763, + Iarg_leaf 466))), + Iarg_facet ((5,true),0.6255,815, + Iarg_facet ((0,true),0.5000,854, + Iarg_leaf 1196)))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.7311,874, + Iarg_leaf 1965), + Iarg_facet ((5,true),0.7598,728, + Iarg_facet ((0,true),0.5001,1835, + Iarg_leaf 1360))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.6413,711, + Iarg_facet ((0,true),0.5336,871, + Iarg_leaf 737)), + Iarg_facet ((5,true),0.9004,945, + Iarg_leaf 559)))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1049, + Iarg_leaf 1245), + Iarg_facet ((4,true),0.5000,1087, + Iarg_leaf 1262)), + Iarg_facet ((3,true),0.5000,1854, + Iarg_leaf 1899))), + Iarg_facet ((1,true),0.5000,949, + Iarg_facet ((2,true),0.5000,1811, + Iarg_facet ((3,true),0.5000,1201, + Iarg_leaf 1205)))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1109, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6643,757, + Iarg_leaf 1776), + Iarg_facet ((1,true),0.6642,900, + Iarg_facet ((3,true),0.5000,728, + Iarg_leaf 1098)))), + Iarg_facet ((5,true),0.5000,757, + Iarg_facet ((0,false),0.5000,923, + Iarg_facet ((1,true),0.8505,1080, + Iarg_leaf 725)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,788, + Iarg_facet ((0,false),0.5000,931, + Iarg_facet ((1,true),0.8653,922, + Iarg_leaf 175))), + Iarg_facet ((5,true),0.6372,768, + Iarg_facet ((0,true),0.5280,1123, + Iarg_leaf 1064)))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,883, + Iarg_facet ((0,false),0.5000,1692, + Iarg_facet ((1,true),0.6958,948, + Iarg_facet ((2,true),0.5000,1161, + Iarg_leaf 1263)))), + Iarg_facet ((5,true),0.6180,883, + Iarg_facet ((0,true),0.5000,1662, + Iarg_leaf 1724))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5929,833, + Iarg_facet ((0,false),0.5000,1536, + Iarg_leaf 1614)), + Iarg_facet ((5,true),0.6521,704, + Iarg_facet ((0,false),0.5000,1043, + Iarg_leaf 1197))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1289, + Iarg_leaf 1661), + Iarg_facet ((4,true),0.5000,1040, + Iarg_leaf 1325)), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1178, + Iarg_leaf 1450), + Iarg_facet ((4,true),0.5000,986, + Iarg_leaf 1171)))), + Iarg_facet ((1,true),0.5000,1125, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1205, + Iarg_leaf 1403), + Iarg_facet ((3,true),0.5000,1114, + Iarg_leaf 1341)))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6274,863, + Iarg_facet ((0,true),0.5000,1393, + Iarg_leaf 1479)), + Iarg_facet ((5,true),0.7928,1119, + Iarg_facet ((0,true),0.5000,978, + Iarg_leaf 1358))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.7421,803, + Iarg_leaf 1321), + Iarg_facet ((5,true),0.7706,727, + Iarg_facet ((0,true),0.5353,970, + Iarg_leaf 836)))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1830, + Iarg_facet ((5,true),0.6372,804, + Iarg_facet ((0,true),0.5000,865, + Iarg_leaf 1319))), + Iarg_facet ((4,true),0.5000,1354, + Iarg_facet ((5,true),0.7664,732, + Iarg_facet ((0,true),0.5000,1346, + Iarg_leaf 1353))))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1792, + Iarg_facet ((4,true),0.5000,1050, + Iarg_leaf 1119)), + Iarg_facet ((3,true),0.5000,1568, + Iarg_facet ((4,true),0.5000,973, + Iarg_leaf 1036)))), + Iarg_facet ((1,true),0.5000,918, + Iarg_facet ((2,true),0.5000,1885, + Iarg_facet ((3,true),0.5000,899, + Iarg_leaf 1156))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,736, + Iarg_facet ((0,false),0.5000,833, + Iarg_facet ((1,true),0.9340,1179, + Iarg_leaf 122))), + Iarg_facet ((5,true),0.6486,705, + Iarg_facet ((0,true),0.5222,839, + Iarg_leaf 250))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,747, + Iarg_facet ((0,false),0.5000,880, + Iarg_facet ((1,true),0.8942,793, + Iarg_leaf 140))), + Iarg_facet ((5,true),0.6456,717, + Iarg_facet ((0,true),0.5386,1241, + Iarg_leaf 494)))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6350,790, + Iarg_facet ((0,true),0.5000,830, + Iarg_leaf 1165)), + Iarg_facet ((5,true),0.7631,744, + Iarg_facet ((0,false),0.5000,1354, + Iarg_leaf 1794))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.6288,836, + Iarg_facet ((0,false),0.5000,1259, + Iarg_leaf 1416)), + Iarg_facet ((5,true),0.7600,762, + Iarg_facet ((0,false),0.5000,1359, + Iarg_leaf 1726))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,988, + Iarg_leaf 1229), + Iarg_facet ((4,true),0.5000,1018, + Iarg_leaf 1277)), + Iarg_facet ((3,true),0.5000,1943, + Iarg_leaf 1957))), + Iarg_facet ((1,true),0.5000,949, + Iarg_facet ((2,true),0.5000,1897, + Iarg_facet ((3,true),0.5000,1098, + Iarg_leaf 1105)))), + Iarg_bisect (5, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1989, + Iarg_facet ((5,true),0.8863,842, + Iarg_leaf 1021)), + Iarg_facet ((4,true),0.5000,1756, + Iarg_facet ((5,true),0.9361,942, + Iarg_leaf 317))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1227, + Iarg_leaf 1987), + Iarg_facet ((4,true),0.5000,1052, + Iarg_leaf 1766))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1540, + Iarg_leaf 1576), + Iarg_facet ((3,true),0.5000,1359, + Iarg_leaf 1431))), + Iarg_facet ((1,true),0.5000,834, + Iarg_facet ((2,true),0.5000,1553, + Iarg_leaf 1625)))))), + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.7768,1280, + Iarg_facet ((1,true),0.5000,1445, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1525, + Iarg_facet ((4,true),0.5000,802, + Iarg_leaf 1645)), + Iarg_facet ((3,true),0.5000,1046, + Iarg_leaf 1314)))), + Iarg_facet ((5,true),0.7405,1029, + Iarg_facet ((1,true),0.5000,893, + Iarg_facet ((2,true),0.5000,1588, + Iarg_leaf 1963)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.7403,1162, + Iarg_facet ((1,true),0.5000,975, + Iarg_facet ((2,true),0.5000,1919, + Iarg_facet ((3,false),0.5000,1281, + Iarg_leaf 1368)))), + Iarg_facet ((5,true),0.7401,939, + Iarg_facet ((1,true),0.5000,747, + Iarg_facet ((2,true),0.5000,1004, + Iarg_leaf 1619))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.7411,1025, + Iarg_facet ((1,true),0.5000,891, + Iarg_facet ((2,true),0.5000,1683, + Iarg_leaf 1846))), + Iarg_facet ((5,true),0.6711,891, + Iarg_facet ((1,true),0.5000,885, + Iarg_facet ((2,true),0.5000,1622, + Iarg_leaf 1798)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.7468,940, + Iarg_facet ((1,true),0.5000,751, + Iarg_facet ((2,true),0.5000,1136, + Iarg_leaf 1497))), + Iarg_facet ((5,true),0.7894,1292, + Iarg_facet ((1,true),0.5000,824, + Iarg_leaf 1989)))))));; + +add_case ("7550003505 0 1 2", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,795, + Iarg_facet ((1,true),0.8022,845, + Iarg_leaf 1509)), + Iarg_facet ((0,true),0.5000,844, + Iarg_leaf 1789)), + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,896, + Iarg_leaf 1176), + Iarg_facet ((0,false),0.5000,1176, + Iarg_leaf 1705))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1613, + Iarg_facet ((2,true),0.5000,1345, + Iarg_facet ((3,false),0.5000,1951, + Iarg_facet ((4,false),0.5000,1012, + Iarg_leaf 1016)))), + Iarg_facet ((1,true),0.6212,852, + Iarg_leaf 1983)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1226, + Iarg_facet ((3,false),0.5000,1857, + Iarg_leaf 1985)), + Iarg_facet ((2,true),0.6995,727, + Iarg_facet ((3,false),0.5000,927, + Iarg_leaf 1088))), + Iarg_facet ((1,true),0.5000,1004, + Iarg_facet ((2,true),0.7215,1005, + Iarg_leaf 1407)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1106, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1338, + Iarg_leaf 1365), + Iarg_facet ((3,false),0.5000,965, + Iarg_leaf 1498))), + Iarg_facet ((1,true),0.5850,896, + Iarg_facet ((2,true),0.5000,844, + Iarg_leaf 1913))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1779, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1507, + Iarg_leaf 1688), + Iarg_facet ((3,false),0.6285,866, + Iarg_leaf 979))), + Iarg_facet ((1,true),0.5000,1283, + Iarg_facet ((2,true),0.5000,1078, + Iarg_facet ((3,true),0.5000,1203, + Iarg_leaf 1390))))))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((0,true),0.5000,944, + Iarg_leaf 1819), + Iarg_facet ((0,false),0.5000,1034, + Iarg_leaf 1104)), + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1899, + Iarg_bisect (2, + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,991, + Iarg_leaf 1073), + Iarg_facet ((3,false),0.5000,1436, + Iarg_leaf 1739)), + Iarg_facet ((5,false),0.5000,1338, + Iarg_facet ((3,false),0.5000,794, + Iarg_leaf 1607)))), + Iarg_facet ((1,true),0.5000,1091, + Iarg_facet ((2,true),0.6163,910, + Iarg_leaf 1497))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1614, + Iarg_facet ((2,true),0.5000,1824, + Iarg_facet ((5,false),0.5000,1570, + Iarg_leaf 1847))), + Iarg_facet ((1,true),0.5000,1845, + Iarg_facet ((2,true),0.5000,1016, + Iarg_facet ((5,true),0.5000,1040, + Iarg_leaf 1389)))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_facet ((1,true),0.8384,1159, + Iarg_facet ((2,true),0.7007,891, + Iarg_facet ((3,false),0.5000,703, + Iarg_facet ((4,true),0.5000,1804, + Iarg_facet ((5,false),0.8229,1166, + Iarg_leaf 679))))), + Iarg_facet ((1,true),0.9284,1240, + Iarg_leaf 852)), + Iarg_facet ((0,true),0.5000,844, + Iarg_facet ((1,true),0.9374,1104, + Iarg_leaf 857))), + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1395, + Iarg_facet ((0,true),0.6544,1137, + Iarg_leaf 1615)), + Iarg_facet ((5,false),0.5000,1169, + Iarg_facet ((0,true),0.7538,929, + Iarg_leaf 1150))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1759, + Iarg_facet ((0,true),0.5000,762, + Iarg_facet ((1,true),0.7724,935, + Iarg_leaf 1056))), + Iarg_facet ((5,false),0.5000,1440, + Iarg_leaf 1969))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1414, + Iarg_leaf 1962), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1422, + Iarg_facet ((0,true),0.5000,1086, + Iarg_facet ((1,true),0.6640,791, + Iarg_facet ((2,false),0.6305,884, + Iarg_leaf 1410)))), + Iarg_facet ((5,false),0.5000,1012, + Iarg_facet ((0,true),0.6469,956, + Iarg_leaf 1370))))), + Iarg_facet ((2,true),0.8002,1077, + Iarg_leaf 729)), + Iarg_facet ((1,true),0.5000,771, + Iarg_facet ((2,true),0.5000,1732, + Iarg_facet ((3,true),0.5000,1627, + Iarg_leaf 1892)))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1224, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,781, + Iarg_facet ((5,false),0.5000,766, + Iarg_leaf 1386)), + Iarg_facet ((4,true),0.5000,839, + Iarg_facet ((5,false),0.5000,994, + Iarg_leaf 1153))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,856, + Iarg_leaf 1318), + Iarg_facet ((4,true),0.5000,1853, + Iarg_facet ((5,false),0.6160,883, + Iarg_leaf 1974))))), + Iarg_facet ((1,true),0.5000,951, + Iarg_facet ((2,true),0.5000,1619, + Iarg_facet ((3,false),0.5000,1192, + Iarg_leaf 1616)))))))), + Iarg_bisect (5, + Iarg_facet ((4,true),0.7387,1118, + Iarg_facet ((3,false),0.6258,1144, + Iarg_facet ((5,false),0.5000,1374, + Iarg_facet ((0,false),0.6658,1123, + Iarg_leaf 1095)))), + Iarg_facet ((4,true),0.7420,1079, + Iarg_bisect (5, + Iarg_facet ((3,false),0.7169,1089, + Iarg_leaf 1528), + Iarg_facet ((3,false),0.8122,1268, + Iarg_leaf 1222))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1451, + Iarg_leaf 1724), + Iarg_facet ((4,true),0.5000,1456, + Iarg_leaf 1705)), + Iarg_facet ((3,false),0.5000,901, + Iarg_leaf 1574)), + Iarg_facet ((2,true),0.5000,1085, + Iarg_facet ((3,false),0.5000,971, + Iarg_leaf 1686))), + Iarg_facet ((1,true),0.5000,1246, + Iarg_facet ((2,true),0.5000,947, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1106, + Iarg_leaf 1259), + Iarg_facet ((4,false),0.5000,1232, + Iarg_leaf 1313))))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1398, + Iarg_leaf 1546), + Iarg_facet ((4,true),0.5000,1305, + Iarg_leaf 1633)), + Iarg_facet ((3,false),0.5000,774, + Iarg_leaf 1236)), + Iarg_facet ((2,true),0.5000,1161, + Iarg_facet ((3,false),0.5000,1242, + Iarg_leaf 1304))), + Iarg_facet ((1,true),0.5000,1753, + Iarg_facet ((2,true),0.5000,995, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1189, + Iarg_leaf 1341), + Iarg_facet ((4,true),0.5000,1324, + Iarg_leaf 1360)))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1861, + Iarg_leaf 1957), + Iarg_facet ((3,false),0.5000,1279, + Iarg_leaf 1346)), + Iarg_facet ((2,true),0.5000,1222, + Iarg_leaf 1724)), + Iarg_facet ((1,true),0.5000,1612, + Iarg_facet ((2,true),0.5000,1377, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1315, + Iarg_leaf 1375), + Iarg_facet ((4,false),0.5000,1410, + Iarg_leaf 1437))))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1752, + Iarg_leaf 1838), + Iarg_facet ((3,false),0.5000,1318, + Iarg_leaf 1327)), + Iarg_facet ((2,true),0.5000,1956, + Iarg_leaf 1969)), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1527, + Iarg_facet ((3,false),0.5000,1683, + Iarg_facet ((4,true),0.5000,991, + Iarg_leaf 1049))), + Iarg_facet ((2,true),0.5000,829, + Iarg_leaf 1516))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5683,985, + Iarg_facet ((3,true),0.6698,1065, + Iarg_leaf 1180)), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5612,722, + Iarg_facet ((4,false),0.5000,1140, + Iarg_leaf 1172)), + Iarg_facet ((3,false),0.6501,890, + Iarg_leaf 1526))), + Iarg_bisect (1, + Iarg_facet ((2,false),0.6795,1156, + Iarg_leaf 1230), + Iarg_facet ((2,true),0.5000,1721, + Iarg_leaf 1902))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5787,967, + Iarg_leaf 1540), + Iarg_facet ((2,true),0.5000,1734, + Iarg_leaf 1953)), + Iarg_facet ((1,false),0.5000,1616, + Iarg_facet ((2,true),0.5000,944, + Iarg_leaf 1298)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5865,1136, + Iarg_leaf 1441), + Iarg_facet ((2,false),0.5000,1898, + Iarg_facet ((3,false),0.6345,967, + Iarg_leaf 1244))), + Iarg_facet ((1,false),0.5000,1882, + Iarg_facet ((2,true),0.5000,1182, + Iarg_leaf 1637))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.6923,922, + Iarg_leaf 1237), + Iarg_facet ((2,false),0.5000,1382, + Iarg_leaf 1834)), + Iarg_facet ((1,false),0.5000,1631, + Iarg_facet ((2,true),0.5000,1042, + Iarg_leaf 1437)))))), + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,1557, + Iarg_facet ((4,false),0.5000,1075, + Iarg_leaf 1123)), + Iarg_facet ((5,false),0.5000,1353, + Iarg_leaf 1564)), + Iarg_facet ((3,true),0.5000,1710, + Iarg_facet ((5,false),0.5000,747, + Iarg_leaf 1425))), + Iarg_facet ((2,true),0.5000,1134, + Iarg_facet ((3,false),0.5000,1126, + Iarg_leaf 1246))), + Iarg_facet ((1,true),0.5000,1737, + Iarg_facet ((2,true),0.5000,700, + Iarg_facet ((3,false),0.5000,1863, + Iarg_facet ((5,true),0.5000,1049, + Iarg_leaf 1341))))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,1137, + Iarg_leaf 1313), + Iarg_facet ((5,false),0.5000,995, + Iarg_leaf 1103)), + Iarg_facet ((3,false),0.5000,1523, + Iarg_leaf 1914)), + Iarg_facet ((2,true),0.5000,1592, + Iarg_facet ((3,true),0.5000,1256, + Iarg_leaf 1297))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1354, + Iarg_facet ((3,false),0.5000,1803, + Iarg_facet ((5,false),0.5000,1041, + Iarg_leaf 1109))), + Iarg_facet ((2,true),0.5000,815, + Iarg_leaf 1862)))), + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1857, + Iarg_facet ((0,true),0.5000,881, + Iarg_leaf 1895)), + Iarg_facet ((5,false),0.5000,1438, + Iarg_leaf 1600)), + Iarg_facet ((4,true),0.5000,1906, + Iarg_facet ((5,false),0.5000,1107, + Iarg_leaf 1550))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1549, + Iarg_facet ((0,true),0.5000,906, + Iarg_facet ((1,true),0.6780,926, + Iarg_facet ((2,true),0.5000,1243, + Iarg_leaf 1280)))), + Iarg_facet ((5,false),0.5000,1224, + Iarg_facet ((0,true),0.6322,1062, + Iarg_leaf 1457))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1126, + Iarg_facet ((0,true),0.6499,1116, + Iarg_leaf 1939)), + Iarg_facet ((5,false),0.5000,1206, + Iarg_facet ((0,true),0.6740,899, + Iarg_facet ((1,true),0.6419,848, + Iarg_leaf 1335)))))), + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1573, + Iarg_leaf 1746), + Iarg_facet ((3,false),0.5000,925, + Iarg_leaf 1294))), + Iarg_facet ((1,true),0.5000,1311, + Iarg_facet ((2,true),0.5000,1677, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1047, + Iarg_leaf 1074), + Iarg_facet ((4,true),0.5000,1100, + Iarg_leaf 1174))))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,774, + Iarg_leaf 1884), + Iarg_facet ((4,true),0.6374,783, + Iarg_leaf 889)), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,891, + Iarg_facet ((0,true),0.7683,823, + Iarg_leaf 946)), + Iarg_facet ((5,false),0.5000,778, + Iarg_leaf 1387)), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1136, + Iarg_facet ((0,true),0.7528,1011, + Iarg_leaf 779)), + Iarg_facet ((5,false),0.5000,893, + Iarg_leaf 1210)))), + Iarg_facet ((2,true),0.5000,1079, + Iarg_facet ((3,false),0.5000,942, + Iarg_leaf 1254))), + Iarg_facet ((1,true),0.5000,1730, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1103, + Iarg_leaf 1143), + Iarg_facet ((4,false),0.5000,1131, + Iarg_leaf 1234)), + Iarg_facet ((3,true),0.5000,1020, + Iarg_leaf 1121)))))), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5764,979, + Iarg_leaf 1683), + Iarg_facet ((2,true),0.5000,1444, + Iarg_facet ((5,true),0.5000,905, + Iarg_leaf 1102))), + Iarg_facet ((1,false),0.5000,1323, + Iarg_facet ((2,true),0.5000,820, + Iarg_leaf 1398))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.6170,1166, + Iarg_leaf 1731), + Iarg_facet ((2,true),0.5000,1569, + Iarg_leaf 1580)), + Iarg_facet ((1,false),0.5000,1632, + Iarg_facet ((2,true),0.5000,1034, + Iarg_leaf 1118)))), + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5329,766, + Iarg_facet ((3,true),0.5836,1243, + Iarg_bisect (4, + Iarg_facet ((5,false),0.6174,819, + Iarg_leaf 1638), + Iarg_facet ((5,false),0.6206,874, + Iarg_leaf 1335)))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.7381,1231, + Iarg_leaf 1074), + Iarg_facet ((3,true),0.5000,904, + Iarg_leaf 1265))), + Iarg_facet ((1,true),0.5000,1336, + Iarg_leaf 1385)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5787,1021, + Iarg_facet ((3,true),0.5874,1135, + Iarg_facet ((4,true),0.5000,1462, + Iarg_leaf 1830))), + Iarg_facet ((2,false),0.5000,1775, + Iarg_leaf 1915)), + Iarg_facet ((1,false),0.5000,1407, + Iarg_leaf 1757)))))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((4,true),0.6544,766, + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1225, + Iarg_facet ((1,true),0.6610,1037, + Iarg_facet ((2,true),0.5000,934, + Iarg_leaf 1150))), + Iarg_facet ((0,false),0.5000,1598, + Iarg_facet ((1,true),0.5000,1096, + Iarg_facet ((2,false),0.5000,1157, + Iarg_leaf 1180))))), + Iarg_facet ((4,true),0.6679,800, + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1463, + Iarg_facet ((1,true),0.5000,1218, + Iarg_leaf 1358)), + Iarg_facet ((0,false),0.5000,1219, + Iarg_facet ((1,false),0.5000,879, + Iarg_leaf 1248))))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.6558,774, + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1596, + Iarg_facet ((1,true),0.5000,1647, + Iarg_facet ((2,true),0.5000,952, + Iarg_leaf 1134))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.7869,770, + Iarg_leaf 911), + Iarg_facet ((1,true),0.5000,1268, + Iarg_facet ((2,true),0.5000,945, + Iarg_leaf 1255))))), + Iarg_facet ((4,true),0.6614,753, + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1508, + Iarg_leaf 1961), + Iarg_facet ((0,false),0.5000,1643, + Iarg_leaf 1814))))))));; + +add_case ("7550003505 0 1 1", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1851, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.7321,1047, + Iarg_leaf 1321), + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,723, + Iarg_leaf 1438), + Iarg_facet ((0,true),0.5000,1221, + Iarg_leaf 1258))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1359, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1179, + Iarg_facet ((2,true),0.5000,1139, + Iarg_facet ((3,false),0.5000,1391, + Iarg_leaf 1451))), + Iarg_facet ((1,true),0.6523,912, + Iarg_leaf 1626))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1308, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1550, + Iarg_leaf 1585), + Iarg_facet ((3,false),0.5000,793, + Iarg_leaf 1215))), + Iarg_facet ((1,true),0.6624,1012, + Iarg_facet ((2,true),0.6232,862, + Iarg_leaf 1206))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1518, + Iarg_facet ((2,true),0.5000,1536, + Iarg_facet ((3,false),0.5000,1754, + Iarg_leaf 1950))), + Iarg_facet ((1,true),0.5000,931, + Iarg_facet ((2,true),0.5000,859, + Iarg_leaf 1951))))))), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,811, + Iarg_leaf 1535), + Iarg_facet ((0,true),0.5000,909, + Iarg_leaf 1962)), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1400, + Iarg_facet ((4,false),0.5000,1794, + Iarg_facet ((3,false),0.5000,1229, + Iarg_leaf 1484))), + Iarg_facet ((2,true),0.7709,981, + Iarg_facet ((4,false),0.5000,860, + Iarg_leaf 1621))), + Iarg_facet ((1,true),0.6201,992, + Iarg_facet ((2,true),0.5000,724, + Iarg_leaf 1291))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1757, + Iarg_facet ((2,true),0.5000,1466, + Iarg_bisect (4, + Iarg_facet ((3,false),0.5000,1072, + Iarg_leaf 1352), + Iarg_facet ((3,false),0.5000,1309, + Iarg_leaf 1536)))), + Iarg_facet ((1,true),0.5000,982, + Iarg_facet ((2,true),0.5000,1361, + Iarg_facet ((4,true),0.5000,871, + Iarg_leaf 1150)))))), + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1682, + Iarg_facet ((1,true),0.6512,737, + Iarg_facet ((2,true),0.8409,752, + Iarg_facet ((3,false),0.5284,862, + Iarg_facet ((4,false),0.5980,890, + Iarg_leaf 1661))))), + Iarg_facet ((0,true),0.5000,731, + Iarg_facet ((1,true),0.7425,1284, + Iarg_facet ((2,true),0.8324,984, + Iarg_leaf 1214)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1408, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,966, + Iarg_leaf 1151), + Iarg_facet ((5,true),0.5000,1901, + Iarg_facet ((0,true),0.6656,1034, + Iarg_leaf 1295))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1158, + Iarg_leaf 1487), + Iarg_facet ((5,true),0.5000,1616, + Iarg_facet ((0,true),0.5623,981, + Iarg_leaf 1561))))), + Iarg_facet ((2,true),0.6744,1178, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,814, + Iarg_facet ((5,true),0.5000,949, + Iarg_leaf 1322)), + Iarg_facet ((4,false),0.5000,1572, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,896, + Iarg_facet ((1,false),0.5000,910, + Iarg_leaf 1666)), + Iarg_facet ((0,true),0.7179,719, + Iarg_leaf 1431)))))), + Iarg_facet ((1,true),0.5000,1678, + Iarg_facet ((2,true),0.5000,716, + Iarg_facet ((3,true),0.5000,1350, + Iarg_leaf 1574)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1565, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1839, + Iarg_facet ((5,true),0.5000,995, + Iarg_leaf 1360)), + Iarg_facet ((4,true),0.5000,1709, + Iarg_leaf 1739))), + Iarg_facet ((2,true),0.7448,767, + Iarg_facet ((3,false),0.5000,1907, + Iarg_facet ((4,false),0.5000,838, + Iarg_facet ((5,true),0.5000,1107, + Iarg_leaf 1366))))), + Iarg_facet ((1,true),0.5000,1523, + Iarg_facet ((2,true),0.5000,765, + Iarg_facet ((3,false),0.5000,997, + Iarg_leaf 1388))))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,736, + Iarg_facet ((1,true),0.8449,986, + Iarg_leaf 1238)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1739, + Iarg_facet ((4,false),0.5000,1947, + Iarg_facet ((5,true),0.5000,1332, + Iarg_leaf 1448))), + Iarg_facet ((2,true),0.9001,984, + Iarg_leaf 597)), + Iarg_facet ((1,true),0.5000,1104, + Iarg_facet ((2,true),0.5000,1054, + Iarg_facet ((4,false),0.5000,1071, + Iarg_leaf 1518))))), + Iarg_facet ((3,false),0.7251,921, + Iarg_leaf 1071)), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1164, + Iarg_facet ((1,true),0.7459,1031, + Iarg_leaf 1616)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((5,true),0.5000,1913, + Iarg_facet ((3,true),0.5000,1149, + Iarg_leaf 1393)), + Iarg_facet ((5,false),0.5000,1198, + Iarg_leaf 1569)), + Iarg_facet ((2,true),0.7178,970, + Iarg_facet ((5,true),0.5000,1969, + Iarg_facet ((3,false),0.5000,989, + Iarg_leaf 1434)))), + Iarg_facet ((1,true),0.5000,761, + Iarg_facet ((2,true),0.5000,702, + Iarg_facet ((5,false),0.5000,1494, + Iarg_leaf 1854))))), + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,753, + Iarg_leaf 1543), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1580, + Iarg_facet ((3,false),0.5000,1007, + Iarg_leaf 1913)), + Iarg_facet ((2,true),0.6915,1118, + Iarg_facet ((3,false),0.5000,896, + Iarg_leaf 1341))), + Iarg_facet ((1,true),0.5000,1195, + Iarg_facet ((2,true),0.5000,906, + Iarg_facet ((3,false),0.5000,1681, + Iarg_leaf 1921))))))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1106, + Iarg_leaf 1255), + Iarg_facet ((4,false),0.5000,1084, + Iarg_leaf 1272)), + Iarg_facet ((3,false),0.5000,751, + Iarg_leaf 1361)), + Iarg_facet ((2,true),0.5000,912, + Iarg_facet ((3,false),0.5000,766, + Iarg_leaf 1384))), + Iarg_facet ((1,true),0.5000,1395, + Iarg_facet ((2,true),0.5000,1147, + Iarg_facet ((3,false),0.5000,1966, + Iarg_facet ((4,false),0.5000,1133, + Iarg_leaf 1257))))), + Iarg_facet ((0,true),0.5000,984, + Iarg_leaf 1240)), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1163, + Iarg_leaf 1223), + Iarg_facet ((4,true),0.5000,1194, + Iarg_leaf 1267)), + Iarg_facet ((3,false),0.5000,1052, + Iarg_leaf 1150)), + Iarg_facet ((2,true),0.5000,1003, + Iarg_leaf 1874)), + Iarg_facet ((1,true),0.5000,1348, + Iarg_facet ((2,true),0.5000,1215, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1097, + Iarg_leaf 1120), + Iarg_facet ((4,false),0.5000,1188, + Iarg_leaf 1206))))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,920, + Iarg_leaf 1563), + Iarg_facet ((4,false),0.5000,773, + Iarg_leaf 1258)), + Iarg_facet ((3,false),0.5000,1003, + Iarg_leaf 1022)), + Iarg_facet ((2,true),0.5000,1434, + Iarg_leaf 1826)), + Iarg_facet ((1,true),0.5000,1864, + Iarg_facet ((2,true),0.5000,1188, + Iarg_facet ((3,false),0.5000,1172, + Iarg_leaf 1457)))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1199, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.6713,1272, + Iarg_leaf 1938), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5726,994, + Iarg_leaf 1794), + Iarg_facet ((3,false),0.6326,961, + Iarg_facet ((4,true),0.5000,993, + Iarg_leaf 1661)))), + Iarg_bisect (1, + Iarg_facet ((2,false),0.5711,1061, + Iarg_facet ((3,true),0.5000,771, + Iarg_facet ((4,true),0.6163,803, + Iarg_leaf 1042))), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,926, + Iarg_facet ((4,true),0.5000,956, + Iarg_facet ((5,true),0.9737,1285, + Iarg_leaf 952))), + Iarg_facet ((3,false),0.5586,811, + Iarg_facet ((4,true),0.5000,1269, + Iarg_facet ((5,true),0.8223,1200, + Iarg_facet ((0,false),0.5000,786, + Iarg_leaf 1623)))))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.6946,1217, + Iarg_leaf 1156), + Iarg_facet ((2,true),0.5000,1751, + Iarg_leaf 1933)), + Iarg_facet ((1,false),0.5000,1851, + Iarg_facet ((2,true),0.5000,1357, + Iarg_leaf 1441))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1587, + Iarg_facet ((2,false),0.5000,1322, + Iarg_leaf 1335)), + Iarg_facet ((1,false),0.5000,1266, + Iarg_leaf 1939))))), + Iarg_facet ((3,true),0.5000,1117, + Iarg_facet ((5,true),0.9991,1233, + Iarg_leaf 1342))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1322, + Iarg_leaf 1826), + Iarg_facet ((4,false),0.5000,1121, + Iarg_leaf 1305)), + Iarg_facet ((3,false),0.5000,940, + Iarg_leaf 1069)), + Iarg_facet ((2,true),0.5000,950, + Iarg_facet ((3,true),0.5000,1567, + Iarg_leaf 1870))), + Iarg_facet ((1,true),0.5000,916, + Iarg_facet ((2,true),0.5000,1260, + Iarg_facet ((3,false),0.5000,1539, + Iarg_facet ((4,true),0.5000,920, + Iarg_leaf 1126))))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1643, + Iarg_leaf 1688), + Iarg_facet ((4,true),0.5000,1292, + Iarg_leaf 1306)), + Iarg_facet ((3,false),0.5000,1419, + Iarg_leaf 1619)), + Iarg_facet ((2,true),0.5000,1286, + Iarg_facet ((3,false),0.5000,1335, + Iarg_leaf 1672))), + Iarg_facet ((1,true),0.5000,1821, + Iarg_facet ((2,true),0.5000,1511, + Iarg_facet ((3,false),0.5000,1506, + Iarg_leaf 1762))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1191, + Iarg_leaf 1570), + Iarg_facet ((5,true),0.5000,1339, + Iarg_facet ((0,true),0.5000,745, + Iarg_leaf 1573))), + Iarg_facet ((4,false),0.5000,1742, + Iarg_facet ((5,true),0.5000,825, + Iarg_leaf 1308))), + Iarg_facet ((3,false),0.5000,1312, + Iarg_leaf 1507)), + Iarg_facet ((2,true),0.5000,1971, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1050, + Iarg_leaf 1346), + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,835, + Iarg_facet ((2,true),0.6997,879, + Iarg_leaf 1945)), + Iarg_facet ((0,true),0.6653,1070, + Iarg_leaf 1123))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1059, + Iarg_leaf 1063), + Iarg_bisect (5, + Iarg_facet ((0,true),0.6319,950, + Iarg_leaf 1934), + Iarg_facet ((0,true),0.6630,1091, + Iarg_leaf 1136)))))), + Iarg_facet ((1,true),0.5000,1943, + Iarg_facet ((2,true),0.5000,995, + Iarg_facet ((3,false),0.5000,1861, + Iarg_leaf 1966)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1302, + Iarg_leaf 1552), + Iarg_facet ((4,true),0.5000,899, + Iarg_leaf 1173)), + Iarg_facet ((3,false),0.5000,1506, + Iarg_leaf 1987)), + Iarg_facet ((2,true),0.5000,946, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1473, + Iarg_facet ((5,true),0.5000,1189, + Iarg_leaf 1668)), + Iarg_facet ((4,false),0.5000,1773, + Iarg_facet ((5,true),0.5000,1006, + Iarg_leaf 1621))))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,939, + Iarg_facet ((3,false),0.5000,1955, + Iarg_leaf 1974)), + Iarg_facet ((2,true),0.6660,896, + Iarg_leaf 1407))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.6811,1208, + Iarg_leaf 1286), + Iarg_facet ((2,true),0.5000,1330, + Iarg_leaf 1982)), + Iarg_facet ((1,false),0.5000,1701, + Iarg_leaf 1728)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5993,1162, + Iarg_leaf 1407), + Iarg_facet ((2,true),0.5000,1270, + Iarg_facet ((4,false),0.5000,864, + Iarg_leaf 1161))), + Iarg_facet ((1,false),0.5000,1229, + Iarg_leaf 1945))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5675,881, + Iarg_leaf 1262), + Iarg_facet ((2,true),0.5000,1973, + Iarg_facet ((3,true),0.6575,1272, + Iarg_facet ((4,false),0.5000,1037, + Iarg_facet ((5,true),0.5000,991, + Iarg_leaf 1175))))), + Iarg_facet ((1,false),0.5000,1158, + Iarg_leaf 1603)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.6163,1070, + Iarg_leaf 1605), + Iarg_facet ((2,true),0.5000,1590, + Iarg_facet ((3,true),0.6570,1235, + Iarg_facet ((4,false),0.5000,1015, + Iarg_leaf 1271)))), + Iarg_facet ((1,false),0.5000,994, + Iarg_leaf 1680))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1773, + Iarg_facet ((4,false),0.5000,1191, + Iarg_leaf 1278)), + Iarg_facet ((3,false),0.5000,1501, + Iarg_leaf 1903)), + Iarg_facet ((2,true),0.5000,1094, + Iarg_facet ((3,false),0.5000,1642, + Iarg_leaf 1996))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1262, + Iarg_facet ((3,true),0.5000,1812, + Iarg_leaf 1873)), + Iarg_facet ((2,true),0.5000,1040, + Iarg_leaf 1050))), + Iarg_facet ((0,true),0.5000,1204, + Iarg_leaf 1260)), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,766, + Iarg_leaf 1308), + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,997, + Iarg_leaf 1104), + Iarg_facet ((5,true),0.5000,1157, + Iarg_leaf 1235))), + Iarg_facet ((2,true),0.5000,1233, + Iarg_bisect (3, + Iarg_facet ((5,true),0.5000,1351, + Iarg_leaf 1487), + Iarg_facet ((5,true),0.5000,1232, + Iarg_leaf 1424)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1801, + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,1187, + Iarg_leaf 1334), + Iarg_facet ((5,false),0.5000,1138, + Iarg_leaf 1191))), + Iarg_facet ((2,true),0.6340,942, + Iarg_leaf 1024))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.6536,869, + Iarg_facet ((3,true),0.5000,1010, + Iarg_leaf 1209)), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1400, + Iarg_leaf 1767), + Iarg_facet ((3,false),0.5000,873, + Iarg_leaf 1133))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1525, + Iarg_leaf 1956), + Iarg_facet ((3,false),0.5000,909, + Iarg_leaf 1275)), + Iarg_facet ((2,true),0.6596,1214, + Iarg_leaf 1553))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1309, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.6799,1182, + Iarg_leaf 1712), + Iarg_facet ((2,true),0.5000,1799, + Iarg_facet ((4,false),0.5000,829, + Iarg_leaf 1492))), + Iarg_facet ((1,false),0.5000,1140, + Iarg_leaf 1744))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.7496,1142, + Iarg_leaf 1792), + Iarg_bisect (2, + Iarg_facet ((5,true),0.5000,1231, + Iarg_leaf 1492), + Iarg_facet ((5,false),0.5000,1086, + Iarg_leaf 1414))), + Iarg_facet ((1,false),0.5000,1638, + Iarg_leaf 1972)), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1067, + Iarg_facet ((2,false),0.5000,1203, + Iarg_facet ((3,false),0.5000,1421, + Iarg_leaf 1529))), + Iarg_facet ((1,false),0.5000,1995, + Iarg_facet ((2,true),0.5461,1042, + Iarg_leaf 1571))))))))));; + +add_case ("QITNPEA 5400790175 b split(3/4)", + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1807, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6547,1078, + Iarg_facet ((3,true),0.5000,1201, + Iarg_leaf 1663)), + Iarg_facet ((5,true),0.7914,870, + Iarg_leaf 1362)), + Iarg_facet ((4,true),0.5000,1053, + Iarg_facet ((5,true),0.8686,907, + Iarg_leaf 585)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6288,1079, + Iarg_leaf 1896), + Iarg_facet ((5,true),0.7095,753, + Iarg_leaf 909)), + Iarg_bisect (4, + Iarg_facet ((5,true),0.7630,905, + Iarg_leaf 1091), + Iarg_facet ((5,true),0.9675,733, + Iarg_leaf 175))), + Iarg_facet ((2,true),0.5000,894, + Iarg_leaf 1380))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1802, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6506,958, + Iarg_facet ((3,true),0.5000,1041, + Iarg_leaf 1090)), + Iarg_facet ((5,true),0.7475,735, + Iarg_leaf 1065)), + Iarg_facet ((4,true),0.5000,847, + Iarg_facet ((5,true),0.8476,822, + Iarg_leaf 670)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6271,1083, + Iarg_facet ((3,false),0.5000,1017, + Iarg_leaf 1096)), + Iarg_facet ((5,true),0.9342,1180, + Iarg_leaf 304)), + Iarg_bisect (4, + Iarg_facet ((5,true),0.7330,827, + Iarg_leaf 824), + Iarg_facet ((5,true),0.9908,768, + Iarg_leaf 164))), + Iarg_facet ((2,true),0.5000,914, + Iarg_leaf 1415)))), + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1730, + Iarg_leaf 1761), + Iarg_facet ((0,false),0.5000,1720, + Iarg_leaf 1777))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6172,943, + Iarg_facet ((2,true),0.5000,1236, + Iarg_leaf 1857)), + Iarg_facet ((1,true),0.5000,896, + Iarg_bisect (2, + Iarg_facet ((5,true),0.7865,883, + Iarg_leaf 452), + Iarg_facet ((5,true),0.8522,732, + Iarg_leaf 642)))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5727,836, + Iarg_facet ((2,true),0.5000,823, + Iarg_leaf 1366)), + Iarg_facet ((1,true),0.5000,905, + Iarg_bisect (2, + Iarg_facet ((5,true),0.7859,847, + Iarg_leaf 434), + Iarg_facet ((5,true),0.9824,929, + Iarg_leaf 289))))), + Iarg_facet ((3,true),0.5000,1632, + Iarg_leaf 1672))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,732, + Iarg_facet ((4,true),0.5000,1189, + Iarg_leaf 1756)), + Iarg_facet ((1,true),0.5000,957, + Iarg_bisect (4, + Iarg_facet ((5,true),0.7907,894, + Iarg_leaf 447), + Iarg_facet ((5,true),0.9559,914, + Iarg_leaf 174)))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,731, + Iarg_facet ((4,true),0.5000,1090, + Iarg_leaf 1531)), + Iarg_facet ((1,true),0.5000,960, + Iarg_bisect (4, + Iarg_facet ((5,true),0.7905,859, + Iarg_leaf 1857), + Iarg_facet ((5,true),0.8755,761, + Iarg_leaf 240))))), + Iarg_facet ((3,true),0.5000,1587, + Iarg_leaf 1624)), + Iarg_facet ((5,true),0.5000,1682, + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1654, + Iarg_facet ((1,true),0.6763,1000, + Iarg_facet ((5,true),0.9928,710, + Iarg_leaf 92))), + Iarg_facet ((0,false),0.5000,1355, + Iarg_facet ((1,true),0.6979,1033, + Iarg_facet ((5,true),0.9990,650, + Iarg_leaf 92))))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1847, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1663, + Iarg_leaf 1723), + Iarg_facet ((0,true),0.5000,1680, + Iarg_leaf 1723))), + Iarg_facet ((5,true),0.5000,1137, + Iarg_facet ((3,true),0.5000,1452, + Iarg_leaf 1490))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1141, + Iarg_facet ((3,true),0.5000,1586, + Iarg_leaf 1609)), + Iarg_facet ((5,true),0.5000,1029, + Iarg_leaf 1662)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6274,1069, + Iarg_facet ((3,false),0.5000,1161, + Iarg_leaf 1388)), + Iarg_facet ((5,true),0.7038,713, + Iarg_leaf 1011)), + Iarg_facet ((4,true),0.5000,996, + Iarg_facet ((5,true),0.7753,912, + Iarg_leaf 912))), + Iarg_facet ((2,true),0.5000,815, + Iarg_leaf 1329)), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,875, + Iarg_facet ((3,false),0.5000,1300, + Iarg_leaf 1722)), + Iarg_facet ((5,true),0.7076,937, + Iarg_leaf 1027)), + Iarg_bisect (4, + Iarg_facet ((5,true),0.7177,958, + Iarg_leaf 1007), + Iarg_facet ((5,true),0.9166,732, + Iarg_leaf 198))), + Iarg_facet ((2,true),0.5000,1092, + Iarg_leaf 1797))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1022, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1029, + Iarg_leaf 1175), + Iarg_facet ((0,true),0.5000,1561, + Iarg_leaf 1695))), + Iarg_facet ((5,true),0.6745,968, + Iarg_leaf 1810)), + Iarg_facet ((4,true),0.5000,1420, + Iarg_facet ((5,true),0.6776,957, + Iarg_leaf 1804))), + Iarg_facet ((2,true),0.5000,1132, + Iarg_facet ((4,true),0.6255,864, + Iarg_leaf 1220))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1407, + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1024, + Iarg_leaf 1315), + Iarg_facet ((0,false),0.5000,1589, + Iarg_facet ((1,true),0.5000,710, + Iarg_leaf 1493)))), + Iarg_facet ((5,true),0.6183,1055, + Iarg_facet ((3,false),0.5000,869, + Iarg_leaf 1163))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.6315,1077, + Iarg_facet ((3,false),0.5000,1116, + Iarg_leaf 1354)), + Iarg_facet ((5,true),0.7240,744, + Iarg_leaf 799))), + Iarg_facet ((2,true),0.5000,1565, + Iarg_facet ((4,true),0.5000,939, + Iarg_leaf 1941))))), + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1907, + Iarg_facet ((1,true),0.6607,946, + Iarg_leaf 995)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,752, + Iarg_leaf 1879), + Iarg_facet ((1,true),0.5904,958, + Iarg_leaf 1678)))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,777, + Iarg_facet ((2,true),0.5000,1176, + Iarg_leaf 1681)), + Iarg_facet ((1,true),0.5000,1044, + Iarg_bisect (2, + Iarg_facet ((5,true),0.7619,950, + Iarg_leaf 730), + Iarg_facet ((5,true),0.8408,743, + Iarg_leaf 296)))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,998, + Iarg_facet ((2,true),0.5000,1324, + Iarg_facet ((5,true),0.7495,1016, + Iarg_leaf 1021))), + Iarg_facet ((1,true),0.5000,1350, + Iarg_bisect (2, + Iarg_facet ((5,true),0.6578,920, + Iarg_facet ((4,true),0.5000,778, + Iarg_leaf 1228)), + Iarg_facet ((5,true),0.7156,708, + Iarg_leaf 616))))), + Iarg_facet ((3,false),0.5000,1847, + Iarg_facet ((0,false),0.5000,957, + Iarg_leaf 1370)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,827, + Iarg_facet ((4,true),0.5000,1143, + Iarg_leaf 1661)), + Iarg_facet ((1,true),0.5000,1095, + Iarg_bisect (4, + Iarg_facet ((5,true),0.7170,762, + Iarg_leaf 917), + Iarg_facet ((5,true),0.8359,738, + Iarg_leaf 674)))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1054, + Iarg_facet ((4,true),0.5000,1305, + Iarg_facet ((5,true),0.6877,719, + Iarg_leaf 1798))), + Iarg_facet ((1,true),0.5000,1429, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6647,913, + Iarg_leaf 1414), + Iarg_facet ((5,true),0.7676,788, + Iarg_facet ((2,true),0.5000,840, + Iarg_leaf 1096)))))), + Iarg_facet ((3,false),0.5000,1771, + Iarg_facet ((0,false),0.5000,883, + Iarg_leaf 1325))), + Iarg_facet ((5,true),0.5000,1815, + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1399, + Iarg_facet ((1,true),0.6906,1212, + Iarg_facet ((5,true),0.9992,699, + Iarg_leaf 91))), + Iarg_facet ((0,false),0.5000,1692, + Iarg_facet ((1,true),0.6678,839, + Iarg_leaf 1382)))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1878, + Iarg_leaf 1931), + Iarg_bisect (0, + Iarg_facet ((2,true),0.5000,1088, + Iarg_leaf 1299), + Iarg_facet ((2,true),0.5000,1143, + Iarg_leaf 1415))), + Iarg_facet ((3,false),0.5000,988, + Iarg_leaf 1174)), + Iarg_facet ((5,true),0.5000,1193, + Iarg_facet ((3,false),0.5000,1648, + Iarg_facet ((0,false),0.5000,889, + Iarg_leaf 1163)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1177, + Iarg_facet ((3,false),0.5000,1790, + Iarg_facet ((0,false),0.5000,1040, + Iarg_leaf 1272))), + Iarg_facet ((5,true),0.5000,929, + Iarg_leaf 1782))))), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1084, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1645, + Iarg_facet ((5,true),0.6902,783, + Iarg_leaf 1309)), + Iarg_facet ((4,true),0.5000,1208, + Iarg_leaf 1568))), + Iarg_facet ((1,true),0.5000,1012, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1601, + Iarg_facet ((5,true),0.6858,832, + Iarg_leaf 1557)), + Iarg_facet ((4,true),0.5000,1076, + Iarg_leaf 1532))))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1940, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.7847,1193, + Iarg_leaf 933), + Iarg_facet ((1,true),0.6714,715, + Iarg_facet ((2,true),0.5000,886, + Iarg_leaf 1063))), + Iarg_facet ((0,false),0.5000,1779, + Iarg_facet ((1,true),0.6785,1273, + Iarg_facet ((2,true),0.5000,956, + Iarg_leaf 1377))))), + Iarg_facet ((5,true),0.5000,1528, + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1161, + Iarg_facet ((1,true),0.8048,961, + Iarg_leaf 1505)), + Iarg_facet ((0,false),0.5000,900, + Iarg_facet ((1,true),0.8392,936, + Iarg_leaf 803))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1447, + Iarg_bisect (3, + Iarg_facet ((0,false),0.5391,998, + Iarg_facet ((1,true),0.9963,1180, + Iarg_leaf 375)), + Iarg_facet ((0,false),0.6411,1034, + Iarg_leaf 1929))), + Iarg_facet ((5,true),0.5000,1348, + Iarg_facet ((3,true),0.5000,1385, + Iarg_facet ((0,false),0.6469,928, + Iarg_leaf 1233))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1030, + Iarg_leaf 1757), + Iarg_facet ((5,true),0.5000,1027, + Iarg_leaf 1500)), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1023, + Iarg_leaf 1432), + Iarg_facet ((5,true),0.5000,884, + Iarg_leaf 1334)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1850, + Iarg_facet ((1,true),0.6578,733, + Iarg_leaf 1967)), + Iarg_facet ((0,false),0.5000,1985, + Iarg_facet ((1,true),0.6184,806, + Iarg_leaf 1816))), + Iarg_facet ((3,false),0.5000,996, + Iarg_leaf 1098)), + Iarg_facet ((5,true),0.5000,1247, + Iarg_facet ((3,true),0.5000,1539, + Iarg_facet ((0,false),0.5000,866, + Iarg_leaf 1436)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1225, + Iarg_facet ((3,true),0.5000,1363, + Iarg_facet ((0,false),0.5953,1129, + Iarg_leaf 1299))), + Iarg_facet ((5,true),0.5000,797, + Iarg_leaf 1412))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,923, + Iarg_leaf 1854), + Iarg_facet ((5,true),0.5000,874, + Iarg_leaf 1299)), + Iarg_facet ((4,true),0.5000,1443, + Iarg_facet ((5,true),0.5000,802, + Iarg_leaf 1253))))), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,999, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1187, + Iarg_leaf 1287), + Iarg_facet ((4,true),0.5000,1166, + Iarg_leaf 1191))), + Iarg_facet ((1,true),0.5000,878, + Iarg_facet ((2,true),0.5000,1884, + Iarg_leaf 1978))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1832, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.7203,818, + Iarg_leaf 1516), + Iarg_facet ((1,true),0.6454,711, + Iarg_leaf 1906)), + Iarg_facet ((0,false),0.5000,1827, + Iarg_facet ((1,true),0.6654,727, + Iarg_leaf 1768)))), + Iarg_facet ((5,true),0.5000,1426, + Iarg_bisect (3, + Iarg_facet ((0,false),0.5392,993, + Iarg_facet ((1,true),0.9731,1181, + Iarg_leaf 102)), + Iarg_facet ((0,false),0.6413,1068, + Iarg_leaf 1917)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1503, + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1211, + Iarg_facet ((1,true),0.7662,1050, + Iarg_leaf 961)), + Iarg_facet ((0,false),0.5000,960, + Iarg_facet ((1,true),0.8212,923, + Iarg_leaf 214)))), + Iarg_facet ((5,true),0.5000,1341, + Iarg_facet ((3,true),0.5000,1387, + Iarg_facet ((0,false),0.6471,932, + Iarg_leaf 1202))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1054, + Iarg_leaf 1906), + Iarg_facet ((5,true),0.5000,1050, + Iarg_leaf 1494)), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1031, + Iarg_leaf 1529), + Iarg_facet ((5,true),0.5000,881, + Iarg_leaf 1346)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1942, + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1924, + Iarg_facet ((1,true),0.6678,821, + Iarg_leaf 1747)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.7088,971, + Iarg_leaf 1210), + Iarg_facet ((1,true),0.6324,950, + Iarg_leaf 1504)))), + Iarg_facet ((5,true),0.5000,1237, + Iarg_facet ((3,true),0.5000,1386, + Iarg_facet ((0,false),0.6374,1021, + Iarg_leaf 1427)))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1289, + Iarg_facet ((3,true),0.5000,1627, + Iarg_facet ((0,false),0.5000,906, + Iarg_leaf 1538))), + Iarg_facet ((5,true),0.5000,827, + Iarg_leaf 1418))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,929, + Iarg_facet ((3,false),0.5000,962, + Iarg_leaf 1091)), + Iarg_facet ((5,true),0.5000,802, + Iarg_leaf 1232)), + Iarg_facet ((4,true),0.5000,1426, + Iarg_facet ((5,true),0.5000,886, + Iarg_leaf 1257))))), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,999, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1189, + Iarg_leaf 1242), + Iarg_facet ((4,true),0.5000,1152, + Iarg_leaf 1193))), + Iarg_facet ((1,true),0.5000,920, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1059, + Iarg_leaf 1133), + Iarg_facet ((4,true),0.5000,931, + Iarg_leaf 1102))))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1256, + Iarg_facet ((3,true),0.5000,1496, + Iarg_facet ((0,false),0.6469,858, + Iarg_leaf 1271))), + Iarg_facet ((5,true),0.5000,1053, + Iarg_leaf 1724)), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1051, + Iarg_leaf 1734), + Iarg_facet ((5,true),0.5000,867, + Iarg_leaf 1335))), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1621, + Iarg_facet ((5,true),0.5000,812, + Iarg_leaf 1254)), + Iarg_facet ((4,true),0.5000,1327, + Iarg_leaf 1632))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1259, + Iarg_facet ((5,true),0.5000,736, + Iarg_leaf 1474)), + Iarg_facet ((4,true),0.5000,1078, + Iarg_leaf 1280)), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1069, + Iarg_leaf 1319), + Iarg_facet ((4,true),0.5000,1012, + Iarg_leaf 1053)))), + Iarg_bisect (3, + Iarg_facet ((1,true),0.5976,1195, + Iarg_facet ((2,true),0.5000,1200, + Iarg_leaf 1655)), + Iarg_facet ((1,true),0.5843,1162, + Iarg_facet ((2,true),0.5000,1071, + Iarg_leaf 1252)))))), + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.6687,1706, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1252, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1652, + Iarg_facet ((3,true),0.5000,1082, + Iarg_leaf 1086)), + Iarg_facet ((4,true),0.5000,1588, + Iarg_leaf 1653))), + Iarg_facet ((1,true),0.5000,1108, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1584, + Iarg_facet ((3,false),0.5000,1135, + Iarg_leaf 1345)), + Iarg_facet ((4,true),0.5000,1215, + Iarg_leaf 1587))))), + Iarg_facet ((5,true),0.6683,1693, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1183, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1523, + Iarg_leaf 1628), + Iarg_facet ((4,true),0.5000,1044, + Iarg_leaf 1306))), + Iarg_facet ((1,true),0.5000,1045, + Iarg_facet ((2,true),0.5000,1810, + Iarg_facet ((4,true),0.5000,1152, + Iarg_leaf 1310)))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.6681,1685, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,1182, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1382, + Iarg_leaf 1632), + Iarg_facet ((4,true),0.5000,1159, + Iarg_leaf 1518))), + Iarg_facet ((1,true),0.5000,932, + Iarg_facet ((2,true),0.5000,1974, + Iarg_facet ((4,true),0.5000,1013, + Iarg_leaf 1189))))), + Iarg_facet ((5,true),0.6684,1273, + Iarg_bisect (3, + Iarg_facet ((1,true),0.5000,766, + Iarg_facet ((2,true),0.5000,1544, + Iarg_facet ((4,true),0.5000,942, + Iarg_leaf 1081))), + Iarg_facet ((1,true),0.5000,760, + Iarg_facet ((2,true),0.5000,1486, + Iarg_leaf 1715))))))));; + +add_case ("7550003505 1 1 3", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.8039,959, + Iarg_leaf 1441), + Iarg_facet ((0,true),0.7494,741, + Iarg_leaf 1608)), + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1526, + Iarg_facet ((1,true),0.5000,1339, + Iarg_facet ((2,true),0.5000,824, + Iarg_facet ((3,true),0.5000,976, + Iarg_leaf 1255)))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1664, + Iarg_facet ((2,true),0.5000,935, + Iarg_facet ((3,false),0.5000,1259, + Iarg_leaf 1426))), + Iarg_facet ((1,true),0.5000,726, + Iarg_leaf 1827)))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.7677,1160, + Iarg_leaf 1240), + Iarg_facet ((5,false),0.5000,1074, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1102, + Iarg_facet ((3,true),0.5000,1304, + Iarg_leaf 1737)), + Iarg_facet ((2,true),0.6193,892, + Iarg_leaf 1226)), + Iarg_facet ((1,true),0.5000,822, + Iarg_leaf 1445))))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((0,true),0.8310,1257, + Iarg_leaf 1353), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1716, + Iarg_bisect (2, + Iarg_facet ((5,false),0.5000,1486, + Iarg_facet ((3,true),0.5000,976, + Iarg_leaf 1167)), + Iarg_facet ((5,false),0.5000,981, + Iarg_leaf 1693))), + Iarg_facet ((1,true),0.5000,804, + Iarg_leaf 1392))), + Iarg_bisect (4, + Iarg_facet ((0,true),0.8236,995, + Iarg_leaf 1504), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1330, + Iarg_facet ((5,false),0.5000,1946, + Iarg_facet ((3,false),0.5000,1096, + Iarg_leaf 1208))), + Iarg_facet ((2,true),0.5000,779, + Iarg_leaf 1585)), + Iarg_facet ((1,true),0.5000,1330, + Iarg_leaf 1436)))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((0,true),0.8135,1261, + Iarg_facet ((1,true),0.5000,1223, + Iarg_facet ((2,true),0.7263,1260, + Iarg_facet ((3,true),0.5000,1455, + Iarg_leaf 1788)))), + Iarg_facet ((0,true),0.5000,1970, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,936, + Iarg_facet ((0,true),0.8559,1108, + Iarg_leaf 636)), + Iarg_facet ((5,false),0.5000,1144, + Iarg_facet ((0,true),0.8450,1180, + Iarg_leaf 460))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,763, + Iarg_leaf 1561), + Iarg_facet ((5,false),0.5000,949, + Iarg_leaf 1319))), + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1417, + Iarg_facet ((5,false),0.5000,938, + Iarg_facet ((0,true),0.7217,871, + Iarg_leaf 1799))), + Iarg_facet ((4,false),0.5000,990, + Iarg_facet ((5,false),0.6377,808, + Iarg_leaf 1125)))), + Iarg_facet ((2,true),0.5000,1223, + Iarg_facet ((3,false),0.5000,1299, + Iarg_leaf 1368))))), + Iarg_bisect (4, + Iarg_facet ((0,true),0.7949,899, + Iarg_facet ((1,true),0.6087,760, + Iarg_facet ((2,true),0.7494,800, + Iarg_leaf 1404))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1648, + Iarg_leaf 1930), + Iarg_facet ((4,true),0.5000,1194, + Iarg_leaf 1574)), + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,898, + Iarg_leaf 1672), + Iarg_facet ((4,false),0.5000,852, + Iarg_leaf 1350))), + Iarg_facet ((2,true),0.5000,1142, + Iarg_leaf 1821)), + Iarg_facet ((1,true),0.7879,1060, + Iarg_leaf 911)))))), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1917, + Iarg_facet ((2,true),0.5000,1483, + Iarg_facet ((4,true),0.5000,872, + Iarg_leaf 1441))), + Iarg_facet ((1,true),0.5000,706, + Iarg_facet ((2,true),0.5000,730, + Iarg_leaf 1456))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1361, + Iarg_facet ((4,true),0.5000,959, + Iarg_leaf 1635)), + Iarg_facet ((2,true),0.6302,1054, + Iarg_leaf 1576)), + Iarg_facet ((1,true),0.5000,1140, + Iarg_facet ((2,true),0.5000,835, + Iarg_leaf 1677)))), + Iarg_facet ((5,false),0.5000,1583, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1464, + Iarg_facet ((4,true),0.5000,821, + Iarg_leaf 1691)), + Iarg_facet ((2,true),0.5000,935, + Iarg_leaf 1254)), + Iarg_facet ((1,true),0.5000,1411, + Iarg_facet ((2,true),0.5000,1239, + Iarg_leaf 1612))))), + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1781, + Iarg_facet ((1,true),0.5000,777, + Iarg_leaf 1471)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,818, + Iarg_leaf 1237), + Iarg_facet ((1,true),0.5000,921, + Iarg_leaf 1665))), + Iarg_facet ((5,false),0.6562,914, + Iarg_facet ((0,false),0.5000,1222, + Iarg_leaf 1610)))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,941, + Iarg_leaf 1998), + Iarg_facet ((4,true),0.5000,1166, + Iarg_leaf 1540)), + Iarg_facet ((2,true),0.6780,854, + Iarg_leaf 1390)), + Iarg_facet ((1,true),0.5000,1156, + Iarg_facet ((2,true),0.5000,802, + Iarg_leaf 1618))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1251, + Iarg_facet ((5,true),0.5000,1228, + Iarg_leaf 1250)), + Iarg_facet ((4,false),0.5000,1099, + Iarg_leaf 1232)), + Iarg_facet ((2,true),0.5000,900, + Iarg_leaf 1413)), + Iarg_facet ((1,true),0.5000,1742, + Iarg_facet ((2,true),0.5000,1078, + Iarg_facet ((4,false),0.5000,1260, + Iarg_leaf 1312))))), + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1873, + Iarg_facet ((3,true),0.5000,1915, + Iarg_facet ((5,false),0.5000,1057, + Iarg_leaf 1754))), + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,1072, + Iarg_facet ((0,true),0.6489,805, + Iarg_leaf 1652)), + Iarg_facet ((5,false),0.5000,816, + Iarg_leaf 1846)), + Iarg_bisect (3, + Iarg_facet ((5,false),0.6235,960, + Iarg_facet ((0,true),0.7284,829, + Iarg_leaf 1031)), + Iarg_facet ((5,false),0.5000,732, + Iarg_leaf 1746)))), + Iarg_facet ((2,true),0.5000,1152, + Iarg_leaf 1632)), + Iarg_facet ((1,true),0.5000,894, + Iarg_facet ((2,true),0.5000,1616, + Iarg_facet ((4,false),0.5000,1164, + Iarg_leaf 1236)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1279, + Iarg_facet ((3,true),0.5000,988, + Iarg_leaf 1331)), + Iarg_bisect (4, + Iarg_facet ((3,true),0.5000,1451, + Iarg_leaf 1953), + Iarg_facet ((3,true),0.5000,1394, + Iarg_facet ((5,false),0.5000,702, + Iarg_leaf 1290)))), + Iarg_facet ((2,true),0.5000,1498, + Iarg_leaf 1813)), + Iarg_facet ((1,true),0.5000,1131, + Iarg_facet ((2,true),0.5000,757, + Iarg_facet ((4,false),0.5000,1232, + Iarg_leaf 1612)))))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,744, + Iarg_leaf 1329), + Iarg_facet ((1,true),0.5000,956, + Iarg_leaf 1643)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,877, + Iarg_leaf 1384), + Iarg_facet ((1,true),0.5000,923, + Iarg_leaf 1858))), + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,706, + Iarg_facet ((2,false),0.8227,932, + Iarg_leaf 818)), + Iarg_facet ((1,true),0.6494,979, + Iarg_leaf 1649)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,730, + Iarg_facet ((2,false),0.7969,944, + Iarg_leaf 837)), + Iarg_facet ((1,true),0.5000,902, + Iarg_facet ((2,true),0.5000,1004, + Iarg_leaf 1153)))))))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1598, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_facet ((0,true),0.8087,1011, + Iarg_leaf 1609), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1515, + Iarg_facet ((3,true),0.5000,1506, + Iarg_facet ((5,true),0.5000,1204, + Iarg_leaf 1247))), + Iarg_facet ((2,true),0.5000,810, + Iarg_leaf 1990)), + Iarg_facet ((1,true),0.5000,1051, + Iarg_leaf 1707))), + Iarg_bisect (4, + Iarg_facet ((0,true),0.7742,887, + Iarg_facet ((1,true),0.5000,882, + Iarg_leaf 1807)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1634, + Iarg_facet ((4,true),0.5000,948, + Iarg_leaf 1179)), + Iarg_facet ((3,true),0.5000,1863, + Iarg_facet ((4,false),0.5000,822, + Iarg_leaf 1338))), + Iarg_facet ((2,true),0.6476,992, + Iarg_leaf 1997)), + Iarg_facet ((1,true),0.6302,1046, + Iarg_facet ((2,true),0.8142,880, + Iarg_leaf 1237))))), + Iarg_facet ((5,false),0.5000,1677, + Iarg_bisect (4, + Iarg_facet ((0,true),0.8017,748, + Iarg_leaf 1439), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1382, + Iarg_facet ((3,true),0.5000,900, + Iarg_leaf 1546)), + Iarg_facet ((2,true),0.5000,770, + Iarg_facet ((3,true),0.5000,1248, + Iarg_leaf 1687))), + Iarg_facet ((1,true),0.5000,901, + Iarg_facet ((2,true),0.7555,1127, + Iarg_leaf 1569))))))), + Iarg_bisect (5, + Iarg_facet ((3,true),0.9983,1670, + Iarg_leaf 1354), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1052, + Iarg_facet ((4,true),0.5000,734, + Iarg_leaf 1290)), + Iarg_facet ((3,true),0.5000,1245, + Iarg_leaf 1490)), + Iarg_facet ((2,true),0.5000,842, + Iarg_leaf 1928)), + Iarg_facet ((1,true),0.5000,1833, + Iarg_facet ((2,true),0.5000,861, + Iarg_facet ((3,true),0.5000,1363, + Iarg_leaf 1583)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1679, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1115, + Iarg_leaf 1175), + Iarg_facet ((4,true),0.5000,1010, + Iarg_leaf 1091))), + Iarg_facet ((2,true),0.5000,1135, + Iarg_facet ((3,false),0.5000,1318, + Iarg_leaf 1609))), + Iarg_facet ((1,true),0.5000,1955, + Iarg_facet ((2,true),0.5000,1004, + Iarg_facet ((3,false),0.5000,1911, + Iarg_leaf 1987))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6348,1044, + Iarg_leaf 1164), + Iarg_facet ((1,true),0.5000,1005, + Iarg_facet ((2,true),0.5000,1150, + Iarg_leaf 1254))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,865, + Iarg_leaf 1430), + Iarg_facet ((1,true),0.5000,1147, + Iarg_facet ((2,true),0.5000,1395, + Iarg_leaf 1409))))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1985, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.6988,944, + Iarg_leaf 1860), + Iarg_facet ((2,true),0.5000,1692, + Iarg_facet ((4,true),0.5000,949, + Iarg_leaf 1604))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1752, + Iarg_facet ((4,true),0.5000,1182, + Iarg_leaf 1511)), + Iarg_facet ((2,true),0.7852,765, + Iarg_leaf 1156)))), + Iarg_facet ((5,false),0.5000,811, + Iarg_facet ((0,false),0.5000,1795, + Iarg_facet ((1,true),0.5000,1271, + Iarg_facet ((2,false),0.5000,748, + Iarg_leaf 1873))))))))));; + +add_case ("7550003505 0 1 3", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1261, + Iarg_leaf 1787), + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,757, + Iarg_leaf 1934), + Iarg_facet ((0,true),0.5000,1548, + Iarg_leaf 1898))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.7492,827, + Iarg_facet ((1,true),0.5000,785, + Iarg_leaf 1959)), + Iarg_facet ((0,true),0.7492,1073, + Iarg_facet ((1,true),0.5000,1482, + Iarg_leaf 1712))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1758, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,987, + Iarg_leaf 1070), + Iarg_facet ((4,true),0.5000,1031, + Iarg_leaf 1124)), + Iarg_facet ((3,false),0.5000,846, + Iarg_leaf 1256))), + Iarg_facet ((1,true),0.6751,887, + Iarg_leaf 1549)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1721, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1282, + Iarg_leaf 1360), + Iarg_facet ((4,false),0.5000,1374, + Iarg_leaf 1714))), + Iarg_facet ((2,true),0.7140,1034, + Iarg_leaf 1525)), + Iarg_facet ((1,true),0.5000,1005, + Iarg_facet ((2,true),0.7124,794, + Iarg_leaf 1637)))))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,867, + Iarg_facet ((0,true),0.5000,976, + Iarg_facet ((1,true),0.8465,844, + Iarg_leaf 1686))), + Iarg_bisect (4, + Iarg_facet ((0,true),0.7759,957, + Iarg_facet ((1,true),0.6296,846, + Iarg_facet ((2,true),0.8362,878, + Iarg_leaf 1223))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1457, + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,1381, + Iarg_leaf 1774), + Iarg_facet ((3,false),0.5000,1724, + Iarg_facet ((4,false),0.5000,953, + Iarg_leaf 1092)))), + Iarg_facet ((2,true),0.7238,845, + Iarg_leaf 1480)), + Iarg_facet ((1,true),0.5000,1577, + Iarg_facet ((2,true),0.7837,836, + Iarg_leaf 1180))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((0,true),0.8725,1263, + Iarg_facet ((1,true),0.8884,1047, + Iarg_leaf 1670)), + Iarg_facet ((0,true),0.5785,929, + Iarg_facet ((1,true),0.7494,878, + Iarg_facet ((2,true),0.6604,877, + Iarg_facet ((3,false),0.6863,1191, + Iarg_leaf 1331))))), + Iarg_bisect (4, + Iarg_facet ((0,true),0.7308,1082, + Iarg_facet ((1,true),0.6023,1158, + Iarg_facet ((2,true),0.6289,898, + Iarg_facet ((3,true),0.5000,1492, + Iarg_facet ((4,false),0.6209,1105, + Iarg_leaf 1127))))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1172, + Iarg_leaf 1796), + Iarg_facet ((5,false),0.5000,1213, + Iarg_leaf 1289)), + Iarg_facet ((4,true),0.5000,1853, + Iarg_facet ((5,false),0.5000,1242, + Iarg_leaf 1310))), + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1017, + Iarg_leaf 1306), + Iarg_facet ((4,false),0.5000,1343, + Iarg_facet ((5,false),0.6335,783, + Iarg_leaf 1137)))), + Iarg_facet ((2,true),0.8137,735, + Iarg_leaf 1146)), + Iarg_facet ((1,true),0.5000,785, + Iarg_facet ((2,true),0.8337,884, + Iarg_leaf 1219))))))), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1239, + Iarg_leaf 1444), + Iarg_facet ((0,true),0.5000,1209, + Iarg_leaf 1433)), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1921, + Iarg_facet ((4,true),0.5000,1395, + Iarg_facet ((3,false),0.5000,1166, + Iarg_leaf 1287))), + Iarg_facet ((2,true),0.6983,839, + Iarg_leaf 1973)), + Iarg_facet ((1,true),0.5000,969, + Iarg_facet ((2,true),0.5000,1016, + Iarg_facet ((4,false),0.5000,1062, + Iarg_leaf 1341)))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1691, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1447, + Iarg_facet ((3,false),0.5000,1372, + Iarg_leaf 1809)), + Iarg_facet ((4,true),0.5000,969, + Iarg_leaf 1045))), + Iarg_facet ((1,true),0.5000,1367, + Iarg_facet ((2,true),0.5000,1702, + Iarg_facet ((4,true),0.5000,1341, + Iarg_leaf 1531)))))), + Iarg_facet ((3,false),0.5000,1248, + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1825, + Iarg_facet ((1,true),0.5000,805, + Iarg_facet ((2,true),0.5000,933, + Iarg_leaf 1459))), + Iarg_facet ((0,false),0.5000,1548, + Iarg_facet ((1,true),0.5000,850, + Iarg_facet ((2,true),0.5000,1046, + Iarg_leaf 1337)))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1218, + Iarg_facet ((1,true),0.8520,916, + Iarg_leaf 1410)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1787, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1948, + Iarg_facet ((5,true),0.5000,1944, + Iarg_leaf 1962)), + Iarg_facet ((4,false),0.5000,1326, + Iarg_leaf 1564))), + Iarg_facet ((1,true),0.5000,1768, + Iarg_facet ((2,true),0.5000,1450, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,986, + Iarg_leaf 1065), + Iarg_facet ((5,false),0.5000,1062, + Iarg_leaf 1135)))))), + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1631, + Iarg_facet ((1,true),0.7492,722, + Iarg_facet ((2,true),0.7492,1184, + Iarg_leaf 972))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1870, + Iarg_facet ((3,true),0.5000,1466, + Iarg_leaf 1895)), + Iarg_bisect (4, + Iarg_facet ((3,false),0.5000,1273, + Iarg_facet ((5,false),0.5000,807, + Iarg_leaf 1435)), + Iarg_facet ((3,false),0.5000,1066, + Iarg_facet ((5,false),0.5000,843, + Iarg_leaf 1197)))), + Iarg_facet ((2,true),0.7650,1090, + Iarg_leaf 1414)), + Iarg_facet ((1,true),0.5000,1033, + Iarg_facet ((2,true),0.5000,846, + Iarg_facet ((4,false),0.5000,1998, + Iarg_facet ((3,false),0.5000,1095, + Iarg_leaf 1536))))))), + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,709, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6997,715, + Iarg_leaf 1437), + Iarg_facet ((1,true),0.5917,1055, + Iarg_facet ((2,true),0.5000,795, + Iarg_leaf 1419)))), + Iarg_facet ((3,false),0.5944,1264, + Iarg_bisect (0, + Iarg_facet ((1,true),0.6475,828, + Iarg_leaf 1694), + Iarg_facet ((1,true),0.6327,1051, + Iarg_leaf 1903))))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.7146,1275, + Iarg_facet ((1,true),0.5000,1480, + Iarg_facet ((2,true),0.8128,729, + Iarg_leaf 1388))), + Iarg_facet ((0,true),0.7603,1110, + Iarg_facet ((1,true),0.5000,1166, + Iarg_leaf 1850))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1545, + Iarg_leaf 1660), + Iarg_facet ((4,false),0.5000,1577, + Iarg_leaf 1619)), + Iarg_facet ((3,true),0.5000,1076, + Iarg_leaf 1080)), + Iarg_facet ((2,true),0.5000,1028, + Iarg_facet ((3,false),0.5000,1004, + Iarg_leaf 1548))), + Iarg_facet ((1,true),0.5000,1128, + Iarg_facet ((2,true),0.7186,1016, + Iarg_facet ((3,true),0.5000,1428, + Iarg_leaf 1836)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1734, + Iarg_facet ((5,false),0.5000,991, + Iarg_leaf 1201)), + Iarg_facet ((4,false),0.5000,1383, + Iarg_leaf 1662)), + Iarg_facet ((3,true),0.5000,1068, + Iarg_leaf 1114)), + Iarg_facet ((2,true),0.5000,1677, + Iarg_facet ((3,false),0.5000,1391, + Iarg_leaf 1466))), + Iarg_facet ((1,true),0.5000,1505, + Iarg_facet ((2,true),0.7486,867, + Iarg_leaf 1624))))), + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,912, + Iarg_leaf 1643), + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1796, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5628,872, + Iarg_leaf 991), + Iarg_facet ((2,true),0.5000,1627, + Iarg_facet ((3,true),0.5867,1187, + Iarg_facet ((4,true),0.5000,945, + Iarg_leaf 1070))))), + Iarg_facet ((0,true),0.5000,1569, + Iarg_facet ((1,false),0.5000,1633, + Iarg_facet ((2,true),0.5000,1452, + Iarg_leaf 1975)))))), + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_facet ((0,true),0.7727,1258, + Iarg_facet ((1,true),0.5000,885, + Iarg_facet ((2,true),0.7856,1149, + Iarg_leaf 1784))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_facet ((4,false),0.5000,1042, + Iarg_leaf 1181), + Iarg_facet ((4,true),0.5000,1048, + Iarg_leaf 1110)), + Iarg_facet ((5,true),0.5000,1596, + Iarg_leaf 1724)), + Iarg_facet ((3,false),0.5000,1281, + Iarg_leaf 1709)), + Iarg_facet ((2,true),0.5000,1462, + Iarg_facet ((3,false),0.5000,1911, + Iarg_facet ((5,false),0.5000,1075, + Iarg_leaf 1147)))), + Iarg_facet ((1,true),0.5000,1884, + Iarg_facet ((2,true),0.8135,1214, + Iarg_leaf 1590)))), + Iarg_bisect (4, + Iarg_facet ((0,true),0.7158,1255, + Iarg_facet ((1,true),0.5000,1763, + Iarg_facet ((2,true),0.6315,772, + Iarg_facet ((3,true),0.5000,888, + Iarg_leaf 1527)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1487, + Iarg_leaf 1992), + Iarg_facet ((4,true),0.5000,1063, + Iarg_leaf 1395)), + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1334, + Iarg_facet ((5,false),0.5000,777, + Iarg_leaf 1422)), + Iarg_facet ((4,false),0.5000,1148, + Iarg_leaf 1998))), + Iarg_facet ((2,true),0.5000,868, + Iarg_facet ((3,false),0.5000,1935, + Iarg_facet ((4,false),0.5000,1101, + Iarg_leaf 1563)))), + Iarg_facet ((1,true),0.5000,1089, + Iarg_facet ((2,true),0.7192,961, + Iarg_facet ((3,true),0.5000,1132, + Iarg_leaf 1694)))))), + Iarg_bisect (5, + Iarg_facet ((4,false),0.5000,1063, + Iarg_facet ((0,true),0.5000,1323, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5554,925, + Iarg_leaf 1468), + Iarg_facet ((2,true),0.5000,1255, + Iarg_facet ((5,false),0.5000,1208, + Iarg_leaf 1325))))), + Iarg_facet ((4,false),0.5000,1351, + Iarg_facet ((0,true),0.5000,1172, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5789,1104, + Iarg_facet ((3,true),0.7108,1244, + Iarg_leaf 1142)), + Iarg_facet ((2,true),0.5000,1533, + Iarg_facet ((3,true),0.6145,1201, + Iarg_facet ((4,false),0.5000,1062, + Iarg_leaf 1432))))))))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,886, + Iarg_leaf 1825), + Iarg_facet ((4,true),0.5000,908, + Iarg_leaf 1526)), + Iarg_facet ((3,false),0.5000,1385, + Iarg_leaf 1583)), + Iarg_facet ((2,true),0.5000,1434, + Iarg_facet ((3,true),0.5000,1495, + Iarg_leaf 1525))), + Iarg_facet ((1,true),0.5000,1565, + Iarg_facet ((2,true),0.5000,1707, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1145, + Iarg_leaf 1242), + Iarg_facet ((4,true),0.5000,1431, + Iarg_leaf 1537))))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1137, + Iarg_facet ((5,false),0.5000,1096, + Iarg_leaf 1170)), + Iarg_facet ((4,true),0.5000,1091, + Iarg_leaf 1816)), + Iarg_facet ((3,false),0.5000,1928, + Iarg_facet ((4,false),0.5000,1037, + Iarg_leaf 1278))), + Iarg_facet ((2,true),0.5000,1774, + Iarg_facet ((3,false),0.5000,1224, + Iarg_leaf 1421))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1941, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1116, + Iarg_leaf 1130), + Iarg_facet ((4,false),0.5000,1193, + Iarg_leaf 1381))), + Iarg_facet ((2,true),0.5000,892, + Iarg_leaf 1650)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1456, + Iarg_facet ((2,false),0.8065,1037, + Iarg_leaf 436)), + Iarg_facet ((1,true),0.5000,1514, + Iarg_facet ((2,true),0.5000,1468, + Iarg_facet ((3,false),0.5000,942, + Iarg_leaf 1123)))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1142, + Iarg_facet ((2,false),0.9204,1144, + Iarg_leaf 187)), + Iarg_facet ((1,true),0.5000,1839, + Iarg_facet ((2,true),0.5000,1480, + Iarg_leaf 1926))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5550,922, + Iarg_facet ((4,true),0.5000,1057, + Iarg_leaf 1060)), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,854, + Iarg_leaf 1422), + Iarg_facet ((4,false),0.5000,1084, + Iarg_leaf 1201))), + Iarg_bisect (1, + Iarg_facet ((2,false),0.5794,1007, + Iarg_leaf 1325), + Iarg_facet ((2,true),0.5000,1180, + Iarg_leaf 1685))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5495,823, + Iarg_facet ((4,false),0.5000,1004, + Iarg_leaf 1253)), + Iarg_facet ((2,true),0.5000,1874, + Iarg_leaf 1984)), + Iarg_facet ((1,false),0.5000,1596, + Iarg_facet ((2,true),0.5000,1171, + Iarg_leaf 1617)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1223, + Iarg_leaf 1756), + Iarg_facet ((1,false),0.5000,1965, + Iarg_facet ((2,false),0.5000,995, + Iarg_leaf 1423))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1310, + Iarg_leaf 1471), + Iarg_facet ((1,false),0.5000,1490, + Iarg_leaf 1946))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1231, + Iarg_facet ((5,true),0.5000,982, + Iarg_leaf 1277)), + Iarg_facet ((4,true),0.5000,984, + Iarg_leaf 1663)), + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1148, + Iarg_leaf 1309), + Iarg_facet ((4,false),0.5000,1335, + Iarg_leaf 1737))), + Iarg_facet ((2,true),0.5000,1593, + Iarg_facet ((3,false),0.5000,1638, + Iarg_facet ((4,true),0.5000,756, + Iarg_leaf 1456)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1667, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1375, + Iarg_leaf 1656), + Iarg_facet ((4,false),0.5000,1295, + Iarg_leaf 1572))), + Iarg_facet ((2,true),0.5000,1416, + Iarg_leaf 1778))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,947, + Iarg_leaf 1602), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1718, + Iarg_leaf 1843), + Iarg_facet ((4,true),0.5000,1578, + Iarg_leaf 1797))), + Iarg_facet ((2,true),0.5000,1758, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,749, + Iarg_leaf 1376), + Iarg_facet ((4,true),0.5000,998, + Iarg_leaf 1726)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1864, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1543, + Iarg_leaf 1782), + Iarg_facet ((4,false),0.5000,1500, + Iarg_leaf 1603))), + Iarg_facet ((2,true),0.5000,803, + Iarg_facet ((3,false),0.5000,1088, + Iarg_leaf 1507))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1129, + Iarg_facet ((2,false),0.7552,1293, + Iarg_leaf 1201)), + Iarg_facet ((1,true),0.5000,1800, + Iarg_bisect (2, + Iarg_facet ((3,false),0.5000,1196, + Iarg_leaf 1267), + Iarg_facet ((3,false),0.5000,1067, + Iarg_leaf 1318)))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1317, + Iarg_facet ((2,false),0.7795,1019, + Iarg_leaf 1219)), + Iarg_facet ((1,true),0.5000,1826, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1102, + Iarg_leaf 1169), + Iarg_facet ((3,false),0.5000,1013, + Iarg_leaf 1474)))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5525,890, + Iarg_facet ((4,false),0.5000,1398, + Iarg_leaf 1750)), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1088, + Iarg_leaf 1773), + Iarg_facet ((4,false),0.5000,1325, + Iarg_leaf 1607))), + Iarg_facet ((1,false),0.5000,1603, + Iarg_facet ((2,true),0.5000,1331, + Iarg_leaf 1436))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.7115,978, + Iarg_facet ((4,true),0.5000,1197, + Iarg_leaf 1418)), + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1288, + Iarg_leaf 1947), + Iarg_facet ((4,false),0.5000,1416, + Iarg_facet ((3,false),0.5000,919, + Iarg_leaf 1091)))), + Iarg_bisect (1, + Iarg_facet ((2,false),0.5927,1184, + Iarg_leaf 1045), + Iarg_facet ((2,true),0.5000,939, + Iarg_leaf 1820)))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1615, + Iarg_leaf 1866), + Iarg_facet ((1,false),0.5000,1891, + Iarg_facet ((2,false),0.5000,819, + Iarg_leaf 1215))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,963, + Iarg_facet ((2,false),0.9636,1247, + Iarg_leaf 231)), + Iarg_facet ((1,true),0.5000,1898, + Iarg_facet ((2,false),0.7063,977, + Iarg_leaf 1563))))))))));; + +add_case ("7550003505 1 1 2", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1573, + Iarg_facet ((2,true),0.5000,970, + Iarg_facet ((3,true),0.5000,1269, + Iarg_leaf 1613))), + Iarg_facet ((1,true),0.5000,843, + Iarg_leaf 1584)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1603, + Iarg_facet ((2,true),0.5000,751, + Iarg_facet ((3,false),0.5000,1021, + Iarg_leaf 1195))), + Iarg_facet ((1,true),0.5000,1037, + Iarg_leaf 1573))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1103, + Iarg_facet ((2,true),0.5000,1039, + Iarg_leaf 1390)), + Iarg_facet ((1,true),0.5000,783, + Iarg_leaf 1911)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1224, + Iarg_facet ((2,true),0.5000,1047, + Iarg_leaf 1767)), + Iarg_facet ((1,true),0.5000,1125, + Iarg_facet ((2,true),0.5000,728, + Iarg_facet ((3,false),0.5000,934, + Iarg_leaf 1070)))))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1218, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,861, + Iarg_leaf 1989), + Iarg_facet ((2,true),0.6285,803, + Iarg_leaf 1434)), + Iarg_facet ((1,true),0.5000,1058, + Iarg_leaf 1368))), + Iarg_facet ((5,false),0.5000,1189, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1895, + Iarg_facet ((2,true),0.5000,1256, + Iarg_leaf 1829)), + Iarg_facet ((1,true),0.5000,1371, + Iarg_facet ((2,true),0.5000,827, + Iarg_leaf 1512)))))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1586, + Iarg_bisect (2, + Iarg_facet ((5,false),0.5000,1375, + Iarg_facet ((3,true),0.5000,825, + Iarg_leaf 1159)), + Iarg_facet ((5,false),0.5000,781, + Iarg_facet ((3,false),0.5000,869, + Iarg_leaf 1179)))), + Iarg_facet ((1,true),0.5000,829, + Iarg_leaf 1548)), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1398, + Iarg_bisect (2, + Iarg_facet ((5,false),0.5000,956, + Iarg_leaf 1136), + Iarg_facet ((5,false),0.5000,1043, + Iarg_facet ((3,true),0.5000,902, + Iarg_leaf 1038)))), + Iarg_facet ((1,true),0.5000,1096, + Iarg_facet ((2,true),0.6229,830, + Iarg_leaf 1185)))), + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((5,false),0.5000,1244, + Iarg_leaf 1889), + Iarg_facet ((5,false),0.5000,1003, + Iarg_facet ((3,false),0.5000,934, + Iarg_leaf 1044))), + Iarg_facet ((2,true),0.6320,843, + Iarg_leaf 1147)), + Iarg_facet ((1,true),0.5000,1061, + Iarg_leaf 1564)), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1699, + Iarg_facet ((5,false),0.5000,1017, + Iarg_leaf 1155)), + Iarg_facet ((2,true),0.5000,852, + Iarg_leaf 1192)), + Iarg_facet ((1,true),0.5000,1847, + Iarg_facet ((2,true),0.5000,792, + Iarg_leaf 1484))))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1288, + Iarg_facet ((0,true),0.5000,854, + Iarg_facet ((1,true),0.6395,941, + Iarg_facet ((2,false),0.6552,942, + Iarg_facet ((5,false),0.5000,928, + Iarg_facet ((3,true),0.6426,834, + Iarg_leaf 1010)))))), + Iarg_facet ((5,false),0.5000,822, + Iarg_facet ((0,true),0.6262,887, + Iarg_leaf 1431))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,864, + Iarg_facet ((0,true),0.6499,836, + Iarg_leaf 1524)), + Iarg_facet ((5,false),0.6387,826, + Iarg_leaf 1290))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1481, + Iarg_facet ((0,true),0.5000,703, + Iarg_facet ((1,true),0.6094,1160, + Iarg_bisect (2, + Iarg_facet ((5,false),0.5000,1503, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1187, + Iarg_leaf 1542), + Iarg_facet ((4,true),0.5000,997, + Iarg_leaf 1179))), + Iarg_facet ((5,false),0.5000,1058, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1291, + Iarg_leaf 1713), + Iarg_facet ((4,true),0.5000,1555, + Iarg_leaf 1704))))))), + Iarg_facet ((5,false),0.5000,1292, + Iarg_facet ((0,true),0.6243,1187, + Iarg_facet ((1,true),0.6489,1073, + Iarg_bisect (2, + Iarg_facet ((4,true),0.5000,1559, + Iarg_facet ((5,false),0.5000,780, + Iarg_leaf 1860)), + Iarg_bisect (4, + Iarg_facet ((5,false),0.6797,753, + Iarg_leaf 1747), + Iarg_facet ((5,false),0.6533,841, + Iarg_leaf 1739))))))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1254, + Iarg_facet ((0,true),0.6198,1152, + Iarg_facet ((1,true),0.6556,1052, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1519, + Iarg_facet ((5,false),0.5000,786, + Iarg_leaf 1859)), + Iarg_bisect (3, + Iarg_facet ((5,false),0.6801,744, + Iarg_leaf 1741), + Iarg_facet ((5,false),0.6525,827, + Iarg_leaf 1748)))))), + Iarg_facet ((5,false),0.5000,1150, + Iarg_facet ((0,true),0.5000,887, + Iarg_facet ((1,true),0.5000,804, + Iarg_facet ((2,false),0.5000,1371, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1442, + Iarg_leaf 1582), + Iarg_facet ((4,true),0.5000,1070, + Iarg_leaf 1418))))))))), + Iarg_facet ((2,true),0.5000,898, + Iarg_facet ((3,true),0.5000,1265, + Iarg_leaf 1301))), + Iarg_facet ((1,true),0.6673,943, + Iarg_facet ((2,true),0.5000,858, + Iarg_facet ((3,false),0.5000,1031, + Iarg_leaf 1079)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1710, + Iarg_facet ((4,true),0.6418,724, + Iarg_leaf 1129)), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1070, + Iarg_facet ((0,true),0.6353,1040, + Iarg_facet ((1,true),0.6944,852, + Iarg_facet ((2,false),0.6379,1258, + Iarg_facet ((4,false),0.5000,1364, + Iarg_leaf 1500))))), + Iarg_facet ((5,false),0.5000,868, + Iarg_facet ((0,true),0.6449,877, + Iarg_leaf 1520))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,912, + Iarg_facet ((0,true),0.6235,954, + Iarg_facet ((1,true),0.6807,886, + Iarg_facet ((2,false),0.7426,802, + Iarg_leaf 1316)))), + Iarg_facet ((5,false),0.6385,834, + Iarg_leaf 990)))), + Iarg_facet ((2,true),0.5000,1236, + Iarg_leaf 1728)), + Iarg_facet ((1,true),0.5000,778, + Iarg_facet ((2,true),0.5000,1175, + Iarg_leaf 1619)))), + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,889, + Iarg_leaf 1981), + Iarg_facet ((5,false),0.5000,719, + Iarg_leaf 1465)), + Iarg_facet ((4,true),0.5000,1924, + Iarg_facet ((5,false),0.5000,985, + Iarg_leaf 1861))), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1068, + Iarg_facet ((0,true),0.6658,973, + Iarg_facet ((1,true),0.6152,752, + Iarg_facet ((2,false),0.6318,1279, + Iarg_facet ((3,false),0.5000,1707, + Iarg_leaf 1831))))), + Iarg_facet ((5,false),0.5000,901, + Iarg_facet ((0,true),0.6436,948, + Iarg_facet ((1,true),0.6704,941, + Iarg_facet ((2,false),0.7774,957, + Iarg_leaf 1319))))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,945, + Iarg_facet ((0,true),0.5000,708, + Iarg_facet ((1,true),0.7007,863, + Iarg_leaf 1480))), + Iarg_facet ((5,false),0.6255,892, + Iarg_leaf 1374)))), + Iarg_facet ((2,true),0.5000,1120, + Iarg_leaf 1549)), + Iarg_facet ((1,true),0.5000,726, + Iarg_facet ((2,true),0.5000,1246, + Iarg_facet ((3,true),0.5000,945, + Iarg_leaf 1205)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1793, + Iarg_leaf 1872), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1355, + Iarg_facet ((5,false),0.6585,867, + Iarg_leaf 1401)), + Iarg_facet ((4,true),0.5000,1196, + Iarg_leaf 1765))), + Iarg_facet ((2,false),0.5000,1022, + Iarg_leaf 1281)), + Iarg_facet ((1,true),0.5000,980, + Iarg_facet ((2,true),0.5000,1246, + Iarg_leaf 1630))))))), + Iarg_bisect (5, + Iarg_facet ((4,true),0.6709,1264, + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,1314, + Iarg_leaf 1810), + Iarg_facet ((5,false),0.6892,831, + Iarg_leaf 1757))), + Iarg_facet ((4,true),0.6294,787, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,false),0.5000,1100, + Iarg_leaf 1542), + Iarg_facet ((0,false),0.5000,886, + Iarg_facet ((1,true),0.5000,854, + Iarg_leaf 1416))), + Iarg_bisect (3, + Iarg_bisect (0, + Iarg_facet ((1,true),0.8084,1223, + Iarg_leaf 663), + Iarg_facet ((1,true),0.6780,866, + Iarg_leaf 1679)), + Iarg_facet ((0,false),0.5000,1413, + Iarg_leaf 1711)))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((3,true),0.9983,1837, + Iarg_leaf 1444), + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1728, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1618, + Iarg_leaf 1886), + Iarg_facet ((3,true),0.5000,728, + Iarg_leaf 1330))), + Iarg_facet ((1,true),0.5000,878, + Iarg_facet ((2,true),0.7801,855, + Iarg_leaf 1211))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1731, + Iarg_facet ((3,true),0.5000,1009, + Iarg_leaf 1405)), + Iarg_facet ((2,true),0.5000,847, + Iarg_leaf 1298)), + Iarg_facet ((1,true),0.5000,1463, + Iarg_facet ((2,true),0.6260,906, + Iarg_leaf 1168)))), + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1657, + Iarg_facet ((5,false),0.5000,928, + Iarg_leaf 1462)), + Iarg_facet ((4,true),0.5000,1243, + Iarg_leaf 1931)), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,961, + Iarg_facet ((0,true),0.6513,1051, + Iarg_leaf 1228)), + Iarg_facet ((5,false),0.5000,712, + Iarg_leaf 1650)), + Iarg_bisect (4, + Iarg_facet ((5,false),0.6172,854, + Iarg_leaf 1846), + Iarg_facet ((5,false),0.6356,827, + Iarg_leaf 1058)))), + Iarg_facet ((2,true),0.5000,1360, + Iarg_leaf 1821)), + Iarg_facet ((1,true),0.5000,757, + Iarg_facet ((2,true),0.5000,923, + Iarg_facet ((3,false),0.5000,999, + Iarg_leaf 1551)))), + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1922, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1329, + Iarg_leaf 1544), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1289, + Iarg_leaf 1785), + Iarg_facet ((4,true),0.5000,1193, + Iarg_leaf 1710)))), + Iarg_facet ((1,true),0.5000,1025, + Iarg_facet ((2,true),0.5000,1180, + Iarg_facet ((3,false),0.5000,1170, + Iarg_leaf 1656)))))), + Iarg_bisect (5, + Iarg_facet ((4,true),0.5000,1464, + Iarg_leaf 1529), + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1123, + Iarg_facet ((4,true),0.5000,1010, + Iarg_leaf 1647)), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1584, + Iarg_facet ((5,false),0.6366,774, + Iarg_leaf 1034)), + Iarg_facet ((4,true),0.5000,1058, + Iarg_leaf 1531))), + Iarg_facet ((2,true),0.5000,1066, + Iarg_facet ((3,false),0.5000,1038, + Iarg_leaf 1043))), + Iarg_facet ((1,true),0.5000,1113, + Iarg_facet ((2,true),0.5000,1239, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,1300, + Iarg_leaf 1486), + Iarg_facet ((4,true),0.5000,1040, + Iarg_leaf 1489))))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,false),0.5000,1290, + Iarg_facet ((3,true),0.5000,1429, + Iarg_facet ((4,true),0.5000,1043, + Iarg_leaf 1354))), + Iarg_facet ((2,true),0.5000,916, + Iarg_leaf 1708)), + Iarg_facet ((1,true),0.5000,1381, + Iarg_facet ((2,true),0.5000,1238, + Iarg_facet ((3,true),0.5000,1462, + Iarg_facet ((4,true),0.5000,1019, + Iarg_leaf 1171))))))))), + Iarg_facet ((5,false),0.6040,969, + Iarg_bisect (3, + Iarg_facet ((4,true),0.7458,1057, + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,736, + Iarg_leaf 1363), + Iarg_facet ((0,false),0.5000,1060, + Iarg_leaf 1511))), + Iarg_facet ((4,true),0.7462,757, + Iarg_facet ((5,false),0.6506,754, + Iarg_leaf 1752)))))));; + +add_case ("7550003505 0 0 1", + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1478, + Iarg_facet ((0,true),0.5000,837, + Iarg_facet ((1,true),0.7869,735, + Iarg_leaf 1286))), + Iarg_facet ((5,false),0.5000,1050, + Iarg_facet ((0,true),0.5000,1644, + Iarg_facet ((1,true),0.8851,1031, + Iarg_leaf 738)))), + Iarg_bisect (4, + Iarg_facet ((5,false),0.5661,729, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1458, + Iarg_facet ((3,true),0.5000,1577, + Iarg_leaf 1995)), + Iarg_facet ((2,true),0.7946,835, + Iarg_leaf 1168)), + Iarg_facet ((1,true),0.7063,944, + Iarg_leaf 1647))), + Iarg_facet ((5,false),0.5729,759, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1776, + Iarg_facet ((2,true),0.5000,1546, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1289, + Iarg_leaf 1319), + Iarg_facet ((4,false),0.5000,1005, + Iarg_leaf 1245)))), + Iarg_facet ((1,true),0.6248,970, + Iarg_facet ((2,true),0.5000,728, + Iarg_leaf 1747)))))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((0,true),0.5000,1525, + Iarg_facet ((1,true),0.8285,974, + Iarg_leaf 1357)), + Iarg_facet ((0,true),0.5000,1352, + Iarg_facet ((1,true),0.8578,963, + Iarg_leaf 980))), + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,1526, + Iarg_leaf 1729), + Iarg_facet ((3,false),0.5000,1425, + Iarg_leaf 1463)), + Iarg_facet ((5,true),0.5000,1828, + Iarg_facet ((3,false),0.5000,773, + Iarg_leaf 1359))), + Iarg_facet ((2,true),0.7103,1113, + Iarg_leaf 1728)), + Iarg_facet ((1,true),0.5000,1219, + Iarg_facet ((2,true),0.5000,1105, + Iarg_facet ((5,false),0.5000,1264, + Iarg_leaf 1783)))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,1751, + Iarg_facet ((4,false),0.5000,1087, + Iarg_leaf 1245)), + Iarg_facet ((3,false),0.5000,1243, + Iarg_leaf 1622)), + Iarg_facet ((5,true),0.5000,1159, + Iarg_leaf 1185)), + Iarg_facet ((2,true),0.6252,743, + Iarg_leaf 1672)), + Iarg_facet ((1,true),0.5000,1979, + Iarg_facet ((2,true),0.5000,1388, + Iarg_facet ((5,true),0.5000,1611, + Iarg_leaf 1650)))))), + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,900, + Iarg_leaf 1467), + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,987, + Iarg_leaf 1897), + Iarg_facet ((1,true),0.5000,1964, + Iarg_facet ((2,true),0.5000,1312, + Iarg_facet ((3,true),0.5000,1415, + Iarg_leaf 1469)))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,785, + Iarg_leaf 1501), + Iarg_facet ((1,true),0.5000,1675, + Iarg_facet ((2,true),0.5000,1237, + Iarg_facet ((3,false),0.5000,1038, + Iarg_leaf 1067)))))))), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,760, + Iarg_facet ((0,true),0.5000,1019, + Iarg_facet ((1,true),0.8384,1070, + Iarg_leaf 1792))), + Iarg_facet ((5,false),0.5996,873, + Iarg_bisect (0, + Iarg_facet ((1,true),0.5000,1429, + Iarg_facet ((2,true),0.5000,1474, + Iarg_bisect (4, + Iarg_facet ((3,true),0.5000,1310, + Iarg_leaf 1387), + Iarg_facet ((3,true),0.5000,1320, + Iarg_leaf 1672)))), + Iarg_facet ((1,true),0.6854,867, + Iarg_facet ((2,true),0.5000,1194, + Iarg_leaf 1402))))), + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_facet ((0,true),0.8561,824, + Iarg_facet ((1,true),0.8334,812, + Iarg_leaf 1609)), + Iarg_facet ((0,true),0.6249,1260, + Iarg_facet ((1,true),0.7417,994, + Iarg_facet ((2,true),0.7492,891, + Iarg_facet ((3,false),0.6780,972, + Iarg_leaf 1034))))), + Iarg_facet ((5,false),0.5000,828, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1977, + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1162, + Iarg_leaf 1264), + Iarg_facet ((5,true),0.5000,1360, + Iarg_leaf 1706)), + Iarg_facet ((4,true),0.5000,1289, + Iarg_leaf 1388))), + Iarg_facet ((2,true),0.8129,891, + Iarg_facet ((3,true),0.5000,1533, + Iarg_leaf 1676))), + Iarg_facet ((1,true),0.7095,1013, + Iarg_facet ((2,true),0.6188,789, + Iarg_leaf 1385)))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1342, + Iarg_facet ((1,true),0.8037,1259, + Iarg_facet ((2,true),0.7721,735, + Iarg_leaf 1386))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (4, + Iarg_facet ((5,true),0.5000,1691, + Iarg_facet ((3,false),0.5000,1051, + Iarg_leaf 1233)), + Iarg_facet ((5,true),0.5000,1596, + Iarg_facet ((3,true),0.5000,1110, + Iarg_leaf 1155))), + Iarg_facet ((4,false),0.5000,1330, + Iarg_leaf 1366)), + Iarg_facet ((2,true),0.5954,731, + Iarg_facet ((4,false),0.5000,962, + Iarg_leaf 1521))), + Iarg_facet ((1,true),0.5000,1758, + Iarg_facet ((2,true),0.5000,1715, + Iarg_bisect (4, + Iarg_facet ((5,false),0.5000,1129, + Iarg_leaf 1177), + Iarg_facet ((5,false),0.5000,1047, + Iarg_leaf 1245)))))), + Iarg_facet ((3,false),0.5000,983, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,957, + Iarg_facet ((2,true),0.7939,779, + Iarg_leaf 1245)), + Iarg_facet ((1,true),0.5000,1617, + Iarg_facet ((2,true),0.5000,929, + Iarg_facet ((4,false),0.5000,1233, + Iarg_leaf 1361)))))), + Iarg_bisect (5, + Iarg_bisect (3, + Iarg_facet ((0,true),0.5000,1805, + Iarg_facet ((1,true),0.7414,924, + Iarg_facet ((2,true),0.8061,1119, + Iarg_leaf 846))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (5, + Iarg_facet ((3,true),0.5000,1574, + Iarg_facet ((4,true),0.5000,955, + Iarg_leaf 1128)), + Iarg_facet ((3,true),0.5000,1084, + Iarg_leaf 1387)), + Iarg_facet ((5,true),0.5000,1553, + Iarg_leaf 1881)), + Iarg_facet ((2,true),0.6988,1192, + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,1509, + Iarg_facet ((4,false),0.5000,814, + Iarg_leaf 1545)), + Iarg_facet ((3,false),0.5000,1333, + Iarg_leaf 1935)))), + Iarg_facet ((1,true),0.5000,992, + Iarg_facet ((2,true),0.5000,1063, + Iarg_bisect (5, + Iarg_facet ((3,false),0.5000,889, + Iarg_leaf 1266), + Iarg_facet ((3,false),0.5000,1200, + Iarg_leaf 1663)))))), + Iarg_facet ((3,false),0.5000,1296, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,922, + Iarg_facet ((2,true),0.7487,1204, + Iarg_facet ((3,false),0.5000,763, + Iarg_leaf 1230))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,872, + Iarg_facet ((3,false),0.5000,1428, + Iarg_leaf 1798)), + Iarg_facet ((2,true),0.8666,881, + Iarg_leaf 657)))))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_facet ((3,true),0.9979,1277, + Iarg_leaf 1283), + Iarg_facet ((3,true),0.9980,1270, + Iarg_leaf 1488)), + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((5,true),0.5000,1837, + Iarg_facet ((4,true),0.5000,1362, + Iarg_leaf 1382)), + Iarg_facet ((5,false),0.5000,740, + Iarg_leaf 1768)), + Iarg_facet ((3,true),0.5000,1811, + Iarg_facet ((5,false),0.5000,1279, + Iarg_leaf 1404))), + Iarg_facet ((2,true),0.5000,1595, + Iarg_facet ((3,true),0.5000,1334, + Iarg_leaf 1634))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1632, + Iarg_bisect (3, + Iarg_facet ((5,true),0.5000,1491, + Iarg_leaf 1591), + Iarg_facet ((5,false),0.7493,1045, + Iarg_leaf 910))), + Iarg_facet ((2,true),0.6859,790, + Iarg_leaf 1219))), + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_bisect (5, + Iarg_facet ((4,true),0.5000,1401, + Iarg_leaf 1414), + Iarg_facet ((4,false),0.5000,1019, + Iarg_leaf 1050)), + Iarg_facet ((5,false),0.5000,781, + Iarg_leaf 1740)), + Iarg_facet ((3,true),0.5000,1558, + Iarg_leaf 1907)), + Iarg_facet ((2,true),0.5000,1607, + Iarg_facet ((3,true),0.5000,1881, + Iarg_facet ((5,false),0.5000,1019, + Iarg_leaf 1120)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1613, + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,1242, + Iarg_leaf 1352), + Iarg_facet ((5,false),0.7655,1167, + Iarg_leaf 792))), + Iarg_facet ((2,true),0.5000,881, + Iarg_leaf 1861)))), + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1398, + Iarg_facet ((2,true),0.5000,1908, + Iarg_facet ((3,false),0.5000,1352, + Iarg_leaf 1570))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((4,true),0.5000,825, + Iarg_leaf 1146), + Iarg_facet ((4,true),0.5000,960, + Iarg_leaf 1309)), + Iarg_facet ((3,false),0.5000,1025, + Iarg_leaf 1491)), + Iarg_facet ((2,true),0.5000,1535, + Iarg_facet ((3,false),0.5000,1292, + Iarg_leaf 1905)))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1307, + Iarg_facet ((2,true),0.5000,1284, + Iarg_facet ((3,false),0.5000,1234, + Iarg_leaf 1718))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1901, + Iarg_facet ((3,false),0.5000,1575, + Iarg_leaf 1822)), + Iarg_facet ((2,true),0.5000,1298, + Iarg_facet ((3,false),0.5000,1154, + Iarg_leaf 1356)))))), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_facet ((0,true),0.5000,1317, + Iarg_leaf 1474), + Iarg_facet ((0,true),0.5000,1060, + Iarg_leaf 1505)), + Iarg_bisect (4, + Iarg_bisect (0, + Iarg_facet ((1,false),0.5673,1251, + Iarg_facet ((2,false),0.5000,1821, + Iarg_facet ((3,true),0.5000,975, + Iarg_leaf 1031))), + Iarg_bisect (1, + Iarg_facet ((2,false),0.5677,958, + Iarg_facet ((3,true),0.6626,1005, + Iarg_leaf 1174)), + Iarg_bisect (2, + Iarg_facet ((3,true),0.5555,956, + Iarg_facet ((4,true),0.5000,1179, + Iarg_leaf 1602)), + Iarg_facet ((3,false),0.5000,1548, + Iarg_facet ((4,true),0.5000,1049, + Iarg_facet ((5,false),0.7644,1213, + Iarg_leaf 1698)))))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5692,1046, + Iarg_facet ((2,true),0.5000,1377, + Iarg_leaf 1792)), + Iarg_facet ((1,false),0.5000,1880, + Iarg_bisect (2, + Iarg_facet ((3,true),0.6598,1083, + Iarg_leaf 1176), + Iarg_facet ((3,false),0.5000,865, + Iarg_leaf 1162)))))))), + Iarg_bisect (5, + Iarg_bisect (4, + Iarg_facet ((3,true),0.9983,1293, + Iarg_leaf 1548), + Iarg_facet ((3,true),0.9993,1235, + Iarg_leaf 1728)), + Iarg_bisect (3, + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1893, + Iarg_facet ((4,true),0.5000,1790, + Iarg_facet ((5,true),0.5000,1014, + Iarg_leaf 1420))), + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1168, + Iarg_leaf 1257), + Iarg_facet ((4,false),0.5000,926, + Iarg_leaf 1098))), + Iarg_facet ((2,true),0.5000,1416, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1268, + Iarg_leaf 1521), + Iarg_facet ((4,false),0.5000,1239, + Iarg_leaf 1289)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1929, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,1596, + Iarg_leaf 1731), + Iarg_facet ((4,false),0.5000,1092, + Iarg_leaf 1234))), + Iarg_facet ((2,true),0.5000,1355, + Iarg_leaf 1653))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,1178, + Iarg_facet ((2,true),0.5000,1206, + Iarg_facet ((3,false),0.5000,1720, + Iarg_facet ((4,true),0.5000,1079, + Iarg_leaf 1103)))), + Iarg_bisect (1, + Iarg_facet ((2,true),0.5000,1542, + Iarg_bisect (3, + Iarg_facet ((4,false),0.5000,938, + Iarg_leaf 1119), + Iarg_facet ((4,false),0.5000,1015, + Iarg_leaf 1067))), + Iarg_facet ((2,true),0.5000,1401, + Iarg_facet ((3,false),0.5000,1413, + Iarg_leaf 1870))))), + Iarg_bisect (5, + Iarg_bisect (0, + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.7166,744, + Iarg_leaf 1025), + Iarg_bisect (3, + Iarg_facet ((5,true),0.5000,1294, + Iarg_leaf 1529), + Iarg_facet ((5,false),0.7491,1153, + Iarg_leaf 817))), + Iarg_facet ((2,true),0.5000,1712, + Iarg_bisect (3, + Iarg_facet ((5,true),0.5000,1898, + Iarg_leaf 1997), + Iarg_facet ((5,false),0.7485,1077, + Iarg_leaf 820)))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_bisect (3, + Iarg_facet ((5,false),0.5000,1654, + Iarg_leaf 1906), + Iarg_facet ((5,false),0.7493,954, + Iarg_leaf 849)), + Iarg_facet ((3,false),0.5000,1187, + Iarg_leaf 1249)), + Iarg_facet ((2,true),0.5000,792, + Iarg_leaf 1714))), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5000,892, + Iarg_facet ((2,true),0.5000,1656, + Iarg_facet ((3,true),0.5000,1668, + Iarg_leaf 1977))), + Iarg_bisect (1, + Iarg_bisect (2, + Iarg_facet ((3,true),0.5000,1793, + Iarg_facet ((4,true),0.5000,975, + Iarg_leaf 1101)), + Iarg_facet ((3,false),0.5000,826, + Iarg_leaf 1217)), + Iarg_facet ((2,true),0.5000,1164, + Iarg_facet ((3,false),0.5000,1744, + Iarg_facet ((4,false),0.5000,1085, + Iarg_leaf 1246))))))), + Iarg_bisect (4, + Iarg_bisect (5, + Iarg_facet ((0,true),0.5000,1355, + Iarg_leaf 1830), + Iarg_bisect (0, + Iarg_facet ((1,false),0.5709,1082, + Iarg_facet ((2,true),0.5000,1398, + Iarg_facet ((4,true),0.5000,1023, + Iarg_leaf 1127))), + Iarg_facet ((1,false),0.5000,1676, + Iarg_facet ((2,true),0.5000,1866, + Iarg_facet ((4,false),0.5000,1081, + Iarg_leaf 1238))))), + Iarg_bisect (5, + Iarg_facet ((0,false),0.5000,1171, + Iarg_leaf 1238), + Iarg_bisect (0, + Iarg_facet ((1,false),0.6303,1084, + Iarg_facet ((2,false),0.5000,1171, + Iarg_leaf 1718)), + Iarg_bisect (1, + Iarg_facet ((2,false),0.6362,1037, + Iarg_leaf 1070), + Iarg_facet ((2,true),0.5000,1666, + Iarg_facet ((3,true),0.6098,1163, + Iarg_facet ((4,false),0.5000,1126, + Iarg_leaf 1321))))))))))));; + +(* END HERE, 2013/08/05. *) + +end;; diff --git a/text_formalization/nonlinear/calc_derivative.hl b/text_formalization/nonlinear/calc_derivative.hl new file mode 100644 index 0000000..4601708 --- /dev/null +++ b/text_formalization/nonlinear/calc_derivative.hl @@ -0,0 +1,1508 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Section: Counting Spheres *) +(* Chapter: packing *) +(* Author: Thomas C. Hales *) +(* Date: 2011-06-22 *) +(* ========================================================================== *) + +(* Example: + to put all terms over a common denominator : + + rationalize `-- (v/ u pow 3)/(&1/x + &3 * (-- (u /( v * inv (w)))))`;; + + To prove a rational identity, modulo accumulated side conditions: + + rational_identity `&1 / (x + y) - &1 / (x - y) = -- &2 * y / (x pow 2 - y pow 2)`;; +*) + + +(* + + written to automate the calculation of derivatives, with accumulating side conditions. + It implements --, -, +, *, /, inv, pow, sqrt, sin, cos, atn, asn, acs, chain rule. + + To recover results without "within" use: + + "WITHINREAL_UNIV", |- !a. atreal x within (:real) = atreal x) + + derived_form p f f' x s means: + Under the assumption p, the derivative of the function f evaluated at x, + on the interval s + is equal to the real number f'. + + Apply REWRITE_RULE[derived_form] to express the result back in terms of + has_real_derivative. + + (* A rational inequality implies a polynomial ineq with + denominators cleared. Allowed ops <,>, <=,>=,=,~=,*) + + val rational_ineq_rule : thm -> thm + +*) + + + +(* Example: + +To calculate the derivative of tm with respect to q, evaluated at x, on the interval s: + + let th1 = + let x = `x:real` in + let s = `{t | t > &0}` in + let tm = `(\q:real. (q - sin(q pow 3) + q pow 7 + y)/(q pow 2 + q pow 4 *(&33 + &43 * q)) + (q pow 3) * ((q pow 2) / (-- (q pow 3))))` in + differentiate tm x s;; + +*) + + +module Calc_derivative + +(*: sig + + val ratform : thm + val rationalize_ratform: term -> thm + + val rationalize: term -> thm + val rational_identity:term -> thm + val rational_ineq_rule : thm -> thm + + val invert_den_lt :thm + val invert_den_le: thm + + val derived_form:thm + val differentiate:term -> term -> term -> thm + + end *) = struct + + +(* ========================================================================== *) +(* RATIONALIZE CONVERSION *) + + +(* +rationalize puts everything over a common denominator, accumulating +assumptions as it goes. +*) + + +let ratform = new_definition `ratform p r a b = (p ==> ~(b = &0) /\ (r = a/b))`;; + +let ratform_tac = REWRITE_TAC [ratform] THEN + REPEAT STRIP_TAC THENL + [ASM_MESON_TAC[REAL_ENTIRE] ; + REPEAT (FIRST_X_ASSUM (fun t -> MP_TAC t THEN ANTS_TAC THEN + ASM_REWRITE_TAC[])) THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + REPEAT (POP_ASSUM MP_TAC) THEN + CONV_TAC REAL_FIELD];; + +let REAL_POW_NEQ_0 = prove_by_refinement( + `!x n. ~(x pow n = &0) <=> ~(x = &0) \/ (n = 0)`, + (* {{{ proof *) + [ + MESON_TAC[REAL_POW_EQ_0]; + ]);; + (* }}} *) + +let ratform_pow = prove_by_refinement( + `ratform p1 r1 a1 b1 ==> ratform p1 (r1 pow n) (a1 pow n) (b1 pow n)`, + (* {{{ proof *) + [ + REWRITE_TAC[GSYM REAL_POW_DIV;ratform]; + MESON_TAC[REAL_POW_NEQ_0;]; + ]);; + (* }}} *) + +let ratform_add = prove_by_refinement( + `ratform p1 r1 a1 b1 /\ ratform p2 r2 a2 b2 ==> ratform (p1 /\ p2) (r1 + r2) (a1 * b2 + b1 * a2) (b1 * b2)`, + (* {{{ proof *) + [ + ratform_tac; + ]);; + (* }}} *) + +let ratform_sub = prove_by_refinement( + `ratform p1 r1 a1 b1 /\ ratform p2 r2 a2 b2 ==> ratform (p1 /\ p2) (r1 - r2) (a1 * b2 - b1 * a2) (b1 * b2)`, + (* {{{ proof *) + [ + ratform_tac; + ]);; + (* }}} *) + +let ratform_neg = prove_by_refinement( + `ratform p1 r1 a1 b1 ==> ratform p1 (-- r1 ) (-- a1 ) (b1)`, + (* {{{ proof *) + [ + ratform_tac; + ]);; + (* }}} *) + +let ratform_mul = prove_by_refinement( + `ratform p1 r1 a1 b1 /\ ratform p2 r2 a2 b2 ==> ratform (p1 /\ p2) (r1 * r2) (a1 * a2) (b1 * b2)`, + (* {{{ proof *) + [ + ratform_tac; + ]);; + (* }}} *) + +let ratform_div = prove_by_refinement( + `ratform p1 r1 a1 b1 /\ ratform p2 r2 a2 b2 ==> ratform (p1 /\ p2 /\ ~(a2 = &0)) (r1 / r2) (a1 * b2) (b1 * a2)`, + (* {{{ proof *) + [ + ratform_tac; + ]);; + (* }}} *) + +let ratform_inv = prove_by_refinement( + `ratform p1 r1 a1 b1 ==> ratform (p1 /\ ~(a1= &0)) (inv r1) b1 a1`, + (* {{{ proof *) + [ + REWRITE_TAC [ratform;]; + REPEAT STRIP_TAC; + ASM_MESON_TAC[REAL_ENTIRE]; + REPEAT (FIRST_X_ASSUM (fun t -> MP_TAC t THEN ANTS_TAC THEN ASM_REWRITE_TAC[])); + REPEAT STRIP_TAC; + ASM_REWRITE_TAC[REAL_INV_DIV]; + ]);; + (* }}} *) + +let trivial_ratform = prove_by_refinement( + `!t. ratform T t t (&1)`, + (* {{{ proof *) + [ + REWRITE_TAC[ratform]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let pre_rationalize = + let binop_assoc = [(`(+)`,ratform_add); + (`( * )`,ratform_mul);(`( - )`,ratform_sub); + (`( / )`,ratform_div)] in + let unary_assoc = [(` ( -- )`,ratform_neg);(`inv`,ratform_inv)] in + let rec pre_rationalize tm = + try ( + let (x,y) = dest_binop `(pow)` tm in + MATCH_MP (INST [y,`n:num`] ratform_pow) (pre_rationalize x) + ) + with _ -> + try ( + let h = fst (strip_comb tm) in + let bin_th = assoc h binop_assoc in + let (x,y) = dest_binop h tm in + MATCH_MP bin_th (CONJ (pre_rationalize x) (pre_rationalize y)) + ) + with _ -> ( + try ( + let (h,x) = dest_comb tm in + let un_th = assoc h unary_assoc in + MATCH_MP un_th (pre_rationalize x) + ) + with _ -> SPEC tm trivial_ratform) in + pre_rationalize;; + +let clean_conv = + let ra = REAL_ARITH `&1 * x = x /\ x * &1 = x /\ &0 * x = &0 /\ + x * &0 = &0 /\ &0+x = x /\ x + &0 = x /\ x - &0 = x /\ &0 - x = -- x ` in + REWRITE_CONV[REAL_POW_NEQ_0;GSYM CONJ_ASSOC; + TAUT `~(p \/ q) <=> ~p /\ ~q`; + REAL_POW_POW;REAL_POW_1;real_pow;REAL_POW_ONE; + REAL_ENTIRE; + ra] + THENC NUM_REDUCE_CONV;; + +let dest_ratform rf = snd(strip_comb rf);; + +let rationalize_ratform = + let rc = clean_conv in + let clean_ratform = MESON[] + `ratform p r a b /\ (p = p') /\ (a = a') /\ (b = b') ==> ratform p' r a' b'` in + fun tm -> + let pr = pre_rationalize tm in + let [p;_;a;b] = dest_ratform (concl pr) in + let p' = rc p in + let a' = rc a in + let b' = rc b in + MATCH_MP clean_ratform (end_itlist CONJ [pr;p';a';b']);; + +let rationalize = + REWRITE_RULE[ratform] o rationalize_ratform;; + +(* example: +rationalize `-- (v/ u pow 3)/(&1/x + &3 * (-- (u /( v * inv (w)))))`;; +*) + + +let lite_imp = prove_by_refinement( + `ratform p (u - v) a b /\ (p = p') /\ (a = &0) ==> (p' ==> (u = v))`, + (* {{{ proof *) + [ + REWRITE_TAC[ratform]; + ASM_MESON_TAC[REAL_ARITH `(u = v) <=> u - v = &0 /b`]; + ]);; + (* }}} *) + +let lite_imp2 = prove_by_refinement( + `ratform p (u - v) a b /\ (p = p') /\ (a = a') ==> ((p' /\ (a' = &0)) ==> (u = v))`, + (* {{{ proof *) + [ + REWRITE_TAC[ratform]; + ASM_MESON_TAC[REAL_ARITH `(u = v) <=> u - v = &0 /b`]; + ]);; + (* }}} *) + +let rational_identity = + let sub = `( - )` in + fun tm -> + let (lhs,rhs) = dest_eq tm in + let diff = mk_binop sub lhs rhs in + let rf = pre_rationalize diff in + let [p;_;a;_]=dest_ratform (concl rf) in + let p' = clean_conv p in + let a' = clean_conv a in + try ( + let zero = REAL_FIELD (mk_eq (a,`&0`)) in + MATCH_MP (lite_imp) (end_itlist CONJ [rf ;p';zero]) + ) + with _ -> MATCH_MP (lite_imp2) (end_itlist CONJ [rf;p';a']);; + +let CALC_ID_TAC gl = (MATCH_MP_TAC (rational_identity (goal_concl gl))) gl;; + +let invert_den_lt = prove_by_refinement( + `!a b. &0 < a/b <=> &0 < a*b`, + (* {{{ proof *) +[ + REPEAT GEN_TAC; +REWRITE_TAC [real_div]; +REWRITE_TAC [REAL_MUL_POS_LT]; +REWRITE_TAC [REAL_ARITH `inv x < &0 <=> &0 < -- inv x`]; +REWRITE_TAC [GSYM REAL_INV_NEG]; +REWRITE_TAC [REAL_LT_INV_EQ]; +REAL_ARITH_TAC + ]);; + (* }}} *) + +let invert_den_le = prove_by_refinement( + `!a b. &0 <= a/b <=> &0 <= a*b`, + (* {{{ proof *) +[ + REPEAT GEN_TAC; +REWRITE_TAC [real_div]; +REWRITE_TAC [REAL_MUL_POS_LE]; +REWRITE_TAC [REAL_ARITH `inv x < &0 <=> &0 < -- inv x`]; +REWRITE_TAC [GSYM REAL_INV_NEG]; +REWRITE_TAC [REAL_LT_INV_EQ;Real_ext.REAL_PROP_ZERO_INV]; +REAL_ARITH_TAC + ]);; + (* }}} *) + +let invert_den_eq = prove_by_refinement( + `!a b. (a/b = &0) <=> ( a*b = &0)`, + (* {{{ proof *) +[ + REPEAT GEN_TAC; +REWRITE_TAC [real_div]; +REWRITE_TAC [REAL_ENTIRE]; +REWRITE_TAC [REAL_LT_INV_EQ;Real_ext.REAL_PROP_ZERO_INV]; + ]);; + (* }}} *) + +let imp_lt = prove_by_refinement( + `!p p' x a a' b b'. (&0 < x) /\ (ratform p x a b) /\ (p = p') /\ (a = a') /\ (b = b') ==> (p' ==> &0 < a' * b')`, + (* {{{ proof *) +[ +REWRITE_TAC [ratform]; +REPEAT STRIP_TAC ; +ASM_MESON_TAC [invert_den_lt] +]);; + (* }}} *) + + +let imp_le = prove_by_refinement( + `!p p' x a a' b b'. (&0 <= x) /\ (ratform p x a b) /\ (p = p') /\ (a = a') /\ (b = b') ==> (p' ==> &0 <= a' * b')`, + (* {{{ proof *) +[ +REWRITE_TAC [ratform]; +REPEAT STRIP_TAC ; +ASM_MESON_TAC [invert_den_le] +]);; + (* }}} *) + +let imp_eq = prove_by_refinement( + `!p p' x a a' b b'. (x= &0) /\ (ratform p x a b) /\ (p = p') /\ (a = a') /\ (b = b') ==> (p' /\ ~(b' = &0) ==> (a'= &0 ))`, + (* {{{ proof *) +[ +REWRITE_TAC [ratform]; +REPEAT STRIP_TAC ; +ASM_MESON_TAC [invert_den_eq;REAL_ENTIRE] +]);; + (* }}} *) + + +let imp_nz = prove_by_refinement( + `!p p' x a a' b b'. ~(x= &0) /\ (ratform p x a b) /\ (p = p') /\ (a = a') /\ (b = b') ==> (p' ==> (~(a' = &0) /\ ~(b' = &0)))`, + (* {{{ proof *) +[ +REWRITE_TAC [ratform]; +REPEAT STRIP_TAC THEN ASM_MESON_TAC [invert_den_eq;REAL_ENTIRE] +]);; + (* }}} *) + +let dest_nz = + let neg = `(~)` in + fun tm -> + let (a,b) = dest_comb tm in + let _ = (a = neg) or failwith "not a negation" in + dest_eq b;; + +(* clear the denominator of an inequality *) + +let rational_ineq_rule = + let lt = `(<)` in + let le = `(<=)` in + let ra1 = REAL_ARITH `a < b <=> &0 < b - a` in + let ra2 = REAL_ARITH `a <= b <=> &0 <= b - a` in + let ra3 = REAL_ARITH `(x = y) <=> (x - y = &0)` in + let ineq_types = + [snd o (dest_binop lt ), imp_lt; + snd o (dest_binop le ), imp_le; + fst o (dest_eq ), imp_eq; + fst o (dest_nz), imp_nz] in + fun thm -> + let thm' = REWRITE_RULE[real_gt;real_ge] thm in + let thm' = ONCE_REWRITE_RULE [ra1] thm' in + let thm' = ONCE_REWRITE_RULE [ra2] thm' in + let thm' = ONCE_REWRITE_RULE [ra3] thm' in + let (diff,imp) = tryfind (fun (d,imp) -> (d(concl thm'),imp)) ineq_types in + let rf = pre_rationalize diff in + let [p;_;a;b]=dest_ratform (concl rf) in + let p' = clean_conv p in + let a' = clean_conv a in + let b' = clean_conv b in + let thm' = MATCH_MP (imp) (end_itlist CONJ [thm';rf ;p';a';b']) in + thm';; + +(* Example: + +rational_identity `(&1 / u - &1/v) pow 2 = inv u pow 2 - &2 * inv (u * v) + inv v pow 2`;; + +rational_identity `&1 / (x + y) - &1 / (x - y) = -- &2 * y / (x pow 2 - y pow 2)`;; + +rational_ineq_rule (ASSUME `a / (b * e) < c / (&2 * b)`);; + +*) + + +(* ========================================================================== *) +(* DERIV FORM *) + + + let derived_form = new_definition + `derived_form p f f' x s = (p ==> (f has_real_derivative f') (atreal x within s))`;; + + let deriv_tac = REWRITE_TAC[derived_form] THEN +(* REPEAT GEN_TAC THEN + COND_CASES_TAC THEN + REWRITE_TAC[] THEN *) + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + FIRST (map MATCH_MP_TAC [ + HAS_REAL_DERIVATIVE_ADD; + HAS_REAL_DERIVATIVE_SUB; + HAS_REAL_DERIVATIVE_MUL_ATREAL; + HAS_REAL_DERIVATIVE_MUL_WITHIN; + HAS_REAL_DERIVATIVE_DIV_ATREAL; + HAS_REAL_DERIVATIVE_DIV_WITHIN; + HAS_REAL_DERIVATIVE_NEG; + HAS_REAL_DERIVATIVE_POW_WITHIN; + HAS_REAL_DERIVATIVE_POW_ATREAL + ]) THEN + ASM_MESON_TAC[];; + + +(* OLD u versions: + + let derived_form_add = prove_by_refinement( + `!x s. derived_form p1 f1 f1' x s /\ derived_form p2 f2 f2' x s /\ (u = (\x. f1 x + f2 x)) ==> derived_form (p1 /\ p2) u (f1'+f2') x s`, + (* {{{ proof *) + [ + deriv_tac; + ]);; + (* }}} *) + + let derived_form_sub = prove_by_refinement( + `!x s. derived_form p1 f1 f1' x s /\ derived_form p2 f2 f2' x s /\ (u = (\x. f1 x - f2 x)) ==> derived_form (p1 /\ p2) u (f1'-f2') x s`, + (* {{{ proof *) + [ + deriv_tac; + ]);; + (* }}} *) + + let derived_form_mul = prove_by_refinement( + `!x s. derived_form p1 f1 f1' x s /\ derived_form p2 f2 f2' x s /\ (u = (\x. f1 x * f2 x)) ==> derived_form (p1 /\ p2) u (f1 x * f2' + f1' * f2 x) x s`, + (* {{{ proof *) + [ + deriv_tac; + ]);; + (* }}} *) + + let derived_form_div = prove_by_refinement( + `!x s. derived_form p1 f1 f1' x s /\ derived_form p2 f2 f2' x s /\ (u = (\x. f1 x / f2 x) ) ==> derived_form (p1 /\ p2 /\ ~(f2 x = &0)) u ((f1' * f2 x - f1 x * f2')/(f2 x pow 2)) x s`, + (* {{{ proof *) + [ + deriv_tac; + ]);; + (* }}} *) + + let derived_form_neg = prove_by_refinement( + `!x s. derived_form p1 f1 f1' x s /\ (u = (\x. -- f1 x)) ==> derived_form p1 u (-- f1') x s`, + (* {{{ proof *) + [ + deriv_tac; + ]);; + (* }}} *) + + let derived_form_pow = prove_by_refinement( + `!x s. derived_form p f f' x s /\ (u = (\x. f x pow n)) ==> derived_form p u (&n * f x pow (n-1)* f') x s`, + (* {{{ proof *) + [ + deriv_tac; + ]);; + (* }}} *) + + let deriv_fn_tac = REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[derived_form] THEN + (* COND_CASES_TAC THEN *) + ASM_MESON_TAC[ HAS_REAL_DERIVATIVE_CONST; + HAS_REAL_DERIVATIVE_ATREAL_WITHIN; + HAS_REAL_DERIVATIVE_SIN; + HAS_REAL_DERIVATIVE_COS; + HAS_REAL_DERIVATIVE_SQRT; + HAS_REAL_DERIVATIVE_ATN; + HAS_REAL_DERIVATIVE_ACS; + HAS_REAL_DERIVATIVE_ASN; + HAS_REAL_DERIVATIVE_INV_BASIC; + ];; + + let derived_form_const = prove_by_refinement( + `!x s. (u = \x. c) ==> derived_form T u (&0) x s`, + (* {{{ proof *) + [ + deriv_fn_tac; + ]);; + (* }}} *) + + let derived_form_sin = prove_by_refinement( + `!x s. derived_form T sin (cos x) x s`, + (* {{{ proof *) + [ + deriv_fn_tac; + ]);; + (* }}} *) + + let derived_form_cos = prove_by_refinement( + `!x s. derived_form T cos (-- sin x) x s`, + (* {{{ proof *) + [ + deriv_fn_tac; + ]);; + (* }}} *) + + let derived_form_sqrt = prove_by_refinement( + `!x s. derived_form (&0 < x) sqrt (inv (&2 * sqrt x)) x s`, + (* {{{ proof *) + [ + deriv_fn_tac; + ]);; + (* }}} *) + + let derived_form_atn = prove_by_refinement( + `!x s. derived_form T atn (inv (&1 + x pow 2)) x s`, + (* {{{ proof *) + [ + deriv_fn_tac; + ]);; + (* }}} *) + + let derived_form_acs = prove_by_refinement( + `!x s. derived_form (abs x < &1) acs (-- inv (sqrt(&1 - x pow 2))) x s`, + (* {{{ proof *) + [ + deriv_fn_tac; + ]);; + (* }}} *) + + let derived_form_asn = prove_by_refinement( + `!x s. derived_form (abs x < &1) asn ( inv (sqrt(&1 - x pow 2))) x s`, + (* {{{ proof *) + [ + deriv_fn_tac; + ]);; + (* }}} *) + + + let derived_form_inv = prove_by_refinement( + `!x s. derived_form (~(x = &0)) inv (-- inv (x pow 2)) x s`, + (* {{{ proof *) + [ + deriv_fn_tac; + ]);; + (* }}} *) + + let derived_form_id = prove_by_refinement( + `!x s. (u = (\x. x)) ==>derived_form T u (&1) x s`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + ASM_REWRITE_TAC[derived_form;HAS_REAL_DERIVATIVE_ID]; + ]);; + (* }}} *) + + let derived_form_chain = prove_by_refinement( + `!x s. derived_form p g g' (f x) (:real) /\ derived_form p' f f' x s /\ (u = (\x. g(f x))) ==> derived_form (p /\ p' ) u (f' * g') x s`, + (* {{{ proof *) + [ + REWRITE_TAC[derived_form]; + REPEAT STRIP_TAC; + MP_TAC (SPECL [`(\t. ((t = (f:real->real) x) /\ p))`;`(f:real->real)`;`(g:real->real)`] (INST [`(\(t:real). (g':real))`,`g':real->real`] HAS_REAL_DERIVATIVE_CHAIN)); + ANTS_TAC; + GEN_TAC; + BETA_TAC; + ASM_MESON_TAC[WITHINREAL_UNIV]; + REPEAT (POP_ASSUM MP_TAC); + (* *) + ASM_MESON_TAC[]; + ]);; + (* }}} *) + + + *) +(* REDO *) + + + let derived_form_add = prove_by_refinement( + `!x s. derived_form p1 f1 f1' x s /\ derived_form p2 f2 f2' x s ==> derived_form (p1 /\ p2) (\x. f1 x + f2 x) (f1'+f2') x s`, + (* {{{ proof *) + [ + deriv_tac; + ]);; + (* }}} *) + + let derived_form_sub = prove_by_refinement( + `!x s. derived_form p1 f1 f1' x s /\ derived_form p2 f2 f2' x s ==> derived_form (p1 /\ p2) (\x. f1 x - f2 x) (f1'-f2') x s`, + (* {{{ proof *) + [ + deriv_tac; + ]);; + (* }}} *) + + let derived_form_mul = prove_by_refinement( + `!x s. derived_form p1 f1 f1' x s /\ derived_form p2 f2 f2' x s ==> derived_form (p1 /\ p2) (\x. f1 x * f2 x) (f1 x * f2' + f1' * f2 x) x s`, + (* {{{ proof *) + [ + deriv_tac; + ]);; + (* }}} *) + + let derived_form_div = prove_by_refinement( + `!x s. derived_form p1 f1 f1' x s /\ derived_form p2 f2 f2' x s ==> derived_form (p1 /\ p2 /\ ~(f2 x = &0)) (\x. f1 x / f2 x) ((f1' * f2 x - f1 x * f2')/(f2 x pow 2)) x s`, + (* {{{ proof *) + [ + deriv_tac; + ]);; + (* }}} *) + +(* moved to function section. + let derived_form_neg = prove_by_refinement( + `!x s. derived_form p1 f1 f1' x s ==> derived_form p1 (\x. -- f1 x) (-- f1') x s`, + (* {{{ proof *) + [ + deriv_tac; + ]);; + (* }}} *) +*) + + let derived_form_pow = prove_by_refinement( + `!n x s. derived_form p f f' x s ==> derived_form p (\x. f x pow n) (&n * f x pow (n-1)* f') x s`, + (* {{{ proof *) + [ + deriv_tac; + ]);; + (* }}} *) + + let deriv_fn_tac = REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[derived_form] THEN + (* COND_CASES_TAC THEN *) + ASM_MESON_TAC[ HAS_REAL_DERIVATIVE_CONST; + HAS_REAL_DERIVATIVE_ATREAL_WITHIN; + HAS_REAL_DERIVATIVE_SIN; + HAS_REAL_DERIVATIVE_COS; + HAS_REAL_DERIVATIVE_SQRT; + HAS_REAL_DERIVATIVE_ATN; + HAS_REAL_DERIVATIVE_ACS; + HAS_REAL_DERIVATIVE_ASN; + HAS_REAL_DERIVATIVE_INV_BASIC; + ];; + + let derived_form_neg = prove_by_refinement( + `!x s. derived_form T ( -- ) (-- &1) x s`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[derived_form]; + SUBGOAL_THEN `( -- ) = (\x. --x)` SUBST1_TAC; + MATCH_MP_TAC EQ_EXT; + MESON_TAC[]; + BETA_TAC; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_NEG; + REWRITE_TAC[HAS_REAL_DERIVATIVE_ID]; + ]);; + (* }}} *) + + let derived_form_const = prove_by_refinement( + `!c x s. derived_form T (\x. c) (&0) x s`, + (* {{{ proof *) + [ + deriv_fn_tac; + ]);; + (* }}} *) + + let derived_form_sin = prove_by_refinement( + `!x s. derived_form T sin (cos x) x s`, + (* {{{ proof *) + [ + deriv_fn_tac; + ]);; + (* }}} *) + + let derived_form_cos = prove_by_refinement( + `!x s. derived_form T cos (-- sin x) x s`, + (* {{{ proof *) + [ + deriv_fn_tac; + ]);; + (* }}} *) + + let derived_form_sqrt = prove_by_refinement( + `!x s. derived_form (&0 < x) sqrt (inv (&2 * sqrt x)) x s`, + (* {{{ proof *) + [ + deriv_fn_tac; + ]);; + (* }}} *) + + let derived_form_atn = prove_by_refinement( + `!x s. derived_form T atn (inv (&1 + x pow 2)) x s`, + (* {{{ proof *) + [ + deriv_fn_tac; + ]);; + (* }}} *) + + let derived_form_acs = prove_by_refinement( + `!x s. derived_form (abs x < &1) acs (-- inv (sqrt(&1 - x pow 2))) x s`, + (* {{{ proof *) + [ + deriv_fn_tac; + ]);; + (* }}} *) + + let derived_form_asn = prove_by_refinement( + `!x s. derived_form (abs x < &1) asn ( inv (sqrt(&1 - x pow 2))) x s`, + (* {{{ proof *) + [ + deriv_fn_tac; + ]);; + (* }}} *) + + + let derived_form_inv = prove_by_refinement( + `!x s. derived_form (~(x = &0)) inv (-- inv (x pow 2)) x s`, + (* {{{ proof *) + [ + deriv_fn_tac; + ]);; + (* }}} *) + + let derived_form_id = prove_by_refinement( + `!x s. derived_form T (\x. x) (&1) x s`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + ASM_REWRITE_TAC[derived_form;HAS_REAL_DERIVATIVE_ID]; + ]);; + (* }}} *) + + let derived_form_chain = prove_by_refinement( + `!x s. derived_form p g g' (f1 x) (:real) /\ derived_form p' f2 f' x s /\ (f1=f2) ==> derived_form (p /\ p' ) (\x. g(f1 x)) (f' * g') x s`, + (* {{{ proof *) + [ + REWRITE_TAC[derived_form]; + REPEAT STRIP_TAC; + MP_TAC (SPECL [`(\t. ((t = (f1:real->real) x) /\ p))`;`(f1:real->real)`;`(g:real->real)`] (INST [`(\(t:real). (g':real))`,`g':real->real`] HAS_REAL_DERIVATIVE_CHAIN)); + ANTS_TAC; + GEN_TAC; + BETA_TAC; + ASM_MESON_TAC[WITHINREAL_UNIV]; + REPEAT (POP_ASSUM MP_TAC); + (* *) + ASM_MESON_TAC[]; + ]);; + (* }}} *) + + +let derived_form_generic = prove_by_refinement( + `!f f' x s. derived_form (derived_form T f (f') x s) f (f') x s`, + (* {{{ proof *) + [ + REWRITE_TAC[derived_form]; + ]);; + + +(* START OF NICK VOLKER'S CODE *) + + +let region_conv = prove_by_refinement( + `!(x:real) (y:real). ~(y = &0 /\ x <= &0) ==> (x > &0) \/ (y < &0) \/ (y > &0)`, + (* {{{ proof *) + [ + REAL_ARITH_TAC; + ]);; + + let x2notless0 = prove_by_refinement(`!x:real. ~(x pow 2 < &0)`, + [ +STRIP_TAC; +SUBGOAL_THEN `x = &0 ==> ~(x pow 2 < &0)` MP_TAC; +STRIP_TAC; +MP_TAC (SPECL[`x:real`] Trigonometry2.POW2_EQ_0); +ASM_REWRITE_TAC[]; +REAL_ARITH_TAC; +SUBGOAL_THEN `~(x = &0) ==> ~(x pow 2 < &0)` MP_TAC; +STRIP_TAC; +MP_TAC (SPECL[`x:real`] (GENL[`a:real`] Trigonometry2.NOT_ZERO_EQ_POW2_LT)); +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (REAL_FIELD `&0 < x pow 2 ==> ~(x pow 2 < &0)`); +ASM_MESON_TAC[]; +ASM_MESON_TAC[]; + ]);; + + let x2notlesseq0 = prove_by_refinement(`!x:real. ~(x = &0) ==> ~(x pow 2 <= &0)`, + [ +STRIP_TAC; +STRIP_TAC; +MP_TAC (SPECL[`x:real`] (GENL[`a:real`] Trigonometry2.NOT_ZERO_EQ_POW2_LT)); +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (REAL_FIELD `&0 < x pow 2 ==> ~(x pow 2 <= &0)`); +ASM_MESON_TAC[]; + ]);; + + let sumsquaresnot0 = prove_by_refinement(`!x:real y:real. ~(x = &0) ==> ~(x pow 2 + y pow 2 <= &0)`, + [ +STRIP_TAC; +STRIP_TAC; +STRIP_TAC; +MP_TAC (SPECL[`x:real`] x2notlesseq0); +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (SPECL[`y:real`] x2notless0); +STRIP_TAC; +MP_TAC (REAL_ARITH `~(x pow 2 <= &0) /\ ~(y pow 2 < &0) ==> ~(x pow 2 + y pow 2 <= &0)`); +ASM_MESON_TAC[]; + ]);; + + let notzerodenom = prove_by_refinement(`!a:real b:real c:real d:real. (~(b = &0) ==> (a*b - c*d)/(b pow 2) * inv (&1 + (c/b) pow 2) = (a*b - c*d)/(b pow 2 + c pow 2))`, + [ +REPEAT STRIP_TAC; +MP_TAC (SPECL [`b:real`;`c:real`] sumsquaresnot0); +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (REAL_FIELD `~(b = &0) /\ ~(b pow 2 + c pow 2 <= &0) ==> (a*b - c*d)/(b pow 2) * inv (&1 + (c/b) pow 2) = (a*b - c*d)/(b pow 2 + c pow 2)`); +ASM_MESON_TAC[]; + ]);; + + let notzerodenom2 = prove_by_refinement(`!a:real b:real c:real d:real. (~(c = &0) ==> (a*b - c*d)/(c pow 2) * inv (&1 + (b/c) pow 2) = (a*b - c*d)/(b pow 2 + c pow 2))`, + [ +REPEAT STRIP_TAC; +MP_TAC (SPECL [`c:real`;`b:real`] sumsquaresnot0); +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (REAL_FIELD `~(c = &0) /\ ~(c pow 2 + b pow 2 <= &0) ==> (a*b - c*d)/(c pow 2) * inv (&1 + (b/c) pow 2) = (a*b - c*d)/(b pow 2 + c pow 2)`); +ASM_MESON_TAC[]; + ]);; + + +let derived_imp_pos_open = prove_by_refinement( + `!p f f' x s. p /\ derived_form p f f' x s /\ &0 < f x ==> + (?d. &0 < d /\ (!x'. x' IN s /\ abs (x' - x) < d ==> &0 < f x'))`, + (* {{{ proof *) + [ +REWRITE_TAC[derived_form]; +REWRITE_TAC[TAUT `(a /\ (a ==> b) /\ c) <=> (a /\ b /\ c)`]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o ( MATCH_MP HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_WITHINREAL )); +REWRITE_TAC[real_continuous_withinreal]; +DISCH_THEN (MP_TAC o (SPEC `(f:real->real) x`)); +ASM_REWRITE_TAC[]; +STRIP_TAC; +EXISTS_TAC `d:real`; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC `x':real`)); +ASM_REWRITE_TAC[]; +ASM_REAL_ARITH_TAC; + ]);; + +let derived_imp_pos_open_2 = prove_by_refinement( + `!p g g' x s. p /\ derived_form p g g' x s /\ &0 < g x ==> + (?d. &0 < d /\ (!x'. x' IN s /\ abs (x' - x) < d ==> &0 < g x'))`, + (* {{{ proof *) + [ +REWRITE_TAC[derived_form]; +REWRITE_TAC[TAUT `(a /\ (a ==> b) /\ c) <=> (a /\ b /\ c)`]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o ( MATCH_MP HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_WITHINREAL )); +REWRITE_TAC[real_continuous_withinreal]; +DISCH_THEN (MP_TAC o (SPEC `(g:real->real) x`)); +ASM_REWRITE_TAC[]; +STRIP_TAC; +EXISTS_TAC `d:real`; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC `x':real`)); +ASM_REWRITE_TAC[]; +ASM_REAL_ARITH_TAC; + ]);; + +let derived_imp_pos_open_3 = prove_by_refinement( + `!p g g' x s. p /\ derived_form p g g' x s /\ &0 > g x==> + (?d. &0 < d /\ (!x'. x' IN s /\ abs (x' - x) < d ==> &0 > g x' ))`, + (* {{{ proof *) + [ +REWRITE_TAC[REAL_ARITH ` &0 > g x <=> &0 < --(g x)`]; +REWRITE_TAC[derived_form]; +REWRITE_TAC[TAUT `(a /\ (a ==> b) /\ c) <=> (a /\ b /\ c)`]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o ( MATCH_MP HAS_REAL_DERIVATIVE_IMP_CONTINUOUS_WITHINREAL )); +REWRITE_TAC[real_continuous_withinreal]; +DISCH_THEN (MP_TAC o (SPEC `--(g:real->real) x`)); +ASM_REWRITE_TAC[]; +STRIP_TAC; +EXISTS_TAC `d:real`; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC `x':real`)); +ASM_REWRITE_TAC[]; +ASM_REAL_ARITH_TAC; + ]);; + +let deriv_pi = prove_by_refinement( + `!(x:real) s. derived_form T (\x. (pi / &2)) (&0) x s`, + [ + MP_TAC (SPECL [`(pi / &2)`] derived_form_const); + ASM_MESON_TAC[]; + ]);; + +let deriv_pi_minus = prove_by_refinement( + `!(x:real) pf f f' s. derived_form pf f f' x s ==> derived_form (T /\pf) (\x. (pi / &2) - f x) (&0 - f') x s`, + [ + REPEAT GEN_TAC; + MP_TAC (SPECL[`x:real`;`s:real->bool`] deriv_pi); + REPEAT STRIP_TAC; + MATCH_MP_TAC derived_form_sub; + ASM_MESON_TAC[]; +]);; + +let deriv_minus_pi = prove_by_refinement( + `!(x:real) s. derived_form T (\x. --(pi / &2)) (&0) x s`, + [ + MP_TAC (SPECL [`--(pi / &2)`] derived_form_const); + ASM_MESON_TAC[]; + ]);; + +let deriv_minus_pi_minus = prove_by_refinement( + `!(x:real) pf f f' s. derived_form pf f f' x s ==> derived_form (T /\pf) (\x. --(pi / &2) - f x) (&0 - f') x s`, + [ + REPEAT GEN_TAC; + MP_TAC (SPECL[`x:real`;`s:real->bool`] deriv_minus_pi); + REPEAT STRIP_TAC; + MATCH_MP_TAC derived_form_sub; + ASM_MESON_TAC[]; +]);; + +let derived_form_chain_simple = prove_by_refinement( + `!x s g g' f f' p p'. + derived_form p g g' (f x) (:real) /\ + derived_form p' f f' x s + ==> derived_form (p /\ p') (\x. g (f x)) (f' * g') x s`, + (* {{{ proof *) + [ + MESON_TAC[derived_form_chain] + ]);; + +let atn_lemma = prove_by_refinement( + `!x pf f f' pg g g' s. (&0 < f x) /\ derived_form pf f f' x s /\ derived_form pg g g' x s ==> derived_form (T /\ (pg /\ pf)) (\x. atn( g x / f x)) ((g' * f x - g x * f')/(f x pow 2) *inv (&1 + (g x / f x) pow 2)) x s`, + (* {{{ proof *) + [ +REPEAT STRIP_TAC; +MATCH_MP_TAC derived_form_chain_simple; +REWRITE_TAC[derived_form_atn]; +MP_TAC (REAL_ARITH `&0 < (f:real->real) x ==> ~(f x = &0)`); +SUBGOAL_THEN `derived_form (pg /\ pf /\ ~(f x = &0)) (\x. g x / f x) ((g' * f x - g x * f') / f x pow 2) x s` MP_TAC; +MATCH_MP_TAC derived_form_div; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[derived_form]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[] + ]);; + +let atn_notpi_lemma = prove_by_refinement( + `!x pf f f' pg g g' s. (&0 < g x) /\ derived_form pf f f' x s /\ derived_form pg g g' x s ==> derived_form (T /\ (pf /\ pg)) (\x. atn( f x / g x)) ((f' * g x - f x * g')/(g x pow 2) *inv (&1 + (f x / g x) pow 2)) x s`, + (* {{{ proof *) + [ +REPEAT STRIP_TAC; +MATCH_MP_TAC derived_form_chain_simple; +REWRITE_TAC[derived_form_atn]; +MP_TAC (REAL_ARITH `&0 < (g:real->real) x ==> ~(g x = &0)`); +SUBGOAL_THEN `derived_form (pf /\ pg /\ ~(g x = &0)) (\x. f x / g x) ((f' * g x - f x * g') / g x pow 2) x s` MP_TAC; +MATCH_MP_TAC derived_form_div; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[derived_form]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[] + ]);; + +let atn_notnegpi_lemma = prove_by_refinement( + `!x pf f f' pg g g' s. (&0 > g x) /\ derived_form pf f f' x s /\ derived_form pg g g' x s ==> derived_form (T /\ (pf /\ pg)) (\x. atn( f x / g x)) ((f' * g x - f x * g')/(g x pow 2) *inv (&1 + (f x / g x) pow 2)) x s`, + (* {{{ proof *) + [ +REPEAT STRIP_TAC; +MATCH_MP_TAC derived_form_chain_simple; +REWRITE_TAC[derived_form_atn]; +MP_TAC (REAL_ARITH `&0 > (g:real->real) x ==> ~(g x = &0)`); +SUBGOAL_THEN `derived_form (pf /\ pg /\ ~(g x = &0)) (\x. f x / g x) ((f' * g x - f x * g') / g x pow 2) x s` MP_TAC; +MATCH_MP_TAC derived_form_div; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[derived_form]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[] + ]);; + +let atn_lemma_2 = prove_by_refinement ( + `!x pf f f' pg g g' s. (&0 < g x) /\ derived_form pf f f' x s /\ derived_form pg g g' x s ==> derived_form (T /\ (pf /\ pg)) (\x. (pi / &2) - atn( f x / g x)) ((g' * f x - g x * f')/(g x pow 2) *inv (&1 + (f x / g x) pow 2)) x s`, + [ + REPEAT STRIP_TAC; + MP_TAC (SPECL[`x:real`;`pf:bool`;`f:real->real`;`f':real`;`pg:bool`;`g:real->real`;`g':real`;`s:real->bool`] atn_notpi_lemma); + ASM_REWRITE_TAC[]; + REPEAT STRIP_TAC; + UNDISCH_THEN `derived_form (pf /\ pg) (\x. atn (f x / g x)) ((f' * g x - f x * g') / g x pow 2 * inv (&1 + (f x / g x) pow 2)) x s` (MP_TAC o (MATCH_MP deriv_pi_minus)); +(*REWRITE_TAC[REAL_ARITH `(&0 - (a*d -b*c))/u*v = (c*b - d*a)/u*v`]; *) + UNDISCH_TAC `derived_form pf f f' x s`; + UNDISCH_TAC `derived_form pg g g' x s`; + REWRITE_TAC[derived_form]; + REPEAT STRIP_TAC; + SUBGOAL_THEN `((\x. pi / &2 - atn (f x / g x)) has_real_derivative + &0 - + (f' * g x - f x * g') / g x pow 2 * inv (&1 + (f x / g x) pow 2)) + (atreal x within s)` MP_TAC; + ASM_MESON_TAC[]; + SUBGOAL_THEN `!(f:real->real) (g:real->real). (&0 - (f' * g x - f x * g') / g x pow 2 * inv (&1 + (f x / g x) pow 2)) = ((g' * f x - g x * f') / g x pow 2 * inv (&1 + (f x / g x) pow 2))` MP_TAC; + REPEAT STRIP_TAC; + REAL_ARITH_TAC; + STRIP_TAC; + ASM_MESON_TAC[]; + ]);; + +let atn_lemma_3 = prove_by_refinement ( + `!x pf f f' pg g g' s. (&0 > g x) /\ derived_form pf f f' x s /\ derived_form pg g g' x s ==> derived_form (T /\ (pf /\ pg)) (\x. --(pi / &2) - atn( f x / g x)) ((g' * f x - g x * f')/(g x pow 2) *inv (&1 + (f x / g x) pow 2)) x s`, + [ + REPEAT STRIP_TAC; + MP_TAC (SPECL[`x:real`;`pf:bool`;`f:real->real`;`f':real`;`pg:bool`;`g:real->real`;`g':real`;`s:real->bool`] atn_notnegpi_lemma); + ASM_REWRITE_TAC[]; + REPEAT STRIP_TAC; + UNDISCH_THEN `derived_form (pf /\ pg) (\x. atn (f x / g x)) ((f' * g x - f x * g') / g x pow 2 * inv (&1 + (f x / g x) pow 2)) x s` (MP_TAC o (MATCH_MP deriv_minus_pi_minus)); +(*REWRITE_TAC[REAL_ARITH `(&0 - (a*d -b*c))/u*v = (c*b - d*a)/u*v`]; *) + UNDISCH_TAC `derived_form pf f f' x s`; + UNDISCH_TAC `derived_form pg g g' x s`; + REWRITE_TAC[derived_form]; + REPEAT STRIP_TAC; + SUBGOAL_THEN `((\x. --(pi / &2) - atn (f x / g x)) has_real_derivative + &0 - + (f' * g x - f x * g') / g x pow 2 * inv (&1 + (f x / g x) pow 2)) + (atreal x within s)` MP_TAC; + ASM_MESON_TAC[]; + SUBGOAL_THEN `!(f:real->real) (g:real->real). (&0 - (f' * g x - f x * g') / g x pow 2 * inv (&1 + (f x / g x) pow 2)) = ((g' * f x - g x * f') / g x pow 2 * inv (&1 + (f x / g x) pow 2))` MP_TAC; + REPEAT STRIP_TAC; + REAL_ARITH_TAC; + STRIP_TAC; + ASM_MESON_TAC[]; + ]);; + +let atn2_atn_open = prove_by_refinement( + `!p f f' g x s. p /\ derived_form p f f' x s /\ (&0 < f x)==> + (?d. &0 < d /\ (!x'. x' IN s /\ abs (x' - x) < d ==> + atn2 (f x', g x') = atn(g x' / f x')))`, + (* {{{ proof *) + [ +(REPEAT GEN_TAC); +(DISCH_THEN (MP_TAC o (MATCH_MP derived_imp_pos_open))); +(REPEAT STRIP_TAC); +(EXISTS_TAC `d:real`); +(ASM_REWRITE_TAC[]); +(REPEAT STRIP_TAC); +(SUBGOAL_THEN `&0 < ((f:real->real) x')` MP_TAC); +(ASM_MESON_TAC[]); +(MP_TAC (MATCH_MP (TAUT `a /\ b /\ c /\ d ==> a`) (SPECL [`((f:real->real) x')`;`((g:real->real) x')`] Trigonometry1.ATN2_BREAKDOWN))); +(REPEAT STRIP_TAC); + ]);; + +let atn2_atn_open_2 = prove_by_refinement( + `!p g g' f x s. p /\ derived_form p g g' x s /\ (&0 < g x)==> + (?d. &0 < d /\ (!x'. x' IN s /\ abs (x' - x) < d ==> + atn2 (f x', g x') = (pi / &2 - atn(f x' / g x'))))`, + (* {{{ proof *) + [ +(REPEAT GEN_TAC); +(DISCH_THEN (MP_TAC o (MATCH_MP derived_imp_pos_open))); +(REPEAT STRIP_TAC); +(EXISTS_TAC `d:real`); +(ASM_REWRITE_TAC[]); +(REPEAT STRIP_TAC); +(SUBGOAL_THEN `&0 < ((g:real->real) x')` MP_TAC); +(ASM_MESON_TAC[]); +(MP_TAC (MATCH_MP (TAUT `a /\ b /\ c /\ d ==> b`) (SPECL [`((f:real->real) x')`;`((g:real->real) x')`] Trigonometry1.ATN2_BREAKDOWN))); +(REPEAT STRIP_TAC); + ]);; + +let atn2_atn_open_3 = prove_by_refinement( + `!p g g' f x s. p /\ derived_form p g g' x s /\ (&0 > g x)==> + (?d. &0 < d /\ (!x'. x' IN s /\ abs (x' - x) < d ==> + atn2 (f x', g x') = (--(pi / &2) - atn(f x' / g x'))))`, + (* {{{ proof *) + [ +(REPEAT GEN_TAC); +(DISCH_THEN (MP_TAC o (MATCH_MP derived_imp_pos_open_3))); +(REPEAT STRIP_TAC); +(EXISTS_TAC `d:real`); +(ASM_REWRITE_TAC[]); +(REPEAT STRIP_TAC); +(SUBGOAL_THEN `&0 > ((g:real->real) x')` MP_TAC); +(ASM_MESON_TAC[]); +(REWRITE_TAC[REAL_ARITH `a > b <=> b < a`]); +(MP_TAC (MATCH_MP (TAUT `a /\ b /\ c /\ d ==> c`) (SPECL [`((f:real->real) x')`;`((g:real->real) x')`] Trigonometry1.ATN2_BREAKDOWN))); +(REPEAT STRIP_TAC); + ]);; + +(*//////////////////////////////////*) + +let atn2_final_1 = prove_by_refinement( `!x pf (f:real->real) f' pg (g:real->real) g' s. (&0 < f x) /\ derived_form pf f f' x s /\ derived_form pg g g' x s ==> derived_form ((x IN s) /\ (pg /\ pf)) (\x. atn2( f x , g x)) ((g' * f x - g x * f')/(f x pow 2) *inv (&1 + (g x / f x) pow 2)) x s`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REWRITE_TAC[derived_form]; + REPEAT STRIP_TAC; + SUBGOAL_THEN `pf /\ derived_form pf f f' x s /\ (&0 < (f:real->real) x)` MP_TAC; + REWRITE_TAC[derived_form]; + ASM_MESON_TAC[]; + DISCH_THEN (MP_TAC o (MATCH_MP atn2_atn_open)); + STRIP_TAC; + SUBGOAL_THEN `derived_form (T /\ (pg /\ pf)) (\x. atn( g x / f x)) ((g' * f x - g x * f')/(f x pow 2) *inv (&1 + (g x / f x) pow 2)) x s` MP_TAC; + MP_TAC atn_lemma; + REWRITE_TAC[derived_form]; + REPEAT STRIP_TAC; + ASM_MESON_TAC[]; + REWRITE_TAC[derived_form]; + STRIP_TAC; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_TRANSFORM_WITHIN; + ASM_MESON_TAC[]; + ]);; + +let atn2_final_2 = prove_by_refinement ( + `!x pf (f:real->real) f' pg (g:real->real) g' s. (&0 < g x) /\ derived_form pf f f' x s /\ derived_form pg g g' x s ==> derived_form ((x IN s) /\ (pg /\ pf)) (\x. atn2( f x , g x)) ((g' * f x - g x * f')/(g x pow 2) *inv (&1 + (f x / g x) pow 2)) x s`, + [ + REPEAT GEN_TAC; + REWRITE_TAC[derived_form]; + REPEAT STRIP_TAC; + SUBGOAL_THEN `pg /\ derived_form pg g g' x s /\ (&0 < (g:real->real) x)` MP_TAC; + REWRITE_TAC[derived_form]; + ASM_MESON_TAC[]; + DISCH_THEN (MP_TAC o (MATCH_MP atn2_atn_open_2)); + STRIP_TAC; + SUBGOAL_THEN `derived_form (T /\ (pg /\ pf)) (\x. (pi / &2) - atn( f x / g x)) ((g' * f x - g x * f')/(g x pow 2) *inv (&1 + (f x / g x) pow 2)) x s` MP_TAC; + MP_TAC atn_lemma_2; + REWRITE_TAC[derived_form]; + REPEAT STRIP_TAC; + ASM_MESON_TAC[]; + REWRITE_TAC[derived_form]; + STRIP_TAC; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_TRANSFORM_WITHIN; + ASM_MESON_TAC[]; + ]);; + +let atn2_final_3 = prove_by_refinement ( + `!x pf (f:real->real) f' pg (g:real->real) g' s. (&0 > g x) /\ derived_form pf f f' x s /\ derived_form pg g g' x s ==> derived_form ((x IN s) /\ (pg /\ pf)) (\x. atn2( f x , g x)) ((g' * f x - g x * f')/(g x pow 2) *inv (&1 + (f x / g x) pow 2)) x s`, + [ + REPEAT GEN_TAC; + REWRITE_TAC[derived_form]; + REPEAT STRIP_TAC; + SUBGOAL_THEN `pg /\ derived_form pg g g' x s /\ (&0 > (g:real->real) x)` MP_TAC; + REWRITE_TAC[derived_form]; + ASM_MESON_TAC[]; + DISCH_THEN (MP_TAC o (MATCH_MP atn2_atn_open_3)); + STRIP_TAC; + SUBGOAL_THEN `derived_form (T /\ (pg /\ pf)) (\x. --(pi / &2) - atn( f x / g x)) ((g' * f x - g x * f')/(g x pow 2) *inv (&1 + (f x / g x) pow 2)) x s` MP_TAC; + MP_TAC atn_lemma_3; + REWRITE_TAC[derived_form]; + REPEAT STRIP_TAC; + ASM_MESON_TAC[]; + REWRITE_TAC[derived_form]; + STRIP_TAC; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_TRANSFORM_WITHIN; + ASM_MESON_TAC[]; + ]);; + +let atn2_deriv_simple1 = prove_by_refinement(`!x pf (f:real->real) f' pg (g:real->real) g' s. (&0 < f x) /\ derived_form pf f f' x s /\ derived_form pg g g' x s ==> derived_form ((x IN s) /\ (pg /\ pf)) (\x. atn2( f x , g x)) ((g' * f x - g x * f')/(f x pow 2 + g x pow 2)) x s`, + [ +REPEAT STRIP_TAC; +MP_TAC (SPECL[`x:real`;`pf:bool`;`f:real->real`;`f':real`;`pg:bool`;`g:real->real`;`g':real`;`s:real->bool`] atn2_final_1); +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (REAL_ARITH `&0 < (f:real->real) x ==> ~(f x = &0)`); +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (SPECL[`(f:real->real) x`;`(g:real->real) x`;] sumsquaresnot0); +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (SPECL[`g':real`;`(f:real->real) x`;`(g:real->real) x`;`f':real`] notzerodenom); +ASM_REWRITE_TAC[]; +ASM_MESON_TAC[]; + ]);; + +let atn2_deriv_simple2 = prove_by_refinement(`!x pf (f:real->real) f' pg (g:real->real) g' s. (&0 < g x) /\ derived_form pf f f' x s /\ derived_form pg g g' x s ==> derived_form ((x IN s) /\ (pg /\ pf)) (\x. atn2( f x , g x)) ((g' * f x - g x * f')/(f x pow 2 + g x pow 2)) x s`, + [ +REPEAT STRIP_TAC; +MP_TAC (SPECL[`x:real`;`pf:bool`;`f:real->real`;`f':real`;`pg:bool`;`g:real->real`;`g':real`;`s:real->bool`] atn2_final_2); +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (REAL_ARITH `&0 < (g:real->real) x ==> ~(g x = &0)`); +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (SPECL[`(f:real->real) x`;`(g:real->real) x`;] sumsquaresnot0); +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (SPECL[`g':real`;`(f:real->real) x`;`(g:real->real) x`;`f':real`] notzerodenom2); +ASM_REWRITE_TAC[]; +ASM_MESON_TAC[]; + ]);; + +let atn2_deriv_simple3 = prove_by_refinement(`!x pf (f:real->real) f' pg (g:real->real) g' s. (&0 > g x) /\ derived_form pf f f' x s /\ derived_form pg g g' x s ==> derived_form ((x IN s) /\ (pg /\ pf)) (\x. atn2( f x , g x)) ((g' * f x - g x * f')/(f x pow 2 + g x pow 2)) x s`, + [ +REPEAT STRIP_TAC; +MP_TAC (SPECL[`x:real`;`pf:bool`;`f:real->real`;`f':real`;`pg:bool`;`g:real->real`;`g':real`;`s:real->bool`] atn2_final_3); +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (REAL_ARITH `&0 > (g:real->real) x ==> ~(g x = &0)`); +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (SPECL[`(f:real->real) x`;`(g:real->real) x`;] sumsquaresnot0); +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (SPECL[`g':real`;`(f:real->real) x`;`(g:real->real) x`;`f':real`] notzerodenom2); +ASM_REWRITE_TAC[]; +ASM_MESON_TAC[]; + ]);; + +let atn2_derivative = prove_by_refinement(`!x pf (f:real->real) f' pg (g:real->real) g' s. (~((g x = &0) /\ (f x <= &0))) /\ derived_form pf f f' x s /\ derived_form pg g g' x s ==> derived_form ((x IN s) /\ (pg /\ pf)) (\x. atn2( f x , g x)) ((g' * f x - g x * f')/(f x pow 2 + g x pow 2)) x s`, + [ +REPEAT GEN_TAC; +REWRITE_TAC[REAL_ARITH `(~((y = &0) /\ (x <= &0)) <=> (&0 < x) \/ (&0 < y) \/ (&0 > y))`]; +REPEAT STRIP_TAC; +MP_TAC (SPECL[`x:real`;`pf:bool`;`f:real->real`;`f':real`;`pg:bool`;`g:real->real`;`g':real`;`s:real->bool`] atn2_deriv_simple1); +ASM_MESON_TAC[]; +MP_TAC (SPECL[`x:real`;`pf:bool`;`f:real->real`;`f':real`;`pg:bool`;`g:real->real`;`g':real`;`s:real->bool`] atn2_deriv_simple2); +ASM_MESON_TAC[]; +MP_TAC (SPECL[`x:real`;`pf:bool`;`f:real->real`;`f':real`;`pg:bool`;`g:real->real`;`g':real`;`s:real->bool`] atn2_deriv_simple3); +ASM_MESON_TAC[]; + ]);; + + +(* END OF NICK VOLKER'S ATAN2 CODE *) + + + + let atn2curry = new_definition `atn2curry x y = atn2(x,y)`;; + + let derived_form_atn2curry = prove_by_refinement( + `!x s. derived_form p1 f1 f1' x s /\ derived_form p2 f2 f2' x s ==> derived_form (p1 /\ p2 /\ (~((f2 x = &0) /\ (f1 x <= &0))) /\ (x IN s)) (\x. atn2curry (f1 x) (f2 x)) ( (f2' * f1 x - f2 x * f1')/ (f1 x pow 2 + f2 x pow 2)) x s`, + (* {{{ proof *) + [ + REWRITE_TAC[atn2curry]; + REPEAT STRIP_TAC; + MP_TAC (SPECL [`x:real`;`p1:bool`;`f1:real->real`;`f1':real`;`p2:bool`;`f2:real->real`;`f2':real`;`s:real->bool`] atn2_derivative); + ASM_REWRITE_TAC[]; + REWRITE_TAC[derived_form]; + ASM_MESON_TAC[]; + ]);; + (* }}} *) + +(* apply chain only when head is a named constant, sqrt, cos, sin,... *) + + + let differentiate = + let real_univ = `(:real)` in + let real_ty = `:real` in + let pow = `(pow)` in + let c = ref 0 in + let get_var() = + let _ = (c:= !c+1) in + mk_var("F"^(string_of_int !c),real_ty) in + let curryl = [atn2curry] in + let uncurry = REWRITE_CONV curryl in + let curry = REWRITE_CONV (map GSYM curryl) in + let binop = [(`( / )`,derived_form_div);(`( * )`,derived_form_mul); + (`( + )`,derived_form_add); (`( - )`,derived_form_sub); + (`atn2curry`,derived_form_atn2curry)] in + let unop = [] in + let fns = [((` -- `), derived_form_neg); + (`sin`,derived_form_sin); + (`cos`,derived_form_cos); + (`sqrt`,derived_form_sqrt); + (`inv`,derived_form_inv); + (`acs`,derived_form_acs); + (`asn`,derived_form_asn); + (`atn`,derived_form_atn); + ] in + let rc = clean_conv in + let check thm = ((* print_thm thm; *) thm) in + let mate f g = try (MATCH_MP f g) with e -> + ( + print_string "ERROR: derivative MATCH_MP:\n\n" ; + print_thm f; + print_thm g; + print_string "END ERROR\n"; + raise e; + ) in + let clean_derived_form = MESON[] + `derived_form p f f' x s /\ (p = p') /\ (f = tm) /\ (f' = f'') /\ (x = x') /\ (s = s') ==> + derived_form p' tm f'' x' s'` in + + let cleanup_derived_form th tm s = + let (_,[p;f;f';x;s']) = strip_comb (concl th) in + let p' = rc p in + let f'' = (rc THENC uncurry) f' in + let tm1 = ((REDEPTH_CONV BETA_CONV) THENC curry) tm in + let f1 = ((REDEPTH_CONV BETA_CONV) THENC curry) f in + let u = try (prove(mk_eq (f,tm),REWRITE_TAC[tm1;f1] THEN MESON_TAC[])) + with _ -> + (print_term tm; print_string" "; print_thm tm1; print_thm f1; failwith "cdfm") in + mate (clean_derived_form) (end_itlist CONJ [th;p';u;f'';REFL x;REFL s]) in + + let rec derivative' tm x s = + let hyp r = end_itlist CONJ ((map (fun t->derivative' t x s) r)) in + let SPECM xs (dd,msg) = + try SPECL xs dd + with e -> + ( + print_string("\n\n unexpected \n"^msg^"\n"); + map print_term xs; + raise e ; + ) in + + let m r (dd,msg) = + try ( + if (r=[]) then SPECL [x;s] dd else (mate (SPECL [x;s] dd) (hyp r)) + ) + with e -> ( + print_string("\n\n unexpected failure on ops\n"^msg^"\n"); + map (fun u ->print_term u; print_string "\n") r; + print_thm (SPECL [x;s] dd); + print_string "-------\n\n"; + raise e + ) in + let d_fns tm = + let derived_form_fn = assoc tm fns in + (SPECM[x;s] (derived_form_fn,"fns")) in + let d_const tm = + let (v,bod) = dest_abs tm in + let _ = not(mem v (frees bod)) or failwith "constant" in + (SPECM[bod;x;s] (derived_form_const,"const")) in + let d_id tm = + let (v,bod) = dest_abs tm in + let _ = (v=bod) or failwith "id" in + (m [] (derived_form_id,"id")) in + let d_pow tm = + let (v,bod) = dest_abs tm in + let (t,n) = dest_binop pow bod in + let r = mk_abs (v,t) in + (m [r] (SPEC n derived_form_pow,"pow")) in + let d_op tm = + let (v,bod) = dest_abs tm in + let (h,b) = strip_comb bod in + if (List.length b = 1) then + let _ = failwith "no unary ops exist" in + let derived_form_unary = assoc h unop in + let r = mk_abs (v,hd b) in + (m [r] (derived_form_unary,"unary")) + else + let _ = (List.length b = 2) or failwith "not a binary op" in + let [f1;f2] = b in + let derived_form_op = (assoc h binop) in + let r1 = mk_abs (v,f1) in + let r2 = mk_abs (v,f2) in + (m [r1;r2] (derived_form_op,"binary")) in + let d_chain tm = + let (v,bod) = dest_abs tm in + let (h,br) = strip_comb bod in + let _ = List.length br = 1 or failwith "not a chain" in + let fs = mk_abs(v,hd br) in + let r1 = derivative' h (mk_comb (fs,x)) real_univ in + let r2 = derivative' fs x s in +(* let b1 = ABS v (AP_TERM h (SYM(BETA (mk_comb (fs,v))))) in *) + let f1 = + let (_,[_;_;_;f1x;_]) = strip_comb (concl r1) in + let (f1,_) = dest_comb f1x in + f1 in + let f2 = + let (_,[_;f2;_;_;_]) = strip_comb(concl r2) in f2 in + let rd = REDEPTH_CONV BETA_CONV in + let b1 = prove(mk_eq(f1,f2),REWRITE_TAC[rd f1;rd f2] THEN MESON_TAC[]) in + let spec = SPECM [x;s] (derived_form_chain,"chain") in + (mate (spec) (end_itlist CONJ [r1;r2;b1])) in + + let d_hyp tm = + SPECM [tm;get_var();x;s] (derived_form_generic,"generic") in + + tryfind (fun t -> check(t tm)) [d_fns;d_const;d_id;d_pow;d_op;d_chain;d_hyp] in + + fun tm x s -> + let tm' = rhs (concl (curry tm)) in + cleanup_derived_form (derivative' tm' x s) tm s;; + + +(* + let differentiate tm x s = + let th = (REWRITE_CONV [GSYM atn2curry] tm) in + let tm1 = rhs (concl th) in + let d = differentiate_prelim tm1 x s in + let ans = REWRITE_RULE[SYM th] d in + ans;; +*) + + +(* Examples *) + +(* + +let th1 = + let x = `x:real` in + let s = `(:real)` in + let tm = `\x:real. &1` in + differentiate tm x s;; + + +let th1 = + let x = `x:real` in + let s = `(:real)` in + let tm = `\x:real. x` in + differentiate tm x s;; + +let th1 = + let x = `x:real` in + let s = `(:real)` in + let tm = `sin` in + differentiate tm x s;; + +let th1 = + let x = `x:real` in + let s = `(:real)` in + let tm = `( -- )` in + differentiate tm x s;; + + +let th1 = + let x = `x:real` in + let s = `(:real)` in + let tm = `\x. &1 + x` in + differentiate tm x s;; + + +let th1 = + let x = `x:real` in + let s = `(:real)` in + let tm = `\x. x + &1` in + differentiate tm x s;; + +let th1 = + let x = `x:real` in + let s = `(:real)` in + let tm = `\x. -- (x pow 2)` in + differentiate tm x s;; + + let th1 = + let x = `x:real` in + let s = `{t | t > &0}` in + let tm = `(\q:real. (q - sin(q pow 3) + q pow 7 + y)/(q pow 2 + q pow 4 *(&33 + &43 * q)) + (q pow 3) * ((q pow 2) / (-- (q pow 3))))` in + time(differentiate tm x) s;; + + let th2 = + let x = `x:real` in + let s = `(:real)` in + let tm = `\q. cos(&1 + q pow 2) * acs (q pow 4) + atn(cos q) + inv (q + &1)` in + time(differentiate tm x) s;; + + let th3 = + let x = `r:real` in + let s = `(:real)` in + let tm = `\q. cos(&1 + q pow 2) * acs (q pow 4) + atn(cos q) + inv (q + &1)` in + time(differentiate tm x) s;; + + let th3 = + let x = `t:real` in + let s = `(:real)` in + let tm = `\q. (\x. x pow 5 + x* y - cos x) (&1 + q pow 2) ` in + differentiate tm x s;; + + let th3 = + let x = `t:real` in + let s = `(:real)` in + let tm = `\q. (\x. x pow 5 + &1 - cos x) q` in + differentiate tm x s;; + +let th3 = + let x = `t:real` in + let s = `(:real)` in + let tm = `\q. (\x. &2 + sin x + &1) q` in + differentiate tm x s;; + + let th3 = + let x = `x:real` in + let s = `(:real)` in + let tm = `\q. ((f:real->real) ((g:real->real) q)) + (g:real->real) q ` in + differentiate tm x s;; + +*) + +(* +let real_interval_nonempty = prove_by_refinement( + `!a b. (a<=b) ==> ~(real_interval[a,b]={})`, + (* {{{ proof *) + [ + REWRITE_TAC[real_interval]; + REPEAT GEN_TAC; + DISCH_TAC; + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY;IN_ELIM_THM]; + EXISTS_TAC `a:real`; + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + ]);; + (* }}} *) +*) + + + +end;; diff --git a/text_formalization/nonlinear/check_completeness.hl b/text_formalization/nonlinear/check_completeness.hl new file mode 100644 index 0000000..6757b6a --- /dev/null +++ b/text_formalization/nonlinear/check_completeness.hl @@ -0,0 +1,2439 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Section: Local Fan Main Estimate *) +(* Chapter: Local Fan *) +(* Author: Thomas C. Hales *) +(* Date: 2012-05-05 *) +(* Date: 2013-03, revised *) +(* ========================================================================== *) + +(* +Check completeness (informally) +of case anaysis in proof of Kepler conjecture, Main Estimate. + +The purpose is to transform the list init_cs into terminal_cs +in a finite sequence of regulated moves. + +This proves the arrow S_init ==> S_term described in the +appendix to the Local Fan chapter. + +*) + + +module Check_completeness = struct + +(* + +We don't need the full flyspeck build, really just lib.ml. + +#directory "/Users/thomashales/Desktop/googlecode/hol_light";; +#use "hol.ml";; + +let flyspeck_dir = + (try Sys.getenv "FLYSPECK_DIR" with Not_found -> Sys.getcwd());; + +loadt (flyspeck_dir^"/../glpk/sphere.ml");; +loadt (flyspeck_dir^"/general/lib.hl");; + +*) + + +(* +**************************************** +BASICS +**************************************** +*) + + + + +let false_on_fail b x = try (b x) with _ -> false;; + +let fail_on_false b x s = (b x or failwith "s");; + +let filter_some xs = + mapfilter (function |Some x -> x |None -> failwith "none" ) xs;; + +let length = List.length;; + +let nub = Lib.uniq;; + +let sortuniq = setify;; + +(* +let sortuniq xs = uniq (Lib.sort (<) xs);; +*) + +let psort u = if fst u <= snd u then u else (snd u,fst u);; + +let rec cart a b = + match a with + | [] -> [] + | a::rest -> (map (fun x -> (a,x)) b) @ cart rest b;; + +let cart2 a = cart a a;; + + + +(* from parse_ineq *) +let unsplit d f = function + | (x::xs) -> List.fold_left (fun s t -> s^d^(f t)) (f x) xs + | [] -> "";; + +(* let join_comma = unsplit "," (fun x-> x);;*) +let join_semi = unsplit ";" (fun x-> x);; + let join_lines = unsplit "\n" (fun x-> x);; +(* let join_space = unsplit " " (fun x-> x);; *) + +let string_of_list f xs = + let ss = map f xs in + "["^(join_semi ss)^"]";; + +let string_of_pair (i,j) = + Printf.sprintf "(%d,%d)" i j;; + +let string_of_triple (i,j,s) = + Printf.sprintf "(%d,%d,%3.2f)" i j s;; + +let string_of_f f k = + let ks = filter (fun (i,j) -> i 4 * h0, upper bound on diags in BB *) + +let d_tame i = + if (i <= 3) then zero + else if (i=4) then 0.206 + else if (i=5) then 0.4819 + else if (i=6) then 0.712 + else target;; + +let tame_table_d r s = + if (r + 2 * s <= 3) then 0.0 + else + let r' = float_of_int r in + let s' = float_of_int s in + 0.103 *. (2.0 -. s') +. 0.2759 *. (r' +. 2.0 *. s' -. 4.0);; + + +(* +look only at global minumum points for tau*(s,v) (for s fixed) +and such that tau*(s,v)<=0. +Let index(v) = the number of edges st |vi-vj|=a(i,j). +and such that index(v) is minimized among global minimum points in Bs. +Call this set MM(s) (index-minimizers). + +The semantics that guide us will be counterexample propagation; +if a stable constraint system contains a point, does the +output of the function contain a nonempty stable constraint system? + +Formally, we will prove statements of the form for various +f:ACS -> (ACS) list +|- nonempty_M cs ==> (?cs'. mem cs'(f cs) /\ nonempty_M cs'). + +Termination of algorithms: +Every slice decreases k. +Every subdivision restricts the B-field through a finite set of choices + (retaining the M-field) +Every deformation sets a new M-field constraint. + +As a matter of programming style. +Procedures that refer to particular cs's should be avoided, +except the list terminal list. Pass everything else in by argument. +Select from terminal list with filter_terminal + +a_cs,b_cs,am_bs,bm_cs are symmetric functions for args i,j < k. +Their values for args k and large are not relevant. +*) + +type constraint_system = +{ + k_cs : int; + d_cs : float; + a_cs : int->int ->float; + b_cs: int->int->float; + am_cs: int->int->float; + bm_cs: int->int->float; + js_cs : (int*int) list; (* psorted, both < k_cs *) + lo_cs :int list; + str_cs : int list; + history_cs : string list; +};; + +(* +**************************************** +DEBUG +**************************************** +*) + + +let string_of_cs cs = + let s = string_of_list string_of_int in + let k = string_of_int cs.k_cs in + let d = string_of_float cs.d_cs in + let a = string_of_f cs.a_cs (cs.k_cs) in + let b = string_of_f cs.b_cs (cs.k_cs) in + let am = string_of_f cs.am_cs (cs.k_cs) in + let bm = string_of_f cs.bm_cs (cs.k_cs) in + let js = string_of_list string_of_pair cs.js_cs in + let lo = s cs.lo_cs in + let str = s cs.str_cs in + Printf.sprintf + "{\n k=%s;\n d=%s;\n a=%s;\n b=%s;\n am=%s;\n bm=%s;\n js=%s;\n lo=%s;\n str=%s;\n}\n" + k d a b am bm js lo str;; + +let pp_print_cs f cs = pp_print_string f (string_of_cs cs);; + + +(* report(string_of_cs quad_std_cs);; *) +(* #install_printer pp_print_cs;; *) + +let ks_cs cs = (0-- (cs.k_cs -1));; + +let ks_cart cs = cart2 (ks_cs cs);; + +let extensional_equality cs cs' = + let bk = cs.k_cs = cs'.k_cs in + let bd = cs.d_cs = cs'.d_cs in + let m r r' = forall (fun (i,j) -> r i j = r' i j) (ks_cart cs) in + let ba = m cs.a_cs cs'.a_cs in + let bb = m cs.b_cs cs'.b_cs in + let bam = m cs.am_cs cs'.am_cs in + let bbm = m cs.bm_cs cs'.bm_cs in + let ps js = map psort js in + let bj = set_eq (ps cs.js_cs) (ps cs'.js_cs) in + let bstr = set_eq (cs.str_cs) cs'.str_cs in + let blo = set_eq cs.lo_cs cs'.lo_cs in + bk && bd && ba && bb && bam && bbm && bstr && blo && bj;; + + + +let debug_cs = ref [];; + + +let catch_failure cs_term h = + fun cs -> + try + h cs + with Failure _ -> + if exists (extensional_equality cs_term) !debug_cs + then [cs_term] else [];; + +let rec rev_assoc_e e a l = + match l with + (x,y)::t -> if e a y then x else rev_assoc_e e a t + | [] -> failwith "find";; + +let rec build_path e dict cs cs' buf = + if (e cs cs') then cs::buf else + let v = rev_assoc_e e cs' dict in + build_path e dict cs v (cs'::buf);; + +build_path (=) [(0,4);(4,9);(9,3);(9,7)] 0 7 [];; + +let rec mk_assoc h cs_term dict cs_init = + let e = extensional_equality in + if can (Lib.find (e cs_term)) cs_init then dict + else + let out = map h cs_init in + let zs = zip cs_init out in + let f(z,css) = map (fun cs-> (z,cs)) css in + let zss = List.flatten (map f zs) in + mk_assoc h cs_term (zss @ dict) (List.flatten out);; + +let debug_trace h cs_init cs_term = + let dict = mk_assoc h cs_term [] [cs_init] in + build_path extensional_equality dict cs_init cs_term [];; + + +let report_cs cs = report(string_of_cs cs);; + + +let failcs (cs,s) = + report_cs cs; debug_cs:= [cs]; failwith s;; + + +(* +**************************************** +MORE BASIC OPERATIONS +**************************************** +*) + + + +(* +There are B-fields (hard constraints) and M-fields (soft constraints). +The B-fields define the domain of the constraint system s. +The M-fields partition the minimizers in B_s. + +k,a,b, are the primary B-fields +d,j are secondary B-fields that define the function tau. + +lo,str,am,bm are M-fields. + +js represented as pairs (i,j) with i + { + k_cs = k; + a_cs = a; + b_cs = b; + am_cs = am; + bm_cs = bm; + d_cs = d; + js_cs = js; + lo_cs = lo; + str_cs = str; + history_cs = history; +};; + +let hist cs s = modify_cs cs ~h:(s::cs.history_cs) ();; + +(* usage : modify_cs hex_std_cs ~k:4 ();; *) + +let reset_to_unadorned cs = + modify_cs cs ~am:cs.a_cs ~bm:cs.b_cs ~lo:[] ~str:[] ();; + + +let ink k i = (i+1) mod k;; + +let dek k i = (i+k-1) mod k;; + +let inc cs i = ink cs.k_cs i;; + +let dec cs i = dek cs.k_cs i;; + +let inka k a = + map (ink k) a;; + +let mk_j cs i = psort (i,inc cs i);; + +let memj cs (i,j) = mem (psort (i,j)) cs.js_cs;; + +let compact u = length (sortuniq u) = length u;; + +let ks_cs cs = (0-- (cs.k_cs -1));; + +let ks_cart cs = cart2 (ks_cs cs);; + +let alldiag cs = + filter (fun (i,j) -> (i (i psort(i,inc cs i)) ks in + ed;; + +let all = (fun t -> true);; + +let htmax cs p = if (mem p cs.lo_cs) then two else twoh0;; + +let htmin = two;; + +let arcmin cs (i,j) = arc (htmax cs i) (htmax cs j) (cs.am_cs i j);; + +let arcmax cs (i,j) = arc htmin htmin (cs.bm_cs i j);; + +let m_count cs = + let m i = + let j = inc cs i in + (cs.b_cs i j > twoh0 or cs.a_cs i j > two) in + List.length (filter m (ks_cs cs));; + + +(* +**************************************** +BASIC OPS ON CONSTRAINT SYSTEMS +**************************************** +*) + +(* +let is_stable cs = + let f (i,j) = + (i = j) or (2.0 <= cs.a_cs i j) in + let ks = ks_cs cs in + let k2s = cart2 ks in + let bm = forall f k2s or failwith "is_st:bm" in + let bs = zero_diag cs.a_cs ks or failwith "is_st:bs" in + let g i = (cs.b_cs i (inc cs i) <= cstab) in + let bs' = forall g ks or failwith "is_st:bs'" in + let fj (i,j) = not(memj cs (i,j)) or + (sqrt8 = cs.a_cs i j && cs.b_cs i j = cstab) in + let bj = forall fj k2s or failwith "is_st:bj" in + bm && bs && bs' && bj;; + +let is_tri_stable cs = + let bk = (3 = cs.k_cs) or failwith "ts:3" in + let f (i,j) = + (i = j) or (2.0 <= cs.a_cs i j) in + let ks = ks_cs cs in + let k2s = cart2 ks in + let bm = forall f k2s or failwith "ts:bm" in + let bs = zero_diag cs.a_cs ks or failwith "ts:bs" in + let g i = (cs.b_cs i (inc cs i) < four) in + let bs' = forall g ks or failwith "ts:bs'" in + let fj (i,j) = not(memj cs (i,j)) or + (sqrt8 = cs.a_cs i j && cs.b_cs i j = cstab) in + let bj = forall fj k2s or failwith "ts:bj" in + bk && bm && bs && bs' && bj;; +*) + +let is_unadorned cs = + let f (i,j) = (cs.a_cs i j = cs.am_cs i j) && (cs.b_cs i j = cs.bm_cs i j) in + let k2s = ks_cart cs in + let bm = forall f k2s (* or failwith "unadorned" *) in + bm && (cs.lo_cs=[]) && (cs.str_cs=[]);; + +let zero_diag a xs = forall (fun i -> ((=) zero) (a i i)) xs;; + +let stable_constraint_system_test1 cs = + let ks = ks_cs cs in + let k2s = ks_cart cs in + let f (i,j) = + (cs.a_cs i j = cs.a_cs j i) && + (cs.b_cs i j = cs.b_cs j i) && + (cs.am_cs i j = cs.am_cs j i) && + (cs.bm_cs i j = cs.bm_cs j i) && + (cs.a_cs i j <= cs.am_cs i j) && + (cs.am_cs i j <= cs.bm_cs i j) && + (cs.bm_cs i j <= cs.b_cs i j) in + let fj (i,j) = (i < j) && ((inc cs i = j) or (inc cs j = i)) in + let ls = cs.lo_cs @ cs.str_cs in + let _ = ((3 <= cs.k_cs) && (cs.k_cs <= 6) ) or failwith ( "test1:k_bound") in + let _ = (subset ls ks && subset cs.js_cs k2s) or failwith "test1:I_lo, I_str, J" in + let _ = (cs.d_cs < 0.9) or failwith "test1:d_bound" in + let _ = forall f k2s or failwith ("test1:ab_relations") in + let _ = (compact cs.js_cs) or failwith "test1:J set" in + let _ = (forall fj cs.js_cs) or failwith "test1:J edge" in + let _ = (length cs.js_cs + cs.k_cs <= 6) or failwith "test1:card_J" in + ();; + +let stable_constraint_system_test2 cs = + let ks = ks_cs cs in + let k2s = ks_cart cs in + let f2 (i,j) = + (i = j) or (2.0 <= cs.a_cs i j) in + let _ = forall f2 k2s or failwith "test2:a packing" in + let _ = zero_diag cs.a_cs ks or failwith "test2:a diagonal" in + let b_edge i = cs.b_cs i (inc cs i) in + let b_bound i = if (cs.k_cs > 3) then (b_edge i <= cstab) else (b_edge i < four) in + let _ = forall b_bound ks or failwith "test2:b edge bounds" in + let j_bound (i,j) = not(memj cs (i,j)) or + (sqrt8 = cs.a_cs i j && cs.b_cs i j = cstab) in + let _ = forall j_bound k2s or failwith "test2:J bounds" in + let edge (i,j) = (j = inc cs i) or (i = inc cs j) in (* bug corrected 2/23/2013, was (i = inc c i) *) + let fm (i,j) = edge(i,j) && (i < j) && (two < cs.a_cs i j or twoh0< cs.b_cs i j) in + let m = length (filter fm k2s) in + let _ = (m + cs.k_cs <= 6) or failwith "test2:m" in + ();; + +let assert_stable_cs cs = + try + stable_constraint_system_test1 cs; + stable_constraint_system_test2 cs + with Failure s -> failcs(cs,s);; + + +(* f is an edge preserving map *) + +let map_cs f g cs = + let ks = ks_cs cs in + let _ = forall (fun i-> f(g i) = i) ks or failwith "map_cs:not inverse" in + let _ = forall (fun i-> g(f i) = i) ks or failwith "map_cs:not inverse" in + let a' a i j = a (f i) (f j) in + let g2 (i,j) = psort (g i , g j ) in + { + k_cs = cs.k_cs; + d_cs = cs.d_cs; + a_cs = a' (cs.a_cs); + b_cs = a' (cs.b_cs); + am_cs = a' (cs.am_cs); + bm_cs = a' (cs.bm_cs); + lo_cs = map g cs.lo_cs; + str_cs = map g cs.str_cs; + js_cs = map g2 cs.js_cs; + history_cs = cs.history_cs; + };; + +let opposite_cs cs = + let f i = (cs.k_cs - (i+1)) in + map_cs f f cs;; + +let rotate_cs cs = map_cs (inc cs) (dec cs) cs;; + +let rec rotatek_cs k cs = + funpow k rotate_cs cs;; + +(* anadorned isomorphisms *) + +let unadorned_iso_strict_cs cs cs' = + let cs = reset_to_unadorned cs in + let cs' = reset_to_unadorned cs' in + let bk = cs.k_cs = cs'.k_cs in + let bd = cs.d_cs = cs'.d_cs in + let m r r' = forall (fun (i,j) -> r i j = r' i j) (ks_cart cs) in + let ba = m cs.a_cs cs'.a_cs in + let bb = m cs.b_cs cs'.b_cs in + let ps js = map psort js in + let bj = set_eq (ps cs.js_cs) (ps cs'.js_cs) in + bk && bd && ba && bb && bj;; + +let unadorned_iso_proper_cs cs cs' = + Lib.exists (fun i -> unadorned_iso_strict_cs (rotatek_cs i cs) cs') (ks_cs cs);; + +let unadorned_iso_cs cs cs' = + (cs.k_cs = cs'.k_cs) && + ( unadorned_iso_proper_cs cs cs' or unadorned_iso_proper_cs (opposite_cs cs) cs');; + + + +(* +**************************************** +FUNCTION BUILDERS +**************************************** +*) + +let cs_adj adj diag k i j = + let s t = string_of_int t in + if (i<0) or (j<0) or (i>=k) or (j>=k) + then failwith ("adj out of range"^(s k)^(s i)^(s j)) + else if (i=j) then zero + else if (j = ink k i) or (i = ink k j) then adj + else diag;; + +let a_pro pro adj diag k i j = + if (i<0) or (j<0) or (i>=k) or (j>=k) then failwith "pro out of range" + else if (i=j) then zero + else if (i=0 && j=1) or (j=0 && i=1) then pro + else if (j = ink k i) or (i = ink k j) then adj + else diag ;; + +(* OLD BUG IF data not sorted: +let funlist data d i j = + if (i=j) then zero + else assocd (psort (i,j)) data d;; +*) + +let funlist data = + let data' = map (fun ((i,j),d) -> (psort(i,j),d)) data in + fun d i j -> + if (i=j) then zero + else assocd (psort (i,j)) data' d;; + +let override a (p,q,d) i j = + if psort (p,q) = psort (i,j) then d else a i j;; + +let overrides a data = + let fd = funlist data in + fun i j -> + fd (a i j) i j;; + + + +(* +**************************************** +TABLES OF AUGMENTED CONSTRAINT SYSTEMS +**************************************** +*) + +let mk_unadorned (k,d,a,b,h) = { + k_cs = k; + d_cs = d; + a_cs = a; + b_cs = b; + am_cs = a; + bm_cs = b; + js_cs = []; + lo_cs = []; + str_cs = []; + history_cs = [h]; +};; + +let hex_std_cs = mk_unadorned (6, d_tame 6, + cs_adj two twoh0 6, + cs_adj twoh0 upperbd 6,"hex std init");; + +let pent_std_cs = mk_unadorned (5,d_tame 5, + cs_adj two twoh0 5, + cs_adj twoh0 upperbd 5,"pent std init");; + +let quad_std_cs = mk_unadorned (4,d_tame 4, + cs_adj two twoh0 4, + cs_adj twoh0 upperbd 4,"quad std init");; + +let tri_std_cs = mk_unadorned (3,d_tame 3, + cs_adj two twoh0 3, + cs_adj twoh0 upperbd 3,"tri std init");; + +let pent_diag_cs = mk_unadorned ( + 5, + 0.616, + cs_adj two sqrt8 5, + cs_adj twoh0 upperbd 5,"pent diag init");; + +let quad_diag_cs = mk_unadorned ( + 4, + 0.467, + cs_adj two three 4, + cs_adj twoh0 upperbd 4,"quad diag init");; + +let pent_pro_cs = mk_unadorned ( + 5, + 0.616, + a_pro twoh0 two twoh0 5, + a_pro sqrt8 twoh0 upperbd 5,"pent pro init");; + +let quad_pro_cs = mk_unadorned ( + 4, + 0.477, + a_pro twoh0 two sqrt8 4, + a_pro sqrt8 twoh0 upperbd 4,"quad pro init");; + +let init_cs = [ + hex_std_cs ; + pent_std_cs ; + quad_std_cs ; + tri_std_cs ; + pent_diag_cs ; + quad_diag_cs ; + pent_pro_cs ; + quad_pro_cs ; +];; + +map assert_stable_cs init_cs;; +(forall is_unadorned init_cs) or failwith "init_cs:unadorned";; + +(* now for the terminal cases done by interval computer calculation *) + +let terminal_hex = +mk_unadorned ( + 6, + d_tame 6, + cs_adj two cstab 6, + cs_adj two upperbd 6,"terminal hex");; + +let terminal_pent = +mk_unadorned ( + 5, + 0.616, + cs_adj two cstab 5, + cs_adj two upperbd 5,"terminal pent");; + +(* two cases for the 0.467 bound: all top edges 2 or both diags 3 *) + +let terminal_adhoc_quad_5691615370 = (* doesn't exist: rhombus side 2, diags >= 3 *) +mk_unadorned ( + 4, + 0.467, + cs_adj two three 4, + cs_adj two upperbd 4,"terminal");; + +let terminal_adhoc_quad_9563139965B = +mk_unadorned ( + 4, + 0.467, + cs_adj two three 4, + cs_adj twoh0 three 4,"terminal");; + +let terminal_adhoc_quad_4680581274 = mk_unadorned( + 4, + 0.616 -. 0.11, + funlist [(0,1),cstab ; (0,2),cstab ; (1,3),cstab ] two, + funlist [(0,1),cstab ; (0,2),upperbd ; (1,3),upperbd ] two,"terminal 4680581274");; + +let terminal_adhoc_quad_7697147739 = mk_unadorned( + 4, + 0.616 -. 0.11, + funlist [(0,1),sqrt8 ; (0,2),cstab ; (1,3),cstab ] two, + funlist [(0,1),sqrt8 ; (0,2),upperbd ; (1,3),upperbd ] two,"terminal 7697147739");; + +(* special case of tri_492... +let terminal_tri_3456082115 = mk_unadorned( + 3, + 0.5518 /. 2.0, + funlist [(0,1), cstab; (0,2),twoh0; (1,2),two] two, + funlist [(0,1), 3.22; (0,2),twoh0; (1,2),two] two,"terminal 3456082115");; +*) + +let terminal_tri_7720405539 = mk_unadorned( + 3, + 0.5518 /. 2.0 -. 0.2, + funlist [(0,1),cstab; (0,2),twoh0; (1,2),two] two, + funlist [(0,1),3.41; (0,2),twoh0; (1,2),two] two,"terminal 7720405539");; + +let terminal_tri_2739661360 = mk_unadorned( + 3, + 0.5518 /. 2.0 +. 0.2, + funlist [(0,1),cstab; (0,2),cstab; (1,2),two] two, + funlist [(0,1),3.41; (0,2),cstab; (1,2),two] two,"terminal 2739661360");; + +(* range increased by combining with previous case *) + +let terminal_tri_9269152105 = mk_unadorned( + 3, + 0.5518 /. 2.0 , + funlist [(0,1),cstab; (0,2),cstab; (1,2),two] two, + funlist [(0,1),3.62; (0,2),cstab; (1,2),two] two,"terminal 9269152105");; + +let terminal_tri_4922521904 = mk_unadorned( + 3, + 0.5518 /. 2.0 , + funlist [(0,1),cstab; (0,2),twoh0; (1,2),two] two, + funlist [(0,1),3.339; (0,2),twoh0; (1,2),two] two,"terminal 4922521904");; + +(* +Note: May 25, 2012. +The interval ineq requires bounds on (0,2) of 3.41 3.634, +but we have Delta[3.634,2,2,3.01,2.52,3.01]<0, so the upper bound +always holds. +In the range 3.01--3.41, we can slice and use +upper echelon inequalities _772 and _273. +I haven't implemented this, but it would be an easy extension of +the upper_echelon procedure. + +OK. Implemented as upper_echelonC. +We no longer need quad_163. +We use 5512912661 deformation: 3.15/h0 instead +*) + +(* +let terminal_quad_1637868761 = mk_unadorned( + 4, + 0.5518, + funlist [(0,1),two; (1,2), cstab; + (2,3),twoh0; (0,3),two; (0,2),3.41; (1,3),cstab] two, + funlist [(0,1),two; (1,2), cstab; + (2,3),twoh0; (0,3),two; (0,2),3.634; (1,3),upperbd] two,"terminal 1637868761");; +*) + +(* +let terminal_quad_1637868761 = mk_unadorned( + 4, + 0.5518, + funlist [(0,1),two; (1,2), cstab; + (2,3),twoh0; (0,3),two; (0,2),cstab; (1,3),cstab] two, + funlist [(0,1),two; (1,2), cstab; + (2,3),twoh0; (0,3),two; (0,2),upperbd; (1,3),upperbd] two,"terminal 1637868761");; +*) + + +let ear_cs = +{ + k_cs = 3; + d_cs = 0.11; + a_cs = funlist [(0,1),sqrt8] two; + b_cs = funlist [(0,1),cstab] twoh0; + am_cs = funlist [(0,1),sqrt8] two; + bm_cs = funlist [(0,1),cstab] twoh0; + js_cs = [0,1]; + lo_cs = []; + str_cs = []; + history_cs= ["ear 3603097872"]; +};; + +(* two consequences of usual ear *) +let ear_jnull = modify_cs ear_cs ~js:[] ();; + +let ear_stab = mk_unadorned( + 3, + djz, + funlist [(0,2),cstab] two, + funlist [(0,2),cstab] twoh0, + "ear_stab" +);; + +let terminal_ear_3603097872 = ear_cs;; + +let terminal_tri_5405130650 = +{ + k_cs = 3; + d_cs = 0.477 -. 0.11; + a_cs = funlist [(0,1),sqrt8;(0,2),twoh0;(1,2),two] two; + b_cs = funlist [(0,1),cstab;(0,2),sqrt8;(1,2),twoh0] twoh0; + am_cs = funlist [(0,1),sqrt8;(0,2),twoh0;(1,2),two] two; + bm_cs = funlist [(0,1),cstab;(0,2),sqrt8;(1,2),twoh0] twoh0; + js_cs = [0,1]; + lo_cs = []; + str_cs = []; + history_cs=["terminal 5405130650"]; +};; + +let terminal_tri_5766053833 = +{ + k_cs = 3; + d_cs = 0.696 -. 2.0 *. 0.11; + a_cs = funlist [(0,1),sqrt8;(1,2),sqrt8] two; + b_cs = funlist [(0,1),cstab;(1,2),cstab] two; + am_cs = funlist [(0,1),sqrt8;(1,2),sqrt8] two; + bm_cs = funlist [(0,1),cstab;(1,2),cstab] two; + js_cs = [(0,1);(1,2)]; + lo_cs = []; + str_cs = []; + history_cs=["terminal 5766053833"]; +};; + +let terminal_tri_5026777310a = mk_unadorned( + 3, + 0.6548 -. 2.0 *. 0.11, + funlist [(0,1),sqrt8;(1,2),sqrt8] two, + funlist [(0,1),cstab;(1,2),cstab] twoh0,"terminal 5026777310a");; + +let terminal_tri_7881254908 = mk_unadorned( + 3, + 0.696 -. 2.0 *. 0.11, + funlist [(0,1),sqrt8;(1,2),sqrt8] twoh0, + funlist [(0,1),cstab;(1,2),cstab] twoh0,"terminal 7881254908");; + +let terminal_std_tri_OMKYNLT_3336871894 = mk_unadorned( + 3, + zero, + funlist [] two, + funlist [] two,"terminal 3336871894");; + + +(* +(* 1107929058 *) +let terminal_std_tri_OMKYNLT_2_1 = mk_unadorned( + 3, + tame_table_d 2 1, + funlist [(0,1),twoh0] two, + funlist [(0,1),twoh0] two,"terminal 1107929058");; + +let terminal_std_tri_7645170609 = mk_unadorned( + 3, + tame_table_d 2 1, + funlist [(0,1),sqrt8] two, + funlist [(0,1),sqrt8] two,"terminal 7645170609");; + +(* 1532755966 *) +let terminal_std_tri_OMKYNLT_1_2 = mk_unadorned( + 3, + tame_table_d 1 2, + funlist [(0,1),two] twoh0, + funlist [(0,1),two] twoh0,"terminal 1532755966");; + +let terminal_std_tri_7097350062a = mk_unadorned( + 3, + tame_table_d 1 2, + funlist [(0,1),twoh0;(0,2),sqrt8] two, + funlist [(0,1),twoh0;(0,2),sqrt8] two,"terminal 7097350062a");; + +let terminal_std_tri_2900061606 = mk_unadorned( + 3, + tame_table_d 1 2 +. (tame_table_d 2 1 -. 0.11), + funlist [(0,1),twoh0;(0,2),cstab] two, + funlist [(0,1),twoh0;(0,2),cstab] two,"terminal 2900061606");; + +let terminal_std_tri_2200527225 = mk_unadorned( + 3, + tame_table_d 1 2 +. 2.0*. (tame_table_d 2 1 -. 0.11), + funlist [(0,1),two;] sqrt8, + funlist [(0,1),two;] sqrt8,"terminal 2200527225");; + +let terminal_std_tri_3106201101 = mk_unadorned( + 3, + tame_table_d 1 2 +. 2.0*. (tame_table_d 2 1 -. 0.11), + funlist [(0,1),two;(0,2),cstab] sqrt8, + funlist [(0,1),two;(0,2),cstab] sqrt8,"terminal 3106201101");; + +let terminal_std_tri_9816718044 = mk_unadorned( + 3, + tame_table_d 1 2 +. 2.0*. (tame_table_d 2 1 -. 0.11), + funlist [(0,1),two] cstab, + funlist [(0,1),two] cstab,"terminal 9816718044");; + +let terminal_std_tri_1080462150 = mk_unadorned( + 3, + tame_table_d 0 3 +. 3.0 *.(tame_table_d 2 1 -. 0.11), + funlist [] twoh0, + funlist [] twoh0,"terminal 1080462150");; + +let terminal_std_tri_4143829594 = mk_unadorned( + 3, + tame_table_d 0 3 +. 3.0 *.(tame_table_d 2 1 -. 0.11), + funlist [(0,1),cstab] twoh0, + funlist [(0,1),cstab] twoh0,"terminal 4143829594");; + +let terminal_std_tri_7459553847 = mk_unadorned( + 3, + tame_table_d 0 3 +. 3.0 *.(tame_table_d 2 1 -. 0.11), + funlist [(0,1),twoh0] cstab, + funlist [(0,1),twoh0] cstab,"terminal 7459553847");; + +let terminal_std_tri_4528012043 = mk_unadorned( + 3, + tame_table_d 0 3 +. 3.0 *.(tame_table_d 2 1 -. 0.11), + funlist [] cstab, + funlist [] cstab,"terminal 4528012043");; +*) + +(* added 2013-06-04 *) + +let terminal_tri_4010906068 = mk_unadorned( + 3, + 0.476, + funlist [] twoh0, + funlist [] cstab,"terminal 4010906068");; + +let terminal_tri_6833979866 = mk_unadorned( + 3, + 0.2759, + funlist [(0,1),two] twoh0, + funlist [(0,1),twoh0] cstab,"terminal 6833979866");; + +let terminal_tri_5541487347 = mk_unadorned( + 3, + 0.103, + funlist [(0,1),twoh0] two, + funlist [(0,1),sqrt8] twoh0,"terminal 5541487347");; + + + + +(* use unit_cs as a default terminal object + +let unit_cs = terminal_std_tri_OMKYNLT_3336871894;; + *) + + +let terminal_cs = [ + terminal_hex; + terminal_pent; + terminal_adhoc_quad_5691615370; + terminal_adhoc_quad_9563139965B; + terminal_adhoc_quad_4680581274; + terminal_adhoc_quad_7697147739; + +(* upper echelon related *) + terminal_tri_7720405539; + terminal_tri_2739661360; + terminal_tri_9269152105; + terminal_tri_4922521904; + +(* ear related *) + terminal_ear_3603097872; + ear_jnull; + terminal_tri_5405130650; + + + terminal_tri_5026777310a; + terminal_tri_7881254908; + terminal_std_tri_OMKYNLT_3336871894; + +(* added 2013-06-04 *) +terminal_tri_4010906068; +terminal_tri_6833979866; +terminal_tri_5541487347; + +(* terminal_tri_3456082115; special case of tri_492... *) +(* terminal_quad_1637868761; *) +(* ear_stab; test 2013-06-03 *) +(* terminal_tri_5766053833; *) (* removed 2013-06-03 *) + + +(* removed 2013-06-04 + terminal_std_tri_OMKYNLT_2_1 ; (* 1107929058 *) + terminal_std_tri_7645170609; + terminal_std_tri_OMKYNLT_1_2 ; (* 1532755966 *) + terminal_std_tri_7097350062a; + terminal_std_tri_2900061606; + terminal_std_tri_2200527225; + terminal_std_tri_3106201101; + terminal_std_tri_9816718044; + terminal_std_tri_1080462150; + terminal_std_tri_4143829594; + terminal_std_tri_7459553847; + terminal_std_tri_4528012043; +*) + +];; + +let filter_terminal f = filter f terminal_cs;; + +map ( assert_stable_cs) (filter_terminal all);; +(forall ( is_unadorned) (filter_terminal all)) or failwith "terminal_cs:unadorned";; + +let is_ear cs = + (cs.k_cs = 3) && (length cs.js_cs = 1) && (unadorned_iso_cs cs ear_cs);; + + +(* +**************************************** +OPERATIONS AND TRANSFORMATIONS +**************************************** +*) + +(* transfer move an M-field to a larger + B-fields resetting M-fields. b5 not used *) + +let transfer_to = + let machine_eps = 1e-08 in + let b1 cs cs' = (cs.k_cs = cs'.k_cs) in + let b2 cs cs' = (cs.d_cs <= cs'.d_cs +. machine_eps) in + let c3 cs cs' (i,j) = + cs.am_cs i j >= cs'.a_cs i j && cs.bm_cs i j <= cs'.b_cs i j in + let b3 cs cs' = forall (c3 cs cs') (allpair cs) in + let b4 cs cs' = + if is_ear cs then is_ear cs' + else subset (map psort cs'.js_cs) (map psort cs.js_cs) in + let b5 cs cs' = + subset cs'.lo_cs cs.lo_cs && + subset cs'.str_cs cs.str_cs in + fun cs cs' -> + is_unadorned cs' && + b1 cs cs' && b2 cs cs' && b3 cs cs' && b4 cs cs' ;; + +let proper_transfer_cs cs cs' = + Lib.exists (fun i -> transfer_to (rotatek_cs i cs) cs') (ks_cs cs);; + +let equi_transfer_cs cs cs' = + (cs.k_cs = cs'.k_cs) && + ( proper_transfer_cs cs cs' or proper_transfer_cs (opposite_cs cs) cs');; + +let equi_transfer_to_list terminals = + let f1 = map (C equi_transfer_cs) terminals in + fun cs -> exists (fun f -> f cs) f1;; + +let rec transfer_union a b = + match a with + [] -> b + | a::aas -> if exists (equi_transfer_cs a) b + then transfer_union aas b + else + let b' = filter (not o (C equi_transfer_cs a)) b in + transfer_union aas (a::b');; + +(* optimized version of equi_transfer_to_list *) + +let x_equi_transfer_to_list terms = + let machine_eps = 1e-08 in + let _ = not (can (Lib.find (not o is_unadorned)) terms) or failwith "eq:unadorned" in + let has_ear = exists is_ear terms in + let rotates cs = map (fun i -> rotatek_cs i cs) (ks_cs cs) in + let orotates cs = map (fun i -> rotatek_cs i (opposite_cs cs)) (ks_cs cs) in + let props = List.flatten (map rotates terms) in + let oprops = List.flatten (map orotates terms) in + let terms = (props @ oprops) in + let list_le = forall2 (<=) in + let eval_ls f cs = map (fun(i,j)-> f i j) (allpair cs) in + let dump_e cs = (cs.k_cs,cs.d_cs+.machine_eps, + eval_ls cs.a_cs cs,eval_ls cs.b_cs cs, + cs.js_cs) in + let dump_m cs = (cs.k_cs,cs.d_cs,eval_ls cs.am_cs cs,eval_ls cs.bm_cs cs, + sortuniq (map psort cs.js_cs)) in + let dump' = setify (map (dump_e) terms) in + fun cs -> + if is_ear cs then has_ear + else + let (k,d,am,bm,js) = dump_m cs in + exists (fun (k',d',a',b',js') -> + (k=k') && (d<=d') && (list_le a' am) && + (list_le bm b') && (subset (js') (map psort js))) dump';; + +(* changes B-field, M remains a minimizer on smaller domain. Type 1 restriction. + The only places b gets modified is with restrict_type1_cs, restrict_type2_cs, subdivision, and + initialization of pents. +*) + +let restrict_type1_cs cs = + (* preconditions added 2013-05-15 *) + let k = cs.k_cs in + let jcount = List.length (filter (fun i -> memj cs (i,inc cs i)) (ks_cs cs)) in + let _ = jcount = 0 or 3 < k or failwith "type1 cs 1" in + (modify_cs cs ~b:cs.bm_cs ());; + +(* restrict shrinks to B-field down to the M-field, + leaving M-field intact. *) + +let restrict_type2_cs cs = + (* 2013-05-14, added preconditions *) + let k = cs.k_cs in + let jcount = List.length (filter (fun i -> memj cs (i,inc cs i)) (ks_cs cs)) in + let _ = jcount = 0 or failwith "type2 cs" in + let _ = forall (fun i -> cs.am_cs i i = zero) (ks_cs cs) or failwith "type2 zero" in + let cs' = modify_cs cs ~a:cs.am_cs ~b:cs.bm_cs () in + let _ = m_count cs' + k <= 6 or failwith "type2 cs 2" in + cs';; + +(* half_slice works on B-fields, resetting M-fields. + This version does not create an ear. + It does just one side. *) + +let half_slice cs p q dv = + (* 2013-05-14, long diag preconditions added *) + let k = cs.k_cs in + let _ = (k = 4) or (cs.bm_cs p q <= cstab) or failwith "half_slice long diag" in + let _ = (cs.bm_cs p q < 4.0) or failwith "half_slice long diag" in + let p = p mod k in + let q = q mod k in + let q' = if (q2) or failwith "half_slice underflow" in + let _ = (k' < k) or failwith "half_slice overflow" in + let r i = (i + k - p) mod k in + let s i' = (i' + p) mod k in + let shift f i' j' = f (s i') (s j') in + let cd1 = mk_unadorned (k',dv,shift a, shift b,"slice:"^(join_semi cs.history_cs)) in + let js = map (fun (i,j) -> psort (r i,r j)) (intersect (cart2 (p--q)) cs.js_cs) in + let cd2 = modify_cs cd1 ~js:js () in + cd2;; + +(* calculate the value of the new d from the old one, + using standard assumptions about the desired terminal inequalities. + This does cases where no "ear" is involved. + This inequality is to be used when every edge has bounds in + one of the three intervals [2,2h0], [2h0,sqrt8], [sqrt8,3.01] *) + +let calc_d_std_earless cs p q = + let k = cs.k_cs in + let p = p mod k in + let q = q mod k in + let d = cs.d_cs in + let q' = if (q 4) + then + (if (inc2 p = q) then (p,q,false) else (q,p,true)) + else + let p1 = inc cs p in + let _ = (inc cs p1 = q) or failwith "sso:not a diag" in + (if (edge1(p,p1) && edge1(p1,q)) then (p,q,false) else (q,p,true));; + +let calc_d_std cs p q = + let k = cs.k_cs in + let swap (a,b) = (b,a) in + let inc3 = funpow 3 (inc cs) in + if (k=6) && (inc3 p = q) + then + let d = cs.d_cs /. two in (d,d) + else + let (p,q,swapped) = sort_slice_order cs p q in + let d = + try + calc_d_std_earless cs p q + with Not_found -> failwith "calc_d_std" in + (if swapped then swap d else d);; + +let slice_cs cs p q dvpq dvqp mk_ear = + let machine_eps = 1e-08 in (* will go away in formalization *) + let _ = dvpq +. dvqp +. machine_eps >= cs.d_cs or failwith "slice_cs:bad d" in + let cpq = half_slice cs p q dvpq in + let cqp = half_slice cs q p dvqp in + let addj cs = modify_cs cs ~js:((0,(cs.k_cs - 1))::cs.js_cs) () in + let cpq = if (mk_ear) then addj cpq else cpq in + let cqp = if (mk_ear) then addj cqp else cqp in + let _ = not(mk_ear) or is_ear cpq or is_ear cqp or failwith "slice_cs:ear" in + [cpq;cqp];; + +let slice_std cs p q = + let (dvpq,dvqp) = calc_d_std cs p q in + let mk_ear = false in + let rv = slice_cs cs p q dvpq dvqp mk_ear in + let _ = forall (fun cs' -> cs'.k_cs < cs.k_cs) rv in + rv;; + + +(* +**************************************** +DEFORMATIONS +**************************************** +*) + + +(* deformation acts on M-fields, keeping the domain fixed. *) + +let deform_ODXLSTC_cs p cs = + let p0 = dec cs p in + let p1 = p in + let p2 = inc cs p in + let ks = ks_cs cs in + let ksp = subtract ks [p] in + let diag = subtract ks [p0;p1;p2] in + let _ = mem p ks or failwith "odx:out of range" in + let _ = not(memj cs (p0,p1)) or raise Unchanged in + let _ = not(memj cs (p1,p2)) or raise Unchanged in + let _ = not(mem p cs.lo_cs) or raise Unchanged in + let m q = (cs.a_cs p1 q = cs.bm_cs p1 q) in + let _ = forall (not o m) ksp or raise Unchanged in + let n q = (fourh0 < cs.b_cs p1 q) in + let _ = forall n diag or raise Unchanged in + let cs1 = modify_cs cs ~lo:(sortuniq (p::cs.lo_cs)) () in + let csp q = + if (cs.am_cs p q > cs.a_cs p q) then None + else Some (modify_cs cs ~bm:(override cs.bm_cs (p,q,cs.a_cs p q)) ()) in + cs1::(filter_some(map csp ksp));; + +let deform_IMJXPHR_cs p cs = + let p0 = dec cs p in + let p1 = p in + let p2 = inc cs p in + let ks = ks_cs cs in + let ksp = subtract ks [p] in + let diag = subtract ks [p0;p1;p2] in + let _ = mem p ks or failwith ("imj:out of range"^(string_of_int p)) in + let _ = mem p cs.str_cs or raise Unchanged in + let _ = not(memj cs (p0,p1)) or raise Unchanged in + let _ = not(memj cs (p1,p2)) or raise Unchanged in + let _ = not(mem p cs.lo_cs) or raise Unchanged in + let m q = (cs.a_cs p1 q = cs.bm_cs p1 q) in + let _ = forall (not o m) diag or raise Unchanged in + let _ = (m p0 <> m p2) or raise Unchanged in (* boolean xor *) + let p' = if (m p0) then p0 else p2 in + let ksp' = subtract ksp [p'] in + let n q = (fourh0 < cs.b_cs p1 q) in + let _ = forall n diag or raise Unchanged in + let cs1 = modify_cs cs ~lo:(sortuniq (p::cs.lo_cs)) () in + let csp q = + if (cs.am_cs p q > cs.a_cs p q) then None + else Some(modify_cs cs ~bm:(override cs.bm_cs (p,q,cs.a_cs p q)) ()) in + cs1::(filter_some(map csp ksp'));; + +let deform_NUXCOEA_cs p cs = + let p0 = dec cs p in + let p1 = p in + let p2 = inc cs p in + let ks = ks_cs cs in + let ksp = subtract ks [p] in + let diag = subtract ks [p0;p1;p2] in + let _ = mem p ks or failwith ("nux:out of range"^(string_of_int p)) in + let _ = mem p cs.str_cs or raise Unchanged in + let _ = not(memj cs (p0,p1)) or raise Unchanged in + let _ = not(memj cs (p1,p2)) or raise Unchanged in + let m q = (cs.a_cs p1 q = cs.bm_cs p1 q) in + let _ = forall (not o m) diag or raise Unchanged in + let _ = (m p0 <> m p2) or raise Unchanged in (* boolean xor *) + let p' = if (m p0) then p0 else p2 in + let ksp' = subtract ksp [p'] in + let n q = (fourh0 < cs.b_cs p1 q) in + let _ = forall n diag or raise Unchanged in + let csp q = + if (cs.am_cs p q > cs.a_cs p q) then None + else Some(modify_cs cs ~bm:(override cs.bm_cs (p,q,cs.a_cs p q)) ()) in + (filter_some(map csp ksp'));; + +(* +apply M-field deformation at (p,p+1)=(p1,p2) +This assumes not lunar. +*) + +let deform_1834976373_A1_single p cs = + let p1 = p in + let p2 = inc cs p in + let ks = ks_cs cs in + let alldiag' = alldiag cs in + let _ = mem p ks or failwith "1834:out of range" in + let _ = arcmax cs (p1, p2) < arc1553 or + raise Unchanged in + let _ = not(memj cs (p1,p2)) or raise Unchanged in + let _ = not(mem p1 cs.str_cs) or raise Unchanged in + let _ = not(mem p2 cs.str_cs) or raise Unchanged in + let m (i,j) = (cs.a_cs i j = cs.bm_cs i j) in + let _ = forall (not o m) alldiag' or raise Unchanged in + let _ = not (m (p1,p2)) or raise Unchanged in + let m' (i,j) = (cs.b_cs i j = cs.am_cs i j) in + let _ = not (m'(p1,p2)) or raise Unchanged in + let n (i,j) = (fourh0 < cs.b_cs i j) in + let _ = forall n alldiag' or raise Unchanged in + let cs1 = modify_cs cs ~str:(sortuniq (p1::cs.str_cs)) () in + let cs2 = modify_cs cs ~str:(sortuniq (p2::cs.str_cs)) () in + let cspq (p,q) = + if (cs.am_cs p q > cs.a_cs p q) then None + else Some (modify_cs cs ~bm:(override cs.bm_cs (p,q,cs.a_cs p q)) ()) in + let cspq' (p,q) = + if (cs.bm_cs p q < cs.b_cs p q) then None + else Some (modify_cs cs ~am:(override cs.am_cs (p,q,cs.b_cs p q)) ()) in + cs1::cs2:: + (filter_some(cspq' (p1,p2) :: (cspq (p1,p2)) ::(map cspq alldiag')));; + +(* +apply M-field deformation at straight p=p1, double edge (p0,p1) (p1,p2) +This assumes not lunar. +*) + +let deform_1834976373_A1_double p cs = + let p0 = dec cs p in + let p1 = p in + let p2 = inc cs p in + let ks = ks_cs cs in + let alldiag = alldiag cs in + let _ = mem p ks or failwith "1834-double:out of range" in + let _ = (arcmax cs (p1,p2) +. arcmax cs (p0,p1) < arc1553) or + raise Unchanged in + let _ = not(memj cs (p1,p2)) or raise Unchanged in + let _ = not(memj cs (p0,p1)) or raise Unchanged in + let _ = not(mem p0 cs.str_cs) or raise Unchanged in + let _ = mem p1 cs.str_cs or raise Unchanged in + let _ = not(mem p2 cs.str_cs) or raise Unchanged in + let m (i,j) = (cs.a_cs i j = cs.bm_cs i j) in + let _ = forall (not o m) alldiag or raise Unchanged in + let _ = not (m (p1,p2) && m(p0,p1)) or raise Unchanged in + let m' (i,j) = (cs.b_cs i j = cs.am_cs i j) in + let _ = not (m'(p1,p2) && m'(p0,p1)) or raise Unchanged in + let n (i,j) = (fourh0 < cs.b_cs i j) in + let _ = forall n alldiag or raise Unchanged in + let cs1 = modify_cs cs ~str:(sortuniq (p0::cs.str_cs)) () in + let cs2 = modify_cs cs ~str:(sortuniq (p2::cs.str_cs)) () in + let cspq (p,q) = + if (cs.am_cs p q > cs.a_cs p q) then None + else Some (modify_cs cs ~bm:(override cs.bm_cs (p,q,cs.a_cs p q)) ()) in + let csmin = + if (cs.am_cs p1 p2 > cs.a_cs p1 p2 or cs.am_cs p0 p1 > cs.a_cs p0 p1) + then None + else Some (modify_cs cs ~bm:(overrides cs.bm_cs + [(p0,p1),cs.a_cs p0 p1; (p1,p2),cs.a_cs p1 p2]) ()) in + let csmax = + if (cs.bm_cs p1 p2 < cs.b_cs p1 p2 or cs.bm_cs p0 p1 < cs.b_cs p0 p1) + then None + else Some (modify_cs cs ~am:(overrides cs.am_cs + [(p0,p1),cs.b_cs p0 p1; (p1,p2),cs.b_cs p1 p2]) ()) in + cs1::cs2::(filter_some(csmin :: csmax:: (map cspq alldiag)));; + + +(* +apply M-field deformation at (p,p+1)=(p1,p2) +*) + +(* +correction -- originally I had constraints on the straightness +of p0. By the beta lemma for nonreflexive local fans (or rather by the +monotonocity of dih in the opposite edge), the +azimuth angle is decreasing at p0 as p1 pivots in the direction of p2. +So cs0 is not used. +*) + +let deform_4828966562 p0 p1 p2 cs = + let ks = ks_cs cs in + let diag = subtract ks [p0;p1;p2] in + let _ = mem p1 ks or failwith "482:out of range" in + let _ = (three <= cs.a_cs p0 p2) or raise Unchanged in + let _ = (cs.b_cs p1 p2 <= twoh0) or raise Unchanged in + let _ = (cs.b_cs p0 p1 <= cstab) or raise Unchanged in + let _ = (cs.a_cs p1 p2 < cs.bm_cs p1 p2) or raise Unchanged in + let _ = not(memj cs (p1,p2)) or raise Unchanged in +(* let _ = not(mem p0 cs.str_cs) or raise Unchanged in *) + let _ = not(mem p1 cs.str_cs) or raise Unchanged in + let _ = not(mem p2 cs.str_cs) or raise Unchanged in + let m q = (cs.a_cs p1 q = cs.bm_cs p1 q) in + let _ = forall (not o m) diag or raise Unchanged in + let n q = (fourh0 < cs.b_cs p1 q) in + let _ = forall n diag or raise Unchanged in +(* let cs0 = modify_cs cs ~str:(sortuniq (p0::cs.str_cs)) () in *) + let cs1 = modify_cs cs ~str:(sortuniq (p1::cs.str_cs)) () in + let cs2 = modify_cs cs ~str:(sortuniq (p2::cs.str_cs)) () in + let cspq q = + if (cs.am_cs p1 q > cs.a_cs p1 q) then None + else Some (modify_cs cs ~bm:(override cs.bm_cs (p1,q,cs.a_cs p1 q)) ()) in + (* cs0:: *) cs1::cs2:: + (filter_some( (cspq p2) ::(map cspq diag)));; + +let deform_4828966562A p cs = + let p0 = dec cs p in + let p1 = p in + let p2 = inc cs p in + deform_4828966562 p0 p1 p2 cs;; + +let deform_4828966562B p cs = + let p0 = dec cs p in + let p1 = p in + let p2 = inc cs p in + deform_4828966562 p2 p1 p0 cs;; + +(* +Obsolete comment. +Use obtuse angle at p1 to avoid node straigtenings. +Uses "1117202051" and "4559601669" for obtuseness criteria. +//This one could cause infinite looping because we are deleting +//attributes str_cs at p0 p1. +Only use as a last resort. + +Update: looping prevented. +It is a bad choice of words to call these deformations. +We are not actually +deforming, we are listing the constraints that prevent deformation. +The deformation might be a diagonal at its lower bound, +a straight node at p1, or an edge (p1,p2) at its lower bound. + +If there are other conditions in the stable constraint system, that is ok. +If mem p2 cs.str_cs, then we don't need to eliminate it, because +we never deform it. We are just saying that if an element of M_s +has a straight node at p2, then it must also have some other constraint +that prevents deformation. + +So I have modified the code so not to remove p0 p2 from str_cs. + +*) + +(* check for obtuse angle at p1, based on delta_x4 calcs in main_estimate_ineq.hl, + 117202051, 2449601669, 45596016696. *) + +let obtuse_crit cs p0 p1 p2 = + ((cs.bm_cs p0 p1= two) && (mem p2 cs.lo_cs)) or + (mem p0 cs.lo_cs && mem p2 cs.lo_cs) or + ((cs.bm_cs p0 p1=two) && (mem p0 cs.lo_cs) );; + +(* +Explanation of obtuse_sloc in the next deformation lemma. +Preconditions: hexagon (k=6) and three straights: p0,p4 and either p3 or p5, + making an effective triangle. +Precondition: bm p1 p2 <= twoh0 +The spherical law of cosines arg has been replaced with ineq 8430954724, +which does it as an ineq delta4_y < 0. + +Here is the old argument: +new condition for obtuseness by spherical law of cosines. +if p3 p4 are both straight, then the three segments +give cos c <= cos(3.0 *. arc 2.52 2.52 2.) < -0.76 < -0.6. +If there are a total of 3 straights, then we have an effective triangle arclengths a,b,c=opposite. +assume p1 p2 are not straight and the side p1 p2 [2,2.52]. +Then (0.206,0.685)=(cos(arc 2. 2. 2.52),cos(arc 2.52 2.52 2.)). +By the sloc, cos c - cos a cos b <= cos c + |cos a cos b| + < cos c + 0.6 < 0. and we are obtuse. + +If we try to make p5 straight, we have three consec straights p4,p5,p0. +making a chain of 4 edges. arc[2,2,2.52]*4 > pi, making a circular fan. +Hence the preconditions imply that p3 (not p5) is straight. +It is stated as it is, because we don't know if p0,p1,p2 are a inc sequence +or dec sequence, so only p4 is well-defined. +*) + + +let deform_4828966562_obtuse p0 p1 p2 cs = + let ks = ks_cs cs in + let diag = subtract ks [p0;p1;p2] in + let _ = mem p1 ks or failwith "482:out of range" in + let _ = (cstab <= cs.a_cs p0 p2) or raise Unchanged in + let _ = (cs.b_cs p1 p2 <= twoh0) or raise Unchanged in + let _ = (cs.b_cs p0 p1 <= twoh0) or raise Unchanged in + let obtuse = obtuse_crit cs p0 p1 p2 in + let obtuse_sloc = + let p4 = funpow 3 (inc cs) p1 in + (cs.k_cs = 6) && + (length (sortuniq cs.str_cs) = 3) && (subset [p0;p4] cs.str_cs) && + (cs.bm_cs p1 p2 <= twoh0) && not (mem p1 cs.str_cs) && + not (mem p2 cs.str_cs) in + let _ = obtuse or obtuse_sloc or raise Unchanged in + let _ = (cs.a_cs p1 p2 < cs.bm_cs p1 p2) or raise Unchanged in + let _ = not(memj cs (p1,p2)) or raise Unchanged in + let _ = not(mem p1 cs.str_cs) or raise Unchanged in + let m q = (cs.a_cs p1 q = cs.bm_cs p1 q) in + let _ = forall (not o m) diag or raise Unchanged in + let n q = (fourh0 < cs.b_cs p1 q) in + let _ = forall n diag or raise Unchanged in + let cs_str1 = modify_cs cs ~str:(sortuniq (p1::cs.str_cs)) () in + let cspq q = + if (cs.am_cs p1 q > cs.a_cs p1 q) then None + else Some (modify_cs cs ~bm:(override cs.bm_cs (p1,q,cs.a_cs p1 q)) ()) in + cs_str1:: filter_some (map cspq (p2::diag));; + +let deform_4828966562A_obtuse p cs = + let p0 = dec cs p in + let p1 = p in + let p2 = inc cs p in + deform_4828966562_obtuse p0 p1 p2 cs;; + +let deform_4828966562B_obtuse p cs = + let p0 = dec cs p in + let p1 = p in + let p2 = inc cs p in + deform_4828966562_obtuse p2 p1 p0 cs;; + +(* + +range calculations for 6843920790. +2.0 *. arc 2.52 2.52 2.0 > arc 2.0 2.0 2.38;; +2.0 *. arc 2.0 2.0 2.52 < arc1553;; +As the documentation for this inequality indicates, it is +applied to the triangle p4 p1 p2. + +This also applies to some quads and triangles, +implemented as separate deformations. + +Edited: May 23, 2012. +need to consider more diagonals. For instance (p1,p3) may bottom out. +*) + + +let deform_6843920790 p1 cs = + let _ = (cs.k_cs = 5) or raise Unchanged in + let ks = ks_cs cs in + let p0 = dec cs p1 in + let p2 = inc cs p1 in + let p3 = inc cs p2 in + let p4 = inc cs p3 in + let _ = mem p1 ks or failwith "684:out of range" in + let _ = (cs.am_cs p1 p2 = cstab && cstab = cs.bm_cs p1 p2) + or raise Unchanged in + let _ = (cstab <= cs.am_cs p1 p4) or raise Unchanged in + let _ = (cstab <= cs.am_cs p4 p2) or raise Unchanged in + let f (i,j) = (cs.bm_cs i j <= twoh0) in + let _ = forall f [(p0,p1);(p2,p3);(p3,p4);(p4,p0)] or raise Unchanged in + let _ = not(memj cs (p1,p2)) or raise Unchanged in + let _ = not(mem p1 cs.str_cs) or raise Unchanged in + let _ = not(mem p2 cs.str_cs) or raise Unchanged in + let m (i,j) = (cs.a_cs i j < cs.bm_cs i j) in + let _ = forall m (alldiag cs) or raise Unchanged in + let _ = m (p1,p2) or raise Unchanged in + let n (i,j) = (fourh0 < cs.b_cs i j) in + let _ = forall n (alldiag cs) or raise Unchanged in + let cs1 = modify_cs cs ~str:(sortuniq (p1::cs.str_cs)) () in + let cs2 = modify_cs cs ~str:(sortuniq (p2::cs.str_cs)) () in + (* diags at p4 can be excluded, their lengths are fixed under def. *) + let non_p4diag = [(p3,p1);(p3,p0);(p0,p2)] in + let cspq (i,j) = + if (cs.am_cs i j > cs.a_cs i j) then None + else Some (modify_cs cs ~bm:(override cs.bm_cs (i,j,cs.a_cs i j)) ()) in + cs1::cs2:: + (filter_some(map cspq ((p1,p2)::non_p4diag)));; + +(* +deformation 5512912661 functions in an almost identical manner +to 6843920790 on quads. We take the union of the two deformations +here. +*) + +let deform_6843920790_quad p1 p2 p3 p4 cs = + let _ = (cs.k_cs = 4) or raise Unchanged in + let ks = ks_cs cs in + let adj (i,j) = (inc cs i = j) or (inc cs j = i) in + let _ = forall adj [(p1,p2);(p2,p3);(p3,p4);(p4,p1)] or failwith "684q" in + let _ = subset [p1;p2;p3;p4] ks or failwith "684:range" in + let arc238 = arc two two 2.38 in + (* ineq 684 conditions. *) + let a2 = (two <= cs.am_cs p1 p2 && cs.bm_cs p1 p2 <= cstab) in + let b2 = (arc238 <= arcmin cs(p1,p4) && cs.bm_cs p1 p4 <= cstab) in + let c2 = (cstab <= cs.am_cs p2 p4 && arcmax cs(p2,p3)+.arcmax cs(p3,p4) <= arc1553) in + (* ineq 5512912661 conditions. *) + let a2' = (arc238 <= arcmin cs (p1,p2) && cs.bm_cs p1 p2 <= cstab) in + let b2' = (two <= cs.bm_cs p1 p4 && cs.bm_cs p1 p4 <= twoh0) in + let arc315 = arc two two (3.15/.1.26) in + let c2' = (arc315 <= arcmin cs ( p2, p4) && + ((arcmax cs(p2,p3)+.arcmax cs(p3,p4) <= arc1553) or + (arcmax cs (p2,p1) +.arcmax cs (p1,p4) <= arc1553))) in + let _ = (a2 && b2 && c2) or (a2' && b2' && c2') or raise Unchanged in + let _ = not(memj cs (p1,p2)) or raise Unchanged in + let _ = not(mem p1 cs.str_cs) or raise Unchanged in + let _ = not(mem p2 cs.str_cs) or raise Unchanged in + let m (i,j) = (cs.a_cs i j < cs.bm_cs i j) in + let _ = forall m (alldiag cs) or raise Unchanged in + let _ = m (p1,p2) or raise Unchanged in + let n (i,j) = (fourh0 < cs.b_cs i j) in + let _ = forall n (alldiag cs) or raise Unchanged in + let cs1 = modify_cs cs ~str:(sortuniq (p1::cs.str_cs)) () in + let cs2 = modify_cs cs ~str:(sortuniq (p2::cs.str_cs)) () in + let cspq (i,j) = + if (cs.am_cs i j > cs.a_cs i j) then None + else Some (modify_cs cs ~bm:(override cs.bm_cs (i,j,cs.a_cs i j)) ()) in + cs1::cs2:: + (filter_some( [cspq (p1,p2);cspq (p1,p3)] ));; + +let deform_6843920790_tri p1 cs = + let p2 = inc cs p1 in + let p3 = inc cs p2 in + let _ = (cs.k_cs = 3) or raise Unchanged in + let ks = ks_cs cs in + let _ = mem p1 ks or failwith "684:tri" in + let _ = subset [p1;p2;p3] ks or failwith "684:range" in + let arc238 = arc two two 2.38 in + let a2 = (two <= cs.am_cs p1 p2 && cs.bm_cs p1 p2 <= cstab) in + let range(p,q) = (arc238 <= arcmin cs(p,q) && arcmax cs (p,q) <= arc1553) in + let _ = (a2 && range(p3,p1) && range(p3,p2)) or raise Unchanged in + let _ = not(memj cs (p1,p2)) or raise Unchanged in + let _ = not(mem p1 cs.str_cs) or raise Unchanged in + let _ = not(mem p2 cs.str_cs) or raise Unchanged in + let m (i,j) = (cs.a_cs i j < cs.bm_cs i j) in + let _ = m (p1,p2) or raise Unchanged in + let cs1 = modify_cs cs ~str:(sortuniq (p1::cs.str_cs)) () in + let cs2 = modify_cs cs ~str:(sortuniq (p2::cs.str_cs)) () in + let cspq (i,j) = + if (cs.am_cs i j > cs.a_cs i j) then None + else Some (modify_cs cs ~bm:(override cs.bm_cs (i,j,cs.a_cs i j)) ()) in + cs1::cs2:: + (filter_some( [cspq (p1,p2)]));; + +let deform_684_quadA p1 cs = + let f j = funpow j (inc cs) in + let p2 = f 1 p1 in + let p3 = f 2 p1 in + let p4 = f 3 p1 in + deform_6843920790_quad p1 p2 p3 p4 cs;; + +let deform_684_quadB p1 cs = + let f j = funpow j (dec cs) in + let p2 = f 1 p1 in + let p3 = f 2 p1 in + let p4 = f 3 p1 in + deform_6843920790_quad p1 p2 p3 p4 cs;; + + + +let deformations postfilter k = + let r f p cs = filter postfilter (f p cs) in + let m d = map (r d) (0--(k-1)) in + let rtl d cs = map restrict_type1_cs (d cs) in + let u = [deform_ODXLSTC_cs; + deform_IMJXPHR_cs; + deform_NUXCOEA_cs; + deform_4828966562A_obtuse; + deform_4828966562B_obtuse; + deform_1834976373_A1_single; + deform_1834976373_A1_double; + deform_4828966562A; + deform_4828966562B; + deform_6843920790; + deform_684_quadA; + deform_684_quadB; + deform_6843920790_tri] in + map rtl (List.flatten (map m u));; + +let name_of_deformation k i = + let names_hex = + ["odx";"imj";"nux";"482ao";"482bo";"1834s"; + "1834d";"482a";"482b";"684";"684qA";"684qB";"684t"] in + let offset = i mod k in + let s = i/k in + (List.nth names_hex s) ^ "-" ^ (string_of_int offset);; + + +(* +**************************************** + SUBDIVISON +**************************************** +*) + +(* division acts on B-fields, shrinks domain. + The global minima Ms remain global minima on smaller domain. + We can keep adornments. + Avoid Unchanged. Pass through if c is out of range. + Restricts the domain if possible. *) + +(* + +Five domain possibilities, starting with [a,am,bm,b] + +c <= a --> unchanged +a < c <= am --> cs2:[c,am,bm,b] +am < c < bm --> cs1:[a,am,c,c]; cs2:[c,c,bm,b] +bm <= c < b --> cs1:[a,am,bm,c] +b <= c --> unchanged. + +*) + +let subdivide_cs p q c cs = + let _ = (cs.k_cs > 3) or failwith "subdiv: triangle" in + let _ = (0 <= p && p< cs.k_cs) or failwith "p out of range divide_cs" in + let _ = (0 <= q && q< cs.k_cs) or failwith "q out of range divide_cs" in + let _ = not(p = q) or failwith "subdiv: p q must be unequal" in + let _ = not( memj cs (p,q)) or failwith "subdiv: (p,q) in J" in + let e = alledge cs in + let (p,q) = psort(p,q) in + let _ = not(mem (p,q) e) or (cs.a_cs p q > two) or (cs.b_cs p q > twoh0) or + failwith "subdiv: cannot subdivide standard edge" in + let _ = mem (p,q) (allpair cs) or failwith "subdivide range" in + let _ = not (c = cs.am_cs p q) or not(mem(p,q) e) or failwith "subdiv: c is am on edge" in + let a = cs.a_cs p q in + let b = cs.b_cs p q in + let am = cs.am_cs p q in + let bm = cs.bm_cs p q in + let cs1 = modify_cs cs ~b:(override cs.b_cs (p,q,c)) () in + let cs2 = modify_cs cs ~a:(override cs.a_cs (p,q,c)) () in + let _ = (a < c && c < b) or + (report ("warning:unchanged subdivide "^(string_of_float c)); + debug_cs:= cs::!debug_cs; true) in + if not (a < c && c < b) then [cs] + else if bm <= c then [cs1] + else if c <= am then [cs2] + else (* am < c < bm *) + let cs1' = modify_cs cs1 ~bm:(override cs.bm_cs (p,q,c)) () in + let cs2' = modify_cs cs2 ~am:(override cs.am_cs (p,q,c)) () in + [cs1';cs2'];; + +let between_cs c cs (i,j) = + (cs.a_cs i j < c && c < cs.b_cs i j );; + +let can_subdivide f_diag c cs = + exists (between_cs c cs) (f_diag cs);; + +let find_subdivide_edge f_diag c cs = + let diag = f_diag cs in + let ind = index true (map (between_cs c cs) (diag)) in + List.nth diag ind;; + +let subdivide_all_c_diag f_diag c = + let p = partition (can_subdivide f_diag c) in + let rec sub init term = + match init with + | [] -> term + | cs::css -> + let (i,j) = find_subdivide_edge f_diag c cs in + let kss = subdivide_cs i j c cs in + let (u,v) = p kss in + sub (u @ css) (v @ term) in + fun init -> + let (u,v) = p init in + sub u v;; + + +(* claims serve as documentation for + how the calculations are progressing from init_cs to terminal_cs. + + To do: make this into a formal deductive system. + With rules of inference given by deformation rules, etc. + + a = what we assert to prove at that point, + b=what we leave for later + + reduce remaining if r transfers to a. + remove from b those that transfer to terminal. + put residual b back in remaining. + *) + + +let remaining = ref [];; +remaining := init_cs;; (* arrow *) + +let claim_arrow(a,b) = + let r = !remaining in + let transfers_to_a cs = exists (equi_transfer_cs cs) a in + let r' = filter (not o transfers_to_a) r in + let transfers_from_b cs = exists (C equi_transfer_cs cs) b in + let r'' = filter (not o transfers_from_b) r' in + let _ = remaining := (b @ r'') in + !remaining;; + +(* +**************************************** +HEXAGONS +**************************************** +*) + +(* flow on hexagons. + hex-std- + subdivide all diags at stab. + apply deformations, + in cyclic repetition. + setting aside all cs st ?bm diag <= stab. + checking they are assert_stable_cs. + +*) + +(* claim in this section goes as follows *) + +(* todo: construct from generic subdivide *) + +let hex_std_preslice_02,hex_std_preslice_03 = + let c1 = subdivide_cs 0 2 cstab hex_std_cs in + let c2 = subdivide_cs 0 3 cstab hex_std_cs in + hist (hd c1) "hex_std_preslice 02" , hist (hd c2) "hex_std_preslice 03";; + +let hex_std_postslice = (* claim A *) + let cs = hex_std_preslice_02 in + let d'= 0.616 in + let d = cs.d_cs -. d' in + let vv = slice_cs cs 2 0 d' d false in + let vv02 = map (C hist "slice_hex_02") vv in + let cs = hex_std_preslice_03 in + let d' = cs.d_cs /. 2.0 in + let vv = slice_cs cs 0 3 d' d' false in + let vv03 = transfer_union (map (C hist "slice_hex_03") vv) [] in + vv02 @ vv03;; + +let hex_assumptions = [hex_std_preslice_02;hex_std_preslice_03];; + +claim_arrow([hex_std_cs],hex_assumptions);; (* claim B *) +claim_arrow(hex_assumptions,hex_std_postslice);; (* claim A *) + + + +(* end claim *) + +let ok_for_more_hex = + let is_hex cs = (cs.k_cs =6) in + let terminals = filter_terminal is_hex in + fun cs -> + let _ = (cs.k_cs = 6) or failwith "ok:6" in + let _ = assert_stable_cs cs in + let bstr = 3 + length (cs.str_cs) <= cs.k_cs in + let generic_at i = + let p0 = i in + let p1 = inc cs i in + let p2 = inc cs p1 in + let p3 = inc cs p2 in + not (subset[p0;p1;p2;p3] cs.lo_cs && subset[p1;p2] cs.str_cs) in + let bg = forall generic_at (ks_cs cs) in + let bunfinished = not (exists (transfer_to cs) terminals) in + bstr && bg && bunfinished;; + +let hex_deformations = deformations ok_for_more_hex 6;; + +let name_of_deformation_hex = name_of_deformation 6;; + +let filtered_subdivide postfilter init = + let sub = subdivide_all_c_diag (alldiag) cstab init in + filter postfilter sub;; + +let rec apply_first dl cs = + match dl with + [] -> failwith ( "all deformations fail") + | d::dls -> + try + d cs + with Unchanged -> apply_first dls cs;; + +let preslice_ready cs = + if (cs.k_cs=4) && (cs.d_cs=0.467) + then + (cs.bm_cs 0 2 = three) && (cs.bm_cs 1 3 = three) + else + exists (fun (i,j) -> cs.bm_cs i j <= cstab ) (alldiag cs);; + +let rec general_loop2 df postfilter c active stab_diags = + if (c <= 0) or length stab_diags > 0 then (active,stab_diags) + else match active with + [] -> ([],stab_diags) + | cs::css -> + try + let kss = apply_first df cs in + let (u,v) = partition preslice_ready kss in + let u' = filter postfilter u in + general_loop2 df postfilter (c-1) (v @ css) (u' @ stab_diags) + with + Failure s -> (active,stab_diags);; + +let execute_hexagons() = (* claim B *) + let postfilter = not o (equi_transfer_to_list hex_assumptions) in + let hex_ultra = filtered_subdivide postfilter [hex_std_cs] in + let hex_loop = general_loop2 hex_deformations postfilter in + (([],[]) =hex_loop 200000 hex_ultra []);; + +(* if true, it means that all hexagons have been reduced + to the one terminal hexagon, together with two cases of hex_std_preslice +*) + +(* time execute_hexagons ();; 117secs. + working in svn:2819,2824m,2829m,2830m,2832m *) + + +(* +**************************************** +PENTAGONS +**************************************** +*) + +(* flow on pentagons is the same as for hexagons *) + + +let ok_for_more_pent = + let terminals = filter_terminal (fun cs -> cs.k_cs = 5) in + fun cs -> + let _ = (cs.k_cs = 5) or failwith "ok:5" in + let _ = assert_stable_cs cs in + let bstr = 3 + length (cs.str_cs) <= cs.k_cs in + let sph_tri_ineq i = + if (length cs.str_cs < 2) then true + else + let p0 = i in + let p1 = inc cs p0 in + let p2 = inc cs p1 in + let p3 = inc cs p2 in + let p4 = inc cs p3 in + if not(subset [p1;p2] cs.str_cs) then true + else + let e03min = arcmin cs (p0,p1) +. + arcmin cs (p1,p2) +. arcmin cs (p2,p3) in + let e03max = arcmax cs (p3,p4) +. arcmax cs (p4, p0) in + e03min <= e03max in + let bunfinished = not (exists (transfer_to cs) terminals) in + bstr && bunfinished && forall sph_tri_ineq (ks_cs cs);; + + +let pent_deformations = deformations ok_for_more_pent 5;; + +let name_of_deformation_pent = name_of_deformation 5;; + +(* these are the cases handled in the pent section *) + +let pent_init = + filter (fun cs ->(5=cs.k_cs)) (init_cs @ hex_std_postslice);; + +(* it doesn't matter how our assumptions are generated, + as long as they are eventually discharged. *) + +let pent_composite_cs = mk_unadorned ( + 5, + 0.616, + a_pro two two cstab 5, + a_pro cstab twoh0 upperbd 5,"pent composite") ;; + +let pent_assumptions = + let pent_comp_rediag_cs (p,q) = + let cs = pent_composite_cs in + modify_cs cs + ~b:(override cs.b_cs (p,q,cstab)) + ~bm:(override cs.bm_cs (p,q,cstab)) () in + let alld = alldiag pent_std_cs in + let ffh ((p,q), cs) = subdivide_cs p q cstab cs in + let preslices = List.flatten (map ffh (cart alld pent_init)) in + let pent_comb = map pent_comp_rediag_cs alld in + let cstab_preslices = filter preslice_ready (pent_comb @ preslices) in + let union_cstab_preslices = transfer_union cstab_preslices [] in + let pa = map (C hist "preslice") union_cstab_preslices in + pa;; + +(* we introduce pent_composite_ultra_cs + which combines all the pent_init cases, + then we run execute_pentagons to get rid of it too. +*) + +let pent_composite_ultra_cs = (* claim C *) + let pl = filtered_subdivide + (not o (equi_transfer_to_list pent_assumptions)) + (pent_composite_cs::pent_init) in + transfer_union pl [];; + +(* claim C *) +claim_arrow(pent_init,pent_composite_ultra_cs @pent_assumptions);; + +(* pent section main claim *) + +let execute_pentagons() = (* claim D *) + let pent_filter = not o (equi_transfer_to_list pent_assumptions) in + let pent_loop = general_loop2 pent_deformations pent_filter in + (([],[])=pent_loop 200000 (pent_composite_ultra_cs) []);; + + +(* + time execute_pentagons();; + + if true, it means that all pentagons have been reduced + to the one terminal pentagon, together with cases of pent_assumptions + worked 36sec. in svn:2821, May 20, 2012. + svn 2834m. +*) + +claim_arrow(pent_composite_ultra_cs,pent_assumptions);; (* claim D *) + + +(* +**************************************** +ECHELON QUADS +**************************************** +*) + +(* These are the quadrilaterals that need subdivision in +the 'ultra' range of diagonals >= cstab. +There are two ways of doing this, either by picking the smaller +diagonal (echelon B) or picking the "better" diagonal, even if +not the shortest. + +This should be used as the last resort on a quadrilateral. +It fails unless the slice reduces to terminal cases. +*) + +let delta_am_diag2_neg cs d = + let y01 = cs.am_cs 0 1 in + let y03 = cs.am_cs 0 3 in + let y21 = cs.am_cs 2 1 in + let y23 = cs.am_cs 2 3 in + Sphere_math.delta_y d y01 y03 d y23 y21 < 0.0;; + +let delta_am_diag_neg cs p1 d = (* d from p1 to p3, am from p2 to p4 *) + let p2 = inc cs p1 in + let p3 = inc cs p2 in + let p4 = inc cs p3 in + let y12 = cs.am_cs p1 p2 in + let y14 = cs.am_cs p1 p4 in + let y32 = cs.am_cs p3 p2 in + let y34 = cs.am_cs p3 p4 in + let am = cs.am_cs p2 p4 in + Sphere_math.delta_y d y12 y14 am y34 y32 < 0.0;; + +let check_echelon_precondition cs = + try + let _ = (cs.k_cs = 4) or failwith "echelon1" in + let fixed (i,j) = (cs.am_cs i j = cs.bm_cs i j) in + let _ = forall fixed (alledge cs) or failwith "echelon:edge" in + let _ = forall (fun(i,j) ->cs.am_cs i j >= cstab) (alldiag cs) or + failwith "ech:diag" in + let _ = (cs.js_cs = []) or failwith "ech:j" in + true + with Failure _ -> false;; + +let upper_echelonA = + let assumptions = filter_terminal all in + let transfer = x_equi_transfer_to_list assumptions in + fun (p1,(dval,diag)) cs -> + let _ = check_echelon_precondition cs or raise Unchanged in + let _ = delta_am_diag_neg cs p1 diag or raise Unchanged in + let p2 = inc cs p1 in + let p3 = inc cs p2 in + let dval' = cs.d_cs -. dval in + let css = filter + (fun cs -> cs.bm_cs p1 p3 <= diag) (subdivide_cs p1 p3 diag cs) in + let css' = List.flatten + (map (fun cs -> slice_cs cs p1 p3 dval dval' false) css) in + let css'' = filter (not o transfer) css' in + let _ = (css''=[]) or raise Unchanged in + [];; + +let upper_echelonC = + let assumptions = filter_terminal all in + let transfer = x_equi_transfer_to_list assumptions in + fun p1 cs -> + let diag341 = 3.41 in + let _ = check_echelon_precondition cs or raise Unchanged in + let p2 = inc cs p1 in + let p3 = inc cs p2 in + let p4 = inc cs p3 in + let edge_is c (i,j) = (cs.am_cs i j = c) in + let rhs = [(p1,p2);(p2,p3)] in + let lhs = [(p3,p4);(p4,p1)] in + let has_one c e = (length(filter(edge_is c) e) = 1) in + let _ = (has_one two rhs) or raise Unchanged in + let _ = (has_one two lhs) or raise Unchanged in + let _ = (has_one cstab rhs) or raise Unchanged in + let _ = (has_one twoh0 lhs) or (has_one cstab lhs) or raise Unchanged in + let css = subdivide_cs p1 p3 diag341 cs in + let (css1,css2) = partition (fun cs -> cs.bm_cs p1 p3 <= diag341) css in + let _ = (length css1 = 1) or failwith "ech:C" in + let cs1 = restrict_type2_cs (hd css1) in + let dval = 0.4759 in + let dval' = cs.d_cs -. dval in + let css' = slice_cs cs1 p1 p3 dval dval' false in + let css'' = filter (not o transfer) css' in + let _ = (css'' =[]) or raise Unchanged in + css2;; + +let upper_echelonB = + let assumptions = filter_terminal all in + let transfer = x_equi_transfer_to_list assumptions in + fun diag cs -> + let _ = check_echelon_precondition cs or raise Unchanged in + let _ = delta_am_diag2_neg cs diag or raise Unchanged in + let css = filter + (fun cs -> cs.bm_cs 0 2 <= diag or cs.bm_cs 1 3 <= diag) + (subdivide_all_c_diag alldiag diag [cs]) in + let css02,css13 = partition + (fun cs -> cs.bm_cs 0 2 <= diag) css in + let dcases = if (diag=3.41) then [0.0759;0.4759] else [0.2759] in + let op(a,b) = (b,a) in + let dv = map (fun d -> (d,cs.d_cs -. d)) dcases in + let dv' = (dv @ map op dv) in + let f (p,q) (d,d') cs = + let css' = slice_cs cs p q d d' false in + let css'' = filter (not o transfer) css' in + let _ = (css''=[]) or raise Unchanged in + () in + try + ignore(map (apply_first (map (f(0,2)) dv')) css02); + ignore(map (apply_first (map (f(1,3)) dv')) css13); + [] + with Failure _ -> raise Unchanged;; + +let upper_echelon = + (* we get the case data from echelon data in terminal_cs. *) + let dataA = cart (0--3) + [(0.0759,3.41);(0.4759,3.41);(0.2759,3.339);(0.2759,3.62)] in + let dataB = [3.41;3.339;3.62] in + let dataC = (0--3) in + let cases = map upper_echelonA dataA @ map upper_echelonB dataB @ + map upper_echelonC dataC in + fun cs -> + apply_first cases cs;; + + + +(* +**************************************** +QUADRILATERALS +**************************************** +*) + +(* this handles quad_pro_cs modulo the return cs's *) + +let (quad_477_preslice_short,quad_477_preslice_long) = (* claim E *) + let preslices = subdivide_all_c_diag alldiag cstab [quad_pro_cs] in + let vv = (map (C hist "preslice pro") preslices) in + let p = filter (fun cs -> cs.b_cs 0 2 = cstab) + (subdivide_cs 0 2 cstab quad_pro_cs) in + let ww = transfer_union (p @ vv) [] in + partition preslice_ready ww;; + +(* This is the case where ears are required -- finally! *) + +let execute_quad_to_ear() = (* claim E' *) + let transfer = x_equi_transfer_to_list (filter_terminal all) in + let _ = (length quad_477_preslice_short = 1) or failwith "handle 477" in + let cs = hd quad_477_preslice_short in + let mk_ear = true in + let inc2 = funpow 2 (inc cs) in + let f i = slice_cs cs i (inc2 i) (0.11) (0.477 -. 0.11) mk_ear in + let ind = filter (can f) (0--3) in + let g i = forall (transfer) (f i) in + exists g ind;; + + +(* let quad_remaining = !remaining;; +remaining :=quad_remaining;; + *) + +claim_arrow([quad_pro_cs],quad_477_preslice_long);; (* claim E *) + +let triquad_assumption = +[ + mk_unadorned ( + 4, + 0.513, + overrides (cs_adj two cstab 4) [((1,2),twoh0);((2,3),twoh0)], + overrides (cs_adj twoh0 upperbd 4) [((1,2),cstab);((2,3),cstab)], + "triquad assumption" + ); + mk_unadorned ( + 4, + 0.513, + overrides (cs_adj two cstab 4) [((1,2),twoh0);((0,3),twoh0)], + overrides (cs_adj twoh0 upperbd 4) [((1,2),cstab);((0,3),cstab)], + "triquad assumption" + ); + mk_unadorned ( + 3, + 0.4278, + cs_adj twoh0 cstab 3, + cs_adj cstab upperbd 3, + "tri assumption" + ); +(* + mk_unadorned ( + 3, + 0.103, + funlist [(0,1),twoh0] two, + funlist [(0,1),sqrt8] twoh0, + "td 2 1"); + mk_unadorned ( + 3, + 0.0, + cs_adj two cstab 3, + cs_adj twoh0 cstab 3, + "td 3 0"); +*) +];; + +claim_arrow([],triquad_assumption);; (* claim - no justification required *) + +(* 477 has been handled already. + We make the case involving the ear part of the terminal + set so that we don't need to deal with ears any further. + can make it an assumption *) + +let terminalj_cs = quad_477_preslice_short @ (filter_terminal all);; + +let terminal_quad = + triquad_assumption @ terminalj_cs;; + +(* see calc in main_estimate.hl. If opposite edges are too short + the angle cannot be straight. *) +let can_be_straight_2485876245b cs p1 = + if (not (cs.k_cs = 4)) then true + else + let p0 = dec cs p1 in + let p2 = inc cs p1 in + let p3 = inc cs p2 in + not (cstab <= cs.am_cs p1 p3 && + cs.bm_cs p1 p2 <= cstab && + cs.bm_cs p1 p0 <= cstab && + cs.bm_cs p2 p3 <= twoh0 && + cs.bm_cs p3 p0 <= twoh0);; + +let ok_for_more_tri_quad assumptions = + let terminal_transfer = x_equi_transfer_to_list assumptions in + fun cs -> + let _ = (mem cs.k_cs [3;4]) or failwith "ok:3,4" in + let b467_2485876245a = + if (cs.d_cs=0.467) && (cs.k_cs = 4) && + forall (fun (i,j)-> cs.bm_cs i j <= twoh0) [(0,1);(1,2);(2,3);(3,0)] && + forall (fun (i,j)-> cs.am_cs i j >= three) [(0,2);(1,3)] + then ( cs.str_cs = []) else true in + let deltay cs = Sphere_math.delta_y (* if neg then geometric impossibility *) + (cs.bm_cs 0 1) (cs.bm_cs 0 3) (cs.am_cs 0 2) + (cs.bm_cs 2 3) (cs.bm_cs 1 2) (cs.am_cs 1 3) >= 0.0 in + let b4 = (cs.k_cs = 4) in + let b4a = if b4 then deltay cs else true in + let is_477 = b4 && (cs.d_cs=0.477) && + forall (fun (i,j)-> cs.bm_cs i j <= twoh0) [(0,1);(1,2);(2,3);(3,0)] && + forall (fun (i,j)-> cs.am_cs i j >= cstab) [(0,2);(1,3)] in + let b477 = + if is_477 + then + let b477a = cs.str_cs = [] in + let b477c = + not(exists (equi_transfer_cs cs) quad_477_preslice_short) in + (b477a && b477c) + else true in + let sph_tri_ineq p1 = + let p0 = dec cs p1 in + let p2 = inc cs p1 in + let p3 = inc cs p2 in + if (not (mem p1 cs.str_cs)) then true (* in tri str=[] *) + else + arcmin cs (p0,p1) +. arcmin cs (p1,p2) < + arcmax cs (p0,p3) +. arcmax cs (p3,p2) in + let sph_tri_ineq2 p1 = (* rather ad hoc to kill a case *) + let p0 = dec cs p1 in + let p2 = inc cs p1 in + let p3 = inc cs p2 in + if (not (mem p1 (intersect cs.str_cs cs.lo_cs))) then true + else + cs.am_cs p0 p1 < cs.bm_cs p0 p3 or + cs.am_cs p1 p2 < cs.bm_cs p2 p3 in + let _ = assert_stable_cs cs in + let bstr = 3 + length (cs.str_cs) <= cs.k_cs in + let bunfinished = not (terminal_transfer cs) in + bstr && b4a && bunfinished && b467_2485876245a && + b477 && forall sph_tri_ineq (cs.str_cs) && + forall sph_tri_ineq2 (intersect cs.str_cs cs.lo_cs) && + forall (can_be_straight_2485876245b cs) (cs.str_cs);; + +let special_quad_init = + quad_diag_cs :: quad_477_preslice_long;; + +let execute_special_quads = (* claim F *) + let quad_deformations = + deformations (ok_for_more_tri_quad terminal_quad) 4 in + let terminal_transfer = x_equi_transfer_to_list terminal_quad in + fun () -> + let quad_loop = general_loop2 quad_deformations + (not o terminal_transfer) in + (([],[])=quad_loop 200000 special_quad_init []);; + +(* +execute_special_quads();; +*) + +claim_arrow(special_quad_init,[]);; (* claim F *) + +(* execute_special_quads is true, it means that + all special quads have been reduced + to terminal quads, + worked in svn:2821, May 20, 2012. + svn:2824. +*) + + +(* now the general case remains + policies and procedure: + - no more use of js_cs and ears. + - determine d by slice_dpq procedure. + + The order is extremely important! + 1- if the cs transfers to a terminal or is not "ready" for more, + then were are done with it. + 2- if stab is between lower and upper bounds of a diag, then subdivide it + 3- if sqrt8 is between lower and upper bounds of a diag, then sub + 4- if there is a diag [2h0,sqrt8], then slice it. + 5- if there is a diag [sqrt8,cstab], then slice it. + 6- if a deformation applies, then apply it. + 7- do "upper echelon" treatment of quads (subdivisions on edges > 3.01) + +*) + +let ok_for_more assumptions = + let ok3 = ok_for_more_tri_quad assumptions in + fun cs -> + ((cs.k_cs = 6) && (ok_for_more_hex cs)) or + ((cs.k_cs=5) && (ok_for_more_pent cs)) or + ((mem cs.k_cs [3;4]) && (ok3 cs));; + + +let handle_general_case skip8 assumptions = + let ok = ok_for_more assumptions in + let dff k = deformations (fun cs -> true) k in + let defs = [[];[];[];dff 3;dff 4;dff 5;dff 6] in + let inrange cs a b (p,q) = (a <= cs.am_cs p q && cs.bm_cs p q <= b) in + let allunderstable cs = + if(cs.k_cs < 4) then [] + else filter (fun (i,j)-> (cs.b_cs i j <= cstab)) (allpair cs) in + fun cs -> + let alld = alldiag cs in + (* 1- *) + if not(ok cs) then [] + (* else if exists (equi_transfer_cs cs) terminal_quad then [] *) + (* 2,3- *) + else if not(skip8) && (can_subdivide allunderstable sqrt8 cs) + then (subdivide_all_c_diag allunderstable sqrt8 [cs]) + else if (can_subdivide allunderstable twoh0 cs) + then (subdivide_all_c_diag allunderstable twoh0 [cs]) + else + try (* 4- *) + let (p,q) = Lib.find (inrange cs twoh0 sqrt8) alld in + slice_std cs p q + with Failure _ -> + try (* 5 *) + let (p,q) = Lib.find (inrange cs sqrt8 cstab) alld in + slice_std cs p q + with Failure _ -> + try (* 6 *) + if (can_subdivide alldiag cstab cs) + then (subdivide_all_c_diag alldiag cstab [cs]) + else + let k = cs.k_cs in + let dl = List.nth defs k in + apply_first dl cs + with Failure _ -> + try (* 7 *) + upper_echelon cs + with Failure _ -> failcs(cs, "no handler found");; + + +let handle_loop skip8 assumptions = + let handle_one = handle_general_case skip8 assumptions in + let rec handle_loop_rec c ls = + if (c<=0) then ls + else match ls with + | [] -> [] + | cs::css -> + let v = handle_one cs in + let (a,b) = partition (fun cs -> cs.k_cs > 4) (v @ css) in + let (b',b'') = partition (fun cs -> cs.k_cs = 3) b in + handle_loop_rec (c-1) ( a @ b' @ b'') in + handle_loop_rec;; + + +let r_init = !remaining;; + +let execute_triquad () = (* claim G*) + let b1 = ([] = (handle_loop false terminal_quad 50000) r_init) in + let b2 = ([] = (handle_loop true terminalj_cs 50000) triquad_assumption) in + b1 && b2;; + +claim_arrow(r_init,terminal_quad);; (* claim G *) +claim_arrow(triquad_assumption,terminalj_cs);; (* claim G *) +claim_arrow(terminalj_cs,[]);; (* claim E *) + +let all_cases_done = (!remaining = []);; + +let execute() = + (time execute_hexagons() && + time execute_pentagons() && + time execute_quad_to_ear() && + time execute_special_quads() && + time execute_triquad() && + all_cases_done);; + + +end;; + + +(* scratch area *) + +(* +let handle = handle_general_case true terminalj_cs;; + +debug_cs := [];; +execute_triquad();; +let cs1 = (hd !debug_cs);; +report_cs cs1;; +let cs2 = upper_echelon cs1;; +report_cs (hd cs2);; +let cs3 = hd(handle (hd cs2));; +report_cs cs3;; +1;; + +let hl = time (handle_loop true terminalj_cs 50000) tri_cases_left;; +let cs_term = hd (!debug_cs);; +let cs_init = List.nth quad_cases_left 1;; +report_cs cs_term;; +let handle1 = handle_general_case true terminalj_cs;; +let handle1' = catch_failure cs_term handle1;; +let kl = debug_trace handle1' cs_init cs_term;; +List.length kl;; +let cs' = List.nth kl 4;; +report_cs cs';; +handle1 cs';; +slice_std cs' 1 3 ;; +calc_d_std cs' 1 3;; + +let kl = handle1 cs1;; +map report_cs kl;; +let cases_left = + filter (not o (x_equi_transfer_to_list (filter_terminal all)) terminal_quad;; +*) diff --git a/text_formalization/nonlinear/cleanDeriv.hl b/text_formalization/nonlinear/cleanDeriv.hl new file mode 100644 index 0000000..0a503ec --- /dev/null +++ b/text_formalization/nonlinear/cleanDeriv.hl @@ -0,0 +1,362 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Nonlinear *) +(* Author: Nicholas Volker *) +(* Date: 2012-01-18 *) +(* ========================================================================== *) + + +(* + +Module for automatic differentiation of functions in the flyspeck project. +These functions resulted from Volker's 2011 undergraduate research project at Pitt. + + +Key stuff: + DIFF_TAC + derived_goal (interactive goal-based differentiation) + nonstack_goal (fully automated) + +See cleanDeriv_examples.hl for examples of use. + +*) + +module Clean_deriv = struct + + + +open Sphere;; +open Calc_derivative;; + +let goal_concl = Hales_tactic.goal_concl;; + +(* Begin various useful identities about derived_form *) + +let derived_form_equivalence = prove_by_refinement(`!t1 t2 f1 f2 f1' f2' x s. (t1 = t2) /\ (f1' = f2') /\ (f1 = f2) ==> (derived_form t1 f1 f1' x s ==> derived_form t2 f2 f2' x s)`, +[ +MESON_TAC[]; +]);; + +let extra_assum_derived_form = prove_by_refinement(`!t1 t2 f1 f2 f1' f2' x s.(f1' = f2') /\ (f2 = f1) ==> (derived_form t1 f1 f1' x s ==> derived_form (t1 /\ t2) f2 f2' x s)`, +[ +REWRITE_TAC[derived_form]; +MESON_TAC[]; +]);; + +let retrieve_assum = prove_by_refinement(`!p q f f' x s. (q ==> derived_form (p /\ q) f f' x s) ==> derived_form (p /\ q) f f' x s`, + [ +REPEAT GEN_TAC; +REWRITE_TAC[derived_form]; +ASM_MESON_TAC[]; + ]);; + +(* End derived_form identities *) + +(* Begin theorems in order to rewrite function definitions. Currently working on eta2_126. Will probably need to rework these in order to use HAS_REAL_DERIVATIVE_TRANSFORM_WITHIN. *) + +let zero_lemma = prove_by_refinement(`!x:real. &0 <= x ==> &0 pow 2 <= x`, + [ + CONV_TAC REAL_FIELD; + ]);; + +let sqrt_squared = prove_by_refinement(`!x:real. &0 < x ==> x = sqrt x * sqrt x`, + [ + REPEAT STRIP_TAC; + SUBGOAL_THEN `&0 < x ==> &0 <= x` MP_TAC; + ASM_REAL_ARITH_TAC; + ASM_REWRITE_TAC[]; + ASM_MESON_TAC[(SPECL[`x:real`] zero_lemma); (SPECL[`&0`;`x:real`] Nonlinear_lemma.sq_pow2)]; + ]);; + +let eta2_assum = prove_by_refinement (`!x1 x2 x3 x4 x5 x6. (&0 < x1) /\ (&0 < x2) /\ (&0 < x6) ==> eta2_126 x1 x2 x3 x4 x5 x6 = eta_x x1 x2 x6 pow 2`, + [ +REPEAT STRIP_TAC; +MP_TAC (SPEC_ALL eta2_126); +REWRITE_TAC[eta_y]; +REPEAT LET_TAC; +ASM_MESON_TAC[(SPECL[`x1:real`] sqrt_squared);(SPECL[`x2:real`] sqrt_squared);(SPECL[`x6:real`] sqrt_squared)]; + ]);; + +let x_greater_lemma = prove_by_refinement (`!x:real (s:real->bool). &0 < x ==> (?d. &0 < d /\ (!x'. x' IN s /\ abs (x' - x) < d ==> &0 < x'))`, + [ +REPEAT STRIP_TAC; +EXISTS_TAC `x:real`; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +ASM_REAL_ARITH_TAC; + ]);; + +let eta2_126_eta_x_open = prove_by_refinement (`!x1:real x2:real x3:real x4:real x5:real x6:real (s:real->bool). &0 < x1 /\ &0 < x2 /\ &0 < x6 ==> + (?d. &0 < d /\ (!x'. x' IN s /\ abs (x' - x1) < d ==> + ((\x'. eta_x x' x2 x6 pow 2) x') = ((\x'. eta2_126 x' x2 x3 x4 x5 x6) x')))`, + [ +REPEAT STRIP_TAC; +MP_TAC (SPECL [`x1:real`;`s:real->bool`] x_greater_lemma); +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +EXISTS_TAC `d:real`; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +SUBGOAL_THEN `&0 < x'` MP_TAC; +ASM_MESON_TAC[]; +MP_TAC (SPECL [`x':real`;`x2:real`;`x3:real`;`x4:real`;`x5:real`;`x6:real`] eta2_assum); +REPEAT STRIP_TAC; +ASM_MESON_TAC[]; + ]);; + +(* End theorems needed to rewrite function defns. *) + + + +(* A list of the function names and their associated rewrite theorems. If a function requires assumptions in order to rewrite it into a form differentiate understands, it goes here. *) + +let thms_rew = [(`eta2_126`, eta2_assum)];; + +(* A list of functions that require no assumptions in order to rewrite. *) + +let fn_defs_matching = [(`dih_x`, dih_x); (`ups_x`, ups_x); (`delta_x`, delta_x); (`delta_x4`, delta_x4); (`eta_x`, eta_x)];; + +let fn_defs = [dih_x;ups_x;delta_x;delta_x4;eta_x;chi_x;rho_x];; + +(* Basic rewrite methods. *) + +let fn_rewrite (f:term) = rhs (concl (REWRITE_CONV fn_defs f));; +let full_rewrite (f:term) = rhs (concl (REPEATC let_CONV (rhs (concl (REWRITE_CONV fn_defs f)))));; + +(* From here until the notes section I wrote for myself, the first attempt at writing the automatic differentiation and cleanup methods, for first derivatives. Works fine for polynomials and functions that require no assumptions to rewrite for differentiate. *) + +(* Reduces the goal set by the next 2 methods to a series of three statements of equivalence, that of the assumptions, function and derivative each of which can then be solved using ARITH methods and other identities needed for simplifying the output of differentiate. *) + +let DIFF_TAC gl = + let (_,[t;f;f';x;s]) = strip_comb (goal_concl gl) in + let fr = full_rewrite f in + (MATCH_MP_TAC retrieve_assum THEN + REPEAT STRIP_TAC THEN + MP_TAC (Calc_derivative.differentiate fr x s) THEN + MATCH_MP_TAC derived_form_equivalence THEN + REWRITE_TAC fn_defs) gl;; + +(* Produces a goal for the interactive goal stack *) + +let derived_goal (f,var,final_deriv) = + let expanded = full_rewrite f in + let lambda = mk_abs(var, expanded) in + let (_,[p;f;f';x;s]) = strip_comb (concl (Calc_derivative.differentiate lambda var `(:real)`)) in + let goal_term = list_mk_comb(`derived_form`, [p;lambda;final_deriv;var;`(:real)`]) in + (set_goal([], goal_term));; + +(* Produces a term for use with prove_by_refinement *) + +let nonstack_goal (f,var,final_deriv) = + let expanded = full_rewrite f in + let lambda = mk_abs(var, expanded) in + let (_,[p;f;f';x;s]) = strip_comb (concl (Calc_derivative.differentiate lambda var `(:real)`)) in + list_mk_comb(`derived_form`, [p;lambda;final_deriv;var;`(:real)`]);; + +(* Encapsulates the above for Polynomial functions, since the simplification of the derivative is just collection of terms, so REAL_ARITH can handle it. *) + +let clean_differentiate (f,var,final_deriv) = + prove_by_refinement(nonstack_goal (f,var,final_deriv), + [ + DIFF_TAC; + (* REPEAT try MATCH_MP_TAC fn_identities *) + REAL_ARITH_TAC; + ]);; + +(* <<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>> *) +(* Do rewrites in order to differentiate. Collect assumptions from differentiate and the rewrites and apply to the goal of derived_form (pdiff /\ prew) fun simpderiv var universe. Throw extra assumptions into returned value from differentiate to get matching assumption lists. The rewrite assumptions allow you to get fun = f where f is pattern matched from differentiate. Then use all assumptions to apply identities to get derivatives to match. *) + +(* A list where the desired first derivatives will be put, if there are any. *) + +let deriv_list = [(`\x1:real. ups_x`,`-- &2 * x1 + &2 * x3 + &2 * x2`)];; + +(* A method to lookup the theorem needed to rewrite a function name. What I wanted to use to prove equivalence of lambda-abstracted functions. *) + +let get_rw_thm tm = + let (var,f) = dest_abs tm in + let (name,_) = strip_comb f in + try REWRITE_TAC[(assoc name thms_rew)] + with DNE -> REWRITE_TAC[(assoc name fn_defs_matching)];; + +(* Methods to grab the assumptions needed to do a rewrite on the original function. These assumptions will be added to those from the differentiate method and put in as the full assumption list in the final goal that we set. *) + +let needs_assum tm = + let (var,f) = dest_abs tm in + let (name,_) = strip_comb f in + let rw = assoc name thms_rew in + let (_,[assum;concl]) = strip_comb (concl (SPEC_ALL rw)) in + (assum, mk_abs (var, (full_rewrite (rhs concl))));; + +let case_handle tm = + try needs_assum tm + with DNE -> + let (var,fn) = dest_abs(tm) in + (`T`, mk_abs (var, full_rewrite(fn)));; + +(* Method to search the list of set first derivatives and find a matching one for the function and variable we are differentiating over. If one does not exist, it simply returns what the differentiate method would give you. *) + +let find_deriv tm = + let (var,fn) = dest_abs tm in + let (name,_) = strip_comb fn in + let searchtm = mk_abs (var, name) in + try assoc searchtm deriv_list + with DNE -> + let (var,_) = dest_abs (tm) in + let (assum, lambda) = case_handle tm in + let (_,[p;f;f';x;s]) = strip_comb (concl (Calc_derivative.differentiate lambda var `(:real)`)) in + f';; + +(* Methods to set the final goal. derived_goal2 gives a goalstack, nonstack_goal2 returns a term which can be used in a prove_by_refinement. Each take a starting lambda-abstracted term, see if the term needs assumptions in order to be rewritten into a form that differentiate will understand and searches the first derivative list to see if there's a particular form we want. It then applies differentiate to the rewritten function, adds the gathered assumptions together, and sets the final derived_form goal. *) + +let derived_goal2 tm = + let (assum,lambda) = case_handle tm in + let final_deriv = find_deriv tm in + let (var,_) = dest_abs (lambda) in + let (_,[p;f;f';x;s]) = strip_comb (concl (Calc_derivative.differentiate lambda var `(:real)`)) in + let all_assum = list_mk_comb(`/\`, [p;assum]) in + let goal_term = list_mk_comb(`derived_form`, [all_assum;tm;final_deriv;var;`(:real)`]) in + (set_goal([], goal_term));; + +let nonstack_goal2 tm = + let (assum,lambda) = case_handle tm in + let final_deriv = find_deriv tm in + let (var,_) = dest_abs (lambda) in + let (_,[p;f;f';x;s]) = strip_comb (concl (Calc_derivative.differentiate lambda var `(:real)`)) in + let all_assum = list_mk_comb(`/\`, [p;assum]) in + list_mk_comb(`derived_form`, [all_assum;tm;final_deriv;var;`(:real)`]);; + +(* A tactic to reduce the above goals to a set of equivalence statements about the assumptions, f and f'. Has been reworked to use HAS_REAL_DERIVATIVE_TRANFORM_WITHIN. A method still needs to be written that will produce the assumption "xi IN s" for each i and add it to the assumption list in order to apply that sequence of reasoning. See the proof of atn2 for more detail. Each method will need an "openness lemma" as well.*) + +let DIFF_TAC2 gl = + let (_,[t;f;f';x;s]) = strip_comb (goal_concl gl) in + let (_,rw) = case_handle f in + (REWRITE_TAC[derived_form] THEN + REPEAT STRIP_TAC THEN + MP_TAC (Calc_derivative.differentiate rw x s) THEN + REWRITE_TAC[derived_form]) gl;; + +(* The below sequence will not work yet because the assumptions "xi IN s" are not in the assumption list. list_mk_comb did not work when applied to IN, but is_comb returns true on the term `x IN s`. *) + +(* +derived_goal2 `\x1:real. eta2_126 x1 x2 x3 x4 x5 x6`;; + +e (DIFF_TAC2);; +e (ASM_REWRITE_TAC[]);; +e (MP_TAC (SPEC_ALL eta2_126_eta_x_open));; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (MATCH_MP_TAC HAS_REAL_DERIVATIVE_TRANSFORM_WITHIN);; +*) + +(* Begin cheating in order to test. Calls mk_fthm. *) + + +let f = `\x1:real. eta2_126 x1 x2 x3 x4 x5 x6`;; + +let x1_eta2 = mk_fthm([],`derived_form + ((&0 < + (x1 * x2 * x6) / + (--x1 * x1 - x2 * x2 - x6 * x6 + + &2 * x1 * x6 + + &2 * x1 * x2 + + &2 * x2 * x6) /\ + ~(--x1 * x1 - x2 * x2 - x6 * x6 + + &2 * x1 * x6 + + &2 * x1 * x2 + + &2 * x2 * x6 = + &0)) /\ + &0 <= x1 /\ + &0 <= x2 /\ + &0 <= x6) + (\x1. eta2_126 x1 x2 x3 x4 x5 x6) + (&2 * + sqrt + ((x1 * x2 * x6) / + (--x1 * x1 - x2 * x2 - x6 * x6 + + &2 * x1 * x6 + + &2 * x1 * x2 + + &2 * x2 * x6)) pow + 1 * + ((x2 * x6) * + (--x1 * x1 - x2 * x2 - x6 * x6 + + &2 * x1 * x6 + + &2 * x1 * x2 + + &2 * x2 * x6) - + (x1 * x2 * x6) * ((--x1 + -- &1 * x1) + &2 * x6 + &2 * x2)) / + (--x1 * x1 - x2 * x2 - x6 * x6 + + &2 * x1 * x6 + + &2 * x1 * x2 + + &2 * x2 * x6) pow + 2 * + inv + (&2 * + sqrt + ((x1 * x2 * x6) / + (--x1 * x1 - x2 * x2 - x6 * x6 + + &2 * x1 * x6 + + &2 * x1 * x2 + + &2 * x2 * x6)))) + x1 + (:real)`);; + +let first_derivs = [(`\x1:real. eta2_126`, x1_eta2)];; + + + (* End cheating. Cheated in in order to test second derivative stuff. This list will be where all the first derivatives will be put *) + +(* Translated from C code, what the final 2nd derivative should be. Is this correct? *) + +let x1x2_eta2_126 = `(x6 * (x1 pow 4 + &2 * x1 pow 3 * x2 - &6 * x1 pow 2 * x2 pow 2 + &2 * x1 * x2 pow 3 + x2 pow 4 - &2 * x1 pow 3 * x6 + &6 * x1 pow 2 * x2 * x6 + &6 * x1 * x2 pow 2 * x6 - &2 * x2 pow 3 * x6 - &10 * x1 * x2 * x6 pow 2 + &2 * x1 * x6 pow 3 + &2 * x2 * x6 pow 3 - x6 pow 4))/((ups_x x1 x2 x6) pow 3)`;; + +let goal_2deriv = full_rewrite x1x2_eta2_126;; + +let final_second_deriv = [(`\x2:real. \x1:real. eta2_126`, x1x2_eta2_126)];; + +(* A method to find the first derivative we are looking for. *) + +let find_deriv_thm tm = + let (var,fn) = dest_abs tm in + let (name,_) = strip_comb fn in + let searchtm = mk_abs (var, name) in + assoc searchtm first_derivs;; + +(* A method to find the desired second derivative. *) + +let find_wanted_second_deriv y tm = + let (var,fn) = dest_abs tm in + let (name,_) = strip_comb fn in + let firstabs = mk_abs (var, name) in + let secondabs = mk_abs (y, firstabs) in + assoc secondabs final_second_deriv;; + +(* Similar to the first derivative case, makes a goal using the f' from the first derivative and carries with it all the assumptions. *) + +let mk_xy_deriv_goal y tm = + let (_,[p;f;f';x;s]) = strip_comb (concl (find_deriv_thm tm)) in + let (x,_) = dest_abs(f) in + let deriv_abs = mk_abs(y,f') in + let (_,[q;g;g';y;s]) = strip_comb (concl (differentiate deriv_abs y `(:real)`)) in + let all_assum = list_mk_comb(`/\`,[q;p]) in + let goal_deriv = find_wanted_second_deriv y tm in + set_goal([], list_mk_comb(`derived_form`,[all_assum;deriv_abs;goal_deriv;y;s]));; + +(* A similar reduction tactic. Should work better in the second derivative case, since the equivalence of the lambda-abstracted function is immediate. Since has_real_derivative handles nth derivatives in a curried fashion, we don't need to worry about directly associating any function name (such as eta2_126) directly with its second derivative, as long as its first derivative is associated with its second derivative. *) + +let SECOND_DIFF_TAC gl = + let (_,[t;f;f';x;s]) = strip_comb (goal_concl gl) in + (MATCH_MP_TAC retrieve_assum THEN + REPEAT STRIP_TAC THEN + MP_TAC (Calc_derivative.differentiate f x s) THEN + MATCH_MP_TAC extra_assum_derived_form THEN + ASM_REWRITE_TAC[]) gl;; + + + +end;; + + + + + + diff --git a/text_formalization/nonlinear/cleanDeriv_examples.hl b/text_formalization/nonlinear/cleanDeriv_examples.hl new file mode 100644 index 0000000..6d1035c --- /dev/null +++ b/text_formalization/nonlinear/cleanDeriv_examples.hl @@ -0,0 +1,83 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Nonlinear *) +(* Author: Nicholas Volker *) +(* Date: 2012-01-18 *) +(* ========================================================================== *) + + +(* + +Module for automatic differentiation of functions in the flyspeck project. +These functions resulted from Volker's 2011 undergraduate research project at Pitt. + + +Key stuff: + DIFF_TAC + derived_goal (interactive goal-based differentiation) + nonstack_goal (fully automated) + +See cleanDeriv_examples.hl for examples of use. + +*) + +module Clean_deriv_examples = struct +(* Examples of all the major methods in the cleanDeriv.hl file *) + + open Clean_deriv;; + + + + + +(* the original derived_goal and nonstack_goal methods are deprecated. You may use derived_goal2 and nonstack_goal2 to set the goal term as follows *) + +derived_goal2 `\x1:real. ups_x x1 x2 x3`;; + +(* This begins an interactive goalstack with the appropriate derived_form as the goal. *) + +nonstack_goal2 `\x1:real. ups_x x1 x2 x3`;; + +(* This is for use with prove_by_refinement *) + +(* Produces the same thing as the previous method, but instead of returning it as a goal returns it as a term. *) + +(* These methods attempt to rewrite the term by looking up an associated theorem in a list using the function name, e.g. ups_x or eta2_126. This is done automatically. If a theorem is not found, it does a normal set of rewrites on the term using a list of function definitions. *) + +(* DIFF_TAC will reduce a derived_form goal to a set of equivalences with the results of differentiate. *) + +derived_goal2 `\x1:real. ups_x x1 x2 x3`;; +e (DIFF_TAC);; +e (REAL_ARITH_TAC);; + +let thm = prove_by_refinement ( nonstack_goal2 `\x1:real. ups_x x1 x2 x3`, + [ + DIFF_TAC; + REAL_ARITH_TAC; + ]);; + +(* This will only work for terms that do not require a theorem with extra assumptions to rewrite. For example, does not work for eta2_126. Use DIFF_TAC2. *) + +(* The below sequence will not work yet because the assumptions "xi IN s" are not in the assumption list. list_mk_comb did not work when applied to IN, but is_comb returns true on the term `x IN s`. *) + +(* +derived_goal2 `\x1:real. eta2_126 x1 x2 x3 x4 x5 x6`;; + +e (DIFF_TAC2);; +e (ASM_REWRITE_TAC[]);; +e (MP_TAC (SPEC_ALL eta2_126_eta_x_open));; +e (ASM_REWRITE_TAC[]);; +e (STRIP_TAC);; +e (MATCH_MP_TAC HAS_REAL_DERIVATIVE_TRANSFORM_WITHIN);; +*) + +(* This set of tactics should nearly complete the goal once those assumptions are added. See the proof of atn2 for an example to this process. Each such function will need a theorem proving its equivalence to something differentiate can handle, and an "openness" theorem. *) + +(* mk_xy_derived_goal works as the first methods do, but you must pass it a variable as well as a term. The variable is what will be differentiated with respect to. *) + +mk_xy_deriv_goal `x2:real` `\x1:real. eta2_126 x1 x2 x3 x4 x5 x6`;; + +(* The final thing that needs to be done is a completion of the lists that these methods reference, and a full automation of creating the lambda abstracted terms. i.e. a method that will loop through all variables on a function and pass the terms to the *_goal2 methods etc. *) + +end;; diff --git a/text_formalization/nonlinear/compute_2158872499.hl b/text_formalization/nonlinear/compute_2158872499.hl new file mode 100644 index 0000000..69ad645 --- /dev/null +++ b/text_formalization/nonlinear/compute_2158872499.hl @@ -0,0 +1,1422 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* *) +(* Author : TRIEU THI DIEP *) +(* Date: 2010-05-14 *) +(* Number : 2158872499 *) +(* *) +(* ========================================================================= *) + +(* +This contains the second derivative calculation of g(t) in calculation 2158872499. +*) + +(* +changes: extension changed from .ml to .hl, +wrapped all files in a module. +needs -> flyspeck_needs. +merged two compute files, +open Sphere, +open Vukhacky_tactics, +replaced h0 with hz to avoid conflict with constant h0. +*) + +flyspeck_needs "nonlinear/vukhacky_tactics.hl";; + +module Compute_2158872499 = struct + + + open Sphere;; + open Vukhacky_tactics;; + open Trigonometry1;; + open Trigonometry2;; + +(* ========================================================================== *) + +let ATN_UPS_X_BREAKDOWN1 = prove_by_refinement ( + `!a b c. + &0 < (a + b + c) * (a + b - c) * (b + c - a) * (c + a - b) + ==> arclength a b c = + pi / &2 + + atn + ((c * c - a * a - b * b) / + sqrt ((a + b + c) * (a + b - c) * (b + c - a) * (c + a - b)))`, + +[(REPEAT STRIP_TAC); + (SUBGOAL_THEN `ups_x (a * a) (b * b) (c * c) = (a + b + c) * (a + b - c) * + (b + c - a) * (c + a - b)` ASSUME_TAC); + (REWRITE_TAC[ups_x]); + (REAL_ARITH_TAC); + (REWRITE_TAC[arclength]); + AP_TERM_TAC; + (ASM_REWRITE_TAC[]); + (ABBREV_TAC `S = (a + b + c) * (a + b - c) * (b + c - a) * (c + a - b)`); + (SUBGOAL_THEN `&0 < sqrt S` ASSUME_TAC); + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[ATN2_BREAKDOWN])]);; + +(* ========================================================================== *) + +let compute_one_first = prove_by_refinement ( + `!y1 y2 s hz g x. + &1 <= hz /\ hz < &2 /\ &2 <= y1 /\ y1 <= &2 * hz /\ + &2 <= y2 /\ y2 <= &2 * hz /\ + s = {t | y1 - &4 < t /\ t < &4 - y2} /\ + g = (\t. arclength y1 (y2 + t) (&2)) /\ x IN s /\ + g' = (\x. --((y2 + x) pow 2 - y1 pow 2 + &4) / + ((y2 + x) * + sqrt + ((y1 + (y2 + x) + &2) * + (y1 + (y2 + x) - &2) * + ((y2 + x) + &2 - y1) * + (&2 + y1 - (y2 + x))))) + ==> (g has_real_derivative g' x) (atreal x within s)`, + +[(REPEAT STRIP_TAC); + REWRITE_TAC[ASSUME `g' = (\x. --((y2 + x) pow 2 - y1 pow 2 + &4) / + ((y2 + x) * + sqrt + ((y1 + (y2 + x) + &2) * + (y1 + (y2 + x) - &2) * + ((y2 + x) + &2 - y1) * + (&2 + y1 - (y2 + x)))))`]; + (SUBGOAL_THEN `!t. t IN s ==> + &0 < (y1 + (y2 + t) + &2) * (y1 + (y2 + t) - &2) * + ((y2 + t) + &2 - y1) * (&2 + y1 - (y2 + t))` ASSUME_TAC); + + (GEN_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC); + + (SUBGOAL_THEN + `&0 < y1 + (y2 + t) - &2 /\ &0 < y1 + (y2 + t) + &2 /\ + &0 < (y2 + t) + &2 - y1 /\ &0 < &2 + y1 - (y2 + t)` ASSUME_TAC); + ASM_REAL_ARITH_TAC; + (ASM_MESON_TAC[REAL_LT_MUL]); + +(* ========================================================================== *) +(* SUBGOAL 3 *) +(* ========================================================================== *) + + (ABBREV_TAC `f1 = (\t. (y1 + (y2 + t) + &2) * (y1 + (y2 + t) - &2) * + ((y2 + t) + &2 - y1) * (&2 + y1 - (y2 + t)))`); + (ABBREV_TAC `f1' = &4 * (y2 + x) * (y1 pow 2 - (y2 + x) pow 2 + &4)`); + (ABBREV_TAC `P ={x| &0 < x}`); + (ABBREV_TAC `f2 = (\t. sqrt ((y1 + (y2 + t) + &2) * (y1 + (y2 + t) - &2) * + ((y2 + t) + &2 - y1) * (&2 + y1 - (y2 + t))))`); + + (SUBGOAL_THEN `f2 = (\t:real. sqrt (f1 t))` ASSUME_TAC); + (EXPAND_TAC "f1" THEN EXPAND_TAC "f2" THEN MESON_TAC[]); + + (ABBREV_TAC `g2' = (\x. inv (&2 * sqrt x))`); + (ABBREV_TAC `f2' = f1' * g2' ((f1:real->real) x)`); + + (SUBGOAL_THEN `(f2 has_real_derivative f2') (atreal x within s)`ASSUME_TAC); + (EXPAND_TAC "f2'" THEN PURE_REWRITE_TAC[ASSUME `f2 = (\t:real. sqrt (f1 t))`]); + + (SUBGOAL_THEN `(f1 has_real_derivative f1') (atreal x within s) /\ P (f1 x)` + ASSUME_TAC); + STRIP_TAC; + (EXPAND_TAC "f1" THEN EXPAND_TAC "f1'"); + (REAL_DIFF_TAC THEN REAL_ARITH_TAC); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN_ELIM_THM] THEN EXPAND_TAC "f1"); + (MP_TAC (ASSUME `(x:real) IN s`) THEN ASM_REWRITE_TAC[]); + (FIRST_X_ASSUM MP_TAC); + + (SUBGOAL_THEN `!x. P x ==> + (sqrt has_real_derivative (g2':real->real) x) (atreal x)` ASSUME_TAC); + (EXPAND_TAC "g2'" THEN REWRITE_TAC[BETA_THM]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN_ELIM_THM]); + (REWRITE_TAC[HAS_REAL_DERIVATIVE_SQRT]); + (FIRST_X_ASSUM MP_TAC); + + (REWRITE_TAC[HAS_REAL_DERIVATIVE_CHAIN2]); + +(* ------------------------------------------------------------------------- *) + + (ABBREV_TAC `f3 = (\t. (&2 * &2 - y1 * y1 - (y2 + t) * (y2 + t)) / + sqrt ((y1 + (y2 + t) + &2) * (y1 + (y2 + t) - &2) * + ((y2 + t) + &2 - y1) * (&2 + y1 - (y2 + t))))`); + (ABBREV_TAC `h = (\t. (&2 * &2 - y1 * y1 - (y2 + t) * (y2 + t)))`); + + (SUBGOAL_THEN `f3 = (\t:real. h t / f2 t)` ASSUME_TAC); + (EXPAND_TAC "f2" THEN EXPAND_TAC "h" THEN EXPAND_TAC "f3"); + (REWRITE_TAC[]); + + (SUBGOAL_THEN `(h has_real_derivative -- &2 * (y2 + x)) (atreal x within s) /\ + (f2 has_real_derivative f2') (atreal x within s) /\ + ~(f2 x = &0)` ASSUME_TAC); + (REPEAT CONJ_TAC); + + (EXPAND_TAC "h" THEN REAL_DIFF_TAC THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`)); + (MATCH_MP_TAC SQRT_POS_LT); + (EXPAND_TAC "f1" THEN MP_TAC (ASSUME `x:real IN s`) THEN ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `(f3 has_real_derivative + ((-- &2 * (y2 + x)) * f2 x - h x * f2') / f2 x pow 2) + (atreal x within s)` ASSUME_TAC); + (PURE_REWRITE_TAC[ASSUME `f3 = (\t:real. h t / f2 t)`]); + (FIRST_X_ASSUM MP_TAC); + (REWRITE_TAC[HAS_REAL_DERIVATIVE_DIV_WITHIN]); + +(* --------------------------------------------------------------------------*) + + (ABBREV_TAC `F1 = (\t. atn ((&2 * &2 - y1 * y1 - (y2 + t) * (y2 + t)) / + sqrt ((y1 + (y2 + t) + &2) * (y1 + (y2 + t) - &2) * + ((y2 + t) + &2 - y1) * (&2 + y1 - (y2 + t)))))`); + (ABBREV_TAC `f3' = ((-- &2 * (y2 + x)) * f2 x - h x * f2') / f2 x pow 2`); + (ABBREV_TAC `h' = (\x. inv (&1 + x pow 2))`); + + (SUBGOAL_THEN `F1 = (\t:real. atn (f3 t))` ASSUME_TAC); + (EXPAND_TAC "f3" THEN EXPAND_TAC "F1" THEN ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `(F1 has_real_derivative f3' * inv (&1 + f3 x pow 2)) + (atreal x within s)` ASSUME_TAC); + (REWRITE_TAC[ASSUME `F1 = (\t:real. atn (f3 t))`]); + + (SUBGOAL_THEN `(f3 has_real_derivative f3') (atreal x within s) /\ + (:real) (f3 x)` ASSUME_TAC); + (ASM_REWRITE_TAC[]); + (MESON_TAC[EQ_UNIV;IN_UNIV; IN]); + (FIRST_X_ASSUM MP_TAC); + + (SUBGOAL_THEN `!x. (:real) x ==> (atn has_real_derivative (h':real->real) x) + (atreal x)` ASSUME_TAC); + (EXPAND_TAC "h'" THEN REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[EQ_UNIV; HAS_REAL_DERIVATIVE_ATN]); + (FIRST_X_ASSUM MP_TAC); + + (SUBGOAL_THEN `inv (&1 + f3 (x:real) pow 2) = h' (f3 x)` ASSUME_TAC); + (EXPAND_TAC "h'" THEN REWRITE_TAC[]); + + (REWRITE_TAC[ASSUME `inv (&1 + f3 (x:real) pow 2) = h'( f3 x)`]); + (REWRITE_TAC[HAS_REAL_DERIVATIVE_CHAIN2]); + +(* --------------------------------------------------------------------------*) + + (SUBGOAL_THEN `f1 x = &4 * (y1 * (y2 + x)) pow 2 - + (&2 * &2 - y1 * y1 - (y2 + x) * (y2 + x)) pow 2` ASSUME_TAC); + (EXPAND_TAC "f1" THEN REAL_ARITH_TAC); + + (SUBGOAL_THEN `inv (&1 + f3 x pow 2) = + (f1 x) / (&4 * (y1 * (y2 + x)) pow 2)` ASSUME_TAC); + (EXPAND_TAC "f3"); + (REWRITE_TAC[REAL_POW_DIV]); + + (SUBGOAL_THEN `&0 <= (y1 + (y2 + x) + &2) * (y1 + (y2 + x) - &2) * + ((y2 + x) + &2 - y1) * (&2 + y1 - (y2 + x))` ASSUME_TAC); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`)); + (MP_TAC (ASSUME `x:real IN s`) THEN ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `sqrt ((y1 + (y2 + x) + &2) * (y1 + (y2 + x) - &2) * + ((y2 + x) + &2 - y1) * (&2 + y1 - (y2 + x))) pow 2 = f1 x` ASSUME_TAC); + (EXPAND_TAC "f1" THEN ASM_SIMP_TAC [SQRT_POW_2]); + + (PURE_ONCE_ASM_REWRITE_TAC[]); + (ONCE_ASM_REWRITE_TAC[GSYM REAL_INV_DIV]); + (AP_TERM_TAC); + (ONCE_ASM_REWRITE_TAC[REAL_INV_DIV] THEN PURE_ONCE_ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC (REAL_ARITH `&1 = x - y ==> &1 + y = x `)); + (REWRITE_TAC [REAL_ARITH `x / y - z / y = (x - z) / y`]); + (MATCH_MP_TAC (GSYM REAL_DIV_REFL)); + (REWRITE_TAC[GSYM (ASSUME `f1 x = &4 * (y1 * (y2 + x)) pow 2 - + (&2 * &2 - y1 * y1 - (y2 + x) * (y2 + x)) pow 2`)]); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(&0 = a)`)); + (MP_TAC (ASSUME `x:real IN s`)); + (EXPAND_TAC "f1" THEN ASM_REWRITE_TAC[]); + +(* ========================================================================== *) + + (SUBGOAL_THEN ` ((-- &2 * (y2 + x)) * f2 x - h x * f2') = + -- &4 * y1 * y1 * (y2 + x) * ((y2 + x) pow 2 - y1 pow 2 + &4) / f2 x` + ASSUME_TAC); + + (ABBREV_TAC `X = ((-- &2 * (y2 + x)) * f2 x - h x * f2')`); + (REWRITE_TAC[REAL_ARITH `x * y / z = (x * y) / z`]); + (ABBREV_TAC + `Y = (-- &4 * y1 * y1 * (y2 + x) * ((y2 + x) pow 2 - y1 pow 2 + &4))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + + (SUBGOAL_THEN `Y / f2 (x:real) = X <=> Y = X * f2 x` ASSUME_TAC); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (REPLICATE_TAC 2 (ONCE_ASM_REWRITE_TAC[]) THEN MATCH_MP_TAC SQRT_POS_LT); + (EXPAND_TAC "f1" THEN MP_TAC (ASSUME `x:real IN s`) THEN ASM_REWRITE_TAC[]); + (ONCE_ASM_REWRITE_TAC[]); + + (EXPAND_TAC "X" THEN EXPAND_TAC "Y"); + (EXPAND_TAC "f2'" THEN EXPAND_TAC "h" THEN EXPAND_TAC "g2'"); + (ONCE_REWRITE_TAC[REAL_ARITH `(a - b) * c = a * c - b * c`]); + + (SUBGOAL_THEN `inv (&2 * sqrt (f1 x)) * f2 (x:real) = &1 / &2` ASSUME_TAC); + (REWRITE_TAC[ASSUME `f2 = (\t:real. sqrt (f1 t))`]); + (ONCE_REWRITE_TAC[REAL_ARITH `a * sqrt b = (a * (&2 * sqrt b)) / &2`]); + (AP_THM_TAC THEN AP_TERM_TAC); + (MATCH_MP_TAC REAL_MUL_LINV); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`)); + (MATCH_MP_TAC REAL_LT_MUL); + (REWRITE_TAC[REAL_ARITH `&0 < &2`]); + (MATCH_MP_TAC SQRT_POS_LT); + (EXPAND_TAC "f1" THEN MP_TAC (ASSUME `x:real IN s`) THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[REAL_ARITH `(a * b * c) * d = (a * b) * c * d`]); + (PURE_REWRITE_TAC[ASSUME `inv (&2 * sqrt (f1 x)) * f2 (x:real) = &1 / &2`]); + (REWRITE_TAC[REAL_ARITH `(a * f2 x) * f2 x = a * (f2 (x:real) pow 2)`]); + + (SUBGOAL_THEN `f2 (x:real) pow 2 = f1 x` ASSUME_TAC); + (REWRITE_TAC [ASSUME `f2 = (\t:real. sqrt (f1 t))`]); + (MATCH_MP_TAC SQRT_POW_2); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`)); + (EXPAND_TAC "f1" THEN MP_TAC (ASSUME `x:real IN s`) THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ASSUME `f2 (x:real) pow 2 = f1 x`]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "Y" THEN EXPAND_TAC "f1'"); + REAL_ARITH_TAC; + +(* ========================================================================= *) + + (SUBGOAL_THEN + `f3' * inv (&1 + f3 x pow 2) = + -- ((y2 + x) pow 2 - y1 pow 2 + &4) / ((y2 + x) * f2 x)` ASSUME_TAC); + (EXPAND_TAC "f3'"); + (REWRITE_TAC[ASSUME + `inv (&1 + f3 x pow 2) = f1 x / (&4 * (y1 * (y2 + x)) pow 2)`]); + (REWRITE_TAC[ASSUME `(-- &2 * (y2 + x)) * f2 x - h x * f2' = + -- &4 * y1 * y1 * (y2 + x) * ((y2 + x) pow 2 - y1 pow 2 + &4) / f2 x`]); + + (SUBGOAL_THEN `f2 (x:real) pow 2 = f1 x` ASSUME_TAC); + (REWRITE_TAC [ASSUME `f2 = (\t:real. sqrt (f1 t))`]); + (MATCH_MP_TAC SQRT_POW_2); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`)); + (EXPAND_TAC "f1" THEN MP_TAC (ASSUME `x:real IN s`) THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `f2 (x:real) pow 2 = f1 x`]); + + (ONCE_REWRITE_TAC [REAL_ARITH `a / b * c / d = (a / d) * c / b`]); + (MATCH_MP_TAC (MESON[REAL_MUL_RID] `a = &1 /\ x = y ==> x * a = y`)); + STRIP_TAC; + (MATCH_MP_TAC REAL_DIV_REFL); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`)); + (EXPAND_TAC "f1" THEN MP_TAC (ASSUME `x:real IN s`) THEN ASM_REWRITE_TAC[]); + + (ABBREV_TAC `X = + (-- &4 * y1 * y1 * (y2 + x) * ((y2 + x) pow 2 - y1 pow 2 + &4) / f2 x)`); + (ABBREV_TAC + `Y = --((y2 + x) pow 2 - y1 pow 2 + &4) / ((y2 + x) * f2 x)`); + (ABBREV_TAC `Z = (&4 * (y1 * (y2 + x)) pow 2)`); + + (SUBGOAL_THEN `X / Z = Y <=> X = Y * Z` ASSUME_TAC); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (EXPAND_TAC "Z"); + (MATCH_MP_TAC REAL_LT_MUL); + (REWRITE_TAC[REAL_ARITH `&0 < &4`]); + (MATCH_MP_TAC REAL_POW_LT); + (MATCH_MP_TAC REAL_LT_MUL); + STRIP_TAC; + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC (REAL_ARITH `&0 <= y1 + y2 - &4 /\ y1 + y2 - &4 < s ==> &0 < s`)); + (STRIP_TAC); + (MATCH_MP_TAC (REAL_ARITH `&2 <= y1 /\ &2 <= y2 ==> &0 <= y1 + y2 - &4`)); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (REAL_ARITH `y1 - &4 < x ==> y1 + y2 - &4 < y2 + x`)); + (MP_TAC (ASSUME `x:real IN s`)); + (REWRITE_TAC[ASSUME `s = {t | y1 - &4 < t /\ t < &4 - y2}`]); + (PURE_REWRITE_TAC[IN_ELIM_THM]); + (STRIP_TAC THEN ASM_REWRITE_TAC[]); + (ONCE_ASM_REWRITE_TAC[]); + + (EXPAND_TAC "X" THEN EXPAND_TAC "Y" THEN EXPAND_TAC "Z"); + (REWRITE_TAC [REAL_ARITH `a * b / c = (a * b) / c`]); + (REWRITE_TAC[REAL_ARITH + `--((y2 + x) pow 2 - y1 pow 2 + &4) / ((y2 + x) * f2 x) * + &4 * (y1 * (y2 + x)) pow 2 = + (-- &4 * y1 * y1 * (y2 + x) * ((y2 + x) pow 2 - y1 pow 2 + &4)) * (y2 + x) + / (f2 x * (y2 + x))`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC REDUCE_WITH_DIV_Euler_lemma); + CONJ_TAC; + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~ (a = &0)`)); + (MATCH_MP_TAC (REAL_ARITH `&0 <= y1 + y2 - &4 /\ y1 + y2 - &4 < s ==> &0 < s`)); + (STRIP_TAC); + (MATCH_MP_TAC (REAL_ARITH `&2 <= y1 /\ &2 <= y2 ==> &0 <= y1 + y2 - &4`)); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (REAL_ARITH `y1 - &4 < x ==> y1 + y2 - &4 < y2 + x`)); + (MP_TAC (ASSUME `x:real IN s`)); + (REWRITE_TAC[ASSUME `s = {t | y1 - &4 < t /\ t < &4 - y2}`]); + (PURE_REWRITE_TAC[IN_ELIM_THM]); + (STRIP_TAC THEN ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~ (a = &0)`)); + (ONCE_ASM_REWRITE_TAC[]); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SQRT_POS_LT); + (EXPAND_TAC "f1" THEN MP_TAC (ASSUME `x:real IN s`) THEN ASM_REWRITE_TAC[]); + +(* ========================================================================== *) + + (SUBGOAL_THEN + `(F1 has_real_derivative --((y2 + x) pow 2 - y1 pow 2 + &4) / + ((y2 + x) * f2 x)) (atreal x within s)` ASSUME_TAC); + (ASM_MESON_TAC[]); + + (SUBGOAL_THEN ` + (F1 has_real_derivative --((y2 + x) pow 2 - y1 pow 2 + &4) / + ((y2 + x) * sqrt + ((y1 + (y2 + x) + &2) * + (y1 + (y2 + x) - &2) * + ((y2 + x) + &2 - y1) * + (&2 + y1 - (y2 + x))))) + (atreal x within s)` ASSUME_TAC); + (FIRST_X_ASSUM MP_TAC THEN EXPAND_TAC "f2"); + (REWRITE_TAC[]); + + (ABBREV_TAC `F2 = (\x:real. pi / &2 + F1 x)`); + (ABBREV_TAC `pi_2 = (\x:real. pi / &2 )`); + + (SUBGOAL_THEN `(F2 has_real_derivative --((y2 + x) pow 2 - y1 pow 2 + &4) / + ((y2 + x) * + sqrt + ((y1 + (y2 + x) + &2) * + (y1 + (y2 + x) - &2) * + ((y2 + x) + &2 - y1) * + (&2 + y1 - (y2 + x))))) + (atreal x within s)` ASSUME_TAC); + + (SUBGOAL_THEN `F2 = (\x:real. pi_2 x + F1 x)` ASSUME_TAC); + (EXPAND_TAC "F2" THEN EXPAND_TAC "F1" THEN EXPAND_TAC "pi_2"); + (REWRITE_TAC[]); + + (REWRITE_TAC[ASSUME `F2 = (\x:real. pi_2 x + F1 x)`]); + (ABBREV_TAC `F1' = (--((y2 + x) pow 2 - y1 pow 2 + &4) / + ((y2 + x) * + sqrt + ((y1 + (y2 + x) + &2) * + (y1 + (y2 + x) - &2) * + ((y2 + x) + &2 - y1) * + (&2 + y1 - (y2 + x)))))`); + + (SUBGOAL_THEN `((\x. pi_2 x + F1 x) has_real_derivative &0 + F1') + (atreal x within s)` ASSUME_TAC); + + (SUBGOAL_THEN `(pi_2 has_real_derivative (&0)) (atreal x within s)` + ASSUME_TAC); + (EXPAND_TAC "pi_2"); + (REAL_DIFF_TAC THEN REAL_ARITH_TAC); + + (FIRST_X_ASSUM MP_TAC); + (MP_TAC (ASSUME `(F1 has_real_derivative F1') (atreal x within s)`)); + (REWRITE_TAC[MESON[] `(a ==> b ==> c) <=> (b /\ a ==> c)`]); + (MESON_TAC[HAS_REAL_DERIVATIVE_ADD]); + (ASM_MESON_TAC[REAL_ARITH `&0 + a = a`]); + + + (ABBREV_TAC `F1' = (--((y2 + x) pow 2 - y1 pow 2 + &4) / + ((y2 + x) * + sqrt + ((y1 + (y2 + x) + &2) * + (y1 + (y2 + x) - &2) * + ((y2 + x) + &2 - y1) * + (&2 + y1 - (y2 + x)))))`); + + (SUBGOAL_THEN + `(!x':real. (x':real) IN s /\ abs (x' - x) < &1 ==> + (F2:real -> real) x' = g x')` ASSUME_TAC); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (EXPAND_TAC "F2"); + (EXPAND_TAC "F1"); + (MATCH_MP_TAC ATN_UPS_X_BREAKDOWN1); + (MP_TAC (ASSUME `x':real IN s`)); + (ASM_REWRITE_TAC[]); + (MP_TAC (ASSUME `(F2 has_real_derivative F1') (atreal x within s)`)); + (MP_TAC (ASSUME `!x'. x' IN s /\ abs (x' - x) < &1 ==> (F2:real->real) x' = g x'`)); + (MP_TAC (ASSUME `x:real IN s`)); + (MP_TAC (REAL_ARITH `&0 < &1`)); + (MESON_TAC[HAS_REAL_DERIVATIVE_TRANSFORM_WITHIN])]);; + +(* ========================================================================= *) + + +let compute_one_second = prove_by_refinement ( + `!y1 y2 s hz g x. + &1 <= hz /\ hz < &2 /\ &2 <= y1 /\ y1 <= &2 * hz /\ + &2 <= y2 /\ y2 <= &2 * hz /\ + s = {t | y1 - &4 < t /\ t < &4 - y2} /\ + g = (\t. --((y2 + t) pow 2 - y1 pow 2 + &4) / + ((y2 + t) * + sqrt ((y1 + (y2 + t) + &2) * (y1 + (y2 + t) - &2) * + ((y2 + t) + &2 - y1) * (&2 + y1 - (y2 + t))))) + ==> (g has_real_derivative + (-- &64 + &48 * y1 pow 2 - &12 * y1 pow 4 + y1 pow 6 + + &80 * y2 pow 2 - &8 * y1 pow 2 * y2 pow 2 - &3 * y1 pow 4 * y2 pow 2 - + &12 * y2 pow 4 + &3 * y1 pow 2 * y2 pow 4 - y2 pow 6) / + (y2 pow 2 * sqrt (ups_x (y1 pow 2) (y2 pow 2) (&4)) * + ups_x (y1 pow 2) (y2 pow 2) (&4))) + (atreal (&0) within s)`, +[ REPEAT STRIP_TAC; + + (SUBGOAL_THEN `&0 IN s` ASSUME_TAC); + (PURE_ASM_REWRITE_TAC[IN_ELIM_THM]); + CONJ_TAC; + (REWRITE_TAC[REAL_ARITH `a - b < &0 <=> a < b`]); + (MATCH_MP_TAC (REAL_ARITH `y1 <= &2 * hz /\ &2 * hz < &4 ==> y1 < &4`)); + (ASM_REWRITE_TAC[] THEN ASM_REAL_ARITH_TAC); + ASM_REAL_ARITH_TAC; + +(* ========================================================================== *) + + (SUBGOAL_THEN + `!t. t IN s ==> &0 < (y1 + (y2 + t) + &2) * (y1 + (y2 + t) - &2) * + ((y2 + t) + &2 - y1) * (&2 + y1 - (y2 + t))` ASSUME_TAC); + (GEN_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC); + + (SUBGOAL_THEN `&0 < y1 + (y2 + t) - &2 /\ &0 < y1 + (y2 + t) + &2 /\ + &0 < (y2 + t) + &2 - y1 /\ &0 < &2 + y1 - (y2 + t)` ASSUME_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[REAL_LT_MUL]); + + (ABBREV_TAC `f1 = (\t. --((y2 + t) pow 2 - y1 pow 2 + &4))`); + (ABBREV_TAC `f2 = (\t. (y1 + (y2 + t) + &2) * (y1 + (y2 + t) - &2) * + ((y2 + t) + &2 - y1) * (&2 + y1 - (y2 + t)))`); + (ABBREV_TAC `f3 = (\t:real. sqrt (f2 t))`); + (ABBREV_TAC `f4 = (\t:real. y2 + t)`); + (ABBREV_TAC `f5 = (\t:real. f4 t * f3 t )`); + +(SUBGOAL_THEN `&0 < f2 (&0)` ASSUME_TAC); +(EXPAND_TAC "f2" THEN MP_TAC (ASSUME`((&0):real) IN s`) THEN ASM_REWRITE_TAC[]); + +(SUBGOAL_THEN `(f1 has_real_derivative -- &2 * y2) (atreal (&0) within s)` + ASSUME_TAC); +(EXPAND_TAC "f1" THEN REAL_DIFF_TAC); +(REWRITE_TAC[ARITH_RULE `2 - 1 = 1`] THEN REAL_ARITH_TAC); + +(ABBREV_TAC `f2' = &4 * y2 * (y1 pow 2 - y2 pow 2 + &4)`); +(ABBREV_TAC `P ={x| &0 < x}`); +(ABBREV_TAC `g3' = (\x. inv (&2 * sqrt x))`); +(ABBREV_TAC `f3' = f2' * g3' ((f2:real->real) (&0))`); + + (SUBGOAL_THEN + `(f3 has_real_derivative f3') (atreal (&0) within s)` ASSUME_TAC); + (EXPAND_TAC "f3'" THEN EXPAND_TAC "f3"); + +(SUBGOAL_THEN `(f2 has_real_derivative f2') (atreal (&0) within s) /\ + P (f2 (&0))` MP_TAC); + STRIP_TAC; + + (EXPAND_TAC "f2" THEN EXPAND_TAC "f2'"); + (REAL_DIFF_TAC THEN REWRITE_TAC[POW_2] THEN REAL_ARITH_TAC); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN_ELIM_THM]); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `!x. P x ==> (sqrt has_real_derivative (g3':real->real) x) (atreal x)` + MP_TAC); + (EXPAND_TAC "g3'" THEN REWRITE_TAC[BETA_THM]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN_ELIM_THM]); + (REWRITE_TAC[HAS_REAL_DERIVATIVE_SQRT]); + +(REWRITE_TAC[HAS_REAL_DERIVATIVE_CHAIN2]); + +(* ========================================================================== *) + +(SUBGOAL_THEN `(f5 has_real_derivative f4 (&0) * f3' + &1 * f3 (&0)) + (atreal (&0) within s)` ASSUME_TAC); + +(SUBGOAL_THEN + `(f4 has_real_derivative &1) (atreal (&0) within s) /\ + (f3 has_real_derivative f3') (atreal (&0) within s)` MP_TAC); +(ASM_REWRITE_TAC[]); +(EXPAND_TAC "f4" THEN REAL_DIFF_TAC THEN REAL_ARITH_TAC); + +(EXPAND_TAC "f5"); +(REWRITE_TAC[HAS_REAL_DERIVATIVE_MUL_WITHIN]); + +(* ========================================================================= *) +(* Derivative of f1 / f5 *) +(* ========================================================================= *) + +(SUBGOAL_THEN `g = (\t:real. f1 t / f5 t)` ASSUME_TAC); +(ASM_REWRITE_TAC[] THEN EXPAND_TAC "f5" THEN EXPAND_TAC "f1"); +(EXPAND_TAC "f4" THEN EXPAND_TAC "f3" THEN EXPAND_TAC "f2" THEN REWRITE_TAC[]); + +(REWRITE_TAC[ASSUME `g = (\t:real. f1 t / f5 t)`] THEN DEL_TAC); + +(SUBGOAL_THEN `((\t. f1 t / f5 t) has_real_derivative + ((-- &2 * y2) * f5 (&0) - f1 (&0) * (f4 (&0) * f3' + &1 * f3 (&0))) / + f5 (&0) pow 2) (atreal (&0) within s)` ASSUME_TAC); + +(SUBGOAL_THEN + `(f1 has_real_derivative -- &2 * y2) (atreal (&0) within s) /\ + (f5 has_real_derivative f4 (&0) * f3' + &1 * f3 (&0)) + (atreal (&0) within s) /\ ~(f5 (&0) = &0)` MP_TAC); +(ASM_REWRITE_TAC[]); +(MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`)); +(EXPAND_TAC "f5" THEN MATCH_MP_TAC REAL_LT_MUL); +STRIP_TAC; + +(EXPAND_TAC "f4" THEN ASM_REAL_ARITH_TAC); +(EXPAND_TAC "f3" THEN MATCH_MP_TAC SQRT_POS_LT THEN ASM_REWRITE_TAC[]); + +(REWRITE_TAC[HAS_REAL_DERIVATIVE_DIV_WITHIN]); + +(* ========================================================================= *) + +(SUBGOAL_THEN +`((-- &2 * y2) * f5 (&0) - f1 (&0) * (f4 (&0) * f3' + &1 * f3 (&0))) / + f5 (&0) pow 2 = +(-- &64 + &48 * y1 pow 2 - &12 * y1 pow 4 + y1 pow 6 + + &80 * y2 pow 2 - &8 * y1 pow 2 * y2 pow 2 - &3 * y1 pow 4 * y2 pow 2 - + &12 * y2 pow 4 + &3 * y1 pow 2 * y2 pow 4 - y2 pow 6) / + (y2 pow 2 * sqrt (ups_x (y1 pow 2) (y2 pow 2) (&4)) * + ups_x (y1 pow 2) (y2 pow 2) (&4))` ASSUME_TAC); + +(EXPAND_TAC "f5"); + +(SUBGOAL_THEN `f4 (&0) = (y2:real)` ASSUME_TAC); +(EXPAND_TAC "f4" THEN REAL_ARITH_TAC); +(ASM_REWRITE_TAC[]); +(REWRITE_TAC[REAL_ARITH `a pow 4 = a pow 2 * a pow 2`]); +(REWRITE_TAC[REAL_ARITH `a pow 6 = a pow 2 * a pow 2 * a pow 2`]); +(REWRITE_TAC[REAL_MUL_LID]); +(REWRITE_TAC[REAL_ARITH `a - b * (c + d) = a - b * c - b * d`]); +(REWRITE_TAC[REAL_ARITH `(-- &2 * y2) * y2 * x = ((-- &2 * y2) * y2) * x`]); +(REWRITE_TAC[REAL_ARITH `a * f3 (&0) - b - c * f3 (&0) = (a - c) * f3 (&0) - b`]); + +(SUBGOAL_THEN `(-- &2 * y2) * y2 - f1 (&0) = (&4 - y1 pow 2 - y2 pow 2)` ASSUME_TAC); +(EXPAND_TAC "f1" THEN REAL_ARITH_TAC); +(ASM_REWRITE_TAC[]); + +(EXPAND_TAC "f3'" THEN EXPAND_TAC "g3'"); + +(SUBGOAL_THEN `sqrt (f2 (&0)) = f3 (&0)` ASSUME_TAC); +(EXPAND_TAC "f3" THEN REWRITE_TAC[]); +(REWRITE_TAC[ASSUME `sqrt (f2 (&0)) = f3 (&0)`]); + +(SUBGOAL_THEN +`(&4 - y1 pow 2 - y2 pow 2) * f3 (&0) - + f1 (&0) * y2 * f2' * inv (&2 * f3 (&0)) = + ((&4 - y1 pow 2 - y2 pow 2) * f3 (&0) pow 2 - + f1 (&0) * &2 * y2 pow 2 * (y1 pow 2 - y2 pow 2 + &4)) / + f3 (&0)` ASSUME_TAC); + +(PURE_ONCE_REWRITE_TAC[REAL_ARITH `(a - b) / c = a / c - b / c`]); +(MATCH_MP_TAC (REAL_ARITH `a = b /\ c = d ==> a - c = b - d`)); +STRIP_TAC; + +(REWRITE_TAC[REAL_POW_2; REAL_ARITH `(a * b * c) / d = (a * b) * c / d`]); +(MATCH_MP_TAC (MESON[REAL_MUL_RID] `a = &1 ==> b = b * a`)); +(MATCH_MP_TAC REAL_DIV_REFL); +(EXPAND_TAC "f3"); +(MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~ (a = &0)`)); +(MATCH_MP_TAC SQRT_POS_LT); +(ASM_REWRITE_TAC[]); + +(EXPAND_TAC "f2'" THEN REWRITE_TAC[REAL_POW_2]); +(REWRITE_TAC[REAL_ARITH + `f1 (&0) * y2 * (&4 * y2 * (y1 * y1 - y2 * y2 + &4)) * inv (&2 * f3 (&0)) = + (f1 (&0) * &2 * (y2 * y2) * (y1 * y1 - y2 * y2 + &4)) * &2 * + inv (&2 * f3 (&0))`]) ; + +(ABBREV_TAC `X = (f1 (&0) * &2 * (y2 * y2) * (y1 * y1 - y2 * y2 + &4)) * + &2 * inv (&2 * f3 (&0))`); +(ABBREV_TAC `Y = (f1 (&0) * &2 * (y2 * y2) * (y1 * y1 - y2 * y2 + &4))`); +(ABBREV_TAC `Z = (f3:real->real) (&0)`); + +(SUBGOAL_THEN `X = Y / Z <=> X * Z = Y` ASSUME_TAC); +(MATCH_MP_TAC REAL_EQ_RDIV_EQ THEN EXPAND_TAC "Z" THEN EXPAND_TAC "f3"); +(MATCH_MP_TAC SQRT_POS_LT THEN ASM_REWRITE_TAC[]); +(ASM_REWRITE_TAC[]); + +(EXPAND_TAC "X" THEN EXPAND_TAC "Y" THEN EXPAND_TAC "Z"); +(REWRITE_TAC[REAL_ARITH + `((f1 (&0) * &2 * (y2 * y2) * (y1 * y1 - y2 * y2 + &4)) * &2 * + inv (&2 * f3 (&0))) * f3 (&0) = + (f1 (&0) * &2 * (y2 * y2) * (y1 * y1 - y2 * y2 + &4)) * + (&2 * f3 (&0)) * inv (&2 * f3 (&0))`]); + +(MATCH_MP_TAC( MESON[REAL_MUL_RID] `a = &1 ==> b * a = b`)); +(MATCH_MP_TAC REAL_MUL_RINV); +(MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~ (a = &0)`)); +(MATCH_MP_TAC REAL_LT_MUL); +(REWRITE_TAC[REAL_ARITH `&0 < &2`]); +(EXPAND_TAC "f3" THEN MATCH_MP_TAC SQRT_POS_LT THEN ASM_REWRITE_TAC[]); +(ASM_REWRITE_TAC[]); + +(ABBREV_TAC `a = y1 pow 2`); +(ABBREV_TAC `b = y2 pow 2`); + +(SUBGOAL_THEN + `((&4 - a - b) * f3 (&0) pow 2 - f1 (&0) * &2 * b * (a - b + &4)) = + -- &64 + &48 * a - &12 * a * a + a * a * a + &80 * b - &8 * a * b - + &3 * (a * a) * b - &12 * b * b + &3 * a * b * b - b * b * b` ASSUME_TAC); + +(EXPAND_TAC "f3"); +(SUBGOAL_THEN `sqrt (f2 (&0)) pow 2 = f2 (&0)` ASSUME_TAC); +(MATCH_MP_TAC SQRT_POW_2); +(MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`) THEN ASM_REWRITE_TAC[]); +(ASM_REWRITE_TAC[]); + +(SUBGOAL_THEN `f2 (&0) = &4 * a * b - (&4 - a - b) pow 2` ASSUME_TAC); +(EXPAND_TAC "f2" THEN EXPAND_TAC "a" THEN EXPAND_TAC "b"); +REAL_ARITH_TAC; +(ASM_REWRITE_TAC[]); + +(EXPAND_TAC "f1"); +(REWRITE_TAC[REAL_ARITH `y + &0 = y`; ASSUME `y2 pow 2 = b`]); +REAL_ARITH_TAC; + +(ASM_REWRITE_TAC[]); + +(ABBREV_TAC `X' = (-- &64 + &48 * a - &12 * a * a + a * a * a + &80 * b - + &8 * a * b - &3 * (a * a) * b - &12 * b * b + &3 * a * b * b - b * b * b)`); + +(SUBGOAL_THEN `ups_x a b (&4) = f2 (&0)` ASSUME_TAC); +(EXPAND_TAC "f2" THEN REWRITE_TAC[ups_x]); +(EXPAND_TAC "a" THEN EXPAND_TAC "b" THEN REAL_ARITH_TAC); +(ASM_REWRITE_TAC[]); + +(ABBREV_TAC `Z' = X' / f3 (&0) / (y2 * f3 (&0)) pow 2`); +(ABBREV_TAC `Y' = (b * f3 (&0) * f2 (&0))`); + +(SUBGOAL_THEN `Z' = X' / Y' <=> Z' * Y' = X'` ASSUME_TAC); +(MATCH_MP_TAC REAL_EQ_RDIV_EQ THEN EXPAND_TAC "Y'"); +(MATCH_MP_TAC REAL_LT_MUL); +STRIP_TAC; +(EXPAND_TAC "b" THEN MATCH_MP_TAC REAL_POW_LT THEN ASM_REAL_ARITH_TAC); +(MATCH_MP_TAC REAL_LT_MUL THEN EXPAND_TAC "f3"); +(ASM_SIMP_TAC [SQRT_POS_LT]); +(ASM_REWRITE_TAC[]); + +(EXPAND_TAC "Z'" THEN EXPAND_TAC "Y'"); +(REWRITE_TAC[REAL_ARITH `a / b * c = (a * c) / b`]); + +(SUBGOAL_THEN `(X' * b * f3 (&0) * f2 (&0)) / f3 (&0) = X' * b * f2 (&0)` ASSUME_TAC); +(REWRITE_TAC[REAL_ARITH `(a * b * c * d) / f = (a * b * d) * (c / f)`] ); +(MATCH_MP_TAC (MESON[REAL_MUL_RID] `a = &1 ==> b * a = b`)); +(MATCH_MP_TAC REAL_DIV_REFL); +(MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`)); +(EXPAND_TAC "f3"); +(MATCH_MP_TAC SQRT_POS_LT THEN ASM_REWRITE_TAC[]); + +(ASM_REWRITE_TAC[]); +(REWRITE_TAC[REAL_POW_2]); +(REWRITE_TAC[REAL_ARITH `(a * b) * a * b = a pow 2 * b pow 2`]); +(SUBGOAL_THEN `f3 (&0) pow 2 = f2 (&0)` ASSUME_TAC); +(EXPAND_TAC "f3" THEN MATCH_MP_TAC SQRT_POW_2); +(MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`) THEN ASM_REWRITE_TAC[]); + +(ASM_REWRITE_TAC[]); +(REWRITE_TAC[REAL_ARITH `(a * b) / c = a * (b / c)`]); +(MATCH_MP_TAC (MESON[REAL_MUL_RID] `a = &1 ==> b * a = b`)); +(REWRITE_TAC[REAL_ARITH `a * b / c = (a * b) / c`]); +(MATCH_MP_TAC REAL_DIV_REFL); +(MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`)); +(MATCH_MP_TAC REAL_LT_MUL); +(ASM_REWRITE_TAC[]); +(EXPAND_TAC "b" THEN MATCH_MP_TAC REAL_POW_LT THEN ASM_REAL_ARITH_TAC); + +(ASM_MESON_TAC[])]);; + +(* ========================================================================= *) + +let COMPUTE_DERIVATIVE_ONE = prove_by_refinement ( + `!y1 y2 s hz g x f. + &1 <= hz /\ hz < &2 /\ &2 <= y1 /\ y1 <= &2 * hz /\ + &2 <= y2 /\ y2 <= &2 * hz /\ + s = {t | y1 - &4 < t /\ t < &4 - y2} /\ + g = (\t. arclength y1 (y2 + t) (&2)) /\ + g' = (\t. --((y2 + t) pow 2 - y1 pow 2 + &4) / + ((y2 + t) * + sqrt ((y1 + (y2 + t) + &2) * (y1 + (y2 + t) - &2) * + ((y2 + t) + &2 - y1) * (&2 + y1 - (y2 + t))))) +==> (!x. x IN s ==> (g has_real_derivative g' x) (atreal x within s)) /\ + (g' has_real_derivative + (-- &64 + &48 * y1 pow 2 - &12 * y1 pow 4 + y1 pow 6 + + &80 * y2 pow 2 - &8 * y1 pow 2 * y2 pow 2 - &3 * y1 pow 4 * y2 pow 2 - + &12 * y2 pow 4 + &3 * y1 pow 2 * y2 pow 4 - y2 pow 6) / + (y2 pow 2 * sqrt (ups_x (y1 pow 2) (y2 pow 2) (&4)) * + ups_x (y1 pow 2) (y2 pow 2) (&4))) + (atreal (&0) within s)`, + +[(REPEAT STRIP_TAC); + (ASM_MESON_TAC[compute_one_first]); + (ASM_MESON_TAC[compute_one_second])]);; + + +let compute_two_first = prove_by_refinement ( + `!y1 y2 s hz g x. + &1 <= hz /\ hz < &2 /\ &2 <= y1 /\ y1 <= &2 * hz /\ + &2 <= y2 /\ y2 <= &2 * hz /\ + s = {t | y2 - &2 - y1 < &2 * t /\ &2 * t < y2 + &2 - y1} /\ + g = (\t. arclength (y1 + t) (y2 - t) (&2)) /\ x IN s /\ + g' = (\x. ((y2 - y1 - &2 * x) * ((y2 + y1) pow 2 - &4)) / + ((y1 + x) * (y2 - x) * sqrt ((y1 + y2 + &2) * (y1 + y2 - &2) * + (y2 - &2 * x + &2 - y1) * (&2 + y1 + &2 * x - y2)))) + ==> (g has_real_derivative g' x) (atreal x within s)`, + +[(REPEAT STRIP_TAC); + (SUBGOAL_THEN `!t. t IN s ==> + &0 < ((y1 + t)+ (y2 - t) + &2) * ((y1 + t)+ (y2 - t) - &2) * + ((y2 - t) + &2 - (y1 + t)) * (&2 + (y1 + t) - (y2 - t))` ASSUME_TAC); + (GEN_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC); + (SUBGOAL_THEN + `&0 < (y1 + t) + y2 - t + &2 /\ &0 < (y1 + t) + y2 - t - &2 /\ + &0 < y2 - t + &2 - (y1 + t) /\ &0 < &2 + (y1 + t) - (y2 - t)`ASSUME_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[REAL_LT_MUL]); + (ABBREV_TAC + `f1 = (\t. ((y1 + t) + y2 - t + &2) * ((y1 + t) + y2 - t - &2) * + (y2 - t + &2 - (y1 + t)) * (&2 + (y1 + t) - (y2 - t)))`); + (ABBREV_TAC + `f1' = &4 * (y1 + y2 + &2) * (y1 + y2 - &2) * (y2 - y1 - &2 * x)`); + (ABBREV_TAC `P ={x| &0 < x}`); + (ABBREV_TAC + `f2 = (\t. sqrt (((y1 + t) + y2 - t + &2) * ((y1 + t) + y2 - t - &2) * + (y2 - t + &2 - (y1 + t)) * (&2 + (y1 + t) - (y2 - t))))`); + (SUBGOAL_THEN `f2 = (\t:real. sqrt (f1 t))` ASSUME_TAC); + (EXPAND_TAC "f1" THEN EXPAND_TAC "f2" THEN MESON_TAC[]); + (ABBREV_TAC `g2' = (\x. inv (&2 * sqrt x))`); + (ABBREV_TAC `f2' = f1' * g2' ((f1:real->real) x)`); + (SUBGOAL_THEN`(f2 has_real_derivative f2') (atreal x within s)` ASSUME_TAC); + (EXPAND_TAC "f2'" THEN REWRITE_TAC[ASSUME `f2 = (\t:real. sqrt (f1 t))`]); + (SUBGOAL_THEN `(f1 has_real_derivative f1')(atreal x within s) /\ P (f1 x)` + MP_TAC); + STRIP_TAC; + (EXPAND_TAC "f1'" THEN EXPAND_TAC "f1"); + (REAL_DIFF_TAC THEN REAL_ARITH_TAC); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN_ELIM_THM] THEN EXPAND_TAC "f1"); + (MP_TAC (ASSUME `(x:real) IN s`) THEN ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `!x. P x ==> (sqrt has_real_derivative g2' x) (atreal x)`MP_TAC); + (EXPAND_TAC "g2'" THEN REWRITE_TAC[BETA_THM]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN_ELIM_THM]); + (REWRITE_TAC[HAS_REAL_DERIVATIVE_SQRT]); + (REWRITE_TAC[HAS_REAL_DERIVATIVE_CHAIN2]); + + (ABBREV_TAC `f3 = (\t. (&2 * &2 - (y1 + t) * (y1 + t) - (y2 - t) * (y2 - t)) / + sqrt (((y1 + t) + (y2 - t) + &2) * ((y1 + t) + (y2 - t) - &2) * + ((y2 - t) + &2 - (y1 + t)) * (&2 + (y1 + t) - (y2 - t))))`); + (ABBREV_TAC + `h = (\t. (&2 * &2 - (y1 + t) * (y1 + t) - (y2 - t) * (y2 - t)))`); + + (SUBGOAL_THEN `(f3 has_real_derivative + ((&2 * (y2 - y1 - &2 * x)) * f2 x - h x * f2') / f2 x pow 2) + (atreal x within s)` ASSUME_TAC); + + (SUBGOAL_THEN `f3 = (\t:real. h t / f2 t)` ASSUME_TAC); + (EXPAND_TAC "f2" THEN EXPAND_TAC "h" THEN EXPAND_TAC "f3"); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `(h has_real_derivative &2 * (y2 - y1 - &2 * x)) (atreal x within s) /\ + (f2 has_real_derivative f2') (atreal x within s) /\ ~(f2 x = &0)` MP_TAC); + (ASM_REWRITE_TAC[] THEN REPEAT CONJ_TAC); + (EXPAND_TAC "h" THEN REAL_DIFF_TAC THEN REAL_ARITH_TAC); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`)); + (ASM_REWRITE_TAC[] THEN MATCH_MP_TAC SQRT_POS_LT); + (EXPAND_TAC "f1" THEN MP_TAC(ASSUME `x:real IN s`) THEN ASM_REWRITE_TAC[]); + + (PURE_REWRITE_TAC[ASSUME `f3 = (\t:real. h t / f2 t)`]); + (REWRITE_TAC[HAS_REAL_DERIVATIVE_DIV_WITHIN]); + + (ABBREV_TAC `F1 = (\t. atn + ((&2 * &2 - (y1 + t) * (y1 + t) - (y2 - t) * (y2 - t)) / + sqrt + (((y1 + t) + (y2 - t) + &2) * + ((y1 + t) + (y2 - t) - &2) * + ((y2 - t) + &2 - (y1 + t)) * + (&2 + (y1 + t) - (y2 - t)))))`); + (SUBGOAL_THEN `F1 = (\t:real. atn (f3 t))` ASSUME_TAC); + (EXPAND_TAC "f3" THEN EXPAND_TAC "F1" THEN ASM_REWRITE_TAC[]); + + (ABBREV_TAC + `f3' = ((&2 * (y2 - y1 - &2 * x)) * f2 x - h x * f2') / f2 x pow 2`); + (SUBGOAL_THEN + `(F1 has_real_derivative f3' * inv (&1 + f3 x pow 2)) (atreal x within s)` + ASSUME_TAC); + (REWRITE_TAC[ASSUME `F1 = (\t:real. atn (f3 t))`]); + (SUBGOAL_THEN `(f3 has_real_derivative f3') (atreal x within s) /\ + (:real) (f3 x)` MP_TAC); + (ASM_REWRITE_TAC[] THEN MESON_TAC[EQ_UNIV;IN_UNIV; IN]); + (ABBREV_TAC `h' = (\x. inv (&1 + x pow 2))`); + + (SUBGOAL_THEN `!x. (:real) x ==> (atn has_real_derivative (h':real->real) x) + (atreal x)` MP_TAC); + (EXPAND_TAC "h'" THEN REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[EQ_UNIV; HAS_REAL_DERIVATIVE_ATN]); + + (SUBGOAL_THEN `inv (&1 + f3 (x:real) pow 2) = h' (f3 x)` ASSUME_TAC); + (EXPAND_TAC "h'" THEN REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `inv (&1 + f3 (x:real) pow 2) = h'( f3 x)`]); + + (REWRITE_TAC[HAS_REAL_DERIVATIVE_CHAIN2]); + +(* --------------------------------------------------------------------------*) +(* REDUCE derivative of F1 *) +(* --------------------------------------------------------------------------*) + + (SUBGOAL_THEN `f1 x = (y1 + y2 + &2) * + (y1 + y2 - &2) * + (y2 - &2 * x + &2 - y1) * + (&2 + y1 + &2 * x - y2)`ASSUME_TAC); + (EXPAND_TAC "f1" THEN REAL_ARITH_TAC); + (SUBGOAL_THEN `inv (&1 + f3 x pow 2) = + (f1 x) / (&4 * ((y1 + x) * (y2 - x)) pow 2)` ASSUME_TAC); + (EXPAND_TAC "f3" THEN REWRITE_TAC[REAL_POW_DIV]); + + (SUBGOAL_THEN `&0 <= ((y1 + x) + y2 - x + &2) * ((y1 + x) + y2 - x - &2) * + (y2 - x + &2 - (y1 + x)) * (&2 + (y1 + x) - (y2 - x))` ASSUME_TAC); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`)); + (MP_TAC (ASSUME `x:real IN s`) THEN ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `sqrt (((y1 + x) + y2 - x + &2) * ((y1 + x) + y2 - x - &2) * + (y2 - x + &2 - (y1 + x)) * (&2 + (y1 + x) - (y2 - x))) pow 2 = f1 x` + ASSUME_TAC); + (EXPAND_TAC "f1" THEN ASM_SIMP_TAC [SQRT_POW_2]); + + (PURE_ONCE_ASM_REWRITE_TAC[]); + (ONCE_ASM_REWRITE_TAC[GSYM REAL_INV_DIV]); + (AP_TERM_TAC); + (ONCE_ASM_REWRITE_TAC[REAL_INV_DIV] THEN PURE_ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (REAL_ARITH `&1 = x - y ==> &1 + y = x `)); + (REWRITE_TAC [REAL_ARITH `x / y - z / y = (x - z) / y`]); + (REWRITE_TAC[REAL_ARITH `&4 * ((y1 + x) * (y2 - x)) pow 2 - + (&2 * &2 - (y1 + x) * (y1 + x) - (y2 - x) * (y2 - x)) pow 2 = + (y1 + y2 + &2) * (y1 + y2 - &2) * (y2 - &2 * x + &2 - y1) * + (&2 + y1 + &2 * x - y2)`]); + (MATCH_MP_TAC (GSYM REAL_DIV_REFL)); + (REWRITE_TAC[GSYM (ASSUME `f1 x = (y1 + y2 + &2) * (y1 + y2 - &2) * + (y2 - &2 * x + &2 - y1) * (&2 + y1 + &2 * x - y2)`)]); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(&0 = a)`)); + (MP_TAC (ASSUME `x:real IN s`) THEN EXPAND_TAC "f1" THEN ASM_REWRITE_TAC[]); + +(* ========================================================================== *) + + (SUBGOAL_THEN `(&2 * (y2 - y1 - &2 * x)) * f2 x - h x * f2' = + &4 * (y1 + x) * (y2 - x) * (y2 - y1 - &2 * x) * + ((y2 + y1) pow 2 - &4) / f2 x` ASSUME_TAC); + (ABBREV_TAC `X = (&2 * (y2 - y1 - &2 * x)) * f2 x - h x * f2'`); + (REWRITE_TAC[REAL_ARITH `x * y / z = (x * y) / z`]); + (ABBREV_TAC `Y = &4 * (y1 + x) * (y2 - x) * (y2 - y1 - &2 * x) * + ((y2 + y1) pow 2 - &4)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + + (SUBGOAL_THEN `Y / f2 (x:real) = X <=> Y = X * f2 x` ASSUME_TAC); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (REPLICATE_TAC 2 (ONCE_ASM_REWRITE_TAC[]) THEN MATCH_MP_TAC SQRT_POS_LT); + (EXPAND_TAC "f1" THEN MP_TAC (ASSUME `x:real IN s`) THEN ASM_REWRITE_TAC[]); + + (ONCE_ASM_REWRITE_TAC[]); + (EXPAND_TAC "X" THEN EXPAND_TAC "Y"); + (EXPAND_TAC "f2'" THEN EXPAND_TAC "h" THEN EXPAND_TAC "g2'"); + (ONCE_REWRITE_TAC[REAL_ARITH `(a - b) * c = a * c - b * c`]); + + (SUBGOAL_THEN `inv (&2 * sqrt (f1 x)) * f2 (x:real) = &1 / &2` ASSUME_TAC); + (REWRITE_TAC[ASSUME `f2 = (\t:real. sqrt (f1 t))`]); + (ONCE_REWRITE_TAC[REAL_ARITH `a * sqrt b = (a * (&2 * sqrt b)) / &2`]); + (AP_THM_TAC THEN AP_TERM_TAC); + (MATCH_MP_TAC REAL_MUL_LINV); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`)); + (MATCH_MP_TAC REAL_LT_MUL); + (REWRITE_TAC[REAL_ARITH `&0 < &2`]); + (MATCH_MP_TAC SQRT_POS_LT); + (EXPAND_TAC "f1" THEN MP_TAC (ASSUME `x:real IN s`) THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[REAL_ARITH `(a * b * c) * d = (a * b) * c * d`]); + (PURE_REWRITE_TAC[ASSUME `inv (&2 * sqrt (f1 x)) * f2 (x:real) = &1 / &2`]); + (REWRITE_TAC[REAL_ARITH `(a * f2 x) * f2 x = a * (f2 (x:real) pow 2)`]); + + (SUBGOAL_THEN `f2 (x:real) pow 2 = f1 x` ASSUME_TAC); + (REWRITE_TAC [ASSUME `f2 = (\t:real. sqrt (f1 t))`]); + (MATCH_MP_TAC SQRT_POW_2); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`)); + (EXPAND_TAC "f1" THEN MP_TAC (ASSUME `x:real IN s`) THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ASSUME `f2 (x:real) pow 2 = f1 x`]); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "f1'" THEN REAL_ARITH_TAC); + + (SUBGOAL_THEN + `f3' * inv (&1 + f3 x pow 2) = + (y2 - y1 - &2 * x) * ((y2 + y1) pow 2 - &4) / ((y1 + x) * (y2 - x) * f2 x)` ASSUME_TAC); + (EXPAND_TAC "f3'"); + (REWRITE_TAC[ASSUME `inv (&1 + f3 x pow 2) = + f1 x / (&4 * ((y1 + x) * (y2 - x)) pow 2)`]); + (REWRITE_TAC[ASSUME + `(&2 * (y2 - y1 - &2 * x)) * f2 x - h x * f2' = &4 * (y1 + x) * (y2 - x) * + (y2 - y1 - &2 * x) * ((y2 + y1) pow 2 - &4) / f2 x`]); + + (SUBGOAL_THEN `f2 (x:real) pow 2 = f1 x` ASSUME_TAC); + (REWRITE_TAC [ASSUME `f2 = (\t:real. sqrt (f1 t))`]); + (MATCH_MP_TAC SQRT_POW_2); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`)); + (EXPAND_TAC "f1" THEN MP_TAC (ASSUME `x:real IN s`) THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `f2 (x:real) pow 2 = f1 x`]); + + (ONCE_REWRITE_TAC [REAL_ARITH `a / b * c / d = (a / d) * c / b`]); + (MATCH_MP_TAC (MESON[REAL_MUL_RID] `a = &1 /\ x = y ==> x * a = y`)); + STRIP_TAC; + + (MATCH_MP_TAC REAL_DIV_REFL); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`)); + (EXPAND_TAC "f1" THEN MP_TAC (ASSUME `x:real IN s`) THEN ASM_REWRITE_TAC[]); + + (ABBREV_TAC `X = (&4 * (y1 + x) * (y2 - x) * (y2 - y1 - &2 * x) * + ((y2 + y1) pow 2 - &4) / f2 x)`); + (ABBREV_TAC `Y = (y2 - y1 - &2 * x) * ((y2 + y1) pow 2 - &4) / + ((y1 + x) * (y2 - x) * f2 x)`); + (ABBREV_TAC `Z = (&4 * ((y1 + x) * (y2 - x)) pow 2)`); + + (SUBGOAL_THEN `X / Z = Y <=> X = Y * Z` ASSUME_TAC); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (EXPAND_TAC "Z" THEN MATCH_MP_TAC REAL_LT_MUL); + (REWRITE_TAC[REAL_ARITH `&0 < &4`] THEN MATCH_MP_TAC REAL_POW_LT); + (MATCH_MP_TAC REAL_LT_MUL); + (MP_TAC (ASSUME `x:real IN s`)); + (PURE_REWRITE_TAC[ASSUME + `s = {t | y2 - &2 - y1 < &2 * t /\ &2 * t < y2 + &2 - y1}`]); + (REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (MATCH_MP_TAC (REAL_ARITH `&0 <= y1 + &2 * x /\ &2 <= y1 ==> &0 < y1 + x`)); + (ASM_REWRITE_TAC[] THEN ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC (REAL_ARITH `&2 * x < &2 * y ==> &0 < y - x`)); + (MATCH_MP_TAC (REAL_ARITH + `a < y2 + &2 - y1 /\ y2 + &2 - y1 <= b ==> a < b`)); + (ASM_REWRITE_TAC[] THEN ASM_REAL_ARITH_TAC); + + (ONCE_ASM_REWRITE_TAC[]); + (EXPAND_TAC "X" THEN EXPAND_TAC "Y" THEN EXPAND_TAC "Z"); + (REWRITE_TAC [REAL_ARITH `a * b / c = (a * b) / c`]); + (REWRITE_TAC[REAL_ARITH `((y2 - y1 - &2 * x) * ((y2 + y1) pow 2 - &4)) / + ((y1 + x) * (y2 - x) * f2 x) * &4 * ((y1 + x) * (y2 - x)) pow 2 = + (&4 * (y1 + x) * (y2 - x) * (y2 - y1 - &2 * x) * ((y2 + y1) pow 2 - &4)) * + ((y1 + x) * (y2 - x)) / (f2 x * (y1 + x) * (y2 - x))`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC REDUCE_WITH_DIV_Euler_lemma); + CONJ_TAC; + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~ (a = &0)`)); + (MATCH_MP_TAC REAL_LT_MUL THEN MP_TAC (ASSUME `x:real IN s`)); + (PURE_REWRITE_TAC[ASSUME + `s = {t | y2 - &2 - y1 < &2 * t /\ &2 * t < y2 + &2 - y1}`]); + (REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (MATCH_MP_TAC (REAL_ARITH `&0 <= y1 + &2 * x /\ &2 <= y1 ==> &0 < y1 + x`)); + (ASM_REWRITE_TAC[] THEN ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC (REAL_ARITH `&2 * x < &2 * y ==> &0 < y - x`)); + (MATCH_MP_TAC (REAL_ARITH + `a < y2 + &2 - y1 /\ y2 + &2 - y1 <= b ==> a < b`)); + (ASM_REWRITE_TAC[] THEN ASM_REAL_ARITH_TAC); + + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~ (a = &0)`)); + (ONCE_ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[]); + (MATCH_MP_TAC SQRT_POS_LT); + (EXPAND_TAC "f1" THEN MP_TAC (ASSUME `x:real IN s`) THEN ASM_REWRITE_TAC[]); + +(* ========================================================================== *) + + (SUBGOAL_THEN + `(F1 has_real_derivative ((y2 - y1 - &2 * x) * + ((y2 + y1) pow 2 - &4)) / ((y1 + x) * (y2 - x) * f2 x)) + (atreal x within s)` ASSUME_TAC); + (ONCE_REWRITE_TAC[REAL_ARITH `(a * b) / c = a * b / c`]); + (ASM_MESON_TAC[]); + + (SUBGOAL_THEN + `(F1 has_real_derivative g' x) (atreal x within s)` ASSUME_TAC); + (REWRITE_TAC[ASSUME + `g' = (\x. ((y2 - y1 - &2 * x) * ((y2 + y1) pow 2 - &4)) / + ((y1 + x) * (y2 - x) * + sqrt + ((y1 + y2 + &2) * + (y1 + y2 - &2) * + (y2 - &2 * x + &2 - y1) * + (&2 + y1 + &2 * x - y2))))`]); + (FIRST_X_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]); + + (ABBREV_TAC `F2 = (\x:real. pi / &2 + F1 x)`); + (ABBREV_TAC `pi_2 = (\x:real. pi / &2 )`); + + (SUBGOAL_THEN `(F2 has_real_derivative g' x)(atreal x within s)` MP_TAC); + (SUBGOAL_THEN `F2 = (\x:real. pi_2 x + F1 x)` ASSUME_TAC); + (EXPAND_TAC "F2" THEN EXPAND_TAC "F1" THEN EXPAND_TAC "pi_2"); + (REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `F2 = (\x:real. pi_2 x + F1 x)`]); + (SUBGOAL_THEN `((\x. pi_2 x + F1 x) has_real_derivative &0 + g' x) + (atreal x within s)` ASSUME_TAC); + + (SUBGOAL_THEN `(pi_2 has_real_derivative (&0)) (atreal x within s)` MP_TAC); + (EXPAND_TAC "pi_2" THEN REAL_DIFF_TAC THEN REAL_ARITH_TAC); + + (MP_TAC (ASSUME `(F1 has_real_derivative g' x) (atreal x within s)`)); + (REWRITE_TAC[MESON[] `(a ==> b ==> c) <=> (b /\ a ==> c)`]); + (MESON_TAC[HAS_REAL_DERIVATIVE_ADD]); + (ASM_MESON_TAC[REAL_ARITH `&0 + a = a`]); + + (SUBGOAL_THEN `(!x':real. (x':real) IN s /\ abs (x' - x) < &1 ==> + (F2:real -> real) x' = g x')` MP_TAC); + (REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN EXPAND_TAC "F2" THEN EXPAND_TAC "F1"); + (MATCH_MP_TAC ATN_UPS_X_BREAKDOWN1); + (MP_TAC (ASSUME `x':real IN s`) THEN ASM_REWRITE_TAC[]); + + (MP_TAC (ASSUME `x:real IN s`)); + (MP_TAC (REAL_ARITH `&0 < &1`)); + (MESON_TAC[HAS_REAL_DERIVATIVE_TRANSFORM_WITHIN])]);; + +(* ========================================================================== *) +(* SECOND LEMMA *) +(* ========================================================================== *) + +let compute_two_second = prove_by_refinement ( + `!y1 y2 s hz g x. + &1 <= hz /\ hz < &2 /\ + &2 <= y1 /\ y1 <= &2 * hz /\ + &2 <= y2 /\ y2 <= &2 * hz /\ + s = {t | y2 - &2 - y1 < &2 * t /\ &2 * t < y2 + &2 - y1} /\ + g = + (\t. ((y2 - y1 - &2 * t) * ((y2 + y1) pow 2 - &4)) / + ((y1 + t) * + (y2 - t) * + sqrt + ((y1 + y2 + &2) * + (y1 + y2 - &2) * + (y2 - &2 * t + &2 - y1) * + (&2 + y1 + &2 * t - y2)))) + ==> (g has_real_derivative + (sqrt (ups_x (y1 pow 2) (y2 pow 2) (&4)) * + (-- &4 * y1 pow 2 + + y1 pow 4 - &4 * y1 pow 3 * y2 - &4 * y2 pow 2 + + &6 * y1 pow 2 * y2 pow 2 - &4 * y1 * y2 pow 3 + + y2 pow 4)) / + (y1 pow 2 * y2 pow 2 * (&4 - (y1 - y2) pow 2) pow 2)) + (atreal (&0) within s)`, + +[(REWRITE_TAC[REAL_ARITH `a * b * sqrt c = (a * b) * sqrt c`]); + (REPEAT STRIP_TAC); + + (SUBGOAL_THEN `&0 IN s` ASSUME_TAC); + (PURE_ASM_REWRITE_TAC[IN_ELIM_THM; REAL_MUL_RZERO]); + ASM_REAL_ARITH_TAC; + +(* ========================================================================== *) + + (SUBGOAL_THEN `!t. t IN s ==> &0 < (y1 + y2 + &2) * (y1 + y2 - &2) * + (y2 - &2 * t + &2 - y1) * (&2 + y1 + &2 * t - y2)` + ASSUME_TAC); + + (GEN_TAC THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC); + + (SUBGOAL_THEN `&0 < y1 + y2 - &2 /\ &0 < y1 + y2 + &2 /\ + &0 < y2 - &2 * t + &2 - y1 /\ &0 < &2 + y1 + &2 * t - y2` ASSUME_TAC); + ASM_REAL_ARITH_TAC; + (ASM_MESON_TAC[REAL_LT_MUL]); + +(* -------------------------------------------------------------------------- *) + +(ABBREV_TAC `f1 = (\t. (y2 - y1 - &2 * t) * ((y2 + y1) pow 2 - &4))`); +(ABBREV_TAC `f2 = (\t. (y1 + y2 + &2) * (y1 + y2 - &2) * + (y2 - &2 * t + &2 - y1) * (&2 + y1 + &2 * t - y2))`); +(ABBREV_TAC `f3 = (\t:real. sqrt (f2 t))`); +(ABBREV_TAC `f4 = (\t:real. (y1 + t) * (y2 - t))`); +(ABBREV_TAC `f5 = (\t:real. f4 t * f3 t )`); + +(SUBGOAL_THEN `&0 < f2 (&0)` ASSUME_TAC); +(EXPAND_TAC "f2" THEN MP_TAC (ASSUME `((&0):real) IN s`)); +(ASM_REWRITE_TAC[]); + +(SUBGOAL_THEN `(f1 has_real_derivative -- &2 * ((y2 + y1) pow 2 - &4)) + (atreal (&0) within s)` ASSUME_TAC); +(EXPAND_TAC "f1" THEN REAL_DIFF_TAC); + REAL_ARITH_TAC; + +(ABBREV_TAC `f2' = &4 * (y2 - y1) * ((y2 + y1) pow 2 - &4)`); +(ABBREV_TAC `P ={x| &0 < x}`); +(ABBREV_TAC `g3' = (\x. inv (&2 * sqrt x))`); +(ABBREV_TAC `f3' = f2' * g3' ((f2:real->real) (&0))`); + + (SUBGOAL_THEN + `(f3 has_real_derivative f3') (atreal (&0) within s)` ASSUME_TAC); + (EXPAND_TAC "f3'" THEN EXPAND_TAC "f3"); + + (SUBGOAL_THEN + `(f2 has_real_derivative f2') (atreal (&0) within s) /\ P (f2 (&0))` + MP_TAC); + STRIP_TAC; + + (EXPAND_TAC "f2" THEN EXPAND_TAC "f2'"); + (REAL_DIFF_TAC THEN REWRITE_TAC[POW_2] THEN REAL_ARITH_TAC); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN_ELIM_THM]); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `!x. P x ==> (sqrt has_real_derivative (g3':real->real) x) (atreal x)` + MP_TAC); + (EXPAND_TAC "g3'" THEN REWRITE_TAC[BETA_THM]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN_ELIM_THM]); + (REWRITE_TAC[HAS_REAL_DERIVATIVE_SQRT]); + +(REWRITE_TAC[HAS_REAL_DERIVATIVE_CHAIN2]); + +(* ========================================================================== *) + +(SUBGOAL_THEN `(f5 has_real_derivative f4 (&0) * f3' + (y2 - y1) * f3 (&0)) + (atreal (&0) within s)` ASSUME_TAC); +(EXPAND_TAC "f5"); + +(SUBGOAL_THEN + `(f4 has_real_derivative y2 - y1) (atreal (&0) within s) /\ + (f3 has_real_derivative f3') (atreal (&0) within s)` MP_TAC); +(ASM_REWRITE_TAC[]); +(EXPAND_TAC "f4" THEN REAL_DIFF_TAC THEN REAL_ARITH_TAC); + +(REWRITE_TAC[HAS_REAL_DERIVATIVE_MUL_WITHIN]); + +(* ========================================================================= *) +(* Derivative of f1 / f5 *) +(* ========================================================================= *) + +(SUBGOAL_THEN `g = (\t:real. f1 t / f5 t)` ASSUME_TAC); +(ASM_REWRITE_TAC[]); +(EXPAND_TAC "f5" THEN EXPAND_TAC "f1"); +(EXPAND_TAC "f4" THEN EXPAND_TAC "f3" THEN EXPAND_TAC "f2"); +(REWRITE_TAC[]); + +(REWRITE_TAC[ASSUME `g = (\t:real. f1 t / f5 t)`] THEN DEL_TAC); + +(SUBGOAL_THEN `((\t. f1 t / f5 t) has_real_derivative + ((-- &2 * ((y2 + y1) pow 2 - &4)) * f5 (&0) - f1 (&0) * + (f4 (&0) * f3' + (y2 - y1) * f3 (&0))) / + f5 (&0) pow 2) (atreal (&0) within s)` ASSUME_TAC); + +(SUBGOAL_THEN + `(f1 has_real_derivative -- &2 * ((y2 + y1) pow 2 - &4)) + (atreal (&0) within s) /\ + (f5 has_real_derivative f4 (&0) * f3' + (y2 - y1) * f3 (&0)) + (atreal (&0) within s) /\ ~(f5 (&0) = &0)` MP_TAC); + +(ASM_REWRITE_TAC[]); +(MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`)); +(EXPAND_TAC "f5" THEN MATCH_MP_TAC REAL_LT_MUL); + STRIP_TAC; + +(EXPAND_TAC "f4" THEN MATCH_MP_TAC REAL_LT_MUL THEN ASM_REAL_ARITH_TAC); +(EXPAND_TAC "f3" THEN MATCH_MP_TAC SQRT_POS_LT THEN ASM_REWRITE_TAC[]); + +(REWRITE_TAC[HAS_REAL_DERIVATIVE_DIV_WITHIN]); + +(* ========================================================================= *) + +(SUBGOAL_THEN +`((-- &2 * ((y2 + y1) pow 2 - &4)) * f5 (&0) - + f1 (&0) * (f4 (&0) * f3' + (y2 - y1) * f3 (&0))) / + f5 (&0) pow 2 = + (sqrt (ups_x (y1 pow 2) (y2 pow 2) (&4)) * + (-- &4 * y1 pow 2 + + y1 pow 4 - &4 * y1 pow 3 * y2 - &4 * y2 pow 2 + + &6 * y1 pow 2 * y2 pow 2 - &4 * y1 * y2 pow 3 + + y2 pow 4)) / + (y1 pow 2 * y2 pow 2 * (&4 - (y1 - y2) pow 2) pow 2)` ASSUME_TAC); + +(REWRITE_WITH `ups_x (y1 pow 2) (y2 pow 2) (&4) = f2 (&0)`); +(REWRITE_TAC[ups_x] THEN EXPAND_TAC "f2"); + REAL_ARITH_TAC; + +(EXPAND_TAC "f5"); + +(SUBGOAL_THEN `f4 (&0) = y1 * y2` ASSUME_TAC); +(EXPAND_TAC "f4" THEN REAL_ARITH_TAC); +(ASM_REWRITE_TAC[]); + + +(REWRITE_TAC[REAL_ARITH `a - b * (c + d) = a - b * c - b * d`]); +(REWRITE_TAC[REAL_ARITH `(-- &2 * m) * n * x = ((-- &2 * m) * n) * x`]); +(REWRITE_TAC[REAL_ARITH `f1 (&0) * (y2 - y1) * f3 (&0) = + (f1 (&0) * (y2 - y1)) * f3 (&0)`]); +(REWRITE_TAC[REAL_ARITH `a * f3 (&0) - b - c * f3 (&0) = (a - c) * f3 (&0) - b`]); +(SUBGOAL_THEN + `((-- &2 * ((y2 + y1) pow 2 - &4)) * y1) * y2 - f1 (&0) * (y2 - y1) = + -- (y1 pow 2 + y2 pow 2) * ((y2 + y1) pow 2 - &4)` ASSUME_TAC); +(EXPAND_TAC "f1" THEN REAL_ARITH_TAC); + +(ASM_REWRITE_TAC[]); +(EXPAND_TAC "f3'" THEN EXPAND_TAC "g3'"); + +(SUBGOAL_THEN `sqrt (f2 (&0)) = f3 (&0)` ASSUME_TAC); +(EXPAND_TAC "f3" THEN REWRITE_TAC[]); +(REWRITE_TAC[ASSUME `sqrt (f2 (&0)) = f3 (&0)`]); + +(SUBGOAL_THEN +`(--(y1 pow 2 + y2 pow 2) * ((y2 + y1) pow 2 - &4)) * f3 (&0) - + f1 (&0) * (y1 * y2) * f2' * inv (&2 * f3 (&0)) = + ((--(y1 pow 2 + y2 pow 2) * ((y2 + y1) pow 2 - &4)) * f3 (&0) pow 2 - + f1 (&0) * (y1 * y2) * &2 * (y2 - y1) * ((y2 + y1) pow 2 - &4)) / + f3 (&0)` ASSUME_TAC); + +(PURE_ONCE_REWRITE_TAC[REAL_ARITH `(a - b) / c = a / c - b / c`]); +(MATCH_MP_TAC (REAL_ARITH `a = b /\ c = d ==> a - c = b - d`)); + STRIP_TAC; + +(REWRITE_TAC[REAL_POW_2; REAL_ARITH `(a * b * c) / d = (a * b) * c / d`]); +(MATCH_MP_TAC (MESON[REAL_MUL_RID] `a = &1 ==> b = b * a`)); +(MATCH_MP_TAC REAL_DIV_REFL); +(EXPAND_TAC "f3"); +(MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~ (a = &0)`)); +(MATCH_MP_TAC SQRT_POS_LT); +(ASM_REWRITE_TAC[]); + +(EXPAND_TAC "f2'"); +(REWRITE_TAC[REAL_ARITH + `f1 (&0) * (y1 * y2) * (&4 * (y2 - y1) * ((y2 + y1) pow 2 - &4)) * + inv (&2 * f3 (&0)) = + f1 (&0) * (y1 * y2) * &2 * (y2 - y1) * ((y2 + y1) pow 2 - &4) * &2 * + inv (&2 * f3 (&0))`]) ; +(ABBREV_TAC + `X = f1 (&0) * (y1 * y2) * &2 * (y2 - y1) * ((y2 + y1) pow 2 - &4) * &2 * + inv (&2 * f3 (&0))`); +(ABBREV_TAC + `Y = f1 (&0) * (y1 * y2) * &2 * (y2 - y1) * ((y2 + y1) pow 2 - &4)`); +(ABBREV_TAC `Z = (f3:real->real) (&0)`); + +(SUBGOAL_THEN `X = Y / Z <=> X * Z = Y` ASSUME_TAC); +(MATCH_MP_TAC REAL_EQ_RDIV_EQ THEN EXPAND_TAC "Z" THEN EXPAND_TAC "f3"); +(MATCH_MP_TAC SQRT_POS_LT THEN ASM_REWRITE_TAC[]); +(ASM_REWRITE_TAC[]); + +(EXPAND_TAC "X" THEN EXPAND_TAC "Y" THEN EXPAND_TAC "Z"); +(REWRITE_TAC[REAL_ARITH `(x1 * x2 * x3 * x4 * x5 * &2 * b) * c = + (x1 * x2 * x3 * x4 * x5) * (&2 * c) * b`]); +(MATCH_MP_TAC( MESON[REAL_MUL_RID] `a = &1 ==> b * a = b`)); +(MATCH_MP_TAC REAL_MUL_RINV); +(MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~ (a = &0)`)); +(MATCH_MP_TAC REAL_LT_MUL); +(REWRITE_TAC[REAL_ARITH `&0 < &2`]); +(EXPAND_TAC "f3" THEN MATCH_MP_TAC SQRT_POS_LT THEN ASM_REWRITE_TAC[]); + +(ASM_REWRITE_TAC[]); +(REWRITE_TAC[REAL_POW_MUL]); +(EXPAND_TAC "f3"); +(REWRITE_WITH `sqrt (f2 (&0)) pow 2 = f2 (&0)`); +(MATCH_MP_TAC SQRT_POW_2); +(MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`) THEN ASM_REWRITE_TAC[]); + +(REWRITE_TAC[REAL_ARITH `a / b / c = a / c / b`]); +(ABBREV_TAC `A = ((--(y1 pow 2 + y2 pow 2) * ((y2 + y1) pow 2 - &4)) * + f2 (&0) - f1 (&0) * (y1 * y2) * &2 * (y2 - y1) * ((y2 + y1) pow 2 - &4)) / + ((y1 pow 2 * y2 pow 2) * f2 (&0))`); +(ABBREV_TAC `B = (sqrt (f2 (&0)) * (-- &4 * y1 pow 2 + + y1 pow 4 - &4 * y1 pow 3 * y2 - &4 * y2 pow 2 + + &6 * y1 pow 2 * y2 pow 2 - &4 * y1 * y2 pow 3 + + y2 pow 4)) / + (y1 pow 2 * y2 pow 2 * (&4 - (y1 - y2) pow 2) pow 2)`); + +(SUBGOAL_THEN `A/ sqrt (f2 (&0)) = B <=> A = B * sqrt (f2 (&0))` ASSUME_TAC); +(MATCH_MP_TAC REAL_EQ_LDIV_EQ); +(MATCH_MP_TAC SQRT_POS_LT THEN ASM_REWRITE_TAC[]); +(ONCE_ASM_REWRITE_TAC[]); +(EXPAND_TAC "A" THEN EXPAND_TAC "B"); +(REWRITE_TAC[REAL_ARITH `(a * b) / c * d = (b * a * d) / c`]); +(ONCE_REWRITE_TAC[GSYM REAL_POW_2]); +(REWRITE_WITH `sqrt (f2 (&0)) pow 2 = f2 (&0)`); +(MATCH_MP_TAC SQRT_POW_2); +(MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`) THEN ASM_REWRITE_TAC[]); + + +(ABBREV_TAC `C = ((--(y1 pow 2 + y2 pow 2) * ((y2 + y1) pow 2 - &4)) * + f2 (&0) - f1 (&0) * (y1 * y2) * &2 * (y2 - y1) * ((y2 + y1) pow 2 - &4)) / + ((y1 pow 2 * y2 pow 2) * f2 (&0))`); +(ABBREV_TAC `D = ((-- &4 * y1 pow 2 + + y1 pow 4 - &4 * y1 pow 3 * y2 - &4 * y2 pow 2 + + &6 * y1 pow 2 * y2 pow 2 - &4 * y1 * y2 pow 3 + + y2 pow 4) * + f2 (&0))`); +(ABBREV_TAC `E = (y1 pow 2 * y2 pow 2 * (&4 - (y1 - y2) pow 2) pow 2)`); + + +(SUBGOAL_THEN `C = D / E <=> C * E = D` ASSUME_TAC); +(MATCH_MP_TAC REAL_EQ_RDIV_EQ); +(EXPAND_TAC "E"); +(MATCH_MP_TAC REAL_LT_MUL THEN STRIP_TAC); +(MATCH_MP_TAC REAL_POW_LT); +(ASM_SIMP_TAC[REAL_ARITH `&2 <= a ==> &0 < a`]); +(MATCH_MP_TAC REAL_LT_MUL THEN STRIP_TAC); +(MATCH_MP_TAC REAL_POW_LT); +(ASM_SIMP_TAC[REAL_ARITH `&2 <= a ==> &0 < a`]); +(MATCH_MP_TAC REAL_POW_LT); +(MATCH_MP_TAC (REAL_ARITH `b < a ==> &0 < a - b`)); +(SUBGOAL_THEN ` -- &2 < y1 - y2 /\ y1 - y2 < &2` ASSUME_TAC); +(ASM_REAL_ARITH_TAC); +(REWRITE_TAC[REAL_ARITH `&4 = (&2) pow 2`]); +(REWRITE_TAC[GSYM REAL_LT_SQUARE_ABS]); +(ASM_REAL_ARITH_TAC); + +(ONCE_ASM_REWRITE_TAC[]); +(EXPAND_TAC "C" THEN EXPAND_TAC "D" THEN EXPAND_TAC "E"); +(REWRITE_TAC[REAL_ARITH `a / b * c = (a * c) / b`]); + +(REWRITE_WITH `(((--(y1 pow 2 + y2 pow 2) * ((y2 + y1) pow 2 - &4)) * f2 (&0) - + f1 (&0) * (y1 * y2) * &2 * (y2 - y1) * ((y2 + y1) pow 2 - &4)) * + y1 pow 2 * + y2 pow 2 * + (&4 - (y1 - y2) pow 2) pow 2) = ((-- &4 * y1 pow 2 + + y1 pow 4 - &4 * y1 pow 3 * y2 - &4 * y2 pow 2 + + &6 * y1 pow 2 * y2 pow 2 - &4 * y1 * y2 pow 3 + + y2 pow 4) * + f2 (&0)) * ((y1 pow 2 * y2 pow 2) * f2 (&0))`); + +(EXPAND_TAC "f2" THEN EXPAND_TAC "f1"); +(REAL_ARITH_TAC); + +(ONCE_REWRITE_TAC[REAL_ARITH `(a * b) / c = a * b / c`]); +(MATCH_MP_TAC (MESON [REAL_MUL_RID] `a = &1 ==> b * a = b`)); +(MATCH_MP_TAC REAL_DIV_REFL); +(MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~ (a = &0)`)); + + +(MATCH_MP_TAC REAL_LT_MUL THEN STRIP_TAC); +(MATCH_MP_TAC REAL_LT_MUL THEN STRIP_TAC); +(MATCH_MP_TAC REAL_POW_LT); +(ASM_SIMP_TAC[REAL_ARITH `&2 <= a ==> &0 < a`]); +(MATCH_MP_TAC REAL_POW_LT); +(ASM_SIMP_TAC[REAL_ARITH `&2 <= a ==> &0 < a`]); +(ASM_REWRITE_TAC[]); + +(ASM_MESON_TAC[])]);; + +(* ========================================================================= *) + +let COMPUTE_DERIVATIVE_TWO = prove_by_refinement ( + `!y1 y2 s hz g x f. + &1 <= hz /\ hz < &2 /\ &2 <= y1 /\ y1 <= &2 * hz /\ + &2 <= y2 /\ y2 <= &2 * hz /\ + s = {t | y2 - &2 - y1 < &2 * t /\ &2 * t < y2 + &2 - y1} /\ + g = (\t. arclength (y1 + t) (y2 - t) (&2)) /\ x IN s /\ + g' = + (\t. ((y2 - y1 - &2 * t) * ((y2 + y1) pow 2 - &4)) / + ((y1 + t) * + (y2 - t) * + sqrt + ((y1 + y2 + &2) * + (y1 + y2 - &2) * + (y2 - &2 * t + &2 - y1) * + (&2 + y1 + &2 * t - y2)))) +==> (!x. x IN s ==> (g has_real_derivative g' x) (atreal x within s)) /\ + (g' has_real_derivative + (sqrt (ups_x (y1 pow 2) (y2 pow 2) (&4)) * + (-- &4 * y1 pow 2 + + y1 pow 4 - &4 * y1 pow 3 * y2 - &4 * y2 pow 2 + + &6 * y1 pow 2 * y2 pow 2 - &4 * y1 * y2 pow 3 + + y2 pow 4)) / + (y1 pow 2 * y2 pow 2 * (&4 - (y1 - y2) pow 2) pow 2)) + (atreal (&0) within s)`, + +[(REPEAT STRIP_TAC); + (ASM_MESON_TAC[compute_two_first]); + (ASM_MESON_TAC[compute_two_second])]);; + + +end;; diff --git a/text_formalization/nonlinear/formal_tests/hminus.hl b/text_formalization/nonlinear/formal_tests/hminus.hl new file mode 100644 index 0000000..0810060 --- /dev/null +++ b/text_formalization/nonlinear/formal_tests/hminus.hl @@ -0,0 +1,225 @@ +(* Gives an interval approximation of hminus *) +(* hminus ~ 1.2317544220903043901 *) + +(* load_path := "/mnt/Repository/formal_ineqs" :: !load_path;; *) + +(* tested with base = 100 *) +needs "verifier/m_verifier_main.hl";; + +(* module Hminus = struct *) + +open M_verifier_main;; + + +let lmfun_cond_le = (UNDISCH_ALL o prove)(`x <= h0 ==> lmfun x = (h0 - x) / (h0 - &1)`, + REWRITE_TAC[Sphere.lmfun] THEN REAL_ARITH_TAC);; + +let lmfun_cond_ge = (UNDISCH_ALL o prove)(`h0 <= x ==> lmfun x = &0`, + ONCE_REWRITE_TAC[REAL_ARITH `a <= b <=> ~(b <= a) \/ a = b`] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[Sphere.lmfun] THEN + REAL_ARITH_TAC);; + +let eq_tm = `marchal_quartic x - lmfun x`;; +let eq_th1, eq_th2 = + let ths = [Sphere.marchal_quartic; Sphere.h0; Sphere.hplus] in + REWRITE_CONV (lmfun_cond_le :: ths) eq_tm, + REWRITE_CONV (REAL_SUB_RZERO :: lmfun_cond_ge :: ths) eq_tm;; + +let eq_tm1 = (rand o concl) eq_th1 and + eq_tm2 = (rand o concl) eq_th2;; + +let ineq1_concl = mk_binary "real_lt" (eq_tm1, `&0`) and + ineq2_concl = mk_binary "real_lt" (`&0`, eq_tm1) and + ineq3_concl = mk_binary "real_lt" (`&0`, eq_tm2);; + +(* A better approximation cannot be achieved directly *) +let bounds1 = `#1.2 <= x /\ x <= #1.2317544220903043901` and + bounds2 = `#1.2317544220903047 <= x /\ x <= #1.26` and + bounds3 = `#1.26 <= x /\ x <= #1.3`;; + +let ineq1_tm = mk_imp (bounds1, ineq1_concl) and + ineq2_tm = mk_imp (bounds2, ineq2_concl) and + ineq3_tm = mk_imp (bounds3, ineq3_concl);; + +let ineq1_th, _ = verify_ineq default_params 12 ineq1_tm;; +let ineq2_th, _ = verify_ineq default_params 12 ineq2_tm;; +let ineq3_th, _ = verify_ineq default_params 12 ineq3_tm;; + +let ineq_th = prove(`(#1.2 <= x /\ x < #1.3) /\ + ~(#1.2317544220903043901 <= x /\ x <= #1.2317544220903047) ==> + ~(marchal_quartic x = lmfun x)`, + REWRITE_TAC[DE_MORGAN_THM; REAL_NOT_LE] THEN + ONCE_REWRITE_TAC[REAL_ARITH `a = b <=> a - b = &0`] THEN + STRIP_TAC THENL [ + MP_TAC (SPEC_ALL ineq1_th) THEN ASM_SIMP_TAC[REAL_LT_IMP_LE] THEN + MP_TAC (DISCH_ALL eq_th1) THEN REWRITE_TAC[Sphere.h0] THEN ANTS_TAC THENL [ + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + DISJ_CASES_TAC (REAL_ARITH `x <= #1.26 \/ #1.26 <= x`) THENL [ + MP_TAC (SPEC_ALL ineq2_th) THEN ASM_SIMP_TAC[REAL_LT_IMP_LE] THEN + MP_TAC (DISCH_ALL eq_th1) THEN ASM_REWRITE_TAC[Sphere.h0] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + MP_TAC (SPEC_ALL ineq3_th) THEN ASM_SIMP_TAC[REAL_LT_IMP_LE] THEN + MP_TAC (DISCH_ALL eq_th2) THEN ASM_REWRITE_TAC[Sphere.h0] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + REAL_ARITH_TAC);; + + +let marchal_quartic_continuous_at = prove(`!x. marchal_quartic real_continuous atreal x`, + GEN_TAC THEN + new_rewrite [] [`marchal_quartic`] (GSYM ETA_AX) THEN + PURE_REWRITE_TAC[Sphere.marchal_quartic] THEN + MATCH_MP_TAC REAL_CONTINUOUS_MUL THEN CONJ_TAC THENL [ + MATCH_MP_TAC REAL_CONTINUOUS_SUB THEN + REWRITE_TAC[REAL_CONTINUOUS_CONST; REAL_CONTINUOUS_AT_ID]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_CONTINUOUS_MUL THEN CONJ_TAC THENL [ + MATCH_MP_TAC REAL_CONTINUOUS_SUB THEN + REWRITE_TAC[REAL_CONTINUOUS_CONST; REAL_CONTINUOUS_AT_ID]; + ALL_TAC + ] THEN + REWRITE_TAC[real_div] THEN MATCH_MP_TAC REAL_CONTINUOUS_MUL THEN + REWRITE_TAC[REAL_CONTINUOUS_CONST] THEN + MATCH_MP_TAC REAL_CONTINUOUS_ADD THEN + REWRITE_TAC[REAL_CONTINUOUS_CONST] THEN + MATCH_MP_TAC REAL_CONTINUOUS_SUB THEN CONJ_TAC THENL [ + MATCH_MP_TAC REAL_CONTINUOUS_LMUL THEN + MATCH_MP_TAC REAL_CONTINUOUS_POW THEN + REWRITE_TAC[REAL_CONTINUOUS_AT_ID]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_CONTINUOUS_LMUL THEN + REWRITE_TAC[REAL_CONTINUOUS_AT_ID]);; + +(* Lemma piecewise_real_continuous *) +let piecewise_real_continuous = section_proof ["a";"b";"t";"f1";"f2";"f"] +`f1 real_continuous_on (real_interval [a,t]) /\ f2 real_continuous_on (real_interval [t,b]) /\ + f1 t = f2 t /\ f = (\x. if x <= t then f1 x else f2 x) ==> + f real_continuous_on (real_interval [a,b])` +[ + (((repeat_tactic 1 9 (((use_arg_then "real_continuous_on")(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["f1_cont"])) THEN (case THEN (move ["f2_cont"])) THEN (case THEN (move ["f12_eq"])) THEN (move ["f_eq"]) THEN (move ["x"]) THEN (move ["e"]) THEN (case THEN ((move ["x_in"]) THEN (move ["e_gt0"])))); + ((THENL) (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `x < t \/ t < x \/ x = t`))) (disch_tac [])) THEN case) [(move ["h"]); ALL_TAC]); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "f1_cont") (fun fst_arg -> (use_arg_then "e_gt0") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then "REAL_LT_IMP_LE") (fun fst_arg -> (use_arg_then "h") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then "x_in")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))) THEN ALL_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d_gt0"])) THEN (move ["ineq"]))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`min d (t - x)`))) (term_tac exists_tac)) THEN (split_tac)) ((((use_arg_then "h") (disch_tac [])) THEN (clear_assumption "h") THEN ((use_arg_then "d_gt0") (disch_tac [])) THEN (clear_assumption "d_gt0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["y_ineq"]) THEN (move ["xy_lt"])))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`y < t`))) (term_tac (have_gen_tac [](move ["y_lt"])))) ((((use_arg_then "h") (disch_tac [])) THEN (clear_assumption "h") THEN ((use_arg_then "xy_lt") (disch_tac [])) THEN (clear_assumption "xy_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then "f_eq")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_LT_IMP_LE")(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then "ineq")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xy_lt") (disch_tac [])) THEN (clear_assumption "xy_lt") THEN ((use_arg_then "y_lt") (disch_tac [])) THEN (clear_assumption "y_lt") THEN ((use_arg_then "y_ineq") (disch_tac [])) THEN (clear_assumption "y_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (case THEN (move ["h"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "f2_cont") (fun fst_arg -> (use_arg_then "e_gt0") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then "REAL_LT_IMP_LE") (fun fst_arg -> (use_arg_then "h") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then "x_in")(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))) THEN ALL_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d_gt0"])) THEN (move ["ineq"]))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`min d (x - t)`))) (term_tac exists_tac)) THEN (split_tac)) ((((use_arg_then "h") (disch_tac [])) THEN (clear_assumption "h") THEN ((use_arg_then "d_gt0") (disch_tac [])) THEN (clear_assumption "d_gt0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["y_ineq"]) THEN (move ["xy_lt"])))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`t < y`))) (term_tac (have_gen_tac [](move ["y_lt"])))) ((((use_arg_then "h") (disch_tac [])) THEN (clear_assumption "h") THEN ((use_arg_then "xy_lt") (disch_tac [])) THEN (clear_assumption "xy_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then "f_eq")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then "REAL_NOT_LT")(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then "y_lt")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "h")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "ineq")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xy_lt") (disch_tac [])) THEN (clear_assumption "xy_lt") THEN ((use_arg_then "y_lt") (disch_tac [])) THEN (clear_assumption "y_lt") THEN ((use_arg_then "y_ineq") (disch_tac [])) THEN (clear_assumption "y_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then "f2_cont") (fun fst_arg -> (use_arg_then "t") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "e_gt0") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then "f1_cont") (fun fst_arg -> (use_arg_then "t") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "e_gt0") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then "h")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then "x_in")(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + (BETA_TAC THEN (case THEN (move ["d1"])) THEN (case THEN (move ["d1_gt0"])) THEN (move ["ineq1"]) THEN (case THEN (move ["d2"])) THEN (case THEN (move ["d2_gt0"])) THEN (move ["ineq2"])); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`min d1 d2`))) (term_tac exists_tac)) THEN (split_tac)) ((((use_arg_then "d2_gt0") (disch_tac [])) THEN (clear_assumption "d2_gt0") THEN ((use_arg_then "d1_gt0") (disch_tac [])) THEN (clear_assumption "d1_gt0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["y_ineq"]) THEN (move ["xy_lt"])))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then "REAL_LET_TOTAL") (fun fst_arg -> (use_arg_then "y") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "x") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["xy_ineq"])); + (((((use_arg_then "f_eq")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "h")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xy_ineq")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "ineq1")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xy_ineq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "y_ineq")(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xy_lt") (disch_tac [])) THEN (clear_assumption "xy_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then "f_eq")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "h")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "REAL_LE_REFL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_NOT_LT")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "xy_ineq")(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then "h")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "f12_eq")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "h")(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then "ineq2")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "xy_lt") (disch_tac [])) THEN (clear_assumption "xy_lt") THEN ((use_arg_then "y_ineq") (disch_tac [])) THEN (clear_assumption "y_ineq") THEN ((use_arg_then "xy_ineq") (disch_tac [])) THEN (clear_assumption "xy_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma piecewise_real_continuous_univ *) +let piecewise_real_continuous_univ = section_proof ["t";"f1";"f2";"f"] +`f1 real_continuous_on UNIV /\ f2 real_continuous_on UNIV /\ f1 t = f2 t /\ + f = (\x. if x <= t then f1 x else f2 x) ==> + f real_continuous_on UNIV` +[ + (BETA_TAC THEN (case THEN (move ["f1_cont"])) THEN (case THEN (move ["f2_con"])) THEN (case THEN (move ["f12_eq"])) THEN (move ["f_eq"])); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`!a b. f real_continuous_on real_interval (a,b)`))) (term_tac (have_gen_tac [](move ["cont_int"]))))); + (((((use_arg_then "REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_OPEN_UNIV")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["x"]) THEN (move ["_"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then "cont_int") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x - &1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x + &1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((((use_arg_then "REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT")(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then "REAL_OPEN_REAL_INTERVAL")(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then "IN_REAL_INTERVAL")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((BETA_TAC THEN (move ["a"]) THEN (move ["b"])) THEN (((use_arg_then "REAL_CONTINUOUS_ON_SUBSET") (disch_tac [])) THEN (clear_assumption "REAL_CONTINUOUS_ON_SUBSET") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`real_interval [a,b]`))) (term_tac exists_tac))); + ((((use_arg_then "REAL_INTERVAL_OPEN_SUBSET_CLOSED")(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then "piecewise_real_continuous") (fun fst_arg -> (use_arg_then "f_eq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then "f12_eq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((split_tac) THEN ((((fun arg_tac -> (use_arg_then "REAL_CONTINUOUS_ON_SUBSET") (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(:real)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "SUBSET_UNIV")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma lmfun_continuous *) +let lmfun_continuous = section_proof [] +`lmfun real_continuous_on UNIV` +[ + ((fun arg_tac -> arg_tac (Arg_term (`lmfun = (\x. if x <= h0 then (h0 - x) / (h0 - &1) else &0)`))) (term_tac (have_gen_tac [](move ["eq"])))); + (((((use_arg_then "eq_ext")(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then "Sphere.lmfun")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_ROT (1)) ((((fun arg_tac -> (use_arg_then "piecewise_real_continuous_univ") (fun fst_arg -> (use_arg_then "eq") (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (split_tac))); + ((((use_arg_then "REAL_CONTINUOUS_ON_CONST")(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then "real_div")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_ON_RMUL")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_ON_SUB")(thm_tac (new_rewrite [] []))))); + (((((use_arg_then "REAL_CONTINUOUS_ON_ID")(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then "REAL_CONTINUOUS_ON_CONST")(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + + +let root_th = prove(`?x. (#1.2317544220903043901 <= x /\ x <= #1.2317544220903047) /\ + marchal_quartic x = lmfun x`, + REWRITE_TAC[GSYM IN_REAL_INTERVAL] THEN + ONCE_REWRITE_TAC[REAL_ARITH `a = b <=> a - b = &0`] THEN + MATCH_MP_TAC REAL_IVT_INCREASING THEN REPEAT STRIP_TAC THENL [ + REAL_ARITH_TAC; + MATCH_MP_TAC REAL_CONTINUOUS_ON_SUB THEN CONJ_TAC THENL [ + REWRITE_TAC[REAL_CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC REAL_CONTINUOUS_ATREAL_WITHINREAL THEN + REWRITE_TAC[marchal_quartic_continuous_at]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_CONTINUOUS_ON_SUBSET THEN + EXISTS_TAC `(:real)` THEN + REWRITE_TAC[SUBSET_UNIV; lmfun_continuous]; + MP_TAC (SPEC `#1.2317544220903043901` ineq1_th) THEN ANTS_TAC THENL [ + REAL_ARITH_TAC; + ALL_TAC + ] THEN + MP_TAC ((SPEC `#1.2317544220903043901` o GEN_ALL o DISCH_ALL) eq_th1) THEN + ANTS_TAC THENL [ + REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + MP_TAC (SPEC `#1.2317544220903047` ineq2_th) THEN ANTS_TAC THENL [ + REAL_ARITH_TAC; + ALL_TAC + ] THEN + MP_TAC ((SPEC `#1.2317544220903047` o GEN_ALL o DISCH_ALL) eq_th1) THEN + ANTS_TAC THENL [ + REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + REAL_ARITH_TAC);; + + +let root_lemma = prove(`!P Q P2 y. y = (@x. P x /\ Q x) /\ + (!x. P2 x ==> P x) /\ (?z. P2 z /\ Q z) /\ (!x. P x /\ ~(P2 x) ==> ~(Q x)) ==> + P2 y`, MESON_TAC[]);; + + +let hminus_interval = prove(`interval_arith hminus (#1.2317544220903043901, #1.2317544220903047)`, + SUBGOAL_THEN `!x lo hi. interval_arith x (lo,hi) = (\x. interval_arith x (lo, hi)) x` MP_TAC THENL [ + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> PURE_ONCE_REWRITE_TAC[th]) THEN + MATCH_MP_TAC root_lemma THEN REWRITE_TAC[interval_arith] THEN + EXISTS_TAC `\x. #1.2 <= x /\ x < #1.3` THEN + EXISTS_TAC `\x. marchal_quartic x = lmfun x` THEN + ASM_REWRITE_TAC[Sphere.hminus; CONJ_ASSOC] THEN + REWRITE_TAC[root_th; ineq_th] THEN + REAL_ARITH_TAC);; + + +add_constant_interval hminus_interval;; + +(* end;; *) diff --git a/text_formalization/nonlinear/formal_tests/ineq_ids.hl b/text_formalization/nonlinear/formal_tests/ineq_ids.hl new file mode 100644 index 0000000..5a54638 --- /dev/null +++ b/text_formalization/nonlinear/formal_tests/ineq_ids.hl @@ -0,0 +1,643 @@ +(* id, C verification time in ms *) +let ineq_ids = +[ +"GRKIBMP split(1/2)",0; +"GRKIBMP split(0/2)",0; +"HJKDESR1a",0; +"ZTGIJCF0",0; +"TSKAJXY-delta_x4",0; +"OXLZLEZ 6346351218 0 0",0; +"OXLZLEZ 6346351218 0 1",0; +"OXLZLEZ 6346351218 0 2",0; +"OXLZLEZ 6346351218 0 3",0; +"OXLZLEZ 6346351218 0 4",0; +"OXLZLEZ 6346351218 0 5",0; +"OXLZLEZ 6346351218 0 6",0; +"OXLZLEZ 6346351218 0 7",0; +"OXLZLEZ 6346351218 0 8",0; +"OXLZLEZ 6346351218 0 9",0; +"OXLZLEZ 6346351218 0 10",0; +"OXLZLEZ 6346351218 0 11",0; +"OXLZLEZ 6346351218 0 12",0; +"OXLZLEZ 6346351218 0 13",0; +"OXLZLEZ 6346351218 0 14",0; +"OXLZLEZ 6346351218 0 15",0; +"OXLZLEZ 6346351218 0 16",0; +"OXLZLEZ 6346351218 0 17",0; +"OXLZLEZ 6346351218 0 18",0; +"OXLZLEZ 6346351218 0 19",0; +"OXLZLEZ 6346351218 0 20",0; +"OXLZLEZ 6346351218 0 21",0; +"OXLZLEZ 6346351218 0 22",0; +"OXLZLEZ 6346351218 0 23",0; +"OXLZLEZ 6346351218 0 24",0; +"OXLZLEZ 6346351218 0 25",0; +"OXLZLEZ 6346351218 0 26",0; +"OXLZLEZ 6346351218 0 27",0; +"OXLZLEZ 6346351218 0 28",0; +"OXLZLEZ 6346351218 0 29",0; +"OXLZLEZ 6346351218 0 30",0; +"OXLZLEZ 6346351218 0 31",0; +"OXLZLEZ 6346351218 0 32",0; +"OXLZLEZ 6346351218 0 33",0; +"OXLZLEZ 6346351218 0 34",0; +"OXLZLEZ 6346351218 0 35",0; +"OXLZLEZ 6346351218 0 36",0; +"OXLZLEZ 6346351218 0 37",0; +"OXLZLEZ 6346351218 0 38",0; +"OXLZLEZ 6346351218 0 39",0; +"OXLZLEZ 6346351218 0 40",0; +"OXLZLEZ 6346351218 0 41",0; +"OXLZLEZ 6346351218 0 42",0; +"OXLZLEZ 6346351218 0 43",0; +"OXLZLEZ 6346351218 0 44",0; +"OXLZLEZ 6346351218 0 45",0; +"1965189142 34",0; +"6096597438 a",0; +"4717061266",0; +"1117202051",0; +"4559601669",0; +"4559601669b",0; +"2485876245a",0; +"JNTEFVP 1",1; +"TSKAJXY-eulerA",1; +"5512912661",2; +"6843920790",2; +"BIXPCGW b",2; +"4828966562",3; +"TSKAJXY-RIBCYXU sharp",3; +"8055810915",3; +"6459846571",3; +"ZTGIJCF4 1 1 1 1 1821661595 split(16/32)",4; +"QITNPEA4 1 1 1 1 3803737830 split(16/32)",4; +"ZTGIJCF4 1 1 1 1 1821661595 split(0/32)",5; +"QITNPEA4 1 1 1 1 3803737830 split(0/32)",5; +"SDCCMGA a",5; +"2485876245b",5; +"SDCCMGA b",6; +"QITNPEA4 1 1 1 1 3803737830 split(1/32)",8; +"ZTGIJCF4 1 1 1 1 1821661595 split(8/32)",8; +"ZTGIJCF4 1 1 1 1 1821661595 split(4/32)",8; +"ZTGIJCF4 1 1 1 1 1821661595 split(1/32)",9; +"TSKAJXY-GXSABWC DIV",9; +"QITNPEA 4003532128 a",10; +"ZTGIJCF4 1 1 1 1 1821661595 split(24/32)",10; +"ZTGIJCF4 1 1 1 1 1821661595 split(17/32)",10; +"QITNPEA4 1 1 1 1 3803737830 split(8/32)",10; +"QITNPEA4 1 1 1 1 3803737830 split(4/32)",10; +"8520556953",11; +"ZTGIJCF4 1 1 1 1 1821661595 split(18/32)",11; +"6096597438 b",11; +"7459553847",12; +"ZTGIJCF4 1 1 1 1 1821661595 split(20/32)",12; +"QITNPEA4 1 1 1 1 3803737830 split(20/32)",12; +"7459553847",13; +"4528012043",13; +"ZTGIJCF4 1 1 1 1 1821661595 split(2/32)",13; +"QITNPEA4 1 1 1 1 3803737830 split(17/32)",13; +"4528012043",14; +"QITNPEA4 1 1 1 1 3803737830 split(24/32)",14; +"QITNPEA4 1 1 1 1 3803737830 split(18/32)",14; +"QITNPEA4 1 1 1 1 3803737830 split(2/32)",14; +"BIXPCGW 7274157868 split(63/64)",20; +"ZTGIJCF4 1 1 1 1 1821661595 split(12/32)",20; +"9816718044",21; +"ZTGIJCF4 1 1 0 1 1821661595 split(0/16)",21; +"ZTGIJCF4 1 1 1 1 1821661595 split(5/32)",21; +"9816718044",22; +"BIXPCGW 7274157868 split(31/64)",22; +"QITNPEA4 1 1 1 1 3803737830 split(12/32)",22; +"QITNPEA4 1 1 1 1 3803737830 split(5/32)",22; +"ZTGIJCF4 1 1 1 1 1821661595 split(28/32)",23; +"ZTGIJCF4 1 1 1 1 1821661595 split(6/32)",23; +"QITNPEA4 1 1 1 1 3803737830 split(10/32)",24; +"QITNPEA4 1 1 1 1 3803737830 split(3/32)",24; +"4143829594",25; +"ZTGIJCF4 1 1 1 1 1821661595 split(10/32)",25; +"ZTGIJCF4 1 1 1 1 1821661595 split(3/32)",25; +"QITNPEA 3725403817",25; +"4143829594",26; +"ZTGIJCF4 0 1 1 1 1821661595 split(0/16)",26; +"ZTGIJCF4 1 1 0 1 1821661595 split(8/16)",26; +"ZTGIJCF4 1 1 1 0 1821661595 split(0/16)",26; +"7697147739 delta issue",27; +"ZTGIJCF4 1 1 1 1 1821661595 split(22/32)",27; +"QITNPEA4 1 1 1 1 3803737830 split(6/32)",27; +"2200527225",28; +"3106201101",28; +"ZTGIJCF4 1 1 1 1 1821661595 split(21/32)",28; +"3106201101",29; +"2200527225",29; +"ZTGIJCF4 1 1 1 1 1821661595 split(26/32)",29; +"ZTGIJCF4 1 1 1 1 1821661595 split(19/32)",29; +"QITNPEA4 1 1 0 1 3803737830 split(0/16)",29; +"QITNPEA4 1 1 1 1 3803737830 split(22/32)",29; +"QITNPEA4 1 1 1 1 3803737830 split(21/32)",31; +"QITNPEA4 1 1 1 1 3803737830 split(26/32)",32; +"QITNPEA4 1 1 1 1 3803737830 split(19/32)",32; +"QITNPEA4 1 1 1 1 3803737830 split(28/32)",33; +"ZTGIJCF4 0 1 1 1 1821661595 split(8/16)",34; +"ZTGIJCF4 1 1 1 0 1821661595 split(8/16)",35; +"QITNPEA4 0 1 1 1 3803737830 split(0/16)",35; +"QITNPEA4 1 0 1 1 3803737830 split(0/16)",35; +"QITNPEA4 1 1 1 0 3803737830 split(0/16)",36; +"9977174768",37; +"QITNPEA4 0 1 1 1 3803737830 split(8/16)",37; +"QITNPEA4 1 1 0 1 3803737830 split(8/16)",37; +"QITNPEA4 1 1 1 1 3803737830 split(9/32)",37; +"2559885109",38; +"9977174768",38; +"ZTGIJCF4 1 1 1 1 1821661595 split(9/32)",38; +"ZTGIJCF4 1 0 1 1 1821661595 split(0/16)",39; +"8673686234 a",40; +"BIXPCGW 7274157868 split(29/64)",44; +"BIXPCGW 7274157868 split(15/64)",45; +"ZTGIJCF4 1 1 1 1 1821661595 split(25/32)",45; +"QITNPEA4 1 1 1 0 3803737830 split(8/16)",46; +"2900061606",47; +"QITNPEA4 1 0 1 1 3803737830 split(8/16)",47; +"QITNPEA4 1 1 1 1 3803737830 split(25/32)",47; +"BIXPCGW 7274157868 split(23/64)",49; +"7097350062a",50; +"ZTGIJCF4 1 0 1 1 1821661595 split(8/16)",50; +"7097350062a",51; +"BIXPCGW 7274157868 split(27/64)",52; +"BIXPCGW 7274157868 split(30/64)",53; +"1080462150",55; +"ZTGIJCF4 1 1 1 1 1821661595 split(14/32)",57; +"QITNPEA4 1 1 1 1 3803737830 split(14/32)",58; +"ZTGIJCF4 1 1 1 1 1821661595 split(7/32)",58; +"ZTGIJCF4 1 1 0 1 1821661595 split(2/16)",60; +"2570626711",60; +"QITNPEA4 1 1 1 1 3803737830 split(7/32)",61; +"BIXPCGW 7274157868 split(59/64)",64; +"ZTGIJCF4 1 1 1 1 1821661595 split(23/32)",64; +"BIXPCGW 7274157868 split(47/64)",66; +"ZTGIJCF4 0 1 1 1 1821661595 split(2/16)",68; +"7067938795",70; +"ZTGIJCF4 0 1 1 1 1821661595 split(1/16)",71; +"QZECFIC wt2 split(0/4)",73; +"ZTGIJCF4 1 1 1 0 1821661595 split(1/16)",74; +"ZTGIJCF4 1 1 1 1 1821661595 split(13/32)",74; +"OMKYNLT 0 3",74; +"QITNPEA4 1 1 1 1 3803737830 split(23/32)",75; +"ZTGIJCF4 1 1 0 1 1821661595 split(1/16)",76; +"ZTGIJCF4 1 1 0 1 1821661595 split(4/16)",77; +"BIXPCGW 7274157868 split(14/64)",78; +"GLFVCVK4 2477216213 split(31/64)",79; +"BIXPCGW 7274157868 split(21/64)",79; +"ZTGIJCF4 0 1 1 1 1821661595 split(4/16)",79; +"ZTGIJCF4 1 1 1 0 1821661595 split(2/16)",79; +"ZTGIJCF4 1 1 1 0 1821661595 split(4/16)",80; +"QITNPEA4 1 1 0 1 3803737830 split(4/16)",81; +"QITNPEA4 1 1 0 1 3803737830 split(2/16)",82; +"QITNPEA4 1 1 1 1 3803737830 split(13/32)",82; +"BIXPCGW 7274157868 split(62/64)",83; +"QITNPEA4 1 1 0 1 3803737830 split(1/16)",83; +"ZTGIJCF4 1 1 1 1 1821661595 split(30/32)",84; +"1965189142 a",85; +"QITNPEA4 1 1 1 1 3803737830 split(11/32)",86; +"7645170609",86; +"ZTGIJCF4 0 1 1 1 1821661595 split(9/16)",86; +"QITNPEA4 1 1 1 0 3803737830 split(1/16)",86; +"ZTGIJCF4 0 1 1 1 1821661595 split(10/16)",87; +"ZTGIJCF4 1 1 1 1 1821661595 split(11/32)",87; +"QITNPEA4 1 0 1 1 3803737830 split(2/16)",87; +"OMKYNLT 3336871894",87; +"QITNPEA4 0 1 1 1 3803737830 split(2/16)",88; +"QITNPEA4 1 1 1 1 3803737830 split(30/32)",88; +"7645170609",90; +"OMKYNLT 2 1",90; +"BIXPCGW 7274157868 split(55/64)",90; +"QITNPEA4 1 1 1 0 3803737830 split(4/16)",90; +"QITNPEA4 0 1 1 1 3803737830 split(1/16)",91; +"ZTGIJCF4 1 1 1 1 1821661595 split(27/32)",92; +"ZTGIJCF4 1 1 1 1 1821661595 split(29/32)",93; +"ZTGIJCF4 1 1 0 1 1821661595 split(12/16)",94; +"ZTGIJCF4 1 1 0 1 1821661595 split(9/16)",94; +"ZTGIJCF4 1 0 1 1 1821661595 split(2/16)",95; +"ZTGIJCF4 1 1 1 0 1821661595 split(9/16)",96; +"ZTGIJCF4 1 1 1 0 1821661595 split(12/16)",98; +"QITNPEA4 1 1 1 1 3803737830 split(27/32)",98; +"QITNPEA4 1 1 1 0 3803737830 split(2/16)",99; +"QITNPEA4 0 1 1 1 3803737830 split(4/16)",100; +"GLFVCVK4 2477216213 split(63/64)",101; +"QITNPEA4 1 1 1 1 3803737830 split(29/32)",103; +"QITNPEA4 1 0 1 1 3803737830 split(1/16)",104; +"BIXPCGW 7274157868 split(7/64)",105; +"TSKAJXY-IYOUOBF sharp v2",108; +"QITNPEA4 1 1 0 1 3803737830 split(12/16)",109; +"QITNPEA4 1 1 0 1 3803737830 split(9/16)",109; +"BIXPCGW 7274157868 split(61/64)",110; +"QITNPEA4 0 1 1 1 3803737830 split(9/16)",110; +"BIXPCGW 7274157868 split(28/64)",111; +"QITNPEA4 0 1 1 1 3803737830 split(10/16)",112; +"QITNPEA4 1 0 1 1 3803737830 split(10/16)",112; +"QITNPEA4 1 0 1 1 3803737830 split(4/16)",115; +"QITNPEA4 1 1 1 0 3803737830 split(12/16)",120; +"ZTGIJCF4 1 1 0 1 1821661595 split(10/16)",122; +"QITNPEA4 1 1 1 0 3803737830 split(9/16)",122; +"5026777310",125; +"ZTGIJCF4 1 0 1 1 1821661595 split(10/16)",126; +"9459075374",126; +"ZTGIJCF4 1 0 1 1 1821661595 split(1/16)",127; +"9459075374",128; +"ZTGIJCF4 1 0 1 1 1821661595 split(4/16)",128; +"QITNPEA4 1 0 1 1 3803737830 split(9/16)",136; +"ZTGIJCF4 1 0 1 1 1821661595 split(9/16)",147; +"ZTGIJCF4 0 1 1 1 1821661595 split(12/16)",147; +"QITNPEA4 1 0 1 1 3803737830 split(12/16)",150; +"ZTGIJCF4 1 1 1 0 1821661595 split(10/16)",155; +"BIXPCGW 7274157868 split(13/64)",156; +"BIXPCGW 7274157868 split(46/64)",158; +"BIXPCGW 7274157868 split(43/64)",160; +"QITNPEA4 1 1 0 1 3803737830 split(10/16)",161; +"OMKYNLT 1 2",161; +"BIXPCGW 7274157868 split(53/64)",162; +"ZTGIJCF4 1 0 1 1 1821661595 split(12/16)",162; +"BIXPCGW 7274157868 split(22/64)",163; +"BIXPCGW 7274157868 split(11/64)",170; +"BIXPCGW 7274157868 split(58/64)",173; +"ZTGIJCF4 1 1 1 1 1821661595 split(15/32)",179; +"BIXPCGW 7274157868 split(19/64)",181; +"4680581274 delta issue",184; +"BIXPCGW 7274157868 split(26/64)",184; +"7881254908",186; +"BIXPCGW 7274157868 split(51/64)",188; +"QITNPEA4 1 1 1 1 3803737830 split(15/32)",188; +"QITNPEA4 0 1 1 1 3803737830 split(12/16)",198; +"ZTGIJCF4 1 1 0 1 1821661595 split(3/16)",200; +"QITNPEA4 1 1 1 0 3803737830 split(10/16)",201; +"ZTGIJCF4 1 1 1 0 1821661595 split(6/16)",206; +"ZTGIJCF4 1 1 1 1 1821661595 split(31/32)",214; +"7881254908",217; +"ZTGIJCF4 0 1 1 1 1821661595 split(6/16)",222; +"ZTGIJCF4 0 1 1 1 1821661595 split(5/16)",223; +"ZTGIJCF4 0 1 1 0 1821661595 split(0/8)",225; +"BIXPCGW 7274157868 split(39/64)",227; +"ZTGIJCF4 1 1 0 1 1821661595 split(6/16)",228; +"BIXPCGW 7274157868 split(45/64)",230; +"ZTGIJCF4 0 1 0 1 1821661595 split(0/8)",231; +"QITNPEA4 1 1 0 1 3803737830 split(3/16)",233; +"GLFVCVK4 2477216213 split(15/64)",235; +"ZTGIJCF4 0 1 1 1 1821661595 split(3/16)",235; +"QITNPEA4 1 1 0 1 3803737830 split(6/16)",236; +"BIXPCGW 7274157868 split(54/64)",237; +"GLFVCVK4 2477216213 split(23/64)",238; +"ZTGIJCF4 1 1 0 0 1821661595 split(0/8)",244; +"ZTGIJCF4 1 1 1 0 1821661595 split(5/16)",244; +"ZTGIJCF4 1 1 1 0 1821661595 split(3/16)",244; +"GLFVCVK4 2477216213 split(30/64)",245; +"QITNPEA4 1 1 1 1 3803737830 split(31/32)",247; +"BIXPCGW 7274157868 split(25/64)",248; +"BIXPCGW 7274157868 split(57/64)",250; +"BIXPCGW 7274157868 split(3/64)",253; +"QITNPEA4 1 1 1 0 3803737830 split(5/16)",254; +"QITNPEA4 0 1 1 1 3803737830 split(3/16)",256; +"QITNPEA4 1 1 1 0 3803737830 split(3/16)",257; +"BIXPCGW 7274157868 split(6/64)",260; +"ZTGIJCF4 0 1 1 1 1821661595 split(11/16)",267; +"QITNPEA4 1 1 1 0 3803737830 split(6/16)",267; +"QITNPEA4 1 0 1 1 3803737830 split(3/16)",272; +"QITNPEA4 0 0 1 1 3803737830 split(0/8)",273; +"BIXPCGW 7274157868 split(24/64)",275; +"GLFVCVK4 2477216213 split(29/64)",276; +"BIXPCGW 7274157868 split(60/64)",280; +"ZTGIJCF4 1 1 0 1 1821661595 split(11/16)",280; +"ZTGIJCF4 0 0 1 1 1821661595 split(0/8)",280; +"GLFVCVK4 2477216213 split(27/64)",285; +"QZECFIC wt2 split(2/4)",286; +"ZTGIJCF4 1 1 0 1 1821661595 split(14/16)",290; +"BIXPCGW 7274157868 split(10/64)",293; +"BIXPCGW 7274157868 split(12/64)",294; +"BIXPCGW 7274157868 split(5/64)",295; +"QITNPEA4 0 1 1 1 3803737830 split(6/16)",296; +"BIXPCGW 7274157868 split(20/64)",300; +"QITNPEA4 0 1 1 1 3803737830 split(5/16)",303; +"BIXPCGW 7274157868 split(17/64)",307; +"ZTGIJCF4 1 1 1 0 1821661595 split(13/16)",318; +"ZTGIJCF4 1 0 1 1 1821661595 split(3/16)",318; +"QITNPEA4 1 0 1 1 3803737830 split(6/16)",322; +"QITNPEA4 0 1 1 0 3803737830 split(0/8)",324; +"GLFVCVK4 2477216213 split(55/64)",326; +"GLFVCVK4 2477216213 split(47/64)",330; +"QITNPEA4 0 1 1 1 3803737830 split(11/16)",344; +"9269152105",348; +"ZTGIJCF4 1 0 1 1 1821661595 split(6/16)",357; +"QITNPEA4 0 1 0 1 3803737830 split(0/8)",357; +"QITNPEA4 1 1 0 0 3803737830 split(0/8)",362; +"QITNPEA4 1 1 0 1 3803737830 split(14/16)",365; +"QITNPEA4 1 0 1 1 3803737830 split(11/16)",367; +"ZTGIJCF4 0 1 1 1 1821661595 split(13/16)",371; +"QITNPEA4 1 1 0 1 3803737830 split(11/16)",373; +"5490182221",375; +"QITNPEA4 1 0 1 0 3803737830 split(0/8)",376; +"GLFVCVK4 2477216213 y4crit split(0/8)",378; +"GLFVCVK4 2477216213 split(59/64)",380; +"9507202313",382; +"QITNPEA4 1 0 0 1 3803737830 split(0/8)",383; +"QITNPEA4 1 1 1 0 3803737830 split(13/16)",388; +"QITNPEA1 1 1 9063653052 split(0/8)",389; +"ZTGIJCF4 0 1 1 1 1821661595 split(14/16)",395; +"ZTGIJCF4 0 0 1 1 1821661595 split(4/8)",397; +"GLFVCVK4 2477216213 split(62/64)",398; +"BIXPCGW 7274157868 split(35/64)",398; +"ZTGIJCF4 1 0 1 1 1821661595 split(11/16)",400; +"3872614111",404; +"ZTGIJCF4 1 1 1 0 1821661595 split(14/16)",407; +"ZTGIJCF4 1 1 1 0 1821661595 split(11/16)",412; +"QITNPEA4 0 0 1 1 3803737830 split(4/8)",418; +"9925287433",418; +"ZTGIJCF4 1 0 1 0 1821661595 split(0/8)",422; +"4841020453",424; +"BIXPCGW 7274157868 split(56/64)",433; +"GLFVCVK4 2477216213 split(61/64)",436; +"ZTGIJCF4 0 1 0 1 1821661595 split(4/8)",454; +"ZTGIJCF4 0 1 1 0 1821661595 split(4/8)",454; +"QITNPEA4 1 0 1 1 3803737830 split(14/16)",455; +"2390583444",456; +"ZTGIJCF4 1 1 0 0 1821661595 split(4/8)",463; +"ZTGIJCF4 1 1 0 1 1821661595 split(5/16)",470; +"6619134733",474; +"7043724150 a reduced",481; +"BIXPCGW 7274157868 split(1/64)",489; +"QITNPEA4 1 1 0 1 3803737830 split(5/16)",493; +"ZTGIJCF4 1 0 1 1 1821661595 split(14/16)",496; +"BIXPCGW 7274157868 split(2/64)",498; +"QITNPEA1 2 1 9063653052 split(0/4)",503; +"BIXPCGW 7274157868 split(42/64)",503; +"2739661360",507; +"ZTGIJCF4 1 0 0 1 1821661595 split(0/8)",507; +"2739661360",509; +"7720405539",520; +"GLFVCVK4 2477216213 y4crit split(2/8)",527; +"3139693500",528; +"BIXPCGW 7274157868 split(49/64)",529; +"QITNPEA4 0 1 1 1 3803737830 split(13/16)",529; +"QITNPEA4 1 1 1 0 3803737830 split(11/16)",529; +"QITNPEA1 1 1 9063653052 split(2/8)",529; +"BIXPCGW 7274157868 split(37/64)",530; +"QITNPEA4 0 1 1 1 3803737830 split(14/16)",532; +"BIXPCGW 7274157868 split(8/64)",533; +"QITNPEA4 1 0 1 1 3803737830 split(5/16)",533; +"QITNPEA4 1 1 1 0 3803737830 split(14/16)",536; +"BIXPCGW 7274157868 split(16/64)",537; +"QITNPEA4 1 0 0 1 3803737830 split(4/8)",542; +"5735387903",547; +"BIXPCGW 7274157868 split(38/64)",548; +"ZTGIJCF4 1 1 0 1 1821661595 split(13/16)",555; +"QZECFIC wt2 split(1/4)",569; +"2535350075",574; +"ZTGIJCF4 1 0 1 0 1821661595 split(4/8)",577; +"4922521904",578; +"QITNPEA4 1 1 0 1 3803737830 split(13/16)",588; +"QITNPEA4 1 0 1 0 3803737830 split(4/8)",590; +"BIXPCGW 7274157868 split(4/64)",591; +"ZTGIJCF4 1 0 0 1 1821661595 split(4/8)",593; +"2535350075",594; +"4922521904",600; +"ZTGIJCF4 1 1 1 0 1821661595 split(7/16)",621; +"181212899 4",622; +"181212899 5",628; +"ZTGIJCF4 1 0 1 1 1821661595 split(5/16)",638; +"1550635295",638; +"MKFKQWU",670; +"ZTGIJCF4 0 1 1 1 1821661595 split(7/16)",674; +"ZTGIJCF4 0 1 0 1 1821661595 split(1/8)",680; +"181212899 3",685; +"ZTGIJCF4 0 1 1 0 1821661595 split(1/8)",690; +"ZTGIJCF4 1 1 0 0 1821661595 split(2/8)",690; +"9563139965 e",694; +"181212899 2",697; +"6987934000",705; +"2923748598",708; +"QITNPEA4 0 1 1 0 3803737830 split(4/8)",714; +"QITNPEA4 0 1 0 1 3803737830 split(4/8)",718; +"4306175952",724; +"BIXPCGW 7274157868 split(44/64)",727; +"BIXPCGW 7274157868 split(52/64)",728; +"7316455966",730; +"BIXPCGW 7080972881 a",734; +"BIXPCGW 7274157868 split(18/64)",737; +"QITNPEA4 1 1 0 0 3803737830 split(4/8)",737; +"BIXPCGW 7274157868 split(9/64)",737; +"QZECFIC wt2 split(3/4)",740; +"QITNPEA4 1 1 1 0 3803737830 split(7/16)",741; +"GLFVCVK4 2477216213 y4crit split(1/8)",773; +"6410081357",781; +"QITNPEA1 1 1 9063653052 split(1/8)",785; +"GLFVCVK4 2477216213 y4crit split(4/8)",805; +"QITNPEA1 1 1 9063653052 split(4/8)",816; +"BIXPCGW 7274157868 split(50/64)",822; +"QITNPEA4 0 0 1 1 3803737830 split(1/8)",827; +"QITNPEA4 1 0 1 1 3803737830 split(13/16)",829; +"QITNPEA4 0 0 1 1 3803737830 split(2/8)",838; +"GLFVCVK4 2477216213 split(21/64)",840; +"BIXPCGW 7274157868 split(40/64)",843; +"BIXPCGW 7274157868 split(33/64)",844; +"BIXPCGW 7274157868 split(41/64)",845; +"ZTGIJCF4 0 0 1 1 1821661595 split(1/8)",881; +"GLFVCVK4 2477216213 split(14/64)",885; +"ZTGIJCF4 1 0 1 1 1821661595 split(13/16)",888; +"6836427086",890; +"ZTGIJCF4 0 0 1 1 1821661595 split(2/8)",892; +"QITNPEA4 0 1 1 1 3803737830 split(7/16)",892; +"4222324842",898; +"QITNPEA1 2 1 9063653052 split(1/4)",900; +"OXLZLEZ 6346351218 1 30",901; +"BIXPCGW 7274157868 split(34/64)",914; +"BIXPCGW 7274157868 split(48/64)",923; +"QITNPEA4 0 1 0 1 3803737830 split(1/8)",924; +"QITNPEA4 0 1 1 0 3803737830 split(1/8)",924; +"QITNPEA4 1 1 0 0 3803737830 split(2/8)",935; +"1894886027",937; +"QITNPEA1 2 1 9063653052 split(2/4)",945; +"ZTGIJCF4 0 1 1 1 1821661595 split(15/16)",966; +"BIXPCGW 7274157868 split(0/64)",999; +"QITNPEA1 1 2 9063653052 split(0/4)",1048; +"ZTGIJCF4 1 1 0 1 1821661595 split(7/16)",1069; +"ZTGIJCF4 1 1 1 0 1821661595 split(15/16)",1073; +"ZTGIJCF4 0 1 0 1 1821661595 split(2/8)",1079; +"RQWUDDU split(0/2)",1083; +"ZTGIJCF4 0 1 1 0 1821661595 split(2/8)",1086; +"ZTGIJCF4 1 1 0 0 1821661595 split(1/8)",1095; +"6284721194",1109; +"GLFVCVK4 2477216213 split(7/64)",1130; +"QITNPEA4 1 1 0 1 3803737830 split(7/16)",1130; +"QITNPEA1 1 1 9063653052 split(3/8)",1152; +"QITNPEA1 1 1 9063653052 split(6/8)",1153; +"GLFVCVK4 2477216213 y4crit split(3/8)",1156; +"GLFVCVK4 2477216213 y4crit split(6/8)",1159; +"ZTGIJCF4 1 1 0 1 1821661595 split(15/16)",1169; +"1284543870",1171; +"GLFVCVK4 2477216213 split(28/64)",1174; +"3020140039",1197; +"ZTGIJCF4 0 1 0 1 1821661595 split(5/8)",1208; +"QITNPEA4 1 0 1 0 3803737830 split(1/8)",1219; +"ZTGIJCF4 0 1 1 0 1821661595 split(5/8)",1226; +"ZTGIJCF4 1 1 0 0 1821661595 split(6/8)",1230; +"QITNPEA4 1 0 1 0 3803737830 split(2/8)",1232; +"1836408787",1235; +"5835568093",1249; +"GLFVCVK4 2477216213 split(13/64)",1253; +"GLFVCVK4 2477216213 split(22/64)",1255; +"QITNPEA1 2 2 9063653052 split(0/2)",1258; +"7409690040",1267; +"5756588587",1271; +"ZTGIJCF4 0 0 1 1 1821661595 split(5/8)",1292; +"QITNPEA4 0 0 1 1 3803737830 split(5/8)",1299; +"ZTGIJCF4 1 0 1 0 1821661595 split(1/8)",1312; +"ZTGIJCF4 1 0 1 0 1821661595 split(2/8)",1314; +"9229542852",1326; +"QITNPEA4 0 0 1 1 3803737830 split(6/8)",1328; +"ZTGIJCF4 0 0 1 1 1821661595 split(6/8)",1334; +"QITNPEA4 1 1 1 0 3803737830 split(15/16)",1355; +"BIXPCGW 1738910218 a",1356; +"QITNPEA4 0 1 1 1 3803737830 split(15/16)",1361; +"QITNPEA4 1 1 0 1 3803737830 split(15/16)",1390; +"OXLZLEZ 6346351218 1 29",1398; +"BIXPCGW 7274157868 split(32/64)",1436; +"GLFVCVK4 2477216213 split(19/64)",1500; +"QITNPEA4 1 0 1 1 3803737830 split(7/16)",1521; +"4002562507",1523; +"4041673283",1578; +"QITNPEA1 1 2 9063653052 split(1/4)",1625; +"GLFVCVK4 2477216213 split(11/64)",1626; +"GLFVCVK4 2477216213 split(25/64)",1674; +"GLFVCVK4 2477216213 split(45/64)",1683; +"QITNPEA4 0 1 0 1 3803737830 split(2/8)",1689; +"QITNPEA4 0 1 1 0 3803737830 split(2/8)",1697; +"GLFVCVK4 2477216213 split(26/64)",1703; +"GLFVCVK4 2477216213 split(54/64)",1717; +"GLFVCVK4 2477216213 split(53/64)",1719; +"QITNPEA4 1 1 0 0 3803737830 split(1/8)",1733; +"GLFVCVK4 2477216213 split(46/64)",1753; +"QITNPEA1 1 1 9063653052 split(5/8)",1798; +"GLFVCVK4 2477216213 y4crit split(5/8)",1801; +"QITNPEA4 0 1 0 1 3803737830 split(5/8)",1801; +"GLFVCVK4 2477216213 split(39/64)",1820; +"ZTGIJCF4 1 0 1 1 1821661595 split(7/16)",1843; +"QITNPEA4 0 1 1 0 3803737830 split(5/8)",1858; +"BIXPCGW 6652007036 a",1860; +"OXLZLEZ 6346351218 4 44",1863; +"QITNPEA4 1 1 0 0 3803737830 split(6/8)",1864; +"OXLZLEZ 6346351218 2 44",1865; +"3566713650",1920; +"GLFVCVK4 2477216213 split(60/64)",1947; +"RQWUDDU split(1/2)",1972; +"OXLZLEZ 6346351218 3 30",1985; +"QITNPEA4 1 0 0 1 3803737830 split(2/8)",1991; +"QITNPEA4 1 0 1 1 3803737830 split(15/16)",1994; +"QITNPEA4 1 0 0 1 3803737830 split(1/8)",2033; +"8657368829",2037; +"QITNPEA1 2 1 9063653052 split(3/4)",2053; +"5766053833",2064; +"GLFVCVK4 2477216213 split(51/64)",2124; +"GLFVCVK4 2477216213 split(57/64)",2178; +"TSKAJXY-XLLIPLS",2179; +"QITNPEA4 1 0 1 0 3803737830 split(5/8)",2183; +"ZTGIJCF4 0 1 0 1 1821661595 split(6/8)",2194; +"QITNPEA4 1 0 1 0 3803737830 split(6/8)",2213; +"ZTGIJCF4 1 1 0 0 1821661595 split(5/8)",2226; +"1248932983",2228; +"ZTGIJCF4 0 1 1 0 1821661595 split(6/8)",2237; +"5298513205",2244; +"ZTGIJCF4 1 0 1 0 1821661595 split(5/8)",2246; +"QITNPEA1 1 2 9063653052 split(2/4)",2266; +"ZTGIJCF4 1 0 1 0 1821661595 split(6/8)",2272; +"GLFVCVK4 2477216213 split(43/64)",2285; +"ZTGIJCF4 1 0 1 1 1821661595 split(15/16)",2305; +"9641946727",2311; +"GLFVCVK4 2477216213 split(58/64)",2315; +"OXLZLEZ 6346351218 4 31",2327; +"OXLZLEZ 6346351218 2 31",2328; +"QZECFIC wt1 split(0/2)",2417; +"7743522046",2481; +"ZTGIJCF4 1 0 0 1 1821661595 split(1/8)",2512; +"ZTGIJCF4 1 0 0 1 1821661595 split(2/8)",2521; +"9414951439",2550; +"OXLZLEZ 6346351218 1 43",2578; +"5943578801",2585; +"OXLZLEZ 6346351218 3 29",2698; +"9185711902",2707; +"OXLZLEZ 6346351218 1 7",2721; +"QITNPEA4 0 0 1 1 3803737830 split(3/8)",2722; +"3980286827",2728; +"3425739813",2740; +"9291937879",2753; +"QITNPEA4 1 0 0 1 3803737830 split(5/8)",2755; +"QITNPEA1 1 1 9063653052 split(7/8)",2772; +"GLFVCVK4 2477216213 y4crit split(7/8)",2782; +"QITNPEA4 1 0 0 1 3803737830 split(6/8)",2801; +"3137600529",2844; +"ZTGIJCF4 0 0 1 1 1821661595 split(3/8)",2866; +"OXLZLEZ 6346351218 1 40",2877; +"7718591733",2903; +"9922699028",2957; +"ZTGIJCF4 0 1 0 1 1821661595 split(3/8)",3072; +"QITNPEA1 2 2 9063653052 split(1/2)",3100; +"ZTGIJCF4 0 1 1 0 1821661595 split(3/8)",3101; +"OXLZLEZ 6346351218 2 21",3112; +"9563139965 f",3149; +"OXLZLEZ 6346351218 4 27",3154; +"OXLZLEZ 6346351218 4 20",3155; +"OXLZLEZ 6346351218 2 20",3161; +"ZTGIJCF4 1 1 0 0 1821661595 split(3/8)",3175; +"ZTGIJCF4 1 0 0 1 1821661595 split(5/8)",3207; +"OXLZLEZ 6346351218 1 26",3210; +"OXLZLEZ 6346351218 2 28",3264; +"8199484193",3323; +"GLFVCVK4 2477216213 split(3/64)",3358; +"OXLZLEZ 6346351218 2 19",3372; +"OXLZLEZ 6346351218 3 43",3377; +"ZTGIJCF4 1 0 0 1 1821661595 split(6/8)",3395; +"OXLZLEZ 6346351218 4 28",3456; +"GLFVCVK4 2477216213 split(24/64)",3501; +"OXLZLEZ 6346351218 4 41",3511; +"QITNPEA4 0 1 0 1 3803737830 split(6/8)",3537; +"QITNPEA4 0 1 1 0 3803737830 split(6/8)",3557; +"QITNPEA4 1 1 0 0 3803737830 split(5/8)",3658; +"OXLZLEZ 6346351218 2 42",3670; +"OXLZLEZ 6346351218 3 17",3674; +"OXLZLEZ 6346351218 1 18",3695; +"OXLZLEZ 6346351218 1 17",3695; +"OXLZLEZ 6346351218 1 16",3711; +"GLFVCVK4 2477216213 split(17/64)",3740; +"QITNPEA1 1 2 9063653052 split(3/4)",3759; +"OXLZLEZ 6346351218 1 25",3766; +"OXLZLEZ 6346351218 3 18",3818; +"OXLZLEZ 6346351218 4 42",3819; +"ZTGIJCF4 1 0 0 0 1821661595 split(0/4)",3942; +"ZTGIJCF4 0 0 1 0 1821661595 split(0/4)",3949; +"ZTGIJCF4 0 0 0 1 1821661595 split(0/4)",3975; +"7819193535",4032; +"2151506422",4075; +"QITNPEA4 0 0 1 1 3803737830 split(7/8)",4131; +"8384511215",4157; +"ZTGIJCF4 0 0 1 1 1821661595 split(7/8)",4193; +"QITNPEA4 1 0 0 0 3803737830 split(0/4)",4252; +"QITNPEA4 0 0 0 1 3803737830 split(0/4)",4262; +"QITNPEA4 0 0 1 0 3803737830 split(0/4)",4280; +"7291663656",4421; +"QITNPEA4 0 1 0 1 3803737830 split(3/8)",4572; +"QITNPEA1 1 0 9063653052 split(0/4)",4581; +"QITNPEA4 0 1 1 0 3803737830 split(3/8)",4597; +"ZTGIJCF4 0 1 0 0 1821661595 split(0/4)",4633; +"5760733457",4649; +"5202826650 a",4691; +"9995621667",4699; +"QITNPEA4 1 0 1 0 3803737830 split(3/8)",4713; +"QITNPEA4 1 1 0 0 3803737830 split(3/8)",4715; +"6725783616",4864; +"QITNPEA 5400790175 a split(0/4)",5054; +"ZTGIJCF4 1 0 1 0 1821661595 split(3/8)",5089; +"GLFVCVK4 2477216213 split(20/64)",5144; +"181212899 1",5181; +"181212899 0",5226; +"MKFKQWU halfwt",5307; +"3221740746 a",5611; +"9861833891",6705; +"5405130650",8072; +"3603097872",13611; +"5493250206",43794; +];; \ No newline at end of file diff --git a/text_formalization/nonlinear/formal_tests/load.hl b/text_formalization/nonlinear/formal_tests/load.hl new file mode 100644 index 0000000..39f8d36 --- /dev/null +++ b/text_formalization/nonlinear/formal_tests/load.hl @@ -0,0 +1,53 @@ +let flyspeck_dir = "/mnt/Repository/text_formalization";; +let hollight_dir = "";; + +load_path := flyspeck_dir :: !load_path;; + +let flyspeck_needs = needs;; + +map needs [ + "Multivariate/flyspeck.ml"; + "Rqe/num_calc_simp.ml"; + "general/sphere.hl"; + "general/prove_by_refinement.hl"; +];; + +#load "unix.cma";; +let process_to_string unixstring = + let p = Unix.open_process_in unixstring + and b = Buffer.create 64 in + let rec read () = Buffer.add_channel b p 1; read () in + try read () with End_of_file -> (Unix.close_process_in p; Buffer.contents b);; + + +open Prove_by_refinement;; + +map needs [ + "general/flyspeck_lib.hl"; + "leg/collect_geom2.hl"; + "leg/enclosed_def.hl"; + "trigonometry/trig2.hl"; +];; + +map needs [ + "jordan/lib_ext.hl"; + "jordan/refinement.hl"; + "jordan/parse_ext_override_interface.hl"; + "jordan/real_ext.hl"; + "jordan/hash_term.hl"; +];; + + +prioritize_real();; +map needs [ + "jordan/tactics_jordan.hl"; + "jordan/num_ext_nabs.hl"; + "jordan/taylor_atn.hl"; + "jordan/float.hl"; + "jordan/flyspeck_constants.hl"; +];; + +map needs [ + "nonlinear/ineq.hl"; + "nonlinear/lemma.hl"; +];; diff --git a/text_formalization/nonlinear/formal_tests/test1.hl b/text_formalization/nonlinear/formal_tests/test1.hl new file mode 100644 index 0000000..7a5000b --- /dev/null +++ b/text_formalization/nonlinear/formal_tests/test1.hl @@ -0,0 +1,258 @@ +needs "verifier/m_verifier_main.hl";; + +needs "nonlinear/lemma.hl";; +needs "nonlinear/functional_equation.hl";; +needs "nonlinear/ineq.hl";; + +needs "nonlinear/prep.hl";; +let add_inequality = Prep.add_inequality;; +let find_ineqs idv = filter (fun t -> (String.length idv <= String.length t.idv) && + (String.sub t.idv 0 (String.length idv) = idv)) (!Prep.prep_ineqs);; + +needs "nonlinear/formal_tests/ineq_ids.hl";; + +needs "nonlinear/formal_tests/hminus.hl";; + + +open M_verifier_main;; +open Sphere;; + +(*************************) + +let dih_x_pos_eq = prove (`let d_x4 = delta_x4 x1 x2 x3 x4 x5 x6 in + let d = delta_x x1 x2 x3 x4 x5 x6 in + &0 < x1 /\ &0 < d ==> + dih_x x1 x2 x3 x4 x5 x6 = pi / &2 + atn(--d_x4 / sqrt (&4 * x1 * d))`, + REPEAT (CONV_TAC let_CONV) THEN STRIP_TAC THEN + REWRITE_TAC[dih_x] THEN CONV_TAC (DEPTH_CONV let_CONV) THEN + new_rewrite [] [] Trigonometry1.ATN2_BREAKDOWN THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC SQRT_POS_LT THEN + MATCH_MP_TAC REAL_LT_MUL THEN STRIP_TAC THENL [ REAL_ARITH_TAC; ALL_TAC] THEN + MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[]);; + + +let arclength_pos_eq = prove(`&0 < ups_x (a * a) (b * b) (c * c) ==> + arclength a b c = pi / &2 + atn ((c * c - a * a - b * b) / sqrt (ups_x (a * a) (b * b) (c * c)))`, + STRIP_TAC THEN REWRITE_TAC[arclength] THEN + new_rewrite [] [] Trigonometry1.ATN2_BREAKDOWN THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC SQRT_POS_LT THEN ASM_REWRITE_TAC[]);; + +let sqrt_pos_eq = prove(`&0 < x ==> sqrt x * sqrt x = x`, + DISCH_TAC THEN REWRITE_TAC[GSYM REAL_POW_2] THEN + MATCH_MP_TAC SQRT_POW_2 THEN + MATCH_MP_TAC REAL_LT_IMP_LE THEN ASM_REWRITE_TAC[]);; + +let ineqs = + let dummy = `ineq [] (P \/ Q)` in + let find id = + let data = find_ineqs id in + (snd o strip_forall) (if data = [] then dummy else (hd data).ineq) in + let all_ineqs = map (fun id, t -> find id, (id, t)) ineq_ids in + let filter1 = filter (fun ineq, _ -> not (is_disj (rand ineq))) all_ineqs in + filter (fun ineq, _ -> not (is_binary "real_le" (rand ineq))) filter1;; + +(* 195 *) +length ineqs;; + +let get_constants tm = + let rec find tm = + match tm with + | Const _ -> [tm] + | Comb (tm1, tm2) -> find tm1 @ find tm2 + | Abs (_, tm2) -> find tm2 + | _ -> [] in + setify (find tm);; + + +let ineqs = + let c1 = "asn797k" and + c2 = "asnFnhk" in + filter (fun ineq, _ -> + let cs = get_constants ineq in + let l = map (fst o dest_const) cs in + not (mem c1 l or mem c2 l)) ineqs;; + +let consts = end_itlist union (map (get_constants o fst) ineqs);; +(* 193 *) +length ineqs;; + +let all_ids = map (fst o snd) ineqs;; + +open Functional_equation;; +open Nonlinear_lemma;; + +let flyspeck_defs = [ + gamma3f_x_div_sqrtdelta; promote_pow3; + proj_x1; proj_x2; proj_x3; proj_x4; proj_x5; proj_x6; + delta_x4; delta_x; eulerA_x; num1; acs_sqrt_x1_d4; + arclength_x_123; arc_hhn; arclength_x1; + lfun_y1; gchi1_x; rhazim2_x; rhazim3_x; rhazim_x; + taum_sub345_x; dih4_x; halfbump_x1; halfbump_x4; + gchi2_x; gchi3_x; gchi4_x; gchi5_x; gchi6_x; + sqrt8; vol_x; dih2_x; dih3_x; + sqrt_x1; sqrt_x2; sqrt_x3; sqrt_x4; sqrt_x5; sqrt_x6; + rad2_x; unit6; + promote1_to_6; + mm1; mm2; arclength_y1; h0; lfun; + rhazim2; rhazim3; taum_x; rhazim; + halfbump_x; dih4_y; dih5_x; dih6_x; gchi; + sol_y; rho_x; sol0; tau0; + node2_y; node3_y; rho; + bump; dih5_y; dih6_y; dih_y; + ly; interp; hplus; ups_x; + GSYM sol0_over_pi_EQ_const1; +];; + +let cond_defs = + let conv = UNDISCH_ALL o CONV_RULE (DEPTH_CONV let_CONV) in + map conv [ + dih_x_pos_eq; + arclength_pos_eq + ];; + +(* A temporary cheating *) +let cond_defs = + let conv = UNDISCH_ALL o CONV_RULE (DEPTH_CONV let_CONV) in + let conv = Hol.new_axiom o concl o conv in + map conv [ + dih_x_pos_eq; + arclength_pos_eq; + sqrt_pos_eq; + ];; + +let ineq_conv = REWRITE_CONV[Sphere.ineq; IMP_IMP] THENC REWRITE_CONV flyspeck_defs + THENC DEPTH_CONV let_CONV THENC REWRITE_CONV cond_defs THENC REWRITE_CONV flyspeck_defs;; +(* let consts2 = end_itlist union (map (get_constants o rand o concl o ineq_conv o fst) ineqs);; *) + + +let verify_all pp ineqs = + let n = length ineqs in + let k = ref 0 in + let verify ineq_tm = + let _ = k := !k + 1 in + let _ = report (sprintf "Verifying: %d/%d" !k n) in + let eq_th = ineq_conv ineq_tm in + let ineq_tm1 = (rand o concl) eq_th in + try + verify_ineq default_params pp ineq_tm1 + with Failure s -> + let _ = report s in + TRUTH, {total_time = 0.0; formal_verification_time = 0.0; certificate = Verifier.dummy_stats} in + map (verify o fst) ineqs;; + + +let sum_time ineqs result = + let original_time = itlist (fun (_,(_,x)) y -> x + y) ineqs 0 in + let failures = length (filter (fun x, _ -> x = TRUTH) result) in + let times = snd (unzip result) in + failures, + itlist (fun x y -> x.total_time +. y) times 0.0, + itlist (fun x y -> x.formal_verification_time +. y) times 0.0, + original_time;; + + +(* Returns inequalities with the given informal verification time (bounds are inclusive) *) +let get_ineqs t_min t_max = + filter (fun (_, (_, t)) -> t_min <= t && t <= t_max) ineqs;; + + +(**************) +(* 0 ms *) +let ineqs0 = get_ineqs 0 0;; +(* 55 *) +length ineqs0;; + + +let result0 = verify_all 4 ineqs0;; +(* base = 200, pp = 4: 422.494, 2.159; informal = 0 *) +sum_time ineqs0 result0;; + +(*******************) +(* 1 ms -- 100 ms *) +let ineqs100 = get_ineqs 1 100;; +(* 35 *) +length ineqs100;; + +let result100 = verify_all 4 ineqs100;; +(* base = 200, pp = 4: 5546, 3854; informal = 1134 *) +sum_time ineqs100 result100;; + + +(***********************************) +(* 101 ms -- 500 ms, 501 -- 700 ms *) +let ineqs500 = get_ineqs 101 500;; +(* 11 *) +length ineqs500;; + +let ineqs700 = get_ineqs 501 700;; +(* 14 *) +length ineqs700;; + +let result500 = verify_all 4 ineqs500;; + +let result700 = verify_all 4 ineqs700;; + +(* base = 200, pp = 4: 12098, 10451; informal = 3944 *) +sum_time ineqs500 result500;; + +(* base = 200, pp = 4: 32065, 28705; informal = 8423 *) +sum_time ineqs700 result700;; + + +(******************) +(* 701 -- 1000 ms *) +let ineqs1000 = get_ineqs 701 1000;; +(* 9 *) +length ineqs1000;; + +let result1000 = verify_all 4 ineqs1000;; + +(* base = 200, pp = 4: 19040, 16688; informal = 7274 *) +sum_time ineqs1000 result1000;; + +let x = 2;; + +(************************************) + +let ineqs1, ineqs2 = chop_list 57 ineqs;; +let result = verify_all 4 ineqs1;; + +(* base = 200, pp = 4: 434.977, 2.202 (0) *) +sum_time ineqs1 result;; + +let ineqs1, ineqs2 = chop_list 20 ineqs2;; +let result2 = verify_all 4 ineqs1;; + +(* base = 200, pp = 4: 1809.949, 997.721 (279) *) +sum_time ineqs1 result2;; + +let ineqs1, ineqs2 = chop_list 30 ineqs2;; +let result3 = verify_all 4 ineqs1;; + +(* base = 200, pp = 4: 26885, 23111 (6863) *) +sum_time ineqs1 result3;; + + +let ineqs3, ineqs4 = chop_list 2 ineqs2;; +let result4 = verify_all 4 ineqs3;; + +(* base = 200, pp = 4: 7105, 6439 (1125) *) +sum_time ineqs3 result4;; + +let ineq_tm = List.nth ineqs3 1;; +let eq_th = (ineq_conv THENC REWRITE_CONV[REAL_LE_REFL]) + (subst[`#6.3504`, `x5:real`; `#4.0`, `x6:real`] (fst ineq_tm));; +let ineq_tm1 = (rand o concl) eq_th;; +(* verification time: 1954 (vs 3299) *) +verify_ineq default_params 4 ineq_tm1;; + + +let ineq_tm = List.nth ineqs3 1;; +let eq_th = + (REWRITE_CONV[REAL_ARITH `a + b * (-- &1) + c * (-- &1) + d * (-- &1) + e = (a + e) - (b + c + d)`] THENC + ineq_conv THENC REWRITE_CONV[REAL_LE_REFL]) + (subst[`#6.3504`, `x5:real`; `#4.0`, `x6:real`] (fst ineq_tm));; +let ineq_tm1 = (rand o concl) eq_th;; + +(* verification time: 1771 (vs 3299) *) +verify_ineq default_params 4 ineq_tm1;; diff --git a/text_formalization/nonlinear/formal_tests/test2.hl b/text_formalization/nonlinear/formal_tests/test2.hl new file mode 100644 index 0000000..81e8b43 --- /dev/null +++ b/text_formalization/nonlinear/formal_tests/test2.hl @@ -0,0 +1,103 @@ +(* TSKAJXY-TADIAMB *) +let ineq_tm = `ineq + [ #2.0 * #1.3254 * #2.0 * #1.3254,x1, #8.0; #2.0 * #1.3254 * #2.0 * #1.3254, x2, #8.0; + #4.0,x3, #8.0; #4.0, x4, #8.0; #4.0,x5, #8.0; #4.0,x6, #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`;; + +(* Too difficult: +verify_flyspeck_ineq 3 ineq_tm;; +*) + +let ineq1_tm = `ineq + [ #2.0 * #1.3254 * #2.0 * #1.3254,x1, #8.0; #2.0 * #1.3254 * #2.0 * #1.3254, x2, #8.0; + #4.0,x3, #8.0; #4.0, x4, #8.0; #4.0,x5, #8.0; #4.0,x6, #8.0] + (&0 < delta_x x1 x2 x3 x4 x5 x6 * &4)`;; + +let ineq2_tm = `ineq + [ #2.0 * #1.3254 * #2.0 * #1.3254,x1, #8.0; #2.0 * #1.3254 * #2.0 * #1.3254, x2, #8.0; + #4.0,x3, #8.0; #4.0, x4, #8.0; #4.0,x5, #8.0; #4.0,x6, #8.0] + ((unit6 x1 x2 x3 x4 x5 x6 * #2.0) * (delta_x x1 x2 x3 x4 x5 x6 * &4) < rho_x x1 x2 x3 x4 x5 x6)`;; + +(* easy *) +let delta_x4_pos = verify_flyspeck_ineq 3 ineq1_tm;; +(* easy *) +let ineq2_th = verify_flyspeck_ineq 3 ineq2_tm;; + +let eq_th = REWRITE_CONV[ineq; IMP_IMP] ineq_tm;; +let INEQ_RULE = UNDISCH_ALL o SPEC_ALL o REWRITE_RULE[ineq; IMP_IMP];; +let th0 = INEQ_RULE delta_x4_pos;; +let th1 = INEQ_RULE ineq2_th;; +let th2 = MATCH_MP REAL_LT_RDIV_EQ th0;; +let th3 = REWRITE_RULE[GSYM th2; GSYM rad2_x] th1;; +let th4 = ONCE_REWRITE_RULE[REAL_ARITH `a < b <=> a + b * -- &1 < &0`] th3;; +let result = (REWRITE_RULE[GSYM eq_th] o DISCH_ALL) th4;; + + + +(* 7067938795 *) +add_example {id = "7067938795"; + difficulty = Medium; + ineq_tm = `ineq [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0,x4, #4.0; + #3.01 * #3.01, x5, #3.24 * #3.24; #3.01 * #3.01,x6, #3.24 * #3.24] + (dih_x' x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * pi * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * #0.46 < + &0)`;; + +(* base = 200: 690s (834s total) (386s (468s) Ubuntu 9/Ocaml 3.09.3)*) +verify_flyspeck_ineq 4 ineq_tm;; + + +(* 3318775219 *) +let ineq_tm = `ineq [&2, y1, #2.52; &2, y2, #2.52; + &2, y3, #2.52; #2.52, y4, sqrt(&8); + &2, y5, #2.52; &2, y6, #2.52] + ( ((dih_y' y1 y2 y3 y4 y5 y6) - #1.629 + + (#0.414 * (y2 + y3 + y5 + y6 - #8.0)) - + (#0.763 * (y4 - #2.52)) - + (#0.315 * (y1 - #2.0))) * (-- &1) < &0)`;; + +(* base = 200: 27946s (31514s total) (Ubuntu 9: 15226 (17091)) *) +verify_flyspeck_ineq 5 ineq_tm;; + +let ineq_tm2 = `ineq [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504,x4, #8.0; + #4.0, x5, #6.3504; #4.0,x6, #6.3504] + (dih_x' x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #1.629 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.414 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.414 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.414 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.414 + + unit6 x1 x2 x3 x4 x5 x6 * #0.414 * #8.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.763 + + unit6 x1 x2 x3 x4 x5 x6 * #0.763 * -- #2.52 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.315 + + unit6 x1 x2 x3 x4 x5 x6 * #0.315 * -- #2.0 < + &0)`;; + +(* Ubuntu 9: 6hr (16279s (14296s) with Sys.time()) *) +verify_flyspeck_ineq 5 ineq_tm2;; + +(* 5490182221 *) +let ineq_tm = `ineq [&2, y1, #2.52; &2, y2, #2.52; + &2, y3, #2.52; &2, y4, #2.52; + &2, y5, #2.52; &2, y6, #2.52] + (dih_y' y1 y2 y3 y4 y5 y6 < #1.893)`;; + +(* base = 200: 5570s (6480s total) *) +verify_flyspeck_ineq 10 ineq_tm;; + +(* base = 200 (Ubuntu 9): 3600s total (2716s (3128s) with Sys.time()) *) +verify_flyspeck_ineq 4 ineq_tm;; + +let ineq_tm2 = `ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0,x4, #6.3504; + #4.0, x5, #6.3504; #4.0,x6, #6.3504] + (dih_x' x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #1.893 < &0)`;; + +(* base = 200 (Ubuntu 9): 1593s (1450s) *) +verify_flyspeck_ineq 4 ineq_tm2;; + + + + diff --git a/text_formalization/nonlinear/function_list.hl b/text_formalization/nonlinear/function_list.hl new file mode 100644 index 0000000..fd1db42 --- /dev/null +++ b/text_formalization/nonlinear/function_list.hl @@ -0,0 +1,364 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: nonlinear inequalities *) +(* Author: Thomas Hales *) +(* Date: 2013-05-16 *) +(* ========================================================================= *) + +(* + +Initialize the set of functions that are generated in interval calculations + +*) +module Function_list = struct + +let function_list = ref + [ + (* constants *) + Float.pi_atn; + Functional_equation.cos797; + Sphere.h0; + Sphere.hplus; + Sphere.sqrt3; + Sphere.sqrt8; + Sphere.sol0; + Sphere.tau0; + Sphere.mm1; + Sphere.mm2; + Functional_equation.rh0; + SYM Nonlinear_lemma.sol0_over_pi_EQ_const1; + (* single variable *) + Sphere.gchi; + Sphere.matan; + Sphere.lfun; + Sphere.flat_term; + Nonlinear_lemma.rho_alt; +(* deprecated 2013-08-17 + Sphere.sqn; +*) + REWRITE_RULE[Sphere.flat_term] Sphere.flat_term_x; + (* 3 vars *) + Nonlinear_lemma.quad_root_plus_curry; + Sphere.ups_x; + Sphere.eta_x; + Sphere.arclength; + Sphere.arc_hhn; + (* general 6 *) + Functional_equation.scalar6; + Functional_equation.promote1_to_6; + Functional_equation.promote3_to_6; + Nonlinear_lemma.unit6; + Nonlinear_lemma.proj_x1; + Nonlinear_lemma.proj_x2; + Nonlinear_lemma.proj_x3; + Nonlinear_lemma.proj_x4; + Nonlinear_lemma.proj_x5; + Nonlinear_lemma.proj_x6; + Functional_equation.compose6; + Functional_equation.functional_rotate2; + Functional_equation.functional_rotate3; + Functional_equation.functional_rotate4; + Functional_equation.functional_rotate5; + Functional_equation.functional_rotate6; + Functional_equation.proj_y1; + Functional_equation.functional_proj_y2; + Functional_equation.functional_proj_y3; + Functional_equation.functional_proj_y4; + Functional_equation.functional_proj_y5; + Functional_equation.functional_proj_y6; + Sphere.delta_x; + Sphere.delta_y; + Sphere.delta_x4; + Sphere.dih_x; + Sphere.sol_x; + Sphere.dih_y; + Sphere.sol_y; + Sphere.rho_x; + Sphere.rad2_x; + Functional_equation.uni; + Functional_equation.constant6; + Functional_equation.two6; + Functional_equation.zero6; + Functional_equation.four6; + Functional_equation.dummy6; + Functional_equation.add6; + Functional_equation.sub6; + Functional_equation.mul6; + Functional_equation.div6; + Functional_equation.mk_126; + Functional_equation.mk_135; + Functional_equation.mk_456; + Functional_equation.rotate126; + (* by hand: Functional_equation.domain6; *) +(* deprecated: + Functional_equation.rotate234; + Functional_equation.rotate345; + *) + Functional_equation.functional_norm2hh_x; +Functional_equation.functional_eta2_126; +Functional_equation.functional_x1_delta_x; +Functional_equation.functional_delta4_squared_x; +Functional_equation.functional_vol_x; +Functional_equation.functional_dih2_x; +Functional_equation.functional_dih3_x; +Functional_equation.functional_dih4_x; +Functional_equation.functional_dih5_x; +Functional_equation.functional_dih6_x; +Functional_equation.functional_lfun_y1; +Functional_equation.functional_ldih_x; +Functional_equation.functional_ldih2_x; +Functional_equation.functional_ldih3_x; +Functional_equation.functional_ldih6_x; +Functional_equation.functional_eulerA_x; +Functional_equation.functional_gchi1_x; +Functional_equation.functional_gchi2_x; +Functional_equation.functional_gchi3_x; +Functional_equation.functional_gchi4_x; +Functional_equation.functional_gchi5_x; +Functional_equation.functional_gchi6_x; +Sphere.bump; +Nonlinear_lemma.halfbump_x; +Functional_equation.functional_halfbump_x1; +Functional_equation.functional_halfbump_x4; +Functional_equation.functional_eta2_135; +Functional_equation.functional_eta2_456; +Functional_equation.functional_vol3_x_sqrt; +Functional_equation.functional_vol3f_x_lfun; +Functional_equation.functional_vol3f_x_sqrt2_lmplus; +Functional_equation.functional_asn797k; +Functional_equation.functional_asnFnhk; +Functional_equation.functional_acs_sqrt_x1_d4; +Functional_equation.functional_acs_sqrt_x2_d4; +Functional_equation.functional_arclength_x_123; +Functional_equation.functional_sol_euler_x_divsqrtdelta; +Functional_equation.functional_sol246_euler_x_div_sqrtdelta; +Functional_equation.functional_sol345_euler_x_div_sqrtdelta; +Functional_equation.functional_sol156_euler_x_div_sqrtdelta; +Functional_equation.functional_dih_x_div_sqrtdelta_posbranch; +Functional_equation.functional_dih3_x_div_sqrtdelta_posbranch; +Functional_equation.functional_dih4_x_div_sqrtdelta_posbranch; + +Functional_equation.functional_rhazim_x; +Functional_equation.functional_rhazim2_x; +Functional_equation.functional_rhazim3_x; +Functional_equation.functional_taum_x; +Functional_equation.functional_ldih_x_div_sqrtdelta_posbranch; +Functional_equation.functional_ldih2_x_div_sqrtdelta_posbranch; +Functional_equation.functional_ldih3_x_div_sqrtdelta_posbranch; +Functional_equation.functional_ldih5_x_div_sqrtdelta_posbranch; +Functional_equation.functional_ldih6_x_div_sqrtdelta_posbranch; +Functional_equation.functional_arclength_x1; +Functional_equation.functional_arclength_x2; +Functional_equation.functional_delta_126_x; +Functional_equation.functional_delta_234_x; +Functional_equation.functional_delta_135_x; +Functional_equation.functional_rhazim_x_div_sqrt_delta_posbranch; +Functional_equation.functional_rhazim2_x_div_sqrt_delta_posbranch; +Functional_equation.functional_rhazim3_x_div_sqrt_delta_posbranch; +Functional_equation.functional_tau_residual; +Functional_equation.h0cut; +(* Functional_equation.gamma2_x_div_azim; deprecated =gamma2= *) +Nonlin_def.gamma2_x_div_azim_v2; + (* Functional_equation.gamma2_x1_div_a; deprecated =gamma2= *) +Nonlin_def.gamma2_x1_div_a_v2; +Functional_equation.gamma3f_x_div_sqrtdelta_alt; +Functional_equation.vol3f_456; +Functional_equation.gamma3_x; +Functional_equation.gamma23_full8_x; +Functional_equation.gamma23_keep135_x; +Sphere.num1; +Functional_equation.functional_dnum1; +(* added 2013-05-13 *) +Functional_equation.functional_delta_x1;Nonlin_def.mu6_x;Functional_equation.taud_x_ALT; +Nonlin_def.taud_D2_num_x;Nonlin_def.taud_D1_num_x; +Functional_equation.functional_mud_135_x;Functional_equation.functional_mud_126_x; +Functional_equation.functional_mud_234_x;Nonlin_def.mudLs_234_x;Nonlin_def.mudLs_126_x; +Nonlin_def.mudLs_135_x; +Nonlin_def.ups_126; +Functional_equation.functional_edge2_126_x;Functional_equation.functional_edge2_135_x; +Functional_equation.functional_edge2_234_x; +Nonlin_def.flat_term2_126_x;Nonlin_def.flat_term2_135_x;Nonlin_def.flat_term2_234_x; +Functional_equation.functional_ups_126; + ];; + + + +(* + +(* Test code to determine which functions are actually used. + The list of rewrites are more accurate than the function list above in what is + acutally used. + *) + + +flyspeck_needs "nonlinear/prep.hl";; +#print_length 100;; +let suppress = Print_types.suppress;; + +(* univariate functions *) +map suppress ["matan";"acs";"asn";"sin";"pow2";"sqrt";];; +(* constants *) +map suppress ["cos797";"sqrt3";"pi";"hminus";"hplus";"h0";"const1";"mm1";"mm2";"sqrt8";"sol0"];; +(* functional constants and operators *) +map suppress ["two6";"dummy6"];; +map suppress ["add6";"mul6";"compose6";"proj_x1";"proj_x2";"proj_x3";"proj_x4"];; +map suppress ["proj_x5"; "proj_x6"; "proj_y1"; "scalar6"; "sub6"];; +map suppress ["sqrt_x1";"sqrt_x2";"sqrt_x3";"sqrt_x4";"sqrt_x5";"sqrt_x6"];; +map suppress ["unit6";"constant6";"uni"];; +map suppress ["div6";"zero6";"promote1_to_6"];; +(* Lib.h univariate *) +map suppress ["flat_term_x";"gamma2_x1_div_a_v2";"lfun";"halfbump_x";"rho";];; +(* Lib.h multivariate *) +map suppress ["delta_x";"delta_x4";"sol_x";"rad2_x";"eta2_126";"ups_126";"dih_x"];; + +let const_types i = setify (map fst (Print_types.get_const_types i));; + +let h1 = + let p1 = !Prep.prep_ineqs in + let i1 = map (fun t -> t.ineq) p1 in + fun k-> (ASSUME (snd(strip_forall (List.nth i1 k))));; + +(* ignore domain6 constraints *) + +let domain6_assum = prove_by_refinement( + `!h g f. domain6 h f g ==> (F ==> (f = g))`, + (* {{{ proof *) + [ + MESON_TAC[] + ]);; + (* }}} *) + + let strip_domain6 thm = + try + UNDISCH (MATCH_MP domain6_assum (SPEC_ALL thm)) + with Failure _ -> thm;; + + let rewrite_to_cpp_library_functions = map strip_domain6 [ +Sphere.ineq; + Sphere.gchi; + Functional_equation.uni; +Functional_equation.functional_vol_x; +Functional_equation.functional_dih2_x; +Functional_equation.functional_dih3_x; +Functional_equation.functional_dih4_x; +Functional_equation.functional_dih5_x; +Functional_equation.functional_dih6_x; +Functional_equation.functional_gchi1_x; +Functional_equation.functional_gchi2_x; +Functional_equation.functional_gchi3_x; +Functional_equation.functional_gchi4_x; +Functional_equation.functional_gchi5_x; +Functional_equation.functional_gchi6_x; +Functional_equation.functional_ldih2_x; +Functional_equation.functional_ldih3_x; +Functional_equation.functional_eulerA_x; +Functional_equation.functional_sol156_euler_x_div_sqrtdelta; +Functional_equation.functional_sol246_euler_x_div_sqrtdelta; +Functional_equation.functional_sol345_euler_x_div_sqrtdelta; + Functional_equation.add6; + Functional_equation.sub6; + Functional_equation.mul6; + Functional_equation.div6; + Functional_equation.mk_126; + Functional_equation.mk_135; + Functional_equation.mk_456; + Nonlinear_lemma.proj_x1; + Nonlinear_lemma.proj_x2; + Nonlinear_lemma.proj_x3; + Nonlinear_lemma.proj_x4; + Nonlinear_lemma.proj_x5; + Nonlinear_lemma.proj_x6; + Functional_equation.compose6; + Functional_equation.functional_rotate2; + Functional_equation.functional_rotate3; + Functional_equation.functional_rotate4; + Functional_equation.functional_rotate5; + Functional_equation.functional_rotate6; + Functional_equation.proj_y1; + Functional_equation.functional_proj_y2; + Functional_equation.functional_proj_y3; + Functional_equation.functional_proj_y4; + Functional_equation.functional_proj_y5; + Functional_equation.functional_proj_y6; +Functional_equation.functional_delta_126_x; +Functional_equation.functional_delta_234_x; +Functional_equation.functional_delta_135_x; +Nonlin_def.flat_term2_135_x;Nonlin_def.flat_term2_234_x; +Functional_equation.functional_mud_135_x;Functional_equation.functional_mud_126_x; +Functional_equation.functional_mud_234_x; +Functional_equation.functional_ldih2_x_div_sqrtdelta_posbranch; +Functional_equation.functional_ldih3_x_div_sqrtdelta_posbranch; +Functional_equation.functional_ldih5_x_div_sqrtdelta_posbranch; +Functional_equation.functional_ldih6_x_div_sqrtdelta_posbranch; + Sphere.delta_x; +Functional_equation.functional_ldih_x_div_sqrtdelta_posbranch; +Functional_equation.functional_sol_euler_x_divsqrtdelta; +Functional_equation.functional_dih_x_div_sqrtdelta_posbranch; +Functional_equation.functional_rhazim_x; +Functional_equation.functional_rhazim2_x; +Functional_equation.functional_rhazim3_x; + Functional_equation.rh0; +Functional_equation.functional_delta4_squared_x; +Functional_equation.functional_x1_delta_x; +Functional_equation.functional_tau_residual; +Nonlin_def.mu6_x;Functional_equation.taud_x_ALT; +Nonlin_def.taud_D2_num_x;Nonlin_def.taud_D1_num_x; +Functional_equation.functional_edge2_126_x;Functional_equation.functional_edge2_135_x; +Functional_equation.functional_edge2_234_x; +Nonlin_def.flat_term2_126_x;Nonlin_def.flat_term2_135_x;Nonlin_def.flat_term2_234_x; +Functional_equation.functional_delta_x1; + REWRITE_RULE[Sphere.flat_term] Sphere.flat_term_x; +Functional_equation.functional_rhazim_x_div_sqrt_delta_posbranch; +Functional_equation.functional_rhazim2_x_div_sqrt_delta_posbranch; +Functional_equation.functional_rhazim3_x_div_sqrt_delta_posbranch; +Nonlin_def.mudLs_234_x;Nonlin_def.mudLs_126_x; +Nonlin_def.mudLs_135_x; +Functional_equation.functional_taum_x; +Functional_equation.functional_dnum1; +Nonlinear_lemma.halfbump_x; +Functional_equation.functional_halfbump_x1; +Functional_equation.functional_halfbump_x4; +Functional_equation.functional_asn797k; +Functional_equation.functional_asnFnhk; +Functional_equation.functional_acs_sqrt_x1_d4; + Sphere.arc_hhn; +Functional_equation.functional_arclength_x1; +REWRITE_RULE[LET_DEF;LET_END_DEF] Functional_equation.functional_arclength_x_123; +Functional_equation.vol3f_456; +Functional_equation.functional_vol3_x_sqrt; +Functional_equation.functional_vol3f_x_sqrt2_lmplus; +Functional_equation.functional_vol3f_x_lfun; +Functional_equation.functional_eta2_135; +Functional_equation.functional_eta2_456; +Functional_equation.gamma3_x; +Functional_equation.gamma23_full8_x; +Functional_equation.gamma23_keep135_x; +Functional_equation.gamma3f_x_div_sqrtdelta_alt; +Functional_equation.functional_dih4_x_div_sqrtdelta_posbranch; +Functional_equation.functional_ldih6_x; +Functional_equation.functional_ldih_x; + Functional_equation.functional_norm2hh_x; + ];; + + let test k = + let u = REWRITE_RULE rewrite_to_cpp_library_functions + (h1 k) in + (concl u);; + +let cons = (map (const_types o test) (0--(List.length !Prep.prep_ineqs - 1)));; +let nubcons = Flyspeck_lib.nub cons;; +*) + + let functions() = (!function_list);; + + let function_remove thm = + let _ = (function_list:= (filter (fun t -> not(t = thm)) !function_list)) in + ();; + + let function_add thm = + let _ = function_remove thm in + let _ = (function_list:= (!function_list) @ [thm]) in + ();; + +end;; diff --git a/text_formalization/nonlinear/functional_equation.hl b/text_formalization/nonlinear/functional_equation.hl new file mode 100644 index 0000000..b1b8615 --- /dev/null +++ b/text_formalization/nonlinear/functional_equation.hl @@ -0,0 +1,1508 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: nonlinear inequalities *) +(* Author: Thomas Hales *) +(* Date: 2012-05-20 *) +(* ========================================================================= *) + + +(* May 2012 functional equational definitions of + inequality functions. + + This code is to be used in automated generation of C++ + taylorFunctions. + + scripts.hl generates ocaml Sphere2 module based on these lemmas. + + June 2012: truncate_* are all deprecated. They can be deleted. + +autogen: + see functional_* lemmas in this file. + see functional1_* lemmas in this file for univariate functions. + +native_c: + unit,x1,x2,x3,x4,x5,x6, + y1,y2,y3,y4,y5,y6, + delta_x,delta_x4, + dih_x, sol_x,rad2_x, + num1, + norm2hh_x, + + *) + +(* failwith "moodule";; *) + + module Functional_equation = struct + + open Hales_tactic;; + open Nonlinear_lemma;; + + let GMATCH = GMATCH_SIMP_TAC;; + +let uni = new_definition `uni (f,x) x1 x2 x3 x4 x5 x6 = + (f:A->B) ( x x1 x2 x3 x4 x5 x6)`;; + +let constant6 = new_definition `constant6 c x1 x2 x3 x4 x5 x6 = c`;; + +let promote3_to_6 = new_definition + `promote3_to_6 f x1 x2 x3 x4 x5 x6 = f x1 x2 x3`;; + +let promote1_to_6 = new_definition + `promote1_to_6 f x1 x2 x3 x4 x5 x6 = f x1`;; + +let functional_proj_x1 = prove_by_refinement( + `proj_x1 = promote1_to_6 I`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;promote1_to_6;proj_x1;I_DEF]; + ]);; + (* }}} *) + +(* these are circular, because we will define rotatek + as a composition of proj_xm *) + +let functional_proj_x2 = prove_by_refinement( + `proj_x2 = rotate2 proj_x1`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;proj_x1;proj_x2;Sphere.rotate2]; + ]);; + (* }}} *) + +let functional_proj_x3 = prove_by_refinement( + `proj_x3 = rotate3 proj_x1`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;proj_x1;proj_x3;Sphere.rotate3]; + ]);; + (* }}} *) + +let functional_proj_x4 = prove_by_refinement( + `proj_x4 = rotate4 proj_x1`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;proj_x1;proj_x4;Sphere.rotate4]; + ]);; + (* }}} *) + +let functional_proj_x5 = prove_by_refinement( + `proj_x5 = rotate5 proj_x1`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;proj_x1;proj_x5;Sphere.rotate5]; + ]);; + (* }}} *) + +let functional_proj_x6 = prove_by_refinement( + `proj_x6 = rotate6 proj_x1`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;proj_x1;proj_x6;Sphere.rotate6]; + ]);; + (* }}} *) + +let rh0 = new_definition `rh0 = &1/(h0 - &1)`;; + +let two6 = new_definition `two6 = constant6 ( &2)`;; + +let zero6 = new_definition `zero6 = constant6 ( &0)`;; + +let dummy6 = new_definition `dummy6 = constant6 ( &0)`;; + +let four6 = new_definition `four6 = constant6 ( &4)`;; + +let mk_126 = new_definition `mk_126 f = + compose6 f proj_x1 proj_x2 two6 two6 two6 proj_x6`;; + +let mk_456 = new_definition `mk_456 f = + compose6 f two6 two6 two6 proj_x4 proj_x5 proj_x6`;; + +let mk_135 = new_definition `mk_135 f = + compose6 f proj_x1 two6 proj_x3 two6 proj_x5 two6`;; + +let add6 = new_definition `add6 f g x1 x2 x3 x4 x5 x6 = + f x1 x2 x3 x4 x5 x6 + g x1 x2 x3 x4 x5 x6`;; + +let scalar6 = new_definition `scalar6 f r x1 x2 x3 x4 x5 x6 = + (f x1 x2 x3 x4 x5 x6) * (r:real)`;; + +let mul6 = new_definition `mul6 f g x1 x2 x3 x4 x5 x6 = + f x1 x2 x3 x4 x5 x6 * g x1 x2 x3 x4 x5 x6`;; + +let div6 = new_definition `div6 f g x1 x2 x3 x4 x5 x6 = + f x1 x2 x3 x4 x5 x6 / g x1 x2 x3 x4 x5 x6`;; + +let sub6 = new_definition `sub6 f g x1 x2 x3 x4 x5 x6 = + f x1 x2 x3 x4 x5 x6 - g x1 x2 x3 x4 x5 x6`;; + +let proj_y1 = new_definition `proj_y1 x1 x2 x3 x4 x5 x6 = + sqrt(x1)`;; + +let proj_y2 = new_definition `proj_y2 x1 x2 x3 x4 x5 x6 = + sqrt(x2)`;; + +let proj_y3 = new_definition `proj_y3 x1 x2 x3 x4 x5 x6 = + sqrt(x3)`;; + +let proj_y4 = new_definition `proj_y4 x1 x2 x3 x4 x5 x6 = + sqrt(x4)`;; + +let proj_y5 = new_definition `proj_y5 x1 x2 x3 x4 x5 x6 = + sqrt(x5)`;; + +let proj_y6 = new_definition `proj_y6 x1 x2 x3 x4 x5 x6 = + sqrt(x6)`;; + + +let domain6 = new_definition `domain6 h f g = + (!x1 x2 x3 x4 x5 x6. h x1 x2 x3 x4 x5 x6 ==> + (f x1 x2 x3 x4 x5 x6 = g x1 x2 x3 x4 x5 x6))`;; + +(* should be called something different, because we project out 3 coords *) + +let rotate234 = new_definition `rotate234 f = + compose6 f proj_x2 proj_x3 proj_x4 unit6 unit6 unit6`;; + +let rotate126 = new_definition `rotate126 f = + compose6 f proj_x1 proj_x2 proj_x6 unit6 unit6 unit6`;; + +let rotate345 = new_definition `rotate345 f = + compose6 f proj_x3 proj_x4 proj_x5 unit6 unit6 unit6`;; + +let functional_overload() = ( + overload_interface ("+",`add6`); + overload_interface ("-",`sub6`); + overload_interface ("/",`div6`); + overload_interface ("*",`mul6`));; + +let _ = functional_overload();; + +let proj_x1 = Nonlinear_lemma.proj_x1;; +let proj_x2 = Nonlinear_lemma.proj_x2;; +let proj_x3 = Nonlinear_lemma.proj_x3;; +let proj_x4 = Nonlinear_lemma.proj_x4;; +let proj_x5 = Nonlinear_lemma.proj_x5;; +let proj_x6 = Nonlinear_lemma.proj_x6;; +let unit6 = Nonlinear_lemma.unit6;; +let compose6 = Nonlinear_lemma.compose6;; + +let h0cut = new_definition `h0cut y = if (y <= &2 * h0) then &1 else &0`;; + +let functional_proj_y1 = prove_by_refinement( + `proj_y1 = promote1_to_6 sqrt`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;promote1_to_6;proj_y1]; + ]);; + (* }}} *) + +let functional_proj_y2 = prove_by_refinement( + `proj_y2 = rotate2 proj_y1`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;proj_y1;proj_y2;Sphere.rotate2]; + ]);; + (* }}} *) + +let functional_proj_y3 = prove_by_refinement( + `proj_y3 = rotate3 proj_y1`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;proj_y1;proj_y3;Sphere.rotate3]; + ]);; + (* }}} *) + +let functional_proj_y4 = prove_by_refinement( + `proj_y4 = rotate4 proj_y1`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;proj_y1;proj_y4;Sphere.rotate4]; + ]);; + (* }}} *) + +let functional_proj_y5 = prove_by_refinement( + `proj_y5 = rotate5 proj_y1`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;proj_y1;proj_y5;Sphere.rotate5]; + ]);; + (* }}} *) + +let functional_proj_y6 = prove_by_refinement( + `proj_y6 = rotate6 proj_y1`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;proj_y1;proj_y6;Sphere.rotate6]; + ]);; + (* }}} *) + +let sqrt_sqrt = prove_by_refinement( + `!x. &0 <= x ==> (sqrt x * sqrt x = x)`, + (* {{{ proof *) + [ + MESON_TAC[arith `&0 pow 2 = &0`;(SPEC `&0` Nonlinear_lemma.sq_pow2)]; + ]);; + (* }}} *) + +let functional_norm2hh_x = prove_by_refinement( + `norm2hh_x = uni(pow2,(proj_y1 - constant6 (hminus + hplus))) + + uni(pow2, proj_y2 - two6) + uni(pow2,proj_y3 - two6) + + uni(pow2, proj_y4 - two6) + uni(pow2,proj_y5 - two6) + + uni(pow2, proj_y6 - two6)`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM; add6; sub6; uni;proj_y1;Nonlinear_lemma.pow2; two6;Sphere.norm2hh_x;Sphere.norm2hh;proj_y1;proj_y2;proj_y3;proj_y4;proj_y5;proj_y6;constant6]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let functional_eta2_126 = prove_by_refinement( + `domain6 + (\x1 x2 x3 x4 x5 x6. + (&0 <= x1 /\ &0 <= x2 /\ &0 <= x6)) + eta2_126 (uni(pow2,rotate126 (promote3_to_6 eta_x)))`, + (* {{{ proof *) + [ + REWRITE_TAC[domain6;Sphere.eta2_126;Sphere.eta_y; uni; rotate126;compose6;promote3_to_6;proj_x1;proj_x2;proj_x6;unit6;LET_END_DEF;LET_DEF;Nonlinear_lemma.pow2]; + BY(ASM_SIMP_TAC[sqrt_sqrt]) + ]);; + (* }}} *) + + +let functional_rotate2 = prove_by_refinement( + `!f. rotate2 f = compose6 f proj_x2 proj_x3 proj_x1 proj_x5 proj_x6 proj_x4`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Sphere.rotate2;FUN_EQ_THM;compose6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6]); + ]);; + (* }}} *) + +let functional_rotate3 = prove_by_refinement( + `!f. rotate3 f = compose6 f proj_x3 proj_x1 proj_x2 proj_x6 proj_x4 proj_x5`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Sphere.rotate3;FUN_EQ_THM;compose6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6]); + ]);; + (* }}} *) + +let functional_rotate4 = prove_by_refinement( + `!f. rotate4 f = compose6 f proj_x4 proj_x2 proj_x6 proj_x1 proj_x5 proj_x3`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Sphere.rotate4;FUN_EQ_THM;compose6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6]); + ]);; + (* }}} *) + +let functional_rotate5 = prove_by_refinement( + `!f. rotate5 f = compose6 f proj_x5 proj_x3 proj_x4 proj_x2 proj_x6 proj_x1`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Sphere.rotate5;FUN_EQ_THM;compose6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6]); + ]);; + (* }}} *) + +let functional_rotate6 = prove_by_refinement( + `!f. rotate6 f = compose6 f proj_x6 proj_x1 proj_x5 proj_x3 proj_x4 proj_x2`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Sphere.rotate6;FUN_EQ_THM;compose6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6]); + ]);; + (* }}} *) + +let functional_x1_delta_x = prove_by_refinement( + `x1_delta_x = proj_x1 * delta_x`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM]; + BY(REWRITE_TAC[proj_x1;Sphere.x1_delta_x;mul6]) + ]);; + (* }}} *) + +let functional_delta4_squared_x = prove_by_refinement( + `delta4_squared_x = uni(pow2,delta_x4)`, + (* {{{ proof *) + [ +BY(REWRITE_TAC[FUN_EQ_THM;uni;Nonlinear_lemma.pow2;Sphere.delta4_squared_x]) + ]);; + (* }}} *) + +let functional_vol_x = prove_by_refinement( + `vol_x = scalar6 (uni(sqrt,delta_x)) (&1 / &12)`, + (* {{{ proof *) + [ + (REWRITE_TAC[FUN_EQ_THM;uni;Sphere.vol_x;scalar6]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let functional_dih2_x = prove_by_refinement( + `dih2_x = rotate2 dih_x`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[Sphere.dih2_x;Sphere.rotate2]; + BY(MESON_TAC[Nonlinear_lemma.dih_x_sym]) + ]);; + (* }}} *) + +let functional_dih3_x = prove_by_refinement( + `dih3_x = rotate3 dih_x`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[Sphere.dih3_x;Sphere.rotate3]; + ]);; + (* }}} *) + +let functional_dih4_x = prove_by_refinement( + `domain6 (\x1 x2 x3 x4 x5 x6. + &0 <= x1 /\ &0 <= x2 /\ &0 <= x3 /\ + &0 <= x4 /\ &0 <= x5 /\ &0 <= x6) + dih4_x (rotate4 dih_x)`, + (* {{{ proof *) + [ + REWRITE_TAC[domain6]; + REWRITE_TAC[Sphere.dih4_x; Sphere.rotate4;Sphere.dih4_y; Sphere.dih_y; LET_DEF;LET_END_DEF]; + REPEAT WEAK_STRIP_TAC; + REPEAT( GMATCH_SIMP_TAC (ISPEC `&0` Nonlinear_lemma.sq_pow2)); + BY(ASM_REWRITE_TAC[REAL_ARITH `&0 pow 2 = &0`]) + ]);; + (* }}} *) + +let functional_dih5_x = prove_by_refinement( + `domain6 (\x1 x2 x3 x4 x5 x6. + &0 <= x1 /\ &0 <= x2 /\ &0 <= x3 /\ + &0 <= x4 /\ &0 <= x5 /\ &0 <= x6) + dih5_x (rotate5 dih_x)`, + (* {{{ proof *) + [ + REWRITE_TAC[domain6]; + REWRITE_TAC[Sphere.dih5_x; Sphere.rotate5;Sphere.dih5_y; Sphere.dih_y; LET_DEF;LET_END_DEF]; + REPEAT WEAK_STRIP_TAC; + REPEAT( GMATCH_SIMP_TAC (ISPEC `&0` Nonlinear_lemma.sq_pow2)); + (ASM_REWRITE_TAC[REAL_ARITH `&0 pow 2 = &0`]); + MESON_TAC[Nonlinear_lemma.dih_x_sym;Nonlinear_lemma.dih_x_sym2]; + ]);; + (* }}} *) + +let functional_dih6_x = prove_by_refinement( + `domain6 (\x1 x2 x3 x4 x5 x6. + &0 <= x1 /\ &0 <= x2 /\ &0 <= x3 /\ + &0 <= x4 /\ &0 <= x5 /\ &0 <= x6) + dih6_x (rotate6 dih_x)`, + (* {{{ proof *) + [ + REWRITE_TAC[domain6]; + REWRITE_TAC[Sphere.dih6_x; Sphere.rotate6;Sphere.dih6_y;Sphere.dih_y; LET_DEF;LET_END_DEF]; + REPEAT WEAK_STRIP_TAC; + REPEAT( GMATCH_SIMP_TAC (ISPEC `&0` Nonlinear_lemma.sq_pow2)); + (ASM_REWRITE_TAC[REAL_ARITH `&0 pow 2 = &0`]); + ]);; + (* }}} *) + +(* + +let dih6_x' = new_definition `dih6_x' = rotate6 dih_x`;; + +let ldih6_x' = new_definition `!x1 x2 x3 x4 x5 x6. + ldih6_x' x1 x2 x3 x4 x5 x6 = + lfun (sqrt x6 / &2) * dih6_x' x1 x2 x3 x4 x5 x6`;; + +let gchi6_x' = new_definition `!x1 x2 x3 x4 x5 x6. + gchi6_x x1 x2 x3 x4 x5 x6 = + gchi (sqrt x6) * dih6_x' x1 x2 x3 x4 x5 x6`;; + +*) + +let functional_lfun_y1 = prove_by_refinement( + `lfun_y1 = scalar6 (scalar6 unit6 h0 - proj_x1) rh0`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[add6;scalar6;mul6;div6;sub6;constant6;rh0]; + REWRITE_TAC[Sphere.lfun_y1;Sphere.lfun; Nonlinear_lemma.unit6;Nonlinear_lemma.proj_x1]; +REAL_ARITH_TAC; + ]);; + (* }}} *) + +let functional_ldih_x = prove_by_refinement( + `ldih_x = + (scalar6 (scalar6 unit6 h0 - scalar6 proj_y1 (#0.5)) rh0) * dih_x`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[add6;mul6;div6;sub6;constant6;rh0;scalar6]; + REWRITE_TAC[proj_y1;Sphere.ldih_x;Nonlinear_lemma.unit6;Sphere.lfun]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let functional_ldih2_x = prove_by_refinement( + `ldih2_x = rotate2 ldih_x`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[Sphere.rotate2;Sphere.ldih2_x;Sphere.ldih_x;Sphere.dih2_x]; + MESON_TAC[Nonlinear_lemma.dih_x_sym]; + ]);; + (* }}} *) + +let functional_ldih3_x = prove_by_refinement( + `ldih3_x = rotate3 ldih_x`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[Sphere.rotate3;Sphere.ldih3_x;Sphere.ldih_x;Sphere.dih3_x]; + ]);; + (* }}} *) + +let functional_ldih6_x = prove_by_refinement( + `domain6 + (\x1 x2 x3 x4 x5 x6. &0 <= x1 /\ &0 <= x2 /\ &0 <= x3 /\ + &0 <= x4 /\ &0 <= x5 /\ &0 <= x6) + ldih6_x + (rotate6 ldih_x)`, + (* {{{ proof *) + [ + REWRITE_TAC[domain6 ]; + REWRITE_TAC[Sphere.rotate6;Sphere.ldih6_x;Sphere.ldih_x;Sphere.dih6_x;Sphere.dih6_y; Sphere.dih_y;LET_DEF;LET_END_DEF]; + BY(ASM_SIMP_TAC[sqrt_sqrt]) + ]);; + (* }}} *) + +let functional_eulerA_x = prove_by_refinement( + `eulerA_x = proj_y1 * proj_y2 * proj_y3 + + scalar6 (proj_y1 * (proj_x2 + proj_x3 - proj_x4)) (#0.5) + + scalar6 (proj_y2 * (proj_x1 + proj_x3 - proj_x5)) (#0.5) + + scalar6 (proj_y3 * (proj_x1 + proj_x2 - proj_x6)) (#0.5) + `, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;mul6;add6; sub6;proj_y1;proj_y2;proj_y3;scalar6; constant6;proj_x1;proj_x2; proj_x3;proj_x4; proj_x5;proj_x6;Sphere.eulerA_x]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let functional_gchi1_x = prove_by_refinement( + `gchi1_x = uni (gchi,proj_y1) * dih_x`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[FUN_EQ_THM;Sphere.gchi1_x;uni;proj_y1;mul6]); + ]);; + (* }}} *) + +let functional_gchi2_x = prove_by_refinement( + `gchi2_x = uni (gchi,proj_y2) * dih2_x`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[FUN_EQ_THM;Sphere.gchi2_x;uni;proj_y2;mul6]); + ]);; + (* }}} *) + +let functional_gchi3_x = prove_by_refinement( + `gchi3_x = uni (gchi,proj_y3) * dih3_x`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[FUN_EQ_THM;Sphere.gchi3_x;uni;proj_y3;mul6]); + ]);; + (* }}} *) + +let functional_gchi4_x = prove_by_refinement( + `gchi4_x = uni (gchi,proj_y4) * dih4_x`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[FUN_EQ_THM;Sphere.gchi4_x;uni;proj_y4;mul6]); + ]);; + (* }}} *) + +let functional_gchi5_x = prove_by_refinement( + `gchi5_x = uni (gchi,proj_y5) * dih5_x`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[FUN_EQ_THM;Sphere.gchi5_x;uni;proj_y5;mul6]); + ]);; + (* }}} *) + +let functional_gchi6_x = prove_by_refinement( + `gchi6_x = uni (gchi,proj_y6) * dih6_x`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[FUN_EQ_THM;Sphere.gchi6_x;uni;proj_y6;mul6]); + ]);; + (* }}} *) + +let functional_eta2_135 = prove_by_refinement( + `eta2_135 = rotate3 eta2_126`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;Sphere.rotate3;Sphere.eta2_135;Sphere.eta2_126]; + BY(MESON_TAC[Collect_geom.ETA_Y_SYYM]) + ]);; + (* }}} *) + +let functional_eta2_456 = prove_by_refinement( + `eta2_456 = rotate4 eta2_135`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;Sphere.rotate4;Sphere.eta2_456;Sphere.eta2_135;Sphere.rotate3;Sphere.eta2_126]; + BY(MESON_TAC[Collect_geom.ETA_Y_SYYM]) + ]);; + (* }}} *) + +let functional_vol3_x_sqrt = prove_by_refinement( + `domain6 + (\x1 x2 x3 x4 x5 x6. + &0 <= x1 /\ &0 <= x2 /\ &0 <=x6) + vol3_x_sqrt + (mk_126 vol_x)`, + (* {{{ proof *) + [ +BY(REWRITE_TAC[domain6;mk_126;two6;constant6;proj_x1;proj_x2;proj_x6;compose6;Nonlinear_lemma.vol3_vol_x]) + ]);; + (* }}} *) + +let functional_vol3f_x_lfun = prove_by_refinement( + `domain6 + (\x1 x2 x3 x4 x5 x6. + &0 <= x1 /\ &0 <= x2 /\ &0 <=x6) + vol3f_x_lfun + (constant6 ( &2 * mm1 / pi ) * + (two6 * mk_126 dih_x + two6 * mk_126 dih2_x + two6 * mk_126 dih6_x + + mk_126 dih3_x + mk_126 dih4_x + mk_126 dih5_x - + constant6 ( &3 * pi)) + - (constant6 (&8 * mm2 / pi)) * + (mk_126 ldih_x + mk_126 ldih2_x + mk_126 ldih6_x )) + `, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF;mk_126; two6; domain6;constant6;mul6;add6;sub6;proj_x1; compose6;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6]; + BY(REWRITE_TAC[Nonlinear_lemma.vol3f_x_lfun_alt]) + ]);; + (* }}} *) + +let functional_vol3f_x_sqrt2_lmplus = prove_by_refinement( + ` (domain6 + (\x1 x2 x3 x4 x5 x6. + (&2 * h0) pow 2 <= x1 /\ &0 <= x2 /\ &0 <=x6) + vol3f_x_sqrt2_lmplus + (constant6 ( &2 * mm1 / pi ) * + (two6 * mk_126 dih_x + + two6 * mk_126 dih2_x + + two6 * mk_126 dih6_x + + mk_126 dih3_x + + mk_126 dih4_x + + mk_126 dih5_x - + constant6 ( &3 * pi)) + - (constant6 (&8 * mm2 / pi)) * + (mk_126 ldih2_x + + mk_126 ldih6_x)))`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF;mk_126;domain6; two6;constant6;mul6;add6;sub6;proj_x1;compose6;proj_x2; proj_x3;proj_x4;proj_x5;proj_x6]; + BY(REWRITE_TAC[Nonlinear_lemma.vol3f_x_sqrt2_lmplus_alt]) + ]);; + (* }}} *) + +let cos797 = new_definition `cos797 = cos(#0.797)`;; + +let functional_asn797k = prove_by_refinement( + `asn797k = + proj_x1 * uni(asn,constant6 (cos797) * + uni(sin, constant6(pi) / proj_x1))`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[FUN_EQ_THM;mul6;div6;uni;cos797;constant6;proj_x1;Sphere.asn797k]); + ]);; + (* }}} *) + +let functional_asnFnhk = prove_by_refinement( + `asnFnhk = + proj_x2 * uni(asn,(proj_x1 * constant6 (sqrt3 / #4.0) + + (uni(sqrt,unit6 - + uni(pow2,(proj_x1 * constant6 (#0.5))))) * + constant6 (#0.5)) * uni(sin,constant6(pi)/proj_x2))`, + (* {{{ proof *) + [ + (REWRITE_TAC[FUN_EQ_THM;sub6;mul6; div6;Nonlinear_lemma.pow2;add6;unit6; uni;constant6;proj_x1; proj_x2;Sphere.asnFnhk]); + BY(REWRITE_TAC[REAL_ARITH `x * #0.5 = x/ &2`]) + ]);; + (* }}} *) + +let functional_acs_sqrt_x1_d4 = prove_by_refinement( + `acs_sqrt_x1_d4 = uni(acs,scalar6 proj_y1 (#0.25))`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[FUN_EQ_THM;uni;mul6;constant6;scalar6;proj_y1; Sphere.acs_sqrt_x1_d4;arith `x * #0.25 = x/ &4`]) + ]);; + (* }}} *) + +let functional_acs_sqrt_x2_d4 = prove_by_refinement( + `acs_sqrt_x2_d4 = uni(acs,scalar6 proj_y2 (#0.25))`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[FUN_EQ_THM;uni;mul6;constant6;scalar6;proj_y2; Sphere.acs_sqrt_x2_d4;arith `x * #0.25 = x/ &4`]) + ]);; + (* }}} *) + +(* ldih5_x ldih6_x not in HOL Light*) + +let functional_arclength_x_123 = prove_by_refinement( + `let al_num = proj_x1 + proj_x2 - proj_x3 in + let al_den = uni(sqrt,scalar6 (proj_x1 * proj_x2) ( &4)) in + let domain = + (\x1 x2 x3 x4 x5 x6. (&0 < x1 /\ &0 < x2 /\ &0 <= x3) /\ + (sqrt x3 <= sqrt x1 + sqrt x2 /\ sqrt x1 <= sqrt x2 + sqrt x3 /\ + sqrt x2 <= sqrt x3 + sqrt x1)) in + domain6 domain (arclength_x_123) ( uni(acs, al_num / al_den ) )`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF;]; + REWRITE_TAC[domain6]; + REWRITE_TAC[add6;mul6;div6;sub6;scalar6;constant6;uni]; + REWRITE_TAC[proj_x1;proj_x2;proj_x3;Sphere.arclength_x_123;]; + REPEAT STRIP_TAC; + GMATCH_SIMP_TAC Trigonometry1.ACS_ARCLENGTH; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[SQRT_POS_LT;SQRT_POS_LE]; + AP_TERM_TAC; + REPEAT( GMATCH_SIMP_TAC (ISPEC `&0` Nonlinear_lemma.sq_pow2)); + ASM_SIMP_TAC[REAL_ARITH `&0 pow 2 = &0`;REAL_ARITH `&0 < x ==> &0 <= x`;REAL_ARITH `u + x * -- &1 = u - x`]; + AP_TERM_TAC; + MATCH_MP_TAC EQ_SYM; + REWRITE_TAC[REAL_ARITH `(x1 * x2)* &4 = x1 * (x2 * (&2 pow 2))`]; + REPEAT (GMATCH SQRT_MUL); + GMATCH Euler_complement.SQRT_OF_POW_2_LE; + REPEAT (GMATCH Real_ext.REAL_PROP_NN_MUL2); + ASM_SIMP_TAC[REAL_ARITH `&0 <= &2 pow 2 /\ &0 <= &2`;REAL_ARITH `&0 < x ==> &0 <= x`]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let functional_arclength_234 = prove_by_refinement( + `arclength_x_234 = rotate234 arclength_x_123`, + (* {{{ proof *) + [ + REWRITE_TAC[rotate234;Sphere.arclength_x_123]; + REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[add6;mul6;div6;sub6; constant6;Nonlinear_lemma.compose6;uni;Nonlinear_lemma.arclength_x_234; Sphere.arclength_x_123;]; + REWRITE_TAC[proj_x1;proj_x2;proj_x3;proj_x4]; + ]);; + (* }}} *) + +let functional_arclength_126 = prove_by_refinement( + `arclength_x_126 = rotate126 arclength_x_123`, + (* {{{ proof *) + [ + REWRITE_TAC[rotate126]; + REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[add6;mul6;div6;sub6; constant6;Nonlinear_lemma.compose6;uni; Nonlinear_lemma.arclength_x_126; Sphere.arclength_x_123;]; + REWRITE_TAC[proj_x1;proj_x2;proj_x3;proj_x6]; + ]);; + (* }}} *) + +let functional_sol_euler_x_divsqrtdelta = prove_by_refinement( + `domain6 + (\x1 x2 x3 x4 x5 x6. + (&0 <= x1 /\ &0 <= x2 /\ &0 <= x3)) + sol_euler_x_div_sqrtdelta + ((uni(matan,(delta_x / (scalar6 (eulerA_x * eulerA_x) (&4))))) / eulerA_x)`, + (* {{{ proof *) + [ + REWRITE_TAC[domain6]; + REWRITE_TAC[uni;scalar6;Nonlin_def.sol_euler_x_div_sqrtdelta; functional_eulerA_x;div6;mul6;add6;sub6;constant6;proj_y1;proj_y2; proj_y3;proj_x1;proj_x2;proj_x3; proj_x4;proj_x5;proj_x6]; + REWRITE_TAC[REAL_ARITH ` (x/ &2 = x * (#0.5)) /\ ((a*b)*(c:real) = a*b*c)`;REAL_ARITH `&4 * a pow 2 = a* a * &4`;LET_DEF;LET_END_DEF]; + REPEAT STRIP_TAC; + BY(ASM_SIMP_TAC[SQRT_MUL;Real_ext.REAL_PROP_NN_MUL2]) + ]);; + (* }}} *) + + +let functional_sol246_euler_x_div_sqrtdelta = prove_by_refinement( + `sol_euler246_x_div_sqrtdelta = rotate4 sol_euler_x_div_sqrtdelta`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM]; + BY(REWRITE_TAC[Sphere.rotate4; Nonlin_def.sol_euler246_x_div_sqrtdelta]) + ]);; + (* }}} *) + +let functional_sol345_euler_x_div_sqrtdelta = prove_by_refinement( + `sol_euler345_x_div_sqrtdelta = rotate5 sol_euler_x_div_sqrtdelta`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM]; + BY(REWRITE_TAC[Sphere.rotate5;Nonlin_def.sol_euler345_x_div_sqrtdelta]) + ]);; + (* }}} *) + +let functional_sol156_euler_x_div_sqrtdelta = prove_by_refinement( + `sol_euler156_x_div_sqrtdelta = rotate6 sol_euler_x_div_sqrtdelta`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM]; + BY(REWRITE_TAC[Sphere.rotate6;Nonlin_def.sol_euler156_x_div_sqrtdelta]) + ]);; + (* }}} *) + +let functional_dih_x_div_sqrtdelta_posbranch = prove_by_refinement( + `domain6 (\x1 x2 x3 x4 x5 x6. (&0 <= x1)) + dih_x_div_sqrtdelta_posbranch + ((scalar6 proj_y1 (&2)) / (delta_x4) * + uni(matan, (scalar6 (proj_x1 * delta_x) (&4)) / (uni(pow2,delta_x4))))`, + (* {{{ proof *) + [ + REWRITE_TAC[domain6]; + REWRITE_TAC[proj_y1;constant6;proj_x1;uni;scalar6;mul6;div6;Nonlin_def.dih_x_div_sqrtdelta_posbranch;]; + REWRITE_TAC[LET_DEF;LET_END_DEF;Nonlinear_lemma.pow2;arith `&4 * x * y = (x*y)* &4`]; + REPEAT WEAK_STRIP_TAC; + ASM_SIMP_TAC[SQRT_MUL;arith `&0 <= &4`]; + (REWRITE_TAC[Collect_geom2.SQRT4_EQ2]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + +(* dih2_x_div_sqrtdelta_posbranch not defined in HOL-Light *) + +let functional_dih3_x_div_sqrtdelta_posbranch = prove_by_refinement( + `dih3_x_div_sqrtdelta_posbranch = rotate3 dih_x_div_sqrtdelta_posbranch`, + (* {{{ proof *) + [ +BY(REWRITE_TAC[FUN_EQ_THM;Sphere.rotate3;Nonlin_def.dih3_x_div_sqrtdelta_posbranch]); + ]);; + (* }}} *) + +let functional_dih4_x_div_sqrtdelta_posbranch = + Nonlin_def.dih4_x_div_sqrtdelta_posbranch;; + +let functional_dih5_x_div_sqrtdelta_posbranch = prove_by_refinement( + `dih5_x_div_sqrtdelta_posbranch = rotate5 dih_x_div_sqrtdelta_posbranch`, + (* {{{ proof *) + [ +BY(REWRITE_TAC[FUN_EQ_THM;Sphere.rotate5;Nonlin_def.dih5_x_div_sqrtdelta_posbranch]); + ]);; + (* }}} *) + +let functional_edge_flat2_x = prove_by_refinement( + `domain6 + (\x1 x2 x3 x4 x5 x6. + &0 <= x1 /\ &0 <= x2 /\ &0 <= x3 /\ &0 <= x5 /\ &0 <= x6) + edge_flat2_x + (uni(pow2,(uni(sqrt, + compose6(promote3_to_6 quadratic_root_plus_curry) + proj_x1 + (proj_x1 * proj_x1 + + (proj_x3 - proj_x5) * (proj_x2 - proj_x6) - + proj_x1 * (proj_x2 + proj_x3 + proj_x5 + proj_x6)) +( proj_x1 * proj_x3 * proj_x5 + + proj_x1 * proj_x2 * proj_x6 - + proj_x3 * (proj_x1 + proj_x2 - proj_x3 + proj_x5 - proj_x6) * + proj_x6 - + proj_x2 * proj_x5 * (proj_x1 - proj_x2 + proj_x3 - + proj_x5 + proj_x6)) + zero6 zero6 zero6)))) + `, + (* {{{ proof *) + [ + BY(REWRITE_TAC[domain6; Nonlinear_lemma.edge_flat2_x_rewrite; compose6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6; zero6;constant6;add6;mul6; sub6;uni;promote3_to_6; Nonlinear_lemma.quadratic_root_plus_curry; Nonlinear_lemma.pow2]) + ]);; + (* }}} *) + +let functional_ldih_x_div_sqrtdelta_posbranch = prove_by_refinement( + `ldih_x_div_sqrtdelta_posbranch = + (scalar6 (constant6 h0 - scalar6 proj_y1 ( #0.5)) rh0) + * dih_x_div_sqrtdelta_posbranch`, + (* {{{ proof *) +[ + REWRITE_TAC[FUN_EQ_THM;mul6;scalar6;rh0;Nonlin_def.ldih_x_div_sqrtdelta_posbranch;Sphere.lfun;constant6;mul6;sub6;proj_y1;]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let functional_ldih2_x_div_sqrtdelta_posbranch = + Nonlin_def.ldih2_x_div_sqrtdelta_posbranch;; + +let functional_ldih3_x_div_sqrtdelta_posbranch = + Nonlin_def.ldih3_x_div_sqrtdelta_posbranch;; + + +let functional_ldih5_x_div_sqrtdelta_posbranch = + Nonlin_def.ldih5_x_div_sqrtdelta_posbranch;; + +let functional_ldih6_x_div_sqrtdelta_posbranch = + Nonlin_def.ldih6_x_div_sqrtdelta_posbranch;; + + +let functional1_rho = prove_by_refinement( + `!y. rho y = y * (const1 * rh0 * (#0.5)) + (&1 - const1 * rh0)`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlinear_lemma.rho_alt;Sphere.h0;rh0]; + REPEAT WEAK_STRIP_TAC; + BY(CONV_TAC REAL_RING) + ]);; + (* }}} *) + +let functional1_flat_term_x = prove_by_refinement( + `!y. flat_term_x y = (sqrt y - &2 * h0) * rh0 * sol0 * (#0.5)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.flat_term_x;Sphere.flat_term;Sphere.h0;rh0]; + REPEAT WEAK_STRIP_TAC; + BY(BY(CONV_TAC REAL_RING)) + ]);; + (* }}} *) + +let functional1_lfun = prove_by_refinement( + `!y. lfun y = ( h0 - y)*rh0`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.lfun;rh0]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + +let functional_rhazim_x = prove_by_refinement( + `domain6 + (\x1 x2 x3 x4 x5 x6. &0 <= x1 /\ &0 <= x2 /\ &0 <= x3 /\ + &0 <= x4 /\ &0 <= x5 /\ &0 <= x6) + rhazim_x + (uni (rho,proj_y1) * dih_x)`, + (* {{{ proof *) + [ + REWRITE_TAC[domain6]; + REWRITE_TAC[Sphere.rhazim_x;Sphere.rhazim;uni;proj_y1;mul6;Sphere.dih_y;LET_DEF;LET_END_DEF]; + REPEAT WEAK_STRIP_TAC; + AP_TERM_TAC; + REPEAT( GMATCH_SIMP_TAC (ISPEC `&0` Nonlinear_lemma.sq_pow2)); + BY(ASM_REWRITE_TAC[REAL_ARITH `&0 pow 2 = &0`;]) + ]);; + (* }}} *) + +let functional_rhazim2_x = prove_by_refinement( + `rhazim2_x = rotate2 rhazim_x`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM]; + BY(REWRITE_TAC[Sphere.node2_y;Sphere.rotate2;Sphere.rhazim2_x;Sphere.rhazim_x;Sphere.rhazim2]) + ]);; + (* }}} *) + +let functional_rhazim3_x = prove_by_refinement( + `rhazim3_x = rotate3 rhazim_x`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM]; + BY(REWRITE_TAC[Sphere.node3_y;Sphere.rotate3;Sphere.rhazim3_x;Sphere.rhazim_x;Sphere.rhazim3]) + ]);; + (* }}} *) + +let functional_taum_x = prove_by_refinement( + `taum_x = rhazim_x + rhazim2_x + + rhazim3_x - constant6 ((&1 + const1)*pi)`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM]; + (REWRITE_TAC[Sphere.taum_x;add6;sub6;mul6;constant6;unit6]); + ]);; + (* }}} *) + +(* extra parameter cases *) + +let functional_arclength_x1 = prove_by_refinement( + `!a b. + domain6 (\x1 x2 x3 x4 x5 x6. &0 <= a /\ &0 <= b) + (arclength_x1 a b) + (compose6 + arclength_x_123 proj_x1 (constant6 (a*a)) (constant6 (b*b)) + dummy6 dummy6 dummy6)`, + (* {{{ proof *) + [ + REWRITE_TAC[domain6;Sphere.arclength_x_123; compose6; Sphere.arclength_x1;proj_x1;constant6;dummy6; Sphere.arclength_y1]; + BY(BY(SIMP_TAC[Nonlinear_lemma.sqrtxx])) + ]);; + (* }}} *) + +let functional_arclength_x2 = prove_by_refinement( + `!a b. + domain6 (\x1 x2 x3 x4 x5 x6. &0 <= a /\ &0 <= b) + (arclength_x2 a b) + (compose6 + arclength_x_123 proj_x2 (constant6 (a*a)) (constant6 (b*b)) + dummy6 dummy6 dummy6)`, + (* {{{ proof *) + [ + REWRITE_TAC[domain6;Sphere.arclength_x_123; compose6; Sphere.arclength_x2;proj_x2;constant6;dummy6; Sphere.arclength_y2]; + BY(BY(SIMP_TAC[Nonlinear_lemma.sqrtxx])) + ]);; + (* }}} *) + +let functional_delta_126_x = prove_by_refinement( + `!a b c. delta_126_x a b c = compose6 delta_x proj_x1 proj_x2 + (constant6 a) (constant6 b) (constant6 c) proj_x6`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[FUN_EQ_THM; Sphere.delta_126_x;constant6;compose6;proj_x1;proj_x2;proj_x6 ]) + ]);; + (* }}} *) + +let functional_delta_234_x = prove_by_refinement( + `!a b c. delta_234_x a b c = compose6 delta_x + (constant6 a) proj_x2 proj_x3 proj_x4 (constant6 b) (constant6 c)`, + (* {{{ proof *) + [ + (REWRITE_TAC[FUN_EQ_THM; Sphere.delta_234_x;constant6;compose6;proj_x2;proj_x3;proj_x4 ]) + ]);; + (* }}} *) + +let functional_delta_135_x = prove_by_refinement( + `!a b c. delta_135_x a b c = compose6 delta_x + proj_x1 (constant6 a) proj_x3 (constant6 b) proj_x5 (constant6 c)`, + (* {{{ proof *) + [ + (REWRITE_TAC[FUN_EQ_THM; Sphere.delta_135_x;constant6;compose6;proj_x1;proj_x3;proj_x5 ]) + ]);; + (* }}} *) + +let functional_rhazim_x_div_sqrt_delta_posbranch = prove_by_refinement( + `rhazim_x_div_sqrtdelta_posbranch = + uni(rho,proj_y1) * dih_x_div_sqrtdelta_posbranch`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[FUN_EQ_THM;Nonlin_def.rhazim_x_div_sqrtdelta_posbranch;mul6;uni;proj_y1;]); + ]);; + (* }}} *) + +let functional_rhazim2_x_div_sqrt_delta_posbranch = prove_by_refinement( + `rhazim2_x_div_sqrtdelta_posbranch = + rotate2 rhazim_x_div_sqrtdelta_posbranch`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[FUN_EQ_THM;Nonlin_def.rhazim2_x_div_sqrtdelta_posbranch;mul6;uni;proj_y1;]); + ]);; + (* }}} *) + +let functional_rhazim3_x_div_sqrt_delta_posbranch = prove_by_refinement( + `rhazim3_x_div_sqrtdelta_posbranch = + rotate3 rhazim_x_div_sqrtdelta_posbranch`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[FUN_EQ_THM;Nonlin_def.rhazim3_x_div_sqrtdelta_posbranch;mul6;uni;proj_y1;]); + ]);; + (* }}} *) + +let functional_tau_residual = prove_by_refinement( + `tau_residual_x = rhazim_x_div_sqrtdelta_posbranch + + rhazim2_x_div_sqrtdelta_posbranch + rhazim3_x_div_sqrtdelta_posbranch `, + (* {{{ proof *) + [ + (REWRITE_TAC[FUN_EQ_THM;Nonlin_def.tau_residual_x;add6]); + ]);; + (* }}} *) + +let functional_halfbump_x1 = prove_by_refinement( + `halfbump_x1 = promote1_to_6 halfbump_x`, + (* {{{ proof *) + [ + REWRITE_TAC[promote1_to_6;Nonlinear_lemma.halfbump_x1;FUN_EQ_THM]; + ]);; + (* }}} *) + +let functional_halfbump_x4 = prove_by_refinement( + `halfbump_x4 = rotate4 halfbump_x1`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Sphere.rotate4;Nonlinear_lemma.halfbump_x4;Nonlinear_lemma.halfbump_x1;FUN_EQ_THM]) + ]);; + (* }}} *) + +(* two repeated defs =gamma2= deprecated. *) +let gamma2_x_div_azim = (* same as truncate_gamma2_x *) + new_definition `gamma2_x_div_azim m x = (&8 - x)* sqrt x / (&24) - + ( (&2 * mm1/ pi) * (&1 - sqrt x / sqrt8) - + (&8 * mm2 / pi) * m * lfun (sqrt x / &2))`;; + +let gamma2_x1_div_a = new_definition `gamma2_x1_div_a m = + promote1_to_6 (gamma2_x_div_azim m)`;; + +let nonf_gamma2_x1_div_a = prove_by_refinement( + `!(m:real) (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real). + gamma2_x1_div_a m x1 x2 x3 x4 x5 x6 = gamma2_x_div_azim m x1`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[FUN_EQ_THM;promote1_to_6;gamma2_x1_div_a]) + ]);; + (* }}} *) + +let nonf_gamma2_x1_div_a_v2 = prove_by_refinement( + `!(m:real) (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real). + gamma2_x1_div_a_v2 m x1 x2 x3 x4 x5 x6 = gamma2_x_div_azim_v2 m x1`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[FUN_EQ_THM;promote1_to_6;Nonlin_def.gamma2_x1_div_a_v2]) + ]);; + (* }}} *) + +let gamma3f_x_div_sqrtdelta = new_definition `gamma3f_x_div_sqrtdelta m4 m5 m6 = + constant6 (&1/ &12) - + (scalar6 ( mk_456 (rotate5 (sol_euler_x_div_sqrtdelta)) + + mk_456 (rotate6 (sol_euler_x_div_sqrtdelta)) + + mk_456 (rotate4 (sol_euler_x_div_sqrtdelta)) + ) (&2 * mm1/ pi) + - + scalar6 ( + (scalar6 (uni(lfun,(scalar6 proj_y4 #0.5))) m4) * + mk_456 (rotate4 (dih_x_div_sqrtdelta_posbranch)) + + (scalar6 (uni(lfun,(scalar6 proj_y5 #0.5))) m5) * + mk_456 (rotate5 (dih_x_div_sqrtdelta_posbranch)) + + (scalar6 (uni(lfun,(scalar6 proj_y6 #0.5))) m6) * + mk_456 (rotate6 (dih_x_div_sqrtdelta_posbranch)) + ) (&8 * mm2 / pi))`;; + +let shift_scalar6 = prove_by_refinement( + `!f g m. (scalar6 f m) * g = f * (scalar6 g m)`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[mul6;scalar6]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let gamma3f_x_div_sqrtdelta_alt = prove_by_refinement( + `!m4 m5 m6. gamma3f_x_div_sqrtdelta m4 m5 m6 = + constant6 (&1/ &12) - + (scalar6 ( mk_456 (rotate5 (sol_euler_x_div_sqrtdelta)) + + mk_456 (rotate6 (sol_euler_x_div_sqrtdelta)) + + mk_456 (rotate4 (sol_euler_x_div_sqrtdelta)) + ) (&2 * mm1/ pi) + - + scalar6 ( + ( (uni(lfun,(scalar6 proj_y4 #0.5))) ) * + (scalar6 (mk_456 (rotate4 (dih_x_div_sqrtdelta_posbranch))) m4) + + ( (uni(lfun,(scalar6 proj_y5 #0.5))) ) * + (scalar6 ( mk_456 (rotate5 (dih_x_div_sqrtdelta_posbranch))) m5) + + ( (uni(lfun,(scalar6 proj_y6 #0.5)))) * + (scalar6 (mk_456 (rotate6 (dih_x_div_sqrtdelta_posbranch))) m6) + ) (&8 * mm2 / pi)) `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[gamma3f_x_div_sqrtdelta]; + BY(REWRITE_TAC[shift_scalar6]) + ]);; + (* }}} *) + +let vol3f_456 = new_definition `vol3f_456 m4 = + scalar6 ( mk_456 (rotate5 sol_x) + + mk_456 (rotate6 sol_x) + + mk_456 (rotate4 sol_x) + ) (&2 * mm1/ pi) + - + scalar6 ( + (scalar6 (uni(lfun,(scalar6 proj_y4 #0.5))) m4) * + mk_456 (rotate4 dih_x) + + (uni(lfun,(scalar6 proj_y5 #0.5))) * + mk_456 (rotate5 dih_x) + + (uni(lfun,(scalar6 proj_y6 #0.5))) * + mk_456 (rotate6 dih_x) + ) (&8 * mm2 / pi)`;; + +let gamma3_x = new_definition `gamma3_x m4 = + mk_456 vol_x - vol3f_456 m4`;; + +let gamma23_full8_x = new_definition `gamma23_full8_x m1 = + (compose6 (gamma3_x m1) + dummy6 dummy6 dummy6 proj_x1 proj_x2 proj_x6) + + (compose6 (gamma3_x m1) + dummy6 dummy6 dummy6 proj_x1 proj_x3 proj_x5) + + scalar6 (dih_x -(mk_126 dih_x + mk_135 dih_x)) (#0.008)`;; + +let gamma23_keep135_x = new_definition `gamma23_keep135_x m1 = + (compose6 (gamma3_x m1) + dummy6 dummy6 dummy6 proj_x1 proj_x3 proj_x5) + + scalar6 (dih_x - mk_135 dih_x) (#0.008)`;; + +let nonf_gamma3_x = prove_by_refinement( + `!m1 x1 x2 x3 x4 x5 x6. + gamma3_x m1 x1 x2 x3 x4 x5 x6 = vol_x (&2) (&2) (&2) x4 x5 x6 - + ((sol_x x5 (&2) x4 (&2) x6 (&2) + + sol_x x6 (&2) x5 (&2) x4 (&2) + + sol_x x4 (&2) x6 (&2) x5 (&2)) * + &2 * + mm1 / pi - + ((lfun (sqrt x4 * #0.5) * m1) * dih_x x4 (&2) x6 (&2) x5 (&2) + + lfun (sqrt x5 * #0.5) * dih_x x5 (&2) x4 (&2) x6 (&2) + + lfun (sqrt x6 * #0.5) * dih_x x6 (&2) x5 (&2) x4 (&2)) * + &8 * + mm2 / pi)`, + (* {{{ proof *) + [ +(REWRITE_TAC[gamma3_x;vol3f_456;mk_456;Sphere.rotate5;Sphere.rotate6;Sphere.rotate4;scalar6;sub6;add6;mul6;constant6;compose6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6;two6;uni;proj_y4;proj_y5;proj_y6;dummy6;mk_126;mk_135]) + ]);; + (* }}} *) + +let nonf_gamma23_full8_x = prove_by_refinement( + `!m1 x1 x2 x3 x4 x5 x6. + gamma23_full8_x m1 x1 x2 x3 x4 x5 x6 = + gamma3_x m1 (&0) (&0) (&0) x1 x2 x6 + + gamma3_x m1 (&0) (&0) (&0) x1 x3 x5 + + (dih_x x1 x2 x3 x4 x5 x6 - + (dih_x x1 x2 (&2) (&2) (&2) x6 + dih_x x1 (&2) x3 (&2) x5 (&2))) * + #0.008`, + (* {{{ proof *) + [ +(REWRITE_TAC[gamma23_full8_x;mk_456;Sphere.rotate5;Sphere.rotate6;Sphere.rotate4;scalar6;sub6;add6;mul6;constant6;compose6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6;two6;uni;proj_y4;proj_y5;proj_y6;dummy6;mk_126;mk_135]) + ]);; + (* }}} *) + +let nonf_gamma23_keep135_x = prove_by_refinement( + `!m1 x1 x2 x3 x4 x5 x6. + gamma23_keep135_x m1 x1 x2 x3 x4 x5 x6 = + gamma3_x m1 (&0) (&0) (&0) x1 x3 x5 + + (dih_x x1 x2 x3 x4 x5 x6 - dih_x x1 (&2) x3 (&2) x5 (&2)) * #0.008 + `, + (* {{{ proof *) + [ +(REWRITE_TAC[gamma23_keep135_x;mk_456;Sphere.rotate5;Sphere.rotate6;Sphere.rotate4;scalar6;sub6;add6;mul6;constant6;compose6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6;two6;uni;proj_y4;proj_y5;proj_y6;dummy6;mk_126;mk_135]) + ]);; + (* }}} *) + +let nonf_gamma3f_x_div_sqrtdelta = prove_by_refinement( + `!m4 m5 m6 x1 x2 x3 x4 x5 x6. + gamma3f_x_div_sqrtdelta m4 m5 m6 x1 x2 x3 x4 x5 x6 = &1 / &12 - + ((sol_euler_x_div_sqrtdelta x5 (&2) x4 (&2) x6 (&2) + + sol_euler_x_div_sqrtdelta x6 (&2) x5 (&2) x4 (&2) + + sol_euler_x_div_sqrtdelta x4 (&2) x6 (&2) x5 (&2)) * + &2 * + mm1 / pi - + ((lfun (sqrt x4 * #0.5) * m4) * + dih_x_div_sqrtdelta_posbranch x4 (&2) x6 (&2) x5 (&2) + + (lfun (sqrt x5 * #0.5) * m5) * + dih_x_div_sqrtdelta_posbranch x5 (&2) x4 (&2) x6 (&2) + + (lfun (sqrt x6 * #0.5) * m6) * + dih_x_div_sqrtdelta_posbranch x6 (&2) x5 (&2) x4 (&2)) * + &8 * + mm2 / pi)`, + (* {{{ proof *) + [ +BY(REWRITE_TAC[gamma3f_x_div_sqrtdelta;mk_456;Sphere.rotate5;Sphere.rotate6;Sphere.rotate4;scalar6;sub6;add6;mul6;constant6;compose6;proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6;two6;uni;proj_y4;proj_y5;proj_y6]) + ]);; + (* }}} *) + + +(* +extra parameter cases scratch +*) + +(* added 2013-May *) + + let F_REWRITE_TAC = REWRITE_TAC[ + Nonlin_def.mud_126_x;Nonlin_def.mu6_x;Nonlin_def.mu_y;Nonlin_def.taud;Nonlin_def.taud_x; + Nonlin_def.ups_126;Nonlin_def.edge2_126_x;Nonlin_def.edge2_flatD_x1; + Nonlin_def.edge2_135_x;Nonlin_def.edge2_234_x; + Nonlin_def.mud_135_x;Nonlin_def.mud_126_x;Nonlin_def.mud_234_x; + Nonlin_def.mudLs_234_x;Nonlin_def.mudLs_126_x;Nonlin_def.mudLs_135_x; + LET_DEF;LET_END_DEF; + Sphere.delta_y; + Sphere.y_of_x;Sphere.flat_term_x;Sphere.flat_term; + compose6;promote3_to_6; + promote1_to_6; domain6; + constant6; + uni; + add6;mul6; + sub6;div6; + proj_y1;proj_y2; + proj_y3;proj_y4; + proj_y5;proj_y6; + dummy6; zero6; + proj_x1;proj_x2; + proj_x4;proj_x3; + proj_x5; proj_x6; +];; + + let taud_x_taud = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + &0 <= y1 /\ &0 <= y2 /\ &0 <= y3 ==> + y_of_x taud_x y1 y2 y3 y4 y5 y6 = taud y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + F_REWRITE_TAC; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_SIMP_TAC[Nonlinear_lemma.sqrtxx]) + ]);; + (* }}} *) + +let mu6_x_mu_y = prove_by_refinement( + `!y1 y2 y3 x4 x5 x6. &0 <= y1 /\ &0 <= y2 /\ &0 <= y3 ==> + mu_y y1 y2 y3 = mu6_x (y1 * y1) ( y2 * y2) (y3 * y3) x4 x5 x6 `, + (* {{{ proof *) + [ + F_REWRITE_TAC; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_SIMP_TAC[Nonlinear_lemma.sqrtxx]) + ]);; + (* }}} *) + +let taud_x_ALT = prove_by_refinement( + `domain6 + (\x1 x2 x3 x4 x5 x6. + (&0 <= x1 /\ &0 <= x2 /\ &0 <= x3)) + taud_x ( (promote1_to_6 flat_term_x) + + (uni(sqrt,delta_x)) * mu6_x)`, + (* {{{ proof *) + [ + F_REWRITE_TAC; + ]);; + (* }}} *) + +let functional_edge2_126_x = prove_by_refinement( + `!d x4 x5. + (edge2_126_x d x4 x5) = + (let a = proj_x6 in + let c4 = constant6 x4 in + let c5 = constant6 x5 in + let b = constant6(-- &1) * compose6 delta_x1 zero6 proj_x2 proj_x1 proj_x6 (c5) (c4) in + let c = constant6 ( d) - compose6 delta_x proj_x1 proj_x2 zero6 (c4) (c5) proj_x6 in + let ups_456 = compose6 ups_126 (c4) (c5) dummy6 dummy6 dummy6 proj_x6 in + let discr = ups_456 * ups_126 + constant6( -- &4*d) * a in + (uni(sqrt,discr) - b) / (constant6 (&2) * a))`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM]; + F_REWRITE_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY_GOAL_THEN `!x1 x2 x3 x4 x5 x6. d - delta_x x3 x1 x2 x6 x4 x5 = (x6) * x3 pow 2 + ( -- delta_x1 (&0) x2 x1 x6 x5 x4) * x3 + (d - delta_x (&0) x2 x1 x6 x5 x4)` (unlist ONCE_REWRITE_TAC); + REWRITE_TAC[Sphere.delta_x;Nonlin_def.delta_x1]; + BY(REAL_ARITH_TAC); + REWRITE_TAC[Nonlinear_lemma.abc_quadratic;Sphere.quadratic_root_plus]; + AP_THM_TAC; + AP_TERM_TAC; + MATCH_MP_TAC (arith `s1 = s2 ==> -- -- d + s1 = s2 - -- &1 * d`); + AP_TERM_TAC; + REWRITE_TAC[Nonlin_def.delta_x1;Sphere.ups_x;Sphere.delta_x]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let functional_edge2_135_x = prove_by_refinement( + `!d x4 x6. + (edge2_135_x d x4 x6) = + compose6 (edge2_126_x d x4 x6) (proj_x1) (proj_x3) (dummy6) (dummy6) (dummy6) (proj_x5)`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM]; + F_REWRITE_TAC; + ]);; + (* }}} *) + +let functional_edge2_234_x = prove_by_refinement( + `!d x5 x6. + edge2_234_x d x5 x6 = + compose6 (edge2_126_x d x5 x6) (proj_x2) (proj_x3) (dummy6) (dummy6) (dummy6) (proj_x4)`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM]; + F_REWRITE_TAC; + ]);; + (* }}} *) + +let nonfunctional_edge2_126_x = prove_by_refinement( + `!d x1 x2 a b c x4 x5 x6. + (edge2_126_x d x4 x5) x1 x2 a b c x6 = + ((sqrt (ups_x x4 x5 x6 * ups_x x1 x2 x6 + (-- &4 * d) * x6) - + -- &1 * delta_x1 (&0) x2 x1 x6 x5 x4) / + (&2 * x6))`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;functional_edge2_126_x]; + F_REWRITE_TAC; + ]);; + (* }}} *) + +let nonfunctional_edge2_135_x = prove_by_refinement( + `!d x1 x3 x5 x4 x6 a b c. + (edge2_135_x d x4 x6) x1 a x3 b x5 c = (sqrt (ups_x x4 x6 x5 * ups_x x1 x3 x5 + (-- &4 * d) * x5) - + -- &1 * delta_x1 (&0) x3 x1 x5 x6 x4) / + (&2 * x5)`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;functional_edge2_126_x;functional_edge2_135_x]; + F_REWRITE_TAC; + ]);; + (* }}} *) + +let nonfunctional_edge2_234_x = prove_by_refinement( + `!d x2 x3 x4 x5 x6 a b c. + (edge2_234_x d x5 x6) a x2 x3 x4 b c = + (sqrt (ups_x x5 x6 x4 * ups_x x2 x3 x4 + (-- &4 * d) * x4) - + -- &1 * delta_x1 (&0) x3 x2 x4 x6 x5) / + (&2 * x4)`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;functional_edge2_126_x;functional_edge2_234_x]; + F_REWRITE_TAC; + ]);; + (* }}} *) + +let functional_mud_135_x = prove_by_refinement( + `!y2 y4 y6. (domain6 (\ x1 x2 x3 x4 x5 x6. &0 <= y2)) + (mud_135_x_v1 y2 y4 y6) + (mul6 (compose6 (mu6_x) (constant6 (y2*y2)) proj_x1 proj_x3 dummy6 dummy6 dummy6) + (uni(sqrt,(delta_135_x (y2*y2) (y4*y4) (y6*y6)))))`, + (* {{{ proof *) + [ + F_REWRITE_TAC; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_SIMP_TAC[Nonlinear_lemma.sqrtxx]) + ]);; + (* }}} *) + +let functional_mud_126_x = prove_by_refinement( + `!y3 y4 y5. (domain6 (\ x1 x2 x3 x4 x5 x6. &0 <= y3)) + (mud_126_x_v1 y3 y4 y5) + (mul6 (compose6 (mu6_x) (constant6 (y3*y3)) proj_x1 proj_x2 dummy6 dummy6 dummy6) + (uni(sqrt,(delta_126_x (y3*y3) (y4*y4) (y5*y5)))))`, + (* {{{ proof *) + [ + F_REWRITE_TAC; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_SIMP_TAC[Nonlinear_lemma.sqrtxx]) + ]);; + (* }}} *) + +let functional_mud_234_x = prove_by_refinement( + `!y1 y5 y6. (domain6 (\ x1 x2 x3 x4 x5 x6. &0 <= y1)) + (mud_234_x_v1 y1 y5 y6) + (mul6 (compose6 (mu6_x) (constant6 (y1*y1)) proj_x2 proj_x3 dummy6 dummy6 dummy6) + (uni(sqrt,(delta_234_x (y1*y1) (y5*y5) (y6*y6)))))`, + (* {{{ proof *) + [ + F_REWRITE_TAC; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_SIMP_TAC[Nonlinear_lemma.sqrtxx]) + ]);; + (* }}} *) + +let nonfunctional_taud_D2 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. taud_D2_num_x x1 x2 x3 x4 x5 x6 = -- #0.07 * + delta_x x1 x2 x3 x4 x5 x6 * + delta_x1 x1 x2 x3 x4 x5 x6 * + &2 * + sqrt x1 - + &1 / &4 * + mu6_x x1 x2 x3 x4 x5 x6 * + (delta_x1 x1 x2 x3 x4 x5 x6 * &2 * sqrt x1) pow 2 + + &1 / &2 * + mu6_x x1 x2 x3 x4 x5 x6 * + delta_x x1 x2 x3 x4 x5 x6 * + (-- &8 * x1 * x4 + delta_x1 x1 x2 x3 x4 x5 x6 * &2)`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.taud_D2_num_x]; + F_REWRITE_TAC; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let nonfunctional_taud_D1 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. taud_D1_num_x x1 x2 x3 x4 x5 x6 = + -- #0.07 * delta_x x1 x2 x3 x4 x5 x6 + + &1 / &2 * + mu6_x x1 x2 x3 x4 x5 x6 * + delta_x1 x1 x2 x3 x4 x5 x6 * + &2 * + sqrt x1 + + sol0 / #0.52 * sqrt (delta_x x1 x2 x3 x4 x5 x6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.taud_D1_num_x]; + F_REWRITE_TAC; + ]);; + (* }}} *) + +let nonfunctional_mu6_x = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + mu6_x x1 x2 x3 x4 x5 x6 = + (#0.012 + #0.07 * (#2.52 - sqrt(x1)) + #0.01 * (#2.52 * &2 - sqrt(x2) - sqrt(x3) ))`, + (* {{{ proof *) + [ + F_REWRITE_TAC; + ]);; + (* }}} *) + +let functional_delta_x1 = prove_by_refinement( + `delta_x1 = rotate4 delta_x4`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;Sphere.rotate4;Nonlin_def.delta_x1;Sphere.delta_x4]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let functional_dnum1 = prove_by_refinement( + `dnum1 = (constant6 (&16) - constant6 (&2) * proj_x4) * proj_x1 + + (proj_x5 - constant6 (&8)) * proj_x2 + (proj_x6 - constant6(&8)) * proj_x3`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;Nonlin_def.dnum1]; + BY(F_REWRITE_TAC) + ]);; + (* }}} *) + +let functional_ups_126 = prove_by_refinement( + `ups_126= two6 * proj_x1 * proj_x6 + two6 * proj_x2 * proj_x6 + two6 * proj_x1 * proj_x2 + - proj_x1 * proj_x1 - proj_x2 * proj_x2 - proj_x6 * proj_x6`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;two6]; + F_REWRITE_TAC; + REWRITE_TAC[Sphere.ups_x]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let nonf_ups_126 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. ups_126 x1 x2 x3 x4 x5 x6 = ups_x x1 x2 x6`, + (* {{{ proof *) + [ + REWRITE_TAC[Nonlin_def.ups_126]; + BY(F_REWRITE_TAC) + ]);; + (* }}} *) + + +let nonf_gamma3f_x_div_sqrt_delta = prove_by_refinement( + `!p1 p2 p3 x1 x2 x3 x4 x5 x6. + gamma3f_x_div_sqrtdelta p1 p2 p3 x1 x2 x3 x4 x5 x6 = &1 / &12 - + ((sol_euler_x_div_sqrtdelta x5 (&2) x4 (&2) x6 (&2) + + sol_euler_x_div_sqrtdelta x6 (&2) x5 (&2) x4 (&2) + + sol_euler_x_div_sqrtdelta x4 (&2) x6 (&2) x5 (&2)) * + &2 * + mm1 / pi - + ((lfun (sqrt x4 * #0.5) * p1) * + dih_x_div_sqrtdelta_posbranch x4 (&2) x6 (&2) x5 (&2) + + (lfun (sqrt x5 * #0.5) * p2) * + dih_x_div_sqrtdelta_posbranch x5 (&2) x4 (&2) x6 (&2) + + (lfun (sqrt x6 * #0.5) * p3) * + dih_x_div_sqrtdelta_posbranch x6 (&2) x5 (&2) x4 (&2)) * + &8 * + mm2 / pi)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Nonlin_def.gamma3f_x_div_sqrtdelta]; + F_REWRITE_TAC; + REWRITE_TAC[Nonlin_def.scalar6]; + F_REWRITE_TAC; + REWRITE_TAC[Nonlin_def.mk_456;Nonlin_def.scalar6]; + F_REWRITE_TAC; + BY(REWRITE_TAC[Nonlin_def.two6;Nonlin_def.scalar6;Sphere.rotate5;Sphere.rotate6;Sphere.rotate4;Nonlin_def.constant6;Nonlin_def.proj_y4;Nonlin_def.proj_y5;Nonlin_def.proj_y6]) + ]);; + (* }}} *) + + + end;; diff --git a/text_formalization/nonlinear/ineq.hl b/text_formalization/nonlinear/ineq.hl new file mode 100644 index 0000000..0753e19 --- /dev/null +++ b/text_formalization/nonlinear/ineq.hl @@ -0,0 +1,3678 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Nonlinear *) +(* Author: Thomas C. Hales *) +(* Date: 2010-05-30 *) +(* ========================================================================== *) + +(* +File of the nonlinear inequalities to be verified by interval arithmetic. +*) + +flyspeck_needs "general/sphere.hl";; +flyspeck_needs "nonlinear/ineqdata3q1h.hl" ;; + +(* XX some Flypaper[] tags exist, without text attribution *) + + + +module Ineq = struct + +open Sphere;; + +(* The nonlinear inequality data has become too widely dispersed over + the project directories. This file is meant to be the authoritative + central repository for inequalities. + + Old sources of information: + (svn 1678 2010-04-26 of NonlinearInequalities.wiki) + software_guide.tex (svn 1760) +*) + +let ineqdoc = ref [];; + +let addtex (a,b,c) = (ineqdoc := (a,b,c)::!ineqdoc);; + +let ineqs = ref ([]:ineq_datum list);; + +let add i = ( + ineqs:= i :: !ineqs; + if (List.mem Tex i.tags) then addtex (Ineqdoc,i.idv,i.doc) else () +);; + +let skip _ = ();; + +let remove idv = ( + ineqs := filter (fun t -> not(t.idv=idv)) (!ineqs) +);; + +let getexact idv = filter (fun t -> (t.idv = idv)) (!ineqs);; + +let getprefix idv = filter (fun t -> (String.length idv <= String.length t.idv) && + (String.sub t.idv 0 (String.length idv) = idv)) (!ineqs);; + +let getfield r = filter (fun t -> mem r t.tags) (!ineqs);; + +(* special tags have all been eliminated. These fields can all be deprecated. +let rec has_delta = function + | [] -> false + | Delta126min t :: _ -> true + | Delta126max t :: _ -> true + | Delta135min t :: _ -> true + | Delta135max t :: _ -> true + | Set_rad2 :: _ -> true + | _ :: a -> has_delta a;; + +let has_special_tags() = filter (function t -> has_delta t.tags) (!Ineq.ineqs);; +*) + +let flypaper_ids idv = + List.flatten( map (function Flypaper s -> s | _ -> []) idv.tags);; + +let all_flypaper() = unions (map flypaper_ids (!ineqs));; + +let do_betas x = all_forall (snd(dest_eq(concl(BETAS_CONV x))));; + +let mk_tplate template r = + do_betas(list_mk_comb (template, r));; + + +(************** DATA SECTION ******************************) + +addtex (Section,"Packing -- Marchal Inequality","");; + +addtex(Comment,"", +"This first series shows that a Marchal 4-cell without any critical edges +is non-negative. +");; + +(******************************************************************************) +(* MARCHAL 4-CELL WITH NO CRITICAL EDGES NONNEGATIVITY *) +(******************************************************************************) + +let TSKAJXY_DERIVED = + { + idv= "TSKAJXY-DERIVED"; + ineq = (all_forall `ineq + [ + (#2.0,y1,sqrt8); + (#2.0,y2,sqrt8); + (#2.0,y3,sqrt8); + (#2.0,y4,sqrt8); + (#2.0,y5,sqrt8); + (#2.0,y6,sqrt8) + ] + (( + ~(critical_edge_y y1) /\ + ~(critical_edge_y y2) /\ + ~(critical_edge_y y3) /\ + ~(critical_edge_y y4) /\ + ~(critical_edge_y y5) /\ + ~(critical_edge_y y6) /\ + &0 < delta_y y1 y2 y3 y4 y5 y6 /\ + rad2_y y1 y2 y3 y4 y5 y6 < &2) ==> + (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun >= &0) )`); + doc="If a four-cell does not have any critical edges then it is + non-negative. Critical edge, delta,rad conditions added 2012-06. + A derivation of this from other inequalities appears in merge_ineq.hl. + "; + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Cfsqp;Xconvert;Derived [];Branching;Eps 1.0e-12;Sharp]; + };; + +(* The following make up merge_ineq.tsk_hyp *) + +add + { + idv= "TSKAJXY-TADIAMB"; + ineq = (all_forall `ineq + [ + (&2 * hplus,y1,sqrt8); + (&2 * hplus,y2,sqrt8); + (#2.0,y3,sqrt8); + (#2.0,y4,sqrt8); + (#2.0,y5,sqrt8); + (#2.0,y6,sqrt8) + ] + ( + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2))`); + doc= "This is a reduction step for main modified Marchal inequality + (for lmfun). Cannot have two adjacent long edges."; + tags = [Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Cfsqp;Xconvert]; + };; + +skip + { + idv= "TSKAJXY-RIBCYXU"; + ineq = (all_forall `ineq + [ + (#2.0,y1,&2 * hminus); + (#2.0,y2,&2 * hminus); + (#2.0,y3,&2 * hminus); + (#2.0,y4,&2 * hminus); + (#2.0,y5,&2 * hminus); + (#2.0,y6,&2 * hminus) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun >= &0) )`); + doc= "If a simplex does not have any critical edges then it is non-negative. + This had long run times, so it has been replaced with the two subcases + -sharp and -sym that do symmetry reductions of the domain."; + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Cfsqp;Xconvert;Branching;Eps 1.0e-12;Sharp;Deprecated]; + };; + +add + { + idv= "TSKAJXY-RIBCYXU sharp"; + ineq = (all_forall `ineq + [ + (#2.0,y1,#2.001); + (#2.0,y2,#2.001); + (#2.0,y3,#2.001); + (#2.0,y4,#2.001); + (#2.0,y5,#2.001); + (#2.0,y6,#2.001) + ] + (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun >= &0)`); + doc= "If a simplex does not have any critical edges then it is non-negative. + "; + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Cfsqp;Xconvert;Branching;Eps 1.0e-12;Sharp]; + };; + +add + { + idv= "TSKAJXY-RIBCYXU sym"; + ineq = (all_forall `ineq + [ + (#2.001,y1,&2 * hminus); + (#2.0,y2,&2 * hminus); + (#2.0,y3,&2 * hminus); + (#2.0,y4,&2 * hminus); + (#2.0,y5,&2 * hminus); + (#2.0,y6,&2 * hminus) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun > &0) \/ + (y1 < y2) \/ (y1 < y3) \/ (y1 < y4) \/ (y1 < y5) \/ (y1 < y6) \/ + (y2 < y3) \/ (y2 < y5) \/ (y2 < y6))`); + doc= " + If a simplex does not have any critical edges then it is non-negative. + By symmetry, wlog y1 is largest and y2 is largest among y2,y3,y5,y6"; + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Cfsqp;Xconvert;Branching]; + };; + +skip + { + idv= "TSKAJXY-IYOUOBF"; + ineq = (all_forall `ineq + [ + (&2 * hplus,y1,sqrt8); + (#2.0,y2,&2 * hminus); + (#2.0,y3,&2 * hminus); + (#2.0,y4,&2 * hminus); + (#2.0,y5,&2 * hminus); + (#2.0,y6,&2 * hminus) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun >= &0) )`); + doc= "If a simplex does not have any critical edges then it is non-negative. + Replaced May 24, 2011 with the symmetrized version to improve execution time."; + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Cfsqp; + Xconvert;Branching;Eps 1.0e-12;Sharp;Deprecated]; + };; + +add + { + idv= "TSKAJXY-IYOUOBF sym"; + ineq = (all_forall `ineq + [ + (&2 * hplus,y1,sqrt8); + (#2.001,y2,&2 * hminus); + (#2.0,y3,&2 * hminus); + (#2.0,y4,&2 * hminus); + (#2.0,y5,&2 * hminus); + (#2.0,y6,&2 * hminus) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun >= &0) \/ + (y2 < y3 ) \/ (y2 < y5) \/ (y2 < y6) )`); + doc= "If a simplex does not have any critical edges then it is non-negative. + By symmetry, we may assume that y2 is the longest of y2,y3,y5,y6"; + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Cfsqp;Xconvert;Branching;Eps 1.0e-12;Sharp]; + };; + +add + { + idv= "TSKAJXY-IYOUOBF sharp v2"; + ineq = (all_forall `ineq + [ + (&2 * hplus,y1,sqrt8); + (#2.0,y2,#2.001); + (#2.0,y3,#2.001); + (#2.0,y4,&2 * hminus); + (#2.0,y5,#2.001); + (#2.0,y6,#2.001) + ] + (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun >= &0)`); + doc= "If a simplex does not have any critical edges then it is non-negative. + Upper bound on y4 corrected from 2.001 to 2 * hminus on 2012-06-15"; + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Cfsqp;Xconvert;Branching;Eps 1.0e-12;Sharp]; + };; + +skip + { + idv= "TSKAJXY-WKGUESB"; + ineq = (all_forall `ineq + [ + (&2 * hplus,y1,sqrt8); + (#2.01,y2,&2 * hminus); + (#2.0,y3,&2 * hminus); + (&2 * hplus,y4,sqrt8); + (#2.0,y5,&2 * hminus); + (#2.0,y6,&2 * hminus) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun > &0) )`); + doc="If a simplex does not have any critical edges then it is non-negative. + Case opposite edges y1,y4 long, and some other edge (y2) at least 2.01. + May 24, 2011. This was replaced with 'TSKAJXY-WKGUESB sym' that reduces + the domain using symmetry, because this was a slow calculation. + "; + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Branching;Cfsqp;Xconvert;Deprecated]; + };; + +add + { + idv= "TSKAJXY-WKGUESB sym"; + ineq = (all_forall `ineq + [ + (&2 * hplus,y1,sqrt8); + (#2.01,y2,&2 * hminus); + (#2.0,y3,&2 * hminus); + (&2 * hplus,y4,sqrt8); + (#2.0,y5,&2 * hminus); + (#2.0,y6,&2 * hminus) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun > &0) \/ + (y2 < y3) \/ (y2 < y5) \/ (y2 < y6) \/ (y1 < y4) )`); + doc="If a simplex does not have any critical edges then it is non-negative. + Add symmetry reductions. + Case y1,y4 long and longest of the other edges is at least 2.01. + Wlog, by symmetry y2. + Wlog, by tetrahedral symmetry, y1 longer than y4. + "; + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Branching;Cfsqp;Xconvert]; + };; + +add + { + idv= "TSKAJXY-XLLIPLS"; + ineq = (all_forall `ineq + [ + (&2 * hplus,y1,sqrt8); + (#2.0,y2,#2.01); + (#2.0,y3,#2.01); + (&2 * hplus,y4,#2.8); + (#2.0,y5,#2.01); + (#2.0,y6,#2.01) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun > &0) )`); + doc= "If a simplex does not have any critical edges then it is non-negative. + Case y1,y4 long, y1 <= 2.8, and all other edges at most 2.01. + Swapped upper bounds on y1,y4 on 2012-06-15. This form is equivalent, + but easier to use. + "; + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Branching;Cfsqp;Xconvert;]; + };; + + add { + idv= "TSKAJXY-eulerA"; + ineq = (all_forall `ineq + [ + (#2.8 pow 2,x1,&8); + (&4,x2,#2.01 pow 2); + (&4,x3,#2.01 pow 2); + (#2.8 pow 2,x4,&8); + (&4,x5,#2.01 pow 2); + (&4,x6,#2.01 pow 2) + ] + (&0 < eulerA_x x1 x2 x3 x4 x5 x6) + `); + doc="Easy bound needed for 'TSKAJXY-GXSABWC DIV'. Added 2012-06."; + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Cfsqp;Derived []]; + };; + + add { + idv= "TSKAJXY-delta_x4"; + ineq = (all_forall `ineq + [ + (&4,x1,#2.01 pow 2); + (&4,x2,#2.01 pow 2); + (#2.8 pow 2,x3,&8); + (&4,x4,#2.01 pow 2); + (&4,x5,#2.01 pow 2); + (#2.8 pow 2,x6,&8) + ] + (&0 < delta_x4 x1 x2 x3 x4 x5 x6) + `); + doc="Easy bound needed for 'TSKAJXY-GXSABWC DIV'. Added 2012-06."; + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Cfsqp;Derived []]; + };; + +add + { + idv= "TSKAJXY-GXSABWC DIV"; + ineq = (all_forall `ineq + [ + (#2.8 pow 2,x1,&8); + (&4,x2,#2.01 pow 2); + (&4,x3,#2.01 pow 2); + (#2.8 pow 2,x4,&8); + (&4,x5,#2.01 pow 2); + (&4,x6,#2.01 pow 2) + ] + ((&1 / &12 - + ( + (&2 * mm1 / pi) * + (sol_euler_x_div_sqrtdelta x1 x2 x3 x4 x5 x6 + + sol_euler345_x_div_sqrtdelta x1 x2 x3 x4 x5 x6 + + sol_euler156_x_div_sqrtdelta x1 x2 x3 x4 x5 x6 + + sol_euler246_x_div_sqrtdelta x1 x2 x3 x4 x5 x6) - + (&8 * mm2 / pi) * ( + ldih2_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 + + ldih3_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 + + ldih5_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 + + ldih6_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 + ) + ) >= &0) \/ + (delta_x x1 x2 x3 x4 x5 x6 < &0) )`); + doc= "If a simplex does not have any critical edges then it is non-negative. + This is a degenerate calculation, because the volume of the simplex tends to zero. + Case y1, y4 long, and all variables near the critical point."; + tags=[Marchal;Flypaper["OXLZLEZ";"TSKAJXY";];Tex;Cfsqp;]; + };; + + +(******************************************************************************) +(* MARCHAL CELL_CLUSTER 4-CELLS, AT LEAST 5 LEAVES, ZTG4 SERIES. *) +(******************************************************************************) + + +addtex(Section,"Packing Cluster Inequality -- Five or more leaves","");; + +addtex(Comment,"", +" +% cc:5bl +Let $B$ be the set of cells in the cluster that lie between any two +consecutive leaves. $B$ is either a singleton set containing a +$4$-cell, or a set of three cells: a $2$-cell and two adjacent +$3$-cells. Write $\\op{azim}(B)$ for the azimuth angle formed by the +two leaves. + + Let + \\[ + a= 0.0560305, \\textand b= -0.0445813. + \\] + + The constants $a$ and $b$ must satisfy $5 a + b (2\\pi) >0$, for the $5$-leaf + case of the cluster inequality. + + The circumradius of a triangle with sides $h_-,h_-,h_-$ is greater than $\\sqrt2$, so + in $4$-cells some edge next to the spine is subcritical. Without loss of generality, we + can assume it is $y_2$. We have the inequality for all $4$-cells: + \\[ + \\gamma(X,L) \\op{wt}(X) + \\beta(\\e,X) \\ge a + b \\azim(X). + \\] + This has many cases \\ineq{ZTGIJCF4 i3 i4 i5 i6}, depending on which edges $y_3,\\ldots,y_6$ + are subcritical, critical, or supercritical. + +\\begin{itemize}\\wasitemize +\\item \\case{1821661595} A $4$-cell $X$ along a spine $e$ satisfies +\\[ +\\gamma_L(X)\\op{wt}(X) + \\beta(e,X) \\ge a + b\\,\\op{azim}(X), +\\] +\\item \\case{7907792228} The $2$-cell $X_2$ and two $3$-cells $X_1,X_3$ +that flank it along a spine $e$ satisfy +\\[ +\\sum_{i=1}^3 \\left(\\gamma_L(X_i)\\op{wt}(X_i) + \\beta(e,X_i)\\right)\\ge a + b\\,\\sum_{i=1}^3\\op{azim}(X_i). +\\] +\\end{itemize}\\wasitemize +Then +\\[ +\\sum_{X\\in B} \\gamma(X,L)\\op{wt}(X) + \\beta(\\ee,X) \\ge a + b\\,\\op{azim}(B). +\\] +It follows that +\\[ +\\Gamma(Z) \\ge 5 a + b\\, (2\\pi) > 0. +\\] +");; + +add + { + idv = "ZTGIJCF0"; + ineq = all_forall `ineq + [(&1,dummy,&1)] + ( &5 * a_spine5 + b_spine5 * &2 * pi > &0)`; + doc = "Calculation of constants for 5 or more leaves"; + tags=[Marchal;Flypaper["OXLZLEZ";];Tex;Cfsqp]; + };; + + + +(* F4 *) + +let template_F4 = `\ y3m y3M y4m y4M y5m y5M y6m y6M w m. ineq + [(&2 * hminus, y1, &2 * hplus); + (&2 ,y2, &2 *hminus); + (y3m,y3,y3M); + (y4m,y4,y4M); + (y5m,y5,y5M); + (y6m,y6,y6M)] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &w + &m *beta_bump_lb > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2))`;; + +let mk_ineq_F4 i3 i4 i5 i6 = + let x i = List.nth [`&2`; `&2 * hminus`; `sqrt8`] i in + let X i = x (i+1) in + let mid i = if (i=1) then 1 else 0 in + let w = 1 + mid i3 + mid i4 + mid i5 + mid i6 in + let m = if (w =2) && (i4 = 1) then `1` else `0` in + mk_tplate template_F4 [x i3;X i3; x i4;X i4; x i5;X i5; x i6 ;X i6; mk_small_numeral w; m];; + +(* +bug fixed July 15, 2011. To many cases were being generated. +0 <, changed to 1= +*) + +let split_F4 i3 i4 i5 i6 = + let split i = (1 = List.nth [1;0;i3;i4;i5;i6] i) in + filter split [0;1;2;3;4;5];; + +(* rewrote May 25, 2011 +let split_F4 i3 i4 i5 i6 = + let sp ls i pos = if (i=1) then ls @ [pos] else ls in + let l0 = [0] in + let l3 = sp l0 i3 2 in + let l4 = sp l3 i4 3 in + let l5 = sp l4 i5 4 in + sp l5 i6 5;; +*) + +let make_F4 i3 i4 i5 i6 = + { + idv = Printf.sprintf "ZTGIJCF4 %d %d %d %d 1821661595" i3 i4 i5 i6; + ineq = mk_ineq_F4 i3 i4 i5 i6; + doc = "This is the $4$-cell inequality for five or more leaves."; + tags=(if (i3,i4,i5,i6)=(0,0,0,0) then [Tex] else [] ) @ [Marchal;Cfsqp;Flypaper["OXLZLEZ";];Xconvert;Penalty(50.0,500.0);Branching;Split (split_F4 i3 i4 i5 i6)]; + };; + + for i3=0 to 1 do +for i4 = 0 to 1 do + for i5 = 0 to 1 do + for i6 = 0 to 1 do + add(make_F4 i3 i4 i5 i6) done done done done;; + +add + { + idv = "MKFKQWU"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus ); + (&2*hminus ,y2,sqrt8 ); + (&2*hminus,y3,sqrt8); + (&2,y4, sqrt8); + (&2*hminus,y5,sqrt8 ); + (&2*hminus,y6,sqrt8 ) + ] + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2)`; + doc= "This is a reduction step for 5-leaf ineq on 4-cells, + with critical edge $y_1$. + It justifies that the shortest edge $y_2$ adjacent to the spine + must be at most 2hminus in 'ZTGIJCF4'. + Added 2012-06. +"; + tags = [Flypaper["OXLZLEZ"];Tex;Cfsqp;Xconvert]; + };; + +add + { + idv = "MKFKQWU halfwt"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus ); + (&2*hplus ,y2,sqrt8 ); + (&2,y3,sqrt8); + (&2*hminus,y4, sqrt8); + (&2,y5,sqrt8 ); + (&2,y6,sqrt8 ) + ] + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2)`; + doc= "This is a reduction step for 5-leaf ineq on 4-cells, + with critical edge $y_1$. + It means that a 4-cell with a beta bump, has edges y2,y3,y5,y6 subcritical. + Used to justify beta approximations in + 'ZTGIJCF4'. + Added 2012-06. +"; + tags = [Flypaper["OXLZLEZ"];Tex;Cfsqp;Xconvert]; + };; + + +(******************************************************************************) +(* MARCHAL 4-CELL QX LOWER BOUNDS *) +(******************************************************************************) + +addtex(Comment,"", +" +Call a $4$-cell a quarter, when it has exactly one critical +edge and all other edges of the simplex have length at most $2 h_-$. +(Actually, strictly less than 2h_-, because if = 2h_-, then critical.) +The weight of any quarter is $1$. +Here we treat 4-cells with at least one critical edge, but not a quarter. +");; + +add +{ + idv = "GLFVCVK4 2477216213"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus); + (&2,y2,sqrt8); + (&2,y3,sqrt8); + (&2,y4,sqrt8); + (&2,y5,sqrt8); + (&2,y6,sqrt8) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun > &0)\/ + (norm2hh y1 y2 y3 y4 y5 y6 < (hplus- hminus) pow 2) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2))`; (* norm2hh was <= *) + doc = " + OXLZLEZ.mod 'gamma_qx' + \\claim{If $X$ is a $4$-cell that is not a quarter, then $\\gamma(X,L)\\ge0$.} + Indeed, if no edge of $X$ is critical, we use 'TSKAJXY-DERIVED'. + If some edge of $X$ is critical, then we may label the edges + so that it is the first, and + this computer calculation treats it. + If the norm condition holds, then it is a quarter. This norm condition seems easier to + check in practice than the conditions defining a quarter. + "; + tags=[Marchal;Flypaper["OXLZLEZ";];Tex;Xconvert;Branching;Split[0;1;2;3;4;5]]; +};; + +add +{ + idv = "GLFVCVK4a 8328676778"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus ); + (&2 ,y2,&2 * hminus ); + (&2,y3,&2 * hminus); + (&2 * hminus ,y4,&2 * hplus ); + (&2,y5,&2 * hminus ); + (&2,y6,&2 * hminus ) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &2 + + beta_bump_force_y y1 y2 y3 y4 y5 y6 > &0)\/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2))`; + doc = " + OXLZLEZ.mod 'gamma_qx' +Let $\\gamma$ be given by Definition~\\ref{def:gammaL}, $\\op{wt}$ by +Definition~\\ref{def:wt}, and $\\beta$ by Definition~\\ref{def:beta}. +If $X$ is any $k$-cell with $k\\in\\{2,3,4\\}$, and if $X$ is not a quarter, then +then +\\[ +\\gamma(X,L) \\op{wt}(X) + \\beta(\\ee,X)\\ge 0. +\\] +% gammaL is nonneg on quarters. cc:qtr + In fact, $\\beta(\\ee,X)=0$, except possibly when $X$ is a $4$-cell with oppositely + arranged critical edges. Hence in most cases, it is enough to check the simpler + inequality $\\gamma(X,L)\\ge0$. This is the verification of the case where the factor + $\\beta$ matters and where all edges are critical or subcritical. + If some edge is supercritical, then the circumradius is at least + \\[ + \\op{rad}(2h_-,2,2,2h_-,2h_+,2) > \\sqrt2, + \\] + and the simplex is not a $4$-cell. + "; + tags=[Marchal;Flypaper["OXLZLEZ";];Tex;Cfsqp;Xconvert;Branching;Split[0;3]]; + };; + +add +{ + idv = "GLFVCVK4 2477216213 y4crit"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus); + (&2 * hminus,y2,&2 * hplus ); + (&2,y3,&2 * hminus); + (&2 * hminus,y4,&2 * hplus); + (&2,y5,&2 * hminus); + (&2,y6,&2 * hminus) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &3 > #0.0057)\/ + (eta_y y1 y2 y6 pow 2 < #1.34 pow 2) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2))`; + doc = " + OXLZLEZ.mod 'gamma_qx' QX + Non-quarter, non beta-half, eta126>1.34, y3 y5 subcritical ==> gwt > 0.0057. + Case: + y4 critical + Non-beta-half because y2 (adj to spine) is not subcritical. + y2 upper bound: Rad[2hminus,2hplus,2,2hminus,2,2]^2 > 2. + y6 upper bound comes eta[2hminus,2hminus,2hminus]>sqrt2. + "; + tags=[Marchal;Flypaper["OXLZLEZ";"Jun2012"];Tex;Xconvert;Branching;Split[0;1;3]]; +};; + +add +{ + idv = "GLFVCVK4 2477216213 y4supercrit"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus); + (&2,y2,&2 * h0); + (&2,y3,&2 * hminus); + (&2 * hplus,y4,sqrt8); + (&2,y5,&2 * hminus); + (&2,y6,&2 * hminus) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &2 > #0.0057)\/ + (eta_y y1 y2 y6 pow 2 < #1.34 pow 2) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2))`; + doc = " + OXLZLEZ.mod 'gamma_qx' QX + Non-quarter, non beta-half, eta126>1.34, y3 y5 subcritical ==> gwt > 0.0057. + Case: + y4 critical + Non-beta-half nonquarter because y4 supercritical. + y2 upper bound: Rad[2hminus,2h0,2,2hplus,2,2]^2 > 2. + y6 upper bound comes eta[2hminus,2hminus,2hminus]>sqrt2. and wlog y6 < y2. + "; + tags=[Marchal;Flypaper["OXLZLEZ";"Jun2012"];Tex;Xconvert;Branching;Split[0]]; +};; + +add +{ + idv = "GLFVCVK4 2477216213 y4subcrit"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus); + (&2 * hminus,y2,sqrt8); + (&2,y3,&2 * hminus); + (&2,y4,&2 * hminus); + (&2,y5,&2 * hminus); + (&2,y6,&2 * hminus) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &2 > #0.0057)\/ + (eta_y y1 y2 y6 pow 2 < #1.34 pow 2) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2))`; + doc = " + OXLZLEZ.mod 'gamma_qx' QX + Non-quarter, non beta-half, eta126>1.34, y3 y5 subcritical ==> gwt > 0.0057. + Case: + y4 subcritical + Non-quarter because y2 (adj to spine) is not subcritical. + y6 upper bound comes eta[2hminus,2hminus,2hminus]>sqrt2. + "; + tags=[Marchal;Flypaper["OXLZLEZ";"Jun2012"];Tex;Xconvert;Branching;Split[0;1]]; +};; + + +add +{ + idv = "BIXPCGW 6652007036 a2"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus); + (&2,y2, sqrt8); + (&2,y3, sqrt8); + (&2,y4, sqrt8); + (&2,y5, sqrt8); + (&2,y6, sqrt8) + ] + ((dih_y y1 y2 y3 y4 y5 y6 < #2.8) )`; + doc = " + OXLZLEZ.mod 'azim_c4' QX and QU + If $X$ is a $4$-cell then $\\dih(X) < 2.8$."; + tags=[Marchal;Flypaper["OXLZLEZ";];Cfsqp;Clusterlp;Tex;Xconvert]; +};; + + + +add +{ + idv = "BIXPCGW 7080972881 a2"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2 * hminus,y2, sqrt8); + (&2,y3, sqrt8); + (&2,y4, sqrt8); + (&2,y5, sqrt8); + (&2,y6, sqrt8) + ] + ((dih_y y1 y2 y3 y4 y5 y6 < #2.3) )`; + doc = " + OXLZLEZ.mod 'g_qxd' QXD + If $X$ is a $4$-cell with a critical edge next to the spine, then $\\dih(X) < 2.3$."; + tags=[Marchal;Flypaper["OXLZLEZ";];Cfsqp;Clusterlp;Tex;Xconvert]; +};; + +add +{ + idv = "BIXPCGW 1738910218 a2"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, sqrt8); + (&2,y3, sqrt8); + (&2,y4, &2 * hplus); + (&2,y5, sqrt8); + (&2,y6, sqrt8) + ] + ( (dih_y y1 y2 y3 y4 y5 y6 < #2.3) )`; + doc = " + OXLZLEZ.mod 'g_qxd' QXD + If $X$ is a $4$-cell with a critical edge opposite spine, then $\\dih(X) < 2.3$."; + tags=[Marchal;Flypaper["OXLZLEZ";];Cfsqp;Clusterlp;Tex;Xconvert]; +};; + + +add +{ + idv = "BIXPCGW b"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, sqrt8); + (&2,y3, sqrt8); + (&2,y4, &2 * hplus); + (&2,y5, sqrt8); + (&2,y6, sqrt8) + ] + ( (delta4_y y1 y2 y3 y4 y5 y6 > &0) \/ (delta_y y1 y2 y3 y4 y5 y6 > &60) \/ (delta_y y1 y2 y3 y4 y5 y6 < &0))`; + doc = " + NONQXD + If $X$ is a $4$-cell with a critical edge opposite spine, then $\\dih(X) < 2.3$."; + tags=[Marchal;Flypaper["OXLZLEZ";];Cfsqp;Clusterlp;Penalty (500.0,500.0);Tex;Xconvert]; +};; + +add +{ + idv = "BIXPCGW 7274157868 a"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (&2 * hplus,y4, sqrt8); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun > #0.0057) \/ + (dih_y y1 y2 y3 y4 y5 y6 < #2.3))`; + doc = " + OXLZLEZ.mod 'g_qxd' QXD + If $X$ is a $4$-cell with a single critical edge (the spine), and if $\\dih(X)\\ge 2.3$, + then $\\gamma(X,L) > 0.0057$. + Domain restricted, Dec 1, 2012. Outside this, we have dih_y < 2.3 anyway."; + tags=[Marchal;Flypaper["OXLZLEZ";];Cfsqp;Clusterlp;Tex;Xconvert;Branching;Split[0]]; +};; + + +add +{ + idv = "QITNPEA 9939613598"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (&2 * hplus,y4, sqrt8); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun - #0.00457511 + - #0.00609451*dih_y y1 y2 y3 y4 y5 y6 > #0.0) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2))`; + doc = " + OXLZLEZ.mod 'azim2' FULLWT + This is an inequality for nonquarter $4$-cells of weight $1$ used to prove the cluster inequality."; + tags=[Marchal;Cfsqp;Flypaper["OXLZLEZ"];Clusterlp;Tex;Xconvert;Branching;Split[0]]; +};; + +(******************************************************************************) +(* MARCHAL CELL_CLUSTER 4-CELL INEQS QX (continued gaz7, gamma8, gaz9) *) +(******************************************************************************) + +(* beta_bump_lb -> beta_bumpA_y 2010-06-23, false otherwise on (i3,i4,i5,i6) = (0,1,0,0) + beta_bumpA_y -> beta_bump_force_y 2010-09-23 +*) + + + +let mk_QITNPEA1 i3 i4 = + let template = `\ y3m y3M y4m y4M w . ineq + [(&2 * hminus, y1, &2 * hplus); + (&2 ,y2, &2 *hminus); + (y3m,y3,y3M); + (y4m,y4,y4M); + (&2 ,y5,&2 *hminus); + (&2 ,y6,&2 * hminus)] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &w // + &m *beta_bump_lb + > #0.0057) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2))` in + let x i = List.nth [`&2`; `&2 * hminus`; `&2 * hplus`; `sqrt8`] i in + let X i = x (i+1) in + let mid i = if (i=1) then 1 else 0 in + let w = 1 + mid i3 + mid i4 in + (* let m = if (w =2) && (i4 = 1) then `1` else `0` in *) + mk_tplate template [x i3;X i3; x i4;X i4; mk_small_numeral w; ];; + +let add_QITNPEA1 i3 i4 = (* if (i3+i4 = 0) then () else *) + add{ + idv = Printf.sprintf "QITNPEA1 %d %d 9063653052 A" i3 i4 ; + ineq = mk_QITNPEA1 i3 i4 ; + doc = " + OXLZLEZ.mod 'gamma8' + This is a $4$-cell (nonquarter) inequality. The four cell is assumed to + have exactly one face along the spine with 2 subcritical (y2,y6). + Note eta[2hminus,2hminus,2hminus]^2 > 2, so each face along the spine has + at least one subcritical, this gives y5 subcritical, wlog. + Dec 1, 2012. Removed beta_bump_lb, since y3 is never subcritical, using beta_bumpA_y. + "; + tags=(if (i3+i4=1) then [Tex] else []) @ [Marchal;Cfsqp;Flypaper["OXLZLEZ";];Xconvert;Penalty(50.0,500.0);Branching;Split (split_F4 i3 i4 0 0)]; + };; + +for i3=1 to 2 do (* start at 1 to force the triangle (y1,y3,y5) not to be small *) +for i4 = 0 to 2 do + add_QITNPEA1 i3 i4 done done;; + +add{ + idv = "QITNPEA 2134082733" ; + ineq = all_forall `ineq [(&2 * hminus, y1, &2 * hplus); + (&2 ,y2, &2 *hminus); + (&2 ,y3,&2 * hminus); + (&2 * hminus,y4,sqrt8); + (&2 ,y5,&2 * hminus); + (&2 ,y6,&2 * hminus)] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &2 + beta_bump_lb + - #0.213849 + #0.119482*dih_y y1 y2 y3 y4 y5 y6 > #0.0 ) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2))`; + doc = " + OXLZLEZ.mod 'gaz9' + This is a $4$-cell (nonquarter) inequality. The two edges along the + spine are small."; + tags=[Marchal;Cfsqp;Flypaper["OXLZLEZ";];Clusterlp;Xconvert;Tex;Branching;Split[0;3]]; +};; + + +(******************************************************************************) +(* MARCHAL 4-CELL QU LOWER BOUNDS *) +(******************************************************************************) + +add + { + idv = "FHBVYXZv2 a"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus ); + (&2 ,y2,&2 * hminus ); + (&2,y3,&2 * hminus); + (&2,y4,&2 * hminus); + (&2,y5,&2 * hminus ); + (&2,y6,&2 * hminus ) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun + > #0.0057)\/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2) \/ (eta_y y1 y3 y5 pow 2 < #1.34 pow 2))`; + doc = " +If $X$ is any quarter, with eta >= 1.34, then +\\[ +\\gamma(X,L) \\ge 0.0057. +\\] + Nov2012: Needed? Yes, see June 23, 2012 notes. + "; + tags=[Marchal;Flypaper["OXLZLEZ";"Jun2012"];Tex;Cfsqp;Xconvert;Branching;Split[0]]; + };; + + + +add + { + idv = "FHBVYXZ a"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus ); + (&2 ,y2,&2 * hminus ); + (&2,y3,&2 * hminus); + (&2,y4,&2 * hminus); + (&2,y5,&2 * hminus ); + (&2,y6,&2 * hminus ) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun + > &0)\/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2) \/ (eta_y y1 y2 y6 pow 2 < #1.34 pow 2))`; + doc = " + OXLZLEZ.mod 'g_quqya' 'g_quqyb' +%old idv: 1118115412, cc:2bl +If $X$ is any quarter, and $Y$ is a $3$-cell that flanks it, then +\\[ +\\gamma(X,L) + \\gamma(Y,L) \\ge 0. +\\] +Nov2012, changed eta_y y1 y3 y5 to eta_y y1 y2 y6. + "; +(* + &0 * gamma3f y1 y3 y5 sqrt2 lmfun dropped *) + tags=[Marchal;Flypaper["OXLZLEZ";];Tex;Cfsqp;Xconvert;Branching;Split[0]]; + };; + + +add + { + idv = "FHBVYXZ b"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus ); + (&2,y2,&2 * hminus ); + (&2,y3,&2 * hminus); + (&2,y4,&2 * hminus); + (&2,y5,&2 * hminus ); + (&2,y6,&2 * hminus ) + ] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun + gamma3f y1 y2 y6 sqrt2 lmfun + > &0)\/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2) \/ (eta_y y1 y2 y6 pow 2 > #1.34 pow 2))`; + doc = " + OXLZLEZ.mod 'g_quqya' 'g_quqyb' +%old idv: 1118115412, cc:2bl +If $X$ is any quarter, and $Y$ is a $3$-cell that flanks it, then +\\[ +\\gamma(X,L) + \\gamma(Y,L) \\ge 0. +\\] + "; + tags=[Marchal;Flypaper["OXLZLEZ";];Tex;Cfsqp;Xconvert;Branching;Split[0]]; + };; + +add + { + idv = "FWGKMBZ"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus ); + (&2 ,y2,sqrt8 ); + (&2,y3,sqrt8); + (&2,y4,sqrt8); + (&2,y5,sqrt8 ); + (&2,y6,sqrt8 ) + ] + (y_of_x delta_x y1 y2 y3 y4 y5 y6 > &0)`; + doc = " + This is used with rad2_x calculations to bound the denominator. + "; + tags=[Marchal;Flypaper["OXLZLEZ";"Nov2012"];Tex;Cfsqp;Xconvert;Branching]; + };; + +add +{ + idv = "BIXPCGW 9455898160"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (&2,y4, &2 * hminus); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun > -- #0.00569) `; + doc = " + OXLZLEZ.mod 'gamma_qu' + If $X$ is a quarter, then $\\gamma(X,L)\\ge -0.00569$."; + tags=[Marchal;Flypaper["OXLZLEZ";];Cfsqp;Clusterlp;Tex;Xconvert;Branching;Split[0]]; +};; + + +add +{ + idv = "QITNPEA 5653753305"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (&2,y4, &2 * hminus); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun + #0.0659 + - #0.042*dih_y y1 y2 y3 y4 y5 y6 > #0.0)`; + doc = " + OXLZLEZ.mod 'azim1' + This is an inequality for quarters used to prove the cluster inequality."; + tags=[Marchal;Cfsqp;Flypaper["OXLZLEZ"];Clusterlp;Tex;Xconvert;Branching;Split[0]]; +};; + +add +{ + idv = "QITNPEA 6206775865"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (#2 ,y4, &2 * hminus); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun + #0.0142852 - #0.00609451 *dih_y y1 y2 y3 y4 y5 y6 > #0.0) `; + doc = " + OXLZLEZ.mod 'gaz4' + This is an inequality for quarters used to prove the cluster inequality."; + tags=[Marchal;Cfsqp;Clusterlp;Flypaper["OXLZLEZ"];Tex;Xconvert;Branching;Split[0]]; +};; + +add +{ + idv = "QITNPEA 5814748276"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (#2 ,y4, &2 * hminus); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun - #0.00127562 + #0.00522841 * dih_y y1 y2 y3 y4 y5 y6 > #0.0) `; + doc = " + OXLZLEZ.mod 'gaz5' + This is an inequality for quarters used to prove the cluster inequality."; + tags=[Marchal;Cfsqp;Clusterlp;Flypaper["OXLZLEZ"];Tex;Xconvert;Branching;Split[0]]; +};; + +add +{ + idv = "QITNPEA 3848804089"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (#2 ,y4, &2 * hminus); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun - #0.161517 + #0.119482* dih_y y1 y2 y3 y4 y5 y6 > #0.0) `; + doc = " + OXLZLEZ.mod 'gaz6' + This is an inequality for quarters used to prove the cluster inequality."; + tags=[Marchal;Cfsqp;Clusterlp;Flypaper["OXLZLEZ"];Tex;Xconvert;Branching;Split[0]]; +};; + + +addtex(Section,"Packing -- Cluster Inequality","");; + + +addtex(Comment,"", +"\\claim{We show that the cluster inequality holds +when there are at most two leaves along the critical +edge.} + Indeed, if the cluster has no quarter, then the inequality follows from \\ineq{GLFVCVK}. +Assume that a quarter exists. Then there are two leaves, which flank the quarter. +Next to the quarter is a three cell, +because the dihedral angle of a $4$-cell is less than $\\pi$. + The quarter and the $3$-cell both have weight $1$. + The result follows from the given inequality. +");; + + + + + + + + +(******************************************************************************) +(* MARCHAL CELL_CLUSTER 3/4-COMBO CELL INEQS *) +(******************************************************************************) + +add{ + idv = "QITNPEA 5400790175 a" ; + ineq = all_forall `ineq [(&2 * hminus, y1, &2 * hplus); + (&2 ,y2, &2 *hminus); + (&2 ,y3,&2 * hminus); + (&2 * hminus,y4,sqrt8); + (&2 ,y5,&2 * hminus); + (&2 ,y6,&2 * hminus)] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &2 + beta_bump_lb > #0.0057) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2) \/ + (eta_y y1 y2 y6 pow 2 < #1.34 pow 2))`; + doc = " + OXLZLEZ.mod 'gamma10' + This is a $4$-cell (nonquarter) and adjacent $3$-cell inequality. + The edges along the spine are small."; + tags=[Marchal;Cfsqp;Flypaper["OXLZLEZ";];Clusterlp;Xconvert;Tex;Branching;Split[0;3]]; +};; + +add{ + idv = "QITNPEA 5400790175 b" ; + ineq = all_forall `ineq [(&2 * hminus, y1, &2 * hplus); + (&2 ,y2, &2 *hminus); + (&2 ,y3,&2 * hminus); + (&2 * hminus,y4,sqrt8); + (&2 ,y5,&2 * hminus); + (&2 ,y6,&2 * hminus)] + ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &2 + beta_bump_lb + + gamma3f y1 y2 y6 sqrt2 lmfun > #0.0057) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2) \/ + (eta_y y1 y2 y6 pow 2 > #1.34 pow 2))`; + doc = " + OXLZLEZ.mod 'gamma11' + This is a $4$-cell (nonquarter) and adjacent $3$-cell inequality. + The edges along the spine are small."; + tags=[Marchal;Cfsqp;Flypaper["OXLZLEZ";];Clusterlp;Xconvert;Tex;Branching;Split[0;3]]; +};; + + +(******************************************************************************) +(* MARCHAL CELL_CLUSTER 2/3-CELLS QY FOR LEMMA OXLZLEZ *) +(******************************************************************************) + +add +{ + idv = "TEWNSCJ"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (&2,y4, sqrt8); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ( + (y_of_x (gamma23_full8_x (h0cut y1)) y1 y2 y3 y4 y5 y6 > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6) \/ + y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2 \/ + eta_y y1 y2 y6 pow 2 > #1.34 pow 2 \/ + eta_y y1 y3 y5 pow 2 > #1.34 pow 2 )`; + doc = " + 5 LEAF INEQ. + Special case of ZTG...F23."; + tags=[Marchal;Flypaper["OXLZLEZ";"Jun2012"];Cfsqp;Clusterlp;Tex;Xconvert;Branching;Split[0]]; +};; + +add +{ + idv = "PEMKWKU"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus); + (&2,y2, sqrt8); + (&2,y3, &2 * hminus); + (&2,y4, sqrt8); + (&2,y5, &2 * hminus); + (&2,y6, sqrt8) + ] + ( + (y_of_x (gamma23_keep135_x (h0cut y1)) + y1 y2 y3 y4 y5 y6 > a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6) \/ + y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2 \/ + dih_y y1 y2 y3 y4 y5 y6 > #1.074 \/ + eta_y y1 y2 y6 pow 2 > &2 \/ + eta_y y1 y2 y6 pow 2 < #1.34 pow 2 \/ + eta_y y1 y3 y5 pow 2 > #1.34 pow 2 )`; + doc = "test"; + tags=[Marchal;Flypaper["OXLZLEZ";"Jun2012"];Cfsqp;Clusterlp;Tex;Xconvert;Branching;Split[0]]; +};; + + +add +{ + idv = "QITNPEAv2 4003532128"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (&2 ,y4, sqrt8); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + (( eta_y y1 y2 y6 pow 2 > #1.34 pow 2 ) \/ + (eta_y y1 y3 y5 pow 2 > #1.34 pow 2) \/ + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2) \/ + (y2 < y3) \/ (y2 < y5) \/ (y2 < y6) \/ + (y_of_x (gamma23_full8_x (h0cut y1)) + y1 y2 y3 y4 y5 y6 - #0.00457511 + - #0.00609451*dih_y y1 y2 y3 y4 y5 y6 > #0.0) + )`; + doc = " + OXLZLEZ.mod 'gaz3a' + (Note the lower bound on $y_4$ is $2.1$. removed June 2012) + This is an inequality for $23$-cells used to prove the cluster inequality. + We may use monotonicity so that rad2 is exactly 2. + By symmetry we may assume that y2 is the longest of y2,y3,y5,y6."; + tags=[Marchal;Cfsqp;Cfsqp_branch 6; + Clusterlp;Flypaper["OXLZLEZ";"Jun2012"];Tex;Xconvert;Branching;Split[0];] +};; + +add{ + idv = "QITNPEA 3725403817"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (#2 ,y4, #2.1); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + (dih_y y1 y2 y3 y4 y5 y6 < #1.56) `; + doc = " + OXLZLEZ.mod 'azim3b' + This is an inequality for $2$- and $3$-cells used to prove the cluster inequality. + Note that $y_4\\le 2.1$. + "; + tags=[Marchal;Cfsqp;Clusterlp;Flypaper["OXLZLEZ"];Tex;Xconvert]; +};; + +add +{ + idv = "TXQTPVC"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (&2,y4, sqrt8); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ( + (y_of_x (gamma23_full8_x (h0cut y1)) + y1 y2 y3 y4 y5 y6 > &3 * #0.0057) \/ + y_of_x rad2_x y1 y2 y3 y4 y5 y6 < &2 \/ + dih_y y1 y2 y3 y4 y5 y6 > #2.089 \/ + dih_y y1 y2 y3 y4 y5 y6 < #1.946 \/ + eta_y y1 y2 y6 pow 2 > #1.34 pow 2 \/ + eta_y y1 y3 y5 pow 2 > #1.34 pow 2 )`; + doc = "test. + Is this needed? tch - 11/2012. Yes, June 22, 2012 notes page 1, in case 3 QX+1 QY"; + tags=[Marchal;Flypaper["OXLZLEZ";"Jun2012"];Cfsqp;Clusterlp;Tex;Xconvert;Branching;Split[0]]; +};; + +add +{ + idv = "IXPOTPA"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus); + (&2,y2, &2 * hminus); + (&2,y3, &2 * hminus); + (sqrt8,y4, &4 * hminus); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + (let tan2lower = #3.07 in ( // Tan[Pi-2.089]^2 + let tan2upper = #6.45 in ( // Tan[Pi-1.946]^2 + delta_y y1 y2 y3 y4 y5 y6 < &0 \/ + delta4_y y1 y2 y3 y4 y5 y6 > &0 \/ + (&4 * x1_delta_y y1 y2 y3 y4 y5 y6 < tan2lower * delta4_squared_y y1 y2 y3 y4 y5 y6) \/ + (&4 * x1_delta_y y1 y2 y3 y4 y5 y6 > tan2upper * delta4_squared_y y1 y2 y3 y4 y5 y6) \/ + eta_y y1 y2 y6 pow 2 > #1.34 pow 2 \/ + eta_y y1 y3 y5 pow 2 > #1.34 pow 2 \/ + (y_of_x (gamma23_full8_x (h0cut y1)) y1 y2 y3 y4 y5 y6 > &3 * #0.0057))))`; + doc = "Dec 2, 2012. This is the case of TXQTPVC, when y4 >= sqrt8. We can't use monotonicty here, + because of the explicit dih constraints."; + tags=[Marchal;Flypaper["OXLZLEZ";"Nov2012"];Cfsqp;Clusterlp;Tex;Xconvert;Branching;Split[0];Cfsqp_branch 6;Penalty(50.0,500.0)]; +};; + +add +{ + idv = "QITNPEA 4003532128 a"; + ineq = all_forall `ineq + [(&2 * hminus,y1, &2 * hplus); + (&2,y2, sqrt8); + (sqrt2,y3,sqrt2); + (sqrt2,y4,sqrt2); + (sqrt2,y5,sqrt2); + (&2,y6, sqrt8) + ] + ( + (delta4_y y1 y2 y3 y4 y5 y6 > &25) \/ + (delta_y y1 y2 y3 y4 y5 y6 > #0.14) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) )`; + doc = " + OXLZLEZ.mod 'gaz3a' + This gives an upper bound $0.08$ on the dihedral angle of the $3$-cell, + when delta < 0.14. + This is an inequality for $23$-cells used to prove the cluster inequality."; + tags=[Marchal;Cfsqp;Clusterlp;Flypaper["OXLZLEZ"];Tex;Xconvert;Branching]; + (* lindih_lt: dih < 0.08 <=> 25*Tan[0.08] > Sqrt[4 (2hplus)^2 0.14] *) + (* lindih_lt: dih < 0.037 <=> 25*Tan[0.037] > Sqrt[4 (2hplus)^2 0.03] *) + (* 2012/6 corrected missing x1: was + d4 > 25 > Tan[Pi/2 - 0.03] Sqrt[4 0.14] ==> dih <= 0.03. *) +};; + + + + +(******************************************************************************) +(* MARCHAL 3-CELL NONNEGATIVITY *) +(******************************************************************************) + + +addtex(Section,"Marchal 3-cell nonnegativity","");; + + +(* next series was added June 24, 2012 to replace old ZTG...F23 + and related inequalities. Verifications are much faster now. *) + + +add +{ + idv = "RQWUDDU"; (* was "testdih" *) + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus); + (&2,y2, sqrt8); + (&2,y3, sqrt8); + (&2,y4, sqrt8); + (&2,y5, sqrt8); + (&2,y6, sqrt8) + ] + ( + dih_y y1 y2 y3 y4 y5 y6 > #0.76 \/ + eta_y y1 y2 y6 pow 2 > &2 \/ + eta_y y1 y3 y5 pow 2 > &2 )`; + doc = "Min angle on a cell along a spine. + Nov 2012: this gets used in jun 23, 2012 notes to reduce to at most 5 leaves."; + tags=[Marchal;Flypaper["OXLZLEZ";"Jun2012"];Cfsqp;Clusterlp;Tex;Xconvert;Branching;Split[0]]; +};; + +add +{ + idv = "GCKBQEA"; + ineq = all_forall `ineq + [(&2 * hminus, y1, &2 * hplus); + (&2,y2, sqrt8); + (&2,y3, sqrt8); + (&2,y4, sqrt8); + (&2,y5, sqrt8); + (&2,y6, sqrt8) + ] + ( + dih_y y1 y2 y3 y4 y5 y6 > #0.606 + )`; + doc = "Min angle on a cell along a spine. + added Dec 2, 2012"; + tags=[Marchal;Flypaper["OXLZLEZ";"Nov2012"];Cfsqp;Clusterlp;Tex;Xconvert;Branching]; +};; + +add +{ + idv = "QZECFIC wt0"; + ineq = all_forall `ineq + [(&1,y1,&1); + (&1,y2,&1); + (&1,y3,&1); + (#2.01,y4,&2 * hminus); + (&2,y5, &2 *hminus); + (&2,y6, &2 * hminus) + ] + ( y_of_x (gamma3f_x_div_sqrtdelta (&1) (&1) (&1)) y1 y2 y3 y4 y5 y6 > &0 + )`; + doc = "positivity of 3-cells on subcritical domain"; + tags=[Marchal;Flypaper["OXLZLEZ";"Nov2012"];Cfsqp;Clusterlp;Tex;Xconvert;Branching]; +};; + +add +{ + idv = "QZECFIC wt0 corner"; + ineq = all_forall `ineq + [(&1,y1,&1); + (&1,y2,&1); + (&1,y3,&1); + (&2,y4,#2.01); + (&2,y5,#2.01); + (&2,y6,#2.01) + ] + ( y_of_x (gamma3f_x_div_sqrtdelta (&1) (&1) (&1)) y1 y2 y3 y4 y5 y6 >= &0 + )`; + doc = "positivity of 3-cells on subcritical domain. Corner near sharp point"; + tags=[Marchal;Flypaper["OXLZLEZ";"Nov2012"];Cfsqp;Clusterlp;Tex;Xconvert;Branching;Sharp;Eps 1.0e-8]; +};; + +add +{ + idv = "QZECFIC wt0 sqrt8"; + ineq = all_forall `ineq + [(&1,y1,&1); + (&1,y2,&1); + (&1,y3,&1); + (&2 * hplus,y4,sqrt8); + (&2,y5, &2 * hminus); + (&2,y6, &2 * hminus) + ] + ( y_of_x (gamma3f_x_div_sqrtdelta (&0) (&1) (&1)) y1 y2 y3 y4 y5 y6 > &0 + \/ eta_y y4 y5 y6 pow 2 > &2 + )`; + doc = "positivity of 3-cells on subcritical domain. + The interval arithmetic calculation must kill off the '0'-branch of dih4, to avoid instability."; + tags=[Marchal;Flypaper["OXLZLEZ";"Nov2012"];Widthcutoff 0.0002;Cfsqp;Clusterlp;Tex;Xconvert;Branching]; +};; + +add +{ + idv = "QZECFIC wt1"; (* was "test ratio" *) + ineq = all_forall `ineq + [(sqrt2,y1,sqrt2); + (sqrt2,y2,sqrt2); + (sqrt2,y3,sqrt2); + (&2 * hminus, y4, &2 * hplus); + (&2 ,y5, &2 * hminus); + (&2 ,y6, &2 * hminus) + ] + ( y_of_x (gamma3f_x_div_sqrtdelta (h0cut y4) (&1) (&1)) y1 y2 y3 y4 y5 y6 > #0.008 * y_of_x dih4_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 \/ + eta_y y4 y5 y6 pow 2 > &2 + )`; + doc = "gamma3f averages at least 0.008 per azim."; + tags=[Marchal;Flypaper["OXLZLEZ";"Jun2012"];Cfsqp;Clusterlp;Tex;Xconvert;Branching;Split[3]]; +};; + +add +{ + idv = "QZECFIC wt2 A"; (* was "test ratio" , y4 y5 swapped, nov 2012, upper bounds on y4 y5 both made sqrt8 on Nov 27, 2012 *) + ineq = all_forall `ineq + [(sqrt2,y1,sqrt2); + (sqrt2,y2,sqrt2); + (sqrt2,y3,sqrt2); + (&2 * hminus ,y4, sqrt8); + (&2 * hminus, y5, sqrt8); + (&2 ,y6, &2 * hminus) + ] + ( y_of_x (gamma3f_x_div_sqrtdelta (h0cut y4) (h0cut y5) (&1)) y1 y2 y3 y4 y5 y6 / &2 > #0.008 * y_of_x dih4_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 \/ + eta_y y4 y5 y6 pow 2 > &2 + )`; + doc = "gamma3f averages at least 0.008 per azim. + We don't have a wt3 case because eta[2hminus,2hminus,2hminus]>sqrt2."; + tags=[Marchal;Flypaper["OXLZLEZ";"Jun2012"];Cfsqp;Clusterlp;Tex;Xconvert;Branching;Split[3;4]]; +};; + +add +{ + idv = "CIHTIUM"; + ineq = all_forall `ineq + [ + (&1,y1,&1); + (&1,y2,&1); + (&1,y3,&1); + (&2 * hminus,y4, sqrt8); + (&2 * hminus ,y5, sqrt8); + (&2 * hminus ,y6, sqrt8) + ] + (eta_y y4 y5 y6 pow 2 > &2 )`; + doc = "every 3-cell has a subcritical edge"; + tags=[Marchal;Flypaper["OXLZLEZ";"Nov2012"];Cfsqp;Clusterlp;Tex;Xconvert;Branching]; +};; + +add +{ + idv = "CJFZZDW"; (* y4 y6 swapped, nov 2012 *) + ineq = all_forall `ineq + [ + (&1,y1,&1); + (&1,y2,&1); + (&1,y3,&1); + (&2 * hplus ,y4, sqrt8); + (&2 * hplus,y5, sqrt8); + (&2,y6, sqrt8) + ] + (eta_y y4 y5 y6 pow 2 > &2 )`; + doc = "no 3-cell has two supercritical edges"; + tags=[Marchal;Flypaper["OXLZLEZ";"Nov2012"];Cfsqp;Clusterlp;Tex;Xconvert;Branching]; +};; + +add +{ + idv = "JSPEVYT"; + ineq = all_forall `ineq + [ + (&1,y1,&1); + (&1,y2,&1); + (&1,y3,&1); + (&2 * hminus,y4, sqrt8); + (&2 * hminus ,y5, sqrt8); + (&2 ,y6, sqrt8) + ] + (eta_y y4 y5 y6 pow 2 > (#1.34) pow 2 )`; + doc = "eta small implies face small"; + tags=[Marchal;Flypaper["OXLZLEZ";"Nov2012"];Cfsqp;Clusterlp;Tex;Xconvert;Branching]; +};; + +(******************************************************************************) +(* MARCHAL 2-CELL NONNEGATIVITY *) +(******************************************************************************) + + +addtex(Section,"Marchal 2-cell nonnegativity","");; + +add +{ + idv = "GRKIBMP A V2"; + ineq = all_forall `ineq + [((&2),y1, (&2 * hplus)); + (&1,y2,&1); + (&1,y3,&1); + (&1,y4,&1); + (&1,y5,&1); + (&1,y6,&1) + ] + (y_of_x (gamma2_x1_div_a_v2 (h0cut y1)) y1 y2 y3 y4 y5 y6 > #0.008 )`; + doc = "gamma2 at least 0.008 per azim along critical edge."; + tags=[Marchal;Flypaper["OXLZLEZ";"Jan2013"];Cfsqp;Clusterlp;Tex;Xconvert; + Branching;Split[0]]; +};; + +add +{ + idv = "GRKIBMP B V2"; + ineq = all_forall `ineq + [((&2 * hplus),y1, (sqrt8)); + (&1,y2,&1); + (&1,y3,&1); + (&1,y4,&1); + (&1,y5,&1); + (&1,y6,&1) + ] + (y_of_x (gamma2_x1_div_a_v2 (&0)) y1 y2 y3 y4 y5 y6 >= &0 )`; + doc = "gamma2 nonnegative in general."; + tags=[Marchal;Flypaper["OXLZLEZ";"Jan2013"];Cfsqp;Clusterlp;Tex;Xconvert;Sharp;Eps 1.0e-8; + Branching;]; +};; + + + + + +(******************************************************************************) +(* MARCHAL CELL_CLUSTER 3Q1H INEQUALITIES FROM ineqdata3q1h.hl *) +(******************************************************************************) + + +(* Add all the inequalities from ineqdata3q1h.hl *) + +let add3q1h = + let records = Ineqdata3q1h.records in + let mk_ineq = Ineqdata3q1h.mk_ineq in + let mk_3q1h case r = + let d = List.nth records r in + let f = mk_ineq case d in + { ineq = f; + idv = Printf.sprintf "OXLZLEZ 6346351218 %d %d" case r; + tags=(if (case,r)=(0,0) then [Tex] else []) @ [Marchal;Clusterlp;Branching;Flypaper["OXLZLEZ";]] @ + (if (case >0) then [Xconvert] else []); + doc = "One of many inequalities for four leaves, three quarters, and + simplex of weight $1/2$"; } in + let mk_3q1hc r = map (fun c -> mk_3q1h c r) (0-- 4) in + let mk_3q1h_all = List.flatten(map (mk_3q1hc) (0--((List.length records)-1))) in + map add mk_3q1h_all;; + + +(******************************************************************************) +(* PACKING COUNTING SPHERES INEQUALITIES *) +(******************************************************************************) + + +addtex (Section,"Packing -- Polyhedra","");; + +add{ +idv = "1965189142 34"; +tags = [Tex;Flypaper["BIEFJHU"]]; +doc = "This inequality gives a linear lower bound on the area of a regular spherical polygon, when $k\\ge 34$"; +ineq = all_forall `ineq + [ + (#1.0,x1,#1.26); (&1,x2,&1);(&1,x3,&1);(&1,x4,&1);(&1,x5,&1);(&1,x6,&1) + ] + (#0.591 - #0.0331 * &34 + #0.506 * lfun_y1 x1 x2 x3 x4 x5 x6 < &0)` +};; + +add{ +idv = "1965189142 a"; +tags = [Tex;Flypaper["BIEFJHU"]]; +doc = " +%old idv: 7991525482, eqn:alin, +This inequality gives a linear lower bound on the area of a regular spherical polygon, when $k\\le 34$. +Let $L$ be given by Definition~\\ref{def:L}. +Let +\\[ +g(h) = \\arccos(h/2) - \\pi/6. +\\] +Let +\\[ +\\op{reg}(a,k) = 2\\pi - 2 k (\\arcsin(\\cos(a)\\sin(\\pi/k))). +\\] +Then +\\[ +\\op{reg}(g(h),k) \\ge c_0 + c_1 k + c_2 L(h),\\quad +k = 3,4,\\ldots,\\quad 1\\le h\\le \\hm. +\\] + The integer parameter $k$ has been replaced with a real variable. If $k\\ge34$, then +the right-hand-side is negative and the inequality is immediate. + The trig identity + \\[ + \\cos(\\acos (h/2) - \\pi/6)) = h \\sqrt(3)/4 + \\sqrt(1-(h/2)^2)/2. + \\] + has been used to simplify the inequality. + "; +ineq = all_forall `ineq + [ + (#1.0,x1,#1.26); + (#3.0,x2,#34.0);(&1,x3,&1);(&1,x4,&1);(&1,x5,&1);(&1,x6,&1) + ] + (&2 * pi - &2 * asnFnhk x1 x2 x3 x4 x5 x6 > #0.591 - #0.0331 * x2 + #0.506 * lfun_y1 x1 x2 x3 x4 x5 x6)` +};; + +add{ +idv = "8055810915"; +tags = [Tex;Flypaper["WAZLDCD"]]; +doc = "This inequality gives the nonoverlap of disks on the unit sphere."; +ineq = all_forall `ineq + [ + (&4, x1, #2.52 pow 2); + (&4,x2,&4); + ((&2 * h0) pow 2,x3,(&2 * h0) pow 2); + (&1,x4,&1); + (&1,x5,&1); + (&1,x6,&1) + ] + (acs_sqrt_x1_d4 x1 x2 x3 x4 x5 x6 - pi/ (&6) + #0.797 < arclength_x_123 x1 x2 x3 x4 x5 x6)`; +};; + +add{ +idv = "6096597438 a"; +tags = [Tex;Flypaper["UKBRPFE"]]; +doc = "This inequality gives a linear lower bound on the area of a regular spherical polygon, when $k\\ge 64$"; +ineq = all_forall `ineq + [ + (#1.0,h,#1.0) + ] + (#0.591 - #0.0331 * &64 + #0.506 * lfun (&1) + #1.0 < &0)` +};; + +add{ +idv = "6096597438 b"; +tags = [Tex;Flypaper["UKBRPFE"]]; +doc = " +% old idv cc:alin2. 8540377696 +Let +\\[ +g(h) = \\arccos(h/2) - \\pi/6. +\\] +Let +\\[ +\\op{reg}(a,k) = 2\\pi - 2 k (\\arcsin(\\cos(a)\\sin(\\pi/k))). +\\] +Let +\\[ a'=0.797\\approx \\arc(2,2,2\\hm)-g(\\hm).\\] Then for $k=3,~4$,\\dots +\\[ \\op{reg}(a',k) \\ge c_0 + c_1 k + c_2 L(1) +c_3.\\] +This inequality gives a linear lower bound on the area of a regular spherical polygon, when $k\\le 64$. + The integer parameter $k$ has been replaced with a real variable. If $k\\ge64$, then +the right-hand-side is negative and the inequality is immediate. + "; +ineq = all_forall `ineq + [ + (#3.0,x1,#64.0); + (&1,x2,&1); (&1,x3,&1); (&1,x4,&1); (&1,x5,&1); (&1,x6,&1) + ] + (&2 * pi - &2 * asn797k x1 x2 x3 x4 x5 x6 > + #0.591 - #0.0331 * x1 + #0.506 * lfun (&1) + #1.0)` +};; + + +(******************************************************************************) +(* LOCAL FAN INEQUALITIES *) +(******************************************************************************) + + +addtex(Section,"Local Fan -- Standard Fan","");; + +add{ +idv = "4717061266"; +ineq = all_forall `ineq +[ +(&2, y1, &2*h0); +(&2, y2, &2*h0); +(&2, y3, &2*h0); +(&2, y4, &2*h0); +(&2, y5, &2*h0); +(&2, y6, &2*h0) +] + (delta_y y1 y2 y3 y4 y5 y6 > &0)`; +tags = [Flypaper["TVAWGDR"];Main_estimate;Tex;Xconvert]; +doc = "A certain configuration of four points cannot be coplanar. + Note 2013-06-27: This doesn't ever get used. I think it can be skipped. + 2013-08-05. Now used in the main estimate. It could be moved there. + "; +};; + +addtex(Section,"Local Fan"," -- Minimal Fan");; + + + +add{ +idv = "SDCCMGA a"; +doc = "This is an arclength estimate. + 2013-06-24. This does not seem to be used anywhere."; +tags = [Tex;Flypaper["SDCCMGA"];Cfsqp;Xconvert]; +ineq = all_forall `ineq + [ + (&2,y1,#2.52); + (&1,y2,&1);(&1,y3,&1);(&1,y4,&1);(&1,y5,&1);(&1,y6,&1) + ] + (arclength_y1 (&2) (&2 * h0) y1 y2 y3 y4 y5 y6 + + arclength_y1 (&2) (&2 * h0) y1 y2 y3 y4 y5 y6 < + arclength_y1 (&2*h0) (&2 * h0) y1 y2 y3 y4 y5 y6 + + &2 * arc_hhn)`; +};; + +add{ +idv = "SDCCMGA b"; +doc = "This is an arclength estimate. + 2013-06-24. This does not seem to be used anywhere."; +tags = [Tex;Flypaper["SDCCMGA"];Cfsqp;Xconvert]; +ineq = all_forall `ineq + [ + (&2,y1,#2.52); + (&1,y2,&1);(&1,y3,&1);(&1,y4,&1);(&1,y5,&1);(&1,y6,&1) + ] + (arclength_y1 (&2) (&2 * h0) y1 y2 y3 y4 y5 y6 + + arclength_y1 (&2) (&2 * h0) y1 y2 y3 y4 y5 y6 < + arclength_y1 (&2*h0) (&2) y1 y2 y3 y4 y5 y6 + + pi / &3 + arc_hhn)`; +};; + + +add{ +idv = "JNTEFVP 1"; +doc = "A quad with a reflex vertex has a diagonal less than $\\sqrt8$. This allows us +to split a quad into two simplices. By extreme edge we can assume the diagonal +is $2h_0$ or $\\sqrt8$. The case $2h_0$ is already done with the triangles."; +tags=[Tex;Cfsqp;Flypaper["JNTEFVP"]]; +ineq = all_forall `ineq + [ + (&4,x1,(&2 * h0) pow 2); + (&4,x2,(&2 * h0) pow 2); + (&4,x3,(&2 * h0) pow 2); + (&4,x4,(&2 * h0) pow 2); + (&4,x5,(&2 * h0) pow 2); + (&8 ,x6, (&4 * h0) pow 2) + ] + (delta_x4 x1 x2 x3 x4 x5 x6 > &0)`; +};; + +addtex (Section,"Tame Hypermap","");; + +add{ + idv = "4652969746 1"; + doc = "This is the calculation of the (p,q)=(5,0) entry in tame table b."; + tags=[Cfsqp;Tex;Tablelp;Flypaper["KCBLRQC"];Xconvert]; + ineq = all_forall `ineq + [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#2.1771,y4,#2.52); + (&2,y5,#2.52); + (&2,y6,#2.52) + ] + (taum y1 y2 y3 y4 y5 y6 > #0.04)`; +};; + + +add{ + idv = "4652969746 2"; + doc = "This is the calculation of the (p,q)=(5,0) entry in tame table b."; + tags=[Cfsqp;Tex;Tablelp;Flypaper["KCBLRQC"];Xconvert]; + ineq = all_forall `ineq + [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.1771); + (&2,y5,#2.52); + (&2,y6,#2.52) + ] + (taum y1 y2 y3 y4 y5 y6 - #0.312 * (dih_y y1 y2 y3 y4 y5 y6 - &2 * pi/ &5) > #0.04 / &5)`; +};; + + +(* interval arithmetic bounds DART4 *) + +add{ + idv = "2570626711"; + doc=""; + tags = [Cfsqp;Tablelp;Flypaper["KCBLRQC"];Xconvert;Tex]; + ineq = all_forall `ineq + [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (&2 * h0,y4,&2 * h0); + (#2.0,y5,&2 * h0); + (#2.0,y6,&2 * h0)] + (dih_y y1 y2 y3 y4 y5 y6 > #1.15)`; +};; + +(******************************************************************************) +(* LINEAR PROGRAM INEQUALITIES *) +(******************************************************************************) + + +addtex(Section,"Linear Programs","");; + +let dart_classes = ref [];; + +let define_dart t = + let th = new_definition t in + let _ = (dart_classes := th :: (!dart_classes)) in + th;; + +(* + The bounds on the four vertices $\\v_1,\\ldots,\\v_4$ gives + the top simplex bound + \\[ + y_4 \\le \\op{edge\\_flat}(2h_0,2h_0,2h_0,2h_0,2h_0) < 4.37 + \\ +*) + +add{ + idv = "3287695934"; + doc=""; + tags = [Cfsqp;Tablelp;Xconvert;Tex]; + ineq = all_forall `ineq + [ + (#4.37,y1,&4 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (&2 * h0,y4,&4 * h0); + (#2.0,y5,&2 * h0); + (#2.0,y6,&2 * h0)] + (delta_y y1 y2 y3 y4 y5 y6 < &0)`; +};; + +let dart_std4 = define_dart `dart_std4 y1 y2 y3 y4 y5 y6 y7 y8 y9 = + [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (&2 * h0,y4,#4.37); + (#2.0,y5,&2 * h0); + (#2.0,y6,&2 * h0); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2 * h0); + (#2.0,y9,&2 * h0)]`;; + + +skip{ + idv = "8673686234"; + doc="Special Nonlinear Inequality for Lp. This is not autogenerated. + $y_1$ is the shorter diagonal. + Ran for 95 million steps and it didn't pass. Replaced with -a, -b, -c below."; + tags = [Cfsqp;Tex;Xconvert;Deprecated]; + ineq = all_forall `ineq [ + (sqrt8,y1,#3.0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (sqrt8,y4,&4 * h0); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) + ] + ((y2 + y3 + y5 + y6 - #7.99 > #2.75 * (y1 - sqrt8)) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ + (y4 < y1)) `; +};; + + +add{ + idv = "8673686234 a"; + doc="Special Nonlinear Inequality for Lp. This is not autogenerated. See head.mod. + $y_1$ is the shorter diagonal. + Cut out a piece near {sqrt8,2,2,sqrt8,2,2}."; + tags = [Cfsqp;Lp_aux "8673686234";Tex;Xconvert]; + ineq = all_forall `ineq [ + (sqrt8,y1,#3.0); + (&2,y2,#2.07); + (&2,y3,#2.07); + (sqrt8,y4,&4 * h0); + (&2,y5,#2.07); + (&2,y6,#2.07) + ] + ((y2 + y3 + y5 + y6 - #7.99 - #0.00385 * delta_y y1 y2 y3 y4 y5 y6 > #2.75 * ((y1 + y4)/ &2 - sqrt8)) + ) `; +};; + +add{ + idv = "8673686234 b"; + doc="Special Nonlinear Inequality for Lp. This is not autogenerated. + $y_1$ is the shorter diagonal. This is the case $y_4\\ge 3$. + Stretch $y_4$ until $\\Delta=0$, then contract $y_4$ within the plane until $y_4=3$."; + tags = [Cfsqp;Lp_aux "8673686234";Tex;Xconvert]; + ineq = all_forall `ineq [ + (sqrt8,y1,#3.0); + (#2.07,y2,&2 * h0); + (&2,y3,&2 * h0); + (#3.0,y4,#3.0); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) + ] + ((y2 + y3 + y5 + y6 - #7.99 > #2.75 * (y1 - sqrt8)) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) ) `; +};; + +add{ + idv = "8673686234 c"; + doc="Special Nonlinear Inequality for Lp. This is not autogenerated. + $y_1$ is the shorter diagonal. This case takes $y_4\\le 3$."; + tags = [Cfsqp;Lp_aux "8673686234";Tex;Xconvert]; + ineq = all_forall `ineq [ + (sqrt8,y1,#3.0); + (#2.07,y2,&2 * h0); + (&2,y3,&2 * h0); + (sqrt8,y4,#3.0); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) + ] + ((y2 + y3 + y5 + y6 - #7.99 > #2.75 * ((y1 + y4)/ &2 - sqrt8)) \/ + (y2 + y3 + y5 + y6 - #7.99 - #0.00385 * delta_y y1 y2 y3 y4 y5 y6 > #2.75 * ((y1 + y4)/ &2 - sqrt8)) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) ) `; +};; + +add +{ + idv="6170936724"; + doc="Special nonlinear inequality for LP. + Used to help prove 8673686234. + Added 2013-06-17."; + tags=[Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&3,y1,&3); + (&2,y2,#2.52); + (&2,y3,#2.52); + (sqrt8,y4,&4 * h0); + (&2,y5,#2.52); + (&2,y6,#2.52) + ] + ( y_of_x delta_x1 y1 y2 y3 y4 y5 y6 < &0)`; +};; + + +addtex(Comment,"Quad convexity justification"," +We can use dimension reduction methods to reduce the number of variables. + This is the reduced version that occurs when the cross diagonal is minimal. + This reduction allows nonconvex deformations. The Dim_red_backsym extremalizes + the edges x8 and x9. However, if the cross-diag $\\le \\sqrt8$, then by + geometric considerations, the cross-diagonal is interior to the quad, and the + subdivision is justified. +");; + +add{ + idv = "7043724150 a"; + doc="We can use dimension reduction methods to reduce the number of variables. + Deprecated 2013-07-29"; +(* \/ (delta_y y4 y9 y6 sqrt8 y5 y8 < &0) *) + tags = [Cfsqp;Tablelp;Flypaper["KCBLRQC"];Lp;Xconvert;Tex;Dim_red_backsym;Quad_cluster 0.001]; + ineq =all_forall `ineq (dart_std4 y1 y2 y3 y4 y5 y6 y7 y8 y9) +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 + #4.72 * dih_y y1 y2 y3 y4 y5 y6 - #6.248 > #0.0) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < sqrt8 ) )`; +};; + +add{ + idv = "7043724150 a reduced v2"; + doc="We can use dimension reduction methods to reduce the number of variables. + This is the reduced version that occurs when the cross diagonal is minimal. + See 'Quad convexity justification' comment. + Corrected 2013-05-01, A.Solovyev / thales, y5 upper bound was &2 * h0. + Deprecated 2013-07-29. + "; + tags = [Cfsqp;Lp_aux "7043724150 a";Xconvert;Tex;]; + ineq =all_forall `ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2,y4,&2 * h0); + (&2 * h0,y5,sqrt8); + (&2,y6,&2 * h0) + ] +( taum y1 y2 y3 y4 y5 y6 + #4.72 * dih_y y1 y2 y3 y4 y5 y6 - #6.248 / &2 > #0.0)`; +};; + + +add + { + idv = "6944699408 a"; + doc="We can use dimension reduction methods to reduce the number of variables. + Deprecated 2013-07-29."; + tags = [Cfsqp;Tablelp;Flypaper["KCBLRQC"];Lp;Xconvert;Tex;Dim_red_backsym;Quad_cluster 0.0005]; + ineq = all_forall `ineq (dart_std4 y1 y2 y3 y4 y5 y6 y7 y8 y9) +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 + #0.972 * dih_y y1 y2 y3 y4 y5 y6 - #1.707 > #0.0) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < sqrt8 ))`; +};; + +add + { + idv = "6944699408 a reduced"; + doc="We can use dimension reduction methods to reduce the number of variables. + This is the reduced version that occurs when the cross diagonal is minimal. + See 'Quad convexity justification' comment. + Deprecated 2013-07-29. + " ; + tags = [Cfsqp;Lp_aux "6944699408 a";Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2,y4,&2 * h0); + (&2 * h0,y5,sqrt8); + (&2,y6,&2 * h0) + ] +( taum y1 y2 y3 y4 y5 y6 + #0.972 * dih_y y1 y2 y3 y4 y5 y6 - #1.707 / &2 > #0.0)`; +};; + +(* constant 1.433 corrected 2010-06-14 *) + +add{ + idv = "4240815464 a"; + doc=""; + tags = [Cfsqp;Tablelp;Flypaper["KCBLRQC"];Tex;Xconvert;Lp;Penalty(10000.0,500.0);Dim_red_backsym;Quad_cluster 0.0001]; + ineq = all_forall `ineq (dart_std4 y1 y2 y3 y4 y5 y6 y7 y8 y9) +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 + + #0.7573 *dih_y y1 y2 y3 y4 y5 y6 - #1.433 > #0.0) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < sqrt8 ) \/ +( delta_y y1 y2 y3 y4 y5 y6 < &0) \/ +( delta_y y7 y2 y3 y4 y8 y9 < &0)) `; +};; + +add{ + idv = "4240815464 a reduced"; + doc="We can use dimension reduction methods to reduce the number of variables. + This is the reduced version that occurs when the cross diagonal is minimal. + See 'Quad convexity justification' comment. "; + tags = [Cfsqp;Lp_aux "4240815464 a";Tex;Xconvert]; + ineq = all_forall `ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2,y4,&2 * h0); + (&2 * h0,y5,sqrt8); + (&2,y6,&2 * h0) + ] +( taum y1 y2 y3 y4 y5 y6 + + #0.7573 *dih_y y1 y2 y3 y4 y5 y6 - #1.433 / &2 > #0.0)`; +};; + + +add{ + idv = "3862621143 revised"; + doc="Revised May 24, 2011 for speed by extending enclosed to 3.01 and y4 to 2.9. + See 'Quad convexity justification' comment."; + tags = [Cfsqp;Tablelp;Flypaper["KCBLRQC"];Tex;Xconvert;Lp;Penalty(10000.0,500.0);Dim_red_backsym;Quad_cluster 0.05]; (* was Quad_cluster 0.0005 *) + ineq = all_forall `ineq (dart_std4 y1 y2 y3 y4 y5 y6 y7 y8 y9) +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 - #0.453 * dih_y y1 y2 y3 y4 y5 y6 + #0.777 > #0.0) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ) \/ +( delta_y y1 y2 y3 y4 y5 y6 < &0) \/ + (y4 < #2.9) \/ +( delta_y y7 y2 y3 y4 y8 y9 < &0)) `; +};; + +add + { + idv = "3862621143 side"; + doc= "Do side splits out to 3.01."; + tags = [Cfsqp;Lp_aux "3862621143 revised";Tex;Xconvert]; + ineq = all_forall `ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2,y4,&2 * h0); + (&2 * h0,y5,#3.01); + (&2,y6,&2 * h0) + ] +( taum y1 y2 y3 y4 y5 y6 - #0.453 * dih_y y1 y2 y3 y4 y5 y6 + #0.777 / &2 > #0.0)`; +};; + +add + { + idv = "3862621143 front"; + doc= "Do front half when y4 <= 2.9 "; + tags = [Cfsqp;Lp_aux "3862621143 revised";Tex;Xconvert]; + ineq = all_forall `ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2 * h0,y4,#2.9); + (&2 ,y5,&2 * h0); + (&2,y6,&2 * h0) + ] +( taum y1 y2 y3 y4 y5 y6 + tame_table_d 2 1 - #0.453 * dih_y y1 y2 y3 y4 y5 y6 + #0.777 > #0.0)`; +};; + +add + { + idv = "3862621143 back"; + doc= " + Back half when y4 <= 2.0. + We know taum > tame_table_d 2 1, when y4 in [sqrt8,3.01]. This extends a bit further. + We could optimize by extremizing y4,y5,y6 and using known triangle calculations."; + tags = [Cfsqp;Lp_aux "3862621143 revised";Tex;Xconvert]; + ineq = all_forall `ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (sqrt8,y4,#3.01); + (&2 ,y5,&2 * h0); + (&2,y6,&2 * h0) + ] +( taum y1 y2 y3 y4 y5 y6 > tame_table_d 2 1)`; +};; + +skip +{ + idv = "3862621143 a"; + doc="This was replaced with '3862621143 revised'. + The revision is mathematically equivalent, but runs about 6 hours faster."; + tags = [Cfsqp;Tablelp;Flypaper["KCBLRQC"];Tex;Xconvert;Lp;Penalty(10000.0,500.0);Dim_red_backsym;Quad_cluster 0.0005;Deprecated]; + ineq = all_forall `ineq (dart_std4 y1 y2 y3 y4 y5 y6 y7 y8 y9) +(( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 - #0.453 * dih_y y1 y2 y3 y4 y5 y6 + #0.777 > #0.0) \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < sqrt8 ) \/ +( delta_y y1 y2 y3 y4 y5 y6 < &0) \/ +( delta_y y7 y2 y3 y4 y8 y9 < &0)) `; +};; + +skip + { + idv = "3862621143 a reduced"; + doc= "This has also been revised. + See 'Quad convexity justification' comment."; + tags = [Cfsqp;Lp_aux "3862621143 a";Tex;Xconvert;Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2,y4,&2 * h0); + (&2 * h0,y5,sqrt8); + (&2,y6,&2 * h0) + ] +( taum y1 y2 y3 y4 y5 y6 - #0.453 * dih_y y1 y2 y3 y4 y5 y6 + #0.777 / &2 > #0.0)`; +};; + +add{ + idv = "5691615370"; + doc="This is one of the hand-entered LP inequalities (perimZ) in head.mod. + \\claim{If a quadrilateral standard region has both diagonals at least $3$, then + the perimeter is at least $8.472$.} Otherwise, + some configuration has perimeter $\\le8.472$. + We may disregard the origin $\\orz$ and + show the result holds for $\\v_1,\\ldots,\\v_4$. We may increase a diagonal, + with fixed perimeter, until the four points are coplanar. We may contract the + diagonals until both equal $3$. This calculation provides the desired inequality. + + May 25, 2011. Symmetry added. Wlog, y2 is the longest edge among y2,y3,y5,y6. + Wlog, y3 is the longest among y3,y6. + "; + tags = [Cfsqp;Lp_aux "5691615370";Lp_aux "9563139965D";Main_estimate;Tex;Xconvert]; + ineq = all_forall `ineq + [ + (#3.0,y1,#3.0); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.0,y4,#3.0); + (&2,y5,#2.52); + (&2,y6,#2.52) + ] + ((delta_y y1 y2 y3 y4 y5 y6 < &0) \/ (y2 + y3 + y5 + y6 > #8.472) \/ + (y2 < y3) \/ (y2 < y5) \/ (y2 < y6 ) \/ (y3 < y6))`; +};; + +skip +{ + idv="3748250573"; + doc="Used with 5691615370. + Added 2013-06-19."; + tags=[Cfsqp;Xconvert;Lp_aux "5691615370";Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2 * h0,y1,&4 * h0); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2 * h0,y4,&4 * h0); + (&2,y5,#2.52); + (&2,y6,#2.52) + ] + ( y_of_x ups_126 y1 y2 y3 y4 y5 y6 > &0 \/ +delta_y y1 y2 y3 y4 y5 y6 < &0 )`; +};; + +add +{ + idv="5584033259"; + doc= "Used with 5691615370. + Added 2013-06-19."; + tags=[Cfsqp;Xconvert;Tex;Lp_aux "5691615370";Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&3,y1,&4 * h0); + (&2,y2,#2.472); + (&2,y3,#2.472); + (&3,y4,&4 * h0); + (&2,y5,#2.472); + (&2,y6,#2.472) + ] + ( y1 < &4 \/ delta_y y1 y2 y3 y4 y5 y6 < &0 )`; +};; + + +(* Second derivative (2986512...) dimension reduction is used on quad + to reduce $y_4$ (the diagonal) to 3. *) + +(* +let dart4_diag3_a = define_dart `dart4_diag3_a y1 y2 y3 y4 y5 y6 y7 y8 y9 = + [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&3,y4,&2 * #2.52); + (&2,y5,#2.52); + (&2,y6,#2.52); + (&2,y7,#2.52); + (&2,y8,#2.52); + (&2,y9,#2.52) + ]`;; +*) + +let dart4_diag3_b = define_dart `dart4_diag3_b y1 y2 y3 y4 y5 y6 y7 y8 y9 = + [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&3,y4,&3); + (&2,y5,#2.52); + (&2,y6,#2.52); + (&2,y7,#2.52); + (&2,y8,#2.52); + (&2,y9,#2.52) + ]`;; (* tchales 2013-05-03, upper bound on y4 should be &2* #2.52. + It is inconsequential because ineq "9563139965D" is not used formally. *) + +(* + We use "add" rather than "skip" on 9563139965D to make it accessible to the linear programs. + However, it is derived from other inequalities. + + Let's start with the ad hoc inequality: 9563139965D. (>= 0.467 ) + By top edge contraction arguments, we may assume that + (0) all top edges have length 2, or + (1) both diagonals have length 3 (by contracting in different ways). + The first case (0) is impossible by geomeric considerations: + edges=2 ==> some diagonal <= sqrt8. + So both diagonals have length 3. + This has been completely solved in a series 9563139965D in ineq.hl. +*) + +add{ + idv = "9563139965D"; + doc = "This is the special Lp estimate for quadrilaterals with both diagonals greater + than 3.0. Dimension reduction can be used to simplify. + Derived from 5691615370 and d,e,f below"; + tags = [Cfsqp;Xconvert;Lp;Tex;Penalty(5.0,500.0);Derived ["d e f"]]; + ineq = all_forall `ineq (dart4_diag3_b y1 y2 y3 y4 y5 y6 y7 y8 y9) +((tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > #0.467) \/ + (enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < &3 ))`; +};; + + +(* Change to 9563139965, change the constant 0.496 to 0.467, then use dimension + reduction below to prove with 5D calcs. Dec 18, 2010. *) + + +add + { + idv = "9563139965 d"; + doc = "This is the special Lp estimate for quadrilaterals with both diagonals greater + than 3.0. Dimension reduction can be used to simplify. This is the reduced case + with both diagonals 3.0. The correction term is based in ineq (5691615...). + It holds for both simplices if the appropriate diagonal is selected. + This is the case where all top edges of quad are at most 2.472."; + tags = [Cfsqp;Lp_aux "9563139965D";Main_estimate;Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&3,y4,&3); + (&2,y5,#2.472); + (&2,y6,#2.472) + ] +((taum y1 y2 y3 y4 y5 y6 + #0.5 * ( #8.472 / &2 - y5 - y6) > #0.467 / &2))`; +};; + +add + { + idv = "9563139965 e"; + doc = "This is the secondary estimate for quadrilaterals with both diagonals greater + than 3.0. Dimension reduction can be used to simplify. This is the reduced case + with both diagonals 3.0. This is the case where some top edges is at least 2.472. + First triangle of split."; + tags = [Cfsqp;Lp_aux "9563139965D";Main_estimate;Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&3,y4,&3); + (#2.467,y5,&2 * h0); + (&2,y6,&2 * h0) + ] +((taum y1 y2 y3 y4 y5 y6 > #0.467 - #0.115))`; +};; + +add + { + idv = "9563139965 f"; + doc = "This is the secondary estimate for quadrilaterals with both diagonals greater + than 3.0. Dimension reduction can be used to simplify. This is the reduced case + with both diagonals 3.0. This is the case where some top edges is at least 2.472. + Second triangle of split."; + tags = [Cfsqp;Lp_aux "9563139965D";Main_estimate;Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&3,y4,&3); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0) + ] +((taum y1 y2 y3 y4 y5 y6 > #0.115))`; +};; + + +addtex(Section,"Linear Programs"," -- dart\_ std3");; + +let dart_std3 = define_dart `dart_std3 y1 y2 y3 y4 y5 y6 = [ + (#2.0,y1,#2.52); + (#2.0,y2,#2.52); + (#2.0,y3,#2.52); + (#2.0,y4,#2.52); + (#2.0,y5,#2.52); + (#2.0,y6,#2.52)]`;; + + + +(* Tame table B inequalities *) + +add{ + idv = "5735387903"; + doc=""; + tags = [Cfsqp;Tablelp;Flypaper["KCBLRQC"];Xconvert;Lp;Tex]; + ineq = all_forall `ineq (dart_std3 y1 y2 y3 y4 y5 y6) + (dih_y y1 y2 y3 y4 y5 y6 > #0.852)`; +};; + + +(* changed from #1.893, to #1.9, for reasons I forget, + thales, 2010-02-28, back again 2010-06-15. *) + +add{ + idv = "5490182221"; + doc=""; + tags = [Cfsqp;Tablelp;Flypaper["KCBLRQC"];Xconvert;Lp;Tex]; + ineq = all_forall `ineq (dart_std3 y1 y2 y3 y4 y5 y6) + (dih_y y1 y2 y3 y4 y5 y6 < #1.893)`; +};; + + +(* +let tame_hypermap_list = + map (fun t -> (getexact t).ineq) ["5735387903";"5490182221";"2570626711"];; +*) + +add{ + idv = "3296257235"; + doc=""; + tags = [Cfsqp;Tablelp;Flypaper["KCBLRQC"];Xconvert;Lp;Tex]; + ineq = all_forall `ineq (dart_std3 y1 y2 y3 y4 y5 y6) + (taum y1 y2 y3 y4 y5 y6 + #0.626 * dih_y y1 y2 y3 y4 y5 y6 - #0.77 > #0.0)`; +};; + +add{ + idv = "8519146937"; + doc=""; + tags = [Cfsqp;Tablelp;Flypaper["KCBLRQC"];Xconvert;Lp;Tex]; + ineq = all_forall `ineq (dart_std3 y1 y2 y3 y4 y5 y6) + ( taum y1 y2 y3 y4 y5 y6 - #0.259 * dih_y y1 y2 y3 y4 y5 y6 + #0.32 > #0.0)`; +};; + +add{ + idv = "4667071578"; + doc=""; + tags = [Cfsqp;Tablelp;Flypaper["KCBLRQC"];Xconvert;Lp;Tex]; + ineq = all_forall `ineq (dart_std3 y1 y2 y3 y4 y5 y6) + ( taum y1 y2 y3 y4 y5 y6 - #0.507 * dih_y y1 y2 y3 y4 y5 y6 + #0.724 > #0.0)`; +};; + +add{ + idv = "1395142356"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = all_forall `ineq + (dart_std3 y1 y2 y3 y4 y5 y6) + ( taum y1 y2 y3 y4 y5 y6 + #0.001 - #0.18 * (y1 + y2 + y3 - #6.0) - + #0.125 * (y4 + y5 + y6 - #6.0) > #0.0)`; +};; + +add{ + idv = "7394240696"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = all_forall `ineq + (dart_std3 y1 y2 y3 y4 y5 y6) +( sol_y y1 y2 y3 y4 y5 y6 - #0.55125 - #0.196 * (y4 + y5 + y6 - #6.0) + + #0.38 * (y1 + y2 + y3 - #6.0) > #0.0)`; +};; + +add{ + idv = "7726998381"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = all_forall `ineq + (dart_std3 y1 y2 y3 y4 y5 y6) +( -- sol_y y1 y2 y3 y4 y5 y6 + #0.5513 + + #0.3232 * (y4 + y5 + y6 - #6.0) - + #0.151 * (y1 + y2 + y3 - #6.0) > #0.0)`; +};; + +add{ + idv = "4047599236"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = all_forall `ineq (dart_std3 y1 y2 y3 y4 y5 y6) +( (dih_y y1 y2 y3 y4 y5 y6) - #1.2308 + + (#0.3639 * (y2 + y3 + y5 + y6 - #8.0)) - + (#0.235 * (y1 - #2.0)) -(#0.685 * (y4 - #2.0)) > #0.0)`; +};; + +add{ + idv = "3526497018"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = all_forall `ineq + (dart_std3 y1 y2 y3 y4 y5 y6) + ( (--dih_y y1 y2 y3 y4 y5 y6) + #1.231 - + (#0.152 * (y2 + y3 + y5 + y6 - #8.0))+ + (#0.5 * (y1 - #2.0)) + (#0.773 * (y4 - #2.0))> #0.0)`; +};; + +add{ + idv = "5957966880"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = all_forall `ineq (dart_std3 y1 y2 y3 y4 y5 y6) +( (rhazim y1 y2 y3 y4 y5 y6) - #1.2308 + + (#0.3639 * (y2 + y3 + y5 + y6 - #8.0)) - + (#0.6 * (y1 - #2.0)) -(#0.685 * (y4 - #2.0)) > #0.0)`; +};; + + + + +addtex(Section,"Linear Programs"," -- dartXYZ");; + +(*more interval arithmetic on nonstandard triangles*) + +let dartX = define_dart `dartX y1 y2 y3 y4 y5 y6 = + [ + (#2.0,y1,#2.52); + (#2.0,y2,#2.52); + (#2.0,y3,#2.52); + (#2.52,y4,#2.52); + (#2.0,y5,#2.52); + (#2.0,y6,#2.52)]`;; + +add{ + idv = "3020140039"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = all_forall `ineq (dartX y1 y2 y3 y4 y5 y6) +( (dih_y y1 y2 y3 y4 y5 y6) - #1.629 + + (#0.402 * (y2 + y3 + y5 + y6 - #8.0)) - + (#0.315 * (y1 - #2.0)) > #0.0)`; +};; + +let dartY = define_dart `dartY y1 y2 y3 y4 y5 y6 = + [ + (#2.0,y1,#2.52); + (#2.0,y2,#2.52); + (#2.0,y3,#2.52); + (sqrt8,y4,sqrt8); + (#2.0,y5,#2.52); + (#2.0,y6,#2.52)]`;; + +add{ + idv = "9414951439"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = all_forall `ineq (dartY y1 y2 y3 y4 y5 y6) +( (dih_y y1 y2 y3 y4 y5 y6) - #1.91 + + (#0.458 * (y2 + y3 + y5 + y6 - #8.0)) - + (#0.342 * (y1 - #2.0)) > #0.0)` ; +};; + +let dart4_diag3 = define_dart `dart4_diag3 y1 y2 y3 y4 y5 y6 = + [ + (#2.0,y1,#2.52); + (#2.0,y2,#2.52); + (#2.0,y3,#2.52); + (#3.0,y4,#3.0); + (#2.0,y5,#2.52); + (#2.0,y6,#2.52)]`;; + +add{ + idv = "9995621667"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = + all_forall `ineq (dart4_diag3 y1 y2 y3 y4 y5 y6) +( (dih_y y1 y2 y3 y4 y5 y6) - #2.09 + + (#0.578 * (y2 + y3 + y5 + y6 - #8.0)) - + (#0.54 * (y1 - #2.0)) > #0.0)`; +};; + +(*branch flat inequality*) + +let apex_flat = define_dart `apex_flat y1 y2 y3 y4 y5 y6 = + [ + (#2.0,y1,#2.52); + (#2.0,y2,#2.52); + (#2.0,y3,#2.52); + (#2.52,y4,sqrt8); + (#2.0,y5,#2.52); + (#2.0,y6,#2.52)]`;; + +add{ + idv = "6988401556"; + doc="We can use extremal edge properties and the tame table D calculations + to reduce to the case where $y_4=\\sqrt8$ and $y_5,y_6$ are extremal."; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = all_forall `ineq (apex_flat y1 y2 y3 y4 y5 y6) +(taum y1 y2 y3 y4 y5 y6 > #0.103)`; +};; + +add{ + idv = "8248508703"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = + all_forall `ineq (apex_flat y1 y2 y3 y4 y5 y6) +( (taum y1 y2 y3 y4 y5 y6) - #0.1 - + (#0.265 * (y5 + y6 - #4.0)) - + (#0.06 * (y4 - #2.52)) - (#0.16 * (y1 - #2.0)) - + (#0.115 * (y2 + y3 - #4.0)) > #0.0)`; +};; + +add{ + idv = "3318775219"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = + all_forall `ineq (apex_flat y1 y2 y3 y4 y5 y6) +( (dih_y y1 y2 y3 y4 y5 y6) - #1.629 + + (#0.414 * (y2 + y3 + y5 + y6 - #8.0)) - + (#0.763 * (y4 - #2.52)) - + (#0.315 * (y1 - #2.0)) > #0.0)`; +};; + +add{ + idv = "9922699028"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = + all_forall `ineq (apex_flat y1 y2 y3 y4 y5 y6) +( (--dih_y y1 y2 y3 y4 y5 y6) + #1.6294 - + (#0.2213 * (y2 + y3 + y5 + y6 - #8.0)) + + (#0.913 * (y4 - #2.52)) + + (#0.728 * (y1 - #2.0)) > #0.0)`; +};; + +add{ + idv = "5000076558"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Lpsymmetry;Tex]; + ineq = + all_forall `ineq (apex_flat y1 y2 y3 y4 y5 y6) +( (dih2_y y1 y2 y3 y4 y5 y6) - #1.083 + + (#0.6365 * (y1 - #2.0)) - + (#0.198 * (y2 - #2.0)) + + (#0.352 * (y3 - #2.0)) + + (#0.416 * (y4 - #2.52)) - + (#0.66 * (y5 - #2.0)) + + (#0.071 * (y6 - #2.0)) > #0.0)`; +};; + +add{ + idv = "9251360200"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = + all_forall `ineq (apex_flat y1 y2 y3 y4 y5 y6) +( (rhazim y1 y2 y3 y4 y5 y6) - #1.629 - + (#0.866 * (y1 - #2.0)) + + (#0.3805 * (y2 + y3 - #4.0)) - + (#0.841 * (y4 - #2.52)) + + (#0.501 * (y5 + y6 - #4.0)) > #0.0)`; +};; + +add{ + idv = "9756015945"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Lpsymmetry;Tex]; + ineq = + all_forall `ineq (apex_flat y1 y2 y3 y4 y5 y6) +( (rhazim2 y1 y2 y3 y4 y5 y6) - #1.08 + + (#0.6362 * (y1 - #2.0)) - + (#0.565 * (y2 - #2.0)) + + (#0.359 * (y3 - #2.0)) + + (#0.416 * (y4 - #2.52)) - + (#0.666 * (y5 - #2.0)) + + (#0.061 * (y6 - #2.0)) > #0.0)`; +};; + +let apex_A = define_dart `apex_A y1 y2 y3 y4 y5 y6 = + [(#2.0, y1, #2.52); +(#2.0, y2, #2.52); +(#2.0, y3, #2.52); +(#2.0, y4, #2.52); +(#2.52, y5, sqrt8); +(#2.52, y6, sqrt8)]`;; + +add{ + idv = "8082208587"; + doc="We can use extremal edge properties and + the tame table D (1,2) calculations + to reduce to the case where $y_4=\\sqrt8$ and $y_5,y_6$ are extremal."; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = all_forall `ineq (apex_A y1 y2 y3 y4 y5 y6) +(taum y1 y2 y3 y4 y5 y6 > #0.2759)`; +};; + +add{ + idv = "5760733457"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = all_forall `ineq (apex_A y1 y2 y3 y4 y5 y6) + (dih_y y1 y2 y3 y4 y5 y6 - #1.0705 -( #0.1 * (y1 - #2)) + + (#0.424 * (y2 - #2.0)) + + (#0.424 * (y3 - #2.0)) - + (#0.594 * (y4 - #2.0)) + + (#0.124 * (y5 - #2.52)) + + (#0.124 * (y6 - #2.52)) > #0.0)`; +};; + +add{ + idv = "2563100177"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = +all_forall `ineq (apex_A y1 y2 y3 y4 y5 y6) +( rhazim y1 y2 y3 y4 y5 y6 - #1.0685 - +(#0.4635 * (y1 - #2.0)) + +(#0.424 * (y2 - #2.0)) + +(#0.424 * (y3 - #2.0)) - +(#0.594 * (y4 - #2.0)) + +(#0.124 * (y5 - #2.52)) + +(#0.124 * (y6 - #2.52)) > #0.0)`; +};; + +add{ + idv = "7931207804"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = +all_forall `ineq (apex_A y1 y2 y3 y4 y5 y6) +( taum y1 y2 y3 y4 y5 y6 - #0.27 + +(#0.0295 * (y1 - #2.0)) - +(#0.0778 * (y2 - #2.0)) - +(#0.0778 * (y3 - #2.0)) - +(#0.37 * (y4 - #2.0)) - +(#0.27 * (y5 - #2.52)) - +(#0.27 * (y6 - #2.52)) > #0.0)`; +};; + +let dart_std3_small = define_dart `dart_std3_small y1 y2 y3 y4 y5 y6 = + [(#2.0, y1, #2.52); +(#2.0, y2, #2.52); +(#2.0, y3, #2.52); +(#2.0, y4, #2.25); +(#2.0, y5, #2.25); +(#2.0, y6, #2.25)]`;; + +add{ + idv = "9225295803"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = +all_forall `ineq (dart_std3_small y1 y2 y3 y4 y5 y6) +(taum y1 y2 y3 y4 y5 y6 + #0.0034 - +(#0.166 * (y1 + y2 + y3 - #6.0)) - +(#0.22 * (y4 + y5 + y6 - #6.0)) > #0.0)`; +};; + +add{ + idv = "9291937879"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = +all_forall `ineq (dart_std3_small y1 y2 y3 y4 y5 y6) +(dih_y y1 y2 y3 y4 y5 y6 - #1.23 - +(#0.235 * (y1 - #2.0)) + +(#0.362 * (y2 + y3 - #4.0)) - +(#0.694 * (y4 - #2.0)) + +(#0.26 * (y5 + y6 - #4.0)) > #0.0)`; +};; + +(* same domain but extra disjunct *) +let dart_std3_big = define_dart `dart_std3_big = dart_std3`;; + +add{ + idv = "7761782916"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = +all_forall `ineq (dart_std3_big y1 y2 y3 y4 y5 y6) +((taum y1 y2 y3 y4 y5 y6 - #0.05 - (#0.137 * (y1 + y2 + y3 - #6.0)) + - (#0.17 * (y4 + y5 + y6 - #6.25)) > #0.0)\/ +(y4 + y5 + y6 < #6.25))`; +};; + +add{ + idv = "6224332984"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = all_forall `ineq (dart_std3_big y1 y2 y3 y4 y5 y6) +((sol_y y1 y2 y3 y4 y5 y6 - #0.589 + +(#0.39 * (y1 + y2 + y3 - #6.0)) - +(#0.235 * (y4 + y5 + y6 - #6.25)) > #0.0) \/ +(y4 + y5 + y6 < #6.25))`; +};; + +let apex_sup_flat = define_dart `apex_sup_flat y1 y2 y3 y4 y5 y6 = + [(#2.0, y1, #2.52); +(#2.0, y2, #2.52); +(#2.0, y3, #2.52); +(sqrt8, y4, #3.0); +(#2.0, y5, #2.52); +(#2.0, y6, #2.52)] + `;; + +add{ + idv = "5451229371"; + doc=""; + tags = [Cfsqp;Tex;Xconvert;Lp]; + ineq = all_forall `ineq (apex_sup_flat y1 y2 y3 y4 y5 y6) + (taum y1 y2 y3 y4 y5 y6 - #0.11 + - #0.14132 * (y1 + (y2 + y3) / &2 - &4) + - #0.38 * (y5 + y6 - &4) > &0)`; +};; + + +add{ + idv = "4840774900"; + doc=""; + tags = [Cfsqp;Tex;Xconvert;Lp]; + ineq = all_forall `ineq (apex_sup_flat y1 y2 y3 y4 y5 y6) + ( + taum y1 y2 y3 y4 y5 y6 - #0.1054 + - #0.14132*(y1 + y2 / &2 + y3 / &2 - &4) + - #0.36499*(y5 +y6 - &4) > &0)`; +};; + +add{ + idv = "1642527039"; + doc=""; + tags = [Cfsqp;Tex;Xconvert;Lp]; + ineq = all_forall `ineq (apex_sup_flat y1 y2 y3 y4 y5 y6) + ( + taum y1 y2 y3 y4 y5 y6 - #0.128 + - #0.053*((y5 +y6 - &4) - (#2.75/ &2)*(y4 - sqrt8)) > &0)`; +};; + +add{ + idv = "7863247282"; + doc=""; + tags = [Cfsqp;Tex;Xconvert;Lp]; + ineq = all_forall `ineq (apex_sup_flat y1 y2 y3 y4 y5 y6) + (taum y1 y2 y3 y4 y5 y6 - #0.053*((y5 +y6 - &4) - (#2.75/ &2)*(y4 - sqrt8)) + - #0.12 + - #0.14132*(y1 + y2 / &2 + y3 / &2 - &4) + - #0.328*(y5 +y6 - &4) > &0)`; (* corrected 2010-06-22, thales, was y4 + y5, was >= *) +};; + +add{ + idv = "7718591733"; + doc=""; + tags = [Cfsqp;Tex;Xconvert;Lp]; + ineq = all_forall `ineq (apex_sup_flat y1 y2 y3 y4 y5 y6) + (dih2_y y1 y2 y3 y4 y5 y6 - #0.955 + - #0.2356*(y2 - &2) + + #0.32*(y3 - &2) + #0.792*(y1 - &2) + - #0.707*(y5 - &2) + + #0.0844*(y6 - &2) + #0.821*(y4 - sqrt8) > &0)`; (* corrected 2010-06-22, was >= *) +};; + +add{ + idv = "3566713650"; + doc=""; + tags = [Cfsqp;Tex;Xconvert;Lp]; + ineq = all_forall `ineq (apex_sup_flat y1 y2 y3 y4 y5 y6) + ( + -- dih_y y1 y2 y3 y4 y5 y6 + #1.911 + #1.01 *(y1 - &2) + - #0.284*(y2 +y3 +y5 +y6 - &8) + + #1.07*(y4 - sqrt8) > &0)`; (* was >= *) +};; + +add{ + idv = "1085358243"; + doc=""; + tags = [Cfsqp;Tex;Xconvert;Lp]; + ineq = all_forall `ineq (apex_sup_flat y1 y2 y3 y4 y5 y6) + ( + dih_y y1 y2 y3 y4 y5 y6 - #1.903 - #0.4*(y1 - &2) + + #0.49688*(y2 +y3 +y5 +y6 - &8) + -(y4 -sqrt8) > &0)`; +};; + +(* use this if there is no smallness constraint *) + +let dart_std3_mini = define_dart `dart_std3_mini y1 y2 y3 y4 y5 y6 = + [ + (#2,y1,#2.18); + (&2,y2,#2.18); + (&2,y3,#2.18); + (&2,y4,#2.25); + (&2,y5,#2.25); + (&2,y6,#2.25) + ]` ;; + + +add{ + idv = "9229542852"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = all_forall `ineq (dart_std3_mini y1 y2 y3 y4 y5 y6) +(dih_y y1 y2 y3 y4 y5 y6 - #1.230 - +(#0.2357 * (y1 - #2.0)) + +(#0.2493 * (y2 + y3 - #4.0)) - +(#0.682 * (y4 - #2.0)) + +(#0.3035 * (y5 + y6 - #4.0)) > #0.0)`; +};; + +add{ + idv = "1550635295"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = all_forall `ineq (dart_std3_mini y1 y2 y3 y4 y5 y6) +(--(dih_y y1 y2 y3 y4 y5 y6) + #1.232 + +(#0.261 * (y1 - #2.0)) - +(#0.203 * (y2 + y3 - #4.0)) + +(#0.772 * (y4 - #2.0)) - +(#0.191 * (y5 + y6 - #4.0)) > #0.0)`; +};; + +add{ + idv = "4491491732"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = all_forall `ineq (dart_std3_mini y1 y2 y3 y4 y5 y6) +(taum y1 y2 y3 y4 y5 y6 + #0.0008 - +(#0.1631 * (y1 + y2 + y3 - #6.0)) - +(#0.2127 * (y4 + y5 + y6 - #6.0)) > #0.0)`; +};; + +let apex_flat_hll = define_dart + `apex_flat_hll y1 y2 y3 y4 y5 y6 = [(#2.18, y1, #2.52); +(#2.0, y2, #2.18); +(#2.0, y3, #2.18); +(#2.52, y4, sqrt8); +(#2.0, y5, #2.52); +(#2.0, y6, #2.52)]`;; + +add{ + idv = "8282573160"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = all_forall `ineq (apex_flat_hll y1 y2 y3 y4 y5 y6) +(taum y1 y2 y3 y4 y5 y6 - #0.1413 - +(#0.214 * (y1 - #2.18)) - +(#0.1259 * (y2 + y3 - #4.0)) - +(#0.067 * (y4 - #2.52)) - +(#0.241 * (y5 + y6 - #4.0)) > #0.0)`; +};; + +let dart_std3_big_200_218 = define_dart + `dart_std3_big_200_218 y1 y2 y3 y4 y5 y6 = [(#2.0, y1, #2.18); +(#2.0, y2, #2.18); +(#2.0, y3, #2.18); +(#2.0, y4, #2.52); +(#2.0, y5, #2.52); +(#2.0, y6, #2.52)]`;; + +add{ + idv = "8611785756"; + doc=""; + tags = [Cfsqp;Xconvert;Lp;Tex]; + ineq = all_forall `ineq (dart_std3_big_200_218 y1 y2 y3 y4 y5 y6) +((sol_y y1 y2 y3 y4 y5 y6 - #0.589 + +(#0.24 * (y1 + y2 + y3 - #6.0)) - +(#0.16 * (y4 + y5 + y6 - #6.25)) > #0.0) \/ +(y4 + y5 + y6 < #6.25))`; +};; + +(* 181212899 is applied in six different ways, each with a different dart class. *) +let dart_template = `\dart_class y4min y4max. dart_class + (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) = + [ + (#2.0, y1, #2.52); + (#2.0, y2, #2.52); + (#2.0, y3, #2.52); + (y4min, y4, y4max); + (#2.0, y5, #2.52); + (#2.52, y6, sqrt8)]`;; + +let dart_template_reverse = `\dart_class y4min y4max. dart_class + (y1:real) (y2:real) (y3:real) (y4:real) (y5:real) (y6:real) = + [ + (#2.0, y1, #2.52); + (#2.0, y2, #2.52); + (#2.0, y3, #2.52); + (y4min, y4, y4max); + (#2.52, y5, sqrt8); + (#2.0, y6, #2.52)]`;; + +let tyR = `:real->real->real->real->real->real-> (real#real#real)list`;; + +let mk_dart rev (x,y,z) = + let x' = if (is_var x) then mk_var(fst(dest_var x),tyR) else x in + let plate = if (rev) then dart_template_reverse else dart_template in + snd(strip_forall (mk_tplate plate [x';y;z]));; + +let newdef rev t = define_dart (mk_dart rev t);; + +let apexffA = newdef false (`apexffA`,`#2.52`,`sqrt8`);; (* NB ff comes before f on this *) +let apexfA = newdef true (`apexfA`,`#2.52`,`sqrt8`);; +let apexf4 = newdef false (`apexf4`,`sqrt8`,`sqrt8`);; +let apexff4 = newdef true (`apexff4`,`sqrt8`,`sqrt8`);; +let apexf5 = newdef false (`apexf5`,`#2.52`,`#2.52`);; +let apexff5 = newdef true (`apexff5`,`#2.52`,`#2.52`);; + +let template_181212899= `\dart_class y4e y2' y3' y5' y6'. ineq (dart_class y1 y2 y3 y4 y5 y6) +(dih_y y1 y2 y3 y4 y5 y6 - #1.448 - +(#0.266 * (y1 - #2.0)) + +(#0.295 * (y2' - #2.0)) + +(#0.57 * (y3' - #2.0)) - +(#0.745 * (y4e - #2.52)) + +(#0.268 * (y5' - #2.0)) + +(#0.385 * (y6' - #2.52)) > #0.0)`;; +(* coefficients corrected, April 28, 2010, June 20, 2010-thales *) + +let mk_iqd rev (d,dart,y4e) = + let yy = if rev then [`y3:real`;`y2:real`;`y6:real`;`y5:real`] else + [`y2:real`;`y3:real`;`y5:real`;`y6:real`] in + let ineq = mk_tplate template_181212899([dart;y4e] @ yy) in + { + idv = Printf.sprintf "181212899 %d" d; + doc = if (d=0) then + "This original version of the inequality. There are five other derived versions." else ""; + tags = [Cfsqp;Xconvert;Lp] @ (if (d>0) then [Derived []] else [Tex]); + ineq = all_forall ineq; + };; + +add (mk_iqd false (0,`apexffA`,`y4:real`));; +add (mk_iqd true (1,`apexfA`,`y4:real`));; +add (mk_iqd false (2,`apexf4`,`sqrt8`));; +add (mk_iqd true (3,`apexff4`,`sqrt8`));; +add (mk_iqd false (4,`apexf5`,`#2.52`));; +add (mk_iqd true (5,`apexff5`,`#2.52`));; + +addtex(Section,"Linear Programs"," -- apex std3 hll");; + +let apex_std3_hll = define_dart `apex_std3_hll y1 y2 y3 y4 y5 y6 = + [ + (#2.18,y1,#2.52); + (&2,y2,#2.18); + (&2,y3,#2.18); + (&2,y4,#2.52); + (&2,y5,#2.52); + (&2,y6,#2.52) + ]`;; + +let apex_std3_small_hll = define_dart `apex_std3_small_hll y1 y2 y3 y4 y5 y6 = + [ + (#2.18,y1,#2.52); + (&2,y2,#2.18); + (&2,y3,#2.18); + (&2,y4,#2.25); + (&2,y5,#2.25); + (&2,y6,#2.25) + ]`;; + +let dart_mll_w = define_dart `dart_mll_w y1 y2 y3 y4 y5 y6 = + [ + (#2.18,y1,#2.36); + (&2,y2,#2.18); + (&2,y3,#2.18); + (#2.25,y4,#2.52); + (&2,y5,#2.52); + (&2,y6,#2.52) + ]` ;; + +let dart_mll_n = define_dart `dart_mll_n y1 y2 y3 y4 y5 y6 = + [ + (#2.18,y1,#2.36); + (&2,y2,#2.18); + (&2,y3,#2.18); + (&2,y4,#2.25); + (&2,y5,#2.52); + (&2,y6,#2.52) + ]` ;; + +let dart_Hll_n = define_dart `dart_Hll_n y1 y2 y3 y4 y5 y6 = + [ + (#2.36,y1,#2.52); + (&2,y2,#2.18); + (&2,y3,#2.18); + (&2,y4,#2.25); + (&2,y5,#2.52); + (&2,y6,#2.52) + ]` ;; + +let dart_Hll_w = define_dart `dart_Hll_w y1 y2 y3 y4 y5 y6 = + [ + (#2.36,y1,#2.52); + (&2,y2,#2.18); + (&2,y3,#2.18); + (#2.25,y4,#2.52); + (&2,y5,#2.52); + (&2,y6,#2.52) + ]` ;; + +let dart_mll_w = define_dart `dart_mll_w y1 y2 y3 y4 y5 y6 = + [ + (#2.18,y1,#2.36); + (&2,y2,#2.18); + (&2,y3,#2.18); + (#2.25,y4,#2.52); + (&2,y5,#2.52); + (&2,y6,#2.52) + ]` ;; + +(* repeated *) +let dart_mll_n = define_dart `dart_mll_n y1 y2 y3 y4 y5 y6 = + [ + (#2.18,y1,#2.36); + (&2,y2,#2.18); + (&2,y3,#2.18); + (&2,y4,#2.25); + (&2,y5,#2.52); + (&2,y6,#2.52) + ]` ;; + +let dart_Hll_n = define_dart `dart_Hll_n y1 y2 y3 y4 y5 y6 = + [ + (#2.36,y1,#2.52); + (&2,y2,#2.18); + (&2,y3,#2.18); + (&2,y4,#2.25); + (&2,y5,#2.52); + (&2,y6,#2.52) + ]` ;; + +let dart_Hll_w = define_dart `dart_Hll_w y1 y2 y3 y4 y5 y6 = + [ + (#2.36,y1,#2.52); + (&2,y2,#2.18); + (&2,y3,#2.18); + (#2.25,y4,#2.52); + (&2,y5,#2.52); + (&2,y6,#2.52) + ]` ;; + +let templateC = `\ dart_class + f fc f0 c1 c2 c3 c4 c5 c6 y1min y2min y3min y4min y5min y6min . + ineq (dart_class y1 y2 y3 y4 y5 y6) + ( fc * f y1 y2 y3 y4 y5 y6 > f0 + + c1 * (y1 - y1min) + c2 *(y2- y2min) + c3 * (y3 - y3min) + + c4 * (y4 - y4min) + c5 *(y5- y5min) + c6 * (y6 - y6min))`;; + +let yymin = dest_list `[#2.18;&2;&2;&2;&2;&2]`;; + +let iqd s dart sym t = + let c = mk_mconst (dart,tyR) in { + idv = s; + doc = ""; + tags = [Cfsqp;Xconvert;Lp;] @ (if sym then [Lpsymmetry] else []); + ineq = mk_tplate templateC (c:: t); +};; + +add(iqd "2151506422" "apex_std3_hll" false + ([`dih_y`;`&1`;`#1.2777`] @ dest_list + `[#0.281; -- #0.278364; -- #0.278364; #0.7117; -- #0.34336; -- #0.34336]` @ + yymin));; + +add(iqd "6836427086" "apex_std3_hll" false + ([`dih_y`;`-- &1`;`-- #1.27799`] @ dest_list + `[-- #0.356217; #0.229466; #0.229466; -- #0.949067; #0.172726; #0.172726]` @ + yymin));; + +add(iqd "3636849632" "apex_std3_hll" false + ([`taum`;`&1`;`#0.0345`] @ dest_list + `[#0.185545; #0.193139; #0.193139; #0.170148; #0.13195; #0.13195]` @ + yymin));; + +add(iqd "5298513205" "apex_std3_hll" true + ([`dih2_y`;`&1`;`#1.185`] @ dest_list + `[-- #0.302913; #0.214849; -- #0.163775; -- #0.443449; #0.67364; -- #0.314532]` @ + yymin));; + +add(iqd "7743522046" "apex_std3_hll" true + ([`dih2_y`;`-- &1`;`-- #1.1865`] @ dest_list + `[#0.20758; -- #0.236153; #0.14172; #0.263834; -- #0.771203; #0.0457292]` @ + yymin));; + +let yymin_plus = dest_list `[#2.36;&2;&2;#2.25;&2;&2]`;; + +add(iqd "8657368829" "apex_std3_small_hll" false + ([`dih_y`;`&1`;`#1.277`] @ dest_list + `[#0.273298; -- #0.273853; -- #0.273853; #0.708818; -- #0.313988; -- #0.313988]` @ + yymin));; + +add(iqd "6619134733" "apex_std3_small_hll" false + ([`dih_y`;`-- &1`;`-- #1.27799`] @ dest_list + `[-- #0.439002; #0.229466; #0.229466; -- #0.771733; #0.208429; #0.208429]` @ + yymin));; + +add(iqd "1284543870" "apex_std3_small_hll" true + ([`dih2_y`;`&1`;`#1.185`] @ dest_list + `[-- #0.372262; #0.214849; -- #0.163775; -- #0.293508; #0.656172; -- #0.267157]` @ + yymin));; + +add(iqd "4041673283" "apex_std3_small_hll" true + ([`dih2_y`;`-- &1`;`-- #1.1864`] @ dest_list + `[#0.20758; -- #0.236153; #0.14172; #0.263109; -- #0.737003; #0.12047]` @ + yymin));; + +add(iqd "3872614111" "dart_mll_w" false + ([`dih_y`;`-- &1`;`-- #1.542`] @ dest_list + `[-- #0.362519; #0.298691; #0.287065; -- #0.920785; #0.190917; #0.219132]` @ + yymin_plus));; + +add(iqd "3139693500" "dart_mll_n" false + ([`dih_y`;`-- &1`;`-- #1.542`] @ dest_list + `[-- #0.346773; #0.300751; #0.300751; -- #0.702567; #0.172726; #0.172727]` @ + yymin_plus));; + +add(iqd "4841020453" "dart_Hll_n" false + ([`dih_y`;`-- &1`;`-- #1.542`] @ dest_list + `[-- #0.490439; #0.318125; #0.32468; -- #0.740079; #0.178868; #0.205819]` @ + yymin_plus));; + +add(iqd "9925287433" "dart_Hll_w" false + ([`dih_y`;`-- &1`;`-- #1.542`] @ dest_list + `[-- #0.490439; #0.321849; #0.320956; -- #1.00902; #0.240709; #0.218081]` @ + yymin_plus));; + +add(iqd "7409690040" "dart_mll_w" true + ([`dih2_y`;`&1`;`#1.0494`] @ dest_list + `[-- #0.297823; #0.215328; -- #0.0792439; -- #0.422674; #0.647416; -- #0.207561]` @ + yymin_plus));; + +add(iqd "4002562507" "dart_mll_n" true + ([`dih2_y`;`&1`;`#1.0494`] @ dest_list + `[-- #0.29013; #0.215328; -- #0.0715511; -- #0.267157; #0.650269; -- #0.295198]` @ + yymin_plus));; + +add(iqd "5835568093" "dart_Hll_n" true + ([`dih2_y`;`&1`;`#1.0494`] @ dest_list + `[-- #0.404131; #0.212119; -- #0.0402827; -- #0.299046; #0.643273; -- #0.266118]` @ + yymin_plus));; + + add(iqd "1894886027" "dart_Hll_w" true + ([`dih2_y`;`&1`;`#1.0494`] @ dest_list + `[-- #0.401543; #0.207551; -- #0.0294227; -- #0.494954; #0.605453; -- #0.156385]` @ + yymin_plus));; + + +(* NOW DATA SECTION OF NEW DART CLASSES THAT HAVE BEEN FOUND *) + + +let dart_std3_lw = define_dart `dart_std3_lw y1 y2 y3 y4 y5 y6 = + [ + (#2.00,y1,#2.18); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#2.25,y4,#2.52); + (&2,y5,#2.52); + (&2,y6,#2.52) + ]` ;; + +(* NOW DATA SECTION OF NEW INEQUALITIES THAT HAVE BEEN FOUND *) + +(* +generate_ineq_datum "mDihedral2" + "{2,2,2,2.52,2,2}" "{2.52,2.52,2.52,sqrt8,2.52,2.52}";; + +Annoyance: have to manually edit `--#X.XX` -> `-- #X.XX` +*) + +let i4750199435 = + {ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (apex_flat y1 y2 y3 y4 y5 y6) + (--dih2_y y1 y2 y3 y4 y5 y6 + #0.0031 > + -- #1.08346 + + #0.288794 * (-- &2 + y1) + + -- #0.292829 * (-- &2 + y2) + + #0.036457 * (-- &2 + y3) + + #0.348796 * (-- #2.52 + y4) + + -- #0.762602 * (-- &2 + y5) + + -- #0.112679 * (-- &2 + y6))`; + idv = "4750199435"; + doc = + "date{2010, 8, 1, 7, 59, 42.645902} + ineq generated by Mathematica holineq + The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + +add i4750199435;; + +(* 8384511215;; +generate_ineq_datum_p "Dihedral2" "{2,2,2.52,sqrt8,2,2}" + "{2,2,2,2.52,2,2}" "{2.52,2.52,2.52,sqrt8,2.52,2.52}";; +*) + +let i8384511215 = {ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (apex_flat y1 y2 y3 y4 y5 y6) + (dih2_y y1 y2 y3 y4 y5 y6 + #0.0015 > + #0.913186 + + -- #0.390288 * (-- &2 + y1) + + #0.115895 * (-- &2 + y2) + + #0.164805 * (-- #2.52 + y3) + + -- #0.271329 * (-- #2.82843 + y4) + + #0.584817 * (-- &2 + y5) + + -- #0.170218 * (-- &2 + y6))`; + idv = "8384511215"; + doc = + "date{2010, 8, 1, 12, 24, 31.880776}\n ineq generated by Mathematica holineq\n The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + +add i8384511215;; + +(* +7819193535; +generate_ineq_datum "Dihedral2" + "{2,2,2,2.25,2,2}" "{2.18,2.52,2.52,2.52,2.52,2.52}";; +*) + +let i7819193535 = {ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (dart_std3_lw y1 y2 y3 y4 y5 y6) + (dih2_y y1 y2 y3 y4 y5 y6 + #0.0011 > + #1.16613 + + -- #0.296776 * (-- &2 + y1) + + #0.208935 * (-- &2 + y2) + + -- #0.243302 * (-- &2 + y3) + + -- #0.360575 * (-- #2.25 + y4) + + #0.636205 * (-- &2 + y5) + + -- #0.295156 * (-- &2 + y6))`; + idv = "7819193535"; + doc = + "date{2010, 8, 1, 14, 6, 32.558867}\n ineq generated by Mathematica holineq\n The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + +add i7819193535;; + +(* remove "2621779878";; *) + +(* +let ii = generate_ineq_datum_p "Dihedral2" "{2.36,2,2,2.52,2,2.25}" + "{2.18,2,2,2.25,2,2}" "{2.36,2.18,2.18,2.52,2.52,2.52}";; +*) + +let i6987934000 = {ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (dart_mll_w y1 y2 y3 y4 y5 y6) + (dih2_y y1 y2 y3 y4 y5 y6 + #0.0042 > + #0.952682 + + -- #0.268837 * (-- #2.36 + y1) + + #0.130607 * (-- &2 + y2) + + -- #0.168729 * (-- &2 + y3) + + -- #0.0831764 * (-- #2.52 + y4) + + #0.580152 * (-- &2 + y5) + + #0.0656612 * (-- #2.25 + y6))`; + idv = "6987934000"; + doc = + "date{2010, 8, 1, 17, 50, 0.245131}\n ineq generated by Mathematica holineq\n The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + +add i6987934000;; + +let i7291663656 = {ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (apex_flat y1 y2 y3 y4 y5 y6) + (dih2_y y1 y2 y3 y4 y5 y6 + #0.0009 > + #0.947391 + + -- #0.637397 * (-- &2 + y1) + + #0.120003 * (-- &2 + y2) + + -- #0.100814 * (-- #2.3 + y3) + + -- #0.302956 * (-- #2.65 + y4) + + #0.547359 * (-- &2 + y5) + + -- #0.157745 * (-- #2.2 + y6))`; + idv = "7291663656"; + doc = + "date{2010, 8, 2, 15, 44, 43.580639}\n ineq generated by Mathematica holineq\n Generated by generate_ineq_datum_p with input Dihedral2 {2,2,2.3,2.65,2,2.2} {2,2,2,2.52,2,2} {2.52,2.52,2.52,sqrt8,2.52,2.52}.\n The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + +add i7291663656;; + +let i2390583444= {ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (dart_std3_mini y1 y2 y3 y4 y5 y6) + (dih_y y1 y2 y3 y4 y5 y6 + #0.0012 > + #1.08627 + + #0.159149 * (-- &2 + y1) + + -- #0.198496 * (-- #2.1 + y2) + + -- #0.199306 * (-- #2.1 + y3) + + #0.590083 * (-- &2 + y4) + + -- #0.0888111 * (-- #2.25 + y5) + + -- #0.0881846 * (-- #2.25 + y6))`; + idv = "2390583444"; + doc = + "date{2010, 8, 2, 17, 51, 29.665035}\n ineq generated by Mathematica holineq\n Generated by generate_ineq_datum_p with input Dihedral {2,2.1,2.1,2,2.25,2.25} {2,2,2,2,2,2} {2.18,2.18,2.18,2.25,2.25,2.25}.\n The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + +add i2390583444;; + + +let apex_flat_l = define_dart `apex_flat_l y1 y2 y3 y4 y5 y6 = + [ + (#2,y1,#2.18); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#2.52,y4,sqrt8); + (&2,y5,#2.52); + (&2,y6,#2.52) + ]` ;; + +let apex_flat_h = define_dart `apex_flat_h y1 y2 y3 y4 y5 y6 = + [ + (#2.18,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#2.52,y4,sqrt8); + (&2,y5,#2.52); + (&2,y6,#2.52) + ]` ;; + + +add{ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (apex_flat_l y1 y2 y3 y4 y5 y6) + (dih2_y y1 y2 y3 y4 y5 y6 + #0.0071 > + #0.98362 + + -- #0.264094 * (-- #2.18 + y1) + + #0.149308 * (-- #2.18 + y2) + + -- #0.312683 * (-- &2 + y3) + + -- #0.282792 * (-- #2.65 + y4) + + #0.581552 * (-- &2 + y5) + + #0.143669 * (-- #2.3 + y6))`; + idv = "9641946727"; + doc = + "date{2010, 8, 2, 20, 0, 47.561405}\n ineq generated by Mathematica holineq\n Generated by generate_ineq_datum_p with input Dihedral2 {2.18,2.18,2,2.65,2,2.3} {2,2,2,2.52,2,2} {2.18,2.52,2.52,sqrt8,2.52,2.52}.\n The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + +let apex_std3_lll_xww = define_dart `apex_std3_lll_xww y1 y2 y3 y4 y5 y6 = + [ + (&2,y1,#2.18); + (&2,y2,#2.18); + (&2,y3,#2.18); + (&2,y4,#2.52); + (#2.25,y5,#2.52); + (#2.25,y6,#2.52) + ]` ;; + +add{ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (apex_std3_lll_xww y1 y2 y3 y4 y5 y6) + (dih_y y1 y2 y3 y4 y5 y6 + #0.0071 > + #1.09969 + + #0.146345 * (-- &2 + y1) + + -- #0.160538 * (-- &2 + y2) + + -- #0.151698 * (-- #2.14 + y3) + + #0.61314 * (-- &2 + y4) + + -- #0.236149 * (-- #2.25 + y5) + + -- #0.242043 * (-- #2.25 + y6))`; + idv = "4222324842"; + doc = + "date{2010, 8, 3, 7, 9, 1.995901}\n ineq generated by Mathematica holineq\n Generated by generate_ineq_datum_p with input Dihedral {2,2,2.14,2,2.25,2.25} {2,2,2,2,2.25,2.25} {2.18,2.18,2.18,2.52,2.52,2.52}.\n The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + +let apex_std3_lll_wxx = define_dart `apex_std3_lll_wxx y1 y2 y3 y4 y5 y6 = + [ + (&2,y1,#2.18); + (&2,y2,#2.18); + (&2,y3,#2.18); + (#2.25,y4,#2.52); + (&2,y5,#2.52); + (&2,y6,#2.52) + ]` ;; + +add{ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (apex_std3_lll_wxx y1 y2 y3 y4 y5 y6) + (dih2_y y1 y2 y3 y4 y5 y6 + #0.0025 > + #1.16613 + + -- #0.296776 * (-- &2 + y1) + + #0.208935 * (-- &2 + y2) + + -- #0.196313 * (-- &2 + y3) + + -- #0.360575 * (-- #2.25 + y4) + + #0.652861 * (-- &2 + y5) + + -- #0.218063 * (-- &2 + y6))`; + idv = "5756588587"; + doc = + "date{2010, 8, 3, 19, 47, 22.770311}\n ineq generated by Mathematica holineq\n Generated by generate_ineq_datum with input Dihedral2 {2,2,2,2.25,2,2} {2.18,2.18,2.18,2.52,2.52,2.52}.\n The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + +add{ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (apex_flat y1 y2 y3 y4 y5 y6) + (--dih_y y1 y2 y3 y4 y5 y6 + #0.0011 > + -- #1.67609 + + -- #0.506322 * (-- #2.18 + y1) + + #0.212075 * (-- #2.1 + y2) + + #0.230669 * (-- #2.1 + y3) + + -- #1.28579 * (-- #2.52 + y4) + + #0.249199 * (-- &2 + y5) + + #0.193545 * (-- &2 + y6))`; + idv = "3425739813"; + doc = + "date{2010, 8, 3, 20, 2, 51.133190}\n ineq generated by Mathematica holineq\n Generated by generate_ineq_datum_p with input mDihedral {2.18,2.1,2.1,2.52,2,2} {2,2,2,2.52,2,2} {2.52,2.52,2.52,sqrt8,2.52,2.52}.\n The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + + +add{ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (apex_std3_lll_wxx y1 y2 y3 y4 y5 y6) + (dih2_y y1 y2 y3 y4 y5 y6 + #0.0050 > + #1.02005 + + -- #0.256494 * (-- #2.18 + y1) + + #0.121497 * (-- &2 + y2) + + -- #0.256494 * (-- &2 + y3) + + -- #0.0116869 * (-- #2.52 + y4) + + #0.598233 * (-- &2 + y5) + + #0.0187672 * (-- #2.25 + y6))`; + idv = "7316455966"; + doc = + "date{2010, 8, 4, 6, 2, 11.667622}\n ineq generated by Mathematica holineq\n Generated by generate_ineq_datum_p with input Dihedral2 {2.18,2,2,2.52,2,2.25} {2,2,2,2.25,2,2} {2.18,2.18,2.18,2.52,2.52,2.52}.\n The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + +add{ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (apex_std3_lll_wxx y1 y2 y3 y4 y5 y6) + (--dih3_y y1 y2 y3 y4 y5 y6 + #0.0087 > + -- #1.18616 + + #0.436647 * (-- #2.18 + y1) + + #0.032258 * (-- &2 + y2) + + -- #0.289629 * (-- &2 + y3) + + #0.397053 * (-- #2.52 + y4) + + -- #0.0210289 * (-- &2 + y5) + + -- #0.683341 * (-- #2.25 + y6))`; + idv = "6410081357"; + doc = + "date{2010, 8, 4, 6, 2, 43.302104}\n ineq generated by Mathematica holineq\n Generated by generate_ineq_datum_p with input mDihedral3 {2.18,2,2,2.52,2,2.25} {2,2,2,2.25,2,2} {2.18,2.18,2.18,2.52,2.52,2.52}.\n The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + +add{ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (dart_mll_n y1 y2 y3 y4 y5 y6) + (--dih_y y1 y2 y3 y4 y5 y6 + #0.0083 > + -- #1.29912 + + -- #0.284457 * (-- #2.18 + y1) + + #0.337354 * (-- &2 + y2) + + #0.186287 * (-- &2 + y3) + + -- #0.645382 * (-- #2.25 + y4) + + #0.367671 * (-- #2.52 + y5) + + #0.0536051 * (-- &2 + y6))`; + idv = "2923748598"; + doc = + "date{2010, 8, 4, 8, 57, 40.892442}\n ineq generated by Mathematica holineq\n Generated by generate_ineq_datum_p with input mDihedral {2.18,2,2,2.25,2.52,2} {2.18,2,2,2,2,2} {2.36,2.18,2.18,2.25,2.52,2.52}.\n The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + +add{ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (dart_mll_n y1 y2 y3 y4 y5 y6) + (dih2_y y1 y2 y3 y4 y5 y6 + #0.0035 > + #1.05036 + + -- #0.222178 * (-- #2.18 + y1) + + #0.132628 * (-- &2 + y2) + + -- #0.219284 * (-- &2 + y3) + + #0.00563427 * (-- #2.25 + y4) + + #0.59096 * (-- &2 + y5) + + -- #0.0771574 * (-- #2.52 + y6))`; + idv = "4306175952"; + doc = + "date{2010, 8, 4, 9, 3, 43.896393}\n ineq generated by Mathematica holineq\n Generated by generate_ineq_datum_p with input Dihedral2 {2.18,2,2,2.25,2,2.52} {2.18,2,2,2,2,2} {2.36,2.18,2.18,2.25,2.52,2.52}.\n The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + +add{ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (apex_sup_flat y1 y2 y3 y4 y5 y6) + (--dih3_y y1 y2 y3 y4 y5 y6 + #0.0076 > + -- #0.956317 + + #0.419124 * (-- &2 + y1) + + -- #0.0753922 * (-- &2 + y2) + + -- #0.252307 * (-- &2 + y3) + + #0.5 * (-- #2.82843 + y4) + + -- #0.246082 * (-- &2 + y5) + + -- #0.788717 * (-- &2 + y6))`; + idv = "2763799127"; + doc = + "date{2010, 8, 4, 13, 47, 22.850389}\n ineq generated by Mathematica holineq\n Generated by generate_ineq_datum with input mDihedral3 {2,2,2,sqrt8,2,2} {2.52,2.52,2.52,3.0,2.52,2.52}.\n The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + +add{ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (apex_sup_flat y1 y2 y3 y4 y5 y6) + (dih2_y y1 y2 y3 y4 y5 y6 + #0.0047 > + #0.936544 + + -- #0.636113 * (-- #2.1 + y1) + + #0.140759 * (-- #2.1 + y2) + + -- #0.0771734 * (-- #2.3 + y3) + + -- #1.29068 * (-- #2.82843 + y4) + + #0.591328 * (-- #2.1 + y5) + + -- #0.0521775 * (-- #2.1 + y6))`; + idv = "5943578801"; + doc = + "date{2010, 8, 4, 13, 50, 57.176690}\n ineq generated by Mathematica holineq\n Generated by generate_ineq_datum_p with input Dihedral2 {2.1,2.1,2.3,sqrt8,2.1,2.1} {2,2,2,sqrt8,2,2} {2.52,2.52,2.52,3.0,2.52,2.52}.\n The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + +let apex_std3_lhh = define_dart `apex_std3_lhh y1 y2 y3 y4 y5 y6 = + [ + (&2,y1,#2.18); + (#2.18,y2,#2.52); + (#2.18,y3,#2.52); + (&2,y4,#2.52); + (&2,y5,#2.52); + (&2,y6,#2.52) + ]` ;; + +add{ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (apex_std3_lhh y1 y2 y3 y4 y5 y6) + (dih_y y1 y2 y3 y4 y5 y6 + #0.0012 > + #1.01332 + + #0.148615 * (-- &2 + y1) + + -- #0.379006 * (-- #2.18 + y2) + + -- #0.379441 * (-- #2.18 + y3) + + #0.583676 * (-- &2 + y4) + + -- #0.184708 * (-- #2.25 + y5) + + -- #0.18471 * (-- #2.25 + y6))`; + idv = "1836408787"; + doc = + "date{2010, 8, 4, 18, 41, 52.689213}\n ineq generated by Mathematica holineq\n Generated by generate_ineq_datum_p with input Dihedral {2,2.18,2.18,2,2.25,2.25} {2,2.18,2.18,2,2,2} {2.18,2.52,2.52,2.52,2.52,2.52}.\n The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + +add{ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (apex_std3_lhh y1 y2 y3 y4 y5 y6) + (--dih2_y y1 y2 y3 y4 y5 y6 + #0.0059 > + -- #1.33909 + + #0.0724529 * (-- &2 + y1) + + -- #0.486824 * (-- #2.18 + y2) + + #0.317329 * (-- #2.18 + y3) + + -- #0.00479451 * (-- &2 + y4) + + -- #0.751179 * (-- #2.25 + y5) + + #0.350857 * (-- #2.25 + y6))`; + idv = "1248932983"; + doc = + "date{2010, 8, 4, 18, 42, 54.778495}\n ineq generated by Mathematica holineq\n Generated by generate_ineq_datum_p with input mDihedral2 {2,2.18,2.18,2,2.25,2.25} {2,2.18,2.18,2,2,2} {2.18,2.52,2.52,2.52,2.52,2.52}.\n The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + +(* Aug 5, 2010 *) + +add{ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (apex_flat y1 y2 y3 y4 y5 y6) + (dih3_y y1 y2 y3 y4 y5 y6 + #0.0046 > + #0.88473 + + -- #0.443946 * (-- #2.36 + y1) + + -- #0.244711 * (-- #2.1 + y2) + + #0.205592 * (-- #2.1 + y3) + + -- #0.739126 * (-- #2.55 + y4) + + -- #0.127198 * (-- #2.1 + y5) + + #0.61582 * (-- &2 + y6))`; + idv = "6725783616"; + doc = + "date{2010, 8, 5, 6, 6, 10.752609}\n ineq generated by Mathematica holineq\n Generated by generate_ineq_datum_p with input Dihedral3 {2.36,2.1,2.1,2.55,2.1,2.0} {2,2,2,2.52,2,2} {2.52,2.52,2.52,sqrt8,2.52,2.52}.\n The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + +add{ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (apex_std3_hll y1 y2 y3 y4 y5 y6) + (--dih3_y y1 y2 y3 y4 y5 y6 + #0.0116 > + -- #1.30119 + + #0.392915 * (-- #2.36 + y1) + + #0.142563 * (-- #2.1 + y2) + + -- #0.258747 * (-- #2.1 + y3) + + #0.417088 * (-- #2.45 + y4) + + -- #0.0606764 * (-- &2 + y5) + + -- #0.637966 * (-- #2.45 + y6))`; + idv = "9185711902"; + doc = + "date{2010, 8, 5, 6, 25, 0.685185}\n ineq generated by Mathematica holineq\n Generated by generate_ineq_datum_p with input mDihedral3 {2.36,2.1,2.1,2.45,2.,2.45} {2.18,2,2,2,2,2} {2.52,2.18,2.18,2.52,2.52,2.52}.\n The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + +add{ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (apex_std3_hll y1 y2 y3 y4 y5 y6) + (dih2_y y1 y2 y3 y4 y5 y6 + #0.0011 > + #0.957661 + + -- #0.250506 * (-- #2.36 + y1) + + #0.145114 * (-- #2.1 + y2) + + -- #0.0549376 * (-- #2.1 + y3) + + -- #0.0384445 * (-- #2.45 + y4) + + #0.5275 * (-- &2 + y5) + + #0.118819 * (-- #2.45 + y6))`; + idv = "6284721194"; + doc = + "date{2010, 8, 5, 6, 29, 20.593944}\n ineq generated by Mathematica holineq\n Generated by generate_ineq_datum_p with input Dihedral2 {2.36,2.1,2.1,2.45,2.,2.45} {2.18,2,2,2,2,2} {2.52,2.18,2.18,2.52,2.52,2.52}.\n The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + +add{ineq = + `!y1 y2 y3 y4 y5 y6. + ineq (apex_flat_h y1 y2 y3 y4 y5 y6) + (dih2_y y1 y2 y3 y4 y5 y6 + #0.0042 > + #0.868174 + + -- #0.701906 * (-- #2.25 + y1) + + #0.136514 * (-- &2 + y2) + + -- #0.209239 * (-- #2.18 + y3) + + -- #0.493373 * (-- #2.65 + y4) + + #0.537385 * (-- &2 + y5) + + #0.0187672 * (-- #2.2 + y6))`; + idv = "3137600529"; + doc = + "date{2010, 8, 5, 10, 13, 11.823742}\n ineq generated by Mathematica holineq\n Generated by generate_ineq_datum_p with input Dihedral2 {2.25,2,2.18,2.65,2.,2.2} {2.18,2,2,2.52,2,2} {2.52,2.52,2.52,sqrt8,2.52,2.52}.\n The inequality has been fitted to cfsqp margins."; + tags = [Cfsqp; Xconvert;Lp; Lpsymmetry]};; + +end;; diff --git a/text_formalization/nonlinear/ineqdata3q1h.hl b/text_formalization/nonlinear/ineqdata3q1h.hl new file mode 100644 index 0000000..e6fc739 --- /dev/null +++ b/text_formalization/nonlinear/ineqdata3q1h.hl @@ -0,0 +1,1164 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Lemma: OXLZLEZ *) +(* Chapter: Packing *) +(* Author: Thomas C. Hales *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + +(* This file contains the inequalities for the hard case of the cluster inequality, + consisting of 4 blades, 3 quarters, and one half-weight. *) + + + type irecord = { + caseno : int; + coef1 : term * term * term * term; + coef2 : term*term*term*term; + coef3 : term*term*term*term; + coef4 : term*term*term*term; + branch1 : int list; + branch2 : int list; + branch3 : int list; + branch4 : int list; + branch5 : int list; + eps : float; + numerical1 : float list; + numerical2 : float list; + numerical3 : float list; + numerical4 : float list; +};; + +module Ineqdata3q1h : + +sig + val records : irecord list + val mk_ineq : int -> irecord -> term + val domain_cover_calculation: bool + val combine : (int list*int list*int list*int list*int list)* + (int list*int list*int list*int list*int list) -> + (bool*int)*(int list*int list*int list*int list*int list) +end + += struct + +(* + +FOUR BLADE INEQUALITIES + Each record corresponds to 5 different formal inequalities obtained by + mk_ineq i, for i=0,1,2,3,4. + + + Data nonlindata automatically generated by Mathematica sphereBook.nb, + *process* function . + + There is a nonlinear optimization problem of 4blades, 3quarters, + 1halfwt along a common spine. This is a 13-dimensional problem. + A Mathematica calculation has broken it into a collection of 6-dimensional + nonlinear optimizations. The data describing these 6-dimensional + problems appears below. + + Each list entry corresponds to four nonlinear optimization problems + (for the four different simplices around the spine. + + Each list entry has the following format. + [[caseno];lindata;b1;b2;b3;b4;b5;d1;d2;d3;d4] + + caseno : 1, 2,3,4 + + This gives information about what the lengths of the spine and + edge#4 on the 1halfwt are: + + case spine edge#4 + 1 2h0 to 2hplus 2hminus to 2h0 + 2 2h0 to 2hplus 2h0 to 2hplus + 3 2hminus to 2h0 2hminus to 2h0 + 4 2hminus to 2h0 2h0 to 2hplus + + **** + + lindata is a list of length 14. + [eps,a, b1,c1,d1, b2,c2,d2, b3,c3,d3, b4,c4,d4] + These are the inequalities: + gamma + a dih + bi y1 + ci (y2+y3+y5+y6) + di >= 0. + + -eps gives the margin by which it holds. + + The first group is for the 4-cell of wt 0.5. The indices 2,3,4 are for the quarters. + + **** + + b1,b2,b3,b4,b5 branch data + each of these is a sequence of 0s and 1s. + b1 <-> domain of y1 (the spine) + b2 <-> domain of y4 (on the (halfwt) + b3 <-> domain of the y4 variable on quarter 2 + b4 <-> domain of the y4 variable on quarter 3 + b5 <-> domain of the y4 variable on quarter 4 + + each entry in bi cuts the domain in half, 0 takes the LHS, 1 takes + the RHS. + + The first in the sequence is the first subdivision performed. + + **** + + d1,d2,d3,d4 data on the numerical optimization of the 4 nonlinear + inequalities + + di = [value;y1,y2,y3,y4,y5,y6] minimizer(numerical) and optimal point. + + +*) + +(* +produced from /tmp/ineqdata3q1h.ml (from Mathematica) with the +following edits: + s/{/[ /g + s/}/ ]/g + s/,/ ;/g + s/. /.0 /g + +The formal version has the additional edits + s/-/-- /g + \([0-9]\)-> #\1 + s/ //g + +*) + + open Sphere;; + + let do_betas x = all_forall (snd(dest_eq(concl(BETAS_CONV x))));; + + let dest_decimal x = match strip_comb x with + | (dec,[a;b]) -> div_num (dest_numeral a) (dest_numeral b) + | _ -> failwith ("dest_decimal: '" ^ string_of_term x ^ "'");; + + let dest_signed_decimal x = match strip_comb x with + | (dec,[a;b]) -> dest_decimal x + | (neg,[a]) -> Num.minus_num(dest_decimal a) + | _ -> failwith ("dest_decimal: '" ^ string_of_term x ^ "'");; + +let int_of_dec u = + Num.int_of_num (dest_signed_decimal u);; + +let float_of_dec u = Num.float_of_num (dest_signed_decimal u);; + +let mk_irecord oni = + let fd t = map float_of_dec t in + let i t = map int_of_dec t in + let g = function + [eps;a;b1;c1;d1;b2;c2;d2;b3;c3;d3;b4;c4;d4] -> + (float_of_dec eps,(a,b1,c1,d1),(a,b2,c2,d2),(a,b3,c3,d3),(a,b4,c4,d4)) + | _ -> failwith "parse error g" in + let f = function + [[case];lindata;b1;b2;b3;b4;b5;d1;d2;d3;d4] + -> (int_of_dec case,g lindata,i b1,i b2, i b3,i b4,i b5,fd d1,fd d2,fd d3,fd d4) + | _ -> failwith "parse error f" in + let (i,(e,c1,c2,c3,c4),b1,b2,b3,b4,b5,n1,n2,n3,n4) = f oni in + { + caseno = i; + coef1 = c1; + coef2 = c2; + coef3 = c3; + coef4 = c4; + branch1 = b1; + branch2 = b2; + branch3 = b3; + branch4 = b4; + branch5 = b5; + eps = e; + numerical1 = n1; + numerical2 = n2; + numerical3 = n3; + numerical4 = n4; + };; + +let y1domain d = + List.nth [`&2 * h0,&2 * hplus`;`&2 * h0,&2 * hplus`; + `&2 * hminus,&2 * h0`; `&2 * hminus,&2 * h0`] (d.caseno -1);; + +let y4domain d = + List.nth [`&2 * hminus,&2 * h0`; `&2 * h0,&2 * hplus`; + `&2 * hminus,&2 * h0`; `&2 * h0,&2 * hplus` ] (d.caseno-1);; + +(* in sphere.hl: +let pathL = new_definition `pathL (a,b) = (a,(a+b)/ &2)`;; + +let pathR = new_definition `pathR (a,b) = ((a+b)/ &2,b)`;; +*) + +let rec mkpath r = function + [] -> r + | x::xs -> let t = if (x=0) then `pathL` else `pathR` in + mkpath (mk_comb (t,r)) xs;; + +let template = `\ y1d y2d y3d y4d y5d y6d + a b c d w m. ineq + [(FST y1d, y1, SND y1d); + (FST y2d ,y2, SND y2d); + (FST y3d,y3,SND y3d); + (FST y4d,y4,SND y4d); + (FST y5d,y5,SND y5d); + (FST y6d,y6,SND y6d)] + (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &w + &m *beta_bump_force_y y1 y2 y3 y4 y5 y6 + + a * dih_y y1 y2 y3 y4 y5 y6 + + b * y1 + + c * (y2 + y3 + y5 + y6) + + d > &0)`;; + +let mk_ineq1 i d = (* i=1,2,3,4, d reconstructs the formal statement of the ineq *) + let nth = List.nth in + let halfwt i = (i=1) in + let mk = mk_small_numeral in + let y1d = (y1domain d) in + let yd = `(&2, &2 * hminus)` in + let y4d = if halfwt i then (y4domain d) else yd in + let y j = nth [y1d;yd;yd;y4d;yd;yd] (j-1) in + let w = if halfwt i then 2 else 1 in + let m = w - 1 in + let (a,b,c,e) = nth [d.coef1;d.coef2;d.coef3;d.coef4] (i-1) in + let p1 = d.branch1 in + let p4 = nth [d.branch2;d.branch3;d.branch4;d.branch5] (i-1) in + let p j = nth [p1;[];[];p4;[];[]] (j-1) in + let x j = mkpath (y j) (p j) in + do_betas(list_mk_comb (template, + [x 1;x 2;x 3;x 4;x 5;x 6;a;b;c;e;mk w; mk m]));; + +(* NB: + In each simplex ineq, there are four products ci * yj. When we sum, + we get 16 products, each (ci + ci') is paired with y(i,i') and z(i,i'), + where y is the edge at the origin and z is the edge on top. + We combine y(i,i')+z(i,i') into a single variable &2 *y... +*) + +let templateB = `\ a b1 b2 b3 b4 c1 c2 c3 c4 d1 d2 d3 d4 y1d. + ineq + [(FST y1d, y1, SND y1d); + (&2 ,y12, &2 * hminus); + (&2,y23, &2 * hminus); + (&2,y34, &2 * hminus); + (&2,y41, &2 * hminus)] + (&2 * pi * a + (b1+b2+b3+b4)* y1 + + &2 * (c1+c2) * y12 + &2 *(c2 + c3) * y23 + &2 *(c3 + c4) * y34 + &2 * + (c4+c1)* y41 + + d1 + d2 + d3 + d4 < &0)`;; + +let mk_ineq0 d = (* test constant compatibility for the 4 simplices around the spine *) + let (a,b1,c1,d1) = d.coef1 in + let (_,b2,c2,d2) = d.coef2 in + let (_,b3,c3,d3) = d.coef3 in + let (_,b4,c4,d4) = d.coef4 in + let y1d = mkpath (y1domain d) d.branch1 in +do_betas(list_mk_comb(templateB, + [a; b1; b2; b3; b4; c1; c2; c3; c4; d1; d2; d3; d4; y1d]));; + +let mk_ineq case d = + let _ = (case >= 0) or failwith "mk_ineq domain error" in + let _ = (case <= 4) or failwith "mk_ineq domain error" in + if (case=0) then mk_ineq0 d else mk_ineq1 case d;; + +(* formal version. + We take the floating point numbers to be exact rational numbers given by their + decimal expansions: *) + +let raw_nonlindatah = [ [ [ `#4.0` ] ; [ `-- #0.00289` ; `#0.129913` ; `-- #0.060416` ; `#0.002372` ; `-- #0.113134` ; `#0.01764` ; + `-- #0.002372` ; `-- #0.198777` ; `#0.045166` ; `#0.002372` ; `-- #0.306092` ; `#0.021777` ; `-- #0.002372` ; + `-- #0.259166` ] ; [ ] ; [ ] ; [ ] ; [ ] ; [ `#1.0` ] ; [ `#0.003326` ; `#2.463509` ; `#2.0` ; `#2.0` ; `#2.52` ; `#2.0` ; + `#2.0` ] ; [ `#0.00289` ; `#2.463514` ; `#2.0` ; `#2.463508` ; `#2.0` ; `#2.000001` ; `#2.000001` ] ; + [ `#0.003534` ; `#2.463509` ; `#2.000001` ; `#2.463508` ; `#2.0` ; `#2.0` ; `#2.000001` ] ; + [ `#0.00289` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.231754` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#4.0` ] ; [ `-- #0.002889` ; `#0.129699` ; `-- #0.060316` ; `#0.002264` ; `-- #0.112116` ; `#0.019214` ; + `-- #0.002264` ; `-- #0.203309` ; `#0.021887` ; `#0.002264` ; `-- #0.29619` ; `#0.019214` ; `-- #0.002264` ; + `-- #0.203309` ] ; [ ] ; [ ] ; [ ] ; [ `#1.0` ] ; [ `#0.0` ] ; [ `#0.003328` ; `#2.463509` ; `#2.0` ; `#2.0` ; `#2.52` ; `#2.0` ; + `#2.0` ] ; [ `#0.00289` ; `#2.463513` ; `#2.0` ; `#2.463508` ; `#2.0` ; `#2.000001` ; `#2.0` ] ; + [ `#0.002889` ; `#2.463509` ; `#2.0` ; `#2.0` ; `#2.231754` ; `#2.0` ; `#2.0` ] ; + [ `#0.002998` ; `#2.519915` ; `#2.000025` ; `#2.000038` ; `#2.000022` ; `#2.463485` ; `#2.000022` ] ] ; + [ [ `#4.0` ] ; [ `-- #0.00289` ; `#0.129913` ; `-- #0.060416` ; `#0.002372` ; `-- #0.113134` ; `#0.021777` ; + `-- #0.002372` ; `-- #0.259166` ; `#0.045166` ; `#0.002372` ; `-- #0.306092` ; `#0.01764` ; `-- #0.002372` ; + `-- #0.198777` ] ; [ ] ; [ ] ; [ `#1.0` ] ; [ `#0.0` ] ; [ `#0.0` ] ; [ `#0.003326` ; `#2.463509` ; `#2.0` ; `#2.0` ; `#2.52` ; + `#2.0` ; `#2.0` ] ; [ `#0.00289` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.231754` ; `#2.0` ; `#2.0` ] ; + [ `#0.003534` ; `#2.463509` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463508` ; `#2.0` ] ; + [ `#0.002915` ; `#2.519935` ; `#2.000027` ; `#2.00004` ; `#2.000024` ; `#2.463484` ; `#2.000025` ] ] ; + [ [ `#4.0` ] ; [ `-- #0.000426` ; `-- #0.114872` ; `#0.133539` ; `-- #0.080919` ; `#0.532524` ; `#0.148605` ; + `#0.080919` ; `-- #0.855148` ; `#0.08743` ; `-- #0.080919` ; `#0.593722` ; `#0.148605` ; `#0.080919` ; + `-- #0.855148` ] ; [ ] ; [ ] ; [ `#0.0` ] ; [ `#0.0` ] ; [ `#0.0` ] ; [ `#0.000426` ; `#2.463509` ; `#2.0` ; `#2.0` ; `#2.6508` ; + `#2.0` ; `#2.0` ] ; [ `#0.000435` ; `#2.463511` ; `#2.000001` ; `#2.000001` ; `#2.000002` ; `#2.000002` ; + `#2.000002` ] ; [ `#0.004824` ; `#2.46351` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; `#2.0` ] ; + [ `#0.000435` ; `#2.463511` ; `#2.000001` ; `#2.000001` ; `#2.000002` ; `#2.000002` ; `#2.000002` ] ] ; + [ [ `#3.0` ] ; [ `-- #0.00272` ; `#0.065103` ; `-- #0.008732` ; `-- #0.024884` ; `#0.097156` ; `#0.072591` ; + `#0.024884` ; `-- #0.464803` ; `#0.042651` ; `-- #0.024884` ; `#0.008797` ; `#0.055356` ; `#0.024884` ; + `-- #0.458108` ] ; [ ] ; [ ] ; [ ] ; [ ] ; [ `#1.0` ] ; [ `#0.002594` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.491729` ; `#2.0` ; + `#2.0` ] ; [ `#0.00272` ; `#2.463509` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; + [ `#0.00272` ; `#2.463509` ; `#2.0` ; `#2.463509` ; `#2.0` ; `#2.0` ; `#2.0` ] ; + [ `#0.00272` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.231754` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#3.0` ] ; [ `-- #0.00272` ; `#0.065103` ; `-- #0.029778` ; `-- #0.027449` ; `#0.170713` ; `#0.072591` ; + `#0.027449` ; `-- #0.485323` ; `#0.055356` ; `-- #0.027449` ; `-- #0.039438` ; `#0.072591` ; `#0.027449` ; + `-- #0.485323` ] ; [ ] ; [ ] ; [ ] ; [ `#1.0` ] ; [ `#0.0` ] ; [ `#0.002594` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.491998` ; `#2.0` ; + `#2.0` ] ; [ `#0.00272` ; `#2.463509` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; + [ `#0.00272` ; `#2.463509` ; `#2.0` ; `#2.0` ; `#2.231754` ; `#2.0` ; `#2.0` ] ; + [ `#0.00272` ; `#2.463509` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#3.0` ] ; [ `-- #0.00272` ; `#0.065103` ; `-- #0.008732` ; `#0.025458` ; `-- #0.30558` ; `#0.055356` ; + `-- #0.025458` ; `-- #0.055371` ; `#0.072591` ; `#0.025458` ; `-- #0.469389` ; `#0.037947` ; `-- #0.025458` ; + `#0.025236` ] ; [ ] ; [ ] ; [ `#1.0` ] ; [ `#0.0` ] ; [ `#0.0` ] ; [ `#0.002612` ; `#2.463509` ; `#2.0` ; `#2.0` ; + `#2.489061` ; `#2.0` ; `#2.0` ] ; [ `#0.00272` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.231754` ; `#2.0` ; `#2.0` ] ; + [ `#0.00272` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; [ `#0.00272` ; `#2.463509` ; `#2.0` ; `#2.0` ; `#2.0` ; + `#2.463509` ; `#2.0` ] ] ; [ [ `#3.0` ] ; [ `-- #0.00225` ; `-- #0.114872` ; `#0.116669` ; `#0.080919` ; + `-- #0.7251449999999999` ; `#0.08743` ; `-- #0.080919` ; `#0.595546` ; `#0.148605` ; `#0.080919` ; + `-- #0.853324` ; `#0.08743` ; `-- #0.080919` ; `#0.595546` ] ; [ ] ; [ ] ; [ `#0.0` ] ; [ `#0.0` ] ; [ `#0.0` ] ; + [ `#0.00225` ; `#2.519989` ; `#2.0` ; `#2.0` ; `#2.52` ; `#2.0` ; `#2.0` ] ; [ `#0.006648` ; `#2.46351` ; `#2.0` ; `#2.0` ; `#2.0` ; + `#2.463509` ; `#2.0` ] ; [ `#0.002259` ; `#2.463511` ; `#2.000001` ; `#2.000001` ; `#2.000002` ; + `#2.000002` ; `#2.000002` ] ; [ `#0.006648` ; `#2.46351` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; `#2.0` ] ] ; + [ [ `#2.0` ] ; [ `-- #0.00289` ; `#0.129913` ; `-- #0.09152` ; `#0.002372` ; `-- #0.034749` ; `#0.347659` ; + `-- #0.002372` ; `-- #1.030425` ; `-- #0.105208` ; `#0.002372` ; `#0.072849` ; `-- #0.150931` ; `-- #0.002372` ; + `#0.176057` ] ; [ ] ; [ ] ; [ ] ; [ ] ; [ `#1.0` ] ; [ `#0.00289` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.52` ; `#2.0` ; `#2.0` ] ; + [ `#0.00289` ; `#2.52` ; `#2.0` ; `#2.463509` ; `#2.0` ; `#2.0` ; `#2.0` ] ; [ `#0.005089` ; `#2.52` ; `#2.0` ; `#2.463509` ; + `#2.0` ; `#2.0` ; `#2.0` ] ; [ `#0.00289` ; `#2.6508` ; `#2.0` ; `#2.0` ; `#2.231754` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#2.0` ] ; [ `-- #0.00289` ; `#0.129913` ; `#0.340765` ; `#0.002372` ; `-- #1.124108` ; `-- #0.094917` ; + `-- #0.002372` ; `#0.084866` ; `-- #0.150931` ; `#0.002372` ; `#0.138108` ; `-- #0.094917` ; `-- #0.002372` ; + `#0.084866` ] ; [ ] ; [ ] ; [ ] ; [ `#1.0` ] ; [ `#0.0` ] ; [ `#0.00289` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.52` ; `#2.0` ; `#2.0` ] ; + [ `#0.00289` ; `#2.52` ; `#2.0` ; `#2.463509` ; `#2.0` ; `#2.0` ; `#2.0` ] ; [ `#0.00289` ; `#2.6508` ; `#2.0` ; `#2.0` ; + `#2.231754` ; `#2.0` ; `#2.0` ] ; [ `#0.00289` ; `#2.520001` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; `#2.0` ] ] ; + [ [ `#2.0` ] ; [ `-- #0.00289` ; `#0.129913` ; `-- #0.09152` ; `#0.002372` ; `-- #0.034749` ; `#0.291645` ; + `-- #0.002372` ; `-- #0.939234` ; `-- #0.105208` ; `#0.002372` ; `#0.072849` ; `-- #0.094917` ; `-- #0.002372` ; + `#0.084866` ] ; [ ] ; [ ] ; [ `#1.0` ] ; [ `#0.0` ] ; [ `#0.0` ] ; [ `#0.00289` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.52` ; `#2.0` ; + `#2.0` ] ; [ `#0.00289` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.231754` ; `#2.0` ; `#2.0` ] ; + [ `#0.005089` ; `#2.520002` ; `#2.000001` ; `#2.000001` ; `#2.000001` ; `#2.463507` ; `#2.000001` ] ; + [ `#0.00289` ; `#2.520001` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; `#2.0` ] ] ; + [ [ `#2.0` ] ; [ `-- #0.005361` ; `#0.128506` ; `#0.290371` ; `#0.003287` ; `-- #1.026581` ; `-- #0.070878` ; + `-- #0.003287` ; `#0.033394` ; `-- #0.097658` ; `#0.003287` ; `#0.050047` ; `-- #0.121835` ; `-- #0.003287` ; + `#0.13571` ] ; [ `#1.0` ] ; [ ] ; [ `#0.0` ] ; [ `#0.0` ] ; [ `#0.0` ; `#1.0` ] ; [ `#0.005361` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.52` ; + `#2.0` ; `#2.0` ] ; [ `#0.005361` ; `#2.585401` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; `#2.0` ] ; + [ `#0.008408` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; `#2.0` ] ; + [ `#0.005361` ; `#2.6508` ; `#2.0` ; `#2.0` ; `#2.115877` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#2.0` ] ; [ `-- #0.005361` ; `#0.128506` ; `#0.263591` ; `#0.003287` ; `-- #0.957343` ; `-- #0.070878` ; + `-- #0.003287` ; `#0.033394` ; `-- #0.121835` ; `#0.003287` ; `#0.083125` ; `-- #0.070878` ; `-- #0.003287` ; + `#0.033394` ] ; [ `#1.0` ] ; [ ] ; [ `#0.0` ] ; [ `#0.0` ; `#1.0` ] ; [ `#0.0` ; `#0.0` ] ; + [ `#0.005361` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.52` ; `#2.0` ; `#2.0` ] ; [ `#0.005361` ; `#2.585401` ; `#2.0` ; `#2.0` ; `#2.0` ; + `#2.463509` ; `#2.0` ] ; [ `#0.005361` ; `#2.6508` ; `#2.0` ; `#2.0` ; `#2.115877` ; `#2.0` ; `#2.0` ] ; + [ `#0.005362` ; `#2.585403` ; `#2.0` ; `#2.000001` ; `#2.0` ; `#2.463508` ; `#2.0` ] ] ; + [ [ `#2.0` ] ; [ `-- #0.005361` ; `#0.128506` ; `-- #0.066254` ; `#0.003287` ; `-- #0.104563` ; `#0.234791` ; + `-- #0.003287` ; `-- #0.786309` ; `-- #0.097658` ; `#0.003287` ; `#0.050047` ; `-- #0.070878` ; `-- #0.003287` ; + `#0.033394` ] ; [ `#1.0` ] ; [ ] ; [ `#0.0` ; `#1.0` ] ; [ `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ] ; + [ `#0.005361` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.52` ; `#2.0` ; `#2.0` ] ; [ `#0.005361` ; `#2.5854` ; `#2.0` ; `#2.0` ; + `#2.115877` ; `#2.0` ; `#2.0` ] ; [ `#0.008409` ; `#2.585403` ; `#2.000001` ; `#2.000001` ; `#2.000001` ; + `#2.463508` ; `#2.000001` ] ; [ `#0.005362` ; `#2.585403` ; `#2.0` ; `#2.000001` ; `#2.0` ; `#2.463508` ; + `#2.0` ] ] ; [ [ `#2.0` ] ; [ `-- #0.001637` ; `#0.127166` ; `-- #0.07331` ; `#0.003788` ; `-- #0.105909` ; `#0.23984` ; + `-- #0.003788` ; `-- #0.767737` ; `-- #0.096981` ; `#0.003788` ; `#0.04248` ; `-- #0.069548` ; `-- #0.003788` ; + `#0.032155` ] ; [ `#1.0` ] ; [ `#1.0` ] ; [ `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ] ; + [ `#0.001637` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.5854` ; `#2.0` ; `#2.0` ] ; [ `#0.001637` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.0` ; + `#2.0` ; `#2.0` ] ; [ `#0.005148` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; `#2.0` ] ; + [ `#0.001637` ; `#2.585403` ; `#2.0` ; `#2.000001` ; `#2.0` ; `#2.463508` ; `#2.0` ] ] ; + [ [ `#2.0` ] ; [ `-- #0.00125` ; `#0.126777` ; `-- #0.053069` ; `#0.003525` ; `-- #0.142652` ; `#0.196466` ; + `-- #0.003525` ; `-- #0.667227` ; `-- #0.093532` ; `#0.003525` ; `#0.035622` ; `-- #0.049865` ; `-- #0.003525` ; + `-- #0.022307` ] ; [ `#1.0` ; `#1.0` ] ; [ `#0.0` ] ; [ `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ] ; + [ `#0.00125` ; `#2.6181` ; `#2.0` ; `#2.0` ; `#2.52` ; `#2.463509` ; `#2.0` ] ; + [ `#0.001388` ; `#2.6181` ; `#2.000001` ; `#2.000001` ; `#2.0` ; `#2.463508` ; `#2.0` ] ; + [ `#0.004482` ; `#2.6508` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; `#2.0` ] ; + [ `#0.001388` ; `#2.618101` ; `#2.000001` ; `#2.000002` ; `#2.0` ; `#2.463508` ; `#2.000001` ] ] ; + [ [ `#2.0` ] ; [ `-- #0.001974` ; `-- #0.0469` ; `#0.051237` ; `#0.060747` ; `-- #0.530637` ; `-- #0.014413` ; + `-- #0.060747` ; `#0.594377` ; `-- #0.014413` ; `#0.060747` ; `-- #0.377571` ; `-- #0.02241` ; `-- #0.060747` ; + `#0.608509` ] ; [ `#1.0` ; `#0.0` ] ; [ `#0.0` ] ; [ `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#1.0` ] ; + [ `#0.001974` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.520037` ; `#2.0` ; `#2.0` ] ; + [ `#0.005733` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; `#2.0` ] ; + [ `#0.001976` ; `#2.618027` ; `#2.000001` ; `#2.000001` ; `#2.000002` ; `#2.000001` ; `#2.000001` ] ; + [ `#0.001974` ; `#2.6181` ; `#2.0` ; `#2.0` ; `#2.057939` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#2.0` ] ; [ `-- #0.001974` ; `-- #0.0469` ; `#0.051237` ; `#0.060747` ; `-- #0.530636` ; `-- #0.014413` ; + `-- #0.060747` ; `#0.594377` ; `-- #0.02241` ; `#0.060747` ; `-- #0.36344` ; `-- #0.014413` ; `-- #0.060747` ; + `#0.594377` ] ; [ `#1.0` ; `#0.0` ] ; [ `#0.0` ] ; [ `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#1.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; + [ `#0.001974` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.520037` ; `#2.0` ; `#2.0` ] ; + [ `#0.005733` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; `#2.0` ] ; + [ `#0.001975` ; `#2.585404` ; `#2.000001` ; `#2.000001` ; `#2.05794` ; `#2.000001` ; `#2.000001` ] ; + [ `#0.001974` ; `#2.6181` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#2.0` ] ; [ `-- #0.001974` ; `-- #0.0469` ; `#0.051237` ; `#0.060747` ; `-- #0.530637` ; `-- #0.02241` ; + `-- #0.060747` ; `#0.608509` ; `-- #0.014413` ; `#0.060747` ; `-- #0.377571` ; `-- #0.014413` ; `-- #0.060747` ; + `#0.594377` ] ; [ `#1.0` ; `#0.0` ] ; [ `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#1.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; + [ `#0.001974` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.520037` ; `#2.0` ; `#2.0` ] ; + [ `#0.001974` ; `#2.6181` ; `#2.0` ; `#2.0` ; `#2.057939` ; `#2.0` ; `#2.0` ] ; + [ `#0.001975` ; `#2.585402` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; [ `#0.001974` ; `#2.6181` ; `#2.0` ; `#2.0` ; `#2.0` ; + `#2.0` ; `#2.0` ] ] ; [ [ `#2.0` ] ; [ `-- #0.00033` ; `-- #0.036939` ; `#0.050064` ; `-- #0.057593` ; `#0.397884` ; + `-- #0.016688` ; `#0.057593` ; `-- #0.362427` ; `-- #0.016688` ; `-- #0.057593` ; `#0.559062` ; `-- #0.016688` ; + `-- #0.057593` ; `#0.559062` ] ; [ `#1.0` ; `#0.0` ; `#1.0` ] ; [ `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; + [ `#0.0` ; `#0.0` ; `#0.0` ] ; [ `#0.00033` ; `#2.618094` ; `#2.000003` ; `#2.000003` ; `#2.520014` ; `#2.000003` ; + `#2.000003` ] ; [ `#0.00033` ; `#2.601753` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; + [ `#0.00033` ; `#2.6181` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; [ `#0.00033` ; `#2.6181` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; + `#2.0` ] ] ; [ [ `#2.0` ] ; [ `-- #0.000417` ; `-- #0.049823` ; `#0.047052` ; `-- #0.061687` ; `#0.463622` ; + `-- #0.015684` ; `#0.061687` ; `-- #0.379191` ; `-- #0.015684` ; `-- #0.061687` ; `#0.607807` ; `-- #0.015684` ; + `#0.061687` ; `-- #0.379191` ] ; [ `#1.0` ; `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#1.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; + [ `#0.0` ; `#0.0` ; `#0.0` ] ; [ `#0.000417` ; `#2.60175` ; `#2.0` ; `#2.0` ; `#2.5527` ; `#2.0` ; `#2.0` ] ; + [ `#0.000418` ; `#2.601748` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; [ `#0.000417` ; `#2.60175` ; `#2.0` ; `#2.0` ; `#2.0` ; + `#2.0` ; `#2.0` ] ; [ `#0.000418` ; `#2.601748` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#2.0` ] ; [ `-- #0.000396` ; `-- #0.053582` ; `#0.049452` ; `-- #0.06302` ; `#0.475514` ; `-- #0.013853` ; + `#0.06302` ; `-- #0.389234` ; `-- #0.020791` ; `-- #0.06302` ; `#0.637132` ; `-- #0.013853` ; `-- #0.062897` ; + `#0.618101` ] ; [ `#1.0` ; `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; + [ `#0.0` ; `#0.0` ; `#0.0` ] ; [ `#0.000359` ; `#2.601749` ; `#2.0` ; `#2.0` ; `#2.536279` ; `#2.0` ; `#2.0` ] ; + [ `#0.000396` ; `#2.601748` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; [ `#0.000396` ; `#2.60175` ; `#2.0` ; `#2.0` ; `#2.0` ; + `#2.0` ; `#2.0` ] ; [ `#0.000396` ; `#2.60175` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#2.0` ] ; [ `-- #0.002012` ; `-- #0.066935` ; `#0.079693` ; `#0.066241` ; `-- #0.605497` ; `-- #0.021495` ; + `-- #0.066241` ; `#0.685308` ; `-- #0.021495` ; `#0.066241` ; `-- #0.374549` ; `-- #0.036704` ; `-- #0.066241` ; + `#0.715304` ] ; [ `#0.0` ] ; [ ] ; [ `#0.0` ] ; [ `#0.0` ] ; [ `#0.0` ; `#1.0` ] ; [ `#0.00141` ; `#2.52` ; `#2.0` ; `#2.0` ; + `#2.584895` ; `#2.0` ; `#2.0` ] ; [ `#0.004908` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; `#2.0` ] ; + [ `#0.002012` ; `#2.585399` ; `#2.000001` ; `#2.000001` ; `#2.000001` ; `#2.000001` ; `#2.0` ] ; + [ `#0.002012` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.115877` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#2.0` ] ; [ `-- #0.002012` ; `-- #0.066935` ; `#0.028887` ; `#0.066241` ; `-- #0.477466` ; `-- #0.021495` ; + `-- #0.066241` ; `#0.685308` ; `#0.014102` ; `#0.066241` ; `-- #0.472584` ; `-- #0.021495` ; `-- #0.066241` ; + `#0.685308` ] ; [ `#0.0` ] ; [ ] ; [ `#0.0` ] ; [ `#0.0` ; `#1.0` ] ; [ `#0.0` ; `#0.0` ] ; + [ `#0.001651` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.596115` ; `#2.0` ; `#2.0` ] ; + [ `#0.004908` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; `#2.0` ] ; [ `#0.002012` ; `#2.52` ; `#2.0` ; `#2.0` ; + `#2.115878` ; `#2.0` ; `#2.0` ] ; [ `#0.004908` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; `#2.0` ] ] ; + [ [ `#2.0` ] ; [ `-- #0.002012` ; `-- #0.066935` ; `#0.028887` ; `-- #0.066241` ; `#0.582391` ; `#0.014102` ; + `#0.066241` ; `-- #0.472584` ; `-- #0.021495` ; `-- #0.066241` ; `#0.685308` ; `-- #0.021495` ; `#0.066241` ; + `-- #0.374549` ] ; [ `#0.0` ] ; [ ] ; [ `#0.0` ; `#1.0` ] ; [ `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ] ; + [ `#0.00141` ; `#2.520001` ; `#2.000001` ; `#2.000001` ; `#2.58489` ; `#2.000001` ; `#2.000001` ] ; + [ `#0.002012` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.115878` ; `#2.0` ; `#2.0` ] ; [ `#0.004908` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.0` ; + `#2.463509` ; `#2.0` ] ; [ `#0.002012` ; `#2.520001` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#2.0` ] ; [ `-- #0.000405` ; `-- #0.070081` ; `#0.043025` ; `#0.06775` ; `-- #0.520998` ; `-- #0.014342` ; + `-- #0.06775` ; `#0.681778` ; `-- #0.014342` ; `#0.06775` ; `-- #0.402228` ; `-- #0.014342` ; `-- #0.06775` ; + `#0.681778` ] ; [ `#0.0` ; `#1.0` ] ; [ `#1.0` ] ; [ `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ] ; + [ `#0.000317` ; `#2.585399` ; `#2.0` ; `#2.0` ; `#2.612413` ; `#2.0` ; `#2.0` ] ; + [ `#0.004048` ; `#2.5527` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; `#2.0` ] ; + [ `#0.000405` ; `#2.585391` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; [ `#0.004048` ; `#2.5527` ; `#2.0` ; `#2.0` ; `#2.0` ; + `#2.463509` ; `#2.0` ] ] ; [ [ `#2.0` ] ; [ `-- #0.001161` ; `-- #0.074623` ; `#0.079355` ; `#0.068595` ; + `-- #0.608613` ; `-- #0.023711` ; `-- #0.068595` ; `#0.719631` ; `-- #0.023711` ; `#0.068595` ; `-- #0.37789` ; + `-- #0.031932` ; `-- #0.068595` ; `#0.735738` ] ; [ `#0.0` ; `#0.0` ] ; [ `#1.0` ] ; [ `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ] ; + [ `#0.0` ; `#0.0` ; `#1.0` ] ; [ `#0.001019` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.61793` ; `#2.0` ; `#2.0` ] ; + [ `#0.004236` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; `#2.0` ] ; [ `#0.001162` ; `#2.520001` ; `#2.0` ; `#2.0` ; + `#2.0` ; `#2.0` ; `#2.0` ] ; [ `#0.001161` ; `#2.5527` ; `#2.0` ; `#2.0` ; `#2.057939` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#2.0` ] ; [ `-- #0.001161` ; `-- #0.074623` ; `#0.019702` ; `-- #0.081204` ; `#0.740105` ; `-- #0.023711` ; + `#0.081204` ; `-- #0.47876` ; `-- #0.031932` ; `-- #0.081204` ; `#0.836608` ; `#0.035942` ; `#0.081204` ; + `-- #0.629086` ] ; [ `#0.0` ; `#0.0` ] ; [ `#1.0` ] ; [ `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#1.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; + [ `#0.001084` ; `#2.552699` ; `#2.000001` ; `#2.000001` ; `#2.625659` ; `#2.000001` ; `#2.000001` ] ; + [ `#0.001161` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; [ `#0.002657` ; `#2.52` ; `#2.0` ; `#2.463509` ; + `#2.057939` ; `#2.0` ; `#2.0` ] ; [ `#0.001162` ; `#2.52` ; `#2.000001` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#2.0` ] ; [ `-- #0.001161` ; `-- #0.074623` ; `#0.019702` ; `-- #0.068595` ; `#0.639237` ; `-- #0.031932` ; + `#0.068595` ; `-- #0.361784` ; `-- #0.023711` ; `-- #0.068595` ; `#0.719631` ; `#0.035942` ; `#0.068595` ; + `-- #0.528217` ] ; [ `#0.0` ; `#0.0` ] ; [ `#1.0` ] ; [ `#0.0` ; `#0.0` ; `#1.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; + [ `#0.001084` ; `#2.5527` ; `#2.0` ; `#2.0` ; `#2.625659` ; `#2.0` ; `#2.0` ] ; + [ `#0.001161` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.057939` ; `#2.0` ; `#2.0` ] ; [ `#0.004236` ; `#2.52` ; `#2.0` ; `#2.463509` ; + `#2.0` ; `#2.0` ; `#2.0` ] ; [ `#0.001161` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#2.0` ] ; [ `-- #0.000308` ; `-- #0.090009` ; `#0.04151` ; `#0.073665` ; `-- #0.523458` ; `-- #0.013837` ; + `-- #0.073665` ; `#0.755879` ; `-- #0.013837` ; `#0.073665` ; `-- #0.422755` ; `-- #0.013837` ; `-- #0.073665` ; + `#0.755879` ] ; [ `#0.0` ; `#0.0` ; `#1.0` ] ; [ `#1.0` ; `#1.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; + [ `#0.0` ; `#0.0` ; `#0.0` ] ; [ `#0.000308` ; `#2.53635` ; `#2.0` ; `#2.0` ; `#2.650799` ; `#2.0` ; `#2.0` ] ; + [ `#0.000308` ; `#2.5527` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; [ `#0.000308` ; `#2.536357` ; `#2.0` ; `#2.0` ; `#2.0` ; + `#2.0` ; `#2.0` ] ; [ `#0.000308` ; `#2.5527` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#2.0` ] ; [ `-- #0.000418` ; `-- #0.17025` ; `#0.094709` ; `#0.098535` ; `-- #0.692034` ; `-- #0.021455` ; + `-- #0.098535` ; `#1.087114` ; `#0.009749` ; `#0.098535` ; `-- #0.568591` ; `-- #0.021455` ; `-- #0.098535` ; + `#1.087114` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; [ `#1.0` ; `#1.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; + [ `#0.0` ; `#0.0` ; `#0.0` ] ; [ `#0.000418` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.6508` ; `#2.0` ; `#2.0` ] ; + [ `#0.000418` ; `#2.53635` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; [ `#0.000418` ; `#2.536343` ; `#2.0` ; `#2.0` ; + `#2.000004` ; `#2.0` ; `#2.0` ] ; [ `#0.000418` ; `#2.53635` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#2.0` ] ; [ `-- #0.000644` ; `-- #0.172166` ; `#0.09973` ; `-- #0.099785` ; `#0.882284` ; `#0.014169` ; + `#0.099785` ; `-- #0.586728` ; `-- #0.017353` ; `-- #0.099785` ; `#1.0903` ; `#0.014169` ; `#0.099785` ; + `-- #0.586728` ] ; [ `#0.0` ; `#0.0` ] ; [ `#1.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; + [ `#0.000644` ; `#2.5527` ; `#2.0` ; `#2.0` ; `#2.6181` ; `#2.0` ; `#2.0` ] ; [ `#0.000644` ; `#2.5527` ; `#2.0` ; `#2.0` ; `#2.0` ; + `#2.0` ; `#2.0` ] ; [ `#0.000644` ; `#2.5527` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; + [ `#0.000644` ; `#2.5527` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#2.0` ] ; [ `-- #0.000313` ; `-- #0.084789` ; `#0.039845` ; `-- #0.071708` ; `#0.632521` ; `-- #0.013282` ; + `-- #0.071708` ; `#0.731624` ; `-- #0.013282` ; `-- #0.071708` ; `#0.731624` ; `-- #0.013282` ; `#0.071708` ; + `-- #0.415701` ] ; [ `#0.0` ] ; [ `#0.0` ] ; [ `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ] ; + [ `#0.000313` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.5854` ; `#2.0` ; `#2.0` ] ; [ `#0.003624` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.0` ; + `#2.463509` ; `#2.0` ] ; [ `#0.003624` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; `#2.0` ] ; + [ `#0.000314` ; `#2.520002` ; `#2.000002` ; `#2.000001` ; `#2.000001` ; `#2.000001` ; `#2.000001` ] ] ; + [ [ `#1.0` ] ; [ `-- #0.00272` ; `#0.065103` ; `-- #0.052337` ; `-- #0.02292` ; `#0.191326` ; `#0.23854` ; `#0.02292` ; + `-- #0.867278` ; `-- #0.073933` ; `-- #0.02292` ; `#0.286871` ; `-- #0.11227` ; `#0.02292` ; `-- #0.019974` ] ; + [ ] ; [ ] ; [ ] ; [ ] ; [ `#1.0` ] ; [ `#0.002703` ; `#2.6508` ; `#2.0` ; `#2.0` ; `#2.474335` ; `#2.0` ; `#2.0` ] ; + [ `#0.00272` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; [ `#0.004959` ; `#2.6508` ; `#2.0` ; `#2.463509` ; `#2.0` ; + `#2.0` ; `#2.0` ] ; [ `#0.002721` ; `#2.650799` ; `#2.0` ; `#2.0` ; `#2.231755` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#1.0` ] ; [ `-- #0.00272` ; `#0.065103` ; `-- #0.052337` ; `#0.02292` ; `-- #0.17539` ; `#0.23854` ; `-- #0.02292` ; + `-- #0.500562` ; `-- #0.11227` ; `#0.02292` ; `-- #0.019974` ; `-- #0.073933` ; `-- #0.02292` ; `#0.286871` ] ; + [ ] ; [ ] ; [ ] ; [ `#1.0` ] ; [ `#0.0` ] ; [ `#0.002703` ; `#2.650799` ; `#2.0` ; `#2.000001` ; `#2.474442` ; + `#2.000001` ; `#2.0` ] ; [ `#0.00272` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; + [ `#0.002721` ; `#2.650799` ; `#2.0` ; `#2.0` ; `#2.231755` ; `#2.0` ; `#2.0` ] ; + [ `#0.003897` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; `#2.0` ] ] ; + [ [ `#1.0` ] ; [ `-- #0.00272` ; `#0.065103` ; `-- #0.052337` ; `#0.02292` ; `-- #0.175391` ; `-- #0.11227` ; + `-- #0.02292` ; `#0.346743` ; `#0.23854` ; `#0.02292` ; `-- #0.867278` ; `-- #0.073933` ; `-- #0.02292` ; + `#0.286871` ] ; [ ] ; [ ] ; [ `#1.0` ] ; [ `#0.0` ] ; [ `#0.0` ] ; [ `#0.002703` ; `#2.650799` ; `#2.0` ; `#2.000001` ; + `#2.474442` ; `#2.000001` ; `#2.0` ] ; [ `#0.00272` ; `#2.6508` ; `#2.0` ; `#2.0` ; `#2.231754` ; `#2.0` ; `#2.0` ] ; + [ `#0.00272` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; [ `#0.003897` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; + `#2.0` ] ] ; [ [ `#1.0` ] ; [ `-- #0.004545` ; `#0.062681` ; `-- #0.026929` ; `#0.023742` ; `-- #0.242815` ; + `-- #0.06441` ; `-- #0.023742` ; `#0.273568` ; `#0.176245` ; `#0.023742` ; `-- #0.72849` ; `-- #0.084906` ; + `-- #0.023742` ; `#0.3039` ] ; [ `#1.0` ] ; [ ] ; [ `#0.0` ] ; [ `#0.0` ] ; [ `#0.0` ; `#1.0` ] ; + [ `#0.004424` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.491903` ; `#2.0` ; `#2.0` ] ; + [ `#0.006469` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; `#2.0` ] ; + [ `#0.004545` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; [ `#0.004545` ; `#2.6508` ; `#2.0` ; `#2.0` ; + `#2.115877` ; `#2.0` ; `#2.0` ] ] ; [ [ `#1.0` ] ; [ `-- #0.004545` ; `#0.062681` ; `-- #0.026929` ; `#0.023742` ; + `-- #0.242815` ; `#0.176245` ; `-- #0.023742` ; `-- #0.348621` ; `-- #0.084906` ; `#0.023742` ; `-- #0.075969` ; + `-- #0.06441` ; `-- #0.023742` ; `#0.273568` ] ; [ `#1.0` ] ; [ ] ; [ `#0.0` ] ; [ `#0.0` ; `#1.0` ] ; [ `#0.0` ; `#0.0` ] ; + [ `#0.004424` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.491903` ; `#2.0` ; `#2.0` ] ; + [ `#0.004545` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; [ `#0.004545` ; `#2.6508` ; `#2.0` ; `#2.0` ; + `#2.115877` ; `#2.0` ; `#2.0` ] ; [ `#0.006469` ; `#2.585401` ; `#2.0` ; `#2.000001` ; `#2.0` ; `#2.463508` ; `#2.0` ] ] ; + [ [ `#1.0` ] ; [ `-- #0.004545` ; `#0.062681` ; `-- #0.026929` ; `#0.023742` ; `-- #0.242815` ; `-- #0.084906` ; + `-- #0.023742` ; `#0.3039` ; `#0.176245` ; `#0.023742` ; `-- #0.72849` ; `-- #0.06441` ; `-- #0.023742` ; + `#0.273568` ] ; [ `#1.0` ] ; [ ] ; [ `#0.0` ; `#1.0` ] ; [ `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ] ; + [ `#0.004424` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.491903` ; `#2.0` ; `#2.0` ] ; + [ `#0.004545` ; `#2.6508` ; `#2.0` ; `#2.0` ; `#2.115877` ; `#2.0` ; `#2.0` ] ; + [ `#0.004545` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; [ `#0.006469` ; `#2.585401` ; `#2.0` ; `#2.000001` ; + `#2.0` ; `#2.463508` ; `#2.0` ] ] ; [ [ `#1.0` ] ; [ `-- #0.000884` ; `#0.061714` ; `-- #0.014502` ; `-- #0.02407` ; + `#0.104941` ; `#0.134266` ; `#0.02407` ; `-- #0.631477` ; `-- #0.059882` ; `-- #0.02407` ; `#0.261947` ; + `-- #0.059882` ; `-- #0.02407` ; `#0.261947` ] ; [ `#1.0` ; `#1.0` ] ; [ ] ; [ `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ] ; + [ `#0.0` ; `#0.0` ] ; [ `#0.000796` ; `#2.6508` ; `#2.0` ; `#2.0` ; `#2.488246` ; `#2.0` ; `#2.0` ] ; + [ `#0.000884` ; `#2.6181` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; [ `#0.003066` ; `#2.618101` ; `#2.0` ; `#2.0` ; `#2.0` ; + `#2.463509` ; `#2.0` ] ; [ `#0.003066` ; `#2.618101` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; `#2.0` ] ] ; + [ [ `#1.0` ] ; [ `-- #0.001974` ; `-- #0.0469` ; `#0.051237` ; `#0.060747` ; `-- #0.530637` ; `-- #0.014413` ; + `-- #0.060747` ; `#0.594377` ; `-- #0.014413` ; `#0.060747` ; `-- #0.377571` ; `-- #0.02241` ; `-- #0.060747` ; + `#0.608509` ] ; [ `#1.0` ; `#0.0` ] ; [ ] ; [ `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#1.0` ] ; + [ `#0.002084` ; `#2.585663` ; `#2.000116` ; `#2.000116` ; `#2.519822` ; `#2.000113` ; `#2.000116` ] ; + [ `#0.005733` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; `#2.0` ] ; + [ `#0.001976` ; `#2.618027` ; `#2.000001` ; `#2.000001` ; `#2.000002` ; `#2.000001` ; `#2.000001` ] ; + [ `#0.001974` ; `#2.6181` ; `#2.0` ; `#2.0` ; `#2.057939` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#1.0` ] ; [ `-- #0.001974` ; `-- #0.0469` ; `#0.051237` ; `-- #0.073427` ; `#0.542756` ; `-- #0.014413` ; + `#0.073427` ; `-- #0.479016` ; `-- #0.02241` ; `-- #0.073427` ; `#0.709954` ; `-- #0.014413` ; `#0.073427` ; + `-- #0.479016` ] ; [ `#1.0` ; `#0.0` ] ; [ ] ; [ `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#1.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; + [ `#0.001974` ; `#2.6181` ; `#2.0` ; `#2.0` ; `#2.52` ; `#2.0` ; `#2.0` ] ; [ `#0.001974` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.0` ; + `#2.0` ; `#2.0` ] ; [ `#0.004138` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.057939` ; `#2.463509` ; `#2.0` ] ; + [ `#0.001974` ; `#2.585401` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#1.0` ] ; [ `-- #0.001974` ; `-- #0.0469` ; `#0.051237` ; `-- #0.060747` ; `#0.44131200000000004` ; + `-- #0.02241` ; `#0.060747` ; `-- #0.36344` ; `-- #0.014413` ; `-- #0.060747` ; `#0.594377` ; `-- #0.014413` ; + `#0.060747` ; `-- #0.377571` ] ; [ `#1.0` ; `#0.0` ] ; [ ] ; [ `#0.0` ; `#0.0` ; `#1.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; + [ `#0.0` ; `#0.0` ; `#0.0` ] ; [ `#0.002165` ; `#2.585453` ; `#2.000636` ; `#2.000639` ; `#2.51972` ; `#2.000635` ; + `#2.000606` ] ; [ `#0.001975` ; `#2.585404` ; `#2.000001` ; `#2.000001` ; `#2.05794` ; `#2.000001` ; + `#2.000001` ] ; [ `#0.001974` ; `#2.6181` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; + [ `#0.001975` ; `#2.585402` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#1.0` ] ; [ `-- #0.00033` ; `-- #0.036939` ; `#0.050064` ; `#0.057593` ; `-- #0.523604` ; `-- #0.016688` ; + `-- #0.057593` ; `#0.559062` ; `-- #0.016688` ; `#0.057593` ; `-- #0.362427` ; `-- #0.016688` ; `-- #0.057593` ; + `#0.559062` ] ; [ `#1.0` ; `#0.0` ; `#1.0` ] ; [ ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; + [ `#0.000403` ; `#2.609586` ; `#2.000023` ; `#2.00002` ; `#2.519733` ; `#2.000019` ; `#2.000024` ] ; + [ `#0.00033` ; `#2.6181` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ; [ `#0.00033` ; `#2.601753` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; + `#2.0` ] ; [ `#0.00033` ; `#2.6181` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ] ; + [ [ `#1.0` ] ; [ `-- #0.000886` ; `-- #0.177145` ; `#0.151334` ; `-- #0.103308` ; `#0.774954` ; `#0.041584` ; + `#0.103308` ; `-- #0.677721` ; `#0.00995` ; `-- #0.103308` ; `#1.057518` ; `#0.041584` ; `#0.103308` ; + `-- #0.677721` ] ; [ `#1.0` ; `#0.0` ; `#0.0` ] ; [ ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; [ `#0.0` ; `#0.0` ; `#0.0` ] ; + [ `#0.000886` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.52` ; `#2.0` ; `#2.0` ] ; [ `#0.000887` ; `#2.601712` ; `#2.000001` ; + `#2.000001` ; `#2.000015` ; `#2.000001` ; `#2.000001` ] ; [ `#0.000886` ; `#2.601749` ; `#2.0` ; `#2.0` ; `#2.0` ; + `#2.000001` ; `#2.0` ] ; [ `#0.000887` ; `#2.601712` ; `#2.000001` ; `#2.000001` ; `#2.000015` ; + `#2.000001` ; `#2.000001` ] ] ; [ [ `#1.0` ] ; [ `-- #0.001328` ; `-- #0.121189` ; `#0.06473` ; `-- #0.084657` ; + `#0.741383` ; `-- #0.016252` ; `#0.084657` ; `-- #0.45858` ; `-- #0.022099` ; `-- #0.084657` ; `#0.911046` ; + `-- #0.016252` ; `#0.084657` ; `-- #0.45858` ] ; [ `#0.0` ] ; [ ] ; [ `#0.0` ] ; [ `#0.0` ] ; [ `#0.0` ] ; + [ `#0.001328` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.52` ; `#2.0` ; `#2.0` ] ; [ `#0.001328` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; + `#2.0` ] ; [ `#0.006318` ; `#2.52` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.463509` ; `#2.0` ] ; + [ `#0.001328` ; `#2.5854` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ; `#2.0` ] ] ];; + +let records = map mk_irecord raw_nonlindatah;; + +(* +let nonlindata = [ [ [ 4.0 ] ; [ -0.00289 ; 0.129913 ; -0.060416 ; 0.002372 ; -0.113134 ; 0.01764 ; + -0.002372 ; -0.198777 ; 0.045166 ; 0.002372 ; -0.306092 ; 0.021777 ; -0.002372 ; + -0.259166 ] ; [ ] ; [ ] ; [ ] ; [ ] ; [ 1.0 ] ; [ 0.003326 ; 2.463509 ; 2.0 ; 2.0 ; 2.52 ; 2.0 ; + 2.0 ] ; [ 0.00289 ; 2.463514 ; 2.0 ; 2.463508 ; 2.0 ; 2.000001 ; 2.000001 ] ; + [ 0.003534 ; 2.463509 ; 2.000001 ; 2.463508 ; 2.0 ; 2.0 ; 2.000001 ] ; + [ 0.00289 ; 2.52 ; 2.0 ; 2.0 ; 2.231754 ; 2.0 ; 2.0 ] ] ; + [ [ 4.0 ] ; [ -0.002889 ; 0.129699 ; -0.060316 ; 0.002264 ; -0.112116 ; 0.019214 ; + -0.002264 ; -0.203309 ; 0.021887 ; 0.002264 ; -0.29619 ; 0.019214 ; -0.002264 ; + -0.203309 ] ; [ ] ; [ ] ; [ ] ; [ 1.0 ] ; [ 0.0 ] ; [ 0.003328 ; 2.463509 ; 2.0 ; 2.0 ; 2.52 ; 2.0 ; + 2.0 ] ; [ 0.00289 ; 2.463513 ; 2.0 ; 2.463508 ; 2.0 ; 2.000001 ; 2.0 ] ; + [ 0.002889 ; 2.463509 ; 2.0 ; 2.0 ; 2.231754 ; 2.0 ; 2.0 ] ; + [ 0.002998 ; 2.519915 ; 2.000025 ; 2.000038 ; 2.000022 ; 2.463485 ; 2.000022 ] ] ; + [ [ 4.0 ] ; [ -0.00289 ; 0.129913 ; -0.060416 ; 0.002372 ; -0.113134 ; 0.021777 ; + -0.002372 ; -0.259166 ; 0.045166 ; 0.002372 ; -0.306092 ; 0.01764 ; -0.002372 ; + -0.198777 ] ; [ ] ; [ ] ; [ 1.0 ] ; [ 0.0 ] ; [ 0.0 ] ; [ 0.003326 ; 2.463509 ; 2.0 ; 2.0 ; 2.52 ; + 2.0 ; 2.0 ] ; [ 0.00289 ; 2.52 ; 2.0 ; 2.0 ; 2.231754 ; 2.0 ; 2.0 ] ; + [ 0.003534 ; 2.463509 ; 2.0 ; 2.0 ; 2.0 ; 2.463508 ; 2.0 ] ; + [ 0.002915 ; 2.519935 ; 2.000027 ; 2.00004 ; 2.000024 ; 2.463484 ; 2.000025 ] ] ; + [ [ 4.0 ] ; [ -0.000426 ; -0.114872 ; 0.133539 ; -0.080919 ; 0.532524 ; 0.148605 ; + 0.080919 ; -0.855148 ; 0.08743 ; -0.080919 ; 0.593722 ; 0.148605 ; 0.080919 ; + -0.855148 ] ; [ ] ; [ ] ; [ 0.0 ] ; [ 0.0 ] ; [ 0.0 ] ; [ 0.000426 ; 2.463509 ; 2.0 ; 2.0 ; 2.6508 ; + 2.0 ; 2.0 ] ; [ 0.000435 ; 2.463511 ; 2.000001 ; 2.000001 ; 2.000002 ; 2.000002 ; + 2.000002 ] ; [ 0.004824 ; 2.46351 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; 2.0 ] ; + [ 0.000435 ; 2.463511 ; 2.000001 ; 2.000001 ; 2.000002 ; 2.000002 ; 2.000002 ] ] ; + [ [ 3.0 ] ; [ -0.00272 ; 0.065103 ; -0.008732 ; -0.024884 ; 0.097156 ; 0.072591 ; + 0.024884 ; -0.464803 ; 0.042651 ; -0.024884 ; 0.008797 ; 0.055356 ; 0.024884 ; + -0.458108 ] ; [ ] ; [ ] ; [ ] ; [ ] ; [ 1.0 ] ; [ 0.002594 ; 2.52 ; 2.0 ; 2.0 ; 2.491729 ; 2.0 ; + 2.0 ] ; [ 0.00272 ; 2.463509 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; + [ 0.00272 ; 2.463509 ; 2.0 ; 2.463509 ; 2.0 ; 2.0 ; 2.0 ] ; + [ 0.00272 ; 2.52 ; 2.0 ; 2.0 ; 2.231754 ; 2.0 ; 2.0 ] ] ; + [ [ 3.0 ] ; [ -0.00272 ; 0.065103 ; -0.029778 ; -0.027449 ; 0.170713 ; 0.072591 ; + 0.027449 ; -0.485323 ; 0.055356 ; -0.027449 ; -0.039438 ; 0.072591 ; 0.027449 ; + -0.485323 ] ; [ ] ; [ ] ; [ ] ; [ 1.0 ] ; [ 0.0 ] ; [ 0.002594 ; 2.52 ; 2.0 ; 2.0 ; 2.491998 ; 2.0 ; + 2.0 ] ; [ 0.00272 ; 2.463509 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; + [ 0.00272 ; 2.463509 ; 2.0 ; 2.0 ; 2.231754 ; 2.0 ; 2.0 ] ; + [ 0.00272 ; 2.463509 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ] ; + [ [ 3.0 ] ; [ -0.00272 ; 0.065103 ; -0.008732 ; 0.025458 ; -0.30558 ; 0.055356 ; + -0.025458 ; -0.055371 ; 0.072591 ; 0.025458 ; -0.469389 ; 0.037947 ; -0.025458 ; + 0.025236 ] ; [ ] ; [ ] ; [ 1.0 ] ; [ 0.0 ] ; [ 0.0 ] ; [ 0.002612 ; 2.463509 ; 2.0 ; 2.0 ; + 2.489061 ; 2.0 ; 2.0 ] ; [ 0.00272 ; 2.52 ; 2.0 ; 2.0 ; 2.231754 ; 2.0 ; 2.0 ] ; + [ 0.00272 ; 2.52 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; [ 0.00272 ; 2.463509 ; 2.0 ; 2.0 ; 2.0 ; + 2.463509 ; 2.0 ] ] ; [ [ 3.0 ] ; [ -0.00225 ; -0.114872 ; 0.116669 ; 0.080919 ; + -0.7251449999999999 ; 0.08743 ; -0.080919 ; 0.595546 ; 0.148605 ; 0.080919 ; + -0.853324 ; 0.08743 ; -0.080919 ; 0.595546 ] ; [ ] ; [ ] ; [ 0.0 ] ; [ 0.0 ] ; [ 0.0 ] ; + [ 0.00225 ; 2.519989 ; 2.0 ; 2.0 ; 2.52 ; 2.0 ; 2.0 ] ; [ 0.006648 ; 2.46351 ; 2.0 ; 2.0 ; 2.0 ; + 2.463509 ; 2.0 ] ; [ 0.002259 ; 2.463511 ; 2.000001 ; 2.000001 ; 2.000002 ; + 2.000002 ; 2.000002 ] ; [ 0.006648 ; 2.46351 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; 2.0 ] ] ; + [ [ 2.0 ] ; [ -0.00289 ; 0.129913 ; -0.09152 ; 0.002372 ; -0.034749 ; 0.347659 ; + -0.002372 ; -1.030425 ; -0.105208 ; 0.002372 ; 0.072849 ; -0.150931 ; -0.002372 ; + 0.176057 ] ; [ ] ; [ ] ; [ ] ; [ ] ; [ 1.0 ] ; [ 0.00289 ; 2.52 ; 2.0 ; 2.0 ; 2.52 ; 2.0 ; 2.0 ] ; + [ 0.00289 ; 2.52 ; 2.0 ; 2.463509 ; 2.0 ; 2.0 ; 2.0 ] ; [ 0.005089 ; 2.52 ; 2.0 ; 2.463509 ; + 2.0 ; 2.0 ; 2.0 ] ; [ 0.00289 ; 2.6508 ; 2.0 ; 2.0 ; 2.231754 ; 2.0 ; 2.0 ] ] ; + [ [ 2.0 ] ; [ -0.00289 ; 0.129913 ; 0.340765 ; 0.002372 ; -1.124108 ; -0.094917 ; + -0.002372 ; 0.084866 ; -0.150931 ; 0.002372 ; 0.138108 ; -0.094917 ; -0.002372 ; + 0.084866 ] ; [ ] ; [ ] ; [ ] ; [ 1.0 ] ; [ 0.0 ] ; [ 0.00289 ; 2.52 ; 2.0 ; 2.0 ; 2.52 ; 2.0 ; 2.0 ] ; + [ 0.00289 ; 2.52 ; 2.0 ; 2.463509 ; 2.0 ; 2.0 ; 2.0 ] ; [ 0.00289 ; 2.6508 ; 2.0 ; 2.0 ; + 2.231754 ; 2.0 ; 2.0 ] ; [ 0.00289 ; 2.520001 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; 2.0 ] ] ; + [ [ 2.0 ] ; [ -0.00289 ; 0.129913 ; -0.09152 ; 0.002372 ; -0.034749 ; 0.291645 ; + -0.002372 ; -0.939234 ; -0.105208 ; 0.002372 ; 0.072849 ; -0.094917 ; -0.002372 ; + 0.084866 ] ; [ ] ; [ ] ; [ 1.0 ] ; [ 0.0 ] ; [ 0.0 ] ; [ 0.00289 ; 2.52 ; 2.0 ; 2.0 ; 2.52 ; 2.0 ; + 2.0 ] ; [ 0.00289 ; 2.52 ; 2.0 ; 2.0 ; 2.231754 ; 2.0 ; 2.0 ] ; + [ 0.005089 ; 2.520002 ; 2.000001 ; 2.000001 ; 2.000001 ; 2.463507 ; 2.000001 ] ; + [ 0.00289 ; 2.520001 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; 2.0 ] ] ; + [ [ 2.0 ] ; [ -0.005361 ; 0.128506 ; 0.290371 ; 0.003287 ; -1.026581 ; -0.070878 ; + -0.003287 ; 0.033394 ; -0.097658 ; 0.003287 ; 0.050047 ; -0.121835 ; -0.003287 ; + 0.13571 ] ; [ 1.0 ] ; [ ] ; [ 0.0 ] ; [ 0.0 ] ; [ 0.0 ; 1.0 ] ; [ 0.005361 ; 2.5854 ; 2.0 ; 2.0 ; 2.52 ; + 2.0 ; 2.0 ] ; [ 0.005361 ; 2.585401 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; 2.0 ] ; + [ 0.008408 ; 2.5854 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; 2.0 ] ; + [ 0.005361 ; 2.6508 ; 2.0 ; 2.0 ; 2.115877 ; 2.0 ; 2.0 ] ] ; + [ [ 2.0 ] ; [ -0.005361 ; 0.128506 ; 0.263591 ; 0.003287 ; -0.957343 ; -0.070878 ; + -0.003287 ; 0.033394 ; -0.121835 ; 0.003287 ; 0.083125 ; -0.070878 ; -0.003287 ; + 0.033394 ] ; [ 1.0 ] ; [ ] ; [ 0.0 ] ; [ 0.0 ; 1.0 ] ; [ 0.0 ; 0.0 ] ; + [ 0.005361 ; 2.5854 ; 2.0 ; 2.0 ; 2.52 ; 2.0 ; 2.0 ] ; [ 0.005361 ; 2.585401 ; 2.0 ; 2.0 ; 2.0 ; + 2.463509 ; 2.0 ] ; [ 0.005361 ; 2.6508 ; 2.0 ; 2.0 ; 2.115877 ; 2.0 ; 2.0 ] ; + [ 0.005362 ; 2.585403 ; 2.0 ; 2.000001 ; 2.0 ; 2.463508 ; 2.0 ] ] ; + [ [ 2.0 ] ; [ -0.005361 ; 0.128506 ; -0.066254 ; 0.003287 ; -0.104563 ; 0.234791 ; + -0.003287 ; -0.786309 ; -0.097658 ; 0.003287 ; 0.050047 ; -0.070878 ; -0.003287 ; + 0.033394 ] ; [ 1.0 ] ; [ ] ; [ 0.0 ; 1.0 ] ; [ 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ] ; + [ 0.005361 ; 2.5854 ; 2.0 ; 2.0 ; 2.52 ; 2.0 ; 2.0 ] ; [ 0.005361 ; 2.5854 ; 2.0 ; 2.0 ; + 2.115877 ; 2.0 ; 2.0 ] ; [ 0.008409 ; 2.585403 ; 2.000001 ; 2.000001 ; 2.000001 ; + 2.463508 ; 2.000001 ] ; [ 0.005362 ; 2.585403 ; 2.0 ; 2.000001 ; 2.0 ; 2.463508 ; + 2.0 ] ] ; [ [ 2.0 ] ; [ -0.001637 ; 0.127166 ; -0.07331 ; 0.003788 ; -0.105909 ; 0.23984 ; + -0.003788 ; -0.767737 ; -0.096981 ; 0.003788 ; 0.04248 ; -0.069548 ; -0.003788 ; + 0.032155 ] ; [ 1.0 ] ; [ 1.0 ] ; [ 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ] ; + [ 0.001637 ; 2.5854 ; 2.0 ; 2.0 ; 2.5854 ; 2.0 ; 2.0 ] ; [ 0.001637 ; 2.5854 ; 2.0 ; 2.0 ; 2.0 ; + 2.0 ; 2.0 ] ; [ 0.005148 ; 2.5854 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; 2.0 ] ; + [ 0.001637 ; 2.585403 ; 2.0 ; 2.000001 ; 2.0 ; 2.463508 ; 2.0 ] ] ; + [ [ 2.0 ] ; [ -0.00125 ; 0.126777 ; -0.053069 ; 0.003525 ; -0.142652 ; 0.196466 ; + -0.003525 ; -0.667227 ; -0.093532 ; 0.003525 ; 0.035622 ; -0.049865 ; -0.003525 ; + -0.022307 ] ; [ 1.0 ; 1.0 ] ; [ 0.0 ] ; [ 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ] ; + [ 0.00125 ; 2.6181 ; 2.0 ; 2.0 ; 2.52 ; 2.463509 ; 2.0 ] ; + [ 0.001388 ; 2.6181 ; 2.000001 ; 2.000001 ; 2.0 ; 2.463508 ; 2.0 ] ; + [ 0.004482 ; 2.6508 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; 2.0 ] ; + [ 0.001388 ; 2.618101 ; 2.000001 ; 2.000002 ; 2.0 ; 2.463508 ; 2.000001 ] ] ; + [ [ 2.0 ] ; [ -0.001974 ; -0.0469 ; 0.051237 ; 0.060747 ; -0.530637 ; -0.014413 ; + -0.060747 ; 0.594377 ; -0.014413 ; 0.060747 ; -0.377571 ; -0.02241 ; -0.060747 ; + 0.608509 ] ; [ 1.0 ; 0.0 ] ; [ 0.0 ] ; [ 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ; 1.0 ] ; + [ 0.001974 ; 2.5854 ; 2.0 ; 2.0 ; 2.520037 ; 2.0 ; 2.0 ] ; + [ 0.005733 ; 2.5854 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; 2.0 ] ; + [ 0.001976 ; 2.618027 ; 2.000001 ; 2.000001 ; 2.000002 ; 2.000001 ; 2.000001 ] ; + [ 0.001974 ; 2.6181 ; 2.0 ; 2.0 ; 2.057939 ; 2.0 ; 2.0 ] ] ; + [ [ 2.0 ] ; [ -0.001974 ; -0.0469 ; 0.051237 ; 0.060747 ; -0.530636 ; -0.014413 ; + -0.060747 ; 0.594377 ; -0.02241 ; 0.060747 ; -0.36344 ; -0.014413 ; -0.060747 ; + 0.594377 ] ; [ 1.0 ; 0.0 ] ; [ 0.0 ] ; [ 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ; 1.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; + [ 0.001974 ; 2.5854 ; 2.0 ; 2.0 ; 2.520037 ; 2.0 ; 2.0 ] ; + [ 0.005733 ; 2.5854 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; 2.0 ] ; + [ 0.001975 ; 2.585404 ; 2.000001 ; 2.000001 ; 2.05794 ; 2.000001 ; 2.000001 ] ; + [ 0.001974 ; 2.6181 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ] ; + [ [ 2.0 ] ; [ -0.001974 ; -0.0469 ; 0.051237 ; 0.060747 ; -0.530637 ; -0.02241 ; + -0.060747 ; 0.608509 ; -0.014413 ; 0.060747 ; -0.377571 ; -0.014413 ; -0.060747 ; + 0.594377 ] ; [ 1.0 ; 0.0 ] ; [ 0.0 ] ; [ 0.0 ; 0.0 ; 1.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; + [ 0.001974 ; 2.5854 ; 2.0 ; 2.0 ; 2.520037 ; 2.0 ; 2.0 ] ; + [ 0.001974 ; 2.6181 ; 2.0 ; 2.0 ; 2.057939 ; 2.0 ; 2.0 ] ; + [ 0.001975 ; 2.585402 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; [ 0.001974 ; 2.6181 ; 2.0 ; 2.0 ; 2.0 ; + 2.0 ; 2.0 ] ] ; [ [ 2.0 ] ; [ -0.00033 ; -0.036939 ; 0.050064 ; -0.057593 ; 0.397884 ; + -0.016688 ; 0.057593 ; -0.362427 ; -0.016688 ; -0.057593 ; 0.559062 ; -0.016688 ; + -0.057593 ; 0.559062 ] ; [ 1.0 ; 0.0 ; 1.0 ] ; [ 0.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; + [ 0.0 ; 0.0 ; 0.0 ] ; [ 0.00033 ; 2.618094 ; 2.000003 ; 2.000003 ; 2.520014 ; 2.000003 ; + 2.000003 ] ; [ 0.00033 ; 2.601753 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; + [ 0.00033 ; 2.6181 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; [ 0.00033 ; 2.6181 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; + 2.0 ] ] ; [ [ 2.0 ] ; [ -0.000417 ; -0.049823 ; 0.047052 ; -0.061687 ; 0.463622 ; + -0.015684 ; 0.061687 ; -0.379191 ; -0.015684 ; -0.061687 ; 0.607807 ; -0.015684 ; + 0.061687 ; -0.379191 ] ; [ 1.0 ; 0.0 ; 0.0 ] ; [ 0.0 ; 1.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; + [ 0.0 ; 0.0 ; 0.0 ] ; [ 0.000417 ; 2.60175 ; 2.0 ; 2.0 ; 2.5527 ; 2.0 ; 2.0 ] ; + [ 0.000418 ; 2.601748 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; [ 0.000417 ; 2.60175 ; 2.0 ; 2.0 ; 2.0 ; + 2.0 ; 2.0 ] ; [ 0.000418 ; 2.601748 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ] ; + [ [ 2.0 ] ; [ -0.000396 ; -0.053582 ; 0.049452 ; -0.06302 ; 0.475514 ; -0.013853 ; + 0.06302 ; -0.389234 ; -0.020791 ; -0.06302 ; 0.637132 ; -0.013853 ; -0.062897 ; + 0.618101 ] ; [ 1.0 ; 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; + [ 0.0 ; 0.0 ; 0.0 ] ; [ 0.000359 ; 2.601749 ; 2.0 ; 2.0 ; 2.536279 ; 2.0 ; 2.0 ] ; + [ 0.000396 ; 2.601748 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; [ 0.000396 ; 2.60175 ; 2.0 ; 2.0 ; 2.0 ; + 2.0 ; 2.0 ] ; [ 0.000396 ; 2.60175 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ] ; + [ [ 2.0 ] ; [ -0.002012 ; -0.066935 ; 0.079693 ; 0.066241 ; -0.605497 ; -0.021495 ; + -0.066241 ; 0.685308 ; -0.021495 ; 0.066241 ; -0.374549 ; -0.036704 ; -0.066241 ; + 0.715304 ] ; [ 0.0 ] ; [ ] ; [ 0.0 ] ; [ 0.0 ] ; [ 0.0 ; 1.0 ] ; [ 0.00141 ; 2.52 ; 2.0 ; 2.0 ; + 2.584895 ; 2.0 ; 2.0 ] ; [ 0.004908 ; 2.52 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; 2.0 ] ; + [ 0.002012 ; 2.585399 ; 2.000001 ; 2.000001 ; 2.000001 ; 2.000001 ; 2.0 ] ; + [ 0.002012 ; 2.5854 ; 2.0 ; 2.0 ; 2.115877 ; 2.0 ; 2.0 ] ] ; + [ [ 2.0 ] ; [ -0.002012 ; -0.066935 ; 0.028887 ; 0.066241 ; -0.477466 ; -0.021495 ; + -0.066241 ; 0.685308 ; 0.014102 ; 0.066241 ; -0.472584 ; -0.021495 ; -0.066241 ; + 0.685308 ] ; [ 0.0 ] ; [ ] ; [ 0.0 ] ; [ 0.0 ; 1.0 ] ; [ 0.0 ; 0.0 ] ; + [ 0.001651 ; 2.5854 ; 2.0 ; 2.0 ; 2.596115 ; 2.0 ; 2.0 ] ; + [ 0.004908 ; 2.52 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; 2.0 ] ; [ 0.002012 ; 2.52 ; 2.0 ; 2.0 ; + 2.115878 ; 2.0 ; 2.0 ] ; [ 0.004908 ; 2.52 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; 2.0 ] ] ; + [ [ 2.0 ] ; [ -0.002012 ; -0.066935 ; 0.028887 ; -0.066241 ; 0.582391 ; 0.014102 ; + 0.066241 ; -0.472584 ; -0.021495 ; -0.066241 ; 0.685308 ; -0.021495 ; 0.066241 ; + -0.374549 ] ; [ 0.0 ] ; [ ] ; [ 0.0 ; 1.0 ] ; [ 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ] ; + [ 0.00141 ; 2.520001 ; 2.000001 ; 2.000001 ; 2.58489 ; 2.000001 ; 2.000001 ] ; + [ 0.002012 ; 2.52 ; 2.0 ; 2.0 ; 2.115878 ; 2.0 ; 2.0 ] ; [ 0.004908 ; 2.52 ; 2.0 ; 2.0 ; 2.0 ; + 2.463509 ; 2.0 ] ; [ 0.002012 ; 2.520001 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ] ; + [ [ 2.0 ] ; [ -0.000405 ; -0.070081 ; 0.043025 ; 0.06775 ; -0.520998 ; -0.014342 ; + -0.06775 ; 0.681778 ; -0.014342 ; 0.06775 ; -0.402228 ; -0.014342 ; -0.06775 ; + 0.681778 ] ; [ 0.0 ; 1.0 ] ; [ 1.0 ] ; [ 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ] ; + [ 0.000317 ; 2.585399 ; 2.0 ; 2.0 ; 2.612413 ; 2.0 ; 2.0 ] ; + [ 0.004048 ; 2.5527 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; 2.0 ] ; + [ 0.000405 ; 2.585391 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; [ 0.004048 ; 2.5527 ; 2.0 ; 2.0 ; 2.0 ; + 2.463509 ; 2.0 ] ] ; [ [ 2.0 ] ; [ -0.001161 ; -0.074623 ; 0.079355 ; 0.068595 ; + -0.608613 ; -0.023711 ; -0.068595 ; 0.719631 ; -0.023711 ; 0.068595 ; -0.37789 ; + -0.031932 ; -0.068595 ; 0.735738 ] ; [ 0.0 ; 0.0 ] ; [ 1.0 ] ; [ 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ] ; + [ 0.0 ; 0.0 ; 1.0 ] ; [ 0.001019 ; 2.52 ; 2.0 ; 2.0 ; 2.61793 ; 2.0 ; 2.0 ] ; + [ 0.004236 ; 2.52 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; 2.0 ] ; [ 0.001162 ; 2.520001 ; 2.0 ; 2.0 ; + 2.0 ; 2.0 ; 2.0 ] ; [ 0.001161 ; 2.5527 ; 2.0 ; 2.0 ; 2.057939 ; 2.0 ; 2.0 ] ] ; + [ [ 2.0 ] ; [ -0.001161 ; -0.074623 ; 0.019702 ; -0.081204 ; 0.740105 ; -0.023711 ; + 0.081204 ; -0.47876 ; -0.031932 ; -0.081204 ; 0.836608 ; 0.035942 ; 0.081204 ; + -0.629086 ] ; [ 0.0 ; 0.0 ] ; [ 1.0 ] ; [ 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ; 1.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; + [ 0.001084 ; 2.552699 ; 2.000001 ; 2.000001 ; 2.625659 ; 2.000001 ; 2.000001 ] ; + [ 0.001161 ; 2.52 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; [ 0.002657 ; 2.52 ; 2.0 ; 2.463509 ; + 2.057939 ; 2.0 ; 2.0 ] ; [ 0.001162 ; 2.52 ; 2.000001 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ] ; + [ [ 2.0 ] ; [ -0.001161 ; -0.074623 ; 0.019702 ; -0.068595 ; 0.639237 ; -0.031932 ; + 0.068595 ; -0.361784 ; -0.023711 ; -0.068595 ; 0.719631 ; 0.035942 ; 0.068595 ; + -0.528217 ] ; [ 0.0 ; 0.0 ] ; [ 1.0 ] ; [ 0.0 ; 0.0 ; 1.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; + [ 0.001084 ; 2.5527 ; 2.0 ; 2.0 ; 2.625659 ; 2.0 ; 2.0 ] ; + [ 0.001161 ; 2.52 ; 2.0 ; 2.0 ; 2.057939 ; 2.0 ; 2.0 ] ; [ 0.004236 ; 2.52 ; 2.0 ; 2.463509 ; + 2.0 ; 2.0 ; 2.0 ] ; [ 0.001161 ; 2.52 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ] ; + [ [ 2.0 ] ; [ -0.000308 ; -0.090009 ; 0.04151 ; 0.073665 ; -0.523458 ; -0.013837 ; + -0.073665 ; 0.755879 ; -0.013837 ; 0.073665 ; -0.422755 ; -0.013837 ; -0.073665 ; + 0.755879 ] ; [ 0.0 ; 0.0 ; 1.0 ] ; [ 1.0 ; 1.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; + [ 0.0 ; 0.0 ; 0.0 ] ; [ 0.000308 ; 2.53635 ; 2.0 ; 2.0 ; 2.650799 ; 2.0 ; 2.0 ] ; + [ 0.000308 ; 2.5527 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; [ 0.000308 ; 2.536357 ; 2.0 ; 2.0 ; 2.0 ; + 2.0 ; 2.0 ] ; [ 0.000308 ; 2.5527 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ] ; + [ [ 2.0 ] ; [ -0.000418 ; -0.17025 ; 0.094709 ; 0.098535 ; -0.692034 ; -0.021455 ; + -0.098535 ; 1.087114 ; 0.009749 ; 0.098535 ; -0.568591 ; -0.021455 ; -0.098535 ; + 1.087114 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; [ 1.0 ; 1.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; + [ 0.0 ; 0.0 ; 0.0 ] ; [ 0.000418 ; 2.52 ; 2.0 ; 2.0 ; 2.6508 ; 2.0 ; 2.0 ] ; + [ 0.000418 ; 2.53635 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; [ 0.000418 ; 2.536343 ; 2.0 ; 2.0 ; + 2.000004 ; 2.0 ; 2.0 ] ; [ 0.000418 ; 2.53635 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ] ; + [ [ 2.0 ] ; [ -0.000644 ; -0.172166 ; 0.09973 ; -0.099785 ; 0.882284 ; 0.014169 ; + 0.099785 ; -0.586728 ; -0.017353 ; -0.099785 ; 1.0903 ; 0.014169 ; 0.099785 ; + -0.586728 ] ; [ 0.0 ; 0.0 ] ; [ 1.0 ; 0.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; + [ 0.000644 ; 2.5527 ; 2.0 ; 2.0 ; 2.6181 ; 2.0 ; 2.0 ] ; [ 0.000644 ; 2.5527 ; 2.0 ; 2.0 ; 2.0 ; + 2.0 ; 2.0 ] ; [ 0.000644 ; 2.5527 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; + [ 0.000644 ; 2.5527 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ] ; + [ [ 2.0 ] ; [ -0.000313 ; -0.084789 ; 0.039845 ; -0.071708 ; 0.632521 ; -0.013282 ; + -0.071708 ; 0.731624 ; -0.013282 ; -0.071708 ; 0.731624 ; -0.013282 ; 0.071708 ; + -0.415701 ] ; [ 0.0 ] ; [ 0.0 ] ; [ 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ] ; + [ 0.000313 ; 2.52 ; 2.0 ; 2.0 ; 2.5854 ; 2.0 ; 2.0 ] ; [ 0.003624 ; 2.52 ; 2.0 ; 2.0 ; 2.0 ; + 2.463509 ; 2.0 ] ; [ 0.003624 ; 2.52 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; 2.0 ] ; + [ 0.000314 ; 2.520002 ; 2.000002 ; 2.000001 ; 2.000001 ; 2.000001 ; 2.000001 ] ] ; + [ [ 1.0 ] ; [ -0.00272 ; 0.065103 ; -0.052337 ; -0.02292 ; 0.191326 ; 0.23854 ; 0.02292 ; + -0.867278 ; -0.073933 ; -0.02292 ; 0.286871 ; -0.11227 ; 0.02292 ; -0.019974 ] ; + [ ] ; [ ] ; [ ] ; [ ] ; [ 1.0 ] ; [ 0.002703 ; 2.6508 ; 2.0 ; 2.0 ; 2.474335 ; 2.0 ; 2.0 ] ; + [ 0.00272 ; 2.52 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; [ 0.004959 ; 2.6508 ; 2.0 ; 2.463509 ; 2.0 ; + 2.0 ; 2.0 ] ; [ 0.002721 ; 2.650799 ; 2.0 ; 2.0 ; 2.231755 ; 2.0 ; 2.0 ] ] ; + [ [ 1.0 ] ; [ -0.00272 ; 0.065103 ; -0.052337 ; 0.02292 ; -0.17539 ; 0.23854 ; -0.02292 ; + -0.500562 ; -0.11227 ; 0.02292 ; -0.019974 ; -0.073933 ; -0.02292 ; 0.286871 ] ; + [ ] ; [ ] ; [ ] ; [ 1.0 ] ; [ 0.0 ] ; [ 0.002703 ; 2.650799 ; 2.0 ; 2.000001 ; 2.474442 ; + 2.000001 ; 2.0 ] ; [ 0.00272 ; 2.52 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; + [ 0.002721 ; 2.650799 ; 2.0 ; 2.0 ; 2.231755 ; 2.0 ; 2.0 ] ; + [ 0.003897 ; 2.52 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; 2.0 ] ] ; + [ [ 1.0 ] ; [ -0.00272 ; 0.065103 ; -0.052337 ; 0.02292 ; -0.175391 ; -0.11227 ; + -0.02292 ; 0.346743 ; 0.23854 ; 0.02292 ; -0.867278 ; -0.073933 ; -0.02292 ; + 0.286871 ] ; [ ] ; [ ] ; [ 1.0 ] ; [ 0.0 ] ; [ 0.0 ] ; [ 0.002703 ; 2.650799 ; 2.0 ; 2.000001 ; + 2.474442 ; 2.000001 ; 2.0 ] ; [ 0.00272 ; 2.6508 ; 2.0 ; 2.0 ; 2.231754 ; 2.0 ; 2.0 ] ; + [ 0.00272 ; 2.52 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; [ 0.003897 ; 2.52 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; + 2.0 ] ] ; [ [ 1.0 ] ; [ -0.004545 ; 0.062681 ; -0.026929 ; 0.023742 ; -0.242815 ; + -0.06441 ; -0.023742 ; 0.273568 ; 0.176245 ; 0.023742 ; -0.72849 ; -0.084906 ; + -0.023742 ; 0.3039 ] ; [ 1.0 ] ; [ ] ; [ 0.0 ] ; [ 0.0 ] ; [ 0.0 ; 1.0 ] ; + [ 0.004424 ; 2.5854 ; 2.0 ; 2.0 ; 2.491903 ; 2.0 ; 2.0 ] ; + [ 0.006469 ; 2.5854 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; 2.0 ] ; + [ 0.004545 ; 2.5854 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; [ 0.004545 ; 2.6508 ; 2.0 ; 2.0 ; + 2.115877 ; 2.0 ; 2.0 ] ] ; [ [ 1.0 ] ; [ -0.004545 ; 0.062681 ; -0.026929 ; 0.023742 ; + -0.242815 ; 0.176245 ; -0.023742 ; -0.348621 ; -0.084906 ; 0.023742 ; -0.075969 ; + -0.06441 ; -0.023742 ; 0.273568 ] ; [ 1.0 ] ; [ ] ; [ 0.0 ] ; [ 0.0 ; 1.0 ] ; [ 0.0 ; 0.0 ] ; + [ 0.004424 ; 2.5854 ; 2.0 ; 2.0 ; 2.491903 ; 2.0 ; 2.0 ] ; + [ 0.004545 ; 2.5854 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; [ 0.004545 ; 2.6508 ; 2.0 ; 2.0 ; + 2.115877 ; 2.0 ; 2.0 ] ; [ 0.006469 ; 2.585401 ; 2.0 ; 2.000001 ; 2.0 ; 2.463508 ; 2.0 ] ] ; + [ [ 1.0 ] ; [ -0.004545 ; 0.062681 ; -0.026929 ; 0.023742 ; -0.242815 ; -0.084906 ; + -0.023742 ; 0.3039 ; 0.176245 ; 0.023742 ; -0.72849 ; -0.06441 ; -0.023742 ; + 0.273568 ] ; [ 1.0 ] ; [ ] ; [ 0.0 ; 1.0 ] ; [ 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ] ; + [ 0.004424 ; 2.5854 ; 2.0 ; 2.0 ; 2.491903 ; 2.0 ; 2.0 ] ; + [ 0.004545 ; 2.6508 ; 2.0 ; 2.0 ; 2.115877 ; 2.0 ; 2.0 ] ; + [ 0.004545 ; 2.5854 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; [ 0.006469 ; 2.585401 ; 2.0 ; 2.000001 ; + 2.0 ; 2.463508 ; 2.0 ] ] ; [ [ 1.0 ] ; [ -0.000884 ; 0.061714 ; -0.014502 ; -0.02407 ; + 0.104941 ; 0.134266 ; 0.02407 ; -0.631477 ; -0.059882 ; -0.02407 ; 0.261947 ; + -0.059882 ; -0.02407 ; 0.261947 ] ; [ 1.0 ; 1.0 ] ; [ ] ; [ 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ] ; + [ 0.0 ; 0.0 ] ; [ 0.000796 ; 2.6508 ; 2.0 ; 2.0 ; 2.488246 ; 2.0 ; 2.0 ] ; + [ 0.000884 ; 2.6181 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; [ 0.003066 ; 2.618101 ; 2.0 ; 2.0 ; 2.0 ; + 2.463509 ; 2.0 ] ; [ 0.003066 ; 2.618101 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; 2.0 ] ] ; + [ [ 1.0 ] ; [ -0.001974 ; -0.0469 ; 0.051237 ; 0.060747 ; -0.530637 ; -0.014413 ; + -0.060747 ; 0.594377 ; -0.014413 ; 0.060747 ; -0.377571 ; -0.02241 ; -0.060747 ; + 0.608509 ] ; [ 1.0 ; 0.0 ] ; [ ] ; [ 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ; 1.0 ] ; + [ 0.002084 ; 2.585663 ; 2.000116 ; 2.000116 ; 2.519822 ; 2.000113 ; 2.000116 ] ; + [ 0.005733 ; 2.5854 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; 2.0 ] ; + [ 0.001976 ; 2.618027 ; 2.000001 ; 2.000001 ; 2.000002 ; 2.000001 ; 2.000001 ] ; + [ 0.001974 ; 2.6181 ; 2.0 ; 2.0 ; 2.057939 ; 2.0 ; 2.0 ] ] ; + [ [ 1.0 ] ; [ -0.001974 ; -0.0469 ; 0.051237 ; -0.073427 ; 0.542756 ; -0.014413 ; + 0.073427 ; -0.479016 ; -0.02241 ; -0.073427 ; 0.709954 ; -0.014413 ; 0.073427 ; + -0.479016 ] ; [ 1.0 ; 0.0 ] ; [ ] ; [ 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ; 1.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; + [ 0.001974 ; 2.6181 ; 2.0 ; 2.0 ; 2.52 ; 2.0 ; 2.0 ] ; [ 0.001974 ; 2.5854 ; 2.0 ; 2.0 ; 2.0 ; + 2.0 ; 2.0 ] ; [ 0.004138 ; 2.5854 ; 2.0 ; 2.0 ; 2.057939 ; 2.463509 ; 2.0 ] ; + [ 0.001974 ; 2.585401 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ] ; + [ [ 1.0 ] ; [ -0.001974 ; -0.0469 ; 0.051237 ; -0.060747 ; 0.44131200000000004 ; + -0.02241 ; 0.060747 ; -0.36344 ; -0.014413 ; -0.060747 ; 0.594377 ; -0.014413 ; + 0.060747 ; -0.377571 ] ; [ 1.0 ; 0.0 ] ; [ ] ; [ 0.0 ; 0.0 ; 1.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; + [ 0.0 ; 0.0 ; 0.0 ] ; [ 0.002165 ; 2.585453 ; 2.000636 ; 2.000639 ; 2.51972 ; 2.000635 ; + 2.000606 ] ; [ 0.001975 ; 2.585404 ; 2.000001 ; 2.000001 ; 2.05794 ; 2.000001 ; + 2.000001 ] ; [ 0.001974 ; 2.6181 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; + [ 0.001975 ; 2.585402 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ] ; + [ [ 1.0 ] ; [ -0.00033 ; -0.036939 ; 0.050064 ; 0.057593 ; -0.523604 ; -0.016688 ; + -0.057593 ; 0.559062 ; -0.016688 ; 0.057593 ; -0.362427 ; -0.016688 ; -0.057593 ; + 0.559062 ] ; [ 1.0 ; 0.0 ; 1.0 ] ; [ ] ; [ 0.0 ; 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; + [ 0.000403 ; 2.609586 ; 2.000023 ; 2.00002 ; 2.519733 ; 2.000019 ; 2.000024 ] ; + [ 0.00033 ; 2.6181 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ; [ 0.00033 ; 2.601753 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; + 2.0 ] ; [ 0.00033 ; 2.6181 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ] ; + [ [ 1.0 ] ; [ -0.000886 ; -0.177145 ; 0.151334 ; -0.103308 ; 0.774954 ; 0.041584 ; + 0.103308 ; -0.677721 ; 0.00995 ; -0.103308 ; 1.057518 ; 0.041584 ; 0.103308 ; + -0.677721 ] ; [ 1.0 ; 0.0 ; 0.0 ] ; [ ] ; [ 0.0 ; 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; [ 0.0 ; 0.0 ; 0.0 ] ; + [ 0.000886 ; 2.5854 ; 2.0 ; 2.0 ; 2.52 ; 2.0 ; 2.0 ] ; [ 0.000887 ; 2.601712 ; 2.000001 ; + 2.000001 ; 2.000015 ; 2.000001 ; 2.000001 ] ; [ 0.000886 ; 2.601749 ; 2.0 ; 2.0 ; 2.0 ; + 2.000001 ; 2.0 ] ; [ 0.000887 ; 2.601712 ; 2.000001 ; 2.000001 ; 2.000015 ; + 2.000001 ; 2.000001 ] ] ; [ [ 1.0 ] ; [ -0.001328 ; -0.121189 ; 0.06473 ; -0.084657 ; + 0.741383 ; -0.016252 ; 0.084657 ; -0.45858 ; -0.022099 ; -0.084657 ; 0.911046 ; + -0.016252 ; 0.084657 ; -0.45858 ] ; [ 0.0 ] ; [ ] ; [ 0.0 ] ; [ 0.0 ] ; [ 0.0 ] ; + [ 0.001328 ; 2.52 ; 2.0 ; 2.0 ; 2.52 ; 2.0 ; 2.0 ] ; [ 0.001328 ; 2.5854 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; + 2.0 ] ; [ 0.006318 ; 2.52 ; 2.0 ; 2.0 ; 2.0 ; 2.463509 ; 2.0 ] ; + [ 0.001328 ; 2.5854 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ; 2.0 ] ] ];; +*) + + + + +(* + raw data from Mathematica + output /tmp/ineqdata3q1h.ml (with cutoff = 0.0003), + book_code/sphereBook.nb, svn version 1185. + +{{{4.}, {-0.00289, 0.129913, -0.060416, 0.002372, -0.113134, 0.01764, + -0.002372, -0.198777, 0.045166, 0.002372, -0.306092, 0.021777, -0.002372, + -0.259166}, {}, {}, {}, {}, {1.}, {0.003326, 2.463509, 2., 2., 2.52, 2., + 2.}, {0.00289, 2.463514, 2., 2.463508, 2., 2.000001, 2.000001}, + {0.003534, 2.463509, 2.000001, 2.463508, 2., 2., 2.000001}, + {0.00289, 2.52, 2., 2., 2.231754, 2., 2.}}, + {{4.}, {-0.002889, 0.129699, -0.060316, 0.002264, -0.112116, 0.019214, + -0.002264, -0.203309, 0.021887, 0.002264, -0.29619, 0.019214, -0.002264, + -0.203309}, {}, {}, {}, {1.}, {0.}, {0.003328, 2.463509, 2., 2., 2.52, 2., + 2.}, {0.00289, 2.463513, 2., 2.463508, 2., 2.000001, 2.}, + {0.002889, 2.463509, 2., 2., 2.231754, 2., 2.}, + {0.002998, 2.519915, 2.000025, 2.000038, 2.000022, 2.463485, 2.000022}}, + {{4.}, {-0.00289, 0.129913, -0.060416, 0.002372, -0.113134, 0.021777, + -0.002372, -0.259166, 0.045166, 0.002372, -0.306092, 0.01764, -0.002372, + -0.198777}, {}, {}, {1.}, {0.}, {0.}, {0.003326, 2.463509, 2., 2., 2.52, + 2., 2.}, {0.00289, 2.52, 2., 2., 2.231754, 2., 2.}, + {0.003534, 2.463509, 2., 2., 2., 2.463508, 2.}, + {0.002915, 2.519935, 2.000027, 2.00004, 2.000024, 2.463484, 2.000025}}, + {{4.}, {-0.000426, -0.114872, 0.133539, -0.080919, 0.532524, 0.148605, + 0.080919, -0.855148, 0.08743, -0.080919, 0.593722, 0.148605, 0.080919, + -0.855148}, {}, {}, {0.}, {0.}, {0.}, {0.000426, 2.463509, 2., 2., 2.6508, + 2., 2.}, {0.000435, 2.463511, 2.000001, 2.000001, 2.000002, 2.000002, + 2.000002}, {0.004824, 2.46351, 2., 2., 2., 2.463509, 2.}, + {0.000435, 2.463511, 2.000001, 2.000001, 2.000002, 2.000002, 2.000002}}, + {{3.}, {-0.00272, 0.065103, -0.008732, -0.024884, 0.097156, 0.072591, + 0.024884, -0.464803, 0.042651, -0.024884, 0.008797, 0.055356, 0.024884, + -0.458108}, {}, {}, {}, {}, {1.}, {0.002594, 2.52, 2., 2., 2.491729, 2., + 2.}, {0.00272, 2.463509, 2., 2., 2., 2., 2.}, + {0.00272, 2.463509, 2., 2.463509, 2., 2., 2.}, + {0.00272, 2.52, 2., 2., 2.231754, 2., 2.}}, + {{3.}, {-0.00272, 0.065103, -0.029778, -0.027449, 0.170713, 0.072591, + 0.027449, -0.485323, 0.055356, -0.027449, -0.039438, 0.072591, 0.027449, + -0.485323}, {}, {}, {}, {1.}, {0.}, {0.002594, 2.52, 2., 2., 2.491998, 2., + 2.}, {0.00272, 2.463509, 2., 2., 2., 2., 2.}, + {0.00272, 2.463509, 2., 2., 2.231754, 2., 2.}, + {0.00272, 2.463509, 2., 2., 2., 2., 2.}}, + {{3.}, {-0.00272, 0.065103, -0.008732, 0.025458, -0.30558, 0.055356, + -0.025458, -0.055371, 0.072591, 0.025458, -0.469389, 0.037947, -0.025458, + 0.025236}, {}, {}, {1.}, {0.}, {0.}, {0.002612, 2.463509, 2., 2., + 2.489061, 2., 2.}, {0.00272, 2.52, 2., 2., 2.231754, 2., 2.}, + {0.00272, 2.52, 2., 2., 2., 2., 2.}, {0.00272, 2.463509, 2., 2., 2., + 2.463509, 2.}}, {{3.}, {-0.00225, -0.114872, 0.116669, 0.080919, + -0.7251449999999999, 0.08743, -0.080919, 0.595546, 0.148605, 0.080919, + -0.853324, 0.08743, -0.080919, 0.595546}, {}, {}, {0.}, {0.}, {0.}, + {0.00225, 2.519989, 2., 2., 2.52, 2., 2.}, {0.006648, 2.46351, 2., 2., 2., + 2.463509, 2.}, {0.002259, 2.463511, 2.000001, 2.000001, 2.000002, + 2.000002, 2.000002}, {0.006648, 2.46351, 2., 2., 2., 2.463509, 2.}}, + {{2.}, {-0.00289, 0.129913, -0.09152, 0.002372, -0.034749, 0.347659, + -0.002372, -1.030425, -0.105208, 0.002372, 0.072849, -0.150931, -0.002372, + 0.176057}, {}, {}, {}, {}, {1.}, {0.00289, 2.52, 2., 2., 2.52, 2., 2.}, + {0.00289, 2.52, 2., 2.463509, 2., 2., 2.}, {0.005089, 2.52, 2., 2.463509, + 2., 2., 2.}, {0.00289, 2.6508, 2., 2., 2.231754, 2., 2.}}, + {{2.}, {-0.00289, 0.129913, 0.340765, 0.002372, -1.124108, -0.094917, + -0.002372, 0.084866, -0.150931, 0.002372, 0.138108, -0.094917, -0.002372, + 0.084866}, {}, {}, {}, {1.}, {0.}, {0.00289, 2.52, 2., 2., 2.52, 2., 2.}, + {0.00289, 2.52, 2., 2.463509, 2., 2., 2.}, {0.00289, 2.6508, 2., 2., + 2.231754, 2., 2.}, {0.00289, 2.520001, 2., 2., 2., 2.463509, 2.}}, + {{2.}, {-0.00289, 0.129913, -0.09152, 0.002372, -0.034749, 0.291645, + -0.002372, -0.939234, -0.105208, 0.002372, 0.072849, -0.094917, -0.002372, + 0.084866}, {}, {}, {1.}, {0.}, {0.}, {0.00289, 2.52, 2., 2., 2.52, 2., + 2.}, {0.00289, 2.52, 2., 2., 2.231754, 2., 2.}, + {0.005089, 2.520002, 2.000001, 2.000001, 2.000001, 2.463507, 2.000001}, + {0.00289, 2.520001, 2., 2., 2., 2.463509, 2.}}, + {{2.}, {-0.005361, 0.128506, 0.290371, 0.003287, -1.026581, -0.070878, + -0.003287, 0.033394, -0.097658, 0.003287, 0.050047, -0.121835, -0.003287, + 0.13571}, {1.}, {}, {0.}, {0.}, {0., 1.}, {0.005361, 2.5854, 2., 2., 2.52, + 2., 2.}, {0.005361, 2.585401, 2., 2., 2., 2.463509, 2.}, + {0.008408, 2.5854, 2., 2., 2., 2.463509, 2.}, + {0.005361, 2.6508, 2., 2., 2.115877, 2., 2.}}, + {{2.}, {-0.005361, 0.128506, 0.263591, 0.003287, -0.957343, -0.070878, + -0.003287, 0.033394, -0.121835, 0.003287, 0.083125, -0.070878, -0.003287, + 0.033394}, {1.}, {}, {0.}, {0., 1.}, {0., 0.}, + {0.005361, 2.5854, 2., 2., 2.52, 2., 2.}, {0.005361, 2.585401, 2., 2., 2., + 2.463509, 2.}, {0.005361, 2.6508, 2., 2., 2.115877, 2., 2.}, + {0.005362, 2.585403, 2., 2.000001, 2., 2.463508, 2.}}, + {{2.}, {-0.005361, 0.128506, -0.066254, 0.003287, -0.104563, 0.234791, + -0.003287, -0.786309, -0.097658, 0.003287, 0.050047, -0.070878, -0.003287, + 0.033394}, {1.}, {}, {0., 1.}, {0., 0.}, {0., 0.}, + {0.005361, 2.5854, 2., 2., 2.52, 2., 2.}, {0.005361, 2.5854, 2., 2., + 2.115877, 2., 2.}, {0.008409, 2.585403, 2.000001, 2.000001, 2.000001, + 2.463508, 2.000001}, {0.005362, 2.585403, 2., 2.000001, 2., 2.463508, + 2.}}, {{2.}, {-0.001637, 0.127166, -0.07331, 0.003788, -0.105909, 0.23984, + -0.003788, -0.767737, -0.096981, 0.003788, 0.04248, -0.069548, -0.003788, + 0.032155}, {1.}, {1.}, {0., 0.}, {0., 0.}, {0., 0.}, + {0.001637, 2.5854, 2., 2., 2.5854, 2., 2.}, {0.001637, 2.5854, 2., 2., 2., + 2., 2.}, {0.005148, 2.5854, 2., 2., 2., 2.463509, 2.}, + {0.001637, 2.585403, 2., 2.000001, 2., 2.463508, 2.}}, + {{2.}, {-0.00125, 0.126777, -0.053069, 0.003525, -0.142652, 0.196466, + -0.003525, -0.667227, -0.093532, 0.003525, 0.035622, -0.049865, -0.003525, + -0.022307}, {1., 1.}, {0.}, {0., 0.}, {0., 0.}, {0., 0.}, + {0.00125, 2.6181, 2., 2., 2.52, 2.463509, 2.}, + {0.001388, 2.6181, 2.000001, 2.000001, 2., 2.463508, 2.}, + {0.004482, 2.6508, 2., 2., 2., 2.463509, 2.}, + {0.001388, 2.618101, 2.000001, 2.000002, 2., 2.463508, 2.000001}}, + {{2.}, {-0.001974, -0.0469, 0.051237, 0.060747, -0.530637, -0.014413, + -0.060747, 0.594377, -0.014413, 0.060747, -0.377571, -0.02241, -0.060747, + 0.608509}, {1., 0.}, {0.}, {0., 0.}, {0., 0.}, {0., 0., 1.}, + {0.001974, 2.5854, 2., 2., 2.520037, 2., 2.}, + {0.005733, 2.5854, 2., 2., 2., 2.463509, 2.}, + {0.001976, 2.618027, 2.000001, 2.000001, 2.000002, 2.000001, 2.000001}, + {0.001974, 2.6181, 2., 2., 2.057939, 2., 2.}}, + {{2.}, {-0.001974, -0.0469, 0.051237, 0.060747, -0.530636, -0.014413, + -0.060747, 0.594377, -0.02241, 0.060747, -0.36344, -0.014413, -0.060747, + 0.594377}, {1., 0.}, {0.}, {0., 0.}, {0., 0., 1.}, {0., 0., 0.}, + {0.001974, 2.5854, 2., 2., 2.520037, 2., 2.}, + {0.005733, 2.5854, 2., 2., 2., 2.463509, 2.}, + {0.001975, 2.585404, 2.000001, 2.000001, 2.05794, 2.000001, 2.000001}, + {0.001974, 2.6181, 2., 2., 2., 2., 2.}}, + {{2.}, {-0.001974, -0.0469, 0.051237, 0.060747, -0.530637, -0.02241, + -0.060747, 0.608509, -0.014413, 0.060747, -0.377571, -0.014413, -0.060747, + 0.594377}, {1., 0.}, {0.}, {0., 0., 1.}, {0., 0., 0.}, {0., 0., 0.}, + {0.001974, 2.5854, 2., 2., 2.520037, 2., 2.}, + {0.001974, 2.6181, 2., 2., 2.057939, 2., 2.}, + {0.001975, 2.585402, 2., 2., 2., 2., 2.}, {0.001974, 2.6181, 2., 2., 2., + 2., 2.}}, {{2.}, {-0.00033, -0.036939, 0.050064, -0.057593, 0.397884, + -0.016688, 0.057593, -0.362427, -0.016688, -0.057593, 0.559062, -0.016688, + -0.057593, 0.559062}, {1., 0., 1.}, {0.}, {0., 0., 0.}, {0., 0., 0.}, + {0., 0., 0.}, {0.00033, 2.618094, 2.000003, 2.000003, 2.520014, 2.000003, + 2.000003}, {0.00033, 2.601753, 2., 2., 2., 2., 2.}, + {0.00033, 2.6181, 2., 2., 2., 2., 2.}, {0.00033, 2.6181, 2., 2., 2., 2., + 2.}}, {{2.}, {-0.000417, -0.049823, 0.047052, -0.061687, 0.463622, + -0.015684, 0.061687, -0.379191, -0.015684, -0.061687, 0.607807, -0.015684, + 0.061687, -0.379191}, {1., 0., 0.}, {0., 1.}, {0., 0., 0.}, {0., 0., 0.}, + {0., 0., 0.}, {0.000417, 2.60175, 2., 2., 2.5527, 2., 2.}, + {0.000418, 2.601748, 2., 2., 2., 2., 2.}, {0.000417, 2.60175, 2., 2., 2., + 2., 2.}, {0.000418, 2.601748, 2., 2., 2., 2., 2.}}, + {{2.}, {-0.000396, -0.053582, 0.049452, -0.06302, 0.475514, -0.013853, + 0.06302, -0.389234, -0.020791, -0.06302, 0.637132, -0.013853, -0.062897, + 0.618101}, {1., 0., 0.}, {0., 0.}, {0., 0., 0.}, {0., 0., 0.}, + {0., 0., 0.}, {0.000359, 2.601749, 2., 2., 2.536279, 2., 2.}, + {0.000396, 2.601748, 2., 2., 2., 2., 2.}, {0.000396, 2.60175, 2., 2., 2., + 2., 2.}, {0.000396, 2.60175, 2., 2., 2., 2., 2.}}, + {{2.}, {-0.002012, -0.066935, 0.079693, 0.066241, -0.605497, -0.021495, + -0.066241, 0.685308, -0.021495, 0.066241, -0.374549, -0.036704, -0.066241, + 0.715304}, {0.}, {}, {0.}, {0.}, {0., 1.}, {0.00141, 2.52, 2., 2., + 2.584895, 2., 2.}, {0.004908, 2.52, 2., 2., 2., 2.463509, 2.}, + {0.002012, 2.585399, 2.000001, 2.000001, 2.000001, 2.000001, 2.}, + {0.002012, 2.5854, 2., 2., 2.115877, 2., 2.}}, + {{2.}, {-0.002012, -0.066935, 0.028887, 0.066241, -0.477466, -0.021495, + -0.066241, 0.685308, 0.014102, 0.066241, -0.472584, -0.021495, -0.066241, + 0.685308}, {0.}, {}, {0.}, {0., 1.}, {0., 0.}, + {0.001651, 2.5854, 2., 2., 2.596115, 2., 2.}, + {0.004908, 2.52, 2., 2., 2., 2.463509, 2.}, {0.002012, 2.52, 2., 2., + 2.115878, 2., 2.}, {0.004908, 2.52, 2., 2., 2., 2.463509, 2.}}, + {{2.}, {-0.002012, -0.066935, 0.028887, -0.066241, 0.582391, 0.014102, + 0.066241, -0.472584, -0.021495, -0.066241, 0.685308, -0.021495, 0.066241, + -0.374549}, {0.}, {}, {0., 1.}, {0., 0.}, {0., 0.}, + {0.00141, 2.520001, 2.000001, 2.000001, 2.58489, 2.000001, 2.000001}, + {0.002012, 2.52, 2., 2., 2.115878, 2., 2.}, {0.004908, 2.52, 2., 2., 2., + 2.463509, 2.}, {0.002012, 2.520001, 2., 2., 2., 2., 2.}}, + {{2.}, {-0.000405, -0.070081, 0.043025, 0.06775, -0.520998, -0.014342, + -0.06775, 0.681778, -0.014342, 0.06775, -0.402228, -0.014342, -0.06775, + 0.681778}, {0., 1.}, {1.}, {0., 0.}, {0., 0.}, {0., 0.}, + {0.000317, 2.585399, 2., 2., 2.612413, 2., 2.}, + {0.004048, 2.5527, 2., 2., 2., 2.463509, 2.}, + {0.000405, 2.585391, 2., 2., 2., 2., 2.}, {0.004048, 2.5527, 2., 2., 2., + 2.463509, 2.}}, {{2.}, {-0.001161, -0.074623, 0.079355, 0.068595, + -0.608613, -0.023711, -0.068595, 0.719631, -0.023711, 0.068595, -0.37789, + -0.031932, -0.068595, 0.735738}, {0., 0.}, {1.}, {0., 0.}, {0., 0.}, + {0., 0., 1.}, {0.001019, 2.52, 2., 2., 2.61793, 2., 2.}, + {0.004236, 2.52, 2., 2., 2., 2.463509, 2.}, {0.001162, 2.520001, 2., 2., + 2., 2., 2.}, {0.001161, 2.5527, 2., 2., 2.057939, 2., 2.}}, + {{2.}, {-0.001161, -0.074623, 0.019702, -0.081204, 0.740105, -0.023711, + 0.081204, -0.47876, -0.031932, -0.081204, 0.836608, 0.035942, 0.081204, + -0.629086}, {0., 0.}, {1.}, {0., 0.}, {0., 0., 1.}, {0., 0., 0.}, + {0.001084, 2.552699, 2.000001, 2.000001, 2.625659, 2.000001, 2.000001}, + {0.001161, 2.52, 2., 2., 2., 2., 2.}, {0.002657, 2.52, 2., 2.463509, + 2.057939, 2., 2.}, {0.001162, 2.52, 2.000001, 2., 2., 2., 2.}}, + {{2.}, {-0.001161, -0.074623, 0.019702, -0.068595, 0.639237, -0.031932, + 0.068595, -0.361784, -0.023711, -0.068595, 0.719631, 0.035942, 0.068595, + -0.528217}, {0., 0.}, {1.}, {0., 0., 1.}, {0., 0., 0.}, {0., 0., 0.}, + {0.001084, 2.5527, 2., 2., 2.625659, 2., 2.}, + {0.001161, 2.52, 2., 2., 2.057939, 2., 2.}, {0.004236, 2.52, 2., 2.463509, + 2., 2., 2.}, {0.001161, 2.52, 2., 2., 2., 2., 2.}}, + {{2.}, {-0.000308, -0.090009, 0.04151, 0.073665, -0.523458, -0.013837, + -0.073665, 0.755879, -0.013837, 0.073665, -0.422755, -0.013837, -0.073665, + 0.755879}, {0., 0., 1.}, {1., 1.}, {0., 0., 0.}, {0., 0., 0.}, + {0., 0., 0.}, {0.000308, 2.53635, 2., 2., 2.650799, 2., 2.}, + {0.000308, 2.5527, 2., 2., 2., 2., 2.}, {0.000308, 2.536357, 2., 2., 2., + 2., 2.}, {0.000308, 2.5527, 2., 2., 2., 2., 2.}}, + {{2.}, {-0.000418, -0.17025, 0.094709, 0.098535, -0.692034, -0.021455, + -0.098535, 1.087114, 0.009749, 0.098535, -0.568591, -0.021455, -0.098535, + 1.087114}, {0., 0., 0.}, {1., 1.}, {0., 0., 0.}, {0., 0., 0.}, + {0., 0., 0.}, {0.000418, 2.52, 2., 2., 2.6508, 2., 2.}, + {0.000418, 2.53635, 2., 2., 2., 2., 2.}, {0.000418, 2.536343, 2., 2., + 2.000004, 2., 2.}, {0.000418, 2.53635, 2., 2., 2., 2., 2.}}, + {{2.}, {-0.000644, -0.172166, 0.09973, -0.099785, 0.882284, 0.014169, + 0.099785, -0.586728, -0.017353, -0.099785, 1.0903, 0.014169, 0.099785, + -0.586728}, {0., 0.}, {1., 0.}, {0., 0., 0.}, {0., 0., 0.}, {0., 0., 0.}, + {0.000644, 2.5527, 2., 2., 2.6181, 2., 2.}, {0.000644, 2.5527, 2., 2., 2., + 2., 2.}, {0.000644, 2.5527, 2., 2., 2., 2., 2.}, + {0.000644, 2.5527, 2., 2., 2., 2., 2.}}, + {{2.}, {-0.000313, -0.084789, 0.039845, -0.071708, 0.632521, -0.013282, + -0.071708, 0.731624, -0.013282, -0.071708, 0.731624, -0.013282, 0.071708, + -0.415701}, {0.}, {0.}, {0., 0.}, {0., 0.}, {0., 0.}, + {0.000313, 2.52, 2., 2., 2.5854, 2., 2.}, {0.003624, 2.52, 2., 2., 2., + 2.463509, 2.}, {0.003624, 2.52, 2., 2., 2., 2.463509, 2.}, + {0.000314, 2.520002, 2.000002, 2.000001, 2.000001, 2.000001, 2.000001}}, + {{1.}, {-0.00272, 0.065103, -0.052337, -0.02292, 0.191326, 0.23854, 0.02292, + -0.867278, -0.073933, -0.02292, 0.286871, -0.11227, 0.02292, -0.019974}, + {}, {}, {}, {}, {1.}, {0.002703, 2.6508, 2., 2., 2.474335, 2., 2.}, + {0.00272, 2.52, 2., 2., 2., 2., 2.}, {0.004959, 2.6508, 2., 2.463509, 2., + 2., 2.}, {0.002721, 2.650799, 2., 2., 2.231755, 2., 2.}}, + {{1.}, {-0.00272, 0.065103, -0.052337, 0.02292, -0.17539, 0.23854, -0.02292, + -0.500562, -0.11227, 0.02292, -0.019974, -0.073933, -0.02292, 0.286871}, + {}, {}, {}, {1.}, {0.}, {0.002703, 2.650799, 2., 2.000001, 2.474442, + 2.000001, 2.}, {0.00272, 2.52, 2., 2., 2., 2., 2.}, + {0.002721, 2.650799, 2., 2., 2.231755, 2., 2.}, + {0.003897, 2.52, 2., 2., 2., 2.463509, 2.}}, + {{1.}, {-0.00272, 0.065103, -0.052337, 0.02292, -0.175391, -0.11227, + -0.02292, 0.346743, 0.23854, 0.02292, -0.867278, -0.073933, -0.02292, + 0.286871}, {}, {}, {1.}, {0.}, {0.}, {0.002703, 2.650799, 2., 2.000001, + 2.474442, 2.000001, 2.}, {0.00272, 2.6508, 2., 2., 2.231754, 2., 2.}, + {0.00272, 2.52, 2., 2., 2., 2., 2.}, {0.003897, 2.52, 2., 2., 2., 2.463509, + 2.}}, {{1.}, {-0.004545, 0.062681, -0.026929, 0.023742, -0.242815, + -0.06441, -0.023742, 0.273568, 0.176245, 0.023742, -0.72849, -0.084906, + -0.023742, 0.3039}, {1.}, {}, {0.}, {0.}, {0., 1.}, + {0.004424, 2.5854, 2., 2., 2.491903, 2., 2.}, + {0.006469, 2.5854, 2., 2., 2., 2.463509, 2.}, + {0.004545, 2.5854, 2., 2., 2., 2., 2.}, {0.004545, 2.6508, 2., 2., + 2.115877, 2., 2.}}, {{1.}, {-0.004545, 0.062681, -0.026929, 0.023742, + -0.242815, 0.176245, -0.023742, -0.348621, -0.084906, 0.023742, -0.075969, + -0.06441, -0.023742, 0.273568}, {1.}, {}, {0.}, {0., 1.}, {0., 0.}, + {0.004424, 2.5854, 2., 2., 2.491903, 2., 2.}, + {0.004545, 2.5854, 2., 2., 2., 2., 2.}, {0.004545, 2.6508, 2., 2., + 2.115877, 2., 2.}, {0.006469, 2.585401, 2., 2.000001, 2., 2.463508, 2.}}, + {{1.}, {-0.004545, 0.062681, -0.026929, 0.023742, -0.242815, -0.084906, + -0.023742, 0.3039, 0.176245, 0.023742, -0.72849, -0.06441, -0.023742, + 0.273568}, {1.}, {}, {0., 1.}, {0., 0.}, {0., 0.}, + {0.004424, 2.5854, 2., 2., 2.491903, 2., 2.}, + {0.004545, 2.6508, 2., 2., 2.115877, 2., 2.}, + {0.004545, 2.5854, 2., 2., 2., 2., 2.}, {0.006469, 2.585401, 2., 2.000001, + 2., 2.463508, 2.}}, {{1.}, {-0.000884, 0.061714, -0.014502, -0.02407, + 0.104941, 0.134266, 0.02407, -0.631477, -0.059882, -0.02407, 0.261947, + -0.059882, -0.02407, 0.261947}, {1., 1.}, {}, {0., 0.}, {0., 0.}, + {0., 0.}, {0.000796, 2.6508, 2., 2., 2.488246, 2., 2.}, + {0.000884, 2.6181, 2., 2., 2., 2., 2.}, {0.003066, 2.618101, 2., 2., 2., + 2.463509, 2.}, {0.003066, 2.618101, 2., 2., 2., 2.463509, 2.}}, + {{1.}, {-0.001974, -0.0469, 0.051237, 0.060747, -0.530637, -0.014413, + -0.060747, 0.594377, -0.014413, 0.060747, -0.377571, -0.02241, -0.060747, + 0.608509}, {1., 0.}, {}, {0., 0.}, {0., 0.}, {0., 0., 1.}, + {0.002084, 2.585663, 2.000116, 2.000116, 2.519822, 2.000113, 2.000116}, + {0.005733, 2.5854, 2., 2., 2., 2.463509, 2.}, + {0.001976, 2.618027, 2.000001, 2.000001, 2.000002, 2.000001, 2.000001}, + {0.001974, 2.6181, 2., 2., 2.057939, 2., 2.}}, + {{1.}, {-0.001974, -0.0469, 0.051237, -0.073427, 0.542756, -0.014413, + 0.073427, -0.479016, -0.02241, -0.073427, 0.709954, -0.014413, 0.073427, + -0.479016}, {1., 0.}, {}, {0., 0.}, {0., 0., 1.}, {0., 0., 0.}, + {0.001974, 2.6181, 2., 2., 2.52, 2., 2.}, {0.001974, 2.5854, 2., 2., 2., + 2., 2.}, {0.004138, 2.5854, 2., 2., 2.057939, 2.463509, 2.}, + {0.001974, 2.585401, 2., 2., 2., 2., 2.}}, + {{1.}, {-0.001974, -0.0469, 0.051237, -0.060747, 0.44131200000000004, + -0.02241, 0.060747, -0.36344, -0.014413, -0.060747, 0.594377, -0.014413, + 0.060747, -0.377571}, {1., 0.}, {}, {0., 0., 1.}, {0., 0., 0.}, + {0., 0., 0.}, {0.002165, 2.585453, 2.000636, 2.000639, 2.51972, 2.000635, + 2.000606}, {0.001975, 2.585404, 2.000001, 2.000001, 2.05794, 2.000001, + 2.000001}, {0.001974, 2.6181, 2., 2., 2., 2., 2.}, + {0.001975, 2.585402, 2., 2., 2., 2., 2.}}, + {{1.}, {-0.00033, -0.036939, 0.050064, 0.057593, -0.523604, -0.016688, + -0.057593, 0.559062, -0.016688, 0.057593, -0.362427, -0.016688, -0.057593, + 0.559062}, {1., 0., 1.}, {}, {0., 0., 0.}, {0., 0., 0.}, {0., 0., 0.}, + {0.000403, 2.609586, 2.000023, 2.00002, 2.519733, 2.000019, 2.000024}, + {0.00033, 2.6181, 2., 2., 2., 2., 2.}, {0.00033, 2.601753, 2., 2., 2., 2., + 2.}, {0.00033, 2.6181, 2., 2., 2., 2., 2.}}, + {{1.}, {-0.000886, -0.177145, 0.151334, -0.103308, 0.774954, 0.041584, + 0.103308, -0.677721, 0.00995, -0.103308, 1.057518, 0.041584, 0.103308, + -0.677721}, {1., 0., 0.}, {}, {0., 0., 0.}, {0., 0., 0.}, {0., 0., 0.}, + {0.000886, 2.5854, 2., 2., 2.52, 2., 2.}, {0.000887, 2.601712, 2.000001, + 2.000001, 2.000015, 2.000001, 2.000001}, {0.000886, 2.601749, 2., 2., 2., + 2.000001, 2.}, {0.000887, 2.601712, 2.000001, 2.000001, 2.000015, + 2.000001, 2.000001}}, {{1.}, {-0.001328, -0.121189, 0.06473, -0.084657, + 0.741383, -0.016252, 0.084657, -0.45858, -0.022099, -0.084657, 0.911046, + -0.016252, 0.084657, -0.45858}, {0.}, {}, {0.}, {0.}, {0.}, + {0.001328, 2.52, 2., 2., 2.52, 2., 2.}, {0.001328, 2.5854, 2., 2., 2., 2., + 2.}, {0.006318, 2.52, 2., 2., 2., 2.463509, 2.}, + {0.001328, 2.5854, 2., 2., 2., 2., 2.}}} + +*) + + + +(* test that the data covers the entire 13-dimensional domain of octahedra *) + +let get_cover i = + let v = List.rev in + let r = map (fun t -> (v t.branch1,v t.branch2,v t.branch3,v t.branch4,v t.branch5)) (filter (fun t -> t.caseno =i ) records) in r;; + +let check ((r1,r2,r3,r4,r5),(s1,s2,s3,s4,s5)) = + not(r1=[]) && not(s1=[]) && + not(hd r1 = hd s1) && (tl r1 = tl s1) && + (r2 = s2) && (r3 = s3) && (r4=s4) &&(r5=s5);; + +let combine + ((r1,r2,r3,r4,r5),(s1,s2,s3,s4,s5))= + if check((r1,r2,r3,r4,r5),(s1,s2,s3,s4,s5)) + then (hd r1 < hd s1,0),(tl r1,r2,r3,r4,r5) + else if check((r2,r1,r3,r4,r5),(s2,s1,s3,s4,s5)) + then (hd r2 < hd s2,1),(r1,tl r2,r3,r4,r5) + else if check((r3,r1,r2,r4,r5),(s3,s1,s2,s4,s5)) + then (hd r3 < hd s3,2),(r1,r2,tl r3,r4,r5) + else if check((r4,r1,r2,r3,r5),(s4,s1,s2,s3,s5)) + then (hd r4 < hd s4,3),(r1,r2,r3,tl r4,r5) + else if check((r5,r1,r2,r3,r4),(s5,s1,s2,s3,s4)) + then (hd r5 < hd s5,4),(r1,r2,r3,r4,tl r5) + else failwith "combine";; + +let rec combine_l = function + [] -> [] + | [a] -> [a] + | a::b::cs -> try (snd(combine (a,b))) :: cs with Failure _ -> a:: (combine_l (b::cs));; + +let rec combine_r x= + let y = combine_l x in + if (y = x) then x else combine_r y;; + +let rec nub = function (* from lpproc *) + | [] -> [] + | x::xs -> x::filter ((<>) x) (nub xs);; + +let domain_cover_calculation = ([[([],[],[],[],[])]] = + nub(map (fun t -> combine_r (get_cover t)) ( 1 -- 4) ));; + +(* for testing in cfsqp: + +let exec case r = + let d = List.nth records r in + let f = mk_ineq case d in + execute_cfsqp { ineq = f; id = "TEST"; tags = []; doc = ""; };; + +*) + + +end;; + diff --git a/text_formalization/nonlinear/lemma.hl b/text_formalization/nonlinear/lemma.hl new file mode 100644 index 0000000..59e8140 --- /dev/null +++ b/text_formalization/nonlinear/lemma.hl @@ -0,0 +1,1607 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: nonlinear inequalities *) +(* Author: Thomas Hales *) +(* Date: 2010-10-17 *) +(* ========================================================================== *) + +(* +Definitions and Lemmas used in the generation of interval arithmetic +code from the HOL Light specifications. + +*) + +(* ========================================================================== *) +(* DEFINITIONS *) +(* ========================================================================== *) + +module Nonlinear_lemma = struct + +let ineq = Sphere.ineq;; + +let NONLIN = new_definition `NONLIN = T`;; + +let sqrt_x1 = define `sqrt_x1 x1 x2 x3 x4 x5 x6 = sqrt x1`;; + +let sqrt_x2 = define `sqrt_x2 x1 x2 x3 x4 x5 x6 = sqrt x2`;; + +let sqrt_x3 = define `sqrt_x3 x1 x2 x3 x4 x5 x6 = sqrt x3`;; + +let sqrt_x4 = define `sqrt_x4 x1 x2 x3 x4 x5 x6 = sqrt x4`;; + +let sqrt_x5 = define `sqrt_x5 x1 x2 x3 x4 x5 x6 = sqrt x5`;; + +let sqrt_x6 = define `sqrt_x6 x1 x2 x3 x4 x5 x6 = sqrt x6`;; + +let halfbump_x = new_definition `halfbump_x x = bump (sqrt x / &2)`;; + +let halfbump_x1 = new_definition `halfbump_x1 x1 x2 x3 x4 x5 x6 = halfbump_x x1`;; + +let halfbump_x4 = new_definition `halfbump_x4 x1 x2 x3 x4 x5 x6 = halfbump_x x4`;; + +let unit6 = define `unit6 x1 x2 x3 x4 x5 x6 = &1`;; + +let proj_x1 = define `proj_x1 (x1:A) (x2:B) (x3:C) (x4:D) (x5:E) (x6:F) = x1`;; + +let proj_x2 = define `proj_x2 (x1:A) (x2:B) (x3:C) (x4:D) (x5:E) (x6:F) = x2`;; + +let proj_x3 = define `proj_x3 (x1:A) (x2:B) (x3:C) (x4:D) (x5:E) (x6:F) = x3`;; + +let proj_x4 = define `proj_x4 (x1:A) (x2:B) (x3:C) (x4:D) (x5:E) (x6:F) = x4`;; + +let proj_x5 = define `proj_x5 (x1:A) (x2:B) (x3:C) (x4:D) (x5:E) (x6:F) = x5`;; + +let proj_x6 = define `proj_x6 (x1:A) (x2:B) (x3:C) (x4:D) (x5:E) (x6:F) = x6`;; + +let promote = define `promote f (x1:A) (x2:B) (x3:C) (x4:D) (x5:E) (x6:F) = f x1`;; + +let unit0 = define `unit0 = &1`;; + +let pow1 = new_definition `pow1 y = y pow 1`;; + +let pow2 = new_definition `pow2 y = y pow 2`;; + +let pow3 = new_definition `pow3 y = y pow 3`;; + +let pow4 = new_definition `pow4 y = y pow 4`;; + +let promote_pow2 = new_definition `promote_pow2 x1 (x2:A) (x3:B) (x4:C) (x5:D) (x6:E) = x1 pow 2`;; + +let promote_pow3 = new_definition `promote_pow3 x1 (x2:A) (x3:B) (x4:C) (x5:D) (x6:E) = x1 pow 3`;; + +let compose6 = new_definition `compose6 f p1 p2 p3 p4 p5 p6 + (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + (f:real->real->real->real->real->real->real) + (p1 x1 x2 x3 x4 x5 x6) + (p2 x1 x2 x3 x4 x5 x6) + (p3 x1 x2 x3 x4 x5 x6) + (p4 x1 x2 x3 x4 x5 x6) + (p5 x1 x2 x3 x4 x5 x6) + (p6 x1 x2 x3 x4 x5 x6)`;; + +let scale6 = new_definition `scale6 f + (r:real) (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + (f x1 x2 x3 x4 x5 x6) * r`;; + +let quadratic_root_plus_curry = + new_definition `quadratic_root_plus_curry a b c = quadratic_root_plus (a,b,c)`;; + +let sq_pow2 = prove_by_refinement( + `!a x. a pow 2 <= x ==> (sqrt x * sqrt x = x)`, + (* {{{ proof *) + [ + REWRITE_TAC[GSYM REAL_POW_2;SQRT_POW2]; + MESON_TAC[REAL_LE_TRANS;Collect_geom.REAL_LE_SQUARE_POW]; + ]);; + (* }}} *) + +let sqrt2_sqrt2 = prove_by_refinement( + `sqrt2 * sqrt2 = &2`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.sqrt2]; + MATCH_MP_TAC sq_pow2; + EXISTS_TAC`&0`; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +(* SOME DEFINITIONS *) + +let vol3f_sqrt2_lmplus = new_definition + `vol3f_sqrt2_lmplus y1 y2 (y3:real) (y4:real) (y5:real) y6 = + (&2 * mm1 / pi) * + (&2 * dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + + &2 * dih2_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + + &2 * dih6_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + + dih3_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + + dih4_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + + dih5_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - &3 * pi) - + (&8 * mm2 / pi) * + ( + lfun (y2 / &2) * dih2_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + + lfun (y6 / &2) * dih6_y y1 y2 sqrt2 sqrt2 sqrt2 y6)`;; + +let vol3f_x_sqrt2_lmplus = new_definition + `vol3f_x_sqrt2_lmplus x1 x2 x3 x4 x5 x6 = + vol3f_sqrt2_lmplus (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let vol3f_x_lfun = new_definition + `vol3f_x_lfun x1 x2 (x3:real) (x4:real) (x5:real) x6 = vol3f (sqrt x1) (sqrt x2) (sqrt x6) sqrt2 lfun `;; + +let vol3_x_sqrt = new_definition + `vol3_x_sqrt x1 x2 (x3:real) (x4:real) (x5:real) x6 = vol_y sqrt2 sqrt2 sqrt2 (sqrt x1) (sqrt x2) (sqrt x6) `;; + +let monomial = new_definition `monomial n1 n2 n3 n4 n5 n6 y1 y2 y3 y4 y5 y6 = + (y1 pow n1) * (y2 pow n2) * (y3 pow n3) * (y4 pow n4) * (y5 pow n5) * (y6 pow n6)`;; + +let arclength_x_234 = new_definition `arclength_x_234 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = arclength (sqrt x2) (sqrt x3) (sqrt x4)`;; + +let arclength_x_126 = new_definition `arclength_x_126 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = arclength (sqrt x1) (sqrt x2) (sqrt x6)`;; + + +(* ========================================================================== *) +(* BASIC LEMMAS *) +(* ========================================================================== *) + +let strip_let_tm t = snd(dest_eq(concl(REDEPTH_CONV let_CONV t)));; + +let strip_let t = REWRITE_RULE[REDEPTH_CONV let_CONV (concl t )] t;; + +let tame_table_d_values = prove_by_refinement( + `tame_table_d 2 1 = #0.103 /\ tame_table_d 1 2 = #0.2759 /\ tame_table_d 0 3 = #0.4488 /\ tame_table_d 4 1 = #0.6548 /\ + tame_table_d 6 0 = #0.7578 /\ + tame_table_d 3 1 = #0.3789 /\ + tame_table_d 2 2 = #0.5518 /\ + tame_table_d 1 3 = #0.7247 /\ + tame_table_d 0 4 = #0.8976 /\ + tame_table_d 5 0 = #0.4819 /\ + tame_table_d 4 1 = #0.6548 /\ + tame_table_d 3 2 = #0.8277 /\ + tame_table_d 2 3 = #1.0006 + `, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.tame_table_d;ARITH_RULE `2 + 2 * 1 > 3 /\ 1 + 2 * 2 > 3 /\ 0 + 2 * 3 > 3 /\ 4 + 2 *1 > 3 /\ 6 + 2 * 0 > 3 /\ (2 + 2 * 3 > 3) /\ (3 + 2 * 2 > 3) /\ (5 + 2 * 0 > 3) /\ (0 + 2 * 4 > 3) /\ (1 + 2 * 3 > 3) /\ (2 + 2 * 2 > 3) /\ (3 + 2 * 1 > 3)` ]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let unit0f = prove_by_refinement( + `f x1 x2 x3 x4 x5 x6 * unit0 = f x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + REWRITE_TAC[unit0] THEN REAL_ARITH_TAC + ]);; + (* }}} *) + +let sqrt8_sqrt2 = prove_by_refinement( + `sqrt8 = &2 * sqrt2`, + (* {{{ proof *) + [ + SIMP_TAC[Sphere.sqrt8;Sphere.sqrt2;SQRT_MUL; + REAL_ARITH `&8 = &2 pow 2 * &2 /\ &0 <= &2 /\ &0 <= &2 pow 2 /\ + abs(&2) = &2`;POW_2_SQRT_ABS]; + ]);; + (* }}} *) + +let sqrt2_sqrt8 = prove_by_refinement( + `sqrt2 = #0.5 * sqrt8`, + (* {{{ proof *) + [ + REWRITE_TAC[sqrt8_sqrt2]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let SQRT_MUL_POW_2= prove_by_refinement(`!(a:real) b. (a>= &0) /\ (b>= &0) ==> sqrt((a*a)*b)= a* sqrt(b)`, +[ +SIMP_TAC[SQRT_MUL;REAL_LE_SQUARE;real_ge]; +MESON_TAC[sq_pow2;REAL_ARITH `&0 pow 2 = &0`]; +]);; + +(* sol0 = const1 * pi, repeated from TameGeneral.hl *) +let sol0_EQ_sol_y = prove(`sol0 = sol_y (&2) (&2) (&2) (&2) (&2) (&2)`, + REWRITE_TAC[Sphere.sol0; Sphere.sol_y; Sphere.dih_y; Sphere.dih_x; Sphere.delta_x4; Sphere.delta_x] THEN + CONV_TAC (DEPTH_CONV let_CONV) THEN + CONV_TAC (REAL_RAT_REDUCE_CONV) THEN + MP_TAC (SPEC `&1 / &3` Trigonometry2.acs_atn2) THEN + CONV_TAC (REAL_RAT_REDUCE_CONV) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC [REAL_ARITH `&3 * (a - b) - c = (a + d) + (a + d) + (a + d) - c <=> --b = d`] THEN + MP_TAC (SPECL [`sqrt (&8 / &9)`; `&1 / &3`] Trigonometry1.ATN2_RNEG) THEN + CONV_TAC (REAL_RAT_REDUCE_CONV) THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + SUBGOAL_THEN `sqrt (&2048) = &48 * sqrt (&8 / &9) /\ -- &16 = &48 * (-- &1 / &3)` ASSUME_TAC THENL + [ + MP_TAC (SPECL [`&48`; `&8 / &9`] SQRT_MUL_POW_2) THEN + CONV_TAC (REAL_RAT_REDUCE_CONV); + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC (GSYM Trigonometry1.ATN2_LMUL_EQ) THEN + REAL_ARITH_TAC);; + +let sol0_over_pi_EQ_const1 = prove(`sol0 / pi = const1`, + REWRITE_TAC[sol0_EQ_sol_y; Sphere.const1]);; + +let sol0_const1 = prove_by_refinement( + `sol0 = pi * const1`, + (* {{{ proof *) + [ + REWRITE_TAC[GSYM sol0_over_pi_EQ_const1]; + MP_TAC PI_POS; + CONV_TAC REAL_FIELD; + ]);; + (* }}} *) + +let ineq_lemma_b = prove_by_refinement( + `!a y b. (&0 <= a /\ &0 <= b /\ a <= y /\ y <= b) ==> + a pow 2 <= y pow 2 /\ y pow 2 <= b pow 2 /\ (sqrt (y pow 2) = y)`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + STRIP_TAC; + SUBGOAL_THEN `&0 <= y` MP_TAC; + ASM_MESON_TAC [REAL_LE_TRANS]; + ASM_MESON_TAC[Collect_geom.POW2_COND;POW_2_SQRT_ABS; + REAL_ARITH `&0 <= x ==> (x = abs x)`]; + ]);; + (* }}} *) + +let ineq_square2 = prove_by_refinement( + `(&0 <= a1 /\ &0 <= a2 /\ &0 <= a3 /\ &0 <= a4 /\ &0 <= a5 /\ &0 <= a6 /\ + &0 <= b1 /\ &0 <= b2 /\ &0 <= b3 /\ &0 <= b4 /\ &0 <= b5 /\ &0 <= b6 ) + /\ + (!x1 x2 x3 x4 x5 x6. + ineq [(a1 pow 2,x1,b1 pow 2);(a2 pow 2,x2,b2 pow 2);(a3 pow 2,x3,b3 pow 2); + (a4 pow 2,x4,b4 pow 2);(a5 pow 2,x5,b5 pow 2);(a6 pow 2,x6,b6 pow 2)] + (P (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6))) ==> + (!y1 y2 y3 y4 y5 y6. + ineq + [(a1,y1,b1);(a2,y2,b2);(a3,y3,b3);(a4,y4,b4);(a5,y5,b5);(a6,y6,b6)] + (P y1 y2 y3 y4 y5 y6))`, + (* {{{ proof *) + [ + REWRITE_TAC[ineq]; + REPEAT STRIP_TAC; + FIRST_X_ASSUM (fun t-> MP_TAC (SPECL [`y1 pow 2`;`y2 pow 2`;`y3 pow 2`;`y4 pow 2`;`y5 pow 2`;`y6 pow 2`] t)); + SUBGOAL_THEN `(sqrt (y1 pow 2) = y1) /\ (sqrt (y2 pow 2) = y2) /\ (sqrt (y3 pow 2) = y3) /\ (sqrt (y4 pow 2) = y4) /\ (sqrt (y5 pow 2) = y5) /\ (sqrt (y6 pow 2) = y6)` (fun t -> REWRITE_TAC[t]); + ASM_MESON_TAC[ineq_lemma_b]; + REWRITE_TAC[TAUT `(a ==> b ==> c) <=> (a /\ b ==> c)`]; + DISCH_THEN MATCH_MP_TAC; + ASM_MESON_TAC[ineq_lemma_b]; + ]);; + (* }}} *) + +let ineq_square2_9 = prove_by_refinement( + `(&0 <= a1 /\ &0 <= a2 /\ &0 <= a3 /\ &0 <= a4 /\ &0 <= a5 /\ &0 <= a6 /\ + &0 <= a7 /\ &0 <= a8 /\ &0 <= a9 /\ + &0 <= b1 /\ &0 <= b2 /\ &0 <= b3 /\ &0 <= b4 /\ &0 <= b5 /\ &0 <= b6 /\ + &0 <= b7 /\ &0 <= b8 /\ &0 <= b9 +) + /\ + (!x1 x2 x3 x4 x5 x6 x7 x8 x9. + ineq [(a1 pow 2,x1,b1 pow 2);(a2 pow 2,x2,b2 pow 2);(a3 pow 2,x3,b3 pow 2); + (a4 pow 2,x4,b4 pow 2);(a5 pow 2,x5,b5 pow 2);(a6 pow 2,x6,b6 pow 2); + (a7 pow 2,x7,b7 pow 2);(a8 pow 2,x8,b8 pow 2);(a9 pow 2,x9,b9 pow 2)] + (P (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) (sqrt x7) (sqrt x8) (sqrt x9))) ==> + (!y1 y2 y3 y4 y5 y6 y7 y8 y9. + ineq + [(a1,y1,b1);(a2,y2,b2);(a3,y3,b3);(a4,y4,b4);(a5,y5,b5);(a6,y6,b6);(a7,y7,b7);(a8,y8,b8);(a9,y9,b9)] + (P y1 y2 y3 y4 y5 y6 y7 y8 y9))`, + (* {{{ proof *) + [ + REWRITE_TAC[ineq]; + REPEAT STRIP_TAC; + FIRST_X_ASSUM (fun t-> MP_TAC (SPECL [`y1 pow 2`;`y2 pow 2`;`y3 pow 2`;`y4 pow 2`;`y5 pow 2`;`y6 pow 2`;`y7 pow 2`;`y8 pow 2`;`y9 pow 2`] t)); + SUBGOAL_THEN `(sqrt (y1 pow 2) = y1) /\ (sqrt (y2 pow 2) = y2) /\ (sqrt (y3 pow 2) = y3) /\ (sqrt (y4 pow 2) = y4) /\ (sqrt (y5 pow 2) = y5) /\ (sqrt (y6 pow 2) = y6) /\ (sqrt (y7 pow 2) = y7) /\ (sqrt (y8 pow 2) = y8) /\ (sqrt (y9 pow 2) = y9)` (fun t -> REWRITE_TAC[t]); + ASM_MESON_TAC[ineq_lemma_b]; + REWRITE_TAC[TAUT `(a ==> b ==> c) <=> (a /\ b ==> c)`]; + DISCH_THEN MATCH_MP_TAC; + ASM_MESON_TAC[ineq_lemma_b]; + ]);; + (* }}} *) + +let sqrt8_nn = prove_by_refinement( + `&0 <= sqrt8`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.sqrt8]; + MATCH_MP_TAC SQRT_POS_LE; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let sqrt2_nn = prove_by_refinement( + `&0 <= sqrt2`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.sqrt2]; + MATCH_MP_TAC SQRT_POS_LE; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let sqrt3_nn = prove_by_refinement( + `&0 <= sqrt(&3)`, + (* {{{ proof *) + [ + MATCH_MP_TAC SQRT_POS_LE; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let basic_constants_nn = [ + REAL_ARITH `&0 <= #2.18 /\ &0 <= &2 /\ &0 <= #2.52 /\ #2.0 = &2 /\ #2 = &2 /\ &0 <= #2.25 `; + sqrt8_nn;sqrt2_nn; + ];; + +let abc_quadratic = prove (`abc_of_quadratic (\x. a * (x pow 2) + b * x + c) = (a,b,c)`, + REWRITE_TAC[Sphere.abc_of_quadratic] THEN + (REPEAT LET_TAC) THEN + REWRITE_TAC[PAIR_EQ] THEN + REPEAT(FIRST_X_ASSUM MP_TAC)THEN + ARITH_TAC);; + +let delta_quadratic = prove( `-- delta_x x1 x2 x3 x4 x5 x6 = + (x1) * (x4 pow 2) + (x1*x1 + (x3 - x5)*(x2 - x6) + - x1*(x2 + x3 + x5 + x6)) * x4 + + ( x1*x3*x5 + x1*x2*x6 - x3*(x1 + x2 - x3 + x5 - x6)*x6 + - x2*x5*(x1 - x2 + x3 - x5 + x6) ) `, +REWRITE_TAC[Sphere.delta_x] THEN +ARITH_TAC);; + +let edge_flat_rewrite = + REWRITE_RULE[abc_quadratic;delta_quadratic] Sphere.edge_flat;; + +let enclosed_rewrite = + REWRITE_RULE[abc_quadratic] + (strip_let(REWRITE_RULE[Mur.muRa;Cayleyr.cayleyR_quadratic] Enclosed.enclosed));; + +let quad_root_plus_curry = + REWRITE_RULE[Sphere.quadratic_root_plus] quadratic_root_plus_curry;; + +let y_of_x_e = prove(`!y1 y2 y3 y4 y5 y6. y_of_x f y1 y2 y3 y4 y5 y6 = + f (y1*y1) (y2*y2) (y3*y3) (y4*y4) (y5*y5) (y6*y6)`, + REWRITE_TAC[Sphere.y_of_x]);; + +let vol_y_e = prove(`!y1 y2 y3 y4 y5 y6. vol_y y1 y2 y3 y4 y5 y6 = + y_of_x vol_x y1 y2 y3 y4 y5 y6`, + REWRITE_TAC[Sphere.vol_y]);; + +let rad2_y_e = prove(`!y1 y2 y3 y4 y5 y6. rad2_y y1 y2 y3 y4 y5 y6 = + y_of_x rad2_x y1 y2 y3 y4 y5 y6`, + REWRITE_TAC[Sphere.rad2_y]);; + +let rad2_x_y = prove_by_refinement( + `!a1 a2 a3 a4 a5 a6 x1 x2 x3 x4 x5 x6. + (a1 pow 2 <= x1) /\ (a2 pow 2 <= x2) /\ (a3 pow 2 <= x3) /\ (a4 pow 2 <= x4) /\ + (a5 pow 2 <= x5) /\ (a6 pow 2 <= x6) ==> + (rad2_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + rad2_x x1 x2 x3 x4 x5 x6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.rad2_y;y_of_x_e;LET_DEF;LET_END_DEF]; + ASM_MESON_TAC[sq_pow2]; + ]);; + (* }}} *) + +let delta_x4_delta4_y = prove_by_refinement( + `!a1 a2 a3 a4 a5 a6 x1 x2 x3 x4 x5 x6. + (a1 pow 2 <= x1) /\ (a2 pow 2 <= x2) /\ (a3 pow 2 <= x3) /\ (a4 pow 2 <= x4) /\ + (a5 pow 2 <= x5) /\ (a6 pow 2 <= x6) ==> + (delta4_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = delta_x4 x1 x2 x3 x4 x5 x6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta4_y;y_of_x_e;LET_DEF;LET_END_DEF]; + ASM_MESON_TAC[sq_pow2]; + ]);; + (* }}} *) + +let dih_x_y = prove_by_refinement( + `!a1 a2 a3 a4 a5 a6 x1 x2 x3 x4 x5 x6. + (a1 pow 2 <= x1) /\ (a2 pow 2 <= x2) /\ (a3 pow 2 <= x3) /\ (a4 pow 2 <= x4) /\ + (a5 pow 2 <= x5) /\ (a6 pow 2 <= x6) ==> + (dih_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + dih_x x1 x2 x3 x4 x5 x6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF]; + ASM_MESON_TAC[sq_pow2]; + ]);; + (* }}} *) + +let dih2_x_y = prove_by_refinement( + `!a1 a2 a3 a4 a5 a6 x1 x2 x3 x4 x5 x6. + (a1 pow 2 <= x1) /\ (a2 pow 2 <= x2) /\ (a3 pow 2 <= x3) /\ (a4 pow 2 <= x4) /\ + (a5 pow 2 <= x5) /\ (a6 pow 2 <= x6) ==> + (dih2_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + dih2_x x1 x2 x3 x4 x5 x6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.dih2_y;Sphere.dih2_x;Sphere.dih_y;LET_DEF;LET_END_DEF]; + ASM_MESON_TAC[sq_pow2]; + ]);; + (* }}} *) + +let dih3_x_y = prove_by_refinement( + `!a1 a2 a3 a4 a5 a6 x1 x2 x3 x4 x5 x6. + (a1 pow 2 <= x1) /\ (a2 pow 2 <= x2) /\ (a3 pow 2 <= x3) /\ (a4 pow 2 <= x4) /\ + (a5 pow 2 <= x5) /\ (a6 pow 2 <= x6) ==> + (dih3_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + dih3_x x1 x2 x3 x4 x5 x6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.dih3_y;Sphere.dih3_x;Sphere.dih_y;LET_DEF;LET_END_DEF]; + ASM_MESON_TAC[sq_pow2]; + ]);; + (* }}} *) + +let delta_x_y = prove_by_refinement( + `!a1 a2 a3 a4 a5 a6 x1 x2 x3 x4 x5 x6. + (a1 pow 2 <= x1) /\ (a2 pow 2 <= x2) /\ (a3 pow 2 <= x3) /\ (a4 pow 2 <= x4) /\ + (a5 pow 2 <= x5) /\ (a6 pow 2 <= x6) ==> + (delta_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + delta_x x1 x2 x3 x4 x5 x6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_y;LET_DEF;LET_END_DEF]; + ASM_MESON_TAC[sq_pow2]; + ]);; + (* }}} *) + +let vol_x_y = prove_by_refinement( + `!a1 a2 a3 a4 a5 a6 x1 x2 x3 x4 x5 x6. + (a1 pow 2 <= x1) /\ (a2 pow 2 <= x2) /\ (a3 pow 2 <= x3) /\ (a4 pow 2 <= x4) /\ + (a5 pow 2 <= x5) /\ (a6 pow 2 <= x6) ==> + (vol_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + vol_x x1 x2 x3 x4 x5 x6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.vol_y;Sphere.y_of_x;LET_DEF;LET_END_DEF]; + ASM_MESON_TAC[sq_pow2]; + ]);; + (* }}} *) + + +let sqrt8_2 = prove_by_refinement( + `sqrt8 * sqrt8 = #8.0`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.sqrt8]; + MESON_TAC[REAL_POW_2;SQRT_WORKS;REAL_ARITH `&8 = #8.0 /\ &0 <= &8`]; + ]);; + (* }}} *) + +let dih_x_sym = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. dih_x x1 x2 x3 x4 x5 x6 = dih_x x1 x3 x2 x4 x6 x5`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.dih_x;LET_DEF;LET_END_DEF]; + REPEAT GEN_TAC; + REPEAT AP_TERM_TAC; + REWRITE_TAC[Sphere.delta_x;Sphere.delta_x4;PAIR_EQ]; + CONJ_TAC THEN AP_TERM_TAC THEN REAL_ARITH_TAC; + ]);; + (* }}} *) + +let dih_x_sym2 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. dih_x x1 x2 x3 x4 x5 x6 = dih_x x1 x5 x6 x4 x2 x3`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.dih_x;LET_DEF;LET_END_DEF]; + REPEAT GEN_TAC; + REPEAT AP_TERM_TAC; + REWRITE_TAC[Sphere.delta_x;Sphere.delta_x4;PAIR_EQ]; + CONJ_TAC THEN AP_TERM_TAC THEN REAL_ARITH_TAC; + ]);; + (* }}} *) + + +let dih_y_sym = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. dih_y y1 y2 y3 y4 y5 y6 = dih_y y1 y3 y2 y4 y6 y5`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF]; + MESON_TAC[dih_x_sym]; + ]);; + (* }}} *) + +let dih_y_sym2 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. dih_y y1 y2 y3 y4 y5 y6 = dih_y y1 y5 y6 y4 y2 y3`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF]; + MESON_TAC[dih_x_sym2]; + ]);; + (* }}} *) + +let sol_y_123 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. sol_y y1 y2 y3 y4 y5 y6 = + dih_y y1 y2 y3 y4 y5 y6 + dih2_y y1 y2 y3 y4 y5 y6 + dih3_y y1 y2 y3 y4 y5 y6 - pi`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.sol_y;Sphere.dih2_y;Sphere.dih3_y]; + REPEAT GEN_TAC; + MATCH_MP_TAC (REAL_ARITH `(b = b') ==> (a + b + c -pi = a + b' + c - pi)`); + REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF]; + MESON_TAC[dih_x_sym]; + ]);; + (* }}} *) + +let rhazim2_alt = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. rhazim2 y1 y2 y3 y4 y5 y6 = rho y2 * dih2_y y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.rhazim2;Sphere.node2_y;Sphere.rhazim;Sphere.dih2_y;Sphere.dih_y;LET_DEF;LET_END_DEF]; + MESON_TAC[dih_x_sym]; + ]);; + (* }}} *) + +let rhazim3_alt = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. rhazim3 y1 y2 y3 y4 y5 y6 = rho y3 * dih3_y y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.rhazim3;Sphere.node3_y;Sphere.rhazim;Sphere.dih3_y;Sphere.dih_y;LET_DEF;LET_END_DEF]; + ]);; + (* }}} *) + +let taum_123 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. taum y1 y2 y3 y4 y5 y6 = rhazim y1 y2 y3 y4 y5 y6 + rhazim2 y1 y2 y3 y4 y5 y6 + rhazim3 y1 y2 y3 y4 y5 y6 - (&1 + const1)* pi`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REWRITE_TAC[Sphere.taum;sol_y_123;Sphere.lnazim]; + SUBGOAL_THEN `dih_y y2 y3 y1 y5 y6 y4 = dih2_y y1 y2 y3 y4 y5 y6 /\ dih_y y3 y1 y2 y6 y4 y5 = dih3_y y1 y2 y3 y4 y5 y6` (fun t-> REWRITE_TAC[t]); + REWRITE_TAC[Sphere.dih_y;Sphere.dih2_y;Sphere.dih3_y;LET_DEF;LET_END_DEF] THEN MESON_TAC[dih_x_sym]; + REWRITE_TAC[Sphere.rhazim;rhazim2_alt;rhazim3_alt;Sphere.rho]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let tauq_x_y = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6 x7 x8 x9. + (tauq (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) (sqrt x7) (sqrt x8) (sqrt x9) = + taum_x x1 x2 x3 x4 x5 x6 + taum_x x7 x2 x3 x4 x8 x9)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.tauq;Sphere.taum_x;taum_123;LET_DEF;LET_END_DEF;Sphere.rhazim_x;Sphere.rhazim2_x;Sphere.rhazim3_x]; + ]);; + (* }}} *) + + +let rho_alt = prove_by_refinement( + `!y. rho y = &1 + const1 *(y - &2) / (#0.52)`, + (* {{{ proof *) + [ + GEN_TAC; + REWRITE_TAC[Sphere.rho;Sphere.ly;Sphere.interp;REAL_ARITH `#2.52 - &2 = #0.52`]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +(* renamed from rho_x to avoid clash with rho_x in sphere.hl *) + +let rho_sqrtx = prove_by_refinement( + `!x. rho (sqrt x) = &1 + const1 * (sqrt x - &2) / (#0.52)`, + (* {{{ proof *) + [ + REWRITE_TAC[rho_alt]; + ]);; + (* }}} *) + +let lfun_ly = prove_by_refinement( + `!h. lfun h = ly (&2 * h)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.lfun;Sphere.ly;Sphere.interp;Sphere.h0]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let lfun1 = prove_by_refinement( + `lfun (&1) = (&1)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.lfun;Sphere.h0]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let rhazim2_alt = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. rhazim2 y1 y2 y3 y4 y5 y6 = rho y2 * dih2_y y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.rhazim2;Sphere.node2_y;Sphere.rhazim;Sphere.dih2_y;]; + MESON_TAC[dih_y_sym]; + ]);; + (* }}} *) + +let rhazim3_alt = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. rhazim3 y1 y2 y3 y4 y5 y6 = rho y3 * dih3_y y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.rhazim3;Sphere.node3_y;Sphere.rhazim;Sphere.dih3_y;]; + ]);; + (* }}} *) + +let beta_bump_force_x = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. beta_bump_force_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + halfbump_x1 x1 x2 x3 x4 x5 x6 - halfbump_x4 x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.beta_bump_force_y;halfbump_x1;halfbump_x4;halfbump_x]; + ]);; + (* }}} *) + +let halfbump_x_expand = prove_by_refinement( + `!x. &0 <= x ==> (halfbump_x x = + -- (&4398119 / &2376200) + (&17500 / &11881) * sqrt x - (&31250 / &106929) * x)`, + (* {{{ proof *) + [ + REWRITE_TAC[halfbump_x;Sphere.bump;Sphere.h0;Sphere.hplus]; + REPEAT STRIP_TAC; + REWRITE_TAC[REAL_ARITH`(a/ &2 - b) pow 2 = (a pow 2) / &4 - a * b + b pow 2`]; + ASM_SIMP_TAC[SQRT_POW_2]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let vol4f_palt = prove_by_refinement( + `!f y1 y2 y3 y4 y5 y6. vol4f y1 y2 y3 y4 y5 y6 f = + (-- &8 * mm1) + + + (&4 * mm1 / pi) * + (dih_y y1 y2 y3 y4 y5 y6 + dih2_y y1 y2 y3 y4 y5 y6 + + dih3_y y1 y2 y3 y4 y5 y6 + + dih4_y y1 y2 y3 y4 y5 y6 + dih5_y y1 y2 y3 y4 y5 y6 + + dih6_y y1 y2 y3 y4 y5 y6) + + + (-- &8 * mm2 / pi) * + (f (y1/ &2) * dih_y y1 y2 y3 y4 y5 y6 + + f(y2/ &2) * dih2_y y1 y2 y3 y4 y5 y6 + + f (y3/ &2) * dih3_y y1 y2 y3 y4 y5 y6 + + f (y4/ &2) * dih4_y y1 y2 y3 y4 y5 y6 + + f(y5/ &2) * dih5_y y1 y2 y3 y4 y5 y6 + + f(y6/ &2) * dih6_y y1 y2 y3 y4 y5 y6) + `, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REWRITE_TAC[Sphere.vol4f;Sphere.sol_y;lfun_ly;REAL_ARITH `&2 * y / &2 = y`;Sphere.rhazim;rhazim2_alt;rhazim3_alt;Sphere.rhazim4;Sphere.rhazim5;Sphere.rhazim6;]; + SUBGOAL_THEN `dih_y y2 y3 y1 y5 y6 y4 = dih2_y y1 y2 y3 y4 y5 y6 /\ + dih_y y3 y1 y2 y6 y4 y5 = dih3_y y1 y2 y3 y4 y5 y6 /\ + dih_y y3 y1 y2 y6 y4 y5 = dih3_y y1 y2 y3 y4 y5 y6 /\ + dih_y y4 y3 y5 y1 y6 y2 = dih4_y y1 y2 y3 y4 y5 y6 /\ + dih_y y5 y1 y6 y2 y4 y3 = dih5_y y1 y2 y3 y4 y5 y6 /\ + dih_y y6 y1 y5 y3 y4 y2 = dih6_y y1 y2 y3 y4 y5 y6 /\ + dih_y y6 y4 y2 y3 y1 y5 = dih6_y y1 y2 y3 y4 y5 y6 /\ + dih_y y2 y6 y4 y5 y3 y1 = dih2_y y1 y2 y3 y4 y5 y6 /\ + dih_y y1 y5 y6 y4 y2 y3 = dih_y y1 y2 y3 y4 y5 y6 /\ + dih_y y5 y6 y1 y2 y3 y4 = dih5_y y1 y2 y3 y4 y5 y6 /\ + dih_y y4 y5 y3 y1 y2 y6 = dih4_y y1 y2 y3 y4 y5 y6 /\ + dih_y y5 y3 y4 y2 y6 y1 = dih5_y y1 y2 y3 y4 y5 y6 /\ + dih_y y3 y4 y5 y6 y1 y2 = dih3_y y1 y2 y3 y4 y5 y6 /\ + dih_y y4 y2 y6 y1 y5 y3 = dih4_y y1 y2 y3 y4 y5 y6` (fun t-> REWRITE_TAC[t]); + REWRITE_TAC[Sphere.dih2_y;Sphere.dih3_y;Sphere.dih4_y;Sphere.dih5_y;Sphere.dih6_y]; + MESON_TAC[dih_y_sym;dih_y_sym2]; + ONCE_REWRITE_TAC[REAL_ARITH `x = y <=> x - y = &0`]; + ABBREV_TAC `a = mm1/pi `; + SUBGOAL_THEN `mm1 = a * pi ` (fun t->REWRITE_TAC[t]); + POP_ASSUM MP_TAC; + SUBGOAL_THEN `~(pi = &0)` MP_TAC; + SIMP_TAC[PI_POS;REAL_ARITH `&0 < x ==> ~(x= &0)`]; + CONV_TAC REAL_FIELD; + REAL_ARITH_TAC; + ]);; + (* }}} *) + + +let edge_flat2_x_rewrite = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. (&0 <= x1 /\ &0 <= x2 /\ &0 <= x3 /\ &0 <= x5 /\ + &0 <= x6) ==> (edge_flat2_x x1 x2 x3 x4 x5 x6 = + (sqrt (quadratic_root_plus + (x1, + (x1) * x1 + + (x3 - x5) * (x2 - x6) - + (x1) * (x2 + x3 + x5 + x6), + (x1) * (x3) * x5 + + (x1) * (x2) * x6 - + (x3) * + (x1 + x2 - x3 + x5 - x6) * x6 - + (x2) * + (x5) * + (x1 - x2 + x3 - x5 + x6)))) pow 2)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.edge_flat2_x]; + REPEAT STRIP_TAC; + AP_THM_TAC; + AP_TERM_TAC; + REWRITE_TAC[edge_flat_rewrite]; + ASM_SIMP_TAC[REAL_ARITH `sqrt x * sqrt x = (sqrt x) pow 2`;SQRT_POW2;SQRT_WORKS]; + ]);; + (* }}} *) + +let edge_quadratic = prove_by_refinement( + `!x1 x2 x3 x5 x6. quadratic_root_plus (x1, + x1 * x1 + + (x3 - x5) * (x2 - x6) - + x1 * (x2 + x3 + x5 + x6), + x1 * x3 * x5 + + (x1) * (x2) * x6 - (x3) * (x1 + x2 - x3 + x5 - x6) * x6 - + (x2) * (x5) * (x1 - x2 + x3 - x5 + x6)) = + (-- (x1 * x1) + x1*x2 + x1*x3 - x2*x3 + x1*x5 + x2*x5 + x1*x6 + x3*x6 - + x5*x6 + sqrt(ups_x x1 x3 x5 * ups_x x1 x2 x6))/(&2*x1)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.quadratic_root_plus;Sphere.ups_x]; + REPEAT STRIP_TAC; + AP_THM_TAC; + AP_TERM_TAC; + REWRITE_TAC[REAL_ARITH `--(x1 * x1 + (x3 - x5) * (x2 - x6) - x1 * (x2 + x3 + x5 + x6)) + a = -- (x1 * x1) + x1 * x2 + x1 * x3 - x2 * x3 + x1 * x5 + x2 * x5 + x1 * x6 + x3 * x6 - x5 * x6 + a`]; + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let lmfun0 = prove_by_refinement( + `!y. &2 * h0 <= y ==> (lmfun (y/ &2) = &0)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.lmfun;REAL_ARITH `&2 * h0 <= y <=> (~(y/ &2 <= h0) \/ (y/ &2 = h0))`]; + GEN_TAC; + DISCH_THEN DISJ_CASES_TAC THEN ASM_REWRITE_TAC[REAL_ARITH `h0 <= h0`;REAL_FIELD `(h0 - h0)/(h0 - &1) = &0`]; + ]);; + (* }}} *) + +let lmfun_lfun = prove_by_refinement( + `!y. y <= &2 * h0 ==> (lmfun (y/ &2) = lfun(y/ &2))`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.lmfun;Sphere.lfun;REAL_ARITH `y <= &2 * h0 <=> y/ &2 <= h0`]; + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]; + ]);; + (* }}} *) + +let lmfun_lfun2 = prove_by_refinement( + `!y. y <= h0 ==> (lmfun (y) = lfun(y))`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.lmfun;Sphere.lfun]; + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]; + ]);; + (* }}} *) + +(* compute hminus *) + +let quartic_has_real_derivative = prove_by_refinement( + `!x c0 c1 c2 c3 c4 . ((\x. c0 * &1 + c1 * x pow 1 + c2 * x pow 2 + c3 * x pow 3 + c4 * x pow 4) has_real_derivative (c0 * &0 + c1 * (&1 * x pow (1-1) * &1) + c2 * (&2 * x pow (2-1)) * &1 + c3 * (&3 * x pow (3-1)) * &1 + c4 * (&4 * x pow (4-1)) * &1)) (atreal x)`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC THEN +REPEAT (MATCH_MP_TAC HAS_REAL_DERIVATIVE_ADD THEN CONJ_TAC) THEN MATCH_MP_TAC (HAS_REAL_DERIVATIVE_LMUL_ATREAL) THEN REWRITE_TAC[HAS_REAL_DERIVATIVE_CONST] THEN REWRITE_TAC[REAL_ARITH `(a * b) * c = a * b * (c:real)`] THEN MATCH_MP_TAC (HAS_REAL_DERIVATIVE_POW_ATREAL) THEN REWRITE_TAC[HAS_REAL_DERIVATIVE_ID]; + ]);; + (* }}} *) + +let POLY_CONTINUITY_TAC = + REPEAT (MATCH_MP_TAC REAL_CONTINUOUS_ON_ADD THEN + CONJ_TAC) THEN + REPEAT (MATCH_MP_TAC REAL_CONTINUOUS_ON_LMUL) THEN + (MATCH_MP_TAC REAL_CONTINUOUS_ON_POW) THEN + REWRITE_TAC[REAL_CONTINUOUS_ON_ID];; + +let quartic_continuous_on = prove_by_refinement( + `!s c0 c1 c2 c3 c4 . (\x. c0 * x pow 0 + c1 * x pow 1 + c2 * x pow 2 + c3 * x pow 3 + c4 * x pow 4) real_continuous_on s`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + POLY_CONTINUITY_TAC; + ]);; + (* }}} *) + +let marchal_minus_lfun = prove_by_refinement( + `!h. marchal_quartic h - lfun h = + (inv(&65 * &1627 * (sqrt(&2) - &1))) * (h - &1)* + (( -- &512505 + &770958*sqrt(&2)) * h pow 0 + + ( -- &364208 - &1295359*sqrt(&2)) * h pow 1 + + ( &1295359 + &585000*sqrt(&2))* h pow 2 + + (-- &585000) * h pow 3)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.marchal_quartic;Sphere.lfun;REAL_ARITH `x/y = x * inv y /\ #1.26 - &1 = &13/ &50 /\ #1.3254 - &1 = &1627/ &5000 /\ &65 = &5 * &13`;REAL_INV_INV;REAL_INV_MUL;Sphere.hplus;Sphere.h0]; + GEN_TAC; + SUBGOAL_THEN `&0 < sqrt(&2) - &1 ` MP_TAC THENL [ALL_TAC;CONV_TAC REAL_FIELD]; + SUBGOAL_THEN `#1.414213 < sqrt(&2) ` MP_TAC THENL[ALL_TAC;REAL_ARITH_TAC]; + REWRITE_TAC[GSYM Sphere.sqrt2;Flyspeck_constants.bounds]; + ]);; + (* }}} *) + +let hminus_cont = prove_by_refinement( + `!s. (\h. marchal_quartic h - lfun h) real_continuous_on s`, + (* {{{ proof *) + [ + GEN_TAC; + REWRITE_TAC[marchal_minus_lfun]; + MATCH_MP_TAC REAL_CONTINUOUS_ON_LMUL; + MATCH_MP_TAC REAL_CONTINUOUS_ON_MUL THEN REWRITE_TAC[REAL_ARITH `h - &1 = (-- &1) * h pow 0 + &1 * h pow 1`] THEN CONJ_TAC THEN POLY_CONTINUITY_TAC; + ]);; + (* }}} *) + +let sqrt2_lb = prove_by_refinement( + `#1.414213 < sqrt2 `, + (* {{{ proof *) + [ + REWRITE_TAC[Flyspeck_constants.bounds]; + ]);; + (* }}} *) + +let STRIP_NN_TAC = REPEAT (CONJ_TAC ORELSE MATCH_MP_TAC REAL_LE_MUL ORELSE CHANGED_TAC (REWRITE_TAC[REAL_LE_INV_EQ;REAL_ARITH `a >= &0 <=> &0 <= a /\ ((a*b)*c = a*b*c)`;REAL_INV_MUL]));; + +let hminus_exists = prove_by_refinement( + `?x. (#1.2 <= x /\ x < #1.3 /\ marchal_quartic x = lmfun x)`, + (* {{{ proof *) + [ + SUBGOAL_THEN `(?x. x IN real_interval [#1.2,#1.26] /\ (\x. marchal_quartic x - lfun x) x = &0)` MP_TAC; + MATCH_MP_TAC REAL_IVT_INCREASING; + BETA_TAC; + REWRITE_TAC[hminus_cont]; + REWRITE_TAC[marchal_minus_lfun;GSYM Sphere.sqrt2]; + ASSUME_TAC sqrt2_lb; + SUBGOAL_THEN `&0 < sqrt2 - &1` ASSUME_TAC; + POP_ASSUM MP_TAC; + REAL_ARITH_TAC; + REWRITE_TAC[(* REAL_INV_MUL;REAL_INV_INV; *) REAL_ARITH `#1.2- &1 = &1 / &5 /\ #1.26 - &1 = &13 / &50`]; + CONJ_TAC THENL[REAL_ARITH_TAC;ALL_TAC]; + SUBGOAL_THEN `sqrt2 < #1.414214` ASSUME_TAC; + REWRITE_TAC[Flyspeck_constants.bounds]; + SUBGOAL_THEN ` ((-- &512505 + &770958 * sqrt2) * #1.26 pow 0 + (-- &364208 - &1295359 * sqrt2) * #1.26 pow 1 + (&1295359 + &585000 * sqrt2) * #1.26 pow 2 + -- &585000 * #1.26 pow 3) = -- &212787729/ &2500 + &3377583 *sqrt2 /(&50)` (fun t-> REWRITE_TAC[t]); + REAL_ARITH_TAC; + SUBGOAL_THEN `((-- &512505 + &770958 * sqrt2) * #1.2 pow 0 + (-- &364208 - &1295359 * sqrt2) * #1.2 pow 1 + (&1295359 + &585000 * sqrt2) * #1.2 pow 2 + -- &585000 * #1.2 pow 3) = -- &2377941/ &25 + (& 294636* sqrt2)/ &5` (fun t-> REWRITE_TAC[t]); + REAL_ARITH_TAC; + REWRITE_TAC[REAL_ARITH `a * b * c <= &0 <=> (&0 <= a * b * (-- c))`]; + STRIP_NN_TAC THEN (REPEAT (POP_ASSUM MP_TAC)) THEN TRY REAL_ARITH_TAC; + (* last subgoal *) + REWRITE_TAC[real_interval;IN_ELIM_THM]; + REPEAT STRIP_TAC; + EXISTS_TAC `x:real`; + SUBGOAL_THEN `x <= &2 * h0` ASSUME_TAC; + REWRITE_TAC[Sphere.h0]; + UNDISCH_TAC `x <= #1.26` THEN REAL_ARITH_TAC; + ASM_SIMP_TAC [Sphere.h0;lmfun_lfun2]; + REPEAT (POP_ASSUM MP_TAC); + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let hminus_prop = prove_by_refinement( + `#1.2 <= hminus /\ hminus < #1.3 /\ marchal_quartic hminus = lmfun hminus`, + (* {{{ proof *) + [ + MP_TAC hminus_exists; + MP_TAC Sphere.hminus; + MESON_TAC[]; + ]);; + (* }}} *) + +let hminus_high = prove_by_refinement( + `!h. (h0 <= h) ==> lmfun h = &0`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.lmfun;REAL_ARITH `h0 <= h <=> (~(h <= h0) \/ (h = h0))`]; + GEN_TAC; + DISCH_THEN DISJ_CASES_TAC THEN ASM_REWRITE_TAC[REAL_ARITH `h0 <= h0`;REAL_FIELD `(h0 - h0)/(h0 - &1) = &0`]; + ]);; + (* }}} *) + +let hminus_lt_h0 = prove_by_refinement( + `!h. (&1 <= h) /\ (h < hplus) ==> (marchal_quartic h > &0)`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[Sphere.marchal_quartic]; + REWRITE_TAC[REAL_ARITH `(h-hplus)*(&9 * h pow 2 - &17 * h + &3)/u = (hplus - h)*(&17 * h - &9 * h pow 2 - &3)/u /\ (u > &0 <=> &0 < u)`]; + MATCH_MP_TAC REAL_LT_MUL; + CONJ_TAC; + POP_ASSUM MP_TAC; + SUBGOAL_THEN `&0 < sqrt(&2) - hplus` MP_TAC; + REWRITE_TAC[Flyspeck_constants.bounds]; + REAL_ARITH_TAC; +MATCH_MP_TAC REAL_LT_MUL; + CONJ_TAC; + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + MATCH_MP_TAC REAL_LT_DIV; + REWRITE_TAC[Flyspeck_constants.bounds]; + REPEAT (POP_ASSUM MP_TAC); + REWRITE_TAC[Sphere.hplus]; + ABBREV_TAC `u = h - &1`; + SUBGOAL_THEN `h = u + &1` (fun t->REWRITE_TAC[t]); + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + REWRITE_TAC[REAL_FIELD `(&1 <= u + &1 <=> &0 <= u) /\ (u + &1 < #1.3254 <=> u < #0.3254) /\ (&17 * (u + &1) - &9 * (u+ &1) pow 2 - &3 = -- &9 * u pow 2 - u + &5)`]; + POP_ASSUM (fun t->ALL_TAC); + REPEAT STRIP_TAC; + SUBGOAL_THEN `u pow 2 < #0.3254 pow 2` MP_TAC; + REWRITE_TAC[ GSYM REAL_LT_SQUARE_ABS]; + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; + REPEAT (POP_ASSUM MP_TAC); + ABBREV_TAC `v = u pow 2`; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let hminus_lt_h0 = prove_by_refinement( + `hminus < h0`, + (* {{{ proof *) + [ + REWRITE_TAC [REAL_ARITH `x < y <=> ~(x >= y)`]; + STRIP_TAC; + MP_TAC hminus_prop; + REPEAT STRIP_TAC; + POP_ASSUM MP_TAC; + MATCH_MP_TAC (REAL_ARITH `a > b ==>((a:real) = b ==> F)`); + SUBGOAL_THEN `lmfun hminus = &0` (fun t -> REWRITE_TAC[t]); + MATCH_MP_TAC hminus_high; + UNDISCH_TAC `hminus >= h0` THEN REAL_ARITH_TAC; + MATCH_MP_TAC hminus_lt_h0; + REPEAT (POP_ASSUM MP_TAC); + REWRITE_TAC[Sphere.hplus;Sphere.h0]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let h0_lt_hplus = prove_by_refinement( + `h0 < hplus`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.h0;Sphere.hplus]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let hminus_gt = prove_by_refinement( + `#1.2 <= hminus`, + (* {{{ proof *) + [ + REWRITE_TAC[hminus_prop]; + ]);; + (* }}} *) + +let lminus_ge_h0 = prove_by_refinement( + `!h. (hplus <= h) /\ (h <= sqrt (&2)) ==> (marchal_quartic h <= &0)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.marchal_quartic]; + REWRITE_TAC[REAL_ARITH `a * b * c /d <= &0 <=> &0 <= a * b * (-- c)/d`]; + REPEAT STRIP_TAC; + MATCH_MP_TAC REAL_LE_MUL; + CONJ_TAC; + POP_ASSUM MP_TAC; + REAL_ARITH_TAC; + MATCH_MP_TAC REAL_LE_MUL; + CONJ_TAC; + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; + MATCH_MP_TAC REAL_LE_DIV; + CONJ_TAC; + (* *) + REPEAT (POP_ASSUM MP_TAC); + REWRITE_TAC[Sphere.hplus]; + ABBREV_TAC `u = h - &1`; + SUBGOAL_THEN `h = u + &1` (fun t->REWRITE_TAC[t]); + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + REWRITE_TAC[REAL_FIELD `(&1 <= u + &1 <=> &0 <= u) /\ (#1.3254 <= u + &1 <=> #0.3254 <= u) /\ (-- (&9* (u + &1) pow 2 - &17 * (u+ &1) + &3) = -- &9 * u pow 2 - u + &5)`]; + REPEAT STRIP_TAC; + SUBGOAL_THEN `u pow 2 < #0.42 pow 2` MP_TAC; + REWRITE_TAC[ GSYM REAL_LT_SQUARE_ABS]; + POP_ASSUM MP_TAC; + POP_ASSUM MP_TAC; + EXPAND_TAC "u"; + SUBGOAL_THEN `sqrt(&2) - &1 < #0.42` (fun t-> (MP_TAC t) THEN REAL_ARITH_TAC); + SUBGOAL_THEN `sqrt(&2) < #1.414214` MP_TAC; + REWRITE_TAC[GSYM Sphere.sqrt2;Flyspeck_constants.bounds]; + REAL_ARITH_TAC; + SUBGOAL_THEN `u < #0.414214` MP_TAC; + SUBGOAL_THEN `sqrt(&2) < #1.414214` MP_TAC; + REWRITE_TAC[GSYM Sphere.sqrt2;Flyspeck_constants.bounds]; + POP_ASSUM MP_TAC; + REAL_ARITH_TAC; + REAL_ARITH_TAC; + MATCH_MP_TAC (REAL_ARITH `&0 < x ==> &0 <= x`); + REWRITE_TAC[Flyspeck_constants.bounds]; + ]);; + (* }}} *) + +let gcy_high = prove_by_refinement( + `!y. (&2 * h0 <= y) ==> (gcy y = &4 * mm1/pi)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.gcy]; + SIMP_TAC[lmfun0]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let gcy_low = prove_by_refinement( + `!y. (y <= &2 * h0) ==> (gcy y = gchi y)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.gcy;Sphere.gchi]; + SIMP_TAC[lmfun_lfun]; + REWRITE_TAC[Sphere.lfun;Sphere.h0]; + REPEAT STRIP_TAC; + ABBREV_TAC `m = mm2/pi`; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let gcy_low_hminus = prove_by_refinement( + `!y. (y <= &2 * hminus) ==> (gcy y = gchi y)`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + MATCH_MP_TAC gcy_low; + POP_ASSUM MP_TAC; + MP_TAC hminus_lt_h0; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let c2001 = prove_by_refinement( + `!y. (y <= #2.001) ==> (y <= &2 * h0)`, + [ + REWRITE_TAC[Sphere.h0]; + REAL_ARITH_TAC; + ] +);; + +let gcy_low_const = prove_by_refinement( + `!y. (y <= #2.001) ==> (gcy y = gchi y)`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + MATCH_MP_TAC gcy_low; + POP_ASSUM MP_TAC; + REWRITE_TAC[Sphere.h0]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let gcy_high_hplus = prove_by_refinement( + `!y. (&2 * hplus <= y) ==> (gcy y = &4 * mm1/pi)`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + MATCH_MP_TAC gcy_high; + FIRST_X_ASSUM MP_TAC; + MP_TAC h0_lt_hplus; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let hm0 = prove_by_refinement( + `!y. ((y <= &2 * hminus) ==> (y <= &2 * h0))`, + (* {{{ proof *) + [ + MP_TAC hminus_lt_h0; + CONV_TAC REAL_FIELD; + ]);; + (* }}} *) + +let h0_lt_gt = prove_by_refinement( + `((y <= #2.01) ==> (y <= &2 * h0)) /\ + ((#2.8 <= y) ==> (&2 * h0 <= y)) /\ + (( y <= &2) ==> (y <= &2 * h0)) /\ + ((sqrt8 <= y) ==> (&2 * h0 <= y)) /\ ((&2 * h0 <= y) ==> (&0 <= y)) /\ + ((&2 <= y) ==> (&0 <= y)) /\ + ((y <= &2 * hminus) ==> (y <= &2 * h0)) /\ + ((&2 * hminus <= y) ==> (&0 <= y))`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.h0;sqrt8_sqrt2;hm0]; + MP_TAC sqrt2_lb; + MP_TAC hminus_gt; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let sqrtxx = prove_by_refinement( + `!x. &0 <= x ==> (sqrt(x * x) = x)`, + (* {{{ proof *) + [ + REWRITE_TAC[POW_2_SQRT_ABS;REAL_ARITH `x * x = x pow 2`]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let lmdih_ldih = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. (&0 <= y1 /\ y1 <= &2 * h0) ==>(y_of_x lmdih_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 = y_of_x ldih_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 )`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.y_of_x;Nonlin_def.lmdih_x_div_sqrtdelta_posbranch;Nonlin_def.ldih_x_div_sqrtdelta_posbranch]; + MESON_TAC[sqrtxx;lmfun_lfun]; + ]);; + (* }}} *) + +let lmdih3_ldih3 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. (&0 <= y3 /\ y3 <= &2 * h0) ==>(y_of_x lmdih3_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 = y_of_x ldih3_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 )`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.rotate3;Nonlin_def.lmdih_x_div_sqrtdelta_posbranch;Nonlin_def.ldih_x_div_sqrtdelta_posbranch;Sphere.y_of_x;Nonlin_def.lmdih3_x_div_sqrtdelta_posbranch;Nonlin_def.ldih3_x_div_sqrtdelta_posbranch]; + MESON_TAC[sqrtxx;lmfun_lfun]; + ]);; + (* }}} *) + +let lmdih5_ldih5 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. (&0 <= y5 /\ y5 <= &2 * h0) ==>(y_of_x lmdih5_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 = y_of_x ldih5_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 )`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.rotate5;Nonlin_def.lmdih_x_div_sqrtdelta_posbranch;Nonlin_def.ldih_x_div_sqrtdelta_posbranch;Sphere.y_of_x;Nonlin_def.lmdih5_x_div_sqrtdelta_posbranch;Nonlin_def.ldih5_x_div_sqrtdelta_posbranch]; + MESON_TAC[sqrtxx;lmfun_lfun]; + ]);; + (* }}} *) + +let lmdih_ldih' = REWRITE_RULE[Sphere.y_of_x] lmdih_ldih;; +let lmdih3_ldih3' = REWRITE_RULE[Sphere.y_of_x] lmdih3_ldih3;; +let lmdih5_ldih5' = REWRITE_RULE[Sphere.y_of_x] lmdih5_ldih5;; + +let lmdih0 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. (&2 * h0 <= y1 ) ==>(y_of_x lmdih_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 = &0 )`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.y_of_x;Nonlin_def.lmdih_x_div_sqrtdelta_posbranch;Nonlin_def.ldih_x_div_sqrtdelta_posbranch]; + MESON_TAC[sqrtxx;lmfun0;REAL_ARITH `&0 * x = &0 `;h0_lt_gt]; + ]);; + (* }}} *) + +let lmdih3_0 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. (&2 * h0 <= y3 ) ==>(y_of_x lmdih3_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 = &0 )`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.y_of_x;Nonlin_def.lmdih3_x_div_sqrtdelta_posbranch;Sphere.rotate3;Nonlin_def.lmdih_x_div_sqrtdelta_posbranch;Nonlin_def.ldih_x_div_sqrtdelta_posbranch]; + MESON_TAC[sqrtxx;lmfun0;REAL_ARITH `&0 * x = &0 `;h0_lt_gt]; + ]);; + (* }}} *) + +let lmdih5_0 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. (&2 * h0 <= y5 ) ==>(y_of_x lmdih5_x_div_sqrtdelta_posbranch y1 y2 y3 y4 y5 y6 = &0 )`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.y_of_x;Nonlin_def.lmdih5_x_div_sqrtdelta_posbranch;Sphere.rotate5;Nonlin_def.lmdih_x_div_sqrtdelta_posbranch;Nonlin_def.ldih_x_div_sqrtdelta_posbranch]; + MESON_TAC[sqrtxx;lmfun0;REAL_ARITH `&0 * x = &0 `;h0_lt_gt]; + ]);; + (* }}} *) + +let lmdih1_0' = REWRITE_RULE[Sphere.y_of_x] lmdih0;; +let lmdih3_0' = REWRITE_RULE[Sphere.y_of_x] lmdih3_0;; +let lmdih5_0' = REWRITE_RULE[Sphere.y_of_x] lmdih5_0;; + +let vol4f_lmfun = prove_by_refinement( + `! y1 y2 y3 y4 y5 y6. vol4f y1 y2 y3 y4 y5 y6 lmfun = + (-- &8 * mm1) + + + gcy y1 * dih_y y1 y2 y3 y4 y5 y6 + gcy y2 * dih2_y y1 y2 y3 y4 y5 y6 + + gcy y3 * dih3_y y1 y2 y3 y4 y5 y6 + + gcy y4 * dih4_y y1 y2 y3 y4 y5 y6 + + gcy y5 * dih5_y y1 y2 y3 y4 y5 y6 + + gcy y6 * dih6_y y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REWRITE_TAC[vol4f_palt;Sphere.gcy]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let gamma4fgcy_alt = prove_by_refinement(`gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun = + vol_y y1 y2 y3 y4 y5 y6 - + ((-- &8 * mm1) + + + gcy y1 * dih_y y1 y2 y3 y4 y5 y6 + gcy y2 * dih2_y y1 y2 y3 y4 y5 y6 + + gcy y3 * dih3_y y1 y2 y3 y4 y5 y6 + + gcy y4 * dih4_y y1 y2 y3 y4 y5 y6 + + gcy y5 * dih5_y y1 y2 y3 y4 y5 y6 + + gcy y6 * dih6_y y1 y2 y3 y4 y5 y6)`, +[ +REWRITE_TAC[Sphere.gamma4fgcy;Sphere.gamma4f;vol4f_lmfun]; +]);; + +let vol3f_palt = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6 r f. + (y3 = r) /\ (y4 = r) /\ (y5 = r) ==> + (vol3f y1 y2 y6 r f = (&2 * mm1 / pi) * + (&2 * dih_y y1 y2 y3 y4 y5 y6 + &2 * dih2_y y1 y2 y3 y4 y5 y6 + + &2 * dih6_y y1 y2 y3 y4 y5 y6 + dih3_y y1 y2 y3 y4 y5 y6 + + dih4_y y1 y2 y3 y4 y5 y6 + dih5_y y1 y2 y3 y4 y5 y6 - &3 * pi) - + (&8 * mm2 / pi) * + (f (y1 / &2) * dih_y y1 y2 y3 y4 y5 y6 + + f (y2 / &2) * dih2_y y1 y2 y3 y4 y5 y6 + + f (y6 / &2) * dih6_y y1 y2 y3 y4 y5 y6))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REWRITE_TAC[Sphere.vol3f;Sphere.sol_y]; + DISCH_THEN (fun t->REWRITE_TAC[t]); + REWRITE_TAC[Sphere.dih2_y;Sphere.dih3_y;Sphere.dih4_y;Sphere.dih5_y;Sphere.dih6_y]; + ABBREV_TAC `a = &8 * mm2/pi`; + ABBREV_TAC `b = &2 * mm1/pi`; + SUBGOAL_THEN `dih_y y2 r y1 r y6 r = dih_y y2 y1 r r r y6 /\ dih_y y2 y6 r r r y1 = dih_y y2 y1 r r r y6 /\ dih_y y6 r y2 r y1 r = dih_y y6 y1 r r r y2 /\ dih_y y1 r y6 r y2 r = dih_y y1 y2 r r r y6 /\ dih_y r y6 y1 y2 r r = dih_y r y1 y6 y2 r r` (fun t->REWRITE_TAC[t]); + MESON_TAC[dih_y_sym2;dih_y_sym]; + MATCH_MP_TAC (REAL_ARITH `(a = a') ==> (a - c = a' - c)`); + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let vol3f_135_palt = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6 r f. + (y2 = r) /\ (y4 = r) /\ (y6 = r) ==> + (vol3f y1 y3 y5 r f = (&2 * mm1 / pi) * + (&2 * dih_y y1 y2 y3 y4 y5 y6 + &2 * dih3_y y1 y2 y3 y4 y5 y6 + + &2 * dih5_y y1 y2 y3 y4 y5 y6 + dih2_y y1 y2 y3 y4 y5 y6 + + dih4_y y1 y2 y3 y4 y5 y6 + dih6_y y1 y2 y3 y4 y5 y6 - &3 * pi) - + (&8 * mm2 / pi) * + (f (y1 / &2) * dih_y y1 y2 y3 y4 y5 y6 + + f (y3 / &2) * dih3_y y1 y2 y3 y4 y5 y6 + + f (y5 / &2) * dih5_y y1 y2 y3 y4 y5 y6))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REWRITE_TAC[Sphere.vol3f;Sphere.sol_y]; + DISCH_THEN (fun t->REWRITE_TAC[t]); + REWRITE_TAC[Sphere.dih2_y;Sphere.dih3_y;Sphere.dih4_y;Sphere.dih5_y;Sphere.dih6_y]; + ABBREV_TAC `a = &8 * mm2/pi`; + ABBREV_TAC `b = &2 * mm1/pi`; + SUBGOAL_THEN `dih_y y3 r y1 r y5 r = dih_y y3 y5 r r r y1 /\ dih_y y5 r y3 r y1 r = dih_y y5 y1 r r r y3 /\ dih_y y1 r y5 r y3 r = dih_y y1 y3 r r r y5 /\ dih_y y1 r y3 r y5 r = dih_y y1 y3 r r r y5 /\ dih_y y3 y1 r r r y5 = dih_y y3 y5 r r r y1 /\ dih_y r r r y1 y5 y3 = dih_y r y3 y5 y1 r r /\ dih_y r y1 y5 y3 r r = dih_y r y5 y1 y3 r r` (fun t->REWRITE_TAC[t]); + MESON_TAC[dih_y_sym2;dih_y_sym]; + MATCH_MP_TAC (REAL_ARITH `(a = a') ==> (a - c = a' - c)`); + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let vol3r_alt = prove_by_refinement( + `! y1 y2 y3 y4 y5 y6 r. (y3 = r ) /\ (y4 = r) /\ (y5 = r) ==> + (vol3r y1 y2 y6 r = vol_y y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.vol3r;Sphere.vol_y;Sphere.y_of_x;Sphere.vol_x;Sphere.delta_x]; + REPEAT GEN_TAC; + DISCH_THEN (fun t->REWRITE_TAC[t]); + AP_THM_TAC; + AP_TERM_TAC; + AP_TERM_TAC; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +(* a few lemmas copied from TameGeneral *) + +let COS_PI3 = prove(`cos (pi / &3) = &1 / &2`, + REWRITE_TAC[COS_SIN] THEN + REWRITE_TAC[REAL_ARITH `pi / &2 - pi / &3 = pi / &6`] THEN + REWRITE_TAC[SIN_PI6]);; + +let ACS_2 = prove(`acs (&1 / &2) = pi / &3`, + REWRITE_TAC[SYM COS_PI3] THEN + MATCH_MP_TAC ACS_COS THEN + REWRITE_TAC[REAL_ARITH `(&0 <= a / &3 <=> &0 <= a) /\ (a / &3 <= a <=> &0 <= a)`] THEN + MATCH_MP_TAC REAL_LT_IMP_LE THEN + REWRITE_TAC[PI_POS]);; + +let sol0_POS = prove(`&0 < sol0`, + REWRITE_TAC[Sphere.sol0] THEN + REWRITE_TAC[REAL_ARITH `&0 < &3 * a - pi <=> pi / &3 < a`] THEN + REWRITE_TAC[SYM ACS_2] THEN + MATCH_MP_TAC ACS_MONO_LT THEN + REAL_ARITH_TAC);; + +let vol4f_alt = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. vol4f y1 y2 y3 y4 y5 y6 lfun = + (-- &8 * mm1) + + + (&4 * mm1/pi - &8 * mm2 *(&1+const1)/(pi * const1) ) * + (dih_y y1 y2 y3 y4 y5 y6 + dih2_y y1 y2 y3 y4 y5 y6 + dih3_y y1 y2 y3 y4 y5 y6 + + dih4_y y1 y2 y3 y4 y5 y6 + dih5_y y1 y2 y3 y4 y5 y6 + dih6_y y1 y2 y3 y4 y5 y6) + + + (&8 * mm2 / (pi * const1)) * + (rhazim y1 y2 y3 y4 y5 y6 + rhazim2 y1 y2 y3 y4 y5 y6 + rhazim3 y1 y2 y3 y4 y5 y6 + + rhazim4 y1 y2 y3 y4 y5 y6 + rhazim5 y1 y2 y3 y4 y5 y6 + rhazim6 y1 y2 y3 y4 y5 y6) + `, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REWRITE_TAC[vol4f_palt]; + REWRITE_TAC[Sphere.sol_y;lfun_ly;REAL_ARITH `&2 * y / &2 = y`;Sphere.rhazim;rhazim2_alt;rhazim3_alt;Sphere.rhazim4;Sphere.rhazim5;Sphere.rhazim6;]; + REWRITE_TAC[Sphere.rho;Sphere.node2_y;Sphere.node3_y;Sphere.rhazim]; + ONCE_REWRITE_TAC[REAL_ARITH `x = y <=> x - y = &0`]; + SUBGOAL_THEN `~(pi = &0)` ASSUME_TAC; + SIMP_TAC[PI_POS;REAL_ARITH `&0 < x ==> ~(x= &0)`]; + SUBGOAL_THEN `~(const1 = &0)` MP_TAC; + REWRITE_TAC[GSYM sol0_over_pi_EQ_const1]; + MP_TAC sol0_POS; + FIRST_X_ASSUM MP_TAC; + CONV_TAC REAL_FIELD; + FIRST_X_ASSUM MP_TAC; + CONV_TAC REAL_FIELD; + ]);; + (* }}} *) + +let vol2f_marchal_pow_y = prove_by_refinement( + `!r y. vol2f y r marchal_quartic = + let fac = (-- (&8 * mm2/pi) * &2 * pi * inv ( #1.627 * (sqrt2 - &1))) in + (&2 * mm1 / pi) * &2 * pi + - (&2 * mm1 /pi) * &2 * pi * inv(r * &2) * y pow 1 + - fac * &3 * sqrt2 *hplus + + fac *(#1.5 * sqrt2 + #1.5 * hplus + #8.5 * sqrt2 * hplus) * y pow 1 + + fac * (-- #0.75 - #8.5 * sqrt2 * inv(&2) - #8.5 * hplus * inv(&2) - &9 * hplus * sqrt2 * inv (&4)) * y pow 2 + + fac* ( #17.0 * inv (&8) + #9.0 * sqrt2 * inv(&8) + #9.0 * hplus * inv(&8)) * y pow 3 + - fac * #9.0 * inv(&16) * y pow 4`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.vol2f;Sphere.marchal_quartic;LET_DEF;LET_END_DEF;Sphere.hplus;GSYM Sphere.sqrt2;REAL_ARITH `(sqrt2 - &1) * &5 * (#1.3254 - &1) = #1.627 * (sqrt2- &1)`]; + REPEAT GEN_TAC; + REWRITE_TAC[GSYM Sphere.hplus;real_div]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let vol2r_y = prove_by_refinement( + `!y r. vol2r y r = &2 * pi * r * r * inv (&3) - #0.5 * pi * inv(&3) * y pow 2`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.vol2r;real_div]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let ineq_expand6 = prove_by_refinement( + `!a1 a2 a3 a4 a5 a6 b1 b2 b3 b4 b5 b6 x1 x2 x3 x4 x5 x6 P. (ineq [(a1,y1,b1);(a2,y2,b2);(a3,y3,b3);(a4,y4,b4);(a5,y5,b5);(a6,y6,b6)] P) <=> + (a1 <= y1 /\ y1 <= b1 + ==> a2 <= y2 /\ y2 <= b2 + ==> a3 <= y3 /\ y3 <= b3 + ==> a4 <= y4 /\ y4 <= b4 + ==> a5 <= y5 /\ y5 <= b5 + ==> a6 <= y6 /\ y6 <= b6 + ==> P)`, + (* {{{ proof *) + [ + REWRITE_TAC[ineq]; + ]);; + (* }}} *) + +let ineq_expand9 = prove_by_refinement( + `!a1 a2 a3 a4 a5 a6 a7 a8 a9 b1 b2 b3 b4 b5 b6 b7 b8 b9 x1 x2 x3 x4 x5 x6 x7 x8 x9 P. (ineq [(a1,y1,b1);(a2,y2,b2);(a3,y3,b3);(a4,y4,b4);(a5,y5,b5);(a6,y6,b6);(a7,y7,b7);(a8,y8,b8);(a9,y9,b9)] P) <=> + (a1 <= y1 /\ y1 <= b1 + ==> a2 <= y2 /\ y2 <= b2 + ==> a3 <= y3 /\ y3 <= b3 + ==> a4 <= y4 /\ y4 <= b4 + ==> a5 <= y5 /\ y5 <= b5 + ==> a6 <= y6 /\ y6 <= b6 + ==> a7 <= y7 /\ y7 <= b7 + ==> a8 <= y8 /\ y8 <= b8 + ==> a9 <= y9 /\ y9 <= b9 + ==> P)`, + (* {{{ proof *) + [ + REWRITE_TAC[ineq]; + ]);; + (* }}} *) + +let pathL_bound = prove_by_refinement( + `!y a. FST (pathL a) <= y /\ y <= SND (pathL a) ==> + FST a <= y /\ y <= SND a`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + SUBGOAL_THEN `pathL a = pathL (FST a, SND a)` (fun t->ONCE_REWRITE_TAC[t]); + REWRITE_TAC[PAIR]; + REWRITE_TAC[Sphere.pathL]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let pathR_bound = prove_by_refinement( + `!y a. FST (pathR a) <= y /\ y <= SND (pathR a) ==> + FST a <= y /\ y <= SND a`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + SUBGOAL_THEN `pathR a = pathR (FST a, SND a)` (fun t->ONCE_REWRITE_TAC[t]); + REWRITE_TAC[PAIR]; + REWRITE_TAC[Sphere.pathR]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let delta_x_eq0 = prove_by_refinement( + `delta_x (&8) (&4) (&4) (&8) (&4) (&4) = &0 /\ + delta_x (&4) (&8) (&4) (&4) (&8) (&4) = &0 + `, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_x]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let delta_x4_eq64 = prove_by_refinement( + `delta_x4 (&8) (&4) (&4) (&8) (&4) (&4) = -- &64 /\ + delta_x4 (&4) (&8) (&4) (&4) (&8) (&4) = &64 + `, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_x4]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let atn2_0y = prove_by_refinement( + `atn2 (&0,&64) = pi / &2 /\ atn2 (&0 ,-- &64) = -- pi/ &2`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.atn2;REAL_ARITH `~(abs(&64) < &0) /\ &0 < &64 /\ ~(abs (-- &64) < &0) /\ ~(&0 < -- &64) /\ (-- &64 < &0) /\ (&0 / &64 = &0) /\ (&0 / -- &64 = &0)`;ATN_0]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let OR_RULE rule1 rule2 th = try rule1 th with _ -> rule2 th;; + +let rec REPEAT_RULE rule = + fun t -> if can rule t then REPEAT_RULE rule (rule t) else t;; + +let vol3f_lmln = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. (y1 <= &2 * h0) /\ (y2 <= &2 * h0) /\ (y6 <= &2 * h0) ==> (vol3f y1 y2 y6 sqrt2 lmfun = vol3f y1 y2 y6 sqrt2 lfun)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.vol3f]; + MESON_TAC[lmfun_lfun]; + ]);; + (* }}} *) + +let vol3_vol_x = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + &0 <= x1 /\ &0 <= x2 /\ &0 <= x6 ==> + (vol3_x_sqrt x1 x2 x3 x4 x5 x6 = vol_x x1 x2 (&2) (&2) (&2) x6)`, + (* {{{ proof *) + [ + MP_TAC (REAL_ARITH `&0 <= &2`); + ONCE_REWRITE_TAC[REAL_ARITH `&0 = &0 pow 2`]; + REPEAT STRIP_TAC; + REWRITE_TAC[vol3_x_sqrt;Sphere.vol_x;Sphere.vol_y;Sphere.y_of_x;Sphere.sqrt2]; + REPEAT AP_THM_TAC; + AP_TERM_TAC ; + AP_TERM_TAC; + ASM_SIMP_TAC[SPEC `&0` sq_pow2]; + REWRITE_TAC[Sphere.delta_x]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let spec0 = SPECL [`&0`;`&0`;`&0`;`&0`;`&0`;`&0`;];; + +let vol3f_x_lfun_alt = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + &0 <= x1 /\ &0 <= x2 /\ &0 <= x6 ==> + vol3f_x_lfun x1 x2 x3 x4 x5 x6 = (&2 * mm1 / pi) * + (&2 * dih_x x1 x2 (&2) (&2) (&2) x6 + + &2 * dih2_x x1 x2 (&2) (&2) (&2) x6 + + &2 * dih6_x x1 x2 (&2) (&2) (&2) x6 + + dih3_x x1 x2 (&2) (&2) (&2) x6 + + dih4_x x1 x2 (&2) (&2) (&2) x6 + + dih5_x x1 x2 (&2) (&2) (&2) x6 - &3 * pi) - + (&8 * mm2 / pi) * + ( ldih_x x1 x2 (&2) (&2) (&2) x6 + + ldih2_x x1 x2 (&2) (&2) (&2) x6 + + ldih6_x x1 x2 (&2) (&2) (&2) x6)`, + (* {{{ proof *) + [ + MP_TAC (REAL_ARITH `&0 <= &2`); + ONCE_REWRITE_TAC[REAL_ARITH `&0 = &0 pow 2`]; + REPEAT STRIP_TAC; + REWRITE_TAC[vol3f_x_lfun;]; + MP_TAC (SPECL [`sqrt x1`;`sqrt x2`;`sqrt2`;`sqrt2`;`sqrt2`;`sqrt x6`;`sqrt2`;`lfun`] vol3f_palt); + REWRITE_TAC[]; + DISCH_THEN (fun t->REWRITE_TAC[t]); + REWRITE_TAC[Sphere.sqrt2;Sphere.ldih_x;Sphere.ldih2_x;Sphere.ldih6_x;Sphere.dih4_x;Sphere.dih5_x;Sphere.dih6_x]; + ASM_SIMP_TAC[spec0 dih_x_y;spec0 dih2_x_y;spec0 dih3_x_y]; + ]);; + (* }}} *) + +let spech0 = SPECL [`&2 * h0`;`&0`;`&0`;`&0`;`&0`;`&0`;];; + +let vol3f_x_sqrt2_lmplus_alt = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + ((&2 * h0) pow 2 <= x1) /\ &0 <= x2 /\ &0 <= x6 ==> + vol3f_x_sqrt2_lmplus x1 x2 x3 x4 x5 x6 = (&2 * mm1 / pi) * + (&2 * dih_x x1 x2 (&2) (&2) (&2) x6 + + &2 * dih2_x x1 x2 (&2) (&2) (&2) x6 + + &2 * dih6_x x1 x2 (&2) (&2) (&2) x6 + + dih3_x x1 x2 (&2) (&2) (&2) x6 + + dih4_x x1 x2 (&2) (&2) (&2) x6 + + dih5_x x1 x2 (&2) (&2) (&2) x6 - &3 * pi) - + (&8 * mm2 / pi) * + ( + ldih2_x x1 x2 (&2) (&2) (&2) x6 + + ldih6_x x1 x2 (&2) (&2) (&2) x6)`, + (* {{{ proof *) + [ + MP_TAC (REAL_ARITH `&0 <= &2`); + ONCE_REWRITE_TAC[REAL_ARITH `&0 = &0 pow 2`]; + REPEAT STRIP_TAC; + REWRITE_TAC[vol3f_x_sqrt2_lmplus;vol3f_sqrt2_lmplus]; + REWRITE_TAC[Sphere.sqrt2;Sphere.ldih_x;Sphere.ldih2_x;Sphere.ldih6_x;Sphere.dih4_x;Sphere.dih5_x;Sphere.dih6_x]; + ASM_SIMP_TAC[spech0 dih_x_y;spech0 dih2_x_y;spech0 dih3_x_y]; + ]);; + (* }}} *) + +let vol3f_lm0 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + ( &2 * h0 <= y1) /\ (y2 <= &2 * h0) /\ (y6 <= &2 * h0) ==> + (vol3f y1 y2 y6 sqrt2 lmfun = vol3f_sqrt2_lmplus y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[vol3f_sqrt2_lmplus]; + MP_TAC (SPECL [`y1:real`;`y2:real`;`sqrt2`;`sqrt2`;`sqrt2`;`y6:real`; `sqrt2`;`lmfun`] vol3f_palt); + REWRITE_TAC[]; + DISCH_THEN (fun t-> REWRITE_TAC[t]); + ASM_SIMP_TAC[lmfun_lfun;lmfun0]; + REWRITE_TAC[REAL_ARITH `&0 * x = &0 /\ &0 + y = y`]; + ]);; + (* }}} *) + +let vol3r_126_x = prove_by_refinement( + `vol3r (sqrt x1) (sqrt x2) (sqrt x6) sqrt2 = vol3_x_sqrt x1 x2 (x3:real) (x4:real) (x5:real) x6`, + (* {{{ proof *) + [ + REWRITE_TAC[vol3_x_sqrt;Sphere.vol3r;Sphere.vol_y]; + ]);; + (* }}} *) + +let num1_poly = prove_by_refinement( + `! x1 x2 x3 x4 x5 x6. num1 x1 x2 x3 x4 x5 x6 = + &64*x1*x4 - &32*x2*x4 - &32*x3*x4 - &4*x1*(x4 pow 2) - &32*x2*x5 + &32*x3*x5 + + &4*x2*x4*x5 + &32*x2*x6 - &32*x3*x6 + &4*x3*x4*x6 `, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.num1]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let ineq6_of_ineq5 = prove_by_refinement( + `!a1 a2 a3 a4 a5 y1 y2 y3 y4 y5 b1 b2 b3 b4 b5 P. +((!x1 x2 x3 x4 x5 x6. ineq[(a1,x1,b1);(a2,x2,b2);(a3,x3,b3);(a4,x4,b4);(a5,x5,b5);(&1,x6,&1)] + (P x1 x2 x3 x4 x5)) ==> + ineq[(a1,y1,b1);(a2,y2,b2);(a3,y3,b3);(a4,y4,b4);(a5,y5,b5)] + (P y1 y2 y3 y4 y5))`, + (* {{{ proof *) + [ + REWRITE_TAC[ineq]; + MESON_TAC[REAL_ARITH `&1 <= &1`]; + ]);; + (* }}} *) + +let ineq6_of_ineq1 = prove_by_refinement( + `!a1 y1 b1 P. +((!x1 x2 x3 x4 x5 x6. ineq[(a1,x1,b1);(&1,x2,&1);(&1,x3,&1);(&1,x4,&1);(&1,x5,&1);(&1,x6,&1)] + (P x1)) ==> ineq[(a1,y1,b1)] (P y1))`, + (* {{{ proof *) + [ + REWRITE_TAC[ineq]; + MESON_TAC[REAL_ARITH `&1 <= &1`]; + ]);; + (* }}} *) + +let dih_x_alt = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. dih_x x1 x2 x3 x4 x5 x6 = pi / &2 + + atn2 + (sqrt (&4 * x1 * delta_x x1 x2 x3 x4 x5 x6), + --delta_x4 x1 x2 x3 x4 x5 x6) `, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.dih_x]; + REPEAT LET_TAC; + REWRITE_TAC[]; + ]);; + (* }}} *) + +end;; diff --git a/text_formalization/nonlinear/main_estimate_ineq.hl b/text_formalization/nonlinear/main_estimate_ineq.hl new file mode 100644 index 0000000..e896caa --- /dev/null +++ b/text_formalization/nonlinear/main_estimate_ineq.hl @@ -0,0 +1,1634 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Nonlinear *) +(* Author: Thomas C. Hales *) +(* Date: 2011-05-13 *) +(* ========================================================================== *) + +(* TO DO XX + replace 0.696 -> 0.616 systematically in estimates. + (2013-05-05, changed 0.696->0.616 in 7697147739 and 4680581274) +*) + + +(* New test inequalities from May 2011. Redo all the tameTableD calculations, + together with associated nontriangular ad hoc LP estimates. + + HEX (1 CASE): + tameTableD[6,0] has dropped to 0.712. + // old values: 0.7578, 0.723, ... + + PENT (3 CASES): + tameTableD[4,1] = 0.616. This is AD HOC tauB5h in head.mod + tameTableD[5,0] = 0.4819. This is (standard) tau5 in head.mod + tau >= 0.616, diags >= sqrt8. This is AD HOC tau5h 9620775909-5 in head.mod + // old values: 0.696->0.616, 0.6548->0.616. + + QUAD (2 CASES): + tau >= 0.477, diags >= sqrt8, 1edge [2.52,sqrt8]. This is AD HOC tauB4h 9620775909 in head.mod: + tau >= 0.467 diags >= 3. This is AD HOC 9563139965D in body.mod + + standard B-series quad inequalities. + +*) + + +(* This file does *not* treat the standard quad LP cases: + ["3862621143";"4240815464";"6944699408";"7043724150"] + which are proved by usual quad methods *) + +module Main_estimate_ineq = struct + +let mk_tplate = Ineq.mk_tplate ;; +let all_forall = Sphere.all_forall;; +let add = Ineq.add;; +let skip = Ineq.skip;; +let addtex = Ineq.addtex;; + + +addtex(Section,"Main Estimate","Definitions"); + + +(* for sphere.hl *) + + + + + + +add + { +idv = "1834976363"; +doc = "replacement for 22065952723 A1"; +tags=[Main_estimate;Flypaper["UPONLFY"];Tex]; +ineq = all_forall `ineq + [ + (&1 , x1, &1 + sol0/ pi); + (&1 , x2, &1 + sol0/ pi); + (&1 , x3, &1 + sol0/ pi); + ((&2 / h0) pow 2, x4, #15.53); + ((&2 / h0) pow 2, x5, &4 pow 2); + ((&2 / h0) pow 2, x6, &4 pow 2) + ] + (num1 x1 x2 x3 x4 x5 x6 > &0 \/ + num1 x1 x2 x3 x4 x5 x6 < &0 \/ + dnum1 x1 x2 x3 x4 x5 x6 < &0)`; +};; + +add + { +idv="4828966562"; +doc = "If minor diag >= 3, then 3/1.26 > 2.38 and we can contract. + 15.53: arc[2,2,2.52]2 < arc[2,2,Sqrt[15.53]]. + Added May 12, 2011. + c2 upper bound changed from 15.53 to 16.0 on May 23."; +tags=[Main_estimate;Cfsqp;Tex;Flypaper["UPONLFY"];]; +ineq = all_forall `ineq + [ + (&1 , e1, &1 + sol0/ pi); + (&1 , e2, &1 + sol0/ pi); + (&1 , e3, &1 + sol0/ pi); + ((&2 / h0) pow 2, a2, (&2 * h0) pow 2); + ((&2/ h0) pow 2, b2, #3.01 pow 2); + (#2.38 pow 2, c2,#16.0) + ] + ((num1 e1 e2 e3 a2 b2 c2 ) > &0) `; +};; + +add + { +idv="6843920790"; +doc = "In a pentagon with one long edge, we can contract the long edge to 2.52, + or even to 2, using 2 diags. + The constant 2.38 < 3.01/h0."; +tags=[Main_estimate;Cfsqp;Tex;Flypaper["UPONLFY"];]; +ineq = all_forall `ineq + [ + (&1 , e1, &1 + sol0/ pi); + (&1 , e2, &1 + sol0/ pi); + (&1 , e3, &1 + sol0/ pi); + ((&2 / h0) pow 2, a2, #3.01 pow 2); + (#2.38 pow 2, b2, #15.53); + (#2.38 pow 2, c2, #15.53) + ] + ((num1 e1 e2 e3 a2 b2 c2 > &0) ) `; +};; + + +skip + { +idv="quadtest"; +doc = "useful dimension reduction for quads. quadrilateral test"; +tags=[Cfsqp;Tex]; +ineq = all_forall `ineq + [ + (&1 , e1, &1 + sol0/ pi); + (&1 , e2, &1 + sol0/ pi); + (&1 , e3, &1 + sol0/ pi); + ((&2 / h0) pow 2, a2, (&2 * h0) pow 2); + ((&2/ h0) pow 2, b2, (&2 * h0) pow 2); + ((#2.9/ h0) pow 2, c2,(#4.0) pow 2) + ] + ((num1 e1 e2 e3 a2 b2 c2 ) > &0) `; +};; + +add +{ + idv="1117202051"; + doc="Used to maintain nonreflexivity when making num1-deformations. + The big angle on a skinny triangle (ear) is obtuse. + Case where 2 opposite edges equal 2."; + tags=[Flypaper["UPONLFY"];Main_estimate;Cfsqp;Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.0); + (#3.01,y4,#3.01); + (&2,y5,#2.52); + (&2,y6,&2) + ] +(delta4_y y1 y2 y3 y4 y5 y6 < &0)`; +};; + +add +{ + idv="4559601669"; + doc="Used to maintain nonreflexivity when making num1-deformations. + The big angle on a skinny triangle (ear) is obtuse. + Case where two adjacent edges equal 2 along y2 y3 y4"; + tags=[Flypaper["UPONLFY"];Main_estimate;Cfsqp;Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,&2); + (&2,y3,&2); + (#3.01,y4,#3.915); + (&2,y5,#2.52); + (&2,y6,#2.52) + ] +(delta4_y y1 y2 y3 y4 y5 y6 < &0)`; +};; + +add +{ + idv="4559601669b"; + doc="Used to maintain nonreflexivity when making num1-deformations. + The big angle on a skinny triangle (ear) is obtuse. + Case where two adjacent edges equal 2 along face y1 y2 y6. + Added 5/2012."; + tags=[Flypaper["UPONLFY"];Main_estimate;Cfsqp;Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,&2); + (&2,y3,#2.52); + (#3.01,y4,#3.01); + (&2,y5,#2.52); + (&2,y6,&2) + ] +(delta4_y y1 y2 y3 y4 y5 y6 < &0)`; +};; + + + +add +{ + idv="2485876245a"; + doc="Used to justify matan approx in skinny triangles (ears). + This says that the skinny angle is acute. + y4 upper bound comes from the triangle inequality. + Revision a: May 20, 2012: changed lower bound on y5 from 3.01 to 3.0. + Note: this inequality is a consequence of 'JNTEFVP 1' and could be eliminated."; + tags=[Flypaper["TNNOPSI"];Main_estimate;Cfsqp;Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); + (#3.0,y5, &2 * #2.52); + (&2,y6,#2.52) + ] +(delta4_y y1 y2 y3 y4 y5 y6 > &0)`; +};; + +add +{ + idv="2485876245b"; + doc="Used in some quad calculations to show that a node + is not straight (both halves are acute). + Added 2012-5-25."; + tags=[Flypaper["TNNOPSI"];Main_estimate;Cfsqp;Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); + (#3.01,y5, &2 * #2.52); + (&2,y6,#3.01) + ] +((delta4_y y1 y2 y3 y4 y5 y6 > &0) \/ (delta_y y1 y2 y3 y4 y5 y6 < &0))`; +};; + +(* PENT SECTION *) + +addtex (Section,"Main Estimate","Local Fan/Main Estimate/Appendix/Terminal Pent");; + + +add +{ + idv="7175074394"; + doc="ear dih ineq when delta < 20. + Local-fan/Main-estimate/Terminal-pent/both-ears-under-20. + Adaptation of 9459075374. + (EAR) A bound on the delta of an ear in a pent, + The disjunct (dih_y y1 y2 y3 y4 y5 y6 < #0.3205 = (1.75-1.109)/2) has been 'linearized'. + Tan[0.3205]^2 = (>=) 0.110186 + In more detail, this calc shows that delta > 20 or dih < 0.3205 + By 4887115291, we know that the combined angle at the crowded node of a pent is + at least 1.75. If both ears have delta < 20, then combined angle + is at least 1.109 + 2 * 0.3205 = 1.75, so a cross diag <= 3.01. + Hence wlog one of the two ears has delta >= 20. + Added 2013-06-25. Replaces 3405144397 which has invalid domain constraints on y2,y5 + "; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(50.0,500.0);]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (&2,y6,&2) + ] +(let tan2lower = #0.110186 in + (delta_y y1 y2 y3 y4 y5 y6 > &20) \/ + (&4 * x1_delta_y y1 y2 y3 y4 y5 y6 < tan2lower * delta4_squared_y y1 y2 y3 y4 y5 y6) + )`; +};; + + +add +{ + idv="4887115291"; + doc="old name: angles pent* + Local-fan/Main-estimate/Terminal-pent/both-ears-under-20. + "; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.01); + (&2,y5,&2); + (&2,y6,&2) + ] +( #1.75 < dih_y y1 y2 y3 y4 y5 y6 +)`; +};; + +add +{ + idv="6789182745"; + doc="old name: test A* + Local-fan/Main-estimate/Terminal-pent/both-ears-under-20. + "; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = Sphere.all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237) + ] +( + (dih_y y1 y2 y3 y4 y5 y6 < #1.109) + )`; +};; + +add +{ + idv="7796879304"; + doc="old name: res1* + Local-fan/Main-estimate/terminal-pent/ear-tau-approximation + tau_residual. This restricts delta to [0,C]"; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0);Cfsqp_branch 2]; + ineq = all_forall `ineq [ + (#2.0,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (delta_y y1 y2 y3 y4 y5 y6 < &0) \/ + (delta_y y1 y2 y3 y4 y5 y6 > &80) \/ + (y_of_x tau_residual_x y1 y2 y3 y4 y5 y6 > #0.012 + #0.07 * (#2.52 - y1) + #0.01 * (#2.52 * &2 - y2 - y3 )) + )`; +};; + +add +{ + idv="2314572187"; + doc="old name: res1* + Local-fan/Main-estimate/terminal-pent/ear-tau-approximation + tau_residual. This restricts delta above C"; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (#2.0,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (taum y1 y2 y3 y4 y5 y6 > y_of_x taud_x y1 y2 y3 y4 y5 y6) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &80) + )`; +};; + + +add +{ + idv="1347067436"; + doc="old name: local max v4*, WNLKGOQ, 1671775772 (with #0.12->#0.1) 8146670324 + better local max test. + This is the numerator of the 2nd derivative of the function taud. + Case delta > 20."; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.237); + (&2,y5,&2); + (&2,y6,&2) + ] + (y_of_x taud_D1_num_x y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x taud_D1_num_x y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x taud_D2_num_x y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x taud_x y1 y2 y3 y4 y5 y6 > #0.12 \/ + delta_y y1 y2 y3 y4 y5 y6 < &20)`; +};; + + +add +{ + idv="3078028960"; + doc="When delta <= 20, delta is monotonic decreasing in y1. + Hence smallest y1 on the comain delta <= 20 occurs when delta =20. + This gives a lower bound flat_term (y1 @ del20) <= taud on the domain delta <= 20."; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Tex;Xconvert;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] + ( + y_of_x delta_x1 y1 y2 y3 y4 y5 y6 < &0 \/ + delta_y y1 y2 y3 y4 y5 y6 > &20 +)`; +};; + +add +{ + idv="6601228004"; + doc="old name: local max v4* + better local max test. + This is the numerator of the 2nd derivative of the function taud."; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.237); + (&2,y5,&2); + (&2,y6,&2) + ] + ( + y_of_x taud_D2_num_x y1 y2 y3 y4 y5 y6 < &0 \/ + delta_y y1 y2 y3 y4 y5 y6 > &20 \/ + delta_y y1 y2 y3 y4 y5 y6 < &0 +)`; +};; + +add +{ + idv="3665919985"; + doc=" 'A' piece lower bound for terminal pent."; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237) + ] +(taum y1 y2 y3 y4 y5 y6 > #0.541 +)`; +};; + +add +{ + idv="7903347843"; + doc=" + local fan/main estimate/terminal pent + LHS(135,taum>=0.12) RHS(126,y1=2,delta>20) + "; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237) + ] +( + (taum y1 y2 y3 y4 y5 y6 + + y_of_x (mud_126_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + #0.12 + > #0.616) +) +`; +};; + +add +{ + idv="5546286427"; + doc=" + local fan/main estimate/terminal pent + LHS(135,taum>=0.12) RHS(126,delta=0 (reduced from 20)) + "; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237) + ] +( + let d = &0 in + ((taum y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_126_x d (&4) (&4)) y1 y2 y3 y4 y5 y6 + + #0.12 + > #0.616) \/ + y_of_x (delta_126_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 > d )) +`; +};; + +add +{ + idv="7997589055"; + doc=" + local fan/main estimate/terminal pent + LHS(135,y1=2) RHS(126,y1=2) + "; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237) + ] +( + (taum y1 y2 y3 y4 y5 y6 + + y_of_x (mud_126_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + y_of_x (mud_135_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + > #0.616) +) +`; +};; + + +add +{ + idv="2320951108"; + doc=" + local fan/main estimate/terminal pent + LHS(135,y1=2) RHS(126,y1=2.52), extra implicit assumption delta > 20. + mu sqrt(delta) >= 0.012 sqrt(&20) > 0.053. + "; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237) + ] +( + (taum y1 y2 y3 y4 y5 y6 + + y_of_x (mud_135_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + + #0.053 + > #0.616) +) +`; +};; + +add +{ + idv="5429238960"; + doc=" + local fan/main estimate/terminal pent + LHS(135,y1=2) RHS(126,y1=2.52), extra assumption deltaRHS < 20. + "; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237) + ] +( + y_of_x (delta_126_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &20 \/ + (taum y1 y2 y3 y4 y5 y6 + + y_of_x (mud_135_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + > #0.616)) +`; +};; + +add +{ + idv="2565248885"; + doc=" + local fan/main estimate/terminal pent + LHS(135,y1=2) RHS(126,delta <= 20 (reduce to delta=0 or previous case)) + "; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237) + ] +( + let d = &0 in + ((taum y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_126_x d (&4) (&4)) y1 y2 y3 y4 y5 y6 + + y_of_x (mud_135_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0 + > #0.616) \/ + y_of_x (delta_126_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 > d )) +`; +};; + +add +{ + idv="5708641738"; + doc=" + local fan/main estimate/terminal pent + LHS(135,y1=2.52) RHS(126,y1=2.52) + wlog. LHS delta on ears is >= 20, + mu sqrt(delta) >= 0.012 sqrt(&20) > 0.053. + If RHS delta >= 20. get 0.541 + 2 (0.053) > 0.616. + so wlog. RHS delta on ear is <= 20. + "; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237) + ] +( + let d = &20 in + ((taum y1 y2 y3 y4 y5 y6 + + #0.053 + > #0.616) \/ + y_of_x (delta_126_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 > d )) +`; +};; + +add +{ + idv="1948775510"; + doc="was test Q. + local fan/main estimate/terminal pent + LHS(135,y1=2.52,delta=>20) RHS(126,delta=0) + "; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237) + ] +(taum y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_126_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + y_of_x (mud_135_x_v1 (&2 * h0) (&2) (&2)) y1 y2 y3 y4 y5 y6 + > #0.616 \/ + y_of_x (delta_135_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &20 \/ + y_of_x (delta_126_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 // \/ +// y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 +)`; +};; + +add +{ + idv="1586903463"; + doc=" + local fan/main estimate/terminal pent + LHS(135,delta=20) RHS(126,y1=2.52,delta<=20) + sqrt(20) .> 4.47. + "; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237) + ] +(taum y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_135_x (&20) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + (#0.012 + #0.01 * (#2.52 * &2 - y1 - y3 )) * #4.47 + + &0 + > #0.616 \/ +// removed 2013-05-26 y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &20 \/ + y_of_x (delta_135_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &20 \/ + y_of_x (delta_126_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &20 +)`; +};; + +add +{ + idv="8875146520"; + doc=" + local fan/main estimate/terminal pent + LHS(135,delta=20) RHS(126,y1=2.52,delta>20) + sqrt(20) .> 4.47. + "; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237) + ] +(taum y1 y2 y3 y4 y5 y6 + + y_of_x (flat_term2_135_x (&20) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + (#0.012 + #0.01 * (#2.52 * &2 - y1 - y3 )) * #4.47 + + y_of_x (mud_126_x_v1 (&2 * h0) (&2) (&2)) y1 y2 y3 y4 y5 y6 + > #0.616 \/ +// removed 2013-05-26: y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &20 \/ + y_of_x (delta_135_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &20 \/ + y_of_x (delta_126_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &20 +)`; +};; + + +add +{ + idv="1008824382"; + doc=" + local fan/main estimate/terminal pent + LHS(135,delta=20) RHS(126,delta=0) + sqrt(20) .> 4.47. + 0.705 comes by combining mu_y and flat_term2_x terms. + "; + tags=[Main_estimate;Flypaper ["XFZFSWT"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.237); + (#3.01,y6,#3.237) + ] +(taum y1 y2 y3 y4 y5 y6 + + #0.705 * y_of_x (flat_term2_135_x (&20) (&4) (&4)) y1 y2 y3 y4 y5 y6 + + (#0.012 + #0.01 * (#2.52 * &2 - y1 - y3 )) * #4.47 + + y_of_x (flat_term2_126_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 + > #0.616 \/ + y_of_x (delta_135_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &20 \/ + y_of_x (delta_126_x (&4 * h0 * h0) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0 +)`; +};; + + +addtex (Section,"Main Estimate","Local Fan/Main Estimate/Appendix/Terminal Hex");; + +(* START OF HEX SECTION *) + +add +{ + idv="6459846571"; + doc="upper bound on minor diagonal is 3.915 when top edges are 2. + The bound on y4 comes from the triangle inequality. + This could be proved directly with monotonicity and delta, without interval arith."; + tags=[Flypaper["UPONLFY"];Main_estimate;Cfsqp;Xconvert;Tex]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#4.52); + (&2,y5,&2); + (&2,y6,&2) + ] +((y4 < #3.915) \/ + delta_y y1 y2 y3 y4 y5 y6 < &0 +)`; +};; + +add +{ + idv="7439076204"; + doc="local fan/main estimate/terminal hex. + This is used to remove the eulerA_x hypothesis."; + tags=[Main_estimate;Flypaper ["LIAULBV"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] +( y_of_x delta_x4 y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x eulerA_x y1 y2 y3 y4 y5 y6 > &0) +`; +};; + + +skip +{ + idv="test-hex-numerical"; + doc="For cfsqp only. + This is the numerator of the 2nd derivative of the function taud."; + tags=[Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0);Deprecated]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] + (((y_of_x taud_D1_num_x y1 y2 y3 y4 y5 y6) pow 2 > &0) \/ + (y_of_x taud_D2_num_x y1 y2 y3 y4 y5 y6 < &0 \/ + taum y1 y2 y3 y4 y5 y6 > #0.0 \/ // can adjust this later. + delta_y y1 y2 y3 y4 y5 y6 < &15))`; +};; + +add +{ + idv="6877738680"; + doc="local fan/main estimate/appendix/terminal hex + 2nd derivative test for taud. + old version 4910585280. This uses taud."; + tags=[Main_estimate;Flypaper ["LIAULBV"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] + (y_of_x taud_D1_num_x y1 y2 y3 y4 y5 y6 > &0 \/ + y_of_x taud_D1_num_x y1 y2 y3 y4 y5 y6 < &0 \/ + (y_of_x taud_D2_num_x y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x taud_x y1 y2 y3 y4 y5 y6 > &0 \/ + delta_y y1 y2 y3 y4 y5 y6 < &15))`; +};; + + +add +{ + idv="9692636487"; + doc="local fan/main estimate/appendix/terminal hex. + 2nd derivative test for taud."; + tags=[Main_estimate;Flypaper ["LIAULBV"];Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] + ( + (y_of_x taud_D2_num_x y1 y2 y3 y4 y5 y6 < &0 \/ + delta_y y1 y2 y3 y4 y5 y6 < &0) \/ + delta_y y1 y2 y3 y4 y5 y6 > &15 +)`; +};; + + +let template_hex = `\ d234 d126 d135 c234 c126 c135 s45 s56 . ineq + [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (#3.01,y5,#3.915); + (#3.01,y6,#3.915) + ] + (taum y1 y2 y3 y4 y5 y6 + + d234 + + d126 + + d135 + > #0.712 \/ + y_of_x eulerA_x y1 y2 y3 y4 y5 y6 < &0 \/ + c234 \/ + c126 \/ + c135 \/ + s45 \/ + s56 +)`;; + +let mk_ineq_hex i234 i126 i135 = + let nth = List.nth in + let d234 = nth [` y_of_x (flat_term2_234_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 `; + `&0`; + `y_of_x (mud_234_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0`; + `y_of_x (mudLs_234_x (&4) (&10) (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0`; + `&0 - sol0`] i234 in + let d126 = nth [` y_of_x (flat_term2_126_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 `; + `&0`; + `y_of_x (mud_126_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0`; + `y_of_x (mudLs_126_x (&4) (&10) (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0`; + `&0 - sol0`] i126 in + let d135 = nth [` y_of_x (flat_term2_135_x (&0) (&4) (&4)) y1 y2 y3 y4 y5 y6 `; + `&0`; + `y_of_x (mud_135_x_v1 (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0`; + `y_of_x (mudLs_135_x (&4) (&10) (&2) (&2) (&2)) y1 y2 y3 y4 y5 y6 - sol0`; + `&0 - sol0`] i135 in + let c234 = nth [`y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0`; + `F`; + `y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &100`; + `y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &16 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &100`; + `y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_234_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &16`;] i234 in + let c126 = nth [`y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0`; + `F`; + `y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &100`; + `y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &16 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &100`; + `y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_126_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &16`;] i126 in + let c135 = nth [`y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (#2.52 pow 2) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &0`; + `F`; + `y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &100`; + `y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &16 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &100`; + `y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 < &0 \/ + y_of_x (delta_135_x (&4) (&4) (&4)) y1 y2 y3 y4 y5 y6 > &16`;] i135 in + let s45 = if (i234= i126) then `y6 < y4` else `F` in + let s56 = if (i126= i135) then `y5 < y6` else `F` in + rhs(concl(REWRITE_CONV[] (Ineq.mk_tplate template_hex [d234;d126;d135;c234;c126;c135;s45;s56])));; + +(* s45 correction svn 3246, 2013-05-28 *) + +let make_hex_ear i234 i126 i135 = + { + idv = Printf.sprintf "7550003505 %d %d %d" i234 i126 i135; + ineq = mk_ineq_hex i234 i126 i135; + doc = "local fan/main estimate/terminal hex/body + cases: (0) delta=0; (1) taud>0; (2) y=2, 0<=delta<=16; (3) y=2, 16<=delta<=100; (4) y=2, 100 &0 )`; +};; + +add{ + idv = "8346775862"; + doc="In OWZLKVY the angle at y1 is obtuse. Added 2013-4-18."; + tags = [Cfsqp;Tablelp;Xconvert;Main_estimate;Tex;Cfsqp_branch 1]; + ineq = all_forall `ineq + [ + (&2 ,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2)] + ( + delta_y y1 y2 y3 y4 y5 y6 > &200 \/ y_of_x delta_x4 y1 y2 y3 y4 y5 y6 < &0 ) `; +};; + +add{ + idv = "8631418063"; + doc="In OWZLKVY the angle at y2,y3 is acute. Added 2013-4-18."; + tags = [Cfsqp;Tablelp;Xconvert;Main_estimate;Tex]; + ineq = all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (&2,y4,&2); + (#3.01,y5,#3.915); + (&2,y6,&2)] + (y_of_x delta_x4 y1 y2 y3 y4 y5 y6 > &0)`; +};; + +add{ + idv = "4821120729"; + doc="Used in the proof of OWZLKVY to show that sol>=0. Added 2013-04-17."; + tags = [Cfsqp;Tablelp;Xconvert;Main_estimate;Tex]; + ineq = all_forall `ineq + [ + (&2,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2)] + (y_of_x eulerA_x y1 y2 y3 y4 y5 y6 > &0)`; +};; + +add +{ + idv="5202826650 a"; + doc=" + This is part of the proof of Lemma OWZLKVY in flypaper.pdf. + In the book this is called 'some analytic function f' and + doesn't give the idv of the calculation. + It shows that a + skinny triangle (ear) residual is positive, when y1=2.52, + We have tau = tau_residual * sqrt(delta), by definition. + This domain falls within the preconditions of the residual function because of + 4559601669 and 2485876245 + Domain generalized June 3 (2011?): y3 upperbound -> 2.52. + "; + tags=[Flypaper["SAUZWSD"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(500.0,5000.0)]; + ineq = all_forall `ineq [ + (#2.52,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.915); + (&2,y5,&2); + (&2,y6,&2) + ] +( + (y_of_x tau_residual_x y1 y2 y3 y4 y5 y6 > &0) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + + +addtex(Section,"Main Estimate","quadrilaterals");; + +(* Here are some estimates for quad cases that were added late: + 2013-08-07. +*) + +add + { + idv="6184614449"; (* was "test gamma1"; *) + doc = ""; + tags=[Main_estimate;Cfsqp;Tex;Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2 * h0); + (&2,y2,&2 * h0); + (&2,y3,&2 * h0); + (#3.3,y4,&4 * h0); + (&2,y5,&2 * h0); + (&2,y6,&2 * h0)] + ((delta4_y y1 y2 y3 y4 y5 y6 < &0) ) `; + };; + +add + { + idv= "2073661826"; (* "test gamma"; *) + doc = ""; + tags=[Main_estimate;Cfsqp;Tex;Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.55,y4,&4 * h0); + (&2,y5,#2.52); + (#2.52,y6,#3.01)] + ((delta4_y y1 y2 y3 y4 y5 y6 < &0) ) `; + };; + +add + { + idv="1348932091"; (* was "testB"; *) + doc = ""; + tags=[Main_estimate;Cfsqp;Tex;Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#2.52,y4,#2.52); + (#3.01,y5,#3.3); + (&2,y6,#2.52)] + ((dih_y y1 y2 y3 y4 y5 y6 < #1.4) ) `; + };; + +add + { + idv="1348932091 delta"; + doc = ""; + tags=[Main_estimate;Cfsqp;Tex;Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#2.52,y4,#2.52); + (#3.01,y5,#3.3); + (&2,y6,#2.52)] + ((delta_y y1 y2 y3 y4 y5 y6 > &0) ) `; + };; + +add + { + idv= "5557288534"; (* was "testC"; *) + doc = ""; + tags=[Main_estimate;Cfsqp;Tex;Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.01); + (#3.01,y5,#3.3); + (&2,y6,#2.52)] + ((dih_y y1 y2 y3 y4 y5 y6 < #1.7) ) `; + };; + +add + { + idv= "5557288534 delta"; + doc = ""; + tags=[Main_estimate;Cfsqp;Tex;Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.01); + (#3.01,y5,#3.3); + (&2,y6,#2.52)] + ((delta_y y1 y2 y3 y4 y5 y6 > &0) ) `; + };; + + +add + { + idv="9368433105"; + doc = "Justify dih linearization in 8405387449"; + tags=[Main_estimate;Cfsqp;Tex;Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.55); + (&2 * h0,y6,#3.01)] + ((delta4_y y1 y2 y3 y4 y5 y6 > &0) ) `; + };; + +add +{ + idv="8405387449"; + doc=" + (EAR) A bound on the dih of an ear in a quad, + The disjunct (dih_y y1 y2 y3 y4 y5 y6 < #1.1 has been 'linearized'. + Tan[1.1]^2 = (>=) 3.86 + In more detail, this calc shows that delta < 0 or dih < 1.1 + "; + tags=[Main_estimate;Cfsqp;Tex;Xconvert;]; + ineq = Sphere.all_forall `ineq [ + (&2,y1,&2); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,&2); + (#3.01,y5,#3.55); + (&2 * h0,y6,#3.01)] + (let tan2lower = #3.86 in + ((&4 * x1_delta_y y1 y2 y3 y4 y5 y6 < tan2lower * delta4_squared_y y1 y2 y3 y4 y5 y6) \/ + delta_y y1 y2 y3 y4 y5 y6 < &0))`; +};; + +add + { + idv="5550839403"; (* was "test E"; *) + doc = ""; + tags=[Main_estimate;Cfsqp;Tex;Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.01); + (#3.01,y5,#3.55); + (&2,y6,&2 * h0)] + ((dih_y y1 y2 y3 y4 y5 y6 < #2.0) ) `; + };; + + +add + { + idv="5550839403 delta"; + doc = ""; + tags=[Main_estimate;Cfsqp;Tex;Xconvert]; + ineq = Sphere.all_forall `ineq + [ + (&2,y1,&2); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.01); + (#3.01,y5,#3.55); + (&2,y6,&2 * h0)] + ((delta_y y1 y2 y3 y4 y5 y6 > &0) ) `; + };; + + + +addtex (Section,"Main Estimate","Ad hoc quadrilaterals");; + +addtex(Comment,"", +" +Let's start with the ad hoc inequality: 9563139965D. (>= 0.467 ) + By top edge contraction arguments, we may assume that + (0) all top edges have length 2, or + (1) both diagonals have length 3 (by contracting in different ways). + The first case (0) is impossible by geomeric considerations: + edges=2 ==> some diagonal <= sqrt8. + So both diagonals have length 3. + This has been completely solved in a series 9563139965D in ineq.hl. +");; + + +addtex(Comment,"", +"Next the ad hoc LP inequality in head.mod : + tauB4h 9620775909. tau >= 0.477, quad, diags >= sqrt8, one edge [2.52,sqrt8]. + This comes from a pentagon that has a 'flat quarter'. + + Case 1: a diagonal < 3.01. Here we make no deformations. We cut + the quad into two triangles. + + Case 2: both diags > 3.01. In this case we bound the shorter diagonal. + Solve[Delta[x, 2, 2, x, 2, sqrt8] == 0, x] // N gives x <= 3.108 + *) +");; + + + +addtex(Comment,"", +" + Now third ad hoc LP inequality: Quad 0.696. + tau5h 9620775909-5 std5 INTER std56flatfree, tau >= 0.696, pent, diags >= sqrt8, + It drops to a quad case if some diag of pent has length <= 3.01 and a slice is made. + Contract top edges of quad until 3 have length 2. + Extremize the other long edge to 3.01 or sqrt8. + Short diag: Solve[Delta[x,2,2,x,2,3.01]==0,x]//N, gives x <= 3.166 +");; + +add +{ + idv="4680581274 a"; + doc="quad case both diags > 3.01, y9 long. + 4559601669 gives the gratuitous delta4_y disjunct. + May 23, changed delta4 constant from -11.2 to 0. + 2013-05-05, 0.696 -> 0.616."; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Quad_cluster 10000.0 (* was 0.001 *); + Xconvert;Tex;Penalty(50.0,5000.0)]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.166); + (#2.0,y5,&2); + (#2.0,y6,&2); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (#3.01,y9,#3.01)] +( + ( tauq y1 y2 y3 y4 y5 y6 y7 y8 y9 > #0.513) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &10) \/ + delta4_y y1 y2 y3 y4 y5 y6 > &0 \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ))`; +};; + +add +{ + idv="4680581274 delta issue"; + doc="quad case both diags > 3.01, y9 long. + This justifies the assumption the disjunct delta < 10 in the inequality. + 4559601669 gives the gratuitous delta4_y disjunct. + May 23, changed delta4 constant from -11.2 to 0."; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Quad_cluster 10000.0 (* was 0.001 *); + Xconvert;Tex;Penalty(50.0,5000.0)]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.01,y4,#3.166); + (#2.0,y5,&2); + (#2.0,y6,&2); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (#3.01,y9,#3.01)] +( + (delta_y y1 y2 y3 y4 y5 y6 > &10) \/ + delta4_y y1 y2 y3 y4 y5 y6 > &0 \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ))`; +};; + +add +{ + idv="4680581274 delta top issue"; + doc="quad case top neg delta. + Solve[Delta[x,2,2,x,2,3.01]==0,x] (*x < 3.166 *) + Added 2013-05-05."; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert]; + ineq = all_forall `ineq [ + (#3.166,y1,&4); + (#3.01,y2,#3.01); + (&2,y3,&2); + (#3.166,y4,&4); + (&2,y5,&2); + (&2,y6,&2)] +(delta_y y1 y2 y3 y4 y5 y6 < &0)`; +};; + + + +addtex (Section,"Main Estimate","Quadrilaterals (non ad hoc)");; + + +add +{ + idv="2171548893"; + doc=" Main estimate/quad case. + This justifies the upper bound of 3.62 on shortest diagonal when top edges are 2,cstab,2,cstab. + "; + tags=[Flypaper["FHOLLLW"];Cfsqp;Main_estimate;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,&2); + (#3.01,y2,#3.01); + (#3.62,y3,&6); + (&2,y4,&2); + (#3.01,y5,#3.01); + (#3.62,y6,&6) + ] + ( delta_y y1 y2 y3 y4 y5 y6 < &0)`; +};; + +add +{ + idv="2468307358"; + doc="Main estimate/quad/upper echelon. + tameTableD[2,2] + Triangulate quad with diagonal y4. + Use if some diag, 3.01 <= diag <= 3.62. + 2013-06-13. Adapted from 9269152105. d and Lower bound on y4 changed "; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#3.01,y4,#3.62); + (#3.01,y5,#3.01); + (&2,y6,&2) + ] +( + ( taum y1 y2 y3 y4 y5 y6 > #0.2565 ) + )`; +};; + +(* now for the cases where the shorter diagonal does not separate long edges *) + + +add { + idv="9507202313"; + doc="tameTableD[2,2]. + Triangulate quad with diagonal y4. + Case both diags > 3.01, y6, y9 long (2.52 and 3.01), + short diagonal doesn't separate long edges. + Triangulate by long diagonal (at least 3.41 for otherwise it drops into case + where short diagonal separates long edges). + Solve[Delta[x, 2, 2, 3.01, 2.52, 3.01] == 0, x] (* x < 3.634 *) + "; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Quad_cluster 10000.0 (* was 0.001 *); + Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (#2.0,y1,&2 * h0); + (#2.0,y2,&2 * h0); + (#2.0,y3,&2 * h0); + (#3.41,y4,#3.634); + (#2.0,y5,&2); + (#2.52,y6,#2.52); + (#2.0,y7,&2 * h0); + (#2.0,y8,&2); + (#3.01,y9,#3.01)] +( + delta_y y1 y2 y3 y4 y5 y6 > &30 \/ + ( enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9 < #3.01 ))`; +};; + + + +addtex (Section,"Main Estimate","Triangles");; + +(* FIRST DEAL WITH AD HOC TRIANGLES *) + +addtex(Comment,"", +" +If the sliced edge is between [sqrt8,3.01], the triangle (2,1) has tau < tame_table_d 2 1. +Nevertheless tau > 0.11 +We must compensate by putting an extra penalty term (tame_table_d 2 1 - 0.11) + in the other pieces. + +Ad hoc LP. The case. +tauB4h 9620775909 apex4 tau >= 0.477, quad, diags >= sqrt8, one edge [2.52,sqrt8] + This can break into a triangle (2,1) [2.52,sqrt8][sqrt8,3.01] and a triangle (1,2). + In this case we run one extra triangle calc, + replace tame_table_d entries with 0.477 - 0.11. + +tau5h 9620775909-5 std5 INTER std56flatfree, tau >= 0.696, pent, diags >= sqrt8, + This will give an A-piece with [sqrt8,3.01][sqrt8,3.01]. need 0.696 - 2 0.11. + +9563139965D, dart4_diag3_b, tau >= 0.467, quad, diags >= 3. + No triangle occurs here. No diagonal drawn. + +");; + +add +{ + idv="3603097872"; + doc="skinny clipped triangle (ear) inequality + In the application to tameTableD[4,1], we have y4=3.01, y6=2, + It is slightly generalized for later use."; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (sqrt8,y4,#3.01); + (&2,y5,#2.52); + (&2,y6,#2.52) + ] +( + ( taum y1 y2 y3 y4 y5 y6 - #0.1 * (#3.01 - y4) > #0.11) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + + +add +{ + idv="5405130650"; + doc=" 0.477 estimate, clipped A-piece triangle. + Case 1. + We reuse the other cut triangle (bound 0.11) from above. + We have not done it here, but we could extremize edge y5, y6."; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (sqrt8,y4,#3.01); + (#2.52,y5,sqrt8); + (&2,y6,#2.52) + ] +( + ( taum y1 y2 y3 y4 y5 y6 + #0.1 * (#3.01 - y4) > #0.477 - #0.11) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + + +add +{ + idv="5026777310a"; + doc="pentagon case, clipped A-piece triangle. Added 2013-4-20"; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (sqrt8,y4,#3.01); + (sqrt8,y5,#3.01); + (&2,y6,#2.52) + ] +( + ( taum y1 y2 y3 y4 y5 y6 > tame_table_d 4 1 - &2 * #0.11) \/ + (delta_y y1 y2 y3 y4 y5 y6 < &0) + )`; +};; + +add +{ + idv="7881254908"; + doc="triangle 1,2, ad hoc 0.696 case LP"; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (#2.0,y2,#2.52); + (&2,y3,#2.52); + (#2.52,y4,#2.52); + (sqrt8,y5,#3.01); + (sqrt8,y6,#3.01) + ] +( + taum y1 y2 y3 y4 y5 y6 > #0.696 - &2 * #0.11 + )`; +};; + + + +addtex(Section,"Main Estimate","Triangle (non ad hoc)");; + +add +{ + idv="4010906068"; + doc="main estimate/triangle 3 long edges. Added 2013-06-04."; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = Sphere.all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (#2.52,y4,#3.01); + (#2.52,y5,#3.01); + (#2.52,y6,#3.01) + ] +( + taum y1 y2 y3 y4 y5 y6 > #0.476 + )`; +};; + +add +{ + idv="6833979866"; + doc="main estimate A piece. Added 2013-06-04"; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = Sphere.all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); + (#2.52,y5,#3.01); + (#2.52,y6,#3.01) + ] +( + taum y1 y2 y3 y4 y5 y6 > #0.2759 + )`; +};; + +add +{ + idv="5541487347"; + doc="main estimate triangle short ear. Added 2013-06-04."; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = Sphere.all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); + (&2,y5,#2.52); + (#2.52,y6,sqrt8) + ] +( + taum y1 y2 y3 y4 y5 y6 > #0.103 + )`; +};; + +add{ +idv = "OMKYNLT 3336871894"; +tags = [Tex;Cfsqp;Eps 1.0e-8;Flypaper["OMKYNLT"];Main_estimate;Xconvert;Sharp]; +doc = "This is the nonnegativity of $\\tau$ on triangles. It is a sharp inequality."; +ineq = all_forall `ineq + [ + (#2.0,y1,#2.52); + (#2.0,y2,#2.52); + (#2.0,y3,#2.52); + (&2,y4,&2); + (&2,y5,&2); + (&2,y6,&2) + ] +( taum y1 y2 y3 y4 y5 y6 >= #0.0)`; +};; + +add +{ + idv="8495326405"; + doc=" Main estimate/quad case. + "; + tags=[Flypaper["FHOLLLW"];Cfsqp;Main_estimate;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,&2); + (&2,y2,&2); + (#3.01,y3,&6); + (&2,y4,&2); + (&2 * h0,y5,&2 * h0); + (#3.01,y6,&6) + ] + ( delta_y y1 y2 y3 y4 y5 y6 < &0)`; +};; + + + +add +{ + idv="9096461391"; + doc=" 0.513 estimate, A-piece triangle. + One diagonal exactly 3.01. Added 2013-06-13. replaces 8748498390"; + tags=[Flypaper["FHOLLLW"];Cfsqp;Main_estimate;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); + (#2.52,y5,#3.01); + (#3.01,y6,#3.01) + ] + ( taum y1 y2 y3 y4 y5 y6 + #0.12 * (y1 - &2) > #0.403 )`; +};; + + +add +{ + idv="2445657182"; + doc=" 0.513 estimate. ear. Combine with 8748498390 along diagonal 3.01. + Added 2013-06-13."; + tags=[Flypaper["FHOLLLW"];Cfsqp;Main_estimate;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); + (&2,y5,#2.52); + (#3.01,y6,#3.01) + ] + ( taum y1 y2 y3 y4 y5 y6 > #0.11 + #0.12 * (y1 - &2) )`; +};; + +add +{ + idv="2125338128"; + doc="Used to show that angle not straight in (3,3) diagonal main estimate. + Added 2013-06-13."; + tags=[Flypaper["FHOLLLW"];Main_estimate;Cfsqp;Xconvert;Tex;Penalty(50.0,500.0)]; + ineq = all_forall `ineq [ + (&2,y1,#2.52); + (&2,y2,#2.52); + (&2,y3,#2.52); + (&2,y4,#2.52); + (&2,y5,#2.52); + (&2,y6,#3.01) + ] + ( delta_y y1 y2 y3 y4 y5 y6 > &0 )`; +};; + + + + +end;; diff --git a/text_formalization/nonlinear/merge_ineq.hl b/text_formalization/nonlinear/merge_ineq.hl new file mode 100644 index 0000000..5872c7c --- /dev/null +++ b/text_formalization/nonlinear/merge_ineq.hl @@ -0,0 +1,5456 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Nonlinear *) +(* Author: Thomas C. Hales *) +(* Date: 2012-06-08 *) +(* ========================================================================== *) + +(* +Copies DIHV_EQ_DIH_Y from Tame_general. + +*) + +(* + +There are many nonlinear inequalities in the database, which have +been broken into pieces to simplify verification. However, the text +"Dense Sphere Packings" uses the inequalities in a merged formed that +combine many separate pieces. Here we merge the inequalities +into the form used in the text. + +In particular the 5*46 inequalities of nonlinear/ineqdata3q1h.hl have +been merged into a single inequality: ox3q1h_merge (in 13 variables). +The assumption ox3q1h is the conjunction of these 230 inequalities. + +This file is rather slow to load because it processes hundreds of +inequalities. + +Major results in this file: + ox3q1h_merge : the 5*46 inequalities merged into one. + TSKAJXY_DERIVED4: tsk; that is, Ineq.TSKAJXY_DERIVED.ineq + ztg4 : ztg4_concl : combining ZTGIJCF4 ineqs. + lindih inequalities. + +This file also proves many compatibilities of definitions. +*) + +(* bug b14<->b34 fixed, feb 13, 2013 tchales *) + +flyspeck_needs "nonlinear/ineqdata3q1h.hl";; + +module Merge_ineq = struct + + open Sphere;; + open Hales_tactic;; + + let CALC_ID_TAC = Calc_derivative.CALC_ID_TAC;; + + let let_RULE = fun th -> REWRITE_RULE[DEPTH_CONV let_CONV (concl th)] th;; + + let critical_edge_y = new_definition `critical_edge_y y = ((&2*hminus <= y) /\ (y <= &2 *hplus))`;; + +let add_hyp s concl = + let nonlinear = map (fun t -> (hd(Ineq.getexact t)).ineq) s in + let conj = end_itlist (curry mk_conj) nonlinear in + mk_imp(conj,concl);; + +let COND_FALSE = prove_by_refinement( + `!a (b:B) c. (~a) ==> ((if a then b else c) = c)`, + (* {{{ proof *) + [ + BY(MESON_TAC[]) + ]);; + (* }}} *) + + +(* ========================================================================== *) +(* Merge ineqdata3q1h.hl into a single inequality *) +(* ========================================================================== *) + +let idq_of_string s = hd(Ineq.getexact s);; + +(* idq_of_string "OXLZLEZ 6346351218 1 18";; *) + + +(* merge the inequalities in ineqdata3q1h.hl *) + +let ox n i = + (idq_of_string (Printf.sprintf "OXLZLEZ 6346351218 %d %d" i n)).ineq;; + +let tm0 n = ox n 0;; +let tm1 n = ox n 1;; +let tm2 n = ox n 2;; +let tm3 n = ox n 3;; +let tm4 n = ox n 4;; + +let numcases = List.length Ineqdata3q1h.records;; + +let ox_conj n = end_itlist (curry mk_conj) [tm0 n;tm1 n;tm2 n;tm3 n;tm4 n];; +let ox3q1h_term() = + end_itlist (curry mk_conj) (map ox_conj (0--(numcases-1)));; +let ox3q1h() = new_definition (mk_eq (`ox3q1h:bool`,ox3q1h_term()));; +let ox3q1h_mp = MP_TAC(ox3q1h());; + +(* GENERATE PACKING CHAPTER NONLINEAR INEQS *) +(* get ids, make 1 def, extract *) + +let filter_flypaper tl = + List.flatten (map (function + | Flypaper s -> s + | _ -> []) tl);; + +let has_flypaper_tag sl ind = + let tl = ind.tags in + List.length (intersect (filter_flypaper tl) sl) > 0;; + +let is_ox3q1h ind = + let oxl = "OXLZLEZ 6346351218" in + let s = ind.idv in + ( (String.length oxl <= String.length s) && + (String.sub s 0 (String.length oxl) = oxl));; + +let packing_ineq_data = + filter (fun ind -> + has_flypaper_tag ["UKBRPFE";"BIEFJHU";"OXLZLEZ";"TSKAJXY"] ind && + not(is_ox3q1h ind)) (!Ineq.ineqs);; + +let mk_pack_nonlinear = + let ineql = map (fun idv -> idv.ineq) packing_ineq_data in + let packing_ineq_conj = end_itlist (curry mk_conj) ineql in + let _ = new_definition (mk_eq (`pack_nonlinear_non_ox3q1h:bool`,packing_ineq_conj)) in + ();; + +let get_pack_nonlinear_non_ox3q1h = + let ineql = map (fun ind -> ind.ineq) packing_ineq_data in + let sl = map (fun ind -> ind.idv) packing_ineq_data in + let packing_ineq_conj = end_itlist (curry mk_conj) ineql in + let th = new_definition (mk_eq (`pack_nonlinear_non_ox3q1h:bool`,packing_ineq_conj)) in + let th1 = UNDISCH (MATCH_MP (TAUT `(a <=> b) ==> (a ==> b)`) th) in + let co1 thm = if (is_conj (concl thm)) then CONJUNCT1 thm else thm in + fun s -> + let i = index s sl in + let th2 = funpow i CONJUNCT2 th1 in + co1 th2;; + +let example1 = (get_pack_nonlinear_non_ox3q1h "BIXPCGW 6652007036 a2");; + + +let [yv;a12;a23;a34;a14;b12;b23;b34;b14;c1;c2;c3;c4] = + map (fun t -> mk_var(t,`:real`)) + (Str.split (Str.regexp " ") + "y a12 a23 a34 a14 b12 b23 b34 b14 c1 c2 c3 c4");; + +let y12 = `(a12 + b12)/ &2`;; +let y23 = `(a23 + b23)/ &2`;; +let y34 = `(a34 + b34)/ &2`;; +let y41 = `(a14 + b14)/ &2`;; + +let specl x = concl o (SPECL x) o ASSUME;; +let spec1 = specl[yv;a12;a14;c1;b14;b12];; +let spec2 = specl[yv;a23;a12;c2;b12;b23];; +let spec3 = specl[yv;a34;a23;c3;b23;b34];; +let spec4 = specl[yv;a14;a34;c4;b34;b14];; +(* let spec4 = specl[yv;a14;a34;c4;b14;b34];; (* bug b14<->b34 fixed, feb 13, 2013 tchales *) *) + +let spec0 = specl[yv;y12;y23;y34;y41];; +let in1 n = spec1 (tm1 n);; +let in2 n = spec2 (tm2 n);; +let in3 n = spec3 (tm3 n);; +let in4 n = spec4 (tm4 n);; +let in0 n = spec0 (tm0 n);; + +(* labels: y=spine, aij lower edge shared between i & j. bij = top edge. + ci = edge opp spine on simplex i *) +prioritize_real();; + +(* +let getinstantiation = + let concl1 = ` (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / w + + cb * beta_bump_force_y y1 y2 y3 y4 y5 y6 + + cd * dih_y y1 y2 y3 y4 y5 y6 + + cy * y1 + + cab * (y2 + y3 + y5 + y6) + + cc > + &0)` in + fun in2 -> + let u = hd(tl(snd (strip_comb in2))) in + (term_match [] (concl1)) u;; +*) + +let combinator_lemma = + prove_by_refinement(`!cd cy1 cy2 cy3 cy4 cab1 cab2 cab3 cab4 cc1 cc2 cc3 cc4. + ((dih_y y a12 a14 c1 b14 b12 + + dih_y y a23 a12 c2 b12 b23 + + dih_y y a34 a23 c3 b23 b34 + +// bug2/14/2013: dih_y y a14 a34 c4 b14 b34 = + dih_y y a14 a34 c4 b34 b14 = + &2 * pi) /\ (&2 * pi * cd + + (cy1 + cy2 + cy3 + cy4) * y + + &2 * (cab1 + cab2) * (a12 + b12) / &2 + + &2 * (cab2 + cab3) * (a23 + b23) / &2 + + &2 * (cab3 + cab4) * (a34 + b34) / &2 + + &2 * (cab4 + cab1) * (a14 + b14) / &2 + + cc1 + + cc2 + + cc3 + + cc4 < + &0) /\ ( gamma4fgcy y a12 a14 c1 b14 b12 lmfun / &2 + + &1 * beta_bump_force_y y a12 a14 c1 b14 b12 + + cd * dih_y y a12 a14 c1 b14 b12 + + cy1 * y + + cab1 * (a12 + a14 + b14 + b12) + + cc1 > + &0) /\ + (gamma4fgcy y a23 a12 c2 b12 b23 lmfun / &1 + + &0 * beta_bump_force_y y a23 a12 c2 b12 b23 + + cd * dih_y y a23 a12 c2 b12 b23 + + cy2 * y + + cab2 * (a23 + a12 + b12 + b23) + + cc2 > &0) /\ + (gamma4fgcy y a34 a23 c3 b23 b34 lmfun / &1 + + &0 * beta_bump_force_y y a34 a23 c3 b23 b34 + + cd * dih_y y a34 a23 c3 b23 b34 + + cy3 * y + + cab3 * (a34 + a23 + b23 + b34) + + cc3 > + &0) /\ +// (gamma4fgcy y a14 a34 c4 b14 b34 lmfun / &1 + +// &0 * beta_bump_force_y y a14 a34 c4 b14 b34 + +// cd * dih_y y a14 a34 c4 b14 b34 + + (gamma4fgcy y a14 a34 c4 b34 b14 lmfun / &1 + + &0 * beta_bump_force_y y a14 a34 c4 b34 b14 + + cd * dih_y y a14 a34 c4 b34 b14 + + cy4 * y + + cab4 * (a14 + a34 + b34 + b14) + + cc4 > + &0) ==> + ( gamma4fgcy y a12 a14 c1 b14 b12 lmfun / &2 + + beta_bump_force_y y a12 a14 c1 b14 b12 + + gamma4fgcy y a23 a12 c2 b12 b23 lmfun + + gamma4fgcy y a34 a23 c3 b23 b34 lmfun + +// gamma4fgcy y a14 a34 c4 b14 b34 lmfun > + gamma4fgcy y a14 a34 c4 b34 b14 lmfun > + &0 + ))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REPEAT(FIRST_X_ASSUM_ST `gamma4fgcy` MP_TAC); + MATCH_MP_TAC (arith `(a + b+c+d - e < &0) ==> ((a > &0) ==> (b > &0) ==> (c > &0) ==> (d > &0) ==> (e> &0))`); + FIRST_X_ASSUM MP_TAC; + MATCH_MP_TAC (arith `(t = e) ==> ((t< &0) ==> (e < &0))`); + REWRITE_TAC[arith `&2 * pi * cd = (&2 * pi) * cd`]; + FIRST_X_ASSUM (SUBST1_TAC o (SYM)); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + +let template_OX = `!in0 in1 in2 in3 in4 + y' y'' + c1' c1'' c2' c2'' c3' c3'' c4' c4'' + a12' a12'' a23' a23'' a34' a34'' a14' a14'' + b12' b12'' b23' b23'' b34' b34'' b14' b14''. + (in0 /\ in1 /\ in2 /\ in3 /\ in4) ==> + ineq [(y',y,y''); + (c1',c1,c1''); + (c2',c2,c2''); + (c3',c3,c3''); + (c4',c4,c4''); + (a12',a12,a12''); + (a23',a23,a23''); + (a34',a34,a34''); + (a14',a14,a14''); + (b12',b12,b12''); + (b23',b23,b23''); + (b34',b34,b34''); + (b14',b14,b14'') + ] + ((dih_y y a12 a14 c1 b14 b12 + + dih_y y a23 a12 c2 b12 b23 + + dih_y y a34 a23 c3 b23 b34 + +// dih_y y a14 a34 c4 b14 b34 = &2 * pi) ==> + dih_y y a14 a34 c4 b34 b14 = &2 * pi) ==> + (gamma4fgcy y a12 a14 c1 b14 b12 lmfun / &2 + + beta_bump_force_y y a12 a14 c1 b14 b12 + + gamma4fgcy y a23 a12 c2 b12 b23 lmfun + + gamma4fgcy y a34 a23 c3 b23 b34 lmfun + +// gamma4fgcy y a14 a34 c4 b14 b34 lmfun + gamma4fgcy y a14 a34 c4 b34 b14 lmfun + > &0))`;; + +let template_OX2 = `! + y' y'' + c1' c1'' c2' c2'' c3' c3'' c4' c4'' + a12' a12'' a23' a23'' a34' a34'' a14' a14'' + b12' b12'' b23' b23'' b34' b34'' b14' b14''. + ox3q1h ==> + ineq [(y',y,y''); + (c1',c1,c1''); + (c2',c2,c2''); + (c3',c3,c3''); + (c4',c4,c4''); + (a12',a12,a12''); + (a23',a23,a23''); + (a34',a34,a34''); + (a14',a14,a14''); + (b12',b12,b12''); + (b23',b23,b23''); + (b34',b34,b34''); + (b14',b14,b14'') + ] + ((dih_y y a12 a14 c1 b14 b12 + + dih_y y a23 a12 c2 b12 b23 + + dih_y y a34 a23 c3 b23 b34 + +// dih_y y a14 a34 c4 b14 b34 = &2 * pi) ==> + dih_y y a14 a34 c4 b34 b14 = &2 * pi) ==> + (gamma4fgcy y a12 a14 c1 b14 b12 lmfun / &2 + + beta_bump_force_y y a12 a14 c1 b14 b12 + + gamma4fgcy y a23 a12 c2 b12 b23 lmfun + + gamma4fgcy y a34 a23 c3 b23 b34 lmfun + +// gamma4fgcy y a14 a34 c4 b14 b34 lmfun + gamma4fgcy y a14 a34 c4 b34 b14 lmfun + > &0))`;; + + +let dest_triple x = + let (a,b) = dest_pair x in + let (b,c) = dest_pair b in (b,(a,c));; + +let getbounds tm = + let xx1 = hd(snd(strip_comb tm)) in + let xx2 = dest_list xx1 in + map dest_triple xx2;; + +let allbounds n = setify(List.flatten (map getbounds [in1 n;in2 n;in3 n;in4 n]));; + +let goal_OX n = + let g1 = specl [in0 n;in1 n;in2 n;in3 n;in4 n] template_OX in + let a = C assoc (allbounds n) in + let s1 v g = + let (v',v'') = a v in + specl [v';v''] g in + itlist s1 (List.rev [yv;c1;c2;c3;c4;a12;a23;a34;a14;b12;b23;b34;b14]) g1;; + +let goal_OX2 n = + let g1 = template_OX2 in + let a = C assoc (allbounds n) in + let s1 v g = + let (v',v'') = a v in + specl [v';v''] g in + itlist s1 (List.rev [yv;c1;c2;c3;c4;a12;a23;a34;a14;b12;b23;b34;b14]) g1;; + + +let mk13ner n = prove_by_refinement( + goal_OX n, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.ineq]; + REPEAT STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `/\` MP_TAC); + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[arith `a <= b /\ a <= c ==> a <= (b + c)/ &2`; arith `b <= a /\ c <= a ==> (b + c)/ &2 <= a` ]; + FIRST_X_ASSUM_ST `dih_y` MP_TAC; + REWRITE_TAC[TAUT `(a ==> b==>c ==>d==>e==>f==>g)<=>(a /\ b /\ c /\ d/\ e /\ f ==>g)`]; + DISCH_THEN (ASSUME_TAC o (MATCH_MP combinator_lemma)); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let mk_ox3q1h n = prove_by_refinement( + goal_OX2 n, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC (mk13ner n); + BY(BY(ox3q1h_mp THEN ASM_REWRITE_TAC[] THEN REPEAT WEAK_STRIP_TAC THEN ASM_REWRITE_TAC[])) + ]);; + (* }}} *) + +let ox3q1h_46() = map mk_ox3q1h (0--(numcases-1));; + +(* now start combining inequalities from ineqdata31h.hl *) + + +let ineq_APPEND = prove_by_refinement( + `!v f u. ineq (APPEND u v) f = ineq u (ineq v f)`, + (* {{{ proof *) + [ + GEN_TAC; + GEN_TAC; + LIST_INDUCT_TAC; + REWRITE_TAC[APPEND]; + BY(REWRITE_TAC[APPEND;Sphere.ineq]); + REWRITE_TAC[APPEND;Sphere.ineq]; + SUBGOAL_THEN `?(a:real) (b:real) (c:real). h = (a,b,c)` MP_TAC; + BY(MESON_TAC[PAIR_SURJECTIVE]); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[Sphere.ineq]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let pathL_pathR = prove_by_refinement( + `!c x. + (FST c <= x /\ x <= SND c) <=> ( + (FST(pathL c) <= x /\ x <= SND(pathL c)) \/ + (FST(pathR c) <= x /\ x <= SND(pathR c))) +`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + SUBGOAL_THEN `?(a:real) (b:real). c = (a,b)` MP_TAC; + BY(REWRITE_TAC[PAIR_SURJECTIVE]); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[Sphere.pathL;Sphere.pathR]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let ineq_pathL_pathR = prove_by_refinement( + `!u c x f. + ineq (APPEND u (CONS (FST(pathL c),x,SND(pathL c)) v)) f /\ + ineq (APPEND u (CONS (FST(pathR c),x,SND(pathR c)) v)) f ==> + ineq (APPEND u (CONS (FST c,x,SND c) v)) f`, + (* {{{ proof *) + [ + REWRITE_TAC[ineq_APPEND]; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + ONCE_REWRITE_TAC[pathL_pathR]; + REPEAT (FIRST_X_ASSUM MP_TAC); + BY(ASM_CASES_TAC `FST (pathL c) <= x /\ x <= SND (pathL c)` THEN ASM_CASES_TAC ` FST (pathR c) <= x /\ x <= SND (pathR c)` THEN ASM_REWRITE_TAC[] THEN REPEAT WEAK_STRIP_TAC THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let chop0 = prove_by_refinement( + `!l. l = APPEND [] l`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[APPEND]) + ]);; + (* }}} *) + +let chop1 = prove_by_refinement( + `!l. CONS a l = APPEND [a] l`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[APPEND]) + ]);; + (* }}} *) + +let chop2 = prove_by_refinement( + `!l. CONS a1 (CONS a2 l) = APPEND [a1;a2] l`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[APPEND]) + ]);; + (* }}} *) + +let chop3 = prove_by_refinement( + `!l. CONS a1 (CONS a2 (CONS a3 l)) = APPEND [a1;a2;a3] l`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[APPEND]) + ]);; + (* }}} *) + +let chop4 = prove_by_refinement( + `!l. CONS a1 (CONS a2 (CONS a3 (CONS a4 l))) = APPEND [a1;a2;a3;a4] l`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[APPEND]) + ]);; + (* }}} *) + +let chop5 = prove_by_refinement( + `!l. CONS a1 (CONS a2 (CONS a3 (CONS a4 (CONS a5 l)))) = APPEND [a1;a2;a3;a4;a5] l`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[APPEND]) + ]);; + (* }}} *) + +let CHOP_LIST_TAC n = + let chop = List.nth [chop0;chop1;chop2;chop3;chop4;chop5] n in + ONCE_REWRITE_TAC[chop];; + +let CHOP_LIST_RULE n = + let chop = List.nth [chop0;chop1;chop2;chop3;chop4;chop5] n in + ONCE_REWRITE_RULE[chop];; + +let get_cover i = + let zipr = zip (0--(numcases-1)) Ineqdata3q1h.records in + let fil = filter (fun (_,t) -> t.caseno=i) zipr in + let v = List.rev in + map + (fun (k,t) -> + (k,(v t.branch1,v t.branch2,v t.branch3,v t.branch4,v t.branch5))) + fil;; + +let op1 gc k = + let thm = REWRITE_RULE[FST;SND] (UNDISCH (mk_ox3q1h k)) in + (thm,assoc k gc);; + +let prep n = + let gc = get_cover n in + let vs = map fst gc in + map (op1 gc) vs;; + +let merge_match (th1,r1) (th2,r2) = + let ((bx,nx),r3) = Ineqdata3q1h.combine (r1,r2) in + let (th1',th2') = if bx then (th1,th2) else (th2,th1) in + let th3 = CHOP_LIST_RULE nx (CONJ th1' th2') in + let th4 = MATCH_MP ineq_pathL_pathR th3 in + let th5 = REWRITE_RULE[APPEND;FST;SND] th4 in + (th5,r3);; + +let rec combine_l = function + [] -> [] + | [a] -> [a] + | a::b::cs -> + try (merge_match a b)::cs + with Failure _ -> a::combine_l (b::cs);; + +let rec combine_r x = + let x'= combine_l x in + if (x'=x) then x else combine_r x';; + +let combos = map (combine_r o prep) (1--4);; +let partial_merge = end_itlist CONJ (map fst (List.flatten combos));; + +let hminus_h0_hplus = prove_by_refinement( + `!x. (&2 * hminus <= x /\ x <= &2 * hplus) <=> ((&2 * hminus <= x /\ x <= &2 *h0) \/ (&2 * h0 <= x /\ x <= &2 * hplus))`, + (* {{{ proof *) + [ + GEN_TAC; + MP_TAC Nonlinear_lemma.hminus_lt_h0; + MP_TAC Nonlinear_lemma.h0_lt_hplus; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let ox3q1h_merge = prove_by_refinement( + `ox3q1h ==> + !y c1 c2 c3 c4 a12 a23 a34 a14 b12 b23 b34 b14. + ineq + [&2 * hminus,y,&2 * hplus; &2 * hminus,c1,&2 * hplus; &2,c2,&2 * hminus; + &2, + c3, + &2 * hminus; &2,c4,&2 * hminus; &2,a12,&2 * hminus; &2,a23,&2 * hminus; + &2, + a34, + &2 * hminus; &2,a14,&2 * hminus; &2,b12,&2 * hminus; &2, + b23, + &2 * hminus; + &2, + b34, + &2 * hminus; &2,b14,&2 * hminus] + (dih_y y a12 a14 c1 b14 b12 + + dih_y y a23 a12 c2 b12 b23 + + dih_y y a34 a23 c3 b23 b34 + +// dih_y y a14 a34 c4 b14 b34 = + dih_y y a14 a34 c4 b34 b14 = + &2 * pi + ==> gamma4fgcy y a12 a14 c1 b14 b12 lmfun / &2 + + beta_bump_force_y y a12 a14 c1 b14 b12 + + gamma4fgcy y a23 a12 c2 b12 b23 lmfun + + gamma4fgcy y a34 a23 c3 b23 b34 lmfun + +// gamma4fgcy y a14 a34 c4 b14 b34 lmfun > + gamma4fgcy y a14 a34 c4 b34 b14 lmfun > + &0)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MP_TAC partial_merge; + CHOP_LIST_TAC (2); + REWRITE_TAC[ineq_APPEND]; + REPLICATE_TAC 3 (ONCE_REWRITE_TAC[Sphere.ineq]); + REWRITE_TAC[hminus_h0_hplus]; + BY(BOOL_CASES_TAC `&2 * hminus <= y /\ y <= &2 * h0` THEN BOOL_CASES_TAC `&2 * h0 <= y /\ y <= &2 * hplus` THEN BOOL_CASES_TAC `&2 * hminus <= c1 /\ c1 <= &2 * h0` THEN BOOL_CASES_TAC `&2 * h0 <= c1 /\ c1 <= &2 * hplus` THEN REWRITE_TAC[] THEN ASM_MESON_TAC[]) + ]);; + (* }}} *) + +(* ========================================================================== *) +(* Prove Ineq.TSKAJXY_DERIVED.ineq from the nonlinear inequalities *) +(* ========================================================================== *) + + +let atn2_0 = REWRITE_RULE[ATN_0;arith `&0 <= &0`;arith `~(&0 < &0)`;arith `x - &0 = x`;arith `&0/x = &0`] (SPEC `&0` Trigonometry1.ATN2_BREAKDOWN);; + +let matan_pos = prove_by_refinement( + `!x. (&0 < x ==> matan x = atn (sqrt x) / sqrt x)`, + (* {{{ proof *) + [ + BY(ASM_MESON_TAC[Sphere.matan;arith `&0 < x ==> ~(x = &0) /\ (&0 < x <=> x > &0)`]) + ]);; + (* }}} *) + +let pi2_sub_atn2 = prove_by_refinement( + `!x y. (&0 < x /\ &0 < y) ==> pi/ &2 - atn2(x,y) = atn2(y,x)`, + (* {{{ proof *) + [ + ASM_MESON_TAC[Trigonometry1.ATN2_BREAKDOWN] + ]);; + (* }}} *) + +let ATN2_LE_PI2 = prove_by_refinement( + `!x y. &0 < x ==> atn2(x,y) < pi/ &2`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.atn2]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC ATN_BOUNDS []; + ASSUME_TAC PI_POS; + DISCH_TAC; + COND_CASES_TAC; + BY(ASM_MESON_TAC[]); + COND_CASES_TAC; + REWRITE_TAC[ATN_POS_LT;arith `p - x < p <=> &0 < x`]; + GMATCH_SIMP_TAC REAL_LT_DIV; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COND_CASES_TAC; + REWRITE_TAC[arith `-- (x/ &2) - y < x / &2 <=> -- x < y`]; + MATCH_MP_TAC (arith `&0 < pi /\ -- ( pi / &2) < u ==> --pi < u`); + BY(ASM_REWRITE_TAC[ATN_BOUNDS]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let ATN2_POS = prove_by_refinement( + `!x y. &0 < x ==> (&0 < atn2(x,y) <=> &0 < y)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.atn2]; + REPEAT WEAKER_STRIP_TAC; + ASSUME_TAC PI_POS; + COND_CASES_TAC; + REWRITE_TAC[ATN_POS_LT]; + BY(ASM_SIMP_TAC[Collect_geom.REAL_LT_RDIV_0]); + COND_CASES_TAC; + INTRO_TAC ATN_BOUNDS [`x / y`]; + BY(REAL_ARITH_TAC); + COND_CASES_TAC; + INTRO_TAC ATN_BOUNDS [`x / y`]; + BY(REAL_ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + + let TRI_UPS_X_STRICT_POS = prove + (`!a b c. (&0 < a) /\ (&0 < b) /\ (&0 <= c) /\ (c < a + b) /\ (a < b + c) /\ (b < c + a) ==> + &0 < ups_x (a * a) (b * b) (c * c)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC [Trigonometry1.UPS_X_SQUARES] THEN + BY(REPEAT (MATCH_MP_TAC REAL_LT_MUL ORELSE CONJ_TAC ORELSE + ASM_REAL_ARITH_TAC)));; + + let ups_x_pos24 = prove_by_refinement( + `!a b c. &2 <= a /\ a < &4 /\ &2 <= b /\ b < &4 /\ &2 <= c /\ c < &4 ==> &0 < ups_x (a pow 2) (b pow 2) (c pow 2)`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[arith `a pow 2 = a * a`]; + MATCH_MP_TAC TRI_UPS_X_STRICT_POS; + REPEAT (FIRST_X_ASSUM MP_TAC); + (BY(ASM_REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let sqrtpow2 = prove_by_refinement( + `!x. &0 <= x ==> sqrt x * sqrt x = x`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC (ISPEC `&0` Nonlinear_lemma.sq_pow2); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + + +(* +let FROZEN_ONCE_REWRITE_TAC ths = + let th = end_itlist CONJ ths in + FREEZE_THEN (fun t -> ONCE_REWRITE_TAC[t]) th;; +*) + +let COLLECT_MONOM t = (Optimize.FROZEN_REWRITE_TAC [ + (SPEC t (REAL_ARITH `!t u v w. (((u * v)* w = u * v*w) /\ (t * (u * v)) = (u * (t * v)) /\ (t * t = t pow 2) /\ (t * t * u = (t pow 2 * u)))`))]);; + + +let loc_dot = prove_by_refinement( + `!v0 (v1:real^3). (v1 - v0) dot (v1 - v0) = -- &2 * v0 dot v1 + v0 dot v0 + v1 dot v1`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[VECTOR_ARITH `((v1:real^3) - v0) dot (v1 - v0) = v1 dot v1 - &2 * v0 dot v1 + v0 dot v0`]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let vector_of_simplex_dot = prove_by_refinement( + `!(v0:real^3) v1 v2 v3 x1 x2 x3 x4 x5 x6. + ((v0 = vec 0) /\ + (v1 dot v1 = x1) /\ + (v2 dot v2 = x2) /\ + (v3 dot v3 = x3) /\ + (v1 dot v2 = (x1 + x2 - x6)/ &2) /\ + (v1 dot v3 = (x1 + x3 - x5)/ &2) /\ + (v2 dot v3 = (x2 + x3 - x4)/ &2 )) ==> + ((x1 = dist(v0,v1) pow 2) /\ + (x2 = dist(v0,v2) pow 2) /\ + (x3 = dist(v0,v3) pow 2) /\ + (x4 = dist(v2,v3) pow 2) /\ + (x5 = dist(v1,v3) pow 2) /\ + (x6 = dist(v1,v2) pow 2))`, + (* {{{ proof *) + [ + REWRITE_TAC[Collect_geom.DIST_POW2_DOT;loc_dot]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[VECTOR_ARITH `vec 0 dot u = &0 /\ u dot vec 0 = &0`]; + ONCE_REWRITE_TAC[VECTOR_ARITH `v3 dot v2 = v2 dot v3`]; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let vector_of_simplex_edge_lemma = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6 y1 u1 d1 p. ~(y1= &0) /\ ~(u1 = &0) /\ + &0 <= delta_x x1 x2 x3 x4 x5 x6 /\ y1 pow 2 = x1 /\ u1 pow 2 = ups_x x1 x2 x6 /\ + d1 pow 2 = delta_x x1 x2 x3 x4 x5 x6 /\ p = (x1*x1 - x1*x2 - x1*x3 + x2*x3 + &2*x1*x4 - x1*x5 - x2*x5 - x1*x6 - x3*x6 + x5*x6) + ==> + (let (v0:real^3) = vec 0 in + let v1 = vector [y1; &0; &0] in + let v2 = vector [(x1+x2 - x6)/(&2 * y1); u1/(&2 * y1); &0] in + let v3 = vector [(x1+x3-x5)/(&2 * y1); + -- p/(&2*y1 *u1);d1/u1] in + ((x1 = dist(v0,v1) pow 2) /\ + (x2 = dist(v0,v2) pow 2) /\ + (x3 = dist(v0,v3) pow 2) /\ + (x4 = dist(v2,v3) pow 2) /\ + (x5 = dist(v1,v3) pow 2) /\ + (x6 = dist(v1,v2) pow 2)))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + MATCH_MP_TAC vector_of_simplex_dot; + REWRITE_TAC[Collect_geom.DIST_POW2_DOT;vector_norm;DOT_3;VECTOR_SUB_COMPONENT;VECTOR_3]; + BY(REPEAT CONJ_TAC THEN CALC_ID_TAC THEN ASM_REWRITE_TAC[arith `(-- x)*y = -- (x *y) /\ x*(--y) = -- (x * y) /\ (-- (x + y) = --x + --y) /\ (x +y)+z = x + y+z /\ (-- (-- x) = x) /\ (x - y = x + (-- y)) /\ x * &0 = &0 /\ &0 * x = &0 /\ (x + y)*z = x*z + y*z /\ z*(x+y) = z*x + z*y`;arith `(a * b) *c = a * b* c`;] THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[arith `~(&2= &0)`] THEN REPLICATE_TAC 3 DISCH_TAC THEN (COLLECT_MONOM `y1:real`) THEN (COLLECT_MONOM `u1:real`) THEN (COLLECT_MONOM `d1:real`) THEN REPEAT WEAK_STRIP_TAC THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[Sphere.ups_x;Sphere.delta_x] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let simplex_exists = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. (&0 < x1 /\ &0 < ups_x x1 x2 x6 /\ &0 <= + delta_x x1 x2 x3 x4 x5 x6) ==> (?(v0:real^3) v1 v2 v3. + ( x1 = dist(v0,v1) pow 2 /\ + x2 = dist (v0,v2) pow 2 /\ + x3 = dist (v0,v3) pow 2 /\ + x4 = dist (v2,v3) pow 2 /\ + x5 = dist (v1,v3) pow 2 /\ + x6 = dist (v1,v2) pow 2))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MP_TAC (ISPECL [`x1:real`;`x2:real`;`x3:real`;`x4:real`;`x5:real`;`x6:real`;`sqrt x1`;`sqrt(ups_x x1 x2 x6)`;`sqrt(delta_x x1 x2 x3 x4 x5 x6)`;`(x1*x1 - x1*x2 - x1*x3 + x2*x3 + &2*x1*x4 - x1*x5 - x2*x5 - x1*x6 - x3*x6 + x5*x6)`] vector_of_simplex_edge_lemma); + ASM_REWRITE_TAC[]; + ANTS_TAC; + REWRITE_TAC[SQRT_POW2]; + GMATCH_SIMP_TAC SQRT_EQ_0; + GMATCH_SIMP_TAC SQRT_EQ_0; + REPEAT (FIRST_X_ASSUM (MP_TAC)); + BY(REAL_ARITH_TAC); + LET_TAC; + REPEAT LET_TAC; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let DELTA_X_AND_DELTA_X4 = prove(`!x1 x2 x3 x4 x5 x6. + (let d4 = delta_x4 x1 x2 x3 x4 x5 x6 in + let d = delta_x x1 x2 x3 x4 x5 x6 in + let v1 = ups_x x1 x2 x6 in + let v2 = ups_x x1 x3 x5 in + &4 * x1 * d = v1 * v2 - d4 * d4)`, + REPEAT GEN_TAC THEN + REPEAT (CONV_TAC let_CONV) THEN + REWRITE_TAC[Sphere.delta_x4; Sphere.delta_x; Sphere.ups_x] THEN + REAL_ARITH_TAC);; + +(* dihV = dih_y *) +let DIHV_EQ_DIH_Y = prove(`!v0:real^3 v1 v2 v3. ~collinear {v0, v1, v2} /\ ~collinear {v0, v1, v3} + ==> (let v01 = dist (v0, v1) in + let v02 = dist (v0, v2) in + let v03 = dist (v0, v3) in + let v12 = dist (v1, v2) in + let v13 = dist (v1, v3) in + let v23 = dist (v2, v3) in + dihV v0 v1 v2 v3 = dih_y v01 v02 v03 v23 v13 v12)`, + REPEAT GEN_TAC THEN + DISCH_TAC THEN + FIRST_ASSUM (MP_TAC o (fun th -> CONJUNCT2 (MATCH_MP (let_RULE Trigonometry.OJEKOJF) th))) THEN + DISCH_THEN (unlist REWRITE_TAC) THEN + REPEAT (CONV_TAC let_CONV) THEN + MAP_EVERY ABBREV_TAC [`v01 = dist(v0:real^3,v1)`; `v02 = dist(v0:real^3,v2)`; + `v03 = dist(v0:real^3,v3)`; `v12 = dist(v1:real^3,v2)`; + `v13 = dist(v1:real^3,v3)`; `v23 = dist(v2:real^3,v3)`; + `d = delta_x (v01 pow 2) (v02 pow 2) (v03 pow 2) (v23 pow 2) (v13 pow 2) (v12 pow 2)`; + `d4 = delta_x4 (v01 pow 2) (v02 pow 2) (v03 pow 2) (v23 pow 2) (v13 pow 2) (v12 pow 2)`] THEN + REWRITE_TAC[let_RULE Sphere.dih_y; let_RULE Sphere.dih_x; GSYM REAL_POW_2] THEN + ASM_REWRITE_TAC[REAL_ARITH `a - b = a + c <=> c = --b`] THEN + MATCH_MP_TAC Trigonometry1.ATN2_RNEG THEN + DISJ_CASES_TAC (TAUT `~(d4 = &0) \/ d4 = &0`) THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC SQRT_POS_LT THEN + MP_TAC (let_RULE (SPECL [`v01 pow 2`; `v02 pow 2`; `v03 pow 2`; `v23 pow 2`; `v13 pow 2`; `v12 pow 2`] DELTA_X_AND_DELTA_X4)) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; REAL_ARITH `a - &0 * &0 = a`]) THEN + MP_TAC (let_RULE Trigonometry2.NOT_COLLINEAR_IMP_UPS_LT) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (INST [`v3:real^3`,`v2:real^3`] (let_RULE Trigonometry2.NOT_COLLINEAR_IMP_UPS_LT)) THEN + ASM_REWRITE_TAC[] THEN + REPEAT DISCH_TAC THEN + MATCH_MP_TAC REAL_LT_MUL THEN + ASM_REWRITE_TAC[]);; + +let DIHV_DIH_X = prove_by_refinement( + `!(v0:real^3) v1 v2 v3. + (let x01 = dist (v0,v1) pow 2 in + let x02 = dist (v0,v2) pow 2 in + let x03 = dist (v0,v3) pow 2 in + let x12 = dist (v1,v2) pow 2 in + let x13 = dist (v1,v3) pow 2 in + let x23 = dist (v2,v3) pow 2 in + &0 < ups_x x01 x02 x12 /\ &0 < ups_x x01 x03 x13 ==> ( dihV v0 v1 v2 v3 = dih_x x01 x02 x03 x23 x13 x12)) + `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MP_TAC(ISPECL [`v0:real^3`;`v1:real^3`;`v2:real^3`;`v3:real^3`] DIHV_EQ_DIH_Y); + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `collinear` MP_TAC; + ANTS_TAC; + BY(ASM_REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS]); + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[Sphere.dih_y]; + BY(REWRITE_TAC[arith `x * x = x pow 2`;LET_DEF;LET_END_DEF]) + ]);; + (* }}} *) + +let sol_x_sol_euler_x = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. &0 < x1 /\ &0 < ups_x x1 x2 x6 /\ &0 < ups_x x2 x3 x4 /\ + &0 < ups_x x1 x3 x5 /\ &0 < eulerA_x x1 x2 x3 x4 x5 x6 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 ==> + sol_x x1 x2 x3 x4 x5 x6 = sol_euler_x x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MP_TAC (ISPECL [`x1:real`;`x2:real`;`x3:real`;`x4:real`;`x5:real`;`x6:real`] simplex_exists); + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + MP_TAC (ISPECL [`v0:real^3`;`v1:real^3`;`v2:real^3`;`v3:real^3`] Euler_main_theorem.EULER_TRIANGLE); + REWRITE_TAC[Sphere.euler_p;Sphere.xlist;Sphere.ylist]; + REWRITE_TAC[Sphere.sol_x;Sphere.sol_euler_x]; + REWRITE_TAC[ LET_DEF;LET_END_DEF]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT (GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] DIHV_DIH_X)); + REPEAT ( FIRST_X_ASSUM_ST `pow` ((MP_TAC o (SYM )))); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[DIST_SYM]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[Collect_geom.UPS_X_SYM]); + CONJ_TAC; + BY(ASM_MESON_TAC[Collect_geom.UPS_X_SYM]); + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[arith `pi - &2 * x = &2*(pi/ &2 - x)`]; + GMATCH_SIMP_TAC pi2_sub_atn2; + REWRITE_TAC[GSYM CONJ_ASSOC]; + CONJ_TAC; + BY(ASM_SIMP_TAC [SQRT_POS_LT]); + SUBGOAL_THEN `(dist ((v1:real^3),v0) * dist (v2,v0) * dist (v3,v0) + dist (v1,v0) * ((v2 - v0) dot (v3 - v0)) + dist (v2,v0) * ((v3 - v0) dot (v1 - v0)) + dist (v3,v0) * ((v1 - v0) dot (v2 - v0))) = eulerA_x x1 x2 x3 x4 x5 x6` SUBST1_TAC; + REWRITE_TAC[Sphere.eulerA_x]; + BINOP_TAC; + BY(REPEAT BINOP_TAC THEN ASM_MESON_TAC[POW_2_SQRT;DIST_POS_LE;DIST_SYM]); + BINOP_TAC; + BINOP_TAC; + BY(ASM_MESON_TAC[POW_2_SQRT;DIST_POS_LE;DIST_SYM]); + EXPAND_TAC"x2"; + EXPAND_TAC "x3"; + EXPAND_TAC "x4"; + REWRITE_TAC[Collect_geom.DIST_POW2_DOT]; + REWRITE_TAC[DOT_LSUB;DOT_RSUB]; + REWRITE_TAC[DOT_SYM]; + BY(REAL_ARITH_TAC); + BINOP_TAC; + BINOP_TAC; + BY(ASM_MESON_TAC[POW_2_SQRT;DIST_POS_LE;DIST_SYM]); + EXPAND_TAC"x1"; + EXPAND_TAC "x3"; + EXPAND_TAC "x5"; + REWRITE_TAC[Collect_geom.DIST_POW2_DOT]; + REWRITE_TAC[DOT_LSUB;DOT_RSUB;DOT_SYM]; + BY(REAL_ARITH_TAC); + BINOP_TAC; + BY(ASM_MESON_TAC[POW_2_SQRT;DIST_POS_LE;DIST_SYM]); + EXPAND_TAC"x1"; + EXPAND_TAC "x2"; + EXPAND_TAC "x6"; + REWRITE_TAC[Collect_geom.DIST_POW2_DOT]; + REWRITE_TAC[DOT_LSUB;DOT_RSUB;DOT_SYM]; + BY(REAL_ARITH_TAC); + CONJ_TAC; + FIRST_X_ASSUM_ST `eulerA_x` MP_TAC; + BY(REAL_ARITH_TAC); + REPEAT (AP_THM_TAC ORELSE AP_TERM_TAC); + REWRITE_TAC[Sphere.eulerA_x]; + MATCH_MP_TAC (arith `(a = a') ==> (a + b = a' + b)`); + GMATCH_SIMP_TAC SQRT_MUL; + GMATCH_SIMP_TAC SQRT_MUL; + GMATCH_SIMP_TAC Real_ext.REAL_PROP_NN_MUL2; + BY(ASM_MESON_TAC[REAL_LE_POW_2]) + ]);; + (* }}} *) + +let dih_x_dih_x_div_sqrtdelta_posbranch = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + &0 < x1 /\ &0 < delta_x x1 x2 x3 x4 x5 x6 /\ + &0 < delta_x4 x1 x2 x3 x4 x5 x6 ==> + dih_x x1 x2 x3 x4 x5 x6 = sqrt(delta_x x1 x2 x3 x4 x5 x6) * + dih_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.dih_x;Nonlin_def.dih_x_div_sqrtdelta_posbranch;LET_DEF;LET_END_DEF]; + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC matan_pos; + SUBCONJ_TAC; + REWRITE_TAC[Calc_derivative.invert_den_lt;GSYM REAL_MUL_ASSOC;arith `x pow 2 = x * x`]; + BY(ASM_MESON_TAC[REAL_LT_MUL;arith `&0 < &4`]); + DISCH_TAC; + ABBREV_TAC `d = delta_x x1 x2 x3 x4 x5 x6`; + ABBREV_TAC `d4 = delta_x4 x1 x2 x3 x4 x5 x6`; + GMATCH_SIMP_TAC Trigonometry1.ATN2_RNEG; + CONJ_TAC; + DISJ1_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `x + -- y = x - y`]; + GMATCH_SIMP_TAC pi2_sub_atn2; + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC SQRT_POS_LT; + BY(ASM_MESON_TAC[REAL_LT_MUL;arith `&0 < &4`]); + GMATCH_SIMP_TAC (MESON[Trigonometry1.ATN2_BREAKDOWN] `&0 < x ==> (atn2(x,y) = atn(y/x))`); + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `sqrt((&4 * x1 * d) / d4 pow 2) = sqrt(&4 * x1 * d)/d4` SUBST1_TAC; + BY(ASM_MESON_TAC[Trigonometry1.SQRT_DIV_R;REAL_LT_MUL;arith `&0 < x ==> &0 <= x`;arith `&0 < &4`]); + REWRITE_TAC[arith `a * b /c * e/f = e * ((a * b/c)/f)`]; + MATCH_MP_TAC (arith `x = &1 ==> u = u * x`); + GMATCH_SIMP_TAC REAL_EQ_LDIV_EQ; + REWRITE_TAC[arith `&4 * x1 * d = d * (&4 * x1)`]; + GMATCH_SIMP_TAC SQRT_MUL; + REWRITE_TAC[Calc_derivative.invert_den_lt]; + REPEAT CONJ_TAC; + BY(ASM_MESON_TAC[arith `&0 < d ==> &0 <= d`]); + BY(ASM_MESON_TAC[REAL_LT_MUL;arith `&0 < &4`;arith `&0 < d ==> &0 <= d`]); + GMATCH_SIMP_TAC SQRT_MUL; + BY(ASM_MESON_TAC[REAL_LT_MUL;arith `&0 < &4`;arith `&0 < d ==> &0 <= d`;SQRT_POS_LT]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let dih_x_dih_x_div_sqrtdelta_negbranch = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + &0 < x1 /\ &0 < delta_x x1 x2 x3 x4 x5 x6 /\ + delta_x4 x1 x2 x3 x4 x5 x6 < &0 ==> + dih_x x1 x2 x3 x4 x5 x6 = pi + sqrt(delta_x x1 x2 x3 x4 x5 x6) * + dih_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.dih_x;Nonlin_def.dih_x_div_sqrtdelta_posbranch;LET_DEF;LET_END_DEF;arith `x < &0 <=> &0 < -- x`]; + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC matan_pos; + SUBCONJ_TAC; + REWRITE_TAC[Calc_derivative.invert_den_lt;GSYM REAL_MUL_ASSOC;arith `x pow 2 = (--x) * (-- x)`]; + BY(BY(ASM_MESON_TAC[REAL_LT_MUL;arith `&0 < &4`;arith `x < &0 <=> &0 < -- x`])); + DISCH_TAC; + ABBREV_TAC `d = delta_x x1 x2 x3 x4 x5 x6`; + ONCE_REWRITE_TAC[arith `x pow 2 = (--x) pow 2`]; + ONCE_REWRITE_TAC[arith `a * sqrt u / v * r = a * sqrt u /(-- (-- v)) * r`]; + ABBREV_TAC `d4 = -- delta_x4 x1 x2 x3 x4 x5 x6`; + REWRITE_TAC[arith `pi / &2 + x = pi + u <=> -- u = pi/ &2 - x`]; + GMATCH_SIMP_TAC pi2_sub_atn2; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(BY(ASM_MESON_TAC[REAL_LT_MUL;SQRT_POS_LT;arith `x < &0 <=> &0 < -- x`;arith `&0 < &4`])); + GMATCH_SIMP_TAC (MESON[Trigonometry1.ATN2_BREAKDOWN] `&0 < x ==> (atn2(x,y) = atn(y/x))`); + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `sqrt((&4 * x1 * d) / d4 pow 2) = sqrt(&4 * x1 * d)/d4` SUBST1_TAC; + BY(BY(ASM_MESON_TAC[Trigonometry1.SQRT_DIV_R;REAL_LT_MUL;arith `&0 < x ==> &0 <= x`;arith `&0 < &4`])); + REWRITE_TAC[arith `--(a * b /c * e/f) = e * ((a * (--b)/c)/f)`]; + MATCH_MP_TAC (arith `x = &1 ==> u * x = u`); + GMATCH_SIMP_TAC REAL_EQ_LDIV_EQ; + REWRITE_TAC[arith `&4 * x1 * d = d * (&4 * x1)`]; + GMATCH_SIMP_TAC SQRT_MUL; + REWRITE_TAC[Calc_derivative.invert_den_lt]; + REPEAT CONJ_TAC; + BY(BY(ASM_MESON_TAC[arith `&0 < d ==> &0 <= d`])); + BY(BY(ASM_MESON_TAC[REAL_LT_MUL;arith `&0 < &4`;arith `&0 < d ==> &0 <= d`])); + GMATCH_SIMP_TAC SQRT_MUL; + BY(BY(ASM_MESON_TAC[REAL_LT_MUL;arith `&0 < &4`;arith `&0 < d ==> &0 <= d`;SQRT_POS_LT])); + CALC_ID_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let tau_x_tau_residual_x = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + sqrt(x1) = &2 * h0 /\ + &0 < x1 /\ &0 < x2 /\ &0 < x3 /\ &0 < x4 /\ &0 < x5 /\ &0 < x6 /\ + delta_x4 x1 x2 x3 x4 x5 x6 < &0 /\ + &0 < delta_x4 x2 x3 x1 x5 x6 x4 /\ + &0 < delta_x4 x3 x1 x2 x6 x4 x5 /\ + &0 <= delta_x x1 x2 x3 x4 x5 x6 ==> + taum_x x1 x2 x3 x4 x5 x6 = sqrt(delta_x x1 x2 x3 x4 x5 x6) * + tau_residual_x x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[arith `&0 <= x <=> (&0 = x \/ &0 < x)`]; + DISCH_THEN DISJ_CASES_TAC; + REWRITE_TAC[Sphere.taum_x;Sphere.rhazim_x;Sphere.rhazim2_x;Sphere.rhazim3_x;Sphere.rhazim;Sphere.rhazim2;Sphere.rhazim3;Sphere.node2_y;Sphere.node3_y;Sphere.dih_y;LET_DEF;LET_END_DEF;Sphere.dih_x]; + ASM_SIMP_TAC[arith `x * x = x pow 2`;SQRT_POW_2;arith `&0 < x ==> &0 <= x`]; + SUBGOAL_THEN `delta_x x2 x3 x1 x5 x6 x4 = &0` SUBST1_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.delta_x] THEN REAL_ARITH_TAC); + SUBGOAL_THEN `delta_x x3 x1 x2 x6 x4 x5 = &0` SUBST1_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.delta_x] THEN REAL_ARITH_TAC); + FIRST_X_ASSUM (SUBST1_TAC o (GSYM)); + REWRITE_TAC[arith `x * &0 = &0`;arith `&0 * x = &0`;SQRT_0]; + ASM_SIMP_TAC[atn2_0;arith `(-- y < &0 <=> &0 < y) /\ ( &0 < -- y <=> y < &0)`]; + REWRITE_TAC[Sphere.h0;Nonlinear_lemma.rho_alt;arith `pi/ &2 + pi/ &2 = pi /\ x + -- x = &0 /\ x * &0 = &0`]; + BY(REAL_ARITH_TAC); + REWRITE_TAC[Sphere.taum_x;Sphere.rhazim_x;Sphere.rhazim2_x;Sphere.rhazim3_x;Sphere.rhazim;Sphere.rhazim2;Sphere.rhazim3;Sphere.node2_y;Sphere.node3_y;Sphere.dih_y;LET_DEF;LET_END_DEF]; + ASM_SIMP_TAC[arith `x * x = x pow 2`;SQRT_POW_2;arith `&0 < x ==> &0 <= x`]; + REWRITE_TAC[Nonlin_def.tau_residual_x]; + REWRITE_TAC[Nonlin_def.tau_residual_x;Nonlin_def.rhazim_x_div_sqrtdelta_posbranch;Nonlin_def.rhazim2_x_div_sqrtdelta_posbranch;Nonlin_def.rhazim3_x_div_sqrtdelta_posbranch;Sphere.rotate2;Sphere.rotate3]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `a + b + c - d = (a - d) + b + c`]; + REWRITE_TAC[arith `a * (b + c) = a * b + a * c`]; + BINOP_TAC; + ASM_SIMP_TAC[dih_x_dih_x_div_sqrtdelta_negbranch]; + REWRITE_TAC[Sphere.h0;Nonlinear_lemma.rho_alt;]; + BY(REAL_ARITH_TAC); + BINOP_TAC; + ONCE_REWRITE_TAC[arith `a * b * c = b * (a * c)`]; + AP_TERM_TAC; + GMATCH_SIMP_TAC dih_x_dih_x_div_sqrtdelta_posbranch; + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `delta_x x2 x3 x1 x5 x6 x4 = delta_x x1 x2 x3 x4 x5 x6` SUBST1_TAC; + BY(REWRITE_TAC[Sphere.delta_x] THEN REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[]); + ONCE_REWRITE_TAC[arith `a * b * c = b * (a * c)`]; + AP_TERM_TAC; + GMATCH_SIMP_TAC dih_x_dih_x_div_sqrtdelta_posbranch; + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `delta_x x3 x1 x2 x6 x4 x5 = delta_x x1 x2 x3 x4 x5 x6` SUBST1_TAC; + BY(REWRITE_TAC[Sphere.delta_x] THEN REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let sol_x_sol_x_sqrtdelta = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. &0 < x1 /\ &0 < x2 /\ &0 < x3 /\ + (&0 < eulerA_x x1 x2 x3 x4 x5 x6) /\ (&0 <= delta_x x1 x2 x3 x4 x5 x6 ) ==> + sol_euler_x x1 x2 x3 x4 x5 x6 = sqrt(delta_x x1 x2 x3 x4 x5 x6) * + sol_euler_x_div_sqrtdelta x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.sol_euler_x;Nonlin_def.sol_euler_x_div_sqrtdelta]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (DISJ_CASES_TAC o (REWRITE_RULE[arith `&0 <= x <=> x = &0 \/ &0 < x`])); + ASM_REWRITE_TAC[arith `&0 / x = &0`;SQRT_0]; + LET_TAC; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REWRITE_TAC[arith `&0 * x = &0 /\ (&2 * x = &0 <=> x = &0)`]; + GMATCH_SIMP_TAC (MESON [Trigonometry1.ATN2_BREAKDOWN] `&0 < x ==> atn2 (x,&0) = atn(&0/x)`); + REWRITE_TAC[arith `&0 / x = &0`;ATN_0;arith `&0 < &2 * a <=> &0 < a`]; + SUBGOAL_THEN `a = eulerA_x x1 x2 x3 x4 x5 x6` SUBST1_TAC; + EXPAND_TAC "a"; + REWRITE_TAC[Sphere.eulerA_x]; + REPEAT (GMATCH_SIMP_TAC SQRT_MUL); + BY(ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`;Real_ext.REAL_PROP_NN_MUL2]); + BY(ASM_REWRITE_TAC[]); + LET_TAC; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + SUBGOAL_THEN `a = eulerA_x x1 x2 x3 x4 x5 x6` ASSUME_TAC; + EXPAND_TAC "a"; + REWRITE_TAC[Sphere.eulerA_x]; + REPEAT (GMATCH_SIMP_TAC SQRT_MUL); + BY(ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`;Real_ext.REAL_PROP_NN_MUL2]); + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC matan_pos; + REWRITE_TAC[Calc_derivative.invert_den_lt]; + CONJ_TAC; + REWRITE_TAC[arith `x pow 2 = x* x`]; + BY(BY(ASM_MESON_TAC[REAL_LT_MUL;arith `&0 < &4`])); + REWRITE_TAC[arith `&4 * x pow 2 = (&2 * x ) pow 2`]; + GMATCH_SIMP_TAC (MESON[Trigonometry1.SQRT_DIV_R] `&0 <= x /\ &0 <= y ==> sqrt(x / y pow 2) = sqrt x / y`); + GMATCH_SIMP_TAC (MESON [Trigonometry1.ATN2_BREAKDOWN] `&0 < x ==> atn2 (x,y) = atn(y/x)`); + ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`;Real_ext.REAL_PROP_NN_MUL2;arith `&0 < &2`;REAL_LT_MUL]; + MATCH_MP_TAC (arith `&2 = a / y / z ==> &2 * x = a * x / y / z`); + CALC_ID_TAC; + GMATCH_SIMP_TAC SQRT_EQ_0; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + + +let sol_y_sol_x = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. sol_y y1 y2 y3 y4 y5 y6 = sol_x (y1*y1) (y2*y2) (y3*y3) (y4*y4) (y5 * y5) (y6 * y6)`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Sphere.sol_y;Sphere.sol_x;Sphere.dih_y;LET_DEF;LET_END_DEF]); + ]);; + (* }}} *) + +let sol_x_sym = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. sol_x x1 x2 x3 x4 x5 x6 = sol_x x1 x3 x2 x4 x6 x5`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.sol_x]; + REPEAT STRIP_TAC; + MATCH_MP_TAC (arith `(a=a')/\(b=b')/\(c=c')==>((a + b + c - pi) = (a' + c'+b'-pi)) `); + BY(MESON_TAC[Nonlinear_lemma.dih_x_sym;Nonlinear_lemma.dih_x_sym2]) + ]);; + (* }}} *) + +let sol_x_sym2 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. sol_x x1 x2 x3 x4 x5 x6 = sol_x x2 x3 x1 x5 x6 x4`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.sol_x]; + REPEAT STRIP_TAC; + MATCH_MP_TAC (arith `(a=a')/\(b=b')/\(c=c')==>((a + b + c - pi) = (b' + c'+a'-pi)) `); + BY(BY(MESON_TAC[Nonlinear_lemma.dih_x_sym;Nonlinear_lemma.dih_x_sym2])) + ]);; + (* }}} *) + +let delta_x_sym = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. delta_x x1 x2 x3 x4 x5 x6 = delta_x x2 x1 x3 x5 x4 x6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_x]; + BY(REAL_ARITH_TAC); + ]);; + (* }}} *) + +let delta_x_sym2 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. delta_x x1 x2 x3 x4 x5 x6 = delta_x x2 x3 x1 x5 x6 x4`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_x]; + BY(REAL_ARITH_TAC); + ]);; + (* }}} *) + +let sol_x_sol_y = prove_by_refinement( + `sol_y = y_of_x sol_x`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM]; + BY(REWRITE_TAC[Sphere.sol_y;Sphere.y_of_x;Sphere.sol_x;Sphere.dih_y;LET_DEF;LET_END_DEF]) + ]);; + (* }}} *) + +let gamma4fgcy_div_sqrtdelta = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + &0 < x1 /\ &0 < x2 /\ &0 < x3 /\ &0 < x4 /\ &0 < x5 /\ &0 < x6 /\ + &2 * h0 <= sqrt x1 /\ &2 * h0 <= sqrt x4 /\ + sqrt x2 <= &2 * h0 /\ sqrt x3 <= &2 * h0 /\ sqrt x5 <= &2 * h0 /\ + sqrt x6 <= &2 * h0 /\ + &0 < ups_x x1 x2 x6 /\ &0 < ups_x x2 x3 x4 /\ &0 < ups_x x1 x3 x5 /\ + &0 < ups_x x4 x5 x6 /\ + &0 < eulerA_x x1 x2 x3 x4 x5 x6 /\ + &0 < eulerA_x x4 x2 x6 x1 x5 x3 /\ + &0 < eulerA_x x5 x3 x4 x2 x6 x1 /\ + &0 < eulerA_x x6 x1 x5 x3 x4 x2 /\ + &0 < delta_x4 x5 x3 x4 x2 x6 x1 /\ + &0 < delta_x4 x3 x1 x2 x6 x4 x5 /\ + &0 < delta_x4 x2 x3 x1 x5 x6 x4 /\ + &0 < delta_x4 x6 x1 x5 x3 x4 x2 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 ==> + (gamma4fgcy (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) + (sqrt x5) (sqrt x6) lmfun = + sqrt(delta_x x1 x2 x3 x4 x5 x6) * (&1 / &12 - + ( + (&2 * mm1 / pi) * + (sol_euler_x_div_sqrtdelta x1 x2 x3 x4 x5 x6 + + sol_euler345_x_div_sqrtdelta x1 x2 x3 x4 x5 x6 + + sol_euler156_x_div_sqrtdelta x1 x2 x3 x4 x5 x6 + + sol_euler246_x_div_sqrtdelta x1 x2 x3 x4 x5 x6) - + (&8 * mm2 / pi) * ( + ldih2_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 + + ldih3_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 + + ldih5_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 + + ldih6_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 + ) + )))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.gamma4fgcy;Sphere.gamma4f;Sphere.vol_y;Sphere.vol4f;Sphere.y_of_x;sol_x_sol_y;Sphere.dih_y;LET_DEF;LET_END_DEF]; + ASM_SIMP_TAC[arith `x * x = x pow 2`;SQRT_POW_2;arith `&0 < x ==> &0 <= x`]; + REWRITE_TAC[Nonlin_def.sol_euler345_x_div_sqrtdelta;Nonlin_def.sol_euler156_x_div_sqrtdelta;Nonlin_def.sol_euler246_x_div_sqrtdelta;Nonlin_def.ldih2_x_div_sqrtdelta_posbranch;Nonlin_def.ldih3_x_div_sqrtdelta_posbranch;Nonlin_def.ldih5_x_div_sqrtdelta_posbranch;Nonlin_def.ldih6_x_div_sqrtdelta_posbranch;Sphere.rotate2;Sphere.rotate3;Sphere.rotate5;Sphere.rotate6;Sphere.rotate4;Nonlin_def.ldih_x_div_sqrtdelta_posbranch]; + ASM_SIMP_TAC[Nonlinear_lemma.lmfun_lfun]; + ASM_SIMP_TAC[Nonlinear_lemma.lmfun0;arith `&0 * x = &0 /\ &0 + x = x`]; + REWRITE_TAC[arith `sqrt x * (u - v) = sqrt x * u - sqrt x * v /\ sqrt x * (u+ v) = sqrt x * u + sqrt x * v`]; + BINOP_TAC; + REWRITE_TAC[Sphere.vol_x]; + BY(REAL_ARITH_TAC); + BINOP_TAC; + REWRITE_TAC[arith `sqrt x * y * z = y * sqrt x * z`]; + AP_TERM_TAC; + SUBGOAL_THEN `sol_x x1 x5 x6 x4 x2 x3 = sol_x x6 x1 x5 x3 x4 x2 /\ sol_x x4 x5 x3 x1 x2 x6 = sol_x x5 x3 x4 x2 x6 x1 /\ sol_x x4 x2 x6 x1 x5 x3 = sol_x x4 x2 x6 x1 x5 x3` (unlist REWRITE_TAC); + BY(MESON_TAC[sol_x_sym;sol_x_sym2]); + REPEAT (GMATCH_SIMP_TAC sol_x_sol_euler_x); + ASM_REWRITE_TAC[]; + REWRITE_TAC[ CONJ_ASSOC]; + MATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`); + CONJ_TAC; + REWRITE_TAC[arith `x * ( y + z) = x * y + x* z`]; + MATCH_MP_TAC (arith ` (a = a' /\ b = c' /\ c = b' /\ d = d')==>(a + b + c + d = a' + b' + c' + d')`); + REPEAT (GMATCH_SIMP_TAC sol_x_sol_x_sqrtdelta); + ASM_REWRITE_TAC[]; + REWRITE_TAC[GSYM CONJ_ASSOC]; + BY(REPEAT CONJ_TAC THEN REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC) THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN REWRITE_TAC[Sphere.delta_x;Sphere.eulerA_x] THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[GSYM CONJ_ASSOC] THEN REPEAT CONJ_TAC THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN REWRITE_TAC[Sphere.delta_x;Sphere.ups_x] THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `sqrt x * y * z = y * sqrt x * z`]; + AP_TERM_TAC; + SUBGOAL_THEN `dih_x x5 x1 x6 x2 x4 x3 = dih_x x5 x3 x4 x2 x6 x1` SUBST1_TAC; + BY(MESON_TAC[Nonlinear_lemma.dih_x_sym;Nonlinear_lemma.dih_x_sym2]); + REWRITE_TAC[arith `a * (b + c) = a* b + a*c`]; + MATCH_MP_TAC (arith `a = a' /\ b = b' /\ c = c' /\ d = d' ==> a + b + c +d = a' + b' + c' + d'`); + REWRITE_TAC[arith `sqrt x * y * z = y * sqrt x * z`]; + REPEAT (GMATCH_SIMP_TAC (dih_x_dih_x_div_sqrtdelta_posbranch)); + ASM_REWRITE_TAC[]; + BY(REPEAT CONJ_TAC THEN REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC) THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN REWRITE_TAC[Sphere.delta_x] THEN TRY REAL_ARITH_TAC) + ]);; + (* }}} *) + +let gamma4fgcy_sym12 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6 f. gamma4fgcy y1 y2 y3 y4 y5 y6 f = gamma4fgcy y2 y1 y3 y5 y4 y6 f`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.gamma4fgcy;Sphere.gamma4f;Sphere.vol_y;Sphere.vol4f]; + REPEAT WEAK_STRIP_TAC; + BINOP_TAC; + REWRITE_TAC[Sphere.y_of_x;Sphere.vol_x]; + REPLICATE_TAC 3 (AP_TERM_TAC ORELSE AP_THM_TAC); + REWRITE_TAC[Sphere.delta_x]; + BY(REAL_ARITH_TAC); + BINOP_TAC; + AP_TERM_TAC; + MATCH_MP_TAC (arith `a = a' /\ b = d' /\ c = c' /\ d = b' ==> a+b+c+d = a'+b' + c' + d'`); + REWRITE_TAC[sol_x_sol_y;Sphere.y_of_x]; + BY(MESON_TAC[sol_x_sym;sol_x_sym2]); + AP_TERM_TAC; + MATCH_MP_TAC (arith `a = b' /\ b = a' /\ c = c' /\ d = e' /\ e = d' /\ f = f' ==> (a+b+c+d+e+f = a'+b'+c'+d'+e'+f')`); + REWRITE_TAC[Sphere.dih_y]; + REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF]; + BY(ASM_MESON_TAC[Nonlinear_lemma.dih_x_sym;Nonlinear_lemma.dih_x_sym2]) + ]);; + (* }}} *) + +let gamma4fgcy_sym23 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6 f. gamma4fgcy y1 y2 y3 y4 y5 y6 f = gamma4fgcy y1 y3 y2 y4 y6 y5 f`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.gamma4fgcy;Sphere.gamma4f;Sphere.vol_y;Sphere.vol4f]; + REPEAT WEAK_STRIP_TAC; + BINOP_TAC; + REWRITE_TAC[Sphere.y_of_x;Sphere.vol_x]; + REPLICATE_TAC 3 (AP_TERM_TAC ORELSE AP_THM_TAC); + REWRITE_TAC[Sphere.delta_x]; + BY(BY(REAL_ARITH_TAC)); + BINOP_TAC; + AP_TERM_TAC; + MATCH_MP_TAC (arith `a = a' /\ b = b' /\ c = d' /\ d = c' ==> a+b+c+d = a'+b' + c' + d'`); + REWRITE_TAC[sol_x_sol_y;Sphere.y_of_x]; + BY(BY(MESON_TAC[sol_x_sym;sol_x_sym2])); + AP_TERM_TAC; + MATCH_MP_TAC (arith `a = a' /\ b = c' /\ c = b' /\ d = d' /\ e = f' /\ f = e' ==> (a+b+c+d+e+f = a'+b'+c'+d'+e'+f')`); + REWRITE_TAC[Sphere.dih_y]; + REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF]; + BY(BY(ASM_MESON_TAC[Nonlinear_lemma.dih_x_sym;Nonlinear_lemma.dih_x_sym2])) + ]);; + (* }}} *) + +let gamma4fgcy_sym03 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6 f. gamma4fgcy y1 y2 y3 y4 y5 y6 f = gamma4fgcy y5 y4 y3 y2 y1 y6 f`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.gamma4fgcy;Sphere.gamma4f;Sphere.vol_y;Sphere.vol4f]; + REPEAT WEAK_STRIP_TAC; + BINOP_TAC; + REWRITE_TAC[Sphere.y_of_x;Sphere.vol_x]; + REPLICATE_TAC 3 (AP_TERM_TAC ORELSE AP_THM_TAC); + REWRITE_TAC[Sphere.delta_x]; + BY(BY(BY(REAL_ARITH_TAC))); + BINOP_TAC; + AP_TERM_TAC; + MATCH_MP_TAC (arith `a = c' /\ b = b' /\ c = a' /\ d = d' ==> a+b+c+d = a'+b' + c' + d'`); + REWRITE_TAC[sol_x_sol_y;Sphere.y_of_x]; + BY(BY(BY(MESON_TAC[sol_x_sym;sol_x_sym2]))); + AP_TERM_TAC; + MATCH_MP_TAC (arith `a = e' /\ b = d' /\ c = c' /\ d = b' /\ e = a' /\ f = f' ==> (a+b+c+d+e+f = a'+b'+c'+d'+e'+f')`); + REWRITE_TAC[Sphere.dih_y]; + REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF]; + BY(BY(BY(ASM_MESON_TAC[Nonlinear_lemma.dih_x_sym;Nonlinear_lemma.dih_x_sym2]))) + ]);; + (* }}} *) + +(* +let rho_ij'_rho_x = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. rho_ij' x1 x2 x3 x6 x5 x4 = rho_x x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.rho_x;Collect_geom.rho_ij']; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) +*) + +let delta_delta_x = prove_by_refinement( + `delta x1 x2 x3 x6 x5 x4 = delta_x x1 x2 x3 x4 x5 x6 `, + (* {{{ proof *) + [ + REWRITE_TAC[Collect_geom.delta;Sphere.delta_x]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let GDRQXLGv2 = prove_by_refinement( + `!(v0:real^3) v1 v2 v3. let s = {v0, v1, v2, v3} in + let x1 = dist (v0,v1) pow 2 in + let x2 = dist (v0,v2) pow 2 in + let x3 = dist (v0,v3) pow 2 in + let x4 = dist (v2,v3) pow 2 in + let x5 = dist (v1,v3) pow 2 in + let x6 = dist (v1,v2) pow 2 in + CARD s = 4 /\ ~coplanar_alt s + ==> (radV s) pow 2 = rad2_x x1 x2 x3 x4 x5 x6 `, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF;Sphere.rad2_x]; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `&0 <= rho_x (dist ((v0:real^3),(v1:real^3)) pow 2) (dist (v0,(v2:real^3)) pow 2) (dist (v0,(v3:real^3)) pow 2) (dist (v2,v3) pow 2) (dist (v1,v3) pow 2) (dist (v1,v2) pow 2)` ASSUME_TAC; + REWRITE_TAC[GSYM Collect_geom.rho_ij'_rho_x]; + MATCH_MP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] Collect_geom2.SHOGYBS); + BY(ASM_REWRITE_TAC[]); + SUBGOAL_THEN `&0 < delta_x (dist ((v0:real^3),(v1:real^3)) pow 2) (dist (v0,(v2:real^3)) pow 2) (dist (v0,(v3:real^3)) pow 2) (dist (v2,v3) pow 2) (dist (v1,v3) pow 2) (dist (v1,v2) pow 2)` ASSUME_TAC; + REWRITE_TAC[GSYM delta_delta_x]; + BY(ASM_REWRITE_TAC[ Collect_geom2.POS_EQ_NOT_COPLANANR]); + GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] Collect_geom2.GDRQXLG); + ASM_REWRITE_TAC[]; + REWRITE_TAC[Collect_geom.rho_ij'_rho_x;delta_delta_x]; + ABBREV_TAC `r = rho_x (dist ((v0:real^3),(v1:real^3)) pow 2) (dist (v0,(v2:real^3)) pow 2) (dist (v0,(v3:real^3)) pow 2) (dist (v2,v3) pow 2) (dist (v1,v3) pow 2) (dist (v1,v2) pow 2)`; + ABBREV_TAC `d = delta_x (dist ((v0:real^3),(v1:real^3)) pow 2) (dist (v0,(v2:real^3)) pow 2) (dist (v0,(v3:real^3)) pow 2) (dist (v2,v3) pow 2) (dist (v1,v3) pow 2) (dist (v1,v2) pow 2)`; + REWRITE_TAC[Trigonometry2.DIV_POW2]; + CALC_ID_TAC; + REWRITE_TAC[GSYM CONJ_ASSOC]; + GMATCH_SIMP_TAC SQRT_EQ_0; + REWRITE_TAC[Trigonometry2.MUL_POW2]; + REPEAT (GMATCH_SIMP_TAC SQRT_POW_2); + REPEAT (FIRST_X_ASSUM MP_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* need to fix order for future compatibility of proofs +let tsk_hyp = + let tsk_nonlinear = map (fun t -> t.ineq) (Ineq.getprefix "TSK") in + end_itlist (curry mk_conj) tsk_nonlinear;; +*) + +let tsk_hyp = + let tsks= ["TSKAJXY-GXSABWC DIV"; "TSKAJXY-IYOUOBF sharp v2"; + "TSKAJXY-IYOUOBF sym"; + "TSKAJXY-RIBCYXU sharp"; "TSKAJXY-RIBCYXU sym"; "TSKAJXY-TADIAMB"; + "TSKAJXY-WKGUESB sym"; "TSKAJXY-XLLIPLS"; "TSKAJXY-delta_x4"; + "TSKAJXY-eulerA"] in + let tsk_nonlinear = map (fun t -> (hd(Ineq.getexact t)).ineq) tsks in + end_itlist (curry mk_conj) tsk_nonlinear;; + +let tsk = + let tsk_concl = Ineq.TSKAJXY_DERIVED.ineq in + mk_imp(tsk_hyp,tsk_concl);; + +let tsk_lemma1 = prove_by_refinement( + (mk_imp(tsk_hyp,`!y1 y2 y3 y4 y5 y6. + ineq [#2.8,y1,sqrt8; + &2,y2,#2.01; + &2,y3,#2.01; + #2.8,y4,sqrt8; + &2,y5,#2.01; + &2,y6,#2.01] + (&0 < delta_y y1 y2 y3 y4 y5 y6 ==> + gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun >= &0)`)), + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `delta_x4` MP_TAC); + REPEAT (FIRST_X_ASSUM_ST `eulerA_x` MP_TAC); + REPEAT (FIRST_X_ASSUM_ST `mm1` MP_TAC); + REPEAT (FIRST_X_ASSUM (fun t -> ALL_TAC)); + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `y1 = sqrt (y1 * y1) /\ y2 = sqrt(y2 * y2) /\ y3 = sqrt(y3 * y3) /\ y4 = sqrt (y4 * y4) /\ y5 = sqrt(y5 *y5) /\ y6 = sqrt(y6 * y6)` (unlist ONCE_REWRITE_TAC); + REPEAT (GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC gamma4fgcy_div_sqrtdelta; + REPEAT (GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx); + REWRITE_TAC[Collect_geom2.REAL_POSSQ]; + REWRITE_TAC[GSYM CONJ_ASSOC]; + REPLICATE_TAC 18 (CONJ_TAC THENL [(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[Sphere.h0] THEN MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC);ALL_TAC]); + REPEAT (GMATCH_SIMP_TAC (REWRITE_RULE[arith `y1 pow 2 = y1 * y1`] ups_x_pos24)); + REPLICATE_TAC 4 (CONJ_TAC THENL [(REPEAT (FIRST_X_ASSUM MP_TAC) THEN MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC);ALL_TAC]); + REPEAT (FIRST_X_ASSUM MP_TAC); + REPLICATE_TAC 3 DISCH_TAC; + REWRITE_TAC[TAUT `(a <= y ==> y <= b ==> c) <=> (a <= y /\ y <= b) ==> c`]; + REWRITE_TAC[GSYM Nonlinear_lemma.ineq_expand6]; + EVERY (map SPEC_TAC [(`y6:real`,`y6:real`);(`y5:real`,`y5:real`);(`y4:real`,`y4:real`);(`y3:real`,`y3:real`);(`y2:real`,`y2:real`);(`y1:real`,`y1:real`)]); + MATCH_MP_TAC Nonlinear_lemma.ineq_square2; + (CONJ_TAC THENL [(REPEAT (FIRST_X_ASSUM MP_TAC) THEN MP_TAC Flyspeck_constants.bounds THEN REAL_ARITH_TAC);ALL_TAC]); + REWRITE_TAC[Sphere.delta_y;Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REPEAT (GMATCH_SIMP_TAC sqrtpow2); + REPLICATE_TAC 6 (CONJ_TAC THENL [(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC);ALL_TAC]); + SUBGOAL_THEN `delta_x4 x3 x1 x2 x6 x4 x5 = delta_x4 x3 x2 x1 x6 x5 x4 /\ delta_x4 x6 x1 x5 x3 x4 x2 = delta_x4 x6 x5 x1 x3 x2 x4` (unlist REWRITE_TAC); + BY(REWRITE_TAC[Sphere.delta_x4] THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `delta_x4` MP_TAC; + REWRITE_TAC[Sphere.ineq]; + DISCH_THEN (REPEAT o (GMATCH_SIMP_TAC)); + ASM_REWRITE_TAC[]; + REPLICATE_TAC 12 (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[REWRITE_RULE[arith `x * x = x pow 2`] Nonlinear_lemma.sqrt8_2]; + REWRITE_TAC[arith `#8.0 = &8 /\ &2 pow 2 = &4`]; + REPLICATE_TAC 12 (DISCH_TAC); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `eulerA_x` MP_TAC; + REWRITE_TAC[Sphere.ineq]; + SUBGOAL_THEN `eulerA_x x5 x3 x4 x2 x6 x1 = eulerA_x x4 x3 x5 x1 x6 x2 /\ eulerA_x x6 x1 x5 x3 x4 x2 = eulerA_x x1 x5 x6 x4 x2 x3` (unlist REWRITE_TAC); + REWRITE_TAC[Sphere.eulerA_x]; + BY(REAL_ARITH_TAC); + DISCH_THEN (REPEAT o (GMATCH_SIMP_TAC)); + ASM_REWRITE_TAC[]; + DISCH_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `a >= b <=> b <= a`]; + MATCH_MP_TAC Real_ext.REAL_PROP_NN_MUL2; + CONJ_TAC; + MATCH_MP_TAC SQRT_POS_LE; + BY((FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `b <= a <=> a >= b`]; + FIRST_X_ASSUM MP_TAC; + MATCH_MP_TAC (arith `(f >= &0 \/ d < &0) ==> (&0 < d ==> f >= &0)`); + FIRST_X_ASSUM_ST `mm1` MP_TAC; + REWRITE_TAC[Sphere.ineq]; + DISCH_THEN (GMATCH_SIMP_TAC); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + + +let specl x = concl o (SPECL x) o ASSUME;; + +(* THIS APPROACH TO PROVING REAL_WLOG_SIMPLEX CRASHES OCAML --- +let real_ty = `:real`;; +let mk_y i = mk_var("y"^string_of_int i,real_ty);; + +let [y1;y2;y3;y4;y5;y6] = map mk_y (1--6);; + +let simplex_orders = + [[y1;y2;y3;y4;y5;y6];[y1;y3;y2;y4;y6;y5];[y1;y5;y6;y4;y2;y3];[y1;y6;y5;y4;y3;y2]; + [y2;y1;y3;y5;y4;y6];[y2;y3;y1;y5;y6;y4];[y2;y4;y6;y5;y1;y3];[y2;y6;y4;y5;y3;y1]; + [y3;y1;y2;y6;y4;y5];[y3;y2;y1;y6;y5;y4];[y3;y4;y5;y6;y1;y2];[y3;y5;y4;y6;y2;y1]; + [y4;y2;y6;y1;y5;y3];[y4;y3;y5;y1;y6;y2];[y4;y5;y3;y1;y2;y6];[y4;y6;y2;y1;y3;y5]; + [y5;y1;y6;y2;y4;y3];[y5;y3;y4;y2;y6;y1];[y5;y4;y3;y2;y1;y6];[y5;y6;y1;y2;y3;y4]; + [y6;y1;y5;y3;y4;y2];[y6;y2;y4;y3;y5;y1];[y6;y4;y2;y3;y1;y5];[y6;y5;y1;y3;y2;y4]];; + +let symtt = + let symt = `!y1 y2 y3 y4 y5 y6. (y6 <= y1) /\ (y5 <= y1) /\ (y4 <= y1) /\ + (y3 <= y1) /\ (y2 <= y1) /\ (y6 <= y2) /\ (y5 <= y2) /\ (y3 <= y2)` in + let cs = map (fun t -> specl t symt) simplex_orders in + end_itlist (curry mk_disj) cs;; + +let SYM_CASES = time REAL_ARITH symtt;; (* THIS IS THE KILLER LINE *) +*) + + + +let (* Packing3 *) REAL_FINITE_MAX_EXISTS = +prove(`!S:real->bool. FINITE S /\ ~(S = {}) ==> ?m. m IN S /\ (!x. x IN S ==> x <= m)`, + MESON_TAC[SUP_FINITE]);; + + +let REAL_WLOG_SIMPLEX_LEMMA = prove_by_refinement( + `!P. (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y2 y1 y3 y5 y4 y6 /\ + P y1 y2 y3 y4 y5 y6 = P y1 y3 y2 y4 y6 y5 /\ + P y1 y2 y3 y4 y5 y6 = P y5 y4 y3 y2 y1 y6) /\ + (!y1 y2 y3 y4 y5 y6. (y6 <= y1) /\ (y5 <= y1) /\ (y4 <= y1) /\ + (y3 <= y1) /\ (y2 <= y1) ==> + P y1 y2 y3 y4 y5 y6) ==> + (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `?a. a IN {y1,y2,y3,y4,y5,y6} /\ (!x. x IN {y1,y2,y3,y4,y5,y6} ==> x <= a)` MP_TAC; + MATCH_MP_TAC REAL_FINITE_MAX_EXISTS; + BY(REWRITE_TAC[ FINITE_INSERT ; FINITE_EMPTY;NOT_INSERT_EMPTY]); + REPEAT WEAK_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `IN` MP_TAC); + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[MESON[] `(!x. x = y1 \/ x = y2 \/ x = y3 \/ x = y4 \/ x = y5 \/ x = y6 ==> x <= a) = (y1 <= a /\ y2 <= a /\ y3 <= a /\ y4 <= a /\ y5 <= a /\ y6 <= a)`]; + BY(DISCH_THEN STRIP_ASSUME_TAC THEN ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let REAL_WLOG_SIMPLEX_SYM = prove_by_refinement( + `!P. (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y2 y1 y3 y5 y4 y6 /\ + P y1 y2 y3 y4 y5 y6 = P y1 y3 y2 y4 y6 y5 /\ + P y1 y2 y3 y4 y5 y6 = P y5 y4 y3 y2 y1 y6) ==> + ((!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y1 y3 y2 y4 y6 y5) /\ + (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y1 y6 y5 y4 y3 y2))`, + (* {{{ proof *) + [ + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let REAL_WLOG_SIMPLEX_LEMMA2 = prove_by_refinement( + `!P (y1:real) (y4:real). + ((!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y1 y3 y2 y4 y6 y5) /\ + (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y1 y6 y5 y4 y3 y2)) + /\ + (! y2 y3 y5 y6. (y3 <= y2) /\ (y5 <= y2) /\ (y6 <= y2) ==> + P y1 y2 y3 y4 y5 y6) ==> + (!y2 y3 y5 y6. P y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `?a. a IN {y2,y3,y5,y6} /\ (!x. x IN {y2,y3,y5,y6} ==> x <= a)` MP_TAC; + MATCH_MP_TAC REAL_FINITE_MAX_EXISTS; + BY(BY(BY(REWRITE_TAC[ FINITE_INSERT ; FINITE_EMPTY;NOT_INSERT_EMPTY]))); + REPEAT WEAK_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `IN` MP_TAC); + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[MESON[] `(!x. x = y1 \/ x = y2 \/ x = y3 \/ x = y4 \/ x = y5 \/ x = y6 ==> x <= a) = (y1 <= a /\ y2 <= a /\ y3 <= a /\ y4 <= a /\ y5 <= a /\ y6 <= a)`]; + BY(BY(BY(DISCH_THEN STRIP_ASSUME_TAC THEN ASM_MESON_TAC[]))) + ]);; + (* }}} *) + +let REAL_WLOG_SIMPLEX = prove_by_refinement( + `!P. (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y2 y1 y3 y5 y4 y6 /\ + P y1 y2 y3 y4 y5 y6 = P y1 y3 y2 y4 y6 y5 /\ + P y1 y2 y3 y4 y5 y6 = P y5 y4 y3 y2 y1 y6) /\ + (!y1 y2 y3 y4 y5 y6. (y6 <= y1) /\ (y5 <= y1) /\ (y4 <= y1) /\ + (y3 <= y1) /\ (y2 <= y1) /\ (y3 <= y2) /\ (y5 <= y2) /\ (y6 <= y2) ==> + P y1 y2 y3 y4 y5 y6) ==> + (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + GEN_TAC; + DISCH_TAC; + MATCH_MP_TAC REAL_WLOG_SIMPLEX_LEMMA; + ASM_REWRITE_TAC[]; + REPEAT GEN_TAC; + SUBGOAL_THEN `(y6 <= y1 /\ y5 <= y1 /\ y4 <= y1 /\ y3 <= y1 /\ y2 <= y1 ==> P y1 y2 y3 y4 y5 y6) = (\y1 y2 y3 y4 y5 y6. y6 <= y1 /\ y5 <= y1 /\ y4 <= y1 /\ y3 <= y1 /\ y2 <= y1 ==> P y1 y2 y3 y4 y5 y6) y1 y2 y3 y4 y5 y6` SUBST1_TAC; + BY(MESON_TAC[]); + EVERY (map SPEC_TAC [(`y6:real`,`y6:real`);(`y5:real`,`y5:real`);(`y3:real`,`y3:real`);(`y2:real`,`y2:real`)]); + ABBREV_TAC `Q = (\y1 y2 y3 y4 y5 y6. y6 <= y1 /\ y5 <= y1 /\ y4 <= y1 /\ y3 <= y1 /\ y2 <= y1 ==> P y1 y2 y3 y4 y5 y6)`; + MATCH_MP_TAC REAL_WLOG_SIMPLEX_LEMMA2; + CONJ_TAC; + REPEAT (FIRST_X_ASSUM MP_TAC); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP REAL_WLOG_SIMPLEX_SYM)); + EXPAND_TAC "Q"; + BY(ASM_MESON_TAC[]); + EXPAND_TAC "Q"; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + + +let rad2_x_sym = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + rad2_x x1 x2 x3 x4 x5 x6 = rad2_x x2 x1 x3 x5 x4 x6 /\ + rad2_x x1 x2 x3 x4 x5 x6 = rad2_x x1 x3 x2 x4 x6 x5 /\ + rad2_x x1 x2 x3 x4 x5 x6 = rad2_x x5 x4 x3 x2 x1 x6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.rad2_x]; + REPEAT WEAK_STRIP_TAC; + BY(REPEAT CONJ_TAC THEN BINOP_TAC THEN REWRITE_TAC[Sphere.rho_x;Sphere.delta_x] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let rad2_y_sym = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + rad2_y x1 x2 x3 x4 x5 x6 = rad2_y x2 x1 x3 x5 x4 x6 /\ + rad2_y x1 x2 x3 x4 x5 x6 = rad2_y x1 x3 x2 x4 x6 x5 /\ + rad2_y x1 x2 x3 x4 x5 x6 = rad2_y x5 x4 x3 x2 x1 x6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.rad2_y;Sphere.y_of_x]; + BY(MESON_TAC[rad2_x_sym]) + ]);; + (* }}} *) + +let delta_x_sym = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + delta_x x1 x2 x3 x4 x5 x6 = delta_x x2 x1 x3 x5 x4 x6 /\ + delta_x x1 x2 x3 x4 x5 x6 = delta_x x1 x3 x2 x4 x6 x5 /\ + delta_x x1 x2 x3 x4 x5 x6 = delta_x x5 x4 x3 x2 x1 x6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_x]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let delta_y_sym = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + delta_y x1 x2 x3 x4 x5 x6 = delta_y x2 x1 x3 x5 x4 x6 /\ + delta_y x1 x2 x3 x4 x5 x6 = delta_y x1 x3 x2 x4 x6 x5 /\ + delta_y x1 x2 x3 x4 x5 x6 = delta_y x5 x4 x3 x2 x1 x6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_y;Sphere.delta_x]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + +let ineq_critical_edge = prove_by_refinement( + `!u v y f. + ~critical_edge_y y /\ + ineq (APPEND u (CONS (&2,y,&2 * hminus) v)) f /\ + ineq (APPEND u (CONS (&2 * hplus,y,sqrt8) v)) f ==> + ineq (APPEND u (CONS (&2,y,sqrt8) v)) f`, + (* {{{ proof *) + [ + REWRITE_TAC[ineq_APPEND;critical_edge_y]; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `&2 <= y /\ y <= sqrt8 ==> y <= &2 * hminus \/ &2 * hplus <= y` ASSUME_TAC; + FIRST_X_ASSUM_ST `~` MP_TAC; + REWRITE_TAC[Sphere.hplus]; + MP_TAC Nonlinear_lemma.hminus_prop; + BY(REAL_ARITH_TAC); + REPEAT (FIRST_X_ASSUM MP_TAC); + BY(ASM_CASES_TAC `&2 <= y` THEN ASM_CASES_TAC `y <= sqrt8` THEN ASM_CASES_TAC `y <= &2 * hminus` THEN ASM_CASES_TAC `&2 * hplus <= y` THEN ASM_REWRITE_TAC[] THEN TRY (ASM_MESON_TAC[])) + ]);; + (* }}} *) + +let ineq_branch_edge = prove_by_refinement( + `!c a b u v y f. + ineq (APPEND u (CONS (a,y,c) v)) f /\ + ineq (APPEND u (CONS (c,y,b) v)) f ==> + ineq (APPEND u (CONS (a,y,b) v)) f`, + (* {{{ proof *) + [ + REWRITE_TAC[ineq_APPEND]; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + ASSUME_TAC (arith `y <= c \/ c <= y`); + REPEAT (FIRST_X_ASSUM MP_TAC); + BY(ASM_CASES_TAC `a <= y` THEN ASM_CASES_TAC `y <= b` THEN ASM_CASES_TAC `y <= c` THEN ASM_CASES_TAC `c <= y` THEN ASM_REWRITE_TAC[] THEN TRY (ASM_MESON_TAC[])) + ]);; + (* }}} *) + +let BRANCH_TAC n c = + CHOP_LIST_TAC n THEN + MATCH_MP_TAC (SPEC c ineq_branch_edge) + THEN REWRITE_TAC[APPEND];; + +let CRIT_TAC n = + CHOP_LIST_TAC n THEN + MATCH_MP_TAC ( ineq_critical_edge) + THEN ASM_REWRITE_TAC[APPEND];; + +let hminus_lt_hplus = prove_by_refinement( + `&2 * hminus < &2 * hplus`, + (* {{{ proof *) + [ + ASM_MESON_TAC[arith `x < h0 /\ h0 < y ==> &2 * x < &2 * y` ; Nonlinear_lemma.hminus_lt_h0;Nonlinear_lemma.h0_lt_hplus;] + ]);; + (* }}} *) + +let y1y2_lt = prove_by_refinement( + `!y1 y2. y1 <= &2 * hminus /\ &2 * hplus <= y2 ==> ~(y2 <= y1)`, + (* {{{ proof *) + [ + MP_TAC hminus_lt_hplus THEN REAL_ARITH_TAC + ]);; + (* }}} *) + +let real_ty = `:real`;; +let mk_y i = mk_var("y"^string_of_int i,real_ty);; +let ys = map mk_y (1--6);; +let [y1;y2;y3;y4;y5;y6] = ys;; + +let TSKAJXY_DERIVED4 = prove_by_refinement( + tsk, + (* {{{ proof *) + [ + REPEAT DISCH_TAC; + MP_TAC tsk_lemma1; + ASM_REWRITE_TAC[]; + DISCH_TAC; + MATCH_MP_TAC REAL_WLOG_SIMPLEX; + REPEAT STRIP_TAC; + REWRITE_TAC[Sphere.ineq]; + BY(MESON_TAC[delta_y_sym;rad2_y_sym;gamma4fgcy_sym12]); + REWRITE_TAC[Sphere.ineq]; + BY(MESON_TAC[delta_y_sym;rad2_y_sym;gamma4fgcy_sym23]); + REWRITE_TAC[Sphere.ineq]; + BY(MESON_TAC[delta_y_sym;rad2_y_sym;gamma4fgcy_sym03]); + REWRITE_TAC[Sphere.ineq]; + REPLICATE_TAC 6 DISCH_TAC; + REPEAT WEAK_STRIP_TAC; + REPLICATE_TAC 6 (FIRST_X_ASSUM_ST `/\` MP_TAC); + REWRITE_TAC[GSYM Nonlinear_lemma.ineq_expand6]; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM (BURY_TAC); + FIRST_X_ASSUM_ST `ineq` (BURY_TAC); + FIRST_X_ASSUM_ST `ineq` MP_TAC; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `rad2_x` MP_TAC; + REWRITE_TAC[GSYM Sphere.rad2_y]; + DISCH_THEN BURY_TAC; + FIRST_X_ASSUM_ST `mm1` (K ALL_TAC); + FIRST_X_ASSUM_ST `~ineq a b` MP_TAC; + REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[arith `#2.0 = &2`]; + REPEAT WEAK_STRIP_TAC; + CRIT_TAC 0; + CONJ_TAC; + CRIT_TAC 1; + ONCE_REWRITE_TAC[ (CONJ_SYM)]; + CONJ_TAC; + REWRITE_TAC[Sphere.ineq]; + BY(ASM_MESON_TAC[y1y2_lt]); + CRIT_TAC 2; + ONCE_REWRITE_TAC[CONJ_SYM]; + CONJ_TAC; + BY(REWRITE_TAC[Sphere.ineq] THEN ASM_MESON_TAC[y1y2_lt]); + CRIT_TAC 4; + ONCE_REWRITE_TAC[CONJ_SYM]; + CONJ_TAC; + BY(REWRITE_TAC[Sphere.ineq] THEN ASM_MESON_TAC[y1y2_lt]); + CRIT_TAC 5; + ONCE_REWRITE_TAC[CONJ_SYM]; + CONJ_TAC; + BY(REWRITE_TAC[Sphere.ineq] THEN ASM_MESON_TAC[y1y2_lt]); + BRANCH_TAC 0 `#2.001`; + ONCE_REWRITE_TAC[CONJ_SYM]; + CONJ_TAC; + FIRST_X_ASSUM_ST `(#2.001,y,t)` (fun t -> MP_TAC (ISPECL ys t)); + ASM_SIMP_TAC[arith `b <= a ==> ~(a < b)`]; + REWRITE_TAC[Sphere.ineq]; + REPEAT (FIRST_X_ASSUM_ST `y <= x` MP_TAC); + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `(&2,y,#2.001)` (fun t -> MP_TAC(ISPECL ys t)); + REWRITE_TAC[Sphere.ineq]; + REPEAT (FIRST_X_ASSUM_ST `y <= x` MP_TAC); + BY(REAL_ARITH_TAC); + CRIT_TAC 1; + ONCE_REWRITE_TAC[CONJ_SYM]; + CONJ_TAC; + REPEAT (FIRST_X_ASSUM_ST `rad2_y` MP_TAC); + REWRITE_TAC[Sphere.ineq]; + DISCH_THEN (fun t -> MP_TAC (ISPECL ys t)); + BY(REAL_ARITH_TAC); + CRIT_TAC 2; + ONCE_REWRITE_TAC[CONJ_SYM]; + CONJ_TAC; + REPEAT (FIRST_X_ASSUM_ST `rad2_y` MP_TAC); + REWRITE_TAC[Sphere.ineq]; + DISCH_THEN (fun t -> MP_TAC (ISPECL [y1;y3;y2;y4;y6;y5] t)); + SUBGOAL_THEN `rad2_y y1 y3 y2 y4 y6 y5 = rad2_y y1 y2 y3 y4 y5 y6` SUBST1_TAC; + BY(MESON_TAC[rad2_y_sym]); + REPEAT (FIRST_X_ASSUM_ST `y <= x` MP_TAC); + BY(REAL_ARITH_TAC); + CRIT_TAC 4; + ONCE_REWRITE_TAC[CONJ_SYM]; + CONJ_TAC; + REPEAT (FIRST_X_ASSUM_ST `rad2_y` MP_TAC); + REWRITE_TAC[Sphere.ineq]; + DISCH_THEN (fun t -> MP_TAC (ISPECL [y1;y5;y6;y4;y2;y3] t)); + SUBGOAL_THEN `rad2_y y1 y5 y6 y4 y2 y3 = rad2_y y1 y2 y3 y4 y5 y6` SUBST1_TAC; + BY(MESON_TAC[rad2_y_sym]); + REPEAT (FIRST_X_ASSUM_ST `y <= x` MP_TAC); + BY(REAL_ARITH_TAC); + CRIT_TAC 5; + ONCE_REWRITE_TAC[CONJ_SYM]; + CONJ_TAC; + REPEAT (FIRST_X_ASSUM_ST `rad2_y` MP_TAC); + REWRITE_TAC[Sphere.ineq]; + DISCH_THEN (fun t -> MP_TAC (ISPECL [y1;y6;y5;y4;y3;y2] t)); + SUBGOAL_THEN `rad2_y y1 y6 y5 y4 y3 y2 = rad2_y y1 y2 y3 y4 y5 y6` SUBST1_TAC; + BY(MESON_TAC[rad2_y_sym]); + REPEAT (FIRST_X_ASSUM_ST `y <= x` MP_TAC); + BY(REAL_ARITH_TAC); + CRIT_TAC 3; + FIRST_X_ASSUM_ST `ineq (CONS (&2,y,#2.001) v) u` (K ALL_TAC); + FIRST_X_ASSUM_ST `ineq (CONS (#2.001,y1,&2*hminus) v) u` (K ALL_TAC); + CONJ_TAC; + BRANCH_TAC 1 `#2.001`; + ONCE_REWRITE_TAC[CONJ_SYM]; + CONJ_TAC; + FIRST_X_ASSUM_ST `#2.001` (fun t -> MP_TAC ( ISPECL ys t)); + BY(ASM_SIMP_TAC[arith `b <= a ==> ~(a < b)`]); + FIRST_X_ASSUM_ST `(a,b,#2.001)` (MP_TAC o (ISPECL ys)); + REWRITE_TAC[Sphere.ineq]; + REPEAT (FIRST_X_ASSUM_ST `y <= x` MP_TAC); + BY(REAL_ARITH_TAC); + REPEAT (FIRST_X_ASSUM_ST `#2.001` (K ALL_TAC)); + BRANCH_TAC 1 `#2.01`; + ONCE_REWRITE_TAC[CONJ_SYM]; + CONJ_TAC; + FIRST_X_ASSUM_ST `(#2.01,a,b)` (MP_TAC o (ISPECL ys)); + ASM_SIMP_TAC[arith `b <= a ==> ~(a < b)`]; + REWRITE_TAC[Sphere.ineq]; + BY(REAL_ARITH_TAC); + BRANCH_TAC 3 `#2.8`; + CONJ_TAC; + FIRST_X_ASSUM_ST `(a,b,#2.8)` (MP_TAC o (ISPECL ys)); + REWRITE_TAC[Sphere.ineq]; + REPEAT (FIRST_X_ASSUM_ST `y <= x` MP_TAC); + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `(#2.8,a,b)` (MP_TAC o (ISPECL ys)); + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `y <= x` MP_TAC); + REWRITE_TAC[Sphere.ineq]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* ========================================================================== *) +(* Merge "ZTGIJCF4" inequalities. The main result is ztg4. *) +(* ========================================================================== *) + +let REAL_FINITE_MIN_EXISTS = +prove(`!S:real->bool. FINITE S /\ ~(S = {}) ==> ?m. m IN S /\ (!x. x IN S ==> m <= x)`, + MESON_TAC[INF_FINITE]);; + + +let REAL_WLOG_SIMPLEX_LEMMA2_LE = prove_by_refinement( + `!P . + ((!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y1 y3 y2 y4 y6 y5) /\ + (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6 = P y1 y6 y5 y4 y3 y2)) + /\ + (!y1 y2 y3 y4 y5 y6. (y2 <= y3) /\ (y2 <= y5 ) /\ (y2 <= y6 ) ==> + P y1 y2 y3 y4 y5 y6) ==> + (!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `?a. a IN {y2,y3,y5,y6} /\ (!x. x IN {y2,y3,y5,y6} ==> a <= x)` MP_TAC; + MATCH_MP_TAC REAL_FINITE_MIN_EXISTS; + BY(BY(BY(REWRITE_TAC[ FINITE_INSERT ; FINITE_EMPTY;NOT_INSERT_EMPTY]))); + REPEAT WEAK_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `IN` MP_TAC); + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[MESON[] `(!x. x = y1 \/ x = y2 \/ x = y3 \/ x = y4 \/ x = y5 \/ x = y6 ==> a <= x) = (a <= y1 /\ a <= y2 /\ a <= y3 /\ a <= y4 /\ a <= y5 /\ a <= y6)`]; + BY(BY(BY(DISCH_THEN STRIP_ASSUME_TAC THEN ASM_MESON_TAC[]))) + ]);; + (* }}} *) + +let beta_ub = prove_by_refinement( + `!h. bump h <= #0.005`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.bump]; + GEN_TAC; + REWRITE_TAC[arith `a * (&1 - c) <= a <=> &0 <= a * c`]; + MATCH_MP_TAC Real_ext.REAL_PROP_NN_MUL2; + REWRITE_TAC[Calc_derivative.invert_den_le]; + GMATCH_SIMP_TAC Real_ext.REAL_PROP_NN_MUL2; + REWRITE_TAC[REAL_LE_POW_2]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let beta_lb = prove_by_refinement( + `!h. hminus <= h /\ h <= hplus ==> &0 <= bump h`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.bump]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC Real_ext.REAL_PROP_NN_MUL2; + CONJ_TAC; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC (arith `x <= y ==> &0 <= y - x`); + REWRITE_TAC[GSYM Trigonometry2.DIV_POW2]; + REWRITE_TAC[ABS_SQUARE_LE_1;Sphere.h0]; + REPEAT( FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[Sphere.hplus]; + MP_TAC Nonlinear_lemma.hminus_prop; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* +let beta_bump_y_lb = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + -- #0.005 <= beta_bump_y y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.beta_bump_y]; + REPEAT WEAK_STRIP_TAC; + ASM_CASES_TAC `critical_edge_y y6` THEN ASM_CASES_TAC `critical_edge_y y4` THEN ASM_REWRITE_TAC[arith `&0 * x = &0 /\ x * &0 = &0`;arith `-- #0.005 <= &0`]; + ASM_CASES_TAC `critical_edge_y y2` THEN ASM_CASES_TAC `critical_edge_y y3` THEN ASM_REWRITE_TAC[arith `&0 * x = &0 /\ x * &0 = &0`;arith `-- #0.005 <= &0`]; + ASM_CASES_TAC `critical_edge_y y5` THEN ASM_CASES_TAC `critical_edge_y y1` THEN ASM_REWRITE_TAC[arith `&0 * x = &0 /\ x * &0 = &0`;arith `-- #0.005 <= &0`]; + REWRITE_TAC[arith `&1 * x = x`]; + MATCH_MP_TAC (arith `&0 <= x /\ y <= #0.005 ==> -- #0.005 <= x - y`); + GMATCH_SIMP_TAC beta_lb; + REWRITE_TAC[beta_ub]; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Sphere.critical_edge_y]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) +*) + +let beta_sub = prove_by_refinement( + `!y1 y4. critical_edge_y y1 /\ critical_edge_y y4 ==> -- #0.005 <= bump (y1 / &2) - bump( y4 / &2)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.critical_edge_y]; + REPEAT WEAK_STRIP_TAC; + ENOUGH_TO_SHOW_TAC `&0 <= bump (y1 / &2) /\ bump (y4 / &2) <= #0.005`; + BY(REAL_ARITH_TAC); + CONJ_TAC; + MATCH_MP_TAC beta_lb; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[beta_ub]) + ]);; + (* }}} *) + + +let beta_bumpA_y_lb = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + -- #0.005 <= beta_bumpA_y y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.beta_bumpA_y]; + REPEAT WEAK_STRIP_TAC; + REPEAT (COND_CASES_TAC) THEN (TRY (REAL_ARITH_TAC)); + REWRITE_TAC[arith `&1 * x = x`]; + MATCH_MP_TAC beta_sub; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + + +let hmin22 = prove_by_refinement( + `&2 <= &2 * hminus`, + (* {{{ proof *) + [ + MP_TAC Nonlinear_lemma.hminus_gt THEN REAL_ARITH_TAC + ]);; + (* }}} *) + + +let ineq_branch_2hmin = prove_by_refinement( + `! a b u v y f. + (a <= &2 * hminus) /\ + ((~critical_edge_y y) ==> ineq (APPEND u (CONS (a,y, &2 * hminus) v)) f) /\ + ineq (APPEND u (CONS (&2 * hminus,y,b) v)) f ==> + ineq (APPEND u (CONS (a,y,b) v)) f`, + (* {{{ proof *) + [ + REWRITE_TAC[ineq_APPEND;Sphere.critical_edge_y]; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + DISJ_CASES_TAC (arith `y < &2 * hminus \/ &2 * hminus <= y`); + FIRST_X_ASSUM_ST `hplus` MP_TAC; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + SUBGOAL_THEN `y <= &2 * hminus` ASSUME_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REPEAT (FIRST_X_ASSUM_ST `ineq` MP_TAC); + BY((ASM_CASES_TAC `a <= y` THEN ASM_CASES_TAC `y <= b` THEN ASM_REWRITE_TAC[] THEN TRY (ASM_MESON_TAC[]))); + REPEAT (FIRST_X_ASSUM_ST `ineq` MP_TAC); + (ASM_CASES_TAC `a <= y` THEN ASM_CASES_TAC `y <= b` THEN ASM_REWRITE_TAC[] THEN TRY (ASM_MESON_TAC[])); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let ineq_T = prove_by_refinement( + `!a. ineq a T`, + (* {{{ proof *) + [LIST_INDUCT_TAC; + BY(REWRITE_TAC[Sphere.ineq]); + SUBGOAL_THEN `?(a:real) (x:real) (b:real). h = (a,x,b)` MP_TAC; + BY(BY(MESON_TAC[PAIR_SURJECTIVE])); + WEAK_STRIP_TAC; + BY(ASM_REWRITE_TAC[Sphere.ineq]) + ]);; + (* }}} *) + +let ineq_MP = prove_by_refinement( + `! b c a. ineq a (b==>c) ==> ineq a b ==> ineq a c`, + (* {{{ proof *) + [ + REPLICATE_TAC 2 GEN_TAC; + LIST_INDUCT_TAC; + BY(REWRITE_TAC[Sphere.ineq]); + SUBGOAL_THEN `?(a:real) (x:real) (b:real). h = (a,x,b)` MP_TAC; + BY(BY(BY(MESON_TAC[PAIR_SURJECTIVE]))); + WEAK_STRIP_TAC; + (ASM_REWRITE_TAC[Sphere.ineq]); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let ineq_CONJ = prove_by_refinement( + `!b c a. ineq a b /\ ineq a c ==> ineq a (b /\ c)`, + (* {{{ proof *) + [ + REPLICATE_TAC 2 GEN_TAC; + LIST_INDUCT_TAC; + BY(BY(REWRITE_TAC[Sphere.ineq])); + SUBGOAL_THEN `?(a:real) (x:real) (b:real). h = (a,x,b)` MP_TAC; + BY(BY(BY(BY(MESON_TAC[PAIR_SURJECTIVE])))); + WEAK_STRIP_TAC; + (ASM_REWRITE_TAC[Sphere.ineq]); + BY(BY(ASM_MESON_TAC[])) + ]);; + (* }}} *) + + +let ineq_af = prove_by_refinement( + `!f a. f ==> ineq a f`, + (* {{{ proof *) + [ + GEN_TAC; + LIST_INDUCT_TAC; + BY(BY(REWRITE_TAC[Sphere.ineq])); + SUBGOAL_THEN `?(a:real) (x:real) (b:real). h = (a,x,b)` MP_TAC; + BY(BY(BY(BY(MESON_TAC[PAIR_SURJECTIVE])))); + WEAK_STRIP_TAC; + (ASM_REWRITE_TAC[Sphere.ineq]); + BY(BY(ASM_MESON_TAC[])) + ]);; + (* }}} *) + + +let ineq_monotone = prove_by_refinement( + `! f f' a. (f ==> f') ==> (ineq a f ==> ineq a f')`, + (* {{{ proof *) + [ + GEN_TAC; + GEN_TAC; + LIST_INDUCT_TAC; + BY(REWRITE_TAC[Sphere.ineq]); + REWRITE_TAC[Sphere.ineq]; + SUBGOAL_THEN `?(a:real) (x:real) (b:real). h = (a,x,b)` MP_TAC; + BY(MESON_TAC[PAIR_SURJECTIVE]); + WEAK_STRIP_TAC; + ASM_REWRITE_TAC[Sphere.ineq]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + + +(* +let ineq_approx_ztg4 = prove_by_refinement( + `!w' m a y1 y2 y3 y4 y5 y6. + gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &w' <= + gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun/ &(wtcount6_y y1 y2 y3 y4 y5 y6) /\ + &m * beta_bump_lb <= beta_bump_y y1 y2 y3 y4 y5 y6 /\ + ineq a ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &w' + &m * beta_bump_lb > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6) \/ + ( + (y_of_x rad2_x y1 y2 y3 y4 y5 y6 > &2))) ==> + ineq a ( (rad2_y y1 y2 y3 y4 y5 y6 < &2) ==> + (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / + &(wtcount6_y y1 y2 y3 y4 y5 y6) + + beta_bump_y y1 y2 y3 y4 y5 y6 > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + MATCH_MP_TAC ineq_monotone; + REWRITE_TAC[GSYM Sphere.rad2_y]; + MATCH_MP_TAC (TAUT `(b ==> a ==> c) ==> (a ==> b ==> c)`); + DISCH_TAC; + ASM_SIMP_TAC[ (arith `x < &2 ==> ~(x > &2)`)]; + MATCH_MP_TAC (arith `a' <= a /\ b' <= b ==> (a'+b' > c ==> a + b > c)`); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) +*) + +(* +let ineq_approx_ztg4 = prove_by_refinement( + `!w' m a y1 y2 y3 y4 y5 y6. + ineq a (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &w' <= + gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun/ &(wtcount6_y y1 y2 y3 y4 y5 y6) /\ + &m * beta_bump_lb <= beta_bump_y y1 y2 y3 y4 y5 y6 /\ + rad2_y y1 y2 y3 y4 y5 y6 < &2) + ==> + (ineq a ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &w' + &m * beta_bump_lb > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6) \/ + rad2_y y1 y2 y3 y4 y5 y6 > &2 ) ==> + ineq a ( + (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / + &(wtcount6_y y1 y2 y3 y4 y5 y6) + + beta_bump_y y1 y2 y3 y4 y5 y6 > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6)))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + DISCH_TAC; + MATCH_MP_TAC ineq_MP; + FIRST_X_ASSUM MP_TAC; + MATCH_MP_TAC ineq_MP; + ASM_SIMP_TAC[arith `x < &2 ==> ~(x > &2)`]; + MATCH_MP_TAC ineq_af; + DISCH_TAC; + MATCH_MP_TAC (arith `a' <= a /\ b' <= b ==> (a'+b' > c ==> a + b > c)`); + BY(BY(BY(ASM_REWRITE_TAC[]))) + ]);; + (* }}} *) +*) + +let ineq_approxA_ztg4 = prove_by_refinement( + `!w' m a y1 y2 y3 y4 y5 y6. + ineq a (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &w' <= + gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun/ &(wtcount6_y y1 y2 y3 y4 y5 y6) /\ + &m * beta_bump_lb <= beta_bumpA_y y1 y2 y3 y4 y5 y6 /\ + rad2_y y1 y2 y3 y4 y5 y6 < &2) + ==> + (ineq a ((gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &w' + &m * beta_bump_lb > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6) \/ + rad2_y y1 y2 y3 y4 y5 y6 > &2 ) ==> + ineq a ( + (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / + &(wtcount6_y y1 y2 y3 y4 y5 y6) + + beta_bumpA_y y1 y2 y3 y4 y5 y6 > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6)))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + DISCH_TAC; + MATCH_MP_TAC ineq_MP; + FIRST_X_ASSUM MP_TAC; + MATCH_MP_TAC ineq_MP; + ASM_SIMP_TAC[arith `x < &2 ==> ~(x > &2)`]; + MATCH_MP_TAC ineq_af; + DISCH_TAC; + MATCH_MP_TAC (arith `a' <= a /\ b' <= b ==> (a'+b' > c ==> a + b > c)`); + BY(BY(BY(ASM_REWRITE_TAC[]))) + ]);; + (* }}} *) + + +(* +let beta_bump_lb1 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. &1 * beta_bump_lb <= beta_bump_y y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[beta_bump_y_lb;Sphere.beta_bump_lb;arith `&1 * x = x`]) + ]);; + (* }}} *) +*) + +let beta_bumpA_lb1 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. &1 * beta_bump_lb <= beta_bumpA_y y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[beta_bumpA_y_lb;Sphere.beta_bump_lb;arith `&1 * x = x`]) + ]);; + (* }}} *) + +(* +let beta_bump_lb0 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + (~critical_edge_y y1 \/ critical_edge_y y2 \/ critical_edge_y y3 \/ critical_edge_y y5 \/ critical_edge_y y6 \/ ~critical_edge_y y4) + ==> &0 * beta_bump_lb <= beta_bump_y y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.beta_bump_y;arith `&0 * x = &0`]; + REPEAT GEN_TAC; + DISCH_TAC; + ASM_CASES_TAC `critical_edge_y y6` THEN ASM_CASES_TAC `critical_edge_y y4` THEN ASM_REWRITE_TAC[arith `&0 * x = &0 /\ x * &0 = &0`;arith `&0 <= &0`]; + ASM_CASES_TAC `critical_edge_y y2` THEN ASM_CASES_TAC `critical_edge_y y3` THEN ASM_REWRITE_TAC[arith `&0 * x = &0 /\ x * &0 = &0`;arith `&0 <= &0`]; + ASM_CASES_TAC `critical_edge_y y5` THEN ASM_CASES_TAC `critical_edge_y y1` THEN ASM_REWRITE_TAC[arith `&0 * x = &0 /\ x * &0 = &0`;arith `&0 <= &0`]; + FIRST_X_ASSUM_ST `\/` MP_TAC; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) +*) + +let beta_bumpA_lb0 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + (~critical_edge_y y1 \/ critical_edge_y y2 \/ critical_edge_y y3 \/ critical_edge_y y5 \/ critical_edge_y y6 \/ ~critical_edge_y y4) + ==> &0 * beta_bump_lb <= beta_bumpA_y y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.beta_bumpA_y;arith `&0 * x = &0`]; + REPEAT GEN_TAC; + SUBGOAL_THEN `!y. critical_edge_y y ==> ~(y < &2 * hminus)` MP_TAC; + REWRITE_TAC[Sphere.critical_edge_y]; + BY(REAL_ARITH_TAC); + DISCH_TAC; + DISCH_TAC; + ASM_CASES_TAC `critical_edge_y y6` THEN ASM_CASES_TAC `critical_edge_y y4` THEN ASM_SIMP_TAC[arith `&0 * x = &0 /\ x * &0 = &0`;arith `&0 <= &0`]; + ASM_CASES_TAC `critical_edge_y y2` THEN ASM_CASES_TAC `critical_edge_y y3` THEN ASM_SIMP_TAC[arith `&0 * x = &0 /\ x * &0 = &0`;arith `&0 <= &0`]; + ASM_CASES_TAC `critical_edge_y y5` THEN ASM_CASES_TAC `critical_edge_y y1` THEN ASM_SIMP_TAC[arith `&0 * x = &0 /\ x * &0 = &0`;arith `&0 <= &0`]; + FIRST_X_ASSUM_ST `\/` MP_TAC; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + + +let quarter_lemma = prove_by_refinement( + `!x u a. x <= u ==> x <= a pow 2 + u`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + MP_TAC (ISPEC `a:real` REAL_LE_POW_2); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let quarter_lemma2 = prove_by_refinement( + `!x u a. x - a pow 2 <= u ==> x <= a pow 2 + u`, + (* {{{ proof *) + [ + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let quarter_lemma3 = prove_by_refinement( + `!x a . abs(x) <= abs(y) ==> x pow 2 - y pow 2 <= a pow 2`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REWRITE_TAC[REAL_LE_SQUARE_ABS]; + MP_TAC (ISPEC `a:real` REAL_LE_POW_2); + BY(BY(REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let quarter_norm2hh = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. (norm2hh y1 y2 y3 y4 y5 y6 < (hplus- hminus) pow 2) ==> + critical_edge_y y1 /\ (y2 < &2 * hminus) /\ (y3 < &2*hminus) /\ + (y4 < &2 * hminus) /\ (y5 < &2 * hminus) /\ (y6 < &2*hminus)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.critical_edge_y;Sphere.norm2hh]; + REPEAT GEN_TAC; + REWRITE_TAC[GSYM CONJ_ASSOC]; + MATCH_MP_TAC (TAUT `((~b) ==> ~a) ==> (a ==> b)`); + REWRITE_TAC[DE_MORGAN_THM;arith `(~(a < b) <=> (b <= a)) /\ (~(a <= b) <=> (b < a))`]; + REPEAT STRIP_TAC; + MATCH_MP_TAC quarter_lemma2; + REPEAT (MATCH_MP_TAC quarter_lemma); + MATCH_MP_TAC quarter_lemma3; + BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.hplus;] THEN MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC); + MATCH_MP_TAC quarter_lemma2; + REPEAT (MATCH_MP_TAC quarter_lemma); + MATCH_MP_TAC quarter_lemma3; + BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.hplus;] THEN MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC); + MATCH_MP_TAC quarter_lemma; + MATCH_MP_TAC quarter_lemma2; + REPEAT (MATCH_MP_TAC quarter_lemma); + MATCH_MP_TAC quarter_lemma3; + BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.hplus;] THEN MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC); + REPLICATE_TAC 2 (MATCH_MP_TAC quarter_lemma); + MATCH_MP_TAC quarter_lemma2; + REPEAT (MATCH_MP_TAC quarter_lemma); + MATCH_MP_TAC quarter_lemma3; + BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.hplus;] THEN MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC); + REPLICATE_TAC 3 (MATCH_MP_TAC quarter_lemma); + MATCH_MP_TAC quarter_lemma2; + REPEAT (MATCH_MP_TAC quarter_lemma); + MATCH_MP_TAC quarter_lemma3; + BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.hplus;] THEN MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC); + REPLICATE_TAC 4 (MATCH_MP_TAC quarter_lemma); + MATCH_MP_TAC quarter_lemma2; + REPEAT (MATCH_MP_TAC quarter_lemma); + MATCH_MP_TAC quarter_lemma3; + BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.hplus;] THEN MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC); + REPLICATE_TAC 5 (MATCH_MP_TAC quarter_lemma); + ONCE_REWRITE_TAC[arith `x <= y <=> x <= y + &0 pow 2`]; + MATCH_MP_TAC quarter_lemma2; + MATCH_MP_TAC quarter_lemma3; + BY(FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[Sphere.hplus;] THEN MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let gamma_wte = prove_by_refinement( + `!w' y1 y2 y3 y4 y5 y6. + (w' = wtcount6_y y1 y2 y3 y4 y5 y6) ==> + (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun/ &w' <= + gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[REAL_ARITH `x <= x`] + ]);; + (* }}} *) + +let critical_y_range = prove_by_refinement( + `!y. &2 * hminus <= y /\ y <= &2 * hplus ==> critical_edge_y y`, + (* {{{ proof *) + [ + REWRITE_TAC[critical_edge_y] + ]);; + (* }}} *) + + +let gamma_wt = prove_by_refinement( + `!w' y1 y2 y3 y4 y5 y6. + (0 < wtcount6_y y1 y2 y3 y4 y5 y6 /\ + (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun > &0) /\ + wtcount6_y y1 y2 y3 y4 y5 y6 <= w' + ) ==> + gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &w' <= gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun/ &(wtcount6_y y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[arith `a / b <= a /c <=> &0 <= a * (&1/c - &1/b)`]; + MATCH_MP_TAC Real_ext.REAL_PROP_NN_MUL2; + ASM_SIMP_TAC[arith `x > &0 ==> &0 <= x`]; + REWRITE_TAC[arith `&0 <= x - y <=> y <= x`;real_div;arith `&1 * x = x`]; + MATCH_MP_TAC REAL_LE_INV2; + BY(ASM_REWRITE_TAC[REAL_OF_NUM_LT;REAL_OF_NUM_LE]) + ]);; + (* }}} *) + +let critical_edge_bound = prove_by_refinement( + `!y. 0 <= (if critical_edge_y y then 1 else 0) /\ (if critical_edge_y y then 1 else 0) <= 1`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.critical_edge_y]; + MESON_TAC[ARITH_RULE `0 <= 0 /\ 0 <= 1 /\ 1 <= 1`] + ]);; + (* }}} *) + +(* +let ztg4_concl = + Sphere.all_forall `ineq + [&2 * hminus,y1,&2 * hplus; + (&2,y2,sqrt8); + (&2,y3,sqrt8); + (&2,y4,sqrt8); + (&2,y5,sqrt8); + (&2,y6,sqrt8)] + (rad2_y y1 y2 y3 y4 y5 y6 < &2 ==> + (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6) + + beta_bump_y y1 y2 y3 y4 y5 y6 > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6))`;; +*) + + +let ztg4_concl = + Sphere.all_forall `ineq + [&2 * hminus,y1,&2 * hplus; + (&2,y2,sqrt8); + (&2,y3,sqrt8); + (&2,y4,sqrt8); + (&2,y5,sqrt8); + (&2,y6,sqrt8)] + (rad2_y y1 y2 y3 y4 y5 y6 < &2 ==> + (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6) + + beta_bumpA_y y1 y2 y3 y4 y5 y6 > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6))`;; + + +(* need to include beta ge betalb, + Uses gamma >= 0, when not a quarter, so throw that in, and that uses rad *) + +(* +let ztg4_hyp = + let ztgs = + ["GLFVCVK4 2477216213";"MKFKQWU halfwt";"MKFKQWU"; + "ZTGIJCF4 1 1 1 1 1821661595"; "ZTGIJCF4 1 1 1 0 1821661595"; + "ZTGIJCF4 1 1 0 1 1821661595"; "ZTGIJCF4 1 1 0 0 1821661595"; + "ZTGIJCF4 1 0 1 1 1821661595"; "ZTGIJCF4 1 0 1 0 1821661595"; + "ZTGIJCF4 1 0 0 1 1821661595"; "ZTGIJCF4 1 0 0 0 1821661595"; + "ZTGIJCF4 0 1 1 1 1821661595"; "ZTGIJCF4 0 1 1 0 1821661595"; + "ZTGIJCF4 0 1 0 1 1821661595"; "ZTGIJCF4 0 1 0 0 1821661595"; + "ZTGIJCF4 0 0 1 1 1821661595"; "ZTGIJCF4 0 0 1 0 1821661595"; + "ZTGIJCF4 0 0 0 1 1821661595"; "ZTGIJCF4 0 0 0 0 1821661595"] in + let ztg_nonlinear = map (fun t -> (hd(Ineq.getexact t)).ineq) ztgs in + end_itlist (curry mk_conj) ztg_nonlinear;; +*) + +(* +let ztg4_concl' = + mk_imp(ztg4_hyp,ztg4_concl);; +*) + +let ztg4_ineqs = ["GLFVCVK4 2477216213";"MKFKQWU halfwt";"MKFKQWU"; + "ZTGIJCF4 1 1 1 1 1821661595"; "ZTGIJCF4 1 1 1 0 1821661595"; + "ZTGIJCF4 1 1 0 1 1821661595"; "ZTGIJCF4 1 1 0 0 1821661595"; + "ZTGIJCF4 1 0 1 1 1821661595"; "ZTGIJCF4 1 0 1 0 1821661595"; + "ZTGIJCF4 1 0 0 1 1821661595"; "ZTGIJCF4 1 0 0 0 1821661595"; + "ZTGIJCF4 0 1 1 1 1821661595"; "ZTGIJCF4 0 1 1 0 1821661595"; + "ZTGIJCF4 0 1 0 1 1821661595"; "ZTGIJCF4 0 1 0 0 1821661595"; + "ZTGIJCF4 0 0 1 1 1821661595"; "ZTGIJCF4 0 0 1 0 1821661595"; + "ZTGIJCF4 0 0 0 1 1821661595"; "ZTGIJCF4 0 0 0 0 1821661595"];; + +let ztg4_concl' = + add_hyp ztg4_ineqs ztg4_concl;; + +(* let skip_prove_by_refinement(a,b) = ASSUME a;; *) + +let ztg4 = prove_by_refinement( + ztg4_concl', + (* {{{ proof *) + [ + DISCH_TAC; + MATCH_MP_TAC REAL_WLOG_SIMPLEX_LEMMA2_LE; + CONJ_TAC; + CONJ_TAC; + REPEAT GEN_TAC; + SUBGOAL_THEN `rad2_y y1 y3 y2 y4 y6 y5 = rad2_y y1 y2 y3 y4 y5 y6` SUBST1_TAC; + BY(BY(MESON_TAC[rad2_y_sym])); + SUBGOAL_THEN `beta_bumpA_y y1 y3 y2 y4 y6 y5 = beta_bumpA_y y1 y2 y3 y4 y5 y6` SUBST1_TAC; + BY(BY(REWRITE_TAC[Sphere.beta_bumpA_y;REAL_MUL_AC])); + SUBGOAL_THEN `wtcount6_y y1 y3 y2 y4 y6 y5 = wtcount6_y y1 y2 y3 y4 y5 y6` SUBST1_TAC; + REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + BY(BY(REWRITE_TAC[ADD_AC])); + SUBGOAL_THEN `dih_y y1 y3 y2 y4 y6 y5 = dih_y y1 y2 y3 y4 y5 y6` SUBST1_TAC; + REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF]; + BY(BY(ASM_MESON_TAC[Nonlinear_lemma.dih_x_sym;Nonlinear_lemma.dih_x_sym2])); + SUBGOAL_THEN `gamma4fgcy y1 y3 y2 y4 y6 y5 lmfun = gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun` SUBST1_TAC; + BY(BY(MESON_TAC[gamma4fgcy_sym12;gamma4fgcy_sym23;gamma4fgcy_sym03;])); + REWRITE_TAC[Sphere.ineq]; + BY(BY(MESON_TAC[])); + REPEAT GEN_TAC; + SUBGOAL_THEN `rad2_y y1 y6 y5 y4 y3 y2 = rad2_y y1 y2 y3 y4 y5 y6` SUBST1_TAC; + BY(BY(MESON_TAC[rad2_y_sym])); + SUBGOAL_THEN `beta_bumpA_y y1 y6 y5 y4 y3 y2 = beta_bumpA_y y1 y2 y3 y4 y5 y6` SUBST1_TAC; + BY(BY(REWRITE_TAC[Sphere.beta_bumpA_y;REAL_MUL_AC])); + SUBGOAL_THEN `wtcount6_y y1 y6 y5 y4 y3 y2 = wtcount6_y y1 y2 y3 y4 y5 y6` SUBST1_TAC; + REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + BY(BY(REWRITE_TAC[ADD_AC])); + SUBGOAL_THEN `dih_y y1 y6 y5 y4 y3 y2 = dih_y y1 y2 y3 y4 y5 y6` SUBST1_TAC; + REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF]; + BY(BY(ASM_MESON_TAC[Nonlinear_lemma.dih_x_sym;Nonlinear_lemma.dih_x_sym2])); + SUBGOAL_THEN `gamma4fgcy y1 y6 y5 y4 y3 y2 lmfun = gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun` SUBST1_TAC; + BY(BY(MESON_TAC[gamma4fgcy_sym12;gamma4fgcy_sym23;gamma4fgcy_sym03;])); + REWRITE_TAC[Sphere.ineq]; + BY(BY(MESON_TAC[])); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[GSYM Sphere.rad2_y]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.ineq]; + REPEAT DISCH_TAC; + REPEAT (FIRST_X_ASSUM_ST `/\` MP_TAC); + REWRITE_TAC[GSYM Nonlinear_lemma.ineq_expand6]; + REWRITE_TAC[Sphere.ineq]; + REPEAT DISCH_TAC; + SUBGOAL_THEN `critical_edge_y y1` ASSUME_TAC; + BY(ASM_SIMP_TAC[critical_y_range]); + REPLICATE_TAC 6 (FIRST_X_ASSUM_ST `/\` MP_TAC); + REWRITE_TAC[GSYM Nonlinear_lemma.ineq_expand6]; + FIRST_X_ASSUM_ST `gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun > &0` (MP_TAC o (ISPECL ys)); + ASM_REWRITE_TAC[]; + DISCH_TAC; + REWRITE_TAC[Sphere.ineq]; + REPLICATE_TAC 6 (DISCH_THEN (COMBINE_TAC BURY_TAC ASSUME_TAC)); + REPLICATE_TAC 6 (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[GSYM Nonlinear_lemma.ineq_expand6]; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `rad2_y` MP_TAC; + ASM_REWRITE_TAC[Sphere.ineq]; + ASM_SIMP_TAC[arith `x < &2 ==> ~(x > &2)`]; + DISCH_TAC; + SUBGOAL_THEN `(&2*hminus <= y3 \/ &2 * hminus <= y4 \/ &2 * hminus <= y5 \/ &2*hminus <= y6 ==> gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun > &0)` ASSUME_TAC; + FIRST_X_ASSUM MP_TAC; + BY(MESON_TAC[quarter_norm2hh;arith `x <= y <=> ~(y < x)`]); + FIRST_X_ASSUM_ST `~` MP_TAC; + REWRITE_TAC[]; + CHOP_LIST_TAC 1; + MATCH_MP_TAC ineq_branch_2hmin; + REWRITE_TAC[APPEND;hmin22]; + ONCE_REWRITE_TAC[CONJ_SYM]; + CONJ_TAC; + FIRST_X_ASSUM_ST `rad2_y` MP_TAC; + FIRST_X_ASSUM_ST `ineq a (rad2_y y1 y2 y3 y4 y5 y6 > &2)` (fun t -> MP_TAC (ISPECL ys t )); + REPEAT (FIRST_X_ASSUM_ST `a <= b` MP_TAC); + REWRITE_TAC[Sphere.ineq]; + BY(REAL_ARITH_TAC); + DISCH_TAC; + SUBGOAL_THEN `~(rad2_y y1 y2 y3 y4 y5 y6 > &2)` ASSUME_TAC; + FIRST_X_ASSUM_ST `rad2_y` MP_TAC; + BY(REAL_ARITH_TAC); + COMMENT" start on branch with y4 "; + CHOP_LIST_TAC 3; + MATCH_MP_TAC ineq_branch_2hmin; + REWRITE_TAC[hmin22;APPEND]; + ONCE_REWRITE_TAC[CONJ_SYM]; + CONJ_TAC; + REWRITE_TAC[Sphere.ineq]; + REPLICATE_TAC 3 DISCH_TAC; + DISCH_THEN (COMBINE_TAC BURY_TAC ASSUME_TAC); + REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[GSYM Nonlinear_lemma.ineq_expand6]; + SUBGOAL_THEN `(y3 <= &2 * hplus /\ y5 <= &2 * hplus /\ y6 <= &2 * hplus)` MP_TAC THEN REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `ineq a (rad2_y y1 y2 y3 y4 y5 y6 > &2)` BURY_TAC; + CONJ_TAC; + MATCH_MP_TAC (arith `~(x <= y3) ==> (y3 <= x)`); + DISCH_TAC; + FIRST_X_ASSUM_ST `ineq a (rad2_y y1 y2 y3 y4 y5 y6 > &2)` (fun t -> MP_TAC (ISPECL [y1;y3;y2;y4;y6;y5] t)); + REWRITE_TAC[Sphere.ineq]; + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `rad2_y y1 y3 y2 y4 y6 y5 = rad2_y y1 y2 y3 y4 y5 y6` SUBST1_TAC; + BY(MESON_TAC[rad2_y_sym]); + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + MATCH_MP_TAC (arith `~(x <= y3) ==> (y3 <= x)`); + DISCH_TAC; + FIRST_X_ASSUM_ST `ineq a (rad2_y y1 y2 y3 y4 y5 y6 > &2)` (fun t -> MP_TAC (ISPECL [y1;y5;y6;y4;y2;y3] t)); + REWRITE_TAC[Sphere.ineq]; + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `rad2_y y1 y5 y6 y4 y2 y3 = rad2_y y1 y2 y3 y4 y5 y6` SUBST1_TAC; + BY(MESON_TAC[rad2_y_sym]); + BY(ASM_REWRITE_TAC[]); + MATCH_MP_TAC (arith `~(x <= y3) ==> (y3 <= x)`); + DISCH_TAC; + FIRST_X_ASSUM_ST `ineq a (rad2_y y1 y2 y3 y4 y5 y6 > &2)` (fun t -> MP_TAC (ISPECL [y1;y6;y5;y4;y3;y2] t)); + REWRITE_TAC[Sphere.ineq]; + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `rad2_y y1 y6 y5 y4 y3 y2 = rad2_y y1 y2 y3 y4 y5 y6` SUBST1_TAC; + BY(MESON_TAC[rad2_y_sym]); + BY(ASM_REWRITE_TAC[]); + COMMENT "2nd rad ineq here"; + CHOP_LIST_TAC 2 THEN MATCH_MP_TAC ineq_branch_2hmin THEN REWRITE_TAC[hmin22;APPEND] THEN CONJ_TAC THEN TRY DISCH_TAC THEN CHOP_LIST_TAC 4 THEN MATCH_MP_TAC ineq_branch_2hmin THEN REWRITE_TAC[hmin22;APPEND] THEN CONJ_TAC THEN TRY DISCH_TAC THEN CHOP_LIST_TAC 5 THEN MATCH_MP_TAC ineq_branch_2hmin THEN REWRITE_TAC[hmin22;APPEND] THEN CONJ_TAC THEN TRY DISCH_TAC THEN FIRST_X_ASSUM (fun t -> (MP_TAC (SPECL ys t) THEN MATCH_MP_TAC ineq_approxA_ztg4)); + COMMENT " 1st case "; + ASM_REWRITE_TAC[Sphere.ineq;beta_bumpA_lb1]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC gamma_wt; + ASM_SIMP_TAC[]; + ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + MP_TAC (ISPEC `y4:real` critical_edge_bound); + BY(ARITH_TAC); + COMMENT " 2nd case "; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC ineq_CONJ; + CONJ_TAC; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC gamma_wt; + ASM_SIMP_TAC[]; + ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + MP_TAC (ISPEC y4 critical_edge_bound); + MP_TAC (ISPEC y6 critical_edge_bound); + BY(ARITH_TAC); + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC beta_bumpA_lb0; + BY(ASM_SIMP_TAC[critical_y_range]); + COMMENT " 3rd case "; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC ineq_CONJ; + CONJ_TAC; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC gamma_wt; + ASM_SIMP_TAC[]; + ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + MP_TAC (ISPEC y4 critical_edge_bound); + MP_TAC (ISPEC y5 critical_edge_bound); + BY(ARITH_TAC); + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC beta_bumpA_lb0; + BY(ASM_SIMP_TAC[critical_y_range]); + COMMENT " 4th case "; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC ineq_CONJ; + CONJ_TAC; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC gamma_wt; + ASM_SIMP_TAC[]; + ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + MP_TAC (ISPEC y4 critical_edge_bound); + MP_TAC (ISPEC y5 critical_edge_bound); + MP_TAC (ISPEC y6 critical_edge_bound); + BY(ARITH_TAC); + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC beta_bumpA_lb0; + BY(ASM_SIMP_TAC[critical_y_range]); + COMMENT " 5th case "; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC ineq_CONJ; + CONJ_TAC; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC gamma_wt; + ASM_SIMP_TAC[]; + ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + MP_TAC (ISPEC y3 critical_edge_bound); + MP_TAC (ISPEC y4 critical_edge_bound); + BY(ARITH_TAC); + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC beta_bumpA_lb0; + BY(ASM_SIMP_TAC[critical_y_range]); + COMMENT "6th case"; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC ineq_CONJ; + CONJ_TAC; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC gamma_wt; + ASM_SIMP_TAC[]; + ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + MP_TAC (ISPEC y3 critical_edge_bound); + MP_TAC (ISPEC y4 critical_edge_bound); + MP_TAC (ISPEC y6 critical_edge_bound); + BY(ARITH_TAC); + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC beta_bumpA_lb0; + BY(ASM_SIMP_TAC[critical_y_range]); + COMMENT "7th case"; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC ineq_CONJ; + CONJ_TAC; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC gamma_wt; + ASM_SIMP_TAC[]; + ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + MP_TAC (ISPEC y3 critical_edge_bound); + MP_TAC (ISPEC y4 critical_edge_bound); + MP_TAC (ISPEC y5 critical_edge_bound); + BY(ARITH_TAC); + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC beta_bumpA_lb0; + BY(ASM_SIMP_TAC[critical_y_range]); + COMMENT "8th case"; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC ineq_CONJ; + CONJ_TAC; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC gamma_wt; + ASM_SIMP_TAC[]; + ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + MP_TAC (ISPEC y3 critical_edge_bound); + MP_TAC (ISPEC y4 critical_edge_bound); + MP_TAC (ISPEC y5 critical_edge_bound); + MP_TAC (ISPEC y6 critical_edge_bound); + BY(ARITH_TAC); + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC beta_bumpA_lb0; + BY(ASM_SIMP_TAC[critical_y_range]); + DISCH_TAC; + CHOP_LIST_TAC 2 THEN MATCH_MP_TAC ineq_branch_2hmin THEN REWRITE_TAC[hmin22;APPEND] THEN CONJ_TAC THEN TRY DISCH_TAC THEN CHOP_LIST_TAC 4 THEN MATCH_MP_TAC ineq_branch_2hmin THEN REWRITE_TAC[hmin22;APPEND] THEN CONJ_TAC THEN TRY DISCH_TAC THEN CHOP_LIST_TAC 5 THEN MATCH_MP_TAC ineq_branch_2hmin THEN REWRITE_TAC[hmin22;APPEND] THEN CONJ_TAC THEN TRY DISCH_TAC THEN FIRST_X_ASSUM (fun t -> (MP_TAC (SPECL ys t) THEN MATCH_MP_TAC ineq_approxA_ztg4)); + COMMENT "1st' case"; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC ineq_CONJ; + CONJ_TAC; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC gamma_wte; + ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + BY(ARITH_TAC); + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC beta_bumpA_lb0; + BY(ASM_SIMP_TAC[critical_y_range]); + COMMENT "2nd' case"; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC ineq_CONJ; + CONJ_TAC; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC gamma_wt; + ASM_SIMP_TAC[]; + ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + MP_TAC (ISPEC y6 critical_edge_bound); + BY(ARITH_TAC); + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC beta_bumpA_lb0; + BY(ASM_REWRITE_TAC[]); + COMMENT "3rd' case"; + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC ineq_CONJ THEN CONJ_TAC THEN REWRITE_TAC[Sphere.ineq] THEN REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC gamma_wt THEN ASM_SIMP_TAC[] THEN ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + MP_TAC (ISPEC y5 critical_edge_bound); + BY(ARITH_TAC); + BY(MATCH_MP_TAC beta_bumpA_lb0 THEN ASM_REWRITE_TAC[]); + COMMENT "4th' case"; + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC ineq_CONJ THEN CONJ_TAC THEN REWRITE_TAC[Sphere.ineq] THEN REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC gamma_wt THEN ASM_SIMP_TAC[] THEN ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + MP_TAC (ISPEC y5 critical_edge_bound); + MP_TAC (ISPEC y6 critical_edge_bound); + BY(ARITH_TAC); + BY(MATCH_MP_TAC beta_bumpA_lb0 THEN ASM_REWRITE_TAC[]); + COMMENT "5th' case"; + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC ineq_CONJ THEN CONJ_TAC THEN REWRITE_TAC[Sphere.ineq] THEN REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC gamma_wt THEN ASM_SIMP_TAC[] THEN ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + MP_TAC (ISPEC y3 critical_edge_bound); + BY(ARITH_TAC); + BY(MATCH_MP_TAC beta_bumpA_lb0 THEN ASM_REWRITE_TAC[]); + COMMENT "6th' case"; + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC ineq_CONJ THEN CONJ_TAC THEN REWRITE_TAC[Sphere.ineq] THEN REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC gamma_wt THEN ASM_SIMP_TAC[] THEN ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + MP_TAC (ISPEC y3 critical_edge_bound); + MP_TAC (ISPEC y6 critical_edge_bound); + BY(ARITH_TAC); + BY(MATCH_MP_TAC beta_bumpA_lb0 THEN ASM_REWRITE_TAC[]); + COMMENT "7th' case"; + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC ineq_CONJ THEN CONJ_TAC THEN REWRITE_TAC[Sphere.ineq] THEN REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC gamma_wt THEN ASM_SIMP_TAC[] THEN ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + MP_TAC (ISPEC y3 critical_edge_bound); + MP_TAC (ISPEC y5 critical_edge_bound); + BY(ARITH_TAC); + BY(MATCH_MP_TAC beta_bumpA_lb0 THEN ASM_REWRITE_TAC[]); + COMMENT "8th' case"; + ASM_REWRITE_TAC[] THEN MATCH_MP_TAC ineq_CONJ THEN CONJ_TAC THEN REWRITE_TAC[Sphere.ineq] THEN REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC gamma_wt THEN ASM_SIMP_TAC[] THEN ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + MP_TAC (ISPEC y3 critical_edge_bound); + MP_TAC (ISPEC y5 critical_edge_bound); + MP_TAC (ISPEC y6 critical_edge_bound); + BY(ARITH_TAC); + BY(MATCH_MP_TAC beta_bumpA_lb0 THEN ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let ztg4_ALT = prove_by_refinement( + `pack_nonlinear_non_ox3q1h ==> +!y1 y2 y3 y4 y5 y6. + ineq + [&2 * hminus,y1,&2 * hplus; &2,y2,sqrt8; &2,y3,sqrt8; &2,y4,sqrt8; + &2, + y5, + sqrt8; &2,y6,sqrt8] + (rad2_y y1 y2 y3 y4 y5 y6 < &2 + ==> gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / + &(wtcount6_y y1 y2 y3 y4 y5 y6) + + beta_bumpA_y y1 y2 y3 y4 y5 y6 > + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MP_TAC ztg4; + ANTS_TAC; + BY(ASM_REWRITE_TAC (map get_pack_nonlinear_non_ox3q1h ztg4_ineqs)); + BY(DISCH_THEN (unlist REWRITE_TAC)) + ]);; + (* }}} *) + + +(* ========================================================================== *) +(* lindih inequalities *) +(* ========================================================================== *) + +let lindih_lt = prove_by_refinement( + `!u x1 x2 x3 x4 x5 x6. abs u < pi/ & 2 /\ + &0 < x1 /\ + &0 < delta_x4 x1 x2 x3 x4 x5 x6 ==> (dih_x x1 x2 x3 x4 x5 x6 < u <=> + sqrt(&4 * x1 * delta_x x1 x2 x3 x4 x5 x6) < + tan(u) * delta_x4 x1 x2 x3 x4 x5 x6)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.dih_x;LET_DEF;LET_END_DEF]; + GMATCH_SIMP_TAC (MESON[Trigonometry1.ATN2_BREAKDOWN] `y < &0 ==> atn2(x,y) = --(pi/ &2) - atn(x/y)`); + ASM_REWRITE_TAC[arith `-- x < &0 <=> &0 < x`;arith `pi / &2 + -- (pi/ &2) - x = -- x`]; + REWRITE_TAC[real_div;REAL_INV_NEG;arith `x * -- y = --(x * y)`;ATN_NEG;arith `-- (-- x) = x`]; + ABBREV_TAC `t = sqrt (&4 * x1 * delta_x x1 x2 x3 x4 x5 x6) < tan u * delta_x4 x1 x2 x3 x4 x5 x6`; + GMATCH_SIMP_TAC (GSYM TAN_MONO_LT_EQ); + REWRITE_TAC[ATN_TAN;ATN_BOUNDS]; + CONJ_TAC; + FIRST_X_ASSUM_ST `abs` MP_TAC; + BY(REAL_ARITH_TAC); + REWRITE_TAC[GSYM real_div]; + GMATCH_SIMP_TAC REAL_LT_LDIV_EQ; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let lindih_gt = prove_by_refinement( + `!u x1 x2 x3 x4 x5 x6. abs u < pi/ & 2 /\ + &0 < x1 /\ + &0 < delta_x4 x1 x2 x3 x4 x5 x6 ==> (u < dih_x x1 x2 x3 x4 x5 x6 <=> + (tan(u) * delta_x4 x1 x2 x3 x4 x5 x6) < sqrt(&4 * x1 * delta_x x1 x2 x3 x4 x5 x6)) `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.dih_x;LET_DEF;LET_END_DEF]; + GMATCH_SIMP_TAC (MESON[Trigonometry1.ATN2_BREAKDOWN] `y < &0 ==> atn2(x,y) = --(pi/ &2) - atn(x/y)`); + ASM_REWRITE_TAC[arith `-- x < &0 <=> &0 < x`;arith `pi / &2 + -- (pi/ &2) - x = -- x`]; + REWRITE_TAC[real_div;REAL_INV_NEG;arith `x * -- y = --(x * y)`;ATN_NEG;arith `-- (-- x) = x`]; + ABBREV_TAC `t = tan u * delta_x4 x1 x2 x3 x4 x5 x6 < sqrt (&4 * x1 * delta_x x1 x2 x3 x4 x5 x6)`; + GMATCH_SIMP_TAC (GSYM TAN_MONO_LT_EQ); + REWRITE_TAC[ATN_TAN;ATN_BOUNDS]; + CONJ_TAC; + FIRST_X_ASSUM_ST `abs` MP_TAC; + BY(REAL_ARITH_TAC); + REWRITE_TAC[GSYM real_div]; + GMATCH_SIMP_TAC REAL_LT_RDIV_EQ; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let lindihpi_lt = prove_by_refinement( + `!u x1 x2 x3 x4 x5 x6. abs u < pi/ & 2 /\ + &0 < x1 /\ + delta_x4 x1 x2 x3 x4 x5 x6 < &0 ==> (dih_x x1 x2 x3 x4 x5 x6 < pi - u <=> + -- tan(u) * delta_x4 x1 x2 x3 x4 x5 x6 < sqrt(&4 * x1 * delta_x x1 x2 x3 x4 x5 x6) + )`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.dih_x;LET_DEF;LET_END_DEF]; + GMATCH_SIMP_TAC (MESON[Trigonometry1.ATN2_BREAKDOWN] `&0 < y ==> atn2(x,y) = (pi/ &2) - atn(x/y)`); + ASM_REWRITE_TAC[arith `&0 < --x <=> x < &0`;arith `pi / &2 + (pi/ &2) - x = pi - x`]; + ABBREV_TAC `t = --tan u * delta_x4 x1 x2 x3 x4 x5 x6 < sqrt (&4 * x1 * delta_x x1 x2 x3 x4 x5 x6)`; + REWRITE_TAC[arith `pi - t < pi - u <=> u < t`]; + GMATCH_SIMP_TAC (GSYM TAN_MONO_LT_EQ); + REWRITE_TAC[ATN_TAN;ATN_BOUNDS]; + CONJ_TAC; + FIRST_X_ASSUM_ST `abs` MP_TAC; + BY(BY(REAL_ARITH_TAC)); + GMATCH_SIMP_TAC REAL_LT_RDIV_EQ; + ASM_REWRITE_TAC[arith `&0 < --x <=> x < &0`]; + EXPAND_TAC "t"; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let lindihpi_gt = prove_by_refinement( + `!u x1 x2 x3 x4 x5 x6. abs u < pi/ & 2 /\ + &0 < x1 /\ + delta_x4 x1 x2 x3 x4 x5 x6 < &0 ==> ( pi - u < dih_x x1 x2 x3 x4 x5 x6 <=> + (sqrt(&4 * x1 * delta_x x1 x2 x3 x4 x5 x6) < -- tan(u) * delta_x4 x1 x2 x3 x4 x5 x6 + ))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.dih_x;LET_DEF;LET_END_DEF]; + GMATCH_SIMP_TAC (MESON[Trigonometry1.ATN2_BREAKDOWN] `&0 < y ==> atn2(x,y) = (pi/ &2) - atn(x/y)`); + ASM_REWRITE_TAC[arith `&0 < --x <=> x < &0`;arith `pi / &2 + (pi/ &2) - x = pi - x`]; + ABBREV_TAC `t = sqrt (&4 * x1 * delta_x x1 x2 x3 x4 x5 x6) < --tan u * delta_x4 x1 x2 x3 x4 x5 x6`; + REWRITE_TAC[arith `pi - t < pi - u <=> u < t`]; + GMATCH_SIMP_TAC (GSYM TAN_MONO_LT_EQ); + REWRITE_TAC[ATN_TAN;ATN_BOUNDS]; + CONJ_TAC; + FIRST_X_ASSUM_ST `abs` MP_TAC; + BY(BY(BY(REAL_ARITH_TAC))); + GMATCH_SIMP_TAC REAL_LT_LDIV_EQ; + ASM_REWRITE_TAC[arith `&0 < --x <=> x < &0`]; + EXPAND_TAC "t"; + BY(BY(REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let dih_gt_pi2 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. &0 < x1 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 /\ + pi / &2 < dih_x x1 x2 x3 x4 x5 x6 ==> delta_x4 x1 x2 x3 x4 x5 x6 < &0`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.dih_x;LET_DEF;LET_END_DEF]; + REWRITE_TAC[arith `x < x + y <=> &0 < y`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `&0 < sqrt(&4 * x1 * delta_x x1 x2 x3 x4 x5 x6)` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC REAL_LT_RSQRT; + REWRITE_TAC[arith `&0 pow 2 = &0`]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REWRITE_TAC[arith `&0 < &4`]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM_ST `atn2` MP_TAC; + ASM_SIMP_TAC[ATN2_POS]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let lindihpi_lt_y = prove_by_refinement( + `!a y1 y2 y3 y4 y5 y6. + &0 < y1 /\ + &0 < a /\ + &0 < delta_y y1 y2 y3 y4 y5 y6 /\ + delta4_y y1 y2 y3 y4 y5 y6 < &0 ==> + (dih_y y1 y2 y3 y4 y5 y6 < pi - atn a <=> + a pow 2 * delta4_squared_y y1 y2 y3 y4 y5 y6 < &4 * x1_delta_y y1 y2 y3 y4 y5 y6 + )`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_y;Sphere.delta4_y;Sphere.dih_y;LET_DEF;LET_END_DEF;Sphere.delta4_squared_y;Sphere.x1_delta_y;Sphere.y_of_x;Sphere.delta4_squared_x;Sphere.x1_delta_x]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC lindihpi_lt [`atn a`;`y1 * y1`;`y2*y2`;`y3*y3`;`y4*y4`;`y5*y5`;`y6*y6`]; + ASM_REWRITE_TAC[ATN_BOUND]; + ANTS_TAC; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[ATN_TAN]; + DISCH_THEN SUBST1_TAC; + TYPED_ABBREV_TAC `s = (&4 * (y1 * y1) * delta_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6))` ; + TYPIFY `&0 < s` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "s"; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REWRITE_TAC[arith `&0 < &4`]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!d. (d < s <=> d < sqrt s pow 2)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(ASM_SIMP_TAC[SQRT_POW_2;arith `&0 < s ==> &0 <= s`]); + REWRITE_TAC[arith `a pow 2 * d pow 2 = ( a * -- d) pow 2`]; + GMATCH_SIMP_TAC (GSYM Collect_geom2.LT_POW2_EQ_LT); + REWRITE_TAC[arith `-- a * d = a * --d`]; + CONJ2_TAC; + GMATCH_SIMP_TAC REAL_LT_RSQRT; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let lindihpi_gt_y = prove_by_refinement( + `!a y1 y2 y3 y4 y5 y6. + &0 < y1 /\ + &0 < a /\ + &0 < delta_y y1 y2 y3 y4 y5 y6 /\ + delta4_y y1 y2 y3 y4 y5 y6 < &0 ==> + (pi - atn a < dih_y y1 y2 y3 y4 y5 y6 <=> + &4 * x1_delta_y y1 y2 y3 y4 y5 y6 < a pow 2 * delta4_squared_y y1 y2 y3 y4 y5 y6 + )`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_y;Sphere.delta4_y;Sphere.dih_y;LET_DEF;LET_END_DEF;Sphere.delta4_squared_y;Sphere.x1_delta_y;Sphere.y_of_x;Sphere.delta4_squared_x;Sphere.x1_delta_x]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC lindihpi_gt [`atn a`;`y1 * y1`;`y2*y2`;`y3*y3`;`y4*y4`;`y5*y5`;`y6*y6`]; + ASM_REWRITE_TAC[ATN_BOUND]; + ANTS_TAC; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[ATN_TAN]; + DISCH_THEN SUBST1_TAC; + TYPED_ABBREV_TAC `s = (&4 * (y1 * y1) * delta_x (y1 * y1) (y2 * y2) (y3 * y3) (y4 * y4) (y5 * y5) (y6 * y6))` ; + TYPIFY `&0 < s` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "s"; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REWRITE_TAC[arith `&0 < &4`]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!d. (s < d <=> sqrt s pow 2 < d)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(ASM_SIMP_TAC[SQRT_POW_2;arith `&0 < s ==> &0 <= s`]); + REWRITE_TAC[arith `a pow 2 * d pow 2 = ( a * -- d) pow 2`]; + GMATCH_SIMP_TAC (GSYM Collect_geom2.LT_POW2_EQ_LT); + REWRITE_TAC[arith `-- a * d = a * --d`]; + CONJ_TAC; + GMATCH_SIMP_TAC REAL_LT_RSQRT; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + + +(* ========================================================================== *) +(* 3-cell inequality: gamma3f is non-negative. Also 1-cell and 2-cells *) +(* ========================================================================== *) + + +let cell_3_delta_x_eta_x = prove_by_refinement( + `!x4 x5 x6. (&0 < x4) /\ (&0 < x5) /\ (&0 < x6) /\ (&0 < ups_x x4 x5 x6) ==> + ((&0 < delta_x (&2) (&2) (&2) x4 x5 x6) <=> ( eta_x x4 x5 x6 < sqrt2))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[delta_delta_x]; + REWRITE_TAC[GSYM delta_delta_x;Collect_geom.DELTA_RRR_INTERPRETE;Sphere.eta_x]; + REWRITE_TAC[Sphere.sqrt2]; + GMATCH_SIMP_TAC SQRT_MONO_LT_EQ; + GMATCH_SIMP_TAC REAL_LT_LDIV_EQ; + ASM_REWRITE_TAC[ arith `&0 <= &2`]; + CONJ2_TAC; + REWRITE_TAC[Sphere.ups_x]; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC REAL_LE_DIV; + ASM_SIMP_TAC[ arith `&0 < x ==> &0 <= x`]; + MATCH_MP_TAC (arith `&0 < x ==> &0 <= x`); + BY(REPEAT (MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[])) + ]);; + (* }}} *) + +let lmfun_h0cut = prove_by_refinement( + `!y. lmfun (y / &2) = lfun (y / &2) * h0cut y `, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.lmfun;Sphere.lfun;Sphere.h0cut]; + GEN_TAC; + ASSUME_TAC (arith `y <= &2 * h0 <=> (y / &2 <= h0)`); + COND_CASES_TAC; + BY(ASM_SIMP_TAC[arith `x * &1 = x`]); + BY(ASM_MESON_TAC[ arith `x * &0 = &0`]) + ]);; + (* }}} *) + +let ups_x_cell3 = prove_by_refinement( + `!y. &0 < y /\ y < &2 * sqrt(&2) ==> &0 < ups_x (&2) (&2) (y *y)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC [ GSYM Nonlinear_lemma.sqrt2_sqrt2 ]; + MATCH_MP_TAC TRI_UPS_X_STRICT_POS; + REWRITE_TAC[Sphere.sqrt2]; + ASM_SIMP_TAC[arith `x + x = &2* x`;arith `&0 < x ==> &0 <= x`]; + ASM_SIMP_TAC[arith `&0 < x ==> u < x + u /\ u < u + x`]; + GMATCH_SIMP_TAC SQRT_POS_LT; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let UPS_X_POS = prove_by_refinement( + `!y1 y2 y3. &2 <= y1 /\ y1 < &4 /\ &2 <= y2 /\ y2 < &4 /\ + &2 <= y3 /\ y3 < &4 ==> &0 < ups_x (y1*y1) (y2*y2) (y3*y3)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC TRI_UPS_X_STRICT_POS; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let eulerA_x_sym = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + eulerA_x x1 x2 x3 x4 x5 x6 = eulerA_x x2 x3 x1 x5 x6 x4 /\ + eulerA_x x1 x2 x3 x4 x5 x6 = eulerA_x x1 x3 x2 x4 x6 x5 +`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.eulerA_x]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let delta_xrrr_ups_x = prove_by_refinement( + `!x4 x5 x6 r2. &0 < x4 /\ &0 < x5 /\ &0 < x6 /\ &0 < r2 /\ + &0 < delta_x r2 r2 r2 x4 x5 x6 ==> &0 < ups_x x4 x5 x6`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[GSYM delta_delta_x]; + REWRITE_TAC[Collect_geom.DELTA_RRR_INTERPRETE]; + DISCH_TAC; + SUBGOAL_THEN `&0 < r2 * ups_x x4 x5 x6` ASSUME_TAC; + MATCH_MP_TAC (REAL_LT_TRANS); + EXISTS_TAC `x6 * x5 * x4`; + CONJ_TAC; + BY(ASM_MESON_TAC[ REAL_LT_MUL ]); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Sphere.ups_x]; + BY(REAL_ARITH_TAC); + BY(ASM_MESON_TAC[REAL_LT_MUL_EQ]) + ]);; + (* }}} *) + +let eulerA_x_pos = prove_by_refinement( + `!x4 x5 x6. + &4 <= x4 /\ &4 <= x5 /\ x6 <= &16 ==> + &0 < eulerA_x (&2) x4 x5 x6 (&2) (&2)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.eulerA_x;arith `&2 + x - &2 = x`]; + MATCH_MP_TAC (arith `&0 < x /\ &0 <= y ==> &0 < x + y`); + CONJ_TAC; + (MATCH_MP_TAC REAL_LT_MUL); + GMATCH_SIMP_TAC SQRT_POS_LT; + GMATCH_SIMP_TAC REAL_LT_MUL; + GMATCH_SIMP_TAC SQRT_POS_LT; + GMATCH_SIMP_TAC SQRT_POS_LT; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + MATCH_MP_TAC (arith `&0 <= x * y + u * v + a * b ==> &0 <= x * y / &2 + u * v / &2 + a * b / &2`); + (unlist REWRITE_TAC) (REAL_RING `a * (x4 + x5 - x6) + b * x5 + c * x4 = a * (x4 - &4) + a * (x5 - &4) + a * (&16 - x6) - a * &8 + b * (x5 - &4) + c * (x4 - &4) + &4 * (b + c)`); + MATCH_MP_TAC (arith `&0 <= a /\ &0 <= b /\ &0 <= c /\ &0 <= e /\ &0 <= f /\ &0 <= -- d + q ==> &0 <= a + b + c - d + e + f + q`); + SUBGOAL_THEN `&0 <= sqrt (&2)` ASSUME_TAC; + GMATCH_SIMP_TAC SQRT_POS_LE; + BY(REAL_ARITH_TAC); + SUBGOAL_THEN `&0 <= sqrt x4 /\ &0 <= sqrt x5` MP_TAC; + GMATCH_SIMP_TAC SQRT_POS_LE; + GMATCH_SIMP_TAC SQRT_POS_LE; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + REPLICATE_TAC 5 (CONJ_TAC THENL[MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[] THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC;ALL_TAC]); + MATCH_MP_TAC (arith `a <= b /\ a <= c ==> &0 <= -- (a * &8) + &4 * (b + c)`); + GMATCH_SIMP_TAC SQRT_MONO_LE_EQ; + GMATCH_SIMP_TAC SQRT_MONO_LE_EQ; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let delta_x4_2 = prove_by_refinement( + `!x4 x5 x6. delta_x4 x6 (&2) x5 (&2) x4 (&2) = x6 * (x4 + x5 - x6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_x4]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let delta_x4_pos = prove_by_refinement( + `!x4 x5 x6. + &4 <= x4 /\ &4 <= x5 /\ &0 < x6 /\ x6 < &8 ==> + &0 < delta_x4 x6 (&2) x5 (&2) x4 (&2)`, + (* {{{ proof *) + [ + REWRITE_TAC[delta_x4_2]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC REAL_LT_MUL; + REPEAT (FIRST_X_ASSUM MP_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let ups_x_sym = prove(`!a b c. ups_x a b c = ups_x b a c`, + REWRITE_TAC[Sphere.ups_x] THEN REAL_ARITH_TAC);; + + +let gamma3f_gamma3f_x_div_sqrtdelta_WEAK = prove_by_refinement( + `!y4 y5 y6 a b c. + &0 < y4 /\ &0 < y5 /\ &0 < y6 /\ + y4 < &2 * sqrt(&2) /\ y5 < &2 * sqrt(&2) /\ y6 < &2 * sqrt(&2) /\ + &0 < ups_x (y4 * y4) (y5 * y5) (y6 *y6) /\ + &0 < delta_x (&2) (&2) (&2) (y4*y4) (y5*y5) (y6*y6) /\ + &0 < eulerA_x (&2) (y4 *y4) (y5*y5) (y6*y6) (&2) (&2) /\ + &0 < eulerA_x (&2) (y6*y6) (y4 *y4) (y5*y5) (&2) (&2) /\ + &0 < eulerA_x (&2) (y5*y5) (y6*y6) (y4 *y4) (&2) (&2) /\ + &0 < delta_x4 (y6 * y6) (&2) (y5 * y5) (&2) (y4 * y4) (&2) /\ + &0 < delta_x4 (y5 * y5) (&2) (y4 * y4) (&2) (y6 * y6) (&2) /\ + &0 < delta_x4 (y4 * y4) (&2) (y6 * y6) (&2) (y5 * y5) (&2) +==> + (gamma3f y4 y5 y6 sqrt2 lmfun = gamma3f_x_div_sqrtdelta (h0cut y4) (h0cut y5) (h0cut y6) + a b c (y4*y4) (y5*y5) (y6*y6) * sqrt(delta_x (&2) (&2) (&2) (y4*y4) (y5*y5) (y6*y6)))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.gamma3f; Functional_equation.nonf_gamma3f_x_div_sqrtdelta;Sphere.vol3r;Sphere.vol3f;Sphere.vol_y;Sphere.y_of_x;Sphere.vol_x]; + ASM_SIMP_TAC[Nonlinear_lemma.sqrtxx ; arith `&0 < x ==> &0 <= x`;arith `y * #0.5 = y / &2`;GSYM lmfun_h0cut]; + REWRITE_TAC[Sphere.dih_y; sol_y_sol_x ;LET_END_DEF;LET_DEF; Nonlinear_lemma.sqrt2_sqrt2]; + SUBGOAL_THEN `!x y z. dih_x x y (&2) (&2) (&2) z = dih_x x (&2) z (&2) y (&2)` (unlist REWRITE_TAC); + BY(MESON_TAC[Nonlinear_lemma.dih_x_sym2;Nonlinear_lemma.dih_x_sym]); + SUBGOAL_THEN `!x y z. sol_x x y (&2) (&2) (&2) z = sol_x y (&2) x (&2) z (&2)` (unlist REWRITE_TAC); + BY(MESON_TAC[sol_x_sym;sol_x_sym2]); + REPEAT (GMATCH_SIMP_TAC sol_x_sol_euler_x); + REPEAT (GMATCH_SIMP_TAC sol_x_sol_x_sqrtdelta); + REPEAT (GMATCH_SIMP_TAC dih_x_dih_x_div_sqrtdelta_posbranch); + SUBGOAL_THEN `!x4 x5 x6. delta_x x4 (&2) x5 (&2) x6 (&2) = delta_x (&2) (&2) (&2) x4 x5 x6` (unlist REWRITE_TAC); + BY(REWRITE_TAC[Sphere.delta_x] THEN REAL_ARITH_TAC); + SUBGOAL_THEN `delta_x (&2) (&2) (&2) (y5 * y5) (y4 * y4) (y6 * y6) = delta_x (&2) (&2) (&2) (y4 *y4) (y5*y5) (y6*y6) ` SUBST1_TAC; + BY(MESON_TAC[delta_x_sym]); + SUBGOAL_THEN `delta_x (&2) (&2) (&2) (y6 *y6) (y5 * y5) (y4 * y4) = delta_x (&2) (&2) (&2) (y4 *y4) (y5*y5) (y6*y6) ` SUBST1_TAC; + BY(MESON_TAC[delta_x_sym]); + SUBGOAL_THEN `delta_x (&2) (&2) (&2) (y4 * y4) (y6 *y6) (y5 * y5) = delta_x (&2) (&2) (&2) (y4 *y4) (y5*y5) (y6*y6) ` SUBST1_TAC; + BY(MESON_TAC[delta_x_sym]); + REWRITE_TAC[TAUT `a /\ b /\ c <=> (a /\ b) /\ c`]; + CONJ2_TAC; + BY(REAL_ARITH_TAC); + REWRITE_TAC[TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + ASM_SIMP_TAC[ REAL_LT_MUL ; arith `&0 < &2`;arith `&0 < x ==> &0 <= x`]; + SUBGOAL_THEN `!x. ups_x x (&2) (&2) = ups_x (&2) (&2) x /\ ups_x (&2) x (&2) = ups_x (&2) (&2) x` (unlist REWRITE_TAC); + BY(MESON_TAC[ Collect_geom.UPS_X_SYM ]); + REPEAT (GMATCH_SIMP_TAC ups_x_cell3); + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[ups_x_sym]; + ASM_REWRITE_TAC[]; + SUBGOAL_THEN ` &0 < ups_x (y6 * y6) (y4 * y4) (y5 * y5) ` (unlist REWRITE_TAC); + BY(ASM_MESON_TAC[ Collect_geom.UPS_X_SYM]); + SUBGOAL_THEN `&0 < ups_x (y5 * y5) (y6 * y6) (y4 * y4)` (unlist REWRITE_TAC); + BY(ASM_MESON_TAC[Collect_geom.UPS_X_SYM]); + BY(ASM_MESON_TAC[eulerA_x_sym]) + ]);; + (* }}} *) + +let gamma3f_gamma3f_x_div_sqrtdelta_WEAK2 = prove_by_refinement( + `!y4 y5 y6 a b c. + &2 <= y4 /\ &2 <= y5 /\ &2 <= y6 /\ + y4 < &2 * sqrt(&2) /\ y5 < &2 * sqrt(&2) /\ y6 < &2 * sqrt(&2) /\ + eta_x (y4*y4) (y5*y5) (y6*y6) < sqrt(&2) +==> + (gamma3f y4 y5 y6 sqrt2 lmfun = gamma3f_x_div_sqrtdelta (h0cut y4) (h0cut y5) (h0cut y6) + a b c (y4*y4) (y5*y5) (y6*y6) * sqrt(delta_x (&2) (&2) (&2) (y4*y4) (y5*y5) (y6*y6)))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC gamma3f_gamma3f_x_div_sqrtdelta_WEAK; + ASM_SIMP_TAC[arith `&2 <= x ==> &0 < x`]; + SUBCONJ_TAC; + MATCH_MP_TAC UPS_X_POS; + SUBGOAL_THEN `!x. x < &2 * sqrt (&2) ==> x < &4` ASSUME_TAC; + GEN_TAC; + MATCH_MP_TAC (arith `b < c ==> (x < b ==> x < c)`); + MP_TAC Flyspeck_constants.bounds; + REWRITE_TAC[Sphere.sqrt2]; + BY(REAL_ARITH_TAC); + BY(ASM_SIMP_TAC[]); + DISCH_TAC; + SUBCONJ_TAC; + GMATCH_SIMP_TAC cell_3_delta_x_eta_x; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_REWRITE_TAC[Sphere.sqrt2]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + DISCH_TAC; + REPEAT (GMATCH_SIMP_TAC eulerA_x_pos); + REPEAT (GMATCH_SIMP_TAC delta_x4_pos); + SUBGOAL_THEN `!x. &2 <= x ==> &4 <= x*x` (unlist ASM_SIMP_TAC); + GEN_TAC; + REWRITE_TAC[arith `&4 = &2 * &2`]; + DISCH_TAC; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + SUBGOAL_THEN `!x. &2 <= x ==> &0 < x * x` (unlist ASM_SIMP_TAC); + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + SUBGOAL_THEN `!x. &2 <= x /\ x < &2 * sqrt(&2) ==> x * x < &8` ASSUME_TAC; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[arith `&8 = #8.0`;GSYM Nonlinear_lemma.sqrt8_2]; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE; + REWRITE_TAC[Nonlinear_lemma.sqrt8_sqrt2]; + REWRITE_TAC[Sphere.sqrt2]; + BY((REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC)) THEN REAL_ARITH_TAC); + ASM_SIMP_TAC[]; + SUBGOAL_THEN `!x. x * x < &8 ==> x * x <= &16` (unlist ASM_SIMP_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + + +let dih_x_nn = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + &0 < x1 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 ==> + &0 <= dih_x x1 x2 x3 x4 x5 x6 `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Nonlinear_lemma.dih_x_alt]; + SUBGOAL_THEN `&0 < sqrt(&4 * x1 * delta_x x1 x2 x3 x4 x5 x6)` ASSUME_TAC; + GMATCH_SIMP_TAC SQRT_POS_LT; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + ASM_SIMP_TAC[Trigonometry1.ATN2_BREAKDOWN]; + MATCH_MP_TAC (arith `-- a < c ==> &0 <= a + c`); + BY(MESON_TAC[ATN_BOUNDS]) + ]);; + (* }}} *) + +let dih_x_div_sqrtdelta_pos = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + &0 < x1 /\ + &0 < delta_x x1 x2 x3 x4 x5 x6 /\ + &0 < delta_x4 x1 x2 x3 x4 x5 x6 ==> + &0 <= dih_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC dih_x_dih_x_div_sqrtdelta_posbranch [`x1`;`x2`;`x3`;`x4`;`x5`;`x6`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `&0 <= sqrt (delta_x x1 x2 x3 x4 x5 x6) * dih_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6` ) ASSUME_TAC)); + MATCH_MP_TAC REAL_LE_TRANS; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `dih_x x1 x2 x3 x4 x5 x6`))); + ASM_SIMP_TAC[dih_x_nn]; + BY(REAL_ARITH_TAC); + BY(ASM_MESON_TAC[REAL_LE_MUL_EQ;SQRT_POS_LT]) + ]);; + (* }}} *) + +let ETA_Y_LE_IMP_LT = prove_by_refinement( + `!y4 y5 y6. &2 <= y4 /\ y4 <= sqrt8 /\ &2 <= y5 /\ y5 <= sqrt8 /\ &2 <= y6 /\ y6 <= sqrt8 /\ + eta_y y4 y5 y6 < sqrt2 ==> y4 < sqrt8`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.eta_y]; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC UPS_X_POS [`y4`;`y5`;`y6`]; + ANTS_TAC; + REPEAT (FIRST_X_ASSUM MP_TAC); + MP_TAC Flyspeck_constants.bounds; + REWRITE_TAC[Sphere.sqrt8]; + BY(REAL_ARITH_TAC); + WEAK_STRIP_TAC; + PROOF_BY_CONTR_TAC; + SUBGOAL_THEN `y4 = sqrt8` ASSUME_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + INTRO_TAC cell_3_delta_x_eta_x [`y4*y4`;`y5*y5`;`y6*y6`]; + ANTS_TAC; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_REWRITE_TAC[]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[Nonlinear_lemma.sqrt8_2]; + SUBGOAL_THEN `delta_x (&2) (&2) (&2) #8.0 (y5 * y5) (y6 * y6) = -- &2 * (-- &8 + y5 * y5 + y6 * y6) pow 2` SUBST1_TAC; + REWRITE_TAC[Sphere.delta_x]; + BY(REAL_ARITH_TAC); + INTRO_TAC Real_ext.REAL_LE_POW_2 [`-- &8 + y5 * y5 + y6 * y6`]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let ETA_Y_LE_IMP_LT_ALL = prove_by_refinement( + `!y4 y5 y6. &2 <= y4 /\ y4 <= sqrt8 /\ &2 <= y5 /\ y5 <= sqrt8 /\ &2 <= y6 /\ y6 <= sqrt8 /\ + eta_y y4 y5 y6 < sqrt2 ==> y4 < sqrt8 /\ y5 < sqrt8 /\ y6 < sqrt8`, + (* {{{ proof *) + [ + BY(ASM_MESON_TAC [Collect_geom.ETA_Y_SYYM; ETA_Y_LE_IMP_LT]) + ]);; + (* }}} *) + +let ETA_Y_BOUNDS = prove_by_refinement( + `!y4 y5 y6. &2 <= y4 /\ y4 <= sqrt8 /\ &2 <= y5 /\ y5 <= sqrt8 /\ &2 <= y6 /\ y6 <= sqrt8 /\ + eta_y y4 y5 y6 < sqrt2 ==> &0 < ups_x (y4 * y4) (y5 * y5) (y6 * y6) /\ + &0 < delta_x (&2) (&2) (&2) (y4 * y4) (y5*y5) (y6*y6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.eta_y]; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC UPS_X_POS [`y4`;`y5`;`y6`]; + ANTS_TAC; + REPEAT (FIRST_X_ASSUM MP_TAC); + MP_TAC Flyspeck_constants.bounds; + REWRITE_TAC[Sphere.sqrt8]; + BY(BY(REAL_ARITH_TAC)); + DISCH_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC cell_3_delta_x_eta_x [`y4 * y4`;`y5 * y5`;`y6 * y6`]; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let dih_y_div_sqrtdelta_pos = prove_by_refinement( +`!y4 y5 y6. + &2 <= y4 /\ &2 <= y5 /\ &2 <= y6 /\ + y4 <= &2 * sqrt(&2) /\ y5 <= &2 * sqrt(&2) /\ y6 <= &2 * sqrt(&2) /\ + eta_y (y4) (y5) (y6) < sqrt(&2) ==> + &0 <= y_of_x dih4_x_div_sqrtdelta_posbranch sqrt2 sqrt2 sqrt2 y4 y5 y6`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + INTRO_TAC ETA_Y_LE_IMP_LT_ALL [`y4`;`y5`;`y6`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + REPEAT (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2]; + BY(REAL_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.y_of_x;Nonlin_def.dih4_x_div_sqrtdelta_posbranch;Sphere.rotate4]; + MATCH_MP_TAC dih_x_div_sqrtdelta_pos; + CONJ_TAC; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + SUBCONJ_TAC; + INTRO_TAC ETA_Y_BOUNDS [`y4`;`y5`;`y6`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ASM_SIMP_TAC[Sphere.sqrt2;arith `x < y ==> x <= y`]); + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Nonlinear_lemma.sqrt2_sqrt2]; + BY(ASM_MESON_TAC[delta_x_sym]); + DISCH_TAC; + INTRO_TAC delta_x4_pos [`y5 * y5`;`y6 * y6`;`y4 * y4`]; + ANTS_TAC; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REWRITE_TAC[arith `&4 = &2 * &2`]; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + REWRITE_TAC[GSYM Nonlinear_lemma.sqrt8_2;arith `&8 = #8.0`]; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(REWRITE_TAC[Nonlinear_lemma.sqrt2_sqrt2]) + ]);; + (* }}} *) + +let gamma3f_gamma3f_x_div_sqrtdelta = prove_by_refinement( + `!a b c y4 y5 y6. + &2 <= y4 /\ &2 <= y5 /\ &2 <= y6 /\ + y4 <= &2 * sqrt(&2) /\ y5 <= &2 * sqrt(&2) /\ y6 <= &2 * sqrt(&2) /\ + eta_x (y4*y4) (y5*y5) (y6*y6) < sqrt(&2) +==> + (gamma3f y4 y5 y6 sqrt2 lmfun = gamma3f_x_div_sqrtdelta (h0cut y4) (h0cut y5) (h0cut y6) + a b c (y4*y4) (y5*y5) (y6*y6) * sqrt(delta_x (&2) (&2) (&2) (y4*y4) (y5*y5) (y6*y6)))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC gamma3f_gamma3f_x_div_sqrtdelta_WEAK2; + ASM_REWRITE_TAC[]; + INTRO_TAC ETA_Y_LE_IMP_LT_ALL [`y4`;`y5`;`y6`]; + ASM_REWRITE_TAC[Sphere.sqrt2; Nonlinear_lemma.sqrt8_sqrt2]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[Sphere.eta_y;LET_DEF;LET_END_DEF]) + ]);; + (* }}} *) + +let gamma3f_x_div_sqrtdelta_quotient = prove_by_refinement( + `!y4 y5 y6 a b c. + &2 <= y4 /\ &2 <= y5 /\ &2 <= y6 /\ + y4 <= &2 * sqrt(&2) /\ y5 <= &2 * sqrt(&2) /\ y6 <= &2 * sqrt(&2) /\ + eta_x (y4*y4) (y5*y5) (y6*y6) < sqrt(&2) ==> + gamma3f_x_div_sqrtdelta (h0cut y4) (h0cut y5) (h0cut y6) a b c (y4*y4) (y5*y5) (y6*y6) = + gamma3f y4 y5 y6 sqrt2 lmfun / sqrt(delta_x (&2) (&2) (&2) (y4*y4) (y5*y5) (y6*y6)) +`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (ASM_SIMP_TAC[(ISPECL ( envl w [`a`;`b`;`c`]) gamma3f_gamma3f_x_div_sqrtdelta)])); + Calc_derivative.CALC_ID_TAC; + MATCH_MP_TAC (arith `&0 < x ==> ~(x = &0)`); + GMATCH_SIMP_TAC SQRT_POS_LT; + INTRO_TAC ETA_Y_BOUNDS [`y4`;`y5`;`y6`]; + ASM_REWRITE_TAC[Sphere.eta_y;LET_DEF;LET_END_DEF;Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let gamma3f_x_div_sqrtdelta_arg3 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6 m4 m5 m6. + gamma3f_x_div_sqrtdelta m4 m5 m6 y1 y2 y3 y4 y5 y6 = + gamma3f_x_div_sqrtdelta m4 m5 m6 (&1) (&1) (&1) y4 y5 y6`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Functional_equation.nonf_gamma3f_x_div_sqrtdelta]) + ]);; + (* }}} *) + +let gamma3f_y_div_sqrtdelta_arg3 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6 m4 m5 m6. + y_of_x (gamma3f_x_div_sqrtdelta (m4 y4) (m5 y5) (m6 y6)) y1 y2 y3 y4 y5 y6 = + y_of_x (gamma3f_x_div_sqrtdelta (m4 y4) (m5 y5) (m6 y6)) (&1) (&1) (&1) y4 y5 y6`, + (* {{{ proof *) + [ + BY((REWRITE_TAC[Sphere.y_of_x;Functional_equation.nonf_gamma3f_x_div_sqrtdelta])) + ]);; + (* }}} *) + + +let gamma3f_sym = prove_by_refinement( + `!y4 y5 y6. + gamma3f y4 y5 y6 sqrt2 lmfun = gamma3f y4 y6 y5 sqrt2 lmfun /\ + gamma3f y4 y5 y6 sqrt2 lmfun = gamma3f y5 y6 y4 sqrt2 lmfun`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.gamma3f;Sphere.vol3r;Sphere.vol3f;Sphere.vol_y;Sphere.y_of_x;Sphere.vol_x;Nonlinear_lemma.sqrt2_sqrt2]; + MATCH_MP_TAC (arith `((a = a') /\ (a = a'')) /\ ((b = b') /\ (b =b'')) /\ ((c = c') /\ c = c'') ==> (a - (b - c) = a' - (b' - c'))/\ (a - (b - c) = a'' - (b'' - c''))`); + CONJ_TAC; + BY(ASM_MESON_TAC[delta_x_sym]); + CONJ_TAC; + REWRITE_TAC[sol_y_sol_x]; + CONJ_TAC; + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + MATCH_MP_TAC (arith `(x = z') /\ (y = y') /\ (z = x') ==> (x+y+z = x'+y'+z')`); + BY(MESON_TAC[sol_x_sym;sol_x_sym2]); + BY(MESON_TAC[sol_x_sym;sol_x_sym2;arith `x + y + z = y + z + x`]); + CONJ_TAC; + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + MATCH_MP_TAC (arith `(x = x') /\ (y = z') /\ (z = y') ==> (x+y+z = x'+y'+z')`); + BY(MESON_TAC[Nonlinear_lemma.dih_y_sym;Nonlinear_lemma.dih_y_sym2]); + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + MATCH_MP_TAC (arith `(x = z') /\ (y = x') /\ (z = y') ==> (x+y+z = x'+y'+z')`); + BY(MESON_TAC[Nonlinear_lemma.dih_y_sym;Nonlinear_lemma.dih_y_sym2]) + ]);; + (* }}} *) + +let gamma3f_x_dif_sqrtdelta_sym = prove_by_refinement( + `!y4 y5 y6. + &2 <= y4 /\ &2 <= y5 /\ &2 <= y6 /\ + y4 <= &2 * sqrt(&2) /\ y5 <= &2 * sqrt(&2) /\ y6 <= &2 * sqrt(&2) /\ + eta_x (y4*y4) (y5*y5) (y6*y6) < sqrt(&2) ==> + y_of_x (gamma3f_x_div_sqrtdelta (h0cut y4) (h0cut y5) (h0cut y6)) (&1) (&1) (&1) y4 y5 y6 = + y_of_x (gamma3f_x_div_sqrtdelta (h0cut y5) (h0cut y6) (h0cut y4)) (&1) (&1) (&1) y5 y6 y4 /\ + y_of_x (gamma3f_x_div_sqrtdelta (h0cut y4) (h0cut y5) (h0cut y6)) (&1) (&1) (&1) y4 y5 y6 = + y_of_x (gamma3f_x_div_sqrtdelta (h0cut y5) (h0cut y4) (h0cut y6)) (&1) (&1) (&1) y5 y4 y6 + `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.y_of_x]; + ASM_SIMP_TAC[gamma3f_x_div_sqrtdelta_quotient]; + GMATCH_SIMP_TAC gamma3f_x_div_sqrtdelta_quotient; + GMATCH_SIMP_TAC gamma3f_x_div_sqrtdelta_quotient; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC[Collect_geom.ETA_X_SYMM]); + CONJ_TAC; + BY(ASM_MESON_TAC[Collect_geom.ETA_X_SYMM]); + BY(ASM_MESON_TAC[delta_x_sym;gamma3f_sym]) + ]);; + (* }}} *) + + +(* do 3 -cell nonnegativity *) + + +let REAL_WLOG_SIMPLEX_3d = prove_by_refinement( + `!P. + ((!y4 y5 y6. P y4 y5 y6 = P y4 y6 y5) /\ + (!y4 y5 y6. P y4 y5 y6 = P y5 y6 y4)) + /\ + (! y4 y5 y6. (y6 <= y5) /\ (y5 <= y4) ==> P y4 y5 y6) ==> + (!y4 y5 y6. P y4 y5 y6)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `(y4 <= y5 /\ y5 <= y6) \/ (y4 <= y6 /\ y6 <= y5) \/ (y5 <= y4 /\ y4 <= y6) \/ (y5 <= y6 /\ y6 <= y4) \/ (y6 <= y5 /\ y5 <= y4) \/ (y6 <= y4 /\ y4 <= y5)` ASSUME_TAC; + BY(REAL_ARITH_TAC); + BY(REPEAT ((FIRST_X_ASSUM DISJ_CASES_TAC) THEN (ASM_MESON_TAC[]))) + ]);; + (* }}} *) + +let ineq_constant = prove_by_refinement( + `!a y v f. (ineq (CONS (a,y,a) v) (f y)) <=> ((y=a)==> (ineq v (f a)))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.ineq;arith `a <= y /\ y <= a <=> (y = a)`]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let PPx = prove_by_refinement( + `!(a:A) P. (!y. (y = a) ==> P y) ==> P a`, + (* {{{ proof *) + [ + MESON_TAC[] + ]);; + (* }}} *) + +let cell3_from_ineq = `!y4 y5 y6. + &2 <= y4 /\ &2 <= y5 /\ &2 <= y6 /\ + y4 <= &2 * sqrt(&2) /\ y5 <= &2 * sqrt(&2) /\ y6 <= &2 * sqrt(&2) /\ + eta_y (y4) (y5) (y6) < sqrt(&2) ==> + &0 <= gamma3f y4 y5 y6 sqrt2 lmfun `;; + +let eta_y_nn = prove_by_refinement( + `!y4 y5 y6. &0 <= ups_x (y4*y4) (y5*y5) (y6*y6) ==> &0 <= eta_y y4 y5 y6`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.eta_y;LET_DEF;LET_END_DEF]; + REWRITE_TAC[Sphere.eta_x]; + GMATCH_SIMP_TAC SQRT_POS_LE; + GMATCH_SIMP_TAC REAL_LE_DIV; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LE_MUL; + CONJ_TAC; + BY(REWRITE_TAC[REAL_LE_SQUARE]); + GMATCH_SIMP_TAC REAL_LE_MUL; + BY(REWRITE_TAC[REAL_LE_SQUARE]) + ]);; + (* }}} *) + +let ineq_branch_edge_strict = prove_by_refinement( + `!c a b u v y f. + ineq (APPEND u (CONS (a,y,c) v)) f /\ + ((c < y) ==> ineq (APPEND u (CONS (c,y,b) v)) f) ==> + ineq (APPEND u (CONS (a,y,b) v)) f`, + (* {{{ proof *) + [ + REWRITE_TAC[ineq_APPEND]; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + ASSUME_TAC (arith `y <= c \/ c < y`); + REPEAT (FIRST_X_ASSUM MP_TAC); + (ASM_CASES_TAC `a <= y` THEN ASM_CASES_TAC `y <= b` THEN ASM_CASES_TAC `y <= c` THEN ASM_CASES_TAC `c < y` THEN ASM_SIMP_TAC[arith `c < y ==> c <= y`;ineq_T] THEN TRY (ASM_MESON_TAC[])) + ]);; + (* }}} *) + +let BRANCH_TAC_STRICT n c = + CHOP_LIST_TAC n THEN + MATCH_MP_TAC (SPEC c ineq_branch_edge_strict) + THEN REWRITE_TAC[APPEND];; + +let cell3_hyp = + let cell3= ["QZECFIC wt0";"QZECFIC wt0 corner";"QZECFIC wt0 sqrt8"; + "QZECFIC wt1";"QZECFIC wt2 A";"CIHTIUM";"CJFZZDW";] in + let cell3_nonlinear = map (fun t -> (hd(Ineq.getexact t)).ineq) cell3 in + end_itlist (curry mk_conj) cell3_nonlinear;; + +(* +let goalt = mk_imp(cell3_hyp,cell3_from_ineq);; +Print_types.print_term_types goalt;; +g goalt;; +*) + + + +g (mk_imp(cell3_hyp,cell3_from_ineq));; + +let cell3_from_ineq_thm = prove_by_refinement( + (mk_imp(cell3_hyp,cell3_from_ineq)), + (* {{{ proof *) + [ + DISCH_TAC; + REPEAT GEN_TAC; + ABBREV_TAC `Q = (\y4 y5 y6. &2 <= y4 /\ &2 <= y5 /\ &2 <= y6 /\ y4 <= &2 * sqrt(&2) /\ y5 <= &2 * sqrt(&2) /\ y6 <= &2 * sqrt(&2) /\ eta_y (y4) (y5) (y6) < sqrt(&2))`; + DISCH_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`Q y4 y5 y6`) ASSUME_TAC)); + EXPAND_TAC "Q"; + BY(BY((ASM_REWRITE_TAC[]))); + REPEAT WEAK_STRIP_TAC; + INTRO_TAC ETA_Y_BOUNDS [`y4`;`y5`;`y6`]; + ANTS_TAC; + BY(BY((ASM_SIMP_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2]))); + REPEAT WEAK_STRIP_TAC; + INTRO_TAC ETA_Y_LE_IMP_LT_ALL [`y4`;`y5`;`y6`]; + ANTS_TAC; + BY(BY((ASM_SIMP_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2]))); + REPEAT WEAK_STRIP_TAC; + COMMENT "1. remove excess variables"; + REPEAT (FIRST_X_ASSUM_ST `ineq` MP_TAC); + REWRITE_TAC[ineq_constant]; + REWRITE_TAC[MESON[] `(!y1 y2 y3 y4 y5 y6. P y1 y2 y3 y4 y5 y6) <=> (!y4 y5 y6 y1 y2 y3. P y1 y2 y3 y4 y5 y6)`]; + REWRITE_TAC[ RIGHT_FORALL_IMP_THM]; + REPEAT WEAK_STRIP_TAC; + REPEAT (FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP PPx))); + COMMENT "2. insert Q"; + REPEAT (FIRST_X_ASSUM MP_TAC); + REPLICATE_TAC 8 DISCH_TAC; + REWRITE_TAC[arith `!x y. x > y <=> y < x`;arith `!x y. x >= y <=> y <= x`]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!P. (!y4 y5 y6. P y4 y5 y6) ==> (!y4 y5 y6. Q y4 y5 y6 ==> P y4 y5 y6)`) MP_TAC)); + BY(BY((MESON_TAC[]))); + DISCH_THEN (fun t -> (REPEAT (DISCH_THEN (ASSUME_TAC o (MATCH_MP t))))); + COMMENT "3. remove eta_y"; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!R f. (!y4 y5 y6. Q y4 y5 y6 ==> ineq (R y4 y5 y6) (f y4 y5 y6 \/ &2 < eta_y y4 y5 y6 pow 2)) ==> (!y4 y5 y6. Q y4 y5 y6 ==> ineq (R y4 y5 y6) (f y4 y5 y6))`) MP_TAC)); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPECL ( envl w [`y4'`;`y5'`;`y6'`]))))); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC ineq_monotone; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `~(&2 < eta_y y4' y5' y6' pow 2)`))); + BY(BY((MESON_TAC[]))); + MATCH_MP_TAC (arith `x < &2 ==> ~(&2 < x)`); + FIRST_X_ASSUM MP_TAC; + EXPAND_TAC "Q"; + DISCH_TAC; + REWRITE_TAC[GSYM Nonlinear_lemma.sqrt2_sqrt2]; + REWRITE_TAC[arith `x pow 2 = x * x`]; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE; + GMATCH_SIMP_TAC (arith `&0 <= x ==> (abs x = x)`); + ASM_REWRITE_TAC[Sphere.sqrt2]; + MATCH_MP_TAC eta_y_nn; + BY(BY((ASM_MESON_TAC[ETA_Y_BOUNDS;arith `x < y ==> x <= y`;Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]))); + DISCH_THEN (fun SUBST1_TAC -> (REPEAT (FIRST_X_ASSUM_ST `eta_y` (fun CONJUNCTS_THEN2 -> ASSUME_TAC (MATCH_MP SUBST1_TAC CONJUNCTS_THEN2)))) THEN MP_TAC SUBST1_TAC); + MP_TAC (MESON[] `!y4 y5 y6. &2 < eta_y y4 y5 y6 pow 2 <=> (F \/ &2 < eta_y y4 y5 y6 pow 2)`); + DISCH_THEN (fun SUBST1_TAC -> REPEAT (FIRST_X_ASSUM MP_TAC) THEN ONCE_REWRITE_TAC[SUBST1_TAC]); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[]; + (DISCH_THEN (fun SUBST1_TAC -> (REPEAT (FIRST_X_ASSUM_ST `eta_y` (fun CONJUNCTS_THEN2 -> ASSUME_TAC (MATCH_MP SUBST1_TAC CONJUNCTS_THEN2)))) THEN MP_TAC SUBST1_TAC)); + DISCH_THEN kill; + COMMENT "4. remove dih_4"; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!R f. (!y4 y5 y6. Q y4 y5 y6 ==> ineq (R y4 y5 y6) (#0.008 * y_of_x dih4_x_div_sqrtdelta_posbranch sqrt2 sqrt2 sqrt2 y4 y5 y6 < f y4 y5 y6)) ==> (!y4 y5 y6. Q y4 y5 y6 ==> ineq (R y4 y5 y6) (&0 <= f y4 y5 y6))`) MP_TAC)); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPECL ( envl w [`y4'`;`y5'`;`y6'`]))))); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC ineq_monotone; + MATCH_MP_TAC (arith `&0 <= x ==> (x < y ==> &0 <= y)`); + GMATCH_SIMP_TAC REAL_LE_MUL; + CONJ_TAC; + BY(BY(REAL_ARITH_TAC)); + MATCH_MP_TAC dih_y_div_sqrtdelta_pos; + FIRST_X_ASSUM MP_TAC; + EXPAND_TAC "Q"; + BY(BY(MESON_TAC[])); + (DISCH_THEN (fun SUBST1_TAC -> (REPEAT (FIRST_X_ASSUM_ST `dih4_x_div_sqrtdelta_posbranch` (fun CONJUNCTS_THEN2 -> ASSUME_TAC (MATCH_MP SUBST1_TAC CONJUNCTS_THEN2)))))); + COMMENT "5. make strict ineq"; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!R f. (!y4 y5 y6. Q y4 y5 y6 ==> ineq (R y4 y5 y6) (&0 < f y4 y5 y6)) ==> (!y4 y5 y6. Q y4 y5 y6 ==> ineq (R y4 y5 y6) (&0 <= f y4 y5 y6))`) MP_TAC)); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPECL ( envl w [`y4'`;`y5'`;`y6'`]))))); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC ineq_monotone; + BY(BY(REAL_ARITH_TAC)); + (DISCH_THEN (fun SUBST1_TAC -> (REPEAT (FIRST_X_ASSUM_ST `ineq v (&0 < a)` (fun CONJUNCTS_THEN2 -> ASSUME_TAC (MATCH_MP SUBST1_TAC CONJUNCTS_THEN2)))))); + COMMENT "5. insert h0cut y4 1"; + SUBGOAL_THEN `#2.01 <= &2 * h0 /\ &2 * hminus <= &2 * h0` MP_TAC; + MP_TAC Sphere.h0; + MP_TAC Nonlinear_lemma.hminus_lt_h0; + BY(BY(REAL_ARITH_TAC)); + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `!a b c d e f g v. (!y4 y5 y6. Q y4 y5 y6 ==> ineq (CONS (a,y4,b) (v y5 y6)) (&0 <= y_of_x (gamma3f_x_div_sqrtdelta (&1) (c y5) (d y6)) e f g y4 y5 y6)) ==> (b <= &2 * h0) ==> ( (!y4 y5 y6. Q y4 y5 y6 ==> ineq (CONS (a,y4,b) (v y5 y6)) (&0 <= y_of_x (gamma3f_x_div_sqrtdelta (h0cut y4) (c y5) (d y6)) e f g y4 y5 y6)))` MP_TAC; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPECL ( envl w [`y4'`;`y5'`;`y6'`]))))); + ASM_REWRITE_TAC[]; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `ineq` MP_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Optimize.h0cutA; + REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC); + BY(BY(REAL_ARITH_TAC)); + (DISCH_THEN (fun SUBST1_TAC -> (REPEAT (FIRST_X_ASSUM_ST `gamma3f_x_div_sqrtdelta (&1)` (fun CONJUNCTS_THEN2 -> MP_TAC (MATCH_MP SUBST1_TAC CONJUNCTS_THEN2)))))); + ASM_REWRITE_TAC[]; + REPEAT DISCH_TAC; + COMMENT "5 h0cut y4 0"; + SUBGOAL_THEN `&2 * h0 < &2 * hplus` MP_TAC; + MP_TAC Nonlinear_lemma.h0_lt_hplus; + BY(BY(REAL_ARITH_TAC)); + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `!a b c d e f g v. (!y4 y5 y6. Q y4 y5 y6 ==> ineq (CONS (a,y4,b) (v y5 y6)) (&0 <= y_of_x (gamma3f_x_div_sqrtdelta (&0) (c y5) (d y6)) e f g y4 y5 y6)) ==> ( &2 * h0 < a) ==> ( (!y4 y5 y6. Q y4 y5 y6 ==> ineq (CONS (a,y4,b) (v y5 y6)) (&0 <= y_of_x (gamma3f_x_div_sqrtdelta (h0cut y4) (c y5) (d y6)) e f g y4 y5 y6)))` MP_TAC; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPECL ( envl w [`y4'`;`y5'`;`y6'`]))))); + ASM_REWRITE_TAC[]; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `ineq` MP_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Optimize.h0cutB; + REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC); + BY(BY(REAL_ARITH_TAC)); + (DISCH_THEN (fun SUBST1_TAC -> (REPEAT (FIRST_X_ASSUM_ST `gamma3f_x_div_sqrtdelta (&0)` (fun CONJUNCTS_THEN2 -> MP_TAC (MATCH_MP SUBST1_TAC CONJUNCTS_THEN2)))))); + ASM_REWRITE_TAC[]; + DISCH_TAC; (* inserted Nov 30, 2012 *) + COMMENT "5 h0cut y5 1"; + SUBGOAL_THEN `!a b a' b' c d e f g v. (!y4 y5 y6. Q y4 y5 y6 ==> ineq (CONS (a, y4,b) (CONS (a',y5,b') (v y6))) (&0 <= y_of_x (gamma3f_x_div_sqrtdelta (c y4) (&1) (d y6)) e f g y4 y5 y6)) ==> (b' <= &2 * h0) ==> ( (!y4 y5 y6. Q y4 y5 y6 ==> ineq (CONS (a, y4,b) (CONS (a',y5,b') (v y6))) (&0 <= y_of_x (gamma3f_x_div_sqrtdelta (c y4) (h0cut y5) (d y6)) e f g y4 y5 y6)))` MP_TAC; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPECL ( envl w [`y4'`;`y5'`;`y6'`]))))); + ASM_REWRITE_TAC[]; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `ineq` MP_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Optimize.h0cutA; + REPLICATE_TAC 6 (FIRST_X_ASSUM MP_TAC); + BY(BY(REAL_ARITH_TAC)); + (DISCH_THEN (fun SUBST1_TAC -> (REPEAT (FIRST_X_ASSUM_ST `gamma3f_x_div_sqrtdelta (a) (&1)` (fun CONJUNCTS_THEN2 -> MP_TAC (MATCH_MP SUBST1_TAC CONJUNCTS_THEN2)))))); + ASM_REWRITE_TAC[]; + REPEAT DISCH_TAC; + COMMENT "5 factor of 2"; + FIRST_X_ASSUM_ST `x / &2` MP_TAC; + REWRITE_TAC [arith `!x. &0 <= x / &2 <=> &0 <= x`]; + DISCH_TAC; + COMMENT "5 h0cut y6 1"; + SUBGOAL_THEN `!a b a' b' a'' b'' c d e f g . (!y4 y5 y6. Q y4 y5 y6 ==> ineq (CONS (a, y4,b) (CONS (a',y5,b') [a'',y6,b''])) (&0 <= y_of_x (gamma3f_x_div_sqrtdelta (c y4) (d y5) (&1)) e f g y4 y5 y6)) ==> (b'' <= &2 * h0) ==> ( (!y4 y5 y6. Q y4 y5 y6 ==> ineq (CONS (a, y4,b) (CONS (a',y5,b') [a'',y6,b''])) (&0 <= y_of_x (gamma3f_x_div_sqrtdelta (c y4) (d y5) (h0cut y6)) e f g y4 y5 y6)))` MP_TAC; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPECL ( envl w [`y4'`;`y5'`;`y6'`]))))); + ASM_REWRITE_TAC[]; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `y_of_x` MP_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Optimize.h0cutA; + REPLICATE_TAC 8 (FIRST_X_ASSUM MP_TAC); + BY(BY(REAL_ARITH_TAC)); + (DISCH_THEN (fun SUBST1_TAC -> (REPEAT (FIRST_X_ASSUM_ST `gamma3f_x_div_sqrtdelta (a) b (&1)` (fun CONJUNCTS_THEN2 -> MP_TAC (MATCH_MP SUBST1_TAC CONJUNCTS_THEN2)))))); + ASM_REWRITE_TAC[]; + REPEAT DISCH_TAC; + COMMENT "7. gamma3f"; + REPEAT (FIRST_X_ASSUM MP_TAC); + ONCE_REWRITE_TAC[gamma3f_y_div_sqrtdelta_arg3]; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `!v. (!y4 y5 y6. Q y4 y5 y6 ==> ineq (v y4 y5 y6) (&0 <= y_of_x (gamma3f_x_div_sqrtdelta (h0cut y4) (h0cut y5) (h0cut y6)) (&1) (&1) (&1) y4 y5 y6)) ==> (!y4 y5 y6. Q y4 y5 y6 ==> ineq (v y4 y5 y6) (&0 <= gamma3f y4 y5 y6 sqrt2 lmfun))` MP_TAC; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPECL ( envl w [`y4'`;`y5'`;`y6'`]))))); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC ineq_monotone; + DISCH_TAC; + INTRO_TAC gamma3f_gamma3f_x_div_sqrtdelta [`&1`;`&1`;`&1`]; + DISCH_THEN GMATCH_SIMP_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); + EXPAND_TAC "Q"; + REWRITE_TAC[Sphere.eta_y;LET_DEF;LET_END_DEF]; + DISCH_TAC; + ASM_REWRITE_TAC[]; + DISCH_TAC; + GMATCH_SIMP_TAC REAL_LE_MUL; + CONJ_TAC; + FIRST_X_ASSUM MP_TAC; + BY(BY(REWRITE_TAC[Sphere.y_of_x;arith `&1 * &1 = &1`])); + GMATCH_SIMP_TAC SQRT_POS_LE; + MATCH_MP_TAC (arith `&0 < x ==> &0 <= x`); + INTRO_TAC ETA_Y_BOUNDS [`y4'`;`y5'`;`y6'`]; + ASM_SIMP_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2]; + ANTS_TAC; + BY(BY(ASM_REWRITE_TAC[Sphere.eta_y;LET_DEF;LET_END_DEF])); + BY(BY(MESON_TAC[])); + ((DISCH_THEN (fun SUBST1_TAC -> (REPEAT (FIRST_X_ASSUM_ST `gamma3f_x_div_sqrtdelta` (fun CONJUNCTS_THEN2 -> MP_TAC (MATCH_MP SUBST1_TAC CONJUNCTS_THEN2))))))); + REPEAT WEAK_STRIP_TAC; + COMMENT "8. symmetry reduction"; + ENOUGH_TO_SHOW_TAC `(!y4 y5 y6. Q y4 y5 y6 ==> ineq [(&2,y4,sqrt8);(&2,y5,sqrt8);(&2,y6,sqrt8)] (&0 <= gamma3f y4 y5 y6 sqrt2 lmfun))`; + DISCH_THEN (C INTRO_TAC [`y4`;`y5`;`y6`]); + BY(ASM_REWRITE_TAC[Sphere.ineq;Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2]); + MATCH_MP_TAC REAL_WLOG_SIMPLEX_3d; + REWRITE_TAC[TAUT `a /\ b /\ c <=> (a /\ b) /\ c`]; + CONJ_TAC; + EXPAND_TAC "Q"; + REWRITE_TAC[Sphere.ineq]; + BY(MESON_TAC[gamma3f_sym;Collect_geom.ETA_Y_SYYM]); + REPEAT WEAK_STRIP_TAC; + BRANCH_TAC_STRICT 0 `&2 * hminus`; + CONJ_TAC; + BRANCH_TAC_STRICT 0 `#2.01`; + SUBGOAL_THEN `#2.01 <= sqrt8` ASSUME_TAC; + BY(MP_TAC (Flyspeck_constants.bounds) THEN REAL_ARITH_TAC); + REPEAT (FIRST_X_ASSUM_ST `#2.01` (C INTRO_TAC [`y4'`;`y5'`;`y6'`])); + ASM_REWRITE_TAC[]; + REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC); + BY(REWRITE_TAC[Sphere.ineq] THEN REAL_ARITH_TAC); + DISCH_TAC; + COMMENT "9. now 2hminus < y4"; + DISJ_CASES_TAC (arith `&2 * hminus < y6' \/ y6' <= &2 * hminus`); + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `F` (C INTRO_TAC [`y4'`;`y5'`;`y6'`])); + ASM_REWRITE_TAC[]; + REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC); + BY(REWRITE_TAC[Sphere.ineq] THEN REAL_ARITH_TAC); + DISJ_CASES_TAC (arith `&2 * hplus < y5' \/ y5' <= &2 * hplus`); + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `F` (C INTRO_TAC [`y4'`;`y5'`;`y6'`])); + ASM_REWRITE_TAC[]; + REPLICATE_TAC 6 (FIRST_X_ASSUM MP_TAC); + BY(REWRITE_TAC[Sphere.ineq] THEN REAL_ARITH_TAC); + DISJ_CASES_TAC (arith `&2 * hminus < y5' \/ y5' <= &2 * hminus`); + (FIRST_X_ASSUM (C INTRO_TAC [`y4'`;`y5'`;`y6'`])); + ASM_REWRITE_TAC[]; + REPLICATE_TAC 7 (FIRST_X_ASSUM MP_TAC); + BY(REWRITE_TAC[Sphere.ineq] THEN REAL_ARITH_TAC); + DISJ_CASES_TAC (arith `&2 * hplus < y4' \/ y4' <= &2 * hplus`); + REPEAT (FIRST_X_ASSUM_ST `#2.01` kill); + REPLICATE_TAC 2 (FIRST_X_ASSUM (C INTRO_TAC [`y4'`;`y5'`;`y6'`])); + ASM_REWRITE_TAC[]; + REPLICATE_TAC 8 (FIRST_X_ASSUM MP_TAC); + BY(REWRITE_TAC[Sphere.ineq] THEN REAL_ARITH_TAC); + REPEAT (FIRST_X_ASSUM_ST `#2.01` kill); + REPLICATE_TAC 3 (FIRST_X_ASSUM (C INTRO_TAC [`y4'`;`y5'`;`y6'`])); + ASM_REWRITE_TAC[]; + REPLICATE_TAC 8 (FIRST_X_ASSUM MP_TAC); + BY(REWRITE_TAC[Sphere.ineq] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let cell3_from_ineq_thm_ALT = prove_by_refinement( + `pack_nonlinear_non_ox3q1h ==> (!y4 y5 y6. + &2 <= y4 /\ + &2 <= y5 /\ + &2 <= y6 /\ + y4 <= &2 * sqrt (&2) /\ + y5 <= &2 * sqrt (&2) /\ + y6 <= &2 * sqrt (&2) /\ + eta_y y4 y5 y6 < sqrt (&2) + ==> &0 <= gamma3f y4 y5 y6 sqrt2 lmfun) + `, + (* {{{ proof *) + [ + DISCH_TAC; + INTRO_TAC cell3_from_ineq_thm []; + ANTS_TAC; + BY((REWRITE_TAC (map get_pack_nonlinear_non_ox3q1h ["QZECFIC wt0";"QZECFIC wt0 corner";"QZECFIC wt0 sqrt8";"QZECFIC wt1";"QZECFIC wt2 A";"CIHTIUM";"CJFZZDW";]))); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + + + + + +let HJKDESR1a_1cell = prove_by_refinement( + `&0 < &8 * pi * sqrt2 / &3 - &8 * mm1 `, + (* {{{ proof *) + [ + REWRITE_TAC[ arith `&8 * pi * sqrt2 / &3 = (&8 / &3) * (pi * sqrt2)`]; + MATCH_MP_TAC (arith `&3 * mm1 < z ==> &0 < (&8/ &3) * z - &8 * mm1`); + MATCH_MP_TAC REAL_LT_TRANS; + EXISTS_TAC (`&3 * #1.3`); + GMATCH_SIMP_TAC REAL_LT_LMUL_EQ; + GMATCH_SIMP_TAC REAL_LT_MUL2; + MP_TAC Flyspeck_constants.bounds; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + + +let GRKIBMP_concl = + `!y. &2 <= y /\ y <= sqrt8 ==> + &0 <= gamma2_x_div_azim_v2 (h0cut y) (y* y)`;; + +(* lmfun_h0cut relates this to the function lmfun *) + +let GRKIBMP = prove_by_refinement( + (add_hyp ["GRKIBMP A V2"; "GRKIBMP B V2"] GRKIBMP_concl), + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REPEAT (FIRST_X_ASSUM (C INTRO_TAC [`y`;`&1`;`&1`;`&1`;`&1`;`&1`])); + REWRITE_TAC[Sphere.ineq;Sphere.y_of_x;arith `&1 * &1 = &1`;arith `&1 <= &1`;Functional_equation.nonf_gamma2_x1_div_a_v2]; + ASM_CASES_TAC `&2 * hplus <= y`; + ASM_REWRITE_TAC[arith `x >= &0 <=> &0 <= x`]; + REPEAT WEAK_STRIP_TAC; + ENOUGH_TO_SHOW_TAC `h0cut y = &0`; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC Optimize.h0cutB; + MP_TAC Nonlinear_lemma.h0_lt_hplus; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + + + +(* see also Nonlinear_lemma.h0_lt_gt *) + +let y_bounds = prove_by_refinement( + `!y. (y <= &2 * hminus ==> y <= sqrt8) /\ + (y <= sqrt8 ==> y <= &2 * sqrt(&2)) /\ + (y <= &2 * sqrt(&2) ==> y < &4) /\ + (y < &2 * hminus ==> y <= &2 * hminus) /\ + (y < &2 * hminus ==> y <= &2 * sqrt(&2)) /\ + (&2 <= y ==> &0 < y) /\ + (&2 * hminus <= y ==> &2 <= y) /\ + (&2 <= y ==> &0 <= y) /\ + (&2 * hminus <= y ==> &0 <= y) /\ + (y <= &2 * hminus ==> y <= &2 * h0) /\ + (y <= &2 * hplus ==> y <= &2 * sqrt(&2)) `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MP_TAC Flyspeck_constants.bounds; + MP_TAC Nonlinear_lemma.hminus_lt_h0; + REWRITE_TAC[GSYM Nonlinear_lemma.sqrt8_sqrt2;GSYM Sphere.sqrt2]; + MP_TAC Nonlinear_lemma.hminus_prop; + REWRITE_TAC[Sphere.hplus]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let rad2_x_eta_x = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + &0 < x4 /\ &0 < x5 /\ &0 < x6 /\ + &0 < ups_x x4 x5 x6 /\ &0 < delta_x x1 x2 x3 x4 x5 x6 ==> + eta_x x4 x5 x6 pow 2 <= rad2_x x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.rad2_x;Sphere.eta_x;GSYM (* Merge_ineq *) Collect_geom.rho_ij'_rho_x]; + GMATCH_SIMP_TAC REAL_LE_RDIV_EQ; + CONJ_TAC; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC SQRT_POW_2; + CONJ_TAC; + GMATCH_SIMP_TAC REAL_LE_DIV; + ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`]; + GMATCH_SIMP_TAC REAL_LE_MUL; + GMATCH_SIMP_TAC REAL_LE_MUL; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + SUBGOAL_THEN `(x4 * x5 * x6) / ups_x x4 x5 x6 * delta_x x1 x2 x3 x4 x5 x6 * &4 = (&4 * delta_x x1 x2 x3 x4 x5 x6 * x4 * x5 * x6) / ups_x x4 x5 x6` SUBST1_TAC; + Calc_derivative.CALC_ID_TAC; + FIRST_X_ASSUM_ST `ups_x` MP_TAC; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LE_LDIV_EQ; + ASM_REWRITE_TAC[]; + REWRITE_TAC[Collect_geom.RHUFIIB]; + REWRITE_TAC[(* Merge_ineq *) delta_delta_x]; + MATCH_MP_TAC (arith `&0 <= x ==> y <= x + y`); + BY(REWRITE_TAC[ REAL_LE_POW_2]) + ]);; + (* }}} *) + + +let rad2_eta2 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + &2 <= y1 /\ &2 <= y2 /\ &2 <= y6 /\ y1 < &4 /\ y2 < &4 /\ y6 < &4 /\ + rad2_y y1 y2 y3 y4 y5 y6 < &2 /\ + &0 < delta_y y1 y2 y3 y4 y5 y6 ==> + eta_y y1 y2 y6 pow 2 < &2`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC REAL_LET_TRANS; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `rad2_y y1 y2 y3 y4 y5 y6`))); + ASM_REWRITE_TAC[]; + REWRITE_TAC[Sphere.eta_y;Sphere.rad2_y;LET_DEF;LET_END_DEF;Sphere.y_of_x]; + SUBGOAL_THEN `!x1 x2 x3 x4 x5 x6. rad2_x x1 x2 x3 x4 x5 x6 = rad2_x x4 x5 x3 x1 x2 x6` (unlist ONCE_REWRITE_TAC); + BY((MESON_TAC[(* Merge_ineq *) rad2_x_sym])); + MATCH_MP_TAC rad2_x_eta_x; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_SIMP_TAC[y_bounds]; + CONJ2_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Sphere.delta_y]; + MATCH_MP_TAC (arith `x = y ==> (&0 < x ==> &0 < y)`); + BY((MESON_TAC[(* Merge_ineq *) delta_x_sym])); + MATCH_MP_TAC UPS_X_POS; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + + +let g_quqya_goal = + add_hyp ["FHBVYXZ a";"FHBVYXZ b";"FWGKMBZ"] + (mk_imp(cell3_from_ineq,`!y1 y2 y3 y4 y5 y6. + ineq + [(&2 * hminus, y1, &2 * hplus ); + (&2,y2,&2 * hminus ); + (&2,y3,&2 * hminus); + (&2,y4,&2 * hminus); + (&2,y5,&2 * hminus ); + (&2,y6,&2 * hminus ) + ] + (rad2_y y1 y2 y3 y4 y5 y6 < &2 ==> + (&0 <= gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun + gamma3f y1 y2 y6 sqrt2 lmfun))`));; + + +g g_quqya_goal;; + +let g_quqya_g_quqyb = prove_by_refinement( + g_quqya_goal, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`y1`;`y2`;`y6`]); + REPEAT (FIRST_X_ASSUM (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`])); + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `gamma4fgcy` MP_TAC); + REPEAT (FIRST_X_ASSUM_ST `gamma3f` MP_TAC); + REPEAT (FIRST_X_ASSUM_ST `delta_x` MP_TAC); + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[y_bounds]; + REWRITE_TAC[GSYM Sphere.rad2_y]; + ASM_SIMP_TAC[arith `x < y ==> ~(x > y)`]; + DISCH_TAC; + ANTS_TAC; + GMATCH_SIMP_TAC REAL_LT_RSQRT; + MATCH_MP_TAC rad2_eta2; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `y3`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `y4`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `y5`))); + ASM_SIMP_TAC[y_bounds]; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Sphere.y_of_x]; + REWRITE_TAC[Sphere.y_of_x;Sphere.delta_y]; + BY(REAL_ARITH_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let g_quqya_g_quqyb_ALT = prove_by_refinement( + `pack_nonlinear_non_ox3q1h ==> + !y1 y2 y3 y4 y5 y6. + ineq + [(&2 * hminus, y1, &2 * hplus ); + (&2,y2,&2 * hminus ); + (&2,y3,&2 * hminus); + (&2,y4,&2 * hminus); + (&2,y5,&2 * hminus ); + (&2,y6,&2 * hminus ) + ] + (rad2_y y1 y2 y3 y4 y5 y6 < &2 ==> + (&0 <= gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun + gamma3f y1 y2 y6 sqrt2 lmfun))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MP_TAC cell3_from_ineq_thm_ALT; + ASM_REWRITE_TAC[]; + DISCH_TAC; + MP_TAC g_quqya_g_quqyb; + ANTS_TAC; + BY(ASM_REWRITE_TAC (map get_pack_nonlinear_non_ox3q1h ["FHBVYXZ a";"FHBVYXZ b";"FWGKMBZ"])); + ASM_REWRITE_TAC[]; + BY(DISCH_THEN (unlist REWRITE_TAC)) + ]);; + (* }}} *) + + +(* +let gamma10_gamma11_concl = + add_hyp ["GLFVCVK4 2477216213";"QITNPEA 5400790175 a";"QITNPEA 5400790175 b";"FWGKMBZ"] + (mk_imp(cell3_from_ineq,`!y1 y2 y3 y4 y5 y6. + &2 * hminus <= y1 /\ y1 <= &2 * hplus /\ + &2 <= y2 /\ y2 < &2 * hminus /\ + &2 <= y3 /\ y3 < &2 * hminus /\ + &2 * hminus <= y4 /\ y4 <= sqrt8 /\ + &2 <= y5 /\ y5 < &2 * hminus /\ + &2 <= y6 /\ y6 < &2 * hminus /\ + rad2_y y1 y2 y3 y4 y5 y6 < &2 ==> + (#0.0057 <= gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6) + + beta_bump_y y1 y2 y3 y4 y5 y6 + + gamma3f y1 y2 y6 sqrt2 lmfun)`));; +*) + +let gamma10_gamma11_concl = + add_hyp ["GLFVCVK4 2477216213";"QITNPEA 5400790175 a";"QITNPEA 5400790175 b";"FWGKMBZ"] + (mk_imp(cell3_from_ineq,`!y1 y2 y3 y4 y5 y6. + &2 * hminus <= y1 /\ y1 <= &2 * hplus /\ + &2 <= y2 /\ y2 < &2 * hminus /\ + &2 <= y3 /\ y3 < &2 * hminus /\ + &2 * hminus <= y4 /\ y4 <= sqrt8 /\ + &2 <= y5 /\ y5 < &2 * hminus /\ + &2 <= y6 /\ y6 < &2 * hminus /\ + rad2_y y1 y2 y3 y4 y5 y6 < &2 ==> + (#0.0057 <= gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6) + + beta_bumpA_y y1 y2 y3 y4 y5 y6 + + gamma3f y1 y2 y6 sqrt2 lmfun)`));; + +let gamma10_gamma11 = prove_by_refinement( + gamma10_gamma11_concl, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`y1`;`y2`;`y6`]); + REPEAT (FIRST_X_ASSUM (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`])); + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `gamma4fgcy` MP_TAC); + REPEAT (FIRST_X_ASSUM_ST `gamma3f` MP_TAC); + REPEAT (FIRST_X_ASSUM_ST `delta_x` MP_TAC); + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[y_bounds]; + REWRITE_TAC[GSYM Sphere.rad2_y]; + ASM_SIMP_TAC[arith `x < y ==> ~(x > y)`]; + DISCH_TAC; + ANTS_TAC; + GMATCH_SIMP_TAC REAL_LT_RSQRT; + MATCH_MP_TAC rad2_eta2; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `y3`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `y4`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `y5`))); + ASM_SIMP_TAC[y_bounds]; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Sphere.y_of_x;Sphere.delta_y]; + BY(REAL_ARITH_TAC); + REPEAT DISCH_TAC; + SUBGOAL_THEN `#0.0057 <= gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &2 + beta_bump_lb + gamma3f y1 y2 y6 sqrt2 lmfun` ASSUME_TAC; + ASM_CASES_TAC `eta_y y1 y2 y6 pow 2 < #1.34 pow 2`; + REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC); + BY(REAL_ARITH_TAC); + REPEAT (FIRST_X_ASSUM_ST `gamma4fgcy` MP_TAC); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `gamma3f` MP_TAC; + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM MP_TAC; + MATCH_MP_TAC (arith `x <= x' /\ y <= y' ==> (z <= x + y + u ==> z <= x' + y' +u)`); + CONJ2_TAC; + BY(ASM_MESON_TAC[(* Merge_ineq *) beta_bumpA_lb1;arith `&1 * x = x`]); + ASM_CASES_TAC (`wtcount6_y y1 y2 y3 y4 y5 y6 = 2`); + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + COMMENT "insert here"; + FIRST_X_ASSUM_ST `norm2hh` MP_TAC; + REWRITE_TAC[TAUT ` (a \/b) <=> (~b ==> a) `]; + ANTS_TAC; + DISCH_THEN (MP_TAC o (MATCH_MP quarter_norm2hh)); + BY(REPEAT (FIRST_X_ASSUM_ST `hminus` MP_TAC) THEN REAL_ARITH_TAC); + DISCH_TAC; + COMMENT "end insert"; + SUBGOAL_THEN `critical_edge_y y1 /\ ~critical_edge_y y2 /\ ~critical_edge_y y3 /\ ~critical_edge_y y4 /\ ~critical_edge_y y5 /\ ~critical_edge_y y6 /\ wtcount6_y y1 y2 y3 y4 y5 y6 = 1` ASSUME_TAC; + FIRST_X_ASSUM_ST `wtcount6_y` MP_TAC; + REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y;Sphere.critical_edge_y]; + TYPED_ABBREV_TAC `A = if &2 * hminus <= y4 /\ y4 <= &2 * hplus then 1 else 0`; + ASM_REWRITE_TAC[]; + REPEAT (GMATCH_SIMP_TAC COND_FALSE); + REWRITE_TAC[DE_MORGAN_THM;arith `~(x <= y) <=> y < x`]; + ASM_SIMP_TAC[y_bounds]; + REWRITE_TAC[arith `(1 + 0 +0 ) + A + 0 + 0 = 1 + A`]; + EXPAND_TAC "A"; + COND_CASES_TAC; + BY(MESON_TAC[arith `1 + 1 = 2`]); + DISCH_TAC; + CONJ2_TAC; + BY(ARITH_TAC); + REPEAT (FIRST_X_ASSUM_ST `hminus` MP_TAC); + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `gamma4fgcy` MP_TAC; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let gamma10_gamma11_ALT = prove_by_refinement( + `pack_nonlinear_non_ox3q1h ==> + (!y1 y2 y3 y4 y5 y6. + &2 * hminus <= y1 /\ y1 <= &2 * hplus /\ + &2 <= y2 /\ y2 < &2 * hminus /\ + &2 <= y3 /\ y3 < &2 * hminus /\ + &2 * hminus <= y4 /\ y4 <= sqrt8 /\ + &2 <= y5 /\ y5 < &2 * hminus /\ + &2 <= y6 /\ y6 < &2 * hminus /\ + rad2_y y1 y2 y3 y4 y5 y6 < &2 ==> + (#0.0057 <= gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6) + + beta_bumpA_y y1 y2 y3 y4 y5 y6 + + gamma3f y1 y2 y6 sqrt2 lmfun))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MP_TAC cell3_from_ineq_thm_ALT; + ASM_REWRITE_TAC[]; + DISCH_TAC; + MP_TAC gamma10_gamma11; + ANTS_TAC; + BY(ASM_REWRITE_TAC (map get_pack_nonlinear_non_ox3q1h ["GLFVCVK4 2477216213";"QITNPEA 5400790175 a";"QITNPEA 5400790175 b";"FWGKMBZ"])); + ASM_REWRITE_TAC[]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + + + +let gamma3_x_gamma3f = prove_by_refinement( + `!a b c y4 y5 y6. + &2 * hminus <= y4 /\ + &2 <= y5 /\ y5 <= &2 * hminus /\ + &2 <= y6 /\ y6 <= &2 * hminus ==> + gamma3f y4 y5 y6 sqrt2 lmfun = (gamma3_x (h0cut y4)) a b c (y4*y4) (y5*y5) (y6*y6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.gamma3f;Functional_equation.nonf_gamma3_x;Sphere.y_of_x;Sphere.vol3r;Sphere.vol3f;Sphere.vol_y]; + REWRITE_TAC[Sphere.dih_y;(* Merge_ineq *) sol_y_sol_x;LET_DEF;LET_END_DEF]; + REWRITE_TAC[Nonlinear_lemma.sqrt2_sqrt2]; + REPEAT WEAK_STRIP_TAC; + REPEAT (GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx); + ASM_SIMP_TAC[y_bounds]; + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + REWRITE_TAC[arith `x * #0.5 = x/ &2`]; + REWRITE_TAC[GSYM (* Merge_ineq *) lmfun_h0cut]; + REPEAT (GMATCH_SIMP_TAC (GSYM Nonlinear_lemma.lmfun_lfun)); + ASM_SIMP_TAC[y_bounds]; + BINOP_TAC; + REWRITE_TAC[ (arith `x * &2 * mm1/pi = (&2 * mm1/pi) * x`)]; + AP_TERM_TAC; + BY(MESON_TAC[(* Merge_ineq *) sol_x_sym;(* Merge_ineq *) sol_x_sym2]); + REWRITE_TAC[arith `x * &8 * mm2/ pi = (&8 * mm2 /pi) * x`]; + AP_TERM_TAC; + BY(MESON_TAC[Nonlinear_lemma.dih_x_sym2;Nonlinear_lemma.dih_x_sym]) + ]);; + (* }}} *) + +let atn_add = prove_by_refinement( + `!x y. abs(atn x + atn y) < pi / &2 ==> + atn x + atn y = atn ((x+y)/(&1 - x * y))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC Taylor_atn.tan_one_one; + GMATCH_SIMP_TAC TAN_ADD; + REWRITE_TAC[ATN_TAN;ATN_BOUND]; + ASM_REWRITE_TAC[COS_ATN_NZ]; + MATCH_MP_TAC Taylor_atn.cos_nz; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + + + +let atn_inv = prove_by_refinement( + `!x. &0 < x ==> atn x + atn (&1 / x) = pi/ &2`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ASM_SIMP_TAC[GSYM Trigonometry1.ATN2_BREAKDOWN]; + SIMP_TAC[arith `&0 < &1`; Trigonometry1.ATN2_BREAKDOWN]; + REWRITE_TAC[arith `x / &1 = x`]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let atn_add2 = prove_by_refinement( + `!x y. &0 < x /\ &0 < y /\ x * y < &1 ==> + atn x + atn y = atn ((x+y)/(&1 - x * y))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC atn_add; + MATCH_MP_TAC (arith `&0 < u /\ u < y ==> abs(u) < y`); + CONJ_TAC; + MATCH_MP_TAC (arith `&0 < x /\ &0 < y ==> &0 < x + y`); + BY(ASM_REWRITE_TAC[ ATN_POS_LT]); + INTRO_TAC ATN_MONO_LT [`y`;`&1 / x`]; + ANTS_TAC; + GMATCH_SIMP_TAC REAL_LT_RDIV_EQ; + ONCE_REWRITE_TAC[arith `x * y = y*x`]; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + GMATCH_SIMP_TAC (GSYM atn_inv); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `x`))); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let delta_x_rrr = prove_by_refinement( + `!x1 x2 x6 r. delta_x x1 x2 r r r x6 = -- x1 * x2 *x6 + r * ups_x x1 x2 x6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_x;Sphere.ups_x]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let rho_x_ups_x = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + rho_x x1 x2 x3 x4 x5 x6 * ups_x x1 x2 x6 = chi_x x4 x5 x3 x1 x2 x6 pow 2 + &4 * delta_x x1 x2 x3 x4 x5 x6 * x1 * x2 * x6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.rho_x;Sphere.chi_x;Sphere.delta_x;Sphere.ups_x]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let chi_rad2 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6 r. + rad2_x x1 x2 x3 x4 x5 x6 = r /\ ~(delta_x x1 x2 x3 x4 x5 x6 = &0) ==> + delta_x x1 x2 r r r x6 = (chi_x x4 x5 x3 x1 x2 x6 pow 2)/ (&4 * delta_x x1 x2 x3 x4 x5 x6)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.rad2_x;delta_x_rrr]; + REPEAT WEAK_STRIP_TAC; + EXPAND_TAC "r"; + SUBGOAL_THEN `rho_x x1 x2 x3 x4 x5 x6 / (delta_x x1 x2 x3 x4 x5 x6 * &4) * ups_x x1 x2 x6 = (rho_x x1 x2 x3 x4 x5 x6 * ups_x x1 x2 x6) / (&4 *delta_x x1 x2 x3 x4 x5 x6)` SUBST1_TAC; + Calc_derivative.CALC_ID_TAC; + BY(ASM_REWRITE_TAC[arith `~(&4 = &0)`]); + REWRITE_TAC[rho_x_ups_x]; + Calc_derivative.CALC_ID_TAC; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let delta_x4_rad2 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6 r. + rad2_x x1 x2 x3 x4 x5 x6 = r /\ ~(delta_x x1 x2 x3 x4 x5 x6 = &0) ==> + delta_x4 x1 x2 r r r x6 = x1 * (-- x1 + x2 + x6) + `, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.rad2_x]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.delta_x4]; + EXPAND_TAC "r"; + ABBREV_TAC `h = rho_x x1 x2 x3 x4 x5 x6`; + Calc_derivative.CALC_ID_TAC; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + + +let dih_x_rad2 = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6 r. + rad2_x x1 x2 x3 x4 x5 x6 = r /\ &0 < delta_x x1 x2 x3 x4 x5 x6 /\ &0 < x1 ==> + dih_x x1 x2 r r r x6 = pi/ &2 + atn2 (abs(chi_x x4 x5 x3 x1 x2 x6) , sqrt(x1 * delta_x x1 x2 x3 x4 x5 x6) * (x1 - x2 - x6))`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.dih_x;LET_DEF;LET_END_DEF]; + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC delta_x4_rad2; + GMATCH_SIMP_TAC chi_rad2; + GEXISTL_TAC [`x3`;`x4`;`x5`]; + ASM_SIMP_TAC[ arith `&0 < x ==> ~(x = &0)`]; + CONJ_TAC; + BY(ASM_MESON_TAC[arith `&0 < x ==> ~(x = &0)`]); + AP_TERM_TAC; + SUBGOAL_THEN `&0 < sqrt (x1 / delta_x x1 x2 x3 x4 x5 x6)` ASSUME_TAC; + GMATCH_SIMP_TAC SQRT_POS_LT; + GMATCH_SIMP_TAC REAL_LT_DIV; + BY(ASM_REWRITE_TAC[]); + SUBGOAL_THEN `sqrt (&4 * x1 * chi_x x4 x5 x3 x1 x2 x6 pow 2 / (&4 * delta_x x1 x2 x3 x4 x5 x6)) = (sqrt (x1 /delta_x x1 x2 x3 x4 x5 x6)) * abs(chi_x x4 x5 x3 x1 x2 x6)` SUBST1_TAC; + REWRITE_TAC[ GSYM POW_2_SQRT_ABS ]; + GMATCH_SIMP_TAC (GSYM SQRT_MUL); + REWRITE_TAC[ REAL_LE_POW_2]; + GMATCH_SIMP_TAC REAL_LE_DIV; + ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`]; + AP_TERM_TAC; + Calc_derivative.CALC_ID_TAC; + ASM_SIMP_TAC[arith `&0 < x ==> ~(x = &0)`]; + BY(REAL_ARITH_TAC); + SUBGOAL_THEN `-- (x1 * (-- x1 + x2 + x6)) = sqrt(x1 / delta_x x1 x2 x3 x4 x5 x6) * (sqrt (x1 * delta_x x1 x2 x3 x4 x5 x6) * (x1 - x2 - x6))` SUBST1_TAC; + ONCE_REWRITE_TAC[arith `x * y * z = (z * (x * y))`]; + GMATCH_SIMP_TAC (GSYM SQRT_MUL); + GMATCH_SIMP_TAC REAL_LE_MUL; + GMATCH_SIMP_TAC REAL_LE_DIV; + ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`]; + SUBGOAL_THEN `x1 / delta_x x1 x2 x3 x4 x5 x6 * x1 * delta_x x1 x2 x3 x4 x5 x6 = x1 pow 2` SUBST1_TAC; + Calc_derivative.CALC_ID_TAC; + BY(ASM_SIMP_TAC[arith `&0 < x ==> ~(x = &0)`]); + GMATCH_SIMP_TAC POW_2_SQRT; + CONJ_TAC; + BY(ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`]); + BY(REAL_ARITH_TAC); + MATCH_MP_TAC Trigonometry1.ATN2_LMUL_EQ; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +(* +let dih_circumrad = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6 r. + rad2_x x1 x2 x3 x4 x5 x6 = r ==> + dih_x x1 x2 r r r x6 + dih_x x1 r x3 r x5 r = dih_x x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + rt[Sphere.dih_x;LET_DEF;LET_END_DEF;Sphere.rad2_x] + ]);; + (* }}} *) +*) + +let gamma23_full8_x_gamma = prove_by_refinement( + (add_hyp ["GRKIBMP A V2"] `!y1 y2 y3 y4 y5 y6 . + eta_y y1 y2 y6 pow 2 < &2 /\ + eta_y y1 y3 y5 pow 2 < &2 /\ + &2 <= rad2_y y1 y2 y3 y4 y5 y6 /\ + dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + dih_y y1 sqrt2 y3 sqrt2 y5 sqrt2 <= dih_y y1 y2 y3 y4 y5 y6 + ==> + ineq [ + (&2 * hminus, y1, &2 * hplus); + (&2 ,y2,&2 * hminus); + (&2,y3,&2 * hminus); + (&2,y4,sqrt8); + (&2,y5,&2 * hminus); + (&2,y6,&2 * hminus) + ] + ( + y_of_x (gamma23_full8_x (h0cut y1)) y1 y2 y3 y4 y5 y6 <= + gamma3f y1 y2 y6 sqrt2 lmfun + gamma3f y1 y3 y5 sqrt2 lmfun + + (dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - dih_y y1 sqrt2 y3 sqrt2 y5 sqrt2) * gamma2_x_div_azim_v2 (h0cut y1) (y1* y1))`) +, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Functional_equation.nonf_gamma23_full8_x;Sphere.y_of_x]; + REPEAT (GMATCH_SIMP_TAC (GSYM gamma3_x_gamma3f)); + ASM_SIMP_TAC[y_bounds]; + REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF;Nonlinear_lemma.sqrt2_sqrt2]; + MATCH_MP_TAC( arith `u <= v ==> (x + y + u <= x + y + v)`); + REWRITE_TAC[ arith `x - (y + z) = x - y - z`]; + GMATCH_SIMP_TAC Real_ext.REAL_LE_LMUL_IMP; + CONJ2_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`y1`;`&1`;`&1`;`&1`;`&1`;`&1`]); + ASM_SIMP_TAC[y_bounds;arith `&1 <= &1`]; + REWRITE_TAC[Functional_equation.nonf_gamma2_x1_div_a_v2;Sphere.y_of_x]; + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `dih_y` MP_TAC; + REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF]; + REWRITE_TAC[Nonlinear_lemma.sqrt2_sqrt2]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + +let undiv_gamma3 = prove_by_refinement( + `!y4 y5 y6 w. + &2 <= y4 /\ + &2 <= y5 /\ + &2 <= y6 /\ + y4 <= &2 * sqrt (&2) /\ + y5 <= &2 * sqrt (&2) /\ + y6 <= &2 * hminus /\ + eta_x (y4 * y4) (y5 * y5) (y6 * y6) < sqrt (&2) /\ + #0.008 *y_of_x dih4_x_div_sqrtdelta_posbranch sqrt2 sqrt2 sqrt2 y4 y5 y6 < + y_of_x (gamma3f_x_div_sqrtdelta (h0cut y4) (h0cut y5) (&1)) sqrt2 sqrt2 sqrt2 y4 y5 y6 / w ==> #0.008 * dih_y y4 sqrt2 y6 sqrt2 y5 sqrt2 < gamma3f y4 y5 y6 sqrt2 lmfun /w`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC gamma3f_gamma3f_x_div_sqrtdelta; + GEXISTL_TAC [`sqrt2 * sqrt2`;`sqrt2 * sqrt2`;`sqrt2 * sqrt2`]; + ASM_SIMP_TAC[y_bounds]; + REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF]; + REWRITE_TAC[Nonlinear_lemma.sqrt2_sqrt2]; + GMATCH_SIMP_TAC dih_x_dih_x_div_sqrtdelta_posbranch; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + SUBGOAL_THEN `delta_x4 (y4 * y4) (y5 * y5) (&2) (&2) (&2) (y6 * y6) = delta_x4 (y4*y4) (&2) (y5 * y5) (&2) (y6*y6) (&2)` SUBST1_TAC; + REWRITE_TAC[Sphere.delta_x4]; + BY((REAL_ARITH_TAC)); + GMATCH_SIMP_TAC (* Merge_ineq *) delta_x4_pos; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_SIMP_TAC[y_bounds]; + REWRITE_TAC[arith `&4 = &2 * &2 /\ &8 = #8.0`;GSYM Nonlinear_lemma.sqrt8_2]; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + REWRITE_TAC[arith `abs(&2) = &2`]; + GMATCH_SIMP_TAC (arith `&0 <= y ==> abs(y) = y`); + ASM_SIMP_TAC[y_bounds]; + SUBGOAL_THEN `y4 < sqrt8` ASSUME_TAC; + MATCH_MP_TAC ETA_Y_LE_IMP_LT; + REWRITE_TAC[Sphere.eta_y;LET_DEF;LET_END_DEF]; + GEXISTL_TAC [`y5`;`y6`]; + ASM_SIMP_TAC[y_bounds]; + BY((ASM_SIMP_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2])); + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `delta_x (y4 * y4) (y5 * y5) (&2) (&2) (&2) (y6 * y6) = delta_x (&2) (&2) (&2) (y4 * y4) (y5 * y5) (y6 * y6) ` SUBST1_TAC; + REWRITE_TAC[Sphere.delta_x]; + BY((REAL_ARITH_TAC)); + SUBGOAL_THEN `delta_x (y4 * y4) (&2) (y6 * y6) (&2) (y5 * y5) (&2) = delta_x (&2) (&2) (&2) (y4 * y4) (y5 * y5) (y6 * y6) ` SUBST1_TAC; + REWRITE_TAC[Sphere.delta_x]; + BY((REAL_ARITH_TAC)); + SUBCONJ_TAC; + GMATCH_SIMP_TAC (MESON[ETA_Y_BOUNDS] `!y4 y5 y6. &2 <= y4 /\ y4 <= sqrt8 /\ &2 <= y5 /\ y5 <= sqrt8 /\ &2 <= y6 /\ y6 <= sqrt8 /\ eta_y y4 y5 y6 < sqrt2 ==> &0 < delta_x (&2) (&2) (&2) (y4 * y4) (y5*y5) (y6*y6)`); + REWRITE_TAC[Sphere.eta_y;LET_DEF;LET_END_DEF]; + ASM_SIMP_TAC[y_bounds]; + BY((ASM_SIMP_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2])); + DISCH_TAC; + INTRO_TAC Optimize.h0cutC [`y6`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + ONCE_REWRITE_TAC[arith `(a * b * c < (e * b)/w) <=> (b * (a *c) < b * (e/w))`]; + GMATCH_SIMP_TAC REAL_LT_LMUL_EQ; + GMATCH_SIMP_TAC SQRT_POS_LT; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `y_of_x` MP_TAC; + REWRITE_TAC[Sphere.y_of_x]; + REWRITE_TAC[Nonlinear_lemma.sqrt2_sqrt2]; + BY((REWRITE_TAC[Nonlin_def.dih4_x_div_sqrtdelta_posbranch;Sphere.rotate4])) + ]);; + (* }}} *) + + + +let undiv_gamma3_nn = prove_by_refinement( + `!y4 y5 y6 w w'. + &0 < w' /\ + &0 <= gamma3f y4 y5 y6 sqrt2 lmfun /\ + &2 <= y4 /\ + &2 <= y5 /\ + &2 <= y6 /\ + y4 <= &2 * sqrt (&2) /\ + y5 <= &2 * sqrt (&2) /\ + y6 <= &2 * hminus /\ + eta_x (y4 * y4) (y5 * y5) (y6 * y6) < sqrt (&2) /\ + w' <= w /\ + #0.008 *y_of_x dih4_x_div_sqrtdelta_posbranch sqrt2 sqrt2 sqrt2 y4 y5 y6 < + y_of_x (gamma3f_x_div_sqrtdelta (h0cut y4) (h0cut y5) (&1)) sqrt2 sqrt2 sqrt2 y4 y5 y6 / w ==> #0.008 * dih_y y4 sqrt2 y6 sqrt2 y5 sqrt2 < gamma3f y4 y5 y6 sqrt2 lmfun /w'`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC REAL_LTE_TRANS; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `gamma3f y4 y5 y6 sqrt2 lmfun / w`))); + CONJ_TAC; + MATCH_MP_TAC undiv_gamma3; + BY(ASM_REWRITE_TAC[]); + GMATCH_SIMP_TAC REAL_LE_RDIV_EQ; + REWRITE_TAC[arith `x / y * z = (x * z) / y`]; + GMATCH_SIMP_TAC REAL_LE_LDIV_EQ; + GMATCH_SIMP_TAC Real_ext.REAL_LE_LMUL_IMP; + BY(ASM_MESON_TAC[arith `&0 < w' /\ w' <= w ==> &0 < w`]) + ]);; + (* }}} *) + + + +(* final hypothesis is contained in cell3_from_ineq_thm *) + +let cell3_008_from_ineq = `!y1 y2 y6. + &2 *hminus <= y1 /\ &2 <= y2 /\ &2 <= y6 /\ + y1 <= &2 * hplus /\ y2 <= &2 * sqrt(&2) /\ y6 <= &2 * sqrt(&2) /\ + eta_y (y1) (y2) (y6) < sqrt(&2) /\ &0 <= gamma3f y1 y2 y6 sqrt2 lmfun ==> + dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 * #0.008 <= gamma3f y1 y2 y6 sqrt2 lmfun / &(wtcount3_y y1 y2 y6)`;; + +let cell3_008 = + add_hyp [ "QZECFIC wt1";"QZECFIC wt2 A";"CIHTIUM";(* "CJFZZDW"; *)] + cell3_008_from_ineq;; + +(* +g cell3_008;; +g (mk_imp(`pack_nonlinear_non_ox3q1h`,cell3_008_from_ineq));; +*) + +let cell3_008_from_ineq_thm = prove_by_refinement( + cell3_008, + (* {{{ proof *) + [ + DISCH_TAC; + COMMENT "0. symmetry reduction"; + SUBGOAL_THEN `!(p:real->real->real->bool). (!y1 y2 y6. p y1 y2 y6 ==> p y1 y6 y2) /\ (!y1 y2 y6. y6 <= y2 ==> p y1 y2 y6) ==> (!y1 y2 y6. p y1 y2 y6)` MATCH_MP_TAC; + BY(MESON_TAC[arith `y <= x \/ x <= y`]); + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `( /\ )` MP_TAC; + ASM_SIMP_TAC[]; + SUBGOAL_THEN `gamma3f y1 y2 y6 sqrt2 lmfun = gamma3f y1 y6 y2 sqrt2 lmfun` SUBST1_TAC; + BY(ASM_MESON_TAC[(* Merge_ineq *) gamma3f_sym]); + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ASM_MESON_TAC[Collect_geom.ETA_Y_SYYM]); + SUBGOAL_THEN `dih_y y1 y6 sqrt2 sqrt2 sqrt2 y2 = dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6` SUBST1_TAC; + BY(MESON_TAC[Nonlinear_lemma.dih_y_sym;Nonlinear_lemma.dih_y_sym2]); + SUBGOAL_THEN `wtcount3_y y1 y6 y2 = wtcount3_y y1 y2 y6` SUBST1_TAC; + REWRITE_TAC[Sphere.wtcount3_y]; + BY(ARITH_TAC); + BY(MESON_TAC[]); + REPEAT GEN_TAC; + DISCH_THEN BURY_TAC; + ABBREV_TAC `Q = (\y1 y2 y6. &2 * hminus <= y1 /\ &2 <= y2 /\ &2 <= y6 /\ y1 <= &2 * hplus /\ y2 <= &2 * sqrt (&2) /\ y6 <= &2 * sqrt (&2) /\ eta_y y1 y2 y6 < sqrt (&2))`; + DISCH_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`Q y1 y2 y6`) ASSUME_TAC)); + EXPAND_TAC "Q"; + BY(BY((ASM_REWRITE_TAC[]))); + INTRO_TAC ETA_Y_BOUNDS [`y1`;`y2`;`y6`]; + ANTS_TAC; + BY(ASM_SIMP_TAC[y_bounds;Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2]); + REPEAT WEAK_STRIP_TAC; + INTRO_TAC ETA_Y_LE_IMP_LT_ALL [`y1`;`y2`;`y6`]; + ANTS_TAC; + BY((((ASM_SIMP_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2;y_bounds])))); + REPEAT WEAK_STRIP_TAC; + COMMENT "1. remove excess variables"; + REPEAT (FIRST_X_ASSUM_ST `ineq` MP_TAC); + REWRITE_TAC[ineq_constant]; + REWRITE_TAC[ RIGHT_FORALL_IMP_THM]; + REWRITE_TAC[MESON[] `(!y. (y = a ==> P y)) <=> P a`]; + REPEAT WEAK_STRIP_TAC; + COMMENT "2. insert Q"; + REPEAT (FIRST_X_ASSUM_ST `ineq` MP_TAC); + REWRITE_TAC[arith `!x y. x > y <=> y < x`;arith `!x y. x >= y <=> y <= x`]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!P. (!y4 y5 y6. P y4 y5 y6) ==> (!y4 y5 y6. Q y4 y5 y6 ==> P y4 y5 y6)`) MP_TAC)); + BY((((MESON_TAC[])))); + DISCH_THEN (fun t -> (REPEAT (DISCH_THEN (ASSUME_TAC o (MATCH_MP t))))); + COMMENT "3. remove eta_y"; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!R f. (!y4 y5 y6. Q y4 y5 y6 ==> ineq (R y4 y5 y6) (f y4 y5 y6 \/ &2 < eta_y y4 y5 y6 pow 2)) ==> (!y4 y5 y6. Q y4 y5 y6 ==> ineq (R y4 y5 y6) (f y4 y5 y6))`) MP_TAC)); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPECL ( envl w [`y4`;`y5`;`y6'`]))))); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC ineq_monotone; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `~(&2 < eta_y y4 y5 y6' pow 2)`))); + BY((((MESON_TAC[])))); + MATCH_MP_TAC (arith `x < &2 ==> ~(&2 < x)`); + FIRST_X_ASSUM MP_TAC; + EXPAND_TAC "Q"; + DISCH_TAC; + REWRITE_TAC[GSYM Nonlinear_lemma.sqrt2_sqrt2]; + REWRITE_TAC[arith `x pow 2 = x * x`]; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE; + GMATCH_SIMP_TAC (arith `&0 <= x ==> (abs x = x)`); + ASM_REWRITE_TAC[Sphere.sqrt2]; + MATCH_MP_TAC eta_y_nn; + BY((((ASM_MESON_TAC[ETA_Y_BOUNDS;y_bounds;arith `x < y ==> x <= y`;Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2])))); + DISCH_THEN (fun t -> (REPEAT (FIRST_X_ASSUM_ST `eta_y` (fun CONJUNCTS_THEN2 -> ASSUME_TAC (MATCH_MP t CONJUNCTS_THEN2)))) THEN MP_TAC t); + MP_TAC (MESON[] `!y4 y5 y6. &2 < eta_y y4 y5 y6 pow 2 <=> (F \/ &2 < eta_y y4 y5 y6 pow 2)`); + DISCH_THEN (fun t -> REPEAT (FIRST_X_ASSUM_ST `eta_y` (MP_TAC o (ONCE_REWRITE_RULE[t])))); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + (DISCH_THEN (fun t -> (REPEAT (FIRST_X_ASSUM_ST `eta_y` (fun CONJUNCTS_THEN2 -> ASSUME_TAC (MATCH_MP t CONJUNCTS_THEN2)))) THEN MP_TAC t)); + DISCH_THEN kill; + COMMENT "add weight counts"; + SUBGOAL_THEN `critical_edge_y y1` ASSUME_TAC; + REWRITE_TAC[Sphere.critical_edge_y]; + BY(ASM_SIMP_TAC[y_bounds]); + SUBGOAL_THEN `y6 < &2 * hminus` ASSUME_TAC; + REWRITE_TAC[arith `x < y <=> ~(y <= x)`]; + DISCH_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`y1`;`y2`;`y6`]); + ASM_SIMP_TAC[y_bounds;Sphere.ineq]; + ASM_SIMP_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2]; + REWRITE_TAC[TAUT `(~(a ==> ~b)) <=> (a /\ b)`]; + CONJ2_TAC; + BY(ASM_MESON_TAC[arith `x <= y /\ y <= z ==> x <= z`]); + BY(ASM_MESON_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2;y_bounds]); + SUBGOAL_THEN `~critical_edge_y y6` ASSUME_TAC; + BY(ASM_REWRITE_TAC[Sphere.critical_edge_y;arith `x <= y <=> ~(y < x)`]); + SUBGOAL_THEN `wtcount3_y y1 y2 y6 = if critical_edge_y y2 then 2 else 1` ASSUME_TAC; + ASM_REWRITE_TAC[Sphere.wtcount3_y]; + BY(COND_CASES_TAC THEN TRY (ARITH_TAC)); + COMMENT "4. apply undiv_gamma3"; + MATCH_MP_TAC (arith `a * b < c ==> b * a <= c`); + SUBGOAL_THEN `dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 = dih_y y1 sqrt2 y6 sqrt2 y2 sqrt2` SUBST1_TAC; + BY(MESON_TAC[Nonlinear_lemma.dih_y_sym;Nonlinear_lemma.dih_y_sym2]); + MATCH_MP_TAC undiv_gamma3_nn; + ASM_SIMP_TAC[y_bounds]; + REWRITE_TAC[RIGHT_EXISTS_AND_THM]; + CONJ_TAC; + BY(COND_CASES_TAC THEN REAL_ARITH_TAC); + CONJ_TAC; + FIRST_X_ASSUM_ST `eta_y` MP_TAC; + BY(REWRITE_TAC[Sphere.eta_y;LET_DEF;LET_END_DEF]); + COMMENT "5. split along y2"; + ASM_CASES_TAC `y2 < &2 * hminus`; + SUBGOAL_THEN `~critical_edge_y y2` (unlist REWRITE_TAC); + REWRITE_TAC[Sphere.critical_edge_y]; + BY(ASM_SIMP_TAC[arith `x < y ==> ~(y <= x)`]); + EXISTS_TAC `&1`; + REWRITE_TAC[arith `&1 <= &1`]; + SUBGOAL_THEN `h0cut y2 = &1` SUBST1_TAC; + MATCH_MP_TAC Optimize.h0cutC; + BY(ASM_SIMP_TAC[arith `x < y ==> (x <= y)`]); + REWRITE_TAC[arith `x/ &1 = x`]; + FIRST_X_ASSUM_ST `h0cut` MP_TAC; + REWRITE_TAC[Sphere.ineq;TAUT `(a ==> b ==> c) <=> (a /\ b ==> c)`]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_SIMP_TAC [arith `x < y ==> x <= y`]); + COMMENT "5a. second half of split"; + EXISTS_TAC `&2`; + CONJ_TAC; + BY(COND_CASES_TAC THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `x / &2 ` MP_TAC; + REWRITE_TAC[Sphere.ineq;TAUT `(a ==> b ==> c) <=> (a /\ b ==> c)`]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_SIMP_TAC [arith `~(x < y) ==> y <= x`;arith `x < y ==> x<= y`]) + ]);; + (* }}} *) + +let cell3_008_from_ineq_ALT = prove_by_refinement( +`pack_nonlinear_non_ox3q1h ==> (!y1 y2 y6. + &2 *hminus <= y1 /\ &2 <= y2 /\ &2 <= y6 /\ + y1 <= &2 * hplus /\ y2 <= &2 * sqrt(&2) /\ y6 <= &2 * sqrt(&2) /\ + eta_y (y1) (y2) (y6) < sqrt(&2) + ==> + dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 * #0.008 <= gamma3f y1 y2 y6 sqrt2 lmfun / &(wtcount3_y y1 y2 y6))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MP_TAC cell3_from_ineq_thm_ALT; + ASM_REWRITE_TAC[]; + DISCH_TAC; + MP_TAC cell3_008_from_ineq_thm; + ANTS_TAC; + BY((ASM_REWRITE_TAC (map get_pack_nonlinear_non_ox3q1h ["QZECFIC wt1";"QZECFIC wt2 A";"CIHTIUM"]))); + DISCH_THEN MATCH_MP_TAC; + (ASM_REWRITE_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM_ST `hminus` MP_TAC; + MP_TAC Nonlinear_lemma.hminus_gt; + BY(REAL_ARITH_TAC); + BY(ASM_MESON_TAC[y_bounds]) + ]);; + (* }}} *) + + + +let gamma23_keep135_x_gamma = prove_by_refinement( + (add_hyp ["GRKIBMP A V2"] `!y1 y2 y3 y4 y5 y6 . + eta_y y1 y2 y6 pow 2 < &2 /\ + eta_y y1 y3 y5 pow 2 < &2 /\ + &2 <= rad2_y y1 y2 y3 y4 y5 y6 /\ + dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 * #0.008 <= gamma3f y1 y2 y6 sqrt2 lmfun / &(wtcount3_y y1 y2 y6) /\ + dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + dih_y y1 sqrt2 y3 sqrt2 y5 sqrt2 <= dih_y y1 y2 y3 y4 y5 y6 + ==> + ineq [ + (&2 * hminus, y1, &2 * hplus); + (&2 ,y2,sqrt8); + (&2,y3,&2 * hminus); + (&2,y4,sqrt8); + (&2,y5,&2 * hminus); + (&2,y6,sqrt8) + ] + ( + y_of_x (gamma23_keep135_x (h0cut y1)) y1 y2 y3 y4 y5 y6 <= + gamma3f y1 y2 y6 sqrt2 lmfun / &(wtcount3_y y1 y2 y6) + gamma3f y1 y3 y5 sqrt2 lmfun + + (dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - dih_y y1 sqrt2 y3 sqrt2 y5 sqrt2) * gamma2_x_div_azim_v2 (h0cut y1) (y1* y1))`), + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Functional_equation.nonf_gamma23_keep135_x;Sphere.y_of_x]; + REPEAT (GMATCH_SIMP_TAC (GSYM gamma3_x_gamma3f)); + ASM_SIMP_TAC[y_bounds]; + MATCH_MP_TAC (arith `u <= w + v ==> (x + u <= w + x + v)`); + MATCH_MP_TAC (arith `(?f1 f2. f1 + f2 = f /\ f1 <= x /\ f2 <= y) ==> f <= x + y`); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 * #0.008`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `(dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - dih_y y1 sqrt2 y3 sqrt2 y5 sqrt2) * #0.008 `))); + REPEAT (FIRST_X_ASSUM_ST `dih_y` MP_TAC); + REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF;Nonlinear_lemma.sqrt2_sqrt2]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC Real_ext.REAL_LE_LMUL_IMP; + CONJ_TAC; + FIRST_X_ASSUM MP_TAC; + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `gamma2_x1_div_a_v2` (C INTRO_TAC [`y1`;`&1`;`&1`;`&1`;`&1`;`&1`]); + ASM_SIMP_TAC[y_bounds;arith `&1 <= &1`]; + REWRITE_TAC[Sphere.y_of_x;Functional_equation.nonf_gamma2_x1_div_a_v2]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + + +(* ========================================================================== *) +(* MATERIAL ADDED FEB 2013 *) +(* ========================================================================== *) + +let ineq_critical_edge2 = prove_by_refinement( + `!u v y f. + ( y < &2 * hminus ==> + ineq (APPEND u (CONS (&2,y,&2 * hminus) v)) f) /\ + ineq (APPEND u (CONS (&2 * hminus,y,sqrt8) v)) f ==> + ineq (APPEND u (CONS (&2,y,sqrt8) v)) f`, + (* {{{ proof *) + [ + REWRITE_TAC[ineq_APPEND;Sphere.critical_edge_y]; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `(y <= &2 * hminus ==> y <= sqrt8) /\ (&2 * hminus <= y ==> &2 <= y)` ASSUME_TAC; + BY(ASM_SIMP_TAC[y_bounds]); + DISJ_CASES_TAC (arith `y < &2 * hminus \/ &2 * hminus <= y`); + FIRST_X_ASSUM_ST `ineq` kill; + FIRST_X_ASSUM_ST `ineq` MP_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC ineq_monotone; + BY(ASM_MESON_TAC[arith `y < x ==> y <= x`]); + FIRST_X_ASSUM_ST `ineq` MP_TAC; + MATCH_MP_TAC ineq_monotone; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let CRIT2_TAC n = + CHOP_LIST_TAC n THEN + MATCH_MP_TAC ( ineq_critical_edge2) + THEN ASM_REWRITE_TAC[APPEND];; + + +let ineq_critical_edge3 = prove_by_refinement( + `!u v y f. + ( y < &2 * hminus ==> + ineq (APPEND u (CONS (&2,y,&2 * hminus) v)) f) /\ + ( &2 * hplus < y ==> + ineq (APPEND u (CONS (&2 * hplus,y,sqrt8) v)) f) /\ + ineq (APPEND u (CONS (&2 * hminus,y,&2 * hplus) v)) f ==> + ineq (APPEND u (CONS (&2,y,sqrt8) v)) f`, + (* {{{ proof *) + [ + REWRITE_TAC[ineq_APPEND;Sphere.critical_edge_y]; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `(y <= &2 * hminus ==> y <= sqrt8) /\ (&2 * hminus <= y ==> &2 <= y)` ASSUME_TAC; + BY(ASM_SIMP_TAC[y_bounds]); + SUBGOAL_THEN `(y <= &2 * hplus ==> y <= sqrt8) /\ (&2 * hplus < y ==> &2 <= y)` ASSUME_TAC; + MP_TAC hminus_lt_hplus; + (MP_TAC y_bounds); + REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; + DISCH_THEN (C INTRO_TAC [`y`]); + REPEAT WEAK_STRIP_TAC; + CONJ_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); + BY(REAL_ARITH_TAC); + DISJ_CASES_TAC (arith `y < &2 * hminus \/ (&2 * hminus <= y /\ y <= &2 * hplus) \/ (&2 * hplus < y)`); + FIRST_X_ASSUM (fun t -> (FIRST_X_ASSUM (fun s -> MP_TAC (MATCH_MP t s) THEN ASSUME_TAC s))); + MATCH_MP_TAC ineq_monotone; + BY(ASM_MESON_TAC[arith `y < x ==> y <= x`]); + FIRST_X_ASSUM DISJ_CASES_TAC; + FIRST_X_ASSUM_ST `ineq` MP_TAC; + MATCH_MP_TAC ineq_monotone; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM (fun t -> (FIRST_X_ASSUM (fun s -> MP_TAC (MATCH_MP t s) THEN ASSUME_TAC s))); + MATCH_MP_TAC ineq_monotone; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_MESON_TAC[arith `y < x ==> y <= x`]) + ]);; + (* }}} *) + +let CRIT3_TAC n = + CHOP_LIST_TAC n THEN + MATCH_MP_TAC ( ineq_critical_edge3) + THEN ASM_REWRITE_TAC[APPEND];; + +let ineq_critical_edge4 = prove_by_refinement( + `!u v y f. + ( &2 * hplus < y ==> + ineq (APPEND u (CONS (&2 * hplus,y,sqrt8) v)) f) /\ + ineq (APPEND u (CONS (&2 * hminus,y,&2 * hplus) v)) f ==> + ineq (APPEND u (CONS (&2 * hminus,y,sqrt8) v)) f`, + (* {{{ proof *) + [ + REWRITE_TAC[ineq_APPEND;Sphere.critical_edge_y]; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `(y <= &2 * hminus ==> y <= sqrt8) /\ (&2 * hminus <= y ==> &2 <= y)` ASSUME_TAC; + BY(ASM_SIMP_TAC[y_bounds]); + SUBGOAL_THEN `(y <= &2 * hplus ==> y <= sqrt8) /\ (&2 * hplus < y ==> &2 *hminus <= y)` ASSUME_TAC; + MP_TAC hminus_lt_hplus; + (MP_TAC y_bounds); + REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; + DISCH_THEN (C INTRO_TAC [`y`]); + REPEAT WEAK_STRIP_TAC; + CONJ_TAC; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM MP_TAC; + BY(REAL_ARITH_TAC); + DISJ_CASES_TAC (arith `(&2 * hplus < y) \/ (y <= &2 * hplus)`); + FIRST_X_ASSUM (fun t -> (FIRST_X_ASSUM (fun s -> MP_TAC (MATCH_MP t s) THEN ASSUME_TAC s))); + MATCH_MP_TAC ineq_monotone; + BY(ASM_MESON_TAC[arith `y < x ==> y <= x`]); + FIRST_X_ASSUM_ST `ineq` MP_TAC; + MATCH_MP_TAC ineq_monotone; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let CRIT4_TAC n = + CHOP_LIST_TAC n THEN + MATCH_MP_TAC ( ineq_critical_edge4) + THEN ASM_REWRITE_TAC[APPEND];; + +(* XX tchales 2013/2/16. I don't believe that 3803737830 is ever + used. I think it may be possible to delete! *) + +(* QITNPEA4 series 3803737830. + We assume type QX, so exclude QU (quarters). + We use TSKAJXY to assume &0 <= gamma4fgcy. *) + +(* Feb 2013. I don't think this gets used ... +let QITNPEA4_3803737830_concl = `!y1 y2 y3 y4 y5 y6. + ineq [(&2 * hminus, y1, &2 * hplus); + (&2 ,y2, sqrt8); + (&2,y3,sqrt8); + (&2,y4,sqrt8); + (&2,y5,sqrt8); + (&2,y6,sqrt8)] + (rad2_y y1 y2 y3 y4 y5 y6 < &2 /\ + (~(y2 < &2 * hminus /\ y3 < &2 * hminus /\ + y4 < &2 * hminus /\ y5 < &2 * hminus /\ y6 < &2 * hminus)) /\ + (&0 <= gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun ) + ==> + (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6) + + beta_bumpA_y y1 y2 y3 y4 y5 y6 + - #0.0105256 + #0.00522841*dih_y y1 y2 y3 y4 y5 y6 > #0.0))`;; + +let QITNPEA4_3803737830_full_hypl = [ +"QITNPEA4 0 0 0 1 3803737830"; +"QITNPEA4 0 0 1 0 3803737830"; +"QITNPEA4 0 1 0 0 3803737830"; +"QITNPEA4 1 0 0 0 3803737830"; +"QITNPEA4 0 0 1 1 3803737830"; +"QITNPEA4 0 1 0 1 3803737830"; +"QITNPEA4 1 0 0 1 3803737830"; +"QITNPEA4 0 1 1 0 3803737830"; +"QITNPEA4 1 0 1 0 3803737830"; +"QITNPEA4 1 1 0 0 3803737830"; +"QITNPEA4 0 1 1 1 3803737830"; +"QITNPEA4 1 0 1 1 3803737830"; +"QITNPEA4 1 1 0 1 3803737830"; +"QITNPEA4 1 1 1 0 3803737830"; +"QITNPEA4 1 1 1 1 3803737830"; +"QITNPEA4 3803737830 supercritical"; +"CIHTIUM"; +"FWGKMBZ"; +];; + +let QITNPEA4_3803737830_full = add_hyp + QITNPEA4_3803737830_full_hypl + QITNPEA4_3803737830_concl;; + +let QITNPEA4_3803737830 = prove_by_refinement( + QITNPEA4_3803737830_full, + (* {{{ proof *) + [ + REPEAT DISCH_TAC; + COMMENT "WLOG. y2 <= y6"; + SUBGOAL_THEN `!(p:real->real->real->real->real->real->bool). ((!y1 y2 y3 y4 y5 y6. (p y1 y2 y3 y4 y5 y6 ==> p y1 y6 y5 y4 y3 y2)) /\ (!y1 y2 y3 y4 y5 y6. (y2 <= y6) ==> p y1 y2 y3 y4 y5 y6)) ==> (!y1 y2 y3 y4 y5 y6. p y1 y2 y3 y4 y5 y6)` MATCH_MP_TAC; + BY(MESON_TAC[arith `y <= x \/ x <= y`]); + CONJ_TAC; + REPEAT GEN_TAC; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `gamma4fgcy` MP_TAC); + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `gamma4fgcy y1 y6 y5 y4 y3 y2 lmfun = gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun` SUBST1_TAC; + BY(MESON_TAC[gamma4fgcy_sym23;gamma4fgcy_sym12;gamma4fgcy_sym03]); + SUBGOAL_THEN `wtcount6_y y1 y6 y5 y4 y3 y2 = wtcount6_y y1 y2 y3 y4 y5 y6` SUBST1_TAC; + BY(REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y] THEN ARITH_TAC); + SUBGOAL_THEN `beta_bumpA_y y1 y6 y5 y4 y3 y2 = beta_bumpA_y y1 y2 y3 y4 y5 y6` SUBST1_TAC; + REWRITE_TAC[ Sphere.beta_bumpA_y]; + BY(REAL_ARITH_TAC); + SUBGOAL_THEN `dih_y y1 y6 y5 y4 y3 y2 = dih_y y1 y2 y3 y4 y5 y6` SUBST1_TAC; + BY(MESON_TAC[Nonlinear_lemma.dih_y_sym;Nonlinear_lemma.dih_y_sym2]); + SUBGOAL_THEN `rad2_y y1 y2 y3 y4 y5 y6 = rad2_y y1 y6 y5 y4 y3 y2` SUBST1_TAC; + BY(MESON_TAC[rad2_y_sym]); + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); + BY(MESON_TAC[]); + COMMENT "WLOG y2 < &2 * hminus"; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `delta_x` MP_TAC; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `delta_x` (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]); + REWRITE_TAC[Sphere.ineq;arith `x > &0 <=> &0 < x`;Sphere.y_of_x]; + ASM_SIMP_TAC[y_bounds]; + DISCH_TAC; + FIRST_X_ASSUM_ST `eta_y` (C INTRO_TAC [`&1`;`&1`;`&1`;`y1`;`y2`;`y6`]); + REWRITE_TAC[Sphere.ineq;arith `&1 <= &1`]; + ASM_SIMP_TAC[y_bounds]; + SUBGOAL_THEN `y1 <= sqrt8` ASSUME_TAC; + REWRITE_TAC[Nonlinear_lemma.sqrt8_sqrt2]; + BY(ASM_SIMP_TAC[y_bounds;Sphere.sqrt2]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC rad2_eta2 [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + ASM_SIMP_TAC[y_bounds;Sphere.delta_y]; + DISCH_TAC; + ASM_CASES_TAC `&2 * hminus <= y2`; + FIRST_X_ASSUM_ST `>` MP_TAC; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `eta_y` MP_TAC; + BY(REAL_ARITH_TAC); + COMMENT "remove rad2"; + FIRST_X_ASSUM_ST `rad2_y` MP_TAC; + REWRITE_TAC[Sphere.rad2_y]; + DISCH_THEN (fun t -> ASSUME_TAC (MATCH_MP (arith `x < &2 ==> ~(x > &2)`) t)); + REPEAT (FIRST_X_ASSUM_ST `ineq` (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`])); + ASM_REWRITE_TAC[]; + (COMMENT "0 < weight"); + SUBGOAL_THEN `critical_edge_y y1` ASSUME_TAC; + REWRITE_TAC[Sphere.critical_edge_y]; + BY(ASM_REWRITE_TAC[]); + SUBGOAL_THEN `&0 < &(wtcount6_y y1 y2 y3 y4 y5 y6)` ASSUME_TAC; + REWRITE_TAC[ REAL_OF_NUM_LT]; + REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + ASM_REWRITE_TAC[]; + BY(ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + ASM_CASES_TAC `y2 < &2 * hminus /\ y3 < &2 * hminus /\ y5 < &2 * hminus /\ y6 < &2 * hminus`; + SUBGOAL_THEN `&2 * hminus <= y4` ASSUME_TAC; + FIRST_X_ASSUM MP_TAC; + REPEAT (FIRST_X_ASSUM_ST `~x` MP_TAC); + REWRITE_TAC[arith `&2 * hminus <= y4 <=> ~(y4 < &2 * hminus)`]; + BY(REAL_ARITH_TAC); + SUBGOAL_THEN `~critical_edge_y y2 /\ ~critical_edge_y y3 /\ ~critical_edge_y y5 /\ ~critical_edge_y y6` ASSUME_TAC; + BY(ASM_SIMP_TAC[Sphere.critical_edge_y;arith `!x. x < &2 * hminus ==> ~(&2 * hminus <= x)`]); + SUBGOAL_THEN `wtcount6_y y1 y2 y3 y4 y5 y6 = if critical_edge_y y4 then (2) else (1)` SUBST1_TAC; + ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + BY(COND_CASES_TAC THEN ARITH_TAC); + SUBGOAL_THEN `beta_bumpA_y y1 y2 y3 y4 y5 y6 = if critical_edge_y y4 then &1 * beta_bump_force_y y1 y2 y3 y4 y5 y6 else (&0)` SUBST1_TAC; + ASM_REWRITE_TAC[ Sphere.beta_bumpA_y;Sphere.beta_bump_force_y]; + BY(COND_CASES_TAC THEN REAL_ARITH_TAC); + ASM_CASES_TAC `critical_edge_y y4`; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `&1 * x` MP_TAC; + REWRITE_TAC[Sphere.ineq]; + BY(ASM_SIMP_TAC[y_bounds;arith `!x. x < &2 * hminus ==> x <= &2 * hminus`]); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `ineq` MP_TAC; + REWRITE_TAC[Sphere.ineq]; + ASM_SIMP_TAC[y_bounds;arith `!x. x < &2 * hminus ==> x <= &2 * hminus`]; + ANTS_TAC; + FIRST_X_ASSUM MP_TAC; + FIRST_X_ASSUM_ST `hminus` MP_TAC; + BY(MESON_TAC[Sphere.critical_edge_y;arith `~(y <= &2 * hplus) ==> &2 * hplus <= y`]); + BY(REAL_ARITH_TAC); + COMMENT "remove beta_bumpA_y"; + SUBGOAL_THEN `beta_bumpA_y y1 y2 y3 y4 y5 y6 = &0` SUBST1_TAC; + ASM_REWRITE_TAC[ Sphere.beta_bumpA_y]; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[DE_MORGAN_THM]; + BY(COND_CASES_TAC THEN (TRY REAL_ARITH_TAC)); + FIRST_X_ASSUM_ST `ineq` kill; + REPEAT (FIRST_X_ASSUM_ST `ineq` MP_TAC); + REWRITE_TAC[arith `&0 * x = &0`]; + REPEAT DISCH_TAC; + COMMENT "fix weights"; + SUBGOAL_THEN `!a w' f g. ineq a (f / &w' + g > #0.0) ==> ineq a (&0 <= f /\ wtcount6_y y1 y2 y3 y4 y5 y6 <= w') ==> ineq a (f / &(wtcount6_y y1 y2 y3 y4 y5 y6) + g > #0.0)` MP_TAC; + REPEAT GEN_TAC; + DISCH_TAC; + MATCH_MP_TAC ineq_MP; + FIRST_X_ASSUM MP_TAC; + MATCH_MP_TAC ineq_monotone; + REPEAT WEAK_STRIP_TAC; + ENOUGH_TO_SHOW_TAC `f/ &w' <= f/ &(wtcount6_y y1 y2 y3 y4 y5 y6)`; + REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC); + BY(REAL_ARITH_TAC); + REWRITE_TAC[real_div]; + GMATCH_SIMP_TAC Real_ext.REAL_LE_LMUL_IMP; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LE_INV2; + ASM_REWRITE_TAC[]; + REWRITE_TAC[ REAL_OF_NUM_LE]; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM_ST `&1 * x` kill; + DISCH_THEN (fun t -> REPEAT (FIRST_X_ASSUM_ST `ineq` (fun s -> MP_TAC(MATCH_MP t s)))); + ASM_REWRITE_TAC[ineq_T]; + REPEAT WEAK_STRIP_TAC; + ABBREV_TAC `ccc = (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6) + &0 - #0.0105256 + #0.00522841 * dih_y y1 y2 y3 y4 y5 y6 > #0.0)`; + FIRST_X_ASSUM kill; + COMMENT "make strict ineqs"; + ENOUGH_TO_SHOW_TAC `ineq [(&2 * hminus, y1, &2 * hplus); (&2 ,y2, &2 * hminus); (&2,y3,sqrt8); (&2,y4,sqrt8); (&2,y5,sqrt8); (&2,y6,sqrt8)] ccc`; + REWRITE_TAC[Sphere.ineq]; + BY(ASM_SIMP_TAC[arith `~(x <= y2) ==> (y2 <= x)`]); + SUBGOAL_THEN `(( y2 < &2 * hminus /\ y3 < &2 * hminus /\ y5 < &2 * hminus /\ y6 < &2 * hminus) ==> ineq [&2 * hminus,y1,&2 * hplus; &2,y2,&2 * hminus; &2 ,y3,&2 * hminus;&2,y4,&2 * hminus; &2 ,y5,&2 * hminus; &2 ,y6,&2 * hminus] ccc) /\ (( y2 < &2 * hminus /\ y3 < &2 * hminus /\ y5 < &2 * hminus /\ y6 < &2 * hminus) ==> ineq [&2 * hminus,y1,&2 * hplus; &2,y2,&2 * hminus; &2 ,y3,&2 * hminus;&2 * hminus,y4,sqrt8; &2 ,y5,&2 * hminus; &2 ,y6,&2 * hminus] ccc)` MP_TAC; + REWRITE_TAC[Sphere.ineq;Sphere.critical_edge_y]; + FIRST_X_ASSUM_ST `~x` MP_TAC; + MP_TAC hminus_lt_hplus; + BY(REAL_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `~critical_edge_y y2 /\ y2 < &2 * hminus` MP_TAC; + REWRITE_TAC[Sphere.critical_edge_y]; + BY(ASM_SIMP_TAC[ arith `~(x <= y2) ==> (y2 < x)`]); + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `!y. y < &2 * hminus ==> ~critical_edge_y y` ASSUME_TAC; + REWRITE_TAC[Sphere.critical_edge_y]; + BY(REAL_ARITH_TAC); + COMMENT "split cases"; + CRIT2_TAC 2 THEN CONJ_TAC THEN REPEAT WEAK_STRIP_TAC THEN CRIT2_TAC 3 THEN CONJ_TAC THEN REPEAT WEAK_STRIP_TAC THEN CRIT2_TAC 4 THEN CONJ_TAC THEN REPEAT WEAK_STRIP_TAC THEN CRIT2_TAC 5 THEN CONJ_TAC THEN REPEAT WEAK_STRIP_TAC THEN (TRY (FIRST_X_ASSUM MATCH_MP_TAC)) THEN (REPEAT (FIRST_X_ASSUM_ST `ineq` kill)) THEN ASM_REWRITE_TAC[Sphere.ineq;Sphere.wtcount6_y;Sphere.wtcount3_y] THEN REPEAT WEAK_STRIP_TAC THEN ASM_SIMP_TAC[] THEN TRY(ARITH_TAC); + REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC); + BY(MESON_TAC[]); + REPLICATE_TAC 10 (FIRST_X_ASSUM MP_TAC); + BY(MESON_TAC[]) + ]);; + (* }}} *) +*) + +(* I don't think this gets used. Feb 2013. +let QITNPEA4_3803737830_ALT = prove_by_refinement( + (mk_imp (`pack_nonlinear_non_ox3q1h`,QITNPEA4_3803737830_concl)), + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MP_TAC QITNPEA4_3803737830; + ASM_REWRITE_TAC (map get_pack_nonlinear_non_ox3q1h QITNPEA4_3803737830_full_hypl); + BY(DISCH_THEN (unlist REWRITE_TAC)) + ]);; + (* }}} *) +*) + +let QITNPEA1_9063653052_concl = `!y1 y2 y3 y4 y5 y6. + ineq [(&2 * hminus, y1, &2 * hplus); + (&2 ,y2, &2 * hminus); + (&2* hminus,y3,sqrt8); + (&2,y4,sqrt8); + (&2,y5,&2 * hminus); + (&2,y6,&2 * hminus)] + (rad2_y y1 y2 y3 y4 y5 y6 < &2 /\ + (&0 <= gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun ) /\ + (y2 < &2 * hminus /\ y5 < &2 * hminus /\ y6 < &2 * hminus) + ==> + (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6) + > #0.0057))`;; + +let QITNPEA1_9063653052_hypl = + [ +"QITNPEA1 1 0 9063653052 A"; +"QITNPEA1 1 1 9063653052 A"; +"QITNPEA1 1 2 9063653052 A"; +"QITNPEA1 2 0 9063653052 A"; +"QITNPEA1 2 1 9063653052 A"; +"QITNPEA1 2 2 9063653052 A"; +] ;; + +let QITNPEA1_9063653052_full = add_hyp + QITNPEA1_9063653052_hypl + QITNPEA1_9063653052_concl;; + +let QITNPEA_9063653052_weak = prove_by_refinement( + QITNPEA1_9063653052_full, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + COMMENT "remove rad2"; + FIRST_X_ASSUM_ST `rad2_y` MP_TAC; + REWRITE_TAC[Sphere.rad2_y]; + DISCH_THEN (ASSUME_TAC o (MATCH_MP (arith `x < &2 ==> ~(x > &2)`))); + REPEAT (FIRST_X_ASSUM_ST `ineq` (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`])); + ASM_REWRITE_TAC[]; + (COMMENT "0 < weight"); + SUBGOAL_THEN `critical_edge_y y1` ASSUME_TAC; + REWRITE_TAC[Sphere.critical_edge_y]; + BY(ASM_REWRITE_TAC[]); + SUBGOAL_THEN `&0 < &(wtcount6_y y1 y2 y3 y4 y5 y6)` ASSUME_TAC; + REWRITE_TAC[ REAL_OF_NUM_LT]; + REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + ASM_REWRITE_TAC[]; + BY(ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + COMMENT "fix weights"; + SUBGOAL_THEN `!a w' f . ineq a (f / &w' > #0.0057) ==> ineq a (&0 <= f /\ wtcount6_y y1 y2 y3 y4 y5 y6 <= w') ==> ineq a (f / &(wtcount6_y y1 y2 y3 y4 y5 y6) > #0.0057)` MP_TAC; + REPEAT GEN_TAC; + DISCH_TAC; + MATCH_MP_TAC ineq_MP; + FIRST_X_ASSUM MP_TAC; + MATCH_MP_TAC ineq_monotone; + REPEAT WEAK_STRIP_TAC; + ENOUGH_TO_SHOW_TAC `f/ &w' <= f/ &(wtcount6_y y1 y2 y3 y4 y5 y6)`; + REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC); + BY(REAL_ARITH_TAC); + REWRITE_TAC[real_div]; + GMATCH_SIMP_TAC Real_ext.REAL_LE_LMUL_IMP; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LE_INV2; + ASM_REWRITE_TAC[]; + REWRITE_TAC[ REAL_OF_NUM_LE]; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN (fun t -> REPEAT (FIRST_X_ASSUM_ST `ineq` (fun s -> MP_TAC(MATCH_MP t s)))); + ASM_REWRITE_TAC[ineq_T]; + REPEAT WEAK_STRIP_TAC; + ABBREV_TAC `ccc = (gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6) > #0.0057)`; + FIRST_X_ASSUM kill; + COMMENT "make strict ineqs"; + ENOUGH_TO_SHOW_TAC `ineq [(&2 * hminus, y1, &2 * hplus); (&2 ,y2, &2 * hminus); (&2* hminus,y3,sqrt8); (&2,y4,sqrt8); (&2,y5,&2 * hminus); (&2,y6,&2 * hminus)] ccc`; + REWRITE_TAC[Sphere.ineq]; + BY(ASM_REWRITE_TAC[]); + SUBGOAL_THEN `!y. y < &2 * hminus ==> ~critical_edge_y y` ASSUME_TAC; + REWRITE_TAC[Sphere.critical_edge_y]; + BY(REAL_ARITH_TAC); + SUBGOAL_THEN `!y. &2 * hplus < y ==> ~critical_edge_y y` ASSUME_TAC; + REWRITE_TAC[Sphere.critical_edge_y]; + BY(REAL_ARITH_TAC); + SUBGOAL_THEN `~critical_edge_y y2 /\ ~critical_edge_y y5 /\ ~critical_edge_y y6` MP_TAC; + FIRST_X_ASSUM kill; + BY(ASM_MESON_TAC[]); + REPEAT STRIP_TAC; + BY(CRIT3_TAC 3 THEN REPEAT CONJ_TAC THEN REPEAT WEAK_STRIP_TAC THEN TRY(CRIT4_TAC 2 THEN CONJ_TAC THEN REPEAT WEAK_STRIP_TAC) THEN TRY(FIRST_X_ASSUM MATCH_MP_TAC) THEN (REPEAT (FIRST_X_ASSUM_ST `ineq` kill)) THEN ASM_REWRITE_TAC[Sphere.ineq;Sphere.wtcount6_y;Sphere.wtcount3_y] THEN REPEAT WEAK_STRIP_TAC THEN ASM_SIMP_TAC[] THEN TRY(ARITH_TAC)) + ]);; + (* }}} *) + +let QITNPEA4_9063653052_weak_ALT = prove_by_refinement( + (mk_imp (`pack_nonlinear_non_ox3q1h`,QITNPEA1_9063653052_concl)), + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MP_TAC QITNPEA_9063653052_weak; + ASM_REWRITE_TAC (map get_pack_nonlinear_non_ox3q1h QITNPEA1_9063653052_hypl); + BY(DISCH_THEN (unlist REWRITE_TAC)) + ]);; + (* }}} *) + +let g_qxd_concl = + `!y1 y2 y3 y4 y5 y6. + ineq [(&2 * hminus,y1, &2 * hplus); + (&2,y2, sqrt8); + (&2,y3, sqrt8); + (&2,y4, sqrt8); + (&2,y5, sqrt8); + (&2,y6, sqrt8) + ] + (#2.3 < dih_y y1 y2 y3 y4 y5 y6 ==> + #0.0057 < gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6) + beta_bumpA_y y1 y2 y3 y4 y5 y6)`;; + +let g_qxd_hypl = [ + "BIXPCGW 7080972881 a2"; + "BIXPCGW 1738910218 a2"; + "BIXPCGW 7274157868 a"; +];; + +let g_qxd_full = add_hyp g_qxd_hypl g_qxd_concl;; + +let g_qxd = prove_by_refinement( + g_qxd_full, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + CRIT2_TAC 1; + CONJ2_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM kill); + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]); + REWRITE_TAC[Sphere.ineq]; + ASM_SIMP_TAC[]; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + DISCH_TAC; + CRIT2_TAC 2; + CONJ2_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `ineq` kill); + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`y1`;`y3`;`y2`;`y4`;`y6`;`y5`]); + REWRITE_TAC[Sphere.ineq]; + ASM_SIMP_TAC[y_bounds]; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP (arith `x < y ==> ~(y < x)`))); + BY(MESON_TAC[Nonlinear_lemma.dih_y_sym;Nonlinear_lemma.dih_y_sym2]); + DISCH_TAC; + CRIT2_TAC 4; + CONJ2_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `ineq` kill); + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`y1`;`y5`;`y6`;`y4`;`y2`;`y3`]); + REWRITE_TAC[Sphere.ineq]; + ASM_SIMP_TAC[y_bounds]; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP (arith `x < y ==> ~(y < x)`))); + BY(MESON_TAC[Nonlinear_lemma.dih_y_sym;Nonlinear_lemma.dih_y_sym2]); + DISCH_TAC; + CRIT2_TAC 5; + CONJ2_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `ineq` kill); + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`y1`;`y6`;`y5`;`y4`;`y3`;`y2`]); + REWRITE_TAC[Sphere.ineq]; + ASM_SIMP_TAC[y_bounds]; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP (arith `x < y ==> ~(y < x)`))); + BY(MESON_TAC[Nonlinear_lemma.dih_y_sym;Nonlinear_lemma.dih_y_sym2]); + DISCH_TAC; + ASM_CASES_TAC `y4 <= &2 * hplus`; + FIRST_X_ASSUM_ST `ineq` kill; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `ineq` (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]); + REWRITE_TAC[Sphere.ineq]; + ASM_SIMP_TAC[y_bounds]; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP (arith `x < y ==> ~(y < x)`))); + BY(MESON_TAC[]); + SUBGOAL_THEN `!y. y < &2 * hminus ==> ~critical_edge_y y` ASSUME_TAC; + BY(REWRITE_TAC[Sphere.critical_edge_y] THEN REAL_ARITH_TAC); + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `critical_edge_y y1` ASSUME_TAC; + BY(REWRITE_TAC[Sphere.critical_edge_y] THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN REAL_ARITH_TAC); + SUBGOAL_THEN `~critical_edge_y y4` ASSUME_TAC; + BY(REWRITE_TAC[Sphere.critical_edge_y] THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN REAL_ARITH_TAC); + SUBGOAL_THEN `wtcount6_y y1 y2 y3 y4 y5 y6 = 1` SUBST1_TAC; + ASM_SIMP_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + BY(ARITH_TAC); + SUBGOAL_THEN `beta_bumpA_y y1 y2 y3 y4 y5 y6 = &0` SUBST1_TAC; + ASM_SIMP_TAC[Sphere.beta_bumpA_y]; + BY(REAL_ARITH_TAC); + REWRITE_TAC[arith `x / &1 = x /\ x + &0 = x`]; + REWRITE_TAC[arith `x < y <=> y > x`]; + FIRST_X_ASSUM_ST `ineq` (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]); + REWRITE_TAC[Sphere.ineq]; + ASM_SIMP_TAC[y_bounds]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let g_qxd_ALT = prove_by_refinement( + (mk_imp (`pack_nonlinear_non_ox3q1h`,g_qxd_concl)), + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MP_TAC g_qxd; + ASM_REWRITE_TAC (map get_pack_nonlinear_non_ox3q1h g_qxd_hypl); + BY(DISCH_THEN (unlist REWRITE_TAC)) + ]);; + (* }}} *) + +let gamma_qx_concl = `!y1 y2 y3 y4 y5 y6. ineq + [(&2 * hminus, y1, &2 * hplus); + (&2,y2,sqrt8); + (&2,y3,sqrt8); + (&2,y4,sqrt8); + (&2,y5,sqrt8); + (&2,y6,sqrt8) + ] + ((rad2_y y1 y2 y3 y4 y5 y6 < &2) /\ + ~(y2 < &2 * hminus /\ y3 < &2 * hminus /\ y4 < &2 * hminus /\ y5 < &2 * hminus /\ y6 < &2 * hminus) + ==> (&0 < gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun / &(wtcount6_y y1 y2 y3 y4 y5 y6) + beta_bumpA_y y1 y2 y3 y4 y5 y6))`;; + +let gamma_qx_hypl = [ +"GLFVCVK4 2477216213"; +"GLFVCVK4a 8328676778"; +];; + +let gamma_qx_full = add_hyp gamma_qx_hypl gamma_qx_concl;; + +let gamma_qx = prove_by_refinement( + gamma_qx_full, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.ineq]; + REPEAT WEAK_STRIP_TAC; + REPEAT (FIRST_X_ASSUM (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`])); + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `critical_edge_y y1` ASSUME_TAC; + REWRITE_TAC[Sphere.critical_edge_y]; + BY(ASM_SIMP_TAC[]); + SUBGOAL_THEN `&0 < &(wtcount6_y y1 y2 y3 y4 y5 y6)` ASSUME_TAC; + REWRITE_TAC[ REAL_OF_NUM_LT]; + REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + ASM_REWRITE_TAC[]; + BY(ARITH_TAC); + COMMENT "case wt2-beta"; + ASM_CASES_TAC `y2 < &2 * hminus /\ y3 < &2 * hminus /\ critical_edge_y y4 /\ y5 < &2 * hminus /\ y6 < &2 * hminus`; + SUBGOAL_THEN `!y. y < &2 * hminus ==> ~critical_edge_y y` ASSUME_TAC; + BY(REWRITE_TAC[Sphere.critical_edge_y] THEN REAL_ARITH_TAC); + SUBGOAL_THEN `wtcount6_y y1 y2 y3 y4 y5 y6 = 2` SUBST1_TAC; + ASM_SIMP_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + BY(ARITH_TAC); + SUBGOAL_THEN `beta_bumpA_y y1 y2 y3 y4 y5 y6 = beta_bump_force_y y1 y2 y3 y4 y5 y6` SUBST1_TAC; + ASM_SIMP_TAC[Sphere.beta_bumpA_y;Sphere.beta_bump_force_y]; + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `ineq` MP_TAC; + ASM_SIMP_TAC[Sphere.ineq;arith `x < y ==> x <= y`]; + ASM_SIMP_TAC[GSYM Sphere.rad2_y;arith `x < y ==> ~( x > y)`]; + REWRITE_TAC[arith `x > y <=> y < x`]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_MESON_TAC[Sphere.critical_edge_y]); + COMMENT "beta_bumpA_y =0"; + SUBGOAL_THEN `beta_bumpA_y y1 y2 y3 y4 y5 y6 = &0` SUBST1_TAC; + REWRITE_TAC[Sphere.beta_bumpA_y]; + REPEAT COND_CASES_TAC THEN TRY(REAL_ARITH_TAC); + BY(ASM_MESON_TAC[]); + REWRITE_TAC[arith `x + &0 = x`]; + GMATCH_SIMP_TAC REAL_LT_DIV; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `ineq` kill; + FIRST_X_ASSUM_ST `ineq` MP_TAC; + ASM_SIMP_TAC[Sphere.ineq;y_bounds]; + ASM_REWRITE_TAC[GSYM Sphere.rad2_y]; + SUBGOAL_THEN `~(norm2hh y1 y2 y3 y4 y5 y6 < (hplus - hminus) pow 2)` (unlist REWRITE_TAC); + DISCH_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP quarter_norm2hh)); + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM_ST `rad2_y` MP_TAC; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let gamma_qx_ALT = prove_by_refinement( + (mk_imp (`pack_nonlinear_non_ox3q1h`,gamma_qx_concl)), + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MP_TAC gamma_qx; + ASM_REWRITE_TAC (map get_pack_nonlinear_non_ox3q1h gamma_qx_hypl); + BY(DISCH_THEN (unlist REWRITE_TAC)) + ]);; + (* }}} *) + + end;; diff --git a/text_formalization/nonlinear/mk_all_ineq.hl b/text_formalization/nonlinear/mk_all_ineq.hl new file mode 100644 index 0000000..21d5148 --- /dev/null +++ b/text_formalization/nonlinear/mk_all_ineq.hl @@ -0,0 +1,149 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: nonlinear inequalities *) +(* Author: Thomas Hales *) +(* Date: 2013-01-28 *) +(* ========================================================================== *) + +(* generate all theorems of terms in !Ineq.ineqs from a single assumption `prepared_nonlinear:bool`, + defined as the conjunction of all inequalities in prep.hl + + Taking this a step further, we would get |- prepared_nonlinear ==> nonlinear + + *) + +flyspeck_needs "nonlinear/prep.hl";; + +module Mk_all_ineq = struct + + open Optimize;; + +let mk_nonlinear = + let ineql = map (fun idv -> idv.ineq) !Ineq.ineqs in + let ineq_conj = end_itlist (curry mk_conj) ineql in + let _ = new_definition (mk_eq (`nonlinear:bool`,ineq_conj)) in + ();; + +let get_nonlinear = + let sl = map (fun ind -> ind.idv) !Ineq.ineqs in + let ineql = map (fun idv -> idv.ineq) !Ineq.ineqs in + let ineq_conj = end_itlist (curry mk_conj) ineql in + let th = new_definition (mk_eq (`nonlinear:bool`,ineq_conj)) in + let th1 = UNDISCH (MATCH_MP (TAUT `(a <=> b) ==> (a ==> b)`) th) in + let co1 thm = if (is_conj (concl thm)) then CONJUNCT1 thm else thm in + fun s -> + let i = index s sl in + let th2 = funpow i CONJUNCT2 th1 in + co1 th2;; + +(* +let prep_ineqs = ref ([]:ineq_datum list);; + +let add_inequality i = + let _ = prep_ineqs:= i :: !prep_ineqs in + ();; +*) + +let prep_ineqs = Prep.prep_ineqs;; + +let mk_prepared_nonlinear = + let ineql = map (fun idv -> idv.ineq) (!prep_ineqs) in + let ineq_conj = end_itlist (curry mk_conj) ineql in + let _ = new_definition (mk_eq (`prepared_nonlinear:bool`,ineq_conj)) in + ();; + +let get_prep_nonlinear = + let sl = map (fun ind -> ind.idv) !prep_ineqs in + let ineql = map (fun ind -> ind.ineq) (!prep_ineqs) in + let ineq_conj = end_itlist (curry mk_conj) ineql in + let th = new_definition (mk_eq (`prepared_nonlinear:bool`,ineq_conj)) in + let th1 = UNDISCH (MATCH_MP (TAUT `(a <=> b) ==> (a ==> b)`) th) in + let co1 thm = if (is_conj (concl thm)) then CONJUNCT1 thm else thm in + fun s -> + let i = index s sl in + let th2 = funpow i CONJUNCT2 th1 in + co1 th2;; + +let hasprefix s sl = filter (fun t -> (String.length s <= String.length t) && + (String.sub t 0 (String.length s) = s)) (sl);; + +let get_all_prep_nonlinear = + let sl = map (fun ind -> ind.idv) !prep_ineqs in + let ineql = map (fun ind -> ind.ineq) (!prep_ineqs) in + let ineq_conj = end_itlist (curry mk_conj) ineql in + let th = new_definition (mk_eq (`prepared_nonlinear:bool`,ineq_conj)) in + let th1 = UNDISCH (MATCH_MP (TAUT `(a <=> b) ==> (a ==> b)`) th) in + let co1 thm = if (is_conj (concl thm)) then CONJUNCT1 thm else thm in + let c i thm = co1 (funpow i CONJUNCT2 thm) in + let get s = c (index s sl) th1 in + fun s -> + try [get s] with + Failure _ -> + (let s' = s^" split(" in + let ssl = hasprefix s' sl in + map get ssl);; + +let example1 = get_all_prep_nonlinear "GLFVCVK4a 8328676778";; + +(* This follows the same sequence in the module Optimize that is used to generate the inequalities + in prep.hl, finishing off the last step of the proof with a rewrite. *) + +let prove_ineq s = + let DSPLIT_TAC i = DISCH_TAC THEN (Optimize.SPLIT_H0_TAC i) in + let LET_ELIM_TAC = CONV_TAC (REDEPTH_CONV let_CONV) in + let is_xconvert tags = mem Xconvert tags in + let is_branch tags = mem Branching tags in + let NONL = `prepared_nonlinear:bool` in + let idq = hd(Ineq.getexact s) in + let (s',tags,ineq) = idq_fields idq in + let _ = (s = s') or failwith "prove_ineq: wrong ineq" in + try (s,prove(mk_imp(NONL,ineq), + LET_ELIM_TAC THEN + EVERY (map DSPLIT_TAC (get_split_tags idq)) THEN + EVERY + [LET_ELIM_TAC; + PRELIM_REWRITE_TAC; + if (is_branch tags) then BRANCH_TAC else ALL_TAC; + if (is_xconvert tags) then X_OF_Y_TAC else ALL_TAC; + if (is_branch tags && not(is_xconvert tags)) then SERIES3Q1H_5D_TAC else ALL_TAC; + STYLIZE_TAC; + WRAPUP_TAC; + REWRITE_TAC (get_all_prep_nonlinear s)])) + with Failure m -> failwith (s^" "^m);; + +let example2 = map prove_ineq ["GLFVCVK4a 8328676778";"4750199435";"GLFVCVK4 2477216213 y4supercrit"];; + +Ineq.getexact "4528012043";; +prove_ineq "4528012043";; + +let exec() = + let sl = map (fun t -> t.idv) !Ineq.ineqs in + map prove_ineq sl;; + +(* (* experimental, combine subgoals into a a single subgoal. *) +let (merge1_goal:refinement) = + fun (meta,sgs,just) -> + if List.length sgs < 2 then (meta,sgs,just) + else + let s0::s1::s2 = sgs in + let _ = fst(s0) = [] or failwith "merge1_goal asl nonempty" in + let _ = fst(s1) = [] or failwith "merge1_goal asl nonempty" in + let sgs' = ([],mk_conj (snd s0, snd s1)) ::s2 in + let just' i ths = + (just i ( (CONJUNCT1 (hd ths)) :: (CONJUNCT2 ( (hd ths))) :: tl ths)) in + (meta,sgs',just');; + +let rec merge_all_goal (meta,sgs,just) = + if (List.length sgs < 2) then (meta,sgs,just) + else merge_all_goal (merge1_goal (meta,sgs,just));; + +let top_asl_thm() = + let (_,sgs,f)::_ = !current_goalstack in + let t = snd(hd sgs) in + DISCH t (f null_inst [ASSUME t]);; +*) + + + + end;; diff --git a/text_formalization/nonlinear/nonlin_def.hl b/text_formalization/nonlinear/nonlin_def.hl new file mode 100644 index 0000000..0f65c80 --- /dev/null +++ b/text_formalization/nonlinear/nonlin_def.hl @@ -0,0 +1,522 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Nonlinear *) +(* Author: Thomas C. Hales *) +(* Date: 2012-11-30 *) +(* ========================================================================== *) + +(* +Combine definitions for nonlinear inequalities here. +*) + + +module Nonlin_def = struct + +(* From lemma.hl *) + +let NONLIN = new_definition `NONLIN = T`;; + +let sqrt_x1 = define `sqrt_x1 x1 x2 x3 x4 x5 x6 = sqrt x1`;; + +let sqrt_x2 = define `sqrt_x2 x1 x2 x3 x4 x5 x6 = sqrt x2`;; + +let sqrt_x3 = define `sqrt_x3 x1 x2 x3 x4 x5 x6 = sqrt x3`;; + +let sqrt_x4 = define `sqrt_x4 x1 x2 x3 x4 x5 x6 = sqrt x4`;; + +let sqrt_x5 = define `sqrt_x5 x1 x2 x3 x4 x5 x6 = sqrt x5`;; + +let sqrt_x6 = define `sqrt_x6 x1 x2 x3 x4 x5 x6 = sqrt x6`;; + +let halfbump_x = new_definition `halfbump_x x = bump (sqrt x / &2)`;; + +let halfbump_x1 = new_definition `halfbump_x1 x1 x2 x3 x4 x5 x6 = halfbump_x x1`;; + +let halfbump_x4 = new_definition `halfbump_x4 x1 x2 x3 x4 x5 x6 = halfbump_x x4`;; + +let unit6 = define `unit6 x1 x2 x3 x4 x5 x6 = &1`;; + +let proj_x1 = define `proj_x1 (x1:A) (x2:B) (x3:C) (x4:D) (x5:E) (x6:F) = x1`;; + +let proj_x2 = define `proj_x2 (x1:A) (x2:B) (x3:C) (x4:D) (x5:E) (x6:F) = x2`;; + +let proj_x3 = define `proj_x3 (x1:A) (x2:B) (x3:C) (x4:D) (x5:E) (x6:F) = x3`;; + +let proj_x4 = define `proj_x4 (x1:A) (x2:B) (x3:C) (x4:D) (x5:E) (x6:F) = x4`;; + +let proj_x5 = define `proj_x5 (x1:A) (x2:B) (x3:C) (x4:D) (x5:E) (x6:F) = x5`;; + +let proj_x6 = define `proj_x6 (x1:A) (x2:B) (x3:C) (x4:D) (x5:E) (x6:F) = x6`;; + +let promote = define `promote f (x1:A) (x2:B) (x3:C) (x4:D) (x5:E) (x6:F) = f x1`;; + +let unit0 = define `unit0 = &1`;; + +let pow1 = new_definition `pow1 y = y pow 1`;; + +let pow2 = new_definition `pow2 y = y pow 2`;; + +let pow3 = new_definition `pow3 y = y pow 3`;; + +let pow4 = new_definition `pow4 y = y pow 4`;; + +let promote_pow2 = new_definition `promote_pow2 x1 (x2:A) (x3:B) (x4:C) (x5:D) (x6:E) = x1 pow 2`;; + +let promote_pow3 = new_definition `promote_pow3 x1 (x2:A) (x3:B) (x4:C) (x5:D) (x6:E) = x1 pow 3`;; + +(* +let promote_pow3r = INST_TYPE [(`:real`,`:A`);(`:real`,`:B`);(`:real`,`:C`);(`:real`,`:D`);(`:real`,`:E`)] promote_pow3;; +*) + +let compose6 = new_definition `compose6 f p1 p2 p3 p4 p5 p6 + (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + (f:real->real->real->real->real->real->real) + (p1 x1 x2 x3 x4 x5 x6) + (p2 x1 x2 x3 x4 x5 x6) + (p3 x1 x2 x3 x4 x5 x6) + (p4 x1 x2 x3 x4 x5 x6) + (p5 x1 x2 x3 x4 x5 x6) + (p6 x1 x2 x3 x4 x5 x6)`;; + +let scale6 = new_definition `scale6 f + (r:real) (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = + (f x1 x2 x3 x4 x5 x6) * r`;; + + + +let quadratic_root_plus_curry = + new_definition `quadratic_root_plus_curry a b c = quadratic_root_plus (a,b,c)`;; + +(* ---- *) + +let sq_pow2 = prove_by_refinement( + `!a x. a pow 2 <= x ==> (sqrt x * sqrt x = x)`, + (* {{{ proof *) + [ + REWRITE_TAC[GSYM REAL_POW_2;SQRT_POW2]; + MESON_TAC[REAL_LE_TRANS;Collect_geom.REAL_LE_SQUARE_POW]; + ]);; + (* }}} *) + +let sqrt2_sqrt2 = prove_by_refinement( + `sqrt2 * sqrt2 = &2`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.sqrt2]; + MATCH_MP_TAC sq_pow2; + EXISTS_TAC`&0`; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +(* This is valid when a > 0 *) + +let sol_euler_x_div_sqrtdelta = new_definition + `sol_euler_x_div_sqrtdelta x1 x2 x3 x4 x5 x6 = + (let a = sqrt(x1*x2*x3) + sqrt( x1)*(x2 + x3 - x4)/ &2 + + sqrt(x2)*(x1 + x3 - x5)/ &2 + sqrt(x3)*(x1 + x2 - x6)/ &2 in + (matan ((delta_x x1 x2 x3 x4 x5 x6)/(&4 * a pow 2 )))/( a))`;; + +let sol_euler246_x_div_sqrtdelta = new_definition + `sol_euler246_x_div_sqrtdelta = rotate4 sol_euler_x_div_sqrtdelta`;; + +let sol_euler345_x_div_sqrtdelta = new_definition + `sol_euler345_x_div_sqrtdelta = rotate5 sol_euler_x_div_sqrtdelta`;; + +let sol_euler156_x_div_sqrtdelta = new_definition + `sol_euler156_x_div_sqrtdelta = rotate6 sol_euler_x_div_sqrtdelta`;; + +(* This is a valid formula for dih_x / sqrt(delta) when delta >0 and d_x4 !=0 *) + +let dih_x_div_sqrtdelta = `dih_x_div_sqrtdelta x1 x2 x3 x4 x5 x6 = + ( let d_x4 = delta_x4 x1 x2 x3 x4 x5 x6 in + let d = delta_x x1 x2 x3 x4 x5 x6 in + let pi_shift = if (d_x4 < &0) then pi else (&0) in + pi_shift + (sqrt(&4 * x1) / d_x4) * matan((&4 * x1 * d)/(d_x4 pow 2)))`;; + +let dih_x_div_sqrtdelta_posbranch = new_definition + `dih_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 = + ( let d_x4 = delta_x4 x1 x2 x3 x4 x5 x6 in + let d = delta_x x1 x2 x3 x4 x5 x6 in + (sqrt(&4 * x1) / d_x4) * matan((&4 * x1 * d)/(d_x4 pow 2)))`;; + +let ldih_x_div_sqrtdelta_posbranch = new_definition + `ldih_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 = + lfun(sqrt(x1) / &2) * dih_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let ldih2_x_div_sqrtdelta_posbranch = new_definition + `ldih2_x_div_sqrtdelta_posbranch = rotate2 ldih_x_div_sqrtdelta_posbranch`;; + +let ldih3_x_div_sqrtdelta_posbranch = new_definition + `ldih3_x_div_sqrtdelta_posbranch = rotate3 ldih_x_div_sqrtdelta_posbranch`;; + +let ldih5_x_div_sqrtdelta_posbranch = new_definition + `ldih5_x_div_sqrtdelta_posbranch = rotate5 ldih_x_div_sqrtdelta_posbranch`;; + +let ldih6_x_div_sqrtdelta_posbranch = new_definition + `ldih6_x_div_sqrtdelta_posbranch = rotate6 ldih_x_div_sqrtdelta_posbranch`;; + +let dih3_x_div_sqrtdelta_posbranch = new_definition + `dih3_x_div_sqrtdelta_posbranch = rotate3 dih_x_div_sqrtdelta_posbranch`;; + +let dih4_x_div_sqrtdelta_posbranch = new_definition + `dih4_x_div_sqrtdelta_posbranch = rotate4 dih_x_div_sqrtdelta_posbranch`;; + +let dih5_x_div_sqrtdelta_posbranch = new_definition + `dih5_x_div_sqrtdelta_posbranch = rotate5 dih_x_div_sqrtdelta_posbranch`;; + +let rhazim_x_div_sqrtdelta_posbranch = new_definition + `rhazim_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 = + rho(sqrt(x1)) * dih_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let rhazim2_x_div_sqrtdelta_posbranch = new_definition + `rhazim2_x_div_sqrtdelta_posbranch = + rotate2 rhazim_x_div_sqrtdelta_posbranch`;; + +let rhazim3_x_div_sqrtdelta_posbranch = new_definition + `rhazim3_x_div_sqrtdelta_posbranch = + rotate3 rhazim_x_div_sqrtdelta_posbranch`;; + +let tau_residual_x = new_definition + `tau_residual_x x1 x2 x3 x4 x5 x6 = + rhazim_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 ++ rhazim2_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 ++ rhazim3_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + + +let lmdih_x_div_sqrtdelta_posbranch = new_definition + `lmdih_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 = + lmfun(sqrt(x1) / &2) * dih_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let lmdih2_x_div_sqrtdelta_posbranch = new_definition + `lmdih2_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 = + rotate2 lmdih_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let lmdih3_x_div_sqrtdelta_posbranch = new_definition + `lmdih3_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 = + rotate3 lmdih_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 `;; + +let lmdih5_x_div_sqrtdelta_posbranch = new_definition + `lmdih5_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 = + rotate5 lmdih_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 `;; + +let lmdih6_x_div_sqrtdelta_posbranch = new_definition + `lmdih6_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 = + rotate6 lmdih_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6`;; + +let vol3f_sqrt2_lmplus = new_definition + `vol3f_sqrt2_lmplus y1 y2 (y3:real) (y4:real) (y5:real) y6 = + (&2 * mm1 / pi) * + (&2 * dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + + &2 * dih2_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + + &2 * dih6_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + + dih3_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + + dih4_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + + dih5_y y1 y2 sqrt2 sqrt2 sqrt2 y6 - &3 * pi) - + (&8 * mm2 / pi) * + ( + lfun (y2 / &2) * dih2_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + + lfun (y6 / &2) * dih6_y y1 y2 sqrt2 sqrt2 sqrt2 y6)`;; + +let vol3f_x_sqrt2_lmplus = new_definition + `vol3f_x_sqrt2_lmplus x1 x2 x3 x4 x5 x6 = + vol3f_sqrt2_lmplus (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6)`;; + +let vol3f_x_lfun = new_definition + `vol3f_x_lfun x1 x2 (x3:real) (x4:real) (x5:real) x6 = vol3f (sqrt x1) (sqrt x2) (sqrt x6) sqrt2 lfun `;; + +let vol3_x_sqrt = new_definition + `vol3_x_sqrt x1 x2 (x3:real) (x4:real) (x5:real) x6 = vol_y sqrt2 sqrt2 sqrt2 (sqrt x1) (sqrt x2) (sqrt x6) `;; + + +let gamma23f = new_definition `gamma23f y1 y2 y3 y4 y5 y6 w1 w2 r f = + (gamma3f y1 y2 y6 r f / &w1 + gamma3f y1 y3 y5 r f / &w2 + + (dih_y y1 y2 y3 y4 y5 y6 - dih_y y1 y2 r r r y6 - dih_y y1 y3 r r r y5) * (vol2r y1 r - vol2f y1 r f)/(&2 * pi)) `;; + +let monomial = new_definition `monomial n1 n2 n3 n4 n5 n6 y1 y2 y3 y4 y5 y6 = + (y1 pow n1) * (y2 pow n2) * (y3 pow n3) * (y4 pow n4) * (y5 pow n5) * (y6 pow n6)`;; + +let arclength_x_234 = new_definition `arclength_x_234 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = arclength (sqrt x2) (sqrt x3) (sqrt x4)`;; + +let arclength_x_126 = new_definition `arclength_x_126 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) = arclength (sqrt x1) (sqrt x2) (sqrt x6)`;; + +(* Functional Equation *) + +let uni = new_definition `uni (f,x) x1 x2 x3 x4 x5 x6 = + (f:A->B) ( x x1 x2 x3 x4 x5 x6)`;; + +let constant6 = new_definition `constant6 c x1 x2 x3 x4 x5 x6 = c`;; + +let promote3_to_6 = new_definition + `promote3_to_6 f x1 x2 x3 x4 x5 x6 = f x1 x2 x3`;; + +let promote1_to_6 = new_definition + `promote1_to_6 f x1 x2 x3 x4 x5 x6 = f x1`;; + +let rh0 = new_definition `rh0 = &1/(h0 - &1)`;; + +let two6 = new_definition `two6 = constant6 ( &2)`;; + +let zero6 = new_definition `zero6 = constant6 ( &0)`;; + +let dummy6 = new_definition `dummy6 = constant6 ( &0)`;; + +let four6 = new_definition `four6 = constant6 ( &4)`;; + +let mk_126 = new_definition `mk_126 f = + compose6 f proj_x1 proj_x2 two6 two6 two6 proj_x6`;; + +let mk_456 = new_definition `mk_456 f = + compose6 f two6 two6 two6 proj_x4 proj_x5 proj_x6`;; + +let mk_135 = new_definition `mk_135 f = + compose6 f proj_x1 two6 proj_x3 two6 proj_x5 two6`;; + +let add6 = new_definition `add6 f g x1 x2 x3 x4 x5 x6 = + f x1 x2 x3 x4 x5 x6 + g x1 x2 x3 x4 x5 x6`;; + +let scalar6 = new_definition `scalar6 f r x1 x2 x3 x4 x5 x6 = + (f x1 x2 x3 x4 x5 x6) * (r:real)`;; + +let mul6 = new_definition `mul6 f g x1 x2 x3 x4 x5 x6 = + f x1 x2 x3 x4 x5 x6 * g x1 x2 x3 x4 x5 x6`;; + +let div6 = new_definition `div6 f g x1 x2 x3 x4 x5 x6 = + f x1 x2 x3 x4 x5 x6 / g x1 x2 x3 x4 x5 x6`;; + +let sub6 = new_definition `sub6 f g x1 x2 x3 x4 x5 x6 = + f x1 x2 x3 x4 x5 x6 - g x1 x2 x3 x4 x5 x6`;; + +let proj_y1 = new_definition `proj_y1 x1 x2 x3 x4 x5 x6 = + sqrt(x1)`;; + +let proj_y2 = new_definition `proj_y2 x1 x2 x3 x4 x5 x6 = + sqrt(x2)`;; + +let proj_y3 = new_definition `proj_y3 x1 x2 x3 x4 x5 x6 = + sqrt(x3)`;; + +let proj_y4 = new_definition `proj_y4 x1 x2 x3 x4 x5 x6 = + sqrt(x4)`;; + +let proj_y5 = new_definition `proj_y5 x1 x2 x3 x4 x5 x6 = + sqrt(x5)`;; + +let proj_y6 = new_definition `proj_y6 x1 x2 x3 x4 x5 x6 = + sqrt(x6)`;; + + +let domain6 = new_definition `domain6 h f g = + (!x1 x2 x3 x4 x5 x6. h x1 x2 x3 x4 x5 x6 ==> + (f x1 x2 x3 x4 x5 x6 = g x1 x2 x3 x4 x5 x6))`;; + +(* should be called something different, because we project out 3 coords *) + +let rotate234 = new_definition `rotate234 f = + compose6 f proj_x2 proj_x3 proj_x4 unit6 unit6 unit6`;; + +let rotate126 = new_definition `rotate126 f = + compose6 f proj_x1 proj_x2 proj_x6 unit6 unit6 unit6`;; + +let rotate345 = new_definition `rotate345 f = + compose6 f proj_x3 proj_x4 proj_x5 unit6 unit6 unit6`;; + +let functional_overload() = ( + overload_interface ("+",`add6`); + overload_interface ("-",`sub6`); + overload_interface ("/",`div6`); + overload_interface ("*",`mul6`));; + +let _ = functional_overload();; + +let h0cut = new_definition `h0cut y = if (y <= &2 * h0) then &1 else &0`;; + +let cos797 = new_definition `cos797 = cos(#0.797)`;; + +(* =gamma2= deprecated, Jan 23, 2013. *) + +(* formula corrected Jan 23, 2013. See GAMMAX_GAMMA2_X *) + +let gamma2_x_div_azim_v2 = + new_definition `gamma2_x_div_azim_v2 m x = (&8 - x)* sqrt x / (&24) - + ( &2 * (&2 * mm1/ pi) * (&1 - sqrt x / sqrt8) - + (&8 * mm2 / pi) * m * lfun (sqrt x / &2))`;; + +let gamma2_x1_div_a_v2 = new_definition `gamma2_x1_div_a_v2 m = + promote1_to_6 (gamma2_x_div_azim_v2 m)`;; + +let gamma3f_x_div_sqrtdelta = new_definition `gamma3f_x_div_sqrtdelta m4 m5 m6 = + constant6 (&1/ &12) - + (scalar6 ( mk_456 (rotate5 (sol_euler_x_div_sqrtdelta)) + + mk_456 (rotate6 (sol_euler_x_div_sqrtdelta)) + + mk_456 (rotate4 (sol_euler_x_div_sqrtdelta)) + ) (&2 * mm1/ pi) + - + scalar6 ( + (scalar6 (uni(lfun,(scalar6 proj_y4 #0.5))) m4) * + mk_456 (rotate4 (dih_x_div_sqrtdelta_posbranch)) + + (scalar6 (uni(lfun,(scalar6 proj_y5 #0.5))) m5) * + mk_456 (rotate5 (dih_x_div_sqrtdelta_posbranch)) + + (scalar6 (uni(lfun,(scalar6 proj_y6 #0.5))) m6) * + mk_456 (rotate6 (dih_x_div_sqrtdelta_posbranch)) + ) (&8 * mm2 / pi))`;; + +let vol3f_456 = new_definition `vol3f_456 m4 = + scalar6 ( mk_456 (rotate5 sol_x) + + mk_456 (rotate6 sol_x) + + mk_456 (rotate4 sol_x) + ) (&2 * mm1/ pi) + - + scalar6 ( + (scalar6 (uni(lfun,(scalar6 proj_y4 #0.5))) m4) * + mk_456 (rotate4 dih_x) + + (uni(lfun,(scalar6 proj_y5 #0.5))) * + mk_456 (rotate5 dih_x) + + (uni(lfun,(scalar6 proj_y6 #0.5))) * + mk_456 (rotate6 dih_x) + ) (&8 * mm2 / pi)`;; + +let gamma3_x = new_definition `gamma3_x m4 = + mk_456 vol_x - vol3f_456 m4`;; + +let gamma23_full8_x = new_definition `gamma23_full8_x m1 = + (compose6 (gamma3_x m1) + dummy6 dummy6 dummy6 proj_x1 proj_x2 proj_x6) + + (compose6 (gamma3_x m1) + dummy6 dummy6 dummy6 proj_x1 proj_x3 proj_x5) + + scalar6 (dih_x -(mk_126 dih_x + mk_135 dih_x)) (#0.008)`;; + +let gamma23_keep135_x = new_definition `gamma23_keep135_x m1 = + (compose6 (gamma3_x m1) + dummy6 dummy6 dummy6 proj_x1 proj_x3 proj_x5) + + scalar6 (dih_x - mk_135 dih_x) (#0.008)`;; + +(* added 2013-05-20 *) + +(* new 2013-May *) + + let flat_term = new_definition `flat_term y = sol0 * (y - &2 * h0)/(&2 * h0 - &2)`;; + + let mu_y = new_definition `mu_y y1 y2 y3 = + (#0.012 + #0.07 * (#2.52 - y1) + #0.01 * (#2.52 * &2 - y2 - y3 ))`;; + + let mu6_x = new_definition `(mu6_x:real->real->real->real->real->real->real) = + (constant6 (#0.012) + constant6 (#0.07) * (constant6 (#2.52) - proj_y1) + + constant6 (#0.01) * ((constant6 (#2.52 * &2) - proj_y2 - proj_y3)))`;; + + let taud = new_definition `taud y1 y2 y3 y4 y5 y6 = + sol0 * (y1 - &2 * h0)/(&2 * h0 - &2) + + sqrt(delta_y y1 y2 y3 y4 y5 y6) * + (#0.012 + #0.07 * (#2.52 - y1) + #0.01 * (#2.52 * &2 - y2 - y3 ))`;; + + let taud_x = new_definition `taud_x = + add6 (promote1_to_6 flat_term_x) + (mul6 (uni(sqrt,delta_x)) + (compose6 (promote3_to_6 mu_y) proj_y1 proj_y2 proj_y3 dummy6 dummy6 dummy6))`;; + + let delta_x1 = new_definition + `delta_x1 x1 x2 x3 x4 x5 x6 = + -- x1 * x4 + x2 * x5 - x3 * x5 - x2 * x6 + x3 * x6 + + x4 * (-- x1 + x2 + x3 - x4 + x5 + x6)`;; + + let delta_x2 = new_definition + `delta_x2 x1 x2 x3 x4 x5 x6 = x1 *x4 - x3* x4 - x2* x5 - x1* x6 + x3* x6 + + x5* (x1 - x2 + x3 + x4 - x5 + x6)`;; + + let delta_x3 = new_definition + `delta_x3 x1 x2 x3 x4 x5 x6 = x1 *x4 - x2 *x4 - x1* x5 + x2* x5 - + x3* x6 + (x1 + x2 - x3 + x4 + x5 - x6)* x6`;; + + let delta_x4= new_definition(`delta_x4 x1 x2 x3 x4 x5 x6 + = -- x2* x3 - x1* x4 + x2* x5 + + x3* x6 - x5* x6 + x1* (-- x1 + x2 + x3 - x4 + x5 + x6)`);; + + let delta_x5 = new_definition + `delta_x5 x1 x2 x3 x4 x5 x6 = -- x1* x3 + x1 *x4 - x2* x5 + x3* x6 - x4* x6 + + x2* (x1 - x2 + x3 + x4 - x5 + x6)`;; + + let delta_x6 = new_definition(`delta_x6 x1 x2 x3 x4 x5 x6 + = -- x1 * x2 - x3*x6 + x1 * x4 + + x2* x5 - x4* x5 + x3*(-- x3 + x1 + x2 - x6 + x4 + x5)`);; + + let dnum1 = new_definition `dnum1 e1 e2 e3 x4 x5 x6 = + (&16 - &2 * x4) * e1 + (x5 - &8) * e2 + (x6 - &8) * e3`;; + + let ups_126 = new_definition + `ups_126 = compose6 (promote3_to_6 ups_x) proj_x1 proj_x2 proj_x6 dummy6 dummy6 dummy6`;; + + let taud_v4_D2_num = new_definition `taud_v4_D2_num y1 y2 y3 y4 y5 y6 = + (let d = delta_y y1 y2 y3 y4 y5 y6 in + let delta' = y_of_x delta_x1 y1 y2 y3 y4 y5 y6 * (&2 * y1) in + let delta'' = -- &8 * (y1 * y4) pow 2 + y_of_x delta_x1 y1 y2 y3 y4 y5 y6 * (&2) in + let mu = (#0.012 + #0.07 * (#2.52 - y1) + #0.01 * (#2.52 * &2 - y2 - y3 )) in + let mu' = -- #0.07 in + (mu' * d * delta' - (&1 / &4) * mu * (delta' pow 2) + (&1 / &2) * mu * d * delta'' ))`;; + + let taud_D1_num_x = new_definition `taud_D1_num_x = + (let d = delta_x in + let delta' = delta_x1 * (constant6 (&2)) * proj_y1 in + let mu = mu6_x in + let mu' = constant6 (-- #0.07) in + let ft' = sol0 / (#0.52) in + (mu' * d + constant6(&1 / &2) * mu * delta' + constant6 ft' * uni(sqrt ,d)))`;; + + let taud_D2_num_x = new_definition `taud_D2_num_x = + (let d = delta_x in + let delta' = delta_x1 * (constant6 (&2)) * proj_y1 in + let delta'' = constant6 (-- &8) * proj_x1 * proj_x4 + delta_x1 * constant6 (&2) in + let mu = mu6_x in + let mu' = constant6 (-- #0.07) in + (mu' * d * delta' - constant6(&1 / &4) * mu * (delta' *delta') + constant6(&1 / &2) * mu * d * delta'' ))`;; + + let edge2_flatD_x1 = new_definition `edge2_flatD_x1 d x2 x3 x4 x5 x6 = + quadratic_root_plus (abc_of_quadratic ( + \x1. d - delta_x x1 x2 x3 x4 x5 x6))`;; + + let edge2_126_x = new_definition `edge2_126_x d x4 x5 = + compose6 (edge2_flatD_x1) (constant6 d) proj_x1 proj_x2 proj_x6 (constant6 x4) (constant6 x5)`;; + + let edge2_135_x = new_definition `edge2_135_x d x4 x6 = + compose6 (edge2_flatD_x1) (constant6 d) proj_x1 proj_x3 proj_x5 (constant6 x4) (constant6 x6)`;; + + let edge2_234_x = new_definition `edge2_234_x d x5 x6 = + compose6 (edge2_flatD_x1) (constant6 d) proj_x2 proj_x3 proj_x4 (constant6 x5) (constant6 x6)`;; + + let flat_term2_126_x = new_definition `flat_term2_126_x d x4 x5 = + uni(flat_term_x,edge2_126_x d x4 x5)`;; + + let flat_term2_135_x = new_definition `flat_term2_135_x d x4 x6 = + uni(flat_term_x,edge2_135_x d x4 x6)`;; + + let flat_term2_234_x = new_definition `flat_term2_234_x d x5 x6 = + uni(flat_term_x,edge2_234_x d x5 x6)`;; + + let mud_135_x = new_definition `mud_135_x_v1 y2 y4 y6 = + mul6 (compose6 (promote3_to_6 mu_y) (constant6 y2) proj_y1 proj_y3 dummy6 dummy6 dummy6) + (uni(sqrt,(delta_135_x (y2*y2) (y4*y4) (y6*y6))))`;; + + let mud_126_x = new_definition `mud_126_x_v1 y3 y4 y5 = + mul6 (compose6 (promote3_to_6 mu_y) (constant6 y3) proj_y1 proj_y2 dummy6 dummy6 dummy6) + (uni(sqrt,(delta_126_x (y3*y3) (y4*y4) (y5*y5))))`;; + + let mud_234_x = new_definition `mud_234_x_v1 y1 y5 y6 = + mul6 (compose6 (promote3_to_6 mu_y) (constant6 y1) proj_y2 proj_y3 dummy6 dummy6 dummy6) + (uni(sqrt,(delta_234_x (y1*y1) (y5*y5) (y6*y6))))`;; + + let mudLs_234_x = new_definition `mudLs_234_x d1s d2s y1 y5 y6 = + (mul6 (compose6 (mu6_x) (constant6 (y1*y1)) proj_x2 proj_x3 dummy6 dummy6 dummy6) + (constant6 (&1/ (d1s+d2s)) * (delta_234_x (y1*y1) (y5*y5) (y6*y6) - constant6(d1s *d1s)) + constant6(d1s)))`;; + + let mudLs_126_x = new_definition `mudLs_126_x d1s d2s y3 y4 y5 = + (mul6 (compose6 (mu6_x) (constant6 (y3*y3)) proj_x1 proj_x2 dummy6 dummy6 dummy6) + (constant6 (&1/ (d1s+d2s)) * (delta_126_x (y3*y3) (y4*y4) (y5*y5) - constant6(d1s *d1s)) + constant6(d1s)))`;; + + let mudLs_135_x = new_definition `mudLs_135_x d1s d2s y2 y4 y6 = + (mul6 (compose6 (mu6_x) (constant6 (y2*y2)) proj_x1 proj_x3 dummy6 dummy6 dummy6) + (constant6 (&1/ (d1s+d2s)) * (delta_135_x (y2*y2) (y4*y4) (y6*y6) - constant6(d1s *d1s)) + constant6(d1s)))`;; + + + + +end;; diff --git a/text_formalization/nonlinear/optimize.hl b/text_formalization/nonlinear/optimize.hl new file mode 100644 index 0000000..9e3b56c --- /dev/null +++ b/text_formalization/nonlinear/optimize.hl @@ -0,0 +1,1088 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: nonlinear inequalities *) +(* Author: Thomas Hales *) +(* Date: 2010-08-30 *) +(* ========================================================================== *) + + +(* +Input is a nonlinear inequality. +preprocess_split_idq generates cases and does general preprocessing. +Output is executable interval arithmetic code in C++. +*) + +(* +flyspeck_needs "general/sphere.hl";; +flyspeck_needs "nonlinear/ineq.hl";; +flyspeck_needs "nonlinear/lemma.hl";; +*) + +module Optimize = struct + +open Lib;; +open Nonlinear_lemma;; + + +let length = List.length;; + + +let svn_version = Flyspeck_lib.svn_version;; + +let ineq = Sphere.ineq;; +let all_forall = Sphere.all_forall;; +let add = Ineq.add;; + + +let nub = Flyspeck_lib.nub;; + +let join_comma = Flyspeck_lib.join_comma;; +let join_space = Flyspeck_lib.join_space;; +let join_lines = Flyspeck_lib.join_lines;; + +let string_of_num' = Flyspeck_lib.string_of_num';; +let dest_decimal = Flyspeck_lib.dest_decimal;; + +let strip_let_tm = Nonlinear_lemma.strip_let_tm;; + +let output_filestring = Flyspeck_lib.output_filestring;; + +let BY = Hales_tactic.BY;; +let unlist = Hales_tactic.unlist;; + +(* from glpk_link.ml *) + +let load_and_close_channel_true = Flyspeck_lib.load_and_close_channel_true;; + +let load_file = Flyspeck_lib.load_file;; + +(* ========================================================================= *) +(* GENERAL PROCEDURES *) +(* ========================================================================= *) + +(* The marker NONLIN is used in mk_all_ineq.hl, + where it is replaced with a constant equivalent to the conjunction of all the + nonlinear ineqs. *) + +let NONLIN = new_definition `NONLIN = T`;; + +let FROZEN_REWRITE_TAC ths = + if (ths=[]) then REWRITE_TAC [] else + let th = end_itlist CONJ ths in + FREEZE_THEN (fun t -> REWRITE_TAC[t]) th;; + +let quoted s = let q = "\"" in (q^s^q);; + +let paren s = "("^ s ^")";; + +let real_ty = `:real`;; +let mk_x i = mk_var("x"^string_of_int i,real_ty);; + +let x9list = map mk_x (1--9);; +let x6list = map mk_x (1--6);; +let x_backlist = map mk_x [7;2;3;4;8;9];; + +let xspec = SPECL x6list;; + + +let dest_ineq ineq = + let t = snd(strip_forall ineq) in + let (vs,i) = dest_comb t in + let (_,vs) = dest_comb vs in + let vs = dest_list vs in + let vs = map (fun t -> let (a,b) = dest_pair t in (a,dest_pair b)) vs in + let vs = map (fun (a,(b,c)) -> (a, b, c)) vs in + (t,vs,disjuncts i);; + +(* renames variables as x1,x2,x3,.... *) + +let (X_RENAME_TAC:tactic) = + fun gl -> + let (_,loc,_) = dest_ineq (goal_concl gl) in + let loc' = map (fun (_,b,_) -> b) loc in + let xvar = map mk_x (1 -- (length loc')) in + EVERY (map SPEC_TAC (zip loc' xvar)) gl ;; + + +(* ========================================================================= *) +(* SPLITTING INEQUALITIES AT h0 *) +(* ========================================================================= *) + +let get_split_tags idq = + let ts = idq.tags in + let rec gs = (function + | [] -> [] + | (Split a::_) -> a + | _ :: rs -> gs rs) in + gs ts;; + +let split_2h0 = + let split_interval = prove( + `! a b (y:real). (a <= y /\ y <= b) ==> + ((a <= y /\ y <= m) \/ (m <= y /\ y <= b) ) + `, REAL_ARITH_TAC) in + INST [(`&2 * h0`,`m:real`)] split_interval;; + +let split_2h0_strict = + let split_interval = prove( + `! a b (y:real). (a <= y /\ y <= b) ==> + ((a <= y /\ y <= m) \/ (m < y /\ y <= b) ) + `, REAL_ARITH_TAC) in + INST [(`&2 * h0`,`m:real`)] split_interval;; + + +(* changed 2012-06-20 +let SPLIT_H0_TAC pos = + (REPEAT GEN_TAC) THEN + (REWRITE_TAC[ineq_expand6]) THEN + (REPLICATE_TAC (pos) DISCH_TAC) THEN + (DISCH_THEN (fun t -> MP_TAC (MATCH_MP split_2h0 t))) THEN + DISCH_THEN DISJ_CASES_TAC THEN + (REPEAT (POP_ASSUM MP_TAC)) THEN + (REWRITE_TAC[GSYM ineq_expand6]);; +*) + + +let h0cutA = prove_by_refinement( + `!y. (y <= &2 * h0) ==> ((h0cut y) = &1)`, + (* {{{ proof *) + [ + MESON_TAC[Sphere.h0cut] + ]);; + (* }}} *) + +let h0cutB = prove_by_refinement( + `!y. (&2 * h0 < y) ==> ((h0cut y) = &0)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.h0cut]; + REPEAT STRIP_TAC; + BY(COND_CASES_TAC THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let h0cutC = prove_by_refinement( + `!y. (y <= &2 * hminus) ==> (h0cut y = &1)`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + MATCH_MP_TAC h0cutA; + MP_TAC Nonlinear_lemma.hminus_lt_h0; + POP_ASSUM MP_TAC; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + +let SPLIT_H0_TAC pos = + let destrict = REAL_ARITH `a < y /\ y <= b ==> a <= y /\ y <= b` in + (REPEAT GEN_TAC) THEN + (REWRITE_TAC[ineq_expand6]) THEN + (REPLICATE_TAC (pos) DISCH_TAC) THEN + (DISCH_THEN (fun t -> MP_TAC (MATCH_MP split_2h0_strict t))) THEN + DISCH_THEN DISJ_CASES_TAC THEN + ASM_SIMP_TAC[h0cutA;h0cutB;h0cutC] THENL + [ALL_TAC;POP_ASSUM ( ASSUME_TAC o (MATCH_MP destrict))] THEN + (REPEAT (POP_ASSUM MP_TAC)) THEN + (REWRITE_TAC[GSYM ineq_expand6]);; + + +(* WARNING: This disturbs the goal *) + +let split_h0 (ineq,ss) = + let current_goals() = + map (fun (_,w) -> w) + ((fun (_,b,_) -> b) (hd (!current_goalstack))) in + let split_h0_term i inq = + let _ = g inq in + let _ = e(SPLIT_H0_TAC i) in + map all_forall (current_goals()) in + let _ = (length ss > 0) or failwith "empty split" in + let ineql = split_h0_term (hd ss) ineq in + map (fun t-> (t, tl ss)) ineql;; + +let rec split_all_h0 = function + | [] -> [] + | (i,[])::rs -> i :: split_all_h0 rs + | r::rs -> split_all_h0 (split_h0 r @ rs);; + + + +(* ========================================================================== *) +(* PARSING INEQUALITIES *) +(* ========================================================================== *) + + + +let dest_nonlin t = + let (_,r,il) = dest_ineq t in + let p1 (a,_,_) = a in + let p2 (_,b,_) = b in + let p3 (_,_,c) = c in + let dest x = try dest_binop `(real_lt)` x with Failure _ -> dest_binop `(real_le)` x in + let (iis,zzs) = unzip( map (dest) il) in + let zz = nub zzs in + let _ = (zz = [`&0`]) or failwith "zero expected" in + let _ = ((map p2 r = x6list) or (map p2 r = x9list)) or failwith "x1..x6 or x1..x9 expected" in + (map p1 r, map p3 r,iis);; + + (* these names don't change in cpp interval code *) + +let idem_assoc = [];; (* make it the default *) + +(* these names can change in cpp (hol_name,cpp_name). + Don't generate function defs for these. + "NOT_IMPLEMENTED" is a special tag to suppress the + production of test routines. We would be better + off using an option. *) + +let native_fun = [ + ("unit6","Lib::unit"); + ("two6","Lib::two6"); + ("proj_x1","Lib::x1"); + ("proj_x2","Lib::x2"); + ("proj_x3","Lib::x3"); + ("proj_x4","Lib::x4"); + ("proj_x5","Lib::x5"); + ("proj_x6","Lib::x6"); + ("proj_y1","Lib::y1"); + ("sqrt_x1","Lib::y1"); + ("delta_x","Lib::delta_x"); + ("sol_x","Lib::sol_x"); + ("dih_x","Lib::dih_x"); + ("rad2_x","Lib::rad2_x"); + ("rho_x","NOT_IMPLEMENTED"); + ("delta_y","NOT_IMPLEMENTED"); + ("dih_y","NOT_IMPLEMENTED"); + ("sol_y","NOT_IMPLEMENTED"); + ("delta_x4","Lib::delta_x4"); + ("edge_flat2_x","Lib::edge_flat2_x"); + ("halfbump_x1","Lib::halfbump_x1"); + ("ups_126","Lib::ups_126"); + ("eta2_126","Lib::eta2_126"); + ("compose6","Function::compose"); + ("constant6","Lib::constant6"); + ("uni","Lib::uni"); + ("sqrt","univariate::i_sqrt"); + ("acs","univariate::i_acos"); + ("asn","univariate::i_asin"); + ("atn","univariate::i_atan"); + ("cos","univariate::i_cos"); + ("sin","univariate::i_sin"); + ("pow2","univariate::i_pow2"); + ("matan","univariate::i_matan"); + ("gchi","Lib::i_gchi"); + ("lfun","Lib::i_lfun"); + ("rho","Lib::i_rho"); + ("flat_term_x","Lib::i_flat_term_x"); + ("sqn","univariate::i_sqn"); + ("promote1_to_6","Lib::promote1_to_6"); + ("gamma2_x_div_azim_v2","Lib::i_gamma2_x_div_azim_v2"); + ("num1","Lib::num1"); +];; + + +(* and for these +gradually eliminate this list. +The default will be to have the same names. +*) + +let cpp_assoc = + let pref = "" in + let p (a,b) = (a, (pref^b)) in map p + (idem_assoc @ [ + ("sqrt_x2","proj_y2"); + ("sqrt_x3","proj_y3"); + ("sqrt_x4","proj_y4"); + ("sqrt_x5","proj_y5"); + ("sqrt_x6","proj_y6"); + ("promote_pow2","x1square"); + ("promote_pow3","x1cube"); + + ]);; + +let cpp_fn_name s = + try Lib.assoc s native_fun + with Failure _ -> + try Lib.assoc s cpp_assoc + with Failure _ -> s;; + +let cpp0_assoc = + [("sqrt8","sqrt8");("pi","pi");("const1","const1"); + ("hminus","hminus");("sqrt3","sqrt3"); + ("arc_hhn","arc_hhn"); + ("adodec","aStrongDodec"); + ("bdodec","bStrongDodec"); + ("ydodec","yStrongDodec"); + ];; + +let cpp_of_constant s = + try (assoc s cpp0_assoc) with + Failure _ -> failwith (s^" find: cpp_of_constant") ;; + +let cpp_of_fun to_string xlist s xs = + let (arg,xss) = chop_list (length xs - length xlist) xs in + let _ = (xss = xlist) or failwith ("standard x list expected in "^s) in + let hd = (cpp_fn_name s) in + let arg_s = map (paren o to_string) arg in + let p = if (length arg > 0) then paren else I in + (hd ^ " " ^ p(join_comma arg_s));; + +(* 2013-08-14, changed for AWS compiler. was interval::interval( ... ) *) +let i_mk s = "interval("^quoted s ^")";; + +let i_mk2 t = (* treat small integers exactly *) + let n = dest_numeral t in + let s = if (Num.is_integer_num n) && (Num.sign_num n >= 0) && (n ifix "+" + | "real_mul" -> ifix "*" + | "real_div" -> ifix "/" + | "\\/" -> ifix "\\/" + | "real_neg" -> let [a] = xs in "(-" ^ soh a ^ ")" + | "real_of_num" -> let [a] = xs in i_mk2( a) + | "NUMERAL" -> let [a] = xs in string_of_num' (dest_numeral t) + | "<" -> let [a;b] = xs in paren(soh a ^ " < " ^ soh b) + | ">" -> let [a;b] = xs in paren(soh a ^ " > " ^ soh b) + | "+" -> let [a;b] = xs in paren(soh a ^ " + " ^ soh b) + | "*" -> let [a;b] = xs in paren(soh a ^ " * " ^ soh b) + | "DECIMAL" -> i_mk(string_of_num' (dest_decimal t)) + | s -> if (xs = []) + then "("^cpp_of_constant s^")" + else paren(cpp_of_fun soh x6list s xs) in + fun t -> + try (soh t) + with Failure s -> failwith (s^" ....... "^string_of_term t);; + +(* generation of cpp code *) + +let cpp_template_taylor c (i,s) = Printf.sprintf +" Function F%s%d = %s;" c i s;; + +let cpp_template_t c iis = + join_lines + (map (cpp_template_taylor c) (zip (1--(length iis)) iis));; + +let cpp_template_F c i = Printf.sprintf "&F%s%d" c i;; + +let cpp_template_Fc c len = join_comma + (map (cpp_template_F c) (1-- len));; + +let rec delta126min = function + | [] -> -1.0 + | Delta126min t :: _ -> t + | _ :: a -> delta126min a;; + +let rec widthCut = function + | [] -> (false,0.0) + | Widthcutoff t::_ -> (true,t) + | _:: a -> widthCut a;; + +let rec delta126max = function + | [] -> -1.0 + | Delta126max t :: _ -> t + | _ :: a -> delta126max a;; + +let rec delta135min = function + | [] -> -1.0 + | Delta135min t :: _ -> t + | _ :: a -> delta135min a;; + +let rec delta135max = function + | [] -> -1.0 + | Delta135max t :: _ -> t + | _ :: a -> delta135max a;; + +let cpp_template_gen = Printf.sprintf " + const char svn[] = %s; + const char ineq_id[] = %s; + + int testRun() // autogenerated code + { + interval tx[6]={%s}; + interval tz[6]={%s}; + domain x = domain::lowerD(tx); + domain z = domain::upperD(tz); + domain x0=x; + domain z0=z; + %s + const Function* I[%d] = {%s}; // len ... + cellOption opt; + opt.allowSharp = %d; // sharp + opt.onlyCheckDeriv1Negative = %d; // checkderiv + %s // other options. + return prove::recursiveVerifier(0,x,z,x0,z0,I,%d,opt); // len + }";; + +let mk_cpp_proc t s tags = + let sharp = if mem Sharp tags then 1 else 0 in + let checkderiv = if mem Onlycheckderiv1negative tags then 1 else 0 in + let ifd b s = if b then s else "" in + let setrad2 = ifd (mem Set_rad2 tags) "\topt.setRad2 = 1;\n" in + let (b,f) = widthCut tags in + let sWidth = ifd b (Printf.sprintf "\topt.widthCutoff = %8.16f;\n" f) in + let d126min = delta126min tags in + let s126min = ifd (d126min > -1.0) + (Printf.sprintf "\topt.delta126Min = %8.16f;\n" d126min) in + let d126max = delta126max tags in + let s126max = ifd (d126max > -1.0) + (Printf.sprintf "\topt.delta126Max = %8.16f;\n" d126max) in + let d135min = delta135min tags in + let s135min = ifd (d135min > -1.0) + (Printf.sprintf "\topt.delta135Min = %8.16f;\n" d135min) in + let d135max = delta135max tags in + let s135max = ifd (d135max > -1.0) + (Printf.sprintf "\topt.delta135Max = %8.16f;\n" d135max) in + let s206A = ifd (s="2065952723 A1" ) + (Printf.sprintf "\topt.strategy206A=1;\n") in + let disallowderiv = ifd (mem Disallow_derivatives tags) + "\topt.allowDerivatives=0;\n" in + let others = setrad2 ^ s126min ^ s126max ^ s135min ^ s135max ^ + sWidth ^ s206A ^ disallowderiv in + let c = map cpp_string_of_term in + let f (x,y,z) = (c x,c y,c z) in + let (aas,bbs,iis) = f (dest_nonlin t) in + let len = length iis in + let sq = quoted s in + let svn = (quoted(svn_version())) in + let jaas = join_comma aas in + let jbbs = join_comma bbs in + cpp_template_gen svn sq jaas jbbs (cpp_template_t "" iis) + len (cpp_template_Fc "" len) sharp checkderiv others len;; + +(* quad clusters *) + +let has_subterm sub tm = + can (find_term ((=) sub)) tm;; + +let has_cross_diag = has_subterm `quad_cross_diag2_x`;; + +let has_delta_top = has_subterm `delta_top_x`;; + +let is_quad_cluster tags = (can (find (function Quad_cluster _ -> true | _ -> false)) tags);; + +let quad_margin tags = (function Quad_cluster t -> t | _ -> 0.0) + (find ((function Quad_cluster _ -> true | _ -> false)) tags);; + +let check_quad_partition_term (r,s,t) tm = + let tm2 = list_mk_binop `(+)` (r @ s @ t) in + let t = mk_eq (tm ,tm2) in + (REAL_ARITH) t;; + +let partition_quad_term tm = + let rec split tm = + if (has_cross_diag tm) then ([],[],[tm]) else + if (has_delta_top tm) then ([],[],[tm]) else + if (subset (frees tm) x6list) then ([tm],[],[]) else + if (subset (frees tm) x_backlist) then ([],[tm],[]) else + let (a1,a2) = dest_binop `(+)` tm in + let (r1,s1,t1) = split a1 in + let (r2,s2,t2) = split a2 in + (r1 @ r2, s1 @ s2, t1 @ t2) in + let (r,s,t) = split tm in + let _ = check_quad_partition_term (r,s,t) tm in + let v = vsubst [`x1:real`,`x7:real`; `x5:real`,`x8:real`; `x6:real`,`x9:real`] in + let w = function | [] -> + `unit6 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) * #0.0` | xl -> list_mk_binop `(+)` xl in + (w r,w(map v s), t);; + + +let cppq_template_gen = Printf.sprintf " + char* svn = %s; + char* ineq_id = %s; + + int testRun() // quad cluster case, autogenerated code + { + interval txA[6]={%s}; + interval tzA[6]={%s}; + domain xA = domain::lowerD(txA); + domain zA = domain::upperD(tzA); + interval txB[6]={%s}; + interval tzB[6]={%s}; + domain xB = domain::lowerD(txB); + domain zB = domain::upperD(tzB); + // Declare FA, FB... + %s + %s + const Function* IA[%d] = {%s}; + const Function* IB[%d] = {%s}; + cellOption opt; + %s // options. + return prove::recursiveVerifierQ(0,xA,xB,zA,zB,IA,IB,%d,opt); + }";; + +let get_cross_diag_squared is9 = + let id9' = filter (fun (_,_,c)-> length c >0 && has_cross_diag (hd c)) is9 in + let is9'' = (fun (_,_,[c])::_ -> c ) id9' in + let tm = term_match x9list `quad_cross_diag2_x x1 x2 x3 x4 x5 x6 x7 x8 x9 + + unit6 x1 x2 x3 x4 x5 x6 * t` is9'' in + let t = (fun ([],[(x,_)],[]) -> x) tm in + mk_binop `( * )` t t;; (* t is negative, but it gets squared *) + +let get_delta_top_squared is9 = + let id9' = filter (fun (_,_,c)-> length c >0 && has_delta_top (hd c)) is9 in + let is9'' = (fun (_,_,[c])::_ -> c ) id9' in + let tm = term_match x9list `delta_top_x t x1 x2 x3 x4 x5 x6 x7 x8 x9` is9'' in + let t = (fun ([],[(x,_)],[]) -> x) tm in + mk_binop `( * )` t t;; (* gets squared *) + +let cde_template = + Printf.sprintf "opt.crossDiagMinEnclosed = interMath::inf(%s);\n";; + +let cdt_template = + Printf.sprintf "opt.crossDiagMinDelta = interMath::inf(%s);\n";; + +let mk_cppq_proc t s tags = + let svn = (quoted(svn_version())) in + let ineq_id = quoted s in + let cpp = cpp_string_of_term in + let (x,z,is) = dest_nonlin t in + let is' = map partition_quad_term is in + let (is9,is6) = partition (fun (_,_,c) -> length c > 0) is' in + let (is6A,is6B) = unzip (map (fun (a,b,_) -> (cpp a,cpp b)) is6) in + let len = length is6 in + let xs = map cpp x in + let zs = map cpp z in + let nth = List.nth in + let a_part u = [nth u 0;nth u 1;nth u 2;nth u 3; nth u 4;nth u 5] in + let b_part u = [nth u 6;nth u 1;nth u 2;nth u 3;nth u 7; nth u 8] in + let xA = join_comma(a_part xs) in + let xB = join_comma(b_part xs) in + let zA = join_comma(a_part zs) in + let zB = join_comma(b_part zs) in + let opt_cross = + try + ( cde_template (cpp ( get_cross_diag_squared is9) )) + with _ -> "" in + let opt_delta_top = + try + ( cdt_template (cpp ( get_delta_top_squared is9) )) + with _ -> "" in + let backsym = + if (mem Dim_red_backsym tags) + then "\topt.dimRedBackSym = 1;\n" else "" in + let sWidth = + let (b,f) = widthCut tags in + if b then Printf.sprintf "\topt.widthCutoff = %8.16f;\n" f else "" in + let margin = Printf.sprintf "\topt.margin = %8.16f;\n\n" (quad_margin tags) in + let options = opt_cross ^ opt_delta_top ^ backsym^margin^sWidth in + cppq_template_gen svn ineq_id xA zA xB zB + (cpp_template_t "A" is6A) (cpp_template_t "B" is6B) + len (cpp_template_Fc "A" len) len (cpp_template_Fc "B" len) options len ;; + +(* +let t = snd(top_goal());; +let s = "test";; +let tags = [Quad_cluster 3.0];; +*) + +(* next: put together header, proc, tail and run *) + +let tmpfile = flyspeck_dir^"/../interval_code/test_auto.cc";; + +let cpp_header() = join_lines (load_file (flyspeck_dir^"/../interval_code/generic_head.txt"));; + +let cpp_tail() = join_lines (load_file (flyspeck_dir^"/../interval_code/generic_tail.txt"));; + +let mkfile_cpp t s tags = + output_filestring tmpfile + (join_lines [cpp_header(); (mk_cpp_proc t s tags);cpp_tail()]);; + +let mkfile_cppq t s tags = + output_filestring tmpfile + (join_lines [cpp_header(); (mk_cppq_proc t s tags);cpp_tail()]);; + +let compile_cpp = + let err = Filename.temp_file "cpp_err" ".txt" in + fun () -> + let e = Sys.command("cd "^flyspeck_dir^"/../interval_code; make test_auto >& "^err) in + let _ = (e=0) or (let _ = Sys.command ("cat "^err) in failwith "compiler error") in + ();; + + let execute_interval ex tags s testineq = + let interval_dir = flyspeck_dir^"/../interval_code" in + let quad_cluster = is_quad_cluster tags in + let _ = if quad_cluster then + mkfile_cppq testineq s tags + else + mkfile_cpp testineq s tags in + let _ = compile_cpp() in + let _ = (not ex) or (0= Sys.command(interval_dir^"/test_auto")) or failwith "interval execution error" in + ();; + + +(* ========================================================================== *) +(* MEGA PREP TACTICS *) +(* ========================================================================== *) + +(* *************************************************************************** *) +(* PRELIM *) +(* *************************************************************************** *) + +let macro_expand = ( + [ + Sphere.x1_delta_y;Sphere.delta4_squared_y; + vol4f_palt;Nonlinear_lemma.y_of_x_e; + gamma4fgcy_alt; + Sphere.vol3r;Sphere.vol2f;Sphere.gamma4f; + Sphere.gamma3f; GSYM Nonlinear_lemma.quadratic_root_plus_curry; + REAL_MUL_LZERO; + REAL_MUL_RZERO;FST;SND; + Sphere.node2_y;Sphere.node3_y] @ + (!Ineq.dart_classes));; + +let PRELIM_REWRITE_TAC = EVERY[ + (REWRITE_TAC[GSYM Sphere.rad2_y]) ; + (REWRITE_TAC(macro_expand)) ; +];; + +(* *************************************************************************** *) +(* BRANCH *) +(* *************************************************************************** *) + +(* take care of branching *) + +let BRANCH_TAC = EVERY[ + REWRITE_TAC[REAL_ARITH `x / &1 = x /\ &0 * x = &0 /\ &0 +x = x`]; + REWRITE_TAC[Sphere.gamma4f;vol4f_lmfun;Sphere.gamma3f;]; + REWRITE_TAC[ineq_expand6]; + DISCH_TAC; + REPEAT GEN_TAC; + REPEAT DISCH_TAC; + ASSUM_LIST (let rec r = function | [] -> ALL_TAC | th::ths -> (MP_TAC (REPEAT_RULE (OR_RULE (MATCH_MP pathL_bound) (MATCH_MP pathR_bound)) th)) THEN r ths in r); + REWRITE_TAC[]; + SIMP_TAC[c2001; + gcy_low;gcy_low_const;gcy_low_hminus;gcy_high;gcy_high_hplus; + h0_lt_gt; + lmdih3_ldih3;lmdih5_ldih5;lmdih_ldih;lmdih5_0;lmdih3_0;lmdih0; + (* Oct 28, 2010:*) vol3f_lm0;vol3f_lmln; + (* nov23 *) lmfun0;lmfun_lfun;hm0; + (* may 26, 2011. macro_expand was moved to prelim tac, + so additional simps are needed. *) + lmdih1_0';lmdih3_0';lmdih5_0'; + lmdih_ldih';lmdih3_ldih3';lmdih5_ldih5'; + ]; + SIMP_TAC[lmfun_lfun;lmfun0]; + REWRITE_TAC[REAL_ARITH `&0 * x = &0 /\ &0 + x = x`]; + REPEAT (DISCH_THEN (fun t-> ALL_TAC)); + REPEAT (POP_ASSUM MP_TAC); + REWRITE_TAC[GSYM ineq_expand6]; + DISCH_TAC; + EVERY (map SPEC_TAC [(`y6:real`,`y6:real`);(`y5:real`,`y5:real`);(`y4:real`,`y4:real`);(`y3:real`,`y3:real`);(`y2:real`,`y2:real`);(`y1:real`,`y1:real`)]); + POP_ASSUM MP_TAC; + REWRITE_TAC[Sphere.pathL;Sphere.pathR]; (* moved May 24, 2011 *) +];; + +(* *************************************************************************** *) +(* *************************************************************************** *) + +(* + let SQRT_SQRT_TAC = +EVERY[ + REPEAT DISCH_TAC; + SUBGOAL_THEN `sqrt x1 * sqrt x1 = x1 /\ sqrt x2 * sqrt x2 = x2 /\ sqrt x3 * sqrt x3 = x3 /\ sqrt x4 * sqrt x4 = x4 /\ sqrt x5 * sqrt x5 = x5 /\ sqrt x6 * sqrt x6 = x6` (unlist REWRITE_TAC) THENL[ ASM_MESON_TAC[sq_pow2];ALL_TAC] THEN + REPEAT (POP_ASSUM MP_TAC); + DISCH_TAC; +];; +*) + + let SQRT_SQRT_TAC = EVERY[ + REPEAT DISCH_TAC; + SUBGOAL_THEN `sqrt x1 * sqrt x1 = x1 /\ sqrt x2 * sqrt x2 = x2 /\ sqrt x3 * sqrt x3 = x3 /\ + sqrt x4 * sqrt x4 = x4 /\ sqrt x5 * sqrt x5 = x5 /\ sqrt x6 * sqrt x6 = x6` + (unlist REWRITE_TAC) + THENL [ REPEAT (FIRST_X_ASSUM (MP_TAC o (MATCH_MP sq_pow2))) THEN + REPEAT DISCH_TAC THEN BY(ASM_REWRITE_TAC[]);ALL_TAC] THEN + REPEAT (POP_ASSUM MP_TAC); + DISCH_TAC;];; + + + +let X_SQRT_COMPOUND_ORDER = +[`norm2hh (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + norm2hh_x x1 x2 x3 x4 x5 x6 `; +`rad2_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + rad2_x x1 x2 x3 x4 x5 x6 `; +`delta4_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + delta_x4 x1 x2 x3 x4 x5 x6 `; +`delta4_y (sqrt x7) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x8) (sqrt x9) = + delta_x4 x7 x2 x3 x4 x8 x9 `; +`dih2_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + dih2_x x1 x2 x3 x4 x5 x6 `; +`dih3_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + dih3_x x1 x2 x3 x4 x5 x6 `; +`dih_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + dih_x x1 x2 x3 x4 x5 x6 `; +`dih4_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + dih4_x x1 x2 x3 x4 x5 x6 `; +`dih5_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + dih5_x x1 x2 x3 x4 x5 x6 `; +`dih6_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + dih6_x x1 x2 x3 x4 x5 x6 `; +`delta_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + delta_x x1 x2 x3 x4 x5 x6 `; +`delta_y (sqrt x7) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x8) (sqrt x9) = + delta_x x7 x2 x3 x4 x8 x9`; +`vol_y (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + vol_x x1 x2 x3 x4 x5 x6 `; +`eta_y (sqrt x1) (sqrt x2) (sqrt x6) pow 2 = eta2_126 x1 x2 x3 x4 x5 x6 `; +`eta_y (sqrt x1) (sqrt x3) (sqrt x5) pow 2 = eta2_135 x1 x2 x3 x4 x5 x6 `; +`eta_y (sqrt x4) (sqrt x5) (sqrt x6) pow 2 = eta2_456 x1 x2 x3 x4 x5 x6 `; +`vol3f (sqrt x1) (sqrt x2) (sqrt x6) sqrt2 lfun = vol3f_x_lfun x1 x2 x3 x4 x5 x6 `; +`vol_y sqrt2 sqrt2 sqrt2 (sqrt x1) (sqrt x2) (sqrt x6) = vol3_x_sqrt x1 x2 x3 x4 x5 x6 `; +`vol3f_sqrt2_lmplus (sqrt x1) (sqrt x2) (sqrt x3) (sqrt x4) (sqrt x5) (sqrt x6) = + vol3f_x_sqrt2_lmplus x1 x2 x3 x4 x5 x6`; + ];; + + + let rec get_consts tm = + match tm with + Var(s,t) -> [] + | Const(s,t) -> [tm ] + | Comb (t1,t2) -> get_consts t1 @ get_consts t2 + | Abs (t1,t2) -> get_consts t1 @ get_consts t2 ;; + + let get_goal_const gl = + let w = goal_concl gl in + get_consts w;; + +(* + let X_SQRT_COMPOUND_ORDER_TAC:tactic = + fun gl -> + let (asl,a) = dest_goal gl in + let fr = frees a in + (* edited next line Nov 2012, svn 2931 *) + let vos = filter (fun t -> subset (frees (fst (dest_eq t))) fr ) X_SQRT_COMPOUND_ORDER in + let X_SQRT_COMPOUND_ORDER_FIL = list_mk_conj vos in + (SUBGOAL_THEN X_SQRT_COMPOUND_ORDER_FIL (fun t-> REWRITE_TAC[t;(GSYM Sphere.rhazim_x); (GSYM Sphere.rhazim2_x);xspec (GSYM Sphere.rhazim3_x)]) THENL[ (GEN_MESON_TAC 0 200 1[Sphere.norm2hh_x;rad2_x_y;delta_x4_delta4_y;dih_x_y;dih2_x_y;delta_x_y;dih3_x_y;tauq_x_y;GSYM Sphere.dih4_x;GSYM Sphere.dih5_x;GSYM Sphere.dih6_x;vol_x_y;Sphere.eta2_126; Sphere.eta2_135;Sphere.eta2_456;GSYM vol3f_x_lfun;GSYM vol3_x_sqrt;GSYM vol3f_x_sqrt2_lmplus]);ALL_TAC]) gl +;; +*) + + let X_SQRT_COMPOUND_ORDER_TAC:tactic = + fun gl -> + let (asl,a) = dest_goal gl in + let fr = frees a in + let c = get_goal_const gl in + let vos = filter (fun t -> subset (frees (fst (dest_eq t))) fr ) X_SQRT_COMPOUND_ORDER in + let vos' = filter (fun t -> mem (fst (strip_comb (fst(dest_eq t)))) c) vos in + let vconj = list_mk_conj vos' in + (SUBGOAL_THEN vconj (fun t-> REWRITE_TAC[t;(GSYM Sphere.rhazim_x); (GSYM Sphere.rhazim2_x);xspec (GSYM Sphere.rhazim3_x)]) THENL[ (GEN_MESON_TAC 0 200 1[Sphere.norm2hh_x;rad2_x_y;delta_x4_delta4_y;dih_x_y;dih2_x_y;delta_x_y;dih3_x_y;tauq_x_y;GSYM Sphere.dih4_x;GSYM Sphere.dih5_x;GSYM Sphere.dih6_x;vol_x_y;Sphere.eta2_126; Sphere.eta2_135;Sphere.eta2_456;GSYM vol3f_x_lfun;GSYM vol3_x_sqrt;GSYM vol3f_x_sqrt2_lmplus]);ALL_TAC]) gl +;; + + +let X_FROZEN_COMPOUND =(map SPEC_ALL [ + vol3r_126_x;REAL_ARITH `&2 = #2.0`; + GSYM arclength_x_234; + GSYM arclength_x_126; + GSYM Functional_equation.nonf_gamma2_x1_div_a_v2; + ] ) ;; + + +let decimal = REWRITE_RULE [REAL_ARITH `&2 = #2.0`];; + +let X_COMPOUND_DEF = [REAL_ARITH `&2 = #2.0`; + beta_bump_force_x; + GSYM Sphere.gchi1_x;GSYM Sphere.gchi2_x; + GSYM Sphere.gchi3_x;GSYM Sphere.gchi4_x; + GSYM Sphere.gchi5_x;GSYM Sphere.gchi6_x; + GSYM Sphere.arclength_x1;GSYM Sphere.arclength_x2; + GSYM Enclosed.quad_cross_diag2_x; + tauq_x_y;] @ + map decimal [ + GSYM Sphere.ldih_x;GSYM Sphere.ldih2_x; + GSYM Sphere.ldih3_x;GSYM Sphere.ldih6_x; + ];; + +let X_OF_Y_TAC = + ( + (DISCH_TAC) THEN + TRY (MATCH_MP_TAC ineq_square2) THEN TRY (MATCH_MP_TAC ineq_square2_9) THEN + (REWRITE_TAC basic_constants_nn) THEN + REWRITE_TAC[GSYM CONJ_ASSOC] THEN + (REPEAT (CONJ_TAC THENL[MP_TAC hminus_gt THEN MP_TAC sqrt3_nn THEN REWRITE_TAC[Sphere.h0;Sphere.hplus] THEN REAL_ARITH_TAC;ALL_TAC])) THEN + (REPEAT GEN_TAC) THEN + (REWRITE_TAC [sol_y_123;taum_123]) THEN + (REWRITE_TAC[ineq]) THEN + (SQRT_SQRT_TAC) THEN + (REPEAT DISCH_TAC) THEN + (* remove x variable compound *) + X_SQRT_COMPOUND_ORDER_TAC THEN + FROZEN_REWRITE_TAC X_FROZEN_COMPOUND THEN + REWRITE_TAC X_COMPOUND_DEF THEN + (* repackage *) + (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN + (REWRITE_TAC[GSYM ineq_expand9]) THEN + (REWRITE_TAC[GSYM ineq_expand6]) THEN + (REWRITE_TAC[REAL_ARITH `(&2 = #2.0) /\ (x pow 2 = x * x) /\ (#2.0 * #2.0 = #4.0) /\ (#2.18 * #2.18 = #4.7524 ) /\ (#2.52 * #2.52 = #6.3504)`;sqrt8_2;sqrt2_sqrt2;Sphere.h0;Sphere.hplus]) THEN + ALL_TAC + );; + +let EXPAND_lfun = + (SUBGOAL_THEN `lfun x1 = (#1.26 - proj_x1 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real))/(#0.26)` (fun t-> REWRITE_TAC[t])) THENL [ + REWRITE_TAC[Sphere.lfun;proj_x1;Sphere.h0;REAL_ARITH `#1.26 - &1 = #0.26`];ALL_TAC] ;; + +let REMOVE_dummy = SUBGOAL_THEN `!(f:bool). (!(dummy:real). ineq [&1,dummy,&1] f) = (!(x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real). ineq[(&1,x1,&1);(&1,x2,&1);(&1,x3,&1);(&1,x4,&1);(&1,x5,&1);(&1,x6,&1)] f)` (fun t-> REWRITE_TAC[t]) THENL[ REWRITE_TAC[ineq] THEN MESON_TAC[REAL_ARITH `~(&2 <= &1)`]; ALL_TAC];; + +let EXPAND_1var = SUBGOAL_THEN `!(f:real->bool) a b. (!(y:real). ineq [a,y,b] (f y)) = (!(x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real). ineq[(a,x1,b);(&1,x2,&1);(&1,x3,&1);(&1,x4,&1);(&1,x5,&1);(&1,x6,&1)] (f x1))` (fun t-> REWRITE_TAC[t]) THENL [REWRITE_TAC[ineq] THEN MESON_TAC[REAL_ARITH `(&1 <= &1)`];ALL_TAC] ;; + + +let REAL_SIMPLIFY_EXPRESSION = let + arith = REAL_ARITH `!x y z. (&8 = #8) /\ (x - y = x + (-- #1.0) * y) /\ + (x * (y+z) = x * y + x * z) /\ (y+z) * x = y * x + z * x /\ + (x + y) + z = x + y + z /\ (-- x * -- y = x * y) /\ (x * -- y = -- x * y) /\ + (-- x * y = -- (x * y)) /\ (x * y) * z = x * y * z /\ -- #1.0 * x = -- x /\ + -- (x + y) = -- x + (--y) /\ -- (-- x) = x /\ (-- (-- x * y) = x * y) /\ + #0.0 = &0 /\ #0 = &0 /\ &0 * x = &0 /\ x * &0 = &0 /\ (&0 + x = x) /\ + -- &0 = &0 /\ (x + &0 = x) /\ (&0 + x = x) /\ + &1 * x = x /\ -- &1 * x = -- x /\ x * sqrt8 = sqrt8 * x ` in + (REWRITE_TAC[REAL_POW_MUL;real_div;REAL_MUL_LZERO; REAL_MUL_RZERO;arith]) ;; + +let EXPAND_SQRT = + (SUBGOAL_THEN `sqrt x1 = sqrt_x1 x1 x2 x3 x4 x5 x6 /\ sqrt x2 = sqrt_x2 x1 x2 x3 x4 x5 x6 /\ sqrt x3 = sqrt_x3 x1 x2 x3 x4 x5 x6 /\ sqrt x4 = sqrt_x4 x1 x2 x3 x4 x5 x6 /\ sqrt x5 = sqrt_x5 x1 x2 x3 x4 x5 x6 /\ sqrt x6 = sqrt_x6 x1 x2 x3 x4 x5 x6 /\ sqrt x8 = sqrt_x5 (x7:real) x2 x3 x4 x8 x9 /\ sqrt x9 = sqrt_x6 x7 x2 x3 x4 x8 x9 ` (fun t->REWRITE_TAC[t]) THENL [REWRITE_TAC[sqrt_x1;sqrt_x2; sqrt_x3;sqrt_x4;sqrt_x5;sqrt_x6];ALL_TAC]) ;; + +(* for 1d inequality involving vol2f marchal *) + +let EXPAND_vol2 = +REWRITE_TAC[vol2f_marchal_pow_y;vol2r_y] THEN + SUBGOAL_THEN `x1 pow 1 = promote pow1 x1 x2 x3 x4 x5 x6 /\ + x1 pow 2 = promote_pow2 x1 x2 x3 x4 x5 x6 /\ + x1 pow 3 = promote_pow3 (x1:real) (x2:real) (x3:real) + (x4:real) (x5:real) (x6:real) /\ + x1 pow 4 = promote pow4 x1 x2 x3 x4 x5 x6` + (fun t->REWRITE_TAC[t]) + THENL[ REWRITE_TAC[promote;pow1;pow2;pow3;pow4;promote_pow2;promote_pow3]; + REWRITE_TAC[LET_DEF;LET_END_DEF]] ;; + +let DEF_expand = + [Sphere.a_spine5;Sphere.b_spine5;Sphere.mm1; + Sphere.flat_term;Sphere.beta_bump_lb;REAL_POW_2; + Sphere.h0; + Sphere.mm2;GSYM Sphere.sqrt2;GSYM Sphere.sqrt3; + GSYM Sphere.sqrt8;sol0_const1;sqrt2_sqrt8; + Sphere.mm1;Sphere.mm2;Sphere.tau0;Sphere.hplus; + tame_table_d_values;Sphere.vol2f; + Sphere.lfun; (* added Oct 17, 2010 *) + ];; + +(* *************************************************************************** *) +(* SERIES3Q1H *) +(* *************************************************************************** *) + +let SERIES3Q1H_5D_TAC = + let instjx = INST_TYPE [(`:real`,`:A`);(`:real`,`:B`);(`:real`,`:C`); + (`:real`,`:D`);(`:real`,`:E`);(`:real`,`:F`)] in + let PROJX = map instjx [ proj_x1;proj_x2;proj_x3;proj_x4;proj_x5;proj_x6] in + let projx = list_mk_conj (map (concl o GSYM) PROJX ) in + (REPEAT STRIP_TAC THEN MATCH_MP_TAC ineq6_of_ineq5) THEN + (REWRITE_TAC[Sphere.pathL;Sphere.pathR;Sphere.hplus;Sphere.h0]) THEN + (REWRITE_TAC[ineq_expand6]) THEN + (REPEAT GEN_TAC THEN REPEAT DISCH_TAC) THEN + (SUBGOAL_THEN projx (fun t -> PURE_ONCE_REWRITE_TAC[t])) THENL + [(REWRITE_TAC PROJX);ALL_TAC] THEN + (REPEAT (POP_ASSUM MP_TAC)) THEN + (REWRITE_TAC[GSYM ineq_expand6]);; + +(* *************************************************************************** *) +(* STYLIZE and WRAPUP *) +(* *************************************************************************** *) + +let STYLIZE_TAC = + let real_arith_lt = + REAL_ARITH `(x < y <=> (x- y < &0)) /\ (x <= y <=> (x-y <= &0))` in + let real_arith_gt = + REAL_ARITH `(x > y <=> (y - x < &0) ) /\ (x >= y <=> (y-x <= &0))` in + let real_arith_unit = + REAL_ARITH `unit0 * (x + y ) = unit0 * x + unit0 * y /\ + unit0 * --x = --(unit0 * x) /\ (unit0 * x = x * unit0) /\ + (x * y) * z = x * y * z` in + let subgoal_proj = `x2 * unit0 = + proj_x2 (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real) /\ + x3 * unit0 = proj_x3 (x1) (x2) (x3) (x4) (x5) (x6) /\ + x1 * unit0 = proj_x1 (x1) (x2) (x3) (x4) (x5) (x6) /\ + (x4 * unit0 = proj_x4 x1 x2 x3 x4 x5 x6) /\ + (x5 * unit0 = proj_x5 x1 x2 x3 x4 x5 x6) /\ + (x6 * unit0 = proj_x6 x1 x2 x3 x4 x5 x6)` in + let subgoal_unit6 = `unit0 = unit6 + (x1:real) (x2:real) (x3:real) (x4:real) (x5:real) (x6:real)` in + REMOVE_dummy THEN + EXPAND_1var THEN + DISCH_TAC THEN REPEAT GEN_TAC THEN + (* rename added Nov 27, 2010 *) + X_RENAME_TAC THEN + REPEAT GEN_TAC THEN + EXPAND_vol2 THEN + (* prev line added Sep 8 , 2010 *) + REWRITE_TAC DEF_expand THEN + (* prev line moved down sep 8 *) + EXPAND_lfun THEN + REWRITE_TAC[ineq] THEN + (REPEAT DISCH_TAC) THEN + (ONCE_REWRITE_TAC[real_arith_lt]) THEN + (REWRITE_TAC[real_arith_gt]) THEN + EXPAND_SQRT THEN + REAL_SIMPLIFY_EXPRESSION THEN + SUBGOAL_THEN `!a. x1:real * a = a * x1` (fun t->REWRITE_TAC[t]) + THENL[REAL_ARITH_TAC;ALL_TAC] THEN (* added OCt 17, 2010 *) + (SUBGOAL_THEN `!x. ((x < &0) <=> (unit0 * x < &0)) /\ + ((x <= &0) <=> (unit0 * x <= &0))` (fun t -> ONCE_REWRITE_TAC[t])) + THENL [REWRITE_TAC[unit0;REAL_ARITH `&1 * x = x`];ALL_TAC] THEN + (REWRITE_TAC[REAL_ARITH `f x1 x2 x3 x4 x5 x6 * (y:real) = + y * f x1 x2 x3 x4 x5 x6 /\ ((x * y) * z = x * y * z)`]) THEN + (REWRITE_TAC[real_arith_unit]) THEN + (REWRITE_TAC[REAL_ARITH `unit0 * x = x * unit0`]) THEN + (REWRITE_TAC[unit0f]) THEN + (SUBGOAL_THEN subgoal_proj (fun t-> REWRITE_TAC[t]) + THENL [REWRITE_TAC[proj_x3;proj_x4;proj_x5;proj_x6;proj_x2; + proj_x1;unit0;REAL_ARITH `x * &1 = x`];ALL_TAC]) THEN + (SUBGOAL_THEN subgoal_unit6 (fun t-> REWRITE_TAC[t]) + THENL [REWRITE_TAC[unit0;unit6];ALL_TAC]) THEN + (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN + (REWRITE_TAC[GSYM ineq_expand9]) THEN + (REWRITE_TAC[GSYM ineq_expand6]) THEN DISCH_TAC;; + +let WRAPUP_TAC = + (REWRITE_TAC[REAL_ARITH `(x * y * (z:real)) = (x * y) * z`]) THEN + (REWRITE_TAC[REAL_ARITH `(y:real) * f x1 x2 x3 x4 x5 x6 = + (f x1 x2 x3 x4 x5 x6) * y `]) THEN + (REWRITE_TAC[REAL_ARITH ` -- (x * y) = x * (-- y) `]) THEN + (REWRITE_TAC[REAL_ARITH ` -- (f x1 x2 x3 x4 x5 x6) = + f x1 x2 x3 x4 x5 x6 * -- &1`]) THEN + (REWRITE_TAC[REAL_ARITH `(x * y) * (z:real) = x * y * z`]) THEN + (REWRITE_TAC[REAL_ARITH `inv y = (&1/y)`]);; + + + + +(* ========================================================================== *) +(* VERIFYING INEQUALITIES *) +(* ========================================================================== *) + +let idq_fields idq = (idq.idv,idq.tags, idq.ineq);; + +(* +let preprocess (s,tags,case) = + let is_xconvert = mem Xconvert tags in + let is_branch = mem Branching tags in + let strip_let_case = strip_let_tm case in + let _ = report ("process and exec: "^s) in + let _ = g (strip_let_case) in + let _ = e(PRELIM_REWRITE_TAC) in + let NONLIN_INTRO = e(MP_TAC (REWRITE_RULE[] NONLIN)) in + let _ = if (is_branch) then e(BRANCH_TAC) else e(ALL_TAC) in + let _ = if (is_xconvert) then e (X_OF_Y_TAC) else e(ALL_TAC) in + let _ = if (is_branch && not(is_xconvert)) then + e(SERIES3Q1H_5D_TAC) else e(ALL_TAC) in + let _ = e (STYLIZE_TAC) in + let _ = e (WRAPUP_TAC) in + let testineq = snd(top_goal()) in + (s,tags,testineq);; +*) + +(* rewritten Jan 28, 2013 *) + +let preprocess (s,tags,case) = + let is_xconvert = mem Xconvert tags in + let is_branch = mem Branching tags in + let _ = report ("process and exec: "^s) in + let LET_ELIM_TAC = CONV_TAC (REDEPTH_CONV let_CONV) in + let tacl = + [LET_ELIM_TAC; + PRELIM_REWRITE_TAC; + MP_TAC (REWRITE_RULE[] NONLIN); + if (is_branch) then BRANCH_TAC else ALL_TAC; + if (is_xconvert) then X_OF_Y_TAC else ALL_TAC; + if (is_branch && not(is_xconvert)) then SERIES3Q1H_5D_TAC else ALL_TAC; + STYLIZE_TAC; + WRAPUP_TAC] in + let _ = g (case) in + let _ = e (EVERY tacl) in + let testineq = snd(top_goal()) in + (s,tags,testineq);; + +let process_and_exec ex (s,tags,case) = + let _ = report ("process and exec: "^s) in + let (s,tags,testineq) = preprocess (s,tags,case) in + execute_interval ex tags s testineq;; + +(* +let process_and_exec ex (s,tags,case) = + let _ = report ("process and exec: "^s) in + let is_xconvert = mem Xconvert tags in + let is_branch = mem Branching tags in + let strip_let_case = strip_let_tm case in + let _ = report ("process and exec: "^s) in + let _ = g (strip_let_case) in + let _ = e(PRELIM_REWRITE_TAC) in + let NONLIN_INTRO = e(MP_TAC (REWRITE_RULE[] NONLIN)) in + let _ = if (is_branch) then e(BRANCH_TAC) else e(ALL_TAC) in + let _ = if (is_xconvert) then e (X_OF_Y_TAC) else e(ALL_TAC) in + let _ = if (is_branch && not(is_xconvert)) then + e(SERIES3Q1H_5D_TAC) else e(ALL_TAC) in + let _ = e (STYLIZE_TAC) in + let _ = e (WRAPUP_TAC) in + let testineq = snd(top_goal()) in + execute_interval ex tags s testineq;; +*) + + +(* + +let get_firstexact s = idq_fields (hd(Ineq.getexact s));; + +let process_and_exec_by_id ex s = + let testcase = get_firstexact s in + process_and_exec ex s testcase;; + +testsplit_idq + ** strips let + ** splits cases at h0 according to the split tags + ** ships the cases off to process_and_exec. +*) + +(* +let testsplit_idq ex idq = + let (s,tags,ineq) = idq_fields idq in + let ineq_strip_let = strip_let_tm ineq in + let suffix i n = Printf.sprintf "%s split(%d/%d)" s i n in + let ls = get_split_tags idq in + if (ls = []) then process_and_exec ex (s,tags,ineq_strip_let) else + let cases = split_all_h0 [(ineq_strip_let, ls)] in + let n = length cases in + for i=0 to (n - 1) do + try (process_and_exec ex (suffix i n,tags,(List.nth cases i))) + with Failure s -> failwith (s ^ " case fail: " ^(string_of_int i)) + done;; +*) + +let preprocess_split_idq idq = + let (s,tags,ineq) = idq_fields idq in + let ineq_strip_let = strip_let_tm ineq in + let suffix i n = Printf.sprintf "%s split(%d/%d)" s i n in + let ls = get_split_tags idq in + if (ls = []) then [preprocess (s,tags,ineq_strip_let)] else + let cases = split_all_h0 [(ineq_strip_let, ls)] in + let n = length cases in + map (fun i -> + try preprocess (suffix i n,tags,List.nth cases i) + with Failure s -> failwith (s^ " case fail: " ^ (string_of_int i))) + (0--(n-1));; + +let testsplit_idq ex idq = + let splits = preprocess_split_idq idq in + map (fun (s,tags,testineq) -> execute_interval ex tags s testineq) splits;; + +let testsplit ex s = testsplit_idq ex (hd (Ineq.getexact s));; + + +end;; diff --git a/text_formalization/nonlinear/parse_ineq.hl b/text_formalization/nonlinear/parse_ineq.hl new file mode 100644 index 0000000..d0b15bc --- /dev/null +++ b/text_formalization/nonlinear/parse_ineq.hl @@ -0,0 +1,691 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: nonlinear inequalities *) +(* Author: Thomas Hales starting from Roland Zumkeller's ccform function *) +(* Date: 2010-05-09 *) +(* ========================================================================== *) + +(* + + Use HOL Light specifications of functions and inequalities to + automatically generate code in other languages. + + ** cfsqp C++ code, + ** glpk for linear programming + ** Objective Caml export of functions + ** LaTeX documentation of inequalities. + + C++ code generation for interval arithmetic is done + separately in optimize.hl. + (This file is independent from that one.) + + CFSQP NOTES + Executing the cfsqp produces three output files: + /tmp/cfsqp_err.txt, + tmp/t.cc tmp/t.o (in the cfsqp directory) + Use macro_add to add new function (that is expanded with rewrites) + Use autogen_add to add new function (automatic C code generation) +*) + +(* +flyspeck_needs "general/flyspeck_lib.hl";; +flyspeck_needs "general/sphere.hl";; +flyspeck_needs "nonlinear/ineq.hl";; +flyspeck_needs "nonlinear/lemma.hl";; +*) + +module Parse_ineq = struct + + open Sphere;; + open Nonlinear_lemma;; + open Functional_equation;; + +let cfsqp_trialcount = ref 500;; + +let dest_decimal = Flyspeck_lib.dest_decimal;; + +let string_of_num' = Flyspeck_lib.string_of_num';; + +let join_comma = Flyspeck_lib.join_comma;; + +let join_lines = Flyspeck_lib.join_lines;; + +let join_space = Flyspeck_lib.join_space;; + +let paren s = "("^ s ^")";; + +let nub = Flyspeck_lib.nub;; + +(* moved to lemmas.hl. +let strip_let_tm t = snd(dest_eq(concl(REDEPTH_CONV let_CONV t)));; + +let strip_let t = REWRITE_RULE[REDEPTH_CONV let_CONV (concl t )] t;; +*) + +(* from HOL Light lib.ml *) + +let rec (--) = fun m n -> if m > n then [] else m::((m + 1) -- n);; + + +(* renamed from output_string to avoid Pervasives module name clash *) + +let output_filestring = Flyspeck_lib.output_filestring;; + + +(* ======================================== +cfsqp generation +======================================== *) + +let c_string_of_term t = + let rec soh t = + if is_var t then fst (dest_var t) + else + let (f,xs) = strip_comb t in + let _ = (is_const f) or + failwith ("Non-const function name: " ^ string_of_term f) in + let ifix i = + let [a;b] = xs in paren(soh a ^ " " ^ i ^ " " ^ soh b) in + let ifix_swapped i = + let [b;a] = xs in paren(soh a ^ " " ^ i ^ " " ^ soh b) in + (* soh: *) + match fst (dest_const f) with + | "real_gt" | "real_ge" | "real_sub" -> ifix "-" + | "real_lt" | "real_le" -> ifix_swapped "-" + | "real_add" -> ifix "+" + | "real_mul" -> ifix "*" + | "real_div" -> ifix "/" + | "\\/" -> ifix "\\/" + | "real_neg" -> let [a] = xs in paren("-" ^ soh a) + | "acs" -> let [a] = xs in paren ("acos" ^ (paren (soh a))) + | "real_of_num" -> let [a] = xs in soh a + | "NUMERAL" -> let [_] = xs in string_of_num' (dest_numeral t) + | "<" -> let [a;b] = xs in paren(soh a ^ " < " ^ soh b) + | ">" -> let [a;b] = xs in paren(soh a ^ " > " ^ soh b) + | "+" -> let [a;b] = xs in paren(soh a ^ " + " ^ soh b) + | "*" -> let [a;b] = xs in paren(soh a ^ " * " ^ soh b) + | "DECIMAL" -> string_of_num' (dest_decimal t) + | "COND" -> + let [a;b;c] = xs in + paren(soh a ^ " ? " ^ soh b ^ " : " ^ soh c) + | "atn2" -> + let [ab] = xs in + let (a,b) = dest_pair ab in + paren("atn2( " ^ soh a ^ "," ^ soh b ^ ")") + | s -> paren(s ^ "(" ^ join_comma(map soh xs) ^ ")") in + (* c_string_of_term: *) + try + soh t + with Failure s -> failwith (s^" ....... "^string_of_term t);; + +let constant_names i = + let rec cn b =function + | Const (s,_) -> s::b + | Comb (s,t) -> (cn [] s) @ (cn[] t) @ b + | Abs(x,t) -> (cn b t) + | _ -> b in + nub (sort (<) (cn [] i ));; + + +(* Rewrite unusual terms to prepare for C++ conversion *) + +(* function calls are dealt with three different ways: + - native_c: use the native C code definition of the function. + - autogen: automatically generate a C style function + - macro_expand: use rewrites to eliminate the function. +*) + +(* Native is the default case. There is no need to list them, except + as documentation. *) + +let native_c = [ + ",";"BIT0";"BIT1";"CONS";"DECIMAL"; "NIL"; "NUMERAL"; "_0"; "acs"; + "ineq"; "pi"; "adodec"; "bdodec";"real_add"; "real_div";"real_pow";"cos"; + "real_ge"; "real_mul"; "real_of_num"; "real_sub"; "machine_eps"; + (* -- *) + "delta_x";"sol_y";"dih_y";"rhazim"; + "lmfun";"lnazim";"hminus"; + "wtcount3_y";"wtcount6_y";"beta_bumpA_y";"matan";"sqp";"sqn"; + (* added May 2011 *) + (* "taum_m_diff_quotient";"taum_m_diff_quotient2"; *) + (* added 2012 *) + "ell_uvx"; + "root"; + "h0cut"; + ];; + +let autogen = ref[];; + +let prep_autogen = (function b -> snd(strip_forall (concl (strip_let b))));; + +let autogen_remove thm = + let thm' = prep_autogen thm in + autogen := filter (fun t -> not (t = thm')) !autogen;; + +let autogen_add thm = + let thm' = prep_autogen thm in + let _ = autogen_remove thm in (* duplicates create C compile error *) + autogen := !autogen @ [thm'];; + +(* cfsqp autogeneration *) + +autogen := map prep_autogen + [sol0;tau0;hplus;mm1;mm2;vol_x;sqrt8;sqrt2;sqrt3;rho_x; + rad2_x;ups_x;eta_x;eta_y;volR; + norm2hh;arclength;regular_spherical_polygon_area; + beta_bump_force_y; + a_spine5;b_spine5;beta_bump_lb;marchal_quartic;vol2r; + tame_table_d;delta_x4;dih_x_alt;sol_x;delta4_squared_x;x1_delta_x; + quad_root_plus_curry; + edge_flat_rewrite;const1;taum;flat_term; + taum_y1;taum_y2;taum_y1_y2; + arclength_y1;arclength_y2;arc_hhn;asn797k;asnFnhk; + lfun_y1;arclength_x_123; + + acs_sqrt_x1_d4;acs_sqrt_x2_d4; + tauq;enclosed_rewrite; + Nonlin_def.sol_euler_x_div_sqrtdelta; + Nonlin_def.dih_x_div_sqrtdelta_posbranch; + dih5_y;dih6_y; + num1;Nonlin_def.dnum1; + flat_term_x; + + eulerA_x; + +Functional_equation.nonf_gamma3_x; +Functional_equation.nonf_gamma23_full8_x; +Functional_equation.nonf_gamma23_keep135_x; +Nonlin_def.gamma2_x_div_azim_v2; +Functional_equation.nonf_gamma2_x1_div_a_v2; +(* Added 2013-05-20 *) +Nonlin_def.mu_y;Nonlin_def.delta_x1;Nonlin_def.taud; +Functional_equation.nonf_ups_126; + Functional_equation.nonf_gamma3f_x_div_sqrtdelta; + ];; + +(* cfsqp definition macros expansion *) + +let macros = ref [Sphere.gamma4f];; + +let macro_remove thm = + let _ = macros := filter (fun t -> not (t = thm)) !macros in + ();; + +let macro_add thm = + let _ = macro_remove thm in + macros := !macros @ [thm];; + +let get_macro_expand() = (!macros);; + +macros := ( + [gamma4f;gamma4fgcy;vol4f;y_of_x_e;vol_y_e;rad2_y_e; + vol3f;vol3r;vol2f;delta4_y;delta4_squared_y;x1_delta_y; + gamma3f;gamma23f; (* gamma23f_126_w1;gamma23f_red; *) + gamma23f_red_03;gamma23f_126_03; + GSYM quadratic_root_plus_curry;REAL_MUL_LZERO; + REAL_MUL_RZERO;FST;SND;pathL;pathR;node2_y;node3_y; + rhazim2;rhazim3;rhazim_x;rhazim2_x;rhazim3_x; + (* functional code *) + rotate2;rotate3;rotate4;rotate5;rotate6; + uni;constant6;promote3_to_6;promote1_to_6; + dummy6; + mul6;add6;sub6;scalar6;compose6;I_DEF; + + functional_proj_x1;functional_proj_y1; + functional_proj_x2;functional_proj_y2; + functional_proj_x3;functional_proj_y3; + functional_proj_x4;functional_proj_y4; + functional_proj_x5;functional_proj_y5; + functional_proj_x6;functional_proj_y6; + Nonlin_def.sol_euler345_x_div_sqrtdelta; + Nonlin_def.sol_euler156_x_div_sqrtdelta; + Nonlin_def.sol_euler246_x_div_sqrtdelta; + + + Nonlin_def.dih4_x_div_sqrtdelta_posbranch; + Nonlin_def.ldih_x_div_sqrtdelta_posbranch; + Nonlin_def.ldih2_x_div_sqrtdelta_posbranch; + Nonlin_def.ldih2_x_div_sqrtdelta_posbranch; + Nonlin_def.ldih3_x_div_sqrtdelta_posbranch; + Nonlin_def.ldih5_x_div_sqrtdelta_posbranch; + Nonlin_def.ldih6_x_div_sqrtdelta_posbranch; + taum_x; + edge_flat2_x; + + delta_126_x; + delta_234_x; + delta_135_x; + + (* may 2011 additions *) + Nonlin_def.rhazim_x_div_sqrtdelta_posbranch; + Nonlin_def.rhazim2_x_div_sqrtdelta_posbranch; + Nonlin_def.rhazim3_x_div_sqrtdelta_posbranch; + Nonlin_def.tau_residual_x; + edge_flat_x; + delta_sub1_x; + + + (* 2012 *) + (* may 2013 additions *) + Nonlin_def.mud_135_x; + Nonlin_def.mud_126_x;Nonlin_def.mud_234_x; + Nonlin_def.mudLs_234_x;Nonlin_def.mudLs_135_x;Nonlin_def.mudLs_126_x; + Nonlin_def.taud_x;Functional_equation.nonfunctional_mu6_x; + Functional_equation.nonfunctional_taud_D1; + Functional_equation.nonfunctional_taud_D2; + Functional_equation.nonfunctional_edge2_126_x; + Functional_equation.nonfunctional_edge2_135_x; + Functional_equation.nonfunctional_edge2_234_x; + Nonlin_def.flat_term2_126_x; + Nonlin_def.flat_term2_135_x;Nonlin_def.flat_term2_234_x + ] @ (!Ineq.dart_classes));; + +let prep_term t = + let t' = REWRITE_CONV (get_macro_expand()) (strip_let_tm t) in + let (a,b)= dest_eq (concl t') in + b;; + +let cc_function t = + let args xs = + let ls = map (fun s -> "double "^s) xs in join_comma ls in + let (lhs,rhs) = dest_eq (prep_term t) in + let (f,xs) = strip_comb lhs in + let ss = map c_string_of_term xs in + let p = Printf.sprintf in + let s = join_lines [ + p"double %s(" (fst (dest_const f)); args ss; + p") { \nreturn ( %s ); \n}\n\n" (c_string_of_term rhs); + ] + in s;; + +let dest_ineq ineq = + let t = snd(strip_forall (prep_term (ineq))) in + let (vs,i) = dest_comb t in + let (_,vs) = dest_comb vs in + let vs = dest_list vs in + let vs = map (fun t -> let (a,b) = dest_pair t in (a,dest_pair b)) vs in + let vs = map (fun (a,(b,c)) -> (a, b, c)) vs in + (t,vs,disjuncts i);; + +let c_dest_ineq ineq = + let cs = c_string_of_term in + let (b,vs,i) = dest_ineq ineq in + (cs b, map (fun (a,b,c) -> (cs a, cs b,cs c)) vs,map cs i);; + +(* generate c++ code of ineq *) + +let case p i j = + Printf.sprintf "case %d: *ret = (%s) - (%s); break;" j (List.nth i j) p;; + +let vardecl y vs = + let varname = map (fun (a,b,c) -> b) vs in + let nvs = List.length vs in + let v j = Printf.sprintf "double %s = %s[%d];" (List.nth varname j) y j in + join_lines (map v (0-- (nvs-1)));; + +let bounds f vs = + let lbs = map f vs in + join_comma lbs;; + +let rec geteps = + let getepsf = function + Eps t -> t + | _ -> 0.0 + in function + [] -> 0.0 + | b::bs -> max(getepsf b) (geteps bs);; + +let (has_penalty,penalty) = + let penalties iqd = + filter (function Penalty _ -> true | _ -> false) iqd.tags in + let hasp iqd = (List.length (penalties iqd) >0) in + let onep iqd = if (hasp iqd) then hd(penalties iqd) else Penalty (0.0,0.0) in + (hasp,onep);; + +let penalty_var iqd = + let penalty_ub = function Penalty(a,_) -> string_of_float a in + ["0.0","penalty",penalty_ub (penalty iqd)];; + +let penalty_wt iqd = if has_penalty iqd then + match (penalty iqd) with + Penalty(_,b) -> (string_of_float b)^" * penalty" +else "0.0";; + +let rec cfsqp_branch = function + | [] -> 0 + | Cfsqp_branch i ::_ -> i + | _::a -> cfsqp_branch a;; + +let move_first i ls = + let (a,b::xs) = chop_list i ls in + b::(a @ xs);; + +let cc_main = +"\n\nint main(){ + //Mathematica generated test data + assert(near (pi(),4.0*atan(1.0))); + assert(near (sqrt2(),1.41421356237309)); + assert(near (sqrt8(),2.828427124746190)); + assert(near (sol0(),0.5512855984325308)); + assert(near (tau0(),1.54065864570856)); + assert(near (acos(0.3),1.26610367277949)); + assert(near(hminus(),1.2317544220903216)); + assert(near(hplus(),1.3254)); + assert(near(mm1(),1.012080868420655)); + assert(near(mm2(),0.0254145072695089)); + assert(near(real_pow(1.18,2.),1.3924)); + assert(near(marchal_quartic(1.18),0.228828103048681825)); + assert(near(lmfun(1.18),0.30769230769230793)); + assert(near(lmfun(1.27),0.0)); + assert(near(rad2_x(4.1,4.2,4.3,4.4,4.5,4.6),1.6333363881302794)); + assert(near(dih_y(2.1,2.2,2.3,2.4,2.5,2.6),1.1884801338917963)); + assert(near(sol_y(2.1,2.2,2.3,2.4,2.5,2.6), 0.7703577405137815)); + assert(near(sol_y(2, 2, 2, 2.52, 3.91404, 3.464),4.560740765722419)); + assert(near(taum(2.1,2.2,2.3,2.4,2.5,2.6),tau_m(2.1,2.2,2.3,2.4,2.5,2.6) )); + assert(near(taum(2.1,2.2,2.3,2.4,2.5,2.6),tau_m_alt(2.1,2.2,2.3,2.4,2.5,2.6) )); + assert(near(taum(2.1,2.2,2.3,2.4,2.5,2.6),0.4913685097602183)); + assert(near(taum(2, 2, 2, 2.52, 3.91404, 3.464),4.009455167289888)); + assert(near(ups_x(4.1,4.2,4.3), 52.88)); + assert(near(eta_y(2.1,2.2,2.3), 1.272816758217772)); + assert(near(beta_bump_force_y(2.1,2.2,2.3,2.4,2.5,2.6), + -0.04734449962124398)); + assert(near(beta_bump_force_y(2.5,2.05,2.1,2.6,2.15,2.2), + beta_bumpA_y(2.5,2.05,2.1,2.6,2.15,2.2))); + assert(near(atn2(1.2,1.3),atan(1.3/1.2))); + assert(near(edge_flat(2.1,2.2,2.3,2.5,2.6),4.273045018670291)); + assert(near(flat_term(2.1),-0.4452691371955056)); + assert(near(enclosed(2.02,2.04,2.06,2.08,2.1,2.12,2.14,2.16,2.18), + 3.426676872737882)); +}\n\n";; + +let cc_code outs iqd = + let (b,vs,i) = c_dest_ineq iqd.ineq in + let vs = vs @ if (has_penalty iqd) then penalty_var iqd else [] in + let branch = cfsqp_branch iqd.tags in + let i = move_first branch i in + let eps = geteps (iqd.tags) in + let casep = if has_penalty iqd then "max(0.0,penalty)" else "0.0" in + let nvs = List.length vs in + let ni = List.length i in + let y = "y_mangle__" in + let p = Printf.sprintf in + let s = join_lines ([ + p"// This code is machine generated "; + p"#include \n#include \n#include "; + p"#include \"../Minimizer.h\"\n#include \"../numerical.h\""; + p"#include "; + p"class trialdata { public: trialdata(Minimizer M,char* s)"; + p"{ M.coutReport(s); };};"; + p"int trialcount = %d;\n" (!cfsqp_trialcount); + join_lines(map cc_function (!autogen)); + p"void c0(int numargs,int whichFn,double* %s, double* ret,void*) {" y; + vardecl y vs ; + p"switch(whichFn) {"; + ] @ map (case casep i) (1-- (-1 + List.length i)) @ [ + p"default: *ret = 0; break; }}\n\n"; + p"void t0(int numargs,int whichFn,double* %s, double* ret,void*) { " y; + vardecl y vs ; + p"*ret = (%e) + (%s) + (%s);" eps (List.nth i 0) (penalty_wt iqd); + p"}"; + p"Minimizer m0() {"; + p" double xmin[%d]= {" nvs;(bounds (function (a,b,c) -> a) vs); + p "};\n double xmax[%d]= {" nvs; (bounds (function (a,b,c) -> c) vs); + p "};\n Minimizer M(trialcount,%d,%d,xmin,xmax);" nvs (ni-1); + p" M.func = t0;"; + p" M.cFunc = c0;"; + p" return M;"; + p"}"; + p "trialdata d0(m0(),\"%s\");\n\n" iqd.idv; + p"int near(double x,double y)"; + p" { double eps = 1.0e-8; return (mabs(x-y) + let e = Sys.command("cd "^flyspeck_dir^"/../cfsqp; make tmp/t.o >& "^err) in + let _ = (e=0) or (Sys.command ("cat "^err); failwith "compiler error ") in + ();; + + let execute_cfsqp = + let cfsqp_out = Filename.temp_file "tmp_cfsqp" ".out" in + let cfsqp_dir = flyspeck_dir^"/../cfsqp" in + fun idq -> + let _ = mk_cc (cfsqp_dir ^ "/tmp/t.cc") idq in + let _ = try (compile()) with Failure s -> failwith (s^idq.idv) in + let _ = (0= Sys.command(cfsqp_dir^"/tmp/t.o | tee "^cfsqp_out)) or + failwith ("execution error "^idq.idv) in + let s = process_to_string ("grep 'NEGATIVE' "^cfsqp_out) in + let _ = (s="") or failwith ("NEGATIVE "^idq.idv) in + ();; + + let execute_cfsqp_list xs = + let fails = ref [] in + let _ = for i=0 to (List.length xs - 1) + do + try (execute_cfsqp (List.nth xs i); Sys.command("date"); ()) + with Failure s -> (fails := s :: (!fails)) done in + fails;; + + +(* ======================================== + +glpk generation +======================================== *) + + + let yy6 = [`y1:real`;`y2:real`;`y3:real`;`y4:real`;`y5:real`;`y6:real`];; + let yy9 = yy6 @ [`y7:real`;`y8:real`;`y9:real`];; + + let glpk_translate =ref + [("dih_y","azim[i,j]");("dih2_y","azim2[i,j]");("dih3_y","azim3[i,j]"); + ("sol_y","sol[j]"); + ("taum","tau[j]");("tauq","tau[j]");("rhazim","rhazim[i,j]"); + ("rhazim2","rhazim2[i,j]");("rhazim3","rhazim3[i,j]"); + ("sqrt8","sqrt8")];; + + let reverse = + let xs = [("y2","y3");("y5","y6");("rhazim2","rhazim3"); + ("dih2_y","dih3_y");] in + let f (a,b) = (b,a) in + let ys = xs @ map f xs in + fun s -> try (List.assoc s ys) with Not_found -> s;; + + let glpk_lookup rev s xs = + let s' = if rev then reverse s else s in + if (xs = yy6) or (xs = yy9) + then + try + (List.assoc s' (!glpk_translate)) + with Not_found -> failwith ("glpk_lookup translate" ^ s) + else if xs = [] + then + try + (List.assoc s' (!glpk_translate)) + with Not_found -> (s'^"[i,j]") + else failwith ("glpk_lookup unknown arg list:" ^ s);; + + let rec glpk_form rev t = + let soh = glpk_form rev in + if is_var t then glpk_lookup rev (fst (dest_var t)) [] else + let (f,xs) = strip_comb t in + let ifix i = let [a;b] = xs in paren(soh a ^ " " ^ i ^ " " ^ soh b) in + let ifix_swapped i = + let [b;a] = xs in paren(soh a ^ " " ^ i ^ " " ^ soh b) in + let _ = (is_const f) or + failwith ("glpk constant expected: " ^ string_of_term f) in + match fst (dest_const f) with + | "real_gt" | "real_ge" | "real_sub" -> ifix "-" + | "real_lt" | "real_le" -> ifix_swapped "-" + | "real_add" -> ifix "+" + | "real_mul" -> ifix "*" + | "real_div" -> ifix "/" + | "real_neg" -> let [a] = xs in paren("-" ^ soh a) + | "real_of_num" -> let [a] = xs in soh a + | "NUMERAL" -> let [_] = xs in string_of_num' (dest_numeral t) + | "DECIMAL" -> string_of_num' (dest_decimal t) + | s -> paren(glpk_lookup rev s xs) ;; + +let (counter,counter_reset) = + let ineqcounter = ref 0 in + let counter t = + let u = !ineqcounter in + let _ = ineqcounter := u+1 in + u in + let counter_reset _ = (ineqcounter := 0) in + (counter,counter_reset);; + +let mk_glpk_ineq rev iqd = + let ineq = iqd.ineq in + let t = snd(strip_forall (ineq)) in + let (vs,i) = dest_comb t in + let (_,vs) = dest_comb vs in + let (f,xs) = strip_comb vs in + let (dart,_) = dest_const f in + let i' = hd(disjuncts i) in + let _ = (xs = yy6) or (xs = yy9) or + (print_qterm vs; failwith "dart_class y1 ... y6 expected") in + let p = Printf.sprintf in + let s = p"ineq%d 'ID[%s]' \n { (i,j) in %s } : \n %s >= 0.0;\n\n" + (counter()) iqd.idv dart (glpk_form rev i') in + s;; + +let mk_glpk_ineq_id rev s = + let iqd = Ineq.getexact s in mk_glpk_ineq rev (hd iqd);; + +let test_domain_symmetry idq = + let ineq = idq.ineq in + let dart = List.nth (snd(strip_comb (snd(strip_forall ineq)))) 0 in + let dom = map(fun (a,(b,c)) -> (a,c)) (map (fun (a,b) -> (a,dest_pair b)) + (map dest_pair + (dest_list(snd(dest_eq( + concl(REWRITE_CONV(!Ineq.dart_classes) dart))))))) in + let nth = List.nth in + ((nth dom 1 = nth dom 2) & (nth dom 4 = nth dom 5)) or + failwith "domain asym";; + +let lpstring() = + let _ = counter_reset() in + let _ = map test_domain_symmetry (Ineq.getfield Lpsymmetry) in + join_lines + (("# File automatically generated from nonlinear inequality list "^ + "via lpstring().\n\n") :: + (map (mk_glpk_ineq false) (Ineq.getfield Lp)) @ + ["# Symmetry section\n\n"] @ + (map (mk_glpk_ineq true) (Ineq.getfield Lpsymmetry)));; + + + +(* ======================================== + +Objective Caml generation +======================================== *) + + +let ocaml_string_of_term t = + let rec soh t = + if is_var t then fst (dest_var t) else + let (f,xs) = strip_comb t in + let ifix i = let [a;b] = xs in paren(soh a ^ " " ^ i ^ " " ^ soh b) in + let fv = + if is_var f + then + let fv = fst(dest_var f) in + let _ = warn true ("variable function name: "^fv) in + fv + else if is_const f then fst (dest_const f) + else + failwith ("var or const expected: " ^ string_of_term f) in + match fv with + | "real_sub" -> ifix "-. " + | "real_add" -> ifix "+." + | "real_mul" -> ifix "*." + | "real_div" -> ifix "/." + | "real_lt" -> ifix "<" + | "real_le" -> ifix "<=" + | "real_gt" -> ifix ">" + | "real_ge" -> ifix ">=" + | "real_pow" -> ifix " ** " + | "/\\" -> ifix "&&" + | "\\/" -> ifix "or" + | "real_neg" -> let [a] = xs in paren("-. " ^ soh a) + | "acs" -> + (try + let [a] = xs in "(acos("^soh a^ "))" + with Match_failure _ -> + let _ = (xs=[]) or failwith "ocaml:acs" in + paren "acos") + | "real_of_num" -> let [a] = xs in soh a + | "NUMERAL" -> let [_] = xs in string_of_num' (dest_numeral t) + | "=" -> let [a;b] = xs in soh a ^ " = " ^ soh b + | "," -> let [a;b] = xs in paren( soh a ^ "," ^ soh b) + | "DECIMAL" -> string_of_num' (dest_decimal t) + | "COND" -> + let [a;b;c] = xs in + paren("if "^( paren(soh a)) ^ + " then " ^ (paren (soh b)) ^ + " else " ^ (paren(soh c)) ) + | "atn2" -> let [ab] = xs in let (a,b) = dest_pair ab in + "atan2 " ^ paren(soh b) ^ " " ^ paren(soh a) ^ " " + (* note reverse order atan2 in ocaml *) + | "domain6" -> let [h;f;g] = xs in domain6 soh h f g + | s -> " " ^ s ^ " " ^ join_space(map (paren o soh) xs) ^ " " + and domain6 soh h f g = + let (hv,hbody) = strip_abs h in + let (f1,xs) = strip_comb f in + let vs a = join_space (map (fst o dest_var) a) in + let hbodys = soh hbody in + let fs = fst(dest_const f1) in + let gs = soh g in + (Printf.sprintf + " %s %s = \n let _ = ( %s ) or failwith \"domain6:%s\" in \n + ( %s ) %s" fs (vs (xs @ hv)) hbodys fs gs (vs hv)) in + try + (soh t) + with Failure s -> failwith (s^" ....... "^string_of_term t);; + +let ocaml_function t = + "let " ^ ocaml_string_of_term t ^ ";;\n\n";; + +let ocaml_autogen = map + (function b -> snd(strip_forall (concl (strip_let b)))) + [sqrt2;sqrt8;delta_x;delta_y;delta_x4;delta_x6;ups_x;eta_x; + eta_y;dih_x;dih_y;dih2_y;dih3_y;sol_x;sol_y;interp;ly;const1; + rho;rhazim;lnazim;taum;arclength];; + +let ocaml_code = + "(* code automatically generated from Parse_ineq.ocaml_code *)\n\n"^ + "module Sphere_math = struct\n\n"^ + "let sqrt = Pervasives.sqrt\n\n" ^ + "let pi = 4.0 *. atan(1.0);;\n" ^ + (join_lines (map ocaml_function ocaml_autogen)) ^ + "end;;\n";; + +let sphere_ml = Filename.temp_file "sphere" ".ml";; + +output_filestring sphere_ml ocaml_code;; + +(* ======================================== + +LaTeX generation +======================================== *) + +let mk_texstring (tm,idv,s) = match tm with + | Section -> "\\section{"^idv^" "^s^"}\n" + | Comment -> "\\begin{remark}["^idv^"]\n"^s^"\n\\end{remark}\n" + | Ineqdoc -> "\\begin{calculation}["^idv^"]\n"^s^"\n\\end{calculation}\n";; + +let texstring() = join_lines (map mk_texstring (List.rev (!Ineq.ineqdoc)));; + +(* +output_filestring "/tmp/ineqdoc.tex" (texstring());; +*) + + +end;; diff --git a/text_formalization/nonlinear/prep.hl b/text_formalization/nonlinear/prep.hl new file mode 100755 index 0000000..7e8cca8 --- /dev/null +++ b/text_formalization/nonlinear/prep.hl @@ -0,0 +1,36568 @@ +(* Auto generated file of preprocessed inequalities. See Scripts.exec *) + +(* Flyspeck Revision: 3366 + + Build: Wed Jul 31 05:38:01 EDT 2013 +*) + +(* need to defuse --# in printer.ml *) + +module Prep = struct + +let prep_ineqs = ref ([]:ineq_datum list);; + + let add_inequality i = +let _ = prep_ineqs:= i :: !prep_ineqs in + ();; + +add_inequality { + idv= "2125338128"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #3.01 * #3.01] + (delta_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "2445657182"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #3.01 * #3.01,x6, #3.01 * #3.01] + (unit6 x1 x2 x3 x4 x5 x6 * #0.11 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.12 + + unit6 x1 x2 x3 x4 x5 x6 * #0.12 * -- #2.0 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi < + &0)`; +};; + + +add_inequality { + idv= "9096461391"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #6.3504, + x5, + #3.01 * #3.01; #3.01 * #3.01,x6, #3.01 * #3.01] + (unit6 x1 x2 x3 x4 x5 x6 * #0.403 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.12 + + unit6 x1 x2 x3 x4 x5 x6 * #0.12 * #2.0 < + &0)`; +};; + + +add_inequality { + idv= "8495326405"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #4.0; #4.0,x2, #4.0; #3.01 * #3.01,x3,&6 * &6; #4.0, + x4, + #4.0; + #2.0 * #1.26 * #2.0 * #1.26, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #3.01 * #3.01,x6,&6 * &6] + (delta_x x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "OMKYNLT 3336871894"; + doc=""; + tags= [Sharp]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0,x4, #4.0; + #4.0, + x5, + #4.0; #4.0,x6, #4.0] + (rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi <= + &0)`; +};; + + +add_inequality { + idv= "5541487347"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #6.3504,x6, #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.103 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi < + &0)`; +};; + + +add_inequality { + idv= "6833979866"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #6.3504, + x5, + #3.01 * #3.01; #6.3504,x6, #3.01 * #3.01] + (unit6 x1 x2 x3 x4 x5 x6 * #0.2759 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi < + &0)`; +};; + + +add_inequality { + idv= "4010906068"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504, + x4, + #3.01 * + #3.01; + #6.3504, + x5, + #3.01 * #3.01; #6.3504,x6, #3.01 * #3.01] + (unit6 x1 x2 x3 x4 x5 x6 * #0.476 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi < + &0)`; +};; + + +add_inequality { + idv= "7881254908"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504, + x4, + #6.3504; + #8.0, + x5, + #3.01 * #3.01; #8.0,x6, #3.01 * #3.01] + (unit6 x1 x2 x3 x4 x5 x6 * #0.696 + + unit6 x1 x2 x3 x4 x5 x6 * #2.0 * -- #0.11 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi < + &0)`; +};; + + +add_inequality { + idv= "5026777310a"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #8.0, + x4, + #3.01 * + #3.01; + #8.0, + x5, + #3.01 * #3.01; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #0.6548 + + unit6 x1 x2 x3 x4 x5 x6 * #2.0 * -- #0.11 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi < + &0 \/ + delta_x x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "5405130650"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #8.0, + x4, + #3.01 * + #3.01; + #6.3504, + x5, + #8.0; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #0.477 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.11 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + unit6 x1 x2 x3 x4 x5 x6 * #0.1 * -- #3.01 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.1 < + &0 \/ + delta_x x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "3603097872"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #8.0, + x4, + #3.01 * + #3.01; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #0.11 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + unit6 x1 x2 x3 x4 x5 x6 * #0.1 * #3.01 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.1 < + &0 \/ + delta_x x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "9507202313"; + doc=""; + tags= [Quad_cluster 10000.]; + ineq= `!x1 x2 x3 x4 x5 x6 x7 x8 x9. + ineq + [ #4.0,x1, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x2, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x3, + #2.0 * + #1.26 * + #2.0 * + #1.26; #3.41 * + #3.41, + x4, + #3.634 * + #3.634; + #4.0, + x5, + #4.0; #6.3504,x6, #6.3504; #4.0,x7, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x8, + #4.0; #3.01 * #3.01,x9, #3.01 * #3.01] + (unit6 x1 x2 x3 x4 x5 x6 * &30 + delta_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + quad_cross_diag2_x x1 x2 x3 x4 x5 x6 x7 x8 x9 + + unit6 x1 x2 x3 x4 x5 x6 * -- #3.01 < + &0)`; +};; + + +add_inequality { + idv= "2468307358"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.62 * + #3.62; + #3.01 * #3.01, + x5, + #3.01 * #3.01; #4.0,x6, #4.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.2565 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi < + &0)`; +};; + + +add_inequality { + idv= "2171548893"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #4.0; #3.01 * #3.01,x2, #3.01 * #3.01; #3.62 * #3.62, + x3, + &6 * &6; #4.0, + x4, + #4.0; + #3.01 * #3.01, + x5, + #3.01 * #3.01; #3.62 * #3.62,x6,&6 * &6] + (delta_x x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "4680581274 delta top issue"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #3.166 * #3.166,x1,&4 * &4; #3.01 * #3.01,x2, #3.01 * #3.01; + #4.0, + x3, + #4.0; #3.166 * #3.166,x4,&4 * &4; #4.0,x5, #4.0; #4.0,x6, #4.0] + (delta_x x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "4680581274 delta issue"; + doc=""; + tags= [Quad_cluster 10000.]; + ineq= `!x1 x2 x3 x4 x5 x6 x7 x8 x9. + ineq + [ #4.0,x1, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x2, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x3, + #2.0 * + #1.26 * + #2.0 * + #1.26; #3.01 * + #3.01, + x4, + #3.166 * + #3.166; + #4.0, + x5, + #4.0; #4.0,x6, #4.0; #4.0,x7, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x8, + #4.0; #3.01 * #3.01,x9, #3.01 * #3.01] + (unit6 x1 x2 x3 x4 x5 x6 * &10 + delta_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + delta_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + quad_cross_diag2_x x1 x2 x3 x4 x5 x6 x7 x8 x9 + + unit6 x1 x2 x3 x4 x5 x6 * -- #3.01 < + &0)`; +};; + + +add_inequality { + idv= "4680581274 a"; + doc=""; + tags= [Quad_cluster 10000.]; + ineq= `!x1 x2 x3 x4 x5 x6 x7 x8 x9. + ineq + [ #4.0,x1, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x2, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x3, + #2.0 * + #1.26 * + #2.0 * + #1.26; #3.01 * + #3.01, + x4, + #3.166 * + #3.166; + #4.0, + x5, + #4.0; #4.0,x6, #4.0; #4.0,x7, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x8, + #4.0; #3.01 * #3.01,x9, #3.01 * #3.01] + (unit6 x1 x2 x3 x4 x5 x6 * #0.513 + + taum_x x1 x2 x3 x4 x5 x6 * -- &1 + + taum_x x7 x2 x3 x4 x8 x9 * -- &1 < + &0 \/ + delta_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- &10 < &0 \/ + delta_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + quad_cross_diag2_x x1 x2 x3 x4 x5 x6 x7 x8 x9 + + unit6 x1 x2 x3 x4 x5 x6 * -- #3.01 < + &0)`; +};; + + +add_inequality { + idv= "5202826650 a"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #6.3504,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #4.0, + x5, + #4.0; #4.0,x6, #4.0] + (tau_residual_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + delta_x x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "4821120729"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x2, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x3, + #2.0 * + #1.26 * + #2.0 * + #1.26; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #4.0, + x5, + #4.0; #4.0,x6, #4.0] + (eulerA_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "8631418063"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x2, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x3, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x4, + #4.0; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #4.0,x6, #4.0] + (delta_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "8346775862"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x2, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x3, + #2.0 * + #1.26 * + #2.0 * + #1.26; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #4.0, + x5, + #4.0; #4.0,x6, #4.0] + (unit6 x1 x2 x3 x4 x5 x6 * &200 + delta_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + delta_x4 x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "6762190381"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x2, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x3, + #2.0 * + #1.26 * + #2.0 * + #1.26; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #4.0, + x5, + #4.0; #4.0,x6, #4.0] + (delta_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- &200 < &0 \/ + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi < + &0)`; +};; + + +add_inequality { + idv= "7550003505 4 4 4"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &16 + + delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + (delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &16 + + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + (delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &16 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + sqrt_x6 x1 x2 x3 x4 x5 x6 + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x5 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 3 4 4"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + mudLs_234_x (&4) (&10) #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &16 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &100 + + delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + (delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &16 + + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + (delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &16 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + sqrt_x5 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 3 3 4"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + mudLs_234_x (&4) (&10) #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + mudLs_126_x (&4) (&10) #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &16 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &100 + + delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + (delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &16 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &100 + + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + (delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &16 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + sqrt_x6 x1 x2 x3 x4 x5 x6 + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 3 3 3"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + mudLs_234_x (&4) (&10) #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + mudLs_126_x (&4) (&10) #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + mudLs_135_x (&4) (&10) #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &16 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &100 + + delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + (delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &16 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &100 + + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + (delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &16 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &100 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + sqrt_x6 x1 x2 x3 x4 x5 x6 + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x5 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 2 4 4"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + mud_234_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &100 < + &0 \/ + (delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &16 + + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + (delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &16 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + sqrt_x5 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 2 3 4"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + mud_234_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + mudLs_126_x (&4) (&10) #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &100 < + &0 \/ + (delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &16 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &100 + + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &16 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "7550003505 2 3 3"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + mud_234_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + mudLs_126_x (&4) (&10) #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + mudLs_135_x (&4) (&10) #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &100 < + &0 \/ + (delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &16 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &100 + + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + (delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &16 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &100 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + sqrt_x5 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 2 2 4"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + mud_234_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + mud_126_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &100 < + &0 \/ + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &100 < + &0 \/ + (delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &16 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + sqrt_x6 x1 x2 x3 x4 x5 x6 + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 2 2 3"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + mud_234_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + mud_126_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + mudLs_135_x (&4) (&10) #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &100 < + &0 \/ + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &100 < + &0 \/ + (delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &16 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &100 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + sqrt_x6 x1 x2 x3 x4 x5 x6 + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 2 2 2"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + mud_234_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + mud_126_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + mud_135_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &100 < + &0 \/ + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &100 < + &0 \/ + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &100 < + &0 \/ + sqrt_x6 x1 x2 x3 x4 x5 x6 + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x5 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 1 4 4"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &16 + + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + (delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &16 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + sqrt_x5 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 1 3 4"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + mudLs_126_x (&4) (&10) #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &16 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &100 + + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &16 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "7550003505 1 3 3"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + mudLs_126_x (&4) (&10) #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + mudLs_135_x (&4) (&10) #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &16 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &100 + + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + (delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &16 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &100 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + sqrt_x5 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 1 2 4"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + mud_126_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &100 < + &0 \/ + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &16 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "7550003505 1 2 3"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + mud_126_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + mudLs_135_x (&4) (&10) #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &100 < + &0 \/ + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &16 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &100 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "7550003505 1 2 2"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + mud_126_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + mud_135_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &100 < + &0 \/ + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &100 < + &0 \/ + sqrt_x5 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 1 1 4"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &16 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + sqrt_x6 x1 x2 x3 x4 x5 x6 + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 1 1 3"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + mudLs_135_x (&4) (&10) #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &16 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &100 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + sqrt_x6 x1 x2 x3 x4 x5 x6 + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 1 1 2"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + mud_135_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &100 < + &0 \/ + sqrt_x6 x1 x2 x3 x4 x5 x6 + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 1 1 1"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + sqrt_x6 x1 x2 x3 x4 x5 x6 + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x5 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 0 4 4"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + flat_term2_234_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + delta_234_x #6.3504 (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < &0) \/ + (delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &16 + + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + (delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &16 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + sqrt_x5 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 0 3 4"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + flat_term2_234_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + mudLs_126_x (&4) (&10) #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + delta_234_x #6.3504 (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < &0) \/ + (delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &16 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &100 + + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &16 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "7550003505 0 3 3"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + flat_term2_234_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + mudLs_126_x (&4) (&10) #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + mudLs_135_x (&4) (&10) #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + delta_234_x #6.3504 (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < &0) \/ + (delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &16 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &100 + + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + (delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &16 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &100 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + sqrt_x5 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 0 2 4"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + flat_term2_234_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + mud_126_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + delta_234_x #6.3504 (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < &0) \/ + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &100 < + &0 \/ + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &16 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "7550003505 0 2 3"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + flat_term2_234_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + mud_126_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + mudLs_135_x (&4) (&10) #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + delta_234_x #6.3504 (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < &0) \/ + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &100 < + &0 \/ + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &16 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &100 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "7550003505 0 2 2"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + flat_term2_234_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + mud_126_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + mud_135_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + delta_234_x #6.3504 (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < &0) \/ + delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &100 < + &0 \/ + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &100 < + &0 \/ + sqrt_x5 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 0 1 4"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + flat_term2_234_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + delta_234_x #6.3504 (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < &0) \/ + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &16 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "7550003505 0 1 3"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + flat_term2_234_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + mudLs_135_x (&4) (&10) #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + delta_234_x #6.3504 (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < &0) \/ + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &16 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &100 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "7550003505 0 1 2"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + flat_term2_234_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + mud_135_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + delta_234_x #6.3504 (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < &0) \/ + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &100 < + &0)`; +};; + + +add_inequality { + idv= "7550003505 0 1 1"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + flat_term2_234_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + delta_234_x #6.3504 (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < &0) \/ + sqrt_x5 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 0 0 4"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + flat_term2_234_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + flat_term2_126_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + delta_234_x #6.3504 (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < &0) \/ + (delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + delta_126_x #6.3504 (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < &0) \/ + (delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &16 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + sqrt_x6 x1 x2 x3 x4 x5 x6 + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 0 0 3"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + flat_term2_234_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + flat_term2_126_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + mudLs_135_x (&4) (&10) #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + delta_234_x #6.3504 (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < &0) \/ + (delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + delta_126_x #6.3504 (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < &0) \/ + (delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &16 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &100 + + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0) \/ + sqrt_x6 x1 x2 x3 x4 x5 x6 + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 0 0 2"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + flat_term2_234_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + flat_term2_126_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + mud_135_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + delta_234_x #6.3504 (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < &0) \/ + (delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + delta_126_x #6.3504 (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < &0) \/ + delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &100 < + &0 \/ + sqrt_x6 x1 x2 x3 x4 x5 x6 + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 0 0 1"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + flat_term2_234_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + flat_term2_126_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + delta_234_x #6.3504 (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < &0) \/ + (delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + delta_126_x #6.3504 (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < &0) \/ + sqrt_x6 x1 x2 x3 x4 x5 x6 + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "7550003505 0 0 0"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (unit6 x1 x2 x3 x4 x5 x6 * #0.712 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + flat_term2_234_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + flat_term2_126_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + flat_term2_135_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 < &0 \/ + (delta_234_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + delta_234_x #6.3504 (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < &0) \/ + (delta_126_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + delta_126_x #6.3504 (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < &0) \/ + (delta_135_x (&4) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + delta_135_x #6.3504 (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < &0) \/ + sqrt_x6 x1 x2 x3 x4 x5 x6 + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x5 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "9692636487"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #4.0, + x5, + #4.0; #4.0,x6, #4.0] + ((taud_D2_num_x x1 x2 x3 x4 x5 x6 < &0 \/ + delta_x x1 x2 x3 x4 x5 x6 < &0) \/ + unit6 x1 x2 x3 x4 x5 x6 * &15 + delta_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "6877738680"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #4.0, + x5, + #4.0; #4.0,x6, #4.0] + (taud_D1_num_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + taud_D1_num_x x1 x2 x3 x4 x5 x6 < &0 \/ + taud_D2_num_x x1 x2 x3 x4 x5 x6 < &0 \/ + taud_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + delta_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- &15 < &0)`; +};; + + +add_inequality { + idv= "7439076204"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #3.01 * #3.01, + x5, + #3.915 * #3.915; #3.01 * #3.01,x6, #3.915 * #3.915] + (delta_x4 x1 x2 x3 x4 x5 x6 < &0 \/ + eulerA_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "6459846571"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #4.52 * + #4.52; + #4.0, + x5, + #4.0; #4.0,x6, #4.0] + (sqrt_x4 x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #3.915 < &0 \/ + delta_x x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "1008824382"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0,x4, #4.0; + #3.01 * #3.01, + x5, + #3.237 * #3.237; #3.01 * #3.01,x6, #3.237 * #3.237] + (unit6 x1 x2 x3 x4 x5 x6 * #0.616 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + flat_term2_135_x (&20) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- #0.705 + + unit6 x1 x2 x3 x4 x5 x6 * #0.012 * -- #4.47 + + unit6 x1 x2 x3 x4 x5 x6 * #0.01 * #2.52 * #2.0 * -- #4.47 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.01 * #4.47 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.01 * #4.47 + + flat_term2_126_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &20 + + delta_135_x (&4 * #1.26 * #1.26) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + delta_126_x (&4 * #1.26 * #1.26) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "8875146520"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0,x4, #4.0; + #3.01 * #3.01, + x5, + #3.237 * #3.237; #3.01 * #3.01,x6, #3.237 * #3.237] + (unit6 x1 x2 x3 x4 x5 x6 * #0.616 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + flat_term2_135_x (&20) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #0.012 * -- #4.47 + + unit6 x1 x2 x3 x4 x5 x6 * #0.01 * #2.52 * #2.0 * -- #4.47 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.01 * #4.47 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.01 * #4.47 + + mud_126_x_v1 ( #2.0 * #1.26) #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &20 + + delta_135_x (&4 * #1.26 * #1.26) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + delta_126_x (&4 * #1.26 * #1.26) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &20 < + &0)`; +};; + + +add_inequality { + idv= "1586903463"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0,x4, #4.0; + #3.01 * #3.01, + x5, + #3.237 * #3.237; #3.01 * #3.01,x6, #3.237 * #3.237] + (unit6 x1 x2 x3 x4 x5 x6 * #0.616 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + flat_term2_135_x (&20) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #0.012 * -- #4.47 + + unit6 x1 x2 x3 x4 x5 x6 * #0.01 * #2.52 * #2.0 * -- #4.47 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.01 * #4.47 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.01 * #4.47 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &20 + + delta_135_x (&4 * #1.26 * #1.26) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + delta_126_x (&4 * #1.26 * #1.26) (&4) (&4) x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &20 + + delta_126_x (&4 * #1.26 * #1.26) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "1948775510"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0,x4, #4.0; + #3.01 * #3.01, + x5, + #3.237 * #3.237; #3.01 * #3.01,x6, #3.237 * #3.237] + (unit6 x1 x2 x3 x4 x5 x6 * #0.616 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + flat_term2_126_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + mud_135_x_v1 ( #2.0 * #1.26) #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + delta_135_x (&4 * #1.26 * #1.26) (&4) (&4) x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- &20 < + &0 \/ + delta_126_x (&4 * #1.26 * #1.26) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "5708641738"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0,x4, #4.0; + #3.01 * #3.01, + x5, + #3.237 * #3.237; #3.01 * #3.01,x6, #3.237 * #3.237] + (unit6 x1 x2 x3 x4 x5 x6 * #0.616 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.053 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &20 + + delta_126_x (&4 * #1.26 * #1.26) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "2565248885"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0,x4, #4.0; + #3.01 * #3.01, + x5, + #3.237 * #3.237; #3.01 * #3.01,x6, #3.237 * #3.237] + (unit6 x1 x2 x3 x4 x5 x6 * #0.616 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + flat_term2_126_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + mud_135_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0 \/ + delta_126_x (&4 * #1.26 * #1.26) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "5429238960"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0,x4, #4.0; + #3.01 * #3.01, + x5, + #3.237 * #3.237; #3.01 * #3.01,x6, #3.237 * #3.237] + (unit6 x1 x2 x3 x4 x5 x6 * &20 + + delta_126_x (&4 * #1.26 * #1.26) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #0.616 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + mud_135_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0)`; +};; + + +add_inequality { + idv= "2320951108"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0,x4, #4.0; + #3.01 * #3.01, + x5, + #3.237 * #3.237; #3.01 * #3.01,x6, #3.237 * #3.237] + (unit6 x1 x2 x3 x4 x5 x6 * #0.616 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + mud_135_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.053 < + &0)`; +};; + + +add_inequality { + idv= "7997589055"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0,x4, #4.0; + #3.01 * #3.01, + x5, + #3.237 * #3.237; #3.01 * #3.01,x6, #3.237 * #3.237] + (unit6 x1 x2 x3 x4 x5 x6 * #0.616 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + mud_126_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + mud_135_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 < + &0)`; +};; + + +add_inequality { + idv= "5546286427"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0,x4, #4.0; + #3.01 * #3.01, + x5, + #3.237 * #3.237; #3.01 * #3.01,x6, #3.237 * #3.237] + (unit6 x1 x2 x3 x4 x5 x6 * #0.616 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + flat_term2_126_x (&0) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.12 < + &0 \/ + delta_126_x (&4 * #1.26 * #1.26) (&4) (&4) x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "7903347843"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0,x4, #4.0; + #3.01 * #3.01, + x5, + #3.237 * #3.237; #3.01 * #3.01,x6, #3.237 * #3.237] + (unit6 x1 x2 x3 x4 x5 x6 * #0.616 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + mud_126_x_v1 #2.0 #2.0 #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * const1 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.12 < + &0)`; +};; + + +add_inequality { + idv= "3665919985"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0,x4, #4.0; + #3.01 * #3.01, + x5, + #3.237 * #3.237; #3.01 * #3.01,x6, #3.237 * #3.237] + (unit6 x1 x2 x3 x4 x5 x6 * #0.541 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi < + &0)`; +};; + + +add_inequality { + idv= "6601228004"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.237 * + #3.237; + #4.0, + x5, + #4.0; #4.0,x6, #4.0] + (taud_D2_num_x x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &20 + delta_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + delta_x x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "3078028960"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #4.0, + x5, + #4.0; #4.0,x6, #4.0] + (delta_x1 x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &20 + delta_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "1347067436"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.237 * + #3.237; + #4.0, + x5, + #4.0; #4.0,x6, #4.0] + (taud_D1_num_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + taud_D1_num_x x1 x2 x3 x4 x5 x6 < &0 \/ + taud_D2_num_x x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #0.12 + taud_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + delta_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- &20 < &0)`; +};; + + +add_inequality { + idv= "2314572187"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #4.0, + x5, + #4.0; #4.0,x6, #4.0] + (taud_x x1 x2 x3 x4 x5 x6 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi < + &0 \/ + delta_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- &80 < &0)`; +};; + + +add_inequality { + idv= "7796879304"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.915 * + #3.915; + #4.0, + x5, + #4.0; #4.0,x6, #4.0] + (delta_x x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &80 + delta_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #0.012 + + unit6 x1 x2 x3 x4 x5 x6 * #0.07 * #2.52 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.07 + + unit6 x1 x2 x3 x4 x5 x6 * #0.01 * #2.52 * #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.01 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.01 + + tau_residual_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "6789182745"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0,x4, #4.0; + #3.01 * #3.01, + x5, + #3.237 * #3.237; #3.01 * #3.01,x6, #3.237 * #3.237] + (dih_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #1.109 < &0)`; +};; + + +add_inequality { + idv= "4887115291"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.01 * + #3.01, + x4, + #3.01 * + #3.01; + #4.0, + x5, + #4.0; #4.0,x6, #4.0] + (unit6 x1 x2 x3 x4 x5 x6 * #1.75 + dih_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "7175074394"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0,x4, #4.0; + #3.01 * #3.01, + x5, + #3.237 * #3.237; #4.0,x6, #4.0] + (unit6 x1 x2 x3 x4 x5 x6 * &20 + delta_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + x1_delta_x x1 x2 x3 x4 x5 x6 * &4 + + delta4_squared_x x1 x2 x3 x4 x5 x6 * -- #0.110186 < + &0)`; +};; + + +add_inequality { + idv= "2485876245b"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #3.01 * #3.01, + x5, + #2.0 * #2.52 * #2.0 * #2.52; #4.0,x6, #3.01 * #3.01] + (delta_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + delta_x x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "2485876245a"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #3.0 * #3.0, + x5, + #2.0 * #2.52 * #2.0 * #2.52; #4.0,x6, #6.3504] + (delta_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "4559601669b"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #4.0; #4.0,x3, #6.3504; #3.01 * #3.01, + x4, + #3.01 * #3.01; + #4.0, + x5, + #6.3504; #4.0,x6, #4.0] + (delta_x4 x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "4559601669"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #4.0; #4.0,x3, #4.0; #3.01 * #3.01, + x4, + #3.915 * #3.915; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (delta_x4 x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "1117202051"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #4.0; #3.01 * #3.01, + x4, + #3.01 * #3.01; + #4.0, + x5, + #6.3504; #4.0,x6, #4.0] + (delta_x4 x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "6843920790"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&1,x1,&1 + (pi * const1) / pi; &1,x2,&1 + (pi * const1) / pi; &1, + x3, + &1 + + (pi * + const1) / + pi; + &2 / #1.26 * &2 / #1.26, + x4, + #3.01 * #3.01; #2.38 * #2.38,x5, #15.53; #2.38 * #2.38,x6, #15.53] + (num1 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "4828966562"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&1,x1,&1 + (pi * const1) / pi; &1,x2,&1 + (pi * const1) / pi; &1, + x3, + &1 + + (pi * + const1) / + pi; + &2 / #1.26 * &2 / #1.26, + x4, + &2 * #1.26 * &2 * #1.26; &2 / #1.26 * &2 / #1.26,x5, #3.01 * #3.01; + #2.38 * #2.38, + x6, + #16.0] + (num1 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "1834976363"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&1,x1,&1 + (pi * const1) / pi; &1,x2,&1 + (pi * const1) / pi; &1, + x3, + &1 + + (pi * + const1) / + pi; + &2 / #1.26 * &2 / #1.26, + x4, + #15.53; &2 / #1.26 * &2 / #1.26,x5,&4 * &4; &2 / #1.26 * &2 / #1.26, + x6, + &4 * &4] + (num1 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + num1 x1 x2 x3 x4 x5 x6 < &0 \/ + dnum1 x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "3137600529"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.7524,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504, + x4, + #8.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #0.868174 + + unit6 x1 x2 x3 x4 x5 x6 * #0.701906 * #2.25 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.701906 + + unit6 x1 x2 x3 x4 x5 x6 * #0.136514 * -- #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.136514 + + unit6 x1 x2 x3 x4 x5 x6 * #0.209239 * #2.18 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.209239 + + unit6 x1 x2 x3 x4 x5 x6 * #0.493373 * #2.65 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.493373 + + unit6 x1 x2 x3 x4 x5 x6 * #0.537385 * -- #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.537385 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0187672 * -- #2.2 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.0187672 + + dih2_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0042 < + &0)`; +};; + + +add_inequality { + idv= "6284721194"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.7524,x1, #6.3504; #4.0,x2, #4.7524; #4.0,x3, #4.7524; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #0.957661 + + unit6 x1 x2 x3 x4 x5 x6 * #0.250506 * #2.36 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.250506 + + unit6 x1 x2 x3 x4 x5 x6 * #0.145114 * -- #2.1 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.145114 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0549376 * #2.1 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.0549376 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0384445 * #2.45 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.0384445 + + unit6 x1 x2 x3 x4 x5 x6 * #0.5275 * -- #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.5275 + + unit6 x1 x2 x3 x4 x5 x6 * #0.118819 * -- #2.45 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.118819 + + dih2_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0011 < + &0)`; +};; + + +add_inequality { + idv= "9185711902"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.7524,x1, #6.3504; #4.0,x2, #4.7524; #4.0,x3, #4.7524; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * -- #1.30119 + + unit6 x1 x2 x3 x4 x5 x6 * #0.392915 * -- #2.36 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.392915 + + unit6 x1 x2 x3 x4 x5 x6 * #0.142563 * -- #2.1 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.142563 + + unit6 x1 x2 x3 x4 x5 x6 * #0.258747 * #2.1 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.258747 + + unit6 x1 x2 x3 x4 x5 x6 * #0.417088 * -- #2.45 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.417088 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0606764 * #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.0606764 + + unit6 x1 x2 x3 x4 x5 x6 * #0.637966 * #2.45 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.637966 + + dih3_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0116 < + &0)`; +};; + + +add_inequality { + idv= "6725783616"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504, + x4, + #8.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #0.88473 + + unit6 x1 x2 x3 x4 x5 x6 * #0.443946 * #2.36 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.443946 + + unit6 x1 x2 x3 x4 x5 x6 * #0.244711 * #2.1 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.244711 + + unit6 x1 x2 x3 x4 x5 x6 * #0.205592 * -- #2.1 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.205592 + + unit6 x1 x2 x3 x4 x5 x6 * #0.739126 * #2.55 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.739126 + + unit6 x1 x2 x3 x4 x5 x6 * #0.127198 * #2.1 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.127198 + + unit6 x1 x2 x3 x4 x5 x6 * #0.61582 * -- #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.61582 + + dih3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0046 < + &0)`; +};; + + +add_inequality { + idv= "1248932983"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #4.7524; #4.7524,x2, #6.3504; #4.7524,x3, #6.3504; + #4.0, + x4, + #6.3504; #4.0,x5, #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * -- #1.33909 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0724529 * -- #2.0 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.0724529 + + unit6 x1 x2 x3 x4 x5 x6 * #0.486824 * #2.18 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.486824 + + unit6 x1 x2 x3 x4 x5 x6 * #0.317329 * -- #2.18 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.317329 + + unit6 x1 x2 x3 x4 x5 x6 * #0.00479451 * #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.00479451 + + unit6 x1 x2 x3 x4 x5 x6 * #0.751179 * #2.25 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.751179 + + unit6 x1 x2 x3 x4 x5 x6 * #0.350857 * -- #2.25 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.350857 + + dih2_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0059 < + &0)`; +};; + + +add_inequality { + idv= "1836408787"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #4.7524; #4.7524,x2, #6.3504; #4.7524,x3, #6.3504; + #4.0, + x4, + #6.3504; #4.0,x5, #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #1.01332 + + unit6 x1 x2 x3 x4 x5 x6 * #0.148615 * -- #2.0 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.148615 + + unit6 x1 x2 x3 x4 x5 x6 * #0.379006 * #2.18 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.379006 + + unit6 x1 x2 x3 x4 x5 x6 * #0.379441 * #2.18 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.379441 + + unit6 x1 x2 x3 x4 x5 x6 * #0.583676 * -- #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.583676 + + unit6 x1 x2 x3 x4 x5 x6 * #0.184708 * #2.25 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.184708 + + unit6 x1 x2 x3 x4 x5 x6 * #0.18471 * #2.25 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.18471 + + dih_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0012 < + &0)`; +};; + + +add_inequality { + idv= "5943578801"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #8.0, + x4, + #3.0 * #3.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #0.936544 + + unit6 x1 x2 x3 x4 x5 x6 * #0.636113 * #2.1 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.636113 + + unit6 x1 x2 x3 x4 x5 x6 * #0.140759 * -- #2.1 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.140759 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0771734 * #2.3 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.0771734 + + unit6 x1 x2 x3 x4 x5 x6 * #1.29068 * #2.82843 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #1.29068 + + unit6 x1 x2 x3 x4 x5 x6 * #0.591328 * -- #2.1 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.591328 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0521775 * #2.1 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.0521775 + + dih2_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0047 < + &0)`; +};; + + +add_inequality { + idv= "2763799127"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #8.0, + x4, + #3.0 * #3.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * -- #0.956317 + + unit6 x1 x2 x3 x4 x5 x6 * #0.419124 * -- #2.0 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.419124 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0753922 * #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.0753922 + + unit6 x1 x2 x3 x4 x5 x6 * #0.252307 * #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.252307 + + unit6 x1 x2 x3 x4 x5 x6 * #0.5 * -- #2.82843 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.5 + + unit6 x1 x2 x3 x4 x5 x6 * #0.246082 * #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.246082 + + unit6 x1 x2 x3 x4 x5 x6 * #0.788717 * #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.788717 + + dih3_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0076 < + &0)`; +};; + + +add_inequality { + idv= "4306175952"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.7524,x1, #2.36 * #2.36; #4.0,x2, #4.7524; #4.0,x3, #4.7524; + #4.0, + x4, + #2.25 * #2.25; #4.0,x5, #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #1.05036 + + unit6 x1 x2 x3 x4 x5 x6 * #0.222178 * #2.18 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.222178 + + unit6 x1 x2 x3 x4 x5 x6 * #0.132628 * -- #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.132628 + + unit6 x1 x2 x3 x4 x5 x6 * #0.219284 * #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.219284 + + unit6 x1 x2 x3 x4 x5 x6 * #0.00563427 * -- #2.25 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.00563427 + + unit6 x1 x2 x3 x4 x5 x6 * #0.59096 * -- #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.59096 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0771574 * #2.52 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.0771574 + + dih2_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0035 < + &0)`; +};; + + +add_inequality { + idv= "2923748598"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.7524,x1, #2.36 * #2.36; #4.0,x2, #4.7524; #4.0,x3, #4.7524; + #4.0, + x4, + #2.25 * #2.25; #4.0,x5, #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * -- #1.29912 + + unit6 x1 x2 x3 x4 x5 x6 * #0.284457 * #2.18 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.284457 + + unit6 x1 x2 x3 x4 x5 x6 * #0.337354 * -- #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.337354 + + unit6 x1 x2 x3 x4 x5 x6 * #0.186287 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.186287 + + unit6 x1 x2 x3 x4 x5 x6 * #0.645382 * #2.25 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.645382 + + unit6 x1 x2 x3 x4 x5 x6 * #0.367671 * -- #2.52 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.367671 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0536051 * -- #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.0536051 + + dih_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0083 < + &0)`; +};; + + +add_inequality { + idv= "6410081357"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #4.7524; #4.0,x2, #4.7524; #4.0,x3, #4.7524; #2.25 * + #2.25, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * -- #1.18616 + + unit6 x1 x2 x3 x4 x5 x6 * #0.436647 * -- #2.18 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.436647 + + unit6 x1 x2 x3 x4 x5 x6 * #0.032258 * -- #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.032258 + + unit6 x1 x2 x3 x4 x5 x6 * #0.289629 * #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.289629 + + unit6 x1 x2 x3 x4 x5 x6 * #0.397053 * -- #2.52 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.397053 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0210289 * #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.0210289 + + unit6 x1 x2 x3 x4 x5 x6 * #0.683341 * #2.25 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.683341 + + dih3_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0087 < + &0)`; +};; + + +add_inequality { + idv= "7316455966"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #4.7524; #4.0,x2, #4.7524; #4.0,x3, #4.7524; #2.25 * + #2.25, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #1.02005 + + unit6 x1 x2 x3 x4 x5 x6 * #0.256494 * #2.18 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.256494 + + unit6 x1 x2 x3 x4 x5 x6 * #0.121497 * -- #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.121497 + + unit6 x1 x2 x3 x4 x5 x6 * #0.256494 * #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.256494 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0116869 * #2.52 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.0116869 + + unit6 x1 x2 x3 x4 x5 x6 * #0.598233 * -- #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.598233 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0187672 * -- #2.25 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.0187672 + + dih2_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0050 < + &0)`; +};; + + +add_inequality { + idv= "3425739813"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504, + x4, + #8.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * -- #1.67609 + + unit6 x1 x2 x3 x4 x5 x6 * #0.506322 * #2.18 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.506322 + + unit6 x1 x2 x3 x4 x5 x6 * #0.212075 * -- #2.1 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.212075 + + unit6 x1 x2 x3 x4 x5 x6 * #0.230669 * -- #2.1 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.230669 + + unit6 x1 x2 x3 x4 x5 x6 * #1.28579 * #2.52 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #1.28579 + + unit6 x1 x2 x3 x4 x5 x6 * #0.249199 * -- #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.249199 + + unit6 x1 x2 x3 x4 x5 x6 * #0.193545 * -- #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.193545 + + dih_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0011 < + &0)`; +};; + + +add_inequality { + idv= "5756588587"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #4.7524; #4.0,x2, #4.7524; #4.0,x3, #4.7524; #2.25 * + #2.25, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #1.16613 + + unit6 x1 x2 x3 x4 x5 x6 * #0.296776 * #2.0 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.296776 + + unit6 x1 x2 x3 x4 x5 x6 * #0.208935 * -- #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.208935 + + unit6 x1 x2 x3 x4 x5 x6 * #0.196313 * #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.196313 + + unit6 x1 x2 x3 x4 x5 x6 * #0.360575 * #2.25 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.360575 + + unit6 x1 x2 x3 x4 x5 x6 * #0.652861 * -- #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.652861 + + unit6 x1 x2 x3 x4 x5 x6 * #0.218063 * #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.218063 + + dih2_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0025 < + &0)`; +};; + + +add_inequality { + idv= "4222324842"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #4.7524; #4.0,x2, #4.7524; #4.0,x3, #4.7524; #4.0, + x4, + #6.3504; + #2.25 * #2.25, + x5, + #6.3504; #2.25 * #2.25,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #1.09969 + + unit6 x1 x2 x3 x4 x5 x6 * #0.146345 * -- #2.0 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.146345 + + unit6 x1 x2 x3 x4 x5 x6 * #0.160538 * #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.160538 + + unit6 x1 x2 x3 x4 x5 x6 * #0.151698 * #2.14 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.151698 + + unit6 x1 x2 x3 x4 x5 x6 * #0.61314 * -- #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.61314 + + unit6 x1 x2 x3 x4 x5 x6 * #0.236149 * #2.25 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.236149 + + unit6 x1 x2 x3 x4 x5 x6 * #0.242043 * #2.25 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.242043 + + dih_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0071 < + &0)`; +};; + + +add_inequality { + idv= "9641946727"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #4.7524; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504, + x4, + #8.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #0.98362 + + unit6 x1 x2 x3 x4 x5 x6 * #0.264094 * #2.18 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.264094 + + unit6 x1 x2 x3 x4 x5 x6 * #0.149308 * -- #2.18 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.149308 + + unit6 x1 x2 x3 x4 x5 x6 * #0.312683 * #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.312683 + + unit6 x1 x2 x3 x4 x5 x6 * #0.282792 * #2.65 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.282792 + + unit6 x1 x2 x3 x4 x5 x6 * #0.581552 * -- #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.581552 + + unit6 x1 x2 x3 x4 x5 x6 * #0.143669 * -- #2.3 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.143669 + + dih2_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0071 < + &0)`; +};; + + +add_inequality { + idv= "2390583444"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #4.7524; #4.0,x2, #4.7524; #4.0,x3, #4.7524; #4.0, + x4, + #2.25 * + #2.25; + #4.0, + x5, + #2.25 * #2.25; #4.0,x6, #2.25 * #2.25] + (unit6 x1 x2 x3 x4 x5 x6 * #1.08627 + + unit6 x1 x2 x3 x4 x5 x6 * #0.159149 * -- #2.0 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.159149 + + unit6 x1 x2 x3 x4 x5 x6 * #0.198496 * #2.1 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.198496 + + unit6 x1 x2 x3 x4 x5 x6 * #0.199306 * #2.1 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.199306 + + unit6 x1 x2 x3 x4 x5 x6 * #0.590083 * -- #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.590083 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0888111 * #2.25 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.0888111 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0881846 * #2.25 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.0881846 + + dih_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0012 < + &0)`; +};; + + +add_inequality { + idv= "7291663656"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504, + x4, + #8.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #0.947391 + + unit6 x1 x2 x3 x4 x5 x6 * #0.637397 * #2.0 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.637397 + + unit6 x1 x2 x3 x4 x5 x6 * #0.120003 * -- #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.120003 + + unit6 x1 x2 x3 x4 x5 x6 * #0.100814 * #2.3 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.100814 + + unit6 x1 x2 x3 x4 x5 x6 * #0.302956 * #2.65 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.302956 + + unit6 x1 x2 x3 x4 x5 x6 * #0.547359 * -- #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.547359 + + unit6 x1 x2 x3 x4 x5 x6 * #0.157745 * #2.2 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.157745 + + dih2_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0009 < + &0)`; +};; + + +add_inequality { + idv= "6987934000"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.7524,x1, #2.36 * #2.36; #4.0,x2, #4.7524; #4.0,x3, #4.7524; + #2.25 * #2.25, + x4, + #6.3504; #4.0,x5, #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #0.952682 + + unit6 x1 x2 x3 x4 x5 x6 * #0.268837 * #2.36 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.268837 + + unit6 x1 x2 x3 x4 x5 x6 * #0.130607 * -- #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.130607 + + unit6 x1 x2 x3 x4 x5 x6 * #0.168729 * #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.168729 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0831764 * #2.52 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.0831764 + + unit6 x1 x2 x3 x4 x5 x6 * #0.580152 * -- #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.580152 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0656612 * -- #2.25 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.0656612 + + dih2_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0042 < + &0)`; +};; + + +add_inequality { + idv= "7819193535"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.00 * #2.00,x1, #4.7524; #4.0,x2, #6.3504; #4.0,x3, #6.3504; + #2.25 * #2.25, + x4, + #6.3504; #4.0,x5, #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #1.16613 + + unit6 x1 x2 x3 x4 x5 x6 * #0.296776 * #2.0 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.296776 + + unit6 x1 x2 x3 x4 x5 x6 * #0.208935 * -- #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.208935 + + unit6 x1 x2 x3 x4 x5 x6 * #0.243302 * #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.243302 + + unit6 x1 x2 x3 x4 x5 x6 * #0.360575 * #2.25 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.360575 + + unit6 x1 x2 x3 x4 x5 x6 * #0.636205 * -- #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.636205 + + unit6 x1 x2 x3 x4 x5 x6 * #0.295156 * #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.295156 + + dih2_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0011 < + &0)`; +};; + + +add_inequality { + idv= "8384511215"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504, + x4, + #8.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #0.913186 + + unit6 x1 x2 x3 x4 x5 x6 * #0.390288 * #2.0 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.390288 + + unit6 x1 x2 x3 x4 x5 x6 * #0.115895 * -- #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.115895 + + unit6 x1 x2 x3 x4 x5 x6 * #0.164805 * -- #2.52 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.164805 + + unit6 x1 x2 x3 x4 x5 x6 * #0.271329 * #2.82843 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.271329 + + unit6 x1 x2 x3 x4 x5 x6 * #0.584817 * -- #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.584817 + + unit6 x1 x2 x3 x4 x5 x6 * #0.170218 * #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.170218 + + dih2_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0015 < + &0)`; +};; + + +add_inequality { + idv= "4750199435"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504, + x4, + #8.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * -- #1.08346 + + unit6 x1 x2 x3 x4 x5 x6 * #0.288794 * -- #2.0 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.288794 + + unit6 x1 x2 x3 x4 x5 x6 * #0.292829 * #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.292829 + + unit6 x1 x2 x3 x4 x5 x6 * #0.036457 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.036457 + + unit6 x1 x2 x3 x4 x5 x6 * #0.348796 * -- #2.52 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.348796 + + unit6 x1 x2 x3 x4 x5 x6 * #0.762602 * #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.762602 + + unit6 x1 x2 x3 x4 x5 x6 * #0.112679 * #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.112679 + + dih2_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0031 < + &0)`; +};; + + +add_inequality { + idv= "1894886027"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.36 * #2.36,x1, #6.3504; #4.0,x2, #4.7524; #4.0,x3, #4.7524; + #2.25 * #2.25, + x4, + #6.3504; #4.0,x5, #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #1.0494 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.401543 + + unit6 x1 x2 x3 x4 x5 x6 * #0.401543 * #2.36 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.207551 + + unit6 x1 x2 x3 x4 x5 x6 * #0.207551 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.0294227 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0294227 * #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.494954 + + unit6 x1 x2 x3 x4 x5 x6 * #0.494954 * #2.25 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.605453 + + unit6 x1 x2 x3 x4 x5 x6 * #0.605453 * -- #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.156385 + + unit6 x1 x2 x3 x4 x5 x6 * #0.156385 * #2.0 + + dih2_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "5835568093"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.36 * #2.36,x1, #6.3504; #4.0,x2, #4.7524; #4.0,x3, #4.7524; + #4.0, + x4, + #2.25 * #2.25; #4.0,x5, #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #1.0494 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.404131 + + unit6 x1 x2 x3 x4 x5 x6 * #0.404131 * #2.36 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.212119 + + unit6 x1 x2 x3 x4 x5 x6 * #0.212119 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.0402827 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0402827 * #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.299046 + + unit6 x1 x2 x3 x4 x5 x6 * #0.299046 * #2.25 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.643273 + + unit6 x1 x2 x3 x4 x5 x6 * #0.643273 * -- #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.266118 + + unit6 x1 x2 x3 x4 x5 x6 * #0.266118 * #2.0 + + dih2_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "4002562507"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.7524,x1, #2.36 * #2.36; #4.0,x2, #4.7524; #4.0,x3, #4.7524; + #4.0, + x4, + #2.25 * #2.25; #4.0,x5, #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #1.0494 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.29013 + + unit6 x1 x2 x3 x4 x5 x6 * #0.29013 * #2.36 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.215328 + + unit6 x1 x2 x3 x4 x5 x6 * #0.215328 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.0715511 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0715511 * #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.267157 + + unit6 x1 x2 x3 x4 x5 x6 * #0.267157 * #2.25 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.650269 + + unit6 x1 x2 x3 x4 x5 x6 * #0.650269 * -- #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.295198 + + unit6 x1 x2 x3 x4 x5 x6 * #0.295198 * #2.0 + + dih2_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "7409690040"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.7524,x1, #2.36 * #2.36; #4.0,x2, #4.7524; #4.0,x3, #4.7524; + #2.25 * #2.25, + x4, + #6.3504; #4.0,x5, #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #1.0494 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.297823 + + unit6 x1 x2 x3 x4 x5 x6 * #0.297823 * #2.36 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.215328 + + unit6 x1 x2 x3 x4 x5 x6 * #0.215328 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.0792439 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0792439 * #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.422674 + + unit6 x1 x2 x3 x4 x5 x6 * #0.422674 * #2.25 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.647416 + + unit6 x1 x2 x3 x4 x5 x6 * #0.647416 * -- #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.207561 + + unit6 x1 x2 x3 x4 x5 x6 * #0.207561 * #2.0 + + dih2_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "9925287433"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.36 * #2.36,x1, #6.3504; #4.0,x2, #4.7524; #4.0,x3, #4.7524; + #2.25 * #2.25, + x4, + #6.3504; #4.0,x5, #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * -- #1.542 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.490439 + + unit6 x1 x2 x3 x4 x5 x6 * #0.490439 * #2.36 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.321849 + + unit6 x1 x2 x3 x4 x5 x6 * #0.321849 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.320956 + + unit6 x1 x2 x3 x4 x5 x6 * #0.320956 * -- #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #1.00902 + + unit6 x1 x2 x3 x4 x5 x6 * #1.00902 * #2.25 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.240709 + + unit6 x1 x2 x3 x4 x5 x6 * #0.240709 * -- #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.218081 + + unit6 x1 x2 x3 x4 x5 x6 * #0.218081 * -- #2.0 + + dih_x x1 x2 x3 x4 x5 x6 < + &0)`; +};; + + +add_inequality { + idv= "4841020453"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.36 * #2.36,x1, #6.3504; #4.0,x2, #4.7524; #4.0,x3, #4.7524; + #4.0, + x4, + #2.25 * #2.25; #4.0,x5, #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * -- #1.542 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.490439 + + unit6 x1 x2 x3 x4 x5 x6 * #0.490439 * #2.36 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.318125 + + unit6 x1 x2 x3 x4 x5 x6 * #0.318125 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.32468 + + unit6 x1 x2 x3 x4 x5 x6 * #0.32468 * -- #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.740079 + + unit6 x1 x2 x3 x4 x5 x6 * #0.740079 * #2.25 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.178868 + + unit6 x1 x2 x3 x4 x5 x6 * #0.178868 * -- #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.205819 + + unit6 x1 x2 x3 x4 x5 x6 * #0.205819 * -- #2.0 + + dih_x x1 x2 x3 x4 x5 x6 < + &0)`; +};; + + +add_inequality { + idv= "3139693500"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.7524,x1, #2.36 * #2.36; #4.0,x2, #4.7524; #4.0,x3, #4.7524; + #4.0, + x4, + #2.25 * #2.25; #4.0,x5, #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * -- #1.542 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.346773 + + unit6 x1 x2 x3 x4 x5 x6 * #0.346773 * #2.36 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.300751 + + unit6 x1 x2 x3 x4 x5 x6 * #0.300751 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.300751 + + unit6 x1 x2 x3 x4 x5 x6 * #0.300751 * -- #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.702567 + + unit6 x1 x2 x3 x4 x5 x6 * #0.702567 * #2.25 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.172726 + + unit6 x1 x2 x3 x4 x5 x6 * #0.172726 * -- #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.172727 + + unit6 x1 x2 x3 x4 x5 x6 * #0.172727 * -- #2.0 + + dih_x x1 x2 x3 x4 x5 x6 < + &0)`; +};; + + +add_inequality { + idv= "3872614111"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.7524,x1, #2.36 * #2.36; #4.0,x2, #4.7524; #4.0,x3, #4.7524; + #2.25 * #2.25, + x4, + #6.3504; #4.0,x5, #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * -- #1.542 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.362519 + + unit6 x1 x2 x3 x4 x5 x6 * #0.362519 * #2.36 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.298691 + + unit6 x1 x2 x3 x4 x5 x6 * #0.298691 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.287065 + + unit6 x1 x2 x3 x4 x5 x6 * #0.287065 * -- #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.920785 + + unit6 x1 x2 x3 x4 x5 x6 * #0.920785 * #2.25 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.190917 + + unit6 x1 x2 x3 x4 x5 x6 * #0.190917 * -- #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.219132 + + unit6 x1 x2 x3 x4 x5 x6 * #0.219132 * -- #2.0 + + dih_x x1 x2 x3 x4 x5 x6 < + &0)`; +};; + + +add_inequality { + idv= "4041673283"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.7524,x1, #6.3504; #4.0,x2, #4.7524; #4.0,x3, #4.7524; #4.0, + x4, + #2.25 * + #2.25; + #4.0, + x5, + #2.25 * #2.25; #4.0,x6, #2.25 * #2.25] + (unit6 x1 x2 x3 x4 x5 x6 * -- #1.1864 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.20758 + + unit6 x1 x2 x3 x4 x5 x6 * #0.20758 * -- #2.18 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.236153 + + unit6 x1 x2 x3 x4 x5 x6 * #0.236153 * #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.14172 + + unit6 x1 x2 x3 x4 x5 x6 * #0.14172 * -- #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.263109 + + unit6 x1 x2 x3 x4 x5 x6 * #0.263109 * -- #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.737003 + + unit6 x1 x2 x3 x4 x5 x6 * #0.737003 * #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.12047 + + unit6 x1 x2 x3 x4 x5 x6 * #0.12047 * -- #2.0 + + dih2_x x1 x2 x3 x4 x5 x6 < + &0)`; +};; + + +add_inequality { + idv= "1284543870"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.7524,x1, #6.3504; #4.0,x2, #4.7524; #4.0,x3, #4.7524; #4.0, + x4, + #2.25 * + #2.25; + #4.0, + x5, + #2.25 * #2.25; #4.0,x6, #2.25 * #2.25] + (unit6 x1 x2 x3 x4 x5 x6 * #1.185 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.372262 + + unit6 x1 x2 x3 x4 x5 x6 * #0.372262 * #2.18 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.214849 + + unit6 x1 x2 x3 x4 x5 x6 * #0.214849 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.163775 + + unit6 x1 x2 x3 x4 x5 x6 * #0.163775 * #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.293508 + + unit6 x1 x2 x3 x4 x5 x6 * #0.293508 * #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.656172 + + unit6 x1 x2 x3 x4 x5 x6 * #0.656172 * -- #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.267157 + + unit6 x1 x2 x3 x4 x5 x6 * #0.267157 * #2.0 + + dih2_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "6619134733"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.7524,x1, #6.3504; #4.0,x2, #4.7524; #4.0,x3, #4.7524; #4.0, + x4, + #2.25 * + #2.25; + #4.0, + x5, + #2.25 * #2.25; #4.0,x6, #2.25 * #2.25] + (unit6 x1 x2 x3 x4 x5 x6 * -- #1.27799 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.439002 + + unit6 x1 x2 x3 x4 x5 x6 * #0.439002 * #2.18 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.229466 + + unit6 x1 x2 x3 x4 x5 x6 * #0.229466 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.229466 + + unit6 x1 x2 x3 x4 x5 x6 * #0.229466 * -- #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.771733 + + unit6 x1 x2 x3 x4 x5 x6 * #0.771733 * #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.208429 + + unit6 x1 x2 x3 x4 x5 x6 * #0.208429 * -- #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.208429 + + unit6 x1 x2 x3 x4 x5 x6 * #0.208429 * -- #2.0 + + dih_x x1 x2 x3 x4 x5 x6 < + &0)`; +};; + + +add_inequality { + idv= "8657368829"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.7524,x1, #6.3504; #4.0,x2, #4.7524; #4.0,x3, #4.7524; #4.0, + x4, + #2.25 * + #2.25; + #4.0, + x5, + #2.25 * #2.25; #4.0,x6, #2.25 * #2.25] + (unit6 x1 x2 x3 x4 x5 x6 * #1.277 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.273298 + + unit6 x1 x2 x3 x4 x5 x6 * #0.273298 * -- #2.18 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.273853 + + unit6 x1 x2 x3 x4 x5 x6 * #0.273853 * #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.273853 + + unit6 x1 x2 x3 x4 x5 x6 * #0.273853 * #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.708818 + + unit6 x1 x2 x3 x4 x5 x6 * #0.708818 * -- #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.313988 + + unit6 x1 x2 x3 x4 x5 x6 * #0.313988 * #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.313988 + + unit6 x1 x2 x3 x4 x5 x6 * #0.313988 * #2.0 + + dih_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "7743522046"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.7524,x1, #6.3504; #4.0,x2, #4.7524; #4.0,x3, #4.7524; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * -- #1.1865 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.20758 + + unit6 x1 x2 x3 x4 x5 x6 * #0.20758 * -- #2.18 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.236153 + + unit6 x1 x2 x3 x4 x5 x6 * #0.236153 * #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.14172 + + unit6 x1 x2 x3 x4 x5 x6 * #0.14172 * -- #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.263834 + + unit6 x1 x2 x3 x4 x5 x6 * #0.263834 * -- #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.771203 + + unit6 x1 x2 x3 x4 x5 x6 * #0.771203 * #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.0457292 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0457292 * -- #2.0 + + dih2_x x1 x2 x3 x4 x5 x6 < + &0)`; +};; + + +add_inequality { + idv= "5298513205"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.7524,x1, #6.3504; #4.0,x2, #4.7524; #4.0,x3, #4.7524; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #1.185 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.302913 + + unit6 x1 x2 x3 x4 x5 x6 * #0.302913 * #2.18 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.214849 + + unit6 x1 x2 x3 x4 x5 x6 * #0.214849 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.163775 + + unit6 x1 x2 x3 x4 x5 x6 * #0.163775 * #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.443449 + + unit6 x1 x2 x3 x4 x5 x6 * #0.443449 * #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.67364 + + unit6 x1 x2 x3 x4 x5 x6 * #0.67364 * -- #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.314532 + + unit6 x1 x2 x3 x4 x5 x6 * #0.314532 * #2.0 + + dih2_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "3636849632"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.7524,x1, #6.3504; #4.0,x2, #4.7524; #4.0,x3, #4.7524; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0345 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.185545 + + unit6 x1 x2 x3 x4 x5 x6 * #0.185545 * -- #2.18 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.193139 + + unit6 x1 x2 x3 x4 x5 x6 * #0.193139 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.193139 + + unit6 x1 x2 x3 x4 x5 x6 * #0.193139 * -- #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.170148 + + unit6 x1 x2 x3 x4 x5 x6 * #0.170148 * -- #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.13195 + + unit6 x1 x2 x3 x4 x5 x6 * #0.13195 * -- #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.13195 + + unit6 x1 x2 x3 x4 x5 x6 * #0.13195 * -- #2.0 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi < + &0)`; +};; + + +add_inequality { + idv= "6836427086"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.7524,x1, #6.3504; #4.0,x2, #4.7524; #4.0,x3, #4.7524; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * -- #1.27799 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.356217 + + unit6 x1 x2 x3 x4 x5 x6 * #0.356217 * #2.18 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.229466 + + unit6 x1 x2 x3 x4 x5 x6 * #0.229466 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.229466 + + unit6 x1 x2 x3 x4 x5 x6 * #0.229466 * -- #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.949067 + + unit6 x1 x2 x3 x4 x5 x6 * #0.949067 * #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.172726 + + unit6 x1 x2 x3 x4 x5 x6 * #0.172726 * -- #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.172726 + + unit6 x1 x2 x3 x4 x5 x6 * #0.172726 * -- #2.0 + + dih_x x1 x2 x3 x4 x5 x6 < + &0)`; +};; + + +add_inequality { + idv= "2151506422"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.7524,x1, #6.3504; #4.0,x2, #4.7524; #4.0,x3, #4.7524; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #1.2777 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.281 + + unit6 x1 x2 x3 x4 x5 x6 * #0.281 * -- #2.18 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.278364 + + unit6 x1 x2 x3 x4 x5 x6 * #0.278364 * #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.278364 + + unit6 x1 x2 x3 x4 x5 x6 * #0.278364 * #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.7117 + + unit6 x1 x2 x3 x4 x5 x6 * #0.7117 * -- #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.34336 + + unit6 x1 x2 x3 x4 x5 x6 * #0.34336 * #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.34336 + + unit6 x1 x2 x3 x4 x5 x6 * #0.34336 * #2.0 + + dih_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "181212899 5"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504, + x4, + #6.3504; + #6.3504, + x5, + #8.0; #4.0,x6, #6.3504] + (dih_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #1.448 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.266 + + unit6 x1 x2 x3 x4 x5 x6 * #0.266 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.295 + + unit6 x1 x2 x3 x4 x5 x6 * #0.295 * #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.57 + + unit6 x1 x2 x3 x4 x5 x6 * #0.57 * #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.745 * #2.52 + + unit6 x1 x2 x3 x4 x5 x6 * #0.745 * -- #2.52 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.268 + + unit6 x1 x2 x3 x4 x5 x6 * #0.268 * #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.385 + + unit6 x1 x2 x3 x4 x5 x6 * #0.385 * #2.52 < + &0)`; +};; + + +add_inequality { + idv= "181212899 4"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #6.3504,x6, #8.0] + (dih_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #1.448 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.266 + + unit6 x1 x2 x3 x4 x5 x6 * #0.266 * -- #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.295 + + unit6 x1 x2 x3 x4 x5 x6 * #0.295 * #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.57 + + unit6 x1 x2 x3 x4 x5 x6 * #0.57 * #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.745 * #2.52 + + unit6 x1 x2 x3 x4 x5 x6 * #0.745 * -- #2.52 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.268 + + unit6 x1 x2 x3 x4 x5 x6 * #0.268 * #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.385 + + unit6 x1 x2 x3 x4 x5 x6 * #0.385 * #2.52 < + &0)`; +};; + + +add_inequality { + idv= "181212899 3"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #8.0,x4, #8.0; + #6.3504, + x5, + #8.0; #4.0,x6, #6.3504] + (dih_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #1.448 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.266 + + unit6 x1 x2 x3 x4 x5 x6 * #0.266 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.295 + + unit6 x1 x2 x3 x4 x5 x6 * #0.295 * #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.57 + + unit6 x1 x2 x3 x4 x5 x6 * #0.57 * #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * sqrt8 * #0.745 + + unit6 x1 x2 x3 x4 x5 x6 * #0.745 * -- #2.52 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.268 + + unit6 x1 x2 x3 x4 x5 x6 * #0.268 * #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.385 + + unit6 x1 x2 x3 x4 x5 x6 * #0.385 * #2.52 < + &0)`; +};; + + +add_inequality { + idv= "181212899 2"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #8.0,x4, #8.0; + #4.0, + x5, + #6.3504; #6.3504,x6, #8.0] + (dih_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #1.448 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.266 + + unit6 x1 x2 x3 x4 x5 x6 * #0.266 * -- #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.295 + + unit6 x1 x2 x3 x4 x5 x6 * #0.295 * #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.57 + + unit6 x1 x2 x3 x4 x5 x6 * #0.57 * #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * sqrt8 * #0.745 + + unit6 x1 x2 x3 x4 x5 x6 * #0.745 * -- #2.52 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.268 + + unit6 x1 x2 x3 x4 x5 x6 * #0.268 * #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.385 + + unit6 x1 x2 x3 x4 x5 x6 * #0.385 * #2.52 < + &0)`; +};; + + +add_inequality { + idv= "181212899 1"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504, + x4, + #8.0; + #6.3504, + x5, + #8.0; #4.0,x6, #6.3504] + (dih_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #1.448 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.266 + + unit6 x1 x2 x3 x4 x5 x6 * #0.266 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.295 + + unit6 x1 x2 x3 x4 x5 x6 * #0.295 * #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.57 + + unit6 x1 x2 x3 x4 x5 x6 * #0.57 * #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.745 + + unit6 x1 x2 x3 x4 x5 x6 * #0.745 * -- #2.52 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.268 + + unit6 x1 x2 x3 x4 x5 x6 * #0.268 * #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.385 + + unit6 x1 x2 x3 x4 x5 x6 * #0.385 * #2.52 < + &0)`; +};; + + +add_inequality { + idv= "181212899 0"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504, + x4, + #8.0; + #4.0, + x5, + #6.3504; #6.3504,x6, #8.0] + (dih_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #1.448 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.266 + + unit6 x1 x2 x3 x4 x5 x6 * #0.266 * -- #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.295 + + unit6 x1 x2 x3 x4 x5 x6 * #0.295 * #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.57 + + unit6 x1 x2 x3 x4 x5 x6 * #0.57 * #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.745 + + unit6 x1 x2 x3 x4 x5 x6 * #0.745 * -- #2.52 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.268 + + unit6 x1 x2 x3 x4 x5 x6 * #0.268 * #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.385 + + unit6 x1 x2 x3 x4 x5 x6 * #0.385 * #2.52 < + &0)`; +};; + + +add_inequality { + idv= "8611785756"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #4.7524; #4.0,x2, #4.7524; #4.0,x3, #4.7524; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (dih_x x1 x2 x3 x4 x5 x6 * -- &1 + + dih2_x x1 x2 x3 x4 x5 x6 * -- &1 + + dih3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * #0.589 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.24 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.24 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.24 + + unit6 x1 x2 x3 x4 x5 x6 * #0.24 * #6.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.16 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.16 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.16 + + unit6 x1 x2 x3 x4 x5 x6 * #0.16 * -- #6.25 < + &0 \/ + sqrt_x4 x1 x2 x3 x4 x5 x6 + + sqrt_x5 x1 x2 x3 x4 x5 x6 + + sqrt_x6 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- #6.25 < + &0)`; +};; + + +add_inequality { + idv= "8282573160"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.7524,x1, #6.3504; #4.0,x2, #4.7524; #4.0,x3, #4.7524; #6.3504, + x4, + #8.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + unit6 x1 x2 x3 x4 x5 x6 * #0.1413 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.214 + + unit6 x1 x2 x3 x4 x5 x6 * #0.214 * -- #2.18 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.1259 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.1259 + + unit6 x1 x2 x3 x4 x5 x6 * #0.1259 * -- #4.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.067 + + unit6 x1 x2 x3 x4 x5 x6 * #0.067 * -- #2.52 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.241 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.241 + + unit6 x1 x2 x3 x4 x5 x6 * #0.241 * -- #4.0 < + &0)`; +};; + + +add_inequality { + idv= "4491491732"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #4.7524; #4.0,x2, #4.7524; #4.0,x3, #4.7524; #4.0, + x4, + #2.25 * + #2.25; + #4.0, + x5, + #2.25 * #2.25; #4.0,x6, #2.25 * #2.25] + (rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0008 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.1631 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.1631 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.1631 + + unit6 x1 x2 x3 x4 x5 x6 * #0.1631 * -- #6.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.2127 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.2127 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.2127 + + unit6 x1 x2 x3 x4 x5 x6 * #0.2127 * -- #6.0 < + &0)`; +};; + + +add_inequality { + idv= "1550635295"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #4.7524; #4.0,x2, #4.7524; #4.0,x3, #4.7524; #4.0, + x4, + #2.25 * + #2.25; + #4.0, + x5, + #2.25 * #2.25; #4.0,x6, #2.25 * #2.25] + (dih_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- #1.232 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.261 + + unit6 x1 x2 x3 x4 x5 x6 * #0.261 * #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.203 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.203 + + unit6 x1 x2 x3 x4 x5 x6 * #0.203 * -- #4.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.772 + + unit6 x1 x2 x3 x4 x5 x6 * #0.772 * #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.191 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.191 + + unit6 x1 x2 x3 x4 x5 x6 * #0.191 * -- #4.0 < + &0)`; +};; + + +add_inequality { + idv= "9229542852"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #4.7524; #4.0,x2, #4.7524; #4.0,x3, #4.7524; #4.0, + x4, + #2.25 * + #2.25; + #4.0, + x5, + #2.25 * #2.25; #4.0,x6, #2.25 * #2.25] + (dih_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #1.230 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.2357 + + unit6 x1 x2 x3 x4 x5 x6 * #0.2357 * -- #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.2493 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.2493 + + unit6 x1 x2 x3 x4 x5 x6 * #0.2493 * #4.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.682 + + unit6 x1 x2 x3 x4 x5 x6 * #0.682 * -- #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.3035 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.3035 + + unit6 x1 x2 x3 x4 x5 x6 * #0.3035 * #4.0 < + &0)`; +};; + + +add_inequality { + idv= "1085358243"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #8.0, + x4, + #3.0 * #3.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (dih_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #1.903 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.4 + + unit6 x1 x2 x3 x4 x5 x6 * #0.4 * -- #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.49688 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.49688 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.49688 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.49688 + + unit6 x1 x2 x3 x4 x5 x6 * #0.49688 * #8 + + sqrt_x4 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * --sqrt8 < + &0)`; +};; + + +add_inequality { + idv= "3566713650"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #8.0, + x4, + #3.0 * #3.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (dih_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- #1.911 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #1.01 + + unit6 x1 x2 x3 x4 x5 x6 * #1.01 * #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.284 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.284 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.284 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.284 + + unit6 x1 x2 x3 x4 x5 x6 * #0.284 * -- #8 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #1.07 + + unit6 x1 x2 x3 x4 x5 x6 * sqrt8 * #1.07 < + &0)`; +};; + + +add_inequality { + idv= "7718591733"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #8.0, + x4, + #3.0 * #3.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (dih2_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #0.955 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.2356 + + unit6 x1 x2 x3 x4 x5 x6 * #0.2356 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.32 + + unit6 x1 x2 x3 x4 x5 x6 * #0.32 * #2.0 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.792 + + unit6 x1 x2 x3 x4 x5 x6 * #0.792 * #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.707 + + unit6 x1 x2 x3 x4 x5 x6 * #0.707 * -- #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.0844 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0844 * #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.821 + + unit6 x1 x2 x3 x4 x5 x6 * sqrt8 * #0.821 < + &0)`; +};; + + +add_inequality { + idv= "7863247282"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #8.0, + x4, + #3.0 * #3.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.053 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.053 + + unit6 x1 x2 x3 x4 x5 x6 * #0.053 * -- &4 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.053 * #2.75 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * #0.053 * #2.75 * sqrt8 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.12 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.14132 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.14132 * &1 / #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.14132 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.14132 * -- &4 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.328 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.328 + + unit6 x1 x2 x3 x4 x5 x6 * #0.328 * -- &4 < + &0)`; +};; + + +add_inequality { + idv= "1642527039"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #8.0, + x4, + #3.0 * #3.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + unit6 x1 x2 x3 x4 x5 x6 * #0.128 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.053 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.053 + + unit6 x1 x2 x3 x4 x5 x6 * #0.053 * -- &4 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.053 * #2.75 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * #0.053 * #2.75 * sqrt8 * &1 / #2.0 < + &0)`; +};; + + +add_inequality { + idv= "4840774900"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #8.0, + x4, + #3.0 * #3.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + unit6 x1 x2 x3 x4 x5 x6 * #0.1054 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.14132 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.14132 * &1 / #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.14132 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.14132 * -- &4 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.36499 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.36499 + + unit6 x1 x2 x3 x4 x5 x6 * #0.36499 * -- &4 < + &0)`; +};; + + +add_inequality { + idv= "5451229371"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #8.0, + x4, + #3.0 * #3.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + unit6 x1 x2 x3 x4 x5 x6 * #0.11 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.14132 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.14132 * &1 / #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.14132 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.14132 * -- &4 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.38 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.38 + + unit6 x1 x2 x3 x4 x5 x6 * #0.38 * -- &4 < + &0)`; +};; + + +add_inequality { + idv= "6224332984"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (dih_x x1 x2 x3 x4 x5 x6 * -- &1 + + dih2_x x1 x2 x3 x4 x5 x6 * -- &1 + + dih3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * #0.589 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.39 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.39 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.39 + + unit6 x1 x2 x3 x4 x5 x6 * #0.39 * #6.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.235 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.235 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.235 + + unit6 x1 x2 x3 x4 x5 x6 * #0.235 * -- #6.25 < + &0 \/ + sqrt_x4 x1 x2 x3 x4 x5 x6 + + sqrt_x5 x1 x2 x3 x4 x5 x6 + + sqrt_x6 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- #6.25 < + &0)`; +};; + + +add_inequality { + idv= "7761782916"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + unit6 x1 x2 x3 x4 x5 x6 * #0.05 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.137 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.137 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.137 + + unit6 x1 x2 x3 x4 x5 x6 * #0.137 * -- #6.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.17 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.17 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.17 + + unit6 x1 x2 x3 x4 x5 x6 * #0.17 * -- #6.25 < + &0 \/ + sqrt_x4 x1 x2 x3 x4 x5 x6 + + sqrt_x5 x1 x2 x3 x4 x5 x6 + + sqrt_x6 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- #6.25 < + &0)`; +};; + + +add_inequality { + idv= "9291937879"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #2.25 * + #2.25; + #4.0, + x5, + #2.25 * #2.25; #4.0,x6, #2.25 * #2.25] + (dih_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #1.23 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.235 + + unit6 x1 x2 x3 x4 x5 x6 * #0.235 * -- #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.362 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.362 + + unit6 x1 x2 x3 x4 x5 x6 * #0.362 * #4.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.694 + + unit6 x1 x2 x3 x4 x5 x6 * #0.694 * -- #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.26 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.26 + + unit6 x1 x2 x3 x4 x5 x6 * #0.26 * #4.0 < + &0)`; +};; + + +add_inequality { + idv= "9225295803"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #2.25 * + #2.25; + #4.0, + x5, + #2.25 * #2.25; #4.0,x6, #2.25 * #2.25] + (rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0034 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.166 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.166 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.166 + + unit6 x1 x2 x3 x4 x5 x6 * #0.166 * -- #6.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.22 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.22 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.22 + + unit6 x1 x2 x3 x4 x5 x6 * #0.22 * -- #6.0 < + &0)`; +};; + + +add_inequality { + idv= "7931207804"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #6.3504, + x5, + #8.0; #6.3504,x6, #8.0] + (rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + unit6 x1 x2 x3 x4 x5 x6 * #0.27 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.0295 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0295 * #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.0778 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0778 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.0778 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0778 * -- #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.37 + + unit6 x1 x2 x3 x4 x5 x6 * #0.37 * -- #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.27 + + unit6 x1 x2 x3 x4 x5 x6 * #0.27 * -- #2.52 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.27 + + unit6 x1 x2 x3 x4 x5 x6 * #0.27 * -- #2.52 < + &0)`; +};; + + +add_inequality { + idv= "2563100177"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #6.3504, + x5, + #8.0; #6.3504,x6, #8.0] + (rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #1.0685 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.4635 + + unit6 x1 x2 x3 x4 x5 x6 * #0.4635 * -- #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.424 + + unit6 x1 x2 x3 x4 x5 x6 * #0.424 * #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.424 + + unit6 x1 x2 x3 x4 x5 x6 * #0.424 * #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.594 + + unit6 x1 x2 x3 x4 x5 x6 * #0.594 * -- #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.124 + + unit6 x1 x2 x3 x4 x5 x6 * #0.124 * #2.52 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.124 + + unit6 x1 x2 x3 x4 x5 x6 * #0.124 * #2.52 < + &0)`; +};; + + +add_inequality { + idv= "5760733457"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #6.3504, + x5, + #8.0; #6.3504,x6, #8.0] + (dih_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #1.0705 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.1 + + unit6 x1 x2 x3 x4 x5 x6 * #0.1 * -- #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.424 + + unit6 x1 x2 x3 x4 x5 x6 * #0.424 * #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.424 + + unit6 x1 x2 x3 x4 x5 x6 * #0.424 * #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.594 + + unit6 x1 x2 x3 x4 x5 x6 * #0.594 * -- #2.0 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.124 + + unit6 x1 x2 x3 x4 x5 x6 * #0.124 * #2.52 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.124 + + unit6 x1 x2 x3 x4 x5 x6 * #0.124 * #2.52 < + &0)`; +};; + + +add_inequality { + idv= "8082208587"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #6.3504, + x5, + #8.0; #6.3504,x6, #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.2759 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi < + &0)`; +};; + + +add_inequality { + idv= "9756015945"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504, + x4, + #8.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #1.08 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.6362 + + unit6 x1 x2 x3 x4 x5 x6 * #0.6362 * #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.565 + + unit6 x1 x2 x3 x4 x5 x6 * #0.565 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.359 + + unit6 x1 x2 x3 x4 x5 x6 * #0.359 * #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.416 + + unit6 x1 x2 x3 x4 x5 x6 * #0.416 * #2.52 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.666 + + unit6 x1 x2 x3 x4 x5 x6 * #0.666 * -- #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.061 + + unit6 x1 x2 x3 x4 x5 x6 * #0.061 * #2.0 < + &0)`; +};; + + +add_inequality { + idv= "9251360200"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504, + x4, + #8.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #1.629 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.866 + + unit6 x1 x2 x3 x4 x5 x6 * #0.866 * -- #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.3805 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.3805 + + unit6 x1 x2 x3 x4 x5 x6 * #0.3805 * #4.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.841 + + unit6 x1 x2 x3 x4 x5 x6 * #0.841 * -- #2.52 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.501 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.501 + + unit6 x1 x2 x3 x4 x5 x6 * #0.501 * #4.0 < + &0)`; +};; + + +add_inequality { + idv= "5000076558"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504, + x4, + #8.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (dih2_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #1.083 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.6365 + + unit6 x1 x2 x3 x4 x5 x6 * #0.6365 * #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.198 + + unit6 x1 x2 x3 x4 x5 x6 * #0.198 * -- #2.0 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.352 + + unit6 x1 x2 x3 x4 x5 x6 * #0.352 * #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.416 + + unit6 x1 x2 x3 x4 x5 x6 * #0.416 * #2.52 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.66 + + unit6 x1 x2 x3 x4 x5 x6 * #0.66 * -- #2.0 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.071 + + unit6 x1 x2 x3 x4 x5 x6 * #0.071 * #2.0 < + &0)`; +};; + + +add_inequality { + idv= "9922699028"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504, + x4, + #8.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (dih_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- #1.6294 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.2213 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.2213 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.2213 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.2213 + + unit6 x1 x2 x3 x4 x5 x6 * #0.2213 * -- #8.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.913 + + unit6 x1 x2 x3 x4 x5 x6 * #0.913 * #2.52 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.728 + + unit6 x1 x2 x3 x4 x5 x6 * #0.728 * #2.0 < + &0)`; +};; + + +add_inequality { + idv= "3318775219"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504, + x4, + #8.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (dih_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #1.629 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.414 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.414 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.414 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.414 + + unit6 x1 x2 x3 x4 x5 x6 * #0.414 * #8.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.763 + + unit6 x1 x2 x3 x4 x5 x6 * #0.763 * -- #2.52 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.315 + + unit6 x1 x2 x3 x4 x5 x6 * #0.315 * -- #2.0 < + &0)`; +};; + + +add_inequality { + idv= "8248508703"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504, + x4, + #8.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + unit6 x1 x2 x3 x4 x5 x6 * #0.1 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.265 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.265 + + unit6 x1 x2 x3 x4 x5 x6 * #0.265 * -- #4.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.06 + + unit6 x1 x2 x3 x4 x5 x6 * #0.06 * -- #2.52 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.16 + + unit6 x1 x2 x3 x4 x5 x6 * #0.16 * -- #2.0 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.115 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.115 + + unit6 x1 x2 x3 x4 x5 x6 * #0.115 * -- #4.0 < + &0)`; +};; + + +add_inequality { + idv= "6988401556"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504, + x4, + #8.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #0.103 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi < + &0)`; +};; + + +add_inequality { + idv= "9995621667"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #3.0 * #3.0, + x4, + #3.0 * #3.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (dih_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #2.09 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.578 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.578 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.578 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.578 + + unit6 x1 x2 x3 x4 x5 x6 * #0.578 * #8.0 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.54 + + unit6 x1 x2 x3 x4 x5 x6 * #0.54 * -- #2.0 < + &0)`; +};; + + +add_inequality { + idv= "9414951439"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #8.0,x4, #8.0; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (dih_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #1.91 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.458 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.458 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.458 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.458 + + unit6 x1 x2 x3 x4 x5 x6 * #0.458 * #8.0 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.342 + + unit6 x1 x2 x3 x4 x5 x6 * #0.342 * -- #2.0 < + &0)`; +};; + + +add_inequality { + idv= "3020140039"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #6.3504, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (dih_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #1.629 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.402 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.402 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.402 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.402 + + unit6 x1 x2 x3 x4 x5 x6 * #0.402 * #8.0 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.315 + + unit6 x1 x2 x3 x4 x5 x6 * #0.315 * -- #2.0 < + &0)`; +};; + + +add_inequality { + idv= "5957966880"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #1.2308 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.3639 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.3639 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.3639 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.3639 + + unit6 x1 x2 x3 x4 x5 x6 * #0.3639 * #8.0 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.6 + + unit6 x1 x2 x3 x4 x5 x6 * #0.6 * -- #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.685 + + unit6 x1 x2 x3 x4 x5 x6 * #0.685 * -- #2.0 < + &0)`; +};; + + +add_inequality { + idv= "3526497018"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (dih_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- #1.231 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.152 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.152 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.152 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.152 + + unit6 x1 x2 x3 x4 x5 x6 * #0.152 * -- #8.0 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.5 + + unit6 x1 x2 x3 x4 x5 x6 * #0.5 * #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.773 + + unit6 x1 x2 x3 x4 x5 x6 * #0.773 * #2.0 < + &0)`; +};; + + +add_inequality { + idv= "4047599236"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (dih_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #1.2308 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.3639 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.3639 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.3639 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.3639 + + unit6 x1 x2 x3 x4 x5 x6 * #0.3639 * #8.0 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.235 + + unit6 x1 x2 x3 x4 x5 x6 * #0.235 * -- #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.685 + + unit6 x1 x2 x3 x4 x5 x6 * #0.685 * -- #2.0 < + &0)`; +};; + + +add_inequality { + idv= "7726998381"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (dih_x x1 x2 x3 x4 x5 x6 + + dih2_x x1 x2 x3 x4 x5 x6 + + dih3_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * --pi + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.5513 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- #0.3232 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.3232 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.3232 + + unit6 x1 x2 x3 x4 x5 x6 * #0.3232 * #6.0 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.151 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.151 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.151 + + unit6 x1 x2 x3 x4 x5 x6 * #0.151 * -- #6.0 < + &0)`; +};; + + +add_inequality { + idv= "7394240696"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (dih_x x1 x2 x3 x4 x5 x6 * -- &1 + + dih2_x x1 x2 x3 x4 x5 x6 * -- &1 + + dih3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * #0.55125 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.196 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.196 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.196 + + unit6 x1 x2 x3 x4 x5 x6 * #0.196 * -- #6.0 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.38 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.38 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.38 + + unit6 x1 x2 x3 x4 x5 x6 * #0.38 * #6.0 < + &0)`; +};; + + +add_inequality { + idv= "1395142356"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.001 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.18 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.18 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.18 + + unit6 x1 x2 x3 x4 x5 x6 * #0.18 * -- #6.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #0.125 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.125 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.125 + + unit6 x1 x2 x3 x4 x5 x6 * #0.125 * -- #6.0 < + &0)`; +};; + + +add_inequality { + idv= "4667071578"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + dih_x x1 x2 x3 x4 x5 x6 * #0.507 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.724 < + &0)`; +};; + + +add_inequality { + idv= "8519146937"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + dih_x x1 x2 x3 x4 x5 x6 * #0.259 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.32 < + &0)`; +};; + + +add_inequality { + idv= "3296257235"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.626 + + unit6 x1 x2 x3 x4 x5 x6 * #0.77 < + &0)`; +};; + + +add_inequality { + idv= "5490182221"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (dih_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #1.893 < &0)`; +};; + + +add_inequality { + idv= "5735387903"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #0.852 + dih_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "9563139965 f"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x2, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x3, + #2.0 * + #1.26 * + #2.0 * + #1.26; &3 * &3, + x4, + &3 * &3; + #4.0, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.115 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi < + &0)`; +};; + + +add_inequality { + idv= "9563139965 e"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x2, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x3, + #2.0 * + #1.26 * + #2.0 * + #1.26; &3 * &3, + x4, + &3 * &3; + #2.467 * #2.467, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.467 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.115 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi < + &0)`; +};; + + +add_inequality { + idv= "9563139965 d"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x2, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x3, + #2.0 * + #1.26 * + #2.0 * + #1.26; &3 * &3, + x4, + &3 * &3; + #4.0, + x5, + #2.472 * #2.472; #4.0,x6, #2.472 * #2.472] + (unit6 x1 x2 x3 x4 x5 x6 * #0.467 * &1 / #2.0 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + unit6 x1 x2 x3 x4 x5 x6 * #0.5 * #8.472 * --(&1 / #2.0) + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.5 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.5 < + &0)`; +};; + + +add_inequality { + idv= "5584033259"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&3 * &3,x1,&4 * #1.26 * &4 * #1.26; #4.0,x2, #2.472 * #2.472; + #4.0, + x3, + #2.472 * #2.472; &3 * &3,x4,&4 * #1.26 * &4 * #1.26; #4.0, + x5, + #2.472 * + #2.472; + #4.0, + x6, + #2.472 * #2.472] + (sqrt_x1 x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- &4 < &0 \/ + delta_x x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "5691615370"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #3.0 * #3.0,x1, #3.0 * #3.0; #4.0,x2, #6.3504; #4.0,x3, #6.3504; + #3.0 * #3.0, + x4, + #3.0 * #3.0; #4.0,x5, #6.3504; #4.0,x6, #6.3504] + (delta_x x1 x2 x3 x4 x5 x6 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #8.472 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- &1 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- &1 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- &1 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + sqrt_x2 x1 x2 x3 x4 x5 x6 + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x2 x1 x2 x3 x4 x5 x6 + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x2 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x3 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "3862621143 back"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x2, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x3, + #2.0 * + #1.26 * + #2.0 * + #1.26; #8.0, + x4, + #3.01 * + #3.01; + #4.0, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.103 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi < + &0)`; +};; + + +add_inequality { + idv= "3862621143 front"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x2, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x3, + #2.0 * + #1.26 * + #2.0 * + #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #2.9 * #2.9; + #4.0, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.103 + + dih_x x1 x2 x3 x4 x5 x6 * #0.453 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.777 < + &0)`; +};; + + +add_inequality { + idv= "3862621143 side"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x2, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x3, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x5, + #3.01 * #3.01; #4.0,x6, #2.0 * #1.26 * #2.0 * #1.26] + (rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + dih_x x1 x2 x3 x4 x5 x6 * #0.453 + + unit6 x1 x2 x3 x4 x5 x6 * #0.777 * --(&1 / #2.0) < + &0)`; +};; + + +add_inequality { + idv= "3862621143 revised"; + doc=""; + tags= [Dim_red_backsym;Quad_cluster 0.05]; + ineq= `!x1 x2 x3 x4 x5 x6 x7 x8 x9. + ineq + [ #4.0,x1, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x2, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x3, + #2.0 * + #1.26 * + #2.0 * + #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #4.37 * + #4.37; + #4.0, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x7, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x8, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x9, + #2.0 * #1.26 * #2.0 * #1.26] + (taum_x x1 x2 x3 x4 x5 x6 * -- &1 + + taum_x x7 x2 x3 x4 x8 x9 * -- &1 + + dih_x x1 x2 x3 x4 x5 x6 * #0.453 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.777 < + &0 \/ + quad_cross_diag2_x x1 x2 x3 x4 x5 x6 x7 x8 x9 + + unit6 x1 x2 x3 x4 x5 x6 * -- #3.01 < + &0 \/ + delta_x x1 x2 x3 x4 x5 x6 < &0 \/ + sqrt_x4 x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #2.9 < &0 \/ + delta_x x7 x2 x3 x4 x8 x9 < &0)`; +};; + + +add_inequality { + idv= "4240815464 a reduced"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x2, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x3, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #4.0,x6, #2.0 * #1.26 * #2.0 * #1.26] + (rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.7573 + + unit6 x1 x2 x3 x4 x5 x6 * #1.433 * &1 / #2.0 < + &0)`; +};; + + +add_inequality { + idv= "4240815464 a"; + doc=""; + tags= [Dim_red_backsym;Quad_cluster 0.0001]; + ineq= `!x1 x2 x3 x4 x5 x6 x7 x8 x9. + ineq + [ #4.0,x1, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x2, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x3, + #2.0 * + #1.26 * + #2.0 * + #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #4.37 * + #4.37; + #4.0, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x7, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x8, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x9, + #2.0 * #1.26 * #2.0 * #1.26] + (taum_x x1 x2 x3 x4 x5 x6 * -- &1 + + taum_x x7 x2 x3 x4 x8 x9 * -- &1 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.7573 + + unit6 x1 x2 x3 x4 x5 x6 * #1.433 < + &0 \/ + quad_cross_diag2_x x1 x2 x3 x4 x5 x6 x7 x8 x9 + + unit6 x1 x2 x3 x4 x5 x6 * --sqrt8 < + &0 \/ + delta_x x1 x2 x3 x4 x5 x6 < &0 \/ + delta_x x7 x2 x3 x4 x8 x9 < &0)`; +};; + + +add_inequality { + idv= "6170936724"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&3 * &3,x1,&3 * &3; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #8.0, + x4, + &4 * + #1.26 * + &4 * + #1.26; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (delta_x1 x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "8673686234 c"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #8.0,x1, #3.0 * #3.0; #2.07 * #2.07, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #8.0, + x4, + #3.0 * #3.0; #4.0,x5, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (sqrt_x1 x1 x2 x3 x4 x5 x6 * #2.75 * &1 / #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #2.75 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * sqrt8 * -- #2.75 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- &1 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- &1 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- &1 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #7.99 < + &0 \/ + sqrt_x1 x1 x2 x3 x4 x5 x6 * #2.75 * &1 / #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #2.75 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * sqrt8 * -- #2.75 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- &1 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- &1 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- &1 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #7.99 + + delta_x x1 x2 x3 x4 x5 x6 * #0.00385 < + &0 \/ + delta_x x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "8673686234 b"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #8.0,x1, #3.0 * #3.0; #2.07 * #2.07, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #3.0 * #3.0, + x4, + #3.0 * #3.0; #4.0,x5, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (sqrt_x1 x1 x2 x3 x4 x5 x6 * #2.75 + + unit6 x1 x2 x3 x4 x5 x6 * sqrt8 * -- #2.75 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- &1 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- &1 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- &1 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #7.99 < + &0 \/ + delta_x x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "8673686234 a"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #8.0,x1, #3.0 * #3.0; #4.0,x2, #2.07 * #2.07; #4.0, + x3, + #2.07 * #2.07; + #8.0, + x4, + &4 * #1.26 * &4 * #1.26; #4.0,x5, #2.07 * #2.07; #4.0, + x6, + #2.07 * #2.07] + (sqrt_x1 x1 x2 x3 x4 x5 x6 * #2.75 * &1 / #2.0 + + sqrt_x4 x1 x2 x3 x4 x5 x6 * #2.75 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * sqrt8 * -- #2.75 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- &1 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- &1 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- &1 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #7.99 + + delta_x x1 x2 x3 x4 x5 x6 * #0.00385 < + &0)`; +};; + + +add_inequality { + idv= "3287695934"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.37 * #4.37,x1,&4 * #1.26 * &4 * #1.26; #4.0, + x2, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x3, + #2.0 * + #1.26 * + #2.0 * + #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + &4 * + #1.26 * + &4 * + #1.26; + #4.0, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (delta_x x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "2570626711"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x2, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x3, + #2.0 * + #1.26 * + #2.0 * + #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #4.0, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #1.15 + dih_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "4652969746 2"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #4.0, + x4, + #2.1771 * + #2.1771; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #0.04 * &1 / &5 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi + + dih_x x1 x2 x3 x4 x5 x6 * #0.312 + + unit6 x1 x2 x3 x4 x5 x6 * #0.312 * #2.0 * pi * --(&1 / &5) < + &0)`; +};; + + +add_inequality { + idv= "4652969746 1"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; #4.0,x2, #6.3504; #4.0,x3, #6.3504; #2.1771 * + #2.1771, + x4, + #6.3504; + #4.0, + x5, + #6.3504; #4.0,x6, #6.3504] + (unit6 x1 x2 x3 x4 x5 x6 * #0.04 + + rhazim_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim2_x x1 x2 x3 x4 x5 x6 * -- &1 + + rhazim3_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi + + unit6 x1 x2 x3 x4 x5 x6 * const1 * pi < + &0)`; +};; + + +add_inequality { + idv= "JNTEFVP 1"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&4,x1,&2 * #1.26 * &2 * #1.26; &4,x2,&2 * #1.26 * &2 * #1.26; + &4, + x3, + &2 * #1.26 * &2 * #1.26; &4,x4,&2 * #1.26 * &2 * #1.26; &4, + x5, + &2 * + #1.26 * + &2 * + #1.26; + &8, + x6, + &4 * #1.26 * &4 * #1.26] + (delta_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "SDCCMGA b"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; &1 * &1,x2,&1 * &1; &1 * &1,x3,&1 * &1; &1 * &1, + x4, + &1 * &1; + &1 * &1, + x5, + &1 * &1; &1 * &1,x6,&1 * &1] + (arclength_x1 #2.0 ( #2.0 * #1.26) x1 x2 x3 x4 x5 x6 + + arclength_x1 #2.0 ( #2.0 * #1.26) x1 x2 x3 x4 x5 x6 + + arclength_x1 ( #2.0 * #1.26) #2.0 x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * pi * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * --arc_hhn < + &0)`; +};; + + +add_inequality { + idv= "SDCCMGA a"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #6.3504; &1 * &1,x2,&1 * &1; &1 * &1,x3,&1 * &1; &1 * &1, + x4, + &1 * &1; + &1 * &1, + x5, + &1 * &1; &1 * &1,x6,&1 * &1] + (arclength_x1 #2.0 ( #2.0 * #1.26) x1 x2 x3 x4 x5 x6 + + arclength_x1 #2.0 ( #2.0 * #1.26) x1 x2 x3 x4 x5 x6 + + arclength_x1 ( #2.0 * #1.26) ( #2.0 * #1.26) x1 x2 x3 x4 x5 x6 * + -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #2.0 * --arc_hhn < + &0)`; +};; + + +add_inequality { + idv= "4717061266"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x2, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x3, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #4.0, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (delta_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "6096597438 b"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq [ #3.0,x1, #64.0; &1,x2,&1; &1,x3,&1; &1,x4,&1; &1,x5,&1; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * #0.591 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.0331 + + unit6 x1 x2 x3 x4 x5 x6 * #0.506 * #1.26 * &1 / ( #1.26 + -- &1) + + unit6 x1 x2 x3 x4 x5 x6 * #0.506 * --(&1 / ( #1.26 + -- &1)) + + unit6 x1 x2 x3 x4 x5 x6 * #1.0 + + unit6 x1 x2 x3 x4 x5 x6 * &2 * --pi + + asn797k x1 x2 x3 x4 x5 x6 * &2 < + &0)`; +};; + + +add_inequality { + idv= "6096597438 a"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq [ #1.0,x1, #1.0; &1,x2,&1; &1,x3,&1; &1,x4,&1; &1,x5,&1; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * #0.591 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0331 * -- &64 + + unit6 x1 x2 x3 x4 x5 x6 * #0.506 * #1.26 * &1 / ( #1.26 + -- &1) + + unit6 x1 x2 x3 x4 x5 x6 * #0.506 * --(&1 / ( #1.26 + -- &1)) + + unit6 x1 x2 x3 x4 x5 x6 * #1.0 < + &0)`; +};; + + +add_inequality { + idv= "8055810915"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&4,x1, #2.52 * #2.52; &4,x2,&4; &2 * #1.26 * &2 * #1.26, + x3, + &2 * #1.26 * &2 * #1.26; &1,x4,&1; + &1, + x5, + &1; &1,x6,&1] + (acs_sqrt_x1_d4 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * pi * --(&1 / &6) + + unit6 x1 x2 x3 x4 x5 x6 * #0.797 + + arclength_x_123 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "1965189142 a"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #1.0,x1, #1.26; #3.0,x2, #34.0; &1,x3,&1; &1,x4,&1; &1,x5,&1; + &1, + x6, + &1] + (unit6 x1 x2 x3 x4 x5 x6 * #0.591 + + proj_x2 x1 x2 x3 x4 x5 x6 * -- #0.0331 + + lfun_y1 x1 x2 x3 x4 x5 x6 * #0.506 + + unit6 x1 x2 x3 x4 x5 x6 * &2 * --pi + + asnFnhk x1 x2 x3 x4 x5 x6 * &2 < + &0)`; +};; + + +add_inequality { + idv= "1965189142 34"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq [ #1.0,x1, #1.26; &1,x2,&1; &1,x3,&1; &1,x4,&1; &1,x5,&1; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * #0.591 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0331 * -- &34 + + lfun_y1 x1 x2 x3 x4 x5 x6 * #0.506 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 45"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + #2.0 * + hminus) / + #2.0 * + ( #2.0 + + #2.0 * + hminus) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.121189 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.016252 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.084657 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.084657 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.084657 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.084657 + + unit6 x1 x2 x3 x4 x5 x6 * #0.45858 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 45"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + #2.0 * + hminus) / + #2.0 * + ( #2.0 + + #2.0 * + hminus) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.121189 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.022099 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.084657 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.084657 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.084657 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.084657 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.911046 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 45"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + #2.0 * + hminus) / + #2.0 * + ( #2.0 + + #2.0 * + hminus) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.121189 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.016252 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.084657 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.084657 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.084657 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.084657 + + unit6 x1 x2 x3 x4 x5 x6 * #0.45858 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 45"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #2.0 * + hminus * + #2.0 * + hminus, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.121189 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.06473 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.084657 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.084657 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.084657 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.084657 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.741383 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 45"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * #1.26,x1,(&2 * #1.26 + &2 * #1.3254) / &2; &2,x2,&2 * hminus; + &2, + x3, + &2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.121189 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.06473 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.016252 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.022099 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.016252 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.084657 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.084657 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.084657 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.084657 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.084657 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.084657 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.084657 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.084657 + + unit6 x1 x2 x3 x4 x5 x6 * #0.741383 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.45858 + + unit6 x1 x2 x3 x4 x5 x6 * #0.911046 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.45858 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 44"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.177145 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.041584 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.103308 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.103308 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.103308 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.103308 + + unit6 x1 x2 x3 x4 x5 x6 * #0.677721 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 44"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.177145 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.00995 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.103308 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.103308 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.103308 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.103308 + + unit6 x1 x2 x3 x4 x5 x6 * -- #1.057518 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 44"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.177145 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.041584 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.103308 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.103308 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.103308 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.103308 + + unit6 x1 x2 x3 x4 x5 x6 * #0.677721 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 44"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #2.0 * + hminus * + #2.0 * + hminus, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.177145 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.151334 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.103308 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.103308 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.103308 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.103308 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.774954 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 44"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(&2 * #1.26 + &2 * #1.3254) / &2, + x1, + ((&2 * #1.26 + &2 * #1.3254) / &2 + + ((&2 * #1.26 + &2 * #1.3254) / &2 + &2 * #1.3254) / &2) / + &2; &2,x2,&2 * hminus; &2,x3,&2 * hminus; &2,x4,&2 * hminus; &2, + x5, + &2 * + hminus; + &1, + x6, + &1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.177145 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.151334 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.041584 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.00995 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.041584 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.103308 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.103308 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.103308 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.103308 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.103308 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.103308 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.103308 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.103308 + + unit6 x1 x2 x3 x4 x5 x6 * #0.774954 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.677721 + + unit6 x1 x2 x3 x4 x5 x6 * #1.057518 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.677721 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 43"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.036939 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.016688 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.057593 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.057593 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.057593 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.057593 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.559062 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 43"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.036939 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.016688 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.057593 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.057593 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.057593 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.057593 + + unit6 x1 x2 x3 x4 x5 x6 * #0.362427 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 43"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.036939 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.016688 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.057593 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.057593 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.057593 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.057593 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.559062 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 43"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #2.0 * + hminus * + #2.0 * + hminus, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.036939 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.050064 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.057593 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.057593 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.057593 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.057593 + + unit6 x1 x2 x3 x4 x5 x6 * #0.523604 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 43"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [((&2 * #1.26 + &2 * #1.3254) / &2 + + ((&2 * #1.26 + &2 * #1.3254) / &2 + &2 * #1.3254) / &2) / + &2, + x1, + ((&2 * #1.26 + &2 * #1.3254) / &2 + &2 * #1.3254) / &2; &2, + x2, + &2 * hminus; + &2, + x3, + &2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.036939 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.050064 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.016688 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.016688 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.016688 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.057593 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.057593 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.057593 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.057593 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.057593 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.057593 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.057593 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.057593 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.523604 + + unit6 x1 x2 x3 x4 x5 x6 * #0.559062 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.362427 + + unit6 x1 x2 x3 x4 x5 x6 * #0.559062 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 42"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.014413 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * #0.377571 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 42"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.014413 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.594377 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 42"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0, + x4, + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.02241 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * #0.36344 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 42"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #2.0 * + hminus * + #2.0 * + hminus, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.051237 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.44131200000000004 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 42"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(&2 * #1.26 + &2 * #1.3254) / &2, + x1, + ((&2 * #1.26 + &2 * #1.3254) / &2 + &2 * #1.3254) / &2; &2, + x2, + &2 * hminus; + &2, + x3, + &2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.0469 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.051237 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.02241 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.014413 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.014413 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.060747 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.060747 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.060747 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.060747 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.060747 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.060747 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.060747 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * #0.44131200000000004 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.36344 + + unit6 x1 x2 x3 x4 x5 x6 * #0.594377 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.377571 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 41"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.014413 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.073427 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.073427 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.073427 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.073427 + + unit6 x1 x2 x3 x4 x5 x6 * #0.479016 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 41"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0, + x4, + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.02241 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.073427 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.073427 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.073427 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.073427 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.709954 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 41"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.014413 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.073427 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.073427 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.073427 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.073427 + + unit6 x1 x2 x3 x4 x5 x6 * #0.479016 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 41"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #2.0 * + hminus * + #2.0 * + hminus, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.051237 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.073427 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.073427 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.073427 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.073427 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.542756 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 41"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(&2 * #1.26 + &2 * #1.3254) / &2, + x1, + ((&2 * #1.26 + &2 * #1.3254) / &2 + &2 * #1.3254) / &2; &2, + x2, + &2 * hminus; + &2, + x3, + &2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.0469 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.051237 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.014413 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.02241 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.014413 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.073427 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.073427 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.073427 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.073427 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.073427 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.073427 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.073427 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.073427 + + unit6 x1 x2 x3 x4 x5 x6 * #0.542756 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.479016 + + unit6 x1 x2 x3 x4 x5 x6 * #0.709954 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.479016 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 40"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0, + x4, + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.02241 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.608509 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 40"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.014413 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * #0.377571 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 40"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.014413 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.594377 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 40"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #2.0 * + hminus * + #2.0 * + hminus, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.051237 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * #0.530637 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 40"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(&2 * #1.26 + &2 * #1.3254) / &2, + x1, + ((&2 * #1.26 + &2 * #1.3254) / &2 + &2 * #1.3254) / &2; &2, + x2, + &2 * hminus; + &2, + x3, + &2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.0469 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.051237 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.014413 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.014413 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.02241 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.060747 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.060747 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.060747 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.060747 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.060747 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.060747 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.060747 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.530637 + + unit6 x1 x2 x3 x4 x5 x6 * #0.594377 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.377571 + + unit6 x1 x2 x3 x4 x5 x6 * #0.608509 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 39"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.061714 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.059882 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.02407 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.02407 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.02407 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.02407 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.261947 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 39"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.061714 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.059882 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.02407 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.02407 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.02407 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.02407 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.261947 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 39"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.061714 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.134266 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.02407 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.02407 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.02407 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.02407 + + unit6 x1 x2 x3 x4 x5 x6 * #0.631477 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 39"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.061714 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.014502 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.02407 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.02407 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.02407 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.02407 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.104941 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 39"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [((&2 * #1.26 + &2 * #1.3254) / &2 + &2 * #1.3254) / &2, + x1, + &2 * #1.3254; &2,x2,&2 * hminus; &2,x3,&2 * hminus; &2,x4,&2 * hminus; + &2, + x5, + &2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * #0.061714 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.014502 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.134266 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.059882 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.059882 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.02407 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.02407 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.02407 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.02407 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.02407 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.02407 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.02407 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.02407 + + unit6 x1 x2 x3 x4 x5 x6 * #0.104941 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.631477 + + unit6 x1 x2 x3 x4 x5 x6 * #0.261947 + + unit6 x1 x2 x3 x4 x5 x6 * #0.261947 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 38"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.062681 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.06441 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.023742 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.023742 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.023742 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.023742 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.273568 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 38"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.062681 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.176245 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + unit6 x1 x2 x3 x4 x5 x6 * #0.72849 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 38"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * + ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.062681 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.084906 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.023742 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.023742 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.023742 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.023742 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.3039 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 38"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.062681 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.026929 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + unit6 x1 x2 x3 x4 x5 x6 * #0.242815 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 38"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(&2 * #1.26 + &2 * #1.3254) / &2,x1,&2 * #1.3254; &2,x2,&2 * hminus; + &2, + x3, + &2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * #0.062681 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.026929 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.084906 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.176245 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.06441 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.023742 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.023742 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.023742 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.023742 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.023742 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.023742 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.023742 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.023742 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.242815 + + unit6 x1 x2 x3 x4 x5 x6 * #0.3039 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.72849 + + unit6 x1 x2 x3 x4 x5 x6 * #0.273568 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 37"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.062681 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.06441 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.023742 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.023742 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.023742 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.023742 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.273568 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 37"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * + ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.062681 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.084906 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + unit6 x1 x2 x3 x4 x5 x6 * #0.075969 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 37"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * + ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.062681 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.176245 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.023742 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.023742 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.023742 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.023742 + + unit6 x1 x2 x3 x4 x5 x6 * #0.348621 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 37"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.062681 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.026929 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + unit6 x1 x2 x3 x4 x5 x6 * #0.242815 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 37"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(&2 * #1.26 + &2 * #1.3254) / &2,x1,&2 * #1.3254; &2,x2,&2 * hminus; + &2, + x3, + &2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * #0.062681 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.026929 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.176245 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.084906 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.06441 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.023742 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.023742 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.023742 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.023742 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.023742 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.023742 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.023742 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.023742 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.242815 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.348621 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.075969 + + unit6 x1 x2 x3 x4 x5 x6 * #0.273568 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 36"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * + ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.062681 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.084906 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.023742 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.023742 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.023742 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.023742 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.3039 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 36"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * + ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.062681 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.176245 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + unit6 x1 x2 x3 x4 x5 x6 * #0.72849 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 36"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * + ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.062681 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.06441 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.023742 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.023742 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.023742 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.023742 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.273568 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 36"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.062681 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.026929 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.023742 + + unit6 x1 x2 x3 x4 x5 x6 * #0.242815 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 36"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(&2 * #1.26 + &2 * #1.3254) / &2,x1,&2 * #1.3254; &2,x2,&2 * hminus; + &2, + x3, + &2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * #0.062681 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.026929 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.06441 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.176245 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.084906 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.023742 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.023742 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.023742 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.023742 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.023742 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.023742 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.023742 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.023742 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.242815 + + unit6 x1 x2 x3 x4 x5 x6 * #0.273568 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.72849 + + unit6 x1 x2 x3 x4 x5 x6 * #0.3039 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 35"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.073933 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.02292 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.02292 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.02292 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.02292 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.286871 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 35"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.23854 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + unit6 x1 x2 x3 x4 x5 x6 * #0.867278 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 35"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.11227 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.02292 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.02292 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.02292 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.02292 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.346743 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 35"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.052337 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + unit6 x1 x2 x3 x4 x5 x6 * #0.175391 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 35"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * #1.26,x1,&2 * #1.3254; &2,x2,&2 * hminus; &2,x3,&2 * hminus; + &2, + x4, + &2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * #0.065103 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.052337 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.11227 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.23854 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.073933 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.02292 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.02292 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.02292 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.02292 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.02292 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.02292 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.02292 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.02292 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.175391 + + unit6 x1 x2 x3 x4 x5 x6 * #0.346743 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.867278 + + unit6 x1 x2 x3 x4 x5 x6 * #0.286871 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 34"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.073933 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.02292 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.02292 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.02292 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.02292 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.286871 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 34"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.11227 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + unit6 x1 x2 x3 x4 x5 x6 * #0.019974 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 34"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.23854 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.02292 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.02292 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.02292 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.02292 + + unit6 x1 x2 x3 x4 x5 x6 * #0.500562 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 34"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.052337 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + unit6 x1 x2 x3 x4 x5 x6 * #0.17539 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 34"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * #1.26,x1,&2 * #1.3254; &2,x2,&2 * hminus; &2,x3,&2 * hminus; + &2, + x4, + &2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * #0.065103 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.052337 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.23854 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.11227 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.073933 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.02292 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.02292 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.02292 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.02292 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.02292 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.02292 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.02292 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.02292 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.17539 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.500562 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.019974 + + unit6 x1 x2 x3 x4 x5 x6 * #0.286871 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 33"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.11227 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + unit6 x1 x2 x3 x4 x5 x6 * #0.019974 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 33"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.073933 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.02292 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.02292 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.02292 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.02292 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.286871 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 33"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.23854 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.02292 + + unit6 x1 x2 x3 x4 x5 x6 * #0.867278 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 33"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.052337 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.02292 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.02292 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.02292 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.02292 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.191326 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 33"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * #1.26,x1,&2 * #1.3254; &2,x2,&2 * hminus; &2,x3,&2 * hminus; + &2, + x4, + &2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * #0.065103 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.052337 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.23854 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.073933 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.11227 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.02292 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.02292 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.02292 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.02292 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.02292 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.02292 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.02292 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.02292 + + unit6 x1 x2 x3 x4 x5 x6 * #0.191326 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.867278 + + unit6 x1 x2 x3 x4 x5 x6 * #0.286871 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.019974 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 32"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.084789 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.013282 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.071708 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.071708 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.071708 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.071708 + + unit6 x1 x2 x3 x4 x5 x6 * #0.415701 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 32"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.084789 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.013282 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.071708 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.071708 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.071708 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.071708 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.731624 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 32"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.084789 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.013282 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.071708 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.071708 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.071708 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.071708 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.731624 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 32"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + ( #2.0 * + #1.26 + + #2.0 * + #1.3254) / + #2.0 * + ( #2.0 * + #1.26 + + #2.0 * + #1.3254) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.084789 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.039845 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.071708 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.071708 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.071708 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.071708 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.632521 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 32"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * #1.26,x1,(&2 * #1.26 + &2 * #1.3254) / &2; &2,x2,&2 * hminus; + &2, + x3, + &2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.084789 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.039845 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.013282 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.013282 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.013282 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.071708 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.071708 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.071708 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.071708 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.071708 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.071708 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.071708 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.071708 + + unit6 x1 x2 x3 x4 x5 x6 * #0.632521 + + unit6 x1 x2 x3 x4 x5 x6 * #0.731624 + + unit6 x1 x2 x3 x4 x5 x6 * #0.731624 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.415701 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 31"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0 * + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.172166 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.014169 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.099785 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.099785 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.099785 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.099785 + + unit6 x1 x2 x3 x4 x5 x6 * #0.586728 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 31"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0 * + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.172166 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.017353 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.099785 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.099785 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.099785 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.099785 + + unit6 x1 x2 x3 x4 x5 x6 * -- #1.0903 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 31"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0 * + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.172166 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.014169 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.099785 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.099785 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.099785 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.099785 + + unit6 x1 x2 x3 x4 x5 x6 * #0.586728 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 31"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x4, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.172166 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.09973 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.099785 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.099785 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.099785 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.099785 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.882284 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 31"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * #1.26,x1,(&2 * #1.26 + (&2 * #1.26 + &2 * #1.3254) / &2) / &2; + &2, + x2, + &2 * hminus; &2,x3,&2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; + &1, + x6, + &1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.172166 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.09973 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.014169 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.017353 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.014169 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.099785 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.099785 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.099785 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.099785 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.099785 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.099785 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.099785 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.099785 + + unit6 x1 x2 x3 x4 x5 x6 * #0.882284 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.586728 + + unit6 x1 x2 x3 x4 x5 x6 * #1.0903 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.586728 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 30"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0) / + #2.0 * + ( #2.0 * #1.26 + + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.17025 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.021455 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.098535 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.098535 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.098535 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.098535 + + unit6 x1 x2 x3 x4 x5 x6 * -- #1.087114 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 30"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0) / + #2.0 * + ( #2.0 * #1.26 + + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.17025 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.009749 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.098535 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.098535 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.098535 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.098535 + + unit6 x1 x2 x3 x4 x5 x6 * #0.568591 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 30"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0) / + #2.0 * + ( #2.0 * #1.26 + + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.17025 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.021455 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.098535 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.098535 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.098535 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.098535 + + unit6 x1 x2 x3 x4 x5 x6 * -- #1.087114 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 30"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0) / + #2.0 * + ( #2.0 * #1.26 + + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; (( #2.0 * + #1.26 + + #2.0 * + #1.3254) / + #2.0 + + #2.0 * + #1.3254) / + #2.0 * + (( #2.0 * + #1.26 + + #2.0 * + #1.3254) / + #2.0 + + #2.0 * + #1.3254) / + #2.0, + x4, + #2.0 * + #1.3254 * + #2.0 * + #1.3254; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.17025 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.094709 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.098535 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.098535 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.098535 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.098535 + + unit6 x1 x2 x3 x4 x5 x6 * #0.692034 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 30"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * #1.26, + x1, + (&2 * #1.26 + (&2 * #1.26 + (&2 * #1.26 + &2 * #1.3254) / &2) / &2) / + &2; &2,x2,&2 * hminus; &2,x3,&2 * hminus; &2,x4,&2 * hminus; &2, + x5, + &2 * + hminus; + &1, + x6, + &1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.17025 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.094709 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.021455 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.009749 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.021455 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.098535 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.098535 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.098535 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.098535 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.098535 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.098535 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.098535 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.098535 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.692034 + + unit6 x1 x2 x3 x4 x5 x6 * #1.087114 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.568591 + + unit6 x1 x2 x3 x4 x5 x6 * #1.087114 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 29"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0) / + #2.0 * + ( #2.0 * #1.26 + + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0) / + #2.0, + x1, + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0 * + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.090009 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.013837 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.073665 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.073665 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.073665 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.073665 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.755879 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 29"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0) / + #2.0 * + ( #2.0 * #1.26 + + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0) / + #2.0, + x1, + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0 * + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.090009 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.013837 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.073665 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.073665 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.073665 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.073665 + + unit6 x1 x2 x3 x4 x5 x6 * #0.422755 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 29"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0) / + #2.0 * + ( #2.0 * #1.26 + + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0) / + #2.0, + x1, + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0 * + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.090009 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.013837 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.073665 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.073665 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.073665 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.073665 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.755879 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 29"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0) / + #2.0 * + ( #2.0 * #1.26 + + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0) / + #2.0, + x1, + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / #2.0, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.090009 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.04151 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.073665 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.073665 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.073665 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.073665 + + unit6 x1 x2 x3 x4 x5 x6 * #0.523458 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 29"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(&2 * #1.26 + (&2 * #1.26 + (&2 * #1.26 + &2 * #1.3254) / &2) / &2) / + &2, + x1, + (&2 * #1.26 + (&2 * #1.26 + &2 * #1.3254) / &2) / &2; &2, + x2, + &2 * hminus; + &2, + x3, + &2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.090009 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.04151 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.013837 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.013837 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.013837 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.073665 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.073665 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.073665 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.073665 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.073665 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.073665 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.073665 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.073665 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.523458 + + unit6 x1 x2 x3 x4 x5 x6 * #0.755879 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.422755 + + unit6 x1 x2 x3 x4 x5 x6 * #0.755879 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 28"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0 * + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.074623 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.035942 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.068595 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.068595 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.068595 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.068595 + + unit6 x1 x2 x3 x4 x5 x6 * #0.528217 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 28"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0 * + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.074623 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.023711 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.068595 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.068595 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.068595 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.068595 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.719631 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 28"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0 * + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0, + x4, + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0 * + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0; #4.0, + x5, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.074623 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.031932 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.068595 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.068595 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.068595 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.068595 + + unit6 x1 x2 x3 x4 x5 x6 * #0.361784 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 28"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.074623 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.019702 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.068595 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.068595 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.068595 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.068595 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.639237 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 28"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * #1.26,x1,(&2 * #1.26 + (&2 * #1.26 + &2 * #1.3254) / &2) / &2; + &2, + x2, + &2 * hminus; &2,x3,&2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; + &1, + x6, + &1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.074623 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.019702 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.031932 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.023711 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.035942 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.068595 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.068595 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.068595 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.068595 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.068595 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.068595 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.068595 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.068595 + + unit6 x1 x2 x3 x4 x5 x6 * #0.639237 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.361784 + + unit6 x1 x2 x3 x4 x5 x6 * #0.719631 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.528217 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 27"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0 * + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.074623 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.035942 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.081204 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.081204 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.081204 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.081204 + + unit6 x1 x2 x3 x4 x5 x6 * #0.629086 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 27"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0 * + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0, + x4, + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0 * + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0; #4.0, + x5, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.074623 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.031932 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.081204 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.081204 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.081204 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.081204 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.836608 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 27"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0 * + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0; #4.0, + x5, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.074623 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.023711 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.081204 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.081204 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.081204 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.081204 + + unit6 x1 x2 x3 x4 x5 x6 * #0.47876 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 27"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.074623 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.019702 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.081204 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.081204 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.081204 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.081204 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.740105 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 27"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * #1.26,x1,(&2 * #1.26 + (&2 * #1.26 + &2 * #1.3254) / &2) / &2; + &2, + x2, + &2 * hminus; &2,x3,&2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; + &1, + x6, + &1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.074623 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.019702 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.023711 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.031932 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.035942 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.081204 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.081204 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.081204 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.081204 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.081204 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.081204 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.081204 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.081204 + + unit6 x1 x2 x3 x4 x5 x6 * #0.740105 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.47876 + + unit6 x1 x2 x3 x4 x5 x6 * #0.836608 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.629086 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 26"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0 * + ( #2.0 + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0) / #2.0, + x4, + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0 * + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0; #4.0, + x5, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.074623 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.031932 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.068595 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.068595 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.068595 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.068595 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.735738 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 26"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0 * + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0; #4.0, + x5, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.074623 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.023711 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.068595 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.068595 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.068595 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.068595 + + unit6 x1 x2 x3 x4 x5 x6 * #0.37789 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 26"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0 * + ( #2.0 + ( #2.0 + #2.0 * hminus) / #2.0) / #2.0; #4.0, + x5, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.074623 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.023711 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.068595 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.068595 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.068595 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.068595 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.719631 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 26"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.074623 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.079355 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.068595 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.068595 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.068595 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.068595 + + unit6 x1 x2 x3 x4 x5 x6 * #0.608613 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 26"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * #1.26,x1,(&2 * #1.26 + (&2 * #1.26 + &2 * #1.3254) / &2) / &2; + &2, + x2, + &2 * hminus; &2,x3,&2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; + &1, + x6, + &1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.074623 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.079355 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.023711 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.023711 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.031932 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.068595 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.068595 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.068595 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.068595 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.068595 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.068595 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.068595 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.068595 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.608613 + + unit6 x1 x2 x3 x4 x5 x6 * #0.719631 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.37789 + + unit6 x1 x2 x3 x4 x5 x6 * #0.735738 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 25"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.070081 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.014342 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.06775 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.06775 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.06775 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.06775 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.681778 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 25"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.070081 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.014342 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.06775 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.06775 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.06775 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.06775 + + unit6 x1 x2 x3 x4 x5 x6 * #0.402228 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 25"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.070081 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.014342 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.06775 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.06775 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.06775 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.06775 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.681778 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 25"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0 * + ( #2.0 * #1.26 + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0) / #2.0, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; ( #2.0 * + #1.26 + + #2.0 * + #1.3254) / + #2.0 * + ( #2.0 * + #1.26 + + #2.0 * + #1.3254) / + #2.0, + x4, + #2.0 * + #1.3254 * + #2.0 * + #1.3254; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.070081 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.043025 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.06775 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.06775 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.06775 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.06775 + + unit6 x1 x2 x3 x4 x5 x6 * #0.520998 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 25"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(&2 * #1.26 + (&2 * #1.26 + &2 * #1.3254) / &2) / &2, + x1, + (&2 * #1.26 + &2 * #1.3254) / &2; &2,x2,&2 * hminus; &2, + x3, + &2 * hminus; + &2, + x4, + &2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.070081 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.043025 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.014342 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.014342 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.014342 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.06775 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.06775 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.06775 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.06775 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.06775 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.06775 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.06775 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.06775 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.520998 + + unit6 x1 x2 x3 x4 x5 x6 * #0.681778 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.402228 + + unit6 x1 x2 x3 x4 x5 x6 * #0.681778 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 24"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.066935 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.021495 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + unit6 x1 x2 x3 x4 x5 x6 * #0.374549 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 24"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.066935 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.021495 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.066241 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.066241 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.066241 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.066241 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.685308 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 24"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0, + x4, + ( #2.0 + + #2.0 * + hminus) / + #2.0 * + ( #2.0 + + #2.0 * + hminus) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.066935 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.014102 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + unit6 x1 x2 x3 x4 x5 x6 * #0.472584 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 24"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #2.0 * + #1.3254 * + #2.0 * + #1.3254; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.066935 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.028887 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.066241 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.066241 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.066241 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.066241 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.582391 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 24"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * #1.26,x1,(&2 * #1.26 + &2 * #1.3254) / &2; &2,x2,&2 * hminus; + &2, + x3, + &2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.066935 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.028887 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.014102 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.021495 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.021495 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.066241 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.066241 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.066241 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.066241 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.066241 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.066241 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.066241 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.066241 + + unit6 x1 x2 x3 x4 x5 x6 * #0.582391 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.472584 + + unit6 x1 x2 x3 x4 x5 x6 * #0.685308 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.374549 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 23"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.066935 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.021495 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.066241 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.066241 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.066241 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.066241 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.685308 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 23"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0, + x4, + ( #2.0 + + #2.0 * + hminus) / + #2.0 * + ( #2.0 + + #2.0 * + hminus) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.066935 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.014102 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + unit6 x1 x2 x3 x4 x5 x6 * #0.472584 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 23"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + #2.0 * + hminus) / + #2.0 * + ( #2.0 + + #2.0 * + hminus) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.066935 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.021495 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.066241 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.066241 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.066241 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.066241 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.685308 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 23"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #2.0 * + #1.3254 * + #2.0 * + #1.3254; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.066935 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.028887 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + unit6 x1 x2 x3 x4 x5 x6 * #0.477466 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 23"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * #1.26,x1,(&2 * #1.26 + &2 * #1.3254) / &2; &2,x2,&2 * hminus; + &2, + x3, + &2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.066935 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.028887 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.021495 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.014102 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.021495 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.066241 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.066241 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.066241 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.066241 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.066241 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.066241 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.066241 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.066241 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.477466 + + unit6 x1 x2 x3 x4 x5 x6 * #0.685308 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.472584 + + unit6 x1 x2 x3 x4 x5 x6 * #0.685308 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 22"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0, + x4, + ( #2.0 + + #2.0 * + hminus) / + #2.0 * + ( #2.0 + + #2.0 * + hminus) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.066935 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.036704 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.066241 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.066241 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.066241 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.066241 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.715304 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 22"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + #2.0 * + hminus) / + #2.0 * + ( #2.0 + + #2.0 * + hminus) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.066935 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.021495 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + unit6 x1 x2 x3 x4 x5 x6 * #0.374549 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 22"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + #2.0 * + hminus) / + #2.0 * + ( #2.0 + + #2.0 * + hminus) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.066935 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.021495 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.066241 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.066241 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.066241 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.066241 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.685308 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 22"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26, + x1, + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #2.0 * + #1.3254 * + #2.0 * + #1.3254; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.066935 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.079693 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.066241 + + unit6 x1 x2 x3 x4 x5 x6 * #0.605497 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 22"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * #1.26,x1,(&2 * #1.26 + &2 * #1.3254) / &2; &2,x2,&2 * hminus; + &2, + x3, + &2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.066935 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.079693 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.021495 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.021495 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.036704 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.066241 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.066241 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.066241 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.066241 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.066241 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.066241 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.066241 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.066241 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.605497 + + unit6 x1 x2 x3 x4 x5 x6 * #0.685308 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.374549 + + unit6 x1 x2 x3 x4 x5 x6 * #0.715304 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 21"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.053582 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.013853 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.062897 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.062897 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.062897 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.062897 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.618101 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 21"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.053582 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.020791 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.06302 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.06302 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.06302 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.06302 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.637132 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 21"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.053582 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.013853 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.06302 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.06302 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.06302 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.06302 + + unit6 x1 x2 x3 x4 x5 x6 * #0.389234 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 21"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + ( #2.0 * + #1.26 + + ( #2.0 * + #1.26 + + #2.0 * + #1.3254) / + #2.0) / + #2.0 * + ( #2.0 * + #1.26 + + ( #2.0 * + #1.26 + + #2.0 * + #1.3254) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.053582 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.049452 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.06302 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.06302 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.06302 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.06302 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.475514 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 21"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(&2 * #1.26 + &2 * #1.3254) / &2, + x1, + ((&2 * #1.26 + &2 * #1.3254) / &2 + + ((&2 * #1.26 + &2 * #1.3254) / &2 + &2 * #1.3254) / &2) / + &2; &2,x2,&2 * hminus; &2,x3,&2 * hminus; &2,x4,&2 * hminus; &2, + x5, + &2 * + hminus; + &1, + x6, + &1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.053582 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.049452 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.013853 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.020791 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.013853 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.06302 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.06302 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.06302 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.06302 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.06302 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.062897 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.062897 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.06302 + + unit6 x1 x2 x3 x4 x5 x6 * #0.475514 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.389234 + + unit6 x1 x2 x3 x4 x5 x6 * #0.637132 + + unit6 x1 x2 x3 x4 x5 x6 * #0.618101 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 20"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.049823 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.015684 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.061687 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.061687 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.061687 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.061687 + + unit6 x1 x2 x3 x4 x5 x6 * #0.379191 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 20"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.049823 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.015684 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.061687 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.061687 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.061687 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.061687 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.607807 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 20"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.049823 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.015684 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.061687 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.061687 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.061687 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.061687 + + unit6 x1 x2 x3 x4 x5 x6 * #0.379191 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 20"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; ( #2.0 * + #1.26 + + ( #2.0 * + #1.26 + + #2.0 * + #1.3254) / + #2.0) / + #2.0 * + ( #2.0 * + #1.26 + + ( #2.0 * + #1.26 + + #2.0 * + #1.3254) / + #2.0) / + #2.0, + x4, + ( #2.0 * + #1.26 + + #2.0 * + #1.3254) / + #2.0 * + ( #2.0 * + #1.26 + + #2.0 * + #1.3254) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.049823 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.047052 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.061687 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.061687 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.061687 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.061687 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.463622 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 20"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(&2 * #1.26 + &2 * #1.3254) / &2, + x1, + ((&2 * #1.26 + &2 * #1.3254) / &2 + + ((&2 * #1.26 + &2 * #1.3254) / &2 + &2 * #1.3254) / &2) / + &2; &2,x2,&2 * hminus; &2,x3,&2 * hminus; &2,x4,&2 * hminus; &2, + x5, + &2 * + hminus; + &1, + x6, + &1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.049823 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.047052 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.015684 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.015684 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.015684 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.061687 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.061687 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.061687 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.061687 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.061687 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.061687 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.061687 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.061687 + + unit6 x1 x2 x3 x4 x5 x6 * #0.463622 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.379191 + + unit6 x1 x2 x3 x4 x5 x6 * #0.607807 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.379191 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 19"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.036939 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.016688 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.057593 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.057593 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.057593 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.057593 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.559062 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 19"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.036939 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.016688 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.057593 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.057593 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.057593 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.057593 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.559062 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 19"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.036939 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.016688 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.057593 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.057593 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.057593 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.057593 + + unit6 x1 x2 x3 x4 x5 x6 * #0.362427 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 19"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0) / + #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + ( #2.0 * + #1.26 + + #2.0 * + #1.3254) / + #2.0 * + ( #2.0 * + #1.26 + + #2.0 * + #1.3254) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.036939 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.050064 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.057593 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.057593 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.057593 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.057593 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.397884 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 19"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [((&2 * #1.26 + &2 * #1.3254) / &2 + + ((&2 * #1.26 + &2 * #1.3254) / &2 + &2 * #1.3254) / &2) / + &2, + x1, + ((&2 * #1.26 + &2 * #1.3254) / &2 + &2 * #1.3254) / &2; &2, + x2, + &2 * hminus; + &2, + x3, + &2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.036939 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.050064 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.016688 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.016688 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.016688 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.057593 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.057593 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.057593 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.057593 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.057593 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.057593 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.057593 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.057593 + + unit6 x1 x2 x3 x4 x5 x6 * #0.397884 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.362427 + + unit6 x1 x2 x3 x4 x5 x6 * #0.559062 + + unit6 x1 x2 x3 x4 x5 x6 * #0.559062 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 18"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.014413 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.594377 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 18"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.014413 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * #0.377571 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 18"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0, + x4, + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.02241 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.608509 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 18"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + ( #2.0 * + #1.26 + + #2.0 * + #1.3254) / + #2.0 * + ( #2.0 * + #1.26 + + #2.0 * + #1.3254) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.051237 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * #0.530637 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 18"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(&2 * #1.26 + &2 * #1.3254) / &2, + x1, + ((&2 * #1.26 + &2 * #1.3254) / &2 + &2 * #1.3254) / &2; &2, + x2, + &2 * hminus; + &2, + x3, + &2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.0469 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.051237 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.02241 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.014413 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.014413 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.060747 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.060747 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.060747 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.060747 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.060747 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.060747 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.060747 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.530637 + + unit6 x1 x2 x3 x4 x5 x6 * #0.608509 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.377571 + + unit6 x1 x2 x3 x4 x5 x6 * #0.594377 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 17"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.014413 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.594377 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 17"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0, + x4, + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.02241 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * #0.36344 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 17"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.014413 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.594377 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 17"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + ( #2.0 * + #1.26 + + #2.0 * + #1.3254) / + #2.0 * + ( #2.0 * + #1.26 + + #2.0 * + #1.3254) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.051237 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * #0.530636 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 17"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(&2 * #1.26 + &2 * #1.3254) / &2, + x1, + ((&2 * #1.26 + &2 * #1.3254) / &2 + &2 * #1.3254) / &2; &2, + x2, + &2 * hminus; + &2, + x3, + &2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.0469 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.051237 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.014413 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.02241 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.014413 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.060747 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.060747 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.060747 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.060747 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.060747 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.060747 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.060747 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.530636 + + unit6 x1 x2 x3 x4 x5 x6 * #0.594377 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.36344 + + unit6 x1 x2 x3 x4 x5 x6 * #0.594377 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 16"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0) / + #2.0, + x4, + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.02241 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.608509 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 16"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.014413 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * #0.377571 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 16"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + + #2.0 * + hminus) / + #2.0) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.014413 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.060747 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.594377 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 16"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0; #4.0,x2, #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + ( #2.0 * + #1.26 + + #2.0 * + #1.3254) / + #2.0 * + ( #2.0 * + #1.26 + + #2.0 * + #1.3254) / + #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.0469 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.051237 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * #0.530637 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 16"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(&2 * #1.26 + &2 * #1.3254) / &2, + x1, + ((&2 * #1.26 + &2 * #1.3254) / &2 + &2 * #1.3254) / &2; &2, + x2, + &2 * hminus; + &2, + x3, + &2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.0469 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.051237 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.014413 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.014413 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.02241 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.060747 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.060747 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.060747 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.060747 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.060747 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.060747 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.060747 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.060747 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.530637 + + unit6 x1 x2 x3 x4 x5 x6 * #0.594377 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.377571 + + unit6 x1 x2 x3 x4 x5 x6 * #0.608509 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 15"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.126777 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.049865 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.003525 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.003525 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.003525 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.003525 + + unit6 x1 x2 x3 x4 x5 x6 * #0.022307 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 15"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.126777 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.093532 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.003525 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.003525 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.003525 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.003525 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.035622 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 15"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.126777 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.196466 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.003525 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.003525 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.003525 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.003525 + + unit6 x1 x2 x3 x4 x5 x6 * #0.667227 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 15"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0 * + (( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 + #2.0 * #1.3254) / + #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x4, + ( #2.0 * #1.26 + #2.0 * #1.3254) / + #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / + #2.0; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.126777 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.053069 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.003525 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.003525 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.003525 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.003525 + + unit6 x1 x2 x3 x4 x5 x6 * #0.142652 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 15"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [((&2 * #1.26 + &2 * #1.3254) / &2 + &2 * #1.3254) / &2, + x1, + &2 * #1.3254; &2,x2,&2 * hminus; &2,x3,&2 * hminus; &2,x4,&2 * hminus; + &2, + x5, + &2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * #0.126777 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.053069 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.196466 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.093532 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.049865 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.003525 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.003525 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.003525 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.003525 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.003525 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.003525 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.003525 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.003525 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.142652 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.667227 + + unit6 x1 x2 x3 x4 x5 x6 * #0.035622 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.022307 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 14"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.127166 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.069548 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.003788 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.003788 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.003788 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.003788 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.032155 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 14"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.127166 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.096981 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.003788 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.003788 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.003788 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.003788 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.04248 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 14"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.127166 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.23984 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.003788 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.003788 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.003788 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.003788 + + unit6 x1 x2 x3 x4 x5 x6 * #0.767737 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 14"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; ( #2.0 * #1.26 + #2.0 * #1.3254) / + #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / + #2.0, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.127166 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.07331 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.003788 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.003788 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.003788 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.003788 + + unit6 x1 x2 x3 x4 x5 x6 * #0.105909 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 14"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(&2 * #1.26 + &2 * #1.3254) / &2,x1,&2 * #1.3254; &2,x2,&2 * hminus; + &2, + x3, + &2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * #0.127166 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.07331 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.23984 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.096981 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.069548 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.003788 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.003788 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.003788 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.003788 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.003788 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.003788 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.003788 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.003788 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.105909 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.767737 + + unit6 x1 x2 x3 x4 x5 x6 * #0.04248 + + unit6 x1 x2 x3 x4 x5 x6 * #0.032155 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 13"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.128506 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.070878 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.003287 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.003287 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.003287 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.003287 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.033394 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 13"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.128506 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.097658 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.050047 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 13"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * + ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.128506 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.234791 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.003287 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.003287 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.003287 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.003287 + + unit6 x1 x2 x3 x4 x5 x6 * #0.786309 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 13"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.128506 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.066254 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + unit6 x1 x2 x3 x4 x5 x6 * #0.104563 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 13"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(&2 * #1.26 + &2 * #1.3254) / &2,x1,&2 * #1.3254; &2,x2,&2 * hminus; + &2, + x3, + &2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * #0.128506 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.066254 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.234791 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.097658 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.070878 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.003287 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.003287 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.003287 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.003287 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.003287 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.003287 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.003287 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.003287 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.104563 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.786309 + + unit6 x1 x2 x3 x4 x5 x6 * #0.050047 + + unit6 x1 x2 x3 x4 x5 x6 * #0.033394 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 12"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.128506 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.070878 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.003287 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.003287 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.003287 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.003287 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.033394 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 12"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * + ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.128506 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.121835 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.083125 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 12"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * + ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.128506 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.070878 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.003287 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.003287 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.003287 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.003287 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.033394 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 12"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.128506 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.263591 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + unit6 x1 x2 x3 x4 x5 x6 * #0.957343 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 12"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(&2 * #1.26 + &2 * #1.3254) / &2,x1,&2 * #1.3254; &2,x2,&2 * hminus; + &2, + x3, + &2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * #0.128506 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.263591 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.070878 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.121835 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.070878 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.003287 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.003287 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.003287 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.003287 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.003287 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.003287 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.003287 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.003287 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.957343 + + unit6 x1 x2 x3 x4 x5 x6 * #0.033394 + + unit6 x1 x2 x3 x4 x5 x6 * #0.083125 + + unit6 x1 x2 x3 x4 x5 x6 * #0.033394 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 11"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0 * + ( #2.0 + + ( #2.0 + #2.0 * hminus) / #2.0) / + #2.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * + ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.128506 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.121835 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.003287 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.003287 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.003287 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.003287 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.13571 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 11"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * + ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.128506 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.097658 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.050047 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 11"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * + ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.128506 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.070878 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.003287 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.003287 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.003287 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.003287 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.033394 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 11"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0 * + ( #2.0 * #1.26 + #2.0 * #1.3254) / #2.0, + x1, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.128506 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.290371 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.003287 + + unit6 x1 x2 x3 x4 x5 x6 * #1.026581 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 11"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [(&2 * #1.26 + &2 * #1.3254) / &2,x1,&2 * #1.3254; &2,x2,&2 * hminus; + &2, + x3, + &2 * hminus; &2,x4,&2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * #0.128506 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.290371 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.070878 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.097658 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.121835 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.003287 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.003287 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.003287 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.003287 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.003287 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.003287 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.003287 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.003287 + + unit6 x1 x2 x3 x4 x5 x6 * -- #1.026581 + + unit6 x1 x2 x3 x4 x5 x6 * #0.033394 + + unit6 x1 x2 x3 x4 x5 x6 * #0.050047 + + unit6 x1 x2 x3 x4 x5 x6 * #0.13571 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 10"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129913 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.094917 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.084866 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 10"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129913 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.105208 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.072849 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 10"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129913 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.291645 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * #0.939234 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 10"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129913 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.09152 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * #0.034749 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 10"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * #1.26,x1,&2 * #1.3254; &2,x2,&2 * hminus; &2,x3,&2 * hminus; + &2, + x4, + &2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * #0.129913 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.09152 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.291645 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.105208 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.094917 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.002372 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002372 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002372 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.002372 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.002372 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002372 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002372 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.034749 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.939234 + + unit6 x1 x2 x3 x4 x5 x6 * #0.072849 + + unit6 x1 x2 x3 x4 x5 x6 * #0.084866 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 9"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129913 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.094917 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.084866 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 9"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129913 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.150931 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.138108 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 9"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129913 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.094917 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.084866 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 9"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129913 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.340765 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * #1.124108 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 9"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * #1.26,x1,&2 * #1.3254; &2,x2,&2 * hminus; &2,x3,&2 * hminus; + &2, + x4, + &2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * #0.129913 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.340765 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.094917 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.150931 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.094917 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.002372 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002372 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002372 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.002372 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.002372 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002372 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002372 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * -- #1.124108 + + unit6 x1 x2 x3 x4 x5 x6 * #0.084866 + + unit6 x1 x2 x3 x4 x5 x6 * #0.138108 + + unit6 x1 x2 x3 x4 x5 x6 * #0.084866 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 8"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129913 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.150931 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.176057 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 8"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129913 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.105208 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.072849 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 8"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129913 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.347659 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * #1.030425 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 8"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129913 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.09152 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * #0.034749 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 8"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * #1.26,x1,&2 * #1.3254; &2,x2,&2 * hminus; &2,x3,&2 * hminus; + &2, + x4, + &2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * #0.129913 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.09152 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.347659 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.105208 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.150931 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.002372 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002372 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002372 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.002372 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.002372 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002372 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002372 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.034749 + + unit6 x1 x2 x3 x4 x5 x6 * -- #1.030425 + + unit6 x1 x2 x3 x4 x5 x6 * #0.072849 + + unit6 x1 x2 x3 x4 x5 x6 * #0.176057 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 7"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.114872 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.08743 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.080919 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.080919 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.080919 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.080919 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.595546 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 7"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.114872 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.148605 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.080919 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.080919 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.080919 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.080919 + + unit6 x1 x2 x3 x4 x5 x6 * #0.853324 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 7"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.114872 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.08743 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.080919 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.080919 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.080919 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.080919 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.595546 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 7"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.114872 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.116669 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.080919 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.080919 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.080919 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.080919 + + unit6 x1 x2 x3 x4 x5 x6 * #0.7251449999999999 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 7"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * hminus,x1,&2 * #1.26; &2,x2,&2 * hminus; &2,x3,&2 * hminus; + &2, + x4, + &2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.114872 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.116669 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.08743 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.148605 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.08743 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.080919 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.080919 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.080919 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.080919 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.080919 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.080919 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.080919 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.080919 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.7251449999999999 + + unit6 x1 x2 x3 x4 x5 x6 * #0.595546 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.853324 + + unit6 x1 x2 x3 x4 x5 x6 * #0.595546 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 6"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.037947 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.025458 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.025458 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.025458 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.025458 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.025236 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 6"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.072591 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.025458 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.025458 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.025458 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.025458 + + unit6 x1 x2 x3 x4 x5 x6 * #0.469389 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 6"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.055356 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.025458 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.025458 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.025458 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.025458 + + unit6 x1 x2 x3 x4 x5 x6 * #0.055371 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 6"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.008732 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.025458 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.025458 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.025458 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.025458 + + unit6 x1 x2 x3 x4 x5 x6 * #0.30558 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 6"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * hminus,x1,&2 * #1.26; &2,x2,&2 * hminus; &2,x3,&2 * hminus; + &2, + x4, + &2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * #0.065103 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.008732 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.055356 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.072591 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.037947 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.025458 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.025458 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.025458 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.025458 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.025458 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.025458 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.025458 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.025458 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.30558 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.055371 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.469389 + + unit6 x1 x2 x3 x4 x5 x6 * #0.025236 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 5"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.072591 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.027449 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.027449 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.027449 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.027449 + + unit6 x1 x2 x3 x4 x5 x6 * #0.485323 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 5"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.055356 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.027449 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.027449 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.027449 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.027449 + + unit6 x1 x2 x3 x4 x5 x6 * #0.039438 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 5"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.072591 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.027449 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.027449 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.027449 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.027449 + + unit6 x1 x2 x3 x4 x5 x6 * #0.485323 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 5"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.029778 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.027449 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.027449 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.027449 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.027449 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.170713 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 5"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * hminus,x1,&2 * #1.26; &2,x2,&2 * hminus; &2,x3,&2 * hminus; + &2, + x4, + &2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * #0.065103 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.029778 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.072591 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.055356 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.072591 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.027449 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.027449 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.027449 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.027449 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.027449 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.027449 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.027449 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.027449 + + unit6 x1 x2 x3 x4 x5 x6 * #0.170713 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.485323 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.039438 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.485323 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 4"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.055356 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.024884 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.024884 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.024884 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.024884 + + unit6 x1 x2 x3 x4 x5 x6 * #0.458108 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 4"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.042651 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.024884 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.024884 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.024884 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.024884 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.008797 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 4"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.072591 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.024884 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.024884 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.024884 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.024884 + + unit6 x1 x2 x3 x4 x5 x6 * #0.464803 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 4"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.065103 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.008732 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.024884 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.024884 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.024884 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.024884 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.097156 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 4"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * hminus,x1,&2 * #1.26; &2,x2,&2 * hminus; &2,x3,&2 * hminus; + &2, + x4, + &2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * #0.065103 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.008732 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.072591 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.042651 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.055356 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.024884 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.024884 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.024884 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.024884 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.024884 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.024884 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.024884 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.024884 + + unit6 x1 x2 x3 x4 x5 x6 * #0.097156 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.464803 + + unit6 x1 x2 x3 x4 x5 x6 * #0.008797 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.458108 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 3"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.114872 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.148605 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.080919 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.080919 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.080919 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.080919 + + unit6 x1 x2 x3 x4 x5 x6 * #0.855148 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 3"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.114872 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.08743 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.080919 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.080919 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.080919 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.080919 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.593722 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 3"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.114872 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.148605 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.080919 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.080919 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.080919 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.080919 + + unit6 x1 x2 x3 x4 x5 x6 * #0.855148 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 3"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * #0.114872 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.133539 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.080919 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.080919 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.080919 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.080919 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.532524 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 3"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * hminus,x1,&2 * #1.26; &2,x2,&2 * hminus; &2,x3,&2 * hminus; + &2, + x4, + &2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * -- #0.114872 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.133539 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.148605 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.08743 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.148605 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.080919 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.080919 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.080919 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.080919 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.080919 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.080919 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.080919 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.080919 + + unit6 x1 x2 x3 x4 x5 x6 * #0.532524 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.855148 + + unit6 x1 x2 x3 x4 x5 x6 * #0.593722 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.855148 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 2"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129913 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.01764 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * #0.198777 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 2"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129913 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.045166 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * #0.306092 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 2"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129913 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.021777 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * #0.259166 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 2"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129913 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.060416 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * #0.113134 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 2"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * hminus,x1,&2 * #1.26; &2,x2,&2 * hminus; &2,x3,&2 * hminus; + &2, + x4, + &2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * #0.129913 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.060416 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.021777 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.045166 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.01764 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.002372 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002372 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002372 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.002372 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.002372 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002372 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002372 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.113134 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.259166 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.306092 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.198777 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 1"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129699 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.019214 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.002264 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.002264 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.002264 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.002264 + + unit6 x1 x2 x3 x4 x5 x6 * #0.203309 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 1"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129699 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.021887 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.002264 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.002264 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.002264 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.002264 + + unit6 x1 x2 x3 x4 x5 x6 * #0.29619 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 1"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129699 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.019214 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.002264 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.002264 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.002264 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.002264 + + unit6 x1 x2 x3 x4 x5 x6 * #0.203309 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 1"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129699 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.060316 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.002264 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.002264 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.002264 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.002264 + + unit6 x1 x2 x3 x4 x5 x6 * #0.112116 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 1"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * hminus,x1,&2 * #1.26; &2,x2,&2 * hminus; &2,x3,&2 * hminus; + &2, + x4, + &2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * #0.129699 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.060316 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.019214 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.021887 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.019214 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.002264 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002264 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002264 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.002264 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.002264 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002264 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002264 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.002264 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.112116 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.203309 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.29619 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.203309 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 4 0"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + ( #2.0 + #2.0 * hminus) / #2.0 * ( #2.0 + #2.0 * hminus) / #2.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129913 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.021777 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * #0.259166 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 3 0"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129913 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.045166 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * #0.306092 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 2 0"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129913 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * -- #0.01764 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * #0.002372 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * #0.198777 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 1 0"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.129913 + + sqrt_x1 x1 x2 x3 x4 x5 x6 * #0.060416 + + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * #0.113134 < + &0)`; +};; + + +add_inequality { + idv= "OXLZLEZ 6346351218 0 0"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&2 * hminus,x1,&2 * #1.26; &2,x2,&2 * hminus; &2,x3,&2 * hminus; + &2, + x4, + &2 * hminus; &2,x5,&2 * hminus; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &2 * pi * #0.129913 + + proj_x1 x1 x2 x3 x4 x5 x6 * -- #0.060416 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.01764 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.045166 + + proj_x1 x1 x2 x3 x4 x5 x6 * #0.021777 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * #0.002372 + + proj_x2 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002372 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002372 + + proj_x3 x1 x2 x3 x4 x5 x6 * &2 * #0.002372 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * #0.002372 + + proj_x4 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002372 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * -- #0.002372 + + proj_x5 x1 x2 x3 x4 x5 x6 * &2 * #0.002372 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.113134 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.198777 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.306092 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.259166 < + &0)`; +};; + + +add_inequality { + idv= "GRKIBMP B V2"; + doc=""; + tags= [Sharp;Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.3254 * #2.0 * #1.3254,x1, #8.0; &1 * &1,x2,&1 * &1; + &1 * &1, + x3, + &1 * &1; &1 * &1,x4,&1 * &1; &1 * &1,x5,&1 * &1; &1 * &1,x6,&1 * &1] + (gamma2_x1_div_a_v2 (&0) x1 x2 x3 x4 x5 x6 * -- &1 <= &0)`; +};; + + +add_inequality { + idv= "GRKIBMP A V2 split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #2.0 * #1.26 * #2.0 * #1.26; &1 * &1,x2,&1 * &1; &1 * &1, + x3, + &1 * &1; + &1 * &1, + x4, + &1 * &1; &1 * &1,x5,&1 * &1; &1 * &1,x6,&1 * &1] + (unit6 x1 x2 x3 x4 x5 x6 * #0.008 + + gamma2_x1_div_a_v2 (&1) x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "GRKIBMP A V2 split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + &1 * &1, + x2, + &1 * &1; &1 * &1,x3,&1 * &1; &1 * &1,x4,&1 * &1; &1 * &1,x5,&1 * &1; + &1 * &1, + x6, + &1 * &1] + (unit6 x1 x2 x3 x4 x5 x6 * #0.008 + + gamma2_x1_div_a_v2 (&0) x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "JSPEVYT"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&1 * &1,x1,&1 * &1; &1 * &1,x2,&1 * &1; &1 * &1,x3,&1 * &1; #2.0 * + hminus * + #2.0 * + hminus, + x4, + #8.0; + #2.0 * hminus * #2.0 * hminus, + x5, + #8.0; #4.0,x6, #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_456 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "CJFZZDW"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&1 * &1,x1,&1 * &1; &1 * &1,x2,&1 * &1; &1 * &1,x3,&1 * &1; #2.0 * + #1.3254 * + #2.0 * + #1.3254, + x4, + #8.0; + #2.0 * #1.3254 * #2.0 * #1.3254, + x5, + #8.0; #4.0,x6, #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #2.0 + eta2_456 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "CIHTIUM"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&1 * &1,x1,&1 * &1; &1 * &1,x2,&1 * &1; &1 * &1,x3,&1 * &1; #2.0 * + hminus * + #2.0 * + hminus, + x4, + #8.0; + #2.0 * hminus * #2.0 * hminus, + x5, + #8.0; #2.0 * hminus * #2.0 * hminus,x6, #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #2.0 + eta2_456 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "QZECFIC wt2 A split(0/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0,x1, #2.0; #2.0,x2, #2.0; #2.0,x3, #2.0; #2.0 * + hminus * + #2.0 * + hminus, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; #2.0 * + hminus * + #2.0 * + hminus, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (dih4_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 * #0.008 + + gamma3f_x_div_sqrtdelta (&1) (&1) (&1) x1 x2 x3 x4 x5 x6 * + --(&1 / #2.0) < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + eta2_456 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "QZECFIC wt2 A split(1/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0,x1, #2.0; #2.0,x2, #2.0; #2.0,x3, #2.0; #2.0 * + hminus * + #2.0 * + hminus, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (dih4_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 * #0.008 + + gamma3f_x_div_sqrtdelta (&1) (&0) (&1) x1 x2 x3 x4 x5 x6 * + --(&1 / #2.0) < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + eta2_456 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "QZECFIC wt2 A split(2/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0,x1, #2.0; #2.0,x2, #2.0; #2.0,x3, #2.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #8.0; #2.0 * + hminus * + #2.0 * + hminus, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (dih4_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 * #0.008 + + gamma3f_x_div_sqrtdelta (&0) (&1) (&1) x1 x2 x3 x4 x5 x6 * + --(&1 / #2.0) < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + eta2_456 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "QZECFIC wt2 A split(3/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0,x1, #2.0; #2.0,x2, #2.0; #2.0,x3, #2.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (dih4_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 * #0.008 + + gamma3f_x_div_sqrtdelta (&0) (&0) (&1) x1 x2 x3 x4 x5 x6 * + --(&1 / #2.0) < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + eta2_456 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "QZECFIC wt1 split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0,x1, #2.0; #2.0,x2, #2.0; #2.0,x3, #2.0; #2.0 * + hminus * + #2.0 * + hminus, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x5, + #2.0 * + hminus * + #2.0 * + hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (dih4_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 * #0.008 + + gamma3f_x_div_sqrtdelta (&1) (&1) (&1) x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + eta2_456 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "QZECFIC wt1 split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0,x1, #2.0; #2.0,x2, #2.0; #2.0,x3, #2.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #2.0 * + #1.3254 * + #2.0 * + #1.3254; #4.0, + x5, + #2.0 * + hminus * + #2.0 * + hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (dih4_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 * #0.008 + + gamma3f_x_div_sqrtdelta (&0) (&1) (&1) x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + eta2_456 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "QZECFIC wt0 sqrt8"; + doc=""; + tags= [Widthcutoff 0.0002;Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&1 * &1,x1,&1 * &1; &1 * &1,x2,&1 * &1; &1 * &1,x3,&1 * &1; #2.0 * + #1.3254 * + #2.0 * + #1.3254, + x4, + #8.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (gamma3f_x_div_sqrtdelta (&0) (&1) (&1) x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + eta2_456 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "QZECFIC wt0 corner"; + doc=""; + tags= [Branching;Sharp]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&1 * &1,x1,&1 * &1; &1 * &1,x2,&1 * &1; &1 * &1,x3,&1 * &1; #4.0, + x4, + #2.01 * + #2.01; + #4.0, + x5, + #2.01 * #2.01; #4.0,x6, #2.01 * #2.01] + (gamma3f_x_div_sqrtdelta (&1) (&1) (&1) x1 x2 x3 x4 x5 x6 * -- &1 <= &0)`; +};; + + +add_inequality { + idv= "QZECFIC wt0"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&1 * &1,x1,&1 * &1; &1 * &1,x2,&1 * &1; &1 * &1,x3,&1 * &1; #2.01 * + #2.01, + x4, + #2.0 * + hminus * + #2.0 * + hminus; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (gamma3f_x_div_sqrtdelta (&1) (&1) (&1) x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GCKBQEA"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #8.0; #4.0,x3, #8.0; #4.0,x4, #8.0; #4.0,x5, #8.0; #4.0,x6, #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.606 + dih_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "RQWUDDU split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #8.0; #4.0,x3, #8.0; #4.0,x4, #8.0; #4.0,x5, #8.0; #4.0,x6, #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.76 + dih_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + eta2_126 x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + eta2_135 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "RQWUDDU split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #8.0; #4.0,x3, #8.0; #4.0,x4, #8.0; #4.0,x5, #8.0; #4.0,x6, #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.76 + dih_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + eta2_126 x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + eta2_135 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "QITNPEA 4003532128 a"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #8.0; #2.0,x3, #2.0; #2.0,x4, #2.0; #2.0,x5, #2.0; #4.0,x6, #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * &25 + delta_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #0.14 + delta_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + delta_x x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "IXPOTPA split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #8.0, + x4, + &4 * hminus * &4 * hminus; #4.0,x5, #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (delta_x x1 x2 x3 x4 x5 x6 < &0 \/ + delta_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + x1_delta_x x1 x2 x3 x4 x5 x6 * &4 + + delta4_squared_x x1 x2 x3 x4 x5 x6 * -- #3.07 < + &0 \/ + delta4_squared_x x1 x2 x3 x4 x5 x6 * #6.45 + + x1_delta_x x1 x2 x3 x4 x5 x6 * -- &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_126 x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_135 x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &3 * #0.0057 + + gamma23_full8_x (&1) x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "IXPOTPA split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #8.0, + x4, + &4 * hminus * &4 * hminus; #4.0,x5, #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (delta_x x1 x2 x3 x4 x5 x6 < &0 \/ + delta_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + x1_delta_x x1 x2 x3 x4 x5 x6 * &4 + + delta4_squared_x x1 x2 x3 x4 x5 x6 * -- #3.07 < + &0 \/ + delta4_squared_x x1 x2 x3 x4 x5 x6 * #6.45 + + x1_delta_x x1 x2 x3 x4 x5 x6 * -- &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_126 x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_135 x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &3 * #0.0057 + + gamma23_full8_x (&0) x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "TXQTPVC split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * &3 * #0.0057 + + gamma23_full8_x (&1) x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + rad2_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #2.0 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.089 + dih_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + dih_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #1.946 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_126 x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_135 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "TXQTPVC split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * &3 * #0.0057 + + gamma23_full8_x (&0) x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + rad2_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #2.0 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.089 + dih_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + dih_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #1.946 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_126 x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_135 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "QITNPEA 3725403817"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.1 * #2.1; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (dih_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #1.56 < &0)`; +};; + + +add_inequality { + idv= "QITNPEAv2 4003532128 split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_126 x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_135 x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + rad2_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #2.0 < &0 \/ + sqrt_x2 x1 x2 x3 x4 x5 x6 + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x2 x1 x2 x3 x4 x5 x6 + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x2 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + gamma23_full8_x (&1) x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #0.00457511 + + dih_x x1 x2 x3 x4 x5 x6 * #0.00609451 < + &0)`; +};; + + +add_inequality { + idv= "QITNPEAv2 4003532128 split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_126 x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_135 x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + rad2_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #2.0 < &0 \/ + sqrt_x2 x1 x2 x3 x4 x5 x6 + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x2 x1 x2 x3 x4 x5 x6 + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x2 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + gamma23_full8_x (&0) x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * #0.00457511 + + dih_x x1 x2 x3 x4 x5 x6 * #0.00609451 < + &0)`; +};; + + +add_inequality { + idv= "PEMKWKU split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #8.0; #4.0,x3, #2.0 * hminus * #2.0 * hminus; #4.0,x4, #8.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0,x6, #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + gamma23_keep135_x (&1) x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + rad2_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #2.0 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.074 + dih_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + eta2_126 x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_135 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "PEMKWKU split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #8.0; #4.0,x3, #2.0 * hminus * #2.0 * hminus; #4.0,x4, #8.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0,x6, #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + gamma23_keep135_x (&0) x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + rad2_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #2.0 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.074 + dih_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + eta2_126 x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_135 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "TEWNSCJ split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + gamma23_full8_x (&1) x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + rad2_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #2.0 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_126 x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_135 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "TEWNSCJ split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + gamma23_full8_x (&0) x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + rad2_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #2.0 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_126 x1 x2 x3 x4 x5 x6 * -- &1 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_135 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "QITNPEA 5400790175 b split(0/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.005 + + vol3_x_sqrt x1 x2 x3 x4 x5 x6 * -- &1 + + vol3f_x_lfun x1 x2 x3 x4 x5 x6 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_126 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "QITNPEA 5400790175 b split(1/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.005 + + vol3_x_sqrt x1 x2 x3 x4 x5 x6 * -- &1 + + vol3f_x_lfun x1 x2 x3 x4 x5 x6 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_126 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "QITNPEA 5400790175 b split(2/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.005 + + vol3_x_sqrt x1 x2 x3 x4 x5 x6 * -- &1 + + vol3f_x_sqrt2_lmplus x1 x2 x3 x4 x5 x6 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_126 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "QITNPEA 5400790175 b split(3/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.005 + + vol3_x_sqrt x1 x2 x3 x4 x5 x6 * -- &1 + + vol3f_x_sqrt2_lmplus x1 x2 x3 x4 x5 x6 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_126 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "QITNPEA 5400790175 a split(0/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.005 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0)`; +};; + + +add_inequality { + idv= "QITNPEA 5400790175 a split(1/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.005 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0)`; +};; + + +add_inequality { + idv= "QITNPEA 5400790175 a split(2/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.005 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0)`; +};; + + +add_inequality { + idv= "QITNPEA 5400790175 a split(3/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.005 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0)`; +};; + + +add_inequality { + idv= "QITNPEA 3848804089 split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #0.161517 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.119482 < + &0)`; +};; + + +add_inequality { + idv= "QITNPEA 3848804089 split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #0.161517 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.119482 < + &0)`; +};; + + +add_inequality { + idv= "QITNPEA 5814748276 split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #0.00127562 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.00522841 < + &0)`; +};; + + +add_inequality { + idv= "QITNPEA 5814748276 split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #0.00127562 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.00522841 < + &0)`; +};; + + +add_inequality { + idv= "QITNPEA 6206775865 split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0142852 + + dih_x x1 x2 x3 x4 x5 x6 * #0.00609451 < + &0)`; +};; + + +add_inequality { + idv= "QITNPEA 6206775865 split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0142852 + + dih_x x1 x2 x3 x4 x5 x6 * #0.00609451 < + &0)`; +};; + + +add_inequality { + idv= "QITNPEA 5653753305 split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0659 + + dih_x x1 x2 x3 x4 x5 x6 * #0.042 < + &0)`; +};; + + +add_inequality { + idv= "QITNPEA 5653753305 split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * -- #0.0659 + + dih_x x1 x2 x3 x4 x5 x6 * #0.042 < + &0)`; +};; + + +add_inequality { + idv= "BIXPCGW 9455898160 split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * -- #0.00569 + + vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0)`; +};; + + +add_inequality { + idv= "BIXPCGW 9455898160 split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * -- #0.00569 + + vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0)`; +};; + + +add_inequality { + idv= "FWGKMBZ"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #8.0; #4.0,x3, #8.0; #4.0,x4, #8.0; #4.0,x5, #8.0; #4.0,x6, #8.0] + (delta_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "FHBVYXZ b split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + vol3_x_sqrt x1 x2 x3 x4 x5 x6 * -- &1 + + vol3f_x_lfun x1 x2 x3 x4 x5 x6 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_126 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "FHBVYXZ b split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + vol3_x_sqrt x1 x2 x3 x4 x5 x6 * -- &1 + + vol3f_x_sqrt2_lmplus x1 x2 x3 x4 x5 x6 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * #1.34 + + eta2_126 x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "FHBVYXZ a split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0)`; +};; + + +add_inequality { + idv= "FHBVYXZ a split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0)`; +};; + + +add_inequality { + idv= "FHBVYXZv2 a split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + eta2_135 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0)`; +};; + + +add_inequality { + idv= "FHBVYXZv2 a split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + eta2_135 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0)`; +};; + + +add_inequality { + idv= "QITNPEA 2134082733 split(0/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.005 + + unit6 x1 x2 x3 x4 x5 x6 * #0.213849 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.119482 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA 2134082733 split(1/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.005 + + unit6 x1 x2 x3 x4 x5 x6 * #0.213849 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.119482 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA 2134082733 split(2/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.005 + + unit6 x1 x2 x3 x4 x5 x6 * #0.213849 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.119482 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA 2134082733 split(3/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.005 + + unit6 x1 x2 x3 x4 x5 x6 * #0.213849 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.119482 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 2 2 9063653052 A split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.3254 * #2.0 * #1.3254, + x3, + #8.0; #2.0 * + #1.3254 * + #2.0 * + #1.3254, + x4, + #8.0; #4.0, + x5, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 2 2 9063653052 A split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.3254 * #2.0 * #1.3254, + x3, + #8.0; #2.0 * + #1.3254 * + #2.0 * + #1.3254, + x4, + #8.0; #4.0, + x5, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 2 1 9063653052 A split(0/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.3254 * #2.0 * #1.3254, + x3, + #8.0; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 2 1 9063653052 A split(1/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.3254 * #2.0 * #1.3254, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * + #1.3254 * + #2.0 * + #1.3254; #4.0, + x5, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 2 1 9063653052 A split(2/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.3254 * #2.0 * #1.3254, + x3, + #8.0; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 2 1 9063653052 A split(3/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.3254 * #2.0 * #1.3254, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * + #1.3254 * + #2.0 * + #1.3254; #4.0, + x5, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 2 0 9063653052 A split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.3254 * #2.0 * #1.3254, + x3, + #8.0; #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 2 0 9063653052 A split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.3254 * #2.0 * #1.3254, + x3, + #8.0; #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 1 2 9063653052 A split(0/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.3254 * #2.0 * #1.3254, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 1 2 9063653052 A split(1/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.3254 * #2.0 * #1.3254, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 1 2 9063653052 A split(2/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.3254 * #2.0 * #1.3254, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 1 2 9063653052 A split(3/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.3254 * #2.0 * #1.3254, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 1 1 9063653052 A split(0/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 1 1 9063653052 A split(1/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 1 1 9063653052 A split(2/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 1 1 9063653052 A split(3/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 1 1 9063653052 A split(4/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 1 1 9063653052 A split(5/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 1 1 9063653052 A split(6/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 1 1 9063653052 A split(7/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 1 0 9063653052 A split(0/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 1 0 9063653052 A split(1/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 1 0 9063653052 A split(2/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA1 1 0 9063653052 A split(3/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA 9939613598 split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.3254 * #2.0 * #1.3254, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #0.00457511 + + dih_x x1 x2 x3 x4 x5 x6 * #0.00609451 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "QITNPEA 9939613598 split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.3254 * #2.0 * #1.3254, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #0.00457511 + + dih_x x1 x2 x3 x4 x5 x6 * #0.00609451 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "BIXPCGW 7274157868 a split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.3254 * #2.0 * #1.3254, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + dih_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #2.3 < &0)`; +};; + + +add_inequality { + idv= "BIXPCGW 7274157868 a split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.3254 * #2.0 * #1.3254, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + dih_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #2.3 < &0)`; +};; + + +add_inequality { + idv= "BIXPCGW b"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #8.0; #4.0,x3, #8.0; #4.0,x4, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x5, + #8.0; #4.0,x6, #8.0] + (delta_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * &60 + delta_x x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + delta_x x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "BIXPCGW 1738910218 a2"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #8.0; #4.0,x3, #8.0; #4.0,x4, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x5, + #8.0; #4.0,x6, #8.0] + (dih_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #2.3 < &0)`; +};; + + +add_inequality { + idv= "BIXPCGW 7080972881 a2"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * hminus * #2.0 * hminus, + x2, + #8.0; #4.0,x3, #8.0; #4.0,x4, #8.0; #4.0,x5, #8.0; #4.0,x6, #8.0] + (dih_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #2.3 < &0)`; +};; + + +add_inequality { + idv= "BIXPCGW 6652007036 a2"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #8.0; #4.0,x3, #8.0; #4.0,x4, #8.0; #4.0,x5, #8.0; #4.0,x6, #8.0] + (dih_x x1 x2 x3 x4 x5 x6 + unit6 x1 x2 x3 x4 x5 x6 * -- #2.8 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 y4subcrit split(0/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 y4subcrit split(1/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #4.0,x3, #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x5, + #2.0 * + hminus * + #2.0 * + hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 y4subcrit split(2/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * hminus * #2.0 * hminus, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 y4subcrit split(3/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #4.0,x3, #2.0 * hminus * #2.0 * hminus; #4.0, + x4, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x5, + #2.0 * + hminus * + #2.0 * + hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 y4supercrit split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.3254 * #2.0 * #1.3254, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 y4supercrit split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.3254 * #2.0 * #1.3254, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 y4crit split(0/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 y4crit split(1/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 y4crit split(2/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 y4crit split(3/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 y4crit split(4/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * hminus * #2.0 * hminus, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 y4crit split(5/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * hminus * #2.0 * hminus, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 y4crit split(6/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 y4crit split(7/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0057 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + eta2_126 x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.34 * -- #1.34 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4a 8328676778 split(0/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4a 8328676778 split(1/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4a 8328676778 split(2/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4a 8328676778 split(3/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #2.0 * #1.3254 * #2.0 * #1.3254; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + halfbump_x1 x1 x2 x3 x4 x5 x6 * -- &1 + + halfbump_x4 x1 x2 x3 x4 x5 x6 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(0/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(1/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(2/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(3/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(4/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(5/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * #1.26 * #2.0 * #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(6/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x5, #8.0; #4.0, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(7/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x5, #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(8/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(9/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(10/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #4.0,x6, #2.0 * #1.26 * #2.0 * #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi4_x x1 x2 x3 x4 x5 x6 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(11/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x6, #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi4_x x1 x2 x3 x4 x5 x6 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(12/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(13/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(14/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; #4.0, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(15/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(16/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #4.0,x3, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(17/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #4.0,x3, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(18/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #4.0,x3, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; + #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(19/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #4.0,x3, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(20/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #4.0,x3, #2.0 * #1.26 * #2.0 * #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #8.0; #4.0, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(21/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #4.0,x3, #2.0 * #1.26 * #2.0 * #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #8.0; #4.0, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(22/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #4.0,x3, #2.0 * #1.26 * #2.0 * #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; #4.0, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(23/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #4.0,x3, #2.0 * #1.26 * #2.0 * #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(24/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x3, #8.0; #4.0, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(25/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x3, #8.0; #4.0, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(26/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x3, #8.0; #4.0, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; + #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi4_x x1 x2 x3 x4 x5 x6 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(27/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x3, #8.0; #4.0, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi4_x x1 x2 x3 x4 x5 x6 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(28/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x3, #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #8.0; #4.0, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(29/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x3, #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #8.0; #4.0, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(30/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x3, #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; #4.0, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(31/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x3, #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(32/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(33/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(34/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(35/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(36/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(37/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * #1.26 * #2.0 * #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(38/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x5, #8.0; #4.0, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(39/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x5, #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(40/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(41/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(42/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #4.0,x6, #2.0 * #1.26 * #2.0 * #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi4_x x1 x2 x3 x4 x5 x6 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(43/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x6, #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi4_x x1 x2 x3 x4 x5 x6 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(44/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(45/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(46/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; #4.0, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(47/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(48/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #4.0,x3, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(49/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #4.0,x3, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(50/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #4.0,x3, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; + #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(51/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #4.0,x3, #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(52/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #4.0,x3, #2.0 * #1.26 * #2.0 * #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #8.0; #4.0, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(53/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #4.0,x3, #2.0 * #1.26 * #2.0 * #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #8.0; #4.0, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(54/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #4.0,x3, #2.0 * #1.26 * #2.0 * #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; #4.0, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(55/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #4.0,x3, #2.0 * #1.26 * #2.0 * #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(56/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x3, #8.0; #4.0, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(57/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x3, #8.0; #4.0, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(58/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x3, #8.0; #4.0, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; + #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi4_x x1 x2 x3 x4 x5 x6 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(59/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x3, #8.0; #4.0, + x4, + #2.0 * + #1.26 * + #2.0 * + #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi4_x x1 x2 x3 x4 x5 x6 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(60/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x3, #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #8.0; #4.0, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #4.0, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(61/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x3, #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #8.0; #4.0, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(62/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x3, #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; #4.0, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "GLFVCVK4 2477216213 split(63/64)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.26 * #2.0 * #1.26, + x2, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x3, #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x4, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih2_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi < + &0 \/ + norm2hh_x x1 x2 x3 x4 x5 x6 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * -- #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * #1.3254 * hminus + + unit6 x1 x2 x3 x4 x5 x6 * hminus * #1.3254 + + unit6 x1 x2 x3 x4 x5 x6 * hminus * --hminus < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "MKFKQWU halfwt"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * #1.3254 * #2.0 * #1.3254, + x2, + #8.0; #4.0,x3, #8.0; #2.0 * hminus * #2.0 * hminus,x4, #8.0; + #4.0, + x5, + #8.0; #4.0,x6, #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "MKFKQWU"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #2.0 * hminus * #2.0 * hminus, + x2, + #8.0; #2.0 * hminus * #2.0 * hminus,x3, #8.0; #4.0,x4, #8.0; + #2.0 * hminus * #2.0 * hminus, + x5, + #8.0; #2.0 * hminus * #2.0 * hminus,x6, #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(0/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(1/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(2/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(3/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(4/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(5/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(6/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x5, #8.0; #2.0 * + hminus * + #2.0 * + hminus, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(7/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x5, #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(8/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(9/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(10/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(11/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x6, #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(12/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * + hminus * + #2.0 * + hminus, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; #2.0 * + hminus * + #2.0 * + hminus, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(13/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * + hminus * + #2.0 * + hminus, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(14/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; #2.0 * + hminus * + #2.0 * + hminus, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(15/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(16/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(17/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(18/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(19/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(20/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(21/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(22/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x5, #8.0; #2.0 * + hminus * + #2.0 * + hminus, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(23/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x5, #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(24/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(25/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(26/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(27/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x6, #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(28/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * + hminus * + #2.0 * + hminus, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; #2.0 * + hminus * + #2.0 * + hminus, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(29/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * + hminus * + #2.0 * + hminus, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(30/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; #2.0 * + hminus * + #2.0 * + hminus, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 1 1821661595 split(31/32)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &5) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &5) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &5 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &5 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 0 1821661595 split(0/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 0 1821661595 split(1/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 0 1821661595 split(2/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 0 1821661595 split(3/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x5, #8.0; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 0 1821661595 split(4/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 0 1821661595 split(5/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #4.0,x6, #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 0 1821661595 split(6/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * + hminus * + #2.0 * + hminus, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 0 1821661595 split(7/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 0 1821661595 split(8/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 0 1821661595 split(9/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 0 1821661595 split(10/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 0 1821661595 split(11/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x5, #8.0; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 0 1821661595 split(12/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 0 1821661595 split(13/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #4.0,x6, #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 0 1821661595 split(14/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * + hminus * + #2.0 * + hminus, + x5, + #2.0 * + #1.26 * + #2.0 * + #1.26; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 1 0 1821661595 split(15/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x5, + #8.0; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 1 1821661595 split(0/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 1 1821661595 split(1/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 1 1821661595 split(2/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #2.0 * + hminus * + #2.0 * + hminus, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 1 1821661595 split(3/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 1 1821661595 split(4/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 1 1821661595 split(5/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 1 1821661595 split(6/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0, + x5, + #2.0 * + hminus * + #2.0 * + hminus; #2.0 * + hminus * + #2.0 * + hminus, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 1 1821661595 split(7/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0, + x5, + #2.0 * + hminus * + #2.0 * + hminus; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 1 1821661595 split(8/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 1 1821661595 split(9/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 1 1821661595 split(10/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #2.0 * + hminus * + #2.0 * + hminus, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 1 1821661595 split(11/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 1 1821661595 split(12/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 1 1821661595 split(13/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 1 1821661595 split(14/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0, + x5, + #2.0 * + hminus * + #2.0 * + hminus; #2.0 * + hminus * + #2.0 * + hminus, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 1 1821661595 split(15/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0, + x5, + #2.0 * + hminus * + #2.0 * + hminus; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 0 1821661595 split(0/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 0 1821661595 split(1/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 0 1821661595 split(2/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 0 1821661595 split(3/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0, + x5, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 0 1821661595 split(4/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 0 1821661595 split(5/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 0 1821661595 split(6/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 1 0 0 1821661595 split(7/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0, + x5, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 1 1821661595 split(0/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 1 1821661595 split(1/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 1 1821661595 split(2/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 1 1821661595 split(3/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 1 1821661595 split(4/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 1 1821661595 split(5/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 1 1821661595 split(6/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 1 1821661595 split(7/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x6, #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 1 1821661595 split(8/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 1 1821661595 split(9/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 1 1821661595 split(10/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 1 1821661595 split(11/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 1 1821661595 split(12/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 1 1821661595 split(13/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 1 1821661595 split(14/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 1 1821661595 split(15/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x6, #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 0 1821661595 split(0/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 0 1821661595 split(1/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 0 1821661595 split(2/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 0 1821661595 split(3/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #4.0,x6, #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 0 1821661595 split(4/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 0 1821661595 split(5/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 0 1821661595 split(6/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 1 0 1821661595 split(7/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #4.0,x6, #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 0 1 1821661595 split(0/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 0 1 1821661595 split(1/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 0 1 1821661595 split(2/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 0 1 1821661595 split(3/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 0 1 1821661595 split(4/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 0 1 1821661595 split(5/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 0 1 1821661595 split(6/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 0 1 1821661595 split(7/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 0 0 1821661595 split(0/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 0 0 1821661595 split(1/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 0 0 1821661595 split(2/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x3, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 1 0 0 0 1821661595 split(3/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x3, + #8.0; #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih3_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 1 1821661595 split(0/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 1 1821661595 split(1/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 1 1821661595 split(2/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 1 1821661595 split(3/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 1 1821661595 split(4/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 1 1821661595 split(5/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 1 1821661595 split(6/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x5, #8.0; #2.0 * + hminus * + #2.0 * + hminus, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 1 1821661595 split(7/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x5, #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 1 1821661595 split(8/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 1 1821661595 split(9/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 1 1821661595 split(10/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 1 1821661595 split(11/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 1 1821661595 split(12/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 1 1821661595 split(13/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 1 1821661595 split(14/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x5, #8.0; #2.0 * + hminus * + #2.0 * + hminus, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 1 1821661595 split(15/16)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x5, #8.0; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &4) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &4) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &4 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &4 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 0 1821661595 split(0/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 0 1821661595 split(1/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 0 1821661595 split(2/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 0 1821661595 split(3/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x5, #8.0; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 0 1821661595 split(4/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 0 1821661595 split(5/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 0 1821661595 split(6/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 1 0 1821661595 split(7/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #2.0 * #1.26 * #2.0 * #1.26,x5, #8.0; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 0 1 1821661595 split(0/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 0 1 1821661595 split(1/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 0 1 1821661595 split(2/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #2.0 * + hminus * + #2.0 * + hminus, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 0 1 1821661595 split(3/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 0 1 1821661595 split(4/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 0 1 1821661595 split(5/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 0 1 1821661595 split(6/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #2.0 * + hminus * + #2.0 * + hminus, + x6, + #2.0 * + #1.26 * + #2.0 * + #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 0 1 1821661595 split(7/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #2.0 * + #1.26 * + #2.0 * + #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 0 0 1821661595 split(0/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.005 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 0 0 1821661595 split(1/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.005 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 0 0 1821661595 split(2/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x4, + #2.0 * #1.26 * #2.0 * #1.26; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.005 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 1 0 0 1821661595 split(3/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x4, + #8.0; #4.0,x5, #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * + hminus * + #2.0 * + hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + unit6 x1 x2 x3 x4 x5 x6 * #0.005 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 0 1 1 1821661595 split(0/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 0 1 1 1821661595 split(1/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 0 1 1 1821661595 split(2/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 0 1 1 1821661595 split(3/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 0 1 1 1821661595 split(4/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 0 1 1 1821661595 split(5/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 0 1 1 1821661595 split(6/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 0 1 1 1821661595 split(7/8)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / &3) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / &3) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / &3 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / &3 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 0 1 0 1821661595 split(0/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 0 1 0 1821661595 split(1/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 0 1 0 1821661595 split(2/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * hminus * #2.0 * hminus, + x5, + #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 0 1 0 1821661595 split(3/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #2.0 * #1.26 * #2.0 * #1.26, + x5, + #8.0; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih5_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 0 0 1 1821661595 split(0/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 0 0 1 1821661595 split(1/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + gchi1_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 0 0 1 1821661595 split(2/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #2.0 * hminus * #2.0 * hminus, + x6, + #2.0 * #1.26 * #2.0 * #1.26] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi6_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 0 0 1 1821661595 split(3/4)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #2.0 * #1.26 * #2.0 * #1.26, + x6, + #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * --(&1 / #2.0) + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + --(&1 / #2.0) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 + + gchi2_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi3_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi4_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + gchi5_x x1 x2 x3 x4 x5 x6 * &1 / #2.0 + + dih6_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi * + &1 / #2.0 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 0 0 0 1821661595 split(0/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * hminus * #2.0 * hminus,x1, #2.0 * #1.26 * #2.0 * #1.26; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF4 0 0 0 0 1821661595 split(1/2)"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.26 * #2.0 * #1.26,x1, #2.0 * #1.3254 * #2.0 * #1.3254; + #4.0, + x2, + #2.0 * hminus * #2.0 * hminus; #4.0, + x3, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (unit6 x1 x2 x3 x4 x5 x6 * #0.0560305 + + dih_x x1 x2 x3 x4 x5 x6 * -- #0.0445813 + + vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "ZTGIJCF0"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq [&1,x1,&1; &1,x2,&1; &1,x3,&1; &1,x4,&1; &1,x5,&1; &1,x6,&1] + (unit6 x1 x2 x3 x4 x5 x6 * &5 * -- #0.0560305 + + unit6 x1 x2 x3 x4 x5 x6 * #0.0445813 * &2 * pi < + &0)`; +};; + + +add_inequality { + idv= "TSKAJXY-GXSABWC DIV"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.8 * #2.8,x1,&8; &4,x2, #2.01 * #2.01; &4,x3, #2.01 * #2.01; + #2.8 * #2.8, + x4, + &8; &4,x5, #2.01 * #2.01; &4,x6, #2.01 * #2.01] + (unit6 x1 x2 x3 x4 x5 x6 * --(&1 / &12) + + sol_euler_x_div_sqrtdelta x1 x2 x3 x4 x5 x6 * + &2 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + sol_euler345_x_div_sqrtdelta x1 x2 x3 x4 x5 x6 * + &2 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + sol_euler156_x_div_sqrtdelta x1 x2 x3 x4 x5 x6 * + &2 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + sol_euler246_x_div_sqrtdelta x1 x2 x3 x4 x5 x6 * + &2 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + ldih2_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 * + #8 * + &6 * + pi * + const1 * + #0.5 * + sqrt8 * + &1 / (&6 * &4 * pi + &6 * &20 * pi * --const1) * + --(&1 / pi) + + ldih2_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 * + #8 * + pi * + #0.5 * + sqrt8 * + &1 / (&6 * &4 * pi + &6 * &20 * pi * --const1) * + &1 / pi + + ldih3_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 * + #8 * + &6 * + pi * + const1 * + #0.5 * + sqrt8 * + &1 / (&6 * &4 * pi + &6 * &20 * pi * --const1) * + --(&1 / pi) + + ldih3_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 * + #8 * + pi * + #0.5 * + sqrt8 * + &1 / (&6 * &4 * pi + &6 * &20 * pi * --const1) * + &1 / pi + + ldih5_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 * + #8 * + &6 * + pi * + const1 * + #0.5 * + sqrt8 * + &1 / (&6 * &4 * pi + &6 * &20 * pi * --const1) * + --(&1 / pi) + + ldih5_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 * + #8 * + pi * + #0.5 * + sqrt8 * + &1 / (&6 * &4 * pi + &6 * &20 * pi * --const1) * + &1 / pi + + ldih6_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 * + #8 * + &6 * + pi * + const1 * + #0.5 * + sqrt8 * + &1 / (&6 * &4 * pi + &6 * &20 * pi * --const1) * + --(&1 / pi) + + ldih6_x_div_sqrtdelta_posbranch x1 x2 x3 x4 x5 x6 * + #8 * + pi * + #0.5 * + sqrt8 * + &1 / (&6 * &4 * pi + &6 * &20 * pi * --const1) * + &1 / pi <= + &0 \/ + delta_x x1 x2 x3 x4 x5 x6 < &0)`; +};; + + +add_inequality { + idv= "TSKAJXY-delta_x4"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [&4,x1, #2.01 * #2.01; &4,x2, #2.01 * #2.01; #2.8 * #2.8,x3,&8; + &4, + x4, + #2.01 * #2.01; &4,x5, #2.01 * #2.01; #2.8 * #2.8,x6,&8] + (delta_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "TSKAJXY-eulerA"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.8 * #2.8,x1,&8; &4,x2, #2.01 * #2.01; &4,x3, #2.01 * #2.01; + #2.8 * #2.8, + x4, + &8; &4,x5, #2.01 * #2.01; &4,x6, #2.01 * #2.01] + (eulerA_x x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "TSKAJXY-XLLIPLS"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.3254 * #2.0 * #1.3254,x1, #8.0; #4.0,x2, #2.01 * #2.01; + #4.0, + x3, + #2.01 * #2.01; #2.0 * #1.3254 * #2.0 * #1.3254,x4, #2.8 * #2.8; + #4.0, + x5, + #2.01 * #2.01; #4.0,x6, #2.01 * #2.01] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0)`; +};; + + +add_inequality { + idv= "TSKAJXY-WKGUESB sym"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.3254 * #2.0 * #1.3254,x1, #8.0; #2.01 * #2.01, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #2.0 * + #1.3254 * + #2.0 * + #1.3254, + x4, + #8.0; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + dih4_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + sqrt_x2 x1 x2 x3 x4 x5 x6 + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x2 x1 x2 x3 x4 x5 x6 + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x2 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x1 x1 x2 x3 x4 x5 x6 + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "TSKAJXY-IYOUOBF sharp v2"; + doc=""; + tags= [Branching;Sharp]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.3254 * #2.0 * #1.3254,x1, #8.0; #4.0, + x2, + #2.001 * #2.001; + #4.0, + x3, + #2.001 * #2.001; #4.0,x4, #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.001 * + #2.001; + #4.0, + x6, + #2.001 * #2.001] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 <= + &0)`; +};; + + +add_inequality { + idv= "TSKAJXY-IYOUOBF sym"; + doc=""; + tags= [Branching;Sharp]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.3254 * #2.0 * #1.3254,x1, #8.0; #2.001 * #2.001, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x4, + #2.0 * + hminus * + #2.0 * + hminus; + #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + dih_x x1 x2 x3 x4 x5 x6 * + &4 * + pi * + const1 * + sqrt8 * + &1 / (&4 * pi + &20 * pi * --const1) * + &1 / pi + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 <= + &0 \/ + sqrt_x2 x1 x2 x3 x4 x5 x6 + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x2 x1 x2 x3 x4 x5 x6 + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x2 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "TSKAJXY-RIBCYXU sym"; + doc=""; + tags= [Branching]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.001 * #2.001,x1, #2.0 * hminus * #2.0 * hminus; #4.0, + x2, + #2.0 * + hminus * + #2.0 * + hminus; #4.0, + x3, + #2.0 * + hminus * + #2.0 * + hminus; + #4.0, + x4, + #2.0 * hminus * #2.0 * hminus; #4.0, + x5, + #2.0 * hminus * #2.0 * hminus; + #4.0, + x6, + #2.0 * hminus * #2.0 * hminus] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 < + &0 \/ + sqrt_x1 x1 x2 x3 x4 x5 x6 + sqrt_x2 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x1 x1 x2 x3 x4 x5 x6 + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x1 x1 x2 x3 x4 x5 x6 + sqrt_x4 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x1 x1 x2 x3 x4 x5 x6 + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x1 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x2 x1 x2 x3 x4 x5 x6 + sqrt_x3 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x2 x1 x2 x3 x4 x5 x6 + sqrt_x5 x1 x2 x3 x4 x5 x6 * -- &1 < &0 \/ + sqrt_x2 x1 x2 x3 x4 x5 x6 + sqrt_x6 x1 x2 x3 x4 x5 x6 * -- &1 < &0)`; +};; + + +add_inequality { + idv= "TSKAJXY-RIBCYXU sharp"; + doc=""; + tags= [Branching;Sharp]; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #4.0,x1, #2.001 * #2.001; #4.0,x2, #2.001 * #2.001; #4.0, + x3, + #2.001 * + #2.001; + #4.0, + x4, + #2.001 * #2.001; #4.0,x5, #2.001 * #2.001; #4.0, + x6, + #2.001 * #2.001] + (vol_x x1 x2 x3 x4 x5 x6 * -- &1 + + unit6 x1 x2 x3 x4 x5 x6 * + #8 * + pi * + const1 * + sqrt8 * + --(&1 / (&4 * pi + &20 * pi * --const1)) + + gchi1_x x1 x2 x3 x4 x5 x6 + + gchi2_x x1 x2 x3 x4 x5 x6 + + gchi3_x x1 x2 x3 x4 x5 x6 + + gchi4_x x1 x2 x3 x4 x5 x6 + + gchi5_x x1 x2 x3 x4 x5 x6 + + gchi6_x x1 x2 x3 x4 x5 x6 <= + &0)`; +};; + + +add_inequality { + idv= "TSKAJXY-TADIAMB"; + doc=""; + tags= []; + ineq= `!x1 x2 x3 x4 x5 x6. + ineq + [ #2.0 * #1.3254 * #2.0 * #1.3254,x1, #8.0; #2.0 * + #1.3254 * + #2.0 * + #1.3254, + x2, + #8.0; #4.0,x3, #8.0; + #4.0, + x4, + #8.0; #4.0,x5, #8.0; #4.0,x6, #8.0] + (unit6 x1 x2 x3 x4 x5 x6 * #2.0 + rad2_x x1 x2 x3 x4 x5 x6 * -- &1 < + &0)`; +};; + + + +end;; \ No newline at end of file diff --git a/text_formalization/nonlinear/scripts.hl b/text_formalization/nonlinear/scripts.hl new file mode 100644 index 0000000..14315af --- /dev/null +++ b/text_formalization/nonlinear/scripts.hl @@ -0,0 +1,547 @@ +(* ========================================================================== *) +(* FLYSPECK - CODE INFORMAL *) +(* *) +(* Chapter: Nonlinear *) +(* Author: Thomas C. Hales *) +(* Date: 2012-04-15 *) +(* ========================================================================== *) + + +(* Interactive scripts for the running of interval arithmetic code from + ineq.hl, + + Execution done in computational_build.hl +*) + +(* START NONLINEAR INEQS *) +(* reneeds "nonlinear/ineqdata3q1h.hl";; *) +(* reneeds "nonlinear/strongdodec_ineq.hl";; *) + +flyspeck_needs "leg/enclosed_def.hl";; +flyspeck_needs "general/sphere.hl";; +(* flyspeck_needs "nonlinear/ineq.hl";; *) +flyspeck_needs "nonlinear/main_estimate_ineq.hl";; +(* flyspeck_needs "nonlinear/strongdodec_ineq.hl";; *) + +flyspeck_needs "nonlinear/lemma.hl";; +flyspeck_needs "nonlinear/functional_equation.hl";; +flyspeck_needs "nonlinear/parse_ineq.hl";; +flyspeck_needs "nonlinear/optimize.hl";; +flyspeck_needs "general/flyspeck_lib.hl";; +flyspeck_needs "nonlinear/auto_lib.hl";; +(* flyspeck_needs "../projects_discrete_geom/bcc_lattice.hl";; *) + + +module Scripts = struct + +let idq_of_string s = hd(Ineq.getexact s);; + +let expand_string = map (fun t->t.idv) o Ineq.getprefix;; + +let isquad s = Optimize.is_quad_cluster (idq_of_string s).tags;; + +(* +let finished_splits = + let split_sp = Str.split(Str.regexp "\n") in + let p = process_to_string("grep split "^flyspeck_dir + ^"/../interval_code/qed_log.txt " + ^"| sed 's/^.*ineq./\"/' " + ^"| sed 's/., secs.*$/\";/' " + ^"| sed 's/ split.*$//g' " + ^"| sed 's/\"//g' " + ^" | sed 's/;//g' ") in + Parse_ineq.nub (split_sp p);; + + +let hassplit = + let a = filter (fun t -> List.length (get_split_tags t) > 0) !Ineq.ineqs in + let a' = filter (fun t -> mem t.id unfinished_cases) a in + map (fun t-> t.id) a';; +List.length hassplit;; + +*) + +(* lists of inequality ids *) + +let all_cases() = + Parse_ineq.nub (map (fun t -> t.idv) (!Ineq.ineqs));; + +let finished_cases() = + let split_sp= Str.split (Str.regexp "\n") in + let p = process_to_string ("cat "^flyspeck_dir + ^"/../interval_code/qed_log_2012.txt " + (* ^"| grep 'Aug 1[67].*2013' " *) + ^"| sed 's!^//.*$!!'" + ^"| sed 's/^.*ineq(/\"/' " + ^"| sed 's/., secs.*$/\";/' " + ^"| sed 's/ split(.*$//g' " + ^"| sed 's/\"//g' " + ^" | sed 's/;//g' ") in + Parse_ineq.nub (split_sp p);; + + +let unfinished_cases() = subtract (all_cases()) (finished_cases());; + +let dodec_cases = + let isdodec s = (mem Strongdodec (idq_of_string s).tags) in + filter isdodec (all_cases());; + + +(* *************************************************************************** *) +(* C++ interval verification *) +(* *************************************************************************** *) + +let disregard = + [ +"9563139965D"; (* derived lp, disregard it *) + ] ;; + +let special_concerns = [ +(* deprecated "2065952723 A1"; *) (* requires special code, FAILS ON THACKMAC. *) + ];; + +let nocompile = + [ +(* deprecated "2065952723 A1"; + "5556646409";"4322269127"; (* LC functions *) + "5512912661"; "6843920790"; "4828966562"; (* num1 *) *) +] @ disregard;; + +let testids = ref[];; + +(* +let view nth = idq_of_string (List.nth !testids nth);; +idq_fields(view 0);; +view 1;; +*) + +(* running one id *) + +(* +let testid = "FXZXPNS";; +Optimize.testsplit false testid;; +map (Optimize.testsplit true) !testids;; +*) + +(* map (Auto_lib.testsplit true) (!testids);; *) + +let execute_interval_cases cases bool = +(* let isquad s = Optimize.is_quad_cluster (idq_of_string s).tags in + let nonquad = filter (not o isquad) cases in *) + map (fun t -> try (Auto_lib.testsplit bool t) with Failure _ -> [()]) cases;; + +let execute_interval_allbutdodec bool = + execute_interval_cases (subtract (all_cases()) (union disregard dodec_cases)) bool;; + +let execute_interval_all bool = + execute_interval_cases (subtract (all_cases()) (disregard)) bool;; + +(* execute_interval_allbutdodec true;; *) +(* goal *) + +(* open Optimize;; *) + +let process_cases_testid testid = + let idq = idq_of_string testid in + let (s,tags,ineq) = Optimize.idq_fields idq in + let ls = Optimize.get_split_tags idq in + if (ls=[]) then (s,tags,ineq) else + let cases = Optimize.split_all_h0 [(ineq,ls)] in + (s^" case-",tags,List.nth cases 1);; + +let interactive_debug_stuff testid = + let (id,tags,case) = process_cases_testid testid in + let ife b t = e(if b then t else ALL_TAC) in + let is_xconvert = mem Xconvert tags in + let is_branch = mem Branching tags in + let _ = g (mk_imp (`NONLIN`,case)) in + let _ = e(Optimize.PRELIM_REWRITE_TAC) in + let _ = ife (is_branch) Optimize.BRANCH_TAC in + let _ = ife (is_xconvert) Optimize.X_OF_Y_TAC in + let _ = ife (is_branch && not(is_xconvert)) + (Optimize.SERIES3Q1H_5D_TAC) in + let _ = e (Optimize.STYLIZE_TAC) in + e (Optimize.WRAPUP_TAC);; + +(* *************************************************************************** *) +(* TESTING CFSQP *) +(* *************************************************************************** *) + + +let one_cfsqp = + Parse_ineq.execute_cfsqp o idq_of_string;; + +let cfsqp ts = + let us = map (idq_of_string) ts in + !(Parse_ineq.execute_cfsqp_list us);; + +let execute_cfsqp() = cfsqp (all_cases());; + +(* *************************************************************************** *) +(* Timing *) +(* *************************************************************************** *) + +let rec finalize = function (* use time from most recent verification *) + | [] -> [] + | (x,t)::vs -> if (exists (fun (x',_) -> (x'=x)) vs) then finalize vs + else (x,t)::(finalize vs);; + +let total r = + let rr = map snd r in + end_itlist (+) rr;; + +let hour r = float_of_int r /. (60.0 *. 60.0);; + +let finished_times,finished_rejects = + let split_sp = Str.split (Str.regexp "\n") in + let split_semi = Str.split (Str.regexp ";") in + let int_s [x;y] = try + (x,int_of_string y) + with Failure s -> failwith (s ^ " " ^ x ^ " " ^ y) + in + let p = process_to_string ("cat "^flyspeck_dir + ^"/../interval_code/qed_log_2012.txt " + (* ^"| grep 'Aug 1[67].*2013' " *) + ^"| sed 's!^//.*$!!'" + ^"| sed 's/^.*ineq(//' " + ^"| sed 's/., svn.*$//' " + ^" | sed 's/., *msecs.*$//' " + ^"| sed 's/., *cell.*$//' " + ^"| sed 's/., secs./;/' " + ) in + let (accept,rejects) = partition (fun t -> List.length t =2) + (map split_semi (split_sp p)) in + (map int_s accept,Parse_ineq.nub rejects);; + +let finished_times_msecs,finished_rejects_msecs = + let split_sp = Str.split (Str.regexp "\n") in + let split_semi = Str.split (Str.regexp ";") in + let int_s [x;y] = try + (x,int_of_string y) + with Failure s -> failwith (s ^ " " ^ x ^ " " ^ y) + in + let p = process_to_string ("grep msecs "^flyspeck_dir + ^"/../interval_code/qed_log_2012.txt " + ^"| sed 's!^//.*$!!'" + ^"| sed 's/^.*ineq(//' " + ^"| sed 's/., *cell.*$/;/' " + ^"| sed 's/., secs.[0-9]*//' " + ^"| sed 's/., *msecs./;/' " + ) in + let (accept,rejects) = partition (fun t -> List.length t =2) + (map split_semi (split_sp p)) in + (map int_s accept,Parse_ineq.nub rejects);; + + +let times = + let all = all_cases() in + let ft = finalize finished_times in + let split = Str.split(Str.regexp " +split") in + let fti = filter (fun (x,_) -> mem (hd (split x)) all) ft in + sort (fun (_,y) (_,y') -> (y>y')) fti;; + +let fast_cases = filter (fun (_,t) -> t<=5) times;; + +(* +hour (total times);; + + + +hour(total(filter (fun (t,_) -> + Str.string_match (Str.regexp "QITNPEA 4003") t 0) times));; + +hour (total (filter (fun (t,_) -> + Str.string_match (Str.regexp "ZTGIJCF23") t 0) times));; +*) + +(* *************************************************************************** *) +(* splits, test for missing cases, -- none found! may 27, 2011 *) +(* *************************************************************************** *) + +let case_splits ls = + let split = Str.split(Str.regexp " +split") in + let ss = map split ls in + let ss2 = filter (fun t-> List.length t = 2) ss in + let pair bs = (List.nth bs 0,List.nth bs 1) in + let nodigit = Str.split(Str.regexp "[^0-9]") in + let digitize s = map int_of_string (nodigit s) in + let f = function | b::bs -> (b,pair (unions (map digitize bs))) + | _ -> failwith "case_splits" in + map f ss2;; + +let rec unify_splits = function + | [] -> [] + | (s,(_,t)):: _ as ys -> let (st,xs') = partition (fun (s',(_,t')) -> (s'=s & t'=t)) ys in + (s,Parse_ineq.nub (map (fun (_,(r',_ )) -> r') st),t) ::unify_splits xs';; + +let case_splits_execute = + let vv = unify_splits (case_splits (map fst finished_times)) in + filter (fun (_,ls,r) -> not ((0--(r-1)) = sort (<) ls)) vv;; + + + +(* *************************************************************************** *) +(* inventory of which inequalities actually get used in the proof *) +(* *************************************************************************** *) + + let flyspeck_used_ineqs = + (* Merge_ineq.tsk_hyp *) + ["TSKAJXY-GXSABWC DIV"; "TSKAJXY-IYOUOBF sharp v2"; + "TSKAJXY-IYOUOBF sym"; + "TSKAJXY-RIBCYXU sharp"; "TSKAJXY-RIBCYXU sym"; "TSKAJXY-TADIAMB"; + "TSKAJXY-WKGUESB sym"; "TSKAJXY-XLLIPLS"; "TSKAJXY-delta_x4"; + "TSKAJXY-eulerA"] @ + + Merge_ineq.ztg4_ineqs @ + + (* Merge_ineq.cell3_hyp *) + + ["QZECFIC wt0";"QZECFIC wt0 corner";"QZECFIC wt0 sqrt8"; + "QZECFIC wt1";"QZECFIC wt2 A";"CIHTIUM";"CJFZZDW"] @ + + (* Merge_ineq.CRKIBMP *) + + ["GRKIBMP A V2"; "GRKIBMP B V2"] @ + + (* Mege_ineq.g_quqya_goal *) + + ["FHBVYXZ a";"FHBVYXZ b";"FWGKMBZ"] @ + + (* Merge_ineq.gamma10_gamma11_concl *) + + ["GLFVCVK4 2477216213";"QITNPEA 5400790175 a";"QITNPEA 5400790175 b";"FWGKMBZ"] @ + + (* Merge_ineq.gamma23_full8_x_gamma *) + + ["GRKIBMP A V2"] @ + + (* Merge_ineq.cell3_008 *) + [ "QZECFIC wt1";"QZECFIC wt2 A";"CIHTIUM"] @ + + (* Merge_ineq.gamma23_keep135_x_gamma *) + ["GRKIBMP A V2"] @ + + Merge_ineq.QITNPEA1_9063653052_hypl @ + + Merge_ineq.g_qxd_hypl @ + + Merge_ineq.gamma_qx_hypl @ + + (* Merge_ineq.ox *) +(* (map (fun t -> t.idv) (Ineq.getprefix "OXLZLEZ 6346351218")) @ *) + + (* Merge_ineq: *) + (map (fun t -> t.idv) (filter Merge_ineq.is_ox3q1h (!Ineq.ineqs))) @ + + (* packing chapter, TSK and OXL *) + (map (fun t -> t.idv) Merge_ineq.packing_ineq_data) @ + + (* TameGeneral *) + ["5735387903"; "5490182221"] @ + + (* Pent_hex.get_ineq *) + + (map (fun t -> t.idv) (Ineq.getprefix "7550003505")) @ + + (* Parse_ineq.lpstring () : *) + + (map (fun t -> t.idv) (Ineq.getfield Lp)) @ + (map (fun t -> t.idv) (Ineq.getfield Lpsymmetry)) @ + + (* Lp_details *) + ["5584033259";"6170936724";"5691615370"] @ + ["6170936724";"8673686234 a";"8673686234 b";"8673686234 c"] @ + + (* Yssqoy *) + (let has_packid = (fun t -> not(intersect ["UKBRPFE";"WAZLDCD";"BIEFJHU"] (Ineq.flypaper_ids t) = [])) in + let idl = (filter has_packid !Ineq.ineqs) in + (map (fun t -> t.idv) idl)) @ + + + (* Terminal, Pent_hex : + grep get_main_nonlinear local/*.hl | sed 's/^.*get_main_nonlinear//g' | sed 's/").*$/";/g' *) + [ "7439076204"; + "7439076204"; + "7439076204"; + "1834976363"; + "4828966562"; + "6843920790"; + "1117202051"; + "1117202051"; + "4559601669"; + "4559601669"; + "4559601669b"; + "4559601669b"; + "4821120729"; + "6459846571"; + "2485876245a"; + "7175074394"; + "6789182745"; + "4887115291"; + "2125338128"; + "2314572187"; + "7796879304"; + "1347067436"; + "6601228004"; + "3078028960"; + "3078028960"; + "3078028960"; + "5546286427"; + "3665919985"; + "3665919985"; + "7903347843"; + "7997589055"; + "2565248885"; + "2320951108"; + "5429238960"; + "1948775510"; + "3665919985"; + "5708641738"; + "1008824382"; + "1586903463"; + "8875146520"; + "6877738680"; + "9692636487"; + "2485876245b"; + "6762190381"; + "8346775862"; + "8631418063"; + "8631418063"; + "4821120729"; + "5202826650 a"; + "OMKYNLT 3336871894"; + "OMKYNLT 3336871894"; + "4010906068"; + "4010906068"; + "6833979866"; + "5541487347"; + "4528012043"; + "7459553847"; + "4143829594"; + "1080462150"; + "9816718044"; + "3106201101"; + "2200527225"; + "2900061606"; + "7097350062a"; + "OMKYNLT 1 2"; + "7645170609"; + "OMKYNLT 2 1"; + "7881254908"; + "5026777310a"; + "7720405539"; + "2739661360"; + "4922521904"; + "2468307358"; + "2739661360"; + "3603097872"; + "3603097872"; + "3603097872"; + "3603097872"; + "5405130650"; + "5766053833"; + "5691615370"; + "9563139965 d"; + "9563139965 d"; + "9563139965 f"; + "9563139965 f"; + "9563139965 e"; + "9563139965 e"; + "9563139965 e"; + "9563139965 e"; + "4680581274 delta top issue"; + "4559601669"; + "4680581274 delta issue"; + "4680581274 a"; + "7697147739 delta top issue"; + "4559601669"; + "7697147739 delta issue"; + "7697147739 a"; + "5405130650"; + "3603097872"; + "9096461391"; + "2445657182"];; + + let all_ineqs = map (fun t -> t.idv) (!Ineq.ineqs);; + let remain_to_be_used = Flyspeck_lib.nub (sort (<) (subtract all_ineqs flyspeck_used_ineqs));; + + + end;; + + +(* October, 2012 *) + +(* generate file prep.hl of all preprocessed inequalities. *) + +(* edit "#" -> " #" in printer.ml to defuse "--#0.02" bug *) +(* needs "printer.ml";; *) + +module Preprocess = struct + open Scripts;; + +(* let add_inequality _ = ();; *) + + let ineq = Sphere.ineq;; + let print_tag t = match t with + | Branching -> "Branching" + | Sharp -> "Sharp" + | Disallow_derivatives -> "Disallow_derivatives" + | Onlycheckderiv1negative -> "Onlycheckderiv1negative" + | Dim_red -> "Dim_red" + | Dim_red_backsym -> "Dim_red_backsym" + | Quad_cluster f -> "Quad_cluster "^(string_of_float f) + | Set_rad2 -> "Set_rad2" + | Delta126min f -> "Delta126min "^(string_of_float f) + | Delta126max f -> "Delta126max "^(string_of_float f) + | Widthcutoff f -> "Widthcutoff "^(string_of_float f) + | Delta135min f -> "Delta135min "^(string_of_float f) + | Delta135max f -> "Delta126max "^(string_of_float f) + | _ -> "" + ;; + + let print_one (s,tgl,ii) = + let p = Printf.sprintf in + let tgs = filter (fun s -> not(s="")) (map print_tag tgl) in + let jsemi = Flyspeck_lib.unsplit ";" (fun x-> x) in + let tl = jsemi tgs in + let is = print_to_string pp_print_qterm (Sphere.all_forall ii) in + Flyspeck_lib.join_lines [ + "add_inequality { "; + p " idv= \"%s\";" s; + " doc=\"\";"; + p " tags= [%s];" tl; + p " ineq= %s;" is; + p "};;\n\n"; + ];; + + let preprocess1 s = + let prep = (Optimize.preprocess_split_idq + (hd (Ineq.getexact (s)))) in + let v = + Flyspeck_lib.join_lines (map print_one prep) in + let _ = report v in + ((s,map (fun (s,_,_) -> s) prep),v);; + + (* return the association list of idv -> list of new idv *) + let preprocess filename = + let cc = subtract (all_cases()) (disregard) in + let header = "(* Auto generated file of preprocessed inequalities. See Scripts.exec *)\n\n" in + let h1 = "(* "^flyspeck_version()^"\n "^build_date() ^"*)\n\n" in + let h2 = "(* need to defuse --# in printer.ml *)\n\n" in + let h3 = "module Prep = struct\n\n"^ + "let prep_ineqs = ref ([]:ineq_datum list);;\n\n "^ + "let add_inequality i = \n"^ + "let _ = prep_ineqs:= i :: !prep_ineqs in\n"^ + " ();;\n\n" in + let p = map preprocess1 cc in + let v = Flyspeck_lib.join_lines (map snd p) in + let e = "\n\nend;;" in + let _ = Flyspeck_lib.output_filestring filename (header^h1^h2^h3^v^e) in + map fst p;; + + let prep_file = Filename.temp_file "prep" ".hl";; + + let exec()= preprocess prep_file;; +(* exec();; needs prep_file;; *) + +end;; diff --git a/text_formalization/nonlinear/sharp.hl b/text_formalization/nonlinear/sharp.hl new file mode 100644 index 0000000..0aadca9 --- /dev/null +++ b/text_formalization/nonlinear/sharp.hl @@ -0,0 +1,43 @@ + + +module Sharp = struct + +(* SHARP CASES *) + +(* +let gamma4f_delta0 = prove_by_refinement( + mk_imp (`NONLIN:bool`,Sphere.all_forall `ineq [(sqrt8,y1,sqrt8); + (&2,y2,&2); + (&2,y3,&2); + (sqrt8,y4,sqrt8); + (&2,y5,&2); + (&2,y6,&2)] + (gamma4f y1 y2 y3 y4 y5 y6 lmfun = &0)`), + (* {{{ proof *) + [ + BRANCH_TAC; + X_OF_Y_TAC; + REWRITE_TAC[Sphere.ineq]; + REPEAT STRIP_TAC; + SUBGOAL_THEN `x1 = &8 /\ x2 = &4 /\ x3 = &4 /\ x4 = &8 /\ x5 = &4 /\ x6 = &4` (fun t -> REWRITE_TAC[t]); + REPEAT (POP_ASSUM MP_TAC); + REAL_ARITH_TAC; + REPEAT (POP_ASSUM (fun t -> ALL_TAC)); + REWRITE_TAC[Sphere.vol_x;Sphere.gchi2_x;Sphere.gchi3_x;Sphere.gchi5_x; + Sphere.gchi6_x;Sphere.dih_x;Sphere.dih2_x;Sphere.dih3_x;Sphere.dih4_x; + Sphere.dih4_y;Sphere.dih5_x;Sphere.dih5_y;Sphere.dih6_x;Sphere.dih6_y; + Sphere.dih_y]; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + SUBGOAL_THEN `sqrt (&4) * sqrt(&4) = &4 /\ sqrt(&8) *sqrt (&8) = &8` + (fun t-> REWRITE_TAC[t]); + CONJ_TAC THEN MATCH_MP_TAC sq_pow2 THEN EXISTS_TAC `&0` + THEN REAL_ARITH_TAC; + REWRITE_TAC[delta_x_eq0;REAL_ARITH `x * &0 = &0 /\ -- -- x = x`; + SQRT_0;delta_x4_eq64;atn2_0y]; + MP_TAC PI_POS; + CONV_TAC REAL_FIELD; + ]);; + (* }}} *) +*) + +end;; diff --git a/text_formalization/nonlinear/types.hl b/text_formalization/nonlinear/types.hl new file mode 100644 index 0000000..01bfaf5 --- /dev/null +++ b/text_formalization/nonlinear/types.hl @@ -0,0 +1,154 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Nonlinear *) +(* Author: Thomas C. Hales *) +(* Date: 2010-05-30 *) +(* ========================================================================== *) + +(* +File of types for nonlinear inequalities to be verified by interval arithmetic. +*) + +type tag = + (* Application and organization tags *) + + | Flypaper of string list + | Clusterlp | Marchal + | Tablelp | Main_estimate + | Fejestoth | Strongdodec | Further + | Tex | Derived of string list | Deprecated + + (* Numerical testing tags *) + + | Cfsqp | Cfsqp_branch of int | Eps of float + | Penalty of float*float + + (* Linear programming tags *) + | Lp | Lp_aux of string | Lpsymmetry + + (* Interval arithmetic verification tags *) + + | Xconvert + | Split of int list + | Branching | Sharp | Disallow_derivatives | Onlycheckderiv1negative + | Dim_red | Dim_red_backsym + | Quad_cluster of float + | Set_rad2 | Delta126min of float | Delta126max of float | Widthcutoff of float + | Delta135min of float | Delta135max of float + | Set298 (* deprecated *) + ;; + +type ineq_datum = + { + ineq : term; + idv : string; (* name changed 2/16/2011 because of conflict with type_expr *) + doc : string; + tags : tag list; + };; + +type texmarker = Section | Ineqdoc | Comment;; + +(* + Clusterlp means they enter the GLPK calcs for the cluster + inequality. + + Marchal means they enter the non-negativity estimate for clusters + of Marchal cells. + + Tablelp means they enter the LP calcs for the A and B tables in + the definition of Tame h. + + Flypaper means an inequality cited directly in the flypaper + text. The tags are the citation names in the book. + + Further means that it is not part of the Flyspeck project, but + part of one of the extension theorems: StrongDodec, Fejes + Toth's contact conjecture, or Musin-Tarasov. + + Fejestoth means that it is part of the proof of the Fejes Toth's contact conjecture, + but not part of the proof of the Kepler conjecture + + Strongdodec means that it is part of the proof of the strong dodec conjecture, + but not part of the proof of the Kepler conjecture + + The TeX flag means that the doc field is Tex'able code (with + software_guide.tex context). + + CFSQP TAGS: + Cfsqp means that there is cfsqp nonlinear optimization code to + test it by gradient descent. + + Cfsqp_branch uses this disjunct as the objective function, + the others as constraints. + The default is disjunct 0. + + Eps is a small epsilon that is added to numerical testing to + avoid answers neg. by machine eps. + + Penalty implements a penalty method in cfsqp. + + The floats (ub,wt) give the upper bound on the penalty term and its + weight. + + LINEAR PROGRAMMING TAGS: + Lp gives an instruction to generate a MathProg inequality for the + GLPK program to eliminate tame hypermaps. + + Lp_aux are use to prove the Lp inequalities, but are not themselves Lp. + + Lpsymmetry gives an instruction to generate a second MathProg + inequality by symmetry. y2 <-> y3, y5 <-> y6. The domain must + already be symmetrical, otherwise an error results. + + INTERVAL ARITHMETIC TAGS: + Derived means that it is not a primitive inequality, but rather a + logical consequence of others. + + Main_estimate inequalities for TameTableD and related AD HOC + linear programming inequalities. These appear in the Local Fan + chapter of flypaper. + + Xconvert means to use the squared variables "x1...x6" rather than + "y1..y6" when doing the nonlinear verification. + + Split is an instruction to the nonlinear ineq verification to split + the indicated variables (at 2 h0). This is needed on piecewise differentiable + functions (namely, lmfun) to restrict to differentiable domains. + + Sharp means that equality is attained. + + Disallow_derivatives means that verification should not use first derivative + sign to slide to an edge of the domain. + + Onlycheckderiv1negative means that it is not the function itself that should be + verified, but only the first derivative of the first conjunct should be checked to + be negative. This is useful in monotonicity results. + + Dim_red means that dimension reduction can be used on a quad cluster. + + Dim_red_backsym means that dimension reduction can be used on a + quad cluster. It is assumed that the function on the back simplex is taum. + It takes the following form x8,x9 are both extremal, if both + are as long as possible, then x7 is as short as possible. Also x1 + is minimal or x5 is minimal (eliminating x6 minimal by a symmetry + 5-6,2-3,8-9 ). The reductions also use ineq 4828966562 to assume + that the diagonal y4 is at most 3.01 when both x5 and x6 are extremal. + + Quad_cluster is an ineq on a coupled pair of simplices. The float + is the margin value for "breaksapart". + + Set_rad2 means the circumradius can be assumed to be exactly sqrt2. + + Delta126min is a lower bound on delta_x x1 x2 (&2) (&2) (&2) x6 + + Delta126max is an upper bound on delta_x x1 x2 (&2) (&2) (&2) x6 + + Delta135min is a lower bound on delta_x x1 (&2) x3 (&2) x5 (&2). + + Delta135max is an upper bound on delta_x x1 (&2) x3 (&2) x5 (&2). + +(* Set298 is a special tag for the inequality 2986512815. *) + +*) + diff --git a/text_formalization/nonlinear/vukhacky_tactics.hl b/text_formalization/nonlinear/vukhacky_tactics.hl new file mode 100644 index 0000000..59459ad --- /dev/null +++ b/text_formalization/nonlinear/vukhacky_tactics.hl @@ -0,0 +1,65 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* SOME USEFUL TACTICS AND LEMMAS *) +(* *) +(* Authour : VU KHAC KY *) +(* *) +(* ========================================================================= *) + +(* ========================================================================= *) +(* SOME TACTICS *) +(* ========================================================================= *) + +module Vukhacky_tactics = struct + +let UP_ASM_TAC = FIRST_X_ASSUM MP_TAC;; + +let DEL_TAC = FIRST_X_ASSUM MP_TAC THEN MATCH_MP_TAC (MESON[] `a ==> b ==> a`);; + +let SWITCH_TAC = + FIRST_X_ASSUM MP_TAC THEN + FIRST_X_ASSUM MP_TAC THEN + MATCH_MP_TAC (MESON[] `(a ==> b ==> c) ==> (b ==> a ==> c)`) THEN + DISCH_TAC THEN + DISCH_TAC;; + +let REWRITE_ONLY_TAC thm = REWRITE_TAC[thm];; +let REWRITE_WITH thm = SUBGOAL_THEN thm REWRITE_ONLY_TAC;; +let NEW_GOAL s1 = SUBGOAL_THEN s1 ASSUME_TAC;; + +let KY_CHOOSE_TAC thm s = +UNDISCH_TAC thm THEN DISCH_THEN (LABEL_TAC "temp_ky") THEN +(USE_THEN "temp_ky" (MP_TAC o SPEC s)) THEN DISCH_TAC;; + +(* ========================================================================= *) +(* SOME LEMMAS *) +(* ========================================================================= *) + +let HAS_REAL_DERIVATIVE_CHAIN2 = prove + (`!P f g x s. + (!x. P x ==> (g has_real_derivative g' x) (atreal x)) + ==> (f has_real_derivative f') (atreal x within s) /\ P (f x) + ==> ((\x. g (f x)) has_real_derivative f' * g' (f x)) + (atreal x within s)`, + REPEAT GEN_TAC THEN + MP_TAC HAS_REAL_DERIVATIVE_CHAIN THEN + MESON_TAC[]);; + +let REDUCE_WITH_DIV_Euler_lemma = prove_by_refinement ( + `!x y z . ~ (y = &0) /\ ~ (z = &0) ==> x * y / (z * y) = x / z`, + [(REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_EQ_LCANCEL_IMP); + (EXISTS_TAC `z:real`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `a * b * (c:real) = (a * c) * b`]); + (SUBGOAL_THEN `z * x / z = x` ASSUME_TAC); + (MATCH_MP_TAC REAL_DIV_LMUL); + (ASM_REWRITE_TAC[]); + (PURE_ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (MESON[REAL_MUL_LID] `a = &1 ==> a * b = b`)); + (REWRITE_TAC[REAL_ARITH `a * b / c = (a * b) / c`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; MESON[] `~(a \/ b) <=> ~a /\ ~b`]); + (ASM_REWRITE_TAC[])]);; + +end;; diff --git a/text_formalization/packing/AJRIPQN.hl b/text_formalization/packing/AJRIPQN.hl new file mode 100755 index 0000000..56ede58 --- /dev/null +++ b/text_formalization/packing/AJRIPQN.hl @@ -0,0 +1,1051 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: AJRIPQN *) +(* Chaper : Packing *) +(* *) +(* ========================================================================= *) + + +module Ajripqn = struct + +open Rogers;; +open Vukhacky_tactics;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Sphere;; +open Marchal_cells;; +open Emnwuus;; +open Marchal_cells_2_new;; +open Lepjbdj;; +open Hdtfnfz;; +open Urrphbz1;; +open Sltstlo;; +open Qzksykg;; +open Rvfxzbu;; +open Ddzuphj;; + +(* ========================================================================= *) + +let AJRIPQN_concl = +`!V ul vl i j. + saturated V /\ packing V /\ barV V 3 ul /\ barV V 3 vl /\ + i IN {0,1,2,3,4} /\ j IN {0,1,2,3,4} /\ + ~NULLSET (mcell i V ul INTER mcell j V vl) ==> + i = j /\ mcell i V ul = mcell j V vl`;; + +(* ========================================================================= *) +(* Supported lemmas *) + +let VOL_POS_LT_AFF_DIM_3 = prove_by_refinement ( + `!S:real^3->bool. measurable S /\ &0 < vol S ==> aff_dim S = &3`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `aff_dim (S:real^3->bool) <= &(dimindex (:3))`); + (ASM_REWRITE_TAC[AFF_DIM_LE_UNIV]); + (UP_ASM_TAC THEN REWRITE_TAC[DIMINDEX_3] THEN STRIP_TAC); + (ASM_CASES_TAC `aff_dim (S:real^3->bool) <= &2`); + (NEW_GOAL `negligible (S:real^3->bool)`); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `vol (S:real^3->bool) = &0`); + (NEW_GOAL `(!Z:real^3->bool. NULLSET Z ==> vol Z = &0)`); + (MESON_TAC[volume_props]); + (ASM_MESON_TAC[]); + (NEW_GOAL `F`); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC)]);; + +let UP_TO_4_KY_LEMMA = prove (`!i. i <= 4 <=> i IN {0,1,2,3,4}`, + REWRITE_TAC[SET_RULE `i IN {0,1,2,3,4} <=> + (i = 0 \/ i = 1 \/ i = 2 \/ i = 3 \/i= 4)`] THEN ARITH_TAC);; + +let FINITE_SET_LIST_LEMMA = prove + (`!s:A->bool. + FINITE s + ==> FINITE + {y | ?u0 u1 u2 u3. + u0 IN s /\ + u1 IN s /\ + u2 IN s /\ + u3 IN s /\ + y = [u0; u1; u2; u3]}`, + REWRITE_TAC[SET_RULE + `{y | ?u0 u1 u2 u3. u0 IN s /\ u1 IN s /\ u2 IN s /\ u3 IN s /\ + y = [u0; u1; u2; u3]} = + {CONS u0 y1 | u0 IN s /\ + y1 IN {CONS u1 y2 | u1 IN s /\ + y2 IN {[u2;u3] | u2 IN s /\ + u3 IN s}}}`] THEN + REPEAT(GEN_TAC THEN DISCH_TAC THEN + MATCH_MP_TAC FINITE_PRODUCT_DEPENDENT THEN ASM_REWRITE_TAC[]));; + +(* ========================================================================= *) +(* Main theorem *) + +let AJRIPQN = prove_by_refinement (AJRIPQN_concl, + +[(REPEAT GEN_TAC THEN STRIP_TAC); + + (ABBREV_TAC `S = mcell i V ul INTER mcell j V vl`); + (UNDISCH_TAC `~NULLSET (S:real^3->bool)`); + (REWRITE_WITH `~NULLSET (S:real^3->bool) <=> &0 < measure S`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC MEASURABLE_MEASURE_POS_LT); + (EXPAND_TAC "S" THEN MATCH_MP_TAC MEASURABLE_INTER); + (ASM_SIMP_TAC[MEASURABLE_MCELL]); + + (DISCH_TAC); + (NEW_GOAL `bounded (S:real^3->bool)`); + (EXPAND_TAC "S" THEN MATCH_MP_TAC BOUNDED_INTER); + (ASM_SIMP_TAC[BOUNDED_MCELL]); + (UP_ASM_TAC THEN REWRITE_TAC[bounded]); + (STRIP_TAC); + + (NEW_GOAL `?(v:real^3) S1. + v IN V /\ S1 SUBSET S /\ measurable S1 /\ &0 < measure S1 /\ + S1 SUBSET (voronoi_closed V v)`); + (ABBREV_TAC `SP = {v:real^3 | v IN V /\ + ~(voronoi_closed V v INTER S = {})}`); + (NEW_GOAL `FINITE (SP:(real^3->bool))`); + (NEW_GOAL `SP SUBSET (V INTER ball ((vec 0):real^3, a + &2))`); + (EXPAND_TAC "SP" THEN REWRITE_TAC[SUBSET;IN_INTER;IN;IN_ELIM_THM; ball]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[SET_RULE `~(A = {}) <=> (?z. z IN A)`]); + (REWRITE_TAC[IN_INTER]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[dist; NORM_ARITH `norm (vec 0 - a) = norm a`]); + (NEW_GOAL `norm x <= norm z + dist (x , z:real^3)`); + (REWRITE_TAC[dist] THEN NORM_ARITH_TAC); + (NEW_GOAL `norm (z:real^3) <= a`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `dist (x, z:real^3) < &2`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (MATCH_MP_TAC Pack2.voronoi_in_ball); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `V INTER ball ((vec 0):real^3,a + &2)`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC KIUMVTC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `~((S:real^3->bool) = {})`); + (STRIP_TAC); + (UNDISCH_TAC `&0 < vol (S:real^3->bool)`); + (ASM_REWRITE_TAC[MEASURE_EMPTY]); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[SET_RULE `~(A = {}) <=> (?z. z IN A)`]); + (REPEAT STRIP_TAC); + (NEW_GOAL `norm (z:real^3) <= a`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `&0 <= norm (z:real^3)`); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + + (ABBREV_TAC `f = (\v:real^3. voronoi_closed V v INTER S)`); + (ABBREV_TAC `SPP = IMAGE (f:(real^3->real^3->bool)) (SP:real^3->bool)`); + (NEW_GOAL `FINITE (SPP:(real^3->bool)->bool)`); + (EXPAND_TAC "SPP" THEN MATCH_MP_TAC FINITE_IMAGE THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `(S:real^3->bool) = (UNIONS SPP)`); + (EXPAND_TAC "SPP" THEN REWRITE_TAC[SET_EQ_LEMMA; UNIONS_IMAGE;IN;IN_ELIM_THM] + THEN REPEAT STRIP_TAC); + (EXPAND_TAC "f"); + (NEW_GOAL `?v:real^3. v IN V /\ x IN voronoi_closed V v`); + (MATCH_MP_TAC Packing3.TIWWFYQ); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + (EXISTS_TAC `v:real^3`); + (STRIP_TAC); + (EXPAND_TAC "SP" THEN REWRITE_TAC[IN_ELIM_THM]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `~(A = {}) <=> (?z. z IN A)`]); + (EXISTS_TAC `x:real^3`); + (REWRITE_TAC[IN_INTER]); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ONCE_REWRITE_TAC[GSYM IN]); + (REWRITE_TAC[IN_INTER]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "f"); + (REWRITE_WITH `(voronoi_closed V x' INTER S) (x:real^3) + <=> x IN (voronoi_closed V x' INTER S)`); + (MESON_TAC[GSYM IN]); + (REWRITE_TAC[IN_INTER]); + (ASM_SET_TAC[]); + + (NEW_GOAL `!s1. s1 IN SPP ==> measurable (s1:(real^3->bool))`); + (EXPAND_TAC "SPP" THEN EXPAND_TAC "f" THEN REWRITE_TAC[IMAGE;IN; + IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_INTER); + (STRIP_TAC); + (ASM_SIMP_TAC[Packing3.DRUQUFE]); + (EXPAND_TAC "S"); + (MATCH_MP_TAC MEASURABLE_INTER); + (ASM_SIMP_TAC[MEASURABLE_MCELL]); + + + (NEW_GOAL `?S1:real^3->bool. S1 IN SPP /\ ~(negligible S1)`); + (ONCE_REWRITE_TAC[MESON[] `S <=> ~S ==> F`]); + (STRIP_TAC); + (NEW_GOAL `!S1:real^3->bool. S1 IN SPP ==> negligible S1`); + (UP_ASM_TAC THEN MESON_TAC[]); + (NEW_GOAL `negligible (UNIONS (SPP:(real^3->bool)->bool))`); + (MATCH_MP_TAC NEGLIGIBLE_UNIONS); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[GSYM (ASSUME `S:real^3->bool = UNIONS SPP`)]); + (REWRITE_WITH `~NULLSET S <=> &0 < measure (S:real^3->bool)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC MEASURABLE_MEASURE_POS_LT); + (EXPAND_TAC "S"); + (MATCH_MP_TAC MEASURABLE_INTER); + (ASM_SIMP_TAC[MEASURABLE_MCELL]); + (ASM_REWRITE_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC); + + (UP_ASM_TAC THEN EXPAND_TAC "SPP" THEN EXPAND_TAC "f" THEN + REWRITE_TAC[IMAGE;IN;IN_ELIM_THM]); + (EXPAND_TAC "SP" THEN REWRITE_TAC[IN;IN_ELIM_THM; + SET_RULE `~(s = {}) <=> (?x. x IN s)`]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `x:real^3`); + (EXISTS_TAC `S1:real^3->bool`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_INTER); + (STRIP_TAC); + (ASM_SIMP_TAC[Packing3.DRUQUFE]); + (EXPAND_TAC "S"); + (MATCH_MP_TAC MEASURABLE_INTER); + (ASM_SIMP_TAC[MEASURABLE_MCELL]); + + (REWRITE_WITH `&0 < measure (S1:real^3->bool) <=> ~NULLSET S1`); + (MATCH_MP_TAC MEASURABLE_MEASURE_POS_LT); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_INTER); + (STRIP_TAC); + (ASM_SIMP_TAC[Packing3.DRUQUFE]); + (EXPAND_TAC "S"); + (MATCH_MP_TAC MEASURABLE_INTER); + (ASM_SIMP_TAC[MEASURABLE_MCELL]); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); +(* ======================================================================== *) +(* OK here *) + + (NEW_GOAL `?wl:(real^3)list S2. + barV V 3 wl /\ S2 SUBSET S1 /\ measurable S2 /\ + &0 < measure S2 /\ S2 SUBSET (rogers V wl)`); + + (ABBREV_TAC + `SP = {wl| wl IN barV V 3 /\ HD wl = v /\ ~(rogers V wl INTER S1 = {})}`); + (NEW_GOAL `FINITE (SP:((real^3)list->bool))`); + (ABBREV_TAC `H = {u:real^3| u IN V /\ dist (u,v) <= &4}`); + (NEW_GOAL `SP SUBSET + {wl | ?u0 u1 u2 u3. + u0 IN H /\ u1 IN H /\ u2 IN H /\ u3 IN H /\ wl = [u0;u1;u2;u3:real^3]}`); + (EXPAND_TAC "SP" THEN REWRITE_TAC[SUBSET;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?u0 u1 u2 u3. x = [u0:real^3;u1;u2;u3]`); + (MP_TAC (ASSUME `barV V 3 x`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `omega_list V x IN voronoi_list V x`); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[]); + (ABBREV_TAC `u = omega_list V x`); + (UNDISCH_TAC `(u:real^3) IN voronoi_list V x` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `u0 = v:real^3`); + (EXPAND_TAC "v" THEN REWRITE_TAC[ASSUME `x = [u0;u1;u2;u3:real^3]`;HD]); + (DISCH_TAC THEN EXPAND_TAC "H" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (NEW_GOAL `set_of_list (x:(real^3)list) SUBSET V`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (DISCH_TAC); + (REWRITE_WITH `V v /\ (V:real^3->bool) u1 /\ V u2 /\ V (u3:real^3)`); + (UP_ASM_TAC THEN SET_TAC[]); + (NEW_GOAL `!z. z IN {v, u1, u2, u3:real^3} ==> dist (z,v) <= &4`); + (NEW_GOAL `!z. z IN {v, u1, u2, u3:real^3} ==> dist (z,u) <= &2`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `dist (z,u:real^3) <= &2`); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `saturated (V:real^3->bool)`); + (REWRITE_TAC[saturated]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?y. y IN V /\ dist (u, y:real^3) < &2`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `u IN voronoi_closed V (z:real^3)`); + (UNDISCH_TAC `u IN voronoi_list V [u0; u1; u2; u3:real^3]`); + (REWRITE_TAC[VORONOI_LIST;VORONOI_SET; set_of_list; IN_INTERS]); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN;IN_ELIM_THM]); + (STRIP_TAC); + (NEW_GOAL `dist (u,z:real^3) <= dist (u,y)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (z, v) <= dist (z, u) + dist (v, u:real^3)`); + (NORM_ARITH_TAC); + (NEW_GOAL `dist (z,u:real^3) <= &2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (NEW_GOAL `dist (v,u:real^3) <= &2`); + (FIRST_ASSUM MATCH_MP_TAC); + (SET_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_SIMP_TAC[SET_RULE + `a IN {a,b,c,d} /\ b IN {a,b,c,d} /\ c IN {a,b,c,d} /\ d IN {a,b,c,d}`]); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{wl | ?a b c d. + a IN H /\ b IN H /\ c IN H /\ d IN H /\ wl = [a;b;c;d:real^3]}`); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC FINITE_SET_LIST_LEMMA); + (EXPAND_TAC "H"); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `V INTER ball (v:real^3, &5)`); + (ASM_SIMP_TAC[KIUMVTC; REAL_ARITH `&0 <= &5`]); + (EXPAND_TAC "H" THEN REWRITE_TAC[SUBSET; ball; IN_INTER; IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REAL_ARITH_TAC); + (ABBREV_TAC `f = (\wl:(real^3)list. rogers V wl INTER S1)`); + (ABBREV_TAC `SPP = IMAGE (f:((real^3)list->real^3->bool)) + (SP:(real^3)list->bool)`); + (NEW_GOAL `FINITE (SPP:(real^3->bool)->bool)`); + (EXPAND_TAC "SPP" THEN MATCH_MP_TAC FINITE_IMAGE THEN ASM_REWRITE_TAC[]); + + (NEW_GOAL `(S1:real^3->bool) = (UNIONS SPP)`); + (EXPAND_TAC "SPP" THEN REWRITE_TAC[SET_EQ_LEMMA; UNIONS_IMAGE;IN;IN_ELIM_THM] + THEN REPEAT STRIP_TAC); + (EXPAND_TAC "f"); + (NEW_GOAL `?vl. vl IN barV V 3 /\ + x IN rogers V vl /\ + truncate_simplex 0 vl = [v]`); + (REWRITE_WITH `(?vl. vl IN barV V 3 /\ x IN rogers V vl /\ + truncate_simplex 0 vl = [v]) <=> x IN voronoi_closed V v`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Rogers.GLTVHUM); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `vl':(real^3)list`); + (STRIP_TAC); + (EXPAND_TAC "SP" THEN REWRITE_TAC[IN_ELIM_THM]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?u0 u1 u2 u3. vl' = [u0:real^3;u1;u2;u3]`); + (SUBGOAL_THEN `barV V 3 vl'` MP_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (NEW_GOAL `v = u0:real^3`); + (UNDISCH_TAC `truncate_simplex 0 vl' = [v:real^3]`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_0]); + (STRIP_TAC); + (NEW_GOAL `v = HD [v:real^3] /\ u0 = HD [u0:real^3]`); + (REWRITE_TAC[HD]); + (ONCE_ASM_REWRITE_TAC[]); + (AP_TERM_TAC THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_REWRITE_TAC[HD]); + (REWRITE_TAC[SET_RULE `~(x = {}) <=> (?y. y IN x)`]); + (EXISTS_TAC `x:real^3`); + (REWRITE_TAC[IN_INTER]); + (ASM_REWRITE_TAC[IN]); + (REWRITE_WITH `(rogers V vl' INTER S1) x <=> x IN rogers V vl'/\ x IN S1`); + (REWRITE_TAC[IN; GSYM IN_INTER]); + (ASM_REWRITE_TAC[IN]); + (UNDISCH_TAC `(f:(real^3)list->real^3->bool) x' x`); + (EXPAND_TAC "f"); + (REWRITE_WITH `(rogers V x' INTER S1) x <=> x IN rogers V x'/\ x IN S1`); + (REWRITE_TAC[IN; GSYM IN_INTER]); + (SET_TAC[]); + + + (NEW_GOAL `!s1. s1 IN SPP ==> measurable (s1:(real^3->bool))`); + (EXPAND_TAC "SPP" THEN EXPAND_TAC "f" THEN REWRITE_TAC[IMAGE;IN; + IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_INTER); + (STRIP_TAC); + (MATCH_MP_TAC MEASURABLE_ROGERS); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `(SP:(real^3)list->bool) x`); + (EXPAND_TAC "SP" THEN REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?S2:real^3->bool. S2 IN SPP /\ ~(negligible S2)`); + (ONCE_REWRITE_TAC[MESON[] `S <=> ~S ==> F`]); + (STRIP_TAC); + (NEW_GOAL `!S2:real^3->bool. S2 IN SPP ==> negligible S2`); + (UP_ASM_TAC THEN MESON_TAC[]); + (NEW_GOAL `negligible (UNIONS (SPP:(real^3->bool)->bool))`); + (MATCH_MP_TAC NEGLIGIBLE_UNIONS); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[GSYM (ASSUME `S1:real^3->bool = UNIONS SPP`)]); + (REWRITE_WITH `~NULLSET S1 <=> &0 < measure (S1:real^3->bool)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC MEASURABLE_MEASURE_POS_LT); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (FIRST_X_ASSUM CHOOSE_TAC); + (UP_ASM_TAC THEN EXPAND_TAC "SPP" THEN EXPAND_TAC "f" THEN + REWRITE_TAC[IMAGE;IN;IN_ELIM_THM]); + (EXPAND_TAC "SP" THEN REWRITE_TAC[IN;IN_ELIM_THM; + SET_RULE `~(s = {}) <=> (?x. x IN s)`]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `x:(real^3)list`); + (EXISTS_TAC `S2:real^3->bool`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_INTER); + (STRIP_TAC); + (MATCH_MP_TAC MEASURABLE_ROGERS); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `&0 < measure (S2:real^3->bool) <=> ~NULLSET S2`); + (MATCH_MP_TAC MEASURABLE_MEASURE_POS_LT); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_INTER); + (STRIP_TAC); + (MATCH_MP_TAC MEASURABLE_ROGERS); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + +(* ======================================================================== *) +(* ----------------------------- *) +(* OK here *) + + (NEW_GOAL + `?S3. S3 SUBSET S2 /\ + measurable S3 /\ + &0 < vol S3 /\ + (!kl. barV V 3 kl /\ ~(rogers V kl = rogers V wl) ==> S3 INTER rogers V kl = {})`); + (ABBREV_TAC + `SP = {kl| kl IN barV V 3 /\ ~(rogers V kl INTER S2 = {})}`); + (NEW_GOAL `FINITE (SP:((real^3)list->bool))`); + (ABBREV_TAC `H = {u:real^3| u IN V /\ dist (u,HD wl) <= &12}`); + (NEW_GOAL `SP SUBSET + {kl | ?u0 u1 u2 u3. + u0 IN H /\ u1 IN H /\ u2 IN H /\ u3 IN H /\ kl = [u0;u1;u2;u3:real^3]}`); + (EXPAND_TAC "SP" THEN REWRITE_TAC[SUBSET;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?u0 u1 u2 u3. x = [u0:real^3;u1;u2;u3]`); + (MP_TAC (ASSUME `barV V 3 x`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list x SUBSET (V:real^3 ->bool)`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]); + DISCH_TAC; + (NEW_GOAL `!u. u IN {u0,u1,u2,u3} ==> dist (u, u0:real^3) <= &4`); + (REPEAT STRIP_TAC); + (NEW_GOAL `aff_dim (voronoi_list V (x:(real^3)list)) + &(LENGTH x) = &4`); + (UNDISCH_TAC `barV V 3 x` THEN REWRITE_TAC[BARV;VORONOI_NONDG]); + (STRIP_TAC); + (MATCH_MP_TAC (MESON[] ` + LENGTH x < 5 /\ set_of_list x SUBSET (V:real^3->bool) /\ A ==> A`)); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[Packing3.INITIAL_SUBLIST_REFL]); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (NEW_GOAL `LENGTH (x:(real^3)list) = 4`); + (MATCH_MP_TAC (MESON[] `A /\ CARD (set_of_list (x:(real^3)list)) = 3 + 1 ==> A`)); + (REWRITE_TAC[ARITH_RULE `4 = 3 + 1`]); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `(a:int) + &4 = &4 <=> a = &0`; AFF_DIM_EQ_0]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `!p. p IN {u0, u1, u2, u3:real^3} ==> dist (a', p) <= &2`); + (REPEAT STRIP_TAC); + (NEW_GOAL `a' IN voronoi_closed V (p:real^3)`); + (SWITCH_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[VORONOI_LIST;VORONOI_SET; set_of_list; INTERS]); + (MATCH_MP_TAC (SET_RULE `(s IN A ==> B) ==> (A = {s} ==> B)`)); + (REWRITE_TAC[IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (EXISTS_TAC `p:real^3`); + (STRIP_TAC); + (ASM_MESON_TAC[IN]); + (REWRITE_TAC[ETA_AX]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed;IN;IN_ELIM_THM] THEN DISCH_TAC); + (NEW_GOAL `?y. y IN V /\ dist (a',y:real^3) < &2`); + (ASM_MESON_TAC[saturated]); + (FIRST_X_ASSUM CHOOSE_TAC); + (MATCH_MP_TAC (REAL_ARITH `m <= dist (a', y:real^3) /\ + dist (a', y:real^3) < b ==> m <= b`)); + (ASM_REWRITE_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_MESON_TAC[IN]); + (NEW_GOAL `dist (u, u0) <= dist (a', u) + dist (a', u0:real^3)`); + (NORM_ARITH_TAC); + (NEW_GOAL `dist (a', u) <= &2 /\ dist (a', u0:real^3) <= &2`); + (ASM_SIMP_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (SET_TAC[]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `u0 IN {u0, u1, u2, u3:real^3} /\ u1 IN {u0, u1, u2, u3} /\ + u2 IN {u0, u1, u2, u3} /\ u3 IN {u0, u1, u2, u3}`); + (SET_TAC[]); + (EXPAND_TAC "H"); + (REWRITE_TAC[IN_ELIM_THM]); + (REWRITE_WITH `(u0:real^3) IN V /\ u1 IN V /\ u2 IN V /\ u3 IN V`); + (ASM_SET_TAC[]); + (NEW_GOAL `!u. u IN {u0,u1,u2,u3} ==> dist (u:real^3, HD wl) <= &12`); + (UNDISCH_TAC `~(rogers V x INTER S2 = {})`); + (REWRITE_TAC[SET_RULE `~(s = {}) <=> (?p. p IN s)`]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u,HD wl) <= dist (u,u0:real^3) + dist (u0, p) + dist (p, HD wl)`); + (NORM_ARITH_TAC); + (NEW_GOAL `dist (u,u0:real^3) <= &4 /\ dist (u0,p) <= &4 /\ dist (p,HD wl) <= &4`); + (ASM_SIMP_TAC[]); + (STRIP_TAC); + (SUBGOAL_THEN `p IN rogers V x` ASSUME_TAC); + (ASM_SET_TAC[]); + (NEW_GOAL `p IN voronoi_closed V (u0:real^3)`); + (REWRITE_WITH `p IN voronoi_closed V u0 <=> + (?vl. vl IN barV V 3 /\ + p IN rogers V vl /\ + truncate_simplex 0 vl = [u0])`); + (MATCH_MP_TAC Rogers.GLTVHUM); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (EXISTS_TAC `x:(real^3)list`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_0]); + (ASM_MESON_TAC[IN]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN;IN_ELIM_THM] THEN DISCH_TAC); + + (NEW_GOAL `?y. y IN V /\ dist (p,y:real^3) < &2`); + (ASM_MESON_TAC[saturated]); + (FIRST_X_ASSUM CHOOSE_TAC); + + (MATCH_MP_TAC (REAL_ARITH `m <= dist (p, y:real^3) /\ + dist (p, y:real^3) < &2 ==> m <= &4`)); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `dist (u0,p) = dist (p,u0:real^3)`); + (MESON_TAC[DIST_SYM]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_MESON_TAC[IN]); + + (SUBGOAL_THEN `p IN rogers V wl` ASSUME_TAC); + (ASM_SET_TAC[]); + (NEW_GOAL `?w0 w1 w2 w3. wl = [w0:real^3;w1;w2;w3]`); + (MP_TAC (ASSUME `barV V 3 wl`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (ASM_REWRITE_TAC[HD]); + + (NEW_GOAL `p IN voronoi_closed V (w0:real^3)`); + (REWRITE_WITH `p IN voronoi_closed V w0 <=> + (?vl. vl IN barV V 3 /\ + p IN rogers V vl /\ + truncate_simplex 0 vl = [w0])`); + (MATCH_MP_TAC Rogers.GLTVHUM); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list wl SUBSET (V:real^3->bool)`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (EXISTS_TAC `wl:(real^3)list`); + (ASM_MESON_TAC[IN;TRUNCATE_SIMPLEX_EXPLICIT_0]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN;IN_ELIM_THM] THEN DISCH_TAC); + + (NEW_GOAL `?y. y IN V /\ dist (p,y:real^3) < &2`); + (ASM_MESON_TAC[saturated]); + (FIRST_X_ASSUM CHOOSE_TAC); + + (MATCH_MP_TAC (REAL_ARITH `m <= dist (p, y:real^3) /\ + dist (p, y:real^3) < &2 ==> m <= &4`)); + (ASM_REWRITE_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_MESON_TAC[IN]); + (ASM_REAL_ARITH_TAC); + (ASM_SIMP_TAC[]); + + + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{kl | ?u0 u1 u2 u3:real^3. + u0 IN H /\ u1 IN H /\ u2 IN H /\ u3 IN H /\ + kl = [u0; u1; u2; u3]}`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_SET_LIST_LEMMA); + (EXPAND_TAC "H"); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `V INTER ball ((HD wl):real^3, &15)`); + (ASM_SIMP_TAC[KIUMVTC; REAL_ARITH `&0 <= &15`]); + (EXPAND_TAC "H" THEN REWRITE_TAC[SUBSET; ball; IN_INTER; IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REAL_ARITH_TAC); + +(* ======================================================================== *) +(* Ok here *) + + (ABBREV_TAC `f = (\kl:(real^3)list. rogers V kl INTER rogers V wl)`); + (ABBREV_TAC `SPP = IMAGE (f:((real^3)list->real^3->bool)) + ((SP:(real^3)list->bool) DIFF {zl| rogers V zl = rogers V wl})`); + + (NEW_GOAL `FINITE (SPP:(real^3->bool)->bool)`); + (EXPAND_TAC "SPP" THEN MATCH_MP_TAC FINITE_IMAGE THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `SP:(real^3)list->bool`); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + + (EXISTS_TAC `(S2:real^3->bool) DIFF (rogers V wl INTER UNIONS SPP)`); + (REWRITE_TAC[SET_RULE `A DIFF B SUBSET A`]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC MEASURABLE_DIFF); + (ASM_REWRITE_TAC[MEASURABLE_INTER]); + (MATCH_MP_TAC MEASURABLE_INTER); + (STRIP_TAC); + (MATCH_MP_TAC MEASURABLE_ROGERS); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_UNIONS); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "SPP"); + (EXPAND_TAC "f"); + (REWRITE_TAC[BETA_THM; IMAGE;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_INTER); + (ASM_SIMP_TAC [MEASURABLE_ROGERS]); + (MATCH_MP_TAC MEASURABLE_ROGERS); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `(SP DIFF {zl | rogers V zl = rogers V wl}) x`); + (REWRITE_WITH `(SP DIFF {zl | rogers V zl = rogers V wl}) x <=> + x IN (SP DIFF {zl | rogers V zl = rogers V wl})`); + (MESON_TAC[IN]); + (REWRITE_TAC[IN_DIFF]); + (EXPAND_TAC "SP" THEN REWRITE_TAC[IN_ELIM_THM]); + (MESON_TAC[IN]); + (REWRITE_WITH `measure (S2 DIFF rogers V wl INTER UNIONS SPP) = measure S2`); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + (REWRITE_TAC[SET_RULE `(A DIFF B) DIFF A UNION A DIFF (A DIFF B) = A INTER B`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `rogers V wl INTER UNIONS SPP`); + (REWRITE_TAC[SET_RULE `A INTER B SUBSET B`]); + (REWRITE_TAC[INTER_UNIONS]); + (MATCH_MP_TAC NEGLIGIBLE_UNIONS); + (STRIP_TAC); + (REWRITE_WITH `{rogers V wl INTER x | x IN SPP} = IMAGE (\x. rogers V wl INTER x) SPP`); + (REWRITE_TAC[IMAGE; SET_EQ_LEMMA; IN;IN_ELIM_THM]); + (MATCH_MP_TAC FINITE_IMAGE); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "SPP" THEN EXPAND_TAC "SP" THEN EXPAND_TAC "f"); + (REWRITE_TAC[IMAGE;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[SET_RULE `a INTER b INTER a = a INTER b`]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (MATCH_MP_TAC DUUNHOR); + (UNDISCH_TAC `({kl | barV V 3 kl /\ ~(rogers V kl INTER S2 = {})} DIFF + {zl | rogers V zl = rogers V wl}) x'`); + (REWRITE_WITH + `({kl | barV V 3 kl /\ ~(rogers V kl INTER S2 = {})} DIFF + {zl | rogers V zl = rogers V wl}) x' <=> + x' IN ({kl | barV V 3 kl /\ ~(rogers V kl INTER S2 = {})} DIFF + {zl | rogers V zl = rogers V wl})`); + (MESON_TAC[IN]); + (REWRITE_TAC[IN_DIFF]); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (DISCH_TAC THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (EXPAND_TAC "SPP" THEN EXPAND_TAC "SP" THEN EXPAND_TAC "f"); + (REWRITE_TAC[IMAGE;IN;IN_ELIM_THM]); + (REWRITE_TAC[MESON[IN; IN_DIFF] `(S DIFF P) x <=> x IN S /\ ~(x IN P)`]); + (REWRITE_TAC[IN;IN_ELIM_THM]); + (MATCH_MP_TAC (SET_RULE `(!p. p IN S ==> ~(p IN P)) ==> (S INTER P = {})`)); + (REWRITE_TAC[IN_DIFF; IN_INTER;IN_UNIONS; MESON[] `~(A /\ B) <=> ~A \/ ~ B`]); + + (REPEAT STRIP_TAC); + (NEW_GOAL `p IN rogers V wl`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (NEW_GOAL `?t. t IN + {y | ?x. ((barV V 3 x /\ ~(rogers V x INTER S2 = {})) /\ + ~(rogers V x = rogers V wl)) /\ + y = rogers V x INTER rogers V wl} /\ + p IN t`); + (EXISTS_TAC `rogers V kl INTER rogers V wl`); + (ASM_REWRITE_TAC[IN_INTER]); + (STRIP_TAC); + (REWRITE_TAC[IN;IN_ELIM_THM]); + (EXISTS_TAC `kl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `~(A INTER B = {}) <=> (?z. z IN A /\ z IN B)`]); + (EXISTS_TAC `p:real^3`); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + +(* ========================================================================= *) +(* OK here *) + + (NEW_GOAL `?k:num S4. k <= 4 /\ + S4 SUBSET S3 /\ measurable S4 /\ &0 < measure S4 /\ + S4 SUBSET (mcell k V wl)`); + + (ABBREV_TAC + `SP = {k:num| ~(mcell k V wl INTER S3 = {}) /\ k <= 4}`); + (NEW_GOAL `FINITE (SP:(num ->bool))`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{k | k <= 4}`); + (EXPAND_TAC "SP"); + (SET_TAC[FINITE_NUMSEG_LE]); + + (ABBREV_TAC `f = (\k:num. mcell k V wl INTER S3)`); + (ABBREV_TAC `SPP = IMAGE (f:(num->real^3->bool)) + (SP:num->bool)`); + (NEW_GOAL `FINITE (SPP:(real^3->bool)->bool)`); + (EXPAND_TAC "SPP" THEN MATCH_MP_TAC FINITE_IMAGE THEN ASM_REWRITE_TAC[]); + + (NEW_GOAL `(S3:real^3->bool) = (UNIONS SPP)`); + (EXPAND_TAC "SPP" THEN REWRITE_TAC[SET_EQ_LEMMA; UNIONS_IMAGE;IN;IN_ELIM_THM] + THEN REPEAT STRIP_TAC); + (EXPAND_TAC "f"); + + (NEW_GOAL `?j. j <= 4 /\ x IN mcell j V wl`); + (MATCH_MP_TAC SLTSTLO1); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `(x:real^3) IN S3 /\ S3 SUBSET B ==> x IN B`)); + (STRIP_TAC); + (UP_ASM_TAC THEN SIMP_TAC[IN]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `j':num`); + (STRIP_TAC); + (EXPAND_TAC "SP"); + (REWRITE_TAC[IN_ELIM_THM]); + (ASM_REWRITE_TAC[INTER]); + (ASM_SET_TAC[]); + (ONCE_REWRITE_TAC[GSYM IN]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "f"); + (ONCE_REWRITE_TAC + [MESON[IN] `(mcell x' V wl INTER S3) x <=> x IN (mcell x' V wl INTER S3)`]); + (REWRITE_TAC[IN_INTER; IN]); + (MESON_TAC[]); + + (NEW_GOAL `!s1. s1 IN SPP ==> measurable (s1:(real^3->bool))`); + (EXPAND_TAC "SPP" THEN EXPAND_TAC "f" THEN REWRITE_TAC[IMAGE;IN; + IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_INTER); + (STRIP_TAC); + (MATCH_MP_TAC MEASURABLE_MCELL); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?k. k <= 4 /\ ~negligible (mcell k V wl INTER S3)`); + (REWRITE_WITH `(?k. k <= 4 /\ ~negligible (mcell k V wl INTER S3)) <=> + ~(!k. (k <= 4) ==> negligible (mcell k V wl INTER S3))`); + (MESON_TAC[]); + (STRIP_TAC); + (NEW_GOAL `negligible (UNIONS (SPP:(real^3->bool)->bool))`); + (MATCH_MP_TAC NEGLIGIBLE_UNIONS); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "SPP" THEN EXPAND_TAC "f"); + (REWRITE_TAC[IMAGE]); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ONCE_ASM_REWRITE_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (UNDISCH_TAC `(SP:num->bool) x`); + (EXPAND_TAC "SP" THEN REWRITE_TAC[IN_ELIM_THM]); + (MESON_TAC[]); + + (UP_ASM_TAC THEN REWRITE_TAC[GSYM + (ASSUME `S3 = UNIONS (SPP:(real^3->bool)->bool)`)]); + (REWRITE_WITH `~NULLSET S3 <=> &0 < measure (S3:real^3->bool)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC MEASURABLE_MEASURE_POS_LT); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC THEN EXISTS_TAC `k:num` + THEN EXISTS_TAC `mcell k V wl INTER S3`); + (REPEAT STRIP_TAC); + + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + (MATCH_MP_TAC MEASURABLE_INTER); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_MCELL); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `&0 < measure (mcell k V wl INTER S3) <=> + ~negligible (mcell k V wl INTER S3)`); + (MATCH_MP_TAC MEASURABLE_MEASURE_POS_LT); + (MATCH_MP_TAC MEASURABLE_INTER); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_MCELL); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + +(* -------------------------------------------------------------------------- *) +(* OK here *) + + (NEW_GOAL `?S5. S5 SUBSET S4 /\ measurable S5 /\ &0 < measure S5 /\ + (!h. ~(h = k) /\ h <= 4 ==> (S5 INTER mcell h V wl = {}))`); + (NEW_GOAL `?Z. !p. saturated V /\ packing V /\ barV V 3 wl + ==> NULLSET Z /\ + (p IN rogers V wl DIFF Z + ==> (?!i. i <= 4 /\ p IN mcell i V wl))`); + (ASM_REWRITE_TAC[SLTSTLO2]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `NULLSET Z /\ !p. (p IN rogers V wl DIFF Z + ==> (?!i. i <= 4 /\ p IN mcell i V wl))`); + (NEW_GOAL `!p. NULLSET Z /\ (p IN rogers V wl DIFF Z + ==> (?!i. i <= 4 /\ p IN mcell i V wl))`); + (GEN_TAC THEN FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[EXISTS_UNIQUE] THEN STRIP_TAC); + + (EXISTS_TAC `S4 DIFF (Z:real^3->bool)`); + (REPEAT STRIP_TAC); + (SET_TAC[]); + (MATCH_MP_TAC MEASURABLE_DIFF); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[MEASURABLE_RULES]); + (REWRITE_WITH `measure (S4 DIFF Z) = measure (S4:real^3->bool)`); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `Z:real^3->bool`); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `A = {} <=> (!x. x IN A ==> F)`]); + (GEN_TAC THEN STRIP_TAC); + (NEW_GOAL `x IN mcell k V wl`); + (MATCH_MP_TAC (SET_RULE `x IN (S4 DIFF Z) INTER mcell h V wl /\ + (S4 DIFF Z) INTER mcell h V wl SUBSET A ==> x IN A`)); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + + (NEW_GOAL `x IN rogers V wl DIFF Z`); + (ASM_SET_TAC[]); + (NEW_GOAL `(?i. (i <= 4 /\ x IN mcell i V wl) /\ + (!y. y <= 4 /\ x IN mcell y V wl ==> y = i))`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `k = i':num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `h = i':num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + +(* -------------------------------------------------------------------------- *) +(* OK here *) + (NEW_GOAL `mcell i V ul SUBSET + UNIONS {rogers V (left_action_list p ul) | p permutes 0..i - 1}`); + (MATCH_MP_TAC QZKSYKG2); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `~(S5 = {}:real^3->bool)`); + (STRIP_TAC); + (NEW_GOAL `negligible (S5:real^3->bool)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (NEW_GOAL `vol (S5) = &0`); + (ASM_SIMP_TAC[volume_props]); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[SET_RULE `~(S = {}) <=> (?x. x IN S)`]); + (STRIP_TAC); + + (NEW_GOAL `S5 SUBSET mcell i V ul /\ S5 SUBSET mcell j V vl`); + (ASM_SET_TAC[]); + (NEW_GOAL `S5 SUBSET + UNIONS {rogers V (left_action_list p ul) | p permutes 0..i - 1}`); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (NEW_GOAL `x IN UNIONS {rogers V (left_action_list p ul) | p permutes 0..i - 1}`); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_UNIONS; IN; IN_ELIM_THM] THEN STRIP_TAC); + (ABBREV_TAC `kl:(real^3)list = left_action_list p ul`); + (NEW_GOAL `barV V 3 kl`); + (MATCH_MP_TAC QZKSYKG1); + (EXISTS_TAC `ul:(real^3)list`); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `x IN mcell i V ul`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `rogers V kl = rogers V wl`); + (ASM_CASES_TAC `rogers V kl = rogers V wl`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (NEW_GOAL `S3 INTER rogers V kl = {}`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `mcell i V kl = mcell i V ul`); + (EXPAND_TAC "kl"); + (MATCH_MP_TAC RVFXZBU); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `mcell i V kl = mcell i V wl`); + (MATCH_MP_TAC DDZUPHJ); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (MATCH_MP_TAC VOL_POS_LT_AFF_DIM_3); + (ASM_SIMP_TAC[MEASURABLE_ROGERS]); + (NEW_GOAL `vol S5 <= vol (rogers V wl)`); + (MATCH_MP_TAC MEASURE_SUBSET); + (ASM_SIMP_TAC[MEASURABLE_ROGERS]); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_SET_TAC[]); + + (NEW_GOAL `mcell j V vl SUBSET + UNIONS {rogers V (left_action_list q vl) | q permutes 0..j - 1}`); + (MATCH_MP_TAC QZKSYKG2); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `~(S5 = {}:real^3->bool)`); + (STRIP_TAC); + (NEW_GOAL `negligible (S5:real^3->bool)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (NEW_GOAL `vol (S5) = &0`); + (ASM_SIMP_TAC[volume_props]); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[SET_RULE `~(S = {}) <=> (?x. x IN S)`]); + (STRIP_TAC); + + (NEW_GOAL `S5 SUBSET + UNIONS {rogers V (left_action_list q vl) | q permutes 0..j - 1}`); + (SET_TAC[ASSUME `S5 SUBSET mcell i V ul /\ S5 SUBSET mcell j V vl`; ASSUME + `mcell j V vl SUBSET + UNIONS {rogers V (left_action_list q vl) | q permutes 0..j - 1}`]); + (NEW_GOAL `x' IN UNIONS {rogers V (left_action_list q vl) | q permutes 0..j - 1}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (UP_ASM_TAC THEN REWRITE_TAC[IN_UNIONS; IN; IN_ELIM_THM] THEN STRIP_TAC); + (ABBREV_TAC `sl:(real^3)list = left_action_list q vl`); + (NEW_GOAL `barV V 3 sl`); + (MATCH_MP_TAC QZKSYKG1); + (EXISTS_TAC `vl:(real^3)list`); + (EXISTS_TAC `j:num` THEN EXISTS_TAC `q:num->num`); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + + (NEW_GOAL `rogers V sl = rogers V wl`); + (ASM_CASES_TAC `rogers V sl = rogers V wl`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (NEW_GOAL `S3 INTER rogers V sl = {}`); + (ASM_SIMP_TAC[]); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `mcell j V sl = mcell j V vl`); + (EXPAND_TAC "sl"); + (MATCH_MP_TAC RVFXZBU); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `mcell j V sl = mcell j V wl`); + (MATCH_MP_TAC DDZUPHJ); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (MATCH_MP_TAC VOL_POS_LT_AFF_DIM_3); + (ASM_SIMP_TAC[MEASURABLE_ROGERS]); + (NEW_GOAL `vol S5 <= vol (rogers V wl)`); + (MATCH_MP_TAC MEASURE_SUBSET); + (ASM_SIMP_TAC[MEASURABLE_ROGERS]); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_SET_TAC[]); + + (NEW_GOAL `S5 SUBSET (mcell i V ul INTER mcell j V vl)`); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH + `mcell i V ul = mcell i V wl /\ mcell j V vl = mcell j V wl`); + (ASM_MESON_TAC[]); + (STRIP_TAC); + + (NEW_GOAL `i = k:num`); + (ASM_CASES_TAC `i = k:num`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `S5 INTER mcell i V wl = {}`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[UP_TO_4_KY_LEMMA]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `j = k:num`); + (ASM_CASES_TAC `j = k:num`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `S5 INTER mcell j V wl = {}`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[UP_TO_4_KY_LEMMA]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + + (ASM_REWRITE_TAC[])]);; + + +end;; diff --git a/text_formalization/packing/DDZUPHJ.hl b/text_formalization/packing/DDZUPHJ.hl new file mode 100755 index 0000000..7265c29 --- /dev/null +++ b/text_formalization/packing/DDZUPHJ.hl @@ -0,0 +1,611 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: DDZUPHJ *) +(* Chaper : Packing *) +(* *) +(* ========================================================================= *) + + +module Ddzuphj = struct + +open Rogers;; +open Vukhacky_tactics;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Sphere;; +open Marchal_cells;; +open Emnwuus;; +open Marchal_cells_2_new;; +open Lepjbdj;; +open Hdtfnfz;; +open Tezffsk;; +open Njiutiu;; + +(* ========================================================================= *) + +let DDZUPHJ_concl = +`!V ul vl k. + saturated V /\ packing V /\ k IN {0,1,2,3,4} /\ + barV V 3 ul /\ barV V 3 vl /\ rogers V ul = rogers V vl /\ + aff_dim (rogers V ul) = &3 /\ ~ (mcell k V ul = {}) + ==> (mcell k V ul = mcell k V vl)`;; + +(* ========================================================================= *) + +let RCONE_GT_EQ_EMPTY_LEMMA = prove_by_refinement ( + `!a:real^3 b r. r >= &1 ==> rcone_gt a b r = {}`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[rcone_gt;rconesgn; + SET_RULE `{x | P x} = {} <=> (!x. P x ==> F)`]); + (REWRITE_TAC[dist] THEN REPEAT STRIP_TAC); + (NEW_GOAL `(x - a) dot (b - a) <= norm(x - a) * norm (b - a:real^3)`); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ]); + (NEW_GOAL`norm (x - a) * norm (b:real^3 -a) * r >= norm (x-a) * norm (b-a)`); + (REWRITE_TAC[REAL_ARITH `(a*b*c >= a * b) <=> &0 <= (a * b) * (c - &1)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL THEN REWRITE_TAC[NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC)]);; + +(* ========================================================================= *) +(* Main theorem *) +(* ========================================================================= *) + + +let DDZUPHJ = prove_by_refinement (DDZUPHJ_concl, +[(REPEAT STRIP_TAC); + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REPEAT STRIP_TAC); + +(* ========================================================================= *) +(* Case k = 4 *) + + (ASM_CASES_TAC `k = 4`); + (NEW_GOAL `hl (ul:(real^3)list) < sqrt (&2)`); + (UNDISCH_TAC `~(mcell k V ul = {})` THEN + SIMP_TAC[ASSUME `k = 4`; MCELL_EXPLICIT; ARITH_RULE `4 >= 4`;mcell4]); + (MESON_TAC[]); + + (NEW_GOAL `truncate_simplex 3 (ul:(real^3)list) = truncate_simplex 3 vl`); + (MATCH_MP_TAC TEZFFSK); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[ARITH_RULE `3 <= 3`]); + (REWRITE_WITH `truncate_simplex 3 [u0; u1; u2; u3:real^3] = ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH `truncate_simplex 3 (ul:(real^3)list) = ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3]); + (REWRITE_WITH `truncate_simplex 3 (vl:(real^3)list) = vl`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3]); + (STRIP_TAC); + (REWRITE_TAC[ASSUME `ul = (vl:(real^3)list)`]); + +(* ========================================================================= *) +(* Case k = 3 *) + (ASM_CASES_TAC `k = 3`); + (NEW_GOAL `hl (truncate_simplex 2 ul) < sqrt (&2) /\ + sqrt (&2) <= hl (ul:(real^3)list)`); + (UNDISCH_TAC `~(mcell k V ul = {})` THEN + SIMP_TAC[ASSUME `k = 3`; MCELL_EXPLICIT;mcell3]); + (MESON_TAC[]); + + (NEW_GOAL `truncate_simplex 2 (ul:(real^3)list) = truncate_simplex 2 vl`); + (MATCH_MP_TAC TEZFFSK); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `!i. 0 <= i /\ i <= 3 + ==> omega_list_n V ul i = omega_list_n V vl i`); + (MATCH_MP_TAC NJIUTIU); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `sqrt (&2) <= hl (vl:(real^3)list)`); + (REWRITE_TAC[ARITH_RULE `a <= b <=> (b < a ==> F)`]); + (STRIP_TAC); + (NEW_GOAL `hl vl = dist (omega_list V vl,HD vl)`); + (MATCH_MP_TAC WAUFCHE2); + (EXISTS_TAC `3` THEN REWRITE_TAC[IN] THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `hl ul <= dist (omega_list V ul,HD ul)`); + (MATCH_MP_TAC WAUFCHE1); + (EXISTS_TAC `3` THEN REWRITE_TAC[IN] THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN + REWRITE_WITH `omega_list V ul = omega_list V vl /\ HD ul = HD vl`); + (STRIP_TAC); + (ASM_REWRITE_TAC[OMEGA_LIST; LENGTH]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`); + GSYM (ASSUME `vl = [v0;v1;v2;v3:real^3]`)]); + (FIRST_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + (REWRITE_WITH `HD (ul:(real^3)list) = HD (truncate_simplex 2 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_WITH `HD (vl:(real^3)list) = HD (truncate_simplex 2 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `mxi V ul = mxi V vl`); + (REWRITE_TAC[mxi]); + (COND_CASES_TAC); + (COND_CASES_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + (NEW_GOAL `F`); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `omega_list_n V ul 2 = omega_list_n V vl 2`); + (FIRST_ASSUM MATCH_MP_TAC THEN ARITH_TAC); + (REWRITE_WITH `omega_list_n V ul 3 = omega_list_n V vl 3`); + (FIRST_ASSUM MATCH_MP_TAC THEN ARITH_TAC); + (REWRITE_WITH `HD (ul:(real^3)list) = HD (truncate_simplex 2 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_WITH `HD (vl:(real^3)list) = HD (truncate_simplex 2 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (SIMP_TAC[ASSUME `k = 3`; MCELL_EXPLICIT; mcell3]); + (COND_CASES_TAC); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[GSYM (ASSUME + `truncate_simplex 2 ul = truncate_simplex 2 (vl:(real^3)list)`)]); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + +(* ========================================================================= *) +(* Case k = 2 *) + + (ASM_CASES_TAC `k = 2`); + (NEW_GOAL `hl (truncate_simplex 1 ul) < sqrt (&2) /\ + sqrt (&2) <= hl (ul:(real^3)list)`); + (UNDISCH_TAC `~(mcell k V ul = {})` THEN + SIMP_TAC[ASSUME `k = 2`; MCELL_EXPLICIT;mcell2]); + (MESON_TAC[]); + + (NEW_GOAL `truncate_simplex 1 (ul:(real^3)list) = truncate_simplex 1 vl`); + (MATCH_MP_TAC TEZFFSK); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + + (NEW_GOAL `!i. 0 <= i /\ i <= 3 + ==> omega_list_n V ul i = omega_list_n V vl i`); + (MATCH_MP_TAC NJIUTIU); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `sqrt (&2) <= hl (vl:(real^3)list)`); + (REWRITE_TAC[ARITH_RULE `a <= b <=> (b < a ==> F)`]); + (STRIP_TAC); + (NEW_GOAL `hl vl = dist (omega_list V vl,HD vl)`); + (MATCH_MP_TAC WAUFCHE2); + (EXISTS_TAC `3` THEN REWRITE_TAC[IN] THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `hl ul <= dist (omega_list V ul,HD ul)`); + (MATCH_MP_TAC WAUFCHE1); + (EXISTS_TAC `3` THEN REWRITE_TAC[IN] THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN + REWRITE_WITH `omega_list V ul = omega_list V vl /\ HD ul = HD vl`); + (STRIP_TAC); + (ASM_REWRITE_TAC[OMEGA_LIST; LENGTH]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`); + GSYM (ASSUME `vl = [v0;v1;v2;v3:real^3]`)]); + (FIRST_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + (REWRITE_WITH `HD (ul:(real^3)list) = HD (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_WITH `HD (vl:(real^3)list) = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `mxi V ul = mxi V vl`); + (REWRITE_TAC[mxi]); + (COND_CASES_TAC); + (COND_CASES_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + (NEW_GOAL `F`); + + (ABBREV_TAC `zl:(real^3)list = truncate_simplex 2 vl`); + (NEW_GOAL `hl zl = dist (omega_list V zl,HD zl)`); + (MATCH_MP_TAC WAUFCHE2); + (EXISTS_TAC `2` THEN REWRITE_TAC[IN] THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (EXPAND_TAC "zl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ASM_REAL_ARITH_TAC); + + (ABBREV_TAC `wl:(real^3)list = truncate_simplex 2 ul`); + (NEW_GOAL `hl wl <= dist (omega_list V wl,HD wl)`); + (MATCH_MP_TAC WAUFCHE1); + (EXISTS_TAC `2` THEN REWRITE_TAC[IN] THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "wl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (UP_ASM_TAC THEN + REWRITE_WITH `omega_list V wl = omega_list_n V ul 2/\ HD wl = HD ul`); + (EXPAND_TAC "wl"); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.OMEGA_LIST_LEMMA); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_2; HD]); + + (UNDISCH_TAC `hl zl = dist (omega_list V zl,HD zl)`); + (REWRITE_WITH `omega_list V zl = omega_list_n V vl 2/\ HD zl = HD vl`); + (EXPAND_TAC "zl"); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.OMEGA_LIST_LEMMA); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[ASSUME `vl = [v0;v1;v2;v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_2; HD]); + (REWRITE_WITH `omega_list_n V ul 2 = omega_list_n V vl 2/\ HD ul = HD vl`); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC THEN ARITH_TAC); + + (REWRITE_WITH `HD (ul:(real^3)list) = HD (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_WITH `HD (vl:(real^3)list) = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + + (ABBREV_TAC `zl:(real^3)list = truncate_simplex 2 ul`); + (NEW_GOAL `hl zl = dist (omega_list V zl,HD zl)`); + (MATCH_MP_TAC WAUFCHE2); + (EXISTS_TAC `2` THEN REWRITE_TAC[IN] THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (EXPAND_TAC "zl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ASM_REAL_ARITH_TAC); + + (ABBREV_TAC `wl:(real^3)list = truncate_simplex 2 vl`); + (NEW_GOAL `hl wl <= dist (omega_list V wl,HD wl)`); + (MATCH_MP_TAC WAUFCHE1); + (EXISTS_TAC `2` THEN REWRITE_TAC[IN] THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "wl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (UP_ASM_TAC THEN + REWRITE_WITH `omega_list V wl = omega_list_n V vl 2/\ HD wl = HD vl`); + (EXPAND_TAC "wl"); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.OMEGA_LIST_LEMMA); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[ASSUME `vl = [v0;v1;v2;v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_2; HD]); + + (UNDISCH_TAC `hl zl = dist (omega_list V zl,HD zl)`); + (REWRITE_WITH `omega_list V zl = omega_list_n V ul 2/\ HD zl = HD ul`); + (EXPAND_TAC "zl"); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.OMEGA_LIST_LEMMA); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_2; HD]); + (REWRITE_WITH `omega_list_n V ul 2 = omega_list_n V vl 2/\ HD ul = HD vl`); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC THEN ARITH_TAC); + + (REWRITE_WITH `HD (ul:(real^3)list) = HD (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_WITH `HD (vl:(real^3)list) = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `omega_list_n V ul 2 = omega_list_n V vl 2`); + (FIRST_ASSUM MATCH_MP_TAC THEN ARITH_TAC); + (REWRITE_WITH `omega_list_n V ul 3 = omega_list_n V vl 3`); + (FIRST_ASSUM MATCH_MP_TAC THEN ARITH_TAC); + + (REWRITE_WITH `HD (ul:(real^3)list) = HD (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_WITH `HD (vl:(real^3)list) = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[ASSUME + `truncate_simplex 1 (ul:(real^3)list) = truncate_simplex 1 vl`]); + + (SIMP_TAC[ASSUME `k = 2`; MCELL_EXPLICIT; mcell2]); + (COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_TAC[ASSUME + `truncate_simplex 1 (ul:(real^3)list) = truncate_simplex 1 vl`]); + (REPEAT LET_TAC); + (REWRITE_TAC[ASSUME `mxi V ul = mxi V vl`]); + (REWRITE_WITH `omega_list_n V ul 3 = omega_list_n V vl 3`); + (FIRST_ASSUM MATCH_MP_TAC THEN ARITH_TAC); + (ASM_REWRITE_TAC[HD;TL]); + + (NEW_GOAL `{u0, u1} = {v0, v1:real^3}`); + (REWRITE_WITH `{u0,u1:real^3} = set_of_list(truncate_simplex 1 ul)`); + (REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1; + ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_WITH `{v0,v1:real^3} = set_of_list(truncate_simplex 1 vl)`); + (ASM_REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1]); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `u0 = v0:real^3`); + (NEW_GOAL `u1 = v1:real^3`); + (NEW_GOAL `~(u0 = u1:real^3)`); + (STRIP_TAC); + (NEW_GOAL `LENGTH (truncate_simplex 1 (ul:(real^3)list)) = 1 + 1 /\ + CARD (set_of_list (truncate_simplex 1 ul)) = 1 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + (UP_ASM_TAC THEN REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1; + ASSUME `ul = [u0;u1;u2;u3:real^3]`; ASSUME `u0 = u1:real^3`; + SET_RULE `{a,a} = {a}`; Geomdetail.CARD_SING; ARITH_RULE `~(1 = 1 + 1)`]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `u0 = v1:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (NEW_GOAL `u1 = v0:real^3`); + (DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[GSYM (ASSUME + `truncate_simplex 1 ul = truncate_simplex 1 (vl:(real^3)list)`)]); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + +(* ========================================================================= *) +(* Case k = 1 *) + + (ASM_CASES_TAC `k = 1`); + (NEW_GOAL `sqrt (&2) <= hl (ul:(real^3)list)`); + (UNDISCH_TAC `~(mcell k V ul = {})` THEN + SIMP_TAC[ASSUME `k = 1`; MCELL_EXPLICIT;mcell1]); + (MESON_TAC[]); + + (NEW_GOAL `!i. 0 <= i /\ i <= 3 + ==> omega_list_n V ul i = omega_list_n V vl i`); + (MATCH_MP_TAC NJIUTIU); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `HD ul = HD (vl:(real^3)list)`); + (MATCH_MP_TAC ROGERS_INTER_V_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `HD ul IN set_of_list (ul:(real^3)list)`); + (MATCH_MP_TAC Packing3.BARV_IMP_HD_IN_SET_OF_LIST); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list (ul:(real^3)list) SUBSET V`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (REWRITE_WITH `rogers V vl (HD ul) <=> HD ul IN rogers V vl`); + (REWRITE_TAC[IN]); + (REWRITE_TAC[GSYM (ASSUME `rogers V ul = rogers V vl`)]); + (REWRITE_WITH + `rogers V ul = + convex hull + {HD ul, omega_list_n V ul 1, omega_list_n V ul 2, omega_list_n V ul 3}`); + (MATCH_MP_TAC ROGERS_EXPLICIT); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (SET_TAC[]); + + (NEW_GOAL `sqrt (&2) <= hl (vl:(real^3)list)`); + (REWRITE_TAC[ARITH_RULE `a <= b <=> (b < a ==> F)`]); + (STRIP_TAC); + (NEW_GOAL `hl vl = dist (omega_list V vl,HD vl)`); + (MATCH_MP_TAC WAUFCHE2); + (EXISTS_TAC `3` THEN REWRITE_TAC[IN] THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `hl ul <= dist (omega_list V ul,HD ul)`); + (MATCH_MP_TAC WAUFCHE1); + (EXISTS_TAC `3` THEN REWRITE_TAC[IN] THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN + REWRITE_WITH `omega_list V ul = omega_list V vl /\ HD ul = HD vl`); + (STRIP_TAC); + (ASM_REWRITE_TAC[OMEGA_LIST; LENGTH]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`); + GSYM (ASSUME `vl = [v0;v1;v2;v3:real^3]`)]); + (FIRST_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (ASM_CASES_TAC `hl (truncate_simplex 1 (ul:(real^3)list)) < sqrt (&2)`); + (NEW_GOAL `truncate_simplex 1 (ul:(real^3)list) = truncate_simplex 1 vl`); + (MATCH_MP_TAC TEZFFSK); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + + (SIMP_TAC[ASSUME `k = 1`; MCELL_EXPLICIT; mcell1]); + (COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_TAC[ASSUME + `truncate_simplex 1 (ul:(real^3)list) = truncate_simplex 1 vl`; + ASSUME `HD ul = HD (vl:(real^3)list)`; ASSUME `rogers V ul = rogers V vl`]); + (REWRITE_WITH `HD (TL ul) = EL 1 (truncate_simplex 1 (ul:(real^3)list))`); + (REWRITE_TAC[ASSUME + `ul = [u0;u1;u2;u3:real^3]`;TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `1 = SUC 0`]); + (REWRITE_WITH `HD (TL vl) = EL 1 (truncate_simplex 1 (vl:(real^3)list))`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `1 = SUC 0`]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + + (NEW_GOAL `sqrt (&2) <= hl (truncate_simplex 1 (ul:(real^3)list))`); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `sqrt (&2) <= hl (truncate_simplex 1 (vl:(real^3)list))`); + (REWRITE_TAC[ARITH_RULE `a <= b <=> (b < a ==> F)`]); + (STRIP_TAC); + (ABBREV_TAC `zl = truncate_simplex 1 (vl:(real^3)list)`); + (NEW_GOAL `hl zl = dist (omega_list V zl,HD zl)`); + (MATCH_MP_TAC WAUFCHE2); + (EXISTS_TAC `1` THEN REWRITE_TAC[IN] THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "zl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + + (ABBREV_TAC `wl = truncate_simplex 1 (ul:(real^3)list)`); + (NEW_GOAL `hl wl <= dist (omega_list V wl,HD wl)`); + (MATCH_MP_TAC WAUFCHE1); + (EXISTS_TAC `1` THEN REWRITE_TAC[IN] THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "wl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + + (UP_ASM_TAC THEN + REWRITE_WITH `omega_list V wl = omega_list_n V ul 1 /\ HD wl = HD ul`); + (STRIP_TAC); + (EXPAND_TAC "wl"); + (MATCH_MP_TAC Packing3.OMEGA_LIST_LEMMA); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (EXPAND_TAC "wl"); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (UNDISCH_TAC `hl zl = dist (omega_list V zl,HD zl)` THEN + REWRITE_WITH `omega_list V zl = omega_list_n V vl 1 /\ HD zl = HD vl`); + (STRIP_TAC); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.OMEGA_LIST_LEMMA); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (REWRITE_WITH `omega_list_n V ul 1 = omega_list_n V vl 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + (REWRITE_TAC[ASSUME `HD (ul:(real^3)list) = HD (vl:(real^3)list)`]); + (ASM_REAL_ARITH_TAC); + + (SIMP_TAC[ASSUME `k = 1`; MCELL_EXPLICIT; mcell1]); + (COND_CASES_TAC); + (COND_CASES_TAC); + + (REWRITE_WITH + `rcone_gt (HD (ul:(real^3)list)) (HD (TL ul)) + (hl (truncate_simplex 1 ul) / sqrt (&2)) = {}`); + (MATCH_MP_TAC RCONE_GT_EQ_EMPTY_LEMMA); + (ONCE_REWRITE_TAC[REAL_ARITH `a >= b <=> b <= a`]); + (REWRITE_WITH `&1 <= hl (truncate_simplex 1 (ul:(real^3)list)) / sqrt (&2) + <=> &1 * sqrt (&2) <= hl (truncate_simplex 1 ul)`); + (MATCH_MP_TAC REAL_LE_RDIV_EQ); + (MATCH_MP_TAC SQRT_POS_LT); + (ARITH_TAC); + (REWRITE_TAC[REAL_MUL_LID] THEN ASM_REAL_ARITH_TAC); + + (REWRITE_WITH + `rcone_gt (HD (vl:(real^3)list)) (HD (TL vl)) + (hl (truncate_simplex 1 vl) / sqrt (&2)) = {}`); + (MATCH_MP_TAC RCONE_GT_EQ_EMPTY_LEMMA); + (ONCE_REWRITE_TAC[REAL_ARITH `a >= b <=> b <= a`]); + (REWRITE_WITH `&1 <= hl (truncate_simplex 1 (vl:(real^3)list)) / sqrt (&2) + <=> &1 * sqrt (&2) <= hl (truncate_simplex 1 vl)`); + (MATCH_MP_TAC REAL_LE_RDIV_EQ); + (MATCH_MP_TAC SQRT_POS_LT); + (ARITH_TAC); + (REWRITE_TAC[REAL_MUL_LID] THEN ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + +(* ========================================================================= *) +(* Case k = 0 *) + + (NEW_GOAL `k = 0`); + (ASM_SET_TAC[]); + (SIMP_TAC[ASSUME `k = 0`; MCELL_EXPLICIT; mcell0]); + (REWRITE_TAC[ASSUME `rogers V ul = rogers V vl`]); + + (NEW_GOAL `!i. 0 <= i /\ i <= 3 + ==> omega_list_n V ul i = omega_list_n V vl i`); + (MATCH_MP_TAC NJIUTIU); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `HD ul = HD (vl:(real^3)list)`); + (MATCH_MP_TAC ROGERS_INTER_V_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `HD ul IN set_of_list (ul:(real^3)list)`); + (MATCH_MP_TAC Packing3.BARV_IMP_HD_IN_SET_OF_LIST); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list (ul:(real^3)list) SUBSET V`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (REWRITE_WITH `rogers V vl (HD ul) <=> HD ul IN rogers V vl`); + (REWRITE_TAC[IN]); + (REWRITE_TAC[GSYM (ASSUME `rogers V ul = rogers V vl`)]); + (REWRITE_WITH + `rogers V ul = + convex hull + {HD ul, omega_list_n V ul 1, omega_list_n V ul 2, omega_list_n V ul 3}`); + (MATCH_MP_TAC ROGERS_EXPLICIT); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (SET_TAC[])]);; + + +end;; diff --git a/text_formalization/packing/EMNWUUS.hl b/text_formalization/packing/EMNWUUS.hl new file mode 100755 index 0000000..e460645 --- /dev/null +++ b/text_formalization/packing/EMNWUUS.hl @@ -0,0 +1,526 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: EMNWUUS *) +(* Chaper : Packing (Marchal Cells) *) +(* Date : October 3, 2010 *) +(* *) +(* ========================================================================= *) +(* +#use "/usr/programs/hollight/hollight-svn75/hol.ml";; +loads "Multivariate/flyspeck.ml";; +#use "/home/ky/flyspeck/working/boot.hl";; +flyspeck_needs "trigonometry/trig1.hl";; +flyspeck_needs "trigonometry/trig2.hl";; +flyspeck_needs "trigonometry/trigonometry.hl";; + +(* ================= Loaded files ======================================== *) + +flyspeck_needs "leg/collect_geom.hl";; +flyspeck_needs "fan/fan_defs.hl";; +flyspeck_needs "fan/introduction.hl";; +flyspeck_needs "fan/topology.hl";; +flyspeck_needs "fan/fan_misc.hl";; +flyspeck_needs "fan/HypermapAndFan.hl";; +flyspeck_needs "packing/pack_defs.hl";; +flyspeck_needs "packing/pack_concl.hl";; +flyspeck_needs "packing/pack1.hl";; +flyspeck_needs "packing/pack2.hl";; +flyspeck_needs "packing/pack3.hl";; +flyspeck_needs "packing/Rogers.hl";; +flyspeck_needs "nonlinear/vukhacky_tactics.hl";; +*) +(* ====================== Open appropriate files ============================ *) +flyspeck_needs "packing/marchal_cells.hl";; + +module Emnwuus = struct + +open Rogers;; +open Prove_by_refinement;; +open Vukhacky_tactics;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Sphere;; +open Marchal_cells;; + +let seans_fn () = +let (tms,tm) = top_goal () in +let vss = map frees (tm::tms) in +let vs = setify (flat vss) in +map dest_var vs;; + +(* ======================= Begin working ==================================== *) +(* ========================================================================= *) + +let EMNWUUS1 = prove_by_refinement ( EMNWUUS1_concl, +[ (REWRITE_TAC[mcell4] THEN REPEAT STRIP_TAC THEN EQ_TAC THEN COND_CASES_TAC); + (REPEAT STRIP_TAC); + (NEW_GOAL `set_of_list (ul:(real^3)list) = {}`); + (ASM_MESON_TAC[CONVEX_HULL_EQ_EMPTY]); + (NEW_GOAL `ul:(real^3)list = []`); + (NEW_GOAL `~(?h t. ul:(real^3)list = CONS h t)`); + STRIP_TAC; + (NEW_GOAL `(h:real^3) IN set_of_list ul`); + (REWRITE_TAC [ASSUME `ul = CONS (h:real^3) t`; IN_SET_OF_LIST;MEM]); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[list_CASES]); + (UNDISCH_TAC `barV V 3 (ul:(real^3)list)`); + (REWRITE_TAC[BARV]); + STRIP_TAC; + (NEW_GOAL `LENGTH (ul:(real^3)list) = 0`); + (ASM_MESON_TAC[ASSUME `ul:(real^3)list =[]`;LENGTH]); + (ASM_ARITH_TAC); + (MESON_TAC[]); + (MESON_TAC[]); + (MESON_TAC[]) ]);; + + +(* ========================================================================= *) + +let EMNWUUS2 = prove_by_refinement (EMNWUUS2_concl, +[ (REPEAT GEN_TAC THEN STRIP_TAC); +(EQ_TAC); + +(REPEAT STRIP_TAC); +(* Break into 4 cases *) + +(* =============== Case 1 ================================ *) + +(REWRITE_TAC[mcell0]); +(REWRITE_TAC[SET_RULE `x DIFF y = {} <=> (!a. a IN x ==> a IN y)`]); +(REWRITE_TAC[ROGERS;IMAGE;IN;ball;SUBSET;IN_ELIM_THM]); + GEN_TAC; +(MATCH_MP_TAC BALL_CONVEX_HULL_LEMMA); + +(GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM]); +(STRIP_TAC); + + (* New_subgoal 1.1 *) +(NEW_GOAL `hl (truncate_simplex x' (ul:(real^3)list)) + <= hl (truncate_simplex (LENGTH ul - 1) ul)`); +(ASM_CASES_TAC `x' < LENGTH (ul:(real^3)list) - 1`); +(MATCH_MP_TAC (REAL_ARITH `a < b ==> a <= b`)); +(NEW_GOAL `x' < (LENGTH (ul:(real^3)list) - 1) /\ LENGTH ul - 1 <= 3`); +(ASM_REWRITE_TAC[] THEN UNDISCH_TAC `barV V 3 ul`); +(REWRITE_TAC[BARV] THEN ARITH_TAC); +(UP_ASM_TAC); +(NEW_GOAL `ul IN barV V 3`); +(ASM_MESON_TAC[IN]); +(ASM_MESON_TAC[XNHPWAB4; ARITH_RULE `3 <= 3`]); +(MATCH_MP_TAC (REAL_ARITH `a = b ==> a <= b`)); +(REWRITE_WITH `LENGTH (ul:(real^3)list) - 1 = x'`); +(ASM_ARITH_TAC); + (* End subgoal 1.1 *) + + (* New subgoal 1.2 *) +(NEW_GOAL `hl (truncate_simplex (LENGTH ul - 1) ul) = hl (ul:(real^3)list)`); +(AP_TERM_TAC); +(REWRITE_TAC[TRUNCATE_SIMPLEX]); +(MATCH_MP_TAC SELECT_UNIQUE); +(GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM;INITIAL_SUBLIST] THEN EQ_TAC); +STRIP_TAC; +(NEW_GOAL `LENGTH (ul:(real^3)list) = + LENGTH (y:(real^3)list) + LENGTH (yl:(real^3)list)`); +(ASM_MESON_TAC[LENGTH_APPEND]); +(NEW_GOAL `LENGTH (yl:(real^3)list) = 0`); +(ASM_ARITH_TAC); +(NEW_GOAL `(yl:(real^3)list) = []`); +(ASM_MESON_TAC[LENGTH_EQ_NIL]); +(ASM_MESON_TAC[APPEND_NIL]); +(REPEAT STRIP_TAC); +(ASM_REWRITE_TAC[]); +(ASM_ARITH_TAC); +(EXISTS_TAC `[]:(real^3)list`); +(ASM_MESON_TAC[APPEND_NIL]); + (* End subgoal 1.2 *) + + (* New subgoal 1.3 *) + +(NEW_GOAL `?u0 u1 u2 u3:real^3. ul = [u0;u1;u2;u3]`); +(ASM_MESON_TAC[BARV_3_EXPLICIT]); +(REPEAT (FIRST_X_ASSUM CHOOSE_TAC)); +(REWRITE_TAC[ASSUME `ul = [u0:real^3; u1; u2; u3]`; HD]); + + (* ---------------------------------------------- *) + (* Consider case x' = 0 *) + +(ASM_CASES_TAC `x' = 0`); +(REWRITE_WITH `x:real^3 = u0`); +(MP_TAC (ASSUME `x:real^3 = omega_list_n V ul x'`)); +(ASM_MESON_TAC[OMEGA_LIST_0_EXPLICIT; GSYM IN]); +(ASM_REWRITE_TAC[DIST_REFL]); +(MESON_TAC[SQRT_LT_0;REAL_ARITH `&0 <= &2 /\ &0 < &2`]); + + (* ---------------------------------------------- *) + (* Consider case x' = 1 *) + +(ASM_CASES_TAC `x' = 1`); +(REWRITE_WITH `x:real^3 = circumcenter {u0, u1}`); +(MP_TAC (ASSUME `x:real^3 = omega_list_n V ul x'`)); +(ASM_MESON_TAC[OMEGA_LIST_1_EXPLICIT; GSYM IN]); +(ONCE_REWRITE_TAC[DIST_SYM]); +(REWRITE_WITH `dist (circumcenter {u0:real^3, u1},u0) + = hl (truncate_simplex x' (ul:(real^3)list))`); +(ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1;HL;radV]); +(ONCE_REWRITE_TAC[EQ_SYM_EQ]); +(MATCH_MP_TAC SELECT_UNIQUE); +(GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM; MESON[set_of_list] + `set_of_list [u0:real^3;u1] = {u0, u1}`] THEN EQ_TAC); +(DISCH_TAC THEN (FIRST_ASSUM MATCH_MP_TAC)); +(SUBGOAL_THEN `(u0:real^3) IN {u0, u1}` ASSUME_TAC); +(SET_TAC[]); +(ASM_MESON_TAC[IN]); +(REPEAT STRIP_TAC); +(NEW_GOAL `w IN {u0,u1:real^3}`); +(UP_ASM_TAC THEN MESON_TAC[IN]); +(NEW_GOAL + `(!w. w IN {u0,u1:real^3} ==> radV {u0,u1} = dist (circumcenter {u0,u1},w))`); +(MATCH_MP_TAC OAPVION2); +(REWRITE_TAC[AFFINE_INDEPENDENT_2]); +(ASM_REWRITE_TAC[]); +(NEW_GOAL `(radV {u0,u1:real^3} = dist (circumcenter {u0,u1},w))`); +(ASM_SIMP_TAC[]); +(NEW_GOAL `(radV {u0,u1:real^3} = dist (circumcenter {u0,u1},u0))`); +(FIRST_ASSUM MATCH_MP_TAC); +(SET_TAC[]); +(ASM_MESON_TAC[]); +(ASM_REAL_ARITH_TAC); + + (* ---------------------------------------------- *) + (* Consider case x' = 2 *) + +(ASM_CASES_TAC `x' = 2`); +(REWRITE_WITH `x:real^3 = circumcenter {u0, u1, u2}`); +(MP_TAC (ASSUME `x:real^3 = omega_list_n V ul x'`)); +(ASM_MESON_TAC[OMEGA_LIST_2_EXPLICIT; GSYM IN]); +(ONCE_REWRITE_TAC[DIST_SYM]); +(REWRITE_WITH `dist (circumcenter {u0:real^3, u1, u2},u0) + = hl (truncate_simplex x' (ul:(real^3)list))`); +(ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2;HL;radV]); +(ONCE_REWRITE_TAC[EQ_SYM_EQ]); +(MATCH_MP_TAC SELECT_UNIQUE); +(GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM; MESON[set_of_list] + `set_of_list [u0:real^3;u1;u2] = {u0, u1, u2}`] THEN EQ_TAC); +(DISCH_TAC THEN (FIRST_ASSUM MATCH_MP_TAC)); +(SUBGOAL_THEN `(u0:real^3) IN {u0, u1, u2}` ASSUME_TAC); +(SET_TAC[]); +(ASM_MESON_TAC[IN]); +(REPEAT STRIP_TAC); +(NEW_GOAL `w IN {u0,u1:real^3,u2}`); +(UP_ASM_TAC THEN MESON_TAC[IN]); +(NEW_GOAL `(!w. w IN {u0,u1:real^3, u2} ==> + radV {u0,u1,u2} = dist (circumcenter {u0,u1,u2},w))`); +(MATCH_MP_TAC OAPVION2); +(MATCH_MP_TAC AFFINE_INDEPENDENT_SUBSET); +(EXISTS_TAC `{u0, u1, u2, u3:real^3}`); +(REWRITE_TAC[SET_RULE `{a, b:A, c} SUBSET {a, b , c, d:A}`]); +(REWRITE_TAC[AFFINE_INDEPENDENT_IFF_CARD]); +STRIP_TAC; +(REWRITE_TAC[FINITE_SET_OF_LIST; MESON[set_of_list] + `{u0, u1, u2,u3} = set_of_list [u0;u1;u2:real^3;u3]`]); +(NEW_GOAL `aff_dim {u0,u1,u2,u3:real^3} = &3`); +(REWRITE_TAC[MESON[set_of_list] + `{u0, u1, u2,u3} = set_of_list [u0;u1;u2:real^3;u3]`]); +(MATCH_MP_TAC MHFTTZN1); +(EXISTS_TAC `V:real^3->bool`); +(ASM_MESON_TAC[ARITH_RULE `3 <= 3`]); +(ONCE_ASM_REWRITE_TAC[]); +(NEW_GOAL `FINITE {u1, u2, u3:real^3}`); +(REWRITE_TAC[FINITE_SET_OF_LIST; MESON[set_of_list] + `{u1, u2,u3} = set_of_list [u1;u2:real^3;u3]`]); +(MATCH_MP_TAC (ARITH_RULE + `(a = int_of_num 4) ==> (int_of_num 3 = a - int_of_num 1)`)); +(MATCH_MP_TAC (ARITH_RULE `a = b ==> int_of_num a = int_of_num b`)); +(NEW_GOAL `CARD {u0:real^3, u1, u2, u3} = + (if u0 IN {u1, u2, u3} then CARD {u1, u2, u3} + else SUC (CARD {u1, u2, u3} ))`); +(UP_ASM_TAC THEN REWRITE_TAC[CARD_CLAUSES]); +(UP_ASM_TAC THEN COND_CASES_TAC); +(DISCH_TAC); +(NEW_GOAL `aff_dim {u0:real^3, u1, u2, u3} < &3`); +(REWRITE_WITH `{u0,u1,u2,u3:real^3} = {u1, u2,u3}`); +(ONCE_REWRITE_TAC[EQ_SYM_EQ]); +(NEW_GOAL `CARD {u1, u2, u3} = CARD {u0, u1, u2, u3} <=> + {u1, u2, u3:real^3} = {u0, u1, u2, u3}`); +(MATCH_MP_TAC SUBSET_CARD_EQ); +(STRIP_TAC); +(REWRITE_TAC[MESON[set_of_list] + `{u0, u1, u2, u3:real^3} = set_of_list [u0;u1;u2;u3]`;FINITE_SET_OF_LIST]); +(SET_TAC[]); +(ASM_MESON_TAC[]); + +(REWRITE_TAC[MESON[set_of_list] + `{u1:real^3,u2, u3} = set_of_list [u1;u2;u3]`]); +(MATCH_MP_TAC AFF_DIM_LE_LENGTH); +(REWRITE_TAC[LENGTH]); +(ARITH_TAC); +(NEW_GOAL `F`); +(ASM_MESON_TAC[ARITH_RULE `a = int_of_num 3 /\ a < int_of_num 3 ==> F`]); +(ASM_MESON_TAC[]); + STRIP_TAC; +(NEW_GOAL `CARD {u1:real^3, u2, u3} = 3`); +(NEW_GOAL `CARD {u1,u2,u3:real^3} <= 3`); +(MATCH_MP_TAC (ARITH_RULE + `a <= LENGTH [u1;u2;u3:real^3] /\ LENGTH [u1;u2;u3:real^3] <= b ==> a <= b`)); + STRIP_TAC; +(REWRITE_TAC[MESON[set_of_list] + `{u1,u2,u3:real^3} = set_of_list [u1;u2;u3]`;CARD_SET_OF_LIST_LE]); +(REWRITE_TAC[LENGTH] THEN ARITH_TAC); +(ASM_CASES_TAC `CARD {u1:real^3, u2, u3} <= 2`); +(NEW_GOAL `CARD {u0,u1,u2,u3:real^3} <= 3`); +(NEW_GOAL `CARD {u0:real^3, u1, u2, u3} = + (if u0 IN {u1,u2,u3} then CARD {u1,u2,u3} else SUC (CARD {u1,u2,u3}))`); +(NEW_GOAL `FINITE {u1,u2,u3:real^3}`); +(REWRITE_TAC[MESON[set_of_list] + `{u1,u2,u3:real^3} = set_of_list [u1;u2;u3]`;FINITE_SET_OF_LIST]); +(ASM_REWRITE_TAC[CARD_CLAUSES]); +(UP_ASM_TAC THEN COND_CASES_TAC); +(ASM_ARITH_TAC); +(ASM_ARITH_TAC); +(ABBREV_TAC `xl = list_of_set {u0, u1, u2, u3:real^3}`); + + +(NEW_GOAL `aff_dim {u0:real^3, u1, u2, u3} + < int_of_num (CARD {u0, u1, u2, u3})`); +(REWRITE_WITH `{u0,u1,u2,u3:real^3} = set_of_list (xl:(real^3)list)`); +(EXPAND_TAC "xl"); +(ONCE_REWRITE_TAC[EQ_SYM_EQ]); +(MATCH_MP_TAC SET_OF_LIST_OF_SET); +(REWRITE_TAC[MESON[set_of_list] + `{u0, u1, u2, u3:real^3} = set_of_list [u0;u1;u2;u3]`;FINITE_SET_OF_LIST]); +(MATCH_MP_TAC AFF_DIM_LE_LENGTH); +(REWRITE_WITH `set_of_list (xl:(real^3)list) = {u0, u1, u2, u3:real^3}`); +(EXPAND_TAC "xl"); +(MATCH_MP_TAC SET_OF_LIST_OF_SET); +(REWRITE_TAC[MESON[set_of_list] + `{u0,u1,u2,u3:real^3} = set_of_list [u0;u1;u2;u3]`;FINITE_SET_OF_LIST]); +(EXPAND_TAC "xl"); +(MATCH_MP_TAC LENGTH_LIST_OF_SET); +(REWRITE_TAC[MESON[set_of_list] + `{u0,u1,u2,u3:real^3} = set_of_list [u0;u1;u2;u3]`;FINITE_SET_OF_LIST]); +(NEW_GOAL `F`); +(ASM_ARITH_TAC); +(ASM_MESON_TAC[]); +(ASM_ARITH_TAC); + ASM_ARITH_TAC; +(MATCH_MP_TAC (REAL_ARITH + `radV {u0,u1,u2:real^3} = a /\ radV {u0,u1,u2} = b ==> a = b`)); + STRIP_TAC; +(ASM_REWRITE_TAC[]); +(FIRST_ASSUM MATCH_MP_TAC); +(SET_TAC[]); +(FIRST_ASSUM MATCH_MP_TAC); +(ASM_REWRITE_TAC[]); +(ASM_REAL_ARITH_TAC); + + (* ---------------------------------------------- *) + (* Consider case x' = 3 *) + +(ASM_CASES_TAC `x' = 3`); +(REWRITE_WITH `x = circumcenter {u0,u1,u2,u3:real^3}`); +(ASM_REWRITE_TAC[]); +(MATCH_MP_TAC OMEGA_LIST_3_EXPLICIT); +(ASM_MESON_TAC[GSYM IN]); +(NEW_GOAL `dist (u0,circumcenter {u0:real^3, u1, u2, u3}) + = hl (ul:(real^3)list)`); +(ASM_REWRITE_TAC[HL]); +(REWRITE_WITH `set_of_list [u0:real^3; u1; u2; u3] = {u0,u1,u2,u3}`); +(MESON_TAC[set_of_list]); + +(NEW_GOAL `(!w. w IN {u0,u1:real^3, u2,u3} ==> + radV {u0,u1,u2,u3} = dist (circumcenter {u0,u1,u2,u3},w))`); +(MATCH_MP_TAC OAPVION2); +(REWRITE_TAC[AFFINE_INDEPENDENT_IFF_CARD]); + STRIP_TAC; +(REWRITE_TAC[FINITE_SET_OF_LIST; MESON[set_of_list] + `{u0, u1, u2,u3} = set_of_list [u0;u1;u2:real^3;u3]`]); +(NEW_GOAL `aff_dim {u0,u1,u2,u3:real^3} = &3`); +(REWRITE_TAC[MESON[set_of_list] + `{u0, u1, u2,u3} = set_of_list [u0;u1;u2:real^3;u3]`]); +(MATCH_MP_TAC MHFTTZN1); +(EXISTS_TAC `V:real^3->bool`); +(ASM_MESON_TAC[ARITH_RULE `3 <= 3`]); +(ONCE_ASM_REWRITE_TAC[]); +(MATCH_MP_TAC (ARITH_RULE + `(a = int_of_num 4) ==> (int_of_num 3 = a - int_of_num 1)`)); +(MATCH_MP_TAC (ARITH_RULE `a = b ==> int_of_num a = int_of_num b`)); + +(NEW_GOAL `FINITE {u1, u2, u3:real^3}`); +(REWRITE_TAC[FINITE_SET_OF_LIST; MESON[set_of_list] + `{u1, u2,u3} = set_of_list [u1;u2:real^3;u3]`]); +(NEW_GOAL `CARD {u0:real^3, u1, u2, u3} = + (if u0 IN {u1, u2, u3} then CARD {u1, u2, u3} + else SUC (CARD {u1, u2, u3} ))`); +(UP_ASM_TAC THEN REWRITE_TAC[CARD_CLAUSES]); +(UP_ASM_TAC THEN COND_CASES_TAC); +(DISCH_TAC); +(NEW_GOAL `aff_dim {u0:real^3, u1, u2, u3} < &3`); +(REWRITE_WITH `{u0,u1,u2,u3:real^3} = {u1, u2,u3}`); +(ONCE_REWRITE_TAC[EQ_SYM_EQ]); +(NEW_GOAL `CARD {u1, u2, u3} = CARD {u0, u1, u2, u3} <=> + {u1, u2, u3:real^3} = {u0, u1, u2, u3}`); +(MATCH_MP_TAC SUBSET_CARD_EQ); +(STRIP_TAC); +(REWRITE_TAC[MESON[set_of_list] + `{u0, u1, u2, u3:real^3} = set_of_list [u0;u1;u2;u3]`;FINITE_SET_OF_LIST]); +(SET_TAC[]); (* check *) +(ASM_MESON_TAC[]); + +(REWRITE_TAC[MESON[set_of_list] + `{u1:real^3,u2, u3} = set_of_list [u1;u2;u3]`]); +(MATCH_MP_TAC AFF_DIM_LE_LENGTH); +(REWRITE_TAC[LENGTH]); +(ARITH_TAC); +(NEW_GOAL `F`); +(ASM_MESON_TAC[ARITH_RULE `a = int_of_num 3 /\ a < int_of_num 3 ==> F`]); +(ASM_MESON_TAC[]); + STRIP_TAC; +(NEW_GOAL `CARD {u1:real^3, u2, u3} = 3`); +(NEW_GOAL `CARD {u1,u2,u3:real^3} <= 3`); +(MATCH_MP_TAC (ARITH_RULE + `a <= LENGTH [u1;u2;u3:real^3] /\ LENGTH [u1;u2;u3:real^3] <= b ==> a <= b`)); + STRIP_TAC; +(REWRITE_TAC[MESON[set_of_list] + `{u1,u2,u3:real^3} = set_of_list [u1;u2;u3]`;CARD_SET_OF_LIST_LE]); +(REWRITE_TAC[LENGTH] THEN ARITH_TAC); +(ASM_CASES_TAC `CARD {u1:real^3, u2, u3} <= 2`); +(NEW_GOAL `CARD {u0,u1,u2,u3:real^3} <= 3`); +(NEW_GOAL `CARD {u0:real^3, u1, u2, u3} = + (if u0 IN {u1,u2,u3} then CARD {u1,u2,u3} else SUC (CARD {u1,u2,u3}))`); +(NEW_GOAL `FINITE {u1,u2,u3:real^3}`); +(REWRITE_TAC[MESON[set_of_list] + `{u1,u2,u3:real^3} = set_of_list [u1;u2;u3]`;FINITE_SET_OF_LIST]); +(ASM_REWRITE_TAC[CARD_CLAUSES]); +(UP_ASM_TAC THEN COND_CASES_TAC); +(ASM_ARITH_TAC); +(ASM_ARITH_TAC); +(ABBREV_TAC `xl = list_of_set {u0, u1, u2, u3:real^3}`); + + +(NEW_GOAL `aff_dim {u0:real^3, u1, u2, u3} + < int_of_num (CARD {u0, u1, u2, u3})`); +(REWRITE_WITH `{u0,u1,u2,u3:real^3} = set_of_list (xl:(real^3)list)`); +(EXPAND_TAC "xl"); +(ONCE_REWRITE_TAC[EQ_SYM_EQ]); +(MATCH_MP_TAC SET_OF_LIST_OF_SET); +(REWRITE_TAC[MESON[set_of_list] + `{u0, u1, u2, u3:real^3} = set_of_list [u0;u1;u2;u3]`;FINITE_SET_OF_LIST]); +(MATCH_MP_TAC AFF_DIM_LE_LENGTH); +(REWRITE_WITH `set_of_list (xl:(real^3)list) = {u0, u1, u2, u3:real^3}`); +(EXPAND_TAC "xl"); +(MATCH_MP_TAC SET_OF_LIST_OF_SET); +(REWRITE_TAC[MESON[set_of_list] + `{u0,u1,u2,u3:real^3} = set_of_list [u0;u1;u2;u3]`;FINITE_SET_OF_LIST]); +(EXPAND_TAC "xl"); +(MATCH_MP_TAC LENGTH_LIST_OF_SET); +(REWRITE_TAC[MESON[set_of_list] + `{u0,u1,u2,u3:real^3} = set_of_list [u0;u1;u2;u3]`;FINITE_SET_OF_LIST]); +(NEW_GOAL `F`); +(ASM_ARITH_TAC); +(ASM_MESON_TAC[]); +(ASM_ARITH_TAC); + ASM_ARITH_TAC; +(MATCH_MP_TAC (REAL_ARITH + `radV {u0,u1,u2:real^3,u3} = a /\ radV {u0,u1,u2,u3} = b ==> a = b`)); + STRIP_TAC; +(ONCE_REWRITE_TAC[DIST_SYM] THEN FIRST_ASSUM MATCH_MP_TAC); +(SET_TAC[]); +(MESON_TAC[]); + +(ASM_MESON_TAC[]); + +(* --------------------------------------------- *) + +(UNDISCH_TAC `barV V 3 (ul:(real^3)list)`); +(REWRITE_TAC[BARV]); +(STRIP_TAC); +(NEW_GOAL `F`); +(ASM_ARITH_TAC); +(ASM_MESON_TAC[]); + +(* +Here we have finished the first part `mcell0 V ul = {}`;there are 3 parts left: +mcell1 V ul = {} +mcell2 V ul = {} +mcell3 V ul = {} +*) + +(* =============== Case 2 =================================== *) + +(REWRITE_TAC[mcell1]); +(COND_CASES_TAC); +(NEW_GOAL `F`); +(UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); +(UP_ASM_TAC THEN MESON_TAC[]); +(REWRITE_TAC[]); + +(* =============== Case 3 =================================== *) +(REWRITE_TAC[mcell2]); +(COND_CASES_TAC); +(NEW_GOAL `F`); +(UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); +(UP_ASM_TAC THEN MESON_TAC[]); +(REWRITE_TAC[]); + +(* =============== Case 4 =================================== *) + +(REWRITE_TAC[mcell3]); +(COND_CASES_TAC); +(NEW_GOAL `F`); +(ASM_REAL_ARITH_TAC); +(ASM_MESON_TAC[]); +(MESON_TAC[]); + + +(* =============== Reverse part =============================== *) + +(REPEAT STRIP_TAC); +(ASM_CASES_TAC `hl (ul:(real^3)list) >= sqrt (&2)`); +(NEW_GOAL `omega_list V (ul:(real^3)list) IN mcell0 V ul`); +(REWRITE_TAC[mcell0; IN_DIFF;ROGERS]); +(STRIP_TAC); +(NEW_GOAL`LENGTH (ul:(real^3)list) = 4`); +(NEW_GOAL `?u0 u1 u2 u3:real^3. ul = [u0; u1; u2; u3]`); +(MATCH_MP_TAC BARV_3_EXPLICIT); +(EXISTS_TAC `V:real^3->bool`); +(ASM_REWRITE_TAC[]); +(FIRST_X_ASSUM CHOOSE_TAC); +(FIRST_X_ASSUM CHOOSE_TAC); +(FIRST_X_ASSUM CHOOSE_TAC); +(FIRST_X_ASSUM CHOOSE_TAC); +(ASM_REWRITE_TAC[LENGTH]); +(ARITH_TAC); +(ASM_REWRITE_TAC[OMEGA_LIST; ARITH_RULE `4 - 1 = 3`]); +(REWRITE_TAC[IMAGE; CONVEX_HULL_EXPLICIT; IN; IN_ELIM_THM]); +(EXISTS_TAC `{omega_list_n V (ul:(real^3)list) 3}`); +(ABBREV_TAC `u = (\x:real^3. &1 )`); + +(EXISTS_TAC `(\x:real^3. &1)`); +(REPEAT STRIP_TAC); +(MESON_TAC[FINITE_SING]); +(REWRITE_TAC[SUBSET;IN;IN_ELIM_THM; Geomdetail.IN_ACT_SING]); +(GEN_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[]); +(EXISTS_TAC `3`); +(ASM_REWRITE_TAC[ARITH_RULE `3 < 4`]); +(REWRITE_TAC[BETA_THM]); +(REAL_ARITH_TAC); +(REWRITE_TAC[SUM_SING]); +(REWRITE_TAC[VSUM_SING]); +(VECTOR_ARITH_TAC); +(REWRITE_TAC[IN; ball; IN_ELIM_THM]); +(ONCE_REWRITE_TAC[DIST_SYM]); +(MATCH_MP_TAC (REAL_ARITH `x <= y ==> ~(y < x)`)); +(MATCH_MP_TAC (REAL_ARITH `hl (ul:(real^3)list) >= x /\ hl ul <= z ==> x <= z`)); +(ASM_REWRITE_TAC[]); +(MATCH_MP_TAC WAUFCHE1); +(EXISTS_TAC `3`); +(ASM_REWRITE_TAC[IN]); +(NEW_GOAL `F`); +(UP_ASM_TAC THEN UNDISCH_TAC `mcell0 V (ul:(real^3)list) = {}`); +(SET_TAC[]); +(UP_ASM_TAC THEN MESON_TAC[]); +(UP_ASM_TAC THEN REAL_ARITH_TAC)]);; + +end;; diff --git a/text_formalization/packing/GRUTOTI.hl b/text_formalization/packing/GRUTOTI.hl new file mode 100755 index 0000000..bbf415e --- /dev/null +++ b/text_formalization/packing/GRUTOTI.hl @@ -0,0 +1,8005 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: GRUTOTI *) +(* Chaper : Packing *) +(* Date : March 14, 2012 *) +(* *) +(* ========================================================================= *) +(* *) +(* flyspeck_needs "packing/marchal_cells_3.hl";; *) +(* *) +(* ========================================================================= *) + +module Grutoti = struct + +open Sphere;; +open Euler_main_theorem;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Pack2;; +open Packing3;; +open Rogers;; +open Vukhacky_tactics;; +open Marchal_cells;; +open Emnwuus;; +(* open Marchal_cells_2;; *) +open Marchal_cells_2_new;; +open Urrphbz1;; +open Lepjbdj;; +open Hdtfnfz;; +open Rvfxzbu;; +open Sltstlo;; +open Urrphbz2;; +open Urrphbz3;; +open Ynhyjit;; +open Njiutiu;; +open Tezffsk;; +open Qzksykg;; +open Ddzuphj;; +open Ajripqn;; +open Qzyzmjc;; +open Upfzbzm_support_lemmas;; + + open Marchal_cells_3;; + +let GRUTOTI1_concl = +`!V u0 u1 e. + saturated V /\ + packing V /\ + u0 IN V /\ + u1 IN V /\ + ~(u0 = u1) /\ + hl [u0;u1] < sqrt (&2) /\ + e = {u0, u1} + ==> sum {X | mcell_set V X /\ e IN edgeX V X } (\t. dihX V t (u0,u1)) = + &2 * pi`;; + +let GRUTOTI = prove_by_refinement (GRUTOTI1_concl, +[(REPEAT STRIP_TAC); + (NEW_GOAL `barV V 1 [u0;u1:real^3]`); + (MATCH_MP_TAC HL_LE_SQRT2_IMP_BARV_1); + (ASM_REWRITE_TAC[]); + (NEW_GOAL + `{k | k IN 1..3 /\ + voronoi_list V [u0;u1:real^3] = + UNIONS + {convex hull + ({omega_list_n V vl i | i IN 1..k - 1} UNION + voronoi_list V vl) | vl | barV V k vl /\ + truncate_simplex 1 vl = [u0;u1]}} = + 1..3`); + (MATCH_MP_TAC Rogers.GLTVHUM_lemma1); + (ASM_REWRITE_TAC[] THEN ARITH_TAC); + (NEW_GOAL + `3 IN {k | k IN 1..3 /\ + voronoi_list V [u0; u1] = + UNIONS + {convex hull + ({omega_list_n V vl i | i IN 1..k - 1} UNION voronoi_list V vl) | vl | + barV V k vl /\ + truncate_simplex 1 vl = [u0; u1]}}`); + (ASM_REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC); + (UP_ASM_TAC THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (REWRITE_WITH + `UNIONS + {convex hull ({omega_list_n V vl i | i IN 1..3 - 1} UNION voronoi_list V vl) | vl | barV V 3 vl /\ + truncate_simplex 1 vl = [u0; u1]} = + UNIONS {convex hull {omega_list_n V vl 1, omega_list_n V vl 2, + omega_list_n V vl 3} | vl | barV V 3 vl /\ + truncate_simplex 1 vl = [u0; u1]}`); + (ONCE_REWRITE_TAC[SET_EQ_LEMMA]); + (REWRITE_TAC[IN_UNIONS] THEN ONCE_REWRITE_TAC[IN] THEN + REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `t:real^3->bool` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?a. voronoi_list V vl = {a} /\ + a = circumcenter (set_of_list vl) /\ + hl vl = dist (HD vl,a)`); + (MATCH_MP_TAC Marchal_cells_2_new.VORONOI_LIST_3_SINGLETON_EXPLICIT); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `omega_list_n V vl 3 IN voronoi_list V vl`); + (REWRITE_WITH `omega_list_n V vl 3 = omega_list V vl`); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `(3 + 1) - 1 = 3`]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `omega_list_n V vl 3 = a`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; IN_NUMSEG; + ARITH_RULE `1 <= i /\ i <= 2 <=> i = 1 \/ i = 2`]); + (REWRITE_WITH `{omega_list_n V vl i | i = 1 \/ i = 2} = + {omega_list_n V vl 1,omega_list_n V vl 2}`); + (SET_TAC[]); + (REWRITE_WITH `{omega_list_n V vl 1, omega_list_n V vl 2} UNION + {circumcenter (set_of_list vl)} = {omega_list_n V vl 1, omega_list_n V vl 2, circumcenter (set_of_list vl)}`); + (SET_TAC[]); + + (EXISTS_TAC `t:real^3->bool` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?a. voronoi_list V vl = {a} /\ + a = circumcenter (set_of_list vl) /\ + hl vl = dist (HD vl,a)`); + (MATCH_MP_TAC Marchal_cells_2_new.VORONOI_LIST_3_SINGLETON_EXPLICIT); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `omega_list_n V vl 3 IN voronoi_list V vl`); + (REWRITE_WITH `omega_list_n V vl 3 = omega_list V vl`); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `(3 + 1) - 1 = 3`]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `omega_list_n V vl 3 = a`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; IN_NUMSEG; + ARITH_RULE `1 <= i /\ i <= 2 <=> i = 1 \/ i = 2`]); + (REWRITE_WITH `{omega_list_n V vl i | i = 1 \/ i = 2} = + {omega_list_n V vl 1,omega_list_n V vl 2}`); + (SET_TAC[]); + (REWRITE_WITH `{omega_list_n V vl 1, omega_list_n V vl 2} UNION + {circumcenter (set_of_list vl)} = {omega_list_n V vl 1, omega_list_n V vl 2, + circumcenter (set_of_list vl)}`); + (SET_TAC[]); + (STRIP_TAC); + +(* ======================================================================= *) + + (ABBREV_TAC `p = circumcenter {u0, u1:real^3}`); + (NEW_GOAL `aff_dim (u0 INSERT voronoi_list V [u0;u1]) = &3`); + (REWRITE_TAC[AFF_DIM_INSERT]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + + (NEW_GOAL `affine hull voronoi_list V [u0; u1] SUBSET + affine hull {x | &2 % (u0 - u1) dot x = norm u0 pow 2 - norm u1 pow 2}`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA); + (REWRITE_TAC[VORONOI_LIST; set_of_list; Packing3.VORONOI_SET_2]); + (ONCE_REWRITE_TAC[SET_RULE `a INTER b = b INTER a`]); + (ASM_SIMP_TAC[Pack2.INTER_VORONOI_SUBSET_BISECTOR]); + (NEW_GOAL + `affine hull {x | &2 % (u0 - u1) dot x = norm u0 pow 2 - norm u1 pow 2} = + {x:real^3 | &2 % (u0 - u1) dot x = norm u0 pow 2 - norm u1 pow 2}`); + (REWRITE_TAC[AFFINE_HULL_EQ]); + (REWRITE_TAC[AFFINE_HYPERPLANE]); + (NEW_GOAL + `~(u0 IN {x:real^3 | &2 % (u0 - u1) dot x = norm u0 pow 2 - norm u1 pow 2})`); + (REWRITE_TAC[IN; IN_ELIM_THM; NORM_POW_2]); + (ONCE_REWRITE_TAC [REAL_ARITH `a = b <=> a - b = &0`]); + (REWRITE_TAC[VECTOR_ARITH `&2 % (u0 - u1) dot u0 - (u0 dot u0 - u1 dot u1) = + (u0 - u1) dot (u0 - u1)`]); + (REWRITE_TAC[DOT_EQ_0] THEN ASM_NORM_ARITH_TAC); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[ARITH_RULE `a + &1 = b:int <=> a = b - &1`]); + (MATCH_MP_TAC Packing3.AFF_DIM_VORONOI_LIST); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `aff_dim (u0 INSERT voronoi_list V [u0; u1]) = &(dimindex (:3))`); + (ASM_REWRITE_TAC[DIMINDEX_3]); + (UP_ASM_TAC THEN REWRITE_TAC[AFF_DIM_EQ_FULL]); + (STRIP_TAC); + + (ABBREV_TAC `S = voronoi_list V [u0;u1]`); + (NEW_GOAL `!x. x IN S ==> (x - u0) dot (u1 - u0) = + dist (p, u0) * dist (u1, u0:real^3)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `p = inv (&2) % (u0 + (u1:real^3))`); + (EXPAND_TAC "p" THEN REWRITE_TAC[Rogers.CIRCUMCENTER_2; midpoint]); + (REWRITE_TAC[dist]); + (REWRITE_WITH `u1 - u0 = &2 % (p - u0:real^3)`); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; REAL_ARITH `abs (&2) = &2`; + REAL_ARITH `a * b * a = b * a pow 2`; NORM_POW_2; DOT_RMUL]); + (REWRITE_WITH `(x - u0) dot (p - u0:real^3) = + (p - u0) dot (p - u0) - (x - p) dot (u0 - p)`); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `(x - p) dot (u0 - p:real^3) = &0`); + (EXPAND_TAC "p"); + (REWRITE_WITH `{u0, u1} = set_of_list [u0; u1:real^3]`); + (REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `S SUBSET affine hull voronoi_list V [u0; u1]`); + (EXPAND_TAC "S"); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (ASM_SET_TAC[]); + (REWRITE_TAC[set_of_list]); + (NEW_GOAL `{u0,u1} SUBSET affine hull {u0,u1:real^3}`); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (ASM_SET_TAC[]); + (REAL_ARITH_TAC); + +(* ========================================================================= *) + + (ABBREV_TAC `S1 = {x:real^3 | &2 % (u0 - u1) dot x = + norm u0 pow 2 - norm u1 pow 2}`); + (ABBREV_TAC `S2:real^3->bool = (S1 DIFF (relative_interior S))`); + (NEW_GOAL `closed_in (subtopology euclidean (S1:real^3->bool)) S2`); + (EXPAND_TAC "S2"); + (MATCH_MP_TAC CLOSED_IN_DIFF); + (STRIP_TAC); + (NEW_GOAL `closed (S1:real^3->bool)`); + (EXPAND_TAC "S1" THEN REWRITE_TAC[CLOSED_HYPERPLANE]); + (MATCH_MP_TAC CLOSED_SUBSET); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + + (REWRITE_WITH `S1 = affine hull (S:real^3->bool)`); + (EXPAND_TAC "S"); + (NEW_GOAL `affine hull S1 = S1:real^3->bool`); + (REWRITE_TAC[AFFINE_HULL_EQ]); + (EXPAND_TAC "S1" THEN REWRITE_TAC[AFFINE_HYPERPLANE]); + (ONCE_REWRITE_TAC[GSYM (ASSUME `affine hull S1 = S1:real^3->bool`)]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC AFF_DIM_EQ_AFFINE_HULL); + (STRIP_TAC); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `INTERS {f x | x IN {a, b}} = f a INTER f b`]); + (DEL_TAC THEN EXPAND_TAC "S1"); + (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `aff_dim (S1:(real^3->bool)) = &(dimindex (:3)) - &1`); + (DEL_TAC THEN EXPAND_TAC "S1"); + (MATCH_MP_TAC AFF_DIM_HYPERPLANE); + (REWRITE_TAC[VECTOR_ARITH `&2 % (s - t) = vec 0 <=> s = t`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[DIMINDEX_3]); + (REWRITE_WITH `aff_dim (voronoi_list V [u0;u1:real^3]) = &3 - &1`); + (MATCH_MP_TAC Packing3.AFF_DIM_VORONOI_LIST); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_TAC[OPEN_IN_RELATIVE_INTERIOR]); + + (NEW_GOAL `closed (S2:real^3->bool)`); + (MATCH_MP_TAC CLOSED_IN_CLOSED_TRANS); + (EXISTS_TAC `S1:real^3->bool`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "S1"); + (REWRITE_TAC[CLOSED_HYPERPLANE]); + + + (NEW_GOAL `~(S2:real^3->bool = {})`); + (EXPAND_TAC "S2"); + (REWRITE_TAC [SET_RULE `A DIFF B = {} <=> A SUBSET B`]); + (REPEAT STRIP_TAC); + (NEW_GOAL `S1 SUBSET S:real^3->bool`); + (NEW_GOAL `relative_interior S SUBSET S:real^3->bool`); + (REWRITE_TAC[RELATIVE_INTERIOR_SUBSET]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `S1 = S:real^3->bool`); + (NEW_GOAL `S SUBSET S1:real^3->bool`); + (EXPAND_TAC "S"); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `INTERS {f x | x IN {a, b}} = f a INTER f b`]); + (EXPAND_TAC "S1"); + (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `bounded (S1:real^3->bool)`); + (REWRITE_TAC[ASSUME `S1 = S:real^3->bool`]); + (DEL_TAC THEN EXPAND_TAC "S"); + (MATCH_MP_TAC Packing3.BOUNDED_VORONOI_LIST); + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `~bounded (S1:real^3->bool)`); + (EXPAND_TAC "S1"); + (MATCH_MP_TAC UNBOUNDED_HYPERPLANE); + (REWRITE_TAC[VECTOR_ARITH `&2 % (u0 - u1) = vec 0 <=> u0 = u1`]); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `?z:real^3. z IN S2 /\ + (!w. w IN S2 ==> dist (u0,z) <= dist (u0,w))`); + (MATCH_MP_TAC DISTANCE_ATTAINS_INF); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + +(* ======================================================================== *) + + (ABBREV_TAC `a = dist (p, u0:real^3) / dist (z, u0)`); + (NEW_GOAL `&0 < a /\ a < &1`); + (EXPAND_TAC "a"); + (NEW_GOAL `~(u0:real^3 IN S1)`); + (EXPAND_TAC "S1" THEN REWRITE_TAC[IN; IN_ELIM_THM; NORM_POW_2]); + (REWRITE_TAC[REAL_ARITH `a = b - c <=> a + c - b = &0`]); + (REWRITE_TAC[VECTOR_ARITH `&2 % (u0 - u1) dot u0 + u1 dot u1 - u0 dot u0 = + (u0 - u1) dot (u0 - u1)`]); + (REWRITE_TAC[DOT_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `&0 < dist (p,u0:real^3)`); + (MATCH_MP_TAC DIST_POS_LT); + (EXPAND_TAC "p" THEN REWRITE_TAC[Rogers.CIRCUMCENTER_2; midpoint]); + (REWRITE_TAC[VECTOR_ARITH `inv (&2) % (u0 + u1) = u0 <=> u0 = u1`]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `&0 < dist (z,u0:real^3)`); + (MATCH_MP_TAC DIST_POS_LT); + (STRIP_TAC); + (NEW_GOAL `z:real^3 IN S1`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LT_DIV); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH + `dist (p,u0) / dist (z,u0:real^3) < &1 <=> dist (p,u0) < &1 * dist (z,u0)`); + (ASM_SIMP_TAC[REAL_LT_LDIV_EQ]); + (REWRITE_TAC[REAL_MUL_LID]); + (MATCH_MP_TAC Tactics_jordan.REAL_POW_2_LT); + (REPEAT STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[dist]); + (REWRITE_WITH `norm (z - u0:real^3) pow 2 = + norm (p - u0) pow 2 + norm (z - p) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (REWRITE_WITH `p = circumcenter (set_of_list [u0;u1:real^3])`); + (ASM_REWRITE_TAC[set_of_list]); + (ONCE_REWRITE_TAC[DOT_SYM]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ASSUME `voronoi_list V [u0; u1] = S`]); + (REWRITE_WITH `affine hull (S:real^3->bool) = S1`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (EXPAND_TAC "S"); + (NEW_GOAL `affine hull S1 = S1:real^3->bool`); + (REWRITE_TAC[AFFINE_HULL_EQ]); + (EXPAND_TAC "S1" THEN REWRITE_TAC[AFFINE_HYPERPLANE]); + (ONCE_REWRITE_TAC[GSYM (ASSUME `affine hull S1 = S1:real^3->bool`)]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC AFF_DIM_EQ_AFFINE_HULL); + (STRIP_TAC); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `INTERS {f x | x IN {a, b}} = f a INTER f b`]); + (DEL_TAC THEN EXPAND_TAC "S1"); + (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `aff_dim (S1:(real^3->bool)) = &(dimindex (:3)) - &1`); + (DEL_TAC THEN EXPAND_TAC "S1"); + (MATCH_MP_TAC AFF_DIM_HYPERPLANE); + (REWRITE_TAC[VECTOR_ARITH `&2 % (s - t) = vec 0 <=> s = t`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[DIMINDEX_3]); + (REWRITE_WITH `aff_dim (voronoi_list V [u0;u1:real^3]) = &3 - &1`); + (MATCH_MP_TAC Packing3.AFF_DIM_VORONOI_LIST); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[set_of_list]); + (NEW_GOAL `{u0, u1:real^3} SUBSET affine hull {u0, u1}`); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (ASM_SET_TAC[]); + (REWRITE_TAC[REAL_ARITH `a < a + b <=> &0 < b`; NORM_POW_2; DOT_POS_LT]); + (REWRITE_TAC[VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (STRIP_TAC); + (NEW_GOAL `~(z:real^3 IN S2)`); + (REWRITE_TAC[ASSUME `z = p:real^3`]); + (EXPAND_TAC "S2"); + (NEW_GOAL `p:real^3 IN relative_interior S`); + + + + (ABBREV_TAC `B = V INTER ball (p:real^3, &8)`); + (ABBREV_TAC `A = B DIFF {u0, u1:real^3}`); + (NEW_GOAL `FINITE (A:real^3->bool)`); + (EXPAND_TAC "A"); + (MATCH_MP_TAC FINITE_DIFF); + (EXPAND_TAC "B"); + (MATCH_MP_TAC Packing3.KIUMVTC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `?y. dist (p,y:real^3) = &4`); + (MATCH_MP_TAC VECTOR_CHOOSE_DIST); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + (UNDISCH_TAC `saturated (V:real^3->bool)`); + (REWRITE_TAC[saturated] THEN STRIP_TAC); + (NEW_GOAL `?z. z IN V /\ dist (y:real^3, z) < &2`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `z':real^3 IN A`); + (EXPAND_TAC "A" THEN EXPAND_TAC "B"); + (REWRITE_TAC[IN_DIFF; IN_INTER; IN_BALL]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `dist (p,z') <= dist (p, y) + dist (y, z':real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `dist (p, y) <= dist (p, z') + dist (z', y:real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[DIST_SYM]); + (STRIP_TAC); + (NEW_GOAL `&2 < dist (z', p:real^3)`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[] THEN ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_WITH `p = circumcenter (set_of_list [u0;u1:real^3])`); + (ASM_MESON_TAC[set_of_list]); + (NEW_GOAL `(!w. w IN set_of_list [u0;u1:real^3] + ==> dist (circumcenter (set_of_list [u0;u1]),w) = hl [u0;u1])`); + (MATCH_MP_TAC Rogers.HL_PROPERTIES); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `dist (circumcenter (set_of_list [u0; u1:real^3]),z') = + hl [u0; u1]`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[set_of_list]); + (NEW_GOAL `sqrt (&2) <= &2`); + (MATCH_MP_TAC Tactics_jordan.REAL_POW_2_LE); + (SIMP_TAC[REAL_ARITH `&0 <= &2`; SQRT_POS_LE; SQRT_POW_2]); + (REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `?a:real^3. a IN A /\ (!x. x IN A ==> dist (p,a) <= dist (p,x))`); + (MATCH_MP_TAC Packing3.REAL_FINITE_ARGMIN); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + + (ABBREV_TAC `d = inv (&4) * (dist (p, a') - dist (p, u0:real^3))`); + (NEW_GOAL `&0 < d`); + (EXPAND_TAC "d"); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&0 < a - b <=> a > b`]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (NEW_GOAL `!u v. u IN {u0,u1} /\ v IN V DIFF {u0,u1} ==> + dist (v,p) > dist (u,p:real^3)`); + (MATCH_MP_TAC Rogers.XYOFCGX); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[AFFINE_INDEPENDENT_2]); + (ASM_MESON_TAC[set_of_list]); + (REWRITE_WITH `radV {u0, u1:real^3} = hl [u0;u1]`); + (REWRITE_TAC[HL;set_of_list]); + (ASM_REWRITE_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + + (REWRITE_TAC[relative_interior; IN; IN_ELIM_THM]); + (ABBREV_TAC `St = S INTER ball (p:real^3, d)`); + (EXISTS_TAC `St:real^3->bool`); + (REPEAT STRIP_TAC); + + (REWRITE_TAC[open_in]); + (REPEAT STRIP_TAC); + (NEW_GOAL `S SUBSET affine hull (S:real^3->bool)`); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (EXISTS_TAC `d - dist (p:real^3, x)`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 < a - b <=> b < a`]); + (REWRITE_TAC[GSYM IN_BALL]); + (ASM_SET_TAC[]); + (EXPAND_TAC "St"); + (REWRITE_TAC[IN_INTER]); + (STRIP_TAC); + + + (NEW_GOAL `dist (x',x:real^3) < d`); + (NEW_GOAL `&0 <= dist (p,x:real^3)`); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `x' IN voronoi_closed V (u0:real^3)`); + (REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (ASM_CASES_TAC `w IN {u0, u1:real^3}`); + (ASM_CASES_TAC `w = u0:real^3`); + (REWRITE_TAC[ASSUME `w = u0:real^3`]); + (REAL_ARITH_TAC); + (NEW_GOAL `w = u1:real^3`); + (ASM_SET_TAC[]); + (REWRITE_TAC[ASSUME `w = u1:real^3`]); + (MATCH_MP_TAC (REAL_ARITH `a = b ==> a <= b`)); + + (NEW_GOAL `x':real^3 IN S1`); + (NEW_GOAL `affine hull S SUBSET affine hull (S1:real^3->bool)`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA); + (EXPAND_TAC "S1" THEN REWRITE_TAC[GSYM + (ASSUME `voronoi_list V [u0; u1] = S`); VORONOI_LIST; VORONOI_SET; + set_of_list; SET_RULE `INTERS {f v | v IN {a, b}} = f a INTER f b`]); + (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `x' IN S1 <=> x':real^3 IN affine hull S1`); + (REWRITE_WITH `affine hull S1 = S1:real^3->bool`); + (REWRITE_TAC[AFFINE_HULL_EQ]); + (EXPAND_TAC "S1" THEN REWRITE_TAC[AFFINE_HYPERPLANE]); + (ASM_SET_TAC[]); + + (UP_ASM_TAC THEN EXPAND_TAC "S1" THEN REWRITE_TAC[IN_ELIM_THM; NORM_POW_2]); + (ONCE_REWRITE_TAC[REAL_ARITH `a = b <=> a - b = &0`]); + (REWRITE_TAC[ + VECTOR_ARITH `&2 % (u0 - u1) dot x - (u0 dot u0 - u1 dot u1) = + (u1 - x) dot (u1 - x) - (u0 - x) dot (u0 - x)`]); + (REWRITE_TAC[REAL_ARITH `a - b = &0 <=> a = b`; GSYM NORM_POW_2; GSYM dist]); + (STRIP_TAC); + (REWRITE_TAC[DIST_EQ]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `dist (x', u0:real^3) <= dist (x', x) + dist (x, u0)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (x, u0:real^3) <= dist (x, p:real^3) + dist (p, u0)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (x,p:real^3) < d`); + (NEW_GOAL `x IN ball (p:real^3, d)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL]); + (REWRITE_TAC[DIST_SYM]); + (NEW_GOAL `dist (x',u0) < &2 * d + dist (p:real^3,u0)`); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `dist (p, w:real^3)- &2 * d <= dist (x',w)`); + (NEW_GOAL `dist (x, w:real^3) <= dist (x, x') + dist (x', w)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (p, w:real^3) <= dist (p, x) + dist (x, w)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (x, x':real^3) < d /\ dist (p, x:real^3) < d`); + (ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `dist (p, u0) + &4 * d <= dist (p, w:real^3)`); + (EXPAND_TAC "d"); + (REWRITE_TAC[REAL_ARITH `&4 * inv (&4) * a = a`]); + (REWRITE_TAC[REAL_ARITH `a + b - a = b`]); + + (ASM_CASES_TAC `w:real^3 IN B`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (NEW_GOAL `~(dist (p,w:real^3) < &8)`); + (REWRITE_TAC[GSYM IN_BALL]); + (ASM_SET_TAC[]); + (NEW_GOAL `dist (p,a':real^3) < &8`); + (REWRITE_TAC[GSYM IN_BALL]); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + + (NEW_GOAL `x' IN voronoi_closed V (u1:real^3)`); + (NEW_GOAL `x':real^3 IN S1`); + (NEW_GOAL `affine hull S SUBSET affine hull (S1:real^3->bool)`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA); + (EXPAND_TAC "S1" THEN REWRITE_TAC[GSYM + (ASSUME `voronoi_list V [u0; u1] = S`); VORONOI_LIST; VORONOI_SET; + set_of_list; SET_RULE `INTERS {f v | v IN {a, b}} = f a INTER f b`]); + (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `x' IN S1 <=> x':real^3 IN affine hull S1`); + (REWRITE_WITH `affine hull S1 = S1:real^3->bool`); + (REWRITE_TAC[AFFINE_HULL_EQ]); + (EXPAND_TAC "S1" THEN REWRITE_TAC[AFFINE_HYPERPLANE]); + (ASM_SET_TAC[]); + + (UP_ASM_TAC THEN EXPAND_TAC "S1" THEN REWRITE_TAC[IN_ELIM_THM; NORM_POW_2]); + (ONCE_REWRITE_TAC[REAL_ARITH `a = b <=> a - b = &0`]); + (REWRITE_TAC[ + VECTOR_ARITH `&2 % (u0 - u1) dot x - (u0 dot u0 - u1 dot u1) = + (u1 - x) dot (u1 - x) - (u0 - x) dot (u0 - x)`]); + (REWRITE_TAC[REAL_ARITH `a - b = &0 <=> a = b`; GSYM NORM_POW_2; GSYM dist]); + (STRIP_TAC); + (UNDISCH_TAC `x' IN voronoi_closed V (u0:real^3)`); + (REWRITE_TAC[voronoi_closed; IN_ELIM_THM; IN]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `dist (x', u1)= dist (x', u0:real^3)`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[DIST_EQ]); + (ASM_SIMP_TAC[]); + + (REWRITE_TAC[GSYM + (ASSUME `voronoi_list V [u0; u1] = S`); VORONOI_LIST; VORONOI_SET; + set_of_list; SET_RULE `INTERS {f v | v IN {a, b}} = f a INTER f b`]); + (ASM_REWRITE_TAC[IN_INTER]); + + (REWRITE_TAC[IN_BALL]); + (NEW_GOAL `dist (p,x':real^3) <= dist (p,x) + dist (x, x':real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (x,x':real^3) = dist (x',x)`); + (REWRITE_TAC[DIST_SYM]); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `St p <=> p:real^3 IN St`); + (REWRITE_TAC[IN]); + (EXPAND_TAC "St" THEN REWRITE_TAC[IN_INTER; IN_BALL; DIST_REFL]); + (STRIP_TAC); + (REWRITE_WITH `p = omega_list V [u0; u1]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `p = circumcenter (set_of_list [u0;u1:real^3])`); + (ASM_MESON_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[IN]); + (REWRITE_TAC[GSYM (ASSUME `voronoi_list V [u0;u1] = S`)]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `1` THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + +(* ======================================================================== *) + + (NEW_GOAL `?b. &0 < b /\ b < &1 /\ + rcone_gt u0 u1 b SUBSET aff_ge_alt {u0:real^3} S`); + + (EXISTS_TAC `a:real`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `A SUBSET B <=> (!x. ~(x IN B) ==> ~(x IN A))`]); + (REPEAT STRIP_TAC); + (NEW_GOAL `x:real^3 IN affine hull (u0 INSERT S)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[AFFINE_HULL_EXPLICIT_ALT; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (ABBREV_TAC `h = sum (s DELETE u0:real^3) u`); + (NEW_GOAL `(x - u0) dot (u1 - u0:real^3) = + h * dist (p, u0) * dist (u1, u0:real^3)`); + (EXPAND_TAC "x"); + (NEW_GOAL `u0 = vsum s (\v:real^3. (u:real^3->real) v % (u0:real^3))`); + (ASM_SIMP_TAC[VSUM_RMUL]); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `vsum (s:real^3->bool) (\v. u v % v) - u0:real^3 = + vsum s (\v. u v % v) - vsum s (\v:real^3. u v % u0)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_WITH `vsum s (\v. u v % v) - vsum s (\v:real^3. u v % u0:real^3) = + vsum s (\x. (\v. u v % v) x - (\v. u v % u0) x)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC VSUM_SUB); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_ARITH `a % x - a % y = a % (x - y)`]); + (REWRITE_WITH `vsum s (\x:real^3. u x % (x - u0)) dot (u1 - u0) = + sum s (\x. (\x. u x % (x - u0)) x dot (u1 - u0:real^3))`); + (ASM_SIMP_TAC[DOT_LSUM]); + (REWRITE_TAC[DOT_LMUL]); + (REWRITE_WITH `sum s (\x:real^3. u x * ((x - u0) dot (u1 - u0:real^3))) = + sum (s DELETE u0) (\x. u x * (dist (p,u0) * dist (u1,u0)))`); + (ASM_CASES_TAC `u0:real^3 IN s`); + (NEW_GOAL `s = u0 INSERT (s DELETE u0:real^3)`); + (ASM_SET_TAC[]); + (NEW_GOAL `FINITE (s DELETE u0:real^3)`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `s:real^3->bool` THEN ASM_REWRITE_TAC[] THEN SET_TAC[]); + + (REWRITE_WITH `sum s (\x:real^3. u x * ((x - u0) dot (u1 - u0:real^3))) = + sum (u0 INSERT (s DELETE u0)) (\x. u x * ((x - u0) dot (u1 - u0)))`); + (ASM_MESON_TAC[]); + (ABBREV_TAC `f = (\x:real^3. u x * ((x - u0) dot (u1 - u0:real^3)))`); + (REWRITE_WITH `sum (u0:real^3 INSERT (s DELETE u0)) f = + (if u0 IN (s DELETE u0) then sum (s DELETE u0) f + else f u0 + sum (s DELETE u0) f)`); + (MATCH_MP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt); + (ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_WITH `f (u0:real^3) = &0`); + (EXPAND_TAC "f"); + (REWRITE_TAC[VECTOR_ARITH `(u0 - u0) dot (u1 - u0) = &0`]); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&0 + a = a`]); + (MATCH_MP_TAC SUM_EQ); + (EXPAND_TAC "f"); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a * x = a * y * z <=> a * (x - y * z) = &0`]); + (NEW_GOAL `(x' - u0) dot (u1 - u0) - dist (p,u0) * dist (u1,u0:real^3) = &0`); + (REWRITE_TAC[REAL_ARITH `a - b = &0 <=> a = b`]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (REWRITE_WITH `s DELETE u0:real^3 = s`); + (ASM_SET_TAC[]); + (MATCH_MP_TAC SUM_EQ); + (REPEAT STRIP_TAC); + (REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `a * x = a * y * z <=> a * (x - y * z) = &0`]); + (NEW_GOAL `(x' - u0) dot (u1 - u0) - dist (p,u0) * dist (u1,u0:real^3) = &0`); + (REWRITE_TAC[REAL_ARITH `a - b = &0 <=> a = b`]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (NEW_GOAL `FINITE (s DELETE u0:real^3)`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `s:real^3->bool` THEN ASM_REWRITE_TAC[] THEN SET_TAC[]); + (ASM_SIMP_TAC[SUM_RMUL]); + + (ASM_CASES_TAC `h <= &0`); + (NEW_GOAL `~(x IN rcone_gt u0 (u1:real^3) a)`); + (REWRITE_TAC[rcone_gt; rconesgn; IN; IN_ELIM_THM]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (REAL_ARITH `&0 <= x /\ y <= &0 ==> ~(y > x)`)); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH `a * b * c <= &0 <=> &0 <= b * c * (--a)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (ABBREV_TAC `y = inv (h) % vsum (s DELETE u0) (\v:real^3. u v % v)`); + (NEW_GOAL `?t. t + h = &1 /\ x = t % u0 + h % (y:real^3)`); + (EXISTS_TAC `&1 - h`); + (STRIP_TAC); + (REAL_ARITH_TAC); + (ASM_CASES_TAC `u0:real^3 IN s`); + (REWRITE_TAC[GSYM (ASSUME `sum s (u:real^3->real) = &1`)]); + + (EXPAND_TAC "h"); + (REWRITE_WITH `sum s u = sum (u0 INSERT (s DELETE u0)) (u:real^3->real)`); + (REWRITE_WITH `(u0 INSERT (s DELETE u0:real^3)) = s`); + (ASM_SET_TAC[]); + (NEW_GOAL `FINITE (s DELETE u0:real^3)`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `s:real^3->bool` THEN ASM_REWRITE_TAC[] THEN SET_TAC[]); + + (SIMP_TAC[Marchal_cells_2_new.SUM_CLAUSES_alt; + ASSUME `FINITE (s DELETE u0:real^3)`]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[REAL_ARITH `(a + b:real) - b = a`]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_MUL_ASSOC]); + (REWRITE_WITH `h * inv h = &1`); + (NEW_GOAL `~(h = &0)`); + (ASM_REAL_ARITH_TAC); + (ASM_SIMP_TAC[Trigonometry2.REAL_MUL_LRINV]); + (REWRITE_TAC[VECTOR_MUL_LID]); + (EXPAND_TAC "x"); + + (REWRITE_WITH `vsum s (\v. u v % v) = + vsum (u0 INSERT (s DELETE u0)) (\v:real^3. u v % v)`); + (REWRITE_WITH `(u0 INSERT (s DELETE u0:real^3)) = s`); + (ASM_SET_TAC[]); + (SIMP_TAC[Marchal_cells_2_new.VSUM_CLAUSES_alt; + ASSUME `FINITE (s DELETE u0:real^3)`]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (REFL_TAC); + + (NEW_GOAL `h = &1`); + (EXPAND_TAC "h" THEN REWRITE_WITH `s DELETE u0:real^3 = s`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "y" THEN REWRITE_TAC[ASSUME `h = &1`]); + (REWRITE_WITH `s DELETE u0:real^3 = s`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[REAL_ARITH `inv (&1) = &1 /\ &1 - &1 = &0`]); + (VECTOR_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `~(y:real^3 IN S)`); + (STRIP_TAC); + (NEW_GOAL `x IN aff_ge_alt {u0:real^3} S`); + (REWRITE_TAC[IN; aff_ge_alt; lin_combo]); + + (ABBREV_TAC `f = (\v:real^3. if v = u0 then t + else if v = y then h else &0)`); + (EXISTS_TAC `f:real^3->real`); + (EXISTS_TAC `{y:real^3}`); + + (REPEAT STRIP_TAC); + (REWRITE_TAC[FINITE_SING]); + (ASM_SET_TAC[]); + + (REWRITE_TAC[SET_RULE `{a} UNION {b} = {a, b}`]); + (REWRITE_WITH `vsum {u0:real^3, y} (\v. f v % v) = + (\v. f v % v) u0 + (\v. f v % v) y`); + (MATCH_MP_TAC Geomdetail.VSUM_DIS2); + (STRIP_TAC); + (NEW_GOAL `~(u0:real^3 IN S)`); + (EXPAND_TAC "S"); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `v IN {a,b} <=> v = a \/ v = b`]); + (STRIP_TAC); + (NEW_GOAL `u0 IN voronoi_closed V (u1:real^3)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,u1) <= dist (u0,u0:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `(f:real^3->real) u0 = t`); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `(f:real^3->real) y = h`); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `~(u0:real^3 IN S)`); + (EXPAND_TAC "S"); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `v IN {a,b} <=> v = a \/ v = b`]); + (STRIP_TAC); + (NEW_GOAL `u0 IN voronoi_closed V (u1:real^3)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,u1) <= dist (u0,u0:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[]); + + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `~({y:real^3} u0)`); + (REWRITE_WITH `~({y} u0) <=> ~(u0:real^3 IN {y})`); + (MESON_TAC[IN]); + (REWRITE_TAC[IN_SING]); + (STRIP_TAC); + + (NEW_GOAL `~(u0:real^3 IN S)`); + (EXPAND_TAC "S"); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `v IN {a,b} <=> v = a \/ v = b`]); + (STRIP_TAC); + + (NEW_GOAL `u0 IN voronoi_closed V (u1:real^3)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,u1) <= dist (u0,u0:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (COND_CASES_TAC); + (ASM_REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (REWRITE_TAC[SET_RULE `{a} UNION {b} = {a,b}`]); + (REWRITE_WITH `sum {u0:real^3, y} f = f u0 + f y`); + (MATCH_MP_TAC Geomdetail.SUM_DIS2); + (STRIP_TAC); + (NEW_GOAL `~(u0:real^3 IN S)`); + (EXPAND_TAC "S"); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `v IN {a,b} <=> v = a \/ v = b`]); + (STRIP_TAC); + (NEW_GOAL `u0 IN voronoi_closed V (u1:real^3)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,u1) <= dist (u0,u0:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `(f:real^3->real) u0 = t`); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `(f:real^3->real) y = h`); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `~(u0:real^3 IN S)`); + (EXPAND_TAC "S"); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `v IN {a,b} <=> v = a \/ v = b`]); + (STRIP_TAC); + (NEW_GOAL `u0 IN voronoi_closed V (u1:real^3)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,u1) <= dist (u0,u0:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `y:real^3 IN S2`); + (EXPAND_TAC "S2"); + (NEW_GOAL `y:real^3 IN S1`); + (NEW_GOAL `y:real^3 IN affine hull S`); + (REWRITE_TAC[AFFINE_HULL_EXPLICIT_ALT]); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `s DELETE u0:real^3`); + (EXISTS_TAC `(\v:real^3. inv h * u v)`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[FINITE_DELETE]); + (ASM_SET_TAC[]); + (REWRITE_TAC[SUM_LMUL]); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[Trigonometry2.REAL_MUL_LRINV; + REAL_ARITH `~(h <= &0) ==> ~(h = &0)`]); + (REWRITE_TAC[GSYM VECTOR_MUL_ASSOC]); + (ASM_SIMP_TAC[VSUM_LMUL; FINITE_DELETE]); + (NEW_GOAL `affine hull S1 = S1:real^3->bool`); + (REWRITE_TAC[AFFINE_HULL_EQ]); + (EXPAND_TAC "S1" THEN REWRITE_TAC[AFFINE_HYPERPLANE]); + + (NEW_GOAL `affine hull S SUBSET affine hull (S1:real^3->bool)`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA); + (EXPAND_TAC "S"); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `INTERS {f x | x IN {a, b}} = f a INTER f b`]); + (DEL_TAC THEN EXPAND_TAC "S1"); + (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + + (NEW_GOAL `relative_interior S SUBSET S:real^3->bool`); + (REWRITE_TAC[RELATIVE_INTERIOR_SUBSET]); + (ASM_SET_TAC[]); + +(* OK until here *) +(* ========================================================================= *) + + (NEW_GOAL `dist (z,u0) <= dist (y,u0:real^3)`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ASM_SIMP_TAC[]); + (UNDISCH_TAC `x:real^3 IN rcone_gt u0 u1 a`); + (REWRITE_TAC[rcone_gt; rconesgn; IN; IN_ELIM_THM]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `dist (t % u0 + h % y,u0) = h * dist (y, u0:real^3)`); + (REWRITE_TAC[dist]); + (REWRITE_WITH `(t % u0 + h % y:real^3) - u0 = (t % u0 + h % y) - (t + h) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `(t % u0 + h % y) - (t + h) % u0 = h % (y - u0)`]); + (REWRITE_TAC[NORM_MUL]); + (REWRITE_WITH `abs h = h`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REAL_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH `~(a > b) <=> a <= b`]); + (REWRITE_WITH `h * dist (p,u0:real^3) * dist (u1,u0) = + (h * dist (z,u0)) * dist (u1,u0) * a`); + (EXPAND_TAC "a"); + (REWRITE_TAC[REAL_ARITH `(a * b) * c * d / b = (a * d * c) * (b / b)`]); + (REWRITE_WITH `dist (z,u0) / dist (z,u0:real^3) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[DIST_EQ_0]); + (STRIP_TAC); + + (NEW_GOAL `~(u0:real^3 IN S1)`); + (EXPAND_TAC "S1" THEN REWRITE_TAC[IN; IN_ELIM_THM; NORM_POW_2]); + (REWRITE_TAC[REAL_ARITH `a = b - c <=> a + c - b = &0`]); + (REWRITE_TAC[VECTOR_ARITH `&2 % (u0 - u1) dot u0 + u1 dot u1 - u0 dot u0 = + (u0 - u1) dot (u0 - u1)`]); + (REWRITE_TAC[DOT_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `z:real^3 IN S1`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH + `(a * x) * b * c <= (a * y) * b * c <=> &0 <= a * b * c *(y - x)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (UP_ASM_TAC THEN STRIP_TAC); + + (ABBREV_TAC `W = aff_ge_alt {u0:real^3} S`); + (ABBREV_TAC `c = max b (hl[u0;u1:real^3] / sqrt (&2))`); + (NEW_GOAL `&0 < c /\ c < &1`); + (EXPAND_TAC "c" THEN REWRITE_TAC[REAL_LT_MAX]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "c" THEN REWRITE_TAC[REAL_MAX_LT]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `hl [u0; u1:real^3] / sqrt (&2) < &1 <=> + hl [u0; u1] < &1 * sqrt (&2)`); + (MATCH_MP_TAC REAL_LT_LDIV_EQ); + (ASM_SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `rcone_gt u0 u1 c SUBSET + W INTER (rcone_gt u0 u1 (hl [u0; u1:real^3] / sqrt (&2)))`); + (REWRITE_TAC[SUBSET_INTER]); + (STRIP_TAC); + (NEW_GOAL `rcone_gt (u0:real^3) u1 c SUBSET rcone_gt u0 u1 b`); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "c" THEN REAL_ARITH_TAC); + (ASM_SET_TAC[]); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "c" THEN REAL_ARITH_TAC); + + (ABBREV_TAC `C = ball (u0:real^3,&1) INTER rcone_gt u0 u1 c`); + (NEW_GOAL `C SUBSET + UNIONS + {rogers V vl | vl | barV V 3 vl /\ truncate_simplex 1 vl = [u0; u1]}`); + (REWRITE_TAC[SUBSET]); + (REPEAT STRIP_TAC); + (NEW_GOAL `x IN ball (u0:real^3,&1) /\ x IN aff_ge_alt {u0} S`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + +(* OK until here *) +(* ===========================================================================*) + + (NEW_GOAL `(x:real^3) IN convex hull (u0 INSERT S)`); + (REWRITE_TAC[CONVEX_HULL_EXPLICIT; IN; IN_ELIM_THM]); + + (UP_ASM_TAC THEN REWRITE_TAC[IN; aff_ge_alt; lin_combo]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `{u0:real^3} UNION q`); + (EXISTS_TAC `f:real^3->real`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[SET_RULE `{a} UNION b = a INSERT b`; FINITE_INSERT]); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ASM_CASES_TAC `x':real^3 IN q`); + (FIRST_ASSUM MATCH_MP_TAC); + (UP_ASM_TAC THEN MESON_TAC[IN]); + (REWRITE_WITH `x' = u0:real^3`); + (NEW_GOAL `x' IN ({u0:real^3} UNION q)`); + (ASM_REWRITE_TAC[IN]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[REAL_ARITH `&0 <= x <=> ~(x < &0)`]); + (STRIP_TAC); + (UNDISCH_TAC `x IN ball (u0:real^3,&1)`); + (ASM_REWRITE_TAC[IN_BALL; SET_RULE `{u} UNION q = u INSERT (q DELETE u)`]); + (REWRITE_WITH `vsum (u0 INSERT (q DELETE u0:real^3)) (\v. f v % v) = + (if u0 IN (q DELETE u0) then vsum (q DELETE u0) (\v. f v % v) + else (\v. f v % v) u0 + vsum (q DELETE u0) (\v. f v % v))`); + (MATCH_MP_TAC Marchal_cells_2_new.VSUM_CLAUSES_alt); + (ASM_REWRITE_TAC[FINITE_DELETE]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[dist]); + (REWRITE_WITH `!a. a - u0 = a - (sum ({u0:real^3} UNION q) f) % u0`); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + + + (NEW_GOAL `sum ({u0} UNION q) f = f u0 + sum (q DELETE u0:real^3) f`); + (REWRITE_TAC[SET_RULE `{u} UNION q = u INSERT (q DELETE u)`]); + (REWRITE_WITH `sum (u0 INSERT (q DELETE u0:real^3)) f = + (if u0 IN (q DELETE u0) then sum (q DELETE u0) f + else f u0 + sum (q DELETE u0) f)`); + (MATCH_MP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt); + (ASM_REWRITE_TAC[FINITE_DELETE]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_ADD_RDISTRIB; + VECTOR_ARITH `(a + b) - (a + c:real^3) = b - c`; + ASSUME `sum ({u0} UNION q) f = f u0 + sum (q DELETE u0:real^3) f`; ]); + (ABBREV_TAC `h = sum (q DELETE u0:real^3) f`); + (ABBREV_TAC `y = inv (h) % vsum (q DELETE u0) (\v:real^3. f v % v)`); + (NEW_GOAL `h > &1`); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `vsum (q DELETE u0) (\v. f v % v) = h % y:real^3`); + (EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_MUL_ASSOC]); + (REWRITE_WITH `h * inv h = &1`); + (ASM_SIMP_TAC [Trigonometry2.REAL_MUL_LRINV; REAL_ARITH `h > &1 ==> ~(h = &0)`]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `h % a - h % b = h % (a - b)`; NORM_MUL]); + (REWRITE_TAC[REAL_ARITH `~(a < b) <=> b <= a`]); + + (NEW_GOAL `norm (p - u0) <= norm (y - u0:real^3)`); + (MATCH_MP_TAC Tactics_jordan.REAL_POW_2_LE); + (REWRITE_TAC[NORM_POS_LE]); + (REWRITE_WITH + `norm (y - u0) pow 2 = norm (p - u0) pow 2 + norm (y - p:real^3) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (REWRITE_WITH `p = circumcenter (set_of_list [u0;u1:real^3])`); + (ASM_REWRITE_TAC[set_of_list]); + (ONCE_REWRITE_TAC[DOT_SYM]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ASSUME `voronoi_list V [u0; u1] = S`]); + (REWRITE_TAC[AFFINE_HULL_EXPLICIT_ALT; IN; IN_ELIM_THM]); + (EXISTS_TAC `q DELETE u0:real^3`); + (EXISTS_TAC `(\v:real^3. inv h * f v)`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[FINITE_DELETE]); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[SUM_LMUL]); + (ASM_SIMP_TAC [Trigonometry2.REAL_MUL_LRINV; REAL_ARITH `h > &1 ==> ~(h = &0)`]); + (REWRITE_TAC[GSYM VECTOR_MUL_ASSOC]); + (ASM_REWRITE_TAC[VSUM_LMUL]); + + (REWRITE_TAC[set_of_list]); + (NEW_GOAL `{u0, u1:real^3} SUBSET affine hull {u0, u1}`); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (ASM_SET_TAC[]); + (REWRITE_TAC[REAL_ARITH `a <= a + b <=> &0 <= b`; NORM_POW_2; DOT_POS_LE]); + + (NEW_GOAL `&1 <= norm (p - u0:real^3)`); + (EXPAND_TAC "p"); + (REWRITE_TAC[CIRCUMCENTER_2; midpoint; + VECTOR_ARITH `inv (&2) % (u0 + u1) - u0 = inv (&2) % (u1 - u0)`; + NORM_MUL; REAL_ARITH `abs (inv(&2)) = inv (&2)`]); + (REWRITE_TAC[GSYM dist]); + (REWRITE_WITH `&1 = inv (&2) * &2`); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `inv (&2) * &2 <= inv (&2) * a <=> &2 <= a`]); + (MP_TAC (ASSUME `packing (V:real^3->bool)`)); + (REWRITE_TAC[packing] THEN STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]); + (REWRITE_WITH `abs h = h`); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `h <= h * norm (y - u0:real^3)`); + (REWRITE_TAC[REAL_ARITH `h <= h * a <=> &0 <= h * (a - &1)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + +(* ========================================================================== *) + (NEW_GOAL `~(S:real^3->bool = {})`); + (STRIP_TAC); + (NEW_GOAL `~(aff_dim (u0:real^3 INSERT S) = &3)`); + (REWRITE_TAC[ASSUME `S:real^3->bool = {}`; AFF_DIM_SING]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (SWITCH_TAC); + (UP_ASM_TAC THEN SIMP_TAC[CONVEX_HULL_INSERT; + ASSUME `~(S:real^3->bool = {})`]); + (REWRITE_WITH `convex hull S = S:real^3->bool`); + (REWRITE_TAC[CONVEX_HULL_EQ]); + (EXPAND_TAC "S" THEN REWRITE_TAC[Packing3.CONVEX_VORONOI_LIST]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[IN_UNIONS; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (EXISTS_TAC `rogers V vl`); + (REPEAT STRIP_TAC); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + + (ASM_SIMP_TAC[Marchal_cells_2_new.ROGERS_EXPLICIT]); + (REWRITE_TAC[CONVEX_HULL_4; IN_ELIM_THM]); + + (UNDISCH_TAC `(t:real^3->bool) b'`); + (ASM_REWRITE_TAC[CONVEX_HULL_3; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (EXISTS_TAC `u:real`); + (EXISTS_TAC `v * u'`); + (EXISTS_TAC `v * v'`); + (EXISTS_TAC `v * w`); + (ASM_SIMP_TAC[REAL_LE_MUL]); + (STRIP_TAC); + + (REWRITE_TAC[REAL_ARITH `u + v * u' + v * v' + v * w = u + v * (u' + v' +w)`]); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (ASM_REWRITE_TAC[HD]); + (VECTOR_ARITH_TAC); + +(* ========================================================================= *) +(* ========================================================================== *) + + (NEW_GOAL + `!X. mcell_set V X /\ ~NULLSET (X INTER C) + ==> (?k vl. + 2 <= k /\ + barV V 3 vl /\ + X = mcell k V vl /\ + truncate_simplex 1 vl = [u0; u1])`); + + (REWRITE_TAC[mcell_set_2; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `~NULLSET (X INTER UNIONS + {rogers V vl | vl | barV V 3 vl /\ truncate_simplex 1 vl = [u0; u1]})`); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER C)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER + UNIONS + {rogers V vl | vl | barV V 3 vl /\ truncate_simplex 1 vl = [u0; u1]}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[INTER_UNIONS]); + (STRIP_TAC); + + (NEW_GOAL + `!s. ~NULLSET (UNIONS s) /\ FINITE s ==> (?t. t IN s /\ ~NULLSET t)`); + (MESON_TAC[NEGLIGIBLE_UNIONS]); + (ABBREV_TAC `St = {X INTER x | x IN + {rogers V vl | vl | barV V 3 vl /\ + truncate_simplex 1 vl = [u0; u1]}}`); + (NEW_GOAL `?t. t IN St /\ ~NULLSET t`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "St"); + (ABBREV_TAC `Sr = {rogers V vl | vl | barV V 3 vl /\ + truncate_simplex 1 vl = [u0; u1]}`); + (ABBREV_TAC `f = (\x:real^3->bool. X INTER x)`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y:real^3->bool | ?x:real^3->bool. x IN Sr /\ y = f x }`); + (STRIP_TAC); + + + + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (ABBREV_TAC `Ss = {vl | barV V 3 vl /\ truncate_simplex 1 vl = [u0; u1]}`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y | ?vl. vl IN Ss /\ y = rogers V vl}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (ABBREV_TAC `Sx = V INTER ball (u0:real^3, &4)`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y | ?u0 u1 u2 u3:real^3. + u0 IN Sx /\ + u1 IN Sx /\ + u2 IN Sx /\ + u3 IN Sx /\ + y = [u0; u1; u2; u3]}`); + (STRIP_TAC); + (MATCH_MP_TAC Ajripqn.FINITE_SET_LIST_LEMMA); + (EXPAND_TAC "Sx"); + (MATCH_MP_TAC Pack2.KIUMVTC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "Ss"); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `?v0 v1 v2 v3. x = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v0:real^3`); + (EXISTS_TAC `v1:real^3`); + (EXISTS_TAC `v2:real^3`); + (EXISTS_TAC `v3:real^3`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `{v0, v1, v2, v3:real^3} SUBSET Sx`); + (EXPAND_TAC "Sx"); + (REWRITE_TAC[SUBSET_INTER]); + (REWRITE_WITH `{v0, v1, v2, v3:real^3} = set_of_list x`); + (ASM_REWRITE_TAC[set_of_list]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `HD (truncate_simplex 1 x) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 x) = v0:real^3`); + (REWRITE_TAC[ASSUME `x = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (REWRITE_WITH `u0 = v0:real^3`); + (ASM_MESON_TAC[]); + (REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (EXPAND_TAC "Sr" THEN EXPAND_TAC "Ss"); + (SET_TAC[]); + (REWRITE_WITH `{X INTER x:real^3->bool | x IN Sr} = {f x | x IN Sr}`); + (EXPAND_TAC "f"); + (REFL_TAC); + (SET_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "St" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `x SUBSET UNIONS {mcell i V vl | i <= 4}`); + (ASM_REWRITE_TAC[SUBSET; IN_UNIONS; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?i. i <= 4 /\ x' IN mcell i V vl`); + (MATCH_MP_TAC Sltstlo.SLTSTLO1); + (ASM_REWRITE_TAC[IN]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `mcell i' V vl`); + (STRIP_TAC); + (EXISTS_TAC `i':num` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN]); + + (NEW_GOAL `~NULLSET (X INTER UNIONS {mcell i V vl | i <= 4})`); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (t)`); + (REWRITE_TAC[ASSUME `t:real^3->bool = X INTER x`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER UNIONS {mcell i V vl | i <= 4}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[INTER_UNIONS]); + (STRIP_TAC); + + (NEW_GOAL + `!s. ~NULLSET (UNIONS s) /\ FINITE s ==> (?t. t IN s /\ ~NULLSET t)`); + (MESON_TAC[NEGLIGIBLE_UNIONS]); + (ABBREV_TAC `Sx = {X INTER x | x IN {mcell i V vl | i <= 4}}`); + (NEW_GOAL `?t. t IN Sx /\ ~NULLSET t`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "Sx"); + (ABBREV_TAC `Sy = {mcell i V vl | i <= 4}`); + (ABBREV_TAC `f = (\x:real^3->bool. X INTER x)`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y:real^3->bool | ?x:real^3->bool. x IN Sy /\ y = f x }`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (EXPAND_TAC "Sy"); + (REWRITE_TAC[GSYM IN_NUMSEG_0]); + (ABBREV_TAC `g = (\i:num. mcell i V vl)`); + (REWRITE_WITH `{mcell i V vl | i IN 0..4} = {g i | i IN 0..4}`); + (EXPAND_TAC "g" THEN REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y:real^3->bool | ?i. i IN 0..4 /\ y = g i}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (REWRITE_TAC[FINITE_NUMSEG]); + (SET_TAC[]); + (REWRITE_WITH `{X INTER x:real^3->bool | x IN Sy} = {f x | x IN Sy}`); + (EXPAND_TAC "f" THEN REWRITE_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "Sx" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + +(* ========================================================================= *) + + (NEW_GOAL `i = i' /\ mcell i V ul = mcell i' V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[GSYM Ajripqn.UP_TO_4_KY_LEMMA]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `ul IN barV V 3` THEN REWRITE_TAC[IN]); + (UNDISCH_TAC `~NULLSET t'`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + +(* ========================================================================= *) + + (ASM_CASES_TAC `i' = 0`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER C)`); + (REWRITE_TAC[]); + (REWRITE_WITH `X INTER C = {}:real^3->bool`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell0]); + (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `C SUBSET ball (u0:real^3, sqrt (&2))`); + (NEW_GOAL `ball (u0:real^3, &1) SUBSET ball (u0, sqrt (&2))`); + (MATCH_MP_TAC SUBSET_BALL); + (MATCH_MP_TAC (REAL_ARITH `a < b ==> a <= b`)); + (REWRITE_TAC[Marchal_cells_2_new.ZERO_LT_SQRT_2]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `i' = 1`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER C)`); + (REWRITE_TAC[]); + (REWRITE_WITH `X INTER C = {}:real^3->bool`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell1]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[HD; TL]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 vl) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 vl) = v0:real^3`); + (REWRITE_TAC[ASSUME `vl = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = v1:real^3`); + (REWRITE_TAC[ASSUME `vl = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `C SUBSET (rcone_gt u0 u1 (hl [u0:real^3; u1] / sqrt (&2)))`); + (EXPAND_TAC "C"); + (SET_TAC[ASSUME `rcone_gt u0 u1 c SUBSET + W INTER rcone_gt u0 u1 (hl [u0:real^3; u1] / sqrt (&2))`]); + (UP_ASM_TAC THEN SET_TAC[]); + (SET_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + (ASM_ARITH_TAC); + +(* ========================================================================= *) + + (ABBREV_TAC `f1 = + (\ul. dist (u0:real^3, + closest_point (affine hull {u1, EL 2 ul, mxi V ul}) u0))`); + + (ABBREV_TAC `P1 = { (f1:(real^3)list->real) ul |ul | barV V 3 ul /\ + ~NULLSET (mcell 3 V ul INTER C) /\ + truncate_simplex 1 ul = [u0; u1]}`); + + (NEW_GOAL `~(P1 = {}) ==> (?b:real. b IN P1 /\ (!x. x IN P1 ==> b <= x))`); + (STRIP_TAC); + (MATCH_MP_TAC INF_FINITE_LEMMA); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "P1"); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x | P x} = {f x | x IN {y | P y}}`]); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x IN s} = {y | ?x. x IN s /\ y = f x}`]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y | ?v0:real^3 v1 u2 u3. + v0 IN (V INTER ball (u0:real^3, &4)) /\ + v1 IN (V INTER ball (u0, &4)) /\ + u2 IN (V INTER ball (u0, &4)) /\ + u3 IN (V INTER ball (u0, &4)) /\ + y = [v0; v1; u2; u3]}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SET_LIST_LEMMA); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?v0 v1 u2 u3. x = [v0; v1; u2; u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v0:real^3` THEN EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (x:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (x:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (NEW_GOAL `set_of_list x SUBSET ball (u0:real^3,&4)`); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + (NEW_GOAL `set_of_list x SUBSET V:real^3->bool`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + + (ABBREV_TAC `r1 = (if (P1 = {}:real->bool) then &1 + else (@b. b IN P1 /\ (!x. x IN P1 ==> b <= x)))`); + (NEW_GOAL `&0 < r1`); + (EXPAND_TAC "r1"); + (COND_CASES_TAC); + (REAL_ARITH_TAC); + (NEW_GOAL `?b:real. b IN P1 /\ (!x. x IN P1 ==> b <= x)`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `P = (\b:real. b IN P1 /\ (!x. x IN P1 ==> b <= x))`); + (ABBREV_TAC `zz = (@) (P:real->bool)`); + (NEW_GOAL `(P:real->bool) zz`); + (EXPAND_TAC "zz"); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b':real`); + (EXPAND_TAC "P" THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "P" THEN REWRITE_TAC[]); + (EXPAND_TAC "P1" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "f1"); + (MATCH_MP_TAC DIST_POS_LT); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `closest_point (affine hull {u1, EL 2 ul, mxi V ul}) u0 = u0 + <=> u0 IN (affine hull {u1:real^3, EL 2 ul, mxi V ul})`); + (MATCH_MP_TAC CLOSEST_POINT_REFL); + (REWRITE_TAC[CLOSED_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_EQ_EMPTY] THEN SET_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (mcell 3 V ul INTER C)`); + (REWRITE_TAC[] THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 3 V ul`); + (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]); + (REWRITE_TAC[MCELL_EXPLICIT; mcell3]); + (COND_CASES_TAC); + + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, v2, mxi V [u0; u1; v2; v3]}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_WITH `affine hull {u0, u1, v2, mxi V [u0; u1; v2; v3]} = + affine hull {u1, v2, mxi V [u0; u1; v2; v3]}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + (REWRITE_WITH `affine hull {u1, v2, mxi V [u0; u1; v2; v3]} = + affine hull {u1, EL 2 ul, mxi V ul}`); + (ASM_REWRITE_TAC[EL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`; HD; TL]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + +(* ========================================================================= *) + + (ABBREV_TAC `f2 = + (\ul. dist (u0:real^3, + closest_point (affine hull {u1, EL 2 ul, EL 3 ul}) u0))`); + + (ABBREV_TAC `P2 = { (f2:(real^3)list->real) ul |ul | barV V 3 ul /\ + ~NULLSET (mcell 4 V ul INTER C) /\ + truncate_simplex 1 ul = [u0; u1]}`); + + (NEW_GOAL `~(P2 = {}) ==> (?b:real. b IN P2 /\ (!x. x IN P2 ==> b <= x))`); + (STRIP_TAC); + (MATCH_MP_TAC INF_FINITE_LEMMA); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "P2"); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x | P x} = {f x | x IN {y | P y}}`]); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x IN s} = {y | ?x. x IN s /\ y = f x}`]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y | ?v0:real^3 v1 u2 u3. + v0 IN (V INTER ball (u0:real^3, &4)) /\ + v1 IN (V INTER ball (u0, &4)) /\ + u2 IN (V INTER ball (u0, &4)) /\ + u3 IN (V INTER ball (u0, &4)) /\ + y = [v0; v1; u2; u3]}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SET_LIST_LEMMA); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?v0 v1 u2 u3. x = [v0; v1; u2; u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v0:real^3` THEN EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (x:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (x:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (NEW_GOAL `set_of_list x SUBSET ball (u0:real^3,&4)`); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + (NEW_GOAL `set_of_list x SUBSET V:real^3->bool`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + + (ABBREV_TAC `r2 = (if (P2 = {}:real->bool) then &1 + else (@b. b IN P2 /\ (!x. x IN P2 ==> b <= x)))`); + + (NEW_GOAL `&0 < r2`); + (EXPAND_TAC "r2"); + (COND_CASES_TAC); + (REAL_ARITH_TAC); + (NEW_GOAL `?b:real. b IN P2 /\ (!x. x IN P2 ==> b <= x)`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `P = (\b:real. b IN P2 /\ (!x. x IN P2 ==> b <= x))`); + (ABBREV_TAC `zz = (@) (P:real->bool)`); + (NEW_GOAL `(P:real->bool) zz`); + (EXPAND_TAC "zz"); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b':real`); + (EXPAND_TAC "P" THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "P" THEN REWRITE_TAC[]); + (EXPAND_TAC "P2" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "f2"); + (MATCH_MP_TAC DIST_POS_LT); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `closest_point (affine hull {u1, EL 2 ul, EL 3 ul}) u0 = u0 + <=> u0 IN (affine hull {u1:real^3, EL 2 ul, EL 3 ul})`); + (MATCH_MP_TAC CLOSEST_POINT_REFL); + (REWRITE_TAC[CLOSED_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_EQ_EMPTY] THEN SET_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (mcell 4 V ul INTER C)`); + (REWRITE_TAC[] THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 4 V ul`); + (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4]); + (COND_CASES_TAC); + + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, v2, v3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_WITH `affine hull {u0, u1, v2, v3:real^3} = + affine hull {u1, v2, v3}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + (REWRITE_WITH `affine hull {u1, v2, v3:real^3} = + affine hull {u1, EL 2 ul, EL 3 ul}`); + (ASM_REWRITE_TAC[EL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; HD; TL]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + +(* ========================================================================= *) + + (ABBREV_TAC `r = min (&1) (min r1 r2)`); + (NEW_GOAL `&0 < r`); + (EXPAND_TAC "r"); + (UNDISCH_TAC `&0 < r1` THEN UNDISCH_TAC `&0 < r2` THEN REAL_ARITH_TAC); + +(* ========================================================================= *) + + (ABBREV_TAC `f3 = + (\ul. (((smallest_angle_line (EL 2 ul) (mxi V ul) u0 u1) - u0) + dot (u1 - u0)) / + (norm ((smallest_angle_line (EL 2 ul) (mxi V ul) u0 u1) - u0) + * norm (u1 - u0)))`); + + (ABBREV_TAC `P3 = {(f3:(real^3)list->real) ul |ul | barV V 3 ul /\ + ~NULLSET (mcell 3 V ul INTER C) /\ + truncate_simplex 1 ul = [u0; u1]}`); + + (NEW_GOAL `~(P3 = {}) ==> (?b:real. b IN P3 /\ (!x. x IN P3 ==> x <= b))`); + (STRIP_TAC); + (MATCH_MP_TAC SUP_FINITE_LEMMA); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "P3"); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x | P x} = {f x | x IN {y | P y}}`]); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x IN s} = {y | ?x. x IN s /\ y = f x}`]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y | ?v0:real^3 v1 u2 u3. + v0 IN (V INTER ball (u0:real^3, &4)) /\ + v1 IN (V INTER ball (u0, &4)) /\ + u2 IN (V INTER ball (u0, &4)) /\ + u3 IN (V INTER ball (u0, &4)) /\ + y = [v0; v1; u2; u3]}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SET_LIST_LEMMA); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?v0 v1 u2 u3. x = [v0; v1; u2; u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v0:real^3` THEN EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (x:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (x:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (NEW_GOAL `set_of_list x SUBSET ball (u0:real^3,&4)`); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + (NEW_GOAL `set_of_list x SUBSET V:real^3->bool`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + + (ABBREV_TAC `d1 = (if (P3 = {}:real->bool) then c + else (@b. b IN P3 /\ (!x. x IN P3 ==> x <= b)))`); + + (NEW_GOAL `d1 < &1`); + (EXPAND_TAC "d1"); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?b:real. b IN P3 /\ (!x. x IN P3 ==> x <= b)`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `P = (\b:real. b IN P3 /\ (!x. x IN P3 ==> x <= b))`); + (ABBREV_TAC `zz = (@) (P:real->bool)`); + (NEW_GOAL `(P:real->bool) zz`); + (EXPAND_TAC "zz"); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b':real`); + (EXPAND_TAC "P" THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "P" THEN REWRITE_TAC[]); + (EXPAND_TAC "P3" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "f3"); + + (ABBREV_TAC `xx = smallest_angle_line (EL 2 ul) (mxi V ul) u0 u1`); + (MATCH_MP_TAC REAL_DIV_LT_1_TACTICS); + (STRIP_TAC); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a /\ ~(a = &0) ==> &0 < a`)); + (STRIP_TAC); + (SIMP_TAC[REAL_LE_MUL; NORM_POS_LE]); + (REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "xx"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN + REWRITE_TAC[smallest_angle_line; smallest_angle_set]); + (STRIP_TAC); + (ABBREV_TAC `Q = (\x:real^3. x IN convex hull {EL 2 ul, mxi V ul} /\ + (!y. y IN convex hull {EL 2 ul, mxi V ul} + ==> ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0))))`); + (NEW_GOAL `(Q:real^3->bool) u0`); + (REWRITE_TAC[ASSUME `u0 = (@) (Q:real^3->bool)`]); + (MATCH_MP_TAC SELECT_AX); + (EXPAND_TAC "Q"); + (MATCH_MP_TAC SMALLEST_ANGLE_LINE_EXISTS); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?v1 v2 v3. ul = [u0; v1; v2; v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (ul:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[ASSUME `v0 = u0:real^3`]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `EL 2 ul = v2:real^3`); + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (mcell 3 V ul INTER C)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 3 V ul` THEN STRIP_TAC); + (REWRITE_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; ASSUME `ul = [u0; v1; v2; v3:real^3]`; + SET_RULE `{a,b,c} UNION {d} = {a,b, c,d}`]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, v1, v2, mxi V ul}`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (UNDISCH_TAC `u0 IN convex hull {v2, mxi V ul}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN + EXISTS_TAC `mxi V ul`); + (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (STRIP_TAC); + (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (UP_ASM_TAC THEN EXPAND_TAC "Q"); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (mcell 3 V ul INTER C)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 3 V ul`); + (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]); + (REWRITE_TAC[MCELL_EXPLICIT; mcell3]); + (COND_CASES_TAC); + (NEW_GOAL `?v2 v3. ul = [u0;u1;v2;v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0;v1;v2;v3:real^3]`]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_TAC[GSYM (ASSUME `u0 = (@) (Q:real^3->bool)`)]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, v2, mxi V ul}`); + (REWRITE_TAC[ASSUME `ul = [u0; u1; v2; v3:real^3]`; + CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_WITH `affine hull {u0, u1, v2, mxi V [u0; u1; v2; v3]} = + affine hull {u1, v2, mxi V [u0; u1; v2; v3]}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + + (NEW_GOAL `convex hull {EL 2 ul, mxi V ul} SUBSET + affine hull {EL 2 ul, mxi V ul}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (NEW_GOAL `affine hull {EL 2 ul, mxi V ul} SUBSET + affine hull {u1, v2, mxi V [u0; u1; v2; v3]}`); + (MATCH_MP_TAC AFFINE_SUBSET_KY_LEMMA); + (ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]); + (SET_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN + UNDISCH_TAC `u0 IN convex hull {EL 2 ul, mxi V ul}` THEN SET_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (MATCH_MP_TAC (REAL_ARITH `(a <= b) /\ ~(a = b) ==> a < b`)); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ; NORM_CAUCHY_SCHWARZ_EQ]); + (NEW_GOAL `xx IN convex hull {(EL 2 ul) ,(mxi V ul)}`); + (MATCH_MP_TAC SMALLEST_ANGLE_IN_CONVEX_HULL); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?v1 v2 v3. ul = [u0; v1; v2; v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (ul:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[ASSUME `v0 = u0:real^3`]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `EL 2 ul = v2:real^3`); + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (mcell 3 V ul INTER C)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 3 V ul` THEN STRIP_TAC); + (REWRITE_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; ASSUME `ul = [u0; v1; v2; v3:real^3]`; + SET_RULE `{a,b,c} UNION {d} = {a,b, c,d}`]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, v1, v2, mxi V ul}`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (UNDISCH_TAC `u0 IN convex hull {v2, mxi V ul}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN + EXISTS_TAC `mxi V ul`); + (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (STRIP_TAC); + (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (mcell 3 V ul INTER C)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 3 V ul`); + (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]); + (REWRITE_TAC[MCELL_EXPLICIT; mcell3]); + (COND_CASES_TAC); + (NEW_GOAL `?v2 v3. ul = [u0;u1;v2;v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, v2, mxi V ul}`); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (ABBREV_TAC `m = mxi V ul`); + (NEW_GOAL `mxi V [u0; u1;v2;v3] = m`); + (EXPAND_TAC "m" THEN AP_TERM_TAC THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (ABBREV_TAC `k1 = norm (xx - u0:real^3)`); + (ABBREV_TAC `k2 = norm (u1 - u0:real^3)`); + (UNDISCH_TAC `xx IN convex hull {EL 2 ul, m:real^3}`); + (ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `2 = SUC 1/\ 1 = SUC 0`; + CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (UNDISCH_TAC `k1 % (u1 - u0) = k2 % (xx - u0:real^3)`); + (ASM_REWRITE_TAC[]); + + (STRIP_TAC); + + (REWRITE_TAC[coplanar]); + (NEW_GOAL `~(k2 = &0)`); + (EXPAND_TAC "k2"); + (REWRITE_TAC[NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> b = a`]); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `~(v = &0)`); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN + EXISTS_TAC `v2:real^3`); + (MATCH_MP_TAC (SET_RULE `{a,b,c} SUBSET X /\ d IN X ==> {a,b,c,d} SUBSET X`)); + (STRIP_TAC); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `(k2 - k1:real) / (k2 * v)`); + (EXISTS_TAC `k1 / (k2 * v)`); + (EXISTS_TAC `(--k2 * u) / (k2 * v)`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]); + (REWRITE_WITH `k2 - k1 + k1 + --k2 * u = k2 * (u + v) - k1 + k1 + --k2 * u`); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 0 = 1`] THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `k2 * (u + v) - k1 + k1 + --k2 * u = k2 * v`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[VECTOR_ARITH `a / x % u0 + b / x % u1 + d / x % u2 = + (&1 / x) % (a % u0 + b % u1 + d % u2)`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH + `&1 / (k2 * v) % ((k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2) = m:real^3 <=> + ((k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2) = (k2 * v) % m`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.CHANGE_SIDE); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2 = (k2 * v) % m <=> + k1 % (u1 - u0) = k2 % ((u % v2 + v % m) - u0)`]); + + (NEW_GOAL `~(u = &0)`); + (UP_ASM_TAC THEN UNDISCH_TAC `u + v = &(SUC 0):real` THEN + REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + (REAL_ARITH_TAC); + + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN + EXISTS_TAC `m:real^3`); + (MATCH_MP_TAC (SET_RULE `{a,b,c} SUBSET X /\ d IN X ==> {a,b,d,c} SUBSET X`)); + (STRIP_TAC); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + + (EXISTS_TAC `(k2 - k1:real) / (k2 * u)`); + (EXISTS_TAC `k1 / (k2 * u)`); + (EXISTS_TAC `(--k2 * v) / (k2 * u)`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]); + (REWRITE_WITH `k2 - k1 + k1 + --k2 * v = k2 * (u + v) - k1 + k1 + --k2 * v`); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 0 = 1`] THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `k2 * (u + v) - k1 + k1 + --k2 * v = k2 * u`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[VECTOR_ARITH `a / x % u0 + b / x % u1 + d / x % u2 = + (&1 / x) % (a % u0 + b % u1 + d % u2)`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH + `&1 / (k2 * u) % ((k2 - k1) % u0 + k1 % u1 + (--k2 * v) % m) = v2:real^3 <=> + ((k2 - k1) % u0 + k1 % u1 + (--k2 * v) % m) = (k2 * u) % v2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.CHANGE_SIDE); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(k2 - k1) % u0 + k1 % u1 + (--k2 * v) % m = (k2 * u) % v2 <=> + k1 % (u1 - u0) = k2 % ((u % v2 + v % m) - u0)`]); + + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + +(* ========================================================================== *) + + (ABBREV_TAC `f4 = + (\ul. (((smallest_angle_line (EL 2 ul) (EL 3 ul) u0 u1) - u0) + dot (u1 - u0)) / + (norm ((smallest_angle_line (EL 2 ul) (EL 3 ul) u0 u1) - u0) + * norm (u1 - u0)))`); + + (ABBREV_TAC `P4 = {(f4:(real^3)list->real) ul |ul | barV V 3 ul /\ + ~NULLSET (mcell 4 V ul INTER C) /\ + truncate_simplex 1 ul = [u0; u1]}`); + + (NEW_GOAL `~(P4 = {}) ==> (?b:real. b IN P4 /\ (!x. x IN P4 ==> x <= b))`); + (STRIP_TAC); + (MATCH_MP_TAC SUP_FINITE_LEMMA); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "P4"); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x | P x} = {f x | x IN {y | P y}}`]); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x IN s} = {y | ?x. x IN s /\ y = f x}`]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y | ?v0:real^3 v1 u2 u3. + v0 IN (V INTER ball (u0:real^3, &4)) /\ + v1 IN (V INTER ball (u0, &4)) /\ + u2 IN (V INTER ball (u0, &4)) /\ + u3 IN (V INTER ball (u0, &4)) /\ + y = [v0; v1; u2; u3]}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SET_LIST_LEMMA); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?v0 v1 u2 u3. x = [v0; v1; u2; u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v0:real^3` THEN EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (x:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (x:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (NEW_GOAL `set_of_list x SUBSET ball (u0:real^3,&4)`); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + (NEW_GOAL `set_of_list x SUBSET V:real^3->bool`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + + (ABBREV_TAC `d2 = (if (P4 = {}:real->bool) then c + else (@b. b IN P4 /\ (!x. x IN P4 ==> x <= b)))`); + (NEW_GOAL `d2 < &1`); + (EXPAND_TAC "d2"); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?b:real. b IN P4 /\ (!x. x IN P4 ==> x <= b)`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `P = (\b:real. b IN P4 /\ (!x. x IN P4 ==> x <= b))`); + (ABBREV_TAC `zz = (@) (P:real->bool)`); + (NEW_GOAL `(P:real->bool) zz`); + (EXPAND_TAC "zz"); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b':real`); + (EXPAND_TAC "P" THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "P" THEN REWRITE_TAC[]); + (EXPAND_TAC "P4" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "f4"); + + (ABBREV_TAC `xx = smallest_angle_line (EL 2 ul) (EL 3 ul) u0 u1`); + (MATCH_MP_TAC REAL_DIV_LT_1_TACTICS); + (STRIP_TAC); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a /\ ~(a = &0) ==> &0 < a`)); + (STRIP_TAC); + (SIMP_TAC[REAL_LE_MUL; NORM_POS_LE]); + (REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "xx"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN + REWRITE_TAC[smallest_angle_line; smallest_angle_set]); + (STRIP_TAC); + (ABBREV_TAC `Q = (\x:real^3. x IN convex hull {EL 2 ul, EL 3 ul} /\ + (!y. y IN convex hull {EL 2 ul, EL 3 ul} + ==> ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0))))`); + (NEW_GOAL `(Q:real^3->bool) u0`); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXPAND_TAC "Q"); + + (MATCH_MP_TAC SMALLEST_ANGLE_LINE_EXISTS); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?v1 v2 v3. ul = [u0; v1; v2; v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (ul:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[ASSUME `v0 = u0:real^3`]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `EL 2 ul = v2:real^3 /\ EL 3 ul = v3`); + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `3 = SUC 2 /\2 = SUC 1 /\ 1 = SUC 0`]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (mcell 4 V ul INTER C)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 4 V ul` THEN STRIP_TAC); + (SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list;ARITH_RULE `4 >= 4`; + ASSUME `ul = [u0; v1; v2; v3:real^3]`]); + (COND_CASES_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, v1, v2, v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (UNDISCH_TAC `u0 IN convex hull {v2, v3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN + EXISTS_TAC `v3:real^3`); + (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (STRIP_TAC); + (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (UP_ASM_TAC THEN EXPAND_TAC "Q"); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (mcell 4 V ul INTER C)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 4 V ul`); + (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]); + (SIMP_TAC[MCELL_EXPLICIT; mcell4; ARITH_RULE `4 >= 4`]); + (COND_CASES_TAC); + (NEW_GOAL `?v2 v3. ul = [u0;u1;v2;v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_TAC[GSYM (ASSUME `u0 = (@) (Q:real^3->bool)`)]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, v2, v3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_WITH `affine hull {u0, u1, v2, v3} = + affine hull {u1, v2, v3:real^3}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + + (NEW_GOAL `convex hull {EL 2 ul, (EL 3 ul):real^3} SUBSET + affine hull {EL 2 ul, EL 3 ul}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (NEW_GOAL `affine hull {EL 2 ul, (EL 3 ul):real^3} SUBSET + affine hull {u1, v2, v3}`); + (MATCH_MP_TAC AFFINE_SUBSET_KY_LEMMA); + (ASM_REWRITE_TAC[EL; HD; TL; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (SET_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN + UNDISCH_TAC `u0 IN convex hull {EL 2 ul, (EL 3 ul):real^3}` THEN SET_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (MATCH_MP_TAC (REAL_ARITH `(a <= b) /\ ~(a = b) ==> a < b`)); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ; NORM_CAUCHY_SCHWARZ_EQ]); + (NEW_GOAL `xx IN convex hull {(EL 2 ul) ,(EL 3 ul):real^3}`); + (MATCH_MP_TAC SMALLEST_ANGLE_IN_CONVEX_HULL); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?v1 v2 v3. ul = [u0; v1; v2; v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (ul:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[ASSUME `v0 = u0:real^3`]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `EL 2 ul = v2:real^3 /\ EL 3 ul = v3`); + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `3 = SUC 2 /\2 = SUC 1 /\ 1 = SUC 0`]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (mcell 4 V ul INTER C)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 4 V ul` THEN STRIP_TAC); + (SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list;ARITH_RULE `4 >= 4`; + ASSUME `ul = [u0; v1; v2; v3:real^3]`]); + (COND_CASES_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, v1, v2, v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (UNDISCH_TAC `u0 IN convex hull {v2, v3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN + EXISTS_TAC `v3:real^3`); + (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (STRIP_TAC); + (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (mcell 4 V ul INTER C)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 4 V ul`); + (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]); + (SIMP_TAC[MCELL_EXPLICIT; mcell4; ARITH_RULE `4 >= 4`]); + (COND_CASES_TAC); + (NEW_GOAL `?v2 v3. ul = [u0;u1;v2;v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, v2, v3:real^3}`); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (ABBREV_TAC `k1 = norm (xx - u0:real^3)`); + (ABBREV_TAC `k2 = norm (u1 - u0:real^3)`); + (UNDISCH_TAC `xx IN convex hull {EL 2 ul,(EL 3 ul):real^3}`); + (ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1/\ 1 = SUC 0`; + CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (UNDISCH_TAC `k1 % (u1 - u0) = k2 % (xx - u0:real^3)`); + (ASM_REWRITE_TAC[]); + + (STRIP_TAC); + + (REWRITE_TAC[coplanar]); + (NEW_GOAL `~(k2 = &0)`); + (EXPAND_TAC "k2"); + (REWRITE_TAC[NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> b = a`]); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `~(v = &0)`); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN + EXISTS_TAC `v2:real^3`); + (MATCH_MP_TAC (SET_RULE `{a,b,c} SUBSET X /\ d IN X ==> {a,b,c,d} SUBSET X`)); + (STRIP_TAC); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `(k2 - k1:real) / (k2 * v)`); + (EXISTS_TAC `k1 / (k2 * v)`); + (EXISTS_TAC `(--k2 * u) / (k2 * v)`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]); + (REWRITE_WITH `k2 - k1 + k1 + --k2 * u = k2 * (u + v) - k1 + k1 + --k2 * u`); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 0 = 1`] THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `k2 * (u + v) - k1 + k1 + --k2 * u = k2 * v`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[VECTOR_ARITH `a / x % u0 + b / x % u1 + d / x % u2 = + (&1 / x) % (a % u0 + b % u1 + d % u2)`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH + `&1 / (k2 * v) % ((k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2) = v3:real^3 <=> + ((k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2) = (k2 * v) % v3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.CHANGE_SIDE); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2 = (k2 * v) % v3 <=> + k1 % (u1 - u0) = k2 % ((u % v2 + v % v3) - u0)`]); + + (NEW_GOAL `~(u = &0)`); + (UP_ASM_TAC THEN UNDISCH_TAC `u + v = &(SUC 0):real` THEN + REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + (REAL_ARITH_TAC); + + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN + EXISTS_TAC `v3:real^3`); + (MATCH_MP_TAC (SET_RULE `{a,b,c} SUBSET X /\ d IN X ==> {a,b,d,c} SUBSET X`)); + (STRIP_TAC); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + + (EXISTS_TAC `(k2 - k1:real) / (k2 * u)`); + (EXISTS_TAC `k1 / (k2 * u)`); + (EXISTS_TAC `(--k2 * v) / (k2 * u)`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]); + (REWRITE_WITH `k2 - k1 + k1 + --k2 * v = k2 * (u + v) - k1 + k1 + --k2 * v`); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 0 = 1`] THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `k2 * (u + v) - k1 + k1 + --k2 * v = k2 * u`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[VECTOR_ARITH `a / x % u0 + b / x % u1 + d / x % u2 = + (&1 / x) % (a % u0 + b % u1 + d % u2)`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH + `&1 / (k2 * u) % ((k2 - k1) % u0 + k1 % u1 + (--k2 * v) % v3) = v2:real^3 <=> + ((k2 - k1) % u0 + k1 % u1 + (--k2 * v) % v3) = (k2 * u) % v2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.CHANGE_SIDE); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(k2 - k1) % u0 + k1 % u1 + (--k2 * v) % m = (k2 * u) % v2 <=> + k1 % (u1 - u0) = k2 % ((u % v2 + v % m) - u0)`]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + +(* ========================================================================== *) + + (ABBREV_TAC `d = max c (max d1 d2)`); + (NEW_GOAL `d < &1`); + (UNDISCH_TAC `d2 < &1` THEN UNDISCH_TAC `d1 < &1` THEN + UNDISCH_TAC `&0 < c /\ c < &1`); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + +(* ========================================================================== *) + + (ABBREV_TAC `D = ball (u0:real^3,r) INTER rcone_gt u0 u1 d`); + (NEW_GOAL `D SUBSET C:real^3->bool`); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + + (NEW_GOAL `!X. mcell_set V X /\ ~NULLSET (X INTER D) + ==> (?k vl. + 2 <= k /\ + barV V 3 vl /\ + X = mcell k V vl /\ + truncate_simplex 1 vl = [u0; u1])`); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[] THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER C:real^3->bool`); + (ASM_REWRITE_TAC[] THEN UNDISCH_TAC `D SUBSET C:real^3->bool`); + (SET_TAC[]); + +(* ========================================================================= *) + + (NEW_GOAL `D = conic_cap (u0:real^3) u1 r d`); + (EXPAND_TAC "D" THEN REWRITE_TAC[conic_cap; NORMBALL_BALL]); + + (NEW_GOAL `!X. mcell_set V X /\ ~NULLSET (X INTER D) ==> + vol (X INTER D) = vol (D) * (dihX V X (u0,u1)) / (&2 * pi)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `?k vl. + 2 <= k /\ + barV V 3 vl /\ + X = mcell k V vl /\ + truncate_simplex 1 vl = [u0; u1]`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + +(* ========================================================================= *) +(* Case k = 2 *) +(* ========================================================================= *) + + (ASM_CASES_TAC `k = 2`); + (ABBREV_TAC `m = mxi V vl`); + (ABBREV_TAC `s3 = omega_list_n V vl 3`); + (ABBREV_TAC `L = aff_ge{u0, u1} {m, s3:real^3}`); + + (REWRITE_WITH `vol (X INTER D) = vol (L INTER D)`); + (AP_TERM_TAC); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2]); + (LET_TAC); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (REWRITE_WITH `HD vl = u0 /\ HD (TL vl) = u1:real^3`); + (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = v1:real^3`); + (REWRITE_TAC[ASSUME `vl = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + + (EXPAND_TAC "L"); + (REWRITE_TAC [SET_RULE `(A INTER B INTER C) INTER D = C INTER D + <=> (!x. x IN C INTER D ==> x IN A /\ x IN B)`]); + + (REPEAT GEN_TAC THEN STRIP_TAC); + (NEW_GOAL `x:real^3 IN D`); + (UP_ASM_TAC THEN UNDISCH_TAC `D = conic_cap (u0:real^3) u1 r d`); + (SET_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "D" THEN STRIP_TAC); + (NEW_GOAL `x:real^3 IN rcone_gt u0 u1 a'`); + (NEW_GOAL `rcone_gt (u0:real^3) u1 d SUBSET rcone_gt u0 u1 c`); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC + `rcone_gt (u0:real^3) u1 c SUBSET W INTER rcone_gt u0 u1 a'`); + (SET_TAC[]); + (STRIP_TAC); + (UP_ASM_TAC THEN SET_TAC[RCONE_GT_SUBSET_RCONE_GE]); + +(* ========================================================================== *) + (UP_ASM_TAC THEN REWRITE_TAC[rcone_ge; rconesgn; rcone_gt; IN; IN_ELIM_THM]); + (STRIP_TAC); + + (ABBREV_TAC `y = u0 + proj_point (u1 - u0:real^3) (x - u0)`); + (NEW_GOAL `orthogonal (x - y) (u1 - u0:real^3)`); + (REWRITE_WITH `x - y = (x - u0) - proj_point (u1 - u0) (x - u0:real^3)`); + (EXPAND_TAC "y" THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[GSYM Marchal_cells_2_new.projection_proj_point]); + (REWRITE_TAC[orthogonal; Packing3.PROJECTION_ORTHOGONAL]); + + (NEW_GOAL `norm (x - u0) pow 2 = norm (y - u0) pow 2 + norm (x - y:real^3) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (ONCE_REWRITE_TAC[VECTOR_ARITH `(a - b) dot c = --(c dot (b - a))`]); + (REWRITE_WITH `y - u0 = proj_point (u1 - u0) (x - u0:real^3)`); + (EXPAND_TAC "y" THEN REWRITE_TAC[VECTOR_ARITH `(a + b) - a:real^3 = b`]); + (REWRITE_TAC[PRO_EXP; DOT_RMUL]); + (UP_ASM_TAC THEN REWRITE_TAC[orthogonal] THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + + (NEW_GOAL `norm (x - u1) pow 2 = norm (y - u1) pow 2 + norm (x - y:real^3) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (ONCE_REWRITE_TAC[VECTOR_ARITH `(a - b) dot c = c dot (a - b)`]); + (REWRITE_WITH `u1 - y = (u1 - u0) - proj_point (u1 - u0) (x - u0:real^3)`); + (EXPAND_TAC "y" THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[PRO_EXP; VECTOR_ARITH `x - a % x = (&1 - a) % x`]); + (REWRITE_TAC[DOT_RMUL] THEN DEL_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[orthogonal] THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + + (MP_TAC (ASSUME `(x - u0:real^3) dot (u1 - u0) > + dist (x,u0) * dist (u1,u0) * a'`)); + (REWRITE_WITH `(x - u0) dot (u1 - u0) = + (x - y) dot (u1 - u0) + (y - u0) dot (u1 - u0:real^3)`); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `(x - u1) dot (u0 - u1) = + (x - y) dot (u0 - u1) + (y - u1) dot (u0 - u1:real^3)`); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `(x - y) dot (u1 - u0:real^3) = &0`); + (ASM_REWRITE_TAC[GSYM orthogonal]); + (REWRITE_WITH `(x - y) dot (u0 - u1:real^3) = &0`); + (ONCE_REWRITE_TAC[VECTOR_ARITH `a dot (u0 - u1) = --(a dot (u1 - u0))`]); + (REWRITE_TAC[REAL_ARITH `--a = &0 <=> a = &0`]); + (ASM_REWRITE_TAC[GSYM orthogonal]); + (REWRITE_TAC[REAL_ARITH `&0 + a = a`]); + + (STRIP_TAC); + (NEW_GOAL `(y - u0) dot (u1 - u0) = norm (y - u0) * norm (u1 - u0:real^3)`); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ_EQ]); + (REWRITE_WITH `y - u0 = proj_point (u1 - u0) (x - u0:real^3)`); + (EXPAND_TAC "y" THEN REWRITE_TAC[VECTOR_ARITH `(a + b) - a:real^3 = b`]); + (REWRITE_TAC[PRO_EXP; NORM_MUL; VECTOR_MUL_ASSOC]); + (MATCH_MP_TAC (MESON[] `a = b ==> a % x = b % x`)); + (REWRITE_TAC[REAL_ARITH `a * norm b = norm b * a`]); + (MATCH_MP_TAC (MESON[] `a = b ==> x * a = x * b`)); + (REWRITE_TAC[REAL_ABS_REFL]); + (MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[DOT_POS_LE]); + + (REWRITE_WITH `(x - u0) dot (u1 - u0) = + (x - y) dot (u1 - u0) + (y - u0) dot (u1 - u0:real^3)`); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `(x - y) dot (u1 - u0:real^3) = &0`); + (ASM_REWRITE_TAC[GSYM orthogonal]); + (REWRITE_TAC[REAL_ARITH `&0 + a = a`]); + + (NEW_GOAL `y IN convex hull {u0, u1:real^3}`); + (NEW_GOAL `y IN affine hull {u0, u1:real^3}`); + (REWRITE_TAC[AFFINE_HULL_2; IN; IN_ELIM_THM]); + (EXPAND_TAC "y" THEN REWRITE_TAC[PRO_EXP]); + (ABBREV_TAC `rtemp = ((x - u0) dot (u1 - u0)) / ((u1 - u0) dot (u1 - + u0:real^3))`); + (EXISTS_TAC `&1 - rtemp` THEN EXISTS_TAC `rtemp:real`); + (STRIP_TAC); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[IN; AFFINE_HULL_2; CONVEX_HULL_2; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `y - u0 = v % (u1 - u0:real^3)`); + (NEW_GOAL `y - u0 = y - (u + v) % u0:real^3`); + (REWRITE_TAC[ASSUME `u + v = &1`; VECTOR_MUL_LID]); + (UP_ASM_TAC THEN REWRITE_WITH `y - (u + v) % u0 = v % (u1 - u0:real^3)`); + (REWRITE_TAC[ASSUME `y = u % u0 + v % u1:real^3`] THEN VECTOR_ARITH_TAC); + + (ASM_CASES_TAC `u < &0`); + (NEW_GOAL `F`); + (NEW_GOAL `norm (y - u0) <= norm (x - u0:real^3)`); + (MATCH_MP_TAC Tactics_jordan.REAL_POW_2_LE); + (REWRITE_TAC[NORM_POS_LE; ASSUME + `norm (x - u0:real^3) pow 2 = norm (y - u0) pow 2 + norm (x - y) pow 2`; + REAL_ARITH `a <= a + b <=> &0 <= b`; REAL_LE_POW_2]); + (NEW_GOAL `norm (x - u0:real^3) < &1`); + (REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN + REWRITE_TAC[GSYM IN_BALL]); + (NEW_GOAL `ball (u0:real^3, r) SUBSET ball (u0, &1)`); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC + `x IN ball (u0:real^3,r) INTER rcone_gt u0 u1 d` THEN SET_TAC[]); + + (NEW_GOAL `norm (y - u0) = v * norm (u1:real^3 - u0)`); + (ASM_REWRITE_TAC[NORM_MUL]); + + (REWRITE_WITH `abs v = v`); + (REWRITE_TAC[REAL_ABS_REFL]); + (UNDISCH_TAC `u + v = &1` THEN UNDISCH_TAC `u < &0` THEN REAL_ARITH_TAC); + (NEW_GOAL `&2 <= norm (u1 - u0:real^3)`); + (REWRITE_TAC[GSYM dist]); + (UNDISCH_TAC `packing (V:real^3->bool)` THEN REWRITE_TAC[packing]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[MESON[IN] `V x <=> x IN (V:real^3->bool)`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `v * &2 <= v * norm (u1 - u0:real^3)`); + (REWRITE_TAC[REAL_ARITH `a * b <= a * c <=> &0 <= a * (c - b)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (UNDISCH_TAC `u + v = &1` THEN UNDISCH_TAC `u < &0` THEN UP_ASM_TAC); + (REAL_ARITH_TAC); + + (NEW_GOAL `&1 < v`); + (UNDISCH_TAC `u + v = &1` THEN UNDISCH_TAC `u < &0` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN + UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `v < &0`); + (NEW_GOAL `F`); + (NEW_GOAL `(y - u0) dot (u1 - u0:real^3) <= &0`); + (ASM_REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DOT_POS_LE]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `&0 <= dist (x,u0) * dist (u1,u0:real^3) * a'`); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (EXPAND_TAC "a'" THEN MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (REWRITE_TAC[HL_2]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE] THEN REAL_ARITH_TAC); + (MATCH_MP_TAC SQRT_POS_LE THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC + `(y - u0:real^3) dot (u1 - u0) > dist (x,u0) * dist (u1,u0) * a'`); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `&0 <= dist (x,u0) * dist (u1,u0:real^3) * a'`); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (EXPAND_TAC "a'" THEN MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (REWRITE_TAC[HL_2]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE] THEN REAL_ARITH_TAC); + (MATCH_MP_TAC SQRT_POS_LE THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `(y - u1) dot (u0 - u1) = norm (y - u1) * norm (u0 - u1:real^3)`); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ_EQ]); + (REWRITE_WITH `y - u1 = proj_point (u1 - u0) (x - u0:real^3) - (u1 - u0)`); + (EXPAND_TAC "y" THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[PRO_EXP; VECTOR_ARITH `x % a - a = (x - &1) % a`; NORM_MUL; + VECTOR_MUL_ASSOC]); + (REWRITE_WITH ` + (norm (u0 - u1) * + (((x - u0) dot (u1 - u0)) / ((u1 - u0) dot (u1 - u0)) - &1)) % (u1 - u0) = + (norm (u0 - u1:real^3) * + (&1 - ((x - u0) dot (u1 - u0)) / ((u1 - u0) dot (u1 - u0)))) % (u0 - u1)`); + (VECTOR_ARITH_TAC); + (MATCH_MP_TAC (MESON[] `a = b ==> a % x = b % x`)); + (REWRITE_TAC[REAL_ARITH `a * norm b = norm b * a`]); + (REWRITE_TAC[NORM_ARITH `norm (a - b) = norm (b - a)`]); + (MATCH_MP_TAC (MESON[] `a = b ==> x * a = x * b`)); + (REWRITE_TAC[REAL_ARITH `abs (x - &1) = abs (&1 - x)`]); + (REWRITE_TAC[REAL_ABS_REFL; REAL_ARITH `&0 <= a - b <=> b <= a`]); + (REWRITE_WITH `((x - u0) dot (u1 - u0)) / ((u1 - u0) dot (u1 - u0)) <= &1 + <=> ((x - u0) dot (u1 - u0)) <= &1 * ((u1 - u0) dot (u1 - u0:real^3))`); + (MATCH_MP_TAC REAL_LE_LDIV_EQ); + (REWRITE_TAC[DOT_POS_LT; VECTOR_ARITH `a - b = vec 0 <=> b = a`]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(x - u0) dot (u1 - u0) <= norm (x - u0) * norm (u1 - u0:real^3)`); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ]); + + (NEW_GOAL `norm (x - u0) * norm (u1 - u0) <= &1 * norm (u1 - u0:real^3)`); + (REWRITE_TAC[REAL_ARITH `a * x <= b * x <=> &0 <= (b - a) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `&0 <= a - b <=> b <= a`; GSYM dist]); + (MATCH_MP_TAC (REAL_ARITH `a < x ==> a <= x`)); + (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[GSYM IN_BALL]); + (NEW_GOAL `ball (u0:real^3, r) SUBSET ball (u0, &1)`); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC + `x IN ball (u0:real^3,r) INTER rcone_gt u0 u1 d` THEN SET_TAC[]); + (REWRITE_TAC[GSYM NORM_POW_2; REAL_ARITH `&1 * a pow 2 = a * a`]); + (NEW_GOAL `&1 * norm (u1 - u0) <= norm (u1 - u0) * norm (u1 - u0:real^3)`); + (REWRITE_TAC[REAL_ARITH `a * x <= b * x <=> &0 <= (b - a) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `&0 <= a - b <=> b <= a`; GSYM dist]); + (MATCH_MP_TAC (REAL_ARITH `&2 <= x ==> &1 <= x`)); + (UNDISCH_TAC `packing (V:real^3->bool)` THEN REWRITE_TAC[packing]); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[MESON[IN] `V x <=> x IN (V:real^3->bool)`]); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `(x - u0:real^3) dot (u1 - u0) <= + norm (x - u0) * norm (u1 - u0)` THEN + UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[dist]); + (REWRITE_TAC[REAL_ARITH `a * b >= x * b * c <=> &0 <= b * (a - x * c)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `&0 <= a - b <=> b <= a`]); + (MATCH_MP_TAC Tactics_jordan.REAL_POW_2_LE); + (STRIP_TAC); + + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (EXPAND_TAC "a'" THEN MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (REWRITE_TAC[HL_2]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE] THEN REAL_ARITH_TAC); + (MATCH_MP_TAC SQRT_POS_LE THEN REAL_ARITH_TAC); + (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `(a * b) pow 2 = a pow 2 * b pow 2`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `(a + b) * x <= a <=> b * x <= (&1 - x) * a`]); + + (UNDISCH_TAC `(y - u0) dot (u1 - u0) > dist (x,u0) * dist (u1,u0:real^3) * a'`); + (ASM_REWRITE_TAC[dist]); + (REWRITE_TAC[REAL_ARITH `a * b > x * b * c <=> &0 < b * (a - x * c)`]); + (REWRITE_TAC[REAL_MUL_POS_LT]); + (REWRITE_WITH `~(norm (u1 - u0:real^3) < &0 /\ + norm (y - u0) - norm (x - u0) * a' < &0)`); + (NEW_GOAL `&0 <= norm (u1 - u0:real^3)`); + (REWRITE_TAC[NORM_POS_LE]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&0 < a - b <=> b < a`]); + (REWRITE_WITH `norm (x - u0) * a' < norm (y - u0:real^3) <=> + (norm (x - u0) * a') pow 2 < norm (y - u0) pow 2`); + (MATCH_MP_TAC Pack1.bp_bdt); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (EXPAND_TAC "a'" THEN MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (REWRITE_TAC[HL_2]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE] THEN REAL_ARITH_TAC); + (MATCH_MP_TAC SQRT_POS_LE THEN REAL_ARITH_TAC); + (REWRITE_TAC[NORM_POS_LE]); + + (ASM_REWRITE_TAC[REAL_ARITH `(a * b) pow 2 = a pow 2 * b pow 2`]); + (REWRITE_TAC[REAL_ARITH `(a + b) * x < a <=> b * x < (&1 - x) * a`]); + (STRIP_TAC); + + (NEW_GOAL `(&1 - a' pow 2) * norm (y - u0) pow 2 <= + (&1 - a' pow 2) * norm (y - u1:real^3) pow 2`); + (REWRITE_TAC[REAL_ARITH `a * x <= a * y <=> &0 <= a * (y - x)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 <= &1 - b <=> b <= &1 pow 2`]); + (REWRITE_WITH `a' pow 2 <= &1 pow 2 <=> a' <= &1`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.POW2_COND); + (REWRITE_TAC[REAL_ARITH `&0 <= &1`]); + (EXPAND_TAC "a'" THEN MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (REWRITE_TAC[HL_2]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE] THEN REAL_ARITH_TAC); + (MATCH_MP_TAC SQRT_POS_LE THEN REAL_ARITH_TAC); + + (EXPAND_TAC "a'"); + (MATCH_MP_TAC REAL_DIV_LE_1_TACTICS); + (ASM_SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]); + (UNDISCH_TAC `hl [u0; u1:real^3] < sqrt (&2)` THEN REAL_ARITH_TAC); + (NEW_GOAL `norm (x - u0) pow 2 <= norm (x - u1:real^3) pow 2`); + (REWRITE_WITH `norm (x - u0) pow 2 <= norm (x - u1:real^3) pow 2 <=> + norm (x - u0) <= norm (x - u1:real^3)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.POW2_COND); + (REWRITE_TAC[NORM_POS_LE]); + (MATCH_MP_TAC (REAL_ARITH `&2 * x <= x + y ==> x <= y`)); + (REWRITE_TAC[GSYM dist]); + + (NEW_GOAL `dist (x, u0:real^3) < &1`); + (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[GSYM IN_BALL]); + (NEW_GOAL `ball (u0:real^3, r) SUBSET ball (u0, &1)`); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC + `x IN ball (u0:real^3,r) INTER rcone_gt u0 u1 d` THEN SET_TAC[]); + (NEW_GOAL `&2 * dist (x, u0:real^3) < &2`); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (NEW_GOAL `&2 <= dist (x, u0) + dist (x, u1:real^3)`); + (NEW_GOAL `&2 <= dist (u0, u1:real^3)`); + (UNDISCH_TAC `packing (V:real^3->bool)` THEN REWRITE_TAC[packing]); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[MESON[IN] `V a <=> a:real^3 IN V`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `dist (u0, u1:real^3) <= dist (u0, x) + dist (x, u1)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_SYM]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER C:real^3->bool`); + (ASM_SIMP_TAC [SET_RULE `A SUBSET B ==> X INTER A SUBSET X INTER B`]); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2; SET_RULE `{} INTER s = {}`]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `~coplanar {u0, u1:real^3, m, s3}`); + (ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, m, s3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (UP_ASM_TAC THEN MESON_TAC[]); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2]); + (COND_CASES_TAC); + (LET_TAC); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> M INTER N INTER A SUBSET B`)); + + (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `HD vl = u0 /\ HD (TL vl) = u1:real^3`); + (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = v1:real^3`); + (REWRITE_TAC[ASSUME `vl = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_WITH `{u0, u1, m, s3} = {u0, u1} UNION {m:real^3, s3}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[] THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + +(* ========================================================================= *) + (ASM_CASES_TAC `azim u0 u1 m (s3:real^3) < pi`); + (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 m s3)`); + (ASM_SIMP_TAC[WEDGE_LUNE]); + (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`); + (SET_TAC[]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {m, s3} DIFF conic_cap u0 u1 r d INTER L = {}`); + (EXPAND_TAC "L"); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`)); + (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]); + (REWRITE_TAC[SET_RULE `A UNION {} = A`]); + (EXPAND_TAC "L"); + + (REWRITE_WITH `aff_ge {u0, u1:real^3} {m, s3} = + aff_gt {u0, u1} {m, s3} UNION + UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}}`); + (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[DISJOINT]); + + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`); + (REWRITE_WITH `{u0, u1, m, s3} = {u0, u1, s3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `s3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`); + (REWRITE_WITH `{u0, u1, m, s3} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({m, s3} DELETE a) | a | a IN {m, s3}}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `aff_ge {u0, u1:real^3} {m} UNION aff_ge {u0, u1:real^3} {s3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, m}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,m:real^3} = {u0,u1} UNION {m}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, s3}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,s3:real^3} = {u0,u1} UNION {s3}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`)); + (STRIP_TAC); + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`); + (REWRITE_WITH `{u0, u1, m, s3} = {u0, u1, s3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `s3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`); + (REWRITE_WITH `{u0, u1, m, s3} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (SET_TAC[]); + + (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]); + (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 m s3) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 m s3 / &3 * (&1 - max d (-- &1)) * r pow 3)`); + (NEW_GOAL `~collinear {u0:real^3, u1, m} /\ ~collinear {u0, u1, s3}`); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s3:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `azim (u0:real^3) u1 m s3 = dihV u0 u1 m s3`); + (MATCH_MP_TAC AZIM_DIHV_SAME); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s3:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (LET_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(2, vl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN; ARITH_RULE `2 <= 4`] THEN ASM_REWRITE_TAC[]); + (REWRITE_WITH `initial_sublist [u0;u1:real^3] vl /\ LENGTH [u0;u1] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC); + + (NEW_GOAL `k' = 2 /\ mcell k' V ul = mcell 2 V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell k' V ul INTER mcell 2 V vl = X`); + (SET_TAC[ASSUME `X = mcell k' V ul`; + ASSUME `X = mcell k V vl`; ASSUME `k = 2`]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[]); + + (COND_CASES_TAC); + (REWRITE_TAC[dihu2]); + + (REWRITE_WITH `omega_list_n V ul 3 = s3`); + (EXPAND_TAC "s3"); + (NEW_GOAL `2 = 2 /\ + (!k. 2 - 1 <= k /\ k <= 3 + ==> omega_list_n V ul k = omega_list_n V vl k)`); + (MATCH_MP_TAC MCELL_ID_OMEGA_LIST_N); + (ASM_REWRITE_TAC[SET_RULE `2 IN {2,3,4}`]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k' V ul`); GSYM (ASSUME `k' = 2`)]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (FIRST_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + + (REWRITE_WITH `mxi V ul = m`); + (EXPAND_TAC "m"); + (MATCH_MP_TAC MCELL_ID_MXI); + (EXISTS_TAC `2` THEN EXISTS_TAC `2`); + (ASM_REWRITE_TAC[SET_RULE `2 IN {2,3}`]); + (STRIP_TAC); + + (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[HD]); + + (REWRITE_WITH `(HD ul):real^3 = HD (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[HD]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k' V ul`); GSYM (ASSUME `k' = 2`)]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `initial_sublist [u0; u1:real^3] ul /\ LENGTH [u0; u1] = 1 + 1`); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[EL; HD; ARITH_RULE `1 = SUC 0`; TL]); + (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]); + (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]); + (AP_THM_TAC THEN AP_TERM_TAC); + + (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`); + (MATCH_MP_TAC VOLUME_CONIC_CAP); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN MESON_TAC[]); + (UNDISCH_TAC `d < &1` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + + + (REWRITE_WITH `max d (--(&1)) = d`); + (MATCH_MP_TAC (REAL_ARITH `&0 < d /\ --(&1) < &0 ==> max d (--(&1)) = d`)); + (REWRITE_TAC[REAL_NEG_LT0]); + (STRIP_TAC); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) +(* OK here *) + + (ASM_CASES_TAC `azim u0 u1 s3 (m:real^3) < pi`); + (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (STRIP_TAC); + (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 s3 m)`); + (ASM_SIMP_TAC[WEDGE_LUNE]); + (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`); + (SET_TAC[]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + + (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {s3, m} DIFF conic_cap u0 u1 r d INTER L = {}`); + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`)); + (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]); + (REWRITE_TAC[SET_RULE `A UNION {} = A`]); + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]); + + (REWRITE_WITH `aff_ge {u0, u1:real^3} {m, s3} = + aff_gt {u0, u1} {m, s3} UNION + UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}}`); + (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[DISJOINT]); + + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, s3, m:real^3}`); + (REWRITE_WITH `{u0, u1, s3, m} = {u0, u1, s3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `s3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, s3, m:real^3}`); + (REWRITE_WITH `{u0, u1, s3, m} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({m, s3} DELETE a) | a | a IN {m, s3}}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `aff_ge {u0, u1:real^3} {m} UNION aff_ge {u0, u1:real^3} {s3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, m}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,m:real^3} = {u0,u1} UNION {m}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, s3}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,s3:real^3} = {u0,u1} UNION {s3}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`)); + (STRIP_TAC); + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, s3, m:real^3}`); + (REWRITE_WITH `{u0, u1, s3, m} = {u0, u1, s3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `s3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, s3, m:real^3}`); + (REWRITE_WITH `{u0, u1, s3, m} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (SET_TAC[]); + + (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]); + (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 s3 m) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 s3 m / &3 * (&1 - max d (-- &1)) * r pow 3)`); + (NEW_GOAL `~collinear {u0:real^3, u1, m} /\ ~collinear {u0, u1, s3}`); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s3:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ASM_REWRITE_TAC[]); + + (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + + (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `azim (u0:real^3) u1 s3 m = dihV u0 u1 s3 m`); + (MATCH_MP_TAC AZIM_DIHV_SAME); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s3:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (LET_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(2, vl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN; ARITH_RULE `2 <= 4`] THEN ASM_REWRITE_TAC[]); + (REWRITE_WITH `initial_sublist [u0;u1:real^3] vl /\ LENGTH [u0;u1] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC); + + (NEW_GOAL `k' = 2 /\ mcell k' V ul = mcell 2 V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell k' V ul INTER mcell 2 V vl = X`); + (REWRITE_TAC[ASSUME `X = mcell k V vl`; GSYM (ASSUME `X = mcell k' V ul`); + ASSUME `k = 2`]); + (SET_TAC[]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]); + (SET_TAC[]); + (UNDISCH_TAC `~NULLSET X` THEN UP_ASM_TAC THEN MESON_TAC[]); + + (COND_CASES_TAC); + (REWRITE_TAC[dihu2]); + (REWRITE_WITH `omega_list_n V ul 3 = s3`); + (EXPAND_TAC "s3"); + (NEW_GOAL `2 = 2 /\ + (!k. 2 - 1 <= k /\ k <= 3 + ==> omega_list_n V ul k = omega_list_n V vl k)`); + (MATCH_MP_TAC MCELL_ID_OMEGA_LIST_N); + (ASM_REWRITE_TAC[SET_RULE `2 IN {2,3,4}`]); + (STRIP_TAC); + (MESON_TAC[ASSUME `X = mcell k V vl`; ASSUME `X = mcell k' V ul`; + ASSUME `k = 2`; ASSUME `k' = 2`]); + (REWRITE_WITH `mcell 2 V ul = X`); + (MESON_TAC[ASSUME `X = mcell k' V ul`; ASSUME `k' = 2`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + + (REWRITE_WITH `mxi V ul = m`); + (EXPAND_TAC "m"); + (MATCH_MP_TAC MCELL_ID_MXI); + (EXISTS_TAC `2` THEN EXISTS_TAC `2`); + (ASM_REWRITE_TAC[SET_RULE `2 IN {2,3}`]); + (STRIP_TAC); + + (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[HD]); + + (REWRITE_WITH `(HD ul):real^3 = HD (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[HD]); + + (STRIP_TAC); + (MESON_TAC[ASSUME `X = mcell k V vl`; ASSUME `X = mcell k' V ul`; + ASSUME `k = 2`; ASSUME `k' = 2`]); + (REWRITE_WITH `mcell 2 V ul = X`); + (MESON_TAC[ASSUME `X = mcell k' V ul`; ASSUME `k' = 2`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `initial_sublist [u0; u1:real^3] ul /\ LENGTH [u0; u1] = 1 + 1`); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[EL; HD; ARITH_RULE `1 = SUC 0`; TL]); + (REWRITE_TAC[DIHV_SYM_2]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + + (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]); + (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]); + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`); + (MATCH_MP_TAC VOLUME_CONIC_CAP); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (UP_ASM_TAC THEN UNDISCH_TAC `d < &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `&0 < r` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `max d (--(&1)) = d`); + (MATCH_MP_TAC (REAL_ARITH `&0 < d ==> max d (--(&1)) = d`)); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================== *) + + (NEW_GOAL `F`); + (NEW_GOAL `azim (u0:real^3) u1 s3 m = + (if azim u0 u1 m s3 = &0 then &0 else &2 * pi - azim u0 u1 m s3)`); + (MATCH_MP_TAC AZIM_COMPL); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s3:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b, d, c}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN COND_CASES_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `(&0 < pi)`); + (REWRITE_TAC[PI_POS]); + (UNDISCH_TAC `~(azim (u0:real^3) u1 m s3 < pi)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (STRIP_TAC); + + (NEW_GOAL `azim (u0:real^3) u1 m s3 = pi`); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`); + (REWRITE_TAC[] THEN MATCH_MP_TAC AZIM_EQ_0_PI_IMP_COPLANAR); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + +(* ========================================================================= *) +(* Case k >= 4 *) +(* ========================================================================= *) + + (ASM_CASES_TAC `k >= 4`); + (NEW_GOAL `?u2 u3. vl = [u0; u1;u2;u3:real^3]`); + (NEW_GOAL `?v0 v1 u2 u3. vl = [v0; v1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + + (REWRITE_WITH `u0 = v0:real^3`); + (REWRITE_WITH `v0:real^3 = HD (truncate_simplex 1 vl)`); + (REWRITE_TAC[ASSUME `vl = [v0;v1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + + (REWRITE_WITH `u1 = v1:real^3`); + (REWRITE_WITH `v1:real^3 = HD (TL (truncate_simplex 1 vl))`); + (REWRITE_TAC[ASSUME `vl = [v0;v1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ABBREV_TAC `L = aff_ge{u0, u1} {u2, u3:real^3}`); + + (REWRITE_WITH `vol (X INTER D) = vol (L INTER D)`); + (AP_TERM_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4; ARITH_RULE `4 >= 4`;set_of_list]); + (COND_CASES_TAC); + + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `A = B <=> A SUBSET B /\ B SUBSET A`]); + (STRIP_TAC); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> A INTER X SUBSET B INTER X`)); + (REWRITE_TAC[Marchal_cells_2_new.CONVEX_HULL_4_SUBSET_AFF_GE_2_2]); + (MATCH_MP_TAC (SET_RULE `(!x. x IN A /\ x IN B ==> x IN C) ==> + A INTER B SUBSET C INTER B`)); + (NEW_GOAL `DISJOINT {u0,u1:real^3} {u2, u3}`); + (REWRITE_TAC[DISJOINT]); + (MATCH_MP_TAC (MESON[] `(~A:bool ==> F) ==> A`)); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN REWRITE_TAC[SET_RULE `A INTER X SUBSET A`]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (NEW_GOAL `u3 IN {u0, u1:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + + (SIMP_TAC[ASSUME `DISJOINT {u0, u1} {u2, u3:real^3}`; AFF_GE_2_2]); + (REWRITE_TAC[CONVEX_HULL_4; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN + EXISTS_TAC `t3:real` THEN EXISTS_TAC `t4:real`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= a <=> (a < &0 ==> F)`]); + (STRIP_TAC); + (UNDISCH_TAC `conic_cap (u0:real^3) u1 r d x`); + (REWRITE_TAC[MESON[IN] `conic_cap u0 u1 r d x <=> x IN conic_cap u0 u1 r d`; + GSYM (ASSUME `D = conic_cap (u0:real^3) u1 r d`)]); + (EXPAND_TAC "D"); + (REWRITE_TAC[IN_INTER; MESON[] `~(x:bool /\ y) <=> (~x \/ ~y)`]); + (DISJ1_TAC); + (REWRITE_TAC[IN_BALL] THEN STRIP_TAC); + + (NEW_GOAL `(?b1:real. b1 IN P2 /\ (!x. x IN P2 ==> b1 <= x))`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f2:(real^3)list -> real) vl`); + (EXPAND_TAC "P2" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `r2 = (@b. b IN P2 /\ (!x. x IN P2 ==> b <= x:real))`); + (EXPAND_TAC "r2"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f2:(real^3)list -> real) vl`); + (EXPAND_TAC "P2" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[]); + + (ABBREV_TAC `Q1 = (\b:real. b IN P2 /\ (!x. x IN P2 ==> b <= x))`); + (NEW_GOAL `(Q1:real->bool) r2`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b1:real` THEN EXPAND_TAC "Q1"); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "Q1" THEN REPEAT STRIP_TAC); + (NEW_GOAL `r2 <= f2 (vl:(real^3)list)`); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "P2" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + + (UP_ASM_TAC THEN EXPAND_TAC "f2" THEN REWRITE_TAC[EL; HD; TL; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `vl= [u0; u1; u2; u3:real^3]`] THEN STRIP_TAC); + (NEW_GOAL `!v. v IN affine hull {u1, u2, u3:real^3} ==> r2 <= dist (u0, v)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,closest_point (affine hull {u1, u2, u3}) u0) <= + dist (u0, v:real^3)`); + (MATCH_MP_TAC CLOSEST_POINT_LE); + (ASM_REWRITE_TAC[CLOSED_AFFINE_HULL]); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `r <= dist (u0:real^3, x)`); + (REWRITE_TAC[dist]); + (REWRITE_WITH `u0:real^3 - x = (t1 + t2 + t3 + t4) % u0 - x`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ADD_RDISTRIB]); + (ASM_REWRITE_TAC[VECTOR_ARITH `(t1 % u0 + t2 % u0 + t3 % u0 + t4 % u0) - + (t1 % u0 + t2 % u1 + t3 % u2 + t4 % u3) = + (t2 + t3 + t4) % u0 - (t2 % u1 + t3 % u2 + t4 % u3)`]); + (ABBREV_TAC `y:real^3 = t2 /(t2 + t3 + t4) % u1 + + t3 /(t2 + t3 + t4) % u2 + + t4 /(t2 + t3 + t4) % u3`); + (REWRITE_WITH `(t2 % u1 + t3 % u2 + t4 % u3) = (t2 + t3 + t4) % (y:real^3)`); + (EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_ARITH `x % (t2 / x % u1 + t3 / x % u2 + t4 / x % u3) = + (x / x) % (t2 % u1 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `(t2 + t3 + t4) / (t2 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t1 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1`); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `a % x - a % y = a % (x - y)`; NORM_MUL]); + + (NEW_GOAL `&1 < t2 + t3 + t4`); + (UNDISCH_TAC `t1 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1`); + (REAL_ARITH_TAC); + (REWRITE_WITH `abs (t2 + t3 + t4) = t2 + t3 + t4`); + (REWRITE_TAC[REAL_ABS_REFL] THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (REWRITE_TAC[GSYM dist]); + (NEW_GOAL `r2 <= dist (u0, y:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `t2 / (t2 + t3 + t4)` THEN EXISTS_TAC `t3 / (t2 + t3 + t4)` THEN + EXISTS_TAC `t4 / (t2 + t3 + t4)`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `r2 <= (t2 + t3 + t4) * dist (u0,y:real^3)`); + (NEW_GOAL `dist (u0,y) <= (t2 + t3 + t4) * dist (u0,y:real^3)`); + (REWRITE_TAC[REAL_ARITH `a <= b * a <=> &0 <= (b - &1) * a`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (DEL_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (EXPAND_TAC "r" THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `dist (u0, x:real^3) < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + +(* ========================================================================== *) + + + (REWRITE_TAC[REAL_ARITH `&0 <= a <=> (a < &0 ==> F)`]); + (STRIP_TAC); + (UNDISCH_TAC `conic_cap (u0:real^3) u1 r d x`); + (REWRITE_TAC[MESON[IN] `conic_cap u0 u1 r d x <=> x IN conic_cap u0 u1 r d`; + GSYM (ASSUME `D = conic_cap (u0:real^3) u1 r d`)]); + (EXPAND_TAC "D"); + (REWRITE_TAC[IN_INTER; MESON[] `~(x:bool /\ y) <=> (~x \/ ~y)`]); + (DISJ2_TAC); + (REWRITE_TAC[IN; IN_ELIM_THM; rcone_gt; rconesgn] THEN STRIP_TAC); + + (NEW_GOAL `(?b1:real. b1 IN P4 /\ (!x. x IN P4 ==> x <= b1))`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f4:(real^3)list -> real) vl`); + (EXPAND_TAC "P4" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `d2 = (@b. b IN P4 /\ (!x. x IN P4 ==> x <= b:real))`); + (EXPAND_TAC "d2"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f4:(real^3)list -> real) vl`); + (EXPAND_TAC "P4" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[]); + + (ABBREV_TAC `Q1 = (\b:real. b IN P4 /\ (!x. x IN P4 ==> x <= b))`); + (NEW_GOAL `(Q1:real->bool) d2`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b1:real` THEN EXPAND_TAC "Q1"); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "Q1" THEN REPEAT STRIP_TAC); + + (NEW_GOAL `f4 (vl:(real^3)list) <= d2`); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "P4" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + + (UP_ASM_TAC THEN EXPAND_TAC "f4"); + (REWRITE_TAC[EL; HD; TL; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `vl= [u0; u1; u2; u3:real^3]`] THEN STRIP_TAC); + (ABBREV_TAC `xx = smallest_angle_line u2 u3 u0 u1`); + + (MP_TAC (ASSUME `smallest_angle_line u2 u3 u0 u1 = xx`)); + (REWRITE_TAC[smallest_angle_line; smallest_angle_set]); + (ABBREV_TAC `Q2 = + (\x:real^3. x IN convex hull {u2, u3} /\ + (!y. y IN convex hull {u2, u3} + ==> ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0))))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN STRIP_TAC); + (NEW_GOAL `(Q2:real^3->bool) xx`); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXPAND_TAC "Q2"); + + (MATCH_MP_TAC SMALLEST_ANGLE_LINE_EXISTS); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list;ARITH_RULE `4 >= 4`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (UNDISCH_TAC `u0 IN convex hull {u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`); + (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (STRIP_TAC); + (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (UP_ASM_TAC THEN EXPAND_TAC "Q2"); + (STRIP_TAC); + (ABBREV_TAC `g = (\y:real^3. ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)))`); + + (NEW_GOAL `d < (g:real^3->real) x`); + (EXPAND_TAC "g"); + (REWRITE_WITH + `d < ((x - u0) dot (u1 - u0)) / (norm (x - u0) * norm (u1 - u0:real^3)) <=> + d * (norm (x - u0) * norm (u1 - u0)) < (x - u0) dot (u1 - u0)`); + (MATCH_MP_TAC REAL_LT_RDIV_EQ); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a /\ ~(a = &0) ==> &0 < a`)); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[NORM_POS_LE]); + (REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; VECTOR_ARITH `x - y = vec 0 <=> x = y`]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `t1 % u0 + t2 % u1 + t3 % u2 + t4 % u3 = u0:real^3 <=> + t1 % u0 + t2 % u1 + t3 % u2 + t4 % u3 = (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `t1 % u0 + u = (t1 + t2) % u0 <=> u = t2 % u0`]); + (STRIP_TAC); + + (MP_TAC (ASSUME `~NULLSET (X INTER D)`) THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4;set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (REWRITE_TAC[affine_dependent]); + (EXISTS_TAC `u1:real^3`); + (STRIP_TAC); + (SET_TAC[]); + + (NEW_GOAL `~(u1 IN {u0, u2, u3:real^3})`); + (STRIP_TAC); + (MP_TAC (ASSUME `~NULLSET (X INTER D)`) THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4;set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0:real^3,u2, u3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (SET_TAC[]); + (REWRITE_WITH `{u0, u1, u2, u3} DELETE u1 = {u0, u2, u3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `(t2 + t3 + t4) / t2`); + (EXISTS_TAC `(-- t3) / t2`); + (EXISTS_TAC `(-- t4) / t2`); + + (STRIP_TAC); + (REWRITE_WITH `(t2 + t3 + t4) / t2 + --t3 / t2 + --t4 / t2 = t2 / t2`); + (REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_WITH + `u1 = (t2 + t3 + t4) / t2 % u0 + --t3 / t2 % u2 + --t4 / t2 % u3:real^3 <=> + u1 = (&1 / t2) % ((t2 + t3 + t4) % u0 - t3 % u2 - t4 % u3)`); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[GSYM (ASSUME `t2 % u1 + t3 % u2 + t4 % u3 = + (t2 + t3 + t4) % u0:real^3`)]); + (REWRITE_TAC[VECTOR_ARITH + `(t2 % u1 + t3 % u2 + t4 % u3) - t3 % u2 - t4 % u3 = t2 % u1`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC]); + (REWRITE_WITH `&1 / t2 * t2 = &1`); + (REWRITE_TAC[REAL_ARITH `&1 / t2 * t2 = t2 / t2`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + (REWRITE_TAC[REAL_ARITH `a * b * c < d <=> d > b * c * a`; GSYM dist]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `g x <= (g:real^3->real) xx`); + (NEW_GOAL `!y. y IN convex hull {u2 , u3:real^3} ==> g y <= g xx`); + (EXPAND_TAC "g" THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `&0 < (t3 + t4)`); + (MATCH_MP_TAC (REAL_ARITH `(&0 <= x) /\ ~(x = &0) ==> &0 < x`)); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_ADD); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (NEW_GOAL `t3 = &0 /\ t4 = &0`); + (UNDISCH_TAC `&0 <= t3` THEN UNDISCH_TAC `&0 <= t4` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `F`); + (UNDISCH_TAC `(x - u0) dot (u1 - u0:real^3) > dist (x,u0) * dist (u1,u0) * d`); + (REWRITE_WITH `x = t1 % u0 + t2 % u1:real^3`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (MATCH_MP_TAC (REAL_ARITH `a <= &0 /\ &0 <= b ==> ~(a > b)`)); + (STRIP_TAC); + (REWRITE_WITH `(t1 % u0 + t2 % u1) - u0 = (t1 % u0 + t2 % u1) - + (t1 + t2 + t3 + t4) % u0:real^3`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[ASSUME `t3 = &0`; ASSUME `t4 = &0`; VECTOR_ARITH + `(t1 % u0 + t2 % u1) - (t1 + t2 + &0 + &0) % u0 = t2 % (u1 - u0)`; + DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DOT_POS_LE]); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c/\ c < &1`); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ABBREV_TAC `y = t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3:real^3`); + (NEW_GOAL `(g:real^3->real) y <= g xx`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM]); + (EXISTS_TAC `t3 / (t3 + t4)` THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_SIMP_TAC[REAL_LE_ADD]); + (ASM_SIMP_TAC[REAL_LE_ADD; REAL_LE_DIV]); + (REWRITE_TAC[REAL_ARITH `a / x + b / x = (a + b) / x`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (ABBREV_TAC `w = t1 / (t1 + t3 + t4) % u0 + t3 / (t1 + t3 + t4) % u2 + + t4 / (t1 + t3 + t4) % u3:real^3`); + (NEW_GOAL `(g:real^3->real) y = g w`); + (EXPAND_TAC "g"); + + (REWRITE_WITH `y:real^3 - u0 = + &1 / (t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0)`); + (EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_ARITH + `(t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3) - u0 = + &1 / (t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0) <=> + (t3 + t4) / (t3 + t4) % u0 = u0`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; DOT_LMUL]); + + (REWRITE_WITH `w:real^3 - u0 = + &1 / (t1 + t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0)`); + (EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `(t1 / (t1 + t3 + t4) % u0 + + t3 / (t1 + t3 + t4) % u2 + t4 / (t1 + t3 + t4) % u3) - u0 = + &1 / (t1 + t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0) <=> + (t1 + t3 + t4) / (t1 + t3 + t4) % u0 = u0`]); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` + THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; DOT_LMUL]); + (REWRITE_WITH `abs (&1 / (t3 + t4)) = &1 / (t3 + t4)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_SIMP_TAC[REAL_LE_DIV;REAL_LE_ADD; REAL_ARITH `&0 <= &1`]); + (REWRITE_WITH `abs (&1 / (t1 + t3 + t4)) = &1 / (t1 + t3 + t4)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (MATCH_MP_TAC REAL_LE_DIV THEN REWRITE_TAC[REAL_ARITH `&0 <= &1`]); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` + THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `(a * x) / ((a * y) * z) = + (a * x) / (a * (y * z))`]); + (ABBREV_TAC + `a1 = norm (t3 % u2 + t4 % u3 - (t3 + t4) % u0) * norm (u1 - u0:real^3)`); + (NEW_GOAL `~(a1 = &0)`); + (EXPAND_TAC "a1" THEN ASM_REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; + VECTOR_ARITH `(a - b = vec 0 <=> a = b)/\(a + b-c = vec 0 <=> a + b = c)`]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell4; MCELL_EXPLICIT; set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `t3 / (t3 + t4)` + THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 + t3 / (t3 + t4) + t4 / (t3 + t4) = + (t3 + t4) / (t3 + t4)`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `&0 % u1 + t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3 = + (&1 / (t3 + t4)) % (t3 % u2 + t4 % u3)`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + + (NEW_GOAL `~(&1 / (t3 + t4) = &0)`); + (NEW_GOAL `&0 < &1 / (t3 + t4)`); + (MATCH_MP_TAC REAL_LT_DIV); + (ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (REWRITE_WITH + `(&1 / (t3 + t4) * ((t3 % u2 + t4 % u3 - (t3 + t4) % u0) dot (u1 - u0))) / + (&1 / (t3 + t4) * a1) = + ((t3 % u2 + t4 % u3 - (t3 + t4) % u0) dot (u1 - u0:real^3)) / a1`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[Trigonometry1.REAL_DIV_MUL2]); + + (NEW_GOAL `~(&1 / (t1 + t3 + t4) = &0)`); + (NEW_GOAL `&0 < &1 / (t1 + t3 + t4)`); + (MATCH_MP_TAC REAL_LT_DIV); + (ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`]); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (REWRITE_WITH + `(&1 / (t1 + t3 + t4) * ((t3 % u2 + t4 % u3 - (t3 + t4) % u0) dot (u1 - u0))) / + (&1 / (t1 + t3 + t4) * a1) = + ((t3 % u2 + t4 % u3 - (t3 + t4) % u0) dot (u1 - u0:real^3)) / a1`); + (UP_ASM_TAC THEN UNDISCH_TAC `~(a1 = &0)` THEN + MESON_TAC[Trigonometry1.REAL_DIV_MUL2]); + + (NEW_GOAL `(g:real^3->real) x <= g w`); + (EXPAND_TAC "g"); + + (REWRITE_WITH + `((x - u0) dot (u1 - u0:real^3)) / (norm (x - u0) * norm (u1 - u0)) <= + ((w - u0) dot (u1 - u0)) / (norm (w - u0) * norm (u1 - u0)) <=> + ((x - u0) dot (u1 - u0)) * (norm (w - u0) * norm (u1 - u0)) <= + ((w - u0) dot (u1 - u0)) * (norm (x - u0) * norm (u1 - u0))`); + (MATCH_MP_TAC RAT_LEMMA4); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `x - b = vec 0 <=> x = b`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell4; MCELL_EXPLICIT; set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u0, u1, u2, u3} = {u1, u0, u2, u3}`]); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `(t2 + t3 + t4) / t2` THEN EXISTS_TAC `(--t3) / t2` + THEN EXISTS_TAC `(--t4) / t2`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH + `(t2 + t3 + t4) / t2 + --t3 / t2 + --t4 / t2 = t2 / t2`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_WITH `(t2 + t3 + t4) = &1 - t1`); + (UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (NEW_GOAL `u0 - t1 % u0 - t3 % u2 - t4 % u3:real^3 = t2 % u1`); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(&1 - t1) / t2 % u0 + --t3 / t2 % u2 + --t4 / t2 % u3 = + (&1 / t2) % (u0 - t1 % u0 - t3 % u2 - t4 % u3)`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `t2 / t2 = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `x - b = vec 0 <=> x = b`]); + (EXPAND_TAC "w" THEN STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell4; MCELL_EXPLICIT; set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + + (EXISTS_TAC `&0` THEN EXISTS_TAC `t3 / (t3 + t4)` + THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 + t3 / (t3 + t4) + t4 / (t3 + t4) = + (t3 + t4) / (t3 + t4)`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `&0 % u1 + t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3 = + (&1 / (t3 + t4)) % (t3 % u2 + t4 % u3)`]); + (UP_ASM_TAC THEN REWRITE_TAC[VECTOR_ARITH + `t1 / x % u0 + t3 / x % u2 + t4 / x % u3 = + (&1 / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `&1 / (t1 + t3 + t4) % (t1 % u0 + t3 % u2 + t4 % u3) = u0 <=> + t1 % u0 + t3 % u2 + t4 % u3 = (t1 + t3 + t4) % u0:real^3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.CHANGE_SIDE); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 +t3 + t4 = &1` THEN + REAL_ARITH_TAC); + + (REWRITE_TAC[VECTOR_ARITH `t1 % u0 + t3 % u2 + t4 % u3 = (t1 + t3 + t4) % u0 + <=> t3 % u2 + t4 % u3 = (t3 + t4) % u0`]); + (STRIP_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + + (REWRITE_WITH `x = t2 % u1 + (t1 + t3 + t4) % w:real^3`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `x % (t1 /x % u0 + t3 / x % u2 + t4 /x % u3) = + (x / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (ABBREV_TAC `t = t1 + t3 + t4`); + (REWRITE_WITH `(t2 % u1 + t % w) - u0:real^3 = + (t2 % u1 + t % w) - (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `t1 + t2 + t3 + t4 = t2 + t:real`); + (EXPAND_TAC "t" THEN REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH + `(t2 % u1 + t % w) - (t2 + t) % u0 = t2 % (u1 - u0) + t % (w - u0)`]); + (ABBREV_TAC `x1 = u1 - u0:real^3`); + (ABBREV_TAC `x2 = w - u0:real^3`); + + (REWRITE_WITH `(t2 % x1 + t % x2) dot x1 = + t2 * norm x1 pow 2 + t * x2 dot (x1:real^3)`); + (REWRITE_TAC[NORM_POW_2]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `t2 * norm x1 pow 2 * norm x2 * norm x1 <= + t2 * (x2 dot x1) * norm x1 * norm (x1:real^3)`); + (REWRITE_TAC[REAL_POW_2; REAL_ARITH `t2 * (x1 * x1) * x2 * x1 <= + t2 * x3 * x1 * x1 <=> &0 <= (x1 pow 2) * (--t2) * (x2 * x1 - x3)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[REAL_LE_MUL; NORM_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (STRIP_TAC); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ]); + + (NEW_GOAL + `t2 * (x2 dot x1) * norm x1 * norm x1 + t * (x2 dot x1) * norm x2 * norm x1 <= + (x2 dot x1) * norm (t2 % x1 + t % x2) * norm (x1:real^3)`); + + (REWRITE_TAC[REAL_ARITH `t2 * x3 * x1 * x1 + t * x3 * x2 * x1 <= + x3 * x4 * x1 <=> &0 <= (x1 * x3) * (x4 - t2 * x1 - t * x2)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_CASES_TAC `x2 dot (x1:real^3) < &0`); + (NEW_GOAL `F`); + (NEW_GOAL `(g:real^3->real) x <= &0`); + (EXPAND_TAC "g"); + (REWRITE_TAC[REAL_ARITH `a / b <= &0 <=> &0 <= (--a) / b`]); + (MATCH_MP_TAC REAL_LE_DIV); + (SIMP_TAC[NORM_POS_LE; REAL_LE_MUL]); + + (REWRITE_WITH `x = t2 % u1 + (t1 + t3 + t4) % w:real^3`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `x % (t1 /x % u0 + t3 / x % u2 + t4 /x % u3) = + (x / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (EXPAND_TAC "t"); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= --a <=> a <= &0`]); + (REWRITE_WITH `(t2 % u1 + (t1 + t3 + t4) % w) - u0:real^3 = + (t2 % u1 + (t1 + t3 + t4) % w) - (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `(t2 % u1 + (t1 + t3 + t4) % w) - (t1 + t2 + t3 + t4) % u0 = + t2 % x1 + t % x2:real^3`); + (EXPAND_TAC "x1" THEN EXPAND_TAC "x2" THEN EXPAND_TAC "t" + THEN VECTOR_ARITH_TAC); + (NEW_GOAL `t % x2 dot (x1:real^3) <= &0`); + (REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= a * (--b)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (NEW_GOAL `t2 % x1 dot (x1:real^3) <= &0`); + (REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (REWRITE_TAC[DOT_POS_LE]); + (REWRITE_TAC[DOT_LADD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `d < (g:real^3->real) x`); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1`); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (REWRITE_TAC [REAL_ARITH `&0 <= a - b * d - c <=> c <= a + (--b) * d`]); + (REWRITE_WITH `t * norm (x2:real^3) = abs t * norm x2`); + (AP_THM_TAC THEN AP_TERM_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[REAL_ABS_REFL]); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (REWRITE_WITH `(--t2) * norm (x1:real^3) = abs (--t2) * norm x1`); + (AP_THM_TAC THEN AP_TERM_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[REAL_ABS_REFL]); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_TAC[GSYM NORM_MUL]); + (REWRITE_WITH + `norm (t % x2:real^3) = norm ((t2 % x1 + t % x2) + (--t2 % x1))`); + (AP_TERM_TAC THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_TRIANGLE]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `(g:real^3->real) y <= g xx`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `(g:real^3->real) xx <= d2`); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "P4"); + (EXPAND_TAC "g" THEN EXPAND_TAC "f4"); + (REWRITE_TAC[IN_ELIM_THM; IN]); + (EXISTS_TAC `vl:(real^3)list`); + (REWRITE_TAC[ASSUME `barV V 3 vl`; ASSUME `vl = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1]); + (SIMP_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (EXPAND_TAC "xx"); + (SIMP_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `mcell 4 V vl = mcell k V vl`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k V vl`)]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN EXPAND_TAC "d"); + (REAL_ARITH_TAC); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell4; MCELL_EXPLICIT; set_of_list]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + +(* ========================================================================= *) + + (NEW_GOAL `~coplanar {u0, u1, u2, u3:real^3}`); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell4; MCELL_EXPLICIT; set_of_list]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (ASM_REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (ASM_CASES_TAC `azim u0 u1 u2 (u3:real^3) < pi`); + (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 u2 u3)`); + (ASM_SIMP_TAC[WEDGE_LUNE]); + (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`); + (SET_TAC[]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {u2, u3} DIFF conic_cap u0 u1 r d INTER L = {}`); + (EXPAND_TAC "L"); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`)); + (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]); + (REWRITE_TAC[SET_RULE `A UNION {} = A`]); + (EXPAND_TAC "L"); + + (REWRITE_WITH `aff_ge {u0, u1:real^3} {u2, u3} = + aff_gt {u0, u1} {u2, u3} UNION + UNIONS {aff_ge {u0, u1} ({u2, u3} DELETE a) | a | a IN {u2, u3}}`); + (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[DISJOINT]); + + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `u3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({u2, u3} DELETE a) | a | a IN {u2, u3}}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `aff_ge {u0, u1:real^3} {u2} UNION aff_ge {u0, u1:real^3} {u3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, u2}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,u2:real^3} = {u0,u1} UNION {u2}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, u3}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,u3:real^3} = {u0,u1} UNION {u3}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`)); + (STRIP_TAC); + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `u3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (SET_TAC[]); + +(* begin the computation *) + + (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]); + (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 u2 u3) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 u2 u3 / &3 * (&1 - max d (-- &1)) * r pow 3)`); + (NEW_GOAL `~collinear {u0:real^3, u1, u2} /\ ~collinear {u0, u1, u3}`); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `azim (u0:real^3) u1 u2 u3 = dihV u0 u1 u2 u3`); + (MATCH_MP_TAC AZIM_DIHV_SAME); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (LET_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(4, vl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN; ARITH_RULE `4 <= 4`] THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + + (REWRITE_WITH `initial_sublist [u0;u1:real^3] [u0; u1; u2; u3] /\ + LENGTH [u0;u1] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC); + + (NEW_GOAL `k' = 4 /\ mcell k' V ul = mcell 4 V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `mcell k' V ul INTER mcell 4 V vl = X`); + (REWRITE_WITH `mcell 4 V vl = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (SET_TAC[ASSUME `X = mcell k' V ul`]); + + (REPEAT STRIP_TAC); + (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + + (REWRITE_TAC[dihu4]); + + (REWRITE_WITH `dihV (EL 0 (ul:(real^3)list)) (EL 1 ul) (EL 2 ul) (EL 3 ul) = + dihV u0 u1 u2 (u3:real^3)`); + + (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `{EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = {u0, u1,u2,u3:real^3}`); + (REWRITE_WITH ` + {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = {u0, u1,u2,u3:real^3} <=> + convex hull {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = + convex hull {u0, u1,u2,u3:real^3}`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2, v3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (UNDISCH_TAC + `affine_dependent {EL 0 ul, EL 1 ul, EL 2 ul, (EL 3 ul):real^3}`); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (REWRITE_WITH `convex hull {u0, u1, u2, u3:real^3} = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]); + (COND_CASES_TAC); + (MESON_TAC[]); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[set_of_list; ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `1 = SUC 0`]); + (STRIP_TAC); + + (ASM_CASES_TAC `EL 2 ul = u2:real^3`); + (NEW_GOAL `EL 3 ul = u3:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,u2,u3:real^3}` THEN REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2:real^3}`; COPLANAR_3]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `EL 2 ul = u3:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0:real^3, u1, EL 2 ul, EL 3 ul} = {u0, u1, EL 3 ul}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,u2,u3:real^3}` THEN REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0,u1:real^3, EL 3 ul}`; COPLANAR_3]); + + (NEW_GOAL `EL 3 ul = u2:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u3:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,u2,u3:real^3}` THEN REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u3:real^3}`; COPLANAR_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[DIHV_SYM_2]); + + (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]); + (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]); + (AP_THM_TAC THEN AP_TERM_TAC); + + (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`); + (MATCH_MP_TAC VOLUME_CONIC_CAP); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN MESON_TAC[]); + (UNDISCH_TAC `d < &1` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + + (REWRITE_WITH `max d (--(&1)) = d`); + (MATCH_MP_TAC (REAL_ARITH `&0 < d /\ --(&1) < &0 ==> max d (--(&1)) = d`)); + (REWRITE_TAC[REAL_NEG_LT0]); + (STRIP_TAC); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UNDISCH_TAC `k' = 4 /\ mcell k' V ul = mcell 4 V vl` + THEN MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) +(* OK here *) + + (ASM_CASES_TAC `azim u0 u1 u3 (u2:real^3) < pi`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (STRIP_TAC); + (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 u3 u2)`); + (ASM_SIMP_TAC[WEDGE_LUNE]); + (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`); + (SET_TAC[]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + + (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {u3, u2} DIFF conic_cap u0 u1 r d INTER L = {}`); + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`)); + (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]); + (REWRITE_TAC[SET_RULE `A UNION {} = A`]); + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]); + + (REWRITE_WITH `aff_ge {u0, u1:real^3} {u2, u3} = + aff_gt {u0, u1} {u2, u3} UNION + UNIONS {aff_ge {u0, u1} ({u2, u3} DELETE a) | a | a IN {u2, u3}}`); + (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[DISJOINT]); + + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u3, u2:real^3}`); + (REWRITE_WITH `{u0, u1, u3, u2} = {u0, u1, u3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `u3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u3, u2:real^3}`); + (REWRITE_WITH `{u0, u1, u3, u2} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({u2, u3} DELETE a) | a | a IN {u2, u3}}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `aff_ge {u0, u1:real^3} {u2} UNION aff_ge {u0, u1:real^3} {u3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, u2}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,u2:real^3} = {u0,u1} UNION {u2}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, u3}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,u3:real^3} = {u0,u1} UNION {u3}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`)); + (STRIP_TAC); + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u3, u2:real^3}`); + (REWRITE_WITH `{u0, u1, u3, u2} = {u0, u1, u3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `u3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u3, u2:real^3}`); + (REWRITE_WITH `{u0, u1, u3, u2} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (SET_TAC[]); + + (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]); + (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 u3 u2) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 u3 u2 / &3 * (&1 - max d (-- &1)) * r pow 3)`); + (NEW_GOAL `~collinear {u0:real^3, u1, u2} /\ ~collinear {u0, u1, u3}`); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u3:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ASM_REWRITE_TAC[]); + + (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + + (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `azim (u0:real^3) u1 u3 u2 = dihV u0 u1 u3 u2`); + (MATCH_MP_TAC AZIM_DIHV_SAME); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u3:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (LET_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(4, vl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN; ARITH_RULE `4 <= 4`] THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + + (REWRITE_WITH `initial_sublist [u0;u1:real^3] [u0; u1; u2; u3] /\ + LENGTH [u0;u1] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC); + + (NEW_GOAL `k' = 4 /\ mcell k' V ul = mcell 4 V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `mcell k' V ul INTER mcell 4 V vl = X`); + (REWRITE_WITH `mcell 4 V vl = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (SET_TAC[ASSUME `X = mcell k' V ul`]); + + (REPEAT STRIP_TAC); + (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + + (REWRITE_TAC[dihu4]); + + (REWRITE_WITH `dihV (EL 0 (ul:(real^3)list)) (EL 1 ul) (EL 2 ul) (EL 3 ul) = + dihV u0 u1 u2 (u3:real^3)`); + + (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `{EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = {u0, u1,u2,u3:real^3}`); + (REWRITE_WITH ` + {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = {u0, u1,u2,u3:real^3} <=> + convex hull {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = + convex hull {u0, u1,u2,u3:real^3}`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2, v3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (UNDISCH_TAC + `affine_dependent {EL 0 ul, EL 1 ul, EL 2 ul, (EL 3 ul):real^3}`); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (REWRITE_WITH `convex hull {u0, u1, u2, u3:real^3} = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]); + (COND_CASES_TAC); + (MESON_TAC[]); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[set_of_list; ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `1 = SUC 0`]); + (STRIP_TAC); + + (ASM_CASES_TAC `EL 2 ul = u2:real^3`); + (NEW_GOAL `EL 3 ul = u3:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,u3,u2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2:real^3}`; COPLANAR_3]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `EL 2 ul = u3:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0:real^3, u1, EL 2 ul, EL 3 ul} = {u0, u1, EL 3 ul}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,u3,u2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + + + (REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0,u1:real^3, EL 3 ul}`; COPLANAR_3]); + (NEW_GOAL `EL 3 ul = u2:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u3:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,u3,u2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + + (REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u3:real^3}`; COPLANAR_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[DIHV_SYM_2]); + + (REWRITE_TAC[DIHV_SYM_2]); + (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]); + (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]); + (AP_THM_TAC THEN AP_TERM_TAC); + + (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`); + (MATCH_MP_TAC VOLUME_CONIC_CAP); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN MESON_TAC[]); + (UNDISCH_TAC `d < &1` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `max d (--(&1)) = d`); + (MATCH_MP_TAC (REAL_ARITH `&0 < d /\ --(&1) < &0 ==> max d (--(&1)) = d`)); + (REWRITE_TAC[REAL_NEG_LT0]); + (STRIP_TAC); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UNDISCH_TAC `k' = 4 /\ mcell k' V ul = mcell 4 V vl` + THEN MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================== *) + + (NEW_GOAL `F`); + (NEW_GOAL `azim (u0:real^3) u1 u3 u2 = + (if azim u0 u1 u2 u3 = &0 then &0 else &2 * pi - azim u0 u1 u2 u3)`); + (MATCH_MP_TAC AZIM_COMPL); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b, d, c}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN COND_CASES_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `(&0 < pi)`); + (REWRITE_TAC[PI_POS]); + (UNDISCH_TAC `~(azim (u0:real^3) u1 u2 u3 < pi)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (STRIP_TAC); + + (NEW_GOAL `azim (u0:real^3) u1 u2 u3 = pi`); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[] THEN MATCH_MP_TAC AZIM_EQ_0_PI_IMP_COPLANAR); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) +(* Case k = 3 *) +(* ========================================================================= *) + + (NEW_GOAL `k = 3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC `2 <= k` THEN ARITH_TAC); + (NEW_GOAL `?u2 u3. vl = [u0; u1;u2;u3:real^3]`); + (NEW_GOAL `?v0 v1 u2 u3. vl = [v0; v1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + + (REWRITE_WITH `u0 = v0:real^3`); + (REWRITE_WITH `v0:real^3 = HD (truncate_simplex 1 vl)`); + (REWRITE_TAC[ASSUME `vl = [v0;v1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + + (REWRITE_WITH `u1 = v1:real^3`); + (REWRITE_WITH `v1:real^3 = HD (TL (truncate_simplex 1 vl))`); + (REWRITE_TAC[ASSUME `vl = [v0;v1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ABBREV_TAC `L = aff_ge{u0, u1} {u2, mxi V vl}`); + + (REWRITE_WITH `vol (X INTER D) = vol (L INTER D)`); + (AP_TERM_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; + mcell3; set_of_list; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (COND_CASES_TAC); + (ABBREV_TAC `m = mxi V vl`); + (REWRITE_WITH `mxi V [u0; u1; u2; u3] = m`); + (EXPAND_TAC "m" THEN DEL_TAC THEN ASM_REWRITE_TAC[]); + + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `A = B <=> A SUBSET B /\ B SUBSET A`]); + (STRIP_TAC); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> A INTER X SUBSET B INTER X`)); + (REWRITE_TAC[Marchal_cells_2_new.CONVEX_HULL_4_SUBSET_AFF_GE_2_2]); + (MATCH_MP_TAC (SET_RULE `(!x. x IN A /\ x IN B ==> x IN C) ==> + A INTER B SUBSET C INTER B`)); + (NEW_GOAL `DISJOINT {u0,u1:real^3} {u2, m}`); + (REWRITE_TAC[DISJOINT]); + (MATCH_MP_TAC (MESON[] `(~A:bool ==> F) ==> A`)); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN REWRITE_TAC[SET_RULE `A INTER X SUBSET A`]); + + + (ASM_SIMP_TAC[MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; + mcell3; set_of_list; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0; u1; u2; u3] = m`); + (EXPAND_TAC "m" THEN REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (NEW_GOAL `m IN {u0, u1:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + + (SIMP_TAC[ASSUME `DISJOINT {u0, u1} {u2, m:real^3}`; AFF_GE_2_2]); + (REWRITE_TAC[CONVEX_HULL_4; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN + EXISTS_TAC `t3:real` THEN EXISTS_TAC `t4:real`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= a <=> (a < &0 ==> F)`]); + (STRIP_TAC); + (UNDISCH_TAC `conic_cap (u0:real^3) u1 r d x`); + (REWRITE_TAC[MESON[IN] `conic_cap u0 u1 r d x <=> x IN conic_cap u0 u1 r d`; + GSYM (ASSUME `D = conic_cap (u0:real^3) u1 r d`)]); + (EXPAND_TAC "D"); + (REWRITE_TAC[IN_INTER; MESON[] `~(x:bool /\ y) <=> (~x \/ ~y)`]); + (DISJ1_TAC); + (REWRITE_TAC[IN_BALL] THEN STRIP_TAC); + + (NEW_GOAL `(?b1:real. b1 IN P1 /\ (!x. x IN P1 ==> b1 <= x))`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f1:(real^3)list -> real) vl`); + (EXPAND_TAC "P1" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `r1 = (@b. b IN P1 /\ (!x. x IN P1 ==> b <= x:real))`); + (EXPAND_TAC "r1"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f1:(real^3)list -> real) vl`); + (EXPAND_TAC "P1" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[]); + + (ABBREV_TAC `Q1 = (\b:real. b IN P1 /\ (!x. x IN P1 ==> b <= x))`); + (NEW_GOAL `(Q1:real->bool) r1`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b1:real` THEN EXPAND_TAC "Q1"); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "Q1" THEN REPEAT STRIP_TAC); + (NEW_GOAL `r1 <= f1 (vl:(real^3)list)`); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "P1" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + + (UP_ASM_TAC THEN EXPAND_TAC "f1" THEN REWRITE_TAC[EL; HD; TL; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `vl= [u0; u1; u2; u3:real^3]`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0;u1;u2;u3:real^3]`]); + (STRIP_TAC); + + (NEW_GOAL `!v. v IN affine hull {u1, u2, m:real^3} ==> r1 <= dist (u0, v)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,closest_point (affine hull {u1, u2, m}) u0) <= + dist (u0, v:real^3)`); + (MATCH_MP_TAC CLOSEST_POINT_LE); + (ASM_REWRITE_TAC[CLOSED_AFFINE_HULL]); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `r <= dist (u0:real^3, x)`); + (REWRITE_TAC[dist]); + (REWRITE_WITH `u0:real^3 - x = (t1 + t2 + t3 + t4) % u0 - x`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ADD_RDISTRIB]); + (ASM_REWRITE_TAC[VECTOR_ARITH `(t1 % u0 + t2 % u0 + t3 % u0 + t4 % u0) - + (t1 % u0 + t2 % u1 + t3 % u2 + t4 % u3) = + (t2 + t3 + t4) % u0 - (t2 % u1 + t3 % u2 + t4 % u3)`]); + (ABBREV_TAC `y:real^3 = t2 /(t2 + t3 + t4) % u1 + + t3 /(t2 + t3 + t4) % u2 + + t4 /(t2 + t3 + t4) % m`); + (REWRITE_WITH `(t2 % u1 + t3 % u2 + t4 % m) = (t2 + t3 + t4) % (y:real^3)`); + (EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_ARITH `x % (t2 / x % u1 + t3 / x % u2 + t4 / x % u3) = + (x / x) % (t2 % u1 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `(t2 + t3 + t4) / (t2 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t1 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1`); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `a % x - a % y = a % (x - y)`; NORM_MUL]); + + (NEW_GOAL `&1 < t2 + t3 + t4`); + (UNDISCH_TAC `t1 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1`); + (REAL_ARITH_TAC); + (REWRITE_WITH `abs (t2 + t3 + t4) = t2 + t3 + t4`); + (REWRITE_TAC[REAL_ABS_REFL] THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (REWRITE_TAC[GSYM dist]); + (NEW_GOAL `r1 <= dist (u0, y:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `t2 / (t2 + t3 + t4)` THEN EXISTS_TAC `t3 / (t2 + t3 + t4)` THEN + EXISTS_TAC `t4 / (t2 + t3 + t4)`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `r1 <= (t2 + t3 + t4) * dist (u0,y:real^3)`); + (NEW_GOAL `dist (u0,y) <= (t2 + t3 + t4) * dist (u0,y:real^3)`); + (REWRITE_TAC[REAL_ARITH `a <= b * a <=> &0 <= (b - &1) * a`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (DEL_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (EXPAND_TAC "r" THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `dist (u0, x:real^3) < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + +(* ========================================================================== *) + + (REWRITE_TAC[REAL_ARITH `&0 <= a <=> (a < &0 ==> F)`]); + (STRIP_TAC); + (UNDISCH_TAC `conic_cap (u0:real^3) u1 r d x`); + (REWRITE_TAC[MESON[IN] `conic_cap u0 u1 r d x <=> x IN conic_cap u0 u1 r d`; + GSYM (ASSUME `D = conic_cap (u0:real^3) u1 r d`)]); + (EXPAND_TAC "D"); + (REWRITE_TAC[IN_INTER; MESON[] `~(x:bool /\ y) <=> (~x \/ ~y)`]); + (DISJ2_TAC); + (REWRITE_TAC[IN; IN_ELIM_THM; rcone_gt; rconesgn] THEN STRIP_TAC); + + (NEW_GOAL `(?b1:real. b1 IN P3 /\ (!x. x IN P3 ==> x <= b1))`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f3:(real^3)list -> real) vl`); + (EXPAND_TAC "P3" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `d1 = (@b. b IN P3 /\ (!x. x IN P3 ==> x <= b:real))`); + (EXPAND_TAC "d1"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f3:(real^3)list -> real) vl`); + (EXPAND_TAC "P3" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[]); + + (ABBREV_TAC `Q1 = (\b:real. b IN P3 /\ (!x. x IN P3 ==> x <= b))`); + (NEW_GOAL `(Q1:real->bool) d1`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b1:real` THEN EXPAND_TAC "Q1"); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "Q1" THEN REPEAT STRIP_TAC); + + (NEW_GOAL `f3 (vl:(real^3)list) <= d1`); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "P3" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + + (UP_ASM_TAC THEN EXPAND_TAC "f3"); + (REWRITE_TAC[EL; HD; TL; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; ASSUME `mxi V vl = m`; + ASSUME `vl= [u0; u1; u2; u3:real^3]`] THEN STRIP_TAC); + + (ABBREV_TAC `xx = smallest_angle_line u2 m u0 u1`); + + (MP_TAC (ASSUME `smallest_angle_line u2 m u0 u1 = xx`)); + (REWRITE_TAC[smallest_angle_line; smallest_angle_set]); + (ABBREV_TAC `Q2 = + (\x:real^3. x IN convex hull {u2, m} /\ + (!y. y IN convex hull {u2, m} + ==> ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0))))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN STRIP_TAC); + (NEW_GOAL `(Q2:real^3->bool) xx`); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXPAND_TAC "Q2"); + + (MATCH_MP_TAC SMALLEST_ANGLE_LINE_EXISTS); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell3; set_of_list;TRUNCATE_SIMPLEX_EXPLICIT_2; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (UNDISCH_TAC `u0 IN convex hull {u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `m:real^3`); + (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (STRIP_TAC); + (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (UP_ASM_TAC THEN EXPAND_TAC "Q2"); + (STRIP_TAC); + (ABBREV_TAC `g = (\y:real^3. ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)))`); + + (NEW_GOAL `d < (g:real^3->real) x`); + (EXPAND_TAC "g"); + (REWRITE_WITH + `d < ((x - u0) dot (u1 - u0)) / (norm (x - u0) * norm (u1 - u0:real^3)) <=> + d * (norm (x - u0) * norm (u1 - u0)) < (x - u0) dot (u1 - u0)`); + (MATCH_MP_TAC REAL_LT_RDIV_EQ); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a /\ ~(a = &0) ==> &0 < a`)); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[NORM_POS_LE]); + (REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; VECTOR_ARITH `x - y = vec 0 <=> x = y`]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `t1 % u0 + t2 % u1 + t3 % u2 + t4 % m = u0:real^3 <=> + t1 % u0 + t2 % u1 + t3 % u2 + t4 % m = (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `t1 % u0 + u = (t1 + t2) % u0 <=> u = t2 % u0`]); + (STRIP_TAC); + + (MP_TAC (ASSUME `~NULLSET (X INTER D)`) THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell3;set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (REWRITE_TAC[affine_dependent]); + (EXISTS_TAC `u1:real^3`); + (STRIP_TAC); + (SET_TAC[]); + + (NEW_GOAL `~(u1 IN {u0, u2, m:real^3})`); + (STRIP_TAC); + (MP_TAC (ASSUME `~NULLSET (X INTER D)`) THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell3;set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_WITH `{u0, u1, u2, m} = {u0:real^3,u2, m}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (SET_TAC[]); + (REWRITE_WITH `{u0, u1, u2, m} DELETE u1 = {u0, u2, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `(t2 + t3 + t4) / t2`); + (EXISTS_TAC `(-- t3) / t2`); + (EXISTS_TAC `(-- t4) / t2`); + + (STRIP_TAC); + (REWRITE_WITH `(t2 + t3 + t4) / t2 + --t3 / t2 + --t4 / t2 = t2 / t2`); + (REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_WITH + `u1 = (t2 + t3 + t4) / t2 % u0 + --t3 / t2 % u2 + --t4 / t2 % m:real^3 <=> + u1 = (&1 / t2) % ((t2 + t3 + t4) % u0 - t3 % u2 - t4 % m)`); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[GSYM (ASSUME `t2 % u1 + t3 % u2 + t4 % m = + (t2 + t3 + t4) % u0:real^3`)]); + (REWRITE_TAC[VECTOR_ARITH + `(t2 % u1 + t3 % u2 + t4 % u3) - t3 % u2 - t4 % u3 = t2 % u1`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC]); + (REWRITE_WITH `&1 / t2 * t2 = &1`); + (REWRITE_TAC[REAL_ARITH `&1 / t2 * t2 = t2 / t2`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + (REWRITE_TAC[REAL_ARITH `a * b * c < d <=> d > b * c * a`; GSYM dist]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `g x <= (g:real^3->real) xx`); + (NEW_GOAL `!y. y IN convex hull {u2 , m:real^3} ==> g y <= g xx`); + (EXPAND_TAC "g" THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `&0 < (t3 + t4)`); + (MATCH_MP_TAC (REAL_ARITH `(&0 <= x) /\ ~(x = &0) ==> &0 < x`)); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_ADD); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (NEW_GOAL `t3 = &0 /\ t4 = &0`); + (UNDISCH_TAC `&0 <= t3` THEN UNDISCH_TAC `&0 <= t4` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `F`); + (UNDISCH_TAC `(x - u0) dot (u1 - u0:real^3) > dist (x,u0) * dist (u1,u0) * d`); + (REWRITE_WITH `x = t1 % u0 + t2 % u1:real^3`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (MATCH_MP_TAC (REAL_ARITH `a <= &0 /\ &0 <= b ==> ~(a > b)`)); + (STRIP_TAC); + (REWRITE_WITH `(t1 % u0 + t2 % u1) - u0 = (t1 % u0 + t2 % u1) - + (t1 + t2 + t3 + t4) % u0:real^3`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[ASSUME `t3 = &0`; ASSUME `t4 = &0`; VECTOR_ARITH + `(t1 % u0 + t2 % u1) - (t1 + t2 + &0 + &0) % u0 = t2 % (u1 - u0)`; + DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DOT_POS_LE]); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c/\ c < &1`); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ABBREV_TAC `y = t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % m:real^3`); + (NEW_GOAL `(g:real^3->real) y <= g xx`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM]); + (EXISTS_TAC `t3 / (t3 + t4)` THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_SIMP_TAC[REAL_LE_ADD]); + (ASM_SIMP_TAC[REAL_LE_ADD; REAL_LE_DIV]); + (REWRITE_TAC[REAL_ARITH `a / x + b / x = (a + b) / x`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (ABBREV_TAC `w = t1 / (t1 + t3 + t4) % u0 + t3 / (t1 + t3 + t4) % u2 + + t4 / (t1 + t3 + t4) % m:real^3`); + (NEW_GOAL `(g:real^3->real) y = g w`); + (EXPAND_TAC "g"); + + (REWRITE_WITH `y:real^3 - u0 = + &1 / (t3 + t4) % (t3 % u2 + t4 % m - (t3 + t4) % u0)`); + (EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_ARITH + `(t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3) - u0 = + &1 / (t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0) <=> + (t3 + t4) / (t3 + t4) % u0 = u0`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; DOT_LMUL]); + + (REWRITE_WITH `w:real^3 - u0 = + &1 / (t1 + t3 + t4) % (t3 % u2 + t4 % m - (t3 + t4) % u0)`); + (EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `(t1 / (t1 + t3 + t4) % u0 + + t3 / (t1 + t3 + t4) % u2 + t4 / (t1 + t3 + t4) % u3) - u0 = + &1 / (t1 + t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0) <=> + (t1 + t3 + t4) / (t1 + t3 + t4) % u0 = u0`]); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` + THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; DOT_LMUL]); + (REWRITE_WITH `abs (&1 / (t3 + t4)) = &1 / (t3 + t4)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_SIMP_TAC[REAL_LE_DIV;REAL_LE_ADD; REAL_ARITH `&0 <= &1`]); + (REWRITE_WITH `abs (&1 / (t1 + t3 + t4)) = &1 / (t1 + t3 + t4)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (MATCH_MP_TAC REAL_LE_DIV THEN REWRITE_TAC[REAL_ARITH `&0 <= &1`]); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` + THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `(a * x) / ((a * y) * z) = + (a * x) / (a * (y * z))`]); + (ABBREV_TAC + `a1 = norm (t3 % u2 + t4 % m - (t3 + t4) % u0) * norm (u1 - u0:real^3)`); + (NEW_GOAL `~(a1 = &0)`); + (EXPAND_TAC "a1" THEN ASM_REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; + VECTOR_ARITH `(a - b = vec 0 <=> a = b)/\(a + b-c = vec 0 <=> a + b = c)`]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; + set_of_list; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `m:real^3`); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `t3 / (t3 + t4)` + THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 + t3 / (t3 + t4) + t4 / (t3 + t4) = + (t3 + t4) / (t3 + t4)`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `&0 % u1 + t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3 = + (&1 / (t3 + t4)) % (t3 % u2 + t4 % u3)`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + + (NEW_GOAL `~(&1 / (t3 + t4) = &0)`); + (NEW_GOAL `&0 < &1 / (t3 + t4)`); + (MATCH_MP_TAC REAL_LT_DIV); + (ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (REWRITE_WITH + `(&1 / (t3 + t4) * ((t3 % u2 + t4 % m - (t3 + t4) % u0) dot (u1 - u0))) / + (&1 / (t3 + t4) * a1) = + ((t3 % u2 + t4 % m - (t3 + t4) % u0) dot (u1 - u0:real^3)) / a1`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[Trigonometry1.REAL_DIV_MUL2]); + + (NEW_GOAL `~(&1 / (t1 + t3 + t4) = &0)`); + (NEW_GOAL `&0 < &1 / (t1 + t3 + t4)`); + (MATCH_MP_TAC REAL_LT_DIV); + (ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`]); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (REWRITE_WITH + `(&1 / (t1 + t3 + t4) * ((t3 % u2 + t4 % m - (t3 + t4) % u0) dot (u1 - u0))) / + (&1 / (t1 + t3 + t4) * a1) = + ((t3 % u2 + t4 % m - (t3 + t4) % u0) dot (u1 - u0:real^3)) / a1`); + (UP_ASM_TAC THEN UNDISCH_TAC `~(a1 = &0)` THEN + MESON_TAC[Trigonometry1.REAL_DIV_MUL2]); + + (NEW_GOAL `(g:real^3->real) x <= g w`); + (EXPAND_TAC "g"); + + (REWRITE_WITH + `((x - u0) dot (u1 - u0:real^3)) / (norm (x - u0) * norm (u1 - u0)) <= + ((w - u0) dot (u1 - u0)) / (norm (w - u0) * norm (u1 - u0)) <=> + ((x - u0) dot (u1 - u0)) * (norm (w - u0) * norm (u1 - u0)) <= + ((w - u0) dot (u1 - u0)) * (norm (x - u0) * norm (u1 - u0))`); + (MATCH_MP_TAC RAT_LEMMA4); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `x - b = vec 0 <=> x = b`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `m:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u0, u1, u2, u3} = {u1, u0, u2, u3}`]); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `(t2 + t3 + t4) / t2` THEN EXISTS_TAC `(--t3) / t2` + THEN EXISTS_TAC `(--t4) / t2`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH + `(t2 + t3 + t4) / t2 + --t3 / t2 + --t4 / t2 = t2 / t2`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_WITH `(t2 + t3 + t4) = &1 - t1`); + (UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (NEW_GOAL `u0 - t1 % u0 - t3 % u2 - t4 % m:real^3 = t2 % u1`); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(&1 - t1) / t2 % u0 + --t3 / t2 % u2 + --t4 / t2 % u3 = + (&1 / t2) % (u0 - t1 % u0 - t3 % u2 - t4 % u3)`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `t2 / t2 = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `x - b = vec 0 <=> x = b`]); + (EXPAND_TAC "w" THEN STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `m:real^3`); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + + (EXISTS_TAC `&0` THEN EXISTS_TAC `t3 / (t3 + t4)` + THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 + t3 / (t3 + t4) + t4 / (t3 + t4) = + (t3 + t4) / (t3 + t4)`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `&0 % u1 + t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3 = + (&1 / (t3 + t4)) % (t3 % u2 + t4 % u3)`]); + (UP_ASM_TAC THEN REWRITE_TAC[VECTOR_ARITH + `t1 / x % u0 + t3 / x % u2 + t4 / x % u3 = + (&1 / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `&1 / (t1 + t3 + t4) % (t1 % u0 + t3 % u2 + t4 % m) = u0 <=> + t1 % u0 + t3 % u2 + t4 % m = (t1 + t3 + t4) % u0:real^3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.CHANGE_SIDE); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 +t3 + t4 = &1` THEN + REAL_ARITH_TAC); + + (REWRITE_TAC[VECTOR_ARITH `t1 % u0 + t3 % u2 + t4 % u3 = (t1 + t3 + t4) % u0 + <=> t3 % u2 + t4 % u3 = (t3 + t4) % u0`]); + (STRIP_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + + (REWRITE_WITH `x = t2 % u1 + (t1 + t3 + t4) % w:real^3`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `x % (t1 /x % u0 + t3 / x % u2 + t4 /x % u3) = + (x / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (ABBREV_TAC `t = t1 + t3 + t4`); + (REWRITE_WITH `(t2 % u1 + t % w) - u0:real^3 = + (t2 % u1 + t % w) - (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `t1 + t2 + t3 + t4 = t2 + t:real`); + (EXPAND_TAC "t" THEN REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH + `(t2 % u1 + t % w) - (t2 + t) % u0 = t2 % (u1 - u0) + t % (w - u0)`]); + (ABBREV_TAC `x1 = u1 - u0:real^3`); + (ABBREV_TAC `x2 = w - u0:real^3`); + + (REWRITE_WITH `(t2 % x1 + t % x2) dot x1 = + t2 * norm x1 pow 2 + t * x2 dot (x1:real^3)`); + (REWRITE_TAC[NORM_POW_2]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `t2 * norm x1 pow 2 * norm x2 * norm x1 <= + t2 * (x2 dot x1) * norm x1 * norm (x1:real^3)`); + (REWRITE_TAC[REAL_POW_2; REAL_ARITH `t2 * (x1 * x1) * x2 * x1 <= + t2 * x3 * x1 * x1 <=> &0 <= (x1 pow 2) * (--t2) * (x2 * x1 - x3)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[REAL_LE_MUL; NORM_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (STRIP_TAC); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ]); + + (NEW_GOAL + `t2 * (x2 dot x1) * norm x1 * norm x1 + t * (x2 dot x1) * norm x2 * norm x1 <= (x2 dot x1) * norm (t2 % x1 + t % x2) * norm (x1:real^3)`); + + (REWRITE_TAC[REAL_ARITH `t2 * x3 * x1 * x1 + t * x3 * x2 * x1 <= + x3 * x4 * x1 <=> &0 <= (x1 * x3) * (x4 - t2 * x1 - t * x2)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_CASES_TAC `x2 dot (x1:real^3) < &0`); + (NEW_GOAL `F`); + (NEW_GOAL `(g:real^3->real) x <= &0`); + (EXPAND_TAC "g"); + (REWRITE_TAC[REAL_ARITH `a / b <= &0 <=> &0 <= (--a) / b`]); + (MATCH_MP_TAC REAL_LE_DIV); + (SIMP_TAC[NORM_POS_LE; REAL_LE_MUL]); + + (REWRITE_WITH `x = t2 % u1 + (t1 + t3 + t4) % w:real^3`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `x % (t1 /x % u0 + t3 / x % u2 + t4 /x % u3) = + (x / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (EXPAND_TAC "t"); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= --a <=> a <= &0`]); + (REWRITE_WITH `(t2 % u1 + (t1 + t3 + t4) % w) - u0:real^3 = + (t2 % u1 + (t1 + t3 + t4) % w) - (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `(t2 % u1 + (t1 + t3 + t4) % w) - (t1 + t2 + t3 + t4) % u0 = + t2 % x1 + t % x2:real^3`); + (EXPAND_TAC "x1" THEN EXPAND_TAC "x2" THEN EXPAND_TAC "t" + THEN VECTOR_ARITH_TAC); + (NEW_GOAL `t % x2 dot (x1:real^3) <= &0`); + (REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= a * (--b)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (NEW_GOAL `t2 % x1 dot (x1:real^3) <= &0`); + (REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (REWRITE_TAC[DOT_POS_LE]); + (REWRITE_TAC[DOT_LADD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `d < (g:real^3->real) x`); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1`); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (REWRITE_TAC [REAL_ARITH `&0 <= a - b * d - c <=> c <= a + (--b) * d`]); + (REWRITE_WITH `t * norm (x2:real^3) = abs t * norm x2`); + (AP_THM_TAC THEN AP_TERM_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[REAL_ABS_REFL]); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (REWRITE_WITH `(--t2) * norm (x1:real^3) = abs (--t2) * norm x1`); + (AP_THM_TAC THEN AP_TERM_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[REAL_ABS_REFL]); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_TAC[GSYM NORM_MUL]); + (REWRITE_WITH + `norm (t % x2:real^3) = norm ((t2 % x1 + t % x2) + (--t2 % x1))`); + (AP_TERM_TAC THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_TRIANGLE]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `(g:real^3->real) y <= g xx`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `(g:real^3->real) xx <= d1`); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "P3"); + (EXPAND_TAC "g" THEN EXPAND_TAC "f3"); + (REWRITE_TAC[IN_ELIM_THM; IN]); + (EXISTS_TAC `vl:(real^3)list`); + (REWRITE_TAC[ASSUME `barV V 3 vl`; ASSUME `vl = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1]); + (STRIP_TAC); + (SIMP_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `mcell 3 V vl = mcell k V vl`); + (ASM_SIMP_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k V vl`)]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + + + (EXPAND_TAC "xx"); + (SIMP_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN EXPAND_TAC "d"); + (REAL_ARITH_TAC); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; + set_of_list; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) + + (ABBREV_TAC `m = mxi V vl`); + (NEW_GOAL `~coplanar {u0, u1, u2, m:real^3}`); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; set_of_list]); + (COND_CASES_TAC); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (ASM_REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (ASM_CASES_TAC `azim u0 u1 u2 (m:real^3) < pi`); + (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 u2 m)`); + (ASM_SIMP_TAC[WEDGE_LUNE]); + (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`); + (SET_TAC[]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {u2, m} DIFF conic_cap u0 u1 r d INTER L = {}`); + (EXPAND_TAC "L"); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`)); + (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]); + (REWRITE_TAC[SET_RULE `A UNION {} = A`]); + (EXPAND_TAC "L"); + + (REWRITE_WITH `aff_ge {u0, u1:real^3} {u2, m} = + aff_gt {u0, u1} {u2, m} UNION + UNIONS {aff_ge {u0, u1} ({u2, m} DELETE a) | a | a IN {u2, m}}`); + (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[DISJOINT]); + + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`); + (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`); + (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({u2, m} DELETE a) | a | a IN {u2, m}}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `aff_ge {u0, u1:real^3} {u2} UNION aff_ge {u0, u1:real^3} {m}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, u2}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,u2:real^3} = {u0,u1} UNION {u2}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, m}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,m:real^3} = {u0,u1} UNION {m}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`)); + (STRIP_TAC); + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`); + (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`); + (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (SET_TAC[]); + +(* begin the computation *) + + (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]); + (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 u2 m) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 u2 m / &3 * (&1 - max d (-- &1)) * r pow 3)`); + (NEW_GOAL `~collinear {u0:real^3, u1, u2} /\ ~collinear {u0, u1, m}`); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `azim (u0:real^3) u1 u2 m = dihV u0 u1 u2 m`); + (MATCH_MP_TAC AZIM_DIHV_SAME); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (LET_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(3, vl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN; ARITH_RULE `3 <= 4`] THEN ASM_REWRITE_TAC[]); + (REWRITE_WITH `initial_sublist [u0;u1:real^3] [u0; u1; u2; u3] /\ + LENGTH [u0;u1] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC); + + (NEW_GOAL `k' = 3 /\ mcell k' V ul = mcell 3 V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `mcell k' V ul INTER mcell 3 V vl = X`); + (REWRITE_WITH `mcell 3 V vl = X`); + (ASM_SIMP_TAC[]); + (SET_TAC[ASSUME `X = mcell k' V ul`]); + + (REPEAT STRIP_TAC); + (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + + (REWRITE_TAC[dihu3]); + + (REWRITE_WITH `dihV (EL 0 ul) (EL 1 ul) (EL 2 ul) (mxi V ul) = + dihV u0 u1 u2 (m:real^3)`); + + (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `{EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = {u0, u1,u2,m:real^3}`); + (REWRITE_WITH ` + {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = {u0, u1,u2,m:real^3} <=> + convex hull {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = + convex hull {u0, u1,u2,m:real^3}`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_2; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2, mxi V [v0; v1; v2; v3]}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (UNDISCH_TAC `affine_dependent {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul}`); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, mxi V [u0; u1; u2; u3]}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (REWRITE_WITH `convex hull {u0, u1, u2, m:real^3} = X`); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; set_of_list]); + (COND_CASES_TAC); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; set_of_list]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[set_of_list; ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `1 = SUC 0`]); + + (NEW_GOAL `mxi V ul = m`); + (EXPAND_TAC "m"); + (MATCH_MP_TAC MCELL_ID_MXI); + (EXISTS_TAC `k':num` THEN EXISTS_TAC `k:num`); + (ASM_REWRITE_TAC[SET_RULE `3 IN {2, 3}`]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `HD (ul) = (HD (truncate_simplex 1 ul)):real^3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[HD]); + (ASM_REWRITE_TAC[]); + + (STRIP_TAC); + (NEW_GOAL `EL 2 ul = u2:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0, u1, EL 2 ul, m} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,u2,m:real^3}` THEN REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, m} = {u0, u1, u2, m:real^3}`); + ASSUME `{u0, u1, EL 2 ul, m} = {u0, u1, m:real^3}`; COPLANAR_3]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]); + (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]); + (AP_THM_TAC THEN AP_TERM_TAC); + + (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`); + (MATCH_MP_TAC VOLUME_CONIC_CAP); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN MESON_TAC[]); + (UNDISCH_TAC `d < &1` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + + (REWRITE_WITH `max d (--(&1)) = d`); + (MATCH_MP_TAC (REAL_ARITH `&0 < d /\ --(&1) < &0 ==> max d (--(&1)) = d`)); + (REWRITE_TAC[REAL_NEG_LT0]); + (STRIP_TAC); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UNDISCH_TAC `k' = 3 /\ mcell k' V ul = mcell 3 V vl` + THEN MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) + + (ASM_CASES_TAC `azim u0 u1 m (u2:real^3) < pi`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (STRIP_TAC); + (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 m u2)`); + (ASM_SIMP_TAC[WEDGE_LUNE]); + (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`); + (SET_TAC[]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + + (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {m, u2} DIFF conic_cap u0 u1 r d INTER L = {}`); + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`)); + (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]); + (REWRITE_TAC[SET_RULE `A UNION {} = A`]); + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]); + + (REWRITE_WITH `aff_ge {u0, u1:real^3} {m, u2} = + aff_gt {u0, u1} {m, u2} UNION + UNIONS {aff_ge {u0, u1} ({m, u2} DELETE a) | a | a IN {m, u2}}`); + (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[DISJOINT]); + + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, u2:real^3}`); + (REWRITE_WITH `{u0, u1, m, u2} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, u2:real^3}`); + (REWRITE_WITH `{u0, u1, m, u2} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({m, u2} DELETE a) | a | a IN {m, u2}}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `aff_ge {u0, u1:real^3} {u2} UNION aff_ge {u0, u1:real^3} {m}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, u2}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,u2:real^3} = {u0,u1} UNION {u2}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, m}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,m:real^3} = {u0,u1} UNION {m}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]); + (MATCH_MP_TAC (SET_RULE + `A SUBSET D /\ C SUBSET B ==> A UNION C SUBSET B UNION D`)); + (STRIP_TAC); + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, u2:real^3}`); + (REWRITE_WITH `{u0, u1, m, u2} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, u2:real^3}`); + (REWRITE_WITH `{u0, u1, m, u2} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (SET_TAC[]); + + (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]); + (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 m u2) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 m u2 / &3 * (&1 - max d (-- &1)) * r pow 3)`); + (NEW_GOAL `~collinear {u0:real^3, u1, u2} /\ ~collinear {u0, u1, m}`); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ASM_REWRITE_TAC[]); + + (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + + (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `azim (u0:real^3) u1 m u2 = dihV u0 u1 m u2`); + (MATCH_MP_TAC AZIM_DIHV_SAME); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (LET_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(3, vl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN; ARITH_RULE `3 <= 4`] THEN ASM_REWRITE_TAC[]); + + (REWRITE_WITH `initial_sublist [u0;u1:real^3] [u0; u1; u2; u3] /\ + LENGTH [u0;u1] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC); + + (NEW_GOAL `k' = 3 /\ mcell k' V ul = mcell 3 V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `mcell k' V ul INTER mcell 3 V vl = X`); + (REWRITE_WITH `mcell 3 V vl = X`); + (ASM_SIMP_TAC[]); + (SET_TAC[ASSUME `X = mcell k' V ul`]); + + (REPEAT STRIP_TAC); + (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + + (REWRITE_TAC[dihu3]); + + (REWRITE_WITH `dihV (EL 0 ul) (EL 1 ul) (EL 2 ul) (mxi V ul) = + dihV u0 u1 u2 (m:real^3)`); + + (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `{EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = {u0, u1,u2,m:real^3}`); + (REWRITE_WITH ` + {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = {u0, u1,u2,m:real^3} <=> + convex hull {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = + convex hull {u0, u1,u2,m:real^3}`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_2; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2, mxi V [v0; v1; v2; v3]}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (UNDISCH_TAC `affine_dependent {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul}`); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, mxi V [u0; u1; u2; u3]}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (REWRITE_WITH `convex hull {u0, u1, u2, m:real^3} = X`); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; set_of_list]); + (COND_CASES_TAC); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; set_of_list]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[set_of_list; ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `1 = SUC 0`]); + + (NEW_GOAL `mxi V ul = m`); + (EXPAND_TAC "m"); + (MATCH_MP_TAC MCELL_ID_MXI); + (EXISTS_TAC `k':num` THEN EXISTS_TAC `k:num`); + (ASM_REWRITE_TAC[SET_RULE `3 IN {2, 3}`]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `HD (ul) = (HD (truncate_simplex 1 ul)):real^3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[HD]); + (ASM_REWRITE_TAC[]); + + (STRIP_TAC); + (NEW_GOAL `EL 2 ul = u2:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0, u1, EL 2 ul, m} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,m,u2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (REWRITE_TAC[GSYM (ASSUME `{u0, u1, EL 2 ul, m} = {u0, u1, u2, m:real^3}`); + ASSUME `{u0, u1, EL 2 ul, m} = {u0, u1, m:real^3}`; COPLANAR_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[DIHV_SYM_2]); + + (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]); + (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]); + (AP_THM_TAC THEN AP_TERM_TAC); + + (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`); + (MATCH_MP_TAC VOLUME_CONIC_CAP); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN MESON_TAC[]); + (UNDISCH_TAC `d < &1` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + + (REWRITE_WITH `max d (--(&1)) = d`); + (MATCH_MP_TAC (REAL_ARITH `&0 < d /\ --(&1) < &0 ==> max d (--(&1)) = d`)); + (REWRITE_TAC[REAL_NEG_LT0]); + (STRIP_TAC); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UNDISCH_TAC `k' = 3 /\ mcell k' V ul = mcell 3 V vl` + THEN MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) + + (NEW_GOAL `F`); + (NEW_GOAL `azim (u0:real^3) u1 m u2 = + (if azim u0 u1 u2 m = &0 then &0 else &2 * pi - azim u0 u1 u2 m)`); + (MATCH_MP_TAC AZIM_COMPL); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b, d, c}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN COND_CASES_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `(&0 < pi)`); + (REWRITE_TAC[PI_POS]); + (UNDISCH_TAC `~(azim (u0:real^3) u1 u2 m < pi)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (STRIP_TAC); + + (NEW_GOAL `azim (u0:real^3) u1 u2 m = pi`); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[] THEN MATCH_MP_TAC AZIM_EQ_0_PI_IMP_COPLANAR); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) +(* ========================================================================= *) + (ABBREV_TAC `s = {X | mcell_set V X /\ edgeX V X e}`); + (NEW_GOAL `sum s (\t. vol (t INTER D)) = vol (D)`); + (ABBREV_TAC `f = (\t:real^3->bool. t INTER D)`); + (REWRITE_WITH `(\t. vol (t INTER D)) = (\x:real^3->bool. vol (f x))`); + (EXPAND_TAC "f"); + (REWRITE_TAC[]); + (REWRITE_WITH `sum s (\x:real^3->bool. vol (f x)) = vol (UNIONS (IMAGE f s))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_UNIONS_IMAGE); + (REPEAT STRIP_TAC); + + (EXPAND_TAC "s"); + (MATCH_MP_TAC FINITE_EDGE_X2); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (ASM_REWRITE_TAC[]); + + (EXPAND_TAC "f"); + (MATCH_MP_TAC MEASURABLE_INTER); + (STRIP_TAC); + (UP_ASM_TAC THEN EXPAND_TAC "s"); + (REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[MEASURABLE_MCELL]); + (ASM_REWRITE_TAC[MEASURABLE_CONIC_CAP]); + + (EXPAND_TAC "f"); + (UNDISCH_TAC `(x:real^3->bool) IN s` THEN + UNDISCH_TAC `(y:real^3->bool) IN s` THEN EXPAND_TAC "s"); + (REWRITE_TAC[mcell_set_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `x INTER (y:real^3->bool)`); + (ASM_REWRITE_TAC[SET_RULE `(x INTER D) INTER y INTER D SUBSET x INTER y`]); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + + (NEW_GOAL `i' = i /\ mcell i' V ul' = mcell i V ul`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[SET_RULE `i IN {0, 1, 2, 3, 4} <=> + i = 0 \/ i = 1 \/ i = 2 \/ i = 3 \/ i = 4`]); + (UNDISCH_TAC `i <= 4` THEN UNDISCH_TAC `i' <= 4` THEN ARITH_TAC); + (UNDISCH_TAC `~(x = y:real^3->bool)` THEN ASM_REWRITE_TAC[]); + + + (EXPAND_TAC "s"); + (EXPAND_TAC "f" THEN REWRITE_TAC[IMAGE]); + +(* OK here *) + + + + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + (REWRITE_WITH + `UNIONS {y | ?x. x IN {X | mcell_set V X /\ edgeX V X e} /\ y = x INTER D} + DIFF D = {}`); + (REWRITE_TAC[SET_RULE `A DIFF B = {} <=> A SUBSET B`]); + (REWRITE_TAC[UNIONS_SUBSET; IN; IN_ELIM_THM]); + (SET_TAC[]); + (REWRITE_TAC[SET_RULE `{} UNION A = A`]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `UNIONS {y | ?x. x IN {X | mcell_set V X /\ NULLSET (X INTER D) /\ + ~(X INTER D = {})} /\ y = x INTER D}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNIONS); + (STRIP_TAC); + (REWRITE_WITH + `{y | ?x. x IN {X | mcell_set V X /\ NULLSET (X INTER D) /\ + ~(X INTER D = {})} /\ + y = x INTER D} = + {y | ?x. x IN {X | mcell_set V X /\ NULLSET (X INTER D) /\ + ~(X INTER D = {})} /\ + y = f x }`); + (EXPAND_TAC "f" THEN REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + +(* ========================================================================= *) +(* ========================================================================= *) +(* ========================================================================= *) + + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (u0, &10) /\ mcell_set V X}`); + (STRIP_TAC); + (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA_2]); + (REWRITE_TAC[SUBSET; IN_BALL; IN; IN_ELIM_THM; mcell_set] THEN + REPEAT STRIP_TAC); + + (NEW_GOAL `?v1:real^3. v1 IN x /\ v1 IN D`); + (REWRITE_TAC[GSYM IN_INTER]); + (UNDISCH_TAC `~(x:real^3->bool INTER D = {})` THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `dist (u0, x') <= dist (u0, v1:real^3) + dist (v1, x')`); + (NORM_ARITH_TAC); + (NEW_GOAL `dist (u0, v1:real^3) < &1`); + (REWRITE_TAC[GSYM IN_BALL]); + (NEW_GOAL `D SUBSET ball (u0:real^3, &1)`); + (EXPAND_TAC "D"); + (NEW_GOAL `ball (u0, r) SUBSET ball (u0:real^3, &1)`); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `v1:real^3 IN D` THEN SET_TAC[]); + (NEW_GOAL `dist (v1,x':real^3) < &8`); + (REWRITE_TAC[GSYM IN_BALL]); + + (NEW_GOAL `x SUBSET ball (v1:real^3, &8)`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MCELL_SUBSET_BALL8); + (REWRITE_TAC[GSYM (ASSUME `x = mcell i V ul`)] THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `(x:real^3->bool) x'` THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `ul:(real^3)list`); + (ASM_REWRITE_TAC[]); + +(* ========================================================================= *) + + (REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[ASSUME `t:real^3->bool = x INTER D`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[SUBSET; IN_UNIONS]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `?v:real^3. v IN V /\ x IN voronoi_closed V v`); + (ASM_SIMP_TAC[TIWWFYQ]); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_WITH + `x IN voronoi_closed V v <=> (?vl. vl IN barV V 3 /\ x IN rogers V vl /\ + truncate_simplex 0 vl = [v])`); + (ASM_SIMP_TAC[GLTVHUM]); + (REWRITE_TAC[IN] THEN STRIP_TAC); + (NEW_GOAL `?i. i <= 4 /\ x IN mcell i V vl`); + (ASM_SIMP_TAC[IN;SLTSTLO1]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ABBREV_TAC `X = mcell i V vl`); + (NEW_GOAL `~NULLSET (X INTER D) ==> F`); + (STRIP_TAC); + + (NEW_GOAL `?k ul. + 2 <= k /\ + barV V 3 ul /\ + X = mcell k V ul /\ + truncate_simplex 1 ul = [u0; u1]`); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + (REWRITE_TAC[mcell_set; IN_ELIM_THM; IN]); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (MP_TAC (ASSUME `x IN + D DIFF + UNIONS + {y | ?x. x IN {X | mcell_set V X /\ edgeX V X e} /\ y = x INTER D}`)); + (REWRITE_TAC[IN_DIFF; MESON[] `~(A /\ ~B) <=> ~A \/ B`]); + (DISJ2_TAC); + (REWRITE_TAC[IN_UNIONS; IN; IN_ELIM_THM]); + (EXISTS_TAC `X INTER (D:real^3->bool)`); + (STRIP_TAC); + + (EXISTS_TAC `(X:real^3->bool)`); + (REWRITE_TAC[mcell_set; IN; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[edgeX; IN_ELIM_THM]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (STRIP_TAC); + + (NEW_GOAL `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `(if k < 4 then k else 4)`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (COND_CASES_TAC); + (MESON_TAC[]); + (NEW_GOAL `k >= 4`); + (UP_ASM_TAC THEN ARITH_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ]); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN ASM_REWRITE_TAC[]); + (MESON_TAC[NEGLIGIBLE_SUBSET; SET_RULE `A INTER B SUBSET A`]); + + (NEW_GOAL `(V:real^3->bool) INTER X = + set_of_list (truncate_simplex ((if k < 4 then k else 4) - 1) ul)`); + (REWRITE_WITH `X = mcell (if k < 4 then k else 4) V ul`); + (ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `k >= 4`); + (UP_ASM_TAC THEN ARITH_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ]); + + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `2 <= k` THEN ARITH_TAC); + (STRIP_TAC); + (UNDISCH_TAC `2 <= k` THEN ARITH_TAC); + (REWRITE_WITH `mcell (if k < 4 then k else 4) V ul = X`); + (ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `k >= 4`); + (UP_ASM_TAC THEN ARITH_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN + REWRITE_TAC[ASSUME `X = {}:real^3->bool`; SET_RULE `{} INTER x = {}`; + NEGLIGIBLE_EMPTY]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list (truncate_simplex 1 (ul:(real^3)list)) SUBSET + set_of_list (truncate_simplex ((if k < 4 then k else 4) - 1) ul)`); + (MATCH_MP_TAC Rogers.TRUNCATE_SIMPLEX_SUBSET); + (REWRITE_WITH `LENGTH ul = 3 + 1 /\ + CARD (set_of_list (ul:(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `2 <= k` THEN ARITH_TAC); + (REWRITE_TAC[MESON[IN] `(s:real^3->bool) u <=> u IN s`]); + + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `truncate_simplex 1 ul = [u0; u1:real^3]`; + set_of_list]); + (SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[MESON[IN] `(s:real^3->bool) u <=> u IN s`; IN_INTER]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `x IN + D DIFF + UNIONS + {y | ?x. x IN {X | mcell_set V X /\ edgeX V X e} /\ y = x INTER D}`); + (SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[] THEN STRIP_TAC); + (EXISTS_TAC `X INTER (D:real^3 ->bool)`); + (STRIP_TAC); + (REWRITE_TAC[IN_ELIM_THM]); + (EXISTS_TAC `(X:real^3 ->bool)`); + (STRIP_TAC); + (STRIP_TAC); + + (REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[SET_RULE `~(a = {}) <=> (?x. x IN a)`]); + (EXISTS_TAC `x:real^3`); + + (REWRITE_TAC[IN_INTER]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `x IN + D DIFF + UNIONS + {y | ?x. x IN {X | mcell_set V X /\ edgeX V X e} /\ y = x INTER D}`); + (SET_TAC[]); + (REWRITE_TAC[]); + + (REWRITE_TAC[MESON[IN] `(s:real^3->bool) u <=> u IN s`; IN_INTER]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `x IN + D DIFF + UNIONS + {y | ?x. x IN {X | mcell_set V X /\ edgeX V X e} /\ y = x INTER D}`); + (SET_TAC[]); + +(* ========================================================================= *) +(* ========================================================================= *) +(* ========================================================================= *) + + (UP_ASM_TAC); + (ABBREV_TAC `t ={X | mcell_set V X /\ edgeX V X e /\ ~NULLSET (X INTER D)}`); + + (REWRITE_WITH `sum s (\t. vol (t INTER D)) = + sum t (\t. vol (t INTER D))`); + (MATCH_MP_TAC SUM_SUPERSET); + (EXPAND_TAC "s" THEN EXPAND_TAC "t" THEN REPEAT STRIP_TAC); + (SET_TAC[]); + (MATCH_MP_TAC MEASURE_EQ_0); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[IN; IN_ELIM_THM] ); + (MESON_TAC[]); + + + (REWRITE_WITH `sum s (\t. dihX V t (u0,u1)) = + sum t (\t. dihX V t (u0,u1))`); + (MATCH_MP_TAC SUM_SUPERSET); + (EXPAND_TAC "s" THEN EXPAND_TAC "t" THEN REPEAT STRIP_TAC); + (SET_TAC[]); + + (NEW_GOAL `NULLSET (x INTER D)`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[IN; IN_ELIM_THM] ); + (MESON_TAC[]); + + (NEW_GOAL `mcell_set V x /\ edgeX V x e`); + (UNDISCH_TAC `x IN {X | mcell_set V X /\ edgeX V X e}`); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (UP_ASM_TAC THEN REWRITE_TAC[mcell_set_2; IN_ELIM_THM;IN] THEN STRIP_TAC); + + (NEW_GOAL `~NULLSET x`); + (UP_ASM_TAC THEN REWRITE_TAC[edgeX; VX; IN_ELIM_THM]); + (COND_CASES_TAC THEN REPEAT STRIP_TAC); + (UNDISCH_TAC `{} (u:real^3)` THEN REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`]); + (SET_TAC[]); + + (NEW_GOAL `VX V x = V INTER (x:real^3->bool)`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `V INTER (x:real^3->bool) = + set_of_list (truncate_simplex (i - 1) ul)`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_CASES_TAC `i = 0`); + (NEW_GOAL `V INTER (x:real^3->bool) = {}`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (UNDISCH_TAC `edgeX V x e` THEN REWRITE_TAC[edgeX; IN_ELIM_THM]); + (STRIP_TAC); + (UNDISCH_TAC `VX V x u` THEN ASM_REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`]); + (SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN ARITH_TAC); + (REWRITE_TAC[GSYM (ASSUME `x = mcell i V ul`)] THEN STRIP_TAC); + (UNDISCH_TAC `~NULLSET x` THEN REWRITE_TAC[ASSUME `x:real^3->bool = {}`; + NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `(u0:real^3) IN VX V x /\ u1 IN VX V x`); + (UNDISCH_TAC `edgeX V x e` THEN REWRITE_TAC[edgeX; IN_ELIM_THM; + ASSUME `e = {u0, u1:real^3}`]); + (STRIP_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + +(* ========================================================================== *) + (NEW_GOAL `F`); + + (ASM_CASES_TAC `i <= 1`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2 ;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `i - 1 = 0`); + (UNDISCH_TAC `i <= 1` THEN ARITH_TAC); + (UNDISCH_TAC `u0 IN VX V x /\ u1 IN VX V x`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_0; set_of_list]); + (UNDISCH_TAC `~(u0 = u1:real^3)` THEN SET_TAC[]); + + (ASM_CASES_TAC `i = 3`); + (NEW_GOAL `vol (x INTER D) > &0`); + (ONCE_REWRITE_TAC[SET_RULE `a INTER b = b INTER a`]); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2 ;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell3; TRUNCATE_SIMPLEX_EXPLICIT_2; + set_of_list; SET_RULE `{a,c,d} UNION {x} = {a,c,d,x}`]); + (COND_CASES_TAC); + (NEW_GOAL `i - 1 = 2`); + (UNDISCH_TAC `i = 3` THEN ARITH_TAC); + (UNDISCH_TAC `u0 IN VX V x /\ u1 IN VX V x`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (STRIP_TAC); + (NEW_GOAL `?v:real^3. {u0, u1, v} = {v0, v1, v2}`); + (NEW_GOAL `?v:real^3. v IN {v0, v1, v2} DIFF {u0, u1}`); + (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]); + (REWRITE_WITH `{v0, v1, v2} DIFF {u0, u1:real^3} = {} <=> + CARD ({v0, v1, v2} DIFF {u0, u1}) = 0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_EQ_0); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{v0, v1, v2:real^3}`); + (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]); + (REWRITE_TAC[ARITH_RULE `~(a = 0) <=> 1 <= a`]); + + (NEW_GOAL `CARD {v0, v1, v2} = CARD ({v0, v1, v2} DIFF {u0, u1:real^3}) + + CARD {u0, u1}`); + (MATCH_MP_TAC Hypermap.CARD_MINUS_DIFF_TWO_SET); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + (UP_ASM_TAC THEN REWRITE_WITH `CARD ({v0, v1, v2:real^3}) = 3`); + (REWRITE_WITH `{v0, v1, v2:real^3} = set_of_list (truncate_simplex 2 ul)`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (ABBREV_TAC `xl = truncate_simplex 2 (ul:(real^3)list)`); + (REWRITE_WITH `LENGTH (xl:(real^3)list) = 2 + 1 /\ + CARD (set_of_list xl) = 2 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "xl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ARITH_TAC); + + (NEW_GOAL `CARD {u0, u1:real^3} <= 2`); + (REWRITE_TAC[Geomdetail.CARD2]); + (UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN + UNDISCH_TAC `~(u0 = u1:real^3)` THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `{v0, v1, v2, mxi V [v0; v1; v2; v3]} = + {u0, u1, v, mxi V [v0; v1; v2; v3]}`); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC CONIC_CAP_INTER_CONVEX_HULL_4_GT_0); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (REWRITE_TAC[GSYM (ASSUME `{v0, v1, v2, mxi V [v0; v1; v2; v3]} = + {u0, u1, v, mxi V [v0; v1; v2; v3]}`)] THEN STRIP_TAC); + (UNDISCH_TAC `~NULLSET x`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_TAC[SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2, mxi V [v0; v1; v2; v3]}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET x`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `vol (x INTER D) = &0`); + (MATCH_MP_TAC MEASURE_EQ_0); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + +(* ========================================== *) + + (ASM_CASES_TAC `i = 4`); + (NEW_GOAL `vol (x INTER D) > &0`); + (ONCE_REWRITE_TAC[SET_RULE `a INTER b = b INTER a`]); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2 ;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4; ARITH_RULE `4 >= 4`; + set_of_list]); + (COND_CASES_TAC); + (NEW_GOAL `i - 1 = 3`); + (UNDISCH_TAC `i = 4` THEN ARITH_TAC); + (UNDISCH_TAC `u0 IN VX V x /\ u1 IN VX V x`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3; set_of_list]); + (STRIP_TAC); + + (NEW_GOAL `?v w:real^3. {u0, u1, v, w} = {v0, v1, v2, v3}`); + + (NEW_GOAL `?v:real^3. v IN {v0, v1, v2, v3} DIFF {u0, u1}`); + (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]); + (REWRITE_WITH `{v0, v1, v2, v3} DIFF {u0, u1:real^3} = {} <=> + CARD ({v0, v1, v2, v3} DIFF {u0, u1}) = 0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_EQ_0); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{v0, v1, v2, v3:real^3}`); + (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]); + (REWRITE_TAC[ARITH_RULE `~(a = 0) <=> 1 <= a`]); + + (NEW_GOAL `CARD {v0, v1, v2, v3} = + CARD ({v0, v1, v2, v3} DIFF {u0, u1:real^3}) + CARD {u0, u1}`); + (MATCH_MP_TAC Hypermap.CARD_MINUS_DIFF_TWO_SET); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + + (UP_ASM_TAC THEN REWRITE_WITH `CARD ({v0, v1, v2, v3:real^3}) = 3 + 1`); + (REWRITE_WITH `{v0, v1, v2, v3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD {u0, u1:real^3} <= 2`); + (REWRITE_TAC[Geomdetail.CARD2]); + (UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?w:real^3. w IN {v0, v1, v2, v3} DIFF {u0, u1, v}`); + (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]); + (REWRITE_WITH `{v0, v1, v2, v3} DIFF {u0, u1, v:real^3} = {} <=> + CARD ({v0, v1, v2, v3} DIFF {u0, u1, v}) = 0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_EQ_0); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{v0, v1, v2, v3:real^3}`); + (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]); + (REWRITE_TAC[ARITH_RULE `~(a = 0) <=> 1 <= a`]); + + (NEW_GOAL `CARD ({v0, v1, v2, v3} DIFF {u0, u1,v:real^3}) = + CARD {v0, v1, v2, v3} - CARD {u0,u1,v}`); + (MATCH_MP_TAC CARD_DIFF); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH `CARD ({v0, v1, v2, v3:real^3}) = 3 + 1`); + (REWRITE_WITH `{v0, v1, v2, v3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD {u0, u1, v:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (EXISTS_TAC `v:real^3` THEN EXISTS_TAC `w:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN + UNDISCH_TAC `~(u0 = u1:real^3)` THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[GSYM (ASSUME `{u0:real^3, u1, v, w} = {v0, v1, v2, v3}`)]); + (MATCH_MP_TAC CONIC_CAP_INTER_CONVEX_HULL_4_GT_0); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET x`); + (SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list; ARITH_RULE `4 >= 4`; + ASSUME `x = mcell i V ul`; ASSUME `i = 4`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2, v3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET x`); + (SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list; ARITH_RULE `4 >= 4`; + ASSUME `x = mcell i V ul`; ASSUME `i = 4`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `vol (x INTER D) = &0`); + (MATCH_MP_TAC MEASURE_EQ_0); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + +(* ========================================== *) + + (NEW_GOAL `i = 2`); + (UNDISCH_TAC `i <= 4` THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC + THEN ARITH_TAC); + + + (NEW_GOAL `vol (x INTER D) > &0`); + (ONCE_REWRITE_TAC[SET_RULE `a INTER b = b INTER a`]); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2 ;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2; TRUNCATE_SIMPLEX_EXPLICIT_1; + set_of_list; HD; TL]); + (LET_TAC); + (COND_CASES_TAC); + + (NEW_GOAL `i - 1 = 1`); + (UNDISCH_TAC `i = 2` THEN ARITH_TAC); + (UNDISCH_TAC `u0 IN VX V x /\ u1 IN VX V x`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list]); + (STRIP_TAC); + (NEW_GOAL `{u0, u1} = {v0, v1:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN + SET_TAC[]); + (REWRITE_TAC[SET_RULE `A INTER B INTER C INTER D = + (A INTER (B INTER C)) INTER D`]); + (REWRITE_WITH `rcone_ge v0 v1 a' INTER rcone_ge v1 v0 a' = + rcone_ge u0 u1 a' INTER rcone_ge u1 (u0:real^3) a'`); + (ASM_CASES_TAC `u0:real^3 = v0`); + (NEW_GOAL `u1 = v1:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `u0 = v1:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (NEW_GOAL `u1 = v0:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + + (REWRITE_WITH + `conic_cap u0 u1 r d INTER rcone_ge u0 u1 a' INTER rcone_ge u1 u0 a' = + conic_cap (u0:real^3) u1 r d`); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> A INTER B = A`)); + + (NEW_GOAL `conic_cap (u0:real^3) u1 r d SUBSET rcone_ge u0 u1 a'`); + (REWRITE_TAC[conic_cap]); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A SUBSET B`)); + (NEW_GOAL `rcone_gt u0 u1 d SUBSET rcone_gt (u0:real^3) u1 a'`); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN EXPAND_TAC "c"); + (MATCH_MP_TAC (REAL_ARITH `a = x ==> a <= max (max y x) (max z t)`)); + (EXPAND_TAC "a'" THEN REWRITE_TAC[HL; set_of_list] THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `rcone_gt u0 u1 a' SUBSET rcone_ge (u0:real^3) u1 a'`); + (REWRITE_TAC[RCONE_GT_SUBSET_RCONE_GE]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[SUBSET_INTER] THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[SUBSET]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC Marchal_cells_2_new.RCONEGE_INTER_VORONOI_CLOSED_IMP_RCONEGE); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + + (REWRITE_WITH `a' = hl [u0; u1:real^3] / sqrt (&2)`); + (EXPAND_TAC "a'"); + (REWRITE_TAC[HL; set_of_list] THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC REAL_LT_DIV); + (REWRITE_TAC[HL_2]); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LT_MUL); + (REWRITE_TAC[REAL_ARITH `&0 < inv (&2)`]); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SQRT_POS_LT); + (REAL_ARITH_TAC); + (EXPAND_TAC "a'"); + (MATCH_MP_TAC REAL_DIV_LE_1_TACTICS); + (STRIP_TAC); + (MATCH_MP_TAC SQRT_POS_LT); + (REAL_ARITH_TAC); + (MATCH_MP_TAC (REAL_ARITH `a < b ==> a <= b`)); + (ASM_REWRITE_TAC[]); + + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (NEW_GOAL `x':real^3 IN ball (u0, (&1))`); + (UP_ASM_TAC THEN REWRITE_TAC[conic_cap;NORMBALL_BALL] THEN STRIP_TAC); + (NEW_GOAL `ball (u0, r) SUBSET ball (u0:real^3, &1)`); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r"); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL] THEN ONCE_REWRITE_TAC[DIST_SYM] + THEN STRIP_TAC); + (REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `u0 = w:real^3`); + (ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + (NEW_GOAL `&2 <= dist (u0, w:real^3)`); + (UNDISCH_TAC `packing (V:real^3->bool)` THEN REWRITE_TAC[packing]); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `u0:real^3 IN V` THEN REWRITE_TAC[IN]); + (NEW_GOAL `dist (x', u0) >= dist (u0, w) - dist (x', w:real^3)`); + (NORM_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN DEL_TAC THEN DEL_TAC THEN UP_ASM_TAC + THEN REAL_ARITH_TAC); + (ABBREV_TAC `M = mxi V [v0; v1; v2; v3]`); + (ABBREV_TAC `R = omega_list_n V [v0; v1; v2; v3] 3`); + + (NEW_GOAL `vol (conic_cap u0 u1 r d INTER convex hull {v0:real^3,v1,M,R}) + <= vol (conic_cap u0 u1 r d INTER aff_ge {v0, v1} {M, R})`); + (MATCH_MP_TAC MEASURE_SUBSET); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[MEASURABLE_CONIC_CAP]); + (MATCH_MP_TAC MEASURABLE_CONVEX_HULL); + (MATCH_MP_TAC FINITE_IMP_BOUNDED); + (REWRITE_TAC[Geomdetail.FINITE6]); + + (REWRITE_TAC[conic_cap; NORMBALL_BALL]); + (ONCE_REWRITE_TAC[SET_RULE `(a INTER b) INTER c = + (a INTER b) INTER (a INTER c)`]); + (MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[MEASURABLE_BALL_AFF_GE]); + (REWRITE_TAC[GSYM conic_cap; GSYM NORMBALL_BALL; MEASURABLE_CONIC_CAP]); + + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A SUBSET C INTER B`)); + (REWRITE_TAC[Marchal_cells_2_new.CONVEX_HULL_4_SUBSET_AFF_GE_2_2]); + + + + (NEW_GOAL `vol (conic_cap u0 u1 r d INTER convex hull {v0, v1, M, R}) > &0`); + (REWRITE_WITH `{v0, v1, M, R} = {u0, u1, M, R:real^3}`); + (UNDISCH_TAC `{u0, u1} = {v0, v1:real^3}` THEN SET_TAC[]); + (MATCH_MP_TAC CONIC_CAP_INTER_CONVEX_HULL_4_GT_0); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + + (UNDISCH_TAC `~NULLSET x`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (LET_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `aff_ge {v0, v1} {M, R:real^3}`); + (REWRITE_TAC[SET_RULE `a INTER B INTER c SUBSET c`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull ({v0, v1} UNION {M, R:real^3})`); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL; SET_RULE + `{a, b} UNION {c, d} = {a,b,c,d}`]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_WITH `{v0, v1, M, R} = {u0, u1, M, R:real^3}`); + (UNDISCH_TAC `{u0, u1} = {v0, v1:real^3}` THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET x`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `vol (x INTER D) = &0`); + (MATCH_MP_TAC MEASURE_EQ_0); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================== *) + + (REWRITE_WITH `sum t (\t. vol (t INTER D)) = + sum t (\t. vol D * dihX V t (u0,u1) / (&2 * pi))`); + (MATCH_MP_TAC SUM_EQ); + (EXPAND_TAC "t" THEN REWRITE_TAC[IN_ELIM_THM; IN] THEN REPEAT STRIP_TAC); + (ASM_SIMP_TAC[]); + (REWRITE_TAC[REAL_ARITH `a * b / c = (a / c) * b`]); + (REWRITE_TAC[SUM_LMUL]); + (ABBREV_TAC `R = sum t (\t. dihX V t (u0,u1))`); + (REWRITE_TAC[REAL_ARITH `a / b * c = (a * c) / b`]); + (REWRITE_WITH `(vol D * R) / (&2 * pi) = vol D <=> + (vol D * R) = vol D * (&2 * pi)`); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (MATCH_MP_TAC REAL_LT_MUL); + (REWRITE_TAC[PI_POS]); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `a * b = a * c <=> a * (b - c) = &0`]); + (REWRITE_TAC[REAL_ENTIRE]); + (STRIP_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (NEW_GOAL `&0 < d`); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (ASM_SIMP_TAC[VOLUME_CONIC_CAP]); + (COND_CASES_TAC); + (REWRITE_TAC[]); + (UNDISCH_TAC `d < &1` THEN UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC + THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&2 / &3 * a = &0 <=> a = &0`]); + (REWRITE_TAC[REAL_ENTIRE]); + (NEW_GOAL `~(pi = &0)`); + (MP_TAC PI_POS THEN REAL_ARITH_TAC); + (NEW_GOAL `~(&1 - d = &0)`); + (UNDISCH_TAC `d < &1` THEN REAL_ARITH_TAC); + (NEW_GOAL `~(r pow 3 = &0)`); + (MATCH_MP_TAC REAL_POW_NZ); + (UNDISCH_TAC `&0 < r` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN REAL_ARITH_TAC)]);; + + + +end;; diff --git a/text_formalization/packing/HDTFNFZ.hl b/text_formalization/packing/HDTFNFZ.hl new file mode 100755 index 0000000..8a5cf22 --- /dev/null +++ b/text_formalization/packing/HDTFNFZ.hl @@ -0,0 +1,114 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: HDTFNFZ *) +(* Chaper : Packing (Marchal cells) *) +(* *) +(* ========================================================================= *) + +(* ========================================================================= *) +(* FILES NEED TO BE LOADED *) + +(* flyspeck_needs "packing/marchal_cells_2_new.hl";; *) +(* flyspeck_needs "packing/LEPJBDJ.hl";; *) +(* ========================================================================= *) + +module Hdtfnfz = struct + + +open Rogers;; +open Vukhacky_tactics;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Sphere;; +open Marchal_cells;; +open Emnwuus;; +open Marchal_cells_2_new;; +open Lepjbdj;; + + +let HDTFNFZ_concl = +`!V ul k v X. + saturated V /\ + packing V /\ + barV V 3 ul /\ + X = mcell k V ul /\ ~(NULLSET X) + ==> VX V X = V INTER X`;; + +let HDTFNFZ = prove_by_refinement (HDTFNFZ_concl, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[VX]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (LET_TAC); + (COND_CASES_TAC); (* break into 2 subgoals k' = 0 and k' > 0 *) + + (UNDISCH_TAC `cell_params V X = k',ul'`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[cell_params]); + (ABBREV_TAC `P = (\(k,ul). k <= 4 /\ ul IN barV V 3 /\ X = mcell k V ul)`); + (DISCH_TAC); + (NEW_GOAL `(P:(num#(real^3)list->bool)) (k',ul')`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `((if (k <= 3) then k else 4),ul:(real^3)list)`); + (EXPAND_TAC "P"); + (COND_CASES_TAC); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN] THEN ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN] THEN ASM_REWRITE_TAC[ARITH_RULE `4 <= 4`]); + (REWRITE_WITH `mcell k V ul = mcell4 V ul`); + (ASM_SIMP_TAC [MCELL_EXPLICIT; ARITH_RULE `~(k <= 3) ==> (k >= 4)`]); + (REWRITE_WITH `mcell 4 V ul = mcell4 V ul`); + (ASM_SIMP_TAC [MCELL_EXPLICIT; ARITH_RULE `(4 >= 4)`]); + (UP_ASM_TAC THEN EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM] THEN STRIP_TAC); + (REWRITE_TAC[ASSUME `X = mcell k' V ul'`; ASSUME `k' = 0` ]); + (MATCH_MP_TAC LEPJBDJ_0); + (ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]); + (* Finish the case k' = 0 *) + + (* Continue with the case k' > 0 *) + + (UNDISCH_TAC `cell_params V X = k',ul'`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[cell_params]); + (ABBREV_TAC `P = (\(k,ul). k <= 4 /\ ul IN barV V 3 /\ X = mcell k V ul)`); + (DISCH_TAC); + (NEW_GOAL `(P:(num#(real^3)list->bool)) (k',ul')`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `((if (k <= 3) then k else 4),ul:(real^3)list)`); + (EXPAND_TAC "P"); + (COND_CASES_TAC); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN] THEN ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN] THEN ASM_REWRITE_TAC[ARITH_RULE `4 <= 4`]); + (REWRITE_WITH `mcell k V ul = mcell4 V ul`); + (ASM_SIMP_TAC [MCELL_EXPLICIT; ARITH_RULE `~(k <= 3) ==> (k >= 4)`]); + (REWRITE_WITH `mcell 4 V ul = mcell4 V ul`); + (ASM_SIMP_TAC [MCELL_EXPLICIT; ARITH_RULE `(4 >= 4)`]); + (UP_ASM_TAC THEN EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM] THEN STRIP_TAC); + (REWRITE_TAC[ASSUME `X = mcell k' V ul'`]); + (MATCH_MP_TAC LEPJBDJ); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + (NEW_GOAL `X:real^3->bool = {}`); + (ASM_MESON_TAC[]); + (NEW_GOAL `NULLSET (X:real^3->bool)`); + (ASM_MESON_TAC[NEGLIGIBLE_EMPTY]); + (ASM_MESON_TAC[])]);; + +end;; + diff --git a/text_formalization/packing/KIZHLTL.hl b/text_formalization/packing/KIZHLTL.hl new file mode 100755 index 0000000..7275101 --- /dev/null +++ b/text_formalization/packing/KIZHLTL.hl @@ -0,0 +1,1032 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: KIZHLTL *) +(* Chaper : Packing (Marchal cells) *) +(* *) +(* ========================================================================= *) +(* KIZHLTL1 *) +(* ======================================================================== *) + +module Kizhltl = struct + + +open Sphere;; +open Euler_main_theorem;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Pack2;; +open Packing3;; +open Rogers;; +open Vukhacky_tactics;; +open Marchal_cells;; +open Emnwuus;; +(* open Marchal_cells_2;; *) +open Marchal_cells_2_new;; +open Urrphbz1;; +open Lepjbdj;; +open Hdtfnfz;; +open Rvfxzbu;; +open Sltstlo;; +open Urrphbz2;; +open Urrphbz3;; +open Ynhyjit;; +open Njiutiu;; +open Tezffsk;; +open Qzksykg;; +open Ddzuphj;; +open Ajripqn;; +open Qzyzmjc;; +open Upfzbzm_support_lemmas;; +open Marchal_cells_3;; +open Grutoti;; + +let KIZHLTL1 = prove_by_refinement (KIZHLTL1_concl, + +[(GEN_TAC); + (ASM_CASES_TAC `saturated V /\ packing (V:real^3->bool)`); + (UP_ASM_TAC THEN STRIP_TAC); + + + (NEW_GOAL `!r. &1 <= r + ==> sum {X | X SUBSET ball (vec 0,r) /\ mcell_set V X} vol <= + vol (ball (vec 0, r))`); + (REPEAT STRIP_TAC); + (ABBREV_TAC `S = {X | X SUBSET ball (vec 0,r) /\ mcell_set V X}`); + (REWRITE_WITH `sum S vol = vol (UNIONS S)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_UNIONS); + (REPEAT STRIP_TAC); + (EXPAND_TAC "S"); + (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA]); + (REWRITE_TAC[GSYM HAS_MEASURE_MEASURE]); + (UP_ASM_TAC THEN EXPAND_TAC "S" THEN REWRITE_TAC[IN;IN_ELIM_THM]); + (REWRITE_TAC[mcell_set; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_MCELL); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN]); + + (ASM_CASES_TAC `~NULLSET (s INTER t)`); + (NEW_GOAL `F`); + (UNDISCH_TAC `s:real^3->bool IN S` THEN UNDISCH_TAC `t:real^3->bool IN S`); + (EXPAND_TAC "S" THEN REWRITE_TAC[IN;IN_ELIM_THM]); + (REWRITE_TAC[mcell_set; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (NEW_GOAL `s = t:real^3->bool`); + (REWRITE_TAC[ASSUME `t = mcell i V ul`; ASSUME `s = mcell i' V ul'`]); + (ABBREV_TAC `j = if i <= 4 then i else 4`); + (ABBREV_TAC `j' = if i' <= 4 then i' else 4`); + (REWRITE_WITH `mcell i V ul = mcell j V ul`); + (EXPAND_TAC "j" THEN COND_CASES_TAC); + (REFL_TAC); + (ASM_SIMP_TAC[ARITH_RULE `~(i <= 4) ==> i >= 4`; + ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_WITH `mcell i' V ul' = mcell j' V ul'`); + (EXPAND_TAC "j'" THEN COND_CASES_TAC); + (REFL_TAC); + (ASM_SIMP_TAC[ARITH_RULE `~(i <= 4) ==> i >= 4`; + ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_WITH `j' = j /\ mcell j' V ul' = mcell j V ul`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[IN]); + (ASM_MESON_TAC[IN]); + (EXPAND_TAC "j'" THEN COND_CASES_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[ARITH_RULE `i <= 4 <=> i=0\/i=1\/i=2\/i=3\/i=4`] + THEN SET_TAC[]); + (SET_TAC[]); + (EXPAND_TAC "j" THEN COND_CASES_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[ARITH_RULE `i <= 4 <=> i=0\/i=1\/i=2\/i=3\/i=4`] + THEN SET_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC); + (REWRITE_WITH `mcell j V ul = mcell i V ul`); + (EXPAND_TAC "j" THEN COND_CASES_TAC); + (REFL_TAC); + (ASM_SIMP_TAC[ARITH_RULE `~(i <= 4) ==> i >= 4`; + ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_WITH `mcell j' V ul' = mcell i' V ul'`); + (EXPAND_TAC "j'" THEN COND_CASES_TAC); + (REFL_TAC); + (ASM_SIMP_TAC[ARITH_RULE `~(i <= 4) ==> i >= 4`; + ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (MATCH_MP_TAC MEASURE_SUBSET); + (REWRITE_TAC[MEASURABLE_BALL]); + (REPEAT STRIP_TAC); + (EXPAND_TAC "S" THEN MATCH_MP_TAC MEASURABLE_UNIONS); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA]); + (UP_ASM_TAC THEN REWRITE_TAC[IN;IN_ELIM_THM; mcell_set]); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[MEASURABLE_MCELL]); + (EXPAND_TAC "S" THEN SET_TAC[]); + +(* ----------------------------------------------------------------------- *) + + (NEW_GOAL `?c. !r. &1 <= r + ==> vol (ball (vec 0, r)) + c * r pow 2 <= + sum (V INTER ball (vec 0,r)) (\u:real^3. vol (voronoi_open V u))`); + (EXISTS_TAC `-- (&24 / &3) * pi`); + (REPEAT STRIP_TAC); + + (ASM_CASES_TAC `r < &6`); + (NEW_GOAL `&0 <= sum (V INTER ball (vec 0,r)) (\u:real^3. vol (voronoi_open V u))`); + (MATCH_MP_TAC SUM_POS_LE); + (ASM_SIMP_TAC[Packing3.KIUMVTC]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC MEASURE_POS_LE); + (ASM_SIMP_TAC[Pack1.measurable_voronoi]); + + (NEW_GOAL `vol (ball ((vec 0):real^3,r)) + (--(&24 / &3) * pi) * r pow 2 <= &0`); + (REWRITE_TAC[REAL_ARITH `a + (--b * c) * d <= &0 <=> a <= b * c * d`]); + (ASM_SIMP_TAC [VOLUME_BALL; REAL_ARITH `&1 <= r ==> &0 <= r`]); + (REWRITE_TAC[REAL_ARITH `&4 / &3 * pi * r pow 3 <= &24 / &3 * pi * r pow 2 + <=> &0 <= &4 / &3 * pi * r pow 2 * (&6 - r)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV THEN REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[PI_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_LE_POW_2]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + + (NEW_GOAL `vol (ball (vec 0,r - &2)) <= + sum (V INTER ball (vec 0,r)) (\u:real^3. vol (voronoi_open V u))`); + (REWRITE_WITH + `sum (V INTER ball (vec 0,r)) (\u:real^3. vol (voronoi_open V u)) = + sum (V INTER ball (vec 0,r)) (\u:real^3. vol (voronoi_closed V u))`); + (MATCH_MP_TAC SUM_EQ); + (REPEAT STRIP_TAC); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[GSYM Pack2.MEASURE_VORONOI_CLOSED_OPEN]); + + (ABBREV_TAC `S:real^3->bool = V INTER ball (vec 0, r)`); + (ABBREV_TAC `g = (\t:real^3. voronoi_closed V t)`); + + (REWRITE_WITH `sum S (\u:real^3. vol (voronoi_closed V u)) = sum S (\t. vol (g t))`); + (EXPAND_TAC "g" THEN REWRITE_TAC[]); + (REWRITE_WITH `sum S (\t:real^3. vol (g t)) = measure (UNIONS (IMAGE g S))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_UNIONS_IMAGE); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "g"); + (REPEAT STRIP_TAC); + (EXPAND_TAC "S"); + (ASM_SIMP_TAC[Packing3.KIUMVTC]); + (MATCH_MP_TAC Pack2.MEASURABLE_VORONOI_CLOSED); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Pack2.NEGLIGIBLE_INTER_VORONOI_CLOSED); + (ASM_SET_TAC[]); + (EXPAND_TAC "g" THEN REWRITE_TAC[IMAGE]); + (MATCH_MP_TAC MEASURE_SUBSET); + (REWRITE_TAC[MEASURABLE_BALL]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC MEASURABLE_UNIONS); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (EXPAND_TAC "S"); + (ASM_SIMP_TAC[Packing3.KIUMVTC]); + + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Pack2.MEASURABLE_VORONOI_CLOSED); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[SUBSET; IN_BALL; IN_UNIONS]); + (REPEAT STRIP_TAC); + (MP_TAC (ASSUME `saturated (V:real^3->bool)`)); + (REWRITE_TAC[saturated] THEN STRIP_TAC); + (NEW_GOAL `?y. y IN V /\ dist (x:real^3,y) < &2`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `?v:real^3. v IN V /\ x IN voronoi_closed V v`); + (MATCH_MP_TAC Packing3.TIWWFYQ); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (EXISTS_TAC `voronoi_closed V (v:real^3)`); + (ASM_REWRITE_TAC[]); + + (ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (EXISTS_TAC `v:real^3`); + (STRIP_TAC); + (EXPAND_TAC "S" THEN REWRITE_TAC[IN_INTER]); + (ASM_REWRITE_TAC[IN_BALL]); + + (NEW_GOAL `dist (vec 0,v) <= dist (vec 0,x) + dist (x, v:real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (x, v:real^3) < &2`); + (NEW_GOAL `dist (x, v) <= dist (x, y:real^3)`); + (UNDISCH_TAC `x:real^3 IN voronoi_closed V v`); + (REWRITE_TAC[IN; voronoi_closed; IN_ELIM_THM]); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (REFL_TAC); + + (NEW_GOAL `vol (ball (vec 0,r)) + (--(&24 / &3) * pi) * r pow 2 <= + vol (ball (vec 0,r - &2))`); + (ASM_SIMP_TAC[VOLUME_BALL; REAL_ARITH `~(r < &6) ==> &0 <= r`; + REAL_ARITH `~(r < &6) ==> &0 <= (r - &2)` ]); + (REWRITE_TAC[REAL_ARITH + `&4 / &3 * pi * r pow 3 + (--(&24 / &3) * pi) * r pow 2 <= + &4 / &3 * pi * (r - &2) pow 3 <=> + &0 <= &4 / &3 * pi * (&12 * r - &8)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV THEN REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (REWRITE_TAC[PI_POS_LE]); + (NEW_GOAL `&12 * r >= &72`); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (EXISTS_TAC `c:real`); + (REPEAT STRIP_TAC); + + (NEW_GOAL `sum {X | X SUBSET ball (vec 0,r) /\ mcell_set V X} vol <= + vol (ball (vec 0,r))`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `vol (ball (vec 0,r)) + c * r pow 2 <= + sum (V INTER ball (vec 0,r)) (\u:real^3. vol (voronoi_open V u))`); + (ASM_SIMP_TAC[]); + (ABBREV_TAC `a1 = sum {X | X SUBSET ball (vec 0,r) /\ mcell_set V X} vol`); + (ABBREV_TAC `a2 = vol (ball ((vec 0):real^3,r))`); + (ABBREV_TAC `a3 = sum (V INTER ball (vec 0,r)) (\u:real^3. vol (voronoi_open V u))`); + (ASM_REAL_ARITH_TAC); + + (EXISTS_TAC `&0`); + (REPEAT STRIP_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[])]);; + +(* ======================================================================== *) +(* KIZHLTL2 *) +(* ======================================================================== *) + +let KIZHLTL2 = prove_by_refinement (KIZHLTL2_concl, + +[(REPEAT STRIP_TAC); + (ASM_CASES_TAC `saturated V /\ packing V`); + (NEW_GOAL + `?C. !r. &1 <= r ==> + &(CARD (V INTER ball ((vec 0):real^3,r) DIFF V INTER ball (vec 0,r - &8))) <= + C * r pow 2`); + (REWRITE_WITH `!r p. V INTER ball (p:real^3,r) DIFF V INTER ball (p,r - &8) + = V INTER ball (p:real^3,r + &0) DIFF V INTER ball (p,r - &8)`); + (ASM_REWRITE_TAC[REAL_ARITH `a + &0 = a`]); + (ASM_SIMP_TAC[PACKING_BALL_BOUNDARY]); + (TAKE_TAC); + (EXISTS_TAC `(&2 * mm1 / pi) * (&4 * pi) * (--C)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `&(CARD (V INTER ball ((vec 0):real^3,r) DIFF + V INTER ball (vec 0,r - &8))) <= C * r pow 2`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `total_solid V = (\X. total_solid V X)`); + (REWRITE_TAC[GSYM ETA_AX]); + (ONCE_ASM_REWRITE_TAC[] THEN DEL_TAC); + (REWRITE_TAC[total_solid]); + (ABBREV_TAC `B = {X | X SUBSET ball (vec 0,r) /\ mcell_set V X}`); + (NEW_GOAL `FINITE (B:(real^3->bool) ->bool)`); + (EXPAND_TAC "B" THEN MATCH_MP_TAC FINITE_MCELL_SET_LEMMA); + (ASM_REWRITE_TAC[]); + (ABBREV_TAC `A1:real^3->bool = V INTER ball (vec 0,r)`); + (ABBREV_TAC `A2:real^3->bool = V INTER ball (vec 0,r - &8)`); + (NEW_GOAL `FINITE (A1:real^3->bool)`); + (EXPAND_TAC "A1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `FINITE (A2:real^3->bool)`); + (EXPAND_TAC "A2" THEN MATCH_MP_TAC FINITE_PACK_LEMMA); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `sum B (\X. sum {u | u IN A2 /\ VX V X u} (\u. sol u X)) + <= sum B (\X. sum (VX V X) (\x. sol x X))`); + (MATCH_MP_TAC SUM_LE); + (ASM_REWRITE_TAC[BETA_THM]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC SUM_SUBSET_SIMPLE); + (REPEAT STRIP_TAC); + (REWRITE_TAC[VX] THEN COND_CASES_TAC); + (REWRITE_TAC[FINITE_EMPTY]); + (LET_TAC); + (COND_CASES_TAC); + (REWRITE_TAC[FINITE_EMPTY]); + (REWRITE_TAC[FINITE_SET_OF_LIST]); + (SET_TAC[]); + (REWRITE_TAC[BETA_THM]); + + (UNDISCH_TAC `x:real^3->bool IN B`); + (EXPAND_TAC "B" THEN REWRITE_TAC[IN; IN_ELIM_THM; mcell_set_2]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `eventually_radial x' (mcell i V ul)`); + (MATCH_MP_TAC Urrphbz2.URRPHBZ2); + (ASM_REWRITE_TAC[]); + (SUBGOAL_THEN `x' IN (VX V x)` MP_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[VX]); + (COND_CASES_TAC); + (SET_TAC[]); + (LET_TAC); + (COND_CASES_TAC); + (SET_TAC[]); + (STRIP_TAC); + + (UNDISCH_TAC `cell_params V x = k,ul'`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[cell_params]); + (ABBREV_TAC `P = (\(k,ul). k <= 4 /\ ul IN barV V 3 /\ x = mcell k V ul)`); + (DISCH_TAC); + (NEW_GOAL `(P:(num#(real^3)list->bool)) (k,ul')`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(i:num,ul:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN] THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "P" THEN REWRITE_TAC[BETA_THM] THEN STRIP_TAC); + (NEW_GOAL `set_of_list (truncate_simplex (k - 1) ul') SUBSET V:real^3->bool`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `k - 1`); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (STRIP_TAC); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + (ASM_SET_TAC[]); + + + (UP_ASM_TAC THEN REWRITE_TAC[eventually_radial]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `sol x' (mcell i V ul) = + &3 * vol ((mcell i V ul) INTER normball x' r') / r' pow 3`); + (MATCH_MP_TAC sol); + (ASM_REWRITE_TAC[GSYM Marchal_cells_2_new.RADIAL_VS_RADIAL_NORM; NORMBALL_BALL]); + (MATCH_MP_TAC MEASURABLE_INTER); + (ASM_SIMP_TAC[MEASURABLE_BALL; MEASURABLE_MCELL]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_ARITH `&0 <= &3`] THEN MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (MATCH_MP_TAC MEASURE_POS_LE); + (MATCH_MP_TAC MEASURABLE_INTER); + (ASM_SIMP_TAC[MEASURABLE_BALL; NORMBALL_BALL; MEASURABLE_MCELL]); + (MATCH_MP_TAC REAL_POW_LE THEN ASM_REAL_ARITH_TAC); + +(* ------------------------------------------------------------------------- *) + + (NEW_GOAL `sum B (\X. sum {u | u IN A2 /\ VX V X u} (\u. sol u X)) = + sum A2 (\u. sum {X | X IN B /\ VX V X u} (\X. sol u X))`); + (MATCH_MP_TAC SUM_SUM_RESTRICT); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `sum A2 (\u. sum {X | X IN B /\ VX V X u} (\X. sol u X)) = + sum A2 (\u. sum {X | mcell_set V X /\ u IN VX V X} + (\X. sol u X))`); + (MATCH_MP_TAC SUM_EQ); + (EXPAND_TAC "A2" THEN REWRITE_TAC[IN_INTER; IN_DIFF] THEN + REWRITE_TAC[IN_BALL; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (REWRITE_WITH `{X | B X /\ VX V X x} = + {X | mcell_set V X /\ VX V X x}`); + (REWRITE_TAC[SET_RULE `a = b <=> a SUBSET b /\ b SUBSET a`]); + (STRIP_TAC); + (EXPAND_TAC "B"); + (SET_TAC[]); + (REWRITE_WITH `!x:real^3->bool. B x <=> x IN B`); + (REWRITE_TAC[IN]); + (EXPAND_TAC "B" THEN REWRITE_TAC[SUBSET; IN_INTER; IN_DIFF] THEN + REWRITE_TAC[IN_BALL; IN; IN_ELIM_THM]); + (REWRITE_TAC[MESON[] `A /\ X /\ Y ==> (B /\ A) /\ X /\ Y <=> A /\ X /\ Y ==> B`]); + (REPEAT STRIP_TAC); + (NEW_GOAL `x IN VX V x'`); + (ASM_REWRITE_TAC[IN]); + (NEW_GOAL `~NULLSET x'`); + (UNDISCH_TAC `x IN VX V x'` THEN REWRITE_TAC[VX] THEN COND_CASES_TAC); + (SET_TAC[]); + (MESON_TAC[]); + + (NEW_GOAL `dist (vec 0, x'':real^3) <= dist (vec 0, x) + dist (x, x'')`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `?p. x' SUBSET ball (p:real^3,&4)`); + (MATCH_MP_TAC MCELL_SUBSET_BALL_4); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[SUBSET; IN_BALL] THEN STRIP_TAC); + (NEW_GOAL `dist (x, x'':real^3) <= dist (x, p) + dist (p, x'')`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (x, p:real^3) < &4`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `VX V x' = V INTER x'`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (UNDISCH_TAC `mcell_set V x'` THEN REWRITE_TAC[mcell_set; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + (NEW_GOAL `dist (p:real^3,x'') < &4`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[IN]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + +(* ------------------------------------------------------------------------ *) + + (UP_ASM_TAC); + (REWRITE_WITH `sum A2 (\u. sum {X | mcell_set V X /\ u IN VX V X} (\X. sol u X)) = sum A2 (\u. &4 * pi)`); + (MATCH_MP_TAC SUM_EQ); + (REWRITE_TAC[BETA_THM] THEN REPEAT STRIP_TAC); + (MATCH_MP_TAC Qzyzmjc.QZYZMJC); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ASM_SIMP_TAC[SUM_CONST]); + (STRIP_TAC); + + (ABBREV_TAC `s1 = sum B (\X. sum (VX V X) (\x. sol x X))`); + (NEW_GOAL `&(CARD (A2:real^3->bool)) * &4 * pi <= s1`); + (ABBREV_TAC `s2 = sum B (\X. sum {u | u IN A2 /\ VX V X u} (\u. sol u X))`); + (ABBREV_TAC `s3 = sum A2 (\u. sum {X | X IN B /\ VX V X u} (\X. sol u X))`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `(&2 * mm1 / pi) * &(CARD (A2:real^3->bool)) * &4 * pi <= (&2 * mm1 / pi) * s1`); + (REWRITE_TAC[REAL_ARITH `a * b <= a * c <=> &0 <= (c - b) * a`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[PI_POS_LE]); + (NEW_GOAL `#1.012080 < mm1`); + (REWRITE_TAC[Flyspeck_constants.bounds]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `&(CARD (A1:real^3->bool)) * &8 * mm1 + + ((&2 * mm1 / pi) * (&4 * pi) * --C) * r pow 2 <= + (&2 * mm1 / pi) * &(CARD (A2:real^3->bool)) * &4 * pi`); + (REWRITE_TAC[REAL_ARITH `((&2 * mm1 / pi) * (&4 * pi) * --C) * r pow 2 = + (--C * r pow 2) * (&8 * mm1) * (pi / pi)`]); + (REWRITE_TAC[REAL_ARITH `(&2 * mm1 / pi) * &(CARD A2) * &4 * pi = + &(CARD A2) * (&8 * mm1) * (pi / pi)`]); + (REWRITE_WITH `pi / pi = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (MP_TAC PI_POS THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_MUL_RID; REAL_ARITH `a * b + c * b <= d * b <=> + &0 <= (d - a - c) * b `]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b - (--c * x) <=> b - a <= c * x`]); + + (NEW_GOAL `A2 SUBSET A1:real^3->bool`); + (EXPAND_TAC "A1" THEN EXPAND_TAC "A2"); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> V INTER A SUBSET V INTER B`)); + (MATCH_MP_TAC SUBSET_BALL); + (REAL_ARITH_TAC); + (REWRITE_WITH `&(CARD (A1:real^3->bool)) - &(CARD (A2:real^3->bool)) = + &(CARD A1 - CARD A2)`); + (MATCH_MP_TAC REAL_OF_NUM_SUB); + (MATCH_MP_TAC CARD_SUBSET); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `CARD (A1:real^3->bool) - CARD (A2:real^3->bool) = + CARD (A1 DIFF A2)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_DIFF); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC REAL_LE_MUL); + (NEW_GOAL `#1.012080 < mm1`); + (REWRITE_TAC[Flyspeck_constants.bounds]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + + (ASM_REAL_ARITH_TAC); + (EXISTS_TAC `&0`); + (REPEAT STRIP_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[])]);; + +(* ======================================================================== *) +(* KIZHLTL4 *) +(* ======================================================================== *) + +let KIZHLTL4_concl = + `!V. ?c. !r. saturated V /\ packing V /\ &1 <= r + ==> (&8 * mm2 / pi) * + sum {X | X SUBSET ball (vec 0,r) /\ mcell_set V X} + (\X. sum (edgeX V X) + (\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)) + + c * r pow 2 <= + &8 * + mm2 * + sum (V INTER ball (vec 0,r)) + (\u. sum {v | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v])))`;; + +let KIZHLTL4 = prove_by_refinement (KIZHLTL4_concl, + +[(REPEAT STRIP_TAC); + (ASM_CASES_TAC `saturated V /\ packing V`); + (ABBREV_TAC `c = &8 * mm2 * (&0)`); + (EXISTS_TAC `c:real`); (* choose d later *) + +(* ------------------------------------------------------------------------- *) + + (REPEAT STRIP_TAC); + (ABBREV_TAC `S1 = {X | X SUBSET ball (vec 0,r) /\ mcell_set V X}`); + (ABBREV_TAC `V1:real^3->bool = V INTER ball (vec 0, r)`); + (ABBREV_TAC `T1 = {{u,v:real^3} | u IN V1 /\ v IN V1}`); + + (NEW_GOAL `FINITE (S1:(real^3->bool)->bool)`); + (EXPAND_TAC "S1"); + (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA]); + + (NEW_GOAL `FINITE (T1:(real^3->bool)->bool)`); + (EXPAND_TAC "T1"); + (REWRITE_TAC[GSYM set_of_list]); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `IMAGE (set_of_list) {[u; v:real^3] | u IN V1 /\ v IN V1}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE); + (REWRITE_TAC[SET_RULE `{[u;v] | u IN s /\ v IN s} = + {y | ?u0 u1. u0 IN s /\ u1 IN s /\ y = [u0; u1]}`]); + (MATCH_MP_TAC FINITE_LIST_KY_LEMMA_2); + (EXPAND_TAC "V1" THEN MATCH_MP_TAC Packing3.KIUMVTC); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + + (ABBREV_TAC + `S2 = {X | X SUBSET ball (vec 0,r) /\ mcell_set V X /\ ~NULLSET X}`); + (NEW_GOAL `FINITE (S2:(real^3->bool)->bool)`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `S1:(real^3->bool)->bool`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "S1" THEN EXPAND_TAC "S2" THEN SET_TAC[]); + + (ABBREV_TAC `g = (\X. (\({u, v}). + if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0))`); + (REWRITE_WITH +`sum S1 (\X. sum (edgeX V X) + (\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)) = + sum S1 (\X. sum (edgeX V X) (\({u, v}). g X {u,v}))`); + (MATCH_MP_TAC SUM_EQ); + + (EXPAND_TAC "S1" THEN REWRITE_TAC[IN_ELIM_THM; IN; mcell_set_2]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC SUM_EQ); + (REWRITE_WITH `!x'. x' IN edgeX V x <=> + ?u v. VX V x u /\ VX V x v /\ ~(u = v) /\ x' = {u, v}`); + (REWRITE_TAC[IN; IN_ELIM_THM; edgeX]); + (MESON_TAC[]); + (REPEAT STRIP_TAC); + + (ABBREV_TAC `f_temp = (\u v. if edgeX V x {u, v} + then dihX V x (u,v) * lmfun (hl [u; v]) + else &0)`); + (NEW_GOAL `!u v. (f_temp:real^3->real^3->real) u v = f_temp v u`); + (EXPAND_TAC "f_temp" THEN REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]); + (REPEAT GEN_TAC THEN COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_WITH `dihX V x (u',v') = dihX V x (v',u')`); + (MATCH_MP_TAC DIHX_SYM); + (ASM_REWRITE_TAC[IN; mcell_set; IN_ELIM_THM]); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `ul:(real^3)list` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REFL_TAC); + + (REWRITE_WITH `(\({u, v}). if edgeX V x {u, v} + then dihX V x (u,v) * lmfun (hl [u; v]) + else &0) = (\({u, v}). f_temp u v)`); + (EXPAND_TAC "f_temp"); + (REWRITE_TAC[]); + + (REWRITE_TAC[BETA_SET_2_THM; ASSUME `x' = {u,v:real^3}`]); + (REWRITE_WITH `(\({u, v}). f_temp u v) {u, v} = + (f_temp:real^3->real^3->real) u v`); + (MATCH_MP_TAC BETA_PAIR_THM); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `(g:(real^3->bool)->(real^3->bool)->real) x = + (\({u, v}). f_temp u v)`); + (EXPAND_TAC "f_temp" THEN EXPAND_TAC "g" THEN REWRITE_TAC[IN]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC BETA_PAIR_THM); + (ASM_REWRITE_TAC[]); + +(* ----------------------------------------------------------------------- *) + + (REWRITE_WITH `sum S1 (\X. sum (edgeX V X) (\({u, v}). g X {u, v})) = + sum S1 (\X. sum (edgeX V X) (g X))`); + (MATCH_MP_TAC SUM_EQ); + (REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (MATCH_MP_TAC SUM_EQ); + (REWRITE_TAC[edgeX; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[BETA_SET_2_THM]); + + (REWRITE_WITH `sum S1 (\X. sum (edgeX V X) (g X)) = + sum S2 (\X. sum (edgeX V X) (g X))`); + (MATCH_MP_TAC SUM_SUPERSET); + (STRIP_TAC); + (EXPAND_TAC "S1" THEN EXPAND_TAC "S2" THEN SET_TAC[]); + (EXPAND_TAC "S1" THEN EXPAND_TAC "S2" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC SUM_EQ_0); + (REPEAT STRIP_TAC); + + (ABBREV_TAC `f_temp = (\u v. if edgeX V x {u, v} + then dihX V x (u,v) * lmfun (hl [u; v]) + else &0)`); + (NEW_GOAL `!u v. (f_temp:real^3->real^3->real) u v = f_temp v u`); + (EXPAND_TAC "f_temp" THEN REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]); + (REPEAT GEN_TAC THEN COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_WITH `dihX V x (u,v) = dihX V x (v,u)`); + + (MATCH_MP_TAC DIHX_SYM); + (ASM_REWRITE_TAC[IN; mcell_set; IN_ELIM_THM]); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REFL_TAC); + + (REWRITE_WITH `(g:(real^3->bool)->(real^3->bool)->real) x = + (\({u, v}). f_temp u v)`); + (EXPAND_TAC "f_temp" THEN EXPAND_TAC "g" THEN REWRITE_TAC[IN]); + (UNDISCH_TAC `x' IN edgeX V x` THEN REWRITE_TAC[IN;IN_ELIM_THM; edgeX]); + (STRIP_TAC); + (ASM_SIMP_TAC[BETA_PAIR_THM]); + (EXPAND_TAC "f_temp"); + (COND_CASES_TAC); + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REFL_TAC); + + (REWRITE_WITH + `sum S2 (\X. sum (edgeX V X) (g X)) = + sum S2 (\X. sum {e | e IN T1 /\ edgeX V X e} (g X))`); + (MATCH_MP_TAC SUM_EQ); + (EXPAND_TAC "S2" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_TAC[SET_RULE `a = b <=> b SUBSET a /\ a SUBSET b`]); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[SET_RULE `A SUBSET {y | T2 y /\ A y} <=> A SUBSET T2`]); + (EXPAND_TAC "T1" THEN REWRITE_TAC[SUBSET; edgeX; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXPAND_TAC "V1" THEN REWRITE_TAC[IN_ELIM_THM]); + (EXISTS_TAC `u:real^3` THEN EXISTS_TAC `v:real^3`); + (REWRITE_TAC[ASSUME `x' = {u, v:real^3}`; IN_INTER; + MESON[IN] `V (x:real^3) <=> x IN V`]); + (NEW_GOAL `VX V x = V INTER x`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (UNDISCH_TAC `mcell_set V x` THEN REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (STRIP_TAC); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + + (REWRITE_WITH + `sum S2 (\X. sum {e | e IN T1 /\ edgeX V X e} (g X)) = + sum T1 (\x. sum {X | X IN S2 /\ edgeX V X x} (\X. g X x))`); + (REWRITE_WITH + `sum S2 (\X. sum {e | e IN T1 /\ edgeX V X e} (g X)) = + sum S2 (\X. sum {e | e IN T1 /\ edgeX V X e} (\x.g X x))`); + (REWRITE_TAC[ETA_AX]); + (ASM_SIMP_TAC[SUM_SUM_RESTRICT]); + +(* May 09 - OK here *) + + (ABBREV_TAC + `T2 = {{u0:real^3, u1} | u0 IN V1 /\ u1 IN V1 /\ ~(u0 = u1) /\ + hl[u0;u1] <= h0}`); + (NEW_GOAL `sum T1 (\x. sum {X | X IN S2 /\ edgeX V X x} (\X. g X x)) = + sum T2 (\x. sum {X | X IN S2 /\ edgeX V X x} (\X. g X x))`); + (MATCH_MP_TAC SUM_SUPERSET); + (EXPAND_TAC "T1" THEN EXPAND_TAC "T2" THEN REWRITE_TAC[IN; IN_ELIM_THM] THEN + REPEAT STRIP_TAC); + (SET_TAC[]); + (MATCH_MP_TAC SUM_EQ_0); + (EXPAND_TAC "g" THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (ABBREV_TAC `f_temp = (\u v. if {u, v} IN edgeX V x' + then dihX V x' (u,v) * lmfun (hl [u; v]) + else &0)`); + (REWRITE_WITH `(\({u, v}). if {u, v} IN edgeX V x' + then dihX V x' (u,v) * lmfun (hl [u; v]) + else &0) = (\({u, v}). f_temp u v)`); + (EXPAND_TAC "f_temp"); + (REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `(\({u, v}). f_temp u v) {u, v} = + (f_temp:real^3->real^3->real) u v`); + (MATCH_MP_TAC BETA_PAIR_THM); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "f_temp"); + (REPEAT GEN_TAC THEN REPEAT COND_CASES_TAC); + (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} ={b,a}`]); + (REWRITE_WITH `dihX V x' (u',v') = dihX V x' (v',u')`); + (MATCH_MP_TAC DIHX_SYM); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `x' IN {X | S2 X /\ edgeX V X x}`); + (EXPAND_TAC "S2" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (MESON_TAC[]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REFL_TAC); + + (EXPAND_TAC "f_temp"); + (COND_CASES_TAC); + + (ASM_CASES_TAC `hl [u; v:real^3] <= h0`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~(?u0 u1. + (V1 u0 /\ V1 u1 /\ ~(u0 = u1) /\ hl [u0; u1] <= h0) /\ + x = {u0, u1:real^3})` THEN REWRITE_TAC[]); + (EXISTS_TAC `u:real^3` THEN EXISTS_TAC `v:real^3`); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `{u, v} IN edgeX V x'` THEN REWRITE_TAC[IN; IN_ELIM_THM; edgeX]); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_WITH `lmfun (hl [u; v:real^3]) = &0`); + (ASM_REWRITE_TAC[lmfun]); + (REAL_ARITH_TAC); + (REFL_TAC); + + (ASM_REWRITE_TAC[]); +(* ==================================================================== *) +(* REALLY OK Here *) + + (MATCH_MP_TAC (REAL_ARITH `(?b. a <= b /\ b + d <= e) ==> a + d <= e`)); + (EXISTS_TAC `(&8 * mm2 / pi) * + sum T2 (\x. sum {X | mcell_set V X /\ x IN edgeX V X} (\X. g X x))`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a * b <= a * c <=> &0 <= a * (c - b)`]); + (MATCH_MP_TAC REAL_LE_MUL THEN STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL THEN STRIP_TAC); + (REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV THEN SIMP_TAC[ZERO_LE_MM2_LEMMA; PI_POS_LE]); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (MATCH_MP_TAC SUM_LE THEN REPEAT STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `T1:(real^3->bool)->bool`); + (ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]); + (REWRITE_TAC[BETA_THM]); + (MATCH_MP_TAC SUM_SUBSET_SIMPLE); + + (STRIP_TAC); + (REWRITE_TAC[IN] THEN MATCH_MP_TAC Marchal_cells_3.FINITE_EDGE_X2); + (UP_ASM_TAC THEN EXPAND_TAC "T2" THEN REWRITE_TAC[IN; IN_ELIM_THM] + THEN STRIP_TAC); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + + (EXPAND_TAC "S2" THEN REWRITE_TAC[IN] THEN SET_TAC[]); + (REWRITE_TAC[BETA_THM]); + (REWRITE_WITH `g x' x = gammaY V x' lmfun x`); + (EXPAND_TAC "g" THEN REWRITE_TAC[gammaY]); + (MATCH_MP_TAC gamma_y_pos_le); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[IN_DIFF; IN; IN_ELIM_THM]); + (MESON_TAC[]); + (REWRITE_WITH + `sum T2 (\x. sum {X | mcell_set V X /\ x IN edgeX V X} (\X. g X x)) = + sum T2 (\x. &2 * pi * lmfun (radV x))`); + (MATCH_MP_TAC SUM_EQ); + (REPEAT STRIP_TAC); + (REWRITE_TAC[BETA_THM]); + (EXPAND_TAC "g"); + + (REWRITE_TAC[HL; BETA_THM; set_of_list]); + (UP_ASM_TAC THEN EXPAND_TAC "T2" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (STRIP_TAC); + + (REWRITE_WITH `sum {X | mcell_set V X /\ edgeX V X x} + (\X. (\({u, v}). if edgeX V X {u, v} + then dihX V X (u,v) * lmfun (radV {u, v}) else &0) x) = + sum {X | mcell_set V X /\ edgeX V X x} + (\X. (if edgeX V X {u0, u1} + then dihX V X (u0,u1) * lmfun (radV {u0, u1}) else &0))`); + (MATCH_MP_TAC SUM_EQ); + (ASM_REWRITE_TAC[IN; IN_ELIM_THM; BETA_THM] THEN REPEAT STRIP_TAC); + (ABBREV_TAC + `f_temp = (\u v. if edgeX V x' {u, v} + then dihX V x' (u,v) * lmfun (radV {u, v}) else &0)`); + (NEW_GOAL `!u:real^3 v:real^3. + (f_temp:real^3->real^3->real) u v = f_temp v u`); + (EXPAND_TAC "f_temp" THEN REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]); + (REPEAT GEN_TAC THEN COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_WITH `dihX V x' (u,v) = dihX V x' (v,u)`); + + (MATCH_MP_TAC DIHX_SYM); + (ASM_REWRITE_TAC[IN; mcell_set; IN_ELIM_THM]); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REFL_TAC); + + (REWRITE_WITH + `(\({u, v}). if edgeX V x' {u, v} + then dihX V x' (u,v) * lmfun (radV {u, v}) + else &0) + = (\({u, v}). f_temp u v)`); + (EXPAND_TAC "f_temp" THEN REWRITE_TAC[IN]); + (REWRITE_WITH + `(if edgeX V x' {u0, u1} + then dihX V x' (u0,u1) * lmfun (radV {u0, u1}) else &0) = + f_temp u0 u1`); + (EXPAND_TAC "f_temp" THEN REWRITE_TAC[IN]); + (MATCH_MP_TAC BETA_PAIR_THM); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `FINITE {X | mcell_set V X /\ edgeX V X x}`); + (MATCH_MP_TAC Marchal_cells_3.FINITE_EDGE_X2); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC [SUM_CASES]); + + (REWRITE_TAC[SET_RULE + `{X | X IN {X | mcell_set V X /\ edgeX V X {u0, u1}} /\ edgeX V X {u0, u1}} = + {X | mcell_set V X /\ edgeX V X {u0, u1}} /\ + {X | X IN {X | mcell_set V X /\ edgeX V X {u0, u1}} /\ + ~edgeX V X {u0, u1}} = {}`; SUM_CLAUSES; REAL_ARITH `a + &0 = a`]); + (REWRITE_TAC[SUM_RMUL]); + (REWRITE_WITH + `sum {X | mcell_set V X /\ edgeX V X {u0, u1}} (\X. dihX V X (u0,u1)) = + &2 * pi`); + (REWRITE_WITH + `{X | mcell_set V X /\ edgeX V X {u0, u1}} = + {X | mcell_set V X /\ {u0, u1} IN edgeX V X}`); + (REWRITE_TAC[IN]); + (MATCH_MP_TAC GRUTOTI); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + (NEW_GOAL `h0 < sqrt (&2)`); + (REWRITE_TAC[H0_LT_SQRT2]); + (ASM_REAL_ARITH_TAC); + (REAL_ARITH_TAC); + (REWRITE_TAC[SUM_LMUL; REAL_ARITH `(&8 * mm2 / pi) * &2 * pi * a = + (&8 * mm2) * (pi / pi) * (&2 * a)`]); + (REWRITE_WITH `pi / pi = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[PI_NZ]); + (REWRITE_TAC[REAL_ARITH `&1 * a = a`]); + (EXPAND_TAC "c"); + (REWRITE_TAC[REAL_ARITH + `(&8 * mm2) * a + (&8 * mm2 * d) * b <= &8 * mm2 * c <=> + &0 <= (&8 * mm2) * (c - a - d * b)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (SIMP_TAC[REAL_LE_MUL; REAL_ARITH `&0 <= &8`; ZERO_LE_MM2_LEMMA]); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b - c <=> b + c <= a`]); + + (EXPAND_TAC "T2"); + (REWRITE_TAC[Marchal_cells_3.HL_2; + REAL_ARITH `inv (&2) * x <= y <=> x <= &2 * y`]); + (REWRITE_WITH `&2 * + sum + {{u0:real^3, u1} | u0 IN V1 /\ u1 IN V1 /\ + ~(u0 = u1) /\ dist (u0,u1) <= &2 * h0} + (\x. lmfun (radV x)) = + sum + {u0:real^3,u1 | u0 IN V1 /\ u1 IN V1 /\ + ~(u0 = u1) /\ dist (u0,u1) <= &2 * h0} + (\(u0,u1). (\x. lmfun (radV x)) {u0, u1})`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC SUM_PAIR_2_SET); + (EXPAND_TAC "V1"); + (ASM_SIMP_TAC [Packing3.KIUMVTC]); + (REWRITE_TAC[GSYM Marchal_cells_3.HL_2; HL;set_of_list]); + + (ABBREV_TAC + `t = (\u:real^3. {v | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0})`); + (ABBREV_TAC `f_temp = (\u v. lmfun (radV {u:real^3, v}))`); + + (REWRITE_WITH +`sum V1 + (\u. sum {v | v IN V /\ ~(u = v) /\ dist (u,v:real^3) <= &2 * h0} + (\v. lmfun (radV {u, v}))) = + sum V1 + (\u:real^3. sum + ((t:real^3->real^3->bool) u) ((f_temp:real^3->real^3->real) u))`); + + (EXPAND_TAC "f_temp" THEN EXPAND_TAC "t"); + (REWRITE_TAC[]); + + (REWRITE_WITH + `sum V1 (\i. sum (t i) (f_temp i)) = + sum {u0:real^3,u1:real^3 | u0 IN V1 /\ u1 IN t u0} (\(u0,u1). f_temp u0 u1)`); + (MATCH_MP_TAC SUM_SUM_PRODUCT); + (REPEAT STRIP_TAC); + (EXPAND_TAC "V1"); + (ASM_SIMP_TAC [Packing3.KIUMVTC]); + (EXPAND_TAC "t"); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `(V:real^3->bool) INTER ball (vec 0, r + &2 * h0)`); + (STRIP_TAC); + (ASM_SIMP_TAC [Packing3.KIUMVTC]); + (REWRITE_TAC[SUBSET; IN; IN_INTER; IN_BALL; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `dist (vec 0, x) <= dist (vec 0, u0) + dist (u0, x:real^3)`); + (NORM_ARITH_TAC); + (NEW_GOAL `dist (vec 0, u0:real^3) < r`); + (REWRITE_TAC[GSYM IN_BALL]); + (UNDISCH_TAC `u0:real^3 IN V1` THEN EXPAND_TAC "V1" THEN SET_TAC[]); + (ASM_REAL_ARITH_TAC); + (EXPAND_TAC "t" THEN EXPAND_TAC "f_temp"); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (REWRITE_TAC[REAL_ARITH `a + &0 * r pow 2 = a`]); + (MATCH_MP_TAC SUM_SUBSET_SIMPLE); + (REPEAT STRIP_TAC); + + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC + `{u0:real^3,u1:real^3 |u0 IN V1 /\u1 IN V INTER ball (vec 0, r + &2 * h0)}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_PRODUCT); + (STRIP_TAC); + (EXPAND_TAC "V1"); + (ASM_SIMP_TAC [Packing3.KIUMVTC]); + (ASM_SIMP_TAC [Packing3.KIUMVTC]); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) s <=> s IN A`]); + (REWRITE_TAC[IN_BALL; IN_INTER; IN]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `dist (vec 0, u1) <= dist (vec 0, u0) + dist (u0, u1:real^3)`); + (NORM_ARITH_TAC); + (NEW_GOAL `dist (vec 0, u0:real^3) < r`); + (REWRITE_TAC[GSYM IN_BALL]); + (UNDISCH_TAC `(V1:real^3->bool) u0` THEN EXPAND_TAC "V1"); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) s <=> s IN A`]); + (SET_TAC[]); + (ASM_REAL_ARITH_TAC); + (EXPAND_TAC "V1" THEN + REWRITE_TAC[MESON[IN] `(A:real^3->bool) s <=> s IN A`; IN_INTER] THEN + SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_DIFF; IN_ELIM_THM; IN]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[lmfun_pos_le]); + + (EXISTS_TAC `&0`); + (REPEAT STRIP_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[])]);; + +(* ------ Finish the proof of KIZHLTL 1, KIZHLTL 2, KIZHLTL 4 -------- *) + + + end;; diff --git a/text_formalization/packing/LEPJBDJ.hl b/text_formalization/packing/LEPJBDJ.hl new file mode 100755 index 0000000..ef663ba --- /dev/null +++ b/text_formalization/packing/LEPJBDJ.hl @@ -0,0 +1,927 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: LEPJBDJ *) +(* Chaper : Packing (Marchal cells) *) +(* *) +(* ========================================================================= *) + +(* ========================================================================= *) +(* FILES NEED TO BE LOADED *) + +(* flyspeck_needs "packing/marchal_cells_2.hl";; *) + +(* ========================================================================= *) +module Lepjbdj = struct + +open Rogers;; +(* open Prove_by_refinement;; *) +open Vukhacky_tactics;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Sphere;; +open Marchal_cells;; +open Emnwuus;; +open Marchal_cells_2_new;; + +let LEPJBDJ_concl = `!V ul k. + saturated V /\ packing V /\ barV V 3 ul /\ (1 <= k) /\ (k <= 4) /\ + ~(mcell k V ul = {})==> + (V INTER mcell k V ul = set_of_list (truncate_simplex (k-1) ul))`;; + +let LEPJBDJ_0_concl = + `!V ul. + saturated V /\ + packing V /\ + barV V 3 ul + ==> V INTER mcell 0 V ul = {}`;; + +(* ========================================================================= *) + +let LEPJBDJ = prove_by_refinement ( + LEPJBDJ_concl, +[(REPEAT STRIP_TAC); + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `~(u0 = u1:real^3)`); + (STRIP_TAC); + (NEW_GOAL `CARD {u0,u1,u2,u3:real^3} = 4`); + (REWRITE_WITH `{u0,u1,u2,u3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[SET_RULE `{a,a,b,c} = {a,b,c}`]); + (NEW_GOAL `CARD {u1,u2,u3:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + +(*==== Next, we will consider 4 case of k = 1,2,3 and k >= 4 ======= *) +(* -------------------------------------------------------------------- *) + (ASM_CASES_TAC `k = 1`); + (ASM_REWRITE_TAC[ARITH_RULE `1 - 1 = 0`; TRUNCATE_SIMPLEX_EXPLICIT_0; set_of_list; MCELL_EXPLICIT; mcell1; HD;TL; TRUNCATE_SIMPLEX_EXPLICIT_1]); + (COND_CASES_TAC); + (REWRITE_TAC[SET_EQ_LEMMA; IN_SING]); + (REPEAT STRIP_TAC); + (NEW_GOAL `x IN V INTER cball (u0:real^3,sqrt (&2))`); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_INTER; cball]); + (STRIP_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[IN;IN_ELIM_THM] THEN STRIP_TAC); + (UNDISCH_TAC `packing (V:real^3->bool)` THEN REWRITE_TAC[packing]); + (STRIP_TAC); + (ASM_CASES_TAC `x = u0:real^3`); + (ASM_MESON_TAC[]); + (NEW_GOAL `F`); + (NEW_GOAL `&2 <= dist (u0,x:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ONCE_REWRITE_TAC[GSYM IN] THEN MATCH_MP_TAC (SET_RULE `(?b. a IN b /\ b SUBSET c) ==> a IN c`)); + (EXISTS_TAC `set_of_list (ul:(real^3)list)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `x:real^3 IN V` THEN REWRITE_TAC[IN]); + (NEW_GOAL `sqrt (&2) < &2`); + (REWRITE_TAC[SQRT2_LT_2]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + + (REWRITE_TAC[IN_INTER; IN_DIFF]); + (REPEAT STRIP_TAC); (* break into 3 subgoals *) + + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `(?b. a IN b /\ b SUBSET c) ==> a IN c`)); + (EXISTS_TAC `set_of_list (ul:(real^3)list)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `rogers V ul = convex hull + {HD ul, omega_list_n V ul 1, omega_list_n V ul 2, omega_list_n V ul 3}`); + (MATCH_MP_TAC ROGERS_EXPLICIT); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[HD]); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (SET_TAC[]); + (ASM_REWRITE_TAC[cball; IN; IN_ELIM_THM; DIST_REFL]); + (MATCH_MP_TAC SQRT_POS_LE); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[rcone_gt; rconesgn; IN; IN_ELIM_THM; + VECTOR_SUB_REFL; DOT_LZERO; ARITH_RULE `~(a > b) <=> a <= b`; DIST_REFL; + REAL_MUL_LZERO; REAL_LE_REFL]); + (NEW_GOAL `F`); + (UNDISCH_TAC `~(mcell k V ul = {})`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell1]); + (ASM_MESON_TAC[]); + +(* -------------------------------------------------------------------- *) + (ASM_CASES_TAC `k = 2`); + (ASM_REWRITE_TAC[ARITH_RULE `2 - 1 = 1`; TRUNCATE_SIMPLEX_EXPLICIT_1; + MCELL_EXPLICIT; mcell2;HD;TL]); + (COND_CASES_TAC); + (LET_TAC); + (NEW_GOAL `hl [u0;u1:real^3] = inv(&2) * dist (u1,u0)`); + (REWRITE_WITH `hl [u0;u1:real^3] = + dist (circumcenter (set_of_list [u0;u1]),HD [u0;u1])`); + (MATCH_MP_TAC Rogers.HL_EQ_DIST0); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + (REWRITE_TAC[set_of_list; Rogers.CIRCUMCENTER_2; midpoint; HD; dist]); + (NORM_ARITH_TAC); + + (NEW_GOAL `&0 < a /\ a < &1`); + (EXPAND_TAC "a"); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LT_DIV); + (SIMP_TAC[SQRT_POS_LT; ARITH_RULE `&0 < &2`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_SIMP_TAC[REAL_LT_INV; ARITH_RULE `&0 < &2`]); + (MATCH_MP_TAC DIST_POS_LT THEN ASM_MESON_TAC[]); + (REWRITE_WITH `hl [u0; u1:real^3] / sqrt (&2) < &1 <=> + hl [u0; u1] < &1 * sqrt (&2)`); + (MATCH_MP_TAC REAL_LT_LDIV_EQ); + (SIMP_TAC[SQRT_POS_LT; ARITH_RULE `&0 < &2`]); + (REWRITE_TAC[REAL_MUL_LID]); + (ASM_MESON_TAC[]); + + + (REWRITE_TAC[set_of_list; SET_EQ_LEMMA]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `x IN {u0,u1:real^3}`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (SWITCH_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[IN_INTER] THEN STRIP_TAC); + + + (ABBREV_TAC `v = proj_point (u1 - u0:real^3) (x - u0) `); + (NEW_GOAL `(x - u0 - v:real^3) dot (u1 - u0) = &0`); + (EXPAND_TAC "v"); + (REWRITE_TAC[GSYM projection_proj_point]); + (REWRITE_TAC[Packing3.PROJECTION_ORTHOGONAL]); + + (NEW_GOAL `between (v+u0) (u0,u1:real^3)`); + (ASM_CASES_TAC `between (v+u0) (u0,u1:real^3)`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `between (v+u0) (u0,u1:real^3) \/ between u0 (u1,v+u0) \/ between u1 (v+u0,u0)`); + (REWRITE_TAC[GSYM COLLINEAR_BETWEEN_CASES]); + (MATCH_MP_TAC Collect_geom.IN_AFFINE_HULL_IMP_COLLINEAR); + (REWRITE_TAC[AFFINE_HULL_2; IN_ELIM_THM; IN]); + (EXPAND_TAC "v"); + (REWRITE_TAC[PRO_EXP]); + (ABBREV_TAC `t = ((x - u0) dot (u1 - u0)) / ((u1 - u0) dot (u1 - u0):real^3)`); + (EXISTS_TAC `(&1 - t)` THEN EXISTS_TAC `t:real`); + (REWRITE_TAC[REAL_ARITH `(&1 - t) + t = &1`]); + (VECTOR_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC); + + (UNDISCH_TAC `x:real^3 IN rcone_ge u0 u1 a`); + (REWRITE_TAC[rcone_ge;rconesgn;IN;IN_ELIM_THM; ARITH_RULE `~(a >= b) <=> a < b`]); + (NEW_GOAL `(x - u0) dot (u1 - u0:real^3) <= &0`); + (UP_ASM_TAC THEN REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2; + IN;IN_ELIM_THM] THEN STRIP_TAC); + (REWRITE_WITH `(x - u0) dot (u1 - u0:real^3) = (x - u0 - v) dot (u1 - u0) + + v dot (u1 - u0)`); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[ASSUME `(x - u0 - v) dot (u1 - u0:real^3) = &0`; REAL_ADD_LID]); + (MP_TAC (ASSUME `u0 = u % u1 + v' % (v + u0:real^3)`) THEN + REWRITE_WITH `u0 = u % u1 + v' % (v + u0:real^3) + <=> (u + v') % u0 = u % u1 + v' % (v + u0)`); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `(u + v') % u0 = u % u1 + v' % (v + u0) + <=> u % (u0 - u1) = v' % v`]); + (STRIP_TAC); + (UP_ASM_TAC); + (REWRITE_WITH `u % (u0 - u1) = v' % v <=> u / v' % (u0 - u1:real^3) = v`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Trigonometry2.VEC_DIV_MOV); + (STRIP_TAC); + (MP_TAC (ASSUME `u0 = u % u1 + v' % (v + u0:real^3)`)); + (REWRITE_WITH `u = &1 /\ v' = &0`); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO; VECTOR_ADD_RID]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[DOT_LMUL]); + (REWRITE_WITH `(u0 - u1) dot (u1 - u0) = --((u0 - u1:real^3) dot (u0 - u1))`); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_SQUARE_NORM]); + (REWRITE_TAC[REAL_ARITH `a * -- b <= &0 <=> &0 <= a * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_LE_POW_2]); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `&0 < dist (x,u0) * dist (u1,u0:real^3) * a`); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_SET_TAC[]); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + +(* ==== *) + + (UNDISCH_TAC `x:real^3 IN rcone_ge u1 u0 a`); + (REWRITE_TAC[rcone_ge;rconesgn;IN;IN_ELIM_THM; ARITH_RULE `~(a >= b) <=> a < b`]); + (NEW_GOAL `(x - u1) dot (u0 - u1:real^3) <= &0`); + (UP_ASM_TAC THEN REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2; + IN;IN_ELIM_THM] THEN STRIP_TAC); + (REWRITE_WITH `(x - u1) dot (u0 - u1:real^3) = + --((x - u0 - v) dot (u1 - u0)) + (v + u0 - u1) dot (u0 - u1)`); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[ASSUME `(x - u0 - v) dot (u1 - u0:real^3) = &0`; + REAL_NEG_0; REAL_ADD_LID]); + + + (MP_TAC (ASSUME `u1 = u % (v + u0) + v' % u0:real^3`) THEN + REWRITE_WITH `u1 = u % (v + u0) + v' % u0 + <=> u1 = u % v + (u + v') % u0:real^3`); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[ASSUME `u + v' = &1`; VECTOR_ARITH `&1 % a = a`]); + (REWRITE_TAC[VECTOR_ARITH `u1 = u % v + u0 <=> &1 % (u1 - u0:real^3) = u % v`]); + (REWRITE_WITH `&1 % (u1 - u0) = u % v <=> &1 / u % (u1 - u0:real^3) = v`); + + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Trigonometry2.VEC_DIV_MOV); + (STRIP_TAC); + (MP_TAC (ASSUME `u1 = u % (v + u0) + v' % u0:real^3`)); + (REWRITE_WITH `u = &0 /\ v' = &1`); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO; VECTOR_ADD_LID]); + (ASM_MESON_TAC[]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN STRIP_TAC); + (REWRITE_WITH `v + u0 - u1 = (&1 / u - &1) % (u1 - u0:real^3)`); + + (REWRITE_TAC[ASSUME `v = &1 / u % (u1 - u0:real^3)`]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_LMUL]); + + (REWRITE_WITH `(u1 - u0) dot (u0 - u1) = --((u0 - u1:real^3) dot (u0 - u1))`); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_SQUARE_NORM]); + + (REWRITE_TAC[REAL_ARITH `a * -- b <= &0 <=> &0 <= a * b`]); + + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_LE_POW_2]); + + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + + (REWRITE_WITH `&1 <= &1 / u <=> &1 * u <= &1`); + (MATCH_MP_TAC REAL_LE_RDIV_EQ); + (ASM_CASES_TAC `u = &0`); + (NEW_GOAL `F`); + (MP_TAC (ASSUME `u1 = u % (v + u0) + v' % u0:real^3`)); + (REWRITE_WITH `u = &0 /\ v' = &1`); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO; VECTOR_ADD_LID]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_MUL_LID]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `&0 < dist (x,u1) * dist (u0,u1:real^3) * a`); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_SET_TAC[]); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); +(* Finish proving that (v + u0) is between u0 and u1 *) +(* ================================================= *) + + (NEW_GOAL `norm (x - u0) pow 2 = norm ((u0 + v) - u0) pow 2 + norm (x - (u0 + v):real^3) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (REWRITE_TAC[VECTOR_ARITH `a:real^3 - (a + b) = --b`]); + (REWRITE_TAC[VECTOR_ARITH `--v dot (x - (u0 + v)) = -- ((x - u0 - v) dot v)`]); + (REWRITE_WITH `(x - u0 - v) dot v = (x - u0 - v) dot proj_point (u1 - u0) (x - u0:real^3)`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[PRO_EXP]); + (REWRITE_TAC[DOT_RMUL]); + (ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + + (NEW_GOAL `norm (x - u1) pow 2 = norm ((u0 + v) - u1) pow 2 + norm (x - (u0 + v):real^3) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (REWRITE_TAC[VECTOR_ARITH `(u1 - (u0 + v)) dot (x - (u0 + v)) = ((x - u0 - v) dot (u1 - (u0 + v)))`]); + (REWRITE_WITH `(x - u0 - v) dot (u1 - (u0 + v)) = + (x - u0 - v) dot (u1 - u0 - proj_point (u1 - u0) (x - u0:real^3))`); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[PRO_EXP]); + (ABBREV_TAC `t = ((x - u0) dot (u1 - u0)) / ((u1 - u0) dot (u1 - u0:real^3))`); + (REWRITE_TAC[VECTOR_ARITH `a - b - t% (a - b) = (&1 - t) % (a - b)`]); + (REWRITE_TAC[DOT_RMUL]); + (ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + +(* important lemma *) + (NEW_GOAL `sqrt (&2) <= dist (u0 + v,u0:real^3)`); + (UNDISCH_TAC `x:real^3 IN rcone_ge u0 u1 a`); + (REWRITE_TAC[rcone_ge; rconesgn; IN; IN_ELIM_THM]); + (REWRITE_WITH `(x - u0) dot (u1 - u0) = (x - u0 - v:real^3) dot (u1 - u0) + ((v+u0) - u0) dot (u1 - u0)`); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_ADD_LID]); + (EXPAND_TAC "a"); + (REWRITE_TAC[ASSUME `hl [u0;u1:real^3] = inv (&2) * dist (u1,u0)`]); + + (REWRITE_WITH `((v + u0) - u0) dot (u1 - u0) = dist (u0 + v, u0) * dist (u1,u0:real^3)`); + (REWRITE_WITH `v + u0 = u0 + v:real^3`); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[dist; NORM_CAUCHY_SCHWARZ_EQ]); + (UNDISCH_TAC `between (v + u0) (u0,u1:real^3)` THEN + REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2; IN; + IN_ELIM_THM] THEN STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_WITH `v + u0 = u0 + v:real^3`); + (VECTOR_ARITH_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `(u % u0 + v' % u1) - u0:real^3 = (u % u0 + v' % u1) - (u + v') % u0`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (REWRITE_WITH `(u % u0 + v' % u1) - (u + v') % u0 = v' % (u1 - u0:real^3)`); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; VECTOR_MUL_ASSOC]); + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_WITH `abs v' = v'`); + (ASM_REWRITE_TAC[REAL_ABS_REFL]); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `a * b >= c * b * d <=> &0 <= (a - c* d) * b`]); + (REWRITE_WITH `&0 <= (dist (u0 + v,u0) - dist (x,u0) * (inv (&2) * dist (u1,u0)) / sqrt (&2)) * dist (u1,u0) <=> &0 <= dist (u0 + v,u0:real^3) - dist (x,u0) * (inv (&2) * dist (u1,u0:real^3)) / sqrt (&2)`); + (MP_TAC REAL_LE_MUL_EQ); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_MESON_TAC[]); + (STRIP_TAC); + + (NEW_GOAL `&0 <= dist (x,u0:real^3) * (inv (&2) * dist (u1,u0)) / sqrt (&2) - dist (u1,u0) / sqrt (&2)`); + (REWRITE_TAC[REAL_ARITH `a * (b * c)/d - c/d = (a * b - &1) * (c/d)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[REAL_LE_DIV; DIST_POS_LE; SQRT_POS_LE; REAL_ARITH `&0 <= &2`]); + (NEW_GOAL `&2 <= dist (x,u0:real^3)`); + (UNDISCH_TAC `packing (V:real^3->bool)` ); + (REWRITE_TAC[packing]); + (STRIP_TAC THEN FIRST_ASSUM MATCH_MP_TAC); + (REPEAT STRIP_TAC); + (ONCE_REWRITE_TAC[GSYM IN]); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[GSYM IN]); + (MATCH_MP_TAC (SET_RULE `(?b. a IN b /\ b SUBSET c) ==> a IN c`)); + (EXISTS_TAC `set_of_list (ul:(real^3)list)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (NEW_GOAL `&0 <= dist (x,u0:real^3) * inv (&2) - &2 * inv (&2)`); + (REWRITE_TAC[REAL_ARITH `a * x - b * x = (a - b) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_SIMP_TAC[REAL_LE_INV; REAL_ARITH `&0 <= &2`]); + (NEW_GOAL `&2 * inv (&2) = &1`); + (ASM_SIMP_TAC [REAL_ARITH `~(&2 = &0)`; REAL_MUL_RINV]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `dist (u1,u0) / sqrt (&2) <= dist (u0 + v,u0:real^3)`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `sqrt (&2) <= dist (u1,u0:real^3) / sqrt (&2)`); + (REWRITE_WITH `sqrt (&2) <= dist (u1,u0:real^3) / sqrt (&2) + <=> sqrt (&2) * sqrt (&2) <= dist (u1,u0:real^3)`); + (MATCH_MP_TAC REAL_LE_RDIV_EQ); + (ASM_SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]); + (SIMP_TAC[GSYM REAL_POW_2; SQRT_POW_2; REAL_ARITH `&0 <= &2`]); + (UNDISCH_TAC `packing (V:real^3->bool)` ); + (REWRITE_TAC[packing]); + (STRIP_TAC THEN FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `{u0,u1:real^3} SUBSET V`); + (MATCH_MP_TAC (SET_RULE `(?b. a SUBSET b /\ b SUBSET c) ==> a SUBSET c`)); + (EXISTS_TAC `set_of_list (ul:(real^3)list)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC); + +(* continue the next important lemma, similarly as above *) + + (NEW_GOAL `sqrt (&2) <= dist (u0 + v,u1:real^3)`); + (UNDISCH_TAC `x:real^3 IN rcone_ge u1 u0 a`); + (REWRITE_TAC[rcone_ge; rconesgn; IN; IN_ELIM_THM]); + (REWRITE_WITH `(x - u1) dot (u0 - u1) = --((x - u0 - v:real^3) dot (u1 - u0)) + ((v+u0) - u1) dot (u0 - u1)`); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_ADD_LID;REAL_NEG_0]); + (EXPAND_TAC "a"); + (REWRITE_TAC[ASSUME `hl [u0;u1:real^3] = inv (&2) * dist (u1,u0)`]); + + (REWRITE_WITH `((v + u0) - u1) dot (u0 - u1) = dist (u0 + v, u1) * dist (u1,u0:real^3)`); + (REWRITE_WITH `v + u0 = u0 + v:real^3 /\ dist (u1,u0) = dist (u0,u1)`); + (REWRITE_TAC[DIST_SYM]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[dist; NORM_CAUCHY_SCHWARZ_EQ]); + (UNDISCH_TAC `between (v + u0) (u0,u1:real^3)` THEN + REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2; IN; + IN_ELIM_THM] THEN STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_WITH `v + u0 = u0 + v:real^3`); + (VECTOR_ARITH_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `(u % u0 + v' % u1) - u1:real^3 = (u % u0 + v' % u1) - (u + v') % u1`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (REWRITE_WITH `(u % u0 + v' % u1) - (u + v') % u1 = u % (u0 - u1:real^3)`); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; VECTOR_MUL_ASSOC]); + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_WITH `abs u = u`); + (ASM_REWRITE_TAC[REAL_ABS_REFL]); + (REAL_ARITH_TAC); + (REWRITE_WITH `dist (u0,u1:real^3) = dist (u1,u0)`); + (REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[REAL_ARITH `a * b >= c * b * d <=> &0 <= (a - c* d) * b`]); + (REWRITE_WITH `&0 <= (dist (u0 + v,u1) - dist (x,u1) * (inv (&2) * dist (u1,u0)) / sqrt (&2)) * dist (u1,u0) <=> &0 <= dist (u0 + v,u1:real^3) - dist (x,u1) * (inv (&2) * dist (u1,u0:real^3)) / sqrt (&2)`); + (MP_TAC REAL_LE_MUL_EQ); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_MESON_TAC[]); + (STRIP_TAC); + + (NEW_GOAL `&0 <= dist (x,u1:real^3) * (inv (&2) * dist (u1,u0)) / sqrt (&2) - dist (u1,u0) / sqrt (&2)`); + (REWRITE_TAC[REAL_ARITH `a * (b * c)/d - c/d = (a * b - &1) * (c/d)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[REAL_LE_DIV; DIST_POS_LE; SQRT_POS_LE; REAL_ARITH `&0 <= &2`]); + (NEW_GOAL `&2 <= dist (x,u1:real^3)`); + (UNDISCH_TAC `packing (V:real^3->bool)` ); + (REWRITE_TAC[packing]); + (STRIP_TAC THEN FIRST_ASSUM MATCH_MP_TAC); + (REPEAT STRIP_TAC); + (ONCE_REWRITE_TAC[GSYM IN]); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[GSYM IN]); + (MATCH_MP_TAC (SET_RULE `(?b. a IN b /\ b SUBSET c) ==> a IN c`)); + (EXISTS_TAC `set_of_list (ul:(real^3)list)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (NEW_GOAL `&0 <= dist (x,u1:real^3) * inv (&2) - &2 * inv (&2)`); + (REWRITE_TAC[REAL_ARITH `a * x - b * x = (a - b) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_SIMP_TAC[REAL_LE_INV; REAL_ARITH `&0 <= &2`]); + (NEW_GOAL `&2 * inv (&2) = &1`); + (ASM_SIMP_TAC [REAL_ARITH `~(&2 = &0)`; REAL_MUL_RINV]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `dist (u1,u0) / sqrt (&2) <= dist (u0 + v,u1:real^3)`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `sqrt (&2) <= dist (u1,u0:real^3) / sqrt (&2)`); + (REWRITE_WITH `sqrt (&2) <= dist (u1,u0:real^3) / sqrt (&2) + <=> sqrt (&2) * sqrt (&2) <= dist (u1,u0:real^3)`); + (MATCH_MP_TAC REAL_LE_RDIV_EQ); + (ASM_SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]); + (SIMP_TAC[GSYM REAL_POW_2; SQRT_POW_2; REAL_ARITH `&0 <= &2`]); + (UNDISCH_TAC `packing (V:real^3->bool)` ); + (REWRITE_TAC[packing]); + (STRIP_TAC THEN FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `{u0,u1:real^3} SUBSET V`); + (MATCH_MP_TAC (SET_RULE `(?b. a SUBSET b /\ b SUBSET c) ==> a SUBSET c`)); + (EXISTS_TAC `set_of_list (ul:(real^3)list)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC); + (UNDISCH_TAC `between (v + u0) (u0,u1:real^3)`); + (REWRITE_WITH `v + u0 = u0 + v:real^3`); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[between] THEN STRIP_TAC); + (NEW_GOAL `dist (u0,u1:real^3) = dist (u0 + v,u0) + dist (u0 + v,u1)`); + (ASM_MESON_TAC[DIST_SYM]); + (NEW_GOAL `&2 * sqrt (&2) <= dist (u0,u1:real^3)`); + (NEW_GOAL `&2 * sqrt (&2) <= dist (u0 + v,u0) + dist (u0 + v,u1:real^3)`); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_WITH `dist (u0,u1) = &2 * hl [u0; u1:real^3]`); + (REWRITE_TAC[ASSUME `hl [u0; u1] = inv (&2) * dist (u1,u0:real^3)`]); + (REWRITE_TAC[REAL_ARITH `a * b * c = (a * b) * c`]); + (REWRITE_WITH `&2 * inv (&2) = &1`); + (ASM_SIMP_TAC[REAL_MUL_RINV; REAL_ARITH `~(&2 = &0)`]); + (REWRITE_TAC[DIST_SYM;REAL_MUL_LID]); + (REWRITE_TAC[REAL_ARITH `~(a * b <= a * c) <=> &0 < a * (b - c)`]); + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); +(* Finish the most difficult part in case k = 2 *) + + (REWRITE_TAC[IN_INTER]); + (STRIP_TAC); + (NEW_GOAL `{u0,u1:real^3} SUBSET V`); + (MATCH_MP_TAC (SET_RULE `(?b. a SUBSET b /\ b SUBSET c) ==> a SUBSET c`)); + (EXISTS_TAC `set_of_list (ul:(real^3)list)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[rcone_ge; rconesgn; IN; IN_ELIM_THM]); + (ASM_CASES_TAC `x = u0:real^3`); + (ASM_REWRITE_TAC[VECTOR_ARITH `(a - a) dot b = &0`; DIST_REFL; REAL_MUL_LZERO; REAL_ARITH `&0 >= &0`]); + (ASM_CASES_TAC `x = u1:real^3`); + (ASM_REWRITE_TAC[GSYM NORM_POW_2; GSYM dist; REAL_POW_2; +REAL_ARITH `a * a >= a * a * c <=> &0 <= a * a * (&1 - c)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `F`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_TAC[rcone_ge; rconesgn; IN; IN_ELIM_THM]); + (ASM_CASES_TAC `x = u1:real^3`); + (ASM_REWRITE_TAC[VECTOR_ARITH `(a - a) dot b = &0`; DIST_REFL; REAL_MUL_LZERO; REAL_ARITH `&0 >= &0`]); + (ASM_CASES_TAC `x = u0:real^3`); + (ASM_REWRITE_TAC[GSYM NORM_POW_2; GSYM dist; REAL_POW_2; +REAL_ARITH `a * a >= a * a * c <=> &0 <= a * a * (&1 - c)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `F`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + + (ABBREV_TAC `m = mxi V [u0;u1;u2;u3:real^3]`); + (ABBREV_TAC `s = omega_list_n V [u0;u1;u2;u3:real^3] 3`); + (REWRITE_TAC[aff_ge_def; IN_AFFSIGN; sgn_ge]); + + (ABBREV_TAC `f = (\t:real^3. if t = x then &1 else &0)`); + (EXISTS_TAC `f:real^3->real`); + (REPEAT STRIP_TAC); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (REAL_ARITH_TAC); + (REAL_ARITH_TAC); + (REWRITE_WITH `{u0, u1} UNION {m, s} = {m,s} UNION {u0,u1:real^3}`); + (SET_TAC[]); + (REWRITE_WITH `sum ({m, s} UNION {u0, u1}) f = sum ({u0, u1:real^3}) f`); + (MATCH_MP_TAC SUM_UNION_LZERO); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REPEAT STRIP_TAC THEN EXPAND_TAC "f"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (MESON_TAC[]); + (ASM_SIMP_TAC[Collect_geom.SUM_DIS2]); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REAL_ARITH_TAC); + (COND_CASES_TAC); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `{u0, u1} UNION {m, s} = {m,s} UNION {u0,u1:real^3}`); + (SET_TAC[]); + (REWRITE_WITH `vsum ({m:real^3, s} UNION {u0, u1}) (\x. f x % x) + = vsum ({u0,u1}) (\x. f x % x)`); + (MATCH_MP_TAC VSUM_UNION_LZERO); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REPEAT STRIP_TAC THEN EXPAND_TAC "f"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (VECTOR_ARITH_TAC); + (ASM_SIMP_TAC[Collect_geom.VSUM_DIS2]); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (NEW_GOAL `F`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~(mcell k V ul = {})`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT;mcell2]); + (LET_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[]); + (ASM_MESON_TAC[]); + +(* ========================================================================= *) +(* -------------------- k = 4 --------------------------------------------*) + + (ASM_CASES_TAC `k = 4`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3; ARITH_RULE `4 - 1 = 3`; + set_of_list]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (REWRITE_TAC[SET_EQ_LEMMA; IN_INTER]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (REWRITE_TAC[set_of_list]); + (REPEAT STRIP_TAC); + + (ABBREV_TAC `S = {u0, u1,u2, u3:real^3}`); + (ABBREV_TAC `s3 = omega_list V (ul:(real^3)list)`); + + (ASM_CASES_TAC `(x:real^3) IN S`); + (ASM_MESON_TAC[]); + (NEW_GOAL `!x:real^3. x IN convex hull S /\ ~(x IN S) + ==> (?y. y IN S /\ norm (x - s3) < norm (y - s3))`); + (MATCH_MP_TAC SIMPLEX_FURTHEST_LT_2); + (EXPAND_TAC "S"); + (REWRITE_TAC[Geomdetail.FINITE6]); + (NEW_GOAL `?y:real^3. y IN S /\ norm (x - s3) < norm (y - s3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[IN]); + (UP_ASM_TAC THEN EXPAND_TAC "S" THEN STRIP_TAC); + (NEW_GOAL `s3 IN (voronoi_closed V (y:real^3))`); + (EXPAND_TAC "s3"); + (MATCH_MP_TAC (SET_RULE `(?b. a IN b /\ b SUBSET c) ==> a IN c`)); + (EXISTS_TAC `voronoi_list V (ul:(real^3)list)`); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list]); + (NEW_GOAL `y:real^3 IN S`); + (ASM_MESON_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[dist]); + (STRIP_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `norm (y - s3) <= norm (x - s3:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (UNDISCH_TAC `x:real^3 IN V` THEN MESON_TAC[IN]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + (MATCH_MP_TAC (SET_RULE `(?b. a IN b /\ b SUBSET c ) ==> a IN c`)); + (EXISTS_TAC `set_of_list (ul:(real^3)list)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_SET_IMP_IN_CONVEX_HULL_SET]); + (NEW_GOAL `F`); + (UNDISCH_TAC `~(mcell k V ul = {})`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REFL_TAC); + (ASM_MESON_TAC[]); + +(* ========================================================================= *) +(* -------------------- k = 3 --------------------------------------------*) + + + (ASM_CASES_TAC `k = 3`); + (NEW_GOAL `{u0,u1,u2,u3:real^3} SUBSET V`); + (REWRITE_WITH `{u0,u1,u2,u3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2; + MCELL_EXPLICIT; mcell3; set_of_list]); + (ABBREV_TAC `m = mxi V [u0; u1; u2; u3:real^3]`); + (REWRITE_TAC[SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (COND_CASES_TAC); + + (REWRITE_TAC[set_of_list; SET_EQ_LEMMA; IN_INTER]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `x IN {u0,u1,u2:real^3}`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ABBREV_TAC `S = {u0, u1,u2, m:real^3}`); + (ABBREV_TAC `s2 = omega_list_n V (ul:(real^3)list) 2`); + (ABBREV_TAC `s3 = omega_list V (ul:(real^3)list)`); + + (NEW_GOAL `s2 IN voronoi_list V [u0;u1;u2:real^3]`); + (EXPAND_TAC "s2"); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_2; ASSUME `ul = [u0; u1; u2; u3:real^3]`]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `2`); + (REWRITE_WITH `[u0;u1;u2:real^3] = truncate_simplex 2 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `s3:real^3 IN voronoi_list V ul`); + (EXPAND_TAC "s3"); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + + (NEW_GOAL `s3:real^3 IN voronoi_list V [u0;u1;u2:real^3]`); + (NEW_GOAL `voronoi_list V ul SUBSET voronoi_list V [u0;u1;u2:real^3]`); + (ASM_REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list]); + (SET_TAC[]); + (ASM_SET_TAC[]); + + (NEW_GOAL `?s. between s (omega_list_n V ul 2,omega_list_n V ul 3) /\ + dist (u0,s) = sqrt (&2) /\ + mxi V ul = s`); + (MATCH_MP_TAC MXI_EXPLICIT); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC); + (NEW_GOAL `omega_list_n V [u0; u1; u2; u3] 3 = s3:real^3`); + (EXPAND_TAC "s3" THEN ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `ul = truncate_simplex 3 [u0; u1; u2; u3:real^3]`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_LEMMA); + (REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (MP_TAC (ASSUME `between s (s2,omega_list_n V [u0; u1; u2; u3:real^3] 3)`)); + (REWRITE_TAC[ASSUME `omega_list_n V [u0; u1; u2; u3] 3 = s3:real^3`]); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL]); + (STRIP_TAC); + (NEW_GOAL `convex hull {s2,s3:real^3} SUBSET voronoi_list V [u0; u1; u2]`); + (REWRITE_WITH `convex hull {s2, s3} SUBSET voronoi_list V [u0; u1; u2:real^3] <=> convex hull {s2, s3} SUBSET convex hull (voronoi_list V [u0; u1; u2])`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `convex hull (voronoi_list V [u0; u1; u2]) = voronoi_list V [u0; u1; u2:real^3]`); + (REWRITE_TAC[CONVEX_HULL_EQ; Packing3.CONVEX_VORONOI_LIST]); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (ASM_SET_TAC[]); + (NEW_GOAL `s IN voronoi_list V [u0;u1;u2:real^3]`); + (ASM_SET_TAC[]); + + (NEW_GOAL `~(m:real^3 IN V)`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[VORONOI_LIST;VORONOI_SET;set_of_list]); + (REPEAT STRIP_TAC); + (NEW_GOAL `s IN voronoi_closed V (u0:real^3)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (STRIP_TAC); + (NEW_GOAL `dist (s, u0:real^3) <= dist (s, s)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL] THEN ONCE_REWRITE_TAC[DIST_SYM] + THEN ASM_REWRITE_TAC[REAL_ARITH `~(a <= b) <=> b < a`]); + (ASM_SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]); + + (NEW_GOAL `!x:real^3. x IN convex hull S /\ ~(x IN S) + ==> (?y. y IN S /\ norm (x - m) < norm (y - m))`); + (MATCH_MP_TAC SIMPLEX_FURTHEST_LT_2); + (EXPAND_TAC "S"); + (REWRITE_TAC[Geomdetail.FINITE6]); + (NEW_GOAL `?y:real^3. y IN S /\ norm (x - m) < norm (y - m)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "S"); + (STRIP_TAC); + (NEW_GOAL `x = m:real^3`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "S" THEN STRIP_TAC); + + (NEW_GOAL `norm (u0 - m:real^3) = sqrt (&2)`); + (ASM_REWRITE_TAC[GSYM dist]); + (UNDISCH_TAC `s IN voronoi_list V [u0;u1;u2:real^3]`); + (ASM_REWRITE_TAC[VORONOI_LIST;VORONOI_SET;set_of_list]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `s IN voronoi_closed V (u0:real^3)`); + (ASM_SET_TAC[]); + (NEW_GOAL `s IN voronoi_closed V (u1:real^3)`); + (ASM_SET_TAC[]); + (NEW_GOAL `s IN voronoi_closed V (u2:real^3)`); + (ASM_SET_TAC[]); + (NEW_GOAL `norm (u0 - m:real^3) <= norm (u1 - m)`); + (REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `s IN voronoi_closed V (u0:real^3)` THEN + REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + + (NEW_GOAL `norm (u1 - m:real^3) <= norm (u2 - m)`); + (REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `s IN voronoi_closed V (u1:real^3)` THEN + REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + + (NEW_GOAL `norm (u2 - m:real^3) <= norm (u0 - m)`); + (REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `s IN voronoi_closed V (u2:real^3)` THEN + REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + + (NEW_GOAL `norm (m - m:real^3) = &0`); + (NORM_ARITH_TAC); + (NEW_GOAL `norm (y - m:real^3) <= sqrt (&2)`); + (UNDISCH_TAC `y IN {u0,u1,u2,m:real^3}` THEN + REWRITE_TAC[SET_RULE `(y IN {u0,u1,u2,m:real^3}) + <=> (y = u0 \/ y = u1 \/ y = u2 \/ y = m)`]); + (NEW_GOAL `&0 <= sqrt (&2)`); + (SIMP_TAC[REAL_ARITH `&0 <= &2`; SQRT_POS_LE]); + (NEW_GOAL `norm (u1 - m) = sqrt (&2) /\ norm (u2 - m:real^3) = sqrt (&2)`); + (ASM_REAL_ARITH_TAC); + (STRIP_TAC); + (REWRITE_TAC[ASSUME `y = u0:real^3`; ASSUME `norm (u0 - m:real^3) = sqrt (&2)`] THEN REAL_ARITH_TAC); + (REWRITE_TAC[ASSUME `y = u1:real^3`; ASSUME `norm (u1 - m) = sqrt (&2) /\ norm (u2 - m:real^3) = sqrt (&2)`] THEN REAL_ARITH_TAC); + (REWRITE_TAC[ASSUME `y = u2:real^3`; ASSUME `norm (u1 - m) = sqrt (&2) /\ norm (u2 - m:real^3) = sqrt (&2)`] THEN REAL_ARITH_TAC); + (REWRITE_TAC[ASSUME `y = m:real^3`; ASSUME `norm (m - m:real^3) = &0`; + ASSUME `&0 <= sqrt (&2)`] THEN REAL_ARITH_TAC); + (NEW_GOAL `norm (x - m:real^3) < norm (u0 -m)`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `m = s:real^3`; GSYM dist]); + (STRIP_TAC); + (UNDISCH_TAC `s:real^3 IN voronoi_closed V u0`); + (REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (STRIP_TAC); + (NEW_GOAL `dist (u0,s:real^3) <= dist (x,s)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_SET_TAC[]); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (ASM_SET_TAC[]); + (NEW_GOAL `F`); + (UNDISCH_TAC `~( mcell k V (ul:(real^3)list) = {})`); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2; + MCELL_EXPLICIT; mcell3; set_of_list]); + (ASM_MESON_TAC[]); + (NEW_GOAL `F`); + (NEW_GOAL `k = 1 \/ k = 2 \/ k = 3 \/ k = 4`); + (UNDISCH_TAC `1 <= k` THEN UNDISCH_TAC `k <= 4`); + (ARITH_TAC); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[])]);; + +(* ========================================================================== *) +(* Lemma for the case mcell 0 *) +(* ========================================================================= *) + +let LEPJBDJ_0 = prove_by_refinement +(LEPJBDJ_0_concl, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[MCELL_EXPLICIT; mcell0]); + (REWRITE_TAC[SET_RULE `a INTER b = {} <=> (!v. v IN a INTER b ==> F)`]); + (GEN_TAC THEN REWRITE_TAC[IN_INTER; IN_DIFF] THEN REPEAT STRIP_TAC ); + (NEW_GOAL `v:real^3 = HD ul`); + (MATCH_MP_TAC ROGERS_INTER_V_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UNDISCH_TAC `~(v:real^3 IN ball (HD ul, sqrt (&2)))`); + (ASM_REWRITE_TAC[ball; IN; IN_ELIM_THM; DIST_REFL]); + (ASM_SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`])]);; + +end;; diff --git a/text_formalization/packing/NJIUTIU.hl b/text_formalization/packing/NJIUTIU.hl new file mode 100755 index 0000000..3a4e4c8 --- /dev/null +++ b/text_formalization/packing/NJIUTIU.hl @@ -0,0 +1,581 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: NJIUTIU *) +(* Chaper : Packing (Marchal cells) *) +(* *) +(* ========================================================================= *) + + +(* ========================================================================= *) + +module Njiutiu = struct + +open Rogers;; +open Vukhacky_tactics;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Sphere;; +open Marchal_cells;; +open Emnwuus;; +open Marchal_cells_2_new;; +open Lepjbdj;; + + +let NJIUTIU_concl = + `!V ul vl. + saturated V /\ packing V /\ + barV V 3 ul /\ barV V 3 vl /\ + rogers V ul = rogers V vl /\ aff_dim (rogers V ul) = &3 + ==> (!i. 0 <= i /\ i <= 3 + ==> omega_list_n V ul i = omega_list_n V vl i)`;; + +(* ========================================================================= *) +(* supporting lemmas *) + +let CLOSEST_POINT_SUBSET_lemma = prove_by_refinement ( + `!(a:real^3) x S P. + (a = closest_point S x /\ a IN P /\ P SUBSET S /\ + convex P /\ closed P /\ closed S /\ ~(P = {})) + ==> (a = closest_point P x)`, +[(REPEAT STRIP_TAC); + (ABBREV_TAC `s = closest_point P (x:real^3)`); + (ASM_CASES_TAC `~(a:real^3 = s)`); + (NEW_GOAL `dist (x:real^3, s) < dist (x, a)`); + (EXPAND_TAC "s"); + (MATCH_MP_TAC CLOSEST_POINT_LT); + (ASM_MESON_TAC[]); + (NEW_GOAL `s:real^3 IN P`); + (EXPAND_TAC "s"); + (MATCH_MP_TAC CLOSEST_POINT_IN_SET); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `dist (x, a) <= dist (x, s:real^3)`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC CLOSEST_POINT_LE); + (ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]); + (NEW_GOAL `F`); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[])]);; + +(* ---------------------------------------------------------------------------*) +let AFF_DEPENDENT_AFF_DIM_4 = prove_by_refinement ( + `!a b c d:real^3. + affine_dependent {a,b,c,d} ==> aff_dim {a,b,c,d} <= &2`, +[(REWRITE_TAC[affine_dependent]); + (REPEAT STRIP_TAC); + + (ASM_CASES_TAC `x = a:real^3`); + (ONCE_REWRITE_TAC [AFF_DIM_INSERT]); + (COND_CASES_TAC); + (NEW_GOAL `aff_dim {b,c,d:real^3} <= &(CARD {b,c,d}) - &1`); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_TAC[Geomdetail.FINITE6]); + (NEW_GOAL `&(CARD {b, c, d:real^3}) <= &3:int`); + (REWRITE_TAC[INT_OF_NUM_LE; Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `affine hull({a, b, c, d:real^3} DELETE x) + SUBSET affine hull {b, c, d}`); + (MATCH_MP_TAC AFFINE_SUBSET_KY_LEMMA); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `x = b:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {b,a,c,d}`]); + (ONCE_REWRITE_TAC [AFF_DIM_INSERT]); + (COND_CASES_TAC); + (NEW_GOAL `aff_dim {a,c,d:real^3} <= &(CARD {a,c,d}) - &1`); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_TAC[Geomdetail.FINITE6]); + (NEW_GOAL `&(CARD {a, c, d:real^3}) <= &3:int`); + (REWRITE_TAC[INT_OF_NUM_LE; Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `affine hull({a, b, c, d:real^3} DELETE x) + SUBSET affine hull {a, c, d}`); + (MATCH_MP_TAC AFFINE_SUBSET_KY_LEMMA); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `x = c:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {c,a,b,d}`]); + (ONCE_REWRITE_TAC [AFF_DIM_INSERT]); + (COND_CASES_TAC); + (NEW_GOAL `aff_dim {a,b,d:real^3} <= &(CARD {a,b,d}) - &1`); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_TAC[Geomdetail.FINITE6]); + (NEW_GOAL `&(CARD {a, b, d:real^3}) <= &3:int`); + (REWRITE_TAC[INT_OF_NUM_LE; Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `affine hull({a, b, c, d:real^3} DELETE x) + SUBSET affine hull {a, b, d}`); + (MATCH_MP_TAC AFFINE_SUBSET_KY_LEMMA); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `x = d:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {d,a,b,c}`]); + (ONCE_REWRITE_TAC [AFF_DIM_INSERT]); + (COND_CASES_TAC); + (NEW_GOAL `aff_dim {a,b,c:real^3} <= &(CARD {a,b,c}) - &1`); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_TAC[Geomdetail.FINITE6]); + (NEW_GOAL `&(CARD {a, b,c:real^3}) <= &3:int`); + (REWRITE_TAC[INT_OF_NUM_LE; Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `affine hull({a, b, c, d:real^3} DELETE x) + SUBSET affine hull {a, b, c}`); + (MATCH_MP_TAC AFFINE_SUBSET_KY_LEMMA); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `F`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[])]);; + +(* ========================================================================== *) +(* Main theorem *) +(* ========================================================================== *) + +let NJIUTIU = prove_by_refinement (NJIUTIU_concl, + +[(REPEAT GEN_TAC THEN STRIP_TAC); + (NEW_GOAL + `rogers V ul = + convex hull + {HD ul, omega_list_n V ul 1, omega_list_n V ul 2, omega_list_n V ul 3}`); + (ASM_MESON_TAC[ROGERS_EXPLICIT]); + (NEW_GOAL + `rogers V vl = + convex hull + {HD vl, omega_list_n V vl 1, omega_list_n V vl 2, omega_list_n V vl 3}`); + (ASM_MESON_TAC[ROGERS_EXPLICIT]); + (NEW_GOAL + `{HD (ul:(real^3)list), omega_list_n V ul 1, omega_list_n V ul 2, + omega_list_n V ul 3} + = {HD vl, omega_list_n V vl 1, omega_list_n V vl 2, omega_list_n V vl 3}`); + (REWRITE_WITH + `{HD (ul:(real^3)list), omega_list_n V ul 1, omega_list_n V ul 2, + omega_list_n V ul 3} + = {HD vl, omega_list_n V vl 1, omega_list_n V vl 2, omega_list_n V vl 3} <=> + convex hull + {HD ul, omega_list_n V ul 1, omega_list_n V ul 2, omega_list_n V ul 3} + = convex hull + {HD vl, omega_list_n V vl 1, omega_list_n V vl 2, omega_list_n V vl 3}`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ); + (REPEAT STRIP_TAC); + (NEW_GOAL `aff_dim {HD (ul:(real^3)list), omega_list_n V ul 1, + omega_list_n V ul 2, omega_list_n V ul 3} <= &2`); + (MATCH_MP_TAC AFF_DEPENDENT_AFF_DIM_4); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN PURE_ONCE_REWRITE_TAC[GSYM AFF_DIM_CONVEX_HULL]); + (REWRITE_TAC[GSYM (ASSUME `rogers V ul = + convex hull + {HD ul, omega_list_n V ul 1, omega_list_n V ul 2, omega_list_n V ul 3}`)]); + (ASM_ARITH_TAC); + (NEW_GOAL `aff_dim {HD (vl:(real^3)list), omega_list_n V vl 1, + omega_list_n V vl 2, omega_list_n V vl 3} <= &2`); + (MATCH_MP_TAC AFF_DEPENDENT_AFF_DIM_4); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN PURE_ONCE_REWRITE_TAC[GSYM AFF_DIM_CONVEX_HULL]); + (REWRITE_TAC[GSYM (ASSUME `rogers V vl = + convex hull + {HD vl, omega_list_n V vl 1, omega_list_n V vl 2, omega_list_n V vl 3}`)]); + (REWRITE_TAC[GSYM (ASSUME `rogers V ul = rogers V vl`)]); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ABBREV_TAC `W = {HD (ul:(real^3)list), omega_list_n V ul 1, + omega_list_n V ul 2, omega_list_n V ul 3}`); + + (NEW_GOAL `!i j. + i < 4 /\ j < 4 /\ ~(i = j) + ==> ~(omega_list_n V ul i = omega_list_n V ul j)`); + (MATCH_MP_TAC Rogers.ROGERS_AFF_DIM_FULL); + (ASM_REWRITE_TAC[]); + (NEW_GOAL + `~(omega_list_n V ul 0 = omega_list_n V ul 1) /\ + ~(omega_list_n V ul 0 = omega_list_n V ul 2) /\ + ~(omega_list_n V ul 0 = omega_list_n V ul 3) /\ + ~(omega_list_n V ul 1 = omega_list_n V ul 2) /\ + ~(omega_list_n V ul 1 = omega_list_n V ul 3) /\ + ~(omega_list_n V ul 2 = omega_list_n V ul 3)`); + (ASM_SIMP_TAC[ARITH_RULE + `0 < 4 /\ 1 < 4 /\ 2 < 4 /\ 3 < 4 /\ ~(0 = 1) /\ ~(0 = 2) /\ ~(0 = 3) /\ + ~(1 = 2) /\ ~(2 = 3) /\ ~(1 = 3)`]); + + (NEW_GOAL `(omega_list_n V ul 1) IN voronoi_list V (truncate_simplex 1 ul)`); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_IN_VORONOI_LIST); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + (NEW_GOAL `(omega_list_n V ul 2) IN voronoi_list V (truncate_simplex 2 ul)`); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_IN_VORONOI_LIST); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (NEW_GOAL `(omega_list_n V ul 3) IN voronoi_list V (truncate_simplex 3 ul)`); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_IN_VORONOI_LIST); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `3 <= 3`]); + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `voronoi_list V (truncate_simplex 2 ul) SUBSET + voronoi_list V (truncate_simplex 1 ul) /\ + voronoi_list V (truncate_simplex 3 ul) SUBSET + voronoi_list V (truncate_simplex 1 ul) /\ + voronoi_list V (truncate_simplex 3 ul) SUBSET + voronoi_list V (truncate_simplex 2 ul)`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; TRUNCATE_SIMPLEX_EXPLICIT_2; TRUNCATE_SIMPLEX_EXPLICIT_3; VORONOI_LIST;VORONOI_SET; set_of_list]); + (SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `!i j. + i < 4 /\ j < 4 /\ ~(i = j) + ==> ~(omega_list_n V vl i = omega_list_n V vl j)`); + (MATCH_MP_TAC Rogers.ROGERS_AFF_DIM_FULL); + (ASM_MESON_TAC[]); + (NEW_GOAL + `~(omega_list_n V vl 0 = omega_list_n V vl 1) /\ + ~(omega_list_n V vl 0 = omega_list_n V vl 2) /\ + ~(omega_list_n V vl 0 = omega_list_n V vl 3) /\ + ~(omega_list_n V vl 1 = omega_list_n V vl 2) /\ + ~(omega_list_n V vl 1 = omega_list_n V vl 3) /\ + ~(omega_list_n V vl 2 = omega_list_n V vl 3)`); + (ASM_SIMP_TAC[ARITH_RULE + `0 < 4 /\ 1 < 4 /\ 2 < 4 /\ 3 < 4 /\ ~(0 = 1) /\ ~(0 = 2) /\ ~(0 = 3) /\ + ~(1 = 2) /\ ~(2 = 3) /\ ~(1 = 3)`]); + + (NEW_GOAL `(omega_list_n V vl 1) IN voronoi_list V (truncate_simplex 1 vl)`); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_IN_VORONOI_LIST); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + (NEW_GOAL `(omega_list_n V vl 2) IN voronoi_list V (truncate_simplex 2 vl)`); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_IN_VORONOI_LIST); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (NEW_GOAL `(omega_list_n V vl 3) IN voronoi_list V (truncate_simplex 3 vl)`); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_IN_VORONOI_LIST); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `3 <= 3`]); + (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `voronoi_list V (truncate_simplex 2 vl) SUBSET + voronoi_list V (truncate_simplex 1 vl) /\ + voronoi_list V (truncate_simplex 3 vl) SUBSET + voronoi_list V (truncate_simplex 1 vl) /\ + voronoi_list V (truncate_simplex 3 vl) SUBSET + voronoi_list V (truncate_simplex 2 vl)`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; TRUNCATE_SIMPLEX_EXPLICIT_2; TRUNCATE_SIMPLEX_EXPLICIT_3; VORONOI_LIST;VORONOI_SET; set_of_list]); + (SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `HD (ul:(real^3)list) = HD vl`); + (MATCH_MP_TAC ROGERS_INTER_V_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list ul SUBSET (V:real^3->bool)`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list; HD] THEN SET_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `rogers V ul = rogers V vl`)]); + (ONCE_REWRITE_TAC[MESON[IN] `rogers V ul s <=> s IN rogers V ul`]); + (REWRITE_WITH `rogers V ul = + convex hull + {HD ul, omega_list_n V ul 1, omega_list_n V ul 2, omega_list_n V + ul + 3}`); + (ASM_SIMP_TAC[ROGERS_EXPLICIT]); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (SET_TAC[]); + (NEW_GOAL `omega_list_n V ul 0 = omega_list_n V vl 0`); + (REWRITE_TAC[OMEGA_LIST_N]); + (ASM_MESON_TAC[]); + +(* Case 1: i = 1 *) + (NEW_GOAL `omega_list_n V ul 1 = omega_list_n V vl 1`); + (REWRITE_WITH `omega_list_n V ul 1 = + closest_point (convex hull (W DIFF {HD ul})) (omega_list_n V ul 0)`); + (MATCH_MP_TAC CLOSEST_POINT_SUBSET_lemma); + (EXISTS_TAC `voronoi_list V (truncate_simplex (SUC 0) ul)`); + (REPEAT STRIP_TAC); (* 7 subgoals *) + + (REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `1 = SUC 0`]); (* finish subgoal 1 *) + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (EXPAND_TAC "W"); + (REWRITE_WITH `HD ul = omega_list_n V ul 0`); + (REWRITE_TAC[OMEGA_LIST_N]); + (ASM_SET_TAC[]); (* finish subgoal 2 *) + + (NEW_GOAL `voronoi_list V (truncate_simplex (SUC 0) ul) = + convex hull (voronoi_list V (truncate_simplex (SUC 0) ul))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[CONVEX_HULL_EQ;Packing3.CONVEX_VORONOI_LIST]); + (ONCE_REWRITE_TAC[ASSUME + `voronoi_list V (truncate_simplex (SUC 0) ul) = + convex hull (voronoi_list V (truncate_simplex (SUC 0) ul))`]); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (REWRITE_WITH `W:real^3->bool DIFF {HD ul} = + {omega_list_n V ul 1, omega_list_n V ul 2, omega_list_n V ul 3}`); + (EXPAND_TAC "W" THEN REWRITE_WITH `HD ul = omega_list_n V ul 0`); + (REWRITE_TAC[OMEGA_LIST_N]); + (ASM_SET_TAC[]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + (ASM_SET_TAC[]); (* finish subgoal 3 *) + (REWRITE_TAC[CONVEX_CONVEX_HULL]); (* finish subgoal 4 *) + (MATCH_MP_TAC CLOSED_CONVEX_HULL_FINITE); + (MATCH_MP_TAC FINITE_DIFF); + (EXPAND_TAC "W" THEN REWRITE_TAC[Geomdetail.FINITE6]); (* finish subgoal 5 *) + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); (* finish subgoal 6 *) + (UP_ASM_TAC THEN REWRITE_TAC[CONVEX_HULL_EQ_EMPTY]); + (EXPAND_TAC "W" THEN REWRITE_WITH `HD ul = omega_list_n V ul 0`); + (REWRITE_TAC[OMEGA_LIST_N]); + (ASM_SET_TAC[]); (* finish subgoal 7 *) + + (REWRITE_WITH `omega_list_n V vl 1 = + closest_point (convex hull (W DIFF {HD vl})) (omega_list_n V vl 0)`); + (MATCH_MP_TAC CLOSEST_POINT_SUBSET_lemma); + (EXISTS_TAC `voronoi_list V (truncate_simplex (SUC 0) vl)`); + (REPEAT STRIP_TAC); (* 7 subgoals *) + + (REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `1 = SUC 0`]); (* finish subgoal 1 *) + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (EXPAND_TAC "W"); + (REWRITE_WITH `HD vl = omega_list_n V vl 0`); + (REWRITE_TAC[OMEGA_LIST_N]); + (ASM_SET_TAC[]); (* finish subgoal 2 *) + + (NEW_GOAL `voronoi_list V (truncate_simplex (SUC 0) vl) = + convex hull (voronoi_list V (truncate_simplex (SUC 0) vl))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[CONVEX_HULL_EQ;Packing3.CONVEX_VORONOI_LIST]); + (ONCE_REWRITE_TAC[ASSUME + `voronoi_list V (truncate_simplex (SUC 0) vl) = + convex hull (voronoi_list V (truncate_simplex (SUC 0) vl))`]); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (REWRITE_WITH `W:real^3->bool DIFF {HD vl} = + {omega_list_n V vl 1, omega_list_n V vl 2, omega_list_n V vl 3}`); + (REWRITE_TAC[ASSUME `W:real^3->bool = + {HD vl, omega_list_n V vl 1, omega_list_n V vl 2, omega_list_n V vl 3}`]); + (REWRITE_WITH `HD vl = omega_list_n V vl 0`); + (REWRITE_TAC[OMEGA_LIST_N]); + (ASM_SET_TAC[]); + + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + (ASM_SET_TAC[]); (* finish subgoal 3 *) + (REWRITE_TAC[CONVEX_CONVEX_HULL]); (* finish subgoal 4 *) + (MATCH_MP_TAC CLOSED_CONVEX_HULL_FINITE); + (MATCH_MP_TAC FINITE_DIFF); + (EXPAND_TAC "W" THEN REWRITE_TAC[Geomdetail.FINITE6]); (* finish subgoal 5 *) + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); (* finish subgoal 6 *) + (UP_ASM_TAC THEN REWRITE_TAC[CONVEX_HULL_EQ_EMPTY]); + (REWRITE_TAC[ASSUME `W:real^3->bool = + {HD vl, omega_list_n V vl 1, omega_list_n V vl 2, omega_list_n V vl 3}`]); + (REWRITE_WITH `HD vl = omega_list_n V vl 0`); + (REWRITE_TAC[OMEGA_LIST_N]); + (ASM_SET_TAC[]); (* finish subgoal 7 *) + (ASM_MESON_TAC[]); + (* ------------------------------------------------------------------------- *) +(* Case 2: i = 2 *) + (NEW_GOAL `omega_list_n V ul 2 = omega_list_n V vl 2`); + (REWRITE_WITH `omega_list_n V ul 2 = + closest_point (convex hull (W DIFF {HD ul, omega_list_n V ul 1})) (omega_list_n V ul 1)`); + (MATCH_MP_TAC CLOSEST_POINT_SUBSET_lemma); + (EXISTS_TAC `voronoi_list V (truncate_simplex (SUC 1) ul)`); + (REPEAT STRIP_TAC); (* 7 subgoals *) + + (REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `2 = SUC 1`]); (* finish subgoal 1 *) + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (EXPAND_TAC "W"); + (REWRITE_WITH `HD ul = omega_list_n V ul 0`); + (REWRITE_TAC[OMEGA_LIST_N]); + (ASM_SET_TAC[]); (* finish subgoal 2 *) + + (NEW_GOAL `voronoi_list V (truncate_simplex (SUC 1) ul) = + convex hull (voronoi_list V (truncate_simplex (SUC 1) ul))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[CONVEX_HULL_EQ;Packing3.CONVEX_VORONOI_LIST]); + (ONCE_REWRITE_TAC[ASSUME + `voronoi_list V (truncate_simplex (SUC 1) ul) = + convex hull (voronoi_list V (truncate_simplex (SUC 1) ul))`]); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (REWRITE_WITH `W:real^3->bool DIFF {HD ul, omega_list_n V ul 1} = + {omega_list_n V ul 2, omega_list_n V ul 3}`); + (EXPAND_TAC "W" THEN REWRITE_WITH `HD ul = omega_list_n V ul 0`); + (REWRITE_TAC[OMEGA_LIST_N]); + (ASM_SET_TAC[]); + (REWRITE_TAC[ARITH_RULE `SUC 1 = 2`]); + (ASM_SET_TAC[]); (* finish subgoal 3 *) + (REWRITE_TAC[CONVEX_CONVEX_HULL]); (* finish subgoal 4 *) + (MATCH_MP_TAC CLOSED_CONVEX_HULL_FINITE); + (MATCH_MP_TAC FINITE_DIFF); + (EXPAND_TAC "W" THEN REWRITE_TAC[Geomdetail.FINITE6]); (* finish subgoal 5 *) + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); (* finish subgoal 6 *) + (UP_ASM_TAC THEN REWRITE_TAC[CONVEX_HULL_EQ_EMPTY]); + (EXPAND_TAC "W" THEN REWRITE_WITH `HD ul = omega_list_n V ul 0`); + (REWRITE_TAC[OMEGA_LIST_N]); + (ASM_SET_TAC[]); (* finish subgoal 7 *) + + (REWRITE_WITH + `omega_list_n V vl 2 = + closest_point (convex hull (W DIFF {HD vl, omega_list_n V vl 1})) + (omega_list_n V vl 1)`); + (MATCH_MP_TAC CLOSEST_POINT_SUBSET_lemma); + (EXISTS_TAC `voronoi_list V (truncate_simplex (SUC 1) vl)`); + (REPEAT STRIP_TAC); (* 7 subgoals *) + + (REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `2 = SUC 1`]); (* finish subgoal 1 *) + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (REWRITE_TAC[ASSUME `W:real^3->bool = + {HD vl, omega_list_n V vl 1, omega_list_n V vl 2, omega_list_n V vl 3}`]); + (REWRITE_WITH `HD vl = omega_list_n V vl 0`); + (REWRITE_TAC[OMEGA_LIST_N]); + (ASM_SET_TAC[]); (* finish subgoal 2 *) + + (NEW_GOAL `voronoi_list V (truncate_simplex (SUC 1) vl) = + convex hull (voronoi_list V (truncate_simplex (SUC 1) vl))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[CONVEX_HULL_EQ;Packing3.CONVEX_VORONOI_LIST]); + (ONCE_REWRITE_TAC[ASSUME + `voronoi_list V (truncate_simplex (SUC 1) vl) = + convex hull (voronoi_list V (truncate_simplex (SUC 1) vl))`]); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (REWRITE_WITH `W:real^3->bool DIFF {HD vl, omega_list_n V vl 1} = + {omega_list_n V vl 2, omega_list_n V vl 3}`); + (REWRITE_TAC[ASSUME `W:real^3->bool = + {HD vl, omega_list_n V vl 1, omega_list_n V vl 2, omega_list_n V vl 3}`]); + (REWRITE_WITH `HD vl = omega_list_n V vl 0`); + (REWRITE_TAC[OMEGA_LIST_N]); + (ASM_SET_TAC[]); + + (REWRITE_TAC[ARITH_RULE `SUC 1 = 2`]); + (ASM_SET_TAC[]); (* finish subgoal 3 *) + (REWRITE_TAC[CONVEX_CONVEX_HULL]); (* finish subgoal 4 *) + (MATCH_MP_TAC CLOSED_CONVEX_HULL_FINITE); + (MATCH_MP_TAC FINITE_DIFF); + (EXPAND_TAC "W" THEN REWRITE_TAC[Geomdetail.FINITE6]); (* finish subgoal 5 *) + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); (* finish subgoal 6 *) + (UP_ASM_TAC THEN REWRITE_TAC[CONVEX_HULL_EQ_EMPTY]); + (REWRITE_TAC[ASSUME `W:real^3->bool = + {HD vl, omega_list_n V vl 1, omega_list_n V vl 2, omega_list_n V vl 3}`]); + (REWRITE_WITH `HD vl = omega_list_n V vl 0`); + (REWRITE_TAC[OMEGA_LIST_N]); + (ASM_SET_TAC[]); (* finish subgoal 7 *) + (ASM_MESON_TAC[]); + +(* ------------------------------------------------------------------------- *) +(* Case 3: i = 3 *) + (NEW_GOAL `omega_list_n V ul 3 = omega_list_n V vl 3`); + (REWRITE_WITH + `omega_list_n V ul 3 = closest_point + (convex hull (W DIFF {HD ul, omega_list_n V ul 1, omega_list_n V ul 2})) + (omega_list_n V ul 2)`); + (MATCH_MP_TAC CLOSEST_POINT_SUBSET_lemma); + (EXISTS_TAC `voronoi_list V (truncate_simplex (SUC 2) ul)`); + (REPEAT STRIP_TAC); (* 7 subgoals *) + + (REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `3 = SUC 2`]); (* finish subgoal 1 *) + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (EXPAND_TAC "W"); + (REWRITE_WITH `HD ul = omega_list_n V ul 0`); + (REWRITE_TAC[OMEGA_LIST_N]); + (ASM_SET_TAC[]); (* finish subgoal 2 *) + + (NEW_GOAL `voronoi_list V (truncate_simplex (SUC 2) ul) = + convex hull (voronoi_list V (truncate_simplex (SUC 2) ul))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[CONVEX_HULL_EQ;Packing3.CONVEX_VORONOI_LIST]); + (ONCE_REWRITE_TAC[ASSUME + `voronoi_list V (truncate_simplex (SUC 2) ul) = + convex hull (voronoi_list V (truncate_simplex (SUC 2) ul))`]); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (REWRITE_WITH + `W:real^3->bool DIFF {HD ul, omega_list_n V ul 1, omega_list_n V ul 2} = + {omega_list_n V ul 3}`); + (EXPAND_TAC "W" THEN REWRITE_WITH `HD ul = omega_list_n V ul 0`); + (REWRITE_TAC[OMEGA_LIST_N]); + (ASM_SET_TAC[]); + (REWRITE_TAC[ARITH_RULE `SUC 2 = 3`]); + (ASM_SET_TAC[]); (* finish subgoal 3 *) + (REWRITE_TAC[CONVEX_CONVEX_HULL]); (* finish subgoal 4 *) + (MATCH_MP_TAC CLOSED_CONVEX_HULL_FINITE); + (MATCH_MP_TAC FINITE_DIFF); + (EXPAND_TAC "W" THEN REWRITE_TAC[Geomdetail.FINITE6]); (* finish subgoal 5 *) + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); (* finish subgoal 6 *) + (UP_ASM_TAC THEN REWRITE_TAC[CONVEX_HULL_EQ_EMPTY]); + (EXPAND_TAC "W" THEN REWRITE_WITH `HD ul = omega_list_n V ul 0`); + (REWRITE_TAC[OMEGA_LIST_N]); + (ASM_SET_TAC[]); (* finish subgoal 7 *) + + (REWRITE_WITH + `omega_list_n V vl 3 = + closest_point + (convex hull (W DIFF {HD vl, omega_list_n V vl 1, omega_list_n V vl 2})) + (omega_list_n V vl 2)`); + (MATCH_MP_TAC CLOSEST_POINT_SUBSET_lemma); + (EXISTS_TAC `voronoi_list V (truncate_simplex (SUC 2) vl)`); + (REPEAT STRIP_TAC); (* 7 subgoals *) + + (REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `3 = SUC 2`]); (* finish subgoal 1 *) + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (REWRITE_TAC[ASSUME `W:real^3->bool = + {HD vl, omega_list_n V vl 1, omega_list_n V vl 2, omega_list_n V vl 3}`]); + (REWRITE_WITH `HD vl = omega_list_n V vl 0`); + (REWRITE_TAC[OMEGA_LIST_N]); + (ASM_SET_TAC[]); (* finish subgoal 2 *) + + (NEW_GOAL `voronoi_list V (truncate_simplex (SUC 2) vl) = + convex hull (voronoi_list V (truncate_simplex (SUC 2) vl))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[CONVEX_HULL_EQ;Packing3.CONVEX_VORONOI_LIST]); + (ONCE_REWRITE_TAC[ASSUME + `voronoi_list V (truncate_simplex (SUC 2) vl) = + convex hull (voronoi_list V (truncate_simplex (SUC 2) vl))`]); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (REWRITE_WITH + `W:real^3->bool DIFF {HD vl, omega_list_n V vl 1, omega_list_n V vl 2} + = {omega_list_n V vl 3}`); + (REWRITE_TAC[ASSUME `W:real^3->bool = + {HD vl, omega_list_n V vl 1, omega_list_n V vl 2, omega_list_n V vl 3}`]); + (REWRITE_WITH `HD vl = omega_list_n V vl 0`); + (REWRITE_TAC[OMEGA_LIST_N]); + (ASM_SET_TAC[]); + + (REWRITE_TAC[ARITH_RULE `SUC 2 = 3`]); + (ASM_SET_TAC[]); (* finish subgoal 3 *) + (REWRITE_TAC[CONVEX_CONVEX_HULL]); (* finish subgoal 4 *) + (MATCH_MP_TAC CLOSED_CONVEX_HULL_FINITE); + (MATCH_MP_TAC FINITE_DIFF); + (EXPAND_TAC "W" THEN REWRITE_TAC[Geomdetail.FINITE6]); (* finish subgoal 5 *) + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); (* finish subgoal 6 *) + (UP_ASM_TAC THEN REWRITE_TAC[CONVEX_HULL_EQ_EMPTY]); + (REWRITE_TAC[ASSUME `W:real^3->bool = + {HD vl, omega_list_n V vl 1, omega_list_n V vl 2, omega_list_n V vl 3}`]); + (REWRITE_WITH `HD vl = omega_list_n V vl 0`); + (REWRITE_TAC[OMEGA_LIST_N]); + (ASM_SET_TAC[]); (* finish subgoal 7 *) + (ASM_MESON_TAC[]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `i = 0`); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `i = 1`); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `i = 2`); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `i = 3`); + (ASM_MESON_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[])]);; + + +end;; + diff --git a/text_formalization/packing/OXLZLEZ.hl b/text_formalization/packing/OXLZLEZ.hl new file mode 100644 index 0000000..d54925d --- /dev/null +++ b/text_formalization/packing/OXLZLEZ.hl @@ -0,0 +1,9717 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Packing *) +(* Lemma: OXLZLEZ *) +(* Author: Thomas C. Hales *) +(* Date: 2012-12-31 *) +(* ========================================================================== *) + +(* Combine all the OXLZLEZ lemmas into the final result *) + +(* +When NQT finishes the cell cluster inequality section, this needs to be combined + with CELL_CLUSTER_ESTIMATE_PROPS to give OXLZLEZ + +*) + +(* +let WELLDEFINED_FUNCTION_3 = prove_by_refinement( + `!(f:C -> A->B) (s:C->A->bool) b. (!x i j. s x i /\ s x j ==> (f x i = f x j)) ==> + (?(g:C -> B). (!x. s x = {} ==> g x = b) /\ (!x i. s x i ==> g x = f x i))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPED_ABBREV_TAC `(g:C->B) = \x. if (s x = {}) then b else (f x (@i. (s x i)))` ; + TYPIFY `g` EXISTS_TAC; + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + EXPAND_TAC "g"; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAK_STRIP_TAC; + EXPAND_TAC "g"; + COND_CASES_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + SELECT_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let S_LEAF_FINITE = `!V ul. packing V ==> FINITE (s_leaf V ul)`;; + +let cc1 = `!V u0 u1 p n. saturated V /\ packing V /\ (n = CARD (s_leaf V [u0;u1])) ==> + (?f. IMAGE f (:num) = s_leaf V [u0;u1] /\ (!i. f (i + n) = f i) /\ + (!i j. (i < j /\ j < n) ==> azim u0 u1 p (f i) < azim u0 u1 p (f j)))`;; + +*) + +module Oxlzlez = struct + + +open Hales_tactic;; +open Leaf_cell;; + +parse_as_infix("<<",(18,"right"));; + +(* DEFINITIONS *) + +let s_leaf = new_definition `s_leaf V ul u <=> + (leaf V [EL 0 ul;EL 1 ul;u] /\ (cc_ke V [EL 0 ul; EL 1 ul; u] = 4 \/ cc_ke V [EL 1 ul;EL 0 ul;u] = 4))`;; + +let gg_mcell = new_definition `gg_mcell V f u0 u1 i = + sum + { X | mcell_set V X /\ {u0,u1} IN edgeX V X /\ X SUBSET wedge_ge u0 u1 (f i) (f (SUC i))} + (\X. gammaX V X lmfun * critical_weight V X + beta_bump_v1 V {u0,u1} X)`;; + +let azim_mcell = new_definition `azim_mcell V f u0 u1 i = + sum { X | mcell_set V X /\ {u0,u1} IN edgeX V X /\ X SUBSET wedge_ge u0 u1 (f i) (f (SUC i))} + (\X. dihX V X (u0,u1))`;; + +let cc_data_v8 = new_definition `cc_data_v8 V f u0 u1 = +cc_v11 ([ + (azim_mcell V f u0 u1); + (gg_mcell V f u0 u1); + (\i. gammaX V (cc_cell V [u0;u1;f i]) lmfun * critical_weight V (cc_cell V [u0;u1;f i])); + (\i. gammaX V (cc_cell V [u1;u0;f (SUC i)]) lmfun * critical_weight V (cc_cell V [u1;u0;f (SUC i)])) +], +[ +(\i. dist(f i,f(SUC i)) < &2 * hminus); +(\i. &2 * hminus <= dist (f i, f (SUC i)) /\ dist (f i,f(SUC i)) <= &2 * hplus); +(\i. &2 * hplus < dist (f i, f(SUC i))); +(\i. dist(u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus); +(\i. hl [u0;u1;f i] < #1.34); +(\i. ?ul. barV V 3 ul /\ {u0,u1} IN edgeX V (mcell4 V ul) /\ mcell4 V ul SUBSET (wedge_ge u0 u1 (f i) (f (SUC i)))) +], +CARD (s_leaf V [u0;u1]))`;; + +let leaf_rank = new_definition `!V ul w0 n f. leaf_rank V ul w0 n f = + (IMAGE f (:num) = s_leaf V ul /\ + (!i. f (i + n) = f i) /\ + (!i j. + i < n /\ j < n /\ i < j + ==> azim (EL 0 ul) (EL 1 ul) w0 (f i) < + azim (EL 0 ul) (EL 1 ul) w0 (f j)))`;; + + +let cc_4 = new_definition `cc_4 V u0 u1 f i = (?ul. barV V 3 ul /\ + {u0, u1} IN edgeX V (mcell4 V ul) /\ + mcell4 V ul SUBSET wedge_ge u0 u1 (f i) (f (SUC i)))`;; + +(* GENERIC RESULTS *) + +let CARD_INSERT_INTER = prove_by_refinement( + `!(a:A) A B. FINITE B ==> CARD((a INSERT A) INTER B) = + if (a IN B /\ ~(a IN A)) then SUC(CARD (A INTER B)) else CARD(A INTER B)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + COND_CASES_TAC; + ASM_REWRITE_TAC[INSERT_INTER]; + GMATCH_SIMP_TAC (CONJUNCT2 CARD_CLAUSES); + ASM_REWRITE_TAC[IN_INTER]; + BY(ASM_MESON_TAC[FINITE_INTER]); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[DE_MORGAN_THM]; + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_REWRITE_TAC[INSERT_INTER]); + ASM_REWRITE_TAC[INSERT_INTER]; + COND_CASES_TAC; + GMATCH_SIMP_TAC (CONJUNCT2 CARD_CLAUSES); + ASM_REWRITE_TAC[IN_INTER]; + BY(ASM_MESON_TAC[FINITE_INTER]); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let CARD_INSERT_INTER_ALT = prove_by_refinement( + `!(a:A) A B. FINITE B ==> CARD((a INSERT A) INTER B) = + (if (a IN B /\ ~(a IN A)) then 1 else 0) + CARD(A INTER B)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_SIMP_TAC [CARD_INSERT_INTER]; + COND_CASES_TAC; + BY(REWRITE_TAC[arith `1 + x = SUC x`]); + BY(REWRITE_TAC[arith `0 + x = x`]) + ]);; + (* }}} *) + +let NUMSEG_LT = prove_by_refinement( + `!r. ~(r = 0) ==> (0.. (r - 1)) = {i | i < r}`, + (* {{{ proof *) + [ + REWRITE_TAC[EXTENSION;IN_NUMSEG;IN_ELIM_THM]; + BY(ARITH_TAC) + ]);; + (* }}} *) + +let CARD4_IN_PAIRS = prove_by_refinement( + `!(a:A) b c d e f. + CARD {a,b,c,d} = 4 /\ {a,b,c,d} = {a,b,e,f} ==> {c,d} = {e,f}`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; + MATCH_MP_TAC Leaf_cell.LENGTH4_SET2; + REWRITE_TAC[set_of_list]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let initial_sublist_cons = prove_by_refinement( + `!(a:A) b x y. initial_sublist (CONS a x) (CONS b y) <=> (a = b) /\ initial_sublist x y`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.INITIAL_SUBLIST]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[APPEND]; + REWRITE_TAC[CONS_11]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let COPLANAR_CONVEX_HULL_COPLANAR = prove_by_refinement( + `!(s:real^A->bool). coplanar (convex hull s) <=> coplanar s`, + (* {{{ proof *) + [ + ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]; + GEN_TAC; + BY(REWRITE_TAC[AFFINE_HULL_CONVEX_HULL]) + ]);; + (* }}} *) + +(* +let STRICT_TOPOLOGICAL_SORT = prove_by_refinement( + `!((<<):(A->A->bool)). (!x y. ~(x << y /\ y << x)) /\ + (!x y. ~(x << y) ==> (x = y) \/ (y << x)) /\ + (!x y z. x << y /\ y << z ==> x << z) + ==> (!n s. + s HAS_SIZE n + ==> (?f. s = IMAGE f (1..n) /\ + (!j k. + j IN 1..n /\ k IN 1..n /\ j < k + ==> (f j << f k))))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC TOPOLOGICAL_SORT [`\x y. (x = y) \/ ( x << y)`]; + BETA_TAC; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`n`;`s`]); + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `f` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) +*) + +let BARV3_SET_OF_LIST4 = prove_by_refinement( + `!V ul. packing V /\ barV V 3 ul ==> + set_of_list ul = {EL 0 ul,EL 1 ul, EL 2 ul, EL 3 ul}`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Bump.set_of_list4 [`ul`]; + ANTS_TAC; + REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; + BY(ASM_MESON_TAC[]); + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let STRICT_SORT_FINITE = prove_by_refinement( + `!((<<):(A->A->bool)) s n. (!x y. x IN s /\ y IN s /\ x << y /\ y << x ==> x = y) /\ + (!x y z. x IN s /\ y IN s /\ z IN s /\ x << y /\ y << z ==> x << z) /\ + s HAS_SIZE n ==> + (?f. s = IMAGE f (1..n) /\ + (!j k. + j IN 1..n /\ k IN 1..n /\ j < k + ==> ~(f k << f j)))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC TOPOLOGICAL_SORT [`\x y. x IN s /\ y IN s /\ ((x = y) \/ x << y)`]; + BETA_TAC; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`n`;`s`]); + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `f` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `f j IN s /\ f k IN s` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `IMAGE` MP_TAC; + REWRITE_TAC[IMAGE;EXTENSION;IN_ELIM_THM]; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let MOD_INJ1_ALT = prove_by_refinement +(`!k n. ~( n = 0) /\ k < n /\ ~( k = 0) ==> (! x. ~( x MOD n = (x + k) MOD n)) `, +[ + REPEAT STRIP_TAC; + INTRO_TAC Oxl_def.MOD_INJ [`n`;`x`;`x`;`x + (k:num)`]; + ANTS_TAC; + ASM_REWRITE_TAC[IN_NUMSEG]; + REPEAT (FIRST_X_ASSUM MP_TAC); + SIMP_TAC[LE_REFL; ARITH_RULE` ~( n = 0) ==> x <= n - 1 + x `; ARITH_RULE` a <= a + x:num `]; + BY(ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC) +]);; + +let MOD_PERIOD_BOUNDED_ALT = prove_by_refinement ( +`!k n. ~( n = 0) /\ ~( k = 0) ==> (! x. (x + k) MOD n = x MOD n ==> n <= k ) `, +[ + REPEAT STRIP_TAC; + PROOF_BY_CONTR_TAC; + INTRO_TAC MOD_INJ1_ALT [`k`;`n`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[ARITH_RULE` a < (b:num) <=> ~(b <= a ) `]); + BY(ASM_MESON_TAC[]) +]);; + +let MOD_REFL_ALT = REWRITE_RULE[MULT_CLAUSES] (SPECL [`m:num `;`1`] MOD_MULT);; + + +let periodic_o = prove_by_refinement( + `!(g:A->B) f n. periodic f n ==> periodic (g o f) n`, + (* {{{ proof *) + [ + REWRITE_TAC[Oxl_def.periodic;o_DEF]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let periodic_shift = prove_by_refinement( + `!k (f:num->A) n. periodic f n ==> (periodic (\i. f (i + k)) n)`, + (* {{{ proof *) + [ + REWRITE_TAC[Oxl_def.periodic]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `(i + n) + (k:num) = (i + k) + n` (C SUBGOAL_THEN SUBST1_TAC); + BY(ARITH_TAC); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let PERIODIC_IMAGE = prove_by_refinement( + `!f n. ~(n = 0) /\ periodic (f:num->A) n ==> + IMAGE f {i | i < n} = IMAGE f (:num)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[EXTENSION;IN_IMAGE;IN_UNIV;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Geomdetail.EQ_EXPAND]; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `x' MOD n` EXISTS_TAC; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[GSYM Oxl_def.periodic_mod]; + BY(ASM_MESON_TAC[DIVISION]) + ]);; + (* }}} *) + +let PERIODIC_REDUCE_MOD = prove_by_refinement( + `!(f:num->A) n i. 1 <= n /\ periodic f n ==> (?j. j < n /\ f i = f j /\ f (SUC i) = f (SUC j))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `i MOD n` EXISTS_TAC; + TYPIFY `~(n=0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + ASM_SIMP_TAC[DIVISION]; + ASM_SIMP_TAC[GSYM Oxl_def.periodic_mod]; + BY(ASM_MESON_TAC[Hypermap.lemma_suc_mod;Oxl_def.periodic_mod]) + ]);; + (* }}} *) + +(* renamed from PERIODIC_INJ *) + +let PERIODIC_EQ_IMAGE = prove_by_refinement( + `!(f:num->A) n i j. ~(n=0) /\ periodic f n /\ (i MOD n = j MOD n) ==> (f i = f j)`, + (* {{{ proof *) + [ + BY(ASM_MESON_TAC[Oxl_def.periodic_mod]) + ]);; + (* }}} *) + +let F_SUC_PRE = prove_by_refinement( + `!(f:num->A) n i. ~(n = 0) /\ periodic f n ==> f (SUC (i + n - 1)) = f i`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC PERIODIC_EQ_IMAGE; + EXISTS_TAC `n:num`; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[arith `~(n=0) ==> SUC (i + n - 1) = 1 * n + i`]; + BY(REWRITE_TAC[MOD_MULT_ADD]) + ]);; + (* }}} *) + +let F_DEMOD = prove_by_refinement( + `!f n i. periodic f n /\ 1 < n ==> + f (i MOD n) = f i /\ f (SUC (i MOD n)) = f (SUC i)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MP_TAC (arith `1 < n ==> ~(n =0)`); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + MATCH_MP_TAC PERIODIC_EQ_IMAGE; + TYPIFY `n` EXISTS_TAC; + BY(ASM_SIMP_TAC[MOD_MOD_REFL]); + MATCH_MP_TAC PERIODIC_EQ_IMAGE; + TYPIFY `n` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `SUC x = x + 1`]; + BY(ASM_MESON_TAC[MOD_LT;MOD_ADD_MOD]) + ]);; + (* }}} *) + +let FM_DEMOD = prove_by_refinement( + `!f n i. periodic f n /\ 1 < n ==> f (i MOD n) = f i /\ + f (i MOD n + n - 1) = f (i + n - 1) `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MP_TAC (arith `1 < n ==> ~(n =0)`); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + MATCH_MP_TAC PERIODIC_EQ_IMAGE; + TYPIFY `n` EXISTS_TAC; + BY(ASM_SIMP_TAC[MOD_MOD_REFL]); + MATCH_MP_TAC PERIODIC_EQ_IMAGE; + TYPIFY `n` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `n - 1 < n` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(ASM_MESON_TAC[MOD_LT;MOD_ADD_MOD]) + ]);; + (* }}} *) + +let NULLSET_AFF_2_1 = prove_by_refinement( + `!x y z. NULLSET (aff_ge {x,y} {z})`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC NEGLIGIBLE_SUBSET; + TYPIFY `affine hull {x,y,z}` EXISTS_TAC; + REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]; + TYPIFY `{x,y,z} = {x,y} UNION {z}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]) + ]);; + (* }}} *) + +(* renamed from coplanar_dih_y -> coplanar_delta_y *) + +let coplanar_delta_y = prove_by_refinement( + `!u0 u1 u2 (u3:real^3). + ~coplanar {u0, u1, u2, u3} <=> + &0 < + delta_y (dist (u0,u1)) (dist (u0,u2)) (dist (u0,u3)) (dist (u2,u3)) + (dist (u1,u3)) + (dist (u1,u2))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC ( Leaf_cell.coplanar_eq_coplanar_alt); + REWRITE_TAC[DIMINDEX_3;arith `2 <= 3`]; + REWRITE_TAC[REWRITE_RULE[TAUT `(a <=> ~b) <=> (b <=> ~a)`] (Collect_geom2.POS_EQ_NOT_COPLANANR)]; + REWRITE_TAC[Merge_ineq.delta_delta_x]; + BY(REWRITE_TAC[arith `x pow 2 = x * x`;GSYM Sphere.delta_y]) + ]);; + (* }}} *) + +let RADV_ETAY = prove_by_refinement( + `!u0 u1 (u2:real^3). ~collinear {u0,u1,u2} ==> + radV {u0,u1,u2} = eta_y (dist(u0,u1)) (dist(u0,u2)) (dist(u1,u2))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Collect_geom.RADV_FORMULAR [`u2`;`u1`;`u0`]; + ASM_REWRITE_TAC[]; + TYPIFY `{u2,u1,u0} = {u0,u1,u2}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[Geomdetail.dist3]; + BY(MESON_TAC[DIST_SYM]) + ]);; + (* }}} *) + +let RADV2 = prove_by_refinement( + `!u (v:real^3). radV {u,v} = inv(&2) * dist(u,v)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Pack_defs.HL [`[u;v]`]; + REWRITE_TAC[set_of_list;Marchal_cells_3.HL_2]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let GDRQXLGv3 = prove_by_refinement( + `!(v0:real^3) v1 v2 v3. (let s = {v0,v1,v2,v3} in + let x1 = dist (v0,v1) pow 2 in + let x2 = dist (v0,v2) pow 2 in + let x3 = dist (v0,v3) pow 2 in + let x4 = dist (v2,v3) pow 2 in + let x5 = dist (v1,v3) pow 2 in + let x6 = dist (v1,v2) pow 2 in + ~coplanar s + ==> radV s pow 2 = rad2_x x1 x2 x3 x4 x5 x6)`, + (* {{{ proof *) + [ + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Merge_ineq.GDRQXLGv2 [`v0`;`v1`;`v2`;`v3`]; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + DISCH_THEN MATCH_MP_TAC; + TYPIFY `coplanar {v0,v1,v2,v3} = coplanar_alt{v0,v1,v2,v3}` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC Leaf_cell.coplanar_eq_coplanar_alt; + BY(ASM_REWRITE_TAC[DIMINDEX_3;arith `2 <= 3`]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + BY(ASM_MESON_TAC[Collect_geom2.NOT_COPLANAR_IMP_CARD4]) + ]);; + (* }}} *) + +let DIST_IMP_COLLINEAR = prove_by_refinement( + `!(u0:real^3) u1 u2. &2 <= dist(u0,u1) /\ &2 <= dist(u0,u2) /\ &2 <= dist(u1,u2) /\ + dist(u0,u1) < &4 /\ dist(u0,u2) < &4 /\ dist(u1,u2) < &4 ==> ~collinear{u0,u1,u2}`, + (* {{{ proof *) + [ + REWRITE_TAC[Collect_geom.COL_EQ_UPS_0;Trigonometry2.UPS_X_AND_HERON]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[]; + MATCH_MP_TAC (arith `&0 < x ==> ~(x = &0)`); + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_SIMP_TAC[arith `&2 <= x /\ &2 <= y /\ &2 <= z ==> &0 < x + y + z`]; + TYPIFY `!x y z. &2 <= x /\ &2 <= y /\ z < &4 ==> &0 < x + y - z` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let UPS_X8_POS = prove_by_refinement( + `!y5 y6. + &2 <= y5 /\ y5 < &4 /\ &2 <= y6 /\ y6 < &4 ==> + &0 < ups_x (&8) (y5 * y5) (y6 * y6)`, + (* {{{ proof *) + [ + REWRITE_TAC[GSYM Nonlinear_lemma.sqrt8_2;arith `&8 = #8.0`]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Merge_ineq.TRI_UPS_X_STRICT_POS; + MP_TAC Flyspeck_constants.bounds; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let DIST_IMP_UPS_X_POS = prove_by_refinement( + `!(u0:real^3) u1 u2. &2 <= dist(u0,u1) /\ &2 <= dist(u0,u2) /\ &2 <= dist(u1,u2) /\ + dist(u0,u1) < &4 /\ dist(u0,u2) < &4 /\ dist(u1,u2) < &4 ==> + &0 < ups_x (dist(u0,u1) pow 2) (dist (u0,u2) pow 2) (dist (u1,u2) pow 2)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[GSYM Collect_geom2.NOT_COL_EQ_UPS_X_POS]; + MATCH_MP_TAC DIST_IMP_COLLINEAR; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let INITIAL_SUBLIST_TRUNCATE = prove_by_refinement( + `!vl (ul:(real^3)list). LENGTH ul = 4 /\ + initial_sublist vl ul /\ ~initial_sublist vl (truncate_simplex 2 ul) ==> + (vl = ul)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `ul = [EL 0 ul;EL 1 ul;EL 2 ul;EL 3 ul]` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Bump.LENGTH4; + BY(ASM_REWRITE_TAC[]); + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `initial_sublist` MP_TAC; + REWRITE_TAC[]; + TYPIFY `truncate_simplex 2 ul = [EL 0 ul;EL 1 ul;EL 2 ul]` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM_ST `EL` SUBST1_TAC; + BY(REWRITE_TAC[Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_2;Bump.EL_EXPLICIT]); + FIRST_X_ASSUM_ST `initial_sublist` MP_TAC; + INTRO_TAC Packing3.INITIAL_SUBLIST_APPEND_SING [`vl`;`[EL 0 ul;EL 1 ul;EL 2 ul]`;`EL 3 ul`]; + TYPIFY `APPEND [EL 0 ul; EL 1 ul; EL 2 ul] [EL 3 ul] = [EL 0 ul; EL 1 ul; EL 2 ul; EL 3 ul]` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[APPEND]); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let NOT_COPLANAR_AFF_3 = prove_by_refinement( + `!(s:real^3->bool). ~coplanar s ==> aff_dim s = &3`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[INT_ARITH `x = int_of_num 3 <=> x <= &3 /\ ~(x <= &2)`]; + CONJ2_TAC; + BY(ASM_MESON_TAC[Rogers.AFF_DIM_LE_2_IMP_COPLANAR]); + BY(MESON_TAC[AFF_DIM_LE_UNIV;DIMINDEX_3]) + ]);; + (* }}} *) + +let AFF_DEP_COPLANAR = prove_by_refinement( + `!(a:real^3) b c d. CARD {a,b,c,d} = 4 ==> (affine_dependent {a,b,c,d} <=> coplanar {a,b,c,d})`, + (* {{{ proof *) + [ + ONCE_REWRITE_TAC[TAUT `(a <=> b) <=> (~a <=> ~b)`]; + REWRITE_TAC[AFFINE_INDEPENDENT_IFF_CARD;FINITE_INSERT;FINITE_EMPTY]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[INT_ARITH `int_of_num 4 - &1 = &3`]; + BY(ASM_MESON_TAC[Leaf_cell.COPLANAR_IMP_AFF_DIM;NOT_COPLANAR_AFF_3;INT_ARITH `x = int_of_num 3 ==> ~(x <= &2)`]) + ]);; + (* }}} *) + +let HL_IMP_BARV = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ ~coplanar (set_of_list ul) /\ + set_of_list ul SUBSET V /\ hl ul < sqrt(&2) /\ barV V 2 (truncate_simplex 2 ul) /\ + LENGTH ul = 4 ==> + barV V 3 ul`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.BARV;Sphere.VORONOI_NONDG;arith `2 + 1 = 3`;arith `3 + 1 = 4`]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "preliminaries"; + TYPIFY `initial_sublist vl (truncate_simplex 2 ul)` ASM_CASES_TAC; + BY(ASM_MESON_TAC[]); + TYPIFY `vl = ul` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC INITIAL_SUBLIST_TRUNCATE; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[arith `4 < 5`;arith `x + &4 = int_of_num 4 <=> x = &0`]; + REWRITE_TAC[AFF_DIM_EQ_0]; + TYPIFY `circumcenter (set_of_list ul)` EXISTS_TAC; + TYPIFY `!x y. x SUBSET {y} /\ y IN x ==> x = {(y:real^3)}` (C SUBGOAL_THEN MATCH_MP_TAC); + BY(SET_TAC[]); + TYPIFY `set_of_list ul = {EL 0 ul,EL 1 ul,EL 2 ul,EL 3 ul}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Bump.set_of_list4; + BY(ASM_REWRITE_TAC[]); + TYPIFY `~coplanar_alt {EL 0 ul,EL 1 ul,EL 2 ul,EL 3 ul}` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC (GSYM Leaf_cell.coplanar_eq_coplanar_alt); + BY(ASM_MESON_TAC[DIMINDEX_3;arith `2 <= 3`]); + TYPIFY `~affine_dependent {EL 0 ul,EL 1 ul,EL 2 ul,EL 3 ul}` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC AFF_DEP_COPLANAR; + CONJ2_TAC; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC Collect_geom2.NOT_COPLANAR_IMP_CARD4; + BY(ASM_REWRITE_TAC[]); + CONJ2_TAC; + INTRO_TAC Rogers.CIRCUMCENTER_IN_VORONOI_SET [`V`;`set_of_list ul`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[Pack_defs.HL]); + BY(REWRITE_TAC[Sphere.VORONOI_LIST]); + REWRITE_TAC[SUBSET;IN_SING]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Rogers.OAPVION3 [`set_of_list ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_THEN (C INTRO_TAC [`x`]); + DISCH_THEN MATCH_MP_TAC; + GMATCH_SIMP_TAC Tskajxy.NOT_COPLANAR_R3; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[IN_UNIV]; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Sphere.VORONOI_LIST;Sphere.VORONOI_SET]; + REWRITE_TAC[IN_INTERS;IN_ELIM_THM]; + DISCH_TAC; + TYPIFY `!w. w IN set_of_list ul ==> x IN voronoi_closed V w` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[]); + REWRITE_TAC[Sphere.voronoi_closed;IN_ELIM_THM]; + DISCH_TAC; + TYPIFY `dist(x,EL 0 ul)` EXISTS_TAC; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (arith `x <= y /\ y <= x ==> x = y`); + CONJ_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`w`]); + ASM_REWRITE_TAC[]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_MESON_TAC[SUBSET;IN;IN_INSERT]); + FIRST_X_ASSUM (C INTRO_TAC [`EL 0 ul`]); + ANTS_TAC; + BY(ASM_MESON_TAC[IN_INSERT]); + DISCH_THEN MATCH_MP_TAC; + BY(ASM_MESON_TAC[SUBSET;IN]) + ]);; + (* }}} *) + +let EDGE_LE_2RAD = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. + &0 < delta_x x1 x2 x3 x4 x5 x6 /\ + &0 < x4 /\ &0 < x5 /\ &0 < x6 /\ &0 < ups_x x4 x5 x6 ==> + x4 <= &4 * rad2_x x1 x2 x3 x4 x5 x6`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `&4 * eta_x x4 x5 x6 pow 2` EXISTS_TAC; + CONJ2_TAC; + GMATCH_SIMP_TAC Real_ext.REAL_LE_LMUL_IMP; + CONJ_TAC; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC Merge_ineq.rad2_x_eta_x; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC Collect_geom.HVXIKHW [`sqrt x4`;`sqrt x5`;`sqrt x6`]; + REWRITE_TAC[Collect_geom.ups_x_pow2]; + REWRITE_TAC[Sphere.eta_y;LET_DEF;LET_END_DEF]; + REPEAT (GMATCH_SIMP_TAC SQRT_POS_LE); + REPEAT (GMATCH_SIMP_TAC Merge_ineq.sqrtpow2); + ASM_SIMP_TAC [arith `&0 < x ==> &0 <= x`]; + GMATCH_SIMP_TAC REAL_LE_LDIV_EQ; + CONJ_TAC; + BY(REAL_ARITH_TAC); + DISCH_TAC; + TYPIFY `x4 = sqrt(x4) pow 2` (C SUBGOAL_THEN MP_TAC); + GMATCH_SIMP_TAC SQRT_POW_2; + BY(ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`]); + DISCH_TAC; + ASM_SIMP_TAC [arith `x = y ==> (x <= &4 * z <=> y <= &4 * z)`]; + TYPIFY `sqrt x4 pow 2 <= (&2 * eta_x x4 x5 x6) pow 2` ENOUGH_TO_SHOW_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + MATCH_MP_TAC Collect_geom2.POS_IMP_POW2; + CONJ_TAC; + GMATCH_SIMP_TAC SQRT_POS_LE; + BY(ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`]); + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `max_real3 (sqrt x4) (sqrt x5) (sqrt x6)` EXISTS_TAC; + ASM_SIMP_TAC[arith `&2 * x = x * &2`]; + REWRITE_TAC[Collect_geom.max_real3]; + REWRITE_TAC[Misc_defs_and_lemmas.max_real]; + BY(REPEAT COND_CASES_TAC THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let RAD2_Y_SQRT8 = prove_by_refinement( + `!y1 y2 y3 y5 y6. + &2 <= y5 /\ &2 <= y6 /\ y5 < &4 /\ y6 < &4 /\ + &0 < delta_y y1 y2 y3 (sqrt8) y5 y6 ==> + &2 <= rad2_y y1 y2 y3 (sqrt8) y5 y6`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.rad2_y;Sphere.delta_y;Sphere.y_of_x;Nonlinear_lemma.sqrt8_2;arith `#8.0 = &8`]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `&2 <= x <=> &8 <= &4 * x`]; + MATCH_MP_TAC EDGE_LE_2RAD; + REPEAT (GMATCH_SIMP_TAC REAL_LT_MUL_EQ); + ASM_SIMP_TAC[arith `&0 < &8`;arith `&2 <= x ==> &0 < x`]; + MATCH_MP_TAC UPS_X8_POS; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +(* renamed from DIH_X_LE_PI *) + +let DIH_X_LT_PI = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. &0 < x1 /\ &0 < delta_x x1 x2 x3 x4 x5 x6 ==> + dih_x x1 x2 x3 x4 x5 x6 < pi`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.dih_x;LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `pi / &2 + x < pi <=> x < pi / &2`]; + MATCH_MP_TAC Merge_ineq.ATN2_LE_PI2; + GMATCH_SIMP_TAC REAL_LT_RSQRT; + REWRITE_TAC[arith `&0 pow 2 = &0`]; + REWRITE_TAC[arith `&0 < &4 * x <=> &0 < x`]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let DIH_Y_LT_PI = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. &0 < y1 /\ &0 < delta_y y1 y2 y3 y4 y5 y6 ==> + dih_y y1 y2 y3 y4 y5 y6 < pi`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.delta_y;Sphere.dih_y;LET_DEF;LET_END_DEF]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC DIH_X_LT_PI; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let DIHV_EQ_0_PI_EQ_COPLANAR_ALT = prove_by_refinement( + `!(v0:real^3) v1 w1 w2. ~coplanar {v0,v1,w1,w2} ==> ~(dihV v0 v1 w1 w2 = &0)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY` ~collinear {v0,v1,w1} /\ ~collinear{v0,v1,w2}` (C SUBGOAL_THEN ASSUME_TAC); + CONJ_TAC THEN MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR; + BY(ASM_MESON_TAC[]); + TYPIFY `w1` EXISTS_TAC; + TYPIFY `{v0,v1,w2,w1} = {v0,v1,w1,w2}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(ASM_REWRITE_TAC[]); + INTRO_TAC DIHV_EQ_0_PI_EQ_COPLANAR [`v0`;`v1`;`w1`;`w2`]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let AZIM_ZERO_SHIFT = prove_by_refinement( + `!u0 u1 u2 w w'. ~collinear {u0,u1,u2} /\ ~collinear {u0,u1,w} /\ ~collinear {u0,u1,w'} ==> + (azim u0 u1 u2 w = azim u0 u1 u2 w' <=> azim u0 u1 w w' = &0)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (TAUT `((a ==> b) /\ (b ==> a)) ==> (a = b)`); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Fan.sum4_azim_fan [`u0`;`u1`;`u2`;`w`;`w'`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + DISCH_TAC; + INTRO_TAC Fan.sum5_azim_fan [`u0`;`u1`;`u2`;`w`;`w'`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[Local_lemmas.AZIM_RANGE]); + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let ORDER_AZIM_SUM2Pi0 = prove_by_refinement( + `!x y z n g. + ~collinear {x, y, z} /\ + (!i. i < n ==> ~collinear {x, y, g i}) /\ + g n = g 0 /\ + 1 < n /\ + (!j k. + j < n /\ k < n /\ j < k + ==> azim x y z (g j) < azim x y z (g k)) + ==> sum {i | i < n} (\i. azim x y (g i) (g (i + 1))) = &2 * pi`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Counting_spheres.ORDER_AZIM_SUM2Pi [`x`;`y`;`z`;`n`;`g o PRE`]; + ANTS_TAC; + ASM_REWRITE_TAC[o_THM]; + REWRITE_TAC[IN_NUMSEG]; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[arith `1 <= i /\ i <= n ==> PRE i < n`]); + ASM_REWRITE_TAC[arith `PRE (n + 1) = n /\ PRE 1 = 0`]; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[arith `1 <= i /\ i <= n ==> PRE i < n`;arith `j < k /\ 1 <= j ==> PRE j < PRE k`]); + DISCH_THEN (SUBST1_TAC o GSYM); + TYPIFY `sum (1..n) (\i. azim x y ((g o PRE) i) ((g o PRE) (i + 1))) = sum (1..n) ((\i. azim x y (g i) (g (i + 1))) o PRE)` (C SUBGOAL_THEN SUBST1_TAC); + MATCH_MP_TAC SUM_EQ; + REWRITE_TAC[IN_NUMSEG;o_THM]; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_SIMP_TAC[arith `1 <= x' ==> (PRE (x' + 1) = PRE x' + 1)`]); + MATCH_MP_TAC (GSYM Bump.BIJ_SUM); + REWRITE_TAC[BIJ;SURJ;INJ;IN_NUMSEG;IN_ELIM_THM]; + SUBCONJ_TAC; + BY(ARITH_TAC); + DISCH_THEN (unlist REWRITE_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `SUC x'` EXISTS_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN ARITH_TAC) + ]);; + (* }}} *) + + +(* MCELL FUNCTIONS *) + +let CRITICAL_WEIGHT_POS_LE = prove_by_refinement( + `!V X. &0 <= critical_weight V X`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.critical_weight]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[real_div]; + GMATCH_SIMP_TAC REAL_LE_MUL; + CONJ_TAC; + BY(REAL_ARITH_TAC); + REWRITE_TAC[REAL_LE_INV_EQ]; + REWRITE_TAC[ REAL_OF_NUM_LE]; + BY(ARITH_TAC) + ]);; + (* }}} *) + +let GAMMAX_NO_BETA = prove_by_refinement( + `!V ul X e k. packing V /\ saturated V /\ barV V 3 ul /\ X = mcell k V ul /\ + ~NULLSET X /\ + k < 4 /\ e IN critical_edgeX V X /\ + gammaX V X lmfun >= &0 ==> gammaX V X lmfun * critical_weight V X + beta_bump_v1 V e X >= &0`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Bump.MCELL_BUMP_0 [`V`;`ul`;`e`;`k`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[arith `x + &0 = x /\ (x >= &0 <=> &0 <= x)`]; + DISCH_TAC; + GMATCH_SIMP_TAC REAL_LE_MUL; + BY(ASM_REWRITE_TAC[CRITICAL_WEIGHT_POS_LE]) + ]);; + (* }}} *) + +(* LEAF RESULTS *) + +let REUHADY = prove_by_refinement( + `!V u0 u1 v1 v2. + saturated V /\ packing V /\ leaf V [u0;u1;v1] /\ leaf V [u0;u1;v2] /\ + ~(v1 =v2) ==> + sum {X | mcell_set V X /\ {u0,u1} IN edgeX V X /\ X SUBSET wedge_ge u0 u1 v1 v2} + (\t. dihX V t (u0,u1)) = azim u0 u1 v1 v2`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC Reuhady.REUHADY1; + GEXISTL_TAC [`[u0;u1;v1]`;`[u0;u1;v2]`]; + TYPIFY `EL 2 [u0;u1;v1] = v1 /\ EL 2 [u0;u1;v2] = v2` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(REWRITE_TAC[Bump.EL_EXPLICIT]); + TYPIFY `(hl [u0;u1;v1] < sqrt2 /\ hl [u0;u1;v2] < sqrt2 /\ [u0;u1;v1] IN barV V 2 /\ [u0;u1;v2] IN barV V 2) /\ hl [u0;u1] < sqrt(&2)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + SUBCONJ_TAC; + BY(ASM_MESON_TAC[Leaf_cell.leaf;IN]); + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Rogers.XNHPWAB4 [`V`;`[u0;u1;v1]`;`2`]; + ASM_REWRITE_TAC[GSYM Sphere.sqrt2]; + DISCH_THEN (C INTRO_TAC [`1`;`2`]); + REWRITE_TAC[arith `1 < 2 /\ 2 <= 2`;Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_2;Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_1]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + TYPIFY `set_of_list (truncate_simplex 1 [u0; u1; v1]) = {u0, u1} /\ set_of_list (truncate_simplex 1 [u0; u1; v2]) = {u0, u1}` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + REWRITE_TAC[Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_2;Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_1]; + BY(REWRITE_TAC[Bump.set_of_list2_explicit]); + TYPIFY `~([u0; u1; v1] = [u0; u1; v2])` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(ASM_REWRITE_TAC[CONS_11]); + TYPIFY `~collinear {u0,u1,v1} /\ ~collinear {u0,u1,v2}` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM Bump.set_of_list3_explicit]; + BY(ASM_MESON_TAC[GBEWYFX]); + ASM_SIMP_TAC[Leaf_cell.WEDGE_GE_ALMOST_DISJOINT]; + TYPIFY `~(u0 = u1)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]); + TYPIFY `u0 IN V /\ u1 IN V` (C SUBGOAL_THEN (unlist ASM_REWRITE_TAC)); + INTRO_TAC Packing3.BARV_SUBSET [`V`;`2`;`[u0;u1;v1]`]; + ANTS_TAC; + BY(ASM_MESON_TAC[leaf;IN;Sphere.BARV]); + REWRITE_TAC[Bump.set_of_list3_explicit]; + BY(SET_TAC[]); + SUBCONJ_TAC; + ASM_SIMP_TAC[Local_lemmas.AZIM_EQ_0_GE_ALT2]; + DISCH_TAC; + INTRO_TAC Leaf_cell.FCHKUGT [`V`;`u0`;`u1`;`v1`;`v2`]; + ANTS_TAC; + ASM_REWRITE_TAC[cc_A0;Bump.EL_EXPLICIT]; + MATCH_MP_TAC Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MP_TAC; + GMATCH_SIMP_TAC Collect_geom.IN_AFF_GE_INTERPRET_TO_AFF_GT_AND_AFF; + CONJ_TAC; + BY(ASM_SIMP_TAC[Fan.th3a]); + REWRITE_TAC[Collect_geom.aff]; + TYPIFY `v2 IN affine hull {u0,u1}` ASM_CASES_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP AFFINE_HULL_3_IMP_COLLINEAR)); + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[]); + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC Leaf_cell.EWYBJUA; + TYPIFY `V` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let s_leaf_leaf = prove_by_refinement( + `!V ul x. x IN s_leaf V ul ==> leaf V [EL 0 ul;EL 1 ul;x]`, + (* {{{ proof *) + [ + BY(MESON_TAC[IN;s_leaf]) + ]);; + (* }}} *) + +let s_leaf_collinear = prove_by_refinement( + `!V ul x. packing V /\ saturated V /\ x IN s_leaf V ul ==> ~(collinear {EL 0 ul,EL 1 ul,x})`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP s_leaf_leaf)); + DISCH_TAC; + INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[EL 0 ul;EL 1 ul;x]`]; + REWRITE_TAC[Bump.set_of_list3_explicit]; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let LEAF_RANKING_LEMMA = prove_by_refinement( + `!V ul w0 n. 0 < n /\ packing V /\ saturated V /\ + s_leaf V ul HAS_SIZE n /\ + ~collinear {EL 0 ul,EL 1 ul,w0} ==> + (?f. IMAGE f (:num) = s_leaf V ul /\ + (!i. f (i + n) = f i) /\ + (!i j. i < n /\ j < n /\ i < j ==> azim (EL 0 ul) (EL 1 ul) w0 (f i) < azim (EL 0 ul) (EL 1 ul) w0 (f j)))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPED_ABBREV_TAC `(s:real^3->bool) = s_leaf V ul` ; + TYPIFY `!x. x IN s ==> ~(collinear {EL 0 ul,EL 1 ul,x})` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[s_leaf_collinear]); + INTRO_TAC STRICT_SORT_FINITE [`\v w. (azim (EL 0 ul) (EL 1 ul) w0 v <= azim (EL 0 ul) (EL 1 ul) w0 w)`;`s`;`n` ]; + BETA_TAC; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ2_TAC; + BY(REAL_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + TYPIFY `azim (EL 0 ul) (EL 1 ul) w0 x = azim (EL 0 ul) (EL 1 ul) w0 y ==> (x = y)` ENOUGH_TO_SHOW_TAC; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + DISCH_TAC; + MATCH_MP_TAC Leaf_cell.FCHKUGT; + GEXISTL_TAC [`V`;`EL 0 ul`;`EL 1 ul`]; + REWRITE_TAC[Leaf_cell.cc_A0]; + REWRITE_TAC[Bump.EL_EXPLICIT]; + FIRST_ASSUM (C INTRO_TAC [`x`]); + FIRST_X_ASSUM (C INTRO_TAC [`y`]); + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `azim` MP_TAC; + ASM_SIMP_TAC[AZIM_EQ_ALT]; + BY(ASM_MESON_TAC[Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ;s_leaf_leaf]); + REPEAT WEAK_STRIP_TAC; + TYPIFY `\i. f (SUC (i MOD n))` EXISTS_TAC; + BETA_TAC; + CONJ2_TAC; + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC MOD_MULT_ADD [`1`;`n`;`i`]; + REWRITE_TAC[arith `1 * n + i = i + n`]; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[]); + REPEAT WEAK_STRIP_TAC; + ASM_SIMP_TAC[MOD_LT]; + FIRST_X_ASSUM (C INTRO_TAC [`SUC i`;`SUC j`]); + REWRITE_TAC[arith `~(a <= b) <=> (b b) /\ (b ==> a)) ==> (a = b)`); + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + TYPIFY `SUC (x' MOD n)` EXISTS_TAC; + ASM_REWRITE_TAC[IN_NUMSEG]; + REWRITE_TAC[arith `1 <= SUC x`]; + REWRITE_TAC[arith `SUC x <= n <=> x < n`]; + BY(ASM_MESON_TAC[DIVISION;arith `~(n=0) <=> (0 < n)`]); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `PRE x'` EXISTS_TAC; + AP_TERM_TAC; + TYPIFY `PRE x' MOD n = PRE x'` (C SUBGOAL_THEN SUBST1_TAC); + MATCH_MP_TAC MOD_LT; + FIRST_X_ASSUM_ST `IN` MP_TAC; + REWRITE_TAC[IN_NUMSEG]; + BY(ARITH_TAC); + FIRST_X_ASSUM_ST `IN` MP_TAC; + REWRITE_TAC[IN_NUMSEG]; + BY(ARITH_TAC) + ]);; + (* }}} *) + + +let S_LEAF_SET = prove_by_refinement( + `!V ul. s_leaf V ul = { u | leaf V [EL 0 ul; EL 1 ul; u] /\ + (cc_ke V [EL 0 ul; EL 1 ul; u] = 4 \/ cc_ke V [EL 1 ul; EL 0 ul; u] = 4)}`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[EXTENSION;IN_ELIM_THM;s_leaf;IN]) + ]);; + (* }}} *) + +(* renamed from LEAF_RANK_COLLINEAR: *) + +let LEAF_RANK_COLLINEAR = prove_by_refinement( + `!V ul w0 n f k. packing V /\ saturated V /\ leaf_rank V ul w0 n f ==> ~collinear {EL 0 ul,EL 1 ul,f k}`, + (* {{{ proof *) + [ + REWRITE_TAC[leaf_rank;IMAGE;IN_UNIV;EXTENSION;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[]; + MATCH_MP_TAC s_leaf_collinear; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let S_LEAF_SUBSET_PACKING = prove_by_refinement( + `!V ul. packing V /\ saturated V ==> s_leaf V ul SUBSET V`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[S_LEAF_SET;leaf;SUBSET;IN_ELIM_THM;IN]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP Packing3.BARV_SUBSET)); + REWRITE_TAC[set_of_list]; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let S_LEAF_BOUNDED = prove_by_refinement( + `!V ul. packing V /\ saturated V ==> s_leaf V ul SUBSET (ball(EL 0 ul, &2 * sqrt(&2) ))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[S_LEAF_SET;SUBSET;IN_ELIM_THM;ball;leaf;IN;Sphere.sqrt2]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Rogers.HL_PROPERTIES [`V`;`[EL 0 ul;EL 1 ul;x]`;`2`]; + ASM_REWRITE_TAC[set_of_list;IN_INSERT]; + TYPED_ABBREV_TAC `(d:real^3) = circumcenter {EL 0 ul, EL 1 ul, x}` ; + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + FIRST_ASSUM (C INTRO_TAC [`EL 0 ul`]); + REWRITE_TAC[]; + ONCE_REWRITE_TAC[DIST_SYM]; + FIRST_X_ASSUM (C INTRO_TAC [`x`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC DIST_TRIANGLE [`EL 0 ul`;`d`;`x`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let S_LEAF_FINITE = prove_by_refinement( + `!V ul. packing V /\ saturated V ==> FINITE (s_leaf V ul)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC FINITE_SUBSET; + TYPIFY `V INTER ball(EL 0 ul, &2 * sqrt(&2))` EXISTS_TAC; + CONJ_TAC; + MATCH_MP_TAC Packing3.KIUMVTC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[SUBSET_INTER]; + BY(ASM_MESON_TAC[S_LEAF_SUBSET_PACKING;S_LEAF_BOUNDED]) + ]);; + (* }}} *) + +let S_LEAF_SYM = prove_by_refinement( +`!V u0 u1. + packing V /\ + saturated V ==> + s_leaf V [u1;u0] = s_leaf V [u0;u1]`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[EXTENSION;s_leaf;IN;Bump.EL_EXPLICIT]; + BY(ASM_MESON_TAC[Leaf_cell.ZASUVOR]) + ]);; + (* }}} *) + +let S_LEAF_TRUNCATE = prove_by_refinement( + `!V ul. s_leaf V ul = s_leaf V [EL 0 ul;EL 1 ul]`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[EXTENSION;s_leaf;IN;Bump.EL_EXPLICIT]) + ]);; + (* }}} *) + +let MCELL_AVOID_LEAVES = prove_by_refinement( + `!V ul X. packing V /\ saturated V /\ ~NULLSET X /\ mcell_set V X ==> + ?v. v IN X /\ (!u. u IN s_leaf V ul ==> ~(v IN aff_ge {EL 0 ul,EL 1 ul} {u}))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + TYPIFY `X SUBSET UNIONS (IMAGE (\u. aff_ge {EL 0 ul, EL 1 ul} {u}) (s_leaf V ul))` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[SUBSET;IN_UNIONS;IN_IMAGE]; + FIRST_X_ASSUM MP_TAC; + BY(SET_TAC[]); + FIRST_X_ASSUM_ST `NULLSET` MP_TAC; + REWRITE_TAC[]; + MATCH_MP_TAC NEGLIGIBLE_SUBSET; + TYPIFY `UNIONS (IMAGE (\u. aff_ge {EL 0 ul, EL 1 ul} {u}) (s_leaf V ul))` EXISTS_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC NEGLIGIBLE_UNIONS; + CONJ_TAC; + MATCH_MP_TAC FINITE_IMAGE; + MATCH_MP_TAC S_LEAF_FINITE; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[IN_IMAGE]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[NULLSET_AFF_2_1]) + ]);; + (* }}} *) + +let MCELL_WEDGE_UNIQUE = prove_by_refinement( + `!V ul w0 n f X. + packing V /\ + saturated V /\ + s_leaf V ul HAS_SIZE n /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + leaf_rank V ul w0 n f /\ mcell_set V X /\ + ~NULLSET X /\ + {EL 0 ul,EL 1 ul} IN edgeX V X ==> + (!i j. i < n /\ j < n /\ X SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) /\ + X SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f j) (f (SUC j)) ==> (i = j))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `n <= 1` ASM_CASES_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + PROOF_BY_CONTR_TAC; + TYPIFY `!k. ~collinear {EL 0 ul,EL 1 ul, f k}` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[LEAF_RANK_COLLINEAR]); + TYPIFY `wedge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) INTER wedge (EL 0 ul) (EL 1 ul) (f j) (f (SUC j)) = {}` ENOUGH_TO_SHOW_TAC; + INTRO_TAC Leaf_cell.WEDGE_WEDGE_GE [`EL 0 ul`;`EL 1 ul`;`f i`;`f (SUC i)`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + INTRO_TAC Leaf_cell.WEDGE_WEDGE_GE [`EL 0 ul`;`EL 1 ul`;`f j`;`f (SUC j)`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `X SUBSET aff_ge {EL 0 ul, EL 1 ul} {f i} UNION aff_ge {EL 0 ul, EL 1 ul} {f (SUC i)} UNION aff_ge {EL 0 ul,EL 1 ul} {f j} UNION aff_ge {EL 0 ul, EL 1 ul} { f (SUC j)}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT (FIRST_X_ASSUM MP_TAC); + BY(SET_TAC[]); + BY(ASM_MESON_TAC[NEGLIGIBLE_UNION;NEGLIGIBLE_SUBSET;NULLSET_AFF_2_1]); + INTRO_TAC Counting_spheres.WEDGE_ORDER_DISJOINT [`EL 0 ul`;`EL 1 ul`;`w0`;`n`;`f o PRE`]; + REWRITE_TAC[o_THM]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank]; + REWRITE_TAC[arith `PRE (n+1) = n /\ PRE 1 = 0`]; + REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[arith `0 + n = n`]); + REWRITE_TAC[IN_NUMSEG]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + DISCH_THEN (C INTRO_TAC [`SUC i`;`SUC j`]); + ASM_REWRITE_TAC[IN_NUMSEG;arith `1 <= SUC l`;arith `SUC i = SUC j <=> i = j`;arith `PRE (SUC i) = i`;arith `PRE(SUC i + 1) = SUC i`]; + DISCH_THEN MATCH_MP_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC) + ]);; + (* }}} *) + +let LEAF_RANK_PERIODIC = prove_by_refinement( + `!V ul w0 n f. leaf_rank V ul w0 n f ==> periodic f n`, + (* {{{ proof *) + [ + BY(MESON_TAC[leaf_rank;Oxl_def.periodic]) + ]);; + (* }}} *) + +let LEAF_RANK_AZIM_INJ = prove_by_refinement( + `!V ul w0 n f i j. saturated V /\ packing V /\ ~(n=0) /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ leaf_rank V ul w0 n f ==> ( + azim (EL 0 ul) (EL 1 ul) (f i) (f j) = &0 <=> ((i MOD n) = (j MOD n)))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!j. f j IN s_leaf V ul` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank;EXTENSION;IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + TYPIFY `!j. leaf V [EL 0 ul; EL 1 ul; f j]` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC s_leaf_leaf; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!j. ~collinear {EL 0 ul, EL 1 ul, f j}` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[EL 0 ul;EL 1 ul; f j]`]; + BY(ASM_REWRITE_TAC[set_of_list]); + INTRO_TAC AZIM_ZERO_SHIFT [`EL 0 ul`;`EL 1 ul`;`w0`]; + DISCH_THEN ((unlist ASM_SIMP_TAC) o GSYM); + TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC LEAF_RANK_PERIODIC; + BY(ASM_MESON_TAC[]); + TYPIFY `!k. f k = f (k MOD n)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Oxl_def.periodic_mod]); + ONCE_REWRITE_TAC[Geomdetail.EQ_EXPAND]; + CONJ2_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!k. k MOD n < n` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[DIVISION]); + TYPIFY `i MOD n < j MOD n` ASM_CASES_TAC; + BY(ASM_MESON_TAC[arith `x < y ==> ~(x = y)`]); + TYPIFY `j MOD n < i MOD n` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[arith `~((i:num) < j) <=> (j < i \/ (i = j))`]; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM (C INTRO_TAC [`j MOD n`;`i MOD n`]); + ANTS_TAC; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[arith `x < y ==> ~(x = y)`]) + ]);; + (* }}} *) + +let LEAF_RANK_AZIM_NZ = prove_by_refinement( + `!V ul w0 n f i. saturated V /\ packing V /\ leaf_rank V ul w0 n f /\ 1 < n + /\ ~collinear {EL 0 ul, EL 1 ul,w0} ==> ~(azim (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) = &0)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`ul`;`w0`;`n`;`f`;`i`;`SUC i`]; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`]; + BY(ASM_MESON_TAC[arith `SUC i = i + 1`;arith `1 < n ==> ~(n = 0)`;arith `~(1 = 0)`;arith `1 < n ==> ~(n <= 1)`;MOD_PERIOD_BOUNDED_ALT]) + ]);; + (* }}} *) + +let MCELL_IN_WEDGE = prove_by_refinement( + `!V ul w0 n f X. + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V ul HAS_SIZE n /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + leaf_rank V ul w0 n f /\ mcell_set V X /\ + ~NULLSET X /\ + {EL 0 ul,EL 1 ul} IN edgeX V X ==> + ?i. i < n /\ X SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MCELL_AVOID_LEAVES [`V`;`ul`;`X`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!j. f j IN s_leaf V ul` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank;EXTENSION;IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + TYPIFY `!j. leaf V [EL 0 ul; EL 1 ul; f j]` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC s_leaf_leaf; + BY(ASM_REWRITE_TAC[]); + TYPIFY `!j. ~collinear {EL 0 ul, EL 1 ul, f j}` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[EL 0 ul;EL 1 ul; f j]`]; + BY(ASM_REWRITE_TAC[set_of_list]); + COMMENT "reduce to v in wedge"; + TYPIFY `?i. i < n /\ v IN wedge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `i` EXISTS_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC Leaf_cell.BDXKHTW; + TYPIFY `V` EXISTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + CONJ2_TAC; + REWRITE_TAC[IN_INTER]; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC LEAF_RANK_AZIM_NZ; + BY(ASM_MESON_TAC[]); + COMMENT "try top piece"; + TYPIFY `v IN wedge (EL 0 ul) (EL 1 ul) (f (PRE n)) (f 0)` ASM_CASES_TAC; + TYPIFY `PRE n` EXISTS_TAC; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + TYPIFY `f (SUC (PRE n)) = f 0` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM kill; + FIRST_X_ASSUM (C INTRO_TAC [`0`]); + TYPIFY `SUC (PRE n) = n` (C SUBGOAL_THEN SUBST1_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(REWRITE_TAC[arith `0 + n = n`]); + INTRO_TAC Leaf_cell.WEDGE_COMPLEMENT [`EL 0 ul`;`EL 1 ul`;`f (PRE n)`;`f 0`]; + ANTS_TAC; + GMATCH_SIMP_TAC LEAF_RANK_AZIM_INJ; + TYPIFY `n` EXISTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[arith `1 < n ==> ~(n = 0)`]); + ASM_SIMP_TAC[MOD_0;arith `1 < n ==> ~(n=0)`]; + TYPIFY `PRE n MOD n = PRE n` (C SUBGOAL_THEN SUBST1_TAC); + MATCH_MP_TAC MOD_LT; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + REWRITE_TAC[EXTENSION;IN_UNIV;IN_DIFF]; + DISCH_THEN (C INTRO_TAC [`v`]); + ASM_REWRITE_TAC[]; + REWRITE_TAC[Local_lemmas.WEDGE_GE_AZIM_LE]; + DISCH_TAC; + TYPED_ABBREV_TAC `(A:num->bool) = {i | i < n /\ azim (EL 0 ul) (EL 1 ul) (f 0) (f i) < azim (EL 0 ul) (EL 1 ul) (f 0) v }` ; + TYPIFY `0 IN A` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "A"; + REWRITE_TAC[IN_ELIM_THM;AZIM_REFL]; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + PROOF_BY_CONTR_TAC; + TYPIFY `azim (EL 0 ul) (EL 1 ul) (f 0) v = &0` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC (arith `~(&0 < x) /\ (&0 <= x) ==> (x = &0)`); + BY(ASM_REWRITE_TAC[Local_lemmas.AZIM_RANGE]); + BY(ASM_MESON_TAC[Local_lemmas.AZIM_EQ_0_GE_ALT2]); + INTRO_TAC num_MAX [`A`]; + DISCH_THEN (MP_TAC o MATCH_MP (TAUT `(a <=> b) ==> (a ==> b)`)); + ANTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + TYPIFY `n` EXISTS_TAC; + EXPAND_TAC "A"; + REWRITE_TAC[IN_ELIM_THM]; + BY(ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `m` EXISTS_TAC; + TYPIFY `m < n /\ azim (EL 0 ul) (EL 1 ul) (f 0) (f m) < azim (EL 0 ul) (EL 1 ul) (f 0) v` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM kill; + FIRST_X_ASSUM MP_TAC; + EXPAND_TAC "A"; + BY(REWRITE_TAC[IN_ELIM_THM]); + ASM_REWRITE_TAC[]; + REWRITE_TAC[Reuhady.WEDGE_SIMPLE;IN_ELIM_THM]; + COMMENT "v not collinear"; + TYPIFY `~(EL 0 ul= EL 1 ul)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]); + TYPIFY `~collinear {EL 0 ul,EL 1 ul,v}` (C SUBGOAL_THEN ASSUME_TAC); + ASM_SIMP_TAC[COLLINEAR_3_AFFINE_HULL]; + DISCH_TAC; + FIRST_X_ASSUM_ST `aff_ge` (C INTRO_TAC [`f 0`]); + ASM_SIMP_TAC[]; + TYPIFY `affine hull {EL 0 ul,EL 1 ul} SUBSET aff_ge {EL 0 ul,EL 1 ul} {f 0}` ENOUGH_TO_SHOW_TAC; + FIRST_X_ASSUM MP_TAC; + BY(SET_TAC[]); + MATCH_MP_TAC AFFINE_HULL_SUBSET_AFF_GE; + MATCH_MP_TAC Fan.th3a; + BY(ASM_MESON_TAC[]); + COMMENT "do azim shifts"; + CONJ_TAC; + INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`f 0 `;`f m`;`f m`;`v`]; + ANTS_TAC; + ASM_SIMP_TAC[]; + BY(ASM_SIMP_TAC[arith `x <= x`;arith `x < y ==> x <= y`]); + REWRITE_TAC[AZIM_REFL]; + BY(REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT "second azim ineq"; + TYPIFY `SUC m < n` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `~(m= PRE n)` ENOUGH_TO_SHOW_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + DISCH_TAC; + REPEAT (FIRST_X_ASSUM_ST `azim` MP_TAC); + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + TYPIFY `~(SUC m IN A)` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[IN;arith `~(SUC m <= m)`]); + EXPAND_TAC "A"; + ASM_REWRITE_TAC[IN_ELIM_THM]; + REWRITE_TAC[arith `~(x < y) <=> y <= x`]; + DISCH_TAC; + INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`f 0 `;`f m`;`v`;`f (SUC m)`]; + ANTS_TAC; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0 `;`f 0`;`f m`;`f (SUC m)`]; + ANTS_TAC; + ASM_SIMP_TAC[]; + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank]; + REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + TYPIFY `m = 0` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`0`;`m`]); + BY(ASM_MESON_TAC[arith `1 < n ==> 0 < n`;arith `~(m=0) ==> 0 < m`;arith `x < y ==> x <= y`]); + FIRST_X_ASSUM (C INTRO_TAC [`0`;`SUC m`]); + BY(ASM_MESON_TAC[arith `1 < n ==> 0 < n`;arith ` 0 < SUC m`;arith `x < y ==> x <= y`]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`m`;`SUC m`]); + ANTS_TAC; + BY(ASM_REWRITE_TAC[arith `m < SUC m`]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + ONCE_REWRITE_TAC [arith `x < y <=> &0 < y - x`]; + DISCH_THEN (SUBST1_TAC o GSYM); + MATCH_MP_TAC (arith `~(x = y) /\ (x <= y) ==> &0 < y - x`); + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[AZIM_ZERO_SHIFT]; + ONCE_REWRITE_TAC[Local_lemmas.AZIM_EQ_0_SYM2]; + BY(ASM_SIMP_TAC[AZIM_EQ_0_GE_ALT]) + ]);; + (* }}} *) + +let LEAF_RANK_REUHADY = prove_by_refinement( + `!V ul w0 n f i. + 1 < n /\ + packing V /\ saturated V /\ s_leaf V ul HAS_SIZE n /\ + ~collinear {EL 0 ul, EL 1 ul, w0 } /\ + leaf_rank V ul w0 n f ==> + azim_mcell V f (EL 0 ul) (EL 1 ul) i = azim (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC LEAF_RANK_PERIODIC; + BY(ASM_MESON_TAC[]); + TYPIFY `!k. f (k MOD n) = f k` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Oxl_def.periodic_mod;arith `1 < n ==> ~(n=0)`]); + REWRITE_TAC[azim_mcell]; + INTRO_TAC REUHADY [`V`;`EL 0 ul`;`EL 1 ul`;`f i`;`f (SUC i)`]; + DISCH_THEN MATCH_MP_TAC; + TYPIFY `!j. f j IN s_leaf V ul` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank;EXTENSION;IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + TYPIFY `!j. leaf V [EL 0 ul; EL 1 ul; f j]` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC s_leaf_leaf; + BY(ASM_REWRITE_TAC[]); + ASM_SIMP_TAC[]; + DISCH_TAC; + INTRO_TAC LEAF_RANK_AZIM_NZ [`V`;`ul`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[AZIM_REFL]) + ]);; + (* }}} *) + +let LEAF_RANK_BIJ = prove_by_refinement( + `!V ul w0 n f. + 1 < n /\ + packing V /\ saturated V /\ s_leaf V ul HAS_SIZE n /\ + EL 0 ul IN V /\ EL 1 ul IN V /\ + ~collinear {EL 0 ul, EL 1 ul, w0 } /\ + leaf_rank V ul w0 n f ==> + BIJ SND {i,X | i < n /\ + mcell_set V X /\ + {EL 0 ul, EL 1 ul} IN edgeX V X /\ + X SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))} {X | mcell_set V X /\ + {EL 0 ul, EL 1 ul} IN edgeX V X } +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[BIJ;INJ]; + SUBCONJ_TAC; + SUBCONJ_TAC; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_REWRITE_TAC[SND]); + DISCH_TAC; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[SND]; + REWRITE_TAC[PAIR_EQ]; + DISCH_TAC; + INTRO_TAC MCELL_WEDGE_UNIQUE [`V`;`ul`;`w0`;`n`;`f`;`X`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + DISCH_TAC; + FIRST_X_ASSUM_ST `mcell_set` MP_TAC; + REWRITE_TAC[Pack_defs.mcell_set;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[Bump.RIJRIED;NOT_IN_EMPTY;IN]); + ASM_REWRITE_TAC[]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + REWRITE_TAC[SURJ]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MCELL_IN_WEDGE [`V`;`ul`;`w0`;`n`;`f`;`x`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `mcell_set` MP_TAC; + REWRITE_TAC[Pack_defs.mcell_set;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[Bump.RIJRIED;NOT_IN_EMPTY;IN]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `(i,x)` EXISTS_TAC; + BY(ASM_MESON_TAC[SND]) + ]);; + (* }}} *) + +let LEAF_RANK_GRUTOTI = prove_by_refinement( + `!V ul w0 n f. + 1 < n /\ + packing V /\ saturated V /\ s_leaf V ul HAS_SIZE n /\ + EL 0 ul IN V /\ EL 1 ul IN V /\ + ~collinear {EL 0 ul, EL 1 ul, w0 } /\ + leaf_rank V ul w0 n f /\ + hl [EL 0 ul;EL 1 ul] < sqrt (&2) ==> + sum {i | i < n } (azim_mcell V f (EL 0 ul) (EL 1 ul)) = &2 * pi`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `azim_mcell V f (EL 0 ul) (EL 1 ul) = (\i. azim_mcell V f (EL 0 ul) (EL 1 ul) i)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[FUN_EQ_THM]); + INTRO_TAC LEAF_RANK_REUHADY [`V`;`ul`;`w0`;`n`;`f`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist REWRITE_TAC); + REWRITE_TAC[arith `SUC i = i + 1`]; + MATCH_MP_TAC ORDER_AZIM_SUM2Pi0; + TYPIFY `w0` EXISTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC[LEAF_RANK_COLLINEAR]); + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank]; + BY(MESON_TAC[arith `0 + n = n`]) + ]);; + (* }}} *) + +(* +let LEAF_RANK_GRUTOTI_DEPRECATED = prove_by_refinement( + `!V ul w0 n f. + 1 < n /\ + packing V /\ saturated V /\ s_leaf V ul HAS_SIZE n /\ + EL 0 ul IN V /\ EL 1 ul IN V /\ + ~collinear {EL 0 ul, EL 1 ul, w0 } /\ + leaf_rank V ul w0 n f /\ + hl [EL 0 ul;EL 1 ul] < sqrt (&2) ==> + sum {i | i < n } (azim_mcell V f (EL 0 ul) (EL 1 ul)) = &2 * pi +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `azim_mcell V f (EL 0 ul) (EL 1 ul) = (\i. azim_mcell V f (EL 0 ul) (EL 1 ul) i)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[FUN_EQ_THM]); + REWRITE_TAC[azim_mcell]; + GMATCH_SIMP_TAC SUM_SUM_PRODUCT; + CONJ_TAC; + REWRITE_TAC[FINITE_NUMSEG_LT]; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC FINITE_SUBSET; + TYPIFY `{X | mcell_set V X /\edgeX V X {EL 0 ul, EL 1 ul} }` EXISTS_TAC; + CONJ2_TAC; + BY(SET_TAC[IN]); + MATCH_MP_TAC Marchal_cells_3.FINITE_EDGE_X2; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[IN_ELIM_THM]; + INTRO_TAC LEAF_RANK_BIJ [`V`;`ul`;`w0`;`n`;`f`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + TYPIFY` (\ ((i:num),j). dihX V j (EL 0 ul,EL 1 ul)) = (\X. dihX V X (EL 0 ul, EL 1 ul)) o SND` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(REWRITE_TAC[FUN_EQ_THM;o_THM;Bump.BETA_ORDERED_PAIR_THM]); + DISCH_TAC; + GMATCH_SIMP_TAC Bump.BIJ_SUM; + TYPIFY `{X | mcell_set V X /\ {EL 0 ul, EL 1 ul} IN edgeX V X}` EXISTS_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC Grutoti.GRUTOTI; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]) + ]);; + (* }}} *) +*) + +let LEAF_RANK_GG_SUM = prove_by_refinement( + `!V ul w0 n f. + 1 < n /\ + packing V /\ saturated V /\ s_leaf V ul HAS_SIZE n /\ + EL 0 ul IN V /\ EL 1 ul IN V /\ + ~collinear {EL 0 ul, EL 1 ul, w0 } /\ + leaf_rank V ul w0 n f ==> + sum {i | i < n } (gg_mcell V f (EL 0 ul) (EL 1 ul)) = + sum { X | mcell_set V X /\ {EL 0 ul, EL 1 ul} IN edgeX V X } + (\X. gammaX V X lmfun * critical_weight V X + beta_bump_v1 V {EL 0 ul, EL 1 ul} X )`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `gg_mcell V f (EL 0 ul) (EL 1 ul) = (\i. gg_mcell V f (EL 0 ul) (EL 1 ul) i)` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[FUN_EQ_THM]); + REWRITE_TAC[gg_mcell]; + GMATCH_SIMP_TAC SUM_SUM_PRODUCT; + CONJ_TAC; + REWRITE_TAC[FINITE_NUMSEG_LT]; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC FINITE_SUBSET; + TYPIFY `{X | mcell_set V X /\edgeX V X {EL 0 ul, EL 1 ul} }` EXISTS_TAC; + CONJ2_TAC; + BY(SET_TAC[IN]); + MATCH_MP_TAC Marchal_cells_3.FINITE_EDGE_X2; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[IN_ELIM_THM]; + INTRO_TAC LEAF_RANK_BIJ [`V`;`ul`;`w0`;`n`;`f`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + TYPIFY` (\ ((i:num),j). gammaX V j lmfun * critical_weight V j + beta_bump_v1 V {EL 0 ul, EL 1 ul} j) = (\X. gammaX V X lmfun * critical_weight V X + beta_bump_v1 V {EL 0 ul, EL 1 ul} X) o SND` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(REWRITE_TAC[FUN_EQ_THM;o_THM;Bump.BETA_ORDERED_PAIR_THM]); + DISCH_TAC; + GMATCH_SIMP_TAC Bump.BIJ_SUM; + TYPIFY `{X | mcell_set V X /\ {EL 0 ul, EL 1 ul} IN edgeX V X}` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let MCELL2_DIHX_POS = prove_by_refinement( + `!V X ul. saturated V /\ packing V /\ barV V 3 ul /\ X = mcell2 V ul /\ {EL 0 ul,EL 1 ul} IN edgeX V X ==> + &0 < dihX V X (EL 0 ul,EL 1 ul)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~NULLSET X` (C SUBGOAL_THEN ASSUME_TAC); + DISCH_TAC; + INTRO_TAC Bump.RIJRIED [`V`;`ul`;`2`]; + ANTS_TAC; + BY(ASM_MESON_TAC[Bump.MCELL2]); + REWRITE_TAC[EXTENSION;NOT_IN_EMPTY]; + BY(ASM_MESON_TAC[Bump.MCELL2]); + ASM_SIMP_TAC[Tskajxy.MCELL2_DIHX]; + MATCH_MP_TAC (arith `~(x = &0) /\ (&0 <= x) ==> &0 < x`); + REWRITE_TAC[Upfzbzm_support_lemmas.DIHV_LE_0]; + MATCH_MP_TAC DIHV_EQ_0_PI_EQ_COPLANAR_ALT; + INTRO_TAC Leaf_cell.MCELL2_SUBSET_AFF_GE [`V`;`ul`]; + ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `mcell2 V ul SUBSET affine hull {EL 0 ul, EL 1 ul, mxi V ul, omega_list_n V ul 3}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SUBSET_TRANS; + TYPIFY `aff_ge {HD ul, HD (TL ul)} {mxi V ul, omega_list_n V ul 3}` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `!a b c (d:real^3). {a,b,c,d} = {a,b} UNION {c,d}` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(SET_TAC[]); + BY(REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL;EL;arith `1 = SUC 0`]); + FIRST_X_ASSUM_ST `NULLSET` MP_TAC; + REWRITE_TAC[]; + MATCH_MP_TAC NEGLIGIBLE_SUBSET; + BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE]) + ]);; + (* }}} *) + +let MCELL3_CONVEX_HULL = prove_by_refinement( + `!V ul. packing V /\ + saturated V /\ + ul IN barV V 3 /\ + ~NULLSET (mcell3 V ul) ==> + mcell3 V ul = convex hull {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul}`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Pack_defs.mcell3 [`V`;`ul`]; + COND_CASES_TAC; + DISCH_THEN SUBST1_TAC; + AP_TERM_TAC; + TYPIFY `set_of_list(truncate_simplex 2 ul) = {EL 0 ul,EL 1 ul,EL 2 ul}` (C SUBGOAL_THEN SUBST1_TAC); + MATCH_MP_TAC Bump.SET_OF_LIST_TRUNCATE_2; + BY(ASM_MESON_TAC[IN;Sphere.BARV;arith `3 <= 3 + 1`]); + BY(SET_TAC[]); + BY(ASM_MESON_TAC[NEGLIGIBLE_EMPTY]) + ]);; + (* }}} *) + +let MCELL3_EXTREME_CARD = prove_by_refinement( + `!V ul. packing V /\ + saturated V /\ + ul IN barV V 3 /\ + ~NULLSET (mcell3 V ul) ==> +CARD {EL 0 ul, EL 1 ul, EL 2 ul,mxi V ul} = 4`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC Collect_geom2.NOT_COPLANAR_IMP_CARD4; + GMATCH_SIMP_TAC (GSYM coplanar_eq_coplanar_alt); + REWRITE_TAC[DIMINDEX_3;arith `2 <= 3`]; + ONCE_REWRITE_TAC[GSYM COPLANAR_CONVEX_HULL_COPLANAR]; + TYPIFY `convex hull {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = mcell3 V ul` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE]); + BY(ASM_MESON_TAC[MCELL3_CONVEX_HULL]) + ]);; + (* }}} *) + +let MCELL3_DIHX = prove_by_refinement( +`!V X ul. + saturated V /\ + packing V /\ + barV V 3 ul /\ + X = mcell3 V ul /\ + {EL 0 ul,EL 1 ul} IN edgeX V X /\ + ~NULLSET X + ==> dihX V X (EL 0 ul,EL 1 ul) = + dihV (EL 0 ul) (EL 1 ul) (EL 2 ul) (mxi V ul)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[Pack_defs.dihX;LET_DEF;LET_END_DEF;Bump.BETA_ORDERED_PAIR_THM]; + INTRO_TAC Leaf_cell.MCELL_EDGE_FIRST [`V`;`ul`;`3`;`EL 0 ul`;`EL 1 ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN;Bump.MCELL3]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Tskajxy.INITIAL_SUBLIST_2 [`vl`]; + ANTS_TAC; + REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; + BY(ASM_MESON_TAC[IN]); + DISCH_TAC; + INTRO_TAC Tskajxy.MCELL_PARAM_D_UL [`V`;`vl`;`[EL 0 ul;EL 1 ul]`;`SND (cell_params_d V X [EL 0 ul;EL 1 ul])`;`X`;`3`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN;arith `3 <= 4`;Bump.MCELL3]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Tskajxy.MCELL_CELL_PARAMETERS_D_EXIST [`V`;`vl`;`[EL 0 ul;EL 1 ul]`;`3`;`X`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN;arith `3 <= 4`;Bump.MCELL3]); + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[arith `~(3 = 2)`;Pack_defs.dihu3]; + REPEAT (FIRST_X_ASSUM_ST `SND` MP_TAC); + ASM_REWRITE_TAC[]; + TYPED_ABBREV_TAC `(wl:(real^3)list) = (SND (cell_params_d V (mcell3 V ul) [EL 0 vl; EL 1 vl]))` ; + FIRST_X_ASSUM kill; + REPEAT WEAKER_STRIP_TAC; + COMMENT "match wl with vl"; + TYPIFY `EL 0 wl = EL 0 vl /\ EL 1 wl = EL 1 vl` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC Bump.LENGTH4 [`wl`]; + ANTS_TAC; + REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; + BY(ASM_MESON_TAC[IN]); + DISCH_TAC; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `initial_sublist` MP_TAC; + FIRST_X_ASSUM_ST `CONS` SUBST1_TAC; + REWRITE_TAC[initial_sublist_cons]; + BY(ASM_MESON_TAC[]); + COMMENT "mcell3 as convex hull"; + INTRO_TAC MCELL3_CONVEX_HULL [`V`;`vl`]; + INTRO_TAC MCELL3_CONVEX_HULL [`V`;`wl`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ASM_MESON_TAC[Bump.MCELL3]); + DISCH_TAC; + ANTS_TAC; + BY(ASM_MESON_TAC[Bump.MCELL3]); + DISCH_TAC; + TYPIFY `convex hull {EL 0 vl, EL 1 vl, EL 2 wl, mxi V wl} = convex hull {EL 0 vl, EL 1 vl, EL 2 vl, mxi V vl}` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[Bump.MCELL3]); + GMATCH_SIMP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ; + REWRITE_TAC[AFFINE_INDEPENDENT_IFF_CARD;FINITE_INSERT;FINITE_EMPTY]; + TYPIFY `CARD {EL 0 vl,EL 1 vl,EL 2 vl,mxi V vl} = 4 /\ CARD {EL 0 vl,EL 1 vl,EL 2 wl,mxi V wl} = 4 ` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[MCELL3_EXTREME_CARD;Bump.MCELL3]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `aff_dim {EL 0 vl, EL 1 vl, EL 2 wl, mxi V wl} = &3 /\ aff_dim {EL 0 vl, EL 1 vl, EL 2 vl, mxi V vl} = &3` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + REPEAT (GMATCH_SIMP_TAC NOT_COPLANAR_AFF_3); + ONCE_REWRITE_TAC[GSYM COPLANAR_CONVEX_HULL_COPLANAR]; + BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE;Bump.MCELL3]); + CONJ_TAC; + BY(ASM_MESON_TAC[INT_ARITH `&3 = &4 - int_of_num 1`]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Leaf_cell.LENGTH4_SET2 [`EL 0 vl`;`EL 1 vl`;`EL 2 vl`;`mxi V vl`;`EL 2 wl`;`mxi V wl`]; + ANTS_TAC; + REWRITE_TAC[set_of_list]; + BY(ASM_MESON_TAC[]); + INTRO_TAC MCELL3_CONVEX_HULL [`V`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[Bump.MCELL3;IN]); + DISCH_TAC; + TYPIFY `convex hull {EL 0 vl, EL 1 vl, EL 2 wl, mxi V wl} = convex hull {EL 0 vl, EL 1 vl, EL 2 ul, mxi V ul}` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[Bump.MCELL3]); + GMATCH_SIMP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ; + REWRITE_TAC[AFFINE_INDEPENDENT_IFF_CARD;FINITE_INSERT;FINITE_EMPTY]; + TYPIFY `CARD {EL 0 vl,EL 1 vl,EL 2 ul,mxi V ul} = 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[IN;MCELL3_EXTREME_CARD;Bump.MCELL3]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `aff_dim {EL 0 vl, EL 1 vl, EL 2 wl, mxi V wl} = &3 /\ aff_dim {EL 0 vl, EL 1 vl, EL 2 ul, mxi V ul} = &3` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + REPEAT (GMATCH_SIMP_TAC NOT_COPLANAR_AFF_3); + ONCE_REWRITE_TAC[GSYM COPLANAR_CONVEX_HULL_COPLANAR]; + BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE;Bump.MCELL3]); + CONJ_TAC; + BY(ASM_MESON_TAC[INT_ARITH `&3 = &4 - int_of_num 1`]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Leaf_cell.LENGTH4_SET2 [`EL 0 vl`;`EL 1 vl`;`EL 2 ul`;`mxi V ul`;`EL 2 wl`;`mxi V wl`]; + ANTS_TAC; + REWRITE_TAC[set_of_list]; + BY(ASM_MESON_TAC[]); + STRIP_TAC; + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[]; + BY(MESON_TAC[Trigonometry2.DIHV_SYM]) + ]);; + (* }}} *) + +let MCELL3_DIHX_POS = prove_by_refinement( + `!V X ul. saturated V /\ packing V /\ barV V 3 ul /\ X = mcell3 V ul /\ {EL 0 ul,EL 1 ul} IN edgeX V X ==> + &0 < dihX V X (EL 0 ul,EL 1 ul)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~NULLSET X` (C SUBGOAL_THEN ASSUME_TAC); + DISCH_TAC; + INTRO_TAC Bump.RIJRIED [`V`;`ul`;`3`]; + ANTS_TAC; + BY(ASM_MESON_TAC[Bump.MCELL3]); + REWRITE_TAC[EXTENSION;NOT_IN_EMPTY]; + BY(ASM_MESON_TAC[Bump.MCELL3]); + ASM_SIMP_TAC[MCELL3_DIHX]; + MATCH_MP_TAC (arith `~(x = &0) /\ (&0 <= x) ==> &0 < x`); + REWRITE_TAC[Upfzbzm_support_lemmas.DIHV_LE_0]; + MATCH_MP_TAC DIHV_EQ_0_PI_EQ_COPLANAR_ALT; + ONCE_REWRITE_TAC[GSYM COPLANAR_CONVEX_HULL_COPLANAR]; + GMATCH_SIMP_TAC (GSYM MCELL3_CONVEX_HULL); + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE]) + ]);; + (* }}} *) + +let MCELL3_DOMAIN = prove_by_refinement( + `!V ul. saturated V /\ + packing V /\ + barV V 3 ul /\ + ~(NULLSET (mcell3 V ul)) ==> + ~collinear {EL 0 ul,EL 1 ul,EL 2 ul} /\ + &2 <= dist (EL 1 ul,EL 2 ul) /\ + &2 <= dist (EL 0 ul,EL 2 ul) /\ + &2 <= dist (EL 0 ul,EL 1 ul) /\ + dist (EL 1 ul,EL 2 ul) < &2 * sqrt (&2) /\ + dist (EL 0 ul,EL 2 ul) < &2 * sqrt (&2) /\ + dist (EL 0 ul,EL 1 ul) < &2 * sqrt (&2) /\ + eta_y (dist (EL 0 ul,EL 1 ul)) (dist (EL 0 ul,EL 2 ul)) + (dist (EL 1 ul,EL 2 ul)) < + sqrt (&2)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC (GSYM RADV_ETAY); + TYPIFY `hl (truncate_simplex 2 ul) < sqrt(&2)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `mcell3` MP_TAC; + REWRITE_TAC[Pack_defs.mcell3]; + COND_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + BY(ASM_MESON_TAC[NEGLIGIBLE_EMPTY]); + COMMENT "deal with radV"; + TYPIFY `truncate_simplex 2 ul = [EL 0 ul;EL 1 ul;EL 2 ul]` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Leaf_cell.BARV3_TRUNC2;IN]); + TYPIFY `radV {EL 0 ul, EL 1 ul, EL 2 ul} < sqrt (&2)` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `hl` MP_TAC THEN ASM_REWRITE_TAC[Pack_defs.HL;set_of_list]); + TYPIFY `~collinear {EL 0 ul,EL 1 ul,EL 2 ul}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR; + TYPIFY `mxi V ul` EXISTS_TAC; + ONCE_REWRITE_TAC[GSYM COPLANAR_CONVEX_HULL_COPLANAR]; + GMATCH_SIMP_TAC (GSYM MCELL3_CONVEX_HULL); + BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE;IN]); + ASM_REWRITE_TAC[]; + TYPIFY `~affine_dependent {EL 0 ul,EL 1 ul,EL 2 ul}` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[AFFINE_DEPENDENT_IMP_COLLINEAR_3]); + TYPIFY `!x y. {x,y} SUBSET {EL 0 ul,EL 1 ul,EL 2 ul} ==> dist(x,y) < &2 * sqrt(&2)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `x < &2 * y <=> inv(&2) * x < y`]; + REWRITE_TAC[GSYM RADV2]; + MATCH_MP_TAC REAL_LET_TRANS; + TYPIFY `radV {EL 0 ul, EL 1 ul, EL 2 ul}` EXISTS_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC Rogers.RADV_MONO; + ASM_REWRITE_TAC[EXTENSION;IN_INSERT;NOT_IN_EMPTY]; + BY(MESON_TAC[]); + INTRO_TAC Packing3.BARV_SUBSET [`V`;`3`;`ul`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `set_of_list ul = {EL 0 ul,EL 1 ul,EL 2 ul,EL 3 ul}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Bump.set_of_list4; + REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; + BY(ASM_MESON_TAC[]); + TYPIFY `~(EL 0 ul = EL 1 ul) /\ ~(EL 1 ul = EL 2 ul) /\ ~(EL 0 ul = EL 2 ul)` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `{EL 0 ul,EL 1 ul, EL 2 ul} = {EL 1 ul,EL 2 ul,EL 0 ul}` (C SUBGOAL_THEN ASSUME_TAC); + BY(SET_TAC[]); + BY(ASM_MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]); + TYPIFY `&2 <= dist (EL 1 ul,EL 2 ul) /\ &2 <= dist (EL 0 ul,EL 2 ul) /\ &2 <= dist (EL 0 ul,EL 1 ul)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + FIRST_X_ASSUM_ST `packing` MP_TAC; + REWRITE_TAC[Sphere.packing]; + FIRST_X_ASSUM_ST `SUBSET` MP_TAC; + ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[IN]; + BY(ASM_MESON_TAC[]); + BY(REPEAT (CONJ_TAC THEN (TRY (FIRST_X_ASSUM MATCH_MP_TAC))) THEN SET_TAC[]) + ]);; + (* }}} *) + +let TSKAJXY_3 = Prove_by_refinement.prove_by_refinement( + `!V X ul. pack_nonlinear_non_ox3q1h /\ + saturated V /\ + packing V /\ + barV V 3 ul /\ + X = mcell3 V ul /\ + ~(NULLSET X) + ==> gammaX V X lmfun >= &0`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Tskajxy_lemmas.gammaX_gamma3f [`V`;`X`;`ul`;`EL 0 ul`;`EL 1 ul`;`EL 2 ul`;`EL 3 ul`;`dist(EL 1 ul,EL 2 ul)`;`dist(EL 0 ul,EL 2 ul)`;`dist(EL 0 ul,EL 1 ul)`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(REWRITE_TAC[Bump.MCELL3]); + MATCH_MP_TAC Bump.LENGTH4; + REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; + BY(ASM_MESON_TAC[]); + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC Merge_ineq.cell3_from_ineq_thm_ALT []; + ASM_REWRITE_TAC[arith `x >= &0 <=> &0 <= x`]; + DISCH_THEN MATCH_MP_TAC; + TYPIFY `eta_y (dist (EL 1 ul,EL 2 ul)) (dist (EL 0 ul,EL 2 ul)) (dist (EL 0 ul,EL 1 ul)) = eta_y (dist (EL 0 ul,EL 1 ul)) (dist (EL 0 ul,EL 2 ul)) (dist (EL 1 ul,EL 2 ul))` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[Collect_geom.ETA_Y_SYYM]); + INTRO_TAC MCELL3_DOMAIN [`V`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) + ]);; + (* }}} *) + +let MCELL4_LEAF2 = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ barV V 3 ul /\ ~NULLSET (mcell4 V ul) ==> + leaf V [EL 0 ul;EL 1 ul;EL 2 ul]`, + (* {{{ proof *) + [ + REWRITE_TAC[Leaf_cell.leaf;Pack_defs.mcell4]; + REPEAT GEN_TAC; + COND_CASES_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Packing3.TRUNCATE_SIMPLEX_BARV [`V`;`2`;`3`;`ul`]; + INTRO_TAC Rogers.HL_DECREASE [`V`;`ul`;`3`;`2`]; + ASM_REWRITE_TAC[arith `2 <= 3`;IN]; + INTRO_TAC Leaf_cell.BARV3_TRUNC2 [`V`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + DISCH_THEN SUBST1_TAC; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[arith `h < s /\ h' <= h ==> h' < s`;Sphere.sqrt2]); + BY(MESON_TAC[NEGLIGIBLE_EMPTY]) + ]);; + (* }}} *) + +let MCELL4_CONVEX_HULL = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ barV V 3 ul /\ ~NULLSET (mcell4 V ul) ==> + mcell4 V ul = convex hull {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul}`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.mcell4]; + REPEAT GEN_TAC; + COND_CASES_TAC; + BY(MESON_TAC[BARV3_SET_OF_LIST4]); + BY(REWRITE_TAC[NEGLIGIBLE_EMPTY]) + ]);; + (* }}} *) + +let MCELL4_CARD4 = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ barV V 3 ul /\ ~NULLSET (mcell4 V ul) ==> + CARD ({EL 0 ul,EL 1 ul, EL 2 ul, EL 3 ul}) = 4`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Collect_geom2.NOT_COPLANAR_IMP_CARD4; + GMATCH_SIMP_TAC (GSYM coplanar_eq_coplanar_alt); + REWRITE_TAC[DIMINDEX_3;arith `2 <= 3`]; + ONCE_REWRITE_TAC[GSYM COPLANAR_CONVEX_HULL_COPLANAR]; + TYPIFY `convex hull {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = mcell4 V ul` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE]); + BY(ASM_MESON_TAC[MCELL4_CONVEX_HULL]) + ]);; + (* }}} *) + +let MCELL4_LEAF3 = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ barV V 3 ul /\ ~NULLSET (mcell4 V ul) ==> + leaf V [EL 0 ul;EL 1 ul;EL 3 ul]`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Marchal_cells_3.LEFT_ACTION_LIST_3_EXISTS [`EL 0 ul`;`EL 1 ul`;`EL 2 ul`;`EL 3 ul`;`EL 0 ul`;`EL 1 ul`;`EL 3 ul`;`EL 2 ul`]; + ANTS_TAC; + CONJ_TAC; + MATCH_MP_TAC MCELL4_CARD4; + BY(ASM_MESON_TAC[]); + BY(SET_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Rvfxzbu.RVFXZBU [`V`;`ul`;`4`;`p`]; + ASM_REWRITE_TAC[arith `4 - 1 = 3`]; + ANTS_TAC; + BY(SET_TAC[]); + INTRO_TAC Rogers.YIFVQDV_1 [`V`;`ul`;`3`;`p`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `NULLSET` MP_TAC; + BY(ASM_REWRITE_TAC[Pack_defs.mcell4;NEGLIGIBLE_EMPTY]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Bump.LENGTH4 [`ul`]; + ANTS_TAC; + REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `left_action_list p (CONS x y)` MP_TAC; + FIRST_X_ASSUM (SUBST1_TAC o GSYM); + TYPED_ABBREV_TAC `(wl:(real^3) list) = left_action_list p ul` ; + FIRST_X_ASSUM kill; + DISCH_TAC; + INTRO_TAC MCELL4_LEAF2 [`V`;`wl`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[IN;Bump.MCELL4]); + EXPAND_TAC "wl"; + BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]) + ]);; + (* }}} *) + +let MCELL4_LEAF_S_LEAF = prove_by_refinement( + `!V ul u. packing V /\ saturated V /\ barV V 3 ul /\ ~NULLSET (mcell4 V ul) /\ + leaf V [EL 0 ul;EL 1 ul;u] /\ (u IN {EL 2 ul, EL 3 ul} ) ==> s_leaf V [EL 0 ul;EL 1 ul] u`, + (* {{{ proof *) + [ + REWRITE_TAC[s_leaf;Bump.EL_EXPLICIT;IN_INSERT;NOT_IN_EMPTY]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC Leaf_cell.CFFONNL [`V`;`[EL 0 ul;EL 1 ul;u]`;`mcell4 V ul`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + REWRITE_TAC[TAUT `(a /\ b /\ c /\ ~d ==> e) <=> (a /\ b /\ c ==> (d \/ e))`]; + ANTS_TAC; + CONJ_TAC; + REWRITE_TAC[IN_ELIM_THM;Pack_defs.mcell_set]; + BY(ASM_MESON_TAC[IN;Bump.MCELL4]); + CONJ_TAC; + GMATCH_SIMP_TAC Bump.MCELL4_EDGE; + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC Marchal_cells_2_new.CARD4_IMP_DISTINCT; + BY(ASM_MESON_TAC[MCELL4_CARD4]); + GMATCH_SIMP_TAC BARV3_SET_OF_LIST4; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + BY(SET_TAC[]); + REWRITE_TAC[EXTENSION;NOT_IN_EMPTY;IN_INTER;Leaf_cell.cc_A0;NOT_FORALL_THM;Bump.EL_EXPLICIT]; + TYPIFY `u` EXISTS_TAC; + CONJ_TAC; + GMATCH_SIMP_TAC MCELL4_CONVEX_HULL; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC Marchal_cells_2_new.IN_SET_IMP_IN_CONVEX_HULL_SET; + BY(ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]); + MATCH_MP_TAC Local_lemmas.DISJOINT_IMP_Z_IN_AFF_GT; + REWRITE_TAC[DISJOINT;EXTENSION;IN_SING;NOT_IN_EMPTY;IN_INTER;IN_INSERT]; + INTRO_TAC MCELL4_CARD4 [`V`;`ul`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (MP_TAC o (MATCH_MP Leaf_cell.CARD4_ALL_DISTINCT)); + BY(ASM_MESON_TAC[]); + REWRITE_TAC[Bump.MCELL4;Leaf_cell.cc_cell]; + STRIP_TAC; + INTRO_TAC Ajripqn.AJRIPQN [`V`;`ul`;`cc_uh V [EL 0 ul;EL 1 ul;u]`;`4`;`cc_ke V [EL 0 ul; EL 1 ul; u]`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); + CONJ_TAC; + BY(SET_TAC[]); + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + CONJ_TAC; + BY(MESON_TAC[Leaf_cell.CC_KE_34]); + REWRITE_TAC[INTER_IDEMPOT]; + BY(ASM_MESON_TAC[Bump.MCELL4]); + BY(DISCH_THEN (unlist REWRITE_TAC)); + COMMENT "second case"; + INTRO_TAC Ajripqn.AJRIPQN [`V`;`ul`;`cc_uh V [EL 1 ul;EL 0 ul;u]`;`4`;`cc_ke V [EL 1 ul; EL 0 ul; u]`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + ONCE_REWRITE_TAC[GSYM IN]; + GMATCH_SIMP_TAC Leaf_cell.cc_uh; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[Leaf_cell.ZASUVOR]); + CONJ_TAC; + BY(SET_TAC[]); + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + CONJ_TAC; + BY(MESON_TAC[Leaf_cell.CC_KE_34]); + REWRITE_TAC[INTER_IDEMPOT]; + BY(ASM_MESON_TAC[Bump.MCELL4]); + BY(DISCH_THEN (unlist REWRITE_TAC)) + ]);; + (* }}} *) + +let S_LEAF_CARD2 = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ barV V 3 ul /\ ~NULLSET (mcell4 V ul) ==> + 2 <= CARD(s_leaf V [EL 0 ul;EL 1 ul])`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `2 = CARD {EL 2 ul, EL 3 ul}` ((C SUBGOAL_THEN SUBST1_TAC) ); + MATCH_MP_TAC EQ_SYM; + MATCH_MP_TAC Hypermap.CARD_TWO_ELEMENTS; + INTRO_TAC MCELL4_CARD4 [`V`;`ul`]; + ASM_REWRITE_TAC[]; + TYPIFY `{EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = {EL 2 ul, EL 3 ul, EL 0 ul, EL 1 ul}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(MESON_TAC[Marchal_cells_2_new.CARD4_IMP_DISTINCT]); + MATCH_MP_TAC CARD_SUBSET; + ASM_SIMP_TAC[S_LEAF_FINITE]; + REWRITE_TAC[SUBSET]; + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[IN]; + INTRO_TAC MCELL4_LEAF_S_LEAF [`V`;`ul`;`x`]; + DISCH_THEN MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(ASM_MESON_TAC[MCELL4_LEAF2;MCELL4_LEAF3]) + ]);; + (* }}} *) + +let LEAF_RANK_ONTO = prove_by_refinement( + `!V ul w0 n f u. + packing V /\ saturated V /\ barV V 3 ul /\ + leaf_rank V [EL 0 ul;EL 1 ul] w0 n f /\ ~(n=0) /\ ~NULLSET(mcell4 V ul) /\ + (u IN {EL 2 ul,EL 3 ul}) ==> + (?i. i < n /\ (u = f i))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC LEAF_RANK_PERIODIC [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank;IMAGE;IN_UNIV;EXTENSION;IN_ELIM_THM;Bump.EL_EXPLICIT]; + INTRO_TAC MCELL4_LEAF_S_LEAF [`V`;`ul`;`u`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `IN` MP_TAC; + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(ASM_MESON_TAC[MCELL4_LEAF2;MCELL4_LEAF3]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?j. u = f j` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[IN]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `j MOD n` EXISTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[DIVISION]); + BY(ASM_MESON_TAC[Oxl_def.periodic_mod]) + ]);; + (* }}} *) + +let S_LEAF_IN_WEDGE_GE = prove_by_refinement( + `!V ul u w0 n f j i'. + packing V /\ saturated V /\ leaf_rank V [EL 0 ul;EL 1 ul] w0 n f /\ leaf V [EL 0 ul;EL 1 ul;u] /\ + ~collinear {EL 0 ul,EL 1 ul,w0} /\ + (1 (u = f j \/ u = f (SUC j))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?i. (i < n) /\ f j = f i /\ f (SUC j) = f (SUC i)` (C SUBGOAL_THEN MP_TAC); + TYPIFY `~(n = 0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); + TYPIFY `j MOD n` EXISTS_TAC; + BY(ASM_SIMP_TAC[F_DEMOD;DIVISION]); + DISCH_THEN (fun t -> REPEAT (FIRST_X_ASSUM MP_TAC) THEN MP_TAC t); + STRIP_TAC; + ASM_REWRITE_TAC[]; + REPLICATE_TAC 2 (FIRST_X_ASSUM kill); + REPEAT WEAKER_STRIP_TAC; + COMMENT "restart"; + MATCH_MP_TAC (TAUT ` (~a /\ ~b ==> F) ==> a \/ b`); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC LEAF_RANK_COLLINEAR [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_TAC; + COMMENT "deal with i=n-1"; + TYPIFY `i = n - 1` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `wedge_ge` MP_TAC; + REWRITE_TAC[]; + GMATCH_SIMP_TAC (GSYM Leaf_cell.WEDGE_COMPLEMENT); + REWRITE_TAC[IN_DIFF;IN_UNIV]; + CONJ_TAC; + ONCE_REWRITE_TAC[arith `(x:real) = y <=> y = x`]; + DISCH_TAC; + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`0`;`i`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + DISCH_TAC; + INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`w0`;`f 0`;`f i`]; + ANTS_TAC; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + FIRST_X_ASSUM_ST `SUC` MP_TAC; + ASM_SIMP_TAC[arith `1 < n ==> SUC (n - 1) = n`]; + TYPIFY `f n = f 0` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[arith `0 + n = n`]); + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + ASM_SIMP_TAC[arith `1 < n ==> SUC (n - 1) = n`]; + TYPIFY `f n = f 0` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[arith `0 + n = n`;leaf_rank]); + REWRITE_TAC[Reuhady.WEDGE_SIMPLE;IN_ELIM_THM]; + TYPIFY `i' = 0 \/ (0 < i' /\ i' < (n-1)) \/ (i' = (n-1))` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + FIRST_X_ASSUM DISJ_CASES_TAC; + FIRST_X_ASSUM_ST `SUC` MP_TAC; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[arith `1 < n ==> SUC (n - 1) = n`]; + TYPIFY `f n = f 0` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[arith `0 + n = n`;leaf_rank]); + BY(REWRITE_TAC[]); + FIRST_X_ASSUM DISJ_CASES_TAC; + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]; + REPEAT WEAKER_STRIP_TAC; + FIRST_ASSUM (C INTRO_TAC [`0`;`i'`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`i'`;`n-1`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f 0`;`f 0`;`f i'`]; + ANTS_TAC; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`;arith `x <= x`]); + INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f 0`;`f i'`;`f (n-1)`]; + ANTS_TAC; + ASM_SIMP_TAC [arith `x < y ==> x <= y`]; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REWRITE_TAC[AZIM_REFL]; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(ASM_MESON_TAC[]); + COMMENT "done with i = n-1"; + COMMENT "deal with wedge_ge"; + FIRST_X_ASSUM_ST `wedge_ge` MP_TAC; + REWRITE_TAC[Local_lemmas.WEDGE_GE_AZIM_LE]; + DISCH_TAC; + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]; + REPEAT WEAKER_STRIP_TAC; + MP_TAC (arith `i' = i \/ i' = SUC i \/ SUC i < i' \/ i' < i `); + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM DISJ_CASES_TAC; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM DISJ_CASES_TAC; + INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f i`;`f (SUC i)`;`f i'`]; + ANTS_TAC; + ASM_SIMP_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`i`;`SUC i`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`i`;`i'`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`SUC i`;`i'`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + FIRST_X_ASSUM_ST `azim` MP_TAC; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + COMMENT "last wedge case"; + INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`f i`;`f i'`;`f (SUC i)`]; + ANTS_TAC; + ASM_SIMP_TAC[]; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`f i'`;`f i`;`f (SUC i)`]; + ANTS_TAC; + ASM_SIMP_TAC[]; + INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f i'`;`f i`;`f (SUC i)`]; + ANTS_TAC; + ASM_SIMP_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`i'`;`i`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`i'`;`SUC i`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`i`;`SUC i`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(REAL_ARITH_TAC); + DISCH_TAC; + TYPIFY `azim (EL 0 ul) (EL 1 ul) (f i) (f i') = -- azim (EL 0 ul) (EL 1 ul) (f i') (f i)` (C SUBGOAL_THEN MP_TAC); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `x = -- y <=> y + x = &0`]; + GMATCH_SIMP_TAC Leaf_cell.AZIM_POS_IMP_SUM_2PI_ALT; + CONJ2_TAC; + MATCH_MP_TAC (arith `&0 < x ==> ~(x = &0)`); + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REWRITE_TAC[PI_POS]; + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`i'`;`i`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + DISCH_TAC; + INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`w0`;`f i'`;`f i`]; + ANTS_TAC; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* +let S_LEAF_IN_WEDGE_GE = prove_by_refinement( + `!V ul u w0 n f i i'. + packing V /\ saturated V /\ leaf_rank V [EL 0 ul;EL 1 ul] w0 n f /\ leaf V [EL 0 ul;EL 1 ul;u] /\ + ~collinear {EL 0 ul,EL 1 ul,w0} /\ + (1 (u = f i \/ u = f (SUC i))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (TAUT ` (~a /\ ~b ==> F) ==> a \/ b`); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC LEAF_RANK_COLLINEAR [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_TAC; + COMMENT "deal with i=n-1"; + TYPIFY `i = n - 1` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `wedge_ge` MP_TAC; + REWRITE_TAC[]; + GMATCH_SIMP_TAC (GSYM Leaf_cell.WEDGE_COMPLEMENT); + REWRITE_TAC[IN_DIFF;IN_UNIV]; + CONJ_TAC; + ONCE_REWRITE_TAC[arith `(x:real) = y <=> y = x`]; + DISCH_TAC; + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`0`;`i`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + DISCH_TAC; + INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`w0`;`f 0`;`f i`]; + ANTS_TAC; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + FIRST_X_ASSUM_ST `SUC` MP_TAC; + ASM_SIMP_TAC[arith `1 < n ==> SUC (n - 1) = n`]; + TYPIFY `f n = f 0` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[arith `0 + n = n`]); + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + ASM_SIMP_TAC[arith `1 < n ==> SUC (n - 1) = n`]; + TYPIFY `f n = f 0` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[arith `0 + n = n`;leaf_rank]); + REWRITE_TAC[Reuhady.WEDGE_SIMPLE;IN_ELIM_THM]; + TYPIFY `i' = 0 \/ (0 < i' /\ i' < (n-1)) \/ (i' = (n-1))` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + FIRST_X_ASSUM DISJ_CASES_TAC; + FIRST_X_ASSUM_ST `SUC` MP_TAC; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[arith `1 < n ==> SUC (n - 1) = n`]; + TYPIFY `f n = f 0` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[arith `0 + n = n`;leaf_rank]); + BY(REWRITE_TAC[]); + FIRST_X_ASSUM DISJ_CASES_TAC; + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]; + REPEAT WEAKER_STRIP_TAC; + FIRST_ASSUM (C INTRO_TAC [`0`;`i'`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`i'`;`n-1`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f 0`;`f 0`;`f i'`]; + ANTS_TAC; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`;arith `x <= x`]); + INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f 0`;`f i'`;`f (n-1)`]; + ANTS_TAC; + ASM_SIMP_TAC [arith `x < y ==> x <= y`]; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REWRITE_TAC[AZIM_REFL]; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(ASM_MESON_TAC[]); + COMMENT "done with i = n-1"; + COMMENT "deal with wedge_ge"; + FIRST_X_ASSUM_ST `wedge_ge` MP_TAC; + REWRITE_TAC[Local_lemmas.WEDGE_GE_AZIM_LE]; + DISCH_TAC; + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]; + REPEAT WEAKER_STRIP_TAC; + MP_TAC (arith `i' = i \/ i' = SUC i \/ SUC i < i' \/ i' < i `); + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM DISJ_CASES_TAC; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM DISJ_CASES_TAC; + INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f i`;`f (SUC i)`;`f i'`]; + ANTS_TAC; + ASM_SIMP_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`i`;`SUC i`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`i`;`i'`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`SUC i`;`i'`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + FIRST_X_ASSUM_ST `azim` MP_TAC; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + COMMENT "last wedge case"; + INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`f i`;`f i'`;`f (SUC i)`]; + ANTS_TAC; + ASM_SIMP_TAC[]; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`f i'`;`f i`;`f (SUC i)`]; + ANTS_TAC; + ASM_SIMP_TAC[]; + INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f i'`;`f i`;`f (SUC i)`]; + ANTS_TAC; + ASM_SIMP_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`i'`;`i`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`i'`;`SUC i`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`i`;`SUC i`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(REAL_ARITH_TAC); + DISCH_TAC; + TYPIFY `azim (EL 0 ul) (EL 1 ul) (f i) (f i') = -- azim (EL 0 ul) (EL 1 ul) (f i') (f i)` (C SUBGOAL_THEN MP_TAC); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `x = -- y <=> y + x = &0`]; + GMATCH_SIMP_TAC Leaf_cell.AZIM_POS_IMP_SUM_2PI_ALT; + CONJ2_TAC; + MATCH_MP_TAC (arith `&0 < x ==> ~(x = &0)`); + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REWRITE_TAC[PI_POS]; + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`i'`;`i`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + DISCH_TAC; + INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`w0`;`f i'`;`f i`]; + ANTS_TAC; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) +*) + +let LEAF_IN_WEDGE_GE = prove_by_refinement( + `!V ul u w0 n f i. + packing V /\ saturated V /\ leaf_rank V [EL 0 ul;EL 1 ul] w0 n f /\ leaf V [EL 0 ul;EL 1 ul;u] /\ + barV V 3 ul /\ + ~collinear {EL 0 ul,EL 1 ul,w0} /\ + (1 (u = f i \/ u = f (SUC i))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC LEAF_RANK_ONTO [`V`;`ul`;`w0`;`n`;`f`;`u`]; + ANTS_TAC; + BY(ASM_SIMP_TAC[arith `1 < n==> ~(n=0)`]); + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC S_LEAF_IN_WEDGE_GE; + GEXISTL_TAC [`V`;`ul`;`w0`;`n`;`i'`]; + BY(ASM_REWRITE_TAC[]) +(* + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (TAUT ` (~a /\ ~b ==> F) ==> a \/ b`); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC LEAF_RANK_COLLINEAR [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_TAC; + INTRO_TAC LEAF_RANK_ONTO [`V`;`ul`;`w0`;`n`;`f`;`u`]; + ANTS_TAC; + BY(ASM_SIMP_TAC[arith `1 < n==> ~(n=0)`]); + STRIP_TAC; + COMMENT "deal with i=n-1"; + TYPIFY `i = n - 1` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `wedge_ge` MP_TAC; + REWRITE_TAC[]; + GMATCH_SIMP_TAC (GSYM Leaf_cell.WEDGE_COMPLEMENT); + REWRITE_TAC[IN_DIFF;IN_UNIV]; + CONJ_TAC; + ONCE_REWRITE_TAC[arith `(x:real) = y <=> y = x`]; + DISCH_TAC; + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`0`;`i`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + DISCH_TAC; + INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`w0`;`f 0`;`f i`]; + ANTS_TAC; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + FIRST_X_ASSUM_ST `SUC` MP_TAC; + ASM_SIMP_TAC[arith `1 < n ==> SUC (n - 1) = n`]; + TYPIFY `f n = f 0` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[arith `0 + n = n`]); + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + ASM_SIMP_TAC[arith `1 < n ==> SUC (n - 1) = n`]; + TYPIFY `f n = f 0` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[arith `0 + n = n`;leaf_rank]); + REWRITE_TAC[Reuhady.WEDGE_SIMPLE;IN_ELIM_THM]; + TYPIFY `i' = 0 \/ (0 < i' /\ i' < (n-1)) \/ (i' = (n-1))` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + FIRST_X_ASSUM DISJ_CASES_TAC; + FIRST_X_ASSUM_ST `SUC` MP_TAC; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[arith `1 < n ==> SUC (n - 1) = n`]; + TYPIFY `f n = f 0` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[arith `0 + n = n`;leaf_rank]); + BY(REWRITE_TAC[]); + FIRST_X_ASSUM DISJ_CASES_TAC; + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]; + REPEAT WEAKER_STRIP_TAC; + FIRST_ASSUM (C INTRO_TAC [`0`;`i'`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`i'`;`n-1`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f 0`;`f 0`;`f i'`]; + ANTS_TAC; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`;arith `x <= x`]); + INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f 0`;`f i'`;`f (n-1)`]; + ANTS_TAC; + ASM_SIMP_TAC [arith `x < y ==> x <= y`]; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REWRITE_TAC[AZIM_REFL]; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(ASM_MESON_TAC[]); + COMMENT "done with i = n-1"; + COMMENT "deal with wedge_ge"; + FIRST_X_ASSUM_ST `wedge_ge` MP_TAC; + REWRITE_TAC[Local_lemmas.WEDGE_GE_AZIM_LE]; + DISCH_TAC; + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]; + REPEAT WEAKER_STRIP_TAC; + MP_TAC (arith `i' = i \/ i' = SUC i \/ SUC i < i' \/ i' < i `); + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM DISJ_CASES_TAC; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM DISJ_CASES_TAC; + INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f i`;`f (SUC i)`;`f i'`]; + ANTS_TAC; + ASM_SIMP_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`i`;`SUC i`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`i`;`i'`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`SUC i`;`i'`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + FIRST_X_ASSUM_ST `azim` MP_TAC; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + COMMENT "last wedge case"; + INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`f i`;`f i'`;`f (SUC i)`]; + ANTS_TAC; + ASM_SIMP_TAC[]; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`f i'`;`f i`;`f (SUC i)`]; + ANTS_TAC; + ASM_SIMP_TAC[]; + INTRO_TAC Leaf_cell.AZIM_BASE_SHIFT_LE [`EL 0 ul`;`EL 1 ul`;`w0`;`f i'`;`f i`;`f (SUC i)`]; + ANTS_TAC; + ASM_SIMP_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`i'`;`i`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`i'`;`SUC i`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`i`;`SUC i`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(REAL_ARITH_TAC); + DISCH_TAC; + TYPIFY `azim (EL 0 ul) (EL 1 ul) (f i) (f i') = -- azim (EL 0 ul) (EL 1 ul) (f i') (f i)` (C SUBGOAL_THEN MP_TAC); + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `x = -- y <=> y + x = &0`]; + GMATCH_SIMP_TAC Leaf_cell.AZIM_POS_IMP_SUM_2PI_ALT; + CONJ2_TAC; + MATCH_MP_TAC (arith `&0 < x ==> ~(x = &0)`); + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REWRITE_TAC[PI_POS]; + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM (C INTRO_TAC [`i'`;`i`]); + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + DISCH_TAC; + INTRO_TAC Fan.sum4_azim_fan [`EL 0 ul`;`EL 1 ul`;`w0`;`f i'`;`f i`]; + ANTS_TAC; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC) +*) + ]);; + (* }}} *) + +let MCELL4_FI_EL = prove_by_refinement( +`!V ul w0 n f i. + packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + barV V 3 ul /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + 1 < n /\ + ~NULLSET (mcell4 V ul) /\ + mcell4 V ul SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) ==> + {EL 2 ul, EL 3 ul} = {f i, f (SUC i)}`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MCELL4_CONVEX_HULL [`V`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + TYPIFY `!(a:real^3) b c d. ~(a = b) /\ {a,b} SUBSET {c,d} ==> {a,b} = {c,d}` (C SUBGOAL_THEN MATCH_MP_TAC); + BY(SET_TAC[]); + SUBCONJ_TAC; + INTRO_TAC MCELL4_CARD4 [`V`;`ul`]; + ASM_REWRITE_TAC[]; + BY(MESON_TAC[Leaf_cell.CARD4_ALL_DISTINCT]); + DISCH_TAC; + REWRITE_TAC[SUBSET]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + INTRO_TAC LEAF_IN_WEDGE_GE [`V`;`ul`;`x`;`w0`;`n`;`f`;`i`]; + DISCH_THEN MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(ASM_MESON_TAC[MCELL4_LEAF2;MCELL4_LEAF3]); + FIRST_X_ASSUM_ST `SUBSET` MP_TAC; + REWRITE_TAC[SUBSET]; + DISCH_THEN MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC Marchal_cells_2_new.IN_SET_IMP_IN_CONVEX_HULL_SET; + FIRST_X_ASSUM MP_TAC; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let MCELL4_FI = prove_by_refinement( + `!V ul w0 n f i. + packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + barV V 3 ul /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + 1 < n /\ + ~NULLSET (mcell4 V ul) /\ + (mcell4 V ul) SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) ==> + mcell4 V ul = convex hull {EL 0 ul,EL 1 ul, f i, f(SUC i)} `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MCELL4_CONVEX_HULL [`V`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + ASM_REWRITE_TAC[]; + AP_TERM_TAC; + TYPIFY `{EL 2 ul,EL 3 ul} = {f i, f (SUC i)}` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + MATCH_MP_TAC MCELL4_FI_EL; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let MCELL4_BARV_FI = prove_by_refinement( + `!V ul w0 n f i. + packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + barV V 3 ul /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + 1 < n /\ + ~NULLSET (mcell4 V ul) /\ + (mcell4 V ul) SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) ==> + barV V 3 [EL 0 ul;EL 1 ul; f i; f (SUC i)] /\ + mcell4 V ul = mcell4 V [EL 0 ul;EL 1 ul; f i; f (SUC i)]`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Marchal_cells_3.LEFT_ACTION_LIST_3_EXISTS [`EL 0 ul`;`EL 1 ul`;`EL 2 ul`;`EL 3 ul`;`EL 0 ul`;`EL 1 ul`;`f i`;`f (SUC i)`]; + ANTS_TAC; + CONJ_TAC; + MATCH_MP_TAC MCELL4_CARD4; + BY(ASM_MESON_TAC[]); + INTRO_TAC MCELL4_FI_EL [`V`;`ul`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + BY(SET_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Rogers.YIFVQDV_1 [`V`;`ul`;`3`;`p`]; + ASM_REWRITE_TAC[]; + INTRO_TAC Rvfxzbu.RVFXZBU [`V`;`ul`;`4`;`p`]; + ASM_REWRITE_TAC[arith `4 - 1 = 3`;IN_INSERT]; + FIRST_X_ASSUM MP_TAC; + TYPIFY `[EL 0 ul; EL 1 ul; EL 2 ul; EL 3 ul] = ul` (C SUBGOAL_THEN SUBST1_TAC); + MATCH_MP_TAC EQ_SYM; + MATCH_MP_TAC Bump.LENGTH4; + REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; + BY(ASM_MESON_TAC[]); + DISCH_THEN (SUBST1_TAC o GSYM); + REWRITE_TAC[Bump.MCELL4]; + DISCH_THEN SUBST1_TAC; + ASM_REWRITE_TAC[IN]; + DISCH_THEN MATCH_MP_TAC; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `NULLSET` MP_TAC; + REWRITE_TAC[]; + REWRITE_TAC[Pack_defs.mcell4]; + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[NEGLIGIBLE_EMPTY]) + ]);; + (* }}} *) + +let MCELL4_AZIM_LT_PI = prove_by_refinement( +`!V ul w0 n f i. + packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + barV V 3 ul /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + 1 < n /\ + ~NULLSET (mcell4 V ul) /\ + (mcell4 V ul) SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) ==> + azim (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) < pi`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MCELL4_FI [`V`;`ul`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC LEAF_RANK_COLLINEAR [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_TAC; + INTRO_TAC Marchal_cells_2_new.CONVEX_HULL_4_SUBSET_AFF_GE_2_2 [`EL 0 ul`;`EL 1 ul`;`f i`;`f(SUC i)`]; + DISCH_TAC; + MATCH_MP_TAC (arith `~(x = pi) /\ ~(pi < x) ==> x < pi`); + CONJ_TAC; + DISCH_TAC; + TYPIFY `coplanar {EL 0 ul,EL 1 ul,f i, f (SUC i)}` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC AZIM_EQ_0_PI_IMP_COPLANAR; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[]; + ONCE_REWRITE_TAC[GSYM COPLANAR_CONVEX_HULL_COPLANAR]; + BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE]); + DISCH_TAC; + INTRO_TAC Leaf_cell.AZIM_POS_IMP_SUM_2PI_ALT [`EL 0 ul`;`EL 1 ul`;`f i`;`f (SUC i)`]; + ANTS_TAC; + FIRST_X_ASSUM MP_TAC; + MP_TAC PI_POS; + BY(REAL_ARITH_TAC); + DISCH_TAC; + TYPIFY `azim (EL 0 ul) (EL 1 ul) (f (SUC i)) (f i) < pi` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `aff_ge` MP_TAC; + TYPIFY `{f i,f (SUC i)} = {f (SUC i),f i}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + REWRITE_TAC[]; + GMATCH_SIMP_TAC (GSYM Local_lemmas.WEDGE_GE_EQ_AFF_GE); + ASM_SIMP_TAC[]; + DISCH_TAC; + INTRO_TAC Leaf_cell.WEDGE_GE_ALMOST_DISJOINT [`EL 0 ul`;`EL 1 ul`;`f i`;`f (SUC i)`]; + ASM_SIMP_TAC[]; + REWRITE_TAC[SUBSET;IN_INTER;IN_UNION]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `mcell4 V ul SUBSET aff_ge {EL 0 ul, EL 1 ul} {f i} UNION aff_ge {EL 0 ul, EL 1 ul } {f (SUC i)}` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[SUBSET;IN_UNION]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM_ST `convex` MP_TAC; + TYPIFY `{EL 0 ul, EL 1 ul, f (SUC i), f i} = {EL 0 ul, EL 1 ul, f (i), f (SUC i)}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(ASM_MESON_TAC[SUBSET]); + FIRST_X_ASSUM_ST `NULLSET` MP_TAC; + REWRITE_TAC[]; + MATCH_MP_TAC NEGLIGIBLE_SUBSET; + TYPIFY `aff_ge {EL 0 ul, EL 1 ul} {f i} UNION aff_ge {EL 0 ul, EL 1 ul} {f (SUC i)}` EXISTS_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC NEGLIGIBLE_UNION; + BY(REWRITE_TAC[NULLSET_AFF_2_1]) + ]);; + (* }}} *) + +let MCELL4_DIHX_AZIM = prove_by_refinement( + `!V ul w0 n f i. + packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + barV V 3 ul /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + 1 < n /\ + ~NULLSET (mcell4 V ul) /\ + mcell4 V ul SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) ==> + dihX V (mcell4 V ul) (EL 0 ul, EL 1 ul) = azim (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC LEAF_RANK_COLLINEAR [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_TAC; + INTRO_TAC MCELL4_AZIM_LT_PI [`V`;`ul`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + GMATCH_SIMP_TAC Local_lemmas.AZIM_LE_PI_EQ_DIHV; + CONJ_TAC; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + INTRO_TAC Merge_ineq.DIHV_EQ_DIH_Y [`EL 0 ul`;`EL 1 ul`;`f i`;`f (SUC i)`]; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN SUBST1_TAC; + INTRO_TAC Tskajxy_lemmas.DIHX_DIH_Y_lemma [`V`;`mcell4 V ul`;`[EL 0 ul;EL 1 ul;f i;f (SUC i)]`;`EL 0 ul`;`EL 1 ul`;`f i`;`f (SUC i)`;`4`;`dist(EL 0 ul,EL 1 ul)`;`dist(EL 0 ul,f i)`;`dist(EL 0 ul, f (SUC i))`;`dist(f i, f (SUC i))`;`dist(EL 1 ul,f (SUC i))`;`dist(EL 1 ul,f i)`]; + ANTS_TAC; + ASM_REWRITE_TAC[arith `4 >= 4`]; + INTRO_TAC MCELL4_FI [`V`;`ul`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + INTRO_TAC MCELL4_CONVEX_HULL [`V`;`ul`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + REWRITE_TAC[GSYM Bump.MCELL4]; + MATCH_MP_TAC MCELL4_BARV_FI; + BY(ASM_MESON_TAC[]); + BY(DISCH_THEN (unlist REWRITE_TAC)) + ]);; + (* }}} *) + +let LEAF_RANK_HAS_SIZE = prove_by_refinement( + `!V ul w0 n f. ~(n=0) /\ packing V /\ saturated V /\ leaf_rank V ul w0 n f /\ + ~collinear {EL 0 ul, EL 1 ul, w0} + ==> + s_leaf V ul HAS_SIZE n`, + (* {{{ proof *) + [ + REWRITE_TAC[HAS_SIZE]; + REPEAT WEAKER_STRIP_TAC; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[S_LEAF_FINITE]); + DISCH_TAC; + INTRO_TAC LEAF_RANK_PERIODIC [`V`;`ul`;`w0`;`n`;`f`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`ul`;`w0`;`n`;`f`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank]; + GMATCH_SIMP_TAC (GSYM PERIODIC_IMAGE); + TYPIFY `n` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC EQ_SYM; + TYPIFY `n = CARD {i | i < n }` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[CARD_NUMSEG_LT]); + MATCH_MP_TAC Misc_defs_and_lemmas.BIJ_CARD; + TYPIFY `f` EXISTS_TAC; + REWRITE_TAC[FINITE_NUMSEG_LT]; + REWRITE_TAC[BIJ;INJ]; + SUBCONJ_TAC; + CONJ_TAC; + FIRST_X_ASSUM_ST `IMAGE` MP_TAC; + REWRITE_TAC[EXTENSION;IN_IMAGE]; + BY(MESON_TAC[]); + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC (GSYM MOD_LT); + TYPIFY `n` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `y = y MOD n` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[MOD_LT]); + TYPIFY `azim (EL 0 ul) (EL 1 ul) (f x) (f y) = &0` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM SUBST1_TAC; + BY(REWRITE_TAC[AZIM_REFL]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[SURJ]; + FIRST_X_ASSUM_ST `IMAGE` MP_TAC; + REWRITE_TAC[EXTENSION;IN_IMAGE]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let MCELL4_FULL_WEDGE = prove_by_refinement( + `!V X ul w0 n f i. + packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + barV V 3 ul /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + 1 < n /\ + ~NULLSET (mcell4 V ul) /\ + mcell_set V X /\ + X SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) /\ + {EL 0 ul, EL 1 ul} IN edgeX V X /\ + mcell4 V ul SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) ==> + (X = mcell4 V ul)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `mcell_set` MP_TAC; + REWRITE_TAC[Qzyzmjc.mcell_set_2;IN_ELIM_THM]; + REWRITE_TAC[IN]; + REWRITE_TAC[arith `!i. i <= 4 <=> i <= 1 \/ i = 4 \/ (i = 2 \/ i = 3)`]; + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + COMMENT "case 1"; + FIRST_X_ASSUM DISJ_CASES_TAC; + INTRO_TAC Bump.EDGE_IMP_K2 [`V`;`ul'`;`i'`]; + ASM_REWRITE_TAC[EXTENSION;NOT_IN_EMPTY]; + BY(ASM_MESON_TAC[]); + COMMENT "case 4"; + FIRST_X_ASSUM DISJ_CASES_TAC; + INTRO_TAC MCELL4_FI [`V`;`ul`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_SIMP_TAC[]); + DISCH_TAC; + INTRO_TAC Leaf_cell.MCELL_EDGE_FIRST [`V`;`ul'`;`4`;`EL 0 ul`;`EL 1 ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MCELL4_FI [`V`;`vl`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + ASM_SIMP_TAC[]; + TYPIFY `~NULLSET (mcell4 V vl)` (C SUBGOAL_THEN ASSUME_TAC); + DISCH_TAC; + FIRST_X_ASSUM_ST `edgeX` MP_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Bump.RIJRIED; + REWRITE_TAC[NOT_IN_EMPTY]; + BY(ASM_MESON_TAC[IN;Bump.MCELL4]); + BY(ASM_MESON_TAC[IN;Bump.MCELL4]); + DISCH_TAC; + BY(ASM_MESON_TAC[Bump.MCELL4]); + COMMENT "cases 2 and 3"; + INTRO_TAC LEAF_RANK_REUHADY [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`;`i`]; + REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + ASM_SIMP_TAC[]; + MATCH_MP_TAC LEAF_RANK_HAS_SIZE; + REWRITE_TAC[Bump.EL_EXPLICIT]; + GEXISTL_TAC [`w0`;`f`]; + BY(ASM_MESON_TAC[arith `1 < n ==> ~(n = 0)`]); + REWRITE_TAC[azim_mcell]; + TYPED_ABBREV_TAC `(A:(real^3->bool)->bool) = {X | mcell_set V X /\ {EL 0 ul, EL 1 ul} IN edgeX V X /\ X SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))}` ; + INTRO_TAC SUM_SUBSET_SIMPLE [`{X,mcell4 V ul}`;`A`;`(\X. dihX V X (EL 0 ul,EL 1 ul))`]; + ANTS_TAC; + CONJ_TAC; + EXPAND_TAC "A"; + MATCH_MP_TAC FINITE_SUBSET; + TYPIFY `{X | mcell_set V X /\ edgeX V X {EL 0 ul, EL 1 ul} }` EXISTS_TAC; + CONJ_TAC; + MATCH_MP_TAC Marchal_cells_3.FINITE_EDGE_X2; + BY(ASM_MESON_TAC[]); + BY(SET_TAC[IN]); + CONJ_TAC; + EXPAND_TAC "A"; + REWRITE_TAC[SUBSET;IN_INSERT;IN_ELIM_THM;NOT_IN_EMPTY]; + GEN_TAC; + STRIP_TAC; + REWRITE_TAC[Qzyzmjc.mcell_set_2;IN_ELIM_THM]; + BY(ASM_MESON_TAC[SUBSET;IN;arith `2 <= 4 /\ 3 <= 4`]); + REWRITE_TAC[Qzyzmjc.mcell_set_2;IN_ELIM_THM]; + CONJ_TAC; + GEXISTL_TAC [`4`;`ul`]; + BY(ASM_MESON_TAC[IN;arith `4 <= 4`;Bump.MCELL4]); + CONJ_TAC; + FIRST_X_ASSUM SUBST1_TAC; + GMATCH_SIMP_TAC Bump.MCELL4_EDGE; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + SUBCONJ_TAC; + MATCH_MP_TAC Marchal_cells_2_new.CARD4_IMP_DISTINCT; + GEXISTL_TAC [`EL 2 ul`;`EL 3 ul`]; + MATCH_MP_TAC MCELL4_CARD4; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + GMATCH_SIMP_TAC Bump.set_of_list4; + CONJ2_TAC; + BY(SET_TAC[]); + REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[SUBSET]); + BY(REWRITE_TAC[Marchal_cells_3.DIHX_RANGE]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `<=` MP_TAC; + ASM_REWRITE_TAC[]; + REPLICATE_TAC 2 (FIRST_X_ASSUM kill); + REWRITE_TAC[arith `~(x <= y) <=> (y < x)`]; + GMATCH_SIMP_TAC Geomdetail.SUM_DIS2; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC MCELL4_DIHX_AZIM; + GEXISTL_TAC [`f`;`i`]; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[arith `a < d + a <=> &0 < d`]; + FIRST_X_ASSUM DISJ_CASES_TAC; + INTRO_TAC Leaf_cell.MCELL2_EDGE_FIRST [`V`;`ul'`;`EL 0 ul`;`EL 1 ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[Bump.MCELL2;IN]); + REWRITE_TAC[IN]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `dihX V (mcell i' V ul') (EL 0 ul,EL 1 ul) = dihX V (mcell2 V vl) (EL 0 vl,EL 1 vl)` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[Bump.MCELL2]); + MATCH_MP_TAC MCELL2_DIHX_POS; + REWRITE_TAC[]; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[Bump.MCELL2]); + COMMENT "case 3"; + INTRO_TAC Leaf_cell.MCELL3_EDGE_FIRST [`V`;`ul'`;`EL 0 ul`;`EL 1 ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[Bump.MCELL3;IN]); + REWRITE_TAC[IN]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `dihX V (mcell i' V ul') (EL 0 ul,EL 1 ul) = dihX V (mcell3 V vl) (EL 0 vl,EL 1 vl)` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[Bump.MCELL3]); + MATCH_MP_TAC MCELL3_DIHX_POS; + REWRITE_TAC[]; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[Bump.MCELL3]) + ]);; + (* }}} *) + +let MCELL4_REPARAM = prove_by_refinement( + `!V ul vl. packing V /\ saturated V /\ CARD (set_of_list ul) = 4 /\ (set_of_list ul = set_of_list vl) /\ + LENGTH vl = 4 /\ ~(NULLSET (mcell4 V ul)) /\ + barV V 3 ul ==> mcell4 V ul = mcell4 V vl /\ barV V 3 vl`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Marchal_cells_3.LEFT_ACTION_LIST_3_EXISTS [`EL 0 ul`;`EL 1 ul`;`EL 2 ul`;`EL 3 ul`;`EL 0 vl`;`EL 1 vl`;`EL 2 vl`;`EL 3 vl`]; + TYPIFY `set_of_list ul = {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Bump.set_of_list4; + REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; + BY(ASM_MESON_TAC[]); + TYPIFY `set_of_list vl = {EL 0 vl,EL 1 vl,EL 2 vl,EL 3 vl}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Bump.set_of_list4; + BY(ASM_REWRITE_TAC[]); + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `ul = [EL 0 ul;EL 1 ul;EL 2 ul;EL 3 ul]` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Bump.LENGTH4; + REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; + BY(ASM_MESON_TAC[]); + TYPIFY `vl = [EL 0 vl;EL 1 vl;EL 2 vl;EL 3 vl]` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Bump.LENGTH4; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC Rvfxzbu.RVFXZBU [`V`;`ul`;`4`;`p`]; + ASM_REWRITE_TAC[IN_INSERT;arith `4 - 1 = 3`]; + DISCH_TAC; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[Bump.MCELL4]); + DISCH_TAC; + INTRO_TAC Qzksykg.QZKSYKG1 [`V`;`ul`;`vl`;`4`;`p`]; + DISCH_THEN MATCH_MP_TAC; + ASM_REWRITE_TAC[IN_INSERT;arith `4 - 1 = 3`]; + BY(ASM_MESON_TAC[Bump.MCELL4;NEGLIGIBLE_EMPTY]) + ]);; + (* }}} *) + +let MCELL4_GG = prove_by_refinement( + `!V X ul w0 n f i. + packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + barV V 3 ul /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + 1 < n /\ + X = mcell4 V ul /\ + ~NULLSET X /\ + X SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) ==> + gg_mcell V f (EL 0 ul) (EL 1 ul) i = + gammaX V X lmfun * critical_weight V X + beta_bump_v1 V {EL 0 ul,EL 1 ul} X`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[gg_mcell]; + TYPIFY `{X | mcell_set V X /\ {EL 0 ul, EL 1 ul} IN edgeX V X /\ X SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))} = {X}` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[SUM_SING]); + ONCE_REWRITE_TAC[EXTENSION]; + REWRITE_TAC[IN_SING;IN_ELIM_THM]; + REWRITE_TAC[Geomdetail.EQ_EXPAND]; + REPEAT WEAKER_STRIP_TAC; + CONJ2_TAC; + DISCH_THEN SUBST1_TAC; + ASM_SIMP_TAC[]; + REWRITE_TAC[Pack_defs.mcell_set]; + REWRITE_TAC[Pack_defs.mcell_set;IN_ELIM_THM]; + CONJ_TAC; + BY(ASM_MESON_TAC[Bump.MCELL4;IN]); + GMATCH_SIMP_TAC Bump.MCELL4_EDGE; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + SUBCONJ_TAC; + MATCH_MP_TAC Marchal_cells_2_new.CARD4_IMP_DISTINCT; + GEXISTL_TAC [`EL 2 ul`;`EL 3 ul`]; + MATCH_MP_TAC MCELL4_CARD4; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + GMATCH_SIMP_TAC Bump.set_of_list4; + CONJ2_TAC; + BY(SET_TAC[]); + REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC MCELL4_FULL_WEDGE; + GEXISTL_TAC [`w0`;`n`;`f`;`i`]; + ASM_SIMP_TAC[]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let LEAF_RANK_TRUNCATE = prove_by_refinement( + `!V ul w0 n f. leaf_rank V ul w0 n f = leaf_rank V [EL 0 ul;EL 1 ul] w0 n f`, + (* {{{ proof *) + [ + REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]; + BY(MESON_TAC[S_LEAF_TRUNCATE]) + ]);; + (* }}} *) + +let LEAF_RANK_S_LEAF = prove_by_refinement( + `!V ul w0 n f i. leaf_rank V ul w0 n f ==> s_leaf V ul (f i)`, + (* {{{ proof *) + [ + REWRITE_TAC[leaf_rank;IMAGE;EXTENSION;IN_ELIM_THM;IN_UNIV]; + BY(MESON_TAC[IN]) + ]);; + (* }}} *) + +let CC_CELL_SUBSET_WEDGE = prove_by_refinement( + `!V ul u0 u1 w0 n f j. + packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + (1 < n) /\ + {u0,u1} = {EL 0 ul,EL 1 ul} /\ + ~collinear {EL 0 ul, EL 1 ul, w0} ==> + cc_cell V [u0;u1;f j] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f j) (f (SUC j)) \/ + cc_cell V [u0;u1;f j] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f (j+(n-1))) (f j)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?i. (i < n) /\ f j = f i /\ f(SUC j) = f(SUC i) /\ f(j+(n-1)) = f(i+(n-1))` (C SUBGOAL_THEN MP_TAC); + TYPIFY `~(n = 0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); + TYPIFY `j MOD n` EXISTS_TAC; + BY(ASM_SIMP_TAC[F_DEMOD;FM_DEMOD;DIVISION]); + DISCH_THEN (fun t -> REPEAT (FIRST_X_ASSUM MP_TAC) THEN MP_TAC t); + STRIP_TAC; + ASM_REWRITE_TAC[]; + REPLICATE_TAC 3 (FIRST_X_ASSUM kill); + REPEAT WEAKER_STRIP_TAC; + COMMENT "restart"; + TYPIFY `!i. leaf V [EL 0 ul; EL 1 ul; f i]` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC s_leaf_leaf; + REWRITE_TAC[IN]; + MATCH_MP_TAC LEAF_RANK_S_LEAF; + BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); + TYPIFY `leaf V [u0;u1;f i]` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `=` MP_TAC; + REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + INTRO_TAC Leaf_cell.ZASUVOR [`V`;`EL 0 ul`;`EL 1 ul`;`f i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY(MESON_TAC[]); + COMMENT "f periodic"; + TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[LEAF_RANK_PERIODIC]); + COMMENT "mcell in wedge"; + INTRO_TAC MCELL_IN_WEDGE [`V`;` [EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`;`cc_cell V [u0;u1;f i]`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + ANTS_TAC; + CONJ_TAC; + MATCH_MP_TAC LEAF_RANK_HAS_SIZE; + REWRITE_TAC[Bump.EL_EXPLICIT]; + BY(ASM_MESON_TAC[arith `1 < n ==> ~(n=0)`]); + CONJ_TAC; + ONCE_REWRITE_TAC[GSYM IN]; + MATCH_MP_TAC Leaf_cell.CC_CELL_IN_MCELL_SET; + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + BY(ASM_MESON_TAC[Leaf_cell.CC_CELL_NOT_NULLSET]); + INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[u0;u1; f i]`]; + BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "f i' in wedge"; + INTRO_TAC Leaf_cell.U2_IN_CC_CELL [`V`;`[u0;u1;f i]`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_TAC; + INTRO_TAC S_LEAF_IN_WEDGE_GE [`V`;`[EL 0 ul;EL 1 ul]`;`f i`;`w0`;`n`;`f`;`i'`;`i`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + ANTS_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + COMMENT "first case"; + DISCH_THEN DISJ_CASES_TAC; + INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`;`i`;`i'`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT;AZIM_REFL]; + ASM_SIMP_TAC[arith `1 < n ==> ~(n=0)`]; + DISCH_TAC; + TYPIFY `f (SUC i') = f (SUC i)` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC Oxl_def.periodic_mod; + TYPIFY `n` EXISTS_TAC; + GMATCH_SIMP_TAC (GSYM Hypermap.lemma_suc_mod); + FIRST_X_ASSUM (SUBST1_TAC o GSYM); + BY(ASM_MESON_TAC[Hypermap.lemma_suc_mod;Oxl_def.periodic_mod;arith `1 < n ==> ~(n=0)`]); + DISJ2_TAC; + COMMENT "second case"; + TYPIFY `f i' = f (i + n - 1)` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[]); + INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`;`i`;`SUC i'`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT;AZIM_REFL]; + ASM_SIMP_TAC[arith `1 < n ==> ~(n=0)`]; + DISCH_TAC; + TYPIFY `i' MOD n = (i + n - 1) MOD n` ENOUGH_TO_SHOW_TAC; + DISCH_TAC; + BY(ASM_MESON_TAC [Oxl_def.periodic_mod;arith `1 < n ==> ~(n = 0)`]); + GMATCH_SIMP_TAC (GSYM MOD_ADD_MOD); + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC MOD_ADD_MOD; + TYPIFY `SUC i' + n - 1 = 1*n + i'` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM_ST `1 < n` MP_TAC THEN ARITH_TAC); + REWRITE_TAC[MOD_MULT_ADD]; + BY(ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`]) + ]);; + (* }}} *) + +(* +let CC_CELL_SUBSET_WEDGE = prove_by_refinement( + `!V ul u0 u1 w0 n f i. + packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + (1 < n) /\ + (i < n) /\ + {u0,u1} = {EL 0 ul,EL 1 ul} /\ + ~collinear {EL 0 ul, EL 1 ul, w0} ==> + cc_cell V [u0;u1;f i] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) \/ + cc_cell V [u0;u1;f i] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f (i+(n-1))) (f i)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!i. leaf V [EL 0 ul; EL 1 ul; f i]` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC s_leaf_leaf; + REWRITE_TAC[IN]; + MATCH_MP_TAC LEAF_RANK_S_LEAF; + BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); + TYPIFY `leaf V [u0;u1;f i]` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `=` MP_TAC; + REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + INTRO_TAC Leaf_cell.ZASUVOR [`V`;`EL 0 ul`;`EL 1 ul`;`f i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY(MESON_TAC[]); + COMMENT "f periodic"; + TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[LEAF_RANK_PERIODIC]); + COMMENT "mcell in wedge"; + INTRO_TAC MCELL_IN_WEDGE [`V`;` [EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`;`cc_cell V [u0;u1;f i]`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + ANTS_TAC; + CONJ_TAC; + MATCH_MP_TAC LEAF_RANK_HAS_SIZE; + REWRITE_TAC[Bump.EL_EXPLICIT]; + BY(ASM_MESON_TAC[arith `1 < n ==> ~(n=0)`]); + CONJ_TAC; + ONCE_REWRITE_TAC[GSYM IN]; + MATCH_MP_TAC Leaf_cell.CC_CELL_IN_MCELL_SET; + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + BY(ASM_MESON_TAC[Leaf_cell.CC_CELL_NOT_NULLSET]); + INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[u0;u1; f i]`]; + BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "f i' in wedge"; + INTRO_TAC Leaf_cell.U2_IN_CC_CELL [`V`;`[u0;u1;f i]`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_TAC; + INTRO_TAC S_LEAF_IN_WEDGE_GE [`V`;`[EL 0 ul;EL 1 ul]`;`f i`;`w0`;`n`;`f`;`i'`;`i`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + ANTS_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + COMMENT "first case"; + DISCH_THEN DISJ_CASES_TAC; + INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`;`i`;`i'`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT;AZIM_REFL]; + ASM_SIMP_TAC[arith `1 < n ==> ~(n=0)`]; + DISCH_TAC; + TYPIFY `f (SUC i') = f (SUC i)` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC Oxl_def.periodic_mod; + TYPIFY `n` EXISTS_TAC; + GMATCH_SIMP_TAC (GSYM Hypermap.lemma_suc_mod); + FIRST_X_ASSUM (SUBST1_TAC o GSYM); + BY(ASM_MESON_TAC[Hypermap.lemma_suc_mod;Oxl_def.periodic_mod;arith `1 < n ==> ~(n=0)`]); + DISJ2_TAC; + COMMENT "second case"; + TYPIFY `f i' = f (i + n - 1)` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[]); + INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`;`i`;`SUC i'`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT;AZIM_REFL]; + ASM_SIMP_TAC[arith `1 < n ==> ~(n=0)`]; + DISCH_TAC; + TYPIFY `i' MOD n = (i + n - 1) MOD n` ENOUGH_TO_SHOW_TAC; + DISCH_TAC; + BY(ASM_MESON_TAC [Oxl_def.periodic_mod;arith `1 < n ==> ~(n = 0)`]); + GMATCH_SIMP_TAC (GSYM MOD_ADD_MOD); + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC MOD_ADD_MOD; + TYPIFY `SUC i' + n - 1 = 1*n + i'` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM_ST `1 < n` MP_TAC THEN ARITH_TAC); + REWRITE_TAC[MOD_MULT_ADD]; + BY(ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`]) + ]);; + (* }}} *) +*) + +let WEDGE_UNIQUE_CC_CELL = prove_by_refinement( + `!V ul w0 n f i j. + packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + 1 < n /\ + ~collinear {EL 0 ul, EL 1 ul, w0} ==> + (~(cc_cell V [EL 0 ul;EL 1 ul;f j] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f(SUC i))) \/ + ~(cc_cell V [EL 1 ul;EL 0 ul;f j] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f(SUC i))))`, + (* {{{ proof *) + [ + REWRITE_TAC[GSYM DE_MORGAN_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `cc_ke V [EL 0 ul;EL 1 ul;f j] = 4 \/ cc_ke V [EL 1 ul;EL 0 ul;f j] = 4` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank;IMAGE;EXTENSION;IN_UNIV;IN_ELIM_THM]; + REWRITE_TAC[IN;s_leaf;Bump.EL_EXPLICIT]; + BY(MESON_TAC[]); + COMMENT "do symmetry reduction"; + TYPED_ABBREV_TAC `(W:real^3->bool) = wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))` ; + TYPIFY `!u0 u1. {u0,u1} = {EL 0 ul,EL 1 ul} /\ cc_ke V [u0;u1;f j] = 4 /\ cc_cell V [u0;u1;f j] SUBSET W /\ cc_cell V [u1;u0;f j] SUBSET W ==> F` ENOUGH_TO_SHOW_TAC; + DISCH_THEN MATCH_MP_TAC; + FIRST_X_ASSUM DISJ_CASES_TAC; + GEXISTL_TAC [`EL 0 ul`;`EL 1 ul`]; + BY(ASM_REWRITE_TAC[]); + GEXISTL_TAC [`EL 1 ul`;`EL 0 ul`]; + ASM_REWRITE_TAC[]; + BY(SET_TAC[]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "basic facts"; + TYPIFY `!j. leaf V [EL 0 ul; EL 1 ul; f j]` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC s_leaf_leaf; + REWRITE_TAC[IN]; + MATCH_MP_TAC LEAF_RANK_S_LEAF; + BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); + TYPIFY `leaf V [u0;u1;f j]` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `{u0,u1} = {v0,v1}` MP_TAC; + REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + INTRO_TAC Leaf_cell.ZASUVOR [`V`;`EL 0 ul`;`EL 1 ul`;`f j`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY(MESON_TAC[]); + TYPIFY `leaf V [u1;u0;f j]` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC Leaf_cell.ZASUVOR [`V`;`u0`;`u1`;`f j`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY(MESON_TAC[]); + COMMENT "show 4-cell has standard form"; + INTRO_TAC Leaf_cell.MCELL4_EDGE_FIRST [`V`;`cc_uh V [u0;u1;f j]`;`EL 0 ul`;`EL 1 ul`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[Leaf_cell.cc_uh]); + DISCH_TAC; + INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[u0;u1;f j]`]; + BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT;Leaf_cell.cc_cell;Bump.MCELL4]); + REWRITE_TAC[]; + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `cc_cell V [u0;u1;f j] = mcell4 V vl` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Leaf_cell.cc_cell;Bump.MCELL4]); + INTRO_TAC MCELL4_FI [`V`;`vl`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN;Leaf_cell.CC_CELL_NOT_NULLSET]); + COMMENT "show two cc cells are equal"; + DISCH_TAC; + INTRO_TAC MCELL4_FULL_WEDGE [`V`;`cc_cell V [u1;u0;f j]`;`vl`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + CONJ_TAC; + BY(ASM_MESON_TAC[IN;Leaf_cell.CC_CELL_NOT_NULLSET]); + CONJ_TAC; + BY(ASM_MESON_TAC[Leaf_cell.CC_CELL_IN_MCELL_SET;IN]); + CONJ_TAC; + INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[u1;u0;f j]`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + TYPIFY `{u1,u0} = {u0,u1}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(ASM_REWRITE_TAC[]); + BY(ASM_MESON_TAC[]); + DISCH_TAC; + COMMENT "deal with equality"; + TYPIFY `~(EL 0 ul = EL 1 ul)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]); + TYPIFY `~(u0 = u1)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `{u0,u1} = {v0,v1}` MP_TAC; + REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + BY(ASM_REWRITE_TAC[]); + INTRO_TAC Leaf_cell.FUEIMOV_4 [`V`;`[u0;u1;f j]`;`[u1;u0;f j]`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT;CONS_11]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + TYPIFY `{u0,u1} = {u1,u0}` (C SUBGOAL_THEN ASSUME_TAC); + BY(SET_TAC[]); + REPEAT (GMATCH_SIMP_TAC Leaf_cell.STEM_OF_LEAF); + REWRITE_TAC[Bump.EL_EXPLICIT]; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + TYPIFY `EL 3 (cc_uh V [u1;u0;f j]) = f j` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM SUBST1_TAC; + BY(REWRITE_TAC[Bump.EL_EXPLICIT]); + INTRO_TAC Leaf_cell.CC_CELL_NOT_NULLSET [`V`;`[u1;u0;f j]`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[]; + PROOF_BY_CONTR_TAC; + INTRO_TAC Leaf_cell.CC_CELL4 [`V`;`[u1;u0;f j]`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC Ajripqn.AJRIPQN [`V`;`vl`;`cc_uh V [u1;u0;f j]`;`4`;`cc_ke V [u1;u0;f j]`]; + ANTS_TAC; + TYPIFY `saturated V /\ packing V /\ barV V 3 vl` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(ASM_MESON_TAC[IN]); + CONJ_TAC; + BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); + CONJ_TAC; + BY(SET_TAC[]); + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + CONJ_TAC; + BY(MESON_TAC[Leaf_cell.CC_KE_34]); + TYPIFY `(mcell 4 V vl INTER mcell (cc_ke V [u1; u0; f j]) V (cc_uh V [u1; u0; f j])) = cc_cell V [u1;u0; f j]` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[GSYM Bump.MCELL4]; + BY(ASM_MESON_TAC[INTER_IDEMPOT;Leaf_cell.cc_cell]); + BY(MESON_TAC[]); + DISCH_TAC; + TYPIFY `set_of_list (cc_uh V [u1;u0;f j]) SUBSET affine hull {u1,u0,f j}` ENOUGH_TO_SHOW_TAC; + DISCH_TAC; + FIRST_X_ASSUM_ST `NULLSET` MP_TAC; + REWRITE_TAC[]; + MATCH_MP_TAC NEGLIGIBLE_SUBSET; + TYPIFY `affine hull {u1,u0,f j}` EXISTS_TAC; + REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]; + FIRST_X_ASSUM_ST `cc_cell V ul = x` SUBST1_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP Marchal_cells.CONVEX_HULL_SUBSET)); + BY(MESON_TAC[CONVEX_HULL_EQ;AFFINE_AFFINE_HULL;AFFINE_IMP_CONVEX]); + MATCH_MP_TAC SUBSET_TRANS; + TYPIFY `{u1,u0,f j}` EXISTS_TAC; + REWRITE_TAC[Counting_spheres.SUBSET_P_HULL]; + INTRO_TAC Leaf_cell.EL_CC_UH [`V`;`[u1;u0;f j]`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[Bump.EL_EXPLICIT]; + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC Bump.set_of_list4; + CONJ_TAC; + INTRO_TAC Leaf_cell.cc_uh [`V`;`[u1;u0;f j]`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + BY(MESON_TAC[IN;Sphere.BARV;arith `3 + 1 = 4`]); + ASM_REWRITE_TAC[]; + BY(SET_TAC[]) + ]);; + (* }}} *) + +(* +let WEDGE_UNIQUE_CC_CELL_ALT = prove_by_refinement( + `!V ul w0 n f i j. + packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + 1 < n /\ + ~collinear {EL 0 ul, EL 1 ul, w0} ==> + (~(cc_cell V [EL 0 ul;EL 1 ul;f j] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f(SUC i))) \/ + ~(cc_cell V [EL 1 ul;EL 0 ul;f j] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f(SUC i))))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(n = 0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); + INTRO_TAC WEDGE_UNIQUE_CC_CELL [`V`;`ul`;`w0`;`n`;`f`;`i MOD n`;`j`]; + BY(ASM_SIMP_TAC[DIVISION;F_DEMOD]) + ]);; + (* }}} *) +*) + +let LEAF_RANK4_CHI_MSB = prove_by_refinement( + `!V ul w0 n f i. packing V /\ + saturated V /\ + barV V 3 ul /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + 1 < n /\ + i < n /\ + ~NULLSET (mcell4 V ul) /\ + mcell4 V ul SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) ==> + &0 < chi_msb [EL 0 ul;EL 1 ul;f i] (f (SUC i))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MCELL4_AZIM_LT_PI [`V`;`ul`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + REWRITE_TAC[Leaf_cell.chi_msb;GSYM Local_lemmas.SIN_AZIM_MUTUAL_SROSS;Bump.EL_EXPLICIT]; + INTRO_TAC (GSYM AZIM_TRANSLATION) [`EL 0 ul`;`(vec 0):real^3`;`(EL 1 ul - EL 0 ul):real^3`;`(f i - EL 0 ul):real^3`;`(f (SUC i) - EL 0 ul):real^3`]; + REWRITE_TAC[varith `!(u:real^3) v. v + u - v = u`;varith `!(u:real^3). u + vec 0 = u`]; + DISCH_THEN SUBST1_TAC; + MATCH_MP_TAC SIN_POS_PI; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `~(x = &0) /\ (&0 <= x) ==> &0 < x`); + REWRITE_TAC[Local_lemmas.AZIM_RANGE]; + GMATCH_SIMP_TAC LEAF_RANK_AZIM_INJ; + TYPIFY `n` EXISTS_TAC; + CONJ_TAC; + GEXISTL_TAC [`V`;`w0`]; + ASM_SIMP_TAC[arith `1 < n ==> ~(n=0)`]; + BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); + ASM_SIMP_TAC[MOD_LT]; + TYPIFY `SUC i < n \/ SUC i = n` (C SUBGOAL_THEN DISJ_CASES_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + ASM_SIMP_TAC[MOD_LT]; + BY(ARITH_TAC); + ASM_SIMP_TAC[MOD_REFL_ALT;arith `1 < n ==> ~(n = 0)`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC) + ]);; + (* }}} *) + +let LEAF_RANK4_CHI_MSB_ALT = prove_by_refinement( + `!V ul w0 n f i. packing V /\ + saturated V /\ + barV V 3 ul /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + 1 < n /\ + ~NULLSET (mcell4 V ul) /\ + mcell4 V ul SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) ==> + &0 < chi_msb [EL 0 ul;EL 1 ul;f i] (f (SUC i))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC PERIODIC_REDUCE_MOD [`f`;`n`;`i`]; + ANTS_TAC; + ASM_SIMP_TAC[ arith `1 < n ==> 1 <= n`]; + BY(ASM_MESON_TAC[LEAF_RANK_PERIODIC]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC LEAF_RANK4_CHI_MSB [`V`;`ul`;`w0`;`n`;`f`;`j`]; + ASM_REWRITE_TAC[]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let CC_CELL_WEDGE_MATCH_UH = prove_by_refinement( + `!V ul u0 u1 w0 n f i j. packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + 1 < n /\ + {u0,u1} = {EL 0 ul,EL 1 ul} /\ + cc_cell V [u0;u1;f j] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) /\ + cc_ke V [u0;u1;f j] = 4 ==> + {f j, EL 3 (cc_uh V [u0;u1;f j])} = {f i, f (SUC i)}`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + COMMENT "basic facts"; + TYPIFY `!j. leaf V [EL 0 ul; EL 1 ul; f j]` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC s_leaf_leaf; + REWRITE_TAC[IN]; + MATCH_MP_TAC LEAF_RANK_S_LEAF; + BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); + TYPIFY `leaf V [u0;u1;f j]` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `{u0,u1} = {v0,v1}` MP_TAC; + REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + INTRO_TAC Leaf_cell.ZASUVOR [`V`;`EL 0 ul`;`EL 1 ul`;`f j`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY(MESON_TAC[]); + TYPIFY `leaf V [u1;u0;f j]` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC Leaf_cell.ZASUVOR [`V`;`u0`;`u1`;`f j`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY(MESON_TAC[]); + INTRO_TAC Leaf_cell.EL_CC_UH [`V`;`[u0;u1;f j]`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[Bump.EL_EXPLICIT]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(NULLSET (cc_cell V [u0;u1;f j]))` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[IN;Leaf_cell.CC_CELL_NOT_NULLSET]); + COMMENT "show 4-cell has standard form"; + PROOF_BY_CONTR_TAC; + INTRO_TAC Leaf_cell.MCELL4_EDGE_FIRST [`V`;`cc_uh V [u0;u1;f j]`;`EL 0 ul`;`EL 1 ul`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[Leaf_cell.cc_uh]); + DISCH_TAC; + INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[u0;u1;f j]`]; + BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT;Leaf_cell.cc_cell;Bump.MCELL4]); + REWRITE_TAC[]; + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `cc_cell V [u0;u1;f j] = mcell4 V vl` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Leaf_cell.cc_cell;Bump.MCELL4]); + INTRO_TAC MCELL4_FI [`V`;`vl`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + DISCH_TAC; + COMMENT "show two cc cells are equal"; + INTRO_TAC Leaf_cell.CC_CELL4 [`V`;`[u0;u1;f j]`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + TYPIFY `convex hull {EL 0 vl, EL 1 vl, f i, f (SUC i)} = convex hull set_of_list (cc_uh V [u0; u1; f j])` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[]); + DISCH_TAC; + TYPIFY `affine hull {EL 0 vl, EL 1 vl, f i, f (SUC i)} = affine hull set_of_list (cc_uh V [u0; u1; f j])` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[AFFINE_HULL_CONVEX_HULL]); + TYPIFY `aff_dim {EL 0 vl, EL 1 vl, f i, f (SUC i)} = aff_dim (set_of_list (cc_uh V [u0; u1; f j]))` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[AFF_DIM_AFFINE_HULL]); + INTRO_TAC Leaf_cell.SET_OF_LIST_CC_UH [`V`;`[u0;u1;f j]`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_TAC; + TYPIFY `CARD {u0,u1,f j,EL 3 (cc_uh V [u0;u1;f j])} = 4` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC MCELL4_CARD4 [`V`;`cc_uh V [u0;u1;f j]`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN;Leaf_cell.cc_uh]); + BY(ASM_REWRITE_TAC[]); + COMMENT "show two lists are equal"; + INTRO_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ [`{EL 0 vl, EL 1 vl, f i, f (SUC i)}`;`set_of_list (cc_uh V [u0; u1; f j])`]; + TYPIFY `(~affine_dependent {EL 0 vl, EL 1 vl, f i, f (SUC i)} /\ ~affine_dependent (set_of_list (cc_uh V [u0; u1; f j])))` ENOUGH_TO_SHOW_TAC; + DISCH_THEN (unlist REWRITE_TAC); + ASM_REWRITE_TAC[]; + DISCH_TAC; + FIRST_X_ASSUM_ST `~` MP_TAC; + REWRITE_TAC[]; + MATCH_MP_TAC CARD4_IN_PAIRS; + GEXISTL_TAC [`u0`;`u1`]; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (SUBST1_TAC o GSYM); + FIRST_X_ASSUM_ST `{a,b} = {c,d}` MP_TAC; + BY(SET_TAC[]); + ASM_REWRITE_TAC[AFFINE_INDEPENDENT_IFF_CARD]; + REWRITE_TAC[FINITE_INSERT;FINITE_EMPTY]; + TYPIFY `aff_dim {u0, u1, f j, EL 3 (cc_uh V [u0; u1; f j])} = &3` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC NOT_COPLANAR_AFF_3; + ONCE_REWRITE_TAC[GSYM COPLANAR_CONVEX_HULL_COPLANAR]; + DISCH_THEN (MP_TAC o (MATCH_MP COPLANAR_IMP_NEGLIGIBLE)); + BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE]); + ASM_REWRITE_TAC[]; + REWRITE_TAC[INT_ARITH `!(x:int). &3 = x - &1 <=> x = &4`]; + REWRITE_TAC[INT_OF_NUM_EQ]; + MATCH_MP_TAC (arith `x <= 4 /\ ~(x <= 3) ==> (x = 4)`); + REWRITE_TAC[Geomdetail.CARD4]; + DISCH_TAC; + INTRO_TAC AFF_DIM_LE_CARD [`{EL 0 ul, EL 1 ul, f i, f (SUC i)}`]; + REWRITE_TAC[FINITE_INSERT;FINITE_EMPTY]; + MATCH_MP_TAC (INT_ARITH `c <= &3 /\ a = int_of_num 3 ==> ~(a <= c - int_of_num 1)`); + ASM_REWRITE_TAC[INT_OF_NUM_LE]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +(* +let CC_CELL_WEDGE_MATCH_UH_ALT = prove_by_refinement( + `!V ul u0 u1 w0 n f i j. packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + 1 < n /\ + {u0,u1} = {EL 0 ul,EL 1 ul} /\ + cc_cell V [u0;u1;f j] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i)) /\ + cc_ke V [u0;u1;f j] = 4 ==> + {f j, EL 3 (cc_uh V [u0;u1;f j])} = {f i, f (SUC i)}`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[LEAF_RANK_PERIODIC]); + INTRO_TAC PERIODIC_REDUCE_MOD [`f`;`n`;`i`]; + ASM_SIMP_TAC[arith `1 < n ==> 1 <= n`]; + DISCH_THEN (fun t -> REPEAT (FIRST_X_ASSUM MP_TAC) THEN MP_TAC ( t)); + STRIP_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC CC_CELL_WEDGE_MATCH_UH [`V`;`ul`;`u0`;`u1`;`w0`;`n`;`f`;`j'`;`j`]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) +*) + +let K4_CC_WI_ALT = prove_by_refinement( + `!V ul w0 n f i. packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + 1 < n /\ + cc_ke V [EL 0 ul;EL 1 ul;f i] = 4 ==> + cc_cell V [EL 0 ul;EL 1 ul;f i] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + COMMENT "preliminaries"; + TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); + TYPIFY `~(n = 0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `1 < n` MP_TAC THEN ARITH_TAC); + TYPIFY `f (SUC (i + n - 1)) = f i` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_SIMP_TAC[F_SUC_PRE]); + INTRO_TAC CC_CELL_SUBSET_WEDGE [`V`;`ul`;`EL 0 ul`;`EL 1 ul`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC (TAUT `~b ==> (a \/ b ==> a)`); + DISCH_TAC; + TYPIFY `!j. leaf V [EL 0 ul; EL 1 ul; f j]` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC s_leaf_leaf; + REWRITE_TAC[IN]; + MATCH_MP_TAC LEAF_RANK_S_LEAF; + BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); + INTRO_TAC Leaf_cell.EL_CC_UH [`V`;`[EL 0 ul;EL 1 ul;f i]`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `&0 < chi_msb [EL 0 (cc_uh V [EL 0 ul;EL 1 ul;f i]); EL 1 (cc_uh V [EL 0 ul;EL 1 ul;f i]); f(i + n - 1)] (f (SUC (i + n - 1)))` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC LEAF_RANK4_CHI_MSB_ALT; + GEXISTL_TAC [`V`;`w0`;`n`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + CONJ_TAC; + BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); + TYPIFY `mcell4 V (cc_uh V [EL 0 ul;EL 1 ul; f i]) = cc_cell V [EL 0 ul;EL 1 ul;f i]` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[Leaf_cell.cc_cell;Bump.MCELL4]; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + MATCH_MP_TAC Leaf_cell.CC_CELL_NOT_NULLSET; + BY(ASM_MESON_TAC[]); + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + COMMENT "now compute chi a second way via 0 < chi cc_cell"; + INTRO_TAC Leaf_cell.K4_CHI_MSB_POS [`V`;`[EL 0 ul;EL 1 ul;f (i)]`]; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[Leaf_cell.chi_msb_swap_23]; + TYPIFY `EL 3 (cc_uh V [EL 0 ul; EL 1 ul; f i]) = f (i + n - 1)` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + INTRO_TAC CC_CELL_WEDGE_MATCH_UH [`V`;`ul`;`EL 0 ul`;`EL 1 ul`;`w0`;`n`;`f`;`(i + n - 1)`;`i`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; + DISCH_THEN DISJ_CASES_TAC; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `/\` MP_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`[EL 0 ul;EL 1 ul;f i]`;`w0`;`n`;`f`;`i`;`i + n - 1`]; + ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`;Bump.EL_EXPLICIT;AZIM_REFL]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[MOD_INJ1_ALT;arith `1 < n ==> ~(n = 0) /\ 1 < n ==> (n - 1) < n /\ 1 < n ==> ~(n - 1 = 0)`]); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +(* +let K4_CC_WI_ALT = prove_by_refinement( + `!V ul w0 n f i. packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + 1 < n /\ + cc_ke V [EL 0 ul;EL 1 ul;f i] = 4 ==> + cc_cell V [EL 0 ul;EL 1 ul;f i] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(n = 0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); + INTRO_TAC K4_CC_WI [`V`;`ul`;`w0`;`n`;`f`;`i MOD n`]; + BY(ASM_SIMP_TAC[DIVISION;F_DEMOD]) + ]);; + (* }}} *) +*) + +let K4_CC_WIM = prove_by_refinement( + `!V ul w0 n f i. packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + 1 < n /\ + cc_ke V [EL 1 ul;EL 0 ul;f i] = 4 ==> + cc_cell V [EL 1 ul;EL 0 ul;f i] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f (i + n - 1)) (f i)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + COMMENT "preliminaries"; + TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); + TYPIFY `~(n = 0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `1 < n` MP_TAC THEN ARITH_TAC); + TYPIFY `f (SUC (i + n - 1)) = f i` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_SIMP_TAC[F_SUC_PRE]); + TYPIFY `{EL 1 ul,EL 0 ul} = {EL 0 ul,EL 1 ul}` (C SUBGOAL_THEN ASSUME_TAC); + BY(SET_TAC[]); + INTRO_TAC CC_CELL_SUBSET_WEDGE [`V`;`ul`;`EL 1 ul`;`EL 0 ul`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC (TAUT `~a ==> (a \/ b ==> b)`); + DISCH_TAC; + TYPIFY `!j. leaf V [EL 0 ul; EL 1 ul; f j]` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC s_leaf_leaf; + REWRITE_TAC[IN]; + MATCH_MP_TAC LEAF_RANK_S_LEAF; + BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); + TYPIFY `!j. leaf V [EL 1 ul;EL 0 ul; f j]` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + INTRO_TAC Leaf_cell.ZASUVOR [`V`;`EL 0 ul`;`EL 1 ul`;`f j`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY(MESON_TAC[]); + INTRO_TAC Leaf_cell.EL_CC_UH [`V`;`[EL 1 ul;EL 0 ul;f i]`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Leaf_cell.CC_CELL_NOT_NULLSET [`V`;`[EL 1 ul; EL 0 ul; f i]`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + COMMENT "reparametrize"; + INTRO_TAC MCELL4_REPARAM [`V`;`cc_uh V [EL 1 ul;EL 0 ul;f i]`;`[EL 0 ul;EL 1 ul;f i; EL 3 (cc_uh V [EL 1 ul;EL 0 ul;f i])]`]; + COMMENT "long list of ants"; + ANTS_TAC; + ASM_REWRITE_TAC[LENGTH;arith `SUC(SUC(SUC(SUC 0))) = 4`]; + INTRO_TAC Leaf_cell.CC_CELL_EXTREME_CARD [`V`;`[EL 1 ul;EL 0 ul;f i]`;`EL 3 (cc_uh V [EL 1 ul;EL 0 ul;f i])`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[arith `~(4 = 3)`]); + REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_TAC; + TYPIFY `barV V 3 (cc_uh V [EL 1 ul; EL 0 ul; f i])` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); + INTRO_TAC BARV3_SET_OF_LIST4 [`V`;`cc_uh V [EL 1 ul; EL 0 ul; f i]`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + ASM_REWRITE_TAC[set_of_list]; + BY(SET_TAC[]); + BY(ASM_MESON_TAC[Leaf_cell.cc_cell;Bump.MCELL4;IN]); + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `(vl:(real^3)list) = [EL 0 ul; EL 1 ul; f i; EL 3 (cc_uh V [EL 1 ul; EL 0 ul; f i])]` ; + TYPIFY `EL 0 vl = EL 0 ul /\ EL 1 vl = EL 1 ul` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "vl"; + BY(REWRITE_TAC[Bump.EL_EXPLICIT]); + COMMENT "compute chi_msb"; + INTRO_TAC LEAF_RANK4_CHI_MSB_ALT [`V`;`vl`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[Leaf_cell.cc_cell;Bump.MCELL4]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + COMMENT "now compute chi a second way via 0 < chi cc_cell"; + INTRO_TAC Leaf_cell.K4_CHI_MSB_POS [`V`;`[EL 1 ul;EL 0 ul;f (i)]`]; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[Leaf_cell.chi_msb_swap_01]; + TYPIFY `EL 3 (cc_uh V [EL 1 ul; EL 0 ul; f i]) = f (SUC i)` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + INTRO_TAC CC_CELL_WEDGE_MATCH_UH [`V`;`ul`;`EL 1 ul`;`EL 0 ul`;`w0`;`n`;`f`;`i`;`i`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `/\` MP_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`[EL 0 ul;EL 1 ul]`;`w0`;`n`;`f`;`i`;`SUC i`]; + ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`;Bump.EL_EXPLICIT;AZIM_REFL]; + REWRITE_TAC[arith `SUC i = (i + 1)`]; + BY(ASM_MESON_TAC[MOD_INJ1_ALT;arith `1 < n ==> ~(n = 0) /\ ~(1 = 0)`]) + ]);; + (* }}} *) + +(* +let K4_CC_WIM = prove_by_refinement( + `!V ul w0 n f i. packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + 1 < n /\ + cc_ke V [EL 1 ul;EL 0 ul;f i] = 4 ==> + cc_cell V [EL 1 ul;EL 0 ul;f i] SUBSET wedge_ge (EL 0 ul) (EL 1 ul) (f (i + n - 1)) (f i)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(n = 0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); + INTRO_TAC K4_CC_WI_MINUS [`V`;`ul`;`w0`;`n`;`f`;`i MOD n`]; + BY(ASM_SIMP_TAC[DIVISION;FM_DEMOD]) + ]);; + (* }}} *) +*) + +let K3_CC_WI_ALT = prove_by_refinement( + `!V ul w0 n f i. + packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + 1 < n /\ + cc_ke V [EL 0 ul; EL 1 ul; f i] = 3 + ==> cc_cell V [EL 0 ul; EL 1 ul; f i] SUBSET + wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); + INTRO_TAC CC_CELL_SUBSET_WEDGE [`V`;`ul`;`EL 0 ul`;`EL 1 ul`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[]; + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + PROOF_BY_CONTR_TAC; + TYPIFY `~(n=0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `1 < n` MP_TAC THEN ARITH_TAC); + TYPIFY `cc_ke V [EL 1 ul;EL 0 ul;f i] = 4` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank]; + REWRITE_TAC[IMAGE;EXTENSION;IN_IMAGE;IN_UNIV;IN_ELIM_THM;s_leaf]; + REWRITE_TAC[IN;s_leaf;Bump.EL_EXPLICIT]; + BY(ASM_MESON_TAC[arith `~(3 = 4)`]); + INTRO_TAC K4_CC_WIM [`V`;`ul`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + INTRO_TAC WEDGE_UNIQUE_CC_CELL [`V`;`ul`;`w0`;`n`;`f`;`(i + n - 1) MOD n`;`i`]; + ANTS_TAC; + BY(ASM_SIMP_TAC[DIVISION]); + ASM_SIMP_TAC[F_DEMOD]; + REWRITE_TAC[DE_MORGAN_THM]; + TYPIFY `f (SUC (i + n - 1)) = f i` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(ASM_REWRITE_TAC[]); + MATCH_MP_TAC F_SUC_PRE; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +(* +let K3_CC_WI_ALT = prove_by_refinement( + `!V ul w0 n f i. + packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + 1 < n /\ + cc_ke V [EL 0 ul; EL 1 ul; f i] = 3 + ==> cc_cell V [EL 0 ul; EL 1 ul; f i] SUBSET + wedge_ge (EL 0 ul) (EL 1 ul) (f i) (f (SUC i))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(n = 0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); + INTRO_TAC K3_CC_WI [`V`;`ul`;`w0`;`n`;`f`;`i MOD n`]; + BY(ASM_SIMP_TAC[DIVISION;F_DEMOD]) + ]);; + (* }}} *) +*) + +let K3_CC_WIM_ALT = prove_by_refinement( + `!V ul w0 n f i. + packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + 1 < n /\ + cc_ke V [EL 1 ul; EL 0 ul; f i] = 3 + ==> cc_cell V [EL 1 ul; EL 0 ul; f i] SUBSET + wedge_ge (EL 0 ul) (EL 1 ul) (f (i + n - 1)) (f i)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); + INTRO_TAC CC_CELL_SUBSET_WEDGE [`V`;`ul`;`EL 1 ul`;`EL 0 ul`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(SET_TAC[]); + MATCH_MP_TAC (TAUT `~a ==> (a \/ b ==> b)`); + DISCH_TAC; + TYPIFY `~(n=0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `1 < n` MP_TAC THEN ARITH_TAC); + TYPIFY `cc_ke V [EL 0 ul;EL 1 ul;f i] = 4` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank]; + REWRITE_TAC[IMAGE;EXTENSION;IN_IMAGE;IN_UNIV;IN_ELIM_THM]; + REWRITE_TAC[IN;s_leaf;Bump.EL_EXPLICIT]; + BY(ASM_MESON_TAC[arith `~(3 = 4)`]); + INTRO_TAC K4_CC_WI_ALT [`V`;`ul`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + INTRO_TAC WEDGE_UNIQUE_CC_CELL [`V`;`ul`;`w0`;`n`;`f`;`i`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY(ASM_REWRITE_TAC[DE_MORGAN_THM]) + ]);; + (* }}} *) + +(* +let K3_CC_WIM_ALT = prove_by_refinement( + `!V ul w0 n f i. + packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + 1 < n /\ + cc_ke V [EL 1 ul; EL 0 ul; f i] = 3 + ==> cc_cell V [EL 1 ul; EL 0 ul; f i] SUBSET + wedge_ge (EL 0 ul) (EL 1 ul) (f (i + n - 1)) (f i)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(n = 0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); + INTRO_TAC K3_CC_WIM [`V`;`ul`;`w0`;`n`;`f`;`i MOD n`]; + BY(ASM_SIMP_TAC[DIVISION;FM_DEMOD]) + ]);; + (* }}} *) +*) + +let NO_4CELL_IMP_K3 = prove_by_refinement( + `!V W ul w0 n f i. + packing V /\ + saturated V /\ + leaf_rank V [EL 0 ul; EL 1 ul] w0 n f /\ + ~collinear {EL 0 ul, EL 1 ul, w0} /\ + W = wedge_ge (EL 0 ul) (EL 1 ul) (f i ) (f (SUC i)) /\ + 1 < n /\ + ~(?vl. barV V 3 vl /\ {EL 0 ul,EL 1 ul} IN edgeX V (mcell4 V vl) /\ mcell4 V vl SUBSET W) ==> + cc_ke V [EL 1 ul; EL 0 ul; f (SUC i)] = 3 /\ + cc_ke V [EL 0 ul;EL 1 ul; f i ] = 3 /\ + cc_cell V [EL 0 ul;EL 1 ul;f i] SUBSET W /\ + cc_cell V [EL 1 ul;EL 0 ul; f(SUC i)] SUBSET W /\ + ~(cc_cell V [EL 0 ul;EL 1 ul;f i ] = cc_cell V [EL 1 ul;EL 0 ul;f (SUC i)])`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + COMMENT "preliminaries"; + TYPIFY `!j. leaf V [EL 0 ul; EL 1 ul; f j]` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + MATCH_MP_TAC s_leaf_leaf; + REWRITE_TAC[IN]; + MATCH_MP_TAC LEAF_RANK_S_LEAF; + BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); + TYPIFY `!j. leaf V [EL 1 ul;EL 0 ul;f j]` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + INTRO_TAC Leaf_cell.ZASUVOR [`V`;`EL 0 ul`;`EL 1 ul`;`f j`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY(ASM_MESON_TAC[]); + TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); + TYPIFY `{EL 0 ul,EL 1 ul} = {EL 1 ul,EL 0 ul}` (C SUBGOAL_THEN ASSUME_TAC); + BY(SET_TAC[]); + COMMENT "k- = 3"; + SUBCONJ_TAC; + INTRO_TAC Leaf_cell.CC_KE_34 [`V`;`[EL 1 ul;EL 0 ul;f(SUC i)]`]; + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC K4_CC_WIM [`V`;`ul`;`w0`;`n`;`f`;`SUC i`]; + ASM_REWRITE_TAC[]; + TYPIFY `f (SUC i + n - 1) = f i` (C SUBGOAL_THEN SUBST1_TAC); + MATCH_MP_TAC PERIODIC_EQ_IMAGE; + TYPIFY `n` EXISTS_TAC; + ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`;arith `1 < n ==> SUC i + n - 1 = 1 *n + i`]; + BY(REWRITE_TAC[MOD_MULT_ADD]); + REWRITE_TAC[arith `~(4 = 3)`]; + DISCH_TAC; + FIRST_X_ASSUM_ST `?` MP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `cc_uh V [EL 1 ul;EL 0 ul;f(SUC i)]` EXISTS_TAC; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); + DISCH_TAC; + TYPIFY ` mcell4 V (cc_uh V [EL 1 ul;EL 0 ul;f (SUC i)]) = cc_cell V [EL 1 ul;EL 0 ul;f (SUC i)]` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell;Bump.MCELL4]); + ASM_REWRITE_TAC[]; + INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[EL 1 ul;EL 0 ul;f (SUC i)]`]; + BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); + DISCH_TAC; + COMMENT "k+ = 3"; + SUBCONJ_TAC; + INTRO_TAC Leaf_cell.CC_KE_34 [`V`;`[EL 0 ul;EL 1 ul;f i]`]; + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC K4_CC_WI_ALT [`V`;`ul`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `~(4 = 3)`]; + DISCH_TAC; + FIRST_X_ASSUM_ST `?` MP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `cc_uh V [EL 0 ul;EL 1 ul;f( i)]` EXISTS_TAC; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); + DISCH_TAC; + TYPIFY ` mcell4 V (cc_uh V [EL 0 ul;EL 1 ul;f ( i)]) = cc_cell V [EL 0 ul;EL 1 ul;f ( i)]` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell;Bump.MCELL4]); + ASM_REWRITE_TAC[]; + INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[EL 0 ul;EL 1 ul;f ( i)]`]; + BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); + DISCH_TAC; + COMMENT "cc_cell3+"; + CONJ_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC K3_CC_WI_ALT; + BY(ASM_MESON_TAC[]); + COMMENT "cc_cell3-"; + CONJ_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC K3_CC_WIM_ALT [`V`;`ul`;`w0`;`n`;`f`;`SUC i`]; + ASM_REWRITE_TAC[]; + TYPIFY `f (SUC i + n - 1) = f i` (C SUBGOAL_THEN SUBST1_TAC); + MATCH_MP_TAC PERIODIC_EQ_IMAGE; + TYPIFY `n` EXISTS_TAC; + BY(ASM_SIMP_TAC[arith `1 < n ==> ~(n =0)`;arith `1 < n ==> SUC i + n - 1 = 1*n + i`;MOD_MULT_ADD]); + BY(REWRITE_TAC[]); + COMMENT "inequality"; + DISCH_TAC; + INTRO_TAC Leaf_cell.FUEIMOV_3 [`V`;`[EL 0 ul;EL 1 ul;f i]`;`[EL 1 ul;EL 0 ul;f (SUC i)]`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + REWRITE_TAC[CONS_11]; + BY(ASM_MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]) + ]);; + (* }}} *) + +let JSPEVYT_EXPLICIT = prove_by_refinement( + `!(u0:real^3) u1 u2. + pack_nonlinear_non_ox3q1h /\ + ~collinear {u0,u1,u2} /\ + hl [u0;u1;u2] <= #1.34 /\ &2 * hminus <= dist(u0,u1) /\ &2 <= dist (u0,u2) ==> + dist(u1,u2) < &2 * hminus`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.HL;set_of_list]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `radV` MP_TAC; + ASM_SIMP_TAC[RADV_ETAY]; + DISCH_TAC; + INTRO_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "JSPEVYT") [`&1`;`&1`;`&1`;`dist(u0,u1)`;`dist(u1,u2)`;`dist(u0,u2)`]; + REWRITE_TAC[Sphere.ineq;arith `&1 <= &1`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~affine_dependent {u0,u1,u2}` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[AFFINE_DEPENDENT_IMP_COLLINEAR_3]); + INTRO_TAC Rogers.RADV_MONO [`{u0,u1,u2}`;`{u0,u1}`]; + INTRO_TAC Rogers.RADV_MONO [`{u0,u1,u2}`;`{u0,u2}`]; + INTRO_TAC Rogers.RADV_MONO [`{u0,u1,u2}`;`{u1,u2}`]; + ASM_SIMP_TAC[RADV_ETAY]; + REWRITE_TAC[RADV2]; + REPEAT (ANTS_TAC THENL [SET_TAC[];DISCH_TAC]); + TYPIFY `&0 <= ups_x (dist (u0,u1) pow 2) (dist (u1,u2) pow 2) (dist (u0,u2) pow 2)` (C SUBGOAL_THEN MP_TAC); + BY(REWRITE_TAC[Collect_geom.TROI_OI_DAT_HOI]); + REWRITE_TAC[REAL_POW_2]; + DISCH_TAC; + REWRITE_TAC[arith `x < y <=> ~(y <= x)`]; + DISCH_TAC; + FIRST_X_ASSUM_ST `#1.34` MP_TAC; + TYPIFY `eta_y (dist (u0,u1)) (dist (u1,u2)) (dist (u0,u2)) = eta_y (dist (u0,u1)) (dist (u0,u2)) (dist (u1,u2))` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[Collect_geom.ETA_Y_SYM]); + INTRO_TAC Merge_ineq.eta_y_nn [`dist(u0,u1)`;`dist(u0,u2)`;`dist(u1,u2)`]; + ANTS_TAC; + BY(ASM_MESON_TAC[Collect_geom.UPS_X_SYM]); + DISCH_TAC; + TYPED_ABBREV_TAC `(eta:real) = eta_y (dist (u0,u1)) (dist (u0,u2)) (dist (u1,u2))` ; + ASM_REWRITE_TAC[]; + TYPIFY `!x. inv (&2) * x <= eta ==> x <= sqrt8` (C SUBGOAL_THEN (unlist ASM_SIMP_TAC)); + GEN_TAC; + FIRST_X_ASSUM_ST `#1.34` MP_TAC; + MP_TAC Flyspeck_constants.bounds; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC (arith `x <= y ==> ~(x > y)`); + MATCH_MP_TAC Collect_geom2.POS_IMP_POW2; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let CELL_CLUSTER_ESTIMATE_REDUCE = prove_by_refinement( +`!V. packing V /\ saturated V /\ + (!u0 u1. ~(u0 = u1) /\ hminus <= hl [u0;u1] /\ hl [u0;u1] <= hplus ==> + &0 <= sum {X | {u0,u1} IN edgeX V X /\ mcell_set V X} + (\X. gammaX V X lmfun * critical_weight V X + beta_bump_v1 V {u0,u1} X)) + ==> cell_cluster_estimate_v1 V`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Pack_defs.cell_cluster_estimate_v1;Pack_defs.cluster_gamma_v1;Pack_defs.cell_cluster]; + GEN_TAC; + TYPIFY `{X | e IN critical_edgeX V X /\ mcell_set V X} = {}` ASM_CASES_TAC; + ASM_REWRITE_TAC[SUM_CLAUSES]; + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM (MP_TAC o (REWRITE_RULE[EXTENSION;NOT_IN_EMPTY;IN_ELIM_THM;NOT_FORALL_THM])); + DISCH_THEN (MP_TAC o (REWRITE_RULE[Pack_defs.critical_edgeX;IN_ELIM_THM])); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `u = v` ASM_CASES_TAC; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP Bump.EDGE_MCELL_EL)); + REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; + ASM_REWRITE_TAC[]; + BY(MESON_TAC[]); + FIRST_X_ASSUM (C INTRO_TAC [`u`;`v`]); + ASM_REWRITE_TAC[arith `x >= &0 <=> &0 <= x`]; + TYPIFY `!X. {u, v} IN critical_edgeX V X <=> {u,v} IN edgeX V X` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + REWRITE_TAC[Pack_defs.critical_edgeX;IN_ELIM_THM]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let cc_card_data = prove_by_refinement( + `!V f u0 u1. cc_card_v11 (cc_data_v8 V f u0 u1) = CARD(s_leaf V [u0;u1])`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Oxl_def.cc_card_v11;cc_data_v8;Oxl_def.cc_v11]) + ]);; + (* }}} *) + +let cc_real_data = prove_by_refinement( + `!V f u0 u1. cc_azim_v11 (cc_data_v8 V f u0 u1) = azim_mcell V f u0 u1 /\ + cc_gg_v11 (cc_data_v8 V f u0 u1) = gg_mcell V f u0 u1 /\ + cc_gg3a_v11 (cc_data_v8 V f u0 u1) = (\i. gammaX V (cc_cell V [u0;u1;f i]) lmfun * critical_weight V (cc_cell V [u0;u1;f i])) /\ + cc_gg3b_v11 (cc_data_v8 V f u0 u1) = (\i. gammaX V (cc_cell V [u1;u0;f(SUC i)]) lmfun * critical_weight V (cc_cell V [u1;u0;f (SUC i)]))`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[FUN_EQ_THM;Oxl_def.cc_azim_v11;Oxl_def.cc_gg_v11;Oxl_def.cc_gg3a_v11;Oxl_def.cc_gg3b_v11;Oxl_def.cc_real_v11;cc_data_v8;Oxl_def.cc_v11;Bump.EL_EXPLICIT]) + ]);; + (* }}} *) + +let cc_bool_data = prove_by_refinement( + `!V f u0 u1. cc_subcrit_v11 (cc_data_v8 V f u0 u1) = (\i. dist(f i,f(SUC i)) < &2 * hminus) + /\ + cc_crit_v11 (cc_data_v8 V f u0 u1) = (\i. &2 * hminus <= dist (f i, f (SUC i)) /\ dist (f i,f(SUC i)) <= &2 *hplus) /\ + cc_supercrit_v11 (cc_data_v8 V f u0 u1) = (\i. &2 *hplus < dist (f i, f(SUC i))) /\ + cc_small_v11 (cc_data_v8 V f u0 u1) = (\i. dist(u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ + cc_small_eta_v11 (cc_data_v8 V f u0 u1) = (\i. hl [u0;u1;f i] < #1.34) /\ + cc_4cell_v11 (cc_data_v8 V f u0 u1) = + (\i. ?ul. barV V 3 ul /\ {u0,u1} IN edgeX V (mcell4 V ul) /\ mcell4 V ul SUBSET (wedge_ge u0 u1 (f i) (f (SUC i)))) +`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[FUN_EQ_THM;Oxl_def.cc_subcrit_v11;Oxl_def.cc_crit_v11;Oxl_def.cc_supercrit_v11;Oxl_def.cc_small_v11;Oxl_def.cc_small_eta_v11;Oxl_def.cc_4cell_v11;Oxl_def.cc_bool_v11;cc_data_v8;Oxl_def.cc_v11;Bump.EL_EXPLICIT]) + ]);; + (* }}} *) + +let cc_bool_model_data = prove_by_refinement( + `!V f w0 n u0 u1. + pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ saturated V /\ s_leaf V [u0;u1] HAS_SIZE n /\ + u0 IN V /\ u1 IN V /\ + ~collinear {u0, u1, w0 } /\ + critical_edge_y (dist(u0,u1)) /\ + leaf_rank V [u0;u1] w0 n f ==> + cc_bool_model_v11 (cc_data_v8 V f u0 u1)`, + (* {{{ proof *) + [ + REWRITE_TAC[Oxl_def.cc_bool_model_v11;cc_card_data]; + REWRITE_TAC[HAS_SIZE]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_SIMP_TAC[arith `1 < n==> ~(n = 0)`]); + TYPIFY `(!i. ~(cc_crit_v11 (cc_data_v8 V f u0 u1) i /\ cc_supercrit_v11 (cc_data_v8 V f u0 u1) i)) /\ (!i. ~(cc_crit_v11 (cc_data_v8 V f u0 u1) i /\ cc_subcrit_v11 (cc_data_v8 V f u0 u1) i)) /\ (!i. ~(cc_supercrit_v11 (cc_data_v8 V f u0 u1) i /\ cc_subcrit_v11 (cc_data_v8 V f u0 u1) i))` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + REWRITE_TAC[cc_bool_data]; + INTRO_TAC Merge_ineq.hminus_lt_hplus []; + BY(REAL_ARITH_TAC); + TYPIFY `periodic (cc_subcrit_v11 (cc_data_v8 V f u0 u1)) n /\ periodic (cc_crit_v11 (cc_data_v8 V f u0 u1)) n /\ periodic (cc_supercrit_v11 (cc_data_v8 V f u0 u1)) n /\ periodic (cc_small_v11 (cc_data_v8 V f u0 u1)) n /\ periodic (cc_small_eta_v11 (cc_data_v8 V f u0 u1)) n /\ periodic (cc_4cell_v11 (cc_data_v8 V f u0 u1)) n` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + REWRITE_TAC[Oxl_def.periodic;cc_bool_data;cc_real_data]; + REWRITE_TAC[arith `!i. SUC(i + n) = SUC i + n`]; + INTRO_TAC LEAF_RANK_PERIODIC [`V`;`[u0;u1]`;`w0`;`n`;`f`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[Oxl_def.periodic]; + BY(MESON_TAC[]); + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[cc_bool_data]; + BY(REAL_ARITH_TAC); + REWRITE_TAC[cc_bool_data]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `f i IN s_leaf V [u0;u1]` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM_ST `leaf_rank` MP_TAC; + REWRITE_TAC[leaf_rank;EXTENSION;IN_IMAGE;IN_UNIV]; + BY(MESON_TAC[]); + REWRITE_TAC[IN;s_leaf;Bump.EL_EXPLICIT]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `f i IN V` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `leaf` MP_TAC; + REWRITE_TAC[Leaf_cell.leaf;IN]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP Packing3.BARV_SUBSET)); + REWRITE_TAC[set_of_list;SUBSET;IN_INSERT;NOT_IN_EMPTY]; + BY(MESON_TAC[IN]); + TYPIFY `~collinear {u0,u1,f i}` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[u0;u1;f i]`]; + BY(ASM_REWRITE_TAC[set_of_list]); + COMMENT "symmetry reduction"; + TYPIFY `!v0 v1 ff. v0 IN V /\ v1 IN V /\ ~collinear {v0,v1,ff} /\ ff IN V /\ critical_edge_y( dist(v0,v1)) /\ dist(v0,ff) <= dist(v1,ff) /\ hl [v0;v1;ff] < #1.34 ==> dist(v1,ff) < &2 * hminus` ENOUGH_TO_SHOW_TAC; + DISCH_TAC; + TYPIFY `dist(u0,f i) <= dist(u1,f i)` ASM_CASES_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`u0`;`u1`;`f i`]); + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + COMMENT "second half of symmetry reduction"; + FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP (arith `~(x <= y) ==> (y <= x)`))); + FIRST_X_ASSUM (C INTRO_TAC [`u1`;`u0`;`f i`]); + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + TYPIFY `{u1,u0,f i} = {u0,u1,f i}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + BY(ASM_MESON_TAC[DIST_SYM]); + FIRST_X_ASSUM_ST `hl` MP_TAC; + REWRITE_TAC[Pack_defs.HL;set_of_list]; + TYPIFY `{u0,u1,f i } = {u1,u0, f i}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(REWRITE_TAC[]); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + COMMENT "symmetry reduction complete"; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC JSPEVYT_EXPLICIT; + TYPIFY `v0` EXISTS_TAC; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + CONJ_TAC; + FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; + REWRITE_TAC[Sphere.critical_edge_y]; + BY(REAL_ARITH_TAC); + TYPIFY `~(v0 = ff)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]); + FIRST_X_ASSUM_ST `packing` MP_TAC; + REWRITE_TAC[Sphere.packing]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_MESON_TAC[IN]) + ]);; + (* }}} *) + +let cc_prep_model_data = prove_by_refinement( + `!V f w0 n u0 u1. + 1 < n /\ + packing V /\ saturated V /\ + ~collinear {u0, u1, w0 } /\ + leaf_rank V [u0;u1] w0 n f ==> + cc_bool_prep_v11 (cc_data_v8 V f u0 u1)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Oxl_def.cc_bool_prep_v11;Oxl_def.cc_qy_v11;cc_bool_data]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `periodic f n` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); + TYPIFY `~(n = 0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + TYPIFY `cc_uh V [u0;u1;f (i + 1)]` EXISTS_TAC; + TYPIFY `!j. leaf V [u0; u1; f j]` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + INTRO_TAC s_leaf_leaf[`V`;`[u0;u1]`;`f j`]; + REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_THEN MATCH_MP_TAC; + REWRITE_TAC[IN]; + MATCH_MP_TAC LEAF_RANK_S_LEAF; + BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); + SUBCONJ_TAC; + BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); + DISCH_TAC; + FIRST_X_ASSUM_ST `?` (MP_TAC o (REWRITE_RULE[NOT_EXISTS_THM])); + DISCH_TAC; + INTRO_TAC Leaf_cell.CC_KE_34 [`V`;`[u0;u1;f(i+1)]`]; + DISCH_THEN (MP_TAC o (MATCH_MP (TAUT `a \/ b ==> b \/ a`))); + DISCH_THEN DISJ_CASES_TAC; + TYPIFY `mcell4 V (cc_uh V [u0;u1;f(i+1)]) = cc_cell V [u0;u1;f (i + 1)]` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell;Bump.MCELL4]); + INTRO_TAC Leaf_cell.EL_CC_UH [`V`;`[u0;u1;f (i+1)]`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[Bump.EL_EXPLICIT]; + REPEAT WEAKER_STRIP_TAC; + SUBCONJ_TAC; + INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[u0;u1;f(i+1)]`]; + BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); + DISCH_TAC; + INTRO_TAC K4_CC_WI_ALT [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i+1`]; + REWRITE_TAC[Bump.EL_EXPLICIT]; + BY(ASM_REWRITE_TAC[]); + COMMENT "now k=3"; + TYPIFY `cc_ke V [u1;u0;f (i+1)] = 4` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `s_leaf V [u0;u1] (f(i+1))` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[LEAF_RANK_S_LEAF]); + GMATCH_SIMP_TAC S_LEAF_SYM; + ASM_REWRITE_TAC[]; + REWRITE_TAC[s_leaf;Bump.EL_EXPLICIT]; + BY(ASM_MESON_TAC[arith `~(3=4)`]); + INTRO_TAC K4_CC_WIM [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i+1`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + TYPIFY `wedge_ge u0 u1 (f ((i + 1) + n - 1)) (f (i + 1)) = wedge_ge u0 u1 (f i) (f (SUC i))` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[arith `i + 1 = SUC i`]; + ASM_SIMP_TAC[arith `1 < n ==> SUC i + n - 1 = 1*n + i`]; + TYPIFY `f (1 * n + i) = f i` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[]); + MATCH_MP_TAC PERIODIC_EQ_IMAGE; + TYPIFY `n` EXISTS_TAC; + BY(ASM_REWRITE_TAC[MOD_MULT_ADD]); + FIRST_X_ASSUM (C INTRO_TAC [`cc_uh V [u1;u0;f (i+1)]`]); + TYPIFY `mcell4 V (cc_uh V [u1; u0; f (i + 1)]) = cc_cell V [u1; u0; f (i + 1)]` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell;Bump.MCELL4]); + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `barV` MP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `leaf V [u1;u0;f (i+1)]` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC Leaf_cell.ZASUVOR [`V`;`u0`;`u1`;`f (i+1)`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY(MESON_TAC[]); + CONJ_TAC; + BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); + INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[u1;u0;f(i+1)]`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[Bump.EL_EXPLICIT]; + TYPIFY `{u1,u0} = {u0,u1}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let LEAF_DOMAIN = prove_by_refinement( + `!V ul. saturated V /\ + packing V /\ + leaf V ul ==> + ~collinear {EL 0 ul,EL 1 ul,EL 2 ul} /\ + &2 <= dist (EL 1 ul,EL 2 ul) /\ + &2 <= dist (EL 0 ul,EL 2 ul) /\ + &2 <= dist (EL 0 ul,EL 1 ul) /\ + dist (EL 1 ul,EL 2 ul) < &2 * sqrt (&2) /\ + dist (EL 0 ul,EL 2 ul) < &2 * sqrt (&2) /\ + dist (EL 0 ul,EL 1 ul) < &2 * sqrt (&2) /\ + eta_y (dist (EL 0 ul,EL 1 ul)) (dist (EL 0 ul,EL 2 ul)) + (dist (EL 1 ul,EL 2 ul)) < + sqrt (&2)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `barV V 2 ul` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Leaf_cell.leaf;IN]; + BY(MESON_TAC[]); + TYPIFY `ul = [EL 0 ul;EL 1 ul;EL 2 ul]` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Bump.LENGTH3; + REWRITE_TAC[arith `3 = 2 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; + BY(ASM_MESON_TAC[]); + TYPIFY `truncate_simplex 2 ul = ul` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM SUBST1_TAC; + BY(REWRITE_TAC[Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_2]); + GMATCH_SIMP_TAC (GSYM RADV_ETAY); + TYPIFY `hl ( ul) < sqrt(&2)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `leaf` MP_TAC; + REWRITE_TAC[Leaf_cell.leaf]; + BY(MESON_TAC[Sphere.sqrt2]); + COMMENT "deal with radV"; + TYPIFY `radV {EL 0 ul, EL 1 ul, EL 2 ul} < sqrt (&2)` (C SUBGOAL_THEN ASSUME_TAC); + (FIRST_X_ASSUM_ST `hl` MP_TAC THEN ASM_REWRITE_TAC[Pack_defs.HL;set_of_list]); + BY(FIRST_X_ASSUM_ST `EL` SUBST1_TAC THEN REWRITE_TAC[set_of_list;Bump.EL_EXPLICIT]); + TYPIFY `~collinear {EL 0 ul,EL 1 ul,EL 2 ul}` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC Leaf_cell.GBEWYFX [`V`;`ul`]; + FIRST_ASSUM_ST `CONS (EL 0 ul)` SUBST1_TAC; + REWRITE_TAC[Bump.EL_EXPLICIT;set_of_list]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[]; + TYPIFY `~affine_dependent {EL 0 ul,EL 1 ul,EL 2 ul}` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[AFFINE_DEPENDENT_IMP_COLLINEAR_3]); + TYPIFY `!x y. {x,y} SUBSET {EL 0 ul,EL 1 ul,EL 2 ul} ==> dist(x,y) < &2 * sqrt(&2)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `x < &2 * y <=> inv(&2) * x < y`]; + REWRITE_TAC[GSYM RADV2]; + MATCH_MP_TAC REAL_LET_TRANS; + TYPIFY `radV {EL 0 ul, EL 1 ul, EL 2 ul}` EXISTS_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC Rogers.RADV_MONO; + ASM_REWRITE_TAC[EXTENSION;IN_INSERT;NOT_IN_EMPTY]; + BY(MESON_TAC[]); + INTRO_TAC Packing3.BARV_SUBSET [`V`;`2`;`ul`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `set_of_list ul = {EL 0 ul,EL 1 ul,EL 2 ul}` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_ASSUM_ST `CONS (EL 0 ul)` SUBST1_TAC; + BY(REWRITE_TAC[Bump.EL_EXPLICIT;set_of_list]); + TYPIFY `~(EL 0 ul = EL 1 ul) /\ ~(EL 1 ul = EL 2 ul) /\ ~(EL 0 ul = EL 2 ul)` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `{EL 0 ul,EL 1 ul, EL 2 ul} = {EL 1 ul,EL 2 ul,EL 0 ul}` (C SUBGOAL_THEN ASSUME_TAC); + BY(SET_TAC[]); + BY(ASM_MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]); + TYPIFY `&2 <= dist (EL 1 ul,EL 2 ul) /\ &2 <= dist (EL 0 ul,EL 2 ul) /\ &2 <= dist (EL 0 ul,EL 1 ul)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + FIRST_X_ASSUM_ST `packing` MP_TAC; + REWRITE_TAC[Sphere.packing]; + FIRST_X_ASSUM_ST `SUBSET` MP_TAC; + ASM_REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[IN]; + BY(ASM_MESON_TAC[]); + BY(REPEAT (CONJ_TAC THEN (TRY (FIRST_X_ASSUM MATCH_MP_TAC))) THEN SET_TAC[]) + ]);; + (* }}} *) + +let CELL_CLUSTER_N_LE_1 = prove_by_refinement( + `!V u0 u1. pack_nonlinear_non_ox3q1h /\ packing V /\ saturated V /\ hminus <= hl [u0; u1] /\ + hl [u0; u1] <= hplus /\ CARD(s_leaf V [u0;u1]) <= 1 ==> + &0 <= sum {X | {u0, u1} IN edgeX V X /\ mcell_set V X} + (\X. gammaX V X lmfun * critical_weight V X + + beta_bump_v1 V {u0, u1} X)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `?ul. {u0,u1} IN edgeX V (mcell4 V ul) /\ barV V 3 ul` ASM_CASES_TAC; + FIRST_X_ASSUM MP_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Leaf_cell.MCELL4_EDGE_FIRST [`V`;`ul`;`u0`;`u1`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[IN]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC S_LEAF_CARD2 [`V`;`vl`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + FIRST_X_ASSUM (SUBST1_TAC o GSYM); + REWRITE_TAC[Bump.MCELL4]; + DISCH_THEN (MP_TAC o (MATCH_MP Bump.RIJRIED)); + REWRITE_TAC[EXTENSION;NOT_IN_EMPTY]; + BY(ASM_MESON_TAC[Bump.MCELL4]); + FIRST_X_ASSUM_ST `CARD` MP_TAC; + ASM_REWRITE_TAC[]; + BY(ARITH_TAC); + COMMENT "now sum over 0--3 sums and use positivity."; + MATCH_MP_TAC SUM_POS_LE; + CONJ_TAC; + REWRITE_TAC[IN]; + ONCE_REWRITE_TAC[TAUT `!a b. a /\ b <=> b /\ a`]; + MATCH_MP_TAC Marchal_cells_3.FINITE_EDGE_X2; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[IN_ELIM_THM;Qzyzmjc.mcell_set_2]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `edgeX` MP_TAC; + FIRST_X_ASSUM_ST `mcell` SUBST1_TAC; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `i <= 4` MP_TAC; + REWRITE_TAC[arith `i <= 4 <=> (i <= 1) \/ (i = 4) \/ (i = 2) \/ (i = 3)`]; + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_MESON_TAC[Bump.EDGE_IMP_K2;NOT_IN_EMPTY;IN]); + FIRST_X_ASSUM DISJ_CASES_TAC; + BY(ASM_MESON_TAC[IN;Bump.MCELL4]); + REWRITE_TAC[arith `&0 <= x <=> x >= &0`]; + MATCH_MP_TAC GAMMAX_NO_BETA; + GEXISTL_TAC [`ul`;`i`]; + ASM_SIMP_TAC[arith `i = 2 \/ i = 3 ==> i < 4`]; + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + CONJ_TAC; + BY(ASM_MESON_TAC[Bump.RIJRIED;NOT_IN_EMPTY]); + CONJ_TAC; + REWRITE_TAC[Pack_defs.critical_edgeX;IN_ELIM_THM]; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM DISJ_CASES_TAC; + MATCH_MP_TAC Tskajxy.TSKAJXY_2; + BY(ASM_MESON_TAC[IN;Bump.MCELL2]); + TYPIFY `~NULLSET (mcell 3 V ul)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Bump.RIJRIED;NOT_IN_EMPTY]); + MATCH_MP_TAC TSKAJXY_3; + BY(ASM_MESON_TAC[IN;Bump.MCELL3]) + ]);; + (* }}} *) + +let RAD_PI_IMP_WEDGE4 = prove_by_refinement( + `!V f w0 n i u0 u1. + 1 < n /\ + packing V /\ saturated V /\ + ~collinear {u0, u1, w0 } /\ + leaf_rank V [u0;u1] w0 n f /\ + azim u0 u1 (f i) (f (SUC i)) < pi /\ + radV {u0,u1,f i,f (SUC i)} < sqrt(&2) ==> + (?ul. mcell4 V ul SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ + barV V 3 ul /\ + {u0,u1} IN edgeX V (mcell4 V ul))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~coplanar {u0,u1,f i , f (SUC i)}` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[ (GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR)]; + DISCH_THEN DISJ_CASES_TAC; + INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`;`SUC i`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`;arith `SUC i = i + 1`]; + BY(ASM_MESON_TAC[ MOD_INJ1_ALT;arith `1 < n ==> ~(n = 0) /\ ~(1 = 0)`]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `!j. leaf V [u0; u1; f j]` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + INTRO_TAC s_leaf_leaf[`V`;`[u0;u1]`;`f j`]; + REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_THEN MATCH_MP_TAC; + REWRITE_TAC[IN]; + MATCH_MP_TAC LEAF_RANK_S_LEAF; + BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); + INTRO_TAC HL_IMP_BARV [`V`;`[u0;u1;f i;f (SUC i)]`]; + ANTS_TAC; + ASM_REWRITE_TAC[set_of_list]; + REWRITE_TAC[LENGTH;arith `SUC(SUC(SUC(SUC 0))) = 4`]; + TYPIFY `set_of_list [u0;u1;f i] SUBSET V` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC Packing3.BARV_SUBSET; + TYPIFY `2` EXISTS_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`i`]); + REWRITE_TAC[Leaf_cell.leaf;IN]; + BY(MESON_TAC[]); + TYPIFY `set_of_list [u0;u1;f (SUC i)] SUBSET V` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC Packing3.BARV_SUBSET; + TYPIFY `2` EXISTS_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`SUC i`]); + REWRITE_TAC[Leaf_cell.leaf;IN]; + BY(MESON_TAC[]); + REWRITE_TAC[set_of_list;SUBSET;IN_INSERT;NOT_IN_EMPTY]; + REPEAT WEAKER_STRIP_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + BY(ASM_REWRITE_TAC[Pack_defs.HL;set_of_list]); + REWRITE_TAC[Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_2]; + FIRST_X_ASSUM (C INTRO_TAC [`i`]); + REWRITE_TAC[Leaf_cell.leaf]; + BY(MESON_TAC[IN]); + DISCH_TAC; + COMMENT "now pick ul"; + TYPIFY `[u0;u1;f i;f(SUC i)]` EXISTS_TAC; + TYPIFY `~NULLSET (mcell4 V [u0; u1; f i; f (SUC i)])` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[Pack_defs.mcell4;Pack_defs.HL;set_of_list]; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP Leaf_cell.ZWVCBMN)); + BY(MESON_TAC[Vol1.VOLUME_PROPS_NULLSET;arith `x = &0 ==> ~(&0 < x)`]); + ASM_REWRITE_TAC[]; + CONJ2_TAC; + GMATCH_SIMP_TAC Bump.MCELL4_EDGE; + CONJ_TAC; + BY(ASM_REWRITE_TAC[]); + CONJ2_TAC; + REWRITE_TAC[set_of_list]; + BY(SET_TAC[]); + BY(ASM_MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]); + (COMMENT "now place it in wedge"); + GMATCH_SIMP_TAC MCELL4_CONVEX_HULL; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + GMATCH_SIMP_TAC Local_lemmas.WEDGE_GE_EQ_AFF_GE; + ASM_REWRITE_TAC[]; + INTRO_TAC LEAF_RANK_COLLINEAR [`V`;`[u0;u1]`;`w0`;`n`;`f`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_TAC; + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[Marchal_cells_2_new.CONVEX_HULL_4_SUBSET_AFF_GE_2_2]) + ]);; + (* }}} *) + +let LEAF_RANK_SUC_INJ = prove_by_refinement( + `!V u0 u1 w0 n f i. + packing V /\ + saturated V /\ + leaf_rank V [u0;u1] w0 n f /\ + ~collinear {u0,u1,w0} /\ + 1 < n ==> + ~(f i = f (SUC i))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`;`SUC i`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`;arith `SUC i = i + 1`]; + REWRITE_TAC[AZIM_REFL]; + BY(ASM_MESON_TAC[ MOD_INJ1_ALT;arith `1 < n ==> ~(n = 0) /\ ~(1 = 0)`]) + ]);; + (* }}} *) + +let DIST_I_SUCI = prove_by_refinement( + `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ saturated V /\ + ~collinear {u0, u1, w0 } /\ + leaf_rank V [u0;u1] w0 n f ==> + &2 <= dist (f i,f (SUC i))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!j. leaf V [u0; u1; f j]` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + INTRO_TAC s_leaf_leaf[`V`;`[u0;u1]`;`f j`]; + REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_THEN MATCH_MP_TAC; + REWRITE_TAC[IN]; + MATCH_MP_TAC LEAF_RANK_S_LEAF; + BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); + INTRO_TAC Packing3.BARV_SUBSET [`V`;`2`;`[u0;u1;f i]`]; + ANTS_TAC; + BY(ASM_MESON_TAC[Leaf_cell.leaf;IN]); + INTRO_TAC Packing3.BARV_SUBSET [`V`;`2`;`[u0;u1;f (SUC i)]`]; + ANTS_TAC; + BY(ASM_MESON_TAC[Leaf_cell.leaf;IN]); + REWRITE_TAC[set_of_list]; + REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~(f i = f (SUC i))` (C SUBGOAL_THEN ASSUME_TAC); + ASM_MESON_TAC[LEAF_RANK_SUC_INJ]; + FIRST_X_ASSUM_ST `packing` MP_TAC; + REWRITE_TAC[Sphere.packing]; + BY(ASM_MESON_TAC[IN]) + ]);; + (* }}} *) + +let WEDGE3_Y4 = prove_by_refinement( + `!V f w0 n i u0 u1 y1 y2 y3 y5 y6. + pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ saturated V /\ + ~collinear {u0, u1, w0 } /\ + leaf_rank V [u0;u1] w0 n f /\ + critical_edge_y (dist(u0,u1)) /\ + ~(?vl. barV V 3 vl /\ {u0,u1} IN edgeX V (mcell4 V vl) /\ + mcell4 V vl SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) ) /\ + y1 = dist(u0,u1) /\ + y2 = dist(u0,f i) /\ + y3 = dist(u0,f (SUC i)) /\ + y5 = dist(u1,f (SUC i)) /\ + y6 = dist(u1,f i) +==> (?y4. + &2 <= y4 /\ y4 <= &2 * sqrt(&2) /\ + &0 < delta_y y1 y2 y3 y4 y5 y6 /\ + dih_y y1 y2 y3 y4 y5 y6 <= azim u0 u1 (f i) (f (SUC i)) /\ + &2 <= rad2_y y1 y2 y3 y4 y5 y6 /\ + (azim u0 u1 (f i) (f (SUC i)) < pi /\ dist(f i,f (SUC i)) <= &2 * sqrt(&2) ==> y4 = dist(f i,f(SUC i))))`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.critical_edge_y]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!j. leaf V [u0; u1; f j]` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + INTRO_TAC s_leaf_leaf[`V`;`[u0;u1]`;`f j`]; + REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_THEN MATCH_MP_TAC; + REWRITE_TAC[IN]; + MATCH_MP_TAC LEAF_RANK_S_LEAF; + BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); + INTRO_TAC LEAF_DOMAIN [`V`;`[u0;u1;f i]`]; + INTRO_TAC LEAF_DOMAIN [`V`;`[u0;u1;f (SUC i)]`]; + REWRITE_TAC[Bump.EL_EXPLICIT]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "delta with delta"; + TYPIFY `!y4. &2 <= y4 /\ y4 <= &2 * sqrt(&2) ==> &0 < delta_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) y4 (dist (u1,f (SUC i))) (dist (u1,f i))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "FWGKMBZ"); + REWRITE_TAC[Sphere.y_of_x;GSYM Sphere.delta_y]; + REWRITE_TAC[Sphere.ineq]; + DISCH_THEN (C INTRO_TAC [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]); + REWRITE_TAC[arith `x > &0 <=> &0 < x`]; + ASM_REWRITE_TAC[TAUT `x ==> b ==> c <=> x /\ b ==> c`]; + DISCH_THEN MATCH_MP_TAC; + REWRITE_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2]; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + TYPIFY `&2 <= &2 * sqrt(&2)` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM Sphere.sqrt2]; + MP_TAC Flyspeck_constants.bounds; + BY(REAL_ARITH_TAC); + COMMENT "first case"; + TYPIFY `pi <= azim u0 u1 (f i) (f (SUC i))` ASM_CASES_TAC; + TYPIFY `&2 * sqrt(&2)` EXISTS_TAC; + ASM_SIMP_TAC[arith `pi <= x ==> ~(x < pi)`;arith `x <= x`]; + CONJ_TAC; + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `pi` EXISTS_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `x < y ==> x <= y`); + MATCH_MP_TAC DIH_Y_LT_PI; + CONJ2_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + FIRST_X_ASSUM_ST `hminus` MP_TAC; + BY(MP_TAC Nonlinear_lemma.hminus_gt THEN REAL_ARITH_TAC); + REWRITE_TAC[GSYM Sphere.sqrt2;GSYM Nonlinear_lemma.sqrt8_sqrt2]; + MATCH_MP_TAC RAD2_Y_SQRT8; + ASM_SIMP_TAC[]; + TYPIFY `!y. y < &2 * sqrt(&2) ==> y < &4` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM Sphere.sqrt2]; + MP_TAC Flyspeck_constants.bounds; + BY(REAL_ARITH_TAC); + ASM_SIMP_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`;Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[arith `~(pi <= x) <=> x < pi`]; + DISCH_TAC; + COMMENT "second case"; + TYPIFY `&2 * sqrt(&2) < dist(f i,f (SUC i))` ASM_CASES_TAC; + TYPIFY `&2 * sqrt(&2)` EXISTS_TAC; + ASM_SIMP_TAC[arith `x <= x`;arith `s < d ==> ~(d <= s)`]; + CONJ2_TAC; + REWRITE_TAC[GSYM Sphere.sqrt2;GSYM Nonlinear_lemma.sqrt8_sqrt2]; + MATCH_MP_TAC RAD2_Y_SQRT8; + ASM_SIMP_TAC[]; + TYPIFY `!y. y < &2 * sqrt(&2) ==> y < &4` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[GSYM Sphere.sqrt2]; + MP_TAC Flyspeck_constants.bounds; + BY(REAL_ARITH_TAC); + ASM_SIMP_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`;Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]); + MATCH_MP_TAC REAL_LE_TRANS; + TYPIFY `dihV u0 u1 (f i) (f (SUC i))` EXISTS_TAC; + CONJ2_TAC; + MATCH_MP_TAC Rogers.DIHV_LE_AZIM; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC Merge_ineq.DIHV_EQ_DIH_Y [`u0`;`u1`;`f i`;`f(SUC i)`]; + ASM_SIMP_TAC[LET_DEF;LET_END_DEF]; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF]; + MATCH_MP_TAC (arith `x < y ==> x <= y`); + MATCH_MP_TAC Tame_inequalities.DIH_X_MONO_LT_4; + REWRITE_TAC[GSYM Sphere.delta_y]; + CONJ_TAC; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE; + BY(ASM_SIMP_TAC [arith `&2 <= x ==> abs(x ) = x`]); + CONJ_TAC; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + FIRST_X_ASSUM_ST `hminus` MP_TAC; + BY(MP_TAC Nonlinear_lemma.hminus_gt THEN REAL_ARITH_TAC); + CONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[arith `x <= x`]); + TYPIFY `~coplanar {u0,u1,f i , f (SUC i)}` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[ (GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR)]; + DISCH_THEN DISJ_CASES_TAC; + INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`;`SUC i`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`;arith `SUC i = i + 1`]; + BY(ASM_MESON_TAC[ MOD_INJ1_ALT;arith `1 < n ==> ~(n = 0) /\ ~(1 = 0)`]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[GSYM coplanar_delta_y]); + COMMENT "last case"; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[arith `~(x < d) <=> (d <= x)`]; + DISCH_TAC; + TYPIFY `dist(f i,f (SUC i))` EXISTS_TAC; + ASM_SIMP_TAC[]; + TYPIFY `~(f i = f (SUC i))` (C SUBGOAL_THEN ASSUME_TAC); + DISCH_TAC; + INTRO_TAC LEAF_RANK_AZIM_INJ [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`;`SUC i`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`;arith `SUC i = i + 1`]; + REWRITE_TAC[AZIM_REFL]; + BY(ASM_MESON_TAC[ MOD_INJ1_ALT;arith `1 < n ==> ~(n = 0) /\ ~(1 = 0)`]); + TYPIFY `!i. V (f i)` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + FIRST_X_ASSUM_ST `leaf` MP_TAC; + REWRITE_TAC[Leaf_cell.leaf;IN]; + DISCH_THEN (C INTRO_TAC [`i'`]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Packing3.BARV_SUBSET [`V`;`2`;`[u0;u1;f i']`]; + ASM_REWRITE_TAC[set_of_list;SUBSET;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; + BY(MESON_TAC[IN]); + SUBCONJ_TAC; + FIRST_X_ASSUM_ST `packing` MP_TAC; + REWRITE_TAC[Sphere.packing]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + SUBCONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + COMMENT "azim on last case"; + CONJ_TAC; + INTRO_TAC Rogers.DIHV_LE_AZIM [`u0`;`u1`;`f i`;`f(SUC i)`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + MATCH_MP_TAC (arith `x = y ==> (x <= a ==> y <= a)`); + INTRO_TAC Merge_ineq.DIHV_EQ_DIH_Y [`u0`;`u1`;`f i`;`f(SUC i)`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY(REWRITE_TAC[LET_DEF;LET_END_DEF]); + COMMENT "deal with rad"; + MATCH_MP_TAC (arith `~(x < y) ==> y <= x`); + REWRITE_TAC[Sphere.rad2_y;Sphere.y_of_x;arith `x * x = x pow 2`]; + INTRO_TAC (GSYM GDRQXLGv3) [`u0`;`u1`;`f i`;`f (SUC i)`]; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + ANTS_TAC; + FIRST_X_ASSUM MP_TAC; + BY(MESON_TAC[coplanar_delta_y]); + DISCH_THEN SUBST1_TAC; + DISCH_TAC; + TYPIFY `radV {u0,u1,f i, f(SUC i)} < sqrt(&2)` ENOUGH_TO_SHOW_TAC; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC RAD_PI_IMP_WEDGE4 [`V`;`f`;`w0`;`n`;`i`;`u0`;`u1`]; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `edgeX` MP_TAC; + BY(MESON_TAC[]); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[arith `x < y <=> ~(y <= x)`]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `~` MP_TAC; + REWRITE_TAC[]; + ONCE_REWRITE_TAC[GSYM Nonlin_def.sqrt2_sqrt2]; + REWRITE_TAC[Sphere.sqrt2;arith `x pow 2 = x * x`]; + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + GMATCH_SIMP_TAC Trigonometry2.LT_IMP_ABS_REFL; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_RSQRT; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let cc_4_cc_ke4 = prove_by_refinement( + `!V u0 u1 w0 n f i. + packing V /\ saturated V /\ + leaf_rank V [u0;u1] w0 n f /\ + ~collinear {u0,u1,w0} /\ + periodic f n /\ + 1 < n /\ + leaf V [u0;u1;f i] /\ + cc_4 V u0 u1 f i ==> + cc_ke V [u0;u1;f i] = 4`, + (* {{{ proof *) + [ + REWRITE_TAC[cc_4]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Leaf_cell.MCELL4_EDGE_FIRST [`V`;`ul`;`u0`;`u1`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Leaf_cell.CC_KE_34 [`V`;`[u0;u1;f i]`]; + DISCH_THEN (MP_TAC o (MATCH_MP (TAUT `a \/ b ==> b \/ a`))); + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC K3_CC_WI_ALT [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`]; + ASM_SIMP_TAC[Bump.EL_EXPLICIT]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + TYPIFY `?j. j< n /\ (f i) = (f j) /\ (f (SUC j) = f (SUC i))` (C SUBGOAL_THEN MP_TAC); + TYPIFY `i MOD n` EXISTS_TAC; + INTRO_TAC F_DEMOD [`f`;`n`;`i`]; + BY(ASM_MESON_TAC[DIVISION;arith `1 < n ==> ~(n = 0)`]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[u0;u1;f i]`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_TAC; + INTRO_TAC MCELL4_FULL_WEDGE [`V`;`cc_cell V [u0;u1;f i]`;`vl`;`w0`;`n`;`f`;`j`]; + ANTS_TAC; + ASM_SIMP_TAC[]; + BY(ASM_MESON_TAC[Bump.RIJRIED;NOT_IN_EMPTY;Bump.MCELL4;Leaf_cell.CC_CELL_IN_MCELL_SET;IN]); + DISCH_TAC; + INTRO_TAC Ajripqn.AJRIPQN [`V`;`vl`;`cc_uh V [u0;u1;f i]`;`4`;`3`]; + ASM_REWRITE_TAC[arith `~(4 = 3) /\ ~(3 = 4)`;IN_INSERT]; + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + CONJ_TAC; + BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); + REWRITE_TAC[GSYM Bump.MCELL4]; + TYPIFY `mcell 3 V (cc_uh V [EL 0 vl; EL 1 vl; f j]) = mcell4 V vl` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM (SUBST1_TAC o GSYM); + REWRITE_TAC[Leaf_cell.cc_cell]; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[INTER_IDEMPOT]; + BY(ASM_MESON_TAC[Bump.RIJRIED;NOT_IN_EMPTY;IN;Bump.MCELL4]) + ]);; + (* }}} *) + +let cc_4_cc_cell = prove_by_refinement( + `!V u0 u1 w0 n f i. + packing V /\ + saturated V /\ + periodic f n /\ + leaf V [u0;u1;f i] /\ + leaf_rank V [u0;u1] w0 n f /\ + ~collinear {u0,u1,w0} /\ + 1 < n /\ + cc_4 V u0 u1 f i ==> + gg_mcell V f u0 u1 i = + gammaX V (cc_cell V [u0;u1;f i]) lmfun * critical_weight V (cc_cell V [u0;u1;f i]) + + beta_bump_v1 V {u0,u1} (cc_cell V [u0;u1;f i])`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC cc_4_cc_ke4 [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + INTRO_TAC Leaf_cell.EL_CC_UH [`V`;`[u0;u1;f i]`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `j = (i:num)`; + TYPIFY `mcell4 V (cc_uh V [u0;u1;f j]) = cc_cell V [u0;u1;f j]` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell;Bump.MCELL4]); + INTRO_TAC MCELL4_GG [`V`;`cc_cell V [u0;u1;f i]`;`cc_uh V [u0;u1;f i]`;`w0`;`n`;`f`;`j`]; + ASM_SIMP_TAC[]; + ANTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); + CONJ_TAC; + MATCH_MP_TAC Leaf_cell.CC_CELL_NOT_NULLSET; + BY(ASM_MESON_TAC[]); + INTRO_TAC K4_CC_WI_ALT [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`]; + BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); + DISCH_THEN (SUBST1_TAC o GSYM); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let LEAF_RANK_PROPS = prove_by_refinement( + `!V. packing V /\ saturated V /\ ~cell_cluster_estimate_v1 V /\ pack_nonlinear_non_ox3q1h + ==> (?u0 u1 n w0 f. + 1 < n /\ + s_leaf V [u0;u1] HAS_SIZE n /\ + ~(u0 = u1) /\ + hminus <= hl [u0;u1] /\ hl [u0;u1] <= hplus /\ + ~collinear {u0, u1, w0 } /\ + leaf_rank V [u0;u1] w0 n f /\ + u0 IN V /\ u1 IN V /\ + periodic f n /\ + (!j. leaf V [u0; u1; f j]) /\ + critical_edge_y (dist(u0,u1)) /\ + sum {i | i < n} (gg_mcell V f (u0) (u1)) < &0 /\ + sum {i | i < n} (azim_mcell V f (u0) (u1)) = &2 * pi /\ + (!i. azim_mcell V f u0 u1 i = azim (u0) (u1) (f i) (f (SUC i))) /\ + cc_bool_model_v11 (cc_data_v8 V f u0 u1) /\ + cc_bool_prep_v11 (cc_data_v8 V f u0 u1) + ) `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC CELL_CLUSTER_ESTIMATE_REDUCE [`V`]; + ASM_REWRITE_TAC[NOT_FORALL_THM]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP (TAUT `~(a /\ b /\ d ==>c) ==> a /\ b /\ d /\ ~c`))); + REWRITE_TAC[arith `~(a <= b) <=> b < a`]; + REPEAT WEAKER_STRIP_TAC; + GEXISTL_TAC [`u0`;`u1`]; + TYPED_ABBREV_TAC `(n:num) = CARD(s_leaf V [u0;u1])`; + EXISTS_TAC `n:num`; + TYPIFY `?w0. ~collinear {u0,u1,w0}` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC Trigonometry2.TOW_DISTINCT_POINTS_EXISTS_RD_NOT_COLLINEAR; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `w0` EXISTS_TAC; + INTRO_TAC CELL_CLUSTER_N_LE_1 [`V`;`u0`;`u1`]; + ASM_REWRITE_TAC[arith `&0 <= x <=> ~(x < &0)`;arith `~(n <= 1) <=> 1 < n`]; + DISCH_TAC; + TYPIFY `s_leaf V [u0;u1] HAS_SIZE n` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[ HAS_SIZE]; + MATCH_MP_TAC S_LEAF_FINITE; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC LEAF_RANKING_LEMMA [`V`;`[u0;u1]`;`w0`;`n`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + ASM_SIMP_TAC[arith `1 < n ==> 0 < n`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `f` EXISTS_TAC; + SUBCONJ_TAC; + BY(ASM_REWRITE_TAC[leaf_rank;Bump.EL_EXPLICIT]); + DISCH_TAC; + TYPIFY `!j. leaf V [u0; u1; f j]` (C SUBGOAL_THEN ASSUME_TAC); + GEN_TAC; + INTRO_TAC s_leaf_leaf[`V`;`[u0;u1]`;`f j`]; + REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_THEN MATCH_MP_TAC; + REWRITE_TAC[IN]; + MATCH_MP_TAC LEAF_RANK_S_LEAF; + BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]); + TYPIFY `critical_edge_y (dist(u0,u1))` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[Pack_defs.critical_edge_y]; + REPEAT (FIRST_X_ASSUM_ST `hl` MP_TAC); + REWRITE_TAC[Marchal_cells_3.HL_2]; + BY(REAL_ARITH_TAC); + TYPIFY `u0 IN V /\ u1 IN V` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `u0 IN V /\ u1 IN V` (C SUBGOAL_THEN (unlist ASM_REWRITE_TAC)); + INTRO_TAC Packing3.BARV_SUBSET [`V`;`2`;`[u0;u1;f 0]`]; + ANTS_TAC; + BY(ASM_MESON_TAC[Leaf_cell.leaf;IN;Sphere.BARV]); + REWRITE_TAC[Bump.set_of_list3_explicit]; + BY(SET_TAC[]); + ASM_REWRITE_TAC[]; + INTRO_TAC LEAF_RANK_GG_SUM [`V`;`[u0;u1]`;`w0`;`n`;`f`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_THEN SUBST1_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC[ LEAF_RANK_PERIODIC]); + CONJ_TAC; + ONCE_REWRITE_TAC[TAUT `!a b. a /\ b <=> b /\ a`]; + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + INTRO_TAC LEAF_RANK_GRUTOTI [`V`;`[u0;u1]`;`w0`;`n`;`f`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_THEN MATCH_MP_TAC; + MATCH_MP_TAC REAL_LET_TRANS; + TYPIFY `hplus` EXISTS_TAC; + ASM_REWRITE_TAC[]; + MP_TAC Flyspeck_constants.bounds; + BY(REAL_ARITH_TAC); + CONJ_TAC; + GEN_TAC; + INTRO_TAC LEAF_RANK_REUHADY [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`]; + BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); + CONJ_TAC; + MATCH_MP_TAC cc_bool_model_data; + GEXISTL_TAC [`w0`;`n`]; + BY(ASM_REWRITE_TAC[]); + MATCH_MP_TAC cc_prep_model_data; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let cc_real_dat_def = prove_by_refinement( + `!V f u0 u1. + cc_qx_v11 (cc_data_v8 V f u0 u1) = + (\i. cc_4 V u0 u1 f i /\ + ~(dist (u0,f i) < &2 * hminus /\ + dist (u1,f i) < &2 * hminus /\ + dist (u0,f (i + 1)) < &2 * hminus /\ + dist (u1,f (i + 1)) < &2 * hminus /\ + dist (f i,f (SUC i)) < &2 * hminus)) /\ + cc_qy_v11 (cc_data_v8 V f u0 u1) = (\i. ~cc_4 V u0 u1 f i) /\ + cc_qu_v11 (cc_data_v8 V f u0 u1) = + (\i. cc_4 V u0 u1 f i /\ + (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ + dist (u0,f (i + 1)) < &2 * hminus /\ + dist (u1,f (i + 1)) < &2 * hminus /\ + dist (f i,f (SUC i)) < &2 * hminus) /\ + cc_hassmall_v11 (cc_data_v8 V f u0 u1) = + (\i. (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ + dist (u0,f (i + 1)) < &2 * hminus /\ + dist (u1,f (i + 1)) < &2 * hminus)`, + (* {{{ proof *) + [ + REWRITE_TAC[FUN_EQ_THM;Oxl_def.cc_subcrit_v11;Oxl_def.cc_crit_v11;Oxl_def.cc_supercrit_v11;Oxl_def.cc_small_v11;Oxl_def.cc_small_eta_v11;Oxl_def.cc_4cell_v11;Oxl_def.cc_bool_v11;cc_data_v8;Oxl_def.cc_v11;Bump.EL_EXPLICIT;Oxl_def.cc_qx_v11;Oxl_def.cc_qy_v11;Oxl_def.cc_hassmall_v11;Oxl_def.cc_qu_v11;GSYM cc_4]; + REPEAT WEAKER_STRIP_TAC; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let real_periodic_data = prove_by_refinement( + `!V u0 u1 f n . + periodic f n ==> +periodic (azim_mcell V f u0 u1) n /\ + periodic (gg_mcell V f u0 u1) n /\ + periodic (\i. gammaX V (cc_cell V [u0; u1; f i]) lmfun) n /\ + periodic (\i. gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun) n /\ + periodic (\i. gammaX V (cc_cell V [u0; u1; f i]) lmfun * critical_weight V (cc_cell V [u0; u1; f i])) n /\ + periodic (\i. gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun * critical_weight V (cc_cell V [u1; u0; f (SUC i)])) n +`, + (* {{{ proof *) + [ + REWRITE_TAC[Oxl_def.periodic;azim_mcell;gg_mcell;Pack_defs.critical_weight]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `!i. SUC (i+n) = SUC i + n`]; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let LEAF_RANK_LEAF = prove_by_refinement( + `!V u0 u1 w0 n f i. + leaf_rank V [u0;u1] w0 n f + ==> + leaf V [u0;u1;f i]`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC s_leaf_leaf[`V`;`[u0;u1]`;`f i`]; + REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_THEN MATCH_MP_TAC; + REWRITE_TAC[IN]; + MATCH_MP_TAC LEAF_RANK_S_LEAF; + BY(ASM_MESON_TAC[LEAF_RANK_TRUNCATE]) + ]);; + (* }}} *) + + +let cc_4_UL = prove_by_refinement( + `!V u0 u1 w0 n f i. + packing V /\ + saturated V /\ + leaf_rank V [u0;u1] w0 n f /\ + ~collinear {u0,u1,w0} /\ + 1 < n /\ + cc_4 V u0 u1 f i + ==> + cc_cell V [u0;u1;f i] = mcell4 V [u0;u1;f i; f (SUC i)] + `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC cc_4_cc_ke4 [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ASM_SIMP_TAC[]; + ANTS_TAC; + BY(ASM_MESON_TAC[LEAF_RANK_PERIODIC;LEAF_RANK_LEAF]); + DISCH_TAC; + INTRO_TAC CC_CELL_WEDGE_MATCH_UH [`V`;`[u0;u1;f i]`;`u0`;`u1`;`w0`;`n`;`f`;`i`;`i`]; + ANTS_TAC; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + INTRO_TAC K4_CC_WI_ALT [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`]; + BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); + ASM_SIMP_TAC[Geomdetail.PAIR_EQ_EXPAND]; + DISCH_THEN DISJ_CASES_TAC; + INTRO_TAC Leaf_cell.LIST_OF_CC_UH [`V`;`[u0;u1;f i]`]; + ASM_REWRITE_TAC[Leaf_cell.cc_cell]; + ANTS_TAC; + MATCH_MP_TAC LEAF_RANK_LEAF; + BY(ASM_MESON_TAC[]); + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[Bump.MCELL4;Bump.EL_EXPLICIT]); + BY(ASM_MESON_TAC[LEAF_RANK_SUC_INJ]) + ]);; + (* }}} *) + +let EDGEX_PAIR = prove_by_refinement( + `!V X e. e IN edgeX V X ==> (?u v. e = {u,v} /\ ~(u = v))`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.edgeX;IN_ELIM_THM]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let MCELL4_EDGE_EXPLICIT = prove_by_refinement( + `!V u0 u1 u2 u3. + packing V /\ saturated V /\ ~NULLSET (mcell4 V [u0;u1;u2;u3]) /\ barV V 3 [u0;u1;u2;u3] ==> + edgeX V (mcell4 V [u0;u1;u2;u3]) = {{u0,u1},{u0,u2},{u0,u3},{u1,u2},{u1,u3},{u2,u3}}`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[EXTENSION]; + GEN_TAC; + TYPIFY `~(?u v. x = {u,v})` ASM_CASES_TAC; + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(ASM_MESON_TAC[EDGEX_PAIR]); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC Bump.MCELL4_EDGE [`V`;`[u0;u1;u2;u3]`;`u`;`v`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[set_of_list]; + INTRO_TAC MCELL4_CARD4 [`V`;`[u0;u1;u2;u3]`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_THEN (MP_TAC o (MATCH_MP Leaf_cell.CARD4_ALL_DISTINCT)); + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; + REWRITE_TAC[IN_INSERT;SUBSET;NOT_IN_EMPTY]; + TYPIFY `(u = u0)` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]); + TYPIFY `(u = u1)` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]); + TYPIFY `(u = u2)` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]); + TYPIFY `(u= u3)` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let CC_4_PROPS = prove_by_refinement( + `!V u0 u1 w0 n f i. + packing V /\ + saturated V /\ + leaf_rank V [u0;u1] w0 n f /\ + ~collinear {u0,u1,w0} /\ + 1 < n /\ + cc_4 V u0 u1 f i ==> + cc_ke V [u0; u1; f i] = 4 /\ + hl [u0;u1;f i;f (SUC i)] < sqrt(&2) /\ + convex hull {u0,u1,f i,f (SUC i)} = cc_cell V [u0;u1;f i] /\ + ~coplanar {u0,u1,f i, f (SUC i)} /\ + cc_cell V [u0; u1; f i] SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ + cc_cell V [u0; u1; f i] = mcell4 V [u0; u1; f i; f (SUC i)] /\ + ~collinear {u0,u1,f i} /\ + ~collinear {u0,u1,f (SUC i)} /\ + leaf V [u0; u1; f i] /\ + leaf V [u0; u1; f (SUC i)] /\ + ~NULLSET (cc_cell V [u0; u1; f i]) /\ + barV V 3 [u0;u1;f i;f (SUC i)]`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + INTRO_TAC LEAF_RANK_LEAF [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + INTRO_TAC LEAF_RANK_LEAF [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + INTRO_TAC cc_4_cc_ke4 [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ASM_SIMP_TAC[]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + BY(ASM_MESON_TAC[LEAF_RANK_PERIODIC]); + DISCH_TAC; + INTRO_TAC K4_CC_WI_ALT [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); + REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_TAC; + INTRO_TAC cc_4_UL [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC Leaf_cell.EL_CC_UH [`V`;`[u0;u1;f i]`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Leaf_cell.CC_CELL_NOT_NULLSET [`V`;`[u0;u1;f i]`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + TYPIFY `hl [u0;u1;f i;f (SUC i)] < sqrt(&2)` (C SUBGOAL_THEN ASSUME_TAC); + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `NULLSET` MP_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_REWRITE_TAC[Pack_defs.mcell4;NEGLIGIBLE_EMPTY]); + TYPIFY `convex hull {u0,u1,f i,f (SUC i)} = cc_cell V [u0;u1;f i]` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[]; + BY(ASM_REWRITE_TAC[Pack_defs.mcell4;set_of_list]); + TYPIFY `~coplanar {u0,u1,f i,f (SUC i)}` (C SUBGOAL_THEN ASSUME_TAC); + ONCE_REWRITE_TAC[GSYM COPLANAR_CONVEX_HULL_COPLANAR]; + DISCH_THEN (MP_TAC o (MATCH_MP COPLANAR_IMP_NEGLIGIBLE)); + BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE]); + INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[u0;u1;f (SUC i)]`]; + ASM_REWRITE_TAC[set_of_list]; + PROOF_BY_CONTR_TAC; + INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[u0;u1;f i]`]; + ASM_REWRITE_TAC[set_of_list]; + PROOF_BY_CONTR_TAC; + COMMENT "barV"; + INTRO_TAC MCELL4_BARV_FI [`V`;`cc_uh V [u0;u1;f i]`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); + TYPIFY `mcell4 V (cc_uh V [u0; u1; f i]) = cc_cell V [u0;u1;f i]` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Leaf_cell.cc_cell;Bump.MCELL4]); + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let CC_4_BETA_BUMP_EXPLICIT = prove_by_refinement( + `!V u0 u1 w0 n f i. + packing V /\ + saturated V /\ + leaf_rank V [u0;u1] w0 n f /\ + ~collinear {u0,u1,w0} /\ + 1 < n /\ + cc_4 V u0 u1 f i /\ + critical_edge_y (dist(u0,u1)) /\ + critical_edge_y (dist(f i, f (SUC i))) /\ + dist(u0,f i) < &2 * hminus /\ + dist(u0,f(SUC i)) < &2 * hminus /\ + dist(u1,f i) < &2 * hminus /\ + dist(u1,f(SUC i)) < &2 * hminus ==> + beta_bump_v1 V {u0,u1} (cc_cell V [u0;u1;f i]) = + bump (dist(u0,u1)/ &2) - bump (dist(f i,f (SUC i))/ &2) + `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `beta_bump_v1` MP_TAC; + REWRITE_TAC[]; + INTRO_TAC Bump.BETA_BUMP_ALT [`V`;`cc_cell V [u0;u1;f i]`;`(\e. VX V (cc_cell V [u0;u1;f i]) DIFF e)`;`{u0,u1}`]; + ANTS_TAC; + REWRITE_TAC[]; + TYPIFY `packing V /\ saturated V` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(ASM_REWRITE_TAC[]); + ONCE_REWRITE_TAC[GSYM IN]; + MATCH_MP_TAC Leaf_cell.CC_CELL_IN_MCELL_SET; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN SUBST1_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC Bump.MCELL4_EDGE_OPP [`V`;`[u0;u1;f i;f (SUC i)]`]; + REWRITE_TAC[Bump.EL_EXPLICIT]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]); + DISCH_THEN SUBST1_TAC; + COND_CASES_TAC; + BY(REWRITE_TAC[RADV2;arith `inv (&2) *x = x/ &2`]); + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `subcritical_edgeX` MP_TAC; + REWRITE_TAC[]; + REWRITE_TAC[Bump.CRITICAL_EDGEX_ALT]; + REWRITE_TAC[Bump.SUBCRITICAL_EDGEX_ALT]; + REWRITE_TAC[RADV2;arith `inv (&2) *x <= y <=> x <= &2 * y`;arith `y <= inv(&2) * x <=> &2 * y <= x`]; + INTRO_TAC MCELL4_EDGE_EXPLICIT [`V`;`u0`;`u1`;`f i`;`f(SUC i)`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]); + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + REPEAT (FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC); + REWRITE_TAC[Sphere.critical_edge_y]; + REPEAT (DISCH_THEN (unlist REWRITE_TAC)); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + BY(REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC THEN ASM_REWRITE_TAC[RADV2;arith `inv (&2) *x < hminus <=> x < &2 * hminus`])) + ]);; + (* }}} *) + +let CC_4_BETA_BUMP_0 = prove_by_refinement( + `!V u0 u1 w0 n f i. + packing V /\ + saturated V /\ + leaf_rank V [u0;u1] w0 n f /\ + ~collinear {u0,u1,w0} /\ + 1 < n /\ + cc_4 V u0 u1 f i /\ + ~(critical_edge_y (dist(u0,u1)) /\ + critical_edge_y (dist(f i, f (SUC i))) /\ + dist(u0,f i) < &2 * hminus /\ + dist(u0,f(SUC i)) < &2 * hminus /\ + dist(u1,f i) < &2 * hminus /\ + dist(u1,f(SUC i)) < &2 * hminus) ==> + beta_bump_v1 V {u0,u1} (cc_cell V [u0;u1;f i]) = &0 + `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `beta_bump_v1` MP_TAC; + REWRITE_TAC[]; + INTRO_TAC Bump.BETA_BUMP_ALT [`V`;`cc_cell V [u0;u1;f i]`;`(\e. VX V (cc_cell V [u0;u1;f i]) DIFF e)`;`{u0,u1}`]; + ANTS_TAC; + REWRITE_TAC[]; + TYPIFY `packing V /\ saturated V` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(ASM_REWRITE_TAC[]); + ONCE_REWRITE_TAC[GSYM IN]; + MATCH_MP_TAC Leaf_cell.CC_CELL_IN_MCELL_SET; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN SUBST1_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC Bump.MCELL4_EDGE_OPP [`V`;`[u0;u1;f i;f (SUC i)]`]; + REWRITE_TAC[Bump.EL_EXPLICIT]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]); + DISCH_THEN SUBST1_TAC; + COND_CASES_TAC; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `subcritical_edgeX` MP_TAC; + REWRITE_TAC[Bump.CRITICAL_EDGEX_ALT;Bump.SUBCRITICAL_EDGEX_ALT]; + REWRITE_TAC[RADV2;arith `inv (&2) *x <= y <=> x <= &2 * y`;arith `y <= inv(&2) * x <=> &2 * y <= x`]; + INTRO_TAC MCELL4_EDGE_EXPLICIT [`V`;`u0`;`u1`;`f i`;`f(SUC i)`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]); + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + REPEAT WEAKER_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC); + ASM_REWRITE_TAC[Sphere.critical_edge_y]; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[GSYM RADV2;arith ` x < &2 * hminus <=> inv (&2) *x < hminus`]; + INTRO_TAC MCELL4_CARD4 [`V`;`[u0;u1;f i;f (SUC i)]`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_THEN (MP_TAC o (MATCH_MP Leaf_cell.CARD4_ALL_DISTINCT)); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `!g. (g = {u0, f i} \/ g = {u0, f (SUC i)} \/ g = {u1, f i} \/ g = {u1 , f(SUC i)}) /\ ~(g = {u0,u1}) /\ ~(g = {f i,f(SUC i)}) ==> radV g < hminus` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + BY(REPEAT (CONJ_TAC THEN TRY( (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[] THEN ASM_REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]))); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + + +let critical_edgeX_critical_edge_y = prove_by_refinement( + `!V X u v. {u,v} IN critical_edgeX V X <=> {u,v} IN edgeX V X /\ critical_edge_y (dist(u,v))`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.critical_edgeX;IN_ELIM_THM;Marchal_cells_3.HL_2;Sphere.critical_edge_y]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (TAUT `((a==> b) /\ (b ==> a)) ==> (a = b)`); + CONJ2_TAC; + REWRITE_TAC[arith `!x y. inv(&2) * x <= y <=> x <= &2 * y`; arith `!x y. y <= inv (&2) * x <=> &2 * y <= x`]; + BY(MESON_TAC[]); + REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; + REWRITE_TAC[arith `!x y. inv(&2) * x <= y <=> x <= &2 * y`; arith `!x y. y <= inv (&2) * x <=> &2 * y <= x`]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM DISJ_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `{u,v} = {u',v'}` (C SUBGOAL_THEN SUBST1_TAC); + ASM_REWRITE_TAC[]; + BY(SET_TAC[]); + BY(ASM_MESON_TAC[DIST_SYM]) + ]);; + (* }}} *) + +let critical_weight_wtcount6_y = prove_by_refinement( + `!V u0 u1 w0 n f i. + packing V /\ + saturated V /\ + leaf_rank V [u0;u1] w0 n f /\ + ~collinear {u0,u1,w0} /\ + 1 < n /\ + cc_4 V u0 u1 f i /\ + critical_edge_y (dist(u0,u1)) ==> + critical_weight V (cc_cell V [u0;u1;f i]) = + &1 / & (wtcount6_y (dist(u0,u1)) (dist(u0,f i)) (dist (u0,f (SUC i))) (dist (f i, f (SUC i))) + (dist(u1, f (SUC i))) (dist (u1, f i)))`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.critical_edge_y;Pack_defs.critical_weight;arith `&1/ x = inv(x)`;REAL_EQ_INV2;REAL_OF_NUM_EQ]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Upfzbzm_support_lemmas.FINITE_critical_edgeX [`V`;`cc_cell V [u0;u1;f i]`]; + DISCH_TAC; + INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPED_ABBREV_TAC `ee = critical_edgeX V (cc_cell V [u0; u1; f i])` ; + INTRO_TAC MCELL4_EDGE_EXPLICIT [`V`;`u0`;`u1`;`f i`;`f (SUC i)`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `ee = {{u0, u1}, {u0, f i}, {u0, f (SUC i)}, {u1, f i}, {u1, f (SUC i)}, { f i, f (SUC i)}} INTER ee` (C SUBGOAL_THEN SUBST1_TAC); + MATCH_MP_TAC (SET_RULE `!a b. b SUBSET a ==> b = a INTER b`); + EXPAND_TAC "ee"; + REWRITE_TAC[Pack_defs.critical_edgeX;SUBSET;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[]); + TYPED_ABBREV_TAC `ex = edgeX V (cc_cell V [u0;u1;f i])` ; + TYPIFY `!u v. {u,v} IN ee <=> {u,v} IN ex /\ critical_edge_y (dist(u,v))` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "ee"; + EXPAND_TAC "ex"; + BY(REWRITE_TAC[critical_edgeX_critical_edge_y]); + TYPIFY `{u0,u1} IN ex /\ {u0, f i} IN ex /\ {u0, f (SUC i)} IN ex /\ {u1, f i} IN ex /\ {u1, f (SUC i)} IN ex /\ {f i, f (SUC i)} IN ex` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "ex"; + FIRST_X_ASSUM_ST `edgeX` kill; + BY(ASM_REWRITE_TAC[IN_INSERT]); + INTRO_TAC MCELL4_CARD4 [`V`;`[u0;u1;f i;f (SUC i)]`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_THEN (ASSUME_TAC o (MATCH_MP Leaf_cell.CARD4_ALL_DISTINCT)); + REPLICATE_TAC 6 (ONCE_ASM_SIMP_TAC[CARD_INSERT_INTER_ALT] THEN ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY;Geomdetail.PAIR_EQ_EXPAND]); + REWRITE_TAC[Pack_defs.wtcount6_y;INTER_EMPTY;Pack_defs.wtcount3_y;CARD_CLAUSES;arith `x + 0 = x`]; + BY(ARITH_TAC) + ]);; + (* }}} *) + +(* 3q1h case *) + +(* +let ox3q1h_data = prove_by_refinement( + `!V f w0 n u0 u1. ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f /\ CARD (s_leaf V [u0; u1]) = 4 /\ + (?i. cc_4 V u0 u1 f i /\ + (hminus <= dist (f i,f (SUC i)) /\ dist (f i,f (SUC i)) <= hplus) /\ + (cc_4 V u0 u1 f (i + 1) /\ + (dist (u0,f (i + 1)) < &2 * hminus /\ + dist (u1,f (i + 1)) < &2 * hminus) /\ + dist (u0,f ((i + 1) + 1)) < &2 * hminus /\ + dist (u1,f ((i + 1) + 1)) < &2 * hminus /\ + dist (f (i + 1),f (SUC (i + 1))) < hminus) /\ + (cc_4 V u0 u1 f (i + 2) /\ + (dist (u0,f (i + 2)) < &2 * hminus /\ + dist (u1,f (i + 2)) < &2 * hminus) /\ + dist (u0,f ((i + 2) + 1)) < &2 * hminus /\ + dist (u1,f ((i + 2) + 1)) < &2 * hminus /\ + dist (f (i + 2),f (SUC (i + 2))) < hminus) /\ + cc_4 V u0 u1 f (i + 3) /\ + (dist (u0,f (i + 3)) < &2 * hminus /\ + dist (u1,f (i + 3)) < &2 * hminus) /\ + dist (u0,f ((i + 3) + 1)) < &2 * hminus /\ + dist (u1,f ((i + 3) + 1)) < &2 * hminus /\ + dist (f (i + 3),f (SUC (i + 3))) < hminus) + ==> &0 <= sum {i | i < n} (gg_mcell V f u0 u1) `, + (* {{{ proof *) + [ + st/r + ]);; + (* }}} *) +*) + +let c_4_azim_mcell_dih_y = prove_by_refinement( + `!V u0 u1 w0 n f i. + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f /\ + cc_4 V u0 u1 f i ==> + azim_mcell V f u0 u1 i = dih_y (dist(u0,u1)) (dist(u0,f i)) (dist (u0, f(SUC i))) + (dist(f i, f (SUC i))) (dist (u1,f (SUC i))) (dist (u1, f i))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC LEAF_RANK_REUHADY [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_THEN SUBST1_TAC; + INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MCELL4_AZIM_LT_PI [`V`;`[u0;u1;f i;f(SUC i)]`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[u0;u1;f i]`]; + ASM_REWRITE_TAC[set_of_list]; + INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[u0;u1;f (SUC i)]`]; + ASM_REWRITE_TAC[set_of_list]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC AZIM_DIHV_SAME [`u0`;`u1`;`f i`;`f(SUC i)`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + INTRO_TAC Merge_ineq.DIHV_EQ_DIH_Y [`u0`;`u1`;`f i`;`f (SUC i)`]; + BY(ASM_REWRITE_TAC[LET_DEF;LET_END_DEF]) + ]);; + (* }}} *) + +let NOT_COPLANAR_IMP_CARD4_ALT = prove_by_refinement( + `!(u0:real^3) u1 u2 u3. ~coplanar {u0,u1,u2,u3} ==> CARD {u0,u1,u2,u3} = 4`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Collect_geom2.NOT_COPLANAR_IMP_CARD4; + BY(ASM_MESON_TAC[Leaf_cell.coplanar_eq_coplanar_alt;DIMINDEX_3;arith `2 <= 3`]) + ]);; + (* }}} *) + +let radius_le_circumradius = prove_by_refinement( + `!(u0:real^3) u1 u2 u3. ~coplanar {u0,u1,u2,u3} ==> + dist(u0,u1) <= &2 * radV {u0,u1,u2,u3}`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC NOT_COPLANAR_IMP_CARD4_ALT [`u0`;`u1`;`u2`;`u3`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC Rogers.AFFINE_HULL_RADV [`{u0,u1,u2,u3}`;`{u0,u1}`]; + ANTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[AFF_DEP_COPLANAR]); + BY(SET_TAC[]); + REWRITE_TAC[RADV2]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `x <= &2 * y <=> inv (&2) * x <= y`]; + TYPED_ABBREV_TAC `d = inv(&2) * dist(u0,u1)` ; + TYPED_ABBREV_TAC `r = radV {u0,u1,u2,u3}` ; + TYPIFY `d pow 2 <= r pow 2` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `x <= x + y <=> &0 <= y`]; + BY(REWRITE_TAC[ REAL_LE_POW_2]); + GMATCH_SIMP_TAC Collect_geom.POW2_COND; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let radius_le_circumradius_all = prove_by_refinement( + `!(u0:real^3) u1 u2 u3. ~coplanar {u0,u1,u2,u3} ==> + dist(u0,u1) <= &2 * radV {u0,u1,u2,u3} /\ + dist(u0,u2) <= &2 * radV {u0,u1,u2,u3} /\ + dist(u0,u3) <= &2 * radV {u0,u1,u2,u3} /\ + dist(u1,u2) <= &2 * radV {u0,u1,u2,u3} /\ + dist(u1,u3) <= &2 * radV {u0,u1,u2,u3} /\ + dist(u2,u3) <= &2 * radV {u0,u1,u2,u3} +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + FIRST_ASSUM (ASSUME_TAC o (MATCH_MP NOT_COPLANAR_IMP_CARD4_ALT )); + TYPIFY `!u v. ~(u= v) /\ {u,v} SUBSET {u0,u1,u2,u3} ==> dist(u,v) <= &2 * radV {u0,u1,u2,u3}` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Leaf_cell.SET2_INSERT2 [`u`;`v`;`u0`;`u1`;`u2`;`u3`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC radius_le_circumradius; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP Leaf_cell.CARD4_ALL_DISTINCT)); + BY(REPLICATE_TAC 6 (TRY CONJ_TAC THEN TRY (FIRST_X_ASSUM MATCH_MP_TAC) THEN ASM_REWRITE_TAC[] THEN TRY (SET_TAC[]))) + ]);; + (* }}} *) + +let MCELL4_DOMAIN = prove_by_refinement( + `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f /\ + cc_4 V u0 u1 f i + ==> + &2 * hminus <= dist(u0,u1) /\ dist(u0,u1) <= &2 * hplus /\ + &2 <= dist(u0,f i) /\ dist(u0,f i) < &2 * sqrt(&2) /\ + &2 <= dist(u0,f (SUC i)) /\ dist(u0,f (SUC i)) < &2 * sqrt(&2) /\ + &2 <= dist(f i, f (SUC i)) /\ dist(f i,f (SUC i)) < &2 * sqrt(&2) /\ + &2 <= dist(u1,f i) /\ dist(u1,f i) < &2 * sqrt(&2) /\ + &2 <= dist(u1,f (SUC i)) /\ dist(u1,f (SUC i)) < &2 * sqrt(&2) /\ + rad2_y (dist(u0,u1)) (dist(u0,f i)) (dist (u0, f(SUC i))) + (dist(f i, f (SUC i))) (dist (u1,f (SUC i))) (dist (u1, f i)) < &2 /\ + &0 < delta_y (dist(u0,u1)) (dist(u0,f i)) (dist (u0, f(SUC i))) + (dist(f i, f (SUC i))) (dist (u1,f (SUC i))) (dist (u1, f i)) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC GDRQXLGv3 [`u0`;`u1`;`f i`;`f (SUC i)`]; + ASM_REWRITE_TAC[LET_DEF;LET_END_DEF]; + DISCH_TAC; + INTRO_TAC coplanar_delta_y [`u0`;`u1`;`f i`;`f (SUC i)`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC NOT_COPLANAR_NOT_COLLINEAR [`u0`;`f i`;`f (SUC i)`;`u1`]; + ANTS_TAC; + TYPIFY `{u0, f i, f (SUC i), u1} = {u0,u1,f i,f (SUC i)}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[Collect_geom2.NOT_COL_EQ_UPS_X_POS]; + DISCH_TAC; + INTRO_TAC Packing3.BARV_SUBSET [`V`;`3`;`[u0;u1;f i;f (SUC i)]`]; + ASM_REWRITE_TAC[set_of_list]; + REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MCELL4_CARD4 [`V`;`[u0;u1;f i;f (SUC i)]`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_THEN (ASSUME_TAC o (MATCH_MP Leaf_cell.CARD4_ALL_DISTINCT)); + TYPIFY `&2 <= dist(u0,u1) /\ &2 <= dist (u0,f i) /\ &2 <= dist(u0,f(SUC i)) /\ &2 <= dist(u1, f i) /\ &2 <= dist(u1,f(SUC i)) /\ &2 <= dist (f i, f (SUC i))` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `!u v. u IN V /\ v IN V /\ ~(u = v) ==> &2 <= dist(u,v)` ENOUGH_TO_SHOW_TAC; + DISCH_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[IN]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `packing` MP_TAC; + REWRITE_TAC[Sphere.packing]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + TYPIFY `&2 * hminus <= dist (u0,u1) /\ dist (u0,u1) <= &2 * hplus` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; + BY(MESON_TAC[Sphere.critical_edge_y]); + ASM_REWRITE_TAC[]; + REWRITE_TAC[Sphere.rad2_y;Sphere.y_of_x]; + FIRST_ASSUM (MP_TAC o (MATCH_MP radius_le_circumradius_all)); + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[arith `x * x = x pow 2`]; + FIRST_X_ASSUM_ST `rad2_x` (SUBST1_TAC o GSYM); + TYPIFY `radV {u0,u1,f i,f (SUC i)} < sqrt(&2)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `hl` MP_TAC; + BY(REWRITE_TAC[Pack_defs.HL;set_of_list]); + TYPED_ABBREV_TAC `r = radV {u0,u1,f i,f (SUC i)}` ; + TYPIFY `!x. x <= &2 * r /\ r < sqrt(&2) ==> x < &2 * sqrt(&2)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REAL_ARITH_TAC); + ASM_SIMP_TAC[]; + REWRITE_TAC[GSYM Nonlin_def.sqrt2_sqrt2;GSYM Sphere.sqrt2;arith `x * x = x pow 2`]; + GMATCH_SIMP_TAC (GSYM Collect_geom2.LT_POW2_COND); + ASM_REWRITE_TAC[Sphere.sqrt2]; + GMATCH_SIMP_TAC SQRT_POS_LE; + FIRST_X_ASSUM_ST `dist(u0,u1) <= &2 * r` MP_TAC; + BY(MESON_TAC[arith `&0 <= d /\ d <= &2 * r ==> &0 <= r`;arith `&0 <= &2`;DIST_POS_LE]) + ]);; + (* }}} *) + +let real_model_azim_c4 = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> (!i. cc_4 V u0 u1 f i ==> azim_mcell V f u0 u1 i < #2.8)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC c_4_azim_mcell_dih_y [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "BIXPCGW 6652007036 a2") []; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + DISCH_THEN MATCH_MP_TAC; + REWRITE_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2]; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) + ]);; + (* }}} *) + +(* renamed from gammaX_gamm4fgcy_ALT *) + +let gammaX_gamma4fgcy_ALT = prove_by_refinement( + `!V X u0 u1 u2 u3. + saturated V /\ + packing V /\ + barV V 3 [u0;u1;u2;u3] /\ + X = mcell4 V [u0;u1;u2;u3] /\ + ~NULLSET X + ==> gammaX V X lmfun = + gamma4fgcy (dist(u0,u1)) (dist(u0,u2)) (dist(u0,u3)) (dist(u2,u3)) (dist(u1,u3)) (dist(u1,u2)) lmfun`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + BY(ASM_MESON_TAC[arith `4 >= 4`;Bump.MCELL4;Tskajxy_lemmas.gammaX_gamm4fgcy]) + ]);; + (* }}} *) + +let GG_MCELL_QUARTER = prove_by_refinement( + `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + cc_4 V u0 u1 f i /\ + (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ + dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus /\ + dist (f i,f (SUC i)) < &2 * hminus /\ + leaf_rank V [u0; u1] w0 n f ==> + gg_mcell V f u0 u1 i = gamma4fgcy (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) + (dist (f i,f (SUC i))) + (dist (u1,f (SUC i))) + (dist (u1,f i)) + lmfun`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC cc_4_cc_cell; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC gammaX_gamma4fgcy_ALT; + GEXISTL_TAC [`u0`;`f (SUC i)`;`u1`;`f i`]; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC critical_weight_wtcount6_y; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC CC_4_BETA_BUMP_0; + CONJ_TAC; + GEXISTL_TAC [`w0`;`n`]; + ASM_REWRITE_TAC[Sphere.critical_edge_y]; + BY(ASM_MESON_TAC[arith `d < t ==> ~(t <= d)`]); + TYPIFY `(wtcount6_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) (dist (f i,f (SUC i))) (dist (u1,f (SUC i))) (dist (u1,f i))) = 1` (C SUBGOAL_THEN SUBST1_TAC); + ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + ASM_REWRITE_TAC[arith `x <= y <=> ~(y < x)`;Sphere.critical_edge_y]; + BY(ARITH_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let GG_MCELL_BETA = prove_by_refinement( + `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + cc_4 V u0 u1 f i /\ + (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ + dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus /\ + critical_edge_y (dist(f i, f (SUC i))) /\ + leaf_rank V [u0; u1] w0 n f ==> + gg_mcell V f u0 u1 i = (gamma4fgcy (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) + (dist (f i,f (SUC i))) + (dist (u1,f (SUC i))) + (dist (u1,f i)) + lmfun) / &2 + + bump (dist (u0,u1) / &2) - bump (dist (f i,f (SUC i)) / &2) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC cc_4_cc_cell; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC gammaX_gamma4fgcy_ALT; + GEXISTL_TAC [`u0`;`f (SUC i)`;`u1`;`f i`]; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC critical_weight_wtcount6_y; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC CC_4_BETA_BUMP_EXPLICIT; + CONJ_TAC; + GEXISTL_TAC [`w0`;`n`]; + BY(ASM_REWRITE_TAC[]); + TYPIFY `(wtcount6_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) (dist (f i,f (SUC i))) (dist (u1,f (SUC i))) (dist (u1,f i))) = 2` (C SUBGOAL_THEN SUBST1_TAC); + ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + ASM_REWRITE_TAC[arith `x <= y <=> ~(y < x)`;Sphere.critical_edge_y]; + BY(ARITH_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let beta_bumpA_y_NONBETA = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. ~(critical_edge_y y1 /\ critical_edge_y y4 /\ y2 < &2 * hminus /\ y3 < &2 * hminus /\ y5 < &2 * hminus /\ y6 < &2 * hminus) + ==> beta_bumpA_y y1 y2 y3 y4 y5 y6 = &0`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.beta_bumpA_y]; + REWRITE_TAC[Sphere.beta_bumpA_y;DE_MORGAN_THM]; + REPEAT WEAKER_STRIP_TAC; + BY(REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC THEN ASM_REWRITE_TAC[] THEN TRY REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let GG_MCELL_NONBETA = prove_by_refinement( + `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + cc_4 V u0 u1 f i /\ + ~((dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ + dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus /\ + critical_edge_y (dist(f i, f (SUC i)))) /\ + leaf_rank V [u0; u1] w0 n f ==> + gg_mcell V f u0 u1 i = (gamma4fgcy (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) + (dist (f i,f (SUC i))) + (dist (u1,f (SUC i))) + (dist (u1,f i)) + lmfun) / + &(wtcount6_y (dist(u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) + (dist (f i,f (SUC i))) (dist (u1,f (SUC i))) (dist (u1,f i))) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC cc_4_cc_cell; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC gammaX_gamma4fgcy_ALT; + GEXISTL_TAC [`u0`;`f (SUC i)`;`u1`;`f i`]; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC critical_weight_wtcount6_y; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[arith `g * &1/ w + b = g / w <=> b = &0`]; + GMATCH_SIMP_TAC CC_4_BETA_BUMP_0; + GEXISTL_TAC [`w0`;`n`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `/\` MP_TAC; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let GG_MCELL_GENERAL = prove_by_refinement( + `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + cc_4 V u0 u1 f i /\ + leaf_rank V [u0; u1] w0 n f ==> + gg_mcell V f u0 u1 i = +gamma4fgcy (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) + (dist (f i,f (SUC i))) + (dist (u1,f (SUC i))) + (dist (u1,f i)) + lmfun / + &(wtcount6_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) + (dist (f i,f (SUC i))) + (dist (u1,f (SUC i))) + (dist (u1,f i))) + + beta_bumpA_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) + (dist (f i,f (SUC i))) + (dist (u1,f (SUC i))) + (dist (u1,f i))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC cc_4_cc_cell; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC gammaX_gamma4fgcy_ALT; + GEXISTL_TAC [`u0`;`f (SUC i)`;`u1`;`f i`]; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC critical_weight_wtcount6_y; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[arith `x * &1 / w = x / w`;arith `g + b = g + b' <=> b = b'`]; + REWRITE_TAC[Sphere.beta_bumpA_y]; + TYPIFY`critical_edge_y (dist (u0,u1)) /\ (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ dist (u0,f (SUC i)) < &2 * hminus /\ dist (u1,f (SUC i)) < &2 * hminus /\ critical_edge_y (dist(f i, f (SUC i)))` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `mcell4` (SUBST1_TAC o GSYM); + GMATCH_SIMP_TAC CC_4_BETA_BUMP_EXPLICIT; + CONJ_TAC; + GEXISTL_TAC [`w0`;`n`]; + BY(ASM_REWRITE_TAC[]); + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `mcell4` (SUBST1_TAC o GSYM); + GMATCH_SIMP_TAC CC_4_BETA_BUMP_0; + CONJ_TAC; + GEXISTL_TAC [`w0`;`n`]; + ASM_REWRITE_TAC[Sphere.critical_edge_y]; + BY(ASM_MESON_TAC[Sphere.critical_edge_y;arith `d < t ==> ~(t <= d)`]); + FIRST_X_ASSUM (ASSUME_TAC o (REWRITE_RULE[DE_MORGAN_THM;Sphere.critical_edge_y])); + FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; + REWRITE_TAC[Sphere.critical_edge_y]; + BY(REPEAT (FIRST_X_ASSUM DISJ_CASES_TAC THEN ASM_REWRITE_TAC[] THEN TRY REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let real_model_gamma_qu = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> +(!i. cc_4 V u0 u1 f i /\ + (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ + dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus /\ + dist (f i,f (SUC i)) < &2 * hminus + ==> -- #0.0057 <= gg_mcell V f u0 u1 i) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Oxl_def.cc_eps]; + MATCH_MP_TAC (arith `y > -- #0.00569 ==> -- #0.0057 <= y`); + INTRO_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "BIXPCGW 9455898160") []; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + GMATCH_SIMP_TAC GG_MCELL_QUARTER; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + DISCH_THEN MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) + ]);; + (* }}} *) + +let ETA_Y_POS_LE_ALT = prove_by_refinement( + `!u0 u1 (u2:real^3). &0 <= eta_y (dist (u0,u1)) (dist (u0,u2)) (dist (u1,u2)) `, + (* {{{ proof *) + [ + BY(MESON_TAC[Collect_geom2.ETA_Y_POS_LE;Geomdetail.dist3]) + ]);; + (* }}} *) + +let ETA_Y_LEMMA = prove_by_refinement( + `!u0 u1 (u2:real^3) r. ~collinear {u0,u1,u2} /\ &0 < r /\ r <= hl[u0;u1;u2] ==> + r pow 2 <= eta_y (dist (u0,u1)) (dist (u0,u2)) (dist (u1,u2)) pow 2 `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC (GSYM Collect_geom.POW2_COND_LT); + MATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`); + SUBCONJ_TAC; + GMATCH_SIMP_TAC (GSYM RADV_ETAY); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `hl` MP_TAC; + BY(REWRITE_TAC[Pack_defs.HL;set_of_list]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let ETA_Y_LEMMA_ALT = prove_by_refinement( + `!u0 u1 (u2:real^3) r. ~collinear {u0,u1,u2} /\ hl[u0;u1;u2] <= r ==> + eta_y (dist (u0,u1)) (dist (u0,u2)) (dist (u1,u2)) pow 2 <= r pow 2`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC (GSYM Collect_geom.POW2_COND); + MATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`); + SUBCONJ_TAC; + GMATCH_SIMP_TAC (GSYM RADV_ETAY); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `hl` MP_TAC; + BY(REWRITE_TAC[Pack_defs.HL;set_of_list]); + DISCH_TAC; + SUBCONJ_TAC; + BY(ASM_REWRITE_TAC[ETA_Y_POS_LE_ALT]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let real_model_fhbv2 = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> + (!i. (cc_4 V u0 u1 f i /\ + (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ + dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus /\ + dist (f i,f (SUC i)) < &2 * hminus) /\ + ~(hl [u0; u1; f (SUC i)] < #1.34) + ==> #0.0057 <= gg_mcell V f u0 u1 i) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (arith `y > #0.0057 ==> #0.0057 <= y`); + INTRO_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "FHBVYXZv2 a") []; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + REWRITE_TAC[GSYM Sphere.rad2_y]; + ONCE_REWRITE_TAC[TAUT `(r ==> a \/ b \/ c) <=> ((r /\ ~b /\ ~c) ==> a)`]; + GMATCH_SIMP_TAC GG_MCELL_QUARTER; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + DISCH_THEN MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + (ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + CONJ_TAC; + MATCH_MP_TAC (arith `r < &2 ==> ~( r > &2)`); + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[arith `~(x < y ) <=> y <= x`]; + MATCH_MP_TAC ETA_Y_LEMMA; + INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `#1.34` MP_TAC; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let real_model_fhbv2_sym = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> +(!i. (cc_4 V u0 u1 f i /\ + (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ + dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus /\ + dist (f i,f (SUC i)) < &2 * hminus) /\ + ~(hl [u0; u1; f i] < #1.34) + ==> #0.0057 <= gg_mcell V f u0 u1 i)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (arith `y > #0.0057 ==> #0.0057 <= y`); + INTRO_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "FHBVYXZv2 a") []; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + REWRITE_TAC[GSYM Sphere.rad2_y]; + ONCE_REWRITE_TAC[TAUT `(r ==> a \/ b \/ c) <=> ((r /\ ~b /\ ~c) ==> a)`]; + GMATCH_SIMP_TAC GG_MCELL_QUARTER; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + ONCE_REWRITE_TAC[Merge_ineq.gamma4fgcy_sym23]; + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + (ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + CONJ_TAC; + MATCH_MP_TAC (arith `r < &2 ==> ~( r > &2)`); + FIRST_X_ASSUM_ST `rad2_y` MP_TAC; + BY(MESON_TAC[Merge_ineq.rad2_y_sym]); + REWRITE_TAC[arith `~(x < y ) <=> y <= x`]; + MATCH_MP_TAC ETA_Y_LEMMA; + INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `#1.34` MP_TAC; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let CC_3_PROPS = prove_by_refinement( + `!V u0 u1 w0 n f i. + pack_nonlinear_non_ox3q1h /\ + packing V /\ + saturated V /\ + leaf_rank V [u0;u1] w0 n f /\ + ~collinear {u0,u1,w0} /\ + critical_edge_y (dist(u0,u1)) /\ + s_leaf V [u0;u1] HAS_SIZE n /\ + 1 < n /\ + ~cc_4 V u0 u1 f i ==> + cc_ke V [u0; u1; f i] = 3 /\ +barV V 3 (cc_uh V ([u0;u1;f i])) /\ +barV V 3 (cc_uh V ([u1;u0;f (SUC i)])) /\ +beta_bump_v1 V {u0,u1} (cc_cell V [u0;u1;f i]) = &0 /\ +beta_bump_v1 V {u0,u1} (cc_cell V [u1;u0;f (SUC i)]) = &0 /\ + cc_ke V [u1;u0;f (SUC i)] = 3 /\ + cc_cell V [u0;u1;f i] SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ + cc_cell V [u1;u0;f(SUC i)] SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ + ~(cc_cell V [u0;u1;f i] = cc_cell V [u1;u0;f (SUC i)]) /\ + cc_cell V [u0; u1; f i] SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ + ~collinear {u0,u1,f i} /\ + ~collinear {u0,u1,f (SUC i)} /\ + hl [u0;u1;f i] < sqrt(&2) /\ + hl [u0;u1; f(SUC i)] < sqrt(&2) /\ + hl [u1;u0; f(SUC i)] < sqrt(&2) /\ + leaf V [u0; u1; f i] /\ + leaf V [u0; u1; f (SUC i)] /\ + leaf V [u1; u0; f (SUC i)] /\ + &2 <= dist(u0,u1) /\ + &2 <= dist(u0,f i) /\ + &2 <= dist(u0,f(SUC i)) /\ + &2 <= dist(u1,f i) /\ + &2 <= dist(u1,f(SUC i)) /\ + dist(u0,u1) <= &2 * sqrt(&2) /\ + dist(u0,f i) <= &2 * sqrt(&2) /\ + dist(u0,f (SUC i)) <= &2 * sqrt(&2) /\ + dist(u1,f i) <= &2 * sqrt(&2) /\ + dist(u1,f (SUC i)) <= &2 * sqrt(&2) /\ + eta_y (dist (u0,u1)) (dist(u0,f i)) (dist (u1,f i)) < sqrt(&2) /\ + eta_y (dist (u0,u1)) (dist(u0,f (SUC i))) (dist (u1,f (SUC i))) < sqrt(&2) /\ + ~NULLSET (cc_cell V [u0; u1; f i]) /\ + ~NULLSET (cc_cell V [u1; u0; f (SUC i)]) /\ + azim_mcell V f u0 u1 i = azim u0 u1 (f i) (f (SUC i)) /\ + (?y4. &2 <= y4 /\ + y4 <= &2 * sqrt (&2) /\ + &0 < delta_y (dist(u0,u1)) (dist(u0,f i)) (dist(u0, f(SUC i))) y4 (dist(u1,f(SUC i))) (dist(u1,f i)) /\ + dih_y (dist(u0,u1)) (dist(u0,f i)) (dist(u0, f(SUC i))) y4 (dist(u1,f(SUC i))) (dist(u1,f i)) <= azim u0 u1 (f i) (f (SUC i)) /\ + &2 <= rad2_y (dist(u0,u1)) (dist(u0,f i)) (dist(u0, f(SUC i))) y4 (dist(u1,f(SUC i))) (dist(u1,f i)) /\ + (azim u0 u1 (f i) (f (SUC i)) < pi /\ + dist (f i,f (SUC i)) <= &2 * sqrt (&2) + ==> y4 = dist (f i,f (SUC i)))) +`, + (* {{{ proof *) + [ + REWRITE_TAC[cc_4]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC NO_4CELL_IMP_K3 [`V`;`wedge_ge u0 u1 (f i) (f (SUC i))`;`[u0;u1]`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[TAUT `a /\ b /\ c <=> (a /\ b) /\ c`]; + CONJ2_TAC; + REWRITE_TAC[TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + MATCH_MP_TAC WEDGE3_Y4; + GEXISTL_TAC [`V`;`w0`;`n`]; + BY(ASM_REWRITE_TAC[]); + CONJ2_TAC; + INTRO_TAC LEAF_RANK_REUHADY [`V`;`[u0;u1]`;`w0`;`n`;`f`;`i`]; + BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); + TYPIFY `leaf V [u0;u1;f i] /\ leaf V [u0;u1;f (SUC i)]` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[ LEAF_RANK_LEAF]); + TYPIFY ` s_leaf V [u0;u1] (f (SUC i) )` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC LEAF_RANK_S_LEAF; + BY(ASM_MESON_TAC[]); + TYPIFY `leaf V [u1;u0;f (SUC i)]` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC s_leaf_leaf [`V`;`[u1;u0]`;`f(SUC i)`]; + REWRITE_TAC[IN;Bump.EL_EXPLICIT]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_MESON_TAC[S_LEAF_SYM]); + SUBCONJ2_TAC; + BY(ASM_MESON_TAC[Leaf_cell.CC_CELL_NOT_NULLSET]); + DISCH_TAC; + SUBCONJ2_TAC; + BY(ASM_MESON_TAC[Leaf_cell.CC_CELL_NOT_NULLSET]); + ASM_REWRITE_TAC[]; + INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[u0;u1;f i]`]; + ASM_REWRITE_TAC[]; + INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[u0;u1;f (SUC i)]`]; + ASM_REWRITE_TAC[set_of_list]; + REPEAT WEAKER_STRIP_TAC THEN ASM_REWRITE_TAC[]; + INTRO_TAC LEAF_DOMAIN [`V`;`[u0;u1;f i]`]; + INTRO_TAC LEAF_DOMAIN [`V`;`[u1;u0;f (SUC i)]`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + CONJ2_TAC; + REPEAT (FIRST_X_ASSUM_ST `eta_y` MP_TAC); + BY(MESON_TAC[DIST_SYM;Collect_geom.ETA_Y_SYYM]); + REWRITE_TAC[TAUT `(a /\ b) /\ c <=> a /\ b /\ c`]; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[ Leaf_cell.cc_uh;IN]); + DISCH_TAC; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[Leaf_cell.cc_uh;IN]); + DISCH_TAC; + REPEAT (FIRST_X_ASSUM_ST `NULLSET` MP_TAC); + ASM_REWRITE_TAC[Leaf_cell.cc_cell]; + REPEAT WEAKER_STRIP_TAC; + REPEAT (GMATCH_SIMP_TAC Bump.MCELL_BUMP_0); + ASM_REWRITE_TAC[arith `3 < 4`]; + REPEAT (FIRST_X_ASSUM_ST `leaf` MP_TAC); + REWRITE_TAC[Leaf_cell.leaf]; + BY(MESON_TAC[Sphere.sqrt2]) + ]);; + (* }}} *) + +let real_model_gckb = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> (!i. #0.606 <= azim_mcell V f u0 u1 i)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC (arith `y > x ==> x <= y`); + INTRO_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "GCKBQEA") []; + REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + DISCH_TAC; + TYPIFY `cc_4 V u0 u1 f i` ASM_CASES_TAC; + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC c_4_azim_mcell_dih_y [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_REWRITE_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2]; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `dih_y` MP_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `d > c ==> (d <= a ==> a > c)`); + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; + FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; + BY(MESON_TAC[Sphere.critical_edge_y]) + ]);; + (* }}} *) + +let real_model_sum_azim = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> sum {i | i < n} (azim_mcell V f u0 u1) = &2 * pi`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC LEAF_RANK_GRUTOTI [`V`;`[u0;u1]`;`w0`;`n`;`f`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_THEN MATCH_MP_TAC; + REWRITE_TAC[Marchal_cells_3.HL_2]; + REWRITE_TAC[arith `inv(&2) * x < y <=> x < &2 * y`]; + FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; + REWRITE_TAC[Sphere.critical_edge_y]; + TYPIFY `&0 < sqrt(&2) - hplus` ENOUGH_TO_SHOW_TAC; + BY(REAL_ARITH_TAC); + BY(REWRITE_TAC[Flyspeck_constants.bounds]) + ]);; + (* }}} *) + +let real_model_ox3q1h_merge = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f +==> + (CARD (s_leaf V [u0; u1]) = 4 /\ + (?i. cc_4 V u0 u1 f i /\ + (&2 * hminus <= dist (f i,f (SUC i)) /\ + dist (f i,f (SUC i)) <= &2 * hplus) /\ + (cc_4 V u0 u1 f (SUC i) /\ + (dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus) /\ + dist (u0,f (SUC (SUC i))) < &2 * hminus /\ + dist (u1,f (SUC (SUC i))) < &2 * hminus /\ + dist (f (SUC i),f (SUC (SUC i))) < &2 * hminus) /\ + (cc_4 V u0 u1 f (i + 2) /\ + (dist (u0,f (i + 2)) < &2 * hminus /\ + dist (u1,f (i + 2)) < &2 * hminus) /\ + dist (u0,f (SUC (i + 2))) < &2 * hminus /\ + dist (u1,f (SUC (i + 2))) < &2 * hminus /\ + dist (f (i + 2),f (SUC (i + 2))) < &2 * hminus) /\ + cc_4 V u0 u1 f (i + 3) /\ + (dist (u0,f (i + 3)) < &2 * hminus /\ + dist (u1,f (i + 3)) < &2 * hminus) /\ + dist (u0,f (SUC (i + 3))) < &2 * hminus /\ + dist (u1,f (SUC (i + 3))) < &2 * hminus /\ + dist (f (i + 3),f (SUC (i + 3))) < &2 * hminus) + ==> &0 <= sum {i | i < n} (gg_mcell V f u0 u1)) +`, + (* {{{ proof *) + [ + REWRITE_TAC[arith `i + 2 = SUC (i + 1) /\ i + 3 = SUC (i + 2) /\ i + 1 = SUC i`]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC real_model_sum_azim [`V`;`u0`;`u1`;`w0`;`n`;`f`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `{i | i < n} = ( 0..n - 1)` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[NUMSEG_LT;arith `1 < n==> ~(n = 0)`;HAS_SIZE]); + COMMENT "periodicity"; + INTRO_TAC Oxl_def.periodic_sum [`gg_mcell V f u0 u1`;`n`]; + ANTS_TAC; + CONJ2_TAC; + BY(ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`]); + BY(ASM_MESON_TAC[real_periodic_data;LEAF_RANK_PERIODIC]); + DISCH_THEN (C INTRO_TAC [`i`]); + DISCH_THEN (SUBST1_TAC o GSYM); + INTRO_TAC Oxl_def.periodic_sum [`azim_mcell V f u0 u1`;`n`]; + ANTS_TAC; + CONJ2_TAC; + BY(ASM_SIMP_TAC[arith `1 < n ==> ~(n = 0)`]); + BY(ASM_MESON_TAC[real_periodic_data;LEAF_RANK_PERIODIC]); + DISCH_THEN (C INTRO_TAC [`i`]); + DISCH_THEN (SUBST1_TAC o GSYM); + COMMENT "do sum"; + TYPIFY `n = 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[HAS_SIZE]); + ASM_REWRITE_TAC[arith `4 - 1 + i = SUC (SUC (SUC i))`]; + REWRITE_TAC[SUM_SING_NUMSEG;SUM_CLAUSES_NUMSEG;arith `i <= SUC(SUC(SUC i)) /\ i <= SUC (SUC i) /\ i <= SUC i`]; + REPEAT (FIRST_X_ASSUM_ST `SUC(SUC(SUC(SUC i)))` MP_TAC); + ASM_REWRITE_TAC[arith `SUC(SUC(SUC (SUC i))) = i + 4`]; + TYPIFY `f(i) = f (i+4)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Oxl_def.periodic]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "1st piece"; + INTRO_TAC GG_MCELL_BETA [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[Sphere.critical_edge_y]); + DISCH_THEN SUBST1_TAC; + COMMENT "second piece"; + INTRO_TAC GG_MCELL_QUARTER [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN SUBST1_TAC; + COMMENT "third piece"; + INTRO_TAC GG_MCELL_QUARTER [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC(SUC i)`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN SUBST1_TAC; + COMMENT "fourth piece"; + INTRO_TAC GG_MCELL_QUARTER [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC(SUC(SUC i))`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[arith `SUC(SUC(SUC(SUC i))) = i+4`]); + DISCH_THEN SUBST1_TAC; + MATCH_MP_TAC (arith `g > &0 ==> &0 <= g`); + ASM_REWRITE_TAC[arith `SUC(SUC(SUC(SUC i))) = i+4`]; + ONCE_REWRITE_TAC[arith `((a + b) +c) + d = a + d + c + b`]; + COMMENT "intro ineq"; + INTRO_TAC Merge_ineq.ox3q1h_merge []; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + TYPIFY `bump (dist (u0,u1) / &2) - bump (dist (f (i + 4),f (SUC i)) / &2) = beta_bump_force_y (dist (u0,u1)) (dist (u0,f (i + 4))) (dist (u0,f (SUC i))) (dist (f (i + 4),f (SUC i))) (dist (u1,f (SUC i))) (dist (u1,f (i + 4)))` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[Sphere.beta_bump_force_y]); + REWRITE_TAC[arith `(a+b)+c = a+b+c`]; + DISCH_THEN MATCH_MP_TAC; + ASM_SIMP_TAC[]; + COMMENT "intro domain"; + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC(SUC i)`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC(SUC(SUC i))`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + RULE_ASSUM_TAC (REWRITE_RULE[arith `SUC(SUC(SUC(SUC i))) = i+4`]); + FIRST_X_ASSUM_ST `f i = f (i + 4)` (fun t -> (REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[GSYM t]) THEN ASSUME_TAC t); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[arith `x< y ==> x<= y`]; + COMMENT "deal with angle sum"; + FIRST_X_ASSUM_ST `azim_mcell` MP_TAC; + REPEAT (GMATCH_SIMP_TAC c_4_azim_mcell_dih_y); + ASM_REWRITE_TAC[]; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + ASM_REWRITE_TAC[arith `SUC(SUC(SUC(SUC i))) = i + 4`]; + FIRST_X_ASSUM_ST `f i = f (i + 4)` ((unlist REWRITE_TAC) o GSYM); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + +let mcell3_gammaX_gamma3f = prove_by_refinement( + `!V u0 u1 w0 n f i. + pack_nonlinear_non_ox3q1h /\ + packing V /\ + saturated V /\ + leaf_rank V [u0; u1] w0 n f /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + 1 < n /\ + ~cc_4 V u0 u1 f i + ==> + gammaX V (cc_cell V [u0;u1;f i]) lmfun = + gamma3f (dist(u0,u1)) (dist(u0,f i)) (dist(u1,f i)) sqrt2 lmfun + `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Tskajxy_lemmas.gammaX_gamma3f [`V`;`cc_cell V [u0;u1;f i]`;`cc_uh V [u0;u1;f i]`;`u0`;`u1`;`f i`;`EL 3 (cc_uh V [u0;u1;f i])`;`dist(u1,f i)`;`dist(u0,f i)`;`dist(u0,u1)`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY ` [u0; u1; f i; EL 3 (cc_uh V [u0; u1; f i])] = cc_uh V [u0; u1; f i]` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC Leaf_cell.LIST_OF_CC_UH; + BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); + BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell]); + DISCH_THEN (unlist REWRITE_TAC); + BY(MESON_TAC[Merge_ineq.gamma3f_sym]) + ]);; + (* }}} *) + +let mcell3_dihX_dih_y = prove_by_refinement( + `!V u0 u1 w0 n f i. + pack_nonlinear_non_ox3q1h /\ + packing V /\ + saturated V /\ + leaf_rank V [u0; u1] w0 n f /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + 1 < n /\ + ~cc_4 V u0 u1 f i + ==> + dihX V (cc_cell V [u0;u1;f i]) (u0,u1) = + dih_y (dist(u0,u1)) (dist(u0,f i)) sqrt2 sqrt2 sqrt2 (dist(u1,f i)) + `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Tskajxy_lemmas.gammaX_gamma3f [`V`;`cc_cell V [u0;u1;f i]`;`cc_uh V [u0;u1;f i]`;`u0`;`u1`;`f i`;`EL 3 (cc_uh V [u0;u1;f i])`;`dist(u1,f i)`;`dist(u0,f i)`;`dist(u0,u1)`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY ` [u0; u1; f i; EL 3 (cc_uh V [u0; u1; f i])] = cc_uh V [u0; u1; f i]` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC Leaf_cell.LIST_OF_CC_UH; + BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); + BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell]); + DISCH_THEN (unlist REWRITE_TAC); + BY(MESON_TAC[Nonlinear_lemma.dih_y_sym;Nonlinear_lemma.dih_y_sym2]) + ]);; + (* }}} *) + +let mcell3_gammaXb_gamma3f = prove_by_refinement( + `!V u0 u1 w0 n f i. + pack_nonlinear_non_ox3q1h /\ + packing V /\ + saturated V /\ + leaf_rank V [u0; u1] w0 n f /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + 1 < n /\ + ~cc_4 V u0 u1 f i + ==> + gammaX V (cc_cell V [u1;u0;f (SUC i)]) lmfun = + gamma3f (dist(u0,u1)) (dist(u0,f (SUC i))) (dist(u1,f (SUC i))) sqrt2 lmfun + `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Tskajxy_lemmas.gammaX_gamma3f [`V`;`cc_cell V [u1;u0;f (SUC i)]`;`cc_uh V [u1;u0;f (SUC i)]`;`u1`;`u0`;`f (SUC i)`;`EL 3 (cc_uh V [u1;u0;f (SUC i)])`;`dist(u0,f (SUC i))`;`dist(u1,f (SUC i))`;`dist(u0,u1)`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY ` [u1; u0; f (SUC i); EL 3 (cc_uh V [u1; u0; f (SUC i)])] = cc_uh V [u1; u0; f (SUC i)]` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC Leaf_cell.LIST_OF_CC_UH; + BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); + CONJ_TAC; + BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell]); + ASM_REWRITE_TAC[]; + BY(MESON_TAC[DIST_SYM]); + DISCH_THEN (unlist REWRITE_TAC); + BY(MESON_TAC[Merge_ineq.gamma3f_sym]) + ]);; + (* }}} *) + +let mcell3_dihXb_dih_y = prove_by_refinement( + `!V u0 u1 w0 n f i. + pack_nonlinear_non_ox3q1h /\ + packing V /\ + saturated V /\ + leaf_rank V [u0; u1] w0 n f /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + 1 < n /\ + ~cc_4 V u0 u1 f i + ==> + dihX V (cc_cell V [u1;u0;f (SUC i)]) (u0,u1) = + dih_y (dist(u0,u1)) (dist(u0,f (SUC i))) sqrt2 sqrt2 sqrt2 (dist(u1,f (SUC i))) + `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Tskajxy_lemmas.gammaX_gamma3f [`V`;`cc_cell V [u1;u0;f (SUC i)]`;`cc_uh V [u1;u0;f (SUC i)]`;`u1`;`u0`;`f (SUC i)`;`EL 3 (cc_uh V [u1;u0;f (SUC i)])`;`dist(u0,f (SUC i))`;`dist(u1,f (SUC i))`;`dist(u0,u1)`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY ` [u1; u0; f (SUC i); EL 3 (cc_uh V [u1; u0; f (SUC i)])] = cc_uh V [u1; u0; f (SUC i)]` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC Leaf_cell.LIST_OF_CC_UH; + BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); + CONJ_TAC; + BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell]); + ASM_REWRITE_TAC[]; + BY(MESON_TAC[DIST_SYM]); + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC Marchal_cells_3.DIHX_SYM; + ASM_REWRITE_TAC[]; + CONJ_TAC; + ONCE_REWRITE_TAC[GSYM IN]; + MATCH_MP_TAC Leaf_cell.CC_CELL_IN_MCELL_SET; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;`[u1;u0;f (SUC i)]`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + TYPIFY `{u0,u1} = {u1,u0}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +(* Moved to Merge_ineq +let cell3_from_ineq_thm_ALT = prove_by_refinement( + `pack_nonlinear_non_ox3q1h ==> (!y4 y5 y6. + &2 <= y4 /\ + &2 <= y5 /\ + &2 <= y6 /\ + y4 <= &2 * sqrt (&2) /\ + y5 <= &2 * sqrt (&2) /\ + y6 <= &2 * sqrt (&2) /\ + eta_y y4 y5 y6 < sqrt (&2) + ==> &0 <= gamma3f y4 y5 y6 sqrt2 lmfun) + `, + (* {{{ proof *) + [ + DISCH_TAC; + INTRO_TAC Merge_ineq.cell3_from_ineq_thm []; + ANTS_TAC; + BY((REWRITE_TAC (map Merge_ineq.get_pack_nonlinear_non_ox3q1h ["QZECFIC wt0";"QZECFIC wt0 corner";"QZECFIC wt0 sqrt8";"QZECFIC wt1";"QZECFIC wt2 A";"CIHTIUM";"CJFZZDW";]))); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) +*) + + +let MCELL3_EDGE_EXPLICIT = prove_by_refinement( + `!V u0 u1 u2 u3. + packing V /\ + saturated V /\ + ~NULLSET (mcell3 V [u0; u1; u2; u3]) /\ + barV V 3 [u0; u1; u2; u3] + ==> edgeX V (mcell3 V [u0; u1; u2; u3]) = + {{u0, u1}, {u0, u2}, {u1, u2}}`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[EXTENSION]; + GEN_TAC; + TYPIFY `~(?u v. x = {u,v})` ASM_CASES_TAC; + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(ASM_MESON_TAC[EDGEX_PAIR]); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC Bump.MCELL3_EDGE [`V`;`[u0;u1;u2;u3]`;`u`;`v`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[set_of_list]; + INTRO_TAC MCELL3_EXTREME_CARD [`V`;`[u0;u1;u2;u3]`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_THEN (MP_TAC o (MATCH_MP Leaf_cell.CARD4_ALL_DISTINCT)); + REWRITE_TAC[Basics.TRUNCATE_SIMPLEX_EXPLICIT;set_of_list]; + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; + REWRITE_TAC[IN_INSERT;SUBSET;NOT_IN_EMPTY]; + TYPIFY `(u = u0)` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]); + TYPIFY `(u = u1)` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]); + TYPIFY `(u = u2)` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let critical_weight1 = prove_by_refinement( + `!V u0 u1 u2. critical_edge_y (dist(u0,u1)) /\ dist(u0,u2) < &2 * hminus /\ dist(u1,u2) < &2 * hminus /\ + cc_ke V [u0;u1;u2] = 3 /\ + packing V /\ + saturated V /\ + barV V 3 (cc_uh V [u0;u1;u2]) /\ + leaf V [u0;u1;u2] /\ + ~(NULLSET (cc_cell V [u0;u1;u2])) + ==> + critical_weight V (cc_cell V [u0;u1;u2]) = &1`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.critical_weight]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `CARD (critical_edgeX V (cc_cell V [u0; u1; u2])) = 1` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC Misc_defs_and_lemmas.CARD_SING; + REWRITE_TAC[SING]; + TYPIFY `{u0,u1}` EXISTS_TAC; + ONCE_REWRITE_TAC[EXTENSION]; + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + GEN_TAC; + PROOF_BY_CONTR_TAC; + TYPIFY `~(?u v. x = {u,v})` ENOUGH_TO_SHOW_TAC; + DISCH_TAC; + FIRST_X_ASSUM_ST `IN` MP_TAC; + ASM_REWRITE_TAC[Pack_defs.critical_edgeX;IN_ELIM_THM]; + BY(ASM_MESON_TAC[]); + DISCH_THEN MP_TAC THEN STRIP_TAC; + FIRST_X_ASSUM_ST `IN` MP_TAC; + ASM_REWRITE_TAC[critical_edgeX_critical_edge_y]; + TYPIFY `cc_cell V [u0;u1;u2] = mcell3 V (cc_uh V [u0;u1;u2])` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Leaf_cell.cc_cell;GSYM Bump.MCELL3]); + ASM_REWRITE_TAC[]; + INTRO_TAC Leaf_cell.LIST_OF_CC_UH [`V`;`[u0;u1;u2]`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_TAC; + ONCE_ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC MCELL3_EDGE_EXPLICIT; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + TYPIFY `{u,v} = {u0,u1}` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[Geomdetail.DIST_PAIR_LEMMA]); + REWRITE_TAC[Sphere.critical_edge_y]; + REWRITE_TAC[arith `x <= d <=> ~(d < x)`]; + TYPIFY `{u,v} = {u0,u2}` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[Geomdetail.DIST_PAIR_LEMMA]); + TYPIFY `{u,v} = {u1,u2}` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[Geomdetail.DIST_PAIR_LEMMA]); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let critical_weight1a = prove_by_refinement( + `!V u0 u1 w0 n f i . pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f /\ + ~cc_4 V u0 u1 f (i) /\ + dist(u0,f i) < &2 * hminus /\ dist(u1,f i) < &2 * hminus + ==> + critical_weight V (cc_cell V [u0; u1; f (i)]) = &1`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC critical_weight1 [`V`;`u0`;`u1`;`f i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY(DISCH_THEN (unlist REWRITE_TAC)) + ]);; + (* }}} *) + +let critical_weight1b = prove_by_refinement( + `!V u0 u1 w0 n f i . pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f /\ + ~cc_4 V u0 u1 f (i) /\ + dist(u0,f (SUC i)) < &2 * hminus /\ dist(u1,f (SUC i)) < &2 * hminus + ==> + critical_weight V (cc_cell V [u1; u0; f (SUC i)]) = &1`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC critical_weight1 [`V`;`u1`;`u0`;`f (SUC i)`]; + ANTS_TAC; + (ASM_REWRITE_TAC[]); + ONCE_REWRITE_TAC[DIST_SYM]; + BY(ASM_REWRITE_TAC[]); + BY(DISCH_THEN (unlist REWRITE_TAC)) + ]);; + (* }}} *) + + +let real_model_quqy = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> +(!i. (cc_4 V u0 u1 f i /\ + (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ + dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus /\ + dist (f i,f (SUC i)) < &2 * hminus) /\ + ~cc_4 V u0 u1 f (SUC i) + ==> &0 <= + gg_mcell V f u0 u1 i + + gammaX V (cc_cell V [u0; u1; f (SUC i)]) lmfun * + critical_weight V (cc_cell V [u0; u1; f (SUC i)]) )`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC critical_weight1a; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[arith `x * &1 = x`]; + INTRO_TAC mcell3_gammaX_gamma3f [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC i`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + INTRO_TAC GG_MCELL_QUARTER [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + MP_TAC (Merge_ineq.g_quqya_g_quqyb_ALT); + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + DISCH_TAC; + ONCE_REWRITE_TAC[Merge_ineq.gamma4fgcy_sym23]; + FIRST_X_ASSUM MATCH_MP_TAC; + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + FIRST_X_ASSUM_ST `rad2_y` MP_TAC; + BY(MESON_TAC[Merge_ineq.rad2_y_sym]) + ]);; + (* }}} *) + +(* +let real_model_quqy = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> +(!i. (cc_4 V u0 u1 f i /\ + (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ + dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus /\ + dist (f i,f (SUC i)) < &2 * hminus) /\ + ~cc_4 V u0 u1 f (SUC i) + ==> &0 <= + gg_mcell V f u0 u1 i + + gammaX V (cc_cell V [u0; u1; f (SUC i)]) lmfun)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC mcell3_gammaX_gamma3f [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC i`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + INTRO_TAC GG_MCELL_QUARTER [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + MP_TAC (Merge_ineq.g_quqya_g_quqyb_ALT); + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + DISCH_TAC; + ONCE_REWRITE_TAC[Merge_ineq.gamma4fgcy_sym23]; + FIRST_X_ASSUM MATCH_MP_TAC; + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + FIRST_X_ASSUM_ST `rad2_y` MP_TAC; + BY(MESON_TAC[Merge_ineq.rad2_y_sym]) + ]);; + (* }}} *) +*) + + +let real_model_quqy_sym = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> +(!i. (cc_4 V u0 u1 f (SUC i) /\ + (dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus) /\ + dist (u0,f (SUC (SUC i))) < &2 * hminus /\ + dist (u1,f (SUC (SUC i))) < &2 * hminus /\ + dist (f (SUC i),f (SUC (SUC i))) < &2 * hminus) /\ + ~cc_4 V u0 u1 f i + ==> &0 <= + gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun * + critical_weight V (cc_cell V [u1; u0; f (SUC i)]) + + gg_mcell V f u0 u1 (SUC i))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC critical_weight1b; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[arith `x * &1 = x`]; + INTRO_TAC mcell3_gammaXb_gamma3f [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + INTRO_TAC GG_MCELL_QUARTER [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC i`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + ONCE_REWRITE_TAC[arith `a + b = b + a`]; + MP_TAC (Merge_ineq.g_quqya_g_quqyb_ALT); + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + DISCH_THEN MATCH_MP_TAC; + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) + ]);; + (* }}} *) + +(* +let real_model_quqy_sym = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> +(!i. (cc_4 V u0 u1 f (SUC i) /\ + (dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus) /\ + dist (u0,f (SUC (SUC i))) < &2 * hminus /\ + dist (u1,f (SUC (SUC i))) < &2 * hminus /\ + dist (f (SUC i),f (SUC (SUC i))) < &2 * hminus) /\ + ~cc_4 V u0 u1 f i + ==> &0 <= + gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun + + gg_mcell V f u0 u1 (SUC i))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC mcell3_gammaXb_gamma3f [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + INTRO_TAC GG_MCELL_QUARTER [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC i`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + ONCE_REWRITE_TAC[arith `a + b = b + a`]; + MP_TAC (Merge_ineq.g_quqya_g_quqyb_ALT); + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + DISCH_THEN MATCH_MP_TAC; + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) + ]);; + (* }}} *) +*) + +let real_model_ztg4 = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> +(!i. cc_4 V u0 u1 f i + ==> a_spine5 + b_spine5 * azim_mcell V f u0 u1 i <= + gg_mcell V f u0 u1 i)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC GG_MCELL_GENERAL; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC c_4_azim_mcell_dih_y; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC (arith `g > a ==> a <= g`); + INTRO_TAC Merge_ineq.ztg4_ALT []; + ASM_REWRITE_TAC[]; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + DISCH_THEN MATCH_MP_TAC; + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) + ]);; + (* }}} *) + +let real_model_azim1 = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> + (!i. cc_4 V u0 u1 f i /\ + (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ + dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus /\ + dist (f i,f (SUC i)) < &2 * hminus + ==> -- #0.0659 + #0.042 * azim_mcell V f u0 u1 i <= + gg_mcell V f u0 u1 i) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC GG_MCELL_QUARTER; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC c_4_azim_mcell_dih_y; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC (arith `g +c - d > &0 ==> --c +d <= g`); + MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "QITNPEA 5653753305"); + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`;arith `#0.0 = &0`]; + DISCH_THEN MATCH_MP_TAC; + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) + ]);; + (* }}} *) + +let real_model_gaz4 = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> + (!i. cc_4 V u0 u1 f i /\ + (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ + dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus /\ + dist (f i,f (SUC i)) < &2 * hminus + ==> -- #0.0142852 + #0.00609451 * azim_mcell V f u0 u1 i <= + gg_mcell V f u0 u1 i)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC GG_MCELL_QUARTER; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC c_4_azim_mcell_dih_y; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC (arith `g +c - d > #0.0 ==> --c +d <= g`); + MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "QITNPEA 6206775865"); + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + DISCH_THEN MATCH_MP_TAC; + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2;arith `#2 = &2`]; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) + ]);; + (* }}} *) + +let real_model_gaz6 = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> + (!i. cc_4 V u0 u1 f i /\ + (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ + dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus /\ + dist (f i,f (SUC i)) < &2 * hminus + ==> #0.161517 - #0.119482 * azim_mcell V f u0 u1 i <= + gg_mcell V f u0 u1 i) `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC GG_MCELL_QUARTER; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC c_4_azim_mcell_dih_y; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC (arith `g - c + d > #0.0 ==> c - d <= g`); + MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "QITNPEA 3848804089"); + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + DISCH_THEN MATCH_MP_TAC; + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2;arith `#2 = &2`]; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) + ]);; + (* }}} *) + +let real_model_gamma_qx = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> +(!i. cc_4 V u0 u1 f i /\ + ~(dist (u0,f i) < &2 * hminus /\ + dist (u1,f i) < &2 * hminus /\ + dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus /\ + dist (f i,f (SUC i)) < &2 * hminus) + ==> #0.0 <= gg_mcell V f u0 u1 i)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC GG_MCELL_GENERAL; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC (arith `&0 < x ==> #0.0 <= x`); + MP_TAC Merge_ineq.gamma_qx_ALT; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + DISCH_THEN MATCH_MP_TAC; + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2;arith `#2 = &2`]; + (ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let real_model_g_qxd = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> +(!i. (cc_4 V u0 u1 f i /\ + ~(dist (u0,f i) < &2 * hminus /\ + dist (u1,f i) < &2 * hminus /\ + dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus /\ + dist (f i,f (SUC i)) < &2 * hminus)) /\ + #2.3 < azim_mcell V f u0 u1 i + ==> #0.0057 <= gg_mcell V f u0 u1 i) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC GG_MCELL_GENERAL; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC (arith `y < x ==> y <= x`); + MP_TAC Merge_ineq.g_qxd_ALT; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + DISCH_THEN MATCH_MP_TAC; + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2;arith `#2 = &2`]; + (ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + FIRST_X_ASSUM_ST `azim_mcell` MP_TAC; + MATCH_MP_TAC (arith `a = d ==> (x < a ==> x < d)`); + GMATCH_SIMP_TAC c_4_azim_mcell_dih_y; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let wtcount6_y_sym23 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + wtcount6_y y1 y2 y3 y4 y5 y6 = wtcount6_y y1 y3 y2 y4 y6 y5 `, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + BY(ARITH_TAC) + ]);; + (* }}} *) + +let wtcount6_y_sym26 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + wtcount6_y y1 y2 y3 y4 y5 y6 = wtcount6_y y1 y6 y5 y4 y3 y2 `, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + BY(ARITH_TAC) + ]);; + (* }}} *) + +let beta_bumpA_y_sym23 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + beta_bumpA_y y1 y2 y3 y4 y5 y6 = beta_bumpA_y y1 y3 y2 y4 y6 y5 `, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.beta_bumpA_y;Sphere.beta_bumpA_y]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let real_model_gamma10 = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> + (!i. (cc_4 V u0 u1 f i /\ + ~(dist (u0,f i) < &2 * hminus /\ + dist (u1,f i) < &2 * hminus /\ + dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus /\ + dist (f i,f (SUC i)) < &2 * hminus)) /\ + ((dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ + dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus) /\ + ~cc_4 V u0 u1 f (SUC i) + ==> #0.0057 <= + gg_mcell V f u0 u1 i + + gammaX V (cc_cell V [u0; u1; f (SUC i)]) lmfun * + critical_weight V (cc_cell V [u0; u1; f (SUC i)])) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC critical_weight1a; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[arith `x * &1 = x`]; + GMATCH_SIMP_TAC GG_MCELL_GENERAL; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC mcell3_gammaX_gamma3f; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + ONCE_REWRITE_TAC[Merge_ineq.gamma4fgcy_sym23]; + ONCE_REWRITE_TAC[wtcount6_y_sym23]; + ONCE_REWRITE_TAC[beta_bumpA_y_sym23]; + MP_TAC Merge_ineq.gamma10_gamma11_ALT; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`;arith `(a + b) + c = a + b + c`]; + DISCH_THEN MATCH_MP_TAC; + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2;arith `#2 = &2`]; + (ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + CONJ2_TAC; + BY(ASM_MESON_TAC[Merge_ineq.rad2_y_sym]); + REPEAT (FIRST_X_ASSUM_ST `~` MP_TAC); + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let real_model_gamma11 = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> + (!i. (cc_4 V u0 u1 f (SUC i) /\ + ~(dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus /\ + dist (u0,f (SUC (SUC i))) < &2 * hminus /\ + dist (u1,f (SUC (SUC i))) < &2 * hminus /\ + dist (f (SUC i),f (SUC (SUC i))) < &2 * hminus)) /\ + ((dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus) /\ + dist (u0,f (SUC (SUC i))) < &2 * hminus /\ + dist (u1,f (SUC (SUC i))) < &2 * hminus) /\ + ~cc_4 V u0 u1 f i + ==> #0.0057 <= + gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun * + critical_weight V (cc_cell V [u1; u0; f (SUC i)]) + + gg_mcell V f u0 u1 (SUC i)) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC critical_weight1b; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[arith `x * &1 = x`]; + GMATCH_SIMP_TAC GG_MCELL_GENERAL; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC mcell3_gammaXb_gamma3f; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + ONCE_REWRITE_TAC[arith `g3 + g4 + b = g4 + b + g3`]; + MP_TAC Merge_ineq.gamma10_gamma11_ALT; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`;arith `(a + b) + c = a + b + c`]; + DISCH_THEN MATCH_MP_TAC; + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`SUC i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2;arith `#2 = &2`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let leaf_CIHTIUM = prove_by_refinement( + `!V u0 u1 u2. pack_nonlinear_non_ox3q1h /\ packing V /\ saturated V /\ + leaf V [u0;u1;u2] /\ critical_edge_y (dist(u0,u1)) /\ + (&2 * hminus <= dist(u0,u2)) /\ (&2 * hminus <= dist(u1,u2)) ==> F`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Leaf_cell.GBEWYFX [`V`;`[u0;u1;u2]`]; + ASM_REWRITE_TAC[set_of_list]; + INTRO_TAC LEAF_DOMAIN [`V`;`[u0;u1;u2]`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + REPEAT (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[Leaf_cell.leaf;Pack_defs.HL;set_of_list]; + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "CIHTIUM"); + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + DISCH_TAC; + FIRST_X_ASSUM_ST `sqrt2` MP_TAC; + MATCH_MP_TAC (arith `s < r ==> (r < s ==> F)`); + GMATCH_SIMP_TAC RADV_ETAY; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC (GSYM Tactics_jordan.REAL_POW_2_LT); + REWRITE_TAC[Nonlinear_lemma.sqrt2_nn;ETA_Y_POS_LE_ALT;Nonlin_def.sqrt2_sqrt2;arith `sqrt2 pow 2 = sqrt2 * sqrt2`]; + REWRITE_TAC[arith `x < y <=> y > x`]; + FIRST_X_ASSUM MATCH_MP_TAC; + GEXISTL_TAC [`&1`;`&1`;`&1`]; + ASM_REWRITE_TAC[REAL_LE_REFL]; + ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + BY(ASM_MESON_TAC[Sphere.critical_edge_y]) + ]);; + (* }}} *) + +let gamma4fgcy_sym26 = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6 f. gamma4fgcy y1 y2 y3 y4 y5 y6 f = gamma4fgcy y1 y6 y5 y4 y3 y2 f`, + (* {{{ proof *) + [ + BY(MESON_TAC[Merge_ineq.gamma4fgcy_sym03;Merge_ineq.gamma4fgcy_sym23;Merge_ineq.gamma4fgcy_sym12]) + ]);; + (* }}} *) + +let gamma4fgcy_POS = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. pack_nonlinear_non_ox3q1h /\ rad2_y y1 y2 y3 y4 y5 y6 < &2 /\ critical_edge_y y1 /\ + ~(y2 < &2 * hminus /\ + y3 < &2 * hminus /\ + y4 < &2 * hminus /\ + y5 < &2 * hminus /\ + y6 < &2 * hminus ) /\ + &2 <= y2 /\ y2 <= sqrt8 /\ &2 <= y3 /\ y3 <= sqrt8 /\ +&2 <= y4 /\ y4 <= sqrt8 /\ +&2 <= y5 /\ y5 <= sqrt8 /\ +&2 <= y6 /\ y6 <= sqrt8 ==> +&0 < gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "GLFVCVK4 2477216213"); + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + REWRITE_TAC[TAUT `a ==> b \/ c \/ d <=> a /\ ~c /\ ~d ==> b`]; + REWRITE_TAC[arith `g > &0 <=> &0 < g`]; + DISCH_THEN MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[GSYM Sphere.rad2_y]; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[Sphere.critical_edge_y]); + DISCH_TAC; + CONJ2_TAC; + BY(FIRST_X_ASSUM_ST `rad2_y` MP_TAC THEN REAL_ARITH_TAC); + DISCH_THEN (MP_TAC o (MATCH_MP Merge_ineq.quarter_norm2hh)); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let real_model_gamma8 = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> + (!i. (cc_4 V u0 u1 f i /\ + ~(dist (u0,f i) < &2 * hminus /\ + dist (u1,f i) < &2 * hminus /\ + dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus /\ + dist (f i,f (SUC i)) < &2 * hminus)) /\ + (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ + ~(dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus) + ==> #0.0057 <= gg_mcell V f u0 u1 i) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC GG_MCELL_NONBETA; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + MP_TAC Merge_ineq.QITNPEA4_9063653052_weak_ALT; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + DISCH_TAC; + MATCH_MP_TAC (arith `gw > c ==> c <= gw`); + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC leaf_CIHTIUM [`V`;`u0`;`u1`;`f (SUC i)`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[DE_MORGAN_THM ;arith `~(x <= y) <=> y < x`]; + COMMENT "case split"; + DISCH_THEN DISJ_CASES_TAC; + FIRST_X_ASSUM_ST `~(a /\ b)` MP_TAC; + ASM_REWRITE_TAC[arith `~(a < b) <=> b <= a`]; + DISCH_TAC; + ONCE_REWRITE_TAC[wtcount6_y_sym26]; + ONCE_REWRITE_TAC[gamma4fgcy_sym26]; + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + SUBCONJ_TAC; + FIRST_X_ASSUM_ST `rad2_y` MP_TAC; + BY(MESON_TAC[Merge_ineq.rad2_y_sym]); + DISCH_TAC; + MATCH_MP_TAC (arith `x < y ==> x <= y`); + MATCH_MP_TAC gamma4fgcy_POS; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[arith `x <= y ==> ~(y < x)`]; + ASM_SIMP_TAC[Merge_ineq.y_bounds]; + ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + COMMENT "second case"; + FIRST_X_ASSUM_ST `~(a /\ b)` MP_TAC; + ASM_REWRITE_TAC[arith `~(a < b) <=> b <= a`]; + DISCH_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + MATCH_MP_TAC (arith `x < y ==> x <= y`); + MATCH_MP_TAC gamma4fgcy_POS; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[arith `x <= y ==> ~(y < x)`]; + ASM_SIMP_TAC[Merge_ineq.y_bounds]; + ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) + ]);; + (* }}} *) + +let real_model_gamma8b = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> +(!i. (cc_4 V u0 u1 f i /\ + ~(dist (u0,f i) < &2 * hminus /\ + dist (u1,f i) < &2 * hminus /\ + dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus /\ + dist (f i,f (SUC i)) < &2 * hminus)) /\ + (dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus) /\ + ~(dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) + ==> #0.0057 <= gg_mcell V f u0 u1 i) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC GG_MCELL_NONBETA; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + ONCE_REWRITE_TAC[Merge_ineq.gamma4fgcy_sym23]; + ONCE_REWRITE_TAC[wtcount6_y_sym23]; + MP_TAC Merge_ineq.QITNPEA4_9063653052_weak_ALT; + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + DISCH_TAC; + MATCH_MP_TAC (arith `gw > c ==> c <= gw`); + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC CC_4_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC leaf_CIHTIUM [`V`;`u0`;`u1`;`f i`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[DE_MORGAN_THM ;arith `~(x <= y) <=> y < x`]; + COMMENT "case split"; + DISCH_THEN DISJ_CASES_TAC; + FIRST_X_ASSUM_ST `~(a /\ b)` MP_TAC; + ASM_REWRITE_TAC[arith `~(a < b) <=> b <= a`]; + DISCH_TAC; + ONCE_REWRITE_TAC[wtcount6_y_sym26]; + ONCE_REWRITE_TAC[gamma4fgcy_sym26]; + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + SUBCONJ_TAC; + FIRST_X_ASSUM_ST `rad2_y` MP_TAC; + BY(MESON_TAC[Merge_ineq.rad2_y_sym]); + DISCH_TAC; + MATCH_MP_TAC (arith `x < y ==> x <= y`); + MATCH_MP_TAC gamma4fgcy_POS; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[arith `x <= y ==> ~(y < x)`]; + ASM_SIMP_TAC[Merge_ineq.y_bounds]; + ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + COMMENT "second case"; + FIRST_X_ASSUM_ST `~(a /\ b)` MP_TAC; + ASM_REWRITE_TAC[arith `~(a < b) <=> b <= a`]; + DISCH_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + SUBCONJ_TAC; + FIRST_X_ASSUM_ST `rad2_y` MP_TAC; + BY(MESON_TAC[Merge_ineq.rad2_y_sym]); + DISCH_TAC; + MATCH_MP_TAC (arith `x < y ==> x <= y`); + MATCH_MP_TAC gamma4fgcy_POS; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[arith `x <= y ==> ~(y < x)`]; + ASM_SIMP_TAC[Merge_ineq.y_bounds]; + ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) + ]);; + (* }}} *) + +let real_model_gaz9 = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> + (!i. (cc_4 V u0 u1 f i /\ + ~(dist (u0,f i) < &2 * hminus /\ + dist (u1,f i) < &2 * hminus /\ + dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus /\ + dist (f i,f (SUC i)) < &2 * hminus)) /\ + (dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ + dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus + ==> #0.213849 - #0.119482 * azim_mcell V f u0 u1 i <= + gg_mcell V f u0 u1 i) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC c_4_azim_mcell_dih_y; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `~` MP_TAC; + ASM_REWRITE_TAC[]; + DISCH_TAC; + GMATCH_SIMP_TAC GG_MCELL_GENERAL; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC (arith `(?t. x <= g + t /\ &1 * t <= b) ==> x <= g + b`); + TYPIFY`beta_bump_lb` EXISTS_TAC; + REWRITE_TAC[ Merge_ineq.beta_bumpA_lb1 ]; + MATCH_MP_TAC (arith `(?w. x <= g / w + t /\ g / w <= g / w') ==> (x <= g / w' + t)`); + TYPIFY `&2` EXISTS_TAC; + CONJ2_TAC; + MATCH_MP_TAC Merge_ineq.gamma_wt; + ONCE_REWRITE_TAC[TAUT `a /\ b /\ c <=> b /\ a /\ c`]; + CONJ_TAC; + REWRITE_TAC[arith `x > &0 <=> &0 < x`]; + MATCH_MP_TAC gamma4fgcy_POS; + ASM_REWRITE_TAC[]; + ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + ASM_REWRITE_TAC[Sphere.critical_edge_y]; + ASM_SIMP_TAC[arith `x < y ==> ~(y<= x)`]; + BY(ARITH_TAC); + MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "QITNPEA 2134082733"); + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + ASM_REWRITE_TAC[GSYM Sphere.rad2_y]; + REWRITE_TAC[TAUT ` (a ==> b \/ c) <=> (a /\ ~c ==> b)`]; + REWRITE_TAC[arith `g + b - c + d > #0.0 <=> c - d < g + b`]; + DISCH_TAC; + MATCH_MP_TAC (arith `x < y ==> x <= y`); + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + CONJ2_TAC; + BY(FIRST_X_ASSUM_ST `rad2_y` MP_TAC THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let real_model_azim2 = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> + (!i. (cc_4 V u0 u1 f i /\ + ~(dist (u0,f i) < &2 * hminus /\ + dist (u1,f i) < &2 * hminus /\ + dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus /\ + dist (f i,f (SUC i)) < &2 * hminus)) /\ + ((dist (u0,f i) < &2 * hminus /\ dist (u1,f i) < &2 * hminus) /\ + dist (u0,f (SUC i)) < &2 * hminus /\ + dist (u1,f (SUC i)) < &2 * hminus) /\ + &2 * hplus < dist (f i,f (SUC i)) + ==> #0.00457511 + #0.00609451 * azim_mcell V f u0 u1 i <= + gg_mcell V f u0 u1 i) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC c_4_azim_mcell_dih_y; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + INTRO_TAC MCELL4_DOMAIN [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~critical_edge_y (dist(f i,f (SUC i)))` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_SIMP_TAC[Sphere.critical_edge_y;arith `h < x ==> ~(x<= h)`]); + GMATCH_SIMP_TAC GG_MCELL_NONBETA; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + TYPIFY `wtcount6_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) (dist (f i,f (SUC i))) (dist (u1,f (SUC i))) (dist (u1,f i)) = 1` (C SUBGOAL_THEN SUBST1_TAC); + ASM_REWRITE_TAC[Sphere.wtcount6_y;Sphere.wtcount3_y]; + ASM_REWRITE_TAC[Sphere.critical_edge_y]; + ASM_SIMP_TAC[arith `x < y ==> ~(y<= x)`]; + BY(ARITH_TAC); + MATCH_MP_TAC (arith `g - c - d > #0.0 ==> c + d <= g / &1`); + MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "QITNPEA 9939613598"); + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + ASM_REWRITE_TAC[GSYM Sphere.rad2_y]; + REWRITE_TAC[TAUT ` (a ==> b \/ c) <=> (a /\ ~c ==> b)`]; + DISCH_THEN MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + CONJ2_TAC; + BY(FIRST_X_ASSUM_ST `rad2_y` MP_TAC THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]) + ]);; + (* }}} *) + +let CC_3_SUM_SET = prove_by_refinement( + `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~cc_4 V u0 u1 f i /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f ==> {X | mcell_set V X /\ + {u0, u1} IN edgeX V X /\ + X SUBSET wedge_ge u0 u1 (f i) (f (SUC i))} = + {cc_cell V [u0;u1;f i],cc_cell V [u1;u0;f (SUC i)]} UNION + {X | mcell_set V X /\ {u0,u1} IN edgeX V X /\ + X SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ + ~(X = cc_cell V [u0;u1;f i]) /\ ~(X = cc_cell V [u1;u0;f (SUC i)])}`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ONCE_REWRITE_TAC[EXTENSION]; + REWRITE_TAC[IN_UNION;IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[IN_ELIM_THM]; + GEN_TAC; + MATCH_MP_TAC (TAUT `((a==> b) /\ (b ==> a)) ==> (a = b)`); + CONJ_TAC; + BY(MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC NO_4CELL_IMP_K3 [`V`;`wedge_ge u0 u1 (f i) (f (SUC i))`;`[u0;u1]`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + ANTS_TAC; + BY(ASM_MESON_TAC[cc_4]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Leaf_cell.STEM_EDGEX [`V`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_ASSUM (C INTRO_TAC [`[u0;u1;f i]`]); + FIRST_X_ASSUM (C INTRO_TAC [`[u1;u0;f(SUC i)]`]); + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + TYPIFY `{u1,u0} = {u0,u1}` (C SUBGOAL_THEN ASSUME_TAC); + BY(SET_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `\/` DISJ_CASES_TAC; + BY(ASM_MESON_TAC[Leaf_cell.CC_CELL_IN_MCELL_SET;IN]); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let CC_3_SUM_fn = prove_by_refinement( + `!V u0 u1 w0 n f i fn. pack_nonlinear_non_ox3q1h /\ 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~cc_4 V u0 u1 f i /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f ==> + sum {X | mcell_set V X /\ + {u0, u1} IN edgeX V X /\ + X SUBSET wedge_ge u0 u1 (f i) (f (SUC i))} fn = + fn (cc_cell V [u0;u1;f i]) + fn (cc_cell V [u1;u0;f (SUC i)]) + + sum + {X | mcell_set V X /\ {u0,u1} IN edgeX V X /\ + X SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ + ~(X = cc_cell V [u0;u1;f i]) /\ ~(X = cc_cell V [u1;u0;f (SUC i)])} fn`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC CC_3_SUM_SET; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + INTRO_TAC Marchal_cells_3.FINITE_EDGE_X2 [`V`;`{u0,u1}`;`u0`;`u1`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + GMATCH_SIMP_TAC SUM_UNION; + REWRITE_TAC[FINITE_INSERT;FINITE_EMPTY]; + CONJ_TAC; + CONJ_TAC; + MATCH_MP_TAC FINITE_SUBSET; + TYPIFY `{X | mcell_set V X /\ edgeX V X {u0, u1}}` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[SUBSET;IN_ELIM_THM]; + BY(MESON_TAC[IN]); + REWRITE_TAC[DISJOINT]; + BY(SET_TAC[]); + MATCH_MP_TAC (arith `s = s'+s'' ==> (s + a = s'+s'' + a)`); + MATCH_MP_TAC Geomdetail.SUM_DIS2; + INTRO_TAC NO_4CELL_IMP_K3 [`V`;`wedge_ge u0 u1 (f i) (f (SUC i))`;`[u0;u1]`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + ANTS_TAC; + BY(ASM_MESON_TAC[cc_4]); + BY(DISCH_THEN (unlist REWRITE_TAC)) + ]);; + (* }}} *) + +let EDGE_IMP_K23 = prove_by_refinement( + `!V X u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~cc_4 V u0 u1 f i /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f /\ + mcell_set V X /\ + {u0, u1} IN edgeX V X /\ + X SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) + ==> (?k v1 v2. barV V 3 [u0;u1;v1;v2] /\ ((k = 2)\/ (k = 3)) /\ X = mcell k V [u0;u1;v1;v2]) + `, + (* {{{ proof *) + [ + REWRITE_TAC[Qzyzmjc.mcell_set_2;IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `i'` EXISTS_TAC; + FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP (arith `i' <= 4 ==> (i' <= 1 \/ i' = 4 \/ i' = 2 \/ i' = 3)`))); + FIRST_X_ASSUM DISJ_CASES_TAC; + INTRO_TAC Bump.EDGE_IMP_K2 [`V`;`ul`;`i'`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + BY(ASM_MESON_TAC[NOT_IN_EMPTY;IN]); + FIRST_X_ASSUM DISJ_CASES_TAC; + BY(ASM_MESON_TAC[cc_4;IN;Bump.MCELL4]); + ASM_REWRITE_TAC[]; + INTRO_TAC Leaf_cell.MCELL_EDGE_FIRST [`V`;`ul`;`i'`;`u0`;`u1`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + REPEAT WEAKER_STRIP_TAC; + GEXISTL_TAC [ `EL 2 vl`;`EL 3 vl`]; + TYPIFY `[u0; u1; EL 2 vl; EL 3 vl] = vl` (C SUBGOAL_THEN SUBST1_TAC); + MATCH_MP_TAC EQ_SYM; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC Bump.LENGTH4; + REWRITE_TAC[arith `4 = 3 + 1`] THEN MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA; + BY(ASM_MESON_TAC[IN]); + BY(ASM_MESON_TAC[IN]) + ]);; + (* }}} *) + +let CC_2_PROPS = prove_by_refinement( + `!V X u0 u1 vl. + pack_nonlinear_non_ox3q1h /\ + packing V /\ + saturated V /\ + critical_edge_y (dist(u0,u1)) /\ + X = mcell2 V vl /\ + {u0,u1} IN edgeX V X /\ + barV V 3 vl + ==> + ~(NULLSET X) /\ + gammaX V X lmfun = gamma2_x_div_azim_v2 (h0cut (dist(u0,u1))) (dist(u0,u1) * dist(u0,u1)) * dihX V X (u0,u1) /\ + &0 < dihX V X (u0,u1) /\ + #0.008 * dihX V X (u0,u1) < gammaX V X lmfun`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + SUBCONJ_TAC; + REWRITE_TAC[Bump.MCELL2]; + DISCH_THEN (MP_TAC o (MATCH_MP Bump.RIJRIED)); + BY(ASM_MESON_TAC[NOT_IN_EMPTY;IN;Bump.MCELL2]); + DISCH_TAC; + INTRO_TAC Leaf_cell.MCELL2_EDGE_FIRST [`V`;`vl`;`u0`;`u1`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MCELL2_DIHX_POS [`V`;`X`;`vl'`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + DISCH_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (TAUT `((a ==> b) /\ a) ==> (a /\ b)`); + CONJ_TAC; + DISCH_THEN SUBST1_TAC; + MATCH_MP_TAC REAL_LT_RMUL; + ASM_REWRITE_TAC[]; + MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "GRKIBMP A V2"); + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + REWRITE_TAC[Sphere.y_of_x;Functional_equation.nonf_gamma2_x1_div_a_v2]; + REWRITE_TAC[arith `x > y <=> y < x`]; + DISCH_THEN MATCH_MP_TAC; + GEXISTL_TAC [`&1`;`&1`;`&1`;`&1`;`&1`]; + REWRITE_TAC[REAL_LE_REFL]; + FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; + ASM_REWRITE_TAC[Sphere.critical_edge_y]; + MP_TAC Nonlinear_lemma.hminus_prop; + BY(REAL_ARITH_TAC); + COMMENT "gammaX formula"; + INTRO_TAC Tskajxy.GAMMAX_GAMMA2_X [`V`;`X`;`vl'`;`dist(u0,u1)`;`dist(u0,mxi V vl')`;`dist(u0,omega_list_n V vl' 3)`;`dist(mxi V vl',omega_list_n V vl' 3)`;`dist(u1,omega_list_n V vl' 3)`;`dist(u1,mxi V vl')`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `x = y ==> a * x = a * y`); + GMATCH_SIMP_TAC Tskajxy.MCELL2_DIHX; + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] Merge_ineq.DIHV_EQ_DIH_Y); + INTRO_TAC Tskajxy.NOT_COPLANAR_EXTREME_MCELL2 [`V`;`vl'`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + DISCH_TAC; + FIRST_ASSUM (ASSUME_TAC o (MATCH_MP NOT_COPLANAR_NOT_COLLINEAR)); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + TYPIFY `{EL 0 vl', EL 1 vl', mxi V vl', omega_list_n V vl' 3} = {EL 0 vl', EL 1 vl', omega_list_n V vl' 3, mxi V vl'}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(MESON_TAC[NOT_COPLANAR_NOT_COLLINEAR]) + ]);; + (* }}} *) + +let MCELL2_CRITICAL_WEIGHT1 = prove_by_refinement( + `!V X u0 u1 vl. + pack_nonlinear_non_ox3q1h /\ + packing V /\ + saturated V /\ + critical_edge_y (dist(u0,u1)) /\ + X = mcell2 V vl /\ + {u0,u1} IN edgeX V X /\ + barV V 3 vl ==> + critical_weight V X = &1`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Pack_defs.critical_edge_y;Pack_defs.critical_weight]; + MATCH_MP_TAC (arith `x = &1 ==> &1 / x = &1`); + REWRITE_TAC[REAL_OF_NUM_EQ]; + MATCH_MP_TAC Misc_defs_and_lemmas.CARD_SING; + REWRITE_TAC[SING]; + TYPIFY `{u0,u1}` EXISTS_TAC; + ONCE_REWRITE_TAC[EXTENSION]; + GEN_TAC; + INTRO_TAC Bump.MCELL2_EDGE [`V`;`vl`;`{u0,u1}`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + DISCH_TAC; + INTRO_TAC Tskajxy.MCELL2_VX_PROPS [`V`;`X`;`vl`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[ Bump.MCELL2]; + DISCH_THEN (MP_TAC o (MATCH_MP Bump.RIJRIED)); + BY(ASM_MESON_TAC[NOT_IN_EMPTY;Bump.MCELL2]); + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + TYPIFY `~(?u v. x = {u,v})` ENOUGH_TO_SHOW_TAC; + DISCH_TAC; + FIRST_X_ASSUM_ST `IN` MP_TAC; + ASM_REWRITE_TAC[Pack_defs.critical_edgeX;IN_ELIM_THM]; + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `IN` MP_TAC; + ASM_REWRITE_TAC[critical_edgeX_critical_edge_y;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; + FIRST_X_ASSUM_ST `mcell2` (SUBST1_TAC o GSYM); + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(ASM_MESON_TAC[Geomdetail.DIST_PAIR_LEMMA]) + ]);; + (* }}} *) + +let MCELL3_CRITICAL_WEIGHT = prove_by_refinement( + `!V X u0 u1 v1 v2. + pack_nonlinear_non_ox3q1h /\ + packing V /\ + saturated V /\ + critical_edge_y (dist(u0,u1)) /\ + X = mcell3 V [u0;u1;v1;v2] /\ + {u0,u1} IN edgeX V X /\ + barV V 3 [u0;u1;v1;v2] ==> + critical_weight V X = &1 / &(wtcount3_y (dist(u0,u1)) (dist(u0,v1)) (dist(u1,v1)))`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.critical_weight]; + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Pack_defs.critical_edge_y;Pack_defs.critical_weight;arith `&1 /x = inv x`]; + REWRITE_TAC[REAL_EQ_INV2;REAL_OF_NUM_EQ]; + TYPIFY `~NULLSET X` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[Bump.MCELL3]; + DISCH_THEN (MP_TAC o (MATCH_MP Bump.RIJRIED)); + BY(ASM_MESON_TAC[NOT_IN_EMPTY;Bump.MCELL3]); + INTRO_TAC MCELL3_EDGE_EXPLICIT [`V`;`u0`;`u1`;`v1`;`v2`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + TYPIFY `critical_edgeX V X SUBSET edgeX V X` (C SUBGOAL_THEN MP_TAC); + REWRITE_TAC[SUBSET;Bump.CRITICAL_EDGEX_ALT]; + BY(MESON_TAC[]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `critical_edgeX V (mcell3 V [u0; u1; v1; v2]) = {{u0, u1}, {u0, v1}, {u1, v1}} INTER critical_edgeX V (mcell3 V [u0; u1; v1; v2])` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM MP_TAC; + BY(SET_TAC[]); + INTRO_TAC Upfzbzm_support_lemmas.FINITE_critical_edgeX [`V`;`X`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + ASM_SIMP_TAC[CARD_INSERT_INTER_ALT]; + ASM_REWRITE_TAC[INTER_EMPTY;CARD_CLAUSES;NOT_IN_EMPTY;IN_INSERT;critical_edgeX_critical_edge_y]; + INTRO_TAC MCELL3_EXTREME_CARD [`V`;`[u0; u1; v1; v2]`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_THEN (ASSUME_TAC o (MATCH_MP Leaf_cell.CARD4_ALL_DISTINCT)); + ASM_REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; + REWRITE_TAC[Sphere.wtcount3_y]; + ASM_REWRITE_TAC[]; + BY(ARITH_TAC) + ]);; + (* }}} *) + +let MCELL3_008 = prove_by_refinement( + `!V X u0 u1 ul. + pack_nonlinear_non_ox3q1h /\ + packing V /\ + saturated V /\ + X = mcell3 V ul /\ + critical_edge_y (dist(u0,u1)) /\ + {u0,u1} IN edgeX V (X) /\ + barV V 3 ul ==> + #0.008 * dihX V (X) (u0,u1) <= + gammaX V (X) lmfun * + critical_weight V (X) + + beta_bump_v1 V {u0, u1} (X) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + COMMENT "now 3 cell"; + INTRO_TAC Leaf_cell.MCELL3_EDGE_FIRST [`V`;`ul`;`u0`;`u1`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + REWRITE_TAC[IN]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (fun t -> REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[t]); + REPEAT WEAKER_STRIP_TAC; + TYPIFY `~NULLSET X` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[Bump.MCELL3]; + DISCH_THEN (MP_TAC o (MATCH_MP Bump.RIJRIED)); + BY(ASM_MESON_TAC[NOT_IN_EMPTY;Bump.MCELL3]); + TYPIFY `vl = [EL 0 vl; EL 1 vl; EL 2 vl; EL 3 vl]` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Bump.LENGTH4; + BY(REWRITE_TAC[arith `4 = 3+1`] THEN ASM_MESON_TAC[Sphere.BARV;IN]); + INTRO_TAC Tskajxy_lemmas.gammaX_gamma3f [`V`;`mcell3 V vl`;`vl`;`EL 0 vl`;`EL 1 vl`;`EL 2 vl`;`EL 3 vl`;`dist(EL 1 vl,EL 2 vl)`;`dist(EL 0 vl,EL 2 vl)`;`dist(EL 0 vl,EL 1 vl)`]; + ANTS_TAC; + ASM_REWRITE_TAC[Bump.MCELL3]; + BY(ASM_MESON_TAC[Bump.MCELL3]); + ASM_REWRITE_TAC[Bump.MCELL3]; + FIRST_ASSUM SUBST1_TAC; + REWRITE_TAC[Bump.EL_EXPLICIT]; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC Merge_ineq.cell3_008_from_ineq_ALT []; + ASM_REWRITE_TAC[]; + DISCH_TAC; + REWRITE_TAC[GSYM Bump.MCELL3]; + GMATCH_SIMP_TAC MCELL3_CRITICAL_WEIGHT; + GEXISTL_TAC [`EL 0 vl`;`EL 1 vl`;`EL 2 vl`]; + CONJ_TAC; + TYPIFY `EL 3 vl` EXISTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[Bump.MCELL3]); + TYPIFY `gamma3f (dist (EL 1 vl,EL 2 vl)) (dist (EL 0 vl,EL 2 vl)) (dist (EL 0 vl,EL 1 vl)) sqrt2 lmfun = gamma3f (dist (EL 0 vl,EL 1 vl)) (dist (EL 1 vl,EL 2 vl)) (dist (EL 0 vl,EL 2 vl)) sqrt2 lmfun` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[Merge_ineq.gamma3f_sym]); + TYPIFY `wtcount3_y (dist (EL 0 vl,EL 1 vl)) (dist (EL 0 vl,EL 2 vl)) (dist (EL 1 vl,EL 2 vl)) = wtcount3_y (dist (EL 0 vl,EL 1 vl)) (dist (EL 1 vl,EL 2 vl)) (dist (EL 0 vl,EL 2 vl))` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[Sphere.wtcount3_y]; + BY(ARITH_TAC); + REWRITE_TAC[arith `x * &1 / y = x / y`]; + REWRITE_TAC[arith `#0.008 * d = d * #0.008`]; + REWRITE_TAC[Bump.MCELL3]; + REPEAT (GMATCH_SIMP_TAC Bump.MCELL_BUMP_0); + CONJ_TAC; + BY(ASM_MESON_TAC[arith `3 < 4`;Bump.MCELL3]); + REWRITE_TAC[arith `x + &0 = x`]; + FIRST_X_ASSUM MATCH_MP_TAC; + INTRO_TAC MCELL3_DOMAIN [`V`;`[EL 0 vl;EL 1 vl;EL 2 vl;EL 3 vl]`]; + REWRITE_TAC[Bump.EL_EXPLICIT]; + ANTS_TAC; + BY(ASM_MESON_TAC[Bump.MCELL3]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; + ASM_REWRITE_TAC[Sphere.critical_edge_y]; + DISCH_THEN (unlist REWRITE_TAC); + FIRST_X_ASSUM MP_TAC; + MATCH_MP_TAC (arith `e = e' ==> (e < s ==> e'< s)`); + BY(MESON_TAC[Collect_geom.ETA_Y_SYYM]) + ]);; + (* }}} *) + +let real_model_008 = prove_by_refinement( + `!V u0 u1 w0 n f i. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f /\ + ~cc_4 V u0 u1 f i + ==> + sum {X | mcell_set V X /\ + {u0, u1} IN edgeX V X /\ + X SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ + ~(X = cc_cell V [u0; u1; f i]) /\ + ~(X = cc_cell V [u1; u0; f (SUC i)])} (\X. #0.008 * dihX V X (u0,u1)) <= + sum {X | mcell_set V X /\ + {u0, u1} IN edgeX V X /\ + X SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ + ~(X = cc_cell V [u0; u1; f i]) /\ + ~(X = cc_cell V [u1; u0; f (SUC i)])} + (\X. gammaX V X lmfun * critical_weight V X + beta_bump_v1 V {u0, u1} X) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC SUM_LE; + SUBCONJ_TAC; + INTRO_TAC Marchal_cells_3.FINITE_EDGE_X2 [`V`;`{u0,u1}`;`u0`;`u1`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + MATCH_MP_TAC FINITE_SUBSET; + TYPIFY `{X | mcell_set V X /\ edgeX V X {u0, u1}}` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[SUBSET;IN_ELIM_THM]; + BY(MESON_TAC[IN]); + DISCH_TAC; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC EDGE_IMP_K23 [`V`;`x`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM DISJ_CASES_TAC; + REPEAT (GMATCH_SIMP_TAC Bump.MCELL_BUMP_0); + CONJ_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_SIMP_TAC[arith `(k = 2) ==> (k < 4)`]); + FIRST_X_ASSUM_ST `edgeX` MP_TAC; + ASM_REWRITE_TAC[]; + BY(MESON_TAC[Bump.RIJRIED;NOT_IN_EMPTY]); + REWRITE_TAC[arith `x + &0 = x`]; + GMATCH_SIMP_TAC MCELL2_CRITICAL_WEIGHT1; + CONJ_TAC; + GEXISTL_TAC [`u0`;`u1`;`[u0;u1;v1;v2]`]; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[Bump.MCELL2]); + REWRITE_TAC[arith `x * &1 = x`]; + INTRO_TAC CC_2_PROPS [`V`;`x`;`u0`;`u1`;`[u0;u1;v1;v2]`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[Bump.MCELL2]); + BY(ASM_MESON_TAC[arith `x < y ==> x <= y`]); + COMMENT "now 3 cell"; + INTRO_TAC MCELL3_008 [`V`;`x`;`u0`;`u1`;`[u0;u1;v1;v2]`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[Bump.MCELL3]); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let real_model_cell23 = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> +(!i. ~cc_4 V u0 u1 f i + ==> gammaX V (cc_cell V [u0; u1; f i]) lmfun * + critical_weight V (cc_cell V [u0; u1; f i]) + + gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun * + critical_weight V (cc_cell V [u1; u0; f (SUC i)]) <= + gg_mcell V f u0 u1 i) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[gg_mcell]; + GMATCH_SIMP_TAC CC_3_SUM_fn; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[arith `x + &0 = x`]; + REWRITE_TAC[arith `g1 + g2 <= g1 + g2 + s <=> &0 <= s`]; + INTRO_TAC real_model_008 [`V`; `u0`; `u1`; `w0`; `n`; `f`; `i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + TYPIFY `&0 <= sum {X | mcell_set V X /\ {u0, u1} IN edgeX V X /\ X SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ ~(X = cc_cell V [u0; u1; f i]) /\ ~(X = cc_cell V [u1; u0; f (SUC i)])} (\X. #0.008 * dihX V X (u0,u1))` ENOUGH_TO_SHOW_TAC; + FIRST_X_ASSUM MP_TAC; + TYPED_ABBREV_TAC `s = {X | mcell_set V X /\ {u0, u1} IN edgeX V X /\ X SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ ~(X = cc_cell V [u0; u1; f i]) /\ ~(X = cc_cell V [u1; u0; f (SUC i)])}` ; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC SUM_POS_LE; + CONJ_TAC; + MATCH_MP_TAC FINITE_SUBSET; + TYPIFY `{X | mcell_set V X /\ edgeX V X {u0,u1} }` EXISTS_TAC; + CONJ_TAC; + MATCH_MP_TAC Marchal_cells_3.FINITE_EDGE_X2; + BY(ASM_MESON_TAC[]); + BY(SET_TAC[]); + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC REAL_LE_MUL; + CONJ_TAC; + BY(REAL_ARITH_TAC); + BY(REWRITE_TAC[Upfzbzm_support_lemmas.DIHX_POS]) + ]);; + (* }}} *) + +let real_model_cell23_008 = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> +(!i. ~cc_4 V u0 u1 f i + ==> (gammaX V (cc_cell V [u0; u1; f i]) lmfun * + critical_weight V (cc_cell V [u0; u1; f i]) - #0.008 * dihX V (cc_cell V [u0;u1;f i]) (u0,u1)) + + (gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun * + critical_weight V (cc_cell V [u1; u0; f (SUC i)]) - #0.008 * dihX V (cc_cell V [u1;u0;f (SUC i)]) (u0,u1)) + + #0.008 * azim_mcell V f u0 u1 i <= + gg_mcell V f u0 u1 i) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[gg_mcell;azim_mcell]; + GMATCH_SIMP_TAC CC_3_SUM_fn; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC CC_3_SUM_fn; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[arith `x + &0 = x`]; + TYPED_ABBREV_TAC `s = {X | mcell_set V X /\ {u0, u1} IN edgeX V X /\ X SUBSET wedge_ge u0 u1 (f i) (f (SUC i)) /\ ~(X = cc_cell V [u0; u1; f i]) /\ ~(X = cc_cell V [u1; u0; f (SUC i)])}` ; + TYPIFY `!X. X IN s ==> (?k v1 v2. barV V 3 [u0; u1; v1; v2] /\ (k = 2 \/ k = 3) /\ X = mcell k V [u0; u1; v1; v2])` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "s"; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC EDGE_IMP_K23; + BY(ASM_MESON_TAC[]); + TYPIFY `sum s (\X. gammaX V X lmfun * critical_weight V X + beta_bump_v1 V {u0, u1} X) = sum s (\X. gammaX V X lmfun * critical_weight V X )` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SUM_EQ; + REWRITE_TAC[arith `g + b = g <=> b = &0`]; + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`x`]); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC Bump.MCELL_BUMP_0; + ASM_REWRITE_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM_ST `\/` MP_TAC; + BY(ARITH_TAC); + DISCH_THEN (ASSUME_TAC o (MATCH_MP Bump.RIJRIED)); + FIRST_X_ASSUM_ST `IN` MP_TAC; + EXPAND_TAC "s"; + BY(ASM_REWRITE_TAC[IN_ELIM_THM;NOT_IN_EMPTY]); + ASM_REWRITE_TAC[]; + COMMENT "reduce to 008 bound"; + TYPIFY `#0.008 * sum s (\X. dihX V X (u0,u1)) <= sum s (\X. gammaX V X lmfun * critical_weight V X)` ENOUGH_TO_SHOW_TAC; + BY(REAL_ARITH_TAC); + REWRITE_TAC[GSYM SUM_LMUL]; + FIRST_X_ASSUM (SUBST1_TAC o GSYM); + EXPAND_TAC "s"; + MATCH_MP_TAC real_model_008; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let GAMMAX_008a = prove_by_refinement( + `!V u0 u1 w0 n f i. + pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f /\ + ~cc_4 V u0 u1 f i + ==> #0.008 * dihX V (cc_cell V [u0; u1; f i]) (u0,u1) <= + gammaX V (cc_cell V [u0; u1; f i]) lmfun * + critical_weight V (cc_cell V [u0; u1; f i]) `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC MCELL3_008 [`V`;`cc_cell V [u0;u1; f i]`;`u0`;`u1`;`cc_uh V [u0;u1;f i]`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell;Bump.MCELL3]); + INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;` [u0;u1;f i]`]; + BY(ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); + BY(ASM_REWRITE_TAC[arith `x + &0 = x`]) + ]);; + (* }}} *) + +let GAMMAX_008b = prove_by_refinement( + `!V u0 u1 w0 n f i. + pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f /\ + ~cc_4 V u0 u1 f i + ==> #0.008 * dihX V (cc_cell V [u1; u0; f (SUC i)]) (u0,u1) <= + gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun * + critical_weight V (cc_cell V [u1; u0; f (SUC i)])`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Leaf_cell.STEM_EDGEX [`V`;` [u1;u0;f (SUC i)]`]; + (ASM_REWRITE_TAC[Bump.EL_EXPLICIT]); + DISCH_TAC; + GMATCH_SIMP_TAC (GSYM Marchal_cells_3.DIHX_SYM); + CONJ_TAC; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[GSYM IN] THEN MATCH_MP_TAC Leaf_cell.CC_CELL_IN_MCELL_SET; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC MCELL3_008 [`V`;`cc_cell V [u1;u0; f (SUC i)]`;`u1`;`u0`;`cc_uh V [u1;u0;f (SUC i)]`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell;Bump.MCELL3]); + ONCE_REWRITE_TAC[DIST_SYM]; + BY(ASM_REWRITE_TAC[]); + TYPIFY `{u1,u0} = {u0,u1}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY((ASM_REWRITE_TAC[arith `x + &0 = x`])) + ]);; + (* }}} *) + +let real_model_3a = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> + (!i. ~cc_4 V u0 u1 f i + ==> &0 <= + gammaX V (cc_cell V [u0; u1; f i]) lmfun * + critical_weight V (cc_cell V [u0; u1; f i])) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC REAL_LE_MUL; + REWRITE_TAC[CRITICAL_WEIGHT_POS_LE]; + INTRO_TAC TSKAJXY_3 [`V`;`cc_cell V [u0;u1;f i]`;`cc_uh V [u0;u1;f i]`]; + REWRITE_TAC[arith `g >= &0 <=> &0 <= g`]; + DISCH_THEN MATCH_MP_TAC; + INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell;Bump.MCELL3]) + ]);; + (* }}} *) + +let real_model_3b = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> + (!i. ~cc_4 V u0 u1 f i + ==> &0 <= + gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun * + critical_weight V (cc_cell V [u1; u0; f (SUC i)])) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + GMATCH_SIMP_TAC REAL_LE_MUL; + REWRITE_TAC[CRITICAL_WEIGHT_POS_LE]; + INTRO_TAC TSKAJXY_3 [`V`;`cc_cell V [u1;u0;f (SUC i)]`;`cc_uh V [u1;u0;f (SUC i)]`]; + REWRITE_TAC[arith `g >= &0 <=> &0 <= g`]; + DISCH_THEN MATCH_MP_TAC; + INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_REWRITE_TAC[Leaf_cell.cc_cell;Bump.MCELL3]) + ]);; + (* }}} *) + +let real_model_gr = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> +(!i. ~cc_4 V u0 u1 f i + ==> #0.008 * azim_mcell V f u0 u1 i <= gg_mcell V f u0 u1 i) `, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC real_model_cell23_008 [`V`;`u0`;`u1`;`w0`;`n`;`f`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN (C INTRO_TAC [`i`]); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `&0 <= t1 /\ &0 <= t2 ==> (t1 + t2 + a <= g ==> a <= g)`); + REWRITE_TAC[arith `&0 <= g - d <=> d <= g`]; + CONJ_TAC; + MATCH_MP_TAC GAMMAX_008a; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC GAMMAX_008b; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let JSP_BOUNDS = prove_by_refinement( + `!(u0:real^3) u1 u2. pack_nonlinear_non_ox3q1h /\ + ~collinear {u0, u1, u2} /\ + hl [u0; u1; u2] <= #1.34 /\ + &2 * hminus <= dist (u0,u1) /\ + &2 <= dist (u0,u2) /\ + &2 <= dist (u1,u2) + ==> + dist(u0,u2) < &2 * hminus /\ dist(u1,u2) < &2 * hminus`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC JSPEVYT_EXPLICIT [`u0`;`u1`;`u2`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (unlist REWRITE_TAC); + INTRO_TAC JSPEVYT_EXPLICIT [`u1`;`u0`;`u2`]; + ANTS_TAC; + TYPIFY `{u1,u0,u2 } = {u0,u1,u2}` (C SUBGOAL_THEN ASSUME_TAC); + BY(SET_TAC[]); + TYPIFY `hl [u1;u0;u2] = hl[u0;u1;u2]` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_REWRITE_TAC[Pack_defs.HL;set_of_list]); + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[DIST_SYM]; + BY(ASM_REWRITE_TAC[]); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let real_model_pema = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> + (!i. ~cc_4 V u0 u1 f i /\ + hl [u0; u1; f i] < #1.34 /\ + ~(hl [u0; u1; f (SUC i)] < #1.34) /\ + azim_mcell V f u0 u1 i < #1.074 + ==> a_spine5 + b_spine5 * azim_mcell V f u0 u1 i <= + gg_mcell V f u0 u1 i) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC real_model_cell23_008 [`V`;`u0`;`u1`;`w0`;`n`;`f`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `&2 * hminus <= dist (u0,u1) /\ dist(u0,u1) <= &2 * hplus` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; + BY((REWRITE_TAC[Sphere.critical_edge_y]) THEN REAL_ARITH_TAC); + DISCH_THEN (C INTRO_TAC [`i`]); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `&0 <= t /\ a <= t'+ a' ==> (t' + t + a' <= g ==> a <= g)`); + CONJ_TAC; + REWRITE_TAC[arith `&0 <= g - d <=> d <= g`]; + MATCH_MP_TAC GAMMAX_008b; + BY(ASM_MESON_TAC[]); + INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + COMMENT "bound edges 3,5"; + INTRO_TAC JSP_BOUNDS [`u0`;`u1`;`f i`]; + ANTS_TAC; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "simplify goal"; + TYPIFY `a_spine5 + b_spine5 * dih_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) y4 (dist (u1,f (SUC i))) (dist (u1,f i)) <= gammaX V (cc_cell V [u0; u1; f i]) lmfun * critical_weight V (cc_cell V [u0; u1; f i]) - #0.008 * dihX V (cc_cell V [u0; u1; f i]) (u0,u1) + #0.008 * dih_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) y4 (dist (u1,f (SUC i))) (dist (u1,f i))` ENOUGH_TO_SHOW_TAC; + REWRITE_TAC[Sphere.b_spine5]; + FIRST_X_ASSUM_ST `dih_y` MP_TAC; + BY(REAL_ARITH_TAC); + COMMENT "import inequality"; + MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "PEMKWKU"); + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + REWRITE_TAC[GSYM Sphere.rad2_y]; + REWRITE_TAC[ (TAUT ` (p ==> a \/ b) <=> (p /\ ~b ==> a)`)]; + REWRITE_TAC[DE_MORGAN_THM]; + REWRITE_TAC[Functional_equation.nonf_gamma23_keep135_x;Sphere.y_of_x]; + REWRITE_TAC[GSYM (REWRITE_RULE[LET_DEF;LET_END_DEF] Sphere.dih_y)]; + DISCH_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`(dist (u0,u1))`;` (dist (u0,f (SUC i)))`;` (dist (u0,f i))`;` y4`; ` (dist (u1,f i))`;`(dist (u1,f (SUC i)))`]); + ANTS_TAC; + REWRITE_TAC[arith `~(x < y) <=> y<= x`;arith`~(x > y) <=> x <= y`]; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + GMATCH_SIMP_TAC ETA_Y_LEMMA; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `#1.34` MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `!x. x <= &2 <=> x <= (sqrt(&2) pow 2)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(REWRITE_TAC[GSYM Sphere.sqrt2;arith `x pow 2 = x * x`;Nonlin_def.sqrt2_sqrt2]); + REPEAT (GMATCH_SIMP_TAC ETA_Y_LEMMA_ALT); + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + CONJ2_TAC; + CONJ_TAC; + FIRST_X_ASSUM_ST `rad2_y` MP_TAC; + BY(MESON_TAC[Merge_ineq.rad2_y_sym]); + PURE_ONCE_REWRITE_TAC[Nonlinear_lemma.dih_y_sym]; + FIRST_X_ASSUM_ST `dih_y` MP_TAC; + FIRST_X_ASSUM_ST `#1.074` MP_TAC; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]); + COMMENT "handle gamma3_f"; + GMATCH_SIMP_TAC (GSYM Merge_ineq.gamma3_x_gamma3f); + CONJ_TAC; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + GMATCH_SIMP_TAC critical_weight1; + CONJ_TAC; + BY(ASM_REWRITE_TAC[]); + GMATCH_SIMP_TAC mcell3_gammaX_gamma3f; + CONJ_TAC; + GEXISTL_TAC [`w0`;`n`]; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[arith `g + dd * #0.008 > r <=> g > r - dd * #0.008`]; + MATCH_MP_TAC(arith `r = s + a - b ==> (g > r ==> s <= g * &1 - a + b)`); + REWRITE_TAC[arith `(a+b) - c = a + b - c`;arith `(a+b) + c = a + b + c`]; + AP_TERM_TAC; + MATCH_MP_TAC (arith `(d = d' /\ e' = -- e) ==> (b * d - e = b * d' + e')`); + CONJ_TAC; + BY(MESON_TAC[Nonlinear_lemma.dih_y_sym]); + MATCH_MP_TAC (arith `d3' = d3'' /\ d6 = d6' ==> (#0.008 * d3' - #0.008 * d6 = --( ( d6' - d3'')* #0.008))`); + CONJ2_TAC; + BY(MESON_TAC[Nonlinear_lemma.dih_y_sym]); + GMATCH_SIMP_TAC mcell3_dihX_dih_y; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF;Nonlin_def.sqrt2_sqrt2]; + BY(MESON_TAC[Nonlinear_lemma.dih_x_sym]) + ]);; + (* }}} *) + +let real_model_pemb = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> + (!i. ~cc_4 V u0 u1 f i /\ + ~(hl [u0; u1; f i] < #1.34) /\ + hl [u0; u1; f (SUC i)] < #1.34 /\ + azim_mcell V f u0 u1 i < #1.074 + ==> a_spine5 + b_spine5 * azim_mcell V f u0 u1 i <= + gg_mcell V f u0 u1 i) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC real_model_cell23_008 [`V`;`u0`;`u1`;`w0`;`n`;`f`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `&2 * hminus <= dist (u0,u1) /\ dist(u0,u1) <= &2 * hplus` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; + BY((REWRITE_TAC[Sphere.critical_edge_y]) THEN REAL_ARITH_TAC); + DISCH_THEN (C INTRO_TAC [`i`]); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `&0 <= t' /\ a <= t+ a' ==> (t' + t + a' <= g ==> a <= g)`); + CONJ_TAC; + REWRITE_TAC[arith `&0 <= g - d <=> d <= g`]; + MATCH_MP_TAC GAMMAX_008a; + BY(ASM_MESON_TAC[]); + INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + COMMENT "bound edges 2,6"; + INTRO_TAC JSP_BOUNDS [`u0`;`u1`;`f (SUC i)`]; + ANTS_TAC; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + REPEAT WEAKER_STRIP_TAC; + COMMENT "simplify goal+"; + TYPIFY `a_spine5 + b_spine5 * dih_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) y4 (dist (u1,f (SUC i))) (dist (u1,f i)) <= gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun * critical_weight V (cc_cell V [u1; u0; f (SUC i)]) - #0.008 * dihX V (cc_cell V [u1; u0; f (SUC i)]) (u0,u1) + #0.008 * dih_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) y4 (dist (u1,f (SUC i))) (dist (u1,f i)) ` ENOUGH_TO_SHOW_TAC; + REWRITE_TAC[Sphere.b_spine5]; + FIRST_X_ASSUM_ST `dih_y` MP_TAC; + BY(REAL_ARITH_TAC); + COMMENT "import inequality"; + MP_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "PEMKWKU"); + ASM_REWRITE_TAC[Sphere.ineq;TAUT `a ==> b ==> c <=> (a /\ b) ==> c`]; + REWRITE_TAC[GSYM Sphere.rad2_y]; + REWRITE_TAC[ (TAUT ` (p ==> a \/ b) <=> (p /\ ~b ==> a)`)]; + REWRITE_TAC[DE_MORGAN_THM]; + REWRITE_TAC[Functional_equation.nonf_gamma23_keep135_x;Sphere.y_of_x]; + REWRITE_TAC[GSYM (REWRITE_RULE[LET_DEF;LET_END_DEF] Sphere.dih_y)]; + DISCH_TAC; + COMMENT "instantiate pem"; + FIRST_X_ASSUM (C INTRO_TAC [`(dist (u0,u1))`;` (dist (u0,f ( i)))`;` (dist (u0,f (SUC i)))`;` y4`; ` (dist (u1,f (SUC i)))`;`(dist (u1,f ( i)))`]); + ANTS_TAC; + REWRITE_TAC[arith `~(x < y) <=> y<= x`;arith`~(x > y) <=> x <= y`]; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + GMATCH_SIMP_TAC ETA_Y_LEMMA; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `#1.34` MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `!x. x <= &2 <=> x <= (sqrt(&2) pow 2)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(REWRITE_TAC[GSYM Sphere.sqrt2;arith `x pow 2 = x * x`;Nonlin_def.sqrt2_sqrt2]); + REPEAT (GMATCH_SIMP_TAC ETA_Y_LEMMA_ALT); + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + CONJ2_TAC; + FIRST_X_ASSUM_ST `dih_y` MP_TAC; + FIRST_X_ASSUM_ST `#1.074` MP_TAC; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[Sphere.sqrt2;Nonlinear_lemma.sqrt8_sqrt2]); + COMMENT "handle gamma3_f"; + GMATCH_SIMP_TAC (GSYM Merge_ineq.gamma3_x_gamma3f); + CONJ_TAC; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + GMATCH_SIMP_TAC critical_weight1; + CONJ_TAC; + (ASM_REWRITE_TAC[]); + ONCE_REWRITE_TAC[DIST_SYM]; + BY(ASM_REWRITE_TAC[]); + GMATCH_SIMP_TAC mcell3_gammaXb_gamma3f; + CONJ_TAC; + GEXISTL_TAC [`w0`;`n`]; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[arith `g + dd * #0.008 > r <=> g > r - dd * #0.008`]; + MATCH_MP_TAC(arith `r = s + a - b ==> (g > r ==> s <= g * &1 - a + b)`); + REWRITE_TAC[arith `(a+b) - c = a + b - c`;arith `(a+b) + c = a + b + c`]; + AP_TERM_TAC; + MATCH_MP_TAC (arith `(d = d' /\ e' = -- e) ==> (b * d - e = b * d' + e')`); + CONJ_TAC; + BY(REWRITE_TAC[]); + MATCH_MP_TAC (arith `d3' = d3'' /\ d6 = d6' ==> (#0.008 * d3' - #0.008 * d6 = --( ( d6' - d3'')* #0.008))`); + REWRITE_TAC[]; + GMATCH_SIMP_TAC mcell3_dihXb_dih_y; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF;Nonlin_def.sqrt2_sqrt2]; + BY(MESON_TAC[Nonlinear_lemma.dih_x_sym]) + ]);; + (* }}} *) + +let c2089 = Flyspeck_constants.calc `atn (sqrt (#3.07)) < pi - #2.089`;; +let c1946 = Flyspeck_constants.calc `pi - #1.946 < atn (sqrt (#6.45))`;; + +let IXPOTPA_MERGED = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + pack_nonlinear_non_ox3q1h /\ + critical_edge_y y1 /\ + &2 <= y2 /\ y2 <= &2 * hminus /\ + &2 <= y3 /\ y3 <= &2 * hminus /\ + sqrt8 <= y4 /\ y4 <= y5 + y6 /\ + &2 <= y5 /\ y5 <= &2 * hminus /\ + &2 <= y6 /\ y6 <= &2 * hminus /\ + &0 < delta_y y1 y2 y3 y4 y5 y6 /\ + dih_y y1 y2 y3 y4 y5 y6 <= #2.089 /\ + #1.946 <= dih_y y1 y2 y3 y4 y5 y6 /\ + eta_y y1 y2 y6 pow 2 <= #1.34 pow 2/\ + eta_y y1 y3 y5 pow 2 <= #1.34 pow 2 + ==> + &3 * #0.0057 <= gamma3f y1 y2 y6 sqrt2 lmfun + + gamma3f y1 y3 y5 sqrt2 lmfun + + (dih_y y1 y2 y3 y4 y5 y6 - + (dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + dih_y y1 sqrt2 y3 sqrt2 y5 sqrt2)) * + #0.008`, + (* {{{ proof *) + [ + COMMENT "prelims"; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `y4 <= &4 * hminus ` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `&2 * hminus <= y1 /\ y1 <= &2 * hplus` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Sphere.critical_edge_y]); + TYPIFY `&0 < y1` (C SUBGOAL_THEN ASSUME_TAC); + MP_TAC Nonlinear_lemma.hminus_gt; + FIRST_X_ASSUM MP_TAC; + BY(REAL_ARITH_TAC); + TYPIFY `&0 < y1 * y1` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[]); + TYPIFY `delta4_y y1 y2 y3 y4 y5 y6 < &0` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[Sphere.delta4_y;Sphere.y_of_x]; + MATCH_MP_TAC Merge_ineq.dih_gt_pi2; + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[Sphere.dih_y;Sphere.delta_y;LET_DEF;LET_END_DEF]; + MP_TAC Flyspeck_constants.bounds; + BY(REAL_ARITH_TAC); + COMMENT "add nonlinear"; + MATCH_MP_TAC (arith `x > y ==> y <= x`); + INTRO_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "IXPOTPA") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + ASM_REWRITE_TAC[Sphere.ineq;LET_DEF;LET_END_DEF]; + REWRITE_TAC[TAUT `a \/ b \/ c <=> (a \/ b) \/ c`]; + ONCE_REWRITE_TAC[TAUT `a \/ b <=> (~a ==> b)`]; + REWRITE_TAC[DE_MORGAN_THM]; + REWRITE_TAC[TAUT `(a /\ b) /\c <=> a /\ b /\ c`]; + ASM_REWRITE_TAC[Functional_equation.nonf_gamma23_full8_x;Sphere.y_of_x]; + REPEAT (GMATCH_SIMP_TAC (GSYM Merge_ineq.gamma3_x_gamma3f)); + ASM_SIMP_TAC[Merge_ineq.y_bounds]; + REWRITE_TAC[REWRITE_RULE[LET_DEF;LET_END_DEF] (GSYM Sphere.dih_y);GSYM Nonlinear_lemma.sqrt2_sqrt2]; + DISCH_THEN MATCH_MP_TAC; + COMMENT "remove hypotheses"; + ASM_SIMP_TAC [arith `&0 < x ==> ~(x < &0)`]; + ASM_SIMP_TAC [arith `x <= y ==> ~(x > y)`]; + ASM_SIMP_TAC [arith `x < &0 ==> ~(x > &0)`]; + CONJ_TAC; + MATCH_MP_TAC (arith `b < a ==> ~(a < b)`); + TYPIFY `#3.07 = sqrt (#3.07) pow 2 ` (C SUBGOAL_THEN SUBST1_TAC); + GMATCH_SIMP_TAC SQRT_POW_2; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC (GSYM Merge_ineq.lindihpi_lt_y); + ASM_REWRITE_TAC[]; + CONJ_TAC; + GMATCH_SIMP_TAC REAL_LT_RSQRT; + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `#2.089` MP_TAC; + MP_TAC c2089; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC (arith `a < b ==> ~(a > b)`); + TYPIFY `#6.45 = sqrt (#6.45) pow 2 ` (C SUBGOAL_THEN SUBST1_TAC); + GMATCH_SIMP_TAC SQRT_POW_2; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC (GSYM Merge_ineq.lindihpi_gt_y); + ASM_REWRITE_TAC[]; + CONJ_TAC; + GMATCH_SIMP_TAC REAL_LT_RSQRT; + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `#1.946` MP_TAC; + MP_TAC c1946; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let TXQTPVC_MERGED = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + pack_nonlinear_non_ox3q1h /\ + critical_edge_y y1 /\ + &2 <= y2 /\ y2 <= &2 * hminus /\ + &2 <= y3 /\ y3 <= &2 * hminus /\ + &2 <= y4 /\ y4 <= y5 + y6 /\ + &2 <= rad2_y y1 y2 y3 y4 y5 y6 /\ + &2 <= y5 /\ y5 <= &2 * hminus /\ + &2 <= y6 /\ y6 <= &2 * hminus /\ + &0 < delta_y y1 y2 y3 y4 y5 y6 /\ + dih_y y1 y2 y3 y4 y5 y6 <= #2.089 /\ + #1.946 <= dih_y y1 y2 y3 y4 y5 y6 /\ + eta_y y1 y2 y6 pow 2 <= #1.34 pow 2/\ + eta_y y1 y3 y5 pow 2 <= #1.34 pow 2 + ==> + &3 * #0.0057 <= gamma3f y1 y2 y6 sqrt2 lmfun + + gamma3f y1 y3 y5 sqrt2 lmfun + + (dih_y y1 y2 y3 y4 y5 y6 - + (dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + dih_y y1 sqrt2 y3 sqrt2 y5 sqrt2)) * + #0.008`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `&2 * hminus <= y1 /\ y1 <= &2 * hplus` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Sphere.critical_edge_y]); + TYPIFY `sqrt8 <= y4` ASM_CASES_TAC; + MATCH_MP_TAC IXPOTPA_MERGED; + BY(ASM_REWRITE_TAC[]); + TYPIFY `y4 <= sqrt8` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + MATCH_MP_TAC (arith `y > x ==> x<= y`); + INTRO_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "TXQTPVC") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + ASM_REWRITE_TAC[Sphere.ineq;LET_DEF;LET_END_DEF]; + ONCE_REWRITE_TAC[TAUT `a \/ b <=> ~b ==> a`]; + REWRITE_TAC[DE_MORGAN_THM]; + ASM_REWRITE_TAC[Functional_equation.nonf_gamma23_full8_x;Sphere.y_of_x]; + REPEAT (GMATCH_SIMP_TAC (GSYM Merge_ineq.gamma3_x_gamma3f)); + ASM_SIMP_TAC[Merge_ineq.y_bounds]; + REWRITE_TAC[REWRITE_RULE[LET_DEF;LET_END_DEF] (GSYM Sphere.dih_y);GSYM Nonlinear_lemma.sqrt2_sqrt2]; + DISCH_THEN MATCH_MP_TAC; + COMMENT "deal with assumptions"; + ASM_SIMP_TAC [arith `x <= y ==> ~(x > y)`]; + ASM_SIMP_TAC [arith `c <= d ==> ~(d < c)`]; + FIRST_X_ASSUM_ST `rad2_y` MP_TAC; + REWRITE_TAC[Nonlin_def.sqrt2_sqrt2]; + REWRITE_TAC[Sphere.rad2_y;Sphere.y_of_x]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let TEWNSCJ_MERGED = prove_by_refinement( + `!y1 y2 y3 y4 y5 y6. + pack_nonlinear_non_ox3q1h /\ + critical_edge_y y1 /\ + &2 <= y2 /\ y2 <= &2 * hminus /\ + &2 <= y3 /\ y3 <= &2 * hminus /\ + &2 <= y4 /\ y4 <= sqrt8 /\ + &2 <= rad2_y y1 y2 y3 y4 y5 y6 /\ + &2 <= y5 /\ y5 <= &2 * hminus /\ + &2 <= y6 /\ y6 <= &2 * hminus /\ + eta_y y1 y2 y6 pow 2 <= #1.34 pow 2 /\ + eta_y y1 y3 y5 pow 2 <= #1.34 pow 2 + ==> + a_spine5 + b_spine5 * dih_y y1 y2 y3 y4 y5 y6 <= + gamma3f y1 y2 y6 sqrt2 lmfun + + gamma3f y1 y3 y5 sqrt2 lmfun + + (dih_y y1 y2 y3 y4 y5 y6 - + (dih_y y1 y2 sqrt2 sqrt2 sqrt2 y6 + dih_y y1 sqrt2 y3 sqrt2 y5 sqrt2)) * + #0.008`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + TYPIFY `&2 * hminus <= y1 /\ y1 <= &2 * hplus` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Sphere.critical_edge_y]); + MATCH_MP_TAC (arith `y > x ==> x<= y`); + INTRO_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "TEWNSCJ") [`y1`;`y2`;`y3`;`y4`;`y5`;`y6`]; + ASM_REWRITE_TAC[Sphere.ineq;LET_DEF;LET_END_DEF]; + ONCE_REWRITE_TAC[TAUT `a \/ b <=> ~b ==> a`]; + REWRITE_TAC[DE_MORGAN_THM]; + ASM_REWRITE_TAC[Functional_equation.nonf_gamma23_full8_x;Sphere.y_of_x]; + REPEAT (GMATCH_SIMP_TAC (GSYM Merge_ineq.gamma3_x_gamma3f)); + ASM_SIMP_TAC[Merge_ineq.y_bounds]; + REWRITE_TAC[REWRITE_RULE[LET_DEF;LET_END_DEF] (GSYM Sphere.dih_y);GSYM Nonlinear_lemma.sqrt2_sqrt2]; + DISCH_THEN MATCH_MP_TAC; + COMMENT "deal with assumptions"; + ASM_SIMP_TAC [arith `x <= y ==> ~(x > y)`]; + ASM_SIMP_TAC [arith `c <= d ==> ~(d < c)`]; + FIRST_X_ASSUM_ST `rad2_y` MP_TAC; + REWRITE_TAC[Nonlin_def.sqrt2_sqrt2]; + REWRITE_TAC[Sphere.rad2_y;Sphere.y_of_x]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let CC_3_AZIM_LT_PI_COPLANAR = prove_by_refinement( + `!V u0 u1 w0 n f i . pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + ~cc_4 V u0 u1 f i /\ + leaf_rank V [u0; u1] w0 n f /\ azim u0 u1 (f i) (f (SUC i)) < pi ==> + ~(coplanar {u0,u1,f i,f (SUC i)})`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY((ASM_REWRITE_TAC[])); + REPEAT WEAKER_STRIP_TAC; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + REWRITE_TAC[GSYM Local_lemmas1.AZIM_COND_FOR_COPLANAR]; + ASM_SIMP_TAC[arith `x < y ==> ~(x = y)`]; + ASM_SIMP_TAC[Local_lemmas.AZIM_EQ_0_GE_ALT2]; + GMATCH_SIMP_TAC Local_lemmas1.DIJ_AFF_GE_PARTITION; + REWRITE_TAC[IN_UNION]; + ASM_SIMP_TAC[Fan.th3a]; + REWRITE_TAC[DE_MORGAN_THM]; + CONJ_TAC; + MATCH_MP_TAC Fan.th3c; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + TYPIFY `cc_A0 [u0;u1;f i] = cc_A0 [u0;u1;f (SUC i)]` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[Leaf_cell.cc_A0;Bump.EL_EXPLICIT]; + MATCH_MP_TAC Local_lemmas.COLL_IN_AFF_GT_AFF_GT_EQ; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC Leaf_cell.FCHKUGT [`V`;`u0`;`u1`;`f i`;`f (SUC i)`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC DIST_I_SUCI [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ASM_REWRITE_TAC[DIST_REFL]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let real_model_txq = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> + (!i. ~cc_4 V u0 u1 f i /\ + hl [u0; u1; f i] < #1.34 /\ + hl [u0; u1; f (SUC i)] < #1.34 /\ + #1.946 <= azim_mcell V f u0 u1 i /\ + azim_mcell V f u0 u1 i <= #2.089 + ==> #3.0 * #0.0057 <= gg_mcell V f u0 u1 i) +`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC real_model_cell23_008 [`V`;`u0`;`u1`;`w0`;`n`;`f`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `&2 * hminus <= dist (u0,u1) /\ dist(u0,u1) <= &2 * hplus` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; + BY((REWRITE_TAC[Sphere.critical_edge_y]) THEN REAL_ARITH_TAC); + DISCH_THEN (C INTRO_TAC [`i`]); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `a <= l ==> (l <= g ==> a <= g)`); + INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + COMMENT "build asm list"; + INTRO_TAC JSP_BOUNDS [`u0`;`u1`;`f i`]; + INTRO_TAC JSP_BOUNDS [`u0`;`u1`;`f (SUC i)`]; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + REPEAT WEAKER_STRIP_TAC; + TYPIFY `azim u0 u1 (f i) (f (SUC i)) < pi` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `#2.089` MP_TAC; + ASM_REWRITE_TAC[]; + MP_TAC Flyspeck_constants.bounds; + BY(REAL_ARITH_TAC); + INTRO_TAC CC_3_AZIM_LT_PI_COPLANAR [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + TYPIFY `&0 < delta_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) (dist(f i,f (SUC i))) (dist (u1,f (SUC i))) (dist (u1,f i))` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_REWRITE_TAC[GSYM coplanar_delta_y]); + COMMENT "simplify goal+"; + REPEAT (GMATCH_SIMP_TAC critical_weight1); + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[DIST_SYM]; + ASM_REWRITE_TAC[arith `x * &1 = x`]; + TYPIFY `azim u0 u1 (f i) (f (SUC i)) = dih_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) (dist(f i,f (SUC i))) (dist (u1,f (SUC i))) (dist (u1,f i))` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC AZIM_DIHV_SAME; + CONJ_TAC; + BY(ASM_REWRITE_TAC[]); + GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] Merge_ineq.DIHV_EQ_DIH_Y); + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `DECIMAL` MP_TAC); + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "import inequality"; + INTRO_TAC TXQTPVC_MERGED [`(dist (u0,u1))`;` (dist (u0,f ( i)))`;` (dist (u0,f (SUC i)))`;`dist(f i,f (SUC i))`; ` (dist (u1,f (SUC i)))`;`(dist (u1,f ( i)))`]; + ANTS_TAC; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + CONJ_TAC; + MATCH_MP_TAC DIST_I_SUCI; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + BY(MESON_TAC[DIST_TRIANGLE;DIST_SYM;arith `x + y = y + x`]); + CONJ_TAC; + INTRO_TAC RAD_PI_IMP_WEDGE4 [`V`;`f`;`w0`;`n`;`i`;`u0`;`u1`]; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `cc_4` MP_TAC; + REWRITE_TAC[cc_4]; + DISCH_TAC; + DISCH_THEN (MP_TAC o (MATCH_MP (TAUT `(b ==> a) ==> (~a ==> ~b)`))); + ANTS_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + REWRITE_TAC[arith `~(r < s) <=> s <= r`]; + REWRITE_TAC[Sphere.rad2_y;Sphere.y_of_x;arith `x * x = x pow 2`]; + GMATCH_SIMP_TAC (GSYM (REWRITE_RULE[LET_DEF;LET_END_DEF] GDRQXLGv3)); + ASM_REWRITE_TAC[]; + DISCH_TAC; + REWRITE_TAC[GSYM Nonlin_def.sqrt2_sqrt2;arith `x * x = x pow 2`]; + MATCH_MP_TAC Collect_geom2.POS_IMP_POW2; + ASM_REWRITE_TAC[Sphere.sqrt2]; + GMATCH_SIMP_TAC SQRT_POS_LE; + BY(REAL_ARITH_TAC); + CONJ_TAC; + MATCH_MP_TAC ETA_Y_LEMMA_ALT; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + MATCH_MP_TAC ETA_Y_LEMMA_ALT; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + COMMENT "match ineq with goal"; + MATCH_MP_TAC (arith `(r = r') ==> (&3 * a <= r ==> #3.0 * a <= r')`); + MATCH_MP_TAC (arith `(g1 = g1' /\ g2 = g2' /\ d1 = d1' /\ d2 = d2') ==> (g1 + g2 + (d - (d1 + d2))* #0.008 = g1' - #0.008 * d1' + g2' - #0.008 * d2' + #0.008 * d)`); + GMATCH_SIMP_TAC mcell3_gammaXb_gamma3f; + CONJ_TAC; + GEXISTL_TAC [`w0`;`n`]; + BY(ASM_REWRITE_TAC[]); + GMATCH_SIMP_TAC mcell3_gammaX_gamma3f; + CONJ_TAC; + GEXISTL_TAC [`w0`;`n`]; + BY(ASM_REWRITE_TAC[]); + GMATCH_SIMP_TAC mcell3_dihXb_dih_y; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF;Nonlin_def.sqrt2_sqrt2]; + GMATCH_SIMP_TAC mcell3_dihX_dih_y; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF;Nonlin_def.sqrt2_sqrt2]; + BY(MESON_TAC[Nonlinear_lemma.dih_x_sym]) + ]);; + (* }}} *) + +let real_model_tew = prove_by_refinement( + `!V u0 u1 w0 n f. pack_nonlinear_non_ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> + (!i. ~cc_4 V u0 u1 f i /\ + hl [u0; u1; f i] < #1.34 /\ + hl [u0; u1; f (SUC i)] < #1.34 + ==> a_spine5 + b_spine5 * azim_mcell V f u0 u1 i <= + gg_mcell V f u0 u1 i)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC real_model_cell23_008 [`V`;`u0`;`u1`;`w0`;`n`;`f`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `&2 * hminus <= dist (u0,u1) /\ dist(u0,u1) <= &2 * hplus` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `critical_edge_y` MP_TAC; + BY((REWRITE_TAC[Sphere.critical_edge_y]) THEN REAL_ARITH_TAC); + DISCH_THEN (C INTRO_TAC [`i`]); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `a <= l ==> (l <= g ==> a <= g)`); + INTRO_TAC CC_3_PROPS [`V`;`u0`;`u1`;`w0`;`n`;`f`;`i`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAKER_STRIP_TAC; + ASM_REWRITE_TAC[]; + COMMENT "build asm list"; + INTRO_TAC JSP_BOUNDS [`u0`;`u1`;`f i`]; + INTRO_TAC JSP_BOUNDS [`u0`;`u1`;`f (SUC i)`]; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + REPEAT WEAKER_STRIP_TAC; + COMMENT "simplify goal+"; + REPEAT (GMATCH_SIMP_TAC critical_weight1); + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[DIST_SYM]; + ASM_REWRITE_TAC[arith `x * &1 = x`]; + TYPIFY `a_spine5 + b_spine5 * dih_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) y4 (dist (u1,f (SUC i))) (dist (u1,f i)) <= gammaX V (cc_cell V [u0; u1; f i]) lmfun - #0.008 * dihX V (cc_cell V [u0; u1; f i]) (u0,u1) + gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun - #0.008 * dihX V (cc_cell V [u1; u0; f (SUC i)]) (u0,u1) + #0.008 * dih_y (dist (u0,u1)) (dist (u0,f i)) (dist (u0,f (SUC i))) y4 (dist (u1,f (SUC i))) (dist (u1,f i))` ENOUGH_TO_SHOW_TAC; + REWRITE_TAC[Sphere.b_spine5]; + REPEAT (FIRST_X_ASSUM_ST `dih_y` MP_TAC); + BY(REAL_ARITH_TAC); + COMMENT "import inequality"; + INTRO_TAC TEWNSCJ_MERGED [`(dist (u0,u1))`;` (dist (u0,f ( i)))`;` (dist (u0,f (SUC i)))`;`y4`; ` (dist (u1,f (SUC i)))`;`(dist (u1,f ( i)))`]; + ANTS_TAC; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + ASM_REWRITE_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2]; + CONJ_TAC; + MATCH_MP_TAC ETA_Y_LEMMA_ALT; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + MATCH_MP_TAC ETA_Y_LEMMA_ALT; + BY(ASM_SIMP_TAC[arith `x < y ==> x <= y`]); + COMMENT "match ineq with goal"; + MATCH_MP_TAC (arith `(r = r') ==> (a <= r ==> a <= r')`); + MATCH_MP_TAC (arith `(g1 = g1' /\ g2 = g2' /\ d1 = d1' /\ d2 = d2') ==> (g1 + g2 + (d - (d1 + d2))* #0.008 = g1' - #0.008 * d1' + g2' - #0.008 * d2' + #0.008 * d)`); + GMATCH_SIMP_TAC mcell3_gammaXb_gamma3f; + CONJ_TAC; + GEXISTL_TAC [`w0`;`n`]; + BY(ASM_REWRITE_TAC[]); + GMATCH_SIMP_TAC mcell3_gammaX_gamma3f; + CONJ_TAC; + GEXISTL_TAC [`w0`;`n`]; + BY(ASM_REWRITE_TAC[]); + GMATCH_SIMP_TAC mcell3_dihXb_dih_y; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF;Nonlin_def.sqrt2_sqrt2]; + GMATCH_SIMP_TAC mcell3_dihX_dih_y; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[Sphere.dih_y;LET_DEF;LET_END_DEF;Nonlin_def.sqrt2_sqrt2]; + BY(MESON_TAC[Nonlinear_lemma.dih_x_sym]) + ]);; + (* }}} *) + +let intro_real_model th = + INTRO_TAC th [`V:real^3->bool`;`u0:real^3`;`u1:real^3`;`w0:real^3`;`n:num`;`f:num->real^3`] THEN + ANTS_TAC THEN ASM_REWRITE_TAC[] THEN (DISCH_THEN (unlist REWRITE_TAC));; + +let cc_real_model_data = prove_by_refinement( + `!V f w0 n u0 u1. + pack_nonlinear_non_ox3q1h /\ ox3q1h /\ + 1 < n /\ + packing V /\ + saturated V /\ + s_leaf V [u0; u1] HAS_SIZE n /\ + u0 IN V /\ + u1 IN V /\ + periodic f n /\ + ~collinear {u0, u1, w0} /\ + critical_edge_y (dist (u0,u1)) /\ + leaf_rank V [u0; u1] w0 n f + ==> cc_real_model_v11 (cc_data_v8 V f u0 u1)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + REWRITE_TAC[Oxl_def.cc_real_model_v11;cc_real_data;cc_bool_data;cc_card_data;GSYM cc_4;cc_real_dat_def;Oxl_def.cc_eps]; + TYPIFY `periodic (azim_mcell V f u0 u1) (CARD (s_leaf V [u0; u1])) /\ periodic (gg_mcell V f u0 u1) (CARD (s_leaf V [u0; u1])) /\ periodic (\i. gammaX V (cc_cell V [u0; u1; f i]) lmfun * critical_weight V (cc_cell V [u0; u1; f i])) (CARD (s_leaf V [u0; u1])) /\ periodic (\i. gammaX V (cc_cell V [u1; u0; f (SUC i)]) lmfun * critical_weight V (cc_cell V [u1; u0; f (SUC i)])) (CARD (s_leaf V [u0; u1]))` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(ASM_MESON_TAC[real_periodic_data;HAS_SIZE]); + TYPIFY `( 0..CARD (s_leaf V [u0;u1]) - 1) = {i | i < n}` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[NUMSEG_LT;arith `1 < n==> ~(n = 0)`;HAS_SIZE]); + REWRITE_TAC[arith `!i. i + 1 = SUC i`]; + intro_real_model real_model_ox3q1h_merge; + intro_real_model real_model_azim_c4; + intro_real_model real_model_gamma_qu; + intro_real_model real_model_fhbv2; + intro_real_model real_model_fhbv2_sym; + intro_real_model real_model_gckb; + intro_real_model real_model_sum_azim; + intro_real_model real_model_quqy; + intro_real_model real_model_quqy_sym; + intro_real_model real_model_ztg4; + intro_real_model real_model_azim1; + intro_real_model real_model_gaz4; + intro_real_model real_model_gaz6; + intro_real_model real_model_gamma_qx; + intro_real_model real_model_g_qxd; + intro_real_model real_model_gamma10; + intro_real_model real_model_gamma11; + intro_real_model real_model_gamma8; + intro_real_model real_model_gamma8b; + intro_real_model real_model_gaz9; + intro_real_model real_model_azim2; + intro_real_model real_model_cell23; + intro_real_model real_model_3a; + intro_real_model real_model_3b; + intro_real_model real_model_gr; + intro_real_model real_model_pema; + intro_real_model real_model_pemb; + intro_real_model real_model_tew; + BY(intro_real_model real_model_txq) + ]);; + (* }}} *) + +let CELL_CLUSTER_ESTIMATE_PROPS = prove_by_refinement( +`!V. packing V /\ saturated V /\ ~cell_cluster_estimate_v1 V /\ pack_nonlinear_non_ox3q1h /\ ox3q1h + ==> (?u0 u1 n f. + 1 < n /\ + sum {i | i < n} (gg_mcell V f (u0) (u1)) < &0 /\ + n = cc_card_v11 (cc_data_v8 V f u0 u1) /\ + cc_bool_model_v11 (cc_data_v8 V f u0 u1) /\ + cc_bool_prep_v11 (cc_data_v8 V f u0 u1) /\ + cc_real_model_v11 (cc_data_v8 V f u0 u1))`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC (* Oxlzlez. *)LEAF_RANK_PROPS [`V`]; + ASM_REWRITE_TAC[HAS_SIZE;(* Oxlzlez. *)cc_card_data]; + REPEAT WEAKER_STRIP_TAC; + GEXISTL_TAC [`u0`;`u1`;`n`;`f`]; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (* Oxlzlez. *)cc_real_model_data; + GEXISTL_TAC [`w0`;`n`]; + BY((ASM_REWRITE_TAC[HAS_SIZE])) + ]);; + (* }}} *) + +let OXLZLEZ = prove_by_refinement( + `!V. pack_nonlinear_non_ox3q1h /\ ox3q1h /\ packing V /\ saturated V ==> + cell_cluster_estimate_v1 V`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + PROOF_BY_CONTR_TAC; + INTRO_TAC CELL_CLUSTER_ESTIMATE_PROPS [`V`]; + ASM_REWRITE_TAC[]; + REPEAT WEAKER_STRIP_TAC; + INTRO_TAC Oxl_2012.GRHIDFA [`cc_data_v8 V f u0 u1`]; + ASM_REWRITE_TAC[(* Oxlzlez. *)cc_real_data]; + TYPIFY_GOAL_THEN `(0..(n-1)) = {i | i < n}` (unlist ASM_MESON_TAC); + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_NUMSEG]; + BY(ASM_TAC THEN ARITH_TAC) + ]);; + (* }}} *) + +let PACKING_CHAPTER_MAIN_CONCLUSION = prove_by_refinement( + `~kepler_conjecture /\ pack_nonlinear_non_ox3q1h /\ ox3q1h ==> + (?V. packing V /\ V SUBSET ball_annulus /\ ~lmfun_ineq_center V)`, + (* {{{ proof *) + [ + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Rdwkarc.RDWKARC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC OXLZLEZ; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[Pack_concl.TSKAJXY_statement]; + REPEAT WEAKER_STRIP_TAC; + MATCH_MP_TAC Tskajxy.TSKAJXY; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + + end;; diff --git a/text_formalization/packing/OXL_def.hl b/text_formalization/packing/OXL_def.hl new file mode 100644 index 0000000..e378185 --- /dev/null +++ b/text_formalization/packing/OXL_def.hl @@ -0,0 +1,830 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Packing *) +(* Lemma: OXLZLEZ *) +(* Author: Thomas C. Hales *) +(* Date: 2012-11-23 *) +(* ========================================================================== *) + +(* +Basic definitions (and type) and properties used for proof +OXLZLEZ +*) + +(* +_v11, 2013-2-14, changed constant cc_eps -> &0 in quqy cc_real_model_v10. +*) + +module Oxl_def = struct + + open Hales_tactic;; + +let cc_eps = new_definition `cc_eps = #0.0057`;; + +let cc_v11_exists = MESON[] `?(x:((num->real) list) # ((num->bool)list) # num ). T`;; + +let cc_v11 = REWRITE_RULE[] (new_type_definition "cc_v11" ("cc_v11", "pair_of_cc_v11")cc_v11_exists);; + +(* discarded ccx1, cc_bool *) + +let cc_real_v11 = new_definition `cc_real_v11 cc = FST (pair_of_cc_v11 cc)`;; +let cc_bool_v11 = new_definition `cc_bool_v11 (cc) = FST(SND (pair_of_cc_v11 cc))`;; +let cc_card_v11 = new_definition `cc_card_v11 (cc) = SND(SND (pair_of_cc_v11 cc))`;; + +let cc_azim_v11 = new_definition `cc_azim_v11 cc i = EL 0 (cc_real_v11 cc) i`;; +let cc_gg_v11 = new_definition `cc_gg_v11 cc i = EL 1 (cc_real_v11 cc) i`;; +let cc_gg3a_v11 = new_definition `cc_gg3a_v11 cc i = EL 2 (cc_real_v11 cc) i`;; +let cc_gg3b_v11 = new_definition `cc_gg3b_v11 cc i = EL 3 (cc_real_v11 cc) i`;; + + +let cc_subcrit_v11 = new_definition `cc_subcrit_v11 cc i = EL 0 (cc_bool_v11 cc) i`;; +let cc_crit_v11 = new_definition `cc_crit_v11 cc i = EL 1 (cc_bool_v11 cc) i`;; +let cc_supercrit_v11 = new_definition `cc_supercrit_v11 cc i = EL 2 (cc_bool_v11 cc) i`;; +let cc_small_v11 = new_definition `cc_small_v11 cc i = EL 3 (cc_bool_v11 cc) i`;; +let cc_small_eta_v11 = new_definition `cc_small_eta_v11 cc i = EL 4 (cc_bool_v11 cc) i`;; +let cc_4cell_v11 = new_definition `cc_4cell_v11 cc i = EL 5 (cc_bool_v11 cc) i`;; + + +let cc_hassmall_v11 = new_definition + `cc_hassmall_v11 cc i = (cc_small_v11 cc i /\ cc_small_v11 cc (i+1))`;; + +let cc_qu_v11 = new_definition `cc_qu_v11 cc i = (cc_hassmall_v11 cc i /\ cc_4cell_v11 cc i /\ cc_subcrit_v11 cc i)`;; +let cc_qx_v11 = new_definition `cc_qx_v11 cc i = (cc_4cell_v11 cc i /\ ~(cc_qu_v11 cc i))`;; +let cc_qy_v11 = new_definition `cc_qy_v11 cc i = ~cc_4cell_v11 cc i`;; + +let cc_size_v11 = new_definition `cc_size_v11 cc p = + CARD {i | i IN 0..(cc_card_v11 cc -1) /\ p i }`;; + +let periodic = new_definition `periodic (f:num->A) n = (!i. (f (i+n) = f (i:num)))`;; + +let cc_bool_model_v11 = new_definition `cc_bool_model_v11 cc <=> + ~(cc_card_v11 cc = 0) /\ + periodic (cc_subcrit_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_crit_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_supercrit_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_small_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_small_eta_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_4cell_v11 cc) (cc_card_v11 cc) /\ +(!i. ~(cc_crit_v11 cc i /\ cc_supercrit_v11 cc i)) /\ +(!i. ~(cc_crit_v11 cc i /\ cc_subcrit_v11 cc i)) /\ +(!i. ~(cc_supercrit_v11 cc i /\ cc_subcrit_v11 cc i)) /\ +(!i. (cc_4cell_v11 cc i ==> cc_crit_v11 cc i \/ cc_subcrit_v11 cc i \/ cc_supercrit_v11 cc i)) /\ +(!i. (cc_small_eta_v11 cc i ==> cc_small_v11 cc i)) // jsp +`;; + +let cc_bool_prep_v11 = new_definition `cc_bool_prep_v11 cc = (!i. cc_qy_v11 cc i ==> ~cc_qy_v11 cc (i+1))`;; + +(* thales 2013-2-14, corrected quqy constants cc_eps -> &0 *) + +let cc_real_model_v11 = new_definition `cc_real_model_v11 cc <=> + periodic (cc_azim_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_gg_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_gg3a_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_gg3b_v11 cc) (cc_card_v11 cc) /\ +// +// general bounds. +// +(!i. #0.606 <= cc_azim_v11 cc i) /\ // gckb +(!i. cc_4cell_v11 cc i ==> cc_azim_v11 cc i < #2.8) /\ // azim_c4 +(sum (0.. (cc_card_v11 cc - 1)) (cc_azim_v11 cc) = &2 * pi) /\ +((cc_card_v11 cc = 4) /\ (?i. cc_4cell_v11 cc i /\ cc_crit_v11 cc i /\ + cc_qu_v11 cc (i+1) /\ cc_qu_v11 cc (i+2) /\ cc_qu_v11 cc (i+3)) ==> + (&0 <= sum (0.. (cc_card_v11 cc -1)) (cc_gg_v11 cc))) /\ // ox3q1h +// +// quarters +// +(!i. cc_qu_v11 cc i ==> -- cc_eps <= cc_gg_v11 cc i) /\ // gamma_qu +(!i. cc_qu_v11 cc i /\ ~(cc_small_eta_v11 cc i) ==> cc_eps <= cc_gg_v11 cc i ) /\ // fhbv2 +(!i. cc_qu_v11 cc i /\ ~(cc_small_eta_v11 cc (i+1)) ==> cc_eps <= cc_gg_v11 cc i ) /\ // fhbv2 +(!i. cc_qu_v11 cc i /\ cc_qy_v11 cc (i+1) ==> &0 <= cc_gg_v11 cc i + cc_gg3a_v11 cc (i+1)) /\ // quqy +(!i. cc_qu_v11 cc (i+1) /\ cc_qy_v11 cc i ==> &0 <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i+1)) /\ // quqy +(!i. cc_4cell_v11 cc i ==> a_spine5 + b_spine5 * cc_azim_v11 cc i <= cc_gg_v11 cc i) /\ // ztg4 +(!i. cc_qu_v11 cc i ==> -- #0.0659 + #0.042 * cc_azim_v11 cc i <= cc_gg_v11 cc i) /\ // azim1 +(!i. cc_qu_v11 cc i ==> -- #0.0142852 + #0.00609451 * cc_azim_v11 cc i <= cc_gg_v11 cc i) /\ // gaz4 +(!i. cc_qu_v11 cc i ==> #0.161517 - #0.119482 * cc_azim_v11 cc i <= cc_gg_v11 cc i) /\ // gaz6 +// +// nonquarter 4-cells +// +(!i. cc_qx_v11 cc i ==> #0.0 <= cc_gg_v11 cc i) /\ // gamma_qx +(!i. cc_qx_v11 cc i /\ #2.3 < cc_azim_v11 cc i ==> cc_eps <= cc_gg_v11 cc i) /\ // g_qxd +(!i. cc_qx_v11 cc i /\ cc_hassmall_v11 cc i /\ cc_qy_v11 cc (i+1) ==> cc_eps <= cc_gg_v11 cc i + cc_gg3a_v11 cc (i+1)) /\ // gamma10 +(!i. cc_qx_v11 cc (i+1) /\ cc_hassmall_v11 cc (i+1) /\ cc_qy_v11 cc i ==> cc_eps <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i+1)) /\ // gamma11 +(!i. cc_qx_v11 cc i /\ cc_small_v11 cc i /\ ~cc_small_v11 cc (i+1) ==> cc_eps <= cc_gg_v11 cc i) /\ // gamma8 +(!i. cc_qx_v11 cc i /\ cc_small_v11 cc (i+1) /\ ~cc_small_v11 cc i ==> cc_eps <= cc_gg_v11 cc i) /\ // gamma8 +(!i. cc_qx_v11 cc i /\ cc_hassmall_v11 cc i ==> #0.213849 - #0.119482* cc_azim_v11 cc i <= cc_gg_v11 cc i) /\ // gaz9 +(!i. cc_qx_v11 cc i /\ cc_hassmall_v11 cc i /\ cc_supercrit_v11 cc i ==> #0.00457511 + #0.00609451*cc_azim_v11 cc i <= cc_gg_v11 cc i) /\ // azim2 +// +// 23-cells +// + (!i. cc_qy_v11 cc i ==> cc_gg3a_v11 cc i + cc_gg3b_v11 cc i <= cc_gg_v11 cc i) /\ + (!i. cc_qy_v11 cc i ==> &0 <= cc_gg3a_v11 cc i) /\ + (!i. cc_qy_v11 cc i ==> &0 <= cc_gg3b_v11 cc i) /\ +(!i. cc_qy_v11 cc i ==> #0.008 * cc_azim_v11 cc i <= cc_gg_v11 cc i) /\ // cell3, grki +(!i. cc_qy_v11 cc i /\ cc_small_eta_v11 cc i /\ ~cc_small_eta_v11 cc (i+1) /\ cc_azim_v11 cc i < #1.074 ==> + a_spine5 + b_spine5 * cc_azim_v11 cc i <= cc_gg_v11 cc i) /\ // pem +(!i. cc_qy_v11 cc i /\ ~cc_small_eta_v11 cc i /\ cc_small_eta_v11 cc (i+1) /\ cc_azim_v11 cc i < #1.074 ==> + a_spine5 + b_spine5 * cc_azim_v11 cc i <= cc_gg_v11 cc i) /\ // pem +(!i. cc_qy_v11 cc i /\ cc_small_eta_v11 cc i /\ cc_small_eta_v11 cc (i+1) ==> + a_spine5 + b_spine5 * cc_azim_v11 cc i <= cc_gg_v11 cc i) /\ // tew +(!i. cc_qy_v11 cc i /\ cc_small_eta_v11 cc i /\ cc_small_eta_v11 cc (i+1) /\ #1.946 <= cc_azim_v11 cc i /\ + cc_azim_v11 cc i <= #2.089 ==> + #3.0 * cc_eps <= cc_gg_v11 cc i) // txq +`;; + +let CHQSQEY_concl = `!cc. cc_bool_model_v11 cc /\ cc_bool_prep_v11 cc /\ cc_real_model_v11 cc /\ + (sum (0..cc_card_v11 cc -1) (cc_gg_v11 cc) < &0) ==> (3 <= cc_size_v11 cc (cc_4cell_v11 cc))`;; + +let MTMLSRF_concl = `!cc. cc_bool_model_v11 cc /\ cc_bool_prep_v11 cc /\ cc_real_model_v11 cc /\ + (sum (0..cc_card_v11 cc -1) (cc_gg_v11 cc) < &0) ==> (?i. 0 < i /\ cc_gg_v11 cc i < &0 /\ cc_qu_v11 cc i /\ + cc_4cell_v11 cc (i+1) /\ cc_4cell_v11 cc (i-1))`;; + +let LXDEYBO_concl = `!cc. cc_bool_model_v11 cc /\ cc_bool_prep_v11 cc /\ cc_real_model_v11 cc /\ + (sum (0..cc_card_v11 cc -1) (cc_gg_v11 cc) < &0) ==> (cc_size_v11 cc (cc_4cell_v11 cc) <= 4)`;; + +let UNPNFVW_concl = `!cc. cc_bool_model_v11 cc /\ cc_bool_prep_v11 cc /\ cc_real_model_v11 cc /\ + (sum (0..cc_card_v11 cc -1) (cc_gg_v11 cc) < &0) ==> (cc_size_v11 cc (cc_qy_v11 cc) <= 1)`;; + +let DHCVTVE_concl = `T`;; (* This is just a repeat of CHQSQEY, LXDEYBO, UNPNFVW *) + +let PMZTATI_concl = `T`;; (* This is a restatement of gamma8 *) + +let RJSZKQX_concl = `T`;; (* This is a restatement of fhvb2 *) + +let IXPFBKA_concl = `T`;; (* This is a restatement of jsp *) + +let IPVICGW_concl = `!cc. cc_bool_model_v11 cc /\ cc_bool_prep_v11 cc /\ cc_real_model_v11 cc /\ + (sum (0..cc_card_v11 cc -1) (cc_gg_v11 cc) < &0) ==> (!i. cc_small_v11 cc i)`;; + +let RSIWAMP_concl = `!cc. cc_bool_model_v11 cc /\ cc_bool_prep_v11 cc /\ cc_real_model_v11 cc /\ + (sum (0..cc_card_v11 cc -1) (cc_gg_v11 cc) < &0) ==> (cc_card_v11 cc <= 4)`;; + +let RSIWAMP_concl = `!cc. cc_bool_model_v11 cc /\ cc_bool_prep_v11 cc /\ cc_real_model_v11 cc /\ + (sum (0..cc_card_v11 cc -1) (cc_gg_v11 cc) < &0) ==> (cc_card_v11 cc <= 4)`;; + +let BKLETJQ_concl = `T`;; (* This is a restatement of gamma10_gamma11 *) + +let UTEOITF_concl = `!cc. cc_bool_model_v11 cc /\ cc_bool_prep_v11 cc /\ cc_real_model_v11 cc /\ + (sum (0..cc_card_v11 cc -1) (cc_gg_v11 cc) < &0) ==> (!i. cc_4cell_v11 cc i)`;; + +let LUIKGMH_concl = `!cc. cc_bool_model_v11 cc /\ cc_bool_prep_v11 cc /\ cc_real_model_v11 cc /\ + (sum (0..cc_card_v11 cc -1) (cc_gg_v11 cc) < &0) ==> (4 <= cc_card_v11 cc)`;; + +let GRHIDFA_concl = `!cc. cc_bool_model_v11 cc /\ cc_bool_prep_v11 cc /\ cc_real_model_v11 cc /\ + (sum (0..cc_card_v11 cc -1) (cc_gg_v11 cc) < &0) ==> (F)`;; (* main conclusion *) + +(* +let XSBYGIQ_concl = + `(?cc. cc_bool_model_v11 cc /\ cc_real_model_v11 cc /\ (sum (0..cc_card_v11 cc -1) (cc_gg_v11 cc) < &0)) + ==> (?cc. cc_bool_model_v11 cc /\ cc_real_model_v11 cc /\ cc_bool_prep_v11 cc /\ (sum (0..cc_card_v11 cc -1) (cc_gg_v11 cc) < &0))`;; +*) + + + +let periodic_nk = prove_by_refinement( + `!i k f n. periodic (f:num->A) n /\ (0 < n) ==> (f (i + k * n) = f i)`, + (* {{{ proof *) + [ + REWRITE_TAC[periodic]; + REPEAT WEAK_STRIP_TAC; + SPEC_TAC (`k:num`,`k:num`); + INDUCT_TAC; + AP_TERM_TAC; + BY(ARITH_TAC); + SUBST1_TAC (arith `i + SUC k * n = (i+ k * n) + n`); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let periodic_mod = prove_by_refinement( + `!f n m. periodic (f:num->A) n /\ ~( n=0) ==> (f m = f (m MOD n))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC DIVISION [`m`;`n`]; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[arith `x + (y:num) = y + x`]; + BY(ASM_MESON_TAC[periodic_nk;arith `~(n=0) ==> (0 < n)`]) + ]);; + (* }}} *) + +let MOD_IN_NUMSEG = prove_by_refinement( + `!m n. ~(n =0) ==> (m MOD n IN (0..(n-1)))`, + (* {{{ proof *) + [ + REWRITE_TAC[IN_NUMSEG]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC DIVISION [`m`;`n`]; + ASM_REWRITE_TAC[]; + BY(ARITH_TAC) + ]);; + (* }}} *) + +let MOD_INJ = prove_by_refinement( + `!n r a b. ~(n = 0) /\ a IN (r..((n-1)+r)) /\ b IN (r..((n-1)+r)) /\ a MOD n = b MOD n ==> (a = b)`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + SUBGOAL_THEN `!P. ((!a b. (a <= (b:num)) ==> P a b) /\ (!a b. P a b <=> P b a)) ==> (P a b)` MATCH_MP_TAC; + BY(MESON_TAC[ (arith `a <= b \/ b <= (a:num)`)]); + CONJ2_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + INTRO_TAC DIVISION [`a`;`n`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC DIVISION [`b`;`n`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `(b - a) DIV n = 0` ASSUME_TAC; + GMATCH_SIMP_TAC DIV_LT; + REPEAT (FIRST_X_ASSUM_ST `IN` MP_TAC); + REWRITE_TAC[IN_NUMSEG]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + SUBGOAL_THEN `(b - a) MOD n = 0` ASSUME_TAC; + REWRITE_TAC[MOD_EQ_0]; + ASM_SIMP_TAC[MOD_EQ_0]; + EXISTS_TAC (`b DIV n - a DIV n`); + REPEAT (FIRST_X_ASSUM_ST `( * ):num->num->num` MP_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[RIGHT_SUB_DISTRIB]; + FIRST_X_ASSUM_ST `a <= (b:num)` MP_TAC; + BY(ARITH_TAC); + ENOUGH_TO_SHOW_TAC `b - a = 0`; + FIRST_X_ASSUM_ST `a <= (b:num)` MP_TAC; + BY(ARITH_TAC); + INTRO_TAC DIVISION [`b - (a:num)`;`n`]; + ASM_REWRITE_TAC[]; + BY(ARITH_TAC) + ]);; + (* }}} *) + +let MOD_INJ1_ALT = prove_by_refinement +(`!k n. ~( n = 0) /\ k < n /\ ~( k = 0) ==> (! x. ~( x MOD n = (x + k) MOD n)) `, +[ + REPEAT STRIP_TAC; + INTRO_TAC MOD_INJ [`n`;`x`;`x`;`x + (k:num)`]; + ANTS_TAC; + ASM_REWRITE_TAC[IN_NUMSEG]; + REPEAT (FIRST_X_ASSUM MP_TAC); + SIMP_TAC[LE_REFL; ARITH_RULE` ~( n = 0) ==> x <= n - 1 + x `; ARITH_RULE` a <= a + x:num `]; + BY(ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC) +]);; + + +let MOD_SURJ = prove_by_refinement( + `!n r a. ~(n=0) /\ a IN (0..(n-1)) ==> (?b. b IN (r..((n-1)+r)) /\ b MOD n = a)`, + (* {{{ proof *) + [ + REWRITE_TAC[IN_NUMSEG]; + REPEAT WEAK_STRIP_TAC; + ASM_CASES_TAC `r MOD n <= a`; + EXISTS_TAC (`(r DIV n) * n + a`); + INTRO_TAC DIVISION [`r`;`n`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + REWRITE_TAC[ MOD_MULT_ADD]; + MATCH_MP_TAC MOD_LT; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + EXISTS_TAC (`((r DIV n) + 1) * n + a`); + REWRITE_TAC[ MOD_MULT_ADD ]; + CONJ2_TAC; + MATCH_MP_TAC MOD_LT; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + INTRO_TAC DIVISION [`r`;`n`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC) + ]);; + (* }}} *) + +let BIJ_SUM = prove_by_refinement( + `!(A:A->bool) (B:B->bool) f ab. + BIJ ab A B ==> (sum A (f o ab) = sum B f)`, + (* {{{ proof *) + [ + REWRITE_TAC[BIJ;INJ]; + BY(ASM_MESON_TAC[ SUM_IMAGE ; Misc_defs_and_lemmas.SURJ_IMAGE ]) + ]);; + (* }}} *) + + +let periodic_sum = prove_by_refinement( + `!f n. periodic f n /\ ~( n=0) ==> (!i. sum (i..((n-1) +i)) f = sum (0..(n-1)) f)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC BIJ_SUM [`i..((n-1)+i)`;`0..(n-1)`;`f`;`(\j. (j MOD n))`]; + ANTS_TAC; + REWRITE_TAC[BIJ;INJ]; + SUBCONJ_TAC; + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + BY(ASM_SIMP_TAC[ MOD_IN_NUMSEG]); + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC MOD_INJ; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[SURJ]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + BY(ASM_MESON_TAC[MOD_SURJ]); + DISCH_THEN (SUBST1_TAC o GSYM); + AP_TERM_TAC; + REWRITE_TAC[FUN_EQ_THM]; + GEN_TAC; + REWRITE_TAC[o_THM]; + BY(ASM_MESON_TAC[periodic_mod]) + ]);; + (* }}} *) + +let periodic_fn = prove_by_refinement( + `!cc. cc_bool_model_v11 cc ==> (periodic (cc_hassmall_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_qu_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_qx_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_qy_v11 cc) (cc_card_v11 cc)) + `, + (* {{{ proof *) + [ + REWRITE_TAC[cc_bool_model_v11;periodic;cc_hassmall_v11;cc_qu_v11;cc_qx_v11;cc_qy_v11]; + REPEAT WEAK_STRIP_TAC; + BY(ASM_SIMP_TAC[arith `!i. (i + cc_card_v11 cc) + 1 = (i + 1) + cc_card_v11 cc`]) + ]);; + (* }}} *) + + +let QX_NN = prove_by_refinement( + `!cc i. cc_bool_model_v11 cc /\ cc_real_model_v11 cc /\ (cc_qx_v11 cc i) ==> + (#0.0 <= cc_gg_v11 cc i)`, + (* {{{ proof *) + [ + REWRITE_TAC[cc_bool_model_v11;cc_real_model_v11]; + REPEAT WEAK_STRIP_TAC; + BY(ASM_SIMP_TAC[]) + ]);; + (* }}} *) + +let QY_NN = prove_by_refinement( + `!cc i. cc_bool_model_v11 cc /\ cc_real_model_v11 cc /\ (cc_qy_v11 cc i) ==> + (#0.0 <= cc_gg_v11 cc i)`, + (* {{{ proof *) + [ + REWRITE_TAC[cc_bool_model_v11;cc_real_model_v11]; + REPEAT WEAK_STRIP_TAC; + ENOUGH_TO_SHOW_TAC `&0 <= cc_gg3a_v11 cc i /\ &0 <= cc_gg3b_v11 cc i /\ cc_gg3a_v11 cc i + cc_gg3b_v11 cc i <= cc_gg_v11 cc i`; + BY(REAL_ARITH_TAC); + BY(ASM_SIMP_TAC[]) + ]);; + (* }}} *) + +let QY_QX_QU = prove_by_refinement( + `!cc i. cc_bool_model_v11 cc ==> + (cc_qu_v11 cc i \/ cc_qy_v11 cc i \/ cc_qx_v11 cc i)`, + (* {{{ proof *) + [ + REWRITE_TAC[cc_bool_model_v11]; + REWRITE_TAC[cc_qu_v11;cc_qy_v11;cc_qx_v11]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let QUARTER1 = prove_by_refinement( +`!cc. cc_bool_model_v11 cc /\ cc_real_model_v11 cc /\ + (sum (0..cc_card_v11 cc -1) (cc_gg_v11 cc) < &0) ==> (1 <= cc_size_v11 cc (cc_qu_v11 cc))`, + (* {{{ proof *) + [ + GEN_TAC; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `cc_real_model_v11` MP_TAC; + COPY_TAC; + FIRST_X_ASSUM_ST `cc_bool_model_v11` MP_TAC; + COPY_TAC; + REWRITE_TAC[cc_size_v11;cc_real_model_v11;cc_bool_model_v11]; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `~(cc_card_v11 cc = 0)` ASSUME_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[arith `1 <= x <=> ~(x = 0)`]; + GMATCH_SIMP_TAC CARD_EQ_0; + CONJ_TAC; + MATCH_MP_TAC FINITE_SUBSET; + TYPIFY `0..cc_card_v11 cc - 1` EXISTS_TAC; + REWRITE_TAC[FINITE_NUMSEG]; + BY(SET_TAC[]); + REWRITE_TAC[Misc_defs_and_lemmas.EMPTY_EXISTS]; + TYPIFY `~(!i. ~(cc_qu_v11 cc i))` ENOUGH_TO_SHOW_TAC; + REWRITE_TAC[NOT_FORALL_THM]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `i MOD (cc_card_v11 cc)`))); + REWRITE_TAC[IN_ELIM_THM]; + CONJ_TAC; + GMATCH_SIMP_TAC MOD_IN_NUMSEG; + BY(ASM_REWRITE_TAC[]); + GMATCH_SIMP_TAC (GSYM periodic_mod); + ASM_REWRITE_TAC[]; + BY(ASM_SIMP_TAC[periodic_fn]); + DISCH_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `?p. cc_gg_v11 cc p < &0`) MP_TAC)); + TYPIFY `~(!i. &0 <= cc_gg_v11 cc i)` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[arith `&0 <= x <=> ~(x < &0)`]); + DISCH_TAC; + FIRST_X_ASSUM_ST `sum X f < &0` MP_TAC; + REWRITE_TAC[arith `((x < &0) ==> F) <=> &0 <= x`]; + MATCH_MP_TAC SUM_POS_LE; + REWRITE_TAC[FINITE_NUMSEG]; + REPEAT WEAK_STRIP_TAC; + BY(ASM_SIMP_TAC[]); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (MP_TAC o (ISPEC `p:num`)); + REWRITE_TAC[]; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `~(cc_qx_v11 cc p \/ cc_qy_v11 cc p)`))); + BY(ASM_MESON_TAC[ QY_QX_QU]); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[arith `x < &0 <=> ~(#0.0 <= x)`]; + REWRITE_TAC[TAUT `(~a ==> ~b) <=> (b ==> a)`]; + BY(ASM_MESON_TAC[QX_NN;QY_NN]) + ]);; + (* }}} *) + +let QU_EXISTS = prove_by_refinement( + `!cc. cc_bool_model_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0 ==> + (?q. cc_qu_v11 cc q /\ q IN 0..cc_card_v11 cc - 1)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC QUARTER1 [`cc`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[cc_size_v11;arith `1 <= x <=> ~(x = 0)`]; + GMATCH_SIMP_TAC CARD_EQ_0; + REWRITE_TAC[Misc_defs_and_lemmas.EMPTY_EXISTS]; + REWRITE_TAC[IN_ELIM_THM]; + GMATCH_SIMP_TAC FINITE_SUBSET; + CONJ2_TAC; + BY(MESON_TAC[]); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `0..cc_card_v11 cc - 1`))); + REWRITE_TAC[FINITE_NUMSEG]; + REWRITE_TAC[SUBSET;IN_ELIM_THM]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let CC_CARD2 = prove_by_refinement( + `!cc. cc_bool_model_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0 ==> + (2 <= cc_card_v11 cc)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC QU_EXISTS [`cc`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + ENOUGH_TO_SHOW_TAC `~(cc_card_v11 cc = 1)`; + REWRITE_TAC[arith `2 <= x <=> ~(x = 0) /\ ~(x = 1)`]; + BY(ASM_MESON_TAC[cc_bool_model_v11]); + DISCH_TAC; + SUBGOAL_THEN `sum (0..cc_card_v11 cc -1) (cc_azim_v11 cc) = &2 * pi /\ cc_azim_v11 cc q < #2.8` MP_TAC; + FIRST_X_ASSUM_ST `cc_qu_v11` MP_TAC; + REWRITE_TAC[cc_qu_v11]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `cc_real_model_v11` MP_TAC; + REWRITE_TAC[cc_real_model_v11]; + REPEAT WEAK_STRIP_TAC; + BY(ASM_SIMP_TAC[]); + SUBGOAL_THEN `cc_card_v11 cc - 1 = 0` SUBST1_TAC; + FIRST_X_ASSUM MP_TAC; + BY(ARITH_TAC); + REWRITE_TAC[NUMSEG_SING;SUM_SING]; + SUBGOAL_THEN `q = 0` SUBST1_TAC; + FIRST_X_ASSUM_ST `IN` MP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[IN_NUMSEG]; + BY(ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[]; + MP_TAC Flyspeck_constants.bounds; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let CASE_3Q1H = prove_by_refinement( + `!cc. cc_bool_model_v11 cc /\ +((cc_card_v11 cc = 4) /\ (?i. cc_4cell_v11 cc i /\ cc_crit_v11 cc i /\ + cc_qu_v11 cc (i+1) /\ cc_qu_v11 cc (i+2) /\ cc_qu_v11 cc (i+3))) ==> + ~(?i. cc_qy_v11 cc i)`, + (* {{{ proof *) + [ + REWRITE_TAC[cc_qu_v11;cc_qy_v11]; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `periodic (cc_4cell_v11 cc) (cc_card_v11 cc) /\ ~(0 = cc_card_v11 cc)` ASSUME_TAC; + BY(ASM_MESON_TAC[cc_bool_model_v11]); + SUBGOAL_THEN `cc_4cell_v11 cc (i MOD 4) /\ cc_4cell_v11 cc ((i+1) MOD 4) /\ cc_4cell_v11 cc ((i+2) MOD 4) /\ cc_4cell_v11 cc ((i+3) MOD 4)` MP_TAC; + FIRST_X_ASSUM_ST `4` (SUBST1_TAC o GSYM); + REPEAT (GMATCH_SIMP_TAC (GSYM periodic_mod)); + BY(ASM_REWRITE_TAC[]); + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `~(cc_4cell_v11 cc (i' MOD 4))` MP_TAC; + FIRST_X_ASSUM_ST `4` (SUBST1_TAC o GSYM); + REPEAT (GMATCH_SIMP_TAC (GSYM periodic_mod)); + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[TAUT `(~a ==> F) <=> a`]; + SUBGOAL_THEN `(i' MOD 4 = i MOD 4) \/ (i' MOD 4 = (i+1) MOD 4) \/ (i' MOD 4 = (i+2) MOD 4) \/ (i' MOD 4 = (i+3) MOD 4)` ASSUME_TAC; + INTRO_TAC MOD_SURJ [`4`;`i`;`i' MOD 4`]; + ASM_SIMP_TAC[MOD_IN_NUMSEG;arith `~(4 = 0)`]; + REWRITE_TAC[IN_NUMSEG;arith `4 - 1 +i = i + 3`]; + REWRITE_TAC[arith `(i <= b /\ b <= i + 3) <=> (b = i \/ b = i+1 \/ b = i+2 \/ b = i+3)`]; + BY(MESON_TAC[]); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let CC_EXISTS = prove_by_refinement( + `!az gg gg3a gg3b sub cri super sma eta cell4 n. ?cc. + cc_azim_v11 cc = az /\ + cc_gg_v11 cc = gg /\ + cc_gg3a_v11 cc = gg3a /\ + cc_gg3b_v11 cc = gg3b /\ + cc_subcrit_v11 cc = sub /\ + cc_crit_v11 cc = cri /\ + cc_supercrit_v11 cc = super /\ + cc_small_v11 cc = sma /\ + cc_small_eta_v11 cc = eta /\ + cc_4cell_v11 cc = cell4 /\ + cc_card_v11 cc = n`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `cc_v11 ([az;gg;gg3a;gg3b],([sub;cri;super;sma;eta;cell4],n))`))); + REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[cc_azim_v11;cc_gg_v11;cc_gg3a_v11;cc_gg3b_v11;cc_subcrit_v11;cc_crit_v11;cc_supercrit_v11;cc_small_v11;cc_small_eta_v11;cc_4cell_v11;cc_card_v11;cc_real_v11;cc_bool_v11;cc_v11]; + BY(REWRITE_TAC[EL;HD;TL;arith `5 = SUC 4 /\ 4 = SUC 3 /\ 3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]) + ]);; + (* }}} *) + +let periodic_numseg = prove_by_refinement( + `!p n. periodic p n /\ ~(n = 0) /\ + (!i. i IN 0..(n-1) ==> p i) ==> + (!i. p i)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC periodic_mod; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `n`))); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + GMATCH_SIMP_TAC MOD_IN_NUMSEG; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let cc_bool_model_simple = prove_by_refinement( + `!cc. + ~(cc_card_v11 cc = 0) /\ + periodic (cc_subcrit_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_crit_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_supercrit_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_small_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_small_eta_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_4cell_v11 cc) (cc_card_v11 cc) /\ +(!i. i IN 0..(cc_card_v11 cc - 1) ==> ~(cc_crit_v11 cc i /\ cc_supercrit_v11 cc i)) /\ +(!i. i IN 0..(cc_card_v11 cc - 1) ==> ~(cc_crit_v11 cc i /\ cc_subcrit_v11 cc i)) /\ +(!i. i IN 0..(cc_card_v11 cc - 1) ==> ~(cc_supercrit_v11 cc i /\ cc_subcrit_v11 cc i)) /\ +(!i. i IN 0..(cc_card_v11 cc - 1) ==> (cc_4cell_v11 cc i ==> cc_crit_v11 cc i \/ cc_subcrit_v11 cc i \/ cc_supercrit_v11 cc i)) /\ +(!i. i IN 0..(cc_card_v11 cc - 1) ==> (cc_small_eta_v11 cc i ==> cc_small_v11 cc i)) + ==> cc_bool_model_v11 cc +`, + (* {{{ proof *) + [ + REWRITE_TAC[cc_bool_model_v11]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + ABBREV_TAC `n = cc_card_v11 cc`; + CONJ_TAC; + MATCH_MP_TAC periodic_numseg; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `n`))); + ASM_REWRITE_TAC[]; + REWRITE_TAC[periodic]; + BY(ASM_MESON_TAC[periodic]); + CONJ_TAC; + MATCH_MP_TAC periodic_numseg; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `n`))); + ASM_REWRITE_TAC[]; + REWRITE_TAC[periodic]; + BY(ASM_MESON_TAC[periodic]); + CONJ_TAC; + MATCH_MP_TAC periodic_numseg; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `n`))); + ASM_REWRITE_TAC[]; + REWRITE_TAC[periodic]; + BY(ASM_MESON_TAC[periodic]); + CONJ_TAC; + MATCH_MP_TAC periodic_numseg; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `n`))); + ASM_REWRITE_TAC[]; + REWRITE_TAC[periodic]; + BY(ASM_MESON_TAC[periodic]); + MATCH_MP_TAC periodic_numseg; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `n`))); + ASM_REWRITE_TAC[]; + REWRITE_TAC[periodic]; + BY(ASM_MESON_TAC[periodic]) + ]);; + (* }}} *) + +let cc_bool_model_simple2 = prove_by_refinement( + `!cc cc'. + ~(cc_card_v11 cc = 0) /\ + cc_bool_model_v11 cc' /\ + periodic (cc_subcrit_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_crit_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_supercrit_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_small_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_small_eta_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_4cell_v11 cc) (cc_card_v11 cc) /\ + (!i. i IN 0..(cc_card_v11 cc - 1) ==> (?j. + (cc_subcrit_v11 cc i = cc_subcrit_v11 cc' j) /\ + (cc_crit_v11 cc i = cc_crit_v11 cc' j) /\ + (cc_supercrit_v11 cc i = cc_supercrit_v11 cc' j) /\ + (cc_small_v11 cc i = cc_small_v11 cc' j) /\ + (cc_small_eta_v11 cc i = cc_small_eta_v11 cc' j) /\ + (cc_4cell_v11 cc i = cc_4cell_v11 cc' j))) + ==> cc_bool_model_v11 cc +`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC cc_bool_model_simple; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `cc_bool_model_v11` MP_TAC; + REWRITE_TAC[cc_bool_model_v11]; + REPEAT WEAK_STRIP_TAC; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let cc_real_model_simple = prove_by_refinement( + `!cc n. + (cc_card_v11 cc = n) /\ + ~(n = 0) /\ + periodic (cc_azim_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_gg_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_gg3a_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_gg3b_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_subcrit_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_crit_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_supercrit_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_small_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_small_eta_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_4cell_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_hassmall_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_qu_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_qx_v11 cc) (cc_card_v11 cc) /\ + periodic (cc_qy_v11 cc) (cc_card_v11 cc) /\ +(!i. (i IN 0..(n-1)) ==> (#0.606 <= cc_azim_v11 cc i)) /\ +(!i. (i IN 0..(n-1)) ==> cc_4cell_v11 cc i ==> cc_azim_v11 cc i < #2.8) /\ +(sum (0.. (cc_card_v11 cc - 1)) (cc_azim_v11 cc) = &2 * pi) /\ +((cc_card_v11 cc = 4) /\ (?i. cc_4cell_v11 cc i /\ cc_crit_v11 cc i /\ + cc_qu_v11 cc (i+1) /\ cc_qu_v11 cc (i+2) /\ cc_qu_v11 cc (i+3)) ==> + (&0 <= sum (0.. (cc_card_v11 cc -1)) (cc_gg_v11 cc))) /\ +(!i. (i IN 0..(n-1)) ==> cc_qu_v11 cc i ==> -- cc_eps <= cc_gg_v11 cc i) /\ +(!i. (i IN 0..(n-1)) ==> cc_qu_v11 cc i /\ ~(cc_small_eta_v11 cc i) ==> cc_eps <= cc_gg_v11 cc i ) /\ +(!i. (i IN 0..(n-1)) ==> cc_qu_v11 cc i /\ ~(cc_small_eta_v11 cc (i+1)) ==> cc_eps <= cc_gg_v11 cc i ) /\ +(!i. (i IN 0..(n-1)) ==> cc_qu_v11 cc i /\ cc_qy_v11 cc (i+1) ==> &0 <= cc_gg_v11 cc i + cc_gg3a_v11 cc (i+1)) /\ +(!i. (i IN 0..(n-1)) ==> cc_qu_v11 cc (i+1) /\ cc_qy_v11 cc i ==> &0 <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i+1)) /\ +(!i. (i IN 0..(n-1)) ==> cc_4cell_v11 cc i ==> a_spine5 + b_spine5 * cc_azim_v11 cc i <= cc_gg_v11 cc i) /\ +(!i. (i IN 0..(n-1)) ==> cc_qu_v11 cc i ==> -- #0.0659 + #0.042 * cc_azim_v11 cc i <= cc_gg_v11 cc i) /\ +(!i. (i IN 0..(n-1)) ==> cc_qu_v11 cc i ==> -- #0.0142852 + #0.00609451 * cc_azim_v11 cc i <= cc_gg_v11 cc i) /\ +(!i. (i IN 0..(n-1)) ==> cc_qu_v11 cc i ==> #0.161517 - #0.119482 * cc_azim_v11 cc i <= cc_gg_v11 cc i) /\ +(!i. (i IN 0..(n-1)) ==> cc_qx_v11 cc i ==> #0.0 <= cc_gg_v11 cc i) /\ +(!i. (i IN 0..(n-1)) ==> cc_qx_v11 cc i /\ #2.3 < cc_azim_v11 cc i ==> cc_eps <= cc_gg_v11 cc i) /\ +(!i. (i IN 0..(n-1)) ==> cc_qx_v11 cc i /\ cc_hassmall_v11 cc i /\ cc_qy_v11 cc (i+1) ==> cc_eps <= cc_gg_v11 cc i + cc_gg3a_v11 cc (i+1)) /\ +(!i. (i IN 0..(n-1)) ==> cc_qx_v11 cc (i+1) /\ cc_hassmall_v11 cc (i+1) /\ cc_qy_v11 cc i ==> cc_eps <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i+1)) /\ +(!i. (i IN 0..(n-1)) ==> cc_qx_v11 cc i /\ cc_small_v11 cc i /\ ~cc_small_v11 cc (i+1) ==> cc_eps <= cc_gg_v11 cc i) /\ +(!i. (i IN 0..(n-1)) ==> cc_qx_v11 cc i /\ cc_small_v11 cc (i+1) /\ ~cc_small_v11 cc i ==> cc_eps <= cc_gg_v11 cc i) /\ +(!i. (i IN 0..(n-1)) ==> cc_qx_v11 cc i /\ cc_hassmall_v11 cc i ==> #0.213849 - #0.119482* cc_azim_v11 cc i <= cc_gg_v11 cc i) /\ +(!i. (i IN 0..(n-1)) ==> cc_qx_v11 cc i /\ cc_hassmall_v11 cc i /\ cc_supercrit_v11 cc i ==> #0.00457511 + #0.00609451*cc_azim_v11 cc i <= cc_gg_v11 cc i) /\ + (!i. (i IN 0..(n-1)) ==> cc_qy_v11 cc i ==> cc_gg3a_v11 cc i + cc_gg3b_v11 cc i <= cc_gg_v11 cc i) /\ + (!i. (i IN 0..(n-1)) ==> cc_qy_v11 cc i ==> &0 <= cc_gg3a_v11 cc i) /\ + (!i. (i IN 0..(n-1)) ==> cc_qy_v11 cc i ==> &0 <= cc_gg3b_v11 cc i) /\ +(!i. (i IN 0..(n-1)) ==> cc_qy_v11 cc i ==> #0.008 * cc_azim_v11 cc i <= cc_gg_v11 cc i) /\ +(!i. (i IN 0..(n-1)) ==> cc_qy_v11 cc i /\ cc_small_eta_v11 cc i /\ ~cc_small_eta_v11 cc (i+1) /\ cc_azim_v11 cc i < #1.074 ==> + a_spine5 + b_spine5 * cc_azim_v11 cc i <= cc_gg_v11 cc i) /\ +(!i. (i IN 0..(n-1)) ==> cc_qy_v11 cc i /\ ~cc_small_eta_v11 cc i /\ cc_small_eta_v11 cc (i+1) /\ cc_azim_v11 cc i < #1.074 ==> + a_spine5 + b_spine5 * cc_azim_v11 cc i <= cc_gg_v11 cc i) /\ +(!i. (i IN 0..(n-1)) ==> cc_qy_v11 cc i /\ cc_small_eta_v11 cc i /\ cc_small_eta_v11 cc (i+1) ==> + a_spine5 + b_spine5 * cc_azim_v11 cc i <= cc_gg_v11 cc i) /\ +(!i. (i IN 0..(n-1)) ==> cc_qy_v11 cc i /\ cc_small_eta_v11 cc i /\ cc_small_eta_v11 cc (i+1) /\ #1.946 <= cc_azim_v11 cc i /\ + cc_azim_v11 cc i <= #2.089 ==> + #3.0 * cc_eps <= cc_gg_v11 cc i) + ==> cc_real_model_v11 cc +`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[cc_real_model_v11]; + ASM_REWRITE_TAC[]; + BY(REPEAT (CONJ_TAC) THEN (MATCH_MP_TAC periodic_numseg) THEN EXISTS_TAC `n:num` THEN ASM_REWRITE_TAC[periodic] THEN GEN_TAC THEN SUBST1_TAC (arith `(i+n) + 1 = (i+1) + n`) THEN TRY(ASM_MESON_TAC[periodic])) + ]);; + (* }}} *) + +let BIJ_NUMSEG = prove_by_refinement( + `!s a b. BIJ (\j. j+ s) (a..b) (a+s..b+s)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[BIJ;INJ]; + SUBCONJ_TAC; + REWRITE_TAC[IN_NUMSEG]; + BY(ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[SURJ]; + REWRITE_TAC[IN_NUMSEG]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `(x:num) - s` EXISTS_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); + BY(ARITH_TAC) + ]);; + (* }}} *) + + +let cc_cut_sum = prove_by_refinement( + `!f' x f n. + ~(n=0) /\ + periodic f' (n+1) /\ + f 0 = f' x + f' (x +1) /\ + (!i. i IN 1..n-1 ==> f i = f' (x + 1 + i)) ==> + sum (0..n-1) f = sum (0..n) f'`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `sum (0..n) f' = sum(x..(x+n)) f'` (C SUBGOAL_THEN SUBST1_TAC); + SUBST1_TAC (arith `(x:num) + n = (n + 1 ) - 1 + x` ); + GMATCH_SIMP_TAC periodic_sum; + ASM_REWRITE_TAC[arith `(n+1) - 1 = n`]; + BY(ARITH_TAC); + GMATCH_SIMP_TAC SUM_CLAUSES_LEFT; + ASM_REWRITE_TAC[arith `0 + 1 = 1`;arith `0 <= n-1`]; + ASM_CASES_TAC `n=1`; + ASM_REWRITE_TAC[arith `1 - 1 = 0`]; + ASM_SIMP_TAC[arith `0 < 1`;SUM_TRIV_NUMSEG]; + GMATCH_SIMP_TAC SUM_CLAUSES_LEFT; + REWRITE_TAC[SUM_SING_NUMSEG]; + REWRITE_TAC[arith `x <= x + 1`]; + BY(REAL_ARITH_TAC); + SUBGOAL_THEN `2 <= n` ASSUME_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + TYPIFY `sum (x..x+n) f' = f' x + f' (x+1) + sum (x+2..x+n) f'` (C SUBGOAL_THEN SUBST1_TAC); + GMATCH_SIMP_TAC SUM_CLAUSES_LEFT; + GMATCH_SIMP_TAC SUM_CLAUSES_LEFT; + BY(ASM_SIMP_TAC[arith `2 <= n ==> x + 1 <= x + n`;arith `x <= x + (n:num)`;arith `(x+1)+1 = x+2`]); + TYPIFY `sum (x+2..x+n) f' = sum (1..(n-1)) (\i. f' (i + (x+1)))` (C SUBGOAL_THEN ASSUME_TAC); + SUBST1_TAC (arith `x+2 = 1 + (x+1)`); + MP_TAC (arith `~(n=0) ==> x + n = (n-1) + (x+1)`); + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[ SUM_OFFSET]); + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `(a + b) + c = a + b + d <=> c = d`]; + MATCH_MP_TAC SUM_EQ; + BETA_TAC; + REPEAT WEAK_STRIP_TAC; + ASM_SIMP_TAC[]; + AP_TERM_TAC; + BY(ARITH_TAC) + ]);; + (* }}} *) + +let PERIODIC_PROPERTY= prove( +` ~(k = 0) /\ periodic vv k ==> (!i. vv (i MOD k)= vv i)`, +REWRITE_TAC[periodic] +THEN REPEAT STRIP_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN REMOVE_ASSUM_TAC +THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(RAND_CONV o ONCE_DEPTH_CONV)[th] +THEN MP_TAC th) +THEN ABBREV_TAC`n= i DIV k` +THEN ASM_TAC +THEN SPEC_TAC (`i:num`,`i:num`) +THEN SPEC_TAC (`n:num`,`n:num`) +THEN INDUCT_TAC +THENL[REWRITE_TAC[ARITH_RULE`0*K+A=A`]; +POP_ASSUM(fun th-> REPEAT STRIP_TAC +THEN MRESA1_TAC th`n *k + i MOD k`) +THEN POP_ASSUM MP_TAC +THEN MRESA_TAC DIVISION[`i:num`;`k:num`] +THEN MRESA_TAC MOD_MULT_ADD[`n:num`;`k:num`;`i MOD k`] +THEN MRESA_TAC DIV_UNIQ[`n * k + i MOD k`;`k:num`;`n:num`;`i MOD k`] +THEN ASM_SIMP_TAC[MOD_MOD_REFL;ARITH_RULE`SUC n * k + i MOD k = (n * k + i MOD k) +k`]]) +;; + + + +end;; diff --git a/text_formalization/packing/QZKSYKG.hl b/text_formalization/packing/QZKSYKG.hl new file mode 100755 index 0000000..00fa166 --- /dev/null +++ b/text_formalization/packing/QZKSYKG.hl @@ -0,0 +1,2255 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: QZKSYKG *) +(* Chaper : Packing *) +(* *) +(* ========================================================================= *) + + +module Qzksykg = struct + +open Rogers;; +open Vukhacky_tactics;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Sphere;; +open Marchal_cells;; +open Emnwuus;; +open Marchal_cells_2_new;; +open Lepjbdj;; +open Hdtfnfz;; +open Ynhyjit;; + +let CONVEX_HULL_4_IMP_3_1 = prove_by_refinement ( + `!a:real^3 b c d x. + x IN convex hull {a,b,c,d} ==> + (?x1 t1 t2. + x1 IN convex hull {a,b,c} /\ + &0 <= t1 /\ &0 <= t2 /\ t1 + t2 = &1 /\ + x = t1 % x1 + t2 % d)`, +[(REWRITE_TAC[CONVEX_HULL_4; CONVEX_HULL_3;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `z < &1`); + + (EXISTS_TAC `(u/ (u + v + w)) % a + (v/ (u+v+w)) % b + (w/(u+v+w)) % (c:real^3)`); + (EXISTS_TAC `(u + v + w):real` THEN EXISTS_TAC `z:real`); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u/(u+v+w)`); + (EXISTS_TAC `v/(u+v+w)`); + (EXISTS_TAC `w/(u+v+w)`); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `u / (u + v + w) + v / (u + v + w) + w / (u + v + w)= + (u + v + w) / (u + v + w)`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REAL_ARITH_TAC); + (REFL_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `s % (s1 /s % a + s2 / s % b + s3/ s % c) = + (s * s1 / s) % a + (s * s2 / s) % b + (s * s3 / s) % c`]); + (REWRITE_TAC[REAL_ARITH `s * s1 / s = s1 * (s / s)`]); + (REWRITE_WITH `(u + v + w) / (u + v + w) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_MUL_RID] THEN VECTOR_ARITH_TAC); + + (NEW_GOAL `z = &1 /\ u = &0 /\ v = &0 /\ w = &0`); + (ASM_REAL_ARITH_TAC); + (EXISTS_TAC `a:real^3`); + (EXISTS_TAC `&0` THEN EXISTS_TAC `&1`); + (ASM_REWRITE_TAC[ARITH_RULE `&0 <= &0 /\ &0 <= &1 /\ &0 + &1 = &1`]); + (STRIP_TAC); + (EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0`); + (ASM_REWRITE_TAC[ARITH_RULE `&0 <= &0 /\ &0 <= &1 /\ &1 + &0 + &0 = &1`]); + (VECTOR_ARITH_TAC); + (VECTOR_ARITH_TAC)]);; + + +let BARV_2_EXPLICIT = prove_by_refinement ( + `!V vl. barV V 2 vl ==> ?u0 u1 u2. vl = [u0;u1;u2]`, +[(REWRITE_TAC[BARV] THEN REPEAT STRIP_TAC); + (NEW_GOAL `?x0 xl. (vl:(real^3)list) = CONS x0 xl /\ LENGTH xl = 2`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `x0:real^3`); + (NEW_GOAL `?x1 yl. (xl:(real^3)list) = CONS x1 yl /\ LENGTH yl = 1`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `x1:real^3`); + (NEW_GOAL `?x2 zl. (yl:(real^3)list) = CONS x2 zl /\ LENGTH zl = 0`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `x2:real^3`); + (NEW_GOAL `(zl:(real^3)list) = []`); + (ASM_MESON_TAC[LENGTH_EQ_NIL]); + (ASM_REWRITE_TAC[])]);; + +let ROGERS_EXPLICIT_2 = prove_by_refinement ( + `!V ul. + saturated V /\ packing V /\ barV V 2 ul ==> + rogers V ul = convex hull + {HD ul, omega_list_n V ul 1, omega_list_n V ul 2}`, + +[(REPEAT STRIP_TAC THEN REWRITE_TAC[ROGERS]); + (NEW_GOAL `?u0 u1 u2. (ul:(real^3)list) = [u0:real^3;u1;u2]`); + (MATCH_MP_TAC BARV_2_EXPLICIT THEN EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `{j | j < LENGTH (ul:(real^3)list)} = {0, 1,2}`); + (ASM_REWRITE_TAC[LENGTH; ARITH_RULE `SUC (SUC (SUC 0)) = 3`]); + (SET_TAC[ARITH_RULE `0 < 3 /\ 1 < 3 /\ 2 < 3 /\ + (!j. j < 3 ==> (j=0\/j=1\/j=2))`]); + (REWRITE_TAC[IMAGE]); + (AP_TERM_TAC); + (REWRITE_TAC[SET_RULE `!x. x IN {0,1,2} <=> (x = 0 \/x = 1 \/x = 2)`]); + (REWRITE_WITH + `!y. (?x. (x = 0 \/ x = 1 \/ x = 2) /\ y = omega_list_n V ul x) + <=> (y = omega_list_n V ul 0) \/ (y = omega_list_n V ul 1) \/ + (y = omega_list_n V ul 2)`); + (SET_TAC[BETA_THM]); + (REWRITE_WITH + `{y | y = omega_list_n V ul 0 \/ y = omega_list_n V ul 1 \/ + y = omega_list_n V ul 2} + = {omega_list_n V ul 0, omega_list_n V ul 1, omega_list_n V ul 2}`); + (SET_TAC[]); + (REWRITE_WITH `omega_list_n V ul 0 = HD ul`); + (REWRITE_TAC[OMEGA_LIST_N])]);; + +let TWO_REARRANGEMENT_LEMMA = prove_by_refinement ( + `!V ul p u0 u1 u2 u3. + packing V /\ saturated V /\ barV V 3 ul /\ ul = [u0;u1;u2;u3] ==> + (?p. p permutes 0..1 /\ [u1;u0;u2;u3] = left_action_list p ul)`, +[(REPEAT STRIP_TAC); + (ABBREV_TAC `p = (\i. if i = 0 then 1 else if i = 1 then 0 else i)`); + (EXISTS_TAC `p:num->num`); + + (NEW_GOAL `p 0 = 1`); + (EXPAND_TAC "p"); + (COND_CASES_TAC); + (REFL_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `p 1 = 0`); + (EXPAND_TAC "p"); + (COND_CASES_TAC); + (COND_CASES_TAC); + (REFL_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `!i. 1 < i ==> p i = i`); + (EXPAND_TAC "p"); + (REPEAT STRIP_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (REFL_TAC); + + (NEW_GOAL `inverse p 0 = 1`); + (REWRITE_TAC[inverse]); + (MATCH_MP_TAC SELECT_UNIQUE); + (GEN_TAC THEN EQ_TAC); + (REWRITE_TAC[BETA_THM]); + (ASM_CASES_TAC `y = 0`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_CASES_TAC `1 < y`); + (ASM_SIMP_TAC[]); + (STRIP_TAC); + (ASM_ARITH_TAC); + (STRIP_TAC THEN ASM_REWRITE_TAC[BETA_THM]); + + (NEW_GOAL `inverse p 1 = 0`); + (REWRITE_TAC[inverse]); + (MATCH_MP_TAC SELECT_UNIQUE); + (GEN_TAC THEN EQ_TAC); + (REWRITE_TAC[BETA_THM]); + (ASM_CASES_TAC `y = 1`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_CASES_TAC `1 < y`); + (ASM_SIMP_TAC[]); + (STRIP_TAC); + (ASM_ARITH_TAC); + (STRIP_TAC THEN ASM_REWRITE_TAC[BETA_THM]); + + (NEW_GOAL `!i. 1 < i ==> inverse p i = i`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[inverse]); + (MATCH_MP_TAC SELECT_UNIQUE); + (GEN_TAC THEN EQ_TAC); + (REWRITE_TAC[BETA_THM]); + (ASM_CASES_TAC `y = 0`); + (ASM_SIMP_TAC[]); + (STRIP_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y = 1`); + (ASM_SIMP_TAC[]); + (STRIP_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (NEW_GOAL `1 < y`); + (ASM_ARITH_TAC); + (STRIP_TAC); + (NEW_GOAL `(p:num->num) y = y`); + (UNDISCH_TAC `1 < y` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (STRIP_TAC THEN ASM_REWRITE_TAC[BETA_THM]); + (ASM_MESON_TAC[]); + (STRIP_TAC); + (MATCH_MP_TAC Hypermap.lemma_permutes_via_surjetive); + (REWRITE_WITH `0..1 = {0,1}`); + (REWRITE_TAC[GSYM NUMSEG_LE; ARITH_RULE `x <= 1 <=> x = 0 \/ x = 1`]); + (SET_TAC[]); + (REWRITE_TAC[Geomdetail.FINITE6; SET_RULE `a IN {x,y} <=> a = x \/ a = y`]); + (ASM_MESON_TAC[]); + + (ASM_REWRITE_TAC[left_action_list;LENGTH; ARITH_RULE + `SUC (SUC (SUC (SUC 0))) = 4`]); + (ASM_REWRITE_TAC[TABLE_4]); + (ASM_SIMP_TAC[TABLE_4; EL;HD;TL; ARITH_RULE `1 < 2 /\ 1 < 3`]); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `1 = SUC 0 /\ 2 = SUC 1 /\ 3 = SUC 2`])]);; + + +let SET_SUBSET_AFFINE_HULL = prove ( + `!S:real^3->bool. S SUBSET affine hull S`, + STRIP_TAC THEN + MATCH_MP_TAC (SET_RULE `(?C. A SUBSET C /\ C SUBSET B) ==> A SUBSET B`) THEN + EXISTS_TAC `convex hull S:real^3->bool` THEN + REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL; SUBSET] THEN + REWRITE_TAC[IN_SET_IMP_IN_CONVEX_HULL_SET]);; + +(* ========================================================================= *) + +let QZKSYKG1_concl = + `!V ul vl k p. + saturated V /\ + packing V /\ + barV V 3 ul /\ + k IN {0,1,2,3,4} /\ + ~ (mcell k V ul = {}) /\ + p permutes 0..(k - 1) /\ + vl = left_action_list p ul + ==> barV V 3 vl`;; + +let QZKSYKG2_concl = + `!V ul k. + saturated V /\ + packing V /\ + barV V 3 ul /\ + k IN {0,1,2,3,4} + ==> (mcell k V ul SUBSET + UNIONS{rogers V (left_action_list p ul) | p permutes 0..(k-1)})`;; + +(* ========================================================================= *) + +let QZKSYKG1 = prove_by_refinement (QZKSYKG1_concl, +[(REPEAT STRIP_TAC); + (ASM_CASES_TAC `k = 0 \/ k = 1`); + (UNDISCH_TAC `p permutes 0..(k-1)`); + (REWRITE_WITH `k - 1 = 0`); + (ASM_ARITH_TAC); + (REWRITE_TAC[Packing3.PERMUTES_TRIVIAL]); + (STRIP_TAC); + (ASM_REWRITE_TAC[Packing3.LEFT_ACTION_LIST_I]); + (NEW_GOAL `k IN {2,3,4}`); + (ASM_SET_TAC[]); + +(* Cases k = 4 *) + + (ASM_CASES_TAC `k = 4`); + (UNDISCH_TAC `~(mcell k V ul = {})`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`;mcell4]); + (COND_CASES_TAC); + (STRIP_TAC); + (REWRITE_TAC[MESON[IN] `barV V 3 s <=> s IN barV V 3`]); + (MATCH_MP_TAC Rogers.YIFVQDV_1); + (ASM_REWRITE_TAC[IN]); + (REWRITE_WITH `3 = k - 1`); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (MESON_TAC[]); + +(* Cases k = 3, k = 2 *) + + (REWRITE_WITH + `barV V 3 vl /\ + (!j. k - 1 <= j /\ j <= 3 + ==> omega_list_n V vl j = omega_list_n V ul j)`); + (MATCH_MP_TAC YNHYJIT); + (EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `~(mcell k V ul = {})`); + + (ASM_CASES_TAC `k = 3`); + (SIMP_TAC [ASSUME `k = 3`; MCELL_EXPLICIT; mcell3]); + (COND_CASES_TAC); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`]); + (ASM_REWRITE_TAC[]); + (MESON_TAC[]); + + (NEW_GOAL `k = 2`); + (ASM_SET_TAC[]); + (SIMP_TAC [ASSUME `k = 2`; MCELL_EXPLICIT; mcell2]); + (COND_CASES_TAC); + (LET_TAC); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `2 - 1 = 1`]); + (ASM_REWRITE_TAC[]); + (MESON_TAC[])]);; + +(* ========================================================================= *) + + +let QZKSYKG2 = prove_by_refinement ( QZKSYKG2_concl, + +[(REPEAT STRIP_TAC); + (ASM_CASES_TAC `k = 0 \/ k = 1`); + (REWRITE_WITH `k - 1 = 0`); + (ASM_ARITH_TAC); + (REWRITE_TAC[Packing3.PERMUTES_TRIVIAL]); + (REWRITE_TAC[Packing3.SING_GSPEC_APP; UNIONS_1; + Packing3.LEFT_ACTION_LIST_I]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell0]); + (SET_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell1]); + (COND_CASES_TAC); + (SET_TAC[]); + (SET_TAC[]); + +(* ======================================================================== *) + + (ASM_CASES_TAC `k = 4`); + (REWRITE_WITH `k - 1 = 3`); + (ASM_ARITH_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4]); + (COND_CASES_TAC); + (REWRITE_WITH `convex hull set_of_list ul = + UNIONS {rogers V (left_action_list p ul) | p permutes 0..3}`); + (MATCH_MP_TAC Rogers.WQPRRDY); + (ASM_REWRITE_TAC[IN]); + (SET_TAC[]); + (SET_TAC[]); + +(* ======================================================================== *) + + (ASM_CASES_TAC `k = 3`); + (REWRITE_WITH `k - 1 = 2`); + (ASM_ARITH_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell3]); + (COND_CASES_TAC); + + (ABBREV_TAC `m = mxi V ul`); + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT THEN EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2;set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + + (REWRITE_TAC[SUBSET]); + (GEN_TAC THEN DISCH_TAC); + (NEW_GOAL `(?x1 t1 t2. + x1 IN convex hull {u0, u1, u2:real^3} /\ + &0 <= t1 /\ + &0 <= t2 /\ + t1 + t2 = &1 /\ + x = t1 % x1 + t2 % m)`); + (ASM_SIMP_TAC[CONVEX_HULL_4_IMP_3_1]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[ASSUME `x:real^3 = t1 % x1 + t2 % m`]); + + (UNDISCH_TAC `x1 IN convex hull {u0, u1, u2:real^3}`); + (REWRITE_WITH `convex hull {u0,u1,u2:real^3} = + UNIONS {rogers V (left_action_list p (truncate_simplex 2 ul)) | p permutes 0..2}`); + (REWRITE_WITH `{u0,u1,u2:real^3} = set_of_list (truncate_simplex 2 ul)`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2;set_of_list]); + (MATCH_MP_TAC Rogers.WQPRRDY); + (ASM_REWRITE_TAC[IN]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[IN_UNIONS]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `?p:num->num. p permutes 0..2 /\ t = rogers V (left_action_list p (truncate_simplex 2 ul))`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `zl:(real^3)list = left_action_list p (truncate_simplex 2 ul)`); + (EXISTS_TAC `rogers V (left_action_list p ul)`); + (STRIP_TAC); + (ASM_SET_TAC[]); + (ABBREV_TAC `vl:(real^3)list = left_action_list p ul`); + (NEW_GOAL + `rogers V vl = + convex hull + {HD vl, omega_list_n V vl 1, omega_list_n V vl 2, omega_list_n V vl 3}`); + (MATCH_MP_TAC ROGERS_EXPLICIT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[MESON[IN] `barV V 3 vl <=> vl IN barV V 3`]); + (REWRITE_WITH `vl IN barV V 3 /\ + omega_list_n V vl 2 = omega_list_n V ul 2 /\ + omega_list_n V vl 3 = omega_list_n V ul 3 /\ + mxi V vl = mxi V ul`); + (MATCH_MP_TAC LEFT_ACTION_LIST_PROPERTIES); + (EXISTS_TAC `p:num->num` THEN ASM_REWRITE_TAC[]); + + (NEW_GOAL `zl = truncate_simplex 2 (vl:(real^3)list)`); + (EXPAND_TAC "zl" THEN EXPAND_TAC "vl"); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; LENGTH; + ARITH_RULE `SUC (SUC (SUC 0)) = 3`; TABLE_4; ARITH_RULE `SUC 3 = 4`; + ASSUME `ul = [u0;u1;u2;u3:real^3]`; left_action_list]); + + (REWRITE_WITH `EL (inverse p 0) [u0; u1; u2:real^3] = + EL (inverse p 0) [u0; u1; u2; u3] /\ + EL (inverse p 1) [u0; u1; u2:real^3] = + EL (inverse p 1) [u0; u1; u2; u3] /\ + EL (inverse p 2) [u0; u1; u2:real^3] = + EL (inverse p 2) [u0; u1; u2; u3]`); + (REWRITE_WITH `[u0; u1; u2:real^3] = truncate_simplex 2 [u0; u1; u2; u3]`); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + + (NEW_GOAL `!i. i IN 0..2 ==> inverse p i IN 0..2`); + (REPEAT STRIP_TAC); + (ABBREV_TAC `y = inverse (p:num->num) i`); + (ASM_CASES_TAC `y IN 0..2`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (MP_TAC (ASSUME `p permutes 0..2`) THEN REWRITE_TAC[permutes; EXISTS_UNIQUE]); + (STRIP_TAC); + (NEW_GOAL `(p:num->num) y = y`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "y"); + (REWRITE_WITH `(p:num->num) (inverse p i) = i`); + (MESON_TAC[PERMUTES_INVERSES; ASSUME `p permutes 0..2`]); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (REPEAT STRIP_TAC); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_TAC[LENGTH; ARITH_RULE `2 + 1 <= SUC(SUC(SUC(SUC 0)))`]); + (NEW_GOAL `inverse p 0 IN 0..2`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN_NUMSEG_0] THEN ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[IN_NUMSEG_0]); + + + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_TAC[LENGTH; ARITH_RULE `2 + 1 <= SUC(SUC(SUC(SUC 0)))`]); + (NEW_GOAL `inverse p 1 IN 0..2`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN_NUMSEG_0] THEN ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[IN_NUMSEG_0]); + + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_TAC[LENGTH; ARITH_RULE `2 + 1 <= SUC(SUC(SUC(SUC 0)))`]); + (NEW_GOAL `inverse p 2 IN 0..2`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN_NUMSEG_0] THEN ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[IN_NUMSEG_0]); + + (NEW_GOAL `rogers V zl = + convex hull {HD zl, omega_list_n V zl 1, omega_list_n V zl 2}`); + (MATCH_MP_TAC ROGERS_EXPLICIT_2); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (REWRITE_TAC[MESON[IN] `barV V 3 vl <=> vl IN barV V 3`]); + (REWRITE_WITH `vl IN barV V 3 /\ + omega_list_n V vl 2 = omega_list_n V ul 2 /\ + omega_list_n V vl 3 = omega_list_n V ul 3 /\ + mxi V vl = mxi V ul`); + (MATCH_MP_TAC LEFT_ACTION_LIST_PROPERTIES); + (EXISTS_TAC `p:num->num` THEN ASM_REWRITE_TAC[]); + + +(* ------------------------------ *) + (NEW_GOAL + `x1 IN convex hull {HD zl, omega_list_n V zl 1, omega_list_n V zl 2}`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[CONVEX_HULL_3;IN;IN_ELIM_THM]); + (STRIP_TAC); + (ABBREV_TAC `q1 = omega_list_n V zl 1`); + (ABBREV_TAC `q2 = omega_list_n V zl 2`); + (ABBREV_TAC `s3 = omega_list_n V ul 3`); + (ABBREV_TAC `q0 = HD (zl:(real^3)list)`); + + (NEW_GOAL `vl IN barV V 3 /\ + omega_list_n V vl 2 = omega_list_n V ul 2 /\ + omega_list_n V vl 3 = omega_list_n V ul 3 /\ + mxi V vl = mxi V ul`); + (MATCH_MP_TAC LEFT_ACTION_LIST_PROPERTIES); + (EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN] THEN STRIP_TAC); + (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `HD vl = q0:real^3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (EXPAND_TAC "q0" THEN + REWRITE_TAC[ASSUME `zl:(real^3)list = truncate_simplex 2 vl`]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `omega_list_n V vl 1 = q1`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (EXPAND_TAC "q1" THEN + REWRITE_TAC[ASSUME `zl:(real^3)list = truncate_simplex 2 vl`]); + (REWRITE_TAC[ARITH_RULE `2 = 1 + 1`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `omega_list_n V vl 2 = q2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (EXPAND_TAC "q2" THEN + REWRITE_TAC[ASSUME `zl:(real^3)list = truncate_simplex 2 vl`]); + (REWRITE_WITH `truncate_simplex 2 (vl:(real^3)list) = + truncate_simplex (2 + 0) vl`); + (REWRITE_TAC[ARITH_RULE `2 + 0 = 2`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (UNDISCH_TAC `omega_list_n V vl 2 = omega_list_n V ul 2` THEN + ASM_REWRITE_TAC[]); + (DISCH_TAC); + (NEW_GOAL `between m (q2, s3:real^3)`); + (NEW_GOAL `?s. between s (omega_list_n V ul 2,omega_list_n V ul 3) /\ + dist (u0,s) = sqrt (&2) /\ + mxi V ul = s`); + (MATCH_MP_TAC MXI_EXPLICIT); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;IN;IN_ELIM_THM; + CONVEX_HULL_2; CONVEX_HULL_4]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `t1 * u` THEN EXISTS_TAC `t1 * v`); + (EXISTS_TAC `t1 * w + t2 * u'` THEN EXISTS_TAC `t2 * v'`); + (ASM_SIMP_TAC[REAL_LE_MUL; REAL_LE_ADD]); + (STRIP_TAC); + (REWRITE_WITH + `t1 * u + t1 * v + (t1 * w + t2 * u') + t2 * v' = + t1 * (u + v + w) + t2 * (u' + v')`); + (REAL_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + +(* ========================================================================= *) + + (NEW_GOAL `k = 2`); + (ASM_SET_TAC[]); + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT THEN EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (SIMP_TAC[ASSUME `k = 2`; MCELL_EXPLICIT; mcell2]); + (COND_CASES_TAC); + (LET_TAC); + + (ABBREV_TAC `m = mxi V ul`); + (ABBREV_TAC `s2 = omega_list_n V ul 2`); + (ABBREV_TAC `s3 = omega_list_n V ul 3`); + (ASM_REWRITE_TAC[HD;TL; ARITH_RULE `2 - 1 = 1`]); + (MATCH_MP_TAC (SET_RULE `(?C. C SUBSET B /\ A SUBSET C) ==> A SUBSET B`)); + (EXISTS_TAC `convex hull {u0, u1, s2, s3:real^3}`); + (REPEAT STRIP_TAC); (* Two subgoals *) + +(* ------------------------------------------------------ *) + + (MATCH_MP_TAC (SET_RULE `(?C. C SUBSET B /\ A SUBSET C) ==> A SUBSET B`)); + (EXISTS_TAC `rogers V ul UNION rogers V [u1;u0;u2;u3:real^3]`); + (STRIP_TAC); + (REWRITE_TAC[SUBSET; IN_UNIONS; IN_UNION]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[IN;IN_ELIM_THM]); + (EXISTS_TAC `rogers V ul`); + (STRIP_TAC); + (EXISTS_TAC `I:num->num`); + (ASM_REWRITE_TAC[PERMUTES_I; Packing3.LEFT_ACTION_LIST_I]); + (UP_ASM_TAC THEN REWRITE_TAC[IN]); + + (REWRITE_TAC[IN;IN_ELIM_THM]); + (EXISTS_TAC `rogers V [u1;u0;u2;u3]`); + (STRIP_TAC); + (NEW_GOAL `?p. p permutes 0..1 /\ [u1;u0;u2;u3:real^3] = left_action_list p ul`); + (MATCH_MP_TAC TWO_REARRANGEMENT_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN]); + (NEW_GOAL `?p. p permutes 0..1 /\ [u1;u0;u2;u3:real^3] = left_action_list p ul`); + (MATCH_MP_TAC TWO_REARRANGEMENT_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + + (ABBREV_TAC `vl = [u1;u0;u2;u3:real^3]`); + (NEW_GOAL `barV V 3 vl /\ + (!j. 1 <= j /\ j <= 3 + ==> omega_list_n V vl j = omega_list_n V ul j)`); + (ONCE_REWRITE_TAC[ARITH_RULE `1 = 2 - 1`]); + (MATCH_MP_TAC YNHYJIT); + (EXISTS_TAC `p:num->num` THEN REWRITE_TAC[ARITH_RULE `2 - 1 = 1`]); + (ASM_REWRITE_TAC[SET_RULE `2 IN {2,3,4}`]); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `s1 = omega_list_n V ul 1`); + (NEW_GOAL `rogers V ul = convex hull {HD ul, s1, s2, s3}`); + (EXPAND_TAC "s1" THEN EXPAND_TAC "s2" THEN EXPAND_TAC "s3"); + (MATCH_MP_TAC ROGERS_EXPLICIT); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `rogers V vl = convex hull {HD vl, omega_list_n V vl 1, + omega_list_n V vl 2, omega_list_n V vl 3}`); + (MATCH_MP_TAC ROGERS_EXPLICIT); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `omega_list_n V vl 1 = s1`); + (EXPAND_TAC "s1" THEN FIRST_ASSUM MATCH_MP_TAC THEN ARITH_TAC); + (NEW_GOAL `omega_list_n V vl 2 = s2`); + (EXPAND_TAC "s2" THEN FIRST_ASSUM MATCH_MP_TAC THEN ARITH_TAC); + (NEW_GOAL `omega_list_n V vl 3 = s3`); + (EXPAND_TAC "s3" THEN FIRST_ASSUM MATCH_MP_TAC THEN ARITH_TAC); + + (ASM_REWRITE_TAC[HD]); + (REWRITE_TAC[GSYM (ASSUME `vl = left_action_list p (ul:(real^3)list)`); + GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (EXPAND_TAC "vl" THEN REWRITE_TAC[HD]); + + (NEW_GOAL `s1 = circumcenter {u1, u0:real^3}`); + (EXPAND_TAC "s1" THEN MATCH_MP_TAC Marchal_cells_2_new.OMEGA_LIST_1_EXPLICIT_NEW); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3` THEN REWRITE_TAC[IN]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `hl [u1;u0:real^3] = + hl (truncate_simplex 1 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; HL]); + (REWRITE_TAC[set_of_list; SET_RULE `{a,b} = {b,a}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[CIRCUMCENTER_2;midpoint] THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[SUBSET; CONVEX_HULL_4; IN; IN_ELIM_THM; IN_UNION]); + (REPEAT STRIP_TAC); + + (ASM_CASES_TAC `u <= v:real`); + (DISJ2_TAC); + (EXISTS_TAC `v - u:real` THEN EXISTS_TAC `&2 * u`); + (EXISTS_TAC `w:real` THEN EXISTS_TAC `z:real`); + (ASM_SIMP_TAC[REAL_ARITH `v - u + &2 * u + w + z = u + v + w + z`; REAL_LE_MUL; REAL_ARITH `&0 <= &2`; REAL_ARITH `&0 <= a - b <=> b <= a`]); + (VECTOR_ARITH_TAC); + (NEW_GOAL `v <= u:real`); + (ASM_REAL_ARITH_TAC); + (DISJ1_TAC); + (EXISTS_TAC `u - v:real` THEN EXISTS_TAC `&2 * v`); + (EXISTS_TAC `w:real` THEN EXISTS_TAC `z:real`); + (ASM_SIMP_TAC[REAL_ARITH `u - v + &2 * v + w + z = u + v + w + z`; + REAL_LE_MUL; REAL_ARITH `&0 <= &2`; REAL_ARITH `&0 <= a - b <=> b <= a`]); + (VECTOR_ARITH_TAC); + +(* ------------------------------------------------------ *) + + (REWRITE_TAC[SUBSET; IN_INTER]); + (REPEAT STRIP_TAC); + (ABBREV_TAC `s1 = omega_list_n V ul 1`); + + (NEW_GOAL `s1 = circumcenter {u0, u1:real^3}`); + (EXPAND_TAC "s1" THEN MATCH_MP_TAC Marchal_cells_2_new.OMEGA_LIST_1_EXPLICIT_NEW); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3` THEN REWRITE_TAC[IN]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `hl [u0;u1:real^3] = + hl (truncate_simplex 1 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; HL;set_of_list]); + (ASM_REWRITE_TAC[]); + + (ABBREV_TAC `vl:(real^3)list = truncate_simplex 1 ul`); + + (NEW_GOAL `s1:real^3 IN voronoi_list V vl`); + (EXPAND_TAC "vl" THEN EXPAND_TAC "s1"); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (NEW_GOAL `s2:real^3 IN voronoi_list V vl`); + (EXPAND_TAC "vl" THEN EXPAND_TAC "s2"); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (NEW_GOAL `s3:real^3 IN voronoi_list V vl`); + (EXPAND_TAC "vl" THEN EXPAND_TAC "s3"); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + + (NEW_GOAL `m IN voronoi_list V vl`); + (ASM_CASES_TAC `hl (truncate_simplex 2 (ul:(real^3)list)) >= sqrt (&2)`); + (REWRITE_WITH `m = s2:real^3`); + (EXPAND_TAC "m" THEN REWRITE_TAC[mxi]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(?s. between s (omega_list_n V ul 2,omega_list_n V ul 3) /\ + dist (u0,s) = sqrt (&2) /\ + mxi V ul = s)`); + (MATCH_MP_TAC MXI_EXPLICIT); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `(?C. x IN C /\ C SUBSET B) ==> x IN B`)); + (EXISTS_TAC `convex hull {s2, s3:real^3}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL]); + (REWRITE_WITH `convex hull {s2, s3:real^3} SUBSET voronoi_list V vl <=> + convex hull {s2, s3} SUBSET (convex hull (voronoi_list V vl))`); + (REWRITE_WITH `convex hull (voronoi_list V vl) = voronoi_list V vl`); + (REWRITE_TAC[CONVEX_HULL_EQ]); + (REWRITE_TAC[Packing3.CONVEX_VORONOI_LIST]); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (ASM_SET_TAC[]); + + (NEW_GOAL `~(u0 = u1:real^3)`); + (STRIP_TAC); + (NEW_GOAL `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list; + SET_RULE `{u1, u1, u2, u3} = {u1,u2,u3}`]); + (NEW_GOAL `CARD {u1,u2,u3:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + + (UNDISCH_TAC `x IN aff_ge {u0, u1} {m, s3:real^3}`); + (REWRITE_WITH `aff_ge {u0, u1} {m, s3:real^3} = + {y | ?t1 t2 t3 t4. + &0 <= t3 /\ + &0 <= t4 /\ + t1 + t2 + t3 + t4 = &1 /\ + y = t1 % u0 + t2 % u1 + t3 % m + t4 % s3}`); + (MATCH_MP_TAC AFF_GE_2_2); + + (NEW_GOAL `~(m IN {u0, u1:real^3})`); + (STRIP_TAC); + + (ASM_CASES_TAC `m = u0:real^3`); + (UNDISCH_TAC `m IN voronoi_list V vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1;set_of_list; + ASSUME `ul = [u0;u1;u2;u3:real^3]`; VORONOI_LIST; VORONOI_SET]); + (STRIP_TAC); + (NEW_GOAL `m:real^3 IN voronoi_closed V u1`); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0, u1:real^3) <= dist (u0, u0)`); + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `{u0, u1, u2, u3:real^3} SUBSET V`); + (REWRITE_WITH `{u0, u1, u2, u3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[MESON[IN] `V u0 <=> u0 IN V`]); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL]); + (STRIP_TAC); + (NEW_GOAL `dist (u0, u1:real^3) = &0`); + (NEW_GOAL `&0 <= dist (u0, u1:real^3)`); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_EQ_0]); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `m = u1:real^3`); + (UNDISCH_TAC `m IN voronoi_list V vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1;set_of_list; + ASSUME `ul = [u0;u1;u2;u3:real^3]`; VORONOI_LIST; VORONOI_SET]); + (STRIP_TAC); + (NEW_GOAL `m:real^3 IN voronoi_closed V u0`); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u1, u0:real^3) <= dist (u1, u1)`); + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `{u0, u1, u2, u3:real^3} SUBSET V`); + (REWRITE_WITH `{u0, u1, u2, u3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[MESON[IN] `V u0 <=> u0 IN V`]); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL]); + (STRIP_TAC); + (NEW_GOAL `dist (u1, u0:real^3) = &0`); + (NEW_GOAL `&0 <= dist (u1, u0:real^3)`); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_EQ_0]); + (ASM_MESON_TAC[]); + (ASM_SET_TAC[]); + + + (NEW_GOAL `~(s3 IN {u0, u1:real^3})`); + (STRIP_TAC); + + (ASM_CASES_TAC `s3 = u0:real^3`); + (UNDISCH_TAC `s3 IN voronoi_list V vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1;set_of_list; + ASSUME `ul = [u0;u1;u2;u3:real^3]`; VORONOI_LIST; VORONOI_SET]); + (STRIP_TAC); + (NEW_GOAL `s3:real^3 IN voronoi_closed V u1`); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0, u1:real^3) <= dist (u0, u0)`); + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `{u0, u1, u2, u3:real^3} SUBSET V`); + (REWRITE_WITH `{u0, u1, u2, u3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[MESON[IN] `V u0 <=> u0 IN V`]); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL]); + (STRIP_TAC); + (NEW_GOAL `dist (u0, u1:real^3) = &0`); + (NEW_GOAL `&0 <= dist (u0, u1:real^3)`); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_EQ_0]); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `s3 = u1:real^3`); + (UNDISCH_TAC `s3 IN voronoi_list V vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1;set_of_list; + ASSUME `ul = [u0;u1;u2;u3:real^3]`; VORONOI_LIST; VORONOI_SET]); + (STRIP_TAC); + (NEW_GOAL `s3:real^3 IN voronoi_closed V u0`); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u1, u0:real^3) <= dist (u1, u1)`); + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `{u0, u1, u2, u3:real^3} SUBSET V`); + (REWRITE_WITH `{u0, u1, u2, u3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[MESON[IN] `V u0 <=> u0 IN V`]); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL]); + (STRIP_TAC); + (NEW_GOAL `dist (u1, u0:real^3) = &0`); + (NEW_GOAL `&0 <= dist (u1, u0:real^3)`); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_EQ_0]); + (ASM_MESON_TAC[]); + (ASM_SET_TAC[]); + + (REWRITE_TAC[DISJOINT]); + (ASM_SET_TAC[]); + +(* ======================================================================== *) +(* OK here *) + + (REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `&0 <= t1 /\ &0 <= t2`); + + (ASM_CASES_TAC `&0 < t3 + t4`); + (ABBREV_TAC `t5 = t3 + t4:real`); + (ABBREV_TAC `z = t3 / t5 % m + t4 / t5 % (s3:real^3)`); + (NEW_GOAL `between z (m, s3:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM]); + (EXISTS_TAC `t3 / t5` THEN EXISTS_TAC `t4 / t5`); + (ASM_SIMP_TAC[REAL_LE_DIV; REAL_ARITH `&0 < a ==> &0 <= a`]); + (ASM_REWRITE_TAC[REAL_ARITH `a/b+c/b = (a+c)/b`]); + (MATCH_MP_TAC REAL_DIV_REFL THEN ASM_REAL_ARITH_TAC); + + (NEW_GOAL `z IN voronoi_list V vl`); + (MATCH_MP_TAC (SET_RULE `(?C. x IN C /\ C SUBSET B) ==> x IN B`)); + (EXISTS_TAC `convex hull {m, s3:real^3}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL]); + (REWRITE_WITH `convex hull {m, s3:real^3} SUBSET voronoi_list V vl <=> + convex hull {m, s3} SUBSET (convex hull (voronoi_list V vl))`); + (REWRITE_WITH `convex hull (voronoi_list V vl) = voronoi_list V vl`); + (REWRITE_TAC[CONVEX_HULL_EQ]); + (REWRITE_TAC[Packing3.CONVEX_VORONOI_LIST]); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (ASM_SET_TAC[]); + +(* ------------------------------------------------------------------------ *) + + (ASM_CASES_TAC `t1 < &0`); + (NEW_GOAL `F`); + (UNDISCH_TAC `x:real^3 IN rcone_ge u1 u0 a`); + (REWRITE_TAC[rcone_ge;rconesgn; IN; IN_ELIM_THM]); + (REWRITE_TAC[REAL_ARITH `~(a >= b) <=> a < b`]); + (NEW_GOAL `x = t1 % u0 + t2 % u1 + t5 % (z:real^3)`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "z" THEN EXPAND_TAC "t5"); + (REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC]); + (REWRITE_TAC[REAL_ARITH `a * b / a = b * (a / a)`]); + (ASM_SIMP_TAC[REAL_DIV_REFL; REAL_ARITH `&0 < y ==> ~(y = &0)`; + REAL_MUL_RID]); + (REWRITE_TAC[dist]); + (REWRITE_WITH `x - u1:real^3 = t1 % (u0 - u1) + t5 % (z - u1)`); + (REWRITE_WITH `x - u1:real^3 = x - (t1 + t2 + t5) % u1`); + (REWRITE_WITH `t1 + t2 + t5 = &1`); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[ASSUME `x = t1 % u0 + t2 % u1 + t5 % z:real^3`]); + (VECTOR_ARITH_TAC); + + (REWRITE_TAC[DOT_LADD; DOT_LMUL; GSYM NORM_POW_2]); + (NEW_GOAL `(z - u1) dot (u0 - u1:real^3) <= + norm (z - u1:real^3) * norm (u0 - u1) * a`); + + (ASM_CASES_TAC `hl (truncate_simplex 2 (ul:(real^3)list)) >= sqrt (&2)`); + (NEW_GOAL `m = s2:real^3`); + (EXPAND_TAC "m" THEN REWRITE_TAC[mxi] THEN COND_CASES_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `u0 - u1 = &2 % (u0 - s1:real^3)`); + (REWRITE_TAC[ASSUME `s1 = circumcenter {u0, u1:real^3}`; CIRCUMCENTER_2; + midpoint; VECTOR_ARITH `u0 - inv (&2) % (u0 + u1) = inv (&2) % (u0 - u1)`]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `(z - s1) dot (u0 - s1:real^3) = &0`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `{u0,u1:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1; + ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (MATCH_MP_TAC (SET_RULE `(?C. a IN C/\ C SUBSET B) ==> a IN B`)); + (EXISTS_TAC `voronoi_list V vl`); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC (SET_RULE `(?C. a IN C/\ C SUBSET B) ==> a IN B`)); + (EXISTS_TAC `set_of_list (vl:(real^3)list)`); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1; + ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (SET_TAC[]); + + (NEW_GOAL `norm (s2 - u1) <= norm (z - u1:real^3)`); + (REWRITE_WITH `norm (s2 - u1) <= norm (z - u1:real^3) <=> + norm (s2 - u1) pow 2 <= norm (z - u1:real^3) pow 2`); + (ASM_SIMP_TAC[Collect_geom.POW2_COND; NORM_POS_LE]); + (REWRITE_WITH `s2 - u1 = (s2 - s1) + (s1 - u1:real^3) /\ + z - u1 = (z - s1) + (s1 - u1:real^3)`); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `norm (s2 - s1 + s1 - u1) pow 2 = + norm (s2 - s1) pow 2 + norm (s1 - u1:real^3) pow 2`); + (NEW_GOAL `(s2 - s1) dot (s1 - u1:real^3) = &0`); + (REWRITE_WITH `s1 - u1 = u0 - s1:real^3`); + (ASM_REWRITE_TAC[CIRCUMCENTER_2; midpoint] THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `{u0,u1:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1; + ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (MATCH_MP_TAC (SET_RULE `(?C. a IN C/\ C SUBSET B) ==> a IN B`)); + (EXISTS_TAC `voronoi_list V vl`); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC (SET_RULE `(?C. a IN C/\ C SUBSET B) ==> a IN B`)); + (EXISTS_TAC `set_of_list (vl:(real^3)list)`); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1; + ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (SET_TAC[]); + (ASM_SIMP_TAC[Trigonometry2.PITHAGO_THEOREM]); + + (REWRITE_WITH `norm (z - s1 + s1 - u1:real^3) pow 2 = + norm (z - s1) pow 2 + norm (s1 - u1) pow 2`); + (NEW_GOAL `(z - s1) dot (s1 - u1:real^3) = &0`); + (REWRITE_WITH `s1 - u1 = u0 - s1:real^3`); + (ASM_REWRITE_TAC[CIRCUMCENTER_2; midpoint] THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[Trigonometry2.PITHAGO_THEOREM]); + (REWRITE_TAC[REAL_ARITH `a + b <= c + b <=> a <= c`]); + (REWRITE_TAC[GSYM (ASSUME `omega_list_n V ul 2 = s2`)] THEN + REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `2 = SUC 1`]); + (REWRITE_TAC[ARITH_RULE `SUC 1 = 2`]); + (REWRITE_TAC[GSYM dist; DIST_SYM]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `!a b c d:real^3. + dist (a, b:real^3) pow 2 <= dist (c,d) pow 2 <=> dist (a,b) <= dist (c,d)`); + (REPEAT STRIP_TAC THEN ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (SIMP_TAC[Collect_geom.POW2_COND; DIST_POS_LE]); + (MATCH_MP_TAC CLOSEST_POINT_LE); + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (ABBREV_TAC `zl:(real^3)list = truncate_simplex 2 ul`); + + (NEW_GOAL `s2:real^3 IN voronoi_list V zl`); + (EXPAND_TAC "zl" THEN REWRITE_TAC[GSYM (ASSUME `omega_list_n V ul 2 = s2`)]); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (NEW_GOAL `s3:real^3 IN voronoi_list V zl`); + (EXPAND_TAC "zl" THEN EXPAND_TAC "s3"); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (MATCH_MP_TAC (SET_RULE `(?C. x IN C /\ C SUBSET B) ==> x IN B`)); + (EXISTS_TAC `convex hull {s2, s3:real^3}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL]); + (ASM_MESON_TAC[]); + (REWRITE_WITH `convex hull {s2, s3:real^3} SUBSET voronoi_list V zl <=> + convex hull {s2, s3} SUBSET (convex hull (voronoi_list V zl))`); + (REWRITE_WITH `convex hull (voronoi_list V zl) = voronoi_list V zl`); + (REWRITE_TAC[CONVEX_HULL_EQ]); + (REWRITE_TAC[Packing3.CONVEX_VORONOI_LIST]); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (ASM_SET_TAC[]); + + (REWRITE_WITH `(z - u1) dot (u0 - u1:real^3) = &2 * norm (u0 - s1) pow 2`); + (REWRITE_WITH `(z - u1) dot (u0 - u1) = (z - s1) dot (u0 - u1) + + (s1 - u1) dot (u0 - u1:real^3)`); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[ASSUME `u0 - u1 = &2 % (u0 - s1:real^3)`; DOT_RMUL]); + (REWRITE_WITH `(s1 - u1) = (u0 - s1:real^3)`); + (ASM_REWRITE_TAC[CIRCUMCENTER_2;midpoint] THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[NORM_POW_2] THEN REAL_ARITH_TAC); + + + (NEW_GOAL `&2 * norm (u0 - s1:real^3) pow 2 <= + norm (s2 - u1) * norm (u0 - u1) * a`); + (NEW_GOAL `norm (s2 - u1:real^3) >= sqrt (&2)`); + (NEW_GOAL `norm (s2 - u1:real^3) >= + hl (truncate_simplex 2 (ul:(real^3)list))`); + (REWRITE_TAC[GSYM dist]); + (NEW_GOAL `?p. p permutes 0..1 /\ + [u1; u0; u2; u3:real^3] = left_action_list p ul`); + (MATCH_MP_TAC TWO_REARRANGEMENT_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `ul' = [u1;u0;u2;u3:real^3]`); + (NEW_GOAL `barV V 3 ul' /\ + (!j. 1 <= j /\ j <= 3 + ==> omega_list_n V ul' j = omega_list_n V ul j)`); + (ONCE_REWRITE_TAC[ARITH_RULE `1 = 2 - 1`]); + (MATCH_MP_TAC YNHYJIT); + (EXISTS_TAC `p:num->num` THEN REWRITE_TAC[ARITH_RULE `2 - 1 = 1`; + SET_RULE `2 IN {2,3,4}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `s2 = omega_list_n V ul' 2 /\ u1 = HD ul'`); + (STRIP_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[GSYM (ASSUME `omega_list_n V ul 2 = s2`)] ); + (FIRST_ASSUM MATCH_MP_TAC THEN ARITH_TAC); + (REWRITE_TAC[GSYM (ASSUME `[u1; u0; u2; u3:real^3] = ul'`); HD] ); + (REWRITE_TAC[REAL_ARITH `a >= b <=> b <= a`]); + (ABBREV_TAC `xl:(real^3)list = truncate_simplex 2 ul'`); + (REWRITE_WITH `hl (truncate_simplex 2 (ul:(real^3)list)) = + hl (xl:(real^3)list)`); + (EXPAND_TAC "xl"); + (REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; + GSYM (ASSUME `[u1;u0;u2;u3:real^3] = ul'`); TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_TAC[HL; set_of_list; SET_RULE `{u0, u1, u2} = {u1,u0,u2}`]); + (REWRITE_WITH `omega_list_n V ul' 2 = omega_list V xl`); + (REWRITE_WITH `omega_list V xl = omega_list_n V xl 2`); + (REWRITE_TAC[OMEGA_LIST]); + (EXPAND_TAC "xl" THEN REWRITE_TAC[GSYM + (ASSUME `[u1; u0; u2; u3:real^3] = ul'`); TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_TAC[LENGTH; ARITH_RULE `(SUC (SUC (SUC 0)) - 1) = 2`]); + (EXPAND_TAC "xl"); + (REWRITE_WITH + `truncate_simplex 2 (ul':(real^3)list) = truncate_simplex (2 + 0) ul'`); + (REWRITE_TAC[ARITH_RULE `2 + 0 = 2`]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (REWRITE_TAC[GSYM (ASSUME `[u1; u0; u2; u3:real^3] = ul'`); LENGTH]); + (ARITH_TAC); + (REWRITE_WITH `HD ul' = HD (xl:(real^3)list)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN EXPAND_TAC "xl"); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_TAC[GSYM (ASSUME `[u1; u0; u2; u3:real^3] = ul'`); LENGTH]); + (ARITH_TAC); + (MATCH_MP_TAC Rogers.WAUFCHE1); + (EXISTS_TAC `2`); + (REWRITE_TAC[IN] THEN EXPAND_TAC "xl"); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (EXPAND_TAC "a"); + (REWRITE_WITH `hl (vl:(real^3)list) = dist (s1, u0:real^3)`); + (REWRITE_WITH `s1:real^3 = circumcenter (set_of_list vl)`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `u0:real^3 = HD vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list; HD]); + (MATCH_MP_TAC Rogers.HL_EQ_DIST0); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist]); + (REWRITE_TAC[ASSUME `u0 - u1 = &2 % (u0 - s1:real^3)`; NORM_MUL]); + (REWRITE_WITH `abs (&2) = &2`); + (REWRITE_TAC[REAL_ABS_REFL; REAL_ARITH `&0 <= &2`]); + (REWRITE_TAC[REAL_ARITH `a * (&2 * b) * b / c = (&2 * b pow 2) * ( a / c)`]); + (REWRITE_TAC[REAL_ARITH `a <= a * b <=> &0 <= a * (b - &1)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[REAL_LE_MUL; REAL_LE_POW_2; REAL_ARITH `&0 <= &2`]); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (REWRITE_WITH `&1 <= norm (s2 - u1) / sqrt (&2) <=> + &1 * sqrt (&2) <= norm (s2 - u1:real^3)`); + (MATCH_MP_TAC REAL_LE_RDIV_EQ); + (MATCH_MP_TAC SQRT_POS_LT THEN REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `norm (s2 - u1) * norm (u0 - u1:real^3) * a <= + norm (z - u1) * norm (u0 - u1) * a`); + (REWRITE_TAC[REAL_ARITH `a * x * y <= b * x * y <=> + &0 <= (x * y) * (b - a)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (EXPAND_TAC "a" THEN MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_WITH `hl vl = dist (circumcenter (set_of_list vl),(HD vl):real^3)`); + (MATCH_MP_TAC Rogers.HL_EQ_DIST0); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (REWRITE_TAC[DIST_POS_LE]); + (SIMP_TAC[SQRT_POS_LE; REAL_ARITH `&0 <= &2`]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + +(* ------------------------------------------------------------------------- *) +(* OK here too *) + +(* ----------------------------------------------------- *) + + (NEW_GOAL `?s. between s (omega_list_n V ul 2,omega_list_n V ul 3) /\ + dist (u0,s) = sqrt (&2) /\ + mxi V ul = s`); + (MATCH_MP_TAC MXI_EXPLICIT); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (REWRITE_TAC[REAL_ARITH `a < b <=> ~(a >= b)`]); + (ASM_REWRITE_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC); + (UP_ASM_TAC THEN ONCE_ASM_REWRITE_TAC[] THEN STRIP_TAC); + + (NEW_GOAL `u0 - u1 = &2 % (u0 - s1:real^3)`); + (REWRITE_TAC[ASSUME `s1 = circumcenter {u0, u1:real^3}`; CIRCUMCENTER_2; + midpoint; VECTOR_ARITH `u0 - inv (&2) % (u0 + u1) = inv (&2) % (u0 - u1)`]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `(z - s1) dot (u0 - s1:real^3) = &0`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `{u0,u1:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1; + ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (MATCH_MP_TAC (SET_RULE `(?C. a IN C/\ C SUBSET B) ==> a IN B`)); + (EXISTS_TAC `voronoi_list V vl`); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC (SET_RULE `(?C. a IN C/\ C SUBSET B) ==> a IN B`)); + (EXISTS_TAC `set_of_list (vl:(real^3)list)`); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1; + ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (SET_TAC[]); + + (NEW_GOAL `between m (s2, z:real^3)`); + (MATCH_MP_TAC BETWEEN_TRANS_2); + (EXISTS_TAC `s3:real^3`); + (STRIP_TAC); + (ONCE_REWRITE_TAC[BETWEEN_SYM]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ABBREV_TAC `zl:(real^3)list = truncate_simplex 2 ul`); + + (NEW_GOAL `s2:real^3 IN voronoi_list V zl`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "zl"); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + + (NEW_GOAL `s3:real^3 IN voronoi_list V zl`); + (EXPAND_TAC "s3" THEN EXPAND_TAC "zl"); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + + (NEW_GOAL `m:real^3 IN voronoi_list V zl`); + (MATCH_MP_TAC (SET_RULE `(?C. x IN C /\ C SUBSET B) ==> x IN B`)); + (EXISTS_TAC `convex hull {s2, s3:real^3}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL]); + (REWRITE_WITH `convex hull {s2, s3:real^3} SUBSET voronoi_list V zl <=> + convex hull {s2, s3} SUBSET (convex hull (voronoi_list V zl))`); + (REWRITE_WITH `convex hull (voronoi_list V zl) = voronoi_list V zl`); + (REWRITE_TAC[CONVEX_HULL_EQ]); + (REWRITE_TAC[Packing3.CONVEX_VORONOI_LIST]); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (ASM_SET_TAC[]); + + (NEW_GOAL `z:real^3 IN voronoi_list V zl`); + (MATCH_MP_TAC (SET_RULE `(?C. x IN C /\ C SUBSET B) ==> x IN B`)); + (EXISTS_TAC `convex hull {m, s3:real^3}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL]); + (REWRITE_WITH `convex hull {m, s3:real^3} SUBSET voronoi_list V zl <=> + convex hull {m, s3} SUBSET (convex hull (voronoi_list V zl))`); + (REWRITE_WITH `convex hull (voronoi_list V zl) = voronoi_list V zl`); + (REWRITE_TAC[CONVEX_HULL_EQ]); + (REWRITE_TAC[Packing3.CONVEX_VORONOI_LIST]); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (ASM_SET_TAC[]); + + (NEW_GOAL `norm (m - u1) <= norm (z - u1:real^3)`); + (REWRITE_WITH `norm (m - u1) <= norm (z - u1:real^3) <=> + norm (m - u1) pow 2 <= norm (z - u1:real^3) pow 2`); + (ASM_SIMP_TAC[Collect_geom.POW2_COND; NORM_POS_LE]); + (REWRITE_WITH `m - u1 = (m - s2) + (s2 - u1:real^3) /\ + z - u1 = (z - s2) + (s2 - u1:real^3)`); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `norm (m - s2 + s2 - u1) pow 2 = + norm (m - s2) pow 2 + norm (s2 - u1:real^3) pow 2`); + (NEW_GOAL `(m - s2) dot (s2 - u1:real^3) = &0`); + (ONCE_REWRITE_TAC[VECTOR_ARITH + `(m - s2) dot (s2 - u1) = -- ((m - s2) dot (u1 - s2))`]); + (REWRITE_TAC[REAL_ARITH `--a = &0 <=> a = &0`]); + (REWRITE_WITH `s2:real^3 = circumcenter (set_of_list zl)`); + (REWRITE_WITH `s2:real^3 = omega_list V zl`); + (EXPAND_TAC "s2"); + (EXPAND_TAC "zl"); + (REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; TRUNCATE_SIMPLEX_EXPLICIT_2; LENGTH; ARITH_RULE `(SUC (SUC (SUC 0)) - 1) = 2`; + Marchal_cells.OMEGA_LIST_TRUNCATE_2]); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `2`); + (REWRITE_TAC[IN; REAL_ARITH `a < b <=> ~(a >= b)`]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "zl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "zl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (MATCH_MP_TAC (SET_RULE `(?C. a IN C/\ C SUBSET B) ==> a IN B`)); + (EXISTS_TAC `voronoi_list V zl`); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC (SET_RULE `(?C. a IN C/\ C SUBSET B) ==> a IN B`)); + (EXISTS_TAC `set_of_list (zl:(real^3)list)`); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (EXPAND_TAC "zl" THEN REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_2; + ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (SET_TAC[]); + (ASM_SIMP_TAC[Trigonometry2.PITHAGO_THEOREM]); + + (REWRITE_WITH + `norm (z - s2 + s2 - u1) pow 2 = + norm (z - s2) pow 2 + norm (s2 - u1:real^3) pow 2`); + (NEW_GOAL `(z - s2) dot (s2 - u1:real^3) = &0`); + (ONCE_REWRITE_TAC[VECTOR_ARITH + `(z - s2) dot (s2 - u1) = -- ((z - s2) dot (u1 - s2))`]); + (REWRITE_TAC[REAL_ARITH `--a = &0 <=> a = &0`]); + (REWRITE_WITH `s2:real^3 = circumcenter (set_of_list zl)`); + (REWRITE_WITH `s2:real^3 = omega_list V zl`); + (EXPAND_TAC "s2"); + (EXPAND_TAC "zl"); + (REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; TRUNCATE_SIMPLEX_EXPLICIT_2; LENGTH; ARITH_RULE `(SUC (SUC (SUC 0)) - 1) = 2`; + Marchal_cells.OMEGA_LIST_TRUNCATE_2]); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `2`); + (REWRITE_TAC[IN; REAL_ARITH `a < b <=> ~(a >= b)`]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "zl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "zl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (MATCH_MP_TAC (SET_RULE `(?C. a IN C/\ C SUBSET B) ==> a IN B`)); + (EXISTS_TAC `voronoi_list V zl`); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC (SET_RULE `(?C. a IN C/\ C SUBSET B) ==> a IN B`)); + (EXISTS_TAC `set_of_list (zl:(real^3)list)`); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (EXPAND_TAC "zl" THEN REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_2; + ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (SET_TAC[]); + (ASM_SIMP_TAC[Trigonometry2.PITHAGO_THEOREM]); + (REWRITE_TAC[REAL_ARITH `a + b <= c + b <=> a <= c`]); + + (MP_TAC (ASSUME `between m (s2,z:real^3)`)); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2;IN;IN_ELIM_THM] THEN STRIP_TAC); + (REWRITE_TAC[ASSUME `m = u % s2 + v % z:real^3`]); + (REWRITE_WITH + `(u % s2 + v % z) - s2 = (u % s2 + v % z) - (u + v) % s2:real^3`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (REWRITE_TAC[VECTOR_ARITH `(u % s2 + v % z) - (u + v) % s2 = v % (z - s2)`]); + (REWRITE_TAC[NORM_MUL; REAL_ARITH `(a*b) pow 2 = a pow 2 * b pow 2`; + REAL_ARITH `a * b <= b <=> &0 <= b * (&1 - a)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_LE_POW_2]); + (REWRITE_WITH `abs (v:real) = v`); + (ASM_REWRITE_TAC[REAL_ABS_REFL]); + (REWRITE_TAC[REAL_ARITH `&0 <= &1 - a <=> a <= &1 pow 2`]); + (REWRITE_WITH ` v pow 2 <= &1 pow 2 <=> v <= &1`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.POW2_COND); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `norm (m - u1:real^3) = dist (u0, s:real^3)`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[GSYM dist]); + (UNDISCH_TAC `m IN voronoi_list V zl`); + (ASM_REWRITE_TAC[VORONOI_LIST; VORONOI_SET]); + (EXPAND_TAC "zl"); + (REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (STRIP_TAC); + (NEW_GOAL `s:real^3 IN voronoi_closed V u0 /\ s IN voronoi_closed V u1`); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `{u0,u1,u2,u3:real^3} SUBSET V`); + (REWRITE_WITH `{u0,u1,u2,u3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + + + (NEW_GOAL `dist (s,u0) <= dist (s,u1:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ONCE_REWRITE_TAC[MESON[IN] `V s <=> s IN V`]); + (ASM_SET_TAC[]); + (NEW_GOAL `dist (s,u1) <= dist (s,u0:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ONCE_REWRITE_TAC[MESON[IN] `V s <=> s IN V`]); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `norm (m - u1:real^3) = sqrt (&2)`); + (ASM_REAL_ARITH_TAC); + + (REWRITE_WITH `(z - u1) dot (u0 - u1:real^3) = &2 * norm (u0 - s1) pow 2`); + (REWRITE_WITH `(z - u1) dot (u0 - u1) = (z - s1) dot (u0 - u1) + + (s1 - u1) dot (u0 - u1:real^3)`); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[ASSUME `u0 - u1 = &2 % (u0 - s1:real^3)`; DOT_RMUL]); + (REWRITE_WITH `(s1 - u1) = (u0 - s1:real^3)`); + (ASM_REWRITE_TAC[CIRCUMCENTER_2;midpoint] THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[NORM_POW_2] THEN REAL_ARITH_TAC); + + (NEW_GOAL `&2 * norm (u0 - s1:real^3) pow 2 <= + norm (m - u1) * norm (u0 - u1) * a`); + (EXPAND_TAC "a"); + (REWRITE_WITH `hl (vl:(real^3)list) = dist (s1, u0:real^3)`); + (REWRITE_WITH `s1:real^3 = circumcenter (set_of_list vl)`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `u0:real^3 = HD vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list; HD]); + (MATCH_MP_TAC Rogers.HL_EQ_DIST0); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist]); + (REWRITE_TAC[ASSUME `u0 - u1 = &2 % (u0 - s1:real^3)`; NORM_MUL]); + (REWRITE_WITH `abs (&2) = &2`); + (REWRITE_TAC[REAL_ABS_REFL; REAL_ARITH `&0 <= &2`]); + (REWRITE_TAC[REAL_ARITH `a * (&2 * b) * b / c = (&2 * b pow 2) * ( a / c)`]); + (REWRITE_TAC[REAL_ARITH `a <= a * b <=> &0 <= a * (b - &1)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[REAL_LE_MUL; REAL_LE_POW_2; REAL_ARITH `&0 <= &2`]); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (REWRITE_WITH `sqrt (&2) / sqrt (&2) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`)); + (SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]); + (REAL_ARITH_TAC); + + (NEW_GOAL `norm (m - u1) * norm (u0 - u1:real^3) * a <= + norm (z - u1) * norm (u0 - u1) * a`); + (REWRITE_TAC[REAL_ARITH `a * x * y <= b * x * y <=> + &0 <= (x * y) * (b - a)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (EXPAND_TAC "a" THEN MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_WITH `hl vl = dist (circumcenter (set_of_list vl),(HD vl):real^3)`); + (MATCH_MP_TAC Rogers.HL_EQ_DIST0); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (REWRITE_TAC[DIST_POS_LE]); + (SIMP_TAC[SQRT_POS_LE; REAL_ARITH `&0 <= &2`]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `t1 * norm (u0 - u1:real^3) pow 2 + t5 * ((z - u1) dot (u0 - u1)) + <= t1 * norm (u0 - u1) pow 2 + t5 * (norm (z - u1) * norm (u0 - u1) * a)`); + (REWRITE_TAC[REAL_ARITH `a + b * c <= a + b * d <=> &0 <= b * (d - c)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL + `t1 * norm (u0 - u1) pow 2 + t5 * norm (z - u1:real^3) * norm (u0 - u1) * a + < norm (t1 % (u0 - u1) + t5 % (z - u1)) * norm (u0 - u1) * a`); + + (REWRITE_TAC[REAL_ARITH + `t1 * norm (u0 - u1) pow 2 + t5 * norm (z - u1:real^3) * norm (u0 - u1) * a + < norm (t1 % (u0 - u1) + t5 % (z - u1)) * norm (u0 - u1) * a <=> + &0 < (a * norm (t1 % (u0 - u1) + t5 % (z - u1)) - t1 * norm (u0 - u1) - + t5 * a * norm (z - u1)) * norm (u0 - u1)`]); + (MATCH_MP_TAC REAL_LT_MUL); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 < a - b - c <=> b + c < a`]); + + (NEW_GOAL `t1 * norm (u0 - u1) < a * t1 * norm (u0 - u1:real^3)`); + (REWRITE_TAC[REAL_ARITH `a * b < c * a * b <=> &0 < (--a) * b * (&1 - c)`]); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `&0 < a - b <=> b < a`] THEN EXPAND_TAC "a"); + (REWRITE_WITH `hl (vl:(real^3)list) / sqrt (&2) < &1 <=> hl vl < &1 * sqrt (&2) `); + (MATCH_MP_TAC REAL_LT_LDIV_EQ); + (MATCH_MP_TAC SQRT_POS_LT); + (REAL_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_MUL_LID]); + + (NEW_GOAL `a * t1 * norm (u0 - u1) + t5 * a * norm (z - u1) <= + a * norm (t1 % (u0 - u1) + t5 % (z - u1:real^3))`); + (REWRITE_TAC[REAL_ARITH + `a * t1 * norm (u0 - u1) + t5 * a * norm (z - u1) <= + a * norm (t1 % (u0 - u1) + t5 % (z - u1)) <=> + &0 <= a * (norm (t1 % (u0 - u1) + t5 % (z - u1)) + (--t1 * norm (u0 - u1)) - t5 * norm (z - u1))`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (EXPAND_TAC "a"); + (REWRITE_WITH `hl (vl:(real^3)list) = dist (s1, u0:real^3)`); + (REWRITE_WITH `s1:real^3 = circumcenter (set_of_list vl)`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `u0:real^3 = HD vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list; HD]); + (MATCH_MP_TAC Rogers.HL_EQ_DIST0); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_SIMP_TAC[SQRT_POS_LE; REAL_ARITH `&0 <= &2`]); + + (ONCE_REWRITE_TAC[REAL_ARITH `&0 <= a + b - c <=> c <= a + b`]); + (ABBREV_TAC `k1 = t1 % (u0 - u1) + t5 % (z - u1:real^3)`); + (REWRITE_WITH `t5 * norm (z - u1) = norm (t5 % (z - u1:real^3))`); + (REWRITE_TAC[NORM_MUL]); + (REWRITE_WITH `abs t5 = t5`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `--t1 * norm (u0 - u1) = norm ((--t1) % (u0 - u1:real^3))`); + (REWRITE_TAC[NORM_MUL]); + (REWRITE_WITH `abs (--t1) = --t1`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `t5 % (z - u1) = k1 + --t1 % (u0 - u1:real^3)`); + (EXPAND_TAC "k1" THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_TRIANGLE]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + +(* ----------------------------------------------------------------------- *) +(* Half of the proof *) + + + (ASM_CASES_TAC `t2 < &0`); + (NEW_GOAL `F`); + (UNDISCH_TAC `x:real^3 IN rcone_ge u0 u1 a`); + (REWRITE_TAC[rcone_ge;rconesgn; IN; IN_ELIM_THM]); + (REWRITE_TAC[REAL_ARITH `~(a >= b) <=> a < b`]); + (NEW_GOAL `x = t1 % u0 + t2 % u1 + t5 % (z:real^3)`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "z" THEN EXPAND_TAC "t5"); + (REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC]); + (REWRITE_TAC[REAL_ARITH `a * b / a = b * (a / a)`]); + (ASM_SIMP_TAC[REAL_DIV_REFL; REAL_ARITH `&0 < y ==> ~(y = &0)`; + REAL_MUL_RID]); + (REWRITE_TAC[dist]); + (REWRITE_WITH `x - u0:real^3 = t2 % (u1 - u0) + t5 % (z - u0)`); + (REWRITE_WITH `x - u0:real^3 = x - (t1 + t2 + t5) % u0`); + (REWRITE_WITH `t1 + t2 + t5 = &1`); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[ASSUME `x = t1 % u0 + t2 % u1 + t5 % z:real^3`]); + (VECTOR_ARITH_TAC); + + (REWRITE_TAC[DOT_LADD; DOT_LMUL; GSYM NORM_POW_2]); + (NEW_GOAL `(z - u0) dot (u1 - u0:real^3) <= + norm (z - u0:real^3) * norm (u1 - u0) * a`); + + (ASM_CASES_TAC `hl (truncate_simplex 2 (ul:(real^3)list)) >= sqrt (&2)`); + (NEW_GOAL `m = s2:real^3`); + (EXPAND_TAC "m" THEN REWRITE_TAC[mxi] THEN COND_CASES_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `u1 - u0 = &2 % (u1 - s1:real^3)`); + (REWRITE_TAC[ASSUME `s1 = circumcenter {u0, u1:real^3}`; CIRCUMCENTER_2; + midpoint; VECTOR_ARITH `u1 - inv (&2) % (u0 + u1) = inv (&2) % (u1 - u0)`]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `(z - s1) dot (u1 - s1:real^3) = &0`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `{u0,u1:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1; + ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (MATCH_MP_TAC (SET_RULE `(?C. a IN C/\ C SUBSET B) ==> a IN B`)); + (EXISTS_TAC `voronoi_list V vl`); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC (SET_RULE `(?C. a IN C/\ C SUBSET B) ==> a IN B`)); + (EXISTS_TAC `set_of_list (vl:(real^3)list)`); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1; + ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (SET_TAC[]); + + (NEW_GOAL `norm (s2 - u0) <= norm (z - u0:real^3)`); + (REWRITE_WITH `norm (s2 - u0) <= norm (z - u0:real^3) <=> + norm (s2 - u0) pow 2 <= norm (z - u0:real^3) pow 2`); + (ASM_SIMP_TAC[Collect_geom.POW2_COND; NORM_POS_LE]); + (REWRITE_WITH `s2 - u0 = (s2 - s1) + (s1 - u0:real^3) /\ + z - u0 = (z - s1) + (s1 - u0:real^3)`); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `norm (s2 - s1 + s1 - u0) pow 2 = + norm (s2 - s1) pow 2 + norm (s1 - u0:real^3) pow 2`); + (NEW_GOAL `(s2 - s1) dot (s1 - u0:real^3) = &0`); + (REWRITE_WITH `s1 - u0 = u1 - s1:real^3`); + (ASM_REWRITE_TAC[CIRCUMCENTER_2; midpoint] THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `{u0,u1:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1; + ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (MATCH_MP_TAC (SET_RULE `(?C. a IN C/\ C SUBSET B) ==> a IN B`)); + (EXISTS_TAC `voronoi_list V vl`); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC (SET_RULE `(?C. a IN C/\ C SUBSET B) ==> a IN B`)); + (EXISTS_TAC `set_of_list (vl:(real^3)list)`); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1; + ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (SET_TAC[]); + (ASM_SIMP_TAC[Trigonometry2.PITHAGO_THEOREM]); + + (REWRITE_WITH `norm (z - s1 + s1 - u0:real^3) pow 2 = + norm (z - s1) pow 2 + norm (s1 - u0) pow 2`); + (NEW_GOAL `(z - s1) dot (s1 - u0:real^3) = &0`); + (REWRITE_WITH `s1 - u0 = u1 - s1:real^3`); + (ASM_REWRITE_TAC[CIRCUMCENTER_2; midpoint] THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[Trigonometry2.PITHAGO_THEOREM]); + (REWRITE_TAC[REAL_ARITH `a + b <= c + b <=> a <= c`]); + (REWRITE_TAC[GSYM (ASSUME `omega_list_n V ul 2 = s2`)] THEN + REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `2 = SUC 1`]); + (REWRITE_TAC[ARITH_RULE `SUC 1 = 2`]); + (REWRITE_TAC[GSYM dist; DIST_SYM]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `!a b c d:real^3. + dist (a, b:real^3) pow 2 <= dist (c,d) pow 2 <=> dist (a,b) <= dist (c,d)`); + (REPEAT STRIP_TAC THEN ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (SIMP_TAC[Collect_geom.POW2_COND; DIST_POS_LE]); + (MATCH_MP_TAC CLOSEST_POINT_LE); + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (ABBREV_TAC `zl:(real^3)list = truncate_simplex 2 ul`); + + (NEW_GOAL `s2:real^3 IN voronoi_list V zl`); + (EXPAND_TAC "zl" THEN REWRITE_TAC[GSYM (ASSUME `omega_list_n V ul 2 = s2`)]); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (NEW_GOAL `s3:real^3 IN voronoi_list V zl`); + (EXPAND_TAC "zl" THEN EXPAND_TAC "s3"); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (MATCH_MP_TAC (SET_RULE `(?C. x IN C /\ C SUBSET B) ==> x IN B`)); + (EXISTS_TAC `convex hull {s2, s3:real^3}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL]); + (ASM_MESON_TAC[]); + (REWRITE_WITH `convex hull {s2, s3:real^3} SUBSET voronoi_list V zl <=> + convex hull {s2, s3} SUBSET (convex hull (voronoi_list V zl))`); + (REWRITE_WITH `convex hull (voronoi_list V zl) = voronoi_list V zl`); + (REWRITE_TAC[CONVEX_HULL_EQ]); + (REWRITE_TAC[Packing3.CONVEX_VORONOI_LIST]); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (ASM_SET_TAC[]); + + (REWRITE_WITH `(z - u0) dot (u1 - u0:real^3) = &2 * norm (u1 - s1) pow 2`); + (REWRITE_WITH `(z - u0) dot (u1 - u0) = (z - s1) dot (u1 - u0) + + (s1 - u0) dot (u1 - u0:real^3)`); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[ASSUME `u1 - u0 = &2 % (u1 - s1:real^3)`; DOT_RMUL]); + (REWRITE_WITH `(s1 - u0) = (u1 - s1:real^3)`); + (ASM_REWRITE_TAC[CIRCUMCENTER_2;midpoint] THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[NORM_POW_2] THEN REAL_ARITH_TAC); + + + (NEW_GOAL `&2 * norm (u1 - s1:real^3) pow 2 <= + norm (s2 - u0) * norm (u1 - u0) * a`); + (NEW_GOAL `norm (s2 - u0:real^3) >= sqrt (&2)`); + (NEW_GOAL `norm (s2 - u0:real^3) >= + hl (truncate_simplex 2 (ul:(real^3)list))`); + (REWRITE_TAC[GSYM dist]); + (ONCE_REWRITE_TAC[REAL_ARITH `a >= b <=> b <= a`]); + (ABBREV_TAC `xl:(real^3)list = truncate_simplex 2 ul`); + + (REWRITE_WITH `s2 = omega_list V xl`); + (ONCE_REWRITE_TAC[GSYM (ASSUME `omega_list_n V ul 2 = s2`)]); + (REWRITE_TAC[Marchal_cells.OMEGA_LIST_TRUNCATE_2; + ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (EXPAND_TAC "xl" THEN REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; + ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_WITH `u0:real^3 = HD xl`); + (EXPAND_TAC "xl"); + (REWRITE_TAC[ASSUME `ul = [u0; u1; u2; u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_2; HD]); + (MATCH_MP_TAC Rogers.WAUFCHE1); + (EXISTS_TAC `2`); + (REWRITE_TAC[IN] THEN EXPAND_TAC "xl"); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (EXPAND_TAC "a"); + (REWRITE_WITH `hl (vl:(real^3)list) = dist (s1, u1:real^3)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `s1:real^3 = circumcenter (set_of_list vl)`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `!w:real^3. w IN set_of_list vl + ==> dist (circumcenter (set_of_list vl),w) = hl vl`); + (MATCH_MP_TAC Rogers.HL_PROPERTIES); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "vl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "vl"); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list]); + (SET_TAC[]); + + (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist]); + (REWRITE_TAC[ASSUME `u1 - u0 = &2 % (u1 - s1:real^3)`; NORM_MUL]); + (REWRITE_WITH `abs (&2) = &2`); + (REWRITE_TAC[REAL_ABS_REFL; REAL_ARITH `&0 <= &2`]); + (REWRITE_TAC[REAL_ARITH `a * (&2 * b) * b / c = (&2 * b pow 2) * ( a / c)`]); + (REWRITE_TAC[REAL_ARITH `a <= a * b <=> &0 <= a * (b - &1)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[REAL_LE_MUL; REAL_LE_POW_2; REAL_ARITH `&0 <= &2`]); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (REWRITE_WITH `&1 <= norm (s2 - u0) / sqrt (&2) <=> + &1 * sqrt (&2) <= norm (s2 - u0:real^3)`); + (MATCH_MP_TAC REAL_LE_RDIV_EQ); + (MATCH_MP_TAC SQRT_POS_LT THEN REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `norm (s2 - u0) * norm (u1 - u0:real^3) * a <= + norm (z - u0) * norm (u1 - u0) * a`); + (REWRITE_TAC[REAL_ARITH `a * x * y <= b * x * y <=> + &0 <= (x * y) * (b - a)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (EXPAND_TAC "a" THEN MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_WITH `hl vl = dist (circumcenter (set_of_list vl),(HD vl):real^3)`); + (MATCH_MP_TAC Rogers.HL_EQ_DIST0); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (REWRITE_TAC[DIST_POS_LE]); + (SIMP_TAC[SQRT_POS_LE; REAL_ARITH `&0 <= &2`]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + +(* ------------------------------------------------------------------------- *) +(* OK here too *) + +(* ----------------------------------------------------- *) + + (NEW_GOAL `?s. between s (omega_list_n V ul 2,omega_list_n V ul 3) /\ + dist (u0,s) = sqrt (&2) /\ + mxi V ul = s`); + (MATCH_MP_TAC MXI_EXPLICIT); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (REWRITE_TAC[REAL_ARITH `a < b <=> ~(a >= b)`]); + (ASM_REWRITE_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC); + (UP_ASM_TAC THEN ONCE_ASM_REWRITE_TAC[] THEN STRIP_TAC); + + (NEW_GOAL `u1 - u0 = &2 % (u1 - s1:real^3)`); + (REWRITE_TAC[ASSUME `s1 = circumcenter {u0, u1:real^3}`; CIRCUMCENTER_2; + midpoint; VECTOR_ARITH `u1 - inv (&2) % (u0 + u1) = inv (&2) % (u1 - u0)`]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `(z - s1) dot (u1 - s1:real^3) = &0`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `{u0,u1:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1; + ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (MATCH_MP_TAC (SET_RULE `(?C. a IN C/\ C SUBSET B) ==> a IN B`)); + (EXISTS_TAC `voronoi_list V vl`); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC (SET_RULE `(?C. a IN C/\ C SUBSET B) ==> a IN B`)); + (EXISTS_TAC `set_of_list (vl:(real^3)list)`); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1; + ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (SET_TAC[]); + + (NEW_GOAL `between m (s2, z:real^3)`); + (MATCH_MP_TAC BETWEEN_TRANS_2); + (EXISTS_TAC `s3:real^3`); + (STRIP_TAC); + (ONCE_REWRITE_TAC[BETWEEN_SYM]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ABBREV_TAC `zl:(real^3)list = truncate_simplex 2 ul`); + + (NEW_GOAL `s2:real^3 IN voronoi_list V zl`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "zl"); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + + (NEW_GOAL `s3:real^3 IN voronoi_list V zl`); + (EXPAND_TAC "s3" THEN EXPAND_TAC "zl"); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + + (NEW_GOAL `m:real^3 IN voronoi_list V zl`); + (MATCH_MP_TAC (SET_RULE `(?C. x IN C /\ C SUBSET B) ==> x IN B`)); + (EXISTS_TAC `convex hull {s2, s3:real^3}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL]); + (REWRITE_WITH `convex hull {s2, s3:real^3} SUBSET voronoi_list V zl <=> + convex hull {s2, s3} SUBSET (convex hull (voronoi_list V zl))`); + (REWRITE_WITH `convex hull (voronoi_list V zl) = voronoi_list V zl`); + (REWRITE_TAC[CONVEX_HULL_EQ]); + (REWRITE_TAC[Packing3.CONVEX_VORONOI_LIST]); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (ASM_SET_TAC[]); + + (NEW_GOAL `z:real^3 IN voronoi_list V zl`); + (MATCH_MP_TAC (SET_RULE `(?C. x IN C /\ C SUBSET B) ==> x IN B`)); + (EXISTS_TAC `convex hull {m, s3:real^3}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL]); + (REWRITE_WITH `convex hull {m, s3:real^3} SUBSET voronoi_list V zl <=> + convex hull {m, s3} SUBSET (convex hull (voronoi_list V zl))`); + (REWRITE_WITH `convex hull (voronoi_list V zl) = voronoi_list V zl`); + (REWRITE_TAC[CONVEX_HULL_EQ]); + (REWRITE_TAC[Packing3.CONVEX_VORONOI_LIST]); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (ASM_SET_TAC[]); + + (NEW_GOAL `norm (m - u0) <= norm (z - u0:real^3)`); + (REWRITE_WITH `norm (m - u0) <= norm (z - u0:real^3) <=> + norm (m - u0) pow 2 <= norm (z - u0:real^3) pow 2`); + (ASM_SIMP_TAC[Collect_geom.POW2_COND; NORM_POS_LE]); + (REWRITE_WITH `m - u0 = (m - s2) + (s2 - u0:real^3) /\ + z - u0 = (z - s2) + (s2 - u0:real^3)`); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `norm (m - s2 + s2 - u0) pow 2 = + norm (m - s2) pow 2 + norm (s2 - u0:real^3) pow 2`); + (NEW_GOAL `(m - s2) dot (s2 - u0:real^3) = &0`); + (ONCE_REWRITE_TAC[VECTOR_ARITH + `(m - s2) dot (s2 - u0) = -- ((m - s2) dot (u0 - s2))`]); + (REWRITE_TAC[REAL_ARITH `--a = &0 <=> a = &0`]); + (REWRITE_WITH `s2:real^3 = circumcenter (set_of_list zl)`); + (REWRITE_WITH `s2:real^3 = omega_list V zl`); + (EXPAND_TAC "s2"); + (EXPAND_TAC "zl"); + (REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; TRUNCATE_SIMPLEX_EXPLICIT_2; LENGTH; ARITH_RULE `(SUC (SUC (SUC 0)) - 1) = 2`; + Marchal_cells.OMEGA_LIST_TRUNCATE_2]); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `2`); + (REWRITE_TAC[IN; REAL_ARITH `a < b <=> ~(a >= b)`]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "zl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "zl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (MATCH_MP_TAC (SET_RULE `(?C. a IN C/\ C SUBSET B) ==> a IN B`)); + (EXISTS_TAC `voronoi_list V zl`); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC (SET_RULE `(?C. a IN C/\ C SUBSET B) ==> a IN B`)); + (EXISTS_TAC `set_of_list (zl:(real^3)list)`); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (EXPAND_TAC "zl" THEN REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_2; + ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (SET_TAC[]); + (ASM_SIMP_TAC[Trigonometry2.PITHAGO_THEOREM]); + + (REWRITE_WITH + `norm (z - s2 + s2 - u0) pow 2 = + norm (z - s2) pow 2 + norm (s2 - u0:real^3) pow 2`); + (NEW_GOAL `(z - s2) dot (s2 - u0:real^3) = &0`); + (ONCE_REWRITE_TAC[VECTOR_ARITH + `(z - s2) dot (s2 - u0) = -- ((z - s2) dot (u0 - s2))`]); + (REWRITE_TAC[REAL_ARITH `--a = &0 <=> a = &0`]); + (REWRITE_WITH `s2:real^3 = circumcenter (set_of_list zl)`); + (REWRITE_WITH `s2:real^3 = omega_list V zl`); + (EXPAND_TAC "s2"); + (EXPAND_TAC "zl"); + (REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; TRUNCATE_SIMPLEX_EXPLICIT_2; LENGTH; ARITH_RULE `(SUC (SUC (SUC 0)) - 1) = 2`; + Marchal_cells.OMEGA_LIST_TRUNCATE_2]); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `2`); + (REWRITE_TAC[IN; REAL_ARITH `a < b <=> ~(a >= b)`]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "zl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "zl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (MATCH_MP_TAC (SET_RULE `(?C. a IN C/\ C SUBSET B) ==> a IN B`)); + (EXISTS_TAC `voronoi_list V zl`); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC (SET_RULE `(?C. a IN C/\ C SUBSET B) ==> a IN B`)); + (EXISTS_TAC `set_of_list (zl:(real^3)list)`); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (EXPAND_TAC "zl" THEN REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_2; + ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (SET_TAC[]); + (ASM_SIMP_TAC[Trigonometry2.PITHAGO_THEOREM]); + (REWRITE_TAC[REAL_ARITH `a + b <= c + b <=> a <= c`]); + + (MP_TAC (ASSUME `between m (s2,z:real^3)`)); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2;IN;IN_ELIM_THM] THEN STRIP_TAC); + (REWRITE_TAC[ASSUME `m = u % s2 + v % z:real^3`]); + (REWRITE_WITH + `(u % s2 + v % z) - s2 = (u % s2 + v % z) - (u + v) % s2:real^3`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (REWRITE_TAC[VECTOR_ARITH `(u % s2 + v % z) - (u + v) % s2 = v % (z - s2)`]); + (REWRITE_TAC[NORM_MUL; REAL_ARITH `(a*b) pow 2 = a pow 2 * b pow 2`; + REAL_ARITH `a * b <= b <=> &0 <= b * (&1 - a)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_LE_POW_2]); + (REWRITE_WITH `abs (v:real) = v`); + (ASM_REWRITE_TAC[REAL_ABS_REFL]); + (REWRITE_TAC[REAL_ARITH `&0 <= &1 - a <=> a <= &1 pow 2`]); + (REWRITE_WITH ` v pow 2 <= &1 pow 2 <=> v <= &1`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.POW2_COND); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `norm (m - u0:real^3) = dist (u0, s:real^3)`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[GSYM dist]); + (NEW_GOAL `norm (m - u0:real^3) = sqrt (&2)`); + (ASM_REAL_ARITH_TAC); + + (REWRITE_WITH `(z - u0) dot (u1 - u0:real^3) = &2 * norm (u1 - s1) pow 2`); + (REWRITE_WITH `(z - u0) dot (u1 - u0) = (z - s1) dot (u1 - u0) + + (s1 - u0) dot (u1 - u0:real^3)`); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[ASSUME `u1 - u0 = &2 % (u1 - s1:real^3)`; DOT_RMUL]); + (REWRITE_WITH `(s1 - u0) = (u1 - s1:real^3)`); + (ASM_REWRITE_TAC[CIRCUMCENTER_2;midpoint] THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[NORM_POW_2] THEN REAL_ARITH_TAC); + + (NEW_GOAL `&2 * norm (u1 - s1:real^3) pow 2 <= + norm (m - u0) * norm (u1 - u0) * a`); + (EXPAND_TAC "a"); + (REWRITE_WITH `hl (vl:(real^3)list) = dist (s1, u1:real^3)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `s1:real^3 = circumcenter (set_of_list vl)`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `!w:real^3. w IN set_of_list vl + ==> dist (circumcenter (set_of_list vl),w) = hl vl`); + (MATCH_MP_TAC Rogers.HL_PROPERTIES); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "vl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "vl"); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list]); + (SET_TAC[]); + + (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist]); + (REWRITE_TAC[ASSUME `u1 - u0 = &2 % (u1 - s1:real^3)`; NORM_MUL]); + (REWRITE_WITH `abs (&2) = &2`); + (REWRITE_TAC[REAL_ABS_REFL; REAL_ARITH `&0 <= &2`]); + (REWRITE_TAC[REAL_ARITH `a * (&2 * b) * b / c = (&2 * b pow 2) * ( a / c)`]); + (REWRITE_TAC[REAL_ARITH `a <= a * b <=> &0 <= a * (b - &1)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[REAL_LE_MUL; REAL_LE_POW_2; REAL_ARITH `&0 <= &2`]); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (REWRITE_WITH `sqrt (&2) / sqrt (&2) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`)); + (SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]); + (REAL_ARITH_TAC); + + (NEW_GOAL `norm (m - u0) * norm (u1 - u0:real^3) * a <= + norm (z - u0) * norm (u1 - u0) * a`); + (REWRITE_TAC[REAL_ARITH `a * x * y <= b * x * y <=> + &0 <= (x * y) * (b - a)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (EXPAND_TAC "a" THEN MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_WITH `hl (vl:(real^3)list) = dist (s1, u1:real^3)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `s1:real^3 = circumcenter (set_of_list vl)`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `!w:real^3. w IN set_of_list vl + ==> dist (circumcenter (set_of_list vl),w) = hl vl`); + (MATCH_MP_TAC Rogers.HL_PROPERTIES); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "vl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "vl"); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list]); + (SET_TAC[]); + (REWRITE_TAC[DIST_POS_LE]); + (SIMP_TAC[SQRT_POS_LE; REAL_ARITH `&0 <= &2`]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + + (NEW_GOAL `t2 * norm (u1 - u0:real^3) pow 2 + t5 * ((z - u0) dot (u1 - u0)) + <= t2 * norm (u1 - u0) pow 2 + t5 * (norm (z - u0) * norm (u1 - u0) * a)`); + (REWRITE_TAC[REAL_ARITH `a + b * c <= a + b * d <=> &0 <= b * (d - c)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL + `t2 * norm (u1 - u0) pow 2 + t5 * norm (z - u0:real^3) * norm (u1 - u0) * a + < norm (t2 % (u1 - u0) + t5 % (z - u0)) * norm (u1 - u0) * a`); + + (REWRITE_TAC[REAL_ARITH + `t2 * norm (u1 - u0) pow 2 + t5 * norm (z - u0:real^3) * norm (u1 - u0) * a + < norm (t2 % (u1 - u0) + t5 % (z - u0)) * norm (u1 - u0) * a <=> + &0 < (a * norm (t2 % (u1 - u0) + t5 % (z - u0)) - t2 * norm (u1 - u0) - + t5 * a * norm (z - u0)) * norm (u1 - u0)`]); + (MATCH_MP_TAC REAL_LT_MUL); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 < a - b - c <=> b + c < a`]); + + (NEW_GOAL `t2 * norm (u1 - u0) < a * t2 * norm (u1 - u0:real^3)`); + (REWRITE_TAC[REAL_ARITH `a * b < c * a * b <=> &0 < (--a) * b * (&1 - c)`]); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `a - b = vec 0 <=> b = a`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `&0 < a - b <=> b < a`] THEN EXPAND_TAC "a"); + (REWRITE_WITH `hl (vl:(real^3)list) / sqrt (&2) < &1 <=> hl vl < &1 * sqrt (&2) `); + (MATCH_MP_TAC REAL_LT_LDIV_EQ); + (MATCH_MP_TAC SQRT_POS_LT); + (REAL_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_MUL_LID]); + + (NEW_GOAL `a * t2 * norm (u1 - u0) + t5 * a * norm (z - u0) <= + a * norm (t2 % (u1 - u0) + t5 % (z - u0:real^3))`); + (REWRITE_TAC[REAL_ARITH + `a * t2 * norm (u1 - u0) + t5 * a * norm (z - u0) <= + a * norm (t2 % (u1 - u0) + t5 % (z - u0)) <=> + &0 <= a * (norm (t2 % (u1 - u0) + t5 % (z - u0)) + (--t2 * norm (u1 - u0)) - t5 * norm (z - u0))`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (EXPAND_TAC "a"); + (REWRITE_WITH `hl (vl:(real^3)list) = dist (s1, u1:real^3)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `s1:real^3 = circumcenter (set_of_list vl)`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `!w:real^3. w IN set_of_list vl + ==> dist (circumcenter (set_of_list vl),w) = hl vl`); + (MATCH_MP_TAC Rogers.HL_PROPERTIES); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "vl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "vl"); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list]); + (SET_TAC[]); + + (MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_SIMP_TAC[SQRT_POS_LE; REAL_ARITH `&0 <= &2`]); + + (ONCE_REWRITE_TAC[REAL_ARITH `&0 <= a + b - c <=> c <= a + b`]); + (ABBREV_TAC `k1 = t2 % (u1 - u0) + t5 % (z - u0:real^3)`); + (REWRITE_WITH `t5 * norm (z - u0) = norm (t5 % (z - u0:real^3))`); + (REWRITE_TAC[NORM_MUL]); + (REWRITE_WITH `abs t5 = t5`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `--t2 * norm (u1 - u0) = norm ((--t2) % (u1 - u0:real^3))`); + (REWRITE_TAC[NORM_MUL]); + (REWRITE_WITH `abs (--t2) = --t2`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `t5 % (z - u0) = k1 + --t2 % (u1 - u0:real^3)`); + (EXPAND_TAC "k1" THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_TRIANGLE]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + + (ASM_REAL_ARITH_TAC); + +(* ------------------------------------------------------------------------ *) + + (NEW_GOAL `t3 = &0 /\ t4 = &0`); + (ASM_REAL_ARITH_TAC); + + (ASM_CASES_TAC `t1 < &0`); + (NEW_GOAL `F`); + (UNDISCH_TAC `x:real^3 IN rcone_ge u1 u0 a`); + (REWRITE_TAC[rcone_ge;rconesgn; IN; IN_ELIM_THM]); + (REWRITE_TAC[REAL_ARITH `~(a >= b) <=> a < b`]); + + (REWRITE_TAC[dist]); + (REWRITE_WITH `x - u1 = t1 % (u0 - u1:real^3)`); + (REWRITE_WITH `x - u1 = x - (t1 + t2) % u1:real^3`); + (REWRITE_WITH `t1 + t2 = &1`); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + + (REWRITE_TAC[DOT_LMUL;GSYM NORM_POW_2]); + (NEW_GOAL `t1 * norm (u0 - u1:real^3) pow 2 < &0`); + (REWRITE_TAC[REAL_ARITH `a * b < &0 <=> &0 < (--a) * b`]); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT; NORM_EQ_0]); + (ASM_REWRITE_TAC[VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + + (NEW_GOAL `&0 <= norm (t1 % (u0 - u1:real^3)) * norm (u0 - u1) * a`); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (EXPAND_TAC "a"); + (REWRITE_WITH `hl (vl:(real^3)list) = + dist (circumcenter (set_of_list vl),HD vl)`); + (MATCH_MP_TAC Rogers.HL_EQ_DIST0); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "vl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[DIST_POS_LE]); + (SIMP_TAC[SQRT_POS_LE; REAL_ARITH `&0 <= &2`]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `t2 < &0`); + (NEW_GOAL `F`); + (UNDISCH_TAC `x:real^3 IN rcone_ge u0 u1 a`); + (REWRITE_TAC[rcone_ge;rconesgn; IN; IN_ELIM_THM]); + (REWRITE_TAC[REAL_ARITH `~(a >= b) <=> a < b`]); + + (REWRITE_TAC[dist]); + (REWRITE_WITH `x - u0 = t2 % (u1 - u0:real^3)`); + (REWRITE_WITH `x - u0 = x - (t1 + t2) % u0:real^3`); + (REWRITE_WITH `t1 + t2 = &1`); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + + (REWRITE_TAC[DOT_LMUL;GSYM NORM_POW_2]); + (NEW_GOAL `t2 * norm (u1 - u0:real^3) pow 2 < &0`); + (REWRITE_TAC[REAL_ARITH `a * b < &0 <=> &0 < (--a) * b`]); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT; NORM_EQ_0]); + (ASM_REWRITE_TAC[VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + + (NEW_GOAL `&0 <= norm (t2 % (u1 - u0:real^3)) * norm (u1 - u0) * a`); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (EXPAND_TAC "a"); + (REWRITE_WITH `hl (vl:(real^3)list) = + dist (circumcenter (set_of_list vl),HD vl)`); + (MATCH_MP_TAC Rogers.HL_EQ_DIST0); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "vl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[DIST_POS_LE]); + (SIMP_TAC[SQRT_POS_LE; REAL_ARITH `&0 <= &2`]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + + (ASM_REAL_ARITH_TAC); + + (REWRITE_TAC[CONVEX_HULL_4; IN; IN_ELIM_THM]); + (NEW_GOAL `between m (s2, s3:real^3)`); + (ASM_CASES_TAC `hl (truncate_simplex 2 (ul:(real^3)list)) >= sqrt (&2)`); + (EXPAND_TAC "m"); + (REWRITE_TAC[mxi]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[BETWEEN_REFL]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (NEW_GOAL `?s. between s (omega_list_n V ul 2,omega_list_n V ul 3) /\ + dist (u0,s) = sqrt (&2) /\ + mxi V ul = s`); + (MATCH_MP_TAC MXI_EXPLICIT); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (REWRITE_TAC[REAL_ARITH `a < b <=> ~(a >= b)`]); + (ASM_REWRITE_TAC[]); + (FIRST_ASSUM CHOOSE_TAC THEN UP_ASM_TAC); + (ASM_REWRITE_TAC[] THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (UP_ASM_TAC THEN REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real`); + (EXISTS_TAC `t3 * u` THEN EXISTS_TAC `t3 * v + t4`); + (ASM_SIMP_TAC[REAL_LE_MUL; REAL_LE_ADD]); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `t1 + t2 + t3 * u + t3 * v + t4 = + t1 + t2 + t3 * (u + v) + t4`]); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (VECTOR_ARITH_TAC); + (SET_TAC[])]);; + +(* Finished *) + +end;; diff --git a/text_formalization/packing/QZYZMJC.hl b/text_formalization/packing/QZYZMJC.hl new file mode 100644 index 0000000..742f84c --- /dev/null +++ b/text_formalization/packing/QZYZMJC.hl @@ -0,0 +1,1111 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: QZYZMJC *) +(* Chaper : Packing (Marchal cells) *) +(* *) +(* ========================================================================= *) + + +(* ========================================================================= *) +(* The lemma statement has been corrected *) + +module Qzyzmjc = struct + + +open Rogers;; +open Vukhacky_tactics;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Sphere;; +open Marchal_cells;; +open Emnwuus;; +open Marchal_cells_2_new;; +open Lepjbdj;; +open Hdtfnfz;; +open Urrphbz1;; +open Sltstlo;; +open Qzksykg;; +open Rvfxzbu;; +open Ddzuphj;; +open Urrphbz2;; +open Ajripqn;; + +let QZYZMJC1_concl = +`!V v X. + saturated V /\ packing V /\ v IN V + ==> sum {X | mcell_set V X /\ v IN VX V X} (\t. sol v t) = &4 * pi`;; + +(* ========================================================================= *) +(* Lemma 1 *) +let mcell_set_2 = prove_by_refinement ( + `!V:real^3->bool. mcell_set V = + {X | ?i ul. X = mcell i V ul /\ ul IN barV V 3 /\ i <= 4}`, + +[(REWRITE_TAC[mcell_set] THEN GEN_TAC); + (MATCH_MP_TAC (SET_RULE `A SUBSET B /\ B SUBSET A ==> B = A`)); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[SUBSET;IN;IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_CASES_TAC `i <= 4`); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `ul:(real^3)list`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `4:num` THEN EXISTS_TAC `ul:(real^3)list`); + (ASM_REWRITE_TAC[ARITH_RULE `4 <= 4`]); + (ASM_SIMP_TAC [MCELL_EXPLICIT; ARITH_RULE `~(i <= 4) ==> (i >= 4)`; + ARITH_RULE `4 >= 4`])]);; + +(* ========================================================================= *) +(* Lemma 2 *) +let BARV_3_IMP_FINITE_lemma1 = prove_by_refinement( + `!V ul u v. + packing V /\ saturated V /\ barV V 3 ul /\ {u, v} SUBSET set_of_list ul + ==> dist (u,v) < &4`, +[(REPEAT STRIP_TAC); + + (NEW_GOAL `?a. voronoi_list V ul = {a} /\ + a = circumcenter (set_of_list ul) /\ + hl ul = dist (HD ul,a)`); + (MATCH_MP_TAC VORONOI_LIST_3_SINGLETON_EXPLICIT); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `!s. s IN set_of_list ul ==> dist (a, s:real^3) < &2`); + (REPEAT STRIP_TAC); + (NEW_GOAL `?y. y IN V /\ dist (a,y:real^3) < &2`); + (ASM_MESON_TAC[saturated]); + (UP_ASM_TAC THEN STRIP_TAC); + (SUBGOAL_THEN `a IN voronoi_list V ul` MP_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; voronoi_closed; IN_INTERS]); + (STRIP_TAC); + (NEW_GOAL `a IN {x | !w. V w ==> dist (x,s:real^3) <= dist (x,w)}`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN; IN_ELIM_THM] THEN STRIP_TAC); + (NEW_GOAL `dist (a,s) <= dist (a, y:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `dist (u, v:real^3) <= dist (u,a) + dist (a,v)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (u,a:real^3) < &2`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (NEW_GOAL `dist (a,v:real^3) < &2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + +(* ========================================================================= *) +(* Lemma 3 *) +let BARV_3_IMP_FINITE_lemma2 = prove_by_refinement ( + `!V ul v k. packing V /\ saturated V /\ barV V 3 ul /\ v IN set_of_list ul + ==> set_of_list ul SUBSET ball (v, &4)`, +[(REWRITE_TAC[SUBSET; ball; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (MATCH_MP_TAC BARV_3_IMP_FINITE_lemma1); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `ul:(real^3)list`); + (ASM_REWRITE_TAC[] THEN ASM_SET_TAC[])]);; +(* ========================================================================= *) +(* Lemma 4 *) + +let lemma_r_r'_fix2 = prove_by_refinement ( + `!C x r s. + measurable C /\ radial_norm r x C /\ s > &0 /\ s <= r + ==> measurable (C INTER normball x s) /\ + vol (C INTER normball x s) = vol C * (s / r) pow 3 `, +[(REPEAT GEN_TAC); + (ASM_CASES_TAC `s < r`); + (ASM_MESON_TAC[Vol1.lemma_r_r'_fix]); + (STRIP_TAC); + (NEW_GOAL `s = r:real`); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `C INTER normball x r = C:real^3->bool`); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> A INTER B = A`)); + (UNDISCH_TAC `radial_norm r (x:real^3) C`); + (REWRITE_TAC[GSYM RADIAL_VS_RADIAL_NORM; radial; NORMBALL_BALL] THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `r / r = &1`); + (MATCH_MP_TAC REAL_DIV_REFL THEN ASM_REAL_ARITH_TAC); + (REAL_ARITH_TAC)]);; + +(* ========================================================================= *) +(* Lemma 5 *) +let MCELL_SET_NOT_EMPTY = prove_by_refinement ( + `!V v X. + saturated V /\ packing V /\ v IN V + ==> ~({X | mcell_set V X /\ ~NULLSET X /\ v IN V INTER X} = {})`, + +[(REWRITE_TAC[mcell_set; SET_RULE `~(s = {}) <=> (?x. x IN s)`; IN; + IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (ASM_CASES_TAC `!i ul. 1 <= i /\ i <= 4 /\ barV V 3 ul /\ + truncate_simplex 0 ul = [v] ==> + negligible (mcell i V ul)`); + (NEW_GOAL `!vl. barV V 3 vl /\ + truncate_simplex 0 vl = [v] ==> + negligible (rogers V vl INTER ball (v, sqrt (&2)))`); + (REPEAT STRIP_TAC); + + (NEW_GOAL `vol (rogers V vl) <= + vol (UNIONS {x | ?i. i <= 4 /\ x = mcell i V vl})`); + (MATCH_MP_TAC MEASURE_SUBSET); + (STRIP_TAC); + (MATCH_MP_TAC MEASURABLE_ROGERS); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (MATCH_MP_TAC MEASURABLE_UNIONS); + (STRIP_TAC); + (REWRITE_TAC[GSYM IN_NUMSEG_0]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (REWRITE_TAC[FINITE_NUMSEG]); + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[] THEN MATCH_MP_TAC MEASURABLE_MCELL); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[SUBSET]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[IN_UNIONS; IN;IN_ELIM_THM]); + + (NEW_GOAL `?i. i <= 4 /\ x IN mcell i V vl`); + (MATCH_MP_TAC SLTSTLO1); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `mcell i V vl`); + (STRIP_TAC); + (EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN]); + + + (UP_ASM_TAC THEN REWRITE_WITH + `UNIONS {x | ?i. i <= 4 /\ x = mcell i V vl} = + UNIONS {x | ?i. 1 <= i /\ i <= 4 /\ x = mcell i V vl} UNION (mcell 0 V vl)`); + (ONCE_REWRITE_TAC[SET_EQ_LEMMA] THEN REWRITE_TAC[SUBSET; IN; IN_ELIM_THM; IN_UNIONS; IN_UNION]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `i = 0`); + (DISJ2_TAC); + (ASM_SET_TAC[]); + (DISJ1_TAC); + (EXISTS_TAC `t:real^3->bool`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `i:num` THEN ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC); + (EXISTS_TAC `t:real^3->bool`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `i:num` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `mcell 0 V vl`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `0` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (ABBREV_TAC `S1 = UNIONS {x | ?i. 1 <= i /\ i <= 4 /\ x = mcell i V vl}`); + (REWRITE_WITH `vol (S1 UNION mcell 0 V vl) = + vol (S1) + vol (mcell 0 V vl) - vol (S1 INTER mcell 0 V vl)`); + (MATCH_MP_TAC MEASURE_UNION); + (STRIP_TAC); + (EXPAND_TAC "S1" THEN MATCH_MP_TAC MEASURABLE_UNIONS); + (STRIP_TAC); + (REWRITE_TAC[SET_RULE `A /\ B /\ C <=> (A /\ B) /\ C`]); + (REWRITE_TAC[GSYM IN_NUMSEG]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (REWRITE_TAC[FINITE_NUMSEG]); + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[] THEN MATCH_MP_TAC MEASURABLE_MCELL); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_MCELL); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `vol S1 = &0`); + + (MATCH_MP_TAC MEASURE_EQ_0); + (EXPAND_TAC "S1" THEN MATCH_MP_TAC NEGLIGIBLE_UNIONS); + (STRIP_TAC); + (REWRITE_TAC[SET_RULE `A /\ B /\ C <=> (A /\ B) /\ C`]); + (REWRITE_TAC[GSYM IN_NUMSEG]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (REWRITE_TAC[FINITE_NUMSEG]); + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `vol (S1 INTER mcell 0 V vl) = &0`); + (MATCH_MP_TAC MEASURE_EQ_0); + (MATCH_MP_TAC NEGLIGIBLE_INTER); + (DISJ1_TAC); + (REWRITE_WITH `NULLSET S1 <=> vol S1 = &0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC MEASURABLE_MEASURE_EQ_0); + + (EXPAND_TAC "S1" THEN MATCH_MP_TAC MEASURABLE_UNIONS); + (STRIP_TAC); + (REWRITE_TAC[SET_RULE `A /\ B /\ C <=> (A /\ B) /\ C`]); + (REWRITE_TAC[GSYM IN_NUMSEG]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (REWRITE_TAC[FINITE_NUMSEG]); + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[] THEN MATCH_MP_TAC MEASURABLE_MCELL); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[REAL_ARITH `&0 + a - &0 = a`]); + + (ABBREV_TAC `S2 = rogers V vl INTER ball (v,sqrt (&2))`); + (ABBREV_TAC `S3 = rogers V vl DIFF ball (v,sqrt (&2))`); + (REWRITE_WITH `mcell 0 V vl = S3`); + (REWRITE_TAC[mcell0; MCELL_EXPLICIT]); + (EXPAND_TAC "S3"); + (REWRITE_WITH `HD vl = v:real^3`); + (REWRITE_WITH `HD (vl:(real^3)list) = HD (truncate_simplex 0 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (NEW_GOAL `?u0 u1 u2 u3. vl = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `rogers V vl = S2 UNION S3`); + (ASM_SET_TAC[]); + (REWRITE_WITH `vol (S2 UNION S3) = vol (S2) + vol (S3) - vol (S2 INTER S3)`); + (MATCH_MP_TAC MEASURE_UNION); + (EXPAND_TAC "S2" THEN EXPAND_TAC "S3"); + (STRIP_TAC); + (MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[MEASURABLE_BALL]); + (MATCH_MP_TAC MEASURABLE_ROGERS); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_DIFF); + (REWRITE_TAC[MEASURABLE_BALL]); + (MATCH_MP_TAC MEASURABLE_ROGERS); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `S2 INTER S3 = {}:real^3->bool`); + (ASM_SET_TAC[]); + (REWRITE_TAC[MEASURE_EMPTY; REAL_ARITH `a + b - &0 <= b <=> a <= &0`]); + (NEW_GOAL `&0 <= vol S2`); + (MATCH_MP_TAC MEASURE_POS_LE); + + (EXPAND_TAC "S2" THEN MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[MEASURABLE_BALL]); + (MATCH_MP_TAC MEASURABLE_ROGERS THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (REWRITE_WITH `NULLSET S2 <=> vol S2 = &0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC MEASURABLE_MEASURE_EQ_0); + (EXPAND_TAC "S2" THEN MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[MEASURABLE_BALL]); + (MATCH_MP_TAC MEASURABLE_ROGERS THEN ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `voronoi_closed V v = + UNIONS {y| ?vl. vl IN barV V 3 /\ + y = rogers V vl /\ + truncate_simplex 0 vl = [v:real^3]}`); + (ONCE_REWRITE_TAC[SET_RULE `s = t <=> (!x. x IN s <=> x IN t)`]); + + (REWRITE_WITH `!x. x IN voronoi_closed V v <=> + (?vl. vl IN barV V 3 /\ + x IN rogers V vl /\ + truncate_simplex 0 vl = [v])`); + (GEN_TAC THEN MATCH_MP_TAC GLTVHUM); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (REWRITE_TAC[IN_UNIONS; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EQ_TAC); + (REPEAT STRIP_TAC); + (EXISTS_TAC `rogers V vl` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `vl:(real^3)list` THEN ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `vl:(real^3)list` THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + + (NEW_GOAL `voronoi_closed V v INTER ball (v,sqrt (&2)) = + UNIONS + {y | ?vl. vl IN barV V 3 /\ + y = rogers V vl INTER ball (v,sqrt (&2)) /\ + truncate_simplex 0 vl = [v]}`); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_EQ_LEMMA]); + (REWRITE_TAC[IN_INTER; IN_UNIONS]); + (ONCE_REWRITE_TAC[IN]); + (REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (EXISTS_TAC `rogers V vl INTER ball (v,sqrt (&2))`); + (STRIP_TAC); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[MESON[IN] `(a INTER b) x <=> x IN (a INTER b)`]); + (ASM_SIMP_TAC[IN_INTER]); + (ASM_SET_TAC[]); + + (EXISTS_TAC `rogers V vl`); + (STRIP_TAC); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + + (NEW_GOAL `NULLSET (voronoi_closed V v INTER ball (v,sqrt (&2)))`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_UNIONS); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + + (ABBREV_TAC `s2 = V INTER ball (v:real^3, &4)`); + (ABBREV_TAC `s3 = {ul | ?u0 u1 u2 u3. + u0 IN s2 /\ + u1 IN s2 /\ + u2 IN s2 /\ + u3 IN s2 /\ + ul = [u0; u1; u2; u3:real^3]}`); + (ABBREV_TAC `f = (\t. rogers V t INTER ball (v:real^3,sqrt (&2)))`); + (MATCH_MP_TAC FINITE_SUBSET); + + (EXISTS_TAC `{y | ?vl. vl IN s3 /\y = (f:((real^3)list)->real^3->bool) vl}`); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (EXPAND_TAC "s3"); + (MATCH_MP_TAC FINITE_SET_LIST_LEMMA); + (EXPAND_TAC "s2"); + (MATCH_MP_TAC Pack1.KIUMVTC); + (ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + + (EXPAND_TAC "f" THEN EXPAND_TAC "s3"); + (REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (NEW_GOAL `?u0 u1 u2 u3. vl = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `!s:real^3. s IN set_of_list vl ==> s IN s2`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "s2"); + + (NEW_GOAL `set_of_list vl SUBSET (V INTER ball (v:real^3, &4))`); + (REWRITE_TAC[SUBSET_INTER]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `v = HD [v:real^3]`); + (REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[ASSUME `v = HD [v:real^3]`]); + (REWRITE_TAC[GSYM (ASSUME `truncate_simplex 0 vl = [v:real^3]`)]); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_0; HD;set_of_list]); + (SET_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[]); + + (NEW_GOAL `NULLSET (ball (v, &1))`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `voronoi_closed V v INTER ball (v:real^3,sqrt (&2))`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[SUBSET; IN_INTER; IN_BALL; voronoi_closed]); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `w = v:real^3`); + (ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + (NEW_GOAL `dist (v,w) <= dist (v, x) + dist (x, w:real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `&2 <= dist (v,w:real^3)`); + (UNDISCH_TAC `packing (V:real^3->bool)`); + (REWRITE_TAC[packing] THEN STRIP_TAC THEN FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (REWRITE_WITH `dist (x,v) = dist (v,x:real^3)`); + (REWRITE_TAC[DIST_SYM]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `&1 < sqrt (&2)`); + (REWRITE_WITH `&1 < sqrt (&2) <=> &1 pow 2 < sqrt (&2) pow 2`); + (MATCH_MP_TAC Pack1.bp_bdt); + (ASM_SIMP_TAC[SQRT_POS_LE; REAL_ARITH `&0 <= &1 /\ &0 <= &2`]); + (ASM_SIMP_TAC[SQRT_POW_2; REAL_ARITH `&0 <= &2`]); + (REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `vol (ball (v, &1)) = &4 / &3 * pi * (&1) pow 3`); + (ASM_SIMP_TAC[REAL_ARITH `&0 <= &1`; VOLUME_BALL]); + (NEW_GOAL `vol (ball (v, &1)) > &0`); + (ASM_REWRITE_TAC[REAL_ARITH `&4 / &3 * pi * &1 pow 3 > &0 <=> + &0 < &4 / &3 * pi`]); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LT_DIV THEN REAL_ARITH_TAC); + (REWRITE_TAC[PI_POS]); + + (NEW_GOAL `vol (ball (v,&1)) = &0`); + (REWRITE_WITH `vol (ball (v,&1)) = &0 <=> NULLSET (ball (v,&1))`); + (MATCH_MP_TAC MEASURABLE_MEASURE_EQ_0); + (REWRITE_TAC[MEASURABLE_BALL]); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + + (UP_ASM_TAC THEN REWRITE_TAC[SET_RULE + `~(!i ul. 1 <= i /\ i <= 4 /\ barV V 3 ul /\ truncate_simplex 0 ul = [v] + ==> NULLSET (mcell i V ul)) <=> + (?i ul. 1 <= i /\ i <= 4 /\ barV V 3 ul /\ truncate_simplex 0 ul = [v] /\ + ~NULLSET (mcell i V ul))`]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `mcell i V ul`); + (REPEAT STRIP_TAC); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `ul:(real^3)list`); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `V INTER mcell i V ul = + set_of_list (truncate_simplex (i - 1) ul)`); + (MATCH_MP_TAC LEPJBDJ); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul) ` THEN + ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `set_of_list (truncate_simplex 0 ul) SUBSET + set_of_list (truncate_simplex (i-1) (ul:(real^3)list))`); + (MATCH_MP_TAC Rogers.TRUNCATE_SIMPLEX_SUBSET); + (ASM_REWRITE_TAC[LENGTH] THEN ASM_ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_0; set_of_list]); + (SET_TAC[])]);; + +(* ======================================================================= *) +(* Main theorem *) +(* ======================================================================= *) + + +let QZYZMJC = prove_by_refinement ( QZYZMJC1_concl, + +[(REPEAT STRIP_TAC); + +(* Simplify the set *) + (REWRITE_WITH + `{X | mcell_set V X /\ v IN VX V X} = + {X | mcell_set V X /\ ~(negligible X) /\ v IN V INTER X}`); + (REWRITE_TAC[SET_EQ_LEMMA]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (STRIP_TAC); + (ASM_SET_TAC[]); + (NEW_GOAL `v IN VX V x`); + (ASM_SET_TAC[]); + (UP_ASM_TAC); + (ASM_CASES_TAC `negligible (x:real^3->bool)`); + (REWRITE_TAC[VX]); + (COND_CASES_TAC); + (SET_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (NEW_GOAL `x IN mcell_set V`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[mcell_set;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_MESON_TAC[]); + (REWRITE_WITH `V INTER x = VX V x`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[IN; IN_ELIM_THM] THEN STRIP_TAC); + (ASM_SET_TAC[]); + (REWRITE_WITH `VX V x = V INTER x`); + (MATCH_MP_TAC HDTFNFZ); + (NEW_GOAL `x IN mcell_set V`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[mcell_set;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `x = mcell i V ul`)] THEN ASM_SET_TAC[]); + (REWRITE_TAC[MESON [IN] `(V INTER x) v <=> v IN V INTER x`]); + (ASM_SET_TAC[]); + (* finish simplifyng the set *) + +(* -------------------------------------------------------------------------- *) +(* begin to prove the set is finite *) + + + (NEW_GOAL `FINITE {X | mcell_set V X /\ v IN V INTER X}`); + (REWRITE_TAC[mcell_set_2; IN_ELIM_THM]); + (ABBREV_TAC `s = {(i, ul)| barV V 3 ul /\ v IN V INTER mcell i V ul /\ i <= 4}`); + (ABBREV_TAC `f = (\x:num#(real^3)list. mcell (FST x) V (SND x))`); + + (REWRITE_WITH + `{X |(?i ul. X = mcell i V ul /\ ul IN barV V 3/\ i <= 4) /\ v IN V INTER X} + = {X | ?y:num#(real^3)list. y IN s /\ X = f y}`); + + (EXPAND_TAC "s" THEN EXPAND_TAC "f"); + (ONCE_REWRITE_TAC[SET_EQ_LEMMA] THEN ONCE_REWRITE_TAC[IN]); + (REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `(i:num, ul:(real^3)list)`); + (ASM_REWRITE_TAC[FST;SND]); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `ul:(real^3)list`); + (REWRITE_TAC[GSYM (ASSUME `x = mcell i V ul`)]); + (ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `ul:(real^3)list`); + (ASM_REWRITE_TAC[IN]); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (EXPAND_TAC "s"); + (ABBREV_TAC `s1 = {0,1,2,3,4}`); + (ABBREV_TAC `s2 = V INTER ball (v:real^3, &4)`); + (ABBREV_TAC `s3 = {ul | ?u0 u1 u2 u3. + u0 IN s2 /\ + u1 IN s2 /\ + u2 IN s2 /\ + u3 IN s2 /\ + ul = [u0; u1; u2; u3:real^3]}`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{(i:num, ul:(real^3)list)| i IN s1 /\ ul IN s3}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_PRODUCT); + (EXPAND_TAC "s1" THEN EXPAND_TAC "s3"); + (REWRITE_TAC[Geomdetail.FINITE6]); + (MATCH_MP_TAC FINITE_SET_LIST_LEMMA); + (EXPAND_TAC "s2" THEN MATCH_MP_TAC Pack1.KIUMVTC); + (ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + (EXPAND_TAC "s1" THEN EXPAND_TAC "s3" THEN REWRITE_TAC[SUBSET]); + (ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `ul:(real^3)list`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[SET_RULE `i IN {0,1,2,3,4} <=> i = 0\/i=1\/i=2\/i=3\/i=4`]); + (ASM_ARITH_TAC); + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `!s:real^3. s IN set_of_list ul ==> s IN s2`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "s2"); + + (NEW_GOAL `set_of_list ul SUBSET (V INTER ball (v:real^3, &4))`); + (REWRITE_TAC[SUBSET_INTER]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `V INTER mcell i V ul = set_of_list(truncate_simplex (i - 1) ul)`); + (MATCH_MP_TAC LEPJBDJ); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_CASES_TAC `i = 0`); + (UNDISCH_TAC `v IN V INTER mcell i V ul`); + (REWRITE_TAC[ASSUME `i = 0`; MCELL_EXPLICIT; mcell0; IN_INTER; IN_DIFF]); + (REPEAT STRIP_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `v:real^3 = HD ul`); + (MATCH_MP_TAC Marchal_cells_2_new.ROGERS_INTER_V_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (REWRITE_TAC[MESON[IN] `rogers V ul v <=> v IN rogers V ul`]); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `~(v:real^3 IN ball (HD ul,sqrt (&2)))`); + (ASM_REWRITE_TAC[IN_BALL; DIST_REFL]); + (ASM_SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (ASM_SET_TAC[]); + + (NEW_GOAL `set_of_list (truncate_simplex (i - 1) ul) SUBSET + set_of_list (ul:(real^3)list)`); + (MATCH_MP_TAC Rogers.SET_OF_LIST_TRUNCATE_SIMPLEX_SUBSET); + (ASM_REWRITE_TAC[LENGTH] THEN ASM_ARITH_TAC); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (ASM_SET_TAC[]); + + (ASM_SET_TAC[]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + +(* finish to prove the set is finite *) +(* -------------------------------------------------------------------------- *) + + (NEW_GOAL `FINITE {X | mcell_set V X /\ ~NULLSET X /\ v IN V INTER X}`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | mcell_set V X /\ v IN V INTER X}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + + (ABBREV_TAC `S = {X | mcell_set V X /\ ~NULLSET X /\ v IN V INTER X}`); + (ABBREV_TAC + `P = (\X r. X IN S ==> r > &0 /\ radial r v (X INTER ball (v:real^3,r)))`); + (NEW_GOAL `?f:(real^3->bool)->real. (!X:real^3->bool. P X (f X))`); + (REWRITE_TAC[GSYM SKOLEM_THM]); + (EXPAND_TAC "P"); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `X:real^3 ->bool IN S`); + (NEW_GOAL `?c. c > &0 /\ radial c v (X INTER ball (v:real^3,c))`); + (REWRITE_TAC[GSYM eventually_radial]); + (UP_ASM_TAC THEN EXPAND_TAC "S" THEN REWRITE_TAC[IN;IN_ELIM_THM;mcell_set]); + (REPEAT STRIP_TAC); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC URRPHBZ2); + (ASM_REWRITE_TAC[] THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `c:real`); + (STRIP_TAC THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `&1`); + (STRIP_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN EXPAND_TAC "P" THEN STRIP_TAC); + (REWRITE_WITH + `sum S (\t. sol v t) = + sum S (\t. &3 * vol (t INTER normball v (f t)) / (f t) pow 3)`); + (MATCH_MP_TAC SUM_EQ); + (REWRITE_TAC[BETA_THM]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC sol); + + (ASM_SIMP_TAC[NORMBALL_BALL; GSYM RADIAL_VS_RADIAL_NORM]); + (MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[MEASURABLE_BALL]); + (UP_ASM_TAC THEN EXPAND_TAC"S" THEN REWRITE_TAC[IN;IN_ELIM_THM;mcell_set]); + (STRIP_TAC THEN ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[MEASURABLE_MCELL]); + + (NEW_GOAL `~(S:(real^3->bool)->bool = {})`); + (EXPAND_TAC "S"); + (MATCH_MP_TAC MCELL_SET_NOT_EMPTY); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?r. r > &0 /\ r < &1 /\ !x:real^3->bool. x IN S ==> r <= f x`); + (NEW_GOAL `?r. r > &0 /\ !x:real^3->bool. x IN S ==> r <= f x`); + (NEW_GOAL `?r. r IN (IMAGE f (S:(real^3->bool)->bool)) /\ + (!x. x IN (IMAGE f S) ==> r <= x)`); + (MATCH_MP_TAC INF_FINITE_LEMMA); + (STRIP_TAC); + (ASM_SIMP_TAC[FINITE_IMAGE]); + (REWRITE_TAC[IMAGE_EQ_EMPTY]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (UNDISCH_TAC `r IN IMAGE (f:(real^3->bool)->real) S`); + (REWRITE_TAC[IMAGE]); + (ONCE_REWRITE_TAC[IN]); + (REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `r:real`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IMAGE; IN; IN_ELIM_THM]); + (EXISTS_TAC `x':real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `min r (inv(&2))`); + (NEW_GOAL `inv (&2) > &0 /\ inv (&2) < &1`); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `a > b <=> b < a`]); + (ASM_SIMP_TAC[REAL_LT_MIN]); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_SIMP_TAC[REAL_MIN_LT]); + (ASM_SIMP_TAC[REAL_MIN_LE]); + (UP_ASM_TAC THEN STRIP_TAC); + + (REWRITE_WITH + `sum S (\t. &3 * vol (t INTER normball v (f t)) / f t pow 3) + = sum S (\t. &3 * vol (t INTER normball (v:real^3) r) / r pow 3)`); + (MATCH_MP_TAC SUM_EQ); + (REWRITE_TAC[BETA_THM] THEN REPEAT STRIP_TAC); + (ABBREV_TAC `C:real^3->bool = x INTER normball v (f x)`); + (REWRITE_WITH `x INTER normball v r = C INTER normball (v:real^3) r`); + (EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> x INTER A = (x INTER B) INTER A`)); + (REWRITE_TAC[normball; SUBSET;IN;IN_ELIM_THM]); + (NEW_GOAL `r <= f (x:real^3->bool)`); + (ASM_SIMP_TAC[]); + (ASM_REAL_ARITH_TAC); + + (REWRITE_WITH `measurable (C INTER normball v r) /\ + vol (C INTER normball v r) = + vol C * (r / f (x:real^3->bool)) pow 3`); + (MATCH_MP_TAC lemma_r_r'_fix2); + (EXPAND_TAC "C" THEN REPEAT STRIP_TAC); + (MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[NORMBALL_BALL; MEASURABLE_BALL]); + (UNDISCH_TAC `x:real^3->bool IN S` THEN EXPAND_TAC "S"); + (REWRITE_TAC[mcell_set;IN;IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[MEASURABLE_MCELL]); + (REWRITE_TAC[NORMBALL_BALL; GSYM RADIAL_VS_RADIAL_NORM]); + (ASM_SIMP_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[]); + + (REWRITE_TAC[REAL_POW_DIV]); + (REWRITE_TAC[REAL_ARITH `a * (b * c / d) / c = (a * b / d) * (c / c)`]); + (REWRITE_WITH `r pow 3 / r pow 3 = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (MATCH_MP_TAC Real_ext.REAL_PROP_NZ_POW); + (ASM_REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (REWRITE_WITH + `sum S (\t:real^3->bool. &3 * vol (t INTER normball v r) / r pow 3) = + sum S (\t. (&3 / r pow 3) * vol (t INTER normball v r))`); + (MATCH_MP_TAC SUM_EQ); + (REWRITE_TAC[BETA_THM] THEN REAL_ARITH_TAC); + (REWRITE_TAC [SUM_LMUL]); + (ABBREV_TAC `g = (\t:real^3->bool. t INTER normball v r)`); + (REWRITE_WITH `sum S (\t:real^3->bool. + vol (t INTER normball v r)) = sum S (\t. vol (g t))`); + (EXPAND_TAC "g" THEN REWRITE_TAC[]); + (REWRITE_WITH `sum S (\t:real^3->bool. vol (g t)) = measure (UNIONS (IMAGE g S))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_UNIONS_IMAGE); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "g"); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[NORMBALL_BALL; MEASURABLE_BALL]); + (UNDISCH_TAC `t:real^3->bool IN S` THEN EXPAND_TAC "S"); + (REWRITE_TAC[mcell_set;IN;IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[MEASURABLE_MCELL]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `t INTER y:real^3->bool`); + (STRIP_TAC); + (ASM_CASES_TAC `negligible (t INTER y:real^3->bool)`); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `t:real^3->bool IN S` THEN UNDISCH_TAC `y:real^3->bool IN S` + THEN EXPAND_TAC "S"); + (REWRITE_TAC[mcell_set_2;IN;IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `~(t = y:real^3->bool)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `i' = i /\ mcell i' V ul' = mcell i V ul`); + (MATCH_MP_TAC AJRIPQN); + (REWRITE_TAC[GSYM (ASSUME `t = mcell i' V ul'`); + GSYM (ASSUME `y = mcell i V ul`)]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `a IN {0,1,2,3,4}<=> a=0\/a=1\/a=2\/a=3\/a=4`]); + (ASM_ARITH_TAC); + (SET_TAC[]); + + (EXPAND_TAC "g" THEN EXPAND_TAC "S" THEN REWRITE_TAC[IMAGE]); + + (NEW_GOAL `!s p:real^3->bool. + UNIONS {y| ?x. x IN s /\ y = x INTER p} = + UNIONS {y| ?x. x IN s /\ y = x} INTER p`); + (ONCE_REWRITE_TAC[SET_EQ_LEMMA]); + (REPEAT STRIP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_INTER; IN_UNIONS]); + + (ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `x' INTER p:real^3->bool`); + (STRIP_TAC); + (EXISTS_TAC `x':real^3->bool`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[MESON[IN] `(x' INTER p) x <=> x IN x' INTER p`]); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH + `UNIONS {y | ?x:real^3->bool. x IN S /\ y = x INTER normball v r} = + UNIONS {y | ?x. x IN S /\ y = x} INTER normball v r`); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ----------------------------------------------------------------------- *) +(* OK here *) + + (EXPAND_TAC "S"); + (ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (ABBREV_TAC `S1 = + UNIONS {y | ?x:real^3->bool. (mcell_set V x /\ ~NULLSET x /\ + v IN V INTER x) /\ y = x} INTER normball v r`); + (ABBREV_TAC `S2 = + UNIONS {y | ?x:real^3->bool. (mcell_set V x /\ NULLSET x /\ + v IN V INTER x) /\ y = x} INTER normball v r`); + (ABBREV_TAC `S3 = + UNIONS {y | ?x:real^3->bool. (mcell_set V x /\ v IN V INTER x) /\ y = x} + INTER normball v r`); + + (NEW_GOAL `S3 = S2 UNION S1:real^3->bool`); + (EXPAND_TAC "S1" THEN EXPAND_TAC "S2" THEN EXPAND_TAC "S3"); + (ONCE_REWRITE_TAC[SET_EQ_LEMMA] THEN REWRITE_TAC[IN_INTER; IN_UNIONS; + IN_UNION; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `negligible (x':real^3->bool)`); + (DISJ1_TAC); + (STRIP_TAC); + (EXISTS_TAC `t:real^3->bool` THEN STRIP_TAC); + (EXISTS_TAC `x':real^3->bool`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (DISJ2_TAC); + (STRIP_TAC); + (EXISTS_TAC `t:real^3->bool` THEN STRIP_TAC); + (EXISTS_TAC `x':real^3->bool`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `t:real^3->bool` THEN STRIP_TAC); + (EXISTS_TAC `x':real^3->bool`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `t:real^3->bool` THEN STRIP_TAC); + (EXISTS_TAC `x':real^3->bool`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `measure (S3:real^3->bool) = + measure S2 + measure (S1:real^3->bool) - measure (S2 INTER S1)`); + (ASM_REWRITE_TAC[] THEN MATCH_MP_TAC MEASURE_UNION); + (EXPAND_TAC "S1" THEN EXPAND_TAC "S2" THEN STRIP_TAC); + + (MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[MEASURABLE_BALL; NORMBALL_BALL]); + (MATCH_MP_TAC MEASURABLE_UNIONS); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | mcell_set V X /\ v IN V INTER X}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[SUBSET; IN_INTER; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[IN_ELIM_THM; mcell_set; IN] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_MCELL); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[MEASURABLE_BALL; NORMBALL_BALL]); + (MATCH_MP_TAC MEASURABLE_UNIONS); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | mcell_set V X /\ v IN V INTER X}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[SUBSET; IN_INTER; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[IN_ELIM_THM; mcell_set; IN] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_MCELL); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `measure (S2:real^3->bool) = &0`); + (EXPAND_TAC "S2"); + (MATCH_MP_TAC MEASURE_EQ_0); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `UNIONS {y | ?x:real^3->bool. (mcell_set V x /\ + NULLSET x /\ v IN V INTER x) /\ y = x}`); + (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]); + (MATCH_MP_TAC NEGLIGIBLE_UNIONS); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | mcell_set V X /\ v IN V INTER X}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[SUBSET; IN_INTER; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[IN_ELIM_THM; mcell_set; IN] THEN REPEAT STRIP_TAC); + (REWRITE_TAC[ASSUME `t = x:real^3->bool`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `measure (S2 INTER S1:real^3->bool) = &0`); + (MATCH_MP_TAC MEASURE_EQ_0); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `S2:real^3->bool`); + (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]); + (REWRITE_WITH `negligible S2 <=> measure (S2:real^3->bool) = &0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC MEASURABLE_MEASURE_EQ_0); + (EXPAND_TAC "S2"); + (MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[MEASURABLE_BALL; NORMBALL_BALL]); + (MATCH_MP_TAC MEASURABLE_UNIONS); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | mcell_set V X /\ v IN V INTER X}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[SUBSET; IN_INTER; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[IN_ELIM_THM; mcell_set; IN] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_MCELL); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `vol S1 = vol S3`); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `S3 = normball (v:real^3) r`); + (EXPAND_TAC "S3"); + (REWRITE_TAC[SET_RULE `A INTER B = B <=> B SUBSET A`]); + + (NEW_GOAL `normball v r SUBSET voronoi_closed V (v:real^3)`); + (REWRITE_TAC[NORMBALL_BALL; SUBSET; IN_BALL; voronoi_closed]); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (ASM_CASES_TAC `w = v:real^3`); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + + (NEW_GOAL `dist (v, w) <= dist (v, x) + dist (x, w:real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (REWRITE_WITH `dist (x,v:real^3) = dist (v, x)`); + (REWRITE_TAC[DIST_SYM]); + (NEW_GOAL `&2 <= dist (v, w:real^3)`); + (UNDISCH_TAC `packing (V:real^3->bool)` THEN REWRITE_TAC[packing] + THEN REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `voronoi_closed V (v:real^3) INTER normball v r SUBSET UNIONS + {y | ?x. (mcell_set V x /\ v IN V INTER x) /\ y = x}`); + (REWRITE_TAC[SUBSET; IN_UNIONS; IN_INTER] THEN GEN_TAC); + (REWRITE_WITH `x IN voronoi_closed V v <=> (?vl. vl IN barV V 3 /\ + x IN rogers V vl /\ + truncate_simplex 0 vl = [v:real^3])`); + (MATCH_MP_TAC GLTVHUM); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?i. i <= 4 /\ x IN mcell i V vl`); + (MATCH_MP_TAC SLTSTLO1); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `vl IN barV V 3 ` THEN REWRITE_TAC[IN]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `mcell i V vl`); + (ASM_REWRITE_TAC[mcell_set] THEN ONCE_REWRITE_TAC[IN]); + (REWRITE_TAC[IN_ELIM_THM]); + (EXISTS_TAC `mcell i V vl`); + (REWRITE_TAC[]); + (STRIP_TAC); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `i = 0`); + (UNDISCH_TAC `x IN mcell i V vl` THEN ASM_REWRITE_TAC + [MCELL_EXPLICIT; mcell0; IN_DIFF; IN_BALL]); + (NEW_GOAL `?u0 u1 u2 u3. vl = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `vl IN barV V 3 ` THEN REWRITE_TAC[IN]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `HD (vl:(real^3)list) = HD (truncate_simplex 0 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3. HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_0; HD]); + (STRIP_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `x:real^3 IN normball v r`); + (REWRITE_TAC[NORMBALL_BALL; IN_BALL]); + (NEW_GOAL `&1 < sqrt (&2)`); + (REWRITE_WITH `&1 < sqrt (&2) <=> &1 pow 2 < sqrt (&2) pow 2`); + (MATCH_MP_TAC Pack1.bp_bdt); + (ASM_SIMP_TAC[SQRT_POS_LE; REAL_ARITH `&0 <= &1 /\ &0 <= &2`]); + (ASM_SIMP_TAC[SQRT_POW_2; REAL_ARITH `&0 <= &2`]); + (REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `V INTER mcell i V vl = + set_of_list (truncate_simplex (i - 1) vl)`); + (MATCH_MP_TAC LEPJBDJ); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `vl IN barV V 3 ` THEN REWRITE_TAC[IN]); + (STRIP_TAC); + (ASM_ARITH_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `v IN V INTER mcell i V vl`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?u0 u1 u2 u3. vl = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `vl IN barV V 3 ` THEN REWRITE_TAC[IN]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `set_of_list (truncate_simplex 0 vl) SUBSET + set_of_list (truncate_simplex (i-1) (vl:(real^3)list))`); + (MATCH_MP_TAC Rogers.TRUNCATE_SIMPLEX_SUBSET); + (ASM_REWRITE_TAC[LENGTH] THEN ASM_ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_0; set_of_list]); + (SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (UP_ASM_TAC THEN REWRITE_WITH + `voronoi_closed V v INTER normball v r = normball (v:real^3) r`); + (ASM_SET_TAC[]); + + (REWRITE_TAC[NORMBALL_BALL]); + (REWRITE_WITH `vol (ball (v:real^3,r)) = &4 / &3 * pi * r pow 3`); + (MATCH_MP_TAC VOLUME_BALL); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&3 / r pow 3 * &4 / &3 * pi * r pow 3 = + (&4 * pi) * (r pow 3 / r pow 3)`]); + (REWRITE_WITH `r pow 3 / r pow 3 = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (MATCH_MP_TAC REAL_POW_NZ); + (ASM_REAL_ARITH_TAC); + (REAL_ARITH_TAC)]);; + + +end;; diff --git a/text_formalization/packing/RDWKARC.hl b/text_formalization/packing/RDWKARC.hl new file mode 100755 index 0000000..3a80ff9 --- /dev/null +++ b/text_formalization/packing/RDWKARC.hl @@ -0,0 +1,314 @@ + +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: RDWKARC *) +(* Chaper : Packing (Clusters) *) +(* *) +(* ========================================================================= *) +(* FILES NEED TO BE LOADED *) +(* UPFZBZM.hl *) +(* ========================================================================= *) + +module Rdwkarc = struct + +(* + open Sphere;; + open Pack_defs;; + open Pack_concl;; + open Vukhacky_tactics;; + open Pack1;; +*) + +open Sphere;; +open Euler_main_theorem;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Pack2;; +open Packing3;; +open Rogers;; +open Vukhacky_tactics;; +open Marchal_cells;; +open Emnwuus;; +(* open Marchal_cells_2;; *) +open Marchal_cells_2_new;; +open Urrphbz1;; +open Lepjbdj;; +open Hdtfnfz;; +open Rvfxzbu;; +open Sltstlo;; +open Urrphbz2;; +open Urrphbz3;; +open Ynhyjit;; +open Njiutiu;; +open Tezffsk;; +open Qzksykg;; +open Ddzuphj;; +open Ajripqn;; +open Qzyzmjc;; +open Upfzbzm_support_lemmas;; +open Marchal_cells_3;; +open Grutoti;; + +open Sum_gammax_lmfun_estimate;; +open Kizhltl;; +open Upfzbzm;; + +(*-------------------------------------------------------------------------- *) + +(* +let RDWKARC_concl = +`~kepler_conjecture /\ (!V. cell_cluster_estimate_v1 V) /\ TSKAJXY_statement + ==> (?V. packing V /\ V SUBSET ball_annulus /\ ~lmfun_ineq_center V)`;; +*) + +(* ------------------------------------------------------------------------- *) +(* The following lemmas are necessary for the main theorem RDWKARC *) +(* ------------------------------------------------------------------------- *) + +(* Lemma 1 *) +let JGXZYGW_KY = prove_by_refinement ( + `!S. packing S /\ + saturated S /\ + (?A. fcc_compatible A S /\ negligible_fun_0 A S) + ==> (?c. !r. &1 <= r + ==> vol + (UNIONS {ball (v,&1) | v IN S} INTER ball (vec 0,r)) / + vol (ball (vec 0,r)) <= + pi / sqrt (&18) + c / r)`, +[(MP_TAC JGXZYGW THEN DISCH_THEN (LABEL_TAC "asm1")); + GEN_TAC; + (REWRITE_TAC[negligible_fun_0]); + (USE_THEN "asm1" (MP_TAC o SPEC `S:real^3->bool`)); + (DISCH_THEN (LABEL_TAC "asm2")); + (USE_THEN "asm2" (MP_TAC o SPEC `(vec 0):real^3`)); + (MESON_TAC[])]);; + +(* ------------------------------------------------------------------------- *) +(* Lemma 2 *) +let PACKING_SUBSET = prove_by_refinement ( + `!V S. packing V /\ S SUBSET V ==> packing S`, +[(REPEAT GEN_TAC THEN REWRITE_TAC[packing;SUBSET;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC(ASSUME + `!u:real^3 v. V u /\ V v /\ ~(u = v) ==> &2 <= dist (u,v)`) ); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `V (u:real^3) /\ V v <=> u IN V /\ v IN V`); + (REWRITE_TAC[IN]); + STRIP_TAC; + (* Break into smaller subgoals *) + + (MATCH_MP_TAC(ASSUME `!(x:real^3). x IN S ==> x IN V`) ); + (ASM_REWRITE_TAC[IN]); + (MATCH_MP_TAC(ASSUME `!(x:real^3). x IN S ==> x IN V`) ); + (ASM_REWRITE_TAC[IN])]);; + + +(* ------------------------------------------------------------------------ *) +(* Lemma 3 *) +let PACKING_TRANS = prove_by_refinement ( + `! V (x:real^3). packing V ==> packing {u | (u + x) IN V}`, + +[(REPEAT GEN_TAC THEN REWRITE_TAC[packing;IN_ELIM_THM]); +(REPEAT STRIP_TAC); +(ABBREV_TAC `u' = (u:real^3) + x`); +(ABBREV_TAC `v' = (v:real^3) + x`); + (NEW_GOAL `V (u':real^3) /\ V v' /\ ~(u' = v')`); + (* New subgoal 1 *) + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[GSYM IN]); + (ASM_REWRITE_TAC[GSYM IN]); + (NEW_GOAL `u = v:real^3`); + (REPLICATE_TAC 3 UP_ASM_TAC ); + VECTOR_ARITH_TAC; + (ASM_MESON_TAC[]); + (* End subgoal 1 *) + + (REWRITE_WITH `dist (u:real^3, v) = dist (u', v':real^3)`); + (* Subgoal 2 *) + (EXPAND_TAC "u'" THEN EXPAND_TAC "v'"); + (REWRITE_TAC[dist]); + (NORM_ARITH_TAC); + (* End subgoal 2 *) + +(UP_ASM_TAC THEN ASM_REWRITE_TAC[])]);; + + +(* ------------------------------------------------------------------------- *) +(* Lemma 4 *) + +let SATURATED_TRANS = prove_by_refinement ( +`!V (x:real^3). saturated V ==> saturated {u | u + x IN V}`, + +[(REPEAT GEN_TAC THEN REWRITE_TAC[saturated]); +(DISCH_THEN (LABEL_TAC "asm1")); +(GEN_TAC); +(USE_THEN "asm1" (MP_TAC o SPEC `(x':real^3) + x`)); +(DEL_TAC THEN DISCH_TAC); +(FIRST_X_ASSUM CHOOSE_TAC); +(EXISTS_TAC `y - (x:real^3)`); +(REWRITE_TAC[IN_ELIM_THM; VECTOR_ARITH `y - x + x = (y:real^3)`]); +(ASM_REWRITE_TAC[]); + + (NEW_GOAL `dist (x',y - x) = dist (x'+ x,y:real^3)`); + (* Subgoal 1 *) + (REWRITE_TAC[dist]); + (NORM_ARITH_TAC); + (* End subgoal 1 *) + +(ASM_MESON_TAC[])]);; + + +(* ------------------------------------------------------------------------- *) +(* Lemma 5 *) + +let RADV_TRANS_EQ = prove ( + `!u v:real^3 x. ~(u = v) ==> radV {u, v} = radV {u + x, v + x}`, + REWRITE_TAC[GSYM set_of_list; GSYM HL; Marchal_cells_3.HL_2] THEN NORM_ARITH_TAC);; + +(* ========================================================================= *) +(* MAIN THEOREM RDWKARC *) +(* ========================================================================= *) + + +let RDWKARC = prove_by_refinement (Pack_concl.RDWKARC_concl, +[ + (REWRITE_TAC[kepler_conjecture]); + (REWRITE_WITH + `~(!V. packing V /\ saturated V + ==> (?c. !r. &1 <= r + ==> vol + (UNIONS {ball (v,&1) | v IN V} INTER ball (vec 0,r)) / + vol (ball (vec 0,r)) <= + pi / sqrt (&18) + c / r)) <=> + (?V. packing V /\ saturated V + /\ ~(?c. !r. &1 <= r + ==> vol + (UNIONS {ball (v,&1) | v IN V} INTER ball (vec 0,r)) / + vol (ball (vec 0,r)) <= + pi / sqrt (&18) + c / r))`); + + (MESON_TAC[]); + STRIP_TAC; + + (NEW_GOAL `~(lmfun_inequality (V:real^3->bool))`); + STRIP_TAC; + (NEW_GOAL `(?G. negligible_fun_0 G V /\ fcc_compatible G V)`); + (ASM_MESON_TAC[Upfzbzm.UPFZBZM]); + (NEW_GOAL `(?c. !r. &1 <= r + ==> vol (UNIONS {ball (v,&1) | v IN V} INTER ball (vec 0,r)) / + vol (ball (vec 0,r)) <= + pi / sqrt (&18) + c / r)`); + (MATCH_MP_TAC JGXZYGW_KY); + (ASM_REWRITE_TAC[]); + (CHOOSE_TAC (ASSUME `?G. negligible_fun_0 G V /\ fcc_compatible G V`)); + (EXISTS_TAC `G:real^3->real`); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + +(* ---------------------------------------------------------------------- *) + + (UP_ASM_TAC THEN REWRITE_TAC[lmfun_inequality]); + (REWRITE_WITH + `~(!u:real^3. u IN V + ==> sum {v | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v])) <= + &12) <=> + (?u. u IN V + /\ ~(sum {v | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v])) <= + &12))`); + (MESON_TAC[]); + (REWRITE_TAC[REAL_ARITH `~(a <= b) <=> b < a`]); + (DISCH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + + (ABBREV_TAC `V' = {v:real^3 | v + u IN V}`); + (EXISTS_TAC `V':real^3->bool INTER ball_annulus`); + (ASM_REWRITE_TAC[INTER_SUBSET]); + + (NEW_GOAL `packing (V':real^3->bool)`); + (EXPAND_TAC "V'" THEN ASM_MESON_TAC[PACKING_TRANS]); + STRIP_TAC; + (ASM_MESON_TAC[PACKING_SUBSET;INTER_SUBSET]); + +(* -------------------------------------------------------------------------- *) + + (REWRITE_TAC[lmfun_ineq_center]); + (REWRITE_TAC[REAL_ARITH `~(a <= b) <=> b < a`]); + (EXPAND_TAC "V'" THEN REWRITE_TAC[ball_annulus]); + + (REWRITE_WITH +`sum ({v | v + u IN V} INTER (cball (vec 0,&2 * h0) DIFF ball (vec 0,&2))) + (\v. lmfun (hl [vec 0; v])) = + sum {v:real^3 | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v]))`); + (MATCH_MP_TAC SUM_EQ_GENERAL_INVERSES); + (REWRITE_TAC[IN_ELIM_THM]); + (EXISTS_TAC `(\x:real^3. x + u)`); + (EXISTS_TAC `(\x:real^3. x - u)`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[IN_ELIM_THM;cball;INTER]); + (CONJ_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH `y:real^3 - u + u = y`]); + (REWRITE_TAC[DIFF;IN_ELIM_THM;ball]); + (UP_ASM_TAC THEN REWRITE_TAC[dist]); + (DISCH_TAC THEN CONJ_TAC); + (UP_ASM_TAC THEN NORM_ARITH_TAC); + (REWRITE_WITH `norm (vec 0 - (y:real^3 - u)) = dist (u,y)`); + (REWRITE_TAC[dist]); + (NORM_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `~(a < b) <=> b <= a`]); + (NEW_GOAL `V u /\ V y /\ ~(u = (y:real^3))`); + (ASM_REWRITE_TAC[]); + STRIP_TAC; + (ONCE_REWRITE_TAC[GSYM IN]); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[GSYM IN]); + (ASM_REWRITE_TAC[]); + UP_ASM_TAC; + (ASM_MESON_TAC[packing]); + (REWRITE_TAC[BETA_THM]); + VECTOR_ARITH_TAC; + (REWRITE_TAC[BETA_THM]); + (UP_ASM_TAC THEN REWRITE_TAC[INTER;IN_ELIM_THM]); + (MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_ELIM_THM]); + (REWRITE_TAC[VECTOR_ARITH `(u = x + u:real^3) <=> (x = vec 0)`]); + (UP_ASM_TAC THEN REWRITE_TAC[INTER; DIFF;IN_ELIM_THM;ball]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist(vec 0, x:real^3) = &0`); + (ASM_REWRITE_TAC[dist]); + NORM_ARITH_TAC; + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[BETA_THM;dist]); + (UP_ASM_TAC THEN REWRITE_TAC[INTER; DIFF;IN_ELIM_THM;ball]); + (REWRITE_TAC[IN_ELIM_THM;cball]); + NORM_ARITH_TAC; + (REWRITE_TAC[BETA_THM]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[BETA_THM]); + (AP_TERM_TAC); + (REWRITE_TAC[HL]); + (REWRITE_WITH `!u v:real^3. set_of_list [u; v] = {u , v}`); + (REWRITE_TAC[set_of_list]); + (UP_ASM_TAC THEN REWRITE_TAC[INTER; DIFF;IN_ELIM_THM;ball]); + (REPEAT STRIP_TAC); + (NEW_GOAL `~(x:real^3 = vec 0)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist(vec 0, x:real^3) = &0`); + (ASM_REWRITE_TAC[dist]); + NORM_ARITH_TAC; + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `radV {u:real^3, x + u} = radV {vec 0 + u, x + u}`); + (MESON_TAC[VECTOR_ARITH `!u. u = vec 0 + u`]); + (ASM_MESON_TAC[RADV_TRANS_EQ]); + (ASM_REWRITE_TAC[]) +]);; + + + +end;; diff --git a/text_formalization/packing/REUHADY.hl b/text_formalization/packing/REUHADY.hl new file mode 100644 index 0000000..308cad0 --- /dev/null +++ b/text_formalization/packing/REUHADY.hl @@ -0,0 +1,8358 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Author : VU KHAC KY *) +(* Book lemma: REUHADY *) +(* Chapter : Packing (Marchal cells) *) +(* Date : Nov 2012 *) +(* *) +(* ========================================================================= *) + +module Reuhady = struct + +open Sphere;; +open Euler_main_theorem;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Pack2;; +open Packing3;; +open Rogers;; +open Vukhacky_tactics;; +open Marchal_cells;; +open Emnwuus;; +(* open Marchal_cells_2;; *) +open Marchal_cells_2_new;; +open Urrphbz1;; +open Lepjbdj;; +open Hdtfnfz;; +open Rvfxzbu;; +open Sltstlo;; +open Urrphbz2;; +open Urrphbz3;; +open Ynhyjit;; +open Njiutiu;; +open Tezffsk;; +open Qzksykg;; +open Ddzuphj;; +open Ajripqn;; +open Qzyzmjc;; +open Upfzbzm_support_lemmas;; +open Marchal_cells_3;; +open Grutoti;; +open Kizhltl;; +open Sum_gammax_lmfun_estimate;; +open Upfzbzm;; +open Rdwkarc;; +open Ineq;; +open Merge_ineq;; +open Hales_tactic;; + + +let wedge_ge = new_definition `wedge_ge v0 v1 w1 w2 = { z | +&0 <= azim v0 v1 w1 z /\ azim v0 v1 w1 z <= azim v0 v1 w1 w2 }`;; + +let BARV_2_IMP_NOT_COLLINEAR_SET_OF_LIST = prove_by_refinement ( + `!V ul. packing V /\ barV V 2 ul ==> + ~collinear (set_of_list ul)`, +[(REWRITE_TAC[COLLINEAR_AFF_DIM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `aff_dim (set_of_list (ul:(real^3)list)) = &2`); + (MATCH_MP_TAC MHFTTZN1); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC)]);; + +(* ========================================================================= *) +(* ==== Harrison lemmas about WEDGE_GE ===== *) +(* ========================================================================= *) + +let WEDGE_SIMPLE = prove + (`!v0 v1 w1 w2. + wedge v0 v1 w1 w2 = + {y | &0 < azim v0 v1 w1 y /\ azim v0 v1 w1 y < azim v0 v1 w1 w2}`, + REPEAT GEN_TAC THEN REWRITE_TAC[wedge] THEN + MATCH_MP_TAC(SET_RULE + `(!x. P x ==> ~Q x) ==> {x | ~P x /\ Q x /\ R x} = {x | Q x /\ R x}`) THEN + SIMP_TAC[AZIM_DEGENERATE; REAL_LT_REFL]);; + +let WEDGE_GE_WEDGE = prove + (`!v0 v1 w1 w2. + wedge_ge v0 v1 w1 w2 = + wedge v0 v1 w1 w2 UNION + {z | azim v0 v1 w1 z = &0} UNION + {z | azim v0 v1 w1 z = azim v0 v1 w1 w2}`, + REWRITE_TAC[wedge_ge; WEDGE_SIMPLE; EXTENSION; IN_UNION; IN_ELIM_THM] THEN + REPEAT GEN_TAC THEN + MP_TAC(ISPECL [`v0:real^3`; `v1:real^3`; `w1:real^3`; `w2:real^3`] azim) THEN + REAL_ARITH_TAC);; + +let ARG_EQ_SUBSET_HALFLINE = prove + (`!a. ?b. ~(b = vec 0) /\ {z | Arg z = a} SUBSET aff_ge {vec 0} {b}`, + GEN_TAC THEN ASM_CASES_TAC `{z | Arg z = a} SUBSET {vec 0}` THENL + [EXISTS_TAC `basis 1:real^2` THEN + SIMP_TAC[BASIS_NONZERO; DIMINDEX_2; ARITH] THEN + FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (REWRITE_RULE[IMP_CONJ] + SUBSET_TRANS)) THEN SIMP_TAC[SUBSET; IN_SING; ENDS_IN_HALFLINE]; + ALL_TAC] THEN + FIRST_X_ASSUM(MP_TAC o MATCH_MP (SET_RULE + `~(s SUBSET {a}) ==> ?z. ~(a = z) /\ z IN s`)) THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `z:complex` THEN + REWRITE_TAC[IN_ELIM_THM] THEN DISCH_THEN(STRIP_ASSUME_TAC o GSYM) THEN + ASM_REWRITE_TAC[SUBSET; IN_ELIM_THM] THEN + X_GEN_TAC `x:complex` THEN + ASM_CASES_TAC `x:complex = vec 0` THEN ASM_REWRITE_TAC[ENDS_IN_HALFLINE] THEN + RULE_ASSUM_TAC(REWRITE_RULE[COMPLEX_VEC_0]) THEN ASM_SIMP_TAC[ARG_EQ] THEN + DISCH_THEN(X_CHOOSE_THEN `u:real` STRIP_ASSUME_TAC) THEN + ASM_REWRITE_TAC[GSYM COMPLEX_CMUL] THEN + REWRITE_TAC[HALFLINE_EXPLICIT; IN_ELIM_THM; VECTOR_MUL_RZERO] THEN + MAP_EVERY EXISTS_TAC [`&1 - u`; `u:real`] THEN + ASM_SIMP_TAC[VECTOR_ADD_LID; REAL_LT_IMP_LE] THEN ASM_REAL_ARITH_TAC);; + +let ARG_DIV_EQ_SUBSET_HALFLINE = prove + (`!w a. ~(w = vec 0) + ==> ?b. ~(b = vec 0) /\ + {z | Arg(z / w) = a} SUBSET aff_ge {vec 0} {b}`, + REPEAT GEN_TAC THEN GEOM_BASIS_MULTIPLE_TAC 1 `w:complex` THEN + X_GEN_TAC `w:real` THEN ASM_CASES_TAC `w = &0` THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; REAL_LE_LT] THEN DISCH_TAC THEN + X_GEN_TAC `a:real` THEN DISCH_THEN(K ALL_TAC) THEN + ASM_SIMP_TAC[ARG_DIV_CX; COMPLEX_CMUL; COMPLEX_BASIS; GSYM CX_MUL; + REAL_MUL_RID; ARG_EQ_SUBSET_HALFLINE]);; + +let COPLANAR_AZIM_EQ = prove + (`!v0 v1 w1 a. + (collinear{v0,v1,w1} ==> ~(a = &0)) + ==> coplanar {z | azim v0 v1 w1 z = a}`, + REPEAT GEN_TAC THEN ASM_CASES_TAC `collinear{v0:real^3,v1,w1}` THENL + [ASM_SIMP_TAC[azim_def; EMPTY_GSPEC; COPLANAR_EMPTY]; ALL_TAC] THEN + ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN + GEOM_ORIGIN_TAC `v0:real^3` THEN + GEOM_BASIS_MULTIPLE_TAC 3 `v1:real^3` THEN + X_GEN_TAC `v1:real` THEN ASM_CASES_TAC `v1 = &0` THENL + [ASM_REWRITE_TAC[VECTOR_MUL_LZERO; INSERT_AC; COLLINEAR_2]; ALL_TAC] THEN + ASM_SIMP_TAC[REAL_LE_LT; COLLINEAR_SPECIAL_SCALE] THEN REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[AZIM_SPECIAL_SCALE; AZIM_ARG] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE RAND_CONV [COLLINEAR_BASIS_3]) THEN + POP_ASSUM_LIST(K ALL_TAC) THEN DISCH_THEN(X_CHOOSE_THEN `b:real^2` + STRIP_ASSUME_TAC o SPEC `a:real` o MATCH_MP ARG_DIV_EQ_SUBSET_HALFLINE) THEN + REWRITE_TAC[coplanar] THEN MAP_EVERY EXISTS_TAC + [`vec 0:real^3`; `pushin 3 (&0) (b:real^2):real^3`; `basis 3:real^3`] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [SUBSET]) THEN + REWRITE_TAC[AFFINE_HULL_3; HALFLINE; SUBSET; IN_ELIM_THM] THEN + DISCH_THEN(fun th -> X_GEN_TAC `x:real^3` THEN DISCH_TAC THEN + MP_TAC(SPEC `(dropout 3:real^3->real^2) x` th)) THEN + ASM_REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + DISCH_THEN(X_CHOOSE_THEN `v:real` STRIP_ASSUME_TAC) THEN + MAP_EVERY EXISTS_TAC [`&1 - v - (x:real^3)$3`; `v:real`; `(x:real^3)$3`] THEN + CONJ_TAC THENL [REAL_ARITH_TAC; ALL_TAC] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [CART_EQ]) THEN + SIMP_TAC[CART_EQ; DIMINDEX_2; DIMINDEX_3; FORALL_2; FORALL_3; LAMBDA_BETA; + dropout; pushin; VECTOR_ADD_COMPONENT; VECTOR_MUL_COMPONENT; ARITH; + BASIS_COMPONENT] THEN + REAL_ARITH_TAC);; + +(* ------------------------------------------------------------------------- *) +(* The actual theorems. *) +(* ------------------------------------------------------------------------- *) + +let UNIV_GSPEC = prove + (`{x | T} = UNIV`, + SET_TAC[]);; + + +let MEASURABLE_CONIC_CAP_WEDGE_GE = prove + (`!v0 v1 w1 w2 r a. + measurable (conic_cap v0 v1 r a INTER wedge_ge v0 v1 w1 w2)`, + REPEAT STRIP_TAC THEN REWRITE_TAC[WEDGE_GE_WEDGE] THEN + ASM_CASES_TAC `collinear{v0:real^3,v1,w1}` THENL + [ASM_SIMP_TAC[AZIM_DEGENERATE; UNIV_GSPEC; UNION_UNIV; INTER_UNIV] THEN + REWRITE_TAC[MEASURABLE_CONIC_CAP]; + REWRITE_TAC[UNION_OVER_INTER] THEN MATCH_MP_TAC MEASURABLE_UNION THEN + REWRITE_TAC[MEASURABLE_CONIC_CAP_WEDGE] THEN + MATCH_MP_TAC MEASURABLE_UNION THEN CONJ_TAC THEN + MATCH_MP_TAC NEGLIGIBLE_IMP_MEASURABLE THEN + MATCH_MP_TAC NEGLIGIBLE_INTER THEN DISJ2_TAC THEN + MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE THEN + ASM_SIMP_TAC[COPLANAR_AZIM_EQ]]);; + + +let VOLUME_CONIC_CAP_WEDGE_GE_VS_CONIC_CAP = prove + (`!v0 v1 w1 w2 r a. + &0 < a /\ a < &1 /\ + &0 < r /\ r <= &1 /\ + ~collinear {v0, v1, w1} /\ + ~collinear {v0, v1, w2} + ==> vol (conic_cap v0 v1 r a INTER wedge_ge v0 v1 w1 w2) = + vol (conic_cap v0 v1 r a) * (azim v0 v1 w1 w2) / (&2 * pi)`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `vol (conic_cap v0 v1 r a INTER wedge v0 v1 w1 w2)` THEN + CONJ_TAC THENL + [MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF THEN + REWRITE_TAC[GSYM UNION_OVER_INTER; SET_RULE + `s INTER t DIFF s INTER y = s INTER (t DIFF y)`] THEN + MATCH_MP_TAC NEGLIGIBLE_INTER THEN DISJ2_TAC THEN + REWRITE_TAC[WEDGE_GE_WEDGE; SET_RULE + `((s UNION t) DIFF s) UNION (s DIFF (s UNION t)) = t DIFF s`] THEN + MATCH_MP_TAC NEGLIGIBLE_DIFF THEN MATCH_MP_TAC NEGLIGIBLE_UNION THEN + CONJ_TAC THEN MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE THEN + ASM_SIMP_TAC[COPLANAR_AZIM_EQ]; + ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE; VOLUME_CONIC_CAP] THEN + ASM_SIMP_TAC[REAL_ARITH `a < b ==> ~(b < a) /\ ~(b <= a)`] THEN + ASM_CASES_TAC `v1:real^3 = v0` THENL + [ASM_MESON_TAC[INSERT_AC; COLLINEAR_2]; ASM_REWRITE_TAC[]] THEN + ASM_SIMP_TAC[REAL_ARITH `&0 < a ==> max a (--(&1)) = a`] THEN + MP_TAC PI_POS THEN CONV_TAC REAL_FIELD]);; + +(* ======================================================================== *) + +let REUHADY_concl1_new = + `!V u0 u1 vl1 vl2 v1 v2 e. + saturated V /\ + packing V /\ + u0 IN V /\ + u1 IN V /\ + ~(u0 = u1) /\ + hl [u0; u1] < sqrt (&2) /\ + e = {u0, u1} /\ + wedge_ge u0 u1 n1 n2 INTER wedge_ge u0 u1 n2 n1 SUBSET + aff_ge {u0,u1} {n1} UNION aff_ge {u0,u1} {n2} /\ + ~(azim u0 u1 n1 n2 = &0) /\ + ~(vl1 = vl2) /\ + hl vl1 < sqrt2 /\ + hl vl2 < sqrt2 /\ + vl1 IN barV V 2 /\ + vl2 IN barV V 2 /\ + set_of_list (truncate_simplex 1 vl1) = e /\ + set_of_list (truncate_simplex 1 vl2) = e /\ + n1 = EL 2 vl1 /\ + n2 = EL 2 vl2 /\ + (!X. X IN mcell_set V /\ e IN edgeX V X + ==> X SUBSET wedge_ge u0 u1 n1 n2 \/ + X SUBSET wedge_ge u0 u1 n2 n1) + ==> sum + {X | mcell_set V X /\ e IN edgeX V X /\ X SUBSET wedge_ge u0 u1 n1 n2} + (\t. dihX V t (u0,u1)) = + azim u0 u1 n1 n2`;; + +(* ========================================================================= *) +(* ========================================================================= *) + +let REUHADY1 = prove_by_refinement (REUHADY_concl1_new, +[(REPEAT STRIP_TAC); + (NEW_GOAL `barV V 1 [u0;u1:real^3]`); + (MATCH_MP_TAC HL_LE_SQRT2_IMP_BARV_1); + (ASM_REWRITE_TAC[]); + (NEW_GOAL + `{k | k IN 1..3 /\ + voronoi_list V [u0;u1:real^3] = + UNIONS + {convex hull + ({omega_list_n V vl i | i IN 1..k - 1} UNION + voronoi_list V vl) | vl | barV V k vl /\ + truncate_simplex 1 vl = [u0;u1]}} = + 1..3`); + (MATCH_MP_TAC Rogers.GLTVHUM_lemma1); + (ASM_REWRITE_TAC[] THEN ARITH_TAC); + (NEW_GOAL + `3 IN {k | k IN 1..3 /\ + voronoi_list V [u0; u1] = + UNIONS + {convex hull + ({omega_list_n V vl i | i IN 1..k - 1} UNION voronoi_list V vl) | vl | + barV V k vl /\ + truncate_simplex 1 vl = [u0; u1]}}`); + (ASM_REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC); + (UP_ASM_TAC THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (REWRITE_WITH + `UNIONS + {convex hull ({omega_list_n V vl i | i IN 1..3 - 1} UNION voronoi_list V vl) | vl | barV V 3 vl /\ + truncate_simplex 1 vl = [u0; u1]} = + UNIONS {convex hull {omega_list_n V vl 1, omega_list_n V vl 2, + omega_list_n V vl 3} | vl | barV V 3 vl /\ + truncate_simplex 1 vl = [u0; u1]}`); + (ONCE_REWRITE_TAC[SET_EQ_LEMMA]); + (REWRITE_TAC[IN_UNIONS] THEN ONCE_REWRITE_TAC[IN] THEN + REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `t:real^3->bool` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?a. voronoi_list V vl = {a} /\ + a = circumcenter (set_of_list vl) /\ + hl vl = dist (HD vl,a)`); + (MATCH_MP_TAC Marchal_cells_2_new.VORONOI_LIST_3_SINGLETON_EXPLICIT); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `omega_list_n V vl 3 IN voronoi_list V vl`); + (REWRITE_WITH `omega_list_n V vl 3 = omega_list V vl`); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `(3 + 1) - 1 = 3`]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `omega_list_n V vl 3 = a`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; IN_NUMSEG; + ARITH_RULE `1 <= i /\ i <= 2 <=> i = 1 \/ i = 2`]); + (REWRITE_WITH `{omega_list_n V vl i | i = 1 \/ i = 2} = + {omega_list_n V vl 1,omega_list_n V vl 2}`); + (SET_TAC[]); + (REWRITE_WITH `{omega_list_n V vl 1, omega_list_n V vl 2} UNION + {circumcenter (set_of_list vl)} = {omega_list_n V vl 1, omega_list_n V vl 2, circumcenter (set_of_list vl)}`); + (SET_TAC[]); + + (EXISTS_TAC `t:real^3->bool` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?a. voronoi_list V vl = {a} /\ + a = circumcenter (set_of_list vl) /\ + hl vl = dist (HD vl,a)`); + (MATCH_MP_TAC Marchal_cells_2_new.VORONOI_LIST_3_SINGLETON_EXPLICIT); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + + (NEW_GOAL `omega_list_n V vl 3 IN voronoi_list V vl`); + (REWRITE_WITH `omega_list_n V vl 3 = omega_list V vl`); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `(3 + 1) - 1 = 3`]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `omega_list_n V vl 3 = a`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; IN_NUMSEG; + ARITH_RULE `1 <= i /\ i <= 2 <=> i = 1 \/ i = 2`]); + (REWRITE_WITH `{omega_list_n V vl i | i = 1 \/ i = 2} = + {omega_list_n V vl 1,omega_list_n V vl 2}`); + (SET_TAC[]); + (REWRITE_WITH `{omega_list_n V vl 1, omega_list_n V vl 2} UNION + {circumcenter (set_of_list vl)} = {omega_list_n V vl 1, omega_list_n V vl 2, + circumcenter (set_of_list vl)}`); + (SET_TAC[]); + (STRIP_TAC); + +(* ======================================================================= *) + + (ABBREV_TAC `p = circumcenter {u0, u1:real^3}`); + (NEW_GOAL `aff_dim (u0 INSERT voronoi_list V [u0;u1]) = &3`); + (REWRITE_TAC[AFF_DIM_INSERT]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + + (NEW_GOAL `affine hull voronoi_list V [u0; u1] SUBSET + affine hull {x | &2 % (u0 - u1) dot x = norm u0 pow 2 - norm u1 pow 2}`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA); + (REWRITE_TAC[VORONOI_LIST; set_of_list; Packing3.VORONOI_SET_2]); + (ONCE_REWRITE_TAC[SET_RULE `a INTER b = b INTER a`]); + (ASM_SIMP_TAC[Pack2.INTER_VORONOI_SUBSET_BISECTOR]); + (NEW_GOAL + `affine hull {x | &2 % (u0 - u1) dot x = norm u0 pow 2 - norm u1 pow 2} = + {x:real^3 | &2 % (u0 - u1) dot x = norm u0 pow 2 - norm u1 pow 2}`); + (REWRITE_TAC[AFFINE_HULL_EQ]); + (REWRITE_TAC[AFFINE_HYPERPLANE]); + (NEW_GOAL + `~(u0 IN {x:real^3 | &2 % (u0 - u1) dot x = norm u0 pow 2 - norm u1 pow 2})`); + (REWRITE_TAC[IN; IN_ELIM_THM; NORM_POW_2]); + (ONCE_REWRITE_TAC [REAL_ARITH `a = b <=> a - b = &0`]); + (REWRITE_TAC[VECTOR_ARITH `&2 % (u0 - u1) dot u0 - (u0 dot u0 - u1 dot u1) = + (u0 - u1) dot (u0 - u1)`]); + (REWRITE_TAC[DOT_EQ_0] THEN ASM_NORM_ARITH_TAC); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[ARITH_RULE `a + &1 = b:int <=> a = b - &1`]); + (MATCH_MP_TAC Packing3.AFF_DIM_VORONOI_LIST); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `aff_dim (u0 INSERT voronoi_list V [u0; u1]) = &(dimindex (:3))`); + (ASM_REWRITE_TAC[DIMINDEX_3]); + (UP_ASM_TAC THEN REWRITE_TAC[AFF_DIM_EQ_FULL]); + (STRIP_TAC); + + (ABBREV_TAC `S = voronoi_list V [u0;u1]`); + (NEW_GOAL `!x. x IN S ==> (x - u0) dot (u1 - u0) = + dist (p, u0) * dist (u1, u0:real^3)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `p = inv (&2) % (u0 + (u1:real^3))`); + (EXPAND_TAC "p" THEN REWRITE_TAC[Rogers.CIRCUMCENTER_2; midpoint]); + (REWRITE_TAC[dist]); + (REWRITE_WITH `u1 - u0 = &2 % (p - u0:real^3)`); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; REAL_ARITH `abs (&2) = &2`; + REAL_ARITH `a * b * a = b * a pow 2`; NORM_POW_2; DOT_RMUL]); + (REWRITE_WITH `(x - u0) dot (p - u0:real^3) = + (p - u0) dot (p - u0) - (x - p) dot (u0 - p)`); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `(x - p) dot (u0 - p:real^3) = &0`); + (EXPAND_TAC "p"); + (REWRITE_WITH `{u0, u1} = set_of_list [u0; u1:real^3]`); + (REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `S SUBSET affine hull voronoi_list V [u0; u1]`); + (EXPAND_TAC "S"); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (ASM_SET_TAC[]); + (REWRITE_TAC[set_of_list]); + (NEW_GOAL `{u0,u1} SUBSET affine hull {u0,u1:real^3}`); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (ASM_SET_TAC[]); + (REAL_ARITH_TAC); + +(* ========================================================================= *) + + (ABBREV_TAC `S1 = {x:real^3 | &2 % (u0 - u1) dot x = + norm u0 pow 2 - norm u1 pow 2}`); + (ABBREV_TAC `S2:real^3->bool = (S1 DIFF (relative_interior S))`); + (NEW_GOAL `closed_in (subtopology euclidean (S1:real^3->bool)) S2`); + (EXPAND_TAC "S2"); + (MATCH_MP_TAC CLOSED_IN_DIFF); + (STRIP_TAC); + (NEW_GOAL `closed (S1:real^3->bool)`); + (EXPAND_TAC "S1" THEN REWRITE_TAC[CLOSED_HYPERPLANE]); + (MATCH_MP_TAC CLOSED_SUBSET); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + + (REWRITE_WITH `S1 = affine hull (S:real^3->bool)`); + (EXPAND_TAC "S"); + (NEW_GOAL `affine hull S1 = S1:real^3->bool`); + (REWRITE_TAC[AFFINE_HULL_EQ]); + (EXPAND_TAC "S1" THEN REWRITE_TAC[AFFINE_HYPERPLANE]); + (ONCE_REWRITE_TAC[GSYM (ASSUME `affine hull S1 = S1:real^3->bool`)]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC AFF_DIM_EQ_AFFINE_HULL); + (STRIP_TAC); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `INTERS {f x | x IN {a, b}} = f a INTER f b`]); + (DEL_TAC THEN EXPAND_TAC "S1"); + (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `aff_dim (S1:(real^3->bool)) = &(dimindex (:3)) - &1`); + (DEL_TAC THEN EXPAND_TAC "S1"); + (MATCH_MP_TAC AFF_DIM_HYPERPLANE); + (REWRITE_TAC[VECTOR_ARITH `&2 % (s - t) = vec 0 <=> s = t`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[DIMINDEX_3]); + (REWRITE_WITH `aff_dim (voronoi_list V [u0;u1:real^3]) = &3 - &1`); + (MATCH_MP_TAC Packing3.AFF_DIM_VORONOI_LIST); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_TAC[OPEN_IN_RELATIVE_INTERIOR]); + + (NEW_GOAL `closed (S2:real^3->bool)`); + (MATCH_MP_TAC CLOSED_IN_CLOSED_TRANS); + (EXISTS_TAC `S1:real^3->bool`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "S1"); + (REWRITE_TAC[CLOSED_HYPERPLANE]); + + + (NEW_GOAL `~(S2:real^3->bool = {})`); + (EXPAND_TAC "S2"); + (REWRITE_TAC [SET_RULE `A DIFF B = {} <=> A SUBSET B`]); + (REPEAT STRIP_TAC); + (NEW_GOAL `S1 SUBSET S:real^3->bool`); + (NEW_GOAL `relative_interior S SUBSET S:real^3->bool`); + (REWRITE_TAC[RELATIVE_INTERIOR_SUBSET]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `S1 = S:real^3->bool`); + (NEW_GOAL `S SUBSET S1:real^3->bool`); + (EXPAND_TAC "S"); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `INTERS {f x | x IN {a, b}} = f a INTER f b`]); + (EXPAND_TAC "S1"); + (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `bounded (S1:real^3->bool)`); + (REWRITE_TAC[ASSUME `S1 = S:real^3->bool`]); + (DEL_TAC THEN EXPAND_TAC "S"); + (MATCH_MP_TAC Packing3.BOUNDED_VORONOI_LIST); + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `~bounded (S1:real^3->bool)`); + (EXPAND_TAC "S1"); + (MATCH_MP_TAC UNBOUNDED_HYPERPLANE); + (REWRITE_TAC[VECTOR_ARITH `&2 % (u0 - u1) = vec 0 <=> u0 = u1`]); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `?z:real^3. z IN S2 /\ + (!w. w IN S2 ==> dist (u0,z) <= dist (u0,w))`); + (MATCH_MP_TAC DISTANCE_ATTAINS_INF); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + +(* ======================================================================== *) + + (ABBREV_TAC `a = dist (p, u0:real^3) / dist (z, u0)`); + (NEW_GOAL `&0 < a /\ a < &1`); + (EXPAND_TAC "a"); + (NEW_GOAL `~(u0:real^3 IN S1)`); + (EXPAND_TAC "S1" THEN REWRITE_TAC[IN; IN_ELIM_THM; NORM_POW_2]); + (REWRITE_TAC[REAL_ARITH `a = b - c <=> a + c - b = &0`]); + (REWRITE_TAC[VECTOR_ARITH `&2 % (u0 - u1) dot u0 + u1 dot u1 - u0 dot u0 = + (u0 - u1) dot (u0 - u1)`]); + (REWRITE_TAC[DOT_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `&0 < dist (p,u0:real^3)`); + (MATCH_MP_TAC DIST_POS_LT); + (EXPAND_TAC "p" THEN REWRITE_TAC[Rogers.CIRCUMCENTER_2; midpoint]); + (REWRITE_TAC[VECTOR_ARITH `inv (&2) % (u0 + u1) = u0 <=> u0 = u1`]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `&0 < dist (z,u0:real^3)`); + (MATCH_MP_TAC DIST_POS_LT); + (STRIP_TAC); + (NEW_GOAL `z:real^3 IN S1`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LT_DIV); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH + `dist (p,u0) / dist (z,u0:real^3) < &1 <=> dist (p,u0) < &1 * dist (z,u0)`); + (ASM_SIMP_TAC[REAL_LT_LDIV_EQ]); + (REWRITE_TAC[REAL_MUL_LID]); + (MATCH_MP_TAC Tactics_jordan.REAL_POW_2_LT); + (REPEAT STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[dist]); + (REWRITE_WITH `norm (z - u0:real^3) pow 2 = + norm (p - u0) pow 2 + norm (z - p) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (REWRITE_WITH `p = circumcenter (set_of_list [u0;u1:real^3])`); + (ASM_REWRITE_TAC[set_of_list]); + (ONCE_REWRITE_TAC[DOT_SYM]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ASSUME `voronoi_list V [u0; u1] = S`]); + (REWRITE_WITH `affine hull (S:real^3->bool) = S1`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (EXPAND_TAC "S"); + (NEW_GOAL `affine hull S1 = S1:real^3->bool`); + (REWRITE_TAC[AFFINE_HULL_EQ]); + (EXPAND_TAC "S1" THEN REWRITE_TAC[AFFINE_HYPERPLANE]); + (ONCE_REWRITE_TAC[GSYM (ASSUME `affine hull S1 = S1:real^3->bool`)]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC AFF_DIM_EQ_AFFINE_HULL); + (STRIP_TAC); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `INTERS {f x | x IN {a, b}} = f a INTER f b`]); + (DEL_TAC THEN EXPAND_TAC "S1"); + (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `aff_dim (S1:(real^3->bool)) = &(dimindex (:3)) - &1`); + (DEL_TAC THEN EXPAND_TAC "S1"); + (MATCH_MP_TAC AFF_DIM_HYPERPLANE); + (REWRITE_TAC[VECTOR_ARITH `&2 % (s - t) = vec 0 <=> s = t`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[DIMINDEX_3]); + (REWRITE_WITH `aff_dim (voronoi_list V [u0;u1:real^3]) = &3 - &1`); + (MATCH_MP_TAC Packing3.AFF_DIM_VORONOI_LIST); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[set_of_list]); + (NEW_GOAL `{u0, u1:real^3} SUBSET affine hull {u0, u1}`); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (ASM_SET_TAC[]); + (REWRITE_TAC[REAL_ARITH `a < a + b <=> &0 < b`; NORM_POW_2; DOT_POS_LT]); + (REWRITE_TAC[VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (STRIP_TAC); + (NEW_GOAL `~(z:real^3 IN S2)`); + (REWRITE_TAC[ASSUME `z = p:real^3`]); + (EXPAND_TAC "S2"); + (NEW_GOAL `p:real^3 IN relative_interior S`); + + + (ABBREV_TAC `B = V INTER ball (p:real^3, &8)`); + (ABBREV_TAC `A = B DIFF {u0, u1:real^3}`); + (NEW_GOAL `FINITE (A:real^3->bool)`); + (EXPAND_TAC "A"); + (MATCH_MP_TAC FINITE_DIFF); + (EXPAND_TAC "B"); + (MATCH_MP_TAC Packing3.KIUMVTC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `?y. dist (p,y:real^3) = &4`); + (MATCH_MP_TAC VECTOR_CHOOSE_DIST); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + (UNDISCH_TAC `saturated (V:real^3->bool)`); + (REWRITE_TAC[saturated] THEN STRIP_TAC); + (NEW_GOAL `?z. z IN V /\ dist (y:real^3, z) < &2`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `z':real^3 IN A`); + (EXPAND_TAC "A" THEN EXPAND_TAC "B"); + (REWRITE_TAC[IN_DIFF; IN_INTER; IN_BALL]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `dist (p,z') <= dist (p, y) + dist (y, z':real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `dist (p, y) <= dist (p, z') + dist (z', y:real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[DIST_SYM]); + (STRIP_TAC); + (NEW_GOAL `&2 < dist (z', p:real^3)`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[] THEN ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_WITH `p = circumcenter (set_of_list [u0;u1:real^3])`); + (ASM_MESON_TAC[set_of_list]); + (NEW_GOAL `(!w. w IN set_of_list [u0;u1:real^3] + ==> dist (circumcenter (set_of_list [u0;u1]),w) = hl [u0;u1])`); + (MATCH_MP_TAC Rogers.HL_PROPERTIES); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `dist (circumcenter (set_of_list [u0; u1:real^3]),z') = + hl [u0; u1]`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[set_of_list]); + (NEW_GOAL `sqrt (&2) <= &2`); + (MATCH_MP_TAC Tactics_jordan.REAL_POW_2_LE); + (SIMP_TAC[REAL_ARITH `&0 <= &2`; SQRT_POS_LE; SQRT_POW_2]); + (REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `?a:real^3. a IN A /\ (!x. x IN A ==> dist (p,a) <= dist (p,x))`); + (MATCH_MP_TAC Packing3.REAL_FINITE_ARGMIN); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ABBREV_TAC `d = inv (&4) * (dist (p, a') - dist (p, u0:real^3))`); + (NEW_GOAL `&0 < d`); + (EXPAND_TAC "d"); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&0 < a - b <=> a > b`]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (NEW_GOAL `!u v. u IN {u0,u1} /\ v IN V DIFF {u0,u1} ==> + dist (v,p) > dist (u,p:real^3)`); + (MATCH_MP_TAC Rogers.XYOFCGX); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[AFFINE_INDEPENDENT_2]); + (ASM_MESON_TAC[set_of_list]); + (REWRITE_WITH `radV {u0, u1:real^3} = hl [u0;u1]`); + (REWRITE_TAC[HL;set_of_list]); + (ASM_REWRITE_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + + (REWRITE_TAC[relative_interior; IN; IN_ELIM_THM]); + (ABBREV_TAC `St = S INTER ball (p:real^3, d)`); + (EXISTS_TAC `St:real^3->bool`); + (REPEAT STRIP_TAC); + + (REWRITE_TAC[open_in]); + (REPEAT STRIP_TAC); + (NEW_GOAL `S SUBSET affine hull (S:real^3->bool)`); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (EXISTS_TAC `d - dist (p:real^3, x)`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 < a - b <=> b < a`]); + (REWRITE_TAC[GSYM IN_BALL]); + (ASM_SET_TAC[]); + (EXPAND_TAC "St"); + (REWRITE_TAC[IN_INTER]); + (STRIP_TAC); + + (NEW_GOAL `dist (x',x:real^3) < d`); + (NEW_GOAL `&0 <= dist (p,x:real^3)`); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `x' IN voronoi_closed V (u0:real^3)`); + (REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (ASM_CASES_TAC `w IN {u0, u1:real^3}`); + (ASM_CASES_TAC `w = u0:real^3`); + (REWRITE_TAC[ASSUME `w = u0:real^3`]); + (REAL_ARITH_TAC); + (NEW_GOAL `w = u1:real^3`); + (ASM_SET_TAC[]); + (REWRITE_TAC[ASSUME `w = u1:real^3`]); + (MATCH_MP_TAC (REAL_ARITH `a = b ==> a <= b`)); + + (NEW_GOAL `x':real^3 IN S1`); + (NEW_GOAL `affine hull S SUBSET affine hull (S1:real^3->bool)`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA); + (EXPAND_TAC "S1" THEN REWRITE_TAC[GSYM + (ASSUME `voronoi_list V [u0; u1] = S`); VORONOI_LIST; VORONOI_SET; + set_of_list; SET_RULE `INTERS {f v | v IN {a, b}} = f a INTER f b`]); + (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `x' IN S1 <=> x':real^3 IN affine hull S1`); + (REWRITE_WITH `affine hull S1 = S1:real^3->bool`); + (REWRITE_TAC[AFFINE_HULL_EQ]); + (EXPAND_TAC "S1" THEN REWRITE_TAC[AFFINE_HYPERPLANE]); + (ASM_SET_TAC[]); + + (UP_ASM_TAC THEN EXPAND_TAC "S1" THEN REWRITE_TAC[IN_ELIM_THM; NORM_POW_2]); + (ONCE_REWRITE_TAC[REAL_ARITH `a = b <=> a - b = &0`]); + (REWRITE_TAC[ + VECTOR_ARITH `&2 % (u0 - u1) dot x - (u0 dot u0 - u1 dot u1) = + (u1 - x) dot (u1 - x) - (u0 - x) dot (u0 - x)`]); + (REWRITE_TAC[REAL_ARITH `a - b = &0 <=> a = b`; GSYM NORM_POW_2; GSYM dist]); + (STRIP_TAC); + (REWRITE_TAC[DIST_EQ]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `dist (x', u0:real^3) <= dist (x', x) + dist (x, u0)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (x, u0:real^3) <= dist (x, p:real^3) + dist (p, u0)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (x,p:real^3) < d`); + (NEW_GOAL `x IN ball (p:real^3, d)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL]); + (REWRITE_TAC[DIST_SYM]); + (NEW_GOAL `dist (x',u0) < &2 * d + dist (p:real^3,u0)`); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `dist (p, w:real^3)- &2 * d <= dist (x',w)`); + (NEW_GOAL `dist (x, w:real^3) <= dist (x, x') + dist (x', w)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (p, w:real^3) <= dist (p, x) + dist (x, w)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (x, x':real^3) < d /\ dist (p, x:real^3) < d`); + (ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `dist (p, u0) + &4 * d <= dist (p, w:real^3)`); + (EXPAND_TAC "d"); + (REWRITE_TAC[REAL_ARITH `&4 * inv (&4) * a = a`]); + (REWRITE_TAC[REAL_ARITH `a + b - a = b`]); + + (ASM_CASES_TAC `w:real^3 IN B`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (NEW_GOAL `~(dist (p,w:real^3) < &8)`); + (REWRITE_TAC[GSYM IN_BALL]); + (ASM_SET_TAC[]); + (NEW_GOAL `dist (p,a':real^3) < &8`); + (REWRITE_TAC[GSYM IN_BALL]); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `x' IN voronoi_closed V (u1:real^3)`); + (NEW_GOAL `x':real^3 IN S1`); + (NEW_GOAL `affine hull S SUBSET affine hull (S1:real^3->bool)`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA); + (EXPAND_TAC "S1" THEN REWRITE_TAC[GSYM + (ASSUME `voronoi_list V [u0; u1] = S`); VORONOI_LIST; VORONOI_SET; + set_of_list; SET_RULE `INTERS {f v | v IN {a, b}} = f a INTER f b`]); + (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `x' IN S1 <=> x':real^3 IN affine hull S1`); + (REWRITE_WITH `affine hull S1 = S1:real^3->bool`); + (REWRITE_TAC[AFFINE_HULL_EQ]); + (EXPAND_TAC "S1" THEN REWRITE_TAC[AFFINE_HYPERPLANE]); + (ASM_SET_TAC[]); + + (UP_ASM_TAC THEN EXPAND_TAC "S1" THEN REWRITE_TAC[IN_ELIM_THM; NORM_POW_2]); + (ONCE_REWRITE_TAC[REAL_ARITH `a = b <=> a - b = &0`]); + (REWRITE_TAC[ + VECTOR_ARITH `&2 % (u0 - u1) dot x - (u0 dot u0 - u1 dot u1) = + (u1 - x) dot (u1 - x) - (u0 - x) dot (u0 - x)`]); + (REWRITE_TAC[REAL_ARITH `a - b = &0 <=> a = b`; GSYM NORM_POW_2; GSYM dist]); + (STRIP_TAC); + (UNDISCH_TAC `x' IN voronoi_closed V (u0:real^3)`); + (REWRITE_TAC[voronoi_closed; IN_ELIM_THM; IN]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `dist (x', u1)= dist (x', u0:real^3)`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[DIST_EQ]); + (ASM_SIMP_TAC[]); + + (REWRITE_TAC[GSYM + (ASSUME `voronoi_list V [u0; u1] = S`); VORONOI_LIST; VORONOI_SET; + set_of_list; SET_RULE `INTERS {f v | v IN {a, b}} = f a INTER f b`]); + (ASM_REWRITE_TAC[IN_INTER]); + + (REWRITE_TAC[IN_BALL]); + (NEW_GOAL `dist (p,x':real^3) <= dist (p,x) + dist (x, x':real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (x,x':real^3) = dist (x',x)`); + (REWRITE_TAC[DIST_SYM]); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `St p <=> p:real^3 IN St`); + (REWRITE_TAC[IN]); + (EXPAND_TAC "St" THEN REWRITE_TAC[IN_INTER; IN_BALL; DIST_REFL]); + (STRIP_TAC); + (REWRITE_WITH `p = omega_list V [u0; u1]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `p = circumcenter (set_of_list [u0;u1:real^3])`); + (ASM_MESON_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[IN]); + (REWRITE_TAC[GSYM (ASSUME `voronoi_list V [u0;u1] = S`)]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `1` THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + +(* ======================================================================== *) + + (NEW_GOAL `?b. &0 < b /\ b < &1 /\ + rcone_gt u0 u1 b SUBSET aff_ge_alt {u0:real^3} S`); + + (EXISTS_TAC `a:real`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `A SUBSET B <=> (!x. ~(x IN B) ==> ~(x IN A))`]); + (REPEAT STRIP_TAC); + (NEW_GOAL `x:real^3 IN affine hull (u0 INSERT S)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[AFFINE_HULL_EXPLICIT_ALT; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (ABBREV_TAC `h = sum (s DELETE u0:real^3) u`); + (NEW_GOAL `(x - u0) dot (u1 - u0:real^3) = + h * dist (p, u0) * dist (u1, u0:real^3)`); + (EXPAND_TAC "x"); + (NEW_GOAL `u0 = vsum s (\v:real^3. (u:real^3->real) v % (u0:real^3))`); + (ASM_SIMP_TAC[VSUM_RMUL]); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `vsum (s:real^3->bool) (\v. u v % v) - u0:real^3 = + vsum s (\v. u v % v) - vsum s (\v:real^3. u v % u0)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_WITH `vsum s (\v. u v % v) - vsum s (\v:real^3. u v % u0:real^3) = + vsum s (\x. (\v. u v % v) x - (\v. u v % u0) x)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC VSUM_SUB); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_ARITH `a % x - a % y = a % (x - y)`]); + (REWRITE_WITH `vsum s (\x:real^3. u x % (x - u0)) dot (u1 - u0) = + sum s (\x. (\x. u x % (x - u0)) x dot (u1 - u0:real^3))`); + (ASM_SIMP_TAC[DOT_LSUM]); + (REWRITE_TAC[DOT_LMUL]); + (REWRITE_WITH `sum s (\x:real^3. u x * ((x - u0) dot (u1 - u0:real^3))) = + sum (s DELETE u0) (\x. u x * (dist (p,u0) * dist (u1,u0)))`); + (ASM_CASES_TAC `u0:real^3 IN s`); + (NEW_GOAL `s = u0 INSERT (s DELETE u0:real^3)`); + (ASM_SET_TAC[]); + (NEW_GOAL `FINITE (s DELETE u0:real^3)`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `s:real^3->bool` THEN ASM_REWRITE_TAC[] THEN SET_TAC[]); + + (REWRITE_WITH `sum s (\x:real^3. u x * ((x - u0) dot (u1 - u0:real^3))) = + sum (u0 INSERT (s DELETE u0)) (\x. u x * ((x - u0) dot (u1 - u0)))`); + (ASM_MESON_TAC[]); + (ABBREV_TAC `f = (\x:real^3. u x * ((x - u0) dot (u1 - u0:real^3)))`); + (REWRITE_WITH `sum (u0:real^3 INSERT (s DELETE u0)) f = + (if u0 IN (s DELETE u0) then sum (s DELETE u0) f + else f u0 + sum (s DELETE u0) f)`); + (MATCH_MP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt); + (ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_WITH `f (u0:real^3) = &0`); + (EXPAND_TAC "f"); + (REWRITE_TAC[VECTOR_ARITH `(u0 - u0) dot (u1 - u0) = &0`]); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&0 + a = a`]); + (MATCH_MP_TAC SUM_EQ); + (EXPAND_TAC "f"); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a * x = a * y * z <=> a * (x - y * z) = &0`]); + (NEW_GOAL `(x' - u0) dot (u1 - u0) - dist (p,u0) * dist (u1,u0:real^3) = &0`); + (REWRITE_TAC[REAL_ARITH `a - b = &0 <=> a = b`]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (REWRITE_WITH `s DELETE u0:real^3 = s`); + (ASM_SET_TAC[]); + (MATCH_MP_TAC SUM_EQ); + (REPEAT STRIP_TAC); + (REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `a * x = a * y * z <=> a * (x - y * z) = &0`]); + (NEW_GOAL `(x' - u0) dot (u1 - u0) - dist (p,u0) * dist (u1,u0:real^3) = &0`); + (REWRITE_TAC[REAL_ARITH `a - b = &0 <=> a = b`]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (NEW_GOAL `FINITE (s DELETE u0:real^3)`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `s:real^3->bool` THEN ASM_REWRITE_TAC[] THEN SET_TAC[]); + (ASM_SIMP_TAC[SUM_RMUL]); + + (ASM_CASES_TAC `h <= &0`); + (NEW_GOAL `~(x IN rcone_gt u0 (u1:real^3) a)`); + (REWRITE_TAC[rcone_gt; rconesgn; IN; IN_ELIM_THM]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (REAL_ARITH `&0 <= x /\ y <= &0 ==> ~(y > x)`)); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH `a * b * c <= &0 <=> &0 <= b * c * (--a)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (ABBREV_TAC `y = inv (h) % vsum (s DELETE u0) (\v:real^3. u v % v)`); + (NEW_GOAL `?t. t + h = &1 /\ x = t % u0 + h % (y:real^3)`); + (EXISTS_TAC `&1 - h`); + (STRIP_TAC); + (REAL_ARITH_TAC); + (ASM_CASES_TAC `u0:real^3 IN s`); + (REWRITE_TAC[GSYM (ASSUME `sum s (u:real^3->real) = &1`)]); + + (EXPAND_TAC "h"); + (REWRITE_WITH `sum s u = sum (u0 INSERT (s DELETE u0)) (u:real^3->real)`); + (REWRITE_WITH `(u0 INSERT (s DELETE u0:real^3)) = s`); + (ASM_SET_TAC[]); + (NEW_GOAL `FINITE (s DELETE u0:real^3)`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `s:real^3->bool` THEN ASM_REWRITE_TAC[] THEN SET_TAC[]); + + (SIMP_TAC[Marchal_cells_2_new.SUM_CLAUSES_alt; + ASSUME `FINITE (s DELETE u0:real^3)`]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[REAL_ARITH `(a + b:real) - b = a`]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_MUL_ASSOC]); + (REWRITE_WITH `h * inv h = &1`); + (NEW_GOAL `~(h = &0)`); + (ASM_REAL_ARITH_TAC); + (ASM_SIMP_TAC[Trigonometry2.REAL_MUL_LRINV]); + (REWRITE_TAC[VECTOR_MUL_LID]); + (EXPAND_TAC "x"); + + (REWRITE_WITH `vsum s (\v. u v % v) = + vsum (u0 INSERT (s DELETE u0)) (\v:real^3. u v % v)`); + (REWRITE_WITH `(u0 INSERT (s DELETE u0:real^3)) = s`); + (ASM_SET_TAC[]); + (SIMP_TAC[Marchal_cells_2_new.VSUM_CLAUSES_alt; + ASSUME `FINITE (s DELETE u0:real^3)`]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (REFL_TAC); + + (NEW_GOAL `h = &1`); + (EXPAND_TAC "h" THEN REWRITE_WITH `s DELETE u0:real^3 = s`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "y" THEN REWRITE_TAC[ASSUME `h = &1`]); + (REWRITE_WITH `s DELETE u0:real^3 = s`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[REAL_ARITH `inv (&1) = &1 /\ &1 - &1 = &0`]); + (VECTOR_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `~(y:real^3 IN S)`); + (STRIP_TAC); + (NEW_GOAL `x IN aff_ge_alt {u0:real^3} S`); + (REWRITE_TAC[IN; aff_ge_alt; lin_combo]); + + (ABBREV_TAC `f = (\v:real^3. if v = u0 then t + else if v = y then h else &0)`); + (EXISTS_TAC `f:real^3->real`); + (EXISTS_TAC `{y:real^3}`); + + (REPEAT STRIP_TAC); + (REWRITE_TAC[FINITE_SING]); + (ASM_SET_TAC[]); + + (REWRITE_TAC[SET_RULE `{a} UNION {b} = {a, b}`]); + (REWRITE_WITH `vsum {u0:real^3, y} (\v. f v % v) = + (\v. f v % v) u0 + (\v. f v % v) y`); + (MATCH_MP_TAC Geomdetail.VSUM_DIS2); + (STRIP_TAC); + (NEW_GOAL `~(u0:real^3 IN S)`); + (EXPAND_TAC "S"); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `v IN {a,b} <=> v = a \/ v = b`]); + (STRIP_TAC); + (NEW_GOAL `u0 IN voronoi_closed V (u1:real^3)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,u1) <= dist (u0,u0:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `(f:real^3->real) u0 = t`); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `(f:real^3->real) y = h`); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `~(u0:real^3 IN S)`); + (EXPAND_TAC "S"); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `v IN {a,b} <=> v = a \/ v = b`]); + (STRIP_TAC); + (NEW_GOAL `u0 IN voronoi_closed V (u1:real^3)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,u1) <= dist (u0,u0:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[]); + + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `~({y:real^3} u0)`); + (REWRITE_WITH `~({y} u0) <=> ~(u0:real^3 IN {y})`); + (MESON_TAC[IN]); + (REWRITE_TAC[IN_SING]); + (STRIP_TAC); + + (NEW_GOAL `~(u0:real^3 IN S)`); + (EXPAND_TAC "S"); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `v IN {a,b} <=> v = a \/ v = b`]); + (STRIP_TAC); + + (NEW_GOAL `u0 IN voronoi_closed V (u1:real^3)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,u1) <= dist (u0,u0:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (COND_CASES_TAC); + (ASM_REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (REWRITE_TAC[SET_RULE `{a} UNION {b} = {a,b}`]); + (REWRITE_WITH `sum {u0:real^3, y} f = f u0 + f y`); + (MATCH_MP_TAC Geomdetail.SUM_DIS2); + (STRIP_TAC); + (NEW_GOAL `~(u0:real^3 IN S)`); + (EXPAND_TAC "S"); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `v IN {a,b} <=> v = a \/ v = b`]); + (STRIP_TAC); + (NEW_GOAL `u0 IN voronoi_closed V (u1:real^3)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,u1) <= dist (u0,u0:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `(f:real^3->real) u0 = t`); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `(f:real^3->real) y = h`); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `~(u0:real^3 IN S)`); + (EXPAND_TAC "S"); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `v IN {a,b} <=> v = a \/ v = b`]); + (STRIP_TAC); + (NEW_GOAL `u0 IN voronoi_closed V (u1:real^3)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,u1) <= dist (u0,u0:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `y:real^3 IN S2`); + (EXPAND_TAC "S2"); + (NEW_GOAL `y:real^3 IN S1`); + (NEW_GOAL `y:real^3 IN affine hull S`); + (REWRITE_TAC[AFFINE_HULL_EXPLICIT_ALT]); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `s DELETE u0:real^3`); + (EXISTS_TAC `(\v:real^3. inv h * u v)`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[FINITE_DELETE]); + (ASM_SET_TAC[]); + (REWRITE_TAC[SUM_LMUL]); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[Trigonometry2.REAL_MUL_LRINV; + REAL_ARITH `~(h <= &0) ==> ~(h = &0)`]); + (REWRITE_TAC[GSYM VECTOR_MUL_ASSOC]); + (ASM_SIMP_TAC[VSUM_LMUL; FINITE_DELETE]); + (NEW_GOAL `affine hull S1 = S1:real^3->bool`); + (REWRITE_TAC[AFFINE_HULL_EQ]); + (EXPAND_TAC "S1" THEN REWRITE_TAC[AFFINE_HYPERPLANE]); + + (NEW_GOAL `affine hull S SUBSET affine hull (S1:real^3->bool)`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA); + (EXPAND_TAC "S"); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `INTERS {f x | x IN {a, b}} = f a INTER f b`]); + (DEL_TAC THEN EXPAND_TAC "S1"); + (MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + + (NEW_GOAL `relative_interior S SUBSET S:real^3->bool`); + (REWRITE_TAC[RELATIVE_INTERIOR_SUBSET]); + (ASM_SET_TAC[]); + + (NEW_GOAL `dist (z,u0) <= dist (y,u0:real^3)`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ASM_SIMP_TAC[]); + (UNDISCH_TAC `x:real^3 IN rcone_gt u0 u1 a`); + (REWRITE_TAC[rcone_gt; rconesgn; IN; IN_ELIM_THM]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `dist (t % u0 + h % y,u0) = h * dist (y, u0:real^3)`); + (REWRITE_TAC[dist]); + (REWRITE_WITH `(t % u0 + h % y:real^3) - u0 = (t % u0 + h % y) - (t + h) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `(t % u0 + h % y) - (t + h) % u0 = h % (y - u0)`]); + (REWRITE_TAC[NORM_MUL]); + (REWRITE_WITH `abs h = h`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REAL_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH `~(a > b) <=> a <= b`]); + (REWRITE_WITH `h * dist (p,u0:real^3) * dist (u1,u0) = + (h * dist (z,u0)) * dist (u1,u0) * a`); + (EXPAND_TAC "a"); + (REWRITE_TAC[REAL_ARITH `(a * b) * c * d / b = (a * d * c) * (b / b)`]); + (REWRITE_WITH `dist (z,u0) / dist (z,u0:real^3) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[DIST_EQ_0]); + (STRIP_TAC); + + (NEW_GOAL `~(u0:real^3 IN S1)`); + (EXPAND_TAC "S1" THEN REWRITE_TAC[IN; IN_ELIM_THM; NORM_POW_2]); + (REWRITE_TAC[REAL_ARITH `a = b - c <=> a + c - b = &0`]); + (REWRITE_TAC[VECTOR_ARITH `&2 % (u0 - u1) dot u0 + u1 dot u1 - u0 dot u0 = + (u0 - u1) dot (u0 - u1)`]); + (REWRITE_TAC[DOT_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `z:real^3 IN S1`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH + `(a * x) * b * c <= (a * y) * b * c <=> &0 <= a * b * c *(y - x)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (UP_ASM_TAC THEN STRIP_TAC); + +(* OK until here *) +(* ========================================================================= *) + + (ABBREV_TAC `W = aff_ge_alt {u0:real^3} S`); + (ABBREV_TAC `c = max b (hl[u0;u1:real^3] / sqrt (&2))`); + (NEW_GOAL `&0 < c /\ c < &1`); + (EXPAND_TAC "c" THEN REWRITE_TAC[REAL_LT_MAX]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "c" THEN REWRITE_TAC[REAL_MAX_LT]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `hl [u0; u1:real^3] / sqrt (&2) < &1 <=> + hl [u0; u1] < &1 * sqrt (&2)`); + (MATCH_MP_TAC REAL_LT_LDIV_EQ); + (ASM_SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `rcone_gt u0 u1 c SUBSET + W INTER (rcone_gt u0 u1 (hl [u0; u1:real^3] / sqrt (&2)))`); + (REWRITE_TAC[SUBSET_INTER]); + (STRIP_TAC); + (NEW_GOAL `rcone_gt (u0:real^3) u1 c SUBSET rcone_gt u0 u1 b`); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "c" THEN REAL_ARITH_TAC); + (ASM_SET_TAC[]); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "c" THEN REAL_ARITH_TAC); + + (ABBREV_TAC `C = ball (u0:real^3,&1) INTER rcone_gt u0 u1 c`); + (NEW_GOAL `C SUBSET + UNIONS + {rogers V vl | vl | barV V 3 vl /\ truncate_simplex 1 vl = [u0; u1]}`); + (REWRITE_TAC[SUBSET]); + (REPEAT STRIP_TAC); + (NEW_GOAL `x IN ball (u0:real^3,&1) /\ x IN aff_ge_alt {u0} S`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `(x:real^3) IN convex hull (u0 INSERT S)`); + (REWRITE_TAC[CONVEX_HULL_EXPLICIT; IN; IN_ELIM_THM]); + + (UP_ASM_TAC THEN REWRITE_TAC[IN; aff_ge_alt; lin_combo]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `{u0:real^3} UNION q`); + (EXISTS_TAC `f:real^3->real`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[SET_RULE `{a} UNION b = a INSERT b`; FINITE_INSERT]); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ASM_CASES_TAC `x':real^3 IN q`); + (FIRST_ASSUM MATCH_MP_TAC); + (UP_ASM_TAC THEN MESON_TAC[IN]); + (REWRITE_WITH `x' = u0:real^3`); + (NEW_GOAL `x' IN ({u0:real^3} UNION q)`); + (ASM_REWRITE_TAC[IN]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[REAL_ARITH `&0 <= x <=> ~(x < &0)`]); + (STRIP_TAC); + (UNDISCH_TAC `x IN ball (u0:real^3,&1)`); + (ASM_REWRITE_TAC[IN_BALL; SET_RULE `{u} UNION q = u INSERT (q DELETE u)`]); + (REWRITE_WITH `vsum (u0 INSERT (q DELETE u0:real^3)) (\v. f v % v) = + (if u0 IN (q DELETE u0) then vsum (q DELETE u0) (\v. f v % v) + else (\v. f v % v) u0 + vsum (q DELETE u0) (\v. f v % v))`); + (MATCH_MP_TAC Marchal_cells_2_new.VSUM_CLAUSES_alt); + (ASM_REWRITE_TAC[FINITE_DELETE]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[dist]); + (REWRITE_WITH `!a. a - u0 = a - (sum ({u0:real^3} UNION q) f) % u0`); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `sum ({u0} UNION q) f = f u0 + sum (q DELETE u0:real^3) f`); + (REWRITE_TAC[SET_RULE `{u} UNION q = u INSERT (q DELETE u)`]); + (REWRITE_WITH `sum (u0 INSERT (q DELETE u0:real^3)) f = + (if u0 IN (q DELETE u0) then sum (q DELETE u0) f + else f u0 + sum (q DELETE u0) f)`); + (MATCH_MP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt); + (ASM_REWRITE_TAC[FINITE_DELETE]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_ADD_RDISTRIB; + VECTOR_ARITH `(a + b) - (a + c:real^3) = b - c`; + ASSUME `sum ({u0} UNION q) f = f u0 + sum (q DELETE u0:real^3) f`; ]); + (ABBREV_TAC `h = sum (q DELETE u0:real^3) f`); + (ABBREV_TAC `y = inv (h) % vsum (q DELETE u0) (\v:real^3. f v % v)`); + (NEW_GOAL `h > &1`); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `vsum (q DELETE u0) (\v. f v % v) = h % y:real^3`); + (EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_MUL_ASSOC]); + (REWRITE_WITH `h * inv h = &1`); + (ASM_SIMP_TAC [Trigonometry2.REAL_MUL_LRINV; REAL_ARITH `h > &1 ==> ~(h = &0)`]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `h % a - h % b = h % (a - b)`; NORM_MUL]); + (REWRITE_TAC[REAL_ARITH `~(a < b) <=> b <= a`]); + + (NEW_GOAL `norm (p - u0) <= norm (y - u0:real^3)`); + (MATCH_MP_TAC Tactics_jordan.REAL_POW_2_LE); + (REWRITE_TAC[NORM_POS_LE]); + (REWRITE_WITH + `norm (y - u0) pow 2 = norm (p - u0) pow 2 + norm (y - p:real^3) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (REWRITE_WITH `p = circumcenter (set_of_list [u0;u1:real^3])`); + (ASM_REWRITE_TAC[set_of_list]); + (ONCE_REWRITE_TAC[DOT_SYM]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ASSUME `voronoi_list V [u0; u1] = S`]); + (REWRITE_TAC[AFFINE_HULL_EXPLICIT_ALT; IN; IN_ELIM_THM]); + (EXISTS_TAC `q DELETE u0:real^3`); + (EXISTS_TAC `(\v:real^3. inv h * f v)`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[FINITE_DELETE]); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[SUM_LMUL]); + (ASM_SIMP_TAC [Trigonometry2.REAL_MUL_LRINV; REAL_ARITH `h > &1 ==> ~(h = &0)`]); + (REWRITE_TAC[GSYM VECTOR_MUL_ASSOC]); + (ASM_REWRITE_TAC[VSUM_LMUL]); + + (REWRITE_TAC[set_of_list]); + (NEW_GOAL `{u0, u1:real^3} SUBSET affine hull {u0, u1}`); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (ASM_SET_TAC[]); + (REWRITE_TAC[REAL_ARITH `a <= a + b <=> &0 <= b`; NORM_POW_2; DOT_POS_LE]); + + (NEW_GOAL `&1 <= norm (p - u0:real^3)`); + (EXPAND_TAC "p"); + (REWRITE_TAC[CIRCUMCENTER_2; midpoint; + VECTOR_ARITH `inv (&2) % (u0 + u1) - u0 = inv (&2) % (u1 - u0)`; + NORM_MUL; REAL_ARITH `abs (inv(&2)) = inv (&2)`]); + (REWRITE_TAC[GSYM dist]); + (REWRITE_WITH `&1 = inv (&2) * &2`); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `inv (&2) * &2 <= inv (&2) * a <=> &2 <= a`]); + (MP_TAC (ASSUME `packing (V:real^3->bool)`)); + (REWRITE_TAC[packing] THEN STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]); + (REWRITE_WITH `abs h = h`); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `h <= h * norm (y - u0:real^3)`); + (REWRITE_TAC[REAL_ARITH `h <= h * a <=> &0 <= h * (a - &1)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `~(S:real^3->bool = {})`); + (STRIP_TAC); + (NEW_GOAL `~(aff_dim (u0:real^3 INSERT S) = &3)`); + (REWRITE_TAC[ASSUME `S:real^3->bool = {}`; AFF_DIM_SING]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (SWITCH_TAC); + (UP_ASM_TAC THEN SIMP_TAC[CONVEX_HULL_INSERT; + ASSUME `~(S:real^3->bool = {})`]); + (REWRITE_WITH `convex hull S = S:real^3->bool`); + (REWRITE_TAC[CONVEX_HULL_EQ]); + (EXPAND_TAC "S" THEN REWRITE_TAC[Packing3.CONVEX_VORONOI_LIST]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[IN_UNIONS; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (EXISTS_TAC `rogers V vl`); + (REPEAT STRIP_TAC); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + + (ASM_SIMP_TAC[Marchal_cells_2_new.ROGERS_EXPLICIT]); + (REWRITE_TAC[CONVEX_HULL_4; IN_ELIM_THM]); + + (UNDISCH_TAC `(t:real^3->bool) b'`); + (ASM_REWRITE_TAC[CONVEX_HULL_3; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (EXISTS_TAC `u:real`); + (EXISTS_TAC `v * u'`); + (EXISTS_TAC `v * v'`); + (EXISTS_TAC `v * w`); + (ASM_SIMP_TAC[REAL_LE_MUL]); + (STRIP_TAC); + + (REWRITE_TAC[REAL_ARITH `u + v * u' + v * v' + v * w = u + v * (u' + v' +w)`]); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (ASM_REWRITE_TAC[HD]); + (VECTOR_ARITH_TAC); + +(* ========================================================================== *) + + (NEW_GOAL + `!X. mcell_set V X /\ ~NULLSET (X INTER C) + ==> (?k vl. + 2 <= k /\ + barV V 3 vl /\ + X = mcell k V vl /\ + truncate_simplex 1 vl = [u0; u1])`); + + (REWRITE_TAC[mcell_set_2; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `~NULLSET (X INTER UNIONS + {rogers V vl | vl | barV V 3 vl /\ truncate_simplex 1 vl = [u0; u1]})`); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER C)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER + UNIONS + {rogers V vl | vl | barV V 3 vl /\ truncate_simplex 1 vl = [u0; u1]}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[INTER_UNIONS]); + (STRIP_TAC); + + (NEW_GOAL + `!s. ~NULLSET (UNIONS s) /\ FINITE s ==> (?t. t IN s /\ ~NULLSET t)`); + (MESON_TAC[NEGLIGIBLE_UNIONS]); + (ABBREV_TAC `St = {X INTER x | x IN + {rogers V vl | vl | barV V 3 vl /\ + truncate_simplex 1 vl = [u0; u1]}}`); + (NEW_GOAL `?t. t IN St /\ ~NULLSET t`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "St"); + (ABBREV_TAC `Sr = {rogers V vl | vl | barV V 3 vl /\ + truncate_simplex 1 vl = [u0; u1]}`); + (ABBREV_TAC `f = (\x:real^3->bool. X INTER x)`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y:real^3->bool | ?x:real^3->bool. x IN Sr /\ y = f x }`); + (STRIP_TAC); + + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (ABBREV_TAC `Ss = {vl | barV V 3 vl /\ truncate_simplex 1 vl = [u0; u1]}`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y | ?vl. vl IN Ss /\ y = rogers V vl}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (ABBREV_TAC `Sx = V INTER ball (u0:real^3, &4)`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y | ?u0 u1 u2 u3:real^3. + u0 IN Sx /\ + u1 IN Sx /\ + u2 IN Sx /\ + u3 IN Sx /\ + y = [u0; u1; u2; u3]}`); + (STRIP_TAC); + (MATCH_MP_TAC Ajripqn.FINITE_SET_LIST_LEMMA); + (EXPAND_TAC "Sx"); + (MATCH_MP_TAC Pack2.KIUMVTC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "Ss"); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `?v0 v1 v2 v3. x = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v0:real^3`); + (EXISTS_TAC `v1:real^3`); + (EXISTS_TAC `v2:real^3`); + (EXISTS_TAC `v3:real^3`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `{v0, v1, v2, v3:real^3} SUBSET Sx`); + (EXPAND_TAC "Sx"); + (REWRITE_TAC[SUBSET_INTER]); + (REWRITE_WITH `{v0, v1, v2, v3:real^3} = set_of_list x`); + (ASM_REWRITE_TAC[set_of_list]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `HD (truncate_simplex 1 x) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 x) = v0:real^3`); + (REWRITE_TAC[ASSUME `x = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + + (REWRITE_WITH `u0 = v0:real^3`); + (ASM_MESON_TAC[]); + (REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (EXPAND_TAC "Sr" THEN EXPAND_TAC "Ss"); + (SET_TAC[]); + (REWRITE_WITH `{X INTER x:real^3->bool | x IN Sr} = {f x | x IN Sr}`); + (EXPAND_TAC "f"); + (REFL_TAC); + (SET_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "St" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `x SUBSET UNIONS {mcell i V vl | i <= 4}`); + (ASM_REWRITE_TAC[SUBSET; IN_UNIONS; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?i. i <= 4 /\ x' IN mcell i V vl`); + (MATCH_MP_TAC Sltstlo.SLTSTLO1); + (ASM_REWRITE_TAC[IN]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `mcell i' V vl`); + (STRIP_TAC); + (EXISTS_TAC `i':num` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN]); + + (NEW_GOAL `~NULLSET (X INTER UNIONS {mcell i V vl | i <= 4})`); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (t)`); + (REWRITE_TAC[ASSUME `t:real^3->bool = X INTER x`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER UNIONS {mcell i V vl | i <= 4}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[INTER_UNIONS]); + (STRIP_TAC); + + (NEW_GOAL + `!s. ~NULLSET (UNIONS s) /\ FINITE s ==> (?t. t IN s /\ ~NULLSET t)`); + (MESON_TAC[NEGLIGIBLE_UNIONS]); + (ABBREV_TAC `Sx = {X INTER x | x IN {mcell i V vl | i <= 4}}`); + (NEW_GOAL `?t. t IN Sx /\ ~NULLSET t`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "Sx"); + (ABBREV_TAC `Sy = {mcell i V vl | i <= 4}`); + (ABBREV_TAC `f = (\x:real^3->bool. X INTER x)`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y:real^3->bool | ?x:real^3->bool. x IN Sy /\ y = f x }`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (EXPAND_TAC "Sy"); + (REWRITE_TAC[GSYM IN_NUMSEG_0]); + (ABBREV_TAC `g = (\i:num. mcell i V vl)`); + (REWRITE_WITH `{mcell i V vl | i IN 0..4} = {g i | i IN 0..4}`); + (EXPAND_TAC "g" THEN REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y:real^3->bool | ?i. i IN 0..4 /\ y = g i}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (REWRITE_TAC[FINITE_NUMSEG]); + (SET_TAC[]); + (REWRITE_WITH `{X INTER x:real^3->bool | x IN Sy} = {f x | x IN Sy}`); + (EXPAND_TAC "f" THEN REWRITE_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "Sx" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + +(* ========================================================================= *) + + (NEW_GOAL `i = i' /\ mcell i V ul = mcell i' V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[GSYM Ajripqn.UP_TO_4_KY_LEMMA]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `ul IN barV V 3` THEN REWRITE_TAC[IN]); + (UNDISCH_TAC `~NULLSET t'`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + +(* ========================================================================= *) + + (ASM_CASES_TAC `i' = 0`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER C)`); + (REWRITE_TAC[]); + (REWRITE_WITH `X INTER C = {}:real^3->bool`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell0]); + (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `C SUBSET ball (u0:real^3, sqrt (&2))`); + (NEW_GOAL `ball (u0:real^3, &1) SUBSET ball (u0, sqrt (&2))`); + (MATCH_MP_TAC SUBSET_BALL); + (MATCH_MP_TAC (REAL_ARITH `a < b ==> a <= b`)); + (REWRITE_TAC[Marchal_cells_2_new.ZERO_LT_SQRT_2]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `i' = 1`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER C)`); + (REWRITE_TAC[]); + (REWRITE_WITH `X INTER C = {}:real^3->bool`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell1]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[HD; TL]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 vl) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 vl) = v0:real^3`); + (REWRITE_TAC[ASSUME `vl = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = v1:real^3`); + (REWRITE_TAC[ASSUME `vl = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `C SUBSET (rcone_gt u0 u1 (hl [u0:real^3; u1] / sqrt (&2)))`); + (EXPAND_TAC "C"); + (SET_TAC[ASSUME `rcone_gt u0 u1 c SUBSET + W INTER rcone_gt u0 u1 (hl [u0:real^3; u1] / sqrt (&2))`]); + (UP_ASM_TAC THEN SET_TAC[]); + (SET_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + (ASM_ARITH_TAC); + +(* ========================================================================= *) + + (ABBREV_TAC `f1 = + (\ul. dist (u0:real^3, + closest_point (affine hull {u1, EL 2 ul, mxi V ul}) u0))`); + + (ABBREV_TAC `P1 = { (f1:(real^3)list->real) ul |ul | barV V 3 ul /\ + ~NULLSET (mcell 3 V ul INTER C) /\ + truncate_simplex 1 ul = [u0; u1]}`); + + (NEW_GOAL `~(P1 = {}) ==> (?b:real. b IN P1 /\ (!x. x IN P1 ==> b <= x))`); + (STRIP_TAC); + (MATCH_MP_TAC INF_FINITE_LEMMA); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "P1"); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x | P x} = {f x | x IN {y | P y}}`]); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x IN s} = {y | ?x. x IN s /\ y = f x}`]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y | ?v0:real^3 v1 u2 u3. + v0 IN (V INTER ball (u0:real^3, &4)) /\ + v1 IN (V INTER ball (u0, &4)) /\ + u2 IN (V INTER ball (u0, &4)) /\ + u3 IN (V INTER ball (u0, &4)) /\ + y = [v0; v1; u2; u3]}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SET_LIST_LEMMA); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?v0 v1 u2 u3. x = [v0; v1; u2; u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v0:real^3` THEN EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (x:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (x:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (NEW_GOAL `set_of_list x SUBSET ball (u0:real^3,&4)`); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + (NEW_GOAL `set_of_list x SUBSET V:real^3->bool`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + + (ABBREV_TAC `r1 = (if (P1 = {}:real->bool) then &1 + else (@b. b IN P1 /\ (!x. x IN P1 ==> b <= x)))`); + (NEW_GOAL `&0 < r1`); + (EXPAND_TAC "r1"); + (COND_CASES_TAC); + (REAL_ARITH_TAC); + (NEW_GOAL `?b:real. b IN P1 /\ (!x. x IN P1 ==> b <= x)`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `P = (\b:real. b IN P1 /\ (!x. x IN P1 ==> b <= x))`); + (ABBREV_TAC `zz = (@) (P:real->bool)`); + (NEW_GOAL `(P:real->bool) zz`); + (EXPAND_TAC "zz"); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b':real`); + (EXPAND_TAC "P" THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "P" THEN REWRITE_TAC[]); + (EXPAND_TAC "P1" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "f1"); + (MATCH_MP_TAC DIST_POS_LT); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `closest_point (affine hull {u1, EL 2 ul, mxi V ul}) u0 = u0 + <=> u0 IN (affine hull {u1:real^3, EL 2 ul, mxi V ul})`); + (MATCH_MP_TAC CLOSEST_POINT_REFL); + (REWRITE_TAC[CLOSED_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_EQ_EMPTY] THEN SET_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (mcell 3 V ul INTER C)`); + (REWRITE_TAC[] THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 3 V ul`); + (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]); + (REWRITE_TAC[MCELL_EXPLICIT; mcell3]); + (COND_CASES_TAC); + + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, v2, mxi V [u0; u1; v2; v3]}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_WITH `affine hull {u0, u1, v2, mxi V [u0; u1; v2; v3]} = + affine hull {u1, v2, mxi V [u0; u1; v2; v3]}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + (REWRITE_WITH `affine hull {u1, v2, mxi V [u0; u1; v2; v3]} = + affine hull {u1, EL 2 ul, mxi V ul}`); + (ASM_REWRITE_TAC[EL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`; HD; TL]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + +(* ========================================================================= *) + + (ABBREV_TAC `f2 = + (\ul. dist (u0:real^3, + closest_point (affine hull {u1, EL 2 ul, EL 3 ul}) u0))`); + + (ABBREV_TAC `P2 = { (f2:(real^3)list->real) ul |ul | barV V 3 ul /\ + ~NULLSET (mcell 4 V ul INTER C) /\ + truncate_simplex 1 ul = [u0; u1]}`); + + (NEW_GOAL `~(P2 = {}) ==> (?b:real. b IN P2 /\ (!x. x IN P2 ==> b <= x))`); + (STRIP_TAC); + (MATCH_MP_TAC INF_FINITE_LEMMA); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "P2"); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x | P x} = {f x | x IN {y | P y}}`]); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x IN s} = {y | ?x. x IN s /\ y = f x}`]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y | ?v0:real^3 v1 u2 u3. + v0 IN (V INTER ball (u0:real^3, &4)) /\ + v1 IN (V INTER ball (u0, &4)) /\ + u2 IN (V INTER ball (u0, &4)) /\ + u3 IN (V INTER ball (u0, &4)) /\ + y = [v0; v1; u2; u3]}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SET_LIST_LEMMA); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?v0 v1 u2 u3. x = [v0; v1; u2; u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v0:real^3` THEN EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (x:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (x:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (NEW_GOAL `set_of_list x SUBSET ball (u0:real^3,&4)`); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + (NEW_GOAL `set_of_list x SUBSET V:real^3->bool`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + + (ABBREV_TAC `r2 = (if (P2 = {}:real->bool) then &1 + else (@b. b IN P2 /\ (!x. x IN P2 ==> b <= x)))`); + + (NEW_GOAL `&0 < r2`); + (EXPAND_TAC "r2"); + (COND_CASES_TAC); + (REAL_ARITH_TAC); + (NEW_GOAL `?b:real. b IN P2 /\ (!x. x IN P2 ==> b <= x)`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `P = (\b:real. b IN P2 /\ (!x. x IN P2 ==> b <= x))`); + (ABBREV_TAC `zz = (@) (P:real->bool)`); + (NEW_GOAL `(P:real->bool) zz`); + (EXPAND_TAC "zz"); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b':real`); + (EXPAND_TAC "P" THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "P" THEN REWRITE_TAC[]); + (EXPAND_TAC "P2" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "f2"); + (MATCH_MP_TAC DIST_POS_LT); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `closest_point (affine hull {u1, EL 2 ul, EL 3 ul}) u0 = u0 + <=> u0 IN (affine hull {u1:real^3, EL 2 ul, EL 3 ul})`); + (MATCH_MP_TAC CLOSEST_POINT_REFL); + (REWRITE_TAC[CLOSED_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_EQ_EMPTY] THEN SET_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (mcell 4 V ul INTER C)`); + (REWRITE_TAC[] THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 4 V ul`); + (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4]); + (COND_CASES_TAC); + + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, v2, v3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_WITH `affine hull {u0, u1, v2, v3:real^3} = + affine hull {u1, v2, v3}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + (REWRITE_WITH `affine hull {u1, v2, v3:real^3} = + affine hull {u1, EL 2 ul, EL 3 ul}`); + (ASM_REWRITE_TAC[EL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; HD; TL]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + +(* ========================================================================= *) + + (ABBREV_TAC `r = min (&1) (min r1 r2)`); + (NEW_GOAL `&0 < r`); + (EXPAND_TAC "r"); + (UNDISCH_TAC `&0 < r1` THEN UNDISCH_TAC `&0 < r2` THEN REAL_ARITH_TAC); + +(* ========================================================================= *) + + (ABBREV_TAC `f3 = + (\ul. (((smallest_angle_line (EL 2 ul) (mxi V ul) u0 u1) - u0) + dot (u1 - u0)) / + (norm ((smallest_angle_line (EL 2 ul) (mxi V ul) u0 u1) - u0) + * norm (u1 - u0)))`); + + (ABBREV_TAC `P3 = {(f3:(real^3)list->real) ul |ul | barV V 3 ul /\ + ~NULLSET (mcell 3 V ul INTER C) /\ + truncate_simplex 1 ul = [u0; u1]}`); + + (NEW_GOAL `~(P3 = {}) ==> (?b:real. b IN P3 /\ (!x. x IN P3 ==> x <= b))`); + (STRIP_TAC); + (MATCH_MP_TAC SUP_FINITE_LEMMA); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "P3"); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x | P x} = {f x | x IN {y | P y}}`]); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x IN s} = {y | ?x. x IN s /\ y = f x}`]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y | ?v0:real^3 v1 u2 u3. + v0 IN (V INTER ball (u0:real^3, &4)) /\ + v1 IN (V INTER ball (u0, &4)) /\ + u2 IN (V INTER ball (u0, &4)) /\ + u3 IN (V INTER ball (u0, &4)) /\ + y = [v0; v1; u2; u3]}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SET_LIST_LEMMA); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?v0 v1 u2 u3. x = [v0; v1; u2; u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v0:real^3` THEN EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (x:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (x:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (NEW_GOAL `set_of_list x SUBSET ball (u0:real^3,&4)`); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + (NEW_GOAL `set_of_list x SUBSET V:real^3->bool`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + + (ABBREV_TAC `d1 = (if (P3 = {}:real->bool) then c + else (@b. b IN P3 /\ (!x. x IN P3 ==> x <= b)))`); + + (NEW_GOAL `d1 < &1`); + (EXPAND_TAC "d1"); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?b:real. b IN P3 /\ (!x. x IN P3 ==> x <= b)`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `P = (\b:real. b IN P3 /\ (!x. x IN P3 ==> x <= b))`); + (ABBREV_TAC `zz = (@) (P:real->bool)`); + (NEW_GOAL `(P:real->bool) zz`); + (EXPAND_TAC "zz"); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b':real`); + (EXPAND_TAC "P" THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "P" THEN REWRITE_TAC[]); + (EXPAND_TAC "P3" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "f3"); + + (ABBREV_TAC `xx = smallest_angle_line (EL 2 ul) (mxi V ul) u0 u1`); + (MATCH_MP_TAC REAL_DIV_LT_1_TACTICS); + (STRIP_TAC); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a /\ ~(a = &0) ==> &0 < a`)); + (STRIP_TAC); + (SIMP_TAC[REAL_LE_MUL; NORM_POS_LE]); + (REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "xx"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN + REWRITE_TAC[smallest_angle_line; smallest_angle_set]); + (STRIP_TAC); + (ABBREV_TAC `Q = (\x:real^3. x IN convex hull {EL 2 ul, mxi V ul} /\ + (!y. y IN convex hull {EL 2 ul, mxi V ul} + ==> ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0))))`); + (NEW_GOAL `(Q:real^3->bool) u0`); + (REWRITE_TAC[ASSUME `u0 = (@) (Q:real^3->bool)`]); + (MATCH_MP_TAC SELECT_AX); + (EXPAND_TAC "Q"); + (MATCH_MP_TAC SMALLEST_ANGLE_LINE_EXISTS); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?v1 v2 v3. ul = [u0; v1; v2; v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (ul:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[ASSUME `v0 = u0:real^3`]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `EL 2 ul = v2:real^3`); + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (mcell 3 V ul INTER C)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 3 V ul` THEN STRIP_TAC); + (REWRITE_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; ASSUME `ul = [u0; v1; v2; v3:real^3]`; + SET_RULE `{a,b,c} UNION {d} = {a,b, c,d}`]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, v1, v2, mxi V ul}`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (UNDISCH_TAC `u0 IN convex hull {v2, mxi V ul}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN + EXISTS_TAC `mxi V ul`); + (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (STRIP_TAC); + (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (UP_ASM_TAC THEN EXPAND_TAC "Q"); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (mcell 3 V ul INTER C)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 3 V ul`); + (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]); + (REWRITE_TAC[MCELL_EXPLICIT; mcell3]); + (COND_CASES_TAC); + (NEW_GOAL `?v2 v3. ul = [u0;u1;v2;v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0;v1;v2;v3:real^3]`]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_TAC[GSYM (ASSUME `u0 = (@) (Q:real^3->bool)`)]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, v2, mxi V ul}`); + (REWRITE_TAC[ASSUME `ul = [u0; u1; v2; v3:real^3]`; + CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_WITH `affine hull {u0, u1, v2, mxi V [u0; u1; v2; v3]} = + affine hull {u1, v2, mxi V [u0; u1; v2; v3]}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + + (NEW_GOAL `convex hull {EL 2 ul, mxi V ul} SUBSET + affine hull {EL 2 ul, mxi V ul}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (NEW_GOAL `affine hull {EL 2 ul, mxi V ul} SUBSET + affine hull {u1, v2, mxi V [u0; u1; v2; v3]}`); + (MATCH_MP_TAC AFFINE_SUBSET_KY_LEMMA); + (ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]); + (SET_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN + UNDISCH_TAC `u0 IN convex hull {EL 2 ul, mxi V ul}` THEN SET_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (MATCH_MP_TAC (REAL_ARITH `(a <= b) /\ ~(a = b) ==> a < b`)); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ; NORM_CAUCHY_SCHWARZ_EQ]); + (NEW_GOAL `xx IN convex hull {(EL 2 ul) ,(mxi V ul)}`); + (MATCH_MP_TAC SMALLEST_ANGLE_IN_CONVEX_HULL); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?v1 v2 v3. ul = [u0; v1; v2; v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (ul:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[ASSUME `v0 = u0:real^3`]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `EL 2 ul = v2:real^3`); + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (mcell 3 V ul INTER C)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 3 V ul` THEN STRIP_TAC); + (REWRITE_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; ASSUME `ul = [u0; v1; v2; v3:real^3]`; + SET_RULE `{a,b,c} UNION {d} = {a,b, c,d}`]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, v1, v2, mxi V ul}`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (UNDISCH_TAC `u0 IN convex hull {v2, mxi V ul}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN + EXISTS_TAC `mxi V ul`); + (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (STRIP_TAC); + (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (mcell 3 V ul INTER C)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 3 V ul`); + (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]); + (REWRITE_TAC[MCELL_EXPLICIT; mcell3]); + (COND_CASES_TAC); + (NEW_GOAL `?v2 v3. ul = [u0;u1;v2;v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, v2, mxi V ul}`); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (ABBREV_TAC `m = mxi V ul`); + (NEW_GOAL `mxi V [u0; u1;v2;v3] = m`); + (EXPAND_TAC "m" THEN AP_TERM_TAC THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (ABBREV_TAC `k1 = norm (xx - u0:real^3)`); + (ABBREV_TAC `k2 = norm (u1 - u0:real^3)`); + (UNDISCH_TAC `xx IN convex hull {EL 2 ul, m:real^3}`); + (ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `2 = SUC 1/\ 1 = SUC 0`; + CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (UNDISCH_TAC `k1 % (u1 - u0) = k2 % (xx - u0:real^3)`); + (ASM_REWRITE_TAC[]); + + (STRIP_TAC); + + (REWRITE_TAC[coplanar]); + (NEW_GOAL `~(k2 = &0)`); + (EXPAND_TAC "k2"); + (REWRITE_TAC[NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> b = a`]); + (ASM_REWRITE_TAC[]); + + + (ASM_CASES_TAC `~(v = &0)`); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN + EXISTS_TAC `v2:real^3`); + + (MATCH_MP_TAC (SET_RULE `{a,b,c} SUBSET X /\ d IN X ==> {a,b,c,d} SUBSET X`)); + (STRIP_TAC); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `(k2 - k1:real) / (k2 * v)`); + (EXISTS_TAC `k1 / (k2 * v)`); + (EXISTS_TAC `(--k2 * u) / (k2 * v)`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]); + (REWRITE_WITH `k2 - k1 + k1 + --k2 * u = k2 * (u + v) - k1 + k1 + --k2 * u`); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 0 = 1`] THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `k2 * (u + v) - k1 + k1 + --k2 * u = k2 * v`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[VECTOR_ARITH `a / x % u0 + b / x % u1 + d / x % u2 = + (&1 / x) % (a % u0 + b % u1 + d % u2)`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH + `&1 / (k2 * v) % ((k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2) = m:real^3 <=> + ((k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2) = (k2 * v) % m`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.CHANGE_SIDE); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2 = (k2 * v) % m <=> + k1 % (u1 - u0) = k2 % ((u % v2 + v % m) - u0)`]); + + (NEW_GOAL `~(u = &0)`); + (UP_ASM_TAC THEN UNDISCH_TAC `u + v = &(SUC 0):real` THEN + REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + (REAL_ARITH_TAC); + + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN + EXISTS_TAC `m:real^3`); + (MATCH_MP_TAC (SET_RULE `{a,b,c} SUBSET X /\ d IN X ==> {a,b,d,c} SUBSET X`)); + (STRIP_TAC); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + + (EXISTS_TAC `(k2 - k1:real) / (k2 * u)`); + (EXISTS_TAC `k1 / (k2 * u)`); + (EXISTS_TAC `(--k2 * v) / (k2 * u)`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]); + (REWRITE_WITH `k2 - k1 + k1 + --k2 * v = k2 * (u + v) - k1 + k1 + --k2 * v`); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 0 = 1`] THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `k2 * (u + v) - k1 + k1 + --k2 * v = k2 * u`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[VECTOR_ARITH `a / x % u0 + b / x % u1 + d / x % u2 = + (&1 / x) % (a % u0 + b % u1 + d % u2)`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH + `&1 / (k2 * u) % ((k2 - k1) % u0 + k1 % u1 + (--k2 * v) % m) = v2:real^3 <=> + ((k2 - k1) % u0 + k1 % u1 + (--k2 * v) % m) = (k2 * u) % v2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.CHANGE_SIDE); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(k2 - k1) % u0 + k1 % u1 + (--k2 * v) % m = (k2 * u) % v2 <=> + k1 % (u1 - u0) = k2 % ((u % v2 + v % m) - u0)`]); + + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + +(* ========================================================================== *) + + (ABBREV_TAC `f4 = + (\ul. (((smallest_angle_line (EL 2 ul) (EL 3 ul) u0 u1) - u0) + dot (u1 - u0)) / + (norm ((smallest_angle_line (EL 2 ul) (EL 3 ul) u0 u1) - u0) + * norm (u1 - u0)))`); + + (ABBREV_TAC `P4 = {(f4:(real^3)list->real) ul |ul | barV V 3 ul /\ + ~NULLSET (mcell 4 V ul INTER C) /\ + truncate_simplex 1 ul = [u0; u1]}`); + + (NEW_GOAL `~(P4 = {}) ==> (?b:real. b IN P4 /\ (!x. x IN P4 ==> x <= b))`); + (STRIP_TAC); + (MATCH_MP_TAC SUP_FINITE_LEMMA); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "P4"); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x | P x} = {f x | x IN {y | P y}}`]); + (ONCE_REWRITE_TAC [SET_RULE `{f x| x IN s} = {y | ?x. x IN s /\ y = f x}`]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{y | ?v0:real^3 v1 u2 u3. + v0 IN (V INTER ball (u0:real^3, &4)) /\ + v1 IN (V INTER ball (u0, &4)) /\ + u2 IN (V INTER ball (u0, &4)) /\ + u3 IN (V INTER ball (u0, &4)) /\ + y = [v0; v1; u2; u3]}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SET_LIST_LEMMA); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?v0 v1 u2 u3. x = [v0; v1; u2; u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v0:real^3` THEN EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (x:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (x:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (NEW_GOAL `set_of_list x SUBSET ball (u0:real^3,&4)`); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + (NEW_GOAL `set_of_list x SUBSET V:real^3->bool`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + + (ABBREV_TAC `d2 = (if (P4 = {}:real->bool) then c + else (@b. b IN P4 /\ (!x. x IN P4 ==> x <= b)))`); + (NEW_GOAL `d2 < &1`); + (EXPAND_TAC "d2"); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?b:real. b IN P4 /\ (!x. x IN P4 ==> x <= b)`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `P = (\b:real. b IN P4 /\ (!x. x IN P4 ==> x <= b))`); + (ABBREV_TAC `zz = (@) (P:real->bool)`); + (NEW_GOAL `(P:real->bool) zz`); + (EXPAND_TAC "zz"); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b':real`); + (EXPAND_TAC "P" THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "P" THEN REWRITE_TAC[]); + (EXPAND_TAC "P4" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "f4"); + + (ABBREV_TAC `xx = smallest_angle_line (EL 2 ul) (EL 3 ul) u0 u1`); + (MATCH_MP_TAC REAL_DIV_LT_1_TACTICS); + (STRIP_TAC); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a /\ ~(a = &0) ==> &0 < a`)); + (STRIP_TAC); + (SIMP_TAC[REAL_LE_MUL; NORM_POS_LE]); + (REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "xx"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN + REWRITE_TAC[smallest_angle_line; smallest_angle_set]); + (STRIP_TAC); + (ABBREV_TAC `Q = (\x:real^3. x IN convex hull {EL 2 ul, EL 3 ul} /\ + (!y. y IN convex hull {EL 2 ul, EL 3 ul} + ==> ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0))))`); + (NEW_GOAL `(Q:real^3->bool) u0`); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXPAND_TAC "Q"); + + (MATCH_MP_TAC SMALLEST_ANGLE_LINE_EXISTS); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?v1 v2 v3. ul = [u0; v1; v2; v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (ul:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[ASSUME `v0 = u0:real^3`]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `EL 2 ul = v2:real^3 /\ EL 3 ul = v3`); + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `3 = SUC 2 /\2 = SUC 1 /\ 1 = SUC 0`]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (mcell 4 V ul INTER C)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 4 V ul` THEN STRIP_TAC); + (SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list;ARITH_RULE `4 >= 4`; + ASSUME `ul = [u0; v1; v2; v3:real^3]`]); + (COND_CASES_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, v1, v2, v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (UNDISCH_TAC `u0 IN convex hull {v2, v3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN + EXISTS_TAC `v3:real^3`); + (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (STRIP_TAC); + (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (UP_ASM_TAC THEN EXPAND_TAC "Q"); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (mcell 4 V ul INTER C)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 4 V ul`); + (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]); + (SIMP_TAC[MCELL_EXPLICIT; mcell4; ARITH_RULE `4 >= 4`]); + (COND_CASES_TAC); + (NEW_GOAL `?v2 v3. ul = [u0;u1;v2;v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_TAC[GSYM (ASSUME `u0 = (@) (Q:real^3->bool)`)]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, v2, v3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_WITH `affine hull {u0, u1, v2, v3} = + affine hull {u1, v2, v3:real^3}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + + (NEW_GOAL `convex hull {EL 2 ul, (EL 3 ul):real^3} SUBSET + affine hull {EL 2 ul, EL 3 ul}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (NEW_GOAL `affine hull {EL 2 ul, (EL 3 ul):real^3} SUBSET + affine hull {u1, v2, v3}`); + (MATCH_MP_TAC AFFINE_SUBSET_KY_LEMMA); + (ASM_REWRITE_TAC[EL; HD; TL; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (SET_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN + UNDISCH_TAC `u0 IN convex hull {EL 2 ul, (EL 3 ul):real^3}` THEN SET_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (MATCH_MP_TAC (REAL_ARITH `(a <= b) /\ ~(a = b) ==> a < b`)); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ; NORM_CAUCHY_SCHWARZ_EQ]); + (NEW_GOAL `xx IN convex hull {(EL 2 ul) ,(EL 3 ul):real^3}`); + (MATCH_MP_TAC SMALLEST_ANGLE_IN_CONVEX_HULL); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?v1 v2 v3. ul = [u0; v1; v2; v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (NEW_GOAL `v0 = u0:real^3`); + (REWRITE_WITH `v0 = HD (ul:(real^3)list)`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `u0 = HD (truncate_simplex 1 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[ASSUME `v0 = u0:real^3`]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `EL 2 ul = v2:real^3 /\ EL 3 ul = v3`); + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `3 = SUC 2 /\2 = SUC 1 /\ 1 = SUC 0`]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (mcell 4 V ul INTER C)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 4 V ul` THEN STRIP_TAC); + (SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list;ARITH_RULE `4 >= 4`; + ASSUME `ul = [u0; v1; v2; v3:real^3]`]); + (COND_CASES_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, v1, v2, v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (UNDISCH_TAC `u0 IN convex hull {v2, v3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN + EXISTS_TAC `v3:real^3`); + (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (STRIP_TAC); + (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (mcell 4 V ul INTER C)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `mcell 4 V ul`); + (REWRITE_TAC[SET_RULE `A INTER B SUBSET A`]); + (SIMP_TAC[MCELL_EXPLICIT; mcell4; ARITH_RULE `4 >= 4`]); + (COND_CASES_TAC); + (NEW_GOAL `?v2 v3. ul = [u0;u1;v2;v3:real^3]`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `v0 = u0:real^3`); + (NEW_GOAL `HD (truncate_simplex 1 ul) = u0:real^3`); + (ASM_REWRITE_TAC[HD]); + (NEW_GOAL `HD (truncate_simplex 1 ul) = v0:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `v1 = u1:real^3`); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 ul)) = v1:real^3`); + (REWRITE_TAC[ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, v2, v3:real^3}`); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (ABBREV_TAC `k1 = norm (xx - u0:real^3)`); + (ABBREV_TAC `k2 = norm (u1 - u0:real^3)`); + (UNDISCH_TAC `xx IN convex hull {EL 2 ul,(EL 3 ul):real^3}`); + (ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1/\ 1 = SUC 0`; + CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (UNDISCH_TAC `k1 % (u1 - u0) = k2 % (xx - u0:real^3)`); + (ASM_REWRITE_TAC[]); + + (STRIP_TAC); + + (REWRITE_TAC[coplanar]); + (NEW_GOAL `~(k2 = &0)`); + (EXPAND_TAC "k2"); + (REWRITE_TAC[NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> b = a`]); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `~(v = &0)`); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN + EXISTS_TAC `v2:real^3`); + (MATCH_MP_TAC (SET_RULE `{a,b,c} SUBSET X /\ d IN X ==> {a,b,c,d} SUBSET X`)); + (STRIP_TAC); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `(k2 - k1:real) / (k2 * v)`); + (EXISTS_TAC `k1 / (k2 * v)`); + (EXISTS_TAC `(--k2 * u) / (k2 * v)`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]); + (REWRITE_WITH `k2 - k1 + k1 + --k2 * u = k2 * (u + v) - k1 + k1 + --k2 * u`); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 0 = 1`] THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `k2 * (u + v) - k1 + k1 + --k2 * u = k2 * v`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[VECTOR_ARITH `a / x % u0 + b / x % u1 + d / x % u2 = + (&1 / x) % (a % u0 + b % u1 + d % u2)`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH + `&1 / (k2 * v) % ((k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2) = v3:real^3 <=> + ((k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2) = (k2 * v) % v3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.CHANGE_SIDE); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(k2 - k1) % u0 + k1 % u1 + (--k2 * u) % v2 = (k2 * v) % v3 <=> + k1 % (u1 - u0) = k2 % ((u % v2 + v % v3) - u0)`]); + + (NEW_GOAL `~(u = &0)`); + (UP_ASM_TAC THEN UNDISCH_TAC `u + v = &(SUC 0):real` THEN + REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + (REAL_ARITH_TAC); + + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN + EXISTS_TAC `v3:real^3`); + (MATCH_MP_TAC (SET_RULE `{a,b,c} SUBSET X /\ d IN X ==> {a,b,d,c} SUBSET X`)); + (STRIP_TAC); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + + (EXISTS_TAC `(k2 - k1:real) / (k2 * u)`); + (EXISTS_TAC `k1 / (k2 * u)`); + (EXISTS_TAC `(--k2 * v) / (k2 * u)`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]); + (REWRITE_WITH `k2 - k1 + k1 + --k2 * v = k2 * (u + v) - k1 + k1 + --k2 * v`); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 0 = 1`] THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `k2 * (u + v) - k1 + k1 + --k2 * v = k2 * u`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[VECTOR_ARITH `a / x % u0 + b / x % u1 + d / x % u2 = + (&1 / x) % (a % u0 + b % u1 + d % u2)`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH + `&1 / (k2 * u) % ((k2 - k1) % u0 + k1 % u1 + (--k2 * v) % v3) = v2:real^3 <=> + ((k2 - k1) % u0 + k1 % u1 + (--k2 * v) % v3) = (k2 * u) % v2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.CHANGE_SIDE); + (REWRITE_TAC[REAL_ENTIRE] THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(k2 - k1) % u0 + k1 % u1 + (--k2 * v) % m = (k2 * u) % v2 <=> + k1 % (u1 - u0) = k2 % ((u % v2 + v % m) - u0)`]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + +(* ========================================================================== *) + + (ABBREV_TAC `d = max c (max d1 d2)`); + (NEW_GOAL `d < &1`); + (UNDISCH_TAC `d2 < &1` THEN UNDISCH_TAC `d1 < &1` THEN + UNDISCH_TAC `&0 < c /\ c < &1`); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + +(* ========================================================================== *) + (ABBREV_TAC `D = ball (u0:real^3,r) INTER rcone_gt u0 u1 d`); + (NEW_GOAL `D SUBSET C:real^3->bool`); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + + (NEW_GOAL `!X. mcell_set V X /\ ~NULLSET (X INTER D) + ==> (?k vl. + 2 <= k /\ + barV V 3 vl /\ + X = mcell k V vl /\ + truncate_simplex 1 vl = [u0; u1])`); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[] THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER C:real^3->bool`); + (ASM_REWRITE_TAC[] THEN UNDISCH_TAC `D SUBSET C:real^3->bool`); + (SET_TAC[]); + +(* ========================================================================= *) + + (NEW_GOAL `D = conic_cap (u0:real^3) u1 r d`); + (EXPAND_TAC "D" THEN REWRITE_TAC[conic_cap; NORMBALL_BALL]); + + (NEW_GOAL `!X. mcell_set V X /\ ~NULLSET (X INTER D) ==> + vol (X INTER D) = vol (D) * (dihX V X (u0,u1)) / (&2 * pi)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `?k vl. + 2 <= k /\ + barV V 3 vl /\ + X = mcell k V vl /\ + truncate_simplex 1 vl = [u0; u1]`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + +(* ========================================================================= *) +(* Case k = 2 *) +(* ========================================================================= *) + + (ASM_CASES_TAC `k = 2`); + (ABBREV_TAC `m = mxi V vl`); + (ABBREV_TAC `s3 = omega_list_n V vl 3`); + (ABBREV_TAC `L = aff_ge{u0, u1} {m, s3:real^3}`); + + (REWRITE_WITH `vol (X INTER D) = vol (L INTER D)`); + (AP_TERM_TAC); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2]); + (LET_TAC); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (REWRITE_WITH `HD vl = u0 /\ HD (TL vl) = u1:real^3`); + (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = v1:real^3`); + (REWRITE_TAC[ASSUME `vl = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + + (EXPAND_TAC "L"); + (REWRITE_TAC [SET_RULE `(A INTER B INTER C) INTER D = C INTER D + <=> (!x. x IN C INTER D ==> x IN A /\ x IN B)`]); + + (REPEAT GEN_TAC THEN STRIP_TAC); + (NEW_GOAL `x:real^3 IN D`); + (UP_ASM_TAC THEN UNDISCH_TAC `D = conic_cap (u0:real^3) u1 r d`); + (SET_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "D" THEN STRIP_TAC); + (NEW_GOAL `x:real^3 IN rcone_gt u0 u1 a'`); + (NEW_GOAL `rcone_gt (u0:real^3) u1 d SUBSET rcone_gt u0 u1 c`); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC + `rcone_gt (u0:real^3) u1 c SUBSET W INTER rcone_gt u0 u1 a'`); + (SET_TAC[]); + (STRIP_TAC); + (UP_ASM_TAC THEN SET_TAC[RCONE_GT_SUBSET_RCONE_GE]); + +(* ========================================================================== *) + (UP_ASM_TAC THEN REWRITE_TAC[rcone_ge; rconesgn; rcone_gt; IN; IN_ELIM_THM]); + (STRIP_TAC); + + (ABBREV_TAC `y = u0 + proj_point (u1 - u0:real^3) (x - u0)`); + (NEW_GOAL `orthogonal (x - y) (u1 - u0:real^3)`); + (REWRITE_WITH `x - y = (x - u0) - proj_point (u1 - u0) (x - u0:real^3)`); + (EXPAND_TAC "y" THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[GSYM Marchal_cells_2_new.projection_proj_point]); + (REWRITE_TAC[orthogonal; Packing3.PROJECTION_ORTHOGONAL]); + + (NEW_GOAL `norm (x - u0) pow 2 = norm (y - u0) pow 2 + norm (x - y:real^3) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (ONCE_REWRITE_TAC[VECTOR_ARITH `(a - b) dot c = --(c dot (b - a))`]); + (REWRITE_WITH `y - u0 = proj_point (u1 - u0) (x - u0:real^3)`); + (EXPAND_TAC "y" THEN REWRITE_TAC[VECTOR_ARITH `(a + b) - a:real^3 = b`]); + (REWRITE_TAC[PRO_EXP; DOT_RMUL]); + (UP_ASM_TAC THEN REWRITE_TAC[orthogonal] THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + + (NEW_GOAL `norm (x - u1) pow 2 = norm (y - u1) pow 2 + norm (x - y:real^3) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (ONCE_REWRITE_TAC[VECTOR_ARITH `(a - b) dot c = c dot (a - b)`]); + (REWRITE_WITH `u1 - y = (u1 - u0) - proj_point (u1 - u0) (x - u0:real^3)`); + (EXPAND_TAC "y" THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[PRO_EXP; VECTOR_ARITH `x - a % x = (&1 - a) % x`]); + (REWRITE_TAC[DOT_RMUL] THEN DEL_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[orthogonal] THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + + (MP_TAC (ASSUME `(x - u0:real^3) dot (u1 - u0) > + dist (x,u0) * dist (u1,u0) * a'`)); + (REWRITE_WITH `(x - u0) dot (u1 - u0) = + (x - y) dot (u1 - u0) + (y - u0) dot (u1 - u0:real^3)`); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `(x - u1) dot (u0 - u1) = + (x - y) dot (u0 - u1) + (y - u1) dot (u0 - u1:real^3)`); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `(x - y) dot (u1 - u0:real^3) = &0`); + (ASM_REWRITE_TAC[GSYM orthogonal]); + (REWRITE_WITH `(x - y) dot (u0 - u1:real^3) = &0`); + (ONCE_REWRITE_TAC[VECTOR_ARITH `a dot (u0 - u1) = --(a dot (u1 - u0))`]); + (REWRITE_TAC[REAL_ARITH `--a = &0 <=> a = &0`]); + (ASM_REWRITE_TAC[GSYM orthogonal]); + (REWRITE_TAC[REAL_ARITH `&0 + a = a`]); + + (STRIP_TAC); + (NEW_GOAL `(y - u0) dot (u1 - u0) = norm (y - u0) * norm (u1 - u0:real^3)`); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ_EQ]); + (REWRITE_WITH `y - u0 = proj_point (u1 - u0) (x - u0:real^3)`); + (EXPAND_TAC "y" THEN REWRITE_TAC[VECTOR_ARITH `(a + b) - a:real^3 = b`]); + (REWRITE_TAC[PRO_EXP; NORM_MUL; VECTOR_MUL_ASSOC]); + (MATCH_MP_TAC (MESON[] `a = b ==> a % x = b % x`)); + (REWRITE_TAC[REAL_ARITH `a * norm b = norm b * a`]); + (MATCH_MP_TAC (MESON[] `a = b ==> x * a = x * b`)); + (REWRITE_TAC[REAL_ABS_REFL]); + (MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[DOT_POS_LE]); + + (REWRITE_WITH `(x - u0) dot (u1 - u0) = + (x - y) dot (u1 - u0) + (y - u0) dot (u1 - u0:real^3)`); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `(x - y) dot (u1 - u0:real^3) = &0`); + (ASM_REWRITE_TAC[GSYM orthogonal]); + (REWRITE_TAC[REAL_ARITH `&0 + a = a`]); + + (NEW_GOAL `y IN convex hull {u0, u1:real^3}`); + (NEW_GOAL `y IN affine hull {u0, u1:real^3}`); + (REWRITE_TAC[AFFINE_HULL_2; IN; IN_ELIM_THM]); + (EXPAND_TAC "y" THEN REWRITE_TAC[PRO_EXP]); + (ABBREV_TAC `rtemp = ((x - u0) dot (u1 - u0)) / ((u1 - u0) dot (u1 - + u0:real^3))`); + (EXISTS_TAC `&1 - rtemp` THEN EXISTS_TAC `rtemp:real`); + (STRIP_TAC); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[IN; AFFINE_HULL_2; CONVEX_HULL_2; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `y - u0 = v % (u1 - u0:real^3)`); + (NEW_GOAL `y - u0 = y - (u + v) % u0:real^3`); + (REWRITE_TAC[ASSUME `u + v = &1`; VECTOR_MUL_LID]); + (UP_ASM_TAC THEN REWRITE_WITH `y - (u + v) % u0 = v % (u1 - u0:real^3)`); + (REWRITE_TAC[ASSUME `y = u % u0 + v % u1:real^3`] THEN VECTOR_ARITH_TAC); + + (ASM_CASES_TAC `u < &0`); + (NEW_GOAL `F`); + (NEW_GOAL `norm (y - u0) <= norm (x - u0:real^3)`); + (MATCH_MP_TAC Tactics_jordan.REAL_POW_2_LE); + (REWRITE_TAC[NORM_POS_LE; ASSUME + `norm (x - u0:real^3) pow 2 = norm (y - u0) pow 2 + norm (x - y) pow 2`; + REAL_ARITH `a <= a + b <=> &0 <= b`; REAL_LE_POW_2]); + (NEW_GOAL `norm (x - u0:real^3) < &1`); + (REWRITE_TAC[GSYM dist] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN + REWRITE_TAC[GSYM IN_BALL]); + (NEW_GOAL `ball (u0:real^3, r) SUBSET ball (u0, &1)`); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC + `x IN ball (u0:real^3,r) INTER rcone_gt u0 u1 d` THEN SET_TAC[]); + + (NEW_GOAL `norm (y - u0) = v * norm (u1:real^3 - u0)`); + (ASM_REWRITE_TAC[NORM_MUL]); + + (REWRITE_WITH `abs v = v`); + (REWRITE_TAC[REAL_ABS_REFL]); + (UNDISCH_TAC `u + v = &1` THEN UNDISCH_TAC `u < &0` THEN REAL_ARITH_TAC); + (NEW_GOAL `&2 <= norm (u1 - u0:real^3)`); + (REWRITE_TAC[GSYM dist]); + (UNDISCH_TAC `packing (V:real^3->bool)` THEN REWRITE_TAC[packing]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[MESON[IN] `V x <=> x IN (V:real^3->bool)`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `v * &2 <= v * norm (u1 - u0:real^3)`); + (REWRITE_TAC[REAL_ARITH `a * b <= a * c <=> &0 <= a * (c - b)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (UNDISCH_TAC `u + v = &1` THEN UNDISCH_TAC `u < &0` THEN UP_ASM_TAC); + (REAL_ARITH_TAC); + + (NEW_GOAL `&1 < v`); + (UNDISCH_TAC `u + v = &1` THEN UNDISCH_TAC `u < &0` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN + UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `v < &0`); + (NEW_GOAL `F`); + (NEW_GOAL `(y - u0) dot (u1 - u0:real^3) <= &0`); + (ASM_REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DOT_POS_LE]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `&0 <= dist (x,u0) * dist (u1,u0:real^3) * a'`); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (EXPAND_TAC "a'" THEN MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (REWRITE_TAC[HL_2]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE] THEN REAL_ARITH_TAC); + (MATCH_MP_TAC SQRT_POS_LE THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC + `(y - u0:real^3) dot (u1 - u0) > dist (x,u0) * dist (u1,u0) * a'`); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `&0 <= dist (x,u0) * dist (u1,u0:real^3) * a'`); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (EXPAND_TAC "a'" THEN MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (REWRITE_TAC[HL_2]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE] THEN REAL_ARITH_TAC); + (MATCH_MP_TAC SQRT_POS_LE THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `(y - u1) dot (u0 - u1) = norm (y - u1) * norm (u0 - u1:real^3)`); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ_EQ]); + (REWRITE_WITH `y - u1 = proj_point (u1 - u0) (x - u0:real^3) - (u1 - u0)`); + (EXPAND_TAC "y" THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[PRO_EXP; VECTOR_ARITH `x % a - a = (x - &1) % a`; NORM_MUL; + VECTOR_MUL_ASSOC]); + (REWRITE_WITH ` + (norm (u0 - u1) * + (((x - u0) dot (u1 - u0)) / ((u1 - u0) dot (u1 - u0)) - &1)) % (u1 - u0) = + (norm (u0 - u1:real^3) * + (&1 - ((x - u0) dot (u1 - u0)) / ((u1 - u0) dot (u1 - u0)))) % (u0 - u1)`); + (VECTOR_ARITH_TAC); + (MATCH_MP_TAC (MESON[] `a = b ==> a % x = b % x`)); + (REWRITE_TAC[REAL_ARITH `a * norm b = norm b * a`]); + (REWRITE_TAC[NORM_ARITH `norm (a - b) = norm (b - a)`]); + (MATCH_MP_TAC (MESON[] `a = b ==> x * a = x * b`)); + (REWRITE_TAC[REAL_ARITH `abs (x - &1) = abs (&1 - x)`]); + (REWRITE_TAC[REAL_ABS_REFL; REAL_ARITH `&0 <= a - b <=> b <= a`]); + (REWRITE_WITH `((x - u0) dot (u1 - u0)) / ((u1 - u0) dot (u1 - u0)) <= &1 + <=> ((x - u0) dot (u1 - u0)) <= &1 * ((u1 - u0) dot (u1 - u0:real^3))`); + (MATCH_MP_TAC REAL_LE_LDIV_EQ); + (REWRITE_TAC[DOT_POS_LT; VECTOR_ARITH `a - b = vec 0 <=> b = a`]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(x - u0) dot (u1 - u0) <= norm (x - u0) * norm (u1 - u0:real^3)`); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ]); + + (NEW_GOAL `norm (x - u0) * norm (u1 - u0) <= &1 * norm (u1 - u0:real^3)`); + (REWRITE_TAC[REAL_ARITH `a * x <= b * x <=> &0 <= (b - a) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `&0 <= a - b <=> b <= a`; GSYM dist]); + (MATCH_MP_TAC (REAL_ARITH `a < x ==> a <= x`)); + (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[GSYM IN_BALL]); + (NEW_GOAL `ball (u0:real^3, r) SUBSET ball (u0, &1)`); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC + `x IN ball (u0:real^3,r) INTER rcone_gt u0 u1 d` THEN SET_TAC[]); + (REWRITE_TAC[GSYM NORM_POW_2; REAL_ARITH `&1 * a pow 2 = a * a`]); + (NEW_GOAL `&1 * norm (u1 - u0) <= norm (u1 - u0) * norm (u1 - u0:real^3)`); + (REWRITE_TAC[REAL_ARITH `a * x <= b * x <=> &0 <= (b - a) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `&0 <= a - b <=> b <= a`; GSYM dist]); + (MATCH_MP_TAC (REAL_ARITH `&2 <= x ==> &1 <= x`)); + (UNDISCH_TAC `packing (V:real^3->bool)` THEN REWRITE_TAC[packing]); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[MESON[IN] `V x <=> x IN (V:real^3->bool)`]); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `(x - u0:real^3) dot (u1 - u0) <= + norm (x - u0) * norm (u1 - u0)` THEN + UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[dist]); + (REWRITE_TAC[REAL_ARITH `a * b >= x * b * c <=> &0 <= b * (a - x * c)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `&0 <= a - b <=> b <= a`]); + (MATCH_MP_TAC Tactics_jordan.REAL_POW_2_LE); + (STRIP_TAC); + + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (EXPAND_TAC "a'" THEN MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (REWRITE_TAC[HL_2]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE] THEN REAL_ARITH_TAC); + (MATCH_MP_TAC SQRT_POS_LE THEN REAL_ARITH_TAC); + (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `(a * b) pow 2 = a pow 2 * b pow 2`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `(a + b) * x <= a <=> b * x <= (&1 - x) * a`]); + + (UNDISCH_TAC `(y - u0) dot (u1 - u0) > dist (x,u0) * dist (u1,u0:real^3) * a'`); + (ASM_REWRITE_TAC[dist]); + (REWRITE_TAC[REAL_ARITH `a * b > x * b * c <=> &0 < b * (a - x * c)`]); + (REWRITE_TAC[REAL_MUL_POS_LT]); + (REWRITE_WITH `~(norm (u1 - u0:real^3) < &0 /\ + norm (y - u0) - norm (x - u0) * a' < &0)`); + (NEW_GOAL `&0 <= norm (u1 - u0:real^3)`); + (REWRITE_TAC[NORM_POS_LE]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&0 < a - b <=> b < a`]); + (REWRITE_WITH `norm (x - u0) * a' < norm (y - u0:real^3) <=> + (norm (x - u0) * a') pow 2 < norm (y - u0) pow 2`); + (MATCH_MP_TAC Pack1.bp_bdt); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (EXPAND_TAC "a'" THEN MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (REWRITE_TAC[HL_2]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE] THEN REAL_ARITH_TAC); + (MATCH_MP_TAC SQRT_POS_LE THEN REAL_ARITH_TAC); + (REWRITE_TAC[NORM_POS_LE]); + + (ASM_REWRITE_TAC[REAL_ARITH `(a * b) pow 2 = a pow 2 * b pow 2`]); + (REWRITE_TAC[REAL_ARITH `(a + b) * x < a <=> b * x < (&1 - x) * a`]); + (STRIP_TAC); + + (NEW_GOAL `(&1 - a' pow 2) * norm (y - u0) pow 2 <= + (&1 - a' pow 2) * norm (y - u1:real^3) pow 2`); + (REWRITE_TAC[REAL_ARITH `a * x <= a * y <=> &0 <= a * (y - x)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 <= &1 - b <=> b <= &1 pow 2`]); + (REWRITE_WITH `a' pow 2 <= &1 pow 2 <=> a' <= &1`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.POW2_COND); + (REWRITE_TAC[REAL_ARITH `&0 <= &1`]); + (EXPAND_TAC "a'" THEN MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (REWRITE_TAC[HL_2]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE] THEN REAL_ARITH_TAC); + (MATCH_MP_TAC SQRT_POS_LE THEN REAL_ARITH_TAC); + + (EXPAND_TAC "a'"); + (MATCH_MP_TAC REAL_DIV_LE_1_TACTICS); + (ASM_SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]); + (UNDISCH_TAC `hl [u0; u1:real^3] < sqrt (&2)` THEN REAL_ARITH_TAC); + (NEW_GOAL `norm (x - u0) pow 2 <= norm (x - u1:real^3) pow 2`); + (REWRITE_WITH `norm (x - u0) pow 2 <= norm (x - u1:real^3) pow 2 <=> + norm (x - u0) <= norm (x - u1:real^3)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.POW2_COND); + (REWRITE_TAC[NORM_POS_LE]); + (MATCH_MP_TAC (REAL_ARITH `&2 * x <= x + y ==> x <= y`)); + (REWRITE_TAC[GSYM dist]); + + (NEW_GOAL `dist (x, u0:real^3) < &1`); + (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[GSYM IN_BALL]); + (NEW_GOAL `ball (u0:real^3, r) SUBSET ball (u0, &1)`); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC + `x IN ball (u0:real^3,r) INTER rcone_gt u0 u1 d` THEN SET_TAC[]); + (NEW_GOAL `&2 * dist (x, u0:real^3) < &2`); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (NEW_GOAL `&2 <= dist (x, u0) + dist (x, u1:real^3)`); + (NEW_GOAL `&2 <= dist (u0, u1:real^3)`); + (UNDISCH_TAC `packing (V:real^3->bool)` THEN REWRITE_TAC[packing]); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[MESON[IN] `V a <=> a:real^3 IN V`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `dist (u0, u1:real^3) <= dist (u0, x) + dist (x, u1)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_SYM]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER C:real^3->bool`); + (ASM_SIMP_TAC [SET_RULE `A SUBSET B ==> X INTER A SUBSET X INTER B`]); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2; SET_RULE `{} INTER s = {}`]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `~coplanar {u0, u1:real^3, m, s3}`); + (ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, m, s3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (UP_ASM_TAC THEN MESON_TAC[]); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2]); + (COND_CASES_TAC); + (LET_TAC); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> M INTER N INTER A SUBSET B`)); + + (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `HD vl = u0 /\ HD (TL vl) = u1:real^3`); + (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = u1:real^3`); + (ASM_REWRITE_TAC[HD; TL]); + (NEW_GOAL `HD (TL(truncate_simplex 1 vl)) = v1:real^3`); + (REWRITE_TAC[ASSUME `vl = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_WITH `{u0, u1, m, s3} = {u0, u1} UNION {m:real^3, s3}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[] THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + +(* ========================================================================= *) + (ASM_CASES_TAC `azim u0 u1 m (s3:real^3) < pi`); + (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 m s3)`); + (ASM_SIMP_TAC[WEDGE_LUNE]); + (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`); + (SET_TAC[]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {m, s3} DIFF conic_cap u0 u1 r d INTER L = {}`); + (EXPAND_TAC "L"); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`)); + (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]); + (REWRITE_TAC[SET_RULE `A UNION {} = A`]); + (EXPAND_TAC "L"); + + (REWRITE_WITH `aff_ge {u0, u1:real^3} {m, s3} = + aff_gt {u0, u1} {m, s3} UNION + UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}}`); + (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[DISJOINT]); + + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`); + (REWRITE_WITH `{u0, u1, m, s3} = {u0, u1, s3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `s3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`); + (REWRITE_WITH `{u0, u1, m, s3} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({m, s3} DELETE a) | a | a IN {m, s3}}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `aff_ge {u0, u1:real^3} {m} UNION aff_ge {u0, u1:real^3} {s3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, m}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,m:real^3} = {u0,u1} UNION {m}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, s3}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,s3:real^3} = {u0,u1} UNION {s3}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`)); + (STRIP_TAC); + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`); + (REWRITE_WITH `{u0, u1, m, s3} = {u0, u1, s3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `s3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`); + (REWRITE_WITH `{u0, u1, m, s3} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (SET_TAC[]); + + (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]); + (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 m s3) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 m s3 / &3 * (&1 - max d (-- &1)) * r pow 3)`); + (NEW_GOAL `~collinear {u0:real^3, u1, m} /\ ~collinear {u0, u1, s3}`); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s3:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `azim (u0:real^3) u1 m s3 = dihV u0 u1 m s3`); + (MATCH_MP_TAC AZIM_DIHV_SAME); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s3:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (LET_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(2, vl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN; ARITH_RULE `2 <= 4`] THEN ASM_REWRITE_TAC[]); + (REWRITE_WITH `initial_sublist [u0;u1:real^3] vl /\ LENGTH [u0;u1] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC); + + (NEW_GOAL `k' = 2 /\ mcell k' V ul = mcell 2 V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell k' V ul INTER mcell 2 V vl = X`); + (SET_TAC[ASSUME `X = mcell k' V ul`; + ASSUME `X = mcell k V vl`; ASSUME `k = 2`]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[]); + + (COND_CASES_TAC); + (REWRITE_TAC[dihu2]); + + (REWRITE_WITH `omega_list_n V ul 3 = s3`); + (EXPAND_TAC "s3"); + (NEW_GOAL `2 = 2 /\ + (!k. 2 - 1 <= k /\ k <= 3 + ==> omega_list_n V ul k = omega_list_n V vl k)`); + (MATCH_MP_TAC MCELL_ID_OMEGA_LIST_N); + (ASM_REWRITE_TAC[SET_RULE `2 IN {2,3,4}`]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k' V ul`); GSYM (ASSUME `k' = 2`)]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (FIRST_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + + (REWRITE_WITH `mxi V ul = m`); + (EXPAND_TAC "m"); + (MATCH_MP_TAC MCELL_ID_MXI); + (EXISTS_TAC `2` THEN EXISTS_TAC `2`); + (ASM_REWRITE_TAC[SET_RULE `2 IN {2,3}`]); + (STRIP_TAC); + + (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[HD]); + + (REWRITE_WITH `(HD ul):real^3 = HD (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[HD]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k' V ul`); GSYM (ASSUME `k' = 2`)]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `initial_sublist [u0; u1:real^3] ul /\ LENGTH [u0; u1] = 1 + 1`); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[EL; HD; ARITH_RULE `1 = SUC 0`; TL]); + (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]); + (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]); + (AP_THM_TAC THEN AP_TERM_TAC); + + (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`); + (MATCH_MP_TAC VOLUME_CONIC_CAP); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN MESON_TAC[]); + (UNDISCH_TAC `d < &1` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + + (REWRITE_WITH `max d (--(&1)) = d`); + (MATCH_MP_TAC (REAL_ARITH `&0 < d /\ --(&1) < &0 ==> max d (--(&1)) = d`)); + (REWRITE_TAC[REAL_NEG_LT0]); + (STRIP_TAC); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) +(* OK here *) + + (ASM_CASES_TAC `azim u0 u1 s3 (m:real^3) < pi`); + (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (STRIP_TAC); + (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 s3 m)`); + (ASM_SIMP_TAC[WEDGE_LUNE]); + (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`); + (SET_TAC[]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + + (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {s3, m} DIFF conic_cap u0 u1 r d INTER L = {}`); + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`)); + (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]); + (REWRITE_TAC[SET_RULE `A UNION {} = A`]); + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]); + + (REWRITE_WITH `aff_ge {u0, u1:real^3} {m, s3} = + aff_gt {u0, u1} {m, s3} UNION + UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}}`); + (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[DISJOINT]); + + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, s3, m:real^3}`); + (REWRITE_WITH `{u0, u1, s3, m} = {u0, u1, s3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `s3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, s3, m:real^3}`); + (REWRITE_WITH `{u0, u1, s3, m} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({m, s3} DELETE a) | a | a IN {m, s3}}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `aff_ge {u0, u1:real^3} {m} UNION aff_ge {u0, u1:real^3} {s3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, m}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,m:real^3} = {u0,u1} UNION {m}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, s3}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,s3:real^3} = {u0,u1} UNION {s3}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`)); + (STRIP_TAC); + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, s3, m:real^3}`); + (REWRITE_WITH `{u0, u1, s3, m} = {u0, u1, s3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `s3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, s3, m:real^3}`); + (REWRITE_WITH `{u0, u1, s3, m} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (SET_TAC[]); + + (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]); + (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 s3 m) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 s3 m / &3 * (&1 - max d (-- &1)) * r pow 3)`); + (NEW_GOAL `~collinear {u0:real^3, u1, m} /\ ~collinear {u0, u1, s3}`); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s3:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ASM_REWRITE_TAC[]); + + (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + + (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `azim (u0:real^3) u1 s3 m = dihV u0 u1 s3 m`); + (MATCH_MP_TAC AZIM_DIHV_SAME); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s3:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (LET_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(2, vl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN; ARITH_RULE `2 <= 4`] THEN ASM_REWRITE_TAC[]); + (REWRITE_WITH `initial_sublist [u0;u1:real^3] vl /\ LENGTH [u0;u1] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC); + + (NEW_GOAL `k' = 2 /\ mcell k' V ul = mcell 2 V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell k' V ul INTER mcell 2 V vl = X`); + (REWRITE_TAC[ASSUME `X = mcell k V vl`; GSYM (ASSUME `X = mcell k' V ul`); + ASSUME `k = 2`]); + (SET_TAC[]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]); + (SET_TAC[]); + (UNDISCH_TAC `~NULLSET X` THEN UP_ASM_TAC THEN MESON_TAC[]); + + (COND_CASES_TAC); + (REWRITE_TAC[dihu2]); + (REWRITE_WITH `omega_list_n V ul 3 = s3`); + (EXPAND_TAC "s3"); + (NEW_GOAL `2 = 2 /\ + (!k. 2 - 1 <= k /\ k <= 3 + ==> omega_list_n V ul k = omega_list_n V vl k)`); + (MATCH_MP_TAC MCELL_ID_OMEGA_LIST_N); + (ASM_REWRITE_TAC[SET_RULE `2 IN {2,3,4}`]); + (STRIP_TAC); + (MESON_TAC[ASSUME `X = mcell k V vl`; ASSUME `X = mcell k' V ul`; + ASSUME `k = 2`; ASSUME `k' = 2`]); + (REWRITE_WITH `mcell 2 V ul = X`); + (MESON_TAC[ASSUME `X = mcell k' V ul`; ASSUME `k' = 2`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + + (REWRITE_WITH `mxi V ul = m`); + (EXPAND_TAC "m"); + (MATCH_MP_TAC MCELL_ID_MXI); + (EXISTS_TAC `2` THEN EXISTS_TAC `2`); + (ASM_REWRITE_TAC[SET_RULE `2 IN {2,3}`]); + (STRIP_TAC); + + (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 1 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[HD]); + + (REWRITE_WITH `(HD ul):real^3 = HD (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (REWRITE_TAC[HD]); + + (STRIP_TAC); + (MESON_TAC[ASSUME `X = mcell k V vl`; ASSUME `X = mcell k' V ul`; + ASSUME `k = 2`; ASSUME `k' = 2`]); + (REWRITE_WITH `mcell 2 V ul = X`); + (MESON_TAC[ASSUME `X = mcell k' V ul`; ASSUME `k' = 2`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `initial_sublist [u0; u1:real^3] ul /\ LENGTH [u0; u1] = 1 + 1`); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[EL; HD; ARITH_RULE `1 = SUC 0`; TL]); + (REWRITE_TAC[DIHV_SYM_2]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + + (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]); + (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]); + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`); + (MATCH_MP_TAC VOLUME_CONIC_CAP); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (UP_ASM_TAC THEN UNDISCH_TAC `d < &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `&0 < r` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `max d (--(&1)) = d`); + (MATCH_MP_TAC (REAL_ARITH `&0 < d ==> max d (--(&1)) = d`)); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================== *) + + (NEW_GOAL `F`); + (NEW_GOAL `azim (u0:real^3) u1 s3 m = + (if azim u0 u1 m s3 = &0 then &0 else &2 * pi - azim u0 u1 m s3)`); + (MATCH_MP_TAC AZIM_COMPL); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s3:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b, d, c}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN COND_CASES_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `(&0 < pi)`); + (REWRITE_TAC[PI_POS]); + (UNDISCH_TAC `~(azim (u0:real^3) u1 m s3 < pi)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (STRIP_TAC); + + (NEW_GOAL `azim (u0:real^3) u1 m s3 = pi`); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `~coplanar {u0, u1, m, s3:real^3}`); + (REWRITE_TAC[] THEN MATCH_MP_TAC AZIM_EQ_0_PI_IMP_COPLANAR); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + +(* ========================================================================= *) +(* Case k >= 4 *) +(* ========================================================================= *) + + (ASM_CASES_TAC `k >= 4`); + (NEW_GOAL `?u2 u3. vl = [u0; u1;u2;u3:real^3]`); + (NEW_GOAL `?v0 v1 u2 u3. vl = [v0; v1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + + (REWRITE_WITH `u0 = v0:real^3`); + (REWRITE_WITH `v0:real^3 = HD (truncate_simplex 1 vl)`); + (REWRITE_TAC[ASSUME `vl = [v0;v1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + + (REWRITE_WITH `u1 = v1:real^3`); + (REWRITE_WITH `v1:real^3 = HD (TL (truncate_simplex 1 vl))`); + (REWRITE_TAC[ASSUME `vl = [v0;v1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ABBREV_TAC `L = aff_ge{u0, u1} {u2, u3:real^3}`); + + (REWRITE_WITH `vol (X INTER D) = vol (L INTER D)`); + (AP_TERM_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4; ARITH_RULE `4 >= 4`;set_of_list]); + (COND_CASES_TAC); + + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `A = B <=> A SUBSET B /\ B SUBSET A`]); + (STRIP_TAC); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> A INTER X SUBSET B INTER X`)); + (REWRITE_TAC[Marchal_cells_2_new.CONVEX_HULL_4_SUBSET_AFF_GE_2_2]); + (MATCH_MP_TAC (SET_RULE `(!x. x IN A /\ x IN B ==> x IN C) ==> + A INTER B SUBSET C INTER B`)); + (NEW_GOAL `DISJOINT {u0,u1:real^3} {u2, u3}`); + (REWRITE_TAC[DISJOINT]); + (MATCH_MP_TAC (MESON[] `(~A:bool ==> F) ==> A`)); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN REWRITE_TAC[SET_RULE `A INTER X SUBSET A`]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (NEW_GOAL `u3 IN {u0, u1:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + + (SIMP_TAC[ASSUME `DISJOINT {u0, u1} {u2, u3:real^3}`; AFF_GE_2_2]); + (REWRITE_TAC[CONVEX_HULL_4; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN + EXISTS_TAC `t3:real` THEN EXISTS_TAC `t4:real`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= a <=> (a < &0 ==> F)`]); + (STRIP_TAC); + (UNDISCH_TAC `conic_cap (u0:real^3) u1 r d x`); + (REWRITE_TAC[MESON[IN] `conic_cap u0 u1 r d x <=> x IN conic_cap u0 u1 r d`; + GSYM (ASSUME `D = conic_cap (u0:real^3) u1 r d`)]); + (EXPAND_TAC "D"); + (REWRITE_TAC[IN_INTER; MESON[] `~(x:bool /\ y) <=> (~x \/ ~y)`]); + (DISJ1_TAC); + (REWRITE_TAC[IN_BALL] THEN STRIP_TAC); + + (NEW_GOAL `(?b1:real. b1 IN P2 /\ (!x. x IN P2 ==> b1 <= x))`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f2:(real^3)list -> real) vl`); + (EXPAND_TAC "P2" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `r2 = (@b. b IN P2 /\ (!x. x IN P2 ==> b <= x:real))`); + (EXPAND_TAC "r2"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f2:(real^3)list -> real) vl`); + (EXPAND_TAC "P2" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[]); + + (ABBREV_TAC `Q1 = (\b:real. b IN P2 /\ (!x. x IN P2 ==> b <= x))`); + (NEW_GOAL `(Q1:real->bool) r2`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b1:real` THEN EXPAND_TAC "Q1"); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "Q1" THEN REPEAT STRIP_TAC); + (NEW_GOAL `r2 <= f2 (vl:(real^3)list)`); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "P2" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + + (UP_ASM_TAC THEN EXPAND_TAC "f2" THEN REWRITE_TAC[EL; HD; TL; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `vl= [u0; u1; u2; u3:real^3]`] THEN STRIP_TAC); + (NEW_GOAL `!v. v IN affine hull {u1, u2, u3:real^3} ==> r2 <= dist (u0, v)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,closest_point (affine hull {u1, u2, u3}) u0) <= + dist (u0, v:real^3)`); + (MATCH_MP_TAC CLOSEST_POINT_LE); + (ASM_REWRITE_TAC[CLOSED_AFFINE_HULL]); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `r <= dist (u0:real^3, x)`); + (REWRITE_TAC[dist]); + (REWRITE_WITH `u0:real^3 - x = (t1 + t2 + t3 + t4) % u0 - x`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ADD_RDISTRIB]); + (ASM_REWRITE_TAC[VECTOR_ARITH `(t1 % u0 + t2 % u0 + t3 % u0 + t4 % u0) - + (t1 % u0 + t2 % u1 + t3 % u2 + t4 % u3) = + (t2 + t3 + t4) % u0 - (t2 % u1 + t3 % u2 + t4 % u3)`]); + (ABBREV_TAC `y:real^3 = t2 /(t2 + t3 + t4) % u1 + + t3 /(t2 + t3 + t4) % u2 + + t4 /(t2 + t3 + t4) % u3`); + (REWRITE_WITH `(t2 % u1 + t3 % u2 + t4 % u3) = (t2 + t3 + t4) % (y:real^3)`); + (EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_ARITH `x % (t2 / x % u1 + t3 / x % u2 + t4 / x % u3) = + (x / x) % (t2 % u1 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `(t2 + t3 + t4) / (t2 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t1 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1`); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `a % x - a % y = a % (x - y)`; NORM_MUL]); + + (NEW_GOAL `&1 < t2 + t3 + t4`); + (UNDISCH_TAC `t1 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1`); + (REAL_ARITH_TAC); + (REWRITE_WITH `abs (t2 + t3 + t4) = t2 + t3 + t4`); + (REWRITE_TAC[REAL_ABS_REFL] THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (REWRITE_TAC[GSYM dist]); + (NEW_GOAL `r2 <= dist (u0, y:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `t2 / (t2 + t3 + t4)` THEN EXISTS_TAC `t3 / (t2 + t3 + t4)` THEN + EXISTS_TAC `t4 / (t2 + t3 + t4)`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `r2 <= (t2 + t3 + t4) * dist (u0,y:real^3)`); + (NEW_GOAL `dist (u0,y) <= (t2 + t3 + t4) * dist (u0,y:real^3)`); + (REWRITE_TAC[REAL_ARITH `a <= b * a <=> &0 <= (b - &1) * a`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (DEL_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (EXPAND_TAC "r" THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `dist (u0, x:real^3) < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + +(* ========================================================================== *) + + (REWRITE_TAC[REAL_ARITH `&0 <= a <=> (a < &0 ==> F)`]); + (STRIP_TAC); + (UNDISCH_TAC `conic_cap (u0:real^3) u1 r d x`); + (REWRITE_TAC[MESON[IN] `conic_cap u0 u1 r d x <=> x IN conic_cap u0 u1 r d`; + GSYM (ASSUME `D = conic_cap (u0:real^3) u1 r d`)]); + (EXPAND_TAC "D"); + (REWRITE_TAC[IN_INTER; MESON[] `~(x:bool /\ y) <=> (~x \/ ~y)`]); + (DISJ2_TAC); + (REWRITE_TAC[IN; IN_ELIM_THM; rcone_gt; rconesgn] THEN STRIP_TAC); + + (NEW_GOAL `(?b1:real. b1 IN P4 /\ (!x. x IN P4 ==> x <= b1))`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f4:(real^3)list -> real) vl`); + (EXPAND_TAC "P4" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `d2 = (@b. b IN P4 /\ (!x. x IN P4 ==> x <= b:real))`); + (EXPAND_TAC "d2"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f4:(real^3)list -> real) vl`); + (EXPAND_TAC "P4" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[]); + + (ABBREV_TAC `Q1 = (\b:real. b IN P4 /\ (!x. x IN P4 ==> x <= b))`); + (NEW_GOAL `(Q1:real->bool) d2`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b1:real` THEN EXPAND_TAC "Q1"); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "Q1" THEN REPEAT STRIP_TAC); + + (NEW_GOAL `f4 (vl:(real^3)list) <= d2`); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "P4" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + + (UP_ASM_TAC THEN EXPAND_TAC "f4"); + (REWRITE_TAC[EL; HD; TL; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `vl= [u0; u1; u2; u3:real^3]`] THEN STRIP_TAC); + (ABBREV_TAC `xx = smallest_angle_line u2 u3 u0 u1`); + + (MP_TAC (ASSUME `smallest_angle_line u2 u3 u0 u1 = xx`)); + (REWRITE_TAC[smallest_angle_line; smallest_angle_set]); + (ABBREV_TAC `Q2 = + (\x:real^3. x IN convex hull {u2, u3} /\ + (!y. y IN convex hull {u2, u3} + ==> ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0))))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN STRIP_TAC); + (NEW_GOAL `(Q2:real^3->bool) xx`); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXPAND_TAC "Q2"); + + (MATCH_MP_TAC SMALLEST_ANGLE_LINE_EXISTS); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list;ARITH_RULE `4 >= 4`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (UNDISCH_TAC `u0 IN convex hull {u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`); + (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (STRIP_TAC); + (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (UP_ASM_TAC THEN EXPAND_TAC "Q2"); + (STRIP_TAC); + (ABBREV_TAC `g = (\y:real^3. ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)))`); + + (NEW_GOAL `d < (g:real^3->real) x`); + (EXPAND_TAC "g"); + (REWRITE_WITH + `d < ((x - u0) dot (u1 - u0)) / (norm (x - u0) * norm (u1 - u0:real^3)) <=> + d * (norm (x - u0) * norm (u1 - u0)) < (x - u0) dot (u1 - u0)`); + (MATCH_MP_TAC REAL_LT_RDIV_EQ); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a /\ ~(a = &0) ==> &0 < a`)); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[NORM_POS_LE]); + (REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; VECTOR_ARITH `x - y = vec 0 <=> x = y`]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `t1 % u0 + t2 % u1 + t3 % u2 + t4 % u3 = u0:real^3 <=> + t1 % u0 + t2 % u1 + t3 % u2 + t4 % u3 = (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `t1 % u0 + u = (t1 + t2) % u0 <=> u = t2 % u0`]); + (STRIP_TAC); + + (MP_TAC (ASSUME `~NULLSET (X INTER D)`) THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4;set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (REWRITE_TAC[affine_dependent]); + (EXISTS_TAC `u1:real^3`); + (STRIP_TAC); + (SET_TAC[]); + + (NEW_GOAL `~(u1 IN {u0, u2, u3:real^3})`); + (STRIP_TAC); + (MP_TAC (ASSUME `~NULLSET (X INTER D)`) THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4;set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0:real^3,u2, u3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (SET_TAC[]); + (REWRITE_WITH `{u0, u1, u2, u3} DELETE u1 = {u0, u2, u3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `(t2 + t3 + t4) / t2`); + (EXISTS_TAC `(-- t3) / t2`); + (EXISTS_TAC `(-- t4) / t2`); + + (STRIP_TAC); + (REWRITE_WITH `(t2 + t3 + t4) / t2 + --t3 / t2 + --t4 / t2 = t2 / t2`); + (REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_WITH + `u1 = (t2 + t3 + t4) / t2 % u0 + --t3 / t2 % u2 + --t4 / t2 % u3:real^3 <=> + u1 = (&1 / t2) % ((t2 + t3 + t4) % u0 - t3 % u2 - t4 % u3)`); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[GSYM (ASSUME `t2 % u1 + t3 % u2 + t4 % u3 = + (t2 + t3 + t4) % u0:real^3`)]); + (REWRITE_TAC[VECTOR_ARITH + `(t2 % u1 + t3 % u2 + t4 % u3) - t3 % u2 - t4 % u3 = t2 % u1`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC]); + (REWRITE_WITH `&1 / t2 * t2 = &1`); + (REWRITE_TAC[REAL_ARITH `&1 / t2 * t2 = t2 / t2`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + (REWRITE_TAC[REAL_ARITH `a * b * c < d <=> d > b * c * a`; GSYM dist]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `g x <= (g:real^3->real) xx`); + (NEW_GOAL `!y. y IN convex hull {u2 , u3:real^3} ==> g y <= g xx`); + (EXPAND_TAC "g" THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `&0 < (t3 + t4)`); + (MATCH_MP_TAC (REAL_ARITH `(&0 <= x) /\ ~(x = &0) ==> &0 < x`)); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_ADD); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (NEW_GOAL `t3 = &0 /\ t4 = &0`); + (UNDISCH_TAC `&0 <= t3` THEN UNDISCH_TAC `&0 <= t4` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `F`); + (UNDISCH_TAC `(x - u0) dot (u1 - u0:real^3) > dist (x,u0) * dist (u1,u0) * d`); + (REWRITE_WITH `x = t1 % u0 + t2 % u1:real^3`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (MATCH_MP_TAC (REAL_ARITH `a <= &0 /\ &0 <= b ==> ~(a > b)`)); + (STRIP_TAC); + (REWRITE_WITH `(t1 % u0 + t2 % u1) - u0 = (t1 % u0 + t2 % u1) - + (t1 + t2 + t3 + t4) % u0:real^3`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[ASSUME `t3 = &0`; ASSUME `t4 = &0`; VECTOR_ARITH + `(t1 % u0 + t2 % u1) - (t1 + t2 + &0 + &0) % u0 = t2 % (u1 - u0)`; + DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DOT_POS_LE]); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c/\ c < &1`); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ABBREV_TAC `y = t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3:real^3`); + (NEW_GOAL `(g:real^3->real) y <= g xx`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM]); + (EXISTS_TAC `t3 / (t3 + t4)` THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_SIMP_TAC[REAL_LE_ADD]); + (ASM_SIMP_TAC[REAL_LE_ADD; REAL_LE_DIV]); + (REWRITE_TAC[REAL_ARITH `a / x + b / x = (a + b) / x`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (ABBREV_TAC `w = t1 / (t1 + t3 + t4) % u0 + t3 / (t1 + t3 + t4) % u2 + + t4 / (t1 + t3 + t4) % u3:real^3`); + (NEW_GOAL `(g:real^3->real) y = g w`); + (EXPAND_TAC "g"); + + (REWRITE_WITH `y:real^3 - u0 = + &1 / (t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0)`); + (EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_ARITH + `(t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3) - u0 = + &1 / (t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0) <=> + (t3 + t4) / (t3 + t4) % u0 = u0`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; DOT_LMUL]); + + (REWRITE_WITH `w:real^3 - u0 = + &1 / (t1 + t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0)`); + (EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `(t1 / (t1 + t3 + t4) % u0 + + t3 / (t1 + t3 + t4) % u2 + t4 / (t1 + t3 + t4) % u3) - u0 = + &1 / (t1 + t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0) <=> + (t1 + t3 + t4) / (t1 + t3 + t4) % u0 = u0`]); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` + THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; DOT_LMUL]); + (REWRITE_WITH `abs (&1 / (t3 + t4)) = &1 / (t3 + t4)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_SIMP_TAC[REAL_LE_DIV;REAL_LE_ADD; REAL_ARITH `&0 <= &1`]); + (REWRITE_WITH `abs (&1 / (t1 + t3 + t4)) = &1 / (t1 + t3 + t4)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (MATCH_MP_TAC REAL_LE_DIV THEN REWRITE_TAC[REAL_ARITH `&0 <= &1`]); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` + THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `(a * x) / ((a * y) * z) = + (a * x) / (a * (y * z))`]); + (ABBREV_TAC + `a1 = norm (t3 % u2 + t4 % u3 - (t3 + t4) % u0) * norm (u1 - u0:real^3)`); + (NEW_GOAL `~(a1 = &0)`); + (EXPAND_TAC "a1" THEN ASM_REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; + VECTOR_ARITH `(a - b = vec 0 <=> a = b)/\(a + b-c = vec 0 <=> a + b = c)`]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell4; MCELL_EXPLICIT; set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `t3 / (t3 + t4)` + THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 + t3 / (t3 + t4) + t4 / (t3 + t4) = + (t3 + t4) / (t3 + t4)`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `&0 % u1 + t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3 = + (&1 / (t3 + t4)) % (t3 % u2 + t4 % u3)`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + + (NEW_GOAL `~(&1 / (t3 + t4) = &0)`); + (NEW_GOAL `&0 < &1 / (t3 + t4)`); + (MATCH_MP_TAC REAL_LT_DIV); + (ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (REWRITE_WITH + `(&1 / (t3 + t4) * ((t3 % u2 + t4 % u3 - (t3 + t4) % u0) dot (u1 - u0))) / + (&1 / (t3 + t4) * a1) = + ((t3 % u2 + t4 % u3 - (t3 + t4) % u0) dot (u1 - u0:real^3)) / a1`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[Trigonometry1.REAL_DIV_MUL2]); + + (NEW_GOAL `~(&1 / (t1 + t3 + t4) = &0)`); + (NEW_GOAL `&0 < &1 / (t1 + t3 + t4)`); + (MATCH_MP_TAC REAL_LT_DIV); + (ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`]); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (REWRITE_WITH + `(&1 / (t1 + t3 + t4) * ((t3 % u2 + t4 % u3 - (t3 + t4) % u0) dot (u1 - u0))) / + (&1 / (t1 + t3 + t4) * a1) = + ((t3 % u2 + t4 % u3 - (t3 + t4) % u0) dot (u1 - u0:real^3)) / a1`); + (UP_ASM_TAC THEN UNDISCH_TAC `~(a1 = &0)` THEN + MESON_TAC[Trigonometry1.REAL_DIV_MUL2]); + + (NEW_GOAL `(g:real^3->real) x <= g w`); + (EXPAND_TAC "g"); + + (REWRITE_WITH + `((x - u0) dot (u1 - u0:real^3)) / (norm (x - u0) * norm (u1 - u0)) <= + ((w - u0) dot (u1 - u0)) / (norm (w - u0) * norm (u1 - u0)) <=> + ((x - u0) dot (u1 - u0)) * (norm (w - u0) * norm (u1 - u0)) <= + ((w - u0) dot (u1 - u0)) * (norm (x - u0) * norm (u1 - u0))`); + (MATCH_MP_TAC RAT_LEMMA4); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `x - b = vec 0 <=> x = b`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell4; MCELL_EXPLICIT; set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u0, u1, u2, u3} = {u1, u0, u2, u3}`]); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `(t2 + t3 + t4) / t2` THEN EXISTS_TAC `(--t3) / t2` + THEN EXISTS_TAC `(--t4) / t2`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH + `(t2 + t3 + t4) / t2 + --t3 / t2 + --t4 / t2 = t2 / t2`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_WITH `(t2 + t3 + t4) = &1 - t1`); + (UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (NEW_GOAL `u0 - t1 % u0 - t3 % u2 - t4 % u3:real^3 = t2 % u1`); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(&1 - t1) / t2 % u0 + --t3 / t2 % u2 + --t4 / t2 % u3 = + (&1 / t2) % (u0 - t1 % u0 - t3 % u2 - t4 % u3)`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `t2 / t2 = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `x - b = vec 0 <=> x = b`]); + (EXPAND_TAC "w" THEN STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell4; MCELL_EXPLICIT; set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + + (EXISTS_TAC `&0` THEN EXISTS_TAC `t3 / (t3 + t4)` + THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 + t3 / (t3 + t4) + t4 / (t3 + t4) = + (t3 + t4) / (t3 + t4)`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `&0 % u1 + t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3 = + (&1 / (t3 + t4)) % (t3 % u2 + t4 % u3)`]); + (UP_ASM_TAC THEN REWRITE_TAC[VECTOR_ARITH + `t1 / x % u0 + t3 / x % u2 + t4 / x % u3 = + (&1 / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `&1 / (t1 + t3 + t4) % (t1 % u0 + t3 % u2 + t4 % u3) = u0 <=> + t1 % u0 + t3 % u2 + t4 % u3 = (t1 + t3 + t4) % u0:real^3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.CHANGE_SIDE); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 +t3 + t4 = &1` THEN + REAL_ARITH_TAC); + + (REWRITE_TAC[VECTOR_ARITH `t1 % u0 + t3 % u2 + t4 % u3 = (t1 + t3 + t4) % u0 + <=> t3 % u2 + t4 % u3 = (t3 + t4) % u0`]); + (STRIP_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + + (REWRITE_WITH `x = t2 % u1 + (t1 + t3 + t4) % w:real^3`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `x % (t1 /x % u0 + t3 / x % u2 + t4 /x % u3) = + (x / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (ABBREV_TAC `t = t1 + t3 + t4`); + (REWRITE_WITH `(t2 % u1 + t % w) - u0:real^3 = + (t2 % u1 + t % w) - (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `t1 + t2 + t3 + t4 = t2 + t:real`); + (EXPAND_TAC "t" THEN REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH + `(t2 % u1 + t % w) - (t2 + t) % u0 = t2 % (u1 - u0) + t % (w - u0)`]); + (ABBREV_TAC `x1 = u1 - u0:real^3`); + (ABBREV_TAC `x2 = w - u0:real^3`); + + (REWRITE_WITH `(t2 % x1 + t % x2) dot x1 = + t2 * norm x1 pow 2 + t * x2 dot (x1:real^3)`); + (REWRITE_TAC[NORM_POW_2]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `t2 * norm x1 pow 2 * norm x2 * norm x1 <= + t2 * (x2 dot x1) * norm x1 * norm (x1:real^3)`); + (REWRITE_TAC[REAL_POW_2; REAL_ARITH `t2 * (x1 * x1) * x2 * x1 <= + t2 * x3 * x1 * x1 <=> &0 <= (x1 pow 2) * (--t2) * (x2 * x1 - x3)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[REAL_LE_MUL; NORM_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (STRIP_TAC); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ]); + + (NEW_GOAL + `t2 * (x2 dot x1) * norm x1 * norm x1 + t * (x2 dot x1) * norm x2 * norm x1 <= + (x2 dot x1) * norm (t2 % x1 + t % x2) * norm (x1:real^3)`); + + (REWRITE_TAC[REAL_ARITH `t2 * x3 * x1 * x1 + t * x3 * x2 * x1 <= + x3 * x4 * x1 <=> &0 <= (x1 * x3) * (x4 - t2 * x1 - t * x2)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_CASES_TAC `x2 dot (x1:real^3) < &0`); + (NEW_GOAL `F`); + (NEW_GOAL `(g:real^3->real) x <= &0`); + (EXPAND_TAC "g"); + (REWRITE_TAC[REAL_ARITH `a / b <= &0 <=> &0 <= (--a) / b`]); + (MATCH_MP_TAC REAL_LE_DIV); + (SIMP_TAC[NORM_POS_LE; REAL_LE_MUL]); + + (REWRITE_WITH `x = t2 % u1 + (t1 + t3 + t4) % w:real^3`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `x % (t1 /x % u0 + t3 / x % u2 + t4 /x % u3) = + (x / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (EXPAND_TAC "t"); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= --a <=> a <= &0`]); + (REWRITE_WITH `(t2 % u1 + (t1 + t3 + t4) % w) - u0:real^3 = + (t2 % u1 + (t1 + t3 + t4) % w) - (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `(t2 % u1 + (t1 + t3 + t4) % w) - (t1 + t2 + t3 + t4) % u0 = + t2 % x1 + t % x2:real^3`); + (EXPAND_TAC "x1" THEN EXPAND_TAC "x2" THEN EXPAND_TAC "t" + THEN VECTOR_ARITH_TAC); + (NEW_GOAL `t % x2 dot (x1:real^3) <= &0`); + (REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= a * (--b)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (NEW_GOAL `t2 % x1 dot (x1:real^3) <= &0`); + (REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (REWRITE_TAC[DOT_POS_LE]); + (REWRITE_TAC[DOT_LADD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `d < (g:real^3->real) x`); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1`); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (REWRITE_TAC [REAL_ARITH `&0 <= a - b * d - c <=> c <= a + (--b) * d`]); + (REWRITE_WITH `t * norm (x2:real^3) = abs t * norm x2`); + (AP_THM_TAC THEN AP_TERM_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[REAL_ABS_REFL]); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (REWRITE_WITH `(--t2) * norm (x1:real^3) = abs (--t2) * norm x1`); + (AP_THM_TAC THEN AP_TERM_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[REAL_ABS_REFL]); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_TAC[GSYM NORM_MUL]); + (REWRITE_WITH + `norm (t % x2:real^3) = norm ((t2 % x1 + t % x2) + (--t2 % x1))`); + (AP_TERM_TAC THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_TRIANGLE]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `(g:real^3->real) y <= g xx`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `(g:real^3->real) xx <= d2`); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "P4"); + (EXPAND_TAC "g" THEN EXPAND_TAC "f4"); + (REWRITE_TAC[IN_ELIM_THM; IN]); + (EXISTS_TAC `vl:(real^3)list`); + (REWRITE_TAC[ASSUME `barV V 3 vl`; ASSUME `vl = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1]); + (SIMP_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (EXPAND_TAC "xx"); + (SIMP_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `mcell 4 V vl = mcell k V vl`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k V vl`)]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN EXPAND_TAC "d"); + (REAL_ARITH_TAC); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell4; MCELL_EXPLICIT; set_of_list]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) + + (NEW_GOAL `~coplanar {u0, u1, u2, u3:real^3}`); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell4; MCELL_EXPLICIT; set_of_list]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (ASM_REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (ASM_CASES_TAC `azim u0 u1 u2 (u3:real^3) < pi`); + (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 u2 u3)`); + (ASM_SIMP_TAC[WEDGE_LUNE]); + (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`); + (SET_TAC[]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {u2, u3} DIFF conic_cap u0 u1 r d INTER L = {}`); + (EXPAND_TAC "L"); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`)); + (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]); + (REWRITE_TAC[SET_RULE `A UNION {} = A`]); + (EXPAND_TAC "L"); + + (REWRITE_WITH `aff_ge {u0, u1:real^3} {u2, u3} = + aff_gt {u0, u1} {u2, u3} UNION + UNIONS {aff_ge {u0, u1} ({u2, u3} DELETE a) | a | a IN {u2, u3}}`); + (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[DISJOINT]); + + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `u3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({u2, u3} DELETE a) | a | a IN {u2, u3}}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `aff_ge {u0, u1:real^3} {u2} UNION aff_ge {u0, u1:real^3} {u3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, u2}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,u2:real^3} = {u0,u1} UNION {u2}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, u3}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,u3:real^3} = {u0,u1} UNION {u3}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`)); + (STRIP_TAC); + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `u3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (SET_TAC[]); + +(* begin the computation *) + + (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]); + (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 u2 u3) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 u2 u3 / &3 * (&1 - max d (-- &1)) * r pow 3)`); + (NEW_GOAL `~collinear {u0:real^3, u1, u2} /\ ~collinear {u0, u1, u3}`); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `azim (u0:real^3) u1 u2 u3 = dihV u0 u1 u2 u3`); + (MATCH_MP_TAC AZIM_DIHV_SAME); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (LET_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(4, vl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN; ARITH_RULE `4 <= 4`] THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + + (REWRITE_WITH `initial_sublist [u0;u1:real^3] [u0; u1; u2; u3] /\ + LENGTH [u0;u1] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC); + + (NEW_GOAL `k' = 4 /\ mcell k' V ul = mcell 4 V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `mcell k' V ul INTER mcell 4 V vl = X`); + (REWRITE_WITH `mcell 4 V vl = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (SET_TAC[ASSUME `X = mcell k' V ul`]); + + (REPEAT STRIP_TAC); + (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + + (REWRITE_TAC[dihu4]); + + (REWRITE_WITH `dihV (EL 0 (ul:(real^3)list)) (EL 1 ul) (EL 2 ul) (EL 3 ul) = + dihV u0 u1 u2 (u3:real^3)`); + + (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `{EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = {u0, u1,u2,u3:real^3}`); + (REWRITE_WITH ` + {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = {u0, u1,u2,u3:real^3} <=> + convex hull {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = + convex hull {u0, u1,u2,u3:real^3}`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2, v3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (UNDISCH_TAC + `affine_dependent {EL 0 ul, EL 1 ul, EL 2 ul, (EL 3 ul):real^3}`); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (REWRITE_WITH `convex hull {u0, u1, u2, u3:real^3} = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]); + (COND_CASES_TAC); + (MESON_TAC[]); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[set_of_list; ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `1 = SUC 0`]); + (STRIP_TAC); + + (ASM_CASES_TAC `EL 2 ul = u2:real^3`); + (NEW_GOAL `EL 3 ul = u3:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,u2,u3:real^3}` THEN REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2:real^3}`; COPLANAR_3]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `EL 2 ul = u3:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0:real^3, u1, EL 2 ul, EL 3 ul} = {u0, u1, EL 3 ul}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,u2,u3:real^3}` THEN REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0,u1:real^3, EL 3 ul}`; COPLANAR_3]); + + (NEW_GOAL `EL 3 ul = u2:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u3:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,u2,u3:real^3}` THEN REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u3:real^3}`; COPLANAR_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[DIHV_SYM_2]); + + (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]); + (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]); + (AP_THM_TAC THEN AP_TERM_TAC); + + (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`); + (MATCH_MP_TAC VOLUME_CONIC_CAP); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN MESON_TAC[]); + (UNDISCH_TAC `d < &1` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + + (REWRITE_WITH `max d (--(&1)) = d`); + (MATCH_MP_TAC (REAL_ARITH `&0 < d /\ --(&1) < &0 ==> max d (--(&1)) = d`)); + (REWRITE_TAC[REAL_NEG_LT0]); + (STRIP_TAC); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UNDISCH_TAC `k' = 4 /\ mcell k' V ul = mcell 4 V vl` + THEN MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) +(* OK here *) + + (ASM_CASES_TAC `azim u0 u1 u3 (u2:real^3) < pi`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (STRIP_TAC); + (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 u3 u2)`); + (ASM_SIMP_TAC[WEDGE_LUNE]); + (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`); + (SET_TAC[]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + + (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {u3, u2} DIFF conic_cap u0 u1 r d INTER L = {}`); + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`)); + (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]); + (REWRITE_TAC[SET_RULE `A UNION {} = A`]); + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]); + + (REWRITE_WITH `aff_ge {u0, u1:real^3} {u2, u3} = + aff_gt {u0, u1} {u2, u3} UNION + UNIONS {aff_ge {u0, u1} ({u2, u3} DELETE a) | a | a IN {u2, u3}}`); + (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[DISJOINT]); + + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u3, u2:real^3}`); + (REWRITE_WITH `{u0, u1, u3, u2} = {u0, u1, u3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `u3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u3, u2:real^3}`); + (REWRITE_WITH `{u0, u1, u3, u2} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({u2, u3} DELETE a) | a | a IN {u2, u3}}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `aff_ge {u0, u1:real^3} {u2} UNION aff_ge {u0, u1:real^3} {u3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, u2}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,u2:real^3} = {u0,u1} UNION {u2}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, u3}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,u3:real^3} = {u0,u1} UNION {u3}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`)); + (STRIP_TAC); + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u3, u2:real^3}`); + (REWRITE_WITH `{u0, u1, u3, u2} = {u0, u1, u3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `u3 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u3, u2:real^3}`); + (REWRITE_WITH `{u0, u1, u3, u2} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (SET_TAC[]); + + (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]); + (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 u3 u2) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 u3 u2 / &3 * (&1 - max d (-- &1)) * r pow 3)`); + (NEW_GOAL `~collinear {u0:real^3, u1, u2} /\ ~collinear {u0, u1, u3}`); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u3:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ASM_REWRITE_TAC[]); + + (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + + (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `azim (u0:real^3) u1 u3 u2 = dihV u0 u1 u3 u2`); + (MATCH_MP_TAC AZIM_DIHV_SAME); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u3:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (LET_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(4, vl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN; ARITH_RULE `4 <= 4`] THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + + (REWRITE_WITH `initial_sublist [u0;u1:real^3] [u0; u1; u2; u3] /\ + LENGTH [u0;u1] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC); + + (NEW_GOAL `k' = 4 /\ mcell k' V ul = mcell 4 V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `mcell k' V ul INTER mcell 4 V vl = X`); + (REWRITE_WITH `mcell 4 V vl = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (SET_TAC[ASSUME `X = mcell k' V ul`]); + + (REPEAT STRIP_TAC); + (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + + (REWRITE_TAC[dihu4]); + + (REWRITE_WITH `dihV (EL 0 (ul:(real^3)list)) (EL 1 ul) (EL 2 ul) (EL 3 ul) = + dihV u0 u1 u2 (u3:real^3)`); + + (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `{EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = {u0, u1,u2,u3:real^3}`); + (REWRITE_WITH ` + {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = {u0, u1,u2,u3:real^3} <=> + convex hull {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = + convex hull {u0, u1,u2,u3:real^3}`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2, v3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (UNDISCH_TAC + `affine_dependent {EL 0 ul, EL 1 ul, EL 2 ul, (EL 3 ul):real^3}`); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (REWRITE_WITH `convex hull {u0, u1, u2, u3:real^3} = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]); + (COND_CASES_TAC); + (MESON_TAC[]); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; set_of_list]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[set_of_list; ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; mcell4; + ASSUME `X = mcell k' V ul`; ASSUME `k' = 4`]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `1 = SUC 0`]); + (STRIP_TAC); + + (ASM_CASES_TAC `EL 2 ul = u2:real^3`); + (NEW_GOAL `EL 3 ul = u3:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,u3,u2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2:real^3}`; COPLANAR_3]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `EL 2 ul = u3:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0:real^3, u1, EL 2 ul, EL 3 ul} = {u0, u1, EL 3 ul}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,u3,u2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + + (REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0,u1:real^3, EL 3 ul}`; COPLANAR_3]); + (NEW_GOAL `EL 3 ul = u2:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u3:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,u3,u2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + + (REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u2, u3:real^3}`); + ASSUME `{u0, u1, EL 2 ul, EL 3 ul} = {u0, u1, u3:real^3}`; COPLANAR_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[DIHV_SYM_2]); + + (REWRITE_TAC[DIHV_SYM_2]); + (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]); + (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]); + (AP_THM_TAC THEN AP_TERM_TAC); + + (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`); + (MATCH_MP_TAC VOLUME_CONIC_CAP); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN MESON_TAC[]); + (UNDISCH_TAC `d < &1` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `max d (--(&1)) = d`); + (MATCH_MP_TAC (REAL_ARITH `&0 < d /\ --(&1) < &0 ==> max d (--(&1)) = d`)); + (REWRITE_TAC[REAL_NEG_LT0]); + (STRIP_TAC); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UNDISCH_TAC `k' = 4 /\ mcell k' V ul = mcell 4 V vl` + THEN MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================== *) + + (NEW_GOAL `F`); + (NEW_GOAL `azim (u0:real^3) u1 u3 u2 = + (if azim u0 u1 u2 u3 = &0 then &0 else &2 * pi - azim u0 u1 u2 u3)`); + (MATCH_MP_TAC AZIM_COMPL); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b, d, c}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN COND_CASES_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `(&0 < pi)`); + (REWRITE_TAC[PI_POS]); + (UNDISCH_TAC `~(azim (u0:real^3) u1 u2 u3 < pi)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (STRIP_TAC); + + (NEW_GOAL `azim (u0:real^3) u1 u2 u3 = pi`); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `~coplanar {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[] THEN MATCH_MP_TAC AZIM_EQ_0_PI_IMP_COPLANAR); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) +(* Case k = 3 *) +(* ========================================================================= *) + + (NEW_GOAL `k = 3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC `2 <= k` THEN ARITH_TAC); + (NEW_GOAL `?u2 u3. vl = [u0; u1;u2;u3:real^3]`); + (NEW_GOAL `?v0 v1 u2 u3. vl = [v0; v1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + + (REWRITE_WITH `u0 = v0:real^3`); + (REWRITE_WITH `v0:real^3 = HD (truncate_simplex 1 vl)`); + (REWRITE_TAC[ASSUME `vl = [v0;v1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; HD]); + + (REWRITE_WITH `u1 = v1:real^3`); + (REWRITE_WITH `v1:real^3 = HD (TL (truncate_simplex 1 vl))`); + (REWRITE_TAC[ASSUME `vl = [v0;v1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ABBREV_TAC `L = aff_ge{u0, u1} {u2, mxi V vl}`); + + (REWRITE_WITH `vol (X INTER D) = vol (L INTER D)`); + (AP_TERM_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; + mcell3; set_of_list; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (COND_CASES_TAC); + (ABBREV_TAC `m = mxi V vl`); + (REWRITE_WITH `mxi V [u0; u1; u2; u3] = m`); + (EXPAND_TAC "m" THEN DEL_TAC THEN ASM_REWRITE_TAC[]); + + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `A = B <=> A SUBSET B /\ B SUBSET A`]); + (STRIP_TAC); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> A INTER X SUBSET B INTER X`)); + (REWRITE_TAC[Marchal_cells_2_new.CONVEX_HULL_4_SUBSET_AFF_GE_2_2]); + (MATCH_MP_TAC (SET_RULE `(!x. x IN A /\ x IN B ==> x IN C) ==> + A INTER B SUBSET C INTER B`)); + (NEW_GOAL `DISJOINT {u0,u1:real^3} {u2, m}`); + (REWRITE_TAC[DISJOINT]); + (MATCH_MP_TAC (MESON[] `(~A:bool ==> F) ==> A`)); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN REWRITE_TAC[SET_RULE `A INTER X SUBSET A`]); + + (ASM_SIMP_TAC[MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; + mcell3; set_of_list; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0; u1; u2; u3] = m`); + (EXPAND_TAC "m" THEN REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (NEW_GOAL `m IN {u0, u1:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + + (SIMP_TAC[ASSUME `DISJOINT {u0, u1} {u2, m:real^3}`; AFF_GE_2_2]); + (REWRITE_TAC[CONVEX_HULL_4; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN + EXISTS_TAC `t3:real` THEN EXISTS_TAC `t4:real`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= a <=> (a < &0 ==> F)`]); + (STRIP_TAC); + (UNDISCH_TAC `conic_cap (u0:real^3) u1 r d x`); + (REWRITE_TAC[MESON[IN] `conic_cap u0 u1 r d x <=> x IN conic_cap u0 u1 r d`; + GSYM (ASSUME `D = conic_cap (u0:real^3) u1 r d`)]); + (EXPAND_TAC "D"); + (REWRITE_TAC[IN_INTER; MESON[] `~(x:bool /\ y) <=> (~x \/ ~y)`]); + (DISJ1_TAC); + (REWRITE_TAC[IN_BALL] THEN STRIP_TAC); + + (NEW_GOAL `(?b1:real. b1 IN P1 /\ (!x. x IN P1 ==> b1 <= x))`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f1:(real^3)list -> real) vl`); + (EXPAND_TAC "P1" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `r1 = (@b. b IN P1 /\ (!x. x IN P1 ==> b <= x:real))`); + (EXPAND_TAC "r1"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f1:(real^3)list -> real) vl`); + (EXPAND_TAC "P1" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[]); + + (ABBREV_TAC `Q1 = (\b:real. b IN P1 /\ (!x. x IN P1 ==> b <= x))`); + (NEW_GOAL `(Q1:real->bool) r1`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b1:real` THEN EXPAND_TAC "Q1"); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "Q1" THEN REPEAT STRIP_TAC); + (NEW_GOAL `r1 <= f1 (vl:(real^3)list)`); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "P1" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + + (UP_ASM_TAC THEN EXPAND_TAC "f1" THEN REWRITE_TAC[EL; HD; TL; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `vl= [u0; u1; u2; u3:real^3]`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0;u1;u2;u3:real^3]`]); + (STRIP_TAC); + + (NEW_GOAL `!v. v IN affine hull {u1, u2, m:real^3} ==> r1 <= dist (u0, v)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,closest_point (affine hull {u1, u2, m}) u0) <= + dist (u0, v:real^3)`); + (MATCH_MP_TAC CLOSEST_POINT_LE); + (ASM_REWRITE_TAC[CLOSED_AFFINE_HULL]); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `r <= dist (u0:real^3, x)`); + (REWRITE_TAC[dist]); + (REWRITE_WITH `u0:real^3 - x = (t1 + t2 + t3 + t4) % u0 - x`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ADD_RDISTRIB]); + (ASM_REWRITE_TAC[VECTOR_ARITH `(t1 % u0 + t2 % u0 + t3 % u0 + t4 % u0) - + (t1 % u0 + t2 % u1 + t3 % u2 + t4 % u3) = + (t2 + t3 + t4) % u0 - (t2 % u1 + t3 % u2 + t4 % u3)`]); + (ABBREV_TAC `y:real^3 = t2 /(t2 + t3 + t4) % u1 + + t3 /(t2 + t3 + t4) % u2 + + t4 /(t2 + t3 + t4) % m`); + (REWRITE_WITH `(t2 % u1 + t3 % u2 + t4 % m) = (t2 + t3 + t4) % (y:real^3)`); + (EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_ARITH `x % (t2 / x % u1 + t3 / x % u2 + t4 / x % u3) = + (x / x) % (t2 % u1 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `(t2 + t3 + t4) / (t2 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t1 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1`); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `a % x - a % y = a % (x - y)`; NORM_MUL]); + + (NEW_GOAL `&1 < t2 + t3 + t4`); + (UNDISCH_TAC `t1 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1`); + (REAL_ARITH_TAC); + (REWRITE_WITH `abs (t2 + t3 + t4) = t2 + t3 + t4`); + (REWRITE_TAC[REAL_ABS_REFL] THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (REWRITE_TAC[GSYM dist]); + (NEW_GOAL `r1 <= dist (u0, y:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `t2 / (t2 + t3 + t4)` THEN EXISTS_TAC `t3 / (t2 + t3 + t4)` THEN + EXISTS_TAC `t4 / (t2 + t3 + t4)`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a+b+c)/ x`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `r1 <= (t2 + t3 + t4) * dist (u0,y:real^3)`); + (NEW_GOAL `dist (u0,y) <= (t2 + t3 + t4) * dist (u0,y:real^3)`); + (REWRITE_TAC[REAL_ARITH `a <= b * a <=> &0 <= (b - &1) * a`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (DEL_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (EXPAND_TAC "r" THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `dist (u0, x:real^3) < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + +(* ========================================================================== *) + + (REWRITE_TAC[REAL_ARITH `&0 <= a <=> (a < &0 ==> F)`]); + (STRIP_TAC); + (UNDISCH_TAC `conic_cap (u0:real^3) u1 r d x`); + (REWRITE_TAC[MESON[IN] `conic_cap u0 u1 r d x <=> x IN conic_cap u0 u1 r d`; + GSYM (ASSUME `D = conic_cap (u0:real^3) u1 r d`)]); + (EXPAND_TAC "D"); + (REWRITE_TAC[IN_INTER; MESON[] `~(x:bool /\ y) <=> (~x \/ ~y)`]); + (DISJ2_TAC); + (REWRITE_TAC[IN; IN_ELIM_THM; rcone_gt; rconesgn] THEN STRIP_TAC); + + (NEW_GOAL `(?b1:real. b1 IN P3 /\ (!x. x IN P3 ==> x <= b1))`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f3:(real^3)list -> real) vl`); + (EXPAND_TAC "P3" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `d1 = (@b. b IN P3 /\ (!x. x IN P3 ==> x <= b:real))`); + (EXPAND_TAC "d1"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `~(X = {}) <=> (?x. x IN X)`]); + (EXISTS_TAC `(f3:(real^3)list -> real) vl`); + (EXPAND_TAC "P3" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[]); + + (ABBREV_TAC `Q1 = (\b:real. b IN P3 /\ (!x. x IN P3 ==> x <= b))`); + (NEW_GOAL `(Q1:real->bool) d1`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `b1:real` THEN EXPAND_TAC "Q1"); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "Q1" THEN REPEAT STRIP_TAC); + + (NEW_GOAL `f3 (vl:(real^3)list) <= d1`); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "P3" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_SIMP_TAC[MCELL_EXPLICIT]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + + (UP_ASM_TAC THEN EXPAND_TAC "f3"); + (REWRITE_TAC[EL; HD; TL; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; ASSUME `mxi V vl = m`; + ASSUME `vl= [u0; u1; u2; u3:real^3]`] THEN STRIP_TAC); + + (ABBREV_TAC `xx = smallest_angle_line u2 m u0 u1`); + + (MP_TAC (ASSUME `smallest_angle_line u2 m u0 u1 = xx`)); + (REWRITE_TAC[smallest_angle_line; smallest_angle_set]); + (ABBREV_TAC `Q2 = + (\x:real^3. x IN convex hull {u2, m} /\ + (!y. y IN convex hull {u2, m} + ==> ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0))))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN STRIP_TAC); + (NEW_GOAL `(Q2:real^3->bool) xx`); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXPAND_TAC "Q2"); + + (MATCH_MP_TAC SMALLEST_ANGLE_LINE_EXISTS); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell3; set_of_list;TRUNCATE_SIMPLEX_EXPLICIT_2; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (UNDISCH_TAC `u0 IN convex hull {u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `m:real^3`); + (MATCH_MP_TAC (SET_RULE `a IN s /\ b SUBSET s ==> (a INSERT b) SUBSET s`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (STRIP_TAC); + (UNDISCH_TAC `u + v = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (UP_ASM_TAC THEN EXPAND_TAC "Q2"); + (STRIP_TAC); + (ABBREV_TAC `g = (\y:real^3. ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)))`); + + (NEW_GOAL `d < (g:real^3->real) x`); + (EXPAND_TAC "g"); + (REWRITE_WITH + `d < ((x - u0) dot (u1 - u0)) / (norm (x - u0) * norm (u1 - u0:real^3)) <=> + d * (norm (x - u0) * norm (u1 - u0)) < (x - u0) dot (u1 - u0)`); + (MATCH_MP_TAC REAL_LT_RDIV_EQ); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a /\ ~(a = &0) ==> &0 < a`)); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[NORM_POS_LE]); + (REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; VECTOR_ARITH `x - y = vec 0 <=> x = y`]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `t1 % u0 + t2 % u1 + t3 % u2 + t4 % m = u0:real^3 <=> + t1 % u0 + t2 % u1 + t3 % u2 + t4 % m = (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `t1 % u0 + u = (t1 + t2) % u0 <=> u = t2 % u0`]); + (STRIP_TAC); + + (MP_TAC (ASSUME `~NULLSET (X INTER D)`) THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell3;set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (REWRITE_TAC[affine_dependent]); + (EXISTS_TAC `u1:real^3`); + (STRIP_TAC); + (SET_TAC[]); + + (NEW_GOAL `~(u1 IN {u0, u2, m:real^3})`); + (STRIP_TAC); + (MP_TAC (ASSUME `~NULLSET (X INTER D)`) THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool` THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell3;set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_WITH `{u0, u1, u2, m} = {u0:real^3,u2, m}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (SET_TAC[]); + (REWRITE_WITH `{u0, u1, u2, m} DELETE u1 = {u0, u2, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `(t2 + t3 + t4) / t2`); + (EXISTS_TAC `(-- t3) / t2`); + (EXISTS_TAC `(-- t4) / t2`); + + (STRIP_TAC); + (REWRITE_WITH `(t2 + t3 + t4) / t2 + --t3 / t2 + --t4 / t2 = t2 / t2`); + (REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_WITH + `u1 = (t2 + t3 + t4) / t2 % u0 + --t3 / t2 % u2 + --t4 / t2 % m:real^3 <=> + u1 = (&1 / t2) % ((t2 + t3 + t4) % u0 - t3 % u2 - t4 % m)`); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[GSYM (ASSUME `t2 % u1 + t3 % u2 + t4 % m = + (t2 + t3 + t4) % u0:real^3`)]); + (REWRITE_TAC[VECTOR_ARITH + `(t2 % u1 + t3 % u2 + t4 % u3) - t3 % u2 - t4 % u3 = t2 % u1`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC]); + (REWRITE_WITH `&1 / t2 * t2 = &1`); + (REWRITE_TAC[REAL_ARITH `&1 / t2 * t2 = t2 / t2`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + (REWRITE_TAC[REAL_ARITH `a * b * c < d <=> d > b * c * a`; GSYM dist]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `g x <= (g:real^3->real) xx`); + (NEW_GOAL `!y. y IN convex hull {u2 , m:real^3} ==> g y <= g xx`); + (EXPAND_TAC "g" THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `&0 < (t3 + t4)`); + (MATCH_MP_TAC (REAL_ARITH `(&0 <= x) /\ ~(x = &0) ==> &0 < x`)); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_ADD); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (NEW_GOAL `t3 = &0 /\ t4 = &0`); + (UNDISCH_TAC `&0 <= t3` THEN UNDISCH_TAC `&0 <= t4` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `F`); + (UNDISCH_TAC `(x - u0) dot (u1 - u0:real^3) > dist (x,u0) * dist (u1,u0) * d`); + (REWRITE_WITH `x = t1 % u0 + t2 % u1:real^3`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (MATCH_MP_TAC (REAL_ARITH `a <= &0 /\ &0 <= b ==> ~(a > b)`)); + (STRIP_TAC); + (REWRITE_WITH `(t1 % u0 + t2 % u1) - u0 = (t1 % u0 + t2 % u1) - + (t1 + t2 + t3 + t4) % u0:real^3`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[ASSUME `t3 = &0`; ASSUME `t4 = &0`; VECTOR_ARITH + `(t1 % u0 + t2 % u1) - (t1 + t2 + &0 + &0) % u0 = t2 % (u1 - u0)`; + DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DOT_POS_LE]); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c/\ c < &1`); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ABBREV_TAC `y = t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % m:real^3`); + (NEW_GOAL `(g:real^3->real) y <= g xx`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM]); + (EXISTS_TAC `t3 / (t3 + t4)` THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_SIMP_TAC[REAL_LE_ADD]); + (ASM_SIMP_TAC[REAL_LE_ADD; REAL_LE_DIV]); + (REWRITE_TAC[REAL_ARITH `a / x + b / x = (a + b) / x`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (ABBREV_TAC `w = t1 / (t1 + t3 + t4) % u0 + t3 / (t1 + t3 + t4) % u2 + + t4 / (t1 + t3 + t4) % m:real^3`); + (NEW_GOAL `(g:real^3->real) y = g w`); + (EXPAND_TAC "g"); + + (REWRITE_WITH `y:real^3 - u0 = + &1 / (t3 + t4) % (t3 % u2 + t4 % m - (t3 + t4) % u0)`); + (EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_ARITH + `(t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3) - u0 = + &1 / (t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0) <=> + (t3 + t4) / (t3 + t4) % u0 = u0`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; DOT_LMUL]); + + (REWRITE_WITH `w:real^3 - u0 = + &1 / (t1 + t3 + t4) % (t3 % u2 + t4 % m - (t3 + t4) % u0)`); + (EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `(t1 / (t1 + t3 + t4) % u0 + + t3 / (t1 + t3 + t4) % u2 + t4 / (t1 + t3 + t4) % u3) - u0 = + &1 / (t1 + t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0) <=> + (t1 + t3 + t4) / (t1 + t3 + t4) % u0 = u0`]); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` + THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; DOT_LMUL]); + (REWRITE_WITH `abs (&1 / (t3 + t4)) = &1 / (t3 + t4)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_SIMP_TAC[REAL_LE_DIV;REAL_LE_ADD; REAL_ARITH `&0 <= &1`]); + (REWRITE_WITH `abs (&1 / (t1 + t3 + t4)) = &1 / (t1 + t3 + t4)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (MATCH_MP_TAC REAL_LE_DIV THEN REWRITE_TAC[REAL_ARITH `&0 <= &1`]); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` + THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `(a * x) / ((a * y) * z) = + (a * x) / (a * (y * z))`]); + (ABBREV_TAC + `a1 = norm (t3 % u2 + t4 % m - (t3 + t4) % u0) * norm (u1 - u0:real^3)`); + (NEW_GOAL `~(a1 = &0)`); + (EXPAND_TAC "a1" THEN ASM_REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; + VECTOR_ARITH `(a - b = vec 0 <=> a = b)/\(a + b-c = vec 0 <=> a + b = c)`]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; + set_of_list; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `m:real^3`); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `t3 / (t3 + t4)` + THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 + t3 / (t3 + t4) + t4 / (t3 + t4) = + (t3 + t4) / (t3 + t4)`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `&0 % u1 + t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3 = + (&1 / (t3 + t4)) % (t3 % u2 + t4 % u3)`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + + (NEW_GOAL `~(&1 / (t3 + t4) = &0)`); + (NEW_GOAL `&0 < &1 / (t3 + t4)`); + (MATCH_MP_TAC REAL_LT_DIV); + (ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (REWRITE_WITH + `(&1 / (t3 + t4) * ((t3 % u2 + t4 % m - (t3 + t4) % u0) dot (u1 - u0))) / + (&1 / (t3 + t4) * a1) = + ((t3 % u2 + t4 % m - (t3 + t4) % u0) dot (u1 - u0:real^3)) / a1`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[Trigonometry1.REAL_DIV_MUL2]); + + (NEW_GOAL `~(&1 / (t1 + t3 + t4) = &0)`); + (NEW_GOAL `&0 < &1 / (t1 + t3 + t4)`); + (MATCH_MP_TAC REAL_LT_DIV); + (ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`]); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (REWRITE_WITH + `(&1 / (t1 + t3 + t4) * ((t3 % u2 + t4 % m - (t3 + t4) % u0) dot (u1 - u0))) / + (&1 / (t1 + t3 + t4) * a1) = + ((t3 % u2 + t4 % m - (t3 + t4) % u0) dot (u1 - u0:real^3)) / a1`); + (UP_ASM_TAC THEN UNDISCH_TAC `~(a1 = &0)` THEN + MESON_TAC[Trigonometry1.REAL_DIV_MUL2]); + + (NEW_GOAL `(g:real^3->real) x <= g w`); + (EXPAND_TAC "g"); + + (REWRITE_WITH + `((x - u0) dot (u1 - u0:real^3)) / (norm (x - u0) * norm (u1 - u0)) <= + ((w - u0) dot (u1 - u0)) / (norm (w - u0) * norm (u1 - u0)) <=> + ((x - u0) dot (u1 - u0)) * (norm (w - u0) * norm (u1 - u0)) <= + ((w - u0) dot (u1 - u0)) * (norm (x - u0) * norm (u1 - u0))`); + (MATCH_MP_TAC RAT_LEMMA4); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `x - b = vec 0 <=> x = b`]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `m:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u0, u1, u2, u3} = {u1, u0, u2, u3}`]); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `(t2 + t3 + t4) / t2` THEN EXISTS_TAC `(--t3) / t2` + THEN EXISTS_TAC `(--t4) / t2`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH + `(t2 + t3 + t4) / t2 + --t3 / t2 + --t4 / t2 = t2 / t2`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_WITH `(t2 + t3 + t4) = &1 - t1`); + (UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (NEW_GOAL `u0 - t1 % u0 - t3 % u2 - t4 % m:real^3 = t2 % u1`); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(&1 - t1) / t2 % u0 + --t3 / t2 % u2 + --t4 / t2 % u3 = + (&1 / t2) % (u0 - t1 % u0 - t3 % u2 - t4 % u3)`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `t2 / t2 = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `x - b = vec 0 <=> x = b`]); + (EXPAND_TAC "w" THEN STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `m:real^3`); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + + (EXISTS_TAC `&0` THEN EXISTS_TAC `t3 / (t3 + t4)` + THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 + t3 / (t3 + t4) + t4 / (t3 + t4) = + (t3 + t4) / (t3 + t4)`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `&0 % u1 + t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3 = + (&1 / (t3 + t4)) % (t3 % u2 + t4 % u3)`]); + (UP_ASM_TAC THEN REWRITE_TAC[VECTOR_ARITH + `t1 / x % u0 + t3 / x % u2 + t4 / x % u3 = + (&1 / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `&1 / (t1 + t3 + t4) % (t1 % u0 + t3 % u2 + t4 % m) = u0 <=> + t1 % u0 + t3 % u2 + t4 % m = (t1 + t3 + t4) % u0:real^3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.CHANGE_SIDE); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 +t3 + t4 = &1` THEN + REAL_ARITH_TAC); + + (REWRITE_TAC[VECTOR_ARITH `t1 % u0 + t3 % u2 + t4 % u3 = (t1 + t3 + t4) % u0 + <=> t3 % u2 + t4 % u3 = (t3 + t4) % u0`]); + (STRIP_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `&0 < t3 + t4` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (SET_TAC[]); + + (REWRITE_WITH `x = t2 % u1 + (t1 + t3 + t4) % w:real^3`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `x % (t1 /x % u0 + t3 / x % u2 + t4 /x % u3) = + (x / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (ABBREV_TAC `t = t1 + t3 + t4`); + (REWRITE_WITH `(t2 % u1 + t % w) - u0:real^3 = + (t2 % u1 + t % w) - (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `t1 + t2 + t3 + t4 = t2 + t:real`); + (EXPAND_TAC "t" THEN REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH + `(t2 % u1 + t % w) - (t2 + t) % u0 = t2 % (u1 - u0) + t % (w - u0)`]); + (ABBREV_TAC `x1 = u1 - u0:real^3`); + (ABBREV_TAC `x2 = w - u0:real^3`); + + (REWRITE_WITH `(t2 % x1 + t % x2) dot x1 = + t2 * norm x1 pow 2 + t * x2 dot (x1:real^3)`); + (REWRITE_TAC[NORM_POW_2]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `t2 * norm x1 pow 2 * norm x2 * norm x1 <= + t2 * (x2 dot x1) * norm x1 * norm (x1:real^3)`); + (REWRITE_TAC[REAL_POW_2; REAL_ARITH `t2 * (x1 * x1) * x2 * x1 <= + t2 * x3 * x1 * x1 <=> &0 <= (x1 pow 2) * (--t2) * (x2 * x1 - x3)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[REAL_LE_MUL; NORM_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (STRIP_TAC); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ]); + + (NEW_GOAL + `t2 * (x2 dot x1) * norm x1 * norm x1 + t * (x2 dot x1) * norm x2 * norm x1 <= (x2 dot x1) * norm (t2 % x1 + t % x2) * norm (x1:real^3)`); + + (REWRITE_TAC[REAL_ARITH `t2 * x3 * x1 * x1 + t * x3 * x2 * x1 <= + x3 * x4 * x1 <=> &0 <= (x1 * x3) * (x4 - t2 * x1 - t * x2)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_CASES_TAC `x2 dot (x1:real^3) < &0`); + (NEW_GOAL `F`); + (NEW_GOAL `(g:real^3->real) x <= &0`); + (EXPAND_TAC "g"); + (REWRITE_TAC[REAL_ARITH `a / b <= &0 <=> &0 <= (--a) / b`]); + (MATCH_MP_TAC REAL_LE_DIV); + (SIMP_TAC[NORM_POS_LE; REAL_LE_MUL]); + + (REWRITE_WITH `x = t2 % u1 + (t1 + t3 + t4) % w:real^3`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `x % (t1 /x % u0 + t3 / x % u2 + t4 /x % u3) = + (x / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (EXPAND_TAC "t"); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN + REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= --a <=> a <= &0`]); + (REWRITE_WITH `(t2 % u1 + (t1 + t3 + t4) % w) - u0:real^3 = + (t2 % u1 + (t1 + t3 + t4) % w) - (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `(t2 % u1 + (t1 + t3 + t4) % w) - (t1 + t2 + t3 + t4) % u0 = + t2 % x1 + t % x2:real^3`); + (EXPAND_TAC "x1" THEN EXPAND_TAC "x2" THEN EXPAND_TAC "t" + THEN VECTOR_ARITH_TAC); + (NEW_GOAL `t % x2 dot (x1:real^3) <= &0`); + (REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= a * (--b)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (NEW_GOAL `t2 % x1 dot (x1:real^3) <= &0`); + (REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (REWRITE_TAC[DOT_POS_LE]); + (REWRITE_TAC[DOT_LADD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `d < (g:real^3->real) x`); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1`); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (REWRITE_TAC [REAL_ARITH `&0 <= a - b * d - c <=> c <= a + (--b) * d`]); + (REWRITE_WITH `t * norm (x2:real^3) = abs t * norm x2`); + (AP_THM_TAC THEN AP_TERM_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[REAL_ABS_REFL]); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (REWRITE_WITH `(--t2) * norm (x1:real^3) = abs (--t2) * norm x1`); + (AP_THM_TAC THEN AP_TERM_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[REAL_ABS_REFL]); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_TAC[GSYM NORM_MUL]); + (REWRITE_WITH + `norm (t % x2:real^3) = norm ((t2 % x1 + t % x2) + (--t2 % x1))`); + (AP_TERM_TAC THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_TRIANGLE]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `(g:real^3->real) y <= g xx`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `(g:real^3->real) xx <= d1`); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "P3"); + (EXPAND_TAC "g" THEN EXPAND_TAC "f3"); + (REWRITE_TAC[IN_ELIM_THM; IN]); + (EXISTS_TAC `vl:(real^3)list`); + (REWRITE_TAC[ASSUME `barV V 3 vl`; ASSUME `vl = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_1]); + (STRIP_TAC); + (SIMP_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `mcell 3 V vl = mcell k V vl`); + (ASM_SIMP_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k V vl`)]); + (STRIP_TAC); + + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (C:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `D SUBSET C ==> X INTER D SUBSET X INTER C`)); + (EXPAND_TAC "D" THEN EXPAND_TAC "C"); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A INTER C SUBSET B INTER D`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN REAL_ARITH_TAC); + + (EXPAND_TAC "xx"); + (SIMP_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN EXPAND_TAC "d"); + (REAL_ARITH_TAC); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `(X:real^3->bool)`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; TRUNCATE_SIMPLEX_EXPLICIT_2; + set_of_list; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) + + (ABBREV_TAC `m = mxi V vl`); + (NEW_GOAL `~coplanar {u0, u1, u2, m:real^3}`); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER D)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (STRIP_TAC); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; set_of_list]); + (COND_CASES_TAC); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (ASM_REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (SET_TAC[]); + + (ASM_CASES_TAC `azim u0 u1 u2 (m:real^3) < pi`); + (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 u2 m)`); + (ASM_SIMP_TAC[WEDGE_LUNE]); + (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`); + (SET_TAC[]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {u2, m} DIFF conic_cap u0 u1 r d INTER L = {}`); + (EXPAND_TAC "L"); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`)); + (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]); + (REWRITE_TAC[SET_RULE `A UNION {} = A`]); + (EXPAND_TAC "L"); + + (REWRITE_WITH `aff_ge {u0, u1:real^3} {u2, m} = + aff_gt {u0, u1} {u2, m} UNION + UNIONS {aff_ge {u0, u1} ({u2, m} DELETE a) | a | a IN {u2, m}}`); + (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[DISJOINT]); + + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`); + (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`); + (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({u2, m} DELETE a) | a | a IN {u2, m}}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `aff_ge {u0, u1:real^3} {u2} UNION aff_ge {u0, u1:real^3} {m}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, u2}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,u2:real^3} = {u0,u1} UNION {u2}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, m}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,m:real^3} = {u0,u1} UNION {m}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`)); + (STRIP_TAC); + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`); + (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`); + (REWRITE_WITH `{u0, u1, u2, m} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (SET_TAC[]); + +(* begin the computation *) + + (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]); + (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 u2 m) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 u2 m / &3 * (&1 - max d (-- &1)) * r pow 3)`); + (NEW_GOAL `~collinear {u0:real^3, u1, u2} /\ ~collinear {u0, u1, m}`); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `azim (u0:real^3) u1 u2 m = dihV u0 u1 u2 m`); + (MATCH_MP_TAC AZIM_DIHV_SAME); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (LET_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(3, vl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN; ARITH_RULE `3 <= 4`] THEN ASM_REWRITE_TAC[]); + (REWRITE_WITH `initial_sublist [u0;u1:real^3] [u0; u1; u2; u3] /\ + LENGTH [u0;u1] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC); + + (NEW_GOAL `k' = 3 /\ mcell k' V ul = mcell 3 V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `mcell k' V ul INTER mcell 3 V vl = X`); + (REWRITE_WITH `mcell 3 V vl = X`); + (ASM_SIMP_TAC[]); + (SET_TAC[ASSUME `X = mcell k' V ul`]); + + (REPEAT STRIP_TAC); + (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + + (REWRITE_TAC[dihu3]); + + (REWRITE_WITH `dihV (EL 0 ul) (EL 1 ul) (EL 2 ul) (mxi V ul) = + dihV u0 u1 u2 (m:real^3)`); + + (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `{EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = {u0, u1,u2,m:real^3}`); + (REWRITE_WITH ` + {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = {u0, u1,u2,m:real^3} <=> + convex hull {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = + convex hull {u0, u1,u2,m:real^3}`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_2; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2, mxi V [v0; v1; v2; v3]}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (UNDISCH_TAC `affine_dependent {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul}`); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, mxi V [u0; u1; u2; u3]}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (REWRITE_WITH `convex hull {u0, u1, u2, m:real^3} = X`); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; set_of_list]); + (COND_CASES_TAC); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; set_of_list]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[set_of_list; ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `1 = SUC 0`]); + + (NEW_GOAL `mxi V ul = m`); + (EXPAND_TAC "m"); + (MATCH_MP_TAC MCELL_ID_MXI); + (EXISTS_TAC `k':num` THEN EXISTS_TAC `k:num`); + (ASM_REWRITE_TAC[SET_RULE `3 IN {2, 3}`]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `HD (ul) = (HD (truncate_simplex 1 ul)):real^3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[HD]); + (ASM_REWRITE_TAC[]); + + (STRIP_TAC); + (NEW_GOAL `EL 2 ul = u2:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0, u1, EL 2 ul, m} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,u2,m:real^3}` THEN REWRITE_TAC[ + GSYM (ASSUME `{u0, u1, EL 2 ul, m} = {u0, u1, u2, m:real^3}`); + ASSUME `{u0, u1, EL 2 ul, m} = {u0, u1, m:real^3}`; COPLANAR_3]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]); + (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]); + (AP_THM_TAC THEN AP_TERM_TAC); + + (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`); + (MATCH_MP_TAC VOLUME_CONIC_CAP); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN MESON_TAC[]); + (UNDISCH_TAC `d < &1` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + + (REWRITE_WITH `max d (--(&1)) = d`); + (MATCH_MP_TAC (REAL_ARITH `&0 < d /\ --(&1) < &0 ==> max d (--(&1)) = d`)); + (REWRITE_TAC[REAL_NEG_LT0]); + (STRIP_TAC); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UNDISCH_TAC `k' = 3 /\ mcell k' V ul = mcell 3 V vl` + THEN MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) + + (ASM_CASES_TAC `azim u0 u1 m (u2:real^3) < pi`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (STRIP_TAC); + (REWRITE_WITH `vol (L INTER D) = vol (D INTER wedge u0 u1 m u2)`); + (ASM_SIMP_TAC[WEDGE_LUNE]); + (REWRITE_WITH `L INTER conic_cap (u0:real^3) u1 r d = + conic_cap u0 u1 r d INTER L`); + (SET_TAC[]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + + (REWRITE_WITH `conic_cap (u0:real^3) u1 r d INTER + aff_gt {u0, u1} {m, u2} DIFF conic_cap u0 u1 r d INTER L = {}`); + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A DIFF C INTER B = {}`)); + (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]); + (REWRITE_TAC[SET_RULE `A UNION {} = A`]); + (EXPAND_TAC "L"); + (REWRITE_TAC[SET_RULE `{a,b} = {b, a}`]); + + (REWRITE_WITH `aff_ge {u0, u1:real^3} {m, u2} = + aff_gt {u0, u1} {m, u2} UNION + UNIONS {aff_ge {u0, u1} ({m, u2} DELETE a) | a | a IN {m, u2}}`); + (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[DISJOINT]); + + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, u2:real^3}`); + (REWRITE_WITH `{u0, u1, m, u2} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, u2:real^3}`); + (REWRITE_WITH `{u0, u1, m, u2} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({m, u2} DELETE a) | a | a IN {m, u2}}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `aff_ge {u0, u1:real^3} {u2} UNION aff_ge {u0, u1:real^3} {m}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, u2}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,u2:real^3} = {u0,u1} UNION {u2}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, m}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,m:real^3} = {u0,u1} UNION {m}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]); + (MATCH_MP_TAC (SET_RULE + `A SUBSET D /\ C SUBSET B ==> A UNION C SUBSET B UNION D`)); + (STRIP_TAC); + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `m IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, u2:real^3}`); + (REWRITE_WITH `{u0, u1, m, u2} = {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `u2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, m, u2:real^3}`); + (REWRITE_WITH `{u0, u1, m, u2} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (SET_TAC[]); + + (REWRITE_TAC[ASSUME `D = conic_cap (u0:real^3) u1 r d`]); + (REWRITE_WITH `vol (conic_cap u0 u1 r d INTER wedge u0 u1 m u2) = + (if &1 < d \/ r < &0 + then &0 + else azim u0 u1 m u2 / &3 * (&1 - max d (-- &1)) * r pow 3)`); + (NEW_GOAL `~collinear {u0:real^3, u1, u2} /\ ~collinear {u0, u1, m}`); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ASM_REWRITE_TAC[]); + + (ASM_SIMP_TAC[VOLUME_CONIC_CAP_WEDGE]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + + (UNDISCH_TAC `&0 < r` THEN UNDISCH_TAC `d < &1` THEN + UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_WITH `azim (u0:real^3) u1 m u2 = dihV u0 u1 m u2`); + (MATCH_MP_TAC AZIM_DIHV_SAME); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (X INTER D)`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (LET_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(3, vl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[IN; ARITH_RULE `3 <= 4`] THEN ASM_REWRITE_TAC[]); + + (REWRITE_WITH `initial_sublist [u0;u1:real^3] [u0; u1; u2; u3] /\ + LENGTH [u0;u1] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC); + + (NEW_GOAL `k' = 3 /\ mcell k' V ul = mcell 3 V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `vl = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `mcell k' V ul INTER mcell 3 V vl = X`); + (REWRITE_WITH `mcell 3 V vl = X`); + (ASM_SIMP_TAC[]); + (SET_TAC[ASSUME `X = mcell k' V ul`]); + + (REPEAT STRIP_TAC); + (UNDISCH_TAC `k' <= 4` THEN REWRITE_TAC[ARITH_RULE + `a <= 4 <=> a = 0 \/a = 1 \/ a = 2 \/ a = 3 \/ a = 4`] THEN SET_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + + (REWRITE_TAC[dihu3]); + + (REWRITE_WITH `dihV (EL 0 ul) (EL 1 ul) (EL 2 ul) (mxi V ul) = + dihV u0 u1 u2 (m:real^3)`); + + (NEW_GOAL `truncate_simplex 1 ul = [u0;u1:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `EL 0 (ul:(real^3)list) = EL 0 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `EL 1 (ul:(real^3)list) = EL 1 (truncate_simplex 1 ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `{EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = {u0, u1,u2,m:real^3}`); + (REWRITE_WITH ` + {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = {u0, u1,u2,m:real^3} <=> + convex hull {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul} = + convex hull {u0, u1,u2,m:real^3}`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_2; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2, mxi V [v0; v1; v2; v3]}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (UNDISCH_TAC `affine_dependent {EL 0 ul, EL 1 ul, EL 2 ul, mxi V ul}`); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, mxi V [u0; u1; u2; u3]}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (REWRITE_WITH `convex hull {u0, u1, u2, m:real^3} = X`); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; set_of_list]); + (COND_CASES_TAC); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0;u1;u2;u3] = m`); + (EXPAND_TAC "m"); + (REWRITE_TAC[ASSUME `vl = [u0; u1; u2; u3:real^3]`]); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (ASM_SIMP_TAC[mcell3; MCELL_EXPLICIT; set_of_list]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]); + (COND_CASES_TAC); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[set_of_list; ASSUME `ul = [v0; v1; v2; v3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_TAC[EL; HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[]); + (SIMP_TAC[MCELL_EXPLICIT; mcell3; ASSUME `X = mcell k' V ul`; ASSUME `k' = 3`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `1 = SUC 0`]); + + (NEW_GOAL `mxi V ul = m`); + (EXPAND_TAC "m"); + (MATCH_MP_TAC MCELL_ID_MXI); + (EXISTS_TAC `k':num` THEN EXISTS_TAC `k:num`); + (ASM_REWRITE_TAC[SET_RULE `3 IN {2, 3}`]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `HD (ul) = (HD (truncate_simplex 1 ul)):real^3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[HD]); + (ASM_REWRITE_TAC[]); + + (STRIP_TAC); + (NEW_GOAL `EL 2 ul = u2:real^3`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `{u0, u1, EL 2 ul, m} = {u0, u1, m:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0,u1,m,u2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (REWRITE_TAC[GSYM (ASSUME `{u0, u1, EL 2 ul, m} = {u0, u1, u2, m:real^3}`); + ASSUME `{u0, u1, EL 2 ul, m} = {u0, u1, m:real^3}`; COPLANAR_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[DIHV_SYM_2]); + + (REWRITE_TAC[REAL_ARITH `a / b * c * d pow 3 = (c/ b * d pow 3) * a`]); + (REWRITE_TAC[REAL_ARITH `a * b / (&2 * c) = (a / (&2 * c)) * b`]); + (AP_THM_TAC THEN AP_TERM_TAC); + + (REWRITE_WITH + `measurable (conic_cap u0 u1 r d) /\ + vol (conic_cap u0 u1 r d) = + (if u1 = u0 \/ &1 <= d \/ r < &0 + then &0 + else &2 / &3 * pi * (&1 - d) * r pow 3)`); + (MATCH_MP_TAC VOLUME_CONIC_CAP); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN MESON_TAC[]); + (UNDISCH_TAC `d < &1` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + + (REWRITE_WITH `max d (--(&1)) = d`); + (MATCH_MP_TAC (REAL_ARITH `&0 < d /\ --(&1) < &0 ==> max d (--(&1)) = d`)); + (REWRITE_TAC[REAL_NEG_LT0]); + (STRIP_TAC); + (EXPAND_TAC "d"); + (UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (REWRITE_WITH ` + (&2 / &3 * pi * (&1 - d) * r pow 3) / (&2 * pi) = (&1 - d) / &3 * r pow 3 * + ((&2 * pi) / (&2 * pi))`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; PI_NZ; REAL_ARITH `~(&2 = &0)`]); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UNDISCH_TAC `k' = 3 /\ mcell k' V ul = mcell 3 V vl` + THEN MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) + + (NEW_GOAL `F`); + (NEW_GOAL `azim (u0:real^3) u1 m u2 = + (if azim u0 u1 u2 m = &0 then &0 else &2 * pi - azim u0 u1 u2 m)`); + (MATCH_MP_TAC AZIM_COMPL); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `m:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b, d, c}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN COND_CASES_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `(&0 < pi)`); + (REWRITE_TAC[PI_POS]); + (UNDISCH_TAC `~(azim (u0:real^3) u1 u2 m < pi)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (STRIP_TAC); + + (NEW_GOAL `azim (u0:real^3) u1 u2 m = pi`); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UNDISCH_TAC `~coplanar {u0, u1, u2, m:real^3}`); + (REWRITE_TAC[] THEN MATCH_MP_TAC AZIM_EQ_0_PI_IMP_COPLANAR); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) +(* ========================================================================= *) + + (ABBREV_TAC `E = D INTER wedge_ge u0 u1 n1 n2`); + (ABBREV_TAC + `s = {X | mcell_set V X /\ edgeX V X e /\ X SUBSET wedge_ge u0 u1 n1 n2}`); + (NEW_GOAL `sum s (\t. vol (t INTER E)) = vol (E)`); + (ABBREV_TAC `f = (\t:real^3->bool. t INTER E)`); + (REWRITE_WITH `(\t. vol (t INTER E)) = (\x:real^3->bool. vol (f x))`); + (EXPAND_TAC "f"); + (REWRITE_TAC[]); + (REWRITE_WITH `sum s (\x:real^3->bool. vol (f x)) = vol (UNIONS (IMAGE f s))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_UNIONS_IMAGE); + (REPEAT STRIP_TAC); + + (EXPAND_TAC "s"); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | mcell_set V X /\ edgeX V X e}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_EDGE_X2); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + + (EXPAND_TAC "f"); + (MATCH_MP_TAC MEASURABLE_INTER); + (STRIP_TAC); + (UP_ASM_TAC THEN EXPAND_TAC "s"); + (REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[MEASURABLE_MCELL]); + (EXPAND_TAC "E"); + (REWRITE_TAC[ASSUME `D:real^3->bool = conic_cap u0 u1 r d`]); + (REWRITE_TAC[MEASURABLE_CONIC_CAP_WEDGE_GE]); + + + (EXPAND_TAC "f"); + (UNDISCH_TAC `(x:real^3->bool) IN s` THEN + UNDISCH_TAC `(y:real^3->bool) IN s` THEN EXPAND_TAC "s"); + (REWRITE_TAC[mcell_set_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `x INTER (y:real^3->bool)`); + (ASM_REWRITE_TAC[SET_RULE `(x INTER D) INTER y INTER D SUBSET x INTER y`]); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + + (NEW_GOAL `i' = i /\ mcell i' V ul' = mcell i V ul`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[SET_RULE `i IN {0, 1, 2, 3, 4} <=> + i = 0 \/ i = 1 \/ i = 2 \/ i = 3 \/ i = 4`]); + (UNDISCH_TAC `i <= 4` THEN UNDISCH_TAC `i' <= 4` THEN ARITH_TAC); + (UNDISCH_TAC `~(x = y:real^3->bool)` THEN ASM_REWRITE_TAC[]); + + (EXPAND_TAC "s"); + (EXPAND_TAC "f" THEN REWRITE_TAC[IMAGE]); + + + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + (REWRITE_WITH + `UNIONS + {y | ?x. x IN + {X | mcell_set V X /\ edgeX V X e /\ X SUBSET wedge_ge u0 u1 n1 n2} /\ + y = x INTER E} DIFF E = {}`); + (REWRITE_TAC[SET_RULE `A DIFF B = {} <=> A SUBSET B`]); + (REWRITE_TAC[UNIONS_SUBSET; IN; IN_ELIM_THM]); + (SET_TAC[]); + (REWRITE_TAC[SET_RULE `{} UNION A = A`]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `UNIONS {y | ?x. x IN {X | mcell_set V X /\ NULLSET (X INTER E) /\ + ~(X INTER E = {})} /\ y = x INTER E}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNIONS); + (STRIP_TAC); + (REWRITE_WITH + `{y | ?x. x IN + {X | mcell_set V X /\ NULLSET (X INTER E) /\ ~(X INTER E = {})} /\ + y = x INTER E} = + {y | ?x. x IN + {X | mcell_set V X /\ NULLSET (X INTER E) /\ ~(X INTER E = {})} /\ + y = f x}`); + (EXPAND_TAC "f" THEN REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (u0, &10) /\ mcell_set V X}`); + (STRIP_TAC); + (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA_2]); + (REWRITE_TAC[SUBSET; IN_BALL; IN; IN_ELIM_THM; mcell_set] THEN + REPEAT STRIP_TAC); + + (NEW_GOAL `?v1:real^3. v1 IN x /\ v1 IN D`); + (REWRITE_TAC[GSYM IN_INTER]); + (UNDISCH_TAC `~(x:real^3->bool INTER E = {})` THEN EXPAND_TAC "E" THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `dist (u0, x') <= dist (u0, v1:real^3) + dist (v1, x')`); + (NORM_ARITH_TAC); + (NEW_GOAL `dist (u0, v1:real^3) < &1`); + (REWRITE_TAC[GSYM IN_BALL]); + (NEW_GOAL `D SUBSET ball (u0:real^3, &1)`); + (EXPAND_TAC "D"); + (NEW_GOAL `ball (u0, r) SUBSET ball (u0:real^3, &1)`); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `v1:real^3 IN D` THEN SET_TAC[]); + (NEW_GOAL `dist (v1,x':real^3) < &8`); + (REWRITE_TAC[GSYM IN_BALL]); + + (NEW_GOAL `x SUBSET ball (v1:real^3, &8)`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MCELL_SUBSET_BALL8); + (REWRITE_TAC[GSYM (ASSUME `x = mcell i V ul`)] THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `(x:real^3->bool) x'` THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `ul:(real^3)list`); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[ASSUME `t:real^3->bool = x INTER E`]); + (ASM_REWRITE_TAC[]); + +(* ========================================================================= *) + + (REWRITE_TAC[SUBSET; IN_UNIONS]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `?v:real^3. v IN V /\ x IN voronoi_closed V v`); + (ASM_SIMP_TAC[TIWWFYQ]); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_WITH + `x IN voronoi_closed V v <=> (?vl. vl IN barV V 3 /\ x IN rogers V vl /\ + truncate_simplex 0 vl = [v])`); + (ASM_SIMP_TAC[GLTVHUM]); + (REWRITE_TAC[IN] THEN STRIP_TAC); + (NEW_GOAL `?i. i <= 4 /\ x IN mcell i V vl`); + (ASM_SIMP_TAC[IN;SLTSTLO1]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ABBREV_TAC `X = mcell i V vl`); + (NEW_GOAL `~NULLSET (X INTER E) ==> F`); + (STRIP_TAC); + + (NEW_GOAL `?k ul. + 2 <= k /\ + barV V 3 ul /\ + X = mcell k V ul /\ + truncate_simplex 1 ul = [u0; u1]`); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + (REWRITE_TAC[mcell_set; IN_ELIM_THM; IN]); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER E)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `X INTER (D:real^3->bool)`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "E" THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (MP_TAC (ASSUME `x IN + E DIFF + UNIONS + {y | ?x. x IN + {X | mcell_set V X /\ + edgeX V X e /\ + (!x. x IN X ==> x IN wedge_ge u0 u1 n1 n2)} /\ + y = x INTER E}`)); + (REWRITE_TAC[IN_DIFF; MESON[] `~(A /\ ~B) <=> ~A \/ B`]); + (DISJ2_TAC); + (REWRITE_TAC[IN_UNIONS; IN; IN_ELIM_THM]); + (EXISTS_TAC `X INTER (E:real^3->bool)`); + (STRIP_TAC); + + (EXISTS_TAC `(X:real^3->bool)`); + (REWRITE_TAC[mcell_set; IN; IN_ELIM_THM] THEN STRIP_TAC); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[edgeX; IN_ELIM_THM]); + (STRIP_TAC); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (STRIP_TAC); + + (NEW_GOAL `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `(if k < 4 then k else 4)`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (COND_CASES_TAC); + (MESON_TAC[]); + (NEW_GOAL `k >= 4`); + (UP_ASM_TAC THEN ARITH_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ]); + (UNDISCH_TAC `~NULLSET (X INTER E)` THEN ASM_REWRITE_TAC[]); + (MESON_TAC[NEGLIGIBLE_SUBSET; SET_RULE `A INTER B SUBSET A`]); + + (NEW_GOAL `(V:real^3->bool) INTER X = + set_of_list (truncate_simplex ((if k < 4 then k else 4) - 1) ul)`); + (REWRITE_WITH `X = mcell (if k < 4 then k else 4) V ul`); + (ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `k >= 4`); + (UP_ASM_TAC THEN ARITH_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ]); + + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `2 <= k` THEN ARITH_TAC); + (STRIP_TAC); + (UNDISCH_TAC `2 <= k` THEN ARITH_TAC); + (REWRITE_WITH `mcell (if k < 4 then k else 4) V ul = X`); + (ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `k >= 4`); + (UP_ASM_TAC THEN ARITH_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER E)` THEN + REWRITE_TAC[ASSUME `X = {}:real^3->bool`; SET_RULE `{} INTER x = {}`; + NEGLIGIBLE_EMPTY]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list (truncate_simplex 1 (ul:(real^3)list)) SUBSET + set_of_list (truncate_simplex ((if k < 4 then k else 4) - 1) ul)`); + (MATCH_MP_TAC Rogers.TRUNCATE_SIMPLEX_SUBSET); + (REWRITE_WITH `LENGTH ul = 3 + 1 /\ + CARD (set_of_list (ul:(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `2 <= k` THEN ARITH_TAC); + (REWRITE_TAC[MESON[IN] `(s:real^3->bool) u <=> u IN s`]); + + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `truncate_simplex 1 ul = [u0; u1:real^3]`; + set_of_list]); + (SET_TAC[]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[MESON[IN] `(X:real^3->bool) a <=> a IN X`]); + (REWRITE_TAC[GSYM SUBSET]); + + (NEW_GOAL `X SUBSET wedge_ge u0 u1 n1 n2 \/ X SUBSET wedge_ge u0 u1 n2 n1`); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + (REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (EXISTS_TAC `k:num` THEN EXISTS_TAC `ul:(real^3)list` THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[edgeX; IN; IN_ELIM_THM]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + + (NEW_GOAL `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `(if k < 4 then k else 4)`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (COND_CASES_TAC); + (MESON_TAC[]); + (NEW_GOAL `k >= 4`); + (UP_ASM_TAC THEN ARITH_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ]); + (UNDISCH_TAC `~NULLSET (X INTER E)` THEN ASM_REWRITE_TAC[]); + (MESON_TAC[NEGLIGIBLE_SUBSET; SET_RULE `A INTER B SUBSET A`]); + + (NEW_GOAL `(V:real^3->bool) INTER X = + set_of_list (truncate_simplex ((if k < 4 then k else 4) - 1) ul)`); + (REWRITE_WITH `X = mcell (if k < 4 then k else 4) V ul`); + (ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `k >= 4`); + (UP_ASM_TAC THEN ARITH_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ]); + + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `2 <= k` THEN ARITH_TAC); + (STRIP_TAC); + (UNDISCH_TAC `2 <= k` THEN ARITH_TAC); + (REWRITE_WITH `mcell (if k < 4 then k else 4) V ul = X`); + (ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `k >= 4`); + (UP_ASM_TAC THEN ARITH_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (X INTER E)` THEN + REWRITE_TAC[ASSUME `X = {}:real^3->bool`; SET_RULE `{} INTER x = {}`; + NEGLIGIBLE_EMPTY]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list (truncate_simplex 1 (ul:(real^3)list)) SUBSET + set_of_list (truncate_simplex ((if k < 4 then k else 4) - 1) ul)`); + (MATCH_MP_TAC Rogers.TRUNCATE_SIMPLEX_SUBSET); + (REWRITE_WITH `LENGTH ul = 3 + 1 /\ + CARD (set_of_list (ul:(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `2 <= k` THEN ARITH_TAC); + (REWRITE_TAC[MESON[IN] `(s:real^3->bool) u <=> u IN s`]); + + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `truncate_simplex 1 ul = [u0; u1:real^3]`; + set_of_list]); + (SET_TAC[]); + + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `F`); + (NEW_GOAL + `X INTER E SUBSET (wedge_ge u0 u1 n1 n2 INTER wedge_ge u0 u1 n2 n1)`); + (REWRITE_TAC[SUBSET_INTER]); + (STRIP_TAC); + (EXPAND_TAC "E" THEN SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (UNDISCH_TAC `~NULLSET (X INTER E)` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `wedge_ge u0 u1 n1 n2 INTER wedge_ge u0 u1 n2 n1`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `aff_ge {u0,u1} {n1} UNION aff_ge {u0,u1} {n2:real^3}`); + (STRIP_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0,u1,n1:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_TAC[SET_RULE `{a,b,c} = {a,b} UNION {c}`; + AFF_GE_SUBSET_AFFINE_HULL]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0,u1,n2:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_TAC[SET_RULE `{a,b,c} = {a,b} UNION {c}`; + AFF_GE_SUBSET_AFFINE_HULL]); + + (REWRITE_TAC[ASSUME `wedge_ge u0 u1 n1 n2 INTER wedge_ge u0 u1 n2 n1 + SUBSET aff_ge {u0, u1} {n1} UNION aff_ge {u0, u1:real^3} {n2}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `(x:real^3) IN E`); + (UNDISCH_TAC `x IN + E DIFF + UNIONS + {y | ?x. x IN + {X | mcell_set V X /\ + edgeX V X e /\ + (!x. x IN X ==> x IN wedge_ge u0 u1 n1 n2)} /\ + y = x INTER E}` THEN SET_TAC[]); + + (REWRITE_TAC[MESON[IN] `(X INTER Y) a <=> a IN (X INTER Y)`]); + (REWRITE_TAC[IN_INTER]); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `X INTER (E:real^3 ->bool)`); + (STRIP_TAC); + (REWRITE_TAC[IN_ELIM_THM]); + (EXISTS_TAC `X:real^3->bool`); + (ASM_REWRITE_TAC[mcell_set; IN_ELIM_THM]); + (UP_ASM_TAC THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(x:real^3) IN X INTER E`); + (REWRITE_TAC[IN_INTER]); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `x IN + E DIFF + UNIONS + {y | ?x. x IN + {X | mcell_set V X /\ + edgeX V X e /\ + (!x. x IN X ==> x IN wedge_ge u0 u1 n1 n2)} /\ + y = x INTER E}` THEN SET_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (REWRITE_TAC[MESON[IN] `(X INTER Y) a <=> a IN (X INTER Y)`]); + (REWRITE_TAC[IN_INTER]); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `x IN + E DIFF + UNIONS + {y | ?x. x IN + {X | mcell_set V X /\ + edgeX V X e /\ + (!x. x IN X ==> x IN wedge_ge u0 u1 n1 n2)} /\ + y = x INTER E}` THEN SET_TAC[]); + + (UP_ASM_TAC THEN + REWRITE_WITH `sum s (\t. vol (t INTER E)) = sum s (\t. vol (t INTER D))`); + (MATCH_MP_TAC SUM_EQ); + (EXPAND_TAC "s" THEN REWRITE_TAC[IN; IN_ELIM_THM; BETA_THM] THEN + REPEAT STRIP_TAC); + (AP_TERM_TAC); + (EXPAND_TAC "E" THEN UP_ASM_TAC THEN SET_TAC[]); + + +(* ========================================================================= *) + + (ABBREV_TAC + `t = {X | mcell_set V X /\ edgeX V X e /\ X SUBSET wedge_ge u0 u1 n1 n2 /\ + ~NULLSET (X INTER D)}`); + + (REWRITE_WITH `sum s (\t. dihX V t (u0,u1)) = + sum t (\t. dihX V t (u0,u1))`); + (MATCH_MP_TAC SUM_SUPERSET); + (EXPAND_TAC "s" THEN EXPAND_TAC "t" THEN REPEAT STRIP_TAC); + (SET_TAC[]); + + (NEW_GOAL `NULLSET (x INTER D)`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[IN; IN_ELIM_THM] ); + (MESON_TAC[]); + + (NEW_GOAL `mcell_set V x /\ edgeX V x e`); + (UNDISCH_TAC + `x IN {X | mcell_set V X /\ edgeX V X e /\ X SUBSET wedge_ge u0 u1 n1 n2}`); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[mcell_set_2; IN_ELIM_THM;IN] THEN STRIP_TAC); + + (NEW_GOAL `~NULLSET x`); + (UP_ASM_TAC THEN REWRITE_TAC[edgeX; VX; IN_ELIM_THM]); + (COND_CASES_TAC THEN REPEAT STRIP_TAC); + (UNDISCH_TAC `{} (u:real^3)` THEN REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`]); + (SET_TAC[]); + + (NEW_GOAL `VX V x = V INTER (x:real^3->bool)`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `V INTER (x:real^3->bool) = + set_of_list (truncate_simplex (i - 1) ul)`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_CASES_TAC `i = 0`); + (NEW_GOAL `V INTER (x:real^3->bool) = {}`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (UNDISCH_TAC `edgeX V x e` THEN REWRITE_TAC[edgeX; IN_ELIM_THM]); + (STRIP_TAC); + (UNDISCH_TAC `VX V x u` THEN ASM_REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`]); + (SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN ARITH_TAC); + (REWRITE_TAC[GSYM (ASSUME `x = mcell i V ul`)] THEN STRIP_TAC); + (UNDISCH_TAC `~NULLSET x` THEN REWRITE_TAC[ASSUME `x:real^3->bool = {}`; + NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `(u0:real^3) IN VX V x /\ u1 IN VX V x`); + (UNDISCH_TAC `edgeX V x e` THEN REWRITE_TAC[edgeX; IN_ELIM_THM; + ASSUME `e = {u0, u1:real^3}`]); + (STRIP_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + +(* ========================================================================== *) + (NEW_GOAL `F`); + + (ASM_CASES_TAC `i <= 1`); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2 ;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `i - 1 = 0`); + (UNDISCH_TAC `i <= 1` THEN ARITH_TAC); + (UNDISCH_TAC `u0 IN VX V x /\ u1 IN VX V x`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_0; set_of_list]); + (UNDISCH_TAC `~(u0 = u1:real^3)` THEN SET_TAC[]); + + (ASM_CASES_TAC `i = 3`); + (NEW_GOAL `vol (x INTER D) > &0`); + (ONCE_REWRITE_TAC[SET_RULE `a INTER b = b INTER a`]); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2 ;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell3; TRUNCATE_SIMPLEX_EXPLICIT_2; + set_of_list; SET_RULE `{a,c,d} UNION {x} = {a,c,d,x}`]); + (COND_CASES_TAC); + (NEW_GOAL `i - 1 = 2`); + (UNDISCH_TAC `i = 3` THEN ARITH_TAC); + (UNDISCH_TAC `u0 IN VX V x /\ u1 IN VX V x`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (STRIP_TAC); + (NEW_GOAL `?v:real^3. {u0, u1, v} = {v0, v1, v2}`); + (NEW_GOAL `?v:real^3. v IN {v0, v1, v2} DIFF {u0, u1}`); + (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]); + (REWRITE_WITH `{v0, v1, v2} DIFF {u0, u1:real^3} = {} <=> + CARD ({v0, v1, v2} DIFF {u0, u1}) = 0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_EQ_0); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{v0, v1, v2:real^3}`); + (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]); + (REWRITE_TAC[ARITH_RULE `~(a = 0) <=> 1 <= a`]); + + (NEW_GOAL `CARD {v0, v1, v2} = CARD ({v0, v1, v2} DIFF {u0, u1:real^3}) + + CARD {u0, u1}`); + (MATCH_MP_TAC Hypermap.CARD_MINUS_DIFF_TWO_SET); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + (UP_ASM_TAC THEN REWRITE_WITH `CARD ({v0, v1, v2:real^3}) = 3`); + (REWRITE_WITH `{v0, v1, v2:real^3} = set_of_list (truncate_simplex 2 ul)`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (ABBREV_TAC `xl = truncate_simplex 2 (ul:(real^3)list)`); + (REWRITE_WITH `LENGTH (xl:(real^3)list) = 2 + 1 /\ + CARD (set_of_list xl) = 2 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "xl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ARITH_TAC); + + (NEW_GOAL `CARD {u0, u1:real^3} <= 2`); + (REWRITE_TAC[Geomdetail.CARD2]); + (UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `v:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN + UNDISCH_TAC `~(u0 = u1:real^3)` THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `{v0, v1, v2, mxi V [v0; v1; v2; v3]} = + {u0, u1, v, mxi V [v0; v1; v2; v3]}`); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC CONIC_CAP_INTER_CONVEX_HULL_4_GT_0); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (REWRITE_TAC[GSYM (ASSUME `{v0, v1, v2, mxi V [v0; v1; v2; v3]} = + {u0, u1, v, mxi V [v0; v1; v2; v3]}`)] THEN STRIP_TAC); + (UNDISCH_TAC `~NULLSET x`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_TAC[SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2, mxi V [v0; v1; v2; v3]}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET x`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell3; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `vol (x INTER D) = &0`); + (MATCH_MP_TAC MEASURE_EQ_0); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + +(* ========================================== *) + + (ASM_CASES_TAC `i = 4`); + (NEW_GOAL `vol (x INTER D) > &0`); + (ONCE_REWRITE_TAC[SET_RULE `a INTER b = b INTER a`]); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2 ;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4; ARITH_RULE `4 >= 4`; + set_of_list]); + (COND_CASES_TAC); + (NEW_GOAL `i - 1 = 3`); + (UNDISCH_TAC `i = 4` THEN ARITH_TAC); + (UNDISCH_TAC `u0 IN VX V x /\ u1 IN VX V x`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3; set_of_list]); + (STRIP_TAC); + + (NEW_GOAL `?v w:real^3. {u0, u1, v, w} = {v0, v1, v2, v3}`); + + (NEW_GOAL `?v:real^3. v IN {v0, v1, v2, v3} DIFF {u0, u1}`); + (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]); + (REWRITE_WITH `{v0, v1, v2, v3} DIFF {u0, u1:real^3} = {} <=> + CARD ({v0, v1, v2, v3} DIFF {u0, u1}) = 0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_EQ_0); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{v0, v1, v2, v3:real^3}`); + (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]); + (REWRITE_TAC[ARITH_RULE `~(a = 0) <=> 1 <= a`]); + + (NEW_GOAL `CARD {v0, v1, v2, v3} = + CARD ({v0, v1, v2, v3} DIFF {u0, u1:real^3}) + CARD {u0, u1}`); + (MATCH_MP_TAC Hypermap.CARD_MINUS_DIFF_TWO_SET); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + + (UP_ASM_TAC THEN REWRITE_WITH `CARD ({v0, v1, v2, v3:real^3}) = 3 + 1`); + (REWRITE_WITH `{v0, v1, v2, v3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD {u0, u1:real^3} <= 2`); + (REWRITE_TAC[Geomdetail.CARD2]); + (UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?w:real^3. w IN {v0, v1, v2, v3} DIFF {u0, u1, v}`); + (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]); + (REWRITE_WITH `{v0, v1, v2, v3} DIFF {u0, u1, v:real^3} = {} <=> + CARD ({v0, v1, v2, v3} DIFF {u0, u1, v}) = 0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_EQ_0); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{v0, v1, v2, v3:real^3}`); + (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]); + (REWRITE_TAC[ARITH_RULE `~(a = 0) <=> 1 <= a`]); + + (NEW_GOAL `CARD ({v0, v1, v2, v3} DIFF {u0, u1,v:real^3}) = + CARD {v0, v1, v2, v3} - CARD {u0,u1,v}`); + (MATCH_MP_TAC CARD_DIFF); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH `CARD ({v0, v1, v2, v3:real^3}) = 3 + 1`); + (REWRITE_WITH `{v0, v1, v2, v3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD {u0, u1, v:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (EXISTS_TAC `v:real^3` THEN EXISTS_TAC `w:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN + UNDISCH_TAC `~(u0 = u1:real^3)` THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[GSYM (ASSUME `{u0:real^3, u1, v, w} = {v0, v1, v2, v3}`)]); + (MATCH_MP_TAC CONIC_CAP_INTER_CONVEX_HULL_4_GT_0); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET x`); + (SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list; ARITH_RULE `4 >= 4`; + ASSUME `x = mcell i V ul`; ASSUME `i = 4`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + (COND_CASES_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2, v3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET x`); + (SIMP_TAC[MCELL_EXPLICIT; mcell4; set_of_list; ARITH_RULE `4 >= 4`; + ASSUME `x = mcell i V ul`; ASSUME `i = 4`; + ASSUME `ul = [v0; v1; v2; v3:real^3]`]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `vol (x INTER D) = &0`); + (MATCH_MP_TAC MEASURE_EQ_0); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + +(* ========================================== *) + + (NEW_GOAL `i = 2`); + (UNDISCH_TAC `i <= 4` THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC + THEN ARITH_TAC); + + (NEW_GOAL `vol (x INTER D) > &0`); + (ONCE_REWRITE_TAC[SET_RULE `a INTER b = b INTER a`]); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2 ;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2; TRUNCATE_SIMPLEX_EXPLICIT_1; + set_of_list; HD; TL]); + (LET_TAC); + (COND_CASES_TAC); + + (NEW_GOAL `i - 1 = 1`); + (UNDISCH_TAC `i = 2` THEN ARITH_TAC); + (UNDISCH_TAC `u0 IN VX V x /\ u1 IN VX V x`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list]); + (STRIP_TAC); + (NEW_GOAL `{u0, u1} = {v0, v1:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1:real^3)` THEN + SET_TAC[]); + (REWRITE_TAC[SET_RULE `A INTER B INTER C INTER D = + (A INTER (B INTER C)) INTER D`]); + (REWRITE_WITH `rcone_ge v0 v1 a' INTER rcone_ge v1 v0 a' = + rcone_ge u0 u1 a' INTER rcone_ge u1 (u0:real^3) a'`); + (ASM_CASES_TAC `u0:real^3 = v0`); + (NEW_GOAL `u1 = v1:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `u0 = v1:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (NEW_GOAL `u1 = v0:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + + (REWRITE_WITH + `conic_cap u0 u1 r d INTER rcone_ge u0 u1 a' INTER rcone_ge u1 u0 a' = + conic_cap (u0:real^3) u1 r d`); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> A INTER B = A`)); + + (NEW_GOAL `conic_cap (u0:real^3) u1 r d SUBSET rcone_ge u0 u1 a'`); + (REWRITE_TAC[conic_cap]); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A SUBSET B`)); + (NEW_GOAL `rcone_gt u0 u1 d SUBSET rcone_gt (u0:real^3) u1 a'`); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "d" THEN EXPAND_TAC "c"); + (MATCH_MP_TAC (REAL_ARITH `a = x ==> a <= max (max y x) (max z t)`)); + (EXPAND_TAC "a'" THEN REWRITE_TAC[HL; set_of_list] THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `rcone_gt u0 u1 a' SUBSET rcone_ge (u0:real^3) u1 a'`); + (REWRITE_TAC[RCONE_GT_SUBSET_RCONE_GE]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[SUBSET_INTER] THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[SUBSET]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC Marchal_cells_2_new.RCONEGE_INTER_VORONOI_CLOSED_IMP_RCONEGE); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + + (REWRITE_WITH `a' = hl [u0; u1:real^3] / sqrt (&2)`); + (EXPAND_TAC "a'"); + (REWRITE_TAC[HL; set_of_list] THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC REAL_LT_DIV); + (REWRITE_TAC[HL_2]); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LT_MUL); + (REWRITE_TAC[REAL_ARITH `&0 < inv (&2)`]); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SQRT_POS_LT); + (REAL_ARITH_TAC); + (EXPAND_TAC "a'"); + (MATCH_MP_TAC REAL_DIV_LE_1_TACTICS); + (STRIP_TAC); + (MATCH_MP_TAC SQRT_POS_LT); + (REAL_ARITH_TAC); + (MATCH_MP_TAC (REAL_ARITH `a < b ==> a <= b`)); + (ASM_REWRITE_TAC[]); + + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (NEW_GOAL `x':real^3 IN ball (u0, (&1))`); + (UP_ASM_TAC THEN REWRITE_TAC[conic_cap;NORMBALL_BALL] THEN STRIP_TAC); + (NEW_GOAL `ball (u0, r) SUBSET ball (u0:real^3, &1)`); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r"); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL] THEN ONCE_REWRITE_TAC[DIST_SYM] + THEN STRIP_TAC); + (REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `u0 = w:real^3`); + (ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + (NEW_GOAL `&2 <= dist (u0, w:real^3)`); + (UNDISCH_TAC `packing (V:real^3->bool)` THEN REWRITE_TAC[packing]); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `u0:real^3 IN V` THEN REWRITE_TAC[IN]); + (NEW_GOAL `dist (x', u0) >= dist (u0, w) - dist (x', w:real^3)`); + (NORM_ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN DEL_TAC THEN DEL_TAC THEN UP_ASM_TAC + THEN REAL_ARITH_TAC); + (ABBREV_TAC `M = mxi V [v0; v1; v2; v3]`); + (ABBREV_TAC `R = omega_list_n V [v0; v1; v2; v3] 3`); + + (NEW_GOAL `vol (conic_cap u0 u1 r d INTER convex hull {v0:real^3,v1,M,R}) + <= vol (conic_cap u0 u1 r d INTER aff_ge {v0, v1} {M, R})`); + (MATCH_MP_TAC MEASURE_SUBSET); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[MEASURABLE_CONIC_CAP]); + (MATCH_MP_TAC MEASURABLE_CONVEX_HULL); + (MATCH_MP_TAC FINITE_IMP_BOUNDED); + (REWRITE_TAC[Geomdetail.FINITE6]); + + (REWRITE_TAC[conic_cap; NORMBALL_BALL]); + (ONCE_REWRITE_TAC[SET_RULE `(a INTER b) INTER c = + (a INTER b) INTER (a INTER c)`]); + (MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[MEASURABLE_BALL_AFF_GE]); + (REWRITE_TAC[GSYM conic_cap; GSYM NORMBALL_BALL; MEASURABLE_CONIC_CAP]); + + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> C INTER A SUBSET C INTER B`)); + (REWRITE_TAC[Marchal_cells_2_new.CONVEX_HULL_4_SUBSET_AFF_GE_2_2]); + + + + (NEW_GOAL `vol (conic_cap u0 u1 r d INTER convex hull {v0, v1, M, R}) > &0`); + (REWRITE_WITH `{v0, v1, M, R} = {u0, u1, M, R:real^3}`); + (UNDISCH_TAC `{u0, u1} = {v0, v1:real^3}` THEN SET_TAC[]); + (MATCH_MP_TAC CONIC_CAP_INTER_CONVEX_HULL_4_GT_0); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + + (UNDISCH_TAC `~NULLSET x`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (LET_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `aff_ge {v0, v1} {M, R:real^3}`); + (REWRITE_TAC[SET_RULE `a INTER B INTER c SUBSET c`]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull ({v0, v1} UNION {M, R:real^3})`); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL; SET_RULE + `{a, b} UNION {c, d} = {a,b,c,d}`]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_WITH `{v0, v1, M, R} = {u0, u1, M, R:real^3}`); + (UNDISCH_TAC `{u0, u1} = {v0, v1:real^3}` THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET x`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2; set_of_list; + TRUNCATE_SIMPLEX_EXPLICIT_1; HD; TL]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `vol (x INTER D) = &0`); + (MATCH_MP_TAC MEASURE_EQ_0); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================== *) + + (REWRITE_WITH `sum s (\t. vol (t INTER D)) = + sum t (\t. vol (t INTER D))`); + (MATCH_MP_TAC SUM_SUPERSET); + (EXPAND_TAC "s" THEN EXPAND_TAC "t" THEN REPEAT STRIP_TAC); + (SET_TAC[]); + (MATCH_MP_TAC MEASURE_EQ_0); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[IN; IN_ELIM_THM] ); + (MESON_TAC[]); + + (REWRITE_WITH `sum t (\t. vol (t INTER D)) = + sum t (\t. vol D * dihX V t (u0,u1) / (&2 * pi))`); + (MATCH_MP_TAC SUM_EQ); + (EXPAND_TAC "t" THEN REWRITE_TAC[IN_ELIM_THM; IN] THEN REPEAT STRIP_TAC); + (ASM_SIMP_TAC[]); + + (REWRITE_TAC[REAL_ARITH `a * b / c = (a / c) * b`]); + (REWRITE_TAC[SUM_LMUL]); + (ABBREV_TAC `R = sum t (\t. dihX V t (u0,u1))`); + + (REWRITE_WITH `vol E = vol D * azim u0 u1 n1 n2 / (&2 * pi)`); + (EXPAND_TAC "E" THEN + REWRITE_TAC[ASSUME `D:real^3->bool = conic_cap u0 u1 r d`]); + (MATCH_MP_TAC VOLUME_CONIC_CAP_WEDGE_GE_VS_CONIC_CAP); + (REPEAT STRIP_TAC); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "r" THEN REAL_ARITH_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[]); + (NEW_GOAL `?a0 a1 a2. vl1 = [a0;a1;a2:real^3]`); + (MATCH_MP_TAC Qzksykg.BARV_2_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN + ASM_REWRITE_TAC[MESON[IN] `barV V 2 vl1 <=> vl1 IN barV V 2`]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `{u0,u1,n1:real^3} = set_of_list vl1`); + (ASM_REWRITE_TAC[set_of_list; EL; HD; TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]); + (NEW_GOAL `{a0, a1:real^3} = {u0,u1}`); + (REWRITE_TAC[GSYM (ASSUME `e = {u0,u1:real^3}`); + GSYM (ASSUME `set_of_list (truncate_simplex 1 vl1) = e:real^3->bool`)]); + (REWRITE_TAC[ASSUME `vl1 = [a0; a1; a2:real^3]`; TRUNCATE_SIMPLEX_EXPLICIT_1; + set_of_list]); + (UP_ASM_TAC THEN SET_TAC[]); + (MATCH_MP_TAC BARV_2_IMP_NOT_COLLINEAR_SET_OF_LIST); + (EXISTS_TAC `V:real^3->bool` THEN + ASM_REWRITE_TAC[MESON[IN] `barV V 2 vl1 <=> vl1 IN barV V 2`]); + + + (UP_ASM_TAC THEN REWRITE_TAC[]); + (NEW_GOAL `?a0 a1 a2. vl2 = [a0;a1;a2:real^3]`); + (MATCH_MP_TAC Qzksykg.BARV_2_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN + ASM_REWRITE_TAC[MESON[IN] `barV V 2 vl2 <=> vl2 IN barV V 2`]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `{u0,u1,n2:real^3} = set_of_list vl2`); + (ASM_REWRITE_TAC[set_of_list; EL; HD; TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]); + (NEW_GOAL `{a0, a1:real^3} = {u0,u1}`); + (REWRITE_TAC[GSYM (ASSUME `e = {u0,u1:real^3}`); + GSYM (ASSUME `set_of_list (truncate_simplex 1 vl2) = e:real^3->bool`)]); + (REWRITE_TAC[ASSUME `vl2 = [a0; a1; a2:real^3]`; TRUNCATE_SIMPLEX_EXPLICIT_1; + set_of_list]); + (UP_ASM_TAC THEN SET_TAC[]); + (MATCH_MP_TAC BARV_2_IMP_NOT_COLLINEAR_SET_OF_LIST); + (EXISTS_TAC `V:real^3->bool` THEN + ASM_REWRITE_TAC[MESON[IN] `barV V 2 vl2 <=> vl2 IN barV V 2`]); + + (REWRITE_TAC[REAL_ARITH `a / b * c = (a * c) / b`]); + (REWRITE_WITH + `(vol D * R) / (&2 * pi) = vol D * azim u0 u1 n1 n2 / (&2 * pi) <=> + (vol D * R) = (vol D * azim u0 u1 n1 n2 / (&2 * pi)) * (&2 * pi)`); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (MATCH_MP_TAC REAL_LT_MUL); + (REWRITE_TAC[PI_POS]); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `(a * b / c) * c = (a * b) * c/c`]); + (REWRITE_WITH `(&2 * pi) / (&2 * pi) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`)); + (MATCH_MP_TAC REAL_LT_MUL); + (REWRITE_TAC[PI_POS]); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `a * x = (a * t) * &1 <=> a * (x - t) = &0`]); + (REWRITE_TAC[REAL_ENTIRE]); + (STRIP_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (NEW_GOAL `&0 < d`); + (EXPAND_TAC "d" THEN UNDISCH_TAC `&0 < c /\ c < &1` THEN REAL_ARITH_TAC); + (ASM_SIMP_TAC[VOLUME_CONIC_CAP]); + (COND_CASES_TAC); + (REWRITE_TAC[]); + (UNDISCH_TAC `d < &1` THEN UNDISCH_TAC `&0 < r` THEN UP_ASM_TAC + THEN REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&2 / &3 * a = &0 <=> a = &0`]); + (REWRITE_TAC[REAL_ENTIRE]); + (NEW_GOAL `~(pi = &0)`); + (MP_TAC PI_POS THEN REAL_ARITH_TAC); + (NEW_GOAL `~(&1 - d = &0)`); + (UNDISCH_TAC `d < &1` THEN REAL_ARITH_TAC); + (NEW_GOAL `~(r pow 3 = &0)`); + (MATCH_MP_TAC REAL_POW_NZ); + (UNDISCH_TAC `&0 < r` THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN REAL_ARITH_TAC)]);; + +(* ========================================================================= *) +(* ========================================================================= *) + +end;; diff --git a/text_formalization/packing/RVFXZBU.hl b/text_formalization/packing/RVFXZBU.hl new file mode 100755 index 0000000..a6dca87 --- /dev/null +++ b/text_formalization/packing/RVFXZBU.hl @@ -0,0 +1,198 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: RVFXZBU *) +(* Chaper : Packing (Marchal cells) *) +(* *) +(* ========================================================================= *) + +(* ========================================================================= *) +(* FILES NEED TO BE LOADED *) + +(* flyspeck_needs "packing/marchal_cells_2.hl";; *) + +module Rvfxzbu = struct + +open Rogers;; +open Vukhacky_tactics;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Sphere;; +open Marchal_cells;; +open Emnwuus;; +open Marchal_cells_2_new;; +open Lepjbdj;; +open Hdtfnfz;; + + +(* ========================================================================= *) + +let RVFXZBU_concl = + `!V ul i p. + i IN {0,1,2,3,4} /\ + saturated V /\ packing V /\ barV V 3 ul /\ p permutes 0..i - 1 + ==> mcell i V (left_action_list p ul) = mcell i V ul`;; + + +let RVFXZBU = prove_by_refinement (RVFXZBU_concl, +[(REPEAT STRIP_TAC); +(* ======================== Case i = 4 ====================================*) + + (ASM_CASES_TAC `i = 4`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell4]); + (NEW_GOAL `4 >= 4`); + (ARITH_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4]); + (REWRITE_TAC[HL]); + (REWRITE_WITH + `set_of_list (left_action_list p ul) = set_of_list (ul:(real^3)list)`); + (MATCH_MP_TAC Packing3.SET_OF_LIST_LEFT_ACTION_LIST); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = i`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3 ->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[]); + +(* ======================== Case i = 0 ====================================*) + + (ASM_CASES_TAC `i = 0`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell0]); + (UNDISCH_TAC `p permutes 0 ..i-1`); + (ASM_REWRITE_TAC[ARITH_RULE `0 - 1 = 0`]); + (REWRITE_TAC[Packing3.PERMUTES_TRIVIAL]); + (DISCH_TAC); + (ASM_REWRITE_TAC[Packing3.LEFT_ACTION_LIST_I]); + + (* ======================== Case i = 1 ====================================*) + + (ASM_CASES_TAC `i = 1`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell1]); + (UNDISCH_TAC `p permutes 0 ..i-1`); + (ASM_REWRITE_TAC[ARITH_RULE `1 - 1 = 0`]); + (REWRITE_TAC[Packing3.PERMUTES_TRIVIAL]); + (DISCH_TAC); + (ASM_REWRITE_TAC[Packing3.LEFT_ACTION_LIST_I]); + + (* ======================== Case i = 2 ====================================*) + + (ASM_CASES_TAC `i = 2`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT]); + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0; u1; u2; u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_CASES_TAC `left_action_list p ul = (ul:(real^3)list)`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `left_action_list p ul = ul \/ + left_action_list p ul = [u1; u0; u2; u3:real^3]`); + (MATCH_MP_TAC LEFT_ACTION_LIST_1_EXPLICIT); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[ARITH_RULE `1 = 2 - 1`]); + (NEW_GOAL `left_action_list p ul = [u1; u0; u2; u3:real^3]`); + (ASM_MESON_TAC[]); + (REWRITE_TAC[ASSUME `left_action_list p ul = [u1; u0; u2; u3:real^3]`; mcell2; HD; TL]); + + (COND_CASES_TAC); + (COND_CASES_TAC); + +(* Case 1 *) + (ASM_REWRITE_TAC[mcell2; HD; TL]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; HL; set_of_list]); + (REWRITE_TAC[SET_RULE `{a,b} = {b, a} /\ {a,b,c,d} = {b,a,c,d}`]); + (REPEAT LET_TAC); + (REWRITE_WITH `mxi V [u1; u0; u2; u3:real^3] = mxi V ul /\ + omega_list_n V [u1; u0; u2; u3] 3 = omega_list_n V ul 3`); + (REWRITE_WITH `[u1; u0; u2; u3:real^3] IN barV V 3 /\ + omega_list_n V [u1; u0; u2; u3:real^3] 1 = omega_list_n V ul 1 /\ + omega_list_n V [u1; u0; u2; u3:real^3] 2 = omega_list_n V ul 2 /\ + omega_list_n V [u1; u0; u2; u3:real^3] 3 = omega_list_n V ul 3 /\ + mxi V [u1; u0; u2; u3:real^3] = mxi V ul`); + (MATCH_MP_TAC LEFT_ACTION_LIST_1_PROPERTIES); + (EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `p permutes 0..i-1` THEN ASM_REWRITE_TAC[ARITH_RULE `2 - 1 = 1`]); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + (* Case 2 *) + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN + ASM_REWRITE_TAC[HL;set_of_list;TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_WITH `{u1, u0} = {u0,u1:real^3} /\ {u1, u0, u2, u3} = {u0, u1, u2, u3}`); + (SET_TAC[]); + (ASM_MESON_TAC[]); + +(* Case 3 *) + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN + ASM_REWRITE_TAC[HL;set_of_list;TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_WITH `{u1, u0} = {u0,u1:real^3} /\ {u1, u0, u2, u3} = {u0, u1, u2, u3}`); + (SET_TAC[]); + (ASM_MESON_TAC[]); + (SET_TAC[]); + +(* ======================== Case i = 3 ====================================*) + + (ASM_CASES_TAC `i = 3`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT]); + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0; u1; u2; u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[mcell3]); + (NEW_GOAL `set_of_list (truncate_simplex 2 (left_action_list p ul)) = + set_of_list (truncate_simplex 2 (ul:(real^3)list))`); + (MATCH_MP_TAC SET_OF_LIST_TRUN2_LEFT_ACTION_LIST2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `p permutes 0..i-1` THEN ASM_REWRITE_TAC[ARITH_RULE `3 -1 =2`]); + (COND_CASES_TAC); + (COND_CASES_TAC); + (ABBREV_TAC `xl:(real^3)list = left_action_list p ul`); + (REWRITE_WITH `xl IN barV V 3 /\ + omega_list_n V xl 2 = omega_list_n V ul 2 /\ + omega_list_n V xl 3 = omega_list_n V ul 3 /\ + mxi V xl = mxi V ul`); + (MATCH_MP_TAC LEFT_ACTION_LIST_PROPERTIES); + (EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `p permutes 0..i-1` THEN ASM_REWRITE_TAC[ARITH_RULE `3 -1 =2`]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[HL]); + (REWRITE_WITH `set_of_list (left_action_list p [u0; u1; u2; u3:real^3]) = + set_of_list [u0; u1; u2; u3]`); + (MATCH_MP_TAC SET_OF_LIST_LEFT_ACTION_LIST_2); + (REWRITE_WITH `LENGTH [u0; u1; u2; u3:real^3] = 4 /\ 4 -2 = 2`); + (REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `2 <= 4`]); + (UNDISCH_TAC `p permutes 0..i-1` THEN ASM_REWRITE_TAC[ARITH_RULE `3 -1 =2`]); + (ASM_MESON_TAC[]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[HL]); + (REWRITE_WITH `set_of_list (left_action_list p [u0; u1; u2; u3:real^3]) = + set_of_list [u0; u1; u2; u3]`); + (MATCH_MP_TAC SET_OF_LIST_LEFT_ACTION_LIST_2); + (REWRITE_WITH `LENGTH [u0; u1; u2; u3:real^3] = 4 /\ 4 -2 = 2`); + (REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `2 <= 4`]); + (UNDISCH_TAC `p permutes 0..i-1` THEN ASM_REWRITE_TAC[ARITH_RULE `3 -1 =2`]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[]); + + (NEW_GOAL `F`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[])]);; + +end;; + diff --git a/text_formalization/packing/Rogers.hl b/text_formalization/packing/Rogers.hl new file mode 100644 index 0000000..e38fdca --- /dev/null +++ b/text_formalization/packing/Rogers.hl @@ -0,0 +1,10872 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Packing/Rogers simplex *) +(* Author: Alexey Solovyev *) +(* Date: 2010-08-12 *) +(* ========================================================================== *) + + +flyspeck_needs "packing/pack3.hl";; +flyspeck_needs "fan/HypermapAndFan.hl";; + + +module Rogers = struct + +open Pack_defs;; +open Sphere;; +open Packing3;; + + + +(*****************************************************************) + +(*****************************************) +(* Faces *) +(*****************************************) + + +(*********************************************) +(* KHEJKCI *) +(*********************************************) + + +(* A(u, v) is a face of A+(u, v) *) +let BIS_FACE_OF_BIS_LE = prove(`!(u:real^N) v. bis u v face_of bis_le u v`, + REPEAT GEN_TAC THEN + SUBGOAL_THEN `bis (u:real^N) v = bis_le u v INTER bis u v` (fun th -> ONCE_REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[bis; bis_le; EXTENSION; IN_INTER; IN_ELIM_THM] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[BIS_EQ_HYPERPLANE] THEN + MATCH_MP_TAC FACE_OF_INTER_SUPPORTING_HYPERPLANE_LE THEN + REWRITE_TAC[CONVEX_BIS_LE; BIS_LE_EQ_HALFSPACE; IN_ELIM_THM]);; + + + + + +(* Generalized version of the target theorem *) +let KHEJKCI_GEN = prove(`!V k r ul vl. saturated V /\ packing V /\ barV V k ul /\ barV V r vl /\ initial_sublist ul vl ==> + (voronoi_list V vl) face_of (voronoi_list V ul) `, + REWRITE_TAC[INITIAL_SUBLIST] THEN + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `?h tl. ul = CONS (h:real^3) tl` MP_TAC THENL + [ + ASM_MESON_TAC[BARV_CONS]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + SUBGOAL_THEN `voronoi_list (V:real^3->bool) ul = voronoi_closed V h INTER INTERS {bis h u | u IN set_of_list tl}` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC VORONOI_LIST_BIS THEN + ASM_MESON_TAC[BARV_SUBSET]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `voronoi_list (V:real^3->bool) vl = voronoi_closed V h INTER INTERS {bis h u | u IN set_of_list (APPEND tl yl)}` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC VORONOI_LIST_BIS THEN + ASM_MESON_TAC[BARV_SUBSET; APPEND]; + ALL_TAC + ] THEN + + REWRITE_TAC[face_of; IN_SET_OF_LIST; MEM_APPEND] THEN + REPEAT CONJ_TAC THENL + [ + SET_TAC[]; + MATCH_MP_TAC CONVEX_INTER THEN CONJ_TAC THENL + [ + ASM_MESON_TAC[DRUQUFE]; + ALL_TAC + ] THEN + + MATCH_MP_TAC CONVEX_INTERS THEN + REWRITE_TAC[IN_ELIM_THM] THEN + MESON_TAC[CONVEX_BIS]; + + ALL_TAC + ] THEN + + + REPEAT GEN_TAC THEN + SIMP_TAC[IN_INTER; IN_INTERS; IN_ELIM_THM] THEN + REPLICATE_TAC 2 (DISCH_THEN (CONJUNCTS_THEN2 (ASSUME_TAC o CONJUNCT1) MP_TAC)) THEN + STRIP_TAC THEN + SUBGOAL_THEN `!u:real^3. u IN V ==> a:real^3 IN bis_le h u /\ b:real^3 IN bis_le h u` ASSUME_TAC THENL + [ + REPLICATE_TAC 3 (POP_ASSUM (fun th -> ALL_TAC)) THEN GEN_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[voronoi_closed; bis_le; IN_ELIM_THM; IN] THEN + MESON_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!u:real^3. (MEM u tl ==> u IN V) /\ (MEM u yl ==> u IN V)` ASSUME_TAC THENL + [ + GEN_TAC THEN REPLICATE_TAC 6 (POP_ASSUM (fun th -> ALL_TAC)) THEN + REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN + POP_ASSUM (MP_TAC o (fun th -> MATCH_MP BARV_SUBSET th)) THEN + POP_ASSUM (MP_TAC o (fun th -> MATCH_MP BARV_SUBSET th)) THEN + REWRITE_TAC[IMP_IMP; GSYM CONJ_ASSOC] THEN + REWRITE_TAC[IMP_CONJ_ALT] THEN + REPLICATE_TAC 2 (DISCH_THEN (fun th -> REWRITE_TAC[th])) THEN + REWRITE_TAC[SUBSET; IN_SET_OF_LIST; MEM_APPEND; MEM] THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!u:real^3. u IN V /\ x IN bis h u ==> a IN bis h u /\ b IN bis h u` ASSUME_TAC THENL + [ + POP_ASSUM (fun th -> ALL_TAC) THEN GEN_TAC THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o (SPEC `u:real^3`)) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + MP_TAC (ISPECL [`h:real^3`; `u:real^3`] BIS_FACE_OF_BIS_LE) THEN + REWRITE_TAC[face_of] THEN + DISCH_THEN (CONJUNCTS_THEN2 (fun th -> ALL_TAC) (MP_TAC o CONJUNCT2)) THEN + DISCH_THEN (MP_TAC o ISPECL [`a:real^3`; `b:real^3`; `x:real^3`]) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + ASM_MESON_TAC[]);; + + + + +(* vor_list -> barV *) +let KHEJKCI = prove(`!V k ul. saturated V /\ packing V /\ barV V k ul ==> + ((voronoi_list V ul) face_of (voronoi_closed V (HD ul)) )`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM (MP_TAC o (fun th -> MATCH_MP BARV_CONS th)) THEN + STRIP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[GSYM VORONOI_LIST_SING] THEN + MATCH_MP_TAC KHEJKCI_GEN THEN + EXISTS_TAC `0` THEN EXISTS_TAC `k:num` THEN + SUBGOAL_THEN `initial_sublist [h:real^3] ul` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[INITIAL_SUBLIST; APPEND] THEN MESON_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL [`V:real^3->bool`; `k:num`; `ul:(real^3)list`; `[h:real^3]`] BARV_INITIAL_SUBLIST) THEN + ASM_REWRITE_TAC[LENGTH; ARITH_RULE `0 < SUC 0`; ARITH_RULE `SUC 0 - 1 = 0`]);; + + + + + + +(*********************************************) +(* IDBEZAL *) +(* Characterization of facets of Omega(V,W) *) +(*********************************************) + + + +(* Canonical representation for Omega(V, barV(k)) *) +let VORONOI_BARV_CANONICAL = prove(`!V k ul. packing V /\ saturated V /\ barV V k ul + ==> ?K. FINITE K /\ voronoi_list V ul = affine hull (voronoi_list V ul) INTER INTERS K /\ + (!a. a IN K ==> (?v. v IN V /\ ~(v = HD ul) /\ (a = bis_le v (HD ul) \/ a = bis_le (HD ul) v))) /\ + (!K'. K' PSUBSET K ==> (voronoi_list V ul) PSUBSET (affine hull (voronoi_list V ul) INTER INTERS K'))`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `k:num`; `ul:(real^3)list`] BARV_CONS) THEN + MP_TAC (SPECL [`V:real^3->bool`; `k:num`; `ul:(real^3)list`] BARV_SUBSET) THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `h:real^3`; `t:(real^3)list`] VORONOI_LIST_CANONICAL) THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + DISCH_THEN (LABEL_TAC "A") THEN + DISCH_TAC THEN REMOVE_THEN "A" MP_TAC THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]));; + + + + +let REAL_LINE_BOUNDED = prove(`!a b. (!t. t * a <= b) ==> a = &0`, + REPEAT STRIP_TAC THEN + DISJ_CASES_TAC (TAUT `a = &0 \/ ~(a = &0)`) THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `(b + &1) * inv(a)`) THEN + ASM_REWRITE_TAC[GSYM REAL_MUL_ASSOC] THEN + ASM_SIMP_TAC[REAL_MUL_LINV] THEN + REAL_ARITH_TAC);; + + + +let REAL_NEG_LE_RMUL = prove(`!x y z. z < &0 ==> (x <= y <=> y * z <= x * z)`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`x:real`; `y:real`; `--z:real`] REAL_LE_LMUL_EQ) THEN + ASM_REWRITE_TAC[REAL_NEG_GT0] THEN + REWRITE_TAC[REAL_MUL_LNEG; REAL_LE_NEG; REAL_MUL_AC] THEN + SIMP_TAC[]);; + + + + +let HALFSPACE_EQ = prove(`!(a:real^N) b c d. {x | a dot x <= b} = {x | c dot x <= d} <=> (?t. c = t % a /\ d = t * b /\ &0 < t) \/ (a = vec 0 /\ c = vec 0 /\ ((&0 <= b /\ &0 <= d) \/ (b < &0 /\ d < &0)))`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN + EQ_TAC THENL + [ + DISCH_TAC THEN + DISJ_CASES_TAC (TAUT `(a:real^N) = vec 0 \/ ~(a = vec 0)`) THENL + [ + DISJ2_TAC THEN + ASM_REWRITE_TAC[] THEN + DISJ_CASES_TAC (TAUT `(c:real^N) = vec 0 \/ ~(c = vec 0)`) THEN ASM_REWRITE_TAC[] THENL + [ + FIRST_X_ASSUM (MP_TAC o check (is_forall o concl)) THEN + ASM_REWRITE_TAC[DOT_LZERO] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + + SUBGOAL_TAC "A" `~((c:real^N) dot c = &0)` [ ASM_REWRITE_TAC[DOT_EQ_0] ] THEN + DISJ_CASES_TAC (REAL_ARITH `&0 <= b \/ b < &0`) THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `((d + &1) * inv((c:real^N) dot c)) % c`) THEN + ASM_REWRITE_TAC[DOT_LZERO] THEN + REWRITE_TAC[DOT_RMUL; GSYM REAL_MUL_ASSOC] THEN + ASM_SIMP_TAC[REAL_MUL_LINV] THEN + REAL_ARITH_TAC; + + FIRST_X_ASSUM (MP_TAC o SPEC `(d * inv((c:real^N) dot c)) % c`) THEN + ASM_REWRITE_TAC[DOT_LZERO] THEN + ASM_SIMP_TAC[REAL_ARITH `b < &0 ==> ((&0 <= b) <=> F)`] THEN + REWRITE_TAC[DOT_RMUL; GSYM REAL_MUL_ASSOC] THEN + ASM_SIMP_TAC[REAL_MUL_LINV] THEN + REWRITE_TAC[REAL_MUL_RID; REAL_LE_REFL] + ]; + + ALL_TAC + ] THEN + + DISJ1_TAC THEN + SUBGOAL_TAC "A" `~((a:real^N dot a) = &0)` [ ASM_REWRITE_TAC[DOT_EQ_0] ] THEN + SUBGOAL_THEN `!u. u*((a:real^N dot a)*(c dot c) - (a dot c)*(a dot c)) <= d*(a dot a) - b*(a dot c)` MP_TAC THENL + [ + GEN_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `((b - u * (a:real^N dot c)) * inv(a dot a)) % a + u % c`) THEN + REWRITE_TAC[DOT_RADD; DOT_RMUL] THEN + REWRITE_TAC[GSYM REAL_MUL_ASSOC] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_MUL_RID; REAL_ARITH `(b:real - a) + a = b`; REAL_LE_REFL] THEN + + DISCH_TAC THEN + ASSUME_TAC (ISPEC `a:real^N` DOT_POS_LE) THEN + + MP_TAC (SPECL [`(b - u * (a:real^N dot c)) * inv(a dot a) * (c dot a) + u * (c dot c)`; `d:real`; `a:real^N dot a`] REAL_LE_RMUL) THEN + ASM_REWRITE_TAC[REAL_ADD_RDISTRIB] THEN + REWRITE_TAC[GSYM REAL_MUL_ASSOC] THEN + ASM_SIMP_TAC[REAL_FIELD `~(a:real^N dot a = &0) ==> inv(a dot a) * (c dot a) * (a dot a) = (c dot a)`] THEN + REWRITE_TAC[REAL_SUB_RDISTRIB; REAL_SUB_LDISTRIB; DOT_SYM] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_THEN (MP_TAC o (fun th -> MATCH_MP REAL_LINE_BOUNDED th)) THEN + REWRITE_TAC[GSYM REAL_POW_2; REAL_ARITH `a - b = &0 <=> b = a`] THEN + DISCH_TAC THEN + SUBGOAL_THEN `?t. c = t % (a:real^N)` MP_TAC THENL + [ + MP_TAC (SPECL [`a:real^N`; `c:real^N`] DOT_CAUCHY_SCHWARZ_EQUAL) THEN + ASM_REWRITE_TAC[COLLINEAR_LEMMA] THEN + STRIP_TAC THENL + [ + EXISTS_TAC `&0` THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO]; + ALL_TAC + ] THEN + EXISTS_TAC `c':real` THEN ASM_REWRITE_TAC[]; + + ALL_TAC + ] THEN + + STRIP_TAC THEN + EXISTS_TAC `t:real` THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o check (is_forall o concl)) THEN + ASM_REWRITE_TAC[DOT_LMUL] THEN + DISCH_TAC THEN + FIRST_ASSUM (MP_TAC o SPEC `(b * inv(a:real^N dot a)) % a`) THEN + FIRST_ASSUM (MP_TAC o SPEC `(d * inv(t) * inv(a:real^N dot a)) % a`) THEN + REWRITE_TAC[DOT_RMUL; GSYM REAL_MUL_ASSOC] THEN + ASM_SIMP_TAC[REAL_MUL_LINV] THEN + REWRITE_TAC[REAL_MUL_RID; REAL_LE_REFL] THEN + SUBGOAL_THEN `~(t = &0)` ASSUME_TAC THENL + [ + DISJ_CASES_TAC (TAUT `~(t = &0) \/ t = &0`) THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o check (is_forall o concl)) THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 * a = &0`] THEN + DISCH_TAC THEN + DISJ_CASES_TAC (REAL_ARITH `&0 <= d \/ d < &0`) THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `((b + &1) * inv((a:real^N) dot a)) % a`) THEN + ASM_REWRITE_TAC[DOT_LZERO] THEN + REWRITE_TAC[DOT_RMUL; GSYM REAL_MUL_ASSOC] THEN + ASM_SIMP_TAC[REAL_MUL_LINV] THEN + REAL_ARITH_TAC; + + FIRST_X_ASSUM (MP_TAC o SPEC `(b * inv((a:real^N) dot a)) % a`) THEN + ASM_REWRITE_TAC[DOT_LZERO] THEN + ASM_SIMP_TAC[REAL_ARITH `b < &0 ==> ((&0 <= b) <=> F)`] THEN + REWRITE_TAC[DOT_RMUL; GSYM REAL_MUL_ASSOC] THEN + ASM_SIMP_TAC[REAL_MUL_LINV] THEN + REWRITE_TAC[REAL_MUL_RID; REAL_LE_REFL] + ]; + + ALL_TAC + ] THEN + + ASM_SIMP_TAC[REAL_FIELD `~(t = &0) ==> t * d * inv t = d`] THEN + ASM_REWRITE_TAC[REAL_LE_REFL] THEN + + SUBGOAL_THEN `&0 < t` ASSUME_TAC THENL + [ + DISJ_CASES_TAC (REAL_ARITH `&0 < t \/ t <= &0`) THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[REAL_LE_LT] THEN + DISCH_TAC THEN + DISJ_CASES_TAC (REAL_ARITH `t * b - d - &1 <= &0 \/ &0 < t * b - d - &1`) THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `((d + &1) * inv(t) * inv(a:real^N dot a)) % a`) THEN + REWRITE_TAC[DOT_RMUL; GSYM REAL_MUL_ASSOC] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_MUL_RID; REAL_FIELD `~(t = &0) ==> (t * d * inv t = d)`] THEN + REWRITE_TAC[REAL_ARITH `d + &1 <= d <=> F`] THEN + SUBGOAL_THEN `(d + &1) * inv t <= b` MP_TAC THENL + [ + MP_TAC (SPECL [`(d + &1) * inv t`; `b:real`; `t:real`] REAL_NEG_LE_RMUL) THEN + ASM_REWRITE_TAC[GSYM REAL_MUL_ASSOC] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_MUL_RID] THEN + POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + + ALL_TAC + ] THEN + MESON_TAC[]; + + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `(b * inv(a:real^N dot a)) % a`) THEN + REWRITE_TAC[DOT_RMUL; GSYM REAL_MUL_ASSOC] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_MUL_RID; REAL_LE_REFL] THEN + POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + + ALL_TAC + ] THEN + + DISCH_TAC THEN + SUBGOAL_THEN `d:real <= t * b` MP_TAC THENL + [ + MP_TAC (SPECL [`t:real`; `(d:real) * inv t`; `b:real`] REAL_LE_LMUL) THEN + ASM_SIMP_TAC[REAL_ARITH `&0 < t ==> &0 <= t`; REAL_FIELD `~(t = &0) ==> t * d * inv t = d`]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + REAL_ARITH_TAC; + + ALL_TAC + ] THEN + + STRIP_TAC THENL + [ + GEN_TAC THEN + ASM_REWRITE_TAC[DOT_LMUL] THEN + ASM_SIMP_TAC[REAL_LE_LMUL_EQ]; + + GEN_TAC THEN + ASM_REWRITE_TAC[DOT_LZERO]; + + GEN_TAC THEN + ASM_REWRITE_TAC[DOT_LZERO] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC + ]);; + + + +let HALFSPACE_EQ_BIS_LE_IMP_HYPERPLANE_EQ_BIS = prove(`!(a:real^N) b v w. ~(a = vec 0) /\ {x | a dot x <= b} = bis_le v w ==> {x | a dot x = b} = bis v w`, + REPEAT GEN_TAC THEN + REWRITE_TAC[BIS_LE_EQ_HALFSPACE; BIS_EQ_HYPERPLANE] THEN + REWRITE_TAC[HALFSPACE_EQ] THEN + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[DOT_LZERO; EXTENSION; IN_ELIM_THM] THENL + [ + GEN_TAC THEN + REWRITE_TAC[DOT_LMUL] THEN + REWRITE_TAC[REAL_EQ_MUL_LCANCEL] THEN + ASM_SIMP_TAC[REAL_ARITH `&0 < t ==> ~(t = &0)`]; + + ASM_MESON_TAC[]; + ASM_MESON_TAC[] + ]);; + + + + + +(* A special version of the FACET_OF_POLYHEDRON_EXPLICIT theorem for bisectors *) +let FACET_OF_POLYHEDRON_EXPLICIT_BIS = prove(`!(V:real^3->bool) K s u. + FINITE K /\ s = affine hull s INTER INTERS K /\ + (!a. a IN K ==> (?v. v IN V /\ ~(v = u) /\ (a = bis_le v u \/ a = bis_le u v))) /\ + (!K'. K' PSUBSET K ==> s PSUBSET (affine hull s INTER INTERS K')) + ==> (!c. c facet_of s <=> (?v. v IN V /\ (bis_le v u IN K \/ bis_le u v IN K) /\ c = s INTER bis u v))`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `?a b. !h:real^3->bool. h IN K ==> ~(a h = vec 0) /\ h = {x | a h dot x <= b h}` MP_TAC THENL + [ + POP_ASSUM (fun th -> ALL_TAC) THEN POP_ASSUM MP_TAC THEN + REPLICATE_TAC 2 (POP_ASSUM (fun th -> ALL_TAC)) THEN + DISCH_TAC THEN + REWRITE_TAC[GSYM SKOLEM_THM] THEN + GEN_TAC THEN + REWRITE_TAC[RIGHT_EXISTS_IMP_THM] THEN + DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `h:(real^3->bool)`) THEN + ASM_REWRITE_TAC[BIS_LE_EQ_HALFSPACE] THEN STRIP_TAC THENL + [ + EXISTS_TAC `&2 % (u - (v:real^3))` THEN + EXISTS_TAC `(u:real^3) dot u - (v:real^3) dot v` THEN + ASM_REWRITE_TAC[VECTOR_MUL_EQ_0; REAL_ARITH `&2 = &0 <=> F`; VECTOR_SUB_EQ]; + EXISTS_TAC `&2 % ((v:real^3) - u)` THEN + EXISTS_TAC `(v:real^3) dot v - (u:real^3) dot u` THEN + ASM_REWRITE_TAC[VECTOR_MUL_EQ_0; REAL_ARITH `&2 = &0 <=> F`; VECTOR_SUB_EQ] + ]; + + ALL_TAC + ] THEN + + STRIP_TAC THEN + MP_TAC (ISPECL [`s:(real^3->bool)`; `K:(real^3->bool)->bool`; `a:(real^3->bool)->real^3`; `b:(real^3->bool)->real`] FACET_OF_POLYHEDRON_EXPLICIT) THEN + ASM_REWRITE_TAC[] THEN ANTS_TAC THENL [ ASM_MESON_TAC[]; ALL_TAC] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + EQ_TAC THENL + [ + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `h:real^3->bool`) THEN + FIRST_X_ASSUM ((fun th -> ALL_TAC) o check (is_forall o concl)) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `h:real^3->bool`) THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THENL + [ + EXISTS_TAC `v:real^3` THEN + SUBGOAL_THEN `{x:real^3 | x | (a:(real^3->bool)->real^3) h dot x = b h} = bis u v` ASSUME_TAC THENL + [ + MP_TAC (ISPECL [`(a:(real^3->bool)->real^3) h`; `(b:(real^3->bool)->real) h`; `v:real^3`; `u:real^3`] HALFSPACE_EQ_BIS_LE_IMP_HYPERPLANE_EQ_BIS) THEN + ASM_MESON_TAC[BIS_SYM]; + ALL_TAC + ] THEN + ASM_MESON_TAC[]; + + EXISTS_TAC `v:real^3` THEN + SUBGOAL_THEN `{x:real^3 | x | (a:(real^3->bool)->real^3) h dot x = b h} = bis u v` ASSUME_TAC THENL + [ + MP_TAC (ISPECL [`(a:(real^3->bool)->real^3) h`; `(b:(real^3->bool)->real) h`; `u:real^3`; `v:real^3`] HALFSPACE_EQ_BIS_LE_IMP_HYPERPLANE_EQ_BIS) THEN + ASM_MESON_TAC[]; + ALL_TAC + ] THEN + ASM_MESON_TAC[] + ]; + + ALL_TAC + ] THEN + + STRIP_TAC THENL + [ + ABBREV_TAC `h = bis_le (v:real^3) u` THEN + FIRST_X_ASSUM (MP_TAC o SPEC `h:real^3->bool`) THEN + FIRST_X_ASSUM ((fun th -> ALL_TAC) o check (is_forall o concl)) THEN + FIRST_X_ASSUM ((fun th -> ALL_TAC) o SPEC `h:real^3->bool`) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + EXISTS_TAC `h:real^3->bool` THEN + SUBGOAL_THEN `{x:real^3 | x | (a:(real^3->bool)->real^3) h dot x = b h} = bis u v` ASSUME_TAC THENL + [ + MP_TAC (ISPECL [`(a:(real^3->bool)->real^3) h`; `(b:(real^3->bool)->real) h`; `v:real^3`; `u:real^3`] HALFSPACE_EQ_BIS_LE_IMP_HYPERPLANE_EQ_BIS) THEN + ASM_MESON_TAC[BIS_SYM]; + ALL_TAC + ] THEN + ASM_MESON_TAC[]; + + ABBREV_TAC `h = bis_le (u:real^3) v` THEN + FIRST_X_ASSUM (MP_TAC o SPEC `h:real^3->bool`) THEN + FIRST_X_ASSUM ((fun th -> ALL_TAC) o check (is_forall o concl)) THEN + FIRST_X_ASSUM ((fun th -> ALL_TAC) o SPEC `h:real^3->bool`) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + EXISTS_TAC `h:real^3->bool` THEN + SUBGOAL_THEN `{x:real^3 | x | (a:(real^3->bool)->real^3) h dot x = b h} = bis u v` ASSUME_TAC THENL + [ + MP_TAC (ISPECL [`(a:(real^3->bool)->real^3) h`; `(b:(real^3->bool)->real) h`; `u:real^3`; `v:real^3`] HALFSPACE_EQ_BIS_LE_IMP_HYPERPLANE_EQ_BIS) THEN + ASM_MESON_TAC[BIS_SYM]; + ALL_TAC + ] THEN + ASM_MESON_TAC[] + ]);; + + + + +(************************************************************) +(* IDBEZAL: characterization of facets of Omega(V, ul) *) +(************************************************************) + +(* vor_list -> barV *) +let IDBEZAL = prove(`!V ul k F. saturated V /\ packing V /\ barV V k ul /\ (k < 3) ==> + (F facet_of voronoi_list V ul <=> + (?vl. (F = voronoi_list V vl) /\ barV V (k+1) vl /\ (truncate_simplex k vl = ul)))`, + REPEAT STRIP_TAC THEN + EQ_TAC THENL + [ + MP_TAC (SPECL [`V:real^3->bool`; `k:num`; `ul:(real^3)list`] VORONOI_BARV_CANONICAL) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ABBREV_TAC `s = voronoi_list (V:real^3->bool) ul` THEN + + MP_TAC (SPECL [`V:real^3->bool`; `K:(real^3->bool)->bool`; `s:real^3->bool`; `(HD ul):real^3`] FACET_OF_POLYHEDRON_EXPLICIT_BIS) THEN + + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL [ ASM_MESON_TAC[]; ALL_TAC ] THEN + DISCH_TAC THEN DISCH_TAC THEN + SUBGOAL_THEN `aff_dim (F':real^3->bool) = aff_dim (s:real^3->bool) - &1` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REWRITE_TAC[facet_of] THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + DISCH_THEN (CHOOSE_THEN MP_TAC) THEN + DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + DISCH_THEN (ASSUME_TAC o CONJUNCT2) THEN + DISCH_TAC THEN + EXISTS_TAC `APPEND ul [v:real^3]` THEN + SUBGOAL_THEN `truncate_simplex k (APPEND ul [v:real^3]) = ul` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[TRUNCATE_SIMPLEX] THEN + MATCH_MP_TAC CHOICE_LEMMA THEN + CONJ_TAC THENL + [ + EXISTS_TAC `ul:(real^3)list` THEN + CONJ_TAC THENL [ ASM_MESON_TAC[BARV]; ALL_TAC] THEN + REWRITE_TAC[INITIAL_SUBLIST_APPEND]; + ALL_TAC + ] THEN + + REPLICATE_TAC 9 (POP_ASSUM (fun th -> ALL_TAC)) THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[BARV] THEN + REPEAT STRIP_TAC THEN + ASSUME_TAC (ISPECL [`ul:(real^3)list`; `[v:real^3]`] INITIAL_SUBLIST_APPEND) THEN + ASM_MESON_TAC[INITIAL_SUBLIST_UNIQUE]; + + ALL_TAC + ] THEN + + SUBGOAL_THEN `F' = voronoi_list V (APPEND ul [v:real^3])` ASSUME_TAC THENL + [ + POP_ASSUM (fun th -> ALL_TAC) THEN + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN + REPLICATE_TAC 5 (POP_ASSUM (fun th -> ALL_TAC)) THEN + FIRST_ASSUM (MP_TAC o (fun th -> MATCH_MP BARV_SUBSET th)) THEN + FIRST_ASSUM (MP_TAC o (fun th -> MATCH_MP BARV_CONS th)) THEN + STRIP_TAC THEN + FIRST_X_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + DISCH_TAC THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + DISCH_TAC THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MATCH_MP_TAC VORONOI_LIST_INTER_BIS THEN + ASM_MESON_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `barV (V:real^3->bool) (k + 1) (APPEND ul [v])` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[BARV] THEN CONJ_TAC THENL + [ + REPLICATE_TAC 10 (POP_ASSUM (fun th -> ALL_TAC)) THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[BARV; LENGTH_APPEND] THEN + REWRITE_TAC[LENGTH; SYM ONE] THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[VORONOI_NONDG; INITIAL_SUBLIST_APPEND_SING] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + EXPAND_TAC "s" THEN + POP_ASSUM (fun th -> ALL_TAC) THEN + POP_ASSUM MP_TAC THEN + REPLICATE_TAC 5 (POP_ASSUM (fun th -> ALL_TAC)) THEN + POP_ASSUM MP_TAC THEN + FIRST_ASSUM (MP_TAC o (fun th -> MATCH_MP BARV_SUBSET th)) THEN + POP_ASSUM MP_TAC THEN + REPLICATE_TAC 2 (POP_ASSUM (fun th -> ALL_TAC)) THEN + REWRITE_TAC[BARV; VORONOI_NONDG] THEN + + REPEAT STRIP_TAC THEN ASM_SIMP_TAC[] THENL + [ + ASM_REWRITE_TAC[LENGTH_APPEND; LENGTH] THEN + ASM_SIMP_TAC [ARITH_RULE `k < 3 ==> (k + 1) + SUC 0 < 5`]; + REWRITE_TAC[SUBSET; IN_SET_OF_LIST; MEM_APPEND; MEM] THEN + ASM_MESON_TAC[SUBSET; IN_SET_OF_LIST]; + + POP_ASSUM (fun th -> ALL_TAC) THEN POP_ASSUM (fun th -> ALL_TAC) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[LENGTH_APPEND; LENGTH] THEN + POP_ASSUM (fun th -> ALL_TAC) THEN POP_ASSUM MP_TAC THEN + POP_ASSUM MP_TAC THEN + POP_ASSUM (MP_TAC o SPEC `ul:(real^3)list`) THEN + ASM_REWRITE_TAC[INITIAL_SUBLIST_REFL; ARITH_RULE `0 < k + 1`] THEN + ARITH_TAC + ]; + ALL_TAC + ] THEN + POP_ASSUM ACCEPT_TAC; + + ALL_TAC + ] THEN + + REWRITE_TAC[facet_of] THEN + REPEAT STRIP_TAC THENL + [ + SUBGOAL_THEN `initial_sublist ul (vl:(real^3)list)` ASSUME_TAC THENL + [ + SUBGOAL_TAC "A" `k + 1 <= LENGTH (vl:(real^3)list)` [ ASM_MESON_TAC[BARV; ARITH_RULE `k + 1 <= (k + 1) + 1`] ] THEN + ASM_MESON_TAC[TRUNCATE_SIMPLEX_INITIAL_SUBLIST]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC KHEJKCI_GEN THEN + ASM_MESON_TAC[]; + + POP_ASSUM MP_TAC THEN POP_ASSUM (fun th -> ALL_TAC) THEN POP_ASSUM MP_TAC THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[BARV; VORONOI_NONDG] THEN + STRIP_TAC THEN + POP_ASSUM (MP_TAC o SPEC `vl:(real^3)list`) THEN + ASM_SIMP_TAC[INITIAL_SUBLIST_REFL; ARITH_RULE `k < 3 ==> (k + 1) + 1 < 5`; ARITH_RULE `0 < a + 1`] THEN + DISCH_THEN ((LABEL_TAC "A") o CONJUNCT2) THEN + DISCH_TAC THEN REMOVE_THEN "A" MP_TAC THEN + POP_ASSUM (fun th -> REWRITE_TAC[th; AFF_DIM_EMPTY]) THEN + POP_ASSUM (fun th -> ALL_TAC) THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[GSYM INT_OF_NUM_ADD] THEN + REWRITE_TAC[INT_ARITH `-- &1 + (((&k):int) + &1) + &1 = &4 <=> (&k):int = &3`] THEN + ONCE_REWRITE_TAC[INT_OF_NUM_EQ] THEN + ACCEPT_TAC (ARITH_RULE `k < 3 ==> ~(k = 3)`); + + POP_ASSUM (fun th -> ALL_TAC) THEN + POP_ASSUM MP_TAC THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[BARV; VORONOI_NONDG] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `vl:(real^3)list`) THEN + ASM_SIMP_TAC[INITIAL_SUBLIST_REFL; ARITH_RULE `0 < a + 1`] THEN + DISCH_THEN (CONJUNCTS_THEN2 (fun th -> ALL_TAC) (ASSUME_TAC o CONJUNCT2)) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `ul:(real^3)list`) THEN + ASM_SIMP_TAC[INITIAL_SUBLIST_REFL; ARITH_RULE `0 < a + 1`] THEN + DISCH_THEN (CONJUNCTS_THEN2 (fun th -> ALL_TAC) (ASSUME_TAC o CONJUNCT2)) THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[GSYM INT_OF_NUM_ADD] THEN + INT_ARITH_TAC + ]);; + + + +(**************************************) + +(************************) +(* Partitionining space *) +(************************) + +(* GLTVHUM *) + +let VORONOI_LIST_EQ_UNION_CONVEX_HULL_FACETS = prove(`!V ul k p. packing V /\ saturated V /\ barV V k ul /\ k < 3 /\ p IN voronoi_list V ul + ==> voronoi_list V ul = UNIONS {convex hull (p INSERT voronoi_list V vl) | vl | + barV V (k + 1) vl /\ truncate_simplex k vl = ul}`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`{p:real^3}`; `voronoi_list V ul`] POLYTOPE_UNION_CONVEX_HULL_FACETS) THEN + ANTS_TAC THENL + [ + ASM_SIMP_TAC[SUBSET; IN_SING] THEN + REPEAT CONJ_TAC THENL + [ + MATCH_MP_TAC POLYTOPE_VORONOI_LIST THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC BARV_SUBSET THEN + EXISTS_TAC `k:num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[GSYM LENGTH_EQ_NIL] THEN + UNDISCH_TAC `barV V k ul` THEN SIMP_TAC[BARV] THEN + ARITH_TAC; + + UNDISCH_TAC `barV V k ul` THEN + REWRITE_TAC[BARV; VORONOI_NONDG] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `ul:(real^3)list`) THEN + ASM_REWRITE_TAC[INITIAL_SUBLIST_REFL; ARITH_RULE `0 < k + 1`] THEN + REWRITE_TAC[GSYM INT_OF_NUM_ADD] THEN + UNDISCH_TAC `k < 3` THEN + REWRITE_TAC[GSYM INT_OF_NUM_LT] THEN + INT_ARITH_TAC; + + REWRITE_TAC[EXTENSION; IN_SING; NOT_IN_EMPTY; NOT_FORALL_THM] THEN + EXISTS_TAC `p:real^3` THEN REWRITE_TAC[] + ]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th]) THEN + AP_TERM_TAC THEN + + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `k:num`] IDBEZAL) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th]) THEN + + REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN GEN_TAC THEN + REWRITE_TAC[GSYM EXTENSION; SET_RULE `!f:real^3->bool. {p} UNION f = p INSERT f`] THEN + EQ_TAC THEN STRIP_TAC THENL + [ + EXISTS_TAC `vl:(real^3)list` THEN + ASM_REWRITE_TAC[]; + EXISTS_TAC `voronoi_list V vl` THEN + ASM_REWRITE_TAC[] THEN + EXISTS_TAC `vl:(real^3)list` THEN + ASM_REWRITE_TAC[] + ]);; + + + +let NUMSEG_SUBSET_INDUCT = prove(`!s a b. (a IN s) /\ (!k. a <= k /\ SUC k <= b /\ k IN s ==> SUC k IN s) ==> a..b SUBSET s`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[SUBSET; IN_NUMSEG] THEN + INDUCT_TAC THENL + [ + REWRITE_TAC[ARITH_RULE `a <= 0 <=> a = 0`] THEN DISCH_TAC THEN + UNDISCH_TAC `a:num IN s` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_TAC THEN + ASM_CASES_TAC `SUC x = a:num` THENL + [ + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (ARITH_RULE `a <= SUC x /\ ~(SUC x = a) /\ SUC x <= b ==> a <= x /\ x <= b`) THEN + ASM_SIMP_TAC[]);; + + + +let BARV_EXISTS = prove(`!V wl k. packing V /\ saturated V /\ k < 3 /\ barV V k wl ==> ?vl. barV V (SUC k) vl /\ truncate_simplex k vl = wl`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`voronoi_list V wl`] POLYTOPE_FACET_EXISTS) THEN + ANTS_TAC THENL + [ + CONJ_TAC THENL + [ + MATCH_MP_TAC POLYTOPE_VORONOI_LIST_BARV THEN + EXISTS_TAC `k:num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[AFF_DIM_VORONOI_LIST] THEN + UNDISCH_TAC `k < 3` THEN REWRITE_TAC[GSYM INT_OF_NUM_LT] THEN + INT_ARITH_TAC; + ALL_TAC + ] THEN + + STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `wl:(real^3)list`; `k:num`; `f:real^3->bool`] IDBEZAL) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + EXISTS_TAC `vl:(real^3)list` THEN + ASM_REWRITE_TAC[ADD1]);; + + + +let BARV_EXISTS_ALT = prove(`!V k. packing V /\ saturated V /\ k <= 3 ==> ?ul. barV V k ul`, + GEN_TAC THEN INDUCT_TAC THENL + [ + STRIP_TAC THEN + MP_TAC (SPEC_ALL TIWWFYQ) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + EXISTS_TAC `[v:real^3]` THEN + ASM_SIMP_TAC[BARV_0]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) THEN + ASM_SIMP_TAC[ARITH_RULE `SUC k <= 3 ==> k <= 3`] THEN + STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `k:num`] BARV_EXISTS) THEN + ASM_SIMP_TAC[ARITH_RULE `SUC k <= 3 ==> k < 3`] THEN + STRIP_TAC THEN + EXISTS_TAC `vl:(real^3)list` THEN + ASM_REWRITE_TAC[]);; + + + +let GLTVHUM_lemma1 = prove(`!V ul j. packing V /\ saturated V /\ j < 3 /\ barV V j ul + ==> {k | k IN j..3 /\ + voronoi_list V ul = UNIONS {convex hull ({omega_list_n V vl i | i IN j..k-1} UNION voronoi_list V vl) | vl | + barV V k vl /\ truncate_simplex j vl = ul}} = j..3`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC SUBSET_ANTISYM THEN + CONJ_TAC THENL + [ + SIMP_TAC[SUBSET; IN_ELIM_THM]; + ALL_TAC + ] THEN + + MATCH_MP_TAC NUMSEG_SUBSET_INDUCT THEN + REWRITE_TAC[SUBSET; IN_NUMSEG; IN_ELIM_THM; LE_REFL] THEN + SUBGOAL_THEN `LENGTH (ul:(real^3)list) = j + 1` ASSUME_TAC THENL + [ + UNDISCH_TAC `barV V j ul` THEN SIMP_TAC[BARV]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!vl. barV V j vl /\ truncate_simplex j vl = ul <=> vl = ul` (LABEL_TAC "j") THENL + [ + GEN_TAC THEN EQ_TAC THEN STRIP_TAC THENL + [ + UNDISCH_TAC `barV V j vl` THEN UNDISCH_TAC `barV V j ul` THEN + REWRITE_TAC[BARV] THEN REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`j:num`; `vl:(real^3)list`; `vl:(real^3)list`] TRUNCATE_SIMPLEX_INITIAL_SUBLIST) THEN + ASM_REWRITE_TAC[LE_REFL; INITIAL_SUBLIST_REFL; EQ_SYM_EQ]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[TRUNCATE_SIMPLEX_REFL]; + ALL_TAC + ] THEN + + + CONJ_TAC THENL + [ + ASM_REWRITE_TAC[SING_GSPEC_APP; UNIONS_1] THEN + ASM_SIMP_TAC[LT_IMP_LE] THEN + ASM_CASES_TAC `j = 0` THENL + [ + SUBGOAL_THEN `?x. ul = [x:real^3]` CHOOSE_TAC THENL + [ + EXISTS_TAC `HD ul:real^3` THEN + MATCH_MP_TAC LENGTH_1_LEMMA THEN + UNDISCH_TAC `LENGTH (ul:(real^3)list) = j + 1` THEN ASM_REWRITE_TAC[ARITH]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[ARITH_RULE `0 - 1 = 0`; ARITH_RULE `j <= 0 <=> j = 0`; ARITH_RULE `0 <= i /\ i = 0 <=> i = 0`] THEN + REWRITE_TAC[SING_GSPEC_APP; VORONOI_LIST; set_of_list; VORONOI_SET; INTERS_1; IN_SING; OMEGA_LIST_N; HD; SING_UNION_EQ_INSERT] THEN + SUBGOAL_THEN `x:real^3 INSERT voronoi_closed V x = voronoi_closed V x` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[GSYM ABSORPTION; CENTER_IN_VORONOI_CELL]; + ALL_TAC + ] THEN + + REWRITE_TAC[EQ_SYM_EQ; CONVEX_HULL_EQ; CONVEX_VORONOI_CLOSED]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[ARITH_RULE `~(j = 0) ==> (j <= i /\ i <= j - 1 <=> F)`] THEN + SUBGOAL_THEN `{omega_list_n V ul i | i | F} = {}` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[EXTENSION; IN_ELIM_THM; NOT_IN_EMPTY]; + ALL_TAC + ] THEN + + REWRITE_TAC[UNION_EMPTY; EQ_SYM_EQ; CONVEX_HULL_EQ; CONVEX_VORONOI_LIST]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THENL + [ + ASM_SIMP_TAC[ARITH_RULE `j <= k ==> j <= SUC k`]; + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[ARITH_RULE `SUC k - 1 = k`] THEN + ABBREV_TAC `f = \vl:(real^3)list. {omega_list_n V vl i | j <= i /\ i <= k} UNION voronoi_list V vl` THEN + SUBGOAL_THEN `!vl:(real^3)list. {omega_list_n V vl i | j <= i /\ i <= k} UNION voronoi_list V vl = f vl` (fun th -> REWRITE_TAC[th]) THENL + [ + EXPAND_TAC "f" THEN REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!P:(real^3)list->(real^3->bool). UNIONS {P vl | barV V (SUC k) vl /\ truncate_simplex j vl = ul} = UNIONS {UNIONS {P vl | vl | barV V (SUC k) vl /\ truncate_simplex k vl = wl} | wl | barV V k wl /\ truncate_simplex j wl = ul}` (fun th -> REWRITE_TAC[th]) THENL + [ + GEN_TAC THEN + REWRITE_TAC[EXTENSION; IN_UNIONS] THEN GEN_TAC THEN + REWRITE_TAC[GSYM EXTENSION; IN_ELIM_THM; IN_UNIONS] THEN + EQ_TAC THEN STRIP_TAC THENL + [ + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + EXISTS_TAC `UNIONS {(P vl'):(real^3->bool) | vl' | barV V (SUC k) vl' /\ truncate_simplex k vl' = truncate_simplex k vl}` THEN + CONJ_TAC THENL + [ + EXISTS_TAC `truncate_simplex k vl:(real^3)list` THEN + REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC TRUNCATE_SIMPLEX_BARV THEN + EXISTS_TAC `SUC k` THEN ASM_REWRITE_TAC[ARITH_RULE `k <= SUC k`]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`vl:(real^3)list`; `j:num`; `k:num`] TRUNCATE_TRUNCATE_SIMPLEX) THEN + UNDISCH_TAC `barV V (SUC k) vl` THEN SIMP_TAC[BARV] THEN DISCH_TAC THEN + ASM_SIMP_TAC[ARITH_RULE `k + 1 <= SUC k + 1`]; + ALL_TAC + ] THEN + + REWRITE_TAC[IN_UNIONS; IN_ELIM_THM] THEN + EXISTS_TAC `(P (vl:(real^3)list)):real^3->bool` THEN + ASM_REWRITE_TAC[] THEN + EXISTS_TAC `vl:(real^3)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[IN_UNIONS; IN_ELIM_THM] THEN + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + EXISTS_TAC `(P (vl:(real^3)list)):real^3->bool` THEN + ASM_REWRITE_TAC[] THEN + EXISTS_TAC `vl:(real^3)list` THEN + ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `truncate_simplex j wl = ul:(real^3)list` THEN + MP_TAC (ISPECL [`vl:(real^3)list`; `j:num`; `k:num`] TRUNCATE_TRUNCATE_SIMPLEX) THEN + UNDISCH_TAC `barV V (SUC k) vl` THEN SIMP_TAC[BARV] THEN DISCH_TAC THEN + ASM_SIMP_TAC[ARITH_RULE `k + 1 <= SUC k + 1`]; + ALL_TAC + ] THEN + + ABBREV_TAC `g = \vl:(real^3)list. convex hull (omega_list_n V vl k INSERT voronoi_list V vl)` THEN + + SUBGOAL_THEN `!vl:(real^3)list. convex hull (f vl):real^3->bool = convex hull ({omega_list_n V vl i | j <= i /\ i <= k - 1} UNION g vl)` (fun th -> REWRITE_TAC[th]) THENL + [ + GEN_TAC THEN + EXPAND_TAC "g" THEN + ONCE_REWRITE_TAC[GSYM CONV_UNION_lemma] THEN + ONCE_REWRITE_TAC[GSYM SING_UNION_EQ_INSERT] THEN + REWRITE_TAC[GSYM UNION_ASSOC] THEN + SUBGOAL_THEN `{omega_list_n V vl i | j <= i /\ i <= k - 1} UNION {omega_list_n V vl k} = {omega_list_n V vl i | j <= i /\ i <= k}` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[EXTENSION; IN_UNION; IN_ELIM_THM; IN_SING] THEN + GEN_TAC THEN EQ_TAC THENL + [ + STRIP_TAC THENL + [ + EXISTS_TAC `i:num` THEN + ASM_SIMP_TAC[ARITH_RULE `i <= k - 1 ==> i <= k`]; + ALL_TAC + ] THEN + EXISTS_TAC `k:num` THEN + ASM_REWRITE_TAC[LE_REFL]; + ALL_TAC + ] THEN + STRIP_TAC THEN + ASM_CASES_TAC `i = k:num` THENL + [ + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISJ1_TAC THEN + EXISTS_TAC `i:num` THEN + ASM_SIMP_TAC[ARITH_RULE `i <= k /\ ~(i = k) ==> i <= k - 1`]; + ALL_TAC + ] THEN + + EXPAND_TAC "f" THEN REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!wl. barV V k wl ==> UNIONS {g vl | vl | barV V (SUC k) vl /\ truncate_simplex k vl = wl} = voronoi_list V wl` (LABEL_TAC "wl") THENL + [ + REPEAT STRIP_TAC THEN + ABBREV_TAC `p = omega_list_n V wl k` THEN + SUBGOAL_THEN `UNIONS {g vl | barV V (SUC k) vl /\ truncate_simplex k vl = wl} = UNIONS {convex hull ((p:real^3) INSERT voronoi_list V vl) | vl | barV V (SUC k) vl /\ truncate_simplex k vl = wl}` (fun th -> REWRITE_TAC[th]) THENL + [ + AP_TERM_TAC THEN + EXPAND_TAC "g" THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN GEN_TAC THEN + REWRITE_TAC[GSYM EXTENSION] THEN + SUBGOAL_THEN `!vl. barV V (SUC k) vl /\ truncate_simplex k vl = wl ==> omega_list_n V vl k = p` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `vl:(real^3)list`; `k:num`; `0:num`] OMEGA_LIST_N_LEMMA) THEN + SUBGOAL_THEN `LENGTH (vl:(real^3)list) = k + 2 /\ LENGTH (wl:(real^3)list) = k + 1` ASSUME_TAC THENL + [ + UNDISCH_TAC `barV V k wl` THEN UNDISCH_TAC `barV V (SUC k) vl` THEN + SIMP_TAC[BARV; ARITH_RULE `k + 2 = SUC k + 1`]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[ARITH_RULE `k + 0 + 1 <= k + 2`] THEN + DISCH_THEN (fun th -> ASM_REWRITE_TAC[th; ADD_0]); + ALL_TAC + ] THEN + + EQ_TAC THENL + [ + STRIP_TAC THEN + EXISTS_TAC `vl:(real^3)list` THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + STRIP_TAC THEN + EXISTS_TAC `vl:(real^3)list` THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[ADD1] THEN + MATCH_MP_TAC (GSYM VORONOI_LIST_EQ_UNION_CONVEX_HULL_FACETS) THEN + ASM_SIMP_TAC[ARITH_RULE `SUC k <= 3 ==> k < 3`] THEN + EXPAND_TAC "p" THEN + SUBGOAL_THEN `voronoi_list V wl = voronoi_list V (truncate_simplex k wl):real^3->bool` (fun th -> ONCE_REWRITE_TAC[th]) THENL + [ + SUBGOAL_THEN `truncate_simplex k wl = wl:(real^3)list` (fun th -> REWRITE_TAC[th]) THEN + MATCH_MP_TAC TRUNCATE_SIMPLEX_REFL THEN + UNDISCH_TAC `barV V k wl` THEN SIMP_TAC[BARV]; + ALL_TAC + ] THEN + + MATCH_MP_TAC OMEGA_LIST_N_IN_VORONOI_LIST THEN + EXISTS_TAC `k:num` THEN ASM_REWRITE_TAC[LE_REFL]; + ALL_TAC + ] THEN + + + ASM_REWRITE_TAC[] THEN + AP_TERM_TAC THEN + + + SUBGOAL_THEN `!wl. barV V k wl ==> UNIONS {convex hull ({omega_list_n V vl i | j <= i /\ i <= k - 1} UNION g vl) | vl | barV V (SUC k) vl /\ truncate_simplex k vl = wl} = convex hull ({omega_list_n V wl i | j <= i /\ i <= k - 1} UNION voronoi_list V wl)` (LABEL_TAC "wl2") THENL + [ + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `LENGTH (wl:(real^3)list) = k + 1` ASSUME_TAC THENL + [ + UNDISCH_TAC `barV V k wl` THEN SIMP_TAC[BARV]; + ALL_TAC + ] THEN + + ABBREV_TAC `S = {omega_list_n V wl i | j <= i /\ i <= k - 1}` THEN + SUBGOAL_THEN `!vl. barV V (SUC k) vl /\ truncate_simplex k vl = wl ==> {omega_list_n V vl i | j <= i /\ i <= k - 1} = S` (LABEL_TAC "vl") THENL + [ + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `!i. j <= i /\ i <= k - 1 ==> omega_list_n V wl i = omega_list_n V vl i` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `LENGTH (vl:(real^3)list) = k + 2` ASSUME_TAC THENL + [ + UNDISCH_TAC `barV V (SUC k) vl` THEN SIMP_TAC[BARV; ARITH_RULE `k + 2 = SUC k + 1`]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`V:real^3->bool`; `vl:(real^3)list`; `i:num`; `k - i:num`] OMEGA_LIST_N_LEMMA) THEN + ASM_SIMP_TAC[ARITH_RULE `i <= k - 1 ==> i + k - i + 1 = k + 1 /\ i + k - i = k`; ARITH_RULE `k + 1 <= k + 2`]; + ALL_TAC + ] THEN + + EXPAND_TAC "S" THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN + GEN_TAC THEN EQ_TAC THEN STRIP_TAC THENL + [ + EXISTS_TAC `i:num` THEN ASM_SIMP_TAC[]; + EXISTS_TAC `i:num` THEN ASM_SIMP_TAC[] + ]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`{(g vl):real^3->bool | vl | barV V (SUC k) vl /\ truncate_simplex k vl = wl}`; `S:real^3->bool`] CONVEX_HULL_UNION_UNIONS) THEN + ANTS_TAC THENL + [ + ASM_SIMP_TAC[CONVEX_VORONOI_LIST] THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + MP_TAC (SPEC_ALL BARV_EXISTS) THEN + ASM_SIMP_TAC[ARITH_RULE `SUC k <= 3 ==> k < 3`] THEN + STRIP_TAC THEN + EXISTS_TAC `(g (vl:(real^3)list)):real^3->bool` THEN + REWRITE_TAC[IN_ELIM_THM] THEN + EXISTS_TAC `vl:(real^3)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + AP_TERM_TAC THEN + + REWRITE_TAC[EXTENSION] THEN GEN_TAC THEN + REWRITE_TAC[IN_ELIM_THM] THEN + EQ_TAC THENL + [ + STRIP_TAC THEN + EXISTS_TAC `(g (vl:(real^3)list)):real^3->bool` THEN + ASM_SIMP_TAC[] THEN + EXISTS_TAC `vl:(real^3)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + EXISTS_TAC `vl:(real^3)list` THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[EXTENSION] THEN GEN_TAC THEN + REWRITE_TAC[IN_ELIM_THM] THEN + EQ_TAC THENL + [ + STRIP_TAC THEN + EXISTS_TAC `vl:(real^3)list` THEN + ASM_SIMP_TAC[]; + STRIP_TAC THEN + EXISTS_TAC `wl:(real^3)list` THEN + ASM_SIMP_TAC[] + ]);; + + +(* GLTVHUM *) + +let GLTVHUM = prove(`!V (u0:real^3) p. packing V /\ saturated V /\ (u0 IN V) ==> + (p IN voronoi_closed V u0 <=> + (?vl. vl IN barV V 3 /\ p IN rogers V vl /\ (truncate_simplex 0 vl = [u0])))`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `[u0:real^3]`; `0`] GLTVHUM_lemma1) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[ARITH_RULE `0 < 3`] THEN + ASM_SIMP_TAC[BARV_0]; + ALL_TAC + ] THEN + + REWRITE_TAC[EXTENSION] THEN + DISCH_THEN (MP_TAC o SPEC `3`) THEN + REWRITE_TAC[IN_NUMSEG; LE_REFL; LE_0; IN_ELIM_THM] THEN + SUBGOAL_THEN `voronoi_list V [u0:real^3] = voronoi_closed V u0` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[VORONOI_LIST; set_of_list; VORONOI_SET; IN_SING; SING_GSPEC_APP; INTERS_1]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[IN_UNIONS; IN_ELIM_THM] THEN + + SUBGOAL_THEN `!vl. barV V 3 vl ==> convex hull ({omega_list_n V vl i | i <= 2} UNION voronoi_list V vl) = rogers V vl` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + REWRITE_TAC[ROGERS; IMAGE_LEMMA] THEN + AP_TERM_TAC THEN + SUBGOAL_THEN `LENGTH (vl:(real^3)list) = 4` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN SIMP_TAC[BARV; ARITH_RULE `3 + 1 = 4`]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `voronoi_list V vl = {omega_list_n V vl 3}` (fun th -> REWRITE_TAC[th]) THENL + [ + SUBGOAL_THEN `aff_dim (voronoi_list V vl:real^3->bool) = &0` MP_TAC THENL + [ + ONCE_REWRITE_TAC[INT_ARITH `&0 = int_of_num 3 - &3`] THEN + MATCH_MP_TAC AFF_DIM_VORONOI_LIST THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[AFF_DIM_EQ_0] THEN + STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `vl:(real^3)list`; `3`; `3`] OMEGA_LIST_N_IN_VORONOI_LIST) THEN + ASM_REWRITE_TAC[LE_REFL] THEN + SUBGOAL_THEN `truncate_simplex 3 vl = vl:(real^3)list` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC TRUNCATE_SIMPLEX_REFL THEN + ASM_REWRITE_TAC[] THEN ARITH_TAC; + ALL_TAC + ] THEN + ASM_SIMP_TAC[IN_SING]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[EXTENSION; IN_UNION] THEN GEN_TAC THEN + REWRITE_TAC[IN_SING; IN_ELIM_THM] THEN + EQ_TAC THENL + [ + STRIP_TAC THENL + [ + EXISTS_TAC `i:num` THEN + ASM_SIMP_TAC[ARITH_RULE `i <= 2 ==> i < 4`]; + ALL_TAC + ] THEN + EXISTS_TAC `3` THEN + ASM_REWRITE_TAC[ARITH_RULE `3 < 4`]; + ALL_TAC + ] THEN + STRIP_TAC THEN + ASM_CASES_TAC `x' = 3` THENL + [ + UNDISCH_TAC `x = omega_list_n V vl x'` THEN ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + DISJ1_TAC THEN + EXISTS_TAC `x':num` THEN + ASM_SIMP_TAC[ARITH_RULE `x' < 4 /\ ~(x' = 3) ==> x' <= 2`]; + ALL_TAC + ] THEN + + REWRITE_TAC[ARITH_RULE `3 - 1 = 2`] THEN + EQ_TAC THEN STRIP_TAC THENL + [ + POP_ASSUM MP_TAC THEN ASM_SIMP_TAC[] THEN DISCH_TAC THEN + EXISTS_TAC `vl:(real^3)list` THEN + ASM_REWRITE_TAC[IN]; + ALL_TAC + ] THEN + + UNDISCH_TAC `vl IN barV V 3` THEN DISCH_THEN (ASSUME_TAC o REWRITE_RULE[IN]) THEN + EXISTS_TAC `rogers V vl` THEN + ASM_REWRITE_TAC[] THEN + EXISTS_TAC `vl:(real^3)list` THEN + ASM_SIMP_TAC[]);; + +(***************************************************) + +(* DUUNHOR *) +(*************************) + +let VORONOI_CLOSED_EQ_LEMMA = prove(`!V u v. packing V /\ u IN V /\ v IN V /\ + voronoi_closed V u = voronoi_closed V v + ==> u = v`, + REWRITE_TAC[voronoi_closed; EXTENSION] THEN REPEAT STRIP_TAC THEN + FIRST_ASSUM (MP_TAC o SPEC `v : real^3`) THEN REWRITE_TAC[IN_ELIM_THM] THEN + REWRITE_TAC[DIST_REFL; DIST_POS_LE] THEN + DISCH_THEN (MP_TAC o SPEC `v : real^3`) THEN + UNDISCH_TAC `v : real^3 IN V` THEN REWRITE_TAC[IN] THEN DISCH_TAC THEN + ANTS_TAC THEN ASM_REWRITE_TAC[DIST_REFL; DIST_LE_0; EQ_SYM_EQ]);; + + +let ODIGPXU_lemma = prove(`!P f f' p0 p (q : real^N) t s. + polyhedron P /\ p0 IN P /\ ~(p0 IN f UNION f') /\ + f facet_of P /\ f' facet_of P /\ + p IN f /\ q IN f' /\ + &0 < t /\ &0 < s /\ + (&1 - t) % p0 + t % p = (&1 - s) % p0 + s % q ==> s <= t`, + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[VECTOR_SUB_RDISTRIB] THEN + REWRITE_TAC[VECTOR_ARITH `a - t % (p0 : real^N) + t % p = a - s % p0 + s % q <=> t % (p - p0) = s % (q - p0)`] THEN + MP_TAC (REAL_ARITH `s <= t \/ t < s`) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o AP_TERM `\x : real^N. inv t % x`) THEN REWRITE_TAC[VECTOR_MUL_ASSOC] THEN + ASM_SIMP_TAC[REAL_ARITH `&0 < t ==> ~(t = &0)`; REAL_MUL_LINV; VECTOR_MUL_LID] THEN + ABBREV_TAC `r = inv t * s` THEN + SUBGOAL_THEN `&1 < r` ASSUME_TAC THENL + [ + MP_TAC (SPECL [`&1`; `r : real`; `t : real`] REAL_LT_LMUL_EQ) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[REAL_MUL_ASSOC] THEN + ASM_SIMP_TAC[REAL_MUL_RID; REAL_ARITH `&0 < t ==> ~(t = &0)`; REAL_MUL_RINV; REAL_MUL_LID]; + ALL_TAC + ] THEN + + MP_TAC (SPECL[`P : real^N -> bool`; `f' : real^N -> bool`] FACET_OF_POLYHEDRON) THEN + ASM_REWRITE_TAC[] THEN + REPEAT (DISCH_THEN (CHOOSE_THEN MP_TAC)) THEN REWRITE_TAC[SUBSET] THEN + STRIP_TAC THEN + SUBGOAL_THEN `(a : real^N) dot p0 < b` ASSUME_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `x < y <=> x <= y /\ ~(x = y)`] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `p0 : real^N`) THEN + ASM_REWRITE_TAC[IN_ELIM_THM] THEN SIMP_TAC[] THEN DISCH_THEN (fun th -> ALL_TAC) THEN + UNDISCH_TAC `~(p0 : real^N IN f UNION f')` THEN + ASM_REWRITE_TAC[CONTRAPOS_THM; IN_UNION] THEN DISCH_TAC THEN + DISJ2_TAC THEN ASM_REWRITE_TAC[IN_INTER; IN_ELIM_THM]; + ALL_TAC + ] THEN + REWRITE_TAC[VECTOR_ARITH `p - p0 = x <=> p = p0 + x : real^N`] THEN DISCH_TAC THEN + MP_TAC (ISPECL[`f : real^N -> bool`; `P : real^N -> bool`] FACET_OF_IMP_SUBSET) THEN + ASM_REWRITE_TAC[SUBSET] THEN DISCH_THEN (MP_TAC o SPEC `p : real^N`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> FIRST_X_ASSUM (MP_TAC o (fun th2 -> MATCH_MP th2 th))) THEN + REWRITE_TAC[IN_ELIM_THM; DOT_RADD; DOT_RMUL; DOT_RSUB] THEN + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN REWRITE_TAC[EXTENSION] THEN + DISCH_THEN (MP_TAC o SPEC `q : real^N`) THEN ASM_REWRITE_TAC[IN_INTER; IN_ELIM_THM] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN DISCH_TAC THEN DISCH_THEN (fun th -> ALL_TAC) THEN + REWRITE_TAC[REAL_ARITH `x + r * (b - x) <= b <=> (r - &1) * b <= (r - &1) * x`] THEN + ASM_SIMP_TAC[REAL_ARITH `&1 < r ==> &0 < r - &1`; REAL_LE_LMUL_EQ] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC);; + + +(* ODIGPXU *) +let ODIGPXU = prove(`!P f f' p0 p (q : real^N) t s. + polyhedron P /\ p0 IN P /\ ~(p0 IN f UNION f') /\ + f facet_of P /\ f' facet_of P /\ + p IN f /\ q IN f' /\ + &0 < t /\ &0 < s /\ + (&1 - t) % p0 + t % p = (&1 - s) % p0 + s % q + ==> s = t`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[REAL_ARITH `s = t <=> s <= t /\ t <= s`] THEN + STRIP_TAC THEN MATCH_MP_TAC ODIGPXU_lemma THENL + [ + MAP_EVERY EXISTS_TAC [`P : real^N -> bool`; `f : real^N -> bool`; `f' : real^N -> bool`] THEN + MAP_EVERY EXISTS_TAC [`p0 : real^N`; `p : real^N`; `q : real^N`] THEN + ASM_REWRITE_TAC[]; + MAP_EVERY EXISTS_TAC [`P : real^N -> bool`; `f' : real^N -> bool`; `f : real^N -> bool`] THEN + MAP_EVERY EXISTS_TAC [`p0 : real^N`; `q : real^N`; `p : real^N`] THEN + ASM_REWRITE_TAC[UNION_COMM] + ]);; + + + +let OMEGA_LIST_N_EQ = prove(`!V ul i j. omega_list_n V ul i IN voronoi_list V (truncate_simplex (SUC i) ul) + ==> omega_list_n V ul (SUC i) = omega_list_n V ul i`, + REPEAT GEN_TAC THEN ABBREV_TAC `X = voronoi_list V (truncate_simplex (SUC i) ul)` THEN + ASM_REWRITE_TAC[OMEGA_LIST_N] THEN DISCH_TAC THEN + MP_TAC (ISPECL[`X:real^3 -> bool`; `omega_list_n V ul i`] CLOSEST_POINT_EXISTS) THEN + ANTS_TAC THENL + [ + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + EXPAND_TAC "X" THEN REWRITE_TAC[CLOSED_VORONOI_LIST] THEN + EXISTS_TAC `omega_list_n V ul i` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + STRIP_TAC THEN + POP_ASSUM (MP_TAC o SPEC `omega_list_n V ul i`) THEN + ASM_REWRITE_TAC[DIST_REFL; DIST_LE_0] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]));; + + +let OMEGA_LIST_N_IN_FACET = prove(`!V ul k i. packing V /\ saturated V /\ barV V k ul /\ i < k + ==> ?F. F facet_of voronoi_list V (truncate_simplex i ul) /\ + voronoi_list V (truncate_simplex (i + 1) ul) = F /\ + (!j. i < j /\ j <= k ==> omega_list_n V ul j IN F)`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `FF = voronoi_list V (truncate_simplex (i + 1) ul)` THEN + EXISTS_TAC `FF : real^3 -> bool` THEN REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + MP_TAC (SPECL[`V:real^3->bool`; `truncate_simplex i ul : (real^3)list`; `i:num`; `FF:real^3->bool`] IDBEZAL) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MP_TAC (SPEC_ALL BARV_IMP_K_LE_3) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (ARITH_RULE `i < k /\ k <= 3 ==> i < 3`) THEN ASM_SIMP_TAC[] THEN DISCH_TAC THEN + MATCH_MP_TAC TRUNCATE_SIMPLEX_BARV THEN + EXISTS_TAC `k:num` THEN ASM_SIMP_TAC[LT_IMP_LE]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + EXISTS_TAC `truncate_simplex (i + 1) ul : (real^3)list` THEN + ASM_REWRITE_TAC[] THEN CONJ_TAC THENL + [ + MATCH_MP_TAC TRUNCATE_SIMPLEX_BARV THEN + EXISTS_TAC `k:num` THEN ASM_SIMP_TAC[ARITH_RULE `i < k ==> i + 1 <= k`]; + MP_TAC (ISPECL[`ul:(real^3)list`; `i:num`; `i + 1`] TRUNCATE_TRUNCATE_SIMPLEX) THEN + DISCH_THEN MATCH_MP_TAC THEN + REWRITE_TAC[ARITH_RULE `i <= i + 1`] THEN + UNDISCH_TAC `barV V k ul` THEN REWRITE_TAC[BARV] THEN DISCH_TAC THEN + ASM_SIMP_TAC[ARITH_RULE `i < k ==> (i + 1) + 1 <= k + 1`] + ]; + ALL_TAC + ] THEN + REPEAT STRIP_TAC THEN + MP_TAC (SPECL[`V:real^3->bool`; `ul:(real^3)list`; `k:num`; `j:num`] OMEGA_LIST_N_IN_VORONOI_LIST) THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `voronoi_list V (truncate_simplex j ul) SUBSET FF` ASSUME_TAC THENL + [ + EXPAND_TAC "FF" THEN REWRITE_TAC[VORONOI_LIST; VORONOI_SET] THEN + REWRITE_TAC[SUBSET; IN_INTERS; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + EXISTS_TAC `v:real^3` THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM (fun th -> ALL_TAC) THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[IN_SET_OF_LIST; MEM_EXISTS_EL] THEN + + UNDISCH_TAC `barV V k ul` THEN REWRITE_TAC[BARV] THEN DISCH_TAC THEN + MP_TAC (ISPECL[`i + 1`; `ul:(real^3)list`] LENGTH_TRUNCATE_SIMPLEX) THEN + MP_TAC (ISPECL[`j:num`; `ul:(real^3)list`] LENGTH_TRUNCATE_SIMPLEX) THEN + ASM_REWRITE_TAC[ARITH_RULE `j + 1 <= k + 1 <=> j <= k`] THEN + ASM_SIMP_TAC[ARITH_RULE `i < k ==> i + 1 <= k`] THEN + REPLICATE_TAC 2 (DISCH_THEN (fun th -> REWRITE_TAC[th])) THEN + DISCH_THEN (X_CHOOSE_THEN `r:num` MP_TAC) THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN + + MP_TAC (ISPECL[`ul:(real^3)list`; `i + 1`; `r:num`] EL_TRUNCATE_SIMPLEX) THEN + ASM_SIMP_TAC[ARITH_RULE `i < k ==> (i + 1) + 1 <= k + 1`] THEN + ASM_SIMP_TAC[ARITH_RULE `r < (i + 1) + 1 ==> r <= i + 1`] THEN + REPEAT DISCH_TAC THEN + EXISTS_TAC `r:num` THEN + MP_TAC (ARITH_RULE `j <= k /\ i < j /\ r < (i + 1) + 1 ==> r < j + 1`) THEN + ASM_SIMP_TAC[] THEN DISCH_TAC THEN + MP_TAC (ISPECL[`ul:(real^3)list`; `j:num`; `r:num`] EL_TRUNCATE_SIMPLEX) THEN + ASM_REWRITE_TAC[ARITH_RULE `j + 1 <= k + 1 <=> j <= k`] THEN + ASM_SIMP_TAC[ARITH_RULE `r < j + 1 ==> r <= j`]; + ALL_TAC + ] THEN + DISCH_TAC THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `voronoi_list V (truncate_simplex j ul)` THEN + ASM_REWRITE_TAC[]);; + + +let OMEGA_LIST_N_IN_VORONOI_LIST_GEN = prove(`!V ul k i j. packing V /\ saturated V /\ barV V k ul /\ + i <= j /\ j <= k ==> + omega_list_n V ul j IN voronoi_list V (truncate_simplex i ul)`, + REPEAT STRIP_TAC THEN + UNDISCH_TAC `i <= j:num` THEN REWRITE_TAC[LE_LT] THEN STRIP_TAC THENL + [ + MP_TAC (SPEC_ALL OMEGA_LIST_N_IN_FACET) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC (ARITH_RULE `i < j /\ j <= k ==> i < k : num`) THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + STRIP_TAC THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `F':real^3->bool` THEN + CONJ_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC FACET_OF_IMP_SUBSET THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC OMEGA_LIST_N_IN_VORONOI_LIST THEN + EXISTS_TAC `k:num` THEN ASM_REWRITE_TAC[]);; + + +let VORONOI_SET_SUBSET = prove(`!V s t. s SUBSET t ==> voronoi_set V t SUBSET voronoi_set V s`, + REWRITE_TAC[VORONOI_SET] THEN SET_TAC[]);; + + + + +let TRUNCATE_SIMPLEX_SUBSET = prove(`!(ul:(A)list) i j. j <= i /\ i + 1 <= LENGTH ul ==> + set_of_list (truncate_simplex j ul) SUBSET set_of_list (truncate_simplex i ul)`, + REWRITE_TAC[SUBSET; IN_SET_OF_LIST; MEM_EXISTS_EL] THEN REPEAT STRIP_TAC THEN + EXISTS_TAC `i':num` THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + MP_TAC (SPECL[`i:num`; `ul:(A)list`] LENGTH_TRUNCATE_SIMPLEX) THEN + MP_TAC (SPECL[`j:num`; `ul:(A)list`] LENGTH_TRUNCATE_SIMPLEX) THEN + MP_TAC (ARITH_RULE `!x. j <= i /\ i + 1 <= x ==> j + 1 <= x`) THEN + MP_TAC (ARITH_RULE `i' < j + 1 /\ j <= i ==> i' < i + 1`) THEN + ASM_SIMP_TAC[] THEN REPEAT DISCH_TAC THEN + MP_TAC (SPECL[`ul:(A)list`; `i:num`; `i':num`] EL_TRUNCATE_SIMPLEX) THEN + ASM_SIMP_TAC[ARITH_RULE `i' < i + 1 ==> i' <= i`] THEN DISCH_TAC THEN + MP_TAC (SPECL[`ul:(A)list`; `j:num`; `i':num`] EL_TRUNCATE_SIMPLEX) THEN + ASM_SIMP_TAC[ARITH_RULE `i' < j + 1 ==> i' <= j`]);; + + +let OMEGA_LIST_N_EQ_GEN = prove(`!V ul k i j. packing V /\ saturated V /\ barV V k ul /\ + i < j /\ j <= k /\ omega_list_n V ul i IN voronoi_list V (truncate_simplex j ul) + ==> omega_list_n V ul (SUC i) = omega_list_n V ul i`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC OMEGA_LIST_N_EQ THEN + MATCH_MP_TAC IN_TRANS THEN EXISTS_TAC `voronoi_list V (truncate_simplex j ul)` THEN + ASM_REWRITE_TAC[VORONOI_LIST] THEN + MATCH_MP_TAC VORONOI_SET_SUBSET THEN + MATCH_MP_TAC TRUNCATE_SIMPLEX_SUBSET THEN + ASM_SIMP_TAC[ARITH_RULE `i < j ==> SUC i <= j`] THEN + UNDISCH_TAC `barV V k ul` THEN REWRITE_TAC[BARV] THEN + ASM_SIMP_TAC[ARITH_RULE `j <= k ==> j + 1 <= k + 1`]);; + + + +let CARD_LE_3 = prove(`!s. ~(s = {}) /\ FINITE s /\ CARD s <= 3 ==> ?x y z : A. s = {x, y, z}`, + REPEAT STRIP_TAC THEN + MP_TAC (ARITH_RULE `!n. n <= 3 ==> n = 0 \/ n = 1 \/ n = 2 \/ n = 3`) THEN + DISCH_THEN (MP_TAC o SPEC `CARD (s:A->bool)`) THEN ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN POP_ASSUM MP_TAC THEN UNDISCH_TAC `FINITE (s:A->bool)` THEN REWRITE_TAC[IMP_IMP; GSYM HAS_SIZE; num_CONV `3`; num_CONV `2`; num_CONV `1`; HAS_SIZE_CLAUSES] THENL + [ + DISCH_TAC THEN UNDISCH_TAC `~((s:A->bool) = {})` THEN ASM_REWRITE_TAC[]; + STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_SIMP_TAC[] THEN DISCH_TAC THEN + REPLICATE_TAC 3 (EXISTS_TAC `a:A`) THEN SET_TAC[]; + REPEAT (DISCH_THEN (CHOOSE_THEN MP_TAC)) THEN + DISCH_THEN (CONJUNCTS_THEN2 MP_TAC (LABEL_TAC "A")) THEN + STRIP_TAC THEN REMOVE_THEN "A" MP_TAC THEN ASM_SIMP_TAC[] THEN DISCH_TAC THEN + EXISTS_TAC `a:A` THEN EXISTS_TAC `a':A` THEN EXISTS_TAC `a':A` THEN SET_TAC[]; + REPEAT (DISCH_THEN (CHOOSE_THEN MP_TAC)) THEN + DISCH_THEN (CONJUNCTS_THEN2 MP_TAC (LABEL_TAC "A")) THEN + REPEAT (DISCH_THEN (CHOOSE_THEN MP_TAC)) THEN + DISCH_THEN (CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN + STRIP_TAC THEN REMOVE_THEN "A" MP_TAC THEN ASM_SIMP_TAC[] THEN DISCH_TAC THEN + EXISTS_TAC `a:A` THEN EXISTS_TAC `a':A` THEN EXISTS_TAC `a'':A` THEN REWRITE_TAC[] + ]);; + + +let AFF_DIM_LE_2_IMP_COPLANAR = prove(`!s : real^N -> bool. aff_dim s <= &2 ==> coplanar s`, + REPEAT STRIP_TAC THEN REWRITE_TAC[coplanar] THEN + MP_TAC (ISPEC `s:real^N->bool` AFF_DIM) THEN + STRIP_TAC THEN + SUBGOAL_THEN `CARD (b:real^N -> bool) <= 3` ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM INT_OF_NUM_LE] THEN + REWRITE_TAC[INT_ARITH `a <= int_of_num 3 <=> a - &1 <= &2`] THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + ASM_CASES_TAC `(b:real^N -> bool) = {}` THENL + [ + REPLICATE_TAC 3 (EXISTS_TAC `vec 0 : real^N`) THEN + MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `affine hull b : real^N -> bool` THEN + CONJ_TAC THENL [ ASM_REWRITE_TAC[HULL_SUBSET]; ALL_TAC ] THEN + POP_ASSUM (fun th -> REWRITE_TAC[th; AFFINE_HULL_EMPTY; EMPTY_SUBSET]); + ALL_TAC + ] THEN + MP_TAC (ISPEC `b:real^N->bool` CARD_LE_3) THEN + ASM_SIMP_TAC[AFFINE_INDEPENDENT_IMP_FINITE] THEN + STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`x:real^N`; `y:real^N`; `z:real^N`] THEN + MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `affine hull b : real^N -> bool` THEN + CONJ_TAC THENL [ ASM_REWRITE_TAC[HULL_SUBSET]; ALL_TAC ] THEN + POP_ASSUM (fun th -> REWRITE_TAC[th; SUBSET_REFL]));; + + +let SET_OF_LIST_TRUNCATE_SIMPLEX_SUBSET = prove(`!(ul:(A)list) k. k + 1 <= LENGTH ul ==> set_of_list (truncate_simplex k ul) SUBSET set_of_list ul`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC SET_OF_LIST_INITIAL_SUBLIST_SUBSET THEN + MP_TAC (SPECL [`k:num`; `truncate_simplex k (ul:(A)list)`; `ul:(A)list`] TRUNCATE_SIMPLEX_INITIAL_SUBLIST) THEN + ASM_REWRITE_TAC[] THEN SIMP_TAC[]);; + + + +let ROGERS_AFF_DIM_FULL = prove(`!V ul. barV V 3 ul /\ aff_dim (rogers V ul) = &3 + ==> !i j. i < 4 /\ j < 4 /\ ~(i = j) ==> ~(omega_list_n V ul i = omega_list_n V ul j)`, + REWRITE_TAC[ROGERS; AFF_DIM_CONVEX_HULL; BARV; ARITH] THEN REPEAT GEN_TAC THEN + REWRITE_TAC[GSYM IMP_IMP] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_THEN (fun th -> ALL_TAC) THEN REPEAT STRIP_TAC THEN + ABBREV_TAC `S = IMAGE (omega_list_n V ul) {j | j < 4}` THEN + ABBREV_TAC `a = omega_list_n V ul i` THEN + ABBREV_TAC `b = omega_list_n V ul j` THEN + SUBGOAL_THEN `S DELETE a DELETE b SUBSET IMAGE (omega_list_n V ul) {k | k < 4 /\ ~(k = i) /\ ~(k = j)}` MP_TAC THENL + [ + REPLICATE_TAC 3 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + REWRITE_TAC[SUBSET; IN_DELETE; IN_IMAGE; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + POP_ASSUM (fun th -> ALL_TAC) THEN POP_ASSUM MP_TAC THEN ASM_SIMP_TAC[CONTRAPOS_THM]; + POP_ASSUM MP_TAC THEN ASM_SIMP_TAC[CONTRAPOS_THM] + ]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `FINITE (S:real^3->bool)` ASSUME_TAC THENL + [ + EXPAND_TAC "S" THEN + MATCH_MP_TAC FINITE_IMAGE THEN REWRITE_TAC[FINITE_NUMSEG_LT]; + ALL_TAC + ] THEN + + DISCH_TAC THEN + SUBGOAL_THEN `CARD (S DELETE a DELETE (b:real^3)) <= 2` MP_TAC THENL + [ + MATCH_MP_TAC LE_TRANS THEN + EXISTS_TAC `CARD (IMAGE (omega_list_n V ul) {k | k < 4 /\ ~(k = i) /\ ~(k = j)})` THEN + SUBGOAL_THEN `{k | k < 4 /\ ~(k = i) /\ ~(k = j)} HAS_SIZE 2` MP_TAC THENL + [ + SUBGOAL_THEN `{k | k < 4 /\ ~(k = i) /\ ~(k = j)} = {k | k < 4} DELETE i DELETE j` ASSUME_TAC THENL + [ + REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_DELETE; CONJ_ACI]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[HAS_SIZE; FINITE_DELETE; FINITE_NUMSEG_LT] THEN + MP_TAC (ISPECL[`j:num`; `{k | k < 4} DELETE i`] CARD_DELETE) THEN + ASM_REWRITE_TAC[FINITE_DELETE; FINITE_NUMSEG_LT; IN_DELETE; IN_ELIM_THM] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MP_TAC (ISPECL[`i:num`; `{k | k < 4}`] CARD_DELETE) THEN + ASM_REWRITE_TAC[FINITE_NUMSEG_LT; IN_ELIM_THM] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[CARD_NUMSEG_LT] THEN ARITH_TAC; + ALL_TAC + ] THEN + + REWRITE_TAC[HAS_SIZE] THEN STRIP_TAC THEN + + CONJ_TAC THENL + [ + MATCH_MP_TAC CARD_SUBSET THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC FINITE_IMAGE THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC CARD_IMAGE_LE THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL[`S:real^3->bool`; `a:real^3`] FINITE_DELETE) THEN ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN ASM_SIMP_TAC[CARD_DELETE; IN_DELETE] THEN + SUBGOAL_THEN `b:real^3 IN S` ASSUME_TAC THENL + [ + EXPAND_TAC "S" THEN EXPAND_TAC "b" THEN + REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN EXISTS_TAC `j:num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL[`S:real^3->bool`; `b:real^3`] Hypermap.CARD_ATLEAST_1) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_SIMP_TAC[GSYM INT_OF_NUM_LE; GSYM INT_OF_NUM_SUB] THEN + MP_TAC (ISPEC `S:real^3->bool` AFF_DIM_LE_CARD) THEN ASM_REWRITE_TAC[] THEN + INT_ARITH_TAC);; + + +let VORONOI_LIST_AFF_DIM = prove(`!V ul k i. barV V k ul /\ i <= k + ==> aff_dim (voronoi_list V (truncate_simplex i ul)) = &3 - &i`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `barV V i (truncate_simplex i ul)` MP_TAC THENL + [ + MATCH_MP_TAC TRUNCATE_SIMPLEX_BARV THEN + EXISTS_TAC `k:num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[BARV; VORONOI_NONDG] THEN STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `truncate_simplex i ul : (real^3)list`) THEN + ASM_REWRITE_TAC[INITIAL_SUBLIST_REFL; ARITH_RULE `0 < i + 1`] THEN + REWRITE_TAC[GSYM INT_OF_NUM_ADD] THEN + INT_ARITH_TAC);; + + +let AFF_DIM_FINITE_UNION_LE = prove(`!s (t:real^N->bool). FINITE s ==> + aff_dim (s UNION t) <= &(CARD s) + aff_dim t`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `n = CARD (s:real^N->bool)` THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + SPEC_TAC (`s:real^N->bool`, `s:real^N->bool`) THEN + SPEC_TAC (`n:num`, `n:num`) THEN + INDUCT_TAC THEN REPEAT STRIP_TAC THENL + [ + MP_TAC (ISPEC `s:real^N->bool` CARD_EQ_0) THEN + ASM_SIMP_TAC[UNION_EMPTY; INT_ADD_LID; INT_LE_REFL]; + ALL_TAC + ] THEN + SUBGOAL_THEN `s:real^N->bool HAS_SIZE (SUC n)` MP_TAC THENL + [ + ASM_REWRITE_TAC[HAS_SIZE]; + ALL_TAC + ] THEN + REWRITE_TAC[HAS_SIZE_CLAUSES; HAS_SIZE] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[INSERT_UNION_EQ; AFF_DIM_INSERT] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `t':real^N->bool`) THEN + ASM_REWRITE_TAC[ARITH_RULE `SUC n = n + 1`; GSYM INT_OF_NUM_ADD] THEN + INT_ARITH_TAC);; + +(* DUUNHOR *) +let DUUNHOR = prove(`!V ul vl. packing V /\ saturated V /\ + ul IN barV V 3 /\ vl IN barV V 3 /\ + ~(rogers V ul = rogers V vl) ==> + coplanar (rogers V ul INTER rogers V vl)`, + REWRITE_TAC[IN] THEN REPEAT STRIP_TAC THEN + SUBGOAL_THEN `LENGTH (ul : (real^3)list) = 4 /\ LENGTH (vl : (real^3)list) = 4` ASSUME_TAC THENL + [ + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN SIMP_TAC[BARV; ARITH]; + ALL_TAC + ] THEN + + ASM_CASES_TAC `~(aff_dim (rogers V ul) = &3)` THENL + [ + MATCH_MP_TAC COPLANAR_SUBSET THEN + EXISTS_TAC `rogers V ul` THEN REWRITE_TAC[INTER_SUBSET] THEN + MATCH_MP_TAC AFF_DIM_LE_2_IMP_COPLANAR THEN + MP_TAC (ISPEC `rogers V ul` AFF_DIM_LE_UNIV) THEN REWRITE_TAC[DIMINDEX_3] THEN + POP_ASSUM MP_TAC THEN INT_ARITH_TAC; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[NOT_CLAUSES] THEN + + ASM_CASES_TAC `~(aff_dim (rogers V vl) = &3)` THENL + [ + DISCH_THEN (fun th -> ALL_TAC) THEN MATCH_MP_TAC COPLANAR_SUBSET THEN + EXISTS_TAC `rogers V vl` THEN REWRITE_TAC[INTER_SUBSET] THEN + MATCH_MP_TAC AFF_DIM_LE_2_IMP_COPLANAR THEN + MP_TAC (ISPEC `rogers V vl` AFF_DIM_LE_UNIV) THEN REWRITE_TAC[DIMINDEX_3] THEN + POP_ASSUM MP_TAC THEN INT_ARITH_TAC; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[NOT_CLAUSES] THEN + + SUBGOAL_THEN `?k. k <= 3 /\ (!i. i < k ==> omega_list_n V ul i = omega_list_n V vl i /\ + voronoi_list V (truncate_simplex i ul) = voronoi_list V (truncate_simplex i vl)) /\ + ~(voronoi_list V (truncate_simplex k ul) = voronoi_list V (truncate_simplex k vl))` MP_TAC THENL + [ + ONCE_REWRITE_TAC[GSYM NOT_CLAUSES] THEN UNDISCH_TAC `~(rogers V ul = rogers V vl)` THEN + REWRITE_TAC[CONTRAPOS_THM; NOT_EXISTS_THM; DE_MORGAN_THM; NOT_FORALL_THM; NOT_IMP] THEN + REWRITE_TAC[ROGERS] THEN DISCH_TAC THEN + AP_TERM_TAC THEN + SUBGOAL_THEN `!i. i < 4 ==> omega_list_n V ul i = omega_list_n V vl i /\ voronoi_list V (truncate_simplex i ul) = voronoi_list V (truncate_simplex i vl)` ASSUME_TAC THENL + [ + MATCH_MP_TAC num_WF THEN INDUCT_TAC THEN ASM_REWRITE_TAC[OMEGA_LIST_N] THENL + [ + REPLICATE_TAC 2 (DISCH_THEN (fun th -> ALL_TAC)) THEN + POP_ASSUM (MP_TAC o SPEC `0`) THEN + REWRITE_TAC[ARITH_RULE `~(0 <= 3) <=> F`; ARITH_RULE `i < 0 <=> F`; ARITH_RULE `0 < 4`] THEN + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN + DISCH_THEN (LABEL_TAC "A") THEN DISCH_THEN (LABEL_TAC "B") THEN DISCH_TAC THEN + USE_THEN "A" (MP_TAC o MATCH_MP BARV_SUBSET) THEN + USE_THEN "B" (MP_TAC o MATCH_MP BARV_SUBSET) THEN + REWRITE_TAC[SUBSET] THEN + USE_THEN "A" (MP_TAC o MATCH_MP BARV_IMP_HD_IN_SET_OF_LIST) THEN DISCH_TAC THEN + USE_THEN "B" (MP_TAC o MATCH_MP BARV_IMP_HD_IN_SET_OF_LIST) THEN DISCH_TAC THEN + DISCH_THEN (MP_TAC o SPEC `HD vl : real^3`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + DISCH_THEN (MP_TAC o SPEC `HD ul : real^3`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (ISPEC `ul:(real^3)list` TRUNCATE_0_EQ_HEAD) THEN + MP_TAC (ISPEC `vl:(real^3)list` TRUNCATE_0_EQ_HEAD) THEN + ASM_REWRITE_TAC[ARITH] THEN + REPLICATE_TAC 2 (DISCH_THEN (fun th -> REWRITE_TAC[th])) THEN + REWRITE_TAC[VORONOI_LIST_SING] THEN DISCH_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC VORONOI_CLOSED_EQ_LEMMA THEN + EXISTS_TAC `V : real^3 -> bool` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + POP_ASSUM (fun th -> ALL_TAC) THEN + DISCH_THEN (LABEL_TAC "A") THEN DISCH_TAC THEN + REMOVE_THEN "A" MP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `SUC i`) THEN + ASM_SIMP_TAC[ARITH_RULE `SUC i < 4 ==> SUC i <= 3`] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + DISCH_THEN (MP_TAC o SPEC `i':num`) THEN + MP_TAC (ARITH_RULE `SUC i < 4 /\ i' < SUC i ==> i' < 4`) THEN + ASM_SIMP_TAC[]; + DISCH_THEN (MP_TAC o SPEC `i':num`) THEN + MP_TAC (ARITH_RULE `SUC i < 4 /\ i' < SUC i ==> i' < 4`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + DISCH_THEN (MP_TAC o SPEC `i:num`) THEN + ASM_SIMP_TAC[ARITH_RULE `i < SUC i`; ARITH_RULE `SUC i < 4 ==> i < 4`]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[EXTENSION] THEN GEN_TAC THEN + REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN EQ_TAC THENL + [ + DISCH_THEN (CHOOSE_THEN ASSUME_TAC) THEN + EXISTS_TAC `x' : num` THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x':num`) THEN ASM_SIMP_TAC[]; + DISCH_THEN (CHOOSE_THEN ASSUME_TAC) THEN + EXISTS_TAC `x' : num` THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x':num`) THEN ASM_SIMP_TAC[]; + ]; + ALL_TAC + ] THEN + + DISCH_THEN (CHOOSE_THEN STRIP_ASSUME_TAC) THEN + DISCH_TAC THEN DISCH_TAC THEN + ABBREV_TAC `X = voronoi_list V (truncate_simplex k ul) INTER voronoi_list V (truncate_simplex k vl)` THEN + ABBREV_TAC `Y = IMAGE (omega_list_n V ul) {j | j < k}` THEN + SUBGOAL_THEN `rogers V ul INTER rogers V vl SUBSET convex hull (Y UNION X)` MP_TAC THENL + [ + REWRITE_TAC[SUBSET; IN_INTER] THEN X_GEN_TAC `w:real^3` THEN + ABBREV_TAC `YX = convex hull (Y UNION X) : real^3->bool` THEN + ASM_REWRITE_TAC[ROGERS; CONVEX_HULL_FINITE] THEN + ABBREV_TAC `L1 = IMAGE (omega_list_n V ul) {j | j < 4}` THEN + ABBREV_TAC `L2 = IMAGE (omega_list_n V vl) {j | j < 4}` THEN + REWRITE_TAC[GSYM IMP_IMP; IN_ELIM_THM] THEN + DISCH_THEN (X_CHOOSE_THEN `ss : real^3 -> real` STRIP_ASSUME_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `tt : real^3 -> real` STRIP_ASSUME_TAC) THEN + + SUBGOAL_THEN `FINITE (L1:real^3->bool) /\ FINITE (L2:real^3->bool)` ASSUME_TAC THENL + [ + CONJ_TAC THEN EXPAND_TAC "L1" THEN EXPAND_TAC "L2" THEN MATCH_MP_TAC FINITE_IMAGE THEN REWRITE_TAC[FINITE_NUMSEG_LT]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `Y SUBSET (L1 : real^3->bool) /\ Y SUBSET (L2 : real^3->bool)` ASSUME_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["L1"; "Y"; "L2"] THEN REWRITE_TAC[SUBSET; IN_IMAGE; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN EXISTS_TAC `x':num` THEN MP_TAC (ARITH_RULE `x' < k /\ k <= 3 ==> x' < 4`) THEN ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + ASM_CASES_TAC `?i. i < k /\ (sum (IMAGE (omega_list_n V ul) {j | j <= i}) ss = &1 \/ sum (IMAGE (omega_list_n V vl) {j | j <= i}) tt = &1)` THENL + [ + EXPAND_TAC "YX" THEN + MATCH_MP_TAC IN_TRANS THEN EXISTS_TAC `convex hull Y UNION convex hull X : real^3->bool` THEN + REWRITE_TAC[HULL_UNION_SUBSET; IN_UNION] THEN DISJ1_TAC THEN + REWRITE_TAC[CONVEX_HULL_FINITE; IN_ELIM_THM] THEN + POP_ASSUM MP_TAC THEN STRIP_TAC THENL + [ + ABBREV_TAC `Li = IMAGE (omega_list_n V ul) {j | j <= i}` THEN + EXISTS_TAC `ss : real^3->real` THEN + MP_TAC (ISPECL[`ss:real^3->real`; `Li:real^3->bool`; `L1 DIFF Li:real^3->bool`; `L1:real^3->bool`] (GEN_ALL SUM_UNION_EQ)) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN CONJ_TAC THENL + [ + REWRITE_TAC[EXTENSION; IN_INTER; IN_DIFF] THEN REPEAT STRIP_TAC THEN SET_TAC[]; + EXPAND_TAC "L1" THEN EXPAND_TAC "Li" THEN + REWRITE_TAC[EXTENSION; IN_DIFF; IN_UNION; IN_IMAGE; IN_ELIM_THM] THEN GEN_TAC THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + EXISTS_TAC `x':num` THEN + MP_TAC (ARITH_RULE `x' <= i /\ i < k /\ k <= 3 ==> x' < 4`) THEN + ASM_SIMP_TAC[]; + EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[]; + REWRITE_TAC[TAUT `A \/ B /\ ~A <=> A \/ B`] THEN DISJ2_TAC THEN + EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[] + ]; + ]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[REAL_ARITH `&1 + a = &1 <=> a = &0`] THEN + DISCH_TAC THEN + MP_TAC (ISPECL[`ss:real^3->real`; `L1 DIFF Li:real^3->bool`] SUM_POS_EQ_0) THEN + ANTS_TAC THENL + [ + REPEAT CONJ_TAC THENL + [ + MATCH_MP_TAC FINITE_DIFF THEN ASM_REWRITE_TAC[]; + REWRITE_TAC[IN_DIFF] THEN + REPEAT STRIP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_TAC THEN + REPEAT CONJ_TAC THENL + [ + EXPAND_TAC "Y" THEN REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + EXPAND_TAC "L1" THEN ASM_REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN + EXISTS_TAC `x':num` THEN MP_TAC (ARITH_RULE `x' < k /\ k <= 3 ==> x' < 4`) THEN + ASM_SIMP_TAC[]; + UNDISCH_TAC `sum Li (ss:real^3->real) = &1` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC SUM_SUPERSET THEN + CONJ_TAC THENL + [ + EXPAND_TAC "Li" THEN EXPAND_TAC "Y" THEN + REWRITE_TAC[SUBSET; IN_IMAGE; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + EXISTS_TAC `x':num` THEN MP_TAC (ARITH_RULE `x' <= i /\ i < k ==> x' < k:num`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + EXPAND_TAC "Y" THEN REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[IN_DIFF] THEN EXPAND_TAC "L1" THEN + REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN + EXISTS_TAC `x':num` THEN MP_TAC (ARITH_RULE `x' < k /\ k <= 3 ==> x' < 4`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + UNDISCH_TAC `vsum L1 (\x:real^3. ss x % x) = w` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC EQ_SYM THEN + MATCH_MP_TAC VSUM_SUPERSET THEN + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "Y" THEN REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + REWRITE_TAC[VECTOR_MUL_EQ_0] THEN DISJ1_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[IN_DIFF; CONTRAPOS_THM] THEN + EXPAND_TAC "Li" THEN REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + EXISTS_TAC `x':num` THEN MP_TAC (ARITH_RULE `x' <= i /\ i < k ==> x' < k : num`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + (* The second case *) + ABBREV_TAC `Li = IMAGE (omega_list_n V vl) {j | j <= i}` THEN + EXISTS_TAC `tt : real^3->real` THEN + MP_TAC (ISPECL[`tt:real^3->real`; `Li:real^3->bool`; `L2 DIFF Li:real^3->bool`; `L2:real^3->bool`] (GEN_ALL SUM_UNION_EQ)) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN CONJ_TAC THENL + [ + REWRITE_TAC[EXTENSION; IN_INTER; IN_DIFF] THEN REPEAT STRIP_TAC THEN SET_TAC[]; + EXPAND_TAC "L2" THEN EXPAND_TAC "Li" THEN + REWRITE_TAC[EXTENSION; IN_DIFF; IN_UNION; IN_IMAGE; IN_ELIM_THM] THEN GEN_TAC THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + EXISTS_TAC `x':num` THEN + MP_TAC (ARITH_RULE `x' <= i /\ i < k /\ k <= 3 ==> x' < 4`) THEN + ASM_SIMP_TAC[]; + EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[]; + REWRITE_TAC[TAUT `A \/ B /\ ~A <=> A \/ B`] THEN DISJ2_TAC THEN + EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[] + ]; + ]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[REAL_ARITH `&1 + a = &1 <=> a = &0`] THEN + DISCH_TAC THEN + MP_TAC (ISPECL[`tt:real^3->real`; `L2 DIFF Li:real^3->bool`] SUM_POS_EQ_0) THEN + ANTS_TAC THENL + [ + REPEAT CONJ_TAC THENL + [ + MATCH_MP_TAC FINITE_DIFF THEN ASM_REWRITE_TAC[]; + REWRITE_TAC[IN_DIFF] THEN + REPEAT STRIP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_TAC THEN + SUBGOAL_THEN `Li SUBSET (Y : real^3->bool)` ASSUME_TAC THENL + [ + EXPAND_TAC "Li" THEN EXPAND_TAC "Y" THEN + REWRITE_TAC[SUBSET; IN_IMAGE; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + EXISTS_TAC `x':num` THEN MP_TAC (ARITH_RULE `x' <= i /\ i < k ==> x' < k:num`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + REPEAT CONJ_TAC THENL + [ + REPEAT STRIP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC IN_TRANS THEN EXISTS_TAC `Y:real^3->bool` THEN ASM_REWRITE_TAC[]; + UNDISCH_TAC `sum Li (tt:real^3->real) = &1` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC SUM_SUPERSET THEN ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[IN_DIFF] THEN + MATCH_MP_TAC IN_TRANS THEN EXISTS_TAC `Y:real^3->bool` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + UNDISCH_TAC `vsum L2(\x:real^3. tt x % x) = w` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC EQ_SYM THEN + MATCH_MP_TAC VSUM_SUPERSET THEN + + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + REWRITE_TAC[VECTOR_MUL_EQ_0] THEN DISJ1_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[IN_DIFF; CONTRAPOS_THM] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN SIMP_TAC[SUBSET]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN REWRITE_TAC[NOT_EXISTS_THM; DE_MORGAN_THM] THEN + DISCH_THEN (LABEL_TAC "not1") THEN + + (* ss i = tt i for i < k *) + SUBGOAL_THEN `!i. i < k ==> ss (omega_list_n V ul i) : real = tt (omega_list_n V vl i : real^3)` MP_TAC THENL + [ + MATCH_MP_TAC num_WF THEN REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[] THEN + REMOVE_THEN "not1" (MP_TAC o SPEC `i:num`) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + ABBREV_TAC `a = sum (IMAGE (omega_list_n V ul) {j | j <= i}) ss` THEN + ABBREV_TAC `b = sum (IMAGE (omega_list_n V vl) {j | j <= i}) tt` THEN + ABBREV_TAC `Lu = IMAGE (omega_list_n V ul) {j | i < j /\ j < 4}` THEN + ABBREV_TAC `Lv = IMAGE (omega_list_n V vl) {j | i < j /\ j < 4}` THEN + + (* sum Lu ss = 1 - a *) + SUBGOAL_THEN `sum Lu (ss:real^3->real) = &1 - a` ASSUME_TAC THENL + [ + UNDISCH_TAC `sum (L1:real^3->bool) ss = &1` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[REAL_ARITH `a = b - c <=> a + c = b : real`] THEN + EXPAND_TAC "a" THEN + MATCH_MP_TAC SUM_UNION_EQ THEN ASM_REWRITE_TAC[] THEN + EXPAND_TAC "Lu" THEN REWRITE_TAC[EXTENSION; IN_INTER; IN_UNION; IN_IMAGE; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THENL + [ + REWRITE_TAC[NOT_IN_EMPTY] THEN STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`] ROGERS_AFF_DIM_FULL) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPECL [`x':num`; `x'':num`]) THEN + ANTS_TAC THENL + [ + MP_TAC (ARITH_RULE `x'' <= i /\ i < k /\ k <= 3 ==> x'' < 4`) THEN + MP_TAC (ARITH_RULE `x'' <= i /\ i < x' ==> ~(x' = x'':num)`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + EXPAND_TAC "L1" THEN REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN EQ_TAC THEN STRIP_TAC THENL + [ + EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[]; + EXISTS_TAC `x':num` THEN MP_TAC (ARITH_RULE `x' <= i /\ i < k /\ k <= 3 ==> x' < 4`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + ASM_CASES_TAC `x' <= i : num` THENL + [ + DISJ2_TAC THEN EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + DISJ1_TAC THEN + EXISTS_TAC `x':num` THEN POP_ASSUM MP_TAC THEN ASM_SIMP_TAC[NOT_LE]; + ALL_TAC + ] THEN + + (* sum Lv tt = 1 - b *) + SUBGOAL_THEN `sum Lv (tt:real^3->real) = &1 - b` ASSUME_TAC THENL + [ + UNDISCH_TAC `sum (L2:real^3->bool) tt = &1` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[REAL_ARITH `a = b - c <=> a + c = b : real`] THEN + EXPAND_TAC "b" THEN + MATCH_MP_TAC SUM_UNION_EQ THEN ASM_REWRITE_TAC[] THEN + EXPAND_TAC "Lv" THEN REWRITE_TAC[EXTENSION; IN_INTER; IN_UNION; IN_IMAGE; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THENL + [ + REWRITE_TAC[NOT_IN_EMPTY] THEN STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `vl:(real^3)list`] ROGERS_AFF_DIM_FULL) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPECL [`x':num`; `x'':num`]) THEN + ANTS_TAC THENL + [ + MP_TAC (ARITH_RULE `x'' <= i /\ i < k /\ k <= 3 ==> x'' < 4`) THEN + MP_TAC (ARITH_RULE `x'' <= i /\ i < x' ==> ~(x' = x'':num)`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + EXPAND_TAC "L2" THEN REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN EQ_TAC THEN STRIP_TAC THENL + [ + EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[]; + EXISTS_TAC `x':num` THEN MP_TAC (ARITH_RULE `x' <= i /\ i < k /\ k <= 3 ==> x' < 4`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + ASM_CASES_TAC `x' <= i : num` THENL + [ + DISJ2_TAC THEN EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + DISJ1_TAC THEN + EXISTS_TAC `x':num` THEN POP_ASSUM MP_TAC THEN ASM_SIMP_TAC[NOT_LE]; + ALL_TAC + ] THEN + + (* a < 1 /\ b < 1 *) + SUBGOAL_THEN `&0 < &1 - a /\ &0 < &1 - b` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[REAL_ARITH `&0 < &1 - a <=> a <= &1 /\ ~(a = &1)`] THEN + REPLICATE_TAC 6 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + CONJ_TAC THENL + [ + UNDISCH_TAC `sum (L1:real^3->bool) ss = &1` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC SUM_SUBSET_SIMPLE THEN ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + EXPAND_TAC "L1" THEN REWRITE_TAC[SUBSET; IN_IMAGE; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + EXISTS_TAC `x':num` THEN MP_TAC (ARITH_RULE `x' <= i /\ i < k /\ k <= 3 ==> x' < 4`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[IN_DIFF] THEN REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + UNDISCH_TAC `sum (L2:real^3->bool) tt = &1` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC SUM_SUBSET_SIMPLE THEN ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + EXPAND_TAC "L2" THEN REWRITE_TAC[SUBSET; IN_IMAGE; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + EXISTS_TAC `x':num` THEN MP_TAC (ARITH_RULE `x' <= i /\ i < k /\ k <= 3 ==> x' < 4`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[IN_DIFF] THEN REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + (* Abbreviations *) + ABBREV_TAC `p0 = omega_list_n V vl i` THEN + ABBREV_TAC `p = inv (&1 - a) % vsum Lu (\x : real^3. ss x % x)` THEN + ABBREV_TAC `p' = inv (&1 - b) % vsum Lv (\x : real^3. tt x % x)` THEN + + ABBREV_TAC `Lu_le = IMAGE (omega_list_n V ul) {j | j <= i}` THEN + ABBREV_TAC `Lv_le = IMAGE (omega_list_n V vl) {j | j <= i}` THEN + + (* a = sum {j < i} ss + ss p0 *) + SUBGOAL_THEN `a = sum (Lu_le DELETE p0 : real^3) ss + ss p0` ASSUME_TAC THENL + [ + MP_TAC (ISPECL[`ss:real^3->real`; `Lu_le:real^3->bool`; `p0:real^3`] SUM_DELETE) THEN + ANTS_TAC THEN EXPAND_TAC "Lu_le" THENL + [ + CONJ_TAC THENL + [ + MATCH_MP_TAC FINITE_IMAGE THEN REWRITE_TAC[FINITE_NUMSEG_LE]; + ALL_TAC + ] THEN + EXPAND_TAC "p0" THEN REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN + EXISTS_TAC `i:num` THEN ASM_SIMP_TAC[LE_REFL]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + (* b = sum {j < i} tt + tt p0 *) + SUBGOAL_THEN `b = sum (Lv_le DELETE p0 : real^3) tt + tt p0` ASSUME_TAC THENL + [ + MP_TAC (ISPECL[`tt:real^3->real`; `Lv_le:real^3->bool`; `p0:real^3`] SUM_DELETE) THEN + ANTS_TAC THEN EXPAND_TAC "Lv_le" THENL + [ + CONJ_TAC THENL + [ + MATCH_MP_TAC FINITE_IMAGE THEN REWRITE_TAC[FINITE_NUMSEG_LE]; + ALL_TAC + ] THEN + EXPAND_TAC "p0" THEN REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN + EXISTS_TAC `i:num` THEN ASM_SIMP_TAC[LE_REFL]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + (* Lu_le = Lv_le *) + SUBGOAL_THEN `Lu_le = Lv_le : real^3->bool` (LABEL_TAC "L_eq") THENL + [ + EXPAND_TAC "Lu_le" THEN EXPAND_TAC "Lv_le" THEN + REWRITE_TAC[EXTENSION; IN_IMAGE; IN_ELIM_THM] THEN GEN_TAC THEN + EQ_TAC THEN STRIP_TAC THEN EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[] THENL + [ + MP_TAC (ARITH_RULE `x' <= i /\ i < k ==> x' < k : num`) THEN ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + MP_TAC (ARITH_RULE `x' <= i /\ i < k ==> x' < k : num`) THEN ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + (* sum {j < i} ss = sum {j < i} tt *) + SUBGOAL_THEN `sum (Lv_le DELETE p0 : real^3) ss = sum (Lv_le DELETE p0) tt` ASSUME_TAC THENL + [ + MATCH_MP_TAC SUM_EQ THEN POP_ASSUM (fun th -> ALL_TAC) THEN EXPAND_TAC "Lv_le" THEN + REWRITE_TAC[IN_IMAGE; IN_ELIM_THM; IN_DELETE] THEN REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x':num`) THEN + SUBGOAL_THEN `~(x' = i:num)` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[CONTRAPOS_THM] THEN + EXPAND_TAC "p0" THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[LT_LE] THEN REWRITE_TAC[GSYM LT_LE] THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC (ARITH_RULE `x' <= i /\ i < k ==> x' < k : num`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ARITH_RULE `x' <= i /\ i < k ==> x' < k : num`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `&1 - a = &1 - b ==> (ss:real^3->real) p0 = tt p0` MATCH_MP_TAC THENL + [ + ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC (ISPEC `voronoi_list V (truncate_simplex i ul)` ODIGPXU) THEN + EXISTS_TAC `voronoi_list V (truncate_simplex (i + 1) vl)` THEN + EXISTS_TAC `voronoi_list V (truncate_simplex (i + 1) ul)` THEN + MAP_EVERY EXISTS_TAC [`p0:real^3`; `p':real^3`; `p:real^3`] THEN + REPEAT STRIP_TAC THENL + [ + (* polyhedron *) + MATCH_MP_TAC POLYHEDRON_VORONOI_LIST THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC SUBSET_TRANS THEN EXISTS_TAC `set_of_list ul : real^3->bool` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC SET_OF_LIST_TRUNCATE_SIMPLEX_SUBSET THEN + ASM_REWRITE_TAC[] THEN MP_TAC (ARITH_RULE `i < k /\ k <= 3 ==> i + 1 <= 4`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC BARV_SUBSET THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]; + + (* p0 IN polyhedron *) + ASM_SIMP_TAC[] THEN EXPAND_TAC "p0" THEN + MATCH_MP_TAC OMEGA_LIST_N_IN_VORONOI_LIST THEN + EXISTS_TAC `3` THEN MP_TAC (ARITH_RULE `i < k /\ k <= 3 ==> i <= 3`) THEN + ASM_SIMP_TAC[]; + + (* ~(p0 IN F UNION F') *) + POP_ASSUM MP_TAC THEN REWRITE_TAC[IN_UNION] THEN STRIP_TAC THENL + [ + POP_ASSUM MP_TAC THEN EXPAND_TAC "p0" THEN + REWRITE_TAC[ARITH_RULE `i + 1 = SUC i`] THEN + DISCH_THEN (MP_TAC o MATCH_MP OMEGA_LIST_N_EQ) THEN + REWRITE_TAC[] THEN + MP_TAC (SPECL [`V:real^3->bool`; `vl:(real^3)list`] ROGERS_AFF_DIM_FULL) THEN + ASM_REWRITE_TAC[] THEN EXPAND_TAC "p0" THEN DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[ARITH_RULE `~(SUC i = i)`] THEN + MATCH_MP_TAC (ARITH_RULE `i < k /\ k <= 3 ==> SUC i < 4 /\ i < 4`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN + REPLICATE_TAC 2 (FIRST_X_ASSUM (MP_TAC o SPEC `i:num`)) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN DISCH_TAC THEN + REWRITE_TAC[ARITH_RULE `i + 1 = SUC i`] THEN + DISCH_THEN (MP_TAC o MATCH_MP OMEGA_LIST_N_EQ) THEN + REWRITE_TAC[] THEN + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`] ROGERS_AFF_DIM_FULL) THEN + ASM_REWRITE_TAC[] THEN EXPAND_TAC "p0" THEN DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[ARITH_RULE `~(SUC i = i)`] THEN + MATCH_MP_TAC (ARITH_RULE `i < k /\ k <= 3 ==> SUC i < 4 /\ i < 4`) THEN + ASM_REWRITE_TAC[]; + + (* F facet_of polyhedron *) + MP_TAC (SPECL[`V:real^3->bool`; `vl:(real^3)list`; `3`; `i:num`] OMEGA_LIST_N_IN_FACET) THEN + ASM_SIMP_TAC[] THEN MP_TAC (ARITH_RULE `i < k /\ k <= 3 ==> i < 3`) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[]; + + (* F' facet_of polyhedron *) + MP_TAC (SPECL[`V:real^3->bool`; `ul:(real^3)list`; `3`; `i:num`] OMEGA_LIST_N_IN_FACET) THEN + ASM_REWRITE_TAC[] THEN MP_TAC (ARITH_RULE `i < k /\ k <= 3 ==> i < 3`) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[]; + + (* p' IN F *) + MP_TAC (ISPEC `voronoi_list V (truncate_simplex (i + 1) vl)` CONVEX_HULL_EQ) THEN + REWRITE_TAC[CONVEX_VORONOI_LIST] THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[CONVEX_HULL_EXPLICIT; IN_ELIM_THM] THEN + EXISTS_TAC `Lv : real^3->bool` THEN + EXISTS_TAC `\x:real^3. inv (&1 - b) * tt x` THEN + REPEAT STRIP_TAC THENL + [ + EXPAND_TAC "Lv" THEN MATCH_MP_TAC FINITE_IMAGE THEN + MATCH_MP_TAC FINITE_SUBSET THEN + EXISTS_TAC `{j | j < 4}` THEN REWRITE_TAC[FINITE_NUMSEG_LT] THEN + SIMP_TAC[SUBSET; IN_ELIM_THM]; + EXPAND_TAC "Lv" THEN REWRITE_TAC[SUBSET; IN_IMAGE; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + MP_TAC (SPECL[`V:real^3->bool`; `vl:(real^3)list`; `3`; `i:num`] OMEGA_LIST_N_IN_FACET) THEN + ANTS_TAC THEN ASM_REWRITE_TAC[] THENL + [ + MP_TAC (ARITH_RULE `i < k /\ k <= 3 ==> i < 3`) THEN ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[ARITH_RULE `x' <= 3 <=> x' < 4`]; + REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[REAL_LE_INV_EQ; REAL_LE_LT] THEN + REWRITE_TAC[GSYM REAL_LE_LT] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN EXPAND_TAC "Lv" THEN EXPAND_TAC "L2" THEN + REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[]; + ASM_REWRITE_TAC[SUM_LMUL] THEN + MP_TAC (REAL_ARITH `~(b = &1) ==> ~(&1 - b = &0)`) THEN + ASM_SIMP_TAC[REAL_MUL_LINV]; + ALL_TAC + ] THEN + REPLICATE_TAC 4 (POP_ASSUM (fun th -> ALL_TAC)) THEN + ASM_REWRITE_TAC[GSYM VECTOR_MUL_ASSOC; VSUM_LMUL]; + + (* p IN F' *) + REPLICATE_TAC 4 (POP_ASSUM (fun th -> ALL_TAC)) THEN + MP_TAC (ISPEC `voronoi_list V (truncate_simplex (i + 1) ul)` CONVEX_HULL_EQ) THEN + REWRITE_TAC[CONVEX_VORONOI_LIST] THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[CONVEX_HULL_EXPLICIT; IN_ELIM_THM] THEN + EXISTS_TAC `Lu : real^3->bool` THEN + EXISTS_TAC `\x:real^3. inv (&1 - a) * ss x` THEN + REPEAT STRIP_TAC THENL + [ + EXPAND_TAC "Lu" THEN MATCH_MP_TAC FINITE_IMAGE THEN + MATCH_MP_TAC FINITE_SUBSET THEN + EXISTS_TAC `{j | j < 4}` THEN REWRITE_TAC[FINITE_NUMSEG_LT] THEN + SIMP_TAC[SUBSET; IN_ELIM_THM]; + EXPAND_TAC "Lu" THEN REWRITE_TAC[SUBSET; IN_IMAGE; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + MP_TAC (SPECL[`V:real^3->bool`; `ul:(real^3)list`; `3`; `i:num`] OMEGA_LIST_N_IN_FACET) THEN + ANTS_TAC THEN ASM_REWRITE_TAC[] THENL + [ + MP_TAC (ARITH_RULE `i < k /\ k <= 3 ==> i < 3`) THEN ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[ARITH_RULE `x' <= 3 <=> x' < 4`]; + REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[REAL_LE_INV_EQ; REAL_LE_LT] THEN + REWRITE_TAC[GSYM REAL_LE_LT] THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN EXPAND_TAC "Lu" THEN EXPAND_TAC "L1" THEN + REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[]; + ASM_REWRITE_TAC[SUM_LMUL] THEN + ASM_SIMP_TAC[REAL_ARITH `~(a = &1) ==> ~(&1 - a = &0)`; REAL_MUL_LINV]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[GSYM VECTOR_MUL_ASSOC; VSUM_LMUL]; + + (* &0 < &1 - b *) + ASM_REWRITE_TAC[]; + + (* &0 < &1 - a *) + ASM_REWRITE_TAC[]; + + ALL_TAC + ] THEN + (* b * p0 + (1 - b) * p' = a * p0 + (1 - a) * p *) + REWRITE_TAC[REAL_ARITH `&1 - (&1 - b) = b`] THEN + EXPAND_TAC "p" THEN EXPAND_TAC "p'" THEN + REWRITE_TAC[VECTOR_MUL_ASSOC] THEN + SUBGOAL_THEN `(&1 - b) * inv (&1 - b) = &1 /\ (&1 - a) * inv (&1 - a) = &1` (fun th -> REWRITE_TAC[th]) THENL + [ + CONJ_TAC THEN MATCH_MP_TAC REAL_MUL_RINV THEN ASM_REWRITE_TAC[REAL_ARITH `~(&1 - b = &0) <=> ~(b = &1)`]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[VECTOR_MUL_LID; VECTOR_ADD_RDISTRIB] THEN + REWRITE_TAC[VECTOR_ARITH `(a + b) + c = (a + d) + e <=> b + c = d + e : real^3`] THEN + + (* vsum (Lv_le DELETE p0) ss = vsum (Lv_le DELETE p0) tt *) + SUBGOAL_THEN `vsum (Lv_le DELETE p0) (\x:real^3. tt x % x) = vsum (Lv_le DELETE p0) (\x. ss x % x)` ASSUME_TAC THENL + [ + MATCH_MP_TAC VSUM_EQ THEN UNDISCH_TAC `Lu_le = Lv_le : real^3->bool` THEN + DISCH_THEN (fun th -> ALL_TAC) THEN EXPAND_TAC "Lv_le" THEN + REWRITE_TAC[IN_IMAGE; IN_ELIM_THM; IN_DELETE] THEN REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[VECTOR_MUL_RCANCEL] THEN DISJ1_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x':num`) THEN + SUBGOAL_THEN `~(x' = i:num)` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[CONTRAPOS_THM] THEN + EXPAND_TAC "p0" THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[LT_LE] THEN REWRITE_TAC[GSYM LT_LE] THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC (ARITH_RULE `x' <= i /\ i < k ==> x' < k : num`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ARITH_RULE `x' <= i /\ i < k ==> x' < k : num`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + ONCE_REWRITE_TAC[SPEC `vsum (Lv_le DELETE p0:real^3) (\x. tt x % x)` (VECTOR_ARITH `!x y z:real^3. y = z <=> x + y = x + z`)] THEN + ONCE_REWRITE_TAC[VECTOR_ADD_ASSOC] THEN + + (* vsum {j < i} + vsum i = vsum {j <= i} *) + SUBGOAL_THEN `vsum (Lv_le DELETE p0) (\x:real^3. tt x % x) + tt p0 % p0 = vsum Lv_le (\x. tt x % x)` (fun th -> REWRITE_TAC[th]) THENL + [ + MP_TAC (ISPECL[`\x:real^3. tt x % x`; `Lv_le:real^3->bool`; `p0:real^3`] VSUM_DELETE) THEN + ANTS_TAC THEN EXPAND_TAC "Lv_le" THEN EXPAND_TAC "Lu_le" THENL + [ + CONJ_TAC THENL + [ + MATCH_MP_TAC FINITE_IMAGE THEN REWRITE_TAC[FINITE_NUMSEG_LE]; + ALL_TAC + ] THEN + EXPAND_TAC "p0" THEN REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN + EXISTS_TAC `i:num` THEN ASM_SIMP_TAC[LE_REFL]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + (* vsum {j < i} + vsum i = vsum {j <= i} *) + SUBGOAL_THEN `vsum (Lv_le DELETE p0) (\x:real^3. tt x % x) + ss p0 % p0 = vsum Lv_le (\x. ss x % x)` (fun th -> REWRITE_TAC[th]) THENL + [ + MP_TAC (ISPECL[`\x:real^3. ss x % x`; `Lv_le:real^3->bool`; `p0:real^3`] VSUM_DELETE) THEN + ANTS_TAC THEN EXPAND_TAC "Lv_le" THEN EXPAND_TAC "Lu_le" THENL + [ + CONJ_TAC THENL + [ + MATCH_MP_TAC FINITE_IMAGE THEN REWRITE_TAC[FINITE_NUMSEG_LE]; + ALL_TAC + ] THEN + EXPAND_TAC "p0" THEN REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN + EXISTS_TAC `i:num` THEN ASM_SIMP_TAC[LE_REFL]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `FINITE (Lv_le:real^3->bool) /\ FINITE (Lv:real^3->bool) /\ FINITE (Lu:real^3->bool)` ASSUME_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["Lv_le"; "Lu_le"; "Lv"; "Lu"] THEN + REPEAT CONJ_TAC THEN MATCH_MP_TAC FINITE_IMAGE THEN REWRITE_TAC[FINITE_NUMSEG_LE] THENL + [ + MATCH_MP_TAC FINITE_SUBSET THEN EXISTS_TAC `{j | j < 4}` THEN + SIMP_TAC[FINITE_NUMSEG_LT; SUBSET; IN_ELIM_THM]; + MATCH_MP_TAC FINITE_SUBSET THEN EXISTS_TAC `{j | j < 4}` THEN + SIMP_TAC[FINITE_NUMSEG_LT; SUBSET; IN_ELIM_THM]; + ]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `DISJOINT (Lv_le:real^3->bool) Lv /\ DISJOINT (Lu_le:real^3->bool) Lu` ASSUME_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["Lv_le"; "Lu_le"; "Lv"; "Lu"] THEN + REWRITE_TAC[DISJOINT; EXTENSION; NOT_IN_EMPTY; IN_INTER; IN_IMAGE; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THENL + [ + MP_TAC (SPECL [`V:real^3->bool`; `vl:(real^3)list`] ROGERS_AFF_DIM_FULL) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPECL [`x':num`; `x'':num`]) THEN + ANTS_TAC THENL + [ + MP_TAC (ARITH_RULE `x' <= i /\ i < k /\ k <= 3 ==> x' < 4`) THEN + MP_TAC (ARITH_RULE `x' <= i /\ i < x'' ==> ~(x' = x'':num)`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + MP_TAC (ARITH_RULE `x' <= i /\ i < k ==> x' < k:num`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`] ROGERS_AFF_DIM_FULL) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPECL [`x':num`; `x'':num`]) THEN + ANTS_TAC THENL + [ + MP_TAC (ARITH_RULE `x' <= i /\ i < k /\ k <= 3 ==> x' < 4`) THEN + MP_TAC (ARITH_RULE `x' <= i /\ i < x'' ==> ~(x' = x'':num)`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL[`\x:real^3. tt x % x`; `Lv_le:real^3->bool`; `Lv:real^3->bool`] VSUM_UNION) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (ISPECL[`\x:real^3. ss x % x`; `Lv_le:real^3->bool`; `Lu:real^3->bool`] VSUM_UNION) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + + (* Lv_le UNION Lv = L2 *) + SUBGOAL_THEN `Lv_le UNION Lv = L2 /\ Lv_le UNION Lu = L1 : real^3->bool` (fun th -> REWRITE_TAC[th]) THENL + [ + CONJ_TAC THENL + [ + REMOVE_THEN "L_eq" (fun th -> ALL_TAC) THEN + EXPAND_TAC "Lv_le" THEN EXPAND_TAC "L2" THEN EXPAND_TAC "Lv" THEN + REWRITE_TAC[EXTENSION; IN_IMAGE; IN_UNION; IN_ELIM_THM] THEN GEN_TAC THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + EXISTS_TAC `x':num` THEN MP_TAC (ARITH_RULE `x' <= i /\ i < k /\ k <= 3 ==> x' < 4`) THEN + ASM_SIMP_TAC[]; + EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_CASES_TAC `x' <= i : num` THENL + [ + DISJ1_TAC THEN EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + DISJ2_TAC THEN EXISTS_TAC `x':num` THEN + POP_ASSUM MP_TAC THEN ASM_SIMP_TAC[NOT_LE]; + ALL_TAC + ] THEN + EXPAND_TAC "Lv_le" THEN EXPAND_TAC "L1" THEN EXPAND_TAC "Lu" THEN EXPAND_TAC "Lu_le" THEN + REWRITE_TAC[EXTENSION; IN_IMAGE; IN_UNION; IN_ELIM_THM] THEN GEN_TAC THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + EXISTS_TAC `x':num` THEN MP_TAC (ARITH_RULE `x' <= i /\ i < k /\ k <= 3 ==> x' < 4`) THEN + ASM_SIMP_TAC[]; + EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_CASES_TAC `x' <= i : num` THENL + [ + DISJ1_TAC THEN EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + DISJ2_TAC THEN EXISTS_TAC `x':num` THEN + POP_ASSUM MP_TAC THEN ASM_SIMP_TAC[NOT_LE]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_THEN (LABEL_TAC "ss_tt") THEN + (* Continue the second step *) + + ABBREV_TAC `Lu_lt = IMAGE (omega_list_n V ul) {j | j < k}` THEN + ABBREV_TAC `Lv_lt = IMAGE (omega_list_n V vl) {j | j < k}` THEN + ABBREV_TAC `Lu_ge = IMAGE (omega_list_n V ul) {j | k <= j /\ j < 4}` THEN + ABBREV_TAC `Lv_ge = IMAGE (omega_list_n V vl) {j | k <= j /\ j < 4}` THEN + ABBREV_TAC `a = sum Lv_lt (ss:real^3->real)` THEN + + (* Lu_lt = Lv_lt *) + SUBGOAL_THEN `Lu_lt = Lv_lt : real^3->bool` (LABEL_TAC "l_eq") THENL + [ + EXPAND_TAC "Lu_lt" THEN EXPAND_TAC "Lv_lt" THEN + REWRITE_TAC[EXTENSION; IN_IMAGE; IN_ELIM_THM] THEN GEN_TAC THEN + EQ_TAC THEN STRIP_TAC THEN EXISTS_TAC `x':num` THEN ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + (* Unions *) + SUBGOAL_THEN `Lv_lt UNION Lv_ge = L2 : real^3->bool /\ Lv_lt UNION Lu_ge = L1` ASSUME_TAC THENL + [ + CONJ_TAC THENL + [ + REMOVE_THEN "l_eq" (fun th -> ALL_TAC) THEN + EXPAND_TAC "Lv_lt" THEN EXPAND_TAC "L2" THEN EXPAND_TAC "Lv_ge" THEN + REWRITE_TAC[EXTENSION; IN_IMAGE; IN_UNION; IN_ELIM_THM] THEN GEN_TAC THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + EXISTS_TAC `x':num` THEN MP_TAC (ARITH_RULE `x' < k /\ k <= 3 ==> x' < 4`) THEN + ASM_SIMP_TAC[]; + EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_CASES_TAC `x' < k : num` THENL + [ + DISJ1_TAC THEN EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + DISJ2_TAC THEN EXISTS_TAC `x':num` THEN + POP_ASSUM MP_TAC THEN ASM_SIMP_TAC[NOT_LT]; + ALL_TAC + ] THEN + + EXPAND_TAC "Lv_lt" THEN EXPAND_TAC "L1" THEN EXPAND_TAC "Lu_ge" THEN EXPAND_TAC "Lu_lt" THEN + REWRITE_TAC[EXTENSION; IN_IMAGE; IN_UNION; IN_ELIM_THM] THEN GEN_TAC THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + EXISTS_TAC `x':num` THEN MP_TAC (ARITH_RULE `x' < k /\ k <= 3 ==> x' < 4`) THEN + ASM_SIMP_TAC[]; + EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_CASES_TAC `x' < k : num` THENL + [ + DISJ1_TAC THEN EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + DISJ2_TAC THEN EXISTS_TAC `x':num` THEN + POP_ASSUM MP_TAC THEN ASM_SIMP_TAC[NOT_LT]; + ALL_TAC + ] THEN + + (* Disjoint sets *) + SUBGOAL_THEN `DISJOINT (Lv_lt:real^3->bool) Lv_ge /\ DISJOINT (Lv_lt:real^3->bool) Lu_ge` ASSUME_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["Lv_lt"; "Lu_lt"; "Lv_ge"; "Lu_ge"] THEN + REWRITE_TAC[DISJOINT; EXTENSION; NOT_IN_EMPTY; IN_INTER; IN_IMAGE; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THENL + [ + MP_TAC (SPECL [`V:real^3->bool`; `vl:(real^3)list`] ROGERS_AFF_DIM_FULL) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPECL [`x':num`; `x'':num`]) THEN + ANTS_TAC THENL + [ + MP_TAC (ARITH_RULE `x' < k /\ k <= 3 ==> x' < 4`) THEN + MP_TAC (ARITH_RULE `x' < k /\ k <= x'' ==> ~(x' = x'':num)`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`] ROGERS_AFF_DIM_FULL) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPECL [`x':num`; `x'':num`]) THEN + ANTS_TAC THENL + [ + MP_TAC (ARITH_RULE `x' < k /\ k <= 3 ==> x' < 4`) THEN + MP_TAC (ARITH_RULE `x' < k /\ k <= x'' ==> ~(x' = x'':num)`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + (* Finite sets *) + SUBGOAL_THEN `FINITE (Lv_lt:real^3->bool) /\ FINITE (Lv_ge:real^3->bool) /\ FINITE (Lu_ge:real^3->bool)` ASSUME_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["Lv_lt"; "Lv_ge"; "Lu_ge"; "Lu_lt"] THEN + REPEAT CONJ_TAC THEN MATCH_MP_TAC FINITE_IMAGE THEN REWRITE_TAC[FINITE_NUMSEG_LT] THENL + [ + MATCH_MP_TAC FINITE_SUBSET THEN EXISTS_TAC `{j | j < 4}` THEN + SIMP_TAC[FINITE_NUMSEG_LT; SUBSET; IN_ELIM_THM]; + ALL_TAC + ] THEN + MATCH_MP_TAC FINITE_SUBSET THEN EXISTS_TAC `{j | j < 4}` THEN + SIMP_TAC[FINITE_NUMSEG_LT; SUBSET; IN_ELIM_THM]; + ALL_TAC + ] THEN + + (* vsum Lv_lt ss = vsum Lv_lt tt *) + SUBGOAL_THEN `vsum Lv_lt (\x:real^3. ss x % x) = vsum Lv_lt (\x:real^3. tt x % x)` ASSUME_TAC THENL + [ + MATCH_MP_TAC VSUM_EQ THEN EXPAND_TAC "Lv_lt" THEN EXPAND_TAC "Lu_lt" THEN + REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + REWRITE_TAC[VECTOR_MUL_RCANCEL] THEN DISJ1_TAC THEN + ASM_REWRITE_TAC[] THEN FIRST_X_ASSUM (MP_TAC o SPEC `x':num`) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + (* sum Lv_lt tt = a *) + SUBGOAL_THEN `sum Lv_lt (tt:real^3->real) = a` ASSUME_TAC THENL + [ + EXPAND_TAC "a" THEN EXPAND_TAC "Lv_lt" THEN EXPAND_TAC "Lu_lt" THEN + MATCH_MP_TAC SUM_EQ THEN + REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x':num`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + (* w = w_lt + w_ge *) + MP_TAC (ISPECL[`\x:real^3. ss x % x`; `Lv_lt:real^3->bool`; `Lu_ge:real^3->bool`] VSUM_UNION) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (LABEL_TAC "wu" o SYM) THEN + MP_TAC (ISPECL[`\x:real^3. tt x % x`; `Lv_lt:real^3->bool`; `Lv_ge:real^3->bool`] VSUM_UNION) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (LABEL_TAC "wv" o SYM) THEN + + (* 1 = a + (1 - a) *) + MP_TAC (ISPECL[`ss:real^3->real`; `Lv_lt:real^3->bool`; `Lu_ge:real^3->bool`] SUM_UNION) THEN + MP_TAC (ISPECL[`tt:real^3->real`; `Lv_lt:real^3->bool`; `Lv_ge:real^3->bool`] SUM_UNION) THEN + ASM_REWRITE_TAC[REAL_ARITH `&1 = a + x <=> x = &1 - a`] THEN + DISCH_TAC THEN DISCH_TAC THEN + + (* &1 - a != 0 *) + SUBGOAL_THEN `~(&1 - a = &0)` ASSUME_TAC THENL + [ + ASM_CASES_TAC `?p:real^3. p IN Lv_lt` THENL + [ + POP_ASSUM MP_TAC THEN STRIP_TAC THEN POP_ASSUM MP_TAC THEN + EXPAND_TAC "Lv_lt" THEN EXPAND_TAC "Lu_lt" THEN + REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN STRIP_TAC THEN + REMOVE_THEN "not1" (MP_TAC o SPEC `k - 1`) THEN + MP_TAC (ARITH_RULE `x < k ==> k - 1 < k`) THEN ASM_SIMP_TAC[] THEN DISCH_TAC THEN + ASM_SIMP_TAC[ARITH_RULE `k - 1 < k ==> (j <= k - 1 <=> j < k)`] THEN + SIMP_TAC[ARITH_RULE `~(a = &1) ==> ~(&1 - a = &0)`]; + ALL_TAC + ] THEN + + EXPAND_TAC "a" THEN + SUBGOAL_THEN `Lv_lt = {} : real^3->bool` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[EXTENSION; NOT_IN_EMPTY; GSYM NOT_EXISTS_THM]; + ALL_TAC + ] THEN + REWRITE_TAC[SUM_CLAUSES; REAL_SUB_RZERO] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + (* &0 < &1 - a *) + SUBGOAL_THEN `&0 < &1 - a` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[REAL_LT_LE] THEN + POP_ASSUM (fun th -> ALL_TAC) THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC SUM_POS_LE THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN EXPAND_TAC "Lu_ge" THEN EXPAND_TAC "L1" THEN + REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ABBREV_TAC `p:real^3 = inv (&1 - a) % vsum Lv_ge (\x. tt x % x)` THEN + EXPAND_TAC "YX" THEN + REWRITE_TAC[CONVEX_HULL_EXPLICIT; IN_ELIM_THM] THEN + EXISTS_TAC `Lv_lt UNION {p:real^3}` THEN + EXISTS_TAC `\x:real^3. if x = p then (&1 - a) else tt x` THEN + + (* p IN X *) + SUBGOAL_THEN `p:real^3 IN X` ASSUME_TAC THENL + [ + EXPAND_TAC "X" THEN REWRITE_TAC[IN_INTER] THEN + MP_TAC (ISPEC `voronoi_list V (truncate_simplex k vl)` CONVEX_HULL_EQ) THEN + MP_TAC (ISPEC `voronoi_list V (truncate_simplex k ul)` CONVEX_HULL_EQ) THEN + REWRITE_TAC[CONVEX_VORONOI_LIST] THEN + REPEAT (DISCH_THEN (fun th -> ONCE_REWRITE_TAC[SYM th])) THEN + REWRITE_TAC[CONVEX_HULL_EXPLICIT; IN_ELIM_THM] THEN + CONJ_TAC THENL + [ + EXISTS_TAC `Lu_ge : real^3->bool` THEN + EXISTS_TAC `\x:real^3. inv (&1 - a) * ss x` THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THENL + [ + EXPAND_TAC "Lu_ge" THEN REWRITE_TAC[SUBSET; IN_IMAGE; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC OMEGA_LIST_N_IN_VORONOI_LIST_GEN THEN + EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `x' <= 3 <=> x' < 4`]; + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[REAL_LE_INV_EQ; REAL_LE_LT] THEN REWRITE_TAC[GSYM REAL_LE_LT] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN EXPAND_TAC "Lu_ge" THEN EXPAND_TAC "L1" THEN + REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[SUM_LMUL; REAL_MUL_LINV]; + ALL_TAC + ] THEN + REWRITE_TAC[GSYM VECTOR_MUL_ASSOC; VSUM_LMUL] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[VECTOR_MUL_LCANCEL] THEN DISJ2_TAC THEN + REMOVE_THEN "wu" MP_TAC THEN REMOVE_THEN "wv" (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[VECTOR_ARITH `x + a = x + b <=> a = b:real^3`]; + ALL_TAC + ] THEN + EXISTS_TAC `Lv_ge : real^3->bool` THEN + EXISTS_TAC `\x:real^3. inv (&1 - a) * tt x` THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THENL + [ + EXPAND_TAC "Lv_ge" THEN REWRITE_TAC[SUBSET; IN_IMAGE; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC OMEGA_LIST_N_IN_VORONOI_LIST_GEN THEN + EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `x' <= 3 <=> x' < 4`]; + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[REAL_LE_INV_EQ; REAL_LE_LT] THEN REWRITE_TAC[GSYM REAL_LE_LT] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN EXPAND_TAC "Lv_ge" THEN EXPAND_TAC "L2" THEN + REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + EXISTS_TAC `x':num` THEN ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[SUM_LMUL; REAL_MUL_LINV]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[GSYM VECTOR_MUL_ASSOC; VSUM_LMUL]; + ALL_TAC + ] THEN + + (* ~(p IN Lv_lt) *) + SUBGOAL_THEN `~(p:real^3 IN Lv_lt)` ASSUME_TAC THENL + [ + EXPAND_TAC "Lv_lt" THEN EXPAND_TAC "Lu_lt" THEN + REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + MP_TAC (SPECL[`V:real^3->bool`; `ul:(real^3)list`] ROGERS_AFF_DIM_FULL) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPECL[`x:num`; `SUC x`]) THEN + ANTS_TAC THENL + [ + MP_TAC (ARITH_RULE `x < k /\ k <= 3 ==> x < 4 /\ SUC x < 4`) THEN + ASM_SIMP_TAC[ARITH_RULE `~(x = SUC x)`]; + ALL_TAC + ] THEN + REWRITE_TAC[] THEN + MATCH_MP_TAC EQ_SYM THEN + MATCH_MP_TAC OMEGA_LIST_N_EQ_GEN THEN + EXISTS_TAC `3` THEN EXISTS_TAC `k:num` THEN + ASM_REWRITE_TAC[] THEN POP_ASSUM (fun th -> ALL_TAC) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + POP_ASSUM MP_TAC THEN EXPAND_TAC "X" THEN + SIMP_TAC[IN_INTER]; + ALL_TAC + ] THEN + + REPEAT CONJ_TAC THENL + [ + (* FINITE (Lv_lt UNION {p}) *) + ASM_REWRITE_TAC[FINITE_UNION; FINITE_SING]; + + (* Lv_lt UNION {p} SUBSET Y UNION X *) + EXPAND_TAC "Y" THEN REMOVE_THEN "l_eq" (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[SUBSET; IN_UNION; IN_SING] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]; + + (* &0 <= f x *) + REWRITE_TAC[IN_UNION; IN_SING] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + COND_CASES_TAC THENL + [ + UNDISCH_TAC `~(p:real^3 IN Lv_lt)` THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN EXPAND_TAC "L2" THEN + REMOVE_THEN "l_eq" (fun th -> ALL_TAC) THEN EXPAND_TAC "Lv_lt" THEN + REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + EXISTS_TAC `x':num` THEN MP_TAC (ARITH_RULE `x' < k /\ k <= 3 ==> x' < 4`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[REAL_LE_LT]; + + (* sum = &1 *) + MP_TAC (ISPECL[`\x:real^3. if x = p then &1 - a else tt x`; `Lv_lt:real^3->bool`; `{p:real^3}`] SUM_UNION) THEN + ASM_REWRITE_TAC[FINITE_SING; DISJOINT; EXTENSION; NOT_IN_EMPTY; IN_INTER; IN_SING] THEN + ANTS_TAC THENL + [ + GEN_TAC THEN REWRITE_TAC[DE_MORGAN_THM] THEN + ASM_CASES_TAC `x = p:real^3` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; SUM_SING]) THEN + SUBGOAL_THEN `sum Lv_lt (\x:real^3. if x = p then &1 - a else tt x) = sum Lv_lt tt` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC SUM_EQ THEN REPEAT STRIP_TAC THEN BETA_TAC THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `~(p:real^3 IN Lv_lt)` THEN POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + (* vsum = w *) + REWRITE_TAC[] THEN + MP_TAC (ISPECL[`\v:real^3. (if v = p then &1 - a else tt v) % v`; `Lv_lt:real^3->bool`; `{p:real^3}`] VSUM_UNION) THEN + ASM_REWRITE_TAC[FINITE_SING; DISJOINT; EXTENSION; NOT_IN_EMPTY; IN_INTER; IN_SING] THEN + ANTS_TAC THENL + [ + GEN_TAC THEN REWRITE_TAC[DE_MORGAN_THM] THEN + ASM_CASES_TAC `x = p:real^3` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; VSUM_SING]) THEN + SUBGOAL_THEN `vsum Lv_lt (\v:real^3. (if v = p then &1 - a else tt v) % v) = vsum Lv_lt (\v. tt v % v)` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC VSUM_EQ THEN REPEAT STRIP_TAC THEN BETA_TAC THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `~(p:real^3 IN Lv_lt)` THEN POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + EXPAND_TAC "p" THEN REMOVE_THEN "wv" (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_RINV; VECTOR_MUL_LID]; + ALL_TAC + ] THEN + + (* The third step *) + DISCH_THEN (LABEL_TAC "conv") THEN + MATCH_MP_TAC AFF_DIM_LE_2_IMP_COPLANAR THEN + MATCH_MP_TAC INT_LE_TRANS THEN + EXISTS_TAC `aff_dim (convex hull (Y UNION X:real^3->bool))` THEN + POP_ASSUM (fun th -> SIMP_TAC[MATCH_MP AFF_DIM_SUBSET th]) THEN + REWRITE_TAC[AFF_DIM_CONVEX_HULL] THEN + SUBGOAL_THEN `FINITE (Y:real^3->bool)` ASSUME_TAC THENL + [ + EXPAND_TAC "Y" THEN MATCH_MP_TAC FINITE_IMAGE THEN REWRITE_TAC[FINITE_NUMSEG_LT]; + ALL_TAC + ] THEN + + (* CARD Y <= k *) + SUBGOAL_THEN `CARD (Y:real^3->bool) <= k` ASSUME_TAC THENL + [ + MATCH_MP_TAC LE_TRANS THEN EXISTS_TAC `CARD {j | j < k : num}` THEN + CONJ_TAC THENL + [ + EXPAND_TAC "Y" THEN + MP_TAC (ISPECL[`omega_list_n V ul`; `{j | j < k : num}`] CARD_IMAGE_LE) THEN + SIMP_TAC[FINITE_NUMSEG_LT]; + ALL_TAC + ] THEN + REWRITE_TAC[CARD_NUMSEG_LT; LE_REFL]; + ALL_TAC + ] THEN + + MATCH_MP_TAC INT_LE_TRANS THEN + EXISTS_TAC `&(CARD (Y:real^3->bool)) + aff_dim (X:real^3->bool)` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC AFF_DIM_FINITE_UNION_LE THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + (* aff dim X <= 2 - k *) + SUBGOAL_THEN `aff_dim (X:real^3->bool) <= &2 - &k` MP_TAC THENL + [ + ABBREV_TAC `Fu = voronoi_list V (truncate_simplex k ul)` THEN + ABBREV_TAC `Fv = voronoi_list V (truncate_simplex k vl)` THEN + (* k = 0 \/ 0 < k *) + DISJ_CASES_TAC (ARITH_RULE `k = 0 \/ 0 < k`) THENL + [ + UNDISCH_TAC `~(Fu = Fv : real^3->bool)` THEN + MP_TAC (ISPEC `ul:(real^3)list` TRUNCATE_0_EQ_HEAD) THEN + MP_TAC (ISPEC `vl:(real^3)list` TRUNCATE_0_EQ_HEAD) THEN + ASM_REWRITE_TAC[ARITH] THEN + MAP_EVERY EXPAND_TAC ["X"; "Fu"; "Fv"] THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + REPLICATE_TAC 2 (DISCH_THEN (fun th -> REWRITE_TAC[th])) THEN + REWRITE_TAC[VORONOI_LIST_SING] THEN DISCH_TAC THEN + MATCH_MP_TAC INT_LE_TRANS THEN + EXISTS_TAC `aff_dim ({x : real^3 | &2 % (HD ul - HD vl) dot x = norm (HD ul) pow 2 - norm (HD vl) pow 2})` THEN + + SUBGOAL_THEN `!l:(real^3)list. barV V 3 l ==> HD l IN V` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `set_of_list l : real^3->bool` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC BARV_IMP_HD_IN_SET_OF_LIST THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `3`] THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC BARV_SUBSET THEN + EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + FIRST_ASSUM (MP_TAC o SPEC `ul:(real^3)list`) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `vl:(real^3)list`) THEN + ASM_REWRITE_TAC[] THEN REPEAT DISCH_TAC THEN + + CONJ_TAC THENL + [ + MATCH_MP_TAC AFF_DIM_SUBSET THEN + MATCH_MP_TAC Pack2.INTER_VORONOI_SUBSET_BISECTOR THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `int_of_num 2 - &0 = &(dimindex (:3)) - &1` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[DIMINDEX_3] THEN INT_ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC (INT_ARITH `a = b ==> a <= b : int`) THEN + MATCH_MP_TAC AFF_DIM_HYPERPLANE THEN + REWRITE_TAC[VECTOR_MUL_EQ_0; INT_ARITH `~(&2 = &0)`; VECTOR_SUB_EQ] THEN + DISCH_TAC THEN UNDISCH_TAC `~(voronoi_closed V (HD ul) = voronoi_closed V (HD vl):real^3->bool)` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + (* 0 < k *) + ABBREV_TAC `P = voronoi_list V (truncate_simplex (k - 1) vl) : real^3->bool` THEN + (* Fu facet_of P /\ Fv facet_of P *) + SUBGOAL_THEN `Fu facet_of P /\ Fv facet_of P : real^3->bool` STRIP_ASSUME_TAC THENL + [ + CONJ_TAC THENL + [ + MP_TAC (SPECL[`V:real^3->bool`; `truncate_simplex (k - 1) ul:(real^3)list`; `k - 1`; `Fu:real^3->bool`] IDBEZAL) THEN + ANTS_TAC THENL + [ + ASM_SIMP_TAC[ARITH_RULE `k <= 3 ==> k - 1 < 3`] THEN + MATCH_MP_TAC TRUNCATE_SIMPLEX_BARV THEN + EXISTS_TAC `3` THEN ASM_SIMP_TAC[ARITH_RULE `k <= 3 ==> k - 1 <= 3`]; + ALL_TAC + ] THEN + SUBGOAL_THEN `voronoi_list V (truncate_simplex (k - 1) ul) = P : real^3->bool` MP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `k - 1`) THEN + ASM_SIMP_TAC[ARITH_RULE `0 < k ==> k - 1 < k`]; + ALL_TAC + ] THEN + REPEAT (DISCH_THEN (fun th -> REWRITE_TAC[th])) THEN + EXISTS_TAC `truncate_simplex k ul:(real^3)list` THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + ASM_SIMP_TAC[ARITH_RULE `0 < k ==> k - 1 + 1 = k`] THEN + MATCH_MP_TAC TRUNCATE_SIMPLEX_BARV THEN + EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC TRUNCATE_TRUNCATE_SIMPLEX THEN + ASM_SIMP_TAC[ARITH_RULE `k <= 3 ==> k + 1 <= 4`; ARITH_RULE `k - 1 <= k`]; + ALL_TAC + ] THEN + MP_TAC (SPECL[`V:real^3->bool`; `truncate_simplex (k - 1) vl:(real^3)list`; `k - 1`; `Fv:real^3->bool`] IDBEZAL) THEN + ANTS_TAC THENL + [ + ASM_SIMP_TAC[ARITH_RULE `k <= 3 ==> k - 1 < 3`] THEN + MATCH_MP_TAC TRUNCATE_SIMPLEX_BARV THEN + EXISTS_TAC `3` THEN ASM_SIMP_TAC[ARITH_RULE `k <= 3 ==> k - 1 <= 3`]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + EXISTS_TAC `truncate_simplex k vl:(real^3)list` THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + ASM_SIMP_TAC[ARITH_RULE `0 < k ==> k - 1 + 1 = k`] THEN + MATCH_MP_TAC TRUNCATE_SIMPLEX_BARV THEN + EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC TRUNCATE_TRUNCATE_SIMPLEX THEN + ASM_SIMP_TAC[ARITH_RULE `k <= 3 ==> k + 1 <= 4`; ARITH_RULE `k - 1 <= k`]; + ALL_TAC + ] THEN + + FIRST_ASSUM (MP_TAC o MATCH_MP FACET_OF_IMP_FACE_OF) THEN POP_ASSUM MP_TAC THEN + FIRST_ASSUM (MP_TAC o MATCH_MP FACET_OF_IMP_FACE_OF) THEN POP_ASSUM (LABEL_TAC "Fu_facet") THEN + MAP_EVERY (fun s -> DISCH_THEN (LABEL_TAC s)) ["Fu_face"; "Fv_facet"; "Fv_face"] THEN + + MP_TAC (ISPECL[`Fu:real^3->bool`; `P:real^3->bool`; `Fv:real^3->bool`; `P:real^3->bool`] FACE_OF_INTER_INTER) THEN + ASM_REWRITE_TAC[INTER_ACI] THEN DISCH_TAC THEN + + REMOVE_THEN "Fu_face" (MP_TAC o SPEC `X:real^3->bool` o MATCH_MP FACE_OF_FACE) THEN + REMOVE_THEN "Fv_face" (MP_TAC o SPEC `X:real^3->bool` o MATCH_MP FACE_OF_FACE) THEN + SUBGOAL_THEN `X SUBSET Fv /\ X SUBSET Fu:real^3->bool` (fun th -> ASM_REWRITE_TAC[th]) THENL + [ + MAP_EVERY EXPAND_TAC ["X"; "Fv"; "Fu"] THEN + REWRITE_TAC[INTER_SUBSET]; + ALL_TAC + ] THEN + + ASM_CASES_TAC `X = Fv : real^3->bool /\ X = Fu : real^3->bool` THENL + [ + UNDISCH_TAC `~(Fu = Fv:real^3->bool)` THEN + POP_ASSUM (fun th -> REWRITE_TAC[GSYM th]); + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[DE_MORGAN_THM] THEN REPEAT STRIP_TAC THENL + [ + MP_TAC (ISPECL[`X:real^3->bool`; `Fv:real^3->bool`] FACE_OF_AFF_DIM_LT) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN EXPAND_TAC "Fv" THEN REWRITE_TAC[CONVEX_VORONOI_LIST]; + ALL_TAC + ] THEN + MP_TAC (SPECL[`V:real^3->bool`; `vl:(real^3)list`; `3`; `k:num`] VORONOI_LIST_AFF_DIM) THEN + ASM_SIMP_TAC[] THEN INT_ARITH_TAC; + ALL_TAC + ] THEN + MP_TAC (ISPECL[`X:real^3->bool`; `Fu:real^3->bool`] FACE_OF_AFF_DIM_LT) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN EXPAND_TAC "Fu" THEN REWRITE_TAC[CONVEX_VORONOI_LIST]; + ALL_TAC + ] THEN + MP_TAC (SPECL[`V:real^3->bool`; `ul:(real^3)list`; `3`; `k:num`] VORONOI_LIST_AFF_DIM) THEN + ASM_SIMP_TAC[] THEN INT_ARITH_TAC; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM INT_OF_NUM_LE] THEN + INT_ARITH_TAC);; + + + +(***************************************************) + +(****************) +(* Circumcenter *) +(****************) + + +(* QXSKIIT *) + +let AFFINE_INDEPENDENT_IMP_INDEPENDENT = prove(`!S:real^N->bool. ~affine_dependent S ==> (!x. x IN S ==> independent {y - x | y | y IN (S DELETE x)})`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[independent; DEPENDENT_AFFINE_DEPENDENT_CASES; DE_MORGAN_THM] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC AFFINE_INDEPENDENT_SUBSET THEN + EXISTS_TAC `IMAGE (\y:real^N. --x + y) S` THEN + ASM_REWRITE_TAC[AFFINE_DEPENDENT_TRANSLATION_EQ] THEN + REWRITE_TAC[IMAGE_LEMMA; VECTOR_ARITH `--x + y:real^N = y - x`] THEN + REWRITE_TAC[IN_DELETE; SUBSET; IN_ELIM_THM] THEN + X_GEN_TAC `u:real^N` THEN + STRIP_TAC THEN + EXISTS_TAC `y:real^N` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `{y - x | y | y IN S DELETE x} = IMAGE (\y:real^N. --x + y) (S DELETE x)` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[IMAGE_LEMMA; VECTOR_ARITH `--x + y:real^N = y - x`]; + ALL_TAC + ] THEN + + REWRITE_TAC[AFFINE_HULL_TRANSLATION; IN_IMAGE] THEN + REWRITE_TAC[VECTOR_ARITH `vec 0 = --x + x' <=> x' = x:real^N`] THEN + STRIP_TAC THEN POP_ASSUM MP_TAC THEN + UNDISCH_TAC `~affine_dependent (S:real^N->bool)` THEN + ASM_REWRITE_TAC[CONTRAPOS_THM; affine_dependent] THEN + DISCH_TAC THEN + EXISTS_TAC `x:real^N` THEN + ASM_REWRITE_TAC[]);; + + + + +let ORTHOGONAL_TO_SPAN_EXISTS = prove(`!(s:real^N->bool) t. s SUBSET span t /\ dim s < dim t ==> + ?v. ~(v = vec 0) /\ v IN span t /\ (!x. x IN s ==> x dot v = &0)`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `span s SUBSET span (t:real^N->bool)` ASSUME_TAC THENL + [ + GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [GSYM SPAN_SPAN] THEN + MATCH_MP_TAC SPAN_MONO THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `?y:real^N. y IN span t /\ ~(y IN span s)` CHOOSE_TAC THENL + [ + UNDISCH_TAC `dim (s:real^N->bool) < dim (t:real^N->bool)` THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[NOT_EXISTS_THM; TAUT `~(A /\ ~B) <=> (A ==> B)`; GSYM SUBSET] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[IMP_IMP; SUBSET_ANTISYM_EQ] THEN + DISCH_TAC THEN + MATCH_MP_TAC (ARITH_RULE `a:num = b ==> ~(a < b)`) THEN + MATCH_MP_TAC SPAN_EQ_DIM THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPEC `span (s:real^N->bool)` ORTHOGONAL_BASIS_SUBSPACE) THEN + REWRITE_TAC[SUBSPACE_SPAN; DIM_SPAN] THEN + STRIP_TAC THEN + + ABBREV_TAC `v:real^N = (y - vsum b (\v. (v dot y) / (v dot v) % v))` THEN + + EXISTS_TAC `v:real^N` THEN + REPEAT CONJ_TAC THENL + [ + POP_ASSUM (LABEL_TAC "A") THEN + DISCH_TAC THEN REMOVE_THEN "A" MP_TAC THEN + ASM_REWRITE_TAC[VECTOR_SUB_EQ] THEN + DISCH_TAC THEN + SUBGOAL_THEN `y:real^N IN span b` MP_TAC THENL + [ + REWRITE_TAC[SPAN_EXPLICIT; IN_ELIM_THM] THEN + MAP_EVERY EXISTS_TAC [`b:real^N->bool`; `\v:real^N. (v dot y) / (v dot v)`] THEN + ASM_REWRITE_TAC[EQ_SYM_EQ; SUBSET_REFL] THEN + CONJ_TAC THENL + [ + UNDISCH_TAC `b:real^N->bool HAS_SIZE dim (s:real^N->bool)` THEN + SIMP_TAC[HAS_SIZE]; + ALL_TAC + ] THEN + POP_ASSUM ACCEPT_TAC; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]; + + EXPAND_TAC "v" THEN + MATCH_MP_TAC SPAN_SUB THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `span (s:real^N->bool)` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC SPAN_VSUM THEN + UNDISCH_TAC `b:real^N->bool HAS_SIZE dim (s:real^N->bool)` THEN + SIMP_TAC[HAS_SIZE] THEN DISCH_TAC THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC SPAN_MUL THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `b:real^N->bool` THEN + ASM_REWRITE_TAC[]; + + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`b:real^N->bool`; `y:real^N`; `x:real^N`] GRAM_SCHMIDT_STEP) THEN + ASM_REWRITE_TAC[orthogonal] THEN + ANTS_TAC THEN REWRITE_TAC[] THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `s:real^N->bool` THEN + ASM_REWRITE_TAC[SPAN_INC]);; + + + + + +let INDEPENDENT_EXPLICIT_NUMSEG = prove(`!(v:num->real^N) f n. (!i j. i IN (1..n) /\ j IN (1..n) /\ v i = v j ==> i = j) /\ + independent (IMAGE v (1..n)) /\ + vsum (1..n) (\i. f i % v i) = vec 0 + ==> (!i. i IN 1..n ==> f i = &0)`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`v:num->real^N`; `1..n`] INJECTIVE_ON_LEFT_INVERSE) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + + SUBGOAL_THEN `vsum (1..n) (\i. f i % v i) = vsum (IMAGE v (1..n)) (\x:real^N. f (g x) % x)` MP_TAC THENL + [ + MP_TAC (ISPECL [`\i:num. f i % v i:real^N`; `1..n`] VSUM_RESTRICT) THEN + REWRITE_TAC[FINITE_NUMSEG] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + + SUBGOAL_THEN `(\x:num. if x IN 1..n then f x % v x else vec 0) = (\i:num. if i IN 1..n then ((\x:real^N. f (g x) % x) o v) i else vec 0)` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[FUN_EQ_THM; o_THM] THEN + GEN_TAC THEN COND_CASES_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `x:num`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + REWRITE_TAC[]; + ALL_TAC + ] THEN + MP_TAC (ISPECL [`(\x:real^N. f ((g:real^N->num) x) % x) o (v:num->real^N)`; `1..n`] VSUM_RESTRICT) THEN + REWRITE_TAC[FINITE_NUMSEG] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + + MATCH_MP_TAC (GSYM VSUM_IMAGE) THEN + ASM_REWRITE_TAC[FINITE_NUMSEG] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_TAC THEN + UNDISCH_TAC `vsum (1..n) (\i. f i % v i) = vec 0:real^N` THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + MP_TAC (ISPEC `IMAGE (v:num->real^N) (1..n)` INDEPENDENT_EXPLICIT) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + DISCH_THEN (fun th -> (FIRST_X_ASSUM (MP_TAC o (fun th2 -> MATCH_MP th2 th)))) THEN + DISCH_THEN (MP_TAC o SPEC `(v:num->real^N) i`) THEN + REWRITE_TAC[IN_IMAGE] THEN + ANTS_TAC THENL + [ + EXISTS_TAC `i:num` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN + ASM_REWRITE_TAC[] THEN + SIMP_TAC[]);; + + + +let ORTHOGONAL_TO_ALL_IMP_ZERO = prove(`!(v:real^N) s. v IN span s /\ (!x. x IN s ==> v dot x = &0) ==> v = vec 0`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`span (s:real^N->bool)`; `span {v:real^N}`; `v:real^N`; `vec 0:real^N`; `vec 0:real^N`; `v:real^N`] ORTHOGONAL_SUBSPACE_DECOMP_UNIQUE) THEN + ANTS_TAC THENL + [ + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[SPAN_SPAN; SPAN_0] THENL + [ + MP_TAC (ISPECL [`s:real^N->bool`; `b:real^N`] ORTHOGONAL_TO_SPAN) THEN + ANTS_TAC THENL + [ + REPEAT STRIP_TAC THEN + REWRITE_TAC[orthogonal] THEN + UNDISCH_TAC `b IN span {v:real^N}` THEN + REWRITE_TAC[SPAN_SING; IN_ELIM_THM] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[DOT_LMUL; REAL_ENTIRE] THEN + DISJ2_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_THEN (MP_TAC o SPEC `a:real^N`) THEN + ASM_SIMP_TAC[ORTHOGONAL_SYM]; + + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `{v:real^N}` THEN + REWRITE_TAC[SPAN_INC; IN_SING]; + + VECTOR_ARITH_TAC + ]; + ALL_TAC + ] THEN + + STRIP_TAC);; + + + + +let UNIQUE_SOLUTION_lemma = prove(`!(S:real^N->bool) b. independent S ==> ?!p. p IN span S /\ (!x. x IN S ==> p dot x = b x)`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `n = dim (span (S:real^N->bool))` THEN + SUBGOAL_THEN `?w:num->real^N. S = IMAGE w (1..n) /\ (!i j. i IN (1..n) /\ j IN (1..n) /\ w i = w j ==> i = j)` MP_TAC THENL + [ + SUBGOAL_THEN `FINITE S /\ CARD (S:real^N->bool) = dim (span S)` ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM HAS_SIZE] THEN + MATCH_MP_TAC BASIS_HAS_SIZE_DIM THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MP_TAC (ISPEC `S:real^N->bool` FINITE_INDEX_NUMSEG) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + EXISTS_TAC `f:num->real^N` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + ABBREV_TAC `f:real^N->real^N = (\p:real^N. (lambda i. if i <= n then p dot (w i) else &0))` THEN + ABBREV_TAC `P:real^N->bool = IMAGE f (span (S:real^N->bool))` THEN + ABBREV_TAC `t:real^N->bool = IMAGE basis (1..n)` THEN + + SUBGOAL_THEN `P:real^N->bool SUBSET span t` ASSUME_TAC THENL + [ + REPLICATE_TAC 2 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + REWRITE_TAC[SUBSET; IN_SPAN_IMAGE_BASIS] THEN GEN_TAC THEN + EXPAND_TAC "f" THEN + REWRITE_TAC[IN_IMAGE; IN_NUMSEG] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM ((fun th -> ALL_TAC) o check (is_forall o concl)) THEN + ASM_SIMP_TAC[LAMBDA_BETA] THEN + POP_ASSUM MP_TAC THEN ASM_SIMP_TAC[DE_MORGAN_THM]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `subspace (P:real^N->bool)` ASSUME_TAC THENL + [ + REWRITE_TAC[subspace] THEN + EXPAND_TAC "P" THEN REWRITE_TAC[IN_IMAGE] THEN + REPEAT CONJ_TAC THENL + [ + EXISTS_TAC `vec 0:real^N` THEN + REWRITE_TAC[SPAN_0] THEN + EXPAND_TAC "f" THEN + REWRITE_TAC[DOT_LZERO] THEN + VECTOR_ARITH_TAC; + + REPEAT STRIP_TAC THEN + EXISTS_TAC `x' + x'':real^N` THEN + CONJ_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "f" THEN + REWRITE_TAC[DOT_LADD] THEN + SIMP_TAC[CART_EQ; VECTOR_ADD_COMPONENT; LAMBDA_BETA] THEN + ARITH_TAC; + ALL_TAC + ] THEN + MATCH_MP_TAC SPAN_ADD THEN + ASM_REWRITE_TAC[]; + + REPEAT STRIP_TAC THEN + EXISTS_TAC `c % x':real^N` THEN + CONJ_TAC THENL + [ + ASM_REWRITE_TAC[] THEN EXPAND_TAC "f" THEN + SIMP_TAC[CART_EQ; VECTOR_MUL_COMPONENT; LAMBDA_BETA; DOT_LMUL] THEN + ARITH_TAC; + ALL_TAC + ] THEN + MATCH_MP_TAC SPAN_MUL THEN + ASM_REWRITE_TAC[] + ]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `P:real^N->bool = span t` ASSUME_TAC THENL + [ + ASM_CASES_TAC `P:real^N->bool = span t` THEN ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL [`P:real^N->bool`; `t:real^N->bool`] ORTHOGONAL_TO_SPAN_EXISTS) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC DIM_PSUBSET THEN + REWRITE_TAC[PSUBSET] THEN + SUBGOAL_THEN `span P = P:real^N->bool` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[SPAN_EQ_SELF]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + STRIP_TAC THEN + + ABBREV_TAC `p:real^N = vsum (1..n) (\i. (v:real^N)$i % w i)` THEN + POP_ASSUM (LABEL_TAC "p") THEN + + SUBGOAL_THEN `(f:real^N->real^N) p IN P` ASSUME_TAC THENL + [ + EXPAND_TAC "P" THEN + REWRITE_TAC[IN_IMAGE] THEN + EXISTS_TAC `p:real^N` THEN ASM_REWRITE_TAC[] THEN + EXPAND_TAC "p" THEN + MATCH_MP_TAC SPAN_VSUM THEN + REWRITE_TAC[FINITE_NUMSEG] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC SPAN_MUL THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `IMAGE (w:num->real^N) (1..n)` THEN + REWRITE_TAC[SPAN_INC; IN_IMAGE] THEN + EXISTS_TAC `x:num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `p:real^N dot p = &0` MP_TAC THENL + [ + REMOVE_THEN "p" (fun th -> GEN_REWRITE_TAC (PAT_CONV `\p:real^N. a dot p = &0`) [SYM th]) THEN + SIMP_TAC[FINITE_NUMSEG; DOT_RSUM] THEN + REWRITE_TAC[DOT_RMUL] THEN + SUBGOAL_THEN `sum (1..n) (\y. v$y * (p dot w y)) = (v:real^N) dot ((f:real^N->real^N) p)` (fun th -> REWRITE_TAC[th]) THENL + [ + GEN_REWRITE_TAC RAND_CONV[dot] THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `sum (1..dimindex (:N)) (\i. (v:real^N)$i * (p:real^N dot w i))` THEN + CONJ_TAC THENL + [ + SUBGOAL_THEN `1..dimindex (:N) = (1..n) UNION (n + 1..dimindex (:N))` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC (GSYM NUMSEG_COMBINE_R) THEN + EXPAND_TAC "n" THEN + REWRITE_TAC[DIM_SUBSET_UNIV; ARITH_RULE `1 <= a + 1`]; + ALL_TAC + ] THEN + + MATCH_MP_TAC (GSYM SUM_UNION_RZERO) THEN + REWRITE_TAC[FINITE_NUMSEG; IN_NUMSEG] THEN + GEN_TAC THEN STRIP_TAC THEN + MATCH_MP_TAC EQ_SYM THEN + REWRITE_TAC[REAL_ENTIRE] THEN + DISJ1_TAC THEN + UNDISCH_TAC `v:real^N IN span t` THEN + EXPAND_TAC "t" THEN + REWRITE_TAC[IN_SPAN_IMAGE_BASIS] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[IN_NUMSEG] THEN + MATCH_MP_TAC (ARITH_RULE `n + 1 <= x ==> 1 <= x`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC SUM_EQ THEN + REWRITE_TAC[IN_NUMSEG] THEN REPEAT STRIP_TAC THEN + REPEAT (FIRST_X_ASSUM ((fun th -> ALL_TAC) o check (is_forall o concl))) THEN + EXPAND_TAC "f" THEN ASM_SIMP_TAC[LAMBDA_BETA] THEN + COND_CASES_TAC THEN REWRITE_TAC[] THEN + REWRITE_TAC[REAL_MUL_RZERO; REAL_ENTIRE] THEN + DISJ1_TAC THEN + UNDISCH_TAC `v:real^N IN span t` THEN + EXPAND_TAC "t" THEN + REWRITE_TAC[IN_SPAN_IMAGE_BASIS] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[IN_NUMSEG]; + ALL_TAC + ] THEN + + REWRITE_TAC[DOT_SYM] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[DOT_EQ_0] THEN + DISCH_TAC THEN + + SUBGOAL_THEN `!i. i IN 1..n ==> (v:real^N)$i = &0` ASSUME_TAC THENL + [ + MATCH_MP_TAC INDEPENDENT_EXPLICIT_NUMSEG THEN + EXISTS_TAC `w:num->real^N` THEN + ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `S:real^N->bool = IMAGE w (1..n)` THEN + DISCH_THEN (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + SUBGOAL_THEN `v:real^N = vec 0` MP_TAC THENL + [ + REWRITE_TAC[CART_EQ; VEC_COMPONENT] THEN + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `i <= n:num` THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[IN_NUMSEG]; + ALL_TAC + ] THEN + UNDISCH_TAC `v:real^N IN span t` THEN + EXPAND_TAC "t" THEN + REWRITE_TAC[IN_SPAN_IMAGE_BASIS] THEN + DISCH_THEN (MP_TAC o SPEC `i:num`) THEN + ASM_REWRITE_TAC[IN_NUMSEG; DE_MORGAN_THM]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ABBREV_TAC `r:real^N = lambda i. if i <= n then b ((w:num->real^N) i) else &0` THEN + FIRST_X_ASSUM ((fun th -> ALL_TAC) o check (is_forall o concl)) THEN + + SUBGOAL_THEN `?p. p IN span S /\ f (p:real^N) = r:real^N` MP_TAC THENL + [ + SUBGOAL_THEN `r:real^N IN P` MP_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "t" THEN + REWRITE_TAC[IN_SPAN_IMAGE_BASIS] THEN + REWRITE_TAC[IN_NUMSEG; DE_MORGAN_THM] THEN + REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN + EXPAND_TAC "r" THEN + ASM_SIMP_TAC[LAMBDA_BETA]; + ALL_TAC + ] THEN + + EXPAND_TAC "P" THEN + REWRITE_TAC[IN_IMAGE] THEN + STRIP_TAC THEN + EXISTS_TAC `x:real^N` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + REWRITE_TAC[EXISTS_UNIQUE] THEN + EXISTS_TAC `p:real^N` THEN + + SUBGOAL_THEN `p:real^N IN span S /\ (!x. x IN S ==> p dot x = b x)` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + GEN_TAC THEN REWRITE_TAC[IN_IMAGE; IN_NUMSEG] THEN + DISCH_THEN (X_CHOOSE_THEN `i:num` ASSUME_TAC) THEN + ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `f (p:real^N) = r:real^N` THEN + DISCH_THEN (MP_TAC o AP_TERM `(\v:real^N. v$i)`) THEN + BETA_TAC THEN + EXPAND_TAC "f" THEN EXPAND_TAC "r" THEN + SUBGOAL_THEN `1 <= i /\ i <= dimindex (:N)` MP_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC LE_TRANS THEN + EXISTS_TAC `n:num` THEN + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "n" THEN + REWRITE_TAC[DIM_SUBSET_UNIV]; + ALL_TAC + ] THEN + + SIMP_TAC[LAMBDA_BETA] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + FIRST_ASSUM (fun th -> REWRITE_TAC[th]) THEN + REPEAT STRIP_TAC THEN + + ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN + MATCH_MP_TAC ORTHOGONAL_TO_ALL_IMP_ZERO THEN + EXISTS_TAC `S:real^N->bool` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC SPAN_SUB THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[DOT_LSUB; REAL_SUB_REFL]);; + + + +let UNIQUE_SOLUTION_AFFINE_INDEPENDENT = prove(`!(S:real^N->bool) b. ~(S = {}) /\ ~affine_dependent S + ==> (?!p. p IN affine hull S /\ + (!x y. x IN S /\ y IN S ==> p dot (x - y) = b x - b y))`, + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + REPEAT GEN_TAC THEN + DISCH_THEN (CONJUNCTS_THEN2 (X_CHOOSE_THEN `v0:real^N` ASSUME_TAC) ASSUME_TAC) THEN + + ABBREV_TAC `R:real^N->bool = {y - v0 | y | y IN S DELETE v0}` THEN + + MP_TAC (SPECL [`R:real^N->bool`; `\v:real^N. (b:real^N->real) (v + v0) - b v0 - v0 dot v`] UNIQUE_SOLUTION_lemma) THEN + ANTS_TAC THENL + [ + MP_TAC (SPEC `S:real^N->bool` AFFINE_INDEPENDENT_IMP_INDEPENDENT) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `v0:real^N`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[EXISTS_UNIQUE] THEN + STRIP_TAC THEN + + EXISTS_TAC `p + v0:real^N` THEN + SUBGOAL_THEN `span (R:real^N->bool) = affine hull IMAGE (\x. --v0 + x) S` ASSUME_TAC THENL + [ + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `span ((v0 - v0:real^N) INSERT R)` THEN + CONJ_TAC THENL [ REWRITE_TAC[VECTOR_SUB_REFL; SPAN_INSERT_0]; ALL_TAC ] THEN + SUBGOAL_THEN `(v0 - v0) INSERT R = IMAGE (\x:real^N. --v0 + x) S` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[EXTENSION; IN_INSERT; IN_IMAGE; VECTOR_ARITH `--v0 + x = x - v0:real^N`] THEN + EXPAND_TAC "R" THEN + REWRITE_TAC[IN_ELIM_THM; IN_DELETE] THEN + ASM SET_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC (GSYM AFFINE_HULL_EQ_SPAN) THEN + MATCH_MP_TAC HULL_INC THEN + REWRITE_TAC[IN_IMAGE] THEN + EXISTS_TAC `v0:real^N` THEN + ASM_REWRITE_TAC[VECTOR_ARITH `--v0 + v0 = vec 0:real^N`]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + CONJ_TAC THENL + [ + UNDISCH_TAC `p:real^N IN span R` THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[AFFINE_HULL_TRANSLATION; IN_IMAGE] THEN + REWRITE_TAC[VECTOR_ARITH `p = --v0 + x <=> p + v0:real^N = x`] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!x:real^N. x IN S ==> (p + v0) dot (x - v0) = b x - b v0` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `x = v0:real^N` THENL + [ + ASM_REWRITE_TAC[VECTOR_SUB_REFL; DOT_RZERO; REAL_SUB_REFL]; + ALL_TAC + ] THEN + + REWRITE_TAC[DOT_LADD] THEN + SUBGOAL_THEN `p:real^N dot (x - v0) = b ((x - v0) + v0) - b v0 - v0 dot (x - v0)` (fun th -> REWRITE_TAC[th]) THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + EXPAND_TAC "R" THEN + REWRITE_TAC[IN_ELIM_THM; IN_DELETE] THEN + EXISTS_TAC `x:real^N` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[VECTOR_ARITH `x - v0 + v0 = x:real^N`] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[VECTOR_ARITH `a - b = (a - v0:real^N) - (b - v0)`] THEN + ONCE_REWRITE_TAC[DOT_RSUB] THEN + FIRST_ASSUM (MP_TAC o SPEC `x:real^N`) THEN + FIRST_ASSUM (MP_TAC o SPEC `y:real^N`) THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + REPEAT (DISCH_THEN (fun th -> REWRITE_TAC[th])) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + GEN_TAC THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `y - v0:real^N`) THEN + POP_ASSUM STRIP_ASSUME_TAC THEN + + ANTS_TAC THENL + [ + CONJ_TAC THENL + [ + ASM_REWRITE_TAC[AFFINE_HULL_TRANSLATION; IN_IMAGE] THEN + EXISTS_TAC `y:real^N` THEN + ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + EXPAND_TAC "R" THEN + REWRITE_TAC[IN_IMAGE; IN_DELETE; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[DOT_LSUB; VECTOR_ARITH `y - v0 + v0:real^N = y`] THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`y':real^N`; `v0:real^N`]) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + + VECTOR_ARITH_TAC);; + + +(* QXSKIIT *) + +let QXSKIIT = prove(`!(vf:A->real^N) b . FINITE (IMAGE vf (:A)) /\ + ~affine_dependent (IMAGE vf (:A)) /\ (!i j. (vf i = vf j) ==> (b i = b j)) + ==> (?!p. p IN affine hull (IMAGE vf (:A)) /\ (!i j. (p dot (vf i - vf j) = (b i - b j))))`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `S = IMAGE (vf:A->real^N) (:A)` THEN + SUBGOAL_THEN `?h:real^N->real. !i:A. h (vf i) = b i` CHOOSE_TAC THENL + [ + EXISTS_TAC `\x:real^N. if x IN S then b (inverse (vf:A->real^N) x) else &0` THEN + EXPAND_TAC "S" THEN + REWRITE_TAC[IN_IMAGE; IN_UNIV] THEN + GEN_TAC THEN + SUBGOAL_THEN `?x:A. vf i = (vf x):real^N` (fun th -> REWRITE_TAC[th]) THENL + [ + EXISTS_TAC `i:A` THEN REWRITE_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[inverse] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MESON_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`S:real^N->bool`; `\x:real^N. (h:real^N->real) x`] UNIQUE_SOLUTION_AFFINE_INDEPENDENT) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + EXPAND_TAC "S" THEN + REWRITE_TAC[IN_IMAGE] THEN + MP_TAC UNIV_NOT_EMPTY THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`(vf:A->real^N) x`; `x:A`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[] THEN + SUBGOAL_THEN `!p. (!x y:real^N. x IN S /\ y IN S ==> p dot (x - y) = h x - h y) <=> (!i j:A. p dot (vf i - vf j) = b i - b j)` MP_TAC THENL + [ + GEN_TAC THEN EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + POP_ASSUM (MP_TAC o SPECL [`(vf:A->real^N) i`; `(vf:A->real^N) j`]) THEN + EXPAND_TAC "S" THEN + ASM_REWRITE_TAC[IN_IMAGE; IN_UNIV] THEN + DISCH_THEN MATCH_MP_TAC THEN + CONJ_TAC THENL [ EXISTS_TAC `i:A`; EXISTS_TAC `j:A` ] THEN REWRITE_TAC[]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + EXPAND_TAC "S" THEN + REWRITE_TAC[IN_IMAGE; IN_UNIV] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) + );; + + + +(*******************************************) + +(***********) +(* OAPVION *) +(***********) + + +let CIRCUMCENTER_lemma = prove(`!S:real^N->bool. ~(S = {}) /\ ~affine_dependent S ==> + ?!p. p IN affine hull S /\ + (!x y. x IN S /\ y IN S ==> dist (p,x) = dist (p,y))`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`S:real^N->bool`; `\v:real^N. (v dot v) / &2`] UNIQUE_SOLUTION_AFFINE_INDEPENDENT) THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + REWRITE_TAC[DIST_EQ; dist; NORM_POW_2] THEN + REWRITE_TAC[DOT_LSUB; DOT_RSUB; DOT_SYM] THEN + REWRITE_TAC[REAL_ARITH `p2 - px - (px - x2) = p2 - py - (py - y2) <=> px - py = x2 / &2 - y2 / &2`] THEN + ONCE_REWRITE_TAC[GSYM DOT_RSUB] THEN + ASM_REWRITE_TAC[]);; + + +let CIRCUMCENTER_LEMMA = prove(`!S:real^N->bool. ~(S = {}) /\ ~affine_dependent S ==> + ?!p. p IN affine hull S /\ + (?c. !w. w IN S ==> c = dist (p,w))`, + GEN_TAC THEN DISCH_THEN (MP_TAC o MATCH_MP CIRCUMCENTER_lemma) THEN + SUBGOAL_THEN `!p. (!x y:real^N. x IN S /\ y IN S ==> dist (p,x) = dist (p,y)) <=> (?c. !w. w IN S ==> c = dist (p,w))` ASSUME_TAC THENL + [ + GEN_TAC THEN EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + ASM_CASES_TAC `S:real^N->bool = {}` THEN ASM_REWRITE_TAC[NOT_IN_EMPTY] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + STRIP_TAC THEN + EXISTS_TAC `dist (p,x:real^N)` THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `c:real` THEN + REWRITE_TAC[EQ_SYM_EQ] THEN + CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]);; + + + +let OAPVION1 = prove(`!(S:real^N->bool). ~(S = {}) /\ ~affine_dependent S ==> + (circumcenter S) IN (affine hull S)`, + GEN_TAC THEN DISCH_THEN (MP_TAC o MATCH_MP CIRCUMCENTER_LEMMA) THEN + REWRITE_TAC[circumcenter; IN] THEN + MESON_TAC[]);; + + + +let OAPVION2 = prove(`!(S:real^N->bool). ~affine_dependent S ==> + (!w. w IN S ==> (radV S = dist(circumcenter S, w)))`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `~(S:real^N->bool = {})` ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + EXISTS_TAC `w:real^N` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MP_TAC (SPEC `S:real^N->bool` CIRCUMCENTER_LEMMA) THEN + ASM_REWRITE_TAC[IN; radV; EXISTS_UNIQUE] THEN + STRIP_TAC THEN + SUBGOAL_THEN `circumcenter S = p:real^N` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[circumcenter] THEN + MATCH_MP_TAC SELECT_UNIQUE THEN + ASM_MESON_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC SELECT_UNIQUE THEN + X_GEN_TAC `r:real` THEN + EQ_TAC THENL + [ + REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `w:real^N`) THEN + UNDISCH_TAC `w:real^N IN S` THEN + SIMP_TAC[IN]; + ALL_TAC + ] THEN + + BETA_TAC THEN + REMOVE_ASSUM THEN + FIRST_ASSUM (MP_TAC o SPEC `w:real^N`) THEN + UNDISCH_TAC `w:real^N IN S` THEN + SIMP_TAC[IN] THEN + DISCH_TAC THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN DISCH_TAC THEN + ASM_REWRITE_TAC[]);; + + + +let OAPVION3 = prove(`!(S:real^N->bool). ~affine_dependent S ==> + (!p. (p IN affine hull S) /\ (?c. !w. (w IN S) ==> (dist(p,w) = c)) ==> (p = circumcenter S))`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `~(S:real^N->bool = {})` ASSUME_TAC THENL + [ + DISCH_TAC THEN + UNDISCH_TAC `p:real^N IN affine hull S` THEN + ASM_REWRITE_TAC[AFFINE_HULL_EMPTY; NOT_IN_EMPTY]; + ALL_TAC + ] THEN + + MP_TAC (SPEC `S:real^N->bool` CIRCUMCENTER_LEMMA) THEN + ASM_REWRITE_TAC[EXISTS_UNIQUE; circumcenter] THEN + REPEAT STRIP_TAC THEN + + REPEAT (POP_ASSUM MP_TAC) THEN REWRITE_TAC[IN] THEN REPEAT DISCH_TAC THEN + + MATCH_MP_TAC (GSYM SELECT_UNIQUE) THEN + BETA_TAC THEN GEN_TAC THEN EQ_TAC THEN DISCH_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + EXISTS_TAC `c:real` THEN + UNDISCH_TAC `!w:real^N. S w ==> dist (p,w) = c` THEN + SIMP_TAC[EQ_SYM_EQ]; + ALL_TAC + ] THEN + + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `p':real^N` THEN + CONJ_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC EQ_SYM THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + EXISTS_TAC `c:real` THEN + UNDISCH_TAC `!w:real^N. S w ==> dist (p,w) = c` THEN + SIMP_TAC[EQ_SYM_EQ]);; + + +let CIRCUMCENTER_1 = prove(`!x:real^N. circumcenter {x} = x`, + GEN_TAC THEN + MP_TAC (SPEC `{x:real^N}` OAPVION3) THEN + REWRITE_TAC[AFFINE_INDEPENDENT_1; AFFINE_HULL_SING; IN_SING] THEN + DISCH_THEN (fun th -> MATCH_MP_TAC (GSYM th)) THEN + REWRITE_TAC[] THEN + EXISTS_TAC `&0` THEN + SIMP_TAC[DIST_REFL]);; + + +let CIRCUMCENTER_NOT_EQ = prove(`!S:real^N->bool. ~affine_dependent S /\ 1 < CARD S ==> + !x. x IN S ==> ~(circumcenter S = x)`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `?y. y IN S DELETE (x:real^N)` MP_TAC THENL + [ + REWRITE_TAC[MEMBER_NOT_EMPTY] THEN + DISCH_THEN (MP_TAC o AP_TERM `\s:real^N->bool. CARD s`) THEN + REWRITE_TAC[CARD_CLAUSES] THEN + MP_TAC (ISPECL [`x:real^N`; `S:real^N->bool`] CARD_DELETE) THEN + ASM_SIMP_TAC[AFFINE_INDEPENDENT_IMP_FINITE] THEN + UNDISCH_TAC `1 < CARD (S:real^N->bool)` THEN + ARITH_TAC; + ALL_TAC + ] THEN + + REWRITE_TAC[IN_DELETE] THEN + STRIP_TAC THEN + MP_TAC (SPEC `S:real^N->bool` OAPVION2) THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + FIRST_ASSUM (MP_TAC o SPEC `x:real^N`) THEN + REWRITE_TAC[DIST_REFL] THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `y:real^N`) THEN + ASM_REWRITE_TAC[EQ_SYM_EQ; DIST_EQ_0]);; + + +let CIRCUMCENTER_TRANSLATION = prove(`!s (a:real^N). ~(s = {}) /\ ~affine_dependent s ==> + circumcenter (IMAGE (\x. a + x) s) = a + circumcenter s`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC `IMAGE (\x:real^N. a + x) s` OAPVION3) THEN + ASM_REWRITE_TAC[AFFINE_DEPENDENT_TRANSLATION_EQ] THEN + DISCH_THEN (fun th -> MATCH_MP_TAC (GSYM th)) THEN + CONJ_TAC THENL + [ + REWRITE_TAC[AFFINE_HULL_TRANSLATION; IN_IMAGE] THEN + EXISTS_TAC `circumcenter (s:real^N->bool)` THEN + MP_TAC (SPEC `s:real^N->bool` OAPVION1) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + EXISTS_TAC `radV (s:real^N->bool)` THEN + REWRITE_TAC[IN_IMAGE] THEN + REPEAT STRIP_TAC THEN + MP_TAC (SPEC `s:real^N->bool` OAPVION2) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `x:real^N`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[dist] THEN + AP_TERM_TAC THEN + VECTOR_ARITH_TAC);; + + + + +let RADV_TRANSLATION = prove(`!s (a:real^N). ~affine_dependent s ==> + radV (IMAGE (\x. a + x) s) = radV s`, + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `s:real^N->bool = {}` THENL + [ + ASM_REWRITE_TAC[IMAGE_CLAUSES]; + ALL_TAC + ] THEN + + MP_TAC (SPEC `IMAGE (\x:real^N. a + x) s` OAPVION2) THEN + ASM_REWRITE_TAC[AFFINE_DEPENDENT_TRANSLATION_EQ] THEN + FIRST_ASSUM MP_TAC THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + STRIP_TAC THEN + DISCH_THEN (MP_TAC o SPEC `a + x:real^N`) THEN + ANTS_TAC THENL + [ + REWRITE_TAC[IN_IMAGE] THEN + EXISTS_TAC `x:real^N` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ASM_SIMP_TAC[CIRCUMCENTER_TRANSLATION; dist; VECTOR_ARITH `(a + b) - (a + x) = b - x:real^N`] THEN + REWRITE_TAC[GSYM dist] THEN + MATCH_MP_TAC EQ_SYM THEN + + MP_TAC (SPEC `s:real^N->bool` OAPVION2) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `x:real^N`) THEN + ASM_REWRITE_TAC[]);; + + + + + +(**************************************) + +(***********) +(* MHFTTZN *) +(***********) + + +let AFF_INTER_SUBSET_INTER_AFF = prove(`!s t:real^N->bool. affine hull (s INTER t) SUBSET affine hull s INTER affine hull t`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[SUBSET_INTER] THEN + CONJ_TAC THEN MATCH_MP_TAC HULL_MONO THEN REWRITE_TAC[INTER_SUBSET]);; + + + +let MHFTTZN_lemma = prove(`!V ul k. packing V /\ barV V k ul ==> + affine hull voronoi_list V ul = INTERS {bis (HD ul) u | u | u IN set_of_list ul}`, + REPEAT GEN_TAC THEN + SPEC_TAC (`ul:(real^3)list`, `ul:(real^3)list`) THEN + SPEC_TAC (`k:num`, `k:num`) THEN + INDUCT_TAC THENL + [ + REWRITE_TAC[BARV; VORONOI_NONDG; ARITH] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `UNIV:real^3->bool` THEN + REWRITE_TAC[VORONOI_LIST; VORONOI_SET] THEN + MP_TAC (ISPEC `ul:(real^3)list` LENGTH_1_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th]) THEN + REWRITE_TAC[set_of_list; IN_SING; HD] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC CONTAINS_BALL_AFFINE_HULL THEN + SUBGOAL_THEN `INTERS {voronoi_closed V v | v:real^3 = HD ul} = voronoi_closed V (HD ul)` (fun th -> REWRITE_TAC[th]) THENL + [ + SET_TAC[]; + ALL_TAC + ] THEN + EXISTS_TAC `(HD ul):real^3` THEN + MATCH_MP_TAC VORONOI_CLOSED_CONTAINS_BALL THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `INTERS {bis (HD ul) u | u | u:real^3 = HD ul} = bis (HD ul) (HD ul)` (fun th -> REWRITE_TAC[th]) THENL + [ + SET_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[bis] THEN + SET_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `SUC k <= 3` ASSUME_TAC THENL + [ + MATCH_MP_TAC BARV_IMP_K_LE_3 THEN + EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `ul:(real^3)list` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ABBREV_TAC `vl:(real^3)list = BUTLAST ul` THEN + POP_ASSUM (LABEL_TAC "vl") THEN + + SUBGOAL_THEN `LENGTH (ul:(real^3)list) = k + 2` ASSUME_TAC THENL + [ + UNDISCH_TAC `barV V (SUC k) ul` THEN + REWRITE_TAC[BARV] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `truncate_simplex k (ul:(real^3)list) = vl` (LABEL_TAC "vl2") THENL + [ + MP_TAC (ISPEC `ul:(real^3)list` TRUNCATE_SIMPLEX_EQ_BUTLAST) THEN + ASM_REWRITE_TAC[ARITH_RULE `2 <= k + 2`; ARITH_RULE `(k + 2) - 2 = k`]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `barV V k vl` ASSUME_TAC THENL + [ + REMOVE_THEN "vl2" (fun th -> REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC TRUNCATE_SIMPLEX_BARV THEN + EXISTS_TAC `SUC k` THEN + ASM_SIMP_TAC[ARITH_RULE `k <= SUC k`]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `vl:(real^3)list`) THEN + ASM_REWRITE_TAC[] THEN + + SUBGOAL_THEN `HD vl = (HD ul):real^3` ASSUME_TAC THENL + [ + EXPAND_TAC "vl" THEN + MATCH_MP_TAC HD_TRUNCATE_SIMPLEX THEN + UNDISCH_TAC `barV V (SUC k) ul` THEN + REWRITE_TAC[BARV] THEN + ARITH_TAC; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + + ABBREV_TAC `A0 = INTERS {bis (HD ul) u | u | u:real^3 IN set_of_list vl}` THEN + ABBREV_TAC `A1 = INTERS {bis (HD ul) u | u | u:real^3 IN set_of_list ul}` THEN + + SUBGOAL_THEN `voronoi_list V ul = voronoi_list V vl INTER bis (HD ul) (LAST ul)` (LABEL_TAC "B1") THENL + [ + MP_TAC (SPECL [`V:real^3->bool`; `vl:(real^3)list`; `LAST ul:real^3`; `HD vl:real^3`; `TL vl:(real^3)list`] VORONOI_LIST_INTER_BIS) THEN + SUBGOAL_THEN `APPEND vl [LAST ul:real^3] = ul` (fun th -> REWRITE_TAC[th]) THENL + [ + REMOVE_THEN "vl" (fun th -> REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC APPEND_BUTLAST_LAST THEN + ASM_REWRITE_TAC[GSYM LENGTH_EQ_NIL] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + UNDISCH_TAC `HD vl = HD ul:real^3` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + DISCH_THEN (fun th -> MATCH_MP_TAC (GSYM th)) THEN + MP_TAC (SPECL [`V:real^3->bool`; `k:num`; `vl:(real^3)list`] BARV_SUBSET) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + + CONJ_TAC THENL + [ + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `set_of_list (ul:(real^3)list)` THEN + MP_TAC (SPECL [`V:real^3->bool`; `SUC k`; `ul:(real^3)list`] BARV_SUBSET) THEN + ASM_SIMP_TAC[] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + REWRITE_TAC[IN_SET_OF_LIST] THEN + MP_TAC (ISPEC `ul:(real^3)list` LAST_EL) THEN + ASM_REWRITE_TAC[GSYM LENGTH_EQ_NIL; ARITH_RULE `~(k + 2 = 0)`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MATCH_MP_TAC MEM_EL THEN + ASM_REWRITE_TAC[] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + MP_TAC (ISPEC `vl:(real^3)list` LENGTH_IMP_CONS) THEN + ANTS_TAC THENL + [ + UNDISCH_TAC `barV V k vl` THEN + REWRITE_TAC[BARV] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + STRIP_TAC THEN + ASM_REWRITE_TAC[HD; TL]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `A0 INTER bis ((HD ul):real^3) (LAST ul) = A1` (LABEL_TAC "A1") THENL + [ + EXPAND_TAC "A0" THEN EXPAND_TAC "A1" THEN + SUBGOAL_THEN `set_of_list ul = set_of_list vl UNION {LAST ul:real^3}` (fun th -> REWRITE_TAC[th]) THENL + [ + MP_TAC (ISPEC `ul:(real^3)list` APPEND_BUTLAST_LAST) THEN + ASM_REWRITE_TAC[GSYM LENGTH_EQ_NIL; ARITH_RULE `~(k + 2 = 0)`] THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [SYM th]) THEN + REWRITE_TAC[SET_OF_LIST_APPEND; set_of_list]; + ALL_TAC + ] THEN + SET_TAC[]; + ALL_TAC + ] THEN + + ASM_CASES_TAC `A1 = A0:real^3->bool` THENL + [ + SUBGOAL_THEN `voronoi_list V ul = voronoi_list V vl` (fun th -> ASM_REWRITE_TAC[th]) THEN + SUBGOAL_THEN `voronoi_list V vl = voronoi_list V vl INTER A0` MP_TAC THENL + [ + MATCH_MP_TAC (SET_RULE `A SUBSET B ==> A = A INTER B:A->bool`) THEN + MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `affine hull voronoi_list V vl` THEN + ASM_REWRITE_TAC[HULL_SUBSET; SUBSET_REFL]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + ONCE_ASM_REWRITE_TAC[] THEN + ASM_REWRITE_TAC[INTER_ASSOC]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `affine (A1:real^3->bool)` ASSUME_TAC THENL + [ + REMOVE_THEN "A1" (fun th -> ALL_TAC) THEN + EXPAND_TAC "A1" THEN + MATCH_MP_TAC AFFINE_INTERS THEN + REWRITE_TAC[IN_ELIM_THM; BIS_EQ_HYPERPLANE] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[AFFINE_HYPERPLANE]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `A1:real^3->bool = affine hull A1` (fun th -> ONCE_REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC EQ_SYM THEN + ASM_REWRITE_TAC[AFFINE_HULL_EQ]; + ALL_TAC + ] THEN + + MATCH_MP_TAC AFF_DIM_EQ_AFFINE_HULL THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `affine hull voronoi_list V ul` THEN + ASM_REWRITE_TAC[HULL_SUBSET] THEN + MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `affine hull (voronoi_list V vl) INTER affine hull (bis (HD ul) (LAST ul))` THEN + ASM_REWRITE_TAC[AFF_INTER_SUBSET_INTER_AFF] THEN + SUBGOAL_THEN `affine hull bis ((HD ul):real^3) (LAST ul) = bis (HD ul) (LAST ul)` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[AFFINE_HULL_EQ] THEN + REWRITE_TAC[BIS_EQ_HYPERPLANE; AFFINE_HYPERPLANE]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[SUBSET_REFL]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `aff_dim (voronoi_list V ul) = &(3 - SUC k)` (fun th -> REWRITE_TAC[th]) THENL + [ + UNDISCH_TAC `barV V (SUC k) ul` THEN + REWRITE_TAC[BARV; VORONOI_NONDG] THEN + STRIP_TAC THEN + POP_ASSUM (MP_TAC o SPEC `ul:(real^3)list`) THEN + ASM_REWRITE_TAC[INITIAL_SUBLIST_REFL; ARITH_RULE `0 < k + 2`] THEN + ASM_SIMP_TAC[GSYM INT_OF_NUM_SUB] THEN + REWRITE_TAC[GSYM INT_OF_NUM_ADD; ADD1] THEN + INT_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `aff_dim (A1:real^3->bool) = aff_dim (A0:real^3->bool) - &1 \/ aff_dim A1 = -- &1` MP_TAC THENL + [ + USE_THEN "A1" (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[BIS_EQ_HYPERPLANE] THEN + ABBREV_TAC `a:real^3 = &2 % (LAST ul - HD ul)` THEN + ABBREV_TAC `b = LAST ul dot LAST ul - HD ul dot HD (ul:(real^3)list)` THEN + MP_TAC (ISPECL [`a:real^3`; `b:real`; `A0:real^3->bool`] AFF_DIM_AFFINE_INTER_HYPERPLANE) THEN + ANTS_TAC THENL + [ + EXPAND_TAC "A0" THEN + MATCH_MP_TAC AFFINE_INTERS THEN + REWRITE_TAC[IN_ELIM_THM; BIS_EQ_HYPERPLANE] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[AFFINE_HYPERPLANE]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + COND_CASES_TAC THEN REWRITE_TAC[] THEN + COND_CASES_TAC THEN REWRITE_TAC[] THEN + + POP_ASSUM MP_TAC THEN + EXPAND_TAC "a" THEN EXPAND_TAC "b" THEN + REWRITE_TAC[GSYM BIS_EQ_HYPERPLANE] THEN + DISCH_TAC THEN + SUBGOAL_THEN `A0 = A1:real^3->bool` MP_TAC THENL + [ + REMOVE_THEN "A1" (fun th -> REWRITE_TAC[SYM th]) THEN + POP_ASSUM MP_TAC THEN + SET_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + UNDISCH_TAC `affine hull voronoi_list V vl = A0:real^3->bool` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + UNDISCH_TAC `barV V k vl` THEN + REWRITE_TAC[BARV; VORONOI_NONDG; AFF_DIM_AFFINE_HULL] THEN + STRIP_TAC THEN + POP_ASSUM (MP_TAC o SPEC `vl:(real^3)list`) THEN + ASM_REWRITE_TAC[INITIAL_SUBLIST_REFL; ARITH_RULE `0 < k + 1`] THEN + ASM_SIMP_TAC[GSYM INT_OF_NUM_SUB] THEN + ASM_REWRITE_TAC[GSYM INT_OF_NUM_ADD; ADD1] THEN + INT_ARITH_TAC; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[GSYM INT_OF_NUM_SUB] THEN + UNDISCH_TAC `SUC k <= 3` THEN + REWRITE_TAC[GSYM INT_OF_NUM_LE] THEN + INT_ARITH_TAC);; + + + +let MHFTTZN_lemma2 = prove(`!V ul k. packing V /\ barV V k ul ==> + aff_dim (set_of_list ul) = &k /\ + (!u v. u IN affine hull voronoi_list V ul /\ v IN affine hull (set_of_list ul) + ==> (u - circumcenter (set_of_list ul)) dot (v - circumcenter (set_of_list ul)) = &0)`, + REPEAT GEN_TAC THEN + SPEC_TAC (`ul:(real^3)list`, `ul:(real^3)list`) THEN + SPEC_TAC (`k:num`, `k:num`) THEN + INDUCT_TAC THENL + [ + REWRITE_TAC[BARV; ARITH] THEN + GEN_TAC THEN STRIP_TAC THEN + MP_TAC (ISPEC `ul:(real^3)list` LENGTH_1_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th]) THEN + REWRITE_TAC[set_of_list; CIRCUMCENTER_1; AFFINE_HULL_SING; IN_SING] THEN + SIMP_TAC[AFF_DIM_SING; VECTOR_SUB_REFL; DOT_RZERO]; + ALL_TAC + ] THEN + + GEN_TAC THEN DISCH_THEN STRIP_ASSUME_TAC THEN + SUBGOAL_THEN `SUC k <= 3` ASSUME_TAC THENL + [ + MATCH_MP_TAC BARV_IMP_K_LE_3 THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `ul:(real^3)list`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ABBREV_TAC `vl:(real^3)list = BUTLAST ul` THEN + POP_ASSUM (LABEL_TAC "vl") THEN + + SUBGOAL_THEN `LENGTH (ul:(real^3)list) = k + 2` ASSUME_TAC THENL + [ + UNDISCH_TAC `barV V (SUC k) ul` THEN + REWRITE_TAC[BARV] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `truncate_simplex k (ul:(real^3)list) = vl` (LABEL_TAC "vl2") THENL + [ + MP_TAC (ISPEC `ul:(real^3)list` TRUNCATE_SIMPLEX_EQ_BUTLAST) THEN + ASM_REWRITE_TAC[ARITH_RULE `2 <= k + 2`; ARITH_RULE `(k + 2) - 2 = k`]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `barV V k vl` ASSUME_TAC THENL + [ + REMOVE_THEN "vl2" (fun th -> REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC TRUNCATE_SIMPLEX_BARV THEN + EXISTS_TAC `SUC k` THEN + ASM_SIMP_TAC[ARITH_RULE `k <= SUC k`]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `vl:(real^3)list`) THEN + ANTS_TAC THENL + [ + ASM_SIMP_TAC[ARITH_RULE `SUC k <= 3 ==> k <= 3`]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `HD vl = (HD ul):real^3` ASSUME_TAC THENL + [ + EXPAND_TAC "vl" THEN + MATCH_MP_TAC HD_TRUNCATE_SIMPLEX THEN + UNDISCH_TAC `barV V (SUC k) ul` THEN + REWRITE_TAC[BARV] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_THEN STRIP_ASSUME_TAC THEN + SUBGOAL_THEN `aff_dim (set_of_list (ul:(real^3)list)) = &(SUC k)` ASSUME_TAC THENL + [ + ASM_CASES_TAC `&(SUC k) <= aff_dim (set_of_list (ul:(real^3)list))` THENL + [ + MP_TAC (ISPEC `set_of_list (ul:(real^3)list)` AFF_DIM_LE_CARD) THEN + REWRITE_TAC[FINITE_SET_OF_LIST] THEN + MP_TAC (ISPEC `ul:(real^3)list` CARD_SET_OF_LIST_LE) THEN + POP_ASSUM MP_TAC THEN + ASM_REWRITE_TAC[GSYM INT_OF_NUM_LE; GSYM INT_OF_NUM_ADD; ADD1] THEN + INT_ARITH_TAC; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN REWRITE_TAC[INT_NOT_LE] THEN DISCH_TAC THEN + SUBGOAL_THEN `set_of_list ul = (LAST ul) INSERT (set_of_list vl):real^3->bool` ASSUME_TAC THENL + [ + MP_TAC (ISPEC `ul:(real^3)list` APPEND_BUTLAST_LAST) THEN + ASM_REWRITE_TAC[GSYM LENGTH_EQ_NIL; ARITH_RULE `~(k + 2 = 0)`] THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [SYM th]) THEN + REWRITE_TAC[SET_OF_LIST_APPEND; set_of_list] THEN + REWRITE_TAC[EXTENSION; IN_UNION; IN_INSERT; NOT_IN_EMPTY; DISJ_SYM]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `LAST ul IN affine hull (set_of_list vl):real^3->bool` ASSUME_TAC THENL + [ + UNDISCH_TAC `aff_dim (set_of_list (ul:(real^3)list)) < &(SUC k)` THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + DISCH_TAC THEN + MP_TAC (ISPECL [`LAST ul:real^3`; `set_of_list vl:real^3->bool`] AFF_DIM_INSERT) THEN + ASM_REWRITE_TAC[ADD1; GSYM INT_OF_NUM_ADD] THEN + INT_ARITH_TAC; + ALL_TAC + ] THEN + + ABBREV_TAC `y:real^3 = LAST ul` THEN + ABBREV_TAC `q:real^3 = circumcenter (set_of_list vl)` THEN + + SUBGOAL_THEN `affine hull voronoi_list V vl SUBSET affine hull voronoi_list V ul` MP_TAC THENL + [ + SUBGOAL_THEN `!p. p IN affine hull voronoi_list V vl ==> (p - q) dot (y - q) = &0` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!p. p IN affine hull voronoi_list V vl ==> &2 * ((y - HD ul) dot q) = &2 * ((y - HD ul) dot p:real^3)` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + AP_TERM_TAC THEN + ONCE_REWRITE_TAC[REAL_ARITH `a = b <=> b - a = &0`] THEN + REWRITE_TAC[GSYM DOT_RSUB] THEN + GEN_REWRITE_TAC (LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV) [VECTOR_ARITH `y - u0:real^3 = (y - q) - (u0 - q)`] THEN + ONCE_REWRITE_TAC[DOT_LSUB] THEN + ASM_SIMP_TAC[DOT_SYM; REAL_ARITH `&0 - x = &0 <=> x = &0`] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `set_of_list vl:real^3->bool` THEN + REWRITE_TAC[HULL_SUBSET; IN_SET_OF_LIST] THEN + UNDISCH_TAC `HD vl = HD ul:real^3` THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ONCE_REWRITE_TAC[GSYM EL] THEN + MATCH_MP_TAC MEM_EL THEN + UNDISCH_TAC `barV V k vl` THEN + REWRITE_TAC[BARV] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `?w. w IN affine hull voronoi_list V ul` CHOOSE_TAC THENL + [ + REWRITE_TAC[MEMBER_NOT_EMPTY; AFFINE_HULL_EQ_EMPTY] THEN + DISCH_TAC THEN + UNDISCH_TAC `barV V (SUC k) ul` THEN + REWRITE_TAC[BARV; VORONOI_NONDG] THEN + STRIP_TAC THEN + POP_ASSUM (MP_TAC o SPEC `ul:(real^3)list`) THEN + ASM_REWRITE_TAC[INITIAL_SUBLIST_REFL; ARITH_RULE `0 < k + 2`; AFF_DIM_EMPTY; DE_MORGAN_THM] THEN + DISJ2_TAC THEN DISJ2_TAC THEN + UNDISCH_TAC `SUC k <= 3` THEN + REWRITE_TAC[GSYM INT_OF_NUM_ADD; GSYM INT_OF_NUM_LE; ADD1] THEN + INT_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `affine hull voronoi_list V ul = affine hull voronoi_list V vl INTER bis (HD ul) y` ASSUME_TAC THENL + [ + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `SUC k`] MHFTTZN_lemma) THEN + MP_TAC (SPECL [`V:real^3->bool`; `vl:(real^3)list`; `k:num`] MHFTTZN_lemma) THEN + ASM_SIMP_TAC[ARITH_RULE `SUC k <= 3 ==> k <= 3`] THEN + REPEAT DISCH_TAC THEN + SET_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[SUBSET_INTER; SUBSET_REFL; SUBSET] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[IN_INTER] THEN + REWRITE_TAC[BIS_EQ_HYPERPLANE; IN_ELIM_THM] THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `&2 % ((y:real^3) - HD ul) dot q` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC EQ_SYM THEN + REWRITE_TAC[DOT_LMUL] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `&2 % ((y:real^3) - HD ul) dot w` THEN + CONJ_TAC THENL + [ + REWRITE_TAC[DOT_LMUL] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + UNDISCH_TAC `w:real^3 IN affine hull voronoi_list V ul` THEN + ASM_SIMP_TAC[IN_INTER]; + ALL_TAC + ] THEN + + UNDISCH_TAC `w:real^3 IN affine hull voronoi_list V ul` THEN + ASM_SIMP_TAC[IN_INTER; BIS_EQ_HYPERPLANE; IN_ELIM_THM]; + ALL_TAC + ] THEN + + DISCH_THEN (MP_TAC o MATCH_MP AFF_DIM_SUBSET) THEN + UNDISCH_TAC `barV V (SUC k) ul` THEN + UNDISCH_TAC `barV V k vl` THEN + REWRITE_TAC[BARV; VORONOI_NONDG] THEN + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + POP_ASSUM (MP_TAC o SPEC `ul:(real^3)list`) THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + POP_ASSUM (MP_TAC o SPEC `vl:(real^3)list`) THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + + REWRITE_TAC[INITIAL_SUBLIST_REFL; ARITH_RULE `0 < k + 1 /\ 0 < SUC k + 1`] THEN + STRIP_TAC THEN STRIP_TAC THEN + POP_ASSUM MP_TAC THEN REMOVE_ASSUM THEN REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[GSYM INT_OF_NUM_ADD; ADD1] THEN + REWRITE_TAC[AFF_DIM_AFFINE_HULL] THEN + INT_ARITH_TAC; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + + ABBREV_TAC `q:real^3 = circumcenter (set_of_list ul)` THEN + ABBREV_TAC `S:real^3->bool = affine hull set_of_list ul` THEN + + SUBGOAL_THEN `CARD (set_of_list (ul:(real^3)list)) = k + 2` ASSUME_TAC THENL + [ + SUBGOAL_THEN `CARD (set_of_list (ul:(real^3)list)) <= k + 2` MP_TAC THENL + [ + MATCH_MP_TAC LE_TRANS THEN + EXISTS_TAC `LENGTH (ul:(real^3)list)` THEN + REWRITE_TAC[CARD_SET_OF_LIST_LE] THEN + ASM_REWRITE_TAC[LE_REFL]; + ALL_TAC + ] THEN + MP_TAC (ISPEC `set_of_list (ul:(real^3)list)` AFF_DIM_LE_CARD) THEN + ASM_REWRITE_TAC[FINITE_SET_OF_LIST] THEN + REWRITE_TAC[GSYM INT_OF_NUM_ADD; ADD1; GSYM INT_OF_NUM_LE; GSYM INT_OF_NUM_EQ] THEN + INT_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `~affine_dependent (set_of_list ul:real^3->bool)` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[AFFINE_INDEPENDENT_IFF_CARD; FINITE_SET_OF_LIST] THEN + REWRITE_TAC[GSYM INT_OF_NUM_ADD; ADD1] THEN + INT_ARITH_TAC; + ALL_TAC + ] THEN + + MP_TAC (ISPEC `set_of_list ul:real^3->bool` OAPVION1) THEN + MP_TAC (ISPEC `set_of_list ul:real^3->bool` OAPVION2) THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[SET_OF_LIST_EQ_EMPTY; GSYM LENGTH_EQ_NIL] THEN + ARITH_TAC; + ALL_TAC + ] THEN + DISCH_TAC THEN + + SUBGOAL_THEN `IMAGE (\x:real^3. x - q) S = span {y - HD ul | y | y IN set_of_list ul}` ASSUME_TAC THENL + [ + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `span {y - q | y | y:real^3 IN set_of_list ul}` THEN + SUBGOAL_THEN `IMAGE (\x. x - q) S = span {y - q:real^3 | y IN set_of_list ul}` ASSUME_TAC THENL + [ + EXPAND_TAC "S" THEN + SUBGOAL_THEN `affine hull set_of_list ul = affine hull (q:real^3 INSERT set_of_list ul)` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC AFFINE_HULLS_EQ THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `q:real^3 INSERT set_of_list ul` THEN + REWRITE_TAC[HULL_SUBSET] THEN + SIMP_TAC[SUBSET; IN_INSERT]; + ALL_TAC + ] THEN + REWRITE_TAC[SUBSET; IN_INSERT] THEN + REPEAT STRIP_TAC THENL + [ + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `set_of_list ul:real^3->bool` THEN + ASM_REWRITE_TAC[HULL_SUBSET]; + ALL_TAC + ] THEN + + + SUBGOAL_THEN `span {y - q | y | y IN set_of_list ul} = span {y - q:real^3 | y | y IN (q INSERT set_of_list ul)}` (fun th -> REWRITE_TAC[th]) THENL + [ + SUBGOAL_THEN `{y - q:real^3 | y | y IN q INSERT set_of_list ul} = vec 0 INSERT {y - q | y IN set_of_list ul}` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[EXTENSION; IN_INSERT; IN_ELIM_THM] THEN + GEN_TAC THEN EQ_TAC THENL + [ + REPEAT STRIP_TAC THENL + [ + ASM_REWRITE_TAC[VECTOR_SUB_REFL]; + ALL_TAC + ] THEN + DISJ2_TAC THEN + EXISTS_TAC `y:real^3` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THENL + [ + EXISTS_TAC `q:real^3` THEN + ASM_REWRITE_TAC[VECTOR_SUB_REFL]; + ALL_TAC + ] THEN + + EXISTS_TAC `y:real^3` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[SPAN_INSERT_0]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`q:real^3`; `q:real^3 INSERT set_of_list ul`] DIFFS_AFFINE_HULL_SPAN) THEN + ANTS_TAC THENL + [ + REWRITE_TAC[IN_INSERT]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[EXTENSION; IN_IMAGE; IN_ELIM_THM; CONJ_SYM]; + ALL_TAC + ] THEN + + + ASM_REWRITE_TAC[] THEN + GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [GSYM SPAN_SPAN] THEN + MATCH_MP_TAC EQ_SYM THEN + MATCH_MP_TAC DIM_EQ_SPAN THEN + CONJ_TAC THENL + [ + REWRITE_TAC[SUBSET; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [VECTOR_ARITH `y - u = (y - q) - (u - q):real^3`] THEN + MATCH_MP_TAC SPAN_SUB THEN + CONJ_TAC THEN MATCH_MP_TAC IN_TRANS THEN EXISTS_TAC `{y - q:real^3 | y IN set_of_list ul}` THEN REWRITE_TAC[span; HULL_SUBSET; IN_ELIM_THM] THENL + [ + EXISTS_TAC `y:real^3` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + EXISTS_TAC `HD ul:real^3` THEN + REWRITE_TAC[] THEN + MATCH_MP_TAC HD_IN_SET_OF_LIST THEN + ASM_REWRITE_TAC[ARITH_RULE `1 <= k + 2`]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `dim (span {y - q:real^3 | y IN set_of_list ul}) = k + 1` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[GSYM INT_OF_NUM_EQ] THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `aff_dim (span {y - q:real^3 | y IN set_of_list ul})` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC (GSYM AFF_DIM_DIM_0) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `IMAGE (\x:real^3. x - q) S` THEN + REWRITE_TAC[HULL_SUBSET; IN_IMAGE] THEN + EXISTS_TAC `q:real^3` THEN + ASM_REWRITE_TAC[VECTOR_SUB_REFL]; + ALL_TAC + ] THEN + + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[VECTOR_ARITH `x - q = --q + x:real^3`] THEN + REWRITE_TAC[AFF_DIM_TRANSLATION_EQ] THEN + EXPAND_TAC "S" THEN + REWRITE_TAC[AFF_DIM_AFFINE_HULL] THEN + ASM_REWRITE_TAC[ADD1]; + ALL_TAC + ] THEN + + MATCH_MP_TAC LE_TRANS THEN + EXISTS_TAC `dim {y - HD ul:real^3 | y | y IN set_of_list ul DELETE HD ul}` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC (ARITH_RULE `a = k + 1 ==> k + 1 <= a`) THEN + SUBGOAL_THEN `k + 1 = CARD ({y - HD ul:real^3 | y | y IN set_of_list ul DELETE HD ul})` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `CARD (set_of_list ul DELETE ((HD ul):real^3))` THEN + CONJ_TAC THENL + [ + ASM_SIMP_TAC[FINITE_SET_OF_LIST; CARD_DELETE] THEN + MP_TAC (ISPEC `ul:(real^3)list` HD_IN_SET_OF_LIST) THEN + ASM_REWRITE_TAC[ARITH_RULE `1 <= k + 2`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ARITH_TAC; + ALL_TAC + ] THEN + + ONCE_REWRITE_TAC[GSYM IMAGE_LEMMA] THEN + MATCH_MP_TAC (GSYM CARD_IMAGE_INJ) THEN + CONJ_TAC THENL + [ + BETA_TAC THEN + SIMP_TAC[VECTOR_ARITH `y - u = x - u <=> y = x:real^3`]; + ALL_TAC + ] THEN + + MATCH_MP_TAC FINITE_SUBSET THEN + EXISTS_TAC `set_of_list ul:real^3->bool` THEN + REWRITE_TAC[FINITE_SET_OF_LIST; DELETE_SUBSET]; + ALL_TAC + ] THEN + + MATCH_MP_TAC DIM_EQ_CARD THEN + MP_TAC (ISPEC `set_of_list ul:real^3->bool` AFFINE_INDEPENDENT_IMP_INDEPENDENT) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN MATCH_MP_TAC THEN + MATCH_MP_TAC HD_IN_SET_OF_LIST THEN + ASM_REWRITE_TAC[ARITH_RULE `1 <= k + 2`]; + ALL_TAC + ] THEN + + MATCH_MP_TAC DIM_SUBSET THEN + SIMP_TAC[SUBSET; IN_ELIM_THM; IN_DELETE] THEN + REPEAT STRIP_TAC THEN + EXISTS_TAC `y:real^3` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ABBREV_TAC `w = v - q:real^3` THEN + SUBGOAL_THEN `w IN span {y - HD ul | y | y:real^3 IN set_of_list ul}` MP_TAC THENL + [ + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[IN_IMAGE] THEN + EXISTS_TAC `v:real^3` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REMOVE_ASSUM THEN + SPEC_TAC (`w:real^3`, `w:real^3`) THEN + REWRITE_TAC[GSYM orthogonal] THEN + MATCH_MP_TAC ORTHOGONAL_TO_SPAN THEN + + REWRITE_TAC[IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + + REWRITE_TAC[orthogonal] THEN + SUBGOAL_THEN `&0 = (norm (u - HD ul:real^3) pow 2 - norm (u - y) pow 2) / &2` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[REAL_ARITH `&0 = (a - b) / &2 <=> a = b`] THEN + REWRITE_TAC[GSYM dist; GSYM DIST_EQ] THEN + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `SUC k`] MHFTTZN_lemma) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + UNDISCH_TAC `u IN affine hull voronoi_list V ul` THEN + ASM_REWRITE_TAC[IN_INTERS; IN_ELIM_THM] THEN + DISCH_THEN (MP_TAC o SPEC `bis (HD ul) (y:real^3)`) THEN + ANTS_TAC THENL + [ + EXISTS_TAC `y:real^3` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[bis; IN_ELIM_THM]; + ALL_TAC + ] THEN + + GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [VECTOR_ARITH `u - x:real^3 = (u - q) - (x - q)`] THEN + REWRITE_TAC[NORM_POW_2] THEN + ONCE_REWRITE_TAC[DOT_LSUB] THEN + ONCE_REWRITE_TAC[DOT_RSUB] THEN + REWRITE_TAC[DOT_SQUARE_NORM; DOT_SYM] THEN + REWRITE_TAC[REAL_ARITH `uq - a - (a - u0q) - (uq - b - (b - yq)) = &2 * (b - a) + (u0q - yq)`] THEN + + SUBGOAL_THEN `norm (HD ul - q:real^3) pow 2 - norm (y - q) pow 2 = &0` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[REAL_ARITH `a - b = &0 <=> a = b`] THEN + REWRITE_TAC[GSYM dist; GSYM DIST_EQ] THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `radV (set_of_list ul:real^3->bool)` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC EQ_SYM THEN + REWRITE_TAC[DIST_SYM] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC HD_IN_SET_OF_LIST THEN + ASM_REWRITE_TAC[ARITH_RULE `1 <= k + 2`]; + ALL_TAC + ] THEN + + REWRITE_TAC[DIST_SYM] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[GSYM DOT_RSUB] THEN + REWRITE_TAC[VECTOR_ARITH `y - q - (u0 - q):real^3 = y - u0`] THEN + REWRITE_TAC[GSYM DOT_LSUB] THEN + REAL_ARITH_TAC);; + + + +(* MHFTTZN1 *) + +let MHFTTZN1 = prove(`!V ul k. packing V /\ barV V k ul ==> + aff_dim (set_of_list ul) = &k`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `k:num`] MHFTTZN_lemma2) THEN + ASM_SIMP_TAC[]);; + + +(* MHFTTZN2 *) + +let MHFTTZN2 = prove(`!V ul k. packing V /\ barV V k ul ==> + (!p. p IN affine hull voronoi_list V ul <=> (!u. (u IN set_of_list ul ==> p IN bis (HD ul) u)))`, + REPEAT GEN_TAC THEN + DISCH_THEN (MP_TAC o MATCH_MP MHFTTZN_lemma) THEN + REWRITE_TAC[EXTENSION; IN_INTERS; IN_ELIM_THM] THEN + SET_TAC[]);; + + +(* MHFTTZN3 *) + +let MHFTTZN3 = prove(`!V ul k. packing V /\ barV V k ul ==> + ((affine hull (voronoi_list V ul)) INTER (affine hull (set_of_list ul)) = + { circumcenter (set_of_list ul) } )`, + REPEAT GEN_TAC THEN + DISCH_TAC THEN + FIRST_ASSUM (MP_TAC o MATCH_MP MHFTTZN_lemma) THEN + FIRST_ASSUM (MP_TAC o MATCH_MP MHFTTZN_lemma2) THEN + DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC (fun th -> ALL_TAC)) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[EXTENSION; IN_SING] THEN + GEN_TAC THEN + + SUBGOAL_THEN `LENGTH (ul:(real^3)list) = k + 1` ASSUME_TAC THENL + [ + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[BARV]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `HD ul:real^3 IN set_of_list ul` ASSUME_TAC THENL + [ + MATCH_MP_TAC HD_IN_SET_OF_LIST THEN + ASM_REWRITE_TAC[ARITH_RULE `1 <= k + 1`]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `CARD (set_of_list (ul:(real^3)list)) = k + 1` ASSUME_TAC THENL + [ + SUBGOAL_THEN `CARD (set_of_list (ul:(real^3)list)) <= k + 1` MP_TAC THENL + [ + MATCH_MP_TAC LE_TRANS THEN + EXISTS_TAC `LENGTH (ul:(real^3)list)` THEN + ASM_REWRITE_TAC[CARD_SET_OF_LIST_LE; LE_REFL]; + ALL_TAC + ] THEN + MP_TAC (ISPEC `set_of_list (ul:(real^3)list)` AFF_DIM_LE_CARD) THEN + ASM_REWRITE_TAC[FINITE_SET_OF_LIST] THEN + REWRITE_TAC[GSYM INT_OF_NUM_ADD; ADD1; GSYM INT_OF_NUM_LE; GSYM INT_OF_NUM_EQ] THEN + INT_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `~affine_dependent (set_of_list ul:real^3->bool)` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[AFFINE_INDEPENDENT_IFF_CARD; FINITE_SET_OF_LIST] THEN + REWRITE_TAC[GSYM INT_OF_NUM_ADD] THEN + INT_ARITH_TAC; + ALL_TAC + ] THEN + + REWRITE_TAC[IN_INTER; IN_INTERS; IN_ELIM_THM] THEN + EQ_TAC THENL + [ + REPEAT STRIP_TAC THEN + MP_TAC (ISPEC `set_of_list ul:real^3->bool` OAPVION3) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + EXISTS_TAC `dist (x, HD ul:real^3)` THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `bis (HD ul) (w:real^3)`) THEN + ANTS_TAC THENL + [ + EXISTS_TAC `w:real^3` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SIMP_TAC[bis; IN_ELIM_THM]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `~(set_of_list ul = {}:real^3->bool)` ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + EXISTS_TAC `HD ul:real^3` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[OAPVION1] THEN + REPEAT STRIP_TAC THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[bis; IN_ELIM_THM] THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `radV (set_of_list ul:real^3->bool)` THEN + MP_TAC (ISPEC `set_of_list ul:real^3->bool` OAPVION2) THEN + ASM_REWRITE_TAC[DIST_SYM] THEN + DISCH_TAC THEN + + CONJ_TAC THENL + [ + MATCH_MP_TAC EQ_SYM THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]);; + + +(* MHFTTZN4 *) + +let MHFTTZN4 = prove(`!V ul k u v. packing V /\ barV V k ul /\ + u IN affine hull voronoi_list V ul /\ v IN affine hull (set_of_list ul) ==> + ((u - circumcenter (set_of_list ul)) dot (v - circumcenter (set_of_list ul)) = &0)`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `k:num`] MHFTTZN_lemma2) THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]);; + + +(*****************************************) + +(***********) +(* XYOFCGX *) +(***********) + + +let ARCV_GT_PI2 = prove(`!p u v:real^N. pi / &2 < arcV p u v <=> cos(arcV p u v) < &0`, + REPEAT GEN_TAC THEN + EQ_TAC THENL + [ + DISCH_TAC THEN + REWRITE_TAC[GSYM COS_PI2] THEN + MATCH_MP_TAC COS_MONO_LT THEN + ASM_REWRITE_TAC[ARCV_ANGLE; ANGLE_RANGE] THEN + MP_TAC PI_POS THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[REAL_NOT_LT; REAL_NOT_LE] THEN + DISCH_TAC THEN + MATCH_MP_TAC COS_POS_PI_LE THEN + ASM_SIMP_TAC[ARCV_ANGLE; PI_POS; ANGLE_RANGE; REAL_ARITH `&0 < pi /\ &0 <= x ==> --(pi / &2) <= x`]);; + + + +let XYOFCGX_lemma0 = prove(`!V S p w. packing V /\ S SUBSET V /\ ~affine_dependent S /\ + (p = circumcenter S) /\ (radV S < sqrt(&2)) /\ + w IN V DIFF S /\ dist (p,w) <= radV S /\ 1 < CARD S + ==> (!u. u IN S ==> pi / &2 < arcV p w u) /\ + (!u v. u IN S /\ v IN S /\ ~(u = v) ==> pi / &2 < arcV p u v)`, + REPEAT GEN_TAC THEN + REWRITE_TAC[packing; ARCV_GT_PI2] THEN + DISCH_THEN STRIP_ASSUME_TAC THEN + SUBGOAL_THEN `!p u w:real^3. ~(p = u) /\ ~(p = w) /\ dist (p,u) < sqrt(&2) /\ dist (p,w) < sqrt(&2) /\ &2 <= dist(u,w) ==> cos(arcV p u w) < &0` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + REWRITE_TAC[ARCV_ANGLE] THEN + MP_TAC (ISPECL [`p':real^3`; `u:real^3`; `w':real^3`] LAW_OF_COSINES) THEN + ABBREV_TAC `d0 = dist(u:real^3,w')` THEN + ABBREV_TAC `d1 = dist(p':real^3,u)` THEN + ABBREV_TAC `d2 = dist(p':real^3,w')` THEN + ABBREV_TAC `x = cos(angle (u:real^3,p',w'))` THEN + SUBGOAL_THEN `(d1 pow 2 + d2 pow 2) - d0 pow 2 < &0` ASSUME_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `a - b < &0 <=> a < b`] THEN + MATCH_MP_TAC REAL_LTE_TRANS THEN + EXISTS_TAC `&4` THEN + CONJ_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `&4 = &2 + &2`] THEN + MATCH_MP_TAC REAL_LT_ADD2 THEN + MP_TAC (SPEC `&2` SQRT_WORKS) THEN + REWRITE_TAC[REAL_ARITH `&0 <= &2`] THEN + DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC (fun th -> ONCE_REWRITE_TAC[SYM th])) THEN + REWRITE_TAC[GSYM REAL_LT_SQUARE_ABS] THEN + POP_ASSUM MP_TAC THEN + ONCE_REWRITE_TAC[GSYM REAL_ABS_REFL] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + EXPAND_TAC "d1" THEN EXPAND_TAC "d2" THEN + REWRITE_TAC[dist; REAL_ABS_NORM] THEN + ASM_REWRITE_TAC[GSYM dist]; + ALL_TAC + ] THEN + + REWRITE_TAC[REAL_ARITH `&4 = &2 pow 2`] THEN + REWRITE_TAC[GSYM REAL_LE_SQUARE_ABS; REAL_ARITH `abs(&2) = &2`] THEN + EXPAND_TAC "d0" THEN + REWRITE_TAC[dist; REAL_ABS_NORM] THEN + ASM_REWRITE_TAC[GSYM dist]; + ALL_TAC + ] THEN + + REWRITE_TAC[REAL_ARITH `d0 = d12 - x <=> x = d12 - d0:real`] THEN + DISCH_TAC THEN + MATCH_MP_TAC REAL_LT_LCANCEL_IMP THEN + EXISTS_TAC `&2 * d1 * d2` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LT_MUL THEN + REWRITE_TAC[REAL_ARITH `&0 < &2`] THEN + MATCH_MP_TAC REAL_LT_MUL THEN + EXPAND_TAC "d1" THEN EXPAND_TAC "d2" THEN + ASM_REWRITE_TAC[GSYM DIST_NZ]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[REAL_MUL_RZERO; GSYM REAL_MUL_ASSOC]; + ALL_TAC + ] THEN + + MP_TAC (ISPEC `S:real^3->bool` OAPVION2) THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + SUBGOAL_THEN `!x. x IN S ==> dist(p:real^3,x) < sqrt(&2)` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:real^3`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!u:real^3. u IN S ==> V u /\ ~(u = w)` (LABEL_TAC "A") THENL + [ + REPEAT STRIP_TAC THENL + [ + ONCE_REWRITE_TAC[GSYM IN] THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `S:real^3->bool` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + UNDISCH_TAC `u:real^3 IN S` THEN + UNDISCH_TAC `w:real^3 IN V DIFF S` THEN + ASM_SIMP_TAC[IN_DIFF]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `(V:real^3->bool) w` ASSUME_TAC THENL + [ + UNDISCH_TAC `w:real^3 IN V DIFF S` THEN + SIMP_TAC[IN_DIFF; IN]; + ALL_TAC + ] THEN + + CONJ_TAC THEN REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + SUBGOAL_THEN `~(circumcenter S = u:real^3)` ASSUME_TAC THENL + [ + MP_TAC (ISPEC `S:real^3->bool` CIRCUMCENTER_NOT_EQ) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + + REPEAT CONJ_TAC THENL + [ + DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `u:real^3`) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `u:real^3`) THEN + ASM_REWRITE_TAC[REAL_NOT_LT] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `&2` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_LSQRT THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `radV (S:real^3->bool)` THEN + ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `p = circumcenter S:real^3` THEN + DISCH_THEN (fun th -> ASM_REWRITE_TAC[SYM th]); + + REMOVE_THEN "A" (fun th -> ALL_TAC) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `u:real^3`) THEN + ASM_SIMP_TAC[]; + + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_SIMP_TAC[] + ]; + + ALL_TAC + ] THEN + + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_SIMP_TAC[CIRCUMCENTER_NOT_EQ] THEN + UNDISCH_TAC `p:real^3 = circumcenter S` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[]);; + + + +let CARD_1_IMP_SING = prove(`!s:A->bool. FINITE s /\ CARD s = 1 ==> ?x. s = {x}`, + REWRITE_TAC[GSYM HAS_SIZE] THEN + REWRITE_TAC[HAS_SIZE_1_EXISTS; EXISTS_UNIQUE] THEN + REPEAT STRIP_TAC THEN + EXISTS_TAC `x:A` THEN + REWRITE_TAC[EXTENSION; IN_SING] THEN + GEN_TAC THEN EQ_TAC THEN DISCH_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ASM_REWRITE_TAC[] + ]);; + + +(* CARD S <= 1 *) +let XYOFCGX_1 = prove(`!V S p. packing V /\ S SUBSET V /\ ~affine_dependent S /\ + p = circumcenter S /\ radV S < sqrt(&2) /\ + CARD S <= 1 ==> + (!u v. u IN S /\ v IN (V DIFF S) ==> dist (v,p) > dist (u,p))`, + REWRITE_TAC[ARITH_RULE `a <= 1 <=> a = 0 \/ a = 1`] THEN + REPEAT STRIP_TAC THENL + [ + MP_TAC (ISPEC `S:real^3->bool` CARD_EQ_0) THEN + ASM_SIMP_TAC[AFFINE_INDEPENDENT_IMP_FINITE] THEN + DISCH_TAC THEN + UNDISCH_TAC `u:real^3 IN S` THEN + ASM_REWRITE_TAC[NOT_IN_EMPTY]; + ALL_TAC + ] THEN + + MP_TAC (ISPEC `S:real^3->bool` Hypermap.set_one_point) THEN + ASM_SIMP_TAC[AFFINE_INDEPENDENT_IMP_FINITE] THEN + DISCH_THEN (MP_TAC o SPEC `u:real^3`) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_REWRITE_TAC[CIRCUMCENTER_1; DIST_REFL; GSYM DIST_NZ; real_gt] THEN + UNDISCH_TAC `v:real^3 IN V DIFF S` THEN + ASM_REWRITE_TAC[IN_DIFF; IN_SING] THEN + SIMP_TAC[]);; + + + +(* CARD S = 2 *) +let CIRCUMCENTER_2 = prove(`!a b:real^N. circumcenter {a, b} = midpoint (a,b)`, + REPEAT GEN_TAC THEN + MATCH_MP_TAC EQ_SYM THEN + MP_TAC (SPEC `{a,b:real^N}` OAPVION3) THEN + REWRITE_TAC[AFFINE_INDEPENDENT_2] THEN + DISCH_THEN MATCH_MP_TAC THEN + + CONJ_TAC THENL + [ + REWRITE_TAC[AFFINE_HULL_2; midpoint; IN_ELIM_THM] THEN + MAP_EVERY EXISTS_TAC [`inv(&2)`; `inv(&2)`] THEN + REWRITE_TAC[VECTOR_ADD_LDISTRIB] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + EXISTS_TAC `dist(a:real^N,b) / &2` THEN + REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY] THEN + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[DIST_MIDPOINT]);; + + +let CARD_2_IMP_DOUBLE = prove(`!s:A->bool. FINITE s /\ CARD s = 2 ==> (?a b. s = {a, b} /\ ~(a = b))`, + REWRITE_TAC[GSYM HAS_SIZE; HAS_SIZE_2_EXISTS] THEN + REPEAT STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`x:A`; `y:A`] THEN + ASM_REWRITE_TAC[EXTENSION; IN_INSERT; NOT_IN_EMPTY]);; + + + + +let XYOFCGX_2 = prove(`!V S p. packing V /\ S SUBSET V /\ ~affine_dependent S /\ + p = circumcenter S /\ radV S < sqrt(&2) /\ + CARD S = 2 ==> + (!u v. u IN S /\ v IN (V DIFF S) ==> dist (v,p) > dist (u,p))`, + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `dist (v,p:real^3) > dist(u,p)` THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN PURE_REWRITE_TAC[real_gt; REAL_NOT_LT; DIST_SYM] THEN DISCH_TAC THEN + SUBGOAL_THEN `dist (p:real^3,v) <= radV (S:real^3->bool)` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `dist (p,u:real^3)` THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[REAL_LE_LT] THEN DISJ2_TAC THEN + MP_TAC (ISPEC `S:real^3->bool` OAPVION2) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> MATCH_MP_TAC (GSYM th)) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`V:real^3->bool`; `S:real^3->bool`; `p:real^3`; `v:real^3`] XYOFCGX_lemma0) THEN + ASM_REWRITE_TAC[ARITH_RULE `1 < 2`] THEN + MP_TAC (ISPEC `S:real^3->bool`CARD_2_IMP_DOUBLE) THEN + ASM_SIMP_TAC[AFFINE_INDEPENDENT_IMP_FINITE] THEN + STRIP_TAC THEN + DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC (fun th -> ALL_TAC)) THEN + FIRST_ASSUM (MP_TAC o SPEC `a:real^3`) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `b:real^3`) THEN + ASM_REWRITE_TAC[IN_INSERT; CIRCUMCENTER_2; ARCV_ANGLE] THEN + REPEAT DISCH_TAC THEN + MP_TAC (ISPECL [`a:real^3`; `b:real^3`; `midpoint (a:real^3,b)`; `v:real^3`] ANGLES_ALONG_LINE) THEN + ASM_REWRITE_TAC[BETWEEN_MIDPOINT; MIDPOINT_EQ_ENDPOINT] THEN + ONCE_REWRITE_TAC[ANGLE_SYM] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC);; + + + +(* CARD S = 3 *) + +let ANGLE_GT_PI2 = prove(`!a b c:real^N. pi / &2 < angle (a,b,c) <=> (a - b) dot (c - b) < &0`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[angle; vector_angle] THEN + ASM_CASES_TAC `a - b = vec 0:real^N \/ c - b = vec 0` THEN ASM_REWRITE_TAC[] THENL + [ + REWRITE_TAC[REAL_LT_REFL; REAL_NOT_LT; REAL_LE_LT] THEN + DISJ2_TAC THEN + POP_ASSUM DISJ_CASES_TAC THEN ASM_REWRITE_TAC[DOT_LZERO; DOT_RZERO]; + ALL_TAC + ] THEN + + ABBREV_TAC `x = (a - b:real^N) dot (c - b)` THEN + ABBREV_TAC `y = norm (a - b:real^N) * norm (c - b)` THEN + SUBGOAL_THEN `-- &1 <= x / y /\ x / y <= &1` ASSUME_TAC THENL + [ + EXPAND_TAC "x" THEN EXPAND_TAC "y" THEN + MATCH_MP_TAC Trigonometry1.NORM_CAUCHY_SCHWARZ_FRAC THEN + ASM_REWRITE_TAC[GSYM DE_MORGAN_THM]; + ALL_TAC + ] THEN + + EQ_TAC THENL + [ + REWRITE_TAC[GSYM ACS_0] THEN + MP_TAC (SPECL [`&0`; `x / y`] ACS_MONO_LT_EQ) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[REAL_ARITH `abs a <= &1 <=> -- &1 <= a /\ a <= &1`] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[REAL_NOT_LT] THEN DISCH_TAC THEN + MATCH_MP_TAC REAL_LE_DIV THEN + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "y" THEN + MATCH_MP_TAC REAL_LE_MUL THEN + REWRITE_TAC[NORM_POS_LE]; + ALL_TAC + ] THEN + + REWRITE_TAC[GSYM ACS_0] THEN DISCH_TAC THEN + MATCH_MP_TAC ACS_MONO_LT THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 <= &1`] THEN + ONCE_REWRITE_TAC[REAL_ARITH `x / y < &0 <=> &0 < --x / y`] THEN + MATCH_MP_TAC REAL_LT_DIV THEN + ASM_REWRITE_TAC[REAL_NEG_GT0] THEN + EXPAND_TAC "y" THEN + MATCH_MP_TAC REAL_LT_MUL THEN + ASM_REWRITE_TAC[NORM_POS_LT; GSYM DE_MORGAN_THM]);; + + + + +let AZIM_COMPL_EXT = prove(`!v w a b. azim v w b a = if azim v w a b = &0 then &0 else &2 * pi - azim v w a b`, + REPEAT GEN_TAC THEN + ASM_CASES_TAC `collinear {v, w, a:real^3}` THENL + [ + ASM_REWRITE_TAC[azim_def]; + ALL_TAC + ] THEN + ASM_CASES_TAC `collinear {v, w, b:real^3}` THENL + [ + ASM_REWRITE_TAC[azim_def]; + ALL_TAC + ] THEN + MATCH_MP_TAC AZIM_COMPL THEN + ASM_REWRITE_TAC[]);; + + + +let AZIM_EQ_SYM = prove(`!v w a b c. azim v w b a = azim v w c a <=> azim v w a b = azim v w a c`, + REPEAT GEN_TAC THEN + EQ_TAC THEN DISCH_TAC THEN ONCE_REWRITE_TAC[AZIM_COMPL_EXT] THEN ASM_REWRITE_TAC[]);; + + + + +(* A special configuration of points is a fan *) +let STRICT_CYCLIC_IMP_FAN = prove(`!V p. FINITE V /\ 2 <= CARD V /\ + (!v w. v IN V /\ w IN V /\ ~(v = w) ==> &0 < azim (vec 0) p v w) + ==> FAN (vec 0, V UNION {p}, {{p, v} | v | v IN V})`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `?v w:real^3. v IN V /\ w IN V /\ ~(v = w)` MP_TAC THENL + [ + MP_TAC (ISPEC `V:real^3->bool` CHOOSE_SUBSET) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `2`) THEN + ASM_REWRITE_TAC[LE_REFL; HAS_SIZE_2_EXISTS] THEN + REPEAT STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`x:real^3`; `y:real^3`] THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THEN MATCH_MP_TAC IN_TRANS THEN EXISTS_TAC `t:real^3->bool` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + STRIP_TAC THEN + + SUBGOAL_THEN `!v:real^3. v IN V ==> ~collinear {vec 0, p, v}` (LABEL_TAC "c") THENL + [ + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `v:real^3 = v'` THENL + [ + FIRST_X_ASSUM (MP_TAC o SPECL [`v:real^3`; `w:real^3`]) THEN + ASM_REWRITE_TAC[azim_def; REAL_LT_REFL]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPECL [`v':real^3`; `v:real^3`]) THEN + ASM_REWRITE_TAC[azim_def; REAL_LT_REFL]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!v:real^3. v IN V ==> DISJOINT {vec 0, p} {v} /\ DISJOINT {vec 0} {p, v}` (LABEL_TAC "d") THENL + [ + REPEAT STRIP_TAC THENL + [ + MATCH_MP_TAC Collect_geom.COLLINEAR_DISJOINT3 THEN + FIRST_X_ASSUM (MP_TAC o SPEC `v':real^3`) THEN + ASM_REWRITE_TAC[] THEN + SIMP_TAC[Collect_geom.PER_SET3]; + REWRITE_TAC[DISJOINT; INTER_ACI] THEN + REWRITE_TAC[GSYM DISJOINT] THEN + MATCH_MP_TAC Collect_geom.COLLINEAR_DISJOINT3 THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] + ]; + ALL_TAC + ] THEN + + + SUBGOAL_THEN `~(p:real^3 = vec 0) /\ ~(p IN V) /\ ~(vec 0 IN V)` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THENL + [ + REMOVE_THEN "c" (MP_TAC o SPEC `v:real^3`) THEN + ASM_REWRITE_TAC[COLLINEAR_LEMMA_ALT]; + + REMOVE_THEN "c" (MP_TAC o SPEC `p:real^3`) THEN + ASM_REWRITE_TAC[COLLINEAR_LEMMA_ALT] THEN + DISJ2_TAC THEN EXISTS_TAC `&1` THEN + REWRITE_TAC[VECTOR_MUL_LID]; + + REMOVE_THEN "c" (MP_TAC o SPEC `vec 0:real^3`) THEN + ASM_REWRITE_TAC[COLLINEAR_LEMMA_ALT] THEN + DISJ2_TAC THEN EXISTS_TAC `&0` THEN + REWRITE_TAC[VECTOR_MUL_LZERO] + ]; + ALL_TAC + ] THEN + POP_ASSUM STRIP_ASSUME_TAC THEN + + SUBGOAL_THEN `!v:real^3. v IN V ==> ~(v = p)` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN POP_ASSUM (ASSUME_TAC o SYM) THEN + UNDISCH_TAC `~(p:real^3 IN V)` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[Fan_defs.FAN] THEN + REPEAT STRIP_TAC THENL + [ + (* UNIONS E SUBSET (V UNION {p}) *) + REWRITE_TAC[SUBSET; IN_UNIONS; IN_UNION; IN_ELIM_THM; IN_SING] THEN + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[]; + + (* graph E *) + REWRITE_TAC[Fan_defs.graph; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[HAS_SIZE_2_EXISTS; IN_INSERT; NOT_IN_EMPTY] THEN + MAP_EVERY EXISTS_TAC [`p:real^3`; `v':real^3`] THEN + REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + + (* FINITE V /\ ~(V = {}) *) + ASM_REWRITE_TAC[Fan_defs.fan1; FINITE_UNION; FINITE_SING; SUBSET_EMPTY] THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + EXISTS_TAC `p:real^3` THEN + REWRITE_TAC[IN_UNION; IN_SING]; + + (* ~(vec 0 IN V) *) + ASM_REWRITE_TAC[Fan_defs.fan2; IN_UNION; IN_SING]; + + (* ~collinear {vec 0, e} *) + REWRITE_TAC[Fan_defs.fan6; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `{vec 0:real^3} UNION {p, v'} = {vec 0, p, v'}` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[EXTENSION; IN_UNION; IN_INSERT; NOT_IN_EMPTY]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + (* fan7 *) + REWRITE_TAC[Fan_defs.fan7; IN_UNION; IN_ELIM_THM; IN_SING] THEN + + SUBGOAL_THEN `!t1 t2 r1 r2 x y v w:real^3. v IN V /\ w IN V /\ x = t1 % p + t2 % v /\ y = r1 % p + r2 % w /\ &0 < t2 /\ &0 < r2 ==> azim (vec 0) p x y = azim (vec 0) p v w` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM ((fun th -> ALL_TAC) o SPEC `v:real^3`) THEN + SUBGOAL_THEN `~collinear {vec 0, p, x:real^3} /\ ~collinear {vec 0, p, y}` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[COLLINEAR_LEMMA_ALT; DE_MORGAN_THM; NOT_EXISTS_THM] THEN + REWRITE_TAC[VECTOR_ARITH `t1 % p + t2 % v = c % p <=> t2 % v = (c - t1) % p:real^3`] THEN + CONJ_TAC THEN GEN_TAC THENL + [ + DISCH_THEN (MP_TAC o AP_TERM `\v:real^3. inv(t2) % v`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&0 < a ==> ~(a = &0)`; REAL_MUL_LINV] THEN + REMOVE_THEN "c" (MP_TAC o SPEC `v':real^3`) THEN + ASM_SIMP_TAC[COLLINEAR_LEMMA_ALT; VECTOR_MUL_LID; NOT_EXISTS_THM]; + DISCH_THEN (MP_TAC o AP_TERM `\v:real^3. inv(r2) % v`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&0 < a ==> ~(a = &0)`; REAL_MUL_LINV] THEN + REMOVE_THEN "c" (MP_TAC o SPEC `w':real^3`) THEN + ASM_SIMP_TAC[COLLINEAR_LEMMA_ALT; VECTOR_MUL_LID; NOT_EXISTS_THM] + ]; + ALL_TAC + ] THEN + + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `azim (vec 0) p v' y` THEN + CONJ_TAC THENL + [ + ONCE_REWRITE_TAC[AZIM_EQ_SYM] THEN + MATCH_MP_TAC EQ_SYM THEN + MP_TAC (SPECL [`vec 0:real^3`; `p:real^3`; `y:real^3`; `v':real^3`; `x:real^3`] AZIM_EQ) THEN + ASM_SIMP_TAC[] THEN DISCH_TAC THEN + + ASM_SIMP_TAC[AFF_GT_2_1; IN_ELIM_THM] THEN + MAP_EVERY EXISTS_TAC [`&1 - t1 - t2`; `t1:real`; `t2:real`] THEN + ASM_REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC EQ_SYM THEN + MP_TAC (SPECL [`vec 0:real^3`; `p:real^3`; `v':real^3`; `w':real^3`; `y:real^3`] AZIM_EQ) THEN + ASM_SIMP_TAC[] THEN DISCH_TAC THEN + ASM_SIMP_TAC[AFF_GT_2_1; IN_ELIM_THM] THEN + MAP_EVERY EXISTS_TAC [`&1 - r1 - r2`; `r1:real`; `r2:real`] THEN + ASM_REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!v w:real^3. v IN V /\ w IN V ==> aff_ge {vec 0} {p, v} INTER aff_ge {vec 0} {p, w} = if (v = w) then aff_ge {vec 0} {p, v} else aff_ge {vec 0} {p}` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[INTER_ACI] THEN + ASM_SIMP_TAC[Fan.AFF_GE_1_2; HALFLINE] THEN + REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID; EXTENSION; IN_ELIM_THM; IN_INTER] THEN + GEN_TAC THEN EQ_TAC THENL + [ + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `t3 = &0` THENL + [ + EXISTS_TAC `t2:real` THEN + UNDISCH_TAC `x = t2 % p + t3 % v':real^3` THEN + ASM_REWRITE_TAC[] THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + ASM_CASES_TAC `t3' = &0` THENL + [ + EXISTS_TAC `t2':real` THEN + UNDISCH_TAC `x = t2' % p + t3' % w':real^3` THEN + ASM_REWRITE_TAC[] THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `azim (vec 0) p x x = azim (vec 0) p v' w'` MP_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + MAP_EVERY EXISTS_TAC [`t2:real`; `t3:real`; `t2':real`; `t3':real`] THEN + ASM_REWRITE_TAC[REAL_LT_LE] THEN + UNDISCH_TAC `x = t2 % p + t3 % v':real^3` THEN + DISCH_THEN (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPECL [`v':real^3`; `w':real^3`]) THEN + ASM_REWRITE_TAC[AZIM_REFL] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + STRIP_TAC THEN + CONJ_TAC THEN MAP_EVERY EXISTS_TAC [`&1 - t`; `t:real`; `&0`] THEN ASM_REWRITE_TAC[REAL_LE_REFL] THENL + [ + CONJ_TAC THENL [ REAL_ARITH_TAC; VECTOR_ARITH_TAC ]; + CONJ_TAC THENL [ REAL_ARITH_TAC; VECTOR_ARITH_TAC ] + ]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!v w:real^3. v IN V /\ w IN V ==> aff_ge {vec 0} {p, v} INTER aff_ge {vec 0} {w} = if (v = w) then aff_ge {vec 0} {v} else aff_ge {vec 0} {}` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + COND_CASES_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[INTER_ACI] THEN + REWRITE_TAC[GSYM SUBSET_INTER_ABSORPTION] THEN + MATCH_MP_TAC AFF_GE_MONO_RIGHT THEN + ASM_SIMP_TAC[SUBSET; IN_INSERT; NOT_IN_EMPTY]; + ALL_TAC + ] THEN + + REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING] THEN + ASM_SIMP_TAC[Fan.AFF_GE_1_2] THEN + REWRITE_TAC[EXTENSION; IN_SING; HALFLINE; IN_INTER; IN_ELIM_THM; VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + GEN_TAC THEN EQ_TAC THENL + [ + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `t = &0` THENL + [ + UNDISCH_TAC `x = t % w':real^3` THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO]; + ALL_TAC + ] THEN + + ASM_CASES_TAC `t3 = &0` THENL + [ + UNDISCH_TAC `x = t % w':real^3` THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID] THEN + REMOVE_THEN "c" (MP_TAC o SPEC `w':real^3`) THEN + ASM_REWRITE_TAC[COLLINEAR_LEMMA_ALT; NOT_EXISTS_THM] THEN + DISCH_TAC THEN + DISCH_THEN (MP_TAC o AP_TERM `\v:real^3. inv t % v`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; VECTOR_MUL_LID]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `azim (vec 0) p x x = azim (vec 0) p v' w'` MP_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + MAP_EVERY EXISTS_TAC [`t2:real`; `t3:real`; `&0`; `t:real`] THEN + ASM_REWRITE_TAC[REAL_LT_LE; VECTOR_MUL_LZERO; VECTOR_ADD_LID] THEN + UNDISCH_TAC `x = t % w':real^3` THEN DISCH_THEN (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + REPLICATE_TAC 2 (FIRST_X_ASSUM (MP_TAC o SPECL [`v':real^3`; `w':real^3`])) THEN + ASM_REWRITE_TAC[AZIM_REFL] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_TAC THEN + CONJ_TAC THENL + [ + MAP_EVERY EXISTS_TAC [`&1`; `&0`; `&0`] THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + EXISTS_TAC `&0` THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; REAL_LE_REFL]; + ALL_TAC + ] THEN + + + SUBGOAL_THEN `!v:real^3. v IN V ==> aff_ge {vec 0} {p, v} INTER aff_ge {vec 0} {p} = aff_ge {vec 0} {p}` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[INTER_ACI] THEN + REWRITE_TAC[GSYM SUBSET_INTER_ABSORPTION] THEN + MATCH_MP_TAC AFF_GE_MONO_RIGHT THEN + ASM_SIMP_TAC[SUBSET; IN_INSERT; NOT_IN_EMPTY]; + ALL_TAC + ] THEN + + + + SUBGOAL_THEN `!v w:real^3. {p, v} INTER {p, w} = if (v = w) then {p, v} else {p}` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + COND_CASES_TAC THENL + [ + ASM_REWRITE_TAC[INTER_ACI]; + ALL_TAC + ] THEN + + REWRITE_TAC[EXTENSION; IN_INTER; IN_INSERT; NOT_IN_EMPTY] THEN + GEN_TAC THEN EQ_TAC THENL + [ + REPEAT STRIP_TAC THEN + UNDISCH_TAC `~(v' = w':real^3)` THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!v:real^3. {p, v} INTER {p} = {p} /\ {p} INTER {p, v} = {p}` ASSUME_TAC THENL + [ + REWRITE_TAC[INTER_ACI; GSYM SUBSET_INTER_ABSORPTION; SUBSET; IN_INSERT; NOT_IN_EMPTY] THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!v w:real^3. w IN V ==> {p, v} INTER {w} = if (v = w) then {v} else {}` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + COND_CASES_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[INTER_ACI] THEN + ASM_REWRITE_TAC[GSYM SUBSET_INTER_ABSORPTION; SUBSET] THEN + SIMP_TAC[IN_INSERT]; + ALL_TAC + ] THEN + + REWRITE_TAC[EXTENSION; IN_INTER; NOT_IN_EMPTY; IN_INSERT; DE_MORGAN_THM] THEN + GEN_TAC THEN ASM_CASES_TAC `~(x = w':real^3)` THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[NOT_CLAUSES] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + + SUBGOAL_THEN `!v w:real^3. v IN V /\ w IN V ==> aff_ge {vec 0} {v} INTER aff_ge {vec 0} {w} = if (v = w) then aff_ge {vec 0} {v} else aff_ge {vec 0} {}` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[INTER_ACI] THEN + + REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING] THEN + REWRITE_TAC[EXTENSION; IN_SING; HALFLINE; IN_INTER; IN_ELIM_THM; VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + GEN_TAC THEN EQ_TAC THENL + [ + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `t = &0` THENL + [ + UNDISCH_TAC `x = t % v':real^3` THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO]; + ALL_TAC + ] THEN + + ASM_CASES_TAC `t' = &0` THENL + [ + UNDISCH_TAC `x = t' % w':real^3` THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `azim (vec 0) p x x = azim (vec 0) p v' w'` MP_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + MAP_EVERY EXISTS_TAC [`&0`; `t:real`; `&0`; `t':real`] THEN + ASM_REWRITE_TAC[REAL_LT_LE; VECTOR_MUL_LZERO; VECTOR_ADD_LID] THEN + UNDISCH_TAC `x = t % v':real^3` THEN DISCH_THEN (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + SUBGOAL_THEN `&0 < azim (vec 0) p v' w'` MP_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[AZIM_REFL] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_TAC THEN + CONJ_TAC THEN EXISTS_TAC `&0` THEN ASM_REWRITE_TAC[REAL_LE_REFL; VECTOR_MUL_LZERO]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!v w:real^3. {v} INTER {w} = if (v = w) then {v} else {}` ASSUME_TAC THENL + [ + REPEAT GEN_TAC THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[INTER_ACI] THEN + REWRITE_TAC[EXTENSION; IN_INTER; NOT_IN_EMPTY; IN_SING] THEN + GEN_TAC THEN REWRITE_TAC[DE_MORGAN_THM] THEN + ASM_CASES_TAC `x = v':real^3` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!v:real^3. v IN V ==> aff_ge {vec 0} {v} INTER aff_ge {vec 0} {p} = aff_ge {vec 0} {}` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + REWRITE_TAC[HALFLINE; AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING; IN_INTER; VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + REWRITE_TAC[EXTENSION; IN_INTER; IN_SING; IN_ELIM_THM] THEN + GEN_TAC THEN EQ_TAC THENL + [ + REPEAT STRIP_TAC THEN + REMOVE_THEN "c" (MP_TAC o SPEC `v':real^3`) THEN + ASM_REWRITE_TAC[COLLINEAR_LEMMA_ALT; NOT_EXISTS_THM] THEN + DISCH_TAC THEN + ASM_CASES_TAC `t = &0` THEN ASM_REWRITE_TAC[VECTOR_MUL_LZERO] THEN + UNDISCH_TAC `x = t % v':real^3` THEN + DISCH_THEN (MP_TAC o AP_TERM `\v:real^3. inv t % v`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; VECTOR_MUL_LID]; + ALL_TAC + ] THEN + DISCH_TAC THEN + CONJ_TAC THEN EXISTS_TAC `&0` THEN ASM_REWRITE_TAC[REAL_LE_REFL; VECTOR_MUL_LZERO]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!v:real^3. v IN V ==> {v} INTER {p} = {}` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + REWRITE_TAC[IN_INTER; EXTENSION; NOT_IN_EMPTY; IN_SING; DE_MORGAN_THM] THEN + GEN_TAC THEN ASM_CASES_TAC `x = p:real^3` THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN (ASSUME_TAC o SYM) THEN + UNDISCH_TAC `v':real^3 IN V` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN ASM_SIMP_TAC[] THEN + ONCE_REWRITE_TAC[INTER_ACI] THEN ASM_SIMP_TAC[] + THEN TRY (COND_CASES_TAC THEN ASM_REWRITE_TAC[]) + );; + + + +let STRICT_CYCLIC_FAN_PROPERTIES = prove(`!V p. let W = V UNION {p} in let E = {{p,v} | v | v IN V} in + FAN (vec 0, W, E) ==> + (!v. v IN V ==> (p, v) IN dart1_of_fan (W,E)) /\ + set_of_edge p W E = V /\ + (!v. v IN V ==> node (hypermap_of_fan (W,E)) (p,v) = {(p,w) | w | w IN V})`, + REPEAT GEN_TAC THEN CONV_TAC (DEPTH_CONV let_CONV) THEN + ABBREV_TAC `W = V UNION {p:real^3}` THEN + ABBREV_TAC `E = {{p, v:real^3} | v | v IN V}` THEN + DISCH_TAC THEN + SUBGOAL_THEN `!v:real^3. v IN V ==> (p, v) IN dart1_of_fan (W,E)` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + EXPAND_TAC "E" THEN + REWRITE_TAC[Fan_defs.dart1_of_fan; IN_ELIM_THM] THEN + MAP_EVERY EXISTS_TAC [`p:real^3`; `v:real^3`] THEN + REWRITE_TAC[] THEN + EXISTS_TAC `v:real^3` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + + SUBGOAL_THEN `set_of_edge p W E = V:real^3->bool` ASSUME_TAC THENL + [ + SUBGOAL_THEN `~(p:real^3 IN V)` MP_TAC THENL + [ + DISCH_TAC THEN + UNDISCH_TAC `FAN (vec 0:real^3,W,E)` THEN + REWRITE_TAC[Fan_defs.FAN; Fan_defs.graph] THEN + DISCH_THEN (CONJUNCTS_THEN2 (fun th -> ALL_TAC) MP_TAC) THEN + DISCH_THEN (CONJUNCTS_THEN2 MP_TAC (fun th -> ALL_TAC)) THEN + DISCH_THEN (MP_TAC o SPEC `{p:real^3, p}`) THEN + EXPAND_TAC "E" THEN + REWRITE_TAC[IN_ELIM_THM; NOT_IMP] THEN + SUBGOAL_THEN `{p:real^3,p} = {p}` ASSUME_TAC THENL [ REWRITE_TAC[EXTENSION; IN_INSERT; NOT_IN_EMPTY]; ALL_TAC ] THEN + ASM_SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_EMPTY; NOT_IN_EMPTY] THEN + REWRITE_TAC[DE_MORGAN_THM; ARITH_RULE `~(SUC 0 = 2)`] THEN + EXISTS_TAC `p:real^3` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[Fan_defs.set_of_edge] THEN + EXPAND_TAC "E" THEN EXPAND_TAC "W" THEN + REWRITE_TAC[EXTENSION; IN_UNION; IN_ELIM_THM; IN_SING] THEN + REPEAT STRIP_TAC THEN + EQ_TAC THENL + [ + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `v:real^3`) THEN + ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY] THEN + DISCH_TAC THEN UNDISCH_TAC `v:real^3 IN V` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + EXISTS_TAC `x:real^3` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[Hypermap_and_fan.NODE_HYPERMAP_OF_FAN_ALT]);; + + + + +let ANGLE_SUM_lemma = prove(`!V p. FINITE V /\ 2 <= CARD V /\ + (!v w. v IN V /\ w IN V /\ ~(v = w) ==> &0 < azim (vec 0) p v w) + ==> ?f. (!x. x IN V ==> f x IN V /\ ~(x = f x)) /\ + sum V (\x. azim (vec 0) p x (f x)) = &2 * pi`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + FIRST_ASSUM (MP_TAC o MATCH_MP STRICT_CYCLIC_IMP_FAN) THEN DISCH_TAC THEN + + ABBREV_TAC `W = V UNION {p:real^3}` THEN + ABBREV_TAC `E = {{p, v:real^3} | v | v IN V}` THEN + + MP_TAC (SPEC_ALL STRICT_CYCLIC_FAN_PROPERTIES) THEN + CONV_TAC (DEPTH_CONV let_CONV) THEN ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + + EXISTS_TAC `sigma_fan (vec 0) W E p` THEN + CONJ_TAC THENL + [ + GEN_TAC THEN DISCH_TAC THEN + MP_TAC (SPECL [`vec 0:real^3`; `W:real^3->bool`; `E:(real^3->bool)->bool`; `p:real^3`; `x:real^3`] Fan.SIGMA_FAN) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o check (is_conj o concl)) THEN + ASM_SIMP_TAC[CARD_CLAUSES; FINITE_EMPTY; NOT_IN_EMPTY] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `?v:real^3. v IN V` CHOOSE_TAC THENL + [ + REWRITE_TAC[MEMBER_NOT_EMPTY] THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o check (is_conj o concl)) THEN + ASM_REWRITE_TAC[CARD_CLAUSES] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`W:real^3->bool`; `E:(real^3->bool)->bool`; `(p:real^3,v:real^3)`] Hypermap_and_fan.SUM_AZIM_DART) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `dart1_of_fan (W:real^3->bool,E)` THEN + ASM_SIMP_TAC[Hypermap_and_fan.DART1_OF_FAN_SUBSET_DART_OF_FAN]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[] THEN + + SUBGOAL_THEN `{p:real^3, w:real^3 | w IN V} = IMAGE (\v. p, v) V` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[IMAGE_LEMMA]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`\x. azim (vec 0) p x (sigma_fan (vec 0) W E p x)`; `V:real^3->bool`] SUM_RESTRICT) THEN + ASM_REWRITE_TAC[] THEN + + SUBGOAL_THEN `(\x. if x IN V then azim (vec 0) p x (sigma_fan (vec 0) W E p x) else &0) = (\x. if x IN V then ((azim_dart (W,E)) o (\v. p, v)) x else &0)` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[FUN_EQ_THM] THEN GEN_TAC THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[o_THM] THEN + REWRITE_TAC[Fan_defs.azim_dart; Fan_defs.azim_fan] THEN + SUBGOAL_THEN `~(p = x:real^3)` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC Hypermap_and_fan.PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ THEN + MAP_EVERY EXISTS_TAC [`W:real^3->bool`; `E:(real^3->bool)->bool`] THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[ARITH_RULE `2 <= a ==> a > 1`]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`azim_dart (W,E) o (\v. p,v)`; `V:real^3->bool`] SUM_RESTRICT) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC (GSYM SUM_IMAGE) THEN + SIMP_TAC[PAIR_EQ]);; + + + + +let ANGLE_SUM_BOUND = prove(`!V (p:real^3) a. &0 <= a /\ FINITE V /\ 2 <= CARD V /\ + (!v w. v IN V /\ w IN V /\ ~(v = w) ==> a < azim (vec 0) p v w) + ==> a * &(CARD V) < &2 * pi`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL ANGLE_SUM_lemma) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `a:real` THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + MATCH_MP_TAC REAL_LTE_TRANS THEN + EXISTS_TAC `sum V (\x. azim (vec 0) p x (f x))` THEN + CONJ_TAC THENL + [ + REMOVE_ASSUM THEN + SUBGOAL_THEN `!x. azim (vec 0) p x (f x) = -- (--azim (vec 0) p x (f x))` (fun th -> ONCE_REWRITE_TAC[th]) THENL [ REAL_ARITH_TAC; ALL_TAC ] THEN + ONCE_REWRITE_TAC[SUM_NEG] THEN + REWRITE_TAC[REAL_ARITH `a * b < --c <=> c < b * (--a)`] THEN + MATCH_MP_TAC SUM_BOUND_LT THEN + ASM_REWRITE_TAC[REAL_LE_NEG] THEN + ASM_SIMP_TAC[REAL_LE_LT] THEN + SUBGOAL_THEN `?x:real^3. x IN V` CHOOSE_TAC THENL + [ + REWRITE_TAC[MEMBER_NOT_EMPTY] THEN + DISCH_TAC THEN UNDISCH_TAC `2 <= CARD (V:real^3->bool)` THEN + ASM_REWRITE_TAC[CARD_CLAUSES; ARITH_RULE `~(2 <= 0)`]; + ALL_TAC + ] THEN + EXISTS_TAC `x:real^3` THEN + ASM_SIMP_TAC[REAL_LT_NEG]; + + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[REAL_LE_REFL]);; + + + + +let DIHV_LE_AZIM = prove(`!v w x y. ~collinear {v, w, x} /\ ~collinear {v, w, y} + ==> dihV v w x y <= azim v w x y`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`v:real^3`; `w:real^3`; `x:real^3`; `y:real^3`] AZIM_DIVH) THEN + ASM_REWRITE_TAC[] THEN + COND_CASES_TAC THEN ASM_SIMP_TAC[REAL_LE_REFL] THEN + DISCH_TAC THEN + REWRITE_TAC[REAL_ARITH `a <= &2 * b - a <=> a <= b`] THEN + REWRITE_TAC[DIHV_RANGE]);; + + + +let IN_PLANE_NOT_COLLINEAR = prove(`!v n:real^N. ~(v = vec 0) /\ ~(n = vec 0) /\ n dot v = &0 ==> ~collinear {vec 0, n, v}`, + REWRITE_TAC[COLLINEAR_LEMMA_ALT; DE_MORGAN_THM] THEN + REPEAT GEN_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[NOT_EXISTS_THM] THEN + GEN_TAC THEN + ASM_CASES_TAC `c = &0` THEN ASM_REWRITE_TAC[VECTOR_MUL_LZERO] THEN + DISCH_THEN (MP_TAC o AP_TERM `\v:real^N. n dot v`) THEN + ASM_REWRITE_TAC[DOT_RMUL; EQ_SYM_EQ; REAL_ENTIRE; DOT_EQ_0]);; + + + +let ANGLE_EQ_DIHV = prove(`!v w n:real^N. ~(v = vec 0) /\ ~(w = vec 0) /\ ~(n = vec 0) /\ n dot v = &0 /\ n dot w = &0 + ==> angle (v, vec 0, w) = dihV (vec 0) n v w`, + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[angle; dihV; VECTOR_SUB_RZERO; vector_angle; arcV] THEN + CONV_TAC (DEPTH_CONV let_CONV) THEN + ASM_REWRITE_TAC[DOT_SYM; VECTOR_MUL_LZERO; VECTOR_SUB_RZERO; DOT_LMUL; DOT_RMUL; NORM_MUL] THEN + AP_TERM_TAC THEN + REWRITE_TAC[DOT_SQUARE_NORM; REAL_ABS_POW; REAL_ABS_NORM; real_div; REAL_INV_MUL] THEN + REWRITE_TAC[REAL_ARITH `(nn * nn * vw) * (inn * iv) * inn * iw = (vw * iv * iw) * (nn * inn) * (nn * inn)`] THEN + + SUBGOAL_THEN `~(norm (n:real^N) pow 2 = &0)` MP_TAC THENL + [ + ASM_REWRITE_TAC[NORM_POW_2; DOT_EQ_0]; + ALL_TAC + ] THEN + + SIMP_TAC[REAL_MUL_RINV; REAL_MUL_RID]);; + + + +let PYTHAGORAS_PROJECTION = prove(`!x y n:real^N. x dot n = &0 ==> dist (x, y) pow 2 = dist (x, projection n y) pow 2 + dist (projection n y, y) pow 2`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`y:real^N`; `projection (n:real^N) y`; `x:real^N`] PYTHAGORAS) THEN + ANTS_TAC THENL + [ + REWRITE_TAC[projection; VECTOR_ARITH `y - (y - a % n) = a % n:real^N`] THEN + REWRITE_TAC[orthogonal; DOT_RSUB; DOT_LMUL; DOT_RMUL] THEN + POP_ASSUM MP_TAC THEN SIMP_TAC[DOT_SYM] THEN DISCH_TAC THEN + REWRITE_TAC[REAL_ENTIRE] THEN + DISJ2_TAC THEN + ASM_CASES_TAC `n dot (n:real^N) = &0` THENL + [ + SUBGOAL_THEN `n = vec 0:real^N` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[GSYM DOT_EQ_0]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[DOT_LZERO] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN + CONV_TAC REAL_FIELD; + ALL_TAC + ] THEN + + REWRITE_TAC[dist] THEN + REAL_ARITH_TAC);; + + + + + +let OBTUSE_ANGLE_PROJECTION = prove(`!a w n:real^N. pi / &2 < angle (a,vec 0,w) /\ a dot n = &0 + ==> pi / &2 < angle (a, vec 0, projection n w)`, + REWRITE_TAC[ANGLE_GT_PI2; VECTOR_SUB_RZERO; projection] THEN + SIMP_TAC[DOT_RSUB; DOT_RMUL; REAL_MUL_RZERO; REAL_SUB_RZERO]);; + + + + +let XYOFCGX_3_0 = prove(`!V S. packing V /\ S SUBSET V /\ ~affine_dependent S /\ + circumcenter S = vec 0 /\ radV S < sqrt(&2) /\ + CARD S = 3 ==> + (!u v. u IN S /\ v IN (V DIFF S) ==> dist (v,vec 0) > dist (u,vec 0))`, + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `dist (v,vec 0:real^3) > dist(u,vec 0:real^3)` THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN PURE_REWRITE_TAC[real_gt; REAL_NOT_LT; DIST_SYM] THEN DISCH_TAC THEN + + SUBGOAL_THEN `!u:real^3. u IN S ==> dist (u, vec 0) = radV S` (LABEL_TAC "r") THENL + [ + REPEAT STRIP_TAC THEN + MP_TAC (ISPEC `S:real^3->bool` OAPVION2) THEN + ASM_REWRITE_TAC[DIST_SYM] THEN + DISCH_THEN (MATCH_MP_TAC o GSYM) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `dist (v:real^3, vec 0) <= radV (S:real^3->bool)` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `dist (u:real^3, vec 0)` THEN + ASM_REWRITE_TAC[REAL_LE_LT] THEN + DISJ2_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `~(S = {}:real^3->bool)` ASSUME_TAC THENL + [ + DISCH_TAC THEN + UNDISCH_TAC `CARD (S:real^3->bool) = 3` THEN + ASM_REWRITE_TAC[CARD_CLAUSES; ARITH_RULE `~(0 = 3)`]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`V:real^3->bool`; `S:real^3->bool`; `vec 0:real^3`; `v:real^3`] XYOFCGX_lemma0) THEN + ASM_REWRITE_TAC[DIST_SYM; ARITH_RULE `1 < 3`; ARCV_ANGLE] THEN + STRIP_TAC THEN + + SUBGOAL_THEN `?n:real^3. ~(n = vec 0) /\ (!u. u IN S ==> n dot u = &0)` MP_TAC THENL + [ + MP_TAC (ISPEC `S:real^3->bool` LOWDIM_SUBSET_HYPERPLANE) THEN + ANTS_TAC THENL + [ + MP_TAC (ISPEC `S:real^3->bool` AFF_DIM_DIM_0) THEN + ANTS_TAC THENL + [ + MP_TAC (ISPEC `S:real^3->bool` OAPVION1) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPEC `S:real^3->bool` AFF_DIM_LE_CARD) THEN + ASM_SIMP_TAC[AFFINE_INDEPENDENT_IMP_FINITE] THEN + REWRITE_TAC[GSYM INT_OF_NUM_LT; DIMINDEX_3] THEN + INT_ARITH_TAC; + ALL_TAC + ] THEN + + STRIP_TAC THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[SUBSET; IN_ELIM_THM] THEN DISCH_TAC THEN + EXISTS_TAC `a:real^3` THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `S:real^3->bool` THEN + ASM_REWRITE_TAC[SPAN_INC]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + + ABBREV_TAC `w:real^3 = projection n v` THEN + ABBREV_TAC `W = (w:real^3) INSERT S` THEN + + SUBGOAL_THEN `(!u:real^3. u IN S ==> ~(u = vec 0)) /\ ~(w:real^3 = vec 0)` STRIP_ASSUME_TAC THENL + [ + CONJ_TAC THENL + [ + REPEAT STRIP_TAC THEN + MP_TAC (ISPEC `S:real^3->bool` CIRCUMCENTER_NOT_EQ) THEN + ASM_REWRITE_TAC[ARITH_RULE `1 < 3`] THEN + DISCH_THEN (MP_TAC o SPEC `u':real^3`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_TAC THEN + MP_TAC (ISPECL [`u:real^3`; `v:real^3`; `n:real^3`] PYTHAGORAS_PROJECTION) THEN + ASM_SIMP_TAC[DOT_SYM] THEN + SUBGOAL_THEN `&4 <= dist (u:real^3, v) pow 2` MP_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `&4 = &2 pow 2`] THEN + REWRITE_TAC[GSYM REAL_LE_SQUARE_ABS; dist; REAL_ABS_NORM; REAL_ARITH `abs(&2) = &2`] THEN + REWRITE_TAC[GSYM dist] THEN + UNDISCH_TAC `packing (V:real^3->bool)` THEN + REWRITE_TAC[packing] THEN + DISCH_THEN MATCH_MP_TAC THEN + CONJ_TAC THENL + [ + ONCE_REWRITE_TAC[GSYM IN] THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `S:real^3->bool` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + ONCE_REWRITE_TAC[GSYM IN] THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `V DIFF S:real^3->bool` THEN + ASM_REWRITE_TAC[SUBSET_DIFF]; + ALL_TAC + ] THEN + + DISCH_TAC THEN UNDISCH_TAC `v:real^3 IN V DIFF S` THEN + ASM_REWRITE_TAC[IN_DIFF; DE_MORGAN_THM] THEN + DISJ2_TAC THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + SUBGOAL_THEN `radV (S:real^3->bool) pow 2 + dist (vec 0, v:real^3) pow 2 < &2 + &2` MP_TAC THENL + [ + MATCH_MP_TAC REAL_LT_ADD2 THEN + MP_TAC (SPEC `&2` SQRT_WORKS) THEN + REWRITE_TAC[REAL_ARITH `&0 <= &2`] THEN + DISCH_TAC THEN + FIRST_ASSUM (fun th -> ONCE_REWRITE_TAC[GSYM th]) THEN + REWRITE_TAC[GSYM REAL_LT_SQUARE_ABS] THEN + CONJ_TAC THENL + [ + SUBGOAL_THEN `abs (radV (S:real^3->bool)) = radV S` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[REAL_ABS_REFL] THEN + REMOVE_THEN "r" (MP_TAC o SPEC `u:real^3`) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[dist; NORM_POS_LE]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN + UNDISCH_TAC `radV (S:real^3->bool) < sqrt (&2)` THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + REWRITE_TAC[dist; REAL_ABS_NORM] THEN REWRITE_TAC[GSYM dist] THEN + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `radV (S:real^3->bool)` THEN + ASM_REWRITE_TAC[DIST_SYM] THEN + POP_ASSUM MP_TAC THEN UNDISCH_TAC `radV (S:real^3->bool) < sqrt (&2)` THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + REPEAT (FIRST_X_ASSUM ((fun th -> ALL_TAC) o check (free_in `u:real^3` o concl))) THEN + + SUBGOAL_THEN `!u:real^3. u IN S ==> pi / &2 < angle (u, vec 0, w)` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + EXPAND_TAC "w" THEN + MATCH_MP_TAC OBTUSE_ANGLE_PROJECTION THEN + CONJ_TAC THENL + [ + FIRST_X_ASSUM ((fun th -> ALL_TAC) o SPECL [`v:real^3`; `w:real^3`]) THEN + ONCE_REWRITE_TAC[ANGLE_SYM] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[DOT_SYM] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + + SUBGOAL_THEN `FINITE (W:real^3->bool) /\ CARD W = 4` ASSUME_TAC THENL + [ + UNDISCH_TAC `w:real^3 INSERT S = W` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[FINITE_INSERT; AFFINE_INDEPENDENT_IMP_FINITE; CARD_CLAUSES] THEN + SUBGOAL_THEN `~(w:real^3 IN S)` (fun th -> REWRITE_TAC[th]) THENL + [ + DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `w:real^3`) THEN + ASM_SIMP_TAC[ANGLE_REFL_MID] THEN + MP_TAC PI_POS THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + ARITH_TAC; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`W:real^3->bool`; `n:real^3`; `pi / &2`] ANGLE_SUM_BOUND) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[ARITH_RULE `2 <= 4`] THEN + CONJ_TAC THENL [ MP_TAC PI_POS THEN REAL_ARITH_TAC; ALL_TAC ] THEN + EXPAND_TAC "W" THEN + REWRITE_TAC[IN_INSERT] THEN + + SUBGOAL_THEN `n dot (w:real^3) = &0` ASSUME_TAC THENL + [ + EXPAND_TAC "w" THEN + MP_TAC (ISPECL [`n:real^3`; `v:real^3`] PROJECTION_ORTHOGONAL) THEN + SIMP_TAC[DOT_SYM]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THENL + [ + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LTE_TRANS THEN + EXISTS_TAC `angle (w':real^3, vec 0, w)` THEN + ASM_SIMP_TAC[] THEN + ONCE_REWRITE_TAC[ANGLE_SYM] THEN + ASM_SIMP_TAC[ANGLE_EQ_DIHV] THEN + ASM_SIMP_TAC[IN_PLANE_NOT_COLLINEAR; DIHV_LE_AZIM]; + MATCH_MP_TAC REAL_LTE_TRANS THEN + EXISTS_TAC `angle (v':real^3, vec 0, w)` THEN + ASM_SIMP_TAC[ANGLE_EQ_DIHV] THEN + ASM_SIMP_TAC[IN_PLANE_NOT_COLLINEAR; DIHV_LE_AZIM]; + MATCH_MP_TAC REAL_LTE_TRANS THEN + EXISTS_TAC `angle (v':real^3, vec 0, w':real^3)` THEN + ASM_SIMP_TAC[ANGLE_EQ_DIHV] THEN + ASM_SIMP_TAC[IN_PLANE_NOT_COLLINEAR; DIHV_LE_AZIM] + ]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN MP_TAC PI_POS THEN + REAL_ARITH_TAC);; + + + +(* CARD S = 4 *) + +let DIHV_GT_PI2 = prove(`!v w x y:real^N. pi / &2 < dihV v w x y <=> cos (dihV v w x y) < &0`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[dihV] THEN + CONV_TAC (DEPTH_CONV let_CONV) THEN + ASM_REWRITE_TAC[ARCV_GT_PI2]);; + + +let XYOFCGX_4_0 = prove(`!V S. packing V /\ S SUBSET V /\ ~affine_dependent S /\ + circumcenter S = vec 0 /\ radV S < sqrt (&2) /\ CARD S = 4 + ==> (!u v. u IN S /\ v IN V DIFF S ==> dist (v, vec 0) > dist (u, vec 0))`, + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `dist (v,vec 0:real^3) > dist(u,vec 0:real^3)` THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN PURE_REWRITE_TAC[real_gt; REAL_NOT_LT; DIST_SYM] THEN DISCH_TAC THEN + + SUBGOAL_THEN `!u:real^3. u IN S ==> dist (u, vec 0) = radV S` (LABEL_TAC "r") THENL + [ + REPEAT STRIP_TAC THEN + MP_TAC (ISPEC `S:real^3->bool` OAPVION2) THEN + ASM_REWRITE_TAC[DIST_SYM] THEN + DISCH_THEN (MATCH_MP_TAC o GSYM) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `dist (v:real^3, vec 0) <= radV (S:real^3->bool)` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `dist (u:real^3, vec 0)` THEN + ASM_REWRITE_TAC[REAL_LE_LT] THEN + DISJ2_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `~(S = {}:real^3->bool)` ASSUME_TAC THENL + [ + DISCH_TAC THEN + UNDISCH_TAC `CARD (S:real^3->bool) = 4` THEN + ASM_REWRITE_TAC[CARD_CLAUSES; ARITH_RULE `~(0 = 4)`]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`V:real^3->bool`; `S:real^3->bool`; `vec 0:real^3`; `v:real^3`] XYOFCGX_lemma0) THEN + ASM_REWRITE_TAC[DIST_SYM; ARITH_RULE `1 < 4`] THEN + STRIP_TAC THEN + + REPEAT (FIRST_X_ASSUM ((fun th -> ALL_TAC) o check (free_in `u:real^3` o concl))) THEN + + SUBGOAL_THEN `!u:real^3. u IN S ==> ~collinear {vec 0, v, u}` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + PURE_REWRITE_TAC[CONJUNCT1 Collect_geom.PER_SET3] THEN + REWRITE_TAC[COLLINEAR_LEMMA_ALT; DE_MORGAN_THM] THEN + CONJ_TAC THENL + [ + MP_TAC (ISPEC `S:real^3->bool` CIRCUMCENTER_NOT_EQ) THEN + ASM_REWRITE_TAC[ARITH_RULE `1 < 4`] THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[NOT_EXISTS_THM] THEN GEN_TAC THEN DISCH_TAC THEN + SUBGOAL_THEN `?w:real^3. w IN S /\ ~(u = w)` CHOOSE_TAC THENL + [ + SUBGOAL_THEN `~(S DELETE u:real^3 = {})` MP_TAC THENL + [ + DISCH_THEN (MP_TAC o AP_TERM `\s:real^3->bool. CARD s`) THEN + ASM_SIMP_TAC[AFFINE_INDEPENDENT_IMP_FINITE; FINITE_DELETE; CARD_DELETE; CARD_CLAUSES] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY; IN_DELETE] THEN + STRIP_TAC THEN + EXISTS_TAC `x:real^3` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPECL [`u:real^3`; `w:real^3`]) THEN + FIRST_ASSUM (MP_TAC o SPEC `w:real^3`) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `u:real^3`) THEN + ASM_REWRITE_TAC[ARCV_ANGLE; ANGLE_GT_PI2; VECTOR_SUB_RZERO; DOT_LMUL] THEN + DISCH_TAC THEN + SUBGOAL_THEN `c < &0` MP_TAC THENL + [ + POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[REAL_NOT_LT] THEN DISCH_TAC THEN + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[DOT_POS_LE]; + ALL_TAC + ] THEN + + DISCH_TAC THEN + ASM_CASES_TAC `u dot w:real^3 < &0` THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[REAL_NOT_LT] THEN + ONCE_REWRITE_TAC[REAL_ARITH `a * b = (--a) * (--b)`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[REAL_NEG_GE0; REAL_LE_LT]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`S:real^3->bool`; `v:real^3`; `pi / &2`] ANGLE_SUM_BOUND) THEN + ANTS_TAC THENL + [ + ASM_SIMP_TAC[AFFINE_INDEPENDENT_IMP_FINITE; ARITH_RULE `2 <= 4`] THEN + CONJ_TAC THENL [ MP_TAC PI_POS THEN REAL_ARITH_TAC; ALL_TAC ] THEN + X_GEN_TAC `u:real^3` THEN X_GEN_TAC `w:real^3` THEN + STRIP_TAC THEN + MATCH_MP_TAC REAL_LTE_TRANS THEN + EXISTS_TAC `dihV (vec 0:real^3) v u w` THEN + + CONJ_TAC THENL + [ + REWRITE_TAC[DIHV_GT_PI2] THEN + MP_TAC (ISPECL [`vec 0:real^3`; `u:real^3`; `w:real^3`; `v:real^3`] Trigonometry.RLXWSTK) THEN + ASM_SIMP_TAC[] THEN + CONV_TAC (DEPTH_CONV let_CONV) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[REAL_ARITH `(a - b) / c < &0 <=> &0 < (b + --a) / c`] THEN + MATCH_MP_TAC REAL_LT_DIV THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LT_ADD THEN + CONJ_TAC THENL + [ + ONCE_REWRITE_TAC[REAL_ARITH `a * b = (--a) * (--b)`] THEN + MATCH_MP_TAC REAL_LT_MUL THEN + REWRITE_TAC[REAL_NEG_GT0; GSYM ARCV_GT_PI2] THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[REAL_NEG_GT0; GSYM ARCV_GT_PI2] THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LT_MUL THEN + REWRITE_TAC[ARCV_ANGLE; REAL_LT_LE; SIN_ANGLE_POS] THEN + + CONJ_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `w:real^3`) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (ISPECL [`v:real^3`; `vec 0:real^3`; `w:real^3`] COLLINEAR_SIN_ANGLE) THEN + ANTS_TAC THENL + [ + POP_ASSUM MP_TAC THEN SIMP_TAC[COLLINEAR_LEMMA; DE_MORGAN_THM]; + ALL_TAC + ] THEN + DISCH_TAC THEN + DISCH_THEN (MP_TAC o SYM) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[Collect_geom.PER_SET3]; + + FIRST_X_ASSUM (MP_TAC o SPEC `u:real^3`) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (ISPECL [`v:real^3`; `vec 0:real^3`; `u:real^3`] COLLINEAR_SIN_ANGLE) THEN + ANTS_TAC THENL + [ + POP_ASSUM MP_TAC THEN SIMP_TAC[COLLINEAR_LEMMA; DE_MORGAN_THM]; + ALL_TAC + ] THEN + DISCH_TAC THEN + DISCH_THEN (MP_TAC o SYM) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[Collect_geom.PER_SET3] + ]; + ALL_TAC + ] THEN + + MATCH_MP_TAC DIHV_LE_AZIM THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN MP_TAC PI_POS THEN + REAL_ARITH_TAC);; + + + +(***********) +(* XYOFCGX *) +(***********) + +let XYOFCGX = prove(`!V S (p:real^3). packing V /\ S SUBSET V /\ ~affine_dependent S /\ + (p = circumcenter S) /\ (radV S < sqrt(&2)) ==> + (!u v. u IN S /\ v IN (V DIFF S) ==> dist(v,p) > dist(u,p))`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + ASM_CASES_TAC `S = {}:real^3->bool` THENL + [ + ASM_REWRITE_TAC[NOT_IN_EMPTY]; + ALL_TAC + ] THEN + + ABBREV_TAC `W = IMAGE (\x:real^3. --p + x) V` THEN + ABBREV_TAC `K = IMAGE (\x:real^3. --p + x) S` THEN + SUBGOAL_THEN `(!u v:real^3. u IN K /\ v IN W DIFF K ==> dist (v,vec 0) > dist(u,vec 0)) ==> (!u v:real^3. u IN S /\ v IN V DIFF S ==> dist (v,p) > dist(u,p))` MP_TAC THENL + [ + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`--p + u:real^3`; `--p + v:real^3`]) THEN + REWRITE_TAC[dist; VECTOR_SUB_RZERO; VECTOR_ARITH `--a + b = b - a:real^3`] THEN + DISCH_THEN MATCH_MP_TAC THEN + REWRITE_TAC[IN_IMAGE; IN_DIFF] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[IN_DIFF] THEN DISCH_TAC THEN + REPEAT CONJ_TAC THENL + [ + EXISTS_TAC `u:real^3` THEN ASM_REWRITE_TAC[]; + EXISTS_TAC `v:real^3` THEN ASM_REWRITE_TAC[]; + REWRITE_TAC[VECTOR_ARITH `v - p = x - p <=> x = v:real^3`; NOT_EXISTS_THM; DE_MORGAN_THM] THEN + GEN_TAC THEN + ASM_CASES_TAC `x = v:real^3` THEN ASM_REWRITE_TAC[] + ]; + ALL_TAC + ] THEN + + DISCH_THEN MATCH_MP_TAC THEN + SUBGOAL_THEN `packing W /\ K SUBSET W /\ ~affine_dependent K /\ circumcenter K = vec 0:real^3 /\ radV K < sqrt (&2)` STRIP_ASSUME_TAC THENL + [ + REPEAT CONJ_TAC THENL + [ + UNDISCH_TAC `packing (V:real^3->bool)` THEN + EXPAND_TAC "W" THEN + REWRITE_TAC[packing] THEN + REWRITE_TAC[IMAGE; IN_ELIM_THM; IN] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`x:real^3`; `x':real^3`]) THEN + POP_ASSUM MP_TAC THEN + ASM_REWRITE_TAC[VECTOR_ARITH `--p + x = --p + x' <=> x = x':real^3`] THEN + SIMP_TAC[dist; VECTOR_ARITH `(--p + x) - (--p + x') = x - x':real^3`]; + + EXPAND_TAC "K" THEN EXPAND_TAC "W" THEN + ASM_SIMP_TAC[IMAGE_SUBSET]; + + EXPAND_TAC "K" THEN + ASM_REWRITE_TAC[AFFINE_DEPENDENT_TRANSLATION_EQ]; + + EXPAND_TAC "K" THEN + MP_TAC (ISPECL [`S:real^3->bool`; `--p:real^3`] CIRCUMCENTER_TRANSLATION) THEN + ASM_REWRITE_TAC[VECTOR_ARITH `--p + p = vec 0:real^3`]; + + MP_TAC (ISPECL [`S:real^3->bool`; `--p:real^3`] RADV_TRANSLATION) THEN + ASM_SIMP_TAC[] + ]; + ALL_TAC + ] THEN + + REPLICATE_TAC 5 (POP_ASSUM MP_TAC) THEN + REPEAT REMOVE_ASSUM THEN REPEAT DISCH_TAC THEN + + MP_TAC (ISPEC `K:real^3->bool` AFFINE_INDEPENDENT_CARD_LE) THEN + ASM_REWRITE_TAC[DIMINDEX_3; ARITH_RULE `a <= 3 + 1 <=> a < 5`; Hypermap_and_fan.gen_NUM_CASES 5] THEN + DISCH_THEN STRIP_ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN + ASM_SIMP_TAC[AFFINE_INDEPENDENT_IMP_FINITE; CARD_EQ_0; NOT_IN_EMPTY]; + + MATCH_MP_TAC XYOFCGX_1 THEN ASM_REWRITE_TAC[LE_REFL]; + MATCH_MP_TAC XYOFCGX_2 THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC XYOFCGX_3_0 THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC XYOFCGX_4_0 THEN ASM_REWRITE_TAC[] + ]);; + + + +(****************************************************) + +(*******************************************) +(* XNHPWAB begins here *) +(*******************************************) + + +(* XNHPWAB1 *) + +let BARV_AFFINE_INDEPENDENT = prove(`!V ul k. packing V /\ barV V k ul + ==> ~affine_dependent (set_of_list ul)`, + REPEAT GEN_TAC THEN DISCH_THEN STRIP_ASSUME_TAC THEN + REWRITE_TAC[AFFINE_INDEPENDENT_IFF_CARD] THEN + ASM_REWRITE_TAC[FINITE_SET_OF_LIST] THEN + MP_TAC (SPEC_ALL MHFTTZN1) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC BARV_IMP_K_LE_3 THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `ul:(real^3)list`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + DISCH_TAC THEN + MP_TAC (ISPEC `set_of_list ul:real^3->bool` AFF_DIM_LE_CARD) THEN + ASM_REWRITE_TAC[FINITE_SET_OF_LIST] THEN + SUBGOAL_THEN `(CARD (set_of_list ul:real^3->bool)) <= k + 1` MP_TAC THENL + [ + UNDISCH_TAC `barV V k ul` THEN + REWRITE_TAC[BARV] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + REWRITE_TAC[CARD_SET_OF_LIST_LE]; + ALL_TAC + ] THEN + REWRITE_TAC[GSYM INT_OF_NUM_LE; GSYM INT_OF_NUM_ADD] THEN + INT_ARITH_TAC);; + + +(* barV v k ul ==> LENGTH ul = CARD (set_of_list ul) *) +let BARV_IMP_LENGTH_EQ_CARD = prove(`!V ul k. packing V /\ barV V k ul + ==> LENGTH ul = k + 1 /\ CARD (set_of_list ul) = k + 1`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + SUBGOAL_THEN `LENGTH (ul:(real^3)list) = k + 1` ASSUME_TAC THENL [ POP_ASSUM MP_TAC THEN SIMP_TAC[BARV]; ALL_TAC ] THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPEC_ALL BARV_AFFINE_INDEPENDENT) THEN + ASM_REWRITE_TAC[AFFINE_INDEPENDENT_IFF_CARD; FINITE_SET_OF_LIST] THEN + MP_TAC (SPEC_ALL MHFTTZN1) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[GSYM INT_OF_NUM_EQ; GSYM INT_OF_NUM_ADD] THEN + INT_ARITH_TAC);; + + + +let AFFINE_HULL_PROJECTION_EXISTS = prove(`!S p:real^N. ~(S = {}) ==> ?x n. p = x + n /\ x IN affine hull S /\ + (!v w. v IN S /\ w IN S ==> (v - w) dot n = &0)`, + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + REPEAT STRIP_TAC THEN + ABBREV_TAC `V = IMAGE (\v:real^N. --x + v) S` THEN + ABBREV_TAC `p0:real^N = --x + p` THEN + SUBGOAL_THEN `?y n:real^N. p0 = y + n /\ y IN affine hull V /\ (!z. z IN V ==> z dot n = &0)` MP_TAC THENL + [ + MP_TAC (ISPECL [`V:real^N->bool`; `p0:real^N`] ORTHOGONAL_SUBSPACE_DECOMP_EXISTS) THEN + REWRITE_TAC[orthogonal] THEN + STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`y:real^N`; `z:real^N`] THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + MP_TAC (ISPEC `V:real^N->bool` AFFINE_HULL_EQ_SPAN) THEN + ANTS_TAC THENL + [ + EXPAND_TAC "V" THEN + REWRITE_TAC[AFFINE_HULL_TRANSLATION; IN_IMAGE] THEN + EXISTS_TAC `x:real^N` THEN + REWRITE_TAC[VECTOR_ARITH `vec 0 = --x + x:real^N`] THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `S:real^N->bool` THEN + ASM_REWRITE_TAC[HULL_SUBSET]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `z':real^N`) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `V:real^N->bool` THEN + ASM_REWRITE_TAC[SPAN_INC]; + ALL_TAC + ] THEN + SIMP_TAC[DOT_SYM]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`x + y:real^N`; `n:real^N`] THEN + CONJ_TAC THENL + [ + UNDISCH_TAC `--x + p = p0:real^N` THEN + ASM_REWRITE_TAC[] THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + UNDISCH_TAC `y:real^N IN affine hull V` THEN + EXPAND_TAC "V" THEN + REWRITE_TAC[AFFINE_HULL_TRANSLATION; IN_IMAGE] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[VECTOR_ARITH `x + --x + x' = x':real^N`]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!v:real^N. v IN S ==> (--x + v) dot n = &0` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + EXPAND_TAC "V" THEN REWRITE_TAC[IN_IMAGE] THEN + EXISTS_TAC `v:real^N` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[VECTOR_ARITH `v - w = (--x + v) - (--x + w):real^N`] THEN + ONCE_REWRITE_TAC[DOT_LSUB] THEN + ASM_SIMP_TAC[REAL_SUB_RZERO]);; + + + +let AFFINE_HULL_PROJECTION_DIST_EQ = prove(`!S p v w x n:real^N. v IN S /\ w IN S /\ dist (p, v) = dist (p, w) /\ + p = x + n /\ (!v w. v IN S /\ w IN S ==> (v - w) dot n = &0) + ==> dist (x, v) = dist (x, w)`, + REPEAT STRIP_TAC THEN + UNDISCH_TAC `p = x + n:real^N` THEN + REWRITE_TAC[VECTOR_ARITH `p = x + n <=> x = p - n:real^N`] THEN + DISCH_TAC THEN + UNDISCH_TAC `dist (p,v) = dist(p,w:real^N)` THEN + ASM_REWRITE_TAC[DIST_EQ; dist; NORM_POW_2] THEN + ONCE_REWRITE_TAC[VECTOR_ARITH `p - n - v = (p - v) - n:real^N`] THEN + ABBREV_TAC `a = p - v:real^N` THEN + ABBREV_TAC `b = p - w:real^N` THEN + DISCH_TAC THEN + ASM_REWRITE_TAC[DOT_LSUB; DOT_RSUB; DOT_SYM] THEN + REWRITE_TAC[REAL_ARITH `bb - an - (an - nn) = bb - bn - (bn - nn) <=> an - bn = &0`] THEN + ONCE_REWRITE_TAC[GSYM DOT_LSUB] THEN + EXPAND_TAC "a" THEN EXPAND_TAC "b" THEN + REWRITE_TAC[VECTOR_ARITH `p - v - (p - w) = w - v:real^N`] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]);; + + + +let ORTHOGONAL_TO_AFFINE_HULL_EQ = prove(`!S n:real^N. (!v w. v IN S /\ w IN S ==> (v - w) dot n = &0) <=> + (!v w. v IN affine hull S /\ w IN affine hull S ==> (v - w) dot n = &0)`, + REPEAT GEN_TAC THEN EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + ASM_CASES_TAC `S = {}:real^N->bool` THENL + [ + UNDISCH_TAC `w:real^N IN affine hull S` THEN + ASM_REWRITE_TAC[AFFINE_HULL_EMPTY; NOT_IN_EMPTY]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + STRIP_TAC THEN + MP_TAC (ISPEC `(IMAGE (\v:real^N. --x + v) S)` ORTHOGONAL_TO_SPAN_EQ) THEN + DISCH_THEN (MP_TAC o SPEC `n:real^N`) THEN + REWRITE_TAC[orthogonal] THEN + SUBGOAL_THEN `span (IMAGE (\v:real^N. --x + v) S) = affine hull (IMAGE (\v:real^N. --x + v) S)` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC (GSYM AFFINE_HULL_EQ_SPAN) THEN + REWRITE_TAC[AFFINE_HULL_TRANSLATION; IN_IMAGE] THEN + EXISTS_TAC `x:real^N` THEN + REWRITE_TAC[VECTOR_ARITH `vec 0 = --x + x:real^N`] THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `S:real^N->bool` THEN + ASM_REWRITE_TAC[HULL_SUBSET]; + ALL_TAC + ] THEN + + ONCE_REWRITE_TAC[TAUT `(A <=> B) <=> ((B ==> A) /\ (A ==> B))`] THEN + DISCH_THEN (CONJUNCTS_THEN2 MP_TAC (fun th -> ALL_TAC)) THEN + REWRITE_TAC[AFFINE_HULL_TRANSLATION; IN_IMAGE] THEN + ANTS_TAC THENL + [ + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[DOT_SYM] THEN + ASM_REWRITE_TAC[VECTOR_ARITH `--x + x' = x' - x:real^N`] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_TAC THEN + SUBGOAL_THEN `!v:real^N. v IN affine hull S ==> (v - x) dot n = &0` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + REWRITE_TAC[DOT_SYM] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + EXISTS_TAC `v':real^N` THEN + ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + ONCE_REWRITE_TAC[VECTOR_ARITH `v - w = (v - x) - (w - x):real^N`] THEN + ONCE_REWRITE_TAC[DOT_LSUB] THEN + ASM_SIMP_TAC[REAL_SUB_RZERO]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM MATCH_MP_TAC THEN + CONJ_TAC THEN MATCH_MP_TAC IN_TRANS THEN EXISTS_TAC `S:real^N->bool` THEN ASM_REWRITE_TAC[HULL_SUBSET]);; + + + + +let AFFINE_HULL_PROJECTION_DIST_LE = prove(`!S p v x n:real^N. v IN S /\ + p = x + n /\ x IN affine hull S /\ (!v w. v IN S /\ w IN S ==> (v - w) dot n = &0) + ==> dist (x, v) <= dist (p, v)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[dist] THEN + ONCE_REWRITE_TAC[GSYM REAL_ABS_NORM] THEN + ASM_REWRITE_TAC[REAL_LE_SQUARE_ABS; NORM_POW_2; VECTOR_ARITH `(x + n) - v = (x - v) + n:real^N`] THEN + ABBREV_TAC `a = x - v:real^N` THEN + REWRITE_TAC[DOT_LADD; DOT_RADD; DOT_SYM] THEN + SUBGOAL_THEN `a dot n = &0 /\ &0 <= n dot n:real^N` MP_TAC THENL + [ + REWRITE_TAC[DOT_POS_LE] THEN + EXPAND_TAC "a" THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + ONCE_REWRITE_TAC[ORTHOGONAL_TO_AFFINE_HULL_EQ] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC IN_TRANS THEN EXISTS_TAC `S:real^N->bool` THEN ASM_REWRITE_TAC[HULL_SUBSET]; + ALL_TAC + ] THEN + + REAL_ARITH_TAC);; + + + + +let AFFINE_HULL_PROJECTION_DIST_LT = prove(`!S p v x n:real^N. v IN S /\ ~(p IN affine hull S) /\ + p = x + n /\ x IN affine hull S /\ (!v w. v IN S /\ w IN S ==> (v - w) dot n = &0) + ==> dist (x, v) < dist (p, v)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[dist] THEN + ONCE_REWRITE_TAC[GSYM REAL_ABS_NORM] THEN + ASM_REWRITE_TAC[REAL_LT_SQUARE_ABS; NORM_POW_2; VECTOR_ARITH `(x + n) - v = (x - v) + n:real^N`] THEN + ABBREV_TAC `a = x - v:real^N` THEN + REWRITE_TAC[DOT_LADD; DOT_RADD; DOT_SYM] THEN + SUBGOAL_THEN `a dot n = &0 /\ &0 < n dot n:real^N` MP_TAC THENL + [ + REWRITE_TAC[DOT_POS_LT] THEN + CONJ_TAC THENL + [ + EXPAND_TAC "a" THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + ONCE_REWRITE_TAC[ORTHOGONAL_TO_AFFINE_HULL_EQ] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC IN_TRANS THEN EXISTS_TAC `S:real^N->bool` THEN ASM_REWRITE_TAC[HULL_SUBSET]; + DISCH_TAC THEN UNDISCH_TAC `p = x + n:real^N` THEN + ASM_REWRITE_TAC[VECTOR_ADD_RID] THEN DISCH_TAC THEN + UNDISCH_TAC `~(p:real^N IN affine hull S)` THEN + ASM_REWRITE_TAC[] + ]; + ALL_TAC + ] THEN + + REAL_ARITH_TAC);; + + + + + +let AFFINE_HULL_CIRCUMCENTER_PROJECTION = prove(`!s t:real^N->bool. ~affine_dependent s /\ t SUBSET s /\ ~(t = {}) + ==> ?n. circumcenter s = circumcenter t + n /\ + (!v w. v IN t /\ w IN t ==> (v - w) dot n = &0)`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `p0:real^N = circumcenter t` THEN + ABBREV_TAC `p:real^N = circumcenter s` THEN + + MP_TAC (SPECL [`t:real^N->bool`; `p:real^N`] AFFINE_HULL_PROJECTION_EXISTS) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + EXISTS_TAC `n:real^N` THEN + ASM_REWRITE_TAC[VECTOR_ARITH `x + n = p0 + n <=> x = p0:real^N`] THEN + EXPAND_TAC "p0" THEN + MP_TAC (SPEC `t:real^N->bool` OAPVION3) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC AFFINE_INDEPENDENT_SUBSET THEN + EXISTS_TAC `s:real^N->bool` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `~(t = {}:real^N->bool)` THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + STRIP_TAC THEN + EXISTS_TAC `dist (x, x':real^N)` THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC AFFINE_HULL_PROJECTION_DIST_EQ THEN + MAP_EVERY EXISTS_TAC [`t:real^N->bool`; `p:real^N`; `n:real^N`] THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPEC `s:real^N->bool` OAPVION2) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + FIRST_ASSUM (MP_TAC o SPEC `x':real^N`) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `w:real^N`) THEN + UNDISCH_TAC `t SUBSET s:real^N->bool` THEN + REWRITE_TAC[SUBSET] THEN DISCH_TAC THEN + ASM_SIMP_TAC[]);; + + +let AFFINE_HULL_CIRCUMCENTER_EQ = prove(`!s t:real^N->bool. ~affine_dependent s /\ t SUBSET s /\ ~(t = {}) /\ circumcenter s IN affine hull t + ==> circumcenter s = circumcenter t`, + REWRITE_TAC[SUBSET] THEN REPEAT STRIP_TAC THEN + MP_TAC (SPEC `t:real^N->bool` OAPVION3) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC AFFINE_INDEPENDENT_SUBSET THEN + EXISTS_TAC `s:real^N->bool` THEN + ASM_REWRITE_TAC[SUBSET]; + ALL_TAC + ] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + EXISTS_TAC `radV (s:real^N->bool)` THEN + REPEAT STRIP_TAC THEN + MP_TAC (SPEC `s:real^N->bool` OAPVION2) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `w:real^N`) THEN + ASM_SIMP_TAC[]);; + + + +let AFFINE_HULL_RADV = prove(`!s t:real^N->bool. ~affine_dependent s /\ t SUBSET s /\ ~(t = {}) + ==> radV s pow 2 = radV t pow 2 + dist (circumcenter t, circumcenter s) pow 2 /\ + &0 <= radV s /\ &0 <= radV t`, + REWRITE_TAC[SUBSET] THEN + REPEAT GEN_TAC THEN STRIP_TAC THEN + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN STRIP_TAC THEN + SUBGOAL_THEN `~affine_dependent (t:real^N->bool)` ASSUME_TAC THENL + [ + MATCH_MP_TAC AFFINE_INDEPENDENT_SUBSET THEN + EXISTS_TAC `s:real^N->bool` THEN + ASM_REWRITE_TAC[SUBSET]; + ALL_TAC + ] THEN + + MP_TAC (SPEC_ALL AFFINE_HULL_CIRCUMCENTER_PROJECTION) THEN + ASM_REWRITE_TAC[SUBSET] THEN + STRIP_TAC THEN + POP_ASSUM (LABEL_TAC "vw") THEN + MP_TAC (SPEC `s:real^N->bool` OAPVION2) THEN + MP_TAC (SPEC `t:real^N->bool` OAPVION2) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `x:real^N`) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + DISCH_THEN (MP_TAC o SPEC `x:real^N`) THEN + ASM_SIMP_TAC[] THEN DISCH_TAC THEN + REWRITE_TAC[DIST_POS_LE] THEN + REWRITE_TAC[dist; NORM_POW_2; VECTOR_ARITH `a - (a + n) = --n:real^N`; VECTOR_ARITH `(a + n) - x = (a - x) + n:real^N`] THEN + REWRITE_TAC[DOT_LADD; DOT_RADD; DOT_LNEG; DOT_RNEG; DOT_SYM; REAL_NEG_NEG] THEN + REWRITE_TAC[REAL_ARITH `(a + b) + b + c = a + c <=> b = &0`] THEN + ONCE_REWRITE_TAC[DOT_SYM] THEN + REMOVE_THEN "vw" MP_TAC THEN ONCE_REWRITE_TAC[ORTHOGONAL_TO_AFFINE_HULL_EQ] THEN + DISCH_THEN MATCH_MP_TAC THEN + CONJ_TAC THENL + [ + MP_TAC (SPEC `t:real^N->bool` OAPVION1) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC IN_TRANS THEN EXISTS_TAC `t:real^N->bool` THEN + ASM_REWRITE_TAC[HULL_SUBSET]);; + + + +let RADV_MONO = prove(`!s t:real^N->bool. ~affine_dependent s /\ t SUBSET s /\ ~(t = {}) + ==> radV t <= radV s`, + REPEAT GEN_TAC THEN DISCH_THEN (MP_TAC o MATCH_MP AFFINE_HULL_RADV) THEN + STRIP_TAC THEN + SUBGOAL_THEN `radV (t:real^N->bool) = abs(radV t) /\ radV (s:real^N->bool) = abs(radV s)` (fun th -> ONCE_REWRITE_TAC[th]) THENL + [ + ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN + ASM_REWRITE_TAC[REAL_ABS_REFL]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[REAL_LE_SQUARE_ABS] THEN + REWRITE_TAC[REAL_ARITH `a <= a + b <=> &0 <= b`] THEN + REWRITE_TAC[REAL_POW_2; REAL_LE_SQUARE]);; + + + +let HL_PROPERTIES = prove(`!V ul k. packing V /\ barV V k ul ==> + (!w. w IN set_of_list ul ==> dist (circumcenter (set_of_list ul), w) = hl ul)`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN + REWRITE_TAC[HL] THEN + MATCH_MP_TAC OAPVION2 THEN + MATCH_MP_TAC BARV_AFFINE_INDEPENDENT THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `k:num`] THEN + ASM_REWRITE_TAC[]);; + + +let BARV_CIRCUMCENTER_EXISTS = prove(`!V ul k. packing V /\ barV V k ul ==> + circumcenter (set_of_list ul) IN affine hull (set_of_list ul)`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC OAPVION1 THEN + CONJ_TAC THENL + [ + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + EXISTS_TAC `HD ul:real^3` THEN + MATCH_MP_TAC HD_IN_SET_OF_LIST THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[BARV] THEN + ARITH_TAC; + ALL_TAC + ] THEN + MATCH_MP_TAC BARV_AFFINE_INDEPENDENT THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `k:num`] THEN + ASM_REWRITE_TAC[]);; + + + + + + + + +let HL_EQ_DIST0 = prove(`!V k ul. packing V /\ barV V k ul ==> hl ul = dist (circumcenter (set_of_list ul), HD ul)`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL HL_PROPERTIES) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MATCH_MP_TAC o GSYM) THEN + MATCH_MP_TAC BARV_IMP_HD_IN_SET_OF_LIST THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `k:num`] THEN + ASM_REWRITE_TAC[]);; + + + + +let BARV_CIRCUMCENTER_PROJECTION = prove(`!V ul k i. packing V /\ ul IN barV V k /\ i <= k + ==> let S = set_of_list (truncate_simplex i ul) in + (?n. circumcenter (set_of_list ul) = circumcenter S + n /\ + (!v w. v IN S /\ w IN S ==> (v - w) dot n = &0))`, + REPEAT STRIP_TAC THEN + UNDISCH_TAC `ul IN barV V k` THEN GEN_REWRITE_TAC LAND_CONV [IN] THEN DISCH_TAC THEN + CONV_TAC let_CONV THEN + ABBREV_TAC `S:real^3->bool = set_of_list (truncate_simplex i ul)` THEN + + MATCH_MP_TAC AFFINE_HULL_CIRCUMCENTER_PROJECTION THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC BARV_AFFINE_INDEPENDENT THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `k:num`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `LENGTH (ul:(real^3)list) = k + 1` ASSUME_TAC THENL + [ + UNDISCH_TAC `barV V k ul` THEN SIMP_TAC[BARV]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + EXPAND_TAC "S" THEN + MATCH_MP_TAC SET_OF_LIST_TRUNCATE_SIMPLEX_SUBSET THEN + ASM_REWRITE_TAC[ARITH_RULE `i + 1 <= k + 1 <=> i <= k`]; + ALL_TAC + ] THEN + + EXPAND_TAC "S" THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + EXISTS_TAC `HD (truncate_simplex i ul):real^3` THEN + MATCH_MP_TAC HD_IN_SET_OF_LIST THEN + MP_TAC (ISPECL [`i:num`; `ul:(real^3)list`] LENGTH_TRUNCATE_SIMPLEX) THEN + ASM_SIMP_TAC[ARITH_RULE `i + 1 <= k + 1 <=> i <= k`; ARITH_RULE `1 <= i + 1`]);; + + + + +let HL_DECREASE = prove(`!V ul k i. packing V /\ ul IN barV V k /\ i <= k + ==> hl (truncate_simplex i ul) <= hl ul`, + REWRITE_TAC[IN] THEN REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL HL_PROPERTIES) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPEC_ALL HL_EQ_DIST0) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `i:num`; `truncate_simplex i (ul:(real^3)list)`] HL_EQ_DIST0) THEN + SUBGOAL_THEN `barV V i (truncate_simplex i ul)` ASSUME_TAC THENL + [ + MATCH_MP_TAC TRUNCATE_SIMPLEX_BARV THEN + EXISTS_TAC `k:num` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + + ABBREV_TAC `S:real^3->bool = set_of_list (truncate_simplex i ul)` THEN + ABBREV_TAC `p0:real^3 = circumcenter S` THEN + ABBREV_TAC `p:real^3 = circumcenter (set_of_list ul)` THEN + + SUBGOAL_THEN `HD (truncate_simplex i ul):real^3 = HD ul` ASSUME_TAC THENL + [ + MATCH_MP_TAC HD_TRUNCATE_SIMPLEX THEN + MATCH_MP_TAC LE_TRANS THEN + EXISTS_TAC `k + 1` THEN + ASM_REWRITE_TAC[ARITH_RULE `i + 1 <= k + 1 <=> i <= k`] THEN + UNDISCH_TAC `barV V k ul` THEN + SIMP_TAC[BARV; LE_REFL]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + + MATCH_MP_TAC AFFINE_HULL_PROJECTION_DIST_LE THEN + EXISTS_TAC `S:real^3->bool` THEN + + MP_TAC (SPEC_ALL BARV_CIRCUMCENTER_PROJECTION) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[IN]; + ALL_TAC + ] THEN + CONV_TAC (DEPTH_CONV let_CONV) THEN ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + EXISTS_TAC `n:real^3` THEN + + MP_TAC (SPECL [`V:real^3->bool`; `i:num`; `truncate_simplex i ul:(real^3)list`] BARV_IMP_HD_IN_SET_OF_LIST) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "p0" THEN + EXPAND_TAC "S" THEN + MATCH_MP_TAC BARV_CIRCUMCENTER_EXISTS THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `i:num`] THEN + ASM_REWRITE_TAC[]);; + + + +let XNHPWAB1 = prove(`!V ul k. packing V /\ (ul IN barV V k) /\ (hl ul < sqrt(&2)) ==> + (omega_list V ul = circumcenter (set_of_list ul))`, + REWRITE_TAC[IN] THEN + REPEAT GEN_TAC THEN SPEC_TAC (`ul:(real^3)list`, `ul:(real^3)list`) THEN + SPEC_TAC (`k:num`, `k:num`) THEN + INDUCT_TAC THENL + [ + GEN_TAC THEN + REWRITE_TAC[BARV; ARITH] THEN + REPEAT STRIP_TAC THEN + MP_TAC (ISPEC `ul:(real^3)list` LENGTH_1_LEMMA) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th]) THEN + REWRITE_TAC[set_of_list; CIRCUMCENTER_1; OMEGA_LIST; LENGTH; ARITH; OMEGA_LIST_N; HD]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `SUC k <= 3` ASSUME_TAC THENL + [ + MATCH_MP_TAC BARV_IMP_K_LE_3 THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `ul:(real^3)list`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ABBREV_TAC `vl:(real^3)list = truncate_simplex k ul` THEN + FIRST_X_ASSUM (MP_TAC o SPEC `vl:(real^3)list`) THEN + ASM_SIMP_TAC[ARITH_RULE `SUC k <= 3 ==> k <= 3`] THEN + SUBGOAL_THEN `barV V k vl` ASSUME_TAC THENL + [ + EXPAND_TAC "vl" THEN + MATCH_MP_TAC TRUNCATE_SIMPLEX_BARV THEN + EXISTS_TAC `SUC k` THEN + ASM_REWRITE_TAC[] THEN ARITH_TAC; + ALL_TAC + ] THEN + SUBGOAL_THEN `LENGTH (ul:(real^3)list) = k + 2 /\ LENGTH (vl:(real^3)list) = k + 1` ASSUME_TAC THENL + [ + UNDISCH_TAC `barV V (SUC k) ul` THEN UNDISCH_TAC `barV V k vl` THEN + SIMP_TAC[BARV] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `hl (ul:(real^3)list)` THEN + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "vl" THEN + MATCH_MP_TAC HL_DECREASE THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `SUC k`] THEN + ASM_REWRITE_TAC[IN] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + ABBREV_TAC `p0 = circumcenter (set_of_list vl):real^3` THEN + POP_ASSUM (LABEL_TAC "p0") THEN + DISCH_THEN (LABEL_TAC "po") THEN + SUBGOAL_THEN `p0:real^3 IN affine hull (set_of_list ul)` ASSUME_TAC THENL + [ + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `affine hull (set_of_list vl):real^3->bool` THEN + CONJ_TAC THENL + [ + REMOVE_THEN "p0" (fun th -> REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC BARV_CIRCUMCENTER_EXISTS THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `k:num`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC HULL_MONO THEN + EXPAND_TAC "vl" THEN + MATCH_MP_TAC SET_OF_LIST_TRUNCATE_SIMPLEX_SUBSET THEN + ASM_REWRITE_TAC[] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + ABBREV_TAC `A:real^3->bool = affine hull (voronoi_list V ul)` THEN + ABBREV_TAC `p:real^3 = closest_point A p0` THEN + + MP_TAC (ISPECL [`A:real^3->bool`; `p0:real^3`] CLOSEST_POINT_EXISTS) THEN + ANTS_TAC THENL + [ + EXPAND_TAC "A" THEN + REWRITE_TAC[CLOSED_AFFINE_HULL] THEN + REWRITE_TAC[AFFINE_HULL_EQ_EMPTY] THEN + DISCH_TAC THEN + UNDISCH_TAC `barV V (SUC k) ul` THEN + REWRITE_TAC[BARV; VORONOI_NONDG] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `ul:(real^3)list`) THEN + ASM_REWRITE_TAC[INITIAL_SUBLIST_REFL; ARITH_RULE `0 < k + 2`; DE_MORGAN_THM] THEN + DISJ2_TAC THEN DISJ2_TAC THEN + REWRITE_TAC[AFF_DIM_EMPTY] THEN + UNDISCH_TAC `SUC k <= 3` THEN + REWRITE_TAC[ADD1; GSYM INT_OF_NUM_ADD; GSYM INT_OF_NUM_LE] THEN + INT_ARITH_TAC; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + + SUBGOAL_THEN `p:real^3 IN affine hull set_of_list ul` ASSUME_TAC THENL + [ + ASM_CASES_TAC `p:real^3 IN affine hull set_of_list ul` THEN ASM_REWRITE_TAC[] THEN + MP_TAC (ISPECL [`set_of_list ul:real^3->bool`; `p:real^3`] AFFINE_HULL_PROJECTION_EXISTS) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[SET_OF_LIST_EQ_EMPTY; GSYM LENGTH_EQ_NIL] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + STRIP_TAC THEN + SUBGOAL_THEN `dist (x, p0) < dist (p, p0:real^3)` ASSUME_TAC THENL + [ + MATCH_MP_TAC AFFINE_HULL_PROJECTION_DIST_LT THEN + MAP_EVERY EXISTS_TAC [`affine hull (set_of_list ul:real^3->bool)`; `n:real^3`] THEN + ASM_REWRITE_TAC[HULL_HULL; GSYM ORTHOGONAL_TO_AFFINE_HULL_EQ] THEN + UNDISCH_TAC `p = x + n:real^3` THEN DISCH_THEN (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + SUBGOAL_THEN `x:real^3 IN A` ASSUME_TAC THENL + [ + UNDISCH_TAC `p:real^3 IN A` THEN + EXPAND_TAC "A" THEN + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `SUC k`] MHFTTZN2) THEN + ANTS_TAC THENL [ ASM_REWRITE_TAC[];ALL_TAC ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[bis; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC AFFINE_HULL_PROJECTION_DIST_EQ THEN + MAP_EVERY EXISTS_TAC [`set_of_list ul:real^3->bool`; `p:real^3`; `n:real^3`] THEN + ASM_SIMP_TAC[] THEN + MATCH_MP_TAC HD_IN_SET_OF_LIST THEN + ASM_REWRITE_TAC[ARITH_RULE `1 <= k + 2`]; + ALL_TAC + ] THEN + + UNDISCH_TAC `dist (x, p0) < dist (p,p0:real^3)` THEN + POP_ASSUM MP_TAC THEN REMOVE_ASSUM THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:real^3`) THEN + ASM_REWRITE_TAC[DIST_SYM; REAL_NOT_LT]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `p = circumcenter (set_of_list ul):real^3` (LABEL_TAC "c") THENL + [ + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `SUC k`] MHFTTZN3) THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + SUBGOAL_THEN `p:real^3 IN A INTER affine hull set_of_list ul` MP_TAC THENL + [ + ASM_REWRITE_TAC[IN_INTER]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[IN_SING]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `p:real^3 IN voronoi_list V ul` ASSUME_TAC THENL + [ + REWRITE_TAC[VORONOI_LIST; VORONOI_SET; IN_INTERS; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[voronoi_closed; IN_ELIM_THM] THEN + SUBGOAL_THEN `!w:real^3. V (w:real^3) <=> w IN V` (fun th -> REWRITE_TAC[th]) THENL [ REWRITE_TAC[IN]; ALL_TAC ] THEN + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `w:real^3 IN set_of_list ul` THENL + [ + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `SUC k`] HL_PROPERTIES) THEN + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[REAL_LE_REFL]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`V:real^3->bool`; `set_of_list ul:real^3->bool`; `p:real^3`] XYOFCGX) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[GSYM HL] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC BARV_SUBSET THEN + EXISTS_TAC `SUC k` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC BARV_AFFINE_INDEPENDENT THEN + EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `SUC k` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_THEN (MP_TAC o SPECL [`v:real^3`; `w:real^3`]) THEN + ASM_REWRITE_TAC[IN_DIFF; DIST_SYM; real_gt; REAL_LT_LE] THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[OMEGA_LIST; OMEGA_LIST_N; ARITH_RULE `(k + 2) - 1 = SUC k`] THEN + SUBGOAL_THEN `omega_list_n V ul k = p0:real^3` (fun th -> REWRITE_TAC[th]) THENL + [ + EXPAND_TAC "p0" THEN + EXPAND_TAC "vl" THEN + MATCH_MP_TAC (GSYM OMEGA_LIST_LEMMA) THEN + ASM_REWRITE_TAC[] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `truncate_simplex (SUC k) ul = ul:(real^3)list` (fun th -> REWRITE_TAC[th]) THENL + [ + MP_TAC (ISPECL [`SUC k`; `ul:(real^3)list`; `ul:(real^3)list`] TRUNCATE_SIMPLEX_INITIAL_SUBLIST) THEN + ASM_REWRITE_TAC[ARITH_RULE `SUC k + 1 = k + 2`; LE_REFL; INITIAL_SUBLIST_REFL]; + ALL_TAC + ] THEN + + REMOVE_THEN "c" (fun th -> REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC (GSYM CLOSEST_POINT_UNIQUE) THEN + ASM_REWRITE_TAC[CONVEX_VORONOI_LIST; CLOSED_VORONOI_LIST] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + EXPAND_TAC "A" THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `voronoi_list V ul:real^3->bool` THEN + ASM_REWRITE_TAC[HULL_SUBSET]);; + + + +(* XNHPWAB2 *) + +let AFFINE_HULL_PROJECTION_SEPARATES = prove(`!S p:real^N. FINITE S /\ p IN affine hull S /\ ~(p IN convex hull S) ==> + ?u. u IN S /\ + (!x n. p = x + n /\ x IN affine hull (S DELETE u) /\ + (!v w. v IN S DELETE u /\ w IN S DELETE u ==> (v - w) dot n = &0) + ==> (p - x) dot (u - x) <= &0)`, + REPEAT STRIP_TAC THEN + POP_ASSUM (MP_TAC o REWRITE_RULE [CONVEX_HULL_FINITE]) THEN + POP_ASSUM (MP_TAC o REWRITE_RULE [AFFINE_HULL_FINITE]) THEN + REWRITE_TAC[IN_ELIM_THM; NOT_EXISTS_THM; DE_MORGAN_THM] THEN + DISCH_THEN (X_CHOOSE_THEN `f:real^N->real` STRIP_ASSUME_TAC) THEN + DISCH_THEN (MP_TAC o SPEC `f:real^N->real`) THEN + ASM_REWRITE_TAC[NOT_FORALL_THM; NOT_IMP; REAL_NOT_LE] THEN + DISCH_THEN (X_CHOOSE_THEN `u:real^N` ASSUME_TAC) THEN + EXISTS_TAC `u:real^N` THEN + ASM_REWRITE_TAC[] THEN + + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[ORTHOGONAL_TO_AFFINE_HULL_EQ] THEN DISCH_TAC THEN + SUBGOAL_THEN `p - x:real^N = vsum S (\v. f v % (v - x))` (LABEL_TAC "px") THENL + [ + REWRITE_TAC[VECTOR_SUB_LDISTRIB] THEN + ASM_SIMP_TAC[VSUM_SUB; VSUM_RMUL; VECTOR_MUL_LID]; + ALL_TAC + ] THEN + + POP_ASSUM (MP_TAC o AP_TERM `\v:real^N. v dot (p - x)`) THEN + ASM_REWRITE_TAC[VECTOR_ARITH `(x + n) - x = n:real^N`] THEN + ASM_SIMP_TAC[DOT_LSUM] THEN + SUBGOAL_THEN `sum S (\v:real^N. f v % (v - x) dot n) = f u * (u - x) dot n` (fun th -> REWRITE_TAC[th]) THENL + [ + SUBGOAL_THEN `S:real^N->bool = (S DELETE u) UNION {u}` (fun th -> ONCE_REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[EXTENSION; IN_UNION; IN_SING; IN_DELETE] THEN + GEN_TAC THEN EQ_TAC THEN SIMP_TAC[DISJ_SYM; EXCLUDED_MIDDLE] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MP_TAC (ISPECL [`\v:real^N. f v % (v - x) dot n`; `u:real^N`] SUM_SING) THEN + REWRITE_TAC[DOT_LMUL] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC SUM_UNION_LZERO THEN + REWRITE_TAC[FINITE_SING] THEN + REPEAT STRIP_TAC THEN + REWRITE_TAC[REAL_ENTIRE] THEN + DISJ2_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `S DELETE (u:real^N)` THEN + ASM_REWRITE_TAC[HULL_SUBSET]; + ALL_TAC + ] THEN + + DISCH_THEN (MP_TAC o AP_TERM `\x. inv (f (u:real^N)) * x`) THEN + REWRITE_TAC[REAL_MUL_ASSOC; DOT_SYM] THEN + ASM_SIMP_TAC[REAL_ARITH `a < &0 ==> ~(a = &0)`; REAL_MUL_LINV; REAL_MUL_LID] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + REWRITE_TAC[DOT_POS_LE; GSYM REAL_INV_NEG] THEN + MATCH_MP_TAC REAL_LE_INV THEN + ASM_REWRITE_TAC[REAL_NEG_GE0; REAL_LE_LT]);; + + + + +let XNHPWAB2 = prove(`!V ul k. packing V /\ (ul IN barV V k) /\ (hl ul < sqrt(&2)) ==> + (omega_list V ul IN convex hull (set_of_list ul))`, + REPEAT STRIP_TAC THEN + UNDISCH_TAC `ul IN barV V k` THEN DISCH_THEN (ASSUME_TAC o REWRITE_RULE[IN]) THEN + ABBREV_TAC `p:real^3 = omega_list V ul` THEN + ABBREV_TAC `S:real^3->bool = set_of_list ul` THEN + ASM_CASES_TAC `p:real^3 IN convex hull S` THEN ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `circumcenter S = p:real^3` (LABEL_TAC "c") THENL + [ + EXPAND_TAC "S" THEN EXPAND_TAC "p" THEN + MATCH_MP_TAC (GSYM XNHPWAB1) THEN + EXISTS_TAC `k:num` THEN + ASM_REWRITE_TAC[IN]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `~affine_dependent (S:real^3->bool)` ASSUME_TAC THENL + [ + EXPAND_TAC "S" THEN + MATCH_MP_TAC BARV_AFFINE_INDEPENDENT THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `k:num`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`S:real^3->bool`; `p:real^3`] AFFINE_HULL_PROJECTION_SEPARATES) THEN + ANTS_TAC THENL + [ + ASM_SIMP_TAC[AFFINE_INDEPENDENT_IMP_FINITE] THEN + EXPAND_TAC "p" THEN EXPAND_TAC "S" THEN + MATCH_MP_TAC BARV_CIRCUMCENTER_EXISTS THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `k:num`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + ASM_CASES_TAC `S DELETE u:real^3 = {}` THENL + [ + SUBGOAL_THEN `S = {u:real^3}` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REWRITE_TAC[EXTENSION; IN_DELETE; NOT_IN_EMPTY; IN_SING; DE_MORGAN_THM] THEN + REPEAT STRIP_TAC THEN + EQ_TAC THEN DISCH_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `x:real^3`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REMOVE_THEN "c" MP_TAC THEN + ASM_REWRITE_TAC[CIRCUMCENTER_1] THEN DISCH_TAC THEN + UNDISCH_TAC `~(p:real^3 IN convex hull S)` THEN + ASM_REWRITE_TAC[CONVEX_HULL_SING; IN_SING]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`S:real^3->bool`; `S DELETE u:real^3`] AFFINE_HULL_CIRCUMCENTER_PROJECTION) THEN + ASM_REWRITE_TAC[DELETE_SUBSET] THEN + ABBREV_TAC `p0:real^3 = circumcenter (S DELETE u)` THEN + STRIP_TAC THEN + POP_ASSUM (LABEL_TAC "vw") THEN + SUBGOAL_THEN `p0:real^3 IN affine hull (S DELETE u)` ASSUME_TAC THENL + [ + EXPAND_TAC "p0" THEN + MP_TAC (ISPEC `S DELETE u:real^3` OAPVION1) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC AFFINE_INDEPENDENT_SUBSET THEN + EXISTS_TAC `S:real^3->bool` THEN + ASM_REWRITE_TAC[DELETE_SUBSET]; + ALL_TAC + ] THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + + UNDISCH_TAC `~(S DELETE u:real^3 = {})` THEN + PURE_REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + DISCH_THEN (X_CHOOSE_THEN `v:real^3` ASSUME_TAC) THEN + + SUBGOAL_THEN `dist (p, v) pow 2 = dist (p0, v) pow 2 + dist (p0, p:real^3) pow 2` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[dist; NORM_POW_2; VECTOR_ARITH `p0 - (p0 + n) = --n:real^3`; VECTOR_ARITH `(p0 + n) - v = (p0 - v) + n:real^3`] THEN + REWRITE_TAC[DOT_LADD; DOT_RADD; DOT_LNEG; DOT_RNEG; REAL_NEG_NEG; DOT_SYM] THEN + REWRITE_TAC[REAL_ARITH `(p0v +nv) + nv + nn = p0v + nn <=> nv = &0`] THEN + REMOVE_THEN "vw" MP_TAC THEN + ONCE_REWRITE_TAC[ORTHOGONAL_TO_AFFINE_HULL_EQ] THEN + REWRITE_TAC[DOT_SYM] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `S DELETE u:real^3` THEN + ASM_REWRITE_TAC[HULL_SUBSET]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `dist (p,u:real^3) pow 2 = dist (p0,u) pow 2 + dist (p0,p) pow 2 + &2 * (p - p0) dot (p0 - u)` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[dist; NORM_POW_2; VECTOR_ARITH `(p0 + n) - u = (p0 - u) + n:real^3`; VECTOR_ARITH `p0 - (p0 + n) = --n:real^3`] THEN + REWRITE_TAC[DOT_LADD; DOT_RADD; DOT_LNEG; DOT_RNEG; REAL_NEG_NEG; DOT_SYM] THEN + REWRITE_TAC[REAL_ARITH `(a + b) + b + c = a + c + &2 * d <=> b = d`] THEN + REWRITE_TAC[VECTOR_SUB_REFL; DOT_LZERO; REAL_ADD_LID]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `dist (p0, u) <= dist (p0, v:real^3)` MP_TAC THENL + [ + REWRITE_TAC[dist] THEN ONCE_REWRITE_TAC[GSYM REAL_ABS_NORM] THEN + REWRITE_TAC[REAL_LE_SQUARE_ABS; GSYM dist] THEN + SUBGOAL_THEN `dist (p0,v:real^3) pow 2 = dist (p,v) pow 2 - dist (p0,p) pow 2` (fun th -> REWRITE_TAC[th]) THENL + [ + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + SUBGOAL_THEN `dist (p0,u:real^3) pow 2 = dist (p,u) pow 2 - dist (p0,p) pow 2 - &2 * ((p - p0) dot (p0 - u))` (fun th -> REWRITE_TAC[th]) THENL + [ + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `dist (p, u) = dist (p, v:real^3)` (fun th -> REWRITE_TAC[th]) THENL + [ + MP_TAC (ISPEC `S:real^3->bool` OAPVION2) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + FIRST_ASSUM (MP_TAC o SPEC `u:real^3`) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `v:real^3`) THEN + UNDISCH_TAC `v IN S DELETE u:real^3` THEN + ASM_SIMP_TAC[IN_DELETE]; + ALL_TAC + ] THEN + + REWRITE_TAC[REAL_ARITH `a - b - &2 * c <= a - b <=> --c <= &0`] THEN + REWRITE_TAC[GSYM DOT_RNEG; VECTOR_NEG_SUB] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + EXISTS_TAC `n:real^3` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[REAL_NOT_LE] THEN + MP_TAC (SPECL [`V:real^3->bool`; `S DELETE u:real^3`; `p0:real^3`] XYOFCGX) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `S:real^3->bool` THEN + REWRITE_TAC[DELETE_SUBSET] THEN + EXPAND_TAC "S" THEN + MATCH_MP_TAC BARV_SUBSET THEN + EXISTS_TAC `k:num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC AFFINE_INDEPENDENT_SUBSET THEN + EXISTS_TAC `S:real^3->bool` THEN + ASM_REWRITE_TAC[DELETE_SUBSET]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `radV (S:real^3->bool)` THEN + EXPAND_TAC "S" THEN + ASM_REWRITE_TAC[GSYM HL] THEN + ASM_REWRITE_TAC[HL] THEN + MATCH_MP_TAC RADV_MONO THEN + ASM_REWRITE_TAC[DELETE_SUBSET; GSYM MEMBER_NOT_EMPTY] THEN + EXISTS_TAC `v:real^3` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_THEN (MP_TAC o SPECL [`v:real^3`; `u:real^3`]) THEN + ASM_REWRITE_TAC[DIST_SYM; real_gt] THEN + DISCH_THEN MATCH_MP_TAC THEN + REWRITE_TAC[IN_DIFF; IN_DELETE] THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `S:real^3->bool` THEN + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "S" THEN + MATCH_MP_TAC BARV_SUBSET THEN + EXISTS_TAC `k:num` THEN ASM_REWRITE_TAC[]);; + + + +(* XNHPWAB4 *) + +let XNHPWAB4 = prove(`!V ul k. packing V /\ (ul IN barV V k) /\ (hl ul < sqrt(&2)) ==> + (!i j. (i < j) /\ (j <= k) ==> hl(truncate_simplex i ul) < hl(truncate_simplex j ul))`, + REWRITE_TAC[IN] THEN REPEAT STRIP_TAC THEN + ABBREV_TAC `xl:(real^3)list = truncate_simplex j ul` THEN + ABBREV_TAC `yl:(real^3)list = truncate_simplex i ul` THEN + SUBGOAL_THEN `barV V i yl /\ barV V j xl` ASSUME_TAC THENL + [ + EXPAND_TAC "xl" THEN EXPAND_TAC "yl" THEN + CONJ_TAC THEN MATCH_MP_TAC TRUNCATE_SIMPLEX_BARV THEN EXISTS_TAC `k:num` THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC LE_TRANS THEN + EXISTS_TAC `j:num` THEN + ASM_SIMP_TAC[LT_IMP_LE]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `LENGTH (xl:(real^3)list) = j + 1 /\ LENGTH (yl:(real^3)list) = i + 1 /\ i + 1 <= j + 1` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN + SIMP_TAC[BARV; ARITH_RULE `i + 1 <= j + 1 <=> i <= j`] THEN + ASM_SIMP_TAC[LT_IMP_LE]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `hl (xl:(real^3)list) < sqrt (&2) /\ hl (yl:(real^3)list) < sqrt (&2)` ASSUME_TAC THENL + [ + CONJ_TAC THEN MATCH_MP_TAC REAL_LET_TRANS THEN EXISTS_TAC `hl (ul:(real^3)list)` THEN ASM_REWRITE_TAC[] THENL + [ + EXPAND_TAC "xl"; + EXPAND_TAC "yl" + ] THEN + MATCH_MP_TAC HL_DECREASE THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `k:num`] THEN + ASM_REWRITE_TAC[IN] THEN + MATCH_MP_TAC LE_TRANS THEN + EXISTS_TAC `j:num` THEN + ASM_SIMP_TAC[LT_IMP_LE]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `truncate_simplex i xl = yl:(real^3)list` ASSUME_TAC THENL + [ + EXPAND_TAC "xl" THEN EXPAND_TAC "yl" THEN + MATCH_MP_TAC TRUNCATE_TRUNCATE_SIMPLEX THEN + ASM_SIMP_TAC[LT_IMP_LE] THEN + UNDISCH_TAC `barV V k ul` THEN + SIMP_TAC[BARV] THEN + ASM_REWRITE_TAC[ARITH_RULE `j + 1 <= k + 1 <=> j <= k`]; + ALL_TAC + ] THEN + + REPEAT (FIRST_X_ASSUM ((fun th -> ALL_TAC) o check (free_in `ul:(real^3)list` o concl))) THEN + + SUBGOAL_THEN `set_of_list yl SUBSET ((set_of_list xl):real^3->bool) /\ ~(set_of_list yl = {})` ASSUME_TAC THENL + [ + CONJ_TAC THENL + [ + EXPAND_TAC "yl" THEN + MATCH_MP_TAC SET_OF_LIST_TRUNCATE_SIMPLEX_SUBSET THEN + ASM_REWRITE_TAC[] THEN ARITH_TAC; + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + EXISTS_TAC `HD (yl:(real^3)list)` THEN + MATCH_MP_TAC HD_IN_SET_OF_LIST THEN + ASM_REWRITE_TAC[] THEN + ARITH_TAC + ]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `~affine_dependent (set_of_list xl:real^3->bool)` ASSUME_TAC THENL + [ + MATCH_MP_TAC BARV_AFFINE_INDEPENDENT THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `j:num`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `~affine_dependent (set_of_list yl:real^3->bool)` ASSUME_TAC THENL + [ + MATCH_MP_TAC BARV_AFFINE_INDEPENDENT THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `i:num`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `?v:real^3. v IN set_of_list xl /\ ~(v IN set_of_list yl)` CHOOSE_TAC THENL + [ + ASM_CASES_TAC `set_of_list xl = set_of_list yl:real^3->bool` THENL + [ + MATCH_MP_TAC (TAUT `F ==> P`) THEN + MP_TAC (SPECL [`V:real^3->bool`; `xl:(real^3)list`; `j:num`] MHFTTZN1) THEN + MP_TAC (SPECL [`V:real^3->bool`; `yl:(real^3)list`; `i:num`] MHFTTZN1) THEN + ASM_SIMP_TAC[] THEN + REWRITE_TAC[INT_OF_NUM_EQ] THEN + UNDISCH_TAC `i < j:num` THEN ARITH_TAC; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`set_of_list yl:real^3->bool`; `set_of_list xl:real^3->bool`] PSUBSET_MEMBER) THEN + ASM_REWRITE_TAC[PSUBSET]; + ALL_TAC + ] THEN + + REWRITE_TAC[HL] THEN + MP_TAC (ISPECL [`set_of_list xl:real^3->bool`; `set_of_list yl:real^3->bool`] AFFINE_HULL_RADV) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + SUBGOAL_THEN `!s:real^3->bool. &0 <= radV s ==> radV s = abs (radV s)` MP_TAC THENL + [ + SIMP_TAC[GSYM REAL_ABS_REFL]; + ALL_TAC + ] THEN + DISCH_TAC THEN FIRST_ASSUM (MP_TAC o SPEC `set_of_list yl:real^3->bool`) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `set_of_list xl:real^3->bool`) THEN + ASM_REWRITE_TAC[] THEN + REPLICATE_TAC 2 (DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th])) THEN + ASM_REWRITE_TAC[REAL_LT_SQUARE_ABS] THEN + REWRITE_TAC[REAL_ARITH `a < a + b <=> &0 < b`] THEN + REWRITE_TAC[dist; NORM_POW_2; DOT_POS_LT; VECTOR_SUB_EQ] THEN + DISCH_TAC THEN + + MP_TAC (SPECL [`V:real^3->bool`; `set_of_list yl:real^3->bool`; `circumcenter (set_of_list xl):real^3`] XYOFCGX) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[GSYM HL] THEN + MATCH_MP_TAC BARV_SUBSET THEN + EXISTS_TAC `i:num` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_THEN (MP_TAC o SPECL [`HD yl:real^3`; `v:real^3`]) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[IN_DIFF] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC HD_IN_SET_OF_LIST THEN + ASM_REWRITE_TAC[] THEN ARITH_TAC; + ALL_TAC + ] THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `set_of_list xl:real^3->bool` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC BARV_SUBSET THEN + EXISTS_TAC `j:num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[] THEN + MATCH_MP_TAC (REAL_ARITH `a = b ==> ~(a > b:real)`) THEN + MP_TAC (ISPEC `set_of_list xl:real^3->bool` OAPVION2) THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + FIRST_ASSUM (MP_TAC o SPEC `v:real^3`) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `HD yl:real^3`) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL + [ + SUBGOAL_THEN `HD yl = HD xl:real^3` (fun th -> REWRITE_TAC[th]) THENL + [ + EXPAND_TAC "yl" THEN + MATCH_MP_TAC HD_TRUNCATE_SIMPLEX THEN + ASM_REWRITE_TAC[] THEN ARITH_TAC; + ALL_TAC + ] THEN + MATCH_MP_TAC HD_IN_SET_OF_LIST THEN + ASM_REWRITE_TAC[] THEN ARITH_TAC; + ALL_TAC + ] THEN + + SIMP_TAC[DIST_SYM]);; + + + + +(* XNHPWAB3 *) + + +let OMEGA_LIST_N_IN_CONVEX_HULL = prove(`!V ul k i. packing V /\ barV V k ul /\ i <= k /\ hl ul < sqrt (&2) + ==> omega_list_n V ul i IN convex hull set_of_list ul`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `vl:(real^3)list = truncate_simplex i ul` THEN + SUBGOAL_THEN `barV V i vl` ASSUME_TAC THENL + [ + EXPAND_TAC "vl" THEN + MATCH_MP_TAC TRUNCATE_SIMPLEX_BARV THEN + EXISTS_TAC `k:num` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `LENGTH (vl:(real^3)list) = i + 1 /\ LENGTH (ul:(real^3)list) = k + 1` ASSUME_TAC THENL + [ + UNDISCH_TAC `barV V k ul` THEN + POP_ASSUM MP_TAC THEN + SIMP_TAC[BARV]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `omega_list_n V ul i = omega_list V vl` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[OMEGA_LIST; ARITH_RULE `(i + 1) - 1 = i`] THEN + EXPAND_TAC "vl" THEN + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `i:num`; `0`] OMEGA_LIST_N_LEMMA) THEN + REWRITE_TAC[ARITH_RULE `i + 0 = i`] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[ARITH_RULE `i + 0 + 1 <= k + 1 <=> i <= k`]; + ALL_TAC + ] THEN + + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `convex hull set_of_list vl:real^3->bool` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC XNHPWAB2 THEN + EXISTS_TAC `i:num` THEN + ASM_REWRITE_TAC[IN] THEN + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `hl (ul:(real^3)list)` THEN + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "vl" THEN + MATCH_MP_TAC HL_DECREASE THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `k:num`] THEN + ASM_REWRITE_TAC[IN]; + ALL_TAC + ] THEN + + MATCH_MP_TAC HULL_MONO THEN + EXPAND_TAC "vl" THEN + MATCH_MP_TAC SET_OF_LIST_TRUNCATE_SIMPLEX_SUBSET THEN + ASM_REWRITE_TAC[ARITH_RULE `i + 1 <= k + 1 <=> i <= k`]);; + + + + +let XNHPWAB3 = prove(`!V ul k. packing V /\ (ul IN barV V k) /\ (hl ul < sqrt(&2)) ==> + (aff_dim { omega_list_n V ul j | j IN (0..k)} = &k)`, + REWRITE_TAC[IN_NUMSEG; IN] THEN + REPEAT GEN_TAC THEN + SPEC_TAC (`ul:(real^3)list`, `ul:(real^3)list`) THEN + SPEC_TAC (`k:num`, `k:num`) THEN + INDUCT_TAC THENL + [ + REPEAT STRIP_TAC THEN + REWRITE_TAC[IN_NUMSEG; LE_ANTISYM; EQ_SYM_EQ] THEN + SUBGOAL_THEN `{omega_list_n V ul j | j = 0} = {omega_list_n V ul 0}` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_SING] THEN + GEN_TAC THEN EQ_TAC THENL + [ + STRIP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + DISCH_TAC THEN + EXISTS_TAC `0` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[AFF_DIM_SING]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN + ABBREV_TAC `vl:(real^3)list = truncate_simplex k ul` THEN + FIRST_X_ASSUM (MP_TAC o SPEC `vl:(real^3)list`) THEN + SUBGOAL_THEN `barV V k vl` ASSUME_TAC THENL + [ + EXPAND_TAC "vl" THEN + MATCH_MP_TAC TRUNCATE_SIMPLEX_BARV THEN + EXISTS_TAC `SUC k` THEN + ASM_REWRITE_TAC[ARITH_RULE `k <= SUC k`]; + ALL_TAC + ] THEN + SUBGOAL_THEN `hl (vl:(real^3)list) < sqrt (&2)` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `hl (ul:(real^3)list)` THEN + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "vl" THEN + MATCH_MP_TAC HL_DECREASE THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `SUC k`] THEN + ASM_REWRITE_TAC[ARITH_RULE `k <= SUC k`; IN]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[ARITH_RULE `SUC k <= 3 ==> k <= 3`] THEN + SUBGOAL_THEN `LENGTH (ul:(real^3)list) = k + 2 /\ LENGTH (vl:(real^3)list) = k + 1` ASSUME_TAC THENL + [ + REPEAT (FIRST_X_ASSUM (MP_TAC o check (free_in `barV` o concl))) THEN + SIMP_TAC[BARV; ADD1; ARITH_RULE `(k + 1) + 1 = k + 2`]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `{omega_list_n V ul j | 0 <= j /\ j <= SUC k} = omega_list_n V ul (SUC k) INSERT {omega_list_n V vl j | 0 <= j /\ j <= k}` MP_TAC THENL + [ + SUBGOAL_THEN `!j. 0 <= j /\ j <= k ==> omega_list_n V vl j = omega_list_n V ul j` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + EXPAND_TAC "vl" THEN + SUBGOAL_THEN `k = j + (k - j:num)` MP_TAC THENL + [ + POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th]) THEN + MATCH_MP_TAC (GSYM OMEGA_LIST_N_LEMMA) THEN + ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN + ARITH_TAC; + ALL_TAC + ] THEN + + REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_INSERT] THEN + GEN_TAC THEN EQ_TAC THENL + [ + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `j = SUC k` THEN ASM_REWRITE_TAC[] THEN + DISJ2_TAC THEN + EXISTS_TAC `j:num` THEN + MP_TAC (ARITH_RULE `j <= SUC k /\ ~(j = SUC k) ==> j <= k`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THENL + [ + EXISTS_TAC `SUC k` THEN + ASM_REWRITE_TAC[LE_0; LE_REFL]; + ALL_TAC + ] THEN + + EXISTS_TAC `j:num` THEN + ASM_SIMP_TAC[ARITH_RULE `j <= k ==> j <= SUC k`]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_TAC THEN + ASM_REWRITE_TAC[AFF_DIM_INSERT] THEN + SUBGOAL_THEN `~(omega_list_n V ul (SUC k) IN affine hull {omega_list_n V vl j | 0 <= j /\ j <= k})` (fun th -> REWRITE_TAC[th; ADD1; INT_OF_NUM_ADD]) THEN + + SUBGOAL_THEN `omega_list_n V ul (SUC k) = circumcenter (set_of_list ul)` (fun th -> REWRITE_TAC[th]) THENL + [ + SUBGOAL_THEN `omega_list_n V ul (SUC k) = omega_list V ul` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[OMEGA_LIST; ARITH_RULE `(k + 2) - 1 = SUC k`]; + ALL_TAC + ] THEN + MATCH_MP_TAC XNHPWAB1 THEN + EXISTS_TAC `SUC k` THEN + ASM_REWRITE_TAC[IN]; + ALL_TAC + ] THEN + + DISCH_TAC THEN + SUBGOAL_THEN `~affine_dependent ((set_of_list ul):real^3->bool)` ASSUME_TAC THENL + [ + MATCH_MP_TAC BARV_AFFINE_INDEPENDENT THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `SUC k`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `set_of_list vl SUBSET ((set_of_list ul):real^3->bool) /\ ~(set_of_list vl = {})` ASSUME_TAC THENL + [ + EXPAND_TAC "vl" THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC SET_OF_LIST_TRUNCATE_SIMPLEX_SUBSET THEN + ASM_REWRITE_TAC[] THEN ARITH_TAC; + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + EXISTS_TAC `HD (vl:(real^3)list)` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC HD_IN_SET_OF_LIST THEN + ASM_REWRITE_TAC[] THEN + ARITH_TAC + ]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `circumcenter (set_of_list ul) = circumcenter (set_of_list vl):real^3` ASSUME_TAC THENL + [ + MATCH_MP_TAC AFFINE_HULL_CIRCUMCENTER_EQ THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `affine hull {omega_list_n V vl j | 0 <= j /\ j <= k}` THEN + ASM_REWRITE_TAC[] THEN + GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [GSYM HULL_HULL] THEN + MATCH_MP_TAC HULL_MONO THEN + REWRITE_TAC[SUBSET; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `convex hull set_of_list (vl:(real^3)list)` THEN + ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL] THEN + MATCH_MP_TAC OMEGA_LIST_N_IN_CONVEX_HULL THEN + EXISTS_TAC `k:num` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `SUC k`] XNHPWAB4) THEN + ASM_REWRITE_TAC[IN] THEN + DISCH_THEN (MP_TAC o SPECL [`k:num`; `SUC k`]) THEN + ANTS_TAC THENL [ ARITH_TAC; ALL_TAC ] THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC (REAL_ARITH `a = b ==> ~(a < b:real)`) THEN + SUBGOAL_THEN `truncate_simplex (SUC k) ul = ul:(real^3)list` (fun th -> REWRITE_TAC[th]) THENL + [ + MP_TAC (ISPECL [`SUC k`; `ul:(real^3)list`; `ul:(real^3)list`] TRUNCATE_SIMPLEX_INITIAL_SUBLIST) THEN + ASM_REWRITE_TAC[ARITH_RULE `SUC k + 1 <= k + 2`; ARITH_RULE `k + 2 = SUC k + 1`; INITIAL_SUBLIST_REFL] THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `SUC k`] HL_PROPERTIES) THEN + MP_TAC (SPECL [`V:real^3->bool`; `vl:(real^3)list`; `k:num`] HL_PROPERTIES) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `HD vl:real^3`) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC HD_IN_SET_OF_LIST THEN + ASM_REWRITE_TAC[] THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + DISCH_THEN (MP_TAC o SPEC `HD vl:real^3`) THEN + ANTS_TAC THENL + [ + SUBGOAL_THEN `HD vl = HD ul:real^3` (fun th -> REWRITE_TAC[th]) THENL + [ + EXPAND_TAC "vl" THEN + MATCH_MP_TAC HD_TRUNCATE_SIMPLEX THEN + ASM_REWRITE_TAC[] THEN ARITH_TAC; + ALL_TAC + ] THEN + MATCH_MP_TAC HD_IN_SET_OF_LIST THEN + ASM_REWRITE_TAC[] THEN ARITH_TAC; + ALL_TAC + ] THEN + + SIMP_TAC[]);; + + + +(*************************************************) + +(***********) +(* WAUFCHE *) +(***********) + + +(* WAUFCHE1 *) + + +let IN_VORONOI_LIST_IMP_IN_BIS = prove(`!V ul k x. barV V k ul /\ x IN voronoi_list V ul ==> + (!u. u IN set_of_list ul ==> x IN bis (HD ul) u)`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPEC `ul:(real^3)list` LENGTH_IMP_CONS) THEN + ANTS_TAC THENL + [ + UNDISCH_TAC `barV V k ul` THEN SIMP_TAC[BARV; ARITH_RULE `1 <= k + 1`]; + ALL_TAC + ] THEN + STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `h:real^3`; `t:(real^3)list`] VORONOI_LIST_BIS) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC BARV_SUBSET THEN + EXISTS_TAC `k:num` THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + DISCH_TAC THEN + UNDISCH_TAC `x:real^3 IN voronoi_list V ul` THEN + ASM_REWRITE_TAC[IN_INTER; IN_INTERS; IN_ELIM_THM; HD] THEN + STRIP_TAC THEN + UNDISCH_TAC `u:real^3 IN set_of_list ul` THEN + ASM_REWRITE_TAC[IN_SET_OF_LIST; MEM] THEN + DISCH_THEN DISJ_CASES_TAC THENL + [ + ASM_REWRITE_TAC[bis; IN_ELIM_THM]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `bis h (u:real^3)`) THEN + DISCH_THEN MATCH_MP_TAC THEN + EXISTS_TAC `u:real^3` THEN + ASM_REWRITE_TAC[IN_SET_OF_LIST]);; + + + + + +let WAUFCHE1 = prove(`!V ul k. packing V /\ ul IN barV V k ==> hl ul <= dist(omega_list V ul, HD ul)`, + REWRITE_TAC[IN] THEN REPEAT STRIP_TAC THEN + ABBREV_TAC `p = omega_list V ul` THEN + MP_TAC (ISPECL [`set_of_list ul:real^3->bool`; `p:real^3`] AFFINE_HULL_PROJECTION_EXISTS) THEN + SUBGOAL_THEN `LENGTH (ul:(real^3)list) = k + 1` ASSUME_TAC THENL + [ + UNDISCH_TAC `barV V k ul` THEN SIMP_TAC[BARV]; + ALL_TAC + ] THEN + SUBGOAL_THEN `HD (ul:(real^3)list) IN set_of_list ul` ASSUME_TAC THENL + [ + MATCH_MP_TAC HD_IN_SET_OF_LIST THEN ASM_REWRITE_TAC[] THEN ARITH_TAC; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[SET_OF_LIST_EQ_EMPTY; GSYM LENGTH_EQ_NIL; ARITH_RULE `~(k + 1 = 0)`] THEN + STRIP_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `dist (x:real^3, HD ul)` THEN + CONJ_TAC THENL + [ + MP_TAC (SPEC_ALL HL_EQ_DIST0) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[REAL_LE_LT] THEN + DISJ2_TAC THEN + AP_TERM_TAC THEN REWRITE_TAC[PAIR_EQ] THEN + MP_TAC (ISPEC `set_of_list ul:real^3->bool` OAPVION3) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC BARV_AFFINE_INDEPENDENT THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `k:num`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_THEN (MATCH_MP_TAC o GSYM) THEN + ASM_REWRITE_TAC[] THEN + EXISTS_TAC `dist (x:real^3, HD ul)` THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC AFFINE_HULL_PROJECTION_DIST_EQ THEN + MAP_EVERY EXISTS_TAC [`set_of_list ul:real^3->bool`; `p:real^3`; `n:real^3`] THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `k:num`; `p:real^3`] IN_VORONOI_LIST_IMP_IN_BIS) THEN + ANTS_TAC THENL + [ + EXPAND_TAC "p" THEN + CONJ_TAC THENL [ ASM_REWRITE_TAC[]; ALL_TAC ] THEN + MATCH_MP_TAC OMEGA_LIST_IN_VORONOI_LIST THEN + EXISTS_TAC `k:num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + DISCH_THEN (MP_TAC o SPEC `w:real^3`) THEN + ASM_REWRITE_TAC[bis; IN_ELIM_THM]; + ALL_TAC + ] THEN + + MATCH_MP_TAC AFFINE_HULL_PROJECTION_DIST_LE THEN + MAP_EVERY EXISTS_TAC [`set_of_list ul:real^3->bool`; `n:real^3`] THEN + ASM_REWRITE_TAC[]);; + + + +(* WAUFCHE2 *) + +let WAUFCHE2 = prove(`!V ul k. packing V /\ ul IN barV V k /\ hl ul < sqrt(&2) ==> + (hl ul = dist(omega_list V ul, HD ul))`, + REWRITE_TAC[IN] THEN REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `k:num`; `ul:(real^3)list`] HL_EQ_DIST0) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + AP_TERM_TAC THEN + REWRITE_TAC[PAIR_EQ] THEN + MATCH_MP_TAC (GSYM XNHPWAB1) THEN + EXISTS_TAC `k:num` THEN + ASM_REWRITE_TAC[IN] THEN + MATCH_MP_TAC BARV_IMP_K_LE_3 THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `ul:(real^3)list`] THEN + ASM_REWRITE_TAC[]);; + + + +(*************************************************) + +(********************) +(* Delaunay simplex *) +(********************) + + + +(* YIFVQDV *) + + +let CIRCUMCENTER_IN_VORONOI_SET = prove(`!V (S:real^3->bool). packing V /\ S SUBSET V /\ ~affine_dependent S /\ radV S < sqrt (&2) + ==> circumcenter S IN voronoi_set V S`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `p:real^3 = circumcenter S` THEN + MP_TAC (ISPEC `S:real^3->bool` OAPVION2) THEN + MP_TAC (ISPECL [`V:real^3->bool`; `S:real^3->bool`; `p:real^3`] XYOFCGX) THEN + ASM_REWRITE_TAC[] THEN + REPEAT DISCH_TAC THEN + REWRITE_TAC[VORONOI_SET; IN_INTERS; IN_ELIM_THM; voronoi_closed] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + POP_ASSUM (ASSUME_TAC o ONCE_REWRITE_RULE[GSYM IN]) THEN + ASM_CASES_TAC `w:real^3 IN S` THENL + [ + FIRST_ASSUM (MP_TAC o SPEC `w:real^3`) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `v:real^3`) THEN + ASM_REWRITE_TAC[] THEN + SIMP_TAC[REAL_LE_REFL]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPECL [`v:real^3`; `w:real^3`]) THEN + ASM_REWRITE_TAC[IN_DIFF; DIST_SYM] THEN + REAL_ARITH_TAC);; + + + + +let NEIGHBORHOOD_lemma = prove(`!V S p. packing V /\ S SUBSET V /\ (!u v. u IN S /\ v IN V DIFF S ==> dist (v, p) > dist (u, p)) + ==> ?r. &0 < r /\ (!x u v. x IN ball(p, r) /\ u IN S /\ v IN V DIFF S ==> dist (v, x) > dist (u, x))`, + REWRITE_TAC[real_gt] THEN REPEAT STRIP_TAC THEN + ASM_CASES_TAC `V DIFF S = {}:real^3->bool` THEN ASM_REWRITE_TAC[NOT_IN_EMPTY] THENL + [ + EXISTS_TAC `&1` THEN REWRITE_TAC[REAL_LT_01]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `?R. S SUBSET ball(p:real^3, R)` CHOOSE_TAC THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN STRIP_TAC THEN + EXISTS_TAC `dist (x:real^3, p)` THEN + REWRITE_TAC[ball; SUBSET; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`x':real^3`; `x:real^3`]) THEN + ASM_REWRITE_TAC[DIST_SYM]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `?d. &0 < d /\ (!u v. u IN S /\ v IN (V DIFF S) INTER ball (p:real^3, R + &2) ==> dist (v, p) >= dist (u, p) + d)` STRIP_ASSUME_TAC THENL + [ + ABBREV_TAC `K = IMAGE (\(u,v). dist (v,p:real^3) - dist (u,p)) {u,v | u IN S /\ v IN (V DIFF S) INTER ball (p:real^3, R + &2)}` THEN + SUBGOAL_THEN `FINITE (K:real->bool)` ASSUME_TAC THENL + [ + EXPAND_TAC "K" THEN + MATCH_MP_TAC FINITE_IMAGE THEN + MATCH_MP_TAC FINITE_PRODUCT THEN + CONJ_TAC THEN MATCH_MP_TAC FINITE_SUBSET THENL + [ + EXISTS_TAC `V INTER ball (p:real^3, R)` THEN + ASM_SIMP_TAC[KIUMVTC; SUBSET_INTER]; + EXISTS_TAC `V INTER (ball (p:real^3, R + &2))` THEN + ASM_SIMP_TAC[KIUMVTC; SUBSET_INTER; INTER_SUBSET] THEN + SIMP_TAC[SUBSET; IN_INTER; IN_DIFF] + ]; + ALL_TAC + ] THEN + + ASM_CASES_TAC `K = {}:real->bool` THENL + [ + POP_ASSUM MP_TAC THEN EXPAND_TAC "K" THEN + REWRITE_TAC[IMAGE_EQ_EMPTY; EXTENSION; NOT_IN_EMPTY; IN_ELIM_THM; NOT_EXISTS_THM] THEN + DISCH_TAC THEN + EXISTS_TAC `&1` THEN + REWRITE_TAC[REAL_LT_01] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`u:real^3,v:real^3`; `u:real^3`; `v:real^3`]) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + EXISTS_TAC `inf (K:real->bool)` THEN + MP_TAC (SPEC `K:real->bool` INF_FINITE) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ABBREV_TAC `d = inf K` THEN + CONJ_TAC THENL + [ + UNDISCH_TAC `d:real IN K` THEN + EXPAND_TAC "K" THEN + REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`u:real^3`; `v:real^3`]) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[IN_INTER]; + ALL_TAC + ] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `dist (v:real^3,p) - dist (u,p)`) THEN + ANTS_TAC THENL + [ + EXPAND_TAC "K" THEN + REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN + EXISTS_TAC `u:real^3,v:real^3` THEN + REWRITE_TAC[] THEN + MAP_EVERY EXISTS_TAC [`u:real^3`; `v:real^3`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + ABBREV_TAC `r = min (&1) (d / &2)` THEN + SUBGOAL_THEN `&0 < r /\ r <= &1 /\ r <= d / &2` ASSUME_TAC THENL + [ + EXPAND_TAC "r" THEN + REWRITE_TAC[REAL_MIN_MIN; REAL_LT_MIN] THEN + UNDISCH_TAC `&0 < d` THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + EXISTS_TAC `r:real` THEN + ASM_REWRITE_TAC[ball; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + + ONCE_REWRITE_TAC[REAL_ARITH `a < b <=> &0 < b - a`] THEN + MATCH_MP_TAC REAL_LTE_TRANS THEN + EXISTS_TAC `(dist (v, p) - dist (u, p)) - &2 * dist (p:real^3, x)` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `dist (v, p) - dist (u, p:real^3) - &2 * r` THEN + CONJ_TAC THENL + [ + ASM_CASES_TAC `v IN ball (p:real^3,R + &2)` THENL + [ + FIRST_X_ASSUM (MP_TAC o SPECL [`u:real^3`; `v:real^3`]) THEN + ASM_REWRITE_TAC[IN_INTER] THEN + FIRST_X_ASSUM (MP_TAC o check (is_conj o concl)) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN + SUBGOAL_THEN `u IN ball(p:real^3,R)` MP_TAC THENL + [ + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `S:real^3->bool` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[ball; IN_ELIM_THM; REAL_NOT_LT; DIST_SYM] THEN + FIRST_X_ASSUM (MP_TAC o check (is_conj o concl)) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + UNDISCH_TAC `dist (p:real^3,x) < r` THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`u:real^3`; `p:real^3`; `x:real^3`] DIST_TRIANGLE) THEN + MP_TAC (ISPECL [`p:real^3`; `x:real^3`; `v:real^3`] DIST_TRIANGLE) THEN + REWRITE_TAC[DIST_SYM] THEN + REAL_ARITH_TAC);; + + + +let SUBSPACES_INTER_BALL_EQ_IMP_EQ = prove(`!s t r. subspace s /\ subspace t /\ + &0 < r /\ s INTER ball (vec 0:real^N, r) = t INTER ball (vec 0, r) + ==> s = t`, + REWRITE_TAC[subspace] THEN REPEAT STRIP_TAC THEN + SUBGOAL_THEN `!v:real^N. ?d. d % v IN ball (vec 0,r) /\ v = (inv d) % (d % v)` ASSUME_TAC THENL + [ + GEN_TAC THEN + EXISTS_TAC `(r / &2) * inv(norm (v:real^N))` THEN + ASM_CASES_TAC `v = vec 0:real^N` THENL + [ + ASM_REWRITE_TAC[VECTOR_MUL_RZERO; CENTRE_IN_BALL]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM NORM_EQ_0] THEN DISCH_TAC THEN + CONJ_TAC THENL + [ + REWRITE_TAC[ball; IN_ELIM_THM; dist; VECTOR_SUB_LZERO; NORM_NEG; NORM_MUL] THEN + REWRITE_TAC[REAL_ABS_MUL; REAL_ABS_INV; REAL_ABS_NORM; GSYM REAL_MUL_ASSOC] THEN + ASM_SIMP_TAC[REAL_MUL_LINV] THEN + UNDISCH_TAC `&0 < r` THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_INV_MUL; REAL_INV_INV] THEN + REWRITE_TAC[REAL_ARITH `(ia * b) * a * ib = (ia * a) * (ib * b)`] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_ARITH `&0 < r ==> ~(r / &2 = &0)`] THEN + REWRITE_TAC[REAL_MUL_LID; VECTOR_MUL_LID]; + ALL_TAC + ] THEN + + REWRITE_TAC[EXTENSION] THEN GEN_TAC THEN + EQ_TAC THEN DISCH_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `x:real^N`) THEN + STRIP_TAC THEN + ABBREV_TAC `v:real^N = d % x` THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`inv d`; `v:real^N`]) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN MATCH_MP_TAC THEN + SUBGOAL_THEN `v IN s INTER ball (vec 0:real^N,r)` MP_TAC THENL + [ + ASM_REWRITE_TAC[IN_INTER] THEN + EXPAND_TAC "v" THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + SIMP_TAC[IN_INTER]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `x:real^N`) THEN + STRIP_TAC THEN + ABBREV_TAC `v:real^N = d % x` THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + SUBGOAL_THEN `v IN t INTER ball (vec 0:real^N,r)` MP_TAC THENL + [ + ASM_REWRITE_TAC[IN_INTER] THEN + EXPAND_TAC "v" THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPLICATE_TAC 4 REMOVE_ASSUM THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + SIMP_TAC[IN_INTER]);; + + + + +let AFFINES_INTER_BALL_EQ_IMP_EQ = prove(`!s t (x:real^N) r. affine s /\ affine t /\ + &0 < r /\ s INTER ball (x, r) = t INTER ball (x, r) /\ x IN s + ==> s = t`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `IMAGE (\v:real^N. --x + v) s = IMAGE (\v:real^N. --x + v) t` MP_TAC THENL + [ + MATCH_MP_TAC SUBSPACES_INTER_BALL_EQ_IMP_EQ THEN + EXISTS_TAC `r:real` THEN + ASM_REWRITE_TAC[] THEN + REPEAT CONJ_TAC THENL + [ + MATCH_MP_TAC AFFINE_IMP_SUBSPACE THEN + ASM_REWRITE_TAC[AFFINE_TRANSLATION_EQ; IN_IMAGE] THEN + EXISTS_TAC `x:real^N` THEN + ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC; + MATCH_MP_TAC AFFINE_IMP_SUBSPACE THEN + ASM_REWRITE_TAC[AFFINE_TRANSLATION_EQ; IN_IMAGE] THEN + EXISTS_TAC `x:real^N` THEN + REWRITE_TAC[VECTOR_ARITH `vec 0 = --x + x:real^N`] THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `s INTER ball (x:real^N, r)` THEN + ASM_REWRITE_TAC[IN_INTER; CENTRE_IN_BALL; INTER_SUBSET]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!s. IMAGE (\v:real^N. --x + v) s INTER ball (vec 0,r) = IMAGE (\v. --x + v) (s INTER ball(x, r))` (fun th -> REWRITE_TAC[th]) THENL + [ + GEN_TAC THEN + SUBGOAL_THEN `ball (vec 0,r) = IMAGE (\v:real^N. --x + v) (ball (x, r))` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[GSYM BALL_TRANSLATION; VECTOR_ARITH `--x + x = vec 0:real^N`]; + ALL_TAC + ] THEN + + MATCH_MP_TAC (GSYM IMAGE_INTER_INJ) THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPEC `\v:real^N. --x + v` INJECTIVE_IMAGE) THEN + REWRITE_TAC[VECTOR_ARITH `--x + x' = --x + y ==> x' = y:real^N`] THEN + DISCH_THEN (MP_TAC o ISPECL [`s:real^N->bool`; `t:real^N->bool`]) THEN + SIMP_TAC[]);; + + + +let VORONOI_LIST_EQ_INTERS_BIS = prove(`!V (ul:(real^3)list). set_of_list ul SUBSET V /\ 1 <= LENGTH ul + ==> voronoi_list V ul = voronoi_closed V (HD ul) INTER (INTERS {bis (HD ul) u | u | u IN set_of_list ul})`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPEC `ul:(real^3)list` LENGTH_IMP_CONS) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + ASM_REWRITE_TAC[HD] THEN + SUBGOAL_THEN `INTERS {bis h u | u | u:real^3 IN set_of_list (CONS h t)} = INTERS {bis h u | u | u IN set_of_list t}` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[set_of_list; IN_INSERT] THEN + REWRITE_TAC[EXTENSION; IN_INTERS; IN_ELIM_THM] THEN + GEN_TAC THEN EQ_TAC THENL + [ + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `bis h (u:real^3)`) THEN + ANTS_TAC THENL + [ + EXISTS_TAC `u:real^3` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + SIMP_TAC[]; + REPEAT STRIP_TAC THENL + [ + ASM_REWRITE_TAC[bis; IN_ELIM_THM]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `bis h (u:real^3)`) THEN + ANTS_TAC THENL + [ + EXISTS_TAC `u:real^3` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + SIMP_TAC[] + ]; + ALL_TAC + ] THEN + MATCH_MP_TAC VORONOI_LIST_BIS THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]));; + + + + + + +let AFFINE_HULL_VORONOI_LIST_SUBSET_INTERS_BIS = prove(`!V (ul:(real^3)list). set_of_list ul SUBSET V + ==> affine hull (voronoi_list V ul) SUBSET INTERS {bis (HD ul) u | u | u IN set_of_list ul}`, + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `ul:(real^3)list = []` THENL + [ + ASM_REWRITE_TAC[VORONOI_LIST; set_of_list; VORONOI_SET; NOT_IN_EMPTY] THEN + SUBGOAL_THEN `{voronoi_closed V (v:real^3) | v | F} = {} /\ {bis (HD []) (u:real^3) | F} = {}` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[EXTENSION; IN_ELIM_THM; NOT_IN_EMPTY]; + ALL_TAC + ] THEN + REWRITE_TAC[INTERS_0; AFFINE_HULL_UNIV; SUBSET_REFL]; + ALL_TAC + ] THEN + SUBGOAL_THEN `1 <= LENGTH (ul:(real^3)list)` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[ARITH_RULE `1 <= a <=> ~(a = 0)`; LENGTH_EQ_NIL]; + ALL_TAC + ] THEN + MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `affine hull (INTERS {bis (HD ul) u | u | u:real^3 IN set_of_list ul})` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC HULL_MONO THEN + ASM_SIMP_TAC[VORONOI_LIST_EQ_INTERS_BIS] THEN + REWRITE_TAC[INTER_SUBSET]; + ALL_TAC + ] THEN + REWRITE_TAC[AFFINE_HULL_INTERS_BIS; SUBSET_REFL]);; + + + + +let YIFVQDV_lemma_aff_dim = prove(`!V vl. packing V /\ set_of_list vl SUBSET V /\ ~affine_dependent (set_of_list vl) /\ hl vl < sqrt (&2) + ==> aff_dim (voronoi_list V vl) = aff_dim (INTERS {bis (HD vl) v | v | v IN set_of_list vl})`, + REPEAT STRIP_TAC THEN + GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [GSYM AFF_DIM_AFFINE_HULL] THEN + AP_TERM_TAC THEN + MATCH_MP_TAC AFFINES_INTER_BALL_EQ_IMP_EQ THEN + ABBREV_TAC `p:real^3 = circumcenter (set_of_list vl)` THEN + ABBREV_TAC `S:real^3->bool = set_of_list vl` THEN + + SUBGOAL_THEN `?r. &0 < r /\ (!x u v. x IN ball (p:real^3, r) /\ u IN S /\ v IN V DIFF S ==> dist (v, x) > dist (u, x))` STRIP_ASSUME_TAC THENL + [ + MATCH_MP_TAC NEIGHBORHOOD_lemma THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC XYOFCGX THEN + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "S" THEN ASM_REWRITE_TAC[GSYM HL]; + ALL_TAC + ] THEN + + MAP_EVERY EXISTS_TAC [`p:real^3`; `r:real`] THEN + ASM_REWRITE_TAC[AFFINE_AFFINE_HULL] THEN + CONJ_TAC THENL + [ + REWRITE_TAC[GSYM AFFINE_HULL_EQ] THEN + REWRITE_TAC[AFFINE_HULL_INTERS_BIS]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + MATCH_MP_TAC SUBSET_ANTISYM THEN + CONJ_TAC THENL + [ + REWRITE_TAC[SUBSET_INTER; INTER_SUBSET] THEN + MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `affine hull voronoi_list V vl` THEN + REWRITE_TAC[INTER_SUBSET] THEN + EXPAND_TAC "S" THEN + MATCH_MP_TAC AFFINE_HULL_VORONOI_LIST_SUBSET_INTERS_BIS THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `voronoi_list V vl INTER ball (p,r)` THEN + CONJ_TAC THENL + [ + ASM_CASES_TAC `S = {}:real^3->bool` THENL + [ + POP_ASSUM MP_TAC THEN EXPAND_TAC "S" THEN REWRITE_TAC[SET_OF_LIST_EQ_EMPTY] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list; NOT_IN_EMPTY] THEN + SUBGOAL_THEN `{bis (HD []) (v:real^3) | F} = {} /\ {voronoi_closed V (v:real^3) | v | F} = {}` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[EXTENSION; NOT_IN_EMPTY; IN_ELIM_THM]; + ALL_TAC + ] THEN + REWRITE_TAC[INTERS_0; INTER_UNIV; SUBSET_REFL]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `1 <= LENGTH (vl:(real^3)list)` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN EXPAND_TAC "S" THEN + REWRITE_TAC[SET_OF_LIST_EQ_EMPTY; ARITH_RULE `1 <= a <=> ~(a = 0)`; LENGTH_EQ_NIL]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`V:real^3->bool`; `vl:(real^3)list`] VORONOI_LIST_EQ_INTERS_BIS) THEN + ASM_REWRITE_TAC[] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + SIMP_TAC[SUBSET; IN_INTER] THEN + REWRITE_TAC[IN_INTERS; voronoi_closed; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + POP_ASSUM (ASSUME_TAC o ONCE_REWRITE_RULE[GSYM IN]) THEN + + ASM_CASES_TAC `w:real^3 IN S` THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `bis (HD vl) (w:real^3)`) THEN + ANTS_TAC THENL + [ + EXISTS_TAC `w:real^3` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + SIMP_TAC[bis; IN_ELIM_THM; REAL_LE_REFL]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPECL [`x:real^3`; `HD vl:real^3`; `w:real^3`]) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[IN_DIFF] THEN + EXPAND_TAC "S" THEN + MATCH_MP_TAC HD_IN_SET_OF_LIST THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[DIST_SYM; real_gt; REAL_LT_IMP_LE]; + ALL_TAC + ] THEN + + REWRITE_TAC[SUBSET_INTER; INTER_SUBSET] THEN + MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `voronoi_list V vl:real^3->bool` THEN + REWRITE_TAC[INTER_SUBSET; HULL_SUBSET]; + ALL_TAC + ] THEN + + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `voronoi_list V vl` THEN + ASM_REWRITE_TAC[HULL_SUBSET; VORONOI_LIST] THEN + EXPAND_TAC "p" THEN + MATCH_MP_TAC CIRCUMCENTER_IN_VORONOI_SET THEN + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "S" THEN ASM_REWRITE_TAC[GSYM HL]);; + + + + +let YIFVQDV_1 = prove(`!V ul k p. packing V /\ ul IN barV V k /\ + hl ul < sqrt (&2) /\ p permutes (0..k) ==> + left_action_list p ul IN barV V k`, + REWRITE_TAC[IN] THEN REPEAT STRIP_TAC THEN + ABBREV_TAC `vl = left_action_list p (ul:(real^3)list)` THEN + REWRITE_TAC[BARV] THEN + + SUBGOAL_THEN `LENGTH (vl:(real^3)list) = k + 1 /\ LENGTH (ul:(real^3)list) = k + 1` ASSUME_TAC THENL + [ + EXPAND_TAC "vl" THEN REWRITE_TAC[LENGTH_LEFT_ACTION_LIST] THEN + UNDISCH_TAC `barV V k ul` THEN SIMP_TAC[BARV]; + ALL_TAC + ] THEN + SUBGOAL_THEN `set_of_list vl = set_of_list ul:real^3->bool` ASSUME_TAC THENL + [ + EXPAND_TAC "vl" THEN + MP_TAC (ISPECL [`ul:(real^3)list`; `p:num->num`] SET_OF_LIST_LEFT_ACTION_LIST) THEN + ASM_REWRITE_TAC[ARITH_RULE `(k + 1) - 1 = k`]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `?j. vl':(real^3)list = truncate_simplex j vl /\ j + 1 <= k + 1 /\ LENGTH vl' = j + 1` CHOOSE_TAC THENL + [ + EXISTS_TAC `LENGTH (vl':(real^3)list) - 1` THEN + ABBREV_TAC `n = LENGTH (vl':(real^3)list)` THEN + MP_TAC (ISPECL [`vl:(real^3)list`; `vl':(real^3)list`] INITIAL_SUBLIST_IMP_TRUNCATE_SIMPLEX) THEN + ASM_REWRITE_TAC[ARITH_RULE `1 <= n <=> 0 < n`] THEN + ASM_SIMP_TAC[ARITH_RULE `0 < n ==> n - 1 + 1 = n`]; + ALL_TAC + ] THEN + + REWRITE_TAC[VORONOI_NONDG] THEN + ASM_REWRITE_TAC[] THEN + REPEAT CONJ_TAC THENL + [ + MATCH_MP_TAC LET_TRANS THEN + EXISTS_TAC `k + 1` THEN + ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `barV V k ul` THEN + REWRITE_TAC[BARV; VORONOI_NONDG] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `ul:(real^3)list`) THEN + ASM_SIMP_TAC[INITIAL_SUBLIST_REFL; ARITH_RULE `0 < k + 1`]; + MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `set_of_list (vl:(real^3)list)` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC SET_OF_LIST_TRUNCATE_SIMPLEX_SUBSET THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC BARV_SUBSET THEN + EXISTS_TAC `k:num` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ABBREV_TAC `a = \j. if j = 0 then &4 else aff_dim (INTERS {bis (HD vl) (v:real^3) | v | v IN set_of_list (truncate_simplex (j - 1) vl)})` THEN + SUBGOAL_THEN `!i. i <= k ==> aff_dim (voronoi_list (V:real^3->bool) (truncate_simplex i vl)) = a (i + 1)` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + EXPAND_TAC "a" THEN + REWRITE_TAC[ARITH_RULE `~(i + 1 = 0) /\ (i + 1) - 1 = i`] THEN + SUBGOAL_THEN `HD vl = HD (truncate_simplex i vl):real^3` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC (GSYM HD_TRUNCATE_SIMPLEX) THEN + ASM_REWRITE_TAC[ARITH_RULE `i + 1 <= k + 1 <=> i <= k`]; + ALL_TAC + ] THEN + + MATCH_MP_TAC YIFVQDV_lemma_aff_dim THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `set_of_list (truncate_simplex i vl) SUBSET set_of_list vl:real^3->bool` ASSUME_TAC THENL + [ + MATCH_MP_TAC SET_OF_LIST_TRUNCATE_SIMPLEX_SUBSET THEN + ASM_REWRITE_TAC[ARITH_RULE `i + 1 <= k + 1 <=> i <= k`]; + ALL_TAC + ] THEN + + REPEAT CONJ_TAC THENL + [ + MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `set_of_list vl:real^3->bool` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC BARV_SUBSET THEN + EXISTS_TAC `k:num` THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC AFFINE_INDEPENDENT_SUBSET THEN + EXISTS_TAC `set_of_list vl:real^3->bool` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC BARV_AFFINE_INDEPENDENT THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `k:num`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `hl (vl:(real^3)list)` THEN + CONJ_TAC THENL + [ + REWRITE_TAC[HL] THEN + MATCH_MP_TAC RADV_MONO THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC BARV_AFFINE_INDEPENDENT THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `k:num`] THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + EXISTS_TAC `HD (truncate_simplex i vl):real^3` THEN + MATCH_MP_TAC HD_IN_SET_OF_LIST THEN + MP_TAC (ISPECL [`i:num`; `vl:(real^3)list`] LENGTH_TRUNCATE_SIMPLEX) THEN + ASM_REWRITE_TAC[ARITH_RULE `i + 1 <= k + 1 <=> i <= k`] THEN + SIMP_TAC[ARITH_RULE `1 <= i + 1`]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[HL] THEN + ASM_REWRITE_TAC[GSYM HL]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `a 0 = int_of_num 4 /\ a 1 = &3` ASSUME_TAC THENL + [ + EXPAND_TAC "a" THEN + REWRITE_TAC[ARITH_RULE `~(1 = 0) /\ 1 - 1 = 0`] THEN + ASM_SIMP_TAC[TRUNCATE_0_EQ_HEAD; ARITH_RULE `1 <= k + 1`] THEN + REWRITE_TAC[set_of_list; IN_SING] THEN + SUBGOAL_THEN `INTERS {bis (HD vl) v | v | v = HD vl:real^3} = bis (HD vl) (HD vl)` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[EXTENSION; IN_INTERS; IN_ELIM_THM; IN_SING] THEN + GEN_TAC THEN REWRITE_TAC[GSYM EXTENSION] THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + POP_ASSUM (MP_TAC o SPEC `bis (HD vl) (HD vl):real^3->bool`) THEN + ANTS_TAC THENL [ EXISTS_TAC `HD vl:real^3` THEN REWRITE_TAC[]; ALL_TAC ] THEN + REWRITE_TAC[]; + ASM_REWRITE_TAC[] + ]; + ALL_TAC + ] THEN + REWRITE_TAC[bis] THEN + SUBGOAL_THEN `{x:real^3 | T} = UNIV` (fun th -> REWRITE_TAC[th]) THENL [ REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_UNIV]; ALL_TAC ] THEN + REWRITE_TAC[AFF_DIM_UNIV; DIMINDEX_3]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!j. j <= k ==> int_of_num 3 - &j <= a j - &1 /\ a j - &1 <= a (j + 1) /\ (a (j + 1) = &3 - &j <=> (!i. i <= j ==> a (i + 1) = &3 - &i))` ASSUME_TAC THENL + [ + INDUCT_TAC THENL + [ + DISCH_TAC THEN + ASM_SIMP_TAC[ARITH; ARITH_RULE `i <= 0 <=> i = 0`] THEN + INT_ARITH_TAC; + ALL_TAC + ] THEN + + REWRITE_TAC[ADD1] THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) THEN + ASM_SIMP_TAC[ARITH_RULE `j' + 1 <= k ==> j' <= k`] THEN + + STRIP_TAC THEN + CONJ_TAC THENL + [ + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[GSYM INT_OF_NUM_ADD] THEN + INT_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `a (j' + 1) - int_of_num 1 <= a ((j' + 1) + 1)` ASSUME_TAC THENL + [ + EXPAND_TAC "a" THEN + REWRITE_TAC[ARITH_RULE `~(j' + 1 = 0) /\ ~((j' + 1) + 1 = 0) /\ (j' + 1) - 1 = j' /\ ((j' + 1) + 1) - 1 = j' + 1`] THEN + ABBREV_TAC `s:real^3->bool = INTERS {bis (HD vl) v | v | v IN set_of_list (truncate_simplex j' vl)}` THEN + ABBREV_TAC `t:real^3->bool = INTERS {bis (HD vl) v | v | v IN set_of_list (truncate_simplex (j' + 1) vl)}` THEN + SUBGOAL_THEN `~(t = {}:real^3->bool)` ASSUME_TAC THENL + [ + EXPAND_TAC "t" THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + ABBREV_TAC `S:real^3->bool = set_of_list (truncate_simplex (j' + 1) vl)` THEN + ABBREV_TAC `c:real^3 = circumcenter S` THEN + EXISTS_TAC `c:real^3` THEN + REWRITE_TAC[IN_INTERS; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[bis; IN_ELIM_THM] THEN + MP_TAC (ISPEC `S:real^3->bool` OAPVION2) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC AFFINE_INDEPENDENT_SUBSET THEN + EXISTS_TAC `set_of_list vl:real^3->bool` THEN + CONJ_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC BARV_AFFINE_INDEPENDENT THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `k:num`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + EXPAND_TAC "S" THEN + MATCH_MP_TAC SET_OF_LIST_TRUNCATE_SIMPLEX_SUBSET THEN + MATCH_MP_TAC LE_TRANS THEN + EXISTS_TAC `k + 1` THEN + ASM_REWRITE_TAC[LE_REFL; ARITH_RULE `a + 1 <= b + 1 <=> a <= b`]; + ALL_TAC + ] THEN + + DISCH_TAC THEN + FIRST_ASSUM (MP_TAC o SPEC `v:real^3`) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `HD vl:real^3`) THEN + ANTS_TAC THENL + [ + EXPAND_TAC "S" THEN + SUBGOAL_THEN `HD vl:real^3 = HD (truncate_simplex (j' + 1) vl)` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC (GSYM HD_TRUNCATE_SIMPLEX) THEN + ASM_SIMP_TAC[ARITH_RULE `j' + 1 <= k ==> (j' + 1) + 1 <= k + 1`]; + ALL_TAC + ] THEN + MATCH_MP_TAC HD_IN_SET_OF_LIST THEN + MP_TAC (ISPECL [`j' + 1`; `vl:(real^3)list`] LENGTH_TRUNCATE_SIMPLEX) THEN + ASM_SIMP_TAC[ARITH_RULE `j' + 1 <= k ==> (j' + 1) + 1 <= k + 1`; ARITH_RULE `1 <= a + 1`]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `?w:real^3. t = s INTER bis (HD vl) w` CHOOSE_TAC THENL + [ + ABBREV_TAC `w:real^3 = LAST (truncate_simplex (j' + 1) vl)` THEN + EXISTS_TAC `w:real^3` THEN + EXPAND_TAC "t" THEN EXPAND_TAC "s" THEN + MP_TAC (ISPECL [`vl:(real^3)list`; `j':num`] TRUNCATE_SIMPLEX_ADD1) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `j' + 1 <= k` THEN + ARITH_TAC; + ALL_TAC + ] THEN + ABBREV_TAC `yl = truncate_simplex (j' + 1) vl:(real^3)list` THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th]) THEN + ASM_REWRITE_TAC[SET_OF_LIST_APPEND; set_of_list; IN_UNION; IN_SING] THEN + EXPAND_TAC "s" THEN + SET_TAC[]; + ALL_TAC + ] THEN + POP_ASSUM (ASSUME_TAC o REWRITE_RULE[BIS_EQ_HYPERPLANE]) THEN + ABBREV_TAC `aa = &2 % (w - HD vl:real^3)` THEN + ABBREV_TAC `bb = w dot (w:real^3) - HD vl dot (HD vl:real^3)` THEN + + MP_TAC (ISPECL [`aa:real^3`; `bb:real`; `s:real^3->bool`] AFF_DIM_AFFINE_INTER_HYPERPLANE) THEN + ANTS_TAC THENL + [ + EXPAND_TAC "s" THEN + REWRITE_TAC[GSYM AFFINE_HULL_EQ] THEN + MATCH_MP_TAC HULL_INTERS_EQ_INTERS THEN + REWRITE_TAC[IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[BIS_EQ_HYPERPLANE; AFFINE_HYPERPLANE]; + ALL_TAC + ] THEN + + REMOVE_ASSUM THEN REMOVE_ASSUM THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + COND_CASES_TAC THEN INT_ARITH_TAC; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + + EQ_TAC THENL + [ + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `a (j' + 1) = int_of_num 3 - &j'` MP_TAC THENL + [ + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[GSYM INT_OF_NUM_ADD] THEN + INT_ARITH_TAC; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + ASM_CASES_TAC `i = j' + 1` THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_THEN (MP_TAC o SPEC `j' + 1`) THEN + REWRITE_TAC[LE_REFL]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `a (k + 1) = int_of_num 3 - &k` MP_TAC THENL + [ + REMOVE_ASSUM THEN FIRST_X_ASSUM (MP_TAC o SPEC `k:num`) THEN + REWRITE_TAC[LE_REFL] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + SUBGOAL_THEN `truncate_simplex k vl = vl:(real^3)list` (fun th -> REWRITE_TAC[th]) THENL + [ + MP_TAC (ISPECL [`k:num`; `vl:(real^3)list`; `vl:(real^3)list`] TRUNCATE_SIMPLEX_INITIAL_SUBLIST) THEN + ASM_REWRITE_TAC[LE_REFL; INITIAL_SUBLIST_REFL]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[VORONOI_LIST] THEN + REWRITE_TAC[GSYM VORONOI_LIST] THEN + UNDISCH_TAC `barV V k ul` THEN + REWRITE_TAC[BARV; VORONOI_NONDG] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `ul:(real^3)list`) THEN + ASM_REWRITE_TAC[INITIAL_SUBLIST_REFL; ARITH_RULE `0 < k + 1`; GSYM INT_OF_NUM_ADD] THEN + INT_ARITH_TAC; + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `k:num`) THEN + REWRITE_TAC[LE_REFL] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_THEN (MP_TAC o SPEC `j:num`) THEN + ASM_REWRITE_TAC[ARITH_RULE `j <= k <=> j + 1 <= k + 1`] THEN + DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `j:num`) THEN + ASM_REWRITE_TAC[ARITH_RULE `j <= k <=> j + 1 <= k + 1`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; GSYM INT_OF_NUM_ADD]) THEN + INT_ARITH_TAC);; + + + + + +(* YIFVQDV *) + +let YIFVQDV = prove(`!V ul k p. packing V /\ ul IN barV V k /\ + hl ul < sqrt(&2) /\ p permutes (0..k) ==> + (left_action_list p ul IN barV V k) /\ (omega_list V (left_action_list p ul) = omega_list V ul)`, + REWRITE_TAC[IN] THEN REPEAT GEN_TAC THEN STRIP_TAC THEN + MP_TAC (SPEC_ALL YIFVQDV_1) THEN + ASM_REWRITE_TAC[IN] THEN + DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + ABBREV_TAC `vl:(real^3)list = left_action_list p ul` THEN + + MP_TAC (SPEC_ALL XNHPWAB1) THEN + ASM_REWRITE_TAC[IN] THEN + DISCH_TAC THEN + + MP_TAC (SPECL [`V:real^3->bool`; `vl:(real^3)list`; `k:num`] XNHPWAB1) THEN + ASM_REWRITE_TAC[HL; IN] THEN + SUBGOAL_THEN `set_of_list vl = set_of_list ul:real^3->bool` (fun th -> REWRITE_TAC[th]) THENL + [ + EXPAND_TAC "vl" THEN + MATCH_MP_TAC SET_OF_LIST_LEFT_ACTION_LIST THEN + UNDISCH_TAC `barV V k ul` THEN + ASM_SIMP_TAC[BARV; ARITH_RULE `(k + 1) - 1 = k`]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[GSYM HL]);; + + + + +(***************************************************) + +(***********) +(* KSOQKWL *) +(***********) + +let HL_TRUNCATE_SIMPLEX_OMEGA_N = prove(`!V k ul j. packing V /\ barV V k ul /\ j <= k /\ hl ul < sqrt (&2) + ==> hl (truncate_simplex j ul) = dist (omega_list_n V ul j, HD ul)`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `vl:(real^3)list = truncate_simplex j ul` THEN + SUBGOAL_THEN `barV V j vl` ASSUME_TAC THENL + [ + EXPAND_TAC "vl" THEN MATCH_MP_TAC TRUNCATE_SIMPLEX_BARV THEN + EXISTS_TAC `k:num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MP_TAC (SPECL [`V:real^3->bool`; `j:num`; `vl:(real^3)list`] HL_EQ_DIST0) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + AP_TERM_TAC THEN + REWRITE_TAC[PAIR_EQ] THEN + CONJ_TAC THENL + [ + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `j:num`] OMEGA_LIST_LEMMA) THEN + ANTS_TAC THENL + [ + UNDISCH_TAC `barV V k ul` THEN UNDISCH_TAC `j <= k:num` THEN + SIMP_TAC[BARV] THEN ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> ASM_REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC (GSYM XNHPWAB1) THEN + EXISTS_TAC `j:num` THEN + ASM_REWRITE_TAC[IN] THEN + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `hl (ul:(real^3)list)` THEN + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "vl" THEN + MATCH_MP_TAC HL_DECREASE THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `k:num`] THEN + ASM_REWRITE_TAC[IN]; + ALL_TAC + ] THEN + + EXPAND_TAC "vl" THEN + MATCH_MP_TAC HD_TRUNCATE_SIMPLEX THEN + UNDISCH_TAC `barV V k ul` THEN UNDISCH_TAC `j <= k:num` THEN + SIMP_TAC[BARV] THEN ARITH_TAC);; + + + + +let KSOQKWL_lemma0 = prove(`!V ul vl k. packing V /\ barV V k ul /\ barV V k vl /\ + ~(HD ul = HD vl) + ==> ~({omega_list_n V ul i | i <= k} = {omega_list_n V vl i | i <= k})`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + REWRITE_TAC[EXTENSION; NOT_FORALL_THM; IN_ELIM_THM] THEN + EXISTS_TAC `HD ul:real^3` THEN + MATCH_MP_TAC (TAUT `~(A ==> B) ==> ~(A <=> B)`) THEN + REWRITE_TAC[NOT_IMP] THEN + CONJ_TAC THENL [ EXISTS_TAC `0` THEN REWRITE_TAC[OMEGA_LIST_N; LE_0]; ALL_TAC ] THEN + REWRITE_TAC[NOT_EXISTS_THM; TAUT `~(A /\ B) <=> A ==> ~B`] THEN + REPEAT STRIP_TAC THEN + POP_ASSUM (ASSUME_TAC o SYM) THEN + + SUBGOAL_THEN `LENGTH (vl:(real^3)list) = k + 1 /\ LENGTH (ul:(real^3)list) = k + 1` ASSUME_TAC THENL + [ + UNDISCH_TAC `barV V k vl` THEN UNDISCH_TAC `barV V k ul` THEN SIMP_TAC[BARV]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `i + 1 <= k + 1` ASSUME_TAC THENL [ UNDISCH_TAC `i <= k:num` THEN ARITH_TAC; ALL_TAC ] THEN + + SUBGOAL_THEN `omega_list_n V vl i IN voronoi_closed V (HD vl)` MP_TAC THENL + [ + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `voronoi_list V (truncate_simplex i vl)` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC OMEGA_LIST_N_IN_VORONOI_LIST THEN + EXISTS_TAC `k:num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + SUBGOAL_THEN `HD vl = HD (truncate_simplex i vl):real^3` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC (GSYM HD_TRUNCATE_SIMPLEX) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC VORONOI_LIST_SUBSET_VORONOI_CLOSED THEN + MP_TAC (ISPECL [`i:num`; `vl:(real^3)list`] LENGTH_TRUNCATE_SIMPLEX) THEN + ASM_REWRITE_TAC[] THEN ARITH_TAC; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[voronoi_closed; IN_ELIM_THM; NOT_FORALL_THM] THEN + EXISTS_TAC `HD ul:real^3` THEN + REWRITE_TAC[NOT_IMP] THEN + CONJ_TAC THENL + [ + ONCE_REWRITE_TAC[GSYM IN] THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `set_of_list ul:real^3->bool` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC HD_IN_SET_OF_LIST THEN + ASM_REWRITE_TAC[] THEN ARITH_TAC; + ALL_TAC + ] THEN + MATCH_MP_TAC BARV_SUBSET THEN + EXISTS_TAC `k:num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[DIST_REFL; DIST_LE_0]);; + + + + +let KSOQKWL_lemma1 = prove(`!V ul vl k j. packing V /\ barV V k ul /\ barV V k vl /\ + hl ul < sqrt (&2) /\ hl vl < sqrt (&2) /\ + 0 < j /\ j <= k /\ + truncate_simplex (j - 1) ul = truncate_simplex (j - 1) vl /\ + hl (truncate_simplex j ul) <= hl (truncate_simplex j vl) /\ + ~(omega_list_n V ul j = omega_list_n V vl j) + ==> ~({omega_list_n V ul i | i <= k} = {omega_list_n V vl i | i <= k})`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + REWRITE_TAC[EXTENSION; NOT_FORALL_THM; IN_ELIM_THM] THEN + EXISTS_TAC `omega_list_n V ul j` THEN + MATCH_MP_TAC (TAUT `~(A ==> B) ==> ~(A <=> B)`) THEN + REWRITE_TAC[NOT_IMP; NOT_EXISTS_THM] THEN + CONJ_TAC THENL + [ + EXISTS_TAC `j:num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `LENGTH (ul:(real^3)list) = k + 1 /\ LENGTH (vl:(real^3)list) = k + 1` ASSUME_TAC THENL + [ + UNDISCH_TAC `barV V k ul` THEN UNDISCH_TAC `barV V k vl` THEN SIMP_TAC[BARV]; + ALL_TAC + ] THEN + SUBGOAL_THEN `j + 1 <= k + 1` ASSUME_TAC THENL [ ASM_REWRITE_TAC[ARITH_RULE `j + 1 <= k + 1 <=> j <= k`]; ALL_TAC ] THEN + MP_TAC (ARITH_RULE `0 < j /\ j <= k ==> j - 1 + 1 = j /\ j <= k + 1`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + + REWRITE_TAC[TAUT `~(A /\ B) <=> (A ==> ~B)`] THEN + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `k:num`; `ul:(real^3)list`; `j:num`] HL_TRUNCATE_SIMPLEX_OMEGA_N) THEN + MP_TAC (SPECL [`V:real^3->bool`; `k:num`; `vl:(real^3)list`; `i:num`] HL_TRUNCATE_SIMPLEX_OMEGA_N) THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `HD vl = HD ul:real^3` ASSUME_TAC THENL + [ + SUBGOAL_THEN `HD vl = HD (truncate_simplex (j - 1) ul):real^3` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC (GSYM HD_TRUNCATE_SIMPLEX) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC HD_TRUNCATE_SIMPLEX THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + + ASM_CASES_TAC `i < j:num` THENL + [ + SUBGOAL_THEN `truncate_simplex i vl:(real^3)list = truncate_simplex i ul` (fun th -> REWRITE_TAC[th]) THENL + [ + MP_TAC (ISPECL [`ul:(real^3)list`; `i:num`; `j - 1`] TRUNCATE_TRUNCATE_SIMPLEX) THEN + ANTS_TAC THENL [ ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN ARITH_TAC; ALL_TAC ] THEN + DISCH_THEN (fun th -> ASM_REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC (GSYM TRUNCATE_TRUNCATE_SIMPLEX) THEN + ASM_REWRITE_TAC[] THEN POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC (REAL_ARITH `a < b ==> ~(b = a:real)`) THEN + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `k:num`] XNHPWAB4) THEN + ASM_REWRITE_TAC[IN] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN REWRITE_TAC[NOT_LT; LE_LT] THEN + DISCH_THEN DISJ_CASES_TAC THENL + [ + MATCH_MP_TAC (REAL_ARITH `a < b ==> ~(a = b:real)`) THEN + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `hl (truncate_simplex j vl:(real^3)list)` THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL [`V:real^3->bool`; `vl:(real^3)list`; `k:num`] XNHPWAB4) THEN + ASM_REWRITE_TAC[IN] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + UNDISCH_TAC `omega_list_n V ul j = omega_list_n V vl i` THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]));; + + + + + +let AFFINE_INDEPENDENT_OMEGA_LIST_N = prove(`!V ul k. packing V /\ barV V k ul /\ hl ul < sqrt (&2) + ==> ~affine_dependent {omega_list_n V ul i | i <= k}`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + REWRITE_TAC[AFFINE_INDEPENDENT_IFF_CARD] THEN + ABBREV_TAC `A = {omega_list_n V ul i | i <= k}` THEN + SUBGOAL_THEN `FINITE (A:real^3->bool) /\ CARD A <= k + 1` ASSUME_TAC THENL + [ + EXPAND_TAC "A" THEN + SUBGOAL_THEN `!i. i <= k <=> i IN 0..k` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[IN_NUMSEG; LE_0]; + ALL_TAC + ] THEN + ONCE_REWRITE_TAC[GSYM IMAGE_LEMMA] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC FINITE_IMAGE THEN REWRITE_TAC[FINITE_NUMSEG]; + ALL_TAC + ] THEN + MP_TAC (ISPECL [`\i. omega_list_n V ul i`; `0..k`] CARD_IMAGE_LE) THEN + REWRITE_TAC[FINITE_NUMSEG; CARD_NUMSEG; ARITH_RULE `(k + 1) - 0 = k + 1`]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `k:num`] XNHPWAB3) THEN + ASM_REWRITE_TAC[IN_NUMSEG; IN; LE_0] THEN + DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + MP_TAC (ISPEC `A:real^3->bool` AFF_DIM_LE_CARD) THEN + ASM_REWRITE_TAC[] THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[GSYM INT_OF_NUM_LE; GSYM INT_OF_NUM_ADD] THEN + INT_ARITH_TAC);; + + + + +let ROGERS_EQ = prove(`!V ul vl k. packing V /\ barV V k ul /\ barV V k vl /\ + hl ul < sqrt (&2) /\ hl vl < sqrt (&2) + ==> (rogers V ul = rogers V vl <=> + {omega_list_n V ul i | i <= k} = {omega_list_n V vl i | i <= k})`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[ROGERS; IMAGE_LEMMA; IN_ELIM_THM] THEN + SUBGOAL_THEN `LENGTH (ul:(real^3)list) = k + 1 /\ LENGTH (vl:(real^3)list) = k + 1` ASSUME_TAC THENL + [ + UNDISCH_TAC `barV V k ul` THEN UNDISCH_TAC `barV V k vl` THEN SIMP_TAC[BARV]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[ARITH_RULE `x < k + 1 <=> x <= k`] THEN + MATCH_MP_TAC CONVEX_HULL_EQ_EQ_SET_EQ THEN + ASM_SIMP_TAC[AFFINE_INDEPENDENT_OMEGA_LIST_N]);; + + + +let NUM_FINITE_IMP_MAX_EXISTS = prove(`!K:num->bool. FINITE K /\ ~(K = {}) ==> ?m. m IN K /\ (!j. j IN K ==> j <= m)`, + REWRITE_TAC[GSYM IMP_IMP] THEN + MATCH_MP_TAC FINITE_INDUCT THEN REWRITE_TAC[NOT_INSERT_EMPTY] THEN + REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN + ASM_CASES_TAC `s:num->bool = {}` THEN ASM_REWRITE_TAC[] THENL + [ + ASM_REWRITE_TAC[IN_SING] THEN + EXISTS_TAC `x:num` THEN + SIMP_TAC[LE_REFL]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + ASM_CASES_TAC `m <= x:num` THENL + [ + EXISTS_TAC `x:num` THEN + REWRITE_TAC[IN_INSERT] THEN + GEN_TAC THEN + ASM_CASES_TAC `j = x:num` THEN ASM_REWRITE_TAC[LE_REFL] THEN + DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `j:num`) THEN + ASM_REWRITE_TAC[] THEN UNDISCH_TAC `m <= x:num` THEN + ARITH_TAC; + ALL_TAC + ] THEN + + EXISTS_TAC `m:num` THEN + ASM_REWRITE_TAC[IN_INSERT] THEN + GEN_TAC THEN + ASM_CASES_TAC `j = x:num` THENL + [ + ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `~(m <= x:num)` THEN ARITH_TAC; + ALL_TAC + ] THEN + ASM_SIMP_TAC[]);; + + + + + +let NOT_ID_IMP_LISTS_NOT_EQ = prove(`!ul:(A)list p k. LENGTH ul = k + 1 /\ CARD (set_of_list ul) = k + 1 /\ + p permutes (0..k) /\ ~(p = I) + ==> ~(ul = left_action_list p ul)`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `?j:num. j < k + 1 /\ ~(p j = j)` CHOOSE_TAC THENL + [ + UNDISCH_TAC `~(p = I:num->num)` THEN + REWRITE_TAC[FUN_EQ_THM; I_THM; NOT_FORALL_THM] THEN + STRIP_TAC THEN + EXISTS_TAC `x:num` THEN + ASM_REWRITE_TAC[] THEN + DISJ_CASES_TAC (ARITH_RULE `x < k + 1 \/ k < x:num`) THEN ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `p permutes 0..k` THEN + REWRITE_TAC[permutes] THEN + DISCH_THEN (CONJUNCTS_THEN2 (MP_TAC o SPEC `x:num`) (fun th -> ALL_TAC)) THEN + ASM_REWRITE_TAC[IN_NUMSEG; LE_0] THEN ARITH_TAC; + ALL_TAC + ] THEN + + UNDISCH_TAC `ul:(A)list = left_action_list p ul` THEN + DISCH_THEN (MP_TAC o AP_TERM `\l:(A)list. EL ((p:num->num) j) l`) THEN + + MP_TAC (SPECL [`ul:(A)list`; `p:num->num`; `j:num`] EL_LEFT_ACTION_LIST) THEN + ASM_REWRITE_TAC[ARITH_RULE `(k + 1) - 1 = k`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + + MP_TAC (SPEC `ul:(A)list` CARD_SET_OF_LIST_EQ_LENGTH_IMP_ALL_DISTINCT) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (ISPECL [`p:num->num`; `0..k`] Hypermap_and_fan.PERMUTES_IMP_INSIDE) THEN + ASM_REWRITE_TAC[IN_NUMSEG] THEN + DISCH_THEN (MP_TAC o SPEC `j:num`) THEN + ASM_REWRITE_TAC[LE_0; ARITH_RULE `a <= b <=> a < b + 1`]);; + + + + + + +let NOT_ID_IMP_EXISTS_MAX_EQ_TRUNCATE_SIMPLEX = prove(`!ul:(A)list p k. LENGTH ul = k + 1 /\ CARD (set_of_list ul) = k + 1 + /\ p permutes (0..k) /\ ~(p = I) + ==> ~(HD ul = HD (left_action_list p ul)) \/ + ?j. j < k /\ truncate_simplex j ul = truncate_simplex j (left_action_list p ul) + /\ ~(EL (j + 1) ul = EL (j + 1) (left_action_list p ul))`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `vl:(A)list = left_action_list p ul` THEN + SUBGOAL_THEN `LENGTH (vl:(A)list) = k + 1` ASSUME_TAC THENL + [ + EXPAND_TAC "vl" THEN + ASM_REWRITE_TAC[LENGTH_LEFT_ACTION_LIST]; + ALL_TAC + ] THEN + + ASM_CASES_TAC `HD ul = HD vl:A` THEN ASM_REWRITE_TAC[] THEN + ABBREV_TAC `K = {j | j <= k /\ truncate_simplex j (ul:(A)list) = truncate_simplex j vl}` THEN + SUBGOAL_THEN `?i:num. i IN K /\ (!j. j IN K ==> j <= i)` STRIP_ASSUME_TAC THENL + [ + MATCH_MP_TAC NUM_FINITE_IMP_MAX_EXISTS THEN + EXPAND_TAC "K" THEN CONJ_TAC THENL + [ + MATCH_MP_TAC FINITE_SUBSET THEN + EXISTS_TAC `{j | j <= k:num}` THEN + CONJ_TAC THENL + [ + SUBGOAL_THEN `!j. j <= k <=> j IN 0..k` (fun th -> REWRITE_TAC[th]) THENL [ REWRITE_TAC[IN_NUMSEG; LE_0]; ALL_TAC ] THEN + REWRITE_TAC[GSYM IMAGE_LEMMA] THEN + MATCH_MP_TAC FINITE_IMAGE THEN + REWRITE_TAC[FINITE_NUMSEG]; + ALL_TAC + ] THEN + SIMP_TAC[SUBSET; IN_ELIM_THM]; + ALL_TAC + ] THEN + + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + EXISTS_TAC `0` THEN + REWRITE_TAC[IN_ELIM_THM; LE_0] THEN + MP_TAC (SPEC `ul:(A)list` TRUNCATE_0_EQ_HEAD) THEN + MP_TAC (SPEC `vl:(A)list` TRUNCATE_0_EQ_HEAD) THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= k + 1`]; + ALL_TAC + ] THEN + + EXISTS_TAC `i:num` THEN + SUBGOAL_THEN `i < k:num` ASSUME_TAC THENL + [ + REWRITE_TAC[LT_LE] THEN + CONJ_TAC THENL + [ + UNDISCH_TAC `i:num IN K` THEN EXPAND_TAC "K" THEN + SIMP_TAC[IN_ELIM_THM]; + ALL_TAC + ] THEN + + DISCH_TAC THEN + UNDISCH_TAC `i:num IN K` THEN + EXPAND_TAC "K" THEN + ASM_REWRITE_TAC[IN_ELIM_THM; LE_REFL] THEN + MP_TAC (SPECL [`k:num`; `ul:(A)list`; `ul:(A)list`] TRUNCATE_SIMPLEX_INITIAL_SUBLIST) THEN + MP_TAC (SPECL [`k:num`; `vl:(A)list`; `vl:(A)list`] TRUNCATE_SIMPLEX_INITIAL_SUBLIST) THEN + ASM_REWRITE_TAC[LE_REFL; INITIAL_SUBLIST_REFL] THEN + REPLICATE_TAC 2 (DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th])) THEN + + EXPAND_TAC "vl" THEN + MATCH_MP_TAC NOT_ID_IMP_LISTS_NOT_EQ THEN + EXISTS_TAC `k:num` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `truncate_simplex i ul = truncate_simplex i vl:(A)list` ASSUME_TAC THENL + [ + UNDISCH_TAC `i:num IN K` THEN EXPAND_TAC "K" THEN + SIMP_TAC[IN_ELIM_THM]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + + SUBGOAL_THEN `i + 1 IN K` ASSUME_TAC THENL + [ + EXPAND_TAC "K" THEN REWRITE_TAC[IN_ELIM_THM] THEN + ASM_SIMP_TAC[ARITH_RULE `i < k ==> i + 1 <= k`] THEN + MP_TAC (ARITH_RULE `i < k ==> i + 2 <= k + 1`) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_SIMP_TAC[TRUNCATE_SIMPLEX_ADD1_ALT]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `i + 1`) THEN + ASM_REWRITE_TAC[ARITH_RULE `~(i + 1 <= i)`]);; + + + +(* KSOQKWL *) + +let KSOQKWL = prove(`!V ul p k. packing V /\ ul IN barV V k /\ hl ul < sqrt(&2) /\ + p permutes (0..k) /\ (rogers V ul = rogers V (left_action_list p ul)) ==> (p = I)`, + REWRITE_TAC[IN] THEN REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN DISCH_TAC THEN + ABBREV_TAC `vl:(real^3)list = left_action_list p ul` THEN + SUBGOAL_THEN `barV V k vl` ASSUME_TAC THENL + [ + EXPAND_TAC "vl" THEN + MP_TAC (SPEC_ALL YIFVQDV) THEN + ASM_SIMP_TAC[IN]; + ALL_TAC + ] THEN + + MP_TAC (SPEC_ALL BARV_IMP_LENGTH_EQ_CARD) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + + SUBGOAL_THEN `hl (vl:(real^3)list) < sqrt (&2)` ASSUME_TAC THENL + [ + SUBGOAL_THEN `hl (vl:(real^3)list) = hl (ul:(real^3)list)` (fun th -> ASM_REWRITE_TAC[th]) THEN + REWRITE_TAC[HL] THEN + AP_TERM_TAC THEN + EXPAND_TAC "vl" THEN + MATCH_MP_TAC SET_OF_LIST_LEFT_ACTION_LIST THEN + UNDISCH_TAC `barV V k ul` THEN SIMP_TAC[BARV] THEN + ASM_REWRITE_TAC[ARITH_RULE `(k + 1) - 1 = k`]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `LENGTH (vl:(real^3)list) = k + 1` ASSUME_TAC THENL + [ + UNDISCH_TAC `barV V k vl` THEN SIMP_TAC[BARV]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[ROGERS_EQ] THEN + + MP_TAC (ISPECL [`ul:(real^3)list`; `p:num->num`; `k:num`] NOT_ID_IMP_EXISTS_MAX_EQ_TRUNCATE_SIMPLEX) THEN + ASM_REWRITE_TAC[] THEN + + ASM_CASES_TAC `~(HD ul = HD vl:real^3)` THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC KSOQKWL_lemma0 THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + + SUBGOAL_THEN `~(omega_list_n V ul (j + 1) = omega_list_n V vl (j + 1))` ASSUME_TAC THENL + [ + DISCH_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `k:num`; `ul:(real^3)list`; `j + 1`] HL_TRUNCATE_SIMPLEX_OMEGA_N) THEN + MP_TAC (SPECL [`V:real^3->bool`; `k:num`; `vl:(real^3)list`; `j + 1`] HL_TRUNCATE_SIMPLEX_OMEGA_N) THEN + MP_TAC (ARITH_RULE `j < k ==> j + 1 <= k`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + + ABBREV_TAC `S = set_of_list (truncate_simplex (j + 1) ul:(real^3)list)` THEN + ABBREV_TAC `c:real^3 = circumcenter S` THEN + + MP_TAC (SPECL [`V:real^3->bool`; `S:real^3->bool`; `c:real^3`] XYOFCGX) THEN + SUBGOAL_THEN `barV V (j + 1) (truncate_simplex (j + 1) ul)` ASSUME_TAC THENL + [ + MATCH_MP_TAC TRUNCATE_SIMPLEX_BARV THEN + EXISTS_TAC `k:num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `~affine_dependent (S:real^3->bool)` ASSUME_TAC THENL + [ + EXPAND_TAC "S" THEN + MATCH_MP_TAC BARV_AFFINE_INDEPENDENT THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `j + 1`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `S SUBSET V:real^3->bool` ASSUME_TAC THENL + [ + EXPAND_TAC "S" THEN + MATCH_MP_TAC BARV_SUBSET THEN + EXISTS_TAC `j + 1` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "S" THEN + REWRITE_TAC[GSYM HL] THEN + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `hl (ul:(real^3)list)` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC HL_DECREASE THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `k:num`] THEN + ASM_REWRITE_TAC[IN]; + ALL_TAC + ] THEN + + ABBREV_TAC `x = EL (j + 1) ul:real^3` THEN + ABBREV_TAC `y = EL (j + 1) vl:real^3` THEN + + DISCH_THEN (MP_TAC o SPECL [`x:real^3`; `y:real^3`]) THEN + ABBREV_TAC `xl:(real^3)list = truncate_simplex (j + 1) ul` THEN + ABBREV_TAC `yl:(real^3)list = truncate_simplex (j + 1) vl` THEN + + SUBGOAL_THEN `barV V (j + 1) yl` ASSUME_TAC THENL + [ + EXPAND_TAC "yl" THEN + MATCH_MP_TAC TRUNCATE_SIMPLEX_BARV THEN + EXISTS_TAC `k:num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`V:real^3->bool`; `xl:(real^3)list`; `j + 1`] BARV_IMP_LENGTH_EQ_CARD) THEN + MP_TAC (SPECL [`V:real^3->bool`; `yl:(real^3)list`; `j + 1`] BARV_IMP_LENGTH_EQ_CARD) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN DISCH_TAC THEN + + MP_TAC (ARITH_RULE `j + 1 <= k ==> (j + 1) + 1 <= k + 1`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + + SUBGOAL_THEN `!n. n < (j + 1) + 1 ==> (EL n xl):real^3 = if (n = j + 1) then x else EL n (truncate_simplex j vl)` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`ul:(real^3)list`; `j + 1`] EL_TRUNCATE_SIMPLEX) THEN + MP_TAC (ISPECL [`ul:(real^3)list`; `j:num`] EL_TRUNCATE_SIMPLEX) THEN + ASM_REWRITE_TAC[] THEN + COND_CASES_TAC THENL + [ + DISCH_TAC THEN + DISCH_THEN (MP_TAC o SPEC `j + 1`) THEN + ASM_REWRITE_TAC[LE_REFL]; + ALL_TAC + ] THEN + + DISCH_TAC THEN DISCH_TAC THEN + POP_ASSUM (MP_TAC o SPEC `n:num`) THEN + POP_ASSUM (MP_TAC o SPEC `n:num`) THEN + ASM_SIMP_TAC[ARITH_RULE `j + 1 <= k ==> j + 1 <= k + 1`; ARITH_RULE `n < (j + 1) + 1 /\ ~(n = j + 1) ==> n <= j /\ n <= j + 1`]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!n. n < (j + 1) + 1 ==> (EL n yl):real^3 = if (n = j + 1) then y else EL n (truncate_simplex j vl)` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`vl:(real^3)list`; `j + 1`] EL_TRUNCATE_SIMPLEX) THEN + MP_TAC (ISPECL [`vl:(real^3)list`; `j:num`] EL_TRUNCATE_SIMPLEX) THEN + ASM_REWRITE_TAC[] THEN + COND_CASES_TAC THENL + [ + DISCH_TAC THEN + DISCH_THEN (MP_TAC o SPEC `j + 1`) THEN + ASM_REWRITE_TAC[LE_REFL]; + ALL_TAC + ] THEN + + DISCH_TAC THEN DISCH_TAC THEN + POP_ASSUM (MP_TAC o SPEC `n:num`) THEN + POP_ASSUM (MP_TAC o SPEC `n:num`) THEN + ASM_SIMP_TAC[ARITH_RULE `j + 1 <= k ==> j + 1 <= k + 1`; ARITH_RULE `n < (j + 1) + 1 /\ ~(n = j + 1) ==> n <= j /\ n <= j + 1`]; + ALL_TAC + ] THEN + + + SUBGOAL_THEN `x:real^3 IN S` ASSUME_TAC THENL + [ + EXPAND_TAC "S" THEN + REWRITE_TAC[IN_SET_OF_LIST] THEN + REMOVE_ASSUM THEN POP_ASSUM (MP_TAC o SPEC `j + 1`) THEN + REWRITE_TAC[ARITH_RULE `j + 1 < (j + 1) + 1`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC MEM_EL THEN + ASM_REWRITE_TAC[ARITH_RULE `j + 1 < (j + 1) + 1`]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `y:real^3 IN (set_of_list yl) DIFF S` ASSUME_TAC THENL + [ + EXPAND_TAC "S" THEN + REWRITE_TAC[IN_DIFF; IN_SET_OF_LIST; MEM_EXISTS_EL] THEN + CONJ_TAC THENL + [ + EXISTS_TAC `j + 1` THEN + ASM_SIMP_TAC[ARITH_RULE `j + 1 < (j + 1) + 1`]; + ALL_TAC + ] THEN + + REWRITE_TAC[NOT_EXISTS_THM; TAUT `~(A /\ B) <=> (A ==> ~B)`] THEN GEN_TAC THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + FIRST_ASSUM (MP_TAC o SPEC `j + 1:num`) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN + ASM_REWRITE_TAC[] THEN + + COND_CASES_TAC THENL + [ + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[ARITH_RULE `j + 1 < (j + 1) + 1`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + + MP_TAC (ISPECL [`yl:(real^3)list`] CARD_SET_OF_LIST_EQ_LENGTH_IMP_ALL_DISTINCT) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `(set_of_list yl:real^3->bool) DIFF S` THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `set_of_list yl:real^3->bool SUBSET V` MP_TAC THENL + [ + MATCH_MP_TAC BARV_SUBSET THEN + EXISTS_TAC `j + 1` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + SIMP_TAC[SUBSET; IN_DIFF]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `omega_list_n V ul (j + 1) = c:real^3` ASSUME_TAC THENL + [ + MP_TAC (SPECL [`V:real^3->bool`; `xl:(real^3)list`; `j + 1`] XNHPWAB1) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[IN] THEN + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `hl (ul:(real^3)list)` THEN + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "xl" THEN + MATCH_MP_TAC HL_DECREASE THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `k:num`] THEN + ASM_REWRITE_TAC[IN]; + ALL_TAC + ] THEN + + EXPAND_TAC "c" THEN EXPAND_TAC "S" THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + EXPAND_TAC "xl" THEN + MATCH_MP_TAC (GSYM OMEGA_LIST_LEMMA) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `hl (xl:(real^3)list) = dist (x:real^3,c)` (fun th -> REWRITE_TAC[SYM th]) THENL + [ + ASM_REWRITE_TAC[HL] THEN + MP_TAC (ISPEC `S:real^3->bool` OAPVION2) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `x:real^3`) THEN + ASM_REWRITE_TAC[DIST_SYM]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `hl (yl:(real^3)list) = dist (y:real^3,c)` (fun th -> REWRITE_TAC[SYM th]) THENL + [ + ASM_REWRITE_TAC[HL] THEN + MP_TAC (SPECL [`V:real^3->bool`; `yl:(real^3)list`; `j + 1`] XNHPWAB1) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[IN] THEN + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `hl (vl:(real^3)list)` THEN + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "yl" THEN + MATCH_MP_TAC HL_DECREASE THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `k:num`] THEN + ASM_REWRITE_TAC[IN]; + ALL_TAC + ] THEN + + DISCH_THEN (ASSUME_TAC o SYM) THEN + MP_TAC (ISPEC `set_of_list yl:real^3->bool` OAPVION2) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC BARV_AFFINE_INDEPENDENT THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `j + 1`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_THEN (MP_TAC o SPEC `y:real^3`) THEN + ANTS_TAC THENL + [ + UNDISCH_TAC `y:real^3 IN set_of_list yl DIFF S` THEN SIMP_TAC[IN_DIFF]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> ASM_REWRITE_TAC[th]) THEN + SUBGOAL_THEN `omega_list V yl = omega_list_n V ul (j + 1)` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "yl" THEN + MATCH_MP_TAC OMEGA_LIST_LEMMA THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REMOVE_ASSUM THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[DIST_SYM]; + ALL_TAC + ] THEN + + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + + ASM_CASES_TAC `hl (truncate_simplex (j + 1) ul:(real^3)list) <= hl (truncate_simplex (j + 1) vl:(real^3)list)` THENL + [ + MATCH_MP_TAC KSOQKWL_lemma1 THEN + EXISTS_TAC `j + 1` THEN + ASM_REWRITE_TAC[ARITH_RULE `0 < j + 1`; ARITH_RULE `j + 1 <= k <=> j < k`; ARITH_RULE `(j + 1) - 1 = j`]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_NOT_LE; REAL_LT_LE] THEN DISCH_TAC THEN + MATCH_MP_TAC (GSYM KSOQKWL_lemma1) THEN + EXISTS_TAC `j + 1` THEN + ASM_REWRITE_TAC[ARITH_RULE `0 < j + 1`; ARITH_RULE `j + 1 <= k <=> j < k`; ARITH_RULE `(j + 1) - 1 = j`]);; + + + + + +(*****************************************************) + +(***********) +(* IVFICRK *) +(***********) + + +let IVFICRK = prove(`!k. ?g. (BIJ g { (i,sigma ) | i IN 0..(k+1) /\ sigma permutes (0..k) } { p | p permutes (0..(k+1)) }) + /\ (!(ul:(A)list) i sigma j. (LENGTH ul = k+2) /\ j <= k /\ i IN 0..(k+1) /\ sigma permutes (0..k) ==> + (EL j ( left_action_list (g(i,sigma)) ul) = EL j (left_action_list sigma (DROP ul i) )))`, + GEN_TAC THEN + ABBREV_TAC `f = (\i j. if j = k + 1 then i else (if (i <= j /\ j < k + 1) then j + 1 else j))` THEN + ABBREV_TAC `fi = (\i j. if j = i then k + 1 else (if (i < j /\ j <= k + 1) then j - 1 else j))` THEN + SUBGOAL_THEN `!i. i <= k + 1 ==> (f:num->num->num) i o fi i = I:num->num /\ fi i o f i = I` ASSUME_TAC THENL + [ + REWRITE_TAC[IN_NUMSEG; FUN_EQ_THM; I_THM; o_THM] THEN + REPEAT STRIP_TAC THENL + [ + EXPAND_TAC "fi" THEN + COND_CASES_TAC THENL + [ + EXPAND_TAC "f" THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + COND_CASES_TAC THENL + [ + EXPAND_TAC "f" THEN + ASM_SIMP_TAC[ARITH_RULE `x <= k + 1 ==> ~(x - 1 = k + 1)`] THEN + MP_TAC (ARITH_RULE `i < x /\ x <= k + 1 ==> i <= x - 1 /\ x - 1 < k + 1`) THEN + ASM_SIMP_TAC[] THEN + POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + EXPAND_TAC "f" THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[DE_MORGAN_THM; NOT_LT; NOT_LE] THEN + DISCH_THEN DISJ_CASES_TAC THENL + [ + MP_TAC (ARITH_RULE `x <= i /\ ~(x = i) /\ i <= k + 1 ==> ~(x = k + 1)`) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + MP_TAC (ARITH_RULE `x <= i /\ i <= x ==> x = i:num`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[ARITH_RULE `k + 1 < x ==> ~(x = k + 1) /\ ~(x < k + 1)`]; + ALL_TAC + ] THEN + + EXPAND_TAC "f" THEN + COND_CASES_TAC THENL + [ + EXPAND_TAC "fi" THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + COND_CASES_TAC THENL + [ + EXPAND_TAC "fi" THEN + ASM_SIMP_TAC[ARITH_RULE `i <= x ==> ~(x + 1 = i)`] THEN + MP_TAC (ARITH_RULE `i <= x /\ x < k + 1 ==> i < x + 1 /\ x + 1 <= k + 1`) THEN + ASM_SIMP_TAC[ARITH_RULE `(x + 1) - 1 = x`]; + ALL_TAC + ] THEN + + EXPAND_TAC "fi" THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[DE_MORGAN_THM; NOT_LE; NOT_LT] THEN + DISCH_THEN DISJ_CASES_TAC THENL + [ + ASM_SIMP_TAC[ARITH_RULE `x < i ==> ~(x = i:num) /\ ~(i < x)`]; + ALL_TAC + ] THEN + + MP_TAC (ARITH_RULE `k + 1 <= x /\ ~(x = k + 1) ==> ~(x <= k + 1)`) THEN + ASM_SIMP_TAC[] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!i j. i <= k + 1 ==> (f:num->num->num) i (fi i j) = j /\ fi i (f i j) = j` ASSUME_TAC THENL + [ + GEN_TAC THEN GEN_TAC THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN + ASM_REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM] THEN + DISCH_THEN (CONJUNCTS_THEN (ASSUME_TAC o SPEC `j:num`)) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!i. i <= k + 1 ==> f i permutes (0..k+1) /\ fi i permutes (0..k+1)` ASSUME_TAC THENL + [ + GEN_TAC THEN DISCH_TAC THEN + SUBGOAL_THEN `(f:num->num->num) i permutes (0..k+1)` ASSUME_TAC THENL + [ + REWRITE_TAC[permutes; IN_NUMSEG; DE_MORGAN_THM; NOT_LE; ARITH_RULE `~(x < 0)`] THEN + REPEAT STRIP_TAC THENL + [ + EXPAND_TAC "f" THEN + ASM_SIMP_TAC[ARITH_RULE `k + 1 < x ==> ~(x = k + 1) /\ ~(x < k + 1)`]; + ALL_TAC + ] THEN + + REWRITE_TAC[EXISTS_UNIQUE] THEN + EXISTS_TAC `(fi:num->num->num) i y` THEN + CONJ_TAC THENL + [ + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + GEN_TAC THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC Hypermap_and_fan.INVERSE_PERMUTES THEN + EXISTS_TAC `(f:num->num->num) i` THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + + ABBREV_TAC `g = \(i:num,sigma:num->num). sigma o (fi:num->num->num) i` THEN + EXISTS_TAC `g:(num#(num->num))->num->num` THEN + + + SUBGOAL_THEN `!i sigma. i <= k + 1 /\ sigma permutes 0..k ==> g (i,sigma) permutes (0..k+1)` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + EXPAND_TAC "g" THEN + REWRITE_TAC[] THEN + MATCH_MP_TAC PERMUTES_COMPOSE THEN + ASM_SIMP_TAC[] THEN + MATCH_MP_TAC PERMUTES_SUBSET THEN + EXISTS_TAC `0..k` THEN + ASM_REWRITE_TAC[SUBSET_NUMSEG] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!i sigma. i <= k + 1 /\ sigma permutes 0..k ==> inverse (g (i,sigma)) (k + 1) = i` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `g (i:num, sigma:num->num) i = k + 1` MP_TAC THENL + [ + EXPAND_TAC "g" THEN REWRITE_TAC[o_THM] THEN + EXPAND_TAC "fi" THEN REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[permutes; IN_NUMSEG; DE_MORGAN_THM; NOT_LE; ARITH_RULE `~(x < 0)`] THEN + DISCH_THEN (CONJUNCTS_THEN2 (MP_TAC o SPEC `k + 1`) (fun th -> ALL_TAC)) THEN + SIMP_TAC[ARITH_RULE `k < k + 1`]; + ALL_TAC + ] THEN + + DISCH_THEN (MP_TAC o AP_TERM `\x:num. (inverse (g (i:num, sigma:num->num)) x):num`) THEN BETA_TAC THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + + MP_TAC (ISPECL [`(g (i:num, sigma:num->num)):num->num`; `0..k+1`] PERMUTES_INVERSES) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + REWRITE_TAC[BIJ; INJ; SURJ; IN_ELIM_THM; IN_NUMSEG; ARITH_RULE `0 <= i`] THEN + REPEAT STRIP_TAC THENL + [ + ASM_SIMP_TAC[]; + + ASM_REWRITE_TAC[PAIR_EQ] THEN + FIRST_ASSUM (MP_TAC o SPECL [`i:num`; `sigma:num->num`]) THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`i':num`; `sigma':num->num`]) THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN DISCH_TAC THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[IMP_IMP] THEN DISCH_THEN (CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN + EXPAND_TAC "g" THEN REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o AP_TERM `(\x:num->num. x o (f:num->num->num) i)`) THEN + ASM_SIMP_TAC[GSYM o_ASSOC; I_O_ID]; + + ASM_SIMP_TAC[]; + + ABBREV_TAC `r = inverse (x:num->num) (k + 1)` THEN + EXISTS_TAC `r:num, (x:num->num) o (f:num->num->num) r` THEN + + SUBGOAL_THEN `r <= k + 1` ASSUME_TAC THENL + [ + MP_TAC (ISPECL [`x:num->num`; `0..k+1`] PERMUTES_INVERSE) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (ISPECL [`inverse (x:num->num)`; `0..k+1`] Hypermap_and_fan.PERMUTES_IMP_INSIDE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `k + 1`) THEN + ASM_REWRITE_TAC[IN_NUMSEG; LE_0; LE_REFL]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + EXISTS_TAC `r:num` THEN + EXISTS_TAC `(x:num->num) o (f:num->num->num) r` THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `(x:num->num) o (f:num->num->num) r permutes 0..k+1` MP_TAC THENL + [ + MATCH_MP_TAC PERMUTES_COMPOSE THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + SIMP_TAC[permutes; IN_NUMSEG; DE_MORGAN_THM; NOT_LE; ARITH_RULE `~(x < 0)`] THEN + DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC (fun th -> ALL_TAC)) THEN + X_GEN_TAC `j:num` THEN + ONCE_REWRITE_TAC[ARITH_RULE `k < j <=> j = k + 1 \/ k + 1 < j`] THEN + DISCH_THEN DISJ_CASES_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "r" THEN + REWRITE_TAC[o_THM] THEN + EXPAND_TAC "f" THEN + REWRITE_TAC[] THEN + MP_TAC (ISPECL [`x:num->num`; `0..k+1`] PERMUTES_INVERSES) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + EXPAND_TAC "g" THEN REWRITE_TAC[GSYM o_ASSOC] THEN + ASM_SIMP_TAC[I_O_ID] + ]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `j < k + 2 /\ j < k + 1` ASSUME_TAC THENL + [ + UNDISCH_TAC `j <= k:num` THEN ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `i < k + 2` ASSUME_TAC THENL + [ + UNDISCH_TAC `i IN 0..k+1` THEN REWRITE_TAC[IN_NUMSEG] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `LENGTH (DROP (ul:(A)list) i) = k + 1` ASSUME_TAC THENL + [ + MP_TAC (SPECL [`i:num`; `ul:(A)list`] LENGTH_DROP) THEN + ASM_REWRITE_TAC[] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[left_action_list; EL_TABLE] THEN + ABBREV_TAC `r = inverse (sigma:num->num) j` THEN + MP_TAC (SPECL [`i:num`; `r:num`; `ul:(A)list`] EL_DROP) THEN + + SUBGOAL_THEN `r <= k:num` ASSUME_TAC THENL + [ + MP_TAC (ISPECL [`sigma:num->num`; `0..k`] PERMUTES_INVERSE) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (ISPECL [`inverse (sigma:num->num)`; `0..k`] Hypermap_and_fan.PERMUTES_IMP_INSIDE) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (MP_TAC o SPEC `j:num`) THEN + ASM_REWRITE_TAC[IN_NUMSEG; LE_0]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[ARITH_RULE `r < (k + 2) - 1 <=> r <= k`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + EXPAND_TAC "g" THEN REWRITE_TAC[] THEN + + SUBGOAL_THEN `inverse ((sigma:num->num) o (fi:num->num->num) i) = (f:num->num->num) i o inverse sigma` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC INVERSE_UNIQUE_o THEN + SUBGOAL_THEN `!a:num->num b:num->num c:num->num d:num->num. (a o b) o c o d = a o (b o c) o d` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[o_ASSOC]; + ALL_TAC + ] THEN + + UNDISCH_TAC `!i. i <= k + 1 ==> (f:num->num->num) i o fi i = I /\ fi i o f i = I` THEN + DISCH_THEN (MP_TAC o SPEC `i:num`) THEN + ASM_REWRITE_TAC[ARITH_RULE `i <= k + 1 <=> i < k + 2`] THEN + DISCH_TAC THEN + MP_TAC (ISPECL [`sigma:num->num`; `0..k`] PERMUTES_INVERSES_o) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_REWRITE_TAC[I_O_ID]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[o_THM] THEN + EXPAND_TAC "f" THEN + ASM_SIMP_TAC[ARITH_RULE `r <= k ==> ~(r = k + 1) /\ r < k + 1`] THEN + ONCE_REWRITE_TAC[GSYM NOT_LE] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[]);; + + + +(* COPY *) + +let IVFICRK_real3 = prove(`!k. ?g. (BIJ g { (i,sigma ) | i IN 0..(k+1) /\ sigma permutes (0..k) } { p | p permutes (0..(k+1)) }) + /\ (!(ul:(real^3)list) i sigma j. (LENGTH ul = k+2) /\ j <= k /\ i IN 0..(k+1) /\ sigma permutes (0..k) ==> + (EL j ( left_action_list (g(i,sigma)) ul) = EL j (left_action_list sigma (DROP ul i) )))`, + GEN_TAC THEN + ABBREV_TAC `f = (\i j. if j = k + 1 then i else (if (i <= j /\ j < k + 1) then j + 1 else j))` THEN + ABBREV_TAC `fi = (\i j. if j = i then k + 1 else (if (i < j /\ j <= k + 1) then j - 1 else j))` THEN + SUBGOAL_THEN `!i. i <= k + 1 ==> (f:num->num->num) i o fi i = I:num->num /\ fi i o f i = I` ASSUME_TAC THENL + [ + REWRITE_TAC[IN_NUMSEG; FUN_EQ_THM; I_THM; o_THM] THEN + REPEAT STRIP_TAC THENL + [ + EXPAND_TAC "fi" THEN + COND_CASES_TAC THENL + [ + EXPAND_TAC "f" THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + COND_CASES_TAC THENL + [ + EXPAND_TAC "f" THEN + ASM_SIMP_TAC[ARITH_RULE `x <= k + 1 ==> ~(x - 1 = k + 1)`] THEN + MP_TAC (ARITH_RULE `i < x /\ x <= k + 1 ==> i <= x - 1 /\ x - 1 < k + 1`) THEN + ASM_SIMP_TAC[] THEN + POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + EXPAND_TAC "f" THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[DE_MORGAN_THM; NOT_LT; NOT_LE] THEN + DISCH_THEN DISJ_CASES_TAC THENL + [ + MP_TAC (ARITH_RULE `x <= i /\ ~(x = i) /\ i <= k + 1 ==> ~(x = k + 1)`) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + MP_TAC (ARITH_RULE `x <= i /\ i <= x ==> x = i:num`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[ARITH_RULE `k + 1 < x ==> ~(x = k + 1) /\ ~(x < k + 1)`]; + ALL_TAC + ] THEN + + EXPAND_TAC "f" THEN + COND_CASES_TAC THENL + [ + EXPAND_TAC "fi" THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + COND_CASES_TAC THENL + [ + EXPAND_TAC "fi" THEN + ASM_SIMP_TAC[ARITH_RULE `i <= x ==> ~(x + 1 = i)`] THEN + MP_TAC (ARITH_RULE `i <= x /\ x < k + 1 ==> i < x + 1 /\ x + 1 <= k + 1`) THEN + ASM_SIMP_TAC[ARITH_RULE `(x + 1) - 1 = x`]; + ALL_TAC + ] THEN + + EXPAND_TAC "fi" THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[DE_MORGAN_THM; NOT_LE; NOT_LT] THEN + DISCH_THEN DISJ_CASES_TAC THENL + [ + ASM_SIMP_TAC[ARITH_RULE `x < i ==> ~(x = i:num) /\ ~(i < x)`]; + ALL_TAC + ] THEN + + MP_TAC (ARITH_RULE `k + 1 <= x /\ ~(x = k + 1) ==> ~(x <= k + 1)`) THEN + ASM_SIMP_TAC[] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!i j. i <= k + 1 ==> (f:num->num->num) i (fi i j) = j /\ fi i (f i j) = j` ASSUME_TAC THENL + [ + GEN_TAC THEN GEN_TAC THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN + ASM_REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM] THEN + DISCH_THEN (CONJUNCTS_THEN (ASSUME_TAC o SPEC `j:num`)) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!i. i <= k + 1 ==> f i permutes (0..k+1) /\ fi i permutes (0..k+1)` ASSUME_TAC THENL + [ + GEN_TAC THEN DISCH_TAC THEN + SUBGOAL_THEN `(f:num->num->num) i permutes (0..k+1)` ASSUME_TAC THENL + [ + REWRITE_TAC[permutes; IN_NUMSEG; DE_MORGAN_THM; NOT_LE; ARITH_RULE `~(x < 0)`] THEN + REPEAT STRIP_TAC THENL + [ + EXPAND_TAC "f" THEN + ASM_SIMP_TAC[ARITH_RULE `k + 1 < x ==> ~(x = k + 1) /\ ~(x < k + 1)`]; + ALL_TAC + ] THEN + + REWRITE_TAC[EXISTS_UNIQUE] THEN + EXISTS_TAC `(fi:num->num->num) i y` THEN + CONJ_TAC THENL + [ + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + GEN_TAC THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC Hypermap_and_fan.INVERSE_PERMUTES THEN + EXISTS_TAC `(f:num->num->num) i` THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + + ABBREV_TAC `g = \(i:num,sigma:num->num). sigma o (fi:num->num->num) i` THEN + EXISTS_TAC `g:(num#(num->num))->num->num` THEN + + + SUBGOAL_THEN `!i sigma. i <= k + 1 /\ sigma permutes 0..k ==> g (i,sigma) permutes (0..k+1)` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + EXPAND_TAC "g" THEN + REWRITE_TAC[] THEN + MATCH_MP_TAC PERMUTES_COMPOSE THEN + ASM_SIMP_TAC[] THEN + MATCH_MP_TAC PERMUTES_SUBSET THEN + EXISTS_TAC `0..k` THEN + ASM_REWRITE_TAC[SUBSET_NUMSEG] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!i sigma. i <= k + 1 /\ sigma permutes 0..k ==> inverse (g (i,sigma)) (k + 1) = i` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `g (i:num, sigma:num->num) i = k + 1` MP_TAC THENL + [ + EXPAND_TAC "g" THEN REWRITE_TAC[o_THM] THEN + EXPAND_TAC "fi" THEN REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[permutes; IN_NUMSEG; DE_MORGAN_THM; NOT_LE; ARITH_RULE `~(x < 0)`] THEN + DISCH_THEN (CONJUNCTS_THEN2 (MP_TAC o SPEC `k + 1`) (fun th -> ALL_TAC)) THEN + SIMP_TAC[ARITH_RULE `k < k + 1`]; + ALL_TAC + ] THEN + + DISCH_THEN (MP_TAC o AP_TERM `\x:num. (inverse (g (i:num, sigma:num->num)) x):num`) THEN BETA_TAC THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + + MP_TAC (ISPECL [`(g (i:num, sigma:num->num)):num->num`; `0..k+1`] PERMUTES_INVERSES) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + REWRITE_TAC[BIJ; INJ; SURJ; IN_ELIM_THM; IN_NUMSEG; ARITH_RULE `0 <= i`] THEN + REPEAT STRIP_TAC THENL + [ + ASM_SIMP_TAC[]; + + ASM_REWRITE_TAC[PAIR_EQ] THEN + FIRST_ASSUM (MP_TAC o SPECL [`i:num`; `sigma:num->num`]) THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`i':num`; `sigma':num->num`]) THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN DISCH_TAC THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[IMP_IMP] THEN DISCH_THEN (CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN + EXPAND_TAC "g" THEN REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o AP_TERM `(\x:num->num. x o (f:num->num->num) i)`) THEN + ASM_SIMP_TAC[GSYM o_ASSOC; I_O_ID]; + + ASM_SIMP_TAC[]; + + ABBREV_TAC `r = inverse (x:num->num) (k + 1)` THEN + EXISTS_TAC `r:num, (x:num->num) o (f:num->num->num) r` THEN + + SUBGOAL_THEN `r <= k + 1` ASSUME_TAC THENL + [ + MP_TAC (ISPECL [`x:num->num`; `0..k+1`] PERMUTES_INVERSE) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (ISPECL [`inverse (x:num->num)`; `0..k+1`] Hypermap_and_fan.PERMUTES_IMP_INSIDE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `k + 1`) THEN + ASM_REWRITE_TAC[IN_NUMSEG; LE_0; LE_REFL]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + EXISTS_TAC `r:num` THEN + EXISTS_TAC `(x:num->num) o (f:num->num->num) r` THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `(x:num->num) o (f:num->num->num) r permutes 0..k+1` MP_TAC THENL + [ + MATCH_MP_TAC PERMUTES_COMPOSE THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + SIMP_TAC[permutes; IN_NUMSEG; DE_MORGAN_THM; NOT_LE; ARITH_RULE `~(x < 0)`] THEN + DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC (fun th -> ALL_TAC)) THEN + X_GEN_TAC `j:num` THEN + ONCE_REWRITE_TAC[ARITH_RULE `k < j <=> j = k + 1 \/ k + 1 < j`] THEN + DISCH_THEN DISJ_CASES_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "r" THEN + REWRITE_TAC[o_THM] THEN + EXPAND_TAC "f" THEN + REWRITE_TAC[] THEN + MP_TAC (ISPECL [`x:num->num`; `0..k+1`] PERMUTES_INVERSES) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + EXPAND_TAC "g" THEN REWRITE_TAC[GSYM o_ASSOC] THEN + ASM_SIMP_TAC[I_O_ID] + ]; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `j < k + 2 /\ j < k + 1` ASSUME_TAC THENL + [ + UNDISCH_TAC `j <= k:num` THEN ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `i < k + 2` ASSUME_TAC THENL + [ + UNDISCH_TAC `i IN 0..k+1` THEN REWRITE_TAC[IN_NUMSEG] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `LENGTH (DROP (ul:(real^3)list) i) = k + 1` ASSUME_TAC THENL + [ + MP_TAC (ISPECL [`i:num`; `ul:(real^3)list`] LENGTH_DROP) THEN + ASM_REWRITE_TAC[] THEN + ARITH_TAC; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[left_action_list; EL_TABLE] THEN + ABBREV_TAC `r = inverse (sigma:num->num) j` THEN + MP_TAC (ISPECL [`i:num`; `r:num`; `ul:(real^3)list`] EL_DROP) THEN + + SUBGOAL_THEN `r <= k:num` ASSUME_TAC THENL + [ + MP_TAC (ISPECL [`sigma:num->num`; `0..k`] PERMUTES_INVERSE) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (ISPECL [`inverse (sigma:num->num)`; `0..k`] Hypermap_and_fan.PERMUTES_IMP_INSIDE) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (MP_TAC o SPEC `j:num`) THEN + ASM_REWRITE_TAC[IN_NUMSEG; LE_0]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[ARITH_RULE `r < (k + 2) - 1 <=> r <= k`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + EXPAND_TAC "g" THEN REWRITE_TAC[] THEN + + SUBGOAL_THEN `inverse ((sigma:num->num) o (fi:num->num->num) i) = (f:num->num->num) i o inverse sigma` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC INVERSE_UNIQUE_o THEN + SUBGOAL_THEN `!a:num->num b:num->num c:num->num d:num->num. (a o b) o c o d = a o (b o c) o d` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[o_ASSOC]; + ALL_TAC + ] THEN + + UNDISCH_TAC `!i. i <= k + 1 ==> (f:num->num->num) i o fi i = I /\ fi i o f i = I` THEN + DISCH_THEN (MP_TAC o SPEC `i:num`) THEN + ASM_REWRITE_TAC[ARITH_RULE `i <= k + 1 <=> i < k + 2`] THEN + DISCH_TAC THEN + MP_TAC (ISPECL [`sigma:num->num`; `0..k`] PERMUTES_INVERSES_o) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_REWRITE_TAC[I_O_ID]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[o_THM] THEN + EXPAND_TAC "f" THEN + ASM_SIMP_TAC[ARITH_RULE `r <= k ==> ~(r = k + 1) /\ r < k + 1`] THEN + ONCE_REWRITE_TAC[GSYM NOT_LE] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[]);; + + + + +(******************************************) + +(* WQPRRDY *) + +let WQPRRDY = prove(`!V ul k. packing V /\ ul IN barV V k /\ hl ul < sqrt(&2) ==> + (convex hull (set_of_list ul) = UNIONS { rogers V (left_action_list p ul) | p permutes (0..k) })`, + GEN_TAC THEN REWRITE_TAC[IN] THEN ONCE_REWRITE_TAC[SWAP_FORALL_THM] THEN + INDUCT_TAC THEN REPEAT STRIP_TAC THENL + [ + SUBGOAL_THEN `?x:real^3. ul = [x]` CHOOSE_TAC THENL + [ + EXISTS_TAC `HD ul:real^3` THEN + MATCH_MP_TAC LENGTH_1_LEMMA THEN + UNDISCH_TAC `barV V 0 ul` THEN SIMP_TAC[BARV; ARITH]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SING; PERMUTES_TRIVIAL; SING_GSPEC_APP; LEFT_ACTION_LIST_I] THEN + REWRITE_TAC[ROGERS; LENGTH; ARITH_RULE `j < SUC 0 <=> j = 0`; SING_GSPEC; IMAGE_LEMMA; IN_SING; SING_GSPEC_APP; CONVEX_HULL_SING] THEN + REWRITE_TAC[OMEGA_LIST_N; HD; UNIONS_1]; + ALL_TAC + ] THEN + + ABBREV_TAC `S:real^3->bool = set_of_list ul` THEN + MP_TAC (ISPECL [`S:real^3->bool`; `omega_list V ul`] CONVEX_HULL_EXCHANGE_UNION) THEN + ANTS_TAC THENL + [ + EXPAND_TAC "S" THEN + MATCH_MP_TAC XNHPWAB2 THEN + EXISTS_TAC `SUC k` THEN ASM_REWRITE_TAC[IN]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ABBREV_TAC `u = omega_list V ul` THEN + + EXPAND_TAC "S" THEN ASM_REWRITE_TAC[IN_SET_OF_LIST] THEN + MP_TAC (ISPECL [`V:real^3->bool`; `ul:(real^3)list`; `SUC k`] BARV_IMP_LENGTH_EQ_CARD) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + + + MP_TAC (SPEC `k:num` IVFICRK_real3) THEN + DISCH_THEN (CHOOSE_THEN (CONJUNCTS_THEN2 (LABEL_TAC "g0") ASSUME_TAC)) THEN + POP_ASSUM (MP_TAC o ISPEC `ul:(real^3)list`) THEN + ASM_REWRITE_TAC[ARITH_RULE `SUC k + 1 = k + 2`; IN_NUMSEG; LE_0] THEN DISCH_THEN (LABEL_TAC "tmp") THEN + + SUBGOAL_THEN `!i p. i < SUC k + 1 /\ p permutes 0..k ==> g (i,p) permutes 0..SUC k` (LABEL_TAC "g1") THENL + [ + REPEAT STRIP_TAC THEN + REMOVE_THEN "g0" MP_TAC THEN + REWRITE_TAC[BIJ; INJ; GSYM CONJ_ASSOC] THEN + DISCH_THEN (CONJUNCTS_THEN2 MP_TAC (fun th -> ALL_TAC)) THEN + DISCH_THEN (MP_TAC o SPEC `i:num, p:num->num`) THEN + REWRITE_TAC[IN_ELIM_THM; ADD1] THEN + ANTS_TAC THENL + [ + MAP_EVERY EXISTS_TAC [`i:num`; `p:num->num`] THEN + ASM_REWRITE_TAC[IN_NUMSEG; LE_0; ARITH_RULE `i <= k + 1 <=> i < SUC k + 1`]; + ALL_TAC + ] THEN + REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!s. s permutes 0..SUC k ==> ?i p. i < SUC k + 1 /\ p permutes 0..k /\ s = g(i,p)` (LABEL_TAC "g2") THENL + [ + REWRITE_TAC[ADD1; ARITH_RULE `i < (k + 1) + 1 <=> i <= k + 1`] THEN + REPEAT STRIP_TAC THEN + REMOVE_THEN "g0" MP_TAC THEN + REWRITE_TAC[BIJ; SURJ] THEN + REPLICATE_TAC 2 (DISCH_THEN (CONJUNCTS_THEN2 (fun th -> ALL_TAC) MP_TAC)) THEN + DISCH_THEN (MP_TAC o SPEC `s:num->num`) THEN + ASM_REWRITE_TAC[IN_ELIM_THM; IN_NUMSEG; LE_0] THEN + STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`i:num`; `sigma:num->num`] THEN + POP_ASSUM MP_TAC THEN + ASM_REWRITE_TAC[EQ_SYM_EQ]; + ALL_TAC + ] THEN + + REMOVE_THEN "g0" (fun th -> ALL_TAC) THEN + + SUBGOAL_THEN `!i p r. i < SUC k + 1 /\ r <= k /\ p permutes 0..k ==> truncate_simplex r (left_action_list (g(i,p)) ul:(real^3)list) = truncate_simplex r (left_action_list p (DROP ul i))` (LABEL_TAC "tr") THENL + [ + REPEAT STRIP_TAC THEN + REWRITE_TAC[LIST_EL_EQ] THEN + ABBREV_TAC `xl:(real^3)list = truncate_simplex r (left_action_list (g (i:num,p:num->num)) ul)` THEN + ABBREV_TAC `yl:(real^3)list = truncate_simplex r (left_action_list p (DROP ul i))` THEN + + MP_TAC (ISPECL [`i:num`; `ul:(real^3)list`] LENGTH_DROP) THEN + ASM_REWRITE_TAC[ARITH_RULE `(SUC k + 1) - 1 = SUC k`] THEN DISCH_TAC THEN + MP_TAC (ISPECL [`r:num`; `left_action_list (g (i:num,p:num->num)) ul:(real^3)list`] LENGTH_TRUNCATE_SIMPLEX) THEN + MP_TAC (ARITH_RULE `r <= k ==> r + 1 <= SUC k + 1`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_REWRITE_TAC[LENGTH_LEFT_ACTION_LIST] THEN + + MP_TAC (ISPECL [`r:num`; `left_action_list p (DROP ul i):(real^3)list`] LENGTH_TRUNCATE_SIMPLEX) THEN + ASM_SIMP_TAC[LENGTH_LEFT_ACTION_LIST; ARITH_RULE `r <= k ==> r + 1 <= SUC k`] THEN + + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`left_action_list (g(i:num,p:num->num)) ul:(real^3)list`; `r:num`; `j:num`] EL_TRUNCATE_SIMPLEX) THEN + ASM_REWRITE_TAC[LENGTH_LEFT_ACTION_LIST] THEN + MP_TAC (ARITH_RULE `j < r + 1 ==> j <= r`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + + MP_TAC (ISPECL [`left_action_list p (DROP ul i):(real^3)list`; `r:num`; `j:num`] EL_TRUNCATE_SIMPLEX) THEN + ASM_REWRITE_TAC[LENGTH_LEFT_ACTION_LIST; ARITH_RULE `r + 1 <= SUC k <=> r <= k`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `r <= k:num` THEN UNDISCH_TAC `j <= r:num` THEN UNDISCH_TAC `i < SUC k + 1` THEN + ARITH_TAC; + ALL_TAC + ] THEN + + REMOVE_THEN "tmp" (fun th -> ALL_TAC) THEN + + SUBGOAL_THEN `!i b:real^3. i < SUC k + 1 /\ b = EL i ul ==> convex hull (u INSERT (S DELETE b)) = UNIONS {convex hull (u INSERT rogers V (left_action_list p (DROP ul i))) | p permutes 0..k}` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`i:num`; `ul:(real^3)list`] SET_OF_LIST_DELETE_EQ_DROP) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + + ABBREV_TAC `vl:(real^3)list = DROP ul i` THEN + FIRST_X_ASSUM (MP_TAC o SPEC `vl:(real^3)list`) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`i:num`; `I:num->num`; `k:num`]) THEN + ASM_REWRITE_TAC[PERMUTES_I; LE_REFL; LEFT_ACTION_LIST_I] THEN + MP_TAC (ISPECL [`i:num`; `ul:(real^3)list`] LENGTH_DROP) THEN + ASM_REWRITE_TAC[ARITH_RULE `(SUC k + 1) - 1 = k + 1`] THEN DISCH_TAC THEN + ABBREV_TAC `xl:(real^3)list = left_action_list (g (i:num, I:num->num)) ul` THEN + SUBGOAL_THEN `truncate_simplex k vl = vl:(real^3)list` (fun th -> REWRITE_TAC[th]) THENL + [ + MP_TAC (ISPECL [`k:num`; `vl:(real^3)list`; `vl:(real^3)list`] TRUNCATE_SIMPLEX_INITIAL_SUBLIST) THEN + ASM_REWRITE_TAC[LE_REFL; INITIAL_SUBLIST_REFL]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`i:num`; `I:num->num`]) THEN + ASM_REWRITE_TAC[PERMUTES_I] THEN DISCH_TAC THEN + + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `SUC k`; `(g(i:num,I:num->num)):num->num`] YIFVQDV) THEN + ASM_REWRITE_TAC[IN] THEN DISCH_TAC THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC TRUNCATE_SIMPLEX_BARV THEN + EXISTS_TAC `SUC k` THEN ASM_REWRITE_TAC[ARITH_RULE `k <= SUC k`]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `hl (xl:(real^3)list)` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC HL_DECREASE THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `SUC k`] THEN + ASM_REWRITE_TAC[IN; ARITH_RULE `k <= SUC k`]; + ALL_TAC + ] THEN + + EXPAND_TAC "xl" THEN + REWRITE_TAC[HL] THEN + ASM_SIMP_TAC[ARITH_RULE `(SUC k + 1) - 1 = SUC k`; SET_OF_LIST_LEFT_ACTION_LIST] THEN + EXPAND_TAC "S" THEN REWRITE_TAC[GSYM HL] THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + + SUBGOAL_THEN `convex hull (u:real^3 INSERT set_of_list vl) = convex hull (u INSERT convex hull set_of_list vl)` (fun th -> REWRITE_TAC[th]) THENL + [ + MP_TAC (ISPECL [`{u:real^3}`; `set_of_list vl:real^3->bool`] CONV_UNION_lemma) THEN + REWRITE_TAC[SET_RULE `!x s. {x:real^3} UNION s = x INSERT s`]; + ALL_TAC + ] THEN + + DISCH_THEN (LABEL_TAC "A") THEN ASM_REWRITE_TAC[] THEN + ABBREV_TAC `f = {rogers V (left_action_list p vl) | p permutes 0..k}` THEN + ONCE_REWRITE_TAC[SET_RULE `!x s. (x:real^3) INSERT s = {x} UNION s`] THEN + MP_TAC (ISPECL [`f:(real^3->bool)->bool`; `{u:real^3}`] CONVEX_HULL_UNION_UNIONS) THEN + ANTS_TAC THENL + [ + REMOVE_THEN "A" (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY; CONVEX_CONVEX_HULL] THEN + EXISTS_TAC `rogers V vl` THEN + EXPAND_TAC "f" THEN + REWRITE_TAC[IN_ELIM_THM] THEN + EXISTS_TAC `I:num->num` THEN + REWRITE_TAC[LEFT_ACTION_LIST_I; PERMUTES_I]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + AP_TERM_TAC THEN + ASM SET_TAC[]; + ALL_TAC + ] THEN + + + SUBGOAL_THEN `!i p. i < SUC k + 1 /\ p permutes 0..k ==> convex hull (u:real^3 INSERT rogers V (left_action_list p (DROP ul i))) = rogers V (left_action_list (g (i, p)) ul)` (LABEL_TAC "r") THENL + [ + REPEAT STRIP_TAC THEN + REWRITE_TAC[ROGERS] THEN + ABBREV_TAC `xl:(real^3)list = left_action_list p (DROP ul i)` THEN + ABBREV_TAC `yl:(real^3)list = left_action_list (g (i:num, p:num->num)) ul` THEN + SUBGOAL_THEN `!s:real^3->bool. convex hull (u INSERT convex hull s) = convex hull (u INSERT s)` (fun th -> REWRITE_TAC[th]) THENL + [ + GEN_TAC THEN + MP_TAC (ISPECL [`{u:real^3}`; `s:real^3->bool`] CONV_UNION_lemma) THEN + SIMP_TAC[SET_RULE `{u:real^3} UNION s = u INSERT s`]; + ALL_TAC + ] THEN + + AP_TERM_TAC THEN + EXPAND_TAC "xl" THEN EXPAND_TAC "yl" THEN + ASM_REWRITE_TAC[LENGTH_LEFT_ACTION_LIST] THEN + + MP_TAC (ISPECL [`i:num`; `ul:(real^3)list`] LENGTH_DROP) THEN + ASM_REWRITE_TAC[ARITH_RULE `(SUC k + 1) - 1 = SUC k`] THEN DISCH_TAC THEN + + SUBGOAL_THEN `u = omega_list_n V yl (SUC k)` ASSUME_TAC THENL + [ + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `SUC k`; `(g (i:num, p:num->num)):num->num`] YIFVQDV) THEN + ASM_SIMP_TAC[IN] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + + MP_TAC (SPECL [`V:real^3->bool`; `yl:(real^3)list`; `SUC k`] OMEGA_LIST_LEMMA) THEN + EXPAND_TAC "yl" THEN ASM_REWRITE_TAC[LENGTH_LEFT_ACTION_LIST; LE_REFL] THEN + MP_TAC (ISPECL [`SUC k`; `yl:(real^3)list`; `yl:(real^3)list`] TRUNCATE_SIMPLEX_INITIAL_SUBLIST) THEN + EXPAND_TAC "yl" THEN ASM_REWRITE_TAC[LENGTH_LEFT_ACTION_LIST; LE_REFL; INITIAL_SUBLIST_REFL] THEN + DISCH_THEN (fun th -> ASM_REWRITE_TAC[th]); + ALL_TAC + ] THEN + + SUBGOAL_THEN `!j. j < SUC k ==> omega_list_n V xl j = omega_list_n V yl j` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + REMOVE_THEN "tr" (MP_TAC o SPECL [`i:num`; `p:num->num`; `k:num`]) THEN + ASM_REWRITE_TAC[LE_REFL] THEN + DISCH_TAC THEN + + MP_TAC (SPECL [`V:real^3->bool`; `xl:(real^3)list`; `j:num`; `k - j:num`] OMEGA_LIST_N_LEMMA) THEN + MP_TAC (SPECL [`V:real^3->bool`; `yl:(real^3)list`; `j:num`; `k - j:num`] OMEGA_LIST_N_LEMMA) THEN + MP_TAC (ARITH_RULE `j < SUC k ==> j + k - j = k /\ j + k - j + 1 = k + 1`) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + EXPAND_TAC "yl" THEN EXPAND_TAC "xl" THEN REWRITE_TAC[LENGTH_LEFT_ACTION_LIST] THEN + ASM_REWRITE_TAC[ARITH_RULE `k + 1 <= SUC k /\ k + 1 <= SUC k + 1`] THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[EXTENSION; IN_IMAGE; IN_INSERT; IN_ELIM_THM] THEN + GEN_TAC THEN EQ_TAC THENL + [ + STRIP_TAC THENL + [ + EXISTS_TAC `SUC k` THEN + ASM_REWRITE_TAC[] THEN ARITH_TAC; + ALL_TAC + ] THEN + + EXISTS_TAC `x':num` THEN + ASM_SIMP_TAC[] THEN POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + + STRIP_TAC THEN + ASM_CASES_TAC `x' = SUC k` THENL + [ + DISJ1_TAC THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + DISJ2_TAC THEN + EXISTS_TAC `x':num` THEN + MP_TAC (ARITH_RULE `x' < SUC k + 1 /\ ~(x' = SUC k) ==> x' < SUC k`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + + + REWRITE_TAC[EXTENSION; IN_UNIONS; IN_ELIM_THM] THEN GEN_TAC THEN + REWRITE_TAC[GSYM EXTENSION; MEM_EXISTS_EL] THEN + EQ_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + ASM_REWRITE_TAC[] THEN REMOVE_ASSUM THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`i:num`; `b:real^3`]) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[IN_UNIONS; IN_ELIM_THM] THEN + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`i:num`; `p:num->num`]) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_TAC THEN + + EXISTS_TAC `rogers V (left_action_list (g (i:num, p:num->num)) ul)` THEN + ASM_REWRITE_TAC[] THEN + EXISTS_TAC `(g (i:num, p:num->num)):num->num` THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `p:num->num`) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + + EXISTS_TAC `convex hull (u:real^3 INSERT (S DELETE (EL i ul)))` THEN + CONJ_TAC THENL + [ + EXISTS_TAC `EL i ul:real^3` THEN REWRITE_TAC[] THEN + EXISTS_TAC `i:num` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `rogers V (left_action_list p ul)` THEN + ASM_REWRITE_TAC[] THEN + + FIRST_X_ASSUM (MP_TAC o SPECL [`i:num`; `p':num->num`]) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`i:num`; `EL i ul:real^3`]) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[SUBSET; IN_UNIONS] THEN + REPEAT STRIP_TAC THEN + EXISTS_TAC `convex hull (u INSERT rogers V (left_action_list p' (DROP ul i)))` THEN + ASM_REWRITE_TAC[IN_ELIM_THM] THEN + EXISTS_TAC `p':num->num` THEN + ASM_REWRITE_TAC[]);; + + + + + +end;; + diff --git a/text_formalization/packing/SLTSTLO.hl b/text_formalization/packing/SLTSTLO.hl new file mode 100755 index 0000000..ab8a914 --- /dev/null +++ b/text_formalization/packing/SLTSTLO.hl @@ -0,0 +1,3692 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: SLTSTLO *) +(* Chaper : Packing (Marchal Cells) *) +(* Date : June - July 2011 *) +(* *) +(* ========================================================================= *) + +module Sltstlo = struct + +open Rogers;; +open Vukhacky_tactics;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Sphere;; +open Marchal_cells;; +open Marchal_cells_2_new;; +open Emnwuus;; + + +let seans_fn () = +let (tms,tm) = top_goal () in +let vss = map frees (tm::tms) in +let vs = setify (flat vss) in +map dest_var vs;; + + +let NULLSET_SPHERE = prove_by_refinement + (`(!P. (?(v:real^3)(r:real). (r> &0)/\ (P={w:real^3 | norm (w-v)= r})) ==> NULLSET P)`, + [ + X_GEN_TAC `s:real^3->bool` THEN STRIP_TAC; + FIRST_X_ASSUM(MP_TAC); + STRIP_TAC THEN ASM_REWRITE_TAC[GSYM dist] ; + ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[NEGLIGIBLE_SPHERE]; + ]);; + + +(* =========================================================================== *) + +let SLTSTLO1 = prove_by_refinement ( + SLTSTLO1_concl, + +[(REPEAT GEN_TAC THEN REPEAT STRIP_TAC); + +(* =================== Case 1 ============================================== *) + + (ASM_CASES_TAC `hl (ul:(real^3)list) < sqrt(&2)`); + (EXISTS_TAC `4`); + (REWRITE_TAC[ARITH_RULE `4 <= 4`]); + (* New subgoal *) + (SUBGOAL_THEN `mcell4 V ul = convex hull (set_of_list (ul:(real^3)list))` + ASSUME_TAC); + + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (REFL_TAC); + (SUBGOAL_THEN `F` ASSUME_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (SUBGOAL_THEN `mcell 4 V ul = mcell4 V (ul:(real^3)list)` ASSUME_TAC); + (REWRITE_TAC[mcell]); + (COND_CASES_TAC); + (SUBGOAL_THEN `F` ASSUME_TAC); + (MESON_TAC[ASSUME `4 = 0`;ARITH_RULE `~(4 = 0)`]); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (SUBGOAL_THEN `F` ASSUME_TAC); + (MESON_TAC[ASSUME `4 = 1`;ARITH_RULE `~(4 = 1)`]); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (SUBGOAL_THEN `F` ASSUME_TAC); + (MESON_TAC[ASSUME `4 = 2`;ARITH_RULE `~(4 = 2)`]); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (SUBGOAL_THEN `F` ASSUME_TAC); + (MESON_TAC[ASSUME `4 = 3`;ARITH_RULE `~(4 = 3)`]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REFL_TAC); + + (ASM_REWRITE_TAC[]); + (DEL_TAC THEN DEL_TAC); + +(* New subgoal *) + (SUBGOAL_THEN `convex hull set_of_list (ul:(real^3)list) = + UNIONS {rogers V (left_action_list p ul) | p permutes 0..3}` + ASSUME_TAC); + (MATCH_MP_TAC WQPRRDY); + (ASM_REWRITE_TAC[IN]); +(* End subgoal *) + (PURE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[IN_UNIONS]); + (EXISTS_TAC `rogers V (ul:(real^3)list)`); + (ASM_REWRITE_TAC[IN_ELIM_THM]); + (EXISTS_TAC `I:(num->num)`); + (STRIP_TAC); + (MESON_TAC[PERMUTES_I]); + (AP_TERM_TAC); + (REWRITE_TAC[Packing3.LEFT_ACTION_LIST_I]); + +(* Finish case 1 *) + +(* =================== Case 2 ============================================== *) + + (NEW_GOAL `sqrt (&2) <= hl (ul:(real^3)list)`); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (SUBGOAL_THEN `? u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]` CHOOSE_TAC); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (ASM_CASES_TAC `dist(u0:real^3, p) >= sqrt(&2)`); + (EXISTS_TAC `0`); + (REWRITE_TAC[ARITH_RULE `0 <= 4`]); + (SUBGOAL_THEN `mcell 0 V ul = mcell0 V (ul:(real^3)list)` ASSUME_TAC); + (REWRITE_TAC[mcell]); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[mcell0]); + (REWRITE_TAC[DIFF; IN; IN_ELIM_THM]); + STRIP_TAC; + (ASM_MESON_TAC[IN]); + (REWRITE_TAC[ball;IN_ELIM_THM]); + + (SUBGOAL_THEN `HD (ul:(real^3)list) = u0` ASSUME_TAC); + (ASM_REWRITE_TAC[HD]); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + +(* Finish case 2 *) + +(* =================== Case 3 ============================================== *) + (NEW_GOAL `dist (u0, p:real^3) < sqrt (&2)`); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (ASM_CASES_TAC `~(p IN rcone_gt (HD (ul:(real^3)list)) (HD (TL ul)) + (hl (truncate_simplex 1 ul) / sqrt (&2))) `); + (EXISTS_TAC `1`); + (REWRITE_TAC[ARITH_RULE `1 <= 4`]); + (SUBGOAL_THEN `mcell 1 V ul = mcell1 V (ul:(real^3)list)` ASSUME_TAC); + (REWRITE_TAC[mcell]); + (COND_CASES_TAC); + (SUBGOAL_THEN `F` MP_TAC); + (UP_ASM_TAC THEN ARITH_TAC); + (MESON_TAC[]); + (REFL_TAC); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[mcell1]); + (COND_CASES_TAC); + + (REWRITE_TAC[IN_DIFF]); + (ASM_REWRITE_TAC[IN_INTER]); + (REWRITE_WITH `HD [u0;u1;u2;u3] = u0:real^3`); + (REWRITE_TAC[HD]); + (REWRITE_TAC[cball;IN;IN_ELIM_THM]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* Finish case 3 *) + +(* =================== Case 4 ============================================== *) + (NEW_GOAL `p IN rcone_gt (HD (ul:(real^3)list)) (HD (TL ul)) + (hl (truncate_simplex 1 ul) / sqrt (&2))`); + (UP_ASM_TAC THEN MESON_TAC[]); + (SWITCH_TAC THEN DEL_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[HD;TL; TRUNCATE_SIMPLEX_EXPLICIT_1]); + (STRIP_TAC); + + (ASM_CASES_TAC `p IN aff_ge {u0:real^3, u1} {mxi V ul, omega_list_n V ul 3}`); + (EXISTS_TAC `2`); + (REWRITE_TAC[ARITH_RULE `2 <= 4`]); + (REWRITE_TAC[MCELL_EXPLICIT; mcell2]); + (COND_CASES_TAC); + (LET_TAC); + (REWRITE_TAC[IN_INTER]); + (ASM_REWRITE_TAC[HD;TL]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN + ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC (SET_RULE `(?s. p IN s /\ s SUBSET B) ==> p IN B`)); + (EXISTS_TAC `rcone_gt (u0:real^3) u1 a`); + (REWRITE_TAC[RCONE_GT_SUBSET_RCONE_GE]); + (ASM_MESON_TAC[]); + (MATCH_MP_TAC RCONEGE_INTER_VORONOI_CLOSED_IMP_RCONEGE); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `voronoi_nondg V (ul:(real^3)list)`); + (UNDISCH_TAC `barV V 3 (ul:(real^3)list)`); + (REWRITE_TAC[BARV]); + (STRIP_TAC THEN FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[LENGTH; INITIAL_SUBLIST;ARITH_RULE `0 < 3 + 1`]); + (EXISTS_TAC `[]:(real^3)list`); + (REWRITE_TAC[APPEND]); + (UP_ASM_TAC THEN REWRITE_TAC[VORONOI_NONDG]); + (ASM_REWRITE_TAC[set_of_list]); + + (REPEAT STRIP_TAC); + (* Break into 7 subgoals *) + +(* Subgoal 1 & subgoal 2 *) + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + (NEW_GOAL `&0 < hl [u0; u1:real^3]`); + (REWRITE_WITH `hl [u0;u1:real^3] = + hl (truncate_simplex 1 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (MATCH_MP_TAC BARV_IMP_HL_1_POS_LT); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `hl [u0;u1:real^3] = &0`); + (ASM_REWRITE_TAC[HL;set_of_list;SET_RULE `{a, a} = {a}`]); + (NEW_GOAL `radV {u1:real^3} = dist (circumcenter {u1},u1)`); + (NEW_GOAL `(!w. w IN {u1:real^3} ==> radV {u1} = dist (circumcenter {u1},w))`); + (MATCH_MP_TAC Rogers.OAPVION2); + (REWRITE_TAC[AFFINE_INDEPENDENT_1]); + (FIRST_X_ASSUM MATCH_MP_TAC); + (SET_TAC[]); + (ASM_REWRITE_TAC[Rogers.CIRCUMCENTER_1; dist]); + (NORM_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (EXPAND_TAC "a"); + (MATCH_MP_TAC REAL_LT_DIV); + (STRIP_TAC); + (REWRITE_WITH `hl [u0;u1:real^3] = + hl (truncate_simplex 1 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (MATCH_MP_TAC BARV_IMP_HL_1_POS_LT); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SQRT_POS_LT); + (REAL_ARITH_TAC); + (EXPAND_TAC "a"); + (NEW_GOAL `hl [u0; u1:real^3] / sqrt (&2) <= &1 <=> + hl [u0; u1] <= &1 * sqrt (&2)`); + (MATCH_MP_TAC REAL_LE_LDIV_EQ); + (MATCH_MP_TAC SQRT_POS_LT THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (MATCH_MP_TAC (SET_RULE `(?s. p IN s /\ s SUBSET B) ==> p IN B`)); + (EXISTS_TAC `rcone_gt (u0:real^3) u1 a`); + (REWRITE_TAC[RCONE_GT_SUBSET_RCONE_GE]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `p IN voronoi_closed V (u0:real^3) <=> + (?vl. vl IN barV V 3 /\ + p IN rogers V vl /\ + truncate_simplex 0 vl = [u0])`); + (MATCH_MP_TAC Rogers.GLTVHUM); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (EXISTS_TAC `ul:(real^3)list`); + (ASM_REWRITE_TAC[IN; TRUNCATE_SIMPLEX_EXPLICIT_0]); + (UP_ASM_TAC THEN REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_TAC[MESON [] `~(a /\ b) <=> ~a \/ ~ b`]); + (DISCH_TAC); + (NEW_GOAL `~(hl [u0; u1:real^3] < sqrt (&2))`); + (ASM_MESON_TAC[]); + (NEW_GOAL `hl [u0; u1:real^3] >= sqrt (&2)`); + (ASM_REAL_ARITH_TAC); + (ABBREV_TAC `t = hl [u0; u1:real^3] / sqrt (&2)`); + (NEW_GOAL `&1 <= t`); + (EXPAND_TAC "t"); + (NEW_GOAL `&1 <= hl [u0; u1:real^3] / sqrt (&2) <=> + &1 * sqrt (&2) <= hl [u0; u1]`); + (MATCH_MP_TAC REAL_LE_RDIV_EQ); + (MATCH_MP_TAC SQRT_POS_LT THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (UNDISCH_TAC `p IN rcone_gt (u0:real^3) u1 t`); + (REWRITE_TAC[rcone_gt;rconesgn; IN; IN_ELIM_THM; dist]); + (DISCH_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `(p - u0) dot (u1 - u0) <= norm (p - u0) * norm (u1 - u0:real^3)`); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ]); + (NEW_GOAL `norm (p - u0) * norm (u1 - u0) * t >= + norm (p - u0) * norm (u1 - u0:real^3) `); + (REWRITE_TAC[REAL_ARITH `a * b * t >= a * b <=> &0 <= (t - &1) * (a * b)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* Finish case 4 *) + +(* =================== Case 5 ============================================== *) + + (ASM_CASES_TAC `hl (truncate_simplex 2 (ul:(real^3)list)) >= sqrt (&2)`); + (NEW_GOAL `mxi V (ul:(real^3)list) = omega_list_n V ul 2`); + (REWRITE_TAC[mxi]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (NEW_GOAL `p IN aff_ge {u0, u1:real^3} {mxi V ul, omega_list_n V ul 3}`); + (MATCH_MP_TAC (SET_RULE `(?s. p IN s /\ s SUBSET B) ==> p IN B`)); + + (EXISTS_TAC `rogers V (ul:(real^3)list)`); + STRIP_TAC; + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `(?s. p SUBSET s /\ s SUBSET B) ==> p SUBSET B`)); + (EXISTS_TAC `convex hull ({u0, u1:real^3} UNION {mxi V ul, omega_list_n V ul 3})`); + (STRIP_TAC); + (NEW_GOAL + `convex hull ({u0, u1:real^3} UNION {mxi V ul, omega_list_n V ul 3}) = + convex hull (convex hull ({u0, u1} UNION {mxi V ul, omega_list_n V ul 3}))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[CONVEX_HULL_EQ; CONVEX_CONVEX_HULL]); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[ROGERS]); + (MATCH_MP_TAC CONVEX_HULL_SUBSET); + + (ASM_REWRITE_TAC + [LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4` ; SET_OF_0_TO_3]); + (REWRITE_TAC[IMAGE;SUBSET;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (ASM_CASES_TAC `x' = 0`); + (REWRITE_WITH `x = u0:real^3`); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[OMEGA_LIST_N;HD]); + (ONCE_REWRITE_TAC[GSYM IN]); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (SET_TAC[]); + + (ASM_CASES_TAC `x' = 1`); + (REWRITE_WITH `x = circumcenter {u0,u1:real^3}`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC OMEGA_LIST_1_EXPLICIT_NEW); + (EXISTS_TAC `u2:real^3`); + (EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[IN]); + (STRIP_TAC); + (ASM_MESON_TAC[IN]); + + (ASM_CASES_TAC `hl [u0; u1:real^3] < sqrt (&2)`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `hl [u0; u1:real^3] >= sqrt (&2)`); + (ASM_REAL_ARITH_TAC); + (ABBREV_TAC `t = hl [u0; u1:real^3] / sqrt (&2)`); + (NEW_GOAL `&1 <= t`); + (EXPAND_TAC "t"); + (NEW_GOAL `&1 <= hl [u0; u1:real^3] / sqrt (&2) <=> + &1 * sqrt (&2) <= hl [u0; u1]`); + (MATCH_MP_TAC REAL_LE_RDIV_EQ); + (MATCH_MP_TAC SQRT_POS_LT THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (UNDISCH_TAC `p IN rcone_gt (u0:real^3) u1 t`); + (REWRITE_TAC[rcone_gt;rconesgn; IN; IN_ELIM_THM; dist]); + (DISCH_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `(p - u0) dot (u1 - u0) <= norm (p - u0) * norm (u1 - u0:real^3)`); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ]); + (NEW_GOAL `norm (p - u0) * norm (u1 - u0) * t >= + norm (p - u0) * norm (u1 - u0:real^3) `); + (REWRITE_TAC[REAL_ARITH `a * b * t >= a * b <=> &0 <= (t - &1) * (a * b)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (ONCE_REWRITE_TAC[GSYM IN]); + + (MATCH_MP_TAC (SET_RULE `(?s. p IN s /\ s SUBSET B) ==> p IN B`)); + (EXISTS_TAC `convex hull ({u0, u1:real^3})`); + (STRIP_TAC); + (REWRITE_TAC[Rogers.CIRCUMCENTER_2; midpoint;CONVEX_HULL_2;IN;IN_ELIM_THM]); + (EXISTS_TAC `&1 / (&2)`); + (EXISTS_TAC `&1 / (&2)`); + (ASM_SIMP_TAC[REAL_LE_DIV; REAL_ARITH `&0 <= &1 /\ &0 <= &2`]); + (STRIP_TAC); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (MATCH_MP_TAC CONVEX_HULL_SUBSET); + (SET_TAC[]); + + (ASM_CASES_TAC `x' = 2`); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[GSYM IN]); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (SET_TAC[]); + + (ASM_CASES_TAC `x' = 3`); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[GSYM IN]); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (SET_TAC[]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN DEL_TAC); + (UP_ASM_TAC THEN TRUONG_SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (ASM_REWRITE_TAC[SET_RULE `{a, b} UNION {c , d} = {a, b, c,d}`]); + (REWRITE_TAC[CONVEX_HULL_4_SUBSET_AFF_GE_2_2]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + + (NEW_GOAL `hl (truncate_simplex 2 (ul:(real^3)list)) < sqrt (&2)`); + (ASM_REAL_ARITH_TAC); + (EXISTS_TAC `3`); + (REWRITE_TAC[ARITH_RULE `3 <= 4`]); + (REWRITE_TAC[MCELL_EXPLICIT; mcell3]); + (COND_CASES_TAC); + + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (REWRITE_TAC[SET_RULE `{a, b ,c} UNION {d} = {a, b , c, d}`]); + + + + (NEW_GOAL + `(?s. between s (omega_list_n V ul 2,omega_list_n V ul 3) /\ + dist (u0,s:real^3) = sqrt (&2) /\ + mxi V ul = s)`); + (MATCH_MP_TAC MXI_EXPLICIT_OLD); + (ASM_MESON_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC); + (REWRITE_WITH `mxi V [u0; u1; u2; u3] = s:real^3`); + (ASM_MESON_TAC[]); + +(* ========================================================================= *) + + (ABBREV_TAC `a = omega_list_n V ul 1`); + (ABBREV_TAC `b = omega_list_n V ul 2`); + (ABBREV_TAC `c = omega_list_n V ul 3`); + + (NEW_GOAL `p IN convex hull {u0, a, b, c:real^3}`); + (EXPAND_TAC "a" THEN EXPAND_TAC "b" THEN EXPAND_TAC "c"); + (REWRITE_WITH `u0:real^3 = HD ul`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `convex hull + {HD ul, omega_list_n V ul 1, omega_list_n V ul 2, omega_list_n V ul 3} = + rogers V ul`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC ROGERS_EXPLICIT); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `a = midpoint (u0, u1:real^3)`); + (REWRITE_TAC[GSYM Rogers.CIRCUMCENTER_2]); + (EXPAND_TAC "a"); + (REWRITE_WITH `{u0,u1} = set_of_list [u0;(u1:real^3)]`); + (MESON_TAC[set_of_list]); + (REWRITE_TAC[ASSUME `ul = [u0; u1; u2; u3:real^3]`; OMEGA_LIST_TRUNCATE_1]); + (MATCH_MP_TAC XNHPWAB1); + + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + + (MP_TAC (ASSUME `barV V 3 ul`) THEN REWRITE_TAC[IN;BARV]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[LENGTH;ARITH_RULE `SUC (SUC 0) = 1 + 1`]); + (NEW_GOAL `initial_sublist vl (ul:(real^3)list)`); + (UNDISCH_TAC `initial_sublist vl [u0:real^3; u1]`); + (REWRITE_TAC[INITIAL_SUBLIST] THEN STRIP_TAC); + (EXISTS_TAC `APPEND yl [u2;u3:real^3]`); + (REWRITE_TAC[APPEND_ASSOC; GSYM (ASSUME `[u0:real^3; u1] = APPEND vl yl`)]); + (ASM_REWRITE_TAC[APPEND]); + (ASM_MESON_TAC[]); + + + + (ABBREV_TAC `sl = truncate_simplex 2 (ul:(real^3)list)`); + (MATCH_MP_TAC (REAL_ARITH `hl (sl:(real^3)list) < b /\ a < hl sl ==> a < b`)); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 sl`); + (EXPAND_TAC "sl" THEN DEL_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2;TRUNCATE_SIMPLEX_EXPLICIT_1]); + (EXPAND_TAC "sl" THEN REWRITE_TAC[ASSUME + `ul = [u0;u1;u2:real^3;u3]`; TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_WITH `hl ([u0;u1;u2:real^3]) = + hl (truncate_simplex 2 (sl:(real^3)list))`); + (AP_TERM_TAC); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_WITH `[u0;u1;u2:real^3] = sl`); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + + (NEW_GOAL `!i j. i < j /\ j <= 2 + ==> hl (truncate_simplex i (sl:(real^3)list)) + < hl (truncate_simplex j sl)`); + (MATCH_MP_TAC XNHPWAB4); + (EXISTS_TAC `V:real^3->bool`); + + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "sl" THEN REWRITE_TAC[IN]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (FIRST_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + +(* ================================================================== *) + (NEW_GOAL `p IN convex hull {b, c, u0, u1:real^3}`); + (UP_ASM_TAC THEN UP_ASM_TAC); + (REWRITE_TAC[CONVEX_HULL_4; midpoint; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `w:real` THEN EXISTS_TAC `z:real`); + (EXISTS_TAC `u + v * inv (&2)` THEN EXISTS_TAC `v * inv (&2)`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `&0 <= v * inv (&2)`); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_ARITH `w + z + (u + v * inv (&2)) + v * inv (&2) = + u + v + w + z`]); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_ADD); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (NEW_GOAL `convex hull {b, c, u0, u1:real^3} = + convex hull {b, s, u0, u1} UNION convex hull {s, c, u0, u1}`); + (MATCH_MP_TAC CONVEX_HULL_BREAK_KY_LEMMA); + (ASM_REWRITE_TAC[]); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[IN_UNION]); + (NEW_GOAL `~(p IN convex hull {s, c, u0, u1:real^3})`); + (STRIP_TAC); + + (NEW_GOAL `p IN aff_ge {u0, u1} {mxi V ul, c:real^3}`); + + + + + + (NEW_GOAL `convex hull {s, c, u0, u1} SUBSET aff_ge {u0, u1} {s, c:real^3}`); + (REWRITE_WITH `{s, c, u0, u1} = {u0,u1,s, c:real^3}`); + (SET_TAC[]); + (REWRITE_TAC[CONVEX_HULL_4_SUBSET_AFF_GE_2_2]); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (DISCH_TAC); + (NEW_GOAL `p IN convex hull {b, s, u0, u1:real^3}`); + (ASM_MESON_TAC[]); + + (NEW_GOAL `b IN convex hull {u0,u1,u2:real^3}`); + (EXPAND_TAC "b"); + (REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`;OMEGA_LIST_TRUNCATE_2]); + (ABBREV_TAC `wl = [u0;u1;u2:real^3]`); + (REWRITE_WITH `{u0, u1, u2:real^3} = set_of_list wl`); + (EXPAND_TAC "wl" THEN REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC XNHPWAB2); + (EXISTS_TAC `2`); + (REWRITE_WITH `wl = truncate_simplex 2 (ul:(real^3)list)`); + (EXPAND_TAC "wl" THEN REWRITE_TAC[ASSUME `ul = [u0; u1; u2; u3:real^3]`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (ASM_REWRITE_TAC[IN]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_MESON_TAC[ARITH_RULE `2 <= 3`]); + + (UP_ASM_TAC THEN UP_ASM_TAC); + (REWRITE_TAC[CONVEX_HULL_3; CONVEX_HULL_4; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (EXISTS_TAC `w + u * u'`); + (EXISTS_TAC `z + u * v'`); + (EXISTS_TAC `u * w'`); + (EXISTS_TAC `v:real`); + + (ASM_SIMP_TAC[REAL_LE_ADD; REAL_LE_MUL]); + (STRIP_TAC); + (ASM_REWRITE_TAC[REAL_ARITH `(w + u * u') + (z + u * v') + u * w' + v = + u * (u' + v' + w') + v + w + z`; REAL_MUL_RID]); + (VECTOR_ARITH_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[])]);; + +(* =========================================================================== *) +(* =========================================================================== *) + +let SLTSTLO2 = prove_by_refinement ( + SLTSTLO2_concl, + +[(REPEAT STRIP_TAC); + (ABBREV_TAC `B1 = frontier (rogers V (ul:(real^3)list))`); + (ABBREV_TAC `B2 = {w| norm ((w:real^3) - (HD ul)) = sqrt (&2)}`); + (ABBREV_TAC `B3 = rcone_eq (HD (ul:(real^3)list)) (HD (TL ul)) + (hl (truncate_simplex 1 ul) / sqrt (&2))`); + (ABBREV_TAC `B4 = affine hull {(HD (ul:(real^3)list)), (HD (TL ul)), + mxi V ul}`); + (ABBREV_TAC `B5 = convex hull {omega_list_n V ul 2, + omega_list_n V (ul:(real^3)list) 3 }`); + (ABBREV_TAC `B6 = affine hull {(HD (ul:(real^3)list)), (HD (TL ul)), + (HD (TL (TL ul)))}`); + (ABBREV_TAC `B7 = affine hull {omega_list_n V ul 1, omega_list_n V ul 2, + omega_list_n V ul 3}`); + + (ABBREV_TAC `Z = B1 UNION B2 UNION B3 UNION B4 UNION + (B5:real^3->bool) UNION B6 UNION B7`); + (EXISTS_TAC `Z:real^3->bool`); + (REPEAT STRIP_TAC); + + (NEW_GOAL `?u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]`); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (EXPAND_TAC "Z"); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + (EXPAND_TAC "B1" THEN MATCH_MP_TAC NEGLIGIBLE_CONVEX_FRONTIER); + (ASM_SIMP_TAC[ROGERS_EXPLICIT;CONVEX_CONVEX_HULL]); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + + (* revised 2013-05-25: *) + (NEW_GOAL `(?(v:real^3)(r:real). (r> &0)/\ (B2 ={w:real^3 | norm (w-v)= r}))`); + (EXPAND_TAC "B2"); + (EXISTS_TAC `(HD ul):real^3` THEN EXISTS_TAC `sqrt(&2)`); + (ASM_REWRITE_TAC[REAL_ARITH `a > &0 <=> &0 < a`]); + (MATCH_MP_TAC SQRT_POS_LT); + (REAL_ARITH_TAC); + (ASM_SIMP_TAC[NULLSET_SPHERE]); + (* end of revision *) + + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + (EXPAND_TAC "B3"); + (MATCH_MP_TAC NEGLIGIBLE_RCONE_EQ); + (ASM_REWRITE_TAC[HD;TL]); + (STRIP_TAC); + (NEW_GOAL `aff_dim (set_of_list [u0;u1:real^3]) = &0`); + (ASM_REWRITE_TAC[set_of_list; SET_RULE `{x, x} = {x}`; AFF_DIM_SING]); + (NEW_GOAL `aff_dim (set_of_list [u0;u1:real^3]) = &1`); + (MATCH_MP_TAC MHFTTZN1); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `[u0; u0:real^3] = truncate_simplex 1 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (NEW_GOAL `&0 = &1`); + (ASM_MESON_TAC[INT_OF_NUM_EQ;REAL_OF_NUM_EQ]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + (EXPAND_TAC "B4"); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + (EXPAND_TAC "B5"); + (ONCE_REWRITE_TAC[SET_RULE `{a,b:real^3} = {a,a,b}`]); + (MESON_TAC[NEGLIGIBLE_CONVEX_HULL_3]); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + (EXPAND_TAC "B6"); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (EXPAND_TAC "B7"); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + +(* ========================================================================= *) + + (NEW_GOAL `?u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]`); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (REWRITE_TAC[EXISTS_UNIQUE]); + (NEW_GOAL `?i. i <= 4 /\ p IN mcell i V ul`); + (MATCH_MP_TAC SLTSTLO1); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC THEN EXISTS_TAC `i:num`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + +(* ========================================================================= *) + + (ASM_CASES_TAC `hl (ul:(real^3)list) < sqrt(&2)`); + (NEW_GOAL ` mcell0 V ul = {} /\ mcell1 V ul = {} /\ + mcell2 V ul = {} /\ mcell3 V ul = {}`); + (ASM_MESON_TAC[EMNWUUS2]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC); + + (NEW_GOAL `!y. y <= 4 /\ p IN mcell y V ul ==> + ~ (y = 0 \/ y = 1 \/ y = 2 \/ y = 3)`); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `p IN mcell y V ul` THEN ASM_REWRITE_TAC[MCELL_EXPLICIT]); + (SET_TAC[]); + (UNDISCH_TAC `p IN mcell y V ul` THEN ASM_REWRITE_TAC[MCELL_EXPLICIT]); + (SET_TAC[]); + (UNDISCH_TAC `p IN mcell y V ul` THEN ASM_REWRITE_TAC[MCELL_EXPLICIT]); + (SET_TAC[]); + (UNDISCH_TAC `p IN mcell y V ul` THEN ASM_REWRITE_TAC[MCELL_EXPLICIT]); + (SET_TAC[]); + (NEW_GOAL `!y. y <= 4 /\ p IN mcell y V ul ==> y = 4`); + (GEN_TAC THEN DISCH_TAC); + (NEW_GOAL `~(y = 0 \/ y = 1 \/ y = 2 \/ y = 3)`); + (ASM_SIMP_TAC[]); + (ASM_ARITH_TAC); + (GEN_TAC THEN DISCH_TAC); + (NEW_GOAL `y = 4`); + (ASM_MESON_TAC[]); + (NEW_GOAL `i = 4`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (NEW_GOAL `sqrt (&2) <= hl (ul:(real^3)list)`); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + +(* ========================================================================= *) + + (ASM_CASES_TAC `dist(u0:real^3, p) >= sqrt(&2)`); + (NEW_GOAL `!y. y <= 4 /\ p IN mcell y V ul ==> + ~ (y = 4 \/ y = 1 \/ y = 2 \/ y = 3)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `mcell 4 V ul = {}`); + + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`;mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REFL_TAC); + (UNDISCH_TAC `p IN mcell y V ul` THEN REWRITE_TAC[ASSUME `y = 4`]); + (REWRITE_TAC[ASSUME `mcell 4 V ul = {}`]); + (SET_TAC[]); + (UNDISCH_TAC `p IN mcell y V ul` THEN REWRITE_TAC[ASSUME `y = 1`; + MCELL_EXPLICIT;mcell1]); + (COND_CASES_TAC); + (STRIP_TAC); + (NEW_GOAL `~(p:real^3 IN B2)`); + (UNDISCH_TAC `p IN rogers V ul DIFF Z` THEN REWRITE_TAC[IN_DIFF]); + (EXPAND_TAC "Z" THEN REWRITE_TAC[IN_UNION]); + (SET_TAC[]); + (NEW_GOAL `p:real^3 IN cball (HD ul,sqrt (&2))`); + (ASM_SET_TAC[IN_DIFF;IN_INTER]); + (NEW_GOAL `~(p:real^3 IN B2 UNION ball (HD ul,sqrt (&2)))`); + (ASM_REWRITE_TAC[IN_UNION;HD;ball;IN;IN_ELIM_THM]); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_WITH `B2 UNION ball (HD ul,sqrt (&2)) = + cball (HD (ul:(real^3)list),sqrt (&2))`); + (EXPAND_TAC "B2"); + (REWRITE_TAC[SET_EQ_LEMMA; IN_UNION; cball; ball;IN;IN_ELIM_THM]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[dist] THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + + + (UNDISCH_TAC `p IN mcell y V ul` THEN REWRITE_TAC[ASSUME `y = 2`; + MCELL_EXPLICIT;mcell2]); + (COND_CASES_TAC); + (LET_TAC); + (ASM_REWRITE_TAC[HD;TL] THEN STRIP_TAC); + (NEW_GOAL `p:real^3 IN (rcone_ge u0 u1 a INTER rcone_ge u1 u0 a)`); + (ASM_SET_TAC[IN_INTER]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_INTER;rcone_ge;rconesgn;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `(p - u0) dot (u1 - u0:real^3) + (p - u1) dot (u0 - u1) >= + dist (p,u0) * dist (u1,u0) * a + dist (p,u1) * dist (u0,u1) * a`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_SYM]); + (REWRITE_WITH `(p - u0) dot (u1 - u0:real^3) + (p - u1) dot (u0 - u1) = + (u0 - u1) dot (u0 - u1)`); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `x * a * b + y * a * b = (x + y) * a * b`; + GSYM NORM_POW_2; GSYM dist]); + +(* ========================================================================== *) + (NEW_GOAL `dist (p,u0:real^3) <= dist (p,u1) /\ a = (inv(&2) * dist (u0,u1)) / sqrt (&2)`); + (REPEAT STRIP_TAC); + + (NEW_GOAL `p IN rogers V ul`); + (ASM_SET_TAC[IN_DIFF]); + (NEW_GOAL `(p:real^3) IN voronoi_closed V u0`); + (NEW_GOAL `(p:real^3) IN voronoi_closed V u0 <=> + (?vl. vl IN barV V 3 /\ + p IN rogers V vl /\ + truncate_simplex 0 vl = [u0:real^3])`); + (MATCH_MP_TAC GLTVHUM); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC BARV_IMP_u0_IN_V); + (EXISTS_TAC `ul:(real^3)list`); + (EXISTS_TAC `u1:real^3`); + (EXISTS_TAC `u2:real^3`); + (EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `ul:(real^3)list`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_0]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed;IN;IN_ELIM_THM]); + (DISCH_TAC THEN FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `set_of_list (ul:(real^3)list) SUBSET V`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_MESON_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + (EXPAND_TAC "a"); + (AP_THM_TAC); + (AP_TERM_TAC); + (REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; TRUNCATE_SIMPLEX_EXPLICIT_1; HL;set_of_list]); + (NEW_GOAL `!w. w IN {u0,u1:real^3} ==> + radV {u0,u1} = dist (circumcenter {u0,u1},w)`); + (MATCH_MP_TAC Rogers.OAPVION2); + (REWRITE_TAC[AFFINE_INDEPENDENT_IFF_CARD]); + (STRIP_TAC); + (REWRITE_TAC[Geomdetail.FINITE6]); + (NEW_GOAL `aff_dim {u0, u1:real^3} = &1`); + (ABBREV_TAC `vl = [u0;u1:real^3]`); + (REWRITE_WITH `{u0, u1:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.MHFTTZN1); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `vl = truncate_simplex 1 ul:(real^3)list`); + (EXPAND_TAC "vl" THEN DEL_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[ARITH_RULE + `&1 = &(CARD {u0, u1:real^3}) - (&1):int + <=> &(CARD {u0, u1:real^3}) = (&2):int`]); + (ONCE_REWRITE_TAC[INT_OF_NUM_EQ]); + (REWRITE_TAC[Geomdetail.CARD2]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `CARD {u0, u1:real^3} = 1`); + (REWRITE_WITH `{u0, u1} = {u1:real^3}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD_SING]); + (NEW_GOAL `aff_dim {u0, u1} <= &(CARD {u0, u1:real^3}) - (&1):int`); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_TAC[Geomdetail.FINITE6]); + (NEW_GOAL `(&2):int <= &(CARD {u0, u1:real^3})`); + (ONCE_REWRITE_TAC[ARITH_RULE + `(&2):int <= &(CARD {u0, u1:real^3}) <=> + &1 <= &(CARD {u0, u1:real^3}) - (&1):int`]); + (ASM_MESON_TAC[]); + (NEW_GOAL `&(CARD {u0, u1:real^3}) <= (&2):int`); + (ONCE_REWRITE_TAC[INT_OF_NUM_LE]); + (REWRITE_TAC[Geomdetail.CARD2]); + (NEW_GOAL `CARD {u0, u1:real^3} = 2`); + (ONCE_REWRITE_TAC[GSYM INT_OF_NUM_EQ]); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + + (REWRITE_WITH `radV {u0, u1} = dist (circumcenter {u0, u1},u0:real^3)`); + (FIRST_X_ASSUM MATCH_MP_TAC); + (TRUONG_SET_TAC[]); + (REWRITE_TAC[CIRCUMCENTER_2;midpoint;dist; + VECTOR_ARITH `inv (&2) % (u0 + u1) - u0 = inv (&2) % (u1 - u0)`]); + (REWRITE_TAC[NORM_MUL]); + (REWRITE_WITH `abs (inv (&2)) = inv (&2)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (REAL_ARITH_TAC); + (REWRITE_TAC[GSYM dist]); + (MESON_TAC[DIST_SYM]); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + (NEW_GOAL `(dist (p,u0) + dist (p,u1:real^3)) * dist (u0,u1) * a >= + (&2 * dist (p,u0)) * dist (u0,u1) * a`); + (REWRITE_TAC[REAL_ARITH `(x + y) * a * b >= (&2 * x) * a * b <=> + &0 <= (y - x) * a * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (REAL_ARITH_TAC); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC SQRT_POS_LE); + (REAL_ARITH_TAC); + + (NEW_GOAL `dist (u0,u1:real^3) pow 2 >= (&2 * dist (p,u0)) * dist (u0,u1) * a `); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `(&2 * x) * a * (inv(&2) * a) / b = (x / b) * a pow 2`]); + (REWRITE_TAC[REAL_ARITH `a >= x * a <=> &0 <= a * (&1 - x)`]); + (DISCH_TAC); + (NEW_GOAL `&0 <= dist (u0,u1) pow 2 * (&1 - dist (p,u0) / sqrt (&2)) + <=> &0 <= (&1 - dist (p,u0:real^3) / sqrt (&2))`); + (NEW_GOAL `&0 < dist (u0,u1:real^3) pow 2`); + (REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT; DIST_EQ_0]); + (STRIP_TAC); + + + (NEW_GOAL `aff_dim {u0, u1:real^3} = &1`); + (ABBREV_TAC `vl = [u0;u1:real^3]`); + (REWRITE_WITH `{u0, u1:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.MHFTTZN1); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `vl = truncate_simplex 1 ul:(real^3)list`); + (EXPAND_TAC "vl" THEN DEL_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (NEW_GOAL `CARD {u0, u1:real^3} = 1`); + (REWRITE_WITH `{u0, u1} = {u1:real^3}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD_SING]); + (NEW_GOAL `aff_dim {u0, u1} <= &(CARD {u0, u1:real^3}) - (&1):int`); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_TAC[Geomdetail.FINITE6]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[REAL_LE_MUL_EQ]); + (NEW_GOAL `&0 <= &1 - dist (p,u0:real^3) / sqrt (&2)`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (REWRITE_WITH `dist (p,u0:real^3) / sqrt (&2) <= &1 + <=> dist (p,u0) <= &1 * sqrt (&2)`); + (MATCH_MP_TAC REAL_LE_LDIV_EQ); + (MATCH_MP_TAC SQRT_POS_LT); + (REAL_ARITH_TAC); + (REWRITE_TAC [REAL_MUL_LID]); + (STRIP_TAC); + (NEW_GOAL `dist (p, u0:real^3) = sqrt (&2)`); + (UP_ASM_TAC THEN ONCE_REWRITE_TAC[DIST_SYM]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `~(p:real^3 IN B2)`); + (ASM_SET_TAC[IN_DIFF]); + (UP_ASM_TAC THEN EXPAND_TAC "B2" THEN REWRITE_TAC[IN;IN_ELIM_THM]); + (ASM_REWRITE_TAC[HD;GSYM dist]); + (SET_TAC[]); + +(* ========================================================================= *) + + (UNDISCH_TAC `p IN mcell y V ul` THEN REWRITE_TAC[ASSUME `y = 3`; + MCELL_EXPLICIT;mcell3]); + (COND_CASES_TAC); + + (ASM_REWRITE_TAC[HD;TL;set_of_list]); + (NEW_GOAL `(?s. between s (omega_list_n V ul 2,omega_list_n V ul 3) /\ + dist (u0,s) = sqrt (&2) /\ + mxi V ul = s:real^3)`); + (MATCH_MP_TAC MXI_EXPLICIT_OLD); + (ASM_REWRITE_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2;set_of_list]); + (REWRITE_TAC[SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (STRIP_TAC); + (SUBGOAL_THEN `p:real^3 IN rogers V ul` MP_TAC); + (ASM_SET_TAC[IN_DIFF]); + (ASM_SIMP_TAC[ROGERS_EXPLICIT; HD]); + (ABBREV_TAC `s1 = omega_list_n V [u0; u1; u2; u3:real^3] 1`); + (ABBREV_TAC `s2 = omega_list_n V [u0; u1; u2; u3:real^3] 2`); + (ABBREV_TAC `s3 = omega_list_n V [u0; u1; u2; u3:real^3] 3`); + (STRIP_TAC); + (NEW_GOAL `?m n:real^3. + between p (m,n) /\ between m (u0,s1) /\ between n (s2,s3)`); + (ASM_SIMP_TAC[CONVEX_HULL_4_IMP_2_2]); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + (NEW_GOAL `between (p - m:real^3) (vec 0, n - m)`); + (UNDISCH_TAC `between p (m,n:real^3)` THEN REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; + CONVEX_HULL_2;IN;IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real` THEN ASM_REWRITE_TAC[]); + (REWRITE_WITH `(u % m + v % n) - m:real^3 = (u % m + v % n) - (u + v) % m`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (VECTOR_ARITH_TAC); + (NEW_GOAL `between (proj_point (s2 - m) (p - m:real^3)) + (vec 0, proj_point (s2 - m) (n - m))`); + (REWRITE_WITH `vec 0 = proj_point (s2 - m) (m - m:real^3)`); + (REWRITE_TAC[VECTOR_SUB_REFL; PRO_EXP; DOT_LZERO; REAL_ARITH `&0 / a = &0`]); + (VECTOR_ARITH_TAC); + (MATCH_MP_TAC BETWEEN_PROJ_POINT); + (ASM_REWRITE_TAC[VECTOR_SUB_REFL]); + (ABBREV_TAC `p' = proj_point (s2 - m) (p - m:real^3)`); + (ABBREV_TAC `n' = proj_point (s2 - m) (n - m:real^3)`); + + +(* ============================================================================ *) + + (ABBREV_TAC `vl = [u0;u1;u2:real^3]`); + (NEW_GOAL `s2:real^3 = circumcenter (set_of_list vl)`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "vl"); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_2]); + (MATCH_MP_TAC XNHPWAB1); + (EXISTS_TAC `2`); + (REWRITE_WITH `[u0; u1; u2:real^3] = truncate_simplex 2 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (ASM_REWRITE_TAC[IN]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_MESON_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `s3 IN voronoi_list V (truncate_simplex 2 (ul:(real^3)list))`); + (NEW_GOAL `s3 IN voronoi_list V (truncate_simplex (SUC 2) + [u0:real^3; u1; u2; u3])`); + (EXPAND_TAC "s3"); + (REWRITE_TAC[OMEGA_LIST_N;ARITH_RULE `3 = SUC 2`]); + (MATCH_MP_TAC CLOSEST_POINT_IN_SET); + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); + (MATCH_MP_TAC Packing3.BARV_IMP_VORONOI_LIST_NOT_EMPTY); + (EXISTS_TAC `3`); + (REWRITE_WITH `truncate_simplex (SUC 2) [u0; u1; u2; u3:real^3] = ul`); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 2 = 3`; TRUNCATE_SIMPLEX_EXPLICIT_3]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC); + (REWRITE_WITH `truncate_simplex (SUC 2) [u0; u1; u2; u3:real^3] = ul`); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 2 = 3`; TRUNCATE_SIMPLEX_EXPLICIT_3]); + (STRIP_TAC); + (NEW_GOAL `voronoi_list V (ul:(real^3)list) SUBSET + voronoi_list V (truncate_simplex 2 ul)`); + (ASM_REWRITE_TAC[VORONOI_LIST;VORONOI_SET; SUBSET; + TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; IN_INTERS]); + (EXPAND_TAC "vl" THEN REWRITE_TAC[IN; IN_ELIM_THM;set_of_list] + THEN REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (EXISTS_TAC `v:real^3`); + (ASM_REWRITE_TAC[]); + (SWITCH_TAC THEN UP_ASM_TAC THEN TRUONG_SET_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[SUBSET]); + + + (NEW_GOAL `n' = s2:real^3 - m`); + (EXPAND_TAC "n'"); + (UNDISCH_TAC `between n (s2,s3:real^3)` THEN REWRITE_TAC[ + BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (REWRITE_TAC[ASSUME `n:real^3 = u % s2 + v % s3`]); + (REWRITE_WITH `(u % s2 + v % s3) - m:real^3 = (s2 - m) + v % (s3 - s2)`); + (REWRITE_TAC[VECTOR_ARITH `(u % s2 + v % s3) - m = s2 - m + v % (s3 - s2) + <=> (u + v) % s2 = s2`]); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (REWRITE_TAC[PRO_EXP]); + (REWRITE_WITH `((s2 - m + v % (s3 - s2)) dot (s2 - m)) / + ((s2 - m) dot (s2 - m:real^3)) = &1`); + (REWRITE_TAC[DOT_LADD; REAL_ARITH `(a + b) / c = a / c + b / c`]); + (REWRITE_WITH `((s2 - m) dot (s2 - m)) / ((s2 - m) dot (s2 - m:real^3)) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[GSYM NORM_POW_2; Trigonometry2.POW2_EQ_0;NORM_EQ_0]); + (REWRITE_TAC[VECTOR_ARITH `s2 - m = vec 0 <=> s2 = m`]); + (STRIP_TAC); + + (NEW_GOAL `between s2 (u0, s1:real^3)`); + (ASM_MESON_TAC[]); + (NEW_GOAL `s2 IN affine hull {u0, s1:real^3}`); + (UP_ASM_TAC THEN REWRITE_TAC[BETWEEN_IN_CONVEX_HULL]); + (STRIP_TAC); + (NEW_GOAL `convex hull {u0,s1:real^3} SUBSET affine hull {u0,s1}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (NEW_GOAL `affine hull {u0,s1,s2} = affine hull {u0, s1:real^3}`); + (MATCH_MP_TAC AFFINE_HULLS_EQ); + (REWRITE_TAC[SUBSET; SET_RULE `x IN {a,b,c} <=> x = a \/ x = b \/ x = c`]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[Trigonometry2.UV_IN_AFF2]); + (ASM_REWRITE_TAC[Trigonometry2.UV_IN_AFF2]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC); + (REWRITE_TAC[SUBSET; SET_RULE `x IN {b,c} <=> x = b \/ x = c`]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[AFFINE_HULL_3;IN;IN_ELIM_THM]); + (EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0`); + (STRIP_TAC); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[AFFINE_HULL_3;IN;IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `&1` THEN EXISTS_TAC `&0`); + (STRIP_TAC); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `aff_dim {u0,s1,s2:real^3} <= &1`); + (ONCE_REWRITE_TAC[GSYM AFF_DIM_AFFINE_HULL]); + (ONCE_ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[AFF_DIM_AFFINE_HULL]); + (MATCH_MP_TAC (ARITH_RULE `(?x. x <= &1 /\ y <= x:int) ==> y <= &1`)); + (EXISTS_TAC `&(CARD {u0,s1:real^3}):int - &1`); + (STRIP_TAC); + (REWRITE_TAC[ARITH_RULE `a:int - &1 <= &1 <=> a <= &2`; INT_OF_NUM_LE]); + (REWRITE_TAC[Geomdetail.CARD2]); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_TAC[Geomdetail.FINITE6]); + + (NEW_GOAL `aff_dim {u0,s1,s2:real^3} = &2`); + + (NEW_GOAL `vl:(real^3)list = truncate_simplex 2 ul`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_WITH `aff_dim {u0,s1,s2:real^3} = + aff_dim {omega_list_n V vl j | j IN 0..2}`); + (AP_TERM_TAC); + (REWRITE_TAC[IN_NUMSEG_0]); + (REWRITE_TAC[SET_EQ_LEMMA; + SET_RULE `x IN {a,b,c} <=> (x = a \/ x = b \/ x = c)`; IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `0`); + (REWRITE_TAC[ARITH_RULE `0 <= 2`; OMEGA_LIST_N]); + (EXPAND_TAC "vl" THEN REWRITE_TAC[HD]); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 2`]); + (EXPAND_TAC "vl"); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (DEL_TAC); + (EXPAND_TAC "s1"); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_1; OMEGA_LIST_TRUNCATE_1_NEW1]); + + (EXISTS_TAC `2`); + (REWRITE_TAC[ARITH_RULE `2 <= 2`; ASSUME `x = s2:real^3`] THEN EXPAND_TAC "vl" THEN DEL_TAC); + (EXPAND_TAC "s2"); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; HD]); + (REWRITE_TAC[set_of_list; OMEGA_LIST_TRUNCATE_2; + OMEGA_LIST_TRUNCATE_2_NEW1]); + + (ASM_CASES_TAC `j = 0`); + (DISJ1_TAC); + (REWRITE_TAC[ASSUME `x:real^3 = omega_list_n V vl j`; OMEGA_LIST_N; HD]); + (EXPAND_TAC "vl"); + (REWRITE_TAC[ASSUME `j = 0`]); + (REWRITE_TAC[OMEGA_LIST_N; HD]); + + (ASM_CASES_TAC `j = 1`); + (DISJ2_TAC); + (DISJ1_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; HD]); + (EXPAND_TAC "s1"); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_1; OMEGA_LIST_TRUNCATE_1_NEW1]); + + (ASM_CASES_TAC `j = 2`); + (DISJ2_TAC); + (DISJ2_TAC); + (REWRITE_TAC[ASSUME `x:real^3 = omega_list_n V vl j`]); + (EXPAND_TAC "vl"); + (EXPAND_TAC "s2"); + (REWRITE_TAC[ASSUME `j = 2`; OMEGA_LIST_TRUNCATE_2; OMEGA_LIST_TRUNCATE_2_NEW1]); + (SUBGOAL_THEN `F` MP_TAC); + (ASM_ARITH_TAC); + (MESON_TAC[]); + + (MATCH_MP_TAC XNHPWAB3); + (ASM_REWRITE_TAC[IN]); + STRIP_TAC; + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + +(* ========================================================================= *) + +(* ========================================================================== *) + (MATCH_MP_TAC (REAL_ARITH `x = &0 ==> a + x = a`)); + (REWRITE_TAC[DOT_LMUL]); + (REWRITE_WITH `(s3 - s2) dot (s2 - m:real^3) = &0`); + (ONCE_REWRITE_TAC[VECTOR_ARITH `a dot (b - c) = -- (a dot (c - b))`]); + (ONCE_REWRITE_TAC[REAL_ARITH `--a = &0 <=> a = &0`]); + (REWRITE_TAC[ASSUME `s2:real^3 = circumcenter (set_of_list vl)`]); + (MATCH_MP_TAC MHFTTZN4); + (EXISTS_TAC `V:real^3->bool`); + (EXISTS_TAC `2`); + (REWRITE_WITH `vl:(real^3)list = truncate_simplex 2 ul`); + (EXPAND_TAC "vl" THEN DEL_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_MESON_TAC[ARITH_RULE `2 <= 3`]); + +(* ========================================================================== *) + (MATCH_MP_TAC IN_AFFINE_KY_LEMMA1); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (UNDISCH_TAC `between m (u0,s1:real^3)`); + (REWRITE_WITH `s1 = midpoint (u0,u1:real^3)`); + (EXPAND_TAC "s1"); + + (REWRITE_WITH `omega_list_n V [u0; u1; u2; u3] 1 = + omega_list_n V [u0; u1:real^3] 1`); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_1_NEW2;OMEGA_LIST_TRUNCATE_1]); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_1_NEW2]); + (REWRITE_WITH `omega_list V [u0; u1:real^3] = + circumcenter (set_of_list [u0;u1])`); + (MATCH_MP_TAC XNHPWAB1); + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_TAC[IN] THEN STRIP_TAC); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `2` THEN REWRITE_TAC[ARITH_RULE `1 <= 2`]); + (REWRITE_WITH `vl = truncate_simplex 2 ul:(real^3)list`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `!i j. i < j /\ j <= 2 + ==> hl (truncate_simplex i (vl:(real^3)list)) + < hl (truncate_simplex j vl)`); + + (MATCH_MP_TAC XNHPWAB4); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[IN]); + (REWRITE_WITH `vl = truncate_simplex 2 ul:(real^3)list`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ASM_MESON_TAC[]); + (NEW_GOAL `hl (truncate_simplex 1 (vl:(real^3)list)) < hl (truncate_simplex 2 vl)`); + (FIRST_X_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + + (NEW_GOAL `truncate_simplex 2 vl = truncate_simplex 2 ul:(real^3)list`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC (REAL_ARITH `a < hl (truncate_simplex 2 (vl:(real^3)list)) /\ + hl (truncate_simplex 2 vl) < b ==> a < b`)); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[set_of_list;Rogers.CIRCUMCENTER_2]); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2; midpoint; IN; IN_ELIM_THM; AFFINE_HULL_3]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u' + v' * inv (&2)`); + (EXISTS_TAC `v' * inv (&2)`); + (EXISTS_TAC `&0`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `(u' + v' * inv (&2)) + v' * inv (&2) + &0 = u' + v'`]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[REAL_MUL_RZERO; REAL_ARITH `&0 / x = &0`]); + (VECTOR_ARITH_TAC); + +(* ========================================================================== *) + + (NEW_GOAL `norm (u0 - p:real^3) pow 2 = + norm ((p'+ m) - p) pow 2 + norm (u0 - (p' + m)) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_WITH `p - (p'+ m) = projection (s2 - m) (p - m:real^3)`); + (REWRITE_TAC[VECTOR_ARITH `p - (a + b:real^3) = (p - b) - a`]); + (EXPAND_TAC "p'" THEN REWRITE_TAC[proj_point]); + (UNDISCH_TAC `between (p - m) (vec 0,n - m:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2;IN; + IN_ELIM_THM; VECTOR_MUL_RZERO;VECTOR_ADD_LID]); + (REPEAT STRIP_TAC); + (VECTOR_ARITH_TAC); + (NEW_GOAL `(?k. k <= &1 /\ &0 <= k /\ + projection (s2 - m) (p - m:real^3) = k % projection (s2 - m) (n - m))`); + (MATCH_MP_TAC PARALLEL_PROJECTION); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (NEW_GOAL `s2 = m:real^3`); + (ASM_REWRITE_TAC[]); + (SWITCH_TAC THEN DEL_TAC); + + (NEW_GOAL `between s2 (u0, s1:real^3)`); + (ASM_MESON_TAC[]); + (NEW_GOAL `s2 IN affine hull {u0, s1:real^3}`); + (UP_ASM_TAC THEN REWRITE_TAC[BETWEEN_IN_CONVEX_HULL]); + (STRIP_TAC); + (NEW_GOAL `convex hull {u0,s1:real^3} SUBSET affine hull {u0,s1}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `affine hull {u0,s1,s2} = affine hull {u0, s1:real^3}`); + (MATCH_MP_TAC AFFINE_HULLS_EQ); + (REWRITE_TAC[SUBSET; SET_RULE `x IN {a,b,c} <=> x = a \/ x = b \/ x = c`]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[Trigonometry2.UV_IN_AFF2]); + (ASM_REWRITE_TAC[Trigonometry2.UV_IN_AFF2]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC); + (REWRITE_TAC[SUBSET; SET_RULE `x IN {b,c} <=> x = b \/ x = c`]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[AFFINE_HULL_3;IN;IN_ELIM_THM]); + (EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0`); + (STRIP_TAC); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[ASSUME `x = s1:real^3`;AFFINE_HULL_3;IN;IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `&1` THEN EXISTS_TAC `&0`); + (STRIP_TAC); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `aff_dim {u0,s1,s2:real^3} <= &1`); + (ONCE_REWRITE_TAC[GSYM AFF_DIM_AFFINE_HULL]); + (ONCE_ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[AFF_DIM_AFFINE_HULL]); + (MATCH_MP_TAC (ARITH_RULE `(?x. x <= &1 /\ y <= x:int) ==> y <= &1`)); + (EXISTS_TAC `&(CARD {u0,s1:real^3}):int - &1`); + (STRIP_TAC); + (REWRITE_TAC[ARITH_RULE `a:int - &1 <= &1 <=> a <= &2`; INT_OF_NUM_LE]); + (REWRITE_TAC[Geomdetail.CARD2]); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_TAC[Geomdetail.FINITE6]); + + (NEW_GOAL `aff_dim {u0,s1,s2:real^3} = &2`); + + (NEW_GOAL `vl:(real^3)list = truncate_simplex 2 ul`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_WITH `aff_dim {u0,s1,s2:real^3} = + aff_dim {omega_list_n V vl j | j IN 0..2}`); + (AP_TERM_TAC); + (REWRITE_TAC[IN_NUMSEG_0]); + (REWRITE_TAC[SET_EQ_LEMMA; + SET_RULE `x IN {a,b,c} <=> (x = a \/ x = b \/ x = c)`; IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `0`); + (REWRITE_TAC[ARITH_RULE `0 <= 2`; OMEGA_LIST_N]); + (EXPAND_TAC "vl" THEN REWRITE_TAC[HD]); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 2`]); + (EXPAND_TAC "vl"); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (DEL_TAC); + (EXPAND_TAC "s1"); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_1; OMEGA_LIST_TRUNCATE_1_NEW1]); + + (EXISTS_TAC `2`); + (REWRITE_TAC[ARITH_RULE `2 <= 2`; ASSUME `x = s2:real^3`] THEN EXPAND_TAC "vl" THEN DEL_TAC); + (EXPAND_TAC "s2"); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; HD]); + (REWRITE_TAC[set_of_list; OMEGA_LIST_TRUNCATE_2; + OMEGA_LIST_TRUNCATE_2_NEW1]); + + (ASM_CASES_TAC `j = 0`); + (DISJ1_TAC); + (REWRITE_TAC[ASSUME `x:real^3 = omega_list_n V vl j`; OMEGA_LIST_N; HD]); + (EXPAND_TAC "vl"); + (REWRITE_TAC[ASSUME `j = 0`]); + (REWRITE_TAC[OMEGA_LIST_N; HD]); + + (ASM_CASES_TAC `j = 1`); + (DISJ2_TAC); + (DISJ1_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; HD]); + (EXPAND_TAC "s1"); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_1; OMEGA_LIST_TRUNCATE_1_NEW1]); + + (ASM_CASES_TAC `j = 2`); + (DISJ2_TAC); + (DISJ2_TAC); + (REWRITE_TAC[ASSUME `x:real^3 = omega_list_n V vl j`]); + (EXPAND_TAC "vl"); + (EXPAND_TAC "s2"); + (REWRITE_TAC[ASSUME `j = 2`; OMEGA_LIST_TRUNCATE_2; OMEGA_LIST_TRUNCATE_2_NEW1]); + (SUBGOAL_THEN `F` MP_TAC); + (ASM_ARITH_TAC); + (MESON_TAC[]); + + (MATCH_MP_TAC XNHPWAB3); + (ASM_REWRITE_TAC[IN]); + STRIP_TAC; + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (FIRST_X_ASSUM CHOOSE_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + + (REWRITE_TAC[ASSUME `projection (s2 - m) (p - m:real^3) = + k % projection (s2 - m) (n - m)`]); + (REWRITE_TAC[projection_proj_point; orthogonal]); + (REWRITE_TAC[ASSUME `proj_point (s2 - m) (n - m:real^3) = n'`]); + (REWRITE_TAC[ASSUME `n' = s2 - m:real^3`; + VECTOR_ARITH `n - m - (a - m:real^3) = n - a`]); + (UNDISCH_TAC `between n (s2,s3:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM] THEN + REPEAT STRIP_TAC); + (REWRITE_TAC[ASSUME `n = u % s2 + v % s3:real^3`]); + (REWRITE_WITH `(u % s2 + v % s3:real^3) - s2 = (u % s2 + v % s3) - (u + v) % s2`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (REWRITE_TAC[VECTOR_ARITH + `(u % s2 + v % s3) - (u + v) % s2 = v % (s3 - s2:real^3)`]); + (ONCE_REWRITE_TAC[VECTOR_ARITH + `u0 - (p' + m) = ((u0:real^3) + s2 - (p' + m)) - s2`]); + (NEW_GOAL `(s3 - s2:real^3) dot ((u0 + s2 - (p' + m)) - s2) = &0`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MHFTTZN4); + (EXISTS_TAC `V:real^3->bool`); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (REWRITE_WITH `vl:(real^3)list = truncate_simplex 2 ul`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl"); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (STRIP_TAC); + (MATCH_MP_TAC IN_AFFINE_KY_LEMMA1); + (REWRITE_WITH `vl:(real^3)list = truncate_simplex 2 ul`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl"); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + + (NEW_GOAL `!a b c m n p. + m IN affine hull {a,b,c:real^3} /\ + n IN affine hull {a,b,c} /\ + p IN affine hull {a,b,c} + ==> m + n - p IN affine hull {a,b,c}`); + (REWRITE_TAC[AFFINE_HULL_3; IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `(u' + u'') - u'''`); + (EXISTS_TAC `(v' + v'') - v'''`); + (EXISTS_TAC `(w + w') - w''`); + STRIP_TAC; + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (FIRST_X_ASSUM MATCH_MP_TAC); + + (REPEAT STRIP_TAC); + + (REWRITE_TAC[AFFINE_HULL_3; IN;IN_ELIM_THM]); + (EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0`); + STRIP_TAC; + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + + (MATCH_MP_TAC Rogers.OAPVION1); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_WITH `{u0, u1, u2:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT); + + (EXISTS_TAC `V:real^3->bool`); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `vl:(real^3)list = truncate_simplex 2 ul`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl"); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC Packing3. TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (EXPAND_TAC "p'"); + (REWRITE_TAC[PRO_EXP]); + (ABBREV_TAC `h = ((p - m) dot (s2 - m)) / ((s2 - m) dot (s2 - m:real^3))`); + + (NEW_GOAL `!a b c x y r. + x IN affine hull {a,b,c:real^3} /\ + y IN affine hull {a,b,c} + ==> r % (x - y) + y IN affine hull {a,b,c}`); + (REWRITE_TAC[AFFINE_HULL_3; IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `r * (u' - u'') + u''`); + (EXISTS_TAC `r * (v' - v'') + v''`); + (EXISTS_TAC `r * (w - w') + w'`); + STRIP_TAC; + (REWRITE_TAC[REAL_ARITH + `(r * (u' - u'') + u'') + (r * (v' - v'') + v'') + r * (w - w') + w' = + r * (u' + v' + w) - r * (u'' + v'' + w') + (u'' + v'' + w')`]); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (FIRST_X_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + + (REWRITE_WITH `{u0, u1, u2:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.OAPVION1); + (STRIP_TAC); + (REWRITE_WITH `set_of_list vl = {u0, u1, u2:real^3}`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (SET_TAC[]); + (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT); + (EXISTS_TAC `V:real^3->bool`); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `vl:(real^3)list = truncate_simplex 2 ul`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl"); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC Packing3. TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (UNDISCH_TAC `between m (u0,s1:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2; + AFFINE_HULL_3;IN;IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (UP_ASM_TAC); + + (REWRITE_WITH `s1 = midpoint (u0,u1:real^3)`); + (REWRITE_TAC[GSYM (ASSUME `omega_list_n V [u0; u1; u2; u3:real^3] 1 = s1`)]); + (REWRITE_WITH `omega_list_n V [u0; u1; u2; u3] 1 = + omega_list_n V [u0; u1:real^3] 1`); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_1_NEW2;OMEGA_LIST_TRUNCATE_1]); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_1_NEW2]); + (REWRITE_WITH `omega_list V [u0; u1:real^3] = + circumcenter (set_of_list [u0;u1])`); + (MATCH_MP_TAC XNHPWAB1); + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_TAC[IN] THEN STRIP_TAC); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `2` THEN REWRITE_TAC[ARITH_RULE `1 <= 2`]); + (REWRITE_WITH `vl = truncate_simplex 2 ul:(real^3)list`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `!i j. i < j /\ j <= 2 + ==> hl (truncate_simplex i (vl:(real^3)list)) + < hl (truncate_simplex j vl)`); + + (MATCH_MP_TAC XNHPWAB4); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[IN]); + (REWRITE_WITH `vl = truncate_simplex 2 ul:(real^3)list`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ASM_MESON_TAC[]); + (NEW_GOAL `hl (truncate_simplex 1 (vl:(real^3)list)) < hl (truncate_simplex 2 vl)`); + (FIRST_X_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + + (NEW_GOAL `truncate_simplex 2 vl = truncate_simplex 2 ul:(real^3)list`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC (REAL_ARITH `a < hl (truncate_simplex 2 (vl:(real^3)list)) /\ + hl (truncate_simplex 2 vl) < b ==> a < b`)); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[set_of_list;Rogers.CIRCUMCENTER_2]); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2; midpoint; IN; IN_ELIM_THM; AFFINE_HULL_3]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u' + v' * inv (&2)`); + (EXISTS_TAC `v' * inv (&2)`); + (EXISTS_TAC `&0`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `(u' + v' * inv (&2)) + v' * inv (&2) + &0 = u' + v'`]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + + (REWRITE_TAC[VECTOR_ARITH `a % b % c dot d = a * b * (c dot d)`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_MUL_RZERO]); + +(* ========================================================================= *) + (NEW_GOAL `norm (u0 - s:real^3) pow 2 = + norm (s2 - s) pow 2 + norm (u0 - s2) pow 2`); + + (MATCH_MP_TAC PYTHAGORAS); + (ASM_REWRITE_TAC[orthogonal]); + (MATCH_MP_TAC MHFTTZN4); + (EXISTS_TAC `V:real^3->bool`); + (EXISTS_TAC `2`); + (REWRITE_WITH `vl:(real^3)list = truncate_simplex 2 ul`); + (EXPAND_TAC "vl" THEN DEL_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_MESON_TAC[ARITH_RULE `2 <= 3`]); + + (UNDISCH_TAC `between s (s2,s3:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ONCE_REWRITE_TAC [GSYM IN]); + (ONCE_ASM_REWRITE_TAC[]); + (NEW_GOAL `convex (affine hull voronoi_list V + (truncate_simplex 2 [u0; u1; u2; u3:real^3]))`); + (MATCH_MP_TAC POLYHEDRON_IMP_CONVEX); + (REWRITE_TAC[POLYHEDRON_AFFINE_HULL]); + (UP_ASM_TAC THEN REWRITE_TAC[convex]); + (DISCH_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `truncate_simplex 2 [u0; u1; u2; u3:real^3] = vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (NEW_GOAL `affine hull (voronoi_list V vl) INTER + affine hull (set_of_list vl) = + {circumcenter (set_of_list (vl:(real^3)list))}`); + (MATCH_MP_TAC Rogers.MHFTTZN3); + (EXISTS_TAC `2`); + (REWRITE_WITH `vl:(real^3)list = truncate_simplex 2 ul`); + (EXPAND_TAC "vl" THEN DEL_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_MESON_TAC[ARITH_RULE `2 <= 3`]); + (UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC IN_AFFINE_KY_LEMMA1); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2;set_of_list]); + (MATCH_MP_TAC IN_AFFINE_KY_LEMMA1); + (SET_TAC[]); + +(* ======================================================================== *) + + (NEW_GOAL `norm (u0 - (p' + m)) pow 2 <= norm (u0 - s2:real^3) pow 2`); + (REWRITE_TAC[GSYM REAL_LE_SQUARE_ABS; REAL_ABS_NORM;GSYM dist]); + (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist]); + (NEW_GOAL + `(?y. y IN {m, s2:real^3} /\ + (!x. x IN convex hull {m,s2} ==> norm (x - u0) <= norm (y - u0 )))`); + (MATCH_MP_TAC SIMPLEX_FURTHEST_LE); + (STRIP_TAC); + (REWRITE_TAC[Geomdetail.FINITE6]); + (SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[SET_RULE `x IN {a, b} <=> x = b \/ x = a`] + THEN REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `y' = s2:real^3`]); + (DISCH_TAC THEN FIRST_ASSUM MATCH_MP_TAC); + (UNDISCH_TAC `between p' (vec 0,n':real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID; VECTOR_ARITH + `a % (x - y) + y = b % y + a % x <=> ((b + a) - &1) % y = vec 0`]); + (ASM_REWRITE_TAC[REAL_SUB_REFL; VECTOR_MUL_LZERO]); + (MATCH_MP_TAC (REAL_ARITH `(?s. a <= s /\ s <= b) ==> a <= b`)); + + (EXISTS_TAC `norm (m - u0:real^3)`); + (STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `y' = m:real^3`]); + (DISCH_TAC THEN FIRST_ASSUM MATCH_MP_TAC); + (UNDISCH_TAC `between p' (vec 0,n':real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID; VECTOR_ARITH + `a % (x - y) + y = b % y + a % x <=> ((b + a) - &1) % y = vec 0`]); + (ASM_REWRITE_TAC[REAL_SUB_REFL; VECTOR_MUL_LZERO]); + + (MATCH_MP_TAC (REAL_ARITH `(?s. a <= s /\ s <= b) ==> a <= b`)); + (EXISTS_TAC `norm (s1 - u0:real^3)`); + (STRIP_TAC); + (REWRITE_TAC[GSYM dist]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (UNDISCH_TAC `between m (u0,s1:real^3)`); + (REWRITE_TAC[between]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `a <= a + b <=> &0 <= b`; DIST_POS_LE]); + (NEW_GOAL `norm (s2 - u0:real^3) pow 2 = + norm (s1 - u0) pow 2 + norm (s2 - s1) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + + (ABBREV_TAC `sl = [u0;u1:real^3]`); + (NEW_GOAL `s1:real^3 = circumcenter (set_of_list sl)`); + (EXPAND_TAC "s1" THEN EXPAND_TAC "sl"); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_1]); + (MATCH_MP_TAC XNHPWAB1); + (EXISTS_TAC `1`); + (REWRITE_WITH `[u0; u1:real^3] = truncate_simplex 1 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (ASM_REWRITE_TAC[IN]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_MESON_TAC[ARITH_RULE `1 <= 3`]); + (DEL_TAC THEN ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + + (NEW_GOAL `!i j. i < j /\ j <= 2 + ==> hl (truncate_simplex i (vl:(real^3)list)) + < hl (truncate_simplex j vl)`); + + (MATCH_MP_TAC XNHPWAB4); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[IN]); + (REWRITE_WITH `vl = truncate_simplex 2 ul:(real^3)list`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ASM_MESON_TAC[]); + (NEW_GOAL `hl (truncate_simplex 1 (vl:(real^3)list)) < hl (truncate_simplex 2 vl)`); + (FIRST_X_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + + (NEW_GOAL `truncate_simplex 2 vl = truncate_simplex 2 ul:(real^3)list`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC (REAL_ARITH `a < hl (truncate_simplex 2 (vl:(real^3)list)) /\ + hl (truncate_simplex 2 vl) < b ==> a < b`)); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_TAC [ASSUME `s1:real^3 = circumcenter (set_of_list sl)`;orthogonal]); + (ONCE_REWRITE_TAC[DOT_SYM]); + (MATCH_MP_TAC MHFTTZN4); + + (EXISTS_TAC `V:real^3->bool`); + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (REWRITE_WITH `sl:(real^3)list = truncate_simplex 1 ul`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "sl"); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + + (STRIP_TAC); + (NEW_GOAL `affine hull (voronoi_list V vl) SUBSET + affine hull (voronoi_list V (sl:(real^3)list))`); + (MATCH_MP_TAC AFFINE_SUBSET_KY_LEMMA); + (EXPAND_TAC "sl" THEN EXPAND_TAC "vl" THEN REWRITE_TAC + [set_of_list; SET_RULE `x IN {a, b} <=> x = a \/ x = b`; + SET_RULE `x IN {a,b,c} <=> x = a \/ x = b \/ x = c`; + VORONOI_LIST; VORONOI_SET;voronoi_closed; SUBSET;IN_INTERS]); + (REWRITE_TAC[IN;IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (EXISTS_TAC `v:real^3`); + (ASM_REWRITE_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (EXISTS_TAC `v:real^3`); + (ASM_REWRITE_TAC[]); + + + (MATCH_MP_TAC (SET_RULE `(?C. C SUBSET B /\ s IN C ) ==> s IN B`)); + (EXISTS_TAC `affine hull voronoi_list V (vl:(real^3)list)`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `affine hull (voronoi_list V vl) INTER + affine hull (set_of_list vl) = + {circumcenter (set_of_list (vl:(real^3)list))}`); + (MATCH_MP_TAC Rogers.MHFTTZN3); + (EXISTS_TAC `2`); + (REWRITE_WITH `vl:(real^3)list = truncate_simplex 2 ul`); + (EXPAND_TAC "vl" THEN DEL_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_MESON_TAC[ARITH_RULE `2 <= 3`]); + (UP_ASM_TAC THEN SET_TAC[]); + + (EXPAND_TAC "sl" THEN REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC IN_AFFINE_KY_LEMMA1); + (SET_TAC[IN]); + + (REWRITE_WITH `norm (s1 - u0:real^3) <= norm (s2 - u0) + <=> norm (s1 - u0) pow 2 <= norm (s2 - u0) pow 2`); + (MATCH_MP_TAC Collect_geom.POW2_COND); + (REWRITE_TAC[NORM_POS_LE]); + (UP_ASM_TAC THEN MATCH_MP_TAC + (REAL_ARITH `(&0 <= c) ==> (a = b + c ==> b <= a)`)); + (REWRITE_TAC[REAL_LE_POW_2]); + +(* ==================================================================== *) + + (NEW_GOAL `norm (u0 - s:real^3) < norm (u0 - p)`); + (MATCH_MP_TAC (REAL_ARITH `(?s. a <= s /\ s < b) ==> a < b`)); + (EXISTS_TAC `sqrt (&2)`); + (STRIP_TAC); + (REWRITE_TAC[GSYM dist]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[GSYM dist]); + (UNDISCH_TAC `dist (u0,p:real^3) >= sqrt (&2)`); + (MATCH_MP_TAC (REAL_ARITH `~(a = b) ==> (a >= b ==> b < a)`)); + (STRIP_TAC); + (NEW_GOAL `~(p:real^3 IN B2)`); + (ASM_SET_TAC[IN_DIFF]); + (UP_ASM_TAC THEN EXPAND_TAC "B2" THEN REWRITE_TAC[IN;IN_ELIM_THM]); + (ASM_REWRITE_TAC[HD; GSYM dist]); + (ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); + + (NEW_GOAL `norm (u0 - s:real^3) pow 2 < norm (u0 - p) pow 2`); + (REWRITE_TAC[GSYM REAL_LT_SQUARE_ABS; REAL_ABS_NORM]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `norm (s2 - s:real^3) pow 2 < norm ((p' + m) - p:real^3) pow 2`); + (REWRITE_WITH `norm (s2 - s) pow 2 = + norm (u0 - s:real^3) pow 2 - norm (u0 - s2) pow 2`); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `norm ((p' + m) - p) pow 2 = + norm (u0 - p:real^3) pow 2 - norm (u0 - (p' + m)) pow 2`); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + +(* ======================================================================== *) + + (UNDISCH_TAC `p IN convex hull {u0, u1, u2, s:real^3}`); + (REWRITE_TAC[CONVEX_HULL_4; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (NEW_GOAL `(?m1. m1 IN convex hull {u0, u1, u2} /\ + between p (m1, s:real^3))`); + (ASM_CASES_TAC `(u + v + w = &0)`); + (NEW_GOAL `p = s:real^3`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `u = &0 /\ v = &0 /\ w = &0 /\ z = &1`); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `~(p:real^3 IN B2)`); + (ASM_SET_TAC[IN_DIFF]); + (UP_ASM_TAC THEN EXPAND_TAC "B2" THEN REWRITE_TAC[IN;IN_ELIM_THM]); + (ASM_REWRITE_TAC[HD; GSYM dist]); + (REWRITE_WITH `u = &0 /\ v = &0 /\ w = &0 /\ z = &1`); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_MUL_LID; VECTOR_ADD_LID]); + (ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (EXISTS_TAC `(u / (u + v + w)) % u0 + (v / (u + v + w)) % u1 + + (w / (u + v + w)) % u2:real^3`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2;CONVEX_HULL_3; IN; + IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `u / (u + v + w)`); + (EXISTS_TAC `v / (u + v + w)`); + (EXISTS_TAC `w / (u + v + w)`); + (ASM_REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a + b + c) / x`]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REAL_ARITH_TAC); + (EXISTS_TAC `u + v + w:real`); + (EXISTS_TAC `z:real`); + (REPEAT STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_ARITH `a % (x/ a % u0 + y / a % u1 + z / a % u2) = + (a / a) % (x % u0) + (a / a) % (y % u1) + (a / a) % (z % u2)`]); + (REWRITE_WITH `(u + v + w) / (u + v + w) = &1`); + (ASM_SIMP_TAC [REAL_DIV_REFL]); + (REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + +(* ======================================================================== *) + + (NEW_GOAL `(?k. k <= &1 /\ &0 <= k /\ + projection (s2 - m) (p - m:real^3) = k % projection (s2 - m) (n - m))`); + (MATCH_MP_TAC PARALLEL_PROJECTION); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (NEW_GOAL `s2 = m:real^3`); + (ASM_REWRITE_TAC[]); + (SWITCH_TAC THEN DEL_TAC); + + (NEW_GOAL `between s2 (u0, s1:real^3)`); + (ASM_MESON_TAC[]); + (NEW_GOAL `s2 IN affine hull {u0, s1:real^3}`); + (UP_ASM_TAC THEN REWRITE_TAC[BETWEEN_IN_CONVEX_HULL]); + (STRIP_TAC); + (NEW_GOAL `convex hull {u0,s1:real^3} SUBSET affine hull {u0,s1}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `affine hull {u0,s1,s2} = affine hull {u0, s1:real^3}`); + (MATCH_MP_TAC AFFINE_HULLS_EQ); + (REWRITE_TAC[SUBSET; SET_RULE `x IN {a,b,c} <=> x = a \/ x = b \/ x = c`]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[Trigonometry2.UV_IN_AFF2]); + (ASM_REWRITE_TAC[Trigonometry2.UV_IN_AFF2]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC); + (REWRITE_TAC[SUBSET; SET_RULE `x IN {b,c} <=> x = b \/ x = c`]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[AFFINE_HULL_3;IN;IN_ELIM_THM]); + (EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0`); + (STRIP_TAC); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[ASSUME `x = s1:real^3`;AFFINE_HULL_3;IN;IN_ELIM_THM]); + (EXISTS_TAC `&0` THEN EXISTS_TAC `&1` THEN EXISTS_TAC `&0`); + (STRIP_TAC); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `aff_dim {u0,s1,s2:real^3} <= &1`); + (ONCE_REWRITE_TAC[GSYM AFF_DIM_AFFINE_HULL]); + (ONCE_ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[AFF_DIM_AFFINE_HULL]); + (MATCH_MP_TAC (ARITH_RULE `(?x. x <= &1 /\ y <= x:int) ==> y <= &1`)); + (EXISTS_TAC `&(CARD {u0,s1:real^3}):int - &1`); + (STRIP_TAC); + (REWRITE_TAC[ARITH_RULE `a:int - &1 <= &1 <=> a <= &2`; INT_OF_NUM_LE]); + (REWRITE_TAC[Geomdetail.CARD2]); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_TAC[Geomdetail.FINITE6]); + + (NEW_GOAL `aff_dim {u0,s1,s2:real^3} = &2`); + + (NEW_GOAL `vl:(real^3)list = truncate_simplex 2 ul`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_WITH `aff_dim {u0,s1,s2:real^3} = + aff_dim {omega_list_n V vl j | j IN 0..2}`); + (AP_TERM_TAC); + (REWRITE_TAC[IN_NUMSEG_0]); + (REWRITE_TAC[SET_EQ_LEMMA; + SET_RULE `x IN {a,b,c} <=> (x = a \/ x = b \/ x = c)`; IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `0`); + (REWRITE_TAC[ARITH_RULE `0 <= 2`; OMEGA_LIST_N]); + (EXPAND_TAC "vl" THEN REWRITE_TAC[HD]); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 2`]); + (EXPAND_TAC "vl"); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (DEL_TAC); + (EXPAND_TAC "s1"); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_1; OMEGA_LIST_TRUNCATE_1_NEW1]); + + (EXISTS_TAC `2`); + (REWRITE_TAC[ARITH_RULE `2 <= 2`; ASSUME `x = s2:real^3`] THEN EXPAND_TAC "vl" THEN DEL_TAC); + (EXPAND_TAC "s2"); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; HD]); + (REWRITE_TAC[set_of_list; OMEGA_LIST_TRUNCATE_2; + OMEGA_LIST_TRUNCATE_2_NEW1]); + + (ASM_CASES_TAC `j = 0`); + (DISJ1_TAC); + (REWRITE_TAC[ASSUME `x:real^3 = omega_list_n V vl j`; OMEGA_LIST_N; HD]); + (EXPAND_TAC "vl"); + (REWRITE_TAC[ASSUME `j = 0`]); + (REWRITE_TAC[OMEGA_LIST_N; HD]); + + (ASM_CASES_TAC `j = 1`); + (DISJ2_TAC); + (DISJ1_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; HD]); + (EXPAND_TAC "s1"); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_1; OMEGA_LIST_TRUNCATE_1_NEW1]); + + (ASM_CASES_TAC `j = 2`); + (DISJ2_TAC); + (DISJ2_TAC); + (REWRITE_TAC[ASSUME `x:real^3 = omega_list_n V vl j`]); + (EXPAND_TAC "vl"); + (EXPAND_TAC "s2"); + (REWRITE_TAC[ASSUME `j = 2`; OMEGA_LIST_TRUNCATE_2; OMEGA_LIST_TRUNCATE_2_NEW1]); + (SUBGOAL_THEN `F` MP_TAC); + (ASM_ARITH_TAC); + (MESON_TAC[]); + + (MATCH_MP_TAC XNHPWAB3); + (ASM_REWRITE_TAC[IN]); + STRIP_TAC; + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `?h. h <= &1 /\ &0 <= h /\ + projection (s2 - m1:real^3) (p - m1) = h % projection (s2 - m1) (s - m1)`); + (MATCH_MP_TAC PARALLEL_PROJECTION); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (NEW_GOAL `s2 = m1:real^3`); + (ASM_REWRITE_TAC[]); + (SWITCH_TAC THEN DEL_TAC); + (NEW_GOAL `between p (s2, s:real^3)`); + (ASM_MESON_TAC[]); + (NEW_GOAL `between p (s3, s2:real^3)`); + (MATCH_MP_TAC BETWEEN_TRANS); + (EXISTS_TAC `s:real^3`); + (STRIP_TAC); + (ASM_MESON_TAC[BETWEEN_SYM]); + (ASM_MESON_TAC[BETWEEN_SYM]); + + (NEW_GOAL `p:real^3 IN B5`); + (EXPAND_TAC "B5"); + (UP_ASM_TAC THEN REWRITE_TAC[BETWEEN_IN_CONVEX_HULL]); + (EXPAND_TAC "s2"); + (EXPAND_TAC "s3"); + (REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (MESON_TAC[SET_RULE `{a,b} = {b, a}`]); + (NEW_GOAL `~(p:real^3 IN B5)`); + (ASM_SET_TAC[IN_DIFF]); + (ASM_MESON_TAC[]); + + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `projection (s2 - m1) (s - m1) = s - s2:real^3`); + (REWRITE_TAC[projection; VECTOR_ARITH `a - b - x % (d - b) = a - d + <=> (&1 - x) % (d - b:real^3) = vec 0`]); + (REWRITE_WITH `&1 - ((s - m1) dot (s2 - m1:real^3)) / ((s2 - m1) dot (s2 - m1)) = &0`); + (REWRITE_TAC[REAL_ARITH `&1 - a = &0 <=> a = &1`]); + (REWRITE_WITH `((s - m1) dot (s2 - m1)) / ((s2 - m1) dot (s2 - m1)) = &1 + <=> ((s - m1) dot (s2 - m1)) = &1 * ((s2 - m1) dot (s2 - m1:real^3))`); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (REWRITE_TAC[GSYM NORM_POW_2; GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT; + NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (STRIP_TAC); + + (NEW_GOAL `between p (s2, s:real^3)`); + (ASM_MESON_TAC[]); + (NEW_GOAL `between p (s3, s2:real^3)`); + (MATCH_MP_TAC BETWEEN_TRANS); + (EXISTS_TAC `s:real^3`); + (STRIP_TAC); + (ASM_MESON_TAC[BETWEEN_SYM]); + (ASM_MESON_TAC[BETWEEN_SYM]); + + (NEW_GOAL `p:real^3 IN B5`); + (EXPAND_TAC "B5"); + (UP_ASM_TAC THEN REWRITE_TAC[BETWEEN_IN_CONVEX_HULL]); + (EXPAND_TAC "s2"); + (EXPAND_TAC "s3"); + (REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (MESON_TAC[SET_RULE `{a,b} = {b, a}`]); + (NEW_GOAL `~(p:real^3 IN B5)`); + (ASM_SET_TAC[IN_DIFF]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[REAL_MUL_LID]); + (ONCE_REWRITE_TAC[REAL_ARITH `a = b <=> a - b = &0`]); + (REWRITE_TAC[VECTOR_ARITH + `(s - m1) dot r - (s2 - m1) dot r = (s - s2) dot r:real^3`]); + (REWRITE_WITH `(s - s2) dot (s2 - m1) = --((s - s2) dot (m1 - s2:real^3))`); + (VECTOR_ARITH_TAC); + (ONCE_REWRITE_TAC[REAL_ARITH `-- a = &0 <=> a = &0`]); + (UNDISCH_TAC `between s (s2,s3:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;IN;IN_ELIM_THM; CONVEX_HULL_2]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[ASSUME `s = u' % s2 + v' % s3:real^3`]); + (REWRITE_WITH `(u' % s2 + v' % s3) - s2:real^3 = + (u' % s2 + v' % s3) - (u' + v') % s2`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (REWRITE_TAC[VECTOR_ARITH + `(u' % s2 + v' % s3) - (u' + v') % s2 = v' % (s3 - s2)`; DOT_LMUL]); + (REWRITE_WITH `(s3 - s2) dot (m1 - s2:real^3) = &0`); + (ASM_REWRITE_TAC[]); + + + + (MATCH_MP_TAC MHFTTZN4); + (EXISTS_TAC `V:real^3->bool`); + (EXISTS_TAC `2`); + (REWRITE_WITH `vl:(real^3)list = truncate_simplex 2 ul`); + (EXPAND_TAC "vl" THEN DEL_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_MESON_TAC[ARITH_RULE `2 <= 3`]); + (MATCH_MP_TAC IN_AFFINE_KY_LEMMA1); + (ONCE_ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_2;set_of_list]); + (UNDISCH_TAC `m1 IN convex hull {u0, u1, u2:real^3}`); + (NEW_GOAL `convex hull {u0, u1, u2:real^3} SUBSET + affine hull {u0, u1, u2:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (UP_ASM_TAC THEN SET_TAC[]); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (ABBREV_TAC `M = projection (s2 - m1) (p - m1:real^3)`); + (ABBREV_TAC `N = projection (s2 - m) (p - m:real^3)`); + (NEW_GOAL `M = N:real^3`); + (NEW_GOAL `?r. N = r % M:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `projection (s2 - m) (n - m:real^3) = n - s2`); + (REWRITE_TAC[projection_proj_point; ASSUME `n' = s2 - m:real^3`; + ASSUME `proj_point (s2 - m) (n - m) = n':real^3`]); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `circumcenter (set_of_list vl) = s2:real^3`); + (ASM_MESON_TAC[]); + (REWRITE_TAC[ASSUME `projection (s2 - m) (n - m) = n - s2:real^3`]); + (UNDISCH_TAC `between n (s2,s3:real^3)`); + (UNDISCH_TAC `between s (s2,s3:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (REWRITE_TAC[ASSUME `n = u'' % s2 + v'' % s3:real^3`; + ASSUME `s = u' % s2 + v' % s3:real^3`]); + (REWRITE_WITH `(u' % s2 + v' % s3) - s2:real^3 + = (u' % s2 + v' % s3) - (u' + v') % s2 /\ + (u'' % s2 + v'' % s3) - s2 + = (u'' % s2 + v'' % s3) - (u'' + v'') % s2`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (REWRITE_TAC[VECTOR_ARITH `(u % s + v % r) - (u + v) % s = v % (r - s)`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC]); + (REWRITE_TAC[VECTOR_ARITH `a % x = b % x <=> (a - b) % x = vec 0`]); + (REWRITE_TAC[REAL_ARITH `(r * h) * v' = r * (h * v')`]); + (ASM_CASES_TAC `h * v' = &0`); + (NEW_GOAL `F`); + (ASM_CASES_TAC `h = &0`); + (NEW_GOAL `M:real^3 = vec 0`); + (ASM_REWRITE_TAC[VECTOR_MUL_LZERO]); + (UP_ASM_TAC THEN EXPAND_TAC "M" THEN REWRITE_TAC[projection]); + (ABBREV_TAC `kts = ((p - m1) dot (s2 - m1)) / ((s2 - m1) dot (s2 - m1:real^3))`); + (REWRITE_TAC [VECTOR_ARITH `a - p - c = vec 0 <=> a = p + c`]); + (STRIP_TAC); + (NEW_GOAL `p IN affine hull {u0,u1,u2:real^3}`); + (REWRITE_TAC[ASSUME `p = m1 + kts % (s2 - m1:real^3)`]); + (MATCH_MP_TAC TRANSLATE_AFFINE_KY_LEMMA1); + (REWRITE_TAC[MESON[] `A /\ B /\ A <=> A /\ B`]); + (STRIP_TAC); + (NEW_GOAL `convex hull {u0,u1,u2:real^3} SUBSET affine hull {u0, u1, u2}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (UNDISCH_TAC `m1 IN convex hull {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl"); + (REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.OAPVION1); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_WITH `{u0, u1, u2:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT); + + (EXISTS_TAC `V:real^3->bool`); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `vl:(real^3)list = truncate_simplex 2 ul`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl"); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC Packing3. TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `~(p:real^3 IN B6)`); + (ASM_SET_TAC[IN_DIFF]); + (UP_ASM_TAC THEN EXPAND_TAC "B6"); + (REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`;HD;TL]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `v' = &0`); + (ASM_MESON_TAC[REAL_ENTIRE]); + (NEW_GOAL `s = s2:real^3`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `u' = &1`); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `!w. w IN {u0,u1,u2:real^3} ==> + radV {u0,u1,u2} = dist (circumcenter {u0,u1,u2},w)`); + (MATCH_MP_TAC Rogers.OAPVION2); + (REWRITE_WITH `{u0, u1, u2:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT); + (EXISTS_TAC `V:real^3->bool`); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `vl:(real^3)list = truncate_simplex 2 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `hl (truncate_simplex 2 (ul:(real^3)list)) = dist (s2, u0:real^3)`); + (REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; HL]); + (REWRITE_WITH `s2 = circumcenter {u0,u1,u2:real^3}`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (FIRST_ASSUM MATCH_MP_TAC); + (SET_TAC[]); + (NEW_GOAL `hl (truncate_simplex 2 (ul:(real^3)list)) = sqrt (&2)`); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `s = s2:real^3`)]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (EXISTS_TAC `(k * v'') / (h * v')`); + (REWRITE_TAC[REAL_ARITH `k * v'' - (k * v'') / (h * v') * h * v' = + (k * v'') * (&1 - (h * v') / (h * v'))`]); + (REWRITE_WITH `(h * v') / (h * v') = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_SUB_REFL;REAL_MUL_RZERO; VECTOR_MUL_LZERO]); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `r = &1`); + (ASM_CASES_TAC `r = &1`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `p IN affine hull {u0,u1,u2:real^3}`); + (MATCH_MP_TAC IN_AFFINE_HULL_KY_LEMMA3_alt); + (EXISTS_TAC `M:real^3`); + (EXISTS_TAC `r:real`); + (REWRITE_WITH `p - M = (m1:real^3) + proj_point (s2 - m1) (p - m1)`); + (EXPAND_TAC "M" THEN REWRITE_TAC[proj_point]); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `p - r % M =(m:real^3) + proj_point (s2 - m) (p - m)`); + (REWRITE_TAC[GSYM (ASSUME `N = r % M:real^3`)]); + (EXPAND_TAC "N" THEN REWRITE_TAC[proj_point]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[PRO_EXP]); + + (REPEAT STRIP_TAC); + (MATCH_MP_TAC TRANSLATE_AFFINE_KY_LEMMA1 ); + (REWRITE_TAC[MESON[] `A /\ B /\ A <=> A /\ B`]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `convex hull {u0,u1,u2} SUBSET affine hull {u0,u1,u2:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (UP_ASM_TAC THEN UNDISCH_TAC `m1:real^3 IN convex hull {u0,u1,u2}` THEN + SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `{u0, u1, u2:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.BARV_CIRCUMCENTER_EXISTS); + (EXISTS_TAC `V:real^3->bool`); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `vl:(real^3)list = truncate_simplex 2 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (MATCH_MP_TAC TRANSLATE_AFFINE_KY_LEMMA1); + + (REWRITE_TAC[MESON[] `A/\B/\A <=> A/\B`]); + (STRIP_TAC); + + (MATCH_MP_TAC IN_AFFINE_HULL_3_KY_LEMMA2); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `s1:real^3`); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC IN_AFFINE_KY_LEMMA1); + (SET_TAC[]); + + (MATCH_MP_TAC (SET_RULE`(?s. s SUBSET b /\ a IN s) ==> a IN b`)); + (EXISTS_TAC `convex hull {u0, u1,u2:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC (SET_RULE`(?s. s SUBSET b /\ a IN s) ==> a IN b`)); + (EXISTS_TAC `convex hull {u0, u1:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC CONVEX_HULL_SUBSET); + (SET_TAC[]); + + (REWRITE_WITH `{u0, u1:real^3} = set_of_list [u0;u1]`); + (REWRITE_TAC[set_of_list]); + (EXPAND_TAC "s1"); + (REWRITE_WITH `omega_list_n V [u0; u1; u2; u3] 1 = + omega_list V [u0;u1:real^3]`); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_1]); + (MATCH_MP_TAC XNHPWAB2); + (EXISTS_TAC `1`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_TAC[IN]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 vl`); + (EXPAND_TAC "vl"); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (MATCH_MP_TAC (REAL_ARITH `(?s. s < b /\ a <= s) ==> a < b`)); + (EXISTS_TAC `hl (vl:(real^3)list)`); + (STRIP_TAC); + (REWRITE_WITH `vl = truncate_simplex 2 (ul:(real^3)list)`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl"); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Rogers.HL_DECREASE); + (EXISTS_TAC `V:real^3->bool`); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 2`;IN]); + (REWRITE_WITH `vl = truncate_simplex 2 (ul:(real^3)list)`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl"); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `{u0, u1, u2:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.BARV_CIRCUMCENTER_EXISTS); + (EXISTS_TAC `V:real^3->bool`); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `vl:(real^3)list = truncate_simplex 2 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ASM_MESON_TAC[]); + (NEW_GOAL `~(p:real^3 IN B6)`); + (ASM_SET_TAC[IN_DIFF]); + (UP_ASM_TAC THEN EXPAND_TAC "B6"); + (REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`;HD;TL]); + (STRIP_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[ASSUME `N = r % M:real^3`; ASSUME `r = &1`]); + (VECTOR_ARITH_TAC); + + + + (NEW_GOAL `norm (M:real^3) <= norm (s2 - s:real^3)`); + (REWRITE_WITH `norm (s2 - s:real^3) = norm (projection (s2 - m1) (s - m1))`); + (REWRITE_WITH `norm (s2 - s:real^3) = norm (s - s2)`); + (NORM_ARITH_TAC); + (AP_TERM_TAC); + (ASM_MESON_TAC[]); + (REWRITE_TAC[ASSUME + `h <= &1 /\ &0 <= h /\ M = h % projection (s2 - m1) (s - m1:real^3)`]); + (REWRITE_TAC[NORM_MUL;REAL_ARITH `a * b <= b <=> &0 <= b * (&1 - a)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `&0 <= a - b <=> b <= a`]); + (REWRITE_WITH `abs h = h`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `norm (s2 - s:real^3) < norm (N:real^3) `); + (REWRITE_WITH `norm (s2 - s:real^3) < norm (N:real^3) <=> + norm (s2 - s) pow 2 < norm (N:real^3) pow 2`); + (MATCH_MP_TAC Pack1.bp_bdt); + (REWRITE_TAC[NORM_POS_LE]); + (REWRITE_WITH `norm (N:real^3) = norm ((p' + m) - p:real^3)`); + + (REWRITE_TAC[GSYM (ASSUME `projection (s2 - m) (p - m) = N:real^3`)]); + (REWRITE_TAC[projection_proj_point]); + (REWRITE_TAC[ASSUME `proj_point (s2 - m) (p - m) = p':real^3`]); + (NORM_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `norm (s2 - s:real^3) < norm (M:real^3)`); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + (SET_TAC[]); + +(* ======================================================================= *) + (NEW_GOAL `!y. y <= 4 /\ p IN mcell y V ul ==> y = 0`); + (REPEAT STRIP_TAC); + (NEW_GOAL `~(y = 4 \/ y = 1 \/ y = 2 \/ y = 3)`); + (ASM_SIMP_TAC[]); + (ASM_ARITH_TAC); + (NEW_GOAL `i = 0`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SIMP_TAC[]); + (REWRITE_TAC[ASSUME `i = 0`]); + (ASM_REWRITE_TAC[]); + +(* ====================================================================== *) + + (NEW_GOAL `dist (u0, p:real^3) < sqrt (&2)`); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (ASM_CASES_TAC `~(p IN rcone_gt (HD (ul:(real^3)list)) (HD (TL ul)) + (hl (truncate_simplex 1 ul) / sqrt (&2))) `); + (NEW_GOAL `!y. y <= 4 /\ p IN mcell y V ul ==> + ~ (y = 4 \/ y = 0 \/ y = 2 \/ y = 3)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `mcell 4 V ul = {}`); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`;mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REFL_TAC); + (UNDISCH_TAC `p IN mcell y V ul` THEN REWRITE_TAC[ASSUME `y = 4`]); + (REWRITE_TAC[ASSUME `mcell 4 V ul = {}`]); + (SET_TAC[]); + (UNDISCH_TAC `p IN mcell y V ul` THEN REWRITE_TAC[ASSUME `y = 0`; + MCELL_EXPLICIT;mcell0]); + (STRIP_TAC); + (NEW_GOAL `~(p:real^3 IN ball (HD ul,sqrt (&2)))`); + (ASM_SET_TAC[IN_DIFF]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[HD;IN;ball;IN_ELIM_THM]); + + (UNDISCH_TAC `p IN mcell y V ul` THEN REWRITE_TAC[ASSUME `y = 2`; + MCELL_EXPLICIT;mcell2]); + (COND_CASES_TAC); + (LET_TAC); + (REWRITE_TAC[IN_INTER]); + (REPEAT STRIP_TAC); + (NEW_GOAL `p:real^3 IN rcone_gt (HD ul) (HD (TL ul)) a`); + (REWRITE_TAC[RCONE_GT_GE;IN_DIFF]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[HD;TL;IN;IN_ELIM_THM]); + (STRIP_TAC); + (NEW_GOAL `~(p:real^3 IN B3)`); + (ASM_SET_TAC[IN_DIFF]); + (UP_ASM_TAC THEN EXPAND_TAC "B3" THEN REWRITE_TAC[rcone_eq;rconesgn]); + (ASM_REWRITE_TAC[HD;TL;IN;IN_ELIM_THM;dist]); + (ASM_MESON_TAC[]); + (SET_TAC[]); + +(* ======================================================================= *) + + (UNDISCH_TAC `p IN mcell y V ul` THEN REWRITE_TAC[ASSUME `y = 3`; + MCELL_EXPLICIT;mcell3]); + (COND_CASES_TAC); + + (NEW_GOAL `(?s. between s (omega_list_n V ul 2,omega_list_n V ul 3) /\ + dist (u0,s) = sqrt (&2) /\ + mxi V ul = s:real^3)`); + (MATCH_MP_TAC MXI_EXPLICIT_OLD); + (ASM_REWRITE_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2;set_of_list]); + (REWRITE_TAC[SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (STRIP_TAC); + + (SUBGOAL_THEN `p:real^3 IN rogers V ul` MP_TAC); + (ASM_SET_TAC[IN_DIFF]); + (ASM_SIMP_TAC[ROGERS_EXPLICIT; HD]); + (ABBREV_TAC `s1 = omega_list_n V [u0; u1; u2; u3:real^3] 1`); + (ABBREV_TAC `s2 = omega_list_n V [u0; u1; u2; u3:real^3] 2`); + (ABBREV_TAC `s3 = omega_list_n V [u0; u1; u2; u3:real^3] 3`); + (STRIP_TAC); + + (ABBREV_TAC `vl = [u0;u1;u2:real^3]`); + (NEW_GOAL `vl = truncate_simplex 2 ul:(real^3)list`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2] THEN EXPAND_TAC "vl"); + (NEW_GOAL `barV V 2 vl`); + (ASM_REWRITE_TAC[] THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_MESON_TAC[ARITH_RULE `2 <= 3`]); + (NEW_GOAL `LENGTH (vl:(real^3)list) = 3 /\ CARD {u0,u1,u2:real^3} = 3`); + (REWRITE_WITH `{u0,u1,u2:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (REWRITE_TAC[ARITH_RULE `3 = 2 + 1`]); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `s2:real^3 = omega_list V vl`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "vl" THEN + REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (MESON_TAC[OMEGA_LIST_TRUNCATE_2]); + + (NEW_GOAL `s2 = circumcenter {u0,u1,u2:real^3}`); + (REWRITE_WITH `{u0,u1,u2:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (REWRITE_TAC[ASSUME `s2 = omega_list V vl`]); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `2` THEN REWRITE_TAC[IN]); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `dist (s2,u0:real^3) = hl (truncate_simplex 2 (ul:(real^3)list))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[GSYM (ASSUME `vl:(real^3)list = truncate_simplex 2 ul`)]); + (REWRITE_TAC[ASSUME `s2 = circumcenter {u0, u1, u2:real^3}`]); + (REWRITE_WITH `{u0, u1, u2:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (REWRITE_WITH `u0:real^3 = HD vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[HD]); + (MATCH_MP_TAC Rogers.HL_EQ_DIST0); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `~(s = s2:real^3)`); + (STRIP_TAC); + (NEW_GOAL `dist (u0,s:real^3) < sqrt (&2)`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[ASSUME `s = s2:real^3`]); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `(s2:real^3) IN voronoi_list V vl`); + (SIMP_TAC[ASSUME `s2 = omega_list V vl`]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `(s3:real^3) IN voronoi_list V ul`); + (REWRITE_WITH `s3 = omega_list V ul`); + (EXPAND_TAC "s3" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; OMEGA_LIST]); + (REWRITE_TAC[LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) - 1 = 3`]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `(s3:real^3) IN voronoi_list V vl`); + (MATCH_MP_TAC (SET_RULE `(?s. a IN s /\ s SUBSET A) ==> a IN A`)); + (EXISTS_TAC `voronoi_list V ul`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_TAC[VORONOI_LIST;VORONOI_SET;voronoi_closed;set_of_list; + SUBSET; IN_INTERS]); + (ONCE_REWRITE_TAC[IN]); + (REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (EXISTS_TAC `v:real^3`); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `v IN {u0, u1, u2:real^3}`); + (SET_TAC[]); + + (NEW_GOAL `s IN voronoi_list V vl`); + (NEW_GOAL `convex (voronoi_list V vl)`); + (REWRITE_TAC[Packing3.CONVEX_VORONOI_LIST]); + (UP_ASM_TAC THEN REWRITE_TAC[convex] THEN STRIP_TAC); + (UNDISCH_TAC `between s (s2,s3:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ONCE_REWRITE_TAC[GSYM IN]); + (REWRITE_TAC[ASSUME `s = u % s2 + v % s3:real^3`]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `~ (s IN affine hull {u0,u1,u2:real^3})`); + STRIP_TAC; + + (NEW_GOAL `(s:real^3 - s2) dot (s - s2) = &0`); + (REWRITE_TAC[ASSUME `s2 = circumcenter {u0, u1, u2:real^3}`]); + (REWRITE_WITH `{u0, u1, u2:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[IN_AFFINE_KY_LEMMA1]); + (EXPAND_TAC "vl" THEN ASM_MESON_TAC[set_of_list]); + (UP_ASM_TAC THEN REWRITE_TAC[GSYM NORM_POW_2; Trigonometry2.POW2_EQ_0; + NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `CARD {u0, u1, u2, s:real^3} = 4`); + (ONCE_REWRITE_TAC[SET_RULE `{u0, u1, u2, s} = {s, u0, u1, u2}`]); + (REWRITE_WITH `4 = SUC (CARD {u0,u1,u2:real^3})`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC (MESON[Geomdetail.CARD_CLAUSES_IMP] + `!s a. FINITE s /\ ~(a IN s) ==> CARD (a INSERT s) = SUC (CARD s)`)); + (REWRITE_TAC[Geomdetail.FINITE6]); + (STRIP_TAC); + (NEW_GOAL `s IN affine hull {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN REWRITE_TAC[IN_AFFINE_KY_LEMMA1]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `~affine_dependent {u0, u1, u2, s:real^3}`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {d,a,b,c}`]); + (MATCH_MP_TAC AFFINE_INDEPENDENT_INSERT); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `{u0, u1, u2:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2` THEN ASM_REWRITE_TAC[]); + + (NEW_GOAL `s2 IN convex hull {u0, u1, u2:real^3}`); + (REWRITE_WITH `s2 = omega_list V vl /\ {u0, u1, u2:real^3} = set_of_list vl`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "vl"); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_2;set_of_list]); + (MATCH_MP_TAC Rogers.XNHPWAB2); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[IN]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `s1 = inv (&2) % (u0 + u1:real^3)`); + (ONCE_REWRITE_TAC[GSYM midpoint]); + (EXPAND_TAC "s1"); + + (REWRITE_WITH `omega_list_n V [u0; u1; u2; u3] 1 = + omega_list_n V [u0; u1:real^3] 1`); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_1_NEW2;OMEGA_LIST_TRUNCATE_1]); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_1_NEW2]); + (REWRITE_WITH `omega_list V [u0; u1:real^3] = + circumcenter (set_of_list [u0;u1])`); + (MATCH_MP_TAC XNHPWAB1); + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_TAC[IN] THEN STRIP_TAC); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `2` THEN REWRITE_TAC[ARITH_RULE `1 <= 2`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `!i j. i < j /\ j <= 2 + ==> hl (truncate_simplex i (vl:(real^3)list)) + < hl (truncate_simplex j vl)`); + + (MATCH_MP_TAC XNHPWAB4); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[IN]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `hl (truncate_simplex 1 (vl:(real^3)list)) < hl (truncate_simplex 2 vl)`); + (FIRST_X_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + + (NEW_GOAL `truncate_simplex 2 vl = truncate_simplex 2 ul:(real^3)list`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC (REAL_ARITH `a < hl (truncate_simplex 2 (vl:(real^3)list)) /\ + hl (truncate_simplex 2 vl) < b ==> a < b`)); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[set_of_list;Rogers.CIRCUMCENTER_2]); + + (NEW_GOAL `~(s3 IN affine hull {u0,u1,u2:real^3})`); + (STRIP_TAC); + (NEW_GOAL `(s3 - s2) dot (s3 - s2:real^3) = &0`); + (REWRITE_TAC[ASSUME `s2 = circumcenter {u0, u1, u2:real^3}`]); + (REWRITE_WITH `{u0, u1, u2:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[IN_AFFINE_KY_LEMMA1]); + (EXPAND_TAC "vl" THEN ASM_MESON_TAC[set_of_list]); + (UP_ASM_TAC THEN REWRITE_TAC[GSYM NORM_POW_2; Trigonometry2.POW2_EQ_0; + NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (STRIP_TAC); + (UNDISCH_TAC `between s (s2,s3:real^3)`); + (REWRITE_TAC[ASSUME `s3= s2:real^3`; BETWEEN_REFL_EQ]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `p IN convex hull {u0, u1, s2, s:real^3}`); + (MATCH_MP_TAC CONVEX_HULL_KY_LEMMA_5); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `s3:real^3`); + (REPEAT STRIP_TAC); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (NEW_GOAL `~(p:real^3 IN B4)`); + (ASM_SET_TAC[IN_DIFF]); + (UP_ASM_TAC THEN EXPAND_TAC "B4" THEN REWRITE_TAC[ASSUME + `ul = [u0;u1;u2;u3:real^3]`; HD;TL; + ASSUME `mxi V [u0; u1; u2; u3] = s:real^3`]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[IN_INTER; ASSUME `p IN convex hull {u0, u1, u2, s:real^3}`]); + (UNDISCH_TAC `p IN convex hull {u0, s1, s2, s3:real^3}`); + (REWRITE_TAC[ASSUME `s1 = inv (&2) % (u0 + u1:real^3)`; + CONVEX_HULL_4;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u + v * inv (&2)`); + (EXISTS_TAC `v * inv (&2)`); + (EXISTS_TAC `w:real` THEN EXISTS_TAC `z:real`); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_ADD); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH + `(u + v * inv (&2)) + v * inv (&2) + w + z = u + v + w + z`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME + `p = u % u0 + v % inv (&2) % (u0 + u1) + w % s2 + z % s3:real^3`]); + (VECTOR_ARITH_TAC); + +(* ========================================================================== *) + + (NEW_GOAL `?m n. between p (m,n) /\ between m (u0,u1) /\ between n (s2,s:real^3)`); + (UP_ASM_TAC THEN REWRITE_TAC[CONVEX_HULL_4_IMP_2_2]); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + + (NEW_GOAL `between m (u0, s1:real^3)`); + (ASM_CASES_TAC `between m (u0, s1:real^3)`); + (UP_ASM_TAC THEN MESON_TAC[]); + (NEW_GOAL `between m (s1, u1:real^3)`); + (NEW_GOAL `between m (u0, s1) \/ between m (s1, u1:real^3)`); + (MATCH_MP_TAC BETWEEN_TRANS_3_CASES); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM midpoint;BETWEEN_MIDPOINT]); + (ASM_MESON_TAC[]); + (NEW_GOAL `F`); + (NEW_GOAL `between n (s2,s3:real^3)`); + (ONCE_REWRITE_TAC[BETWEEN_SYM]); + (MATCH_MP_TAC BETWEEN_TRANS); + (EXISTS_TAC `s:real^3`); + (ONCE_REWRITE_TAC[BETWEEN_SYM]); + (ASM_MESON_TAC[]); + + (UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC `between p (m,n:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `p = u % m + v % n:real^3`); + (REWRITE_TAC[ASSUME `m = u' % s1 + v' % u1:real^3`; + ASSUME `n = u'' % s2 + v'' % s3:real^3`]); + (REWRITE_WITH `u1 = &2 % s1 - u0:real^3`); + (REWRITE_TAC[ASSUME `s1 = inv (&2) % (u0 + u1:real^3)`]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ADD_LDISTRIB;VECTOR_MUL_ASSOC]); + (REWRITE_TAC [VECTOR_ARITH + `((u * u') % s1 + (u * v') % (&2 % s1 - u0)) + + (v * u'') % s2 + + (v * v'') % s3 = + (u * (-- v')) % u0 + (u * u' + v' * &2 * u) % s1 + (v * u'') % s2 + (v * v'') % s3`]); + (STRIP_TAC); + (NEW_GOAL `u * --v' = &0`); + (MATCH_MP_TAC AFFINE_DEPENDENT_KY_LEMMA1); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `s1:real^3`); + (EXISTS_TAC `s2:real^3` THEN EXISTS_TAC `s3:real^3`); + (EXISTS_TAC `p:real^3`); + (EXISTS_TAC `u * u' + v' * &2 * u`); + (EXISTS_TAC `v * u''`); + (EXISTS_TAC `v * v''`); + + (NEW_GOAL `~(affine_dependent {u0,s1,s2:real^3})`); + (REWRITE_WITH `{u0,s1,s2:real^3} = {omega_list_n V vl i | i <= 2}`); + (EXPAND_TAC "s1" THEN EXPAND_TAC "s2"); + (REWRITE_WITH `omega_list_n V [u0; u1; u2; u3] 1 = omega_list_n V vl 1`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[OMEGA_LIST_TRUNCATE_1_NEW1; OMEGA_LIST_TRUNCATE_1]); + (REWRITE_WITH `omega_list_n V [u0; u1; u2; u3] 2 = omega_list_n V vl 2`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[OMEGA_LIST_TRUNCATE_2_NEW1; OMEGA_LIST_TRUNCATE_2]); + (REWRITE_WITH `u0 = omega_list_n V vl 0`); + (REWRITE_TAC[OMEGA_LIST_N]); + (EXPAND_TAC "vl" THEN REWRITE_TAC[HD]); + (REWRITE_TAC[OMEGA_LIST_UP_TO_2]); + (MATCH_MP_TAC Rogers.AFFINE_INDEPENDENT_OMEGA_LIST_N); + (ASM_MESON_TAC[]); + +(* ======================================================================== *) + + (NEW_GOAL `~affine_dependent {u0, s1, s2, s3:real^3}`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {d,a,b,c}`]); + (MATCH_MP_TAC AFFINE_INDEPENDENT_INSERT); + STRIP_TAC; + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `~(s3 = s2:real^3)`); + (STRIP_TAC); + (UNDISCH_TAC `between s (s2,s3:real^3)`); + (REWRITE_TAC[ASSUME `s3= s2:real^3`; BETWEEN_REFL_EQ]); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (NEW_GOAL `(s3 IN affine hull {u0,u1,u2:real^3})`); + (UNDISCH_TAC `s2 IN convex hull {u0,u1,u2:real^3}` THEN UP_ASM_TAC THEN + REWRITE_TAC[AFFINE_HULL_3; CONVEX_HULL_3; IN;IN_ELIM_THM; + ASSUME `s1 = inv (&2) % (u0 + u1:real^3)`]); + (REPEAT STRIP_TAC); + + (REWRITE_TAC[ASSUME + `s3 = u''' % u0 + v''' % inv (&2) % (u0 + u1) + w % s2:real^3`; + ASSUME `s2 = u'''' % u0 + v'''' % u1 + w' % u2:real^3`]); + (EXISTS_TAC `u''' + v''' * inv (&2) + w * u''''`); + (EXISTS_TAC `v''' * inv (&2) + w * v''''`); + (EXISTS_TAC `w * w'`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH + `(u''' + v''' * inv (&2) + w * u'''') + + (v''' * inv (&2) + w * v'''') + w * w' = + (u''' + v''') + w * (u'''' + v'''' + w')`]); + (ASM_REWRITE_TAC[REAL_ARITH `(a + b) + c * &1 = a + b + c`]); + (VECTOR_ARITH_TAC); + (ASM_MESON_TAC[]); + + (REPEAT STRIP_TAC); + (ASM_MESON_TAC[]); + + (ONCE_REWRITE_TAC [SET_RULE `{u0, s1, s2, s3} = {s3,u0, s1, s2}`]); + (NEW_GOAL `CARD {u0,s1,s2:real^3} = 3`); + (REWRITE_WITH `{u0,s1,s2:real^3} = {omega_list_n V vl i | i <= 2}`); + (EXPAND_TAC "s1" THEN EXPAND_TAC "s2"); + (REWRITE_WITH `omega_list_n V [u0; u1; u2; u3] 1 = omega_list_n V vl 1`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[OMEGA_LIST_TRUNCATE_1_NEW1; OMEGA_LIST_TRUNCATE_1]); + (REWRITE_WITH `omega_list_n V [u0; u1; u2; u3] 2 = omega_list_n V vl 2`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[OMEGA_LIST_TRUNCATE_2_NEW1; OMEGA_LIST_TRUNCATE_2]); + (REWRITE_WITH `u0 = omega_list_n V vl 0`); + (REWRITE_TAC[OMEGA_LIST_N]); + (EXPAND_TAC "vl" THEN REWRITE_TAC[HD]); + (REWRITE_TAC[OMEGA_LIST_UP_TO_2]); + (REWRITE_WITH `{omega_list_n V vl i | i <= 2} = IMAGE (omega_list_n V vl) {i | i <= 2}`); + (REWRITE_TAC[IMAGE]); + (SET_TAC[]); + (REWRITE_TAC[NUMSEG_LE]); + (REWRITE_WITH `IMAGE (omega_list_n V vl) (0..2) = {omega_list_n V vl i | i IN (0..2)}`); + (REWRITE_TAC[IMAGE]); + (SET_TAC[]); + (NEW_GOAL `aff_dim {omega_list_n V vl j | j IN 0..2} = &2`); + (MATCH_MP_TAC XNHPWAB3); + (ASM_MESON_TAC[IN]); + (NEW_GOAL `aff_dim {omega_list_n V vl i | i IN 0..2} <= + &(CARD {omega_list_n V vl i | i IN 0..2}) - &1`); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_WITH `{omega_list_n V vl i | i IN (0..2)} = IMAGE (omega_list_n V vl) (0..2)`); + (REWRITE_TAC[IMAGE]); + (SET_TAC[]); + (REWRITE_TAC[GSYM NUMSEG_LE]); + (REWRITE_WITH `IMAGE (omega_list_n V vl) {i | i <= 2} = {omega_list_n V vl i | i <= 2}`); + (REWRITE_TAC[IMAGE]); + (SET_TAC[]); + (REWRITE_TAC[OMEGA_LIST_UP_TO_2;Geomdetail.FINITE6]); + (UP_ASM_TAC THEN REWRITE_TAC[ARITH_RULE `a:int <= b - &1 <=> a + &1 <= b`]); + (REWRITE_TAC[ASSUME `aff_dim {omega_list_n V vl j | j IN 0..2} = &2`; + ARITH_RULE `&2 + &1 = &3:int`; INT_OF_NUM_LE]); + (STRIP_TAC); + (NEW_GOAL `CARD {omega_list_n V vl i | i IN 0..2} <= 3`); + (REWRITE_WITH `{omega_list_n V vl i | i IN (0..2)} = IMAGE (omega_list_n V vl) (0..2)`); + (REWRITE_TAC[IMAGE]); + (SET_TAC[]); + (REWRITE_TAC[GSYM NUMSEG_LE]); + (REWRITE_WITH `IMAGE (omega_list_n V vl) {i | i <= 2} = {omega_list_n V vl i | i <= 2}`); + (REWRITE_TAC[IMAGE]); + (SET_TAC[]); + (REWRITE_TAC[OMEGA_LIST_UP_TO_2; Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (REWRITE_WITH `4 = SUC (CARD {u0, s1, s2:real^3})`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC (MESON[Geomdetail.CARD_CLAUSES_IMP] + `!a s. FINITE s /\ ~(a IN s) ==> CARD (a INSERT s) = SUC (CARD s)`)); + (REWRITE_TAC[Geomdetail.FINITE6]); + (STRIP_TAC); + + (NEW_GOAL `~(s3 IN affine hull {u0,s1,s2:real^3})`); + (STRIP_TAC); + (NEW_GOAL `(s3 IN affine hull {u0,u1,u2:real^3})`); + (UNDISCH_TAC `s2 IN convex hull {u0,u1,u2:real^3}` THEN UP_ASM_TAC THEN + REWRITE_TAC[AFFINE_HULL_3; CONVEX_HULL_3; IN;IN_ELIM_THM; + ASSUME `s1 = inv (&2) % (u0 + u1:real^3)`]); + (REPEAT STRIP_TAC); + + (REWRITE_TAC[ASSUME + `s3 = u''' % u0 + v''' % inv (&2) % (u0 + u1) + w % s2:real^3`; + ASSUME `s2 = u'''' % u0 + v'''' % u1 + w' % u2:real^3`]); + (EXISTS_TAC `u''' + v''' * inv (&2) + w * u''''`); + (EXISTS_TAC `v''' * inv (&2) + w * v''''`); + (EXISTS_TAC `w * w'`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH + `(u''' + v''' * inv (&2) + w * u'''') + + (v''' * inv (&2) + w * v'''') + w * w' = + (u''' + v''') + w * (u'''' + v'''' + w')`]); + (ASM_REWRITE_TAC[REAL_ARITH `(a + b) + c * &1 = a + b + c`]); + (VECTOR_ARITH_TAC); + (ASM_MESON_TAC[]); + (NEW_GOAL `s3 IN affine hull {u0, s1, s2:real^3}`); + (UNDISCH_TAC `s3 IN {u0, s1, s2:real^3}` THEN + REWRITE_TAC [IN_AFFINE_KY_LEMMA1]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[REAL_ARITH + `u * --v' + (u * u' + v' * &2 * u) + v * u'' + v * v'' + = u * (u' + v') + v * (u'' + v'')`]); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `a * (-- b) <= &0 <=> &0 <= a * b`]); + (ASM_SIMP_TAC[REAL_LE_MUL]); + (NEW_GOAL `p IN affine hull {s1, s2, s3:real^3}`); + (REWRITE_TAC[AFFINE_HULL_3;IN;IN_ELIM_THM]); + (EXISTS_TAC `u * u' + v' * &2 * u`); + (EXISTS_TAC `v * u''`); + (EXISTS_TAC `v * v''`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `(u * u' + v' * &2 * u) + v * u'' + v * v'' = + (u * (u' + v') + v * (u'' + v'')) - (u * -- v')`]); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (NEW_GOAL `~(p:real^3 IN B7)`); + (ASM_SET_TAC[IN_DIFF]); + (UP_ASM_TAC THEN EXPAND_TAC "B7"); + (UP_ASM_TAC THEN EXPAND_TAC "s1" THEN EXPAND_TAC "s2" THEN EXPAND_TAC "s3"); + (REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) + + (NEW_GOAL `?q. between p (u0,q) /\ between q (n,s1:real^3)`); + (UNDISCH_TAC `between p (m,n:real^3)` THEN UP_ASM_TAC); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;IN;IN_ELIM_THM; CONVEX_HULL_2]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `((u' * v) / (u' * v + v')) % s1 + + (v' / (u' * v + v')) % n:real^3`); + (NEW_GOAL `~((u' * v + v') = &0)`); + (STRIP_TAC); + (NEW_GOAL `p = u0:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `u' * v = &0 /\ v' = &0`); + (NEW_GOAL `&0 <= u' * v /\ &0 <= v'`); + (ASM_SIMP_TAC [REAL_LE_MUL]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `u' * u = &1`); + (NEW_GOAL `u' * u + (u' * v + v') = &1`); + (REWRITE_TAC[REAL_ARITH `u' * u + (u' * v + v') = u' * (u + v) + v'`]); + (ASM_MESON_TAC[REAL_MUL_RID]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_ADD_LDISTRIB;VECTOR_MUL_ASSOC]); + (ONCE_REWRITE_TAC[REAL_ARITH `a * b * c = (a * b) * c`]); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `~(p:real^3 IN B6)`); + (ASM_SET_TAC[IN_DIFF]); + (UP_ASM_TAC THEN EXPAND_TAC "B6" THEN REWRITE_TAC[ + ASSUME `ul = [u0;u1;u2;u3:real^3]`; HD; TL]); + (REWRITE_TAC[ASSUME `p = u0:real^3`; AFFINE_HULL_3;IN;IN_ELIM_THM]); + (EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0`); + (STRIP_TAC); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (STRIP_TAC); + (EXISTS_TAC `u' * u`); + (EXISTS_TAC `u' * v + v'`); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[REAL_LE_MUL]); + (ASM_SIMP_TAC[REAL_LE_ADD;REAL_LE_MUL]); + (ASM_REWRITE_TAC[REAL_ARITH `u' * u + u' * v + v' = u' * (u + v) + v'`; + REAL_MUL_RID]); + (REWRITE_TAC[ASSUME `p = u' % m + v' % n:real^3`; + ASSUME `m = u % u0 + v % s1:real^3`;VECTOR_ADD_LDISTRIB;VECTOR_MUL_ASSOC]); + + (REWRITE_TAC[VECTOR_ARITH `((u' * v + v') * (u' * v) / (u' * v + v')) % s1 = + ((u' * v + v') / (u' * v + v')) % ((u' * v) % s1)`]); + (REWRITE_TAC[VECTOR_ARITH `((u' * v + v') * v' / (u' * v + v')) % n = + ((u' * v + v') / (u' * v + v')) % (v' % n)`]); + (REWRITE_TAC[VECTOR_ARITH `(x + a % y) + b % z = x + m % a % y + m % b % z + <=> (m - &1) % (a % y + b % z )= vec 0`]); + + (REWRITE_WITH `(u' * v + v') / (u' * v + v') = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + + (EXISTS_TAC `v' / (u' * v + v')`); + (EXISTS_TAC `(u' * v) / (u' * v + v')`); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[REAL_LE_DIV;REAL_LE_ADD;REAL_LE_MUL]); + (ASM_SIMP_TAC[REAL_LE_DIV;REAL_LE_ADD;REAL_LE_MUL]); + (REWRITE_TAC[REAL_ARITH `a / x + b / x = (b + a) / x`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + + +(* ========================================================================= *) + + (UNDISCH_TAC `~(p:real^3 IN + rcone_gt (HD ul) (HD (TL ul)) + (hl (truncate_simplex 1 ul) / sqrt (&2)))`); + (ASM_REWRITE_TAC[HD;TL]); + (REWRITE_WITH `hl (truncate_simplex 1 [u0; u1; u2; u3:real^3]) = dist (s1, u0)`); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_WITH `dist (s1,u0) = dist (circumcenter (set_of_list [u0;u1:real^3]), HD [u0;u1:real^3])`); + (REWRITE_TAC[HD; set_of_list; Rogers.CIRCUMCENTER_2]); + (ASM_REWRITE_TAC[midpoint]); + (MATCH_MP_TAC Rogers.HL_EQ_DIST0); + (EXISTS_TAC `V:real^3->bool`); + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 2`]); + + + (NEW_GOAL `q:real^3 IN rcone_ge u0 u1 (dist (s1,u0) / sqrt (&2))`); + (REWRITE_TAC[rcone_ge; rconesgn;IN;IN_ELIM_THM]); + (REWRITE_WITH `(q - u0) dot (u1 - u0) = + (q - s1) dot (u1 - u0) + (s1 - u0) dot (u1 - u0:real^3)`); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `(q - s1) dot (u1 - u0:real^3) = &0`); + (REWRITE_WITH `u1 - u0 = (-- &2) % (u0:real^3 - s1)`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_RMUL]); + (REWRITE_WITH `(q - s1) dot (u0 - s1:real^3) = &0`); + (REWRITE_WITH `s1 = circumcenter (set_of_list [u0;u1:real^3])`); + (ASM_REWRITE_TAC[set_of_list; Rogers.CIRCUMCENTER_2; midpoint]); + (MATCH_MP_TAC MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 2`]); + + (MATCH_MP_TAC IN_AFFINE_KY_LEMMA1); + (NEW_GOAL `n IN voronoi_list V [u0; u1:real^3]`); + (NEW_GOAL `s2 IN voronoi_list V [u0; u1:real^3]`); + + (NEW_GOAL `(s2:real^3) IN voronoi_list V vl`); + (SIMP_TAC[ASSUME `s2 = omega_list V vl`]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC (SET_RULE `(?s. a IN s /\ s SUBSET A) ==> a IN A`)); + (EXISTS_TAC `voronoi_list V vl`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl"); + (REWRITE_TAC[VORONOI_LIST;VORONOI_SET;voronoi_closed;set_of_list; + SUBSET; IN_INTERS]); + (ONCE_REWRITE_TAC[IN]); + (REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (EXISTS_TAC `v:real^3`); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `v IN {u0, u1:real^3}`); + (SET_TAC[]); + + (NEW_GOAL `s3 IN voronoi_list V [u0; u1]`); + (MATCH_MP_TAC (SET_RULE `(?s. a IN s /\ s SUBSET A) ==> a IN A`)); + (EXISTS_TAC `voronoi_list V vl`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl"); + (REWRITE_TAC[VORONOI_LIST;VORONOI_SET;voronoi_closed;set_of_list; + SUBSET; IN_INTERS]); + (ONCE_REWRITE_TAC[IN]); + (REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (EXISTS_TAC `v:real^3`); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `v IN {u0, u1:real^3}`); + (SET_TAC[]); + + (NEW_GOAL `convex (voronoi_list V [u0;u1:real^3])`); + (REWRITE_TAC[Packing3.CONVEX_VORONOI_LIST]); + (UP_ASM_TAC THEN REWRITE_TAC[convex] THEN STRIP_TAC); + (SUBGOAL_THEN `between n (s2,s3:real^3)` MP_TAC); + (ONCE_REWRITE_TAC[BETWEEN_SYM]); + (MATCH_MP_TAC BETWEEN_TRANS); + (EXISTS_TAC `s:real^3`); + (ONCE_REWRITE_TAC[BETWEEN_SYM]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC THEN ONCE_REWRITE_TAC[GSYM IN]); + (REWRITE_TAC[ASSUME `n = u % s2 + v % s3:real^3`]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (UNDISCH_TAC `between q (n,s1:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC THEN ONCE_REWRITE_TAC[GSYM IN]); + (REWRITE_TAC[ASSUME `q = u % n + v % s1:real^3`]); + (NEW_GOAL `convex (voronoi_list V [u0;u1:real^3])`); + (REWRITE_TAC[Packing3.CONVEX_VORONOI_LIST]); + (UP_ASM_TAC THEN REWRITE_TAC[convex] THEN STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `s1 = inv (&2) % (u0 + u1:real^3)`)]); + (REWRITE_WITH `s1 = omega_list V [u0;u1:real^3]`); + (EXPAND_TAC "s1"); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_1]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `1`); + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + (MATCH_MP_TAC IN_AFFINE_KY_LEMMA1); + (REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (REAL_ARITH_TAC); + + (REWRITE_WITH `(s1 - u0) dot (u1 - u0:real^3) = dist (s1,u0) * dist (u1,u0)`); + (REWRITE_TAC[dist]); + (REWRITE_TAC [NORM_CAUCHY_SCHWARZ_EQ]); + (REWRITE_TAC[ASSUME `s1 = inv (&2) % (u0 + u1:real^3)`; + VECTOR_ARITH `inv (&2) % (u0 + u1) - u0 = inv (&2) % (u1 - u0)`]); + (REWRITE_TAC[NORM_MUL; VECTOR_MUL_ASSOC; REAL_ABS_MUL]); + (REWRITE_WITH `abs (inv (&2)) = inv (&2)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[REAL_ADD_LID; REAL_ARITH `a * b >= x * b * a / t <=> + &0 <= a * b * (&1 - x / t)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (REWRITE_TAC[DIST_POS_LE]); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (REWRITE_WITH `dist (q,u0:real^3) / sqrt (&2) <= &1 + <=> dist (q,u0) <= &1 * sqrt (&2) `); + (MATCH_MP_TAC REAL_LE_LDIV_EQ); + (MATCH_MP_TAC SQRT_POS_LT THEN REAL_ARITH_TAC); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ONCE_REWRITE_TAC[REAL_MUL_LID]); + + (NEW_GOAL `dist (u0,s1:real^3) = hl (truncate_simplex 1 [u0;u1:real^3])`); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_WITH `s1 = omega_list V [u0;u1:real^3]`); + (EXPAND_TAC "s1"); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_1]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_WITH ` dist (omega_list V [u0; u1],u0) = + dist (omega_list V [u0; u1],HD [u0;u1:real^3])`); + (REWRITE_TAC[HD]); + (MATCH_MP_TAC Rogers.WAUFCHE2); + (EXISTS_TAC `1`); + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 vl`); + (EXPAND_TAC "vl"); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[IN]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 2`]); + + (NEW_GOAL `hl (truncate_simplex 1 vl) <= hl (vl:(real^3)list)`); + (MATCH_MP_TAC Rogers.HL_DECREASE); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (ASM_REWRITE_TAC[IN; ARITH_RULE `1 <= 2`]); + (NEW_GOAL `hl (vl:(real^3)list) < sqrt (&2)`); + (ONCE_ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + + (NEW_GOAL `hl (truncate_simplex 1 [u0;u1:real^3]) <= hl (vl:(real^3)list)`); + (REWRITE_WITH `truncate_simplex 1 [u0;u1:real^3] = + truncate_simplex 1 vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (MATCH_MP_TAC Rogers.HL_DECREASE); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (ASM_REWRITE_TAC[IN; ARITH_RULE `1 <= 2`]); + (NEW_GOAL `hl (vl:(real^3)list) < sqrt (&2)`); + (ONCE_ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `dist (u0,s1:real^3) < sqrt (&2)`); + (ONCE_ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `?y. y IN {n,s1:real^3} /\ + (!x. x IN convex hull {n,s1} ==> norm (x - u0) <= norm (y - u0))`); + (MATCH_MP_TAC SIMPLEX_FURTHEST_LE); + (REWRITE_TAC[Geomdetail.FINITE6]); + (SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC [SET_RULE `a IN {x,y} <=> a = x \/ a = y`] + THEN REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,q) <= dist (u0, n:real^3)`); + (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC + [dist; GSYM (ASSUME `y' = n:real^3`)]); + (POP_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `dist (u0,n:real^3) <= sqrt (&2)`); + (NEW_GOAL `?y. y IN {s2,s:real^3} /\ + (!x. x IN convex hull {s2,s} ==> norm (x - u0) <= norm (y - u0))`); + (MATCH_MP_TAC SIMPLEX_FURTHEST_LE); + (REWRITE_TAC[Geomdetail.FINITE6]); + (SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC [SET_RULE `a IN {x,y} <=> a = x \/ a = y`] + THEN REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0,n) <= dist (u0, s2:real^3)`); + (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC + [dist; GSYM (ASSUME `y'' = s2:real^3`)]); + (POP_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `dist (u0,s2:real^3) < sqrt (&2)`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ONCE_ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `dist (u0,n) <= dist (u0, s:real^3)`); + (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC + [dist; GSYM (ASSUME `y'' = s:real^3`)]); + (POP_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL]); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `dist (u0,q) <= dist (u0, s1:real^3)`); + (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC + [dist; GSYM (ASSUME `y' = s1:real^3`)]); + (POP_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL]); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + +(* ========================================================================== *) + + (NEW_GOAL `p:real^3 IN rcone_ge u0 u1 (dist (s1,u0) / sqrt (&2))`); + (UNDISCH_TAC `between p (u0,q:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ONCE_REWRITE_TAC[GSYM IN]); + (REWRITE_TAC[ASSUME `p = u % u0 + v % q:real^3`]); + (REWRITE_WITH `u % u0 + v % q = u0 + v % (q - u0:real^3)`); + (REWRITE_TAC[VECTOR_ARITH `u % u0 + v % q = u0 + v % (q - u0) <=> + ((u + v) - &1) % u0 = vec 0`]); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (MATCH_MP_TAC RCONE_GE_TRANS); + (REWRITE_TAC[VECTOR_ARITH `u0 + q - u0:real^3 = q`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[RCONE_GT_GE; IN_DIFF]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[IN;IN_ELIM_THM]); + (STRIP_TAC); + (NEW_GOAL `~(p:real^3 IN B3)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "B3" THEN REWRITE_TAC[ASSUME + `ul = [u0;u1;u2;u3:real^3]`; HD;TL]); + (REWRITE_WITH `hl (truncate_simplex 1 [u0; u1; u2; u3]) = dist (s1,u0:real^3)`); + (REWRITE_WITH `truncate_simplex 1 [u0; u1; u2; u3] = + truncate_simplex 1 [u0;u1:real^3]`); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_WITH `s1 = omega_list V [u0;u1:real^3]`); + (EXPAND_TAC "s1"); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_1]); + (REWRITE_WITH ` dist (omega_list V [u0; u1],u0) = + dist (omega_list V [u0; u1],HD [u0;u1:real^3])`); + (REWRITE_TAC[HD]); + (MATCH_MP_TAC Rogers.WAUFCHE2); + (EXISTS_TAC `1`); + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 vl`); + (EXPAND_TAC "vl"); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[IN]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 2`]); + + (NEW_GOAL `hl (truncate_simplex 1 vl) <= hl (vl:(real^3)list)`); + (MATCH_MP_TAC Rogers.HL_DECREASE); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (ASM_REWRITE_TAC[IN; ARITH_RULE `1 <= 2`]); + (NEW_GOAL `hl (vl:(real^3)list) < sqrt (&2)`); + (ONCE_ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (REWRITE_TAC[rcone_eq;rconesgn;IN;IN_ELIM_THM]); + (UP_ASM_TAC THEN REWRITE_TAC[dist] THEN MESON_TAC[]); + (SET_TAC[]); + + (NEW_GOAL `!y. y <= 4 /\ p IN mcell y V ul ==> y = 1`); + (GEN_TAC THEN STRIP_TAC); + (NEW_GOAL `~(y = 4 \/ y = 0 \/ y = 2 \/ y = 3)`); + (ASM_SIMP_TAC[]); + (ASM_ARITH_TAC); + (NEW_GOAL `i = 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (GEN_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[MESON[] `~ ~ A <=> A`] THEN DISCH_TAC); + +(* ======================================================================== *) + + + (ASM_CASES_TAC + `p IN aff_ge {u0:real^3, u1} {mxi V ul, omega_list_n V ul 3}`); + + (NEW_GOAL `!y. y <= 4 /\ p IN mcell y V ul ==> + ~ (y = 4 \/ y = 0 \/ y = 1 \/ y = 3)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `mcell 4 V ul = {}`); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`;mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REFL_TAC); + (UNDISCH_TAC `p IN mcell y V ul` THEN REWRITE_TAC[ASSUME `y = 4`]); + (REWRITE_TAC[ASSUME `mcell 4 V ul = {}`]); + (SET_TAC[]); + (UNDISCH_TAC `p IN mcell y V ul` THEN REWRITE_TAC[ASSUME `y = 0`; + MCELL_EXPLICIT;mcell0]); + (STRIP_TAC); + (NEW_GOAL `~(p:real^3 IN ball (HD ul,sqrt (&2)))`); + (ASM_SET_TAC[IN_DIFF]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[HD;IN;ball;IN_ELIM_THM]); + + (UNDISCH_TAC `p IN mcell y V ul` THEN REWRITE_TAC[ASSUME `y = 1`; + MCELL_EXPLICIT;mcell1]); + (COND_CASES_TAC); + (REWRITE_TAC[IN_DIFF]); + (STRIP_TAC); + (ASM_MESON_TAC[]); + (SET_TAC[]); + +(* ======================================================================= *) + + (UNDISCH_TAC `p IN mcell y V ul` THEN REWRITE_TAC[ASSUME `y = 3`; + MCELL_EXPLICIT;mcell3]); + (COND_CASES_TAC); + + (NEW_GOAL `(?s. between s (omega_list_n V ul 2,omega_list_n V ul 3) /\ + dist (u0,s) = sqrt (&2) /\ + mxi V ul = s:real^3)`); + (MATCH_MP_TAC MXI_EXPLICIT_OLD); + (ASM_REWRITE_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2;set_of_list]); + (REWRITE_TAC[SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (STRIP_TAC); + (ABBREV_TAC `s2 = omega_list_n V [u0; u1; u2; u3:real^3] 2`); + (ABBREV_TAC `s3 = omega_list_n V [u0; u1; u2; u3:real^3] 3`); + (NEW_GOAL `p IN aff_ge {u0, u1} {s, s3:real^3}`); + (ASM_MESON_TAC[]); + (ABBREV_TAC `vl = [u0;u1;u2:real^3]`); + (NEW_GOAL `vl = truncate_simplex 2 ul:(real^3)list`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2] THEN EXPAND_TAC "vl"); + (NEW_GOAL `barV V 2 vl`); + (ASM_REWRITE_TAC[] THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_MESON_TAC[ARITH_RULE `2 <= 3`]); + (NEW_GOAL `LENGTH (vl:(real^3)list) = 3 /\ CARD {u0,u1,u2:real^3} = 3`); + (REWRITE_WITH `{u0,u1,u2:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (REWRITE_TAC[ARITH_RULE `3 = 2 + 1`]); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `s2:real^3 = omega_list V vl`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "vl" THEN + REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (MESON_TAC[OMEGA_LIST_TRUNCATE_2]); + + (NEW_GOAL `s2 = circumcenter {u0,u1,u2:real^3}`); + (REWRITE_WITH `{u0,u1,u2:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (REWRITE_TAC[ASSUME `s2 = omega_list V vl`]); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `2` THEN REWRITE_TAC[IN]); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (NEW_GOAL `dist (s2,u0:real^3) = hl (truncate_simplex 2 (ul:(real^3)list))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[GSYM (ASSUME `vl:(real^3)list = truncate_simplex 2 ul`)]); + (REWRITE_TAC[ASSUME `s2 = circumcenter {u0, u1, u2:real^3}`]); + (REWRITE_WITH `{u0, u1, u2:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (REWRITE_WITH `u0:real^3 = HD vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[HD]); + (MATCH_MP_TAC Rogers.HL_EQ_DIST0); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `~(s = s2:real^3)`); + (STRIP_TAC); + (NEW_GOAL `dist (u0,s:real^3) < sqrt (&2)`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[ASSUME `s = s2:real^3`]); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `(s2:real^3) IN voronoi_list V vl`); + (SIMP_TAC[ASSUME `s2 = omega_list V vl`]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `(s3:real^3) IN voronoi_list V ul`); + (REWRITE_WITH `s3 = omega_list V ul`); + (EXPAND_TAC "s3" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; OMEGA_LIST]); + (REWRITE_TAC[LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) - 1 = 3`]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `(s3:real^3) IN voronoi_list V vl`); + (MATCH_MP_TAC (SET_RULE `(?s. a IN s /\ s SUBSET A) ==> a IN A`)); + (EXISTS_TAC `voronoi_list V ul`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_TAC[VORONOI_LIST;VORONOI_SET;voronoi_closed;set_of_list; + SUBSET; IN_INTERS]); + (ONCE_REWRITE_TAC[IN]); + (REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (EXISTS_TAC `v:real^3`); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `v IN {u0, u1, u2:real^3}`); + (SET_TAC[]); + + (NEW_GOAL `s IN voronoi_list V vl`); + (NEW_GOAL `convex (voronoi_list V vl)`); + (REWRITE_TAC[Packing3.CONVEX_VORONOI_LIST]); + (UP_ASM_TAC THEN REWRITE_TAC[convex] THEN STRIP_TAC); + (UNDISCH_TAC `between s (s2,s3:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ONCE_REWRITE_TAC[GSYM IN]); + (REWRITE_TAC[ASSUME `s = u % s2 + v % s3:real^3`]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `~ (s IN affine hull {u0,u1,u2:real^3})`); + STRIP_TAC; + (NEW_GOAL `(s:real^3 - s2) dot (s - s2) = &0`); + (REWRITE_TAC[ASSUME `s2 = circumcenter {u0, u1, u2:real^3}`]); + (REWRITE_WITH `{u0, u1, u2:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[IN_AFFINE_KY_LEMMA1]); + (EXPAND_TAC "vl" THEN ASM_MESON_TAC[set_of_list]); + (UP_ASM_TAC THEN REWRITE_TAC[GSYM NORM_POW_2; Trigonometry2.POW2_EQ_0; + NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `~affine_dependent {u0, u1, u2, s:real^3}`); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {d,a,b,c}`]); + (MATCH_MP_TAC AFFINE_INDEPENDENT_INSERT); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `{u0, u1, u2:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2` THEN ASM_REWRITE_TAC[]); + + (NEW_GOAL `s2 IN convex hull {u0, u1, u2:real^3}`); + (REWRITE_WITH `s2 = omega_list V vl /\ {u0, u1, u2:real^3} = set_of_list vl`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "vl"); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_2;set_of_list]); + (MATCH_MP_TAC Rogers.XNHPWAB2); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[IN]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `~ (s3 IN affine hull {u0,u1,u2:real^3})`); + STRIP_TAC; + (NEW_GOAL `(s3:real^3 - s2) dot (s3 - s2) = &0`); + (REWRITE_TAC[ASSUME `s2 = circumcenter {u0, u1, u2:real^3}`]); + (REWRITE_WITH `{u0, u1, u2:real^3} = set_of_list vl`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[IN_AFFINE_KY_LEMMA1]); + (EXPAND_TAC "vl" THEN ASM_MESON_TAC[set_of_list]); + (UP_ASM_TAC THEN REWRITE_TAC[GSYM NORM_POW_2; Trigonometry2.POW2_EQ_0; + NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `between s (s2,s3:real^3)`); + (REWRITE_TAC[ASSUME `s3 = s2:real^3`]); + (REWRITE_TAC[BETWEEN_REFL_EQ]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `DISJOINT {u0,u1} {s, s3:real^3}`); + (REWRITE_TAC[DISJOINT]); + (MATCH_MP_TAC (SET_RULE `~ (a IN s) /\ ~ (b IN s) ==> s INTER {a, b} = {}`)); + (REPEAT STRIP_TAC); + (NEW_GOAL `s IN affine hull {u0, u1,u2:real^3}`); + (MATCH_MP_TAC IN_AFFINE_KY_LEMMA1); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (NEW_GOAL `s3 IN affine hull {u0, u1,u2:real^3}`); + (MATCH_MP_TAC IN_AFFINE_KY_LEMMA1); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (UNDISCH_TAC `p IN aff_ge {u0, u1} {s, s3:real^3}`); + (ASM_SIMP_TAC[AFF_GE_2_2]); + (REWRITE_TAC[IN;IN_ELIM_THM]); + (NEW_GOAL `?k1 k2. k1 + k2 = &1 /\ k2 <= &0 /\ k1 % s + k2 % s2 = s3:real^3`); + (UNDISCH_TAC `between s (s2,s3:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `&1 / v` THEN EXISTS_TAC ` -- u / v`); + (NEW_GOAL `~(v = &0)`); + (STRIP_TAC); + (NEW_GOAL `s = s2:real^3`); + (REWRITE_TAC[ASSUME `s = u % s2 + v % s3:real^3`]); + (REWRITE_WITH `v = &0 /\ u = &1`); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (ASM_MESON_TAC[]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&1 / v + --u / v = (&1 - u) / v`]); + (REWRITE_WITH `&1 - u = v`); + (ASM_REAL_ARITH_TAC); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + (REWRITE_TAC[REAL_ARITH `--u / v <= &0 <=> &0 <= u / v`]); + (ASM_SIMP_TAC[REAL_LE_DIV]); + (REWRITE_TAC[ASSUME `s = u % s2 + v % s3:real^3`]); + (REWRITE_TAC[VECTOR_ADD_LDISTRIB;VECTOR_MUL_ASSOC]); + (REWRITE_TAC[VECTOR_ARITH + `((&1 / v * u) % s2 + (&1 / v * v) % s3) + --u / v % s2 = s3 <=> + (v / v - &1) % s3 = vec 0`]); + (REWRITE_WITH `v / v = &1`); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + (VECTOR_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC THEN FIRST_X_ASSUM CHOOSE_TAC); + (REWRITE_WITH `s3 = k1 % s + k2 % s2:real^3`); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `s2 IN convex hull {u0, u1, u2:real^3}`); + (REWRITE_TAC[CONVEX_HULL_3; IN_ELIM_THM; IN]); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `s2 = u % u0 + v % u1 + w % u2:real^3`]); + (REWRITE_TAC [VECTOR_ADD_LDISTRIB;VECTOR_MUL_ASSOC]); + (REWRITE_TAC[VECTOR_ARITH `t1 % u0 + t2 % u1 + t3 % s + (t4 * k1) % s + + ((t4 * k2) * u) % u0 + ((t4 * k2) * v) % u1 + + ((t4 * k2) * w) % u2 = (t4 * k2 * w) % u2 + + (t1 + t4 * k2 * u) % u0 + (t2 + t4 * k2 * v) % u1 + (t3 + t4 * k1) % s`]); + (STRIP_TAC); + (NEW_GOAL `t4 * k2 * w = &0`); + (MATCH_MP_TAC AFFINE_DEPENDENT_KY_LEMMA1); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `s:real^3` THEN EXISTS_TAC `p:real^3`); + (EXISTS_TAC `t1 + t4 * k2 * u`); + (EXISTS_TAC `t2 + t4 * k2 * v`); + (EXISTS_TAC `t3 + t4 * k1`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[] THEN ONCE_REWRITE_TAC[SET_RULE + `{u2, u0, u1, s} = {u0, u1, u2, s}`]); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE + `{u2, u0, u1, s} = {s, u0, u1, u2}`]); + (REWRITE_WITH `4 = SUC (CARD {u0,u1,u2:real^3})`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC (MESON[Geomdetail.CARD_CLAUSES_IMP] + `!s a. FINITE s /\ ~(a IN s) ==> CARD (a INSERT s) = SUC (CARD s)`)); + (REWRITE_TAC[Geomdetail.FINITE6]); + (STRIP_TAC); + (NEW_GOAL `s IN affine hull {u0, u1, u2:real^3}`); + (UP_ASM_TAC THEN REWRITE_TAC[IN_AFFINE_KY_LEMMA1]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `p = + (t4 * k2 * w) % u2 + + (t1 + t4 * k2 * u) % u0 + + (t2 + t4 * k2 * v) % u1 + + (t3 + t4 * k1) % s:real^3`)]); + (ONCE_REWRITE_TAC[SET_RULE + `{u2, u0, u1, s} = {u0, u1, u2,s}`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH + `t4 * k2 * w + (t1 + t4 * k2 * u) + (t2 + t4 * k2 * v) + t3 + t4 * k1 = + t1 + t2 + t3 + t4 * (k1 + k2 * (u + v + w))`]); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (NEW_GOAL `&0 <= -- k2`); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `a * b * c <= &0 <=> &0 <= a * c * (-- b)`]); + (ASM_SIMP_TAC[REAL_LE_MUL]); + (NEW_GOAL `p IN affine hull {u0,u1,s:real^3}`); + (REWRITE_TAC[AFFINE_HULL_3;IN;IN_ELIM_THM]); + (EXISTS_TAC `t1 + t4 * k2 * u`); + (EXISTS_TAC `t2 + t4 * k2 * v`); + (EXISTS_TAC `t3 + t4 * k1`); + (ASM_REWRITE_TAC[VECTOR_MUL_LZERO;VECTOR_ADD_LID]); + (REWRITE_TAC[REAL_ARITH + `(t1 + t4 * k2 * u) + (t2 + t4 * k2 * v) + t3 + t4 * k1 + = (t1 + t2 + t3 + t4 * (k1 + k2 * (u + v + w))) - (t4 * k2 * w)`]); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (REAL_ARITH_TAC); + (NEW_GOAL `~(p:real^3 IN B4)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN EXPAND_TAC "B4" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; HD;TL]); + (REWRITE_WITH `mxi V [u0; u1; u2; u3] = s`); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + + (NEW_GOAL `!y. y <= 4 /\ p IN mcell y V ul ==> y = 2`); + (GEN_TAC THEN STRIP_TAC); + (NEW_GOAL `~(y = 4 \/ y = 0 \/ y = 1 \/ y = 3)`); + (ASM_SIMP_TAC[]); + (ASM_ARITH_TAC); + (NEW_GOAL `i = 2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (GEN_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + +(* ===================================================================== *) + + (NEW_GOAL `!y. y <= 4 /\ p IN mcell y V ul ==> + ~ (y = 4 \/ y = 0 \/ y = 1 \/ y = 2)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `mcell 4 V ul = {}`); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`;mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REFL_TAC); + (UNDISCH_TAC `p IN mcell y V ul` THEN REWRITE_TAC[ASSUME `y = 4`]); + (REWRITE_TAC[ASSUME `mcell 4 V ul = {}`]); + (SET_TAC[]); + + (UNDISCH_TAC `p IN mcell y V ul` THEN REWRITE_TAC[ASSUME `y = 0`; + MCELL_EXPLICIT;mcell0]); + (STRIP_TAC); + (NEW_GOAL `~(p:real^3 IN ball (HD ul,sqrt (&2)))`); + (ASM_SET_TAC[IN_DIFF]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[HD;IN;ball;IN_ELIM_THM]); + + (UNDISCH_TAC `p IN mcell y V ul` THEN REWRITE_TAC[ASSUME `y = 1`; + MCELL_EXPLICIT;mcell1]); + (COND_CASES_TAC); + (REWRITE_TAC[IN_DIFF]); + (STRIP_TAC); + (ASM_MESON_TAC[]); + (SET_TAC[]); + + (UNDISCH_TAC `p IN mcell y V ul` THEN REWRITE_TAC[ASSUME `y = 2`; + MCELL_EXPLICIT;mcell2]); + (COND_CASES_TAC); + (LET_TAC); + (UNDISCH_TAC `~(p IN aff_ge {u0, u1} {mxi V ul, omega_list_n V ul 3})`); + (REWRITE_TAC[IN_INTER; ASSUME `ul = [u0;u1;u2;u3:real^3]`;HD;TL]); + (MESON_TAC[]); + (SET_TAC[]); + + (NEW_GOAL `!y. y <= 4 /\ p IN mcell y V ul ==> y = 3`); + (GEN_TAC THEN STRIP_TAC); + (NEW_GOAL `~(y = 4 \/ y = 0 \/ y = 1 \/ y = 2)`); + (ASM_SIMP_TAC[]); + (ASM_ARITH_TAC); + (NEW_GOAL `i = 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (GEN_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[])]);; + + +end;; + diff --git a/text_formalization/packing/TARJJUW.hl b/text_formalization/packing/TARJJUW.hl new file mode 100644 index 0000000..f8b1fdc --- /dev/null +++ b/text_formalization/packing/TARJJUW.hl @@ -0,0 +1,666 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Lemma: TARJJUW *) +(* Chapter: packing *) +(* Author: Dang Tat Dat *) +(* Date: 2010-02-13 *) +(* ========================================================================== *) + +(* edits by thales: + wrapped in a module. + Moved into the project on August 2, 2010. +*) + +module Tarjjuw = struct + +(* +needs "/home/nyx/flyspeck/working/flyspeck_needs.hl";; + +flyspeck_needs "general/prove_by_refinement.hl";; +flyspeck_needs "general/sphere.hl";; +*) +open Sphere;; +open Prove_by_refinement;; +(*-----------Definition------------------------------------------------------*) +let weakly_saturated = + new_definition + `weakly_saturated (V:real^3 ->bool) (r:real) (r':real) <=> + (!(v:real^3).(&2 <= dist(vec 0,v) ) /\ (dist(vec 0, v) <= r') ==> + (?(u:real^3). (u IN V) /\ (~((vec 0) = u)) /\ (dist(u,v) < r)))`;; + +let half_spaces = + new_definition + `half_spaces (a:real^3) (b:real) = + {x:real^3| (a dot x) <= b}`;; + +(*----------------------------------------------------------------------------*) +let CHANGE_TARJJUW_1 = prove (`!(v:real^3) (r':real) (p:real^3).(&0 < r') /\ (~(p = vec 0)) /\ (v = (r'/(norm p))% p) ==> (r' = norm v)`,REPEAT GEN_TAC THEN STRIP_TAC THEN +SUBGOAL_THEN `norm (v:real^3) = norm (((r':real)/(norm (p:real^3)))%p)` ASSUME_TAC THENL +[REWRITE_TAC [] THEN +ASM_MESON_TAC [];SUBGOAL_THEN `&0 < norm (p:real^3)` ASSUME_TAC THENL +[REWRITE_TAC[] THEN +ASM_REWRITE_TAC [NORM_POS_LT];SUBGOAL_THEN `norm (((r':real)/(norm (p:real^3)))%p) = (abs (r'/norm p))*(norm p)` ASSUME_TAC THENL [REWRITE_TAC[] THEN REWRITE_TAC [NORM_MUL];SUBGOAL_THEN `&0 < ((r':real)/(norm (p:real^3)))` ASSUME_TAC THENL [REWRITE_TAC[] THEN ASM_MESON_TAC [REAL_LT_DIV];SUBGOAL_THEN `abs ((r':real) / norm (p:real^3)) = r'/(norm p)` ASSUME_TAC THENL [REWRITE_TAC[] THEN ASM_REWRITE_TAC [REAL_ABS_REFL] THEN ASM_ARITH_TAC;SUBGOAL_THEN `abs ((r':real) / norm (p:real^3)) * norm p = ((r':real) / norm (p:real^3)) * norm p` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `~(norm (p:real^3) = &0)` ASSUME_TAC THENL [ASM_ARITH_TAC;ASM_MESON_TAC [REAL_DIV_RMUL]]]]]]]]);; + +let CHANGE_TARJJUW_11 = prove (`!(v:real^3) (r':real) (p:real^3). (&0 < r') /\ (~(p = vec 0)) /\ (v = (r'/(norm p))% p) ==> norm (((r')/(norm (p)))%p) = r'`,REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `(r':real) = norm (v:real^3)` ASSUME_TAC THENL +[ASM_MESON_TAC [CHANGE_TARJJUW_1]; +SUBGOAL_THEN `norm (v:real^3) = norm (((r':real)/(norm (p:real^3)))%p)` ASSUME_TAC THENL +[ASM_MESON_TAC[]; +SUBGOAL_THEN `(r':real) = norm (((r':real)/(norm (p:real^3)))%p)` ASSUME_TAC THENL +[ASM_ARITH_TAC;ASM_MESON_TAC [EQ_SYM_EQ]]]]);; + +let CHANGE_TARJJUW_12 = prove (`!(v:real^3) (r':real) (p:real^3). (&0 < r') /\ (~(p = vec 0)) ==> norm (((r')/(norm (p)))%p) = r'`,REPEAT GEN_TAC THEN STRIP_TAC THEN +SUBGOAL_THEN `&0 < norm (p:real^3)` ASSUME_TAC THENL +[REWRITE_TAC[] THEN +ASM_REWRITE_TAC [NORM_POS_LT]; +SUBGOAL_THEN `norm (((r':real)/(norm (p:real^3)))%p) = (abs (r'/norm p))*(norm p)` ASSUME_TAC THENL +[REWRITE_TAC[] THEN +REWRITE_TAC [NORM_MUL]; +SUBGOAL_THEN `&0 < ((r':real)/(norm (p:real^3)))` ASSUME_TAC THENL +[REWRITE_TAC[] THEN +ASM_MESON_TAC [REAL_LT_DIV]; +SUBGOAL_THEN `abs ((r':real) / norm (p:real^3)) = r'/(norm p)` ASSUME_TAC THENL +[REWRITE_TAC[] THEN +ASM_REWRITE_TAC [REAL_ABS_REFL] THEN ASM_ARITH_TAC; +SUBGOAL_THEN `abs ((r':real) / norm (p:real^3)) * norm p = ((r':real) / norm (p:real^3)) * norm p` ASSUME_TAC THENL +[ASM_ARITH_TAC; +SUBGOAL_THEN `~(norm (p:real^3) = &0)` ASSUME_TAC THENL +[ASM_ARITH_TAC; +SUBGOAL_THEN `norm (((r':real)/(norm (p:real^3)))%p) = ((r':real) / norm (p:real^3)) * norm p` ASSUME_TAC THENL +[REWRITE_TAC[] THEN ASM_ARITH_TAC; +ASM_MESON_TAC [REAL_DIV_RMUL]]]]]]]]);; + +(*-------------------------------------------------------------------*) +let CHANGE_TARJJUW_2 = prove (`!(v:real^3) (r':real) (p:real^3).(~(p = vec 0)) /\ (v = (r'/(norm p))% p) ==> +(r'% p = (norm p)%v)`,REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `(norm (p:real^3)) % (v:real^3) =(norm (p:real^3)) % ((r'/(norm p))% p) ` ASSUME_TAC THENL [REWRITE_TAC [] THEN ASM_MESON_TAC [VECTOR_MUL_LCANCEL];SUBGOAL_THEN `(norm (p:real^3)) % (((r':real)/(norm p))% p) = ((norm p) * (r'/norm p))%p` ASSUME_TAC THENL [REWRITE_TAC[] THEN MESON_TAC[VECTOR_MUL_ASSOC];SUBGOAL_THEN `~(norm (p:real^3) = &0)` ASSUME_TAC THENL [REWRITE_TAC[] THEN REWRITE_TAC[NORM_EQ_0] THEN ASM_MESON_TAC[];SUBGOAL_THEN `(norm (p:real^3)) * ((r':real)/norm p) = r'` ASSUME_TAC THENL [REWRITE_TAC[] THEN ASM_MESON_TAC [REAL_DIV_LMUL];SUBGOAL_THEN `((norm (p:real^3)) * ((r':real)/norm p))%p = r' % p` ASSUME_TAC THENL [REWRITE_TAC[] THEN ASM_MESON_TAC[];ASM_MESON_TAC[]]]]]]);; + +(*-------------------------------------------------------------------*) + +let CHANGE_TARJJUW_3 = prove_by_refinement(`!(V:real^3 -> bool)(u:real^3).(packing V) /\ (V SUBSET (:real^3) DIFF ball (vec 0,&2)) /\ (u IN V) ==> &2 <= norm u`, +[ + (REPEAT GEN_TAC THEN REWRITE_TAC [ball; DIFF;SUBSET]); + (STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC)); + (DISCH_TAC); + (DISCH_THEN (LABEL_TAC "F1")); + (REWRITE_TAC [IN] THEN REPEAT STRIP_TAC); + (REMOVE_THEN "F1" (MP_TAC o SPEC `u:real^3`)); + (ASM_REWRITE_TAC [IN;IN_ELIM_THM]); + (STRIP_TAC); + (POP_ASSUM MP_TAC); + (REWRITE_TAC [DIST_0]); + (ARITH_TAC); + +]);; + + + +let CHANGE_TARJJUW_31 = prove_by_refinement( `!(V:real^3 -> bool)(u:real^3).(packing V) /\ (V SUBSET (:real^3) DIFF ball (vec 0,&2)) /\ (u IN V) ==> ~(u = vec 0)`, +[ + (REPEAT GEN_TAC); + (STRIP_TAC); + (SUBGOAL_THEN `&2 <= norm (u:real^3)` ASSUME_TAC); + (ASM_MESON_TAC [CHANGE_TARJJUW_3]); + (MP_TAC (ISPECL [`&0`;`&2`;`norm (u:real^3)`]REAL_LTE_TRANS)); + (ASM_REWRITE_TAC [ARITH_RULE `&0 < &2`]); + (REWRITE_TAC[NORM_POS_LT]); + +]);; + + +let CHANGE_TARJJUW_32 = prove_by_refinement(`!(V:real^3 -> bool)(u:real^3)(v:real^3).(packing V) /\ (vec 0 IN V) /\ (u IN V) /\ (~(vec 0 = u)) ==> &2 <= norm u`, +[ + (REPEAT GEN_TAC THEN REWRITE_TAC [packing;IN] THEN STRIP_TAC THEN REPEAT (POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC "F1") THEN REPEAT STRIP_TAC); + (ASM_CASES_TAC `&2 <= norm (u:real^3)` THENL [ASM_ARITH_TAC;POP_ASSUM MP_TAC THEN REWRITE_TAC [GSYM DIST_0]]); + (STRIP_TAC THEN REMOVE_THEN "F1" (MP_TAC o SPECL [`(vec 0):real^3`;`u:real^3`])); + (ASM_REWRITE_TAC[]); + +]);; +(*------------------------------------------------------------------------*) + +let CHANGE_TARJJUW_4 =prove (`!(u:real^3) (v:real^3) (r:real).dist (u,v) < r ==> (dist (u,v)) pow 2 < r pow 2`,REPEAT GEN_TAC THEN REWRITE_TAC [dist] THEN STRIP_TAC THEN SUBGOAL_THEN `&0 <= norm ((u:real^3) - (v:real^3))` ASSUME_TAC THENL [REWRITE_TAC [NORM_POS_LE];SUBGOAL_THEN `&0 <= r` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `abs (norm ((u:real^3) - (v:real^3))) = norm (u - v)` ASSUME_TAC THENL [REWRITE_TAC [REAL_ABS_NORM];SUBGOAL_THEN `abs (r:real) = r` ASSUME_TAC THENL [ASM_ARITH_TAC;SUBGOAL_THEN `abs (norm ((u:real^3) - (v:real^3))) < abs(r:real)` ASSUME_TAC THENL [ASM_ARITH_TAC;ASM_MESON_TAC [REAL_LT_SQUARE_ABS]]]]]]);; + +(*-------------------------------------------------------------------------*) + +let CHANGE_TARJJUW_5 =prove (`!(V:real^3 -> bool)(g:real^3->real) (r:real) (r':real) (u:real^3) (v:real^3) (p:real^3).(packing V) /\ V SUBSET (:real^3) DIFF ball (vec 0,&2) /\ (&2 <= r) /\ (r <= r') /\ (~(p = vec 0)) /\ ((((g u) * r')/ &2) < norm p) /\ (v = (r'/(norm p))% p) /\ ((u dot p) <= (g u)) /\ (~(vec 0 = u)) /\ (dist (u,v) < r) /\ (u IN V) ==> (norm p < norm p)`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC (ISPECL [`v:real^3`;`r':real`]CHANGE_TARJJUW_1) +THEN DISCH_THEN (MP_TAC o SPEC `p:real^3`) +THEN MP_TAC (ISPECL [`&2`;`r:real`;`r':real`]REAL_LE_TRANS) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC (ISPECL [`&0`;`&2`;`r':real`]REAL_LTE_TRANS) +THEN ASM_REWRITE_TAC[ARITH_RULE `&0 < &2`] +THEN STRIP_TAC +THEN ASM_REWRITE_TAC[] +THEN FIND_ASSUM (fun th -> REWRITE_TAC [GSYM th]) `(v:real^3) = (r':real) / norm p % (p:real^3)` +THEN STRIP_TAC +THEN MP_TAC (ISPECL [`v:real^3`]NORM_POS_LE) +THEN STRIP_TAC +THEN MP_TAC (ISPECL [`((u:real^3) dot (p:real^3))`;`((g:real^3->real)(u:real^3))`;`(norm (v:real^3))`]REAL_LE_RMUL) +THEN FIND_ASSUM (fun th -> REWRITE_TAC [GSYM th]) `((u:real^3) dot (p:real^3)) <= ((g:real^3->real)(u:real^3))` +THEN FIND_ASSUM (fun th -> REWRITE_TAC [GSYM th]) `&0 <= norm (v:real^3)` +THEN STRIP_TAC +THEN MP_TAC (ISPECL [`(((u:real^3) dot (p:real^3)) * (norm (v:real^3)))`;`(((g:real^3->real)(u:real^3)) * norm v)`;`&2`](GSYM REAL_LE_DIV2_EQ)) +THEN REWRITE_TAC [ARITH_RULE `&0 < &2`] +THEN STRIP_TAC +(*Sub 1*) +THEN SUBGOAL_THEN `((u dot p) * norm (v:real^3)) / &2 <= (((g:real^3->real)(u:real^3)) * norm v) / &2` ASSUME_TAC +THENL [ASM_ARITH_TAC;MP_TAC (ISPECL [`((u:real^3) dot (p:real^3))`;`(r':real)`]REAL_MUL_SYM) +THEN STRIP_TAC +THEN MP_TAC (ISPECL [`r':real`;`u:real^3`;`p:real^3`]DOT_RMUL) +THEN STRIP_TAC +THEN MP_TAC (ISPECL [`v:real^3`;`r':real`;`p:real^3`]CHANGE_TARJJUW_2) +THEN FIND_ASSUM (fun th -> REWRITE_TAC [th]) `~(p:real^3 = vec 0)` +THEN FIND_ASSUM (fun th -> REWRITE_TAC [th]) `v:real^3 = (r':real) / norm p % (p:real^3)` +THEN FIND_ASSUM (fun th -> REWRITE_TAC [GSYM th]) `v:real^3 = (r':real) / norm p % (p:real^3)` +THEN STRIP_TAC +THEN +(*Sub 1.1 ]]*) +SUBGOAL_THEN `(u:real^3) dot ((r':real)% (p:real^3)) = u dot ((norm p)%v)` ASSUME_TAC +THENL [ASM_MESON_TAC[];MP_TAC (ISPECL [`(norm (p:real^3))`;`(u:real^3)`;`(v:real^3)`]DOT_RMUL) +THEN STRIP_TAC (*]]);;*) +(*Sub 1.1.1]]]*) +THEN SUBGOAL_THEN `((u:real^3) dot (p:real^3)) * (r':real) = norm p * (u dot (v:real^3))` ASSUME_TAC +THENL [FIND_ASSUM (fun th -> REWRITE_TAC [th]) `((u:real^3) dot (p:real^3)) * (r':real) = r' * (u dot p)` +THEN FIND_ASSUM (fun th -> REWRITE_TAC [GSYM th]) `(u:real^3) dot (r':real) % (p:real^3)= r' * (u dot p)` +THEN FIND_ASSUM (fun th -> REWRITE_TAC [GSYM th]) `(u:real^3) dot (r':real) % (p:real^3)= r' * (u dot p)` +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN MESON_TAC[EQ_TRANS]; +MP_TAC (ISPECL [`(u:real^3)`;`(v:real^3)`]DOT_NORM_NEG) +THEN STRIP_TAC (*]]]);;*) +(*Sub 1.1.1.1 ]]]]*) +THEN SUBGOAL_THEN `((norm (p:real^3)) * ((u:real^3) dot (v:real^3))) = (((norm p) *(((norm u pow 2 + norm v pow 2) - (norm (u - v)) pow 2)) / &2))` ASSUME_TAC +THENL [POP_ASSUM MP_TAC +THEN MESON_TAC[]; +POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM dist] THEN STRIP_TAC +THEN MP_TAC (ISPECL [`V:real^3->bool`;`u:real^3`]CHANGE_TARJJUW_3) +THEN ASM_REWRITE_TAC[] +THEN STRIP_TAC +THEN MP_TAC (ISPECL [`&2`]REAL_ABS_REFL) +THEN REWRITE_TAC [ARITH_RULE `&0 <= &2`] +THEN STRIP_TAC +THEN MP_TAC (ISPECL [`u:real^3`]REAL_ABS_NORM) THEN STRIP_TAC (*]]]]);;*) +THEN +(*Sub 1.1.1.1.1 ]]]]]*) +SUBGOAL_THEN `abs (&2) <= abs (norm (u:real^3))` ASSUME_TAC +THENL [ASM_ARITH_TAC; +MP_TAC (ISPECL [`&2`;`norm (u:real^3)`]REAL_LE_SQUARE_ABS) +THEN POP_ASSUM (fun th -> REWRITE_TAC [th]) +THEN REWRITE_TAC [ARITH_RULE `&2 pow 2 = &4`] +THEN STRIP_TAC +THEN MP_TAC (ISPECL [`u:real^3`;`v:real^3`;`r:real`]CHANGE_TARJJUW_4) +THEN FIND_ASSUM (fun th -> REWRITE_TAC [th]) `dist (u:real^3,v:real^3) < r:real` +THEN STRIP_TAC +THEN MP_TAC (ISPECL [`((r:real) pow 2)`;`dist (u:real^3,v:real^3) pow 2`]REAL_LT_NEG) +THEN FIRST_ASSUM (fun th -> REWRITE_TAC [th]) +THEN STRIP_TAC (*]]]]]);;*) +(*Sub 1.1.1.1.1.1 ]]]]]]*) +THEN SUBGOAL_THEN `(norm (v:real^3)) pow 2 = (r':real) pow 2`ASSUME_TAC +THENL [UNDISCH_TAC `r':real = norm (v:real^3)` +THEN MESON_TAC[]; +(*Sub 1.1.1.1.1.1.2*) +SUBGOAL_THEN `((norm (u:real^3)) pow 2 + (norm (v:real^3)) pow 2) = + (norm (u:real^3)) pow 2 + (r':real) pow 2` ASSUME_TAC +THENL [ASM_ARITH_TAC; +(*Sub 1.1.1.1.1.1.2.2*) +SUBGOAL_THEN `&4 + (norm (v:real^3)) pow 2 <= ((norm (u:real^3)) pow 2 + (norm v) pow 2 )` ASSUME_TAC +THENL [ASM_ARITH_TAC; +(*Sub 1.1.1.1.1.1.2.2.2*) +SUBGOAL_THEN `(((u:real^3) dot (p:real^3)) * (r':real)) / &2 < (norm (p))` ASSUME_TAC +THENL [UNDISCH_TAC `(((u:real^3) dot (p:real^3)) * norm (v:real^3)) / &2 <= ((g:real^3->real) u * norm v) / &2` +THEN FIND_ASSUM (fun th -> REWRITE_TAC [GSYM th]) `r':real = norm (v:real^3)` +THEN UNDISCH_TAC `((g:real^3->real) (u:real^3) * (r':real)) / &2 < norm (p:real^3)` +THEN ARITH_TAC; +(*Sub 1.1.1.1.1.1.2.2.2.2*) +SUBGOAL_THEN `((norm (p:real^3)) * ((u:real^3) dot (v:real^3))) / &2 < (norm (p))`ASSUME_TAC +THENL [ASM_ARITH_TAC; +(*Sub 1.1.1.1.1.1.2.2.2.2*) +SUBGOAL_THEN `&4 + (r':real) pow 2 <= ((norm (u:real^3)) pow 2 + (norm (v:real^3)) pow 2 )` ASSUME_TAC +THENL [ASM_ARITH_TAC; +(*Sub 1.1.1.1.1.1.2.2.2.2*) +SUBGOAL_THEN `&4 + (r':real) pow 2 + --(dist ((u:real^3),(v:real^3)) pow 2) <= ((norm (u)) pow 2 + (norm (v)) pow 2 + --(dist (u,v) pow 2) )` ASSUME_TAC +THENL [ASM_ARITH_TAC; +(*Sub 1.1.1.1.1.1.2.2.2.2*) +SUBGOAL_THEN `&4 + (r':real) pow 2 + --((r:real) pow 2) <= &4 + (r':real) pow 2 + --(dist ((u:real^3),(v:real^3)) pow 2)` ASSUME_TAC +THENL [ASM_ARITH_TAC; +SUBGOAL_THEN `&4 + (r':real) pow 2 + --((r:real) pow 2) <= ((norm (u:real^3)) pow 2 + (norm (v:real^3)) pow 2 + --(dist (u,v) pow 2))` ASSUME_TAC +THENL [ASM_ARITH_TAC; +MP_TAC (ISPECL [`&0`;`&2`;`r:real`]REAL_LE_TRANS) +THEN ASM_REWRITE_TAC[ARITH_RULE `&0 <= &2`] +THEN STRIP_TAC +THEN MP_TAC (ISPECL [`&0`;`r:real`;`r':real`]REAL_LE_TRANS) +THEN FIND_ASSUM (fun th -> REWRITE_TAC [th]) `&0 <= r:real` +THEN FIND_ASSUM (fun th -> REWRITE_TAC [th]) `r:real <= r':real` +THEN STRIP_TAC +THEN MP_TAC (ISPECL [`r':real`]REAL_ABS_REFL) +THEN FIND_ASSUM (fun th -> REWRITE_TAC [GSYM th]) `&0 <= r':real` +THEN STRIP_TAC +THEN MP_TAC (ISPECL [`r:real`]REAL_ABS_REFL) +THEN FIND_ASSUM (fun th -> REWRITE_TAC [GSYM th]) `&0 <= r:real` +THEN STRIP_TAC(*]]]]]]]]]]]]]]);;*) + +THEN SUBGOAL_THEN `abs (r:real) <= abs(r':real)` ASSUME_TAC +THENL [POP_ASSUM (fun th -> REWRITE_TAC[th]) +THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) +THEN ASM_REWRITE_TAC[]; +MP_TAC (ISPECL [`r:real`;`r':real`]REAL_LE_SQUARE_ABS) +THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) +THEN STRIP_TAC +THEN MP_TAC (ISPECL [`r':real`;`r:real`]REAL_SUB_LE) +THEN UNDISCH_TAC `r:real <= r':real` +THEN STRIP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) +THEN STRIP_TAC +THEN MP_TAC (ISPECL [`(r':real) pow 2`;`(r:real) pow 2 `]REAL_SUB_LE) +THEN FIND_ASSUM (fun th -> REWRITE_TAC [th]) `(r:real) pow 2 <= (r':real) pow 2` +THEN STRIP_TAC(*]]]]]]]]]]]]]]]);;*) + +THEN SUBGOAL_THEN `&4 <= &4 + (r':real) pow 2 - (r:real) pow 2` ASSUME_TAC +THENL [MP_TAC (ISPECL [`&4`;`&0`;`(r':real) pow 2 - (r:real) pow 2`]REAL_LE_LADD) +THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) +THEN REWRITE_TAC [ARITH_RULE `&4 + &0 = &4`]; +MP_TAC (ISPECL [`&4 + ((r':real) pow 2)`;`((r:real) pow 2)`]real_sub) +THEN STRIP_TAC(*]]]]]]]]]]]]]]]]);;*) + +THEN SUBGOAL_THEN `&4 + ((r':real) pow 2) - ((r:real) pow 2) <= ((norm (u:real^3)) pow 2 + (norm (v:real^3)) pow 2) + --(dist (u,v) pow 2)` ASSUME_TAC +THENL [ASM_ARITH_TAC;SUBGOAL_THEN `&4 <= ((norm (u:real^3)) pow 2 + (norm (v:real^3)) pow 2) + --(dist (u,v) pow 2)` ASSUME_TAC +THENL [ASM_ARITH_TAC; +MP_TAC (ISPECL [`(((norm (p:real^3)) * ((u:real^3) dot (v:real^3)))/ &2)`;`(norm (p:real^3))`;`&2`]REAL_LT_RMUL) +THEN REWRITE_TAC [ARITH_RULE `&0 < &2`] +THEN FIND_ASSUM (fun th -> REWRITE_TAC [th]) `(norm (p:real^3) * ((u:real^3) dot (v:real^3))) / &2 < norm p` +THEN REWRITE_TAC [ARITH_RULE `(((norm (p:real^3)) * ((u:real^3) dot (v:real^3)))/ &2) * (&2) = ((norm (p:real^3)) * ((u:real^3) dot (v:real^3)))`] +THEN STRIP_TAC(*]]]]]]]]]]]]]]]]]]);;*) + + +THEN SUBGOAL_THEN `(((norm (p:real^3)) * (((norm (u:real^3)) pow 2 + (norm (v:real^3)) pow 2) - dist (u,v) pow 2)) / &2) < (norm p) * (&2) ` ASSUME_TAC +THENL [ASM_ARITH_TAC; +MP_TAC (ISPECL [`((((norm (p:real^3)) * (((norm (u:real^3)) pow 2 + (norm (v:real^3)) pow 2) - dist (u,v) pow 2)) / &2))`;`(norm (p:real^3)) * (&2)`;`&2`]REAL_LT_RMUL) +THEN REWRITE_TAC [ARITH_RULE `&0 < &2`] +THEN FIND_ASSUM (fun th -> REWRITE_TAC [th]) `(norm (p:real^3) * ((norm (u:real^3) pow 2 + norm (v:real^3) pow 2) - dist (u,v) pow 2)) / &2 < norm p * &2` +THEN REWRITE_TAC [ARITH_RULE `((((norm (p:real^3)) * (((norm (u:real^3)) pow 2 + (norm (v:real^3)) pow 2) - dist (u,v) pow 2)) / &2))*(&2) = ((norm (p:real^3)) * (((norm (u:real^3)) pow 2 + (norm (v:real^3)) pow 2) - dist (u,v) pow 2))`] +THEN STRIP_TAC +THEN MP_TAC (ISPECL [`((norm (u:real^3)) pow 2 + (norm (v:real^3)) pow 2)`;`(dist (u:real^3,v:real^3) pow 2)`]real_sub) +THEN STRIP_TAC(*]]]]]]]]]]]]]]]]]]]);;*) + + + +THEN SUBGOAL_THEN `&4 <= ((norm (u:real^3)) pow 2 + (norm (v:real^3)) pow 2) - (dist (u,v) pow 2)` ASSUME_TAC +THENL [ASM_ARITH_TAC; +MP_TAC (ISPECL [`p:real^3`]NORM_POS_LE) THEN STRIP_TAC +THEN MP_TAC (ISPECL [`(norm (p:real^3))`;`&4`;`(((norm (u:real^3)) pow 2 + (norm (v:real^3)) pow 2) - dist (u,v) pow 2)`]REAL_LE_LMUL) +THEN FIND_ASSUM (fun th -> REWRITE_TAC [th]) `&4 <= (norm (u:real^3) pow 2 + norm (v:real^3) pow 2) - dist (u,v) pow 2` +THEN FIND_ASSUM (fun th -> REWRITE_TAC [th]) `&0 <= norm (p:real^3)` +THEN STRIP_TAC(*]]]]]]]]]]]]]]]]]]]]);; *) +THEN MP_TAC (ISPECL [`(norm (p:real^3)) * (&4)`;`norm (p:real^3) * ((norm (u:real^3) pow 2 + norm v pow 2) - dist (u,v) pow 2)`;`(norm (p:real^3) * &2) * &2`]REAL_LET_TRANS) +THEN POP_ASSUM (fun th -> REWRITE_TAC [th]) +THEN FIND_ASSUM (fun th -> REWRITE_TAC [th]) `norm (p:real^3) * ((norm (u:real^3) pow 2 + norm v pow 2) - dist (u,v) pow 2) < + (norm p * &2) * &2` +THEN ARITH_TAC]]]]]]]]]]]]]]]]]]]]);; + + +(*----------------------------------------------------------------*) +let CHANGE_TARJJUW_6 = prove_by_refinement(`!(V:real^3 -> bool)(P:real^3->bool) (g:real^3->real) p:real^3 r r':real. (&2 <= r) /\ (r <= r') /\ (V SUBSET (:real^3) DIFF ball (vec 0,&2)) /\ (FINITE V) /\ packing V /\ (weakly_saturated V r r') /\ + P = INTERS {half_spaces u (g u)| u IN V} /\ (p IN P) ==>(!u:real^3. u IN V ==> p IN half_spaces u (g u))`, + +[ +(REPEAT GEN_TAC ); +(STRIP_TAC); +(REWRITE_TAC [INTERS;IN_ELIM_THM] THEN STRIP_TAC); +(POP_ASSUM MP_TAC); +(ASM_REWRITE_TAC[IN_ELIM_THM]); +(REPEAT STRIP_TAC); +(SUBGOAL_THEN `INTERS {half_spaces u (g u) | u IN V} SUBSET half_spaces (u:real^3) ((g:real^3->real) u)` ASSUME_TAC); +(REWRITE_TAC [SUBSET;IN_INTERS]); +(GEN_TAC); +(DISCH_THEN (LABEL_TAC "F1")); +(REMOVE_THEN "F1" (MP_TAC o SPEC `half_spaces (u:real^3) ((g:real^3 -> real) u)`)); +(STRIP_TAC); +(SUBGOAL_THEN `half_spaces (u:real^3) ((g:real^3 -> real) u) IN {half_spaces u (g u) | u IN (V:real^3->bool)}` ASSUME_TAC); +(REWRITE_TAC [half_spaces]); +(REWRITE_TAC [IN_ELIM_THM]); +(EXISTS_TAC `u:real^3`); +(ASM_REWRITE_TAC[]); +(POP_ASSUM MP_TAC); +(ASM_REWRITE_TAC[]); +(POP_ASSUM MP_TAC); +(REWRITE_TAC [SUBSET]); +(DISCH_THEN (MP_TAC o SPEC `p:real^3`)); +(ASM_REWRITE_TAC[]); + +]);; + + +let CHANGE_TARJJUW_7 = prove_by_refinement( `!(V:real^3 -> bool)(P:real^3->bool) (g:real^3->real) u:real^3 r r':real. (&2 <= r) /\ (r <= r') /\ (V SUBSET (:real^3) DIFF ball (vec 0,&2)) /\ (FINITE V) /\ packing V /\ (weakly_saturated V r r') /\ + P = INTERS {half_spaces u (g u)| u IN V} /\ u IN V ==> (!p:real^3. p IN P ==> (u dot p) <= (g u))`, +[ +(REPEAT GEN_TAC THEN STRIP_TAC); +(GEN_TAC); +(STRIP_TAC); +(SUBGOAL_THEN `(!u:real^3. u IN (V:real^3->bool) ==> p IN half_spaces u ((g:real^3->real) u))` ASSUME_TAC); +(ASM_MESON_TAC[CHANGE_TARJJUW_6]); +(POP_ASSUM MP_TAC); +(REWRITE_TAC [half_spaces;IN_ELIM_THM]); +(DISCH_THEN (MP_TAC o SPEC `u:real^3`)); +(ASM_REWRITE_TAC[]); + +]);; + + +let CHANGE_TARJJUW_71 = prove_by_refinement( `!(V:real^3 -> bool)(P:real^3->bool) (g:real^3->real) r r':real. (&2 <= r) /\ (r <= r') /\ (V SUBSET (:real^3) DIFF ball (vec 0,&2)) /\ (FINITE V) /\ packing V /\ (weakly_saturated V r r') /\ + P = INTERS {half_spaces u (g u)| u IN V} ==> (!p:real^3 u:real^3. p IN P /\ u IN V ==> (u dot p) <= ((g:real^3->real) u))`, +[ +(REPEAT GEN_TAC); +(STRIP_TAC); +(REPEAT GEN_TAC); +(STRIP_TAC); +(SUBGOAL_THEN `!p:real^3. p IN (P:real^3->bool) ==> (u dot p) <= ((g:real^3->real)(u:real^3))` ASSUME_TAC); +(ASM_MESON_TAC [CHANGE_TARJJUW_7]); +(POP_ASSUM (MP_TAC o SPEC `p:real^3`)); +(ASM_REWRITE_TAC[]); +]);; + + +let CHANGE_TARJJUW_8 = prove_by_refinement( `!(g:real^3->real)(r':real)(u:real^3).(&2 <= r) /\ (r <= r') /\ (&0 <= g u) ==> &0 <= ((g u) * r')/ &2`, + +[ + (REPEAT GEN_TAC THEN STRIP_TAC); + (SUBGOAL_THEN `&2 <= (r':real)` ASSUME_TAC); + (ASM_ARITH_TAC); + (SUBGOAL_THEN `&0 <= (r':real)` ASSUME_TAC); + (POP_ASSUM MP_TAC); + (MP_TAC (ARITH_RULE `&0 <= &2`)); + (MESON_TAC[REAL_LE_TRANS]); + (MP_TAC (ISPECL [`(g:real^3->real) (u:real^3)`;`r':real`]REAL_LE_MUL)); + (ASM_REWRITE_TAC[]); +(STRIP_TAC); + (MP_TAC (ISPECL [`(((g:real^3->real) (u:real^3)) * (r':real))`;`(&2)`]REAL_LE_DIV)); + (ASM_REWRITE_TAC[ARITH_RULE `&0 <= &2`]); +]);; + + +let FININTE_GFUN = prove_by_refinement(`!(V:real^3 -> bool)(g:real^3->real) r':real.(FINITE V) /\ ~(V = {}) ==> FINITE {(g(u:real^3)*r')/(&2)|u IN V} /\ ~({(g(u:real^3)*r')/(&2)|u IN V} = {})`, +[ + (REPEAT GEN_TAC); + (SUBGOAL_THEN `IMAGE (\u. ((g:real^3->real)(u:real^3) * (r':real)) / &2) (V:real^3->bool) = {(g u * r') / &2 | u IN V}` ASSUME_TAC); + (REWRITE_TAC [IMAGE;EXTENSION]); + (GEN_TAC); + (EQ_TAC); + (REWRITE_TAC [IN_ELIM_THM]); + (REWRITE_TAC [IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (MP_TAC (ISPECL [`\u. (((g:real^3->real)(u:real^3)) * (r':real)) / (&2)`;`V:real^3->bool`]FINITE_IMAGE)); + (ASM_REWRITE_TAC[]); + (MP_TAC (ISPECL [`\u. (((g:real^3->real)(u:real^3)) * (r':real)) / (&2)`;`V:real^3->bool`]IMAGE_EQ_EMPTY)); + (ASM_REWRITE_TAC[]); + +]);; + + +(*----------------------------------------------------------------------------*) +let CHANGE_TARJJUW_9 = prove_by_refinement(`!(V:real^3 -> bool)(P:real^3->bool) (g:real^3->real) r r':real. (&2 <= r) /\ (r <= r') /\ (V SUBSET (:real^3) DIFF ball (vec 0,&2)) /\ (FINITE V) /\ packing V/\ ~(V = {}) /\ (weakly_saturated V r r') /\ + P = INTERS {half_spaces u (g u)| u IN V} ==> polyhedron P`, +[ +(REPEAT GEN_TAC); +(STRIP_TAC); +(ASM_REWRITE_TAC [polyhedron]); +(EXISTS_TAC `{half_spaces (u:real^3) ((g:real^3->real) u)| u IN (V:real^3->bool)}`); +(REWRITE_TAC[]); +(STRIP_TAC); +(MP_TAC (ISPECL [`\u. half_spaces (u:real^3) ((g:real^3->real) u) `;`V:real^3->bool`]FINITE_IMAGE)); +(ASM_REWRITE_TAC[]); +(SUBGOAL_THEN `IMAGE (\u. half_spaces (u:real^3) ((g:real^3->real)(u))) (V:real^3->bool) = {half_spaces u (g u) | u IN V}` ASSUME_TAC); +(REWRITE_TAC [IMAGE;EXTENSION]); +(STRIP_TAC); +(REWRITE_TAC [IN_ELIM_THM]); +(EQ_TAC); +(STRIP_TAC); +(EXISTS_TAC `x':real^3`); +(ASM_REWRITE_TAC[]); +(REWRITE_TAC [EXTENSION]); +(STRIP_TAC); +(POP_ASSUM (MP_TAC o SPEC `x'':real^3`)); +(ARITH_TAC); +(STRIP_TAC); +(EXISTS_TAC `u:real^3`); +(ASM_REWRITE_TAC []); +(ASM_REWRITE_TAC[]); +(ASM_REWRITE_TAC[half_spaces;IN_ELIM_THM]); +(GEN_TAC THEN STRIP_TAC); +(EXISTS_TAC `u:real^3`); +(EXISTS_TAC `((g:real^3->real)(u:real^3))`); +(MP_TAC (ISPECL [`V:real^3->bool`;`u:real^3`]CHANGE_TARJJUW_31)); +(ASM_REWRITE_TAC[]); + +]);; + +let CHANGE_TARJJUW_10 = prove_by_refinement( `!(V:real^3 -> bool)(P:real^3->bool) (g:real^3->real) r r':real u:real^3. (&2 <= r) /\ (r <= r') /\ (V SUBSET (:real^3) DIFF ball (vec 0,&2)) /\ (FINITE V) /\ packing V/\ ~(V = {}) /\ (weakly_saturated V r r') /\ + P = INTERS {half_spaces u (g u)| u IN V} /\ polyhedron P /\ u IN V ==> +(bounded P)`, +[ +(REPEAT GEN_TAC); +(STRIP_TAC); +(SUBGOAL_THEN `!p:real^3 u:real^3. p IN P /\ u IN V ==> (u dot p) <= ((g:real^3->real) u)` ASSUME_TAC); +(ASM_MESON_TAC[CHANGE_TARJJUW_71]); +(REPEAT (POP_ASSUM MP_TAC)); +(REWRITE_TAC [weakly_saturated;polyhedron;half_spaces] THEN STRIP_TAC); +(DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC THEN DISCH_TAC); +(STRIP_TAC); +(DISCH_THEN (LABEL_TAC "F1")); +(DISCH_TAC); +(DISCH_THEN (LABEL_TAC "F2")); +(DISCH_TAC); +(DISCH_THEN (LABEL_TAC "F3")); +(* +(ASM_CASES_TAC `(V:real^3->bool) = {}`); +(SUBGOAL_THEN `IMAGE (\(u:real^3). {x:real^3 | u dot x <= g u}) (V:real^3->bool) = {{x | u dot x <= g u} | u IN V}` ASSUME_TAC); +(REWRITE_TAC[IMAGE;EXTENSION]); +(GEN_TAC); +(EQ_TAC); +(REWRITE_TAC [IN_ELIM_THM]); +(STRIP_TAC); +(EXISTS_TAC `x':real^3`); +(ASM_REWRITE_TAC[]); +(POP_ASSUM (LABEL_TAC "B1")); +(REWRITE_TAC [EXTENSION]); +(STRIP_TAC); +(REWRITE_TAC[IN_ELIM_THM]); +(REMOVE_THEN "B1" (MP_TAC o SPEC `x'':real^3`)); +(ASM_REWRITE_TAC[]); +(REWRITE_TAC [IN_ELIM_THM]); +(STRIP_TAC); +(EXISTS_TAC `u':real^3`); +(ASM_REWRITE_TAC[]); +(STRIP_TAC); +(REWRITE_TAC [IN_ELIM_THM]); +(MP_TAC (ISPECL [`(\(u:real^3). {x:real^3 | u dot x <= g u})`;`V:real^3->bool`]IMAGE_EQ_EMPTY)); +(FIND_ASSUM (fun th -> REWRITE_TAC [th]) `(V:real^3->bool) = {}`); +(POP_ASSUM MP_TAC); +(ASM_REWRITE_TAC[]); +(DISCH_TAC); +(POP_ASSUM (fun th -> REWRITE_TAC [GSYM th])); +(DISCH_TAC); +( POP_ASSUM (fun th -> REWRITE_TAC [th])); +(REWRITE_TAC [INTERS_0]); +*) + +(MP_TAC (ISPECL [`V:real^3->bool`;`(g:real^3->real)`;`r':real`]FININTE_GFUN)); +(FIND_ASSUM (fun th -> REWRITE_TAC [th]) `~ ((V:real^3->bool) = {})`); +(FIND_ASSUM (fun th -> REWRITE_TAC [th]) `FINITE (V:real^3->bool) `); +(STRIP_TAC); +(ASM_CASES_TAC `bounded (P:real^3->bool)`); +(ASM_REWRITE_TAC[]); +(POP_ASSUM MP_TAC); +(REWRITE_TAC [bounded]); +(REWRITE_TAC [NOT_EXISTS_THM;NOT_FORALL_THM]); +(REWRITE_TAC [NOT_IMP;REAL_NOT_LE]); +(DISCH_THEN (LABEL_TAC "F4")); +(REWRITE_TAC [GSYM bounded]); +(SUBGOAL_THEN `!u:real^3 . u IN (V:real^3->bool) ==> (?p:real^3. p IN (P:real^3->bool) /\ (((g:real^3->real)(u:real^3)) * (r':real)) / (&2) < norm p)` ASSUME_TAC); +(REPEAT STRIP_TAC); +(REMOVE_THEN "F4" (MP_TAC o SPEC `sup {((g:real^3->real)(u:real^3) * (r':real)) / &2 | u IN (V:real^3->bool)}`)); +(DISCH_THEN (X_CHOOSE_TAC `p:real^3`)); +(POP_ASSUM MP_TAC THEN STRIP_TAC); +(EXISTS_TAC `p:real^3`); +(ASM_REWRITE_TAC[]); +(MP_TAC (ISPECL [`{((g:real^3->real)(u:real^3) * (r':real)) / &2 | u IN (V:real^3->bool)}`]SUP_FINITE)); +(ASM_REWRITE_TAC[]); +(STRIP_TAC); +(POP_ASSUM (MP_TAC o SPEC `((g:real^3->real)(u':real^3) * (r':real)) / &2 `)); +(REWRITE_TAC [IN_ELIM_THM]); +(SUBGOAL_THEN `(?u:real^3. u IN (V:real^3->bool) /\ ((g:real^3->real)(u':real^3) * (r':real)) / &2 = (g u * r') / &2)` ASSUME_TAC); +(EXISTS_TAC `u':real^3`); +(ASM_REWRITE_TAC[]); +(POP_ASSUM (fun th ->REWRITE_TAC [th])); +(STRIP_TAC); +(MP_TAC (ISPECL [`((g:real^3->real)(u':real^3) * (r':real)) / &2`;`sup {((g:real^3->real)(u:real^3) * (r':real)) / &2 | u IN (V:real^3->bool)}`;`norm (p:real^3)`]REAL_LET_TRANS)); +(POP_ASSUM (fun th ->REWRITE_TAC [th])); +(POP_ASSUM MP_TAC); +(POP_ASSUM (fun th ->REWRITE_TAC [th])); +(POP_ASSUM (LABEL_TAC "F5")); +(REMOVE_THEN "F4" (MP_TAC o SPEC `sup {((g:real^3->real)(u:real^3) * (r':real)) / &2 | u IN (V:real^3->bool)}`)); +(DISCH_THEN (X_CHOOSE_TAC `p:real^3`)); +(POP_ASSUM MP_TAC THEN STRIP_TAC); +(REMOVE_THEN "F5" (MP_TAC o SPEC `u:real^3`)); +(FIND_ASSUM (fun th ->REWRITE_TAC [th]) `(u:real^3) IN (V:real^3 -> bool)`); +(STRIP_TAC); +(USE_THEN "F3" (MP_TAC o SPECL [`p:real^3`;`u:real^3`])); +(FIND_ASSUM (fun th -> REWRITE_TAC [th])`(p:real^3) IN (P:real^3->bool)`); +(FIND_ASSUM (fun th -> REWRITE_TAC [th])`(u:real^3) IN (V:real^3->bool)`); +(DISCH_TAC); +(MP_TAC (ISPECL [`{((g:real^3->real)(u:real^3) * (r':real)) / &2 | u IN (V:real^3->bool)}`]SUP_FINITE)); +(ASM_REWRITE_TAC[]); +(STRIP_TAC); +(POP_ASSUM (MP_TAC o SPEC `((g:real^3->real)(u:real^3) * (r':real)) / &2`)); +(REWRITE_TAC [IN_ELIM_THM]); +(SUBGOAL_THEN `(?(u':real^3). u' IN (V:real^3->bool) /\ ((g:real^3->real)(u:real^3) * (r':real)) / &2 = (g u' * r') / &2)` ASSUME_TAC); +(EXISTS_TAC `u:real^3`); +(ASM_REWRITE_TAC[]); +(POP_ASSUM (fun th -> REWRITE_TAC[th])); +(STRIP_TAC); +(MP_TAC (ISPECL [`((g:real^3->real)(u:real^3) * (r':real)) / &2`;`sup {((g:real^3->real)(u:real^3) * (r':real)) / &2 | u IN (V:real^3->bool)}`;`norm (p:real^3)`]REAL_LET_TRANS)); +(ASM_REWRITE_TAC[]); +(STRIP_TAC); +(ASM_CASES_TAC `(p:real^3) = vec 0`); +(SUBGOAL_THEN `((r':real)/(norm (p:real^3)))% p = vec 0` ASSUME_TAC); +(POP_ASSUM (fun th -> REWRITE_TAC [th])); +(MESON_TAC [VECTOR_MUL_RZERO]); +(SUBGOAL_THEN `norm (((r':real)/(norm (p:real^3)))% p) = &0` ASSUME_TAC ); +(ASM_REWRITE_TAC[]); +(REWRITE_TAC [NORM_EQ_0]); +(MP_TAC (ISPECL [`p:real^3`]NORM_EQ_0)); +(ASM_REWRITE_TAC[]); +(STRIP_TAC); +(UNDISCH_TAC `((g:real^3->real)(u:real^3) * (r':real)) / (&2) < norm (p:real^3)`); +(ASM_REWRITE_TAC[]); +(STRIP_TAC); +(USE_THEN "F3" (MP_TAC o SPECL [`(vec 0):real^3`;`u:real^3`])); +(UNDISCH_TAC `(p:real^3) IN (P:real^3->bool)`); +(UNDISCH_TAC `p:real^3 = vec 0`); +(DISCH_TAC THEN POP_ASSUM (fun th ->REWRITE_TAC [th])); +(DISCH_TAC THEN POP_ASSUM (fun th ->REWRITE_TAC [th])); +(FIND_ASSUM (fun th -> REWRITE_TAC [th]) `(u:real^3) IN (V:real^3->bool)`); +(UNDISCH_TAC `(P:real^3->bool) = INTERS {{x:real^3 | u dot x <= (g:real^3->real)(u)} | (u:real^3) IN (V:real^3->bool)}`); +(DISCH_TAC); +(POP_ASSUM (fun th -> REWRITE_TAC [GSYM th])); +(REWRITE_TAC [DOT_RZERO]); +(SUBGOAL_THEN `&2 <= r':real` ASSUME_TAC); +(ASM_ARITH_TAC); +(MP_TAC (ISPECL [`&0`;`&2`;`r':real`]REAL_LTE_TRANS)); +(ASM_REWRITE_TAC [ARITH_RULE `&0 < &2`]); +(STRIP_TAC); +(MP_TAC (ARITH_RULE `(((g:real^3->real))(u:real^3) * (r':real)) / &2 < &0 <=> g u * r' < &0`)); +(POP_ASSUM MP_TAC); +(POP_ASSUM MP_TAC); +(POP_ASSUM (fun th ->REWRITE_TAC [th])); +(REPEAT STRIP_TAC); +(MP_TAC (ISPECL [`((g:real^3->real))(u:real^3)`;`&0`;`r':real`]REAL_LT_RDIV_EQ)); +(POP_ASSUM MP_TAC); +(POP_ASSUM (fun th ->REWRITE_TAC [th])); +(POP_ASSUM (fun th ->REWRITE_TAC [th])); +(REWRITE_TAC [ARITH_RULE `&0 / (r':real) = &0`]); +(ARITH_TAC); +(SUBGOAL_THEN `~(u:real^3 = vec 0)` ASSUME_TAC); +(ASM_MESON_TAC[CHANGE_TARJJUW_31]); + +(SUBGOAL_THEN `!v:real^3.(v = ((r':real)/(norm p))% (p:real^3)) ==> (r' = norm v)` ASSUME_TAC); +(GEN_TAC); +(STRIP_TAC); +(SUBGOAL_THEN `&2 <= r':real` ASSUME_TAC); +(ASM_ARITH_TAC); +(MP_TAC (ISPECL [`&0`;`&2`;`r':real`]REAL_LTE_TRANS)); +(ASM_REWRITE_TAC [ARITH_RULE `&0 < &2`]); +(STRIP_TAC); +(FIND_ASSUM (fun th -> REWRITE_TAC [GSYM th]) `(v:real^3) = (r':real) / norm p % (p:real^3)`); +(ASM_MESON_TAC [CHANGE_TARJJUW_1]); +(POP_ASSUM (LABEL_TAC "F7")); +(USE_THEN "F1" (MP_TAC o SPEC `((r':real)/(norm (p:real^3)))% p`)); +(REWRITE_TAC [dist;NORM_SUB;VECTOR_SUB_RZERO]); +(ABBREV_TAC `v = (r':real) / norm p % (p:real^3)`); +(ASM_REWRITE_TAC[]); +(REMOVE_THEN "F7" (MP_TAC o SPEC `v:real^3`)); +(REWRITE_TAC[]); +(STRIP_TAC); +(SUBGOAL_THEN `&2 <= r':real` ASSUME_TAC); +(ASM_ARITH_TAC); +(POP_ASSUM MP_TAC); +(ASM_REWRITE_TAC[]); +(STRIP_TAC); +(ASM_REWRITE_TAC[ARITH_RULE `norm (v:real^3) <= norm v`]); +(STRIP_TAC); +(POP_ASSUM MP_TAC); +(REWRITE_TAC [GSYM dist]); +(STRIP_TAC); +(REMOVE_THEN "F3" (MP_TAC o SPECL [`p:real^3`;`u':real^3`])); +(ASM_REWRITE_TAC[]); +(STRIP_TAC); +(MP_TAC (ISPECL [`{((g:real^3->real)(u:real^3) * (r':real)) / &2 | u IN (V:real^3->bool)}`]SUP_FINITE)); +(ASM_REWRITE_TAC[]); +(UNDISCH_TAC `(r':real) = norm (v:real^3)`); +(STRIP_TAC); +(POP_ASSUM (fun th -> REWRITE_TAC[GSYM th])); +(STRIP_TAC); +(POP_ASSUM (MP_TAC o SPEC `((g:real^3->real)(u':real^3) * (r':real)) / &2`)); +(REWRITE_TAC [IN_ELIM_THM]); +(SUBGOAL_THEN `(?(u:real^3). u IN (V:real^3->bool) /\ ((g:real^3->real)(u':real^3) * (r':real)) / &2 = (g u * r') / &2)` ASSUME_TAC); +(EXISTS_TAC `u':real^3`); +(ASM_REWRITE_TAC[]); +(POP_ASSUM (fun th -> REWRITE_TAC[th])); +(STRIP_TAC); +(MP_TAC (ISPECL [`((g:real^3->real)(u':real^3) * (r':real)) / &2`;`sup {((g:real^3->real)(u:real^3) * (r':real)) / &2 | u IN (V:real^3->bool)}`;`norm (p:real^3)`]REAL_LET_TRANS)); +(ASM_REWRITE_TAC[]); +(STRIP_TAC); +(UNDISCH_TAC `(r':real) / norm (p:real^3) % p = v:real^3`); +(REWRITE_TAC [EQ_SYM_EQ]); +(STRIP_TAC); +(SUBGOAL_THEN `norm (p:real^3) < norm p` ASSUME_TAC); +(ASM_MESON_TAC[CHANGE_TARJJUW_5]); +(UNDISCH_TAC `(P:real^3->bool) = INTERS {{x:real^3 | u dot x <= (g:real^3->real)(u:real^3)} | u IN (V:real^3->bool)}`); +(STRIP_TAC); +(POP_ASSUM (fun th -> REWRITE_TAC [GSYM th])); +(ASM_ARITH_TAC); +]);; + + +let TARJJUW = prove( `!(V:real^3 -> bool)(P:real^3->bool) (g:real^3->real) r r':real. (&2 <= r) /\ (r <= r') /\ (V SUBSET (:real^3) DIFF ball (vec 0,&2)) /\ (FINITE V) /\ packing V /\ ~(V = {}) /\ (weakly_saturated V r r') /\ + P = INTERS {half_spaces u (g u)| u IN V} ==> +(bounded P)`, +REPEAT GEN_TAC +THEN STRIP_TAC +THEN MP_TAC (ISPECL [`V:real^3->bool`]MEMBER_NOT_EMPTY) +THEN POP_ASSUM MP_TAC +THEN POP_ASSUM MP_TAC +THEN FIRST_ASSUM (fun th -> REWRITE_TAC [th]) +THEN STRIP_TAC +THEN STRIP_TAC +THEN DISCH_THEN (X_CHOOSE_TAC `u:real^3`) +THEN MP_TAC (ISPECL [`(V:real^3 -> bool)`;`(P:real^3->bool)`;`(g:real^3->real)`;` r:real`;`r':real`] CHANGE_TARJJUW_9) +THEN ASM_REWRITE_TAC[] +THEN FIRST_ASSUM (fun th -> REWRITE_TAC [GSYM th]) +THEN POP_ASSUM MP_TAC +THEN FIRST_ASSUM (fun th -> REWRITE_TAC [GSYM th]) +THEN REPEAT STRIP_TAC +THEN MP_TAC (ISPECL [`V:real^3 -> bool`;`P:real^3->bool`;`g:real^3 -> real`;`r:real`;`r':real`;`u:real^3`]CHANGE_TARJJUW_10) +THEN ASM_REWRITE_TAC[]);; + + +end;; \ No newline at end of file diff --git a/text_formalization/packing/TEZFFSK.hl b/text_formalization/packing/TEZFFSK.hl new file mode 100755 index 0000000..8113ead --- /dev/null +++ b/text_formalization/packing/TEZFFSK.hl @@ -0,0 +1,586 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: TEZFFSK *) +(* Chaper : Packing (Marchal cells) *) +(* *) +(* ========================================================================= *) + +(* ========================================================================= *) +(* FILES NEED TO BE LOADED *) +(* + + +*) + +module Tezffsk = struct + +open Rogers;; +open Vukhacky_tactics;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Sphere;; +open Marchal_cells;; +open Emnwuus;; +open Marchal_cells_2_new;; +open Lepjbdj;; +open Njiutiu;; + +let TEZFFSK_concl = +`!V ul vl k. + saturated V /\ packing V /\ barV V 3 ul /\ barV V 3 vl /\ + rogers V ul = rogers V vl /\ aff_dim (rogers V ul) = &3 /\ + k <= 3 /\ hl (truncate_simplex k ul) < sqrt (&2) + ==> truncate_simplex k ul = truncate_simplex k vl`;; + +let TEZFFSK = prove_by_refinement (TEZFFSK_concl, +[(REPEAT STRIP_TAC); + (ABBREV_TAC `s1 = omega_list_n V ul 1`); + (ABBREV_TAC `s2 = omega_list_n V ul 2`); + (ABBREV_TAC `s3 = omega_list_n V ul 3`); + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `!i. i <= k + ==> hl (truncate_simplex i (ul:(real^3)list)) < sqrt (&2)`); + (REPEAT STRIP_TAC); + (ABBREV_TAC `wl:(real^3)list = truncate_simplex k ul`); + (REWRITE_WITH `truncate_simplex i ul + = truncate_simplex i (wl:(real^3)list)`); + (EXPAND_TAC "wl" THEN ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.TRUNCATE_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH]); + (ASM_ARITH_TAC); + (NEW_GOAL `hl (truncate_simplex i wl) <= hl (wl:(real^3)list)`); + (MATCH_MP_TAC Rogers.HL_DECREASE); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `k:num`); + (ASM_REWRITE_TAC[IN]); + (EXPAND_TAC "wl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `3 <= 3`]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `!i. i <= k + ==> omega_list_n V ul i = + circumcenter (set_of_list (truncate_simplex i ul))`); + (REPEAT STRIP_TAC); + (REWRITE_WITH `omega_list_n V ul i = omega_list V (truncate_simplex i ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_LEMMA); + (ASM_REWRITE_TAC[LENGTH] THEN ASM_ARITH_TAC); + (MATCH_MP_TAC XNHPWAB1); + (EXISTS_TAC `i:num` THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[IN]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC); + (ASM_SIMP_TAC[]); + + (NEW_GOAL `!i. 0 <= i /\ i <= 3 + ==> omega_list_n V ul i = omega_list_n V vl i`); + (MATCH_MP_TAC NJIUTIU); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `s1 = omega_list_n V vl 1`); + (EXPAND_TAC "s1" THEN FIRST_ASSUM MATCH_MP_TAC THEN ARITH_TAC); + (NEW_GOAL `s2 = omega_list_n V vl 2`); + (EXPAND_TAC "s2" THEN FIRST_ASSUM MATCH_MP_TAC THEN ARITH_TAC); + (NEW_GOAL `s3 = omega_list_n V vl 3`); + (EXPAND_TAC "s3" THEN FIRST_ASSUM MATCH_MP_TAC THEN ARITH_TAC); + + (NEW_GOAL `HD ul = HD (vl:(real^3)list)`); + (REWRITE_TAC[HD; ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (MATCH_MP_TAC ROGERS_INTER_V_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (SUBGOAL_THEN `set_of_list (ul:(real^3)list) SUBSET V` MP_TAC); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `rogers V ul = rogers V vl`)]); + (REWRITE_TAC[MESON[IN] `rogers V ul u0 <=> u0 IN rogers V ul`]); + (REWRITE_WITH `rogers V ul = + convex hull + {HD ul, omega_list_n V ul 1, omega_list_n V ul 2, omega_list_n V ul 3}`); + (MATCH_MP_TAC ROGERS_EXPLICIT); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (ASM_REWRITE_TAC[HD] THEN SET_TAC[]); + + (ASM_CASES_TAC `1 <= k`); + (ABBREV_TAC `wl:(real^3)list = truncate_simplex k ul`); + (NEW_GOAL `hl (wl:(real^3)list) = dist (omega_list V wl,HD wl)`); + (MATCH_MP_TAC Rogers.WAUFCHE2); + (EXISTS_TAC `k:num` THEN ASM_REWRITE_TAC[IN]); + (EXPAND_TAC "wl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH `omega_list V wl = omega_list_n V ul k`); + (EXPAND_TAC "wl" THEN MATCH_MP_TAC Packing3.OMEGA_LIST_LEMMA); + (ASM_REWRITE_TAC[LENGTH] THEN ASM_ARITH_TAC); + (REWRITE_WITH `HD wl = HD (ul:(real^3)list)`); + (EXPAND_TAC "wl" THEN MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ASM_ARITH_TAC); + (DISCH_TAC); + (ABBREV_TAC `zl = truncate_simplex k (vl:(real^3)list)`); + + (NEW_GOAL `hl (zl:(real^3)list) < sqrt (&2)`); + (NEW_GOAL `hl (zl:(real^3)list) <= dist (omega_list_n V ul k, HD ul)`); + (REWRITE_WITH `omega_list_n V ul k = omega_list_n V vl k`); + (NEW_GOAL `k = 1 \/ k = 2 \/ k = 3`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN ASM_MESON_TAC[]); + (REWRITE_TAC[ASSUME `HD (ul:(real^3)list) = HD vl`]); + (REWRITE_WITH `omega_list_n V vl k = omega_list V zl`); + (EXPAND_TAC "zl" THEN ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_LEMMA); + (ASM_REWRITE_TAC[LENGTH] THEN ASM_ARITH_TAC); + (REWRITE_WITH `HD vl = HD (zl:(real^3)list)`); + (EXPAND_TAC "zl" THEN ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH] THEN ASM_ARITH_TAC); + (MATCH_MP_TAC WAUFCHE1); + (EXISTS_TAC `k:num` THEN REWRITE_TAC[IN] THEN EXPAND_TAC "zl"); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + + (NEW_GOAL `!i. i <= k + ==> hl (truncate_simplex i (vl:(real^3)list)) < sqrt (&2)`); + (REPEAT STRIP_TAC); + (REWRITE_WITH `truncate_simplex i vl + = truncate_simplex i (zl:(real^3)list)`); + (EXPAND_TAC "zl" THEN ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.TRUNCATE_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH]); + (ASM_ARITH_TAC); + (NEW_GOAL `hl (truncate_simplex i zl) <= hl (zl:(real^3)list)`); + (MATCH_MP_TAC Rogers.HL_DECREASE); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `k:num`); + (ASM_REWRITE_TAC[IN]); + (EXPAND_TAC "zl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `3 <= 3`]); + (ASM_REAL_ARITH_TAC); + +(* ------------------------------------------------------------------------- *) + (NEW_GOAL `~(affine_dependent {v0,v1,v2,v3:real^3})`); + (REWRITE_WITH `{v0,v1,v2,v3:real^3} = set_of_list vl`); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3:num`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `rogers V ul = + convex hull + {HD ul, omega_list_n V ul 1, omega_list_n V ul 2, omega_list_n V ul 3}`); + (MATCH_MP_TAC ROGERS_EXPLICIT); + (ASM_REWRITE_TAC[]); + (NEW_GOAL +`~(affine_dependent {HD ul, omega_list_n V ul 1, omega_list_n V ul 2, + omega_list_n V ul 3})`); + (STRIP_TAC); + (NEW_GOAL `aff_dim {HD ul, omega_list_n V ul 1, + omega_list_n V ul 2, omega_list_n V ul 3} <= &2`); + (ASM_SIMP_TAC [AFF_DEPENDENT_AFF_DIM_4]); + (UP_ASM_TAC THEN REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[GSYM AFF_DIM_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `aff_dim (rogers V ul) <= aff_dim (affine hull + {HD ul, omega_list_n V ul 1, omega_list_n V ul 2, omega_list_n V ul 3})`); + (MATCH_MP_TAC AFF_DIM_SUBSET); + (REWRITE_TAC[ASSUME `rogers V ul = + convex hull + {HD ul, omega_list_n V ul 1, omega_list_n V ul 2, omega_list_n V ul 3}`; + CONVEX_HULL_SUBSET_AFFINE_HULL]); + (ASM_ARITH_TAC); + + (NEW_GOAL `~(affine_dependent ( + set_of_list (truncate_simplex k (ul:(real^3)list))))`); + (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `k:num`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + + (NEW_GOAL `CARD {v0,v1,v2,v3:real^3} = 4`); + (REWRITE_WITH `{v0,v1,v2,v3:real^3} = set_of_list vl`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + +(* ------------------------------------------------------------------------- *) + (NEW_GOAL `u0 = v0:real^3`); + (UNDISCH_TAC `HD ul = HD (vl:(real^3)list)` THEN ASM_REWRITE_TAC[HD]); + + (NEW_GOAL `u1 = v1:real^3`); + (ABBREV_TAC `S1 = {u0, u1:real^3}`); + + (NEW_GOAL `!u:real^3 v. u IN S1 /\ v IN V DIFF S1 + ==> dist (v,s1) > dist (u,s1)`); + (MATCH_MP_TAC XYOFCGX); + (REPEAT STRIP_TAC); (* 5 new subgoals *) + + (ASM_REWRITE_TAC[]); (* finish subgoal 1 *) + (REWRITE_WITH `S1:real^3->bool = set_of_list (truncate_simplex 1 ul)`); + (ASM_REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1]); + (ASM_MESON_TAC[]); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `1` THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + (* finish subgoal 2 *) + + (UP_ASM_TAC THEN REWRITE_TAC[] THEN MATCH_MP_TAC AFFINE_INDEPENDENT_SUBSET); + (EXISTS_TAC `set_of_list (truncate_simplex k (ul:(real^3)list))`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "wl"); + (ASM_CASES_TAC `k = 1`); + (REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1; + ASSUME `ul = [u0;u1;u2;u3:real^3]`; ASSUME `k = 1`]); + (ASM_SET_TAC[]); + (ASM_CASES_TAC `k = 2`); + (REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_2; + ASSUME `ul = [u0;u1;u2;u3:real^3]`; ASSUME `k = 2`]); + (ASM_SET_TAC[]); + (ASM_CASES_TAC `k = 3`); + (REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_3; + ASSUME `ul = [u0;u1;u2;u3:real^3]`; ASSUME `k = 3`]); + (ASM_SET_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); (* finish subgoal 3 *) + + (EXPAND_TAC "s1" THEN EXPAND_TAC "S1"); + (MATCH_MP_TAC OMEGA_LIST_1_EXPLICIT_NEW); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_TAC[IN; MESON[] `A/\B/\C/\D/\E <=> (A/\B/\C/\D)/\E`]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `radV (S1:real^3->bool) + = hl (truncate_simplex 1 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[HL;TRUNCATE_SIMPLEX_EXPLICIT_1;set_of_list]); + (EXPAND_TAC "S1" THEN REWRITE_TAC[ASSUME `u0 = v0:real^3`]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); (* finish subgoal 5 *) + + (NEW_GOAL `v1:real^3 IN S1`); + (ASM_CASES_TAC `v1:real^3 IN S1`); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `F`); + (NEW_GOAL `dist (v1,s1) > dist (u0,s1:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + (EXPAND_TAC "S1" THEN SET_TAC[]); + (ASM_REWRITE_TAC[IN_DIFF]); + (NEW_GOAL `set_of_list vl SUBSET V:real^3->bool`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + + (NEW_GOAL `s1 = circumcenter {v0,v1:real^3}`); + (REWRITE_TAC[ASSUME `s1 = omega_list_n V vl 1`]); + (MATCH_MP_TAC OMEGA_LIST_1_EXPLICIT_NEW); + (EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (REWRITE_WITH `[v0;v1:real^3] = truncate_simplex 1 vl`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_TAC[IN; MESON[] `A/\B/\C/\D/\E <=> (A/\B/\C/\D)/\E`]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[Rogers.CIRCUMCENTER_2; midpoint]); + (STRIP_TAC THEN SWITCH_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[ + ASSUME `s1:real^3 = inv (&2) % (v0 + v1)`; ASSUME `u0 = v0:real^3`;dist]); + (REWRITE_TAC[VECTOR_ARITH + `v1 - inv (&2) % (v0 + v1) = inv (&2) % (v1 - v0) /\ + v0 - inv (&2) % (v0 + v1) = (-- inv (&2)) % (v1 - v0)`; NORM_MUL; REAL_ABS_NEG] THEN REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `~(v1 = u0:real^3)`); + (REWRITE_TAC[ASSUME `u0 = v0:real^3`]); + (STRIP_TAC); + (UNDISCH_TAC `CARD {v0,v1,v2,v3:real^3} = 4`); + (ASM_REWRITE_TAC[SET_RULE `{a,a,b,c} = {a,b,c}`]); + (NEW_GOAL `CARD {v0,v2,v3:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN ARITH_TAC); + (ASM_SET_TAC[]); + + (ASM_CASES_TAC `k = 1`); + (EXPAND_TAC "wl" THEN EXPAND_TAC "zl" THEN REWRITE_TAC[ASSUME `k = 1`]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + +(* ======================================================================= *) + + (NEW_GOAL `u2 = v2:real^3`); + (ABBREV_TAC `S2 = {u0, u1, u2:real^3}`); + + (NEW_GOAL `!u:real^3 v. u IN S2 /\ v IN V DIFF S2 + ==> dist (v,s2) > dist (u,s2)`); + (MATCH_MP_TAC XYOFCGX); + (REPEAT STRIP_TAC); (* 5 new subgoals *) + + (ASM_REWRITE_TAC[]); (* finish subgoal 1 *) + (REWRITE_WITH `S2:real^3->bool = set_of_list (truncate_simplex 2 ul)`); + (ASM_REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_2]); + (ASM_MESON_TAC[]); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `2` THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (* finish subgoal 2 *) + (UP_ASM_TAC THEN REWRITE_TAC[] THEN MATCH_MP_TAC AFFINE_INDEPENDENT_SUBSET); + (EXISTS_TAC `set_of_list (truncate_simplex k (ul:(real^3)list))`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "wl"); + (ASM_CASES_TAC `k = 2`); + (REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_2; + ASSUME `ul = [u0;u1;u2;u3:real^3]`; ASSUME `k = 2`]); + (ASM_SET_TAC[]); + (ASM_CASES_TAC `k = 3`); + (REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_3; + ASSUME `ul = [u0;u1;u2;u3:real^3]`; ASSUME `k = 3`]); + (ASM_SET_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); (* finish subgoal 3 *) + + (EXPAND_TAC "s2" THEN EXPAND_TAC "S2"); + (MATCH_MP_TAC OMEGA_LIST_2_EXPLICIT_NEW); + (EXISTS_TAC `u3:real^3`); + (REWRITE_WITH `[u0;u1;u2:real^3] = truncate_simplex 2 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_TAC[IN; MESON[] `A/\B/\C/\D/\E <=> (A/\B/\C/\D)/\E`]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_ARITH_TAC); + + (REWRITE_WITH `radV (S2:real^3->bool) + = hl (truncate_simplex 2 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[HL;TRUNCATE_SIMPLEX_EXPLICIT_2;set_of_list]); + (EXPAND_TAC "S2" THEN REWRITE_TAC[ASSUME `u0 = v0:real^3`; ASSUME `u1 = v1:real^3`]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_ARITH_TAC); (* finish subgoal 5 *) + + (NEW_GOAL `v2:real^3 IN S2`); + (ASM_CASES_TAC `v2:real^3 IN S2`); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `F`); + (NEW_GOAL `dist (v2,s2) > dist (u0,s2:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + (EXPAND_TAC "S2" THEN SET_TAC[]); + (ASM_REWRITE_TAC[IN_DIFF]); + (NEW_GOAL `set_of_list vl SUBSET V:real^3->bool`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + + (NEW_GOAL `s2 = circumcenter {v0,v1,v2:real^3}`); + (REWRITE_TAC[ASSUME `s2 = omega_list_n V vl 2`]); + (MATCH_MP_TAC OMEGA_LIST_2_EXPLICIT_NEW); + (EXISTS_TAC `v3:real^3`); + (REWRITE_WITH `[v0;v1;v2:real^3] = truncate_simplex 2 vl`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_TAC[IN; MESON[] `A/\B/\C/\D/\E <=> (A/\B/\C/\D)/\E`]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_ARITH_TAC); + + (NEW_GOAL `!w:real^3. w IN {v0,v1,v2} + ==> radV {v0,v1,v2} = dist (s2:real^3,w)`); + (REWRITE_TAC[ASSUME `s2 = circumcenter {v0, v1, v2:real^3}`]); + (MATCH_MP_TAC Rogers.OAPVION2); + (MATCH_MP_TAC AFFINE_INDEPENDENT_SUBSET); + (EXISTS_TAC `{v0,v1,v2,v3:real^3}`); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (NEW_GOAL `dist (u0,s2:real^3) = radV {v0, v1, v2:real^3}`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (NEW_GOAL `dist (v2,s2:real^3) = radV {v0, v1, v2:real^3}`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (FIRST_ASSUM MATCH_MP_TAC); + (SET_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `~(v2 = u0:real^3)`); + (REWRITE_TAC[ASSUME `u0 = v0:real^3`]); + (STRIP_TAC); + (UNDISCH_TAC `CARD {v0,v1,v2,v3:real^3} = 4`); + (ASM_REWRITE_TAC[SET_RULE `{a,b,a,c} = {a,b,c}`]); + (NEW_GOAL `CARD {v0,v1,v3:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN ARITH_TAC); + + (NEW_GOAL `~(v2 = u1:real^3)`); + (REWRITE_TAC[ASSUME `u1 = v1:real^3`]); + (STRIP_TAC); + (UNDISCH_TAC `CARD {v0,v1,v2,v3:real^3} = 4`); + (ASM_REWRITE_TAC[SET_RULE `{a,b,b,c} = {a,b,c}`]); + (NEW_GOAL `CARD {v0,v1,v3:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN ARITH_TAC); + (ASM_SET_TAC[]); + + (ASM_CASES_TAC `k = 2`); + (EXPAND_TAC "wl" THEN EXPAND_TAC "zl" THEN REWRITE_TAC[ASSUME `k = 2`]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + +(* ------------------------------------------------------------------------ *) + + (NEW_GOAL `k = 3`); + (ASM_ARITH_TAC); + (NEW_GOAL `u3 = v3:real^3`); + (ABBREV_TAC `S3 = {u0, u1, u2, u3:real^3}`); + + (NEW_GOAL `!u:real^3 v. u IN S3 /\ v IN V DIFF S3 + ==> dist (v,s3) > dist (u,s3)`); + (MATCH_MP_TAC XYOFCGX); + (REPEAT STRIP_TAC); (* 5 new subgoals *) + + (ASM_REWRITE_TAC[]); (* finish subgoal 1 *) + (REWRITE_WITH `S3:real^3->bool = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (ASM_MESON_TAC[]); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); (* finish subgoal 2 *) + + (UP_ASM_TAC THEN EXPAND_TAC "S3"); + (REWRITE_WITH `{u0, u1, u2, u3:real^3} = set_of_list (truncate_simplex k ul)`); + (REWRITE_TAC[ASSUME `k = 3`; ASSUME `ul = [u0;u1;u2;u3:real^3]`; + set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_3]); + (ASM_REWRITE_TAC[]); (* finish subgoal 3 *) + + (EXPAND_TAC "s3" THEN EXPAND_TAC "S3"); + (MATCH_MP_TAC OMEGA_LIST_3_EXPLICIT); + (REWRITE_TAC[IN; MESON[] `A/\B/\C/\D/\E <=>(A/\B/\C/\E)/\D`] THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `hl (ul:(real^3)list) = hl (wl:(real^3)list)`); + (EXPAND_TAC "wl" THEN REWRITE_TAC[ASSUME `k = 3`]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `radV (S3:real^3->bool) + = hl (truncate_simplex 3 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[HL;TRUNCATE_SIMPLEX_EXPLICIT_3;set_of_list]); + (EXPAND_TAC "S3" THEN REWRITE_TAC[ASSUME `u0 = v0:real^3`; + ASSUME `u1 = v1:real^3`; ASSUME `u2 = v2:real^3`]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_ARITH_TAC); (* finish subgoal 5 *) + + (NEW_GOAL `v3:real^3 IN S3`); + (ASM_CASES_TAC `v3:real^3 IN S3`); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `F`); + (NEW_GOAL `dist (v3,s3) > dist (u0,s3:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + (EXPAND_TAC "S3" THEN SET_TAC[]); + (ASM_REWRITE_TAC[IN_DIFF]); + (NEW_GOAL `set_of_list vl SUBSET V:real^3->bool`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + + (NEW_GOAL `s3 = circumcenter {v0,v1,v2, v3:real^3}`); + (REWRITE_TAC[ASSUME `s3 = omega_list_n V vl 3`]); + (MATCH_MP_TAC OMEGA_LIST_3_EXPLICIT); + (REWRITE_TAC[IN; MESON[] `A/\B/\C/\D/\E <=>(A/\B/\C/\E)/\D`] THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `hl (vl:(real^3)list) = hl (zl:(real^3)list)`); + (EXPAND_TAC "zl" THEN REWRITE_TAC[ASSUME `k = 3`]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `!w:real^3. w IN {v0,v1,v2,v3} + ==> radV {v0,v1,v2,v3} = dist (s3:real^3,w)`); + (REWRITE_TAC[ASSUME `s3 = circumcenter {v0, v1, v2, v3:real^3}`]); + (MATCH_MP_TAC Rogers.OAPVION2); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `dist (u0,s3:real^3) = radV {v0, v1, v2, v3:real^3}`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (NEW_GOAL `dist (v3,s3:real^3) = radV {v0, v1, v2, v3:real^3}`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (FIRST_ASSUM MATCH_MP_TAC); + (SET_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `~(v3 = u0:real^3)`); + (REWRITE_TAC[ASSUME `u0 = v0:real^3`]); + (STRIP_TAC); + (UNDISCH_TAC `CARD {v0,v1,v2,v3:real^3} = 4`); + (ASM_REWRITE_TAC[SET_RULE `{a,b,c,a} = {a,b,c}`]); + (NEW_GOAL `CARD {v0,v1,v2:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN ARITH_TAC); + + (NEW_GOAL `~(v3 = u1:real^3)`); + (REWRITE_TAC[ASSUME `u1 = v1:real^3`]); + (STRIP_TAC); + (UNDISCH_TAC `CARD {v0,v1,v2,v3:real^3} = 4`); + (ASM_REWRITE_TAC[SET_RULE `{a,b,c,b} = {a,b,c}`]); + (NEW_GOAL `CARD {v0,v1,v2:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN ARITH_TAC); + + (NEW_GOAL `~(v3 = u2:real^3)`); + (REWRITE_TAC[ASSUME `u2 = v2:real^3`]); + (STRIP_TAC); + (UNDISCH_TAC `CARD {v0,v1,v2,v3:real^3} = 4`); + (ASM_REWRITE_TAC[SET_RULE `{a,b,c,c} = {a,b,c}`]); + (NEW_GOAL `CARD {v0,v1,v2:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN ARITH_TAC); + (ASM_SET_TAC[]); + + (EXPAND_TAC "wl" THEN EXPAND_TAC "zl" THEN REWRITE_TAC[ASSUME `k = 3`]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3]); + +(* ------------------------------------------------------------------------ *) + + (NEW_GOAL `k = 0`); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_0]); + (REWRITE_WITH `u0:real^3 = HD ul /\ v0:real^3 = HD vl`); + (ASM_MESON_TAC[HD]); + (ASM_REWRITE_TAC[])]);; + +(* ========================================================================= *) + +end;; + diff --git a/text_formalization/packing/TSKAJXY.hl b/text_formalization/packing/TSKAJXY.hl new file mode 100644 index 0000000..40a2372 --- /dev/null +++ b/text_formalization/packing/TSKAJXY.hl @@ -0,0 +1,2489 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Packing *) +(* Lemma: TSKAJXY *) +(* Author: Thomas C. Hales *) +(* Date: 2012-01-15 *) +(* ========================================================================== *) + + +(* + +Remaining cases of TSKAJXY. + +*) + +flyspeck_needs "usr/thales/hales_tactic.hl";; + +module Tskajxy = struct + + open Hales_tactic;; + +let GAMMAX_NULLSET = prove_by_refinement( + `!V f X ul k. saturated V /\ packing V /\ barV V 3 ul /\ (X = mcell k V ul) /\ NULLSET X ==> + gammaX V X f = &0`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Pack_defs.gammaX]; + TYPIFY `total_solid V X = &0` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[Pack_defs.total_solid]; + TYPIFY `(VX V X = {})` (C SUBGOAL_THEN SUBST1_TAC); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC Bump.VX_EMPTY; + BY(ASM_MESON_TAC[]); + BY(REWRITE_TAC[SUM_CLAUSES]); + TYPIFY `(edgeX V X = {})` (C SUBGOAL_THEN SUBST1_TAC); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC Bump.RIJRIED; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[SUM_CLAUSES]; + TYPIFY `vol X = &0` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[volume_props]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let GAMMAX_MCELL1 = prove_by_refinement( + `!V X ul. saturated V /\ packing V /\ barV V 3 ul /\ (X = mcell1 V ul) /\ ~(NULLSET X) ==> + gammaX V X lmfun = vol X - (&2 * mm1 /pi) * sol (EL 0 ul) X`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.gammaX]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `edgeX V X = {}` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[Bump.EDGE_IMP_K2;Bump.MCELL1;arith `1 <= 1`]); + REWRITE_TAC[SUM_CLAUSES;Pack_defs.total_solid;arith `x + y* &0 = x`]; + REPEAT AP_TERM_TAC; + TYPIFY `VX V X = {EL 0 ul}` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[SUM_SING]); + REWRITE_TAC[EL]; + MATCH_MP_TAC SUBSET_ANTISYM; + CONJ_TAC; + MATCH_MP_TAC SUBSET_TRANS; + TYPIFY `V INTER X` EXISTS_TAC; + CONJ_TAC; + MATCH_MP_TAC Bump.HDTFNFZ_SUBSET; + BY(ASM_MESON_TAC[Bump.MCELL1]); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC Bump.V_CELL1_SINGLE; + BY(ASM_REWRITE_TAC[]); + GMATCH_SIMP_TAC Hdtfnfz.HDTFNFZ; + REWRITE_TAC[SUBSET;IN_SING;IN_INTER]; + CONJ_TAC; + BY(ASM_MESON_TAC[Bump.MCELL1]); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + CONJ2_TAC; + MATCH_MP_TAC Marchal_cells_3.HD_IN_MCELL; + BY(ASM_MESON_TAC[NEGLIGIBLE_EMPTY;arith `~(1=0)`;Bump.MCELL1]); + INTRO_TAC Packing3.BARV_SUBSET [`V`;`3`;`ul`]; + GMATCH_SIMP_TAC Bump.set_of_list4; + REWRITE_TAC[EL;SUBSET;IN_INSERT;NOT_IN_EMPTY]; + BY(ASM_MESON_TAC[IN;Sphere.BARV;arith `3 + 1 = 4`]) + ]);; + (* }}} *) + +let MCELL2_VX_PROPS = prove_by_refinement( + `!V X ul. saturated V /\ packing V /\ barV V 3 ul /\ (X = mcell2 V ul) /\ ~(NULLSET X) ==> + (VX V X = {EL 0 ul,EL 1 ul}) /\ ~(EL 0 ul = EL 1 ul) /\ (edgeX V X = {{EL 0 ul, EL 1 ul}})`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.gammaX]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `VX V X = {EL 0 ul, EL 1 ul}` (C SUBGOAL_THEN MP_TAC); + GMATCH_SIMP_TAC Bump.HDTFNFZ_ALT; + CONJ_TAC; + BY(ASM_MESON_TAC[Bump.MCELL2]); + ASM_REWRITE_TAC[Bump.MCELL2]; + GMATCH_SIMP_TAC Lepjbdj.LEPJBDJ; + ASM_REWRITE_TAC[arith `1 <= 2 /\ 2 <= 4 /\ 2 -1 = 1`]; + CONJ_TAC; + BY(ASM_MESON_TAC[NEGLIGIBLE_EMPTY;Bump.MCELL2]); + MATCH_MP_TAC Bump.SET_OF_LIST_TRUNCATE_1; + BY(ASM_MESON_TAC[Sphere.BARV;IN;arith `2 <= 3 + 1`]); + DISCH_TAC; + TYPIFY `~(EL 0 ul = EL 1 ul)` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC Marchal_cells_3.BARV_CARD_LEMMA [`V`;`ul`;`3`]; + ASM_REWRITE_TAC[arith ` 3 + 1 = 4`]; + GMATCH_SIMP_TAC Bump.set_of_list4; + CONJ_TAC; + BY(ASM_MESON_TAC[IN;Sphere.BARV;arith `3 + 1 = 4`]); + BY(MESON_TAC[Marchal_cells_2_new.CARD4_IMP_DISTINCT]); + DISCH_TAC; + TYPIFY `edgeX V X = {{EL 0 ul, EL 1 ul}}` (C SUBGOAL_THEN MP_TAC); + REWRITE_TAC[Pack_defs.edgeX]; + REWRITE_TAC[GSYM SUBSET_ANTISYM_EQ]; + TYPIFY `!w. VX V X w <=> w IN VX V X` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(SET_TAC[]); + CONJ_TAC; + ASM_REWRITE_TAC[SUBSET;IN_INSERT;IN_SING;IN_ELIM_THM]; + REBIND_TAC (`x:real^3->bool`,"A"); + GEN_TAC; + REPEAT WEAK_STRIP_TAC; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[]); + BY(ASM_REWRITE_TAC[] THEN SET_TAC[]); + BY(ASM_MESON_TAC[]); + REWRITE_TAC[SUBSET]; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MP_TAC; + BY(SET_TAC[]); + BY(ASM_SIMP_TAC[]) + ]);; + (* }}} *) + +let GAMMAX_MCELL2 = prove_by_refinement( + `!V X ul. saturated V /\ packing V /\ barV V 3 ul /\ (X = mcell2 V ul) /\ ~(NULLSET X) ==> + gammaX V X lmfun = vol X - (&2 * mm1 /pi) * (sol (EL 0 ul) X + sol (EL 1 ul) X) + + (&8*mm2/ pi) * lmfun (hl [EL 0 ul;EL 1 ul]) * dihX V X (EL 0 ul,EL 1 ul)`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.gammaX]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `X IN mcell_set V` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[Pack_defs.mcell_set;Bump.MCELL2;IN_ELIM_THM]; + BY(ASM_MESON_TAC[IN;Bump.MCELL2]); + INTRO_TAC MCELL2_VX_PROPS [`V`;`X`;`ul`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAK_STRIP_TAC; + TYPIFY `total_solid V X = (sol (EL 0 ul) X + sol (EL 1 ul) X)` (C SUBGOAL_THEN SUBST1_TAC); + ASM_REWRITE_TAC[Pack_defs.total_solid]; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Geomdetail.SUM_DIS2; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[IN_SING;SUM_SING]; + GMATCH_SIMP_TAC Marchal_cells_3.BETA_PAIR_THM; + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Pack_defs.HL;Bump.set_of_list2_explicit]; + TYPIFY `{v,u} = {u,v}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + COND_CASES_TAC; + REWRITE_TAC[]; + AP_THM_TAC; + AP_TERM_TAC; + MATCH_MP_TAC Marchal_cells_3.DIHX_SYM; + BY(ASM_MESON_TAC[IN_SING;IN]); + BY(REWRITE_TAC[]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* renamed from RCONE_GT_BALL_PLANE *) + +let RCONE_GT_HYPERPLANE = prove_by_refinement( + `!v0 v1 b t (p:real^A) r. + p dot (v1 - v0) = b /\ ~(v1 = v0) /\ (&0 < t) /\ (b - v0 dot (v1 - v0) = r * t * dist(v1,v0)) ==> + (p IN rcone_gt v0 v1 t <=> p IN ball (v0,r))`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.rcone_gt;Sphere.rconesgn;ball;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `(p - v0) dot (v1 - v0) = p dot (v1 - v0) - v0 dot (v1 - v0)` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `dp * d * t > r * t * d <=> (&0 < d * t * (dp - r))`]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_REWRITE_TAC[GSYM DIST_NZ]; + BY(MESON_TAC[DIST_SYM;arith `&0 < x - y <=> y < x`]) + ]);; + (* }}} *) + +let RCONE_GE_HYPERPLANE = prove_by_refinement( + `!v0 v1 b t (p:real^A) r. + p dot (v1 - v0) = b /\ ~(v1 = v0) /\ (&0 < t) /\ (b - v0 dot (v1 - v0) = r * t * dist(v1,v0)) ==> + (p IN rcone_ge v0 v1 t <=> p IN cball (v0,r))`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.rcone_ge;Sphere.rconesgn;cball;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `(p - v0) dot (v1 - v0) = p dot (v1 - v0) - v0 dot (v1 - v0)` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `dp * d * t >= r * t * d <=> (&0 <= d * t * (dp - r))`]; + GMATCH_SIMP_TAC REAL_LE_MUL_EQ; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LE_MUL_EQ; + ASM_REWRITE_TAC[GSYM DIST_NZ]; + BY(MESON_TAC[DIST_SYM;arith `&0 <= x - y <=> y <= x`]) + ]);; + (* }}} *) + +(* renamed from BALL_DIFF_RCONE_GE *) + +let BALL_DIFF_RCONE_GT = prove_by_refinement( + `!u0 u1 (p:real^A) a r. + p IN ball(u0,r) DIFF rcone_gt u0 u1 a /\ &0 <= a ==> + p dot (u1 - u0) <= u0 dot (u1 - u0) + r * a * dist(u1,u0)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.rcone_gt;Sphere.rconesgn;ball;IN_ELIM_THM;IN_DIFF;arith `~(x > y) <=> (x <= y)`]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `dot` MP_TAC; + TYPIFY `(p - u0) dot (u1 - u0) = p dot (u1 - u0) - u0 dot (u1 - u0)` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + TYPIFY `dist (p,u0) * dist (u1,u0) * a <= r * a * dist(u1,u0)` ENOUGH_TO_SHOW_TAC; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC (arith `&0 <= (r - dp) * d1 * a ==> dp * d1 * a <= r * a * d1`); + GMATCH_SIMP_TAC REAL_LE_MUL; + CONJ_TAC; + BY(ASM_MESON_TAC [arith `d < r ==> &0 <= r - d`;DIST_SYM]); + GMATCH_SIMP_TAC REAL_LE_MUL; + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[DIST_POS_LE]) + ]);; + (* }}} *) + +(* renamed from BALL_DIFF_RCONE_GT_BISECTOR *) + +let BALL_DIFF_RCONE_GT_BISECTOR = prove_by_refinement( + `!u0 u1 (p:real^A) r h. + p IN ball(u0,r) DIFF rcone_gt u0 u1 (h/r) /\ &2 * h = dist(u1,u0) /\ &0 < r ==> + dist(p,u0) <= dist(p,u1)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC BALL_DIFF_RCONE_GT [`u0`;`u1`;`p`;`h/r`;`r`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + GMATCH_SIMP_TAC REAL_LE_RDIV_EQ; + ASM_REWRITE_TAC[arith `&0 * x = &0`]; + ONCE_REWRITE_TAC[arith `&0 <= h <=> &0 <= &2 * h`]; + BY(ASM_MESON_TAC[DIST_POS_LE]); + TYPIFY `r * h / r * dist(u1,u0) = (dist(u1,u0)) pow 2 / &2` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM (SUBST1_TAC o SYM); + Calc_derivative.CALC_ID_TAC; + BY((FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REWRITE_TAC[Leaf_cell.DIST_LE_HALF_PLANE]; + REWRITE_TAC[Collect_geom.DIST_POW2_DOT]; + MATCH_MP_TAC (arith `&2 * a + c - b - &2 * b1 = &0 ==> (a <= b1 + b / &2 ==> &0 <= c)`); + BY(VECTOR_ARITH_TAC) + ]);; + (* }}} *) + +let MCELL1_EXPLICIT = prove_by_refinement( + `!V X ul. saturated V /\ packing V /\ barV V 3 ul /\ (X = mcell1 V ul) /\ ~(NULLSET X) ==> + (X = rogers V ul INTER cball (HD ul,sqrt (&2)) DIFF + rcone_gt (HD ul) (HD (TL ul)) (hl (truncate_simplex 1 ul) / sqrt (&2)))`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.mcell1]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `sqrt (&2) <= hl ul` (C SUBGOAL_THEN ASSUME_TAC); + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `rogers` MP_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[NEGLIGIBLE_EMPTY]); + FIRST_X_ASSUM_ST `rogers` MP_TAC; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let MCELL1_VOL_RESTRICT = prove_by_refinement( + `!V X ul. saturated V /\ packing V /\ barV V 3 ul /\ (X = mcell1 V ul) /\ ~(NULLSET X) ==> + vol X = vol (X INTER ball(EL 0 ul, sqrt(&2)))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `measurable X /\ measurable (X INTER ball(EL 0 ul, sqrt(&2)))` (C SUBGOAL_THEN ASSUME_TAC); + SUBCONJ_TAC; + BY(ASM_MESON_TAC[Urrphbz1.MEASURABLE_MCELL;Bump.MCELL1]); + DISCH_TAC; + MATCH_MP_TAC MEASURABLE_INTER; + BY(ASM_REWRITE_TAC[MEASURABLE_BALL]); + MATCH_MP_TAC Vol1.VOLUME_PROPS_SDIFF; + ASM_REWRITE_TAC[SDIFF]; + MATCH_MP_TAC (CONJUNCT2 NULLSET_RULES); + CONJ2_TAC; + TYPIFY `!x. (x = {}) ==> NULLSET x` ENOUGH_TO_SHOW_TAC; + DISCH_THEN MATCH_MP_TAC; + BY(SET_TAC[]); + BY(MESON_TAC[NEGLIGIBLE_EMPTY]); + TYPIFY `X DIFF (X INTER ball(EL 0 ul,sqrt(&2))) SUBSET cball (EL 0 ul,sqrt(&2)) DIFF ball(EL 0 ul,sqrt(&2))` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `X SUBSET cball(EL 0 ul,sqrt(&2))` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + INTRO_TAC MCELL1_EXPLICIT [`V`;`X`;`ul`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[EL]; + BY(SET_TAC[]); + MATCH_MP_TAC NEGLIGIBLE_SUBSET; + FIRST_X_ASSUM MP_TAC; + TYPIFY `cball (EL 0 ul,sqrt(&2)) DIFF ball(EL 0 ul,sqrt(&2)) = {p | dist(EL 0 ul,p) = sqrt(&2)}` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[EXTENSION;cball;ball;IN_ELIM_THM;IN_DIFF]; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `{p | dist(EL 0 ul,p) = sqrt(&2) }` EXISTS_TAC; + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[NEGLIGIBLE_SPHERE]) + ]);; + (* }}} *) + +let MCELL1_SOL_RESTRICT = prove_by_refinement( + `!V X ul. saturated V /\ packing V /\ barV V 3 ul /\ (X = mcell1 V ul) /\ ~(NULLSET X) ==> + sol (EL 0 ul) X = sol (EL 0 ul) (X INTER ball(EL 0 ul, sqrt(&2)))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Urrphbz2.URRPHBZ2 [`V`;`ul`;`1`;`EL 0 ul`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC Packing3.BARV_SUBSET [`V`;`3`;`ul`]; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Bump.set_of_list4; + CONJ2_TAC; + BY(SET_TAC[]); + BY(ASM_MESON_TAC[Sphere.BARV;IN;arith `3 + 1 = 4`]); + REWRITE_TAC[Sphere.eventually_radial]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `?r'. (&0 < r' /\ r' <= r /\ r' <= sqrt(&2))` (C SUBGOAL_THEN ASSUME_TAC); + EXISTS_TAC `if (r <= sqrt(&2)) then r else sqrt(&2)`; + COND_CASES_TAC; + BY(ASM_SIMP_TAC[arith `r > &0 ==> &0 < r`;arith `r <= r`]); + ASM_SIMP_TAC[arith `s <= s`;arith `~(r <= s) ==> (s <= r)`]; + GMATCH_SIMP_TAC REAL_LT_RSQRT; + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM MP_TAC THEN WEAK_STRIP_TAC; + INTRO_TAC Conforming.RADIAL_NORM_CO [`r`;`r'`;`EL 0 ul`;`X`]; + ASM_REWRITE_TAC[GSYM Marchal_cells_2_new.RADIAL_VS_RADIAL_NORM;Bump.MCELL1;NORMBALL_BALL]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Vol1.sol [`EL 0 ul`;`X`;`r'`]; + INTRO_TAC Vol1.sol [`EL 0 ul`;`X INTER ball (EL 0 ul,sqrt(&2))`;`r'`]; + ASM_REWRITE_TAC[arith `r' > &0 <=> &0 < r'`;NORMBALL_BALL;INTER_ASSOC;GSYM Marchal_cells_2_new.RADIAL_VS_RADIAL_NORM;Bump.MCELL1]; + TYPIFY ` ball(EL 0 ul,sqrt(&2)) INTER ball(EL 0 ul,r') = ball(EL 0 ul,r')` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[ball;EXTENSION;IN_ELIM_THM;IN_INTER]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `measurable (mcell 1 V ul INTER ball (EL 0 ul,r'))` (C SUBGOAL_THEN ((unlist ASM_REWRITE_TAC))); + MATCH_MP_TAC MEASURABLE_INTER; + CONJ2_TAC; + BY(ASM_REWRITE_TAC[MEASURABLE_BALL]); + BY(ASM_MESON_TAC[Urrphbz1.MEASURABLE_MCELL;Bump.MCELL1]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let CONV_CONVEX_HULL = prove_by_refinement( + `!(s:real^A->bool). conv s = convex hull s`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Geomdetail.conv;aff_ge_def;CONVEX_HULL_AFF_GE]) + ]);; + (* }}} *) + +let CONVEX_HULL_4_AFF_GE = prove_by_refinement( + `!(w0:real^3) w1 w2 w3. ~coplanar {w0,w1, w2,w3} ==> + (convex hull {w0,w1,w2,w3} = aff_ge {w0} {w1,w2,w3} INTER aff_ge {w1,w2,w3} {w0})`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC DIMINDEX_3 []; + DISCH_TAC; + INTRO_TAC Collect_geom2.ARIKWRQ [`w0`;`w1`;`w2`;`w3`]; + REWRITE_TAC[LET_DEF;LET_END_DEF;CONV_CONVEX_HULL]; + TYPIFY `~coplanar_alt {w0,w1,w2,w3}` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Leaf_cell.coplanar_eq_coplanar_alt;arith `2 <= 3`]); + ASM_REWRITE_TAC[]; + TYPIFY `CARD {w0,w1,w2,w3} = 4` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Collect_geom2.NOT_COPLANAR_IMP_CARD4; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + TYPIFY `({w0,w1,w2,w3} DIFF {w0} = {w1,w2,w3}) /\ ({w0,w1,w2,w3} DIFF {w1} = {w0,w2,w3}) /\ ({w0,w1,w2,w3} DIFF {w2} = {w0,w3,w1} ) /\ ({w0,w1,w2,w3} DIFF {w3} = {w0,w1,w2})` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + FIRST_X_ASSUM (MP_TAC o (MATCH_MP Leaf_cell.CARD4_ALL_DISTINCT)); + BY(SET_TAC[]); + INTRO_TAC Cfyxfty.inter_aff_ge_3_1_is_aff_ge_1_3 [`w0`;`w1`;`w2`;`w3`]; + ASM_REWRITE_TAC[]; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let RADIAL_ALT = prove_by_refinement( + `!(x:real^A) r A. radial r x A <=> (A SUBSET ball(x,r) /\ + (!y t. &0 < t /\ y IN A /\ x + t % (y- x) IN ball(x,r) ==> x + t % (y - x) + IN A))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.radial]; + TYPIFY `A SUBSET ball(x,r)` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (TAUT `((a ==> b) /\ (b ==> a)) ==> (a = b)`); + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`y - (x:real^A)`]); + ANTS_TAC; + TYPIFY `x + y - x = (y:real^A)` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + BY(ASM_REWRITE_TAC[]); + DISCH_THEN (C INTRO_TAC [`t`]); + DISCH_THEN MATCH_MP_TAC; + ASM_SIMP_TAC[arith `&0 < t ==> t > &0`]; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[ball;IN_ELIM_THM;dist]; + TYPIFY `x - (x + t % (y - x)) = (-- t) % (y - x)` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + REWRITE_TAC[NORM_MUL]; + BY(ASM_SIMP_TAC[arith `&0 < t ==> abs (-- t) = t`]); + COMMENT "second direction"; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `ball` (C INTRO_TAC [`x + (u:real^A)`;`t`]); + TYPIFY `(x + u) - x = (u:real^A)` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + DISCH_THEN MATCH_MP_TAC; + ASM_SIMP_TAC[arith `t > &0 ==> &0 < t`]; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[ball;IN_ELIM_THM;dist;varith `x - (x + t % u) = (-- t) % (u:real^A)`;NORM_MUL]; + BY(ASM_SIMP_TAC[arith `t > &0 ==> abs(-- t) = t`]); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let CONVEX_HULL_SCALE = prove_by_refinement( + `!(w0:real^3) w1 w2 w3 w t. ~coplanar {w0,w1,w2,w3} /\ w IN convex hull {w0,w1,w2,w3} /\ &0 <= t /\ + (w0 + t % (w - w0) IN aff_ge {w1,w2,w3} {w0} ) ==> + (w0 + t % (w - w0) IN convex hull {w0,w1,w2,w3})`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ASM_SIMP_TAC[CONVEX_HULL_4_AFF_GE]; + REPEAT WEAK_STRIP_TAC; + ASM_SIMP_TAC[CONVEX_HULL_4_AFF_GE]; + ASM_REWRITE_TAC[IN_INTER]; + TYPIFY `DISJOINT {w0} {w1,w2,w3}` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Planarity.notcoplanar_disjoints]); + ASM_SIMP_TAC[ Planarity.AFF_GE_1_3]; + REWRITE_TAC[IN_ELIM_THM]; + FIRST_X_ASSUM_ST `convex` MP_TAC; + REWRITE_TAC[Marchal_cells_2_new.CONVEX_HULL_4;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + GEXISTL_TAC [`&1 + t * (u - &1)`;`t * v`;`t * w'`;`t * z`]; + GMATCH_SIMP_TAC REAL_LE_MUL; + GMATCH_SIMP_TAC REAL_LE_MUL; + GMATCH_SIMP_TAC REAL_LE_MUL; + ASM_REWRITE_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM_ST `&1` MP_TAC; + BY(CONV_TAC REAL_RING); + BY(VECTOR_ARITH_TAC) + ]);; + (* }}} *) + +let IMAGE_4_EXPLICIT = prove_by_refinement( + `!(f:num->B). { f i | i <= 3 } = {f 0 , f 1 ,f 2, f 3}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[EXTENSION;IN_ELIM_THM;IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[arith `i <= 3 <=> (i = 0 \/ i = 1 \/ i = 2 \/ i = 3)`]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let NULLSET_MCELL1 = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ ul IN barV V 3 /\ ~NULLSET (mcell1 V ul) ==> ~NULLSET (rogers V ul)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC MCELL1_EXPLICIT [`V`;`mcell1 V ul`;`ul`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[IN]); + DISCH_TAC; + TYPIFY `mcell1 V ul SUBSET rogers V ul` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM MP_TAC; + BY(SET_TAC[]); + BY(ASM_MESON_TAC[NEGLIGIBLE_SUBSET]) + ]);; + (* }}} *) + +let NOT_COPLANAR_OMEGA_LIST_N = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ ul IN barV V 3 /\ ~NULLSET (mcell1 V ul) ==> + ~coplanar { omega_list_n V ul i | i <= 3}`, + (* {{{ proof *) + [ + REWRITE_TAC[coplanar]; + REWRITE_TAC[IMAGE_4_EXPLICIT]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC NULLSET_MCELL1 [`V`;`ul`]; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC Marchal_cells_2_new.ROGERS_EXPLICIT; + REWRITE_TAC[GSYM Sphere.OMEGA_LIST_N]; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + TYPED_ABBREV_TAC `s = {omega_list_n V ul 0, omega_list_n V ul 1, omega_list_n V ul 2, omega_list_n V ul 3}`; + TYPIFY `convex hull s SUBSET affine hull {u,v,w}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SUBSET_TRANS; + TYPIFY `affine hull s` EXISTS_TAC; + REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]; + INTRO_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA [`s`;`affine hull {u,v,w}`]; + REWRITE_TAC[Planarity.AFFINE_HULL_AFFINE_EQ]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `convex hull s SUBSET affine hull {u,v,w}` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[NEGLIGIBLE_AFFINE_HULL_3;NEGLIGIBLE_SUBSET]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]) + ]);; + (* }}} *) + +let NOT_COPLANAR_R3 = prove_by_refinement( + `!s. ~coplanar s ==> affine hull s = (:real^3)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC AFF_DIM_EQ_FULL [`s`]; + INTRO_TAC AFF_DIM_LE_UNIV [`s`]; + REWRITE_TAC[DIMINDEX_3]; + BY(ASM_MESON_TAC[Rogers.AFF_DIM_LE_2_IMP_COPLANAR;INT_ARITH `~(x <= int_of_num 2) /\ x <= &3 ==> x = &3`]) + ]);; + (* }}} *) + +let BARV_DISTINCT = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ ul IN barV V 1 ==> + ~(EL 0 ul = EL 1 ul)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Packing3.TRUNCATE_SIMPLEX_BARV [`V`;`0`;`1`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN;arith `0 <= 1`]); + FIRST_X_ASSUM_ST `barV` MP_TAC; + REWRITE_TAC[Sphere.BARV;IN;Sphere.VORONOI_NONDG]; + REWRITE_TAC[Sphere.VORONOI_LIST;Sphere.VORONOI_SET]; + REPEAT WEAK_STRIP_TAC; + (FIRST_X_ASSUM (C INTRO_TAC [`truncate_simplex 0 ul`])); + (FIRST_X_ASSUM (C INTRO_TAC [`ul`])); + ASM_REWRITE_TAC[Packing3.INITIAL_SUBLIST_REFL;arith `0 < 1 + 1 /\ 0 < 0 + 1 /\ 1 + 1 < 5 /\ 0 + 1 < 5`]; + REWRITE_TAC[arith `1 + 1 = 2 /\ 0 + 1 = 1`]; + TYPIFY `set_of_list (truncate_simplex 0 ul) = set_of_list ul` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(INT_ARITH_TAC); + GMATCH_SIMP_TAC Packing3.TRUNCATE_0_EQ_HEAD; + REWRITE_TAC[set_of_list]; + GMATCH_SIMP_TAC Bump.set_of_list2; + FIRST_X_ASSUM SUBST1_TAC; + FIRST_X_ASSUM SUBST1_TAC; + FIRST_X_ASSUM (SUBST1_TAC o GSYM); + REWRITE_TAC[arith `1 + 1 = 2 /\ 1 <= 1 + 1`;EL]; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let OMEGA_LIST_BISECTOR = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ ul IN barV V 3 /\ ~NULLSET (mcell1 V ul) ==> + aff_ge {omega_list_n V ul 1, omega_list_n V ul 2, omega_list_n V ul 3} {EL 0 ul} = + bis_le (EL 0 ul) (EL 1 ul)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.bis_le;EXTENSION;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC NOT_COPLANAR_OMEGA_LIST_N [`V`;`ul`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[IMAGE_4_EXPLICIT]; + REWRITE_TAC[Sphere.OMEGA_LIST_N;GSYM EL]; + DISCH_TAC; + GMATCH_SIMP_TAC Cfyxfty.AFF_GE_3_1; + SUBCONJ_TAC; + ONCE_REWRITE_TAC[DISJOINT_SYM]; + BY(ASM_MESON_TAC[Planarity.notcoplanar_disjoints]); + DISCH_TAC; + REWRITE_TAC[IN_ELIM_THM]; + TYPIFY `!t1 t2 t3 t4. t1 + t2 + t3 + t4 = &1 /\ x = t1 % omega_list_n V ul 1 + t2 % omega_list_n V ul 2 + t3 % omega_list_n V ul 3 + t4 % EL 0 ul ==> (&0 <= t4 <=> dist(x,EL 0 ul) <= dist(x, EL 1 ul))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC (TAUT `((a ==> b) /\ (b ==> a)) ==> (a = b)`); + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + TYPIFY `!a b c d. {a,b,c,d} = {b,c,d,(a:real^3)}` (C SUBGOAL_THEN (unlist ONCE_REWRITE_TAC)); + BY(SET_TAC[]); + DISCH_THEN (MP_TAC o (MATCH_MP NOT_COPLANAR_R3)); + REWRITE_TAC[Collect_geom2.AFFINE_HULL_4;EXTENSION;IN_UNIV;IN_ELIM_THM]; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + TYPIFY `dist(omega_list_n V ul 1,EL 0 ul) = dist(omega_list_n V ul 1,EL 1 ul) /\ dist(omega_list_n V ul 2,EL 0 ul) = dist(omega_list_n V ul 2,EL 1 ul) /\ dist(omega_list_n V ul 3,EL 0 ul) = dist(omega_list_n V ul 3,EL 1 ul)` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN [`V`;`ul`;`3`;`1`]; + DISCH_TAC; + FIRST_ASSUM (C INTRO_TAC [`1`]); + FIRST_ASSUM (C INTRO_TAC [`2`]); + FIRST_X_ASSUM (C INTRO_TAC [`3`]); + ASM_REWRITE_TAC[arith `1 <= 3 /\ 3 <= 3 /\ 1 <= 2 /\ 2 <= 3 /\ 1 <= 1`]; + TYPIFY `barV V 3 ul` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(ASM_MESON_TAC[IN]); + INTRO_TAC Leaf_cell.VORONOI_LIST_EQ [`V`;`truncate_simplex 1 ul`]; + TYPIFY `set_of_list (truncate_simplex 1 ul) = {EL 0 ul, EL 1 ul}` (C SUBGOAL_THEN SUBST1_TAC); + MATCH_MP_TAC Bump.SET_OF_LIST_TRUNCATE_1; + BY(ASM_MESON_TAC[Sphere.BARV;IN;arith `2 <= 3 + 1`]); + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + ONCE_REWRITE_TAC[MESON[] `(!x y. P x y) = !y x. P x y`]; + DISCH_THEN (C INTRO_TAC [`1`]); + TYPIFY `barV V 1 (truncate_simplex 1 ul)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV; + EXISTS_TAC `3`; + BY(ASM_MESON_TAC[IN;arith `1 <= 3`]); + BY(MESON_TAC[]); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Leaf_cell.DIST_EQ_HALF_PLANE]; + ASM_REWRITE_TAC[Leaf_cell.DIST_LE_HALF_PLANE]; + TYPED_ABBREV_TAC `(n:real^3) = (EL 0 ul - EL 1 ul)`; + TYPED_ABBREV_TAC `(m:real^3) = (EL 0 ul + EL 1 ul)`; + TYPIFY `n dot (&2 % (t1 % omega_list_n V ul 1 + t2 % omega_list_n V ul 2 + t3 % omega_list_n V ul 3 + t4 % EL 0 ul) - m) = t1 * n dot (&2 % omega_list_n V ul 1 - m) + t2 * n dot (&2 % omega_list_n V ul 2 - m) + t3 * n dot (&2 % omega_list_n V ul 3 - m) + t4 * n dot (&2 % EL 0 ul - m)` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM (MP_TAC o (MATCH_MP (arith `t1 + t2 + t3 + t4 = &1 ==> t4 = &1 - t1 - t2 - t3`))); + DISCH_THEN SUBST1_TAC; + BY(VECTOR_ARITH_TAC); + DISCH_THEN ((unlist REWRITE_TAC) o GSYM); + REWRITE_TAC[arith `x * &0 = &0 /\ &0 + x = x`]; + MATCH_MP_TAC (TAUT `((a ==> b) /\ (b ==> a)) ==> (a = b)`); + CONJ_TAC; + DISCH_TAC; + GMATCH_SIMP_TAC REAL_LE_MUL; + ASM_REWRITE_TAC[]; + EXPAND_TAC "n"; + EXPAND_TAC "m"; + BY(REWRITE_TAC[GSYM Leaf_cell.DIST_LE_HALF_PLANE;DIST_REFL;DIST_POS_LE]); + COMMENT "other direction"; + TYPIFY `&0 < (n dot (&2 % EL 0 ul - m))` ENOUGH_TO_SHOW_TAC; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC Real_ext.REAL_PROP_NN_RCANCEL; + BY(ASM_MESON_TAC[]); + EXPAND_TAC "n"; + EXPAND_TAC "m"; + REWRITE_TAC[GSYM Collect_geom.DIST_LT_HALF_PLANE]; + REWRITE_TAC[DIST_REFL]; + MATCH_MP_TAC DIST_POS_LT; + INTRO_TAC BARV_DISTINCT [`V`;`truncate_simplex 1 ul`]; + ANTS_TAC; + ASM_REWRITE_TAC[IN]; + MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV; + BY(ASM_MESON_TAC[IN;arith `1 <= 3`]); + REPEAT (GMATCH_SIMP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + BY(ASM_MESON_TAC[arith `1 + 1 <= 3 + 1 /\ 1 <= 1 /\ 0 <= 1`;IN;Sphere.BARV]) + ]);; + (* }}} *) + +let DIFF_INTER = prove_by_refinement( + `!(X:A->bool) Y Z. (X DIFF Y) INTER Z = (X INTER Z) DIFF Y`, + (* {{{ proof *) + [ + BY(SET_TAC[]) + ]);; + (* }}} *) + +let RCONE_GT_SCALE = prove_by_refinement( + `!u0 u1 (u:real^A) a t. &0 < t /\ u0 + u IN rcone_gt u0 u1 a ==> u0 + t % u IN rcone_gt u0 u1 a`, + (* {{{ proof *) + [ + REWRITE_TAC[rcone_gt;rconesgn;IN_ELIM_THM;dist]; + REWRITE_TAC[varith `!(v:real^A). (u0 + v) - u0 = v`]; + REWRITE_TAC[NORM_MUL;DOT_LMUL;arith `x > y <=> y < x`]; + REPEAT WEAK_STRIP_TAC; + ASM_SIMP_TAC[arith `&0 < t ==> abs t = t`]; + REWRITE_TAC[GSYM REAL_MUL_ASSOC]; + GMATCH_SIMP_TAC REAL_LT_LMUL_EQ; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let BARV3_TRUNC1 = prove_by_refinement( + `!V ul. ul IN barV V 3 ==> truncate_simplex 1 ul = [EL 0 ul;EL 1 ul]`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `ul = [EL 0 ul;EL 1 ul; EL 2 ul; EL 3 ul]` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Bump.LENGTH4; + BY(ASM_MESON_TAC[IN;Sphere.BARV;arith `3+1 = 4`]); + BY(ASM_MESON_TAC[Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_1]) + ]);; + (* }}} *) + +let MCELL1_RADIAL = prove_by_refinement( + `!V X ul. saturated V /\ packing V /\ barV V 3 ul /\ (X = mcell1 V ul) /\ ~(NULLSET X) ==> + radial (sqrt(&2)) (EL 0 ul) (X INTER ball(EL 0 ul,sqrt (&2))) +`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Sphere.radial]; + CONJ_TAC; + BY(SET_TAC[]); + ASM_REWRITE_TAC[]; + INTRO_TAC MCELL1_EXPLICIT [`V`;`mcell1 V ul`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[Bump.MCELL1]; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC [GSYM EL]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `ball (EL 0 ul,sqrt(&2)) SUBSET cball(EL 0 ul,sqrt(&2))` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[BALL_SUBSET_CBALL]); + FIRST_X_ASSUM_ST `rogers` MP_TAC; + TYPIFY `((rogers V ul INTER cball (EL 0 ul,sqrt(&2))) DIFF rcone_gt (EL 0 ul) (EL (SUC 0) ul) (hl (truncate_simplex 1 ul) / sqrt (&2))) INTER ball (EL 0 ul,sqrt (&2)) = (rogers V ul INTER ball (EL 0 ul,sqrt(&2))) DIFF rcone_gt (EL 0 ul) (EL (SUC 0) ul) (hl (truncate_simplex 1 ul) / sqrt (&2))` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[GSYM DIFF_INTER]; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[ INTER_ASSOC]; + BY(SET_TAC[]); + REWRITE_TAC[IN_INTER;IN_DIFF]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `~(EL 0 ul = EL 1 ul)` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC BARV_DISTINCT [`V`;`truncate_simplex 1 ul`]; + ANTS_TAC; + ASM_REWRITE_TAC[IN]; + MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV; + BY(ASM_MESON_TAC[IN;arith `1 <= 3`]); + REPEAT (GMATCH_SIMP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + BY(ASM_MESON_TAC[arith `1 + 1 <= 3 + 1 /\ 1 <= 1 /\ 0 <= 1`;IN;Sphere.BARV]); + MATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`); + SUBCONJ_TAC; + REPEAT (FIRST_X_ASSUM_ST `SUC` MP_TAC); + REWRITE_TAC[arith `SUC 0 = 1`]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `~` MP_TAC; + REWRITE_TAC[]; + TYPIFY `EL 0 ul + u = (EL 0 ul + (&1/t) % (t % u))` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[VECTOR_MUL_ASSOC]; + TYPIFY `(&1 / t) * t = &1` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(VECTOR_ARITH_TAC); + Calc_derivative.CALC_ID_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + MATCH_MP_TAC RCONE_GT_SCALE; + GMATCH_SIMP_TAC REAL_LT_DIV; + ASM_REWRITE_TAC[]; + BY(ASM_REWRITE_TAC[arith `&0 < &1 /\ ( &0 < t <=> t > &0)`]); + COMMENT "down to 1"; + DISCH_TAC; + MATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`); + SUBCONJ_TAC; + REWRITE_TAC[ball;IN_ELIM_THM;dist]; + TYPIFY `!u v. (u:real^3) - (u + t % v) = (-- t) % v` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(VECTOR_ARITH_TAC); + REWRITE_TAC[NORM_MUL]; + BY(ASM_SIMP_TAC[arith `t > &0 ==> abs(-- t) = t`]); + DISCH_TAC; + COMMENT "last goal"; + FIRST_X_ASSUM_ST `rogers` MP_TAC; + REPEAT (GMATCH_SIMP_TAC Marchal_cells_2_new.ROGERS_EXPLICIT); + ASM_REWRITE_TAC[GSYM EL]; + TYPED_ABBREV_TAC `(w:real^3) = EL 0 ul + u`; + TYPIFY `t % u = t % (w - EL 0 ul)` (C SUBGOAL_THEN SUBST1_TAC); + EXPAND_TAC "w"; + BY(VECTOR_ARITH_TAC); + DISCH_TAC; + MATCH_MP_TAC CONVEX_HULL_SCALE; + ASM_SIMP_TAC[arith `t > &0 ==> &0 <= t`]; + SUBCONJ_TAC; + INTRO_TAC NOT_COPLANAR_OMEGA_LIST_N [`V`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + REWRITE_TAC[IMAGE_4_EXPLICIT]; + BY(MESON_TAC[Sphere.OMEGA_LIST_N;EL]); + DISCH_TAC; + GMATCH_SIMP_TAC OMEGA_LIST_BISECTOR; + ASM_REWRITE_TAC[IN]; + INTRO_TAC BALL_DIFF_RCONE_GT_BISECTOR [`EL 0 ul`;`EL 1 ul`;`EL 0 ul + t % u`;`sqrt(&2)`;`hl(truncate_simplex 1 ul)`]; + ANTS_TAC; + ASM_REWRITE_TAC[IN_DIFF]; + CONJ_TAC; + BY(ASM_MESON_TAC[arith `1 = SUC 0`]); + CONJ2_TAC; + GMATCH_SIMP_TAC REAL_LT_RSQRT; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC BARV3_TRUNC1; + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + ONCE_REWRITE_TAC[DIST_SYM]; + REWRITE_TAC[Marchal_cells_3.HL_2]; + BY(REAL_ARITH_TAC); + REWRITE_TAC[Sphere.bis_le;IN_ELIM_THM]; + REWRITE_TAC[dist]; + EXPAND_TAC "w"; + REWRITE_TAC[arith `!u v. (u + w) - u = (w:real^3)`]; + DISCH_THEN (unlist REWRITE_TAC); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let MCELL1_VOL = prove_by_refinement( + `!V X ul. saturated V /\ packing V /\ barV V 3 ul /\ (X = mcell1 V ul) /\ ~(NULLSET X) ==> + vol X = (sqrt(&2) pow 3 / &3) * sol (EL 0 ul) X`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC MCELL1_VOL_RESTRICT [`V`;`X`;`ul`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + INTRO_TAC MCELL1_SOL_RESTRICT [`V`;`X`;`ul`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + INTRO_TAC MCELL1_RADIAL [`V`;`X`;`ul`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + GMATCH_SIMP_TAC Vol1.sol_spec; + EXISTS_TAC `sqrt(&2)`; + REWRITE_TAC[GSYM CONJ_ASSOC]; + CONJ_TAC; + REWRITE_TAC[arith `x > y <=> y < x`]; + GMATCH_SIMP_TAC REAL_LT_RSQRT; + BY(REAL_ARITH_TAC); + CONJ_TAC; + REWRITE_TAC[INTER_ASSOC;INTER_IDEMPOT]; + MATCH_MP_TAC MEASURABLE_INTER; + REWRITE_TAC[MEASURABLE_BALL;Bump.MCELL1;]; + MATCH_MP_TAC Urrphbz1.MEASURABLE_MCELL; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[INTER_ASSOC;INTER_IDEMPOT]; + Calc_derivative.CALC_ID_TAC; + GMATCH_SIMP_TAC SQRT_EQ_0; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let HJKDESR1a_1cell = prove_by_refinement( + `&0 < &8 * pi * sqrt2 / &3 - &8 * mm1 `, + (* {{{ proof *) + [ + REWRITE_TAC[ arith `&8 * pi * sqrt2 / &3 = (&8 / &3) * (pi * sqrt2)`]; + MATCH_MP_TAC (arith `&3 * mm1 < z ==> &0 < (&8/ &3) * z - &8 * mm1`); + MATCH_MP_TAC REAL_LT_TRANS; + EXISTS_TAC (`&3 * #1.3`); + GMATCH_SIMP_TAC REAL_LT_LMUL_EQ; + GMATCH_SIMP_TAC REAL_LT_MUL2; + MP_TAC Flyspeck_constants.bounds; + BY(REAL_ARITH_TAC) + ]);; + +let TSKAJXY_1 = prove_by_refinement( + `!V ul. saturated V /\ packing V /\ barV V 3 ul ==> + gammaX V (mcell1 V ul) lmfun >= &0 `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ASM_CASES_TAC `NULLSET (mcell1 V ul)`; + BY(ASM_MESON_TAC[GAMMAX_NULLSET;arith `x = &0 ==> x >= &0`;Bump.MCELL1]); + GMATCH_SIMP_TAC GAMMAX_MCELL1; + TYPIFY `ul` EXISTS_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC MCELL1_VOL [`V`;`mcell1 V ul`;`ul`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `sol (EL 0 ul) (mcell1 V ul) = (&3 / sqrt(&2) pow 3) * vol (mcell1 V ul)` (C SUBGOAL_THEN SUBST1_TAC); + ASM_REWRITE_TAC[]; + Calc_derivative.CALC_ID_TAC; + GMATCH_SIMP_TAC SQRT_EQ_0; + BY(REAL_ARITH_TAC); + REWRITE_TAC[arith `b - c * d* b = (&1 - c* d) * b`;arith `x >= &0 <=> &0 <= x`]; + GMATCH_SIMP_TAC REAL_LE_MUL; + CONJ2_TAC; + REWRITE_TAC[arith `&0 <= x <=> x >= &0`]; + MATCH_MP_TAC Vol1.VOLUME_PROPS_MEASURABLE; + REWRITE_TAC[Bump.MCELL1]; + MATCH_MP_TAC Urrphbz1.URRPHBZ1; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC HJKDESR1a_1cell []; + SUBGOAL_THEN `!x y. (x = (&8 * pi * sqrt(&2) / &3) * y) ==> (&0 < x ==> &0 <= y)` MATCH_MP_TAC; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[]; + DISCH_THEN (MP_TAC o (MATCH_MP (arith `&0 < x ==> &0 <= x`))); + DISCH_TAC; + MATCH_MP_TAC Real_ext.REAL_PROP_NN_LCANCEL; + TYPIFY `(&8 * pi * sqrt (&2) / &3)` EXISTS_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REWRITE_TAC[ REAL_OF_NUM_LT]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_DIV; + REWRITE_TAC[ REAL_OF_NUM_LT]; + GMATCH_SIMP_TAC REAL_LT_RSQRT; + REWRITE_TAC[PI_POS]; + CONJ_TAC; + BY(REAL_ARITH_TAC); + BY(ARITH_TAC); + Calc_derivative.CALC_ID_TAC; + ASM_SIMP_TAC[PI_POS;arith `&0 < x ==> ~(x = &0)`;arith `~(&3= &0)`]; + GMATCH_SIMP_TAC SQRT_EQ_0; + REWRITE_TAC[Sphere.sqrt2]; + CONJ_TAC; + BY(REAL_ARITH_TAC); + CONJ_TAC; + BY(REAL_ARITH_TAC); + TYPIFY `sqrt(&2) pow 3 = &2 * sqrt(&2)` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[arith `3 = SUC 2`;real_pow]; + GMATCH_SIMP_TAC SQRT_POW_2; + BY(REAL_ARITH_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let MCELL_CELL_PARAMETERS_D_EXIST = prove_by_refinement( + `!V ul vl k X. (k <= 4) /\ packing V /\ saturated V /\ (X = mcell k V ul) /\ ul IN barV V 3 /\ + initial_sublist vl ul /\ + ~NULLSET X ==> + FST (cell_params_d V X vl) = k`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.cell_params_d]; + REPEAT WEAK_STRIP_TAC; + SELECT_TAC THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN (REWRITE_TAC[Bump.BETA_ORDERED_PAIR_THM]); + INTRO_TAC Ajripqn.AJRIPQN [`V`;`ul`;`SND t`;`k`;`FST t`]; + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY;arith `x = 0 \/ x = 1 \/ x = 2 \/ x = 3 \/ x = 4 <=> x <= 4`]; + REWRITE_TAC[IN]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `==>` MP_TAC; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[INTER_IDEMPOT]); + BY(DISCH_THEN (unlist REWRITE_TAC)); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[NOT_EXISTS_THM]; + DISCH_THEN (C INTRO_TAC [`k,ul`]); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let INITIAL_SUBLIST_2 = prove_by_refinement( + `!ul. LENGTH ul = 4 ==> initial_sublist [EL 0 (ul:(A)list);EL 1 ul] ul`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Bump.LENGTH4 [`ul`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + TYPIFY `ul = APPEND [EL 0 ul;EL 1 ul] [EL 2 ul;EL 3 ul]` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[Packing3.INITIAL_SUBLIST_APPEND]); + REWRITE_TAC[APPEND]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let MCELL2_CELL_PARAMETERS_EXIST = prove_by_refinement( + `!V ul X. packing V /\ saturated V /\ (X = mcell2 V ul) /\ ul IN barV V 3 /\ ~NULLSET X ==> + FST (cell_params_d V X [EL 0 ul;EL 1 ul]) = 2`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC THEN MATCH_MP_TAC MCELL_CELL_PARAMETERS_D_EXIST THEN ASM_REWRITE_TAC[Bump.MCELL2;arith `2 <= 4`]; + TYPIFY `ul` EXISTS_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC INITIAL_SUBLIST_2; + BY(ASM_MESON_TAC[Sphere.BARV;IN;arith `3 + 1 = 4`]) + ]);; + (* }}} *) + +let MCELL_PARAM_D_UL = prove_by_refinement( + `!V ul ul' vl X k. (k<= 4) /\ packing V /\ saturated V /\ (X = mcell k V ul) /\ ul IN barV V 3 /\ ~NULLSET X /\ + initial_sublist ul' ul /\ + vl = SND (cell_params_d V X ul') ==> + (X = mcell k V vl /\ vl IN barV V 3 /\ initial_sublist ul' vl)`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.cell_params_d]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC MCELL_CELL_PARAMETERS_D_EXIST [`V`;`ul`;`ul'`;`k`;`X`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[Pack_defs.cell_params_d]; + Bump.WEAK_SELECT_TAC THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN (REWRITE_TAC[Bump.BETA_ORDERED_PAIR_THM]); + Bump.WEAK_SELECT_TAC THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN (REWRITE_TAC[Bump.BETA_ORDERED_PAIR_THM]); + REPEAT WEAK_STRIP_TAC; + CONJ_TAC; + BY(MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[NOT_EXISTS_THM]; + DISCH_THEN (C INTRO_TAC [`k,ul`]); + BY(ASM_MESON_TAC[FST;SND]) + ]);; + (* }}} *) + +let MCELL2_PARAM_D_UL = prove_by_refinement( + `!V ul ul' vl X. packing V /\ saturated V /\ (X = mcell2 V ul) /\ ul IN barV V 3 /\ ~NULLSET X /\ + initial_sublist ul' ul /\ + vl = SND (cell_params_d V X ul') ==> + (X = mcell2 V (vl) /\ vl IN barV V 3 /\ initial_sublist ul' vl)`, + (* {{{ proof *) + [ + REWRITE_TAC[Bump.MCELL2]; + REPEAT WEAK_STRIP_TAC THEN MATCH_MP_TAC MCELL_PARAM_D_UL; + BY(ASM_MESON_TAC[arith `2 <= 4`]) + ]);; + (* }}} *) + +let MCELL2_DIHX = prove_by_refinement( + `!V X ul. saturated V /\ packing V /\ barV V 3 ul /\ (X = mcell2 V ul) /\ ~(NULLSET X) ==> + dihX V X (EL 0 ul, EL 1 ul) = dihV (EL 0 ul) (EL 1 ul) (mxi V ul) (omega_list_n V ul 3)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[Pack_defs.dihX;Pack_defs.dihu2;LET_DEF;LET_END_DEF;Bump.BETA_ORDERED_PAIR_THM]; + GMATCH_SIMP_TAC MCELL2_CELL_PARAMETERS_EXIST; + ASM_REWRITE_TAC[IN]; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + TYPED_ABBREV_TAC `(vl:(real^3)list) = SND (cell_params_d V (mcell2 V ul) [EL 0 ul; EL 1 ul])`; + INTRO_TAC MCELL2_PARAM_D_UL [`V`;`ul`;`[EL 0 ul;EL 1 ul]`;`vl`;`X`]; + ASM_REWRITE_TAC[IN]; + ANTS_TAC; + MATCH_MP_TAC INITIAL_SUBLIST_2; + BY(ASM_MESON_TAC[Sphere.BARV;IN;arith `3 + 1 = 4`]); + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Marchal_cells_3.MCELL_ID_OMEGA_LIST_N [`V`;`2`;`2`;`ul`;`vl`]; + ANTS_TAC; + ASM_REWRITE_TAC[IN_INSERT]; + BY(ASM_MESON_TAC[Bump.MCELL2]); + REWRITE_TAC[arith `2 = 2`;arith `2 - 1 = 1`]; + DISCH_THEN (C INTRO_TAC [`3`]); + REWRITE_TAC[arith `1 <= 3 /\ 3 <= 3`]; + DISCH_THEN SUBST1_TAC; + INTRO_TAC Marchal_cells_3.MCELL_ID_MXI_2 [`V`;`2`;`2`;`ul`;`vl`]; + ANTS_TAC; + ASM_REWRITE_TAC[IN_INSERT]; + BY(ASM_MESON_TAC[Bump.MCELL2]); + DISCH_THEN SUBST1_TAC; + INTRO_TAC INITIAL_SUBLIST_2 [`vl`]; + ANTS_TAC; + BY(ASM_MESON_TAC[Sphere.BARV;arith `3 + 1 = 4`]); + DISCH_TAC; + INTRO_TAC Packing3.INITIAL_SUBLIST_UNIQUE [`2`;`[EL 0 ul;EL 1 ul]`;`[EL 0 vl;EL 1 vl]`;`vl`]; + ASM_REWRITE_TAC[LENGTH;arith `SUC (SUC 0) = 2`]; + REWRITE_TAC[CONS_11]; + BY(DISCH_THEN (unlist REWRITE_TAC)) + ]);; + (* }}} *) + +let BIS_LE_INTER = prove_by_refinement( + `!u0 (u1:real^A). bis_le u0 u1 INTER bis_le u1 u0 = bis u0 u1`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.bis_le;EXTENSION;IN_ELIM_THM;IN_INTER;Sphere.bis]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let BIS_LE_UNION = prove_by_refinement( + `!u0 (u1:real^A). bis_le u0 u1 UNION bis_le u1 u0 = (:real^A)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.bis_le;EXTENSION;IN_ELIM_THM;IN_UNION;IN_UNIV]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let BIS_HYPERPLANE = prove_by_refinement( + `!u0 (u1:real^A). bis u0 u1 = { p | (&2 % (u0 - u1)) dot p = (u0 - u1) dot (u0 + u1)}`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.bis;EXTENSION;Leaf_cell.DIST_EQ_HALF_PLANE;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC (arith `u = a - (b) ==> (&0 = u <=> a = b)`); + BY(VECTOR_ARITH_TAC) + ]);; + (* }}} *) + +let MCELL2_INTER_BIS_LE_MEASURABLE = prove_by_refinement( + `!u0 u1 V X ul. packing V /\ saturated V /\ + barV V 3 ul /\ + X = mcell2 V ul ==> + measurable (X INTER bis_le u0 u1)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC MEASURABLE_CONVEX; + CONJ_TAC; + MATCH_MP_TAC CONVEX_INTER; + ASM_REWRITE_TAC[Bump.MCELL2;Packing3.CONVEX_BIS_LE]; + MATCH_MP_TAC Leaf_cell.MCELL_CONVEX; + BY(ASM_MESON_TAC[arith `2 <= 2`]); + MATCH_MP_TAC BOUNDED_SUBSET; + TYPIFY `X` EXISTS_TAC; + CONJ2_TAC; + BY(SET_TAC[]); + ASM_REWRITE_TAC[Bump.MCELL2]; + MATCH_MP_TAC Urrphbz1.BOUNDED_MCELL; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let MCELL2_VOL_SPLIT = prove_by_refinement( + `!V X ul. saturated V /\ + packing V /\ + barV V 3 ul /\ + X = mcell2 V ul /\ + ~NULLSET X ==> + vol X = vol (X INTER bis_le (EL 0 ul) (EL 1 ul)) + vol (X INTER bis_le (EL 1 ul) (EL 0 ul))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC (GSYM MEASURE_NEGLIGIBLE_UNION); + TYPIFY ` ((X INTER bis_le (EL 0 ul) (EL 1 ul)) INTER X INTER bis_le (EL 1 ul) (EL 0 ul)) = X INTER bis (EL 0 ul) (EL 1 ul)` (C SUBGOAL_THEN SUBST1_TAC); + INTRO_TAC BIS_LE_INTER [`EL 0 ul`;`EL 1 ul`]; + BY(SET_TAC[]); + TYPIFY `(X INTER bis_le (EL 0 ul) (EL 1 ul) UNION X INTER bis_le (EL 1 ul) (EL 0 ul)) = X` (C SUBGOAL_THEN SUBST1_TAC); + INTRO_TAC BIS_LE_UNION [`EL 0 ul`;`EL 1 ul`]; + BY(SET_TAC[]); + REWRITE_TAC[]; + REWRITE_TAC[CONJ_ASSOC]; + CONJ_TAC; + BY(ASM_MESON_TAC[MCELL2_INTER_BIS_LE_MEASURABLE]); + REWRITE_TAC[BIS_HYPERPLANE]; + MATCH_MP_TAC NEGLIGIBLE_SUBSET; + TYPIFY `{p | &2 % (EL 0 ul - EL 1 ul) dot p = (EL 0 ul - EL 1 ul) dot (EL 0 ul + EL 1 ul)}` EXISTS_TAC; + CONJ2_TAC; + BY(SET_TAC[]); + MATCH_MP_TAC NEGLIGIBLE_HYPERPLANE; + REWRITE_TAC[DE_MORGAN_THM]; + DISJ1_TAC; + REWRITE_TAC[VECTOR_MUL_EQ_0;arith `~(&2 = &0)`]; + REWRITE_TAC[varith `!a (b:real^A). a - b = vec 0 <=> a = b`]; + DISCH_TAC; + BY(ASM_MESON_TAC[MCELL2_VX_PROPS]) + ]);; + (* }}} *) + +let RCONE_GE_COS = prove_by_refinement( + `!(u:real^3) v a. ~(u=v) ==> + rcone_ge u v a = {u} UNION { x | a <= cos(arcV u v x) }`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ONCE_REWRITE_TAC[Trigonometry2.ARC_SYM]; + REWRITE_TAC[Sphere.rcone_ge;Sphere.rconesgn;EXTENSION;IN_ELIM_THM;IN_UNION;IN_SING;Trigonometry1.DOT_COS]; + REWRITE_TAC[dist;arith `x >= y <=> y <= x`]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `x = u` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[VECTOR_SUB_REFL;NORM_0]; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `nu * nv * a <= nu * nv * c <=> &0 <= nu * nv * (c - a)`]; + GMATCH_SIMP_TAC REAL_LE_MUL_EQ; + GMATCH_SIMP_TAC REAL_LE_MUL_EQ; + REWRITE_TAC[NORM_POS_LT]; + REWRITE_TAC[GSYM Trigonometry2.ARCV_VEC0_FORM]; + REWRITE_TAC[varith `(v:real^3) - u = vec 0 <=> (v = u)`]; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let DIST_LAW_OF_COS_ALT = prove_by_refinement( +`!u v (w:real^3). dist (v,w) pow 2 = + dist (u,v) pow 2 + + dist (u,w) pow 2 - &2 * dist (u,v) * dist (u,w) * cos (arcV u v w)`, + (* {{{ proof *) + [ + BY(MESON_TAC[Trigonometry1.DIST_LAW_OF_COS]) + ]);; + (* }}} *) + +let ATN_INV = prove_by_refinement( + `!x y. &0 < x /\ &0 < y ==> atn (x / y) = pi / &2 - atn (y/x) `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Merge_ineq.atn_inv [`y/x`]; + ANTS_TAC; + GMATCH_SIMP_TAC REAL_LT_DIV; + BY(ASM_REWRITE_TAC[]); + TYPIFY `&1 / (y / x) = x / y` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let REAL_DIV_NEG = prove_by_refinement( + `!x y. (x / --y) = -- (x/y)`, + (* {{{ proof *) + [ + REWRITE_TAC[real_div;REAL_INV_NEG]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let ATN2_Y_NEG = prove_by_refinement( + `!x y. y < &0 ==> atn2(x,y) = -- (pi / &2) - atn(x/y)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Trigonometry2.atn2]; + TYPIFY `abs y < x` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + TYPED_ABBREV_TAC `(u:real) = -- y`; + REPEAT (FIRST_X_ASSUM_ST `<` MP_TAC); + TYPIFY `y = -- u` (C SUBGOAL_THEN SUBST1_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `-- u < &0 <=> &0 < u`;arith `-- u / x = -- (u/x)`;REAL_DIV_NEG]; + REWRITE_TAC[ATN_NEG]; + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC ATN_INV; + CONJ2_TAC; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + BY(ASM_SIMP_TAC[arith `y < &0 ==> ~(&0 < y)`]) + ]);; + (* }}} *) + +let RCONE_PAIR = prove_by_refinement( + `!(u:real^3) v t. ~(u=v) /\ &0 < t /\ t <= &1 ==> rcone_ge u v t INTER bis_le u v SUBSET rcone_ge v u t`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC RCONE_GE_COS; + GMATCH_SIMP_TAC RCONE_GE_COS; + ASM_REWRITE_TAC[SUBSET;IN_INTER;IN_UNION;IN_SING;IN_ELIM_THM;Sphere.bis_le]; + GEN_TAC; + TYPIFY `x = u` ASM_CASES_TAC; + BY(ASM_SIMP_TAC[Local_lemmas1.ACR_REFL;COS_0]); + ASM_REWRITE_TAC[]; + TYPIFY `x = v` ASM_CASES_TAC; + BY(ASM_SIMP_TAC[Local_lemmas1.ACR_REFL;COS_0]); + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `cos` MP_TAC; + MATCH_MP_TAC (arith `(t <= x ==> x <= y) ==> (t <= x ==> t <= y)`); + DISCH_TAC; + MATCH_MP_TAC COS_MONO_LE; + REWRITE_TAC[Local_lemmas1.ARCV_BOUNDS]; + TYPIFY `&0 < cos (arcV u v x)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REPLICATE_TAC 2 (GMATCH_SIMP_TAC Trigonometry1.arcVarc); + ASM_REWRITE_TAC[]; + TYPIFY `dist(v,x) pow 2 < dist(u,v) pow 2 + dist(u,x) pow 2` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC DIST_LAW_OF_COS_ALT [`u`;`v`;`x`]; + TYPIFY `&0 < &2 * dist(u,v) * dist (u,x) * cos (arcV u v x)` ENOUGH_TO_SHOW_TAC; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + CONJ_TAC; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_SIMP_TAC[GSYM DIST_POS_LT]); + TYPIFY `dist(v,u) = dist(u,v)` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[DIST_SYM]); + TYPED_ABBREV_TAC `(c:real) = dist(u,v)` ; + TYPED_ABBREV_TAC `(b:real) = dist(v,x)` ; + TYPED_ABBREV_TAC `(a:real) = dist(u,x)` ; + REWRITE_TAC[Local_lemmas1.COS_ARCV]; + REWRITE_TAC[Sphere.arclength]; + REWRITE_TAC[arith `t + u <= t + v <=> u <= v`]; + FIRST_X_ASSUM_ST `dist(x,u) <= dist(x,v)` MP_TAC; + ONCE_REWRITE_TAC[DIST_SYM]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `a pow 2 <= b pow 2` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Collect_geom2.POS_IMP_POW2; + ASM_REWRITE_TAC[]; + EXPAND_TAC "a"; + BY(REWRITE_TAC[DIST_POS_LE]); + TYPIFY `ups_x (c*c) (a*a) (b*b) = ups_x (c*c) (b*b) (a*a)` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[Collect_geom.UPS_X_SYM]); + TYPED_ABBREV_TAC `(up:real) = ups_x (c*c) (b*b) (a*a)` ; + REPEAT (GMATCH_SIMP_TAC ATN2_Y_NEG); + SUBCONJ_TAC; + FIRST_X_ASSUM_ST `<` MP_TAC; + BY(REAL_ARITH_TAC); + DISCH_TAC; + SUBCONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + DISCH_TAC; + MATCH_MP_TAC (arith `y <= x ==> u - x <= u - y`); + REWRITE_TAC[ATN_MONO_LE_EQ]; + TYPIFY `&0 <= sqrt up` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC SQRT_POS_LE; + EXPAND_TAC "up"; + BY(ASM_MESON_TAC[Collect_geom.TROI_OI_DAT_HOI;REAL_POW_2]); + REWRITE_TAC[real_div]; + GMATCH_SIMP_TAC Real_ext.REAL_LE_LMUL_IMP; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `x - y - z = --(y + z - x)`;REAL_INV_NEG;arith `-- x <= --y <=> y <= x`]; + GMATCH_SIMP_TAC REAL_LE_INV2; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let MCELL2_SPLIT = prove_by_refinement( + `!V X ul. + saturated V /\ + packing V /\ + barV V 3 ul /\ + X = mcell2 V ul /\ + ~NULLSET X ==> + (X INTER bis_le (EL 0 ul) (EL 1 ul) = + rcone_ge (EL 0 ul) (EL 1 ul) (hl (truncate_simplex 1 ul) / sqrt (&2)) INTER + aff_ge {EL 0 ul,EL 1 ul} {mxi V ul,omega_list_n V ul 3} INTER bis_le (EL 0 ul) (EL 1 ul))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Pack_defs.mcell2 [`V`;`ul`]; + TYPIFY `~(hl (truncate_simplex 1 ul) < sqrt (&2) /\ sqrt (&2) <= hl ul)` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[NEGLIGIBLE_EMPTY]); + FIRST_ASSUM ((unlist REWRITE_TAC) o (REWRITE_RULE[NOT_CLAUSES])); + ASM_REWRITE_TAC[LET_DEF;LET_END_DEF]; + DISCH_THEN SUBST1_TAC; + TYPED_ABBREV_TAC `(a:real) = hl (truncate_simplex 1 ul)/ (sqrt (&2))` ; + TYPIFY `HD ul = EL 0 ul /\ HD(TL ul) = EL 1 ul` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(REWRITE_TAC[EL;arith `1 = SUC 0`]); + SUBGOAL_THEN `!(a:real^3->bool) b c d. (a INTER d SUBSET b) ==> ((a INTER b INTER c) INTER d = a INTER c INTER d)` (MATCH_MP_TAC); + BY(SET_TAC[]); + MATCH_MP_TAC RCONE_PAIR; + EXPAND_TAC "a"; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[MCELL2_VX_PROPS]); + DISCH_TAC; + TYPIFY `&0 < sqrt(&2)` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC REAL_LT_RSQRT; + BY(REAL_ARITH_TAC); + CONJ2_TAC; + GMATCH_SIMP_TAC REAL_LE_LDIV_EQ; + ASM_REWRITE_TAC[arith `&1 * x = x`]; + FIRST_X_ASSUM_ST `~ ~ x` MP_TAC THEN REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LT_DIV; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[Marchal_cells_2_new.BARV_IMP_HL_1_POS_LT]) + ]);; + (* }}} *) + +let FRUSTT_RCONE_GE = prove_by_refinement( + `!u v h a . + &0 < a /\ ~(u= v) ==> + NULLSET (SDIFF + (frustt u v h a) + (rcone_ge u v a INTER {y | (y- u) dot (v-u) <= h * norm (v-u) }))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[frustt;frustum;EXTENSION;IN_ELIM_THM;LET_DEF;LET_END_DEF;IN_INTER]; + REWRITE_TAC[IN;arith `&0 * x = &0`;SDIFF]; + MATCH_MP_TAC NEGLIGIBLE_UNION; + CONJ_TAC; + TYPIFY `!s. (s = {}) ==> NULLSET s` (C SUBGOAL_THEN MATCH_MP_TAC); + BY(MESON_TAC[NEGLIGIBLE_EMPTY]); + REWRITE_TAC[EXTENSION;NOT_IN_EMPTY;IN_DIFF;IN_ELIM_THM;IN_INTER]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC[Marchal_cells_2_new.RCONE_GT_SUBSET_RCONE_GE;IN;SUBSET]); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + MATCH_MP_TAC NEGLIGIBLE_SUBSET; + TYPIFY `(rcone_ge u v a DIFF rcone_gt u v a) UNION {y | (y - u) dot (v - u) = h * norm (v - u)}` EXISTS_TAC; + CONJ_TAC; + MATCH_MP_TAC NEGLIGIBLE_UNION; + CONJ_TAC; + REWRITE_TAC[RCONE_GT_GE]; + MATCH_MP_TAC NEGLIGIBLE_SUBSET; + TYPIFY `{x | (x - u) dot (v - u) = norm (x - u) * norm (v - u) * a}` EXISTS_TAC; + CONJ2_TAC; + BY(SET_TAC[]); + TYPIFY `circular_cone {x | (x - u) dot (v - u) = norm (x - u) * norm (v - u) * a}` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[NULLSET_RULES]); + REWRITE_TAC[circular_cone;c_cone]; + REWRITE_TAC[EXISTS_PAIRED_THM]; + GEXISTL_TAC [`u`;`v - (u:real^3)`;`a`]; + BY(ASM_REWRITE_TAC[varith `v - (u:real^3) = vec 0 <=> u = v`]); + TYPIFY `!y u w a. (y- u) dot (w:real^3) = a <=> w dot y = a + u dot w` (C SUBGOAL_THEN (unlist ONCE_REWRITE_TAC)); + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC (arith `(x = y - z ==> (x = a' <=> y = a' + z))`); + BY(VECTOR_ARITH_TAC); + MATCH_MP_TAC NEGLIGIBLE_HYPERPLANE; + BY(ASM_REWRITE_TAC[varith `(v:real^3) - u = vec 0 <=> u = v`]); + REWRITE_TAC[SUBSET;IN_DIFF;IN_UNION;IN_INTER;IN_ELIM_THM]; + REWRITE_TAC[IN]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (TAUT (`(a ==>b) ==> (~ a \/ b)`)); + DISCH_TAC; + ASM_SIMP_TAC [(arith `x <= y ==> ((x = y) <=> ~(x < y))`)]; + DISCH_TAC; + FIRST_X_ASSUM_ST `~` MP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `rcone_gt` MP_TAC; + REWRITE_TAC[Sphere.rcone_gt;Sphere.rconesgn;IN_ELIM_THM]; + TYPIFY `&0 <= dist(x,u) * dist(v,u) * a` ENOUGH_TO_SHOW_TAC; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LE_MUL; + GMATCH_SIMP_TAC REAL_LE_MUL; + BY(ASM_SIMP_TAC[DIST_POS_LE;arith `&0 < a ==> &0 <= a`]) + ]);; + (* }}} *) + +let SDIFF_SUBSET = prove_by_refinement( + `!X Y Z.SDIFF (X INTER Z) (Y INTER Z) SUBSET SDIFF X Y `, + (* {{{ proof *) + [ + REWRITE_TAC[SDIFF]; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let SDIFF_TRANS = prove_by_refinement( + `!X Y (Z:A->bool). SDIFF X Z SUBSET SDIFF X Y UNION SDIFF Y Z`, + (* {{{ proof *) + [ + REWRITE_TAC[SDIFF]; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let NULL_SDIFF_TRANS = prove_by_refinement( + `!X Y Z. NULLSET (SDIFF X Y) /\ NULLSET (SDIFF Y Z) ==> NULLSET(SDIFF X Z)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC NEGLIGIBLE_SUBSET; + BY(ASM_MESON_TAC[SDIFF_TRANS;NEGLIGIBLE_UNION]) + ]);; + (* }}} *) + + +let FRUSTT_WEDGE_RCONE_GE = prove_by_refinement( + `!u v w1 w2 h a . + &0 < a /\ ~(u= v) /\ + &0 < a /\ a <= &1 /\ &0 <= h /\ ~(u = v) /\ + ~collinear {u,v,w1} /\ ~collinear{ u,v,w2} ==> + NULLSET (SDIFF + (frustt u v h a INTER wedge u v w1 w2) + (rcone_ge u v a INTER {y | (y- u) dot (v-u) <= h * norm (v-u) } INTER wedge_ge u v w1 w2))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC NULL_SDIFF_TRANS; + TYPIFY `frustt u v h a INTER wedge_ge u v w1 w2` EXISTS_TAC; + CONJ2_TAC; + MATCH_MP_TAC NEGLIGIBLE_SUBSET; + TYPIFY `SDIFF (frustt u v h a) (rcone_ge u v a INTER {y | (y - u) dot (v - u) <= h * norm (v - u)})` EXISTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[FRUSTT_RCONE_GE]); + BY(MESON_TAC[INTER_ASSOC;SDIFF_SUBSET]); + COMMENT "down to 1"; + ONCE_REWRITE_TAC[INTER_COMM]; + MATCH_MP_TAC NEGLIGIBLE_SUBSET; + TYPIFY `SDIFF (wedge u v w1 w2) (wedge_ge u v w1 w2)` EXISTS_TAC; + CONJ2_TAC; + BY(MESON_TAC[SDIFF_SUBSET]); + REWRITE_TAC[SDIFF]; + MATCH_MP_TAC NEGLIGIBLE_UNION; + CONJ_TAC; + TYPIFY `wedge u v w1 w2 DIFF wedge_ge u v w1 w2 = {}` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(SET_TAC[Leaf_cell.WEDGE_SUBSET_WEDGE_GE]); + BY(REWRITE_TAC[NEGLIGIBLE_EMPTY]); + MATCH_MP_TAC NEGLIGIBLE_SUBSET; + TYPIFY `affine hull {u,v,w1} UNION affine hull {u,v,w2}` EXISTS_TAC; + CONJ_TAC; + MATCH_MP_TAC NEGLIGIBLE_UNION; + BY(REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + MATCH_MP_TAC SUBSET_TRANS; + TYPIFY `aff_ge {u,v} {w1} UNION aff_ge {u,v} {w2}` EXISTS_TAC; + CONJ_TAC; + INTRO_TAC Leaf_cell.WEDGE_WEDGE_GE [`u`;`v`;`w1`;`w2`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + BY(SET_TAC[]); + TYPIFY `!(A:real^3->bool) B A' B'. A SUBSET A' /\ B SUBSET B' ==> (A UNION B) SUBSET (A' UNION B')` (C SUBGOAL_THEN MATCH_MP_TAC); + BY(SET_TAC[]); + TYPIFY `!(u:real^3) v w. {u,v,w} = {u,v} UNION {w}` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(SET_TAC[]); + BY(REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]) + ]);; + (* }}} *) + +let MCELL2_SUBSET_AFF_GE = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ ul IN barV V 3 ==> + mcell2 V ul SUBSET aff_ge {EL 0 ul, EL 1 ul} {mxi V ul, omega_list_n V ul 3}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[SUBSET;Pack_defs.mcell2]; + GEN_TAC; + COND_CASES_TAC; + REWRITE_TAC[LET_DEF;LET_END_DEF;EL;arith `1 = SUC 0`]; + BY(SET_TAC[]); + BY(REWRITE_TAC[NOT_IN_EMPTY]) + ]);; + (* }}} *) + +let NOT_COPLANAR_EXTREME_MCELL2 = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ ul IN barV V 3 /\ ~NULLSET (mcell2 V ul) ==> + ~coplanar { EL 0 ul, EL 1 ul, mxi V ul, omega_list_n V ul 3 }`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `~` MP_TAC; + REWRITE_TAC[]; + MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE; + MATCH_MP_TAC COPLANAR_SUBSET; + TYPIFY `affine hull {EL 0 ul, EL 1 ul, mxi V ul, omega_list_n V ul 3}` EXISTS_TAC; + CONJ_TAC; + BY(ASM_REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + MATCH_MP_TAC SUBSET_TRANS; + TYPIFY `aff_ge {EL 0 ul, EL 1 ul} {mxi V ul, omega_list_n V ul 3}` EXISTS_TAC; + ASM_SIMP_TAC[MCELL2_SUBSET_AFF_GE]; + TYPIFY `!a b c (d:real^3). {a,b,c,d} = {a,b} UNION {c,d}` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(SET_TAC[]); + BY(REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]) + ]);; + (* }}} *) + +let MCELL2_DIHV_LT_PI = prove_by_refinement( + `!V X ul. packing V /\ saturated V /\ + barV V 3 ul /\ + X = mcell2 V ul /\ + ~NULLSET X ==> dihV (EL 0 ul) (EL 1 ul) (mxi V ul) (omega_list_n V ul 3) < pi`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `~(dihV (EL 0 ul) (EL 1 ul) (mxi V ul) (omega_list_n V ul 3) = pi)` ENOUGH_TO_SHOW_TAC; + MATCH_MP_TAC (arith `(x <= pi) ==> (~(x = pi) ==> x < pi)`); + BY(REWRITE_TAC[DIHV_RANGE]); + TYPIFY `~coplanar { EL 0 ul, EL 1 ul, mxi V ul, omega_list_n V ul 3 }` ((C SUBGOAL_THEN ASSUME_TAC)); + BY(ASM_MESON_TAC[NOT_COPLANAR_EXTREME_MCELL2;IN]); + TYPIFY `~collinear {EL 0 ul,EL 1 ul,mxi V ul} /\ ~collinear {EL 0 ul, EL 1 ul,omega_list_n V ul 3}` ((C SUBGOAL_THEN ASSUME_TAC)); + TYPIFY `!a b c (d:real^3). {a,b,c,d} = {a,b,d,c}` ((C SUBGOAL_THEN MP_TAC)); + BY(SET_TAC[]); + BY(ASM_MESON_TAC[NOT_COPLANAR_NOT_COLLINEAR]); + BY(ASM_MESON_TAC[DIHV_EQ_0_PI_EQ_COPLANAR]) + ]);; + (* }}} *) + +let MCELL2_DIHV_AZIM = prove_by_refinement( + `!V X ul h. packing V /\ saturated V /\ + barV V 3 ul /\ + X = mcell2 V ul /\ + ~NULLSET X ==> ?w1 w2. {w1,w2} = {mxi V ul,omega_list_n V ul 3} /\ dihV (EL 0 ul) (EL 1 ul) (mxi V ul) (omega_list_n V ul 3) = azim (EL 0 ul) (EL 1 ul) w1 w2`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC NOT_COPLANAR_EXTREME_MCELL2 [`V`;`ul`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + DISCH_TAC; + TYPIFY `~collinear {EL 0 ul,EL 1 ul,mxi V ul} /\ ~collinear {EL 0 ul, EL 1 ul,omega_list_n V ul 3}` ((C SUBGOAL_THEN ASSUME_TAC)); + TYPIFY `!a b c (d:real^3). {a,b,c,d} = {a,b,d,c}` ((C SUBGOAL_THEN MP_TAC)); + BY(SET_TAC[]); + BY(ASM_MESON_TAC[NOT_COPLANAR_NOT_COLLINEAR]); + TYPIFY `azim (EL 0 ul) (EL 1 ul) (mxi V ul) (omega_list_n V ul 3) <= pi` ASM_CASES_TAC; + BY(ASM_MESON_TAC[Local_lemmas.AZIM_LE_PI_EQ_DIHV]); + FIRST_ASSUM MP_TAC; + DISCH_THEN (MP_TAC o (ONCE_REWRITE_RULE[Rogers.AZIM_COMPL_EXT])); + COND_CASES_TAC; + BY(ASM_MESON_TAC[PI_POS;arith `&0 < x ==> &0 <= x`]); + DISCH_TAC; + TYPIFY `azim (EL 0 ul) (EL 1 ul) (omega_list_n V ul 3) (mxi V ul) <= pi` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + ONCE_REWRITE_TAC[DIHV_SYM]; + TYPIFY `!b. {mxi V ul,b} = {b,mxi V ul}` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(SET_TAC[]); + BY(ASM_MESON_TAC[Local_lemmas.AZIM_LE_PI_EQ_DIHV]) + ]);; + (* }}} *) + +let BIS_LE_NORM = prove_by_refinement( + `!u (v:real^A). bis_le u v = { y | (y - u) dot (v - u) <= norm (v - u) pow 2 / &2}`, + (* {{{ proof *) + [ + REWRITE_TAC[Packing3.BIS_LE_EQ_HALFSPACE;EXTENSION;IN_ELIM_THM;GSYM DOT_SQUARE_NORM]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC (arith `(a - b = &2 * (c - d)) ==> (a <= b <=> c <= d)`); + REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;DOT_LSUB;DOT_RSUB]; + TYPIFY `x dot v = v dot x` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + TYPIFY `x dot u = u dot x` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + TYPIFY `v dot u = u dot v` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let BIS_LT_NORM = prove_by_refinement( + `!u (v:real^A) x. dist(x,u) < dist(x,v) <=> (x - u) dot (v - u) < norm (v - u) pow 2 / &2`, + (* {{{ proof *) + [ + REWRITE_TAC[Geomdetail.DIST_LT_HALF_PLANE;EXTENSION;IN_ELIM_THM;GSYM DOT_SQUARE_NORM]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC (arith `( &0 = b + &2 * (c - d)) ==> (&0 < b <=> c < d)`); + REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;DOT_LSUB;DOT_RSUB]; + TYPIFY `x dot v = v dot x` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + TYPIFY `x dot u = u dot x` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + TYPIFY `v dot u = u dot v` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let SDIFF_SYM = prove_by_refinement( + `!(X:A->bool) Y. SDIFF X Y = SDIFF Y X`, + (* {{{ proof *) + [ + REWRITE_TAC[SDIFF]; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let MCELL2_VOL_SPLIT_EXPLICIT = prove_by_refinement( + `!V X ul h. saturated V /\ + packing V /\ + barV V 3 ul /\ + X = mcell2 V ul /\ + h = hl (truncate_simplex 1 ul) /\ + h < sqrt(&2) /\ + ~NULLSET X ==> + vol (X INTER bis_le (EL 0 ul) (EL 1 ul)) = + dihV (EL 0 ul) (EL 1 ul) (mxi V ul) (omega_list_n V ul 3) * (&2 - h pow 2) * h / &6`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `dihV (EL 0 ul) (EL 1 ul) (mxi V ul) (omega_list_n V ul 3) < pi` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC MCELL2_DIHV_LT_PI; + BY(ASM_MESON_TAC[]); + INTRO_TAC MCELL2_DIHV_AZIM [`V`;`X`;`ul`;`h`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC NOT_COPLANAR_EXTREME_MCELL2 [`V`;`ul`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + DISCH_TAC; + TYPIFY `~collinear {EL 0 ul,EL 1 ul,mxi V ul} /\ ~collinear {EL 0 ul, EL 1 ul,omega_list_n V ul 3}` ((C SUBGOAL_THEN ASSUME_TAC)); + TYPIFY `!a b c (d:real^3). {a,b,c,d} = {a,b,d,c}` ((C SUBGOAL_THEN MP_TAC)); + BY(SET_TAC[]); + BY(ASM_MESON_TAC[NOT_COPLANAR_NOT_COLLINEAR]); + TYPIFY `~collinear {EL 0 ul, EL 1 ul,w1} /\ ~collinear {EL 0 ul,EL 1 ul, w2}` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `{a,b} = {c,d}` MP_TAC; + REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; + BY(REPEAT WEAK_STRIP_TAC THEN ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[]); + TYPIFY `&0 < h` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC Marchal_cells_2_new.BARV_IMP_HL_1_POS_LT; + BY(ASM_MESON_TAC[]); + INTRO_TAC VOLUME_FRUSTT_WEDGE [`EL 0 ul`;`EL 1 ul`;`w1`;`w2`;`h`;`h / sqrt(&2)`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[real_div]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_INV; + GMATCH_SIMP_TAC REAL_LT_RSQRT; + CONJ_TAC; + BY(REAL_ARITH_TAC); + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + COND_CASES_TAC; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `\/` MP_TAC; + ASM_SIMP_TAC[arith `&0 < h ==> ~(h < &0)`]; + GMATCH_SIMP_TAC REAL_LE_RDIV_EQ; + GMATCH_SIMP_TAC REAL_LT_RSQRT; + BY(REPEAT (FIRST_X_ASSUM_ST `<` MP_TAC) THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + TYPIFY `(h / (h / sqrt(&2))) pow 2 = &2` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + CONJ2_TAC; + REWRITE_TAC[GSYM Sphere.sqrt2;REAL_POW_MUL]; + REWRITE_TAC[Nonlin_def.sqrt2_sqrt2;REAL_POW_2]; + BY(REAL_ARITH_TAC); + ASM_SIMP_TAC[arith `&0 < h ==> ~(h = &0)`;arith `~(&1 = &0)`]; + GMATCH_SIMP_TAC SQRT_EQ_0; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + DISCH_THEN (SUBST1_TAC o GSYM); + MATCH_MP_TAC Vol1.VOLUME_PROPS_SDIFF; + CONJ_TAC; + MATCH_MP_TAC MCELL2_INTER_BIS_LE_MEASURABLE; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + FIRST_X_ASSUM_ST `frustt` MP_TAC; + BY(ASM_REWRITE_TAC[]); + GMATCH_SIMP_TAC MCELL2_SPLIT; + TYPIFY `V` EXISTS_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `{a,b} = {c,d}` (ASSUME_TAC o GSYM); + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC (GSYM Local_lemmas.WEDGE_GE_EQ_AFF_GE); + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + ONCE_REWRITE_TAC[SDIFF_SYM]; + ONCE_REWRITE_TAC[SET_RULE `a INTER b INTER c = a INTER c INTER b`]; + REWRITE_TAC[BIS_LE_NORM]; + TYPIFY `hl (truncate_simplex 1 ul) = dist(EL 1 ul,EL 0 ul) / &2` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC BARV3_TRUNC1; + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + ONCE_REWRITE_TAC[DIST_SYM]; + REWRITE_TAC[Marchal_cells_3.HL_2]; + BY(REAL_ARITH_TAC); + TYPIFY `norm (EL 1 ul - EL 0 ul) pow 2 / &2 = hl (truncate_simplex 1 ul) * norm (EL 1 ul - EL 0 ul)` (C SUBGOAL_THEN SUBST1_TAC); + ASM_REWRITE_TAC[dist]; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC FRUSTT_WEDGE_RCONE_GE; + FIRST_X_ASSUM kill; + ASM_REWRITE_TAC[]; + TYPIFY `&0 < sqrt(&2)` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC REAL_LT_RSQRT; + BY(REAL_ARITH_TAC); + TYPIFY `&0 < hl(truncate_simplex 1 ul)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Marchal_cells_2_new.BARV_IMP_HL_1_POS_LT]); + SUBCONJ_TAC; + GMATCH_SIMP_TAC REAL_LT_DIV; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[IN;MCELL2_VX_PROPS]); + DISCH_TAC; + ASM_SIMP_TAC[arith `&0 < h ==> &0 <= h`]; + GMATCH_SIMP_TAC REAL_LE_LDIV_EQ; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `&1 * x = x`]; + MATCH_MP_TAC (arith `x < y ==> x <= y`); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let MCELL2_HL_LT_SQRT2 = prove_by_refinement( + `!V ul. saturated V /\ + packing V /\ + barV V 3 ul /\ + ~NULLSET (mcell2 V ul) ==> + hl (truncate_simplex 1 ul) < sqrt(&2) +`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `NULLSET` MP_TAC; + BY(ASM_REWRITE_TAC[Pack_defs.mcell2;NEGLIGIBLE_EMPTY]) + ]);; + (* }}} *) + +let LEFT_ACTION_LIST_1_PROPERTIES_ALT = prove_by_refinement( + `!V ul xl p. + packing V /\ + saturated V /\ + barV V 3 ul /\ + p permutes 0..1 /\ + hl (truncate_simplex 1 ul) < sqrt (&2) /\ + sqrt (&2) <= hl ul /\ + xl = left_action_list p ul + ==> xl IN barV V 3 /\ + omega_list_n V xl 1 = omega_list_n V ul 1 /\ + omega_list_n V xl 2 = omega_list_n V ul 2 /\ + omega_list_n V xl 3 = omega_list_n V ul 3 /\ + mxi V xl = mxi V ul`, + (* {{{ proof *) + [ + REWRITE_TAC[Marchal_cells_2_new.LEFT_ACTION_LIST_1_PROPERTIES] + ]);; + (* }}} *) + +let MCELL2_PERMUTE_01 = prove_by_refinement( + `!V ul. saturated V /\ packing V /\ barV V 3 ul /\ ~NULLSET (mcell2 V ul) ==> + (?vl. (EL 0 ul = EL 1 vl) /\ (EL 1 ul = EL 0 vl) /\ (mxi V ul = mxi V vl) /\ + (omega_list_n V ul 3 = omega_list_n V vl 3) /\ + (hl (truncate_simplex 1 ul) = hl (truncate_simplex 1 vl)) /\ + (mcell2 V ul = mcell2 V vl) /\ barV V 3 vl)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `LENGTH ul = 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[IN;Sphere.BARV;arith `3 + 1 = 4`]); + INTRO_TAC Bump.LENGTH4 [`ul`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC MCELL2_HL_LT_SQRT2 [`V`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Leaf_cell.TWO_REARRANGEMENT_LEMMA_ALT [`V`;`ul`;`EL 0 ul`;`EL 1 ul`;`EL 2 ul`;`EL 3 ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + TYPED_ABBREV_TAC `(vl:(real^3) list) = left_action_list p ul` ; + TYPIFY `vl` EXISTS_TAC; + INTRO_TAC LEFT_ACTION_LIST_1_PROPERTIES_ALT [`V`;`ul`;`vl`;`p`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `mcell2` MP_TAC; + BY(ASM_REWRITE_TAC[Pack_defs.mcell2;NEGLIGIBLE_EMPTY]); + REWRITE_TAC[IN;Bump.MCELL2]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC Rvfxzbu.RVFXZBU [`V`;`ul`;`2`;`p`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[arith `2 - 1 = 1`;IN_INSERT]); + DISCH_TAC; + REWRITE_TAC[CONJ_ASSOC]; + CONJ2_TAC; + BY(ASM_MESON_TAC[]); + PROOF_BY_CONTR_TAC; + TYPIFY `LENGTH vl = 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[IN;Sphere.BARV;arith `3 + 1 = 4`]); + INTRO_TAC Bump.LENGTH4 [`vl`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + FIRST_X_ASSUM_ST `~` MP_TAC; + REWRITE_TAC[]; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[CONS_11]); + DISCH_TAC; + REWRITE_TAC[Pack_defs.HL]; + AP_TERM_TAC; + REPEAT (GMATCH_SIMP_TAC Bump.SET_OF_LIST_TRUNCATE_1); + ASM_SIMP_TAC[arith `x = 4 ==> 2 <= x`]; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let MCELL2_VOL = prove_by_refinement( + `!V X ul h. saturated V /\ + packing V /\ + barV V 3 ul /\ + X = mcell2 V ul /\ + h = hl (truncate_simplex 1 ul) /\ + ~NULLSET X ==> + vol X = + dihV (EL 0 ul) (EL 1 ul) (mxi V ul) (omega_list_n V ul 3) * (&2 - h pow 2) * h / &3`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC MCELL2_VOL_SPLIT [`V`;`X`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_THEN SUBST1_TAC; + MATCH_MP_TAC (arith `x = a/ &2 /\ y = a / &2 ==> (x + y = a)`); + TYPIFY `h < sqrt(&2)` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[MCELL2_HL_LT_SQRT2]); + COMMENT "first branch"; + CONJ_TAC; + INTRO_TAC MCELL2_VOL_SPLIT_EXPLICIT [`V`;`X`;`ul`;`h`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_THEN SUBST1_TAC; + BY(REAL_ARITH_TAC); + COMMENT "second branch"; + INTRO_TAC MCELL2_PERMUTE_01 [`V`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[Marchal_cells_2_new.DIHV_SYM]; + INTRO_TAC MCELL2_VOL_SPLIT_EXPLICIT [`V`;`X`;`vl`;`hl (truncate_simplex 1 vl)`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let BALL_SUBSET_BIS_LE = prove_by_refinement( + `!u (v:real^A) r. + &2 * r <= dist(u,v) ==> + ball(u,r) SUBSET bis_le u v`, + (* {{{ proof *) + [ + REWRITE_TAC[ball;Sphere.bis_le;SUBSET;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `dist(x,u) = dist(u,x)` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[DIST_SYM]); + PROOF_BY_CONTR_TAC; + INTRO_TAC DIST_TRIANGLE [`u`;`x`;`v`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let BALL_SUBSET_BIS_LT = prove_by_refinement( + `!u (v:real^A) r. + &2 * r <= dist(u,v) ==> + ball(u,r) SUBSET {y | dist(y, u) < dist(y, v)}`, + (* {{{ proof *) + [ + REWRITE_TAC[ball;Sphere.bis_le;SUBSET;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `dist(x,u) = dist(u,x)` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[DIST_SYM]); + PROOF_BY_CONTR_TAC; + INTRO_TAC DIST_TRIANGLE [`u`;`x`;`v`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let RADIAL_LE = prove_by_refinement( + `!r r' (x:real^3) C. r' <= r /\ &0 < r' + ==> radial r x (C INTER ball( x, r)) + ==> radial r' x (C INTER ball( x, r'))`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Marchal_cells_2_new.RADIAL_VS_RADIAL_NORM;GSYM NORMBALL_BALL;Conforming.RADIAL_NORM_CO]) + ]);; + (* }}} *) + +let MCELL2_SOL = prove_by_refinement( + `!V X ul h. saturated V /\ + packing V /\ + barV V 3 ul /\ + X = mcell2 V ul /\ + h = hl (truncate_simplex 1 ul) /\ + h < sqrt(&2) /\ + ~NULLSET X ==> + sol (EL 0 ul) X = + dihV (EL 0 ul) (EL 1 ul) (mxi V ul) (omega_list_n V ul 3) * (&1 - h / sqrt(&2))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `dist(EL 0 ul,EL 1 ul) / &2 = hl (truncate_simplex 1 ul) ` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC BARV3_TRUNC1; + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + REWRITE_TAC[Marchal_cells_3.HL_2]; + BY(REAL_ARITH_TAC); + TYPIFY `!r. r < h ==> X INTER ball (EL 0 ul,r) = (X INTER bis_le (EL 0 ul) (EL 1 ul)) INTER ball(EL 0 ul,r)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAK_STRIP_TAC; + TYPIFY `ball (EL 0 ul,r) SUBSET bis_le (EL 0 ul) (EL 1 ul)` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + MATCH_MP_TAC BALL_SUBSET_BIS_LE; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `&0 < sqrt(&2) ` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC REAL_LT_RSQRT; + BY(REAL_ARITH_TAC); + TYPIFY `&0 < h` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC Marchal_cells_2_new.BARV_IMP_HL_1_POS_LT; + BY(ASM_MESON_TAC[]); + TYPIFY `&0 < h / sqrt(&2) /\ h / sqrt(&2) < &1` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC REAL_LT_DIV; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC REAL_LT_LDIV_EQ; + ASM_REWRITE_TAC[arith `(&1 * x = x)`]; + BY(ASM_MESON_TAC[]); + COMMENT "0. basic setup of azim and dih"; + TYPIFY `dihV (EL 0 ul) (EL 1 ul) (mxi V ul) (omega_list_n V ul 3) < pi` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC MCELL2_DIHV_LT_PI; + BY(ASM_MESON_TAC[]); + INTRO_TAC MCELL2_DIHV_AZIM [`V`;`X`;`ul`;`h`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + COMMENT "show non-degeneracy"; + INTRO_TAC NOT_COPLANAR_EXTREME_MCELL2 [`V`;`ul`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + DISCH_TAC; + TYPIFY `~collinear {EL 0 ul,EL 1 ul,mxi V ul} /\ ~collinear {EL 0 ul, EL 1 ul,omega_list_n V ul 3}` ((C SUBGOAL_THEN ASSUME_TAC)); + TYPIFY `!a b c (d:real^3). {a,b,c,d} = {a,b,d,c}` ((C SUBGOAL_THEN MP_TAC)); + BY(SET_TAC[]); + BY(ASM_MESON_TAC[NOT_COPLANAR_NOT_COLLINEAR]); + TYPIFY `~collinear {EL 0 ul, EL 1 ul,w1} /\ ~collinear {EL 0 ul,EL 1 ul, w2}` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `{a,b} = {c,d}` MP_TAC; + REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; + BY(REPEAT WEAK_STRIP_TAC THEN ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[]); + COMMENT "next"; + TYPIFY `EL 0 ul IN V` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC MCELL2_VX_PROPS [`V`;`X`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + INTRO_TAC Bump.HDTFNFZ_ALT [`V`;`ul`;`2`;`X`]; + ANTS_TAC; + BY(ASM_MESON_TAC[Bump.MCELL2]); + DISCH_THEN SUBST1_TAC; + BY(SET_TAC[]); + INTRO_TAC Urrphbz2.URRPHBZ2 [`V`;`ul`;`2`;`EL 0 ul`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[GSYM Bump.MCELL2]; + REWRITE_TAC[Sphere.eventually_radial]; + REPEAT WEAK_STRIP_TAC; + COMMENT "next2"; + TYPIFY `?r'. r' <= h /\ &0 < r' /\ radial r' (EL 0 ul) (mcell2 V ul INTER ball (EL 0 ul,r'))` (C SUBGOAL_THEN MP_TAC); + TYPIFY `if (r <= h) then r else h` EXISTS_TAC; + COND_CASES_TAC; + BY(ASM_REWRITE_TAC[arith `&0 < r <=> r > &0`]); + REWRITE_TAC[arith `h <= h`]; + BY(ASM_MESON_TAC[RADIAL_LE;arith `~(r <= h) ==> (h <= r)`]); + REPLICATE_TAC 2 (FIRST_X_ASSUM kill); + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC Vol1.sol_spec; + TYPIFY `r'` EXISTS_TAC; + ASM_REWRITE_TAC[arith `r' > &0 <=> &0 < r'`]; + SUBCONJ_TAC; + MATCH_MP_TAC MEASURABLE_INTER; + REWRITE_TAC[MEASURABLE_BALL;Bump.MCELL2]; + BY(ASM_MESON_TAC[Urrphbz1.MEASURABLE_MCELL]); + DISCH_TAC; + COMMENT "1. done with sol "; + INTRO_TAC MCELL2_VX_PROPS [`V`;`X`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + INTRO_TAC VOLUME_CONIC_CAP_STRONG [`EL 0 ul`;`EL 1 ul`;`r'`;`h/ sqrt(&2)`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + COND_CASES_TAC; + TYPIFY `~(&1 <= h / sqrt(&2))` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC (arith `a < b ==> ~(b <= a)`); + BY(ASM_REWRITE_TAC[]); + BY(ASM_MESON_TAC[arith `&0 < r' ==> ~(r' < &0)`]); + REPEAT WEAK_STRIP_TAC; + COMMENT "add wedge"; + INTRO_TAC Vol1.VOLUME_PROPS_CONIC_CAP [`EL 0 ul`;`EL 1 ul`;`w1`;`w2`;`r'`;`h / sqrt(&2)`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[arith `&0 < r' ==> r' >= &0`;arith `&0 < h' ==> h' >= -- &1`;arith `h' < &1 ==> h' <= &1`]); + REWRITE_TAC[vol_conic_cap_wedge]; + TYPIFY `!v x. &3 * v / r' pow 3 = x <=> v = x * r' pow 3 / &3` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC (TAUT `((a ==> b) /\ (b ==> a)) ==> (a = b)`); + CONJ_TAC THEN REPEAT WEAK_STRIP_TAC; + EXPAND_TAC "x"; + Calc_derivative.CALC_ID_TAC; + BY(ASM_MESON_TAC[arith `~(&3 = &0)`;arith `&0 < r' ==> ~(r' = &0)`]); + ASM_REWRITE_TAC[]; + Calc_derivative.CALC_ID_TAC; + BY(ASM_MESON_TAC[arith `~(&3 = &0)`;arith `&0 < r' ==> ~(r' = &0)`]); + ASM_REWRITE_TAC[GSYM REAL_MUL_ASSOC]; + DISCH_THEN (SUBST1_TAC o SYM); + COMMENT "pure volumes left"; + MATCH_MP_TAC Vol1.VOLUME_PROPS_SDIFF; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(REWRITE_TAC[MEASURABLE_CONIC_CAP_WEDGE]); + REWRITE_TAC[conic_cap;NORMBALL_BALL]; + COMMENT "SDIFF to match volumes"; + ONCE_REWRITE_TAC[SDIFF_SYM]; + INTRO_TAC FRUSTT_WEDGE_RCONE_GE [`EL 0 ul`;`EL 1 ul`;`w1`;`w2`;`h`;`h/ sqrt(&2)`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[arith `h' < y ==> h' <= y`]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC SDIFF_SUBSET [`(frustt (EL 0 ul) (EL 1 ul) (hl (truncate_simplex 1 ul)) (hl (truncate_simplex 1 ul) / sqrt (&2)) INTER wedge (EL 0 ul) (EL 1 ul) w1 w2)`;` (rcone_ge (EL 0 ul) (EL 1 ul) (hl (truncate_simplex 1 ul) / sqrt (&2)) INTER {y | (y - EL 0 ul) dot (EL 1 ul - EL 0 ul) <= hl (truncate_simplex 1 ul) * norm (EL 1 ul - EL 0 ul)} INTER wedge_ge (EL 0 ul) (EL 1 ul) w1 w2)`;`ball ((EL 0 ul),r')`]; + DISCH_THEN (MP_TAC o (MATCH_MP (REWRITE_RULE[TAUT `(a /\ b ==> c) <=> (b ==> (a ==> c))`] NEGLIGIBLE_SUBSET))); + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + COMMENT "match frustt"; + TYPIFY `(frustt (EL 0 ul) (EL 1 ul) (hl (truncate_simplex 1 ul)) (hl (truncate_simplex 1 ul) / sqrt (&2)) INTER wedge (EL 0 ul) (EL 1 ul) w1 w2) INTER ball (EL 0 ul,r') = (ball (EL 0 ul,r') INTER rcone_gt (EL 0 ul) (EL 1 ul) (hl (truncate_simplex 1 ul) / sqrt (&2))) INTER wedge (EL 0 ul) (EL 1 ul) w1 w2` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[frustt;frustum;LET_DEF;EXTENSION;IN_ELIM_THM;LET_DEF;LET_END_DEF;IN_INTER]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[arith `&0 * x = &0`]; + TYPIFY `~(x IN ball(EL 0 ul,r'))` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `~(x IN rcone_gt (EL 0 ul) (EL 1 ul) (hl (truncate_simplex 1 ul) / sqrt (&2)))` ASM_CASES_TAC; + BY(ASM_MESON_TAC[IN]); + TYPIFY `~(x IN wedge (EL 0 ul) (EL 1 ul) w1 w2)` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT (FIRST_X_ASSUM_ST `~ ~ x` MP_TAC) THEN REWRITE_TAC[] THEN REPEAT WEAK_STRIP_TAC THEN ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + CONJ_TAC; + FIRST_X_ASSUM_ST `rcone_gt` MP_TAC; + REWRITE_TAC[Sphere.rcone_gt;Sphere.rconesgn;IN_ELIM_THM]; + TYPIFY `&0 <= dist (x,EL 0 ul) * dist (EL 1 ul,EL 0 ul) * hl (truncate_simplex 1 ul) / sqrt (&2)` ENOUGH_TO_SHOW_TAC; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LE_MUL; + GMATCH_SIMP_TAC REAL_LE_MUL; + REWRITE_TAC[DIST_POS_LE]; + MATCH_MP_TAC (arith `&0 < h' ==> &0 <= h'`); + BY(ASM_MESON_TAC[]); + INTRO_TAC BALL_SUBSET_BIS_LT [`EL 0 ul`;`EL 1 ul`;`r'`]; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REWRITE_TAC[SUBSET;IN_ELIM_THM]; + DISCH_THEN (C INTRO_TAC [`x`]); + ASM_REWRITE_TAC[]; + REWRITE_TAC[BIS_LT_NORM]; + ONCE_REWRITE_TAC[arith `x pow 2 / &2 = (x / &2) * x`]; + FIRST_X_ASSUM_ST `dist a / &2 = h` (SUBST1_TAC o GSYM); + ONCE_REWRITE_TAC[DIST_SYM]; + BY(REWRITE_TAC[dist]); + TYPIFY `((rcone_ge (EL 0 ul) (EL 1 ul) (hl (truncate_simplex 1 ul) / sqrt (&2)) INTER {y | (y - EL 0 ul) dot (EL 1 ul - EL 0 ul) <= hl (truncate_simplex 1 ul) * norm (EL 1 ul - EL 0 ul)} INTER wedge_ge (EL 0 ul) (EL 1 ul) w1 w2) INTER ball (EL 0 ul,r')) = (mcell2 V ul INTER ball (EL 0 ul,r'))` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[]); + TYPIFY `mcell2 V ul INTER ball (EL 0 ul,r') = mcell2 V ul INTER bis_le (EL 0 ul) (EL 1 ul) INTER ball (EL 0 ul,r')` (C SUBGOAL_THEN SUBST1_TAC); + INTRO_TAC BALL_SUBSET_BIS_LE [`EL 0 ul`;`EL 1 ul`;`r'`]; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(SET_TAC[]); + INTRO_TAC MCELL2_SPLIT [`V`;`mcell2 V ul`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[GSYM INTER_ASSOC]; + DISCH_THEN SUBST1_TAC; + FIRST_X_ASSUM_ST `{a,b} = {c,d}` (SUBST1_TAC o SYM); + TYPIFY `wedge_ge (EL 0 ul) (EL 1 ul) w1 w2 = aff_ge {EL 0 ul, EL 1 ul} {w1,w2}` (C SUBGOAL_THEN SUBST1_TAC); + MATCH_MP_TAC Local_lemmas.WEDGE_GE_EQ_AFF_GE; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[BIS_LE_NORM]; + ONCE_REWRITE_TAC[arith `x pow 2 / &2 = (x / &2) * x`]; + FIRST_X_ASSUM_ST `dist a / &2 = h` (SUBST1_TAC o GSYM); + ONCE_REWRITE_TAC[DIST_SYM]; + REWRITE_TAC[dist]; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let gamma2_x_div_azim_v2 = + new_definition `gamma2_x_div_azim_v2 m x = (&8 - x)* sqrt x / (&24) - + ( &2 * (&2 * mm1/ pi) * (&1 - sqrt x / sqrt8) - + (&8 * mm2 / pi) * m * lfun (sqrt x / &2))`;; + +(* +let GAMMAX_GAMMA2_X = prove_by_refinement( + `!V X ul y1 y2 y3 y4 y5 y6. + saturated V /\ + packing V /\ + barV V 3 ul /\ + X = mcell2 V ul /\ + ~NULLSET X /\ + y1 = dist(EL 0 ul,EL 1 ul) /\ + y2 = dist(EL 0 ul,mxi V ul) /\ + y3 = dist(EL 0 ul,omega_list_n V ul 3) /\ + y4 = dist(mxi V ul,omega_list_n V ul 3) /\ + y5 = dist(EL 1 ul,omega_list_n V ul 3) /\ + y6 = dist(EL 1 ul,mxi V ul) + ==> + gammaX V X lmfun = + gamma2_x_div_azim_v2 (h0cut y1) (y1 * y1) * dih_y y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC GAMMAX_MCELL2 [`V`;`X`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_THEN SUBST1_TAC; + INTRO_TAC MCELL2_VOL [`V`;`X`;`ul`;`hl (truncate_simplex 1 ul)`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_THEN SUBST1_TAC; + INTRO_TAC MCELL2_HL_LT_SQRT2 [`V`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + INTRO_TAC MCELL2_SOL [`V`;`X`;`ul`;`hl (truncate_simplex 1 ul)`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_THEN SUBST1_TAC; + TYPIFY `sol (EL 1 ul) X = dihV (EL 0 ul) (EL 1 ul) (mxi V ul) (omega_list_n V ul 3) * (&1 - hl (truncate_simplex 1 ul) / sqrt (&2))` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC MCELL2_PERMUTE_01 [`V`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC MCELL2_SOL [`V`;`X`;`vl`;`hl (truncate_simplex 1 vl)`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + BY(MESON_TAC[Marchal_cells_2_new.DIHV_SYM]); + DISCH_THEN SUBST1_TAC; + INTRO_TAC MCELL2_DIHX [`V`;`X`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[arith `d * a - m * (d * a' + d * a') + m' * l * d = (a - &2 * m * a' + m' * l) * d`]; + MATCH_MP_TAC (arith `a = b /\ c = d ==> (a*c = b * d)`); + COMMENT "show non-degeneracy"; + INTRO_TAC NOT_COPLANAR_EXTREME_MCELL2 [`V`;`ul`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + DISCH_TAC; + TYPIFY `~collinear {EL 0 ul,EL 1 ul,mxi V ul} /\ ~collinear {EL 0 ul, EL 1 ul,omega_list_n V ul 3}` ((C SUBGOAL_THEN ASSUME_TAC)); + TYPIFY `!a b c (d:real^3). {a,b,c,d} = {a,b,d,c}` ((C SUBGOAL_THEN MP_TAC)); + BY(SET_TAC[]); + BY(ASM_MESON_TAC[NOT_COPLANAR_NOT_COLLINEAR]); + CONJ2_TAC; + INTRO_TAC Merge_ineq.DIHV_EQ_DIH_Y [`EL 0 ul`;`EL 1 ul`;`mxi V ul`;`omega_list_n V ul 3`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + BY(REWRITE_TAC[LET_DEF;LET_END_DEF]); + TYPED_ABBREV_TAC `(h:real) = hl (truncate_simplex 1 ul)` ; + TYPIFY `dist(EL 0 ul,EL 1 ul) = &2 * hl (truncate_simplex 1 ul) ` (C SUBGOAL_THEN ASSUME_TAC); + ONCE_REWRITE_TAC[arith `(x = &2 * h <=> x / &2 = h)`]; + GMATCH_SIMP_TAC BARV3_TRUNC1; + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + REWRITE_TAC[Marchal_cells_3.HL_2]; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[gamma2_x_div_azim_v2]; + COMMENT "simplify polynomial identity"; + TYPIFY `&0 < h` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "h"; + MATCH_MP_TAC Marchal_cells_2_new.BARV_IMP_HL_1_POS_LT; + BY(ASM_MESON_TAC[]); + TYPIFY `[EL 0 ul; EL 1 ul] = truncate_simplex 1 ul` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[BARV3_TRUNC1;IN]); + TYPIFY `sqrt((&2 * h) * (&2 * h)) = &2 * h` (C SUBGOAL_THEN SUBST1_TAC); + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + MATCH_MP_TAC (arith `(a = a') /\ (b = b') /\ (c = c') ==> a - b + c = a' - (b' - c')`); + CONJ_TAC; + BY(REAL_ARITH_TAC); + CONJ2_TAC; + AP_TERM_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC Merge_ineq.lmfun_h0cut [`(&2 * h)`]; + REWRITE_TAC[arith `(&2 * h) / &2 = h`]; + BY(REAL_ARITH_TAC); + AP_TERM_TAC; + AP_TERM_TAC; + AP_TERM_TAC; + REWRITE_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2]; + Calc_derivative.CALC_ID_TAC; + REPEAT (GMATCH_SIMP_TAC SQRT_EQ_0); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) +*) + +let GAMMAX_GAMMA2_X = prove_by_refinement( + `!V X ul y1 y2 y3 y4 y5 y6. + saturated V /\ + packing V /\ + barV V 3 ul /\ + X = mcell2 V ul /\ + ~NULLSET X /\ + y1 = dist(EL 0 ul,EL 1 ul) /\ + y2 = dist(EL 0 ul,mxi V ul) /\ + y3 = dist(EL 0 ul,omega_list_n V ul 3) /\ + y4 = dist(mxi V ul,omega_list_n V ul 3) /\ + y5 = dist(EL 1 ul,omega_list_n V ul 3) /\ + y6 = dist(EL 1 ul,mxi V ul) + ==> + &0 <= dih_y y1 y2 y3 y4 y5 y6 /\ + gammaX V X lmfun = + gamma2_x_div_azim_v2 (h0cut y1) (y1 * y1) * dih_y y1 y2 y3 y4 y5 y6`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC GAMMAX_MCELL2 [`V`;`X`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_THEN SUBST1_TAC; + INTRO_TAC MCELL2_VOL [`V`;`X`;`ul`;`hl (truncate_simplex 1 ul)`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_THEN SUBST1_TAC; + INTRO_TAC MCELL2_HL_LT_SQRT2 [`V`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + INTRO_TAC MCELL2_SOL [`V`;`X`;`ul`;`hl (truncate_simplex 1 ul)`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_THEN SUBST1_TAC; + TYPIFY `sol (EL 1 ul) X = dihV (EL 0 ul) (EL 1 ul) (mxi V ul) (omega_list_n V ul 3) * (&1 - hl (truncate_simplex 1 ul) / sqrt (&2))` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC MCELL2_PERMUTE_01 [`V`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC MCELL2_SOL [`V`;`X`;`vl`;`hl (truncate_simplex 1 vl)`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + BY(MESON_TAC[Marchal_cells_2_new.DIHV_SYM]); + DISCH_THEN SUBST1_TAC; + INTRO_TAC MCELL2_DIHX [`V`;`X`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[arith `d * a - m * (d * a' + d * a') + m' * l * d = (a - &2 * m * a' + m' * l) * d`]; + MATCH_MP_TAC (arith `&0 <= c /\ a = b /\ c = d ==> (&0 <= d /\ a*c = b * d)`); + CONJ_TAC; + BY(REWRITE_TAC[DIHV_RANGE]); + COMMENT "show non-degeneracy"; + INTRO_TAC NOT_COPLANAR_EXTREME_MCELL2 [`V`;`ul`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + DISCH_TAC; + TYPIFY `~collinear {EL 0 ul,EL 1 ul,mxi V ul} /\ ~collinear {EL 0 ul, EL 1 ul,omega_list_n V ul 3}` ((C SUBGOAL_THEN ASSUME_TAC)); + TYPIFY `!a b c (d:real^3). {a,b,c,d} = {a,b,d,c}` ((C SUBGOAL_THEN MP_TAC)); + BY(SET_TAC[]); + BY(ASM_MESON_TAC[NOT_COPLANAR_NOT_COLLINEAR]); + CONJ2_TAC; + INTRO_TAC Merge_ineq.DIHV_EQ_DIH_Y [`EL 0 ul`;`EL 1 ul`;`mxi V ul`;`omega_list_n V ul 3`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + BY(REWRITE_TAC[LET_DEF;LET_END_DEF]); + TYPED_ABBREV_TAC `(h:real) = hl (truncate_simplex 1 ul)` ; + TYPIFY `dist(EL 0 ul,EL 1 ul) = &2 * hl (truncate_simplex 1 ul) ` (C SUBGOAL_THEN ASSUME_TAC); + ONCE_REWRITE_TAC[arith `(x = &2 * h <=> x / &2 = h)`]; + GMATCH_SIMP_TAC BARV3_TRUNC1; + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + REWRITE_TAC[Marchal_cells_3.HL_2]; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[gamma2_x_div_azim_v2]; + COMMENT "simplify polynomial identity"; + TYPIFY `&0 < h` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "h"; + MATCH_MP_TAC Marchal_cells_2_new.BARV_IMP_HL_1_POS_LT; + BY(ASM_MESON_TAC[]); + TYPIFY `[EL 0 ul; EL 1 ul] = truncate_simplex 1 ul` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[BARV3_TRUNC1;IN]); + TYPIFY `sqrt((&2 * h) * (&2 * h)) = &2 * h` (C SUBGOAL_THEN SUBST1_TAC); + GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + MATCH_MP_TAC (arith `(a = a') /\ (b = b') /\ (c = c') ==> a - b + c = a' - (b' - c')`); + CONJ_TAC; + BY(REAL_ARITH_TAC); + CONJ2_TAC; + AP_TERM_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC Merge_ineq.lmfun_h0cut [`(&2 * h)`]; + REWRITE_TAC[arith `(&2 * h) / &2 = h`]; + BY(REAL_ARITH_TAC); + AP_TERM_TAC; + AP_TERM_TAC; + AP_TERM_TAC; + REWRITE_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2]; + Calc_derivative.CALC_ID_TAC; + REPEAT (GMATCH_SIMP_TAC SQRT_EQ_0); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + + + + +let TSKAJXY_2 = prove_by_refinement( + `!V X ul. + pack_nonlinear_non_ox3q1h /\ saturated V /\ + packing V /\ + barV V 3 ul /\ + X = mcell2 V ul + ==> gammaX V X lmfun >= &0`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `NULLSET X` ASM_CASES_TAC; + INTRO_TAC GAMMAX_NULLSET [`V`;`lmfun`;`X`;`ul`;`2`]; + ANTS_TAC; + BY(ASM_MESON_TAC[Bump.MCELL2]); + BY(REAL_ARITH_TAC); + INTRO_TAC GAMMAX_GAMMA2_X [`V`;`X`;`ul`;`dist(EL 0 ul,EL 1 ul)`;`dist(EL 0 ul,mxi V ul)`;`dist(EL 0 ul,omega_list_n V ul 3)`;`dist(mxi V ul,omega_list_n V ul 3)`;`dist(EL 1 ul,omega_list_n V ul 3)`;`dist(EL 1 ul,mxi V ul)`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `a * b >= &0 <=> &0 <= a * b`]; + GMATCH_SIMP_TAC REAL_LE_MUL; + ASM_REWRITE_TAC[]; + TYPIFY ` (!y. &2 <= y /\ y <= sqrt8 ==> &0 <= gamma2_x_div_azim_v2 (h0cut y) (y * y))` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Merge_ineq.GRKIBMP; + INTRO_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "GRKIBMP A V2") []; + INTRO_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h "GRKIBMP B V2") []; + BY(MESON_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + INTRO_TAC MCELL2_VX_PROPS [`V`;`X`;`ul`]; + ASM_REWRITE_TAC[]; + INTRO_TAC Bump.HDTFNFZ_ALT [`V`;`ul`;`2`;`X`]; + ANTS_TAC; + BY(ASM_MESON_TAC[Bump.MCELL2]); + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + REPEAT WEAK_STRIP_TAC; + TYPIFY `EL 0 ul IN V /\ EL 1 ul IN V` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM_ST `INTER` MP_TAC THEN SET_TAC[]); + CONJ_TAC; + FIRST_X_ASSUM_ST `packing` MP_TAC; + REWRITE_TAC[Sphere.packing]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_MESON_TAC[IN]); + INTRO_TAC MCELL2_HL_LT_SQRT2 [`V`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[Nonlinear_lemma.sqrt8_sqrt2;Sphere.sqrt2]; + TYPIFY `dist(EL 0 ul,EL 1 ul) = &2 * hl (truncate_simplex 1 ul) ` (C SUBGOAL_THEN ASSUME_TAC); + ONCE_REWRITE_TAC[arith `(x = &2 * h <=> x / &2 = h)`]; + GMATCH_SIMP_TAC BARV3_TRUNC1; + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + REWRITE_TAC[Marchal_cells_3.HL_2]; + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let tsk_required_ineq = + let cell3_hyp = ["QZECFIC wt0";"QZECFIC wt0 corner";"QZECFIC wt0 sqrt8"; + "QZECFIC wt1";"QZECFIC wt2 A";"CIHTIUM";"CJFZZDW";] in + let tsk = ["TSKAJXY-GXSABWC DIV"; "TSKAJXY-IYOUOBF sharp v2"; + "TSKAJXY-IYOUOBF sym"; + "TSKAJXY-RIBCYXU sharp"; "TSKAJXY-RIBCYXU sym"; "TSKAJXY-TADIAMB"; + "TSKAJXY-WKGUESB sym"; "TSKAJXY-XLLIPLS"; "TSKAJXY-delta_x4"; + "TSKAJXY-eulerA"] in + let grk = ["GRKIBMP A V2";"GRKIBMP B V2"] in + cell3_hyp @ tsk @ grk;; + +let TSKAJXY = prove_by_refinement( + `!V X. + pack_nonlinear_non_ox3q1h /\ + saturated V /\ + packing V /\ + mcell_set V X /\ + critical_edgeX V X = {} + ==> gammaX V X lmfun >= &0`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY ` ~(?i ul. ul IN barV V 3 /\ (i = 1 \/ i = 2) /\ X = mcell i V ul)` ASM_CASES_TAC; + INTRO_TAC Tskajxy_034.TSKAJXY_034 []; + ANTS_TAC; + EVERY (map (fun t -> INTRO_TAC (Merge_ineq.get_pack_nonlinear_non_ox3q1h t) []) tsk_required_ineq); + REPEAT WEAK_STRIP_TAC THEN ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC Merge_ineq.GRKIBMP; + BY(ASM_REWRITE_TAC[]); + MATCH_MP_TAC Merge_ineq.cell3_from_ineq_thm; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[Tskajxy_034.TSKAJXY_statement_special_case]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[GSYM Bump.MCELL1]; + MATCH_MP_TAC TSKAJXY_1; + BY(ASM_MESON_TAC[IN]); + ASM_REWRITE_TAC[GSYM Bump.MCELL2]; + MATCH_MP_TAC TSKAJXY_2; + BY(ASM_MESON_TAC[IN]) + ]);; + (* }}} *) + +end;; + diff --git a/text_formalization/packing/TSKAJXY_034.hl b/text_formalization/packing/TSKAJXY_034.hl new file mode 100644 index 0000000..a3743ba --- /dev/null +++ b/text_formalization/packing/TSKAJXY_034.hl @@ -0,0 +1,749 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Author : VU KHAC KY *) +(* Book lemma: TSKAJXY *) +(* Chapter : Packing (Clusters) *) +(* Date: November 2013 *) +(* *) +(* ========================================================================= *) + + +(* + +This does the special cases of Lemma TSKAJXY for 0, 3, and 4-cells + +*) + +module Tskajxy_034 = struct + +open Sphere;; +open Euler_main_theorem;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Pack2;; +open Packing3;; +open Rogers;; +open Vukhacky_tactics;; +open Marchal_cells;; +open Emnwuus;; +(* open Marchal_cells_2;; *) +open Marchal_cells_2_new;; +open Urrphbz1;; +open Lepjbdj;; +open Hdtfnfz;; +open Rvfxzbu;; +open Sltstlo;; +open Urrphbz2;; +open Urrphbz3;; +open Ynhyjit;; +open Njiutiu;; +open Tezffsk;; +open Qzksykg;; +open Ddzuphj;; +open Ajripqn;; +open Qzyzmjc;; +open Upfzbzm_support_lemmas;; +open Marchal_cells_3;; +open Grutoti;; +open Kizhltl;; +open Sum_gammax_lmfun_estimate;; +open Upfzbzm;; +open Rdwkarc;; +open Ineq;; +open Merge_ineq;; +open Hales_tactic;; +open Tskajxy_lemmas;; + +(* ======================================================================== *) + +let cell3_from_ineq = + `!y4 y5 y6. + &2 <= y4 /\ + &2 <= y5 /\ + &2 <= y6 /\ + y4 <= &2 * sqrt (&2) /\ + y5 <= &2 * sqrt (&2) /\ + y6 <= &2 * sqrt (&2) /\ + eta_y y4 y5 y6 < sqrt (&2) + ==> &0 <= gamma3f y4 y5 y6 sqrt2 lmfun`;; + + +let GRKIBMP_concl = + `!y. &2 <= y /\ y <= sqrt8 ==> + &0 <= gamma2_x_div_azim_v2 (h0cut y) (y*y)`;; + +let tsk_hyp_new = mk_conj(GRKIBMP_concl, + mk_conj(cell3_from_ineq,tsk_hyp));; + +let TSKAJXY_statement_special_case = new_definition + `TSKAJXY_statement_special_case <=> + (!V X. + saturated V /\ + packing V /\ + mcell_set V X /\ + ~(?i ul. ul IN barV V 3 /\ (i = 1 \/ i = 2) /\ X = mcell i V ul) /\ + critical_edgeX V X = {} + ==> gammaX V X lmfun >= &0)`;; + +g (mk_imp(tsk_hyp_new,`TSKAJXY_statement_special_case`));; + +let TSKAJXY_034 = Prove_by_refinement.prove_by_refinement( + (mk_imp(tsk_hyp_new,`TSKAJXY_statement_special_case`)), + (* {{{ proof *) + [ + (STRIP_TAC); + (REWRITE_TAC[TSKAJXY_statement_special_case; mcell_set; IN_ELIM_THM]); + (REWRITE_TAC[IN]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `NULLSET X`); + (REWRITE_TAC[gammaX]); + (MATCH_MP_TAC (REAL_ARITH `x = &0 /\ y = &0 /\ z = &0 ==> x - y + z >= &0`)); + (REWRITE_TAC[total_solid; REAL_ENTIRE]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC MEASURE_EQ_0); + BY((ASM_REWRITE_TAC[])); + (DISJ2_TAC); + (REWRITE_WITH `VX V X = {}`); + (REWRITE_TAC[VX]); + BY((ASM_REWRITE_TAC[])); + BY((REWRITE_TAC[SUM_CLAUSES])); + (DISJ2_TAC); + (REWRITE_WITH `edgeX V X = {}`); + (REWRITE_TAC[edgeX]); + (REWRITE_WITH `VX V X = {}`); + (REWRITE_TAC[VX]); + BY((ASM_REWRITE_TAC[])); + (ONCE_REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`]); + BY((SET_TAC[])); + BY((REWRITE_TAC[SUM_CLAUSES])); + (NEW_GOAL `~(X:real^3->bool = {})`); + BY((STRIP_TAC THEN SWITCH_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[ASSUME `X:real^3->bool = {}`; NEGLIGIBLE_EMPTY])); + (ASM_CASES_TAC `i >= 4`); + (NEW_GOAL `X = mcell4 V ul`); + (ASM_REWRITE_TAC[]); + BY((ASM_SIMP_TAC[MCELL_EXPLICIT])); + (UP_ASM_TAC THEN REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0; u1; u2; u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + BY((EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[])); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[ASSUME `ul = [u0; u1; u2; u3:real^3]`; set_of_list]); + (STRIP_TAC); + (ABBREV_TAC `y1 = dist (u0:real^3, u1)`); + (ABBREV_TAC `y2 = dist (u0:real^3, u2)`); + (ABBREV_TAC `y3 = dist (u0:real^3, u3)`); + (ABBREV_TAC `y4 = dist (u2:real^3, u3)`); + (ABBREV_TAC `y5 = dist (u1:real^3, u3)`); + (ABBREV_TAC `y6 = dist (u1:real^3, u2)`); + (NEW_GOAL `VX V X = {u0,u1,u2,u3}`); + (REWRITE_WITH `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + BY((ASM_REWRITE_TAC[])); + (REWRITE_WITH `X = mcell 4 V ul`); + (ASM_REWRITE_TAC[]); + BY((MESON_TAC[ARITH_RULE `4 >= 4`; ASSUME `i >= 4`; MCELL_EXPLICIT])); + (REWRITE_WITH `V INTER mcell 4 V ul = set_of_list (truncate_simplex (4 - 1) ul)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 4 /\ 4 <= 4`]); + (REWRITE_WITH ` mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + BY((MESON_TAC[ARITH_RULE `4 >= 4`; ASSUME `i >= 4`; MCELL_EXPLICIT])); + BY((ASM_REWRITE_TAC[])); + BY((ASM_REWRITE_TAC[ARITH_RULE `4 - 1 = 3`; TRUNCATE_SIMPLEX_EXPLICIT_3; set_of_list])); + (REWRITE_WITH `vol X = vol_y y1 y2 y3 y4 y5 y6 /\ gammaX V X lmfun = gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun`); + (MATCH_MP_TAC gammaX_gamm4fgcy); + (EXISTS_TAC `ul:(real^3)list`); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (EXISTS_TAC `i:num`); + BY((ASM_REWRITE_TAC[])); + (NEW_GOAL `!y1 y2 y3 y4 y5 y6. ineq [#2.0,y1,sqrt8; #2.0,y2,sqrt8; #2.0,y3,sqrt8; #2.0,y4,sqrt8; #2.0, y5, sqrt8; #2.0,y6,sqrt8] (~critical_edge_y y1 /\ ~critical_edge_y y2 /\ ~critical_edge_y y3 /\ ~critical_edge_y y4 /\ ~critical_edge_y y5 /\ ~critical_edge_y y6 /\ &0 < delta_y y1 y2 y3 y4 y5 y6 /\ rad2_y y1 y2 y3 y4 y5 y6 < &2 ==> gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun >= &0)`); + (MATCH_MP_TAC TSKAJXY_DERIVED4); + BY((ASM_REWRITE_TAC[])); + (UP_ASM_TAC THEN REWRITE_TAC[ineq; MESON[] `a ==> b ==> c <=> (a /\ b) ==> c`] THEN STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `~(critical_edge_y y1) /\ ~(critical_edge_y y2) /\ ~(critical_edge_y y3) /\ ~(critical_edge_y y4) /\ ~(critical_edge_y y5) /\ ~(critical_edge_y y6) /\ &0 < delta_y y1 y2 y3 y4 y5 y6`); + (REWRITE_TAC[critical_edge_y]); + (REPEAT STRIP_TAC); + (NEW_GOAL `{u0:real^3, u1} IN critical_edgeX V X`); + (REWRITE_TAC[critical_edgeX; IN; IN_ELIM_THM]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (REWRITE_TAC[HL_2; edgeX; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + BY((ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[])); + (STRIP_TAC); + BY((ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[])); + (STRIP_TAC THEN UNDISCH_TAC `&2 * hminus <= y1`); + (EXPAND_TAC "y1" THEN REWRITE_TAC[dist; ASSUME `u0:real^3 = u1`; NORM_ARITH `norm (u1 - u1) = &0`; REAL_ARITH `~(&2 * s <= &0) <=> &0 < s`]); + BY((MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC)); + BY((ASM_REAL_ARITH_TAC)); + BY((ASM_REAL_ARITH_TAC)); + BY((ASM_SET_TAC[])); + (NEW_GOAL `{u0:real^3, u2} IN critical_edgeX V X`); + (REWRITE_TAC[critical_edgeX; IN; IN_ELIM_THM]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u2:real^3`); + (REWRITE_TAC[HL_2; edgeX; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u2:real^3`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + BY((ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[])); + (STRIP_TAC); + BY((ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[])); + (STRIP_TAC THEN UNDISCH_TAC `&2 * hminus <= y2`); + (EXPAND_TAC "y2" THEN REWRITE_TAC[dist; ASSUME `u0:real^3 = u2`; NORM_ARITH `norm (u2 - u2) = &0`; REAL_ARITH `~(&2 * s <= &0) <=> &0 < s`]); + BY((MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC)); + BY((ASM_REAL_ARITH_TAC)); + BY((ASM_REAL_ARITH_TAC)); + BY((ASM_SET_TAC[])); + (NEW_GOAL `{u0:real^3, u3} IN critical_edgeX V X`); + (REWRITE_TAC[critical_edgeX; IN; IN_ELIM_THM]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u3:real^3`); + (REWRITE_TAC[HL_2; edgeX; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + BY((ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[])); + (STRIP_TAC); + BY((ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[])); + (STRIP_TAC THEN UNDISCH_TAC `&2 * hminus <= y3`); + (EXPAND_TAC "y3" THEN REWRITE_TAC[dist; ASSUME `u0:real^3 = u3`; NORM_ARITH `norm (u3 - u3) = &0`; REAL_ARITH `~(&2 * s <= &0) <=> &0 < s`]); + BY((MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC)); + BY((ASM_REAL_ARITH_TAC)); + BY((ASM_REAL_ARITH_TAC)); + BY((ASM_SET_TAC[])); + (NEW_GOAL `{u2:real^3, u3} IN critical_edgeX V X`); + (REWRITE_TAC[critical_edgeX; IN; IN_ELIM_THM]); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (REWRITE_TAC[HL_2; edgeX; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + BY((ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[])); + (STRIP_TAC); + BY((ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[])); + (STRIP_TAC THEN UNDISCH_TAC `&2 * hminus <= y4`); + (EXPAND_TAC "y4" THEN REWRITE_TAC[dist; ASSUME `u2:real^3 = u3`; NORM_ARITH `norm (u3 - u3) = &0`; REAL_ARITH `~(&2 * s <= &0) <=> &0 < s`]); + BY((MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC)); + BY((ASM_REAL_ARITH_TAC)); + BY((ASM_REAL_ARITH_TAC)); + BY((ASM_SET_TAC[])); + (NEW_GOAL `{u1:real^3, u3} IN critical_edgeX V X`); + (REWRITE_TAC[critical_edgeX; IN; IN_ELIM_THM]); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u3:real^3`); + (REWRITE_TAC[HL_2; edgeX; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + BY((ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[])); + (STRIP_TAC); + BY((ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[])); + (STRIP_TAC THEN UNDISCH_TAC `&2 * hminus <= y5`); + (EXPAND_TAC "y5" THEN REWRITE_TAC[dist; ASSUME `u1:real^3 = u3`; NORM_ARITH `norm (u3 - u3) = &0`; REAL_ARITH `~(&2 * s <= &0) <=> &0 < s`]); + BY((MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC)); + BY((ASM_REAL_ARITH_TAC)); + BY((ASM_REAL_ARITH_TAC)); + BY((ASM_SET_TAC[])); + (NEW_GOAL `{u1:real^3, u2} IN critical_edgeX V X`); + (REWRITE_TAC[critical_edgeX; IN; IN_ELIM_THM]); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3`); + (REWRITE_TAC[HL_2; edgeX; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + BY((ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[])); + (STRIP_TAC); + BY((ONCE_REWRITE_TAC[MESON[IN] `s t <=> t IN s`] THEN SET_TAC[])); + (STRIP_TAC THEN UNDISCH_TAC `&2 * hminus <= y6`); + (EXPAND_TAC "y6" THEN REWRITE_TAC[dist; ASSUME `u1:real^3 = u2`; NORM_ARITH `norm (u2 - u2) = &0`; REAL_ARITH `~(&2 * s <= &0) <=> &0 < s`]); + BY((MP_TAC Nonlinear_lemma.hminus_prop THEN REAL_ARITH_TAC)); + BY((ASM_REAL_ARITH_TAC)); + BY((ASM_REAL_ARITH_TAC)); + BY((ASM_SET_TAC[])); + (REWRITE_WITH `&0 < delta_y y1 y2 y3 y4 y5 y6 <=> &0 < sqrt (delta_y y1 y2 y3 y4 y5 y6)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC SQRT_LT_0); + (REWRITE_TAC[delta_y]); + (ABBREV_TAC `x1 = y1 * y1` THEN ABBREV_TAC `x2 = y2 * y2`); + (ABBREV_TAC `x3 = y3 * y3` THEN ABBREV_TAC `x4 = y4 * y4`); + (ABBREV_TAC `x5 = y5 * y5` THEN ABBREV_TAC `x6 = y6 * y6`); + (REWRITE_WITH `delta_x x1 x2 x3 x4 x5 x6 = (let a = u1:real^3 - u0 in let b = u2 - u0 in let c = u3 - u0 in &4 * (a$1 * b$2 * c$3 - a$1 * b$3 * c$2 - a$2 * b$1 * c$3 + a$2 * b$3 * c$1 + a$3 * b$1 * c$2 - a$3 * b$2 * c$1) pow 2)`); + (MATCH_MP_TAC Delta_x.COMPUTE_DELTA_X); + (REWRITE_TAC[xlist; ylist]); + (REPEAT LET_TAC); + (EXPAND_TAC "x1" THEN EXPAND_TAC "x2" THEN EXPAND_TAC "x3"); + (EXPAND_TAC "x4" THEN EXPAND_TAC "x5" THEN EXPAND_TAC "x6"); + (UP_ASM_TAC THEN REWRITE_TAC[PAIR_EQ; GSYM REAL_POW_2]); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + BY((ASM_REWRITE_TAC[])); + (REPEAT LET_TAC); + (REWRITE_TAC[REAL_ARITH `&0 <= &4 * a <=> &0 <= a`]); + BY((REWRITE_TAC[Real_ext.REAL_LE_POW_2])); + (ONCE_REWRITE_TAC[REAL_ARITH `&0 < a <=> &0 < a / &12`]); + (REWRITE_WITH `sqrt (delta_y y1 y2 y3 y4 y5 y6) / &12 = vol (convex hull {u0,u1,u2,u3})`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[delta_y; GSYM REAL_POW_2]); + (EXPAND_TAC "y1" THEN EXPAND_TAC "y2" THEN EXPAND_TAC "y3"); + (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6"); + BY((REWRITE_TAC[VOLUME_OF_CLOSED_TETRAHEDRON])); + (REWRITE_TAC[GSYM (ASSUME `X = convex hull {u0, u1, u2, u3:real^3}`)]); + (REWRITE_WITH `&0 < vol X <=> ~NULLSET X`); + (MATCH_MP_TAC MEASURABLE_MEASURE_POS_LT); + (REWRITE_TAC[ASSUME `X = convex hull {u0, u1, u2, u3:real^3}`]); + (MATCH_MP_TAC MEASURABLE_CONVEX_HULL); + (MATCH_MP_TAC FINITE_IMP_BOUNDED); + BY((REWRITE_TAC[Geomdetail.FINITE6])); + BY((ASM_REWRITE_TAC[])); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `!u v. {u,v} IN edgeX V X ==> (#2.0 <= dist (u,v) /\ dist(u,v) <= sqrt8)`); + (REPEAT GEN_TAC); + (REWRITE_TAC[edgeX; IN]); + (REWRITE_TAC[MESON[IN] `VX V X x <=> x IN VX V X`]); + (ASM_REWRITE_TAC[IN_ELIM_THM]); + (STRIP_TAC); + (MP_TAC (ASSUME `packing V`)); + (REWRITE_TAC[packing; REAL_ARITH `#2.0 = &2`] THEN STRIP_TAC); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `u:real^3 IN {u0,u1,u2,u3} /\ v IN {u0,u1,u2,u3}`); + (DEL_TAC THEN UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC); + BY((SET_TAC[])); + (NEW_GOAL `{u0,u1,u2,u3:real^3} SUBSET V`); + (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (MATCH_MP_TAC BARV_SUBSET); + BY((EXISTS_TAC `3` THEN ASM_REWRITE_TAC[])); + (STRIP_TAC); + (REWRITE_TAC[MESON[IN] `(V:real^3->bool) x <=> x IN V`]); + BY((UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[])); + (STRIP_TAC); + (REWRITE_TAC[MESON[IN] `(V:real^3->bool) x <=> x IN V`]); + BY((UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[])); + (DEL_TAC THEN DEL_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC); + BY((SET_TAC[])); + (ABBREV_TAC `s = circumcenter {u0,u1,u2,u3:real^3}`); + (NEW_GOAL `dist (u,v:real^3) <= dist (s,u) + dist (s, v)`); + BY((NORM_ARITH_TAC)); + (NEW_GOAL `!w. w IN {u0,u1,u2,u3:real^3} ==> radV {u0,u1,u2,u3:real^3} = dist (circumcenter {u0,u1,u2,u3:real^3},w)`); + (MATCH_MP_TAC Rogers.OAPVION2); + (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT); + BY((EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[])); + (NEW_GOAL `dist (s,u) + dist (s,v:real^3) <= sqrt8`); + (REWRITE_TAC[Nonlinear_lemma.sqrt8_sqrt2; sqrt2]); + (MATCH_MP_TAC (REAL_ARITH `a < x /\ b < x ==> a + b <= &2 * x`)); + (STRIP_TAC); + (REWRITE_WITH `dist (s,u:real^3) = radV {u0,u1,u2,u3:real^3}`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (EXPAND_TAC "s"); + (FIRST_ASSUM MATCH_MP_TAC); + (DEL_TAC THEN DEL_TAC THEN DEL_TAC THEN DEL_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC); + BY((SET_TAC[])); + (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (REWRITE_TAC[GSYM HL]); + BY((ASM_REWRITE_TAC[])); + (REWRITE_WITH `dist (s,v:real^3) = radV {u0,u1,u2,u3:real^3}`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (EXPAND_TAC "s"); + (FIRST_ASSUM MATCH_MP_TAC); + (DEL_TAC THEN DEL_TAC THEN DEL_TAC THEN DEL_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC); + BY((SET_TAC[])); + (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (REWRITE_TAC[GSYM HL]); + BY((ASM_REWRITE_TAC[])); + BY((ASM_REAL_ARITH_TAC)); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} = 4`); + (REWRITE_TAC[ARITH_RULE `4 = 3 + 1`; GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA); + BY((EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[])); + (NEW_GOAL `~(u0 = u1:real^3) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ ~(u1 = u2) /\ ~(u1 = u3) /\ ~(u2 = u3)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + BY((REWRITE_TAC[ASSUME `u0 = u1:real^3`; SET_RULE `{u1, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ])); + BY((ASM_ARITH_TAC)); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + BY((REWRITE_TAC[ASSUME `u0 = u2:real^3`; SET_RULE `{u2, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ])); + BY((ASM_ARITH_TAC)); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + BY((REWRITE_TAC[ASSUME `u0 = u3:real^3`; SET_RULE `{u3, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ])); + BY((ASM_ARITH_TAC)); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + BY((REWRITE_TAC[ASSUME `u1 = u2:real^3`; SET_RULE `{u0, u2, u2, u3} = {u0,u2,u3}`;Geomdetail.CARD3 ])); + BY((ASM_ARITH_TAC)); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + BY((REWRITE_TAC[ASSUME `u1 = u3:real^3`; SET_RULE `{u0, u3, u2, u3} = {u0,u2,u3}`;Geomdetail.CARD3 ])); + BY((ASM_ARITH_TAC)); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + BY((REWRITE_TAC[ASSUME `u2 = u3:real^3`; SET_RULE `{u0, u1, u3, u3} = {u0,u1,u3}`;Geomdetail.CARD3 ])); + BY((ASM_ARITH_TAC)); + (NEW_GOAL `edgeX V X = {{u0,u1:real^3}, {u0,u2}, {u0,u3}, {u1,u2}, {u1,u3}, {u2,u3}}`); + (REWRITE_TAC[edgeX]); + (ONCE_REWRITE_TAC[SET_EQ_LEMMA]); + (REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `VX V X u` THEN UNDISCH_TAC `VX V X v`); + (REWRITE_TAC[MESON[IN] `VX V X s <=> s IN VX V X`]); + (ASM_REWRITE_TAC[SET_RULE `v IN {u0, u1, u2, u3} <=> v = u0 \/ v = u1 \/ v = u2 \/ v = u3`]); + (REPEAT STRIP_TAC); + (NEW_GOAL `F`); + BY((ASM_MESON_TAC[])); + BY((ASM_MESON_TAC[])); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + BY((SET_TAC[])); + BY((ASM_REWRITE_TAC[] THEN SET_TAC[])); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + BY((SET_TAC[])); + BY((ASM_REWRITE_TAC[] THEN SET_TAC[])); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + BY((SET_TAC[])); + BY((ASM_REWRITE_TAC[] THEN SET_TAC[])); + BY((ASM_REWRITE_TAC[] THEN SET_TAC[])); + (NEW_GOAL `F`); + BY((ASM_MESON_TAC[])); + BY((ASM_MESON_TAC[])); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + BY((SET_TAC[])); + BY((ASM_REWRITE_TAC[] THEN SET_TAC[])); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + BY((SET_TAC[])); + BY((ASM_REWRITE_TAC[] THEN SET_TAC[])); + BY((ASM_REWRITE_TAC[] THEN SET_TAC[])); + BY((ASM_REWRITE_TAC[] THEN SET_TAC[])); + (NEW_GOAL `F`); + BY((ASM_MESON_TAC[])); + BY((ASM_MESON_TAC[])); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + BY((SET_TAC[])); + BY((ASM_REWRITE_TAC[] THEN SET_TAC[])); + BY((ASM_REWRITE_TAC[] THEN SET_TAC[])); + BY((ASM_REWRITE_TAC[] THEN SET_TAC[])); + BY((ASM_REWRITE_TAC[] THEN SET_TAC[])); + (NEW_GOAL `F`); + BY((ASM_MESON_TAC[])); + BY((ASM_MESON_TAC[])); + (UP_ASM_TAC THEN REWRITE_TAC[SET_RULE `x IN {a,b,c,d,e,f} <=> x = a \/ x = b \/ x = c \/ x = d \/ x = e \/ x = f`]); + (REWRITE_TAC[MESON[IN] `VX V X s <=> s IN VX V X`]); + (ASM_REWRITE_TAC[SET_RULE `v IN {u0, u1, u2, u3} <=> v = u0 \/ v = u1 \/ v = u2 \/ v = u3`]); + (REPEAT STRIP_TAC); + BY((EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN ASM_REWRITE_TAC[])); + BY((EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u2:real^3` THEN ASM_REWRITE_TAC[])); + BY((EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u3:real^3` THEN ASM_REWRITE_TAC[])); + BY((EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN ASM_REWRITE_TAC[])); + BY((EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u3:real^3` THEN ASM_REWRITE_TAC[])); + BY((EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3` THEN ASM_REWRITE_TAC[])); + (STRIP_TAC); + (EXPAND_TAC "y1"); + (FIRST_ASSUM MATCH_MP_TAC); + BY((ASM_REWRITE_TAC[] THEN SET_TAC[])); + (STRIP_TAC); + (EXPAND_TAC "y2"); + (FIRST_ASSUM MATCH_MP_TAC); + BY((ASM_REWRITE_TAC[] THEN SET_TAC[])); + (STRIP_TAC); + (EXPAND_TAC "y3"); + (FIRST_ASSUM MATCH_MP_TAC); + BY((ASM_REWRITE_TAC[] THEN SET_TAC[])); + (STRIP_TAC); + (EXPAND_TAC "y4"); + (FIRST_ASSUM MATCH_MP_TAC); + BY((ASM_REWRITE_TAC[] THEN SET_TAC[])); + (STRIP_TAC); + (EXPAND_TAC "y5"); + (FIRST_ASSUM MATCH_MP_TAC); + BY((ASM_REWRITE_TAC[] THEN SET_TAC[])); + (STRIP_TAC); + (EXPAND_TAC "y6"); + (FIRST_ASSUM MATCH_MP_TAC); + BY((ASM_REWRITE_TAC[] THEN SET_TAC[])); + (REWRITE_WITH `rad2_y y1 y2 y3 y4 y5 y6 = radV {u0,u1,u2,u3:real^3} pow 2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[rad2_y; y_of_x]); + (GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] Merge_ineq.GDRQXLGv2)); + (STRIP_TAC); + (STRIP_TAC); + (REWRITE_TAC[ARITH_RULE `4 = 3 + 1`; GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA); + BY((EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[])); + (REWRITE_TAC[Collect_geom.coplanar_alt]); + (REWRITE_TAC[GSYM Trigonometry2.coplanar1]); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {u0, u1, u2, u3:real^3} SUBSET affine hull (affine hull {u, v, w})`); + BY((ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA])); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = affine hull {u:real^3, v, w}`); + BY((REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL])); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + BY((ASM_REWRITE_TAC[])); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (REWRITE_WITH `mcell i V ul = mcell4 V ul`); + BY((MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT; ASSUME `i >= 4`])); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + BY((ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL])); + BY((SET_TAC[])); + BY((UP_ASM_TAC THEN ASM_REWRITE_TAC[])); + (REWRITE_TAC[GSYM REAL_POW_2]); + (EXPAND_TAC "y1" THEN EXPAND_TAC "y2" THEN EXPAND_TAC "y3"); + (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6"); + BY((REWRITE_TAC[])); + (REWRITE_WITH `radV {u0, u1, u2, u3:real^3} = hl (ul:(real^3)list)`); + BY((ASM_REWRITE_TAC[HL;set_of_list])); + (REWRITE_WITH `hl (ul:(real^3)list) pow 2 < &2 <=> sqrt (hl ul pow 2) < sqrt (&2)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Real_ext.REAL_PROP_LT_SQRT); + BY((REWRITE_TAC[REAL_LE_POW_2] THEN REAL_ARITH_TAC)); + (REWRITE_WITH `sqrt (hl (ul:(real^3)list) pow 2) = hl ul`); + (MATCH_MP_TAC POW_2_SQRT); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`)); + (NEW_GOAL `hl (truncate_simplex 1 ul) <= hl (ul:(real^3)list)`); + (MATCH_MP_TAC Rogers.HL_DECREASE); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3`); + BY((ASM_REWRITE_TAC[IN; ARITH_RULE `1 <= 3`])); + (NEW_GOAL `&0 < hl (truncate_simplex 1 (ul:(real^3)list))`); + (MATCH_MP_TAC Marchal_cells_2_new.BARV_IMP_HL_1_POS_LT); + BY((EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[])); + BY((ASM_REAL_ARITH_TAC)); + BY((ASM_REWRITE_TAC[])); + (STRIP_TAC); + (NEW_GOAL `F`); + BY((UP_ASM_TAC THEN ASM_REWRITE_TAC[])); + BY((UP_ASM_TAC THEN ASM_REWRITE_TAC[])); + (COMMENT "END OF 4-CELL CASE"); + (ASM_CASES_TAC `i = 0`); + (NEW_GOAL `VX V X = {}`); + (REWRITE_WITH `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + BY((ASM_REWRITE_TAC[])); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + BY((ASM_REWRITE_TAC[])); + (NEW_GOAL `edgeX V X = {}`); + (REWRITE_TAC[edgeX]); + (ASM_REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`; SET_RULE `x IN {} <=> F`]); + BY((SET_TAC[])); + (REWRITE_TAC[gammaX]); + (MATCH_MP_TAC (REAL_ARITH `b = &0 /\ c = &0 /\ &0 <= a ==> a - b + c >= &0`)); + (REPEAT STRIP_TAC); + BY((ASM_REWRITE_TAC[total_solid; SUM_CLAUSES] THEN REAL_ARITH_TAC)); + BY((ASM_REWRITE_TAC[SUM_CLAUSES] THEN REAL_ARITH_TAC)); + (MATCH_MP_TAC MEASURE_POS_LE); + (ASM_REWRITE_TAC[] THEN MATCH_MP_TAC Urrphbz1.MEASURABLE_MCELL); + BY((ASM_REWRITE_TAC[])); + COMMENT "insert. thales. Jan 2013"; + FIRST_X_ASSUM_ST `gamma3f` MP_TAC; + REPEAT (FIRST_X_ASSUM_ST `ineq` kill); + DISCH_TAC; + TYPIFY `i = 3` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC (arith `~(i >= 4) /\ ~(i=0) /\ ~((i=1) \/ (i=2)) ==> (i = 3)`); + REPLICATE_TAC 9 (FIRST_X_ASSUM MP_TAC); + REPEAT (FIRST_X_ASSUM kill); + BY(MESON_TAC[]); + REPEAT (FIRST_X_ASSUM_ST `gamma4fgcy` kill); + COMMENT "end of insert"; + (NEW_GOAL `X = mcell3 V ul`); + (ASM_REWRITE_TAC[]); + BY((ASM_SIMP_TAC[MCELL_EXPLICIT])); + (UP_ASM_TAC THEN REWRITE_TAC[mcell3]); + (COND_CASES_TAC); + (STRIP_TAC); + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0; u1; u2; u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + BY((EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[])); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `(?s. between s (omega_list_n V ul 2,omega_list_n V ul 3) /\ dist (u0,s) = sqrt (&2) /\ mxi V ul = s)`); + (MATCH_MP_TAC MXI_EXPLICIT); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + BY((ASM_REWRITE_TAC[])); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `s2 = omega_list_n V ul 2`); + (ABBREV_TAC `s3 = omega_list_n V ul 3`); + (ABBREV_TAC `vl = truncate_simplex 2 (ul:(real^3)list)`); + (NEW_GOAL `s2 IN voronoi_list V vl`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "vl"); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + BY((ARITH_TAC)); + (NEW_GOAL `s3 IN voronoi_list V vl`); + (EXPAND_TAC "s3" THEN EXPAND_TAC "vl"); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + BY((ARITH_TAC)); + (NEW_GOAL `s IN voronoi_list V vl`); + (MATCH_MP_TAC (SET_RULE `(?x. s IN x /\ x SUBSET t)==> s IN t`)); + (EXISTS_TAC `convex hull {s2,s3:real^3}`); + (STRIP_TAC); + BY((ASM_REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL])); + (NEW_GOAL `voronoi_list V vl = convex hull (voronoi_list V vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + BY((REWRITE_TAC[CONVEX_HULL_EQ; Packing3.CONVEX_VORONOI_LIST])); + (ONCE_REWRITE_TAC[ASSUME `voronoi_list V vl = convex hull voronoi_list V vl`]); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + BY((ASM_SET_TAC[])); + (MP_TAC (ASSUME `s IN voronoi_list V vl`)); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; TRUNCATE_SIMPLEX_EXPLICIT_2; VORONOI_LIST; VORONOI_SET; set_of_list; SET_RULE `x IN {a,b,c} <=> x=a\/x=b\/x=c`; IN_INTERS]); + (STRIP_TAC); + (NEW_GOAL `s IN voronoi_closed V u0 /\ s IN voronoi_closed V u1 /\ s IN voronoi_closed V (u2:real^3)`); + BY((UP_ASM_TAC THEN SET_TAC[])); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM] THEN STRIP_TAC); + (NEW_GOAL `u0 IN V /\ u1 IN V /\ u2 IN V /\ (u3:real^3) IN V`); + (REWRITE_TAC[SET_RULE `u0 IN V /\ u1 IN V /\ u2 IN V /\ (u3:real^3) IN V <=> {u0,u1,u2,u3} SUBSET V`; GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (MATCH_MP_TAC BARV_SUBSET); + BY((EXISTS_TAC `3` THEN ASM_REWRITE_TAC[])); + (FIRST_ASSUM MP_TAC THEN REWRITE_TAC[IN] THEN STRIP_TAC); + (NEW_GOAL `dist (s,u1:real^3) = sqrt(&2)`); + (REWRITE_TAC[GSYM (ASSUME `dist (u0:real^3, s) = sqrt (&2)`)]); + (REWRITE_WITH `dist (u0,s:real^3) = dist (s,u0)`); + BY((NORM_ARITH_TAC)); + (REWRITE_TAC[REAL_ARITH `a = b <=> a <= b /\ b <= a`]); + BY((ASM_SIMP_TAC[])); + (NEW_GOAL `dist (s,u2:real^3) = sqrt(&2)`); + (REWRITE_TAC[GSYM (ASSUME `dist (u0:real^3, s) = sqrt (&2)`)]); + (REWRITE_WITH `dist (u0,s:real^3) = dist (s,u0)`); + BY((NORM_ARITH_TAC)); + (REWRITE_TAC[REAL_ARITH `a = b <=> a <= b /\ b <= a`]); + BY((ASM_SIMP_TAC[])); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} = 4`); + (REWRITE_TAC[ARITH_RULE `4 = 3 + 1`; GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA); + BY((EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[])); + (NEW_GOAL `~(u0 = u1:real^3) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ ~(u1 = u2) /\ ~(u1 = u3) /\ ~(u2 = u3)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + BY((REWRITE_TAC[ASSUME `u0 = u1:real^3`; SET_RULE `{u1, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ])); + BY((ASM_ARITH_TAC)); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + BY((REWRITE_TAC[ASSUME `u0 = u2:real^3`; SET_RULE `{u2, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ])); + BY((ASM_ARITH_TAC)); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + BY((REWRITE_TAC[ASSUME `u0 = u3:real^3`; SET_RULE `{u3, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ])); + BY((ASM_ARITH_TAC)); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + BY((REWRITE_TAC[ASSUME `u1 = u2:real^3`; SET_RULE `{u0, u2, u2, u3} = {u0,u2,u3}`;Geomdetail.CARD3 ])); + BY((ASM_ARITH_TAC)); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + BY((REWRITE_TAC[ASSUME `u1 = u3:real^3`; SET_RULE `{u0, u3, u2, u3} = {u0,u2,u3}`;Geomdetail.CARD3 ])); + BY((ASM_ARITH_TAC)); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + BY((REWRITE_TAC[ASSUME `u2 = u3:real^3`; SET_RULE `{u0, u1, u3, u3} = {u0,u1,u3}`;Geomdetail.CARD3 ])); + BY((ASM_ARITH_TAC)); + (NEW_GOAL `VX V X = {u0,u1,u2}`); + (REWRITE_WITH `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `3`); + BY((ASM_REWRITE_TAC[])); + (REWRITE_WITH `X = mcell 3 V ul`); + BY((ASM_REWRITE_TAC[])); + (REWRITE_WITH `V INTER mcell 3 V ul = set_of_list (truncate_simplex (3 - 1) ul)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3 /\ 3 <= 4`]); + (REWRITE_WITH ` mcell 3 V [u0; u1; u2; u3] = X`); + BY((ASM_REWRITE_TAC[])); + BY((ASM_REWRITE_TAC[])); + BY((ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list])); + (UNDISCH_TAC `X = convex hull (set_of_list vl UNION {mxi V ul})`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_2; ASSUME `ul = [u0;u1;u2;u3:real^3]`; SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0; u1; u2; u3] = s`); + BY((EXPAND_TAC "s" THEN AP_TERM_TAC THEN ASM_REWRITE_TAC[])); + (STRIP_TAC); + (NEW_GOAL `~coplanar {u0,u1,u2,s:real^3}`); + (ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[ASSUME `X = convex hull {u0, u1, u2, s:real^3}`]); + (MATCH_MP_TAC COPLANAR_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, s:real^3}`); + BY((ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL])); + BY((UP_ASM_TAC THEN ASM_REWRITE_TAC[])); + (NEW_GOAL `CARD {u0, u1, u2, s:real^3} = 4`); + (NEW_GOAL `CARD {u0, u1, u2, s:real^3} <= 4`); + BY((REWRITE_TAC[Geomdetail.CARD4])); + (ASM_CASES_TAC `CARD {u0, u1, u2, s:real^3} <= 3`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, s:real^3}`); + (REWRITE_TAC[] THEN MATCH_MP_TAC COPLANAR_SMALL); + BY((ASM_REWRITE_TAC[Geomdetail.FINITE6])); + BY((UP_ASM_TAC THEN MESON_TAC[])); + BY((ASM_ARITH_TAC)); + (NEW_GOAL `~(u0 = s:real^3) /\ ~(u1 = s) /\ ~(u2 = s)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `CARD {u0, u1, u2,s:real^3} <= 3`); + BY((REWRITE_TAC[ASSUME `u0 = s:real^3`; SET_RULE `{s, u1, u2, s} = {s,u1,u2}`;Geomdetail.CARD3 ])); + BY((ASM_ARITH_TAC)); + (NEW_GOAL `CARD {u0, u1, u2, s:real^3} <= 3`); + BY((REWRITE_TAC[ASSUME `u1 = s:real^3`; SET_RULE `{u0, s, u2, s} = {u0,u2,s}`;Geomdetail.CARD3 ])); + BY((ASM_ARITH_TAC)); + (NEW_GOAL `CARD {u0, u1, u2, s:real^3} <= 3`); + BY((REWRITE_TAC[ASSUME `u2 = s:real^3`; SET_RULE `{u0, u1, s, s} = {u0,u1,s}`;Geomdetail.CARD3 ])); + BY((ASM_ARITH_TAC)); + (ABBREV_TAC `y4 = dist (u1:real^3, u2)`); + (ABBREV_TAC `y5 = dist (u0:real^3, u2)`); + (ABBREV_TAC `y6 = dist (u0:real^3, u1)`); + COMMENT "insert by thales, Jan 2013"; + INTRO_TAC Tskajxy_lemmas.gammaX_gamma3f [`V`;`X`;`ul`;`u0`;`u1`;`u2`;`u3`;`y4`;`y5`;`y6`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC THEN ASM_REWRITE_TAC[arith `x >= &0 <=> &0 <= x`]; + REPLICATE_TAC 8 (FIRST_X_ASSUM kill); + FIRST_X_ASSUM MATCH_MP_TAC; + TYPIFY `&2 <= y4 /\ &2 <= y5 /\ &2 <= y6` (C SUBGOAL_THEN ASSUME_TAC); + REPLICATE_TAC 3 (FIRST_X_ASSUM (SUBST1_TAC o SYM)); + BY(ASM_MESON_TAC[packing]); + ASM_REWRITE_TAC[]; + TYPIFY `y4 <= &2 * sqrt (&2) /\ y5 <= &2 * sqrt (&2) /\ y6 <= &2 * sqrt (&2)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + REPLICATE_TAC 3 (FIRST_X_ASSUM (SUBST1_TAC o SYM)); + TYPIFY `!(u:real^3) v. (dist(u,s) = sqrt(&2) /\ dist(v,s) = sqrt(&2)) ==> (dist(u,v) <= &2 * sqrt(&2))` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (ASSUME_TAC o (ONCE_REWRITE_RULE[DIST_SYM])); + INTRO_TAC DIST_TRIANGLE [`u`;`s`;`v`]; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REPEAT (FIRST_X_ASSUM_ST `x = sqrt(&2)` MP_TAC); + TYPIFY `!u. dist (s,u) = dist(u,s)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(MESON_TAC[DIST_SYM]); + BY(MESON_TAC[]); + INTRO_TAC Collect_geom.RADV_FORMULAR [`u0`;`u1`;`u2`]; + REWRITE_TAC[Collect_geom.dist3]; + ANTS_TAC; + BY(ASM_MESON_TAC[NOT_COPLANAR_NOT_COLLINEAR]); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `hl vl` MP_TAC; + EXPAND_TAC "vl"; + TYPIFY `hl (truncate_simplex 2 ul) = radV {u0,u1,u2}` ENOUGH_TO_SHOW_TAC; + BY(REAL_ARITH_TAC); + REWRITE_TAC[Pack_defs.HL]; + AP_TERM_TAC; + GMATCH_SIMP_TAC Bump.SET_OF_LIST_TRUNCATE_2; + ASM_REWRITE_TAC[Bump.EL_EXPLICIT]; + REWRITE_TAC[LENGTH]; + BY(ARITH_TAC); + BY(ASM_MESON_TAC[NEGLIGIBLE_EMPTY]) + ]);; + (* }}} *) + + +(* ======================================================================== *) + +(* OLD SCRIPT FOLLOWS *) + + +end;; diff --git a/text_formalization/packing/TSKAJXY_lemmas.hl b/text_formalization/packing/TSKAJXY_lemmas.hl new file mode 100644 index 0000000..eeceb43 --- /dev/null +++ b/text_formalization/packing/TSKAJXY_lemmas.hl @@ -0,0 +1,5668 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Packing *) +(* Lemma: TSKAJXY *) +(* Author: Vu Khac Ky *) +(* Date: 2012-11 *) +(* ========================================================================== *) + + +module Tskajxy_lemmas = struct + +open Sphere;; +open Euler_main_theorem;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Pack2;; +open Packing3;; +open Rogers;; +open Vukhacky_tactics;; +open Marchal_cells;; +open Emnwuus;; +(* open Marchal_cells_2;; *) +open Marchal_cells_2_new;; +open Urrphbz1;; +open Lepjbdj;; +open Hdtfnfz;; +open Rvfxzbu;; +open Sltstlo;; +open Urrphbz2;; +open Urrphbz3;; +open Ynhyjit;; +open Njiutiu;; +open Tezffsk;; +open Qzksykg;; +open Ddzuphj;; +open Ajripqn;; +open Qzyzmjc;; +open Upfzbzm_support_lemmas;; +open Marchal_cells_3;; +open Grutoti;; +open Kizhltl;; +open Sum_gammax_lmfun_estimate;; +open Upfzbzm;; +open Rdwkarc;; +open Ineq;; +open Merge_ineq;; +open Hales_tactic;; +open Collect_geom;; + +(* ------------------------------------------------------------------------ *) +(* Changed by Vu Khac Ky - 15 Nov 2012 *) +(* The tactic SET_TAC has been changed collect_geom.hl, therefore *) +(* other files cannot be processed. It causes some troubles, *) +(* so I change it back to the original one here. *) +(* ------------------------------------------------------------------------ *) + +let SET_TAC = + let PRESET_TAC = + POP_ASSUM_LIST(K ALL_TAC) THEN REPEAT COND_CASES_TAC THEN + REWRITE_TAC[EXTENSION; SUBSET; PSUBSET; DISJOINT; SING] THEN + REWRITE_TAC[NOT_IN_EMPTY; IN_UNIV; IN_UNION; IN_INTER; IN_DIFF; IN_INSERT; + IN_DELETE; IN_REST; IN_INTERS; IN_UNIONS; IN_IMAGE; + IN_ELIM_THM; IN] in + fun ths -> + (if ths = [] then ALL_TAC else MP_TAC(end_itlist CONJ ths)) THEN + PRESET_TAC THEN + MESON_TAC[];; + +let SET_RULE tm = prove(tm,SET_TAC[]);; + +(* ------------------------------------------------------------------------ *) + +let AFF_GE_1_3 = prove(`!x u v w. + DISJOINT {x} {u, v, w} + ==> aff_ge {x} {u, v, w} = + {y | ?t1 t2 t3 t4. + &0 <= t2 /\ + &0 <= t3 /\ + &0 <= t4 /\ + t1 + t2 + t3 + t4 = &1 /\ + y = t1 % x + t2 % u + t3 % v + t4 % w}`, +AFF_TAC);; + +(* ------------------------------------------------------------------------ *) + +let KY_COPLANAR_3 = prove ( + `!a b c:real^3. coplanar {a,b,c}`, + REPEAT GEN_TAC THEN REWRITE_TAC[coplanar] THEN EXISTS_TAC `a:real^3` THEN + EXISTS_TAC `b:real^3` THEN EXISTS_TAC `c:real^3` THEN + REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]);; + +(* ------------------------------------------------------------------------ *) + +let NEGLIGIBLE_MEASURE_UNION_klema = prove_by_refinement ( + `!s t. measurable s /\ measurable t /\ negligible t ==> +vol (s UNION t) = vol s`, +[(REPEAT STRIP_TAC); + (REWRITE_WITH `vol (s UNION t) = vol s + vol t - vol (s INTER t)`); + (ASM_SIMP_TAC[MEASURE_UNION]); + (REWRITE_WITH `vol t = &0`); + (ASM_SIMP_TAC[MEASURE_EQ_0]); + (REWRITE_WITH `vol (s INTER t) = &0`); + (MATCH_MP_TAC MEASURE_EQ_0); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `t:real^3->bool` THEN ASM_REWRITE_TAC[] THEN SET_TAC[]); + (REAL_ARITH_TAC)]);; + +(* ------------------------------------------------------------------------ *) +let SOL_SOLID_TRIANGLE = prove_by_refinement ( + `!v0 v1 v2 v3 a123 a231 a312. + ~coplanar {v0, v1, v2, v3} /\ + a = dihV v0 v1 v2 v3 /\ + b = dihV v0 v2 v3 v1 /\ + c = dihV v0 v3 v1 v2 + ==> sol v0 (convex hull {v0,v1,v2,v3}) = a + b + c - pi`, +[(REPEAT STRIP_TAC); + + (NEW_GOAL `CARD {v0, v1, v2, v3:real^3} = 4`); + (MATCH_MP_TAC Collect_geom2.NOT_COPLANAR_IMP_CARD4); + (ASM_REWRITE_TAC[coplanar_alt; GSYM Trigonometry2.coplanar1]); + + (NEW_GOAL `~(v0 = v1:real^3) /\ ~(v0 = v2) /\ ~(v0 = v3) /\ + ~(v1 = v2) /\ ~(v1 = v3) /\ ~(v2 = v3)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `CARD {v0, v1, v2, v3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `v0 = v1:real^3`; + SET_RULE `{v1, v1, v2, v3} = {v1,v2,v3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {v0, v1, v2, v3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `v0 = v2:real^3`; + SET_RULE `{v2, v1, v2, v3} = {v1,v2,v3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {v0, v1, v2, v3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `v0 = v3:real^3`; + SET_RULE `{v3, v1, v2, v3} = {v1,v2,v3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {v0, v1, v2, v3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `v1 = v2:real^3`; + SET_RULE `{v0, v2, v2, v3} = {v0,v2,v3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {v0, v1, v2, v3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `v1 = v3:real^3`; + SET_RULE `{v0, v3, v2, v3} = {v0,v2,v3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {v0, v1, v2, v3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `v2 = v3:real^3`; + SET_RULE `{v0, v1, v3, v3} = {v0,v1,v3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + + (REWRITE_TAC[sol]); + (ABBREV_TAC `s = closest_point (convex hull {v1,v2,v3:real^3}) v0`); + (NEW_GOAL `s IN convex hull {v1,v2,v3:real^3} /\ + (!y. y IN convex hull {v1,v2,v3} ==> dist (v0,s) <= dist (v0,y))`); + (EXPAND_TAC "s"); + (MATCH_MP_TAC CLOSEST_POINT_EXISTS); + (STRIP_TAC); + (MATCH_MP_TAC Marchal_cells_2_new.CLOSED_CONVEX_HULL_FINITE); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[CONVEX_HULL_EQ_EMPTY] THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `r = dist (v0, s:real^3)`); + (ABBREV_TAC `C = convex hull {v0,v1,v2,v3:real^3}`); + (NEW_GOAL `r > &0 /\ + measurable (C INTER normball (v0:real^3) r) /\ + radial_norm r v0 (C INTER normball v0 r)`); + (NEW_GOAL `r > &0`); + (EXPAND_TAC "r"); + (REWRITE_TAC[NORM_ARITH `dist (x,y) > &0 <=> ~(x = y)`]); + (STRIP_TAC); + + (UNDISCH_TAC `~coplanar {v0,v1,v2,v3:real^3}`); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN + EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[SUBSET; SET_RULE `a IN {x,y,z,t} <=> a=x\/a=y\/a=z\/a=t`]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `(?s. a IN s /\ s SUBSET t) ==> a IN t`)); + (EXISTS_TAC `convex hull {v1,v2,v3:real^3}`); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `(?s. a IN s /\ s SUBSET t) ==> a IN t`)); + (EXISTS_TAC `{v1,v2,v3:real^3}`); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `(?s. a IN s /\ s SUBSET t) ==> a IN t`)); + (EXISTS_TAC `{v1,v2,v3:real^3}`); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `(?s. a IN s /\ s SUBSET t) ==> a IN t`)); + (EXISTS_TAC `{v1,v2,v3:real^3}`); + (REWRITE_TAC[Qzksykg.SET_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + + (ASM_REWRITE_TAC[]); + (NEW_GOAL `measurable (C INTER normball (v0:real^3) r)`); + (MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[NORMBALL_BALL; MEASURABLE_BALL]); + (EXPAND_TAC "C"); + (MATCH_MP_TAC MEASURABLE_CONVEX_HULL); + (MATCH_MP_TAC FINITE_IMP_BOUNDED); + (REWRITE_TAC[Geomdetail.FINITE6]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[GSYM Marchal_cells_2_new.RADIAL_VS_RADIAL_NORM; radial]); + (REWRITE_TAC[NORMBALL_BALL; SET_RULE `a INTER s SUBSET s`]); + (REWRITE_TAC[IN_INTER]); + (EXPAND_TAC "C"); + (REWRITE_TAC[Marchal_cells_2_new.CONVEX_HULL_4; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (EXISTS_TAC `&1 - t * (v + w + z)`); + (EXISTS_TAC `t*v` THEN EXISTS_TAC `t*w` THEN EXISTS_TAC `t*z`); + (NEW_GOAL `&0 <= t`); + (ASM_REAL_ARITH_TAC); + (ASM_SIMP_TAC[REAL_LE_MUL]); + (REWRITE_TAC[REAL_ARITH `&1 - t * (v + w + z) + t * v + t * w + t * z = &1`]); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> ~(a < b)`]); + (STRIP_TAC); + (ABBREV_TAC `t' = &1 / (v + w + z)`); + (NEW_GOAL `v0 + t' % u IN convex hull {v1,v2,v3:real^3}`); + (REWRITE_TAC[IN; CONVEX_HULL_3; IN_ELIM_THM]); + (EXISTS_TAC `v/(v+w+z)` THEN EXISTS_TAC `w/(v+w+z)` THEN EXISTS_TAC `z/(v+w+z)`); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_SIMP_TAC[REAL_LE_ADD]); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_SIMP_TAC[REAL_LE_ADD]); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_SIMP_TAC[REAL_LE_ADD]); + (REWRITE_TAC[REAL_ARITH `a/x+b/x+c/x = (a+b+c)/x`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (STRIP_TAC); + (UNDISCH_TAC `&1 < t * (v + w + z)` THEN ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `v / (v + w + z) % v1 + w / (v + w + z) % v2 + + z / (v + w + z) % v3 = (&1/(v+w+z)) % (v%v1+w%v2+z%v3)`]); + (REWRITE_WITH `v%v1+w%v2+z%v3 = (v0:real^3) + u - u' % v0`); + (UNDISCH_TAC `v0 + u = u' % v0 + v % v1 + w % v2 + z % (v3:real^3)`); + (VECTOR_ARITH_TAC); + (MATCH_MP_TAC Trigonometry2.VECTOR_MUL_R_TO_L); + (STRIP_TAC); + (STRIP_TAC); + (UNDISCH_TAC `&1 < t * (v + w + z)` THEN ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `(v + w + z) % (v0 + t' % u) = v0 + u - u' % v0 <=> + (u' + v + w + z) % v0 + ((v + w + z) * t') % u = v0 + u`]); + (EXPAND_TAC "t'" THEN REWRITE_TAC[ASSUME `u' + v + w + z = &1`; ARITH_RULE + `x * &1 / x = x / x`; VECTOR_ARITH `&1 % x + y = x + z <=> y = z`]); + (REWRITE_WITH `(v + w + z) / (v + w + z) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (STRIP_TAC); + (UNDISCH_TAC `&1 < t * (v + w + z)` THEN ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `r <= dist(v0:real^3, v0 + t' % u)`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `t' < t:real`); + (REWRITE_TAC[REAL_ARITH `a < b <=> ~(b <= a)`] THEN STRIP_TAC); + (NEW_GOAL `t' * (v+ w + z) = &1`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `&1 = t' * (v + w + z) <=> &1/(v+w+z) = t'`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (NEW_GOAL `&0 <= v + w + z`); + (ASM_SIMP_TAC[REAL_LE_ADD]); + (NEW_GOAL `~(v + w + z = &0)`); + (STRIP_TAC); + (UNDISCH_TAC `&1 < t * (v + w + z)` THEN ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `t * (v + w + z) <= t' * (v + w + z)`); + (REWRITE_TAC[REAL_ARITH `a * x <= b * x <=> &0 <= (b - a) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[REAL_LE_ADD]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `v0 + t' % u IN ball (v0:real^3, r)`); + (REWRITE_TAC[IN_BALL; dist; VECTOR_ARITH `v0 - (v0 + t' % u) = --t' % u`]); + (REWRITE_TAC[NORM_MUL; REAL_ARITH `abs (-- t) = abs (t)`]); + (REWRITE_WITH `abs (t') = t'`); + (REWRITE_TAC[REAL_ABS_REFL]); + (EXPAND_TAC "t'" THEN MATCH_MP_TAC REAL_LE_DIV THEN ASM_SIMP_TAC[REAL_LE_ADD]); + (REAL_ARITH_TAC); + (NEW_GOAL `t' * norm u <= t * norm (u:real^3)`); + (REWRITE_TAC[REAL_ARITH `a * x <= b * x <=> &0 <= (b - a) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `v0 + t % u = + (&1 - t * (v + w + z)) % v0 + (t * v) % v1 + (t * w) % v2 + (t * z) % v3 <=> + t % u = t % (v % v1 + w % v2 + z % v3 - (v+w+z) % v0)`]); + (AP_TERM_TAC); + (REWRITE_TAC[VECTOR_ARITH `u = v % v1 + w % v2 + z % v3 - (v + w + z) % v0 + <=> (u'+v+w+z) % v0 + u = u' % v0 + v % v1 + w % v2 + z % v3 `]); + (ASM_REWRITE_TAC[VECTOR_ARITH `&1 % a = a`]); + (REWRITE_TAC[MESON[IN] `(V:real^3->bool) x <=> x IN V`]); + + (REWRITE_TAC[IN_BALL; dist; VECTOR_ARITH `v0 - (v0 + t' % u) = --t' % u`]); + (REWRITE_TAC[NORM_MUL; REAL_ARITH `abs (-- t) = abs (t)`]); + (REWRITE_WITH `abs (t) = t`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (ASM_SIMP_TAC[sol]); + + (NEW_GOAL `C INTER normball v0 r = + aff_ge {v0:real^3} {v1,v2,v3} INTER normball v0 r`); + (MATCH_MP_TAC (SET_RULE `A SUBSET B /\ B SUBSET A ==> A = B`)); + (STRIP_TAC); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> A INTER C SUBSET B INTER C`)); + (EXPAND_TAC "C"); + + (NEW_GOAL `DISJOINT {v0} {v1,v2,v3:real^3}`); + (REWRITE_TAC[DISJOINT; SET_RULE + `{v0} INTER {v1, v2, v3} = {} <=> ~(v0 = v1 \/ v0 = v2 \/ v0 = v3)`]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `~coplanar {v0,v1,v2,v3:real^3}`); + (ASM_REWRITE_TAC[SET_RULE `{a,a,c,d} = {a,c,d}`; KY_COPLANAR_3]); + (UNDISCH_TAC `~coplanar {v0,v1,v2,v3:real^3}`); + (ASM_REWRITE_TAC[SET_RULE `{c,a,c,d} = {a,c,d}`; KY_COPLANAR_3]); + (UNDISCH_TAC `~coplanar {v0,v1,v2,v3:real^3}`); + (ASM_REWRITE_TAC[SET_RULE `{d,a,c,d} = {a,c,d}`; KY_COPLANAR_3]); + (ASM_SIMP_TAC[AFF_GE_1_3]); + (EXPAND_TAC "C" THEN REWRITE_TAC[SUBSET; CONVEX_HULL_4; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real` THEN + EXISTS_TAC `w:real` THEN EXISTS_TAC `z:real` THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[SUBSET; IN_INTER]); + (NEW_GOAL `DISJOINT {v0} {v1,v2,v3:real^3}`); + (REWRITE_TAC[DISJOINT; SET_RULE + `{v0} INTER {v1, v2, v3} = {} <=> ~(v0 = v1 \/ v0 = v2 \/ v0 = v3)`]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `~coplanar {v0,v1,v2,v3:real^3}`); + (ASM_REWRITE_TAC[SET_RULE `{a,a,c,d} = {a,c,d}`; KY_COPLANAR_3]); + (UNDISCH_TAC `~coplanar {v0,v1,v2,v3:real^3}`); + (ASM_REWRITE_TAC[SET_RULE `{c,a,c,d} = {a,c,d}`; KY_COPLANAR_3]); + (UNDISCH_TAC `~coplanar {v0,v1,v2,v3:real^3}`); + (ASM_REWRITE_TAC[SET_RULE `{d,a,c,d} = {a,c,d}`; KY_COPLANAR_3]); + (ASM_SIMP_TAC[AFF_GE_1_3]); + (EXPAND_TAC "C" THEN REWRITE_TAC[SUBSET; CONVEX_HULL_4; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN + EXISTS_TAC `t3:real` THEN EXISTS_TAC `t4:real` THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ARITH_RULE `&0 <= s <=> ~(s < &0)`] THEN STRIP_TAC); + (NEW_GOAL `&1 < t2 + t3 + t4`); + (ASM_REAL_ARITH_TAC); + + (ABBREV_TAC `u = &1 / (t2 + t3 + t4)`); + (NEW_GOAL `v0 + u % (x - v0) IN convex hull {v1,v2,v3:real^3}`); + (REWRITE_TAC[IN; CONVEX_HULL_3; IN_ELIM_THM]); + (EXISTS_TAC `t2/(t2+t3+t4)` THEN EXISTS_TAC `t3/(t2+t3+t4)` THEN EXISTS_TAC `t4/(t2+t3+t4)`); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_SIMP_TAC[REAL_LE_ADD]); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_SIMP_TAC[REAL_LE_ADD]); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_SIMP_TAC[REAL_LE_ADD]); + (REWRITE_TAC[REAL_ARITH `a/x+b/x+c/x = (a+b+c)/x`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `v / (v + w + z) % v1 + w / (v + w + z) % v2 + + z / (v + w + z) % v3 = (&1/(v+w+z)) % (v%v1+w%v2+z%v3)`]); + (REWRITE_WITH `t2 % v1 + t3 % v2 + t4 % v3 = + (x - v0:real^3) + (&1 - t1) % v0`); + (UNDISCH_TAC `x = t1 % v0 + t2 % v1 + t3 % v2 + t4 % (v3:real^3)`); + (VECTOR_ARITH_TAC); + (MATCH_MP_TAC Trigonometry2.VECTOR_MUL_R_TO_L); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH + `(t2 + t3 + t4) % (v0 + u % (x - v0)) = x - v0 + (&1 - t1) % v0 <=> + (t1 + t2 + t3 + t4) % v0 + ((t2 + t3 + t4) * u) % (x - v0) = v0 + (x - v0)`]); + (EXPAND_TAC "u" THEN REWRITE_TAC[ASSUME `t1 + t2 + t3 + t4 = &1`; + ARITH_RULE `x * &1 / x = x / x`; + VECTOR_ARITH `&1 % x + y = x + z <=> y = z`]); + (REWRITE_WITH `(t2 + t3 + t4) / (t2 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `r <= dist(v0:real^3, v0 + u % (x - v0))`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[dist; + VECTOR_ARITH `v0 - (v0 + u % (x - v0)) = --u % (x - v0)`; + NORM_MUL; REAL_ARITH `abs (-- t) = abs (t)`]); + (REWRITE_WITH `abs (u) = u`); + (REWRITE_TAC[REAL_ABS_REFL]); + (EXPAND_TAC "u"); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[GSYM dist]); + (REWRITE_TAC[REAL_ARITH `a < b <=> ~(b <= a)`] THEN STRIP_TAC); + + (NEW_GOAL `u * dist (x,v0:real^3) <= dist (x,v0:real^3)`); + (REWRITE_TAC[REAL_ARITH `a * b <= b <=> &0 <= (&1 - a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE; REAL_ARITH `&0 <= a - b <=> b <= a`]); + (EXPAND_TAC "u"); + (REWRITE_WITH `&1 / (t2 + t3 + t4) <= &1 <=> &1 <= (t2 + t3 + t4)`); + (MATCH_MP_TAC Packing3.REAL_DIV_LE_1); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `r <= dist (v0, x:real^3)`); + (ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REAL_ARITH_TAC); + (UNDISCH_TAC `normball (v0:real^3) r x` THEN REWRITE_TAC[NORMBALL_BALL]); + (REWRITE_TAC[MESON[IN] `(V:real^3->bool) x <=> x IN V`; IN_BALL]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `vol (aff_ge {v0} {v1, v2, v3} INTER normball v0 r) = + vol (ball (v0,r) INTER aff_gt {v0} {v1, v2, v3})`); + (REWRITE_TAC[SET_RULE `a INTER normball v0 r = normball v0 r INTER a`]); + (REWRITE_TAC[NORMBALL_BALL]); + + (REWRITE_WITH + `aff_ge {v0} {v1, v2, v3:real^3} = + aff_gt {v0} {v1, v2, v3} UNION + UNIONS {aff_ge {v0} ({v1, v2, v3} DELETE a) | a | a IN {v1, v2, v3}}`); + (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP); + (REWRITE_TAC[Geomdetail.FINITE6]); + + (REWRITE_TAC[DISJOINT; SET_RULE + `{v0} INTER {v1, v2, v3} = {} <=> ~(v0 = v1 \/ v0 = v2 \/ v0 = v3)`]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `~coplanar {v0,v1,v2,v3:real^3}`); + (ASM_REWRITE_TAC[SET_RULE `{a,a,c,d} = {a,c,d}`; KY_COPLANAR_3]); + (UNDISCH_TAC `~coplanar {v0,v1,v2,v3:real^3}`); + (ASM_REWRITE_TAC[SET_RULE `{c,a,c,d} = {a,c,d}`; KY_COPLANAR_3]); + (UNDISCH_TAC `~coplanar {v0,v1,v2,v3:real^3}`); + (ASM_REWRITE_TAC[SET_RULE `{d,a,c,d} = {a,c,d}`; KY_COPLANAR_3]); + + (REWRITE_TAC[SET_RULE `A INTER (B UNION C) = (A INTER B) UNION (A INTER C)`]); + (MATCH_MP_TAC NEGLIGIBLE_MEASURE_UNION_klema); + (REWRITE_TAC[MEASURABLE_BALL_AFF_GT]); + (STRIP_TAC); + (REWRITE_WITH `ball (v0:real^3,r) INTER + UNIONS {aff_ge {v0} ({v1, v2, v3} DELETE a) | a | a IN {v1, v2, v3}} = + UNIONS {ball (v0,r) INTER aff_ge {v0} ({v1, v2, v3} DELETE a) | a | a IN {v1, v2, v3}}`); + (REWRITE_TAC[SET_EQ_LEMMA; IN_INTER; IN_UNIONS] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `ball (v0:real^3, r) INTER t`); + (STRIP_TAC); + (DEL_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (NEW_GOAL `(t:real^3->bool) SUBSET ball(v0:real^3, r)`); + (DEL_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[IN; IN_ELIM_THM] THEN STRIP_TAC); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (SWITCH_TAC THEN UP_ASM_TAC THEN ONCE_REWRITE_TAC[IN] THEN + REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC); + + (EXISTS_TAC `aff_ge {v0:real^3} ({v1, v2, v3} DELETE a')`); + (ONCE_REWRITE_TAC[MESON[IN] `(V:real^3->bool) x <=> x IN V`]); + (STRIP_TAC); + (EXISTS_TAC `a':real^3`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC MEASURABLE_UNIONS); + (REPEAT STRIP_TAC); + + (ABBREV_TAC + `fun = (\a:real^3. ball (v0,r) INTER aff_ge {v0} ({v1, v2, v3} DELETE a))`); + (REWRITE_WITH + `{ball (v0,r) INTER aff_ge {v0} ({v1, v2, v3} DELETE a) | a | a IN + {v1, v2, v3}} = + {fun a | a | a IN {v1,v2,v3:real^3}}`); + (EXPAND_TAC "fun" THEN REWRITE_TAC[]); + (REWRITE_WITH `{(fun:real^3->real^3->bool) a | a IN {v1, v2, v3:real^3}} = + {y | ?a. a IN {v1,v2,v3} /\ y = fun a}`); + (ONCE_REWRITE_TAC[SET_EQ_LEMMA]); + (ONCE_REWRITE_TAC[IN]); + (REWRITE_TAC[IN_ELIM_THM]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (REWRITE_TAC[Geomdetail.FINITE6]); + + (UP_ASM_TAC THEN REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[MEASURABLE_BALL_AFF_GE]); + (MATCH_MP_TAC NEGLIGIBLE_INTER); + (DISJ2_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNIONS); + (STRIP_TAC); + + (ABBREV_TAC + `fun = (\a:real^3. aff_ge {v0} ({v1, v2, v3} DELETE a))`); + (REWRITE_WITH + `{aff_ge {v0} ({v1, v2, v3} DELETE a) | a | a IN {v1, v2, v3}} = + {fun a | a | a IN {v1,v2,v3:real^3}}`); + (EXPAND_TAC "fun" THEN REWRITE_TAC[]); + (REWRITE_WITH `{(fun:real^3->real^3->bool) a | a IN {v1, v2, v3:real^3}} = + {y | ?a. a IN {v1,v2,v3} /\ y = fun a}`); + (ONCE_REWRITE_TAC[SET_EQ_LEMMA]); + (ONCE_REWRITE_TAC[IN]); + (REWRITE_TAC[IN_ELIM_THM]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (REWRITE_TAC[Geomdetail.FINITE6]); + + (ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[SET_RULE `a IN {x,y,z} <=> + a = x \/ a = y \/ a = z`; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `{v1, v2, v3} DELETE v1 = {v2,v3:real^3}`); + (UNDISCH_TAC `~(v0 = v1:real^3) /\ ~(v0 = v2) /\ ~(v0 = v3) /\ + ~(v1 = v2) /\ ~(v1 = v3) /\ ~(v2 = v3)`); + (SET_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0,v2,v3:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_TAC[SET_RULE `{a,b,c} = {a} UNION {b,c}`]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `{v1, v2, v3} DELETE v2 = {v1,v3:real^3}`); + (UNDISCH_TAC `~(v0 = v1:real^3) /\ ~(v0 = v2) /\ ~(v0 = v3) /\ + ~(v1 = v2) /\ ~(v1 = v3) /\ ~(v2 = v3)`); + (SET_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0,v1,v3:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_TAC[SET_RULE `{a,b,c} = {a} UNION {b,c}`]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `{v1, v2, v3} DELETE v3 = {v1,v2:real^3}`); + (UNDISCH_TAC `~(v0 = v1:real^3) /\ ~(v0 = v2) /\ ~(v0 = v3) /\ + ~(v1 = v2) /\ ~(v1 = v3) /\ ~(v2 = v3)`); + (SET_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0,v1,v2:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_TAC[SET_RULE `{a,b,c} = {a} UNION {b,c}`]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + + (REWRITE_WITH `vol (ball (v0,r) INTER aff_gt {v0} {v1, v2, v3}) = + (let a123 = dihV v0 v1 v2 v3 in + let a231 = dihV v0 v2 v3 v1 in + let a312 = dihV v0 v3 v1 v2 in + (a123 + a231 + a312 - pi) * r pow 3 / &3)`); + (MATCH_MP_TAC VOLUME_SOLID_TRIANGLE); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (REPEAT LET_TAC); + (REWRITE_TAC[REAL_ARITH + `&3 * (x * r pow 3 / &3) / r pow 3 = x * (r pow 3 / r pow 3)`]); + (REWRITE_WITH `r pow 3 / r pow 3 = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_POW_EQ_0; ARITH_RULE `~(3 = 0)`]); + (ASM_REAL_ARITH_TAC); + (REAL_ARITH_TAC)]);; + +(* ---------------------------------------------------------------------- *) + +let DIHX_DIH_Y_lemma = prove_by_refinement ( + `!V X ul u0 u1 u2 u3 i y1 y2 y3 y4 y5 y6. + saturated V /\ + packing V /\ + barV V 3 ul /\ + i >= 4 /\ + X = mcell i V ul /\ + ~NULLSET X /\ + ul = [u0; u1; u2; u3] /\ + dist (u0,u1) = y1 /\ + dist (u0,u2) = y2 /\ + dist (u0,u3) = y3 /\ + dist (u2,u3) = y4 /\ + dist (u1,u3) = y5 /\ + dist (u1,u2) = y6 + ==> + dihX V X (u0,u1) = dih_y y1 y2 y3 y4 y5 y6 /\ + dihX V X (u0,u2) = dih_y y2 y3 y1 y5 y6 y4 /\ + dihX V X (u0,u3) = dih_y y3 y1 y2 y6 y4 y5 /\ + dihX V X (u2,u3) = dih_y y4 y3 y5 y1 y6 y2 /\ + dihX V X (u1,u3) = dih_y y5 y1 y6 y2 y4 y3 /\ + dihX V X (u1,u2) = dih_y y6 y1 y5 y3 y4 y2`, +[(REPEAT GEN_TAC THEN STRIP_TAC); + (NEW_GOAL `~(X:real^3->bool = {})`); + (STRIP_TAC THEN UNDISCH_TAC `~NULLSET X` THEN + REWRITE_TAC[ASSUME `X:real^3->bool = {}`; NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `X = mcell4 V ul`); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT]); + (UP_ASM_TAC THEN REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (REWRITE_TAC[ASSUME `ul = [u0; u1; u2; u3:real^3]`; set_of_list]); + (STRIP_TAC); + + (NEW_GOAL `VX V X = {u0,u1,u2,u3}`); + (REWRITE_WITH `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `X = mcell 4 V ul`); + (ASM_REWRITE_TAC[]); + (MESON_TAC[ARITH_RULE `4 >= 4`; ASSUME `i >= 4`; MCELL_EXPLICIT]); + + (REWRITE_WITH + `V INTER mcell 4 V ul = set_of_list (truncate_simplex (4 - 1) ul)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 4 /\ 4 <= 4`]); + (REWRITE_WITH ` mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (MESON_TAC[ARITH_RULE `4 >= 4`; ASSUME `i >= 4`; MCELL_EXPLICIT]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[ARITH_RULE `4 - 1 = 3`; TRUNCATE_SIMPLEX_EXPLICIT_3; + set_of_list]); + +(* ---------------------------------------------------------------- *) + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} = 4`); + (REWRITE_TAC[ARITH_RULE `4 = 3 + 1`; GSYM set_of_list; + GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `~(u0 = u1:real^3) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ + ~(u1 = u2) /\ ~(u1 = u3) /\ ~(u2 = u3)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u0 = u1:real^3`; + SET_RULE `{u1, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u0 = u2:real^3`; + SET_RULE `{u2, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u0 = u3:real^3`; + SET_RULE `{u3, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u1 = u2:real^3`; + SET_RULE `{u0, u2, u2, u3} = {u0,u2,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u1 = u3:real^3`; + SET_RULE `{u0, u3, u2, u3} = {u0,u2,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u2 = u3:real^3`; + SET_RULE `{u0, u1, u3, u3} = {u0,u1,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + + (NEW_GOAL `edgeX V X = {{u0,u1:real^3}, {u0,u2}, {u0,u3}, + {u1,u2}, {u1,u3}, {u2,u3}}`); + (REWRITE_TAC[edgeX]); + (ONCE_REWRITE_TAC[SET_EQ_LEMMA]); + (REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `VX V X u` THEN UNDISCH_TAC `VX V X v`); + (REWRITE_TAC[MESON[IN] `VX V X s <=> s IN VX V X`]); + (ASM_REWRITE_TAC[SET_RULE `v IN {u0, u1, u2, u3} <=> + v = u0 \/ v = u1 \/ v = u2 \/ v = u3`]); + (REPEAT STRIP_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + (SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + (SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + (SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + (SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + (SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + (SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (UP_ASM_TAC THEN REWRITE_TAC[SET_RULE `x IN {a,b,c,d,e,f} <=> + x = a \/ x = b \/ x = c \/ x = d \/ x = e \/ x = f`]); + (REWRITE_TAC[MESON[IN] `VX V X s <=> s IN VX V X`]); + (ASM_REWRITE_TAC[SET_RULE `v IN {u0, u1, u2, u3} <=> + v = u0 \/ v = u1 \/ v = u2 \/ v = u3`]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u2:real^3` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u3:real^3` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u3:real^3` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3` THEN ASM_REWRITE_TAC[]); + +(* ==================================== *) + (REPEAT STRIP_TAC); + + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (LET_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(4, ul:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (ASM_REWRITE_TAC[IN; ARITH_RULE `4 <= 4`]); + (STRIP_TAC); + (MESON_TAC[MCELL_EXPLICIT; ASSUME `i >= 4`; ARITH_RULE `4 >= 4`]); + (REWRITE_TAC[INITIAL_SUBLIST]); + (EXISTS_TAC `[u2;u3:real^3]` THEN REWRITE_TAC[APPEND]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN]); + + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `2 <= k`); + (NEW_GOAL `k = 4`); + (NEW_GOAL `4 = k /\ + (!t. 4 - 1 <= t /\ t <= 3 + ==> omega_list_n V ul t = omega_list_n V ul' t)`); + (MATCH_MP_TAC Marchal_cells_3.MCELL_ID_OMEGA_LIST_N); + (ASM_REWRITE_TAC[SET_RULE `x IN {2,3,4} <=> x=2\/x=3\/x=4`]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (REWRITE_WITH `mcell 4 V ul = X`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (MESON_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ASSUME `i >= 4`]); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `~NULLSET X`]); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (REWRITE_TAC[dihu4]); + (NEW_GOAL `?v0 v1 v2 v3. ul' = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `u0 = v0:real^3`); + (NEW_GOAL`u0 = HD [u0;u1:real^3]`); + (REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[ASSUME `u0 = HD[u0;u1:real^3]`]); + (REWRITE_WITH `v0:real^3 = HD ul'`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 ul'`); + (NEW_GOAL `[u0;u1:real^3] = truncate_simplex (LENGTH [u0;u1] - 1) ul' /\ + LENGTH [u0;u1] <= LENGTH ul'`); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_IMP_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH; ARITH_RULE `SUC(SUC(0)) - 1 = 1`]); + (MESON_TAC[]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `u1 = v1:real^3`); + (NEW_GOAL`u1 = EL 1 [u0;u1:real^3]`); + (REWRITE_TAC[EL; ARITH_RULE `1 = SUC 0`; TL; HD]); + (ONCE_REWRITE_TAC[ASSUME `u1 = EL 1 [u0;u1:real^3]`]); + + (REWRITE_WITH `v1:real^3 = EL 1 ul'`); + (ASM_REWRITE_TAC[EL; ARITH_RULE `1 = SUC 0`; TL; HD]); + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 ul'`); + (NEW_GOAL `[u0;u1:real^3] = truncate_simplex (LENGTH [u0;u1] - 1) ul' /\ + LENGTH [u0;u1] <= LENGTH ul'`); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_IMP_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH; ARITH_RULE `SUC(SUC(0)) - 1 = 1`]); + (MESON_TAC[]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `{u0,u1,u2,u3:real^3} = {v0,v1,v2,v3}`); + (NEW_GOAL `{u0,u1,u2,u3:real^3} = {v0,v1,v2,v3} <=> + convex hull {u0,u1,u2,u3:real^3} = convex hull {v0,v1,v2,v3}`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ); + (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`); + GSYM (ASSUME `ul' = [v0;v1;v2;v3:real^3]`)]); + (STRIP_TAC); + (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[ASSUME `{u0, u1, u2, u3:real^3} = {v0, v1, v2, v3} <=> + convex hull {u0, u1, u2, u3} = convex hull {v0, v1, v2, v3}`]); + (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`); + GSYM (ASSUME `ul' = [v0;v1;v2;v3:real^3]`)]); + (REWRITE_WITH `convex hull set_of_list ul= X:real^3->bool`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (REWRITE_WITH `mcell i V ul = mcell4 V ul`); + (MESON_TAC[ASSUME `i >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 4`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `X:real^3->bool = {}`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 4`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REFL_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (NEW_GOAL `(v2 = u2 /\ v3 = u3:real^3) \/ (v2 = u3 /\ v3 = u2)`); + + + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ + ~(u1 = u2) /\ ~(u1 = u3) /\ ~(u2 = u3:real^3)`); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] DIHV_EQ_DIH_Y)); + (STRIP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE ` {v0, v1, v3, v2} = {v0, v1, v2, v3}`]); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `u0 = v0:real^3`); GSYM (ASSUME `u1 = v1:real^3`)]); + (EXPAND_TAC "y1" THEN EXPAND_TAC "y2" THEN EXPAND_TAC "y3"); + (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6"); + (REFL_TAC); + + (GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] DIHV_EQ_DIH_Y)); + (STRIP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE ` {v0, v1, v3, v2} = {v0, v1, v2, v3}`]); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `u0 = v0:real^3`); GSYM (ASSUME `u1 = v1:real^3`)]); + (EXPAND_TAC "y1" THEN EXPAND_TAC "y2" THEN EXPAND_TAC "y3"); + (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6"); + (REWRITE_TAC[Nonlinear_lemma.dih_y_sym; DIST_SYM]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `F`); + (NEW_GOAL `V INTER (X:real^3->bool) = set_of_list (truncate_simplex (4 - 1) ul)`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (REWRITE_WITH `mcell i V ul = mcell 4 V ul`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT; ASSUME `i >= 4`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 4 /\ 4 <= 4`]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT; ASSUME `i >= 4`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[ARITH_RULE `4 - 1 = 3`; + ASSUME `ul = [u0;u1;u2;u3:real^3]`; TRUNCATE_SIMPLEX_EXPLICIT_3]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (ASM_CASES_TAC `k = 1`); + + (REWRITE_WITH `V INTER (X:real^3->bool) = + set_of_list (truncate_simplex (k - 1) ul')`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 1 /\ 1 <= 4`]); + (REWRITE_WITH `mcell 1 V ul' = X`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 1`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `1 - 1 = 0`; ASSUME `k = 1`]); + (REWRITE_WITH `truncate_simplex 0 (ul':(real^3)list) = [HD ul']`); + (MATCH_MP_TAC Packing3.TRUNCATE_0_EQ_HEAD); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (STRIP_TAC); + (NEW_GOAL `CARD (set_of_list [(HD ul'):real^3]) = + CARD (set_of_list (ul:(real^3)list))`); + (AP_TERM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH `CARD (set_of_list (ul:(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[set_of_list; Geomdetail.CARD_SING] THEN ARITH_TAC); + (NEW_GOAL `k = 0`); + (ASM_ARITH_TAC); + + (REWRITE_WITH `V INTER X = {}:real^3->bool`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 0`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[set_of_list]); + (NEW_GOAL `u0 IN {u0,u1,u2,u3:real^3}`); + (SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) + + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (LET_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u2] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + + (ABBREV_TAC `wl = [u0;u2;u1;u3:real^3]`); + + (* Need to list properties of wl at this point *) + (NEW_GOAL `?p. p permutes 0..3 /\ + wl:(real^3)list = left_action_list p ul`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "wl"); + (MATCH_MP_TAC Marchal_cells_3.LEFT_ACTION_LIST_3_EXISTS); + (STRIP_TAC); + (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (REWRITE_TAC[ARITH_RULE `4 = 3 + 1`]); + (MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `barV V 3 wl`); + (MATCH_MP_TAC Qzksykg.QZKSYKG1); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `4` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[SET_RULE `4 IN {0,1,2,3,4}`; ARITH_RULE `4 - 1 = 3`]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT; ASSUME `i >= 4`]); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `(4, wl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (ASM_REWRITE_TAC[IN; ARITH_RULE `4 <= 4`]); + (STRIP_TAC); + + (REWRITE_WITH `mcell i V [u0; u1; u2; u3] = mcell 4 V [u0; u1; u2; u3]`); + (MESON_TAC[MCELL_EXPLICIT; ASSUME `i >= 4`; ARITH_RULE `4 >= 4`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Rvfxzbu.RVFXZBU); + (ASM_REWRITE_TAC[SET_RULE `4 IN {0,1,2,3,4}`; ARITH_RULE `4 - 1 = 3`]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_TAC[GSYM (ASSUME `wl:(real^3)list = left_action_list p ul`)]); + (EXPAND_TAC "wl"); + (REWRITE_WITH `[u0; u2; u1; u3] = APPEND [u0; u2] [u1; u3:real^3]`); + (REWRITE_TAC[APPEND]); + (REWRITE_TAC[Packing3.INITIAL_SUBLIST_APPEND]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN]); + + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `2 <= k`); + (NEW_GOAL `k = 4`); + (NEW_GOAL `4 = k /\ + (!t. 4 - 1 <= t /\ t <= 3 + ==> omega_list_n V ul t = omega_list_n V ul' t)`); + (MATCH_MP_TAC Marchal_cells_3.MCELL_ID_OMEGA_LIST_N); + (ASM_REWRITE_TAC[SET_RULE `x IN {2,3,4} <=> x=2\/x=3\/x=4`]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (REWRITE_WITH `mcell 4 V ul = X`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (MESON_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ASSUME `i >= 4`]); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `~NULLSET X`]); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (REWRITE_TAC[dihu4]); + (NEW_GOAL `?v0 v1 v2 v3. ul' = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `u0 = v0:real^3`); + (NEW_GOAL`u0 = HD [u0;u2:real^3]`); + (REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[ASSUME `u0 = HD[u0;u2:real^3]`]); + (REWRITE_WITH `v0:real^3 = HD ul'`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `[u0;u2:real^3] = truncate_simplex 1 ul'`); + (NEW_GOAL `[u0;u2:real^3] = truncate_simplex (LENGTH [u0;u2] - 1) ul' /\ + LENGTH [u0;u2] <= LENGTH ul'`); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_IMP_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH; ARITH_RULE `SUC(SUC(0)) - 1 = 1`]); + (MESON_TAC[]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `u2 = v1:real^3`); + (NEW_GOAL`u2 = EL 1 [u0;u2:real^3]`); + (REWRITE_TAC[EL; ARITH_RULE `1 = SUC 0`; TL; HD]); + (ONCE_REWRITE_TAC[ASSUME `u2 = EL 1 [u0;u2:real^3]`]); + + (REWRITE_WITH `v1:real^3 = EL 1 ul'`); + (ASM_REWRITE_TAC[EL; ARITH_RULE `1 = SUC 0`; TL; HD]); + (REWRITE_WITH `[u0;u2:real^3] = truncate_simplex 1 ul'`); + (NEW_GOAL `[u0;u2:real^3] = truncate_simplex (LENGTH [u0;u2] - 1) ul' /\ + LENGTH [u0;u2] <= LENGTH ul'`); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_IMP_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH; ARITH_RULE `SUC(SUC(0)) - 1 = 1`]); + (MESON_TAC[]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `{u0,u1,u2,u3:real^3} = {v0,v1,v2,v3}`); + (NEW_GOAL `{u0,u1,u2,u3:real^3} = {v0,v1,v2,v3} <=> + convex hull {u0,u1,u2,u3:real^3} = convex hull {v0,v1,v2,v3}`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ); + (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`); + GSYM (ASSUME `ul' = [v0;v1;v2;v3:real^3]`)]); + (STRIP_TAC); + (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[ASSUME `{u0, u1, u2, u3:real^3} = {v0, v1, v2, v3} <=> + convex hull {u0, u1, u2, u3} = convex hull {v0, v1, v2, v3}`]); + (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`); + GSYM (ASSUME `ul' = [v0;v1;v2;v3:real^3]`)]); + (REWRITE_WITH `convex hull set_of_list ul= X:real^3->bool`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (REWRITE_WITH `mcell i V ul = mcell4 V ul`); + (MESON_TAC[ASSUME `i >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 4`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `X:real^3->bool = {}`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 4`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REFL_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + + (NEW_GOAL `(v2 = u1 /\ v3 = u3:real^3) \/ (v2 = u3 /\ v3 = u1)`); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ + ~(u1 = u2) /\ ~(u1 = u3) /\ ~(u2 = u3:real^3)`); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] DIHV_EQ_DIH_Y)); + (STRIP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE ` {v0, v1, v3, v2} = {v0, v1, v2, v3}`]); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `u0 = v0:real^3`); GSYM (ASSUME `u2 = v1:real^3`)]); + (EXPAND_TAC "y1" THEN EXPAND_TAC "y2" THEN EXPAND_TAC "y3"); + (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6"); + (REWRITE_TAC[Nonlinear_lemma.dih_y_sym; DIST_SYM]); + + (GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] DIHV_EQ_DIH_Y)); + (STRIP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE ` {v0, v1, v3, v2} = {v0, v1, v2, v3}`]); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `u0 = v0:real^3`); GSYM (ASSUME `u2 = v1:real^3`)]); + (EXPAND_TAC "y1" THEN EXPAND_TAC "y2" THEN EXPAND_TAC "y3"); + (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6"); + (REWRITE_TAC[DIST_SYM]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `F`); + (NEW_GOAL `V INTER (X:real^3->bool) = set_of_list (truncate_simplex (4 - 1) ul)`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (REWRITE_WITH `mcell i V ul = mcell 4 V ul`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT; ASSUME `i >= 4`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 4 /\ 4 <= 4`]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT; ASSUME `i >= 4`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[ARITH_RULE `4 - 1 = 3`; + ASSUME `ul = [u0;u1;u2;u3:real^3]`; TRUNCATE_SIMPLEX_EXPLICIT_3]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (ASM_CASES_TAC `k = 1`); + + (REWRITE_WITH `V INTER (X:real^3->bool) = + set_of_list (truncate_simplex (k - 1) ul')`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 1 /\ 1 <= 4`]); + (REWRITE_WITH `mcell 1 V ul' = X`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 1`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `1 - 1 = 0`; ASSUME `k = 1`]); + (REWRITE_WITH `truncate_simplex 0 (ul':(real^3)list) = [HD ul']`); + (MATCH_MP_TAC Packing3.TRUNCATE_0_EQ_HEAD); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (STRIP_TAC); + (NEW_GOAL `CARD (set_of_list [(HD ul'):real^3]) = + CARD (set_of_list (ul:(real^3)list))`); + (AP_TERM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH `CARD (set_of_list (ul:(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[set_of_list; Geomdetail.CARD_SING] THEN ARITH_TAC); + (NEW_GOAL `k = 0`); + (ASM_ARITH_TAC); + + (REWRITE_WITH `V INTER X = {}:real^3->bool`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 0`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[set_of_list]); + (NEW_GOAL `u0 IN {u0,u1,u2,u3:real^3}`); + (SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) + + (REWRITE_TAC[dihX]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (LET_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u3] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + + (ABBREV_TAC `wl = [u0;u3;u1;u2:real^3]`); + + (* Need to list properties of wl at this point *) + (NEW_GOAL `?p. p permutes 0..3 /\ + wl:(real^3)list = left_action_list p ul`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "wl"); + (MATCH_MP_TAC Marchal_cells_3.LEFT_ACTION_LIST_3_EXISTS); + (STRIP_TAC); + (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (REWRITE_TAC[ARITH_RULE `4 = 3 + 1`]); + (MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `barV V 3 wl`); + (MATCH_MP_TAC Qzksykg.QZKSYKG1); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `4` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[SET_RULE `4 IN {0,1,2,3,4}`; ARITH_RULE `4 - 1 = 3`]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT; ASSUME `i >= 4`]); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `(4, wl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (ASM_REWRITE_TAC[IN; ARITH_RULE `4 <= 4`]); + (STRIP_TAC); + + (REWRITE_WITH `mcell i V [u0; u1; u2; u3] = mcell 4 V [u0; u1; u2; u3]`); + (MESON_TAC[MCELL_EXPLICIT; ASSUME `i >= 4`; ARITH_RULE `4 >= 4`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Rvfxzbu.RVFXZBU); + (ASM_REWRITE_TAC[SET_RULE `4 IN {0,1,2,3,4}`; ARITH_RULE `4 - 1 = 3`]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_TAC[GSYM (ASSUME `wl:(real^3)list = left_action_list p ul`)]); + (EXPAND_TAC "wl"); + (REWRITE_WITH `[u0; u3; u1; u2] = APPEND [u0; u3] [u1; u2:real^3]`); + (REWRITE_TAC[APPEND]); + (REWRITE_TAC[Packing3.INITIAL_SUBLIST_APPEND]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN]); + + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `2 <= k`); + (NEW_GOAL `k = 4`); + (NEW_GOAL `4 = k /\ + (!t. 4 - 1 <= t /\ t <= 3 + ==> omega_list_n V ul t = omega_list_n V ul' t)`); + (MATCH_MP_TAC Marchal_cells_3.MCELL_ID_OMEGA_LIST_N); + (ASM_REWRITE_TAC[SET_RULE `x IN {2,3,4} <=> x=2\/x=3\/x=4`]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (REWRITE_WITH `mcell 4 V ul = X`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (MESON_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ASSUME `i >= 4`]); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `~NULLSET X`]); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (REWRITE_TAC[dihu4]); + (NEW_GOAL `?v0 v1 v2 v3. ul' = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `u0 = v0:real^3`); + (NEW_GOAL`u0 = HD [u0;u3:real^3]`); + (REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[ASSUME `u0 = HD[u0;u3:real^3]`]); + (REWRITE_WITH `v0:real^3 = HD ul'`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `[u0;u3:real^3] = truncate_simplex 1 ul'`); + (NEW_GOAL `[u0;u3:real^3] = truncate_simplex (LENGTH [u0;u3] - 1) ul' /\ + LENGTH [u0;u3] <= LENGTH ul'`); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_IMP_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH; ARITH_RULE `SUC(SUC(0)) - 1 = 1`]); + (MESON_TAC[]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `u3 = v1:real^3`); + (NEW_GOAL`u3 = EL 1 [u0;u3:real^3]`); + (REWRITE_TAC[EL; ARITH_RULE `1 = SUC 0`; TL; HD]); + (ONCE_REWRITE_TAC[ASSUME `u3 = EL 1 [u0;u3:real^3]`]); + + (REWRITE_WITH `v1:real^3 = EL 1 ul'`); + (ASM_REWRITE_TAC[EL; ARITH_RULE `1 = SUC 0`; TL; HD]); + (REWRITE_WITH `[u0;u3:real^3] = truncate_simplex 1 ul'`); + (NEW_GOAL `[u0;u3:real^3] = truncate_simplex (LENGTH [u0;u3] - 1) ul' /\ + LENGTH [u0;u3] <= LENGTH ul'`); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_IMP_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH; ARITH_RULE `SUC(SUC(0)) - 1 = 1`]); + (MESON_TAC[]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `{u0,u1,u2,u3:real^3} = {v0,v1,v2,v3}`); + (NEW_GOAL `{u0,u1,u2,u3:real^3} = {v0,v1,v2,v3} <=> + convex hull {u0,u1,u2,u3:real^3} = convex hull {v0,v1,v2,v3}`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ); + (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`); + GSYM (ASSUME `ul' = [v0;v1;v2;v3:real^3]`)]); + (STRIP_TAC); + (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[ASSUME `{u0, u1, u2, u3:real^3} = {v0, v1, v2, v3} <=> + convex hull {u0, u1, u2, u3} = convex hull {v0, v1, v2, v3}`]); + (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`); + GSYM (ASSUME `ul' = [v0;v1;v2;v3:real^3]`)]); + (REWRITE_WITH `convex hull set_of_list ul= X:real^3->bool`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (REWRITE_WITH `mcell i V ul = mcell4 V ul`); + (MESON_TAC[ASSUME `i >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 4`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `X:real^3->bool = {}`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 4`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REFL_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + + (NEW_GOAL `(v2 = u1 /\ v3 = u2:real^3) \/ (v2 = u2 /\ v3 = u1)`); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ + ~(u1 = u2) /\ ~(u1 = u3) /\ ~(u2 = u3:real^3)`); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] DIHV_EQ_DIH_Y)); + (STRIP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE ` {v0, v1, v3, v2} = {v0, v1, v2, v3}`]); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `u0 = v0:real^3`); GSYM (ASSUME `u3 = v1:real^3`)]); + (EXPAND_TAC "y1" THEN EXPAND_TAC "y2" THEN EXPAND_TAC "y3"); + (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6"); + (REWRITE_TAC[Nonlinear_lemma.dih_y_sym; Nonlinear_lemma.dih_y_sym2; + DIST_SYM]); + + (GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] DIHV_EQ_DIH_Y)); + (STRIP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE ` {v0, v1, v3, v2} = {v0, v1, v2, v3}`]); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `u0 = v0:real^3`); GSYM (ASSUME `u3 = v1:real^3`)]); + (EXPAND_TAC "y1" THEN EXPAND_TAC "y2" THEN EXPAND_TAC "y3"); + (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6"); + (REWRITE_TAC[Nonlinear_lemma.dih_y_sym; Nonlinear_lemma.dih_y_sym2; + DIST_SYM]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `F`); + (NEW_GOAL `V INTER (X:real^3->bool) = set_of_list (truncate_simplex (4 - 1) ul)`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (REWRITE_WITH `mcell i V ul = mcell 4 V ul`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT; ASSUME `i >= 4`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 4 /\ 4 <= 4`]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT; ASSUME `i >= 4`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[ARITH_RULE `4 - 1 = 3`; + ASSUME `ul = [u0;u1;u2;u3:real^3]`; TRUNCATE_SIMPLEX_EXPLICIT_3]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (ASM_CASES_TAC `k = 1`); + + (REWRITE_WITH `V INTER (X:real^3->bool) = + set_of_list (truncate_simplex (k - 1) ul')`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 1 /\ 1 <= 4`]); + (REWRITE_WITH `mcell 1 V ul' = X`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 1`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `1 - 1 = 0`; ASSUME `k = 1`]); + (REWRITE_WITH `truncate_simplex 0 (ul':(real^3)list) = [HD ul']`); + (MATCH_MP_TAC Packing3.TRUNCATE_0_EQ_HEAD); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (STRIP_TAC); + (NEW_GOAL `CARD (set_of_list [(HD ul'):real^3]) = + CARD (set_of_list (ul:(real^3)list))`); + (AP_TERM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH `CARD (set_of_list (ul:(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[set_of_list; Geomdetail.CARD_SING] THEN ARITH_TAC); + (NEW_GOAL `k = 0`); + (ASM_ARITH_TAC); + + (REWRITE_WITH `V INTER X = {}:real^3->bool`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 0`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[set_of_list]); + (NEW_GOAL `u0 IN {u0,u1,u2,u3:real^3}`); + (SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) + + (REWRITE_TAC[dihX]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (LET_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u2; u3] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + + (ABBREV_TAC `wl = [u2;u3;u0;u1:real^3]`); + + (* Need to list properties of wl at this point *) + (NEW_GOAL `?p. p permutes 0..3 /\ + wl:(real^3)list = left_action_list p ul`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "wl"); + (MATCH_MP_TAC Marchal_cells_3.LEFT_ACTION_LIST_3_EXISTS); + (STRIP_TAC); + (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (REWRITE_TAC[ARITH_RULE `4 = 3 + 1`]); + (MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `barV V 3 wl`); + (MATCH_MP_TAC Qzksykg.QZKSYKG1); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `4` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[SET_RULE `4 IN {0,1,2,3,4}`; ARITH_RULE `4 - 1 = 3`]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT; ASSUME `i >= 4`]); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `(4, wl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (ASM_REWRITE_TAC[IN; ARITH_RULE `4 <= 4`]); + (STRIP_TAC); + + (REWRITE_WITH `mcell i V [u0; u1; u2; u3] = mcell 4 V [u0; u1; u2; u3]`); + (MESON_TAC[MCELL_EXPLICIT; ASSUME `i >= 4`; ARITH_RULE `4 >= 4`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Rvfxzbu.RVFXZBU); + (ASM_REWRITE_TAC[SET_RULE `4 IN {0,1,2,3,4}`; ARITH_RULE `4 - 1 = 3`]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_TAC[GSYM (ASSUME `wl:(real^3)list = left_action_list p ul`)]); + (EXPAND_TAC "wl"); + (REWRITE_WITH `[u2; u3; u0; u1] = APPEND [u2; u3] [u0; u1:real^3]`); + (REWRITE_TAC[APPEND]); + (REWRITE_TAC[Packing3.INITIAL_SUBLIST_APPEND]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN]); + + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `2 <= k`); + (NEW_GOAL `k = 4`); + (NEW_GOAL `4 = k /\ + (!t. 4 - 1 <= t /\ t <= 3 + ==> omega_list_n V ul t = omega_list_n V ul' t)`); + (MATCH_MP_TAC Marchal_cells_3.MCELL_ID_OMEGA_LIST_N); + (ASM_REWRITE_TAC[SET_RULE `x IN {2,3,4} <=> x=2\/x=3\/x=4`]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (REWRITE_WITH `mcell 4 V ul = X`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (MESON_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ASSUME `i >= 4`]); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `~NULLSET X`]); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (REWRITE_TAC[dihu4]); + (NEW_GOAL `?v0 v1 v2 v3. ul' = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `u2 = v0:real^3`); + (NEW_GOAL`u2 = HD [u2;u3:real^3]`); + (REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[ASSUME `u2 = HD[u2;u3:real^3]`]); + (REWRITE_WITH `v0:real^3 = HD ul'`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `[u2;u3:real^3] = truncate_simplex 1 ul'`); + (NEW_GOAL `[u2;u3:real^3] = truncate_simplex (LENGTH [u2;u3] - 1) ul' /\ + LENGTH [u2;u3] <= LENGTH ul'`); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_IMP_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH; ARITH_RULE `SUC(SUC(0)) - 1 = 1`]); + (MESON_TAC[]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `u3 = v1:real^3`); + (NEW_GOAL`u3 = EL 1 [u2;u3:real^3]`); + (REWRITE_TAC[EL; ARITH_RULE `1 = SUC 0`; TL; HD]); + (ONCE_REWRITE_TAC[ASSUME `u3 = EL 1 [u2;u3:real^3]`]); + + (REWRITE_WITH `v1:real^3 = EL 1 ul'`); + (ASM_REWRITE_TAC[EL; ARITH_RULE `1 = SUC 0`; TL; HD]); + (REWRITE_WITH `[u2;u3:real^3] = truncate_simplex 1 ul'`); + (NEW_GOAL `[u2;u3:real^3] = truncate_simplex (LENGTH [u2;u3] - 1) ul' /\ + LENGTH [u2;u3] <= LENGTH ul'`); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_IMP_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH; ARITH_RULE `SUC(SUC(0)) - 1 = 1`]); + (MESON_TAC[]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `{u0,u1,u2,u3:real^3} = {v0,v1,v2,v3}`); + (NEW_GOAL `{u0,u1,u2,u3:real^3} = {v0,v1,v2,v3} <=> + convex hull {u0,u1,u2,u3:real^3} = convex hull {v0,v1,v2,v3}`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ); + (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`); + GSYM (ASSUME `ul' = [v0;v1;v2;v3:real^3]`)]); + (STRIP_TAC); + (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[ASSUME `{u0, u1, u2, u3:real^3} = {v0, v1, v2, v3} <=> + convex hull {u0, u1, u2, u3} = convex hull {v0, v1, v2, v3}`]); + (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`); + GSYM (ASSUME `ul' = [v0;v1;v2;v3:real^3]`)]); + (REWRITE_WITH `convex hull set_of_list ul= X:real^3->bool`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (REWRITE_WITH `mcell i V ul = mcell4 V ul`); + (MESON_TAC[ASSUME `i >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 4`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `X:real^3->bool = {}`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 4`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REFL_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + + (NEW_GOAL `(v2 = u0 /\ v3 = u1:real^3) \/ (v2 = u1 /\ v3 = u0)`); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ + ~(u1 = u2) /\ ~(u1 = u3) /\ ~(u2 = u3:real^3)`); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] DIHV_EQ_DIH_Y)); + (STRIP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE ` {v0, v1, v3, v2} = {v0, v1, v2, v3}`]); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `u2 = v0:real^3`); GSYM (ASSUME `u3 = v1:real^3`)]); + (EXPAND_TAC "y1" THEN EXPAND_TAC "y2" THEN EXPAND_TAC "y3"); + (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6"); + (REWRITE_TAC[DIST_SYM]); + (REWRITE_WITH + `dih_y (dist (u2,u3)) (dist (u0,u2)) (dist (u1,u2)) (dist (u0,u1)) + (dist (u1,u3:real^3)) + (dist (u0,u3)) = + dih_y (dist (u2,u3)) (dist (u1,u2)) (dist (u0,u2)) (dist (u0,u1)) + (dist (u0,u3)) + (dist (u1,u3:real^3))`); + (REWRITE_TAC[Nonlinear_lemma.dih_y_sym]); + (REWRITE_TAC[Nonlinear_lemma.dih_y_sym2]); + + (GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] DIHV_EQ_DIH_Y)); + (STRIP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE ` {v0, v1, v3, v2} = {v0, v1, v2, v3}`]); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `u2 = v0:real^3`); GSYM (ASSUME `u3 = v1:real^3`)]); + (EXPAND_TAC "y1" THEN EXPAND_TAC "y2" THEN EXPAND_TAC "y3"); + (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6"); + (REWRITE_TAC[DIST_SYM]); + (REWRITE_WITH + `dih_y (dist (u2,u3)) (dist (u0,u2)) (dist (u1,u2)) (dist (u0,u1)) + (dist (u1,u3)) + (dist (u0,u3:real^3)) = + dih_y (dist (u2,u3)) (dist (u1,u2)) (dist (u0,u2)) (dist (u0,u1)) + (dist (u0,u3)) + (dist (u1,u3))`); + (REWRITE_TAC[Nonlinear_lemma.dih_y_sym]); + (REWRITE_TAC[Nonlinear_lemma.dih_y_sym2]); + + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `F`); + (NEW_GOAL `V INTER (X:real^3->bool) = set_of_list (truncate_simplex (4 - 1) ul)`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (REWRITE_WITH `mcell i V ul = mcell 4 V ul`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT; ASSUME `i >= 4`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 4 /\ 4 <= 4`]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT; ASSUME `i >= 4`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[ARITH_RULE `4 - 1 = 3`; + ASSUME `ul = [u0;u1;u2;u3:real^3]`; TRUNCATE_SIMPLEX_EXPLICIT_3]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (ASM_CASES_TAC `k = 1`); + + (REWRITE_WITH `V INTER (X:real^3->bool) = + set_of_list (truncate_simplex (k - 1) ul')`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 1 /\ 1 <= 4`]); + (REWRITE_WITH `mcell 1 V ul' = X`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 1`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `1 - 1 = 0`; ASSUME `k = 1`]); + (REWRITE_WITH `truncate_simplex 0 (ul':(real^3)list) = [HD ul']`); + (MATCH_MP_TAC Packing3.TRUNCATE_0_EQ_HEAD); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (STRIP_TAC); + (NEW_GOAL `CARD (set_of_list [(HD ul'):real^3]) = + CARD (set_of_list (ul:(real^3)list))`); + (AP_TERM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH `CARD (set_of_list (ul:(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[set_of_list; Geomdetail.CARD_SING] THEN ARITH_TAC); + (NEW_GOAL `k = 0`); + (ASM_ARITH_TAC); + + (REWRITE_WITH `V INTER X = {}:real^3->bool`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 0`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[set_of_list]); + (NEW_GOAL `u0 IN {u0,u1,u2,u3:real^3}`); + (SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) + + (REWRITE_TAC[dihX]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (LET_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u1; u3] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + + (ABBREV_TAC `wl = [u1;u3;u0;u2:real^3]`); + + (* Need to list properties of wl at this point *) + (NEW_GOAL `?p. p permutes 0..3 /\ + wl:(real^3)list = left_action_list p ul`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "wl"); + (MATCH_MP_TAC Marchal_cells_3.LEFT_ACTION_LIST_3_EXISTS); + (STRIP_TAC); + (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (REWRITE_TAC[ARITH_RULE `4 = 3 + 1`]); + (MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `barV V 3 wl`); + (MATCH_MP_TAC Qzksykg.QZKSYKG1); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `4` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[SET_RULE `4 IN {0,1,2,3,4}`; ARITH_RULE `4 - 1 = 3`]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT; ASSUME `i >= 4`]); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `(4, wl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (ASM_REWRITE_TAC[IN; ARITH_RULE `4 <= 4`]); + (STRIP_TAC); + + (REWRITE_WITH `mcell i V [u0; u1; u2; u3] = mcell 4 V [u0; u1; u2; u3]`); + (MESON_TAC[MCELL_EXPLICIT; ASSUME `i >= 4`; ARITH_RULE `4 >= 4`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Rvfxzbu.RVFXZBU); + (ASM_REWRITE_TAC[SET_RULE `4 IN {0,1,2,3,4}`; ARITH_RULE `4 - 1 = 3`]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_TAC[GSYM (ASSUME `wl:(real^3)list = left_action_list p ul`)]); + (EXPAND_TAC "wl"); + (REWRITE_WITH `[u1; u3; u0; u2] = APPEND [u1; u3] [u0; u2:real^3]`); + (REWRITE_TAC[APPEND]); + (REWRITE_TAC[Packing3.INITIAL_SUBLIST_APPEND]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN]); + + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `2 <= k`); + (NEW_GOAL `k = 4`); + (NEW_GOAL `4 = k /\ + (!t. 4 - 1 <= t /\ t <= 3 + ==> omega_list_n V ul t = omega_list_n V ul' t)`); + (MATCH_MP_TAC Marchal_cells_3.MCELL_ID_OMEGA_LIST_N); + (ASM_REWRITE_TAC[SET_RULE `x IN {2,3,4} <=> x=2\/x=3\/x=4`]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (REWRITE_WITH `mcell 4 V ul = X`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (MESON_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ASSUME `i >= 4`]); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `~NULLSET X`]); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (REWRITE_TAC[dihu4]); + (NEW_GOAL `?v0 v1 v2 v3. ul' = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `u1 = v0:real^3`); + (NEW_GOAL`u1 = HD [u1;u3:real^3]`); + (REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[ASSUME `u1 = HD[u1;u3:real^3]`]); + (REWRITE_WITH `v0:real^3 = HD ul'`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `[u1;u3:real^3] = truncate_simplex 1 ul'`); + (NEW_GOAL `[u1;u3:real^3] = truncate_simplex (LENGTH [u1;u3] - 1) ul' /\ + LENGTH [u1;u3] <= LENGTH ul'`); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_IMP_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH; ARITH_RULE `SUC(SUC(0)) - 1 = 1`]); + (MESON_TAC[]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `u3 = v1:real^3`); + (NEW_GOAL`u3 = EL 1 [u1;u3:real^3]`); + (REWRITE_TAC[EL; ARITH_RULE `1 = SUC 0`; TL; HD]); + (ONCE_REWRITE_TAC[ASSUME `u3 = EL 1 [u1;u3:real^3]`]); + + (REWRITE_WITH `v1:real^3 = EL 1 ul'`); + (ASM_REWRITE_TAC[EL; ARITH_RULE `1 = SUC 0`; TL; HD]); + (REWRITE_WITH `[u1;u3:real^3] = truncate_simplex 1 ul'`); + (NEW_GOAL `[u1;u3:real^3] = truncate_simplex (LENGTH [u1;u3] - 1) ul' /\ + LENGTH [u1;u3] <= LENGTH ul'`); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_IMP_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH; ARITH_RULE `SUC(SUC(0)) - 1 = 1`]); + (MESON_TAC[]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `{u0,u1,u2,u3:real^3} = {v0,v1,v2,v3}`); + (NEW_GOAL `{u0,u1,u2,u3:real^3} = {v0,v1,v2,v3} <=> + convex hull {u0,u1,u2,u3:real^3} = convex hull {v0,v1,v2,v3}`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ); + (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`); + GSYM (ASSUME `ul' = [v0;v1;v2;v3:real^3]`)]); + (STRIP_TAC); + (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[ASSUME `{u0, u1, u2, u3:real^3} = {v0, v1, v2, v3} <=> + convex hull {u0, u1, u2, u3} = convex hull {v0, v1, v2, v3}`]); + (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`); + GSYM (ASSUME `ul' = [v0;v1;v2;v3:real^3]`)]); + (REWRITE_WITH `convex hull set_of_list ul= X:real^3->bool`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (REWRITE_WITH `mcell i V ul = mcell4 V ul`); + (MESON_TAC[ASSUME `i >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 4`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `X:real^3->bool = {}`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 4`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REFL_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + + (NEW_GOAL `(v2 = u0 /\ v3 = u2:real^3) \/ (v2 = u2 /\ v3 = u0)`); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ + ~(u1 = u2) /\ ~(u1 = u3) /\ ~(u2 = u3:real^3)`); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] DIHV_EQ_DIH_Y)); + (STRIP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE ` {v0, v1, v3, v2} = {v0, v1, v2, v3}`]); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `u1 = v0:real^3`); GSYM (ASSUME `u3 = v1:real^3`)]); + (EXPAND_TAC "y1" THEN EXPAND_TAC "y2" THEN EXPAND_TAC "y3"); + (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6"); + (REWRITE_TAC[DIST_SYM]); + + (GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] DIHV_EQ_DIH_Y)); + (STRIP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE ` {v0, v1, v3, v2} = {v0, v1, v2, v3}`]); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `u1 = v0:real^3`); GSYM (ASSUME `u3 = v1:real^3`)]); + (EXPAND_TAC "y1" THEN EXPAND_TAC "y2" THEN EXPAND_TAC "y3"); + (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6"); + (REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[Nonlinear_lemma.dih_y_sym]); + + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `F`); + (NEW_GOAL `V INTER (X:real^3->bool) = set_of_list (truncate_simplex (4 - 1) ul)`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (REWRITE_WITH `mcell i V ul = mcell 4 V ul`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT; ASSUME `i >= 4`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 4 /\ 4 <= 4`]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT; ASSUME `i >= 4`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[ARITH_RULE `4 - 1 = 3`; + ASSUME `ul = [u0;u1;u2;u3:real^3]`; TRUNCATE_SIMPLEX_EXPLICIT_3]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (ASM_CASES_TAC `k = 1`); + + (REWRITE_WITH `V INTER (X:real^3->bool) = + set_of_list (truncate_simplex (k - 1) ul')`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 1 /\ 1 <= 4`]); + (REWRITE_WITH `mcell 1 V ul' = X`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 1`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `1 - 1 = 0`; ASSUME `k = 1`]); + (REWRITE_WITH `truncate_simplex 0 (ul':(real^3)list) = [HD ul']`); + (MATCH_MP_TAC Packing3.TRUNCATE_0_EQ_HEAD); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (STRIP_TAC); + (NEW_GOAL `CARD (set_of_list [(HD ul'):real^3]) = + CARD (set_of_list (ul:(real^3)list))`); + (AP_TERM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH `CARD (set_of_list (ul:(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[set_of_list; Geomdetail.CARD_SING] THEN ARITH_TAC); + (NEW_GOAL `k = 0`); + (ASM_ARITH_TAC); + + (REWRITE_WITH `V INTER X = {}:real^3->bool`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 0`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[set_of_list]); + (NEW_GOAL `u0 IN {u0,u1,u2,u3:real^3}`); + (SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) + + (REWRITE_TAC[dihX]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (LET_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u1; u2] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + + (ABBREV_TAC `wl = [u1;u2;u0;u3:real^3]`); + + (* Need to list properties of wl at this point *) + (NEW_GOAL `?p. p permutes 0..3 /\ + wl:(real^3)list = left_action_list p ul`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "wl"); + (MATCH_MP_TAC Marchal_cells_3.LEFT_ACTION_LIST_3_EXISTS); + (STRIP_TAC); + (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (REWRITE_TAC[ARITH_RULE `4 = 3 + 1`]); + (MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `barV V 3 wl`); + (MATCH_MP_TAC Qzksykg.QZKSYKG1); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `4` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[SET_RULE `4 IN {0,1,2,3,4}`; ARITH_RULE `4 - 1 = 3`]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT; ASSUME `i >= 4`]); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `(4, wl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (ASM_REWRITE_TAC[IN; ARITH_RULE `4 <= 4`]); + (STRIP_TAC); + + (REWRITE_WITH `mcell i V [u0; u1; u2; u3] = mcell 4 V [u0; u1; u2; u3]`); + (MESON_TAC[MCELL_EXPLICIT; ASSUME `i >= 4`; ARITH_RULE `4 >= 4`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Rvfxzbu.RVFXZBU); + (ASM_REWRITE_TAC[SET_RULE `4 IN {0,1,2,3,4}`; ARITH_RULE `4 - 1 = 3`]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_TAC[GSYM (ASSUME `wl:(real^3)list = left_action_list p ul`)]); + (EXPAND_TAC "wl"); + (REWRITE_WITH `[u1; u2; u0; u3] = APPEND [u1; u2] [u0; u3:real^3]`); + (REWRITE_TAC[APPEND]); + (REWRITE_TAC[Packing3.INITIAL_SUBLIST_APPEND]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN]); + + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `2 <= k`); + (NEW_GOAL `k = 4`); + (NEW_GOAL `4 = k /\ + (!t. 4 - 1 <= t /\ t <= 3 + ==> omega_list_n V ul t = omega_list_n V ul' t)`); + (MATCH_MP_TAC Marchal_cells_3.MCELL_ID_OMEGA_LIST_N); + (ASM_REWRITE_TAC[SET_RULE `x IN {2,3,4} <=> x=2\/x=3\/x=4`]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (REWRITE_WITH `mcell 4 V ul = X`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (MESON_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; ASSUME `i >= 4`]); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `~NULLSET X`]); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (REWRITE_TAC[dihu4]); + (NEW_GOAL `?v0 v1 v2 v3. ul' = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `u1 = v0:real^3`); + (NEW_GOAL`u1 = HD [u1;u2:real^3]`); + (REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[ASSUME `u1 = HD[u1;u2:real^3]`]); + (REWRITE_WITH `v0:real^3 = HD ul'`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `[u1;u2:real^3] = truncate_simplex 1 ul'`); + (NEW_GOAL `[u1;u2:real^3] = truncate_simplex (LENGTH [u1;u2] - 1) ul' /\ + LENGTH [u1;u2] <= LENGTH ul'`); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_IMP_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH; ARITH_RULE `SUC(SUC(0)) - 1 = 1`]); + (MESON_TAC[]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `u2 = v1:real^3`); + (NEW_GOAL`u2 = EL 1 [u1;u2:real^3]`); + (REWRITE_TAC[EL; ARITH_RULE `1 = SUC 0`; TL; HD]); + (ONCE_REWRITE_TAC[ASSUME `u2 = EL 1 [u1;u2:real^3]`]); + + (REWRITE_WITH `v1:real^3 = EL 1 ul'`); + (ASM_REWRITE_TAC[EL; ARITH_RULE `1 = SUC 0`; TL; HD]); + (REWRITE_WITH `[u1;u2:real^3] = truncate_simplex 1 ul'`); + (NEW_GOAL `[u1;u2:real^3] = truncate_simplex (LENGTH [u1;u2] - 1) ul' /\ + LENGTH [u1;u2] <= LENGTH ul'`); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_IMP_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH; ARITH_RULE `SUC(SUC(0)) - 1 = 1`]); + (MESON_TAC[]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `{u0,u1,u2,u3:real^3} = {v0,v1,v2,v3}`); + (NEW_GOAL `{u0,u1,u2,u3:real^3} = {v0,v1,v2,v3} <=> + convex hull {u0,u1,u2,u3:real^3} = convex hull {v0,v1,v2,v3}`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ); + (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`); + GSYM (ASSUME `ul' = [v0;v1;v2;v3:real^3]`)]); + (STRIP_TAC); + (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[ASSUME `{u0, u1, u2, u3:real^3} = {v0, v1, v2, v3} <=> + convex hull {u0, u1, u2, u3} = convex hull {v0, v1, v2, v3}`]); + (REWRITE_TAC[GSYM set_of_list; GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`); + GSYM (ASSUME `ul' = [v0;v1;v2;v3:real^3]`)]); + (REWRITE_WITH `convex hull set_of_list ul= X:real^3->bool`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (REWRITE_WITH `mcell i V ul = mcell4 V ul`); + (MESON_TAC[ASSUME `i >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 4`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `X:real^3->bool = {}`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 4`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REFL_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + + (NEW_GOAL `(v2 = u0 /\ v3 = u3:real^3) \/ (v2 = u3 /\ v3 = u0)`); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ + ~(u1 = u2) /\ ~(u1 = u3) /\ ~(u2 = u3:real^3)`); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] DIHV_EQ_DIH_Y)); + (STRIP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE ` {v0, v1, v3, v2} = {v0, v1, v2, v3}`]); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `u1 = v0:real^3`); GSYM (ASSUME `u2 = v1:real^3`)]); + (EXPAND_TAC "y1" THEN EXPAND_TAC "y2" THEN EXPAND_TAC "y3"); + (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6"); + (REWRITE_TAC[DIST_SYM]); + + (GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] DIHV_EQ_DIH_Y)); + (STRIP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v3:real^3`); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `v2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE ` {v0, v1, v3, v2} = {v0, v1, v2, v3}`]); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {v0, v1, v2, v3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {v0, v1, v2,v3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `k = 4`; ASSUME `X = mcell k V ul'`]); + (REWRITE_WITH `mcell 4 V ul' = mcell4 V ul'`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `u1 = v0:real^3`); GSYM (ASSUME `u2 = v1:real^3`)]); + (EXPAND_TAC "y1" THEN EXPAND_TAC "y2" THEN EXPAND_TAC "y3"); + (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6"); + (REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[Nonlinear_lemma.dih_y_sym]); + + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `F`); + (NEW_GOAL `V INTER (X:real^3->bool) = set_of_list (truncate_simplex (4 - 1) ul)`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (REWRITE_WITH `mcell i V ul = mcell 4 V ul`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT; ASSUME `i >= 4`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 4 /\ 4 <= 4`]); + (REWRITE_WITH `mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT; ASSUME `i >= 4`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[ARITH_RULE `4 - 1 = 3`; + ASSUME `ul = [u0;u1;u2;u3:real^3]`; TRUNCATE_SIMPLEX_EXPLICIT_3]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (ASM_CASES_TAC `k = 1`); + + (REWRITE_WITH `V INTER (X:real^3->bool) = + set_of_list (truncate_simplex (k - 1) ul')`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 1 /\ 1 <= 4`]); + (REWRITE_WITH `mcell 1 V ul' = X`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 1`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `1 - 1 = 0`; ASSUME `k = 1`]); + (REWRITE_WITH `truncate_simplex 0 (ul':(real^3)list) = [HD ul']`); + (MATCH_MP_TAC Packing3.TRUNCATE_0_EQ_HEAD); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (STRIP_TAC); + (NEW_GOAL `CARD (set_of_list [(HD ul'):real^3]) = + CARD (set_of_list (ul:(real^3)list))`); + (AP_TERM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH `CARD (set_of_list (ul:(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[set_of_list; Geomdetail.CARD_SING] THEN ARITH_TAC); + (NEW_GOAL `k = 0`); + (ASM_ARITH_TAC); + + (REWRITE_WITH `V INTER X = {}:real^3->bool`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 0`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[set_of_list]); + (NEW_GOAL `u0 IN {u0,u1,u2,u3:real^3}`); + (SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (STRIP_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[])]);; + +(* ---------------------------------------------------------------------- *) + +let SOL_SOL_Y_EXPLICIT = prove_by_refinement ( + `!V X ul u0 u1 u2 u3 i y1 y2 y3 y4 y5 y6. + saturated V /\ + packing V /\ + barV V 3 ul /\ + i >= 4 /\ + X = mcell i V ul /\ + ~NULLSET X /\ + ul = [u0; u1; u2; u3] /\ + dist (u0,u1) = y1 /\ + dist (u0,u2) = y2 /\ + dist (u0,u3) = y3 /\ + dist (u2,u3) = y4 /\ + dist (u1,u3) = y5 /\ + dist (u1,u2) = y6 + ==> + sol u0 X = sol_y y1 y2 y3 y4 y5 y6 /\ + sol u1 X = sol_y y1 y5 y6 y4 y2 y3 /\ + sol u2 X = sol_y y4 y2 y6 y1 y5 y3 /\ + sol u3 X = sol_y y4 y5 y3 y1 y2 y6`, + +[(REPEAT GEN_TAC THEN STRIP_TAC); + (NEW_GOAL `~(X:real^3->bool = {})`); + (STRIP_TAC THEN UNDISCH_TAC `~NULLSET X` THEN + REWRITE_TAC[ASSUME `X:real^3->bool = {}`; NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `X = mcell4 V ul`); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT]); + (UP_ASM_TAC THEN REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (REWRITE_TAC[ASSUME `ul = [u0; u1; u2; u3:real^3]`; set_of_list]); + (STRIP_TAC); + + (NEW_GOAL `VX V X = {u0,u1,u2,u3}`); + (REWRITE_WITH `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `X = mcell 4 V ul`); + (ASM_REWRITE_TAC[]); + (MESON_TAC[ARITH_RULE `4 >= 4`; ASSUME `i >= 4`; MCELL_EXPLICIT]); + + (REWRITE_WITH + `V INTER mcell 4 V ul = set_of_list (truncate_simplex (4 - 1) ul)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 4 /\ 4 <= 4`]); + (REWRITE_WITH ` mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (MESON_TAC[ARITH_RULE `4 >= 4`; ASSUME `i >= 4`; MCELL_EXPLICIT]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[ARITH_RULE `4 - 1 = 3`; TRUNCATE_SIMPLEX_EXPLICIT_3; + set_of_list]); + + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} = 4`); + (REWRITE_TAC[ARITH_RULE `4 = 3 + 1`; GSYM set_of_list; + GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `~(u0 = u1:real^3) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ + ~(u1 = u2) /\ ~(u1 = u3) /\ ~(u2 = u3)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u0 = u1:real^3`; + SET_RULE `{u1, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u0 = u2:real^3`; + SET_RULE `{u2, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u0 = u3:real^3`; + SET_RULE `{u3, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u1 = u2:real^3`; + SET_RULE `{u0, u2, u2, u3} = {u0,u2,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u1 = u3:real^3`; + SET_RULE `{u0, u3, u2, u3} = {u0,u2,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u2 = u3:real^3`; + SET_RULE `{u0, u1, u3, u3} = {u0,u1,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + + + (NEW_GOAL `~(coplanar {u0,u1,u2,u3:real^3})`); + (REWRITE_TAC[coplanar] THEN STRIP_TAC); + (NEW_GOAL `affine hull {u0, u1, u2, u3:real^3} SUBSET + affine hull (affine hull {u, v, w})`); + (ASM_SIMP_TAC[Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA]); + (UP_ASM_TAC THEN REWRITE_WITH `affine hull (affine hull {u, v, w}) = + affine hull {u:real^3, v, w}`); + (REWRITE_TAC[AFFINE_HULL_EQ; AFFINE_AFFINE_HULL]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u,v,w:real^3}`); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (REWRITE_WITH `mcell i V ul = mcell4 V ul`); + (MESON_TAC[ARITH_RULE `4 >= 4`; MCELL_EXPLICIT; ASSUME `i >= 4`]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list; CONVEX_HULL_SUBSET_AFFINE_HULL]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (REPEAT STRIP_TAC); + (REWRITE_TAC[sol_y]); + (REWRITE_WITH `dih_y y1 y2 y3 y4 y5 y6 = dihV (u0:real^3) u1 u2 u3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MP_TAC Merge_ineq.DIHV_EQ_DIH_Y); + (REWRITE_TAC[LET_DEF; LET_END_DEF]); + (EXPAND_TAC "y1"); + (EXPAND_TAC "y2"); + (EXPAND_TAC "y3"); + (EXPAND_TAC "y4"); + (EXPAND_TAC "y5"); + (EXPAND_TAC "y6"); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u3:real^3` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u0,u1,u3,u2} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `dih_y y2 y3 y1 y5 y6 y4 = dihV (u0:real^3) u2 u3 u1`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MP_TAC Merge_ineq.DIHV_EQ_DIH_Y); + (REWRITE_TAC[LET_DEF; LET_END_DEF]); + (EXPAND_TAC "y1"); + (EXPAND_TAC "y2"); + (EXPAND_TAC "y3"); + (EXPAND_TAC "y4"); + (EXPAND_TAC "y5"); + (EXPAND_TAC "y6"); + (STRIP_TAC); + (REWRITE_WITH +`dih_y (dist (u0,u2:real^3)) (dist (u0,u3)) (dist (u0,u1)) (dist (u1,u3)) + (dist (u1,u2)) (dist (u2,u3)) = + dih_y (dist (u0,u2)) (dist (u0,u3)) (dist (u0,u1)) (dist (u3,u1)) + (dist (u2,u1)) (dist (u2,u3))`); + (REWRITE_TAC[DIST_SYM]); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u1:real^3` THEN ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{u0,u2,u3,u1} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u3:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u0,u2,u1,u3} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `dih_y y3 y1 y2 y6 y4 y5 = dihV (u0:real^3) u3 u1 u2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MP_TAC Merge_ineq.DIHV_EQ_DIH_Y); + (REWRITE_TAC[LET_DEF; LET_END_DEF]); + (EXPAND_TAC "y1"); + (EXPAND_TAC "y2"); + (EXPAND_TAC "y3"); + (EXPAND_TAC "y4"); + (EXPAND_TAC "y5"); + (EXPAND_TAC "y6"); + (STRIP_TAC); + (REWRITE_WITH +`dih_y (dist (u0,u3)) (dist (u0,u1)) (dist (u0,u2)) (dist (u1,u2)) + (dist (u2,u3:real^3)) + (dist (u1,u3)) = + dih_y (dist (u0,u3)) (dist (u0,u1)) (dist (u0,u2)) (dist (u1,u2)) + (dist (u3,u2)) + (dist (u3,u1))`); + (REWRITE_TAC[DIST_SYM]); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3` THEN ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{u0,u3,u1,u2} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u1:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u0,u3, u2,u1} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `X = convex hull {u0,u1,u2,u3:real^3}`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ASSUME `i >= 4`; mcell4; set_of_list]); + (MATCH_MP_TAC SOL_SOLID_TRIANGLE); + (ASM_REWRITE_TAC[]); + +(* ----- *) + (REWRITE_TAC[sol_y]); + (REWRITE_WITH `dih_y y1 y5 y6 y4 y2 y3 = dihV (u1:real^3) u0 u3 u2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MP_TAC Merge_ineq.DIHV_EQ_DIH_Y); + (REWRITE_TAC[LET_DEF; LET_END_DEF]); + (EXPAND_TAC "y1"); + (EXPAND_TAC "y2"); + (EXPAND_TAC "y3"); + (EXPAND_TAC "y4"); + (EXPAND_TAC "y5"); + (EXPAND_TAC "y6"); + (STRIP_TAC); + (REWRITE_WITH +`dih_y (dist (u0,u1)) (dist (u1,u3)) (dist (u1,u2)) (dist (u2,u3)) + (dist (u0,u2:real^3)) + (dist (u0,u3)) = + dih_y (dist (u1,u0)) (dist (u1,u3)) (dist (u1,u2)) (dist (u3,u2)) + (dist (u0,u2)) + (dist (u0,u3))`); + (REWRITE_TAC[DIST_SYM]); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3` THEN ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{u1,u0,u3,u2} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u3:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u1,u0,u2,u3} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `dih_y y5 y6 y1 y2 y3 y4 = dihV (u1:real^3) u3 u2 u0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MP_TAC Merge_ineq.DIHV_EQ_DIH_Y); + (REWRITE_TAC[LET_DEF; LET_END_DEF]); + (EXPAND_TAC "y1"); + (EXPAND_TAC "y2"); + (EXPAND_TAC "y3"); + (EXPAND_TAC "y4"); + (EXPAND_TAC "y5"); + (EXPAND_TAC "y6"); + (STRIP_TAC); + (REWRITE_WITH +`dih_y (dist (u1,u3)) (dist (u1,u2)) (dist (u0,u1)) (dist (u0,u2)) + (dist (u0,u3:real^3)) + (dist (u2,u3)) = + dih_y (dist (u1,u3)) (dist (u1,u2)) (dist (u1,u0)) (dist (u2,u0)) + (dist (u3,u0)) + (dist (u3,u2))`); + (REWRITE_TAC[DIST_SYM]); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u0:real^3` THEN ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{u1,u3,u2,u0} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u1,u3,u0,u2} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `dih_y y6 y1 y5 y3 y4 y2 = dihV (u1:real^3) u2 u0 u3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MP_TAC Merge_ineq.DIHV_EQ_DIH_Y); + (REWRITE_TAC[LET_DEF; LET_END_DEF]); + (EXPAND_TAC "y1"); + (EXPAND_TAC "y2"); + (EXPAND_TAC "y3"); + (EXPAND_TAC "y4"); + (EXPAND_TAC "y5"); + (EXPAND_TAC "y6"); + (STRIP_TAC); + (REWRITE_WITH +`dih_y (dist (u1,u2)) (dist (u0,u1)) (dist (u1,u3)) (dist (u0,u3)) + (dist (u2,u3:real^3)) + (dist (u0,u2)) = + dih_y (dist (u1,u2)) (dist (u1,u0)) (dist (u1,u3)) (dist (u0,u3)) + (dist (u2,u3)) + (dist (u2,u0))`); + (REWRITE_TAC[DIST_SYM]); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u3:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u1,u2,u0,u3} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u0:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u1,u2, u3,u0} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `X = convex hull {u0,u1,u2,u3:real^3}`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ASSUME `i >= 4`; mcell4; set_of_list]); + (ONCE_REWRITE_TAC[SET_RULE `{u0,u1,u2,u3} = {u1,u2,u0,u3}`]); + + (ONCE_REWRITE_TAC[REAL_ARITH `a + b + c - s = c + a + b - s`]); + (MATCH_MP_TAC SOL_SOLID_TRIANGLE); + (ONCE_REWRITE_TAC[GSYM (SET_RULE `{u0,u1,u2,u3} = {u1,u2,u0,u3}`)]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[sol_y]); + (REWRITE_WITH `dih_y y4 y2 y6 y1 y5 y3 = dihV (u2:real^3) u3 u0 u1`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MP_TAC Merge_ineq.DIHV_EQ_DIH_Y); + (REWRITE_TAC[LET_DEF; LET_END_DEF]); + (EXPAND_TAC "y1"); + (EXPAND_TAC "y2"); + (EXPAND_TAC "y3"); + (EXPAND_TAC "y4"); + (EXPAND_TAC "y5"); + (EXPAND_TAC "y6"); + (STRIP_TAC); + (REWRITE_WITH +`dih_y (dist (u2,u3)) (dist (u0,u2)) (dist (u1,u2)) (dist (u0,u1)) + (dist (u1,u3:real^3)) + (dist (u0,u3)) = + dih_y (dist (u2,u3)) (dist (u2,u0)) (dist (u2,u1)) (dist (u0,u1)) + (dist (u3,u1)) + (dist (u3,u0))`); + (REWRITE_TAC[DIST_SYM]); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u1:real^3` THEN ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{u2,u3,u0,u1} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u0:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u2,u3,u1,u0} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `dih_y y2 y6 y4 y5 y3 y1 = dihV (u2:real^3) u0 u1 u3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MP_TAC Merge_ineq.DIHV_EQ_DIH_Y); + (REWRITE_TAC[LET_DEF; LET_END_DEF]); + (EXPAND_TAC "y1"); + (EXPAND_TAC "y2"); + (EXPAND_TAC "y3"); + (EXPAND_TAC "y4"); + (EXPAND_TAC "y5"); + (EXPAND_TAC "y6"); + (STRIP_TAC); + (REWRITE_WITH +`dih_y (dist (u0,u2)) (dist (u1,u2)) (dist (u2,u3)) (dist (u1,u3)) + (dist (u0,u3:real^3)) + (dist (u0,u1)) = + dih_y (dist (u2,u0)) (dist (u2,u1)) (dist (u2,u3)) (dist (u1,u3)) + (dist (u0,u3)) + (dist (u0,u1))`); + (REWRITE_TAC[DIST_SYM]); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u3:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u2,u0,u1,u3} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u1:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u2, u0, u3,u1} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `dih_y y6 y4 y2 y3 y1 y5 = dihV (u2:real^3) u1 u3 u0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MP_TAC Merge_ineq.DIHV_EQ_DIH_Y); + (REWRITE_TAC[LET_DEF; LET_END_DEF]); + (EXPAND_TAC "y1"); + (EXPAND_TAC "y2"); + (EXPAND_TAC "y3"); + (EXPAND_TAC "y4"); + (EXPAND_TAC "y5"); + (EXPAND_TAC "y6"); + (STRIP_TAC); + (REWRITE_WITH +`dih_y (dist (u1,u2)) (dist (u2,u3)) (dist (u0,u2)) (dist (u0,u3)) + (dist (u0,u1:real^3)) + (dist (u1,u3)) = + dih_y (dist (u2,u1)) (dist (u2,u3)) (dist (u2,u0)) (dist (u3,u0)) + (dist (u1,u0)) + (dist (u1,u3))`); + (REWRITE_TAC[DIST_SYM]); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u0:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u2,u1,u3,u0} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u3:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u2,u1,u0,u3} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `X = convex hull {u0,u1,u2,u3:real^3}`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ASSUME `i >= 4`; mcell4; set_of_list]); + (ONCE_REWRITE_TAC[SET_RULE `{u0,u1,u2,u3} = {u2,u3,u0,u1}`]); + + (MATCH_MP_TAC SOL_SOLID_TRIANGLE); + (ONCE_REWRITE_TAC[SET_RULE `{u2,u3,u0,u1} = {u0, u1, u2, u3}`]); + (ASM_REWRITE_TAC[]); + + + (REWRITE_TAC[sol_y]); + (REWRITE_WITH `dih_y y4 y5 y3 y1 y2 y6 = dihV (u3:real^3) u2 u1 u0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MP_TAC Merge_ineq.DIHV_EQ_DIH_Y); + (REWRITE_TAC[LET_DEF; LET_END_DEF]); + (EXPAND_TAC "y1"); + (EXPAND_TAC "y2"); + (EXPAND_TAC "y3"); + (EXPAND_TAC "y4"); + (EXPAND_TAC "y5"); + (EXPAND_TAC "y6"); + (STRIP_TAC); + (REWRITE_WITH +`dih_y (dist (u2,u3)) (dist (u1,u3)) (dist (u0,u3)) (dist (u0,u1)) + (dist (u0,u2)) + (dist (u1,u2)) = + dih_y (dist (u3,u2)) (dist (u3,u1)) (dist (u3,u0)) (dist (u1,u0)) + (dist (u2,u0:real^3)) + (dist (u2,u1))`); + (REWRITE_TAC[DIST_SYM]); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u0:real^3` THEN ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{u3,u2,u1,u0} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u1:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u3,u2,u0,u1} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `dih_y y5 y3 y4 y2 y6 y1 = dihV (u3:real^3) u1 u0 u2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MP_TAC Merge_ineq.DIHV_EQ_DIH_Y); + (REWRITE_TAC[LET_DEF; LET_END_DEF]); + (EXPAND_TAC "y1"); + (EXPAND_TAC "y2"); + (EXPAND_TAC "y3"); + (EXPAND_TAC "y4"); + (EXPAND_TAC "y5"); + (EXPAND_TAC "y6"); + (STRIP_TAC); + (REWRITE_WITH +`dih_y (dist (u1,u3)) (dist (u0,u3)) (dist (u2,u3)) (dist (u0,u2)) + (dist (u1,u2:real^3)) + (dist (u0,u1)) = + dih_y (dist (u3,u1)) (dist (u3,u0)) (dist (u3,u2)) (dist (u0,u2)) + (dist (u1,u2)) + (dist (u1,u0))`); + (REWRITE_TAC[DIST_SYM]); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3` THEN ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{u3,u1,u0,u2} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u0:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u3, u1, u2,u0} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `dih_y y3 y4 y5 y6 y1 y2 = dihV (u3:real^3) u0 u2 u1`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MP_TAC Merge_ineq.DIHV_EQ_DIH_Y); + (REWRITE_TAC[LET_DEF; LET_END_DEF]); + (EXPAND_TAC "y1"); + (EXPAND_TAC "y2"); + (EXPAND_TAC "y3"); + (EXPAND_TAC "y4"); + (EXPAND_TAC "y5"); + (EXPAND_TAC "y6"); + (STRIP_TAC); + (REWRITE_WITH +`dih_y (dist (u0,u3)) (dist (u2,u3)) (dist (u1,u3)) (dist (u1,u2)) + (dist (u0,u1:real^3)) + (dist (u0,u2)) = + dih_y (dist (u3,u0)) (dist (u3,u2)) (dist (u3,u1)) (dist (u2,u1)) + (dist (u0,u1)) + (dist (u0,u2:real^3))`); + (REWRITE_TAC[DIST_SYM]); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u1:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u3,u0,u2,u1} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u3,u0,u1,u2} = {u0,u1,u2,u3}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `X = convex hull {u0,u1,u2,u3:real^3}`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ASSUME `i >= 4`; mcell4; set_of_list]); + (ONCE_REWRITE_TAC[SET_RULE `{u0,u1,u2,u3} = {u3,u0,u2,u1}`]); + + (ONCE_REWRITE_TAC[REAL_ARITH `a + b + c - s = c + a + b - s`]); + (MATCH_MP_TAC SOL_SOLID_TRIANGLE); + (ONCE_REWRITE_TAC[GSYM (SET_RULE `{u0,u1,u2,u3} = {u3, u0, u2, u1}`)]); + (ASM_REWRITE_TAC[]); + + (STRIP_TAC THEN NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[])]);; + +(* ---------------------------------------------------------------------- *) + +let gammaX_gamm4fgcy = prove_by_refinement ( + `!V X ul u0 u1 u2 u3 i y1 y2 y3 y4 y5 y6. + saturated V /\ + packing V /\ + barV V 3 ul /\ + i >= 4 /\ + X = mcell i V ul /\ + ~NULLSET X /\ + ul = [u0; u1; u2; u3] /\ + dist (u0,u1) = y1 /\ + dist (u0,u2) = y2 /\ + dist (u0,u3) = y3 /\ + dist (u2,u3) = y4 /\ + dist (u1,u3) = y5 /\ + dist (u1,u2) = y6 + ==> + vol X = vol_y y1 y2 y3 y4 y5 y6 /\ + gammaX V X lmfun = gamma4fgcy y1 y2 y3 y4 y5 y6 lmfun`, + +[(REPEAT GEN_TAC THEN STRIP_TAC); + (NEW_GOAL `~(X:real^3->bool = {})`); + (STRIP_TAC THEN UNDISCH_TAC `~NULLSET X` THEN + REWRITE_TAC[ASSUME `X:real^3->bool = {}`; NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `X = mcell4 V ul`); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT]); + (UP_ASM_TAC THEN REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (REWRITE_TAC[ASSUME `ul = [u0; u1; u2; u3:real^3]`; set_of_list]); + (STRIP_TAC); + + (NEW_GOAL `VX V X = {u0,u1,u2,u3}`); + (REWRITE_WITH `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `X = mcell 4 V ul`); + (ASM_REWRITE_TAC[]); + (MESON_TAC[ARITH_RULE `4 >= 4`; ASSUME `i >= 4`; MCELL_EXPLICIT]); + + (REWRITE_WITH + `V INTER mcell 4 V ul = set_of_list (truncate_simplex (4 - 1) ul)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 4 /\ 4 <= 4`]); + (REWRITE_WITH ` mcell 4 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (MESON_TAC[ARITH_RULE `4 >= 4`; ASSUME `i >= 4`; MCELL_EXPLICIT]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[ARITH_RULE `4 - 1 = 3`; TRUNCATE_SIMPLEX_EXPLICIT_3; + set_of_list]); + + (REWRITE_TAC[gammaX; gamma4fgcy;gamma4f]); + + (REWRITE_WITH `vol X = vol_y y1 y2 y3 y4 y5 y6`); + (REWRITE_TAC[vol_y; y_of_x; vol_x; + ASSUME `X = convex hull {u0, u1, u2, u3:real^3}`; + VOLUME_OF_CLOSED_TETRAHEDRON; REAL_POW_2]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `a - b + c = a - d <=> d = b - c`; vol4f]); + +(* ---------------------------------------------------------------- *) + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} = 4`); + (REWRITE_TAC[ARITH_RULE `4 = 3 + 1`; GSYM set_of_list; + GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `~(u0 = u1:real^3) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ + ~(u1 = u2) /\ ~(u1 = u3) /\ ~(u2 = u3)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u0 = u1:real^3`; + SET_RULE `{u1, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u0 = u2:real^3`; + SET_RULE `{u2, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u0 = u3:real^3`; + SET_RULE `{u3, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u1 = u2:real^3`; + SET_RULE `{u0, u2, u2, u3} = {u0,u2,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u1 = u3:real^3`; + SET_RULE `{u0, u3, u2, u3} = {u0,u2,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u2 = u3:real^3`; + SET_RULE `{u0, u1, u3, u3} = {u0,u1,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + + (NEW_GOAL `edgeX V X = {{u0,u1:real^3}, {u0,u2}, {u0,u3}, + {u1,u2}, {u1,u3}, {u2,u3}}`); + (REWRITE_TAC[edgeX]); + (ONCE_REWRITE_TAC[SET_EQ_LEMMA]); + (REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `VX V X u` THEN UNDISCH_TAC `VX V X v`); + (REWRITE_TAC[MESON[IN] `VX V X s <=> s IN VX V X`]); + (ASM_REWRITE_TAC[SET_RULE `v IN {u0, u1, u2, u3} <=> + v = u0 \/ v = u1 \/ v = u2 \/ v = u3`]); + (REPEAT STRIP_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + (SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + (SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + (SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + (SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + (SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + (SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (UP_ASM_TAC THEN REWRITE_TAC[SET_RULE `x IN {a,b,c,d,e,f} <=> + x = a \/ x = b \/ x = c \/ x = d \/ x = e \/ x = f`]); + (REWRITE_TAC[MESON[IN] `VX V X s <=> s IN VX V X`]); + (ASM_REWRITE_TAC[SET_RULE `v IN {u0, u1, u2, u3} <=> + v = u0 \/ v = u1 \/ v = u2 \/ v = u3`]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u2:real^3` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u3:real^3` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u3:real^3` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3` THEN ASM_REWRITE_TAC[]); + + + (ABBREV_TAC `f = + (\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)`); + (MATCH_MP_TAC (REAL_ARITH `y = b /\ x = a ==> a - b = x - y`)); + (STRIP_TAC); + (AP_TERM_TAC); + (ASM_REWRITE_TAC[]); + + (ABBREV_TAC `S5 = {{u0, u2}, {u0, u3}, {u1, u2}, {u1, u3}, {u2, u3:real^3}}`); + (REWRITE_WITH `sum ({u0,u1:real^3} INSERT S5) f = + (if {u0,u1} IN S5 then sum S5 f else f {u0,u1} + sum S5 f)`); + (MATCH_MP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt); + (EXPAND_TAC "S5"); + (REWRITE_TAC[Geomdetail.FINITE6]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN EXPAND_TAC "S5"); + (REWRITE_TAC[SET_RULE `x IN {a,b,c,d,e} <=> x=a\/x=b\/x=c\/x=d\/x=e`]); + (SET_TAC[ASSUME + `~(u0 = u1:real^3) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ ~(u1 = u2) /\ + ~(u1 = u3) /\ ~(u2 = u3)`]); + (UP_ASM_TAC THEN MESON_TAC[]); + (EXPAND_TAC "S5"); + + (ABBREV_TAC `S4 = {{u0, u3}, {u1, u2}, {u1, u3}, {u2, u3:real^3}}`); + (REWRITE_WITH `sum ({u0,u2:real^3} INSERT S4) f = + (if {u0,u2} IN S4 then sum S4 f else f {u0,u2} + sum S4 f)`); + (MATCH_MP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt); + (EXPAND_TAC "S4"); + (REWRITE_TAC[Geomdetail.FINITE6]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN EXPAND_TAC "S4"); + (REWRITE_TAC[SET_RULE `x IN {a,b,c,d} <=> x=a\/x=b\/x=c\/x=d`]); + (SET_TAC[ASSUME + `~(u0 = u1:real^3) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ ~(u1 = u2) /\ + ~(u1 = u3) /\ ~(u2 = u3)`]); + (UP_ASM_TAC THEN MESON_TAC[]); + + + (EXPAND_TAC "S4"); + (ABBREV_TAC `S3 = {{u1, u2}, {u1, u3}, {u2, u3:real^3}}`); + (REWRITE_WITH `sum ({u0,u3:real^3} INSERT S3) f = + (if {u0,u3} IN S3 then sum S3 f else f {u0,u3} + sum S3 f)`); + (MATCH_MP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt); + (EXPAND_TAC "S3"); + (REWRITE_TAC[Geomdetail.FINITE6]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN EXPAND_TAC "S3"); + (REWRITE_TAC[SET_RULE `x IN {a,b,c} <=> x=a\/x=b\/x=c`]); + (SET_TAC[ASSUME + `~(u0 = u1:real^3) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ ~(u1 = u2) /\ + ~(u1 = u3) /\ ~(u2 = u3)`]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (EXPAND_TAC "S3"); + (ABBREV_TAC `S2 = {{u1, u3}, {u2, u3:real^3}}`); + (REWRITE_WITH `sum ({u1,u2:real^3} INSERT S2) f = + (if {u1,u2} IN S2 then sum S2 f else f {u1,u2} + sum S2 f)`); + (MATCH_MP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt); + (EXPAND_TAC "S2"); + (REWRITE_TAC[Geomdetail.FINITE6]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN EXPAND_TAC "S2"); + (REWRITE_TAC[SET_RULE `x IN {a,b} <=> x=a\/x=b`]); + (SET_TAC[ASSUME + `~(u0 = u1:real^3) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ ~(u1 = u2) /\ + ~(u1 = u3) /\ ~(u2 = u3)`]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (EXPAND_TAC "S2"); + (ABBREV_TAC `S1 = {{u2, u3:real^3}}`); + (REWRITE_WITH `sum ({u1,u3:real^3} INSERT S1) f = + (if {u1,u3} IN S1 then sum S1 f else f {u1,u3} + sum S1 f)`); + (MATCH_MP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt); + (EXPAND_TAC "S1"); + (REWRITE_TAC[Geomdetail.FINITE6]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN EXPAND_TAC "S1"); + (REWRITE_TAC[SET_RULE `x IN {a} <=> x=a`]); + (SET_TAC[ASSUME + `~(u0 = u1:real^3) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ ~(u1 = u2) /\ + ~(u1 = u3) /\ ~(u2 = u3)`]); + (UP_ASM_TAC THEN MESON_TAC[]); + (EXPAND_TAC "S1" THEN REWRITE_TAC[SUM_SING]); + +(* ========================================================================= *) + + (REWRITE_WITH `f {u0, u1:real^3} = lmfun (y1 / &2) * dih_y y1 y2 y3 y4 y5 y6`); + (EXPAND_TAC "f"); + + (ABBREV_TAC `g = (\u v. if {u, v:real^3} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)`); + (REWRITE_WITH `(\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0) = (\({u, v:real^3}). g u v)`); + (EXPAND_TAC "g" THEN REWRITE_TAC[]); + (REWRITE_WITH `(\({u, v:real^3}). g u v) {u0, u1} = (g u0 u1):real`); + (MATCH_MP_TAC BETA_PAIR_THM); + (REPEAT STRIP_TAC THEN EXPAND_TAC "g" ); + (COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_WITH `dihX V X (u,v) = dihX V X (v,u)`); + (MATCH_MP_TAC Marchal_cells_3.DIHX_SYM); + (REWRITE_TAC[mcell_set; IN_ELIM_THM]); + (ASM_REWRITE_TAC[IN]); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `ul:(real^3)list` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REFL_TAC); + (EXPAND_TAC "g"); + (COND_CASES_TAC); + (REWRITE_TAC[HL_2; REAL_ARITH `inv(&2) * a = a / &2`]); + (REWRITE_TAC[REAL_ARITH ` t * lmfun(s) = lmfun(s) * t`]); + (EXPAND_TAC "y1" THEN AP_TERM_TAC); + (REWRITE_TAC[ASSUME `dist (u0,u1:real^3) = y1`]); + (REWRITE_WITH + `dihX V X (u0,u1) = dih_y y1 y2 y3 y4 y5 y6 /\ + dihX V X (u0,u2) = dih_y y2 y3 y1 y5 y6 y4 /\ + dihX V X (u0,u3) = dih_y y3 y1 y2 y6 y4 y5 /\ + dihX V X (u2,u3) = dih_y y4 y3 y5 y1 y6 y2 /\ + dihX V X (u1,u3) = dih_y y5 y1 y6 y2 y4 y3 /\ + dihX V X (u1,u2) = dih_y y6 y1 y5 y3 y4 y2`); + (MATCH_MP_TAC DIHX_DIH_Y_lemma); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + +(* ========================================================================= *) + + (REWRITE_WITH `f {u0, u2:real^3} = lmfun (y2 / &2) * dih_y y2 y3 y1 y5 y6 y4`); + (EXPAND_TAC "f"); + (ABBREV_TAC `g = (\u v. if {u, v:real^3} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)`); + (REWRITE_WITH `(\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0) = (\({u, v:real^3}). g u v)`); + (EXPAND_TAC "g" THEN REWRITE_TAC[]); + (REWRITE_WITH `(\({u, v:real^3}). g u v) {u0, u2} = (g u0 u2):real`); + (MATCH_MP_TAC BETA_PAIR_THM); + (REPEAT STRIP_TAC THEN EXPAND_TAC "g" ); + (COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_WITH `dihX V X (u,v) = dihX V X (v,u)`); + (MATCH_MP_TAC Marchal_cells_3.DIHX_SYM); + (REWRITE_TAC[mcell_set; IN_ELIM_THM]); + (ASM_REWRITE_TAC[IN]); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `ul:(real^3)list` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REFL_TAC); + (EXPAND_TAC "g"); + (COND_CASES_TAC); + (REWRITE_TAC[HL_2; REAL_ARITH `inv(&2) * a = a / &2`]); + (REWRITE_TAC[REAL_ARITH ` t * lmfun(s) = lmfun(s) * t`]); + (EXPAND_TAC "y2" THEN AP_TERM_TAC); + (REWRITE_TAC[ASSUME `dist (u0,u2:real^3) = y2`]); + (REWRITE_WITH + `dihX V X (u0,u1) = dih_y y1 y2 y3 y4 y5 y6 /\ + dihX V X (u0,u2) = dih_y y2 y3 y1 y5 y6 y4 /\ + dihX V X (u0,u3) = dih_y y3 y1 y2 y6 y4 y5 /\ + dihX V X (u2,u3) = dih_y y4 y3 y5 y1 y6 y2 /\ + dihX V X (u1,u3) = dih_y y5 y1 y6 y2 y4 y3 /\ + dihX V X (u1,u2) = dih_y y6 y1 y5 y3 y4 y2`); + (MATCH_MP_TAC DIHX_DIH_Y_lemma); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "S5" THEN SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + +(* ========================================================================= *) + + (REWRITE_WITH `f {u0, u3:real^3} = lmfun (y3 / &2) * dih_y y3 y1 y2 y6 y4 y5`); + (EXPAND_TAC "f"); + (ABBREV_TAC `g = (\u v. if {u, v:real^3} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)`); + (REWRITE_WITH `(\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0) = (\({u, v:real^3}). g u v)`); + (EXPAND_TAC "g" THEN REWRITE_TAC[]); + (REWRITE_WITH `(\({u, v:real^3}). g u v) {u0, u3} = (g u0 u3):real`); + (MATCH_MP_TAC BETA_PAIR_THM); + (REPEAT STRIP_TAC THEN EXPAND_TAC "g" ); + (COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_WITH `dihX V X (u,v) = dihX V X (v,u)`); + (MATCH_MP_TAC Marchal_cells_3.DIHX_SYM); + (REWRITE_TAC[mcell_set; IN_ELIM_THM]); + (ASM_REWRITE_TAC[IN]); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `ul:(real^3)list` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REFL_TAC); + (EXPAND_TAC "g"); + (COND_CASES_TAC); + (REWRITE_TAC[HL_2; REAL_ARITH `inv(&2) * a = a / &2`]); + (REWRITE_TAC[REAL_ARITH ` t * lmfun(s) = lmfun(s) * t`]); + (EXPAND_TAC "y3" THEN AP_TERM_TAC); + (REWRITE_TAC[ASSUME `dist (u0,u3:real^3) = y3`]); + (REWRITE_WITH + `dihX V X (u0,u1) = dih_y y1 y2 y3 y4 y5 y6 /\ + dihX V X (u0,u2) = dih_y y2 y3 y1 y5 y6 y4 /\ + dihX V X (u0,u3) = dih_y y3 y1 y2 y6 y4 y5 /\ + dihX V X (u2,u3) = dih_y y4 y3 y5 y1 y6 y2 /\ + dihX V X (u1,u3) = dih_y y5 y1 y6 y2 y4 y3 /\ + dihX V X (u1,u2) = dih_y y6 y1 y5 y3 y4 y2`); + (MATCH_MP_TAC DIHX_DIH_Y_lemma); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "S5" THEN EXPAND_TAC "S4" THEN SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + +(* ========================================================================= *) + + (REWRITE_WITH `f {u2, u3:real^3} = lmfun (y4 / &2) * dih_y y4 y3 y5 y1 y6 y2`); + (EXPAND_TAC "f"); + (ABBREV_TAC `g = (\u v. if {u, v:real^3} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)`); + (REWRITE_WITH `(\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0) = (\({u, v:real^3}). g u v)`); + (EXPAND_TAC "g" THEN REWRITE_TAC[]); + (REWRITE_WITH `(\({u, v:real^3}). g u v) {u2, u3} = (g u2 u3):real`); + (MATCH_MP_TAC BETA_PAIR_THM); + (REPEAT STRIP_TAC THEN EXPAND_TAC "g" ); + (COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_WITH `dihX V X (u,v) = dihX V X (v,u)`); + (MATCH_MP_TAC Marchal_cells_3.DIHX_SYM); + (REWRITE_TAC[mcell_set; IN_ELIM_THM]); + (ASM_REWRITE_TAC[IN]); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `ul:(real^3)list` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REFL_TAC); + (EXPAND_TAC "g"); + (COND_CASES_TAC); + (REWRITE_TAC[HL_2; REAL_ARITH `inv(&2) * a = a / &2`]); + (REWRITE_TAC[REAL_ARITH ` t * lmfun(s) = lmfun(s) * t`]); + (EXPAND_TAC "y4" THEN AP_TERM_TAC); + + (REWRITE_TAC[ASSUME `dist (u2,u3:real^3) = y4`]); + (REWRITE_WITH + `dihX V X (u0,u1) = dih_y y1 y2 y3 y4 y5 y6 /\ + dihX V X (u0,u2) = dih_y y2 y3 y1 y5 y6 y4 /\ + dihX V X (u0,u3) = dih_y y3 y1 y2 y6 y4 y5 /\ + dihX V X (u2,u3) = dih_y y4 y3 y5 y1 y6 y2 /\ + dihX V X (u1,u3) = dih_y y5 y1 y6 y2 y4 y3 /\ + dihX V X (u1,u2) = dih_y y6 y1 y5 y3 y4 y2`); + (MATCH_MP_TAC DIHX_DIH_Y_lemma); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "S5" THEN EXPAND_TAC "S4" THEN EXPAND_TAC "S3" THEN + EXPAND_TAC "S2" THEN EXPAND_TAC "S1"THEN SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + +(* ========================================================================= *) + + (REWRITE_WITH `f {u1, u3:real^3} = lmfun (y5 / &2) * dih_y y5 y1 y6 y2 y4 y3`); + (EXPAND_TAC "f"); + (ABBREV_TAC `g = (\u v. if {u, v:real^3} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)`); + (REWRITE_WITH `(\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0) = (\({u, v:real^3}). g u v)`); + (EXPAND_TAC "g" THEN REWRITE_TAC[]); + (REWRITE_WITH `(\({u, v:real^3}). g u v) {u1, u3} = (g u1 u3):real`); + (MATCH_MP_TAC BETA_PAIR_THM); + (REPEAT STRIP_TAC THEN EXPAND_TAC "g" ); + (COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_WITH `dihX V X (u,v) = dihX V X (v,u)`); + (MATCH_MP_TAC Marchal_cells_3.DIHX_SYM); + (REWRITE_TAC[mcell_set; IN_ELIM_THM]); + (ASM_REWRITE_TAC[IN]); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `ul:(real^3)list` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REFL_TAC); + (EXPAND_TAC "g"); + (COND_CASES_TAC); + (REWRITE_TAC[HL_2; REAL_ARITH `inv(&2) * a = a / &2`]); + (REWRITE_TAC[REAL_ARITH ` t * lmfun(s) = lmfun(s) * t`]); + (EXPAND_TAC "y5" THEN AP_TERM_TAC); + + (REWRITE_TAC[ASSUME `dist (u1,u3:real^3) = y5`]); + (REWRITE_WITH + `dihX V X (u0,u1) = dih_y y1 y2 y3 y4 y5 y6 /\ + dihX V X (u0,u2) = dih_y y2 y3 y1 y5 y6 y4 /\ + dihX V X (u0,u3) = dih_y y3 y1 y2 y6 y4 y5 /\ + dihX V X (u2,u3) = dih_y y4 y3 y5 y1 y6 y2 /\ + dihX V X (u1,u3) = dih_y y5 y1 y6 y2 y4 y3 /\ + dihX V X (u1,u2) = dih_y y6 y1 y5 y3 y4 y2`); + (MATCH_MP_TAC DIHX_DIH_Y_lemma); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "S5" THEN EXPAND_TAC "S4" THEN EXPAND_TAC "S3" THEN + EXPAND_TAC "S2" THEN EXPAND_TAC "S1"THEN SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + +(* ========================================================================= *) + + (REWRITE_WITH `f {u1, u2:real^3} = lmfun (y6 / &2) * dih_y y6 y1 y5 y3 y4 y2`); + (EXPAND_TAC "f"); + (ABBREV_TAC `g = (\u v. if {u, v:real^3} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)`); + (REWRITE_WITH `(\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0) = (\({u, v:real^3}). g u v)`); + (EXPAND_TAC "g" THEN REWRITE_TAC[]); + (REWRITE_WITH `(\({u, v:real^3}). g u v) {u1, u2} = (g u1 u2):real`); + (MATCH_MP_TAC BETA_PAIR_THM); + (REPEAT STRIP_TAC THEN EXPAND_TAC "g" ); + (COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_WITH `dihX V X (u,v) = dihX V X (v,u)`); + (MATCH_MP_TAC Marchal_cells_3.DIHX_SYM); + (REWRITE_TAC[mcell_set; IN_ELIM_THM]); + (ASM_REWRITE_TAC[IN]); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `ul:(real^3)list` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REFL_TAC); + (EXPAND_TAC "g"); + (COND_CASES_TAC); + (REWRITE_TAC[HL_2; REAL_ARITH `inv(&2) * a = a / &2`]); + (REWRITE_TAC[REAL_ARITH ` t * lmfun(s) = lmfun(s) * t`]); + (EXPAND_TAC "y6" THEN AP_TERM_TAC); + + (REWRITE_TAC[ASSUME `dist (u1,u2:real^3) = y6`]); + (REWRITE_WITH + `dihX V X (u0,u1) = dih_y y1 y2 y3 y4 y5 y6 /\ + dihX V X (u0,u2) = dih_y y2 y3 y1 y5 y6 y4 /\ + dihX V X (u0,u3) = dih_y y3 y1 y2 y6 y4 y5 /\ + dihX V X (u2,u3) = dih_y y4 y3 y5 y1 y6 y2 /\ + dihX V X (u1,u3) = dih_y y5 y1 y6 y2 y4 y3 /\ + dihX V X (u1,u2) = dih_y y6 y1 y5 y3 y4 y2`); + (MATCH_MP_TAC DIHX_DIH_Y_lemma); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "S5" THEN EXPAND_TAC "S4" THEN EXPAND_TAC "S3" THEN + EXPAND_TAC "S2" THEN EXPAND_TAC "S1"THEN SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + +(* ==================================== *) + (REAL_ARITH_TAC); + (AP_TERM_TAC); + + (REWRITE_TAC[total_solid]); + (REWRITE_TAC[ASSUME `VX V X = {u0,u1,u2,u3}`]); + (ABBREV_TAC `h = (\x. sol x X)`); + + (ABBREV_TAC `S3 = {u1,u2,u3:real^3}`); + (REWRITE_WITH `sum (u0:real^3 INSERT S3) h = + (if u0 IN S3 then sum S3 h else h u0 + sum S3 h)`); + (MATCH_MP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt); + (EXPAND_TAC "S3"); + (REWRITE_TAC[Geomdetail.FINITE6]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN EXPAND_TAC "S3"); + (REWRITE_TAC[SET_RULE `x IN {a,b,c} <=> x=a\/x=b\/x=c`]); + (SET_TAC[ASSUME + `~(u0 = u1:real^3) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ ~(u1 = u2) /\ + ~(u1 = u3) /\ ~(u2 = u3)`]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (EXPAND_TAC "S3"); + (ABBREV_TAC `S2 = {u2,u3:real^3}`); + (REWRITE_WITH `sum (u1:real^3 INSERT S2) h = + (if u1 IN S2 then sum S2 h else h u1 + sum S2 h)`); + (MATCH_MP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt); + (EXPAND_TAC "S2"); + (REWRITE_TAC[Geomdetail.FINITE6]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN EXPAND_TAC "S2"); + (REWRITE_TAC[SET_RULE `x IN {a,b} <=> x = a \/ x = b`]); + (SET_TAC[ASSUME + `~(u0 = u1:real^3) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ ~(u1 = u2) /\ + ~(u1 = u3) /\ ~(u2 = u3)`]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (EXPAND_TAC "S2"); + (ABBREV_TAC `S1 = {u3:real^3}`); + (REWRITE_WITH `sum (u2:real^3 INSERT S1) h = + (if u2 IN S1 then sum S1 h else h u2 + sum S1 h)`); + (MATCH_MP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt); + (EXPAND_TAC "S1"); + (REWRITE_TAC[Geomdetail.FINITE6]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN EXPAND_TAC "S1"); + (REWRITE_TAC[SET_RULE `x IN {a} <=> x = a`]); + (SET_TAC[ASSUME + `~(u0 = u1:real^3) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ ~(u1 = u2) /\ + ~(u1 = u3) /\ ~(u2 = u3)`]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (EXPAND_TAC "S1" THEN REWRITE_TAC[SUM_SING]); + (EXPAND_TAC "h" THEN REWRITE_TAC[BETA_THM]); + + (REWRITE_WITH + `sol u0 X = sol_y y1 y2 y3 y4 y5 y6 /\ + sol u1 X = sol_y y1 y5 y6 y4 y2 y3 /\ + sol u2 X = sol_y y4 y2 y6 y1 y5 y3 /\ + sol u3 X = sol_y y4 y5 y3 y1 y2 y6`); + (MATCH_MP_TAC SOL_SOL_Y_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `ul:(real^3)list` THEN + EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + + (STRIP_TAC THEN NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[])]);; + +(* ---------------------------------------------------------------------- *) + + +(* ====================================================================== *) + +let gammaX_gamma3f = prove_by_refinement ( + `!V X ul u0 u1 u2 u3 y4 y5 y6. + saturated V /\ + packing V /\ + barV V 3 ul /\ + X = mcell 3 V ul /\ + ~NULLSET X /\ + ul = [u0; u1; u2; u3] /\ + dist (u1, u2) = y4 /\ + dist (u0, u2) = y5 /\ + dist (u0, u1) = y6 + ==> + vol X = vol_y sqrt2 sqrt2 sqrt2 y4 y5 y6 /\ + sol u0 X = sol_y y5 y6 sqrt2 sqrt2 sqrt2 y4 /\ + sol u1 X = sol_y y6 y4 sqrt2 sqrt2 sqrt2 y5 /\ + sol u2 X = sol_y y4 y5 sqrt2 sqrt2 sqrt2 y6 /\ + dihX V X (u0,u1) = dih_y y6 y4 sqrt2 sqrt2 sqrt2 y5 /\ + dihX V X (u0,u2) = dih_y y5 y6 sqrt2 sqrt2 sqrt2 y4 /\ + dihX V X (u1,u2) = dih_y y4 y5 sqrt2 sqrt2 sqrt2 y6 /\ + gammaX V X lmfun = gamma3f y4 y5 y6 sqrt2 lmfun`, +[(REPEAT GEN_TAC THEN STRIP_TAC); + + (NEW_GOAL `~(X:real^3->bool = {})`); + (STRIP_TAC THEN UNDISCH_TAC `~NULLSET X` THEN + REWRITE_TAC[ASSUME `X:real^3->bool = {}`; NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `X = mcell3 V ul`); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[MCELL_EXPLICIT]); + (UP_ASM_TAC THEN REWRITE_TAC[mcell3]); + (COND_CASES_TAC); + (STRIP_TAC); + + (NEW_GOAL `(?s. between s (omega_list_n V ul 2,omega_list_n V ul 3) /\ + dist (u0,s) = sqrt (&2) /\ + mxi V ul = s)`); + (MATCH_MP_TAC MXI_EXPLICIT); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `s2 = omega_list_n V ul 2`); + (ABBREV_TAC `s3 = omega_list_n V ul 3`); + (ABBREV_TAC `vl = truncate_simplex 2 (ul:(real^3)list)`); + (NEW_GOAL `s2 IN voronoi_list V vl`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "vl"); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `s3 IN voronoi_list V vl`); + (EXPAND_TAC "s3" THEN EXPAND_TAC "vl"); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `s IN voronoi_list V vl`); + (MATCH_MP_TAC (SET_RULE `(?x. s IN x /\ x SUBSET t)==> s IN t`)); + (EXISTS_TAC `convex hull {s2,s3:real^3}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL]); + (NEW_GOAL `voronoi_list V vl = convex hull (voronoi_list V vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[CONVEX_HULL_EQ; Packing3.CONVEX_VORONOI_LIST]); + (ONCE_REWRITE_TAC[ASSUME `voronoi_list V vl = convex hull voronoi_list V vl`]); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (ASM_SET_TAC[]); + + (MP_TAC (ASSUME `s IN voronoi_list V vl`)); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_2; VORONOI_LIST; VORONOI_SET; set_of_list; + SET_RULE `x IN {a,b,c} <=> x=a\/x=b\/x=c`; IN_INTERS]); + (STRIP_TAC); + (NEW_GOAL `s IN voronoi_closed V u0 /\ s IN voronoi_closed V u1 /\ + s IN voronoi_closed V (u2:real^3)`); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM] THEN + STRIP_TAC); + + (NEW_GOAL `u0 IN V /\ u1 IN V /\ u2 IN V /\ (u3:real^3) IN V`); + (REWRITE_TAC[SET_RULE `u0 IN V /\ u1 IN V /\ u2 IN V /\ (u3:real^3) IN V <=> + {u0,u1,u2,u3} SUBSET V`; GSYM set_of_list; GSYM + (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (MATCH_MP_TAC BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (FIRST_ASSUM MP_TAC THEN REWRITE_TAC[IN] THEN STRIP_TAC); + + (NEW_GOAL `dist (s,u1:real^3) = sqrt(&2)`); + (REWRITE_TAC[GSYM (ASSUME `dist (u0:real^3, s) = sqrt (&2)`)]); + (REWRITE_WITH `dist (u0,s:real^3) = dist (s,u0)`); + (NORM_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `a = b <=> a <= b /\ b <= a`]); + (ASM_SIMP_TAC[]); + (NEW_GOAL `dist (s,u2:real^3) = sqrt(&2)`); + (REWRITE_TAC[GSYM (ASSUME `dist (u0:real^3, s) = sqrt (&2)`)]); + (REWRITE_WITH `dist (u0,s:real^3) = dist (s,u0)`); + (NORM_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `a = b <=> a <= b /\ b <= a`]); + (ASM_SIMP_TAC[]); + + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} = 4`); + (REWRITE_TAC[ARITH_RULE `4 = 3 + 1`; GSYM set_of_list; + GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `~(u0 = u1:real^3) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ + ~(u1 = u2) /\ ~(u1 = u3) /\ ~(u2 = u3)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u0 = u1:real^3`; + SET_RULE `{u1, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u0 = u2:real^3`; + SET_RULE `{u2, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u0 = u3:real^3`; + SET_RULE `{u3, u1, u2, u3} = {u1,u2,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u1 = u2:real^3`; + SET_RULE `{u0, u2, u2, u3} = {u0,u2,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u1 = u3:real^3`; + SET_RULE `{u0, u3, u2, u3} = {u0,u2,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u2 = u3:real^3`; + SET_RULE `{u0, u1, u3, u3} = {u0,u1,u3}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + + + (NEW_GOAL `VX V X = {u0,u1,u2}`); + (REWRITE_WITH `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `3`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `X = mcell 3 V ul`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH + `V INTER mcell 3 V ul = set_of_list (truncate_simplex (3 - 1) ul)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3 /\ 3 <= 4`]); + (REWRITE_WITH ` mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2; + set_of_list]); + + (UNDISCH_TAC `X = convex hull (set_of_list vl UNION {mxi V ul})`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_2; + ASSUME `ul = [u0;u1;u2;u3:real^3]`; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (REWRITE_WITH `mxi V [u0; u1; u2; u3] = s`); + (EXPAND_TAC "s" THEN AP_TERM_TAC THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (NEW_GOAL `~coplanar {u0,u1,u2,s:real^3}`); + (ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (REWRITE_TAC[ASSUME `X = convex hull {u0, u1, u2, s:real^3}`]); + (MATCH_MP_TAC COPLANAR_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, s:real^3}`); + (ASM_REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (NEW_GOAL `CARD {u0, u1, u2, s:real^3} = 4`); + (NEW_GOAL `CARD {u0, u1, u2, s:real^3} <= 4`); + (REWRITE_TAC[Geomdetail.CARD4]); + (ASM_CASES_TAC `CARD {u0, u1, u2, s:real^3} <= 3`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, u2, s:real^3}`); + (REWRITE_TAC[] THEN MATCH_MP_TAC COPLANAR_SMALL); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + (UP_ASM_TAC THEN MESON_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `~(u0 = s:real^3) /\ ~(u1 = s) /\ ~(u2 = s)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `CARD {u0, u1, u2,s:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u0 = s:real^3`; + SET_RULE `{s, u1, u2, s} = {s,u1,u2}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, s:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u1 = s:real^3`; + SET_RULE `{u0, s, u2, s} = {u0,u2,s}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + (NEW_GOAL `CARD {u0, u1, u2, s:real^3} <= 3`); + (REWRITE_TAC[ASSUME `u2 = s:real^3`; + SET_RULE `{u0, u1, s, s} = {u0,u1,s}`;Geomdetail.CARD3 ]); + (ASM_ARITH_TAC); + +(* ========================================================================= *) + + (NEW_GOAL `vol X = vol_y sqrt2 sqrt2 sqrt2 y4 y5 y6`); + + (REWRITE_TAC[vol_y; y_of_x; vol_x; + ASSUME `X = convex hull {u0, u1, u2, s:real^3}`]); + (ONCE_REWRITE_TAC[SET_RULE `{u0, u1, u2,s} = {s, u0,u1, u2}`]); + (REWRITE_TAC[VOLUME_OF_CLOSED_TETRAHEDRON; REAL_POW_2]); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[sqrt2]); + + (REWRITE_TAC[gamma3f; gammaX; vol3r;vol3f]); + (REWRITE_TAC[ASSUME `vol X = vol_y sqrt2 sqrt2 sqrt2 y4 y5 y6`]); + + +(* ========================================================================= *) + + (REWRITE_TAC[total_solid; ASSUME `VX V X = {u0,u1,u2:real^3}`]); + (ABBREV_TAC `h = (\x. sol x X)`); + + (ABBREV_TAC `S2 = {u1,u2:real^3}`); + (REWRITE_WITH `sum (u0:real^3 INSERT S2) h = + (if u0 IN S2 then sum S2 h else h u0 + sum S2 h)`); + (MATCH_MP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt); + (EXPAND_TAC "S2"); + (REWRITE_TAC[Geomdetail.FINITE6]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN EXPAND_TAC "S2"); + (REWRITE_TAC[SET_RULE `x IN {a,b} <=> x = a \/ x = b`]); + (SET_TAC[ASSUME + `~(u0 = u1:real^3) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ ~(u1 = u2) /\ + ~(u1 = u3) /\ ~(u2 = u3)`]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (EXPAND_TAC "S2"); + (ABBREV_TAC `S1 = {u2:real^3}`); + (REWRITE_WITH `sum (u1:real^3 INSERT S1) h = + (if u1 IN S1 then sum S1 h else h u1 + sum S1 h)`); + (MATCH_MP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt); + (EXPAND_TAC "S1"); + (REWRITE_TAC[Geomdetail.FINITE6]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN EXPAND_TAC "S1"); + (REWRITE_TAC[SET_RULE `x IN {a} <=> x = a`]); + (SET_TAC[ASSUME + `~(u0 = u1:real^3) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ ~(u1 = u2) /\ + ~(u1 = u3) /\ ~(u2 = u3)`]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (EXPAND_TAC "S1" THEN REWRITE_TAC[SUM_SING]); + (EXPAND_TAC "h" THEN REWRITE_TAC[BETA_THM]); + +(* ======================================================================== *) + + (REWRITE_WITH `sol u0 X = sol_y y5 y6 sqrt2 sqrt2 sqrt2 y4`); + (REWRITE_TAC[sol_y]); + (REWRITE_WITH `dih_y y5 y6 sqrt2 sqrt2 sqrt2 y4 = dihV (u0:real^3) u2 u1 s`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MP_TAC Merge_ineq.DIHV_EQ_DIH_Y); + (REWRITE_TAC[LET_DEF; LET_END_DEF]); + (EXPAND_TAC "y4"); + (EXPAND_TAC "y5"); + (EXPAND_TAC "y6"); + (STRIP_TAC); + (REWRITE_WITH + `dih_y (dist (u0,u2)) (dist (u0,u1)) sqrt2 sqrt2 sqrt2 (dist (u1,u2)) = + dih_y (dist (u0,u2)) (dist (u0,u1)) (dist (u0,s)) + (dist (u1,s)) (dist (u2,s)) (dist (u2,u1:real^3))`); + (ASM_REWRITE_TAC[DIST_SYM; sqrt2]); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u0,u2,u1,s} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u1:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u0,u2,s,u1} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `dih_y y6 sqrt2 y5 sqrt2 y4 sqrt2 = + dihV (u0:real^3) u1 s u2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MP_TAC Merge_ineq.DIHV_EQ_DIH_Y); + (REWRITE_TAC[LET_DEF; LET_END_DEF]); + (EXPAND_TAC "y4"); + (EXPAND_TAC "y5"); + (EXPAND_TAC "y6"); + (STRIP_TAC); + (REWRITE_WITH +`dih_y (dist (u0,u1)) sqrt2 (dist (u0,u2)) sqrt2 (dist (u1,u2)) sqrt2 = + dih_y (dist (u0,u1)) (dist (u0,s)) (dist (u0,u2)) (dist (s,u2)) + (dist (u1,u2)) (dist (u1,s:real^3))`); + (ASM_REWRITE_TAC[DIST_SYM; sqrt2]); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u0,u1,s,u2} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s:real^3`); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `dih_y sqrt2 y5 y6 y4 sqrt2 sqrt2 = + dihV (u0:real^3) s u2 u1`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MP_TAC Merge_ineq.DIHV_EQ_DIH_Y); + (REWRITE_TAC[LET_DEF; LET_END_DEF]); + (EXPAND_TAC "y4"); + (EXPAND_TAC "y5"); + (EXPAND_TAC "y6"); + (STRIP_TAC); + (REWRITE_WITH +`dih_y sqrt2 (dist (u0,u2)) (dist (u0,u1)) (dist (u1,u2)) sqrt2 sqrt2 = + dih_y (dist (u0,s)) (dist (u0,u2)) (dist (u0,u1)) (dist (u2,u1)) + (dist (s,u1)) (dist (s,u2:real^3))`); + (ASM_REWRITE_TAC[DIST_SYM;sqrt2]); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u1:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u0,s,u2,u1} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u0,s, u1,u2} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ASSUME `X = convex hull {u0,u1,u2,s:real^3}`]); + (ONCE_REWRITE_TAC[REAL_ARITH `a + b + c = b + a + c`]); + (MATCH_MP_TAC SOL_SOLID_TRIANGLE); + (ASM_REWRITE_TAC[DIHV_SYM_2]); + +(* ======================================================================== *) + + (REWRITE_WITH `sol u1 X = sol_y y6 y4 sqrt2 sqrt2 sqrt2 y5`); + (REWRITE_TAC[sol_y]); + (REWRITE_WITH `dih_y y6 y4 sqrt2 sqrt2 sqrt2 y5 = dihV (u1:real^3) u0 u2 s`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MP_TAC Merge_ineq.DIHV_EQ_DIH_Y); + (REWRITE_TAC[LET_DEF; LET_END_DEF]); + (EXPAND_TAC "y4"); + (EXPAND_TAC "y5"); + (EXPAND_TAC "y6"); + (STRIP_TAC); + (REWRITE_WITH + `dih_y (dist (u0,u1)) (dist (u1,u2)) sqrt2 sqrt2 sqrt2 (dist (u0,u2)) = + dih_y (dist (u1,u0)) (dist (u1,u2)) (dist (u1,s)) + (dist (u2,s)) (dist (u0,s)) (dist (u0,u2:real^3))`); + (ASM_REWRITE_TAC[DIST_SYM; sqrt2]); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u1,u0,u2,s} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u1,u0,s,u2} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `dih_y y4 sqrt2 y6 sqrt2 y5 sqrt2 = + dihV (u1:real^3) u2 s u0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MP_TAC Merge_ineq.DIHV_EQ_DIH_Y); + (REWRITE_TAC[LET_DEF; LET_END_DEF]); + (EXPAND_TAC "y4"); + (EXPAND_TAC "y5"); + (EXPAND_TAC "y6"); + (STRIP_TAC); + (REWRITE_WITH +`dih_y (dist (u1,u2)) sqrt2 (dist (u0,u1)) sqrt2 (dist (u0,u2)) sqrt2 = + dih_y (dist (u1,u2)) (dist (u1,s)) (dist (u1,u0)) (dist (s,u0)) + (dist (u2,u0)) (dist (u2,s:real^3))`); + (REWRITE_WITH `dist (s,u0:real^3) = dist (u0,s)`); + (REWRITE_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[DIST_SYM; sqrt2]); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u0:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u1,u2,s,u0} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u1,u2,u0,s} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `dih_y sqrt2 y6 y4 y5 sqrt2 sqrt2 = + dihV (u1:real^3) s u0 u2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MP_TAC Merge_ineq.DIHV_EQ_DIH_Y); + (REWRITE_TAC[LET_DEF; LET_END_DEF]); + (EXPAND_TAC "y4"); + (EXPAND_TAC "y5"); + (EXPAND_TAC "y6"); + (STRIP_TAC); + (REWRITE_WITH +`dih_y sqrt2 (dist (u0,u1)) (dist (u1,u2)) (dist (u0,u2)) sqrt2 sqrt2 = + dih_y (dist (u1,s)) (dist (u1,u0)) (dist (u1,u2)) (dist (u0,u2)) + (dist (s,u2)) (dist (s,u0:real^3))`); + (REWRITE_WITH `dist (s,u0:real^3) = dist (u0,s)`); + (REWRITE_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[DIST_SYM;sqrt2]); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u1,s,u0,u2} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u0:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u1,s, u2,u0} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ASSUME `X = convex hull {u0,u1,u2,s:real^3}`]); + (ONCE_REWRITE_TAC[SET_RULE `{u0, u1, u2, s} = {u1,u0,u2,s}`]); + (MATCH_MP_TAC SOL_SOLID_TRIANGLE); + (ONCE_REWRITE_TAC[GSYM (SET_RULE `{u0, u1, u2, s} = {u1,u0,u2,s}`)]); + (ASM_REWRITE_TAC[]); + +(* ======================================================================== *) + + (REWRITE_WITH `sol u2 X = sol_y y4 y5 sqrt2 sqrt2 sqrt2 y6`); + (REWRITE_TAC[sol_y]); + (REWRITE_WITH `dih_y y4 y5 sqrt2 sqrt2 sqrt2 y6 = + dihV (u2:real^3) u1 u0 s`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MP_TAC Merge_ineq.DIHV_EQ_DIH_Y); + (REWRITE_TAC[LET_DEF; LET_END_DEF]); + (EXPAND_TAC "y4"); + (EXPAND_TAC "y5"); + (EXPAND_TAC "y6"); + (STRIP_TAC); + (REWRITE_WITH + `dih_y (dist (u1,u2)) (dist (u0,u2)) sqrt2 sqrt2 sqrt2 (dist (u0,u1)) = + dih_y (dist (u2,u1)) (dist (u2,u0)) (dist (u2,s)) + (dist (u0,s)) (dist (u1,s)) (dist (u1,u0:real^3))`); + (ASM_REWRITE_TAC[DIST_SYM; sqrt2]); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u2,u1,u0,s} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u0:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u2,u1,s,u0} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `dih_y y5 sqrt2 y4 sqrt2 y6 sqrt2 = + dihV (u2:real^3) u0 s u1`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MP_TAC Merge_ineq.DIHV_EQ_DIH_Y); + (REWRITE_TAC[LET_DEF; LET_END_DEF]); + (EXPAND_TAC "y4"); + (EXPAND_TAC "y5"); + (EXPAND_TAC "y6"); + (STRIP_TAC); + (REWRITE_WITH +`dih_y (dist (u0,u2)) sqrt2 (dist (u1,u2)) sqrt2 (dist (u0,u1)) sqrt2 = + dih_y (dist (u2,u0)) (dist (u2,s)) (dist (u2,u1)) (dist (s,u1)) + (dist (u0,u1)) (dist (u0,s:real^3))`); + (ASM_REWRITE_TAC[DIST_SYM; sqrt2]); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u1:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u2,u0,s,u1} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u2,u0,u1,s} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `dih_y sqrt2 y4 y5 y6 sqrt2 sqrt2 = + dihV (u2:real^3) s u1 u0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MP_TAC Merge_ineq.DIHV_EQ_DIH_Y); + (REWRITE_TAC[LET_DEF; LET_END_DEF]); + (EXPAND_TAC "y4"); + (EXPAND_TAC "y5"); + (EXPAND_TAC "y6"); + (STRIP_TAC); + (REWRITE_WITH +`dih_y sqrt2 (dist (u1,u2)) (dist (u0,u2)) (dist (u0,u1)) sqrt2 sqrt2 = + dih_y (dist (u2,s)) (dist (u2,u1)) (dist (u2,u0)) (dist (u1,u0)) + (dist (s,u0)) (dist (s,u1:real^3))`); + (REWRITE_WITH `dist (s,u0:real^3) = dist (u0,s)`); + (REWRITE_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[DIST_SYM;sqrt2]); + (FIRST_ASSUM MATCH_MP_TAC); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u0:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u2,s,u1,u0} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u1:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u2,s, u0,u1} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ASSUME `X = convex hull {u0,u1,u2,s:real^3}`]); + (ONCE_REWRITE_TAC[SET_RULE `{u0, u1, u2, s} = {u2,u1,u0,s}`]); + (MATCH_MP_TAC SOL_SOLID_TRIANGLE); + (ONCE_REWRITE_TAC[SET_RULE `{u2, u1, u0, s} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + +(* ===================================================================== *) + (NEW_GOAL `dihX V X (u0,u1) = dih_y y6 y4 sqrt2 sqrt2 sqrt2 y5`); + (REWRITE_TAC[dihX]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (LET_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u1] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(3, ul:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (ASM_REWRITE_TAC[IN; ARITH_RULE `3 <= 4`]); + (REWRITE_TAC[INITIAL_SUBLIST]); + (EXISTS_TAC `[u2;u3:real^3]` THEN REWRITE_TAC[APPEND]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN]); + + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `2 <= k`); + (NEW_GOAL `k = 3`); + + (NEW_GOAL `3 = k /\ + (!t. 3 - 1 <= t /\ t <= 3 + ==> omega_list_n V ul t = omega_list_n V ul' t)`); + (MATCH_MP_TAC Marchal_cells_3.MCELL_ID_OMEGA_LIST_N); + (ASM_REWRITE_TAC[SET_RULE `x IN {2,3,4} <=> x=2\/x=3\/x=4`]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (REWRITE_WITH `mcell 3 V ul = X`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `~NULLSET X`]); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + +(* This part is harder than the previous *) + + (REWRITE_TAC[dihu3]); + (NEW_GOAL `?v0 v1 v2 v3. ul' = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `u0 = v0:real^3`); + (NEW_GOAL`u0 = HD [u0;u1:real^3]`); + (REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[ASSUME `u0 = HD[u0;u1:real^3]`]); + (REWRITE_WITH `v0:real^3 = HD ul'`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 ul'`); + (NEW_GOAL `[u0;u1:real^3] = truncate_simplex (LENGTH [u0;u1] - 1) ul' /\ + LENGTH [u0;u1] <= LENGTH ul'`); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_IMP_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH; ARITH_RULE `SUC(SUC(0)) - 1 = 1`]); + (MESON_TAC[]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `u1 = v1:real^3`); + (NEW_GOAL`u1 = EL 1 [u0;u1:real^3]`); + (REWRITE_TAC[EL; ARITH_RULE `1 = SUC 0`; TL; HD]); + (ONCE_REWRITE_TAC[ASSUME `u1 = EL 1 [u0;u1:real^3]`]); + + (REWRITE_WITH `v1:real^3 = EL 1 ul'`); + (ASM_REWRITE_TAC[EL; ARITH_RULE `1 = SUC 0`; TL; HD]); + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 ul'`); + (NEW_GOAL `[u0;u1:real^3] = truncate_simplex (LENGTH [u0;u1] - 1) ul' /\ + LENGTH [u0;u1] <= LENGTH ul'`); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_IMP_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH; ARITH_RULE `SUC(SUC(0)) - 1 = 1`]); + (MESON_TAC[]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `{u0,u1,u2:real^3} = {v0,v1,v2}`); + (REWRITE_TAC[GSYM set_of_list]); + (REWRITE_WITH `[u0; u1; u2:real^3] = truncate_simplex (3 - 1) ul`); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_WITH `set_of_list (truncate_simplex (3 - 1) ul) = + V INTER (mcell 3 V ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (REWRITE_WITH `mcell 3 V ul = X`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3 /\ 3 <= 4`]); + (REWRITE_WITH `mcell 3 V ul = X`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `X = mcell 3 V ul'`); + (ASM_MESON_TAC[]); + (REWRITE_WITH `[v0; v1; v2:real^3] = truncate_simplex (3 - 1) ul'`); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (REWRITE_WITH `mcell 3 V ul' = X`); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3 /\ 3 <= 4`]); + (NEW_GOAL `u2:real^3 = v2`); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ + ~(u1 = u2) /\ ~(u1 = u3) /\ ~(u2 = u3:real^3)` + THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "S1" THEN REWRITE_TAC[]); + (SET_TAC[]); + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]); + + (REWRITE_WITH `mxi V [v0; v1; v2; v3] = s`); + (EXPAND_TAC "s"); + (MATCH_MP_TAC Marchal_cells_3.MCELL_ID_MXI_2); + (EXISTS_TAC `3` THEN EXISTS_TAC `3`); + (REWRITE_TAC[GSYM (ASSUME `ul' = [v0; v1; v2; v3:real^3]`)]); + (REWRITE_WITH `mcell 3 V ul' = X`); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[SET_RULE `3 IN {2,3}`]); + (REWRITE_TAC[GSYM (ASSUME `u0 = v0:real^3`); + GSYM (ASSUME `u1 = v1:real^3`); + GSYM (ASSUME `u2 = v2:real^3`)]); + (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6"); + (ONCE_REWRITE_TAC[DIHV_SYM]); + + (REWRITE_WITH + `dih_y (dist (u0,u1)) (dist (u1,u2)) sqrt2 sqrt2 sqrt2 (dist (u0,u2)) = + dih_y (dist (u1,u0)) (dist (u1,u2)) (dist (u1,s)) + (dist (u2,s)) (dist (u0,s)) (dist (u0,u2:real^3))`); + (REWRITE_WITH `dist (u1,s) = dist (s,u1:real^3) /\ + dist (u2,s) = dist (s,u2) /\ dist (s,u0) = dist (u0,s)`); + (REWRITE_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[DIST_SYM; sqrt2]); + + (GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] DIHV_EQ_DIH_Y)); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u1,u0,u2,s} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u1,u0,s,u2} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (NEW_GOAL `F`); + (NEW_GOAL `V INTER (X:real^3->bool) = set_of_list (truncate_simplex (3 - 1) ul)`); + (REWRITE_TAC[ASSUME `X = mcell 3 V ul`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3 /\ 3 <= 4`]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[]); + + (ASM_CASES_TAC `k = 1`); + (REWRITE_WITH `V INTER (X:real^3->bool) = + set_of_list (truncate_simplex (k - 1) ul')`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 1 /\ 1 <= 4`]); + (REWRITE_WITH `mcell 1 V ul' = X`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 1`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ARITH_RULE `1 - 1 = 0`; ASSUME `k = 1`]); + (REWRITE_WITH `truncate_simplex 0 (ul':(real^3)list) = [HD ul']`); + (MATCH_MP_TAC Packing3.TRUNCATE_0_EQ_HEAD); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; + TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; HD]); + (UNDISCH_TAC `~(u0 = u1) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ + ~(u1 = u2) /\ ~(u1 = u3) /\ ~(u2 = u3:real^3)`); + (EXPAND_TAC "S2" THEN EXPAND_TAC "S1" THEN SET_TAC[]); + (NEW_GOAL `k = 0`); + (ASM_ARITH_TAC); + + (REWRITE_WITH `V INTER X = {}:real^3->bool`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 0`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; + TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (NEW_GOAL `u0 IN {u0,u1,u2:real^3}`); + (SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ======================================================================= *) + (NEW_GOAL `dihX V X (u0,u2) = dih_y y5 y6 sqrt2 sqrt2 sqrt2 y4`); + (REWRITE_TAC[dihX]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (LET_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u0; u2] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + + (ABBREV_TAC `wl = [u0;u2;u1;u3:real^3]`); + (NEW_GOAL `?p. p permutes 0..2 /\ + wl:(real^3)list = left_action_list p ul`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "wl"); + (MATCH_MP_TAC Marchal_cells_3.LEFT_ACTION_LIST_2_EXISTS); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "S2" THEN EXPAND_TAC "S1" THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `barV V 3 wl`); + (MATCH_MP_TAC Qzksykg.QZKSYKG1); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `3` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[SET_RULE `3 IN {0,1,2,3,4}`; ARITH_RULE `3 - 1 = 2`]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `(3, wl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (ASM_REWRITE_TAC[IN; ARITH_RULE `3 <= 4`]); + (STRIP_TAC); + + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Rvfxzbu.RVFXZBU); + (ASM_REWRITE_TAC[SET_RULE `3 IN {0,1,2,3,4}`; ARITH_RULE `3 - 1 = 2`]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_TAC[GSYM (ASSUME `wl:(real^3)list = left_action_list p ul`)]); + (EXPAND_TAC "wl"); + (REWRITE_WITH `[u0; u2; u1; u3] = APPEND [u0; u2] [u1; u3:real^3]`); + (REWRITE_TAC[APPEND]); + (REWRITE_TAC[Packing3.INITIAL_SUBLIST_APPEND]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN]); + + (REPEAT STRIP_TAC); + + (ASM_CASES_TAC `2 <= k`); + (NEW_GOAL `k = 3`); + + (NEW_GOAL `3 = k /\ + (!t. 3 - 1 <= t /\ t <= 3 + ==> omega_list_n V ul t = omega_list_n V ul' t)`); + (MATCH_MP_TAC Marchal_cells_3.MCELL_ID_OMEGA_LIST_N); + (ASM_REWRITE_TAC[SET_RULE `x IN {2,3,4} <=> x=2\/x=3\/x=4`]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (REWRITE_WITH `mcell 3 V ul = X`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `~NULLSET X`]); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + +(* This part is harder than the previous *) + (REWRITE_TAC[dihu3]); + (NEW_GOAL `?v0 v1 v2 v3. ul' = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `u0 = v0:real^3`); + (NEW_GOAL`u0 = HD [u0;u2:real^3]`); + (REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[ASSUME `u0 = HD[u0;u2:real^3]`]); + (REWRITE_WITH `v0:real^3 = HD ul'`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `[u0;u2:real^3] = truncate_simplex 1 ul'`); + (NEW_GOAL `[u0;u2:real^3] = truncate_simplex (LENGTH [u0;u2] - 1) ul' /\ + LENGTH [u0;u2] <= LENGTH ul'`); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_IMP_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH; ARITH_RULE `SUC(SUC(0)) - 1 = 1`]); + (MESON_TAC[]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `u2 = v1:real^3`); + (NEW_GOAL`u2 = EL 1 [u0;u2:real^3]`); + (REWRITE_TAC[EL; ARITH_RULE `1 = SUC 0`; TL; HD]); + (ONCE_REWRITE_TAC[ASSUME `u2 = EL 1 [u0;u2:real^3]`]); + + (REWRITE_WITH `v1:real^3 = EL 1 ul'`); + (ASM_REWRITE_TAC[EL; ARITH_RULE `1 = SUC 0`; TL; HD]); + (REWRITE_WITH `[u0;u2:real^3] = truncate_simplex 1 ul'`); + (NEW_GOAL `[u0;u2:real^3] = truncate_simplex (LENGTH [u0;u2] - 1) ul' /\ + LENGTH [u0;u2] <= LENGTH ul'`); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_IMP_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH; ARITH_RULE `SUC(SUC(0)) - 1 = 1`]); + (MESON_TAC[]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `{u0,u1,u2:real^3} = {v0,v1,v2}`); + (REWRITE_TAC[GSYM set_of_list]); + (REWRITE_WITH `[u0; u1; u2:real^3] = truncate_simplex (3 - 1) ul`); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_WITH `set_of_list (truncate_simplex (3 - 1) ul) = + V INTER (mcell 3 V ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (REWRITE_WITH `mcell 3 V ul = X`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3 /\ 3 <= 4`]); + (REWRITE_WITH `mcell 3 V ul = X`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `X = mcell 3 V ul'`); + (ASM_MESON_TAC[]); + (REWRITE_WITH `[v0; v1; v2:real^3] = truncate_simplex (3 - 1) ul'`); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (REWRITE_WITH `mcell 3 V ul' = X`); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3 /\ 3 <= 4`]); + + (NEW_GOAL `u1:real^3 = v2`); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ + ~(u1 = u2) /\ ~(u1 = u3) /\ ~(u2 = u3:real^3)` + THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "S2" THEN EXPAND_TAC "S1" THEN SET_TAC[]); + + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]); + (REWRITE_WITH `mxi V [v0; v1; v2; v3] = s`); + (EXPAND_TAC "s"); + (MATCH_MP_TAC Marchal_cells_3.MCELL_ID_MXI_2); + (EXISTS_TAC `3` THEN EXISTS_TAC `3`); + (REWRITE_TAC[GSYM (ASSUME `ul' = [v0; v1; v2; v3:real^3]`)]); + (REWRITE_WITH `mcell 3 V ul' = X`); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[SET_RULE `3 IN {2,3}`]); + (REWRITE_TAC[GSYM (ASSUME `u0 = v0:real^3`); + GSYM (ASSUME `u2 = v1:real^3`); + GSYM (ASSUME `u1 = v2:real^3`)]); + (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6"); + + (REWRITE_WITH + `dih_y (dist (u0,u2)) (dist (u0,u1)) sqrt2 sqrt2 sqrt2 (dist (u1,u2)) = + dih_y (dist (u0,u2)) (dist (u0,u1)) (dist (u0,s)) + (dist (u1,s)) (dist (u2,s)) (dist (u2,u1:real^3))`); + (REWRITE_WITH `dist (u1,s) = dist (s,u1:real^3) /\ + dist (u2,s) = dist (s,u2) /\ dist (s,u0) = dist (u0,s)`); + (REWRITE_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[DIST_SYM; sqrt2]); + + (GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] DIHV_EQ_DIH_Y)); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u0,u2,u1,s} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u1:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u0,u2,s,u1} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (NEW_GOAL `F`); + (NEW_GOAL `V INTER (X:real^3->bool) = set_of_list (truncate_simplex (3 - 1) ul)`); + (REWRITE_TAC[ASSUME `X = mcell 3 V ul`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3 /\ 3 <= 4`]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[]); + + (ASM_CASES_TAC `k = 1`); + (REWRITE_WITH `V INTER (X:real^3->bool) = + set_of_list (truncate_simplex (k - 1) ul')`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 1 /\ 1 <= 4`]); + (REWRITE_WITH `mcell 1 V ul' = X`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 1`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ARITH_RULE `1 - 1 = 0`; ASSUME `k = 1`]); + (REWRITE_WITH `truncate_simplex 0 (ul':(real^3)list) = [HD ul']`); + (MATCH_MP_TAC Packing3.TRUNCATE_0_EQ_HEAD); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; + TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; HD]); + + (UNDISCH_TAC `~(u0 = u1) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ + ~(u1 = u2) /\ ~(u1 = u3) /\ ~(u2 = u3:real^3)`); + (EXPAND_TAC "S2" THEN EXPAND_TAC "S1" THEN SET_TAC[]); + (NEW_GOAL `k = 0`); + (ASM_ARITH_TAC); + + (REWRITE_WITH `V INTER X = {}:real^3->bool`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 0`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; + TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (NEW_GOAL `u0 IN {u0,u1,u2:real^3}`); + (SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + +(* ========================================================================= *) + + (NEW_GOAL `dihX V X (u1,u2) = dih_y y4 y5 sqrt2 sqrt2 sqrt2 y6`); + (REWRITE_TAC[dihX]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (LET_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[cell_params_d]); + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u1; u2] ul)`); + (STRIP_TAC); + (NEW_GOAL `(P:num#(real^3)list->bool) ((@) P)`); + (MATCH_MP_TAC SELECT_AX); + + (ABBREV_TAC `wl = [u1;u2;u0;u3:real^3]`); + (NEW_GOAL `?p. p permutes 0..2 /\ + wl:(real^3)list = left_action_list p ul`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "wl"); + (MATCH_MP_TAC Marchal_cells_3.LEFT_ACTION_LIST_2_EXISTS); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "S2" THEN EXPAND_TAC "S1" THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `barV V 3 wl`); + (MATCH_MP_TAC Qzksykg.QZKSYKG1); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `3` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[SET_RULE `3 IN {0,1,2,3,4}`; ARITH_RULE `3 - 1 = 2`]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `(3, wl:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (ASM_REWRITE_TAC[IN; ARITH_RULE `3 <= 4`]); + (STRIP_TAC); + + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Rvfxzbu.RVFXZBU); + (ASM_REWRITE_TAC[SET_RULE `3 IN {0,1,2,3,4}`; ARITH_RULE `3 - 1 = 2`]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_TAC[GSYM (ASSUME `wl:(real^3)list = left_action_list p ul`)]); + (EXPAND_TAC "wl"); + (REWRITE_WITH `[u1; u2; u0; u3] = APPEND [u1; u2] [u0; u3:real^3]`); + (REWRITE_TAC[APPEND]); + (REWRITE_TAC[Packing3.INITIAL_SUBLIST_APPEND]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN]); + + (REPEAT STRIP_TAC); + + (ASM_CASES_TAC `2 <= k`); + (NEW_GOAL `k = 3`); + + (NEW_GOAL `3 = k /\ + (!t. 3 - 1 <= t /\ t <= 3 + ==> omega_list_n V ul t = omega_list_n V ul' t)`); + (MATCH_MP_TAC Marchal_cells_3.MCELL_ID_OMEGA_LIST_N); + (ASM_REWRITE_TAC[SET_RULE `x IN {2,3,4} <=> x=2\/x=3\/x=4`]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (REWRITE_WITH `mcell 3 V ul = X`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `~NULLSET X`]); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + +(* This part is harder than the previous *) + (REWRITE_TAC[dihu3]); + (NEW_GOAL `?v0 v1 v2 v3. ul' = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC Marchal_cells.BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `u1 = v0:real^3`); + (NEW_GOAL`u1 = HD [u1;u2:real^3]`); + (REWRITE_TAC[HD]); + (ONCE_REWRITE_TAC[ASSUME `u1 = HD[u1;u2:real^3]`]); + (REWRITE_WITH `v0:real^3 = HD ul'`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_WITH `[u1;u2:real^3] = truncate_simplex 1 ul'`); + (NEW_GOAL `[u1;u2:real^3] = truncate_simplex (LENGTH [u1;u2] - 1) ul' /\ + LENGTH [u1;u2] <= LENGTH ul'`); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_IMP_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH; ARITH_RULE `SUC(SUC(0)) - 1 = 1`]); + (MESON_TAC[]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `u2 = v1:real^3`); + (NEW_GOAL`u2 = EL 1 [u1;u2:real^3]`); + (REWRITE_TAC[EL; ARITH_RULE `1 = SUC 0`; TL; HD]); + (ONCE_REWRITE_TAC[ASSUME `u2 = EL 1 [u1;u2:real^3]`]); + + (REWRITE_WITH `v1:real^3 = EL 1 ul'`); + (ASM_REWRITE_TAC[EL; ARITH_RULE `1 = SUC 0`; TL; HD]); + (REWRITE_WITH `[u1;u2:real^3] = truncate_simplex 1 ul'`); + (NEW_GOAL `[u1;u2:real^3] = truncate_simplex (LENGTH [u1;u2] - 1) ul' /\ + LENGTH [u1;u2] <= LENGTH ul'`); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_IMP_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH; ARITH_RULE `SUC(SUC(0)) - 1 = 1`]); + (MESON_TAC[]); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `{u0,u1,u2:real^3} = {v0,v1,v2}`); + (REWRITE_TAC[GSYM set_of_list]); + (REWRITE_WITH `[u0; u1; u2:real^3] = truncate_simplex (3 - 1) ul`); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_WITH `set_of_list (truncate_simplex (3 - 1) ul) = + V INTER (mcell 3 V ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (REWRITE_WITH `mcell 3 V ul = X`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3 /\ 3 <= 4`]); + (REWRITE_WITH `mcell 3 V ul = X`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `X = mcell 3 V ul'`); + (ASM_MESON_TAC[]); + (REWRITE_WITH `[v0; v1; v2:real^3] = truncate_simplex (3 - 1) ul'`); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (REWRITE_WITH `mcell 3 V ul' = X`); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3 /\ 3 <= 4`]); + + (NEW_GOAL `u0:real^3 = v2`); + (UP_ASM_TAC THEN UNDISCH_TAC `~(u0 = u1) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ + ~(u1 = u2) /\ ~(u1 = u3) /\ ~(u2 = u3:real^3)` + THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "S2" THEN EXPAND_TAC "S1" THEN SET_TAC[]); + + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]); + (REWRITE_WITH `mxi V [v0; v1; v2; v3] = s`); + (EXPAND_TAC "s"); + (MATCH_MP_TAC Marchal_cells_3.MCELL_ID_MXI_2); + (EXISTS_TAC `3` THEN EXISTS_TAC `3`); + (REWRITE_TAC[GSYM (ASSUME `ul' = [v0; v1; v2; v3:real^3]`)]); + (REWRITE_WITH `mcell 3 V ul' = X`); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[SET_RULE `3 IN {2,3}`]); + (REWRITE_TAC[GSYM (ASSUME `u1 = v0:real^3`); + GSYM (ASSUME `u2 = v1:real^3`); + GSYM (ASSUME `u0 = v2:real^3`)]); + (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6"); + (ONCE_REWRITE_TAC[DIHV_SYM]); + (REWRITE_WITH + `dih_y (dist (u1,u2)) (dist (u0,u2)) sqrt2 sqrt2 sqrt2 (dist (u0,u1)) = + dih_y (dist (u2,u1)) (dist (u2,u0)) (dist (u2,s)) + (dist (u0,s)) (dist (u1,s)) (dist (u1,u0:real^3))`); + (REWRITE_WITH `dist (u1,s) = dist (s,u1:real^3) /\ + dist (u2,s) = dist (s,u2) /\ dist (s,u0) = dist (u0,s)`); + (REWRITE_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[DIST_SYM; sqrt2]); + + (GMATCH_SIMP_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] DIHV_EQ_DIH_Y)); + (STRIP_TAC); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `s:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u2,u1,u0,s} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `u0:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u2,u1,s,u0} = {u0,u1,u2,s}`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (NEW_GOAL `F`); + (NEW_GOAL `V INTER (X:real^3->bool) = set_of_list (truncate_simplex (3 - 1) ul)`); + (REWRITE_TAC[ASSUME `X = mcell 3 V ul`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3 /\ 3 <= 4`]); + (REWRITE_WITH `mcell 3 V [u0; u1; u2; u3] = X`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[]); + + (ASM_CASES_TAC `k = 1`); + (REWRITE_WITH `V INTER (X:real^3->bool) = + set_of_list (truncate_simplex (k - 1) ul')`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 1 /\ 1 <= 4`]); + (REWRITE_WITH `mcell 1 V ul' = X`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 1`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[ARITH_RULE `1 - 1 = 0`; ASSUME `k = 1`]); + (REWRITE_WITH `truncate_simplex 0 (ul':(real^3)list) = [HD ul']`); + (MATCH_MP_TAC Packing3.TRUNCATE_0_EQ_HEAD); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1`); + (MATCH_MP_TAC Marchal_cells_3.BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; + TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; HD]); + (UNDISCH_TAC `~(u0 = u1) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ + ~(u1 = u2) /\ ~(u1 = u3) /\ ~(u2 = u3:real^3)`); + (EXPAND_TAC "S2" THEN EXPAND_TAC "S1" THEN SET_TAC[]); + (NEW_GOAL `k = 0`); + (ASM_ARITH_TAC); + + (REWRITE_WITH `V INTER X = {}:real^3->bool`); + (REWRITE_TAC[ASSUME `X = mcell k V ul'`; ASSUME `k = 0`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; + TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (NEW_GOAL `u0 IN {u0,u1,u2:real^3}`); + (SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (REWRITE_TAC[ASSUME `dihX V X (u0,u1) = dih_y y6 y4 sqrt2 sqrt2 sqrt2 y5`]); + (REWRITE_TAC[ASSUME `dihX V X (u0,u2) = dih_y y5 y6 sqrt2 sqrt2 sqrt2 y4`]); + (REWRITE_TAC[ASSUME `dihX V X (u1,u2) = dih_y y4 y5 sqrt2 sqrt2 sqrt2 y6`]); + +(* ======================================================================== *) + + (MATCH_MP_TAC ( + REAL_ARITH `(a:real) = x /\ b = y /\ c = z ==> (a - b + c = x - (y - z))`)); + (REPEAT STRIP_TAC); + (REFL_TAC); + (AP_TERM_TAC); + (REAL_ARITH_TAC); + (AP_TERM_TAC); + + (NEW_GOAL `edgeX V X = {{u0,u1:real^3}, {u0,u2}, {u1,u2}}`); + (REWRITE_TAC[edgeX]); + (ONCE_REWRITE_TAC[SET_EQ_LEMMA]); + (REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `VX V X u` THEN UNDISCH_TAC `VX V X v`); + (REWRITE_TAC[MESON[IN] `VX V X s <=> s IN VX V X`]); + (REWRITE_TAC[ASSUME `VX V X = {u0,u1,u2}`; + SET_RULE `v IN {u0, u1, u2} <=> v=u0 \/ v = u1 \/ v = u2`]); + (REPEAT STRIP_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + (SET_TAC[]); + (ASM_REWRITE_TAC[] THEN SET_TAC[]); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + (SET_TAC[]); + + (REWRITE_TAC[ASSUME `x = {u, v:real^3}`; ASSUME `u = u2:real^3`; + ASSUME `v = u0:real^3`] THEN SET_TAC[]); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + (SET_TAC[]); + (REWRITE_TAC[ASSUME `x = {u, v:real^3}`; ASSUME `u = u0:real^3`; + ASSUME `v = u1:real^3`] THEN SET_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_WITH `{u,v} = {v,u:real^3}`); + (SET_TAC[]); + (REWRITE_TAC[ASSUME `x = {u, v:real^3}`; ASSUME `u = u2:real^3`; + ASSUME `v = u1:real^3`] THEN SET_TAC[]); + (REWRITE_TAC[ASSUME `x = {u, v:real^3}`; ASSUME `u = u0:real^3`; + ASSUME `v = u2:real^3`] THEN SET_TAC[]); + (REWRITE_TAC[ASSUME `x = {u, v:real^3}`; ASSUME `u = u1:real^3`; + ASSUME `v = u2:real^3`] THEN SET_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (UP_ASM_TAC THEN REWRITE_TAC[SET_RULE `x IN {a,b,c} <=> x=a\/x=b\/x=c`]); + (REWRITE_TAC[MESON[IN] `VX V X s <=> s IN VX V X`]); + (REWRITE_TAC[ASSUME `VX V X = {u0,u1,u2:real^3}`; + SET_RULE `v IN {u0, u1, u2} <=> v = u0 \/ v = u1 \/ v = u2`]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u2:real^3` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN ASM_REWRITE_TAC[]); + + (ABBREV_TAC `f = + (\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)`); + (REWRITE_TAC[ASSUME `edgeX V X = {{u0, u1}, {u0, u2}, {u1, u2}}`]); + + (ABBREV_TAC `H2 = {{u0, u2}, {u1, u2:real^3}}`); + (REWRITE_WITH `sum ({u0,u1:real^3} INSERT H2) f = + (if {u0,u1} IN H2 then sum H2 f else f {u0,u1} + sum H2 f)`); + (MATCH_MP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt); + (EXPAND_TAC "H2"); + (REWRITE_TAC[Geomdetail.FINITE6]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN EXPAND_TAC "H2"); + (REWRITE_TAC[SET_RULE `x IN {a,b} <=> x=a\/x=b`]); + (SET_TAC[ASSUME + `~(u0 = u1:real^3) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ ~(u1 = u2) /\ + ~(u1 = u3) /\ ~(u2 = u3)`]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (EXPAND_TAC "H2"); + (ABBREV_TAC `H1 = {{u1, u2:real^3}}`); + (REWRITE_WITH `sum ({u0,u2:real^3} INSERT H1) f = + (if {u0,u2} IN H1 then sum H1 f else f {u0,u2} + sum H1 f)`); + (MATCH_MP_TAC Marchal_cells_2_new.SUM_CLAUSES_alt); + (EXPAND_TAC "H1"); + (REWRITE_TAC[Geomdetail.FINITE6]); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN EXPAND_TAC "H1"); + (REWRITE_TAC[SET_RULE `x IN {a} <=> x=a`]); + (SET_TAC[ASSUME + `~(u0 = u1:real^3) /\ ~(u0 = u2) /\ ~(u0 = u3) /\ ~(u1 = u2) /\ + ~(u1 = u3) /\ ~(u2 = u3)`]); + (UP_ASM_TAC THEN MESON_TAC[]); + (EXPAND_TAC "H1" THEN REWRITE_TAC[SUM_SING]); + + (REWRITE_WITH `f {u0, u1:real^3} = + lmfun (y6 / &2) * dih_y y6 y4 sqrt2 sqrt2 sqrt2 y5`); + (EXPAND_TAC "f"); + + (ABBREV_TAC `g = (\u v. if {u, v:real^3} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)`); + (REWRITE_WITH `(\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0) = (\({u, v:real^3}). g u v)`); + (EXPAND_TAC "g" THEN REWRITE_TAC[]); + (REWRITE_WITH `(\({u, v:real^3}). g u v) {u0, u1} = (g u0 u1):real`); + (MATCH_MP_TAC BETA_PAIR_THM); + (REPEAT STRIP_TAC THEN EXPAND_TAC "g" ); + (COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_WITH `dihX V X (u,v) = dihX V X (v,u)`); + (MATCH_MP_TAC Marchal_cells_3.DIHX_SYM); + (REWRITE_TAC[mcell_set; IN_ELIM_THM]); + (ASM_REWRITE_TAC[IN]); + (EXISTS_TAC `3:num` THEN EXISTS_TAC `ul:(real^3)list` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REFL_TAC); + (EXPAND_TAC "g"); + (COND_CASES_TAC); + (REWRITE_TAC[HL_2; REAL_ARITH `inv(&2) * a = a / &2`]); + (REWRITE_TAC[REAL_ARITH ` t * lmfun(s) = lmfun(s) * t`]); + (EXPAND_TAC "y6" THEN AP_TERM_TAC); + + (REWRITE_TAC[ASSUME `dist (u0,u1:real^3) = y6`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + + (REWRITE_WITH `f {u0, u2:real^3} = + lmfun (y5 / &2) * dih_y y5 y6 sqrt2 sqrt2 sqrt2 y4`); + (EXPAND_TAC "f"); + + (ABBREV_TAC `g = (\u v. if {u, v:real^3} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)`); + (REWRITE_WITH `(\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0) = (\({u, v:real^3}). g u v)`); + (EXPAND_TAC "g" THEN REWRITE_TAC[]); + (REWRITE_WITH `(\({u, v:real^3}). g u v) {u0, u2} = (g u0 u2):real`); + (MATCH_MP_TAC BETA_PAIR_THM); + (REPEAT STRIP_TAC THEN EXPAND_TAC "g" ); + (COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_WITH `dihX V X (u,v) = dihX V X (v,u)`); + (MATCH_MP_TAC Marchal_cells_3.DIHX_SYM); + (REWRITE_TAC[mcell_set; IN_ELIM_THM]); + (ASM_REWRITE_TAC[IN]); + (EXISTS_TAC `3:num` THEN EXISTS_TAC `ul:(real^3)list` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REFL_TAC); + (EXPAND_TAC "g"); + (COND_CASES_TAC); + + (REWRITE_TAC[HL_2; REAL_ARITH `inv(&2) * a = a / &2`]); + (REWRITE_TAC[REAL_ARITH ` t * lmfun(s) = lmfun(s) * t`]); + (EXPAND_TAC "y5" THEN AP_TERM_TAC); + + (REWRITE_TAC[ASSUME `dist (u0,u2:real^3) = y5`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `edgeX V X = {u0, u1} INSERT H2`]); + (EXPAND_TAC "H2" THEN SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + + (REWRITE_WITH `f {u1, u2:real^3} = + lmfun (y4 / &2) * dih_y y4 y5 sqrt2 sqrt2 sqrt2 y6`); + (EXPAND_TAC "f"); + + (ABBREV_TAC `g = (\u v. if {u, v:real^3} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)`); + (REWRITE_WITH `(\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0) = (\({u, v:real^3}). g u v)`); + (EXPAND_TAC "g" THEN REWRITE_TAC[]); + (REWRITE_WITH `(\({u, v:real^3}). g u v) {u1, u2} = (g u1 u2):real`); + (MATCH_MP_TAC BETA_PAIR_THM); + (REPEAT STRIP_TAC THEN EXPAND_TAC "g" ); + (COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_WITH `dihX V X (u,v) = dihX V X (v,u)`); + (MATCH_MP_TAC Marchal_cells_3.DIHX_SYM); + (REWRITE_TAC[mcell_set; IN_ELIM_THM]); + (ASM_REWRITE_TAC[IN]); + (EXISTS_TAC `3` THEN EXISTS_TAC `ul:(real^3)list` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (REFL_TAC); + (EXPAND_TAC "g"); + (COND_CASES_TAC); + + (REWRITE_TAC[HL_2; REAL_ARITH `inv(&2) * a = a / &2`]); + (REWRITE_TAC[REAL_ARITH ` t * lmfun(s) = lmfun(s) * t`]); + (EXPAND_TAC "y4" THEN AP_TERM_TAC); + + + (REWRITE_TAC[ASSUME `dist (u1,u2:real^3) = y4`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `edgeX V X = {u0, u1} INSERT H2`]); + (EXPAND_TAC "H2" THEN EXPAND_TAC "H1" THEN SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (REAL_ARITH_TAC); + (STRIP_TAC THEN NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[])]);; + +(* ======================================================================= *) +(* From Thomas Hales *) +(* ======================================================================= *) + +let HJKDESR1a_1cell = prove_by_refinement( + `&0 < &8 * pi * sqrt2 / &3 - &8 * mm1 `, + (* {{{ proof *) + [ + REWRITE_TAC[ arith `&8 * pi * sqrt2 / &3 = (&8 / &3) * (pi * sqrt2)`]; + MATCH_MP_TAC (arith `&3 * mm1 < z ==> &0 < (&8/ &3) * z - &8 * mm1`); + MATCH_MP_TAC REAL_LT_TRANS; + EXISTS_TAC (`&3 * #1.3`); + GMATCH_SIMP_TAC REAL_LT_LMUL_EQ; + GMATCH_SIMP_TAC REAL_LT_MUL2; + MP_TAC Flyspeck_constants.bounds; + BY(REAL_ARITH_TAC) + ]);; + + + +end;; diff --git a/text_formalization/packing/UPFZBZM.hl b/text_formalization/packing/UPFZBZM.hl new file mode 100755 index 0000000..bc2fd3d --- /dev/null +++ b/text_formalization/packing/UPFZBZM.hl @@ -0,0 +1,238 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: UPFZBZM *) +(* Chaper : Packing (Clusters) *) +(* *) +(* ========================================================================= *) + +(* ========================================================================= *) +(* FILES NEED TO BE LOADED *) +(* sum_gammaX_lmfun_estimate.hl *) +(* ========================================================================= *) + +module Upfzbzm = struct + + +open Sphere;; +open Euler_main_theorem;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Pack2;; +open Packing3;; +open Rogers;; +open Vukhacky_tactics;; +open Marchal_cells;; +open Emnwuus;; +(* open Marchal_cells_2;; *) +open Marchal_cells_2_new;; +open Urrphbz1;; +open Lepjbdj;; +open Hdtfnfz;; +open Rvfxzbu;; +open Sltstlo;; +open Urrphbz2;; +open Urrphbz3;; +open Ynhyjit;; +open Njiutiu;; +open Tezffsk;; +open Qzksykg;; +open Ddzuphj;; +open Ajripqn;; +open Qzyzmjc;; +open Upfzbzm_support_lemmas;; +open Marchal_cells_3;; +open Grutoti;; + +open Sum_gammax_lmfun_estimate;; +open Kizhltl;; + +let UPFZBZM_concl = + `!V. saturated V /\ packing V /\ cell_cluster_estimate_v1 V /\ + TSKAJXY_statement /\ + lmfun_inequality V ==> + (?G. negligible_fun_0 G V /\ fcc_compatible G V)`;; + +let FCC_COMPATABILITY_FUNC_concl = + `!V. saturated V /\ packing V /\ cell_cluster_estimate_v1 V /\ + TSKAJXY_statement /\ + lmfun_inequality V /\ G = (\u. --vol(voronoi_open V u) + + &8 * mm1 - &8 * mm2 * sum { v | v IN V /\ ~(u=v) /\ dist(u,v) <= &2*h0 } + (\v. lmfun (hl [u;v]))) + ==> fcc_compatible G V`;; + +let NEGLIGIBLE_FUNC_concl = + `!V. saturated V /\ + packing V /\ + cell_cluster_estimate_v1 V /\ + TSKAJXY_statement /\ + lmfun_inequality V /\ + G = + (\u. --vol (voronoi_open V u) + + &8 * mm1 - + &8 * + mm2 * + sum {v | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v]))) + ==> negligible_fun_0 G V`;; + +(* ========================================================================= *) +(* THE THEOREM *) +(* ========================================================================= *) + +(* PART 1 OF THE LEMMA *) + +let FCC_COMPATABILITY_FUNC = prove_by_refinement ( + FCC_COMPATABILITY_FUNC_concl, +[(REWRITE_TAC[lmfun_inequality;fcc_compatible]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[Pack2.MEASURE_VORONOI_CLOSED_OPEN]); + (ASM_REWRITE_TAC[REAL_ARITH `a + --a + b - c = b - c`]); + (MATCH_MP_TAC (REAL_ARITH + `x = &8 * mm1 - &8 * (&12 * mm2) /\ y <= &8 * (&12 * mm2) ==> + x <= &8 * mm1 - y`)); + (STRIP_TAC); + (REWRITE_TAC[SQRT_OF_32_lemma]); + (REWRITE_TAC[REAL_ARITH `a * b - a * c = a * (b - c)`]); + (REWRITE_TAC[m1_minus_12m2]); + (MATCH_MP_TAC REAL_LE_LMUL); + (REWRITE_TAC[REAL_ARITH `&0 <= &8`]); + (REWRITE_TAC[REAL_ARITH `&12 * mm2 = mm2 * &12`]); + (MATCH_MP_TAC REAL_LE_LMUL); + (REWRITE_TAC[ZERO_LE_MM2_LEMMA]); + (ASM_MESON_TAC[])]);; + + + +(* ========================================================================= *) +(* PART 2 OF THE LEMMA *) +(* ========================================================================= *) + +let NEGLIGIBLE_FUNC = prove_by_refinement ( + NEGLIGIBLE_FUNC_concl, +[(REWRITE_TAC[negligible_fun_0; negligible_fun_any_C]); + (REPEAT STRIP_TAC); + + (MP_TAC (SPEC `V:real^3->bool` KIZHLTL1)); + (STRIP_TAC); + (MP_TAC (SPEC `V:real^3->bool` KIZHLTL2)); + (STRIP_TAC); + (MP_TAC (SPEC `V:real^3->bool` KIZHLTL4)); + (STRIP_TAC); + + (MP_TAC (SPEC `V:real^3->bool` SUM_GAMMAX_LMFUN_ESTIMATE)); + (STRIP_TAC); + + (NEW_GOAL + `!r. saturated V /\ packing V /\ &1 <= r + ==> c''' * r pow 2 <= + sum {X | X SUBSET ball (vec 0,r) /\ mcell_set V X} + (\X. gammaX V X lmfun)`); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[gammaX] THEN STRIP_TAC); + + (EXISTS_TAC `--c''' - c - c' - c''`); + (REPEAT STRIP_TAC); + + (ABBREV_TAC `f1 = (\u:real^3. --vol (voronoi_open V u))`); + (ABBREV_TAC `f2 = (\u:real^3. &8 * mm1 - &8 * mm2 * + sum {v | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v])))`); + (REWRITE_WITH `sum ((V:real^3->bool) INTER ball (vec 0,r)) G = + sum (V INTER ball (vec 0,r)) f1 + + sum (V INTER ball (vec 0,r)) f2`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "f1" THEN EXPAND_TAC "f2"); + (MATCH_MP_TAC SUM_ADD); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (ABBREV_TAC `f3 = (\u:real^3. &8 * mm1)`); + (ABBREV_TAC `f4 = (\u:real^3. &8 * mm2 * + sum {v | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v])))`); + (REWRITE_WITH `sum ((V:real^3->bool) INTER ball (vec 0,r)) f2 = + sum (V INTER ball (vec 0,r)) f3 - + sum (V INTER ball (vec 0,r)) f4`); + (EXPAND_TAC "f2" THEN EXPAND_TAC "f3" THEN EXPAND_TAC "f4"); + (MATCH_MP_TAC SUM_SUB); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (EXPAND_TAC "f4" THEN DEL_TAC THEN + ASM_SIMP_TAC[SUM_NEG;SUM_CONST;SUM_LMUL;FINITE_PACK_LEMMA]); + (ABBREV_TAC `f5 = (\u:real^3. + sum {v | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v])))`); + (ABBREV_TAC `B = {X | X SUBSET ball (vec 0, r) /\ mcell_set V X}`); + (ABBREV_TAC `T1 = sum B vol`); + (ABBREV_TAC `T2 = --(&2 * mm1 / pi) * sum B (total_solid V)`); + (ABBREV_TAC `T3 = (&8 * mm2 / pi) * sum B (\X. sum (edgeX V X) + (\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0))`); + + (NEW_GOAL `sum (V:real^3->bool INTER ball (vec 0,r)) f1 <= --T1 - c * r pow 2`); + (EXPAND_TAC "T1" THEN EXPAND_TAC "B"); + (EXPAND_TAC "f1"); + (REWRITE_TAC[SUM_NEG; REAL_ARITH `-- a <= --b - c <=> b + c <= a`]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL + `sum (V:real^3->bool INTER ball (vec 0,r)) f3 <= --T2 - c' * r pow 2`); + (EXPAND_TAC "T2" THEN EXPAND_TAC "B"); + (EXPAND_TAC "f3"); + (REWRITE_TAC[SUM_NEG; REAL_ARITH `a <= --(-- b * d) - c<=> a + c <= b * d`]); + (REWRITE_WITH `sum (V INTER ball (vec 0,r)) (\u:real^3. &8 * mm1) = + &(CARD (V INTER ball (vec 0,r))) * (&8 * mm1)`); + (MATCH_MP_TAC SUM_CONST); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `T3 + c'' * r pow 2 <= + &8 * mm2 * sum (V:real^3->bool INTER ball (vec 0,r)) f5`); + (EXPAND_TAC "T3" THEN EXPAND_TAC "B"); + + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC (REAL_ARITH `(?s. A <= s /\ s <= b) ==> A <= b`)); + (EXISTS_TAC `--T1 + --T2 + --T3 - (c + c' + c'') * r pow 2`); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH + `--T1 + --T2 + --T3 - (c + c' + c'') * r pow 2 <= + (--c''' - c - c' - c'') * r pow 2 + <=> c''' * r pow 2 <= T1 + T2 + T3`]); + (REWRITE_WITH `T1 + T2 + T3 = + sum {X | X SUBSET ball (vec 0,r) /\ mcell_set V X} + (\X. gammaX V X lmfun)`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[gammaX]); + (NEW_GOAL `FINITE (B:(real^3->bool)->bool)`); + (EXPAND_TAC "B"); + (ASM_SIMP_TAC [FINITE_MCELL_SET_LEMMA]); + (ASM_SIMP_TAC[SUM_ADD; SUM_SUB; SUM_LMUL; ETA_AX]); + (EXPAND_TAC "T2"); + (REAL_ARITH_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[])]);; + + +(* ========================================================================= *) +(* Main theorm *) +(* ========================================================================= *) + +let UPFZBZM = prove (UPFZBZM_concl, + (REPEAT STRIP_TAC) THEN (ABBREV_TAC `G = (\u. --vol (voronoi_open V u) + + &8 * mm1 - + &8 * + mm2 * + sum {v:real^3 | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0} + (\v. lmfun (hl [u; v])))`) THEN + (EXISTS_TAC `G:real^3->real`) THEN + (ASM_MESON_TAC[NEGLIGIBLE_FUNC;FCC_COMPATABILITY_FUNC]));; + + +end;; diff --git a/text_formalization/packing/UPFZBZM_support_lemmas.hl b/text_formalization/packing/UPFZBZM_support_lemmas.hl new file mode 100755 index 0000000..5f0c663 --- /dev/null +++ b/text_formalization/packing/UPFZBZM_support_lemmas.hl @@ -0,0 +1,399 @@ + + +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: UPFZBZM *) +(* Chaper : Packing (Clusters) *) +(* Date : October 3, 2010 *) +(* *) +(* ========================================================================= *) + +(* ========================================================================= *) +(* Supporting lemmas for UPFZBZM *) +(* Chaper : Packing (Clusters) *) +(* *) +(* ========================================================================= *) + +(* ========================================================================= *) +(* FILES NEED TO BE LOADED *) +(* ========================================================================= *) + +flyspeck_needs "jordan/refinement.hl";; +flyspeck_needs "jordan/hash_term.hl";; +flyspeck_needs "jordan/parse_ext_override_interface.hl";; +flyspeck_needs "jordan/real_ext.hl";; +flyspeck_needs "jordan/lib_ext.hl";; +flyspeck_needs "jordan/tactics_jordan.hl";; +flyspeck_needs "jordan/num_ext_nabs.hl";; +flyspeck_needs "jordan/taylor_atn.hl";; +flyspeck_needs "jordan/float.hl";; +flyspeck_needs "jordan/flyspeck_constants.hl";; +(* flyspeck_needs "packing/lemma_negligible.hl";; *) + +flyspeck_needs "nonlinear/vukhacky_tactics.hl";; +flyspeck_needs "packing/pack_defs.hl";; +flyspeck_needs "packing/pack_concl.hl";; +(* flyspeck_needs "packing/beta_pair_thm.hl";; *) + +module Upfzbzm_support_lemmas = struct + +open Flyspeck_constants;; +open Pack_defs;; +open Pack_concl;; +open Vukhacky_tactics;; + + +let CHANGED_SET_TAC = +let basicthms = +[NOT_IN_EMPTY; IN_UNIV; IN_UNION; IN_INTER; IN_DIFF; IN_INSERT; +IN_DELETE; IN_REST; IN_INTERS; IN_UNIONS; IN_IMAGE] in +let allthms = basicthms @ map (REWRITE_RULE[IN]) basicthms @ +[IN_ELIM_THM; IN] in +let PRESET_TAC = +TRY(POP_ASSUM_LIST(MP_TAC o end_itlist CONJ)) THEN +REPEAT COND_CASES_TAC THEN +REWRITE_TAC[EXTENSION; SUBSET; PSUBSET; DISJOINT; SING] THEN +REWRITE_TAC allthms in +fun ths -> +PRESET_TAC THEN +(if ths = [] then ALL_TAC else MP_TAC(end_itlist CONJ ths)) THEN +MESON_TAC[];; + +let CHANGED_SET_RULE tm = prove(tm,CHANGED_SET_TAC[]);; + +(*-------------------------------------------------------------------------- *) + +(* + let UPFZBZM_concl = + `!V. saturated V /\ packing V /\ cell_cluster_estimate_v1 V /\ + marchal_inequality /\ + lmfun_inequality V ==> + (?G. negligible_fun_0 G V /\ fcc_compatible G V)`;; +*) + +(* ------------------------------------------------------------------------- *) + +(* +let SUM_GAMMAX_LMFUN_ESTIMATE_concl = + `!V. ?c. !r. saturated V /\ packing V /\ &1 <= r /\ + cell_cluster_estimate_v1 V /\ marchal_inequality /\ + lmfun_inequality V ==> + c * r pow 2 <= sum {X | X SUBSET ball (vec 0, r) /\ mcell_set V X} + (\X. gammaX V X lmfun)`;; +*) + +let KIZHLTL3_new_concl = + `!V. ?c. !r. saturated V /\ + packing V /\ + &1 <= r + ==> (&8 * mm2 / pi) * + sum {X | X SUBSET ball (vec 0,r) /\ mcell_set V X} + (\X. sum (edgeX V X) + (\({u, v}). dihX V X (u,v) * lmfun (hl [u; v]))) + + c * r pow 2 <= + &8 * mm2 * + sum (V INTER ball (vec 0,r)) + (\u. sum + {v | v IN V /\ ~(u = v) /\ dist (u,v) <= &2 * h0 } + (\v. lmfun (hl [u; v])))`;; + +(* ========================================================================= *) +(* SOME COMPLEMENTARY LEMMAS *) +(* ========================================================================= *) +(* ========================================================================= *) + +let tau0_not_zero = prove_by_refinement ( + `~(tau0 = &0)`, +[(SUBGOAL_THEN `#1.54065 < tau0` ASSUME_TAC); + (REWRITE_TAC[bounds]); + (STRIP_TAC); + (ASM_MESON_TAC[REAL_ARITH `~(#1.54065 < &0)`])]);; + +(* ========================================================================= *) + +let ZERO_LT_MM2_LEMMA = prove_by_refinement ( `&0 < mm2`, +[(SUBGOAL_THEN `#0.02541 < mm2` ASSUME_TAC); + (REWRITE_TAC[bounds]); + (ASM_REAL_ARITH_TAC)]);; + +(* ========================================================================= *) + +let FINITE_PACK_LEMMA = Packing3.KIUMVTC;; + +let FINITE_PERMUTE_3 = prove_by_refinement + (`FINITE {p | p permutes {0, 1, 2}}`, + [MATCH_MP_TAC FINITE_PERMUTATIONS THEN MESON_TAC[FINITE_RULES]]);; +let FINITE_PERMUTE_4 = prove_by_refinement + (`FINITE {p | p permutes {0, 1, 2, 3}}`, + [MATCH_MP_TAC FINITE_PERMUTATIONS THEN MESON_TAC[FINITE_RULES]]);; + +(* Lemma 1 *) + + let john_harrison_lemma1 = prove + (`(\(x,y). P x y) = (\p. P (FST p) (SND p))`, + REWRITE_TAC[FUN_EQ_THM; FORALL_PAIR_THM]);; + + let john_harrison_lemma2 = MESON[] `(?x. P x) /\ (@x. P x) = a ==> P a`;; + + let JOHN_SELECT_THM = prove + (`(?x y. P x /\ Q y /\ R x y) /\ + (@(x,y). P x /\ Q y /\ R x y) = (a,b) + ==> P a /\ Q b /\ R a b`, + REWRITE_TAC[GSYM EXISTS_PAIRED_THM] THEN + REWRITE_TAC[john_harrison_lemma1] THEN + DISCH_THEN(MP_TAC o MATCH_MP john_harrison_lemma2) THEN + REWRITE_TAC[FST; SND]);; + +(* ------------------------------------------------------------------------- *) +(* Lemma 2 *) + +let SQRT_RULE_Euler_lemma = prove + (`!x y. x pow 2 = y /\ &0 <= x ==> x = sqrt y`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[GSYM (ASSUME `x pow 2 = y`);REAL_POW_2] THEN + ASM_SIMP_TAC[SQRT_MUL] THEN + ASM_MESON_TAC[GSYM REAL_POW_2;SQRT_POW_2]);; + +let SQRT_OF_32_lemma = prove_by_refinement ( + `sqrt (&32) = &8 * sqrt (&1 / &2)`, + [ (REWRITE_WITH `&8 = sqrt (&64)`); + (MATCH_MP_TAC SQRT_RULE_Euler_lemma); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&32 = &64 * (&1 / &2)`]); + (MATCH_MP_TAC SQRT_MUL); + (REAL_ARITH_TAC)]);; + +(* ------------------------------------------------------------------------- *) +(* Lemma 3 *) + +let m1_minus_12m2 = prove_by_refinement ( + `mm1 - &12 * mm2 = sqrt (&1 / &2)`, + +[ (REWRITE_TAC[mm1;mm2]); + (REWRITE_TAC [REAL_ARITH `a * (b / c) = (a * b) / c`]); + (REWRITE_WITH + `&12 * (&6 * sol0 - pi) * sqrt (&2) = ((&6 * sol0 - pi) * sqrt (&8)) * &6`); + (REWRITE_TAC[REAL_ARITH`&12 * a * b = (a * &2 * b) * &6`]); + (MATCH_MP_TAC (MESON[REAL_EQ_MUL_RCANCEL] `a = b ==> a * x = b * x`)); + (MATCH_MP_TAC (MESON[REAL_EQ_MUL_LCANCEL] `a = b ==> x * a = x * b`)); + + (REWRITE_TAC[REAL_ARITH `&8 = &4 * &2`]); + (REWRITE_WITH `sqrt (&4 * &2) = sqrt (&4) * sqrt (&2)`); + (MATCH_MP_TAC SQRT_MUL); + (REAL_ARITH_TAC); + (MATCH_MP_TAC (MESON[REAL_EQ_MUL_RCANCEL] `a = b ==> a * x = b * x`)); + (MATCH_MP_TAC SQRT_RULE_Euler_lemma); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `(m * &6) / (&6 * tau0) = m * &6 / (tau0 * &6)`]); + (REWRITE_WITH `((&6 * sol0 - pi) * sqrt (&8)) * &6 / (tau0 * &6) = + ((&6 * sol0 - pi) * sqrt (&8)) / tau0`); + (MATCH_MP_TAC REDUCE_WITH_DIV_Euler_lemma); + (REWRITE_TAC[REAL_ARITH `~(&6 = &0)`;tau0_not_zero]); + + (REWRITE_TAC[REAL_ARITH `a / b - c / b = (a - c) / b`]); + (REWRITE_TAC[REAL_ARITH `a * x - b * x = (a - b) * x`]); + (REWRITE_WITH `sol0 - (&6 * sol0 - pi) = tau0 / &4`); + (REWRITE_TAC[tau0]); + (REAL_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH + `(tau0 / &4 * x) / tau0 = (tau0 / tau0) * (x / &4)`]); + (REWRITE_WITH `sqrt (&8) / &4 = sqrt (&1 / &2)`); + (REWRITE_TAC[REAL_ARITH `&1 / &2 = &8 / &16`]); + (REWRITE_WITH `sqrt (&8 / &16) = sqrt (&8) / sqrt (&16)`); + (MATCH_MP_TAC SQRT_DIV THEN REAL_ARITH_TAC); + (REWRITE_WITH `sqrt (&16) = &4`); + + (MATCH_MP_TAC (MESON[] `a = b ==> b = a`)); + (MATCH_MP_TAC SQRT_RULE_Euler_lemma THEN REAL_ARITH_TAC); + (MATCH_MP_TAC (MESON[REAL_MUL_LID] `x = &1 ==> x * y = y`)); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[tau0_not_zero])]);; + + +(* ------------------------------------------------------------------------- *) +(* Lemma 4 *) + +let ZERO_LE_MM2_LEMMA = + MATCH_MP (REAL_ARITH `&0 < x ==> &0 <= x`) ZERO_LT_MM2_LEMMA;; + +(* ------------------------------------------------------------------------- *) +(* Lemma 5 *) + +let FINITE_edgeX = prove_by_refinement ( + `!V X. FINITE (edgeX V X)`, +[(REPEAT GEN_TAC THEN REWRITE_TAC[edgeX;VX]); + (COND_CASES_TAC); +(* Break into 2 subgoal *) + +(REWRITE_WITH `{{u:real^3, v} | {} u /\ {} v /\ ~(u = v)} = {}`); +(* New Subgoal 1.1 *) +(CHANGED_SET_TAC[]); (* End subgoal 1.1 *) +(MESON_TAC[FINITE_CASES]); (* End Subgoal 1 *) +(REPEAT LET_TAC); +(SUBGOAL_THEN + `FINITE (set_of_list (truncate_simplex (k - 1) (ul:(real^3)list)))` + ASSUME_TAC); +(REWRITE_TAC[FINITE_SET_OF_LIST]); +(ABBREV_TAC `S = set_of_list (truncate_simplex (k - 1) (ul:(real^3)list))`); +(MATCH_MP_TAC FINITE_SUBSET); +(EXISTS_TAC `{t:real^3->bool | t SUBSET S}`); +(STRIP_TAC); +(ASM_MESON_TAC[FINITE_POWERSET]); +(REWRITE_TAC[SUBSET;IN_ELIM_THM]); +(REPEAT STRIP_TAC); +(REPLICATE_TAC 5 UP_ASM_TAC); +(CHANGED_SET_TAC[])]);; + + +(* ------------------------------------------------------------------------- *) +(* Lemma 6 *) + +let FINITE_critical_edgeX = prove_by_refinement ( + `!V X. FINITE (critical_edgeX V X)`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[critical_edgeX]); + (REWRITE_WITH + `{{u:real^3, v} | {u, v} IN edgeX V X /\ hminus <= hl [u; v] /\ + hl [u; v] <= hplus} = + {{u, v} | hminus <= hl [u; v] /\ hl [u; v] <= hplus} INTER (edgeX V X)`); + (REPEAT GEN_TAC THEN SET_TAC[]); + (MESON_TAC[FINITE_edgeX;FINITE_INTER])]);; + + +(* ------------------------------------------------------------------------- *) +(* Lemma 7 *) + +let DIHV_LE_0 = prove_by_refinement ( + `!x:real^N y z t. &0 <= dihV x y z t`, +[ (REPEAT GEN_TAC THEN REWRITE_TAC[dihV]); + (REPEAT LET_TAC THEN REWRITE_TAC[arcV]); + (MATCH_MP_TAC (MESON[] `&0 <= acs y /\ acs y <= pi ==> &0 <= acs y`)); + (MATCH_MP_TAC ACS_BOUNDS); + (REWRITE_TAC[GSYM REAL_ABS_BOUNDS; NORM_CAUCHY_SCHWARZ_DIV])]);; + + +(* ------------------------------------------------------------------------- *) +(* Lemma 8 *) + +let DIHV_SYM = prove_by_refinement ( + `!(x:real^N) y z t. dihV x y z t = dihV y x z t`, +[ (REPEAT GEN_TAC); + (REWRITE_TAC[dihV] THEN REPEAT LET_TAC); + (MATCH_MP_TAC (MESON[] + `!a b c d x. (a = b) /\ (c = d) ==> arcV x a c = arcV x b d`)); + (REPEAT STRIP_TAC); + (* Break into 2 subgoals with similar proofs *) + + (* Subgoal 1 *) + (EXPAND_TAC "vap'" THEN EXPAND_TAC "vap"); + + (REWRITE_WITH `(va':real^N) = va - vc`); + (EXPAND_TAC "va'" THEN EXPAND_TAC "va" THEN EXPAND_TAC "vc"); + (VECTOR_ARITH_TAC); + + (REWRITE_WITH `(vc':real^N) = --vc`); + (EXPAND_TAC "vc'" THEN EXPAND_TAC "vc"); + (VECTOR_ARITH_TAC); + + (REWRITE_WITH + `(--vc dot --vc) % (va:real^N - vc) = (vc dot vc) % va - (vc dot vc) % vc`); + (REWRITE_TAC[DOT_RNEG;DOT_LNEG;REAL_ARITH `-- --x = x `]); + (VECTOR_ARITH_TAC); + + (MATCH_MP_TAC (VECTOR_ARITH `a = b + c ==> x:real^N - b - c = x - a `)); + (REWRITE_WITH `((va:real^N - vc) dot --vc) % --vc = + (va dot vc) % vc - (vc dot vc) % vc`); + (REWRITE_TAC[DOT_RNEG;DOT_LNEG;VECTOR_MUL_LNEG; VECTOR_MUL_RNEG]); + (REWRITE_TAC[VECTOR_NEG_MINUS1;VECTOR_MUL_ASSOC]); + (REWRITE_TAC[REAL_ARITH `-- &1 * -- &1 * x = x`; + DOT_LSUB;VECTOR_SUB_RDISTRIB]); + (VECTOR_ARITH_TAC); + + (* Subgoal 2 *) + (EXPAND_TAC "vbp'" THEN EXPAND_TAC "vbp"); + (REWRITE_WITH `(vb':real^N) = vb - vc`); + (EXPAND_TAC "vb'" THEN EXPAND_TAC "vb" THEN EXPAND_TAC "vc"); + (VECTOR_ARITH_TAC); + + (REWRITE_WITH `(vc':real^N) = --vc`); + (EXPAND_TAC "vc'" THEN EXPAND_TAC "vc"); + (VECTOR_ARITH_TAC); + + (REWRITE_WITH + `(--vc dot --vc) % (vb:real^N - vc) = (vc dot vc) % vb - (vc dot vc) % vc`); + (REWRITE_TAC[DOT_RNEG;DOT_LNEG;REAL_ARITH `-- --x = x `]); + (VECTOR_ARITH_TAC); + + (MATCH_MP_TAC (VECTOR_ARITH `a = b + c ==> x:real^N - b - c = x - a `)); + (REWRITE_WITH `((vb:real^N - vc) dot --vc) % --vc = + (vb dot vc) % vc - (vc dot vc) % vc`); + (REWRITE_TAC[DOT_RNEG;DOT_LNEG;VECTOR_MUL_LNEG; VECTOR_MUL_RNEG]); + (REWRITE_TAC[VECTOR_NEG_MINUS1;VECTOR_MUL_ASSOC]); + (REWRITE_TAC[REAL_ARITH `-- &1 * -- &1 * x = x`; + DOT_LSUB;VECTOR_SUB_RDISTRIB]); + (VECTOR_ARITH_TAC)]);; + +(* ------------------------------------------------------------------------- *) +(* Lemma 9 *) + +let DIHX_POS = prove_by_refinement ( + `!u v V X. &0 <= dihX V X (u,v)`, +[(REPEAT STRIP_TAC THEN REWRITE_TAC[dihX; dihu2; dihu3;dihu4]); + (LET_TAC); + (COND_CASES_TAC); + (REAL_ARITH_TAC); + (COND_CASES_TAC); + (REWRITE_TAC[DIHV_RANGE]); + (COND_CASES_TAC); + (REWRITE_TAC[DIHV_RANGE]); + (COND_CASES_TAC); + (REWRITE_TAC[DIHV_RANGE]); + (REAL_ARITH_TAC)]);; + +(* ------------------------------------------------------------------------- *) +(* Lemma 10 *) + +let SUM_SET_OF_2_ELEMENTS = prove_by_refinement ( + `!s t f. ~(s = t) ==> sum {s:A,t} f = f s + f t`, +[(REPEAT STRIP_TAC); + (REWRITE_WITH `!s t f. f s = sum{s:A} f /\ f t = sum{t} f`); + (MESON_TAC[SUM_SING]); + (REWRITE_WITH `{s:A, t} = {s} UNION {t}`); + (SET_TAC[]); + (MATCH_MP_TAC SUM_UNION); + (REWRITE_TAC[FINITE_SING]); + (UP_ASM_TAC THEN SET_TAC[])]);; + +let pos_lemma = prove_by_refinement( + `!Q. (?C. (&0 <= C /\ (!r. &1 <= r ==> Q r <= C * r pow 2))) <=> + (?C. ( (!r. &1 <= r ==> Q r <= C * r pow 2)))`, +[(GEN_TAC); + EQ_TAC; + (REPEAT STRIP_TAC); + (EXISTS_TAC `C:real`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `abs(C)`); + (REWRITE_TAC[REAL_ARITH `&0 <= abs C`]); + (REPEAT STRIP_TAC); + (ASSUME_TAC (REAL_ARITH `C <= abs C`)); + (MATCH_MP_TAC REAL_LE_TRANS); + (EXISTS_TAC `C * r pow 2`); + (CONJ_TAC); + (ASM_SIMP_TAC[]); + (REWRITE_TAC[REAL_ARITH `a * b <= c * b <=> &0 <= (c - a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_LE_POW_2] THEN ASM_REAL_ARITH_TAC)]);; + +let negligible_fun_any_C = prove( + `!f S. negligible_fun_0 f S <=> + (?C. (!r. &1 <= r ==> sum (S INTER ball ((vec 0),r)) f <= C * r pow 2))`, +REWRITE_TAC[Pack_defs.negligible_fun_0;Pack_defs.negligible_fun_p;pos_lemma]);; + +end;; + + + diff --git a/text_formalization/packing/URRPHBZ1.hl b/text_formalization/packing/URRPHBZ1.hl new file mode 100644 index 0000000..9887266 --- /dev/null +++ b/text_formalization/packing/URRPHBZ1.hl @@ -0,0 +1,688 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: URRPHBZ1 *) +(* Chaper : Packing (Marchal cells) *) +(* *) +(* ========================================================================= *) + +(* emailed from Ky to Hales, July 14, 2011 *) + +module Urrphbz1 = struct + +open Rogers;; +open Vukhacky_tactics;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Sphere;; +open Marchal_cells;; +open Emnwuus;; +open Marchal_cells_2_new;; + +let INTER_RCONE_GE_IMP_BETWEEN_PROJ_POINT = prove_by_refinement ( + `!a:real^3 b p r. + ~(a = b) /\ &0 <= r /\ p IN rcone_ge a b r INTER rcone_ge b a r ==> + between (proj_point (b - a) (p - a) + a) (a, b)`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[between;PRO_EXP] THEN ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[dist; VECTOR_ARITH `(k % x + a) - a = k % x /\ + m - (h % (m - n) + n) = (&1 - h) % (m - n)`]); + (ABBREV_TAC `h = ((p - a) dot (b - a)) / ((b - a) dot (b - a:real^3))`); + (REWRITE_TAC[NORM_MUL]); + (REWRITE_WITH `abs h = h /\ abs (&1 - h) = &1 - h`); + (REWRITE_TAC[REAL_ABS_REFL]); + (STRIP_TAC); + (EXPAND_TAC "h" THEN MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[GSYM NORM_POW_2; REAL_LE_POW_2]); + (SUBGOAL_THEN `p IN rcone_ge a (b:real^3) r` MP_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[rcone_ge;rconesgn;IN;IN_ELIM_THM]); + (STRIP_TAC); + (NEW_GOAL `&0 <= dist (p,a) * dist (b,a:real^3) * r`); + (ASM_SIMP_TAC[REAL_LE_MUL;DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (EXPAND_TAC "h" THEN REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (SUBGOAL_THEN `p IN rcone_ge b (a:real^3) r` MP_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[rcone_ge;rconesgn;IN;IN_ELIM_THM]); + (STRIP_TAC); + (REWRITE_WITH `((p - a) dot (b - a)) / ((b - a) dot (b - a)) <= &1 + <=> ((p - a) dot (b - a)) <= &1 * ((b - a) dot (b - a:real^3))`); + (MATCH_MP_TAC REAL_LE_LDIV_EQ); + (REWRITE_TAC[GSYM NORM_POW_2; GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT; + NORM_EQ_0; VECTOR_ARITH `b - a = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC [REAL_MUL_LID; REAL_ARITH `a <= b <=> ~(b < a)`]); + (STRIP_TAC); + (NEW_GOAL `(p - b) dot (a - b) + (p - a) dot (b - a) > + dist (p,b) * dist (a,b) * r + (b - a) dot (b - a:real^3)`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[VECTOR_ARITH `(p - b) dot (a - b) + + (p - a) dot (b - a) = (b - a) dot (b - a)`; + REAL_ARITH `~(x > y + x) <=> &0 <= y`]); + (ASM_SIMP_TAC[REAL_LE_MUL;DIST_POS_LE]); + (REAL_ARITH_TAC)]);; + +(* ================================================================== *) + +let INTER_RCONE_GE_LE_lemma = prove_by_refinement( + `!a:real^3 b p s h r. + ~(a = b) /\ s = midpoint (a, b) /\ &0 < r /\ ~(p = a) /\ ~(p = b) /\ + inv (&2) <= r pow 2 /\ + between (proj_point (b - a) (p - a) + a) (a, s) /\ + p IN rcone_ge a b r INTER rcone_ge b a r ==> dist (s, p) <= dist (s, a)`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `&0 <= r`); + (ASM_REAL_ARITH_TAC); + (ABBREV_TAC `p' = proj_point (b - a) (p - a) + a:real^3`); + (ABBREV_TAC `x = a + (dist (a, s) / dist (a, p':real^3)) % (p - a)`); + (NEW_GOAL `(p - a) dot (b - a:real^3) >= dist (p,a) * dist (b,a) * r`); + (SUBGOAL_THEN `p IN rcone_ge a (b:real^3) r` MP_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[rcone_ge;rconesgn;IN;IN_ELIM_THM]); + + (NEW_GOAL `between p (a, x:real^3)`); + (EXPAND_TAC "x" THEN REWRITE_TAC[between]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[dist; VECTOR_ARITH `(a + x) - a = x:real^3 /\ + ((a + k % (p - a) ) - p = (k - &1) % (p - a))`; NORM_MUL]); + (REWRITE_WITH `abs (norm (a - s) / norm (a - p':real^3)) = + norm (a - s) / norm (a - p')`); + (REWRITE_TAC[REAL_ABS_REFL]); + (SIMP_TAC[REAL_LE_DIV; NORM_POS_LE]); + (REWRITE_WITH `abs (norm (a - s) / norm (a - p':real^3) - &1) = + norm (a - s) / norm (a - p') - &1`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ONCE_REWRITE_TAC[NORM_ARITH `norm (a - b) = norm (b - a)`]); + (EXPAND_TAC "p'" THEN SIMP_TAC[VECTOR_ARITH `(k % s + a) - a = k % s`; + PRO_EXP; NORM_MUL;REAL_ABS_DIV; GSYM NORM_POW_2; REAL_LE_POW_2]); + (REWRITE_WITH `abs ((p - a) dot (b - a:real^3)) = (p - a) dot (b - a) /\ + abs (norm (b - a) pow 2) = norm (b - a) pow 2`); + (REWRITE_TAC[REAL_ABS_REFL; REAL_LE_POW_2]); + (NEW_GOAL `&0 <= dist (p,a) * dist (b,a:real^3) * r`); + (ASM_SIMP_TAC[REAL_LE_MUL;DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&0 <= x - &1 <=> &1 <= x`]); + (REWRITE_WITH `b = &2 % s - a:real^3`); + (ASM_REWRITE_TAC[midpoint] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `&2 % s - a - a = &2 % (s - a)`; NORM_MUL; + DOT_RMUL; MESON[REAL_ABS_REFL; REAL_ARITH `&0 <= &2`] `abs (&2) = &2`]); + (REWRITE_TAC[real_div; REAL_INV_MUL; REAL_INV_INV]); + + (REWRITE_TAC[REAL_ARITH `x * ((inv (&2) * inv (y)) * (&2 * x) pow 2) * + inv (&2) * inv (x) = (x * inv (x)) * (x pow 2) * inv (y)`]); + (REWRITE_WITH `norm (s - a:real^3) * inv (norm (s - a)) = &1`); + (MATCH_MP_TAC REAL_MUL_RINV); + (REWRITE_TAC[NORM_EQ_0]); + (ASM_REWRITE_TAC[midpoint; VECTOR_ARITH `inv (&2) % (a + b) - a = + inv (&2) % (b - a)`; VECTOR_MUL_EQ_0]); + (ASM_REWRITE_TAC[VECTOR_ARITH `b -a = vec 0 <=> a = b`]); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_MUL_LID; GSYM real_div]); + + + (NEW_GOAL `&0 < (p - a) dot (s - a:real^3)`); + (REWRITE_WITH `(p - a) dot (s - a:real^3) = inv (&2) * (p - a) dot (b - a)`); + (ASM_REWRITE_TAC[midpoint] THEN VECTOR_ARITH_TAC); + (MATCH_MP_TAC REAL_LT_MUL); + (REWRITE_TAC[REAL_ARITH `&0 < inv (&2)`]); + (NEW_GOAL `&0 < dist (p,a) * dist (b,a:real^3) * r`); + (ASM_SIMP_TAC[REAL_LT_MUL;DIST_POS_LT]); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `&1 <= norm (s - a) pow 2 / ((p - a) dot (s - a)) + <=> &1 * ((p - a) dot (s - a:real^3)) <= norm (s - a) pow 2 `); + (ASM_SIMP_TAC[REAL_LE_RDIV_EQ]); + (REWRITE_TAC[REAL_MUL_LID]); + (ONCE_REWRITE_TAC[VECTOR_ARITH `(p - a) dot (s - a) = + (p - a - (p' - a)) dot (s - a) + (p' - a) dot (s - a:real^3)`]); + (EXPAND_TAC "p'" THEN REWRITE_TAC[VECTOR_ARITH `(x + a) - a = x:real^3`]); + (REWRITE_TAC[GSYM projection_proj_point]); + (REWRITE_WITH `s - a:real^3 = inv (&2) % (b - a)`); + (ASM_REWRITE_TAC[midpoint] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_RMUL;Packing3.PROJECTION_ORTHOGONAL;REAL_MUL_RZERO; + REAL_ADD_LID]); + (REWRITE_WITH `proj_point (b - a) (p - a:real^3) = p' - a`); + (EXPAND_TAC "p'" THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `(p' - a) dot (b - a) = norm (p'- a) * norm (b - a:real^3)`); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ_EQ]); + (SUBGOAL_THEN `between p' (a, b:real^3)` MP_TAC); + (EXPAND_TAC "p'" THEN MATCH_MP_TAC INTER_RCONE_GE_IMP_BETWEEN_PROJ_POINT); + (EXISTS_TAC `r:real` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM REWRITE_ONLY_TAC); + (REWRITE_WITH `(u % a + v % b) - a = (u % a + v % b) - (u + v) % a:real^3`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (REWRITE_TAC[VECTOR_ARITH `(u % a + v % b) - (u + v) % a = v % (b - a)`; + NORM_MUL; VECTOR_MUL_ASSOC]); + (REWRITE_WITH `abs v = v`); + (ASM_SIMP_TAC[REAL_ABS_REFL]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `inv (&2) * norm (p' - a) * norm (b - a:real^3) <= + inv (&2) * norm (s - a) * norm (b - a)`); + (REWRITE_TAC[REAL_ARITH `a * x * b <= a * y * b <=> &0 <= (a * b) * (y - x)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `&0 <= inv (&2)`]); + (REWRITE_TAC[GSYM dist]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (UNDISCH_TAC `between p' (a,s:real^3)` THEN REWRITE_TAC[between]); + (DISCH_TAC THEN FIRST_ASSUM REWRITE_ONLY_TAC); + (REWRITE_TAC[REAL_ARITH `(a + b) - a = b`; DIST_POS_LE]); + + (NEW_GOAL `norm (inv (&2) % (b - a:real^3)) pow 2 = + inv (&2) * norm (s - a) * norm (b - a)`); + (REWRITE_TAC[NORM_MUL; REAL_POW_2; REAL_ARITH `abs (inv (&2)) = inv (&2)`]); + (REWRITE_TAC[REAL_ARITH + `(z * x) * z * x = z * y * x <=> (y - z * x) * x * z = &0`]); + (REWRITE_WITH `s - a:real^3 = inv (&2) % (b - a)`); + (ASM_REWRITE_TAC[midpoint] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; REAL_ARITH `abs (inv (&2)) = inv (&2)`]); + (REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (NEW_GOAL `x IN rcone_ge (a:real^3) b r`); + (EXPAND_TAC "x"); + (MATCH_MP_TAC RCONE_GE_TRANS); + (STRIP_TAC); + (SIMP_TAC[REAL_LE_DIV;DIST_POS_LE]); + (ASM_REWRITE_TAC[VECTOR_ARITH `(a:real^3) + p - a = p`]); + (ASM_SET_TAC[]); + + (NEW_GOAL `(p' - a) dot (b - a) = norm (p'- a) * norm (b - a:real^3)`); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ_EQ]); + (SUBGOAL_THEN `between p' (a, b:real^3)` MP_TAC); + (EXPAND_TAC "p'" THEN MATCH_MP_TAC INTER_RCONE_GE_IMP_BETWEEN_PROJ_POINT); + (EXISTS_TAC `r:real` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM REWRITE_ONLY_TAC); + (REWRITE_WITH `(u % a + v % b) - a = (u % a + v % b) - (u + v) % a:real^3`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (REWRITE_TAC[VECTOR_ARITH `(u % a + v % b) - (u + v) % a = v % (b - a)`; + NORM_MUL; VECTOR_MUL_ASSOC]); + (REWRITE_WITH `abs v = v`); + (ASM_SIMP_TAC[REAL_ABS_REFL]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `(x - s:real^3) dot (a - s) = &0`); + (EXPAND_TAC "x"); + (REWRITE_TAC[VECTOR_ARITH `((a + m % x) - s) dot (a - s) = (s - a) dot (s - a) - m * (x dot (s - a))`]); + + (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist]); + (REWRITE_WITH `(p - a) dot (s - a) = + (p - a - (p' - a)) dot (s - a) + (p' - a) dot (s - a:real^3)`); + (VECTOR_ARITH_TAC); + + (EXPAND_TAC "p'" THEN REWRITE_TAC[VECTOR_ARITH `(x + a) - a = x:real^3`]); + (REWRITE_TAC[GSYM projection_proj_point]); + (REWRITE_WITH `s - a:real^3 = inv (&2) % (b - a)`); + (ASM_REWRITE_TAC[midpoint] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_RMUL;Packing3.PROJECTION_ORTHOGONAL;REAL_MUL_RZERO; + REAL_ADD_LID]); + (REWRITE_WITH `proj_point (b - a) (p - a:real^3) = p' - a`); + (EXPAND_TAC "p'" THEN VECTOR_ARITH_TAC); + (FIRST_ASSUM REWRITE_ONLY_TAC); + (REWRITE_TAC[DOT_LMUL; NORM_MUL; REAL_ARITH `abs (inv (&2)) = inv (&2)`; + GSYM NORM_POW_2]); + (REWRITE_TAC [REAL_ARITH `m * m * (x pow 2) - (m * x) / y * m * y * x = &0 + <=> m * m * x * x * (y / y - &1) = &0 `]); + (REWRITE_WITH `norm (p' - a) / norm (p' - a:real^3) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[NORM_EQ_0]); + (EXPAND_TAC "p'" THEN REWRITE_TAC[VECTOR_ARITH `(x + a:real^3) - a = x`]); + (REWRITE_TAC[PRO_EXP;VECTOR_MUL_EQ_0]); + (ASM_REWRITE_TAC[VECTOR_ARITH `b - a = vec 0 <=> a = b`]); + (ONCE_REWRITE_TAC [REAL_ARITH `a / b = a * (&1 / b)`]); + (REWRITE_TAC[REAL_ENTIRE]); + (NEW_GOAL `~((p - a) dot (b - a:real^3) = &0)`); + (NEW_GOAL `&0 < dist (p,a) * dist (b,a:real^3) * r`); + (ASM_SIMP_TAC[REAL_LT_MUL; DIST_POS_LT]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Trigonometry2.NOT_EQ0_IMP_NEITHER_INVERT); + (REWRITE_TAC[GSYM NORM_POW_2; Trigonometry2.POW2_EQ_0; NORM_EQ_0]); + (ASM_REWRITE_TAC[VECTOR_ARITH `b - a = vec 0 <=> a = b`]); + (REAL_ARITH_TAC); + (NEW_GOAL `dist (s, x) <= dist (s, a:real^3)`); + (NEW_GOAL `norm (a - x:real^3) pow 2 = norm (s - x) pow 2 + norm (a - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (ASM_REWRITE_TAC[orthogonal]); + (NEW_GOAL `norm (a - s) pow 2 >= inv (&2) * norm (a - x:real^3) pow 2`); + (ONCE_REWRITE_TAC[NORM_ARITH `norm (x - y) = norm (y - x)`]); + (EXPAND_TAC "x" THEN REWRITE_TAC[VECTOR_ARITH `(x + y:real^3) - x = y`]); + (REWRITE_TAC[NORM_MUL]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[dist]); + (REWRITE_WITH `abs (norm (s - a) / norm (p' - a:real^3)) = + norm (s - a) / norm (p' - a)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (SIMP_TAC[REAL_LE_DIV;NORM_POS_LE]); + (REWRITE_TAC[REAL_ARITH `(x / y * z) pow 2 = x pow 2 * (z / y) pow 2`]); + (REWRITE_TAC[REAL_ARITH + `x pow 2 >= a * x pow 2 * b <=> &0 <= x pow 2 * (&1 - a * b)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + + (REWRITE_TAC[REAL_LE_POW_2]); + (REWRITE_TAC[REAL_ARITH `&0 <= &1 - a <=> a <= &1`]); + (NEW_GOAL `norm (p' - a) >= r * norm (p - a:real^3)`); + (EXPAND_TAC "p'" THEN REWRITE_TAC[VECTOR_ARITH `(x + y:real^3) - y = x`]); + (REWRITE_TAC[PRO_EXP]); + (SUBGOAL_THEN `p IN rcone_ge (a:real^3) b r` MP_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[rcone_ge;rconesgn;IN;IN_ELIM_THM; dist]); + (STRIP_TAC); + (REWRITE_TAC[NORM_MUL;REAL_ABS_DIV;GSYM NORM_POW_2]); + (REWRITE_WITH `abs ((p - a) dot (b - a)) = (p - a) dot (b - a:real^3) /\ + abs (norm (b - a) pow 2) = norm (b - a) pow 2`); + (REWRITE_TAC[REAL_ABS_REFL;REAL_LE_POW_2]); + (NEW_GOAL `&0 <= norm (p - a) * norm (b - a:real^3) * r`); + (ASM_SIMP_TAC[REAL_LE_MUL; NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `a / x * y >= b <=> b <= (a * y) / x`]); + (REWRITE_WITH `r * norm (p - a) <= + (((p - a) dot (b - a)) * norm (b - a)) / norm (b - a) pow 2 + <=> (r * norm (p - a)) * norm (b - a) pow 2 <= + (((p - a) dot (b - a)) * norm (b - a:real^3))`); + (MATCH_MP_TAC REAL_LE_RDIV_EQ); + (REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT; NORM_EQ_0]); + (ASM_REWRITE_TAC[VECTOR_ARITH `b - a = vec 0 <=> a = b`]); + (REWRITE_TAC[REAL_ARITH + `(a * b) * x pow 2 <= m * x <=> &0 <= x * (m - b * x * a)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + + (REWRITE_TAC[REAL_POW_DIV;REAL_ARITH `a * b / c = (a * b) / c`]); + (REWRITE_WITH `(inv (&2) * norm (p - a) pow 2) / norm (p' - a) pow 2 <= &1 + <=> (inv (&2) * norm (p - a) pow 2) <= &1 * norm (p' - a:real^3) pow 2`); + (MATCH_MP_TAC REAL_LE_LDIV_EQ); + (REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]); + (STRIP_TAC); + (NEW_GOAL `norm (p - a:real^3) = &0`); + (NEW_GOAL `r * norm (p - a:real^3) = &0`); + (NEW_GOAL `&0 <= r * norm (p - a:real^3)`); + (ASM_SIMP_TAC[REAL_LE_MUL;NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ENTIRE]); + (REWRITE_WITH `~(r = &0)`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[NORM_EQ_0]); + (ASM_REWRITE_TAC[NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (REWRITE_TAC[REAL_MUL_LID]); + (NEW_GOAL `(r * norm (p - a)) pow 2 <= norm (p' - a:real^3) pow 2`); + (REWRITE_WITH `(r * norm (p - a)) pow 2 <= norm (p' - a:real^3) pow 2 + <=> r * norm (p - a) <= norm (p' - a)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Trigonometry2.POW2_COND); + (ASM_SIMP_TAC[REAL_LE_MUL;NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `inv (&2) * norm (p - a:real^3) pow 2 <= (r * norm (p - a)) pow 2`); + (REWRITE_TAC[REAL_ARITH + `a * x pow 2 <= (m * x) pow 2 <=> &0 <= (m pow 2 - a) * (x pow 2)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_LE_POW_2]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `norm (s - x) pow 2 <= norm (a - s:real^3) pow 2`); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `dist (s,x) <= dist (s,a:real^3) + <=> dist (s,x) pow 2 <= dist (s,a) pow 2`); + (MATCH_MP_TAC Trigonometry2.POW2_COND); + (REWRITE_TAC[DIST_POS_LE]); + (UP_ASM_TAC THEN REWRITE_TAC[GSYM dist] THEN MESON_TAC[DIST_SYM]); + + (ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[dist]); + (NEW_GOAL `?y. y IN {a, x:real^3} /\ + (!m. m IN convex hull {a,x} ==> norm (m - s) <= norm (y - s))`); + (MATCH_MP_TAC SIMPLEX_FURTHEST_LE); + (REWRITE_TAC[Geomdetail.FINITE6]); + (SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[SET_RULE `a IN {x,y} <=> a = x \/ a = y`] + THEN STRIP_TAC); + (UP_ASM_TAC THEN FIRST_ASSUM REWRITE_ONLY_TAC); + (DISCH_TAC THEN FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL] THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN FIRST_ASSUM REWRITE_ONLY_TAC); + (DISCH_TAC); + (NEW_GOAL `norm (p - s) <= norm (x - s:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL] THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `norm (x - s) <= norm (a - s:real^3)`); + (REWRITE_TAC[GSYM dist]); + (ASM_MESON_TAC[DIST_SYM]); + (ASM_REAL_ARITH_TAC)]);; + +(* ================================================================== *) +let MCELL_2_PROPERTIES_lemma1 = prove_by_refinement ( + `!V ul k p. + saturated V /\ + packing V /\ + barV V 3 ul /\ + p IN mcell2 V ul + ==> dist (midpoint (HD ul, HD (TL ul)), p) <= + hl (truncate_simplex 1 ul)`, +[(REPEAT STRIP_TAC); + + (NEW_GOAL `?u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]`); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (ASM_REWRITE_TAC[HD;TL;TRUNCATE_SIMPLEX_EXPLICIT_1]); + (UNDISCH_TAC `p IN mcell2 V ul` THEN REWRITE_TAC[mcell2]); + (COND_CASES_TAC); + (LET_TAC); + (REWRITE_TAC[IN_INTER] THEN DISCH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[HD;TL] THEN STRIP_TAC); + + (NEW_GOAL `barV V 1 [u0;u1:real^3]`); + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN REWRITE_TAC[ARITH_RULE `1 <= 3`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `LENGTH (ul:(real^3)list) = 3 + 1 /\ CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `~ (u0 = u1:real^3)`); + (STRIP_TAC); + (NEW_GOAL `CARD (set_of_list (ul:(real^3)list)) <= 3`); + (REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`; set_of_list]); + (ASM_REWRITE_TAC[SET_RULE `{x,x,a,b} = {x,a,b}`;Geomdetail.CARD3]); + (ASM_ARITH_TAC); + + (ABBREV_TAC `s1 = omega_list_n V ul 1`); + (NEW_GOAL `s1 = midpoint (u0,u1:real^3)`); + (EXPAND_TAC "s1"); + (REWRITE_WITH `omega_list_n V ul 1 = + omega_list V [u0; u1:real^3]`); + (REWRITE_TAC [ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_1]); + (REWRITE_WITH `omega_list V [u0; u1:real^3] = + circumcenter (set_of_list [u0;u1])`); + (MATCH_MP_TAC XNHPWAB1); + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[IN]); + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[set_of_list;Rogers.CIRCUMCENTER_2]); + + (NEW_GOAL `s1 = omega_list V [u0; u1:real^3]`); + (EXPAND_TAC "s1" THEN REWRITE_TAC [ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_TAC[OMEGA_LIST_TRUNCATE_1]); + + (NEW_GOAL `hl [u0;u1] = dist (s1, u0:real^3)`); + (REWRITE_WITH `dist (s1, u0:real^3) = dist (omega_list V [u0;u1],HD [u0;u1])`); + (REWRITE_TAC[HD; ASSUME `s1 = omega_list V [u0; u1:real^3]`]); + (MATCH_MP_TAC Rogers.WAUFCHE2); + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[IN]); + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `p = u0:real^3`); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (ASM_CASES_TAC `p = u1:real^3`); + (ASM_REWRITE_TAC[midpoint; dist]); + (NORM_ARITH_TAC); + + (NEW_GOAL `between (proj_point (u1 - u0) (p - u0) + u0) (u0,u1:real^3)`); + (MATCH_MP_TAC INTER_RCONE_GE_IMP_BETWEEN_PROJ_POINT); + (EXISTS_TAC `a:real`); + (REPEAT STRIP_TAC); + (ASM_MESON_TAC[]); + (EXPAND_TAC "a"); + (MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`;TRUNCATE_SIMPLEX_EXPLICIT_1]); + (ASM_REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC SQRT_POS_LE); + (REAL_ARITH_TAC); + (REWRITE_TAC[IN_INTER]); + (ASM_REWRITE_TAC[]); + (ASM_CASES_TAC `between (proj_point (u1 - u0) (p - u0) + u0) (u0,s1:real^3)`); + + (REWRITE_TAC[GSYM (ASSUME `s1 = midpoint (u0,u1:real^3)`)]); + (REWRITE_TAC[ASSUME `hl [u0; u1] = dist (s1,u0:real^3)`]); + (MATCH_MP_TAC INTER_RCONE_GE_LE_lemma); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `a:real`); + (ASM_REWRITE_TAC[IN_INTER]); + (EXPAND_TAC "a"); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LT_DIV); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (STRIP_TAC); + (MATCH_MP_TAC DIST_POS_LT); + (REWRITE_TAC[midpoint; VECTOR_ARITH `inv (&2) % (u0 + u1) = u0 <=> inv (&2) % + (u0 - u1) = vec 0`; VECTOR_MUL_EQ_0; REAL_ARITH `~(inv (&2) = &0)`]); + (ASM_REWRITE_TAC[VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]); + + (REWRITE_TAC[Trigonometry2.DIV_POW2]); + (REWRITE_WITH `sqrt (&2) pow 2 = &2`); + (MATCH_MP_TAC SQRT_POW_2); + (REAL_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_ARITH `inv (&2) <= a / &2 <=> &1 <= a`]); + (ASM_REWRITE_TAC [TRUNCATE_SIMPLEX_EXPLICIT_1; ASSUME `hl [u0; u1] = + dist (s1,u0:real^3)`; midpoint; dist; VECTOR_ARITH `inv (&2) % (u0 + u1) - + u0 = inv (&2) % (u1 - u0)`; NORM_MUL; REAL_ABS_INV; MESON[REAL_ABS_REFL; + REAL_ARITH `&0 <= &2`]`abs (&2) = (&2)`]); + (NEW_GOAL `&1 <= inv (&2) * norm (u1 - u0:real^3)`); + (REWRITE_TAC[REAL_ARITH `&1 <= inv (&2) * a <=> &2 <= a`; GSYM dist]); + (UNDISCH_TAC `packing V`); + (REWRITE_TAC[packing] THEN DISCH_TAC THEN FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `set_of_list ul SUBSET V:real^3->bool`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[GSYM IN]); + (NEW_GOAL `&1 pow 2 <= (inv (&2) * norm (u1 - u0:real^3)) pow 2`); + (REWRITE_WITH `&1 pow 2 <= (inv (&2) * norm (u1 - u0:real^3)) pow 2 + <=> &1 <= (inv (&2) * norm (u1 - u0:real^3))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Trigonometry2.POW2_COND); + (ASM_SIMP_TAC[REAL_LE_MUL; REAL_ARITH `&0 <= &1 /\ &0 <= inv (&2)`; + NORM_POS_LE]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ARITH `&1 pow 2 = &1`]); + + + (ASM_CASES_TAC `between (proj_point (u1 - u0) (p - u0) + u0) (s1,u1:real^3)`); + + (NEW_GOAL `hl [u0;u1] = dist (s1, u1:real^3)`); + (REWRITE_WITH `dist (s1, u1) = dist (s1, u0:real^3)`); + (ASM_REWRITE_TAC[midpoint;dist]); + (NORM_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[GSYM (ASSUME `s1 = midpoint (u0,u1:real^3)`)]); + (REWRITE_TAC[ASSUME `hl [u0; u1] = dist (s1,u1:real^3)`]); + (MATCH_MP_TAC INTER_RCONE_GE_LE_lemma); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `a:real`); + (ASM_REWRITE_TAC[IN_INTER]); + (EXPAND_TAC "a"); + (REPEAT STRIP_TAC); + (REWRITE_TAC[midpoint] THEN VECTOR_ARITH_TAC); + (MATCH_MP_TAC REAL_LT_DIV); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (STRIP_TAC); + (MATCH_MP_TAC DIST_POS_LT); + (REWRITE_TAC[midpoint; VECTOR_ARITH `inv (&2) % (u0 + u1) = u0 <=> inv (&2) % + (u0 - u1) = vec 0`; VECTOR_MUL_EQ_0; REAL_ARITH `~(inv (&2) = &0)`]); + (ASM_REWRITE_TAC[VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]); + (REWRITE_TAC[Trigonometry2.DIV_POW2]); + (REWRITE_WITH `sqrt (&2) pow 2 = &2`); + (MATCH_MP_TAC SQRT_POW_2); + (REAL_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_ARITH `inv (&2) <= a / &2 <=> &1 <= a`]); + (ASM_REWRITE_TAC [TRUNCATE_SIMPLEX_EXPLICIT_1; ASSUME `hl [u0; u1] = + dist (s1,u0:real^3)`; midpoint; dist; VECTOR_ARITH `inv (&2) % (u0 + u1) - + u0 = inv (&2) % (u1 - u0)`; NORM_MUL; REAL_ABS_INV; MESON[REAL_ABS_REFL; + REAL_ARITH `&0 <= &2`]`abs (&2) = (&2)`]); + (NEW_GOAL `&1 <= inv (&2) * norm (u1 - u0:real^3)`); + (REWRITE_TAC[REAL_ARITH `&1 <= inv (&2) * a <=> &2 <= a`; GSYM dist]); + (UNDISCH_TAC `packing V`); + (REWRITE_TAC[packing] THEN DISCH_TAC THEN FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `set_of_list ul SUBSET V:real^3->bool`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[GSYM IN]); + (NEW_GOAL `&1 pow 2 <= (inv (&2) * norm (u1 - u0:real^3)) pow 2`); + (REWRITE_WITH `&1 pow 2 <= (inv (&2) * norm (u1 - u0:real^3)) pow 2 + <=> &1 <= (inv (&2) * norm (u1 - u0:real^3))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Trigonometry2.POW2_COND); + (ASM_SIMP_TAC[REAL_LE_MUL; REAL_ARITH `&0 <= &1 /\ &0 <= inv (&2)`; + NORM_POS_LE]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ARITH `&1 pow 2 = &1`]); + (REWRITE_WITH `midpoint (u0,u1) = s1:real^3`); + (ASM_REWRITE_TAC[midpoint] THEN VECTOR_ARITH_TAC); + (ONCE_REWRITE_TAC[BETWEEN_SYM]); + + (REWRITE_WITH `proj_point (u0 - u1) (p - u1) + u1:real^3 = + proj_point (u1 - u0) (p - u0) + u0`); + (REWRITE_TAC[PRO_EXP; GSYM NORM_POW_2; GSYM dist; DIST_SYM]); + (REWRITE_TAC[VECTOR_ARITH + `(a / x) % (m - n) + n = (b / x) % (n - m) + m + <=> ((a + b) / x - &1) % (m - n) = vec 0`]); + (REWRITE_TAC[VECTOR_ARITH `(p - u1) dot (u0 - u1) + (p - u0) dot (u1 - u0) + = (u0 - u1) dot (u0 - u1)`]); + (REWRITE_TAC[GSYM NORM_POW_2; GSYM dist]); + (REWRITE_WITH `dist (u0,u1) pow 2 / dist (u0,u1:real^3) pow 2 = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[Trigonometry2.POW2_EQ_0; DIST_EQ_0]); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `between (proj_point (u1 - u0) (p - u0) + u0) (u0,s1) \/ + between (proj_point (u1 - u0) (p - u0) + u0) (s1, u1:real^3)`); + (MATCH_MP_TAC BETWEEN_TRANS_3_CASES); + (ASM_REWRITE_TAC[BETWEEN_MIDPOINT]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (STRIP_TAC); + (NEW_GOAL `F`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[])]);; + +(* ==================================================================== *) + +let BOUNDED_MCELL = prove_by_refinement ( + `!V ul k. + saturated V /\ + packing V /\ + barV V 3 ul + ==> bounded (mcell k V ul)`, +[(REPEAT STRIP_TAC); + (ASM_CASES_TAC `k = 0`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC THEN REWRITE_TAC[MCELL_EXPLICIT; mcell0]); + (MATCH_MP_TAC BOUNDED_DIFF); + (ASM_SIMP_TAC[ROGERS_EXPLICIT]); + (MATCH_MP_TAC FINITE_IMP_BOUNDED_CONVEX_HULL); + (REWRITE_TAC[Geomdetail.FINITE6]); + + (ASM_CASES_TAC `k = 1`); + (MATCH_MP_TAC BOUNDED_SUBSET); + (EXISTS_TAC `rogers V ul`); + (STRIP_TAC); + (ASM_SIMP_TAC[ROGERS_EXPLICIT]); + (MATCH_MP_TAC FINITE_IMP_BOUNDED_CONVEX_HULL); + (REWRITE_TAC[Geomdetail.FINITE6]); + (ASM_REWRITE_TAC[MCELL_EXPLICIT;mcell1]); + (COND_CASES_TAC); + (SET_TAC[]); + (SET_TAC[]); + + (ASM_CASES_TAC `k = 2`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC THEN REWRITE_TAC[MCELL_EXPLICIT]); + (REWRITE_TAC[bounded]); + (EXISTS_TAC `norm (midpoint (HD ul,HD (TL ul))) + + hl (truncate_simplex 1 (ul:(real^3)list))`); + (REPEAT STRIP_TAC); + (NEW_GOAL `norm (x:real^3) <= norm (x - midpoint (HD ul,HD (TL ul))) + + norm (midpoint (HD ul,HD (TL ul)))`); + (NORM_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[GSYM dist]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (NEW_GOAL `dist (midpoint (HD ul,HD (TL ul)),x:real^3) <= + hl (truncate_simplex 1 ul)`); + (MATCH_MP_TAC MCELL_2_PROPERTIES_lemma1); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (DISCH_TAC); + (ASM_REAL_ARITH_TAC); + + (ASM_CASES_TAC `k = 3`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC THEN REWRITE_TAC[MCELL_EXPLICIT;mcell3]); + (COND_CASES_TAC); + (MATCH_MP_TAC FINITE_IMP_BOUNDED_CONVEX_HULL); + (NEW_GOAL `?u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]`); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list; + SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`; Geomdetail.FINITE6]); + (REWRITE_TAC[BOUNDED_EMPTY]); + + (NEW_GOAL `k >= 4`); + (ASM_ARITH_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT;mcell4]); + (COND_CASES_TAC); + (MATCH_MP_TAC FINITE_IMP_BOUNDED_CONVEX_HULL); + (NEW_GOAL `?u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]`); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (ASM_REWRITE_TAC[set_of_list; Geomdetail.FINITE6]); + (REWRITE_TAC[BOUNDED_EMPTY])]);; + +(* ================================================================== *) + +let MEASURABLE_MCELL = prove ( + `!V ul k. + saturated V /\ + packing V /\ + barV V 3 ul + ==> measurable (mcell k V ul)`, + (REPEAT STRIP_TAC) THEN + (MATCH_MP_TAC MEASURABLE_COMPACT) THEN + (REWRITE_TAC[COMPACT_EQ_BOUNDED_CLOSED]) THEN + (ASM_SIMP_TAC[CLOSED_MCELL;BOUNDED_MCELL]));; + +(* MEASURABLE_MCELL = URRPHBZ1 *) + +let URRPHBZ1 = prove (URRPHBZ1_concl, REWRITE_TAC[MEASURABLE_MCELL]);; + +end;; diff --git a/text_formalization/packing/URRPHBZ2.hl b/text_formalization/packing/URRPHBZ2.hl new file mode 100755 index 0000000..0ffc387 --- /dev/null +++ b/text_formalization/packing/URRPHBZ2.hl @@ -0,0 +1,972 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: URRPHBZ2 *) +(* Chaper : Packing (Marchal Cells) *) +(* Date : December 2011 *) +(* With special thanks to John Harrison for the lemma OPEN_RCONE_GT *) +(* ========================================================================= *) +(* FILES NEED TO BE LOADED *) + +(* flyspeck_needs "packing/marchal_cells_2.hl";; *) +(* flyspeck_needs "packing/LEPJBDJ.hl" *) + +(* ========================================================================= *) + +module Urrphbz2 = struct + +open Rogers;; +open Vukhacky_tactics;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Sphere;; +open Marchal_cells;; +open Emnwuus;; +open Marchal_cells_2_new;; +open Lepjbdj;; + +let EVENTUALLY_RADIAL_RCONE_GE_ABC_A = prove_by_refinement ( + `!a u0 u1:real^3. eventually_radial u0 (rcone_ge u0 u1 a)`, +[(STRIP_TAC THEN REWRITE_TAC[eventually_radial; radial]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[SET_RULE `a INTER b SUBSET b`]); + (EXISTS_TAC `&1` THEN REWRITE_TAC[REAL_ARITH `&1 > &0`]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `u0 + u IN rcone_ge u0 u1 a INTER ball (u0:real^3,&1)`); + (REWRITE_TAC[rcone_ge; rconesgn; IN_INTER; ball; IN; IN_ELIM_THM; dist; + VECTOR_ARITH `(u + v) - u:real^3 = v /\ (u - (u + t % v)) = (--t % v)`; + NORM_MUL; REAL_ABS_NEG]); + (REWRITE_WITH `abs t = t`); + (ASM_SIMP_TAC[REAL_ARITH `t > &0 ==> &0 <= t`; REAL_ABS_REFL]); + (ASM_REWRITE_TAC[DOT_LMUL]); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `t * a >= (t * b) * c <=> &0 <= (a - b * c) * t`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC)]);; + + +(* ========================================================================== *) +(* This lemma is in multivariate/flyspeck.hl *) +(* ========================================================================== *) + +let OPEN_RCONE_GT = prove + (`!v0 v1:real^N a. open(rcone_gt v0 v1 a)`, + REWRITE_TAC[rcone_gt; rconesgn] THEN + GEOM_ORIGIN_TAC `v0:real^N` THEN REPEAT GEN_TAC THEN + REWRITE_TAC[VECTOR_SUB_RZERO; DIST_0] THEN + MP_TAC(ISPECL [`\x:real^N. lift(x dot v1 - norm x * norm v1 * a)`; + `{x:real^1 | x$1 > &0}`] + CONTINUOUS_OPEN_PREIMAGE_UNIV) THEN + REWRITE_TAC[OPEN_HALFSPACE_COMPONENT_GT] THEN REWRITE_TAC[GSYM drop] THEN + REWRITE_TAC[IN_ELIM_THM; real_gt; REAL_SUB_LT; LIFT_DROP] THEN + DISCH_THEN MATCH_MP_TAC THEN GEN_TAC THEN REWRITE_TAC[LIFT_SUB] THEN + ONCE_REWRITE_TAC[REAL_MUL_SYM] THEN REWRITE_TAC[LIFT_CMUL] THEN + MATCH_MP_TAC CONTINUOUS_SUB THEN ONCE_REWRITE_TAC[DOT_SYM] THEN + REWRITE_TAC[REWRITE_RULE[o_DEF] CONTINUOUS_AT_LIFT_DOT] THEN + MATCH_MP_TAC CONTINUOUS_CMUL THEN + REWRITE_TAC[REWRITE_RULE[o_DEF] CONTINUOUS_AT_LIFT_NORM]);; + +let EVENTUALLY_RADIAL_RCONE_GE_ABC_B = prove_by_refinement ( + `!a u0 u1:real^3. ~(u0 = u1) /\ (&0 < a) /\ (a < &1) ==> + eventually_radial u1 (rcone_ge u0 u1 a)`, +[(STRIP_TAC THEN REWRITE_TAC[eventually_radial; radial]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[SET_RULE `a INTER b SUBSET b`]); + + (NEW_GOAL `u1:real^3 IN rcone_gt u0 u1 a`); + (REWRITE_TAC[rcone_gt;rconesgn; IN; IN_ELIM_THM; GSYM NORM_POW_2; GSYM dist; REAL_POW_2; REAL_ARITH `x * x > x * x * a <=> &0 < (&1 - a) * x * x`]); + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_SIMP_TAC[REAL_ARITH `&0 < a - b <=> b < a`]); + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_SIMP_TAC[DIST_POS_LT]); + + (NEW_GOAL `open (rcone_gt (u0:real^3) u1 a)`); + (ASM_SIMP_TAC[OPEN_RCONE_GT]); + (UP_ASM_TAC THEN REWRITE_TAC[open_def] THEN DISCH_TAC); + (NEW_GOAL `?e. &0 < e /\ + (!x'. dist (x',u1:real^3) < e ==> x' IN rcone_gt u0 u1 a)`); + + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC THEN EXISTS_TAC `e:real`); + (REPEAT STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[IN_INTER] THEN STRIP_TAC); + (MATCH_MP_TAC (SET_RULE `(?b. a IN b /\ b SUBSET c) ==> a IN c`)); + (EXISTS_TAC `rcone_gt (u0:real^3) u1 a`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[dist; VECTOR_ARITH `(a +b:real^3) - a = b`; NORM_MUL]); + (REWRITE_WITH `abs t = t`); + (ASM_SIMP_TAC[REAL_ABS_REFL; REAL_ARITH `t > &0 ==> &0 <= t`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[RCONE_GT_SUBSET_RCONE_GE]); + (REWRITE_TAC[ball; IN; IN_ELIM_THM; dist; VECTOR_ARITH `a - (a + t % b) = (-- t) % b`; NORM_MUL; REAL_ABS_NEG]); + (REWRITE_WITH `abs t = t`); + (ASM_SIMP_TAC[REAL_ABS_REFL; REAL_ARITH `t > &0 ==> &0 <= t`]); + (ASM_REWRITE_TAC[])]);; + +(* ======================================================================= *) + +let EVENTUALLY_RADIAL_AFF_GE = prove_by_refinement( + `!a b c d:real^3. DISJOINT {a,b} {c, d} + ==> eventually_radial a (aff_ge {a,b}{c,d})`, +[(STRIP_TAC THEN REWRITE_TAC[eventually_radial; radial]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[SET_RULE `a INTER b SUBSET b`]); + (EXISTS_TAC `&1` THEN REWRITE_TAC[REAL_ARITH `&1 > &0`]); + (ASM_SIMP_TAC[AFF_GE_2_2]); + (REWRITE_TAC[IN_INTER; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `&1 - t * t2 - t * t3 - t * t4`); + (EXISTS_TAC `t * t2` THEN EXISTS_TAC `t * t3` THEN EXISTS_TAC `t * t4`); + (ASM_SIMP_TAC[REAL_LE_MUL; REAL_ARITH `t > &0 ==> &0 <= t`]); + (STRIP_TAC); + (REAL_ARITH_TAC); + (REWRITE_WITH `u = t1 % a + t2 % b + t3 % c + t4 % d - a:real^3`); + (UNDISCH_TAC `a + u:real^3 = t1 % a + t2 % b + t3 % c + t4 % d` THEN VECTOR_ARITH_TAC); + (REWRITE_WITH +`a + t % (t1 % a + t2 % b + t3 % c + t4 % d - a) = + (&1 - t * t2 - t * t3 - t * t4) % a + + (t * t2) % (b:real^3) + (t * t3) % c + (t * t4) % d + <=> (t * t1 + t * t2 + t * t3 + t * t4 - t) % a = vec 0`); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_ARITH `t * t1 + t * t2 + t * t3 + t * t4 - t = t * ((t1 + + t2 + t3 + t4) - &1)`; REAL_SUB_REFL; REAL_MUL_RZERO; VECTOR_MUL_LZERO]); + (REWRITE_TAC[ball; IN_ELIM_THM; dist; VECTOR_ARITH `a - (a + t % s) = + (-- t) % s`; NORM_MUL; REAL_ABS_NEG]); + (REWRITE_WITH `abs t = t`); + (ASM_SIMP_TAC[REAL_ABS_REFL; REAL_ARITH `t > &0 ==> &0 <= t`]); + (ASM_REWRITE_TAC[])]);; + +(* ======================================================================= *) + +let FUN_AFFINE_KLEMMA = prove_by_refinement ( + `!a:real^3 b c d. + aff_dim {a,b,c} = &2 /\ ~(d IN affine hull {a,b,c}) + ==> ~(a IN convex hull {b,c,d})`, +[(REWRITE_TAC[CONVEX_HULL_3;AFFINE_HULL_3; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `~(w = &0)`); + (NEW_GOAL `?u v w. u + v + w = &1 /\ d = u % a + v % b + w % c:real^3`); + (EXISTS_TAC `&1 / w` THEN EXISTS_TAC `-- u / w` THEN EXISTS_TAC `-- v/ w`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&1 / w + --u / w + --v / w = (&1 - u - v) / w`; + GSYM (ASSUME `u + v + w = &1`); REAL_ARITH `(u + v + w) - u - v = w`]); + (ASM_REWRITE_TAC[] THEN ASM_SIMP_TAC[REAL_DIV_REFL]); + (REWRITE_TAC[VECTOR_ARITH `&1 / w % a + --u / w % b + --v / w % c = + (&1 / w) % (a - u % b - v % c)`]); + (ASM_REWRITE_TAC[VECTOR_ARITH `(a + b + c) - a - b = c:real^3`; VECTOR_MUL_ASSOC]); + (REWRITE_WITH `&1 / w * w = &1`); + (ASM_REWRITE_TAC[GSYM Trigonometry2.NOT_0_INVERTABLE]); + (VECTOR_ARITH_TAC); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (STRIP_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID]); + (STRIP_TAC); + (UNDISCH_TAC `aff_dim {a, b, c:real^3} = &2`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[GSYM AFF_DIM_AFFINE_HULL]); + (REWRITE_WITH `affine hull {a,b,c} = affine hull {b,c:real^3}`); + (MATCH_MP_TAC AFFINE_HULLS_EQ); + (REPEAT STRIP_TAC); + (REWRITE_TAC[SUBSET;AFFINE_HULL_2; + SET_RULE `x IN {a,b,c} <=> (x = a \/x = b \/ x = c)`; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real` THEN ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (EXISTS_TAC `&0` THEN EXISTS_TAC `&1` THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (REWRITE_TAC[SUBSET;AFFINE_HULL_3; + SET_RULE `x IN {b,c} <=> (x = b \/ x = c)`; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `&0` THEN EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (EXISTS_TAC `&0` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&1` THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (ONCE_REWRITE_TAC[AFF_DIM_AFFINE_HULL]); + (REWRITE_TAC[AFF_DIM_2]); + (COND_CASES_TAC); + (ARITH_TAC); + (ARITH_TAC)]);; + +(* ========================================================================== *) +(* ========================================================================== *) +(* The main theorem *) +(* ========================================================================== *) +(* ========================================================================== *) + + +let URRPHBZ2 = prove_by_refinement (URRPHBZ2_concl, +[(REPEAT STRIP_TAC); + (SUBGOAL_THEN `? u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]` CHOOSE_TAC); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (ASM_CASES_TAC `~ (mcell k V ul) (v:real^3)`); + (MATCH_MP_TAC EVENTUALLY_RADIAL_NOT_IN_CLOSED_SET); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[CLOSED_MCELL]); + (UP_ASM_TAC THEN REWRITE_TAC[MESON[] `~ ~A <=> A`] THEN DISCH_TAC); + +(* ====Case 1: k = 0 ====== *) (* FINISHED *) + + (ASM_CASES_TAC `k = 0`); + (NEW_GOAL `v = u0:real^3`); + (REWRITE_WITH `u0:real^3 = HD ul`); + (ASM_REWRITE_TAC[HD]); + (MATCH_MP_TAC ROGERS_INTER_V_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[MCELL_EXPLICIT;mcell0]); + (REWRITE_TAC[DIFF;IN_ELIM_THM]); + (MESON_TAC[IN]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC EVENTUALLY_RADIAL_NOT_IN_CLOSED_SET ); + (STRIP_TAC); + (REWRITE_TAC[MCELL_EXPLICIT; mcell0]); + (REWRITE_TAC[DIFF;IN_ELIM_THM; MESON[] `!X Y. ~(X /\ ~Y) <=> (~X \/ Y) `]); + (DISJ2_TAC); + (REWRITE_TAC[HD;ball;IN;IN_ELIM_THM;DIST_REFL]); + (MATCH_MP_TAC SQRT_POS_LT); + (REAL_ARITH_TAC); + (MATCH_MP_TAC CLOSED_MCELL); + (ASM_MESON_TAC[]); + +(* ====Case 2: k = 1 ====== *) (* Finished *) + + (ASM_CASES_TAC `k = 1`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell1]); + (COND_CASES_TAC); + (REWRITE_TAC[HD;TL;TRUNCATE_SIMPLEX_EXPLICIT_1;rcone_gt;rconesgn]); + (REWRITE_WITH +` rogers V [u0; u1; u2; u3:real^3] INTER cball (u0,sqrt (&2)) DIFF + {x | (x - u0) dot (u1 - u0) > + dist (x,u0) * dist (u1,u0) * hl [u0; u1] / sqrt (&2)} = + rogers V [u0; u1; u2; u3] INTER cball (u0,sqrt (&2)) INTER + {x | (x - u0) dot (u1 - u0) <= + dist (x,u0) * dist (u1,u0) * hl [u0; u1] / sqrt (&2)}`); + (REWRITE_TAC[Vol1.SET_EQ; IN_INTER; IN_DIFF; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `v = u0:real^3`); + (REWRITE_WITH `u0:real^3 = HD ul`); + (ASM_REWRITE_TAC[HD]); + (MATCH_MP_TAC ROGERS_INTER_V_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[IN]); + (NEW_GOAL `mcell 1 V ul (v:real^3)`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[MCELL_EXPLICIT; mcell1]); + (COND_CASES_TAC); + (TRUONG_SET_TAC[]); + (DISCH_TAC THEN NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_MESON_TAC[GSYM IN; NOT_IN_EMPTY]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (MATCH_MP_TAC EVENTUALLY_RADIAL_INTER); + (STRIP_TAC); + (* e_radial rogers *) + (REWRITE_TAC[ROGERS; LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`]); + (REWRITE_TAC [SET_OF_0_TO_3]); + (REWRITE_WITH `IMAGE (omega_list_n V [u0; u1; u2; u3:real^3]) {0, 1, 2, 3} = + {omega_list_n V [u0; u1; u2; u3] 0, omega_list_n V [u0; u1; u2; u3] 1, + omega_list_n V [u0; u1; u2; u3] 2, omega_list_n V [u0; u1; u2; u3] 3}`); + (REWRITE_TAC[IMAGE]); + (SET_TAC[]); + (ABBREV_TAC `a = omega_list_n V [u0; u1; u2; u3:real^3] 0`); + (REWRITE_WITH `a = u0:real^3`); + (EXPAND_TAC "a" THEN REWRITE_TAC[OMEGA_LIST_N;HD]); + + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC EVENTUALLY_RADIAL_CONVEX_HULL_4_sub1); + (ABBREV_TAC `vl = [u0;u1;u2;u3:real^3]`); + + (REWRITE_WITH `u0:real^3 = HD vl`); + (EXPAND_TAC "vl" THEN ASM_REWRITE_TAC[HD]); + (MATCH_MP_TAC U0_NOT_IN_CONVEX_HULL_FROM_ROGERS) ; + (ASM_MESON_TAC[]); + + (* e_radial cball *) + + (MATCH_MP_TAC EVENTUALLY_RADIAL_INTER); + (STRIP_TAC); + (ASM_REWRITE_TAC[eventually_radial]); + (EXISTS_TAC `&1`); + (REWRITE_TAC[radial; REAL_ARITH `&1 > &0`; INTER_SUBSET]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `cball (u0:real^3,sqrt (&2)) INTER ball (u0,&1) = ball (u0, &1)`); + (MATCH_MP_TAC (SET_RULE `b SUBSET a ==> a INTER b = b`)); + (REWRITE_TAC[SUBSET; ball; cball; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `&1 < sqrt (&2)`); + (REWRITE_TAC[ZERO_LT_SQRT_2]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[ball; IN; IN_ELIM_THM; dist; VECTOR_ARITH `a - (a + b:real^3) = --b`; NORM_NEG; NORM_MUL]); + (REWRITE_WITH `abs t = t`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + +(* e_radial R^3 \ rcone_gt *) + + (ASM_REWRITE_TAC[eventually_radial]); + (EXISTS_TAC `&1`); + (REWRITE_TAC[radial; REAL_ARITH `&1 > &0`; INTER_SUBSET; IN_INTER; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (REWRITE_WITH `((u0 + t % u) - u0) dot (u1 - u0:real^3) = + t * (((u0 + u) - u0) dot (u1 - u0))`); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `dist (u0 + t % u,u0) = abs t * dist (u0 + u,u0:real^3)`); + (REWRITE_TAC[dist; VECTOR_ARITH `(a + (b:real^3)) - a = b`; NORM_MUL]); + (REWRITE_WITH `abs t = t`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC [REAL_ARITH `t * s <= (t * a) * b <=> &0 <= t * (a * b - s)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[ball;IN_ELIM_THM]); + (REWRITE_WITH `dist (u0,u0 + t % u) = abs t * norm (u:real^3)`); + (REWRITE_TAC[dist; VECTOR_ARITH `(a + (b:real^3)) - a = b /\ + r:real^3 - (r + t) = -- t`; NORM_MUL; NORM_NEG]); + (REWRITE_WITH `abs t = t`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + (REWRITE_TAC[EVENTUALLY_RADIAL_EMPTY]); + +(* ======================================================================= *) +(* ====Case 2: k >= 4 ====== *) + + (ASM_CASES_TAC `k >= 4`); + (UNDISCH_TAC `mcell k V ul v`); + (REWRITE_WITH `mcell k V ul = mcell4 V ul`); + (MP_TAC MCELL_EXPLICIT THEN STRIP_TAC); + (NEW_GOAL `mcell 0 V ul = mcell0 V ul /\ + mcell 1 V ul = mcell1 V ul /\ + mcell 2 V ul = mcell2 V ul /\ + mcell 3 V ul = mcell3 V ul /\ + (k >= 4 ==> mcell k V ul = mcell4 V ul)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SIMP_TAC[]); + (REWRITE_TAC[mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list]); + (STRIP_TAC); + (ABBREV_TAC `S = {u0, u1,u2, u3:real^3}`); + (ABBREV_TAC `s3 = omega_list V (ul:(real^3)list)`); + + (NEW_GOAL `v IN {u0, u1 ,u2:real^3, u3}`); + (ASM_CASES_TAC `(v:real^3) IN S`); + (ASM_MESON_TAC[]); + (NEW_GOAL `!x:real^3. x IN convex hull S /\ ~(x IN S) + ==> (?y. y IN S /\ norm (x - s3) < norm (y - s3))`); + (MATCH_MP_TAC SIMPLEX_FURTHEST_LT_2); + (EXPAND_TAC "S"); + (REWRITE_TAC[Geomdetail.FINITE6]); + (NEW_GOAL `?y:real^3. y IN S /\ norm (v - s3) < norm (y - s3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[IN]); + (UP_ASM_TAC THEN EXPAND_TAC "S" THEN STRIP_TAC); + (NEW_GOAL `s3 IN (voronoi_closed V (y:real^3))`); + (EXPAND_TAC "s3"); + (MATCH_MP_TAC (SET_RULE `(?b. a IN b /\ b SUBSET c) ==> a IN c`)); + (EXISTS_TAC `voronoi_list V (ul:(real^3)list)`); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[VORONOI_LIST; VORONOI_SET; set_of_list]); + (NEW_GOAL `y:real^3 IN S`); + (ASM_MESON_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[dist]); + (STRIP_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `norm (y - s3) <= norm (v - s3:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (UNDISCH_TAC `v:real^3 IN V` THEN MESON_TAC[IN]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + +(* Case v = u0 *) + (ASM_CASES_TAC `v = u0:real^3`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "S"); + (MATCH_MP_TAC EVENTUALLY_RADIAL_CONVEX_HULL_4_sub1); + (NEW_GOAL `aff_dim {u0,u1,u2,u3:real^3} = &3`); + (REWRITE_WITH `{u0,u1,u2,u3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.MHFTTZN1); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (NEW_GOAL `aff_dim {u0,u1,u2,u3:real^3} <= &3 - &1`); + (REWRITE_WITH `{u0,u1,u2,u3:real^3} = u0 INSERT {u1,u2,u3:real^3}`); + (SET_TAC[]); + (ONCE_REWRITE_TAC[AFF_DIM_INSERT]); + (COND_CASES_TAC); + + (NEW_GOAL `CARD {u1,u2,u3:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (NEW_GOAL `aff_dim {u1, u2, u3} <= &(CARD{u1,u2,u3:real^3}) - &1`); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_TAC[Geomdetail.FINITE6]); + (ASM_ARITH_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `u0 IN affine hull {u1,u2,u3:real^3}`); + (UNDISCH_TAC `u0 IN convex hull {u1, u2, u3:real^3}`); + (MATCH_MP_TAC (SET_RULE `(b SUBSET c) ==> ((a IN b) ==> (a IN c))`)); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + +(* Case v = u1 *) + (ASM_CASES_TAC `v = u1:real^3`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "S"); + (REWRITE_WITH `{u0, u1, u2, u3} = {u1, u0, u2, u3:real^3}`); + (SET_TAC[]); + (MATCH_MP_TAC EVENTUALLY_RADIAL_CONVEX_HULL_4_sub1); + (NEW_GOAL `aff_dim {u1, u0, u2, u3:real^3} = &3`); + (REWRITE_WITH `{u1, u0, u2, u3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (EXPAND_TAC "S" THEN SET_TAC[]); + (MATCH_MP_TAC Rogers.MHFTTZN1); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (NEW_GOAL `aff_dim {u1, u0, u2, u3:real^3} <= &3 - &1`); + (REWRITE_WITH `{u1, u0, u2, u3:real^3} = u1 INSERT {u0,u2,u3:real^3}`); + (SET_TAC[]); + (ONCE_REWRITE_TAC[AFF_DIM_INSERT]); + (COND_CASES_TAC); + + (NEW_GOAL `CARD {u0,u2,u3:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (NEW_GOAL `aff_dim {u0, u2, u3} <= &(CARD{u0,u2,u3:real^3}) - &1`); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_TAC[Geomdetail.FINITE6]); + (ASM_ARITH_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `u1 IN affine hull {u0,u2,u3:real^3}`); + (UNDISCH_TAC `u1 IN convex hull {u0, u2, u3:real^3}`); + (MATCH_MP_TAC (SET_RULE `(b SUBSET c) ==> ((a IN b) ==> (a IN c))`)); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + +(* Case v = u2 *) + (ASM_CASES_TAC `v = u2:real^3`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "S"); + (REWRITE_WITH `{u0, u1, u2, u3} = {u2, u0, u1, u3:real^3}`); + (SET_TAC[]); + (MATCH_MP_TAC EVENTUALLY_RADIAL_CONVEX_HULL_4_sub1); + (NEW_GOAL `aff_dim {u2, u0, u1, u3:real^3} = &3`); + (REWRITE_WITH `{u2, u0, u1, u3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (EXPAND_TAC "S" THEN SET_TAC[]); + (MATCH_MP_TAC Rogers.MHFTTZN1); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (NEW_GOAL `aff_dim {u2, u0, u1, u3:real^3} <= &3 - &1`); + (REWRITE_WITH `{u2, u0, u1, u3:real^3} = u2 INSERT {u0,u1,u3:real^3}`); + (SET_TAC[]); + (ONCE_REWRITE_TAC[AFF_DIM_INSERT]); + (COND_CASES_TAC); + (NEW_GOAL `CARD {u0,u1,u3:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (NEW_GOAL `aff_dim {u0,u1,u3:real^3} <= &(CARD {u0,u1,u3:real^3}) - &1`); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_TAC[Geomdetail.FINITE6]); + (ASM_ARITH_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `u2 IN affine hull {u0,u1,u3:real^3}`); + (UNDISCH_TAC `u2 IN convex hull {u0,u1,u3:real^3}`); + (MATCH_MP_TAC (SET_RULE `(b SUBSET c) ==> ((a IN b) ==> (a IN c))`)); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + +(* Case v = u2 *) + (ASM_CASES_TAC `v = u3:real^3`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "S"); + (REWRITE_WITH `{u0, u1, u2, u3} = {u3, u0, u1, u2:real^3}`); + (SET_TAC[]); + (MATCH_MP_TAC EVENTUALLY_RADIAL_CONVEX_HULL_4_sub1); + (NEW_GOAL `aff_dim {u3, u0, u1, u2:real^3} = &3`); + (REWRITE_WITH `{u3, u0, u1, u2:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (EXPAND_TAC "S" THEN SET_TAC[]); + (MATCH_MP_TAC Rogers.MHFTTZN1); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (NEW_GOAL `aff_dim {u3, u0, u1, u2:real^3} <= &3 - &1`); + (ONCE_REWRITE_TAC[AFF_DIM_INSERT]); + (COND_CASES_TAC); + (NEW_GOAL `CARD {u0,u1,u2:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (NEW_GOAL `aff_dim {u0,u1,u2:real^3} <= &(CARD {u0,u1,u2:real^3}) - &1`); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_TAC[Geomdetail.FINITE6]); + (ASM_ARITH_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `u3 IN affine hull {u0,u1,u2:real^3}`); + (UNDISCH_TAC `u3 IN convex hull {u0,u1,u2:real^3}`); + (MATCH_MP_TAC (SET_RULE `(b SUBSET c) ==> ((a IN b) ==> (a IN c))`)); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + (NEW_GOAL `F`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (STRIP_TAC); + (NEW_GOAL `v:real^3 IN {}`); + (ASM_REWRITE_TAC[IN]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[NOT_IN_EMPTY]); + (ASM_MESON_TAC[]); + +(* ======================================================================= *) +(* ====Case 4: k = 3 ====== *) + + (ASM_CASES_TAC `k = 3`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell3]); + (COND_CASES_TAC); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (NEW_GOAL + `V INTER mcell k V ul = set_of_list (truncate_simplex (k - 1) ul)`); + (MATCH_MP_TAC LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3 /\ 3 <= 4`]); + (STRIP_TAC); + (NEW_GOAL `v IN mcell 3 V ul`); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_2; ARITH_RULE `3 - 1 = 2`]); + (STRIP_TAC); + + (NEW_GOAL `v IN {u0, u1, u2:real^3}`); + (ASM_SET_TAC[]); + (ABBREV_TAC `m = mxi V [u0;u1;u2;u3:real^3]`); + (REWRITE_TAC[SET_RULE `{a,b,c} UNION {d} = {a,b,c,d}`]); + (NEW_GOAL `aff_dim {u0, u1, u2:real^3} = &2`); + (REWRITE_WITH `{u0,u1,u2:real^3} = set_of_list (truncate_simplex 2 ul)`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (MATCH_MP_TAC Rogers.MHFTTZN1); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ASM_MESON_TAC[]); + (NEW_GOAL `~(m IN affine hull {u0,u1,u2:real^3})`); + (ABBREV_TAC `s2 = omega_list_n V [u0; u1; u2; u3] 2`); + (ABBREV_TAC `s3 = omega_list_n V [u0; u1; u2; u3] 3`); + + (NEW_GOAL `s2 IN voronoi_list V [u0;u1;u2:real^3]`); + (EXPAND_TAC "s2"); + (REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `2 = SUC 1`]); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC CLOSEST_POINT_IN_SET); + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); + (UNDISCH_TAC `barV V 3 ul` THEN REWRITE_TAC[BARV]); + (REPEAT STRIP_TAC); + (NEW_GOAL `voronoi_nondg V ([u0;u1;u2:real^3])`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[Sphere.INITIAL_SUBLIST; LENGTH; ARITH_RULE `0 < SUC (SUC (SUC 0))`]); + (EXISTS_TAC `[u3:real^3]` THEN ASM_REWRITE_TAC[APPEND]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[VORONOI_NONDG; LENGTH; + ARITH_RULE `SUC (SUC (SUC 0)) = 3`; AFF_DIM_EMPTY]); + (REWRITE_TAC[ARITH_RULE `-- &1 + &3:int = &3 - &1`]); + (REWRITE_TAC[MESON[INT_OF_NUM_SUB; ARITH_RULE `1 <= 3`] `&3:int - &1 = &(3 - 1)`]); + (REWRITE_TAC[ARITH_RULE `3 - 1= 2 /\ ~(&2:int = &4)`]); + + + (NEW_GOAL `s3 IN voronoi_list V [u0;u1;u2:real^3]`); + (EXPAND_TAC "s3"); + (REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `3 = SUC 2`]); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 2 = 3`; TRUNCATE_SIMPLEX_EXPLICIT_3]); + (MATCH_MP_TAC (SET_RULE `(?b. a IN b /\ b SUBSET c) ==> a IN c`)); + (EXISTS_TAC `voronoi_list V [u0; u1; u2; u3:real^3]`); + (STRIP_TAC); + (MATCH_MP_TAC CLOSEST_POINT_IN_SET); + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); + (UNDISCH_TAC `barV V 3 ul` THEN REWRITE_TAC[BARV]); + (REPEAT STRIP_TAC); + (NEW_GOAL `voronoi_nondg V ([u0;u1;u2;u3:real^3])`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[Sphere.INITIAL_SUBLIST; LENGTH; ARITH_RULE `0 < SUC (SUC (SUC (SUC 0)))`]); + (EXISTS_TAC `[]:(real^3)list` THEN ASM_REWRITE_TAC[APPEND]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[VORONOI_NONDG; LENGTH; + ARITH_RULE `SUC(SUC (SUC (SUC 0))) = 4`; AFF_DIM_EMPTY]); + (REWRITE_TAC[ARITH_RULE `-- &1 + &4:int = &4 - &1`]); + (REWRITE_TAC[MESON[INT_OF_NUM_SUB; ARITH_RULE `1 <= 4`] `&4:int - &1 = &(4 - 1)`]); + (REWRITE_TAC[ARITH_RULE `4 - 1= 3 /\ ~(&3:int = &4)`]); + (REWRITE_TAC[VORONOI_LIST; set_of_list; VORONOI_SET]); + (SET_TAC[]); + + (NEW_GOAL `?s. between s (omega_list_n V ul 2,omega_list_n V ul 3) /\ + dist (u0,s) = sqrt (&2) /\ + mxi V ul = s`); + (MATCH_MP_TAC MXI_EXPLICIT); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_WITH `[u0; u1; u2:real^3] = truncate_simplex 2 [u0; u1; u2; u3]`); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (ASM_REWRITE_TAC[]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC); + (NEW_GOAL `convex hull {s2,s3:real^3} SUBSET voronoi_list V [u0; u1; u2]`); + (REWRITE_WITH `convex hull {s2, s3} SUBSET voronoi_list V [u0; u1; u2:real^3] <=> convex hull {s2, s3} SUBSET convex hull (voronoi_list V [u0; u1; u2])`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `convex hull (voronoi_list V [u0; u1; u2]) = voronoi_list V [u0; u1; u2:real^3]`); + (REWRITE_TAC[CONVEX_HULL_EQ; Packing3.CONVEX_VORONOI_LIST]); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (ASM_SET_TAC[]); + + (NEW_GOAL `s IN voronoi_list V [u0;u1;u2:real^3]`); + (UNDISCH_TAC `between s (s2, s3:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL]); + (ASM_SET_TAC[]); + + (NEW_GOAL `s2 = circumcenter (set_of_list [u0;u1;u2:real^3])`); + (REWRITE_TAC[set_of_list]); + (EXPAND_TAC "s2"); + (MATCH_MP_TAC OMEGA_LIST_2_EXPLICIT_NEW); + (EXISTS_TAC `u3:(real^3)` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`); IN]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `[u0; u1; u2:real^3] = truncate_simplex 2 [u0; u1; u2; u3]`); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (ASM_REWRITE_TAC[]); + + (STRIP_TAC); + (NEW_GOAL `(m - s2:real^3) dot (m - s2) = &0`); + (REWRITE_TAC[ASSUME `s2 = circumcenter (set_of_list [u0; u1; u2:real^3])`]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (REWRITE_TAC[set_of_list]); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[IN_AFFINE_KY_LEMMA1]); + (REWRITE_WITH `[u0; u1; u2:real^3] = truncate_simplex 2 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (UP_ASM_TAC THEN REWRITE_TAC[DOT_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (STRIP_TAC); + (NEW_GOAL `hl (truncate_simplex 2 [u0;u1;u2;u3]) = dist (s, u0:real^3)`); + (REWRITE_WITH `s = s2:real^3`); + (ASM_MESON_TAC[]); + (REWRITE_TAC[ASSUME `s2 = circumcenter (set_of_list [u0; u1; u2:real^3])`]); + (REWRITE_WITH `dist (circumcenter (set_of_list [u0; u1; u2]),u0) = dist + (circumcenter (set_of_list [u0; u1; u2]),HD [u0; u1; u2:real^3])`); + (REWRITE_TAC[HD]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC Rogers.HL_EQ_DIST0); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `[u0; u1; u2:real^3] = truncate_simplex 2 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (UP_ASM_TAC THEN REWRITE_TAC[] THEN ONCE_REWRITE_TAC[DIST_SYM]); + (ASM_REAL_ARITH_TAC); + + + (ASM_CASES_TAC `v = u0:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC EVENTUALLY_RADIAL_CONVEX_HULL_4_sub1); + (MATCH_MP_TAC FUN_AFFINE_KLEMMA); + (ASM_SET_TAC[]); + + (ASM_CASES_TAC `v = u1:real^3`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `{u0, u1, u2, m:real^3} = {u1, u0, u2, m}`); + (SET_TAC[]); + (MATCH_MP_TAC EVENTUALLY_RADIAL_CONVEX_HULL_4_sub1); + (MATCH_MP_TAC FUN_AFFINE_KLEMMA); + (REWRITE_WITH `{u1, u0, u2} = {u0, u1, u2:real^3}`); + (SET_TAC[]); + (ASM_SET_TAC[]); + + (ASM_CASES_TAC `v = u2:real^3`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `{u0, u1, u2, m:real^3} = {u2, u0, u1, m}`); + (SET_TAC[]); + (MATCH_MP_TAC EVENTUALLY_RADIAL_CONVEX_HULL_4_sub1); + (MATCH_MP_TAC FUN_AFFINE_KLEMMA); + (REWRITE_WITH `{u2, u0, u1} = {u0, u1, u2:real^3}`); + (SET_TAC[]); + (ASM_SET_TAC[]); + + (NEW_GOAL `F`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[EVENTUALLY_RADIAL_EMPTY]); + +(* ======================================================================= *) +(* ====Case 5: k = 2 ====== *) + + (ASM_CASES_TAC `k = 2`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2]); + (COND_CASES_TAC); + (LET_TAC); + (REWRITE_TAC[HD;TL]); + (ABBREV_TAC `s3 = omega_list_n V [u0; u1; u2; u3] 3`); + (ABBREV_TAC `m = mxi V [u0; u1; u2; u3]`); + + (NEW_GOAL + `V INTER mcell k V ul = set_of_list (truncate_simplex (k - 1) ul)`); + (MATCH_MP_TAC LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 2 /\ 2 <= 4`]); + (STRIP_TAC); + (NEW_GOAL `v IN mcell 3 V ul`); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1; ARITH_RULE `2 - 1 = 1`]); + (STRIP_TAC); + + (NEW_GOAL `v IN {u0, u1:real^3}`); + (ASM_SET_TAC[]); + (NEW_GOAL `~(u0 = u1:real^3)`); + (STRIP_TAC); + (NEW_GOAL `CARD {u0,u1,u2,u3:real^3} = 4`); + (REWRITE_WITH `{u0,u1,u2,u3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[SET_RULE `{a,a,b,c} = {a,b,c}`]); + (NEW_GOAL `CARD {u1,u2,u3:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + + + + (NEW_GOAL `hl [u0;u1:real^3] = inv(&2) * dist (u1,u0)`); + (REWRITE_WITH `hl [u0;u1:real^3] = + dist (circumcenter (set_of_list [u0;u1]),HD [u0;u1])`); + (MATCH_MP_TAC Rogers.HL_EQ_DIST0); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + (REWRITE_TAC[set_of_list; Rogers.CIRCUMCENTER_2; midpoint; HD; dist]); + (NORM_ARITH_TAC); + + (NEW_GOAL `&0 < a /\ a < &1`); + (EXPAND_TAC "a"); + (REWRITE_TAC[]); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LT_DIV); + (SIMP_TAC[SQRT_POS_LT; ARITH_RULE `&0 < &2`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_SIMP_TAC[REAL_LT_INV; ARITH_RULE `&0 < &2`]); + (MATCH_MP_TAC DIST_POS_LT THEN ASM_MESON_TAC[]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_WITH `hl [u0; u1:real^3] / sqrt (&2) < &1 <=> + hl [u0; u1] < &1 * sqrt (&2)`); + (MATCH_MP_TAC REAL_LT_LDIV_EQ); + (SIMP_TAC[SQRT_POS_LT; ARITH_RULE `&0 < &2`]); + (REWRITE_TAC[REAL_MUL_LID]); + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 [u0; u1; u2; u3]`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC EVENTUALLY_RADIAL_INTER); + (STRIP_TAC); + (ASM_CASES_TAC `v = u0:real^3`); + (ASM_REWRITE_TAC[EVENTUALLY_RADIAL_RCONE_GE_ABC_A]); + (ASM_CASES_TAC `v = u1:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC EVENTUALLY_RADIAL_RCONE_GE_ABC_B); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + + (MATCH_MP_TAC EVENTUALLY_RADIAL_INTER); + (STRIP_TAC); + (ASM_CASES_TAC `v = u1:real^3`); + (ASM_REWRITE_TAC[EVENTUALLY_RADIAL_RCONE_GE_ABC_A]); + (ASM_CASES_TAC `v = u0:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC EVENTUALLY_RADIAL_RCONE_GE_ABC_B); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + +(* ========================================================================== *) + (NEW_GOAL `DISJOINT {u0, u1:real^3} {m, s3}`); +(* ========================================================================== *) + + (ABBREV_TAC `s2 = omega_list_n V ul 2`); + (NEW_GOAL `s2 IN voronoi_list V [u0;u1]`); + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (EXPAND_TAC "s2"); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 2 /\ 2 <= 3`]); + + (NEW_GOAL `s3 IN voronoi_list V [u0;u1]`); + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (EXPAND_TAC "s3"); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3 /\ 3 <= 3`]); + (NEW_GOAL `m IN voronoi_list V [u0; u1]`); + (ASM_CASES_TAC `hl (truncate_simplex 2 (ul:(real^3)list)) < sqrt (&2)`); + (NEW_GOAL `?s. between s (omega_list_n V ul 2,omega_list_n V ul 3) /\ + dist (u0,s) = sqrt (&2) /\ + m = s`); + (EXPAND_TAC "m"); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (MATCH_MP_TAC MXI_EXPLICIT); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC); + + + (NEW_GOAL `convex hull {s2,s3:real^3} SUBSET voronoi_list V [u0; u1]`); + (REWRITE_WITH `convex hull {s2, s3} SUBSET voronoi_list V [u0; u1:real^3] <=> convex hull {s2, s3} SUBSET convex hull (voronoi_list V [u0; u1])`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `convex hull (voronoi_list V [u0; u1]) = voronoi_list V [u0; u1:real^3]`); + (REWRITE_TAC[CONVEX_HULL_EQ; Packing3.CONVEX_VORONOI_LIST]); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (ASM_SET_TAC[]); + + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `between s (s2, s3:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL]); + (ASM_SET_TAC[]); + + (EXPAND_TAC "m" THEN REWRITE_TAC[mxi]); + (COND_CASES_TAC); + (ASM_MESON_TAC[]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `~(m IN {u0,u1:real^3})`); + (REWRITE_TAC[SET_RULE `a IN {b,c} <=> a = b \/ a = c`] THEN STRIP_TAC); + (NEW_GOAL `m:real^3 IN voronoi_closed V u1`); + (UNDISCH_TAC `m IN voronoi_list V [u0; u1]` THEN REWRITE_TAC[VORONOI_LIST; + VORONOI_SET; set_of_list]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (STRIP_TAC); + (NEW_GOAL `dist (u0, u1:real^3) <= dist (u0, u0)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]); + (ASM_SIMP_TAC[DIST_POS_LT]); + + (NEW_GOAL `m:real^3 IN voronoi_closed V u0`); + (UNDISCH_TAC `m IN voronoi_list V [u0; u1]` THEN REWRITE_TAC[VORONOI_LIST; + VORONOI_SET; set_of_list]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (STRIP_TAC); + (NEW_GOAL `dist (u1, u0:real^3) <= dist (u1, u1)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]); + (ASM_SIMP_TAC[DIST_POS_LT]); + + (NEW_GOAL `~(s3 IN {u0, u1:real^3})`); + (REWRITE_TAC[SET_RULE `a IN {b,c} <=> a = b \/ a = c`] THEN STRIP_TAC); + (NEW_GOAL `s3:real^3 IN voronoi_closed V u1`); + (UNDISCH_TAC `s3 IN voronoi_list V [u0; u1]` THEN REWRITE_TAC[VORONOI_LIST; + VORONOI_SET; set_of_list]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (STRIP_TAC); + (NEW_GOAL `dist (u0, u1:real^3) <= dist (u0, u0)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]); + (ASM_SIMP_TAC[DIST_POS_LT]); + + (NEW_GOAL `s3:real^3 IN voronoi_closed V u0`); + (UNDISCH_TAC `s3 IN voronoi_list V [u0; u1]` THEN REWRITE_TAC[VORONOI_LIST; + VORONOI_SET; set_of_list]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (STRIP_TAC); + (NEW_GOAL `dist (u1, u0:real^3) <= dist (u1, u1)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL; REAL_ARITH `~(a <= b) <=> b < a`]); + (ASM_SIMP_TAC[DIST_POS_LT]); + + (REWRITE_TAC[DISJOINT]); + (ASM_SET_TAC[]); + +(* ========================================================================== *) +(* ========================================================================== *) + + (ASM_CASES_TAC `v = u0:real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC EVENTUALLY_RADIAL_AFF_GE); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `v = u1:real^3`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `{u0,u1:real^3} = {u1,u0}`); + (SET_TAC[]); + (MATCH_MP_TAC EVENTUALLY_RADIAL_AFF_GE); + (REWRITE_WITH `{u1,u0:real^3} = {u0,u1}`); + (SET_TAC[]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `F`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[EVENTUALLY_RADIAL_EMPTY]); + + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[])]);; + + +end;; diff --git a/text_formalization/packing/URRPHBZ3.hl b/text_formalization/packing/URRPHBZ3.hl new file mode 100755 index 0000000..b559c0f --- /dev/null +++ b/text_formalization/packing/URRPHBZ3.hl @@ -0,0 +1,71 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: URRPHBZ3 *) +(* Chaper : Packing (Marchal cells) *) +(* *) +(* ========================================================================= *) + +(* ========================================================================= *) +(* FILES NEED TO BE LOADED *) + +(* flyspeck_needs "packing/marchal_cells_2.hl";; *) +(* flyspeck_needs "packing/HDTFNFZ.hl";; *) +(* ========================================================================= *) + +module Urrphbz3 = struct + +open Rogers;; +open Vukhacky_tactics;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Sphere;; +open Marchal_cells;; +open Emnwuus;; +open Marchal_cells_2_new;; +open Lepjbdj;; +open Hdtfnfz;; + + let URRPHBZ3 = prove_by_refinement (URRPHBZ3_concl, +[(REPEAT STRIP_TAC); + (ABBREV_TAC `X = mcell k V ul`); + (SWITCH_TAC); + (UP_ASM_TAC THEN REWRITE_WITH `VX V X = V INTER X`); + (MATCH_MP_TAC HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `k:num`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `A DIFF A INTER B = A DIFF B`; IN_DIFF]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `open ((:real^3) DIFF X)`); + (REWRITE_TAC[GSYM closed]); + (EXPAND_TAC "X" THEN ASM_SIMP_TAC[CLOSED_MCELL]); + (UP_ASM_TAC THEN REWRITE_TAC[OPEN_CONTAINS_CBALL]); + (STRIP_TAC); + (NEW_GOAL `?e. &0 < e /\ cball (v:real^3,e) SUBSET (:real^3) DIFF X`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[cball; SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `e:real`); + (REPEAT STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `e < dist (p, v:real^3) <=> ~(dist (v, p) <= e)`); + (REWRITE_TAC[DIST_SYM]); + (REAL_ARITH_TAC); + (STRIP_TAC); + + (NEW_GOAL `((:real^3) DIFF X) (p:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SIMP_TAC[]); + (NEW_GOAL `~(X (p:real^3))`); + (UP_ASM_TAC); + (REWRITE_WITH `((:real^3) DIFF X) p ==> ~X p <=> p IN ((:real^3) DIFF X) ==> ~(p IN X)`); + (ASM_REWRITE_TAC[IN]); + (SET_TAC[]); + (ASM_MESON_TAC[])]);; + +end;; + diff --git a/text_formalization/packing/YNHYJIT.hl b/text_formalization/packing/YNHYJIT.hl new file mode 100755 index 0000000..e05241a --- /dev/null +++ b/text_formalization/packing/YNHYJIT.hl @@ -0,0 +1,107 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: YNHYJIT *) +(* Chaper : Packing (Marchal cells) *) +(* *) +(* ========================================================================= *) + +(* ========================================================================= *) +(* FILES NEED TO BE LOADED *) +(* + + +*) + +(* ========================================================================= *) + +module Ynhyjit = struct + +open Rogers;; +open Vukhacky_tactics;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Sphere;; +open Marchal_cells;; +open Emnwuus;; +open Marchal_cells_2_new;; +open Lepjbdj;; + + +let YNHYJIT_concl = +`!V ul i p vl. + saturated V /\ packing V /\ barV V 3 ul /\ i IN {2,3,4} /\ + hl (truncate_simplex (i-1) ul) < sqrt (&2) /\ sqrt (&2) <= hl ul /\ + p permutes 0..(i - 1) /\ + vl = left_action_list p ul + ==> barV V 3 vl /\ + (!j. i-1 <= j/\ j <= 3 ==> omega_list_n V vl j = omega_list_n V ul j)`;; +(* ========================================================================= *) +let YNHYJIT = prove_by_refinement (YNHYJIT_concl, + +[(REPEAT GEN_TAC THEN STRIP_TAC); + (ASM_CASES_TAC `i = 2`); + (NEW_GOAL `vl IN barV V 3 /\ + omega_list_n V vl 1 = omega_list_n V ul 1 /\ + omega_list_n V vl 2 = omega_list_n V ul 2 /\ + omega_list_n V vl 3 = omega_list_n V ul 3 /\ + mxi V vl = mxi V ul`); + (MATCH_MP_TAC LEFT_ACTION_LIST_1_PROPERTIES); + (EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[ARITH_RULE `2 - 1 = 1`]); + (UP_ASM_TAC THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_CASES_TAC `j = 1`); + (REWRITE_TAC[ASSUME `j = 1`]); + (ASM_REWRITE_TAC[]); + (ASM_CASES_TAC `j = 2`); + (REWRITE_TAC[ASSUME `j = 2`]); + (ASM_REWRITE_TAC[]); + (ASM_CASES_TAC `j = 3`); + (REWRITE_TAC[ASSUME `j = 3`]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `i = 3`); + (NEW_GOAL `vl IN barV V 3 /\ + omega_list_n V vl 2 = omega_list_n V ul 2 /\ + omega_list_n V vl 3 = omega_list_n V ul 3 /\ + mxi V vl = mxi V ul`); + (MATCH_MP_TAC LEFT_ACTION_LIST_PROPERTIES); + (EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[ARITH_RULE `3 - 1 = 2`]); + (UP_ASM_TAC THEN REWRITE_TAC[IN] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_CASES_TAC `j = 2`); + (REWRITE_TAC[ASSUME `j = 2`]); + (ASM_REWRITE_TAC[]); + (ASM_CASES_TAC `j = 3`); + (REWRITE_TAC[ASSUME `j = 3`]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `i = 4`); + (ASM_SET_TAC[]); + (NEW_GOAL `F`); + (UNDISCH_TAC `hl (truncate_simplex (i - 1) (ul:(real^3)list)) < sqrt (&2)`); + (ASM_REWRITE_TAC[ARITH_RULE `4 - 1 = 3`]); + (REWRITE_WITH `truncate_simplex 3 (ul:(real^3)list) = ul`); + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3 ->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[])]);; + + +end;; + diff --git a/text_formalization/packing/YSSKQOY.hl b/text_formalization/packing/YSSKQOY.hl new file mode 100644 index 0000000..0a5210d --- /dev/null +++ b/text_formalization/packing/YSSKQOY.hl @@ -0,0 +1,584 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Section: Counting Spheres *) +(* Chapter: packing *) +(* Author: Thomas C. Hales *) +(* Date: 2011-06-18 *) +(* ========================================================================== *) + + + +flyspeck_needs "usr/thales/hales_tactic.hl";; + +module Ysskqoy = struct + + open Tactics_jordan;; +open Hales_tactic;; + + +(* ========================================================================== *) +(* Nonlinear inequality hypotheses *) +(* ========================================================================== *) + + +let pack_ineq_tml = + let has_packid = (fun t -> not(intersect ["UKBRPFE";"WAZLDCD";"BIEFJHU"] (Ineq.flypaper_ids t) = [])) in + let idl = (filter has_packid !Ineq.ineqs) in + let tml = map (fun t -> t.ineq) idl in + end_itlist (curry mk_conj) tml;; + +let pack_ineq_def_a = + new_definition (mk_eq (`pack_ineq_def_a:bool`,pack_ineq_tml));; + + +(* ========================================================================== *) +(* some general lemmas *) +(* ========================================================================== *) + + +let selectd = new_definition `selectd P d = + if (?r. P r) then (@) P else (d:A)`;; + +let selectd_cases = prove_by_refinement( + `!P (d:A). P(selectd P d) \/ (selectd P d = d)`, + (* {{{ proof *) + [ + REWRITE_TAC [selectd]; + REPEAT WEAK_STRIP_TAC; + COND_CASES_TAC THEN (ASM_REWRITE_TAC []); + DISJ1_TAC; + MATCH_MP_TAC SELECT_AX; + BY(ASM_REWRITE_TAC []) + ]);; + (* }}} *) + +let selectd_exists = prove_by_refinement( + `!P (d:A). (?r. P r) ==> P(selectd P d)`, + (* {{{ proof *) + [ + REWRITE_TAC[selectd]; + REPEAT GEN_TAC; + SIMP_TAC[SELECT_AX] + ]);; + (* }}} *) + + +let DOT_COMPLEX = prove_by_refinement( + `!x y x' y'. (complex (x,y)) dot (complex (x',y')) = x * x' + y * y'`, + (* {{{ proof *) + [ + SIMP_TAC [ complex;dot; DIMINDEX_2; SUM_2; VECTOR_2 ] + ]);; + (* }}} *) + +let DOT_RE = prove_by_refinement( + `!z1 z2. z1 dot z2 = Re (z1 * cnj z2)`, + (* {{{ proof *) + [ + REWRITE_TAC [ FORALL_COMPLEX;DOT_COMPLEX;complex_mul;RE;IM;RE_CNJ;IM_CNJ ]; + REAL_ARITH_TAC + ]);; + (* }}} *) + +let ARG_CNJ = prove_by_refinement( + `!z w. ~(w = Cx (&0)) ==> Arg (z / w) = Arg (z * cnj w)`, + (* {{{ proof *) + [ + ONCE_REWRITE_TAC [ COMPLEX_DIV_CNJ ]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC [ complex_div; GSYM CX_INV ; COMPLEX_POW_2;COMPLEX_INV_MUL ]; + TYPIFY `&0 < inv (norm w)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC REAL_LT_INV; + REWRITE_TAC [ NORM_POS_LT ]; + BY(ASM_MESON_TAC [COMPLEX_VEC_0]); + ONCE_REWRITE_TAC [ COMPLEX_MUL_ASSOC ]; + ASM_SIMP_TAC [ ONCE_REWRITE_RULE [ COMPLEX_MUL_SYM ] ARG_MUL_CX ] + ]);; + (* }}} *) + +let ARG_0_DIV = prove_by_refinement( + `!u v. ( (u/v) = Cx (&0)) <=> (u = Cx (&0) \/ v = Cx (&0))`, + (* {{{ proof *) + [ + BY(REWRITE_TAC [ COMPLEX_ENTIRE;complex_div;COMPLEX_INV_EQ_0 ]); + ]);; + (* }}} *) + +let CARD_UNION_EQ = prove + (`!(s:B->bool) t u. FINITE u /\ (s INTER t = {}) /\ (s UNION t = u) + ==> (CARD s + CARD t = CARD u)`, + MESON_TAC[CARD_UNION; FINITE_SUBSET; SUBSET_UNION]);; + +let INJ_SURJ = prove_by_refinement( + `!a b (f:A->B). FINITE a /\ FINITE b /\ (CARD a = CARD b) ==> + (INJ f a b ==> SURJ f a b)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ABBREV_TAC `s = IMAGE (f:A->B) a`; + ABBREV_TAC `t = { r | b r /\ ~(?k. a k /\ r = (f:A->B) k) }`; + INTRO_TAC CARD_UNION_EQ [`s`;`t`;`b`]; + ANTS_TAC; + ASM_REWRITE_TAC []; + ONCE_REWRITE_TAC [ FUN_EQ_THM ]; + EXPAND_TAC "s"; + EXPAND_TAC "t"; + HASH_UNDISCH_TAC 4678; + REWRITE_TAC [IMAGE;INTER;UNION;IN_ELIM_THM;INJ]; + REWRITE_TAC [ IN;IN_ELIM_THM;X_IN NOT_IN_EMPTY ]; + BY(MESON_TAC []); + SUBGOAL_THEN `BIJ (f:A->B) a (IMAGE f a)` ASSUME_TAC; + REWRITE_TAC [ BIJ ; Misc_defs_and_lemmas.IMAGE_SURJ ]; + HASH_UNDISCH_TAC 4678; + REWRITE_TAC [ INJ;IMAGE;IN_ELIM_THM ]; + BY(MESON_TAC []); + SUBGOAL_THEN `CARD (a:A->bool) = CARD (s:B->bool)` ASSUME_TAC; + ASM_MESON_TAC [ Misc_defs_and_lemmas.BIJ_CARD ]; + DISCH_TAC; + SUBGOAL_THEN ` (t:B->bool) HAS_SIZE 0` ASSUME_TAC; + REWRITE_TAC [HAS_SIZE]; + CONJ_TAC; + MATCH_MP_TAC FINITE_SUBSET; + EXISTSv_TAC "b"; + ASM_REWRITE_TAC []; + EXPAND_TAC "t"; + SET_TAC[]; + BY(ASM_MESON_TAC [ ARITH_RULE `x + (t:num) = x ==> (t = 0)` ]); + HASH_RULE_TAC 526 (REWRITE_RULE [ HAS_SIZE_0 ]); + EXPAND_TAC "t"; + HASH_UNDISCH_TAC 4678; + REWRITE_TAC [ SURJ;INJ;IN_ELIM_THM;IN ]; + ONCE_REWRITE_TAC [ FUN_EQ_THM ]; + REWRITE_TAC [ SURJ;INJ;IN_ELIM_THM;IN;X_IN NOT_IN_EMPTY ]; + BY(MESON_TAC []) + ]);; + (* }}} *) + +let INJ_IFF_SURJ = prove_by_refinement( + `!a b (f:A->B). FINITE a /\ FINITE b /\ (CARD a = CARD b) ==> + (INJ f a b <=> SURJ f a b)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + EQ_TAC; + MATCH_MP_TAC INJ_SURJ; + BY(ASM_MESON_TAC []); + DISCH_TAC; + HASH_COPY_TAC 6181; + HASH_UNDISCH_TAC 6181; + DISCH_THEN (MP_TAC o (MATCH_MP Misc_defs_and_lemmas.INVERSE_DEF)); + REPEAT WEAK_STRIP_TAC; + TYPIFY `SURJ (INVERSE f a b) b a` (C SUBGOAL_THEN MP_TAC); + HASH_UNDISCH_TAC 7518; + MATCH_MP_TAC INJ_SURJ; + BY(ASM_REWRITE_TAC []); + DISCH_TAC; + REWRITE_TAC [ INJ ]; + SUBCONJ_TAC; + ASM_MESON_TAC [ SURJ ]; + DISCH_TAC; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `(?r1 r2. r1 IN b /\ r2 IN b /\ x = (INVERSE (f:A->B) a b r1) /\ (y = (INVERSE f a b r2)))` MP_TAC; + ASM_MESON_TAC [SURJ]; + REPEAT WEAK_STRIP_TAC; + ASM_MESON_TAC [] + ]);; + (* }}} *) + +let NORM1_NZ = prove_by_refinement( + `!(a:real^N). norm a = &1 ==> ~(a = vec 0)`, + (* {{{ proof *) + [ +MESON_TAC [NORM_0;REAL_ARITH `~(&1 = &0)`] + ]);; + (* }}} *) + +(* from tame *) + +let normalize = new_definition `!(v:real^N). normalize v = inv (norm v) % v`;; + +let norm_normalize = prove_by_refinement( + `! (v:real^N). ~(v = vec 0) ==> norm (normalize v) = &1 `, +[ +(GEN_TAC THEN STRIP_TAC); +(PURE_REWRITE_TAC[normalize;NORM_MUL;REAL_ABS_INV;REAL_ABS_NORM]); +(MATCH_MP_TAC REAL_MUL_LINV); +(ASM_MESON_TAC[NORM_EQ_0]); +]);; + +let NZ_IMP_NORM1 = prove_by_refinement( + `!(a:real^N) b. ~(a = vec 0) ==> + (?a' b'. (norm a' = &1) /\ + (!x. (a dot x <= b) <=> (a' dot x <= b') ) /\ + (!x. (a dot x = b) <=> (a' dot x = b') ))`, + (* {{{ proof *) + [ +REPEAT STRIP_TAC ; +EXISTS_TAC `normalize (a:real^N)`; +EXISTS_TAC `inv(norm (a:real^N)) * b`; +ASM_SIMP_TAC [norm_normalize]; +ASM_SIMP_TAC [norm_normalize]; +REWRITE_TAC [normalize;DOT_LMUL]; +FIRST_X_ASSUM (ASSUME_TAC o (REWRITE_RULE[GSYM NORM_POS_LT])); +FIRST_X_ASSUM (ASSUME_TAC o (ONCE_REWRITE_RULE[GSYM REAL_LT_INV_EQ])); +ASM_SIMP_TAC [REAL_LE_LMUL_EQ]; +ASM_MESON_TAC [REAL_EQ_MUL_LCANCEL;REAL_ARITH `&0 < u ==> ~(u= &0)`] + ]);; + (* }}} *) + + + +let RE_CEXP_CX = prove_by_refinement( + `!x. Re( cexp (ii * Cx x)) = cos x`, + (* {{{ proof *) + [ + REWRITE_TAC [ RE_CEXP; RE_MUL_II; IM_CX; IM_MUL_II; RE_CX ; REAL_ARITH `-- &0 = &0`; REAL_EXP_0; REAL_ARITH `&1 * x = x` ] + ]);; + (* }}} *) + +let norm_normalize = prove_by_refinement( + `! (v:real^N). ~(v = vec 0) ==> norm (normalize v) = &1 `, +[ +(GEN_TAC THEN STRIP_TAC); +(PURE_REWRITE_TAC[normalize;NORM_MUL;REAL_ABS_INV;REAL_ABS_NORM]); +(MATCH_MP_TAC REAL_MUL_LINV); +(ASM_MESON_TAC[NORM_EQ_0]); +]);; + + +let RE_NORM_1 = prove_by_refinement( + `!z. norm z = &1 ==> Re ( z ) = cos (Arg z)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + CONV_TAC (PATH_CONV "l" (ONCE_REWRITE_CONV[ARG])); + ASM_REWRITE_TAC [ COMPLEX_MUL_LID ; RE_CEXP_CX] + ]);; + (* }}} *) + +let COS_ARG_VECTOR_ANGLE = prove_by_refinement( + `! u v. ~(u = Cx (&0)) /\ ~(v = Cx (&0)) ==> cos (Arg (u/v)) = cos (vector_angle u v)`, + (* {{{ proof *) + [ + REWRITE_TAC [ GSYM COMPLEX_VEC_0 ]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC [ COS_VECTOR_ANGLE]; + ASM_SIMP_TAC [ ]; + TYPIFY `(u dot v) / (norm u * norm v) = (normalize u dot normalize v)` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC [ normalize; DOT_LMUL; DOT_RMUL; real_div; REAL_INV_MUL ]; + BY(REAL_ARITH_TAC); + SUBGOAL_THEN `~(u/v = Cx (&0))` ASSUME_TAC; + BY(ASM_MESON_TAC [ COMPLEX_VEC_0; ARG_0_DIV ]); + REWRITE_TAC [ DOT_RE ]; + TYPIFY `norm (normalize u) = &1 /\ norm (normalize v) = &1` (C SUBGOAL_THEN MP_TAC); + BY(ASM_SIMP_TAC [norm_normalize]); + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN ( `normalize u * cnj (normalize v) = normalize u/ normalize v`) SUBST1_TAC; + ONCE_REWRITE_TAC [ COMPLEX_DIV_CNJ ]; + BY(ASM_REWRITE_TAC [ COMPLEX_DIV_1 ; COMPLEX_POW_ONE ]); + TYPIFY `norm (normalize u / normalize v) = &1` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_REWRITE_TAC [ COMPLEX_NORM_DIV ; REAL_ARITH `&1 / &1 = &1`]); + ASM_SIMP_TAC [RE_NORM_1]; + AP_TERM_TAC; + REWRITE_TAC [ normalize; COMPLEX_CMUL ; complex_div ; REAL_INV_MUL; COMPLEX_INV_MUL; CX_INV; COMPLEX_INV_INV; GSYM COMPLEX_MUL_ASSOC]; + REWRITE_TAC [ GSYM CX_INV ]; + TYPIFY `&0 < inv (norm u) /\ &0 < norm v` (C SUBGOAL_THEN ASSUME_TAC); + BY(CONJ_TAC THEN (TRY (MATCH_MP_TAC REAL_LT_INV)) THEN (ASM_SIMP_TAC [NORM_POS_LT])); + ASM_SIMP_TAC [ ARG_MUL_CX ]; + CONV_TAC (PATH_CONV "rrl" (ONCE_REWRITE_CONV[ COMPLEX_MUL_SYM ])); + ONCE_REWRITE_TAC [ COMPLEX_MUL_ASSOC ]; + CONV_TAC (PATH_CONV "rrl" (ONCE_REWRITE_CONV[ COMPLEX_MUL_SYM ])); + REWRITE_TAC [ GSYM COMPLEX_MUL_ASSOC ]; + BY(ASM_SIMP_TAC [ ARG_MUL_CX ]) + ]);; + (* }}} *) + +let SEC_DOT = prove_by_refinement( + `!u v r psi. + &0 < r /\ + &0 <= psi /\ psi < pi / &2 /\ + norm (v) = r * inv(cos psi) /\ + norm (u) = r /\ + cos (vector_angle u v) = cos psi ==> (u dot (v - u) = &0)` , + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC [ DOT_RSUB]; + ASM_SIMP_TAC [ DOT_SQUARE_NORM ]; + ASM_SIMP_TAC [ VECTOR_ANGLE ]; + REWRITE_TAC [ GSYM REAL_MUL_ASSOC ]; + SUBGOAL_THEN `inv(cos psi) * cos psi = &1` SUBST1_TAC; + MATCH_MP_TAC REAL_MUL_LINV; + MATCH_MP_TAC (REAL_ARITH `&0 < x ==> ~(x = &0)`); + MATCH_MP_TAC COS_POS_PI; + MP_TAC PI_POS; + BY (ASM_REAL_ARITH_TAC); + BY (REAL_ARITH_TAC) + ]);; + (* }}} *) + + + + + +(* YSSKQOY *) + + +(* great study example. It is an obvious conseq. of + Trigonometry1.ACS_ARCLENGTH, but a direct match doesn't work *) + +let arclength2 = prove_by_refinement( + `!h. (&1 <= h /\ h <= h0) ==> arclength (&2) (&2 * h) (&2) = acs(h / &2)`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + MP_TAC (SPECL [`&2`;`&2 * h`;`&2`] Trigonometry1.ACS_ARCLENGTH); + BRANCH_A [ + ANTS_TAC ; + MP_TAC Sphere.h0; + ASM_REAL_ARITH_TAC; + ]; + DISCH_THEN SUBST1_TAC; + AP_TERM_TAC; + UNDISCH_TAC `&1 <= h`; + BY (CONV_TAC REAL_FIELD); + ]);; + (* }}} *) + + +let yssk_reduction = prove_by_refinement( + `(!a1 a2 b1 b2. (&2 <= a1) /\ (a1 <= a2) /\ (a2 <= &2 * h0) /\ + (&2 <= b1 /\ b1 <= b2 /\ b2 <= &2 * h0) ==> + (&0 <= arclength a2 b2 (&2) - arclength a1 b2 (&2) - arclength a2 b1 (&2) + + arclength a1 b1 (&2))) ==> + (!h h'. (&1 <= h) /\ (h <= h0) /\ (&1 <= h') /\ (h' <= h0) ==> + acs (h/ &2) + acs (h'/ &2) - pi/ &3 <= arclength (&2 * h) (&2 * h') (&2))`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + FIRST_X_ASSUM (fun t -> MP_TAC(SPECL[`&2`;`&2 * h`;`&2`;`&2 * h'`] t)); + BRANCH_A [ + ANTS_TAC ; + MP_TAC Sphere.h0; + ASM_REAL_ARITH_TAC; + ]; + MATCH_MP_TAC (REAL_ARITH ` (b = b') /\ (c = c') /\ (d = d') ==> ((&0 <= a - b - c +d) ==> c' + b' - d' <= a)`); + SUBST1_TAC (SPECL[`&2 * h`;`&2`;`&2`] Arc_properties.arc_sym); + ASM_SIMP_TAC [arclength2;Arc_properties.arc_sym;]; + MP_TAC (SPEC `&1` arclength2); + BY(REWRITE_TAC[REAL_ARITH `&2 * &1 = &2`;Nonlinear_lemma.ACS_2;Sphere.h0;REAL_ARITH `&1 <= &1 /\ &1 <= #1.26`]); +]);; + (* }}} *) + + let TRI_UPS_X_STRICT_POS = prove + (`!a b c. (&0 < a) /\ (&0 < b) /\ (&0 <= c) /\ (c < a + b) /\ (a < b + c) /\ (b < c + a) ==> + &0 < ups_x (a * a) (b * b) (c * c)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC [Trigonometry1.UPS_X_SQUARES] THEN + BY(REPEAT (MATCH_MP_TAC REAL_LT_MUL ORELSE CONJ_TAC ORELSE + ASM_REAL_ARITH_TAC)));; + + let ups_x_pos = prove_by_refinement( + `!a b. &2 <= a /\ a <= #2.52 /\ &2 <= b /\ b <= #2.52 ==> &0 < ups_x (a pow 2) (b pow 2) (&4)`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[REAL_ARITH `&4 = &2 * &2 /\ a pow 2 = a*a`]; + MATCH_MP_TAC TRI_UPS_X_STRICT_POS; + BY(ASM_REAL_ARITH_TAC); + ]);; + (* }}} *) + +(* + let expand_poly_tac = REWRITE_TAC[REAL_ADD_LDISTRIB;REAL_ADD_RDISTRIB;REAL_ARITH `-- -- x = x /\ -- (x + y ) = -- x - y /\ -- (x - y) = y - x /\ (a * b) * c = a * b * c /\ x - (u - v) = x + v - u /\ (x - y) - z = x - y - z /\ (x - y) * z = x * z - y * z /\ (-- (a * b) = (-- a) * b) /\ (a + b) + c = a + b + c /\ x*(y-z) = x * y - x * z `;REAL_POW_MUL];; +*) + + + +let arc_derivative = prove_by_refinement( + `!a b. (&2 <= a /\ a <= #2.52) /\ &2 <= b /\ b <= #2.52 + ==>( ((\x. arclength x b (&2)) has_real_derivative + (-- (&4 + a pow 2 - b pow 2) / (a * sqrt(ups_x (a pow 2) (b pow 2) (&4)) ))) + (atreal a within real_interval [&2,#2.52]))`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + MP_TAC (SPECL [`a:real`;`b:real`] Arc_properties.arc_derivative); + ASM_REWRITE_TAC[]; + FORCE_MATCH; + BRANCH_A [ + ( SUBGOAL_THEN `(&0 < a) /\ (&0 < b) /\ &0 < ups_x (a pow 2) (b pow 2) (&4)` ASSUME_TAC) ; + ( REPEAT (CONJ_TAC ORELSE MATCH_MP_TAC ups_x_pos ORELSE ASM_REAL_ARITH_TAC)); + ]; + SUBGOAL_THEN `(&1 - ((a * a + b * b - &2 * &2) / (&2 * a * b)) pow 2) = (inv (&2 * a * b)) pow 2 * (ups_x (a pow 2) (b pow 2) (&4)) ` SUBST1_TAC; + REWRITE_TAC[Sphere.ups_x]; + FIRST_X_ASSUM MP_TAC; + BY(CONV_TAC REAL_FIELD); + BRANCH_A [ + SUBGOAL_THEN `((a + a) * &2 * a * b - (a * a + b * b - &2 * &2) * &2 * b) = ( &2 * b * (&4 + a pow 2 - b pow 2))` SUBST1_TAC; + BY ( CONV_TAC REAL_FIELD); + ]; + MP_TAC (SPECL[`inv(&2 * a * b)`;`ups_x (a pow 2) (b pow 2) (&4)`] (GSYM Trigonometry1.SQRT_MUL_L)); + BRANCH_A [ + ANTS_TAC; + REWRITE_TAC[REAL_LE_INV_EQ] THEN + BY(REPEAT (CONJ_TAC ORELSE MATCH_MP_TAC REAL_LE_MUL ORELSE ASM_REAL_ARITH_TAC)); + ]; + DISCH_THEN SUBST1_TAC; + FIRST_X_ASSUM MP_TAC; + BY(CONV_TAC REAL_FIELD); + ]);; + (* }}} *) + +let arc_derivative2 = prove_by_refinement( + `!a b. (&2 <= a /\ a <= #2.52) /\ &2 <= b /\ b <= #2.52 + ==>( ((\x. -- (&4 + a pow 2 - x pow 2)/(a * sqrt(ups_x (a pow 2) (x pow 2) (&4)))) + has_real_derivative + (&32 * a * b /( (sqrt (ups_x (a pow 2) (b pow 2) (&4))) pow 3))) + (atreal b within real_interval [&2,#2.52]))`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + REWRITE_TAC[Sphere.ups_x]; + MP_TAC (REWRITE_RULE[Calc_derivative.derived_form] (Calc_derivative.differentiate `(\x. --(&4 + a pow 2 - x pow 2) / (a * sqrt (--(a pow 2) * a pow 2 - x pow 2 * x pow 2 - &4 * &4 + &2 * a pow 2 * &4 + &2 * a pow 2 * x pow 2 + &2 * x pow 2 * &4)))` `b:real` `real_interval [&2,#2.52]`)); + REWRITE_TAC[GSYM Sphere.ups_x]; + BRANCH_A [ + SUBGOAL_THEN `&0 < ups_x (a pow 2) (b pow 2) (&4) ` ASSUME_TAC; + REWRITE_TAC[REAL_ARITH `a pow 2 = a * a /\ &4 = &2 * &2`]; + MATCH_MP_TAC TRI_UPS_X_STRICT_POS; + BY(ASM_REAL_ARITH_TAC); + ]; + ASM_REWRITE_TAC[REAL_ENTIRE;TAUT `~(a\/b) <=> ~a /\ ~b`]; + BRANCH_A [ + SUBGOAL_THEN `~(sqrt( ups_x (a pow 2) (b pow 2) (&4)) = &0) ` ASSUME_TAC; + ASM_SIMP_TAC[SQRT_EQ_0;REAL_ARITH `&0 < u ==> &0 <= u`]; + BY(ASM_REAL_ARITH_TAC); + ]; + ASM_REWRITE_TAC[]; + BRANCH_A [ + ANTS_TAC; + (FIRST_X_ASSUM (fun t -> MP_TAC t THEN REAL_ARITH_TAC)); + ]; + FORCE_MATCH; + ABBREV_TAC `c = ups_x (a pow 2) (b pow 2) (&4)`; + Calc_derivative.CALC_ID_TAC; + ASM_SIMP_TAC[REAL_ARITH `~(&2 = &0) /\ (&2 <= a ==> ~(a = &0))`]; + BRANCH_A [ + SUBGOAL_THEN `sqrt c pow 2 = ups_x (a pow 2) (b pow 2) (&4)` MP_TAC; + EXPAND_TAC "c"; + MATCH_MP_TAC SQRT_POW_2; + BY(ASM_MESON_TAC[REAL_ARITH `&0 < c ==> &0 <= c`]) + ]; + ABBREV_TAC `d = sqrt c`; + REWRITE_TAC[Sphere.ups_x]; + BY(CONV_TAC REAL_RING); + ]);; + (* }}} *) + +(* This is a good candidate for automation, long but trivial *) + +let arc_length2_increasing = prove_by_refinement( + `!a b1 b2. (&2 <= a /\ a <= #2.52) /\ &2 <= b1 /\ b1 <= #2.52 /\ &2 <= b2 /\ b2 <= #2.52 /\ b1 <= b2 ==> + let fa = (\x. -- (&4 + a pow 2 - x pow 2)/(a * sqrt(ups_x (a pow 2) (x pow 2) (&4)))) in + ( + fa b1 <= fa b2 + )`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + LET_TAC; + ABBREV_TAC `fa' = \x. (&32 * a * x /( (sqrt (ups_x (a pow 2) (x pow 2) (&4))) pow 3))`; + MP_TAC (SPECL[`fa:real->real`;`fa':real->real`;`b1:real`;`b2:real`] REAL_MVT_VERY_SIMPLE); + ASM_REWRITE_TAC[IN_ELIM_THM;IN;]; + ANTS_TAC; + REPEAT STRIP_TAC; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_WITHIN_SUBSET; + EXISTS_TAC `real_interval [&2, #2.52]`; + CONJ_TAC; + EXPAND_TAC "fa"; + EXPAND_TAC "fa'"; + MATCH_MP_TAC arc_derivative2; + REPEAT (POP_ASSUM MP_TAC) THEN REWRITE_TAC[real_interval;IN_ELIM_THM]; + REAL_ARITH_TAC; + REWRITE_TAC[real_interval;SUBSET;IN_ELIM_THM]; + GEN_TAC; + ASM_REAL_ARITH_TAC; + REWRITE_TAC[real_interval;IN_ELIM_THM]; + REPEAT STRIP_TAC; + ONCE_REWRITE_TAC[REAL_ARITH `(x <= y) = (&0 <= y - x)`]; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_MUL; + CONJ_TAC THENL [ALL_TAC;ASM_MESON_TAC[REAL_ARITH `x <= y ==> &0 <= y -x`]]; + EXPAND_TAC "fa'"; + REWRITE_TAC [real_div]; + REPEAT ((MATCH_MP_TAC REAL_LE_MUL) ORELSE CONJ_TAC ORELSE ASM_REAL_ARITH_TAC); + REWRITE_TAC[REAL_LE_INV_EQ]; + MATCH_MP_TAC REAL_POW_LE; + MATCH_MP_TAC SQRT_POS_LE; + REWRITE_TAC[REAL_ARITH `a pow 2 = a*a /\ &4 = &2 * &2`]; + MATCH_MP_TAC Trigonometry1.TRI_UPS_X_POS; + ASM_REAL_ARITH_TAC; + ]);; + (* }}} *) + +let arc_length1_increasing = prove_by_refinement( + `!a1 a2 b1 b2. (&2 <= a1) /\ (a1 <= a2) /\ (a2 <= #2.52) /\ + (&2 <= b1 /\ b1 <= b2 /\ b2 <= #2.52) ==> + (let f = \x. arclength x b2 (&2) - arclength x b1 (&2) in + (f a1 <= f a2))`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + LET_TAC; + ABBREV_TAC `fa = \b a. (-- (&4 + a pow 2 - b pow 2) / (a * sqrt(ups_x (a pow 2) (b pow 2) (&4)) ))`; + MP_TAC (SPECL [`f:real->real`;`\(a:real). (((fa:real->real->real) b2 a - fa b1 a):real)`;`a1:real`;`a2:real`] REAL_MVT_VERY_SIMPLE); + ASM_REWRITE_TAC[IN;IN_ELIM_THM]; + (* BRANCH will go 3 deep *) + ANTS_TAC; + REPEAT STRIP_TAC; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_WITHIN_SUBSET; + EXISTS_TAC `real_interval [&2, #2.52]`; + CONJ_TAC; + EXPAND_TAC "f"; + MATCH_MP_TAC HAS_REAL_DERIVATIVE_SUB; + EXPAND_TAC "fa"; + CONJ_TAC THEN MATCH_MP_TAC arc_derivative THEN FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[IN_ELIM_THM;real_interval] THEN (ASM_REAL_ARITH_TAC); + REWRITE_TAC[SUBSET;real_interval;IN_ELIM_THM]; + ASM_REAL_ARITH_TAC; + REWRITE_TAC[SUBSET;real_interval;IN_ELIM_THM]; + REPEAT STRIP_TAC; + ONCE_REWRITE_TAC[REAL_ARITH `x <= y <=> &0 <= y - x`]; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_MUL; + CONJ_TAC THENL[ALL_TAC;UNDISCH_TAC `a1 <= a2` THEN REAL_ARITH_TAC]; + MP_TAC (SPECL[`x:real`;`b1:real`;`b2:real`] arc_length2_increasing); + LET_TAC; + EXPAND_TAC "fa'"; + EXPAND_TAC "fa"; + ANTS_TAC; + ASM_REAL_ARITH_TAC; + REAL_ARITH_TAC; + ]);; + (* }}} *) + +let YSSKQOY= prove_by_refinement( + ` (!h h'. (&1 <= h) /\ (h <= h0) /\ (&1 <= h') /\ (h' <= h0) ==> + acs (h/ &2) + acs (h'/ &2) - pi/ &3 <= arclength (&2 * h) (&2 * h') (&2))`, + (* {{{ proof *) + [ + MATCH_MP_TAC yssk_reduction; + REPEAT STRIP_TAC; + MP_TAC (SPECL[`a1:real`;`a2:real`;`b1:real`;`b2:real` ] arc_length1_increasing); + LET_TAC; + EXPAND_TAC "f"; + ASM_REWRITE_TAC[]; + BRANCH_A [ + ANTS_TAC; + MP_TAC Sphere.h0; + ASM_REAL_ARITH_TAC; + ]; + REAL_ARITH_TAC; + ]);; + (* }}} *) + + end;; diff --git a/text_formalization/packing/bump.hl b/text_formalization/packing/bump.hl new file mode 100644 index 0000000..0ff8c2e --- /dev/null +++ b/text_formalization/packing/bump.hl @@ -0,0 +1,1294 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Packing *) +(* Lemma: OXLZLEZ *) +(* Author: Thomas C. Hales *) +(* Date: 2012-12-31 *) +(* ========================================================================== *) + +(* REDO THE beta_bump *) + + + +module Bump = struct + + open Hales_tactic;; + +let WEAK_SELECT_TAC = + let unbeta = prove( + `!(P:A->bool) (Q:A->bool). (Q ((@) P)) <=> (\t. Q t) ((@) P)`,MESON_TAC[]) in + let unbeta_tac = CONV_TAC (HIGHER_REWRITE_CONV[unbeta] true) in + unbeta_tac THEN (MATCH_MP_TAC Tactics.SELECT_THM) THEN BETA_TAC THEN + REPEAT WEAK_STRIP_TAC;; + +let BETA_ORDERED_PAIR_THM = prove_by_refinement( + `!(g:A->B->C) x. + ((\ ( u, v). g u v) x = g (FST x) (SND x))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + INTRO_TAC (GSYM PAIR) [`x`]; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[GABS_DEF;GEQ_DEF]) + ]);; + (* }}} *) + +let BIJ_SUM = prove_by_refinement( + `!(A:A->bool) (B:B->bool) f ab. + BIJ ab A B ==> (sum A (f o ab) = sum B f)`, + (* {{{ proof *) + [ + REWRITE_TAC[BIJ;INJ]; + BY(ASM_MESON_TAC[ SUM_IMAGE ; Misc_defs_and_lemmas.SURJ_IMAGE ]) + ]);; + (* }}} *) + +let EL_EXPLICIT = prove_by_refinement( + `!h t. EL 0 (CONS (h:a) t) = h /\ + EL 1 (CONS h t) = EL 0 t /\ + EL 2 (CONS h t) = EL 1 t /\ + EL 3 (CONS h t) = EL 2 t /\ + EL 4 (CONS h t) = EL 3 t /\ + EL 5 (CONS h t) = EL 4 t /\ + EL 6 (CONS h t) = EL 5 t`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[EL;HD;TL;arith `6 = SUC 5 /\ 5 = SUC 4 /\ 4 = SUC 3 /\ 3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]) + ]);; + (* }}} *) + +let LENGTH1 = prove_by_refinement( + `!ul:(A) list. LENGTH ul = 1 ==> ul = [EL 0 ul]`, + (* {{{ proof *) + [ + REWRITE_TAC[LENGTH_EQ_CONS;arith `1 = SUC 0`;LENGTH_EQ_NIL]; + REPEAT WEAK_STRIP_TAC; + BY(ASM_REWRITE_TAC[EL;HD]) + ]);; + (* }}} *) + +let LENGTH2 = prove_by_refinement( + `!ul:(A) list. LENGTH ul = 2 ==> ul = [EL 0 ul;EL 1 ul]`, + (* {{{ proof *) + [ + REWRITE_TAC[LENGTH_EQ_CONS;arith `2 = SUC 1`]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (unlist ONCE_REWRITE_TAC o (MATCH_MP LENGTH1)); + BY(REWRITE_TAC[EL;HD;arith `1 = SUC 0`;TL]) + ]);; + (* }}} *) + +let LENGTH3 = prove_by_refinement( + `!(ul:(A)list). LENGTH ul = 3 ==> ul = [EL 0 ul; EL 1 ul; EL 2 ul]`, + (* {{{ proof *) + [ + REWRITE_TAC[LENGTH_EQ_CONS;arith `3 = SUC 2`]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (unlist ONCE_REWRITE_TAC o (MATCH_MP LENGTH2)); + BY(REWRITE_TAC[EL;HD;arith `1 = SUC 0`;arith `2 = SUC 1`;TL]) + ]);; + (* }}} *) + +let LENGTH4 = prove_by_refinement( + `!(ul:(A)list). LENGTH ul = 4 ==> ul = [EL 0 ul; EL 1 ul; EL 2 ul; EL 3 ul]`, + (* {{{ proof *) + [ + REWRITE_TAC[LENGTH_EQ_CONS;arith `4 = SUC 3`]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM (unlist ONCE_REWRITE_TAC o (MATCH_MP LENGTH3)); + BY(REWRITE_TAC[EL;HD;arith `1 = SUC 0`;arith `2 = SUC 1`;arith `3 = SUC 2`;TL]) + ]);; + (* }}} *) + +let set_of_list2 = prove_by_refinement( + `!(ul:(A) list). LENGTH ul = 2 ==> set_of_list ul = {EL 0 ul, EL 1 ul}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP LENGTH2)); + ABBREV_TAC `a:A = EL 0 ul`; + ABBREV_TAC `b:A = EL 1 ul`; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[set_of_list]) + ]);; + (* }}} *) + +let set_of_list2_explicit = prove_by_refinement( + `!(a:A) b. set_of_list [a;b] = {a,b}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC set_of_list2; + BY(REWRITE_TAC[LENGTH;EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1`]) + ]);; + (* }}} *) + +let set_of_list3 = prove_by_refinement( + `!(ul:(A) list). LENGTH ul = 3 ==> set_of_list ul = {EL 0 ul, EL 1 ul, EL 2 ul}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP LENGTH3)); + ABBREV_TAC `a:A = EL 0 ul`; + ABBREV_TAC `b:A = EL 1 ul`; + ABBREV_TAC `c:A = EL 2 ul`; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[set_of_list]) + ]);; + (* }}} *) + +let set_of_list3_explicit = prove_by_refinement( + `!(a:A) b c. set_of_list [a;b;c] = {a,b,c}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC set_of_list3; + BY(REWRITE_TAC[EL;HD;TL;arith `2 = SUC 1 /\ 1 = SUC 0 /\ 3 = SUC 2 /\ 4 = SUC 3`;LENGTH]) + ]);; + (* }}} *) + +let set_of_list4 = prove_by_refinement( + `!(ul:(A) list). LENGTH ul = 4 ==> set_of_list ul = {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP LENGTH4)); + ABBREV_TAC `a:A = EL 0 ul`; + ABBREV_TAC `b:A = EL 1 ul`; + ABBREV_TAC `c:A = EL 2 ul`; + ABBREV_TAC `d:A = EL 3 ul`; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[set_of_list]) + ]);; + (* }}} *) + +let set_of_list4_explicit = prove_by_refinement( + `!(a:A) b c d. set_of_list [a;b;c;d] = {a,b,c,d}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC set_of_list4; + BY(REWRITE_TAC[EL;HD;TL;arith `2 = SUC 1 /\ 1 = SUC 0 /\ 3 = SUC 2 /\ 4 = SUC 3`;LENGTH]) + ]);; + (* }}} *) + +let SET_OF_LIST_TRUNCATE_1 = prove_by_refinement( + `!(ul:(A)list). 2 <= LENGTH ul ==> set_of_list (truncate_simplex 1 ul) = {EL 0 ul,EL 1 ul}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC set_of_list2; + CONJ_TAC; + REWRITE_TAC[arith `2 = 1 + 1`]; + MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX; + BY(ASM_REWRITE_TAC[arith `1 + 1 =2`]); + REPEAT (GMATCH_SIMP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + BY(FIRST_X_ASSUM MP_TAC THEN ARITH_TAC) + ]);; + (* }}} *) + +let SET_OF_LIST_TRUNCATE_2 = prove_by_refinement( + `!(ul:(A)list). 3 <= LENGTH ul ==> set_of_list (truncate_simplex 2 ul) = {EL 0 ul,EL 1 ul,EL 2 ul}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC set_of_list3; + CONJ_TAC; + REWRITE_TAC[arith `3 = 2 + 1`]; + MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX; + BY(ASM_REWRITE_TAC[arith `2 + 1 =3`]); + REPEAT (GMATCH_SIMP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM MP_TAC THEN ARITH_TAC) + ]);; + (* }}} *) + + +let VX_EMPTY = prove_by_refinement( + `!V vl k. (NULLSET (mcell k V vl)) ==> (VX V (mcell k V vl) = {})`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + BY(ASM_REWRITE_TAC[Pack_defs.VX]) + ]);; + (* }}} *) + +let RIJRIED = prove_by_refinement( + `!V vl k. (NULLSET (mcell k V vl)) ==> (edgeX V (mcell k V vl) = {})`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Pack_defs.edgeX]; + INTRO_TAC VX_EMPTY[`V`;`vl`;`k`]; + ASM_SIMP_TAC[EXTENSION;IN_ELIM_THM;NOT_IN_EMPTY]; + BY(MESON_TAC[IN]) + ]);; + (* }}} *) + +let HDTFNFZ_SUBSET = prove_by_refinement( + `!V ul k X. + saturated V /\ + packing V /\ + barV V 3 ul /\ + X = mcell k V ul + ==> VX V X SUBSET V INTER X`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `NULLSET X` ASM_CASES_TAC; + BY(ASM_MESON_TAC[EMPTY_SUBSET;VX_EMPTY]); + BY(ASM_MESON_TAC[Hdtfnfz.HDTFNFZ;SUBSET_REFL]) + ]);; + (* }}} *) + +let HDTFNFZ_ALT = prove_by_refinement( + `!V ul k X. + saturated V /\ + packing V /\ + barV V 3 ul /\ + X = mcell k V ul /\ + ~NULLSET X + ==> VX V X = V INTER X`, + (* {{{ proof *) + [ + ASM_MESON_TAC[Hdtfnfz.HDTFNFZ] + ]);; + (* }}} *) + +let VORONOI_V = prove_by_refinement( + `!V (w:real^A). w IN V ==> (V INTER voronoi_closed V w = {w})`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.voronoi_closed;EXTENSION;IN_SING;IN_INTER;IN_ELIM_THM]; + REWRITE_TAC[IN]; + REPEAT WEAK_STRIP_TAC; + BY(ASM_MESON_TAC[DIST_EQ_0;arith `x <= &0 /\ &0 <= x ==> x = &0`;DIST_POS_LE]) + ]);; + (* }}} *) + +let V_CELL0_EMPTY = prove_by_refinement( + `!V vl. saturated V /\ packing V /\ barV V 3 vl ==> V INTER (mcell0 V vl) = {}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[EXTENSION;NOT_IN_EMPTY;IN_INTER;Pack_defs.mcell0;IN_DIFF]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Marchal_cells_3.ROGERS_SUBSET_VORONOI_CLOSED [`V`;`vl`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC VORONOI_V [`V`;`HD vl`]; + REWRITE_TAC[EXTENSION;IN_SING;IN_INTER]; + TYPIFY `x = HD vl` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `ball` MP_TAC; + REWRITE_TAC[ball]; + ASM_REWRITE_TAC[ball;IN_ELIM_THM;DIST_REFL]; + MATCH_MP_TAC (TAUT `a ==> (~a ==> b)`); + GMATCH_SIMP_TAC REAL_LT_RSQRT; + BY(REAL_ARITH_TAC); + DISCH_THEN ( MP_TAC); + ANTS_TAC; + BY(ASM_MESON_TAC[Packing3.BARV_SUBSET;SUBSET;IN;Packing3.BARV_IMP_HD_IN_SET_OF_LIST]); + DISCH_THEN (C INTRO_TAC [`x`]); + BY(ASM_MESON_TAC[SUBSET]) + ]);; + (* }}} *) + +let V_CELL1_SINGLE = prove_by_refinement( + `!V vl. saturated V /\ packing V /\ barV V 3 vl ==> V INTER (mcell1 V vl) SUBSET {HD vl}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[EXTENSION;NOT_IN_EMPTY;IN_INTER;Pack_defs.mcell1;IN_DIFF;SUBSET;IN_SING]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + COND_CASES_TAC; + DISCH_TAC; + TYPIFY `x IN cball(HD vl,sqrt(&2))` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM MP_TAC; + BY(SET_TAC[]); + REWRITE_TAC[cball;IN_ELIM_THM]; + TYPIFY `sqrt(&2) < sqrt(&4)` (C SUBGOAL_THEN MP_TAC); + GMATCH_SIMP_TAC SQRT_MONO_LT_EQ; + BY(REAL_ARITH_TAC); + REWRITE_TAC[Collect_geom2.SQRT4_EQ2]; + FIRST_X_ASSUM_ST `packing` MP_TAC; + REWRITE_TAC[Sphere.packing]; + TYPIFY `HD vl IN V` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Packing3.BARV_SUBSET;SUBSET;IN;Packing3.BARV_IMP_HD_IN_SET_OF_LIST]); + BY(ASM_MESON_TAC[IN;arith `&2 <= d /\ d <= s /\ s < &2 ==> F`]); + BY(REWRITE_TAC[NOT_IN_EMPTY]) + ]);; + (* }}} *) + +let EDGE_IMP_K2 = prove_by_refinement( + `!V vl k. saturated V /\ packing V /\ barV V 3 vl /\ (k <= 1) ==> (edgeX V (mcell k V vl) = {})`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[EXTENSION;Pack_defs.mcell;NOT_IN_EMPTY;Pack_defs.edgeX;IN_ELIM_THM;IN_INSERT]; + REPEAT WEAK_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `mcell0` MP_TAC); + COND_CASES_TAC; + INTRO_TAC V_CELL0_EMPTY [`V`;`vl`]; + INTRO_TAC HDTFNFZ_SUBSET [`V`;`vl`;`0`;`mcell 0 V vl`]; + ASM_REWRITE_TAC[Pack_defs.mcell]; + BY(SET_TAC[IN]); + TYPIFY `k=1` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + ASM_REWRITE_TAC[]; + INTRO_TAC HDTFNFZ_SUBSET [`V`;`vl`;`1`;`mcell 1 V vl`]; + ASM_REWRITE_TAC[Pack_defs.mcell;arith `~(1=0)`]; + INTRO_TAC V_CELL1_SINGLE [`V`;`vl`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[SUBSET;IN_SING;IN_INTER]; + REPEAT WEAK_STRIP_TAC; + BY(ASM_MESON_TAC[IN]) + ]);; + (* }}} *) + + +(* DEC 31, 2012 *) + +(* 2 CELL EXPLICIT *) + +let MCELL2_VERTEX = prove_by_refinement( + `!V ul. saturated V /\ packing V /\ barV V 3 ul ==> + VX V (mcell2 V ul) SUBSET {EL 0 ul,EL 1 ul}`, + (* {{{ proof *) + [ + REWRITE_TAC[SUBSET]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `set_of_list (truncate_simplex 1 ul) = {EL 0 ul, EL 1 ul}` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `LENGTH ul = 4` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[Sphere.BARV;IN;arith `3+1 = 4`]); + DISCH_THEN (MP_TAC o (MATCH_MP LENGTH4)); + BY(MESON_TAC[Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_1;set_of_list2_explicit]); + INTRO_TAC Rogers.XYOFCGX [`V`;`{EL 0 ul,EL 1 ul}`;`circumcenter {EL 0 ul,EL 1 ul}`]; + INTRO_TAC Urrphbz1.MCELL_2_PROPERTIES_lemma1 [`V`;`ul`;`0`;`x`]; + INTRO_TAC HDTFNFZ_SUBSET [`V`;`ul`;`2`;`mcell2 V ul`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(REWRITE_TAC[Pack_defs.mcell;arith `~(2 = 0) /\ ~(2 = 1)`]); + DISCH_TAC; + TYPIFY `x IN V /\ x IN mcell2 V ul` (C SUBGOAL_THEN MP_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + DISCH_TAC; + REWRITE_TAC[Rogers.CIRCUMCENTER_2]; + ANTS_TAC; + CONJ_TAC; + MATCH_MP_TAC SUBSET_TRANS; + TYPIFY `set_of_list ul` EXISTS_TAC; + CONJ_TAC; + GMATCH_SIMP_TAC set_of_list4; + CONJ2_TAC; + BY(SET_TAC[]); + BY(ASM_MESON_TAC[Sphere.BARV;IN;arith `3 + 1 = 4`]); + BY(ASM_MESON_TAC[Packing3.BARV_SUBSET]); + CONJ_TAC; + BY(REWRITE_TAC[AFFINE_INDEPENDENT_2]); + FIRST_X_ASSUM_ST `mcell2` MP_TAC; + REWRITE_TAC[Pack_defs.mcell2]; + REWRITE_TAC[Pack_defs.HL]; + COND_CASES_TAC THEN REWRITE_TAC[NOT_IN_EMPTY]; + DISCH_THEN kill; + FIRST_X_ASSUM MP_TAC; + MATCH_MP_TAC (arith `x = x' ==> (x < y /\ z ==> x' < y)`); + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[IN_DIFF]; + DISCH_THEN (C INTRO_TAC [`EL 0 ul`;`x`]); + REPEAT WEAK_STRIP_TAC; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `dist` MP_TAC; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(SET_TAC[]); + FIRST_X_ASSUM_ST `dist` (MP_TAC o (ONCE_REWRITE_RULE[DIST_SYM])); + TYPIFY ` hl(truncate_simplex 1 ul) = dist(HD ul,midpoint (HD ul,HD (TL ul)))` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[EL;arith `1 = SUC 0`]; + BY(REAL_ARITH_TAC); + TYPIFY ` (truncate_simplex 1 ul) = [EL 0 ul; EL 1 ul]` (C SUBGOAL_THEN SUBST1_TAC); + TYPIFY `LENGTH ul = 4` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[Sphere.BARV;IN;arith `3+1 = 4`]); + DISCH_THEN (MP_TAC o (MATCH_MP LENGTH4)); + BY(MESON_TAC[Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_1]); + ASM_REWRITE_TAC[Marchal_cells_3.HL_2]; + REWRITE_TAC[DIST_MIDPOINT]; + REWRITE_TAC[EL;arith `1 = SUC 0`]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let MCELL2_EDGE = prove_by_refinement( + `!V ul e. saturated V /\ packing V /\ barV V 3 ul /\ edgeX V (mcell2 V ul) e ==> + e = {EL 0 ul, EL 1 ul}`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.edgeX;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC MCELL2_VERTEX [`V`;`ul`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; + REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + DISCH_TAC; + FIRST_ASSUM (C INTRO_TAC [`u`]); + FIRST_X_ASSUM (C INTRO_TAC [`v`]); + BY(ASM_MESON_TAC[IN]) + ]);; + (* }}} *) + +(* 3 AND 4 CELL EXPLICIT *) + +let MCELL4 = prove_by_refinement( + `!V ul. mcell4 V ul = mcell 4 V ul`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Pack_defs.mcell;arith `~(4 =0) /\ ~(4 = 1) /\ ~(4=2) /\ ~(4=3)`]) + ]);; + (* }}} *) + +let MCELL3 = prove_by_refinement( + `!V ul. mcell3 V ul = mcell 3 V ul`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Pack_defs.mcell;arith `~(3 =0) /\ ~(3 = 1) /\ ~(3=2)`]) + ]);; + (* }}} *) + +let MCELL2 = prove_by_refinement( + `!V ul. mcell2 V ul = mcell 2 V ul`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Pack_defs.mcell;arith `~(2 =0) /\ ~(2 = 1)`]) + ]);; + (* }}} *) + +let MCELL1 = prove_by_refinement( + `!V ul. mcell1 V ul = mcell 1 V ul`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Pack_defs.mcell;arith `~(1 =0)`]) + ]);; + (* }}} *) + +let MCELL0 = prove_by_refinement( + `!V ul. mcell0 V ul = mcell 0 V ul`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Pack_defs.mcell;arith `~(1 =0)`]) + ]);; + (* }}} *) + +let MCELL_CELL_PARAMETERS_EXIST = prove_by_refinement( + `!V ul k X. (k <= 4) /\ packing V /\ saturated V /\ (X = mcell k V ul) /\ ul IN barV V 3 /\ ~NULLSET X ==> + FST (cell_params V X) = k`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.cell_params]; + REPEAT WEAK_STRIP_TAC; + SELECT_TAC THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN (REWRITE_TAC[BETA_ORDERED_PAIR_THM]); + INTRO_TAC Ajripqn.AJRIPQN [`V`;`ul`;`SND t`;`k`;`FST t`]; + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY;arith `x = 0 \/ x = 1 \/ x = 2 \/ x = 3 \/ x = 4 <=> x <= 4`]; + REWRITE_TAC[IN]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `==>` MP_TAC; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[INTER_IDEMPOT]); + BY(DISCH_THEN (unlist REWRITE_TAC)); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[NOT_EXISTS_THM]; + DISCH_THEN (C INTRO_TAC [`k,ul`]); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let MCELL4_CELL_PARAMETERS_EXIST = prove_by_refinement( + `!V ul X. packing V /\ saturated V /\ (X = mcell4 V ul) /\ ul IN barV V 3 /\ ~NULLSET X ==> + FST (cell_params V X) = 4`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC THEN MATCH_MP_TAC MCELL_CELL_PARAMETERS_EXIST THEN ASM_REWRITE_TAC[MCELL4;arith `4 <= 4`]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let MCELL3_CELL_PARAMETERS_EXIST = prove_by_refinement( + `!V ul X. packing V /\ saturated V /\ (X = mcell3 V ul) /\ ul IN barV V 3 /\ ~NULLSET X ==> + FST (cell_params V X) = 3`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC THEN MATCH_MP_TAC MCELL_CELL_PARAMETERS_EXIST THEN ASM_REWRITE_TAC[MCELL3;arith `3 <= 4`]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let MCELL2_CELL_PARAMETERS_EXIST = prove_by_refinement( + `!V ul X. packing V /\ saturated V /\ (X = mcell2 V ul) /\ ul IN barV V 3 /\ ~NULLSET X ==> + FST (cell_params V X) = 2`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC THEN MATCH_MP_TAC MCELL_CELL_PARAMETERS_EXIST THEN ASM_REWRITE_TAC[MCELL2;arith `2 <= 4`]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let MCELL_PARAM_UL = prove_by_refinement( + `!V ul vl X k. (k<= 4) /\ packing V /\ saturated V /\ (X = mcell k V ul) /\ ul IN barV V 3 /\ ~NULLSET X /\ + vl = SND (cell_params V X) ==> + (X = mcell k V vl /\ vl IN barV V 3)`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.cell_params]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC MCELL_CELL_PARAMETERS_EXIST [`V`;`ul`;`k`;`X`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[Pack_defs.cell_params]; + WEAK_SELECT_TAC THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN (REWRITE_TAC[BETA_ORDERED_PAIR_THM]); + WEAK_SELECT_TAC THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN (REWRITE_TAC[BETA_ORDERED_PAIR_THM]); + REPEAT WEAK_STRIP_TAC; + CONJ_TAC; + BY(MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[NOT_EXISTS_THM]; + DISCH_THEN (C INTRO_TAC [`k,ul`]); + BY(ASM_MESON_TAC[FST;SND]) + ]);; + (* }}} *) + +let MCELL4_PARAM_UL = prove_by_refinement( + `!V ul vl X. packing V /\ saturated V /\ (X = mcell4 V ul) /\ ul IN barV V 3 /\ ~NULLSET X /\ + vl = SND (cell_params V X) ==> + (X = mcell4 V (vl) /\ vl IN barV V 3)`, + (* {{{ proof *) + [ + REWRITE_TAC[MCELL4]; + REPEAT WEAK_STRIP_TAC THEN MATCH_MP_TAC MCELL_PARAM_UL; + BY(ASM_MESON_TAC[arith `4 <= 4`]) + ]);; + (* }}} *) + +let MCELL3_PARAM_UL = prove_by_refinement( + `!V ul vl X. packing V /\ saturated V /\ (X = mcell3 V ul) /\ ul IN barV V 3 /\ ~NULLSET X /\ + vl = SND (cell_params V X) ==> + (X = mcell3 V (vl) /\ vl IN barV V 3)`, + (* {{{ proof *) + [ + REWRITE_TAC[MCELL3]; + REPEAT WEAK_STRIP_TAC THEN MATCH_MP_TAC MCELL_PARAM_UL; + BY(ASM_MESON_TAC[arith `3 <= 4`]) + ]);; + (* }}} *) + +let MCELL2_PARAM_UL = prove_by_refinement( + `!V ul vl X. packing V /\ saturated V /\ (X = mcell2 V ul) /\ ul IN barV V 3 /\ ~NULLSET X /\ + vl = SND (cell_params V X) ==> + (X = mcell2 V (vl) /\ vl IN barV V 3)`, + (* {{{ proof *) + [ + REWRITE_TAC[MCELL2]; + REPEAT WEAK_STRIP_TAC THEN MATCH_MP_TAC MCELL_PARAM_UL; + BY(ASM_MESON_TAC[arith `2 <= 4`]) + ]);; + (* }}} *) + +let MCELL4_VX = prove_by_refinement( + `!V ul X. packing V /\ saturated V /\ (X = mcell4 V ul) /\ ul IN barV V 3 ==> + VX V X SUBSET (set_of_list (SND (cell_params V X)))`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.VX]; + REPEAT WEAK_STRIP_TAC; + COND_CASES_TAC; + BY(REWRITE_TAC[EMPTY_SUBSET]); + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REWRITE_TAC[BETA_ORDERED_PAIR_THM]; + INTRO_TAC MCELL4_CELL_PARAMETERS_EXIST [`V`;`ul`;`X`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + ASM_REWRITE_TAC[arith `~(4 = 0) /\ 4 - 1 = 3`]; + MATCH_MP_TAC (MESON[SUBSET_REFL] `a = b ==> a SUBSET b`); + AP_TERM_TAC; + INTRO_TAC MCELL4_PARAM_UL [`V`;`ul`;`SND (cell_params V X)`;`X`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_REFL; + BY(ASM_MESON_TAC[Sphere.BARV;IN]) + ]);; + (* }}} *) + +let MCELL3_VX = prove_by_refinement( + `!V ul X. packing V /\ saturated V /\ (X = mcell3 V ul) /\ ul IN barV V 3 ==> + VX V X SUBSET (set_of_list (truncate_simplex 2 (SND (cell_params V X))))`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.VX]; + REPEAT WEAK_STRIP_TAC; + COND_CASES_TAC; + BY(REWRITE_TAC[EMPTY_SUBSET]); + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REWRITE_TAC[BETA_ORDERED_PAIR_THM]; + INTRO_TAC MCELL3_CELL_PARAMETERS_EXIST [`V`;`ul`;`X`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + ASM_REWRITE_TAC[arith `~(3 = 0) /\ 2 = 3 - 1`]; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let MCELL4_SET_OF_LIST_VX = prove_by_refinement( + `!V ul X. packing V /\ saturated V /\ (X = mcell4 V ul) /\ ~(NULLSET X) /\ barV V 3 ul ==> + set_of_list ul = V INTER X`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `set_of_list ul SUBSET V INTER X /\ V INTER X = VX V X /\ VX V X SUBSET set_of_list (SND (cell_params V X)) /\ CARD (set_of_list (SND (cell_params V X))) <= 4 /\ CARD (set_of_list ul) = 4` ENOUGH_TO_SHOW_TAC; + REPEAT WEAK_STRIP_TAC; + TYPIFY `set_of_list ul = set_of_list (SND (cell_params V X))` ENOUGH_TO_SHOW_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + MATCH_MP_TAC CARD_SUBSET_LE; + CONJ_TAC; + BY(REWRITE_TAC[FINITE_SET_OF_LIST]); + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + CONJ_TAC; + REWRITE_TAC[SUBSET_INTER]; + CONJ_TAC; + MATCH_MP_TAC Packing3.BARV_SUBSET; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM_ST `NULLSET` MP_TAC; + ASM_REWRITE_TAC[Pack_defs.mcell4]; + COND_CASES_TAC; + BY(REWRITE_TAC[HULL_SUBSET]); + BY(REWRITE_TAC[NEGLIGIBLE_EMPTY]); + COMMENT "goal 2"; + CONJ_TAC; + BY(ASM_MESON_TAC[HDTFNFZ_ALT;MCELL4]); + CONJ_TAC; + MATCH_MP_TAC MCELL4_VX; + BY(ASM_MESON_TAC[IN]); + CONJ_TAC; + TYPIFY `LENGTH (SND (cell_params V X)) = 4` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[Geomdetail.CARD_SET_OF_LIST_LE]); + INTRO_TAC MCELL4_PARAM_UL [`V`;`ul`;`SND(cell_params V X)`;`X`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[IN]); + BY(MESON_TAC[Sphere.BARV;IN;arith `3 + 1 = 4`]); + REWRITE_TAC[arith `4 = 3 + 1`]; + MATCH_MP_TAC Marchal_cells_3.BARV_CARD_LEMMA; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let MCELL3_SET_OF_LIST_VX = prove_by_refinement( + `!V ul X. packing V /\ saturated V /\ (X = mcell3 V ul) /\ ~(NULLSET X) /\ barV V 3 ul ==> + set_of_list (truncate_simplex 2 ul) = V INTER X`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `set_of_list (truncate_simplex 2 ul) SUBSET V INTER X /\ V INTER X = VX V X /\ VX V X SUBSET set_of_list (truncate_simplex 2 (SND (cell_params V X))) /\ CARD (set_of_list (truncate_simplex 2 (SND (cell_params V X)))) <= 3 /\ CARD (set_of_list (truncate_simplex 2 ul)) = 3` ENOUGH_TO_SHOW_TAC; + REPEAT WEAK_STRIP_TAC; + TYPIFY `set_of_list (truncate_simplex 2 ul) = set_of_list (truncate_simplex 2 (SND (cell_params V X)))` ENOUGH_TO_SHOW_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + MATCH_MP_TAC CARD_SUBSET_LE; + CONJ_TAC; + BY(REWRITE_TAC[FINITE_SET_OF_LIST]); + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + COMMENT "list of conjunts"; + CONJ_TAC; + REWRITE_TAC[SUBSET_INTER]; + CONJ_TAC; + MATCH_MP_TAC SUBSET_TRANS; + TYPIFY `set_of_list ul` EXISTS_TAC; + CONJ_TAC; + MATCH_MP_TAC Rogers.SET_OF_LIST_TRUNCATE_SIMPLEX_SUBSET; + BY(ASM_MESON_TAC[Sphere.BARV;IN;arith `2 + 1 <= 3 + 1`]); + MATCH_MP_TAC Packing3.BARV_SUBSET; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM_ST `NULLSET` MP_TAC; + ASM_REWRITE_TAC[Pack_defs.mcell3]; + COND_CASES_TAC; + DISCH_TAC; + MATCH_MP_TAC SUBSET_TRANS; + TYPIFY `set_of_list (truncate_simplex 2 ul) UNION {mxi V ul}` EXISTS_TAC; + CONJ_TAC; + BY(SET_TAC[]); + BY(REWRITE_TAC[HULL_SUBSET]); + BY(REWRITE_TAC[NEGLIGIBLE_EMPTY]); + COMMENT "goal 2"; + CONJ_TAC; + BY(ASM_MESON_TAC[HDTFNFZ_ALT;MCELL3]); + CONJ_TAC; + MATCH_MP_TAC MCELL3_VX; + BY(ASM_MESON_TAC[IN]); + CONJ_TAC; + TYPIFY `2+1 <= LENGTH (SND (cell_params V X))` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[Geomdetail.CARD_SET_OF_LIST_LE;Packing3.LENGTH_TRUNCATE_SIMPLEX;arith `2+1= 3 /\ 2 + 1 <= 2+1`]); + INTRO_TAC MCELL3_PARAM_UL [`V`;`ul`;`SND(cell_params V X)`;`X`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[IN]); + BY(MESON_TAC[Sphere.BARV;IN;arith `2 + 1 <= 3+1`]); + INTRO_TAC Marchal_cells_3.BARV_CARD_LEMMA [`V`;`ul`;`3`]; + ASM_REWRITE_TAC[]; + TYPIFY `LENGTH ul = 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Sphere.BARV;IN;arith `3 + 1 = 4`]); + FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP LENGTH4)); + FIRST_X_ASSUM SUBST1_TAC; + REWRITE_TAC[Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_2]; + REWRITE_TAC[set_of_list3_explicit;set_of_list4_explicit]; + TYPED_ABBREV_TAC `(s:real^3 -> bool) = {EL 0 ul, EL 1 ul, EL 2 ul}` ; + TYPIFY ` {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = (EL 3 ul) INSERT s ` (C SUBGOAL_THEN SUBST1_TAC); + EXPAND_TAC "s"; + BY(SET_TAC[]); + GMATCH_SIMP_TAC (CONJUNCT2 CARD_CLAUSES); + CONJ_TAC; + BY(ASM_MESON_TAC[FINITE_EMPTY;FINITE_INSERT]); + COND_CASES_TAC; + BY(ASM_MESON_TAC[Geomdetail.CARD3;arith `~( 3 + 1 <= 3)`]); + BY(ARITH_TAC) + ]);; + (* }}} *) + +let MCELL4_EDGE = prove_by_refinement( + `!V ul u v. packing V /\ saturated V /\ ~NULLSET (mcell4 V ul) /\ barV V 3 ul ==> + ({u,v} IN edgeX V (mcell4 V ul) <=> (~(u= v) /\ {u,v} SUBSET set_of_list ul))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Pack_defs.edgeX;IN_ELIM_THM]; + INTRO_TAC HDTFNFZ_ALT [`V`;`ul`;`4`;`mcell4 V ul`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[MCELL4]); + DISCH_THEN SUBST1_TAC; + INTRO_TAC (GSYM MCELL4_SET_OF_LIST_VX) [`V`;`ul`;`mcell4 V ul`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY;Geomdetail.PAIR_EQ_EXPAND]; + BY(MESON_TAC[IN]) + ]);; + (* }}} *) + +let MCELL3_EDGE = prove_by_refinement( + `!V ul u v. packing V /\ saturated V /\ ~NULLSET (mcell3 V ul) /\ barV V 3 ul ==> + ({u,v} IN edgeX V (mcell3 V ul) <=> (~(u= v) /\ {u,v} SUBSET (set_of_list(truncate_simplex 2 ul))))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Pack_defs.edgeX;IN_ELIM_THM]; + INTRO_TAC HDTFNFZ_ALT [`V`;`ul`;`3`;`mcell3 V ul`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[MCELL3]); + DISCH_THEN SUBST1_TAC; + INTRO_TAC (GSYM MCELL3_SET_OF_LIST_VX) [`V`;`ul`;`mcell3 V ul`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY;Geomdetail.PAIR_EQ_EXPAND]; + BY(MESON_TAC[IN]) + ]);; + (* }}} *) + +let EDGE_MCELL_EL = prove_by_refinement( + `!V X e. e IN edgeX V X ==> (?u v. e = {u,v} /\ ~(u=v))`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.edgeX;IN_ELIM_THM]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + + +let MCELL_EDGE = prove_by_refinement( + `!V ul k e. (k < 4) /\ packing V /\ saturated V /\ ~NULLSET (mcell k V ul) /\ barV V 3 ul /\ + e IN edgeX V (mcell k V ul) ==> e SUBSET (set_of_list(truncate_simplex 2 ul))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `LENGTH ul = 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Sphere.BARV;arith `3 + 1 = 4`]); + TYPIFY `k = 3 \/ k = 2 \/ k <= 1` (C SUBGOAL_THEN MP_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + INTRO_TAC EDGE_MCELL_EL [`V`;`mcell k V ul`;`e`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC MCELL3_EDGE [`V`;`ul`;`u`;`v`]; + BY(ASM_MESON_TAC[MCELL3]); + INTRO_TAC MCELL2_EDGE [`V`;`ul`;`e`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN;MCELL2]); + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + GMATCH_SIMP_TAC SET_OF_LIST_TRUNCATE_2; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ARITH_TAC); + BY(SET_TAC[]); + INTRO_TAC EDGE_IMP_K2 [`V`;`ul`;`k`]; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[NOT_IN_EMPTY]) + ]);; + (* }}} *) + +(* +let MCELL_BUMP_0 = prove_by_refinement( + `!V ul e k. (k < 4 ) /\ packing V /\ saturated V /\ barV V 3 ul /\ ~NULLSET (mcell k V ul) + ==> beta_bumpA V e (mcell k V ul) = &0`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Pack_defs.beta_bumpA]; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REWRITE_TAC[BETA_ORDERED_PAIR_THM]; + INTRO_TAC MCELL_CELL_PARAMETERS_EXIST [`V`;`ul`;`k`;`mcell k V ul`]; + ANTS_TAC; + BY(ASM_SIMP_TAC[arith `k < 4 ==> k <= 4`;IN]); + DISCH_THEN SUBST1_TAC; + ASM_SIMP_TAC[arith `k < 4 ==> ~(k=4)`]; + REWRITE_TAC[GSPEC;SETSPEC]; + BY(REWRITE_TAC[SYM EMPTY;SUM_CLAUSES]) + ]);; + (* }}} *) +*) + +let CARD2_EDGEX = prove_by_refinement( + `!V X e. e IN edgeX V X ==> CARD e = 2`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.edgeX;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_SIMP_TAC[Hypermap.CARD_TWO_ELEMENTS]) + ]);; + (* }}} *) + +let DIFF_EDGEX = prove_by_refinement( + `!V X ul k e. (k < 4) /\ packing V /\ saturated V /\ (X = mcell k V ul) /\ ~NULLSET X /\ barV V 3 ul /\ + e IN edgeX V X ==> ~((VX V X DIFF e) IN edgeX V X)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ABBREV_TAC `e' = (VX V X DIFF e)`; + INTRO_TAC MCELL_EDGE [`V`;`ul`;`k`;`e`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + INTRO_TAC MCELL_EDGE [`V`;`ul`;`k`;`e'`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `set_of_list` MP_TAC); + TYPIFY `3 <= LENGTH ul` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Sphere.BARV;IN;arith `3 <= 3 + 1`]); + ASM_SIMP_TAC[ SET_OF_LIST_TRUNCATE_2]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Geomdetail.CARD3 [`EL 0 ul`;`EL 1 ul`;`EL 2 ul`]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC CARD_UNION_GEN [`e`;`e'`]; + TYPIFY `e INTER e' = {}` ((C SUBGOAL_THEN SUBST1_TAC)); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + REWRITE_TAC[CARD_CLAUSES;arith `x - 0 = x`]; + TYPIFY `FINITE {EL 0 ul, EL 1 ul, EL 2 ul}` (C SUBGOAL_THEN MP_TAC); + BY(REWRITE_TAC[FINITE_INSERT;FINITE_EMPTY]); + DISCH_TAC; + DISCH_THEN ( MP_TAC) THEN ANTS_TAC; + BY(ASM_MESON_TAC[FINITE_SUBSET]); + TYPIFY `CARD (e UNION e') <= CARD {EL 0 ul, EL 1 ul, EL 2 ul}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC CARD_SUBSET; + BY(ASM_REWRITE_TAC[UNION_SUBSET]); + REPEAT (FIRST_X_ASSUM (MP_TAC o (MATCH_MP CARD2_EDGEX))); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC) + ]);; + (* }}} *) + +let CRITICAL_EDGEX_ALT = prove_by_refinement( + `!V X e. e IN critical_edgeX V X <=> e IN edgeX V X /\ hminus <= radV e /\ radV e <= hplus `, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.critical_edgeX;Pack_defs.HL;Pack_defs.edgeX]; + REWRITE_TAC[IN_ELIM_THM;set_of_list2_explicit]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let SUBCRITICAL_EDGEX_ALT = prove_by_refinement( + `!V X e. e IN subcritical_edgeX V X <=> e IN edgeX V X /\ radV e < hminus `, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.subcritical_edgeX;Pack_defs.HL;Pack_defs.edgeX]; + REWRITE_TAC[IN_ELIM_THM;set_of_list2_explicit]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let MCELL_BUMP_0 = prove_by_refinement( + `!V ul e k. (k < 4 ) /\ packing V /\ saturated V /\ barV V 3 ul /\ ~NULLSET (mcell k V ul) + ==> beta_bump_v1 V e (mcell k V ul) = &0`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.beta_bump_v1]; + REPEAT WEAK_STRIP_TAC; + ABBREV_TAC `e' = VX V (mcell k V ul) DIFF e`; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + REWRITE_TAC[CRITICAL_EDGEX_ALT;IN_ELIM_THM]; + COND_CASES_TAC; + BY(ASM_MESON_TAC[DIFF_EDGEX]); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let MCELL4_EDGE_OPP = prove_by_refinement( + `!V ul. + packing V /\ saturated V /\ barV V 3 ul /\ ~NULLSET (mcell4 V ul) ==> + VX V (mcell4 V ul) DIFF {EL 0 ul, EL 1 ul} = {EL 2 ul, EL 3 ul}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ABBREV_TAC `e' = VX V (mcell4 V ul) DIFF {EL 0 ul, EL 1 ul}`; + TYPIFY `VX V (mcell4 V ul) = set_of_list ul` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC Hdtfnfz.HDTFNFZ; + CONJ_TAC; + BY(ASM_MESON_TAC[MCELL4]); + MATCH_MP_TAC (GSYM MCELL4_SET_OF_LIST_VX); + BY(ASM_MESON_TAC[MCELL4]); + INTRO_TAC set_of_list4 [`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[Sphere.BARV;IN;arith `3 + 1 = 4`]); + DISCH_TAC; + TYPIFY `e' SUBSET {EL 2 ul, EL 3 ul}` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + TYPIFY `e' = {EL 2 ul,EL 3 ul}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC CARD_SUBSET_LE; + ASM_REWRITE_TAC[FINITE_INSERT;FINITE_EMPTY]; + INTRO_TAC Marchal_cells_3.BARV_CARD_LEMMA [`V`;`ul`;`3`]; + ASM_REWRITE_TAC[]; + ASM_REWRITE_TAC[arith `3 + 1 = 4`]; + INTRO_TAC Hypermap.CARD_MINUS_DIFF_TWO_SET [`{EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul}`;`EL 0 ul`;`EL 1 ul`]; + REWRITE_TAC[FINITE_INSERT;FINITE_EMPTY]; + ANTS_TAC; + BY(SET_TAC[]); + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC (arith `v <= 2 /\ 2 <= x ==> v <= x`); + REWRITE_TAC[Geomdetail.CARD2]; + MATCH_MP_TAC (arith `(?u. 4 = x + u /\ u <= 2) ==> 2 <= x`); + TYPIFY `CARD {EL 0 ul, EL 1 ul}` EXISTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + BY(REWRITE_TAC[Geomdetail.CARD2]); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let MCELL_BUMP_OPP = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ barV V 3 ul /\ ~NULLSET (mcell4 V ul) /\ + ~({EL 2 ul,EL 3 ul} IN critical_edgeX V (mcell4 V ul)) ==> + beta_bump_v1 V {EL 0 ul,EL 1 ul} (mcell4 V ul) = &0 + `, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.beta_bump_v1]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC MCELL4_EDGE_OPP [`V`;`ul`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + + let BETA_BUMP_NZ = prove_by_refinement( + `!V ul e e'. packing V /\ + saturated V /\ + barV V 3 ul /\ + ~NULLSET (mcell4 V ul) /\ + (e = {EL 0 ul, EL 1 ul}) /\ + (e' = {EL 2 ul, EL 3 ul}) /\ + (e IN critical_edgeX V (mcell4 V ul)) /\ + (e' IN critical_edgeX V (mcell4 V ul)) /\ + (!f. f IN edgeX V (mcell4 V ul) ==> (f = e \/ f = e' \/ f IN subcritical_edgeX V (mcell4 V ul))) ==> + beta_bump_v1 V e (mcell4 V ul) = bump (radV e) - bump (radV e')`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC MCELL4_EDGE_OPP [`V`;`ul`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + ASM_REWRITE_TAC[Pack_defs.beta_bump_v1]; + ASM_REWRITE_TAC[LET_DEF;LET_END_DEF]; + COND_CASES_TAC; + BY(REWRITE_TAC[]); + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `mcell4` MP_TAC; + REWRITE_TAC[]; + CONJ_TAC; + REWRITE_TAC[MCELL4;Pack_defs.mcell_set;IN_ELIM_THM]; + BY(ASM_MESON_TAC[IN]); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[]) +]);; + (* }}} *) + +let BETA_BUMP_INVOLUTION = prove_by_refinement( + `!V X r e. saturated V /\ packing V /\ mcell_set V X /\ + e IN critical_edgeX V X /\ + (\e. VX V X DIFF e) = r ==> + r ( r e) = e`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + EXPAND_TAC "r"; + TYPIFY `e SUBSET VX V X` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + FIRST_X_ASSUM_ST `IN` MP_TAC; + REWRITE_TAC[CRITICAL_EDGEX_ALT]; + REWRITE_TAC[Pack_defs.edgeX;IN_ELIM_THM]; + BY(SET_TAC[]) + ]);; + (* }}} *) + +(* +let BETA_BUMP_INVOLUTION = prove_by_refinement( + `!V X r e. saturated V /\ packing V /\ mcell_set V X /\ + e IN critical_edgeX V X /\ ~(beta_bump_v1 V e X = &0) /\ + (\e. VX V X DIFF e) = r ==> + r ( r e) = e`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + EXPAND_TAC "r"; + TYPIFY `e SUBSET VX V X` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + FIRST_X_ASSUM_ST `IN` MP_TAC; + REWRITE_TAC[CRITICAL_EDGEX_ALT]; + REWRITE_TAC[Pack_defs.edgeX;IN_ELIM_THM]; + BY(SET_TAC[]) + ]);; + (* }}} *) +*) + +let BETA_BUMP_ALT = prove_by_refinement( + `!V X r e. saturated V /\ packing V /\ mcell_set V X /\ + (\e. VX V X DIFF e) = r ==> + beta_bump_v1 V e X = + if ~(NULLSET X) /\ e IN critical_edgeX V X /\ r e IN critical_edgeX V X /\ + (!f. f IN edgeX V X ==> f = e \/ f = (r e) \/ f IN subcritical_edgeX V X) then bump (radV e) - bump (radV (r e)) + else &0`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Pack_defs.beta_bump_v1]; + REWRITE_TAC[Pack_defs.beta_bump_v1;LET_DEF;LET_END_DEF]; + EXPAND_TAC "r"; + BY(ASM_REWRITE_TAC[IN]) + ]);; + (* }}} *) + +let BETA_BUMP_INVOLUTION_CRITICAL = prove_by_refinement( + `!V X r e. saturated V /\ packing V /\ mcell_set V X /\ + e IN critical_edgeX V X /\ ~(beta_bump_v1 V e X = &0) /\ + (\e. VX V X DIFF e) = r ==> + r e IN critical_edgeX V X`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + PROOF_BY_CONTR_TAC; + INTRO_TAC BETA_BUMP_ALT [`V`;`X`;`r`;`e`]; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let BETA_BUMP_INVOLUTION_NEG = prove_by_refinement( + `!V X r e. saturated V /\ packing V /\ mcell_set V X /\ + e IN critical_edgeX V X /\ ~(beta_bump_v1 V e X = &0) /\ + (\e. VX V X DIFF e) = r ==> + beta_bump_v1 V (r e) X = -- beta_bump_v1 V e X`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC BETA_BUMP_INVOLUTION_CRITICAL [`V`;`X`;`r`;`e`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC BETA_BUMP_ALT [`V`;`X`;`r`;`e`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + INTRO_TAC BETA_BUMP_ALT [`V`;`X`;`r`;`r e`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + TYPIFY `r (r e) = e` (C SUBGOAL_THEN SUBST1_TAC); + INTRO_TAC BETA_BUMP_INVOLUTION [`V`;`X`;`r`;`e`]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT COND_CASES_TAC; + BY(REAL_ARITH_TAC); + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let BETA_BUMP_INVOLUTION_BIJ = prove_by_refinement( + `!V X s r. saturated V /\ packing V /\ mcell_set V X /\ + ({e | e IN critical_edgeX V X /\ ~(beta_bump_v1 V e X = &0) } = s ) /\ + (\e. VX V X DIFF e) = r ==> + BIJ r s s`, + (* {{{ proof *) + [ + REWRITE_TAC[BIJ;INJ]; + REPEAT WEAK_STRIP_TAC; + SUBCONJ_TAC; + CONJ_TAC; + GEN_TAC; + EXPAND_TAC "s"; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + BY(ASM_MESON_TAC[BETA_BUMP_INVOLUTION_NEG;arith `(-- x = &0 <=> x = &0)`; BETA_BUMP_INVOLUTION_CRITICAL]); + EXPAND_TAC "s"; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `r ( r x) = r ( r y)` (C SUBGOAL_THEN ASSUME_TAC); + AP_TERM_TAC; + BY(ASM_REWRITE_TAC[]); + BY(ASM_MESON_TAC[BETA_BUMP_INVOLUTION]); + DISCH_TAC; + REWRITE_TAC[SURJ]; + ASM_REWRITE_TAC[]; + EXPAND_TAC "s"; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `r x` EXISTS_TAC; + SUBCONJ_TAC; + FIRST_X_ASSUM_ST `==>` MP_TAC; + EXPAND_TAC "s"; + REWRITE_TAC[IN_ELIM_THM]; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + BY(ASM_MESON_TAC[BETA_BUMP_INVOLUTION]) + ]);; + (* }}} *) + +let SUM_BETA_BUMP_LEMMA = prove_by_refinement( + `!V X. saturated V /\ packing V /\ mcell_set V X ==> + sum {e | e IN critical_edgeX V X } (\e. beta_bump_v1 V e X) = &0`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ABBREV_TAC `s = {e | e IN critical_edgeX V X /\ ~(beta_bump_v1 V e X = &0) } `; + INTRO_TAC SUM_SUPERSET [`(\e. beta_bump_v1 V e X)`;`s`;`{e | e IN critical_edgeX V X }`]; + ANTS_TAC; + EXPAND_TAC "s"; + REWRITE_TAC[IN_ELIM_THM;SUBSET]; + BY(MESON_TAC[]); + DISCH_THEN SUBST1_TAC; + ABBREV_TAC `r = (\e. VX V X DIFF e)`; + INTRO_TAC BIJ_SUM [`s`;`s`;`(\e. beta_bump_v1 V e X)`;`r`]; + ANTS_TAC; + BY(ASM_MESON_TAC[ BETA_BUMP_INVOLUTION_BIJ]); + INTRO_TAC SUM_EQ [`((\e. beta_bump_v1 V e X) o r)`;`(\e. -- beta_bump_v1 V e X)`;`s`]; + ANTS_TAC; + EXPAND_TAC "s"; + REWRITE_TAC[IN_ELIM_THM]; + REWRITE_TAC[o_DEF]; + BY(ASM_MESON_TAC[BETA_BUMP_INVOLUTION_NEG]); + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[SUM_NEG]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let REAL_ABS_TRIANGLE_BOUND = prove_by_refinement( + `!a b x. a <= x /\ x <= b ==> abs x <= abs a + abs b`, + (* {{{ proof *) + [ + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let CRITICAL_EDGEX_BOUND = prove_by_refinement( + `?c1. !V X e. e IN critical_edgeX V X ==> abs(radV e - h0) <= c1`, + (* {{{ proof *) + [ + REWRITE_TAC[CRITICAL_EDGEX_ALT]; + EXISTS_TAC `abs (hplus) + abs (hminus) + abs (h0)`; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC REAL_ABS_TRIANGLE_BOUND [`hminus`;`hplus`;`radV e`]; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let ABS_BUMP = prove_by_refinement( + `!h c1. abs(h- h0) <= c1 ==> abs(bump h) <= abs (#0.005) * (&1 + (c1 pow 2) / abs((hplus - h0) pow 2))`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.bump ]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[REAL_ABS_MUL]; + GMATCH_SIMP_TAC Real_ext.REAL_LE_LMUL_IMP; + CONJ_TAC; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC (arith ` abs x + abs y <= z ==> abs (x - y) <= z`); + REWRITE_TAC[arith `abs(&1) + x <= &1 + y <=> x <= y`]; + REWRITE_TAC[REAL_ABS_DIV]; + REWRITE_TAC[real_div]; + MATCH_MP_TAC Real_ext.REAL_PROP_LE_RMUL; + REWRITE_TAC[REAL_LE_INV_EQ]; + CONJ2_TAC; + BY(REAL_ARITH_TAC); + REWRITE_TAC[REAL_ABS_POW]; + MATCH_MP_TAC Collect_geom2.POS_IMP_POW2; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let BOUND_BETA_BUMP = prove_by_refinement( + `?c. !V X e. + saturated V /\ packing V /\ mcell_set V X /\ critical_edgeX V X e + ==> beta_bump_v1 V e X <= c`, + (* {{{ proof *) + [ + INTRO_TAC CRITICAL_EDGEX_BOUND []; + REPEAT WEAK_STRIP_TAC; + EXISTS_TAC `&2 * abs (#0.005) * (&1 + (c1 pow 2) / abs((hplus - h0) pow 2))`; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Pack_defs.beta_bump_v1;LET_DEF;LET_END_DEF]; + COND_CASES_TAC; + MATCH_MP_TAC REAL_LE_TRANS; + ABBREV_TAC `e' = VX V X DIFF e`; + TYPIFY `abs (bump (radV e)) + abs (bump (radV e'))` EXISTS_TAC; + CONJ_TAC; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC (arith `x <= z /\ y <= z ==> x + y <= &2 * z`); + BY(ASM_MESON_TAC[ ABS_BUMP]); + MATCH_MP_TAC (arith `&0 <= x ==> &0 <= &2 * abs (#0.005) * x`); + REWRITE_TAC[real_div]; + MATCH_MP_TAC (arith `&0 <= x ==> &0 <= &1 + x`); + GMATCH_SIMP_TAC REAL_LE_MUL; + REWRITE_TAC[REAL_LE_INV_EQ]; + REWRITE_TAC[ REAL_LE_POW_2]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + + +end;; diff --git a/text_formalization/packing/counting_spheres.hl b/text_formalization/packing/counting_spheres.hl new file mode 100644 index 0000000..e851751 --- /dev/null +++ b/text_formalization/packing/counting_spheres.hl @@ -0,0 +1,7692 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Section: Counting Spheres *) +(* Chapter: packing *) +(* Author: Thomas C. Hales *) +(* Date: 2011-06-18 *) +(* ========================================================================== *) + +module Counting_spheres = struct + + open Tactics_jordan;; +open Ysskqoy;; +open Hales_tactic;; + +let CALC_ID_TAC = Calc_derivative.CALC_ID_TAC;; +let DIHV_SYM = Trigonometry2.DIHV_SYM;; + +(* -------------- *) + + +(* fat_lemma1 = Fatugpd.lemma1 *) +let fat_lemma1 = prove_by_refinement( + `! (S:real^3->bool). packing S /\ S SUBSET ball_annulus ==> FINITE S`, +[ + (REPEAT STRIP_TAC); + (SUBGOAL_THEN ` (S:real^3->bool) = S INTER ball (vec 0,&3 * h0)` ASSUME_TAC); + (MATCH_MP_TAC (SET_RULE `! U V. U SUBSET ball_annulus /\ ball_annulus SUBSET V ==> (U = U INTER V)`)); + (ASM_SIMP_TAC[Pack_defs.ball_annulus;ball;cball;IN_DIFF;SUBSET;IN_ELIM_THM;Sphere.h0]); + (REPEAT STRIP_TAC ); + (MATCH_MP_TAC (ARITH_RULE ` u <= &2 * #1.26 ==> u < &3 * #1.26`)); + BY((ASM_SIMP_TAC[])); + (ONCE_ASM_REWRITE_TAC[]); + BY((ASM_SIMP_TAC[Pack2.KIUMVTC])) +]);; + +(* ckq_in_ball_annulus = Ckqowsa_3_points.in_ball_annulus *) + +let ckq_in_ball_annulus = prove(`!v. v IN ball_annulus <=> &2 <= norm v /\ norm v <= &2 * h0 /\ ~(v = vec 0)`, + REWRITE_TAC[Pack_defs.ball_annulus] THEN + REWRITE_TAC[IN_DIFF; cball; ball; IN_ELIM_THM; DIST_0] THEN + REWRITE_TAC[GSYM NORM_EQ_0] THEN + REAL_ARITH_TAC);; + + +let lemma = prove_by_refinement( + `!a2 b c. (&0 < a2) /\ (&0 < c) /\ (!t. &0 <= t /\ t < c ==> a2*t <= b) ==> (!t. &0 <= t /\ t <= c ==> a2*t <= b)`, + (* {{{ proof *) +[ + REPEAT STRIP_TAC; + DISJ_CASES_TAC (REAL_ARITH `t < c \/ ~(t <= c) \/ t=c `); + BY(ASM_MESON_TAC []); + HASH_UNDISCH_TAC 9516; + ASM_REWRITE_TAC []; + DISCH_THEN SUBST1_TAC; + HASH_UNDISCH_TAC 6171; + DISCH_THEN (fun loc_t -> ASSUME_TAC loc_t THEN ASSUME_TAC loc_t); + HASH_RULE_TAC 6171 (SPEC `(b/(&2 * a2) + c/(&2))`); + HASH_RULE_TAC 6171 (SPEC `&0`); + ANTS_TAC; + BY(ASM_REAL_ARITH_TAC); + REWRITE_TAC [REAL_ARITH`x* &0= &0`]; + DISCH_TAC; + SUBGOAL_THEN `(&0 <= b / (&2 * a2) + c / &2)=T` SUBST1_TAC; + ASM_REWRITE_TAC []; + MATCH_MP_TAC (REAL_ARITH `&0 <= x /\( &0 < y) ==> &0 <= x + y/ &2`); + ASM_REWRITE_TAC []; + MATCH_MP_TAC REAL_LE_DIV; + BY(ASM_REAL_ARITH_TAC); + REWRITE_TAC []; + ONCE_REWRITE_TAC [REAL_ARITH `((x < y) = (x - y < &0)) /\((x <= y) = (x - y <= &0))`]; + MP_TAC (Calc_derivative.rational_identity `(b / (&2 * a2) + c / &2) - c = -- (a2*c - b)/(&2 * a2)`); + MP_TAC (Calc_derivative.rational_identity `(a2 * (b/ (&2 * a2) + c / &2) - b) = (a2 * c - b) /(&2)`); + ASM_SIMP_TAC [REAL_ARITH `~(&2 = &0) /\( &0 < a2 ==> ~(a2 = &0))`]; + DISCH_THEN SUBST1_TAC; + DISCH_THEN SUBST1_TAC; + ABBREV_TAC `u = a2 * c - b `; + HASH_UNDISCH_TAC 3659; + REWRITE_TAC[REAL_ARITH `--x / a < &0 <=> &0 < x / a`]; + SIMP_TAC [REAL_ARITH`&0 < x ==> &0 < &2 * x`;Trigonometry2.REAL_LT_DIV_0]; + BY(REAL_ARITH_TAC ) +] +);; + (* }}} *) + +let eus1 = prove_by_refinement( + `!(P:real^2 -> bool) c. polyhedron P /\ c facet_of P ==> + (?a b. (norm a = &1) /\ + (!r. (&0 < r) /\ (!p. norm p < r ==> P p) ==> (r <= b)) /\ + P SUBSET {x | a dot x <= b} /\ + c = P INTER {x | a dot x = b})`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC ; +MP_TAC (SPECL[`P:real^2->bool`;`c:real^2->bool`] (INST_TYPE [(`:2`,`:N`)] FACET_OF_POLYHEDRON)); +ASM_REWRITE_TAC []; +REPEAT STRIP_TAC ; +EXISTS_TAC `&1/ norm a % (a:real^2)`; +EXISTS_TAC `&1/ norm (a:real^2) * (b:real)`; +ASM_REWRITE_TAC [GSYM Trigonometry2.NOT_VEC0_UNITABLE]; +SUBGOAL_THEN `&0 < norm (a:real^2)` ASSUME_TAC; +ASM_REWRITE_TAC [NORM_POS_LT]; +SUBGOAL_THEN `&0 < &1/ norm (a:real^2)` ASSUME_TAC; +MATCH_MP_TAC REAL_LT_DIV THEN CONJ_TAC THEN TRY REAL_ARITH_TAC THEN ASM_REWRITE_TAC[]; +HASH_UNDISCH_TAC 7978 ; +REWRITE_TAC [DOT_LMUL]; +ASM_SIMP_TAC [REAL_LE_LMUL_EQ]; +REWRITE_TAC [REAL_EQ_MUL_LCANCEL]; +SIMP_TAC [REAL_ARITH `&0 < d==> ~(d= &0)`]; +DISCH_TAC ; +REPEAT STRIP_TAC; +SUBGOAL_THEN `!p. norm (p:real^2) < r ==> (a:real^2) dot p <= b` ASSUME_TAC; +REPEAT STRIP_TAC ; +HASH_UNDISCH_TAC 5889 ; +REWRITE_TAC [SUBSET;IN;IN_ELIM_THM]; +DISCH_THEN MATCH_MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC []; +SUBGOAL_THEN `(&0 < norm (a:real^2) pow 2) /\(&0 < r/ norm a) /\(!t. &0 <= t /\( t < r/ norm a) ==> (norm a pow 2 )*t <= b)` (fun t -> MP_TAC (MATCH_MP lemma t)); +CONJ_TAC ; +HASH_UNDISCH_TAC 7435 ; +REWRITE_TAC [GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]; +REAL_ARITH_TAC ; +CONJ_TAC ; +MATCH_MP_TAC REAL_LT_DIV; +ASM_REWRITE_TAC []; +REPEAT STRIP_TAC ; +HASH_RULE_TAC 4896 (SPEC `t % (a:real^2)`); +ASM_SIMP_TAC [NORM_MUL;REAL_ARITH `&0 <= t ==> (abs t = t)`]; +REWRITE_TAC [DOT_RMUL]; +REWRITE_TAC [DOT_SQUARE_NORM]; +ANTS_TAC; +HASH_RULE_TAC 7310 (Calc_derivative.rational_ineq_rule); +HASH_UNDISCH_TAC 7435 ; +SIMP_TAC [REAL_LT_MUL_EQ]; +MP_TAC (REAL_ARITH `&0 < x ==> ~(x = &0)`); +REAL_ARITH_TAC ; +REAL_ARITH_TAC ; +DISCH_THEN (fun t-> MP_TAC (SPEC `r/ norm (a:real^2)` t)); +ANTS_TAC; +REWRITE_TAC [REAL_ARITH `x <= x`]; +REWRITE_TAC [Calc_derivative.invert_den_le]; +MATCH_MP_TAC REAL_LE_MUL; +ASM_REAL_ARITH_TAC; +DISCH_THEN (MP_TAC o Calc_derivative.rational_ineq_rule); +DISCH_TAC ; +MATCH_MP_TAC (REAL_ARITH `((x < y) ==> F) ==> (y <= x)`); +DISCH_THEN (MP_TAC o Calc_derivative.rational_ineq_rule); +HASH_UNDISCH_TAC 5880 ; +SUBGOAL_THEN `~(norm (a:real^2) = &0)` ASSUME_TAC; +ASM_REAL_ARITH_TAC; +ASM_REWRITE_TAC []; +REWRITE_TAC [REAL_ARITH `~(&0 < (x - y) * b) <=> (&0 <= (y - x)*b)`]; +REWRITE_TAC [REAL_RING `(b * norm (a:real^2) - norm a pow 2 * r) = (b - r * norm a) * norm a`]; +HASH_UNDISCH_TAC 7435 ; +REWRITE_TAC [REAL_MUL_POS_LE;REAL_MUL_POS_LT;REAL_ENTIRE;REAL_ARITH `a * b < &0 <=> ~(&0 <= a * b)`]; +REAL_ARITH_TAC +]);; + (* }}} *) + + +let facet_rep_uniq = prove_by_refinement( + `!(P:real^2 -> bool) a b1 b2. polyhedron P /\ + c1 facet_of P /\ c2 facet_of P /\ + P SUBSET {x | a dot x <= b1} /\ + P SUBSET {x | a dot x <= b2} /\ + c1 = P INTER {x | a dot x = b1} /\ + c2 = P INTER {x | a dot x = b2} ==> + (b1 = b2) /\ (c1 = c2)`, + (* {{{ proof *) +[ +REPEAT GEN_TAC ; +REWRITE_TAC [facet_of;face_of;SUBSET;GSYM MEMBER_NOT_EMPTY;IN;IN_ELIM_THM;INTER]; +STRIP_TAC ; +SUBGOAL_THEN `a dot x = b1 /\ (a:real^2) dot x' = b2` ASSUME_TAC; +HASH_UNDISCH_TAC 4776 ; +HASH_UNDISCH_TAC 6239 ; +ASM_REWRITE_TAC [IN_ELIM_THM]; +MESON_TAC []; +ASM_MESON_TAC [REAL_ARITH `b1 <= b2 /\ b2 <= b1 ==> (b1 = b2)`] +] +);; + (* }}} *) + +let facet_rep_spec = prove_by_refinement( + `?a b. !(P:real^2 -> bool) c. polyhedron P /\ c facet_of P + ==> + ( (norm (a P c) = &1) /\ + (!r. (&0 < r) /\ (!p. norm p < r ==> P p) ==> (r <= (b P c))) /\ + P SUBSET {x | (a P c) dot x <= (b P c)} /\ + c = P INTER {x | (a P c) dot x = (b P c)})`, + (* {{{ proof *) + [ +REWRITE_TAC [GSYM SKOLEM_THM;RIGHT_EXISTS_IMP_THM]; +MESON_TAC [eus1] + ]);; + (* }}} *) + +let facet_rep_def = new_specification ["facet_rep_a";"facet_rep_b"] facet_rep_spec;; + +let facet_rep_uniq_c = prove_by_refinement( + `!(P:real^2 -> bool) c1 c2. polyhedron P /\ c1 facet_of P /\ c2 facet_of P /\ + (facet_rep_a P c1 = facet_rep_a P c2) ==> (c1 = c2)`, + (* {{{ proof *) + [ +REPEAT STRIP_TAC ; +MP_TAC (SPECL[`P:real^2->bool`;`facet_rep_a P c1`;`facet_rep_b P c1`;`facet_rep_b P c2`] facet_rep_uniq); +ASM_REWRITE_TAC []; +MP_TAC (SPECL[`P:real^2->bool`;`c1:real^2->bool`] facet_rep_def); +MP_TAC (SPECL[`P:real^2->bool`;`c2:real^2->bool`] facet_rep_def); +ASM_REWRITE_TAC []; +REPEAT STRIP_TAC ; +ASM_MESON_TAC [] + ]);; + (* }}} *) + +let norm1_cauchy_eq = prove_by_refinement( + `!(x:real^N) y. norm x = &1 /\ norm y = &1 /\ x dot y = &1 ==> (x = y)`, + (* {{{ proof *) + [ +REPEAT STRIP_TAC ; +MP_TAC (SPECL [`x:real^N`;`y:real^N`] NORM_CAUCHY_SCHWARZ_EQ); +ASM_REWRITE_TAC [REAL_ARITH `&1 * &1 = &1`;VECTOR_MUL_LID]; +MESON_TAC [] + ]);; + (* }}} *) + +let facet_rep_in_facet = prove_by_refinement( + `!(P:real^2->bool) c1 c2 r. polyhedron P /\ c1 facet_of P /\ c2 facet_of P /\ + (&0 < r) /\ (!p. norm p < r ==> P p) /\ + (facet_rep_b P c1 <= facet_rep_a P c1 dot (r % facet_rep_a P c2)) ==> + (c1 = c2)`, + (* {{{ proof *) + [ +REWRITE_TAC [DOT_RMUL]; +REPEAT STRIP_TAC ; +MATCH_MP_TAC facet_rep_uniq_c; +EXISTS_TAC `P:real^2->bool`; +ASM_REWRITE_TAC []; +MATCH_MP_TAC (norm1_cauchy_eq); +SUBGOAL_THEN `norm (facet_rep_a (P:real^2->bool) c1) = &1 /\ norm (facet_rep_a P c2) = &1 /\ facet_rep_a P c1 dot facet_rep_a P c2 <= &1` (MP_TAC); +ASM_MESON_TAC [facet_rep_def;REAL_ARITH `&1 * &1 = &1`;NORM_CAUCHY_SCHWARZ]; +REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]; +SUBGOAL_THEN `r <= facet_rep_b P c1` MP_TAC; +ASM_MESON_TAC [facet_rep_def]; +DISCH_TAC ; +HASH_UNDISCH_TAC 4642 ; +REWRITE_TAC [REAL_ARITH `x <= &1 <=> (x = &1) \/ (x < &1)`]; +DISCH_THEN DISJ_CASES_TAC THEN ASM_REWRITE_TAC[]; +ABBREV_TAC `d = facet_rep_a P c1 dot facet_rep_a P c2 `; +SUBGOAL_THEN `&0 < (r * (&1 - d))` ASSUME_TAC; +MATCH_MP_TAC REAL_LT_MUL; +ASM_REAL_ARITH_TAC ; +ASM_REAL_ARITH_TAC + ]);; + (* }}} *) + +let facet_rep_refl = prove_by_refinement( + `!(P:real^2->bool) c r. polyhedron P /\ c facet_of P /\ + (&0 < r) /\ (!p. norm p < r ==> P p) ==> + (facet_rep_a P c dot (r % facet_rep_a P c) <= facet_rep_b P c)`, + (* {{{ proof *) + [ +REWRITE_TAC [DOT_RMUL;Collect_geom.X_DOT_X_EQ]; +REPEAT STRIP_TAC ; +MP_TAC (SPECL[`P:real^2->bool`;`c:real^2->bool`] facet_rep_def); +ASM_REWRITE_TAC []; +REPEAT STRIP_TAC ; +ASM_REWRITE_TAC [Trigonometry2.POW2_1;REAL_ARITH ` r * &1 = r`]; +ASM_MESON_TAC [] + ]);; + (* }}} *) + + +let DOT_EQ_IMP_INEQ_LEMMA = prove_by_refinement( + `!(a:real^N) b a' b'. + (!x. a dot x = b <=> a' dot x = b') /\ (&0 < b) /\ (&0 < b') ==> + (!x. ~(a dot x = &0) ==> (a dot x <= b <=> a' dot x <= b'))`, + (* {{{ proof *) + [ +REPEAT STRIP_TAC ; +HASH_RULE_TAC 2720 (SPEC `((b/(a dot x)) % (x:real^N))`); +REWRITE_TAC [DOT_RMUL]; +SUBGOAL_THEN `b / (a dot x) * (a dot (x:real^N)) = b` SUBST1_TAC; +HASH_UNDISCH_TAC 5506 ; +BY(CONV_TAC REAL_FIELD); +REWRITE_TAC [REAL_FIELD `b/ (a dot x) * (a' dot x) = b * ((a' dot x) / (a dot (x:real^N)))`]; + DISCH_THEN (fun t-> ASSUME_TAC(GSYM t)); +ASM_REWRITE_TAC []; +SUBGOAL_THEN `&0 < (a' dot (x:real^N)) / (a dot x) ` ASSUME_TAC; +HASH_UNDISCH_TAC 9752 ; +ASM_REWRITE_TAC [REAL_MUL_POS_LT]; +ASM_REAL_ARITH_TAC; +SUBGOAL_THEN `a dot (x:real^N) <= b <=> (a dot x) * ((a' dot x)/(a dot x)) <= b * (a' dot x)/(a dot x)` SUBST1_TAC; +ASM_SIMP_TAC [REAL_LE_RMUL_EQ]; +SUBGOAL_THEN `(a dot (x:real^N)) * (a' dot x)/ (a dot x) = a' dot x` SUBST1_TAC; +HASH_UNDISCH_TAC 5506 ; +BY (CONV_TAC REAL_FIELD); +BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let DOT_EQ_IMP_INEQ = prove_by_refinement( + `!(a:real^N) b a' b'. + (!x. a dot x = b <=> a' dot x = b') /\ (&0 <= b) /\ (&0 < b') ==> + (!x. (a dot x <= b) <=> a' dot x <= b')`, + (* {{{ proof *) + [ +REPEAT STRIP_TAC ; +SUBGOAL_THEN `&0 < b` ASSUME_TAC; +HASH_RULE_TAC 2720 (fun t -> (REWRITE_RULE[DOT_RZERO] (SPEC `(vec 0):real^N` t))); +ASM_REAL_ARITH_TAC ; +ASM_CASES_TAC `~(a dot (x:real^N) = &0)`; +ASM_MESON_TAC [DOT_EQ_IMP_INEQ_LEMMA]; +ASM_CASES_TAC `~(a' dot (x:real^N) = &0)`; +ASM_MESON_TAC [DOT_EQ_IMP_INEQ_LEMMA]; +ASM_REAL_ARITH_TAC + ]);; + (* }}} *) + +let affine_facet_hyper = prove_by_refinement( + `!(P:real^N->bool) c a b. c facet_of P /\ polyhedron P /\ (affine hull P = (:real^N)) /\ + ~(a = vec 0) /\ + P INTER { x | a dot x = b } = c ==> + (affine hull c = { x | a dot x = b})`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `{x | a dot x = b} = affine hull {x | a dot x = b}` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC [ AFFINE_HULL_EQ; AFFINE_HYPERPLANE ]); + MATCH_MP_TAC AFF_DIM_EQ_AFFINE_HULL; + ASM_SIMP_TAC [ AFF_DIM_HYPERPLANE ]; + CONJ_TAC; + EXPAND_TAC "c"; + BY(SET_TAC []); + HASH_UNDISCH_TAC 6578; + REWRITE_TAC [ facet_of ]; + HASH_UNDISCH_TAC 6209; + REWRITE_TAC [ GSYM AFF_DIM_EQ_FULL ]; + DISCH_THEN SUBST1_TAC; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC []; + ARITH_TAC + ]);; + (* }}} *) + +let POLYHEDRON_MEMBER = prove_by_refinement( + `!(P:real^2->bool) r (x:real^2). polyhedron P /\ (&0 < r) /\ (!p. norm p < r ==> P p) + /\ (!c. (c facet_of P) ==> (facet_rep_a P c dot x <= facet_rep_b P c )) ==> P x`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + HASH_COPY_TAC 8205; + HASH_UNDISCH_TAC 8205; + REWRITE_TAC [POLYHEDRON_INTER_AFFINE_MINIMAL]; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `affine hull P = (:real^2)` ASSUME_TAC; + MATCH_MP_TAC Packing3.CONTAINS_BALL_AFFINE_HULL; + EXISTS_TAC `(vec 0):real^2`; + EXISTSv_TAC "r"; + BY (ASM_REWRITE_TAC [ball;SUBSET;IN_ELIM_THM;DIST_0;IN]); + TYPIFY `P = INTERS f` (C SUBGOAL_THEN ASSUME_TAC); + BY (ASM_MESON_TAC [INTER_UNIV]); + (fun gl -> (MP_TAC (SPECL ( envl gl [`P`;`f`]) (INST_TYPE [`:2`,`:N`] FACET_OF_POLYHEDRON_EXPLICIT ))) gl); + HASH_COPY_TAC 2338; + HASH_UNDISCH_TAC 2338; + DISCH_THEN (fun loc_t -> ONCE_REWRITE_TAC [ GSYM loc_t ]); + ASM_REWRITE_TAC []; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC [INTERS;IN_ELIM_THM;IN]; + X_GENv_TAC "h"; + HASH_UNDISCH_TAC 8531; + REWRITE_TAC [ GSYM RIGHT_EXISTS_IMP_THM ; SKOLEM_THM ]; + REPEAT WEAK_STRIP_TAC; + (fun gl -> (HASH_RULE_TAC 7519 ( SPECL ( envl gl [`a`;`b`]) )) gl); + ASM_REWRITE_TAC []; + DISCH_TAC; + INTRO_TAC facet_rep_def [`P`]; + (fun gl -> ( let asm_3 = snd(List.nth (List.rev (goal_asms gl)) 3 ) in REWRITE_TAC [ asm_3 ]) gl); + DISCH_TAC; + TYPIFY `h` (HASH_RULE_TAC 1064 o SPEC); +(* (fun gl -> (HASH_RULE_TAC 1064 (SPEC ( env gl `h`))) gl); *) + ASM_REWRITE_TAC [IN]; + REPEAT WEAK_STRIP_TAC; + (fun gl -> ( let asm_13 = snd(List.nth (List.rev (goal_asms gl)) 13 ) in ONCE_REWRITE_TAC [ asm_13 ]) gl); + REWRITE_TAC [IN_ELIM_THM]; + ABBREV_TAC `(c:real^2->bool) = P INTER { x | a (h:real^2->bool) dot x = b h }`; + TYPIFY `c facet_of P` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC [IN]); + TYPIFY `c` (HASH_RULE_TAC 4778 o SPEC); +(* (fun gl -> (HASH_RULE_TAC 4778 (SPEC ( env gl `c`))) gl); *) + DISCH_TAC; + TYPIFY `norm (facet_rep_a P c) = &1 /\ &0 < facet_rep_b P c /\ c = P INTER {x | facet_rep_a P c dot x = facet_rep_b P c}` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC [ REAL_ARITH `&0 < r /\ r <= k ==> &0 < k`]); + REPEAT WEAK_STRIP_TAC; + TYPIFY `affine hull c = { x | a h dot x = b h}` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC affine_facet_hyper; + EXISTSv_TAC "P"; + BY(ASM_MESON_TAC []); + TYPIFY `affine hull c = { x | facet_rep_a P c dot x = facet_rep_b P c }` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC affine_facet_hyper; + EXISTSv_TAC "P"; + BY(ASM_MESON_TAC [ NORM_0; REAL_ARITH `~(&1 = &0)`]); + TYPIFY `a h dot x = b h <=> (facet_rep_a P c dot x = facet_rep_b P c)` (C SUBGOAL_THEN ASSUME_TAC); + HASH_UNDISCH_TAC 6018; + HASH_KILL_TAC 2868; + ASM_REWRITE_TAC []; + ONCE_REWRITE_TAC [ FUN_EQ_THM ]; + REWRITE_TAC [ IN_ELIM_THM ]; + BY(SIMP_TAC [] ); + TYPIFY `P (vec 0)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC [ NORM_0 ]); + TYPIFY `&0 <= b h` (C SUBGOAL_THEN ASSUME_TAC); + HASH_UNDISCH_TAC 7409; + HASH_UNDISCH_TAC 2868; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC [ INTERS;IN_ELIM_THM;IN ]; + (fun gl -> (DISCH_THEN (MP_TAC o (SPEC ( env gl `h`)))) gl); + (fun gl -> ( let asm_8 = snd(List.nth (List.rev (goal_asms gl)) 8 ) in REWRITE_TAC [ asm_8 ]) gl); + (fun gl -> ( let asm_11 = snd(List.nth (List.rev (goal_asms gl)) 11 ) in DISCH_THEN (MP_TAC o (ONCE_REWRITE_RULE [ asm_11 ] ))) gl); + BY(REWRITE_TAC [ IN_ELIM_THM; DOT_RZERO ]); + (fun gl -> (MP_TAC (SPECL ( envl gl [`a h`;`b h`;`facet_rep_a P c`;`facet_rep_b P c`]) (INST_TYPE [`:2`,`:N`] DOT_EQ_IMP_INEQ))) gl); + (fun gl -> ( let asm_17 = snd(List.nth (List.rev (goal_asms gl)) 17 ) in let asm_23 = snd(List.nth (List.rev (goal_asms gl)) 23 ) in REWRITE_TAC [ asm_23; asm_17 ]) gl); + ANTS_TAC; + HASH_UNDISCH_TAC 6018; + (fun gl -> ( let asm_19 = snd(List.nth (List.rev (goal_asms gl)) 19 ) in ONCE_REWRITE_TAC [ asm_19 ]) gl); + ONCE_REWRITE_TAC [ FUN_EQ_THM ]; + REWRITE_TAC [ IN_ELIM_THM ]; + BY(MESON_TAC []); + DISCH_THEN (fun loc_t -> REWRITE_TAC [ loc_t ]); + ASM_MESON_TAC [] + ]);; + (* }}} *) + +let facet_rep_in_poly = prove_by_refinement( + `!(P:real^2->bool) c r. polyhedron P /\ (c facet_of P) /\ + (&0 < r) /\ (!p. norm p < r ==> P p) ==> + P (r % facet_rep_a P c) +`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC POLYHEDRON_MEMBER; + EXISTSv_TAC "r"; + ASM_REWRITE_TAC []; + REPEAT WEAK_STRIP_TAC; + (fun gl -> (ASM_CASES_TAC ( env gl `c' = c`)) gl); + BY(ASM_MESON_TAC [ facet_rep_refl ]); + BY(ASM_MESON_TAC [ facet_rep_in_facet; REAL_ARITH `~(x <= y) ==> (y <= x)`]) + ]);; + (* }}} *) + +let facet_rep_not_in_facet = prove_by_refinement( + `!(P:real^2->bool) c c' r. polyhedron P /\ (c facet_of P) /\ (c' facet_of P) /\ + (&0 < r) /\ (!p. norm p < r ==> P p) /\ (c' (r % facet_rep_a P c)) ==> + (c' = c)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC facet_rep_in_facet; + EXISTSv_TAC "P"; + EXISTSv_TAC "r"; + ASM_REWRITE_TAC []; + (fun gl -> (MP_TAC (SPECL ( envl gl [`P`;`c'`]) facet_rep_def)) gl); + ASM_REWRITE_TAC []; + REPEAT WEAK_STRIP_TAC; + (fun gl -> ( let asm_9 = snd(List.nth (List.rev (goal_asms gl)) 9 ) in HASH_RULE_TAC 2871 ( ONCE_REWRITE_RULE [ asm_9 ] )) gl); + REWRITE_TAC [ IN_ELIM_THM;INTER ]; + REAL_ARITH_TAC + ]);; + (* }}} *) + +let facet_arg_lt_pi = prove_by_refinement( + `!(P:real^2->bool) c r. polyhedron P /\ bounded P /\ c facet_of P /\ + (&0 < r) /\ (!p. norm p < r ==> P p) ==> + (?c'. c' facet_of P /\ (&0 < Arg ( facet_rep_a P c' / facet_rep_a P c ) /\ + Arg (facet_rep_a P c' / facet_rep_a P c) < pi)) `, + (* {{{ proof *) + [ + REWRITE_TAC [bounded;IN;ARG_LT_PI]; + REPEAT WEAK_STRIP_TAC; + PROOF_BY_CONTR_TAC; + ABBREV_TAC `(p:real^2) = Cx (a + &1) * ii * facet_rep_a P c`; + HASH_RULE_TAC 2054 (REWRITE_RULE [ NOT_EXISTS_THM ]); + DISCH_TAC; + TYPIFY `P (vec 0)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC [ NORM_0 ]); + SUBGOAL_THEN (`&0 <= a`) ASSUME_TAC; + BY(ASM_MESON_TAC [ NORM_0 ]); + TYPIFY `P p` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC POLYHEDRON_MEMBER; + EXISTSv_TAC "r"; + ASM_REWRITE_TAC []; + REPEAT WEAK_STRIP_TAC; + TYPIFY `c'` (HASH_RULE_TAC 7404 o SPEC); + ASM_REWRITE_TAC []; + DISCH_TAC; + MATCH_MP_TAC REAL_LE_TRANS; + EXISTS_TAC `&0`; + MATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`); + CONJ_TAC; + BY(ASM_MESON_TAC [ facet_rep_def; REAL_ARITH `&0 < r /\ r <= x ==> &0 <= x` ]); + REWRITE_TAC [ DOT_RE ]; + EXPAND_TAC "p"; + REWRITE_TAC [ CNJ_MUL;CNJ_CX;CNJ_II ]; + SUBGOAL_THEN `facet_rep_a P c' * Cx (a + &1) * --ii * cnj (facet_rep_a P c) = -- (ii * Cx (a + &1) * facet_rep_a P c' * cnj (facet_rep_a P c))` SUBST1_TAC; + SIMPLE_COMPLEX_ARITH_TAC; + REWRITE_TAC [ RE_NEG;IM_MUL_CX;RE_MUL_II;REAL_ARITH ` -- -- x = x`;REAL_ARITH `a * u <= &0 <=> &0 <= a * (-- u)` ]; + MATCH_MP_TAC Real_ext.REAL_PROP_NN_MUL2; + ASM_SIMP_TAC [ REAL_ARITH `&0 <= a ==> &0 <= a + &1`]; + REWRITE_TAC [ REAL_ARITH `(&0 <= -- x <=> ~(&0 < x))` ]; + BY(ASM_MESON_TAC [ IM_COMPLEX_DIV_GT_0 ]); + TYPIFY `p` (HASH_RULE_TAC 8984 o SPEC); + ASM_REWRITE_TAC []; + EXPAND_TAC "p"; + REWRITE_TAC [ COMPLEX_NORM_MUL ]; + REWRITE_TAC [ COMPLEX_NORM_MUL;COMPLEX_NORM_II; COMPLEX_NORM_CX; ]; + (fun gl -> (MP_TAC (SPECL ( envl gl [`P`;`c`]) facet_rep_def)) gl); + ASM_REWRITE_TAC []; + REPEAT WEAK_STRIP_TAC; + HASH_UNDISCH_TAC 8903; + ASM_REWRITE_TAC []; + (CONV_TAC REAL_FIELD) + ]);; + (* }}} *) + +let eus_cos = prove_by_refinement( + `!phi psi. &0 <= psi /\ psi <= phi /\ phi <= &2 * pi - psi ==> + cos phi <= cos psi`, + (* {{{ proof *) +[ +REPEAT STRIP_TAC ; +DISJ_CASES_TAC (REAL_ARITH `phi <= pi \/ (pi <= phi)`); +MATCH_MP_TAC COS_MONO_LE; +ASM_REWRITE_TAC []; +ABBREV_TAC `phi' = &2 * pi - phi`; +HASH_UNDISCH_TAC 6556 ; + DISCH_THEN (fun t -> (REPEAT (POP_ASSUM MP_TAC) THEN REWRITE_TAC[REWRITE_RULE[REAL_ARITH `x - y = u <=> (y = x - u)`] t])); +REWRITE_TAC [REAL_ARITH `pi <= &2 * pi - phi' <=> phi' <= pi`;GSYM Trigonometry2.COS_SUM_2PI]; +REPEAT STRIP_TAC ; +MATCH_MP_TAC COS_MONO_LE; +ASM_REAL_ARITH_TAC +]);; + (* }}} *) + +let insert_v = prove_by_refinement( + `!P c c' r v psi. polyhedron P /\ c facet_of P /\ c' facet_of P /\ + (&0 < r) /\ (!p. norm p < r ==> P p) /\ + Arg(v / facet_rep_a P c) = psi /\ + &0 < psi /\ + psi < pi / &2 /\ + Arg (facet_rep_a P c' / facet_rep_a P c) = &2 * psi /\ + (!c''. (c'' facet_of P /\ Arg (facet_rep_a P c'' / facet_rep_a P c) < &2 * psi) ==> (c'' = c)) /\ + norm v = r / cos psi ==> + (P v)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC POLYHEDRON_MEMBER; + EXISTSv_TAC "r"; + ASM_REWRITE_TAC []; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC [ DOT_RE ]; + ONCE_REWRITE_TAC [ ARG ]; + ASM_REWRITE_TAC [ RE_MUL_CX ; COMPLEX_NORM_MUL;COMPLEX_NORM_CNJ;RE_CEXP;RE_MUL_II;IM_MUL_II;IM_CX;RE_CX ]; + REWRITE_TAC [ REAL_ARITH `-- &0 = &0`;REAL_EXP_0 ]; + TYPIFY `~(v = Cx (&0))` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC [ GSYM COMPLEX_VEC_0 ]; + DISCH_TAC; + HASH_UNDISCH_TAC 5247; + ASM_REWRITE_TAC [NORM_0]; + MATCH_MP_TAC (REAL_ARITH `&0 < x ==> ~(&0 = x)`); + REWRITE_TAC [ Calc_derivative.invert_den_lt ]; + MATCH_MP_TAC REAL_LT_MUL; + ASM_REWRITE_TAC []; + BY(ASM_SIMP_TAC [ COS_POS_PI2 ]); + ASM_SIMP_TAC [ GSYM ARG_CNJ ]; + MATCH_MP_TAC REAL_LE_TRANS; + EXISTSv_TAC "r"; + MATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`); + CONJ_TAC; + BY(ASM_MESON_TAC [ facet_rep_def ]); + SUBGOAL_THEN `norm (facet_rep_a P c'') = &1` SUBST1_TAC; + BY (ASM_MESON_TAC [ facet_rep_def ]); + TYPED_ABBREV_TAC `(phi:real) = Arg (facet_rep_a P c'' / v)`; + REWRITE_TAC [ real_div; REAL_ARITH `(&1 * r * v) * &1 * u = r * u * v` ]; + REWRITE_TAC [ REAL_ARITH `r * x <= r <=> &0 <= r * (&1 - x)` ]; + MATCH_MP_TAC Real_ext.REAL_PROP_NN_MUL2; + CONJ_TAC; + ASM_REAL_ARITH_TAC; + REWRITE_TAC [ REAL_ARITH `&0 <= &1 - x * inv y <=> x / y <= &1`]; + MATCH_MP_TAC Trigonometry2.REAL_LE_LDIV; + SUBGOAL_THEN `&0 < cos psi` ASSUME_TAC; + ASM_SIMP_TAC [ COS_POS_PI2 ]; + ASM_REWRITE_TAC []; + MATCH_MP_TAC eus_cos; + CONJ_TAC; + ASM_REAL_ARITH_TAC; + (fun gl -> (ASM_CASES_TAC ( env gl `c'' = c`)) gl); + EXPAND_TAC "phi"; + HASH_KILL_TAC 2447; + ASM_REWRITE_TAC []; + MP_TAC ARG_INV; + REWRITE_TAC [ GSYM ARG_EQ_0 ]; + ONCE_REWRITE_TAC [ GSYM COMPLEX_INV_DIV ]; + DISCH_TAC; + TYPIFY `Arg (inv (v/ facet_rep_a P c)) = &2 * pi - Arg (v / facet_rep_a P c)` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM MATCH_MP_TAC; + MATCH_MP_TAC( REAL_ARITH `&0 < psi ==> ~(psi = &0)` ); + BY(ASM_SIMP_TAC[]); + (fun gl -> ( let asm_5 = snd(List.nth (List.rev (goal_asms gl)) 5 ) in REWRITE_TAC [ asm_5 ]) gl); + HASH_UNDISCH_TAC 8776; + HASH_UNDISCH_TAC 4801; + MP_TAC PI_POS; + BY(REAL_ARITH_TAC); + TYPIFY `c''` (HASH_RULE_TAC 6343 o SPEC); + ASM_REWRITE_TAC [ REAL_ARITH `~(x < y) <=> (y <= x)`]; + SUBGOAL_THEN `!c. c facet_of P ==> ~(facet_rep_a P c = Cx (&0))` ASSUME_TAC; + REWRITE_TAC [ GSYM COMPLEX_VEC_0 ]; + REPEAT WEAK_STRIP_TAC; + BY(ASM_MESON_TAC [ NORM_0; facet_rep_def; REAL_ARITH`~(&0 = &1)` ]); + SUBGOAL_THEN `!x y. x / y = Cx (&0) <=> (x = Cx (&0) \/ y = Cx (&0))` ASSUME_TAC; + BY(REWRITE_TAC [ COMPLEX_ENTIRE;complex_div;COMPLEX_INV_EQ_0 ]); + TYPED_ABBREV_TAC `(z:complex) = facet_rep_a P c'' / facet_rep_a P c`; + TYPED_ABBREV_TAC `w = v / facet_rep_a P c`; + DISCH_TAC; + SUBGOAL_THEN ( `Arg z = Arg w + Arg (z/ w)` ) ASSUME_TAC; + MATCH_MP_TAC ARG_LE_DIV_SUM; + EXPAND_TAC "w"; + HASH_UNDISCH_TAC 8513; + EXPAND_TAC "z"; + HASH_KILL_TAC 7462; + ASM_SIMP_TAC []; + HASH_UNDISCH_TAC 8776; + REAL_ARITH_TAC; + SUBGOAL_THEN `phi = Arg (z / w)` ASSUME_TAC; + EXPAND_TAC "z"; + EXPAND_TAC "w"; + EXPAND_TAC "phi"; + AP_TERM_TAC; + REWRITE_TAC [ complex_div ;COMPLEX_INV_MUL;COMPLEX_INV_INV]; + SUBGOAL_THEN `(facet_rep_a P c'' * inv (facet_rep_a P c)) * inv v * facet_rep_a P c = facet_rep_a P c'' * inv v * (inv (facet_rep_a P c) * facet_rep_a P c)` SUBST1_TAC; + SIMPLE_COMPLEX_ARITH_TAC; + BY(ASM_SIMP_TAC [ COMPLEX_MUL_RID;COMPLEX_MUL_LINV ] ); + ASM_REWRITE_TAC []; + EXPAND_TAC "psi"; + HASH_UNDISCH_TAC 8513; + HASH_UNDISCH_TAC 6318; + EXPAND_TAC "psi"; + MP_TAC (SPEC `(z:complex)` ARG); + REAL_ARITH_TAC + ]);; + (* }}} *) + +let facet_rep_a_uniq = prove_by_refinement( + `!(P:real^2->bool) c1 c2 r. polyhedron P /\ c1 facet_of P /\ c2 facet_of P /\ + (&0 < r ) /\ (!p. norm p < r ==> P p) /\ + (?s. (&0 < s) /\ facet_rep_a P c1 = s % facet_rep_a P c2) ==> (c1 = c2) + `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `norm (facet_rep_a P c1) = s` ASSUME_TAC; + ASM_REWRITE_TAC [ NORM_MUL ]; + ASM_SIMP_TAC [ REAL_ARITH `&0 < s ==> (abs s = s)` ]; + SUBGOAL_THEN `norm (facet_rep_a P c2) = &1` SUBST1_TAC; + ASM_MESON_TAC [ facet_rep_def ]; + BY (REAL_ARITH_TAC ); + SUBGOAL_THEN `norm (facet_rep_a P c1) = &1` ASSUME_TAC; + BY (ASM_MESON_TAC [ facet_rep_def ] ); + HASH_UNDISCH_TAC 1250; + SUBGOAL_THEN `s = &1` SUBST1_TAC; + ASM_MESON_TAC []; + REWRITE_TAC [ VECTOR_MUL_LID ]; + (fun gl -> (MP_TAC (SPECL ( envl gl [`P`;`c1`]) facet_rep_def)) gl); + (fun gl -> (MP_TAC (SPECL ( envl gl [`P`;`c2`]) facet_rep_def)) gl); + ASM_REWRITE_TAC []; + (fun gl -> (MP_TAC (SPECL ( envl gl [`P`;`facet_rep_a P c1`;`facet_rep_b P c1`;`facet_rep_b P c2`]) facet_rep_uniq)) gl); + ASM_REWRITE_TAC []; + REPEAT WEAK_STRIP_TAC; + HASH_RULE_TAC 1397 (MATCH_MP ( TAUT `(a ==> (b /\ c)) ==> (a ==> c)`)); + DISCH_THEN MATCH_MP_TAC; + ASM_SIMP_TAC []; + ASM_REWRITE_TAC []; + MATCH_MP_TAC (TAUT (`a /\ b ==> b /\ a`)); + CONJ_TAC; + HASH_UNDISCH_TAC 3107; + BY(DISCH_THEN ACCEPT_TAC); + HASH_UNDISCH_TAC 119; + ASM_REWRITE_TAC [] + ]);; + (* }}} *) + +let poly_sort_fn = new_definition `poly_sort_fn P u c1 c2 = + ((c1 facet_of P) /\ (c2 facet_of P) /\ + (Arg (facet_rep_a P c1 / u) <= Arg (facet_rep_a P c2 / u)))`;; + +let poly_sort_antisym = prove_by_refinement( + `!P u c1 c2 r. (polyhedron P) /\ (&0 < r) /\ (!p. (norm p < r)==> (P p)) + /\ poly_sort_fn P u c1 c2 /\ poly_sort_fn P u c2 c1 /\ ~(u = Cx (&0)) + ==> (c1 = c2)`, + (* {{{ proof *) + [ + REWRITE_TAC [ poly_sort_fn ]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `Arg (facet_rep_a P c1 / u) = Arg (facet_rep_a P c2 / u)` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REAL_ARITH_TAC; + HASH_KILL_TAC 5764; + HASH_KILL_TAC 6109; + TYPIFY `!c. c facet_of P ==> ~(facet_rep_a P c = Cx (&0))` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC [ NORM_0; COMPLEX_VEC_0; facet_rep_def; REAL_ARITH `~(&0 = &1)` ]); + PROOF_BY_CONTR_TAC; + HASH_UNDISCH_TAC 8621; + ASM_SIMP_TAC [ ARG_EQ ; ARG_0_DIV ]; + REWRITE_TAC [ NOT_EXISTS_THM ]; + GEN_TAC; + MATCH_MP_TAC (TAUT `(a ==> ~b ) ==> ~(a /\ b)`); + DISCH_TAC; + SUBGOAL_THEN `facet_rep_a P c1 / u = Cx x * facet_rep_a P c2 / u <=> facet_rep_a P c1 = Cx x * facet_rep_a P c2` SUBST1_TAC; + REWRITE_TAC [ complex_div ]; + HASH_UNDISCH_TAC 9092; + BY(SIMP_TAC [ COMPLEX_MUL_ASSOC;COMPLEX_EQ_MUL_RCANCEL;COMPLEX_INV_EQ_0 ]); + REWRITE_TAC [ GSYM COMPLEX_CMUL ]; + DISCH_TAC; + ASM_MESON_TAC [facet_rep_a_uniq] + ]);; + (* }}} *) + +let poly_sort_trans = prove_by_refinement( + `!P u c1 c2 c3 r. polyhedron P /\ (&0 < r) /\ (!p. norm p < r ==> P p) /\ + ~(u = Cx (&0)) /\ + poly_sort_fn P u c1 c2 /\ poly_sort_fn P u c2 c3 ==> + poly_sort_fn P u c1 c3`, + (* {{{ proof *) + [ + REWRITE_TAC [ poly_sort_fn ]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC []; + ASM_REAL_ARITH_TAC + ]);; + (* }}} *) + +let POLY_SORT_LEMMA = prove_by_refinement( + `!P n s r u. (s = { c | c facet_of P }) /\ polyhedron P /\ (&0 < r) /\ + (!p. norm p < r ==> P p) /\ ~(u = Cx (&0)) /\ (s HAS_SIZE n) ==> + (?f. s = IMAGE f (1..n) /\ (!j k. + j IN 1..n /\ k IN 1..n /\ j < k + ==> ~(poly_sort_fn P u (f k) (f j))))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MP_TAC (SPEC `poly_sort_fn P u` (INST_TYPE [`:(real^2->bool)`,`:A`] TOPOLOGICAL_SORT)); + ANTS_TAC; + ASM_MESON_TAC [poly_sort_antisym;poly_sort_trans]; + (fun gl -> (DISCH_THEN (MP_TAC o (SPECL ( envl gl [`n`;`s`])))) gl); + ASM_MESON_TAC [] + ]);; + (* }}} *) + +let POLY_SORT = prove_by_refinement( + `!P n s r u. (s = { c | c facet_of P }) /\ polyhedron P /\ (&0 < r) /\ + (!p. norm p < r ==> P p) /\ ~(u = Cx (&0)) /\ (s HAS_SIZE n) ==> + (?f. s = IMAGE f (1..n) /\ + (!j k. j IN 1..n /\ k IN 1..n /\ j < k + ==> (Arg (facet_rep_a P (f j) / u) < Arg (facet_rep_a P (f k) / u))))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + (fun gl -> (MP_TAC (SPECL ( envl gl [`P`;`n`;`s`;`r`;`u`]) POLY_SORT_LEMMA)) gl); + ASM_REWRITE_TAC []; + REPEAT WEAK_STRIP_TAC; + EXISTSv_TAC "f"; + ASM_REWRITE_TAC []; + REPEAT WEAK_STRIP_TAC; + (fun gl -> (HASH_RULE_TAC 9718 (SPECL ( envl gl [`j`;`k`]))) gl); + ASM_REWRITE_TAC [ poly_sort_fn ]; + TYPIFY `!i. (i IN 1..n) ==> (f i facet_of P)` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT WEAK_STRIP_TAC; + HASH_UNDISCH_TAC 8348; + ONCE_REWRITE_TAC [ FUN_EQ_THM ]; + REWRITE_TAC [ IN_ELIM_THM;IMAGE; ]; + BY(ASM_MESON_TAC []); + ASM_SIMP_TAC []; + MATCH_MP_TAC (REAL_ARITH `~(a = b) ==> (~(b <= a) ==> (a < b))`); + DISCH_TAC; + TYPIFY `f j = f k` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC poly_sort_antisym; + EXISTSv_TAC "P"; + EXISTSv_TAC "u"; + EXISTSv_TAC "r"; + ASM_REWRITE_TAC [poly_sort_fn; REAL_ARITH `x <= x`]; + HASH_UNDISCH_TAC 8348; + ONCE_REWRITE_TAC [ FUN_EQ_THM ]; + REWRITE_TAC [IN;IN_ELIM_THM;IMAGE]; + BY(ASM_MESON_TAC [IN]); + TYPIFY `INJ f (1..n) s = SURJ f (1..n) s` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC INJ_IFF_SURJ; + BY(ASM_MESON_TAC [ HAS_SIZE_NUMSEG_1; HAS_SIZE ]); + TYPIFY `SURJ f (1..n) s` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_REWRITE_TAC [Misc_defs_and_lemmas.IMAGE_SURJ]); + HASH_UNDISCH_TAC 7609; + ASM_REWRITE_TAC []; + REWRITE_TAC [INJ;IMAGE;DE_MORGAN_THM]; + DISJ2_TAC; + ASM_MESON_TAC [ ARITH_RULE `j < k ==> ~((j:num) = k)`] + ]);; + (* }}} *) + +let POLY_SORT_BIJ = prove_by_refinement( + `!P n s r u. (s = { c | c facet_of P }) /\ polyhedron P /\ (&0 < r) /\ + (!p. norm p < r ==> P p) /\ ~(u = Cx (&0)) /\ (s HAS_SIZE n) ==> + (?f. s = IMAGE f (1..n) /\ BIJ f (1..n) s /\ + (!j k. j IN 1..n /\ k IN 1..n /\ j < k + ==> (Arg (facet_rep_a P (f j) / u) < Arg (facet_rep_a P (f k) / u))))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + (fun gl -> (MP_TAC (SPECL ( envl gl [`P`;`n`;`s`;`r`;`u`]) POLY_SORT)) gl); + ASM_REWRITE_TAC []; + REPEAT WEAK_STRIP_TAC; + EXISTSv_TAC "f"; + ASM_REWRITE_TAC [BIJ;Misc_defs_and_lemmas.IMAGE_SURJ;INJ;IN_IMAGE]; + CONJ_TAC; + BY(MESON_TAC []); + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC [ ARITH_RULE `(x = y) <=> ~(x < (y:num)) /\ ~(y < x)` ]; + ASM_MESON_TAC [ REAL_ARITH `(x = y) ==> ~( x < y)` ] + ]);; + (* }}} *) + +let facet_rep_nz = prove_by_refinement( + `!P c. polyhedron P /\ c facet_of P ==> ~(facet_rep_a P c = Cx (&0))`, + (* {{{ proof *) + [ + MESON_TAC [ COMPLEX_VEC_0; NORM_0 ; REAL_ARITH `~(&0= &1)`; facet_rep_def] + ]);; + (* }}} *) + +let bisector_point_exists = prove_by_refinement( + ` !P c c' r. ?v. !psi. (polyhedron P /\ c facet_of P /\ c' facet_of P /\ &0 < r /\ + (!p. norm p < r ==> P p) /\ + psi = Arg (facet_rep_a P c' / facet_rep_a P c) / &2 /\ + (!c''. c'' facet_of P /\ + Arg (facet_rep_a P c'' / facet_rep_a P c) < &2 * psi + ==> c'' = c) /\ + psi < pi/ &2 /\ ~(c' = c)) ==> + (P v /\ norm v = r * inv (cos (psi)) /\ Arg ( v/ facet_rep_a P c) = psi /\ + Arg (facet_rep_a P c' / v) = psi)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPED_ABBREV_TAC `psi = Arg (facet_rep_a P c' / facet_rep_a P c) / &2`; + TYPED_ABBREV_TAC `(u:real^2) = facet_rep_a P c`; + TYPED_ABBREV_TAC `(v:real^2) = Cx (r * inv (cos (psi))) * cexp (ii * (Cx psi)) * u`; + EXISTSv_TAC "v"; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC (TAUT `b /\ (b ==> c) /\ ( b /\ c ==> d) /\ ( b /\ c /\ d ==> a) ==> a /\ b /\ c /\ d `); + SUBGOAL_THEN `&0 <= psi` ASSUME_TAC; + HASH_KILL_TAC 8647; + EXPAND_TAC "psi"; + BY(MESON_TAC [ ARG ; REAL_ARITH `&0 <= x ==> &0 <= x/ &2`]); + CONJ_TAC; + EXPAND_TAC "v"; + REWRITE_TAC [COMPLEX_NORM_MUL;COMPLEX_NORM_CX;NORM_CEXP_II;REAL_ABS_MUL]; + EXPAND_TAC "u"; + ASM_SIMP_TAC [facet_rep_def; Trigonometry2.LT_IMP_ABS_REFL ]; + SUBGOAL_THEN `abs(inv(cos psi)) = inv (cos psi)` SUBST1_TAC; + REWRITE_TAC [ ( Trigonometry2.ABS_REFL);REAL_LE_INV_EQ]; + MATCH_MP_TAC Trigonometry.ZSKECZV; + MP_TAC PI_POS; + BY(ASM_REAL_ARITH_TAC); + BY(REAL_ARITH_TAC); + SUBGOAL_THEN `&0 < r * inv (cos psi)` ASSUME_TAC; + MATCH_MP_TAC REAL_LT_MUL; + ASM_REWRITE_TAC [ REAL_LT_INV_EQ ]; + MATCH_MP_TAC COS_POS_PI; + MP_TAC PI_POS; + ASM_REAL_ARITH_TAC; + CONJ_TAC; + DISCH_TAC; + EXPAND_TAC "v"; + REWRITE_TAC [ complex_div;GSYM COMPLEX_MUL_ASSOC ]; + SUBGOAL_THEN ( `u * inv u = Cx (&1)` ) SUBST1_TAC; + MATCH_MP_TAC COMPLEX_MUL_RINV; + BY(ASM_MESON_TAC [ facet_rep_def ; NORM_0 ; COMPLEX_VEC_0 ; REAL_ARITH `~(&0 = &1)` ]); + ASM_SIMP_TAC [ARG_MUL_CX]; + REWRITE_TAC [COMPLEX_MUL_RID]; + MATCH_MP_TAC ARG_UNIQUE; + EXISTS_TAC `&1`; + ASM_REWRITE_TAC [COMPLEX_MUL_LID;REAL_ARITH `&0 < &1`]; + MP_TAC PI_POS; + BY(ASM_REAL_ARITH_TAC); + CONJ_TAC; + DISCH_TAC; + (fun gl -> (MP_TAC (SPECL ( envl gl [`(v:complex) / u`;`facet_rep_a P c' / (u:complex)`]) ARG_LE_DIV_SUM)) gl); + ANTS_TAC; + REWRITE_TAC [ ARG_0_DIV ]; + MATCH_MP_TAC (TAUT `(a /\ b) /\ c ==> a /\ b /\ c`); + CONJ_TAC; + ASM_MESON_TAC [ NORM_0; REAL_ARITH `~(&0 < &0)`; facet_rep_def; REAL_ARITH `~(&0 = &1)` ; COMPLEX_VEC_0 ]; + BY(ASM_REAL_ARITH_TAC); + TYPIFY `facet_rep_a P c' / u / (v/ u) = facet_rep_a P c' / v` (C SUBGOAL_THEN (argthen SUBST1_TAC ASM_REAL_ARITH_TAC)); + REWRITE_TAC [ complex_div ; GSYM COMPLEX_MUL_ASSOC ]; + AP_TERM_TAC; + REWRITE_TAC [ COMPLEX_INV_MUL;COMPLEX_INV_INV]; + SUBGOAL_THEN `(inv u * u = Cx (&1)) ==> (inv (u:complex) * inv v * u = inv v) ` MATCH_MP_TAC; + SIMPLE_COMPLEX_ARITH_TAC; + MATCH_MP_TAC COMPLEX_MUL_LINV; + BY(ASM_MESON_TAC [ facet_rep_def; NORM_0 ; COMPLEX_VEC_0 ; REAL_ARITH `~(&0 = &1)` ]); + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC insert_v; + EXISTSv_TAC "c"; + EXISTSv_TAC "c'"; + EXISTSv_TAC "r"; + EXISTSv_TAC "psi"; + ASM_REWRITE_TAC []; + SUBCONJ_TAC; + ASM_SIMP_TAC [ (REAL_ARITH `&0 <= psi ==> (&0 < psi <=> ~(psi = &0))`)]; + DISCH_TAC; + HASH_UNDISCH_TAC 1934; + ASM_REWRITE_TAC []; + EXPAND_TAC "u"; + REWRITE_TAC [ (REAL_ARITH `x / &2 = &0 <=> x = &0`)]; + REWRITE_TAC [ ARG_EQ_0; REAL_EXISTS;DE_MORGAN_THM;NOT_EXISTS_THM ]; + MATCH_MP_TAC (TAUT `(b ==> a) ==> (a \/ ~b)`); + REPEAT WEAK_STRIP_TAC; + HASH_UNDISCH_TAC 2684; + ASM_REWRITE_TAC []; + DISCH_TAC; + SUBGOAL_THEN `!u v. u = v ==> (u * facet_rep_a P c = v * facet_rep_a P c)` MP_TAC; + REWRITE_TAC [ COMPLEX_EQ_MUL_RCANCEL ]; + BY(MESON_TAC []); + DISCH_THEN (fun loc_u -> FIRST_X_ASSUM (fun loc_t -> MP_TAC (MATCH_MP loc_u loc_t))); + REWRITE_TAC [ complex_div ; GSYM COMPLEX_MUL_ASSOC ]; + ASM_SIMP_TAC [ COMPLEX_MUL_LINV ; facet_rep_nz; COMPLEX_MUL_RID ]; + EXPAND_TAC "u"; + REWRITE_TAC [GSYM COMPLEX_CMUL]; + HASH_RULE_TAC 8014 ( REWRITE_RULE[ RE_CX]); + DISCH_TAC; + DISCH_TAC; + SUBGOAL_THEN `&0 < x` ASSUME_TAC; + ASM_SIMP_TAC [(REAL_ARITH `&0 <= x ==> (&0 < x <=> ~(x = &0))`)]; + DISCH_TAC; + HASH_UNDISCH_TAC 487; + ASM_REWRITE_TAC [ VECTOR_MUL_LZERO; COMPLEX_VEC_0 ]; + BY(ASM_MESON_TAC [ facet_rep_nz ]); + BY(ASM_MESON_TAC [ facet_rep_a_uniq]); + FULL_EXPAND_TAC "u"; + FULL_EXPAND_TAC "psi"; + ASM_REWRITE_TAC [ real_div ]; + ASM_REAL_ARITH_TAC + ]);; + (* }}} *) + +let bisector_point = new_specification ["bisector_point"] (REWRITE_RULE[SKOLEM_THM] bisector_point_exists);; + +let RCONE_LINEAR_INVARIANT = prove_by_refinement( + `!(f:real^M->real^N) v a. + linear f /\ (!y. ?x. f x = y) /\ (!x. norm (f x) = norm x) + ==> rcone_gt (vec 0) (f v) a = IMAGE f (rcone_gt (vec 0) v a)`, + (* {{{ proof *) + [ + REWRITE_TAC [rcone_gt;rconesgn; VECTOR_SUB_RZERO; DIST_0]; + ONCE_REWRITE_TAC [FUN_EQ_THM]; + REWRITE_TAC [IMAGE;IN_ELIM_THM;IN]; + MESON_TAC[ PRESERVES_NORM_PRESERVES_DOT ] + ]);; + (* }}} *) + +let FCHANGED_LINEAR_INVARIANT = prove_by_refinement( + `!(f:real^M->real^N) c. linear f /\ (!x y. (f x = f y) ==> x = y) + ==> fchanged (IMAGE f c) = IMAGE f (fchanged c)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC [Polyhedron.fchanged]; + ONCE_REWRITE_TAC [FUN_EQ_THM]; + REWRITE_TAC[ IN_ELIM_THM]; + (fun gl -> (MP_TAC (ISPECL ( envl gl [`f`;`c`]) RELATIVE_INTERIOR_INJECTIVE_LINEAR_IMAGE )) gl); + ASM_REWRITE_TAC []; + DISCH_THEN SUBST1_TAC; + GEN_TAC; + EQ_TAC; + REWRITE_TAC [IN_ELIM_THM;IN;IMAGE]; + REPEAT WEAK_STRIP_TAC; + EXISTS_TAC `(t % x'):real^M`; + ASM_SIMP_TAC [ LINEAR_CMUL ]; + BY(ASM_MESON_TAC []); + REWRITE_TAC [ X_IN IN_IMAGE ]; + DISCH_THEN (MP_TAC o (REWRITE_RULE [IN_ELIM_THM])); + REPEAT WEAK_STRIP_TAC; + EXISTS_TAC `(f:real^M->real^N) v1`; + EXISTSv_TAC "t"; + ASM_SIMP_TAC [ LINEAR_CMUL ]; + ASM_MESON_TAC [IN_IMAGE;IN_ELIM_THM;IN] + ]);; + (* }}} *) + +let BALL_LINEAR_INVARIANT = prove_by_refinement( + `!(f:real^M->real^M) r. linear f /\ (!x. norm (f x) = norm x ) /\ (!y. ?x. f x = y) + ==> IMAGE f (ball (vec 0,r)) = (ball (vec 0,r))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ONCE_REWRITE_TAC [FUN_EQ_THM]; + REWRITE_TAC[ X_IN IN_IMAGE; X_IN IN_BALL_0 ]; + ASM_MESON_TAC [] + ]);; + (* }}} *) + +let cos_acs_pi6 = prove_by_refinement( + `!h. &1 <= h /\ h <= h0 ==> + cos (acs (h/ &2) - pi/ &6) = h * sqrt3 / #4.0 + sqrt(&1- (h/ &2) pow 2) / &2`, + (* {{{ proof *) + [ +REWRITE_TAC[COS_SUB;COS_PI6;SIN_PI6;Sphere.h0;Sphere.sqrt3]; +REPEAT STRIP_TAC; + SUBGOAL_THEN `-- &1 <= h/ &2 /\ h/ &2 <= &1` MP_TAC; +ASM_REAL_ARITH_TAC; +REPEAT STRIP_TAC; +ASM_SIMP_TAC[SIN_ACS;COS_ACS]; +REAL_ARITH_TAC + ]);; + (* }}} *) + +let regular_spherical_polygon_area_asnFnhk = prove_by_refinement( + `!h k . (3 <= k /\ &1 <= h /\ h <= h0) ==> + (regular_spherical_polygon_area (h * sqrt3 / #4.0 + sqrt (&1 - (h/ &2) pow 2) / &2) (&k) = + &2 * pi - &2 * asnFnhk h (&k) (&1) (&1) (&1) (&1))`, + (* {{{ proof *) + [ +REWRITE_TAC[Sphere.regular_spherical_polygon_area;Sphere.asnFnhk;Sphere.h0] + ]);; + (* }}} *) + +let regular_spherical_polygon_area_797 = prove_by_refinement( + `!h k . (3 <= k) ==> + (regular_spherical_polygon_area (cos #0.797) (&k) = + &2 * pi - &2 * (&k) * asn (cos #0.797 * sin (pi / &k)))`, + (* {{{ proof *) + [ +REWRITE_TAC[Sphere.regular_spherical_polygon_area;Sphere.asnFnhk;Sphere.h0] + ]);; + (* }}} *) + +let BIEFJHU_explicit = prove_by_refinement( + `!h k. (pack_ineq_def_a /\ &1 <= h /\ h <= h0 /\ 3 <= k) ==> + (#0.591 - #0.0331 * (&k) + #0.506 * lfun h) <= + max (&0) (regular_spherical_polygon_area + (h * sqrt3 / #4.0 + sqrt (&1 - (h/ &2) pow 2) / &2) (&k)) + `, + (* {{{ proof *) + [ +REWRITE_TAC[pack_ineq_def_a;Sphere.ineq;Sphere.lfun_y1;Sphere.h0]; +REPEAT STRIP_TAC; +ASM_CASES_TAC `&34 <= &k`; +HASH_UNDISCH_TAC 4600 ; + DISCH_THEN (MP_TAC o (SPECL [`h:real`;`&1`;`&1`;`&1`;`&1`;`&1`])); +MP_TAC (REAL_MAX_MAX); +BY(ASM_REAL_ARITH_TAC); +HASH_UNDISCH_TAC 3073 ; + DISCH_THEN (MP_TAC o (SPECL [`h:real`;`(&k)`;`&1`;`&1`;`&1`;`&1`])); +ASM_SIMP_TAC[regular_spherical_polygon_area_asnFnhk;Sphere.h0;REAL_ARITH `&1 <= &1 /\ #3.0 = &3`]; +MP_TAC (REAL_MAX_MAX); +HASH_RULE_TAC 415 (ONCE_REWRITE_RULE[GSYM REAL_OF_NUM_LE]); +ASM_REWRITE_TAC [REAL_ARITH `#1.0 = &1`]; +ASM_SIMP_TAC [REAL_ARITH `~(&34 <= &k) ==> &k <= #34.0`]; +ASM_REAL_ARITH_TAC + ]);; + (* }}} *) + +let UKBRPFE_explicit = prove_by_refinement( + `!k. (pack_ineq_def_a /\ 3 <= k) ==> + (#0.591 - #0.0331 * (&k) + #0.506 * lfun (&1) + &1 <= + max (&0) (regular_spherical_polygon_area (cos #0.797) (&k)))`, + (* {{{ proof *) + [ +REWRITE_TAC[pack_ineq_def_a;Sphere.ineq;Sphere.lfun_y1;Sphere.h0;Sphere.asn797k]; +REPEAT STRIP_TAC; +ASM_SIMP_TAC [regular_spherical_polygon_area_797]; +HASH_RULE_TAC 6953 (SPECL[`&k`;`&1`;`&1`;`&1`;`&1`;`&1`]); +HASH_RULE_TAC 415 (ONCE_REWRITE_RULE[GSYM REAL_OF_NUM_LE;REAL_ARITH `&3 = #3.0`]); +HASH_RULE_TAC 1319 (SPEC `&1`); +MP_TAC (REAL_MAX_MAX); +REAL_ARITH_TAC + ]);; + (* }}} *) + +let DLWCHEM_sum = prove_by_refinement( + `!h k n. pack_ineq_def_a /\ + (12 < n) /\ (!i. (i < n) ==> (3 <= k i) /\ (&1 <= h i) /\ (h i <= h0) ) /\ + (sum (0..(n-1)) (\i. &(k i)) <= (&6 * &n - &12)) /\ + (sum (0..(n-1)) + (\i. max (&0) (regular_spherical_polygon_area + ((h i * sqrt3 / #4.0 + sqrt (&1 - (h i/ &2) pow 2)/ &2) ) (&(k i)) )) + <= &4 * pi) /\ + (&12 < sum (0..(n-1)) (\i. lfun (h i))) + ==> (n < 16)`, + (* {{{ proof *) + [ +REPEAT STRIP_TAC; + SUBGOAL_THEN `sum (0..(n-1)) (\i. (#0.591 - #0.0331 * (&(k i)) + #0.506 * lfun (h i))) <= sum(0..(n-1)) (\i. max (&0) (regular_spherical_polygon_area ((h i * sqrt3 / #4.0 + sqrt (&1 - (h i/ &2) pow 2)/ &2) ) (&(k i)) ))` ASSUME_TAC; +MATCH_MP_TAC SUM_LE_NUMSEG; +ASM_SIMP_TAC [ARITH_RULE `(12 < n) ==> (0 <= i /\ i <= n-1 <=> i < n)`]; +REPEAT STRIP_TAC; +MP_TAC (SPECL [`(h:num->real) i`;`(k:num->num) i`] BIEFJHU_explicit); +ASM_SIMP_TAC []; + SUBGOAL_THEN `#0.591 * &n - #0.0331 * (&6 * &n - &12) + #0.506 * &12 <= sum (0..(n-1)) (\i. (#0.591 - #0.0331 * (&(k i)) + #0.506 * lfun (h i)))` ASSUME_TAC; +REWRITE_TAC[SUM_ADD_NUMSEG;SUM_SUB_NUMSEG;SUM_CONST_NUMSEG;SUM_LMUL]; +ASM_SIMP_TAC [ARITH_RULE `12 < n ==> (n-1 + 1 ) - 0= n `]; +ASM_REAL_ARITH_TAC; +SUBGOAL_THEN `#0.591 * &n - #0.0331 * (&6 * &n - &12) + #0.506 * &12 <= &4 * pi` MP_TAC; +ASM_REAL_ARITH_TAC; +SUBGOAL_THEN `pi < #3.1416` MP_TAC; +REWRITE_TAC [Flyspeck_constants.bounds]; +ONCE_REWRITE_TAC[GSYM REAL_OF_NUM_LT]; +REAL_ARITH_TAC + ]);; + (* }}} *) + +let XULJEPR_sum = prove_by_refinement( + `!h k n. ( pack_ineq_def_a /\ + (12 < n) /\ (h 0 = &1) /\ + (!i. i < n ==> 3 <= k i /\ &1 <= h i /\ h i <= h0) /\ +sum (0..n - 1) (\i. &(k i)) <= &6 * &n - &12 /\ +max (&0) (regular_spherical_polygon_area (cos #0.797) (&(k 0))) + sum (1..n - 1) + (\i. max (&0) + (regular_spherical_polygon_area + (h i * sqrt3 / #4.0 + sqrt (&1 - (h i / &2) pow 2) / &2) + (&(k i)))) <= + &4 * pi /\ + &12 < sum (0..n - 1) (\i. lfun (h i)) ==> F + )`, + (* {{{ proof *) + [ +REPEAT STRIP_TAC; + SUBGOAL_THEN `&1 + sum (0..(n-1)) (\i. (#0.591 - #0.0331 * (&(k i)) + #0.506 * lfun (h i))) <= max (&0) (regular_spherical_polygon_area (cos #0.797) (&(k 0))) + sum (1..n - 1) (\i. max (&0) (regular_spherical_polygon_area (h i * sqrt3 / #4.0 + sqrt (&1 - (h i / &2) pow 2) / &2) (&(k i))))` ASSUME_TAC; +ASM_SIMP_TAC [ARITH_RULE `0 <= (n-1)/\ 0 + 1 = 1`;SUM_CLAUSES_LEFT;]; +REWRITE_TAC [REAL_ARITH `&1 + u + v = (u+ &1) + v`]; +MATCH_MP_TAC (REAL_ARITH `a <= b /\ c <= d ==> (a + c) <= (b + d)`); +CONJ_TAC; +MP_TAC (SPEC `(k:num->num) 0` UKBRPFE_explicit); +ANTS_TAC; +ASM_MESON_TAC[ARITH_RULE `12 < n ==> 0 < n`]; +REAL_ARITH_TAC; +MATCH_MP_TAC SUM_LE_NUMSEG; +ASM_SIMP_TAC [ARITH_RULE `(12 < n) ==> (1 <= i /\ i <= n-1 <=> 1 <=i /\ i < n)`]; +REPEAT STRIP_TAC; +MP_TAC (SPECL [`(h:num->real) i`;`(k:num->num) i`] BIEFJHU_explicit); +BY(ASM_SIMP_TAC []); + SUBGOAL_THEN `&1 + #0.591 * &n - #0.0331 * (&6 * &n - &12) + #0.506 * &12 <= &1 + sum (0..(n-1)) (\i. (#0.591 - #0.0331 * (&(k i)) + #0.506 * lfun (h i)))` ASSUME_TAC; +MATCH_MP_TAC (REAL_ARITH `a <= b ==> &1 + a <= &1 + b`); +REWRITE_TAC[SUM_ADD_NUMSEG;SUM_SUB_NUMSEG;SUM_CONST_NUMSEG;SUM_LMUL]; +ASM_SIMP_TAC [ARITH_RULE `12 < n ==> (n-1 + 1 ) - 0= n `]; +BY(ASM_REAL_ARITH_TAC); +SUBGOAL_THEN `&1 + #0.591 * &n - #0.0331 * (&6 * &n - &12) + #0.506 * &12 <= &4 * pi` MP_TAC; +BY(ASM_REAL_ARITH_TAC); +SUBGOAL_THEN `pi < #3.1416` MP_TAC; +REWRITE_TAC [Flyspeck_constants.bounds]; +SUBGOAL_THEN `&13 <= &n` MP_TAC; +UNDISCH_TAC `12 < n`; +REWRITE_TAC[ REAL_OF_NUM_LE]; +ARITH_TAC; +REAL_ARITH_TAC + ]);; + (* }}} *) + +let REAL_CONVEX_ON_SECOND_SECANT = prove_by_refinement( + `!f f' f'' s. + is_realinterval s /\ + ~(?a. s = {a}) /\ + (!x. x IN s ==> (f has_real_derivative f' x) (atreal x within s)) /\ + (!x. x IN s ==> (f' has_real_derivative f'' x) (atreal x within s)) /\ + (!x. x IN s ==> &0 <= f'' x) + ==> (!x y. x IN s /\ y IN s ==> f y - f x <= f' y * (y - x))`, + (* {{{ proof *) + [ +REPEAT STRIP_TAC ; +SUBGOAL_THEN `f real_convex_on s` ASSUME_TAC; +ASM_MESON_TAC [REAL_CONVEX_ON_SECOND_DERIVATIVE]; +ASM_MESON_TAC [REAL_CONVEX_ON_SECANT_DERIVATIVE] + ]);; + (* }}} *) + +let asn_sin_t' = Calc_derivative.differentiate + `\x. x - asn(sin x * t)` `x:real` `real_interval [&0, pi]`;; + +let asn_sin_t'' = Calc_derivative.differentiate + `\x. &1 - (cos x * t) * inv (sqrt (&1 - (sin x * t) pow 2))` `x:real` `real_interval [&0, pi]`;; + +let asn_sin_t''_alt = prove_by_refinement( + `!x t alpha. abs(sin x * t) < &1 /\ cos alpha = sin x * t ==> + derived_form T (\x. &1 - (cos x * t) * inv (sqrt (&1 - (sin x * t) pow 2))) (t * (&1 - t pow 2) * sin x * inv (abs(sin alpha) pow 3)) (x:real) (real_interval [&0, pi])` , + (* {{{ proof *) + [ +REPEAT STRIP_TAC ; +MP_TAC asn_sin_t''; +REWRITE_TAC [Calc_derivative.derived_form]; +HASH_UNDISCH_TAC 8283 ; +FIRST_X_ASSUM (fun t -> (SUBST1_TAC o GSYM) t THEN ASSUME_TAC (GSYM t)); +DISCH_TAC; +SUBGOAL_THEN `~(sqrt (&1 - cos alpha pow 2) = &0) /\ &0 < &1 - cos alpha pow 2 /\ (--((cos x * t) * (--(&2 * cos alpha pow 1 * cos x * t) * inv (&2 * sqrt (&1 - cos alpha pow 2))) * --inv (sqrt (&1 - cos alpha pow 2) pow 2) + (--sin x * t) * inv (sqrt (&1 - cos alpha pow 2))) = (t * (&1 - t pow 2) * sin x * inv (abs(sin alpha) pow 3)))` (fun t -> MP_TAC t THEN MESON_TAC[]); +SUBGOAL_THEN `&0 < &1 - cos alpha pow 2` ASSUME_TAC; +REWRITE_TAC [REAL_ARITH `&0 < &1 - x pow 2 <=> x pow 2 < &1 pow 2`]; +ASM_REWRITE_TAC[GSYM REAL_LT_SQUARE_ABS;REAL_ARITH `abs (&1) = &1`]; +ASM_REWRITE_TAC []; +CONJ_TAC; +ASM_SIMP_TAC [ (SQRT_EQ_0); REAL_ARITH `&0 < u ==> &0 <= u`]; +BY(ASM_REAL_ARITH_TAC); +SUBGOAL_THEN `sqrt (&1 - cos alpha pow 2) = abs(sin alpha)` SUBST1_TAC; +REWRITE_TAC[REWRITE_RULE [REAL_ARITH `(x + y = &1) <=> ( &1 - y = x)`] (SPEC`alpha:real` SIN_CIRCLE)]; +REWRITE_TAC [POW_2_SQRT_ABS]; +MATCH_MP_TAC (Calc_derivative.rational_identity `--((cos x * t) * (--(&2 * cos alpha pow 1 * cos x * t) * inv (&2 * abs (sin alpha))) * --inv (abs (sin alpha) pow 2) + (--sin x * t) * inv (abs (sin alpha))) = t * (&1 - t pow 2) * sin x * inv (abs(sin alpha) pow 3)`); +REWRITE_TAC [REAL_ARITH `~(&2= &0) /\ ~(&1 = &0)`;REAL_ABS_ZERO]; +CONJ_TAC; +HASH_UNDISCH_TAC 754 ; +REWRITE_TAC [REWRITE_RULE[REAL_ARITH `x + y = &1 <=> &1 - y = x`] (SPEC `alpha:real` SIN_CIRCLE)]; +REWRITE_TAC [Trigonometry2.NOT_ZERO_EQ_POW2_LT]; +MP_TAC (SPEC `x:real` SIN_CIRCLE); +MP_TAC (SPEC `alpha:real` SIN_CIRCLE); +HASH_UNDISCH_TAC 3350 ; +SUBST1_TAC (SPEC `sin(alpha)` (GSYM REAL_POW2_ABS)); +TYPED_ABBREV_TAC `u = abs (sin alpha)`; +CONV_TAC REAL_FIELD + ]);; + (* }}} *) + +let real_interval_not_sing = prove_by_refinement( + `!a b. (a < b) ==> ~(?c. real_interval [a,b] = {c})`, + (* {{{ proof *) + [ +REWRITE_TAC [real_interval]; +REPEAT STRIP_TAC ; +HASH_UNDISCH_TAC 5180 ; +REWRITE_TAC[FUN_EQ_THM;IN;IN_ELIM_THM;X_IN IN_SING]; +STRIP_TAC ; +FIRST_X_ASSUM (fun t -> MP_TAC (SPEC `a:real` t) THEN MP_TAC (SPEC `b:real` t)); +ASM_REAL_ARITH_TAC + ]);; + (* }}} *) + +let g_convex = prove_by_refinement( + `!t. (&0 < t /\ t < &1) ==> (? s f' f''. + s = real_interval [&0, pi] /\ + is_realinterval s /\ + ~(?a. s = {a}) /\ + (!x. x IN s ==> ((\x. x - asn(sin x * t)) has_real_derivative f' x) (atreal x within s)) /\ + (!x. x IN s ==> (f' has_real_derivative f'' x) (atreal x within s)) /\ + (!x. x IN s ==> &0 <= f'' x)) + `, + (* {{{ proof *) + [ +REPEAT STRIP_TAC; +EXISTS_TAC `real_interval [&0, pi]`; +REWRITE_TAC [IS_REALINTERVAL_INTERVAL]; +EXISTS_TAC `(\x. &1 - (cos x * t) * inv (sqrt (&1 - (sin x * t) pow 2)))`; +EXISTS_TAC `\x. (t * (&1 - t pow 2) * sin x * inv (abs(sin (acs (sin x * t))) pow 3))`; +CONJ_TAC; +MATCH_MP_TAC real_interval_not_sing; +REWRITE_TAC [PI_POS]; +SUBGOAL_THEN `!x. abs(sin x * t) < &1` ASSUME_TAC; +GEN_TAC; +REWRITE_TAC [REAL_ABS_MUL]; +ASM_SIMP_TAC [REAL_ARITH `&0 < t ==> abs t = t`]; +MATCH_MP_TAC (REAL_ARITH `(t < &1) /\ (&0 <= t - u * t) ==> u * t < &1`); +ASM_REWRITE_TAC [REAL_ARITH `t - u * t = t * (&1 - u)`;]; +MATCH_MP_TAC REAL_LE_MUL; +MP_TAC (SPEC `x:real` SIN_BOUND); +BY(ASM_REAL_ARITH_TAC); +SUBGOAL_THEN `!x. cos (acs (sin x * t)) = sin x * t` ASSUME_TAC; +GEN_TAC ; +MATCH_MP_TAC COS_ACS; +FIRST_X_ASSUM (MP_TAC o (SPEC `x:real`)); +BY(REAL_ARITH_TAC); +CONJ_TAC; +REPEAT STRIP_TAC ; +MP_TAC asn_sin_t'; +ASM_REWRITE_TAC [Calc_derivative.derived_form]; +CONJ_TAC; +REPEAT STRIP_TAC ; +REPEAT (FIRST_X_ASSUM (ASSUME_TAC o (SPEC `x:real`))); +MP_TAC (SPECL[`x:real`;`t:real`;`acs (sin x * t)`] asn_sin_t''_alt); +ASM_REWRITE_TAC [Calc_derivative.derived_form]; +REPEAT STRIP_TAC ; +BETA_TAC; +REPEAT (MATCH_MP_TAC REAL_LE_MUL THEN CONJ_TAC); +ASM_REAL_ARITH_TAC ; +REWRITE_TAC[REAL_ARITH `&1 - t pow 2 = (&1 - t) + t * (&1-t)`]; +MATCH_MP_TAC (REAL_ARITH `&0 < x /\ &0 < y ==> &0 <= x + y`); +CONJ_TAC THEN (TRY (MATCH_MP_TAC REAL_LT_MUL)) THEN ASM_REAL_ARITH_TAC; +HASH_UNDISCH_TAC 2464 ; +REWRITE_TAC [IN;IN_ELIM_THM;real_interval;SIN_POS_PI_LE]; +REWRITE_TAC [REAL_LE_INV_EQ;]; +MATCH_MP_TAC REAL_POW_LE; +REWRITE_TAC [REAL_ABS_POS] + ]);; + (* }}} *) + +let GOTCJAH_convex_sum = prove_by_refinement( + `!n t bet u. 0 < n /\ u <= &n * pi /\ &0 <= u /\ + &0 < t /\ t < &1 /\ sum (0..(n-1)) bet = u /\ + (!i. i < n ==> &0 <= bet i /\ bet i <= pi) ==> + (u - &n * asn (sin (u/ &n) * t)) <= sum (0..(n-1)) (\i. bet i - asn (sin (bet i) * t))`, + (* {{{ proof *) + [ +REPEAT STRIP_TAC ; +MP_TAC (SPEC `t:real` g_convex); +ASM_REWRITE_TAC []; +REPEAT STRIP_TAC ; +MP_TAC (SPECL [`\x. x - asn(sin x * t)`;`f':real->real`;`f'':real->real`;`s:real->bool`] REAL_CONVEX_ON_SECOND_SECANT); +ASM_REWRITE_TAC [real_interval;IN_ELIM_THM]; +REWRITE_TAC [REAL_ARITH `u - v <= c * (y - x) <=> u + c * (x- y) <= v`]; +DISCH_TAC ; +TYPED_ABBREV_TAC `m = u / &n`; +SUBGOAL_THEN `&0 <= m /\ m <= pi` ASSUME_TAC; +EXPAND_TAC "m"; +HASH_UNDISCH_TAC 5908 ; +HASH_UNDISCH_TAC 3476 ; +REWRITE_TAC[GSYM REAL_OF_NUM_LT]; +HASH_UNDISCH_TAC 9033 ; +SIMP_TAC [REAL_LE_DIV;REAL_ARITH `&0 < v ==> &0 <= v`]; +SIMP_TAC [REAL_LE_LDIV_EQ]; +REAL_ARITH_TAC ; +SUBGOAL_THEN `sum (0..n-1) (\i. m - asn (sin m * t) + f' m * (bet i - m)) <= sum (0..n-1) (\i. bet i - asn (sin (bet i) * t))` ASSUME_TAC; +MATCH_MP_TAC SUM_LE_NUMSEG; +BETA_TAC; +ASM_SIMP_TAC [ARITH_RULE `0 < n ==> (0 <= i /\ i <= n-1 <=> i < n)`]; +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC `sum (0..n - 1) (\i. m - asn (sin m * t) + f' m * (bet i - m))`; +ASM_REWRITE_TAC []; +ASM_REWRITE_TAC[SUM_ADD_NUMSEG;SUM_SUB_NUMSEG;SUM_CONST_NUMSEG;SUM_LMUL]; +ASM_SIMP_TAC [ARITH_RULE `0 < n ==> (n - 1 + 1) - 0 = n`]; +EXPAND_TAC "m"; +SUBGOAL_THEN `&n * u/ &n = u` (fun t -> SUBST1_TAC t THEN REAL_ARITH_TAC); +HASH_UNDISCH_TAC 3476 ; +REWRITE_TAC[GSYM REAL_OF_NUM_LT]; +CONV_TAC REAL_FIELD + ]);; + (* }}} *) + +let dih_dot = prove_by_refinement( + `!(u:real^3) v w. ~(u = vec 0) /\ ((w- u) dot v = &0) /\ ((w - u) dot u = &0) ==> + dihV (vec 0) u v w = pi / &2`, + (* {{{ proof *) + [ +REPEAT STRIP_TAC ; +MP_TAC (SPECL [`vec 0:real^3`;`u:real^3`;`v:real^3`;`w:real^3`] Hvihvec.HVIHVEC); +ASM_REWRITE_TAC [VECTOR_SUB_RZERO;LET_DEF;LET_END_DEF]; +DISCH_THEN SUBST1_TAC; +REWRITE_TAC [GSYM ORTHOGONAL_VECTOR_ANGLE;orthogonal]; +SUBGOAL_THEN `(u:real^3) cross w = u cross (w - u)` SUBST1_TAC; +REWRITE_TAC [CROSS_RADD;VECTOR_SUB;CROSS_RNEG;CROSS_REFL]; +REWRITE_TAC [GSYM VECTOR_SUB;VECTOR_SUB_RZERO]; +ONCE_REWRITE_TAC [DOT_SYM]; +ONCE_REWRITE_TAC [GSYM CROSS_TRIPLE]; +ONCE_REWRITE_TAC [CROSS_SKEW]; +REWRITE_TAC [CROSS_LAGRANGE;VECTOR_SUB;DOT_LADD;DOT_LNEG;DOT_LMUL]; +MATCH_MP_TAC (REAL_FIELD `a = &0 /\ b = &0 ==> -- ((c * a) + -- (d * b)) = &0`); +ONCE_REWRITE_TAC [DOT_SYM]; +ASM_REWRITE_TAC [GSYM VECTOR_SUB] + ]);; + (* }}} *) + +let abs_1_prod = prove_by_refinement( + `!x y. abs x <= &1 /\ abs y <= &1 ==> abs (x * y) <= &1`, + (* {{{ proof *) + [ +REWRITE_TAC [REAL_ABS_MUL;REAL_ARITH `(x * y <= &1 <=> &0 <= &1 - x * y) /\ (&1 - x * y) = y * (&1-x) + x * (&1-y) + (&1 - x) * (&1-y)` ]; +REPEAT STRIP_TAC ; +MATCH_MP_TAC (REAL_ARITH `&0 <= a /\ &0 <= b /\ &0 <= c ==> &0 <= a + b + c`); +REPEAT ((TRY CONJ_TAC) THEN (TRY (MATCH_MP_TAC REAL_LE_MUL)) THEN (TRY ASM_REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let sloc2_ortho = prove_by_refinement( + `!(va:real^3) vb vc. ~(coplanar {vec 0, va,vb,vc}) /\ (dihV (vec 0) vc va vb = pi / &2) + ==> + (let bet = dihV (vec 0) vb vc va in + let alp = dihV (vec 0) va vb vc in + let t = cos (arcV (vec 0) vb vc) in + (cos alp = sin bet * t))`, + (* {{{ proof *) + [ +REPEAT STRIP_TAC ; +MP_TAC (SPECL [`(vec 0):real^3`;`vc:real^3`;`vb:real^3`;`va:real^3`] (INST_TYPE [(`:3`,`:N`)] Trigonometry2.NLVWBBW)); +REPEAT LET_TAC; +SUBGOAL_THEN `~collinear {((vec 0):real^3), va , vc } /\ ~collinear {vec 0, va, vb} /\ ~collinear {vec 0, vc, vb}` ASSUME_TAC; +ASM_MESON_TAC [NOT_COPLANAR_NOT_COLLINEAR;SET_RULE `{vec 0, (va:real^3),vb,vc } = {vec 0 ,va,vc,vb} /\ {vec 0,va,vb,vc } = {vec 0 ,va,vb,vc} /\ {vec 0,va,vb,vc } = {vec 0 ,vc,vb,va}` ]; +ASM_REWRITE_TAC []; +SUBGOAL_THEN `al = pi/ &2` SUBST1_TAC; +ASM_MESON_TAC [DIHV_SYM]; +REWRITE_TAC [SIN_PI2;COS_PI2;REAL_ARITH `&1 * x = x /\ &0 * x = &0 /\ x + &0 = x`]; +SUBGOAL_THEN `ga = alp:real` SUBST1_TAC; +ASM_MESON_TAC [DIHV_SYM]; + DISCH_THEN (SUBST1_TAC o GSYM); +SUBGOAL_THEN `be = bet:real` SUBST1_TAC; +ASM_MESON_TAC [DIHV_SYM]; +SUBGOAL_THEN `t = cos c` SUBST1_TAC; +ASM_MESON_TAC [Trigonometry2.ARC_SYM]; +REAL_ARITH_TAC + ]);; + (* }}} *) + +let vol_solid_triangle_ortho = prove_by_refinement( + `!(u:real^3) v w. ~(coplanar {vec 0, u , v, w}) /\ + ((w- u) dot v = &0) /\ ((w - u) dot u = &0) ==> + (let bet = dihV (vec 0) v u w in + let t = cos (arcV (vec 0) v u) in + (&3 * vol_solid_triangle (vec 0) u v w (&1) = bet - asn (sin bet * t))) + `, + (* {{{ proof *) + [ +REPEAT STRIP_TAC ; +REWRITE_TAC [vol_solid_triangle]; +REPEAT LET_TAC; +REWRITE_TAC [REAL_ARITH `&3 * x * &1 pow 3 / &3 = x`]; +SUBGOAL_THEN `a231 = bet:real` SUBST1_TAC; +EXPAND_TAC "bet"; +EXPAND_TAC "a231"; +REWRITE_TAC [DIHV_SYM]; +SUBGOAL_THEN `abs(sin bet * t) <= &1` ASSUME_TAC; +MATCH_MP_TAC abs_1_prod; +EXPAND_TAC "t"; +REWRITE_TAC [COS_BOUND;SIN_BOUND]; +SUBGOAL_THEN `~((u:real^3) = vec 0)` ASSUME_TAC; +STRIP_TAC ; +HASH_UNDISCH_TAC 5227 ; +ASM_REWRITE_TAC [INSERT_INSERT;COPLANAR_3]; +SUBGOAL_THEN `a123 = pi / &2` SUBST1_TAC; +EXPAND_TAC "a123"; +MATCH_MP_TAC dih_dot; +ASM_REWRITE_TAC []; +SUBGOAL_THEN `asn (sin bet * t) = pi / &2 - acs( sin bet * t)` SUBST1_TAC; +MATCH_MP_TAC ASN_ACS; +ASM_REWRITE_TAC [REAL_ARITH `-- &1 <= x /\ x <= &1 <=> abs x <= &1`]; +SUBGOAL_THEN `a312 = acs (sin bet * t)` (fun t -> SUBST1_TAC t THEN REAL_ARITH_TAC); +EXPAND_TAC "a312"; +MATCH_MP_TAC COS_INJ_PI; +ASM_SIMP_TAC [COS_ACS;ACS_BOUNDS;DIHV_RANGE;REAL_ARITH `abs y <= &1 ==> -- &1 <= y /\ y <= &1`]; +EXPAND_TAC "a312"; +MP_TAC (SPECL [`u:real^3`;`v:real^3`;`w:real^3`] dih_dot); +ASM_REWRITE_TAC []; +DISCH_TAC ; +MP_TAC (SPECL [`w:real^3`;`v:real^3`;`u:real^3`] sloc2_ortho); +ANTS_TAC; +ASM_MESON_TAC [SET_RULE `{vec 0, (w:real^3), v ,u} = {vec 0,u,v,w}`;DIHV_SYM]; +REPEAT LET_TAC; +ASM_REWRITE_TAC []; +ASM_MESON_TAC [DIHV_SYM] + ]);; + (* }}} *) + +let inj_int_ball = Pack1.inj_map3;; + +let INJ_IMAGE = prove_by_refinement( + `!a b. INJ (f:A->B) a b ==> IMAGE f a SUBSET b`, + (* {{{ proof *) + [ +REWRITE_TAC [INJ;IMAGE;SUBSET;IN_ELIM_THM;IN]; +MESON_TAC [] + ]);; + (* }}} *) + +let INJ_CARD = prove_by_refinement( + `!a b f. FINITE b /\ INJ (f:A->B) a b ==> (FINITE a /\ CARD a <= CARD b)`, + (* {{{ proof *) + [ +REPEAT GEN_TAC; +STRIP_TAC ; +SUBGOAL_THEN `FINITE (a:A->bool)` ASSUME_TAC; +MATCH_MP_TAC (INST_TYPE [(`:B`,`:B`)]Misc_defs_and_lemmas.FINITE_INJ); +ASM_MESON_TAC []; +ASM_REWRITE_TAC []; +SUBGOAL_THEN `CARD (IMAGE (f:A->B) a) <= CARD (b:B->bool)` ASSUME_TAC; +MATCH_MP_TAC CARD_SUBSET; +ASM_SIMP_TAC [INJ_IMAGE]; +SUBGOAL_THEN `CARD a = CARD (IMAGE (f:A->B) a)` (fun t->SUBST1_TAC t THEN ASM_REWRITE_TAC[]); +MATCH_MP_TAC Misc_defs_and_lemmas.BIJ_CARD; +EXISTS_TAC `f:A->B`; +ASM_REWRITE_TAC [BIJ;Misc_defs_and_lemmas.IMAGE_SURJ]; +HASH_UNDISCH_TAC 4678 ; +REWRITE_TAC [INJ;IMAGE]; +SET_TAC[] + ]);; + (* }}} *) + +let card_packing_ball = prove_by_refinement( + `!r. (&0 <= r) ==> ?n. !(S:real^3->bool). + packing S /\ S SUBSET (ball ((vec 0),r)) ==> (FINITE S /\ (CARD S) <= n)`, + (* {{{ proof *) + [ +REPEAT STRIP_TAC ; +TYPED_ABBREV_TAC `r_int_ball = (sqrt (&8 * r pow 2 + &6))`; +TYPED_ABBREV_TAC `b = &4 / &3 * pi * (r_int_ball + sqrt (&3)) pow 3`; +MP_TAC (SPEC `b:real` REAL_ARCH_SIMPLE); +STRIP_TAC; +EXISTS_TAC `n:num`; +GEN_TAC ; +STRIP_TAC ; +MATCH_MP_TAC (MESON[REAL_LE_TRANS;REAL_OF_NUM_LE] `a /\ (&c <= b) /\ (b <= &n) ==> a /\ (c <= n)`); +ASM_REWRITE_TAC[]; +MP_TAC (SPECL [`(vec 0):real^3`;`r:real`;`S:real^3->bool`] inj_int_ball); +ASM_REWRITE_TAC []; +SUBGOAL_THEN `S INTER ball (vec 0,r) = (S:real^3->bool)` SUBST1_TAC; +HASH_UNDISCH_TAC 3742 ; +BY(SET_TAC[]); +MP_TAC (SPECL [`(vec 0):real^3`;`r_int_ball:real`] Vol1.WQZISRI); +ANTS_TAC; +EXPAND_TAC "r_int_ball"; +MATCH_MP_TAC SQRT_POS_LE; +MATCH_MP_TAC (REAL_ARITH `&0 <= a ==> &0 <= &8 * a + &6`); +REWRITE_TAC [REAL_LE_POW_2]; +REPEAT DISCH_TAC; +SUBGOAL_THEN `FINITE (S:real^3->bool) /\ CARD S <= CARD (int_ball (vec 0) r_int_ball)` ASSUME_TAC; +MATCH_MP_TAC INJ_CARD; +EXISTS_TAC `map3 (vec 0)`; +ASM_REWRITE_TAC []; +ASM_REWRITE_TAC []; +ASM_MESON_TAC [REAL_LE_TRANS;REAL_OF_NUM_LE] + ]);; + (* }}} *) + +let card_packing_annulus = prove_by_refinement( + `?n. !(S:real^3->bool). + packing S /\ S SUBSET ball_annulus ==> (FINITE S /\ (CARD S) <= n)`, + (* {{{ proof *) + [ +SUBGOAL_THEN `ball_annulus SUBSET ball((vec 0),(&2 * h0 + &1))` ASSUME_TAC; +REWRITE_TAC [Pack_defs.ball_annulus;cball;ball;SUBSET;DIFF;IN_ELIM_THM]; +REAL_ARITH_TAC ; +MP_TAC (SPEC `&2 * h0 + &1` card_packing_ball); +ANTS_TAC; +REWRITE_TAC [Sphere.h0]; +REAL_ARITH_TAC ; +REPEAT STRIP_TAC ; +EXISTS_TAC `n:num`; +GEN_TAC ; +STRIP_TAC ; +FIRST_X_ASSUM (MATCH_MP_TAC); +ASM_MESON_TAC [SUBSET_TRANS] + ]);; + (* }}} *) + +(* Almost identical to +Packing3.REAL_FINITE_MAX_EXISTS +*) + +let FINITE_MAX_EXISTS = prove_by_refinement( + `!(s:num->bool). ~(s = {}) /\ FINITE s ==> + (?a. (s a) /\ (!b. s b ==> (b <= a)))`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + MP_TAC (SPEC `(<):num->num->bool` (INST_TYPE [(`:num`,`:A`)]TOPOLOGICAL_SORT)); + ANTS_TAC; + BY(ARITH_TAC); + REWRITE_TAC [HAS_SIZE]; + DISCH_THEN (MP_TAC o (SPECL [`CARD (s:num->bool)`;`(s:num->bool)`])); + ASM_REWRITE_TAC []; + REPEAT STRIP_TAC; + EXISTS_TAC `(f:num->num) (CARD (s:num->bool))`; + HASH_UNDISCH_TAC 3729; + TYPED_ABBREV_TAC `c = CARD (s:num->bool)`; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC [IMAGE;IN_ELIM_THM]; + CONJ_TAC; + EXISTS_TAC `c:num`; + REWRITE_TAC [IN_NUMSEG]; + BY(ASM_MESON_TAC [ARITH_RULE `~(c = 0) ==> (1 <= c) /\ (c <= c)`;CARD_EQ_0]); + REPEAT STRIP_TAC; + HASH_RULE_TAC 6034 (REWRITE_RULE[ARITH_RULE `~((a:num) < b) <=> (b <= a)`]); + ASM_REWRITE_TAC []; + ASM_CASES_TAC `(x = c:num)`; + ASM_REWRITE_TAC []; + BY(ARITH_TAC); + DISCH_THEN MATCH_MP_TAC; + HASH_UNDISCH_TAC 3080; + HASH_UNDISCH_TAC 2978; + HASH_UNDISCH_TAC 8866; + REWRITE_TAC [IN_NUMSEG]; + ASM_MESON_TAC [ARITH_RULE `~(c = 0) ==> (1 <= c) /\ (c <= c) /\ (~(x=c) /\ (x <= c) ==> x < c)`;CARD_EQ_0] + ]);; + (* }}} *) + +let NOT_EMPTY_IMAGE = prove +( ` !(S:A -> bool) (f:A->B). ~( S = {}) ==> ~( IMAGE f S = {})`, SET_TAC[]);; + +let PACKING_INSERT = prove_by_refinement( + `!v S. packing S /\ ~(S v) /\ (!w. S w ==> (&2 <= dist(v,w))) ==> (packing (v INSERT S))`, + (* {{{ proof *) + [ +REWRITE_TAC [Sphere.packing;INSERT;IN;IN_ELIM_THM]; +MESON_TAC [DIST_SYM] + ]);; + (* }}} *) + +let weak_saturation = prove_by_refinement( + `!W S r. &2 <= r /\ r <= &2 * h0 /\ S SUBSET W /\ packing W /\ W SUBSET ball_annulus + /\ (!v w. S v /\ W w /\ dist(v,w) < r ==> (v = w) ) ==> + (?V. V SUBSET ball_annulus /\ packing V /\ + weakly_saturated V r (&2 * h0) /\ FINITE V /\ (W SUBSET V) /\ + (!v w. S v /\ V w /\ dist(v,w)< r ==> (v = w))) + `, + (* {{{ proof *) + [ +REPEAT STRIP_TAC ; +TYPED_ABBREV_TAC `WW = { V | W SUBSET V /\ packing V /\ V SUBSET ball_annulus /\ (!v w. S v /\ V w /\ dist(v,w) < r ==> (v = w) ) }`; +SUBGOAL_THEN `(WW (W:real^3->bool)):bool` ASSUME_TAC; +EXPAND_TAC "WW"; +REWRITE_TAC [IN_ELIM_THM]; +ASM_REWRITE_TAC [SUBSET_REFL]; +SUBGOAL_THEN `?n. !V. ((WW (V:real^3->bool)):bool) ==> FINITE V /\ CARD V <= n` (fun t -> MP_TAC t THEN STRIP_TAC); +EXPAND_TAC "WW"; +REWRITE_TAC [IN_ELIM_THM]; +MP_TAC card_packing_annulus; +STRIP_TAC ; +EXISTS_TAC `n:num`; +GEN_TAC ; +ASM_MESON_TAC []; +SUBGOAL_THEN `FINITE (IMAGE CARD (WW:(real^3->bool)->bool))` (MP_TAC); +MATCH_MP_TAC FINITE_SUBSET; +EXISTS_TAC `{ k | k <= (n:num)}`; +REWRITE_TAC [FINITE_NUMSEG_LE]; +REWRITE_TAC [IMAGE;SUBSET;IN_ELIM_THM;IN]; +ASM_MESON_TAC []; +DISCH_TAC ; +SUBGOAL_THEN `~(IMAGE CARD (WW:(real^3->bool)->bool) = {})` ASSUME_TAC; +MATCH_MP_TAC NOT_EMPTY_IMAGE; +REWRITE_TAC [GSYM MEMBER_NOT_EMPTY;IN]; +ASM_MESON_TAC []; +SUBGOAL_THEN `(?a. ((IMAGE CARD (WW:(real^3->bool)->bool)) a) /\ (!b. (IMAGE CARD WW) b ==> (b <= a)))` MP_TAC; +MATCH_MP_TAC FINITE_MAX_EXISTS; +ASM_REWRITE_TAC [ETA_AX]; +REWRITE_TAC [IMAGE;IN_ELIM_THM;IN]; +REPEAT STRIP_TAC ; +EXISTS_TAC `x:real^3->bool`; +SUBGOAL_THEN `W SUBSET x /\ x SUBSET ball_annulus /\ packing x /\ FINITE x /\ (!(v:real^3) w. S v /\ x w /\ dist (v,w) < r ==> v = w)` (fun t -> MP_TAC t THEN STRIP_TAC); +ASM_SIMP_TAC []; +HASH_UNDISCH_TAC 2672 ; +EXPAND_TAC "WW"; +REWRITE_TAC [IN_ELIM_THM;IN]; +MESON_TAC []; +ASM_REWRITE_TAC [Tarjjuw.weakly_saturated]; +REPEAT STRIP_TAC ; +REWRITE_TAC [IN]; +ASM_CASES_TAC `(x (v:real^3)):bool`; +EXISTS_TAC `v:real^3`; +ASM_REWRITE_TAC []; +CONJ_TAC ; +DISCH_TAC ; +HASH_UNDISCH_TAC 7486 ; +ASM_REWRITE_TAC [DIST_REFL]; +REAL_ARITH_TAC ; +ASM_REWRITE_TAC [DIST_REFL]; +ASM_REAL_ARITH_TAC; +MATCH_MP_TAC (MESON[] `( (!u. x u ==> ~(b u)) ==> F) ==> (?u. x u /\ b u)`); +DISCH_TAC ; +TYPED_ABBREV_TAC `y = (v:real^3) INSERT x`; +SUBGOAL_THEN `!u. x (u:real^3) ==> r <= dist (u,v)` ASSUME_TAC; +REPEAT STRIP_TAC ; +HASH_RULE_TAC 3271 (SPEC `u:real^3`); +ASM_REWRITE_TAC [DE_MORGAN_THM]; +DISCH_THEN DISJ_CASES_TAC; +HASH_UNDISCH_TAC 1666 ; +HASH_UNDISCH_TAC 7625 ; +EXPAND_TAC "u"; +REWRITE_TAC [SUBSET;Pack_defs.ball_annulus;DIFF;IN;ball;IN_ELIM_THM]; +MESON_TAC [DIST_REFL;REAL_ARITH `(&0 < &2)`]; +ASM_REAL_ARITH_TAC ; +ASM_CASES_TAC `CARD (y:(real^3->bool)) <= CARD (x:(real^3->bool))`; +HASH_UNDISCH_TAC 3148 ; +HASH_UNDISCH_TAC 7827 ; +EXPAND_TAC "y"; +HASH_UNDISCH_TAC 4093 ; +SIMP_TAC [CARD_CLAUSES;IN]; +STRIP_TAC ; +STRIP_TAC ; +MESON_TAC [Hypermap.LT_PLUS;ARITH_RULE `~(x <= y) <=> y < (x:num)`]; +HASH_UNDISCH_TAC 9017 ; +HASH_UNDISCH_TAC 5378 ; +ASM_REWRITE_TAC []; +DISCH_THEN (MATCH_MP_TAC); +EXISTS_TAC `y:real^3->bool`; +REWRITE_TAC []; +EXPAND_TAC "WW"; +REWRITE_TAC [IN_ELIM_THM]; +SUBGOAL_THEN `!w. (y w <=> (x w \/ (w = (v:real^3))))` ASSUME_TAC; +GEN_TAC ; +HASH_UNDISCH_TAC 3490 ; +ONCE_REWRITE_TAC [FUN_EQ_THM]; +REWRITE_TAC [INSERT;IN_ELIM_THM;IN]; +MESON_TAC []; +SUBGOAL_THEN `W SUBSET (y:real^3->bool)` ASSUME_TAC; +HASH_UNDISCH_TAC 7323 ; +HASH_UNDISCH_TAC 646 ; +REWRITE_TAC [SUBSET;IN]; +MESON_TAC []; +ASM_REWRITE_TAC []; +SUBGOAL_THEN `packing (y:real^3->bool)` ASSUME_TAC; +EXPAND_TAC "y"; +MATCH_MP_TAC PACKING_INSERT; +ASM_REWRITE_TAC []; +REPEAT STRIP_TAC ; +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC `r:real`; +ASM_SIMP_TAC []; +ONCE_REWRITE_TAC [DIST_SYM]; +ASM_SIMP_TAC []; +ASM_REWRITE_TAC []; +CONJ_TAC ; +EXPAND_TAC "y"; +ASM_REWRITE_TAC [INSERT_SUBSET]; +ASM_REWRITE_TAC [Pack_defs.ball_annulus;IN;DIFF;cball;ball;IN_ELIM_THM]; +ASM_REAL_ARITH_TAC ; +REPEAT STRIP_TAC ; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC []; +HASH_UNDISCH_TAC 8971 ; +ASM_REWRITE_TAC []; +HASH_RULE_TAC 7974 (SPEC `v':real^3`); +REWRITE_TAC [REAL_ARITH `x <= y <=> ~(y < x)`]; +HASH_UNDISCH_TAC 7323 ; +HASH_UNDISCH_TAC 5872 ; +HASH_UNDISCH_TAC 5644 ; +REWRITE_TAC [SUBSET;IN;IN_ELIM_THM]; +MESON_TAC [] + ]);; + (* }}} *) + +let RADIAL_NORM_LINEAR_INVARIANT = prove_by_refinement( + `!(f:real^M->real^N) s r. linear f /\ (!x. norm (f x) = norm x ) /\ (!y. ?x. f x = y) + ==> radial r (vec 0) (IMAGE f s) = radial r (vec 0) s`, + (* {{{ proof *) + [ + REWRITE_TAC [Sphere.radial; VECTOR_ADD_LID ]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC (TAUT `(a <=> b) /\( (a <=> b) ==> (c <=>d)) ==> (a /\ c <=> b /\ d)`); + STRIP_TAC; + REWRITE_TAC [Trigonometry1.DIST_L_ZERO;ball;SUBSET;IMAGE;IN_ELIM_THM]; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Geomdetail.EQ_EXPAND]; + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + HASH_RULE_TAC 7266 (SPEC `(f:real^M->real^N) u`); + REWRITE_TAC[IN;IMAGE;IN_ELIM_THM]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + STRIP_TAC; + HASH_RULE_TAC 503 (SPEC `(t:real)`); + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `x = t % (u:real^M)` MP_TAC; + BY(ASM_MESON_TAC[linear;PRESERVES_NORM_INJECTIVE;IN]); + BY(ASM_MESON_TAC[IN]); + REPEAT WEAK_STRIP_TAC; + HASH_UNDISCH_TAC 662; + REWRITE_TAC[IN;IMAGE;IN_ELIM_THM]; + WEAK_STRIP_TAC; + BY(ASM_MESON_TAC[IN;linear]) + ] );; + (* }}} *) + +let linear_inter_normball = prove_by_refinement( + `!(f:real^M->real^N) s r. linear f /\ (!x. norm (f x) = norm x ) ==> + ( IMAGE f s INTER normball (vec 0) r = IMAGE f (s INTER normball (vec 0) r))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ONCE_REWRITE_TAC[FUN_EQ_THM]; + GEN_TAC; + REWRITE_TAC[IMAGE;INTER;normball;DIST_0;IN;IN_ELIM_THM]; + Tactics_jordan.NAME_CONFLICT_TAC; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let sol0_linear = prove_by_refinement( + `!(f:real^3->real^3) s. linear f /\ (!x. norm (f x) = norm x) /\ (!y. ?x. f x = y)==> + ( (?r. r > &0 /\ + measurable (IMAGE f s INTER normball (vec 0) r) /\ + radial r (vec 0) (IMAGE f s INTER normball (vec 0) r)) <=> + (?r. r > &0 /\ + measurable (s INTER normball (vec 0) r) /\ + radial r (vec 0) (s INTER normball (vec 0) r)))`, + (* {{{ proof *) + [ + BY(ASM_MESON_TAC[linear_inter_normball;RADIAL_NORM_LINEAR_INVARIANT;PRESERVES_NORM_INJECTIVE;MEASURABLE_LINEAR_IMAGE_EQ]) + ]);; + (* }}} *) + +let sol0_linear_r = prove_by_refinement( + `!(f:real^3->real^3) s r. linear f /\ (!x. norm (f x) = norm x) /\ (!y. ?x. f x = y) /\ (r > &0) ==> + (( + measurable (IMAGE f s INTER normball (vec 0) r) /\ + radial r (vec 0) (IMAGE f s INTER normball (vec 0) r)) <=> + ( + measurable (s INTER normball (vec 0) r) /\ + radial r (vec 0) (s INTER normball (vec 0) r)))`, + (* {{{ proof *) + [ + BY(ASM_MESON_TAC[linear_inter_normball;RADIAL_NORM_LINEAR_INVARIANT;PRESERVES_NORM_INJECTIVE;MEASURABLE_LINEAR_IMAGE_EQ]) + ]);; + (* }}} *) + +let dropout_pad2d3d = prove_by_refinement( + `!x. dropout 3 (pad2d3d x) = x`, + (* {{{ proof *) + [ + ONCE_REWRITE_TAC[CART_EQ]; + REWRITE_TAC[dropout;pad2d3d]; + REPEAT WEAK_STRIP_TAC; + ASM_SIMP_TAC[LAMBDA_BETA;DIMINDEX_2;DIMINDEX_3]; + ASSUME_TAC (ARITH_RULE `i <= 2==> i<3` ); + SUBGOAL_THEN `i + 1 <= dimindex(:3) /\ i <= dimindex(:3)` ASSUME_TAC; + BY(ASM_MESON_TAC[DIMINDEX_3;DIMINDEX_2;ARITH_RULE `i<=2 ==> i+1 <= 3 /\ i <= 3`]); + COND_CASES_TAC THEN ASM_SIMP_TAC[LAMBDA_BETA;DIMINDEX_2;DIMINDEX_3]; + BY(ASM_MESON_TAC[DIMINDEX_3;DIMINDEX_2]) + ]);; + (* }}} *) + +let pad2d3d_dropout = prove_by_refinement( + `!x . (x$3= &0) ==> (pad2d3d (dropout 3 x) = x)`, + (* {{{ proof *) + [ + ONCE_REWRITE_TAC[CART_EQ]; + REWRITE_TAC[dropout;pad2d3d]; + REPEAT WEAK_STRIP_TAC; + ASM_SIMP_TAC[LAMBDA_BETA;DIMINDEX_2;DIMINDEX_3]; + COND_CASES_TAC; + BY(ASM_SIMP_TAC[LAMBDA_BETA;DIMINDEX_2;DIMINDEX_3;ARITH_RULE `i < 3 ==> i<= 2`]); + BY(ASM_MESON_TAC[DIMINDEX_3;ARITH_RULE `~(i<3) /\ (i <= 3) ==> (i=3)`]) + ]);; + (* }}} *) + +let pad2d3d_dropout_lemma = prove_by_refinement( + `!(A:A->bool) P h . (!x. x IN A ==> P x) /\ (!x. P x ==> h x = x) ==> + (IMAGE h A = A)`, + (* {{{ proof *) + [ + SET_TAC[] + ]);; + (* }}} *) + +let pad2d3d_dot_v = prove_by_refinement( + `!x y. (pad2d3d x dot pad2d3d y = x dot y)`, + (* {{{ proof *) + [ + BY(ASM_SIMP_TAC[GSYM LINEAR_SUB;LINEAR_PAD2D3D;DOT_NORM_NEG;NORM_PAD2D3D]) + ]);; + (* }}} *) + +let pad_in = prove_by_refinement( + `!x A. (!u. u IN A ==> u$3 = &0) ==> ((pad2d3d x IN A) <=> (x IN (IMAGE (dropout 3) A)))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[IN;IN_ELIM_THM;IMAGE]; + BY(ASM_MESON_TAC[dropout_pad2d3d;pad2d3d_dropout;IN]) + ]);; + (* }}} *) + +let pad2d3d_facet = prove_by_refinement( + `!P n. polyhedron (P:real^3->bool) /\ + (!u. u IN P ==> u$3 = &0) /\ { c | c facet_of P } HAS_SIZE n ==> + {d | (d:real^2->bool) facet_of (IMAGE (dropout 3) P) } HAS_SIZE n`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC (ISPEC `{c | c facet_of (P:real^3->bool)}` BIJECTIONS_HAS_SIZE); + ASM_REWRITE_TAC[IN_ELIM_THM]; + EXISTS_TAC `(IMAGE (dropout 3)): (real^3->bool)->real^2->bool`; + EXISTS_TAC `(IMAGE (pad2d3d)): (real^2->bool)->real^3->bool`; + REWRITE_TAC[GSYM IMAGE_o]; + SUBGOAL_THEN `!(A:real^3->bool). (A SUBSET P) ==> IMAGE(pad2d3d o dropout 3) A = A` ASSUME_TAC; + HASH_UNDISCH_TAC 5723; + REWRITE_TAC[IMAGE;IMAGE_o;SUBSET;IN_ELIM_THM]; + BY(SET_TAC[pad2d3d_dropout]); + SUBGOAL_THEN `!(B:real^2->bool). IMAGE (dropout 3 o pad2d3d) B = B` ASSUME_TAC; + REWRITE_TAC[IMAGE;IMAGE_o;SUBSET;IN_ELIM_THM]; + BY(SET_TAC[dropout_pad2d3d]); + REPEAT STRIP_TAC; + SUBGOAL_THEN `IMAGE pad2d3d (IMAGE (dropout 3) (x:real^3->bool)) facet_of (IMAGE pad2d3d (IMAGE (dropout 3) (P:real^3->bool)))` MP_TAC; + REWRITE_TAC[GSYM IMAGE_o]; + BY(ASM_MESON_TAC[FACET_OF_IMP_SUBSET;SUBSET_REFL]); + BY(ASM_MESON_TAC[FACET_OF_LINEAR_IMAGE;PRESERVES_NORM_INJECTIVE;LINEAR_PAD2D3D;NORM_PAD2D3D]); + BY(ASM_MESON_TAC[FACET_OF_IMP_SUBSET]); + BY(ASM_MESON_TAC[SUBSET_REFL;IMAGE_o;FACET_OF_LINEAR_IMAGE;PRESERVES_NORM_INJECTIVE;LINEAR_PAD2D3D;NORM_PAD2D3D]); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let ARG_SCALE = prove_by_refinement( + `!u w r. (&0 < r) ==> (Arg ((Cx r * u)/w) = Arg (u/w)) /\ (Arg (u/ (Cx r * w)) = Arg (u/w)) `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ASM_CASES_TAC `w = Cx (&0)`; + BY(ASM_REWRITE_TAC[complex_div;COMPLEX_MUL_RZERO;COMPLEX_MUL_LZERO;COMPLEX_INV_0]); + SUBGOAL_THEN `~(Cx r * w = Cx(&0))` ASSUME_TAC; + BY(ASM_SIMP_TAC[COMPLEX_ENTIRE;CX_INJ;REAL_ARITH `&0 < r ==> ~(r = &0)`]); + ASM_SIMP_TAC [Ysskqoy.ARG_CNJ;CNJ_CX;CNJ_MUL]; + BY(ASM_MESON_TAC[ARG_MUL_CX;COMPLEX_MUL_AC]) + ]);; + (* }}} *) + +let complex_frac_cancel = prove_by_refinement( + `!a b (c:complex). ~(b = Cx (&0)) ==> (a/b)/(c/b) = a / c`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ONCE_REWRITE_TAC[ complex_div]; + REWRITE_TAC[COMPLEX_INV_DIV]; + REWRITE_TAC[complex_div]; + MATCH_MP_TAC (prove(`(b' * b) *(a * (c:complex)) = d ==> (a * b' ) * (b * c) = d`,SIMPLE_COMPLEX_ARITH_TAC)); + BY(ASM_SIMP_TAC[COMPLEX_MUL_LINV;COMPLEX_MUL_LID]) + ]);; + (* }}} *) + + +let REAL_CX0 = prove_by_refinement( + `!z. real z /\ Re z = &0 ==> (z = Cx (&0))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + BY(ASM_MESON_TAC[COMPLEX_NORM_ZERO;REAL_NORM;REAL_ARITH `abs (&0) = &0`]) + ]);; + (* }}} *) + + +let ARG_INV_ALT = prove_by_refinement( + `!u x y. ~(u = Cx (&0)) /\ ~(x = Cx(&0)) /\ ~(y = Cx(&0)) /\ ~(Arg (x/u) = Arg(y/u)) + ==> (Arg(x/y) = &2*pi - Arg(y/x))`, + (* {{{ proof *) + [ + REPEAT STRIP_TAC; + MP_TAC (SPEC `(y/(x:complex))` ARG_INV); + REWRITE_TAC[COMPLEX_INV_DIV]; + DISCH_THEN MATCH_MP_TAC; + REPEAT WEAK_STRIP_TAC; + HASH_UNDISCH_TAC 5488; + REWRITE_TAC[]; + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + ASM_SIMP_TAC[ARG_EQ;Ysskqoy.ARG_0_DIV]; + EXISTS_TAC `Re (y/x)`; + SUBCONJ_TAC; + MATCH_MP_TAC (REAL_ARITH `&0 <= x /\ ~(x = &0) ==> &0 < x`); + REPEAT STRIP_TAC; + BY(ASM_REWRITE_TAC[]); + MP_TAC (SPEC `(y:complex/x)` REAL_CX0); + BY(ASM_SIMP_TAC[Ysskqoy.ARG_0_DIV]); + HASH_RULE_TAC 3423 (REWRITE_RULE[REAL]); + DISCH_THEN SUBST1_TAC; + DISCH_TAC; + REWRITE_TAC[ complex_div]; + MATCH_MP_TAC (prove(`d=(b' *b)*(a*c) ==> d = (a *b')*b * (c:complex)`,SIMPLE_COMPLEX_ARITH_TAC)); + BY(ASM_SIMP_TAC[COMPLEX_MUL_LINV;COMPLEX_MUL_LID]) + ]);; + (* }}} *) + +let ARG_ORDER = prove_by_refinement( + `!u h n. + ~(u = Cx (&0)) /\ + (!i. (i IN 1..n) ==> ~(h i = Cx (&0))) /\ + (!i j. (i IN 1..n) /\ (j IN 1..n) /\ (i < j) ==> Arg (h i/ u) < Arg (h j/ u)) /\ (h (n+1) = h 1) ==> + (!i j. (i IN 1..n) /\ (j IN 1..n) /\ ~(i=j) ==> Arg (h (i+1) / h i) <= Arg (h j/ h i)) + `, + (* {{{ proof *) + [ + REWRITE_TAC[ARITH_RULE `~(i = j) <=> (i < j) \/ (j < (i:num))`]; + REPEAT GEN_TAC; + REPEAT DISCH_TAC; + SUBGOAL_THEN `!i. i IN 1..n ==> ~(h (i+1) = Cx (&0))` ASSUME_TAC; + REPEAT WEAK_STRIP_TAC; + ASM_CASES_TAC `i=(n:num)`; + BY(ASM_MESON_TAC[IN_NUMSEG;ARITH_RULE `((n=0) ==> ~(1 <= n)) /\ (~(n=0) ==> (1 <= 1 /\ 1 <= n))`]); + BY(ASM_MESON_TAC[IN_NUMSEG;ARITH_RULE `~(i=n) /\ (i <= n) /\ (1 <= i) ==> (1 <= (i+1) /\ (i+1) <= n)`]); + REPEAT (FIRST_X_ASSUM MP_TAC); + REPEAT WEAK_STRIP_TAC; + FIRST_ASSUM (fun t -> MP_TAC (SPECL [`i+1`;`j:num`] t)); + FIRST_X_ASSUM (fun t -> MP_TAC (SPECL [`i:num`;`(i+1):num`] t)); + ANTS_TAC; + BY(ASM_MESON_TAC[IN_NUMSEG;ARITH_RULE `i < i + 1`;ARITH_RULE `(i < j /\ j <=n ==> i+1 <=n)/\ (1 <= i+1)`]); + DISCH_TAC; + ASM_REWRITE_TAC[]; + DISCH_TAC; + SUBGOAL_THEN `Arg (h (i+1) / u) <= Arg (h j / u)` ASSUME_TAC; + ASM_CASES_TAC `i+1 < j`; + BY(ASM_MESON_TAC [REAL_ARITH `a < (b:real) ==> a <= b`;IN_NUMSEG;ARITH_RULE `1 <= i+1 /\ (i+1 < j /\ j<= n ==> i+1 <= n)`]); + BY(ASM_MESON_TAC[ARITH_RULE `i < j /\ ~(i+1 < j) ==> (i+1=j)`;REAL_ARITH `a <= a`]); + SUBGOAL_THEN `Arg (h (i+1)/ u) = Arg (h i/ u) + Arg ((h(i+1)/u)/(h (i:num)/u))` MP_TAC; + MATCH_MP_TAC ARG_LE_DIV_SUM; + ASM_SIMP_TAC[Ysskqoy.ARG_0_DIV]; + HASH_UNDISCH_TAC 6821; + BY(REAL_ARITH_TAC); + ASM_SIMP_TAC [complex_frac_cancel]; + DISCH_TAC; + SUBGOAL_THEN `Arg (h (j:num)/u) = Arg (h i/u) + Arg( (h j/u)/(h i/u))` MP_TAC; + MATCH_MP_TAC ARG_LE_DIV_SUM; + ASM_SIMP_TAC[Ysskqoy.ARG_0_DIV]; + REPEAT (FIRST_X_ASSUM MP_TAC); + BY(REAL_ARITH_TAC); + ASM_SIMP_TAC [complex_frac_cancel]; + REPEAT (FIRST_X_ASSUM MP_TAC); + BY(REAL_ARITH_TAC); + COMMENT "1 goal: case j a <= b`); + FIRST_X_ASSUM MATCH_MP_TAC; + HASH_UNDISCH_TAC 88; + ASM_REWRITE_TAC[]; + REWRITE_TAC[IN_NUMSEG]; + HASH_UNDISCH_TAC 4; + BY(ARITH_TAC); + ASM_SIMP_TAC [complex_frac_cancel]; + SUBGOAL_THEN `Arg (h (i:num)/u) = Arg( h j/u) + (Arg ((h i/u)/(h j/u)))` MP_TAC; + MATCH_MP_TAC ARG_LE_DIV_SUM; + ASM_SIMP_TAC[Ysskqoy.ARG_0_DIV]; + BY(ASM_MESON_TAC[arith `(a:real < b) ==> (a <= b)`]); + ASM_SIMP_TAC [complex_frac_cancel]; + DISCH_TAC; + SUBGOAL_THEN `Arg (h 1/u) <= Arg (h j /u)` MP_TAC; + ASM_CASES_TAC `j = 1`; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC (arith `a:real < b ==> a <= b`); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_MESON_TAC[IN_NUMSEG;arith `1 <=1`;arith `1 <=j /\ ~(j=1)==> (1 < j)`]); + REPEAT WEAK_STRIP_TAC; + MP_TAC (SPECL [`u:complex`;`(h 1):complex`;`(h:num->complex) n`] ARG_INV_ALT); + ANTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC (arith `(a:real < b) ==> ~(a = b)`); + FIRST_X_ASSUM MATCH_MP_TAC; + REPEAT (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[IN_NUMSEG]; + BY(ARITH_TAC); + DISCH_TAC; + MP_TAC (SPECL [`u:complex`;`(h (j:num)):complex`;`(h:num->complex) i`] ARG_INV_ALT); + ANTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC (arith `(a:real < b) ==> ~(a = b)`); + BY(ASM_SIMP_TAC[]); + REPEAT (FIRST_X_ASSUM MP_TAC); + REPLICATE_TAC 8 (DISCH_TAC); + DISCH_THEN SUBST1_TAC; + BY(REAL_ARITH_TAC); + COMMENT "last case"; + SUBGOAL_THEN `i+1 <=n /\ i+1 IN 1..n` MP_TAC; + REPEAT (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[IN_NUMSEG]; + BY(ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + MP_TAC (SPECL [`u:complex`;`(h (i:num)):complex`;`(h:num->complex) j`] ARG_INV_ALT); + ANTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC (arith `(b:real < a) ==> ~(a = b)`); + BY(ASM_SIMP_TAC[]); + SUBGOAL_THEN `Arg (h (i+1)/u) = Arg (h i /u) + Arg ((h (i+1)/u)/(h i /u))` MP_TAC; + MATCH_MP_TAC ARG_LE_DIV_SUM; + ASM_SIMP_TAC[Ysskqoy.ARG_0_DIV]; + MATCH_MP_TAC (arith `a:real < b ==> a <= b`); + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + BY(ARITH_TAC); + ASM_SIMP_TAC [complex_frac_cancel]; + SUBGOAL_THEN `Arg (h i/u) = Arg (h (j:num) /u) + Arg ((h i/u)/(h j /u))` MP_TAC; + MATCH_MP_TAC ARG_LE_DIV_SUM; + ASM_SIMP_TAC[Ysskqoy.ARG_0_DIV]; + MATCH_MP_TAC (arith `a:real < b ==> a <= b`); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_SIMP_TAC [complex_frac_cancel]; + MP_TAC (ISPEC `(h:num->complex) j/ u` ARG); + MP_TAC (ISPEC `(h:num->complex) (i+1)/ u` ARG); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let POLYSORT_BIJ2 = prove_by_refinement( + `!P n s r u. + s = {c | c facet_of P} /\ + bounded P /\ + polyhedron P /\ + &0 < r /\ + (!p. norm p < r ==> P p) /\ + ~(u = Cx (&0)) /\ + s HAS_SIZE n + ==> (?f. s = IMAGE f (1..n) /\ + BIJ f (1..n) s /\ + (!i k. (i IN 1..n) /\ (k IN 1..n) /\ ~(i=k) ==> + (Arg (facet_rep_a P (f (i+1))/facet_rep_a P (f i))) <= + (Arg (facet_rep_a P (f k)/ facet_rep_a P (f i)))) /\ + (!i. i IN 1..n ==> Arg (facet_rep_a P (f (i+1)) / facet_rep_a P (f i)) < pi) /\ + (f (n+1) = f 1) /\ + (!j k. + j IN 1..n /\ k IN 1..n /\ j < k + ==> Arg (facet_rep_a P (f j) / u) < + Arg (facet_rep_a P (f k) / u)))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MP_TAC (SPECL[`P:real^2->bool`;`n:num`;`s:(real^2->bool)->bool`;`r:real`;`u:real^2`] POLY_SORT_BIJ); + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + EXISTS_TAC `\i. if (i IN 1..n) then (f i) else ((f:num->(real^2->bool)) 1)`; + BETA_TAC; + SUBCONJ_TAC; + HASH_UNDISCH_TAC 8348; + REWRITE_TAC[IMAGE]; + DISCH_THEN SUBST1_TAC; + ONCE_REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[IN_ELIM_THM]; + BY(MESON_TAC[]); + DISCH_TAC; + SUBCONJ_TAC; + HASH_UNDISCH_TAC 8330; + REWRITE_TAC[BIJ;INJ;SURJ;IN;IN_ELIM_THM]; + BY(MESON_TAC[]); + DISCH_TAC; + MATCH_MP_TAC (TAUT `c /\ d /\ a /\ b ==> a /\ b /\ c /\ d`); + SUBGOAL_THEN `~(n+1 IN 1..n)` ASSUME_TAC; + BY(REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC); + SUBCONJ_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + SUBCONJ_TAC; + REPEAT WEAK_STRIP_TAC; + MP_TAC (SPECL [`u:real^2`;`\(i:num). facet_rep_a P (if i IN 1..n then f i else f 1)`;`n:num`] ARG_ORDER); + ANTS_TAC; + ASM_SIMP_TAC[]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[]; + MATCH_MP_TAC facet_rep_nz; + ASM_REWRITE_TAC[]; + HASH_UNDISCH_TAC 8330; + REWRITE_TAC[BIJ;INJ;SURJ;IN_ELIM_THM]; + HASH_UNDISCH_TAC 6240; + BY(MESON_TAC[]); + BETA_TAC; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + COMMENT "down to last subgoal"; + REPEAT WEAK_STRIP_TAC; + MP_TAC(SPECL [`P:real^2->bool`;`if (i IN 1..n) then ((f i):real^2->bool) else f 1`;`r:real`] facet_arg_lt_pi); + ASM_REWRITE_TAC[]; + ANTS_TAC; + HASH_UNDISCH_TAC 8348; + ONCE_REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[IMAGE;IN_ELIM_THM]; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `?j. j IN 1..n /\ c' = (f j):real^2->bool` MP_TAC; + HASH_RULE_TAC 8348 (REWRITE_RULE[FUN_EQ_THM]); + REWRITE_TAC[IMAGE;IN_ELIM_THM]; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (fun t -> MP_TAC (SPECL [`i:num`;`j:num`] t)); + ASM_REWRITE_TAC[]; + ASM_CASES_TAC `i=j:num`; + ASM_REWRITE_TAC[]; + HASH_UNDISCH_TAC 9883; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `(b = &0) ==> (&0 < b ==> a)`); + REWRITE_TAC[GSYM (SPEC `1` ARG_NUM)]; + AP_TERM_TAC; + MATCH_MP_TAC COMPLEX_DIV_REFL; + MATCH_MP_TAC facet_rep_nz; + ASM_REWRITE_TAC[]; + HASH_UNDISCH_TAC 8330; + REWRITE_TAC[BIJ;INJ;SURJ;IN_ELIM_THM]; + HASH_UNDISCH_TAC 7957; + BY(MESON_TAC[]); + ASM_REWRITE_TAC[]; + HASH_UNDISCH_TAC 3495; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +(* ========================================================================== *) +(* EUSOTYP Lemmas *) + +(* + The lemma is phrased in terms of Arg rather than polar cycle, because of + a lack of good supporting libraries for polar cycle. + + The orthogonality conclusion (4) has been put into separate lemmas: + COS_ARG_VECTOR_ANGLE relating Arg to vector_angle, + SEC_DOT the orthogonality statement in terms of vector_angle. +*) +(* ========================================================================== *) + +let EUSOTYP_concl_old = `!(P:real^2 -> bool) s n r c0 u. polyhedron P /\ bounded P /\ + s = { c | c facet_of P } /\ + c0 facet_of P /\ + u = facet_rep_a P c0 /\ + s HAS_SIZE n /\ + (&0 < r ) /\ + (!p. norm p < r ==> P p) ==> + (?(g:num->real^2). + (!i. i IN 1..(2 * n) ==> (P (g i)) /\ ~(g i = vec 0)) /\ + (!j k. j IN 1..(2 * n) /\ k IN 1..(2*n) /\ (j < k) ==> + Arg ( g j/ u) < Arg (g k / u)) /\ + (!l i j k psi. (l IN 1..n /\ i = 2 * l -1 /\ j = 2 *l /\ k = (2 * l +1) MOD (2*n) + /\ psi = Arg( (g k)/(g i) ) / &2) + ==> (norm (g i) = r) /\ + norm (g j) = r * inv (cos (psi)) /\ + Arg (g j/ g i) = psi /\ + Arg (g k/ g j) = psi /\ + psi < pi/ &2 )) + `;; + +let EMPTY_NOT_EXISTS_IN = prove_by_refinement( + `(a:A->bool) = {} <=> ~(?x. x IN a)`, + (* {{{ proof *) + [ + SET_TAC[] + ]);; + (* }}} *) + +let EUSOTYP_simple = prove_by_refinement( + `!(P:real^2->bool) s r n u2. + (polyhedron P) /\ (bounded P) /\ (s = {c | c facet_of P}) /\ s HAS_SIZE n /\ + (&0 < r) /\ ~(u2 = vec 0) /\ (!p2. norm p2 < r ==> p2 IN P) ==> + (?g h. (!i. i IN 1..n ==> g i IN P /\ norm (g i) = r) /\ + g (n + 1) = g 1 /\ + (!j k. j IN 1..n /\ k IN 1..n /\ j < k + ==> Arg ( (g j) / u2) < Arg ( (g k) / u2)) /\ + (!i. i IN 1..n ==> h i IN P /\ + norm (h i) = r * inv (cos (Arg ( (g (i + 1)) / (g i)) / &2))) /\ + (!i. i IN 1..n + ==> Arg ( (h i) / (g i)) = Arg ( (g (i + 1)) / (g i)) / &2 /\ + Arg ( (g (i + 1)) / (h i)) = Arg ( (g (i + 1)) / (g i)) / &2) /\ + (!i. i IN 1..n + ==> g i dot (h i - g i) = &0 /\ g (i + 1) dot (h i - g (i + 1)) = &0) /\ + (1 < n) /\ + (!i. i IN 1..n ==> ~(g i = Cx(&0))) /\ + (!i. i IN 1..n ==> ~(h i = Cx(&0))) /\ + (!i. (i IN 1..n ==> Arg ( g(i+1)/ g(i)) < pi)) )`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MP_TAC (SPECL [`P:real^2->bool`;`n:num`;`{ c | (c:real^2->bool) facet_of P}`;`r:real`;`u2:real^2`] POLYSORT_BIJ2); + ASM_REWRITE_TAC[GSYM COMPLEX_VEC_0]; + ANTS_TAC; + BY(BY(ASM_MESON_TAC[IN])); + REPEAT WEAK_STRIP_TAC; + EXISTS_TAC `\(i:num). r % facet_rep_a P (f i)`; + BETA_TAC; + EXISTS_TAC `\(i:num). bisector_point P (f i) (f (i+1)) r`; + SUBGOAL_THEN `!i. i IN 1..n ==> (f i) facet_of (P:real^2->bool)` ASSUME_TAC; + HASH_UNDISCH_TAC 8348; + BY(BY(SET_TAC[])); + SUBCONJ_TAC; + ASM_SIMP_TAC[Trigonometry2.LT_IMP_ABS_REFL;NORM_MUL]; + REPEAT STRIP_TAC; + REWRITE_TAC[IN]; + MATCH_MP_TAC facet_rep_in_poly; + BY(BY(ASM_MESON_TAC[IN])); + BY(BY(ASM_MESON_TAC[facet_rep_def;REAL_ARITH `r * &1 = r`])); + DISCH_TAC; + CONJ_TAC; + BY(BY(ASM_REWRITE_TAC[])); + BETA_TAC; + SUBGOAL_THEN `!i. (i IN 1..n ==> ~(facet_rep_a P (f i) = Cx (&0)))` ASSUME_TAC; + GEN_TAC; + DISCH_TAC; + MATCH_MP_TAC facet_rep_nz; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(BY(ASM_REWRITE_TAC[])); + REWRITE_TAC[COMPLEX_CMUL]; + SUBGOAL_THEN `!v u. Arg(((Cx r)*v)/u) = Arg (v/u)` ASSUME_TAC; + REPEAT GEN_TAC; + BY(BY(ASM_SIMP_TAC[complex_div;ARG_MUL_CX;arith `((a:complex)*b) * c = a * b * c`])); + ASM_SIMP_TAC[]; + SUBGOAL_THEN `!v u. Arg(v/(Cx r * u)) = Arg (v/u)` ASSUME_TAC; + REPEAT GEN_TAC; + ASM_SIMP_TAC[complex_div;COMPLEX_INV_MUL]; + BY(BY(ASM_SIMP_TAC[arith `(a:complex)*(inv (Cx t) * c) = (a * c)/(Cx t)`;ARG_DIV_CX])); + ASM_SIMP_TAC[]; + COMMENT "three conjuncts left + 3 new ones"; + SUBGOAL_THEN `?x''. x'' facet_of (P:real^2->bool)` MP_TAC; + COMMENT "new insert"; + SUBGOAL_THEN `?c. ~(c = {}) /\ ~(c = (P:real^2->bool)) /\ (c face_of P)` ASSUME_TAC; + MP_TAC (ISPEC `P:real^2->bool` (REWRITE_RULE [GSYM FACE_OF_SING ] EXTREME_POINT_EXISTS_CONVEX )); + ANTS_TAC; + REWRITE_TAC[EMPTY_NOT_EXISTS_IN]; + BY(ASM_MESON_TAC[NORM_0; POLYTOPE_IMP_CONVEX ; POLYTOPE_IMP_COMPACT; POLYTOPE_EQ_BOUNDED_POLYHEDRON ]); + REPEAT WEAK_STRIP_TAC; + (fun gl -> (EXISTS_TAC ( env gl`{x}`)) gl); + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(SET_TAC[]); + HASH_COPY_TAC 1412; + FIRST_X_ASSUM (MP_TAC o (SPEC `Cx (r/ &2)`)); + FIRST_X_ASSUM (MP_TAC o (SPEC `Cx (&0)`)); + ASM_SIMP_TAC [ COMPLEX_NORM_CX; arith `&0 < r ==> abs(r/ &2) < r`;arith `&0 < r ==> abs(&0) ~(&0 = r/ &2)`]); + FIRST_X_ASSUM (MP_TAC); + BY(ASM_MESON_TAC[FACE_OF_POLYHEDRON_SUBSET_FACET]); + WEAK_STRIP_TAC; + COMMENT "1 < n"; + SUBGOAL_THEN `1bool) facet_of P} HAS_SIZE 1 \/ { c | (c:real^2->bool) facet_of P} HAS_SIZE 0` MP_TAC; + BY(BY(ASM_MESON_TAC[arith `~(1 < n) ==> (n=0) \/ (n = 1)`])); + REWRITE_TAC[HAS_SIZE_1_EXISTS;HAS_SIZE_0]; + REWRITE_TAC[EXISTS_UNIQUE;IN_ELIM_THM;EMPTY_NOT_EXISTS_IN]; + REWRITE_TAC[DE_MORGAN_THM]; + ROT_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + MP_TAC (SPECL [`P:real^2->bool`;`(x'':real^2->bool)`;`r:real`] facet_arg_lt_pi); + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(BY(ASM_MESON_TAC[IN])); + REPEAT WEAK_STRIP_TAC; + (fun gl -> (SUBGOAL_THEN ( env gl`c' =x''`) MP_TAC) gl); + BY(BY(ASM_MESON_TAC[])); + DISCH_TAC; + HASH_UNDISCH_TAC 9078; + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `~(facet_rep_a P x'' = Cx (&0))` MP_TAC; + DISCH_TAC; + BY(ASM_MESON_TAC[ facet_rep_def; COMPLEX_NORM_CX; arith `~(abs(&0) = &1)`]); + SIMP_TAC[COMPLEX_DIV_REFL]; + REWRITE_TAC[ARG_NUM]; + BY(BY(REAL_ARITH_TAC)); + COMMENT "end 1 < n"; + ASM_REWRITE_TAC[]; + COMMENT "end 1 < n"; + COMMENT "end insert"; + SUBGOAL_THEN `!i. (i IN 1..n) ==> (P (bisector_point P (f i) (f (i + 1)) r) /\ norm (bisector_point P (f i) (f (i + 1)) r) = r * inv (cos (Arg (facet_rep_a P (f (i + 1)) / facet_rep_a P (f i)) / &2)) /\ Arg (bisector_point P (f i) (f (i + 1)) r / facet_rep_a P (f i)) = Arg (facet_rep_a P (f (i + 1)) / facet_rep_a P (f i)) / &2 /\ Arg (facet_rep_a P (f (i + 1)) / bisector_point P (f i) (f (i + 1)) r) = Arg (facet_rep_a P (f (i + 1)) / facet_rep_a P (f i)) / &2)` ASSUME_TAC; + GEN_TAC; + DISCH_TAC; + MATCH_MP_TAC bisector_point; + ASM_REWRITE_TAC[]; + SUBCONJ_TAC; + BY(BY(ASM_SIMP_TAC[])); + DISCH_TAC; + SUBCONJ_TAC; + ASM_CASES_TAC `i+1 IN 1..n`; + BY(BY(ASM_SIMP_TAC[])); + MP_TAC (prove(`i IN 1..n /\ (~(i+1 IN 1..n)) ==> ((i=n) /\ (1 IN 1..n))`, REWRITE_TAC [IN_NUMSEG] THEN ARITH_TAC)); + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + BY(BY(ASM_SIMP_TAC[])); + DISCH_TAC; + CONJ_TAC; + BY(BY(ASM_MESON_TAC[IN])); + REWRITE_TAC[arith `&2 * x / &2 = x`;arith `x / &2 < y / &2 <=> x < y`]; + ASM_SIMP_TAC[]; + SUBCONJ_TAC; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `(?k. k IN 1..n /\ (c'' = (f:num->real^2->bool) k))` MP_TAC; + HASH_UNDISCH_TAC 3856; + HASH_UNDISCH_TAC 8330; + REWRITE_TAC[BIJ;INJ;SURJ]; + BY(BY(SET_TAC[])); + REPEAT WEAK_STRIP_TAC; + BY(BY(ASM_MESON_TAC[arith `(a:real < b) ==> ~(b <= a)`])); + DISCH_TAC; + ASM_CASES_TAC `(i+1) IN 1..n`; + BY(BY(ASM_MESON_TAC[arith `i < i+1`;arith `(a:real < b) ==> ~(a = b)`])); + MP_TAC (prove(`i IN 1..n /\ (~(i+1 IN 1..n)) ==> ((i=n) /\ (1 IN 1..n))`, REWRITE_TAC [IN_NUMSEG] THEN ARITH_TAC)); + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + COMMENT "1 < n"; + BY(BY(ASM_MESON_TAC[arith `i < i+1`;arith `(a:real < b) ==> ~(a = b)`])); + COMMENT "1 goal, 5 conjuncts, bisector point now read in "; + ASM_SIMP_TAC[]; + CONJ_TAC; + BY(BY(ASM_MESON_TAC[IN])); + COMMENT "nonzero bisector"; + SUBGOAL_THEN `!i. (i IN 1..n) ==> ~(norm (bisector_point P (f i) (f (i+1)) r) = &0)` MP_TAC; + ASM_SIMP_TAC[REAL_ENTIRE;arith `&0 < r ==> ~(r = &0)`]; + REWRITE_TAC[REAL_INV_EQ_0]; + GEN_TAC; + DISCH_TAC; + MATCH_MP_TAC Taylor_atn.cos_nz; + MATCH_MP_TAC (arith `&0 <= x /\ x < pi /\ (&0 < pi) ==>abs(x/ &2) < pi/ &2`); + REWRITE_TAC[ARG;PI_POS]; + BY(BY(ASM_SIMP_TAC[])); + REWRITE_TAC[COMPLEX_NORM_ZERO]; + DISCH_TAC; + COMMENT "nonzero bisector"; + CONJ_TAC; + GEN_TAC; + DISCH_TAC; + COMMENT "nonzero bisector was here"; + CONJ_TAC THEN MATCH_MP_TAC Ysskqoy.SEC_DOT THEN EXISTS_TAC `r:real`; + EXISTS_TAC ` (Arg (facet_rep_a P (f (i + 1)) / facet_rep_a P (f i)) / &2)`; + ASM_SIMP_TAC[]; + REWRITE_TAC[ARG;arith `&0 <= x/ &2 <=> &0 <= x`;COMPLEX_NORM_MUL;COMPLEX_NORM_CX;arith `x/ &2 < y/ &2 <=> x < y`]; + ASM_SIMP_TAC[Trigonometry2.LT_IMP_ABS_REFL;facet_rep_def;arith `r * &1 = r`]; + ONCE_REWRITE_TAC[VECTOR_ANGLE_SYM]; + SUBGOAL_THEN `cos (Arg ( (bisector_point P (f i) (f (i + 1)) r)/ (Cx r * facet_rep_a P (f i))))= cos (vector_angle (bisector_point P (f i) (f (i + 1)) r) (Cx r * facet_rep_a P (f i)))` (SUBST1_TAC o GSYM); + MATCH_MP_TAC Ysskqoy.COS_ARG_VECTOR_ANGLE; + BY(BY(ASM_SIMP_TAC[COMPLEX_ENTIRE;CX_INJ;arith `&0 < r ==> ~(r = &0)`])); + AP_TERM_TAC; + BY(BY(ASM_MESON_TAC[])); + EXISTS_TAC ` (Arg (facet_rep_a P (f (i + 1)) / facet_rep_a P (f i)) / &2)`; + ASM_SIMP_TAC[]; + REWRITE_TAC[ARG;arith `&0 <= x/ &2 <=> &0 <= x`;COMPLEX_NORM_MUL;COMPLEX_NORM_CX;arith `x/ &2 < y/ &2 <=> x < y`]; + SUBGOAL_THEN `(f (i+1)) facet_of (P:real^2->bool)` ASSUME_TAC; + ASM_CASES_TAC `i+1 IN 1..n`; + BY(BY(ASM_MESON_TAC[])); + MP_TAC (prove(`i IN 1..n /\ (~(i+1 IN 1..n)) ==> ((i=n) /\ (1 IN 1..n))`, REWRITE_TAC [IN_NUMSEG] THEN ARITH_TAC)); + ASM_REWRITE_TAC[]; + BY(BY(ASM_MESON_TAC[])); + ASM_SIMP_TAC[Trigonometry2.LT_IMP_ABS_REFL;facet_rep_def;arith `r * &1 = r`]; + SUBGOAL_THEN `cos (Arg ( ( (Cx r * facet_rep_a P (f (i + 1)))/ (bisector_point P (f i) (f (i + 1)) r)) ) ) = cos (vector_angle (Cx r * facet_rep_a P (f (i + 1))) (bisector_point P (f i) (f (i + 1)) r))` (SUBST1_TAC o GSYM); + MATCH_MP_TAC Ysskqoy.COS_ARG_VECTOR_ANGLE; + ASM_SIMP_TAC[COMPLEX_ENTIRE;CX_INJ;arith `&0 < r ==> ~(r = &0)`]; + ASM_CASES_TAC `i+1 IN 1..n`; + BY(BY(ASM_SIMP_TAC[])); + MP_TAC (prove(`i IN 1..n /\ (~(i+1 IN 1..n)) ==> ((i=n) /\ (1 IN 1..n))`, REWRITE_TAC [IN_NUMSEG] THEN ARITH_TAC)); + BY(BY(ASM_MESON_TAC[])); + AP_TERM_TAC; + BY(BY(ASM_MESON_TAC[])); + ROT_TAC; + CONJ_TAC; + BY(ASM_REWRITE_TAC[ COMPLEX_VEC_0 ]); + GEN_TAC; + DISCH_TAC; + BY(ASM_SIMP_TAC[ COMPLEX_VEC_0 ; COMPLEX_ENTIRE ; CX_INJ ;arith `&0 < r ==> ~(r = &0)`]) + ]);; + (* }}} *) + +let pad2d3d_SUB = prove_by_refinement( + `!x y. pad2d3d x - pad2d3d y = pad2d3d (x - y)`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REWRITE_TAC[VECTOR_ARITH `(u:real^A) - (v:real^A) = (u + (-- &1) % v)`]; + BY(MESON_TAC[LINEAR_PAD2D3D;linear]) + ]);; + (* }}} *) + + +let EUSOTYP_general = prove_by_refinement( + `!P A n s r u0 u1 u2. + polyhedron P /\ bounded P /\ P SUBSET A /\ + s = { c | c facet_of P } /\ + s HAS_SIZE n /\ + (&0 < r ) /\ + ~(u2= u0) /\ + ~(u1 = u0) /\ + (u0 IN P) /\ (u2 IN A) /\ + (!v. v IN A <=> (v - u0) dot (u1 - u0) = &0) /\ + (!p. dist (p, u0) < r /\ p IN A ==> p IN P) ==> + (?g h. + (!i. i IN 1..n ==> ((g i ) IN P) /\ dist(g i , u0) = r) /\ + (g (n+1) = g 1) /\ + (!i. i IN 1..n ==> ((h i) IN P) /\ + norm(h i - u0) = r* inv(cos ((azim u0 u1 (g i) (g (i+1)))/ &2))) /\ + (!j k. j IN 1..n /\ k IN 1..n /\ (j < k) ==> + azim u0 u1 u2 (g j) < azim u0 u1 u2 (g k)) /\ + (!i. i IN 1..n ==> + azim u0 u1 (g i) (h i) = (azim u0 u1 (g i) (g (i+1)))/ &2 /\ + azim u0 u1 (h i) (g (i+1)) = (azim u0 u1 (g i) (g (i+1)))/ &2) /\ + (!i. i IN 1..n ==> (((g i - u0) dot (h i - g i) = &0) /\ ((g (i+1) - u0) dot (h i - g (i+1)) = &0))) /\ + (1 < n) /\ + (!i. i IN 1..n ==> ~(g i = u0)) /\ + (!i. i IN 1..n ==> ~(h i = u0)) /\ + (!i. (i IN 1..n ==> azim u0 u1 (g i) (g (i+1)) < pi)) + )`, + (* {{{ proof *) + [ + REPEAT GEN_TAC THEN GEOM_ORIGIN_TAC `u0:real^3`; + REPEAT GEN_TAC THEN GEOM_BASIS_MULTIPLE_TAC 3 `u1:real^3`; + X_GEN_TAC `u1:real`; + GEN_REWRITE_TAC LAND_CONV [REAL_ARITH `&0 <= x <=> x = &0 \/ &0 < x`]; + STRIP_TAC THEN ASM_REWRITE_TAC[VECTOR_MUL_LZERO]; + ASM_SIMP_TAC[AZIM_SPECIAL_SCALE; VECTOR_SUB_RZERO; DIST_0]; + ASM_SIMP_TAC[VECTOR_MUL_EQ_0; DOT_BASIS; DOT_RMUL; REAL_ENTIRE;BASIS_NONZERO; REAL_LT_IMP_NZ; DIMINDEX_3; ARITH]; + POP_ASSUM(K ALL_TAC); + REWRITE_TAC[AZIM_ARG]; + REPEAT GEN_TAC; + REPEAT DISCH_TAC; + SUBGOAL_THEN `(u2:real^3)$3 = &0` (fun t-> (REPEAT (POP_ASSUM MP_TAC)) THEN MP_TAC t); + BY(BY(ASM_MESON_TAC[])); + SPEC_TAC (`u2:real^3`,`u2:real^3`); + PAD2D3D_TAC; + GEN_TAC; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `!v. (v:real^3) IN P ==> v$3 = &0` ASSUME_TAC; + HASH_UNDISCH_TAC 6277; + HASH_UNDISCH_TAC 4709; + BY(BY(SET_TAC[])); + TYPED_ABBREV_TAC `(A':real^2->bool) = IMAGE(dropout 3) (A:real^3->bool)`; + TYPED_ABBREV_TAC `(P':real^2->bool) = IMAGE(dropout 3) (P:real^3->bool)`; + SUBGOAL_THEN `linear ((dropout 3):real^3->real^2)` ASSUME_TAC; + MATCH_MP_TAC LINEAR_DROPOUT; + REWRITE_TAC[DIMINDEX_2;DIMINDEX_3]; + BY(BY(ARITH_TAC)); + SUBGOAL_THEN `polyhedron P' /\ bounded P' /\ (!p2. norm (p2:real^2) < r ==> p2 IN P')` MP_TAC; + EXPAND_TAC "P'"; + CONJ_TAC; + MATCH_MP_TAC POLYHEDRON_LINEAR_IMAGE; + BY(BY(ASM_REWRITE_TAC[])); + CONJ_TAC; + MATCH_MP_TAC BOUNDED_LINEAR_IMAGE; + BY(BY(ASM_REWRITE_TAC[])); + REPEAT WEAK_STRIP_TAC; + ASM_SIMP_TAC [GSYM pad_in]; + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_REWRITE_TAC[NORM_PAD2D3D]; + SPEC_TAC (`p2:real^2`,`p2:real^2`); + BY(BY(REWRITE_TAC[GSYM QUANTIFY_PAD2D3D_THM])); + COMMENT "1 goal"; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `{d | (d:real^2->bool) facet_of P'} HAS_SIZE n` ASSUME_TAC; + EXPAND_TAC "P'"; + MATCH_MP_TAC pad2d3d_facet; + BY(BY(ASM_MESON_TAC[])); + COMMENT "A"; + MP_TAC (SPECL [`P':real^2->bool`;`{d | d facet_of (P':real^2->bool)}`;`r:real`;`n:num`;`u2:real^2`] EUSOTYP_simple); + ASM_SIMP_TAC[]; + REPEAT WEAK_STRIP_TAC; + EXISTS_TAC `\(i:num). pad2d3d (g i)`; + EXISTS_TAC `\(i:num). pad2d3d (h i)`; + BETA_TAC; + ASM_SIMP_TAC[dropout_pad2d3d;NORM_PAD2D3D;pad2d3d_dot_v;pad2d3d_SUB]; + SUBGOAL_THEN `!w. pad2d3d w IN P <=> w IN P'` ASSUME_TAC; + GEN_TAC; + BY(BY(ASM_MESON_TAC[pad_in])); + BY(BY(ASM_MESON_TAC[pad_in; INJECTIVE_PAD2D3D ; COMPLEX_VEC_0 ])) + ]);; + (* }}} *) + +let AZIM_SUM_LE = prove_by_refinement( + `!x y z w1 w2 w3. + ~(collinear {x,y,z}) /\ ~(collinear {x,y,w1}) /\ ~(collinear {x,y,w2}) /\ + ~(collinear {x,y,w3}) /\ + azim x y z w1 <= azim x y z w2 /\ + azim x y z w2 <= azim x y z w3 ==> + (azim x y w1 w3 = azim x y w1 w2 + azim x y w2 w3)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `azim x y z w3 = azim x y z w1 + azim x y w1 w3` ASSUME_TAC; + MATCH_MP_TAC Fan.sum4_azim_fan; + ASM_REWRITE_TAC[]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + SUBGOAL_THEN `azim x y z w2 = azim x y z w1 + azim x y w1 w2` ASSUME_TAC; + MATCH_MP_TAC Fan.sum4_azim_fan; + BY(ASM_REWRITE_TAC[]); + SUBGOAL_THEN `azim x y z w3 = azim x y z w2 + azim x y w2 w3` ASSUME_TAC; + MATCH_MP_TAC Fan.sum4_azim_fan; + BY(ASM_REWRITE_TAC[]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let AZIM_NN = prove_by_refinement( + `!x y z u. &0 <= azim x y z u`, + (* {{{ proof *) + [ + MESON_TAC[azim] + ]);; + (* }}} *) + + +let AZIM_BASE_SHIFT_LT = prove_by_refinement( + `!x y z z' w1 w2 w3. + ~(collinear {x,y,z}) /\ ~(collinear {x,y,z'}) /\ ~(collinear {x,y,w1}) /\ + ~(collinear {x,y,w2}) /\ ~(collinear {x,y,w3}) /\ + azim x y z w1 < azim x y z w2 /\ + azim x y z w2 < azim x y z w3 /\ + azim x y z' w1 < azim x y z' w3 ==> + (azim x y z' w1 < azim x y z' w2 /\ azim x y z' w2 < azim x y z' w3) +`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `azim x y w1 w3 = azim x y w1 w2 + azim x y w2 w3` ASSUME_TAC; + MATCH_MP_TAC AZIM_SUM_LE; + EXISTS_TAC `z:real^3`; + ASM_REWRITE_TAC[]; + BY((REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)); + REWRITE_TAC[arith `a < b <=> ~(b <= a)`]; + CONJ_TAC THEN WEAK_STRIP_TAC; + SUBGOAL_THEN `azim x y w2 w3 = azim x y w2 w1 + azim x y w1 w3` ASSUME_TAC; + MATCH_MP_TAC AZIM_SUM_LE; + EXISTS_TAC `z':real^3`; + ASM_REWRITE_TAC[]; + BY((REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)); + SUBGOAL_THEN `azim x y w1 w2 = &0 /\ azim x y w2 w1 = &0` (MP_TAC); + BY(ASM_MESON_TAC[AZIM_NN;arith `a = b + c /\ c = e + a /\ &0 <= b /\ &0 <= e ==> (b = &0 /\ e = &0)`]); + STRIP_TAC; + SUBGOAL_THEN `azim x y z w2 = azim x y z w1 + azim x y w1 w2` ASSUME_TAC; + MATCH_MP_TAC Fan.sum4_azim_fan; + ASM_REWRITE_TAC[]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT "1 left"; + SUBGOAL_THEN `azim x y w1 w2 = azim x y w1 w3 + azim x y w3 w2` ASSUME_TAC; + MATCH_MP_TAC AZIM_SUM_LE; + EXISTS_TAC `z':real^3`; + ASM_REWRITE_TAC[]; + BY((REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)); + SUBGOAL_THEN `azim x y w2 w3 = &0 /\ azim x y w3 w2 = &0` (MP_TAC); + BY(ASM_MESON_TAC[AZIM_NN;arith `a = b + c /\ b = a + c' /\ &0 <= c /\ &0 <= c' ==> (c = &0 /\ c' = &0)`]); + STRIP_TAC; + SUBGOAL_THEN `azim x y z w3 = azim x y z w2 + azim x y w2 w3` ASSUME_TAC; + MATCH_MP_TAC Fan.sum4_azim_fan; + ASM_REWRITE_TAC[]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + + +let AZIM_COMP_LT = prove_by_refinement( + `!x y z u v. &0 < azim x y z u /\ azim x y z u < azim x y z v ==> + azim x y v z < azim x y u z `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ONCE_REWRITE_TAC[Rogers.AZIM_COMPL_EXT]; + BY(REPEAT COND_CASES_TAC THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let AZIM_COMP_LE = prove_by_refinement( + `!x y z u v. &0 < azim x y z u /\ azim x y z u <= azim x y z v ==> + azim x y v z <= azim x y u z `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ONCE_REWRITE_TAC[Rogers.AZIM_COMPL_EXT]; + BY(REPEAT COND_CASES_TAC THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let AZIM_COMP2_LE = prove_by_refinement( + `!x y z u v. &0 < azim x y u z /\ &0 < azim x y v z /\ azim x y u z <= azim x y v z ==> + azim x y z v <= azim x y z u `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ONCE_REWRITE_TAC[Rogers.AZIM_COMPL_EXT]; + BY(REPEAT COND_CASES_TAC THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let AZIM_COMP2_LT = prove_by_refinement( + `!x y z u v. &0 < azim x y u z /\ &0 < azim x y v z /\ azim x y u z < azim x y v z ==> + azim x y z v < azim x y z u `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ONCE_REWRITE_TAC[Rogers.AZIM_COMPL_EXT]; + BY(REPEAT COND_CASES_TAC THEN (REPEAT (FIRST_X_ASSUM MP_TAC)) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let WEDGE_ORDER_DISJOINT = prove_by_refinement( + `!x y z n g. + ~(collinear {x,y,z}) /\ + (!i. i IN 1..n ==> ~(collinear {x,y, g i})) /\ + (g (n+1) = g 1) /\ + (!j k. j IN 1..n /\ k IN 1..n /\ (j < k) ==> + azim x y z (g j) < azim x y z (g k)) + ==> + (!j k. j IN 1..n /\ k IN 1..n /\ ~(j = k) ==> + wedge x y (g j) (g (j+1)) INTER wedge x y (g k) (g (k+1)) = {}) + `, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + DISCH_TAC; + MATCH_MP_TAC WLOG_LT; + REWRITE_TAC[]; + CONJ_TAC; + BY(SET_TAC[]); + GEN_TAC; + X_GEN_TAC `k:num`; + FIRST_X_ASSUM MP_TAC; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[FUN_EQ_THM]; + X_GEN_TAC `p:real^3`; + REWRITE_TAC[INTER;IN_ELIM_THM;wedge;X_IN NOT_IN_EMPTY]; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `j + 1 IN 1..n` ASSUME_TAC; + REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[IN_NUMSEG]; + BY(ARITH_TAC); + SUBGOAL_THEN `(azim x y z (g (j:num)) < azim x y z p)` ASSUME_TAC; + REWRITE_TAC [arith `a < b <=> ~(b <= a)`]; + WEAK_STRIP_TAC; + (fun gl -> (MP_TAC (SPECL ( envl gl[`x`;`y`;`g j`;`z`;`g j`;`p`;`g (j+1)` ]) AZIM_BASE_SHIFT_LT)) gl); + ASM_SIMP_TAC[AZIM_REFL;arith `j < j+1`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT "A"; + SUBGOAL_THEN `azim x y z p < azim x y z (g (j+1))` ASSUME_TAC; + REWRITE_TAC[arith `a < b <=> ~(b <= a)`]; + WEAK_STRIP_TAC; + (fun gl -> (MP_TAC (SPECL ( envl gl[`x`;`y`;`g j`;`z`;`g j`;`p`;`g (j+1)` ]) AZIM_BASE_SHIFT_LT)) gl); + ASM_SIMP_TAC[AZIM_REFL;arith `j < j+1`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT "B"; + SUBGOAL_THEN `k = (n:num) /\ 1 IN 1..n` ASSUME_TAC; + MATCH_MP_TAC (prove (`k IN 1..n /\ ~(k+1 IN 1..n) ==> ((k = n) /\ 1 IN 1..n)`, REWRITE_TAC [ IN_NUMSEG ] THEN ARITH_TAC )); + ASM_SIMP_TAC[]; + WEAK_STRIP_TAC; + FIRST_ASSUM (MP_TAC o (SPECL[`k:num`;`k+1`])); + FIRST_X_ASSUM (MP_TAC o (SPECL[`j+1`;`k:num`])); + ASM_SIMP_TAC[arith `k < k+1`]; + REPEAT WEAK_STRIP_TAC; + (fun gl -> (MP_TAC (SPECL ( envl gl[`x`;`y`;`g k`;`z`;`g k`;`p`;`g (k+1)`]) AZIM_BASE_SHIFT_LT)) gl); + ASM_SIMP_TAC[AZIM_REFL]; + SUBGOAL_THEN `azim x y z (g (j+1)) <= azim x y z (g (k:num))` ASSUME_TAC; + BY(ASM_MESON_TAC[arith `a <= b <=> (a (j+1=k)\/ (j+1 1 < n`]); + SUBGOAL_THEN `azim x y z (g n) = azim x y z (g 1) + azim x y (g 1) (g n)` ASSUME_TAC; + MATCH_MP_TAC Fan.sum4_azim_fan; + BY(ASM_MESON_TAC[arith `a a <= b`]); + SUBGOAL_THEN `azim x y z p = azim x y z (g 1) + azim x y (g 1) p` ASSUME_TAC; + MATCH_MP_TAC Fan.sum4_azim_fan; + ASM_SIMP_TAC[]; + MATCH_MP_TAC (arith `a a <= b`); + ASM_CASES_TAC `(1=j)`; + BY(ASM_SIMP_TAC[]); + MATCH_MP_TAC (arith `a < azim x y z (g (j:num)) /\ azim x y z (g j) < c ==> a < c`); + ASM_SIMP_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_SIMP_TAC[]; + BY(ASM_MESON_TAC[IN_NUMSEG; arith `1 <= j ==> ((1=j) \/ (1 < j))`]); + FIRST_X_ASSUM MP_TAC; + SUBGOAL_THEN `azim x y z (g n) = azim x y z p + azim x y p (g (n:num))` ASSUME_TAC; + MATCH_MP_TAC Fan.sum4_azim_fan; + ASM_SIMP_TAC[]; + MATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC (arith `a a <= b`); + ASM_CASES_TAC `(j+1=n)`; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC (arith `a < azim x y z (g (j+1)) /\ azim x y z (g (j+1)) < c ==> a < c`); + ASM_SIMP_TAC[]; + BY(ASM_MESON_TAC[IN_NUMSEG; arith `~(j+1=n) /\ ~(j=n) /\ (j<=n) ==> (j+1 < n)`]); + DISCH_TAC; + SUBGOAL_THEN `azim x y (g 1) p < &0` ASSUME_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(ASM_MESON_TAC[azim;arith `x < &0 ==> ~(&0 <= x)`]) + ]);; + (* }}} *) + +let ORDER_AZIM_SUM2Pi = prove_by_refinement( + `!x y z n g. + ~(collinear {x,y,z}) /\ + (!i. i IN 1..n ==> ~(collinear {x,y, g i})) /\ + (g (n+1) = g 1) /\ (1 < n) /\ + (!j k. j IN 1..n /\ k IN 1..n /\ (j < k) ==> + azim x y z (g j) < azim x y z (g k)) + ==> + sum (1..n) (\i. azim x y (g i) (g (i+1))) = &2 * pi`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `!i. i IN 1..(n-1) /\ 1 < n ==> (i < i+1 /\ i IN 1..n /\ (i+1) IN 1..n)` MP_TAC; + REWRITE_TAC[IN_NUMSEG]; + BY(ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `!i. i IN 1..(n-1) ==> azim x y (g i) (g(i+1)) = azim x y z (g(i+1)) - azim x y z (g i)` ASSUME_TAC; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[arith `a = b - c <=> b = c + a`]; + MATCH_MP_TAC Fan.sum4_azim_fan; + ASM_SIMP_TAC[]; + MATCH_MP_TAC (arith `a < b ==> a <= b`); + BY(ASM_MESON_TAC[arith `i < i+1`]); + SUBGOAL_THEN `sum (1..n) (\i. azim x y (g i) (g (i+1))) = sum (1..(n-1)) (\i. azim x y (g i) (g (i+1))) + sum (n..n) (\i. azim x y (g i) (g (i+1)))` SUBST1_TAC; + BY(ASM_MESON_TAC[arith `1 <= (n-1)+1 /\ ((1(n-1)+1 = n)`;SUM_ADD_SPLIT]); + REWRITE_TAC[SUM_SING_NUMSEG]; + SUBGOAL_THEN `sum (1..(n-1)) (\i. azim x y (g i) (g(i+1))) = sum(1..(n-1)) (\i. azim x y z (g (i+1)) - azim x y z (g i))` SUBST1_TAC; + BY(ASM_MESON_TAC[SUM_EQ]); + SIMP_TAC[SUM_DIFFS_ALT]; + ASM_SIMP_TAC[arith `1< n ==> 1 <= n-1`;arith `1 < n==> (n-1)+1 = n`]; + MATCH_MP_TAC (arith ` a = b + azim x y (g 1) (g n) /\ c = &2 * pi - azim x y (g 1) (g n) ==> a - b + c = &2 * pi`); + SUBGOAL_THEN `1 IN 1..n /\ n IN 1..n` MP_TAC; + REWRITE_TAC[IN_NUMSEG]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + SUBCONJ_TAC; + MATCH_MP_TAC Fan.sum4_azim_fan; + BY(ASM_SIMP_TAC[arith `a< b ==> a<=b`]); + DISCH_TAC; + (fun gl -> (REWRITE_TAC[SPECL ( envl gl[`x`;`y`;`g (1)`;`g(n:num)`]) Rogers.AZIM_COMPL_EXT]) gl); + COND_CASES_TAC; + BY(ASM_MESON_TAC[arith `x = y + &0 ==> ~(y vec 0 IN affine hull {u, t % u}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[ AFFINE_HULL_2_ALT ; IN_ELIM_THM ]; + ASM_CASES_TAC (`(u:real^A) = vec 0`); + ASM_REWRITE_TAC[]; + REWRITE_TAC[VECTOR_ADD_RID;VECTOR_SUB_RZERO;VECTOR_ADD_LID;VECTOR_SUB_LZERO]; + REWRITE_TAC[VECTOR_MUL_RZERO]; + BY(REWRITE_TAC[IN_UNIV]); + REWRITE_TAC[IN_UNIV]; + EXISTS_TAC `&1 / (&1 - t)`; + REWRITE_TAC[ VECTOR_ARITH `(u + s % (t % u - (u:real^A))) = (&1 + s * t - s) % u`]; + MATCH_MP_TAC (VECTOR_ARITH (`(a:real^A) = b ==> b = a`)); + ASM_REWRITE_TAC [ VECTOR_MUL_EQ_0 ]; + MATCH_MP_TAC (Calc_derivative.rational_identity `&1 + &1 / (&1 - t) * t - &1 / (&1 - t) = &0`); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + + +let RELATIVE_INTERIOR_AFFINE_FACE = prove_by_refinement( + `!C (p:real^N) f. convex C /\ f face_of C /\ p IN affine hull f /\ (p IN relative_interior C) ==> (f = C) `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + (fun gl -> (ENOUGH_TO_SHOW_TAC ( env gl `~(f INTER relative_interior C = {})`)) gl); + BY(ASM_MESON_TAC[ FACE_OF_DISJOINT_RELATIVE_INTERIOR ]); + REWRITE_TAC[Local_lemmas.EXISTS_IN]; + (fun gl -> (EXISTS_TAC ( env gl `p`)) gl); + ASM_REWRITE_TAC[ IN_INTER ]; + TYPIFY `f = affine hull f INTER C` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC [ FACE_OF_STILLCONVEX ]); + ASM_REWRITE_TAC[ IN_INTER ]; + FIRST_X_ASSUM (MP_TAC); + BY(ASM_MESON_TAC[ RELATIVE_INTERIOR_SUBSET ;SUBSET; IN ]) + ]);; + (* }}} *) + +let SUBSET_P_HULL = prove(` (S:A -> bool) SUBSET P hull S`, +REWRITE_TAC[HULL_SUBSET]);; + + +let FCHANGED_AFFINE = prove_by_refinement( + `!p (f:real^3->bool). + polyhedron p /\ bounded p /\ vec 0 IN interior p /\ f facet_of p ==> + (fchanged f INTER affine hull f = relative_interior f)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC SUBSET_ANTISYM; + ROT_TAC; + CONJ_TAC; + REWRITE_TAC[SUBSET_INTER]; + CONJ_TAC; + BY(BY(ASM_MESON_TAC[ Polyhedron.RELATIVE_SUBSET_FCHANGE ])); + BY(BY(ASM_MESON_TAC[ Qzksykg.SET_SUBSET_AFFINE_HULL ; RELATIVE_INTERIOR_SUBSET ; SUBSET])); + REWRITE_TAC[ SUBSET ; IN_INTER ; Polyhedron.fchanged ; IN_ELIM_THM ]; + (REPEAT WEAK_STRIP_TAC); + (fun gl -> (ASM_CASES_TAC ( env gl`x = v1` )) gl); + BY(ASM_MESON_TAC[]); + TYPIFY `vec 0 IN affine hull f` (C SUBGOAL_THEN ASSUME_TAC); + (fun gl -> (ENOUGH_TO_SHOW_TAC ( env gl `vec 0 IN affine hull {v1, t % v1 } /\ {v1 , t % v1 } SUBSET affine hull f`)) gl); + BY(ASM_MESON_TAC[ SUBSET; IN; Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA ; HULL_MONO; HULL_HULL ]); + CONJ_TAC; + MATCH_MP_TAC AFFINE_VEC0; + BY(ASM_MESON_TAC [ VECTOR_MUL_LID ]); + REWRITE_TAC[ SUBSET ]; + GEN_TAC; + REWRITE_TAC[Collect_geom.IN_SET2]; + REPEAT WEAK_STRIP_TAC THEN ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC [ RELATIVE_INTERIOR_SUBSET; SUBSET_P_HULL ; SUBSET; IN]); + BY(ASM_MESON_TAC[]); + (fun gl -> (SUBGOAL_THEN ( env gl`f = p`) ASSUME_TAC) gl); + MATCH_MP_TAC (INST_TYPE [(`:3`,`:N`)] RELATIVE_INTERIOR_AFFINE_FACE); + EXISTS_TAC `(vec 0):real^3`; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[ POLYHEDRON_IMP_CONVEX ; facet_of; INTERIOR_SUBSET_RELATIVE_INTERIOR ; SUBSET; IN]); + HASH_UNDISCH_TAC 8736; + ASM_REWRITE_TAC[ facet_of ]; + BY(MESON_TAC[ ( arith `T ==> ~((x:int) = x - &1)`)]) + ]);; + (* }}} *) + +let RCONE_PREP = prove_by_refinement( + `!p (v:real^3) u0 b. + &0 < b /\ ~(v = vec 0) /\ (&0 < v dot v) /\ + u0= (b / (v dot v)) % v /\ + (&0 < t ) /\ (t < &1) /\ + p dot v = b ==> + ( (u0 dot u0 = (b * b) / (v dot v)) /\ + (p dot u0 = (b * b )/ (v dot v)) /\ + (dist (p,u0) pow 2 = p dot p - (b * b)/(v dot v) ))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + SUBCONJ_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[DOT_LMUL]; + REWRITE_TAC[DOT_RMUL]; + CALC_ID_TAC; + BY((REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)); + DISCH_TAC; + SUBCONJ_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[DOT_RMUL]; + ASM_REWRITE_TAC[]; + CALC_ID_TAC; + BY((REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)); + DISCH_TAC; + REWRITE_TAC[ Collect_geom.DIST_POW2_DOT ]; + TYPIFY `(p - u0) dot (p - u0) = (p dot p) - (b * b)/(v dot v)` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC [ VECTOR_ARITH `(p - (u0:real^3)) dot (p - u0) = p dot p - &2 * (p dot u0) + u0 dot u0`]; + HASH_KILL_TAC 9721; + ASM_REWRITE_TAC[]; + BY(BY(REAL_ARITH_TAC)); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let RCONE_DISK = prove_by_refinement( + `!p (v:real^3) u0 b r t. + &0 < b /\ ~(v = vec 0) /\ (&0 < v dot v) /\ dist(p,u0) < r /\ + u0= (b / (v dot v)) % v /\ + (&0 < t ) /\ (t < &1) /\ + p dot v = b /\ (r = b * sqrt(&1 - t pow 2)/(t * norm v)) ==> + (p IN rcone_gt (vec 0) v t)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[rcone_gt;rconesgn;IN_ELIM_THM]; + REWRITE_TAC[VECTOR_ADD_RID;VECTOR_SUB_RZERO;VECTOR_ADD_LID;VECTOR_SUB_LZERO]; + REWRITE_TAC[DIST_0]; + GOAL_TERM (fun w -> (MP_TAC (ISPECL ( envl w [`p`;`v`;`u0`;`b`]) RCONE_PREP))); + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + HASH_KILL_TAC 9721; + REWRITE_TAC[arith `a > b <=> b < a`]; + MATCH_MP_TAC Tactics_jordan.REAL_POW_2_LT; + REWRITE_TAC[ Trigonometry2.MUL_POW2 ]; + REWRITE_TAC[ NORM_POW_2 ]; + CONJ_TAC; + REPEAT (MATCH_MP_TAC Real_ext.REAL_PROP_NN_MUL2) THEN REWRITE_TAC[ NORM_POS_LE ]; + REPEAT (MATCH_MP_TAC Real_ext.REAL_PROP_NN_MUL2) THEN REWRITE_TAC[ NORM_POS_LE ]; + BY(BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)); + CONJ_TAC; + BY(BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)); + TYPIFY `p dot p < (b * b)/ ((t pow 2) * (v dot v))` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM (fun t -> MP_TAC (MATCH_MP Tarjjuw.CHANGE_TARJJUW_4 t)); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `(c + u = v) ==> (a - c < u ==> a< v)`); + CALC_ID_TAC; + REWRITE_TAC[ NORM_EQ_0 ]; + ASM_SIMP_TAC[arith `&0 < k ==> ~(k = &0)`]; + REWRITE_TAC[ Trigonometry2.MUL_POW2 ; NORM_POW_2 ]; + SUBGOAL_THEN `&0 <= &1 - t pow 2` ASSUME_TAC; + MATCH_MP_TAC Trigonometry2.UNIT_BOUNDED_IN_TOW_FORMS; + BY(BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)); + ASM_SIMP_TAC [ SQRT_POW_2 ]; + BY(BY(REAL_ARITH_TAC)); + COMMENT "1"; + FIRST_X_ASSUM (fun t -> ASSUME_TAC (MATCH_MP ( REWRITE_RULE[ TAUT `(a /\ b ==> c) <=> (a ==> (b ==> c))`] REAL_LT_RMUL) t)); + FIRST_X_ASSUM (C INTRO_TAC [`(v dot v) * t pow 2`]); +(* TYPIFY `(v dot v) * t pow 2` (C FIRST_X_ASSUM (fun t -> MP_TAC (ISPEC t))); *) + ANTS_TAC; + MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[]; + REWRITE_TAC[ GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT ]; + BY(BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)); + MATCH_MP_TAC (arith `(b = c) ==> (a < b ==> (a < c))`); + ASM_REWRITE_TAC[]; + CALC_ID_TAC; + BY(BY(REPEAT CONJ_TAC THEN REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let RDISK_R = prove_by_refinement( + `! (v:real^3) u0 b t. + &0 < b /\ ~(v = vec 0) /\ (&0 < v dot v) /\ (&0 < t ) /\ (t < &1) /\ + u0= (b / (v dot v)) % v ==> + (?r. (&0 < r) /\ (!p. dist(p,u0) < r /\ p dot v = b ==> (p IN rcone_gt (vec 0) v t)) /\ + (!w. dist(w,u0) = r /\ w dot v = b ==> cos (arcV(vec 0) u0 w) = t))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPED_ABBREV_TAC `r = b * sqrt(&1 - t pow 2)/(t * norm v)`; + SUBGOAL_THEN `&0 < &1 - t pow 2` ASSUME_TAC; + REWRITE_TAC[ arith `&0 < &1 - x <=> x < &1` ]; + REWRITE_TAC[ ABS_SQUARE_LT_1 ]; + BY(BY(BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC))); + EXISTS_TAC `r:real`; + SUBCONJ_TAC; + EXPAND_TAC "r"; + MATCH_MP_TAC REAL_LT_MUL; + CONJ_TAC THEN ASM_REWRITE_TAC[ Calc_derivative.invert_den_lt ]; + MATCH_MP_TAC REAL_LT_MUL; + ASM_SIMP_TAC [ SQRT_POS_LT ]; + MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[]; + BY(ASM_REWRITE_TAC[ NORM_POS_LT ]); + DISCH_TAC; + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + BY(ASM_MESON_TAC[ RCONE_DISK]); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun REWRITE_TAC -> (MP_TAC (ISPECL ( envl REWRITE_TAC [`w`;`v`;`u0`;`b`]) RCONE_PREP))); + ANTS_TAC; + BY(BY(ASM_MESON_TAC[])); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `norm u0 * norm w * cos (arcV (vec 0) u0 w) = norm u0 * norm w * t`))); + REWRITE_TAC[ REAL_EQ_MUL_LCANCEL ; NORM_EQ_0 ]; + MATCH_MP_TAC (TAUT `~a /\ ~b ==> (a \/ b \/ c ==> c)`); + CONJ_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC [ VECTOR_MUL_EQ_0 ]; + ASM_REWRITE_TAC[]; + REWRITE_TAC [ Calc_derivative.invert_den_eq ]; + REWRITE_TAC[ REAL_ENTIRE]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + DISCH_TAC; + HASH_UNDISCH_TAC 287; + ASM_REWRITE_TAC[]; + REWRITE_TAC[ DOT_LZERO ]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REWRITE_TAC[ GSYM Trigonometry1.DOT_COS ]; + FIRST_X_ASSUM (MP_TAC); + HASH_KILL_TAC 9721; + ASM_REWRITE_TAC[]; + HASH_KILL_TAC 1350; + EXPAND_TAC "r"; + REWRITE_TAC[ Trigonometry2.MUL_POW2 ; Trigonometry2.DIV_POW2 ]; + REWRITE_TAC[ arith `a = b - c <=> b = a + c`]; + ASM_SIMP_TAC [ SQRT_POW_2 ; arith `&0 < u ==> &0 <= u`]; + DISCH_TAC; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `&0 <= u0 dot w /\ &0 <= norm u0 * norm w * t /\ ((u0 dot w) pow 2 = (norm u0 * norm w * t) pow 2)`))); + BY(ASM_MESON_TAC[ Collect_geom.EQ_POW2_COND ]); + ONCE_REWRITE_TAC[ DOT_SYM ]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[ Trigonometry2.MUL_POW2 ; Trigonometry2.DIV_POW2 ]; + REWRITE_TAC[ NORM_POW_2 ]; + ASM_REWRITE_TAC[]; + CONJ_TAC; + REWRITE_TAC[ Calc_derivative.invert_den_le ]; + BY(MATCH_MP_TAC Real_ext.REAL_PROP_NN_MUL2 THEN CONJ_TAC THEN TRY (MATCH_MP_TAC Real_ext.REAL_PROP_NN_MUL2 ) THEN (REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)); + CONJ_TAC; + REPEAT (MATCH_MP_TAC Real_ext.REAL_PROP_NN_MUL2 THEN REWRITE_TAC[ NORM_POS_LE ] THEN TRY CONJ_TAC); + BY((REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)); + CALC_ID_TAC; + ASM_REWRITE_TAC[ DOT_EQ_0 ; NORM_EQ_0 ]; + CONJ_TAC; + BY((REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)); + REWRITE_TAC[ NORM_POW_2 ]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let FCHANGED_MEASURABLE = prove_by_refinement( + `!(p:real^3->bool) f r. + bounded p /\ polyhedron p /\ vec 0 IN interior p /\ f facet_of p ==> + measurable ( fchanged f INTER normball (vec 0) r)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC Conforming.MEASURABLE_TOPOLOGICAL_COMPONENT_YFAN_INTER_BALL; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `vertices p`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `edges p`))); + SUBCONJ_TAC; + MATCH_MP_TAC Polyhedron.POLYHEDRON_FAN; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + SUBCONJ_TAC; + MATCH_MP_TAC Conforming.PIIJBJK; + ASM_REWRITE_TAC[]; + ROT_TAC; + SUBCONJ_TAC; + MATCH_MP_TAC Polyhedron.POLYTOPE_FAN80; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + BY(ASM_MESON_TAC [ Polyhedron.CARD_SET_OF_EDGE_INEQ_1_POLYHEDRON ]); + DISCH_TAC; + BY(ASM_MESON_TAC [ Polyhedron.FCHANGED_IN_COMPONENT ]) + ]);; + (* }}} *) + +let RADIAL_NORMBALL = prove_by_refinement( + `!(p:real^3) r. (radial r p (normball p r))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[ Sphere.radial ]; + REWRITE_TAC[ NORMBALL_BALL ]; + REWRITE_TAC[ IN_BALL ]; + CONJ_TAC; + BY(SET_TAC[]); + REWRITE_TAC[ dist ]; + REWRITE_TAC[VECTOR_ARITH `(p - (p + u)) = (-- (u:real^3))`]; + REWRITE_TAC[ NORM_NEG ]; + REWRITE_TAC [ NORM_MUL ]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let FCHANGED_RADIAL = prove_by_refinement( + `!(p:real^3->bool) f r. + bounded p /\ polyhedron p /\ vec 0 IN interior p /\ f facet_of p ==> + radial r (vec 0) ( fchanged f INTER normball (vec 0) r)`, + (* {{{ proof *) + [ + REWRITE_TAC[ Sphere.radial ]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[ NORMBALL_BALL ]; + REWRITE_TAC[VECTOR_ADD_RID;VECTOR_SUB_RZERO;VECTOR_ADD_LID;VECTOR_SUB_LZERO]; + CONJ_TAC; + BY(SET_TAC[]); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `fchanged` MP_TAC; + REWRITE_TAC[IN_INTER]; + REWRITE_TAC[ Polyhedron.fchanged ]; + REWRITE_TAC[ IN_ELIM_THM ]; + REPEAT WEAK_STRIP_TAC; + CONJ_TAC; + TYPIFY `v1` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `t * t'` EXISTS_TAC; + REWRITE_TAC [ VECTOR_MUL_ASSOC ]; + REPEAT (FIRST_X_ASSUM_ST `a > b` MP_TAC); + REWRITE_TAC [arith `a > b <=> b < a`]; + BY(MESON_TAC[ REAL_LT_MUL ]); + INTRO_TAC RADIAL_NORMBALL [`(vec 0):real^3`;`r`]; + REWRITE_TAC[ NORMBALL_BALL ]; + REWRITE_TAC[ Sphere.radial ]; + REWRITE_TAC[VECTOR_ADD_RID;VECTOR_SUB_RZERO;VECTOR_ADD_LID;VECTOR_SUB_LZERO]; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[ IN_BALL ]; + REWRITE_TAC[ dist ]; + REWRITE_TAC[VECTOR_ADD_RID;VECTOR_SUB_RZERO;VECTOR_ADD_LID;VECTOR_SUB_LZERO]; + REWRITE_TAC[ NORM_NEG ]; + BY(ASM_MESON_TAC[SUBSET]) +] +);; + +let WEDGE_SPLIT = prove_by_refinement( + `!u0 u1 u2 u3 w. + ~(collinear {u0,u1,u2}) /\ + ~(collinear {u0,u1,u3}) /\ + w IN wedge u0 u1 u2 u3 ==> + ( ~(collinear {u0,u1,w}) /\ + (wedge u0 u1 u2 w INTER wedge u0 u1 w u3 = {}) /\ + wedge u0 u1 u2 w SUBSET wedge u0 u1 u2 u3 /\ + wedge u0 u1 w u3 SUBSET wedge u0 u1 u2 u3)`, + (* {{{ proof *) + [ + REWRITE_TAC[ wedge ; EMPTY_NOT_EXISTS_IN ]; + REWRITE_TAC[ IN_ELIM_THM ; SUBSET ; IN_INTER]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (MP_TAC (ISPECL ( envl w [`u0`;`u1`;`u2`;`w`;`x`;`w`;`u3`]) AZIM_BASE_SHIFT_LT))); + ASM_REWRITE_TAC[]; + REWRITE_TAC[ AZIM_REFL ]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (MP_TAC (ISPECL ( envl w [`u0`;`u1`;`w`;`u2`;`w`;`x`;`u3`]) AZIM_BASE_SHIFT_LT))); + ASM_REWRITE_TAC[ AZIM_REFL ]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let cone0_subset_lune = prove_by_refinement( + `!u0 u1 u2 u3. cone0 u0 {u1,u2,u3} SUBSET aff_gt { u0 , u1} { u2, u3}`, + (* {{{ proof *) + [ + REWRITE_TAC[ Sphere.aff_gt_def ;SUBSET ]; + REWRITE_TAC[ Sphere.cone0 ]; + REWRITE_TAC[ IN; affsign ]; + REPEAT GEN_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `{u0 } UNION {u1,u2,u3} = {u0,u1,u2,u3}`) SUBST1_TAC)); + BY(SET_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `{u0,u1 } UNION {u2,u3} = {u0,u1,u2,u3}`) SUBST1_TAC)); + BY(SET_TAC[]); + REWRITE_TAC [ X_IN IN_INSERT ]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let COLLINEAR_UNEQUAL = prove_by_refinement( + `!u0 u1 (u2:real^N). ~collinear {u0,u1,u2} ==> + ~(u2 IN {u0,u1}) /\ ~(u1 IN {u0})`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + DISCH_TAC; + REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY ]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `{u0,u1,u2} = {u1,u2,u0}`) ASSUME_TAC)); + BY(SET_TAC[]); + BY(ASM_MESON_TAC[ Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL ]) + ]);; + (* }}} *) + +let HAS_SIZE_GE_2 = prove_by_refinement( + `!(s:A->bool). FINITE s /\ CARD s > 1 ==> (!x. x IN s ==> (?y. y IN s /\ ~(y = x)))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `~(s HAS_SIZE 0) /\ ~(s HAS_SIZE 1)`) MP_TAC)); + REWRITE_TAC[HAS_SIZE]; + ASM_REWRITE_TAC[]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + REWRITE_TAC[ HAS_SIZE_0 ]; + REWRITE_TAC[ HAS_SIZE_1_EXISTS ]; + FIRST_X_ASSUM MP_TAC; + BY(SET_TAC[]) + ]);; + (* }}} *) + + +let TWO_IMP_HAS_SIZE_GE_2 = prove_by_refinement( + `!(s:A->bool) x y. x IN s /\ y IN s /\ ~(x = y) /\ FINITE s ==> CARD s > 1`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun REWRITE_TAC -> (SUBGOAL_THEN ( env REWRITE_TAC `~(s HAS_SIZE 0) /\ ~(s HAS_SIZE 1)`) MP_TAC)); + REWRITE_TAC[ HAS_SIZE_0 ]; + REWRITE_TAC[ HAS_SIZE_1_EXISTS ]; + REPEAT( FIRST_X_ASSUM MP_TAC); + BY(BY(SET_TAC[])); + BY(ASM_MESON_TAC[HAS_SIZE; arith `~(n=0) /\ ~(n=1) ==> (n >1)`]) + ]);; + (* }}} *) + +let AFF_GT_RELATIVE_INTERIOR = prove_by_refinement( + `!(s:real^N->bool). FINITE s /\ CARD s > 1 + ==> aff_gt {} s SUBSET relative_interior (convex hull s)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_ASSUM (fun t -> (MP_TAC (MATCH_MP EXPLICIT_SUBSET_RELATIVE_INTERIOR_CONVEX_HULL t))); + DISCH_TAC; + MATCH_MP_TAC SUBSET_TRANS; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `{y | ?u. (!x. x IN s ==> &0 < u x /\ u x < &1) /\ sum s u = &1 /\ vsum s (\x. u x % x) = y}` ))); + ASM_REWRITE_TAC[]; + REWRITE_TAC[Sphere.aff_gt_def;AFFSIGN]; + REWRITE_TAC[ IN_ELIM_THM; SUBSET ;IN_INSERT ; UNION_EMPTY ]; + REWRITE_TAC[ sgn_gt ]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `f`))); + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + ASM_SIMP_TAC[]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `?y. y IN s /\ ~(y = x')`) MP_TAC)); + BY(ASM_MESON_TAC [ HAS_SIZE_GE_2 ]); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(sum {y,x'} f <= sum s f )`) ASSUME_TAC)); + MATCH_MP_TAC SUM_SUBSET_SIMPLE; + ASM_REWRITE_TAC[]; + CONJ_TAC; + REPEAT (FIRST_X_ASSUM_ST `IN` MP_TAC); +(* ALL_SEARCH [`IN`]; Feb 3, 2013 *) + BY(SET_TAC[]); + REWRITE_TAC[IN_DIFF]; + BY(ASM_MESON_TAC[ arith `&0 < a ==> &0 <= a`]); + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[ Upfzbzm_support_lemmas.SUM_SET_OF_2_ELEMENTS ]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `&0 < f y`) MP_TAC)); + BY(ASM_SIMP_TAC[]); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let NOT_COLLINEAR_AFF_DIM_2 = prove_by_refinement( + `!u0 u1 (u2:real^N). ~collinear{u0,u1,u2} ==> aff_dim {u0,u1,u2}= &2`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ONCE_REWRITE_TAC[ AFF_DIM_INSERT ]; + REWRITE_TAC[ AFF_DIM_2 ]; + BY(ASM_MESON_TAC[ Collect_geom.IN_AFFINE_HULL_IMP_COLLINEAR ; arith `(&1 + &1 = (&2):int)`; COLLINEAR_UNEQUAL; IN_INSERT]) + ]);; + (* }}} *) + +let FACET_AFF_DIM_2 = prove_by_refinement( + `!(p:real^3->bool) f . + polyhedron p /\ (vec 0 IN interior p) /\ + f facet_of p + ==> aff_dim f = &2 `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_ASSUM (fun t -> ASSUME_TAC (MATCH_MP (Polyhedron.AFF_DIM_INTERIOR_EQ_3) t)); + BY(BY(ASM_MESON_TAC[ facet_of ; arith `&3 - &1 = (&2):int` ;arith `(x:int <= x)`])) +] +);; + (* }}} *) + +let CONE0_RELATIVE_INTERIOR_FACET = prove_by_refinement( + `!p f (u0:real^3) u1 u2. + polyhedron p /\ bounded p /\ (vec 0 IN interior p) /\ + f facet_of p /\ ~(collinear {u0,u1,u2}) /\ + {u0,u1,u2} SUBSET f ==> + aff_gt {} {u0,u1,u2} SUBSET relative_interior f +`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC SUBSET_TRANS; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `relative_interior (convex hull {u0,u1,u2})`))); + CONJ_TAC; + MATCH_MP_TAC AFF_GT_RELATIVE_INTERIOR; + SUBCONJ_TAC; + BY(REWRITE_TAC[ FINITE_INSERT; FINITE_EMPTY ]); + DISCH_TAC; + MATCH_MP_TAC TWO_IMP_HAS_SIZE_GE_2; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `u0`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `u1`))); + ASM_REWRITE_TAC[ IN_INSERT ]; + BY(BY(ASM_MESON_TAC[ Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL ])); + MATCH_MP_TAC SUBSET_RELATIVE_INTERIOR; + CONJ_TAC; + BY(ASM_MESON_TAC[ FACE_OF_IMP_CONVEX; Marchal_cells.CONVEX_HULL_SUBSET; CONVEX_HULL_EQ ; facet_of ]); + MATCH_MP_TAC AFF_DIM_EQ_AFFINE_HULL; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[ FACE_OF_IMP_CONVEX; Marchal_cells.CONVEX_HULL_SUBSET; CONVEX_HULL_EQ ; facet_of ]); + DISCH_TAC; + MATCH_MP_TAC (arith ` (a <= &2 /\ &2 <= c ==> (a:int) <= c)`); + CONJ_TAC; + FIRST_ASSUM (fun t -> ASSUME_TAC (MATCH_MP (Polyhedron.AFF_DIM_INTERIOR_EQ_3) t)); + BY(ASM_MESON_TAC[ facet_of ; arith `&3 - &1 = (&2):int` ;arith `(x:int <= x)`]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `{u0,u1,u2} SUBSET convex hull {u0,u1,u2}`) ASSUME_TAC)); + BY(REWRITE_TAC[ Ldurdpn.SUBSET_P_HULL ]); + FIRST_ASSUM (fun t -> ASSUME_TAC (MATCH_MP (AFF_DIM_SUBSET) t)); + MATCH_MP_TAC (arith `!b. (a:int) <= b /\ b <= c ==> (a <=c)`); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `aff_dim {u0,u1,u2}`))); + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC [ NOT_COLLINEAR_AFF_DIM_2 ; arith `(x:int <= x)`]) + ]);; + (* }}} *) + + +let CONE0_FCHANGED_AFF_GT = prove_by_refinement( + `!(s:real^N->bool). FINITE s /\ CARD s > 1 /\ ~(vec 0 IN s) + ==> + cone0 (vec 0) s SUBSET fchanged (convex hull s)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[ Sphere.cone0 ]; + REWRITE_TAC[ Polyhedron.fchanged ]; + REWRITE_TAC[ SUBSET; IN_ELIM_THM ]; + REWRITE_TAC[AFFSIGN]; + REWRITE_TAC[ IN_ELIM_THM ; sgn_gt]; + REPEAT WEAK_STRIP_TAC; + TYPED_ABBREV_TAC `(a:real) = f (vec 0)`; + TYPED_ABBREV_TAC `(v1:real^N) = vsum s (\v. (f v / (&1 - a)) % v)`; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `v1`))); + EXISTS_TAC (`&1 - a`); + SUBGOAL_THEN `&1 - a > &0` ASSUME_TAC; + REWRITE_TAC[ arith `&1 - a > &0 <=> ~(&1 <= a)`]; + DISCH_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`~(s HAS_SIZE 0)`) MP_TAC)); + BY(ASM_MESON_TAC[ HAS_SIZE; arith `x > 1 ==> ~(x = 0)`]); + REWRITE_TAC[ HAS_SIZE_0 ]; + REWRITE_TAC[ EMPTY_NOT_EXISTS_IN ]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `sum {x',vec 0} f <= sum ({vec 0 } UNION s) f`) MP_TAC)); + MATCH_MP_TAC SUM_SUBSET_SIMPLE; + SUBCONJ_TAC; + BY(ASM_REWRITE_TAC[ FINITE_UNION ;FINITE_INSERT; FINITE_EMPTY]); + DISCH_TAC; + SUBCONJ_TAC; + REPEAT (FIRST_X_ASSUM_ST `IN` MP_TAC); +(* ALL_SEARCH [`IN`]; Feb 3, 2013 *) + BY(SET_TAC[]); + DISCH_TAC; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC (arith `&0 < x ==> &0 <= x`); + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM MP_TAC; + BY(SET_TAC[]); + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`~(x' = vec 0)`) ASSUME_TAC)); + BY(ASM_MESON_TAC[]); + ASM_SIMP_TAC[ Upfzbzm_support_lemmas.SUM_SET_OF_2_ELEMENTS ]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `&0 < f x'`) MP_TAC)); + BY(ASM_MESON_TAC[]); + REPEAT (FIRST_X_ASSUM_ST `<=` MP_TAC); +(* ALL_SEARCH [`<=`]; Feb 3, 2013 *) + BY(REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + SUBCONJ_TAC; + EXPAND_TAC "v1"; + REWRITE_TAC[ GSYM VSUM_LMUL ]; + REWRITE_TAC[ VECTOR_MUL_ASSOC ]; + SUBGOAL_THEN `!u. (&1 - a) * u/(&1- a) = u` (fun t-> REWRITE_TAC[t]); + GEN_TAC; + CALC_ID_TAC; + FIRST_X_ASSUM MP_TAC; + BY(REAL_ARITH_TAC); + REWRITE_TAC[ Packing3.SING_UNION_EQ_INSERT ]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `vsum (vec 0 INSERT s) (\v. f v % v) = f (vec 0) % (vec 0) + vsum s (\v. f v % v)`) SUBST1_TAC)); + BY(ASM_MESON_TAC[ Marchal_cells_2_new.VSUM_CLAUSES_alt ]); + REWRITE_TAC[ VECTOR_MUL_RZERO ]; + BY(REWRITE_TAC[VECTOR_ADD_RID;VECTOR_SUB_RZERO;VECTOR_ADD_LID;VECTOR_SUB_LZERO]); + DISCH_TAC; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `v1 IN aff_gt {} s`))); + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `aff_gt {} s SUBSET relative_interior (convex hull s)`))); + BY(SET_TAC[]); + MATCH_MP_TAC AFF_GT_RELATIVE_INTERIOR; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[ aff_gt_def ; AFFSIGN ]; + REWRITE_TAC[ UNION_EMPTY ; sgn_gt ]; + REWRITE_TAC[ IN_ELIM_THM ]; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `\v. f v / (&1 - a)`))); + BETA_TAC; + ASM_REWRITE_TAC[]; + SUBCONJ_TAC; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[ Calc_derivative.invert_den_lt ]; + MATCH_MP_TAC REAL_LT_MUL; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REPEAT (FIRST_X_ASSUM_ST `>` MP_TAC); +(* ALL_SEARCH [`>`]; *) + BY(REAL_ARITH_TAC); + DISCH_TAC; + REPEAT (FIRST_X_ASSUM_ST `sum` MP_TAC); +(* ALL_SEARCH [`sum`]; *) + REWRITE_TAC[ Packing3.SING_UNION_EQ_INSERT ]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `sum (vec 0 INSERT s) f = f (vec 0) + sum s f`) SUBST1_TAC)); + BY(ASM_MESON_TAC[ SUM_CLAUSES ]); + REWRITE_TAC[ real_div ]; + REWRITE_TAC[ SUM_RMUL ]; + ASM_REWRITE_TAC[]; + REWRITE_TAC [arith `a + b = c <=> b = c - a`]; + DISCH_THEN SUBST1_TAC; + CALC_ID_TAC; + REPEAT (FIRST_X_ASSUM_ST `>` MP_TAC); +(* ALL_SEARCH [`>`]; *) + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let CONE0_FCHANGED = prove_by_refinement( + `!p f (u0:real^3) u1 u2. + polyhedron p /\ bounded p /\ (vec 0 IN interior p) /\ + f facet_of p /\ ~(collinear {u0,u1,u2}) /\ + {u0,u1,u2} SUBSET f ==> + cone0 (vec 0) {u0,u1,u2} SUBSET fchanged f`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC SUBSET_TRANS; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `fchanged (convex hull {u0,u1,u2})`))); + SUBCONJ_TAC; + MATCH_MP_TAC CONE0_FCHANGED_AFF_GT; + SUBCONJ_TAC; + BY(REWRITE_TAC[ FINITE_INSERT; FINITE_EMPTY ]); + DISCH_TAC; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[ COLLINEAR_UNEQUAL; TWO_IMP_HAS_SIZE_GE_2; IN_INSERT ]); + DISCH_TAC; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `~(vec 0 IN f)`))); + REPEAT (FIRST_X_ASSUM_ST `SUBSET` MP_TAC); +(* ALL_SEARCH [`SUBSET`]; *) + BY(SET_TAC[]); + BY(ASM_MESON_TAC [ FACE_OF_DISJOINT_INTERIOR ; Hypermap.lemma_in_disjoint ; facet_of ; arith `~(x = x - (&1):int)`]); + DISCH_TAC; + REWRITE_TAC[ Polyhedron.fchanged ]; + REWRITE_TAC[ SUBSET ; IN_ELIM_THM ]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w`relative_interior (convex hull {u0,u1,u2}) SUBSET relative_interior f`))); + REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC); + BY(SET_TAC[]); + MATCH_MP_TAC SUBSET_RELATIVE_INTERIOR; + SUBCONJ_TAC; + BY(BY(ASM_MESON_TAC[ FACE_OF_IMP_CONVEX; Marchal_cells.CONVEX_HULL_SUBSET; CONVEX_HULL_EQ ; facet_of ])); + DISCH_TAC; + MATCH_MP_TAC AFF_DIM_EQ_AFFINE_HULL; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `a = &2 /\ b = &2 ==> (a:int) <= b`); + CONJ_TAC; + BY(ASM_MESON_TAC[ FACET_AFF_DIM_2]); + BY(ASM_MESON_TAC[ AFF_DIM_CONVEX_HULL; NOT_COLLINEAR_AFF_DIM_2 ]) + ]);; + (* }}} *) + +let COLLINEAR_ORTHO_PLANE = prove_by_refinement( + `!p v u0 b (u1:real^N). + ~(v = vec 0) /\ + ~(u0 = u1) /\ + u0 dot v = b /\ + p dot v = b /\ + (u1 = u0 + v) /\ + collinear {u0,u1,p } ==> + (p = u0)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `collinear` MP_TAC); +(* ALL_SEARCH [`collinear`]; *) + ASM_SIMP_TAC [ COLLINEAR_3_AFFINE_HULL ]; + REWRITE_TAC [ AFFINE_HULL_2_ALT ]; + REWRITE_TAC[ IN_ELIM_THM ; IN_UNIV]; + SUBST1_TAC ( VECTOR_ARITH ( `(u0 + (v:real^N) ) - u0 = v`)); + REPEAT WEAK_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `dot` MP_TAC); +(* ALL_SEARCH [`dot`]; *) + ASM_REWRITE_TAC[]; + GOAL_TERM (fun t -> (REWRITE_TAC[ VECTOR_ARITH ( env t`(u0 + u % (v)) dot v = u0 dot v + u * (v dot v)`)])); + DISCH_THEN SUBST1_TAC; + GOAL_TERM (fun t -> (REWRITE_TAC[ VECTOR_ARITH ( env t` (u0 + u % v = u0) <=> u % v = vec 0`); arith `b + c = b <=> c = &0`;REAL_ENTIRE; VECTOR_MUL_EQ_0 ])); + BY(REWRITE_TAC[ DOT_EQ_0 ]) + ]);; + (* }}} *) + +let collinear_translate_axis = prove_by_refinement( + `!t u1 u2. collinear {t % u1,u1,u2} <=> collinear {vec 0 ,u1- t % u1, (u2:real^3)}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ONCE_REWRITE_TAC[Trigonometry2.COLLINEAR_TRANSABLE]; + REWRITE_TAC[arith `(v:real^3) - vec 0 = v`;arith `(u1:real^3) - t % u1 = (&1- t) % u1`]; + ONCE_REWRITE_TAC[Local_lemmas.COLL_IFF_COLL_CROSS]; + SUBGOAL_THEN `(&1 - t) % u1 cross (u2 - t % u1) = (&1 - t) % u1 cross u2` SUBST1_TAC; + REWRITE_TAC[arith `x - (y:real^3) = x + (-- &1) % y`;CROSS_RADD;CROSS_LMUL;CROSS_RMUL;CROSS_REFL;VECTOR_MUL_RZERO]; + BY(VECTOR_ARITH_TAC); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let azim_axis = prove_by_refinement( + `!t u1 u w. + ~(collinear {t % u1,u1,u}) /\ + ~(collinear {t % u1,u1,w}) ==> + azim (t % u1) u1 u w = azim (vec 0) (u1-t % u1) u w`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MP_TAC (arith `(t % u1) = (t % u1) + vec 0 /\ (u1 = (t % u1)+ (u1- t % u1)) /\ (u:real^3) = (t % u1) + (u - t % u1)/\ w = (t % u1) + (w - t % u1)`); + DISCH_THEN (fun t -> ONCE_REWRITE_TAC[t]); + REWRITE_TAC[AZIM_TRANSLATION]; + ONCE_REWRITE_TAC[arith ` ((t % u1 + u1 - t % u1) - (t % (u1:real^3) + vec 0)) = (u1 - t % u1)`]; + SUBGOAL_THEN `~(t = &1)` ASSUME_TAC; + DISCH_TAC; + FIRST_X_ASSUM_ST `collinear` MP_TAC; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[arith `&1 % (v:real^3) = v`]; + SUBGOAL_THEN `{u1,u1,w} = {u1,(w:real^3)}` SUBST1_TAC; + BY(SET_TAC[]); + BY(REWRITE_TAC[COLLINEAR_2]); + SUBGOAL_THEN `!y. y - t % (u1:real^3) = (t/(&1 - t)) % (vec 0) + (t/ (t - &1)) % (u1 - t % u1) + (&1 % y)` ASSUME_TAC; + GEN_TAC; + ONCE_REWRITE_TAC[arith ` ((u:real^3) = v) <=> (u - v = vec 0)`]; + REWRITE_TAC [arith `t % vec 0 = (vec 0):real^3`]; + REWRITE_TAC [arith `y - t % u1 - (vec 0 + t / (t - &1) % (u1 - t % u1) + &1 % y) = (-- t - (t/(t- &1) * (&1-t))) % (u1:real^3)`]; + REWRITE_TAC[VECTOR_MUL_EQ_0]; + DISJ1_TAC; + Calc_derivative.CALC_ID_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `x + y - x = (y:real^3)`]; + SUBGOAL_THEN `t/ (&1 - t) + t/(t - &1) + &1 = &1` ASSUME_TAC; + Calc_derivative.CALC_ID_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + SUBGOAL_THEN `azim (vec 0) (u1 - t % u1) (u - t % u1) (w - t % u1) = azim (vec 0) (u1 - t % u1) (u - t % u1) w` SUBST1_TAC; + FIRST_X_ASSUM (fun t -> ASSUME_TAC(ISPEC `w:real^3` t)); + FIRST_X_ASSUM (SUBST1_TAC); + MATCH_MP_TAC (GSYM Topology.th1); + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(REAL_ARITH_TAC); + SUBGOAL_THEN `~collinear {vec 0, u1 - t % (u1:real^3), w}` ASSUME_TAC; + BY(ASM_MESON_TAC[collinear_translate_axis]); + CONJ_TAC; + MATCH_MP_TAC Fan.th3a; + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + BY(ASM_MESON_TAC[Trigonometry2.COLLINEAR_TRANSABLE]); + BY(ASM_REWRITE_TAC[]); + ONCE_REWRITE_TAC[Rogers.AZIM_EQ_SYM]; + FIRST_X_ASSUM (fun t -> ASSUME_TAC(ISPEC `u:real^3` t)); + FIRST_X_ASSUM (SUBST1_TAC); + MATCH_MP_TAC (GSYM Topology.th1); + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(REAL_ARITH_TAC); + SUBGOAL_THEN `~collinear {vec 0, u1 - t % (u1:real^3), u}` ASSUME_TAC; + BY(ASM_MESON_TAC[collinear_translate_axis]); + CONJ_TAC; + MATCH_MP_TAC Fan.th3a; + BY(ASM_REWRITE_TAC[]); + BY(ASM_MESON_TAC[collinear_translate_axis]) + ]);; + (* }}} *) + +let EUSOTYP2_general = prove_by_refinement( + `!P c3 A n s t u v b. + polyhedron P /\ bounded P /\ (vec 0) IN interior P /\ + c3 facet_of P /\ + c3 SUBSET A /\ + ( P INTER A = c3 ) /\ + A = {p | p dot v = b} /\ + s = { c | c facet_of c3 } /\ + s HAS_SIZE n /\ + &0 < b /\ + (&0 < t ) /\ (t < &1) /\ + ~(collinear {vec 0,v,u}) /\ + (rcone_gt (vec 0) v t SUBSET fchanged c3) /\ + (rcone_gt (vec 0) v t INTER A SUBSET c3) ==> + (?g h. + (!i. i IN 1..n ==> ((g i ) IN c3) /\ cos (arcV (vec 0) v (g i)) = t) /\ + (g (n+1) = g 1) /\ + (!i. i IN 1..n ==> ((h i) IN c3)) /\ + (!j k. j IN 1..n /\ k IN 1..n /\ (j < k) ==> + azim (vec 0) v u (g j) < azim (vec 0) v u (g k)) /\ + (!i. i IN 1..n ==> + azim (vec 0) v (g i) (h i) = (azim (vec 0) v (g i) (g (i+1)))/ &2 /\ + azim (vec 0) v (h i) (g (i+1)) = (azim (vec 0) v (g i) (g (i+1)))/ &2) /\ + (!i. i IN 1..n ==> + ((h i - g i) dot v = &0 /\ (h i - g (i+1)) dot v = &0 /\ (h i - g i) dot g i = &0 /\ + (h i - g (i+1)) dot g (i+1) = &0)) /\ + (1 < n) /\ + (!i. i IN 1..n ==> ~(collinear{vec 0, v, g i})) /\ + (!i. i IN 1..n ==> ~(collinear{vec 0,v, h i})) /\ + (!i. (i IN 1..n ==> azim (vec 0) v (g i) (g (i+1)) < pi)) + )`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPED_ABBREV_TAC `u0 = (b / (v dot v)) % (v:real^3)`; + TYPED_ABBREV_TAC `u1 = u0 + (v:real^3)`; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `~(v = vec 0)`) ASSUME_TAC)); + DISCH_TAC; + FIRST_X_ASSUM_ST `collinear` MP_TAC; + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`{vec 0 ,vec 0 ,u} = {vec 0,u}`) SUBST1_TAC)); + BY(SET_TAC[]); + BY(REWRITE_TAC[COLLINEAR_2]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `&0 < v dot v`) ASSUME_TAC)); + BY(ASM_REWRITE_TAC[DOT_POS_LT]); + GOAL_TERM (fun w -> (MP_TAC (ISPECL ( envl w[`v`;`u0`;`b`;`t`]) RDISK_R))); + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `?a. u + a % v IN A`) MP_TAC)); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `(b - u dot v)/(v dot v)`))); + ASM_REWRITE_TAC[IN_ELIM_THM]; + REWRITE_TAC[DOT_LADD;DOT_LMUL]; + Calc_derivative.CALC_ID_TAC; + BY(FIRST_X_ASSUM_ST `&0 < v dot (v:real^3)` MP_TAC THEN REAL_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + TYPED_ABBREV_TAC ( `u2 = (u:real^3) + a % v`); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `~(u0 = u2)`) ASSUME_TAC)); + EXPAND_TAC "u2"; + DISCH_TAC; + FIRST_X_ASSUM_ST `collinear` MP_TAC; + REWRITE_TAC[]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`?b'. u = b' % v`) MP_TAC)); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w`(b / (v dot v) - a)`))); + FIRST_X_ASSUM MP_TAC; + EXPAND_TAC "u0"; + BY(VECTOR_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[ (COLLINEAR_LEMMA_ALT) ]; + BY(MESON_TAC[]); + GOAL_TERM (fun w -> (MP_TAC (ISPECL ( envl w[`c3`;`A`;`n`;`{c | c facet_of c3}`;`r`;`u0`;`u1`;`u2`]) EUSOTYP_general))); + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `polyhedron c3`) ASSUME_TAC)); + BY(ASM_MESON_TAC[ FACET_OF_IMP_FACE_OF ; FACE_OF_POLYHEDRON_POLYHEDRON ]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `bounded c3`) ASSUME_TAC)); + BY(ASM_MESON_TAC[ FACE_OF_IMP_SUBSET ; BOUNDED_SUBSET ; FACET_OF_IMP_FACE_OF ]); + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `~(u1 = u0)`) ASSUME_TAC)); + EXPAND_TAC "u1"; + FIRST_X_ASSUM_ST `(v = vec 0)` MP_TAC; + GOAL_TERM (fun w -> (ONCE_REWRITE_TAC [varith ( env w `u0 + v = u0 <=> v = vec 0`)])); + BY(REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `{c | c facet_of c3} HAS_SIZE n`) (fun t -> REWRITE_TAC[t]))); + BY(ASM_MESON_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w ` (!p. dist (p,u0) < r /\ p IN {p | p dot v = b} ==> p IN c3)`) (fun t-> REWRITE_TAC[t]))); + GEN_TAC; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (FIRST_X_ASSUM_ST `rcone_gt` (MP_TAC o (ISPEC ( env w`p`))))); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `rcone_gt` (MP_TAC); + ASM_REWRITE_TAC[INTER;SUBSET;IN_ELIM_THM]; + BY(ASM_MESON_TAC[]); + SUBGOAL_THEN `(u0:real^3) IN rcone_gt (vec 0) v t` ASSUME_TAC; + REWRITE_TAC[rcone_gt ; rconesgn ; IN_ELIM_THM ; VECTOR_SUB_RZERO ; DIST_0 ]; + EXPAND_TAC "u0"; + REWRITE_TAC[ DOT_LMUL ]; + REWRITE_TAC[ NORM_MUL ]; + REWRITE_TAC[ GSYM NORM_POW_2 ]; + REWRITE_TAC[ arith `x pow 2 = x * x`]; + REWRITE_TAC[ arith `x > y <=> y < x`]; + (fun gl -> (SUBGOAL_THEN ( env gl`abs (b / (norm v * norm v)) = b / (norm v * norm v)`) SUBST1_TAC) gl); + MATCH_MP_TAC Trigonometry2.LT_IMP_ABS_REFL; + MATCH_MP_TAC REAL_LT_DIV; + BY((ASM_MESON_TAC [ NORM_POW_2 ; arith `x pow 2 = x * x` ])); + REWRITE_TAC[ arith `(a * b) * c = a * (b * c)`]; + REWRITE_TAC[ arith `x * x = x pow 2`; NORM_POW_2 ; arith `a * b * c * d = a * (b * c) * d`]; + MATCH_MP_TAC REAL_LT_LMUL; + CONJ_TAC; + BY((ASM_MESON_TAC [ REAL_LT_DIV ])); + REWRITE_TAC[ arith `a * t < a <=> &0 < a * (&1 - t)`]; + BY((ASM_MESON_TAC [ REAL_LT_MUL ; arith `t < &1 <=> &0 < &1 - t`])); + COMMENT "u0"; + SUBGOAL_THEN `(u0:real^3) IN c3` ASSUME_TAC; + ENOUGH_TO_SHOW_TAC `(u0:real^3) IN fchanged c3 /\ (u0 IN affine hull c3)`; + REWRITE_TAC[ GSYM IN_INTER]; + BY((ASM_MESON_TAC[FCHANGED_AFFINE; SUBSET; IN; RELATIVE_INTERIOR_SUBSET ])); + CONJ_TAC; + BY((ASM_MESON_TAC[SUBSET; IN])); + GOAL_TERM (fun w -> (MP_TAC (ISPECL ( envl w[`P`;`c3`;`v`;`b`]) affine_facet_hyper ))); + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC Polyhedron.INTERIOR_AFFINIE_HUL_EQ_UNIV; + BY((ASM_MESON_TAC[])); + EXPAND_TAC "c3"; + AP_TERM_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC EQ_EXT; + REWRITE_TAC[ IN_ELIM_THM ]; + BY((MESON_TAC[ DOT_SYM ])); + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[ IN_ELIM_THM ]; + EXPAND_TAC "u0"; + REWRITE_TAC [ DOT_RMUL ]; + CALC_ID_TAC; + BY((REPEAT (FIRST_X_ASSUM MP_TAC ) THEN REAL_ARITH_TAC)); + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!v'. v' IN A <=> (v' - u0) dot v = &0`) ASSUME_TAC)); + ASM_REWRITE_TAC[IN;IN_ELIM_THM]; + EXPAND_TAC "u0"; + REWRITE_TAC[varith `v' - c % (v:real^3) = v' + (-- c) % v`;DOT_LMUL; DOT_LADD ]; + GEN_TAC; + SUBGOAL_THEN ` -- (b / (v dot (v:real^3))) * (v dot v) = -- b` SUBST1_TAC; + Calc_derivative.CALC_ID_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(REAL_ARITH_TAC); + ANTS_TAC; + EXPAND_TAC "u1"; + GEN_TAC; + REWRITE_TAC[ varith ( `(u0 + (v:real^3)) - u0 = v`)]; + BY(ASM_MESON_TAC[]); + COMMENT "all anticedents established, ready to choose g, h"; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `g`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `h`))); + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `!(w:real^3). w IN A ==> (w dot v = b)` ASSUME_TAC; + GEN_TAC; + FIRST_X_ASSUM_ST `A = {p | p dot v = b}` SUBST1_TAC; + BY(REWRITE_TAC[IN;IN_ELIM_THM]); + SUBGOAL_THEN `!(w:real^3). w IN c3 ==> w IN A` ASSUME_TAC; + EXPAND_TAC "c3"; + REWRITE_TAC[IN;INTER;IN_ELIM_THM]; + BY(MESON_TAC[]); + SUBCONJ_TAC; + GEN_TAC; + DISCH_TAC; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + FIRST_X_ASSUM_ST `arcV` MP_TAC; + ONCE_REWRITE_TAC[ Trigonometry2.ARC_SYM ]; + GOAL_TERM (fun w -> (DISCH_THEN (MP_TAC o (ISPEC ( env w `g i`))))); + ANTS_TAC; + BY(ASM_MESON_TAC[]); + EXPAND_TAC "u0"; + GMATCH_SIMP_TAC Trigonometry2.WHEN_K_POS_ARCV_STABLE; + EXISTS_TAC ( `(v dot (v:real^3)) / (b:real)`); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `&0 < (v dot v) /(b:real)`) (fun t -> REWRITE_TAC [ t ]))); + REWRITE_TAC[ Calc_derivative.invert_den_lt ]; + MATCH_MP_TAC Real_ext.REAL_PROP_POS_MUL2; + BY(ASM_REWRITE_TAC[]); + MATCH_MP_TAC (TAUT `(a = b) ==> (a ==> b)`); + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + REWRITE_TAC[ VECTOR_MUL_ASSOC ]; + SUBGOAL_THEN `(v dot v) / b * (b:real) / ((v:real^3) dot v) = &1` SUBST1_TAC; + Calc_derivative.CALC_ID_TAC; + BY(ASM_SIMP_TAC[arith `&0 < x ==> ~(x = &0)`]); + BY(VECTOR_ARITH_TAC); + DISCH_TAC; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + SUBGOAL_THEN `!w. w IN A /\ ~(w = u0) ==> ~collinear {u0,(u1:real^3),w}` ASSUME_TAC; + GEN_TAC; + DISCH_TAC; + ONCE_REWRITE_TAC[ Trigonometry2.COLLINEAR_TRANSABLE ]; + EXPAND_TAC "u1"; + SUBST1_TAC ( varith ( `(u0 + v) - (u0:real^3) = v`)); + REWRITE_TAC[ COLLINEAR_LEMMA_ALT ]; + REWRITE_TAC[ DE_MORGAN_THM ; NOT_EXISTS_THM ]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `(w - u0) dot v = c * ((v:real^3) dot v)` MP_TAC; + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[ DOT_LMUL ]); + SUBGOAL_THEN `(w - u0) dot (v:real^3) = &0` SUBST1_TAC; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC (arith `~(c = &0) /\ (&0 < x) ==> (&0 = c * x ==> F)` ); + ASM_REWRITE_TAC[]; + DISCH_TAC; + FIRST_X_ASSUM_ST `(%)` MP_TAC; + ASM_REWRITE_TAC[ VECTOR_MUL_LZERO ]; + BY(ASM_REWRITE_TAC[ varith `(w - u0 = vec 0) <=> (w = (u0:real^3))`]); + SUBGOAL_THEN `!(w:real^3). (w IN A) /\ ~(w = u0) ==> ~collinear {(vec 0),v,w}` ASSUME_TAC; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[ COLLINEAR_LEMMA_ALT ]; + ASM_REWRITE_TAC[ DE_MORGAN_THM ; NOT_EXISTS_THM ]; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `(w - u0) dot v = (c - b/ (v dot v)) * ((v:real^3) dot v)` MP_TAC; + ASM_REWRITE_TAC[]; + EXPAND_TAC "u0"; + BY(REWRITE_TAC[ varith `c % (v:real^3) - x % v = (c - x) % v`; DOT_LMUL ]); + SUBGOAL_THEN `(w - u0) dot (v:real^3) = &0` SUBST1_TAC; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC (arith `~(c = &0) /\ (&0 < x) ==> (&0 = c * x ==> F)` ); + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[arith `~(x -y = &0) <=> ~(x = y)`]; + DISCH_TAC; + FIRST_X_ASSUM_ST `(%)` MP_TAC; + BY(ASM_REWRITE_TAC[ ]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(!i. i IN 1..n ==> ~collinear {vec 0, v, g i})`) ASSUME_TAC)); + BY(ASM_MESON_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w` (!i. i IN 1..n ==> ~collinear {vec 0, v, h i})`) ASSUME_TAC)); + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[]; + SUBGOAL_THEN (`!w w'. w IN A /\ w' IN A ==> (w - w') dot (v:real^3) = &0`) ASSUME_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + ONCE_REWRITE_TAC [varith `(w - w') = (w - u0) + (-- &1) % (w' - (u0:real^3))`]; + REWRITE_TAC[ DOT_LADD ; DOT_LMUL ]; + BY(FIRST_X_ASSUM MP_TAC THEN FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + SUBGOAL_THEN `!w (w':real^3). w IN A /\ w' IN A /\ (w - u0) dot (w' - w) = &0 ==> (w' - w) dot w = &0` ASSUME_TAC; + REPEAT WEAK_STRIP_TAC; + ONCE_REWRITE_TAC[ DOT_SYM ]; + FIRST_X_ASSUM MP_TAC; + MATCH_MP_TAC (arith `(-- &1) * x + y = &0 ==> (x = &0 ==> y = &0)`); + REWRITE_TAC[ GSYM DOT_LADD ; GSYM DOT_LMUL ]; + REWRITE_TAC[varith `( -- &1 % ((w:real^3) - u0) + w) = u0 `]; + EXPAND_TAC "u0"; + REWRITE_TAC[ DOT_LMUL ;REAL_ENTIRE]; + BY(ASM_MESON_TAC[ DOT_SYM ]); + SUBGOAL_THEN `1 IN 1..n` ASSUME_TAC; + BY(ASM_SIMP_TAC[ IN_NUMSEG ; arith `1 <= 1 /\ (1 < n ==> 1 <= n)` ]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!i. i IN 1..n ==> g (i + 1) IN c3`) ASSUME_TAC)); + GEN_TAC; + SUBGOAL_THEN `i IN 1..n ==> (i+1) IN 1..n \/ (i=n)` ASSUME_TAC; + REWRITE_TAC[ IN_NUMSEG ]; + BY(ARITH_TAC); + BY(ASM_MESON_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(!i. i IN 1..n ==> (h i - g i) dot v = &0 /\ (h i - g (i + 1)) dot v = &0 /\ (h i - g i) dot g i = &0 /\ (h i - g (i + 1)) dot g (i + 1) = &0)`) (fun t -> REWRITE_TAC [t]))); + BY(ASM_MESON_TAC[]); + SUBGOAL_THEN `!w w'. (w IN A) /\ (w' IN A) /\ ~(w = u0) /\ ~(w' = u0) ==> (azim u0 u1 w w' = azim (vec 0) v w w')` ASSUME_TAC; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `~collinear {u0, u1,w} /\ ~collinear {u0,u1,(w':real^3)}` MP_TAC; + BY(ASM_MESON_TAC[]); + SUBGOAL_THEN `?t. (u0:real^3) = t % u1 /\ v = u1 - t % u1` MP_TAC; + EXISTS_TAC `(b:real)/ (v dot v) / (&1 + b / (v dot (v:real^3)))`; + MATCH_MP_TAC (varith ` (a = b) /\ ( c = (d:real^3) - a) ==> (a = b /\ c = d - b)`); + EXPAND_TAC "u1"; + REWRITE_TAC[varith ` (u0 + v) - u0 = (v:real^3) `]; + EXPAND_TAC "u0"; + TYPED_ABBREV_TAC `b' = b / (v dot (v:real^3))`; + ONCE_REWRITE_TAC[VECTOR_ARITH `b' % (v:real^3) + v = (b' + &1) % v`]; + REWRITE_TAC[ VECTOR_MUL_ASSOC ]; + REWRITE_TAC[ VECTOR_MUL_RCANCEL ]; + DISJ1_TAC; + Calc_derivative.CALC_ID_TAC; + EXPAND_TAC "b'"; + MATCH_MP_TAC (arith `&0 < x ==> ~(&1 + x = &0)`); + REWRITE_TAC[ Calc_derivative.invert_den_lt ; Real_ext.REAL_PROP_POS_MUL2 ]; + MATCH_MP_TAC Real_ext.REAL_PROP_POS_MUL2; + BY(ASM_REWRITE_TAC[]); + WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[azim_axis]); + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `(!l. l IN 1..n ==> azim u0 u1 u2 (g l) = azim (vec 0) v u (g l))` ASSUME_TAC; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `azim (vec 0) v u (g l) = azim (vec 0) v u2 (g (l:num))` SUBST1_TAC; + EXPAND_TAC "u2"; + MATCH_MP_TAC EQ_SYM; + ONCE_REWRITE_TAC [ Rogers.AZIM_EQ_SYM ]; + SUBGOAL_THEN `(u:real^3) + a % v = (-- a) % (vec 0) + a % v + (&1) % u` SUBST1_TAC; + BY(VECTOR_ARITH_TAC); + MATCH_MP_TAC (GSYM Topology.th1); + CONJ_TAC; + BY(REAL_ARITH_TAC); + CONJ_TAC; + BY(REAL_ARITH_TAC); + BY(ASM_MESON_TAC[ Fan.th3a ]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!i. i IN 1..n ==> ~(g (i+1) = u0)`) ASSUME_TAC)); + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `i IN 1..n ==> (i + 1 IN 1..n) \/ (i = n)` ASSUME_TAC; + REWRITE_TAC[ IN_NUMSEG ]; + BY(ARITH_TAC); + BY(ASM_MESON_TAC[]); + REPEAT (FIRST_X_ASSUM_ST `dot` (fun t -> ALL_TAC)); + REPEAT (FIRST_X_ASSUM_ST `collinear` (fun t -> ALL_TAC)); + REPEAT (FIRST_X_ASSUM_ST `rcone_gt` (fun t -> ALL_TAC)); + SUBGOAL_THEN `!i. i IN 1..n ==> (g i) IN A /\ (g (i+1) IN A) /\ (h i IN (A:real^3->bool))` ASSUME_TAC; + BY(ASM_MESON_TAC[]); + SUBGOAL_THEN `!i. i IN 1..n ==> ~(g i = u0) /\ ~(g (i+1) = u0) /\ ~( h i = (u0:real^3))` ASSUME_TAC; + BY(ASM_MESON_TAC[]); + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); + FIRST_X_ASSUM_ST `azim` MP_TAC; + FIRST_X_ASSUM_ST `pi` MP_TAC; + FIRST_X_ASSUM_ST `&2` MP_TAC; + REPEAT (FIRST_X_ASSUM (fun t -> ALL_TAC)); + REPEAT WEAK_STRIP_TAC; + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN (`azim (vec 0) v (g (i:num)) (h i) = azim u0 u1 (g i) (h i)`) SUBST1_TAC; + BY(ASM_MESON_TAC[]); + SUBGOAL_THEN (`azim (vec 0) v (g (i:num)) (g (i+1)) = azim u0 u1 (g i) (g (i+1))`) SUBST1_TAC; + BY(ASM_MESON_TAC[]); + SUBGOAL_THEN (`azim (vec 0) v (h (i:num)) (g (i+1)) = azim u0 u1 (h i) (g (i+1))`) SUBST1_TAC; + BY(ASM_MESON_TAC[]); + BY(ASM_SIMP_TAC[]); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let CONE0_SUBSET_WEDGE = prove_by_refinement( + `!v u w. + ~collinear { vec 0, v, u} /\ + ~collinear { vec 0, v, w} /\ + &0 < azim (vec 0) v u w /\ + azim (vec 0) v u w < pi + ==> + cone0 (vec 0) {v,u,w} SUBSET wedge (vec 0) v u w`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ENOUGH_TO_SHOW_TAC `wedge (vec 0) v u w = aff_gt {(vec 0),v} {u,w}`; + BY((MESON_TAC[cone0_subset_lune])); + MATCH_MP_TAC WEDGE_LUNE_GT; + BY((ASM_REWRITE_TAC[])) + ]);; + (* }}} *) + +let FACET_INTER_DISJOINT = prove_by_refinement( + `!(p:real^A->bool) f. + polyhedron p /\ + vec 0 IN interior p /\ + f facet_of p ==> ~((vec 0) IN f)`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REWRITE_TAC[ facet_of ]; + GOAL_TERM (fun w -> (MP_TAC (ISPECL ( envl w[`f`;`p`]) FACE_OF_DISJOINT_INTERIOR))); + REWRITE_TAC[ Local_lemmas.EMPTY_NOT_EXISTS_IN ]; + REWRITE_TAC[ INTER; IN;]; + REWRITE_TAC[ INTER; IN; IN_ELIM_THM]; + BY(ASM_MESON_TAC[ arith `~(x = (x:int) - &1)`]) + ]);; + (* }}} *) + +let CONE0_AFF_GT = prove_by_refinement( + `!x U. cone0 (x:real^A) U = aff_gt {x } U`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[cone0;Sphere.aff_gt_def]) + ]);; + (* }}} *) + +let DISJOINT0_SCALE = prove_by_refinement( + `!t (u0:real^A) u1 u2. + DISJOINT { (vec 0) } { u0,u1,u2 } /\ + ~(t = &0) ==> + DISJOINT { (vec 0) } { t % u0,u1,u2 } + `, + (* {{{ proof *) + [ + REWRITE_TAC[DISJOINT; Collect_geom2.INTER_DISJONT_EX ]; + REWRITE_TAC[ IN_SING; IN_INSERT]; + BY(MESON_TAC[ VECTOR_MUL_EQ_0 ; ]) + ]);; + (* }}} *) + +let CONE0_SCALE = prove_by_refinement( + `!t (u0:real^A) u1 u2. + DISJOINT { (vec 0) } { u0,u1,u2 } /\ + &0 < t ==> + cone0 (vec 0) {u0, u1,u2 } = cone0 (vec 0) {t % u0,u1,u2 }`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[ CONE0_AFF_GT]; + ASM_SIMP_TAC [ Vol1.AFF_GT_1_3 ;DISJOINT0_SCALE; arith `&0 < t ==> ~(t = &0)`]; + ONCE_REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[IN_ELIM_THM]; + REWRITE_TAC[arith `t % (vec 0) = vec 0 /\ (vec 0) + u = u`]; + GEN_TAC; + ONCE_REWRITE_TAC[TAUT `a /\ b /\ c /\ d /\ e <=> d /\ (a /\ b /\ c /\ e)`]; + REWRITE_TAC[MESON[] `!a b. ((?t1 t2 t3 t4. (a t1 t2 t3 t4 /\ b t2 t3 t4 )) <=> (?t2 t3 t4. ((?t1. a t1 t2 t3 t4) /\ b t2 t3 t4)))`]; + SUBGOAL_THEN `!t2 t3 t4. ?t1. t1 + t2 + t3 + t4 = &1` (fun t -> REWRITE_TAC [ t]); + REPEAT WEAK_STRIP_TAC; + EXISTS_TAC `&1 - t2 - t3 - t4`; + BY(REAL_ARITH_TAC); + ONCE_REWRITE_TAC[ Geomdetail.EQ_EXPAND ]; + REPEAT WEAK_STRIP_TAC; + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `t2 / t`))); + EXISTS_TAC `t3:real`; + EXISTS_TAC `t4:real`; + REWRITE_TAC[ VECTOR_MUL_ASSOC ]; + SUBGOAL_THEN `t2 / t * t = t2` SUBST1_TAC; + Calc_derivative.CALC_ID_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LT_DIV; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[ VECTOR_MUL_ASSOC ]; + REPEAT WEAK_STRIP_TAC; + EXISTS_TAC (`t2 * t`); + EXISTS_TAC `t3:real`; + EXISTS_TAC `t4:real`; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LT_MUL; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let CONE0_FCHANGED_SCALE = prove_by_refinement( + ` !p f (u0:real^3) u1 u2 t. + polyhedron p /\ + bounded p /\ + vec 0 IN interior p /\ + f facet_of p /\ + ~coplanar { (vec 0), u0,u1, u2 } /\ + {t % u0, u1, u2} SUBSET f /\ + &0 < t + ==> cone0 (vec 0) {u0, u1, u2} SUBSET fchanged f`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `~(u1 = vec 0) /\ ~(u2 = vec 0) /\ ~collinear {u0,u1,u2}`) MP_TAC)); + CONJ_TAC; + BY(ASM_MESON_TAC[ Planarity.notcoplanar_disjoint ]); + CONJ_TAC; + BY(ASM_MESON_TAC[ Planarity.notcoplanar_disjoint ]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`{ vec 0 , u0 , u1, u2} = {u0,u1 , u2, vec 0}`) ASSUME_TAC)); + BY(SET_TAC[]); + BY(ASM_MESON_TAC[ NOT_COPLANAR_NOT_COLLINEAR ]); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `cone0 (vec 0) {u0,u1,u2} = cone0 (vec 0) {t % u0,u1,u2}`) SUBST1_TAC)); + GOAL_TERM (fun w -> (ASM_CASES_TAC ( env w `u0 = vec 0`))); + BY(ASM_REWRITE_TAC[ VECTOR_MUL_RZERO ]); + MATCH_MP_TAC CONE0_SCALE; + ASM_REWRITE_TAC[]; + REWRITE_TAC[ DISJOINT ]; + REWRITE_TAC[ Local_lemmas.EMPTY_NOT_EXISTS_IN ]; + REWRITE_TAC[ IN_SING ; IN_INTER ; IN_INSERT ]; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC CONE0_FCHANGED; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `p`))); + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `~coplanar { vec 0, t % u0, u1, u2}`) ASSUME_TAC)); + BY(ASM_MESON_TAC[ COPLANAR_SPECIAL_SCALE ; arith `&0 < t ==> ~(t = &0)`]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`{ vec 0 , t % u0 , u1, u2} = {t % u0,u1 , u2, vec 0}`) ASSUME_TAC)); + BY(SET_TAC[]); + BY(ASM_MESON_TAC[ NOT_COPLANAR_NOT_COLLINEAR ]) + ]);; + (* }}} *) + +let gotcjah_sol_half = prove_by_refinement( + `!c3 v b P W t rho bet (w0:real^3) w1 s. + polyhedron P /\ bounded P /\ (&0 < b) /\ + (vec 0 IN interior P) /\ + (c3 facet_of P) /\ + (fchanged c3 = W) /\ + (&0 < t /\ t < &1 ) /\ + (&0 < rho) /\ + (&0 < s) /\ + (P INTER { p | p dot v = b } = c3) /\ + rcone_gt (vec 0) v t SUBSET W /\ + ~(v = vec 0) /\ + &0 < v dot v /\ + cos (arcV(vec 0) v w0) = t /\ + s % v IN c3 /\ + w0 IN c3 /\ + w1 IN c3 /\ + ~coplanar {(vec 0), v, w0, w1 } /\ + // ~collinear {(vec 0), v, w0} /\ + // ~collinear {(vec 0), v, w1} /\ + // &0 < dihV (vec 0) v w0 w1 /\ + // dihV (vec 0) v w0 w1 < pi /\ + dihV (vec 0) v w0 w1 = bet /\ + (w1 - w0) dot v = &0 /\ + (w1 - w0) dot w0 = &0 + ==> + (?X. + X = cone0 (vec 0) {v,w0,w1} /\ + X SUBSET (aff_gt { (vec 0), v } { w0, w1} INTER W) /\ + measurable (X INTER normball (vec 0) rho) /\ + radial_norm rho (vec 0) (X INTER normball (vec 0) rho) /\ + (bet - asn (sin bet * t)) = sol (vec 0) X) +`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `~collinear {(vec 0),v,w0} /\ ~collinear {(vec 0),v,w1} /\ &0 < dihV (vec 0) v w0 w1 /\ dihV (vec 0) v w0 w1 < pi`) MP_TAC)); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `{(vec 0), v,w0,w1} = {(vec 0),v,w1,w0}`) ASSUME_TAC)); + BY(SET_TAC []); + BY(ASM_MESON_TAC[ NOT_COPLANAR_NOT_COLLINEAR ; DIHV_EQ_0_PI_EQ_COPLANAR ; DIHV_RANGE ; arith `&0<=x /\ x <= pi /\ ~(x = &0) /\ ~(x = pi) ==> (&0 < x /\ x < pi)`]); + REPEAT WEAK_STRIP_TAC; + EXISTS_TAC `cone0 (vec 0) {v,w0,(w1:real^3)}`; + REWRITE_TAC[ ]; + CONJ_TAC; + REWRITE_TAC[ Misc_defs_and_lemmas.SUBSET_INTER ]; + CONJ_TAC; + BY(REWRITE_TAC[ cone0_subset_lune ]); + EXPAND_TAC "W"; + MATCH_MP_TAC CONE0_FCHANGED_SCALE; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w`P`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w`s`))); + ASM_REWRITE_TAC[]; + REWRITE_TAC[SUBSET;IN_INSERT]; + BY(ASM_MESON_TAC[ NOT_IN_EMPTY ]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`!r. &0 < r ==> measurable (cone0 (vec 0) {v, w0, w1} INTER normball (vec 0) r)`) ASSUME_TAC)); + REPEAT WEAK_STRIP_TAC; + ONCE_REWRITE_TAC[ INTER_COMM ]; + ONCE_REWRITE_TAC[ NORMBALL_BALL ]; + ONCE_REWRITE_TAC[ CONE0_AFF_GT ]; + BY(REWRITE_TAC[ MEASURABLE_BALL_AFF_GT ]); + ASM_SIMP_TAC[]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`!r. &0 < r ==> radial_norm r (vec 0) (cone0 (vec 0) {v, w0, w1} INTER normball (vec 0) r) `) ASSUME_TAC)); + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[ CONE0_AFF_GT ]; + MATCH_MP_TAC Vol1.aff_gt_radial; + CONJ_TAC; + REWRITE_TAC[ DISJOINT ; Local_lemmas.EMPTY_NOT_EXISTS_IN ]; + REWRITE_TAC[ IN_SING; IN_INTER; IN_INSERT ]; + BY(ASM_MESON_TAC [ Planarity.notcoplanar_disjoint ]); + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + ASM_SIMP_TAC[]; + GOAL_TERM (fun w -> (MP_TAC (ISPECL ( envl w [`w0`;`v`;`w1`]) vol_solid_triangle_ortho))); + ASM_REWRITE_TAC[]; + ANTS_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`{vec 0 ,w0, v, w1} = {vec 0 ,v,w0,w1}`) SUBST1_TAC)); + BY(SET_TAC []); + BY(ASM_REWRITE_TAC[]); + LET_TAC; + LET_TAC; + DISCH_THEN (fun t -> REWRITE_TAC [ GSYM t ]); + GOAL_TERM (fun w -> (MP_TAC (ISPECL ( envl w [`(vec 0):real^3`;`cone0 (vec 0) {v,w0,w1}`;`rho'`]) Pack_defs.sol))); + GOAL_TERM (fun w -> (MP_TAC (ISPECL ( envl w [`(vec 0):real^3`;`cone0 (vec 0) {v,w0,w1}`;`&1`]) Pack_defs.sol))); + ASM_SIMP_TAC[arith `&0 < &1`;arith `x < y ==> y > x`]; + DISCH_THEN (fun t -> ALL_TAC); + DISCH_THEN (fun t -> REWRITE_TAC[ GSYM t]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`{(vec 0),w0,v,w1}= {vec 0, v,w0,w1}`) ASSUME_TAC)); + BY(SET_TAC []); + ASM_SIMP_TAC[arith `&1 > &0`;GSYM volume_props]; + REWRITE_TAC[solid_triangle]; + REWRITE_TAC[arith `x / &1 pow 3 = x`]; + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`{w0,v,w1} = {v,w0,w1}`) MP_TAC)); + BY(SET_TAC[]); + BY(MESON_TAC[INTER_COMM]) + ]);; + +let AZIM_LE_PI_EQ_DIHV_ALT = prove_by_refinement( + `!a b x y. ~collinear {a, b, x} /\ ~collinear {a, b, y} /\ + azim a b x y <= pi + ==> dihV a b x y = azim a b x y`, + (* {{{ proof *) + [ + MESON_TAC[Local_lemmas.AZIM_LE_PI_EQ_DIHV]; + ]);; + (* }}} *) + +let gotcjah_sol_lemma = prove_by_refinement( + `!c3 v b P W t rho bet (w0:real^3) w1 w2 s. + polyhedron P /\ bounded P /\ (&0 < b) /\ + (vec 0 IN interior P) /\ + (c3 facet_of P) /\ + (fchanged c3 = W) /\ + (&0 < t /\ t < &1 ) /\ + (&0 < rho) /\ + (&0 < s) /\ + (P INTER { p | p dot v = b } = c3) /\ + rcone_gt (vec 0) v t SUBSET W /\ + ~(v = vec 0) /\ + &0 < v dot v /\ + cos (arcV(vec 0) v w0) = t /\ + cos (arcV(vec 0) v w2) = t /\ + s % v IN c3 /\ + w0 IN c3 /\ + w1 IN c3 /\ + w2 IN c3 /\ + ~collinear {(vec 0), v, w0} /\ + ~collinear {(vec 0), v, w1} /\ + ~collinear {(vec 0), v, w2} /\ + s % v IN c3 /\ + w0 IN c3 /\ + w1 IN c3 /\ + w2 IN c3 /\ + azim (vec 0) v w0 w2 / &2 = bet /\ + // &0 < azim (vec 0) v w0 w2 /\ + azim (vec 0) v w0 w2 < pi /\ + azim (vec 0) v w0 w1 = bet /\ + azim (vec 0) v w1 w2 = bet /\ + (w1 - w0) dot v = &0 /\ + (w1 - w0) dot w0 = &0 /\ + (w1 - w2) dot v = &0 /\ + (w1 - w2) dot w2 = &0 + ==> + (?X. X SUBSET (wedge (vec 0) v w0 w2 INTER W) /\ + measurable (X INTER normball (vec 0) rho) /\ + radial_norm rho (vec 0) (X INTER normball (vec 0) rho) /\ + &2 * (bet - asn (sin bet * t)) = sol (vec 0) X) +`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `dihV (vec 0) v w0 w1 = bet /\ dihV (vec 0) v w1 w2 = bet`) MP_TAC)); + GMATCH_SIMP_TAC AZIM_LE_PI_EQ_DIHV_ALT; + GMATCH_SIMP_TAC AZIM_LE_PI_EQ_DIHV_ALT; + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `azim` MP_TAC); + MP_TAC PI_POS; + BY(REAL_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + COMMENT "CHANGE STARTS HERE"; + SUBGOAL_THEN `azim (vec 0) v w0 w2 = &0 \/ &0 < azim (vec 0) v w0 w2` MP_TAC; + BY(MESON_TAC[AZIM_NN; arith `&0 <= x ==> (x = &0) \/ &0 < x`]); + DISCH_THEN DISJ_CASES_TAC; + EXISTS_TAC (`{}:real^3->bool`); + REWRITE_TAC[INTER_EMPTY ; MEASURABLE_EMPTY; Conforming.RADIAL_EMPTY ]; + REWRITE_TAC[ EMPTY_SUBSET ]; + REWRITE_TAC[ Conforming.SOL_EMPTY ]; + FIRST_X_ASSUM_ST `&2` MP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `&0/ &2 = bet <=> bet = &0`]; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[ SIN_0 ; ASN_0; arith `&0 * t = &0`]; + BY(REAL_ARITH_TAC); + (COMMENT "CHANGE ENDS HERE"); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`~coplanar {(vec 0),v,w0,w1} /\ ~coplanar {(vec 0),v,w1,w2}`) MP_TAC)); + ASSUME_TAC DIHV_EQ_0_PI_EQ_COPLANAR; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w`~(dihV (vec 0) v w0 w1 = &0) /\ ~(dihV (vec 0) v w0 w1 = pi) /\ ~(dihV (vec 0) v w1 w2 = &0) /\ ~(dihV( vec 0) v w1 w2 = pi)`))); + BY(ASM_MESON_TAC[]); + REPEAT (FIRST_X_ASSUM_ST `azim` MP_TAC); + MP_TAC PI_POS; + REPEAT (FIRST_X_ASSUM_ST `dihV` MP_TAC); + BY(REAL_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `cone0 (vec 0) {v,w0,w1} UNION cone0 (vec 0) {v,w2,w1}`))); + REWRITE_TAC[ UNION_SUBSET ]; + ONCE_REWRITE_TAC[INTER_COMM]; + REWRITE_TAC[UNION_OVER_INTER]; + GMATCH_SIMP_TAC MEASURABLE_UNION; + GMATCH_SIMP_TAC Conforming.RADIAL_UNION; + GMATCH_SIMP_TAC Conforming.SOL_DISJOINT_UNION; + ONCE_REWRITE_TAC[arith `u2 = x + y <=> u2 - (x + y) = &0`]; + GMATCH_SIMP_TAC (arith `u = x /\ u = y ==> &2 * u - ( x + y) = &0`); + GOAL_TERM (fun w -> (MP_TAC (ISPECL ( envl w [`c3`;`v`;`b`;`P`;`W`;`t`;`rho'`;`bet`;`w0`;`w1`;`s`]) gotcjah_sol_half))); + ASM_REWRITE_TAC[]; + WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `cone0` (ASSUME_TAC o SYM); + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (MP_TAC (ISPECL ( envl w [`c3`;`v`;`b`;`P`;`W`;`t`;`rho'`;`bet`;`w2`;`w1`;`s`]) gotcjah_sol_half))); + ASM_REWRITE_TAC[]; + ANTS_TAC; + CONJ_TAC; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w`{vec 0 , v,w1,w2} = {vec 0, v, w2,w1}`))); + BY(MESON_TAC[]); + BY(SET_TAC[]); + ONCE_REWRITE_TAC[ DIHV_SYM ]; + BY(ASM_REWRITE_TAC[]); + WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `cone0` (ASSUME_TAC o SYM); + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[INTER_COMM]; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (TAUT `b /\ c /\ a ==> a /\ b /\ c`); + GOAL_TERM (fun w -> (MP_TAC (ISPECL ( envl w [`(vec 0):real^3`;`v`;`w0`;`w2`;`w1`]) WEDGE_SPLIT))); + ASM_REWRITE_TAC[]; + ANTS_TAC; + REWRITE_TAC[wedge; IN;IN_ELIM_THM]; + ASM_REWRITE_TAC[]; + MP_TAC PI_POS; + REPEAT (FIRST_X_ASSUM_ST `azim` MP_TAC); + BY(REAL_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `wedge (vec 0) v w0 w1 = aff_gt {vec 0, v} {w0,w1} /\ wedge (vec 0) v w1 w2 = aff_gt {vec 0, v} {w2,w1}` MP_TAC; + GMATCH_SIMP_TAC WEDGE_LUNE_GT; + GMATCH_SIMP_TAC WEDGE_LUNE_GT; + ASM_REWRITE_TAC[]; + ASSUME_TAC PI_POS; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + BY(SET_TAC[]); + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC (TAUT `c /\ a /\ b ==> a /\ b /\ c`); + CONJ_TAC; + EXISTS_TAC `rho':real`; + ONCE_REWRITE_TAC[INTER_COMM]; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[arith `&0 < x ==> x > &0`;DISJOINT]; + ENOUGH_TO_SHOW_TAC `?Y Y'. X SUBSET Y /\ X' SUBSET Y' /\ Y INTER (Y':real^3->bool) = {}`; + BY(SET_TAC[]); + REPEAT (FIRST_X_ASSUM_ST `wedge` MP_TAC); + REPEAT (FIRST_X_ASSUM_ST `aff_gt` MP_TAC); + BY(MESON_TAC[ SUBSET_INTER]); + REPEAT (FIRST_X_ASSUM_ST `wedge` MP_TAC); + REPEAT (FIRST_X_ASSUM_ST `aff_gt` MP_TAC); + BY(SET_TAC[]) + ]);; + +let c3_lemma = prove_by_refinement( + `!c3 (v:real^3) b. + c3 SUBSET { p | p dot v = b } /\ + &0 < b ==> + ({p | p dot v = b} INTER fchanged c3 SUBSET c3)`, + (* {{{ proof *) + [ + ONCE_REWRITE_TAC[INTER;SUBSET]; + REWRITE_TAC[IN;INTER;IN_ELIM_THM]; + REWRITE_TAC[ Polyhedron.fchanged ;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`c3 v1`) ASSUME_TAC)); + BY(ASM_MESON_TAC[ SUBSET;IN;IN_ELIM_THM;RELATIVE_INTERIOR_SUBSET ]); + SUBGOAL_THEN`t * b = b` ASSUME_TAC; + BY(ASM_MESON_TAC[ DOT_LMUL ]); + SUBGOAL_THEN `t = &1` ASSUME_TAC; + MATCH_MP_TAC (REAL_RING `~(b = &0) /\ (t * b= b) ==> (t = &1)`); + BY(ASM_SIMP_TAC [arith `&0 < b==> ~(b = &0)`]); + BY(ASM_MESON_TAC[arith `&1 % (v1:real^3) = v1`]) + ]);; + (* }}} *) + +let NOT_COLLINEAR = prove_by_refinement( + `!(v:real^3). ~(v = vec 0)==> (?u. ~collinear {(vec 0),v,u})`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ASM_SIMP_TAC [ Local_lemmas.COLLINEAR_ONCE_VEC_0 ]; + SUBGOAL_THEN `&0 < (v:real^3) dot v` ASSUME_TAC; + BY(ASM_REWRITE_TAC[DOT_POS_LT]); + GOAL_TERM (fun w -> (MP_TAC (ISPEC ( env w `v`) Trigonometry2.EXISTS_OTHOR_VECTOR_DIFFF_VEC0))); + REPEAT WEAK_STRIP_TAC; + EXISTS_TAC `v':real^3`; + REWRITE_TAC[ NOT_EXISTS_THM ]; + GEN_TAC; + ONCE_REWRITE_TAC[MESON[] `a = b <=> (b = a)`]; + DISCH_TAC; + REPEAT (FIRST_X_ASSUM_ST `0` MP_TAC); + EXPAND_TAC "v'"; + REWRITE_TAC[DOT_RMUL]; + REWRITE_TAC[REAL_ENTIRE]; + REWRITE_TAC[ VECTOR_MUL_EQ_0 ]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let gotcjah_prep = prove_by_refinement( + `!c v b P WF t n u0 A. + polyhedron P /\ bounded P /\ (&0 < b) /\ + (vec 0 IN interior P) /\ + c facet_of P /\ + ( { (p:real^3) | p dot v = b} = A) /\ + ( (b / (v dot v)) % (v:real^3) = u0 ) /\ + fchanged c = WF /\ + (&0 < t /\ t < &1) /\ + (P INTER { p | p dot v = b } = c) /\ + rcone_gt (vec 0) v t SUBSET WF /\ + ( {f | f facet_of c } HAS_SIZE n) ==> + (c SUBSET A) /\ + ( ~((v:real^3) = vec 0) ) /\ + ( &0 < (v:real^3) dot v ) /\ + ( (u0:real^3) IN rcone_gt (vec 0) v t ) /\ + ( (u0:real^3) IN c ) /\ + ( rcone_gt (vec 0) v t INTER A SUBSET c ) /\ + ( ?u. ~(collinear {(vec 0), v, u }))`, + (* {{{ proof *) + [ + X_GENv_TAC "c3"; + REPEAT WEAK_STRIP_TAC; + SUBCONJ_TAC; + FIRST_X_ASSUM_ST `INTER` MP_TAC; + ASM_REWRITE_TAC[]; + BY(SET_TAC[]); + DISCH_TAC; + SUBGOAL_THEN `~((v:real^3) = vec 0)` ASSUME_TAC; + DISCH_TAC; + HASH_UNDISCH_TAC 2896; + ASM_REWRITE_TAC[DOT_RZERO]; + REWRITE_TAC[ FUN_EQ_THM ;IN_ELIM_THM]; + DISCH_TAC; + (fun gl -> (SUBGOAL_THEN ( env gl`A = {}`) ASSUME_TAC) gl); + BY((REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[arith `&0 < b ==> ~(&0 = b)`])); + (fun gl -> (SUBGOAL_THEN ( env gl`c3 = {}`) ASSUME_TAC) gl); + FIRST_X_ASSUM_ST `SUBSET` MP_TAC; + FIRST_X_ASSUM MP_TAC; + BY(SET_TAC[]); + BY((ASM_MESON_TAC[ facet_of ])); + COMMENT "1"; + COMMENT "v dot v"; + SUBGOAL_THEN `&0 < (v:real^3) dot v` ASSUME_TAC; + BY((ASM_REWRITE_TAC[DOT_POS_LT])); + COMMENT "subgoal"; + ASM_SIMP_TAC[ NOT_COLLINEAR ]; + SUBCONJ_TAC; + REWRITE_TAC[rcone_gt ; rconesgn ; IN_ELIM_THM ; VECTOR_SUB_RZERO ; DIST_0 ]; + EXPAND_TAC "u0"; + REWRITE_TAC[ DOT_LMUL ]; + REWRITE_TAC[ NORM_MUL ]; + REWRITE_TAC[ GSYM NORM_POW_2 ]; + REWRITE_TAC[ arith `x pow 2 = x * x`]; + REWRITE_TAC[ arith `x > y <=> y < x`]; + (fun gl -> (SUBGOAL_THEN ( env gl`abs (b / (norm v * norm v)) = b / (norm v * norm v)`) SUBST1_TAC) gl); + MATCH_MP_TAC Trigonometry2.LT_IMP_ABS_REFL; + MATCH_MP_TAC REAL_LT_DIV; + BY((ASM_MESON_TAC [ NORM_POW_2 ; arith `x pow 2 = x * x` ])); + REWRITE_TAC[ arith `(a * b) * c = a * (b * c)`]; + REWRITE_TAC[ arith `x * x = x pow 2`; NORM_POW_2 ; arith `a * b * c * d = a * (b * c) * d`]; + MATCH_MP_TAC REAL_LT_LMUL; + CONJ_TAC; + BY((ASM_MESON_TAC [ REAL_LT_DIV ])); + REWRITE_TAC[ arith `a * t < a <=> &0 < a * (&1 - t)`]; + BY((ASM_MESON_TAC [ REAL_LT_MUL ; arith `t < &1 <=> &0 < &1 - t`])); + DISCH_TAC; + COMMENT "u0"; + SUBGOAL_THEN `(u0:real^3) IN c3` ASSUME_TAC; + ENOUGH_TO_SHOW_TAC `(u0:real^3) IN fchanged c3 /\ (u0 IN affine hull c3)`; + REWRITE_TAC[ GSYM IN_INTER]; + BY((ASM_MESON_TAC[FCHANGED_AFFINE; SUBSET; IN; RELATIVE_INTERIOR_SUBSET ])); + CONJ_TAC; + BY((ASM_MESON_TAC[SUBSET; IN])); + GOAL_TERM (fun w -> (MP_TAC (ISPECL ( envl w[`P`;`c3`;`v`;`b`]) affine_facet_hyper ))); + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC Polyhedron.INTERIOR_AFFINIE_HUL_EQ_UNIV; + BY((ASM_MESON_TAC[])); + EXPAND_TAC "c3"; + AP_TERM_TAC; + MATCH_MP_TAC EQ_EXT; + REWRITE_TAC[ IN_ELIM_THM ]; + BY((MESON_TAC[ DOT_SYM ])); + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[ IN_ELIM_THM ]; + EXPAND_TAC "u0"; + REWRITE_TAC [ DOT_RMUL ]; + CALC_ID_TAC; + BY((REPEAT (FIRST_X_ASSUM MP_TAC ) THEN REAL_ARITH_TAC)); + ASM_REWRITE_TAC[]; + COMMENT "1"; + MATCH_MP_TAC SUBSET_TRANS; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `A INTER WF'`))); + CONJ_TAC; + REPEAT (FIRST_X_ASSUM_ST `rcone_gt` MP_TAC); + BY(SET_TAC[]); + BY(ASM_MESON_TAC[c3_lemma]) + ]);; + (* }}} *) + + + +let azim_pos = prove_by_refinement( + `!x v u w1 w2. + azim x v u w1 < azim x v u w2 /\ + ~collinear {x, v, w1} /\ + ~collinear {x, v, w2} /\ + ~collinear {x, v, u} + ==> &0 < azim x v w1 w2`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (MP_TAC (ISPECL ( envl w [`x`;`v`;`u`;`w1`;`w2`]) Fan.sum4_azim_fan ))); + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let convex_sum_corollary = prove_by_refinement( + `!n t bet. 0 < n /\ + &0 < t /\ t < &1 /\ + sum (1..n) bet = pi /\ + (!i. i IN 1..n ==> &0 <= bet i /\ bet i <= pi) ==> + (pi - &n * asn (sin (pi / &n) * t)) <= sum (1..n) (\i. bet i - asn (sin (bet i) * t))`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REWRITE_TAC[TAUT `(a /\ b ==> c) <=> (a ==> (b ==> c))`]; + DISCH_TAC; + ASM_SIMP_TAC[ SUM_OFFSET_0 ; arith `0 < n ==> 1 <= n`]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC GOTCJAH_convex_sum; + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `pi <= &n * pi /\ &0 <= pi` (fun t -> REWRITE_TAC[t]); + ASSUME_TAC PI_POS; + SIMP_TAC[ arith `pi <= &n * pi <=> &0 <= pi * (&n - &1)`;]; + GMATCH_SIMP_TAC Real_ext.REAL_PROP_NN_MUL2; + ONCE_REWRITE_TAC[arith `&0 <= &n - &1 <=> &1 <= &n`]; + REWRITE_TAC[Real_ext.REAL_LE]; + BY(ASM_MESON_TAC[arith `0 1<=n`;arith `&0 < pi ==> &0 <= pi`]); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + REWRITE_TAC[IN_NUMSEG]; + BY(ASM_SIMP_TAC[arith `i < n ==> i+1 <=n`;arith `1 <= i + 1`]) + ]);; + (* }}} *) + +let SOL_SUBSET = prove_by_refinement( + `!x s t r. r > &0 /\ + measurable (s INTER normball x r) /\ + measurable (t INTER normball x r) /\ + s SUBSET t /\ + radial_norm r x (s INTER normball x r) /\ + radial_norm r x (t INTER normball x r) + ==> sol x s <= sol x t`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (MP_TAC (ISPECL ( envl w [`x`;`s`;`t DIFF s`;`r`]) Conforming.SOL_DISJOINT_UNION))); + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `s UNION t DIFF s = t`) SUBST1_TAC)); + FIRST_X_ASSUM_ST `SUBSET` MP_TAC; + BY(SET_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `DISJOINT s (t DIFF s)`) (fun t -> ONCE_REWRITE_TAC[t]))); + BY(SET_TAC[]); + REWRITE_TAC[]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!u. (t DIFF s) INTER u = (t INTER u DIFF (s INTER u))`) ASSUME_TAC)); + GEN_TAC; + FIRST_X_ASSUM_ST `SUBSET` MP_TAC; + BY(SET_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `measurable ((t DIFF s) INTER normball x r)`) ASSUME_TAC)); + ASM_SIMP_TAC[]; + MATCH_MP_TAC MEASURABLE_DIFF; + BY(ASM_REWRITE_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `radial_norm r x ((t DIFF s) INTER normball x r)`) ASSUME_TAC)); + ASM_SIMP_TAC[]; + MATCH_MP_TAC Conforming.RADIAL_DIFF; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `SUBSET` MP_TAC; + BY(SET_TAC[]); + ASM_REWRITE_TAC[]; + ENOUGH_TO_SHOW_TAC ( `&0 <= sol x (t DIFF s)`); + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC Vol1.sol; + EXISTS_TAC `r:real`; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC Real_ext.REAL_PROP_NN_MUL2; + CONJ_TAC; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC REAL_LE_DIV; + CONJ_TAC; + MATCH_MP_TAC MEASURE_POS_LE; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC REAL_POW_LE; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let GOTCJAH_concl = `!c v b P WF t n. + polyhedron P /\ bounded P /\ (&0 < b) /\ + (vec 0 IN interior P) /\ + c facet_of P /\ + fchanged c = WF /\ + (&0 < t /\ t < &1) /\ + (c = P INTER { p | p dot v = b } /\ rcone_gt (vec 0) v t SUBSET WF) /\ + ( {u | u facet_of c } HAS_SIZE n) + ==> &2 * pi - &2* &n * asn (t* sin(pi/ &n)) <= sol (vec 0) WF`;; + +let GOTCJAH = prove_by_refinement( + GOTCJAH_concl, + (* {{{ proof *) + [ + X_GENv_TAC "c3"; + REPEAT WEAK_STRIP_TAC; + TYPED_ABBREV_TAC (`A = { (p:real^3) | p dot v = b}`); + TYPED_ABBREV_TAC `u0 = (b / (v dot v)) % (v:real^3)`; + GOAL_TERM (fun w -> (MP_TAC (ISPECL ( envl w [`c3`; `v`; `b`; `P`; `WF'`; `t`; `n`; `u0`; `A`]) gotcjah_prep))); + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (MP_TAC (ISPECL ( envl w [`P`; `c3`; `A`; `n`; `{ c | c facet_of c3 }`; `t`; `u`; `v`; `b`] ) EUSOTYP2_general))); + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `1 IN 1..n /\ (!i. (i IN 1..n) ==> (i+1) IN 1..n \/ (i=n))` ASSUME_TAC; + FIRST_X_ASSUM_ST `1 < n` MP_TAC; + REWRITE_TAC[ IN_NUMSEG ]; + BY((ARITH_TAC)); + SUBGOAL_THEN `&0 < b/ ((v:real^3) dot v)` ASSUME_TAC; + MATCH_MP_TAC REAL_LT_DIV; + BY((ASM_REWRITE_TAC[])); + SUBGOAL_THEN `!i. (?bet X. (i IN 1..n) ==> (azim (vec 0) v (g i) (g (i+1)) / &2 = bet) /\ X SUBSET (wedge (vec 0) v (g i) (g (i+1)) INTER WF') /\ measurable (X INTER normball (vec 0) (&1)) /\ radial_norm (&1) (vec 0) (X INTER normball (vec 0) (&1)) /\ (&2 * (bet - asn (sin bet * t)) = sol (vec 0) X))` ASSUME_TAC; + GEN_TAC; + REWRITE_TAC [MESON[] `(?X bet. (p ==> q X bet)) <=> p ==> (?X bet. q X bet)`]; + DISCH_TAC; + TYPED_ABBREV_TAC (`bet = azim (vec 0) v (g i) (g (i+1))/ &2 `); + EXISTS_TAC `bet:real`; + REWRITE_TAC[]; + MATCH_MP_TAC ( gotcjah_sol_lemma); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `c3`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `b`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `P`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `h i`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `b / (v dot v)`))); + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[arith `&0 < &1`]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `g (i+1) IN P INTER A /\ cos (arcV (vec 0) v (g (i+1))) = t` ) ASSUME_TAC)); + ASM_CASES_TAC `i=(n:num)`; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY((ASM_REWRITE_TAC[])); + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM MP_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `1..n` MP_TAC); + BY((MESON_TAC[])); + ASM_REWRITE_TAC[]; + ASM_CASES_TAC `i = (n:num)`; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY((ASM_REWRITE_TAC[])); + FIRST_X_ASSUM MATCH_MP_TAC; + FIRST_X_ASSUM MP_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `1..n` MP_TAC); + BY((MESON_TAC[])); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[SKOLEM_THM]; + REPEAT WEAK_STRIP_TAC; + COMMENT "Have bet and X"; + ONCE_REWRITE_TAC[arith `&2 * pi - &2 * u <= s <=> (pi - u) <= s/ &2`]; + MATCH_MP_TAC REAL_LE_TRANS; + EXISTS_TAC `sum (1..n) (\i. bet i - asn (sin (bet i) * t))`; + ONCE_REWRITE_TAC [arith `t * sin u = sin u * t`]; + CONJ_TAC; + MATCH_MP_TAC convex_sum_corollary; + ASM_SIMP_TAC [arith `1 < n ==> 0 < n`]; + MATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`); + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN (`bet i = azim (vec 0) v (g i ) (g (i+1)) / &2`) SUBST1_TAC; + BY((ASM_SIMP_TAC[])); + GMATCH_SIMP_TAC(arith `&0 <= x ==> &0 <= x/ &2`); + GMATCH_SIMP_TAC(arith `x < &2 * pi ==> x / &2 <= pi`); + BY((REWRITE_TAC[ Local_lemmas.AZIM_RANGE ])); + SUBGOAL_THEN `sum (1..n) bet = sum (1..n) (\i. (&1/ &2) * azim (vec 0) v (g i) (g (i+1)))` SUBST1_TAC; + MATCH_MP_TAC SUM_EQ; + REPEAT WEAK_STRIP_TAC; + BETA_TAC; + ONCE_REWRITE_TAC[arith ` (&1/ &2) * u = u / &2`]; + BY((ASM_SIMP_TAC[])); + REWRITE_TAC[ SUM_LMUL ]; + REWRITE_TAC[arith `(&1 / &2) * t = pi <=> t = &2 * pi`]; + MATCH_MP_TAC ORDER_AZIM_SUM2Pi; + EXISTS_TAC `u:real^3`; + BY((ASM_REWRITE_TAC[])); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`!i j. (i IN 1..n) /\ (j IN 1..n) /\ ~(i = j) ==> DISJOINT (X i) (X j)`) ASSUME_TAC)); + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[DISJOINT]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(?a1 a2. X i SUBSET a1 /\ X j SUBSET a2 /\ ( a1 INTER a2 = {})) ==> (X i INTER X j = {})`) MATCH_MP_TAC)); + BY((SET_TAC[])); + EXISTS_TAC `wedge (vec 0) v (g i) (g (i+1))`; + EXISTS_TAC `wedge (vec 0) v (g j) (g (j+1))`; + CONJ_TAC; + BY((ASM_MESON_TAC[SUBSET_INTER])); + CONJ_TAC; + BY((ASM_MESON_TAC[SUBSET_INTER])); + GMATCH_SIMP_TAC WEDGE_ORDER_DISJOINT; + EXISTS_TAC `u:real^3`; + EXISTS_TAC `n:num`; + BY((ASM_REWRITE_TAC[])); + COMMENT "1a"; + ONCE_REWRITE_TAC[arith `x <= u/ &2 <=> &2 * x <= u`; ]; + SUBGOAL_THEN `sol ((vec 0):real^3) (UNIONS (IMAGE X (1..n))) = sum ((IMAGE X (1..n))) (\s. sol (vec 0) s)` ASSUME_TAC; + MATCH_MP_TAC Conforming.SOL_UNIONS; + EXISTS_TAC `&1`; + REWRITE_TAC[ arith `&1 > &0`; IN_IMAGE ]; + CONJ_TAC; + MATCH_MP_TAC FINITE_IMAGE; + BY((REWRITE_TAC[ FINITE_NUMSEG ])); + CONJ_TAC; + GEN_TAC; + BY((ASM_MESON_TAC[])); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY((ASM_MESON_TAC[])); + FIRST_X_ASSUM MP_TAC; + GMATCH_SIMP_TAC SUM_IMAGE_NONZERO; + CONJ_TAC; + REWRITE_TAC[ FINITE_NUMSEG]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `X x = {}`))); + DISCH_THEN SUBST1_TAC; + BY((REWRITE_TAC[ Conforming.SOL_EMPTY ])); + REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[ DISJOINT; Local_lemmas.EMPTY_NOT_EXISTS_IN; IN_INTER ]; + BY((MESON_TAC[])); + COMMENT "1b"; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(\s. sol (vec 0) s) o X = (\i. sol (vec 0) (X i))`) SUBST1_TAC)); + ONCE_REWRITE_TAC[FUN_EQ_THM]; + BETA_TAC; + BY((REWRITE_TAC[o_THM])); + DISCH_TAC; + MATCH_MP_TAC REAL_LE_TRANS; + EXISTS_TAC (`sol ((vec 0):real^3) (UNIONS (IMAGE X (1..n)))`); + CONJ_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `x = y ==> x<= y`); + ONCE_REWRITE_TAC[ GSYM SUM_LMUL ]; + MATCH_MP_TAC SUM_EQ; + REPEAT WEAK_STRIP_TAC; + BETA_TAC; + BY((ASM_MESON_TAC[])); + (COMMENT "1c"); + MATCH_MP_TAC SOL_SUBSET; + EXISTS_TAC `&1`; + CONJ_TAC; + BY(REAL_ARITH_TAC); + CONJ_TAC; + REWRITE_TAC[ Conforming.UNIONS_INTER ]; + MATCH_MP_TAC MEASURABLE_UNIONS; + CONJ_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `{s INTER normball (vec 0) (&1) | s IN IMAGE X (1..n)} = IMAGE (\k. X k INTER normball (vec 0) (&1)) (1..n)`) SUBST1_TAC)); + ONCE_REWRITE_TAC[ FUN_EQ_THM]; + REWRITE_TAC[ IN; IMAGE ;IN_ELIM_THM]; + BY(MESON_TAC[ ]); + MATCH_MP_TAC FINITE_IMAGE; + BY(REWRITE_TAC[ FINITE_NUMSEG]); + REWRITE_TAC[IN_ELIM_THM]; + REWRITE_TAC[ IN_IMAGE ]; + FIRST_X_ASSUM_ST `azim` MP_TAC; + BY(MESON_TAC[]); + CONJ_TAC; + EXPAND_TAC "WF'"; + MATCH_MP_TAC FCHANGED_MEASURABLE; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + REWRITE_TAC[ UNIONS_SUBSET ]; + REWRITE_TAC[ IN_IMAGE ]; + FIRST_X_ASSUM_ST `azim` MP_TAC; + BY(MESON_TAC[ SUBSET_INTER ]); + CONJ_TAC; + REWRITE_TAC[ Conforming.UNIONS_INTER ]; + MATCH_MP_TAC Conforming.RADIAL_UNIONS; + CONJ_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `{s INTER normball (vec 0) (&1) | s IN IMAGE X (1..n)} = IMAGE (\k. X k INTER normball (vec 0) (&1)) (1..n)`) SUBST1_TAC)); + ONCE_REWRITE_TAC[ FUN_EQ_THM]; + REWRITE_TAC[ IN; IMAGE ;IN_ELIM_THM]; + BY(MESON_TAC[ ]); + MATCH_MP_TAC FINITE_IMAGE; + BY(REWRITE_TAC[ FINITE_NUMSEG]); + REWRITE_TAC[IN_ELIM_THM]; + REWRITE_TAC[ IN_IMAGE ]; + FIRST_X_ASSUM_ST `azim` MP_TAC; + BY(MESON_TAC[]); + EXPAND_TAC "WF'"; + REWRITE_TAC[ GSYM Marchal_cells_2_new.RADIAL_VS_RADIAL_NORM ]; + MATCH_MP_TAC FCHANGED_RADIAL; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +(* Lemmas related to last two theorems in "Counting Spheres" *) + + + +let rcone_def_alt = prove_by_refinement( + `!(v:real^A) t p. p IN rcone_gt (vec 0) v t <=> norm p * norm v * t < p dot v`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.rcone_gt;Sphere.rconesgn;varith `(x:real^A) - vec 0 = x`;IN;IN_ELIM_THM; DIST_0 ]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let rcone_refl = prove_by_refinement( + `!(v:real^A) t. t < &1 /\ ~(v = vec 0) ==> v IN rcone_gt (vec 0) v t`, + (* {{{ proof *) + [ + REWRITE_TAC[rcone_def_alt]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[ DOT_SQUARE_NORM ]; + REWRITE_TAC[ arith `x * x * t < x pow 2 <=> &0 < (&1 - t ) * (x * x)`]; + (MATCH_MP_TAC REAL_LT_MUL ); + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LT_MUL); + BY(ASM_REWRITE_TAC [ NORM_POS_LT ]) + ]);; + (* }}} *) + +let rcone_nz = prove_by_refinement( + `!(v:real^A) p t. (&0 < t ) /\ (p IN rcone_gt (vec 0) v t) ==> ~(p = vec 0) /\ ~(v = vec 0)`, + (* {{{ proof *) + [ + REWRITE_TAC[ rcone_def_alt ]; + REPEAT WEAK_STRIP_TAC; + BY(CONJ_TAC THEN DISCH_TAC THEN (FIRST_X_ASSUM_ST `norm` MP_TAC) THEN ASM_REWRITE_TAC[ NORM_0 ; DOT_LZERO ; DOT_RZERO ; ] THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let rcone_dot_pos = prove_by_refinement( + `!(v:real^A) t p. &0 < t /\ + p IN rcone_gt (vec 0) v t ==> &0 < p dot v`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w` ~(p = vec 0) /\ ~(v = vec 0)`) ASSUME_TAC)); + BY(ASM_MESON_TAC[rcone_nz]); + FIRST_X_ASSUM_ST `rcone_gt` MP_TAC; + REWRITE_TAC[rcone_def_alt]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC REAL_LT_TRANS; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `norm p * norm v * t`))); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_LT_MUL; + CONJ_TAC; + BY(ASM_REWRITE_TAC[ NORM_POS_LT ]); + MATCH_MP_TAC REAL_LT_MUL; + BY(ASM_REWRITE_TAC [ NORM_POS_LT ]) + ]);; + (* }}} *) + +let rcone_hyperplane = prove_by_refinement( + `!(v:real^A) t b q p. + (&0 < t /\ t < &1) /\ + (p IN rcone_gt (vec 0) v t) /\ + ( ( b / (p dot v)) % p = q) ==> + (q dot v = b)`, + (* {{{ proof *) + [ + REWRITE_TAC[ rcone_def_alt]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`&0 < (p dot v)`) ASSUME_TAC)); + MATCH_MP_TAC rcone_dot_pos; + BY(ASM_MESON_TAC[ rcone_def_alt ]); + EXPAND_TAC "q"; + REWRITE_TAC[ DOT_LMUL ]; + Calc_derivative.CALC_ID_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let rcone_gt_arcV = prove_by_refinement( + `!(v:real^3) g p. + (&0 < g) /\ (g < pi / &2) /\ + p IN rcone_gt (vec 0) v (cos g) ==> + arcV (vec 0) p v < g `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w` ~(p = vec 0) /\ ~(v = vec 0)`) ASSUME_TAC)); + MATCH_MP_TAC rcone_nz; + BY(ASM_MESON_TAC[COS_POS_PI2]); + GMATCH_SIMP_TAC (GSYM COS_MONO_LT_EQ); + REWRITE_TAC[ Local_lemmas1.ARCV_BOUNDS ]; + ASSUME_TAC PI_POS; + ASM_SIMP_TAC [arith `&0 < pi /\ g < pi / &2 ==> g <= pi`;arith `&0 < g ==> &0 <= g`]; + FIRST_X_ASSUM_ST `IN` MP_TAC; + REWRITE_TAC[ rcone_def_alt]; + REWRITE_TAC[ Trigonometry1.DOT_COS ]; + GMATCH_SIMP_TAC REAL_LT_LMUL_EQ; + ASM_SIMP_TAC[ NORM_POS_LT ]; + GMATCH_SIMP_TAC REAL_LT_LMUL_EQ; + BY(ASM_SIMP_TAC[ NORM_POS_LT ]) + ]);; + (* }}} *) + +let cos_bounds_0_Pi2 = prove_by_refinement( + `!x. &0 < x /\ x < pi / &2 ==> + &0 < cos x /\ cos x < &1`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + CONJ_TAC; + BY(ASM_SIMP_TAC[ Trigonometry.CFXEKKP2 ]); + SUBGOAL_THEN `cos x <= &1` MP_TAC; + BY(MESON_TAC[ COS_BOUNDS ]); + DISCH_TAC; + GMATCH_SIMP_TAC ( arith `u <= &1 /\ ~( u = &1) ==> (u < &1 )`); + ASM_REWRITE_TAC[]; + DISCH_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[ COS_ONE_2PI ]; + REWRITE_TAC[ NOT_EXISTS_THM; DE_MORGAN_THM ]; + CONJ_TAC; + STRIP_TAC; + DISJ_CASES_TAC (ARITH_RULE `n = 0 \/ 1 <= n`); + ASM_REWRITE_TAC[]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[ GSYM REAL_OF_NUM_LE ]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `pi / &2` MP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[ arith `~(&n * &2 * pi < pi/ &2) <=> (&0 <= pi * (&n * &2 - &1 / &2))` ]; + MATCH_MP_TAC Real_ext.REAL_PROP_NN_MUL2; + CONJ_TAC; + BY(MP_TAC PI_POS THEN REAL_ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + STRIP_TAC; + MATCH_MP_TAC (arith `(&0 < x /\ &0 <= u ==> ~(x = -- u))`); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC Real_ext.REAL_PROP_NN_MUL2; + GMATCH_SIMP_TAC Real_ext.REAL_PROP_NN_MUL2; + MP_TAC PI_POS; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let rcone_gt_arc_triangle = prove_by_refinement( + `!(p:real^3) v w gv gw. + ~(w = vec 0) /\ + (&0 < gv) /\ (gv < pi / &2) /\ + p IN rcone_gt (vec 0) v (cos gv) /\ + gv + gw <= arcV (vec 0) v w ==> + gw < arcV (vec 0) p w`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `&0 < cos gv /\ cos gv < &1` ASSUME_TAC; + BY(ASM_SIMP_TAC[ cos_bounds_0_Pi2 ]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`~(p = vec 0) /\ ~(v = vec 0)`) ASSUME_TAC)); + BY(ASM_MESON_TAC[rcone_nz]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`arcV (vec 0) v w <= arcV (vec 0) v p + arcV (vec 0) p w`) ASSUME_TAC)); + MATCH_MP_TAC Trigonometry2.ARCV_INEQUALTY; + BY(ASM_REWRITE_TAC[]); + GOAL_TERM (fun w -> (MP_TAC (ISPECL ( envl w [`v`;`gv`;`p`]) rcone_gt_arcV))); + ASM_REWRITE_TAC[]; + DISCH_TAC; + FIRST_X_ASSUM (fun t -> MP_TAC (ONCE_REWRITE_RULE[ Trigonometry2.ARC_SYM ] t)); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let rcone_gt_facet = prove_by_refinement( + `!gv gw v w q (p:real^3). + (&0 < gv /\ gv < pi / &2) /\ + (&0 < gw /\ gw < pi / &2) /\ + ~(w = vec 0) /\ + (p IN rcone_gt (vec 0) v (cos (gv))) /\ + (q = (((norm v) * cos (gv)) / (p dot v)) % p) /\ + (gv + gw <= arcV (vec 0) v w) ==> + (q dot w < norm w * cos gw)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `&0 < cos gv /\ cos gv < &1 /\ &0 < cos gw /\ cos gw < &1` ASSUME_TAC; + BY((ASM_SIMP_TAC[ cos_bounds_0_Pi2 ])); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`~(p = vec 0) /\ ~(v = vec 0)`) ASSUME_TAC)); + BY((ASM_MESON_TAC[rcone_nz])); + SUBGOAL_THEN `&0 < p dot (v:real^3)` ASSUME_TAC; + GMATCH_SIMP_TAC rcone_dot_pos; + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[]; + REWRITE_TAC[ DOT_LMUL ]; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `(p dot v) * ((norm v * cos gv) / (p dot v) * (p dot w)) < (p dot v) * norm w * cos gw`))); + BY(ASM_MESON_TAC[ REAL_LT_LMUL_EQ ]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(p dot v) * (norm v * cos gv) / (p dot v) * (p dot w) = (norm v * cos gv) * (p dot w)`) (fun t -> ONCE_REWRITE_TAC[t]))); + Calc_derivative.CALC_ID_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `&0 < norm w /\ &0 < norm p /\ &0 < norm v`) ASSUME_TAC)); + BY(ASM_SIMP_TAC[ NORM_POS_LT ]); + ASM_SIMP_TAC [ Trigonometry1.DOT_COS ]; + ONCE_REWRITE_TAC [arith `(a * b) * c * d *e < (c * a * f ) * d * g <=> (a * c * d) * b * e < (a*c*d)* (f *g)`]; + GMATCH_SIMP_TAC REAL_LT_LMUL_EQ; + CONJ_TAC; + GMATCH_SIMP_TAC REAL_LT_MUL; + ASM_SIMP_TAC[]; + GMATCH_SIMP_TAC REAL_LT_MUL; + BY(ASM_SIMP_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`&0 < cos (arcV (vec 0) p v)`) ASSUME_TAC)); + FIRST_X_ASSUM_ST `dot` MP_TAC; + REWRITE_TAC[ Trigonometry1.DOT_COS ]; + BY(ASM_SIMP_TAC[ REAL_LT_MUL_EQ ]); + GOAL_TERM (fun w -> (ASM_CASES_TAC ( env w`&0 < cos (arcV (vec 0) p w)`))); + MATCH_MP_TAC REAL_LT_TRANS; + GOAL_TERM (fun w -> ((EXISTS_TAC ( env w`cos (arcV (vec 0) p v) * cos (arcV (vec 0) p w)`)))); + CONJ_TAC; + ONCE_REWRITE_TAC[arith `x * y = y * x`]; + GMATCH_SIMP_TAC REAL_LT_LMUL_EQ; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC COS_MONO_LT_EQ; + ASM_SIMP_TAC[ Local_lemmas1.ARCV_BOUNDS ]; + CONJ_TAC; + MP_TAC PI_POS; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + MATCH_MP_TAC rcone_gt_arcV; + BY(ASM_SIMP_TAC[]); + GMATCH_SIMP_TAC REAL_LT_LMUL_EQ; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC COS_MONO_LT_EQ; + ASM_SIMP_TAC[ Local_lemmas1.ARCV_BOUNDS ]; + CONJ_TAC; + MP_TAC PI_POS; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + MATCH_MP_TAC rcone_gt_arc_triangle; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC REAL_LET_TRANS; + EXISTS_TAC `&0`; + CONJ_TAC; + REWRITE_TAC[ arith `x * y <= &0 <=> &0 <= x * --y`]; + MATCH_MP_TAC Real_ext.REAL_PROP_NN_MUL2; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + MATCH_MP_TAC REAL_LT_MUL; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + + +let edges_of_facet_of = prove_by_refinement( + `!(P:real^3->bool) f. + polyhedron P /\ bounded P /\ (vec 0 IN interior P) ==> + (f edge_of P <=> (?c. f facet_of c /\ c facet_of P))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[edge_of]; + REWRITE_TAC [ Geomdetail.EQ_EXPAND ]; + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC FACE_OF_POLYHEDRON_SUBSET_FACET [`P`;`f`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + REWRITE_TAC[ GSYM AFF_DIM_POS_LE ]; + CONJ_TAC; + ASM_REWRITE_TAC[]; + BY(INT_ARITH_TAC); + DISCH_TAC; + INTRO_TAC Polyhedron.AFF_DIM_INTERIOR_EQ_3 [`(vec 0):real^3`;`P`]; + ASM_REWRITE_TAC[]; + EXPAND_TAC "P"; + ASM_REWRITE_TAC[]; + BY(INT_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `f'`))); + ASM_REWRITE_TAC[ ]; + REWRITE_TAC[ facet_of ]; + ASM_REWRITE_TAC[]; + CONJ_TAC; + GMATCH_SIMP_TAC FACE_OF_FACE; + BY(ASM_MESON_TAC[ facet_of ]); + CONJ_TAC; + REWRITE_TAC[ GSYM AFF_DIM_POS_LE ]; + ASM_REWRITE_TAC[]; + BY(INT_ARITH_TAC); + GMATCH_SIMP_TAC FACET_AFF_DIM_2; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + BY(INT_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC [ FACE_OF_TRANS ; facet_of ]); + INTRO_TAC FACET_AFF_DIM_2 [`P`;`c`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM kill; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[ facet_of ]; + DISCH_THEN (fun t-> REWRITE_TAC[t]); + DISCH_THEN (fun t-> REWRITE_TAC[t]); + BY(INT_ARITH_TAC) + ]);; + (* }}} *) + +let BIJ_SYM = prove_by_refinement( + `!(a:A->bool) (b:B->bool). + (?f. BIJ f a b) ==> (?g. BIJ g b a)`, + (* {{{ proof *) + [ + BY(MESON_TAC[ Misc_defs_and_lemmas.INVERSE_BIJ ]) + ]);; + (* }}} *) + +let BIJ_TRANS = prove_by_refinement( + `! (B:B->bool) (A:A->bool) (C:C->bool) . + (?pab. BIJ pab A B) /\ (?pbc. BIJ pbc B C) ==> (?pab. BIJ pab A C)`, + (* {{{ proof *) + [ + MESON_TAC[ Hypermap.COMPOSE_BIJ ] + ]);; + (* }}} *) + +let SND_BIJ = prove_by_refinement( + `!(a:A) B:(B->bool). BIJ SND { (x,y) | x = a /\ B y } B`, + (* {{{ proof *) + [ + REWRITE_TAC[BIJ;INJ;SURJ;IN_ELIM_THM;IN]; + BY(MESON_TAC[FST;SND]) + ]);; + (* }}} *) + +let FST_BIJ = prove_by_refinement( + `!(A:A->bool) b:B. BIJ FST { (x,y) | A x /\ ( y = b) } A`, + (* {{{ proof *) + [ + REWRITE_TAC[BIJ;INJ;SURJ;IN_ELIM_THM;IN]; + BY(MESON_TAC[FST;SND]) + ]);; + (* }}} *) + +let PREIMAGE_BIJ = prove_by_refinement( + `!(A:A->bool) (B:B->bool) (C:C->bool) f g. + (!a. (a IN A) ==> (f a IN C) ) /\ + (!b. (b IN B) ==> (g b IN C)) /\ + (!c. (c IN C) ==> ?p. BIJ p (preimage A f {c}) (preimage B g {c})) ==> + (?q. BIJ q A B)`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + DISCH_THEN (fun t -> MP_TAC(ONCE_REWRITE_RULE[ RIGHT_IMP_EXISTS_THM ] t)); + ONCE_REWRITE_TAC[SKOLEM_THM]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `\a. p (f a) a`))); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[BIJ;INJ;SURJ; Misc_defs_and_lemmas.in_preimage ;IN_SING]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let BIJ_FACET_HYPERFACE = prove_by_refinement( + `!(p:real^3->bool). + polyhedron p /\ bounded p /\ (vec 0 IN interior p) ==> + (?b. BIJ b {f | f facet_of p} (face_set(hypermap1_of_fanx (vec 0,vertices p,edges p)))) + `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC (INST_TYPE [`:(real^3->bool)`,`:B`] BIJ_TRANS); + EXISTS_TAC (`(topological_component_yfan (vec 0,vertices p,edges p))`); + SUBGOAL_THEN `{(f:real^3 -> bool) | f facet_of p } = \f. f facet_of p` MP_TAC; + ONCE_REWRITE_TAC[FUN_EQ_THM]; + BETA_TAC; + BY(REWRITE_TAC[IN;IN_ELIM_THM]); + DISCH_THEN SUBST1_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[ Polyhedron.AMHFNXP_BIJ]); + BY(ASM_MESON_TAC[ Cfyxfty.WBLARHH_BIJ; BIJ_SYM; ]) + ]);; + (* }}} *) + +let POLYHEDRON_CONFORMING_FAN = prove_by_refinement( + `!(p:real^3->bool). bounded p /\ polyhedron p /\ vec 0 IN interior p ==> + (conforming_fan ((vec 0), vertices p, edges p))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC Conforming.PIIJBJK; + ASM_SIMP_TAC[ Polyhedron.POLYHEDRON_FAN ]; + ASM_SIMP_TAC[ Polyhedron.POLYTOPE_FAN80 ]; + BY(ASM_SIMP_TAC[ Polyhedron.CARD_SET_OF_EDGE_INEQ_1_POLYHEDRON ]) + ]);; + (* }}} *) + +let POLYHEDRON_D1_D = prove_by_refinement( + `!(p:real^3->bool). bounded p /\ polyhedron p /\ vec 0 IN interior p ==> + d_fan ((vec 0), vertices p,edges p) = d1_fan((vec 0),vertices p,edges p)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC Fan.dartset_fully_surrounded_is_non_isolated_fan; + BY(ASM_MESON_TAC[ Polyhedron.POLYHEDRON_FAN ; Polyhedron.CARD_SET_OF_EDGE_INEQ_1_POLYHEDRON]) + ]);; + (* }}} *) + +let POLYHEDRON_PLAIN = prove_by_refinement( + `!(p:real^3->bool). bounded p /\ polyhedron p /\ vec 0 IN interior p ==> + (plain_hypermap (hypermap1_of_fanx ((vec 0), vertices p, edges p)))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC POLYHEDRON_CONFORMING_FAN [`p`]; + INTRO_TAC Polyhedron.POLYHEDRON_FAN [`p`;`(vec 0):real^3`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Hypermap.plain_hypermap]; + REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[I_DEF;o_DEF]; + GEN_TAC; + TYPED_ABBREV_TAC `r = (\t. res (t ((vec 0):real^3) (vertices p) (edges p)) (d1_fan (((vec 0):real^3),(vertices p), edges p)))`; + INTRO_TAC Fan.hypermap_of_fan_rep [`(vec 0):real^3`;`vertices p`;`edges p`;`r`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC POLYHEDRON_D1_D [`p`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + GOAL_TERM (fun w -> (ASM_CASES_TAC ( env w `x IN d1_fan((vec 0),vertices p,edges p)`))); + INTRO_TAC (GEN_ALL Fan.into_domain_e_fan) [`r`;`(vec 0):real^3`;`vertices p`;`edges p`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `r e_fan x IN d1_fan (vec 0,vertices p,edges p)`) ASSUME_TAC)); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `r e_fan (r e_fan x) = e_fan (vec 0) (vertices p) (edges p) (r e_fan x)`) SUBST1_TAC)); + BY(ASM_MESON_TAC[ Fan.into_domain_efn_fan ]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `r e_fan x = e_fan (vec 0) (vertices p) (edges p) x`) SUBST1_TAC)); + BY(ASM_MESON_TAC[ Fan.into_domain_efn_fan ]); + BY(ASM_MESON_TAC[ Fan.plain_hypermap_fan; ]); + INTRO_TAC (GEN_ALL Fan.id_enf_fan ) [`r`;`(vec 0):real^3`;`vertices p`;`edges p`;`x`]; + BY(ASM_SIMP_TAC[]) + ]);; + (* }}} *) + +let POLYHEDRON_NODE_3 = prove_by_refinement( + `!(p:real^3->bool) x. bounded p /\ polyhedron p /\ vec 0 IN interior p /\ + x IN d_fan (vec 0,vertices p,edges p) ==> + 3 <= CARD (node (hypermap1_of_fanx (vec 0,vertices p,edges p)) x)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC POLYHEDRON_CONFORMING_FAN [`p`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC Polyhedron.POLYHEDRON_FAN [`p`;`(vec 0):real^3`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Polyhedron.BSXAQBQ [`p`]; + ASM_SIMP_TAC[]; + DISCH_TAC; + MATCH_MP_TAC (arith `~(u <= 2) ==> (3 <= u)`); + DISCH_TAC; + INTRO_TAC Conforming.SUM_AZIM_FAN_OF_NODE_EQ_2PI_I_FAN [`(vec 0):real^3`;`vertices p`;`edges p`;`node (hypermap1_of_fanx ((vec 0):real^3,vertices p,edges p)) x`]; + ASM_REWRITE_TAC[]; + (ASM_SIMP_TAC[ Polyhedron.CARD_SET_OF_EDGE_INEQ_1_POLYHEDRON ]); + REWRITE_TAC[ GSYM Hypermap.lemma_in_node_set ]; + TYPED_ABBREV_TAC `r = (\t. res (t ((vec 0):real^3) (vertices p) (edges p)) (d1_fan (((vec 0):real^3),(vertices p), edges p)))`; + INTRO_TAC Fan.hypermap_of_fan_rep [`(vec 0):real^3`;`vertices p`;`edges p`;`r`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `(a < b) ==> ~(a = b)`); + MATCH_MP_TAC REAL_LTE_TRANS; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `sum (node (hypermap1_of_fanx (vec 0,vertices p,edges p)) x) (\y. pi)`))); + CONJ_TAC; + MATCH_MP_TAC SUM_LT_ALL; + BETA_TAC; + CONJ_TAC; + BY(REWRITE_TAC[ Hypermap.NODE_FINITE ]); + CONJ_TAC; + REWRITE_TAC[ Misc_defs_and_lemmas.EMPTY_EXISTS ]; + BY(MESON_TAC[ Hypermap.node_refl ]); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_MESON_TAC[ Hypermap.lemma_node_subset ; SUBSET; IN ]); + GMATCH_SIMP_TAC SUM_CONST; + REWRITE_TAC[ Hypermap.NODE_FINITE ]; + GMATCH_SIMP_TAC REAL_LE_RMUL_EQ; + REWRITE_TAC[PI_POS]; + BY(ASM_MESON_TAC[ REAL_OF_NUM_LE ]) + ]);; + (* }}} *) + +let POLYHEDRON_TGJISOK = prove_by_refinement( + `!(p:real^3->bool) H. bounded p /\ polyhedron p /\ vec 0 IN interior p /\ + (H= hypermap1_of_fanx ((vec 0), vertices p, edges p)) ==> + CARD (dart (H)) <= 6 * number_of_faces H - 12`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC Hypermap.lemmaTGJISOK; + INTRO_TAC POLYHEDRON_CONFORMING_FAN [`p`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC Polyhedron.POLYHEDRON_FAN [`p`;`(vec 0):real^3`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + SUBCONJ_TAC; + MATCH_MP_TAC Conforming.WGVWSKE; + BY(ASM_REWRITE_TAC[ ]); + DISCH_TAC; + SUBCONJ_TAC; + MATCH_MP_TAC POLYHEDRON_PLAIN; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + SUBCONJ_TAC; + BY(ASM_SIMP_TAC[ Conforming.GGRLKHP ]); + DISCH_TAC; + GEN_TAC; + DISCH_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`dart (hypermap1_of_fanx ((vec 0),vertices p,edges p)) = d_fan ((vec 0),vertices p,edges p)`) ASSUME_TAC)); + BY(ASM_MESON_TAC[ Fan.hypermap_of_fan_rep ]); + TYPED_ABBREV_TAC `r = (\t. res (t ((vec 0):real^3) (vertices p) (edges p)) (d1_fan (((vec 0):real^3),(vertices p), edges p)))`; + INTRO_TAC Fan.hypermap_of_fan_rep [`(vec 0):real^3`;`vertices p`;`edges p`;`r`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC POLYHEDRON_D1_D [`p`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `r e_fan x = e_fan (vec 0) (vertices p) (edges p) x`) SUBST1_TAC)); + BY((ASM_MESON_TAC[ Fan.into_domain_efn_fan ])); + DISCH_TAC; + MATCH_MP_TAC (TAUT `a /\ b ==> b/\ a`); + CONJ_TAC; + BY(ASM_MESON_TAC[POLYHEDRON_NODE_3]); + BY(ASM_MESON_TAC[ Fan.e_fan_no_fix_point ]) + ]);; + (* }}} *) + +let EDGE_PAIR_pr23 = prove_by_refinement( + `!x V E d d'. + e_fan x V E d = d' ==> + pr2 d = pr3 d' /\ pr3 d = pr2 d'`, + (* {{{ proof *) + [ + REWRITE_TAC[ Fan.e_fan ]; + REPEAT GEN_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `?x0 v w w1. d = (x0,v,w,w1)`) MP_TAC)); + BY(MESON_TAC[PAIR_SURJECTIVE]); + WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + DISCH_THEN (fun t -> ONCE_REWRITE_TAC[GSYM t ]); + REWRITE_TAC[ Fan.pr2; Fan.pr3]; + ]);; + (* }}} *) + +let EDGE_pr23 = prove_by_refinement( + `!x V E y y1. + FAN (x,V,E) /\ + (!v. v IN V ==> CARD (set_of_edge v V E) > 1) /\ + y IN d1_fan (x,V,E) /\ + y1 IN d1_fan (x,V,E) /\ + {pr2 y,pr3 y} = {pr2 y1,pr3 y1} /\ ~(y = y1) ==> + y = edge_map (hypermap1_of_fanx (x,V,E)) y1`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPED_ABBREV_TAC `r = (\t. res (t (x:real^3) (V:real^3->bool) E ) (d1_fan (x,V,E)))`; + INTRO_TAC Fan.hypermap_of_fan_rep [`x`;`V`;`E`;`r`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC (GEN_ALL Fan.into_domain_efn_fan) [`r`;`x`;`V`;`E`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (fun t -> ASM_SIMP_TAC[t]); + FIRST_X_ASSUM_ST `pr2` MP_TAC; + REWRITE_TAC[ Geomdetail.PAIR_EQ_EXPAND ]; + DISCH_THEN DISJ_CASES_TAC; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM kill; + FIRST_X_ASSUM_ST `~` MP_TAC; + REWRITE_TAC[]; + MATCH_MP_TAC Planarity.EQ_PAIR_IMP_EQ_4_FAN; + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `x`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `V`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `E`))); + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[ Fan.dartset_fully_surrounded_is_non_isolated_fan; PAIR_EQ ]); + INTRO_TAC EDGE_PAIR_pr23 [`x`;`V`;`E`;`y1`;`e_fan x V E y1`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + TYPED_ABBREV_TAC `y2 = e_fan x V E y1`; + MATCH_MP_TAC Planarity.EQ_PAIR_IMP_EQ_4_FAN; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `x`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `V`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `E`))); + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[ Fan.dartset_fully_surrounded_is_non_isolated_fan; Fan.into_domain_e_fan ; Fan.into_domain_efn_fan ]) + ]);; + (* }}} *) + +let SIMPLE_FACE_EDGE_INJ = prove_by_refinement( + `!H (y:A) y1. simple_hypermap H /\ (1 < CARD(node H (face_map H y))) /\ + (y IN dart H) /\ + (y IN face H y1) ==> + ~(y = edge_map H y1)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `(y1:A) = (node_map H o face_map H) y` MP_TAC; + ONCE_REWRITE_TAC[ GSYM Hypermap.inverse_hypermap_maps ]; + ONCE_REWRITE_TAC[ EQ_SYM_EQ ]; + GMATCH_SIMP_TAC PERMUTES_INVERSE_EQ; + ASM_REWRITE_TAC[]; + BY(MESON_TAC [Hypermap.edge_map_and_darts]); + REWRITE_TAC[o_THM]; + TYPED_ABBREV_TAC `(y2:A) = face_map H y`; + DISCH_TAC; + SUBGOAL_THEN `y2 = node_map H (y2:A)` ASSUME_TAC; + MATCH_MP_TAC Hypermap_and_fan.SIMPLE_HYPERMAP_IMP_FACE_INJ; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `H`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `y2`))); + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC[ Hypermap.lemma_dart_invariant ]); + CONJ_TAC; + BY(REWRITE_TAC[ Hypermap.node_refl ]); + CONJ_TAC; + BY(ASM_MESON_TAC [Hypermap.lemma_in_node2; Hypermap.POWER_1]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `face H y2 = face H y`) SUBST1_TAC)); + ONCE_REWRITE_TAC[ EQ_SYM_EQ ]; + MATCH_MP_TAC Hypermap.lemma_face_identity; + BY(ASM_MESON_TAC[ Hypermap.lemma_in_face ; Hypermap.POWER_1 ]); + ONCE_REWRITE_TAC[ EQ_SYM_EQ ]; + MATCH_MP_TAC Hypermap.lemma_face_identity; + BY(ASM_MESON_TAC[]); + SUBGOAL_THEN `node H (y2:A) = {y2 }` ASSUME_TAC; + REWRITE_TAC[ Hypermap.node ]; + GMATCH_SIMP_TAC Hypermap.orbit_cyclic; + EXISTS_TAC `1`; + REWRITE_TAC[arith `~(1=0)`;Hypermap.POWER_1]; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + ONCE_REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[REWRITE_RULE[IN] IN_SING;IN_ELIM_THM]; + REWRITE_TAC[ arith `k < 1 <=> k=0`]; + BY(MESON_TAC[ Hypermap.POWER_0 ; I_DEF]); + FIRST_X_ASSUM_ST `CARD` MP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[ Hypermap.CARD_SINGLETON ]; + BY(ARITH_TAC) + ]);; + (* }}} *) + +let INJ_EDGES_FACE_pr23 = prove_by_refinement( + `!p:real^3->bool f y1 y. + bounded p /\ polyhedron p /\ vec 0 IN interior p /\ + f IN face_set (hypermap1_of_fanx (vec 0,vertices p,edges p)) /\ + y IN f /\ + y1 IN f /\ + { pr2 y,pr3 y} = {pr2 y1,pr3 y1} ==> + (y = y1) + `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + PROOF_BY_CONTR_TAC; + INTRO_TAC POLYHEDRON_CONFORMING_FAN [`p`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC Polyhedron.POLYHEDRON_FAN [`p`;`(vec 0):real^3`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `~(y = edge_map (hypermap1_of_fanx (vec 0,vertices p,edges p)) y1)`) ASSUME_TAC)); + MATCH_MP_TAC SIMPLE_FACE_EDGE_INJ; + CONJ_TAC; + BY(ASM_MESON_TAC[ Conforming.SRPRNPL ]); + CONJ_TAC; + MATCH_MP_TAC (arith `3 <= x ==> 1 < x`); + MATCH_MP_TAC POLYHEDRON_NODE_3; + ASM_REWRITE_TAC[]; + TYPED_ABBREV_TAC `H = hypermap1_of_fanx (vec 0,vertices p,edges p)`; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`d_fan (vec 0,vertices p,edges p)= dart H `) ASSUME_TAC)); + BY(ASM_MESON_TAC [Fan.hypermap_of_fan_rep]); + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `y IN dart H`) ASSUME_TAC)); + BY(ASM_MESON_TAC[ Hypermap.lemma_face_representation; Hypermap.lemma_face_subset; SUBSET]); + BY(ASM_SIMP_TAC[ Hypermap.lemma_dart_invariant ]); + CONJ_TAC; + BY(ASM_MESON_TAC[ Hypermap.lemma_face_representation; Hypermap.lemma_face_subset; SUBSET]); + FIRST_X_ASSUM (fun t -> MP_TAC (MATCH_MP Hypermap.lemma_face_representation t)); + REPEAT WEAK_STRIP_TAC; + BY(ASM_MESON_TAC[ Hypermap.face_refl; Hypermap.lemma_face_identity]); + COMMENT "1"; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[]; + MATCH_MP_TAC EDGE_pr23; + ASM_REWRITE_TAC[]; + TYPED_ABBREV_TAC `H = hypermap1_of_fanx (vec 0,vertices p,edges p)`; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`d_fan (vec 0,vertices p,edges p)= dart H `) ASSUME_TAC)); + BY(ASM_MESON_TAC [Fan.hypermap_of_fan_rep]); + INTRO_TAC POLYHEDRON_D1_D[`p`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `y IN dart H /\ y1 IN dart H`) ASSUME_TAC)); + BY(ASM_MESON_TAC[ Hypermap.lemma_face_representation; Hypermap.lemma_face_subset; SUBSET]); + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_SIMP_TAC[ Polyhedron.CARD_SET_OF_EDGE_INEQ_1_POLYHEDRON ]); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let BIJ_EDGES_DART_FACE = prove_by_refinement( + `!p:real^3->bool f f1. + bounded (p:real^3->bool) /\ polyhedron p /\ vec 0 IN interior p + /\ f IN face_set (hypermap1_of_fanx (vec 0,vertices p,edges p)) + /\ f1 facet_of p /\ + fchanged f1 =dartset_leads_into_fan (vec 0) (vertices p) (edges p) f + ==> + (?b. BIJ b (edges f1) f)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `edges f1 = {{pr2 e,pr3 e} | e IN f}`) SUBST1_TAC)); + ASM_SIMP_TAC[GSYM Cfyxfty.CFYXFTY0]; + BY(ASM_SIMP_TAC[GSYM Cfyxfty.CFYXFTY1]); + MATCH_MP_TAC BIJ_SYM; + EXISTS_TAC (`(\e. {pr2 e, pr3 e}):real^3#real^3#real^3#real^3->real^3->bool`); + REWRITE_TAC[BIJ;SURJ]; + MATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`); + SUBCONJ_TAC; + REWRITE_TAC[IN;IN_ELIM_THM]; + BY(MESON_TAC[]); + DISCH_TAC; + REWRITE_TAC[INJ]; + (ASM_REWRITE_TAC[]); + BY(ASM_MESON_TAC[ INJ_EDGES_FACE_pr23]) + ]);; + (* }}} *) + +let SEGMENT_EDGE_ONTO = prove_by_refinement( + `!(p:real^3->bool) e. + polyhedron p /\ bounded p /\ + e edge_of p ==> + (?v w. e = segment [v,w])`, + (* {{{ proof *) + [ + BY(ASM_MESON_TAC[ Polyhedron.EXPAND_EDGE_POLYTOPE; edge_of; POLYTOPE_EQ_BOUNDED_POLYHEDRON]) + ]);; + (* }}} *) + +let EDGE_OF_FACET_OF = prove_by_refinement( + `!(p:real^3->bool) c f. + polyhedron p /\ bounded p /\ (vec 0 IN interior p) /\ c facet_of p ==> + ((e edge_of c) <=> (e facet_of c))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[edge_of;facet_of]; + MATCH_MP_TAC (TAUT `(a ==> (b <=>c)) ==> ((a /\ b) <=> (a /\ c))`); + DISCH_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`aff_dim c = &2`) ASSUME_TAC)); + BY(ASM_MESON_TAC[ FACET_AFF_DIM_2 ]); + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `int_of_num 2 - &1 = &1` SUBST1_TAC; + BY(INT_ARITH_TAC); + MATCH_MP_TAC (TAUT `(a ==> (c)) ==> ((a) <=> (c /\ a))`); + ONCE_REWRITE_TAC [ GSYM AFF_DIM_POS_LE ]; + BY(INT_ARITH_TAC) + ]);; + (* }}} *) + +let EDGE_OF_FACET_EDGE = prove_by_refinement( + `!(p:real^3->bool) c e. + polyhedron p /\ bounded p /\ (vec 0 IN interior p) /\ c facet_of p /\ e facet_of c ==> + ((e edge_of p)) + `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`e edge_of c`) MP_TAC)); + BY(ASM_MESON_TAC[EDGE_OF_FACET_OF]); + REWRITE_TAC[ edge_of ]; + BY(ASM_MESON_TAC[ FACE_OF_TRANS ; facet_of ]) + ]);; + (* }}} *) + +let BIJ_FACET2_EDGE = prove_by_refinement( + `!(p:real^3 -> bool) c. + polyhedron p /\ bounded p /\ (vec 0 IN interior p) /\ c facet_of p ==> + (?b. BIJ b {e | e IN edges c } {u | u facet_of c} ) + `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + (REWRITE_TAC[edges;IN_ELIM_THM]); + EXISTS_TAC ( `((hull) convex):(real^3->bool)->real^3->bool`); + REWRITE_TAC[BIJ]; + REWRITE_TAC[INJ]; + SUBCONJ_TAC; + REWRITE_TAC[IN_ELIM_THM]; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[ SEGMENT_CONVEX_HULL ; EDGE_OF_FACET_OF ]); + DISCH_TAC; + BY(ASM_MESON_TAC[ SEGMENT_CONVEX_HULL ; SEGMENT_EQ; Collect_geom.PER_SET2 ]); + REWRITE_TAC[SURJ]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC (MESON[] (`(?v w. p v w /\ R {v,w}) ==> (?y. (?v w. p v w /\ y = {v,w}) /\ R y)`)); + INTRO_TAC SEGMENT_EDGE_ONTO [`p`;`x`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + MATCH_MP_TAC EDGE_OF_FACET_EDGE; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[ SEGMENT_CONVEX_HULL ; EDGE_OF_FACET_OF ]) + ]);; + (* }}} *) + +let HYPERFACE_EXISTS = prove_by_refinement( + `!P:real^3->bool U. + bounded (P:real^3->bool) /\ polyhedron P /\ vec 0 IN interior P /\ + topological_component_yfan (vec 0,vertices P,edges P) U ==> + (?!f. f IN (face_set (hypermap1_of_fanx (vec 0,vertices P,edges P))) /\ + (dartset_leads_into_fan (vec 0) (vertices P) (edges P) f = U))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Polyhedron.WBLARHH_BIJ [`P`]; + ASM_REWRITE_TAC[BIJ;INJ;SURJ]; + BY(ASM_MESON_TAC[IN]) + ]);; + (* }}} *) + +let BIJ_DART_POLYEDGE = prove_by_refinement( + `!P:real^3->bool. + bounded (P:real^3->bool) /\ polyhedron P /\ vec 0 IN interior P ==> + (?b. BIJ b (dart(hypermap1_of_fanx (vec 0,vertices P,edges P))) + {(e,f1) | e facet_of f1 /\ f1 facet_of P })`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC (INST_TYPE [`:(real^3)->bool`,`:C`] PREIMAGE_BIJ); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `IMAGE fchanged { f1 | f1 facet_of P }`))); + TYPED_ABBREV_TAC `H = hypermap1_of_fanx (vec 0,vertices P,edges P)`; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `dartset_leads_into_fan (vec 0) (vertices P) (edges P) o (face H)`))); + EXISTS_TAC (`(fchanged o SND): (real^3->bool)#(real^3->bool)->real^3->bool`); + SUBCONJ_TAC; + REWRITE_TAC[IN_IMAGE;o_THM]; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Polyhedron.WBLARHH [`P`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (C INTRO_TAC[`(face H a)`]); + ASM_REWRITE_TAC[ GSYM Hypermap.lemma_in_face_set ]; + REWRITE_TAC[ EXISTS_UNIQUE_THM ]; + REPEAT WEAK_STRIP_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + COMMENT "1"; + SUBCONJ_TAC; + REWRITE_TAC[IN_IMAGE;IN_ELIM_THM;o_THM]; + BY(ASM_MESON_TAC[SND]); + DISCH_TAC; + GEN_TAC; + REWRITE_TAC[IN_IMAGE;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + COMMENT "1"; + GOAL_TERM (fun w -> (MATCH_MP_TAC ( ISPEC ( env w `{e | e facet_of x}`) BIJ_TRANS))); + MATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`); + CONJ_TAC; + MATCH_MP_TAC BIJ_SYM; + EXISTS_TAC `FST:((real^3)->bool)#((real^3)->bool) -> real^3 -> bool`; + REWRITE_TAC[ Misc_defs_and_lemmas.preimage ]; + REWRITE_TAC[o_THM; IN_SING ]; + REWRITE_TAC[BIJ]; + REWRITE_TAC[INJ]; + SUBCONJ_TAC; + REWRITE_TAC[IN_ELIM_THM]; + SUBCONJ_TAC; + X_GENv_TAC "ef"; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[]; + DISCH_TAC; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `f1 = x`))); + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC Polyhedron.FCHANGED_ONE_TO_ONE; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `P`))); + ASM_REWRITE_TAC[]; + REWRITE_TAC[INTER_IDEMPOT]; + REWRITE_TAC[ Misc_defs_and_lemmas.EMPTY_EXISTS]; + MATCH_MP_TAC Polyhedron.EXISTS_POINT_IN_FCHANGED; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[PAIR_EQ]; + REPEAT (FIRST_X_ASSUM_ST `FST` MP_TAC); + REPEAT (FIRST_X_ASSUM_ST `SND` MP_TAC); + ASM_REWRITE_TAC[FST;SND]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC Polyhedron.FCHANGED_ONE_TO_ONE; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `P`))); + ASM_REWRITE_TAC[]; + REWRITE_TAC[ INTER_IDEMPOT; Misc_defs_and_lemmas.EMPTY_EXISTS ]; + MATCH_MP_TAC Polyhedron.EXISTS_POINT_IN_FCHANGED; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + REWRITE_TAC[SURJ]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + BY(ASM_MESON_TAC[FST;SND]); + COMMENT "1g"; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `topological_component_yfan (vec 0,vertices P,edges P) c`) ASSUME_TAC)); + BY(ASM_MESON_TAC[Polyhedron.AMHFNXP_BIJ; BIJ;SURJ;IN]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `?!f. f IN face_set (hypermap1_of_fanx (vec 0,vertices P,edges P)) /\ (dartset_leads_into_fan (vec 0) (vertices P) (edges P) f = c)`) MP_TAC)); + MATCH_MP_TAC HYPERFACE_EXISTS; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[ EXISTS_UNIQUE ]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(preimage (dart H) (dartset_leads_into_fan (vec 0) (vertices P) (edges P) o face H) {c}) = f`) SUBST1_TAC)); + REWRITE_TAC[Misc_defs_and_lemmas.preimage]; + REWRITE_TAC[o_THM;IN_SING]; + ONCE_REWRITE_TAC[FUN_EQ_THM]; + GEN_TAC; + REWRITE_TAC[IN_ELIM_THM]; + REWRITE_TAC[ Geomdetail.EQ_EXPAND ]; + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `face H x' = f`) ASSUME_TAC)); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_MESON_TAC[IN;Hypermap.lemma_in_face_set;Conforming.identity_face_in_face_set]); + BY(ASM_MESON_TAC[IN;Hypermap.face_refl;Hypermap.lemma_in_face_set;Conforming.identity_face_in_face_set]); + BY(ASM_MESON_TAC[IN;Hypermap.face_refl;Hypermap.lemma_in_face_set;Conforming.identity_face_in_face_set]); + COMMENT "1h"; + GOAL_TERM (fun w -> (MATCH_MP_TAC (ISPEC ( env w`{e | e IN edges x}`) BIJ_TRANS))); + CONJ2_TAC; + MATCH_MP_TAC BIJ_FACET2_EDGE; + BY(ASM_MESON_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `{e | e IN edges x} = edges x`) SUBST1_TAC)); + ONCE_REWRITE_TAC[FUN_EQ_THM]; + BY(REWRITE_TAC[IN_ELIM_THM;IN]); + MATCH_MP_TAC BIJ_SYM; + MATCH_MP_TAC BIJ_EDGES_DART_FACE; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let FINITE_EDGE = prove_by_refinement( + `!P:real^A->bool. polyhedron P /\ bounded P ==> + (!f. f facet_of P ==> FINITE { e | e facet_of f}) /\ + FINITE { f | f facet_of P } /\ + FINITE {(f,e) | f facet_of P /\ e facet_of f}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `{e' | e' facet_of f } SUBSET {e' | e' face_of P}`))); + BY(ASM_MESON_TAC[FINITE_SUBSET; FINITE_POLYHEDRON_FACES ]); + REWRITE_TAC[SUBSET;IN_ELIM_THM]; + BY(ASM_MESON_TAC[FACET_OF_IMP_FACE_OF; FACE_OF_TRANS; SUBSET]); + CONJ_TAC; + MATCH_MP_TAC FINITE_POLYTOPE_FACETS; + BY(ASM_MESON_TAC[ POLYTOPE_EQ_BOUNDED_POLYHEDRON ]); + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w ` {(f,e) | f facet_of P /\ e facet_of f} SUBSET { f | f face_of P } CROSS {f | f face_of P}`))); + BY(BY(ASM_MESON_TAC[ FINITE_SUBSET; FINITE_CROSS ; FINITE_POLYHEDRON_FACES ])); + REWRITE_TAC[CROSS;SUBSET]; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + BY(BY(ASM_MESON_TAC[PAIR; FACET_OF_IMP_FACE_OF; FACE_OF_TRANS])) + ]);; + (* }}} *) + +let polyhedron_sum_sum_edge = prove_by_refinement( + `!(P:real^3->bool) . bounded P /\ polyhedron P ==> + sum {f | f facet_of P } (\f. &(CARD {e | e facet_of f })) = + &( CARD {(f,e) | f facet_of P /\ e facet_of f})`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC CARD_EQ_SUM; + ASM_SIMP_TAC[FINITE_EDGE]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `sum {f,e | f facet_of P /\ e facet_of f} (\x. &1) = sum {f,e | f IN {f' | f facet_of P} /\ e IN {e' | e' facet_of f}} (\ (f,e). &1 )`) SUBST1_TAC)); + ONCE_REWRITE_TAC[ GSYM CARD_EQ_SUM ]; + BINOP_TAC; + BY(REWRITE_TAC[IN_ELIM_THM]); + REWRITE_TAC[FUN_EQ_THM]; + BY(REWRITE_TAC[ LAMBDA_PAIR ]); + INTRO_TAC SUM_SUM_PRODUCT [`{f | f facet_of P}`;`\f. {e' | e' facet_of (f:real^3->bool)}`]; + DISCH_THEN (fun t -> MP_TAC (ISPEC (`(\ f e. &1):(real^3->bool)->(real^3->bool)->real`) t)); + ANTS_TAC; + REWRITE_TAC[IN_ELIM_THM]; + ASM_SIMP_TAC[FINITE_EDGE]; + BY(ASM_MESON_TAC[FINITE_EDGE]); + MATCH_MP_TAC (MESON[] (`(x = x') /\ (y = y') ==> ((x = y) ==> (x' = y'))`)); + CONJ_TAC; + MATCH_MP_TAC SUM_EQ; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC CARD_EQ_SUM; + BY(ASM_MESON_TAC[FINITE_EDGE]); + BETA_TAC; + BY(REWRITE_TAC[IN_ELIM_THM]) + ]);; + (* }}} *) + +let polyhedron_edge_sum = prove_by_refinement( + `(!(P:real^3->bool) n. bounded P /\ polyhedron P /\ (vec 0) IN interior P /\ + {f | f facet_of P} HAS_SIZE n /\ (2 <= n) ==> + sum {f | f facet_of P } (\f. &(CARD {e | e facet_of f })) <= &6 * &n - &12)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ASM_SIMP_TAC[polyhedron_sum_sum_edge]; + TYPED_ABBREV_TAC `m = CARD {f,e | f facet_of (P:real^3->bool) /\ e facet_of f}`; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `m <= 6 * n - 12`))); + REWRITE_TAC[arith `&m <= x - &12 <=> &m + &12 <= x`]; + REWRITE_TAC[REAL_OF_NUM_ADD;REAL_OF_NUM_MUL;REAL_OF_NUM_LE]; + FIRST_X_ASSUM_ST `2` MP_TAC; + BY(ARITH_TAC); + TYPED_ABBREV_TAC `H = hypermap1_of_fanx (vec 0,vertices P,edges (P:real^3->bool))`; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `n = number_of_faces H`) SUBST1_TAC)); + REWRITE_TAC[ Hypermap.number_of_faces ]; + FIRST_X_ASSUM_ST `HAS_SIZE` MP_TAC; + REWRITE_TAC[HAS_SIZE]; + REPEAT WEAK_STRIP_TAC; + EXPAND_TAC "n"; + MATCH_MP_TAC Misc_defs_and_lemmas.BIJ_CARD; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[ BIJ_FACET_HYPERFACE]); + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `m = CARD(dart H)`))); + BY(ASM_MESON_TAC[POLYHEDRON_TGJISOK]); + EXPAND_TAC "m"; + MATCH_MP_TAC Misc_defs_and_lemmas.BIJ_CARD; + ASM_SIMP_TAC[FINITE_EDGE]; + GOAL_TERM (fun w -> (MATCH_MP_TAC (ISPEC ( env w`{(e,f) | e facet_of f /\ f facet_of P }`) BIJ_TRANS))); + CONJ_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w`(\x. SND x,FST x): (real^3->bool)#(real^3->bool)->(real^3->bool)#(real^3->bool)`))); + REWRITE_TAC[BIJ;INJ;SURJ;IN_ELIM_THM;FST;SND;PAIR_EQ]; + BY(ASM_MESON_TAC[PAIR;FST;SND]); + MATCH_MP_TAC BIJ_SYM; + EXPAND_TAC "H"; + MATCH_MP_TAC BIJ_DART_POLYEDGE; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + + +let RELATIVE_INTERIOR_POLYHEDRON_EXPLICIT_ALT = prove_by_refinement( + `!(V:A->bool) (P:real^B ->bool) h a b p v0. + FINITE V /\ + (!v. (v IN V ) ==> (h v = { p | a v dot p <= b v })) /\ + P = INTERS (IMAGE h V) /\ + (v0 IN V) /\ a v0 dot p = b v0 /\ + (!w. (w IN V) /\ ~(w = v0) ==> a w dot p < b w) ==> + (p IN relative_interior (P INTER { p | a v0 dot p= b v0}))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[IN_RELATIVE_INTERIOR]; + REWRITE_TAC[IN_INTER;IN_INTERS;IN_IMAGE]; + REWRITE_TAC[IN_ELIM_THM]; + SUBCONJ_TAC; + ASM_REWRITE_TAC[]; + ASM_REWRITE_TAC[IN_INTERS;IN_IMAGE]; + ASM_REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + ASM_SIMP_TAC[]; + REWRITE_TAC[IN_ELIM_THM]; + GOAL_TERM (fun w -> (ASM_CASES_TAC ( env w `x = v0`))); + BY(ASM_REWRITE_TAC[arith `u <= u`]); + MATCH_MP_TAC (arith `x < y ==> x <= y`); + BY(ASM_SIMP_TAC[]); + DISCH_TAC; + COMMENT "1"; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(INTERS (IMAGE h (V DIFF {v0})) INTER {p | a v0 dot p = b v0} SUBSET P INTER {p | a v0 dot p = b v0})`) ASSUME_TAC)); + ASM_REWRITE_TAC[SUBSET;IN_INTER;IN_INTERS;IN_IMAGE;IN_DIFF;IN_SING]; + ASM_REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + ASM_SIMP_TAC[]; + REWRITE_TAC[IN_ELIM_THM]; + GOAL_TERM (fun w -> (ASM_CASES_TAC ( env w `x' = v0`))); + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[arith `u <= u`]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `x IN h x'`) MP_TAC)); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_MESON_TAC[]); + ASM_SIMP_TAC[]; + BY(REWRITE_TAC[IN_ELIM_THM]); + COMMENT "1b"; + TYPED_ABBREV_TAC `ho = \ (v:A). {(p : real^B) | a v dot p < b v}`; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!v. ho v = {p | a v dot p < b v}`) ASSUME_TAC)); + GEN_TAC; + EXPAND_TAC "ho"; + BY(REWRITE_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `p IN INTERS (IMAGE ho (V DIFF {v0}))`) ASSUME_TAC)); + REWRITE_TAC[IN_INTERS;IN_IMAGE;IN_DIFF;IN_SING]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[IN_ELIM_THM]; + BY(ASM_MESON_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `open (INTERS (IMAGE ho (V DIFF {v0})))`) ASSUME_TAC)); + MATCH_MP_TAC OPEN_INTERS; + SUBCONJ_TAC; + MATCH_MP_TAC FINITE_IMAGE; + MATCH_MP_TAC FINITE_DIFF; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + REWRITE_TAC[IN_IMAGE;IN_DIFF;IN_SING]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[ OPEN_HALFSPACE_LT ]); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[ OPEN_CONTAINS_BALL ]; + GOAL_TERM (fun w -> (DISCH_THEN (fun t -> MP_TAC (ISPEC ( env w `p`) t)))); + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + EXISTS_TAC `e:real`; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC SUBSET_TRANS; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `ball(p,e) INTER { p | a v0 dot p = b v0}`))); + CONJ_TAC; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w ` affine hull (INTERS (IMAGE h V) INTER {p | a v0 dot p = b v0}) SUBSET {p | a v0 dot p = b v0}`))); + BY(SET_TAC[]); + MATCH_MP_TAC SUBSET_TRANS; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `affine hull {p | a v0 dot p = b v0}`))); + CONJ_TAC; + MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA; + BY(SET_TAC[]); + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `affine hull {p | a v0 dot p = b v0 } = {p | a v0 dot p = b v0}`))); + BY(SET_TAC[]); + INTRO_TAC AFFINE_HYPERPLANE [`a v0`;`b v0`]; + BY(MESON_TAC[ AFFINE_HULL_EQ ]); + COMMENT "1c"; + MATCH_MP_TAC SUBSET_TRANS; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `INTERS (IMAGE h (V DIFF {v0})) INTER {p | a v0 dot p = b v0}`))); + CONJ2_TAC; + BY(ASM_MESON_TAC[]); + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w`INTERS (IMAGE ho (V DIFF {v0})) SUBSET INTERS (IMAGE h (V DIFF {v0}))`))); + FIRST_X_ASSUM MP_TAC; + BY(SET_TAC[]); + REWRITE_TAC[INTERS_IMAGE;SUBSET;IN_ELIM_THM;IN_DIFF;IN_SING]; + REPEAT WEAK_STRIP_TAC; + ASM_SIMP_TAC[IN_ELIM_THM]; + GOAL_TERM (fun w -> (FIRST_X_ASSUM (fun t -> MP_TAC (ISPEC ( env w `x'`) t)))); + EXPAND_TAC "ho"; + REWRITE_TAC[IN_ELIM_THM]; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let FACET_RELEVANT = prove_by_refinement( + `!(V:A->bool) a b (p:real^B) v0. + FINITE V /\ + (!v. v IN V ==> (&0 < b v)) /\ + (a v0 dot p = b v0) /\ + (v0 IN V) /\ + (!w. w IN V /\ ~(v0 = w) ==> a w dot p < b w) ==> + (?t. b v0 < a v0 dot (t % p) /\ + (!w. w IN V /\ ~(v0 = w) ==> a w dot (t % p) < b w))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPED_ABBREV_TAC `h = (\ (v:A). { q | a v dot (q:real^B) < b v })`; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(open:(real^B->bool)->bool) (INTERS (IMAGE (h:A->(real^B->bool)) ((V:A->bool) DIFF {v0})))`) ASSUME_TAC)); + MATCH_MP_TAC OPEN_INTERS; + SUBCONJ_TAC; + MATCH_MP_TAC FINITE_IMAGE; + MATCH_MP_TAC FINITE_DIFF; + BY(BY(ASM_REWRITE_TAC[])); + DISCH_TAC; + REWRITE_TAC[IN_IMAGE;IN_DIFF;IN_SING]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + EXPAND_TAC "h"; + BY(BY(REWRITE_TAC[ OPEN_HALFSPACE_LT ])); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[ OPEN_CONTAINS_BALL ]; + REWRITE_TAC[IN_IMAGE;IN_DIFF;IN_SING;IN_INTERS;SUBSET]; + GOAL_TERM (fun w -> (DISCH_THEN (fun t -> MP_TAC (ISPEC ( env w `p`) t)))); + ANTS_TAC; + EXPAND_TAC "h"; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[IN_ELIM_THM]; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`~(p = vec 0)`) ASSUME_TAC)); + DISCH_TAC; + FIRST_X_ASSUM_ST `u dot v = c` MP_TAC; + ASM_REWRITE_TAC[ DOT_RZERO ]; + BY(ASM_MESON_TAC[arith `&0 < x ==> ~(&0 = x)`]); + TYPED_ABBREV_TAC `s = &1 + e / (&2 * norm (p:real^B))`; + EXISTS_TAC `s:real`; + COMMENT "1"; + SUBGOAL_THEN `&1 < s` ASSUME_TAC; + EXPAND_TAC "s"; + MATCH_MP_TAC (arith `&0 < x ==> &1 < &1 +x `); + MATCH_MP_TAC REAL_LT_DIV; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (arith `&0 < x ==> &0 < &2 * x`); + BY(ASM_REWRITE_TAC[ NORM_POS_LT ]); + CONJ_TAC; + ASM_REWRITE_TAC[ DOT_RMUL ]; + MATCH_MP_TAC (arith `&1 * x < s * x ==> x < s * x`); + MATCH_MP_TAC REAL_LT_RMUL; + BY(ASM_SIMP_TAC[]); + COMMENT "1b"; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPEC ( env w `s % p`))))); + ANTS_TAC; + REWRITE_TAC[IN_BALL]; + ONCE_REWRITE_TAC[DIST_SYM]; + REWRITE_TAC[dist]; + GOAL_TERM (fun w -> (REWRITE_TAC[varith ( env w `s % p - p = (s - &1) % p`)])); + REWRITE_TAC[ NORM_MUL ]; + ASM_SIMP_TAC[arith `&1 < s ==> abs (s - &1) = (s - &1)`]; + EXPAND_TAC "s"; + REWRITE_TAC[arith `(&1 + x) - &1 = x`]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( ( env w`(e / (&2 * norm p) * norm p = e / &2)`)) SUBST1_TAC)); + Calc_derivative.CALC_ID_TAC; + ASM_REWRITE_TAC[ NORM_EQ_0 ]; + BY(REAL_ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + COMMENT "1c"; + GOAL_TERM (fun w -> (DISCH_THEN (MP_TAC o (ISPEC ( env w `h w`))))); + EXPAND_TAC "h"; + REWRITE_TAC[IN_ELIM_THM]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let FACET_OF_POLYHEDRON_EXPLICIT_ALT = prove_by_refinement( + `!(V:A->bool) (P:real^B->bool) h a b. + FINITE V /\ + (vec 0) IN interior P /\ + (!v. (v IN V ) ==> (h v = { p | a v dot p <= b v })) /\ + (!v. v IN V ==> (&0 < b v)) /\ + INTERS (IMAGE h V) = P /\ + (!v. (v IN V ) ==> ~(a v = (vec 0))) /\ + (!v. (v IN V) ==> (?p. a v dot p = b v /\ (!w. (w IN V) /\ ~(v = w) ==> a w dot p < b w))) ==> + (BIJ (\v. P INTER {p | a v dot p = b v}) V { c | c facet_of P })`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!f. (f IN IMAGE h V) ==> (?q. (q IN V) /\ f = h q)`) MP_TAC)); + REWRITE_TAC[IN_IMAGE]; + BY(MESON_TAC[]); + REWRITE_TAC[ RIGHT_IMP_EXISTS_THM ]; + REWRITE_TAC[SKOLEM_THM]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC FACET_OF_POLYHEDRON_EXPLICIT [`P`;`(IMAGE h V)`;`(\f. a (q f))`;`(\f. b (q f))`]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(FINITE (IMAGE h V))`) ASSUME_TAC)); + MATCH_MP_TAC FINITE_IMAGE; + BY(ASM_REWRITE_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(affine hull P) = (:real^B)`) SUBST1_TAC)); + BY(ASM_MESON_TAC[ AFFINE_HULL_NONEMPTY_INTERIOR; NOT_IN_EMPTY ]); + ASM_REWRITE_TAC[ INTER_UNIV ]; + COMMENT "1"; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(!f'. f' PSUBSET IMAGE h V ==> P PSUBSET INTERS f')`) ASSUME_TAC)); + REWRITE_TAC[PSUBSET]; + REWRITE_TAC[SUBSET_IMAGE]; + REPEAT WEAK_STRIP_TAC; + CONJ_TAC; + ASM_REWRITE_TAC[]; + EXPAND_TAC "P"; + FIRST_X_ASSUM_ST `SUBSET` MP_TAC; + REWRITE_TAC[INTERS;IN_IMAGE;SUBSET]; + REWRITE_TAC[IN_ELIM_THM]; + BY(MESON_TAC[]); + COMMENT "2"; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `?v0. v0 IN V /\ ~(h v0 IN f')`) MP_TAC)); + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `IMAGE` MP_TAC); + REWRITE_TAC[IMAGE]; + ONCE_REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[IN_ELIM_THM]; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[SUBSET;IN]; + BY(MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (FIRST_X_ASSUM (fun t -> MP_TAC (ISPEC ( env w `v0`) t)))); + ASM_REWRITE_TAC[]; + REWRITE_TAC[NOT_EXISTS_THM]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC FACET_RELEVANT [`V`;`a`;`b`;`p`;`v0`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[ NOT_EXISTS_THM ]; + GEN_TAC; + MATCH_MP_TAC (TAUT `(b ==> ~a) ==> ~(a /\ b)`); + DISCH_TAC; + MATCH_MP_TAC (arith `x <= y ==> ~(y < x)`); + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `t % p IN P`))); + EXPAND_TAC "P"; + REWRITE_TAC[INTERS_IMAGE;IN_ELIM_THM]; + GOAL_TERM (fun w -> (DISCH_THEN (MP_TAC o (ISPEC ( env w`v0`))))); + ASM_SIMP_TAC[]; + BY(REWRITE_TAC[IN_ELIM_THM]); + ASM_REWRITE_TAC[]; + REWRITE_TAC[INTERS_IMAGE;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `~(v0 IN u)`) ASSUME_TAC)); + DISCH_TAC; + REPEAT (FIRST_X_ASSUM_ST `IN` MP_TAC); + ASM_REWRITE_TAC[IN_IMAGE]; + BY(MESON_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `x IN V`) ASSUME_TAC)); + BY(ASM_MESON_TAC[SUBSET]); + ASM_SIMP_TAC[]; + REWRITE_TAC[IN_ELIM_THM]; + MATCH_MP_TAC (arith `x < y ==> x <= y`); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_MESON_TAC[]); + COMMENT "1"; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!v w. v IN V /\ w IN V /\ (h v = h w) ==> (v = w)`) ASSUME_TAC)); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ASM_SIMP_TAC[]; + ONCE_REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[IN_ELIM_THM]; + DISCH_TAC; + PROOF_BY_CONTR_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `interior {p | a v dot p <= b v} = interior {p | a w dot p <= b w}`) MP_TAC)); + AP_TERM_TAC; + ONCE_REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[IN_ELIM_THM]; + BY(ASM_REWRITE_TAC[]); + ASM_SIMP_TAC[ INTERIOR_HALFSPACE_LE ]; + ONCE_REWRITE_TAC[FUN_EQ_THM]; + REWRITE_TAC[IN_ELIM_THM]; + BY(ASM_MESON_TAC[arith `x = y ==> ~(x < y)`]); + COMMENT "1b"; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!x. x IN V ==> (q(h x) = x)`) MP_TAC)); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[ EQ_SYM_EQ ]; + FIRST_X_ASSUM MATCH_MP_TAC; + REWRITE_TAC[IN_IMAGE]; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + ASM_REWRITE_TAC[]; + COMMENT "1b"; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(!hv. hv IN IMAGE h V ==> ~(a (q hv) = vec 0) /\ hv = {x | a (q hv) dot x <= b (q hv)})`) ASSUME_TAC)); + REWRITE_TAC[IN_IMAGE]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_MESON_TAC[IN_IMAGE]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `q (h x) = x`) SUBST1_TAC)); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + COMMENT "1c"; + REWRITE_TAC[ BIJ; INJ ]; + SUBCONJ_TAC; + SUBCONJ_TAC; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPEC ( env w `P INTER {p | a x dot p = b x}`))))); + REWRITE_TAC[IN_ELIM_THM]; + DISCH_THEN SUBST1_TAC; + BY(ASM_MESON_TAC[IN_IMAGE]); + DISCH_TAC; + REPEAT WEAK_STRIP_TAC; + PROOF_BY_CONTR_TAC; + GOAL_TERM (fun w -> (FIRST_X_ASSUM_ST `<` (MP_TAC o (ISPEC ( env w `y`))))); + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `INTER` MP_TAC; + REWRITE_TAC[FUN_EQ_THM;X_IN IN_INTER;IN_ELIM_THM]; + EXPAND_TAC "P"; + REWRITE_TAC[INTERS_IMAGE;IN_ELIM_THM]; + RENAME_FREE_VAR (`x:A`,"v"); + REBIND_TAC (`x:A`,"w"); + REWRITE_TAC[ NOT_FORALL_THM ]; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `p`))); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (TAUT (`a /\ ~b ==> (~(a /\ b <=> a))`)); + CONJ2_TAC; + BY(ASM_MESON_TAC[arith `x < y ==> ~(x = y)`]); + REPEAT WEAK_STRIP_TAC; + ASM_SIMP_TAC[]; + REWRITE_TAC[IN_ELIM_THM]; + GOAL_TERM (fun w -> (ASM_CASES_TAC ( env w `y = w`))); + EXPAND_TAC "w"; + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `dot` MP_TAC); + BY(REAL_ARITH_TAC); + MATCH_MP_TAC (arith `x < y ==> x <=y`); + REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC); + BY(MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + COMMENT "1d:SUR"; + REWRITE_TAC[SURJ]; + CONJ_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + RENAME_FREE_VAR (`x:real^B->bool`,"c"); + FIRST_X_ASSUM MP_TAC; + ASM_SIMP_TAC[]; + REWRITE_TAC[IN_IMAGE]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `q h'`))); + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `h x IN IMAGE h V`) MP_TAC)); + BY(ASM_MESON_TAC[IN_IMAGE]); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let EXISTS_M_POLYHEDRON = prove_by_refinement( +`!(V:real^3 -> bool) theta r n. + V SUBSET ball_annulus /\ packing V /\ + weakly_saturated V r (&2 * h0) /\ + (V HAS_SIZE n) /\ + ~(V = {}) /\ + (&2 <= r /\ r <= &2 * h0) /\ + (!v w. v IN V /\ w IN V /\ ~(v = w) ==> theta v + theta w <= arcV (vec 0) v w) /\ + (!v. v IN V ==> &0 < theta v /\ theta v < pi/ &2) ==> + (?b f h P . + (!v. v IN V ==> h v = {p | v dot p <= b v}) /\ + INTERS (IMAGE h V) = P /\ + (!v. v IN V ==> &0 < b v) /\ + polyhedron P /\ + bounded P /\ + (vec 0 IN interior P) /\ + BIJ f V {c |c facet_of P} /\ + (!v. v IN V ==> f v = P INTER { p | v dot p = b v}) /\ + (!v. v IN V ==> b v = norm v * cos (theta v)) /\ + (!v. v IN V ==> rcone_gt (vec 0) v (cos (theta v)) SUBSET fchanged (f v)) /\ + (!v. v IN V ==> &0 < cos (theta v) /\ cos(theta v) < &1)) + `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!v. v IN V ==> ~(v = vec 0)`) ASSUME_TAC)); + FIRST_X_ASSUM_ST `ball_annulus` MP_TAC; + REWRITE_TAC[ Pack_defs.ball_annulus ]; + REWRITE_TAC[ SUBSET; DIFF ;IN_ELIM_THM;ball;]; + ONCE_REWRITE_TAC[DIST_SYM]; + REWRITE_TAC[dist;varith `x - vec 0 = x`]; + BY(MESON_TAC[ NORM_0 ; arith `&0 < &2`]); + COMMENT "0"; + TYPED_ABBREV_TAC `b = \ (v:real^3). norm v * cos (theta v)`; + TYPED_ABBREV_TAC `h = \ (v:real^3). { p | v dot p <= b v }`; + TYPED_ABBREV_TAC `(P:real^3->bool) = INTERS (IMAGE h (V:real^3->bool))`; + TYPED_ABBREV_TAC `f = \ (v:real^3). P INTER { p | v dot p = b v}`; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `b`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `f`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `h`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `P`))); + SUBCONJ_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + SUBCONJ_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + SUBGOAL_THEN (`(!v. v IN V ==> &0 < cos (theta v) /\ cos (theta (v:real^3)) < &1)`) ASSUME_TAC; + BY(ASM_MESON_TAC[cos_bounds_0_Pi2]); + ASM_REWRITE_TAC[]; + SUBGOAL_THEN (`(!v. v IN V ==> f v = P INTER {p | v dot p = b (v:real^3) })`) ASSUME_TAC; + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[]; + SUBGOAL_THEN (` (!v. v IN V ==> b v = norm v * cos (theta (v:real^3)))`) ASSUME_TAC; + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[]; + COMMENT "1"; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `polyhedron P`) ASSUME_TAC)); + REWRITE_TAC[ polyhedron ]; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `IMAGE h V`))); + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC FINITE_IMAGE; + BY(ASM_MESON_TAC[HAS_SIZE]); + REWRITE_TAC[IN_IMAGE]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `x`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `b x`))); + CONJ_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[FUN_EQ_THM;IN_ELIM_THM]; + EXPAND_TAC "h"; + BY(REWRITE_TAC[IN_ELIM_THM]); + ASM_REWRITE_TAC[]; + COMMENT "1b"; + SUBCONJ_TAC; + REPEAT WEAK_STRIP_TAC; + ASM_SIMP_TAC[]; + MATCH_MP_TAC Real_ext.REAL_PROP_POS_MUL2; + ASM_SIMP_TAC[]; + REWRITE_TAC[ NORM_POS_LT ]; + BY(ASM_SIMP_TAC[]); + DISCH_TAC; + COMMENT "1c"; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(vec 0) IN P`) ASSUME_TAC)); + EXPAND_TAC "P"; + REWRITE_TAC[INTERS_IMAGE;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + EXPAND_TAC "h"; + REWRITE_TAC[IN_ELIM_THM]; + REWRITE_TAC[DOT_RZERO]; + BY(ASM_MESON_TAC[arith `&0 < x ==> &0 <= x`]); + TYPED_ABBREV_TAC `ho = \ (v:real^3). {(p : real^3) | v dot p < b v}`; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!v. ho v = {p | v dot p < b v}`) ASSUME_TAC)); + GEN_TAC; + EXPAND_TAC "ho"; + BY(BY(REWRITE_TAC[])); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(vec 0) IN INTERS (IMAGE ho V)`) ASSUME_TAC)); + REWRITE_TAC[INTERS_IMAGE;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + EXPAND_TAC "ho"; + REWRITE_TAC[IN_ELIM_THM]; + REWRITE_TAC[DOT_RZERO]; + BY(ASM_MESON_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `open (INTERS (IMAGE ho (V )))`) ASSUME_TAC)); + MATCH_MP_TAC OPEN_INTERS; + SUBCONJ_TAC; + MATCH_MP_TAC FINITE_IMAGE; + BY(ASM_MESON_TAC[HAS_SIZE]); + DISCH_TAC; + REWRITE_TAC[IN_IMAGE]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + BY(BY(REWRITE_TAC[ OPEN_HALFSPACE_LT ])); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[ OPEN_CONTAINS_BALL ]; + GOAL_TERM (fun w -> (DISCH_THEN (fun t -> MP_TAC (ISPEC ( env w `(vec 0):real^3`) t)))); + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + COMMENT "1d"; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `vec 0 IN interior P`) ASSUME_TAC)); + REWRITE_TAC[ IN_INTERIOR]; + EXISTS_TAC `e:real`; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC SUBSET_TRANS; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `INTERS (IMAGE ho V)`))); + ASM_REWRITE_TAC[]; + EXPAND_TAC "P"; + REWRITE_TAC[SUBSET;INTERS_IMAGE]; + REWRITE_TAC[IN_ELIM_THM]; + EXPAND_TAC "ho"; + EXPAND_TAC "h"; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC (arith `x < y ==> x <= y`); + FIRST_X_ASSUM MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + COMMENT "1e"; + SUBCONJ_TAC; + MATCH_MP_TAC Tarjjuw.TARJJUW; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `V`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `b`))); + EXISTS_TAC `r:real`; + EXISTS_TAC `&2 * h0`; + ASM_REWRITE_TAC[]; + SUBCONJ_TAC; + FIRST_X_ASSUM_ST `ball_annulus` MP_TAC; + REWRITE_TAC[Pack_defs.ball_annulus]; + REWRITE_TAC[SUBSET;DIFF]; + REWRITE_TAC[IN_UNIV;IN_ELIM_THM]; + BY(MESON_TAC[]); + DISCH_TAC; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[HAS_SIZE]); + DISCH_TAC; + EXPAND_TAC "P"; + REWRITE_TAC[INTERS_IMAGE]; + REWRITE_TAC[INTERS;IN_ELIM_THM]; + REWRITE_TAC[FUN_EQ_THM;IN_ELIM_THM]; + REBIND_TAC (`u:real^3`,"w"); + EXPAND_TAC "h"; + REWRITE_TAC[IN_ELIM_THM; Tarjjuw.half_spaces]; + GEN_TAC; + ONCE_REWRITE_TAC[ Geomdetail.EQ_EXPAND]; + SUBCONJ_TAC; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[IN]; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPEC ( env w `{x | x' dot x <= b x'}`))))); + REWRITE_TAC[IN_ELIM_THM]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + COMMENT "1f"; + SUBCONJ_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(f = (\v. P INTER {p | I v dot p = b v}))`) SUBST1_TAC)); + EXPAND_TAC "f"; + BY(REWRITE_TAC[I_DEF]); + MATCH_MP_TAC FACET_OF_POLYHEDRON_EXPLICIT_ALT; + REWRITE_TAC[I_DEF]; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `h`))); + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC[HAS_SIZE]); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `(b v / (v dot v)) % v`))); + CONJ_TAC; + REWRITE_TAC[ DOT_RMUL ]; + Calc_derivative.CALC_ID_TAC; + BY(ASM_MESON_TAC[ DOT_EQ_0 ]); + REPEAT WEAK_STRIP_TAC; + INTRO_TAC rcone_gt_facet [`theta v`;`theta w`;`v`;`w`;`(b v / (v dot v)) % v`;`v`]; + ASM_SIMP_TAC[]; + ANTS_TAC; + MATCH_MP_TAC rcone_refl; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC (arith `(x = y) ==> (x < z ==> y < z)`); + REWRITE_TAC[DOT_RMUL;DOT_LMUL]; + BY(MESON_TAC[DOT_SYM]); + DISCH_TAC; + COMMENT "1g"; + REWRITE_TAC[SUBSET]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[ Polyhedron.fchanged ]; + REWRITE_TAC[ IN_ELIM_THM]; + TYPED_ABBREV_TAC `s = ((b:real^3->real) v)/ (x dot v)`; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `s % x`))); + EXISTS_TAC (`&1 / s`); + CONJ_TAC; + REWRITE_TAC[ VECTOR_MUL_ASSOC ]; + REWRITE_TAC[ varith ` (x = u % x) <=> &1 % x = u % x `]; + REWRITE_TAC[ VECTOR_MUL_RCANCEL ]; + DISJ1_TAC; + EXPAND_TAC "s"; + Calc_derivative.CALC_ID_TAC; + ASM_SIMP_TAC[arith `~(&1 = &0)`;arith `&0 < x ==> ~(x = &0)`]; + MATCH_MP_TAC (arith `&0 < x ==> ~(x = &0)`); + MATCH_MP_TAC rcone_dot_pos; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `cos (theta v)`))); + BY(ASM_SIMP_TAC[]); + COMMENT "1h"; + CONJ2_TAC; + EXPAND_TAC "s"; + MATCH_MP_TAC (arith `&0 < x ==> x > &0`); + REWRITE_TAC[ GSYM Collect_geom.POS_EQ_INV_POS ]; + MATCH_MP_TAC REAL_LT_DIV; + ASM_SIMP_TAC[]; + MATCH_MP_TAC rcone_dot_pos; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `cos (theta v)`))); + BY(ASM_SIMP_TAC[]); + EXPAND_TAC "f"; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `{p | v dot p = b v} = {p | I v dot p = b v}`) SUBST1_TAC)); + BY(REWRITE_TAC[I_DEF]); + MATCH_MP_TAC RELATIVE_INTERIOR_POLYHEDRON_EXPLICIT_ALT; + REWRITE_TAC[I_DEF]; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `V`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `h`))); + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC[HAS_SIZE]); + SUBCONJ_TAC; + EXPAND_TAC "s"; + REWRITE_TAC[DOT_RMUL]; + Calc_derivative.CALC_ID_TAC; + CONJ_TAC; + MATCH_MP_TAC (arith `&0 < x ==> ~(x = &0)`); + MATCH_MP_TAC rcone_dot_pos; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `cos(theta v)`))); + BY(ASM_SIMP_TAC[]); + BY(ASM_MESON_TAC[DOT_SYM;arith `(x = z) ==> y * x - z * y = &0`]); + REPEAT WEAK_STRIP_TAC; + EXPAND_TAC "b"; + ONCE_REWRITE_TAC[DOT_SYM]; + MATCH_MP_TAC rcone_gt_facet; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `theta v`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `v`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `x`))); + ASM_SIMP_TAC[]; + EXPAND_TAC "s"; + EXPAND_TAC "b"; + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let LMFUN_LE_1 = prove_by_refinement( + `!h. &1 <= h ==> lmfun h <= &1`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[ Pack_defs.lmfun ]; + COND_CASES_TAC; + ENOUGH_TO_SHOW_TAC (`(h0 - h)/ (h0 - &1) <= (h0 - &1) / (h0 - &1)`); + MATCH_MP_TAC (arith `(x = y) ==> (z <= x ==> z <= y)`); + Calc_derivative.CALC_ID_TAC; + REWRITE_TAC[ Sphere.h0 ]; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LE_DIV2_EQ; + REPEAT (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC [Sphere.h0]; + BY(REAL_ARITH_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let LMFUN_INEQ_CENTER_IMP_13 = prove_by_refinement( + `!V. FINITE V /\ (V SUBSET ball_annulus) /\ ~(lmfun_ineq_center V) ==> + (13 <= CARD V)`, + (* {{{ proof *) + [ + REWRITE_TAC[ Pack_defs.lmfun_ineq_center ]; + REWRITE_TAC[SUBSET; ckq_in_ball_annulus ]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC (arith `~(CARD V <= 12) ==> (13 <= CARD V)`); + DISCH_TAC; + FIRST_X_ASSUM_ST `lmfun` MP_TAC; + REWRITE_TAC[]; + MATCH_MP_TAC REAL_LE_TRANS; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `sum V (\v. &1)`))); + CONJ_TAC; + MATCH_MP_TAC SUM_LE; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[ Marchal_cells_3.HL_2 ]; + REWRITE_TAC[ DIST_0 ]; + MATCH_MP_TAC LMFUN_LE_1; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `&2 <= norm x`) MP_TAC)); + BY(ASM_MESON_TAC[]); + BY(REAL_ARITH_TAC); + ASM_SIMP_TAC [ GSYM CARD_EQ_SUM ]; + BY(ASM_REWRITE_TAC[ REAL_OF_NUM_LE ]) + ]);; + (* }}} *) + +let LMFUN_INEQ_CENTER_SUBSET = prove_by_refinement( + `!V W. FINITE V /\ W SUBSET V /\ (lmfun_ineq_center V) ==> + (lmfun_ineq_center W)`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REWRITE_TAC[ Pack_defs.lmfun_ineq_center ]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC REAL_LE_TRANS; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `sum V (\v. lmfun (hl [vec 0; v]))`))); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC SUM_SUBSET_SIMPLE; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[ Marchal_cells_3.lmfun_pos_le ]) + ]);; + (* }}} *) + +let SATURATE_BALL_ANNULUS = prove_by_refinement( + `!W S r. packing W /\ W SUBSET ball_annulus /\ ~(lmfun_ineq_center W) /\ (S SUBSET W) /\ + &2 <= r /\ r <= &2 * h0 /\ + (!v w. S v /\ W w /\ dist(v,w) < r ==> (v = w) ) ==> + (?V. V SUBSET ball_annulus /\ packing V /\ + weakly_saturated V r (&2 * h0) /\ FINITE V /\ (W SUBSET V) /\ + (!v w. S v /\ V w /\ dist(v,w)< r ==> (v = w)) /\ + ~(lmfun_ineq_center V) /\ (13 <= CARD V))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC weak_saturation [`W`;`S`;`r`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `V`))); + ASM_REWRITE_TAC[]; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[ LMFUN_INEQ_CENTER_SUBSET]); + DISCH_TAC; + MATCH_MP_TAC LMFUN_INEQ_CENTER_IMP_13; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let POLYHEDRON_FACET_SUM_4Pi = prove_by_refinement( + `!(P:real^3->bool). polyhedron P /\ bounded P /\ + (vec 0) IN interior P ==> + (sum {c | c facet_of P } (\c. sol (vec 0) (fchanged c)) = &4 * pi)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC (GSYM Conforming.SUM_SOL_IN_FACE_SET_EQ_4PI) [`(vec 0):real^3`;`vertices P`;`edges P`]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(FAN (vec 0,vertices P,edges P) /\ conforming_fan (vec 0,vertices P,edges P))`) MP_TAC)); + BY(ASM_SIMP_TAC[ Polyhedron.POLYHEDRON_FAN; POLYHEDRON_CONFORMING_FAN]); + WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + ASM_SIMP_TAC[GSYM Conforming.SUM_SOL_IN_TOPOLOGICAL_COMPONENET_EQ_IN_FACE_SET]; + INTRO_TAC Polyhedron.AMHFNXP_BIJ [`P`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[BIJ;INJ]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(topological_component_yfan (vec 0,vertices P,edges P)) = IMAGE fchanged {c | c facet_of P}`) SUBST1_TAC)); + MATCH_MP_TAC Misc_defs_and_lemmas.SURJ_IMAGE; + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `{c | c facet_of P} = (\f. f facet_of P)`) ASSUME_TAC)); + BY(REWRITE_TAC[FUN_EQ_THM;IN_ELIM_THM]); + BY(ASM_REWRITE_TAC[]); + GMATCH_SIMP_TAC SUM_IMAGE; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `{c | c facet_of P} = (\f. f facet_of P)`) SUBST1_TAC)); + BY(REWRITE_TAC[FUN_EQ_THM;IN_ELIM_THM]); + ASM_REWRITE_TAC[]; + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + REWRITE_TAC[FUN_EQ_THM]; + BY(REWRITE_TAC[o_DEF]) + ]);; + (* }}} *) + +let COSG = prove_by_refinement( + `!h. -- &2 <= h /\ h <= &2 /\ g = acs (h/ &2) - pi / &6 ==> + cos g = h * sqrt(&3) / &4 + sqrt (&1 - (h / &2) pow 2) / &2`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[ COS_SUB]; + REWRITE_TAC[ COS_PI6; SIN_PI6]; + GMATCH_SIMP_TAC COS_ACS; + GMATCH_SIMP_TAC SIN_ACS; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let FACET_FINITE = prove_by_refinement( + `!(p:real^3->bool) f. polyhedron p /\ f facet_of p ==> + FINITE { e | e facet_of f}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC FINITE_SUBSET; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `{ e | e face_of p}`))); + ASM_SIMP_TAC[ FINITE_POLYHEDRON_FACES ]; + REWRITE_TAC[SUBSET;IN_ELIM_THM]; + BY(ASM_MESON_TAC[ FACET_OF_IMP_FACE_OF; FACE_OF_TRANS ]) + ]);; + (* }}} *) + +let BIJ_SUM = prove_by_refinement( + `!(A:A->bool) (B:B->bool) f ab. + BIJ ab A B ==> (sum A (f o ab) = sum B f)`, + (* {{{ proof *) + [ + REWRITE_TAC[BIJ;INJ]; + BY(ASM_MESON_TAC[ SUM_IMAGE ; Misc_defs_and_lemmas.SURJ_IMAGE ]) + ]);; + (* }}} *) + +let CARD_AT_LEAST3 = prove_by_refinement( + `!x y z (A:A->bool). FINITE A /\ x IN A /\ y IN A /\ z IN A /\ + ~(x = y) /\ ~(y = z) /\ ~(x = z) ==> + (3 <= CARD A)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC (arith `2 <= CARD A /\ ~(CARD A = 2) ==> (3 <= CARD A)`); + SUBCONJ_TAC; + MATCH_MP_TAC Hypermap.CARD_ATLEAST_2; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `CARD {x,y} < CARD A`) ASSUME_TAC)); + MATCH_MP_TAC CARD_PSUBSET; + ASM_REWRITE_TAC[ PSUBSET_MEMBER ]; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `z`))); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `CARD {x,y} = 2`) ASSUME_TAC)); + MATCH_MP_TAC Hypermap.CARD_TWO_ELEMENTS; + BY(ASM_REWRITE_TAC[]); + REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC); + BY(ARITH_TAC) + ]);; + (* }}} *) + +let polyhedron_3_facets = prove_by_refinement( + `!(p:real^A->bool). polyhedron p /\ bounded p /\ (&1 < aff_dim p) ==> + FINITE { c | c facet_of p } /\ 3 <= CARD {c | c facet_of p } `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[ FINITE_POLYHEDRON_FACETS ]); + DISCH_TAC; + INTRO_TAC POLYTOPE_FACET_EXISTS [`p`]; + ANTS_TAC; + CONJ_TAC; + BY(ASM_REWRITE_TAC[ POLYTOPE_EQ_BOUNDED_POLYHEDRON ]); + FIRST_X_ASSUM_ST `aff_dim` MP_TAC; + BY(INT_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`f SUBSET p`) ASSUME_TAC)); + BY(ASM_MESON_TAC[facet_of;FACE_OF_IMP_SUBSET]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `~(f = p)`) ASSUME_TAC)); + BY(ASM_MESON_TAC[ FACET_OF_REFL]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `?x. x IN p DIFF f`) MP_TAC)); + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); + BY(SET_TAC[]); + REPEAT WEAK_STRIP_TAC; + INTRO_TAC KREIN_MILMAN_MINKOWSKI [`p`]; + ANTS_TAC; + CONJ_TAC; + BY(ASM_SIMP_TAC [ POLYHEDRON_IMP_CONVEX ]); + BY(ASM_MESON_TAC[POLYTOPE_IMP_COMPACT;POLYTOPE_EQ_BOUNDED_POLYHEDRON]); + DISCH_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `?y. y extreme_point_of p /\ ~(y IN f)`) MP_TAC)); + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `~({x | x extreme_point_of p} SUBSET f)`))); + REWRITE_TAC[SUBSET;IN_ELIM_THM]; + BY(MESON_TAC[]); + DISCH_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `p SUBSET convex hull f`) ASSUME_TAC)); + FIRST_X_ASSUM_ST `convex` SUBST1_TAC; + MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM MP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`convex hull f = f`) SUBST1_TAC)); + REWRITE_TAC[ CONVEX_HULL_EQ ]; + BY(ASM_MESON_TAC[ FACET_OF_IMP_FACE_OF; FACE_OF_IMP_CONVEX; ]); + FIRST_X_ASSUM_ST `DIFF` MP_TAC; + BY(SET_TAC[]); + REWRITE_TAC[ GSYM FACE_OF_SING ]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC FACE_OF_POLYHEDRON [`p`;`{y}`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + CONJ_TAC; + BY(SET_TAC[]); + INTRO_TAC AFF_DIM_SING [`y`]; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `~(&1 < (int_of_num 0))` ASSUME_TAC; + BY(INT_ARITH_TAC); + BY(ASM_MESON_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!f. {y} SUBSET f <=> y IN f`) (fun t -> REWRITE_TAC[t]))); + BY(SET_TAC[]); + TYPED_ABBREV_TAC `(A = { c | c facet_of p /\ (y:real^A) IN c })`; + DISCH_TAC; + COMMENT "1"; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `~(A = {})`) MP_TAC)); + DISCH_TAC; + FIRST_X_ASSUM_ST `INTERS` MP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[ INTERS_0 ]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `p SUBSET {y}`) MP_TAC)); + BY(ASM_REWRITE_TAC[SUBSET_UNIV]); + DISCH_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP AFF_DIM_SUBSET)); + REWRITE_TAC[ AFF_DIM_SING ]; + FIRST_X_ASSUM_ST `aff_dim` MP_TAC; + BY(INT_ARITH_TAC); + REWRITE_TAC[Misc_defs_and_lemmas.EMPTY_EXISTS ]; + REPEAT WEAK_STRIP_TAC; + COMMENT "1b"; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `u facet_of p`) ASSUME_TAC)); + FIRST_X_ASSUM MP_TAC; + EXPAND_TAC "A"; + REWRITE_TAC[IN_ELIM_THM]; + BY(MESON_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `&1 <= aff_dim u`) ASSUME_TAC)); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[facet_of]; + FIRST_X_ASSUM_ST `aff_dim` MP_TAC; + BY(INT_ARITH_TAC); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `aff_dim {y } = &0`) ASSUME_TAC)); + BY(REWRITE_TAC[ AFF_DIM_SING ]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `~( A = {u})`) MP_TAC)); + DISCH_TAC; + FIRST_X_ASSUM_ST `INTERS` MP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[ INTERS_1 ]; + DISCH_TAC; + REPEAT (FIRST_X_ASSUM_ST `aff_dim` MP_TAC); + ASM_REWRITE_TAC[]; + BY(INT_ARITH_TAC); + DISCH_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `?v. v IN A /\ ~(v = u)`) ASSUME_TAC)); + FIRST_X_ASSUM MP_TAC; + FIRST_X_ASSUM_ST `IN` MP_TAC; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `{u} SUBSET A /\ ~(A = {u}) ==> (?v. v IN A DIFF {u})`))); + REWRITE_TAC[SUBSET;IN_DIFF;IN_SING]; + BY(MESON_TAC[]); + BY(SET_TAC[]); + FIRST_X_ASSUM MP_TAC; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC CARD_AT_LEAST3; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `f`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `u`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `v`))); + ASM_REWRITE_TAC[IN_ELIM_THM]; + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `IN` MP_TAC); + EXPAND_TAC "A"; + REWRITE_TAC[IN_ELIM_THM]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let facet_3_facets = prove_by_refinement( + `!(p:real^3->bool) f. + polyhedron p /\ bounded p /\ (vec 0 IN interior p) /\ + f facet_of p ==> + FINITE {e | e facet_of f} /\ 3 <= CARD {e | e facet_of f} + `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC polyhedron_3_facets; + SUBCONJ_TAC; + MATCH_MP_TAC FACE_OF_POLYHEDRON_POLYHEDRON; + BY(ASM_MESON_TAC[ FACET_OF_IMP_FACE_OF ]); + DISCH_TAC; + CONJ_TAC; + MATCH_MP_TAC BOUNDED_SUBSET; + BY(ASM_MESON_TAC[ FACET_OF_IMP_FACE_OF; FACE_OF_IMP_SUBSET]); + FIRST_X_ASSUM_ST `facet_of` MP_TAC; + REWRITE_TAC[facet_of]; + ASM_SIMP_TAC[ (ISPEC `(vec 0):real^3` Polyhedron.AFF_DIM_INTERIOR_EQ_3) ]; + BY(INT_ARITH_TAC) + ]);; + (* }}} *) + +let YSSKQOY_VECTOR = prove_by_refinement( + `!v (w:real^3) theta. v IN ball_annulus /\ w IN ball_annulus /\ ~(v = w) /\ + &2 <= dist(v,w) /\ + (\ v. acs(norm v/ &4) - pi/ &6) = theta ==> + theta v + theta w <= arcV (vec 0) v w`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Ysskqoy.YSSKQOY [`norm v / &2`;`norm w / &2 `]; + ANTS_TAC; + INTRO_TAC ckq_in_ball_annulus [`v`]; + INTRO_TAC ckq_in_ball_annulus [`w`]; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC); + EXPAND_TAC "theta"; + MATCH_MP_TAC (arith `x = x' /\ y <= y' ==> (x <= y ==> x' <= y')`); + CONJ_TAC; + REWRITE_TAC[arith `x/ &2 / &2 = x/ &4`]; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC Trigonometry1.arcVarc; + REWRITE_TAC[DIST_0; arith `&2 * x / &2 = x`]; + REPEAT (GMATCH_SIMP_TAC Trigonometry1.ACS_ARCLENGTH); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `&0 < norm v /\ &0 < norm w /\ norm v <= norm w + &2 /\ norm w <= &2 + norm v /\ &2 <= norm v + norm w /\ ~( v = vec 0) /\ ~(w = vec 0) /\ &0 <= dist (v,w) /\ norm v <= norm w + dist (v,w) /\ norm w <= dist (v,w) + norm v /\ &0 <= &2`) MP_TAC)); + INTRO_TAC ckq_in_ball_annulus [`v`]; + INTRO_TAC ckq_in_ball_annulus [`w`]; + ASM_REWRITE_TAC[]; + MP_TAC Sphere.h0; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM MP_TAC); + BY(REAL_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + COMMENT "1"; + SUBCONJ_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `norm v = dist (v, vec 0) /\ norm w = dist(vec 0,w)`) (fun t -> REWRITE_TAC[t]))); + BY(REWRITE_TAC[DIST_0]); + BY(REWRITE_TAC[DIST_TRIANGLE]); + DISCH_TAC; + MATCH_MP_TAC ACS_MONO_LE; + ASM_SIMP_TAC[ Trigonometry1.TRI_SQUARES_BOUNDS ]; + GMATCH_SIMP_TAC REAL_LE_DIV2_EQ; + CONJ_TAC; + BY(ASM_MESON_TAC[ Real_ext.REAL_PROP_POS_MUL2 ; arith `&0 < &2`]); + MATCH_MP_TAC (arith `(c' <= c) ==> (a + b - c <= a + b - c')`); + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + BY(ASM_REWRITE_TAC[arith `abs(&2) = &2`]) + ]);; + (* }}} *) + +let PACK_INEQ_DEF_A_797 = prove_by_refinement( + `!v (v0:real^3). + pack_ineq_def_a /\ + norm v0 = &2 /\ + &2 * h0 <= dist (v,v0) /\ + &2 <= norm v /\ norm v <= &2 * h0 ==> + #0.797 + acs(norm v / &4) - pi / &6 < arclength (norm v) (&2) (dist(v,v0))`, + (* {{{ proof *) + [ + REWRITE_TAC[Ysskqoy.pack_ineq_def_a]; + REPEAT WEAK_STRIP_TAC; + REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC); + FIRST_X_ASSUM_ST `#0.797` MP_TAC; + REPEAT (FIRST_X_ASSUM kill); + REWRITE_TAC[Sphere.ineq]; + REWRITE_TAC[Sphere.acs_sqrt_x1_d4]; + REWRITE_TAC[Sphere.arclength_x_123]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (fun t-> INTRO_TAC t [`(norm v) pow 2`;`(norm v0) pow 2`;`(&2 * h0) pow 2`;`&1`;`&1`;`&1`]); + ASM_REWRITE_TAC[arith `!x. x <= x`;arith `&2 pow 2 = &4`]; + ANTS_TAC; + MP_TAC (GSYM Sphere.h0); + REWRITE_TAC[ GSYM REAL_LE_SQUARE_ABS; arith `&4 = &2 pow 2`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`sqrt(norm v pow 2) = norm v`) SUBST1_TAC)); + MATCH_MP_TAC POW_2_SQRT; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`sqrt((&2 * h0) pow 2) = (&2 * h0)`) SUBST1_TAC)); + MATCH_MP_TAC POW_2_SQRT; + MP_TAC Sphere.h0; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REWRITE_TAC[ Collect_geom2.SQRT4_EQ2 ]; + DISCH_TAC; + MATCH_MP_TAC REAL_LTE_TRANS; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `arclength (norm v) (&2) (&2 * h0)`))); + CONJ_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + COMMENT "1"; + REPEAT (GMATCH_SIMP_TAC Trigonometry1.ACS_ARCLENGTH); + ASSUME_TAC (GSYM Sphere.h0); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `&0 < norm v /\ &0 < &2 /\ &0 <= dist (v,v0) /\ norm v <= &2 + dist (v,v0) /\ &2 <= dist (v,v0) + norm v /\ &0 <= &2 * h0 /\ &2 * h0 <= norm v + &2 /\ norm v <= &2 + &2 * h0 /\ &2 <= &2 * h0 + norm v /\ &2 <= &2 * h0 /\ &2 <= &2 * h0 + norm v`) MP_TAC)); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w`dist(v,v0) <= dist(v,(vec 0)) + dist ((vec 0),v0)`) MP_TAC)); + BY(REWRITE_TAC[DIST_TRIANGLE]); + ASM_REWRITE_TAC[DIST_0]; + DISCH_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC ACS_MONO_LE; + ASM_SIMP_TAC[ Trigonometry1.TRI_SQUARES_BOUNDS ]; + GMATCH_SIMP_TAC REAL_LE_DIV2_EQ; + CONJ_TAC; + BY(BY(ASM_MESON_TAC[ Real_ext.REAL_PROP_POS_MUL2 ; arith `&0 < &2`])); + MATCH_MP_TAC (arith `(c' <= c) ==> (a + b - c <= a + b - c')`); + GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE; + BY(BY(ASM_SIMP_TAC[arith `(#1.26 = h0) ==> abs(&2 * h0) = &2 * h0`])) + ]);; + (* }}} *) + +let YSSKQOY_VECTOR2 = prove_by_refinement( + `!v0 (w:real^3). v0 IN ball_annulus /\ w IN ball_annulus /\ ~(w = v0) /\ + &2 * h0 <= dist(w,v0) /\ + pack_ineq_def_a /\ + norm v0 = &2 ==> + #0.797 + acs(norm w/ &4) - pi/ &6 <= arcV (vec 0) v0 w`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[]; + GMATCH_SIMP_TAC Trigonometry1.arcVarc; + REWRITE_TAC[DIST_0]; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[ Arc_properties.arc_sym]; + REPEAT (FIRST_X_ASSUM_ST `ball_annulus` MP_TAC); + REWRITE_TAC[ ckq_in_ball_annulus]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[DIST_SYM]; + MATCH_MP_TAC (arith `x < y ==> (x <= y)`); + MATCH_MP_TAC PACK_INEQ_DEF_A_797; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let YSSKQOY_VECTOR2_ALT = prove_by_refinement( + `!V v w (v0:real^3) theta. + V SUBSET ball_annulus /\ + packing V /\ + (v IN V) /\ (w IN V) /\ (v0 IN V) /\ + ~(v = w) /\ + (!w. w IN V /\ ~(w = v0) ==> &2 * h0 <= dist (w,v0)) /\ + pack_ineq_def_a /\ + norm v0 = &2 /\ + (\ v. (if (v = v0) then #0.797 else acs(norm v/ &4) - pi/ &6)) = theta ==> + theta v + theta w <= arcV (vec 0) v w`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + EXPAND_TAC "theta"; + REPEAT (COND_CASES_TAC); + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC YSSKQOY_VECTOR2; + BY(ASM_MESON_TAC[ SUBSET]); + ONCE_REWRITE_TAC[arith `a + b = b + a`]; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[ Trigonometry2.ARC_SYM ]; + MATCH_MP_TAC YSSKQOY_VECTOR2; + BY(ASM_MESON_TAC[ SUBSET ]); + INTRO_TAC YSSKQOY_VECTOR [`v`;`w`;`(\v. acs (norm (v:real^3) / &4) - pi / &6)`]; + ASM_REWRITE_TAC[]; + DISCH_THEN MATCH_MP_TAC; + FIRST_X_ASSUM_ST `packing` MP_TAC; + REWRITE_TAC[Sphere.packing]; + BY(ASM_MESON_TAC[IN;SUBSET]) + ]);; + (* }}} *) + +let ACS_ROOT32 = prove_by_refinement( + `acs (sqrt(&3) / &2) = pi / &6`, + (* {{{ proof *) + [ + REWRITE_TAC[GSYM COS_PI6]; + MATCH_MP_TAC ACS_COS; + MP_TAC PI_POS; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let ASN_HALF = prove_by_refinement( + `asn (&1 / &2) = pi/ &6`, + (* {{{ proof *) + [ + REWRITE_TAC[GSYM SIN_PI6]; + MATCH_MP_TAC ASN_SIN; + MP_TAC PI_POS; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let THETA_BOUNDS = prove_by_refinement( + `!v theta. (v IN ball_annulus) /\ (\v. acs(norm v / &4) - pi/ &6) = theta + ==> ( &0 < theta v /\ theta v < pi / &2)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + EXPAND_TAC "theta"; + REWRITE_TAC[arith `x - y < u <=> -- y < u -x `;arith `&0 < x - y <=> y < x`]; + SUBGOAL_THEN `!x y. y <= x ==> -- (pi/ &6) < x - y` GMATCH_SIMP_TAC; + REPEAT GEN_TAC; + MP_TAC PI_POS; + BY(REAL_ARITH_TAC); + REWRITE_TAC[ GSYM ACS_0 ]; + REWRITE_TAC[ GSYM ACS_ROOT32]; + GMATCH_SIMP_TAC ACS_MONO_LT; + GMATCH_SIMP_TAC ACS_MONO_LE; + FIRST_X_ASSUM_ST `IN` MP_TAC; + REWRITE_TAC[ ckq_in_ball_annulus ]; + MP_TAC Sphere.h0; + MP_TAC Flyspeck_constants.bounds; + REWRITE_TAC[Sphere.sqrt3]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let INJ_FINITE_EXISTS = prove_by_refinement( + `!n (A:A->bool) (B:B->bool). + A HAS_SIZE n /\ FINITE B /\ n <= CARD B ==> + (?j. INJ j A B) + `, + (* {{{ proof *) + [ + INDUCT_TAC; + REWRITE_TAC[HAS_SIZE]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `A = {}`) (fun t -> REWRITE_TAC[t]))); + BY(ASM_MESON_TAC[ CARD_EQ_0; SUBSET_EMPTY]); + BY(REWRITE_TAC[INJ;NOT_IN_EMPTY]); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `~(A = {}) /\ ~(B = {})`) (fun t -> ASSUME_TAC t THEN MP_TAC t))); + REWRITE_TAC[ GSYM HAS_SIZE_0]; + REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[HAS_SIZE]; + BY(MESON_TAC[ arith `~(0 = SUC n) /\ ~(SUC n <= 0)`]); + REWRITE_TAC[ Misc_defs_and_lemmas.EMPTY_EXISTS ]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC[`A DELETE u`;`B DELETE u'`]); + ANTS_TAC; + ASM_REWRITE_TAC[ FINITE_DELETE ]; + CONJ_TAC; + FIRST_X_ASSUM_ST `HAS_SIZE` MP_TAC; + REWRITE_TAC[ HAS_SIZE_SUC ]; + BY(ASM_MESON_TAC[]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `?m. (n <= m) /\ B HAS_SIZE (SUC m)`) MP_TAC)); + ASM_REWRITE_TAC[HAS_SIZE]; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `PRE (CARD B)`))); + FIRST_X_ASSUM_ST `SUC` MP_TAC; + BY(ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[ HAS_SIZE_SUC ]; + BY(ASM_MESON_TAC[HAS_SIZE]); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `\ a. if (a = u) then u' else j a`))); + REWRITE_TAC[INJ]; + SUBCONJ_TAC; + REPEAT WEAK_STRIP_TAC; + COND_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM_ST `INJ` MP_TAC; + REWRITE_TAC[INJ;IN_DELETE]; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + REPEAT GEN_TAC; + FIRST_X_ASSUM_ST `INJ` MP_TAC; + REWRITE_TAC[INJ;IN_DELETE]; + BY(REPEAT COND_CASES_TAC THEN ASM_REWRITE_TAC[] THEN TRY (ASM_MESON_TAC[])) + ]);; + (* }}} *) + +let INJ_EXTENSION = prove_by_refinement( + `!(A:A->bool) (B:B->bool) A' j'. + INJ j' A' B /\ A' SUBSET A /\ FINITE A /\ FINITE B /\ CARD A <= CARD B ==> + (?j. INJ j A B /\ (!a. a IN A' ==> j a = j' a))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `?k. INJ k (A DIFF A') (B DIFF (IMAGE j' A'))`) MP_TAC)); + MATCH_MP_TAC INJ_FINITE_EXISTS; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `CARD (A DIFF A')`))); + SUBCONJ_TAC; + BY(ASM_MESON_TAC[HAS_SIZE;FINITE_DIFF]); + DISCH_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[FINITE_DIFF]); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `IMAGE j' A' SUBSET B`) MP_TAC)); + FIRST_X_ASSUM_ST `INJ` MP_TAC; + REWRITE_TAC[INJ;SUBSET;IN_IMAGE]; + BY(MESON_TAC[]); + DISCH_TAC; + ASM_SIMP_TAC[ CARD_DIFF ]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `CARD (IMAGE j' A') <= CARD (A')`) MP_TAC)); + MATCH_MP_TAC CARD_IMAGE_LE; + BY(ASM_MESON_TAC[FINITE_SUBSET]); + FIRST_X_ASSUM_ST `(<=):(num->num->bool)` MP_TAC; + BY(ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + REPEAT (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[SUBSET;INJ;IN_DIFF;IN_IMAGE]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `\v. if (v IN A') then j' v else k v`))); + BY(REPEAT (COND_CASES_TAC) THEN TRY (ASM_MESON_TAC[])) + ]);; + (* }}} *) + +let BIJ_EXTENDS_INJ = prove_by_refinement( + `! (A:A->bool) (B:B->bool) A' j'. + FINITE A /\ FINITE B /\ A' SUBSET A /\ (INJ j' A' B) /\ + (CARD A = CARD B) ==> + (?j. BIJ j A B /\ (!a. a IN A' ==> j' a = j a))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC INJ_EXTENSION [`A`;`B`;`A'`;`j'`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + FIRST_X_ASSUM MP_TAC; + BY(ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `j`))); + ASM_REWRITE_TAC[BIJ]; + BY(ASM_MESON_TAC[Ysskqoy.INJ_IFF_SURJ]) + ]);; + (* }}} *) + +let DLWCHEM_VECTOR_sum = prove_by_refinement( + `!k (V:real^3->bool) n theta. pack_ineq_def_a /\ + (\v. acs (norm v / &4) - pi / &6) = theta /\ + (!v. v IN V ==> (3 <= k v)) /\ + (12 < n) /\ + (V HAS_SIZE n) /\ + (V SUBSET ball_annulus) /\ + (sum V (\v. &(k v)) <= (&6 * &n - &12)) /\ + (sum V (\v. max (&0) (regular_spherical_polygon_area (cos(theta v)) (&(k v)))) <= &4 * pi) /\ + ~(lmfun_ineq_center V) + ==> (n < 16)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC DLWCHEM_sum; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `?b. BIJ b (0..(n-1)) V`) MP_TAC)); + INTRO_TAC BIJ_EXTENDS_INJ [`(0..(n-1))`;`V`;`{}:num->bool`]; + REWRITE_TAC[EMPTY_SUBSET;INJ;NOT_IN_EMPTY]; + DISCH_THEN MATCH_MP_TAC; + INTRO_TAC HAS_SIZE_NUMSEG [`0`;`n-1`]; + FIRST_X_ASSUM_ST `HAS_SIZE` MP_TAC; + REWRITE_TAC[HAS_SIZE]; + FIRST_X_ASSUM_ST `12 < n` MP_TAC; + BY(MESON_TAC[arith `12 < n ==> (n - 1 + 1) - 0 = n`]); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `(\v. (norm v) / &2) o b`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `k o b`))); + ASM_REWRITE_TAC[]; + SUBCONJ_TAC; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[o_DEF]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `b i IN V`) ASSUME_TAC)); + FIRST_X_ASSUM_ST `BIJ` MP_TAC; + REWRITE_TAC[BIJ;INJ;IN_NUMSEG]; + BY(ASM_MESON_TAC[arith `i < n ==> 0 <= i /\ i <= n-1`]); + ASM_SIMP_TAC[]; + FIRST_X_ASSUM_ST `ball_annulus` MP_TAC; + REWRITE_TAC[ckq_in_ball_annulus; SUBSET]; + DISCH_THEN (C INTRO_TAC[`b i`]); + ASM_REWRITE_TAC[]; + MP_TAC Sphere.h0; + BY(REAL_ARITH_TAC); + DISCH_TAC; + COMMENT "1"; + CONJ_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(\i. &((k o b) i)) = (\v. &(k v)) o b`) SUBST1_TAC)); + BY(REWRITE_TAC[FUN_EQ_THM;o_DEF]); + GMATCH_SIMP_TAC BIJ_SUM; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + INTRO_TAC SUM_EQ [`(\i. max (&0) (regular_spherical_polygon_area (((\v. norm v / &2) o b) i * sqrt3 / #4.0 + sqrt (&1 - (((\v. norm v / &2) o b) i / &2) pow 2) / &2) (&((k o b) i))))`;`(\v. max (&0) (regular_spherical_polygon_area (cos (theta v)) (&(k v)))) o b`;`(0..(n-1))`]; + DISCH_THEN GMATCH_SIMP_TAC; + CONJ_TAC; + GEN_TAC; + REWRITE_TAC[FUN_EQ_THM;o_DEF;IN_NUMSEG]; + REPEAT WEAK_STRIP_TAC; + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + GMATCH_SIMP_TAC COSG; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `norm (b x) / &2`))); + EXPAND_TAC "theta"; + REWRITE_TAC[arith `x / &2 / &2 = x / &4`;arith `#4.0 = &4`;Sphere.sqrt3]; + FIRST_X_ASSUM (MP_TAC o (ISPEC `x:num`)); + ANTS_TAC; + REPEAT (FIRST_X_ASSUM MP_TAC); + BY(ARITH_TAC); + REWRITE_TAC[o_DEF]; + MP_TAC Sphere.h0; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC BIJ_SUM; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM_ST `lmfun_ineq_center` MP_TAC; + REWRITE_TAC[ Pack_defs.lmfun_ineq_center ; arith `~(x <= &12) <=> (&12 < x)`]; + INTRO_TAC SUM_EQ [`(\i. lfun (((\v. norm v / &2) o b) i))`;`(\v. lmfun (hl [vec 0; v])) o b`;`(0..(n-1))`]; + DISCH_THEN GMATCH_SIMP_TAC; + CONJ_TAC; + REWRITE_TAC[FUN_EQ_THM;IN_NUMSEG;o_DEF]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[ Marchal_cells_3.HL_2 ; DIST_0; arith `inv (&2) *x = x/ &2`]; + GMATCH_SIMP_TAC Nonlinear_lemma.lmfun_lfun; + FIRST_X_ASSUM (MP_TAC o (ISPEC `x:num`)); + ANTS_TAC; + REPEAT (FIRST_X_ASSUM MP_TAC); + BY(ARITH_TAC); + REWRITE_TAC[o_DEF]; + MP_TAC Sphere.h0; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC BIJ_SUM; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let XULJEPR_VECTOR_sum = prove_by_refinement( + `!k V n theta v0. ( pack_ineq_def_a /\ + (v0 IN V) /\ + (\v. (if (v = v0) then (#0.797) else acs (norm v / &4) - pi / &6)) = theta /\ + (12 < n) /\ + (norm v0 = &2) /\ + (!v. (v IN V ==> 3 <= k v)) /\ + V HAS_SIZE n /\ + V SUBSET ball_annulus /\ + sum V (\v. &(k v)) <= &6 * &n - &12 /\ + sum V (\v. max (&0) (regular_spherical_polygon_area (cos (theta v)) (&(k v)))) <= &4 * pi /\ + ~lmfun_ineq_center V ==> F)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC XULJEPR_sum; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `?b. BIJ b (0..(n-1)) V /\ b 0 = v0`) MP_TAC)); + INTRO_TAC BIJ_EXTENDS_INJ [`(0..(n-1))`;`V`;`{0}`;`\ (i:num). v0`]; + REWRITE_TAC[IN_SING]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(!(j:num->real^3). (!a. a = 0 ==> (v0 = j a)) <=> (j 0 = v0))`) (fun t -> REWRITE_TAC[t]))); + BY(MESON_TAC[]); + DISCH_THEN MATCH_MP_TAC; + INTRO_TAC HAS_SIZE_NUMSEG [`0`;`n-1`]; + FIRST_X_ASSUM_ST `HAS_SIZE` MP_TAC; + REWRITE_TAC[HAS_SIZE]; + FIRST_X_ASSUM_ST `12 < n` MP_TAC; + REWRITE_TAC[INJ;SUBSET;IN_SING;IN_NUMSEG]; + BY(BY(ASM_MESON_TAC[arith `12 < n ==> (n - 1 + 1) - 0 = n`;arith `0 <= 0 /\ (12 < n==> 0 <= n-1)`])); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `(\v. (norm v) / &2) o b`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `k o b`))); + EXISTS_TAC `n:num`; + ASM_REWRITE_TAC[]; + COMMENT "1"; + CONJ_TAC; + ASM_REWRITE_TAC[o_DEF]; + BY(REAL_ARITH_TAC); + SUBCONJ_TAC; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[o_DEF]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `b i IN V`) ASSUME_TAC)); + FIRST_X_ASSUM_ST `BIJ` MP_TAC; + REWRITE_TAC[BIJ;INJ;IN_NUMSEG]; + BY(BY(ASM_MESON_TAC[arith `i < n ==> 0 <= i /\ i <= n-1`])); + ASM_SIMP_TAC[]; + FIRST_X_ASSUM_ST `ball_annulus` MP_TAC; + REWRITE_TAC[ckq_in_ball_annulus; SUBSET]; + DISCH_THEN (C INTRO_TAC[`b i`]); + ASM_REWRITE_TAC[]; + MP_TAC Sphere.h0; + BY(BY(REAL_ARITH_TAC)); + DISCH_TAC; + COMMENT "1a 6n-12"; + CONJ_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(\i. &((k o b) i)) = (\v. &(k v)) o b`) SUBST1_TAC)); + BY(BY(REWRITE_TAC[FUN_EQ_THM;o_DEF])); + GMATCH_SIMP_TAC BIJ_SUM; + BY(BY(ASM_MESON_TAC[])); + CONJ2_TAC; + FIRST_X_ASSUM_ST `lmfun_ineq_center` MP_TAC; + REWRITE_TAC[ Pack_defs.lmfun_ineq_center ; arith `~(x <= &12) <=> (&12 < x)`]; + INTRO_TAC SUM_EQ [`(\i. lfun (((\v. norm v / &2) o b) i))`;`(\v. lmfun (hl [vec 0; v])) o b`;`(0..(n-1))`]; + DISCH_THEN GMATCH_SIMP_TAC; + CONJ_TAC; + REWRITE_TAC[FUN_EQ_THM;IN_NUMSEG;o_DEF]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[ Marchal_cells_3.HL_2 ; DIST_0; arith `inv (&2) *x = x/ &2`]; + GMATCH_SIMP_TAC Nonlinear_lemma.lmfun_lfun; + FIRST_X_ASSUM (MP_TAC o (ISPEC `x:num`)); + ANTS_TAC; + REPEAT (FIRST_X_ASSUM MP_TAC); + BY(BY(ARITH_TAC)); + REWRITE_TAC[o_DEF]; + MP_TAC Sphere.h0; + BY(BY(REAL_ARITH_TAC)); + GMATCH_SIMP_TAC BIJ_SUM; + BY(BY(ASM_MESON_TAC[])); + COMMENT "1b last conjunct"; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `max (&0) (regular_spherical_polygon_area (cos #0.797) (&((k o b) 0))) + sum (1..n - 1) (\i. max (&0) (regular_spherical_polygon_area (((\v. norm v / &2) o b) i * sqrt3 / #4.0 + sqrt (&1 - (((\v. norm v / &2) o b) i / &2) pow 2) / &2) (&((k o b) i)))) = sum (0.. n-1) ( (\v. max (&0) (regular_spherical_polygon_area (cos (theta v)) (&(k v)))) o b)`) SUBST1_TAC)); + INTRO_TAC (GSYM SUM_COMBINE_R) [` ((\v. max (&0) (regular_spherical_polygon_area (cos (theta v)) (&(k v)))) o b)`;`0`;`0`;`n - 1`]; + ANTS_TAC; + BY(ARITH_TAC); + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[arith `0+1 = 1`;SUM_SING_NUMSEG]; + MATCH_MP_TAC (arith `a = a' /\ b = b' ==> (a + b = a'+b')`); + CONJ_TAC; + REWRITE_TAC[o_DEF]; + ASM_REWRITE_TAC[]; + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + EXPAND_TAC "theta"; + BY(REWRITE_TAC[]); + MATCH_MP_TAC SUM_EQ; + GEN_TAC; + REWRITE_TAC[FUN_EQ_THM;o_DEF;IN_NUMSEG]; + REPEAT WEAK_STRIP_TAC; + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + GMATCH_SIMP_TAC COSG; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `norm (b x) / &2`))); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `theta (b x) = acs(norm (b x) / &4) - pi / &6`) SUBST1_TAC)); + EXPAND_TAC "theta"; + COND_CASES_TAC; + SUBGOAL_THEN `x = 0` MP_TAC; + FIRST_X_ASSUM_ST `BIJ` MP_TAC; + REWRITE_TAC[BIJ;INJ;IN_NUMSEG]; + BY(ASM_MESON_TAC[arith `0 <= 0 /\ (12 < n ==> 0 <= n-1) /\ (1 <= x ==> 0 <= x)`]); + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `1` MP_TAC); + BY(ARITH_TAC); + BY(REWRITE_TAC[]); + REWRITE_TAC[arith `x / &2 / &2 = x / &4`;arith `#4.0 = &4`;Sphere.sqrt3]; + FIRST_X_ASSUM (MP_TAC o (ISPEC `x:num`)); + ANTS_TAC; + REPEAT (FIRST_X_ASSUM MP_TAC); + BY(BY(ARITH_TAC)); + REWRITE_TAC[o_DEF]; + MP_TAC Sphere.h0; + BY(BY(REAL_ARITH_TAC)); + GMATCH_SIMP_TAC BIJ_SUM; + BY(BY(ASM_MESON_TAC[])) + ]);; + (* }}} *) + +let SOL_NN = prove_by_refinement( + `!x U. (?r. &0 < r /\ measurable (U INTER normball x r) /\ + radial_norm r x (U INTER normball x r)) ==> &0 <= sol x U`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC Vol1.sol; + EXISTS_TAC `r:real`; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + MATCH_MP_TAC Real_ext.REAL_PROP_NN_MUL2; + CONJ_TAC; + BY(BY(REAL_ARITH_TAC)); + MATCH_MP_TAC REAL_LE_DIV; + CONJ_TAC; + MATCH_MP_TAC MEASURE_POS_LE; + BY(BY(ASM_MESON_TAC[])); + MATCH_MP_TAC REAL_POW_LE; + BY(BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let FACET_SOL_NN = prove_by_refinement( + `!p c. polyhedron p /\ bounded p /\ (vec 0) IN interior p /\ + c facet_of p ==> + &0 <= sol (vec 0) (fchanged c)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC SOL_NN; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `&1`))); + ASM_SIMP_TAC[FCHANGED_RADIAL;FCHANGED_MEASURABLE]; + BY(ASM_MESON_TAC[Marchal_cells_2_new.RADIAL_VS_RADIAL_NORM;FCHANGED_RADIAL;FCHANGED_MEASURABLE;arith `&0 < &1`]) + ]);; + (* }}} *) + +let DLWCHEM = prove_by_refinement( +`!V. packing V /\ pack_ineq_def_a /\ + V SUBSET ball_annulus /\ ~(lmfun_ineq_center V) ==> + (CARD V = 13 \/ CARD V = 14 \/ CARD V = 15)`, + (* {{{ proof *) + [ + X_GENv_TAC "W"; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC LMFUN_INEQ_CENTER_IMP_13 [`W`]; + ASM_SIMP_TAC[fat_lemma1]; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `CARD W < 16`))); + BY((ARITH_TAC)); + INTRO_TAC SATURATE_BALL_ANNULUS [`W`;`{}:real^3->bool`;`&2`]; + ASM_REWRITE_TAC[arith `&2 <= &2`;EMPTY_SUBSET]; + ANTS_TAC; + CONJ_TAC; + MP_TAC Sphere.h0; + BY((REAL_ARITH_TAC)); + BY((REWRITE_TAC[X_IN NOT_IN_EMPTY])); + REWRITE_TAC[X_IN NOT_IN_EMPTY]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `CARD V < 16`))); + MATCH_MP_TAC (arith `y <= x ==> x < z ==> y < (z:num)`); + MATCH_MP_TAC CARD_SUBSET; + BY((ASM_REWRITE_TAC[])); + FIRST_X_ASSUM_ST `SUBSET` kill; + REPLICATE_TAC 6 (FIRST_X_ASSUM MP_TAC); + FIRST_X_ASSUM_ST `pack_ineq_def_a` MP_TAC; + REPEAT (FIRST_X_ASSUM kill); + REPEAT WEAK_STRIP_TAC; + COMMENT "1 saturated"; + TYPED_ABBREV_TAC (`n = CARD (V:real^3 ->bool)`); + TYPED_ABBREV_TAC (`theta = \ (v:real^3). acs(norm v / &4) - pi / &6`); + INTRO_TAC EXISTS_M_POLYHEDRON [`V`;`theta`;`&2`;`n`]; + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `V HAS_SIZE n`) ASSUME_TAC)); + BY((ASM_MESON_TAC[HAS_SIZE])); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `~(V = {})`) ASSUME_TAC)); + BY((ASM_MESON_TAC[CARD_CLAUSES;arith `~(13 <= 0)`])); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w ` (!v w. v IN V /\ w IN V /\ ~(v = w) ==> theta v + theta w <= arcV (vec 0) v w)`) ASSUME_TAC)); + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC YSSKQOY_VECTOR; + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `&2 <= dist(v,w)`) (fun t -> REWRITE_TAC[t]))); + FIRST_X_ASSUM_ST `packing` MP_TAC; + REWRITE_TAC[Sphere.packing]; + DISCH_THEN MATCH_MP_TAC; + BY((ASM_MESON_TAC[IN])); + BY((ASM_MESON_TAC[SUBSET])); + ASM_REWRITE_TAC[]; + (COMMENT "1a"); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w ` (!v. v IN V ==> &0 < theta v /\ theta v < pi / &2)`) ASSUME_TAC)); + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC THETA_BOUNDS; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[SUBSET]); + ASM_REWRITE_TAC[]; + ANTS_TAC; + MP_TAC Sphere.h0; + BY(REAL_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC DLWCHEM_VECTOR_sum; + TYPED_ABBREV_TAC `k = \ (v:real^3). CARD { (e:real^3->bool) | e facet_of (f v) }`; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `k`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `V`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `theta`))); + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!v. v IN V ==> f v facet_of P`) ASSUME_TAC)); + FIRST_X_ASSUM_ST `BIJ` MP_TAC; + REWRITE_TAC[BIJ;INJ;IN_ELIM_THM]; + BY(MESON_TAC[]); + SUBCONJ_TAC; + EXPAND_TAC "k"; + BY(ASM_MESON_TAC[facet_3_facets]); + DISCH_TAC; + CONJ_TAC; + FIRST_X_ASSUM_ST `13` MP_TAC; + BY(ARITH_TAC); + CONJ_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(\v. &(k v)) = (\ c. &(CARD {e | e facet_of c })) o f`) SUBST1_TAC)); + EXPAND_TAC "k"; + BY(REWRITE_TAC[FUN_EQ_THM;o_DEF]); + GMATCH_SIMP_TAC BIJ_SUM; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `{ c | c facet_of P }`))); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC polyhedron_edge_sum; + ASM_SIMP_TAC[arith `13 <= n ==> 2 <= n`]; + REWRITE_TAC[HAS_SIZE]; + BY(ASM_MESON_TAC[ Misc_defs_and_lemmas.BIJ_CARD; Misc_defs_and_lemmas.FINITE_BIJ]); + COMMENT "last conjunct: 4 pi"; + ASM_SIMP_TAC[GSYM POLYHEDRON_FACET_SUM_4Pi]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `sum {c | c facet_of P} (\c. sol (vec 0) (fchanged c)) = sum V ((\c. sol (vec 0) (fchanged c)) o f)`) SUBST1_TAC)); + GMATCH_SIMP_TAC BIJ_SUM; + BY(ASM_MESON_TAC[]); + MATCH_MP_TAC SUM_LE; + ASM_REWRITE_TAC[]; + X_GENv_TAC "v"; + DISCH_TAC; + REWRITE_TAC[o_DEF]; + MATCH_MP_TAC (arith `a <= x /\ b <= x==> (max a b <= x)`); + SUBCONJ_TAC; + MATCH_MP_TAC FACET_SOL_NN; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + REWRITE_TAC[ Sphere.regular_spherical_polygon_area ]; + MATCH_MP_TAC GOTCJAH; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `f v`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `v`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `b v`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `P`))); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `{u | u facet_of f v} HAS_SIZE k v`) (fun t -> REWRITE_TAC[t]))); + EXPAND_TAC "k"; + REWRITE_TAC[HAS_SIZE]; + MATCH_MP_TAC FACET_FINITE; + BY(ASM_MESON_TAC[]); + ASM_SIMP_TAC[]; + AP_TERM_TAC; + REWRITE_TAC[FUN_EQ_THM;IN_ELIM_THM]; + GEN_TAC; + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + BY(MESON_TAC[DOT_SYM]) + ]);; + (* }}} *) + +let XULJEPR_concl = `!V. packing V /\ V SUBSET ball_annulus /\ pack_ineq_def_a /\ + (?v. v IN V /\ norm (v) = &2 /\ (!u. (u IN V) /\ ~(u = v) ==> &2 * h0 <= dist(u,v) )) +==> (lmfun_ineq_center V)`;; + +let XULJEPR = prove_by_refinement( +`!V. packing V /\ V SUBSET ball_annulus /\ pack_ineq_def_a /\ + (?v. v IN V /\ norm (v) = &2 /\ (!u. (u IN V) /\ ~(u = v) ==> &2 * h0 <= dist(u,v) )) +==> (lmfun_ineq_center V)`, + (* {{{ proof *) + [ + X_GENv_TAC "W"; + REPEAT WEAK_STRIP_TAC; + PROOF_BY_CONTR_TAC; + INTRO_TAC LMFUN_INEQ_CENTER_IMP_13 [`W`]; + ASM_SIMP_TAC[fat_lemma1]; + DISCH_TAC; + INTRO_TAC SATURATE_BALL_ANNULUS [`W`;`{v}`;`&2 * h0`]; + ANTS_TAC; + ASM_REWRITE_TAC[arith `&2 * h0 <= &2 * h0`]; + CONJ_TAC; + ASM_REWRITE_TAC[IN_SING;SUBSET]; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + MP_TAC Sphere.h0; + BY(((REAL_ARITH_TAC))); + REWRITE_TAC[X_IN IN_SING]; + REPEAT WEAK_STRIP_TAC; + BY(ASM_MESON_TAC[IN;arith `x <= y ==> ~(y < x)`;DIST_SYM]); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `v IN V`) MP_TAC)); + BY(ASM_MESON_TAC[SUBSET]); + REPLICATE_TAC 8 (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[X_IN IN_SING]; + FIRST_X_ASSUM_ST `norm` MP_TAC; + FIRST_X_ASSUM_ST `pack_ineq_def_a` MP_TAC; + REPEAT (FIRST_X_ASSUM kill); + REPEAT WEAK_STRIP_TAC; + COMMENT "1 saturated"; + TYPED_ABBREV_TAC (`n = CARD (V:real^3 ->bool)`); + RENAME_FREE_VAR (`v:real^3`,"v0"); + TYPED_ABBREV_TAC (`theta = \ (v:real^3). if (v = v0) then (#0.797) else acs(norm v / &4) - pi / &6`); + INTRO_TAC EXISTS_M_POLYHEDRON [`V`;`theta`;`&2 * h0`;`n`]; + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `V HAS_SIZE n`) ASSUME_TAC)); + BY(((ASM_MESON_TAC[HAS_SIZE]))); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `~(V = {})`) ASSUME_TAC)); + BY(((ASM_MESON_TAC[CARD_CLAUSES;arith `~(13 <= 0)`]))); + COMMENT "1 still on M polyhedron "; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w ` (!v w. v IN V /\ w IN V /\ ~(v = w) ==> theta v + theta w <= arcV (vec 0) v w)`) ASSUME_TAC)); + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC YSSKQOY_VECTOR2_ALT; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `V`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `v0`))); + ASM_REWRITE_TAC[]; + REWRITE_TAC[IN]; + BY(ASM_MESON_TAC[IN;DIST_SYM;arith `~(x < y) ==> (y <= x)`]); + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!v w. v IN V /\ w IN V /\ ~(v = w) ==> &2 <= dist(v,w)`) (fun t -> REWRITE_TAC[t]))); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `packing` MP_TAC; + REWRITE_TAC[Sphere.packing]; + DISCH_THEN MATCH_MP_TAC; + BY(((ASM_MESON_TAC[IN]))); + (COMMENT "1a"); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w ` (!v. v IN V ==> &0 < theta v /\ theta v < pi / &2)`) ASSUME_TAC)); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (ASM_CASES_TAC ( env w `v = v0`))); + EXPAND_TAC "theta"; + ASM_REWRITE_TAC[]; + MP_TAC Flyspeck_constants.bounds; + BY(REAL_ARITH_TAC); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `theta v = (\ v . acs (norm v / &4) - pi / &6 ) v`) SUBST1_TAC)); + EXPAND_TAC "theta"; + BY(ASM_REWRITE_TAC[]); + MATCH_MP_TAC THETA_BOUNDS; + ASM_REWRITE_TAC[]; + BY((ASM_MESON_TAC[SUBSET])); + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `&2 <= &2 * h0 /\ &2 * h0 <= &2 * h0` (fun t -> REWRITE_TAC[t]); + MP_TAC Sphere.h0; + BY((REAL_ARITH_TAC)); + MATCH_MP_TAC (TAUT `( p ==> F) ==> ~p`); + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC XULJEPR_VECTOR_sum; + TYPED_ABBREV_TAC `k = \ (v:real^3). CARD { (e:real^3->bool) | e facet_of (f v) }`; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `k`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `V`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `n`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `theta`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `v0`))); + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `!v. v IN V ==> f v facet_of P`) ASSUME_TAC)); + FIRST_X_ASSUM_ST `BIJ` MP_TAC; + REWRITE_TAC[BIJ;INJ;IN_ELIM_THM]; + BY((MESON_TAC[])); + CONJ_TAC; + FIRST_X_ASSUM_ST `13` MP_TAC; + BY(ARITH_TAC); + SUBCONJ_TAC; + EXPAND_TAC "k"; + BY((ASM_MESON_TAC[facet_3_facets])); + DISCH_TAC; + CONJ_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `(\v. &(k v)) = (\ c. &(CARD {e | e facet_of c })) o f`) SUBST1_TAC)); + EXPAND_TAC "k"; + BY((REWRITE_TAC[FUN_EQ_THM;o_DEF])); + GMATCH_SIMP_TAC BIJ_SUM; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `{ c | c facet_of P }`))); + ASM_REWRITE_TAC[]; + MATCH_MP_TAC polyhedron_edge_sum; + ASM_SIMP_TAC[arith `13 <= n ==> 2 <= n`]; + REWRITE_TAC[HAS_SIZE]; + BY((ASM_MESON_TAC[ Misc_defs_and_lemmas.BIJ_CARD; Misc_defs_and_lemmas.FINITE_BIJ])); + COMMENT "last conjunct: 4 pi"; + ASM_SIMP_TAC[GSYM POLYHEDRON_FACET_SUM_4Pi]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `sum {c | c facet_of P} (\c. sol (vec 0) (fchanged c)) = sum V ((\c. sol (vec 0) (fchanged c)) o f)`) SUBST1_TAC)); + GMATCH_SIMP_TAC BIJ_SUM; + BY((ASM_MESON_TAC[])); + MATCH_MP_TAC SUM_LE; + ASM_REWRITE_TAC[]; + X_GENv_TAC "v"; + DISCH_TAC; + REWRITE_TAC[o_DEF]; + MATCH_MP_TAC (arith `a <= x /\ b <= x==> (max a b <= x)`); + SUBCONJ_TAC; + MATCH_MP_TAC FACET_SOL_NN; + BY((ASM_MESON_TAC[])); + DISCH_TAC; + REWRITE_TAC[ Sphere.regular_spherical_polygon_area ]; + MATCH_MP_TAC GOTCJAH; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `f v`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `v`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `b v`))); + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `P`))); + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `{u | u facet_of f v} HAS_SIZE k v`) (fun t -> REWRITE_TAC[t]))); + EXPAND_TAC "k"; + REWRITE_TAC[HAS_SIZE]; + MATCH_MP_TAC FACET_FINITE; + BY((ASM_MESON_TAC[])); + ASM_SIMP_TAC[]; + AP_TERM_TAC; + REWRITE_TAC[FUN_EQ_THM;IN_ELIM_THM]; + GEN_TAC; + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + BY((MESON_TAC[DOT_SYM])) + ]);; + (* }}} *) + +end;; diff --git a/text_formalization/packing/leaf_cell.hl b/text_formalization/packing/leaf_cell.hl new file mode 100644 index 0000000..688c3bf --- /dev/null +++ b/text_formalization/packing/leaf_cell.hl @@ -0,0 +1,4809 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Packing *) +(* Lemma: OXLZLEZ *) +(* Author: Thomas C. Hales *) +(* Date: 2012-12-21 *) +(* ========================================================================== *) + +(* Leaf and Cell Lemmas *) + +module Leaf_cell = struct + + open Hales_tactic;; + open Bump;; + +let leaf = new_definition `leaf V ul <=> ul IN barV V 2 /\ hl ul < sqrt2`;; + +let stem = new_definition `stem (ul:(A)list) = set_of_list (truncate_simplex 1 ul)`;; + +(* START WITH GENERIC LEMMAS *) + +let coplanar_eq_coplanar_alt = prove( + `!s:real^N->bool. 2 <= dimindex(:N) ==> (coplanar s <=> coplanar_alt s)`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[COPLANAR; Collect_geom.coplanar_alt]);; + +let RE_EQVL_IMP_SYM = prove_by_refinement( + `!a b. re_eqvl a b ==> re_eqvl b a`, + (* {{{ proof *) + [ + REWRITE_TAC[Trigonometry2.re_eqvl]; + REPEAT WEAK_STRIP_TAC; + EXISTS_TAC(`inv t`); + GMATCH_SIMP_TAC REAL_LT_INV; + ASM_REWRITE_TAC[]; + Calc_derivative.CALC_ID_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let RE_EQVL_SYM = prove_by_refinement( + `!a b. re_eqvl a b <=> re_eqvl b a`, + (* {{{ proof *) + [ + MESON_TAC[RE_EQVL_IMP_SYM] + ]);; + (* }}} *) + +let RE_EQVL_SCALE1 = prove_by_refinement( + `!a b t. &0 < t ==> (re_eqvl (t * a) b <=> re_eqvl a b)`, + (* {{{ proof *) + [ + REWRITE_TAC[Trigonometry2.re_eqvl]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[TAUT `(a <=> b) <=> ((a ==> b) /\ (b ==> a))`]; + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + EXISTS_TAC `t' / t`; + GMATCH_SIMP_TAC REAL_LT_DIV; + ASM_REWRITE_TAC[]; + Calc_derivative.CALC_ID_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + EXISTS_TAC `t' * t`; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let RE_EQVL_SCALE2 = prove_by_refinement( + `!a b t. &0 < t ==> (re_eqvl a (t* b) <=> re_eqvl a b)`, + (* {{{ proof *) + [ + MESON_TAC[RE_EQVL_SCALE1;RE_EQVL_SYM] + ]);; + (* }}} *) + +let RE_EQVL_REFL = prove_by_refinement( + `!a . re_eqvl a a`, + (* {{{ proof *) + [ + REWRITE_TAC[Trigonometry2.re_eqvl]; + GEN_TAC; + EXISTS_TAC `&1`; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let WEDGE_GE_NULL = prove_by_refinement( + `!u0 u1 v1 v2. ~collinear {u0,u1,v1} /\ ~collinear {u0,u1,v2} /\ azim u0 u1 v1 v2 = &0 ==> + wedge_ge u0 u1 v1 v2 = aff_ge {u0,u1} {v1}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[EXTENSION]; + GEN_TAC; + GMATCH_SIMP_TAC (GSYM Local_lemmas.AZIM_EQ_0_GE_ALT2); + REWRITE_TAC[Local_lemmas.WEDGE_GE_AZIM_LE]; + ASM_REWRITE_TAC[]; + INTRO_TAC Local_lemmas.AZIM_RANGE [`u0`;`u1`;`v1`;`x`]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let X_IN_AFF_GE_LEFT = prove_by_refinement( + `!(x:real^A) S U. (x IN S DIFF U) ==> (x IN aff_ge S U)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `aff_ge S U = aff_ge (S DIFF U) U`) SUBST1_TAC)); + REWRITE_TAC[Sphere.aff_ge_def]; + BY(MESON_TAC[ AFFSIGN_DISJOINT_DIFF]); + MATCH_MP_TAC Packing3.IN_TRANS; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w`aff_ge (S DIFF U) {}`))); + CONJ2_TAC; + MATCH_MP_TAC AFF_GE_MONO_RIGHT; + BY(SET_TAC[]); + REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL]; + MATCH_MP_TAC Marchal_cells_2_new.IN_AFFINE_KY_LEMMA1; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let WEDGE_WEDGE_GE = prove_by_refinement( + `!u0 u1 v1 v2. ~collinear {u0,u1,v1} /\ ~collinear {u0,u1,v2} ==> + wedge_ge u0 u1 v1 v2 SUBSET wedge u0 u1 v1 v2 UNION aff_ge {u0,u1} {v1} UNION aff_ge {u0,u1} {v2}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[SUBSET]; + REWRITE_TAC[IN_UNION]; + REWRITE_TAC[Local_lemmas.WEDGE_GE_AZIM_LE]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (ASM_CASES_TAC ( env w `x IN affine hull {u0,u1}`))); + INTRO_TAC AFFINE_HULL_SUBSET_AFF_GE [`{u0,u1}`;`{v1}`]; + REWRITE_TAC[SUBSET]; + ANTS_TAC; + REWRITE_TAC[DISJOINT]; + REWRITE_TAC[Collect_geom2.INTER_DISJONT_EX]; + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + GOAL_TERM (fun w -> (SUBGOAL_THEN ( env w `{u0,u1,v1} = {v1,u0,u1}`) ASSUME_TAC)); + BY(SET_TAC[]); + BY(ASM_MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]); + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC WEDGE_ALT; + REWRITE_TAC[IN_ELIM_THM]; + ASM_REWRITE_TAC[]; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]); + DISCH_TAC; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `(azim u0 u1 v1 x = &0 ==> x IN aff_ge {u0,u1} {v1}) /\ (azim u0 u1 v1 x = azim u0 u1 v1 v2 ==> x IN aff_ge {u0,u1} {v2})`))); + INTRO_TAC Local_lemmas.AZIM_RANGE [`u0`;`u1`;`v1`;`x`]; + FIRST_X_ASSUM_ST `azim` MP_TAC; + BY(MESON_TAC[arith `x <= y ==> x = y \/ x < y`]); + GMATCH_SIMP_TAC (Local_lemmas.AZIM_EQ_0_GE_ALT2); + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC (GSYM Local_lemmas.AZIM_EQ_0_GE_ALT2); + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[arith `x = azim a b c d <=> azim a b c d = x`]; + GMATCH_SIMP_TAC AZIM_EQ; + GMATCH_SIMP_TAC Local_lemmas.AZIM_EQ_0_GE_ALT2; + ASM_REWRITE_TAC[]; + INTRO_TAC AFF_GT_SUBSET_AFF_GE [`{u0,u1}`;`{v2}`]; + REWRITE_TAC[SUBSET]; + DISCH_THEN (unlist REWRITE_TAC); + GMATCH_SIMP_TAC COLLINEAR_3_AFFINE_HULL; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let WEDGE_GE_ALMOST_DISJOINT = prove_by_refinement( + `!u0 u1 v1 v2. ~collinear {u0,u1,v1} /\ ~collinear {u0,u1,v2} ==> + wedge_ge u0 u1 v1 v2 INTER wedge_ge u0 u1 v2 v1 SUBSET aff_ge {u0,u1} {v1} UNION aff_ge {u0,u1} {v2} + `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ASM_CASES_TAC `azim u0 u1 v1 v2 = &0`; + MATCH_MP_TAC SUBSET_TRANS; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `wedge_ge u0 u1 v1 v2`))); + CONJ_TAC; + BY(SET_TAC[]); + GMATCH_SIMP_TAC WEDGE_GE_NULL; + ASM_REWRITE_TAC[]; + BY(SET_TAC[]); + SUBGOAL_THEN `&0 < azim u0 u1 v1 v2` ASSUME_TAC; + MATCH_MP_TAC (arith `~(x = &0) /\ (&0 <= x) ==> (&0 < x)`); + BY(ASM_REWRITE_TAC[Local_lemmas.AZIM_RANGE;]); + INTRO_TAC WEDGE_WEDGE_GE [`u0`;`u1`;`v1`;`v2`]; + INTRO_TAC WEDGE_WEDGE_GE [`u0`;`u1`;`v2`;`v1`]; + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (ENOUGH_TO_SHOW_TAC ( env w `wedge u0 u1 v1 v2 INTER wedge u0 u1 v2 v1 = {}`))); + BY(SET_TAC[]); + INTRO_TAC Counting_spheres.WEDGE_ORDER_DISJOINT [`u0`;`u1`;`v1`;`2`;`\ i. if (i=2) then v2 else v1`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[arith `~(2 + 1 = 2) /\ ~(1 = 2)`]; + REWRITE_TAC[IN_NUMSEG]; + REWRITE_TAC[arith `!i. (1 <= i /\ i <= 2) <=> (i = 1 \/ i = 2)`]; + ANTS_TAC; + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + BY(ASM_REWRITE_TAC[arith `~(1=2)`]); + FIRST_X_ASSUM MP_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[arith `! j k. ((j = 1 \/ j = 2) /\ (k = 1 \/ k = 2) /\ j < k) <=> (j=1 /\ k=2)`]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[arith `~(1=2)`]; + BY(ASM_REWRITE_TAC[AZIM_REFL]); + DISCH_THEN (C INTRO_TAC [`1`;`2`]); + BY(REWRITE_TAC[arith `~(1=2) /\ (1 + 1 = 2) /\ ~(2 + 1 = 2)`]) + ]);; + (* }}} *) + +let AFF_DIM_3 = prove_by_refinement( + `!a (b:real^A) c. aff_dim {a,b,c} <= &2`, + (* {{{ proof *) + [ + ONCE_REWRITE_TAC[AFF_DIM_INSERT]; + REWRITE_TAC[AFF_DIM_2]; + REPEAT WEAK_STRIP_TAC; + BY(REPEAT COND_CASES_TAC THEN INT_ARITH_TAC) + ]);; + (* }}} *) + +let COPLANAR_IMP_AFF_DIM = prove_by_refinement( + `!(s:real^A->bool). coplanar s ==> aff_dim s <= &2`, + (* {{{ proof *) + [ + REWRITE_TAC[Trigonometry2.coplanar]; + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC INT_LE_TRANS; + TYPIFY `aff_dim (affine hull {u,v,w})` EXISTS_TAC; + CONJ_TAC; + MATCH_MP_TAC AFF_DIM_SUBSET; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[AFF_DIM_AFFINE_HULL]; + ONCE_REWRITE_TAC[AFF_DIM_INSERT]; + REWRITE_TAC[AFF_DIM_2]; + BY(REPEAT COND_CASES_TAC THEN INT_ARITH_TAC) + ]);; + (* }}} *) + +let COPLANAR_INSERT = prove_by_refinement( + `!s (p:real^A). aff_dim s = &2 /\ coplanar (p INSERT s) ==> p IN affine hull s`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP COPLANAR_IMP_AFF_DIM)); + FIRST_X_ASSUM_ST `INSERT` MP_TAC; + REWRITE_TAC[AFF_DIM_INSERT]; + ASM_REWRITE_TAC[]; + COND_CASES_TAC THEN REWRITE_TAC[]; + BY(INT_ARITH_TAC) + ]);; + (* }}} *) + +let COPLANAR_UNION = prove_by_refinement( + `!P Q (a:real^A) b. ~(P = {}) /\ ~(Q = {}) /\ + (!p. p IN P ==> ~collinear {p,a,b}) /\ + (!q. q IN Q ==> ~collinear {q,a,b}) /\ + (! p q. p IN P /\ q IN Q ==> coplanar {p,q,a,b}) ==> + coplanar (P UNION Q UNION {a,b}) + `, + (* {{{ proof *) + [ + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY]; + REPEAT WEAK_STRIP_TAC; + ABBREV_TAC `(E:real^A->bool) = affine hull {x,a,b}`; + TYPIFY `aff_dim {x,a,b} = &2 /\ aff_dim {x',a,b} = &2` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC COLLINEAR_AFF_DIM [`{x,a,b}`]; + INTRO_TAC COLLINEAR_AFF_DIM [`{x',a,b}`]; + ASM_SIMP_TAC[]; + INTRO_TAC AFF_DIM_3 [`x`;`a`;`b`]; + INTRO_TAC AFF_DIM_3 [`x'`;`a`;`b`]; + BY(INT_ARITH_TAC); + TYPIFY `Q SUBSET E` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[SUBSET]; + REPEAT WEAK_STRIP_TAC; + EXPAND_TAC "E"; + MATCH_MP_TAC COPLANAR_INSERT; + ASM_SIMP_TAC[]; + TYPIFY `{x'',x,a,b} = {x,x'',a,b}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(ASM_SIMP_TAC[]); + TYPIFY `affine hull {x',a,b} = E` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "E"; + TYPIFY `affine hull {x,a,b} = affine hull (affine hull {x,a,b})` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[Planarity.AFFINE_HULL_AFFINE_EQ]); + MATCH_MP_TAC AFF_DIM_EQ_AFFINE_HULL; + CONJ_TAC; + TYPIFY `x' IN affine hull {x,a,b} /\ {a,b} SUBSET affine hull {x,a,b}` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + MATCH_MP_TAC SUBSET_TRANS; + TYPIFY `{x,a,b}` EXISTS_TAC; + CONJ_TAC; + BY(SET_TAC[]); + BY(REWRITE_TAC[HULL_SUBSET]); + ASM_REWRITE_TAC[AFF_DIM_AFFINE_HULL]; + BY(INT_ARITH_TAC); + TYPIFY `P SUBSET E` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[SUBSET]; + REPEAT WEAK_STRIP_TAC; + EXPAND_TAC "E"; + MATCH_MP_TAC COPLANAR_INSERT; + BY(ASM_SIMP_TAC[]); + REWRITE_TAC[coplanar]; + GEXISTL_TAC [`x'`;`a`;`b`]; + TYPIFY `P UNION Q SUBSET affine hull {x',a,b} /\ {a,b} SUBSET {x',a,b} /\ {x',a,b} SUBSET affine hull {x',a,b}` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + CONJ_TAC; + REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC); + BY(SET_TAC[]); + REWRITE_TAC[HULL_SUBSET]; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let CONNECTED_SEGMENT_NOT_COVERED = prove_by_refinement( + `!(A:real^A -> bool) B a b. (open) A /\ (open) B /\ a IN A /\ b IN B /\ (A INTER B = {}) ==> + (?x. x IN segment [a,b] /\ ~(x IN A) /\ ~(x IN B)) `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `(!x. x IN segment [a,b] ==> (x IN A) \/ (x IN B)) ==> F ` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[]); + DISCH_TAC; + INTRO_TAC (CONJUNCT1 CONNECTED_SEGMENT) [`a`;`b`]; + REWRITE_TAC[connected]; + GEXISTL_TAC [`A`;`B`]; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN SET_TAC[]); + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + INTRO_TAC ENDS_IN_SEGMENT [`a`;`b`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]) + ]);; + (* }}} *) + +(* END OF GENERIC LEMMAS *) + +let GBEWYFX = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ leaf V ul ==> + ~(collinear (set_of_list ul)) `, + (* {{{ proof *) + [ + REWRITE_TAC[leaf;IN;COLLINEAR_AFF_DIM]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Rogers.MHFTTZN1 [`V`;`ul`;`2`]; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MP_TAC; + BY(INT_ARITH_TAC) + ]);; + (* }}} *) + +let NWVRFMF = prove_by_refinement( + `!V ul p. packing V /\ saturated V /\ leaf V ul /\ {p} facet_of (voronoi_list V ul) ==> + (?vl. vl IN barV V 3 /\ truncate_simplex 2 vl = ul /\ omega_list V vl = p)`, + (* {{{ proof *) + [ + REWRITE_TAC[leaf;IN]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Rogers.IDBEZAL [`V`;`ul`;`2`;`{p}`]; + ASM_REWRITE_TAC[arith `2 < 3`;arith `2 + 1 = 3`]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `vl` EXISTS_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST [`V`;`vl`;`3`]; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[IN_SING]) + ]);; + (* }}} *) + +let YBZFUPO = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ leaf V ul ==> + (?p1 p2. voronoi_list V ul = convex hull {p1,p2} /\ ~(p1 = p2) /\ + (!f. f facet_of voronoi_list V ul <=> f IN {{p1},{p2}}))`, + (* {{{ proof *) + [ + REWRITE_TAC[leaf;IN]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Packing3.AFF_DIM_VORONOI_LIST [`V`;`ul`;`2`]; + ASM_REWRITE_TAC[arith `&3 - int_of_num 2 = &1`]; + DISCH_TAC; + INTRO_TAC Polyhedron.EXPAND_EDGE_POLYTOPE [`voronoi_list V ul`;`voronoi_list V ul`]; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC FACE_OF_REFL; + REWRITE_TAC[Packing3.CONVEX_VORONOI_LIST]; + GMATCH_SIMP_TAC Packing3.POLYTOPE_VORONOI_LIST_BARV; + CONJ_TAC; + EXISTS_TAC `2`; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `a` EXISTS_TAC; + TYPIFY `b` EXISTS_TAC; + SUBCONJ_TAC; + BY(REWRITE_TAC[SEGMENT_CONVEX_HULL]); + DISCH_TAC; + INTRO_TAC EXTREME_POINT_OF_SEGMENT [`a`;`b`;`a`]; + INTRO_TAC EXTREME_POINT_OF_SEGMENT [`a`;`b`;`b`]; + INTRO_TAC EXTREME_POINT_OF_SEGMENT [`a`;`b`]; + REWRITE_TAC[]; + REWRITE_TAC[GSYM FACE_OF_SING]; + REWRITE_TAC[facet_of]; + REPEAT WEAK_STRIP_TAC; + SUBCONJ_TAC; + DISCH_TAC; + INTRO_TAC (CONJUNCT1 SEGMENT_EQ_SING) [`b`;`b`;`b`]; + REWRITE_TAC[]; + DISCH_TAC; + FIRST_X_ASSUM_ST `voronoi_list` MP_TAC; + FIRST_X_ASSUM_ST `convex` kill; + ASM_REWRITE_TAC[]; + DISCH_TAC; + FIRST_X_ASSUM_ST `1` MP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[AFF_DIM_SING]; + BY(INT_ARITH_TAC); + DISCH_TAC; + GEN_TAC; + TYPIFY `{{a},{b}} f <=> f IN {{a},{b}}` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[IN]); + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + TYPIFY `aff_dim(segment[a,b]) - &1 = &0` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[arith ` &1 - int_of_num 1 = &0`]); + REWRITE_TAC[AFF_DIM_EQ_0]; + SUBGOAL_THEN `!(x:real^3). ~({x} = {})` ASSUME_TAC; + BY(SET_TAC[]); + REWRITE_TAC[TAUT `(b <=> a) <=> ((a ==> b) /\ (b ==> a))`]; + CONJ_TAC; + BY(DISCH_THEN DISJ_CASES_TAC THEN ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let PERMUTES_a_PERMUTES_b = prove_by_refinement( + `!p a b. a <= b /\ p permutes 0..a ==> p permutes 0..b`, + (* {{{ proof *) + [ + REWRITE_TAC[permutes;IN_NUMSEG]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MATCH_MP_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC) + ]);; + (* }}} *) + +let PERMUTE_BARV3 = prove_by_refinement( + `!V ul p. packing V /\ saturated V /\ ul IN barV V 3 /\ + hl (truncate_simplex 2 ul) < sqrt2 /\ p permutes 0..1 ==> + left_action_list p ul IN barV V 3`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `hl ul < sqrt2` ASM_CASES_TAC; + MATCH_MP_TAC Rogers.YIFVQDV_1; + ASM_REWRITE_TAC[GSYM Sphere.sqrt2]; + MATCH_MP_TAC PERMUTES_a_PERMUTES_b; + BY(ASM_MESON_TAC[arith `1 <= 3`]); + INTRO_TAC Ynhyjit.YNHYJIT [`V`;`ul`;`3`;`p`;`left_action_list p ul`]; + ASM_SIMP_TAC[GSYM Sphere.sqrt2;arith `3 -1 = 2`]; + ASM_SIMP_TAC[arith `~(x < y) ==> y <= x`]; + ANTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + CONJ_TAC; + BY(SET_TAC[]); + MATCH_MP_TAC PERMUTES_a_PERMUTES_b; + BY(ASM_MESON_TAC[arith `1 <= 2`]); + BY(MESON_TAC[IN]) + ]);; + (* }}} *) + +let ZASUVOR = prove_by_refinement( + `!V u0 u1 u2. packing V /\ saturated V /\ leaf V [u0;u1;u2] ==> + leaf V [u1;u0;u2] /\ (stem [u0;u1;u2] = stem [u1;u0;u2])`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC YBZFUPO [`V`;`[u0;u1;u2]`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC NWVRFMF [`V`;`[u0;u1;u2]`;`p1`]; + FIRST_X_ASSUM_ST `convex` kill; + ASM_REWRITE_TAC[]; + REWRITE_TAC[IN_INSERT]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC PERMUTES_SWAP [`0`;`1`;`0..1`]; + ANTS_TAC; + REWRITE_TAC[IN_NUMSEG]; + BY(ARITH_TAC); + DISCH_TAC; + CONJ2_TAC; + REWRITE_TAC[stem]; + REWRITE_TAC[Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_1]; + REWRITE_TAC[set_of_list]; + BY(SET_TAC[]); + SUBGOAL_THEN `left_action_list (swap(0,1)) vl IN barV V 3` ASSUME_TAC; + MATCH_MP_TAC PERMUTE_BARV3; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[leaf]); + FIRST_X_ASSUM_ST `leaf` MP_TAC; + REWRITE_TAC[leaf;IN]; + REWRITE_TAC[Pack_defs.HL;set_of_list]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `{u1,u0,u2} = {u0,u1,u2}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + ASM_REWRITE_TAC[]; + INTRO_TAC Packing3.TRUNCATE_SIMPLEX_BARV [`V`;`2`;`3`;`left_action_list (swap(0,1)) vl`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN;arith `2 <= 3`]); + TYPIFY `truncate_simplex 2 (left_action_list (swap (0,1)) vl) = [u1;u0;u2]` ENOUGH_TO_SHOW_TAC; + DISCH_THEN SUBST1_TAC; + BY(MESON_TAC[]); + TYPIFY `?w. left_action_list (swap (0,1)) vl = [u1;u0;u2;w]` ENOUGH_TO_SHOW_TAC; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_2]); + TYPIFY `EL 3 vl` EXISTS_TAC; + REWRITE_TAC[Pack_defs.left_action_list]; + REWRITE_TAC[Packing3.LIST_EL_EQ]; + TYPIFY `LENGTH vl = 4` (C SUBGOAL_THEN ASSUME_TAC); + REPEAT (FIRST_X_ASSUM_ST `barV` MP_TAC); + REWRITE_TAC[Sphere.BARV;IN]; + BY(MESON_TAC[arith `3 + 1 = 4`]); + REWRITE_TAC[Packing3.LENGTH_TABLE]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[LENGTH]; + CONJ_TAC; + BY(ARITH_TAC); + GEN_TAC; + SIMP_TAC[Packing3.EL_TABLE]; + REWRITE_TAC[INVERSE_SWAP]; + REWRITE_TAC[arith `j< 4 <=> (j = 0 \/ j = 1 \/ j = 2 \/ j = 3)`]; + INTRO_TAC (GSYM Packing3.EL_TRUNCATE_SIMPLEX) [`vl`;`2`]; + ASM_REWRITE_TAC[arith `2 + 1 <= 4`]; + BY(REPEAT WEAK_STRIP_TAC THEN ASM_SIMP_TAC[swap;EL;HD;arith `0 <= 2 /\ 1 <= 2 /\ 2 <= 2 /\ ~(1 = 0) /\ ~(2 = 1) /\ ~(2=0) /\ ~(3=0) /\ ~(3=1)`] THEN REWRITE_TAC[arith `1 = SUC 0 /\ 2 = SUC 1 /\ 3 = SUC 2`;EL;HD;TL]) + ]);; + (* }}} *) + +let NORM_FLATTEN = prove_by_refinement( + `!u w (p:real^A). norm (u - p) pow 2 - norm (w - p) pow 2 = (u dot u) - (w dot w) + &2 % (w - u) dot p`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[NORM_POW_2]; + BY(VECTOR_ARITH_TAC) + ]);; + (* }}} *) + +let truncate_set_of_list = prove_by_refinement( + `!(vl:(A)list) k. 0 < k /\ LENGTH vl = (k+1) ==> + set_of_list vl SUBSET set_of_list(truncate_simplex (k-1) vl) UNION {EL k vl}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[SUBSET]; + REWRITE_TAC[IN_SET_OF_LIST;IN_UNION;IN_SING]; + REWRITE_TAC[MEM_EXISTS_EL]; + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX; + TYPIFY `k - 1 + 1 = k` (C SUBGOAL_THEN SUBST1_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + ASM_CASES_TAC `i = (k:num)`; + BY(ASM_REWRITE_TAC[]); + DISJ1_TAC; + EXISTS_TAC `i:num`; + GMATCH_SIMP_TAC Packing3.EL_TRUNCATE_SIMPLEX; + ASM_REWRITE_TAC[]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC) + ]);; + (* }}} *) + +let DIST_LE_HALF_PLANE = prove_by_refinement( + `!x:real^A a:real^A b:real^A. + dist(x,a) <= dist(x,b) <=> &0 <= (a - b) dot (&2 % x - (a + b))`, +[ + ABBREV_TAC ` an a b x = ((a:real^A) - b) dot (&2 % x - (a + b))`; + REWRITE_TAC[dist; vector_norm]; + REWRITE_TAC[MESON[DOT_POS_LE; SQRT_MONO_LE_EQ]` sqrt ( x dot x) <= sqrt (y dot y) <=> x dot x <= y dot y `]; + REWRITE_TAC[DOT_LSUB; DOT_RSUB]; + SIMP_TAC[DOT_SYM]; + ONCE_REWRITE_TAC[ GSYM REAL_SUB_LE]; + REWRITE_TAC[ REAL_ARITH ` x dot x - b dot x - (b dot x - b dot b) - (x dot x - a dot x - (a dot x - a dot a)) = &2 * (a dot x - b dot x) + b dot b - a dot a`]; + REWRITE_TAC[GSYM DOT_LSUB; GSYM DOT_RMUL]; + REPEAT GEN_TAC; + TYPIFY `(a - b) dot &2 % x + b dot b - a dot a = (a - b) dot (&2 % x - (a + b))` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + REWRITE_TAC[arith `x - &0 = x`]; + BY(ASM_MESON_TAC[]) +]);; + +let DIST_EQ_HALF_PLANE = prove_by_refinement( + `!x:real^A a:real^A b:real^A. + dist(x,a) = dist(x,b) <=> &0 = (a - b) dot (&2 % x - (a + b))`, +[ + ABBREV_TAC ` an a b x = ((a:real^A) - b) dot (&2 % x - (a + b))`; + REWRITE_TAC[dist; vector_norm]; + REWRITE_TAC[MESON[DOT_POS_LE; SQRT_INJ]` sqrt ( x dot x) = sqrt (y dot y) <=> x dot x = y dot y `]; + REPEAT GEN_TAC; + ONCE_REWRITE_TAC[arith `x = y <=> y - x = &0`]; + TYPIFY `(x - b) dot (x - b) - (x - a) dot (x - a) = ((a - b) dot (&2 % x - (a + b)))` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + BY(ASM_MESON_TAC[arith `x - &0 = x`]) +]);; + +let FUZBZGI_0 = prove_by_refinement( +`!V ul p1 p2 t1 t2. packing V /\ saturated V /\ leaf V ul /\ + (voronoi_list V ul = convex hull {p1, p2}) /\ + ~(p1 = p2) /\ + (circumcenter (set_of_list ul) = t1 % p1 + t2 % p2) /\ + (t1 + t2 = &1) /\ + (!f. f facet_of voronoi_list V ul <=> f IN {{p1}, {p2}}) ==> + (&0 < t2)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + COMMENT "insert"; + TYPIFY `barV V 2 ul` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[leaf;IN]); + COMMENT "end insert"; + COMMENT "borrowed_from _1 lemma"; + INTRO_TAC NWVRFMF [`V`;`ul`;`p1`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(SET_TAC[]); + WEAK_STRIP_TAC; + ABBREV_TAC `q = t1 % p1 + t2 % (p2:real^3)`; + INTRO_TAC Rogers.XYOFCGX [`V`;`set_of_list ul`;`q`]; + ASM_REWRITE_TAC[]; + TYPIFY `set_of_list ul SUBSET V` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Packing3.BARV_SUBSET;leaf;IN]); + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ2_TAC; + FIRST_X_ASSUM_ST `leaf` MP_TAC; + REWRITE_TAC[leaf;Sphere.sqrt2;Pack_defs.HL]; + BY(MESON_TAC[]); + MATCH_MP_TAC Rogers.BARV_AFFINE_INDEPENDENT; + BY(ASM_MESON_TAC[leaf;IN]); + ONCE_REWRITE_TAC[DIST_SYM]; + REWRITE_TAC[arith `x > y <=> y < x`]; + REWRITE_TAC[Collect_geom.DIST_LT_HALF_PLANE]; + DISCH_THEN (C INTRO_TAC [`HD ul`;`EL 3 vl`]); + REWRITE_TAC[IN_DIFF]; + TYPIFY `HD ul IN set_of_list ul` (C SUBGOAL_THEN (ASSUME_TAC)); + REWRITE_TAC[IN_SET_OF_LIST]; + REWRITE_TAC[MEM_EXISTS_EL]; + EXISTS_TAC `0`; + REWRITE_TAC[EL]; + FIRST_X_ASSUM_ST `leaf` MP_TAC; + REWRITE_TAC[leaf;Sphere.BARV;IN]; + BY(ARITH_TAC); + TYPIFY `barV V 3 vl` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[IN]); + TYPIFY `EL 3 vl IN V` (C SUBGOAL_THEN (ASSUME_TAC)); + INTRO_TAC Packing3.BARV_SUBSET [`V`;`3`;`vl`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[ IN_SET_OF_LIST ; SUBSET; MEM_EXISTS_EL]; + (FIRST_X_ASSUM_ST `barV V 3` MP_TAC); + REWRITE_TAC[Sphere.BARV;IN]; + BY(MESON_TAC[arith `3 < 3 + 1`]); + ASM_REWRITE_TAC[]; + COMMENT "back to 1"; + TYPIFY `LENGTH vl = 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Sphere.BARV;arith `4 = 3 + 1`]); + INTRO_TAC Rogers.MHFTTZN1 [`V`;`vl`;`3`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + ANTS_TAC; + DISCH_TAC; + INTRO_TAC truncate_set_of_list [`vl`;`3`]; + ASM_SIMP_TAC[arith `0 < 3 /\ 3 + 1 = 4 /\ 3 - 1 = 2`]; + DISCH_TAC; + INTRO_TAC AFF_DIM_SUBSET [`set_of_list vl`;`set_of_list ul`]; + ANTS_TAC; + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); + BY(SET_TAC[]); + ASM_REWRITE_TAC[]; + TYPIFY `aff_dim (set_of_list ul) = &2` (C SUBGOAL_THEN SUBST1_TAC); + MATCH_MP_TAC Rogers.MHFTTZN1; + BY(ASM_MESON_TAC[leaf;IN]); + BY(INT_ARITH_TAC); + DISCH_TAC; + COMMENT "back to 1' do <=."; + TYPIFY `voronoi_list V ul SUBSET voronoi_closed V (HD ul)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Packing3.VORONOI_LIST_SUBSET_VORONOI_CLOSED; + FIRST_X_ASSUM_ST `leaf` MP_TAC; + REWRITE_TAC[IN;leaf;Sphere.BARV]; + BY(ARITH_TAC); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Pack2.VORONOI_CLOSED;SUBSET]; + REWRITE_TAC[IN_ELIM_THM]; + REWRITE_TAC[DIST_LE_HALF_PLANE]; + DISCH_THEN (C INTRO_TAC [`p2`]); + ASM_REWRITE_TAC[]; + (GMATCH_SIMP_TAC Marchal_cells_2_new.IN_SET_IMP_IN_CONVEX_HULL_SET); + CONJ_TAC; + BY(SET_TAC[]); + GOAL_TERM (fun w -> (DISCH_THEN (MP_TAC o (ISPEC ( env w `EL 3 vl`))))); + ASM_REWRITE_TAC[]; + DISCH_TAC; + COMMENT "back to 1a, do =."; + INTRO_TAC Marchal_cells_2_new.VORONOI_LIST_3_SINGLETON_EXPLICIT [`V`;`vl`]; + ASM_REWRITE_TAC[]; + WEAK_STRIP_TAC; + INTRO_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST [`V`;`vl`;`3`]; + ASM_REWRITE_TAC[IN_SING]; + DISCH_TAC; + COMMENT "back to 1b"; + INTRO_TAC Rogers.HL_PROPERTIES [`V`;`vl`;`3`]; + ASM_REWRITE_TAC[]; + GOAL_TERM (fun w -> (DISCH_THEN (MP_TAC o (ISPEC ( env w `EL 3 vl`))))); + REWRITE_TAC[IN_SET_OF_LIST]; + REWRITE_TAC[MEM_EXISTS_EL]; + ANTS_TAC; + EXISTS_TAC `3`; + BY(ASM_REWRITE_TAC[arith `3 < 4`]); + TYPIFY `dist (HD vl,circumcenter (set_of_list vl)) = dist (circumcenter (set_of_list vl), HD vl)` (C SUBGOAL_THEN SUBST1_TAC); + BY(MESON_TAC[DIST_SYM]); + REWRITE_TAC[DIST_EQ_HALF_PLANE]; + COMMENT "1c"; + TYPIFY `HD vl = HD ul` (C SUBGOAL_THEN SUBST1_TAC); + EXPAND_TAC "ul"; + MATCH_MP_TAC (GSYM Packing3.HD_TRUNCATE_SIMPLEX); + BY(ASM_REWRITE_TAC[arith `2 + 1 <= 4`]); + ONCE_REWRITE_TAC[arith `&0 = x <=> &0 = -- x`]; + TYPIFY ` --((EL 3 vl - HD ul) dot (&2 % circumcenter (set_of_list vl) - (EL 3 vl + HD ul))) = (( HD ul - EL 3 vl) dot (&2 % p1 - (HD ul + EL 3 vl)))` (C SUBGOAL_THEN SUBST1_TAC); + ASM_REWRITE_TAC[]; + BY(VECTOR_ARITH_TAC); + DISCH_TAC; + FIRST_X_ASSUM_ST `&0 < x` MP_TAC; + EXPAND_TAC "q"; + ABBREV_TAC `(w:real^3) = HD ul - EL 3 vl`; + TYPIFY `w dot (&2 % (t1 % p1 + t2 % p2) - (HD ul + EL 3 vl)) = t1 * (w dot (&2 % p1 - (HD ul + EL 3 vl))) + t2 * ( w dot (&2 % p2 - (HD ul + EL 3 vl)))` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM_ST `x = &1` MP_TAC; + REWRITE_TAC[arith `t1 + t2 = &1 <=> t2 = &1 - t1`]; + DISCH_THEN SUBST1_TAC; + BY(VECTOR_ARITH_TAC); + FIRST_X_ASSUM_ST `circumcenter` kill; + FIRST_X_ASSUM_ST `&0` (SUBST1_TAC o GSYM); + REWRITE_TAC[arith `t1 * &0 + x = x`]; + ASM_CASES_TAC `((w:real^3) dot (&2 % p2 - (HD ul + EL 3 vl))) = &0`; + BY(ASM_MESON_TAC[arith `~(&0 < t * &0)`]); + REWRITE_TAC[REAL_MUL_POS_LT]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let FUZBZGI_1 = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ leaf V ul ==> + ?p1 p2 t1 t2. + (voronoi_list V ul = convex hull {p1, p2}) /\ + ~(p1 = p2) /\ + (circumcenter (set_of_list ul) = t1 % p1 + t2 % p2) /\ + (t1 + t2 = &1) /\ + (&0 < t1 /\ &0 < t2)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC YBZFUPO [`V`;`ul`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `p1` EXISTS_TAC; + TYPIFY `p2` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `circumcenter (set_of_list ul) IN affine hull voronoi_list V ul` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC Rogers.MHFTTZN3 [`V`;`ul`;`2`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ASM_MESON_TAC[leaf;IN]); + BY(SET_TAC[]); + ASM_REWRITE_TAC[AFFINE_HULL_CONVEX_HULL;AFFINE_HULL_2]; + ABBREV_TAC `(q:real^3) = circumcenter (set_of_list ul)`; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `u` EXISTS_TAC; + TYPIFY `v` EXISTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + MATCH_MP_TAC FUZBZGI_0; + GOAL_TERM (fun w -> (GEXISTL_TAC ( envl w [`V`;`ul`;`p2`;`p1`;`v`]))); + ASM_REWRITE_TAC[]; + CONJ_TAC; + AP_TERM_TAC; + BY(SET_TAC[]); + CONJ_TAC; + BY(VECTOR_ARITH_TAC); + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `{{p1},{p2}} = {{p2},{p1}}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(REWRITE_TAC[]); + MATCH_MP_TAC FUZBZGI_0; + GOAL_TERM (fun w -> (GEXISTL_TAC ( envl w [`V`;`ul`;`p1`;`p2`;`u`]))); + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let chi_msb = new_definition `chi_msb ul p = + ((EL 1 ul - EL 0 ul) cross (EL 2 ul - EL 0 ul)) dot (p - EL 0 ul)`;; + +let chi_msb_swap_01 = prove_by_refinement( + `!a b c d. chi_msb [a;b;c] d = -- chi_msb [b;a;c] d`, + (* {{{ proof *) + [ + REWRITE_TAC[chi_msb;EL;HD;TL;arith `2 = SUC 1 /\ 1 = SUC 0`]; + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `(d - a) = (d - b) + (b - (a:real^3))` SUBST1_TAC; + BY(VECTOR_ARITH_TAC); + SUBGOAL_THEN `(c - a) = (c - b) + (b - (a:real^3))` SUBST1_TAC; + BY(VECTOR_ARITH_TAC); + REWRITE_TAC[CROSS_RADD;DOT_RADD]; + REWRITE_TAC[DOT_LADD]; + REWRITE_TAC[CROSS_REFL]; + REWRITE_TAC[DOT_LZERO]; + REWRITE_TAC[arith `x + &0 = x`]; + SUBGOAL_THEN `((b - a) cross (c - b)) dot (b - a) = &0` SUBST1_TAC; + BY(MESON_TAC[CROSS_TRIPLE;CROSS_REFL;DOT_LZERO]); + REWRITE_TAC[arith `x + &0 = x`]; + REWRITE_TAC[GSYM DOT_LNEG]; + AP_THM_TAC; + AP_TERM_TAC; + REWRITE_TAC[GSYM CROSS_LNEG]; + AP_THM_TAC THEN AP_TERM_TAC; + BY(VECTOR_ARITH_TAC) + ]);; + (* }}} *) + +let chi_msb_swap_23 = prove_by_refinement( + `!a b c d. chi_msb [a;b;c] d = -- chi_msb[a;b;d] c`, + (* {{{ proof *) + [ + REWRITE_TAC[chi_msb;EL;HD;TL;arith `2 = SUC 1 /\ 1 = SUC 0`]; + REPEAT WEAK_STRIP_TAC; + ONCE_REWRITE_TAC[CROSS_TRIPLE]; + REWRITE_TAC[GSYM DOT_LNEG]; + BY(REWRITE_TAC[GSYM CROSS_SKEW]) + ]);; + (* }}} *) + +let chi_msb_swap_12 = prove_by_refinement( + `!a b c d. chi_msb [a;b;c] d = -- chi_msb [a;c;b] d`, + (* {{{ proof *) + [ + REWRITE_TAC[chi_msb;EL;HD;TL;arith `2 = SUC 1 /\ 1 = SUC 0`]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[GSYM DOT_LNEG]; + AP_THM_TAC; + AP_TERM_TAC; + BY(REWRITE_TAC[GSYM CROSS_SKEW]) + ]);; + (* }}} *) + +let chi_msb_additive_a = prove_by_refinement( + `!a b c d t1 t2 t3 t4. (t1 + t2 + t3 + t4 = &1) ==> + (chi_msb [t1 % a + t2 % b + t3 % c + t4 % d;b;c] d) = t1 * (chi_msb [a;b;c] d)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ONCE_REWRITE_TAC[chi_msb_swap_01]; + REWRITE_TAC[chi_msb;EL;HD;TL;arith`2 = SUC 1 /\ 1 = SUC 0`]; + TYPIFY `(t1 % a + t2 % b + t3 % c + t4 % d) - b = t1 % (a - b) + t3 % (c - b) + t4 % (d - b)` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM (SUBST1_TAC o (MATCH_MP (arith `t1 + t2 + t3 + t4 = &1 ==> t2 = &1 - t1 - t3 -t4`))); + BY(VECTOR_ARITH_TAC); + REWRITE_TAC[GSYM DOT_LNEG;GSYM CROSS_LNEG]; + REWRITE_TAC[GSYM DOT_LMUL]; + TYPIFY `--(t1 % (a - b) + t3 % (c - b) + t4 % (d - b)) = t1 % (--(a-b)) + (-- t3) % (c - b) + (-- t4) % (d - b)` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + REWRITE_TAC[CROSS_LADD]; + REWRITE_TAC[DOT_LADD]; + REWRITE_TAC[CROSS_REFL;CROSS_LMUL]; + TYPIFY ` --t4 % ((d - b) cross (c - b)) dot (d - b) = &0` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[ DOT_LMUL]; + BY(MESON_TAC[CROSS_TRIPLE;CROSS_REFL;DOT_LZERO;arith `t * &0 = &0`]); + REWRITE_TAC[DOT_LMUL;DOT_LZERO]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let chi_msb_additive_d = prove_by_refinement( + `!a b c d t1 t2 t3 t4. (t1 + t2 + t3 + t4 = &1) ==> + chi_msb [a;b;c] (t1 % a + t2 % b + t3 % c + t4 % d) = t4 * chi_msb [a;b;c] d`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ONCE_REWRITE_TAC[chi_msb_swap_23]; + ONCE_REWRITE_TAC[chi_msb_swap_12]; + REWRITE_TAC[arith `-- -- x = x`]; + ONCE_REWRITE_TAC[chi_msb_swap_01]; + SUBST1_TAC (varith `t1 % a + t2 % b + t3 % c + t4 % d = t4 % d + t1 % (a:real^3) + t2 % b + t3 % c`); + REWRITE_TAC[arith `-- x = t * -- y <=> x = t * y`]; + MATCH_MP_TAC chi_msb_additive_a; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let CHI_MSB_ADDITIVE = prove_by_refinement( + `!ul t1 t2 p1 p2. (t1 + t2 = &1) ==> + chi_msb ul (t1 % p1 + t2 % p2) = t1 * chi_msb ul p1 + t2 * chi_msb ul p2`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[chi_msb]; + FIRST_X_ASSUM (SUBST1_TAC o (MATCH_MP (arith `t1 + t2 = &1 ==> t1 = &1 - t2`))); + BY(VECTOR_ARITH_TAC) + ]);; + (* }}} *) + +let CHI_MSB_CONVEX = prove_by_refinement( + `!ul. convex { p | &0 <= chi_msb ul p }`, + (* {{{ proof *) + [ + GEN_TAC; + REWRITE_TAC[ CONVEX_ALT]; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC CHI_MSB_ADDITIVE; + CONJ_TAC; + BY(REAL_ARITH_TAC); + MATCH_MP_TAC (arith `&0 <= x /\ &0 <= y ==> &0 <= x + y`); + GMATCH_SIMP_TAC REAL_LE_MUL; + GMATCH_SIMP_TAC REAL_LE_MUL; + ASM_REWRITE_TAC[]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let CHI_MSB_INCLUDES_CONVEX_HULL = prove_by_refinement( + `!S ul. S SUBSET {p | &0 <= chi_msb ul p } ==> + convex hull S SUBSET {p | &0 <= chi_msb ul p}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP Marchal_cells.CONVEX_HULL_SUBSET)); + BY(MESON_TAC[CHI_MSB_CONVEX;CONVEX_HULL_EQ]) + ]);; + (* }}} *) + + +let AFFINE_IMP_CHI_MSB_0 = prove_by_refinement( + `!ul (p:real^3). LENGTH ul = 3 /\ p IN affine hull (set_of_list ul) ==> + chi_msb ul p = &0`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP set_of_list3)); + FIRST_X_ASSUM_ST `IN` MP_TAC; + ASM_REWRITE_TAC[AFFINE_HULL_3]; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[chi_msb]; + FIRST_X_ASSUM_ST `&1` (unlist REWRITE_TAC o (MATCH_MP (arith `u + v + w = &1 ==> u = &1 - v - w`))); + TYPIFY `((EL 1 ul - EL 0 ul) cross (EL 2 ul - EL 0 ul)) dot (((&1 - v - w) % EL 0 ul + v % EL 1 ul + w % EL 2 ul) - EL 0 ul) = v * (((EL 1 ul - EL 0 ul) cross (EL 2 ul - EL 0 ul)) dot (EL 1 ul - EL 0 ul)) + w * (((EL 1 ul - EL 0 ul) cross (EL 2 ul - EL 0 ul)) dot (EL 2 ul - EL 0 ul))` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + MATCH_MP_TAC (arith `a = &0 /\ b = &0 ==> v *a + w * b = &0`); + CONJ_TAC; + ONCE_REWRITE_TAC[Trigonometry1.cross_triple]; + ONCE_REWRITE_TAC[Trigonometry1.cross_triple]; + BY(REWRITE_TAC[CROSS_REFL;DOT_LZERO]); + ONCE_REWRITE_TAC[Trigonometry1.cross_triple]; + BY(REWRITE_TAC[CROSS_REFL;DOT_LZERO]) + ]);; + (* }}} *) + +let CHI_MSB_IMP_COPLANAR = prove_by_refinement( + `!ul p. chi_msb ul p = &0 ==> coplanar { EL 0 ul, EL 1 ul, EL 2 ul, p}`, + (* {{{ proof *) + [ + BY(REWRITE_TAC[Local_lemmas.COPLANAR_IFF_CROSS_DOT;chi_msb]) + ]);; + (* }}} *) + +let CHI_MSB_COPLANAR = prove_by_refinement( + `!a b c d. coplanar {a,b,c,d} <=> chi_msb [a;b;c] d = &0`, + (* {{{ proof *) + [ + REWRITE_TAC[Local_lemmas.COPLANAR_IFF_CROSS_DOT]; + REWRITE_TAC[chi_msb]; + BY(REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1`]) + ]);; + (* }}} *) + + +let JDHAWAY_0 = prove_by_refinement( + `!V ul p1 p2 t1 t2. packing V /\ saturated V /\ leaf V ul /\ + (voronoi_list V ul = convex hull {p1, p2}) /\ + ~(p1 = p2) /\ + (circumcenter (set_of_list ul) = t1 % p1 + t2 % p2) /\ + (t1 + t2 = &1) /\ + (&0 < t1 /\ &0 < t2) ==> + ~(chi_msb ul p1 = &0)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP CHI_MSB_IMP_COPLANAR)); + TYPIFY `p1 IN affine hull (set_of_list ul)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC COPLANAR_INSERT; + CONJ2_TAC; + TYPIFY `p1 INSERT set_of_list ul = {EL 0 ul, EL 1 ul, EL 2 ul, p1}` ENOUGH_TO_SHOW_TAC; + BY(DISCH_THEN (unlist ASM_REWRITE_TAC)); + GMATCH_SIMP_TAC set_of_list3; + CONJ2_TAC; + BY(SET_TAC[]); + BY(ASM_MESON_TAC[leaf;IN;Sphere.BARV;arith `2 + 1 = 3`]); + MATCH_MP_TAC Rogers.MHFTTZN1; + BY(ASM_MESON_TAC[leaf;IN]); + INTRO_TAC Rogers.MHFTTZN3 [`V`;`ul`;`2`]; + ANTS_TAC; + BY(ASM_MESON_TAC[leaf;IN]); + REWRITE_TAC[EXTENSION;IN_INTER;IN_SING]; + DISCH_THEN (MP_TAC o (ISPEC `p1:real^3`)); + ASM_REWRITE_TAC[]; + REWRITE_TAC[AFFINE_HULL_CONVEX_HULL]; + TYPIFY `p1 IN affine hull {p1, p2}` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + INTRO_TAC Qzksykg.SET_SUBSET_AFFINE_HULL [`{p1,p2}`]; + BY(SET_TAC[]); + FIRST_X_ASSUM_ST `&1` MP_TAC; + REWRITE_TAC[arith `t1 + t2 = &1 <=> t1 = &1 - t2`]; + DISCH_THEN SUBST1_TAC; + TYPIFY `p1 = (&1 - t2) % p1 + t2 % p2 <=> t2 % p1 = t2 % p2` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + REWRITE_TAC[VECTOR_MUL_LCANCEL]; + BY(ASM_SIMP_TAC[arith `&0 < t ==> ~(t = &0)`]) + ]);; + (* }}} *) + +let JDHAWAY_1 = prove_by_refinement( + `!V ul. + packing V /\ saturated V /\ leaf V ul ==> + chi_msb ul (circumcenter (set_of_list ul)) = &0`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC AFFINE_IMP_CHI_MSB_0; + CONJ_TAC; + BY(ASM_MESON_TAC[leaf;IN;Sphere.BARV;arith `2+1 = 3`]); + MATCH_MP_TAC Rogers.BARV_CIRCUMCENTER_EXISTS; + BY(ASM_MESON_TAC[leaf;IN]) + ]);; + (* }}} *) + +let JDWAWAY = prove_by_refinement( + `!V ul p1 p2 t1 t2. + packing V /\ saturated V /\ leaf V ul /\ +(voronoi_list V ul = convex hull {p1, p2}) /\ + ~(p1 = p2) /\ + (circumcenter (set_of_list ul) = t1 % p1 + t2 % p2) /\ + (t1 + t2 = &1) /\ + (&0 < t1 /\ &0 < t2) ==> + ~(chi_msb ul p1 = &0) /\ ~(chi_msb ul p2 = &0) /\ + (chi_msb ul p1 < &0 <=> &0 < chi_msb ul p2)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + SUBCONJ_TAC; + INTRO_TAC JDHAWAY_0 [`V`;`ul`;`p1`;`p2`;`t1`;`t2`]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + SUBCONJ_TAC; + INTRO_TAC JDHAWAY_0 [`V`;`ul`;`p2`;`p1`;`t2`;`t1`]; + DISCH_THEN MATCH_MP_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + AP_TERM_TAC; + BY(SET_TAC[]); + CONJ_TAC; + BY(VECTOR_ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + DISCH_TAC; + INTRO_TAC JDHAWAY_1 [`V`;`ul`]; + ASM_SIMP_TAC[CHI_MSB_ADDITIVE]; + TYPIFY `&0 < chi_msb ul p2 <=> &0 < t2 * chi_msb ul p2` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[REAL_MUL_POS_LT]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + DISCH_THEN (SUBST1_TAC o (MATCH_MP (arith `t1 * x + y = &0 ==> y = t1 * (--x)`))); + REWRITE_TAC[REAL_MUL_POS_LT]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let cc_pe_exists = prove_by_refinement( + `!V ul. ?p1. (?p2. packing V /\ saturated V /\ leaf V ul ==> + (voronoi_list V ul = convex hull {p1, p2}) /\ + ~(p1 = p2) /\ + &0 < chi_msb ul p1) + `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[MESON[] `(?p. x ==> R p) <=> (x ==> ?p. R p)`]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC FUZBZGI_1 [`V`;`ul`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + ASM_CASES_TAC `&0 < chi_msb ul p1`; + GEXISTL_TAC [`p1`;`p2`]; + BY(ASM_REWRITE_TAC[]); + GEXISTL_TAC [`p2`;`p1`]; + ASM_REWRITE_TAC[]; + CONJ_TAC; + AP_TERM_TAC; + BY(SET_TAC[]); + INTRO_TAC (GSYM JDWAWAY) [`V`;`ul`;`p1`;`p2`;`t1`;`t2`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAK_STRIP_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let cc_pe = new_specification ["cc_pe1";"cc_pe2"] + (REWRITE_RULE[SKOLEM_THM] cc_pe_exists);; + +let FACET_OF_SEGMENT = prove_by_refinement( + `!a (b:real^A). ~(a = b) ==> {a} facet_of segment [a,b]`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[facet_of]; + REWRITE_TAC[AFF_DIM_SING]; + CONJ_TAC; + REWRITE_TAC[FACE_OF_SING]; + BY(REWRITE_TAC[EXTREME_POINT_OF_SEGMENT]); + CONJ_TAC; + BY(SET_TAC[]); + REWRITE_TAC[SEGMENT_CONVEX_HULL]; + REWRITE_TAC[AFF_DIM_CONVEX_HULL]; + REWRITE_TAC[AFF_DIM_2]; + ASM_REWRITE_TAC[]; + BY(INT_ARITH_TAC) + ]);; + (* }}} *) + +let CC_PE_FACET_OF = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ leaf V ul ==> + {cc_pe1 V ul} facet_of (voronoi_list V ul)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC cc_pe [`V`;`ul`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[GSYM SEGMENT_CONVEX_HULL ]; + MATCH_MP_TAC FACET_OF_SEGMENT; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let cc_uh_exists = prove_by_refinement( + `!V ul. ?vl. packing V /\ saturated V /\ leaf V ul ==> + vl IN barV V 3 /\ truncate_simplex 2 vl = ul /\ omega_list V vl = (cc_pe1 V ul)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[MESON[] `(?p. x ==> R p) <=> (x ==> ?p. R p)`]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC NWVRFMF [`V`;`ul`;`cc_pe1 V ul`]; + BY(ASM_SIMP_TAC[CC_PE_FACET_OF]) + ]);; + (* }}} *) + +let cc_uh = new_specification ["cc_uh"] + (REWRITE_RULE[SKOLEM_THM] cc_uh_exists);; + +let cc_ke = new_definition `cc_ke V ul = + if hl (cc_uh V ul) < sqrt2 then 4 else 3`;; + +let cc_A0 = new_definition + `cc_A0 (ul:(real^A) list) = aff_gt {EL 0 ul,EL 1 ul} {EL 2 ul}`;; + +let cc_cell = new_definition `cc_cell V ul = mcell (cc_ke V ul) V (cc_uh V ul)`;; + +let CC_CELL4 = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ leaf V ul /\ cc_ke V ul = 4 ==> + cc_cell V ul = convex hull set_of_list (cc_uh V ul)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[cc_cell;Pack_defs.mcell;arith `~(4=0) /\ ~(4=1) /\ ~(4=2) /\ ~(4=3)`]; + REWRITE_TAC[Pack_defs.mcell4]; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[cc_ke]; + REWRITE_TAC[Sphere.sqrt2]; + COND_CASES_TAC; + BY(REWRITE_TAC[]); + BY(REWRITE_TAC[arith `~(3=4)`]) + ]);; + (* }}} *) + +let CC_CELL3 = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ leaf V ul /\ cc_ke V ul = 3 ==> + cc_cell V ul = convex hull + (set_of_list (ul) UNION + {mxi V (cc_uh V ul)})`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[cc_cell;Pack_defs.mcell;arith `~(3=0) /\ ~(3=1) /\ ~(3=2)`]; + REWRITE_TAC[Pack_defs.mcell3]; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[cc_ke;GSYM Sphere.sqrt2]; + COND_CASES_TAC; + BY(REWRITE_TAC[arith `~(4=3)`]); + REWRITE_TAC[arith `3=3`]; + ASM_SIMP_TAC[arith `~(x < y) ==> (y <= x)`]; + INTRO_TAC cc_uh [`V`;`ul`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `leaf` MP_TAC; + REWRITE_TAC[leaf;IN;Sphere.BARV]; + REPEAT WEAK_STRIP_TAC; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let CC_KE_34 = prove_by_refinement( + `!V ul. cc_ke V ul = 3 \/ cc_ke V ul = 4`, + (* {{{ proof *) + [ + BY(MESON_TAC[cc_ke]) + ]);; + (* }}} *) + +let CC_CELL34 = prove_by_refinement( + `!V ul pp. packing V /\ saturated V /\ leaf V ul /\ + ((if (cc_ke V ul = 3) then mxi V (cc_uh V ul) else (EL 3 (cc_uh V ul))) = pp) ==> + cc_cell V ul = convex hull { EL 0 ul, EL 1 ul, EL 2 ul, pp}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + COND_CASES_TAC; + ASM_SIMP_TAC[CC_CELL3]; + DISCH_TAC; + AP_TERM_TAC; + GMATCH_SIMP_TAC set_of_list3; + CONJ_TAC; + BY(ASM_MESON_TAC[leaf;IN;Sphere.BARV;arith `2 + 1 = 3`]); + BY(SET_TAC[]); + SUBGOAL_THEN `cc_ke V ul = 4` ASSUME_TAC; + BY(ASM_MESON_TAC[CC_KE_34]); + ASM_SIMP_TAC[CC_CELL4]; + DISCH_TAC; + AP_TERM_TAC; + GMATCH_SIMP_TAC set_of_list4; + EXPAND_TAC "pp"; + CONJ_TAC; + INTRO_TAC cc_uh [`V`;`ul`]; + ASM_REWRITE_TAC[]; + BY(MESON_TAC[IN;Sphere.BARV;arith `3 + 1 = 4`]); + INTRO_TAC cc_uh [`V`;`ul`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Packing3.EL_TRUNCATE_SIMPLEX [`cc_uh V ul`;`2`]; + ASM_REWRITE_TAC[]; + TYPIFY `2 + 1 <= LENGTH (cc_uh V ul)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + FIRST_X_ASSUM_ST `barV` MP_TAC; + REWRITE_TAC[Sphere.BARV;IN]; + BY(MESON_TAC[arith `2 + 1 <= 3 + 1`]); + BY(MESON_TAC[arith `0 <= 2 /\ 1 <= 2 /\ 2 <= 2`]) + ]);; + (* }}} *) + +let U2_IN_CC_CELL = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ leaf V ul ==> + (EL 2 ul IN cc_cell V ul)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ABBREV_TAC `p = (if (cc_ke V ul = 3) then mxi V (cc_uh V ul) else (EL 3 (cc_uh V ul)))`; + INTRO_TAC CC_CELL34 [`V`;`ul`;`p`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + MATCH_MP_TAC Marchal_cells_2_new.IN_SET_IMP_IN_CONVEX_HULL_SET; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let U2_IN_AFF_GT = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ leaf V ul ==> + EL 2 ul IN aff_gt {EL 0 ul, EL 1 ul} {EL 2 ul}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC Local_lemmas.DISJOINT_IMP_Z_IN_AFF_GT; + REWRITE_TAC[DISJOINT;EXTENSION;NOT_IN_EMPTY;IN_INTER;IN_INSERT]; + GEN_TAC; + DISCH_TAC; + INTRO_TAC GBEWYFX [`V`;`ul`]; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC set_of_list3; + CONJ_TAC; + BY(ASM_MESON_TAC[leaf;IN;Sphere.BARV;arith `2 + 1 = 3`]); + FIRST_X_ASSUM MP_TAC; + REPEAT WEAK_STRIP_TAC; + TYPIFY `{EL 0 ul, EL 1 ul, EL 2 ul} = { EL 0 ul, EL 1 ul}` (C SUBGOAL_THEN SUBST1_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + BY(REWRITE_TAC[COLLINEAR_2]); + TYPIFY `{EL 0 ul, EL 1 ul, EL 2 ul} = { EL 0 ul, EL 1 ul}` (C SUBGOAL_THEN SUBST1_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + BY(REWRITE_TAC[COLLINEAR_2]) + ]);; + (* }}} *) + +let EL_CC_UH = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ leaf V ul ==> + EL 0 (cc_uh V ul) = EL 0 ul /\ + EL 1 (cc_uh V ul) = EL 1 ul /\ + EL 2 (cc_uh V ul) = EL 2 ul`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC cc_uh [`V`;`ul`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Packing3.EL_TRUNCATE_SIMPLEX [`cc_uh V ul`;`2`]; + TYPIFY `2 + 1 <= LENGTH (cc_uh V ul)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(ASM_MESON_TAC[Sphere.BARV;IN;arith `2 + 1 <= 3 + 1`]); + BY(ASM_MESON_TAC[arith `0 <= 2 /\ 1 <= 2 /\ 2 <= 2`]) + ]);; + (* }}} *) + +let NUNRRDS_0 = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ leaf V ul ==> + ~(cc_A0 ul INTER cc_cell V ul = {})`, + (* {{{ proof *) + [ + REWRITE_TAC[EXTENSION;NOT_IN_EMPTY;IN_INTER]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPEC ( env w `EL 2 ul`))))); + REWRITE_TAC[]; + REWRITE_TAC[cc_A0]; + CONJ2_TAC; + MATCH_MP_TAC U2_IN_CC_CELL; + BY(ASM_REWRITE_TAC[]); + COMMENT "second side"; + MATCH_MP_TAC U2_IN_AFF_GT; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let AFF_GE_MONO_TRANS = prove_by_refinement( + `!X Y (S:real^A->bool). S SUBSET X ==> aff_ge (X DIFF S) (Y UNION S) SUBSET aff_ge X Y`, + (* {{{ proof *) + [ + BY(MESON_TAC[Local_lemmas.AFF_GE_MONO_TRANS]) + ]);; + (* }}} *) + +let NUNRRDS_1 = prove_by_refinement( + `!V ul pp. packing V /\ saturated V /\ leaf V ul /\ + (if (cc_ke V ul = 3) then mxi V (cc_uh V ul) else (EL 3 (cc_uh V ul))) = pp + ==> + cc_cell V ul SUBSET aff_ge {EL 0 ul, EL 1 ul, EL 2 ul} {pp}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC CC_CELL34 [`V`;`ul`;`pp`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[CONVEX_HULL_AFF_GE]; + INTRO_TAC (AFF_GE_MONO_TRANS) [`{EL 0 ul, EL 1 ul, EL 2 ul}`;`{pp}`;`{EL 0 ul, EL 1 ul, EL 2 ul}`]; + ANTS_TAC; + BY(SET_TAC[]); + TYPIFY `{EL 0 ul, EL 1 ul, EL 2 ul} DIFF {EL 0 ul, EL 1 ul, EL 2 ul} = {}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + TYPIFY `{pp} UNION {EL 0 ul, EL 1 ul, EL 2 ul} = {EL 0 ul, EL 1 ul, EL 2 ul, pp}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let CELL4_NONDEG = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ leaf V ul /\ (cc_ke V ul = 4) ==> + ~(EL 3 (cc_uh V ul) IN affine hull (set_of_list ul))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Rogers.MHFTTZN1 [`V`;`ul`;`2`]; + INTRO_TAC Rogers.MHFTTZN1 [`V`;`cc_uh V ul`;`3`]; + INTRO_TAC cc_uh [`V`;`ul`]; + ASM_SIMP_TAC[IN]; + WEAK_STRIP_TAC; + WEAK_STRIP_TAC; + TYPIFY `barV V 2 ul` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(ASM_MESON_TAC[leaf;IN]); + DISCH_TAC; + TYPIFY `set_of_list (cc_uh V ul) = (EL 3 (cc_uh V ul)) INSERT (set_of_list ul)` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC set_of_list4; + GMATCH_SIMP_TAC set_of_list3; + CONJ_TAC; + BY(ASM_MESON_TAC[leaf;IN;Sphere.BARV;arith `2+1=3`]); + CONJ_TAC; + BY(ASM_MESON_TAC[Sphere.BARV;arith `3 + 1 = 4`]); + ASM_SIMP_TAC[EL_CC_UH]; + BY(SET_TAC[]); + COMMENT "1"; + FIRST_X_ASSUM_ST `int_of_num 3` MP_TAC; + ASM_REWRITE_TAC[]; + ASM_REWRITE_TAC[AFF_DIM_INSERT]; + BY(INT_ARITH_TAC) + ]);; + (* }}} *) + +let K4_CHI_MSB_EQVL = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ leaf V ul /\ + (cc_ke V ul = 4) + ==> + re_eqvl (chi_msb ul (EL 3 (cc_uh V ul))) (chi_msb ul (cc_pe1 V ul))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC cc_uh [`V`;`ul`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Rogers.XNHPWAB2 [`V`;`cc_uh V ul`;`3`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ASM_MESON_TAC[cc_ke;arith `~(3 = 4)`;Sphere.sqrt2]); + GMATCH_SIMP_TAC set_of_list4; + CONJ_TAC; + BY(ASM_MESON_TAC[Sphere.BARV;IN;arith `3 + 1 =4`]); + REWRITE_TAC[Marchal_cells_2_new.CONVEX_HULL_4;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `chi_msb ul = chi_msb [EL 0 ul;EL 1 ul;EL 2 ul]` (C SUBGOAL_THEN SUBST1_TAC); + ONCE_REWRITE_TAC[FUN_EQ_THM]; + BY(REWRITE_TAC[chi_msb;HD;TL;EL;arith `1 = SUC 0 /\ 2 = SUC 1`]); + INTRO_TAC EL_CC_UH [`V`;`ul`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC chi_msb_additive_d; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC RE_EQVL_SCALE2; + REWRITE_TAC[RE_EQVL_REFL]; + ASM_SIMP_TAC[arith `&0 <= z ==> (&0 < z <=> ~(z = &0))`]; + DISCH_TAC; + TYPIFY `chi_msb ul (cc_pe1 V ul) = &0` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[]; + TYPIFY `chi_msb ul = chi_msb [EL 0 ul;EL 1 ul;EL 2 ul]` (C SUBGOAL_THEN SUBST1_TAC); + ONCE_REWRITE_TAC[FUN_EQ_THM]; + BY(REWRITE_TAC[chi_msb;HD;TL;EL;arith `1 = SUC 0 /\ 2 = SUC 1`]); + GMATCH_SIMP_TAC chi_msb_additive_d; + ASM_REWRITE_TAC[arith `&0 * t = &0`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + INTRO_TAC cc_pe [`V`;`ul`]; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let K4_CHI_MSB_POS = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ leaf V ul /\ + (cc_ke V ul = 4) + ==> + ( &0 < chi_msb ul (EL 3 (cc_uh V ul )))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC K4_CHI_MSB_EQVL [`V`;`ul`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[Trigonometry2.re_eqvl]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_REWRITE_TAC[]; + INTRO_TAC cc_pe [`V`;`ul`]; + ASM_REWRITE_TAC[]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let MXI_BETWEEN = prove_by_refinement( + `!V ul vl. packing V /\ saturated V /\ leaf V ul /\ cc_ke V ul = 3 /\ + cc_uh V ul = vl ==> + between (mxi V vl) (omega_list_n V vl 2, omega_list_n V vl 3) /\ + dist(EL 0 ul, mxi V vl) = sqrt2`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Marchal_cells_2_new.MXI_EXPLICIT [`V`;`cc_uh V ul`;`EL 0 ul`;`EL 1 ul`;`EL 2 ul`;`EL 3 (cc_uh V ul)`]; + INTRO_TAC EL_CC_UH [`V`;`ul`]; + INTRO_TAC cc_uh [`V`;`ul`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[GSYM Sphere.sqrt2]; + ANTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + CONJ_TAC; + FIRST_X_ASSUM_ST `barV` MP_TAC; + REWRITE_TAC[LENGTH4;IN;Sphere.BARV;arith `3 + 1 =4`]; + REPEAT WEAK_STRIP_TAC; + BY(ASM_MESON_TAC[ LENGTH4]); + CONJ_TAC; + BY(ASM_MESON_TAC[leaf]); + BY(ASM_MESON_TAC[cc_ke;arith `~(4 = 3)`;arith `sqrt2 <= x <=> ~(x < sqrt2)`]); + REPEAT WEAK_STRIP_TAC; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let affine_invert = prove_by_refinement( + `!u p (q:real^A) s. ~(u= &0) /\ affine s /\ (&1 - u) % p + u % q IN s /\ p IN s ==> + q IN s`, + (* {{{ proof *) + [ + REWRITE_TAC[affine]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`((&1 - u) % p + u % q)`;`p`;`inv u`;`&1 - inv u`]); + ASM_REWRITE_TAC[arith `x + &1 - x = &1`]; + TYPIFY `inv u % ((&1 - u) % p + u % q) + (&1 - inv u) % p = q` (C SUBGOAL_THEN SUBST1_TAC); + TYPIFY `inv u % ((&1 - u) % p + u % q) + (&1 - inv u) % p = (inv u * (&1 - u) + (&1 - inv u)) % p + (inv u * u) % q` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + TYPIFY `(inv u * (&1 - u) + &1 - inv u) = &0` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `(inv u * u) = &1` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + BY(ASM_REWRITE_TAC[]); + BY(VECTOR_ARITH_TAC); + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let CELL3_NONDEG = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ leaf V ul /\ cc_ke V ul = 3 ==> + ~(mxi V (cc_uh V ul) IN affine hull (set_of_list ul)) /\ + &0 < chi_msb ul (mxi V (cc_uh V ul))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ABBREV_TAC `vl = cc_uh V ul`; + INTRO_TAC MXI_BETWEEN [`V`;`ul`;`vl`]; + ASM_REWRITE_TAC[BETWEEN_IN_SEGMENT;closed_segment;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC cc_pe [`V`;`ul`]; + INTRO_TAC cc_uh [`V`;`ul`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `LENGTH vl = 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Sphere.BARV;IN;arith `3 + 1 = 4`]); + INTRO_TAC Sphere.OMEGA_LIST [`V`;`vl`]; + ASM_REWRITE_TAC[arith `4 - 1 = 3`]; + DISCH_TAC; + INTRO_TAC EL_CC_UH [`V`;`ul`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `omega_list_n V vl 2 = circumcenter (set_of_list ul)` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC (GSYM Rogers.XNHPWAB1) [`V`;`ul`;`2`]; + ASM_REWRITE_TAC[GSYM Sphere.sqrt2]; + ANTS_TAC; + BY(ASM_MESON_TAC[leaf;IN]); + DISCH_THEN SUBST1_TAC; + FIRST_X_ASSUM_ST `leaf` MP_TAC; + REWRITE_TAC[leaf;IN;Sphere.BARV;arith `2 + 1 =3`]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[Pack_concl.JJGTQMN;arith `3 - 1 = 2`]; + INTRO_TAC Packing3.TRUNCATE_SIMPLEX_REFL [`2`;`ul`]; + ASM_REWRITE_TAC[arith `3 = 2 + 1`]; + REPEAT (GMATCH_SIMP_TAC (GSYM Packing3.OMEGA_LIST_LEMMA)); + ASM_REWRITE_TAC[arith `2 + 1 <= 3 /\ 2 + 1 <= 4`]; + BY(ASM_MESON_TAC[]); + GMATCH_SIMP_TAC CHI_MSB_ADDITIVE; + ASM_REWRITE_TAC[arith `&1 - u + u = &1`]; + GMATCH_SIMP_TAC JDHAWAY_1; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[arith `x * &0 + v = v`]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_SIMP_TAC[arith `&0 <= u ==> (&0 < u <=> ~(u = &0))`]; + SUBGOAL_THEN ` &0 < chi_msb ul (omega_list_n V vl 3)` (unlist REWRITE_TAC); + BY(ASM_MESON_TAC[]); + COMMENT "1"; + ASM_CASES_TAC `u = &0`; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `&1 - u` MP_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[VECTOR_MUL_LID;arith `&1 - &0 = &1 /\ x + &0 = x`;VECTOR_MUL_LZERO;VECTOR_ADD_RID]; + DISCH_TAC; + FIRST_X_ASSUM_ST `leaf` MP_TAC; + REWRITE_TAC[leaf;IN]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `hl` MP_TAC; + REWRITE_TAC[]; + GMATCH_SIMP_TAC Rogers.HL_EQ_DIST0; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[DIST_SYM;EL;arith `~(sqrt2 < sqrt2)`]); + ASM_REWRITE_TAC[]; + SUBGOAL_THEN `&0 < u` ASSUME_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + DISCH_TAC; + TYPIFY `cc_pe1 V ul IN affine hull set_of_list ul` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC affine_invert; + GEXISTL_TAC [`u`;`circumcenter (set_of_list ul)`]; + ASM_REWRITE_TAC[AFFINE_AFFINE_HULL]; + MATCH_MP_TAC Rogers.BARV_CIRCUMCENTER_EXISTS; + BY(ASM_MESON_TAC[leaf;IN]); + DISCH_TAC; + FIRST_X_ASSUM_ST `chi_msb` MP_TAC; + REWRITE_TAC[]; + MATCH_MP_TAC (arith `(x = &0) ==> ~(&0 < x)`); + MATCH_MP_TAC AFFINE_IMP_CHI_MSB_0; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[leaf;IN;Sphere.BARV;arith `2 + 1 = 3`]) + ]);; + (* }}} *) + +let CELL_NN = prove_by_refinement( + `!V ul p. packing V /\ saturated V /\ leaf V ul /\ + p IN cc_cell V ul ==> &0 <= chi_msb ul p`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `LENGTH ul = 3` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[leaf;IN;Sphere.BARV;arith `2 + 1 = 3`]); + INTRO_TAC CHI_MSB_CONVEX [`ul`]; + FIRST_X_ASSUM_ST `cc_cell` MP_TAC; + GMATCH_SIMP_TAC CC_CELL34; + ABBREV_TAC `pp = (if cc_ke V ul = 3 then mxi V (cc_uh V ul) else EL 3 (cc_uh V ul))`; + GEXISTL_TAC [`pp`]; + ASM_REWRITE_TAC[]; + INTRO_TAC Marchal_cells.CONVEX_HULL_SUBSET [`{EL 0 ul, EL 1 ul, EL 2 ul, pp}`;`{p | &0 <= chi_msb ul p}`]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `SUBSET` MP_TAC; + ANTS_TAC; + REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY;IN_ELIM_THM]; + GEN_TAC; + SUBGOAL_THEN `&0 <= chi_msb ul pp` ASSUME_TAC; + MATCH_MP_TAC (arith `&0 < x ==> &0 <= x`); + EXPAND_TAC "pp"; + COND_CASES_TAC; + INTRO_TAC CELL3_NONDEG [`V`;`ul`]; + BY(ASM_MESON_TAC[]); + SUBGOAL_THEN `cc_ke V ul = 4` ASSUME_TAC; + BY(ASM_MESON_TAC[CC_KE_34]); + MATCH_MP_TAC K4_CHI_MSB_POS; + BY(ASM_REWRITE_TAC[]); + SUBGOAL_THEN `x IN set_of_list ul ==> &0 <= chi_msb ul x` ASSUME_TAC; + DISCH_TAC; + MATCH_MP_TAC (arith ` x = &0 ==> &0 <= x`); + MATCH_MP_TAC AFFINE_IMP_CHI_MSB_0; + BY(ASM_MESON_TAC[SUBSET;Qzksykg.SET_SUBSET_AFFINE_HULL]); + FIRST_X_ASSUM MP_TAC; + GMATCH_SIMP_TAC set_of_list3; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(ASM_MESON_TAC[]); + TYPIFY `convex hull {p | &0 <= chi_msb ul p} = {p | &0 <= chi_msb ul p}` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_MESON_TAC[CONVEX_HULL_EQ]); + REWRITE_TAC[SUBSET;IN_ELIM_THM]; + DISCH_THEN MATCH_MP_TAC; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let delta_delta_x = prove_by_refinement( + `!x1 x2 x3 x4 x5 x6. delta x1 x2 x3 x6 x5 x4 = delta_x x1 x2 x3 x4 x5 x6 `, + (* {{{ proof *) + [ + REWRITE_TAC[Collect_geom.delta;Sphere.delta_x]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let ZWVCBMN = prove_by_refinement( + `!a b c d. ~coplanar {a,b,c,d} ==> &0 < vol (convex hull {a,b,c,d})`, + (* {{{ proof *) + [ + REWRITE_TAC[VOLUME_OF_CLOSED_TETRAHEDRON]; + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC REAL_LT_DIV; + REWRITE_TAC[ REAL_OF_NUM_LT]; + GMATCH_SIMP_TAC REAL_LT_RSQRT; + REWRITE_TAC[GSYM delta_delta_x]; + INTRO_TAC (REWRITE_RULE[LET_DEF;LET_END_DEF] (GSYM Collect_geom.POLFLZY)) [`a`;`b`;`c`;`d`]; + INTRO_TAC coplanar_eq_coplanar_alt [`{a,b,c,d}`]; + REWRITE_TAC[DIMINDEX_3]; + ANTS_TAC; + BY(ARITH_TAC); + DISCH_THEN (SUBST1_TAC o GSYM); + ASM_REWRITE_TAC[]; + DISCH_TAC; + ASM_SIMP_TAC[arith `0 < 12`;arith `~(x = &0) ==> (&0 pow 2 < x <=> &0 <= x)`]; + BY(MESON_TAC[Collect_geom2.DELTA_POS_4POINTS]) + ]);; + (* }}} *) + +let MCELL4_NONPLANAR = prove_by_refinement( + `!V vl. packing V /\ saturated V /\ barV V 3 vl /\ hl vl < sqrt2 ==> + ~coplanar (mcell4 V vl)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Rogers.MHFTTZN1 [`V`;`vl`;`3`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC Pack_defs.mcell4 [`V`;`vl`]; + ASM_REWRITE_TAC[GSYM Sphere.sqrt2]; + DISCH_TAC; + FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP COPLANAR_IMP_AFF_DIM)); + INTRO_TAC AFF_DIM_SUBSET [`set_of_list vl`;`convex hull set_of_list vl`]; + ANTS_TAC; + BY(MESON_TAC[HULL_SUBSET]); + REPEAT (FIRST_X_ASSUM_ST `aff_dim` MP_TAC); + ASM_REWRITE_TAC[]; + BY(INT_ARITH_TAC) + ]);; + (* }}} *) + +let MXI_IN_VORONOI_LIST = prove_by_refinement( + `!V vl. packing V /\ saturated V /\ barV V 3 vl /\ sqrt2 <= hl vl /\ + hl (truncate_simplex 2 vl) < sqrt2 ==> + mxi V vl IN voronoi_list V (truncate_simplex 2 vl) /\ + dist(EL 0 vl,mxi V vl) = sqrt2`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN [`V`;`vl`;`3`;`2`;`2`]; + INTRO_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN [`V`;`vl`;`3`;`2`;`3`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ARITH_TAC); + DISCH_TAC; + ANTS_TAC; + BY(ARITH_TAC); + DISCH_TAC; + INTRO_TAC Packing3.CONVEX_VORONOI_LIST [`V`;`truncate_simplex 2 vl`]; + DISCH_TAC; + INTRO_TAC Marchal_cells_2_new.MXI_EXPLICIT [`V`;`vl`;`EL 0 vl`;`EL 1 vl`;`EL 2 vl`;`EL 3 vl`]; + REWRITE_TAC[BETWEEN_IN_CONVEX_HULL]; + ANTS_TAC; + ASM_REWRITE_TAC[GSYM Sphere.sqrt2]; + GMATCH_SIMP_TAC LENGTH4; + REWRITE_TAC[EL;HD;TL;arith `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]; + BY(ASM_MESON_TAC[Sphere.BARV;IN;arith `3+1=4`]); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[Sphere.sqrt2]; + TYPED_ABBREV_TAC `(a:real^3->bool) = voronoi_list V (truncate_simplex 2 vl)` ; + TYPIFY `{omega_list_n V vl 2,omega_list_n V vl 3} SUBSET a` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP Marchal_cells.CONVEX_HULL_SUBSET)); + BY(ASM_MESON_TAC[CONVEX_HULL_EQ;Packing3.IN_TRANS]) + ]);; + (* }}} *) + +let VORONOI_LIST_EQ = prove_by_refinement( + `!V ul p k. p IN voronoi_list V ul /\ barV V k ul==> + (?r. !q. q IN set_of_list ul ==> dist(p,q) = r)`, + (* {{{ proof *) + [ + REWRITE_TAC[Sphere.VORONOI_LIST;Sphere.VORONOI_SET;Sphere.voronoi_closed;IN_INTERS;IN_ELIM_THM;LEFT_IMP_EXISTS_THM]; + REPEAT GEN_TAC; + ONCE_REWRITE_TAC[MESON [] `(!p q. R p q) <=> (!q p. R p q)`]; + REWRITE_TAC[TAUT `(a /\ b ==> c) <=> (a ==> b ==> c)`]; + REWRITE_TAC[MESON[] `!a. (!p. a ==> b p) <=> (a ==> (!p. b p))`]; + REWRITE_TAC[MESON[] `!a p. (!t. (t = a) ==> (p IN t)) <=> (p IN a)`]; + REWRITE_TAC[IN_ELIM_THM]; + TYPIFY `set_of_list ul = {}` ASM_CASES_TAC; + BY(ASM_REWRITE_TAC[NOT_IN_EMPTY]); + FIRST_X_ASSUM (MP_TAC o (REWRITE_RULE[Misc_defs_and_lemmas.EMPTY_EXISTS])); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `dist(p,u)`))); + REPEAT WEAK_STRIP_TAC; + BY(ASM_MESON_TAC[Packing3.BARV_SUBSET;arith `x <= y /\ y <= x ==> (x = y)`;IN;SUBSET]) + ]);; + (* }}} *) + +let NOT_COL_IMP_RADV = prove_by_refinement( + `!va vb (vc:real^3). ~collinear {va, vb, vc} + ==> (!w. w IN {va, vb, vc} + ==> radV {va, vb, vc} = dist (circumcenter {va, vb, vc},w))`, + (* {{{ proof *) + [ + MESON_TAC[IN;Collect_geom.NOT_COL_IMP_RADV_PROPERTIY] + ]);; + (* }}} *) + +let MCELL3_NONPLANAR = prove_by_refinement( + `!V vl. packing V /\ saturated V /\ barV V 3 vl /\ sqrt2 <= hl vl /\ + hl (truncate_simplex 2 vl) < sqrt2 ==> + ~coplanar (mcell3 V vl)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `LENGTH vl = 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Sphere.BARV;IN;arith `3+1 = 4`]); + INTRO_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX [`2`;`vl`]; + ANTS_TAC; + BY(ASM_MESON_TAC[arith `2 + 1 <= 4`]); + REWRITE_TAC[arith `2 + 1 = 3`]; + DISCH_TAC; + TYPIFY `coplanar (set_of_list (truncate_simplex 2 vl))` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC set_of_list3; + BY(ASM_REWRITE_TAC[COPLANAR_3]); + INTRO_TAC Pack_defs.mcell3 [`V`;`vl`]; + ASM_REWRITE_TAC[GSYM Sphere.sqrt2]; + DISCH_TAC; + TYPIFY `set_of_list(truncate_simplex 2 vl) = {EL 0 vl,EL 1 vl,EL 2 vl}` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC set_of_list3; + ASM_REWRITE_TAC[]; + REPEAT (GMATCH_SIMP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + ASM_REWRITE_TAC[]; + BY(ARITH_TAC); + TYPIFY `barV V 2 (truncate_simplex 2 vl)` (C SUBGOAL_THEN ASSUME_TAC); + GMATCH_SIMP_TAC Packing3.TRUNCATE_SIMPLEX_BARV; + BY(ASM_MESON_TAC[arith `2 <= 3`]); + COMMENT "GBE"; + INTRO_TAC GBEWYFX [`V`;`truncate_simplex 2 vl`]; + ANTS_TAC; + BY(ASM_SIMP_TAC[leaf;IN]); + DISCH_TAC; + COMMENT "main reduction"; + TYPIFY `(mxi V vl IN affine hull set_of_list (truncate_simplex 2 vl))` ENOUGH_TO_SHOW_TAC; + DISCH_TAC; + INTRO_TAC Rogers.OAPVION3 [`set_of_list (truncate_simplex 2 vl)`]; + ANTS_TAC; + DISCH_TAC; + FIRST_X_ASSUM_ST `collinear` MP_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC AFFINE_DEPENDENT_IMP_COLLINEAR_3; + BY(ASM_MESON_TAC[]); + GOAL_TERM (fun w -> (DISCH_THEN (MP_TAC o (ISPEC ( env w `mxi V vl`))))); + ASM_REWRITE_TAC[]; + INTRO_TAC MXI_IN_VORONOI_LIST [`V`;`vl`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ANTS_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `sqrt2`))); + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + GEN_TAC; + DISCH_TAC; + INTRO_TAC VORONOI_LIST_EQ [`V`;`truncate_simplex 2 vl`;`mxi V vl`;`2`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAK_STRIP_TAC; + FIRST_ASSUM MP_TAC; + DISCH_THEN GMATCH_SIMP_TAC; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + GOAL_TERM (fun w -> (FIRST_X_ASSUM (MP_TAC o (ISPEC ( env w `EL 0 vl`))))); + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + BY(ASM_MESON_TAC[DIST_SYM]); + INTRO_TAC GBEWYFX [`V`;`truncate_simplex 2 vl`]; + ANTS_TAC; + BY(ASM_SIMP_TAC[leaf;IN]); + FIRST_X_ASSUM_ST `hl` MP_TAC; + ASM_REWRITE_TAC[Pack_defs.HL]; + INTRO_TAC NOT_COL_IMP_RADV [`EL 0 vl`;`EL 1 vl`; `EL 2 vl`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + FIRST_X_ASSUM MP_TAC; + BY(MESON_TAC[arith `~(sqrt2 < sqrt2)` ; DIST_SYM]); + COMMENT "back to 1 goal"; + TYPIFY `coplanar (set_of_list (truncate_simplex 2 vl) UNION {mxi V vl})` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC COPLANAR_SUBSET; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `mcell3 V vl`))); + ASM_REWRITE_TAC[]; + BY(MESON_TAC[HULL_SUBSET]); + COMMENT "1b"; + TYPIFY `aff_dim (set_of_list (truncate_simplex 2 vl) UNION {mxi V vl}) <= &2` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC COPLANAR_IMP_AFF_DIM; + BY(ASM_REWRITE_TAC[]); + TYPIFY `&2 <= aff_dim (set_of_list (truncate_simplex 2 vl))` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC COLLINEAR_AFF_DIM [`(set_of_list (truncate_simplex 2 vl))`]; + ASM_REWRITE_TAC[]; + BY(INT_ARITH_TAC); + FIRST_X_ASSUM_ST `UNION` MP_TAC; + COMMENT "1c"; + INTRO_TAC AFF_DIM_INSERT [`mxi V vl`;`set_of_list (truncate_simplex 2 vl)`]; + COND_CASES_TAC; + BY(REWRITE_TAC[]); + FIRST_X_ASSUM_ST `aff_dim` MP_TAC; + TYPIFY `mxi V vl INSERT set_of_list (truncate_simplex 2 vl) = set_of_list (truncate_simplex 2 vl) UNION {mxi V vl}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(INT_ARITH_TAC) + ]);; + (* }}} *) + +let MCELL2_SUBSET_AFF_GE = prove_by_refinement( + `!V ul. mcell2 V ul SUBSET aff_ge {HD ul, HD (TL ul)} {mxi V ul, omega_list_n V ul 3}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Pack_defs.mcell2]; + COND_CASES_TAC; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + BY(SET_TAC[]); + BY(SET_TAC[]) + ]);; + (* }}} *) + +let CONDS_IN_CONV2 = prove_by_refinement( + `!t2 t3 (v:real^A) w. &0 <= t2 /\ &0 <= t3 /\ ~(t2 = &0 /\ t3 = &0) + ==> t2 / (t2 + t3) % v + t3 / (t2 + t3) % w IN conv {v, w}`, + (* {{{ proof *) + [ + MESON_TAC[Local_lemmas.CONDS_IN_CONV2] + ]);; + (* }}} *) + +let NEG_SIGNS_LEMMA = prove_by_refinement( + `!(a:real^3) b c d t0' t0'' t1 t1' s s'. + aff {a, b} INTER conv {c, d} = {} /\ + c = t0' % a + t1 % b + s % p /\ + t0' + t1 + s = &1 /\ + d = t0'' % a + t1' % b + s' % p /\ + t0'' + t1' + s' = &1 +==> + s < &0 ==> s' < &0`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[arith `s' < &0 <=> ~(&0 <= s')`]; + DISCH_TAC; + FIRST_X_ASSUM_ST `INTER` MP_TAC; + REWRITE_TAC[EXTENSION;NOT_IN_EMPTY;IN_INTER;NOT_FORALL_THM]; + GOAL_TERM (fun w -> (EXISTS_TAC( env w ` (s' / ( s' + (-- s))) % c + ((-- s) / (s' + (--s))) % d`))); + CONJ2_TAC; + MATCH_MP_TAC CONDS_IN_CONV2; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + TYPIFY `s' / (s' + --s) % (t0' % a + t1 % b + s % p) + --s / (s' + --s) % (t0'' % a + t1' % b + s' % p) = s' / (s' + --s) % (t0' % a + t1 % b ) + --s / (s' + --s) % (t0'' % a + t1' % b ) + ((s' * s/ (s' + --s)) + ( s' * (--s) / (s' + --s))) % p` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + TYPIFY ` (s' * s / (s' + --s) + s' * --s / (s' + --s)) = &0` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REWRITE_TAC[Sphere.aff]; + REWRITE_TAC[AFFINE_HULL_2;IN_ELIM_THM]; + GEXISTL_TAC [`(s' / (s' + --s) * t0' + (-- s)/(s' + --s) * t0'')`;`(s' / (s' + --s) * t1 + (-- s)/(s' + --s) * t1')`]; + CONJ_TAC; + Calc_derivative.CALC_ID_TAC; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REPEAT (FIRST_X_ASSUM_ST `&1` MP_TAC); + BY(CONV_TAC (REAL_RING)); + BY(VECTOR_ARITH_TAC) + ]);; + (* }}} *) + +let COPLANAR_AFF_GE_REDUCE = prove_by_refinement( + `!(a:real^3) b c d. coplanar {a,b,c,d} /\ aff {a,b} INTER conv {c,d} = {} /\ + ~(a = b) ==> (?p. aff_ge {a,b} {c,d} SUBSET aff_ge {a,b} {p})`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `aff_ge {a,b} {c,d} SUBSET aff{a,b}` ASM_CASES_TAC; + TYPIFY `?p. DISJOINT {a,b} {p}` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[Fan.th3a;Trigonometry2.TOW_DISTINCT_POINTS_EXISTS_RD_NOT_COLLINEAR]); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `p`))); + BY(ASM_MESON_TAC[AFF_GE_MONO_RIGHT;SUBSET_TRANS;EMPTY_SUBSET;AFF_GE_EQ_AFFINE_HULL;Trigonometry2.aff]); + TYPIFY `?p. p IN aff_ge {a,b} {c,d} DIFF aff{a,b}` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM MP_TAC; + BY(SET_TAC[]); + REWRITE_TAC[IN_DIFF]; + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `p`))); + TYPIFY `p IN affine hull {a,b,c,d}` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC AFF_GE_SUBSET_AFFINE_HULL [`{a,b}`;`{c,d}`]; + TYPIFY `{a,b} UNION {c,d} = {a,b,c,d}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + FIRST_X_ASSUM_ST `aff_ge` MP_TAC; + BY(SET_TAC[]); + TYPIFY `~(collinear {a,b,p})` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM (MP_TAC o (MATCH_MP COLLINEAR_3_IN_AFFINE_HULL) o GSYM); + BY(ASM_MESON_TAC[Sphere.aff]); + TYPIFY `aff_dim {a,b,p} = &2` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[COLLINEAR_AFF_DIM]; + INTRO_TAC AFF_DIM_2 [`a`;`b`]; + ASM_REWRITE_TAC[]; + INTRO_TAC AFF_DIM_INSERT [`p`;`{a,b}`]; + ASM_REWRITE_TAC[GSYM Sphere.aff]; + TYPIFY `{p,a,b} = {a,b,p}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(INT_ARITH_TAC); + INTRO_TAC AFF_DIM_EQ_AFFINE_HULL [`{a,b,p}`;`affine hull {a,b,c,d}`]; + ANTS_TAC; + CONJ_TAC; + REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT WEAK_STRIP_TAC THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC HULL_INC THEN SET_TAC[]); + INTRO_TAC COPLANAR_IMP_AFF_DIM [`{a,b,c,d}`]; + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[AFF_DIM_AFFINE_HULL]); + REWRITE_TAC[Planarity.AFFINE_HULL_AFFINE_EQ]; + DISCH_TAC; + TYPIFY `{c,d} SUBSET affine hull {a,b,p}` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[]; + REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT WEAK_STRIP_TAC THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC HULL_INC THEN SET_TAC[]); + TYPIFY `(?tt0 t1 s. c = tt0 % a + t1 % b + s % p /\ tt0 + t1 + s = &1) /\ (?tt0' t1' s'. d = tt0' % a + t1' % b + s' % p /\ tt0' + t1' + s' = &1)` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[AFFINE_HULL_3;IN_ELIM_THM]; + BY(MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + SUBGOAL_THEN `s < &0 ==> s' < &0` ASSUME_TAC; + COMMENT "change here"; + MATCH_MP_TAC NEG_SIGNS_LEMMA; + GEXISTL_TAC [`a`;`b`;`c`;`d`;`tt0`;`tt0'`;`t1`;`t1'`]; + BY(ASM_REWRITE_TAC[]); + SUBGOAL_THEN `s' < &0 ==> s < &0` ASSUME_TAC; + MATCH_MP_TAC NEG_SIGNS_LEMMA; + GEXISTL_TAC [`a`;`b`;`d`;`c`;`tt0'`;`tt0`;`t1'`;`t1`]; + TYPIFY `{d,c} = {c,d}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(ASM_REWRITE_TAC[]); + COMMENT "back to 1"; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `x IN aff_ge u v` MP_TAC; + TYPIFY `DISJOINT {a,b} {c,d}` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `INTER` MP_TAC; + REWRITE_TAC[EXTENSION;NOT_IN_EMPTY;IN_INTER;Sphere.aff;DISJOINT;IN_INSERT]; + TYPIFY `a IN {a,b} /\ b IN {a,b} /\ c IN {c,d} /\ d IN {c,d}` (C SUBGOAL_THEN MP_TAC); + BY(SET_TAC[]); + TYPIFY `({a,b} = {b,a}) /\ ({c,d} = {d,c})` (C SUBGOAL_THEN MP_TAC); + BY(SET_TAC[]); + BY(MESON_TAC[HULL_INC;Geomdetail.U_IN_CONV2]); + INTRO_TAC Nkezbfc_local.AFF_GE_2_2 [`a`;`b`;`c`;`d`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `(p = t1'' % a + t2 % b + t3 % (tt0 % a + t1 % b + s % p) + t4 % (tt0' % a + t1' % b + s' % p)) <=> (&1 - t3 * s - t4 * s') % p = (t1'' + t3 * tt0 + t4 * tt0' ) % a + (t2 + t3 * t1 + t4 * t1') % b` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + ASM_CASES_TAC `~(&1 - t3 * s - t4 * s' = &0)`; + DISCH_TAC; + FIRST_X_ASSUM_ST `aff` MP_TAC; + REWRITE_TAC[Sphere.aff;AFFINE_HULL_2;IN_ELIM_THM]; + GEXISTL_TAC [`(t1'' + t3 * tt0 + t4 * tt0')/(&1 - t3 * s - t4 * s')`;`(t2 + t3 * t1 + t4 * t1')/(&1 - t3 * s - t4 * s')`]; + CONJ_TAC; + Calc_derivative.CALC_ID_TAC; + ASM_REWRITE_TAC[]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN (CONV_TAC REAL_RING)); + MATCH_MP_TAC VECTOR_MUL_LCANCEL_IMP; + EXISTS_TAC `&1 - t3 * s - t4 * s'`; + ASM_REWRITE_TAC[]; + REWRITE_TAC[VECTOR_ADD_LDISTRIB;VECTOR_MUL_ASSOC]; + TYPIFY `((&1 - t3 * s - t4 * s') * (t1'' + t3 * tt0 + t4 * tt0') / (&1 - t3 * s - t4 * s')) = (t1'' + t3 * tt0 + t4 * tt0')` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `((&1 - t3 * s - t4 * s') * (t2 + t3 * t1 + t4 * t1') / (&1 - t3 * s - t4 * s')) = (t2 + t3 * t1 + t4 * t1')` (C SUBGOAL_THEN SUBST1_TAC); + Calc_derivative.CALC_ID_TAC; + BY(ASM_REWRITE_TAC[]); + BY(REWRITE_TAC[]); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[]; + (REPEAT WEAK_STRIP_TAC); + FIRST_X_ASSUM_ST `~` MP_TAC; + REWRITE_TAC[]; + TYPIFY `&0 <= s /\ &0 <= s'` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[arith `&0 <= s /\ &0 <= s' <=> ~(s < &0 \/ s' < &0)`]; + DISCH_TAC; + TYPIFY `s < &0 /\ s' < &0` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `&0 < t3 * s + t4 * s' ` (C SUBGOAL_THEN MP_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REWRITE_TAC[]; + MATCH_MP_TAC (arith `&0 <= t3 * (-- s) /\ &0 <= t4 * (-- s') ==> ~(&0 < t3 *( s) + t4 * ( s'))`); + GMATCH_SIMP_TAC REAL_LE_MUL; + GMATCH_SIMP_TAC REAL_LE_MUL; + BY(ASM_SIMP_TAC[arith `ss < &0 ==> &0 <= -- ss`]); + REWRITE_TAC[SUBSET]; + GEN_TAC; + GMATCH_SIMP_TAC Marchal_cells_2_new.AFF_GE_2_2; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC AFF_GE_2_1; + ASM_REWRITE_TAC[IN_ELIM_THM]; + CONJ_TAC; + MATCH_MP_TAC Fan.th3a; + BY(ASM_REWRITE_TAC[]); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + GEXISTL_TAC [`t1'''+t3' * tt0 + t4' * tt0'`;`t2' + t3' * t1 + t4' * t1'`;`t3' * s + t4' * s'`]; + CONJ_TAC; + MATCH_MP_TAC (arith `&0 <= x /\ &0 <= y ==> &0 <= x + y`); + GMATCH_SIMP_TAC REAL_LE_MUL; + GMATCH_SIMP_TAC REAL_LE_MUL; + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN (CONV_TAC REAL_RING)); + BY(VECTOR_ARITH_TAC) + ]);; + (* }}} *) + +let AFFINE_DEPENDENT_EXPLICIT_4 = prove_by_refinement( + `!(a:real^A) b c d ta tb tc td. ~affine_dependent {a,b,c,d} /\ + CARD {a,b,c,d} = 4 /\ + ta + tb + tc + td = &0 /\ + ta % a + tb % b + tc % c + td % d = vec 0 ==> + (ta = &0 /\ tb = &0 /\ tc = &0 /\ td = &0)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC AFFINE_DEPENDENT_EXPLICIT[`{a,b,c,d}`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[NOT_EXISTS_THM]; + DISCH_THEN (C INTRO_TAC [`{a,b,c,d}`;`\u. if (u=a) then ta else (if (u=b) then tb else (if (u=c) then tc else td))`]); + TYPIFY `FINITE {a,b,c,d}` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(REWRITE_TAC[FINITE_INSERT;FINITE_EMPTY]); + TYPIFY `{a, b, c, d} SUBSET {a, b, c, d}` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(SET_TAC[]); + TYPIFY `~(a = b) /\ ~(a = c) /\ ~(a = d) /\ ~(b = c) /\ ~(b = d) /\ ~(c = d)` (C SUBGOAL_THEN (ASSUME_TAC)); + TYPIFY ` {a,b,c,d} = {a,c,b,d} /\ {a,b,c,d}= {a,d,b,c} /\ {a,b,c,d} = {b,c,a,d} /\ {a,b,c,d} = {b,d,a,c} /\ {a,b,c,d} = {c,d,a,b}` (C SUBGOAL_THEN MP_TAC); + BY(SET_TAC[]); + REPEAT WEAK_STRIP_TAC; + BY(REPEAT CONJ_TAC THEN MATCH_MP_TAC Marchal_cells_2_new.CARD4_IMP_DISTINCT THEN FIRST_X_ASSUM_ST `4` (SUBST1_TAC o GSYM) THEN (REPLICATE_TAC 6 (FIRST_X_ASSUM MP_TAC)) THEN MESON_TAC[]); + TYPIFY `vsum {a, b, c, d} (\v. (if v = a then ta else if v = b then tb else if v = c then tc else td) % v) = vec 0` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + REPEAT (GMATCH_SIMP_TAC (CONJUNCT2 VSUM_CLAUSES)); + REWRITE_TAC[ (CONJUNCT1 VSUM_CLAUSES)]; + ASM_REWRITE_TAC[FINITE_EMPTY;FINITE_INSERT;NOT_IN_EMPTY;IN_INSERT]; + FIRST_X_ASSUM_ST `0` MP_TAC; + BY(VECTOR_ARITH_TAC); + TYPIFY `sum {a, b, c, d} (\u. if u = a then ta else if u = b then tb else if u = c then tc else td) = &0` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + REPEAT (GMATCH_SIMP_TAC (CONJUNCT2 SUM_CLAUSES)); + REWRITE_TAC[ (CONJUNCT1 SUM_CLAUSES)]; + ASM_REWRITE_TAC[FINITE_EMPTY;FINITE_INSERT;NOT_IN_EMPTY;IN_INSERT]; + FIRST_X_ASSUM_ST `&0` MP_TAC; + BY(REAL_ARITH_TAC); + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + REWRITE_TAC[NOT_EXISTS_THM]; + COPY_TAC; + COPY_TAC; + COPY_TAC; + DISCH_THEN (C INTRO_TAC [`a`]); + FIRST_X_ASSUM (C INTRO_TAC [`b`]); + FIRST_X_ASSUM (C INTRO_TAC [`c`]); + FIRST_X_ASSUM (C INTRO_TAC [`d`]); + ASM_REWRITE_TAC[]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let COPLANAR_AFF_GE_REDUCE2 = prove_by_refinement( + `!S (a:real^3) b c d. ~coplanar {a,b,c,d} /\ coplanar S /\ {a,b} SUBSET S /\ S SUBSET aff_ge {a,b} {c,d} ==> + (?p. S SUBSET aff_ge {a,b} {p})`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `~(a = b)` (C SUBGOAL_THEN ASSUME_TAC); + DISCH_TAC; + FIRST_X_ASSUM_ST `~` MP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `{b,b,c,d} = {b,c,d}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(REWRITE_TAC[COPLANAR_3]); + TYPIFY `S SUBSET affine hull {a,b}` ASM_CASES_TAC; + TYPIFY `?p. DISJOINT {a,b} {p}` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[Fan.th3a;Trigonometry2.TOW_DISTINCT_POINTS_EXISTS_RD_NOT_COLLINEAR]); + REPEAT WEAK_STRIP_TAC; + GOAL_TERM (fun w -> (EXISTS_TAC ( env w `p`))); + BY(ASM_MESON_TAC[AFF_GE_MONO_RIGHT;SUBSET_TRANS;EMPTY_SUBSET;AFF_GE_EQ_AFFINE_HULL;Trigonometry2.aff]); + TYPIFY `?p. p IN S DIFF affine hull {a,b}` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM MP_TAC; + BY(SET_TAC[]); + REPEAT WEAK_STRIP_TAC; + TYPIFY `p` EXISTS_TAC; + TYPIFY `p IN aff_ge {a,b} {c,d}` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + REWRITE_TAC[SUBSET]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `x IN aff_ge {a,b} {c,d}` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + TYPIFY `~(collinear {a,b,p})` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM (MP_TAC o (MATCH_MP COLLINEAR_3_IN_AFFINE_HULL) o GSYM); + DISCH_THEN (C INTRO_TAC [`p`]); + DISCH_THEN SUBST1_TAC; + FIRST_X_ASSUM_ST `DIFF` MP_TAC; + BY(SET_TAC[]); + TYPIFY `aff_dim {a,b,p} = &2` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[COLLINEAR_AFF_DIM]; + INTRO_TAC AFF_DIM_2 [`a`;`b`]; + ASM_REWRITE_TAC[]; + INTRO_TAC AFF_DIM_INSERT [`p`;`{a,b}`]; + ASM_REWRITE_TAC[GSYM Sphere.aff]; + TYPIFY `{p,a,b} = {a,b,p}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(INT_ARITH_TAC); + INTRO_TAC AFF_DIM_EQ_AFFINE_HULL [`{a,b,p}`;`affine hull S`]; + ANTS_TAC; + CONJ_TAC; + MATCH_MP_TAC SUBSET_TRANS; + TYPIFY `S` EXISTS_TAC; + CONJ2_TAC; + BY(REWRITE_TAC[HULL_SUBSET]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + INTRO_TAC COPLANAR_IMP_AFF_DIM [`S`]; + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[AFF_DIM_AFFINE_HULL]); + REWRITE_TAC[Planarity.AFFINE_HULL_AFFINE_EQ]; + DISCH_TAC; + TYPIFY `x IN affine hull {a,b,p}` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[HULL_SUBSET;SUBSET;IN]); + REPEAT (FIRST_X_ASSUM_ST `p IN aff_ge {a,b} {c,d}` MP_TAC); + REPEAT (GMATCH_SIMP_TAC Marchal_cells_2_new.AFF_GE_2_2); + CONJ_TAC; + FIRST_X_ASSUM_ST `~coplanar U` MP_TAC; + TYPIFY `{a,b,c,d} = {a,c,b,d}` ((C SUBGOAL_THEN SUBST1_TAC)); + BY(SET_TAC[]); + BY(MESON_TAC[Planarity.notcoplanar_disjoints]); + GMATCH_SIMP_TAC AFF_GE_2_1; + CONJ_TAC; + BY(ASM_MESON_TAC[Fan.th3a]); + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `affine` MP_TAC; + REWRITE_TAC[AFFINE_HULL_3]; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + GEXISTL_TAC [`u`;`v`;`w`]; + CONJ2_TAC; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `(t1' % a + t2' % b + t3' % c + t4' % d = u % a + v % b + w % (t1 % a + t2 % b + t3 % c + t4 % d)) <=> (t1' - w * t1 - u) % a + (t2' - w * t2 - v) % b + (t3' - w * t3) % c + (t4' - w * t4) % d = vec 0` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(VECTOR_ARITH_TAC); + DISCH_TAC; + TYPIFY `CARD {a,b,c,d} = 4` ((C SUBGOAL_THEN ASSUME_TAC)); + MATCH_MP_TAC Collect_geom2.NOT_COPLANAR_IMP_CARD4; + GMATCH_SIMP_TAC (GSYM coplanar_eq_coplanar_alt); + REWRITE_TAC[DIMINDEX_3]; + ASM_REWRITE_TAC[]; + BY(ARITH_TAC); + TYPIFY `~affine_dependent {a,b,c,d}` ((C SUBGOAL_THEN ASSUME_TAC)); + DISCH_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP Njiutiu.AFF_DEPENDENT_AFF_DIM_4)); + BY(ASM_MESON_TAC[Rogers.AFF_DIM_LE_2_IMP_COPLANAR]); + INTRO_TAC AFFINE_DEPENDENT_EXPLICIT_4 [`a`;`b`;`c`;`d`;`t1' - w * t1 - u`;`t2' - w * t2 - v`;`t3' - w * t3`;`t4' - w * t4`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN CONV_TAC REAL_RING); + REWRITE_TAC[arith `a - b = &0 <=> a = b`]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `&0 <= w * t3 /\ &0 <= w * t4` ((C SUBGOAL_THEN MP_TAC)); + BY(ASM_MESON_TAC[]); + REWRITE_TAC[Misc_defs_and_lemmas.REAL_MUL_NN]; + ASM_SIMP_TAC[arith `&0 <= t ==> (t <= &0 <=> t = &0)`]; + ENOUGH_TO_SHOW_TAC `t3 = &0 /\ t4 = &0 ==> F`; + BY(REAL_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + REPEAT (FIRST_X_ASSUM_ST `%` MP_TAC); + ASM_REWRITE_TAC[]; + TYPIFY `t1 % a + t2 % b + &0 % c + &0 % d = t1 % a + t2 % b` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `DIFF` MP_TAC; + REWRITE_TAC[DIFF;AFFINE_HULL_2;IN_ELIM_THM;NOT_EXISTS_THM]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (C INTRO_TAC [`t1`;`t2`]); + REWRITE_TAC[]; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let CONVEX_PLANE_INTER = prove_by_refinement( + `!(a:real^A) b p q. ~(a = b) /\ DISJOINT {a,b} {p} /\ q IN aff_gt {a,b} {p} ==> + (?c. c IN aff_gt {a,b} {p} /\ + c IN convex hull {a,b,p} INTER convex hull {a,b,q})`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `IN` MP_TAC; + (GMATCH_SIMP_TAC AFF_GT_2_1); + ASM_REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + ABBREV_TAC `(r:real->real^A) t = (&1 - t) % ((&1/ &2) % a + (&1/ &2) % b) + t % p`; + TYPIFY `!t. &0 <= t /\ t <= &1 ==> r t IN convex hull {a,b,p}` ((C SUBGOAL_THEN ASSUME_TAC)); + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[CONVEX_HULL_3;IN_ELIM_THM]; + GEXISTL_TAC [`(&1 -t) / &2`;`(&1- t)/ &2`;`t`]; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + GOAL_TERM (fun w -> (FIRST_X_ASSUM (SUBST1_TAC o GSYM o (ISPEC ( env w `t`))))); + BY(VECTOR_ARITH_TAC); + TYPIFY `?t. &0 < t /\ t <= &1 /\ r t IN convex hull {a,b,q}` ENOUGH_TO_SHOW_TAC; + REPEAT WEAK_STRIP_TAC; + TYPIFY `r t` EXISTS_TAC; + CONJ_TAC; + GEXISTL_TAC [`(&1 - t) / &2 `;`(&1 - t)/ &2`;`t`]; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(REAL_ARITH_TAC); + GOAL_TERM (fun w -> (FIRST_X_ASSUM (SUBST1_TAC o GSYM o (ISPEC ( env w `t`))))); + BY(VECTOR_ARITH_TAC); + REWRITE_TAC[IN_INTER]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[CONVEX_HULL_3]; + REWRITE_TAC[IN_ELIM_THM]; + GEXISTL_TAC [`(&1 - t) / &2 `;`(&1 - t)/ &2`;`t`]; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + GOAL_TERM (fun w -> (FIRST_X_ASSUM (SUBST1_TAC o GSYM o (ISPEC ( env w `t`))))); + BY(VECTOR_ARITH_TAC); + REWRITE_TAC[CONVEX_HULL_3;IN_ELIM_THM]; + ASM_REWRITE_TAC[]; + ABBREV_TAC `eps = inv (abs t1 + abs t2 + &2 * abs t3 + &2 * abs (t1 - t2 - &1) + &2 * abs(t2 - t1 - &1) + &10)`; + EXISTS_TAC `&2 * eps * t3`; + CONJ_TAC; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + REWRITE_TAC[ REAL_OF_NUM_LT]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + ASM_REWRITE_TAC[]; + CONJ_TAC; + EXPAND_TAC "eps"; + GMATCH_SIMP_TAC REAL_LT_INV; + BY(REAL_ARITH_TAC); + BY(ARITH_TAC); + CONJ_TAC; + EXPAND_TAC "eps"; + REWRITE_TAC[arith `a * inv b * c = (a * c)/ b`]; + GMATCH_SIMP_TAC REAL_LE_LDIV_EQ; + CONJ_TAC; + BY(REAL_ARITH_TAC); + BY(REAL_ARITH_TAC); + TYPIFY `&0 <= eps` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "eps"; + REWRITE_TAC[REAL_LE_INV_EQ]; + BY(REAL_ARITH_TAC); + GEXISTL_TAC [`&1/ &2 + eps * ( (t2 - t1) - &1 )`;`&1/ &2 + eps * ( (t1 - t2) - &1 )`;`&2 * eps`]; + TYPIFY `(&1 / &2 + eps * (t2 - t1 - &1)) + (&1 / &2 + eps * (t1 - t2 - &1)) + &2 * eps = &1` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(REAL_ARITH_TAC); + TYPIFY `r (&2 * eps * t3) = (&1 / &2 + eps * (t2 - t1 - &1)) % a + (&1 / &2 + eps * (t1 - t2 - &1)) % b + (&2 * eps) % (t1 % a + t2 % b + t3 % p)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + GOAL_TERM (fun w -> (FIRST_X_ASSUM (SUBST1_TAC o GSYM o (ISPEC ( env w `&2 * eps * t3`))))); + FIRST_X_ASSUM_ST `t1 + t2 + t3 = &1` ((unlist REWRITE_TAC) o (REWRITE_RULE[arith `t1 + t2 + t3 = &1 <=> t3 = &1 - t2 - t1`])); + BY(VECTOR_ARITH_TAC); + TYPIFY `&0 <= &2 * eps` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + GMATCH_SIMP_TAC REAL_LE_MUL; + BY(ASM_REWRITE_TAC[arith `&0 <= &2`]); + REPEAT (GMATCH_SIMP_TAC (arith `abs(a * b) <= &1 / &2 ==> &0 <= &1/ &2 + a * b`)); + REWRITE_TAC[REAL_ABS_MUL]; + ASM_SIMP_TAC[arith `&0 <= eps ==> abs (eps) = eps`]; + GMATCH_SIMP_TAC REAL_LE_RDIV_EQ; + REWRITE_TAC[ REAL_OF_NUM_LT]; + EXPAND_TAC "eps"; + GMATCH_SIMP_TAC REAL_LE_RDIV_EQ; + REWRITE_TAC[ REAL_OF_NUM_LT]; + REWRITE_TAC[arith `0 < 2`]; + REWRITE_TAC[arith `(inv a * b) * d <= c <=> (b * d) / a <= c`]; + GMATCH_SIMP_TAC REAL_LE_LDIV_EQ; + GMATCH_SIMP_TAC REAL_LE_LDIV_EQ; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let CONVEX_R3_INTER = prove_by_refinement( + `!(a:real^3) b c p q. ~coplanar {a,b,c,p} /\ q IN aff_gt {a,b,c} {p} ==> + (?d. ~coplanar {a,b,c,d} /\ d IN convex hull {a,b,c,p} INTER convex hull {a,b,c,q})`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `DISJOINT {a,b,c} {p}` ((C SUBGOAL_THEN ASSUME_TAC)); + BY(ASM_MESON_TAC[Planarity.notcoplanar_disjoints]); + FIRST_X_ASSUM_ST `IN` MP_TAC; + GMATCH_SIMP_TAC AFF_GT_3_1; + ASM_REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + ABBREV_TAC `(r:real^3) = (&1 / &3) % a + (&1/ &3 ) % b + (&1 / &3) % c`; + TYPIFY `?t. ~coplanar {a,b,c, (&1 - t) % r + t % q} /\ (&1 - t) % r + t % q IN convex hull{a,b,c,p} INTER convex hull {a,b,c,q}` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[]); + REWRITE_TAC[IN_INTER]; + REWRITE_TAC[Marchal_cells_2_new.CONVEX_HULL_4]; + ASM_REWRITE_TAC[IN_ELIM_THM]; + EXPAND_TAC "r"; + TYPIFY `?s. s < &1 /\ &0 < s /\ &0 < (&1 - s)/ &3 + s * t1 /\ &0 < (&1 -s)/ &3 + s * t2 /\ &0 < (&1 - s)/ &3 + s * t3 ` (C SUBGOAL_THEN MP_TAC); + EXISTS_TAC (`inv (&4 + &3 * abs t1 + &3 * abs t2 + &3 * abs t3)`); + TYPIFY `&0 < &4 + &3 * abs t1 + &3 * abs t2 + &3 * abs t3` ((C SUBGOAL_THEN ASSUME_TAC)); + BY(REAL_ARITH_TAC); + CONJ_TAC; + REWRITE_TAC[arith `inv x = &1 / x`]; + ASM_SIMP_TAC[REAL_LT_LDIV_EQ]; + BY(REAL_ARITH_TAC); + CONJ_TAC; + GMATCH_SIMP_TAC REAL_LT_INV; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[arith `&0 < (&1 - inv x)/ &3 + inv x * t <=> (&1 - &3 * t)/x < &1`]; + (ASM_SIMP_TAC[REAL_LT_LDIV_EQ]); + BY(REAL_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + EXISTS_TAC `s:real`; + CONJ2_TAC; + CONJ_TAC; + GEXISTL_TAC [`(&1 - s)/ &3 + s * t1`;`(&1- s)/ &3 + s * t2`;`(&1- s)/ &3 + s * t3`;`s * t4`]; + ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`]; + GMATCH_SIMP_TAC REAL_LE_MUL; + ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`]; + FIRST_X_ASSUM_ST `t1 + t2 + t3 + t4 = &1` (SUBST1_TAC o (REWRITE_RULE[arith `t1 + t2 + t3 + t4 = &1 <=> t4 = &1 - t1 - t2 - t3`])); + CONJ_TAC; + BY(REAL_ARITH_TAC); + EXPAND_TAC "r"; + BY(VECTOR_ARITH_TAC); + GEXISTL_TAC [`(&1 - s)/ &3 `;`(&1- s)/ &3 `;`(&1- s)/ &3`;`s `]; + ASM_SIMP_TAC[arith `s < &1 ==> &0 <= (&1 - s) / &3`]; + ASM_SIMP_TAC[arith `&0 < x ==> &0 <= x`]; + CONJ_TAC; + BY(REAL_ARITH_TAC); + FIRST_X_ASSUM_ST `t1 + t2 + t3 + t4 = &1` (SUBST1_TAC o (REWRITE_RULE[arith `t1 + t2 + t3 + t4 = &1 <=> t4 = &1 - t1 - t2 - t3`])); + EXPAND_TAC "r"; + BY(VECTOR_ARITH_TAC); + (COMMENT "last goal, coplanarity"); + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + REWRITE_TAC[CHI_MSB_COPLANAR]; + TYPIFY `((&1 - s) % (&1 / &3 % a + &1 / &3 % b + &1 / &3 % c) + s % (t1 % a + t2 % b + t3 % c + t4 % p)) = ((&1 - s)/ &3 + s * t1) % a + ((&1 - s)/ &3 + s * t2) % b + ((&1 - s) / &3 + s * t3) % c + (s * t4) % p` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + DISCH_TAC; + GMATCH_SIMP_TAC chi_msb_additive_d; + CONJ_TAC; + FIRST_X_ASSUM_ST `x = &1` MP_TAC; + BY(CONV_TAC REAL_RING); + REWRITE_TAC[REAL_ENTIRE]; + ASM_REWRITE_TAC[]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let MCELL2_CONVEX = prove_by_refinement( + `!V vl. saturated V /\ packing V /\ barV V 3 vl ==> convex (mcell2 V vl)`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.mcell2]; + REPEAT WEAK_STRIP_TAC; + COND_CASES_TAC; + REWRITE_TAC[LET_DEF;LET_END_DEF]; + MATCH_MP_TAC CONVEX_INTER; + GMATCH_SIMP_TAC CONVEX_INTER; + REWRITE_TAC[CONVEX_AFF_GE]; + TYPIFY `&0 <= hl (truncate_simplex 1 vl) / sqrt (&2)` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[Marchal_cells_2_new.CONVEX_RCONE_GE]); + GMATCH_SIMP_TAC REAL_LE_RDIV_EQ; + REWRITE_TAC[arith `&0 * x = &0`]; + GMATCH_SIMP_TAC REAL_LT_RSQRT; + CONJ_TAC; + BY(REAL_ARITH_TAC); + BY(ASM_MESON_TAC[Marchal_cells_2_new.BARV_IMP_HL_1_POS_LT;arith `&0 < x ==> &0 <= x`]); + BY(REWRITE_TAC[CONVEX_EMPTY]) + ]);; + (* }}} *) + +let MCELL_CONVEX = prove_by_refinement( + `!V vl k. saturated V /\ packing V /\ barV V 3 vl /\ 2 <= k ==> convex (mcell k V vl)`, + (* {{{ proof *) + [ + REWRITE_TAC[Pack_defs.mcell]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `~(k=0) /\ ~(k=1)` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN ARITH_TAC); + ASM_REWRITE_TAC[]; + REPEAT COND_CASES_TAC; + BY(ASM_MESON_TAC[MCELL2_CONVEX]); + REWRITE_TAC[Pack_defs.mcell3]; + COND_CASES_TAC; + BY(REWRITE_TAC[CONVEX_CONVEX_HULL]); + BY(REWRITE_TAC[CONVEX_EMPTY]); + REWRITE_TAC[Pack_defs.mcell4]; + COND_CASES_TAC; + BY(REWRITE_TAC[CONVEX_CONVEX_HULL]); + BY(REWRITE_TAC[CONVEX_EMPTY]) + ]);; + (* }}} *) + +let CHI_MSB_AFF_GT_0 = prove_by_refinement( + `!a b c q q'. ~coplanar {a,b,c,q} /\ + &0 < chi_msb [a;b;c] q /\ &0 < chi_msb [a;b;c] q' ==> + (q' IN aff_gt {a,b,c} {q})`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC AFF_DIM_EQ_AFFINE_HULL [`{a,b,c, q}`;`(:real^3)`]; + REWRITE_TAC[AFFINE_HULL_UNIV]; + ANTS_TAC; + CONJ_TAC; + BY(SET_TAC[]); + REWRITE_TAC[AFF_DIM_UNIV;DIMINDEX_3]; + ENOUGH_TO_SHOW_TAC `~(aff_dim {a,b,c, (q:real^3)} <= &2)`; + BY(INT_ARITH_TAC); + BY(ASM_MESON_TAC[Rogers.AFF_DIM_LE_2_IMP_COPLANAR]); + REWRITE_TAC[EXTENSION;IN_UNIV]; + DISCH_THEN (C INTRO_TAC [`q'`]); + REWRITE_TAC[Collect_geom2.AFFINE_HULL_4]; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `chi_msb` MP_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC chi_msb_additive_d [`a`;`b`;`c`;`q`;`u`;`v`;`w`;`z`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + ASM_SIMP_TAC[Real_ext.REAL_PROP_POS_RMUL]; + DISCH_TAC; + GMATCH_SIMP_TAC AFF_GT_3_1; + REWRITE_TAC[IN_ELIM_THM]; + CONJ2_TAC; + BY(ASM_MESON_TAC[]); + BY(ASM_MESON_TAC[Planarity.notcoplanar_disjoints]) + ]);; + (* }}} *) + +let CHI_MSB_POS2 = prove_by_refinement( + `!a b c d p. DISJOINT {a,b} {c} /\ d IN aff_gt {a,b} {c} ==> re_eqvl (chi_msb [a;b;d] p) (chi_msb[a;b;c] p)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[Trigonometry2.re_eqvl]; + ASM_SIMP_TAC[AFF_GT_2_1]; + REWRITE_TAC[IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + EXISTS_TAC `t3:real`; + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[chi_msb_swap_23]; + TYPIFY `t1 % a + t2 % b + t3 % c = t1 % a + t2 % b + (&0) % p + t3 % c` (C SUBGOAL_THEN SUBST1_TAC); + BY(VECTOR_ARITH_TAC); + GMATCH_SIMP_TAC chi_msb_additive_d; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let MCELL_ARG_REDUCE = prove_by_refinement( + `!V ul i. (?j. j <= 4 /\ mcell i V ul = mcell j V ul)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ASM_CASES_TAC `i <= 4`; + EXISTS_TAC `i:num`; + BY(ASM_REWRITE_TAC[]); + TYPIFY `~(i=0) /\ ~(i=1) /\ ~(i=2) /\ ~(i = 3) /\ ~(i=4)` (C SUBGOAL_THEN ASSUME_TAC); + BY(FIRST_X_ASSUM MP_TAC THEN ARITH_TAC); + EXISTS_TAC `4`; + CONJ_TAC; + BY(ARITH_TAC); + REWRITE_TAC[Pack_defs.mcell]; + BY(ASM_REWRITE_TAC[arith `~(4 =0) /\ ~(4 = 1) /\ ~(4 = 2) /\ ~(4 =3)`]) + ]);; + (* }}} *) + +let AJRIPQN_0 = prove_by_refinement( + `!V ul vl i j. + saturated V /\ + packing V /\ + barV V 3 ul /\ + barV V 3 vl /\ + ~NULLSET (mcell i V ul INTER mcell j V vl) + ==> mcell j V vl = mcell i V ul +`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC MCELL_ARG_REDUCE [`V`;`ul`;`i`]; + INTRO_TAC MCELL_ARG_REDUCE [`V`;`vl`;`j`]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Ajripqn.AJRIPQN [`V`;`ul`;`vl`;`j''`;`j'`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(ASM_MESON_TAC[]); + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let CFFONNL = prove_by_refinement( + `!V ul X. packing V /\ saturated V /\ leaf V ul /\ X IN mcell_set V /\ + {EL 0 ul,EL 1 ul} IN edgeX V X /\ + ~(X INTER cc_A0 ul = {}) /\ ~(X = cc_cell V ul) ==> (X = cc_cell V [EL 1 ul;EL 0 ul;EL 2 ul])`, + (* {{{ proof *) + [ + REWRITE_TAC[cc_A0;Pack_defs.mcell_set;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `~NULLSET X` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[RIJRIED;EXTENSION;NOT_IN_EMPTY]); + INTRO_TAC COPLANAR_IMP_NEGLIGIBLE [`X`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `LENGTH ul = 3` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC [leaf;Sphere.BARV;IN;arith `3 = 2 + 1`]); + TYPIFY `[EL 0 ul;EL 1 ul; EL 2 ul] = ul` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[LENGTH3]); + TYPIFY `{EL 0 ul,EL 1 ul, EL 2 ul} = set_of_list ul` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[set_of_list3]); + INTRO_TAC AFF_GT_SUBSET_AFFINE_HULL [`{EL 0 ul, EL 1 ul}`;`{EL 2 ul}`]; + TYPIFY `{EL 0 ul, EL 1 ul} UNION {EL 2 ul} = {EL 0 ul,EL 1 ul, EL 2 ul}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `?p. p IN X INTER aff_gt {EL 0 ul, EL 1 ul} {EL 2 ul}` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM_ST `INTER` MP_TAC; + BY(SET_TAC[]); + REPEAT WEAK_STRIP_TAC; + TYPIFY `~(X SUBSET affine hull set_of_list ul)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM (SUBST1_TAC o GSYM); + DISCH_TAC; + INTRO_TAC COPLANAR_3 [`EL 0 ul`;`EL 1 ul`;`EL 2 ul`]; + REWRITE_TAC[]; + ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]; + BY(ASM_MESON_TAC[COPLANAR_SUBSET]); + COMMENT "back to 1"; + TYPIFY `aff_dim (set_of_list ul) = &2` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Rogers.MHFTTZN1; + BY(ASM_MESON_TAC[IN;leaf]); + TYPIFY `?q. q IN X DIFF affine hull set_of_list ul` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM_ST `SUBSET` MP_TAC; + BY(SET_TAC[]); + REPEAT WEAK_STRIP_TAC; + PROOF_BY_CONTR_TAC; + TYPIFY `~ (chi_msb ul q = &0)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `[]` (SUBST1_TAC o GSYM); + REWRITE_TAC[GSYM CHI_MSB_COPLANAR]; + DISCH_TAC; + FIRST_X_ASSUM_ST `DIFF` MP_TAC; + REWRITE_TAC[IN_DIFF]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[]; + MATCH_MP_TAC COPLANAR_INSERT; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + MATCH_MP_TAC (TAUT (`a = b ==> (a ==> b)`)); + AP_TERM_TAC; + FIRST_X_ASSUM_ST `{}` (SUBST1_TAC o GSYM); + BY(SET_TAC[]); + TYPIFY `{EL 0 ul, EL 1 ul} SUBSET X` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Marchal_cells_3.EDGEX_SUBSET_MCELL; + TYPIFY `V` EXISTS_TAC; + ASM_REWRITE_TAC[]; + CONJ2_TAC; + BY(ASM_MESON_TAC[IN]); + REWRITE_TAC[Pack_defs.mcell_set]; + REWRITE_TAC[IN_ELIM_THM]; + BY(ASM_MESON_TAC[]); + COMMENT "redo here"; + TYPIFY `2 <= i` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[arith `2 <= i <=> ~(i <= 1)`]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC EDGE_IMP_K2 [`V`;`ul'`;`i`]; + ASM_REWRITE_TAC[EXTENSION;NOT_IN_EMPTY]; + DISCH_THEN MP_TAC; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + BY(ASM_MESON_TAC[]); + COMMENT "next show convex SUBSET X"; + TYPIFY `convex hull {EL 0 ul,EL 1 ul,p,q} SUBSET convex hull X` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET; + REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + FIRST_X_ASSUM MP_TAC; + TYPIFY `convex hull X = X` (C SUBGOAL_THEN SUBST1_TAC); + REWRITE_TAC[CONVEX_HULL_EQ]; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC MCELL_CONVEX; + BY(ASM_MESON_TAC[IN]); + DISCH_TAC; + COMMENT "2. create Y "; + ABBREV_TAC `(wl) = (if (&0 < chi_msb ul q ) then ul else [EL 1 ul; EL 0 ul; EL 2 ul])`; + TYPIFY `&0 < chi_msb wl q` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "wl"; + COND_CASES_TAC; + ONCE_REWRITE_TAC[chi_msb_swap_01]; + MATCH_MP_TAC(arith `~(x = &0) /\ ~(&0 < x) ==> &0 < -- x`); + BY(ASM_MESON_TAC[]); + ABBREV_TAC `k = cc_ke V wl`; + ABBREV_TAC `Y = cc_cell V (wl)`; + TYPIFY `EL 2 wl = EL 2 ul` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "wl"; + COND_CASES_TAC; + BY(REWRITE_TAC[]); + BY(REWRITE_TAC[EL;HD;TL;arith `2 = SUC 1 /\ 1 = SUC 0`]); + TYPIFY `set_of_list wl = set_of_list ul` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "wl"; + COND_CASES_TAC; + BY(REWRITE_TAC[]); + FIRST_X_ASSUM_ST `x = set_of_list ul` (SUBST1_TAC o GSYM); + GMATCH_SIMP_TAC set_of_list3; + REWRITE_TAC[LENGTH;arith `SUC (SUC(SUC 0)) = 3`]; + REWRITE_TAC[EL;HD;TL;arith `2 = SUC 1 /\ 1 = SUC 0`]; + BY(SET_TAC[]); + TYPIFY `leaf V wl` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "wl"; + COND_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + BY(ASM_MESON_TAC[ ZASUVOR]); + COMMENT "points in Y"; + TYPIFY `LENGTH wl = 3` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "wl"; + COND_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + BY(REWRITE_TAC[LENGTH;arith `SUC (SUC(SUC 0)) = 3`]); + TYPIFY `{EL 0 ul,EL 1 ul, EL 2 ul} SUBSET Y` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "Y"; + GMATCH_SIMP_TAC CC_CELL34; + ABBREV_TAC `pp = (if k=3 then mxi V (cc_uh V ( wl)) else EL 3 (cc_uh V wl))`; + TYPIFY `pp` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `set_of_list wl SUBSET {EL 0 wl, EL 1 wl, EL 2 ul, pp}` ENOUGH_TO_SHOW_TAC; + BY(ASM_MESON_TAC[Ldurdpn.SUBSET_P_HULL;SUBSET_TRANS]); + FIRST_X_ASSUM_ST `x = EL 2 ul` (SUBST1_TAC o GSYM); + GMATCH_SIMP_TAC set_of_list3; + CONJ_TAC; + BY(ASM_REWRITE_TAC[]); + BY(SET_TAC[]); + COMMENT "3."; + TYPIFY `EL 2 ul IN Y INTER aff_gt {EL 0 ul, EL 1 ul} {EL 2 ul}` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[IN_INTER]; + CONJ_TAC; + FIRST_X_ASSUM MP_TAC; + BY(SET_TAC[]); + BY((MESON_TAC[Local_lemmas.X_IN_AFF_GT_X])); + COMMENT "now pos half space point"; + TYPIFY `?q'. &0 < chi_msb wl q' /\ q' IN Y` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC CELL_NN [`V`;`wl`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + ABBREV_TAC `pp = (if cc_ke V wl = 3 then mxi V (cc_uh V wl) else EL 3 (cc_uh V wl))`; + INTRO_TAC CC_CELL34 [`V`;`wl`;`pp`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + TYPIFY `pp` EXISTS_TAC; + CONJ2_TAC; + MATCH_MP_TAC HULL_INC; + BY(SET_TAC[]); + EXPAND_TAC "pp"; + COND_CASES_TAC; + BY(ASM_MESON_TAC[CELL3_NONDEG]); + MATCH_MP_TAC K4_CHI_MSB_POS; + BY(ASM_MESON_TAC[CC_KE_34]); + FIRST_X_ASSUM MP_TAC; + WEAK_STRIP_TAC; + COMMENT "now common point in the plane"; + INTRO_TAC GBEWYFX [`V`;`ul`]; + ASM_REWRITE_TAC[]; + PROOF_BY_CONTR_TAC; + INTRO_TAC Fan.th3a [`EL 0 ul`;`EL 1 ul`;`EL 2 ul`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_TAC; + INTRO_TAC CONVEX_PLANE_INTER [`EL 0 ul`;`EL 1 ul`;`EL 2 ul`;`p`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + FIRST_X_ASSUM_ST `edgeX` MP_TAC; + REWRITE_TAC[Pack_defs.edgeX;IN_ELIM_THM]; + BY(SET_TAC[]); + REPEAT (FIRST_X_ASSUM_ST `p IN x INTER y` MP_TAC); + BY(SET_TAC[]); + (REPEAT WEAK_STRIP_TAC); + TYPIFY `{EL 0 wl,EL 1 wl} = {EL 0 ul,EL 1 ul}` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "wl"; + COND_CASES_TAC; + BY(REWRITE_TAC[]); + REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0`]; + BY(SET_TAC[]); + TYPIFY `[EL 0 wl;EL 1 wl; EL 2 wl] = wl` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[LENGTH3]); + INTRO_TAC CHI_MSB_POS2 [`EL 0 wl`;`EL 1 wl`;`EL 2 wl`;`c`;`q`]; + INTRO_TAC CHI_MSB_POS2 [`EL 0 wl`;`EL 1 wl`;`EL 2 wl`;`c`;`q'`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[Trigonometry2.re_eqvl]; + WEAK_STRIP_TAC; + DISCH_THEN MP_TAC; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + WEAK_STRIP_TAC; + INTRO_TAC CONVEX_R3_INTER [`EL 0 ul`;`EL 1 ul`;`c`;`q`;`q'`]; + ANTS_TAC; + TYPIFY `{EL 0 ul, EL 1 ul, c, q} = {EL 0 wl, EL 1 wl, c,q}` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `{EL 0 wl, EL 1 wl} = {EL 0 ul, EL 1 ul}` MP_TAC; + BY(SET_TAC[]); + SUBCONJ_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[CHI_MSB_COPLANAR]; + MATCH_MP_TAC (arith `&0 < x ==> ~(x = &0)`); + FIRST_X_ASSUM_ST `*` SUBST1_TAC; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY ` {EL 0 ul, EL 1 ul, c} = {EL 0 wl, EL 1 wl, c}` (C SUBGOAL_THEN SUBST1_TAC); + FIRST_X_ASSUM_ST `{EL 0 wl, EL 1 wl} = {EL 0 ul, EL 1 ul}` MP_TAC; + BY(SET_TAC[]); + MATCH_MP_TAC CHI_MSB_AFF_GT_0; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + GMATCH_SIMP_TAC REAL_LT_MUL_EQ; + BY(ASM_REWRITE_TAC[]); + WEAK_STRIP_TAC; + (COMMENT "S. back to 1. Show u0 u1 c d in X INTER Y"); + TYPIFY `convex hull X = X /\ convex hull Y = Y` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[CONVEX_HULL_EQ]; + EXPAND_TAC "Y"; + REWRITE_TAC[cc_cell]; + REPEAT (GMATCH_SIMP_TAC MCELL_CONVEX); + ASM_SIMP_TAC[CC_KE_34;arith `k= 3 \/ k = 4 ==> 2 <= k`]; + CONJ2_TAC; + REPEAT (FIRST_X_ASSUM_ST `barV` MP_TAC); + BY(REWRITE_TAC[IN]); + BY(ASM_MESON_TAC[IN;cc_uh]); + COMMENT "S. X"; + TYPIFY `convex hull {EL 0 ul, EL 1 ul, c, q} SUBSET convex hull X` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET; + REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + FIRST_X_ASSUM_ST `convex hull {EL 0 ul, EL 1 ul, p, q} SUBSET X` MP_TAC; + REPEAT (FIRST_X_ASSUM_ST `INTER` MP_TAC); + REPEAT (FIRST_X_ASSUM kill); + REWRITE_TAC[IN_INTER]; + INTRO_TAC Marchal_cells.CONVEX_HULL_SUBSET [`{EL 0 ul,EL 1 ul,p}`;`{EL 0 ul,EL 1 ul,p,q}`]; + ANTS_TAC; + BY(SET_TAC[]); + REWRITE_TAC[SUBSET]; + TYPIFY `!y. y = EL 0 ul \/ y = EL 1 ul ==> y IN {EL 0 ul,EL 1 ul,p}` (C SUBGOAL_THEN MP_TAC); + BY(SET_TAC[]); + TYPIFY `q IN {EL 0 ul,EL 1 ul,p,q}` (C SUBGOAL_THEN MP_TAC); + BY(SET_TAC[]); + BY(MESON_TAC[HULL_INC]); + FIRST_ASSUM (unlist REWRITE_TAC); + DISCH_TAC; + COMMENT "S. now Y"; + TYPIFY `convex hull {EL 0 ul,EL 1 ul,c,q'} SUBSET convex hull Y` (C SUBGOAL_THEN MP_TAC); + MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET; + REWRITE_TAC[SUBSET;IN_INSERT;NOT_IN_EMPTY]; + GEN_TAC; + TYPIFY `q' IN Y` (C SUBGOAL_THEN MP_TAC); + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM_ST `{EL 0 ul, EL 1 ul, EL 2 ul} SUBSET Y` (MP_TAC o (MATCH_MP Marchal_cells.CONVEX_HULL_SUBSET)); + TYPIFY `{EL 0 ul, EL 1 ul, c} SUBSET convex hull {EL 0 ul, EL 1 ul, EL 2 ul}` (C SUBGOAL_THEN MP_TAC); + REPLICATE_TAC 2 (FIRST_X_ASSUM_ST `INTER` MP_TAC); + REWRITE_TAC[IN_INTER;SUBSET;IN_INSERT;NOT_IN_EMPTY]; + TYPIFY `EL 0 ul IN {EL 0 ul,EL 1 ul,EL 2 ul} /\ EL 1 ul IN {EL 0 ul,EL 1 ul, EL 2 ul}` (C SUBGOAL_THEN MP_TAC); + BY(SET_TAC[]); + BY(MESON_TAC[HULL_INC]); + FIRST_X_ASSUM_ST `/\` (unlist REWRITE_TAC); + BY(SET_TAC[]); + FIRST_X_ASSUM_ST `/\` (unlist REWRITE_TAC); + DISCH_TAC; + COMMENT "S. now X INTER Y"; + TYPIFY `convex hull {EL 0 ul,EL 1 ul, c,d} SUBSET X INTER Y` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC SUBSET_TRANS; + TYPIFY `convex hull {EL 0 ul, EL 1 ul, c, q} INTER convex hull {EL 0 ul, EL 1 ul, c, q'}` EXISTS_TAC; + CONJ2_TAC; + BY(REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + REWRITE_TAC[SUBSET_INTER]; + CONJ_TAC; + INTRO_TAC Marchal_cells.CONVEX_HULL_SUBSET [`{EL 0 ul, EL 1 ul, c, d}`;` convex hull {EL 0 ul, EL 1 ul, c, q}`]; + REWRITE_TAC[HULL_HULL]; + DISCH_THEN MATCH_MP_TAC; + TYPIFY `d IN convex hull {EL 0 ul, EL 1 ul, c, q} /\ {EL 0 ul, EL 1 ul, c} SUBSET convex hull {EL 0 ul, EL 1 ul, c, q}` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + CONJ_TAC; + FIRST_X_ASSUM_ST `INTER` MP_TAC; + BY(SET_TAC[]); + REWRITE_TAC[SUBSET]; + BY(MESON_TAC[HULL_INC;MESON[IN_INSERT;NOT_IN_EMPTY] `!x. x IN {EL 0 ul,EL 1 ul,c} ==> x IN {EL 0 ul, EL 1 ul,c,q}`]); + INTRO_TAC Marchal_cells.CONVEX_HULL_SUBSET [`{EL 0 ul, EL 1 ul, c, d}`;` convex hull {EL 0 ul, EL 1 ul, c, q'}`]; + REWRITE_TAC[HULL_HULL]; + DISCH_THEN MATCH_MP_TAC; + TYPIFY `d IN convex hull {EL 0 ul, EL 1 ul, c, q'} /\ {EL 0 ul, EL 1 ul, c} SUBSET convex hull {EL 0 ul, EL 1 ul, c, q'}` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + CONJ_TAC; + FIRST_X_ASSUM_ST `INTER` MP_TAC; + BY(SET_TAC[]); + REWRITE_TAC[SUBSET]; + BY(MESON_TAC[HULL_INC;MESON[IN_INSERT;NOT_IN_EMPTY] `!x. x IN {EL 0 ul,EL 1 ul,c} ==> x IN {EL 0 ul, EL 1 ul,c,q'}`]); + COMMENT "T. back to 1. now show X = Y "; + TYPIFY `X = Y` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC AJRIPQN_0 [`V`;`ul'`;`cc_uh V wl`;`i`;`cc_ke V wl`]; + ASM_REWRITE_TAC[GSYM cc_cell]; + DISCH_THEN (MATCH_MP_TAC o GSYM); + CONJ_TAC; + FIRST_X_ASSUM_ST `barV` MP_TAC; + BY(REWRITE_TAC[IN]); + CONJ_TAC; + BY(ASM_MESON_TAC[IN;cc_uh]); + DISCH_TAC; + TYPIFY `NULLSET (convex hull {EL 0 ul, EL 1 ul, c, d})` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC NEGLIGIBLE_SUBSET; + TYPIFY `X INTER Y` EXISTS_TAC; + FIRST_X_ASSUM_ST `convex` (unlist REWRITE_TAC); + FIRST_X_ASSUM MP_TAC; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM_ST `coplanar` (MP_TAC o (MATCH_MP ZWVCBMN)); + REWRITE_TAC[]; + MATCH_MP_TAC (arith `x = &0 ==> ~(&0 < x)`); + FIRST_X_ASSUM MP_TAC; + BY(MESON_TAC[volume_props]); + REPEAT (FIRST_X_ASSUM_ST `convex` kill); + FIRST_X_ASSUM_ST `~(X = (Y:real^3->bool))` MP_TAC; + REWRITE_TAC[]; + ENOUGH_TO_SHOW_TAC `cc_cell V wl = cc_cell V [EL 1 ul; EL 0 ul; EL 2 ul]`; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM_ST `COND` MP_TAC; + DISCH_TAC; + EXPAND_TAC "wl"; + COND_CASES_TAC; + BY(ASM_MESON_TAC[]); + BY(REWRITE_TAC[]) + ]);; + (* }}} *) + +let CC_CELL_IN_MCELL_SET = prove_by_refinement( + `!V ul. saturated V /\ packing V /\ leaf V ul ==> + cc_cell V ul IN mcell_set V`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[Pack_defs.mcell_set;IN_ELIM_THM]; + REWRITE_TAC[cc_cell]; + GEXISTL_TAC [`cc_ke V ul`;`cc_uh V ul`]; + REWRITE_TAC[]; + BY(ASM_MESON_TAC[cc_uh]) + ]);; + (* }}} *) + +let CARD4_ALL_DISTINCT = prove_by_refinement( + `!(a:A) b c d. CARD {a,b,c,d}= 4 ==> + ~(a = b) /\ ~(a = c) /\ ~(a = d) /\ ~(b = c) /\ ~(b = d) /\ ~(c = d)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY ` {a,b,c,d} = {a,c,b,d} /\ {a,b,c,d}= {a,d,b,c} /\ {a,b,c,d} = {b,c,a,d} /\ {a,b,c,d} = {b,d,a,c} /\ {a,b,c,d} = {c,d,a,b}` (C SUBGOAL_THEN MP_TAC); + BY(SET_TAC[]); + REPEAT WEAK_STRIP_TAC; + BY(REPEAT CONJ_TAC THEN MATCH_MP_TAC Marchal_cells_2_new.CARD4_IMP_DISTINCT THEN FIRST_X_ASSUM_ST `4` (SUBST1_TAC o GSYM) THEN (REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC)) THEN MESON_TAC[]) + ]);; + (* }}} *) + + +let LENGTH4_SET2 = prove_by_refinement( + `!(a:A) b c d e f. CARD {a,b,c,d} = 4 /\ set_of_list [a;b;c;d] = set_of_list [a;b;e;f] ==> + ((e = c /\ (f = d)) \/ ((e = d) /\ (f = c))) `, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REWRITE_TAC[set_of_list4_explicit]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP CARD4_ALL_DISTINCT)); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[EXTENSION;IN_INSERT;NOT_IN_EMPTY]; + REPEAT WEAK_STRIP_TAC; + FIRST_ASSUM (C INTRO_TAC [`c`]); + FIRST_ASSUM (C INTRO_TAC [`d`]); + FIRST_ASSUM (C INTRO_TAC [`e`]); + FIRST_X_ASSUM (C INTRO_TAC [`f`]); + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let LENGTH4_SET2_SWAP01 = prove_by_refinement( + `!(a:A) b c d e f. CARD {a,b,c,d} = 4 /\ set_of_list [a;b;c;d] = set_of_list [b;a;e;f] ==> + ((e = c /\ (f = d)) \/ ((e = d) /\ (f = c))) `, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REWRITE_TAC[set_of_list4_explicit]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM (MP_TAC o (MATCH_MP CARD4_ALL_DISTINCT)); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[EXTENSION;IN_INSERT;NOT_IN_EMPTY]; + REPEAT WEAK_STRIP_TAC; + FIRST_ASSUM (C INTRO_TAC [`c`]); + FIRST_ASSUM (C INTRO_TAC [`d`]); + FIRST_ASSUM (C INTRO_TAC [`e`]); + FIRST_X_ASSUM (C INTRO_TAC [`f`]); + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let CC_CELL_NOT_COPLANAR = prove_by_refinement( + `!V ul. packing V /\ + saturated V /\ + leaf V ul ==> ~coplanar (cc_cell V ul)`, + (* {{{ proof *) + [ + REWRITE_TAC[cc_cell]; + REWRITE_TAC[Pack_defs.mcell]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + INTRO_TAC CC_KE_34 [`V`;`ul`]; + DISCH_TAC; + ABBREV_TAC `k = cc_ke V ul`; + TYPIFY `~(k=0) /\ ~(k=1) /\ ~(k=2)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + FIRST_X_ASSUM_ST `\/` DISJ_CASES_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC MCELL3_NONPLANAR; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC[cc_uh;IN]); + FIRST_X_ASSUM_ST `cc_ke` MP_TAC; + REWRITE_TAC[cc_ke]; + COND_CASES_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + BY(ASM_MESON_TAC[cc_uh;leaf;IN;arith `~(x < sqrt2) ==> sqrt2 <= x`]); + ASM_REWRITE_TAC[arith `~(4=3)`]; + MATCH_MP_TAC MCELL4_NONPLANAR; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `cc_ke` MP_TAC; + REWRITE_TAC[cc_ke]; + COND_CASES_TAC; + BY(ASM_MESON_TAC[REWRITE_RULE[IN] cc_uh]); + BY(ASM_REWRITE_TAC[arith `~(3=4)`]) + ]);; + (* }}} *) + +let CC_CELL_NOT_COPLANAR_EXTREME = prove_by_refinement( + `!V ul pp. packing V /\ + saturated V /\ + leaf V ul /\ + ((if cc_ke V ul = 3 then mxi V (cc_uh V ul) else EL 3 (cc_uh V ul)) = + pp) ==> ~coplanar {EL 0 ul, EL 1 ul, EL 2 ul,pp}`, + (* {{{ proof *) + [ + ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `coplanar (convex hull {EL 0 ul, EL 1 ul, EL 2 ul, pp})` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[COPLANAR_SUBSET;CONVEX_HULL_SUBSET_AFFINE_HULL]); + INTRO_TAC CC_CELL34 [`V`;`ul`;`pp`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + BY(ASM_MESON_TAC[CC_CELL_NOT_COPLANAR]) + ]);; + (* }}} *) + +let CC_CELL_NOT_NULLSET = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ leaf V ul ==> + ~NULLSET (cc_cell V ul)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `vol(cc_cell V ul) = &0` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[volume_props]); + ABBREV_TAC `(p:real^3) = (if cc_ke V ul = 3 then mxi V (cc_uh V ul) else EL 3 (cc_uh V ul))`; + INTRO_TAC CC_CELL34 [`V`;`ul`;`p`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC ZWVCBMN [`EL 0 ul`;` EL 1 ul`;` EL 2 ul`;` p`]; + ANTS_TAC; + MATCH_MP_TAC CC_CELL_NOT_COPLANAR_EXTREME; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM (SUBST1_TAC o GSYM); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let CC_CELL_EXTREME_CARD = prove_by_refinement( + `!V ul pp. packing V /\ + saturated V /\ + leaf V ul /\ + ((if cc_ke V ul = 3 then mxi V (cc_uh V ul) else EL 3 (cc_uh V ul)) = + pp) ==> CARD {EL 0 ul, EL 1 ul, EL 2 ul,pp} = 4`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MATCH_MP_TAC Collect_geom2.NOT_COPLANAR_IMP_CARD4; + GMATCH_SIMP_TAC (GSYM coplanar_eq_coplanar_alt); + REWRITE_TAC[DIMINDEX_3;arith `2 <= 3`]; + MATCH_MP_TAC CC_CELL_NOT_COPLANAR_EXTREME; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let CC_CELL_INDEPENDENT = prove_by_refinement( + `!V ul pp. packing V /\ + saturated V /\ + leaf V ul /\ + (if cc_ke V ul = 3 then mxi V (cc_uh V ul) else EL 3 (cc_uh V ul)) = + pp ==> ~affine_dependent {EL 0 ul, EL 1 ul, EL 2 ul,pp}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[AFFINE_INDEPENDENT_IFF_CARD]; + GMATCH_SIMP_TAC CC_CELL_EXTREME_CARD; + CONJ_TAC; + TYPIFY `V` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + BY(REWRITE_TAC[FINITE_INSERT;FINITE_EMPTY]); + REWRITE_TAC[INT_ARITH `&4 - (int_of_num) 1 = &3`]; + REWRITE_TAC[INT_ARITH `x = int_of_num 3 <=> x <= &3 /\ ~(x <= &2)`]; + CONJ_TAC; + INTRO_TAC AFF_DIM_LE_UNIV [`{EL 0 ul, EL 1 ul, EL 2 ul, pp}`]; + BY(REWRITE_TAC[DIMINDEX_3]); + DISCH_THEN (MP_TAC o (MATCH_MP Rogers.AFF_DIM_LE_2_IMP_COPLANAR)); + REWRITE_TAC[]; + MATCH_MP_TAC CC_CELL_NOT_COPLANAR_EXTREME; + TYPIFY `V` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let CC_CELL_CONVEX_HULL_INJ = prove_by_refinement( + `!V ul vl pu pv. packing V /\ saturated V /\ leaf V ul /\ leaf V vl /\ + (if cc_ke V ul = 3 then mxi V (cc_uh V ul) else EL 3 (cc_uh V ul)) = pu /\ + (if cc_ke V vl = 3 then mxi V (cc_uh V vl) else EL 3 (cc_uh V vl)) = pv /\ + cc_cell V ul = cc_cell V vl ==> + {EL 0 ul, EL 1 ul, EL 2 ul, pu} = {EL 0 vl,EL 1 vl, EL 2 vl, pv} + `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ [` {EL 0 ul, EL 1 ul, EL 2 ul, pu}`;`{EL 0 vl,EL 1 vl, EL 2 vl, pv}`]; + ANTS_TAC; + BY(CONJ_TAC THEN MATCH_MP_TAC CC_CELL_INDEPENDENT THEN TYPIFY `V` EXISTS_TAC THEN ASM_REWRITE_TAC[]); + DISCH_THEN (unlist REWRITE_TAC o SYM); + FIRST_X_ASSUM MP_TAC; + REPEAT (GMATCH_SIMP_TAC CC_CELL34); + TYPIFY `pv` EXISTS_TAC; + ASM_REWRITE_TAC[]; + TYPIFY `pu` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]) + ]);; + (* }}} *) + +let FUEIMOV_K = prove_by_refinement( + `!V ul vl. saturated V /\ packing V /\ leaf V ul /\ leaf V vl /\ + cc_cell V ul = cc_cell V vl ==> (cc_ke V ul = cc_ke V vl)`, + (* {{{ proof *) + [ + REWRITE_TAC[cc_cell]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Ajripqn.AJRIPQN [`V`;`(cc_uh V ul)`;`(cc_uh V vl)`;`(cc_ke V ul)`;`(cc_ke V vl)`]; + ASM_REWRITE_TAC[IN_INSERT;NOT_IN_EMPTY]; + DISCH_THEN MATCH_MP_TAC; + TYPIFY `barV V 3 (cc_uh V ul) /\ barV V 3 (cc_uh V vl)` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(ASM_MESON_TAC[REWRITE_RULE[IN] cc_uh]); + ASM_SIMP_TAC[CC_KE_34]; + REWRITE_TAC[INTER_IDEMPOT]; + BY(ASM_MESON_TAC[ CC_CELL_NOT_NULLSET;cc_cell]) + ]);; + (* }}} *) + +let LIST_OF_CC_UH = prove_by_refinement( + `!V ul. saturated V /\ packing V /\ leaf V ul ==> + (cc_uh V ul) = [EL 0 ul; EL 1 ul; EL 2 ul; EL 3 (cc_uh V ul)]`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `LENGTH (cc_uh V ul) = 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[cc_uh;IN;Sphere.BARV;arith `3 + 1 = 4`]); + GMATCH_SIMP_TAC LENGTH4; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[EL_CC_UH]; + BY(SIMP_TAC[EL;HD;TL;arith `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]) + ]);; + (* }}} *) + +let SET_OF_LIST_CC_UH = prove_by_refinement( + `!V ul. saturated V /\ packing V /\ leaf V ul ==> + set_of_list (cc_uh V ul) = {EL 0 ul, EL 1 ul, EL 2 ul, EL 3 (cc_uh V ul)}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `LENGTH (cc_uh V ul) = 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[cc_uh;IN;Sphere.BARV;arith `3 + 1 = 4`]); + GMATCH_SIMP_TAC set_of_list4; + ASM_REWRITE_TAC[]; + BY(ASM_SIMP_TAC[EL_CC_UH]) + ]);; + (* }}} *) + +let MCELL4_EXTREME_POINT = prove_by_refinement( + `!V ul vl. saturated V /\ packing V /\ leaf V ul /\ leaf V vl /\ + cc_cell V ul = cc_cell V vl /\ (cc_ke V ul = 4) ==> set_of_list (cc_uh V ul) = set_of_list (cc_uh V vl)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `cc_ke V vl = 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[FUEIMOV_K]); + ASM_SIMP_TAC[SET_OF_LIST_CC_UH]; + INTRO_TAC CC_CELL_CONVEX_HULL_INJ[`V`;`ul`;`vl`;`EL 3 (cc_uh V ul)`;`EL 3 (cc_uh V vl)`]; + BY(ASM_SIMP_TAC [arith `k = 4 ==> ~(k = 3)`]) + ]);; + (* }}} *) + +let STEM_OF_LEAF = prove_by_refinement( + `!V ul. leaf V ul ==> + stem ul = {EL 0 ul, EL 1 ul}`, + (* {{{ proof *) + [ + REWRITE_TAC[stem;leaf;IN;Sphere.BARV;arith `2 + 1 = 3`]; + REPEAT WEAK_STRIP_TAC; + GMATCH_SIMP_TAC set_of_list2; + SUBCONJ_TAC; + REWRITE_TAC[arith `2 = 1 + 1`]; + MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX; + BY(ASM_REWRITE_TAC[arith `1 + 1 <= 3`]); + DISCH_TAC; + BY(ASM_MESON_TAC[arith `1+1<= 3 /\ 0 <= 1 /\ 1 <= 1`;Packing3.EL_TRUNCATE_SIMPLEX]) + ]);; + (* }}} *) + +let FUEIMOV_4 = prove_by_refinement( + `!V ul vl. saturated V /\ packing V /\ leaf V ul /\ leaf V vl /\ + cc_cell V ul = cc_cell V vl /\ (stem ul = stem vl) /\ (cc_ke V ul = 4) /\ ~(ul = vl) ==> + cc_uh V vl = [EL 1 ul;EL 0 ul;EL 3 (cc_uh V ul);EL 2 ul]`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `cc_ke V vl = 4` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[FUEIMOV_K]); + INTRO_TAC MCELL4_EXTREME_POINT [`V`;`ul`;`vl`]; + ASM_REWRITE_TAC[]; + REPEAT (GMATCH_SIMP_TAC SET_OF_LIST_CC_UH); + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `stem` MP_TAC; + REPEAT (GMATCH_SIMP_TAC STEM_OF_LEAF); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + TYPIFY `(EL 0 vl = EL 0 ul /\ EL 1 vl = EL 1 ul) \/ (EL 0 vl = EL 1 ul /\ EL 1 vl = EL 0 ul)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM MP_TAC; + BY(SET_TAC[]); + INTRO_TAC K4_CHI_MSB_POS [`V`;`ul`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC K4_CHI_MSB_POS [`V`;`vl`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY ` [EL 0 ul; EL 1 ul; EL 2 ul] = ul /\ [EL 0 vl; EL 1 vl; EL 2 vl] = vl` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[LENGTH3;leaf;IN;Sphere.BARV;arith `2 + 1 = 3`]); + FIRST_X_ASSUM_ST `\/` DISJ_CASES_TAC; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC LENGTH4_SET2 [`EL 0 ul`;`EL 1 ul`;`EL 2 ul`;`EL 3 (cc_uh V ul)`;`EL 2 vl`;`EL 3 (cc_uh V vl)`]; + ANTS_TAC; + INTRO_TAC CC_CELL_EXTREME_CARD[`V`;`ul`;`EL 3(cc_uh V ul)`]; + ASM_REWRITE_TAC[arith `~(4=3)`]; + DISCH_THEN (SUBST1_TAC); + BY(ASM_REWRITE_TAC[set_of_list4_explicit]); + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_MESON_TAC[]); + REPEAT (FIRST_X_ASSUM_ST `/\` MP_TAC) THEN REPEAT WEAK_STRIP_TAC; + PROOF_BY_CONTR_TAC; + REPEAT (FIRST_X_ASSUM_ST `chi_msb` MP_TAC); + ABBREV_TAC `c = cc_uh V ul`; + ABBREV_TAC `d = cc_uh V vl`; + EXPAND_TAC "ul"; + EXPAND_TAC "vl"; + REPEAT (FIRST_X_ASSUM_ST `CONS x y = z` kill); + ASM_REWRITE_TAC[]; + DISCH_TAC; + ONCE_REWRITE_TAC[chi_msb_swap_23]; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + COMMENT "second branch"; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC LENGTH4_SET2_SWAP01 [`EL 0 ul`;`EL 1 ul`;`EL 2 ul`;`EL 3 (cc_uh V ul)`;`EL 2 vl`;`EL 3 (cc_uh V vl)`]; + ANTS_TAC; + INTRO_TAC CC_CELL_EXTREME_CARD[`V`;`ul`;`EL 3(cc_uh V ul)`]; + ASM_REWRITE_TAC[arith `~(4=3)`]; + DISCH_THEN (SUBST1_TAC); + BY(ASM_REWRITE_TAC[set_of_list4_explicit]); + DISCH_THEN DISJ_CASES_TAC; + REPEAT (FIRST_X_ASSUM_ST `/\` MP_TAC) THEN REPEAT WEAK_STRIP_TAC; + PROOF_BY_CONTR_TAC; + REPEAT (FIRST_X_ASSUM_ST `chi_msb` MP_TAC); + ABBREV_TAC `c = cc_uh V ul`; + ABBREV_TAC `d = cc_uh V vl`; + EXPAND_TAC "ul"; + EXPAND_TAC "vl"; + REPEAT (FIRST_X_ASSUM_ST `CONS x y = z` kill); + ASM_REWRITE_TAC[]; + DISCH_TAC; + ONCE_REWRITE_TAC[chi_msb_swap_01]; + BY(FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + INTRO_TAC LIST_OF_CC_UH [`V`;`vl`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + DISCH_THEN SUBST1_TAC; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let MXI_NOT_IN_V = prove_by_refinement( + `!V ul. saturated V /\ packing V /\ leaf V ul /\ (cc_ke V ul = 3) ==> + ~(mxi V (cc_uh V ul) IN V)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC MXI_IN_VORONOI_LIST [`V`;`(cc_uh V ul)`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC[cc_uh;IN]); + FIRST_X_ASSUM_ST `cc_ke` MP_TAC; + REWRITE_TAC[cc_ke]; + COND_CASES_TAC; + BY(REWRITE_TAC[arith `~(4=3)`]); + ASM_SIMP_TAC[arith `~(x < y) ==> (y <= x)`]; + BY(ASM_MESON_TAC[cc_uh;leaf]); + REPEAT WEAK_STRIP_TAC; + TYPIFY `EL 0 (cc_uh V ul) = EL 0 ul` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[EL_CC_UH]); + TYPIFY `EL 0 (cc_uh V ul) IN V` (C SUBGOAL_THEN ASSUME_TAC); + ASM_REWRITE_TAC[EL]; + INTRO_TAC Packing3.BARV_SUBSET [`V`;`2`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[leaf;IN]); + INTRO_TAC Packing3.BARV_IMP_HD_IN_SET_OF_LIST [`V`;`2`;`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[leaf;IN]); + BY(ASM_MESON_TAC[Packing3.IN_TRANS]); + TYPIFY `&0 < sqrt2 /\ sqrt2 < sqrt(&4)` (C SUBGOAL_THEN MP_TAC); + REWRITE_TAC[Sphere.sqrt2]; + GMATCH_SIMP_TAC REAL_LT_RSQRT; + CONJ_TAC; + BY(REAL_ARITH_TAC); + GMATCH_SIMP_TAC REAL_LT_RSQRT; + GMATCH_SIMP_TAC SQRT_POW_2; + BY(REAL_ARITH_TAC); + REWRITE_TAC[Collect_geom2.SQRT4_EQ2]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM_ST `packing` MP_TAC; + REWRITE_TAC[Sphere.packing;NOT_FORALL_THM]; + GEXISTL_TAC [`EL 0 (cc_uh V ul)`;`mxi V (cc_uh V ul)`]; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[arith `x < y ==> ~(y <= x)`]; + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + CONJ_TAC; + BY(ASM_MESON_TAC[IN]); + DISCH_TAC; + FIRST_X_ASSUM_ST `dist` MP_TAC; + ASM_REWRITE_TAC[DIST_REFL]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let MCELL_V_INTER_EXTREME = prove_by_refinement( + `!V ul . + saturated V /\ packing V /\ leaf V ul /\ (cc_ke V ul = 3) + ==> + V INTER {EL 0 ul,EL 1 ul, EL 2 ul,mxi V (cc_uh V ul)} = set_of_list ul`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `LENGTH ul = 3` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[leaf;IN;Sphere.BARV;arith `2 + 1 = 3`]); + MATCH_MP_TAC SUBSET_ANTISYM; + CONJ2_TAC; + REWRITE_TAC[SUBSET_INTER]; + CONJ_TAC; + MATCH_MP_TAC Packing3.BARV_SUBSET; + EXISTS_TAC `2`; + BY(ASM_MESON_TAC[leaf;IN]); + GMATCH_SIMP_TAC set_of_list3; + ASM_REWRITE_TAC[]; + BY(SET_TAC[]); + GMATCH_SIMP_TAC set_of_list3; + ASM_REWRITE_TAC[]; + INTRO_TAC MXI_NOT_IN_V [`V`;`ul`]; + ASM_REWRITE_TAC[]; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let MCELL_EXTREME_DIFF_V = prove_by_refinement( + `!V ul . + saturated V /\ packing V /\ leaf V ul /\ (cc_ke V ul = 3) + ==> + {EL 0 ul,EL 1 ul, EL 2 ul,mxi V (cc_uh V ul)} DIFF V = {mxi V (cc_uh V ul)}`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `LENGTH ul = 3` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[leaf;IN;Sphere.BARV;arith `2 + 1 = 3`]); + MATCH_MP_TAC SUBSET_ANTISYM; + CONJ2_TAC; + INTRO_TAC MXI_NOT_IN_V [`V`;`ul`]; + ASM_REWRITE_TAC[]; + BY(SET_TAC[]); + INTRO_TAC MCELL_V_INTER_EXTREME [`V`;`ul`]; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC set_of_list3; + ASM_REWRITE_TAC[]; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let FUEIMOV_3 = prove_by_refinement( + `!V ul vl. saturated V /\ packing V /\ leaf V ul /\ leaf V vl /\ (cc_ke V ul = 3) /\ + {EL 0 ul,EL 1 ul} = {EL 0 vl,EL 1 vl} /\ cc_cell V ul = cc_cell V vl ==> (ul = vl)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `LENGTH ul = 3 /\ LENGTH vl = 3` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[leaf;IN;Sphere.BARV;arith `2 + 1 = 3`]); + REPEAT WEAK_STRIP_TAC; + TYPIFY `cc_ke V vl = 3` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC CC_KE_34 [`V`;`vl`]; + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC FUEIMOV_K [`V`;`vl`;`ul`]; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC CC_CELL_CONVEX_HULL_INJ [`V`;`ul`;`vl`;`mxi V (cc_uh V ul)`;`mxi V (cc_uh V vl)`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `mxi V (cc_uh V ul) = mxi V (cc_uh V vl)` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC MCELL_EXTREME_DIFF_V [`V`;`ul`]; + INTRO_TAC MCELL_EXTREME_DIFF_V [`V`;`vl`]; + FIRST_X_ASSUM MP_TAC; + ASM_REWRITE_TAC[]; + BY(SET_TAC[]); + TYPIFY `{EL 0 ul, EL 1 ul, EL 2 ul} = {EL 0 vl, EL 1 vl, EL 2 vl}` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC MCELL_V_INTER_EXTREME [`V`;`ul`]; + INTRO_TAC MCELL_V_INTER_EXTREME [`V`;`vl`]; + ASM_REWRITE_TAC[]; + REPEAT (GMATCH_SIMP_TAC set_of_list3); + CONJ_TAC; + BY(ASM_REWRITE_TAC[]); + CONJ_TAC; + BY(ASM_REWRITE_TAC[]); + FIRST_X_ASSUM_ST `EL` MP_TAC; + BY(SET_TAC[]); + TYPIFY `~(EL 0 ul = EL 1 ul)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Marchal_cells_2_new.CARD4_IMP_DISTINCT; + GEXISTL_TAC [`EL 2 ul`;`mxi V (cc_uh V ul)`]; + MATCH_MP_TAC CC_CELL_EXTREME_CARD; + TYPIFY `V` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `~(EL 1 ul = EL 2 ul)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Marchal_cells_2_new.CARD4_IMP_DISTINCT; + GEXISTL_TAC [`EL 0 ul`;`mxi V (cc_uh V ul)`]; + TYPIFY `{EL 1 ul, EL 2 ul, EL 0 ul, mxi V (cc_uh V ul)} = {EL 0 ul, EL 1 ul, EL 2 ul, mxi V (cc_uh V ul)}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + MATCH_MP_TAC CC_CELL_EXTREME_CARD; + TYPIFY `V` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `~(EL 0 ul = EL 2 ul)` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Marchal_cells_2_new.CARD4_IMP_DISTINCT; + GEXISTL_TAC [`EL 1 ul`;`mxi V (cc_uh V ul)`]; + TYPIFY `{EL 0 ul, EL 2 ul, EL 1 ul, mxi V (cc_uh V ul)} = {EL 0 ul, EL 1 ul, EL 2 ul, mxi V (cc_uh V ul)}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + MATCH_MP_TAC CC_CELL_EXTREME_CARD; + TYPIFY `V` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + TYPIFY `((EL 0 vl = EL 0 ul) /\ (EL 1 vl = EL 1 ul)) \/ ((EL 0 vl = EL 1 ul) /\ (EL 1 vl = EL 0 ul))` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `{a,b}={c,d}` MP_TAC; + REWRITE_TAC[Collect_geom.PAIR_EQ_EXPAND]; + DISCH_THEN DISJ_CASES_TAC; + BY(ASM_REWRITE_TAC[]); + BY(ASM_REWRITE_TAC[]); + COMMENT "1. next match EL 2"; + TYPIFY `EL 2 vl = EL 2 ul` (C SUBGOAL_THEN ASSUME_TAC); + (FIRST_X_ASSUM_ST `x INSERT y = x' INSERT y'` MP_TAC); + REWRITE_TAC[EXTENSION;IN_INSERT;NOT_IN_EMPTY]; + DISCH_TAC; + FIRST_ASSUM (C INTRO_TAC [`EL 0 ul`]); + FIRST_ASSUM (C INTRO_TAC [`EL 1 ul`]); + FIRST_X_ASSUM (C INTRO_TAC [`EL 2 ul`]); + REPEAT (FIRST_X_ASSUM_ST `~` MP_TAC); + REWRITE_TAC[]; + FIRST_X_ASSUM DISJ_CASES_TAC; + ASM_REWRITE_TAC[]; + BY(MESON_TAC[]); + ASM_REWRITE_TAC[]; + BY(MESON_TAC[]); + COMMENT "1. now use chi_msb to eliminate the second case"; + FIRST_X_ASSUM DISJ_CASES_TAC; + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + GMATCH_SIMP_TAC LENGTH3; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[LENGTH3]); + INTRO_TAC CELL3_NONDEG [`V`;`ul`]; + ASM_REWRITE_TAC[]; + INTRO_TAC CELL3_NONDEG [`V`;`vl`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + ABBREV_TAC `xi = mxi V (cc_uh V vl)`; + TYPIFY `chi_msb vl xi = chi_msb [EL 1 ul;EL 0 ul;EL 2 ul] xi` (C SUBGOAL_THEN MP_TAC); + REPEAT (AP_TERM_TAC ORELSE AP_THM_TAC); + REPEAT (FIRST_X_ASSUM (MP_TAC o (MATCH_MP LENGTH3))); + DISCH_TAC; + DISCH_THEN SUBST1_TAC; + BY(ASM_REWRITE_TAC[]); + ONCE_REWRITE_TAC[chi_msb_swap_01]; + REPEAT (FIRST_X_ASSUM (MP_TAC o (MATCH_MP LENGTH3))); + DISCH_THEN (SUBST1_TAC o GSYM); + REPEAT (FIRST_X_ASSUM_ST `chi_msb` MP_TAC); + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let TWO_REARRANGEMENT_LEMMA_ALT = prove_by_refinement( + `!V ul u0 u1 u2 u3. + packing V /\ saturated V /\ barV V 3 ul /\ ul = [u0;u1;u2;u3] ==> + (?p. p permutes 0..1 /\ [u1;u0;u2;u3] = left_action_list p ul)`, + (* {{{ proof *) + [ + BY(MESON_TAC[Qzksykg.TWO_REARRANGEMENT_LEMMA]) + ]);; + (* }}} *) + +let MCELL2_EDGE_FIRST = prove_by_refinement( + `!V ul u v. saturated V /\ packing V /\ ul IN barV V 3 /\ + {u,v} IN edgeX V (mcell2 V ul) ==> + (?vl. vl IN barV V 3 /\ u = EL 0 vl /\ v = EL 1 vl /\ mcell2 V ul = mcell2 V vl)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `barV V 3 ul` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[IN]); + INTRO_TAC MCELL2_EDGE [`V`;`ul`;`{u,v}`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + REWRITE_TAC[Geomdetail.PAIR_EQ_EXPAND]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `ul` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + COMMENT "second case"; + INTRO_TAC TWO_REARRANGEMENT_LEMMA_ALT [`V`;`ul`;`v`;`u`;`EL 2 ul`;`EL 3 ul`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC LENGTH4; + BY(ASM_MESON_TAC[IN;Sphere.BARV;arith `3 + 1 = 4`]); + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Rvfxzbu.RVFXZBU [`V`;`ul`;`2`;`p`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[IN_INSERT;arith `2 -1 = 1`]); + DISCH_TAC; + INTRO_TAC Qzksykg.QZKSYKG1 [`V`;`ul`;`left_action_list p ul`;`2`;`p`]; + ANTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;arith `2 - 1 = 1`]; + DISCH_TAC; + BY(ASM_MESON_TAC[NOT_IN_EMPTY; RIJRIED;MCELL2;NEGLIGIBLE_EMPTY]); + DISCH_TAC; + TYPIFY `left_action_list p ul` EXISTS_TAC; + ASM_REWRITE_TAC[IN;MCELL2]; + FIRST_X_ASSUM_ST `EL 3` (SUBST1_TAC o SYM); + REPEAT (FIRST_X_ASSUM_ST `EL` MP_TAC); + REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0`]; + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let FINITE_CARD1_IMP_SINGLETON = prove_by_refinement( + `!(S:A->bool). FINITE S /\ CARD S = 1 ==> (?x. S = {x})`, + (* {{{ proof *) + [ + ASM_MESON_TAC[ Local_lemmas.FINITE_CARD1_IMP_SINGLETON] + ]);; + (* }}} *) + +let SET2_INSERT1 = prove_by_refinement( + `!(a:A) b x y z. {a,b} SUBSET {x,y,z} /\ ~(a = b) ==> (?c. {a,b,c} = {x,y,z})`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `FINITE ({x, y, z} DIFF {a, b})` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC FINITE_DIFF; + BY(REWRITE_TAC[FINITE_INSERT;FINITE_EMPTY]); + TYPIFY `CARD {x,y,z} <= 3` (C SUBGOAL_THEN ASSUME_TAC); + BY(MESON_TAC[Geomdetail.CARD3]); + INTRO_TAC Hypermap.LEMMA_CARD_DIFF [`{x,y,z}`;`{a,b}`]; + ASM_REWRITE_TAC[FINITE_INSERT;FINITE_EMPTY]; + TYPIFY `CARD {a,b} = 2` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_REWRITE_TAC[Geomdetail.CARD_SET2]); + DISCH_TAC; + TYPIFY `CARD ({x,y,z} DIFF {a,b}) = 0 \/ CARD({x,y,z} DIFF {a,b}) = 1` (C SUBGOAL_THEN MP_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + INTRO_TAC CARD_EQ_0 [`{x, y, z} DIFF {a, b}`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `a` EXISTS_TAC; + FIRST_X_ASSUM MP_TAC; + FIRST_X_ASSUM_ST `SUBSET` MP_TAC; + BY(SET_TAC[]); + INTRO_TAC FINITE_CARD1_IMP_SINGLETON [`{x, y, z} DIFF {a, b}`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `x'` EXISTS_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]) + ]);; + (* }}} *) + +let MCELL3_EDGE_FIRST = prove_by_refinement( + `!V ul u v. saturated V /\ packing V /\ ul IN barV V 3 /\ + {u,v} IN edgeX V (mcell3 V ul) ==> + (?vl. vl IN barV V 3 /\ u = EL 0 vl /\ v = EL 1 vl /\ mcell3 V ul = mcell3 V vl)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `barV V 3 ul` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[IN]); + TYPIFY `~NULLSET(mcell3 V ul)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[NOT_IN_EMPTY; RIJRIED;MCELL3;NEGLIGIBLE_EMPTY]); + INTRO_TAC MCELL3_EDGE [`V`;`ul`;`u`;`v`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC SET_OF_LIST_TRUNCATE_2 [`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[arith `3 <= 3 + 1`;IN;Sphere.BARV]); + DISCH_TAC; + INTRO_TAC SET2_INSERT1 [`u`;`v`;`EL 0 ul`;`EL 1 ul`;`EL 2 ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + TYPIFY `{EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = set_of_list ul` (C SUBGOAL_THEN ASSUME_TAC); + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + MATCH_MP_TAC set_of_list4; + BY(ASM_MESON_TAC[arith `3+1 = 4`;IN;Sphere.BARV]); + INTRO_TAC Marchal_cells_3.LEFT_ACTION_LIST_2_EXISTS [`EL 0 ul`;`EL 1 ul`;`EL 2 ul`;`u`;`v`;`c`;`EL 3 ul`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + INTRO_TAC Marchal_cells_3.BARV_CARD_LEMMA [`V`;`ul`;`3`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + MATCH_MP_TAC (arith `(x = y) ==> (x = 3 +1 ==> y = 4)`); + BY(REWRITE_TAC[]); + REPEAT WEAK_STRIP_TAC; + TYPIFY `left_action_list p ul` EXISTS_TAC; + INTRO_TAC Rvfxzbu.RVFXZBU [`V`;`ul`;`3`;`p`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[IN_INSERT;arith `3 -1 = 2`]); + DISCH_TAC; + INTRO_TAC Qzksykg.QZKSYKG1 [`V`;`ul`;`left_action_list p ul`;`3`;`p`]; + ANTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;arith `3 - 1 = 2`]; + DISCH_TAC; + BY(ASM_MESON_TAC[NOT_IN_EMPTY; RIJRIED;MCELL3;NEGLIGIBLE_EMPTY]); + DISCH_TAC; + ASM_REWRITE_TAC[IN;MCELL3]; + INTRO_TAC LENGTH4 [`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[arith `3 + 1 = 4`;IN;Sphere.BARV]); + DISCH_THEN (ASSUME_TAC o SYM); + FIRST_X_ASSUM_ST `CONS x y = left_action_list p q` MP_TAC; + ASM_REWRITE_TAC[]; + DISCH_THEN (SUBST1_TAC o SYM); + BY(REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0`]) + ]);; + (* }}} *) + +let SET2_INSERT2 = prove_by_refinement( + `!(a:A) b w x y z. {a,b} SUBSET {w,x,y,z} /\ ~(a = b) /\ CARD {w,x,y,z} = 4 ==> + (?c d. {w,x,y,z} = {a,b,c,d})`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Hypermap.LEMMA_CARD_DIFF [`{w,x,y,z}`;`{a,b}`]; + ASM_REWRITE_TAC[FINITE_INSERT;FINITE_EMPTY]; + INTRO_TAC Hypermap.CARD_TWO_ELEMENTS [`a`;`b`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC [arith `4 = x + 2 <=> x = 2`]; + DISCH_TAC; + INTRO_TAC Rogers.CARD_2_IMP_DOUBLE [`{w, x, y, z} DIFF {a, b}`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + MATCH_MP_TAC FINITE_DIFF; + BY(REWRITE_TAC[FINITE_INSERT;FINITE_EMPTY]); + REPEAT WEAK_STRIP_TAC; + GEXISTL_TAC [`a'`;`b'`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]) + ]);; + (* }}} *) + +let MCELL4_EDGE_FIRST = prove_by_refinement( + `!V ul u v. saturated V /\ packing V /\ ul IN barV V 3 /\ + {u,v} IN edgeX V (mcell4 V ul) ==> + (?vl. vl IN barV V 3 /\ u = EL 0 vl /\ v = EL 1 vl /\ mcell4 V ul = mcell4 V vl)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `barV V 3 ul` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[IN]); + TYPIFY `~NULLSET(mcell4 V ul)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[NOT_IN_EMPTY; RIJRIED;MCELL4;NEGLIGIBLE_EMPTY]); + INTRO_TAC MCELL4_EDGE [`V`;`ul`;`u`;`v`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `{EL 0 ul, EL 1 ul, EL 2 ul, EL 3 ul} = set_of_list ul` (C SUBGOAL_THEN ASSUME_TAC); + ONCE_REWRITE_TAC[EQ_SYM_EQ]; + MATCH_MP_TAC set_of_list4; + BY(ASM_MESON_TAC[arith `3+1 = 4`;IN;Sphere.BARV]); + INTRO_TAC Marchal_cells_3.BARV_CARD_LEMMA [`V`;`ul`;`3`]; + ASM_REWRITE_TAC[arith `3 + 1 = 4`]; + DISCH_TAC; + INTRO_TAC SET2_INSERT2 [`u`;`v`;`EL 0 ul`;`EL 1 ul`;`EL 2 ul`;`EL 3 ul`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Marchal_cells_3.LEFT_ACTION_LIST_3_EXISTS [`EL 0 ul`;`EL 1 ul`;`EL 2 ul`;`EL 3 ul`;`u`;`v`;`c`;`d`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + TYPIFY `left_action_list p ul` EXISTS_TAC; + INTRO_TAC Rvfxzbu.RVFXZBU [`V`;`ul`;`4`;`p`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[IN_INSERT;arith `4 -1 = 3`]); + DISCH_TAC; + INTRO_TAC Qzksykg.QZKSYKG1 [`V`;`ul`;`left_action_list p ul`;`4`;`p`]; + ANTS_TAC; + ASM_REWRITE_TAC[IN_INSERT;arith `4 - 1 = 3`]; + DISCH_TAC; + BY(ASM_MESON_TAC[MCELL4;NEGLIGIBLE_EMPTY]); + DISCH_TAC; + ASM_REWRITE_TAC[IN;MCELL4]; + INTRO_TAC LENGTH4 [`ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[arith `3 + 1 = 4`;IN;Sphere.BARV]); + DISCH_THEN (ASSUME_TAC o SYM); + FIRST_X_ASSUM_ST `CONS x y = left_action_list p q` MP_TAC; + ASM_REWRITE_TAC[]; + DISCH_THEN (SUBST1_TAC o SYM); + BY(REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0`]) + ]);; + (* }}} *) + + +(* MCELL_EDGE_FIRST is YSAKKTX in the notes *) + +let MCELL_EDGE_FIRST = prove_by_refinement( + `!V ul k u v. saturated V /\ packing V /\ ul IN barV V 3 /\ + {u,v} IN edgeX V (mcell k V ul) ==> + (?vl. vl IN barV V 3 /\ mcell k V vl = mcell k V ul /\ u = EL 0 vl /\ v = EL 1 vl) + `, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + MP_TAC (arith `k <= 1 \/ k = 2 \/ k = 3 \/ 4 <= k`); + REPEAT WEAK_STRIP_TAC; + BY(ASM_MESON_TAC[EDGE_IMP_K2;NOT_IN_EMPTY;IN]); + INTRO_TAC MCELL2_EDGE_FIRST [`V`;`ul`;`u`;`v`]; + REWRITE_TAC[MCELL2]; + BY(ASM_MESON_TAC[]); + INTRO_TAC MCELL3_EDGE_FIRST [`V`;`ul`;`u`;`v`]; + REWRITE_TAC[MCELL3]; + BY(ASM_MESON_TAC[]); + INTRO_TAC MCELL4_EDGE_FIRST [`V`;`ul`;`u`;`v`]; + FIRST_X_ASSUM_ST `mcell` MP_TAC; + ASM_REWRITE_TAC[Pack_defs.mcell]; + ASM_SIMP_TAC [arith `4 <= k ==> ~(k=0) /\ ~(k = 1) /\ ~(k=2) /\ ~(k = 3)`]; + BY(ASM_MESON_TAC[]) + ]);; + (* }}} *) + +let BARV3_TRUNC2 = prove_by_refinement( + `!V ul. ul IN barV V 3 ==> truncate_simplex 2 ul = [EL 0 ul;EL 1 ul;EL 2 ul]`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `ul = [EL 0 ul;EL 1 ul; EL 2 ul; EL 3 ul]` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC LENGTH4; + BY(ASM_MESON_TAC[IN;Sphere.BARV;arith `3+1 = 4`]); + BY(ASM_MESON_TAC[Marchal_cells.TRUNCATE_SIMPLEX_EXPLICIT_2]) + ]);; + (* }}} *) + +let RBUTTCS = prove_by_refinement( + `!V vl u v. saturated V /\ packing V /\ {u,v} IN edgeX V (mcell4 V vl) /\ vl IN barV V 3 ==> + (?ul. leaf V ul /\ stem ul = {u,v} /\ (mcell4 V vl = cc_cell V ul))`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC MCELL_EDGE_FIRST [`V`;`vl`;`4`;`u`;`v`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ASM_MESON_TAC[MCELL4]); + REPEAT WEAK_STRIP_TAC; + TYPIFY `~(mcell 4 V vl' = {})` (C SUBGOAL_THEN MP_TAC); + BY(ASM_MESON_TAC[NOT_IN_EMPTY; RIJRIED;MCELL4;NEGLIGIBLE_EMPTY]); + DISCH_TAC; + FIRST_X_ASSUM_ST `mcell 4 V vl' = mcell 4 V vl` (fun t -> REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[MCELL4] THEN SUBST1_TAC (SYM t)); + REWRITE_TAC[MCELL4] THEN REPEAT WEAK_STRIP_TAC; + TYPED_ABBREV_TAC `(wl:(real^3) list) = truncate_simplex 2 (vl')` ; + TYPIFY `hl vl' < sqrt(&2)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `mcell` MP_TAC; + REWRITE_TAC[GSYM MCELL4;Pack_defs.mcell4]; + BY(MESON_TAC[]); + INTRO_TAC Rogers.XNHPWAB4 [`V`;`vl'`;`3`]; + ASM_REWRITE_TAC[]; + DISCH_THEN (C INTRO_TAC [`2`;`3`]); + ANTS_TAC; + BY(ARITH_TAC); + TYPIFY `truncate_simplex 3 vl' = vl'` (C SUBGOAL_THEN ASSUME_TAC); + MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_REFL; + BY(ASM_MESON_TAC[IN;Sphere.BARV;arith `3 + 1 =4`]); + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `hl wl < sqrt(&2)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + TYPIFY `leaf V wl` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[leaf]; + ASM_REWRITE_TAC[Sphere.sqrt2]; + REWRITE_TAC[IN]; + EXPAND_TAC "wl"; + MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV; + BY(ASM_MESON_TAC[IN;arith `2 <= 3`]); + TYPIFY `EL 0 wl = u /\ EL 1 wl = v /\ EL 2 wl = EL 2 vl'` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "wl"; + REPEAT (GMATCH_SIMP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + ASM_REWRITE_TAC[arith `1 <= 2 /\ 0 <= 2 /\ 2 <= 2`]; + BY(ASM_MESON_TAC[IN;Sphere.BARV;arith `2 + 1 <= 3 + 1`]); + ASM_CASES_TAC `mcell 4 V vl' = cc_cell V wl`; + TYPIFY `wl` EXISTS_TAC; + GMATCH_SIMP_TAC STEM_OF_LEAF; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + INTRO_TAC CFFONNL [`V`;`wl`;`mcell 4 V vl'`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + REWRITE_TAC[Pack_defs.mcell_set;IN_ELIM_THM]; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY]; + TYPIFY `EL 2 wl` EXISTS_TAC; + REWRITE_TAC[IN_INTER]; + CONJ_TAC; + INTRO_TAC Lepjbdj.LEPJBDJ [`V`;`vl'`;`4`]; + ASM_REWRITE_TAC[arith `1 <= 4 /\ 4 <= 4 /\ 4 - 1 = 3`]; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + TYPIFY `EL 2 vl' IN set_of_list vl'` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + GMATCH_SIMP_TAC set_of_list4; + CONJ_TAC; + BY(ASM_MESON_TAC[IN;Sphere.BARV;arith `3+1 = 4`]); + BY(SET_TAC[]); + BY(REWRITE_TAC[cc_A0;Local_lemmas.X_IN_AFF_GT_X]); + DISCH_THEN SUBST1_TAC; + TYPIFY `[EL 1 vl';EL 0 vl';EL 2 vl']` EXISTS_TAC; + REWRITE_TAC[]; + TYPIFY `wl = [EL 0 vl';EL 1 vl'; EL 2 vl']` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "wl"; + GMATCH_SIMP_TAC BARV3_TRUNC2; + BY(ASM_MESON_TAC[]); + INTRO_TAC ZASUVOR [`V`;`EL 0 vl'`;`EL 1 vl'`;`EL 2 vl'`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC STEM_OF_LEAF; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0`]; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let STEM_EDGEX = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ leaf V ul ==> + {EL 0 ul,EL 1 ul} IN edgeX V (cc_cell V ul)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC CC_CELL_NOT_NULLSET [`V`;`ul`]; + ASM_REWRITE_TAC[cc_cell]; + DISCH_TAC; + INTRO_TAC CC_KE_34 [`V`;`ul`]; + DISCH_TAC; + INTRO_TAC LIST_OF_CC_UH [`V`;`ul`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC Marchal_cells_3.BARV_CARD_LEMMA [`V`;`cc_uh V ul`;`3`]; + INTRO_TAC EL_CC_UH [`V`;`ul`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC cc_uh [`V`;`ul`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + ANTS_TAC; + BY(ASM_MESON_TAC[IN]); + REWRITE_TAC[arith `3 + 1 = 4`]; + DISCH_TAC; + INTRO_TAC set_of_list4 [`cc_uh V ul`]; + ANTS_TAC; + BY(ASM_MESON_TAC[Sphere.BARV;IN;arith `3 + 1 =4`]); + DISCH_TAC; + INTRO_TAC Marchal_cells_2_new.CARD4_IMP_DISTINCT [`EL 0 ul`;`EL 1 ul`;`EL 2 ul`;`EL 3 (cc_uh V ul)`]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + COMMENT "do cases"; + FIRST_X_ASSUM DISJ_CASES_TAC; + ASM_REWRITE_TAC[GSYM MCELL3]; + GMATCH_SIMP_TAC Bump.MCELL3_EDGE; + ASM_REWRITE_TAC[]; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[IN;MCELL3]); + DISCH_TAC; + GMATCH_SIMP_TAC set_of_list3; + CONJ_TAC; + BY(ASM_MESON_TAC[leaf;IN;Sphere.BARV;arith `3 = 2 + 1`]); + BY(SET_TAC[]); + COMMENT "do case 4"; + ASM_REWRITE_TAC[GSYM MCELL4]; + GMATCH_SIMP_TAC Bump.MCELL4_EDGE; + ASM_REWRITE_TAC[]; + SUBCONJ_TAC; + BY(ASM_MESON_TAC[IN;MCELL4]); + DISCH_TAC; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let FCHKUGT = prove_by_refinement( + `!V u0 u1 u2 u2'. saturated V /\ packing V /\ cc_A0 [u0;u1;u2] = cc_A0 [u0;u1;u2'] /\ + leaf V [u0;u1;u2] /\ leaf V [u0;u1;u2'] ==> (u2 = u2')`, + (* {{{ proof *) + [ + REWRITE_TAC[cc_A0;EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1`]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `~(u0 = u1)` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC STEM_EDGEX [`V`;`[u0;u1;u2]`]; + ASM_REWRITE_TAC[]; + ASM_REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1 /\ 3 = SUC 2`;CONS_11]; + REWRITE_TAC[IN_ELIM_THM;Pack_defs.edgeX;Geomdetail.PAIR_EQ_EXPAND]; + BY(MESON_TAC[]); + INTRO_TAC ZASUVOR [`V`;`u0`;`u1`;`u2`]; + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC CFFONNL [`V`;`[u0;u1;u2]`;`cc_cell V [u0;u1;u2']`]; + ASM_SIMP_TAC[CC_CELL_IN_MCELL_SET]; + REWRITE_TAC[TAUT `(a /\ b /\ ~c ==> d) <=> (a /\ b ==> c \/ d)`]; + ANTS_TAC; + REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0`]; + CONJ_TAC; + TYPIFY `{u0,u1} = {EL 0 [u0;u1;u2'],EL 1 [u0;u1;u2']}` (C SUBGOAL_THEN SUBST1_TAC); + BY(REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0`]); + MATCH_MP_TAC STEM_EDGEX; + BY(ASM_REWRITE_TAC[]); + INTRO_TAC NUNRRDS_0 [`V`;`[u0;u1;u2']`]; + ASM_REWRITE_TAC[cc_A0]; + REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1`]; + DISCH_TAC; + INTRO_TAC CC_KE_34 [`V`;`[u0;u1;u2']`]; + COMMENT "case k=3"; + DISCH_THEN DISJ_CASES_TAC; + FIRST_X_ASSUM DISJ_CASES_TAC; + INTRO_TAC FUEIMOV_3 [`V`;`[u0;u1;u2']`;`[u0;u1;u2]`]; + ASM_REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1`;CONS_11]; + BY(MESON_TAC[]); + INTRO_TAC FUEIMOV_3 [`V`;`[u0;u1;u2']`;`[u1;u0;u2]`]; + ANTS_TAC; + BY(ASM_REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1`;CONS_11;Geomdetail.PAIR_EQ_EXPAND]); + BY(ASM_REWRITE_TAC[CONS_11]); + COMMENT "case k=4"; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM DISJ_CASES_TAC; + INTRO_TAC FUEIMOV_4 [`V`;`[u0;u1;u2']`;`[u0;u1;u2]`]; + REWRITE_TAC[CONS_11]; + ASM_REWRITE_TAC[]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + REPEAT (GMATCH_SIMP_TAC STEM_OF_LEAF); + REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1`;Geomdetail.PAIR_EQ_EXPAND]; + BY(ASM_MESON_TAC[]); + ASM_REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1 /\ 3 = SUC 2`]; + INTRO_TAC LIST_OF_CC_UH [`V`;`[u0;u1;u2]`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + BY(ASM_REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1 /\ 3 = SUC 2`;CONS_11]); + COMMENT "case k=4 a"; + INTRO_TAC FUEIMOV_4 [`V`;`[u0;u1;u2']`;`[u1;u0;u2]`]; + REWRITE_TAC[CONS_11]; + ASM_REWRITE_TAC[]; + DISCH_THEN MP_TAC THEN ANTS_TAC; + REPEAT (GMATCH_SIMP_TAC STEM_OF_LEAF); + REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1`;Geomdetail.PAIR_EQ_EXPAND]; + BY(ASM_MESON_TAC[]); + INTRO_TAC LIST_OF_CC_UH [`V`;`[u1;u0;u2]`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + REWRITE_TAC[CONS_11]; + TYPIFY `EL 2 [u1;u0;u2] = u2` (C SUBGOAL_THEN SUBST1_TAC); + BY(ASM_REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1 /\ 3 = SUC 2`;CONS_11]); + REPEAT WEAK_STRIP_TAC; + INTRO_TAC CC_CELL_NOT_COPLANAR_EXTREME [`V`;`[u0;u1;u2']`;`u2`]; + ASM_REWRITE_TAC[arith `~(4=3)`]; + FIRST_X_ASSUM kill; + FIRST_X_ASSUM (SUBST1_TAC o SYM); + ASM_REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1 /\ 3 = SUC 2`;CONS_11]; + REPLICATE_TAC 8 (FIRST_X_ASSUM kill); + REWRITE_TAC[coplanar]; + GEXISTL_TAC [`u0`;`u1`;`u2`]; + TYPIFY `{u0,u1,u2} SUBSET affine hull {u0,u1,u2}` (C SUBGOAL_THEN ASSUME_TAC); + BY(REWRITE_TAC[HULL_SUBSET]); + TYPIFY `u2' IN affine hull {u0,u1,u2}` ENOUGH_TO_SHOW_TAC; + BY(FIRST_X_ASSUM MP_TAC THEN SET_TAC[]); + MATCH_MP_TAC Packing3.IN_TRANS; + TYPIFY `aff_gt {u0,u1} {u2}` EXISTS_TAC; + CONJ2_TAC; + INTRO_TAC AFF_GT_SUBSET_AFFINE_HULL [`{u0,u1}`;`{u2}`]; + TYPIFY `{u0,u1} UNION {u2} = {u0,u1,u2}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + BY(REWRITE_TAC[]); + ASM_REWRITE_TAC[]; + BY(REWRITE_TAC[Local_lemmas.X_IN_AFF_GT_X]) + ]);; + (* }}} *) + +let AZIM_BASE_SHIFT_LE = prove_by_refinement( + `!x y b1 b2 w1 w2. + ~(collinear {x,y,b1}) /\ ~(collinear {x,y,b2}) /\ ~(collinear {x,y,w1}) /\ + ~(collinear {x,y,w2}) /\ + azim x y b1 b2 <= azim x y b1 w1 /\ + azim x y b1 b2 <= azim x y b1 w2 ==> + azim x y b1 w2 - azim x y b1 w1 = azim x y b2 w2 - azim x y b2 w1`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Fan.sum4_azim_fan [`x`;`y`;`b1`;`b2`;`w1`]; + DISCH_THEN GMATCH_SIMP_TAC; + INTRO_TAC Fan.sum4_azim_fan [`x`;`y`;`b1`;`b2`;`w2`]; + DISCH_THEN GMATCH_SIMP_TAC; + ASM_REWRITE_TAC[]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let WEDGE_GE_SPLIT = prove_by_refinement( + `!u0 u1 u2 u3 w. + ~(collinear {u0,u1,u2}) /\ + ~(collinear {u0,u1,u3}) /\ + w IN wedge u0 u1 u2 u3 ==> + ( ~(collinear {u0,u1,w}) /\ + wedge_ge u0 u1 u2 u3 = wedge_ge u0 u1 u2 w UNION wedge_ge u0 u1 w u3)`, + (* {{{ proof *) + [ + REWRITE_TAC[wedge;IN_ELIM_THM]; + REWRITE_TAC[EXTENSION;IN_UNION;Local_lemmas.WEDGE_GE_AZIM_LE]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + ASM_CASES_TAC `azim u0 u1 u2 x <= azim u0 u1 u2 w`; + ASM_REWRITE_TAC[]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + ASM_REWRITE_TAC[]; + TYPIFY `collinear {u0,u1,x}` ASM_CASES_TAC; + INTRO_TAC (CONJUNCT2 (CONJUNCT2 AZIM_DEGENERATE)) [`u0`;`u1`;`u2`;`x`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + INTRO_TAC (CONJUNCT2 (CONJUNCT2 AZIM_DEGENERATE)) [`u0`;`u1`;`w`;`x`]; + ASM_REWRITE_TAC[]; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[Local_lemmas.AZIM_RANGE]); + ONCE_REWRITE_TAC[arith `x <= y <=> &0 <= y - x`]; + INTRO_TAC AZIM_BASE_SHIFT_LE [`u0`;`u1`;`u2`;`w`;`u3`;`x`]; + ASM_REWRITE_TAC[]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let IN_CONV0_IMP_AZIM_PI_ALT = prove_by_refinement( + `!x e a b. ~collinear {x, a, e} /\ x IN conv0 {a, b} ==> azim x e a b = pi`, + (* {{{ proof *) + [ + MESON_TAC[Local_lemmas.IN_CONV0_IMP_AZIM_PI] + ]);; + (* }}} *) + +let AFF_GT_0_2 = prove + (`!(v:real^A) w. + aff_gt {} {v,w} = + {y | ?t2 t3. + &0 < t2 /\ + &0 < t3 /\ + t2 + t3 = &1 /\ + y = t2 % v + t3 % w}`, + AFF_TAC +);; + +let MIDPOINT_IN_CONV0 = prove_by_refinement( + `!(p:real^A) q. (#0.5) % (p + q) IN conv0 {p,q}`, + (* {{{ proof *) + [ + REWRITE_TAC[conv0;SYM Sphere.aff_gt_def;AFF_GT_0_2]; + REWRITE_TAC[conv0;SYM Sphere.aff_gt_def;AFF_GT_0_2;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + GEXISTL_TAC [`#0.5`;`#0.5`]; + BY(REPEAT CONJ_TAC THENL [REAL_ARITH_TAC;REAL_ARITH_TAC;REAL_ARITH_TAC;VECTOR_ARITH_TAC]) + ]);; + (* }}} *) + +let AZIM_SPLIT_POINT = prove_by_refinement( + `!u0 u1 u2 u3. + ~collinear {u0,u1,u2} /\ + ~collinear {u0,u1,u3} /\ + pi < azim u0 u1 u2 u3 ==> + (?w. + w IN wedge u0 u1 u2 u3 /\ + azim u0 u1 u2 w = pi /\ + azim u0 u1 w u3 < pi) +`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ABBREV_TAC `(w:real^3) = &2 % u0 - u2`; + TYPIFY `w` EXISTS_TAC; + INTRO_TAC IN_CONV0_IMP_AZIM_PI_ALT [`u0`;`u1`;`u2`;`w`]; + ANTS_TAC; + CONJ_TAC; + TYPIFY `{u0,u2,u1} = {u0,u1,u2}` ENOUGH_TO_SHOW_TAC; + BY(DISCH_THEN SUBST1_TAC THEN ASM_REWRITE_TAC[]); + BY(SET_TAC[]); + INTRO_TAC MIDPOINT_IN_CONV0 [`u2`;`w`]; + MATCH_MP_TAC (TAUT `(a = b) ==> (a ==> b)`); + AP_THM_TAC THEN AP_TERM_TAC; + EXPAND_TAC "w"; + BY(VECTOR_ARITH_TAC); + DISCH_TAC; + ASM_REWRITE_TAC[]; + ASM_REWRITE_TAC[wedge;IN_ELIM_THM]; + REWRITE_TAC[PI_POS]; + SUBCONJ_TAC; + DISCH_TAC; + INTRO_TAC (CONJUNCT2 (CONJUNCT2 AZIM_DEGENERATE)) [`u0`;`u1`;`u2`;`w`]; + ASM_REWRITE_TAC[]; + MP_TAC PI_POS; + BY(REAL_ARITH_TAC); + DISCH_TAC; + INTRO_TAC Fan.sum4_azim_fan [`u0`;`u1`;`u2`;`w`;`u3`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(FIRST_X_ASSUM_ST `pi < x` MP_TAC THEN REAL_ARITH_TAC); + REWRITE_TAC[arith `x = pi + y <=> y = x - pi`]; + DISCH_THEN SUBST1_TAC; + BY(REWRITE_TAC[Local_lemmas.AZIM_RANGE;arith `x - pi < pi <=> x < &2 * pi`]) + ]);; + (* }}} *) + +let CLOSED_WEDGE_LT_PI = prove_by_refinement( + `!u0 u1 u2 u3. ~collinear {u0,u1,u2} /\ ~ collinear {u0,u1,u3} /\ + azim u0 u1 u2 u3 < pi ==> closed (wedge_ge u0 u1 u2 u3)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ASM_SIMP_TAC[Local_lemmas.WEDGE_GE_EQ_AFF_GE]; + MATCH_MP_TAC CLOSED_AFF_GE; + BY(REWRITE_TAC[FINITE_INSERT;FINITE_EMPTY]) + ]);; + (* }}} *) + +let CLOSED_WEDGE_EQ_PI = prove_by_refinement( + `!u0 u1 u2 u3. ~collinear {u0,u1,u2} /\ ~ collinear {u0,u1,u3} /\ + azim u0 u1 u2 u3 = pi ==> closed (wedge_ge u0 u1 u2 u3)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + ASM_SIMP_TAC[Local_lemmas.AZIM_PI_WEDGE_GE_CROSS_DOT]; + ABBREV_TAC `e = ((u1 - u0) cross (u2 - u0))`; + TYPIFY `!x. e dot (x - u0) = e dot x - e dot u0` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + BY(VECTOR_ARITH_TAC); + ONCE_REWRITE_TAC[arith `&0 <= x - y <=> x >= y`]; + BY(REWRITE_TAC[CLOSED_HALFSPACE_GE]) + ]);; + (* }}} *) + +let CLOSED_WEDGE = prove_by_refinement( + `!u0 u1 u2 u3. ~collinear {u0,u1,u2} /\ ~ collinear {u0,u1,u3} ==> closed (wedge_ge u0 u1 u2 u3)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `azim u0 u1 u2 u3 < pi \/ azim u0 u1 u2 u3 = pi \/ pi < azim u0 u1 u2 u3` (C SUBGOAL_THEN MP_TAC); + BY(REAL_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + BY(ASM_MESON_TAC[CLOSED_WEDGE_LT_PI]); + BY(ASM_MESON_TAC[CLOSED_WEDGE_EQ_PI]); + INTRO_TAC AZIM_SPLIT_POINT [`u0`;`u1`;`u2`;`u3`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC WEDGE_GE_SPLIT [`u0`;`u1`;`u2`;`u3`;`w`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC CLOSED_UNION; + CONJ_TAC; + BY(ASM_MESON_TAC[CLOSED_WEDGE_EQ_PI]); + BY(ASM_MESON_TAC[CLOSED_WEDGE_LT_PI]) + ]);; + (* }}} *) + +let WEDGE_INTER_AFF_GE = prove_by_refinement( + `!u0 u1 v1 v2. + wedge u0 u1 v1 v2 INTER aff_ge {u0,u1} {v1} = {} /\ + wedge u0 u1 v1 v2 INTER aff_ge {u0,u1} {v2} = {} + `, + (* {{{ proof *) + [ + REWRITE_TAC[wedge;EXTENSION;NOT_IN_EMPTY;IN_INTER;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + GMATCH_SIMP_TAC (GSYM Local_lemmas.AZIM_EQ_0_GE_ALT2); + CONJ2_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + DISCH_TAC; + BY(ASM_MESON_TAC[AZIM_DEGENERATE;arith `~(&0 < &0)`]); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC; + GMATCH_SIMP_TAC (GSYM Local_lemmas.AZIM_EQ_0_GE_ALT2); + SUBCONJ_TAC; + DISCH_TAC; + BY(ASM_MESON_TAC[AZIM_DEGENERATE;arith `~(&0 < x /\ x < &0)`]); + DISCH_TAC; + TYPIFY `~collinear {u0,u1,v1}` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[AZIM_DEGENERATE;arith `~(&0 < &0)`]); + DISCH_TAC; + INTRO_TAC Fan.sum5_azim_fan [`u0`;`u1`;`v1`;`v2`;`x`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[Local_lemmas.AZIM_RANGE]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let AFF_GE_SUBSET_WEDGE_GE = prove_by_refinement( + `!u0 u1 v1 v2. + ~collinear {u0,u1,v1} /\ + ~collinear {u0,u1,v2} ==> + aff_ge {u0,u1} {v1} SUBSET wedge_ge u0 u1 v1 v2 /\ + aff_ge {u0,u1} {v2} SUBSET wedge_ge u0 u1 v1 v2 + `, + (* {{{ proof *) + [ + REWRITE_TAC[Local_lemmas.WEDGE_GE_AZIM_LE;EXTENSION;NOT_IN_EMPTY;SUBSET;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[AND_FORALL_THM]; + GEN_TAC; + ASM_SIMP_TAC[GSYM Local_lemmas.AZIM_EQ_0_GE_ALT2;Local_lemmas.AZIM_RANGE]; + DISCH_TAC; + TYPIFY `collinear {u0,u1,x}` ASM_CASES_TAC; + BY(ASM_MESON_TAC[AZIM_DEGENERATE;Local_lemmas.AZIM_RANGE]); + INTRO_TAC Fan.sum5_azim_fan [`u0`;`u1`;`v1`;`v2`;`x`]; + ASM_REWRITE_TAC[Local_lemmas.AZIM_RANGE]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let BDXKHTW_PREP_LEMMA = prove_by_refinement( + `!u0 u1 v1 v2 V X. saturated V /\ packing V /\ leaf V [u0;u1;v1] /\ leaf V [u0;u1;v2] /\ + X IN mcell_set V /\ + {u0,u1} IN edgeX V X /\ + ~(azim u0 u1 v1 v2 = &0) /\ (?y. y IN X INTER wedge u0 u1 v1 v2) /\ + (?x. x IN X /\ ~(x IN wedge_ge u0 u1 v1 v2)) ==> + (convex X /\ ~(u0=u1) /\ ~collinear {u0,u1,v1} /\ ~collinear {u0,u1,v2} /\ + (?p q. p IN X INTER wedge u0 u1 v1 v2 /\ q IN X DIFF wedge_ge u0 u1 v1 v2 /\ ~coplanar {p,q,u0,u1} /\ + ~(p IN aff_ge {u0,u1} {v1} UNION aff_ge {u0,u1} {v2}) /\ + ~(q IN aff_ge {u0,u1} {v1} UNION aff_ge {u0,u1} {v2}))) +`, + (* {{{ proof *) + [ + COMMENT "initialize"; + REWRITE_TAC[SUBSET;Pack_defs.mcell_set;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC GBEWYFX [`V`;`[u0;u1;v1]`]; + INTRO_TAC GBEWYFX [`V`;`[u0;u1;v2]`]; + ASM_REWRITE_TAC[Bump.set_of_list3_explicit]; + REPEAT WEAK_STRIP_TAC; + ASM_CASES_TAC `NULLSET X`; + INTRO_TAC Bump.RIJRIED [`V`;`ul`;`i`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + BY(ASM_MESON_TAC[NOT_IN_EMPTY]); + TYPIFY `2 <= i` (C SUBGOAL_THEN ASSUME_TAC); + REWRITE_TAC[arith `2 <= i <=> ~(i <= 1)`]; + DISCH_TAC; + INTRO_TAC Bump.EDGE_IMP_K2 [`V`;`ul`;`i`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[IN]); + BY(ASM_MESON_TAC[NOT_IN_EMPTY]); + TYPIFY `convex X` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[MCELL_CONVEX;IN]); + PROOF_BY_CONTR_TAC; + ABBREV_TAC `(s:real^3->bool) = aff_ge {u0,u1} {v1} UNION aff_ge {u0,u1} {v2}`; + TYPIFY `NULLSET s` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "s"; + MATCH_MP_TAC (CONJUNCT2 NULLSET_RULES); + BY(ASM_SIMP_TAC[Conforming.NEGLIGIBLE_AFF_GE_2_1]); + ABBREV_TAC `(X':real^3->bool) = X DIFF s`; + COMMENT "X' not planar"; + TYPIFY `~(coplanar X')` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "X'"; + DISCH_TAC; + TYPIFY `~(coplanar X)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE]); + TYPIFY `X SUBSET X' UNION s` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "X'"; + BY(SET_TAC[]); + FIRST_X_ASSUM_ST `~NULLSET X` MP_TAC; + REWRITE_TAC[]; + MATCH_MP_TAC NEGLIGIBLE_SUBSET; + TYPIFY `X' UNION s` EXISTS_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (CONJUNCT2 NULLSET_RULES); + ASM_REWRITE_TAC[]; + BY(ASM_MESON_TAC[COPLANAR_IMP_NEGLIGIBLE]); + COMMENT "X'' not planar"; + INTRO_TAC COPLANAR_UNION [`X' INTER wedge u0 u1 v1 v2`;`X' INTER ((:real^3) DIFF wedge_ge u0 u1 v1 v2)`;`u0`;`u1`]; + ABBREV_TAC `X'' = (X' INTER wedge u0 u1 v1 v2 UNION X' INTER ((:real^3) DIFF wedge_ge u0 u1 v1 v2) UNION {u0, u1})`; + TYPIFY `X' SUBSET X''` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "X''"; + REWRITE_TAC[SUBSET;IN_UNION;IN_INTER;IN_DIFF;IN_UNIV]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (TAUT `(~a ==> b) ==> (a \/ b \/ c)`); + DISCH_TAC; + INTRO_TAC WEDGE_WEDGE_GE [`u0`;`u1`;`v1`;`v2`]; + ASM_REWRITE_TAC[]; + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); + EXPAND_TAC "X'"; + BY(SET_TAC[]); + TYPIFY `~(coplanar X'')` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + REPLICATE_TAC 5 (FIRST_X_ASSUM MP_TAC); + BY(MESON_TAC[COPLANAR_SUBSET]); + COMMENT "start on conjuncts"; + CONJ_TAC; + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY]; + TYPIFY `y` EXISTS_TAC; + EXPAND_TAC "X'"; + REWRITE_TAC[IN_INTER;IN_DIFF]; + TYPIFY `~(y IN s)` ENOUGH_TO_SHOW_TAC; + BY(REPEAT (FIRST_X_ASSUM_ST `INTER` MP_TAC) THEN SET_TAC[]); + EXPAND_TAC "s"; + INTRO_TAC WEDGE_INTER_AFF_GE [`u0`;`u1`;`v1`;`v2`]; + BY(REPEAT (FIRST_X_ASSUM_ST `INTER` MP_TAC) THEN SET_TAC[]); + CONJ_TAC; + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY]; + TYPIFY `x` EXISTS_TAC; + EXPAND_TAC "X'"; + TYPIFY `s SUBSET wedge_ge u0 u1 v1 v2` ENOUGH_TO_SHOW_TAC; + REPEAT (FIRST_X_ASSUM_ST `IN` MP_TAC); + BY(SET_TAC[]); + EXPAND_TAC "s"; + REWRITE_TAC[UNION_SUBSET]; + BY(ASM_SIMP_TAC[AFF_GE_SUBSET_WEDGE_GE]); + COMMENT "next conjunct A"; + TYPIFY `~(u0 = u1)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `~collinear t` kill; + FIRST_X_ASSUM_ST `~collinear t` MP_TAC; + BY(MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]); + REWRITE_TAC[TAUT `(a /\ b /\ c) = ((a /\ b) /\ c)`]; + CONJ_TAC; + REWRITE_TAC[AND_FORALL_THM]; + GEN_TAC; + EXPAND_TAC "X'"; + EXPAND_TAC "s"; + REWRITE_TAC[IN_INTER;IN_UNION;IN_DIFF]; + TYPIFY `collinear {p,u0,u1} ==> p IN aff_ge {u0,u1} {v1}` ENOUGH_TO_SHOW_TAC; + BY(MESON_TAC[]); + TYPIFY `{p,u0,u1} = {u0,u1,p}` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + ASM_SIMP_TAC[COLLINEAR_3_IN_AFFINE_HULL]; + TYPIFY `affine hull {u0,u1} SUBSET aff_ge {u0,u1} {v1}` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + MATCH_MP_TAC AFFINE_HULL_SUBSET_AFF_GE; + BY(ASM_SIMP_TAC[Fan.th3a]); + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `mcell` MP_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC[]); + FIRST_X_ASSUM MP_TAC; + REWRITE_TAC[NOT_FORALL_THM]; + REPEAT WEAK_STRIP_TAC; + GEXISTL_TAC [`p`;`q`]; + FIRST_X_ASSUM MP_TAC; + EXPAND_TAC "X'"; + FIRST_X_ASSUM_ST `X = mcell i V ul` SUBST1_TAC; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let WEDGE_SUBSET_WEDGE_GE = prove_by_refinement( + `!u0 u1 u2 u3. wedge u0 u1 u2 u3 SUBSET wedge_ge u0 u1 u2 u3`, + (* {{{ proof *) + [ + REWRITE_TAC[wedge;SUBSET;Local_lemmas.WEDGE_GE_AZIM_LE;IN_ELIM_THM]; + BY(REAL_ARITH_TAC) + ]);; + (* }}} *) + +let AFF_INTER_IMP_COPLANAR = prove_by_refinement( + `!a b c (d:real^3). ~(affine hull {a,b} INTER affine hull {c,d} ={}) ==> + coplanar {a,b,c,d}`, + (* {{{ proof *) + [ + REWRITE_TAC[EXTENSION;IN_INTER;NOT_IN_EMPTY]; + REWRITE_TAC[AFFINE_HULL_2_ALT;IN_ELIM_THM;IN_UNIV;NOT_FORALL_THM]; + REPEAT WEAK_STRIP_TAC; + REWRITE_TAC[coplanar]; + ASM_CASES_TAC `u = &0`; + GEXISTL_TAC [`b`;`c`;`d`]; + TYPIFY `{b,c,d} SUBSET affine hull {b,c,d} /\ a IN affine hull {b,c,d}` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + REWRITE_TAC[HULL_SUBSET]; + REWRITE_TAC[AFFINE_HULL_3;IN_ELIM_THM]; + GEXISTL_TAC [`&0`;`&1 - u'`;`u'`]; + CONJ_TAC; + BY(REAL_ARITH_TAC); + BY(REPEAT (FIRST_X_ASSUM_ST `%` MP_TAC) THEN ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + GEXISTL_TAC [`a`;`c`;`d`]; + TYPIFY `{a,c,d} SUBSET affine hull {a,c,d} /\ b IN affine hull {a,c,d}` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + REWRITE_TAC[HULL_SUBSET]; + REWRITE_TAC[AFFINE_HULL_3;IN_ELIM_THM]; + GEXISTL_TAC [`(u - &1)/ u`;`(&1 - u')/ u`;`u' / u`]; + CONJ_TAC; + Calc_derivative.CALC_ID_TAC; + BY(ASM_REWRITE_TAC[]); + MATCH_MP_TAC VECTOR_MUL_LCANCEL_IMP; + TYPIFY `u` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[VECTOR_ADD_LDISTRIB;VECTOR_MUL_ASSOC]; + TYPIFY `!x. u * x / u = x` (C SUBGOAL_THEN (unlist REWRITE_TAC)); + GEN_TAC; + Calc_derivative.CALC_ID_TAC; + BY(ASM_REWRITE_TAC[]); + BY(REPEAT (FIRST_X_ASSUM_ST `%` MP_TAC) THEN VECTOR_ARITH_TAC) + ]);; + (* }}} *) + +let NOT_COLLINEAR_AFF_DIM2 = prove_by_refinement( + `!(a:real^A) b c. ~collinear {a,b,c} ==> aff_dim {a,b,c} = &2`, + (* {{{ proof *) + [ + REWRITE_TAC[COLLINEAR_AFF_DIM]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC AFF_DIM_3 [`a`;`b`;`c`]; + BY(FIRST_X_ASSUM MP_TAC THEN INT_ARITH_TAC) + ]);; + (* }}} *) + +let ADD_NN_ZERO = prove_by_refinement( + `!a b x y. &0 < a /\ &0 < b /\ &0 <= x /\ &0 <= y /\ a * x + b * y = &0 ==> (x = &0 /\ y = &0)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + PROOF_BY_CONTR_TAC; + FIRST_X_ASSUM_ST `+` (MP_TAC o (MATCH_MP (arith `x + y = &0 ==> (~(&0 <= x) \/ ~(&0 <= y) \/ (x = &0 /\ y = &0))`))); + REPEAT WEAK_STRIP_TAC; + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LE_MUL; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[]; + GMATCH_SIMP_TAC REAL_LE_MUL; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); + REWRITE_TAC[REAL_ENTIRE]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let BDXKHTW = prove_by_refinement( + `!u0 u1 v1 v2 V X. saturated V /\ packing V /\ leaf V [u0;u1;v1] /\ leaf V [u0;u1;v2] /\ + X IN mcell_set V /\ + {u0,u1} IN edgeX V X /\ + ~(azim u0 u1 v1 v2 = &0) /\ (?y. y IN X INTER wedge u0 u1 v1 v2) ==> + (X SUBSET wedge_ge u0 u1 v1 v2)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + PROOF_BY_CONTR_TAC; + INTRO_TAC BDXKHTW_PREP_LEMMA [`u0`;`u1`;`v1`;`v2`;`V`;`X`]; + ANTS_TAC; + BY(ASM_MESON_TAC[SUBSET]); + REPEAT WEAK_STRIP_TAC; + INTRO_TAC CONNECTED_SEGMENT_NOT_COVERED [`wedge u0 u1 v1 v2`;`(:real^3) DIFF wedge_ge u0 u1 v1 v2`;`p`;`q`]; + ANTS_TAC; + ASM_SIMP_TAC[OPEN_WEDGE;CLOSED_WEDGE;GSYM closed]; + REWRITE_TAC[TAUT `(a /\ b /\ c) = ((a /\ b) /\ c)`]; + CONJ_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + BY(SET_TAC[WEDGE_SUBSET_WEDGE_GE]); + REWRITE_TAC[IN_DIFF;IN_UNIV]; + REPEAT WEAK_STRIP_TAC; + COMMENT "x IN X"; + TYPIFY `x IN X` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `segment [p,q] SUBSET X` ENOUGH_TO_SHOW_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + FIRST_X_ASSUM_ST `convex` MP_TAC; + REWRITE_TAC[ CONVEX_CONTAINS_SEGMENT]; + BY(REPEAT (FIRST_X_ASSUM_ST `IN` MP_TAC) THEN SET_TAC[]); + COMMENT "x IN aff_ge"; + TYPIFY `?v. leaf V [u0;u1;v] /\ ~collinear {u0,u1,v} /\ x IN aff_ge {u0,u1} {v} /\ ~(p IN aff_ge {u0,u1} {v}) /\ ~(q IN aff_ge {u0,u1} {v})` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC WEDGE_WEDGE_GE [`u0`;`u1`;`v1`;`v2`]; + ASM_REWRITE_TAC[]; + REPEAT (FIRST_X_ASSUM_ST `UNION` MP_TAC); + REWRITE_TAC[SUBSET;IN_UNION]; + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + COMMENT "non degeneracies"; + TYPIFY `~(x = p) /\ ~(x = q)` (C SUBGOAL_THEN ASSUME_TAC); + BY(REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN MESON_TAC[]); + FIRST_X_ASSUM_ST `segment` MP_TAC; + REWRITE_TAC[closed_segment;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `~(p = q)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `DIFF` MP_TAC; + FIRST_X_ASSUM_ST `INTER` MP_TAC; + BY(SET_TAC[WEDGE_SUBSET_WEDGE_GE]); + TYPIFY `&0 < u` (C SUBGOAL_THEN ASSUME_TAC); + ASM_SIMP_TAC[arith `&0 <= u ==> (&0 < u <=> ~(u= &0))`]; + DISCH_TAC; + FIRST_X_ASSUM_ST `%` MP_TAC; + BY(ASM_REWRITE_TAC[varith `(&1 - &0) % p + &0 % q = (p:real^3)`]); + TYPIFY `u < &1` (C SUBGOAL_THEN ASSUME_TAC); + ASM_SIMP_TAC[arith `u <= &1 ==> (u < &1 <=> ~(u= &1))`]; + DISCH_TAC; + FIRST_X_ASSUM_ST `%` MP_TAC; + BY(ASM_REWRITE_TAC[varith `(&1 - &1) % p + &1 % q = (q:real^3)`]); + COMMENT "x not in aff {u0,u1}"; + TYPIFY `~(x IN affine hull {u0,u1})` (C SUBGOAL_THEN ASSUME_TAC); + DISCH_TAC; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + REWRITE_TAC[]; + MATCH_MP_TAC AFF_INTER_IMP_COPLANAR; + ASM_REWRITE_TAC[EXTENSION;NOT_IN_EMPTY;IN_INTER;NOT_FORALL_THM]; + TYPIFY `x` EXISTS_TAC; + ASM_REWRITE_TAC[]; + REWRITE_TAC[AFFINE_HULL_2_ALT;IN_ELIM_THM;IN_UNIV]; + TYPIFY `u` EXISTS_TAC; + BY(VECTOR_ARITH_TAC); + COMMENT "x in aff_gt"; + TYPIFY `x IN aff_gt {u0,u1} {v}` (C SUBGOAL_THEN ASSUME_TAC); + TYPIFY `DISJOINT {u0,u1} {v}` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_SIMP_TAC[Fan.th3a]); + REPLICATE_TAC 5 (FIRST_X_ASSUM_ST `IN` MP_TAC); + ASM_SIMP_TAC[Collect_geom.IN_AFF_GE_INTERPRET_TO_AFF_GT_AND_AFF]; + BY(MESON_TAC[Sphere.aff]); + COMMENT "introduce cc"; + TYPIFY `?ul. leaf V ul /\ X = cc_cell V ul /\ stem ul = {u0,u1} /\ cc_A0 ul = aff_gt {u0,u1} {v} /\ set_of_list ul = {u0,u1,v} ` (C SUBGOAL_THEN MP_TAC); + INTRO_TAC CFFONNL [`V`;`[u0;u1;v]`;`X`]; + ASM_REWRITE_TAC[]; + REWRITE_TAC[TAUT `(a /\ b /\ ~c ==> d) <=> (a /\ b ==> (c \/ d))`]; + ANTS_TAC; + ASM_REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1`;cc_A0]; + REWRITE_TAC[EXTENSION;IN_INTER;NOT_IN_EMPTY;NOT_FORALL_THM]; + TYPIFY `x` EXISTS_TAC; + BY(ASM_REWRITE_TAC[]); + REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1`]; + DISCH_THEN DISJ_CASES_TAC; + TYPIFY `[u0;u1;v]` EXISTS_TAC; + ASM_REWRITE_TAC[cc_A0;EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1`;set_of_list3_explicit]; + GMATCH_SIMP_TAC STEM_OF_LEAF; + REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1`]; + BY(ASM_MESON_TAC[]); + TYPIFY `[u1;u0;v]` EXISTS_TAC; + ASM_REWRITE_TAC[cc_A0;EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1`;set_of_list3_explicit]; + INTRO_TAC ZASUVOR [`V`;`u0`;`u1`;`v`]; + ASM_REWRITE_TAC[]; + REPEAT WEAK_STRIP_TAC; + ASM_REWRITE_TAC[]; + CONJ2_TAC; + CONJ2_TAC; + BY(SET_TAC[]); + AP_THM_TAC THEN AP_TERM_TAC; + BY(SET_TAC[]); + GMATCH_SIMP_TAC STEM_OF_LEAF; + ASM_REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1`]; + CONJ2_TAC; + BY(SET_TAC[]); + BY(ASM_MESON_TAC[]); + REPEAT WEAK_STRIP_TAC; + COMMENT "introduce chi_msb"; + INTRO_TAC CELL_NN [`V`;`ul`;`p`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `INTER` MP_TAC; + ASM_REWRITE_TAC[]; + BY(SET_TAC[]); + DISCH_TAC; + INTRO_TAC CELL_NN [`V`;`ul`;`q`]; + ANTS_TAC; + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM_ST `DIFF` MP_TAC; + ASM_REWRITE_TAC[]; + BY(SET_TAC[]); + DISCH_TAC; + COMMENT "chi x = 0"; + INTRO_TAC AFFINE_IMP_CHI_MSB_0 [`ul`;`x`]; + ANTS_TAC; + CONJ_TAC; + BY(ASM_MESON_TAC[leaf;IN;Sphere.BARV;arith `2 + 1 = 3`]); + REPEAT (FIRST_X_ASSUM_ST `aff_gt` MP_TAC); + ASM_REWRITE_TAC[]; + TYPIFY ` {u0,u1,v} = {u0,u1} UNION {v} ` (C SUBGOAL_THEN SUBST1_TAC); + BY(SET_TAC[]); + TYPIFY `aff_gt {u0, u1} {v} SUBSET affine hull ({u0, u1} UNION {v})` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + BY(MESON_TAC[AFF_GT_SUBSET_AFFINE_HULL]); + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC CHI_MSB_ADDITIVE; + CONJ_TAC; + BY(REAL_ARITH_TAC); + DISCH_TAC; + FIRST_X_ASSUM_ST `coplanar` MP_TAC; + REWRITE_TAC[coplanar]; + GEXISTL_TAC [`u0`;`u1`;`v`]; + TYPIFY `p IN affine hull {u0,u1,v} /\ q IN affine hull {u0,u1,v} /\ {u0,u1,v} SUBSET affine hull {u0,u1,v}` ENOUGH_TO_SHOW_TAC; + BY(SET_TAC[]); + REWRITE_TAC[HULL_SUBSET]; + FIRST_X_ASSUM_ST `x = {a,b,c}` (SUBST1_TAC o SYM); + REPEAT (GMATCH_SIMP_TAC COPLANAR_INSERT); + COMMENT "fresh start"; + REPEAT (GMATCH_SIMP_TAC set_of_list3); + TYPIFY `!p. {p,EL 0 ul, EL 1 ul, EL 2 ul} = {EL 0 ul, EL 1 ul, EL 2 ul,p}` (C SUBGOAL_THEN (unlist ONCE_REWRITE_TAC)); + BY(SET_TAC[]); + REWRITE_TAC[CHI_MSB_COPLANAR]; + REPEAT (GMATCH_SIMP_TAC NOT_COLLINEAR_AFF_DIM2); + TYPIFY `LENGTH ul = 3` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[leaf;IN;Sphere.BARV;arith `2 + 1 = 3`]); + TYPIFY `set_of_list ul = {EL 0 ul, EL 1 ul, EL 2 ul}` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_SIMP_TAC[set_of_list3]); + CONJ_TAC; + BY(ASM_MESON_TAC[GBEWYFX]); + ASM_REWRITE_TAC[]; + TYPIFY ` [EL 0 ul;EL 1 ul;EL 2 ul] = ul` ((C SUBGOAL_THEN SUBST1_TAC)); + BY(ASM_SIMP_TAC[ GSYM LENGTH3]); + MATCH_MP_TAC (TAUT `a /\ b ==> b /\ a`); + MATCH_MP_TAC ADD_NN_ZERO; + GEXISTL_TAC [`(&1 - u)`;`u`]; + BY(ASM_SIMP_TAC[arith `u < &1 ==> &0 < &1 - u`]) + ]);; + (* }}} *) + +let AZIM_POS_IMP_SUM_2PI_ALT = prove_by_refinement( + `!a b c d. + &0 < azim a b c d ==> azim a b c d + azim a b d c = &2 * pi + `, + (* {{{ proof *) + [ + MESON_TAC[Local_lemmas1.AZIM_POS_IMP_SUM_2PI] + ]);; + (* }}} *) + +let WEDGE_GE_COMPLEMENT = prove_by_refinement( + `!u0 u1 v1 v2. + ~(azim u0 u1 v1 v2 = &0) ==> + (:real^3) DIFF wedge_ge u0 u1 v1 v2 = wedge u0 u1 v2 v1`, + (* {{{ proof *) + [ + REWRITE_TAC[EXTENSION;wedge;Local_lemmas.WEDGE_GE_AZIM_LE;IN_DIFF;IN_UNIV;IN_ELIM_THM]; + REWRITE_TAC[arith `~(x <= y) <=> (y < x)`]; + REPEAT WEAK_STRIP_TAC; + TYPIFY `~(collinear {u0,u1,v1}) /\ ~collinear {u0,u1,v2}` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[AZIM_DEGENERATE]); + TYPIFY `collinear {u0,u1,x}` ASM_CASES_TAC; + ASM_REWRITE_TAC[]; + ASM_SIMP_TAC[AZIM_DEGENERATE;arith `~(x < &0) <=> &0 <= x`]; + BY(REWRITE_TAC[Local_lemmas.AZIM_RANGE]); + ASM_REWRITE_TAC[]; + TYPIFY `&0 < azim u0 u1 v1 v2` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_SIMP_TAC[arith `~(x = &0) ==> (&0 < x <=> &0 <= x)`;Local_lemmas.AZIM_RANGE]); + REWRITE_TAC[TAUT `(a <=> b) <=> ((a ==> b) /\ (b ==> a))`]; + CONJ_TAC; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Fan.sum4_azim_fan [`u0`;`u1`;`v1`;`v2`;`x`]; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + INTRO_TAC AZIM_POS_IMP_SUM_2PI_ALT [`u0`;`u1`;`v1`;`v2`]; + INTRO_TAC Local_lemmas.AZIM_RANGE [`u0`;`u1`;`v1`;`x`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC); + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Fan.sum4_azim_fan [`u0`;`u1`;`v2`;`x`;`v1`]; + ASM_SIMP_TAC[arith `x < y ==> x <= y`]; + INTRO_TAC AZIM_POS_IMP_SUM_2PI_ALT [`u0`;`u1`;`v2`;`v1`]; + INTRO_TAC AZIM_POS_IMP_SUM_2PI_ALT [`u0`;`u1`;`x`;`v1`]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN REAL_ARITH_TAC) + ]);; + (* }}} *) + +let WEDGE_COMPLEMENT = prove_by_refinement( + `!u0 u1 v1 v2. ~(azim u0 u1 v1 v2 = &0) ==> + (:real^3) DIFF wedge u0 u1 v1 v2 = wedge_ge u0 u1 v2 v1`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `~(azim u0 u1 v2 v1 = &0)` (C SUBGOAL_THEN ASSUME_TAC); + BY(ASM_MESON_TAC[Local_lemmas.AZIM_EQ_0_SYM2]); + INTRO_TAC WEDGE_GE_COMPLEMENT [`u0`;`u1`;`v2`;`v1`]; + ASM_REWRITE_TAC[]; + BY(SET_TAC[]) + ]);; + (* }}} *) + +let EWYBJUA = prove_by_refinement( + `!u0 u1 v1 v2 V X. saturated V /\ packing V /\ leaf V [u0;u1;v1] /\ leaf V [u0;u1;v2] /\ + X IN mcell_set V /\ + {u0,u1} IN edgeX V X /\ + ~(azim u0 u1 v1 v2 = &0) ==> + (X SUBSET wedge_ge u0 u1 v1 v2) \/ (X SUBSET wedge_ge u0 u1 v2 v1)`, + (* {{{ proof *) + [ + REPEAT WEAK_STRIP_TAC; + TYPIFY `~(X INTER wedge u0 u1 v1 v2 = {})` ASM_CASES_TAC; + DISJ1_TAC; + MATCH_MP_TAC BDXKHTW; + TYPIFY `V` EXISTS_TAC; + ASM_REWRITE_TAC[]; + BY(FIRST_X_ASSUM MP_TAC THEN SET_TAC[]); + TYPIFY `~(X INTER wedge u0 u1 v2 v1 = {})` ASM_CASES_TAC; + DISJ2_TAC; + MATCH_MP_TAC BDXKHTW; + TYPIFY `V` EXISTS_TAC; + ASM_REWRITE_TAC[]; + CONJ_TAC; + BY(ASM_MESON_TAC[Local_lemmas.AZIM_EQ_0_SYM2]); + BY(FIRST_X_ASSUM MP_TAC THEN SET_TAC[]); + DISJ1_TAC; + TYPIFY `~collinear {u0,u1,v1}` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC GBEWYFX [`V`;`[u0;u1;v1]`]; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC set_of_list3; + ASM_REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1`]; + BY(ASM_MESON_TAC[leaf;IN;Sphere.BARV;arith `2 + 1 = 3`]); + TYPIFY `~collinear {u0,u1,v2}` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC GBEWYFX [`V`;`[u0;u1;v2]`]; + ASM_REWRITE_TAC[]; + GMATCH_SIMP_TAC set_of_list3; + ASM_REWRITE_TAC[EL;HD;TL;arith `1 = SUC 0 /\ 2 = SUC 1`]; + BY(ASM_MESON_TAC[leaf;IN;Sphere.BARV;arith `2 + 1 = 3`]); + TYPIFY `NULLSET X` ASM_CASES_TAC; + FIRST_X_ASSUM_ST `mcell_set` MP_TAC; + REWRITE_TAC[Pack_defs.mcell_set;IN_ELIM_THM]; + REPEAT WEAK_STRIP_TAC; + INTRO_TAC Bump.RIJRIED [`V`;`ul`;`i`]; + ASM_REWRITE_TAC[]; + ANTS_TAC; + BY(ASM_MESON_TAC[]); + DISCH_TAC; + BY(ASM_MESON_TAC[NOT_IN_EMPTY]); + ABBREV_TAC `(s:real^3->bool) = aff_ge {u0,u1} {v1} UNION aff_ge {u0,u1} {v2}`; + TYPIFY `NULLSET s` (C SUBGOAL_THEN ASSUME_TAC); + EXPAND_TAC "s"; + MATCH_MP_TAC (CONJUNCT2 NULLSET_RULES); + BY(ASM_SIMP_TAC[Conforming.NEGLIGIBLE_AFF_GE_2_1]); + TYPIFY `X SUBSET aff_ge {u0,u1} {v1} UNION aff_ge {u0,u1} {v2}` ASM_CASES_TAC; + BY(ASM_MESON_TAC[NEGLIGIBLE_SUBSET]); + TYPIFY `?x. x IN X DIFF s` (C SUBGOAL_THEN MP_TAC); + FIRST_X_ASSUM MP_TAC; + EXPAND_TAC "s"; + BY(SET_TAC[]); + REPEAT WEAK_STRIP_TAC; + TYPIFY `~(u0 = u1)` (C SUBGOAL_THEN ASSUME_TAC); + FIRST_X_ASSUM_ST `~collinear t` MP_TAC; + BY(MESON_TAC[Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL]); + TYPIFY `collinear {u0,u1,x}` ASM_CASES_TAC; + INTRO_TAC COLLINEAR_3_IN_AFFINE_HULL [`u0`;`u1`;`x`]; + ASM_REWRITE_TAC[]; + TYPIFY `affine hull {u0,u1} SUBSET aff_ge {u0,u1} {v1}` ENOUGH_TO_SHOW_TAC; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]); + MATCH_MP_TAC AFFINE_HULL_SUBSET_AFF_GE; + MATCH_MP_TAC Fan.th3a; + BY(ASM_REWRITE_TAC[]); + REPEAT (FIRST_X_ASSUM_ST `INTER` MP_TAC); + REWRITE_TAC[EXTENSION;IN_INTER;NOT_IN_EMPTY]; + (DISCH_THEN (C INTRO_TAC [`x`])); + FIRST_X_ASSUM_ST `DIFF` MP_TAC; + REWRITE_TAC[IN_DIFF]; + DISCH_TAC; + ASM_REWRITE_TAC[]; + DISCH_TAC; + TYPIFY `x IN wedge_ge u0 u1 v2 v1` (C SUBGOAL_THEN ASSUME_TAC); + INTRO_TAC WEDGE_COMPLEMENT [`u0`;`u1`;`v1`;`v2`]; + ASM_REWRITE_TAC[EXTENSION;IN_DIFF;IN_UNIV]; + BY(FIRST_X_ASSUM MP_TAC THEN MESON_TAC[]); + (DISCH_THEN (C INTRO_TAC [`x`])); + ASM_REWRITE_TAC[]; + DISCH_TAC; + INTRO_TAC WEDGE_WEDGE_GE [`u0`;`u1`;`v2`;`v1`]; + ASM_REWRITE_TAC[]; + BY(REPEAT (FIRST_X_ASSUM MP_TAC) THEN SET_TAC[]) + ]);; + (* }}} *) + +end;; diff --git a/text_formalization/packing/marchal_cells.hl b/text_formalization/packing/marchal_cells.hl new file mode 100755 index 0000000..8828999 --- /dev/null +++ b/text_formalization/packing/marchal_cells.hl @@ -0,0 +1,676 @@ + +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: Marchal cells *) +(* Chaper : Packing (Clusters) *) +(* Date : October 3, 2010 *) +(* *) +(* ========================================================================= *) + +(* ========================================================================== *) +(* This file contains some lemmas that support for marchalcells part. *) +(* ========================================================================== *) + + + +(* dmtcp *) + +flyspeck_needs "nonlinear/vukhacky_tactics.hl";; +flyspeck_needs "packing/pack_defs.hl";; +flyspeck_needs "packing/pack_concl.hl";; +flyspeck_needs "packing/pack1.hl";; +flyspeck_needs "packing/Rogers.hl";; + + +module Marchal_cells = struct + + open Sphere;; +open Pack_defs;; +open Pack_concl;; +open Vukhacky_tactics;; +open Pack1;; +open Rogers;; + +(* ========================================================================== *) + +let TRUNCATE_SIMPLEX_GENERAL_0 = prove_by_refinement ( + `!(xl:(real^3)list). ~(xl = []) ==> truncate_simplex 0 xl = [HD xl]`, +[ (REPEAT STRIP_TAC); + (REWRITE_TAC[TRUNCATE_SIMPLEX;INITIAL_SUBLIST]); + (MATCH_MP_TAC SELECT_UNIQUE); + (GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN EQ_TAC); + STRIP_TAC; + + (NEW_GOAL `?x xl. (y:(real^3)list) = CONS x xl /\ LENGTH xl = 0`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (NEW_GOAL `(xl':(real^3)list) = []`); + (ASM_MESON_TAC[LENGTH_EQ_NIL]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (MESON[] `x = y ==> [x] = [y]`)); + (ASM_REWRITE_TAC[APPEND;HD]); + STRIP_TAC; + + (ASM_REWRITE_TAC[LENGTH;HD;ARITH_RULE `SUC 0 = 0 + 1`]); + + (NEW_GOAL `?h:real^3 t. xl = CONS h t`); + (ASM_MESON_TAC[list_CASES]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `t:(real^3)list`); + (ASM_REWRITE_TAC[HD;APPEND])]);; + + + +let TRUNCATE_SIMPLEX_EXPLICIT_0 = prove_by_refinement ( + `!u0 u1 u2 u3:real^3. truncate_simplex 0 [u0] = [u0] /\ + truncate_simplex 0 [u0;u1] = [u0] /\ + truncate_simplex 0 [u0;u1;u2] = [u0] /\ + truncate_simplex 0 [u0;u1;u2;u3] = [u0]`, +[ (REPEAT STRIP_TAC); + (NEW_GOAL `~([u0:real^3] = [])`); + (MESON_TAC[NOT_CONS_NIL]); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_GENERAL_0;HD]); + (NEW_GOAL `~([u0:real^3;u1] = [])`); + (MESON_TAC[NOT_CONS_NIL]); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_GENERAL_0;HD]); + (NEW_GOAL `~([u0:real^3;u1;u2] = [])`); + (MESON_TAC[NOT_CONS_NIL]); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_GENERAL_0;HD]); + (NEW_GOAL `~([u0:real^3;u1;u2;u3] = [])`); + (MESON_TAC[NOT_CONS_NIL]); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_GENERAL_0;HD])]);; + + +(* -------------------------------------------------------------------------- *) + + +let TRUNCATE_SIMPLEX_GENERAL_1 = prove_by_refinement ( + `!ul vl a b:real^3. + (ul = APPEND [a;b] vl) ==> truncate_simplex 1 ul = [a;b]`, +[ (REPEAT STRIP_TAC); + (REWRITE_TAC[TRUNCATE_SIMPLEX;INITIAL_SUBLIST]); + (MATCH_MP_TAC SELECT_UNIQUE); + (GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN EQ_TAC); + STRIP_TAC; + + (NEW_GOAL `?x xl. (y:(real^3)list) = CONS x xl /\ LENGTH xl = 1`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `?z zl. (xl:(real^3)list) = CONS z zl /\ LENGTH zl = 0`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `(zl:(real^3)list) = []`); + (ASM_MESON_TAC[LENGTH_EQ_NIL]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (MESON[] `x = y /\ z = t ==> [x;z] = [y;t]`)); + (UNDISCH_TAC `ul:(real^3)list = APPEND y yl`); + (ASM_REWRITE_TAC[APPEND]); + (MESON_TAC[CONS_11]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[LENGTH;ARITH_RULE `SUC (SUC 0) = 1 + 1`]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[])]);; + + +(* -------------------------------------------------------------------------- *) + +let TRUNCATE_SIMPLEX_EXPLICIT_1 = prove_by_refinement ( + `!a b c (d:real^3). truncate_simplex 1 [a;b] = [a;b] /\ + truncate_simplex 1 [a;b;c] = [a;b] /\ + truncate_simplex 1 [a;b;c;d] = [a;b]`, +[ (REPEAT STRIP_TAC); + (NEW_GOAL `[a;b] = APPEND [a:real^3; b] []`); + (MESON_TAC[APPEND_NIL]); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_GENERAL_1]); + (NEW_GOAL `[a;b;c] = APPEND [a:real^3; b] [c]`); + (REWRITE_TAC[APPEND]); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_GENERAL_1]); + (NEW_GOAL `[a;b;c;d] = APPEND [a:real^3; b] [c;d]`); + (REWRITE_TAC[APPEND]); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_GENERAL_1])]);; + + +(* -------------------------------------------------------------------------- *) + +let TRUNCATE_SIMPLEX_GENERAL_2 = prove_by_refinement ( + `!a b c:real^3 ul vl. + ul = APPEND [a;b;c] vl ==> truncate_simplex 2 ul = [a;b;c]`, +[ (REPEAT STRIP_TAC); + (REWRITE_TAC[TRUNCATE_SIMPLEX;INITIAL_SUBLIST]); + (MATCH_MP_TAC SELECT_UNIQUE); + (GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN EQ_TAC); + STRIP_TAC; + + (NEW_GOAL `?x xl. (y:(real^3)list) = CONS x xl /\ LENGTH xl = 2`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `?z zl. (xl:(real^3)list) = CONS z zl /\ LENGTH zl = 1`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `?t tl. (zl:(real^3)list) = CONS t tl /\ LENGTH tl = 0`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `(tl:(real^3)list) = []`); + (ASM_MESON_TAC[LENGTH_EQ_NIL]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (MESON[] `x = y /\ z = t /\ s = r ==> [x;z;s] = [y;t;r]`)); + (UNDISCH_TAC `ul:(real^3)list = APPEND y yl`); + (ASM_REWRITE_TAC[APPEND;CONS_11]); + (MESON_TAC[]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[LENGTH;ARITH_RULE + `SUC (1 + 1) = 2 + 1 /\ SUC (SUC (SUC 0)) = 2 + 1`]); + (EXISTS_TAC `vl:(real^3)list`); + (ASM_REWRITE_TAC[])]);; + + +(* -------------------------------------------------------------------------- *) + +let TRUNCATE_SIMPLEX_EXPLICIT_2 = prove_by_refinement ( + `!a b c d:real^3. + truncate_simplex 2 [a; b; c] = [a; b; c] /\ + truncate_simplex 2 [a; b; c; d] = [a; b; c]`, +[ (REPEAT STRIP_TAC); + (NEW_GOAL `[a;b;c] = APPEND [a:real^3; b; c] []`); + (MESON_TAC[APPEND_NIL]); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_GENERAL_2]); + (NEW_GOAL `[a;b;c;d] = APPEND [a:real^3; b; c] [d]`); + (REWRITE_TAC[APPEND]); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_GENERAL_2])]);; + + +(* -------------------------------------------------------------------------- *) + +let TRUNCATE_SIMPLEX_EXPLICIT_3 = prove_by_refinement ( + `!a b c d:real^3. + truncate_simplex 3 [a; b; c; d] = [a; b; c; d]`, +[ (REPEAT STRIP_TAC); + (REWRITE_TAC[TRUNCATE_SIMPLEX;INITIAL_SUBLIST]); + (MATCH_MP_TAC SELECT_UNIQUE); + (GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN EQ_TAC); + STRIP_TAC; + + (NEW_GOAL `?x xl. (y:(real^3)list) = CONS x xl /\ LENGTH xl = 3`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `?z zl. (xl:(real^3)list) = CONS z zl /\ LENGTH zl = 2`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `?t tl. (zl:(real^3)list) = CONS t tl /\ LENGTH tl = 1`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `?w wl. (tl:(real^3)list) = CONS w wl /\ LENGTH wl = 0`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `(wl:(real^3)list) = []`); + (ASM_MESON_TAC[LENGTH_EQ_NIL]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `LENGTH [a;b;c;d:real^3] = + LENGTH (y:(real^3)list) + LENGTH (yl:(real^3)list)`); + (ASM_MESON_TAC[LENGTH_APPEND]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[LENGTH] THEN DISCH_TAC); + (NEW_GOAL `(yl:(real^3)list) = ([]:(real^3)list)`); + (REWRITE_TAC[GSYM LENGTH_EQ_NIL]); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[APPEND]); + + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[LENGTH;ARITH_RULE + `SUC (2 + 1) = 3 + 1 /\ SUC (SUC (SUC 0)) = 2 + 1`]); + + (EXISTS_TAC `[]:(real^3)list`); + (ASM_REWRITE_TAC[APPEND])]);; + + +(* -------------------------------------------------------------------------- *) + +let OMEGA_LIST_TRUNCATE_0 = prove_by_refinement ( + `!V u0:real^3 u1 u2 u3. + omega_list_n V [u0;u1;u2;u3] 0 = omega_list V [u0] `, +[ (REPEAT GEN_TAC); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH [u0:real^3] - 1 = 0`); + (REWRITE_TAC[LENGTH; ARITH_RULE `SUC 0 - 1 = 0`]); + (REWRITE_TAC[OMEGA_LIST_N]); + (MESON_TAC[HD])]);; + + +(* -------------------------------------------------------------------------- *) + +let OMEGA_LIST_TRUNCATE_1 = prove_by_refinement ( + `!V u0:real^3 u1 u2 u3. + omega_list_n V [u0;u1;u2;u3] 1 = omega_list V [u0;u1] `, +[ (REPEAT GEN_TAC); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH [u0:real^3;u1] - 1 = 1`); + (REWRITE_TAC[LENGTH; ARITH_RULE `SUC (SUC 0) - 1 = 1`]); + (REWRITE_TAC[ARITH_RULE `1 = SUC 0`; OMEGA_LIST_N]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`;TRUNCATE_SIMPLEX_EXPLICIT_1;HD])]);; + + + +let OMEGA_LIST_TRUNCATE_2 = prove_by_refinement ( + `!V u0:real^3 u1 u2 u3. + omega_list_n V [u0;u1;u2;u3] 2 = omega_list V [u0;u1;u2] `, +[ (REPEAT GEN_TAC); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH [u0:real^3;u1;u2] - 1 = 2`); + (REWRITE_TAC[LENGTH; ARITH_RULE `SUC (SUC (SUC 0)) - 1 = 2`]); + (REWRITE_TAC[ARITH_RULE `2 = SUC 1`; OMEGA_LIST_N]); + (REWRITE_TAC[ARITH_RULE `SUC 1 = 2`;TRUNCATE_SIMPLEX_EXPLICIT_2;HD]); + (REPEAT AP_TERM_TAC); + (REWRITE_TAC[ARITH_RULE `1 = SUC 0`; OMEGA_LIST_N;HD]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`;TRUNCATE_SIMPLEX_EXPLICIT_1;HD])]);; + + +(* -------------------------------------------------------------------------- *) + +(* -------------------------------------------------------------------------- *) +let OMEGA_LIST_0_EXPLICIT = prove_by_refinement ( + `!a:real^3 b c V ul. + saturated V /\ + packing V /\ + ul IN barV V 3 /\ + hl ul < sqrt (&2) /\ + ul = [a; b; c; d] + ==> omega_list_n V ul 0 = a`, +[ (REPEAT STRIP_TAC); + (REWRITE_TAC[OMEGA_LIST_N]); + (ASM_MESON_TAC[HD])]);; + + +(* -------------------------------------------------------------------------- *) + +let OMEGA_LIST_1_EXPLICIT = prove_by_refinement ( + `!a:real^3 b c d V ul. + saturated V /\ + packing V /\ + ul IN barV V 3 /\ + hl ul < sqrt (&2) /\ + ul = [a; b; c; d] + ==> omega_list_n V ul 1 = circumcenter {a, b}`, +[ (REPEAT STRIP_TAC); + (REWRITE_WITH `{a,b} = set_of_list [a;(b:real^3)]`); + (MESON_TAC[set_of_list]); + (REWRITE_WITH `circumcenter (set_of_list [a; b:real^3]) = omega_list V [a:real^3; b]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC XNHPWAB1); + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + (MP_TAC (ASSUME `ul IN barV V 3`) THEN REWRITE_TAC[IN;BARV]); + + (REPEAT STRIP_TAC); + (REWRITE_TAC[LENGTH;ARITH_RULE `SUC (SUC 0) = 1 + 1`]); + (NEW_GOAL `initial_sublist vl (ul:(real^3)list)`); + (UNDISCH_TAC `initial_sublist vl [a:real^3; b]`); + (REWRITE_TAC[INITIAL_SUBLIST] THEN STRIP_TAC); + (EXISTS_TAC `APPEND yl [c;d:real^3]`); + (REWRITE_TAC[APPEND_ASSOC; GSYM (ASSUME `[a:real^3; b] = APPEND vl yl`)]); + (ASM_REWRITE_TAC[APPEND]); + (ASM_MESON_TAC[]); + (MATCH_MP_TAC (REAL_ARITH `hl (ul:(real^3)list) < b /\ a < hl ul ==> a < b`)); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `[a;b:real^3] = truncate_simplex 1 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_WITH `[a;b;c;d:real^3] = truncate_simplex 3 ul`); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3]); + (NEW_GOAL `!i j. i < j /\ j <= 3 + ==> hl (truncate_simplex i (ul:(real^3)list)) + < hl (truncate_simplex j ul)`); + (MATCH_MP_TAC XNHPWAB4); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + (ASM_REWRITE_TAC[OMEGA_LIST_TRUNCATE_1])]);; + +(* -------------------------------------------------------------------------- *) + +let OMEGA_LIST_2_EXPLICIT = prove_by_refinement ( + `!a:real^3 b c d V ul. + saturated V /\ + packing V /\ + ul IN barV V 3 /\ + hl ul < sqrt (&2) /\ + ul = [a; b; c; d] + ==> omega_list_n V ul 2 = circumcenter {a, b , c}`, +[ (REPEAT STRIP_TAC); + (REWRITE_WITH `{a,b, c} = set_of_list [a;(b:real^3);c]`); + (MESON_TAC[set_of_list]); + (REWRITE_WITH `circumcenter (set_of_list [a; b:real^3;c]) = omega_list V [a;b;c]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC XNHPWAB1); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (MP_TAC (ASSUME `ul IN barV V 3`) THEN REWRITE_TAC[IN;BARV]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[LENGTH;ARITH_RULE `SUC (SUC (SUC 0)) = 2 + 1`]); + (NEW_GOAL `initial_sublist vl (ul:(real^3)list)`); + (UNDISCH_TAC `initial_sublist vl [a:real^3; b;c]`); + (REWRITE_TAC[INITIAL_SUBLIST] THEN STRIP_TAC); + (EXISTS_TAC `APPEND yl [d:real^3]`); + (REWRITE_TAC[APPEND_ASSOC; GSYM (ASSUME `[a:real^3; b; c] = APPEND vl yl`)]); + (ASM_REWRITE_TAC[APPEND]); + (ASM_MESON_TAC[]); + (MATCH_MP_TAC (REAL_ARITH `hl (ul:(real^3)list) < b /\ a < hl ul ==> a < b`)); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `[a;b:real^3;c] = truncate_simplex 2 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_WITH `[a;b;c;d:real^3] = truncate_simplex 3 ul`); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3]); + + (NEW_GOAL `!i j. i < j /\ j <= 3 + ==> hl (truncate_simplex i (ul:(real^3)list)) + < hl (truncate_simplex j ul)`); + (MATCH_MP_TAC XNHPWAB4); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + (ASM_REWRITE_TAC[OMEGA_LIST_TRUNCATE_2])]);; + + +(* -------------------------------------------------------------------------- *) + + +let OMEGA_LIST_3_EXPLICIT = prove_by_refinement ( + `!a:real^3 b c d V ul. + saturated V /\ + packing V /\ + ul IN barV V 3 /\ + hl ul < sqrt (&2) /\ + ul = [a; b; c; d] + ==> omega_list_n V ul 3 = circumcenter {a, b , c, d}`, +[ (REPEAT STRIP_TAC); + (REWRITE_WITH `{a,b, c,d} = set_of_list [a;(b:real^3);c;d]`); + (MESON_TAC[set_of_list]); + (REWRITE_WITH `circumcenter (set_of_list [a; b:real^3;c;d]) = omega_list V [a;b;c;d]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC XNHPWAB1); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[ARITH_RULE `3 <= 3`]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH [a:real^3; b; c; d] - 1 = 3`); + (REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (ASM_REWRITE_TAC[])]);; + + +(* ------------------------------------------------------------------------- *) + +let BARV_3_EXPLICIT = prove_by_refinement ( + `!V vl. barV V 3 vl ==> ? u0 u1 u2 u3. vl = [u0;u1;u2;u3]`, +[(REPEAT GEN_TAC); + (REWRITE_TAC[BARV]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?x0 xl. (vl:(real^3)list) = CONS x0 xl /\ LENGTH xl = 3`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `x0:real^3`); + + (NEW_GOAL `?x1 yl. (xl:(real^3)list) = CONS x1 yl /\ LENGTH yl = 2`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `x1:real^3`); + + (NEW_GOAL `?x2 zl. (yl:(real^3)list) = CONS x2 zl /\ LENGTH zl = 1`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `x2:real^3`); + + (NEW_GOAL `?x3 tl. (zl:(real^3)list) = CONS x3 tl /\ LENGTH tl = 0`); + (REWRITE_TAC[GSYM LENGTH_EQ_CONS]); + (ASM_ARITH_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `x3:real^3`); + + (NEW_GOAL `(tl:(real^3)list) = []`); + (ASM_MESON_TAC[LENGTH_EQ_NIL]); + (ASM_REWRITE_TAC[])]);; + + +(* ------------------------------------------------------------------------- *) + +let BARV_K_EXPLICIT = prove_by_refinement ( + `!V a b c d. + barV V 3 [a; b; c; d] + ==> barV V 2 [a; b; c] /\ barV V 1 [a; b] /\ barV V 0 [a]`, +[ (REPEAT GEN_TAC); + (REWRITE_TAC[BARV]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[LENGTH;ARITH_RULE `SUC (SUC (SUC 0)) = 2 + 1`]); + (MATCH_MP_TAC (ASSUME + `!vl. initial_sublist vl [a:real^3; b; c; d] /\ 0 < LENGTH vl + ==> voronoi_nondg V vl`)); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `initial_sublist vl [a; b; c:real^3]` THEN + REWRITE_TAC[INITIAL_SUBLIST]); + (STRIP_TAC); + (EXISTS_TAC `APPEND yl [d:real^3]`); + (REWRITE_TAC[APPEND_ASSOC; GSYM (ASSUME `[a; b; c:real^3] = APPEND vl yl`)]); + (REWRITE_TAC[APPEND]); + (REWRITE_TAC[LENGTH]); + (ARITH_TAC); + + (MATCH_MP_TAC (ASSUME + `!vl. initial_sublist vl [a:real^3; b; c; d] /\ 0 < LENGTH vl + ==> voronoi_nondg V vl`)); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `initial_sublist vl [a; b:real^3]` THEN + REWRITE_TAC[INITIAL_SUBLIST]); + (STRIP_TAC); + (EXISTS_TAC `APPEND yl [c;d:real^3]`); + (REWRITE_TAC[APPEND_ASSOC; GSYM (ASSUME `[a; b:real^3] = APPEND vl yl`)]); + (REWRITE_TAC[APPEND]); + (REWRITE_TAC[LENGTH]); + (ARITH_TAC); + + (MATCH_MP_TAC (ASSUME + `!vl. initial_sublist vl [a:real^3; b; c; d] /\ 0 < LENGTH vl + ==> voronoi_nondg V vl`)); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `initial_sublist vl [a:real^3]` THEN + REWRITE_TAC[INITIAL_SUBLIST]); + (STRIP_TAC); + (EXISTS_TAC `APPEND yl [b;c;d:real^3]`); + (REWRITE_TAC[APPEND_ASSOC; GSYM (ASSUME `[a:real^3] = APPEND vl yl`)]); + (REWRITE_TAC[APPEND])]);; + + +(* ------------------------------------------------------------------------- *) + +let AFF_DIM_LE_LENGTH = prove_by_refinement ( + `!xl n. LENGTH xl = n ==> aff_dim (set_of_list (xl:(real^3)list)) < &n`, +[ (REPEAT GEN_TAC THEN DISCH_TAC); + (ABBREV_TAC `s = set_of_list (xl:(real^3)list)`); + (NEW_GOAL `?b. ~affine_dependent b /\ b SUBSET (s:real^3->bool) /\ + affine hull b = affine hull s`); + (MESON_TAC[AFFINE_BASIS_EXISTS]); + (FIRST_X_ASSUM CHOOSE_TAC); + (NEW_GOAL `aff_dim (s:real^3->bool) = aff_dim (b:real^3->bool)`); + (REWRITE_WITH `aff_dim (s:real^3->bool) = aff_dim (affine hull s) /\ + aff_dim (b:real^3->bool) = aff_dim (affine hull b)`); + (MESON_TAC[AFF_DIM_AFFINE_HULL]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `aff_dim (b:real^3->bool) = &(CARD b) - &1`); + (ASM_SIMP_TAC[AFF_DIM_AFFINE_INDEPENDENT]); + (NEW_GOAL `int_of_num (CARD (b:real^3->bool)) + <= int_of_num (CARD (s:real^3->bool))`); + (MATCH_MP_TAC (ARITH_RULE `a <= b ==> int_of_num a <= int_of_num b`)); + (MATCH_MP_TAC CARD_SUBSET); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "s"); + (REWRITE_TAC[FINITE_SET_OF_LIST]); + + (NEW_GOAL `int_of_num (CARD (s:real^3->bool)) + <= int_of_num (LENGTH (xl:(real^3)list))`); + (MATCH_MP_TAC (ARITH_RULE `a <= b ==> int_of_num a <= int_of_num b`)); + (EXPAND_TAC "s"); + (REWRITE_TAC[CARD_SET_OF_LIST_LE]); + (ASM_ARITH_TAC) ]);; + + +(* ------------------------------------------------------------------------ *) + +let CONVEX_HULL_SUBSET = prove_by_refinement ( + `!S (S':real^N->bool). + S SUBSET S' ==> (convex hull S) SUBSET (convex hull S')` , +[(REWRITE_TAC[SUBSET;convex;hull;IN;IN_ELIM_THM;INTERS]); + (REPEAT STRIP_TAC); + (NEW_GOAL `!x. S (x:real^N) ==> u x`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN DEL_TAC); + (DISCH_THEN (LABEL_TAC "asm1")); + (USE_THEN "asm1" (MP_TAC o SPEC `u:real^N->bool`) THEN DEL_TAC); + (DISCH_TAC THEN DISCH_TAC THEN SWITCH_TAC THEN DISCH_TAC THEN SWITCH_TAC); + (FIRST_X_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[])]);; + + +(* ------------------------------------------------------------------------- *) + +let BALL_CONVEX_HULL_LEMMA = prove_by_refinement ( + `!S s r x:real^N. + (!x. S x ==> dist (s,x) < r) + ==> (convex hull S) x + ==> dist (s,x) < r`, +[ (REPEAT STRIP_TAC); + (NEW_GOAL `S SUBSET ball (s:real^N, r)`); + (ASM_REWRITE_TAC[ball;SUBSET;IN;IN_ELIM_THM]); + (NEW_GOAL `(convex hull S) SUBSET ball (s:real^N, r)`); + (NEW_GOAL `convex hull ball(s:real^N,r) = ball (s,r)`); + (REWRITE_TAC[CONVEX_HULL_EQ;CONVEX_BALL]); + (ASM_MESON_TAC[CONVEX_HULL_SUBSET]); + (REWRITE_WITH `!a x r. dist (a,x:real^N) < r <=> x IN ball(a,r)`); + (REWRITE_TAC[IN;IN_ELIM_THM;ball] ); + (ASM_SET_TAC[])]);; + + +(* ------------------------------------------------------------------------- *) + +let CONVEX_RCONE_GT = prove_by_refinement ( + `!a:real^N b r. &0 <= r ==> convex (rcone_gt a b r)`, +[ (REPEAT STRIP_TAC); + (REWRITE_TAC[rcone_gt;convex;rconesgn;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `(u % x + v % y) - a = u % (x - a) + v % (y - a:real^N)`); + (ASM_REWRITE_TAC[VECTOR_SUB_LDISTRIB; VECTOR_MUL_LID; + VECTOR_ARITH `a - x % b + c - y % b = (a + c) - (x + y) % b`]); + (REWRITE_TAC[DOT_LADD;DOT_LMUL]); + (ASM_CASES_TAC `&0 < u`); + + (* 2 Subgoals *) + + (NEW_GOAL + `u * ((x:real^N - a) dot (b - a)) + v * ((y - a) dot (b - a)) > + u * dist (x,a) * dist (b,a) * r + v * dist (y,a) * dist (b,a) * r`); + (* Subgoal 1.1 *) + + (NEW_GOAL + `u * ((x:real^N - a) dot (b - a)) > u * dist (x,a) * dist (b,a) * r`); + (MATCH_MP_TAC (REAL_ARITH `&0 < a - b ==> a > b`)); + (REWRITE_TAC[REAL_ARITH `a * b * c * d = a * (b * c * d)`; + REAL_ARITH `a * b - a * c = a * (b - c)`]); + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL + `v * ((y:real^N - a) dot (b - a)) >= v * dist (y,a) * dist (b,a) * r`); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a - b ==> a >= b`)); + (REWRITE_TAC[REAL_ARITH `a * b * c * d = a * (b * c * d)`; + REAL_ARITH `a * b - a * c = a * (b - c)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL +`dist (u % x + v % y,a) * dist (b,a:real^N) * r <= + u * dist (x,a) * dist (b,a) * r + v * dist (y,a) * dist (b,a) * r`); + (* Subgoal 1.2 *) + + (MATCH_MP_TAC (REAL_ARITH `&0 <= a - b ==> b <= a`)); + (REWRITE_TAC[REAL_ARITH `(a * b * x + c * d * x) - e * x = + (a * b + c * d - e) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + STRIP_TAC; + (REWRITE_TAC[dist]); + (REWRITE_WITH `(u % x + v % y) - a = u % (x - a) + v % (y - a:real^N)`); + (ASM_REWRITE_TAC[VECTOR_SUB_LDISTRIB; VECTOR_MUL_LID; + VECTOR_ARITH `a - x % b + c - y % b = (a + c) - (x + y) % b`]); + (REWRITE_TAC[REAL_ARITH `&0 <= a + b - c <=> c <= a + b`]); + (MATCH_MP_TAC (REAL_ARITH + `m <= norm (u % (x - a:real^N)) + norm (v % (y - a)) /\ + norm (u % (x - a)) = b /\ + norm (v % (y - a)) = c ==> m <= b + c`)); + (REWRITE_TAC[NORM_TRIANGLE;NORM_MUL]); + (REWRITE_WITH `abs u = u /\ abs v = v`); + (ASM_SIMP_TAC[REAL_ABS_REFL]); + + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + +(* Subgoal 2 *) + + (NEW_GOAL `u = &0`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `v = &1`); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_MUL_LZERO;REAL_ADD_LID;REAL_MUL_LID]); + (ASM_REWRITE_TAC[VECTOR_MUL_LZERO;VECTOR_ADD_LID;VECTOR_MUL_LID])]);; + + + +(* ------------------------------------------------------------------------- *) + +let RCONE_GT_CONVEX_HULL_LEMMA = prove_by_refinement ( + `!a:real^N b r s. + (s SUBSET rcone_gt a b r) /\ &0 <= r ==> + (convex hull s SUBSET rcone_gt a b r)`, +[ (REPEAT STRIP_TAC); + (ASM_MESON_TAC[CONVEX_HULL_SUBSET;CONVEX_RCONE_GT; CONVEX_HULL_EQ])]);; + + + +end;; diff --git a/text_formalization/packing/marchal_cells_2_new.hl b/text_formalization/packing/marchal_cells_2_new.hl new file mode 100755 index 0000000..3d22307 --- /dev/null +++ b/text_formalization/packing/marchal_cells_2_new.hl @@ -0,0 +1,7048 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: *) +(* Chaper : Packing (Marchal Cells 2) *) +(* Date : October 3, 2010 *) +(* *) +(* ========================================================================= *) + +module Marchal_cells_2_new = struct +(* +#use "/usr/programs/hollight/hollight-svn75/hol.ml";; +loads "Multivariate/flyspeck.ml";; +#use "/home/vu/flyspeck/working/boot.hl";; +flyspeck_needs "trigonometry/trig1.hl";; +flyspeck_needs "trigonometry/trig2.hl";; +flyspeck_needs "leg/muR_def.hl";; +flyspeck_needs "leg/enclosed_def.hl";; +flyspeck_needs "trigonometry/euler_main_theorem.hl";; +flyspeck_needs "trigonometry/trigonometry.hl";; + +(* ================= Loaded files ======================================== *) + +flyspeck_needs "leg/collect_geom.hl";; +flyspeck_needs "fan/fan_defs.hl";; +flyspeck_needs "fan/introduction.hl";; +flyspeck_needs "fan/topology.hl";; +flyspeck_needs "fan/fan_misc.hl";; +flyspeck_needs "fan/HypermapAndFan.hl";; +flyspeck_needs "packing/pack_defs.hl";; +flyspeck_needs "packing/pack_concl.hl";; +flyspeck_needs "packing/pack1.hl";; +flyspeck_needs "packing/pack2.hl";; +flyspeck_needs "packing/pack3.hl";; +flyspeck_needs "packing/Rogers.hl";; +flyspeck_needs "nonlinear/vukhacky_tactics.hl";; + +flyspeck_needs "packing/marchal_cells.hl";; +flyspeck_needs "packing/EMNWUUS.hl";; + +*) + +(* ====================== Open appropriate files ======================= *) + +open Rogers;; +open Prove_by_refinement;; +open Vukhacky_tactics;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Sphere;; +open Marchal_cells;; +open Emnwuus;; + +(* +let seans_fn () = +let (tms,tm) = top_goal () in +let vss = map frees (tm::tms) in +let vs = setify (flat vss) in +map dest_var vs;; +*) + +(* ======================================================================= *) +(* Lemma 1 *) +let AFF_GE_2_2 = prove + (`!x v w. + DISJOINT {x,v} {w,z} + ==> aff_ge {x,v} {w, z} = + {y | ?t1 t2 t3 t4. + &0 <= t3 /\ &0 <= t4 /\ + t1 + t2 + t3 + t4 = &1 /\ + y = t1 % x + t2 % v + t3 % w + t4 % z}`, + AFF_TAC);; +(* ======================================================================= *) +(* Lemma 2 *) +let MEASURABLE_ROGERS = prove_by_refinement ( + `!V (ul:(real^3)list) k. + saturated V /\ packing V /\ barV V 3 ul ==> measurable (rogers V ul)`, +[ (REPEAT STRIP_TAC); + (REWRITE_TAC[ROGERS]); + (MATCH_MP_TAC MEASURABLE_CONVEX_HULL); + (MATCH_MP_TAC FINITE_IMP_BOUNDED); + (MATCH_MP_TAC FINITE_IMAGE); + (SUBGOAL_THEN `? u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]` CHOOSE_TAC); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (NEW_GOAL `LENGTH (ul:(real^3)list) = 4`); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[FINITE_NUMSEG_LT])]);; + +(* ======================================================================= *) +(* Lemma 3 *) +let CONVEX_RCONE_GE = prove_by_refinement ( + `!a:real^N b r. &0 <= r ==> convex (rcone_ge a b r)`, +[ (REPEAT STRIP_TAC); + (REWRITE_TAC[rcone_ge;convex;rconesgn;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `(u % x + v % y) - a = u % (x - a) + v % (y - a:real^N)`); + (ASM_REWRITE_TAC[VECTOR_SUB_LDISTRIB; VECTOR_MUL_LID; + VECTOR_ARITH `a - x % b + c - y % b = (a + c) - (x + y) % b`]); + (REWRITE_TAC[DOT_LADD;DOT_LMUL]); + (ASM_CASES_TAC `&0 < u`); + + (* 2 Subgoals *) + + (NEW_GOAL + `u * ((x:real^N - a) dot (b - a)) + v * ((y - a) dot (b - a)) >= + u * dist (x,a) * dist (b,a) * r + v * dist (y,a) * dist (b,a) * r`); + (* Subgoal 1.1 *) + + (NEW_GOAL + `u * ((x:real^N - a) dot (b - a)) >= u * dist (x,a) * dist (b,a) * r`); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a - b ==> a >= b`)); + (REWRITE_TAC[REAL_ARITH `a * b * c * d = a * (b * c * d)`; + REAL_ARITH `a * b - a * c = a * (b - c)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL + `v * ((y:real^N - a) dot (b - a)) >= v * dist (y,a) * dist (b,a) * r`); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a - b ==> a >= b`)); + (REWRITE_TAC[REAL_ARITH `a * b * c * d = a * (b * c * d)`; + REAL_ARITH `a * b - a * c = a * (b - c)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL +`dist (u % x + v % y,a) * dist (b,a:real^N) * r <= + u * dist (x,a) * dist (b,a) * r + v * dist (y,a) * dist (b,a) * r`); + (* Subgoal 1.2 *) + + (MATCH_MP_TAC (REAL_ARITH `&0 <= a - b ==> b <= a`)); + (REWRITE_TAC[REAL_ARITH `(a * b * x + c * d * x) - e * x = + (a * b + c * d - e) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + STRIP_TAC; + (REWRITE_TAC[dist]); + (REWRITE_WITH `(u % x + v % y) - a = u % (x - a) + v % (y - a:real^N)`); + (ASM_REWRITE_TAC[VECTOR_SUB_LDISTRIB; VECTOR_MUL_LID; + VECTOR_ARITH `a - x % b + c - y % b = (a + c) - (x + y) % b`]); + (REWRITE_TAC[REAL_ARITH `&0 <= a + b - c <=> c <= a + b`]); + (MATCH_MP_TAC (REAL_ARITH + `m <= norm (u % (x - a:real^N)) + norm (v % (y - a)) /\ + norm (u % (x - a)) = b /\ + norm (v % (y - a)) = c ==> m <= b + c`)); + (REWRITE_TAC[NORM_TRIANGLE;NORM_MUL]); + (REWRITE_WITH `abs u = u /\ abs v = v`); + (ASM_SIMP_TAC[REAL_ABS_REFL]); + + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + +(* Subgoal 2 *) + + (NEW_GOAL `u = &0`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `v = &1`); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_MUL_LZERO;REAL_ADD_LID;REAL_MUL_LID]); + (ASM_REWRITE_TAC[VECTOR_MUL_LZERO;VECTOR_ADD_LID;VECTOR_MUL_LID])]);; + +(* ======================================================================= *) +(* Lemma 4 *) +let FINITE_PERMUTE_3 = prove_by_refinement + (`FINITE {p | p permutes {0, 1, 2}}`, + [MATCH_MP_TAC FINITE_PERMUTATIONS THEN MESON_TAC[FINITE_RULES]]);; +let FINITE_PERMUTE_4 = prove_by_refinement + (`FINITE {p | p permutes {0, 1, 2, 3}}`, + [MATCH_MP_TAC FINITE_PERMUTATIONS THEN MESON_TAC[FINITE_RULES]]);; + +(* ======================================================================= *) +(* Lemma 5 *) +let TRUONG_SET_TAC = let basicthms = +[NOT_IN_EMPTY; IN_UNIV; IN_UNION; IN_INTER; IN_DIFF; IN_INSERT; +IN_DELETE; IN_REST; IN_INTERS; IN_UNIONS; IN_IMAGE] in +let allthms = basicthms @ map (REWRITE_RULE[IN]) basicthms @ +[IN_ELIM_THM; IN] in +let PRESET_TAC = +TRY(POP_ASSUM_LIST(MP_TAC o end_itlist CONJ)) THEN +REPEAT COND_CASES_TAC THEN +REWRITE_TAC[EXTENSION; SUBSET; PSUBSET; DISJOINT; SING] THEN +REWRITE_TAC allthms in +fun ths -> +PRESET_TAC THEN +(if ths = [] then ALL_TAC else MP_TAC(end_itlist CONJ ths)) THEN +MESON_TAC ths ;; + +(* ======================================================================= *) +(* Lemma 6 *) +let DISJOINT_KY_LEMMA = prove_by_refinement ( + `~(x = y) /\ ~(x = z) ==> DISJOINT {x} {y, z:real^3}`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[DISJOINT; INTER ; IN; IN_ELIM_THM;Geomdetail.IN_ACT_SING]); + (MATCH_MP_TAC (MESON [] `(~a ==> F) ==> a`)); + (DISCH_TAC); + (SUBGOAL_THEN `?t. t IN {x' | x' = x /\ {y, z:real^3} x'}` ASSUME_TAC); + (UP_ASM_TAC THEN SET_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (NEW_GOAL `{y, z:real^3} t <=> (t = y) \/ (t = z)`); + (TRUONG_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 7 *) + + +let DIHV_SYM = prove_by_refinement ( + `!(x:real^N) y z t. dihV x y z t = dihV y x z t`, +[ (REPEAT GEN_TAC); + (REWRITE_TAC[dihV] THEN REPEAT LET_TAC); + (MATCH_MP_TAC (MESON[] + `!a b c d x. (a = b) /\ (c = d) ==> arcV x a c = arcV x b d`)); + (REPEAT STRIP_TAC); + (* Break into 2 subgoals with similar proofs *) + + (* Subgoal 1 *) + (EXPAND_TAC "vap'" THEN EXPAND_TAC "vap"); + + (REWRITE_WITH `(va':real^N) = va - vc`); + (EXPAND_TAC "va'" THEN EXPAND_TAC "va" THEN EXPAND_TAC "vc"); + (VECTOR_ARITH_TAC); + + (REWRITE_WITH `(vc':real^N) = --vc`); + (EXPAND_TAC "vc'" THEN EXPAND_TAC "vc"); + (VECTOR_ARITH_TAC); + + (REWRITE_WITH + `(--vc dot --vc) % (va:real^N - vc) = (vc dot vc) % va - (vc dot vc) % vc`); + (REWRITE_TAC[DOT_RNEG;DOT_LNEG;REAL_ARITH `-- --x = x `]); + (VECTOR_ARITH_TAC); + + (MATCH_MP_TAC (VECTOR_ARITH `a = b + c ==> x:real^N - b - c = x - a `)); + (REWRITE_WITH `((va:real^N - vc) dot --vc) % --vc = + (va dot vc) % vc - (vc dot vc) % vc`); + (REWRITE_TAC[DOT_RNEG;DOT_LNEG;VECTOR_MUL_LNEG; VECTOR_MUL_RNEG]); + (REWRITE_TAC[VECTOR_NEG_MINUS1;VECTOR_MUL_ASSOC]); + (REWRITE_TAC[REAL_ARITH `-- &1 * -- &1 * x = x`; + DOT_LSUB;VECTOR_SUB_RDISTRIB]); + (VECTOR_ARITH_TAC); + + (* Subgoal 2 *) + (EXPAND_TAC "vbp'" THEN EXPAND_TAC "vbp"); + (REWRITE_WITH `(vb':real^N) = vb - vc`); + (EXPAND_TAC "vb'" THEN EXPAND_TAC "vb" THEN EXPAND_TAC "vc"); + (VECTOR_ARITH_TAC); + + (REWRITE_WITH `(vc':real^N) = --vc`); + (EXPAND_TAC "vc'" THEN EXPAND_TAC "vc"); + (VECTOR_ARITH_TAC); + + (REWRITE_WITH + `(--vc dot --vc) % (vb:real^N - vc) = (vc dot vc) % vb - (vc dot vc) % vc`); + (REWRITE_TAC[DOT_RNEG;DOT_LNEG;REAL_ARITH `-- --x = x `]); + (VECTOR_ARITH_TAC); + + (MATCH_MP_TAC (VECTOR_ARITH `a = b + c ==> x:real^N - b - c = x - a `)); + (REWRITE_WITH `((vb:real^N - vc) dot --vc) % --vc = + (vb dot vc) % vc - (vc dot vc) % vc`); + (REWRITE_TAC[DOT_RNEG;DOT_LNEG;VECTOR_MUL_LNEG; VECTOR_MUL_RNEG]); + (REWRITE_TAC[VECTOR_NEG_MINUS1;VECTOR_MUL_ASSOC]); + (REWRITE_TAC[REAL_ARITH `-- &1 * -- &1 * x = x`; + DOT_LSUB;VECTOR_SUB_RDISTRIB]); + (VECTOR_ARITH_TAC)]);; + + +(* ======================================================================= *) +(* Lemma 8 *) +let RCONE_GT_SUBSET_RCONE_GE = prove_by_refinement ( + `! z:real^3 w h. rcone_gt z w h SUBSET rcone_ge z w h`, +[ (REPEAT GEN_TAC THEN REWRITE_TAC[RCONE_GT_GE]); + (SET_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 9 *) +let MCELL_EXPLICIT = prove_by_refinement ( + `!k ul V. + mcell 0 V ul = mcell0 V ul /\ + mcell 1 V ul = mcell1 V ul /\ + mcell 2 V ul = mcell2 V ul /\ + mcell 3 V ul = mcell3 V ul /\ + (k >= 4 ==> mcell k V ul = mcell4 V ul)`, +[ (NEW_GOAL `((1 = 0) ==> F) /\ ((2 = 0) ==> F) /\ ((3 = 0) ==> F) /\ +((2 = 1) ==> F) /\ ((3 = 1) ==> F) /\ ((3 = 2) ==> F)`); + (ARITH_TAC); + (REPEAT STRIP_TAC); (REWRITE_TAC[mcell]); + (REWRITE_TAC[mcell]); (COND_CASES_TAC); + (ASM_MESON_TAC[]); (MESON_TAC[]); + (REWRITE_TAC[mcell]); (COND_CASES_TAC); + (ASM_MESON_TAC[]); (COND_CASES_TAC); + (ASM_MESON_TAC[]); (MESON_TAC[]); + (REWRITE_TAC[mcell]); (COND_CASES_TAC); + (ASM_MESON_TAC[]); (COND_CASES_TAC); + (ASM_MESON_TAC[]); (COND_CASES_TAC); + (ASM_MESON_TAC[]); (MESON_TAC[]); + (REWRITE_TAC[mcell]); (COND_CASES_TAC); + (ASM_MESON_TAC[ARITH_RULE `~(0 >= 4)`]); + (COND_CASES_TAC); (ASM_MESON_TAC[ARITH_RULE `~(1 >= 4)`]); + (COND_CASES_TAC); (ASM_MESON_TAC[ARITH_RULE `~(2 >= 4)`]); + (COND_CASES_TAC); (ASM_MESON_TAC[ARITH_RULE `~(3 >= 4)`]); + (MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 10 *) +let EVENTUALLY_RADIAL_EMPTY = prove_by_refinement ( + `!v:real^3. eventually_radial v {} `, +[(STRIP_TAC); + (REWRITE_TAC[eventually_radial;radial]); + (EXISTS_TAC `&1`); + (REWRITE_TAC[REAL_ARITH `&1 > &0`;INTER_SUBSET]); + (REPEAT STRIP_TAC); + (NEW_GOAL `F`); + (DEL_TAC THEN DEL_TAC THEN UP_ASM_TAC); + (REWRITE_TAC[INTER_EMPTY]); + (SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 11 *) +let EVENTUALLY_RADIAL_NOT_IN_CLOSED_SET = prove_by_refinement ( + `!v:real^3 S. ~(S v) /\ (closed S)==> eventually_radial v S`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `?r. r > &0 /\ ball(v:real^3, r) INTER S = {}`); + (UP_ASM_TAC THEN REWRITE_TAC[closed; open_def]); + (DISCH_TAC); + (MP_TAC (SPEC `v:real^3` (ASSUME `!x. x IN (:real^3) DIFF S + ==> (?e. &0 < e /\ + (!x'. dist (x',x) < e ==> x' IN (:real^3) DIFF S))`))); + (DISCH_TAC); + (NEW_GOAL `(?e. &0 < e /\ (!x'. dist (x',v:real^3) < e ==> x' IN (:real^3) DIFF S))`); + (FIRST_X_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN_DIFF]); + (ASM_REWRITE_TAC[IN]); + (MESON_TAC[IN_UNIV;IN]); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `e:real`); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[ball]); + (MATCH_MP_TAC (SET_RULE `(!a:real^3. (a IN A) ==> ~(a IN B)) ==> (A INTER B = {})`)); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (GEN_TAC THEN DISCH_TAC); + (NEW_GOAL `a IN (:real^3) DIFF S ==> ~S a `); + (REWRITE_TAC[IN_DIFF;IN; IN_ELIM_THM]); + (MESON_TAC[]); + (FIRST_X_ASSUM MATCH_MP_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[eventually_radial;radial]); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `r:real`); + (ASM_REWRITE_TAC[INTER_SUBSET]); + (REPEAT STRIP_TAC); + (NEW_GOAL `F`); + (DEL_TAC THEN DEL_TAC); + (UP_ASM_TAC THEN REWRITE_WITH `S INTER ball (v,r) = ball (v:real^3,r) INTER S`); + (SET_TAC[]); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 12 *) +let CLOSED_CONVEX_HULL_FINITE = prove + (`!s. FINITE s ==> closed(convex hull s)`, + MESON_TAC[COMPACT_IMP_CLOSED; COMPACT_CONVEX_HULL; FINITE_IMP_COMPACT]);; + +(* ======================================================================= *) +(* Lemma 13 *) +let CLOSED_ROGERS = prove_by_refinement ( + `! V ul:(real^3)list. + saturated V /\ packing V /\ barV V 3 ul ==> closed (rogers V ul)`, +[(REPEAT STRIP_TAC THEN REWRITE_TAC[ROGERS]); + (MATCH_MP_TAC CLOSED_CONVEX_HULL_FINITE); + (MATCH_MP_TAC FINITE_IMAGE); + (REWRITE_WITH `{j | j < LENGTH (ul:(real^3)list)} ={j| j < 4}`); + (MATCH_MP_TAC (MESON[] `(a = b) ==> ({j:num| j < a} = {j | j < b})`)); + (NEW_GOAL `?u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]`); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (ASM_REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (REWRITE_TAC[FINITE_NUMSEG_LT])]);; + +(* ======================================================================= *) +(* Lemma 14 *) +let CLOSED_SET_OF_LIST_KY_LEMMA_1 = prove_by_refinement ( + `!V ul. + saturated V /\ packing V /\ barV V 3 (ul:(real^3)list) + ==> closed + (convex hull (set_of_list (truncate_simplex 2 ul) UNION {mxi V ul}))`, +[(REPEAT STRIP_TAC THEN MATCH_MP_TAC CLOSED_CONVEX_HULL_FINITE); + (NEW_GOAL `?u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]`); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (REWRITE_WITH `truncate_simplex 2 ul = [u0;u1;u2:real^3]`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_TAC[set_of_list]); + (REWRITE_TAC[ SET_RULE `!a b c d. {a,b,c} UNION {d:real^3} = {a,b,c,d}`]); + (REWRITE_TAC[Geomdetail.FINITE6])]);; +(* ======================================================================= *) +(* Lemma 15 *) +let CLOSED_SET_OF_LIST_KY_LEMMA_2 = prove_by_refinement ( + `!V (ul:(real^3)list). + saturated V /\ packing V /\ barV V 3 ul ==> + closed (convex hull set_of_list ul)`, +[(REPEAT STRIP_TAC THEN MATCH_MP_TAC CLOSED_CONVEX_HULL_FINITE); + (NEW_GOAL `?u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]`); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_TAC[Geomdetail.FINITE6])]);; + +(* ======================================================================= *) +(* Lemma 16 *) +let CLOSED_RCONE_GE = prove_by_refinement ( + `!v0 v1:real^3 a. &0 < a ==> closed (rcone_ge v0 v1 a)`, +[(REPEAT STRIP_TAC THEN REWRITE_TAC[rcone_ge;rconesgn]); + (REWRITE_TAC[closed]); + (REWRITE_WITH `(:real^3) DIFF + {x | (x - v0) dot (v1 - v0) >= dist (x,v0) * dist (v1,v0) * a} = + {x | (x - v0) dot (v1 - v0) < dist (x,v0) * dist (v1,v0) * a}`); + (REWRITE_TAC[Vol1.SET_EQ]); + (REWRITE_TAC[IN_DIFF;IN;IN_ELIM_THM;IN_UNIV]); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[open_def;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `~(v0 = v1:real^3)`); + STRIP_TAC; + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_SUB_REFL; DOT_RZERO; DIST_REFL; REAL_MUL_LZERO;REAL_MUL_RZERO]); + (REAL_ARITH_TAC); + + (ABBREV_TAC `s = dist (x,v0:real^3) * dist (v1,v0) * a`); + (ABBREV_TAC `t = (x - v0) dot (v1 - v0:real^3)`); + (EXISTS_TAC `(s - t) / (dist (v1,v0) * a + dist (v1, v0:real^3))`); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LT_DIV); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LT_ADD); + (ASM_SIMP_TAC [DIST_POS_LT]); + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_SIMP_TAC [DIST_POS_LT]); + + (REPEAT STRIP_TAC); + (NEW_GOAL `(x' - v0) dot (v1 - v0) <= + (x - v0:real^3) dot (v1 - v0) + dist (x',x) * dist (v1,v0) `); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a - b ==> b <= a`)); + (REWRITE_TAC[REAL_ARITH `(x + y) - z = (x - z) + y`]); + (REWRITE_TAC[VECTOR_ARITH `x dot y - z dot y = (x - z) dot y`]); + (REWRITE_TAC[VECTOR_ARITH `(x:real^3) - y - (z - y) = (x - z)`;dist]); + (REWRITE_WITH ` (x - x':real^3) dot (v1 - v0:real^3) = -- ((x' - x) dot (v1 - v0))`); + (VECTOR_ARITH_TAC); + + (MATCH_MP_TAC (REAL_ARITH `b <= a ==> &0 <= --b + a`)); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ]); + (NEW_GOAL `dist (x',v0) * dist (v1,v0:real^3) * a >= + dist (x,v0) * dist (v1,v0) * a - dist (x',x) * dist (v1,v0) * a `); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a - b ==> a >= b`)); + (REWRITE_TAC[REAL_ARITH `x * a * b - (y * a * b - z * a * b) = (x - y + z) * (a * b) `]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (MATCH_MP_TAC (REAL_ARITH `b <= a + c ==> &0 <= a - b + c`)); + (REWRITE_TAC[DIST_SYM]); + (REWRITE_WITH `dist (x, x':real^3) = dist (x', x)`); + (REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[DIST_TRIANGLE]); + (MATCH_MP_TAC REAL_LE_MUL); + + (ASM_SIMP_TAC[REAL_ARITH `&0 < a ==> &0 <= a`; DIST_POS_LE ]); + (MATCH_MP_TAC (REAL_ARITH `(?n q. m <= n /\ p >= q /\ n < q) ==> m < p`)); + (EXISTS_TAC `(x - v0) dot (v1 - v0) + dist (x',x) * dist (v1,v0:real^3)`); + (EXISTS_TAC `dist (x,v0:real^3) * dist (v1,v0) * a - dist (x',x) * dist (v1,v0) * a`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `t + c * b < s - c * b * a <=> c * (b * a + b) < s - t +`]); + (NEW_GOAL `dist (x',x) * (dist (v1,v0:real^3) * a + dist (v1,v0)) < s - t <=> + dist (x':real^3,x) < (s - t) / (dist (v1,v0) * a + dist (v1,v0))`); + (ONCE_REWRITE_TAC[MESON[] `!a b. (a <=> b) <=> (b <=> a)`]); + (MATCH_MP_TAC REAL_LT_RDIV_EQ); + (MATCH_MP_TAC REAL_LT_ADD); + (ASM_SIMP_TAC[REAL_LT_MUL; REAL_ARITH `&0 < a ==> &0 <= a`; DIST_POS_LT]); + (ASM_REWRITE_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 17 *) +let BARV_IMP_HL_1_POS_LT = prove_by_refinement ( + `!V ul:(real^3)list. + saturated V /\ packing V /\ barV V 3 ul + ==> &0 < hl (truncate_simplex 1 ul)`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `?u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]`); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (REPEAT (FIRST_X_ASSUM CHOOSE_TAC)); + (ABBREV_TAC `vl = truncate_simplex 1 (ul:(real^3)list)`); + (NEW_GOAL `hl (vl:(real^3)list) = dist (circumcenter (set_of_list vl),HD vl)`); + (MATCH_MP_TAC HL_EQ_DIST0); + (EXISTS_TAC `V:real^3->bool`); + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + + (NEW_GOAL `&0 <= hl (vl:(real^3)list)`); + (ASM_REWRITE_TAC[DIST_POS_LE]); + (ASM_CASES_TAC `&0 < hl (vl:(real^3)list)`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `hl (vl:(real^3)list) = &0`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[DIST_EQ_0]); + (REWRITE_WITH `vl = [u0;u1:real^3]`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_TAC[set_of_list;HD;CIRCUMCENTER_2;midpoint]); + STRIP_TAC; + (NEW_GOAL `(u0:real^3) = u1`); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (NEW_GOAL `barV V 1 (vl:(real^3)list)`); + (EXPAND_TAC "vl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + (NEW_GOAL `CARD (set_of_list (vl:(real^3)list)) = 1 + 1`); + (ASM_MESON_TAC[BARV_IMP_LENGTH_EQ_CARD]); + (UP_ASM_TAC THEN REWRITE_WITH `vl = [u0;u1:real^3]`); + (EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_TAC[ SET_RULE `{u1, u1:real^3} = {u1}`]); + (REWRITE_TAC[Hypermap.CARD_SINGLETON]); + (ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 18 *) +let CLOSED_MCELL = prove_by_refinement ( + `!V ul k. + saturated V /\ packing V /\ barV V 3 ul + ==> closed (mcell k V ul)`, +[(REPEAT STRIP_TAC); + (ASM_CASES_TAC `k = 0`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT;mcell0]); + (MATCH_MP_TAC CLOSED_DIFF); + (ASM_MESON_TAC[CLOSED_ROGERS; OPEN_BALL]); + + (ASM_CASES_TAC `k = 1`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT;mcell1]); + (COND_CASES_TAC); + (MATCH_MP_TAC CLOSED_DIFF); + (STRIP_TAC); + (MATCH_MP_TAC CLOSED_INTER); + (ASM_MESON_TAC[CLOSED_ROGERS; CLOSED_CBALL]); + (REWRITE_TAC[OPEN_RCONE_GT]); + (REWRITE_TAC[CLOSED_EMPTY]); + + (SUBGOAL_THEN `? u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]` CHOOSE_TAC); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (ASM_CASES_TAC `k = 2`); + + (ASM_REWRITE_TAC[MCELL_EXPLICIT;mcell2]); + (COND_CASES_TAC); + LET_TAC; + (MATCH_MP_TAC CLOSED_INTER); + (STRIP_TAC); + + (MATCH_MP_TAC CLOSED_RCONE_GE); + (EXPAND_TAC "a"); + (MATCH_MP_TAC REAL_LT_DIV); + (SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]); + (ASM_MESON_TAC[BARV_IMP_HL_1_POS_LT]); + + (MATCH_MP_TAC CLOSED_INTER); + (STRIP_TAC); + (MATCH_MP_TAC CLOSED_RCONE_GE); + (EXPAND_TAC "a"); + (MATCH_MP_TAC REAL_LT_DIV); + (SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]); + (ASM_MESON_TAC[BARV_IMP_HL_1_POS_LT]); + + (MATCH_MP_TAC CLOSED_AFF_GE); + (MESON_TAC[Geomdetail.FINITE6]); + (MESON_TAC[CLOSED_EMPTY]); + + (ASM_CASES_TAC `k = 3`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT;mcell3]); + (COND_CASES_TAC); + (ASM_MESON_TAC[CLOSED_SET_OF_LIST_KY_LEMMA_1]); + (MESON_TAC[CLOSED_EMPTY]); + + (NEW_GOAL `k >= 4`); + (ASM_ARITH_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT;mcell4]); + (COND_CASES_TAC); + (ASM_MESON_TAC[CLOSED_SET_OF_LIST_KY_LEMMA_2]); + (MESON_TAC[CLOSED_EMPTY]) +]);; + +(* ======================================================================= *) +(* Lemma 19 *) +let BARV_IMP_u0_IN_V = prove_by_refinement ( + `!V ul u0 u1 u2 u3. + saturated V /\ packing V /\ barV V 3 ul /\ ul = [u0;u1;u2;u3:real^3] + ==> u0 IN V`, +[(REWRITE_TAC[BARV; VORONOI_NONDG]); + (REPEAT STRIP_TAC); + (NEW_GOAL `initial_sublist [u0:real^3] ul /\ 0 < LENGTH [u0]`); + (REWRITE_TAC[INITIAL_SUBLIST;LENGTH; APPEND; ARITH_RULE `0 < SUC 0`]); + (EXISTS_TAC `[u1;u2;u3:real^3]`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list [u0:real^3] SUBSET V`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[set_of_list]); + (SET_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 20 *) +let ROGERS_INTER_V_LEMMA = prove_by_refinement ( + `!V ul v:real^3. + saturated V /\ packing V /\ barV V 3 ul /\ v IN V /\ (rogers V ul v) + ==> v = HD ul`, +[(REPEAT STRIP_TAC); + (SUBGOAL_THEN `? u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]` CHOOSE_TAC); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (ASM_REWRITE_TAC[HD]); + + (NEW_GOAL `(rogers V ul) SUBSET (voronoi_closed V (u0:real^3))`); + (REWRITE_TAC[SUBSET]); + (REPEAT STRIP_TAC); + (NEW_GOAL `!p. p IN voronoi_closed V u0 <=> + (?vl. vl IN barV V 3 /\ + p IN rogers V vl /\ + truncate_simplex 0 vl = [u0:real^3])`); + (GEN_TAC THEN MATCH_MP_TAC GLTVHUM); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[BARV_IMP_u0_IN_V]); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `ul:(real^3)list`); + (ASM_REWRITE_TAC[IN; TRUNCATE_SIMPLEX_EXPLICIT_0]); + (NEW_GOAL `(v:real^3) IN (voronoi_closed V u0)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[voronoi_closed;IN;IN_ELIM_THM]); + (DISCH_TAC); + (NEW_GOAL `dist (v,u0) <= dist (v,v:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[GSYM IN]); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL]); + (DISCH_TAC); + (NEW_GOAL `dist (v, u0:real^3) = &0`); + (NEW_GOAL `&0 <= dist (v, u0:real^3)`); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[DIST_EQ_0])]);; + +(* ======================================================================= *) +(* Lemma 21 *) +let CONVEX_HULL_4 = prove + (`convex hull {a,b,c,d} = + { u % a + v % b + w % c + z %d| + &0 <= u /\ &0 <= v /\ &0 <= w /\ &0 <= z /\ u + v + w + z = &1}`, + SIMP_TAC[CONVEX_HULL_FINITE; FINITE_INSERT; FINITE_RULES] THEN + SIMP_TAC[CONVEX_HULL_FINITE_STEP; FINITE_INSERT; FINITE_RULES] THEN + REWRITE_TAC[REAL_ARITH `x - y = z:real <=> x = y + z`; + VECTOR_ARITH `x - y = z:real^N <=> x = y + z`] THEN + REWRITE_TAC[VECTOR_ADD_RID; REAL_ADD_RID] THEN SET_TAC[]);; + +(* ======================================================================= *) +(* Lemma 22 *) +let REAL_LE_DIV_SIMPLIFY_KY_LEMMA = prove_by_refinement ( + `!a b c. &0 < a /\ b <= c / a ==> a * b <= c`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `a * b <= a * (c / a)`); + (REWRITE_TAC[REAL_ARITH `x * y <= x * z <=> &0 <= x * (z - y)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `a * c / a = c`); + (REWRITE_TAC[REAL_ARITH `a * c / a = c / a * a`]); + (MATCH_MP_TAC REAL_DIV_RMUL); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 23 *) + +let EVENTUALLY_RADIAL_CONVEX_HULL_4_sub1 = prove_by_refinement ( + `!a b c d:real^3. + ~( a IN convex hull {b , c, d}) + ==> eventually_radial a (convex hull {a, b , c, d})`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[eventually_radial]); + (ABBREV_TAC `s = convex hull {b , c, d:real^3}`); + + (NEW_GOAL `(?(x:real^3). x IN s /\ + (!y:real^3. y IN s ==> dist (a,x) <= dist (a,y)))`); + (MATCH_MP_TAC DISTANCE_ATTAINS_INF); + (EXPAND_TAC "s"); + (STRIP_TAC); + (MATCH_MP_TAC CLOSED_CONVEX_HULL_FINITE); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[CONVEX_HULL_EQ_EMPTY]); + (SET_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `dist (a, x:real^3)`); + + (NEW_GOAL `dist (a, x) <= dist (a, b:real^3) /\ + dist (a, x) <= dist (a, c:real^3) /\ + dist (a, x) <= dist (a, d:real^3)`); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "s"); + (MATCH_MP_TAC (SET_RULE `b IN {b} /\ {b} SUBSET s ==> b IN s `)); + (STRIP_TAC); + (SET_TAC[]); + (NEW_GOAL `{b:real^3} = convex hull {b}`); + (ONCE_REWRITE_TAC[MESON[] `a = b <=> b = a` ]); + (REWRITE_TAC[CONVEX_HULL_EQ]); + (REWRITE_TAC[CONVEX_SING]); + (ONCE_ASM_REWRITE_TAC[]); + (EXPAND_TAC "s"); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (SET_TAC[]); + + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "s"); + (MATCH_MP_TAC (SET_RULE `c IN {c} /\ {c} SUBSET s ==> c IN s `)); + (STRIP_TAC); + (SET_TAC[]); + (NEW_GOAL `{c:real^3} = convex hull {c}`); + (ONCE_REWRITE_TAC[MESON[] `a = b <=> b = a` ]); + (REWRITE_TAC[CONVEX_HULL_EQ]); + (REWRITE_TAC[CONVEX_SING]); + (ONCE_ASM_REWRITE_TAC[]); + (EXPAND_TAC "s"); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (SET_TAC[]); + + + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "s"); + (MATCH_MP_TAC (SET_RULE `c IN {c} /\ {c} SUBSET s ==> c IN s `)); + (STRIP_TAC); + (SET_TAC[]); + (NEW_GOAL `{d:real^3} = convex hull {d}`); + (ONCE_REWRITE_TAC[MESON[] `a = b <=> b = a` ]); + (REWRITE_TAC[CONVEX_HULL_EQ]); + (REWRITE_TAC[CONVEX_SING]); + (ONCE_ASM_REWRITE_TAC[]); + (EXPAND_TAC "s"); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + (SET_TAC[]); + +(* ======== break main lemma into 2 smaller ones =============== *) +(* subgoal 1 *) + + (STRIP_TAC); + (ASM_CASES_TAC `dist (a:real^3, x) = &0`); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_EQ_0]); + (DISCH_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (NEW_GOAL `&0 <= dist (a, x:real^3)`); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + +(* subgoal 2 *) + + (REWRITE_TAC[radial; INTER_SUBSET]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[IN_INTER]); + (STRIP_TAC); + (ASM_CASES_TAC `u:real^3 = vec 0`); + (ASM_REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_RID]); + (REWRITE_TAC[CONVEX_HULL_4;IN;IN_ELIM_THM]); + (EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0`); + (REWRITE_TAC[REAL_ARITH `&0 <= &1 /\ &0 <= &0 /\ &1 + &0 + &0 + &0 = &1`]); + (VECTOR_ARITH_TAC); + (NEW_GOAL `?y. y IN convex hull {b, c, d:real^3} /\ + (a + t % u) IN convex hull {a, y}`); + (UNDISCH_TAC `a + u IN convex hull {a, b, c, d:real^3} INTER ball (a,dist (a,x))`); + (REWRITE_TAC[CONVEX_HULL_4;IN_INTER;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `(&1 / (&1 - u')) % (v % b + w % c + z % (d:real^3))`); + (STRIP_TAC); + (REWRITE_TAC[CONVEX_HULL_3;IN_ELIM_THM]); + (EXISTS_TAC ` v / (&1 - u')`); + (EXISTS_TAC ` w / (&1 - u')`); + (EXISTS_TAC ` z / (&1 - u')`); + (REPEAT STRIP_TAC); + + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a + b + c) / x`]); + (MATCH_MP_TAC (MESON [REAL_DIV_REFL] `~(y = &0) /\ (x = y) ==> x / y = &1`)); + (ASM_REWRITE_TAC[REAL_ARITH `!a b c d e. + (&1 - a = &0 <=> a = &1) /\ ( b + c + d = &1 - e <=> e + b + c + d = &1)`]); + (STRIP_TAC); + (NEW_GOAL `v = &0 /\ w = &0 /\ z = &0`); + (ASM_REAL_ARITH_TAC); + (UNDISCH_TAC `(a:real^3) + u = u' % a + v % b + w % c + z % d`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO]); + (REWRITE_TAC[VECTOR_ARITH `a + (u:real^3) = a + vec 0 + vec 0 + vec 0 <=> u = vec 0`]); + (ASM_MESON_TAC[]); + + (REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC]); + (REWRITE_TAC[REAL_ARITH `!x y. &1 / x * y = y / x`]); + + (REWRITE_WITH `v % (b:real^3) + w % c + z % d = a + u - u' % a`); + (SWITCH_TAC THEN UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `!a t u. a + u - t % a = (&1 - t) % a + u`]); + (REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC]); + (REWRITE_WITH `&1 / (&1 - u') * (&1 - u') = &1`); + (REWRITE_TAC[REAL_ARITH `!x y. &1 / x * y = y / x`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ARITH `!a. &1 - a = &0 <=> a = &1`]); + (STRIP_TAC); + (NEW_GOAL `v = &0 /\ w = &0 /\ z = &0`); + (ASM_REAL_ARITH_TAC); + (UNDISCH_TAC `(a:real^3) + u = u' % a + v % b + w % c + z % d`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO]); + (REWRITE_TAC[VECTOR_ARITH `a + (u:real^3) = a + vec 0 + vec 0 + vec 0 <=> u = vec 0`]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[VECTOR_MUL_LID; CONVEX_HULL_2;IN_ELIM_THM]); + (EXISTS_TAC `&1 - t * (&1 - u') `); + (EXISTS_TAC `t * (&1 - u')`); + (REPEAT STRIP_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= &1 - a <=> a <= &1`]); + (NEW_GOAL `dist (a:real^3, a + u) / (&1 - u') = dist (a, a + (&1 / (&1 - u')) % u)`); + (REWRITE_TAC[dist; VECTOR_ARITH `a - (a + s:real^3) = -- s`; NORM_NEG; NORM_MUL; REAL_ABS_DIV; REAL_ABS_1]); + (ONCE_REWRITE_TAC[REAL_ARITH `&1 / x * y = y / x`]); + (AP_TERM_TAC); + (ONCE_REWRITE_TAC[MESON[] `x = y <=> y = x`]); + (REWRITE_TAC[REAL_ABS_REFL]); + (REWRITE_TAC[REAL_ARITH `!a. &0 <= &1 - a <=> a <= &1`]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `(&1 - u') * dist (a, x:real^3) <= norm (u:real^3) `); + (REWRITE_WITH `norm (u:real^3) = dist (a, a +u)`); + (REWRITE_TAC[dist]); + (NORM_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV_SIMPLIFY_KY_LEMMA); + (ASM_REWRITE_TAC[]); + + (STRIP_TAC); + (ASM_CASES_TAC `(&0 < &1 - u')`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `u' = &1`); + (NEW_GOAL `u' <= &1`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `&1 <= u'`); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `v = &0 /\ w = &0 /\ z = &0`); + (ASM_REAL_ARITH_TAC); + (UNDISCH_TAC `(a:real^3) + u = u' % a + v % b + w % c + z % d`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO]); + (REWRITE_TAC[VECTOR_ARITH `a + (u:real^3) = a + vec 0 + vec 0 + vec 0 <=> u = vec 0`]); + (ASM_MESON_TAC[]); + + (UNDISCH_TAC `x IN s /\ (!y. y IN s ==> dist (a:real^3,x) <= dist (a,y))`); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "s" THEN REWRITE_TAC[CONVEX_HULL_3; IN; IN_ELIM_THM]); + + (EXISTS_TAC ` v / (&1 - u')`); + (EXISTS_TAC ` w / (&1 - u')`); + (EXISTS_TAC ` z / (&1 - u')`); + (REPEAT STRIP_TAC); + + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `a / x + b / x + c / x = (a + b + c) / x`]); + (MATCH_MP_TAC (MESON [REAL_DIV_REFL] `~(y = &0) /\ (x = y) ==> x / y = &1`)); + (ASM_REWRITE_TAC[REAL_ARITH `!a b c d e. + (&1 - a = &0 <=> a = &1) /\ ( b + c + d = &1 - e <=> e + b + c + d = &1)`]); + (STRIP_TAC); + (NEW_GOAL `v = &0 /\ w = &0 /\ z = &0`); + (ASM_REAL_ARITH_TAC); + (UNDISCH_TAC `(a:real^3) + u = u' % a + v % b + w % c + z % d`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO]); + (REWRITE_TAC[VECTOR_ARITH `a + (u:real^3) = a + vec 0 + vec 0 + vec 0 <=> u = vec 0`]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `v / (&1 - u') % b + w / (&1 - u') % c + z / (&1 - u') % d = + &1 / (&1 - u') % (a + u:real^3) - u'/ (&1 - u') % a `); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC]); + (REWRITE_TAC[REAL_ARITH `&1 / x * y = y / x`]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ADD_LDISTRIB]); + + + (REWRITE_TAC[VECTOR_ARITH `a + b = (t % a + b) - s % a <=> a = (t - s) % a`]); + (REWRITE_WITH `&1 / (&1 - u') - u' / (&1 - u') = &1`); + (REWRITE_TAC[REAL_ARITH `a / b - c / b = (a - c) / b`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ARITH `!a. &1 - a = &0 <=> a = &1`]); + (STRIP_TAC); + (NEW_GOAL `v = &0 /\ w = &0 /\ z = &0`); + (ASM_REAL_ARITH_TAC); + (UNDISCH_TAC `(a:real^3) + u = u' % a + v % b + w % c + z % d`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO]); + (REWRITE_TAC[VECTOR_ARITH `a + (u:real^3) = a + vec 0 + vec 0 + vec 0 <=> u = vec 0`]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[VECTOR_MUL_LID]); + + + + (NEW_GOAL `t * ((&1 - u') * dist (a,x:real^3)) <= t * norm (u:real^3)`); + (REWRITE_TAC[REAL_ARITH `t * s <= t * k <=> &0 <= t * (k - s)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `t * ((&1 - u') * dist (a,x:real^3)) <= dist (a, x)`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL ` t * (&1 - u') <= &1 <=> + (t * (&1 - u')) * dist (a,x:real^3) <= &1 * dist (a,x)`); + (ONCE_REWRITE_TAC[MESON[] `(a <=> b) <=> (b <=> a)`]); + (MATCH_MP_TAC REAL_LE_RMUL_EQ); + (ASM_CASES_TAC `dist (a:real^3, x) = &0`); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_EQ_0]); + (DISCH_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (NEW_GOAL `&0 <= dist (a, x:real^3)`); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + + + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + + (REWRITE_TAC[VECTOR_SUB_RDISTRIB; VECTOR_ADD_LDISTRIB; VECTOR_MUL_LID; VECTOR_MUL_ASSOC]); + + (REWRITE_TAC [VECTOR_ARITH `a + m % u = a - t + t + n % u <=> (m - n) % u = vec 0`; VECTOR_MUL_EQ_0]); + (DISJ1_TAC); + (REWRITE_TAC[REAL_ARITH `(a * b) * &1 / b = a * (b / b)`]); + + +(* ======================================================================== *) + + (REWRITE_TAC[REAL_ARITH `t - t * s = t * (&1 - s)`]); + (MATCH_MP_TAC (MESON[REAL_MUL_RZERO] ` x = &0 ==> t * x = &0`)); + (REWRITE_TAC[REAL_ARITH `&1 - t = &0 <=> t = &1`]); + (MATCH_MP_TAC REAL_DIV_REFL); + + (REWRITE_TAC[REAL_ARITH `!a. &1 - a = &0 <=> a = &1`]); + (STRIP_TAC); + (NEW_GOAL `v = &0 /\ w = &0 /\ z = &0`); + (ASM_REAL_ARITH_TAC); + (UNDISCH_TAC `(a:real^3) + u = u' % a + v % b + w % c + z % d`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO]); + (REWRITE_TAC[VECTOR_ARITH `a + (u:real^3) = a + vec 0 + vec 0 + vec 0 <=> u = vec 0`]); + (ASM_MESON_TAC[]); + +(* ghep vao cuchuoi *) + + (FIRST_X_ASSUM CHOOSE_TAC); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + (UP_ASM_TAC THEN MATCH_MP_TAC (SET_RULE `A SUBSET B ==> (a IN A ==> a IN B)`)); + (NEW_GOAL `convex hull {a, b , c, d:real^3} = convex hull (convex hull {a, b, c, d})`); + (ONCE_REWRITE_TAC[MESON [] `!a b. a = b <=> b = a`]); + (REWRITE_TAC[CONVEX_HULL_EQ; CONVEX_CONVEX_HULL]); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC CONVEX_HULL_SUBSET); + (MATCH_MP_TAC (SET_RULE `!m a S. m IN S /\ a IN S ==> {a, m} SUBSET S`)); + (STRIP_TAC); + (MATCH_MP_TAC (SET_RULE `m IN convex hull {b, c, d:real^3} /\ + convex hull {b, c, d} SUBSET n ==> m IN n`)); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "s" THEN MATCH_MP_TAC CONVEX_HULL_SUBSET); + (SET_TAC[]); + (REWRITE_TAC[CONVEX_HULL_4;IN;IN_ELIM_THM]); + (EXISTS_TAC `&1` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0` THEN EXISTS_TAC `&0`); + (REWRITE_TAC[REAL_ARITH `&0 <= &1 /\ &0 <= &0 /\ &1 + &0 + &0 + &0 = &1`]); + (VECTOR_ARITH_TAC); + + (REWRITE_TAC[ball;IN;IN_ELIM_THM]); + (REWRITE_WITH `dist (a:real^3,a + t % u) = t * norm u`); + (REWRITE_TAC[dist; VECTOR_ARITH `a - (a + b:real^3) = -- b`; NORM_NEG; +NORM_MUL]); + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 24 *) +let U0_NOT_IN_CONVEX_HULL_FROM_ROGERS = prove_by_refinement ( + `!V (ul:(real^3)list). + saturated V /\ packing V /\ barV V 3 ul + ==> ~(HD ul IN + convex hull + {omega_list_n V ul 1, omega_list_n V ul 2, omega_list_n V ul 3})`, +[(REWRITE_TAC[ARITH_RULE `1 = SUC 0 /\ 2 = SUC 1 /\ 3 = SUC 2`; OMEGA_LIST_N]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1 /\ SUC 1 = 2 /\ SUC 2 = 3`]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]`); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (ABBREV_TAC `a = closest_point (voronoi_list V + (truncate_simplex 1 (ul:(real^3)list)))`); + (ABBREV_TAC `b = closest_point (voronoi_list V + (truncate_simplex 2 (ul:(real^3)list)))`); + (ABBREV_TAC `c = closest_point (voronoi_list V + (truncate_simplex 3 (ul:(real^3)list)))`); +(* First estimation *) + + (NEW_GOAL `(a (HD ul)) IN voronoi_list V (truncate_simplex 1 (ul:(real^3)list))`); + (EXPAND_TAC "a"); + (MATCH_MP_TAC CLOSEST_POINT_IN_SET); + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); + (MATCH_MP_TAC Packing3.BARV_IMP_VORONOI_LIST_NOT_EMPTY); + (EXISTS_TAC `1`); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + +(* Second estimation *) + + (NEW_GOAL `((b:real^3->real^3) (a (HD ul))) IN voronoi_list V (truncate_simplex 2 (ul:(real^3)list))`); + (EXPAND_TAC "b"); + + (MATCH_MP_TAC CLOSEST_POINT_IN_SET); + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); + (MATCH_MP_TAC Packing3.BARV_IMP_VORONOI_LIST_NOT_EMPTY); + (EXISTS_TAC `2`); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + +(* Third estimation *) + + (NEW_GOAL `((c:(real^3->real^3))((b:real^3->real^3) (a (HD ul)))) IN voronoi_list V (truncate_simplex 3 (ul:(real^3)list))`); + (EXPAND_TAC "c"); + (MATCH_MP_TAC CLOSEST_POINT_IN_SET); + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); + (MATCH_MP_TAC Packing3.BARV_IMP_VORONOI_LIST_NOT_EMPTY); + (EXISTS_TAC `3`); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (ABBREV_TAC `x:real^3 = (a (HD (ul:(real^3)list)))`); + (ABBREV_TAC `y:real^3 = b (x:real^3)`); + (ABBREV_TAC `z:real^3 = c (y:real^3)`); + + + (NEW_GOAL `(y:real^3) IN voronoi_list V (truncate_simplex 1 ul)`); + (MATCH_MP_TAC (SET_RULE `(?A. a IN A /\ A SUBSET B) ==> a IN B`)); + (EXISTS_TAC `voronoi_list V (truncate_simplex 2 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[VORONOI_LIST;VORONOI_SET]); + (MATCH_MP_TAC (SET_RULE `b SUBSET s ==> (INTERS s) SUBSET (INTERS b)`)); + (REWRITE_TAC[SIMPLE_IMAGE]); + (MATCH_MP_TAC IMAGE_SUBSET); + (ASM_REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1; TRUNCATE_SIMPLEX_EXPLICIT_2]); + (SET_TAC[]); + + (NEW_GOAL `(z:real^3) IN voronoi_list V (truncate_simplex 1 ul)`); + (MATCH_MP_TAC (SET_RULE `(?A. a IN A /\ A SUBSET B) ==> a IN B`)); + (EXISTS_TAC `voronoi_list V (truncate_simplex 3 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[VORONOI_LIST;VORONOI_SET]); + (MATCH_MP_TAC (SET_RULE `b SUBSET s ==> (INTERS s) SUBSET (INTERS b)`)); + (REWRITE_TAC[SIMPLE_IMAGE]); + (MATCH_MP_TAC IMAGE_SUBSET); + (ASM_REWRITE_TAC[set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1; TRUNCATE_SIMPLEX_EXPLICIT_3]); + (SET_TAC[]); + + (NEW_GOAL `convex hull {x, y, z:real^3} SUBSET (convex hull voronoi_list V (truncate_simplex 1 ul))`); + (MATCH_MP_TAC CONVEX_HULL_SUBSET); + (ASM_SET_TAC[]); + + (NEW_GOAL `convex hull voronoi_list V (truncate_simplex 1 (ul:(real^3)list)) + = voronoi_list V (truncate_simplex 1 ul)`); + (REWRITE_TAC [CONVEX_HULL_EQ; Packing3.CONVEX_VORONOI_LIST]); + (NEW_GOAL `u0:real^3 IN voronoi_list V (truncate_simplex 1 ul)`); + (REWRITE_WITH `u0:real^3 = HD ul`); + (ASM_MESON_TAC[HD]); + (ASM_SET_TAC[]); + (UP_ASM_TAC); + (ASM_REWRITE_TAC[ TRUNCATE_SIMPLEX_EXPLICIT_1; VORONOI_LIST; VORONOI_SET;set_of_list]); + (REWRITE_WITH `INTERS {voronoi_closed V v | v IN {u0, u1:real^3}} = + voronoi_closed V u0 INTER voronoi_closed V u1`); + (SET_TAC[]); + + + (REWRITE_TAC[IN_INTER; voronoi_closed; IN; IN_ELIM_THM; INTERS; DIST_REFL]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0, u1:real^3) <= dist (u0, u0)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[BARV_IMP_u0_IN_V]); + (NEW_GOAL `u0 = u1:real^3`); + (UP_ASM_TAC THEN REWRITE_TAC[DIST_REFL] THEN DISCH_TAC); + (NEW_GOAL `dist (u0,u1:real^3) = &0`); + (NEW_GOAL `&0 <= dist (u0,u1:real^3) `); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[DIST_EQ_0]); + (NEW_GOAL `aff_dim (set_of_list [u0;u1:real^3]) = &0`); + (ASM_REWRITE_TAC[set_of_list; SET_RULE `{x, x} = {x}`; AFF_DIM_SING]); + (NEW_GOAL `aff_dim (set_of_list [u0;u1:real^3]) = &1`); + (MATCH_MP_TAC MHFTTZN1); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `[u1; u1:real^3] = truncate_simplex 1 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `&0 = &1`); + (ASM_MESON_TAC[INT_OF_NUM_EQ;REAL_OF_NUM_EQ]); + (UP_ASM_TAC THEN REAL_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 25 *) +let RADIAL_VS_RADIAL_NORM = prove_by_refinement ( + `!(x:real^3) r C. radial r x C <=> radial_norm r x C`, +[ (REPEAT GEN_TAC); + (REWRITE_TAC[radial; Vol1.radial_norm]); + (REWRITE_WITH `!(x:real^3) r. ball (x, r) = normball x r`); + (REWRITE_TAC[ball; normball; DIST_SYM])]);; + +(* ======================================================================= *) +(* Lemma 26 *) + +let EVENTUALLY_RADIAL_INTER = prove_by_refinement ( + `!(x:real^3) C C'. + eventually_radial x C /\ eventually_radial x C' ==> + eventually_radial x (C INTER C')`, +[ (REWRITE_TAC[eventually_radial; RADIAL_VS_RADIAL_NORM]); + (REWRITE_WITH `!(x:real^3) r. ball (x, r) = normball x r`); + (REWRITE_TAC[ball; normball; DIST_SYM]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `r >= r'`); + (EXISTS_TAC `r':real`); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `(C INTER C') INTER normball (x:real^3) r' = + (C INTER normball x r') INTER (C' INTER normball x r')`); + (SET_TAC[]); + (MATCH_MP_TAC Vol1.inter_radial); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `radial_norm r (x:real^3) (C INTER normball x r)`); + (REWRITE_TAC[Vol1.radial_norm; normball]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[INTER_SUBSET]); + + (NEW_GOAL `x + u IN C INTER {y | dist (y,x:real^3) < r}`); + (MATCH_MP_TAC (SET_RULE `(?s. a IN s /\ s SUBSET t) ==> a IN t `)); + (EXISTS_TAC `C INTER {y | dist (y,x:real^3) < r'}`); + (ASM_REWRITE_TAC[SUBSET;IN_INTER;IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `(!t. t > &0 /\ t * norm u < r + ==> x + t % u IN C INTER {y | dist (y,x:real^3) < r})`); + (ASM_MESON_TAC[]); + (NEW_GOAL `x + t % u IN C INTER {y | dist (y,x:real^3) < r}`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[IN_INTER;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[dist; VECTOR_ARITH `((a:real^3) + b) - a = b`; NORM_MUL]); + (REWRITE_WITH `abs t = t`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `r:real`); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `(C INTER C') INTER normball (x:real^3) r = + (C INTER normball x r) INTER (C' INTER normball x r)`); + (SET_TAC[]); + (MATCH_MP_TAC Vol1.inter_radial); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `radial_norm r' (x:real^3) (C' INTER normball x r')`); + (REWRITE_TAC[Vol1.radial_norm; normball]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[INTER_SUBSET]); + + (NEW_GOAL `x + u IN C' INTER {y | dist (y,x:real^3) < r'}`); + (MATCH_MP_TAC (SET_RULE `(?s. a IN s /\ s SUBSET t) ==> a IN t `)); + (EXISTS_TAC `C' INTER {y | dist (y,x:real^3) < r}`); + (ASM_REWRITE_TAC[SUBSET;IN_INTER;IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `(!t. t > &0 /\ t * norm u < r' + ==> x + t % u IN C' INTER {y | dist (y,x:real^3) < r'})`); + (ASM_MESON_TAC[]); + (NEW_GOAL `x + t % u IN C' INTER {y | dist (y,x:real^3) < r'}`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[IN_INTER;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[dist; VECTOR_ARITH `((a:real^3) + b) - a = b`; NORM_MUL]); + (REWRITE_WITH `abs t = t`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 27 *) +let SET_EQ_LEMMA = SET_RULE + `A = B <=> (!x. (x IN A ==> x IN B) /\ (x IN B ==> x IN A))`;; + +let SET_OF_0_TO_3 = prove_by_refinement ( + `{j | j < 4} = {0,1,2,3}`, +[(REWRITE_TAC[SET_EQ_LEMMA;IN;IN_ELIM_THM] THEN GEN_TAC); + (ASM_CASES_TAC `x = 0`); (ASM_REWRITE_TAC[]); + (TRUONG_SET_TAC[ARITH_RULE `0 < 4`]); + (ASM_CASES_TAC `x = 1`);(ASM_REWRITE_TAC[]); + (TRUONG_SET_TAC[ARITH_RULE `1 < 4`]); + (ASM_CASES_TAC `x = 2`); (ASM_REWRITE_TAC[]); + (TRUONG_SET_TAC[ARITH_RULE `2 < 4`]); + (ASM_CASES_TAC `x = 3`); (ASM_REWRITE_TAC[]); + (TRUONG_SET_TAC[ARITH_RULE `3 < 4`]); + (NEW_GOAL `x >= 4`); (ASM_ARITH_TAC); (REPEAT STRIP_TAC); + (NEW_GOAL `F`); (ASM_ARITH_TAC); (ASM_MESON_TAC[]); (NEW_GOAL `F`); + (UP_ASM_TAC THEN TRUONG_SET_TAC[]); (ASM_MESON_TAC[])]);; + +let SET_OF_0_TO_2 = prove_by_refinement ( + `{j | j <= 2 } = {0,1,2}`, +[(REWRITE_TAC[SET_EQ_LEMMA;IN;IN_ELIM_THM] THEN GEN_TAC); + (ASM_CASES_TAC `x = 0`); (ASM_REWRITE_TAC[]); + (TRUONG_SET_TAC[ARITH_RULE `0 <= 2`]); + (ASM_CASES_TAC `x = 1`);(ASM_REWRITE_TAC[]); + (TRUONG_SET_TAC[ARITH_RULE `1 <= 2`]); + (ASM_CASES_TAC `x = 2`); (ASM_REWRITE_TAC[]); + (TRUONG_SET_TAC[ARITH_RULE `2 <= 2`]); + (NEW_GOAL `x >= 3`); (ASM_ARITH_TAC); (REPEAT STRIP_TAC); + (NEW_GOAL `F`); (ASM_ARITH_TAC); (ASM_MESON_TAC[]); (NEW_GOAL `F`); + (UP_ASM_TAC THEN TRUONG_SET_TAC[]); (ASM_MESON_TAC[])]);; + +let ZERO_LT_SQRT_2 = prove_by_refinement(`&1 < sqrt (&2)`, +[(NEW_GOAL `&0 < sqrt (&2)`); (MATCH_MP_TAC SQRT_POS_LT THEN REAL_ARITH_TAC); + (NEW_GOAL `&1 = abs (&1) /\ sqrt (&2) = abs (sqrt (&2))`); + ONCE_REWRITE_TAC[EQ_SYM_EQ]; REWRITE_TAC[REAL_ABS_REFL]; ASM_REAL_ARITH_TAC; + ONCE_ASM_REWRITE_TAC[]; + REWRITE_TAC[REAL_LT_SQUARE_ABS; REAL_ARITH `&1 pow 2 = &1`]; + REWRITE_WITH `sqrt (&2) pow 2 = &2`; MATCH_MP_TAC SQRT_POW_2;REAL_ARITH_TAC; + REAL_ARITH_TAC]);; + +(* ======================================================================= *) +(* Lemma 28 *) +let RCONE_GE_TRANS = prove_by_refinement ( + `!(a:real^3) b r x t. + &0 <= t /\ (a + x) IN rcone_ge a b r ==> a + t % x IN rcone_ge a b r`, +[(REWRITE_TAC[rcone_ge; rconesgn; IN; IN_ELIM_THM; dist]); + (REWRITE_TAC[VECTOR_ARITH `((a:real^3) + x) - a = x`; DOT_LMUL; NORM_MUL]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `abs t = t`); + (ASM_REWRITE_TAC[REAL_ABS_REFL]); + (REWRITE_TAC[REAL_ARITH `t * x >= ( t * m) * n <=> &0 <= t * (x - m * n)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC)]);; +(* ======================================================================= *) +(* Lemma 29 *) + +let RCONE_GE_INTERS_PROJECTION_KY_LEMMA = prove_by_refinement ( + `!(a:real^3) b r x:real^3. + &0 < r /\ r < &1 /\ ~(a = b) /\ + x IN (rcone_ge a b r) INTER (rcone_ge b a r) + ==> (?s. s IN convex hull {a, b} /\ (x - s) dot (a - b)= &0 )`, +[(REWRITE_TAC[rcone_ge; rconesgn; IN_INTER;IN; IN_ELIM_THM; dist]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?s. s IN aff {a, b:real^3} /\ (x - s) dot (a - b) = &0`); + (MESON_TAC[Trigonometry2.EXISTS_PROJECTING_POINT2]); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `s:real^3`); + (UP_ASM_TAC THEN + ASM_REWRITE_TAC[Topology.affine_hull_2_fan; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_2; IN_ELIM_THM]); + (EXISTS_TAC `t1:real`); + (EXISTS_TAC `t2:real`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + +(* Case 1 *) + + (ASM_CASES_TAC `t1 < &0`); + (NEW_GOAL `(x - b:real^3) dot (a - b) < &0`); + (REWRITE_WITH `(x - b:real^3) dot (a - b) = + (x - s) dot (a - b) + (s - b) dot (a - b)`); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_ADD_RID; REAL_ADD_LID]); + (REWRITE_WITH `((t1 % a + t2 % b) - b) = t1 % (a - b:real^3)`); + (REWRITE_WITH `((t1 % a + t2 % b) - b:real^3) = (t1 % a + t2 % b) - (t1 + t2) % b`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_LMUL]); + (ONCE_REWRITE_TAC[GSYM REAL_LT_NEG]); + (REWRITE_TAC[REAL_ARITH `-- (a * b) = (-- a) * b`; REAL_NEG_0]); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[GSYM NORM_POW_2]); + (MATCH_MP_TAC REAL_POW_LT); + (REWRITE_TAC[NORM_POS_LT]); + (ASM_REWRITE_TAC[VECTOR_ARITH `(a:real^3 - b = vec 0 <=> a = b)`]); + (NEW_GOAL `norm (x - b) * norm (a - b:real^3) * r < &0`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `&0 <= norm (x - b) * norm (a - b:real^3) * r`); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + +(* Case 2 *) + + (ASM_CASES_TAC `t2 < &0`); + (NEW_GOAL `(x - a:real^3) dot (b - a) < &0`); + (REWRITE_WITH `(x - a:real^3) dot (b - a) = + (a - s) dot (a - b) - (x - s) dot (a - b)`); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_ARITH `a - &0 = a`]); + (REWRITE_WITH `a - (t1 % a + t2 % b) = t2 % (a - b:real^3)`); + (REWRITE_WITH `(a:real^3) - (t1 % a + t2 % b) = (t1 + t2) % a - (t1 % a + t2 % b)`); + + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_LMUL]); + (ONCE_REWRITE_TAC[GSYM REAL_LT_NEG]); + (REWRITE_TAC[REAL_ARITH `-- (a * b) = (-- a) * b`; REAL_NEG_0]); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[GSYM NORM_POW_2]); + (MATCH_MP_TAC REAL_POW_LT); + (REWRITE_TAC[NORM_POS_LT]); + (ASM_REWRITE_TAC[VECTOR_ARITH `(a:real^3 - b = vec 0 <=> a = b)`]); + (NEW_GOAL `norm (x - a) * norm (b - a:real^3) * r < &0`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `&0 <= norm (x - a) * norm (b - a:real^3) * r`); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (ASM_REWRITE_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 30 *) +let RCONE_GE_INTER_VORONOI_CLOSED_PROJECTION_KY_LEMMA = prove_by_refinement( + `!(a:real^3) b r x:real^3 V. + &0 < r /\ ~(a = b) /\ a IN V /\ b IN V /\ + x IN (rcone_ge a b r) INTER (voronoi_closed V a) + ==> (?s. s IN convex hull {a, b} /\ (x - s) dot (a - b)= &0 )`, +[(REWRITE_TAC[voronoi_closed; rcone_ge; rconesgn; IN_INTER;IN; IN_ELIM_THM; dist]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?s. s IN aff {a, b:real^3} /\ (x - s) dot (a - b) = &0`); + (MESON_TAC[Trigonometry2.EXISTS_PROJECTING_POINT2]); + (FIRST_X_ASSUM CHOOSE_TAC); + (EXISTS_TAC `s:real^3`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN + ASM_REWRITE_TAC[Topology.affine_hull_2_fan; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_2; IN_ELIM_THM]); + (EXISTS_TAC `t1:real`); + (EXISTS_TAC `t2:real`); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[MESON[] `a /\ b <=> b /\ a`]); + (STRIP_TAC); + +(* Case 1 : &0 <= t2 *) + + (ASM_CASES_TAC `t2 < &0`); + (NEW_GOAL `(x - a:real^3) dot (b - a) < &0`); + (REWRITE_WITH `(x - a:real^3) dot (b - a) = + (a - s) dot (a - b) - (x - s) dot (a - b)`); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_ARITH `a - &0 = a`]); + (REWRITE_WITH `a - (t1 % a + t2 % b) = t2 % (a - b:real^3)`); + (REWRITE_WITH `(a:real^3) - (t1 % a + t2 % b) = (t1 + t2) % a - (t1 % a + t2 % b)`); + + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_LMUL]); + (ONCE_REWRITE_TAC[GSYM REAL_LT_NEG]); + (REWRITE_TAC[REAL_ARITH `-- (a * b) = (-- a) * b`; REAL_NEG_0]); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[GSYM NORM_POW_2]); + (MATCH_MP_TAC REAL_POW_LT); + (REWRITE_TAC[NORM_POS_LT]); + (ASM_REWRITE_TAC[VECTOR_ARITH `(a:real^3 - b = vec 0 <=> a = b)`]); + (NEW_GOAL `norm (x - a) * norm (b - a:real^3) * r < &0`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `&0 <= norm (x - a) * norm (b - a:real^3) * r`); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + +(* Case 2 : &0 <= t1 *) + + (ASM_CASES_TAC `t1 < &0`); + (NEW_GOAL `norm (x - a) <= norm (x - b:real^3)`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `norm (x - b) < norm (x - a:real^3)`); + (NEW_GOAL `norm (x - b) < norm (x - a:real^3) <=> + norm (x - b) pow 2 < norm (x - a) pow 2`); + (MATCH_MP_TAC Pack1.bp_bdt); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_REWRITE_TAC[]); + + + (REWRITE_WITH `norm (x - b) pow 2 = norm (s - b) pow 2 + norm (x - s:real^3) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (REWRITE_WITH `b:real^3 - s = t1 % (b - a)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `b:real^3 - (t1 % a + t2 % b) = (t1 + t2) % b - (t1 % a + t2 % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_LMUL]); + (REWRITE_WITH `(b - a:real^3) dot (x - s) = -- ((x - s) dot (a - b))`); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + + + (REWRITE_WITH `norm (x - a) pow 2 = norm (s - a) pow 2 + norm (x - s:real^3) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (REWRITE_WITH `a:real^3 - s = t2 % (a - b)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `a:real^3 - (t1 % a + t2 % b) = (t1 + t2) % a - (t1 % a + t2 % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_LMUL]); + (REWRITE_WITH `(a - b:real^3) dot (x - s) = ((x - s) dot (a - b))`); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + + + (MATCH_MP_TAC (REAL_ARITH `x < y ==> x + z < y + z`)); + (REWRITE_TAC[GSYM REAL_LT_SQUARE_ABS]); + (REWRITE_WITH `abs (norm (s - b:real^3)) = norm (s - b)`); + (REWRITE_TAC[REAL_ABS_REFL; NORM_POS_LE]); + (REWRITE_WITH `abs (norm (s - a:real^3)) = norm (s - a)`); + (REWRITE_TAC[REAL_ABS_REFL; NORM_POS_LE]); + + (REWRITE_WITH `s:real^3 - a = t2 % (b - a)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `(t1 % a + t2 % b) - a:real^3 = (t1 % a + t2 % b) - (t1 + t2) % a`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `s:real^3 - b = t1 % (a - b)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `(t1 % a + t2 % b) - b:real^3 = (t1 % a + t2 % b) - (t1 + t2) % b`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; GSYM dist; DIST_SYM]); + (MATCH_MP_TAC (REAL_ARITH `&0 < x * (a - b) ==> b * x < a * x`)); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (MATCH_MP_TAC DIST_POS_LT); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `t2 = &1 - t1`); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `abs (t1) = abs (-- t1)`); + (REWRITE_TAC[REAL_ABS_NEG]); + (REWRITE_WITH `abs (&1 - t1) = &1 - t1`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `abs (-- t1) = (-- t1)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 31 *) +let RCONEGE_INTER_VORONOI_CLOSED_IMP_RCONEGE = prove_by_refinement( + `!V a:real^3 b r x. + packing V /\ + saturated V /\ + a IN V /\ + b IN V /\ + ~(a = b) /\ + &0 < r /\ + r <= &1 /\ + x IN rcone_ge a b r /\ + x IN voronoi_closed V a ==> x IN rcone_ge b a r`, + +[(REPEAT STRIP_TAC); + (NEW_GOAL `?s. s IN convex hull {a, b:real^3} /\ (x - s) dot (a - b) = &0`); + (MATCH_MP_TAC RCONE_GE_INTER_VORONOI_CLOSED_PROJECTION_KY_LEMMA); + (EXISTS_TAC `r:real`); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[IN_INTER]); + (FIRST_X_ASSUM CHOOSE_TAC); + (UNDISCH_TAC `x IN rcone_ge (a:real^3) b r`); + (REWRITE_TAC[rcone_ge; rconesgn; IN; IN_ELIM_THM; dist]); + (DISCH_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[CONVEX_HULL_2;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + + + (NEW_GOAL `((x - (b:real^3)) dot (a - b)) * norm (x - a) >= + ((x - a) dot (b - a)) * norm (x - b)`); + (REWRITE_WITH `(x - b) dot (a - b:real^3) = + (x - s) dot (a - b) + (s - b) dot (a - b)`); + (VECTOR_ARITH_TAC); + (REWRITE_WITH `(x - a) dot (b - a:real^3) = + (a - s) dot (a - b) - (x - s) dot (a - b)`); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_ADD_LID; REAL_ARITH `a - &0 = a`]); + (REWRITE_WITH `(u % a + v % b) - b = u % (a - b:real^3)`); + (REWRITE_WITH `(u % a + v % b:real^3) - b = (u % a + v % b) - (u + v) % b`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + + (REWRITE_WITH `a - (u % a + v % b) = v % (a - b:real^3)`); + (REWRITE_WITH `a - (u % a + v % b:real^3) = (u + v) % a - (u % a + v % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_LMUL; GSYM NORM_POW_2; GSYM dist]); + (REWRITE_TAC[REAL_ARITH `(a * x) * y >= (b * x) * z <=> &0 <= x * (a * y - b * z)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_LE_POW_2]); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (NEW_GOAL `v * dist (x,b) <= u * dist (x,a:real^3) <=> + (v * dist (x,b)) pow 2 <= (u * dist (x,a)) pow 2`); + (MATCH_MP_TAC Trigonometry2.POW2_COND); + (ASM_SIMP_TAC[REAL_LE_MUL; DIST_POS_LE]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `(x * y) pow 2 = (x pow 2) * (y pow 2)`; dist]); + + (REWRITE_WITH `norm (x:real^3 - b) pow 2 = norm (s - b) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (REWRITE_WITH `b - s:real^3 = -- u % (a - b)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `b:real^3 - (u % a + v % b) = (u + v) % b - (u % a + v % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (ASM_MESON_TAC[DOT_LMUL; REAL_MUL_RZERO;DOT_SYM]); + (REWRITE_WITH `norm (s - b:real^3) = norm (b - s)`); + (NORM_ARITH_TAC); + (REWRITE_WITH `b - s:real^3 = -- u % (a - b)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `b:real^3 - (u % a + v % b) = (u + v) % b - (u % a + v % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; REAL_ABS_NEG]); + + (REWRITE_WITH `norm (x:real^3 - a) pow 2 = norm (s - a) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (REWRITE_WITH `a - s:real^3 = v % (a - b)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `a:real^3 - (u % a + v % b) = (u + v) % a - (u % a + v % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (ASM_MESON_TAC[DOT_LMUL; REAL_MUL_RZERO;DOT_SYM]); + (REWRITE_WITH `norm (s - a:real^3) = norm (a - s)`); + (NORM_ARITH_TAC); + (REWRITE_WITH `a - s:real^3 = v % (a - b)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `a:real^3 - (u % a + v % b) = (u + v) % a - (u % a + v % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL]); + + (REWRITE_TAC[REAL_POW_MUL; REAL_POW2_ABS]); + (REWRITE_TAC[REAL_ARITH `x * (y * z + t) <= y * (x * z + t) <=> + &0 <= t * (y - x)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_LE_POW_2]); + (REWRITE_TAC[REAL_ARITH `&0 <= x - y <=> y <= x`]); + (NEW_GOAL `v pow 2 <= u pow 2 <=> v <= u`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Trigonometry2.POW2_COND THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `(x:real^3) IN voronoi_closed V a`); + (REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (x,a) <= dist (x,b:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (NEW_GOAL `dist (x,a:real^3) <= dist (x,b) <=> + dist (x,a) pow 2 <= dist (x,b) pow 2`); + (MATCH_MP_TAC Trigonometry2.POW2_COND THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[DIST_POS_LE]); + (NEW_GOAL `dist (x,a) pow 2 <= dist (x,b:real^3) pow 2`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[dist]); + + (REWRITE_WITH `norm (x:real^3 - a) pow 2 = norm (s - a) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (REWRITE_WITH `a - s:real^3 = v % (a - b)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `a:real^3 - (u % a + v % b) = (u + v) % a - (u % a + v % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (ASM_MESON_TAC[DOT_LMUL; REAL_MUL_RZERO;DOT_SYM]); + + (REWRITE_WITH `norm (s - a:real^3) = norm (a - s)`); + (NORM_ARITH_TAC); + (REWRITE_WITH `a - s:real^3 = v % (a - b)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `a:real^3 - (u % a + v % b) = (u + v) % a - (u % a + v % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL]); + (REWRITE_TAC[REAL_POW_MUL; REAL_POW2_ABS]); + + (REWRITE_WITH `norm (x:real^3 - b) pow 2 = norm (s - b) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (REWRITE_WITH `b - s:real^3 = -- u % (a - b)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `b:real^3 - (u % a + v % b) = (u + v) % b - (u % a + v % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (ASM_MESON_TAC[DOT_LMUL; REAL_MUL_RZERO;DOT_SYM]); + (REWRITE_WITH `norm (s - b:real^3) = norm (b - s)`); + (NORM_ARITH_TAC); + (REWRITE_WITH `b - s:real^3 = -- u % (a - b)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `b:real^3 - (u % a + v % b) = (u + v) % b - (u % a + v % b)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; REAL_ABS_NEG; REAL_POW2_ABS; REAL_POW_MUL]); + + (REWRITE_TAC[REAL_ARITH `a * x + b <= c * x + b <=> &0 <= x * (c - a)`]); + (STRIP_TAC); + (REWRITE_WITH `v <= u <=> v pow 2 <= u pow 2`); + (MATCH_MP_TAC Trigonometry2.POW2_COND); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[REAL_ARITH `a <= b <=> &0 <= b - a`]); + (REWRITE_WITH `&0 <= u pow 2 - v pow 2 <=> + &0 <= norm (a:real^3 - b) pow 2 * (u pow 2 - v pow 2)`); + (NEW_GOAL `(!x y. &0 < x ==> (&0 <= x * y <=> &0 <= y))`); + (MESON_TAC[REAL_LE_MUL_EQ]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (FIRST_X_ASSUM MATCH_MP_TAC); + (MATCH_MP_TAC REAL_POW_LT); + (REWRITE_TAC[NORM_POS_LT]); + (REWRITE_TAC[VECTOR_ARITH `(a - b:real^3) = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + +(* ======================================================================== *) + + (ASM_CASES_TAC `&0 < norm (x:real^3 - b)`); + (ASM_CASES_TAC `&0 < norm (x:real^3 - a)`); + + (REWRITE_TAC[REAL_ARITH `a >= b * c <=> c * b <= a`]); + (REWRITE_WITH `(norm (a - b) * r) * norm (x - b) <= (x - b) dot (a - b) <=> + (norm (a - b) * r) <= ((x - b) dot (a - b)) / norm (x - b:real^3)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC REAL_LE_RDIV_EQ); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC (REAL_ARITH `(?x. a <= x /\ x <= b) ==> a <= b`)); + + (EXISTS_TAC `((x - a) dot (b - a)) / norm (x - a:real^3)`); + (STRIP_TAC); + + (REWRITE_WITH `norm (a - b) * r <= + ((x - a) dot (b - a)) / norm (x - a) <=> + (norm (a - b) * r) * norm (x - a) <= + ((x - a) dot (b - a:real^3))`); + (MATCH_MP_TAC REAL_LE_RDIV_EQ); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH + `(norm (a - b:real^3) * r) * norm (x - a) = norm (x - a) * norm (b - a) * r`); + (REWRITE_WITH `norm (a - b) = norm (b - a:real^3)`); + (NORM_ARITH_TAC); + (REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `((x - a) dot (b - a)) / norm (x - a:real^3) <= + ((x - b) dot (a - b)) / norm (x - b) <=> + ((x - a) dot (b - a)) * norm (x - b) <= + ((x - b) dot (a - b)) * norm (x - a)`); + (MATCH_MP_TAC RAT_LEMMA4); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `x = a:real^3`); + (ONCE_REWRITE_TAC[VECTOR_ARITH `a = b <=> a - b:real^3 = vec 0`]); + (REWRITE_TAC [GSYM NORM_EQ_0]); + (NEW_GOAL `&0 <= norm (x - a:real^3)`); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[GSYM NORM_POW_2]); + (ONCE_REWRITE_TAC[REAL_ARITH `a * a * b = (a pow 2) * b`]); + (REWRITE_TAC[REAL_ARITH `a >= a * b <=> &0 <= (&1 - b) * a`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_LE_POW_2]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `F`); + (NEW_GOAL `x = b:real^3`); + (ONCE_REWRITE_TAC[VECTOR_ARITH `a = b <=> a - b:real^3 = vec 0`]); + (REWRITE_TAC [GSYM NORM_EQ_0]); + (NEW_GOAL `&0 <= norm (x - b:real^3)`); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + + (UNDISCH_TAC `x IN voronoi_closed V (a:real^3)`); + (REWRITE_TAC[voronoi_closed;IN;IN_ELIM_THM]); + (STRIP_TAC); + (NEW_GOAL `dist (x,a) <= dist (x,b:real^3)`); + (FIRST_X_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[DIST_REFL]); + (STRIP_TAC); + (NEW_GOAL `a = b:real^3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[GSYM DIST_EQ_0]); + (NEW_GOAL `&0 <= dist (b, a:real^3)`); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 32 *) +let OMEGA_LIST_1_EXPLICIT_NEW = prove_by_refinement ( + `!a:real^3 b c d V ul. + saturated V /\ + packing V /\ + ul IN barV V 3 /\ + ul = [a; b; c; d] /\ + hl [a;b] < sqrt (&2) + ==> omega_list_n V ul 1 = circumcenter {a, b}`, +[ (REPEAT STRIP_TAC); + (REWRITE_WITH `{a,b} = set_of_list [a;(b:real^3)]`); + (MESON_TAC[set_of_list]); + (REWRITE_WITH `circumcenter (set_of_list [a; b:real^3]) = omega_list V [a:real^3; b]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC XNHPWAB1); + (EXISTS_TAC `1`); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + (MP_TAC (ASSUME `ul IN barV V 3`) THEN REWRITE_TAC[IN;BARV]); + + (REPEAT STRIP_TAC); + (REWRITE_TAC[LENGTH;ARITH_RULE `SUC (SUC 0) = 1 + 1`]); + (NEW_GOAL `initial_sublist vl (ul:(real^3)list)`); + (UNDISCH_TAC `initial_sublist vl [a:real^3; b]`); + (REWRITE_TAC[INITIAL_SUBLIST] THEN STRIP_TAC); + (EXISTS_TAC `APPEND yl [c;d:real^3]`); + (REWRITE_TAC[APPEND_ASSOC; GSYM (ASSUME `[a:real^3; b] = APPEND vl yl`)]); + (ASM_REWRITE_TAC[APPEND]); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[OMEGA_LIST_TRUNCATE_1])]);; + +(* ======================================================================= *) +(* Lemma 33 *) +let IN_SET_IMP_IN_CONVEX_HULL_SET = prove_by_refinement ( + `!a S:real^3->bool. a IN S ==> a IN convex hull S`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[SET_RULE `a IN s <=> {a} SUBSET s`]); + (NEW_GOAL `{a} = convex hull ({a:real^3})`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (SIMP_TAC[CONVEX_HULL_EQ;CONVEX_SING]); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC CONVEX_HULL_SUBSET); + (ASM_SET_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 34 *) +let CONVEX_HULL_BREAK_KY_LEMMA = prove_by_refinement ( + `!a:real^3 b c d x. between x (a,b) ==> +(convex hull {a,b,c,d} = convex hull {a,x, c,d} UNION convex hull {x,b,c,d})`, + +[(REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2;IN; IN_ELIM_THM]); + (REWRITE_TAC[SET_EQ_LEMMA]); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[CONVEX_HULL_4; IN_UNION;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `u = &0`); + (DISJ1_TAC); + (EXISTS_TAC `u':real`); + (EXISTS_TAC `v':real`); + (EXISTS_TAC `w:real`); + (EXISTS_TAC `z:real`); + (ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID]); + (REWRITE_WITH `v = &1`); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (NEW_GOAL `&0 < u `); + (ASM_REAL_ARITH_TAC); + (SWITCH_TAC THEN DEL_TAC); + (ASM_CASES_TAC `v = &0`); + (DISJ2_TAC); + (EXISTS_TAC `u':real`); + (EXISTS_TAC `v':real`); + (EXISTS_TAC `w:real`); + (EXISTS_TAC `z:real`); + (ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID]); + (REWRITE_WITH `u = &1`); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (NEW_GOAL `&0 < v `); + (ASM_REAL_ARITH_TAC); + (SWITCH_TAC THEN DEL_TAC); + + + (ASM_CASES_TAC `&0 < u' + v'`); + (ASM_CASES_TAC `u' / (u' + v') <= u`); + +(*CASE 1*) + (DISJ2_TAC); + (EXISTS_TAC `u' / u`); + (EXISTS_TAC `v' - v * (u'/ u)`); + (EXISTS_TAC `w:real`); + (EXISTS_TAC `z:real`); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[REAL_LE_DIV]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `v' - v * u' / u = (v' * u - v * u' )/ u`); + (REWRITE_TAC[REAL_ARITH `(a - b * d) / c = a / c - b * d / c`]); + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_WITH `v' = (v' * u) / u <=> v' * u = (v' * u)`); + (MATCH_MP_TAC REAL_EQ_RDIV_EQ); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `v * u' = u' - u * u'`); + (REWRITE_TAC[REAL_ARITH `a * b = b - c * b <=> ((c + a) - &1) * b = &0`]); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `v' * u - (u' - u * u') = u * (u' + v') - u'`]); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (NEW_GOAL `u' <= u * (u' + v') <=> u' / (u' + v') <= u`); + (ASM_MESON_TAC[REAL_LE_LDIV_EQ]); + (ONCE_ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_TAC[REAL_ARITH `a + b - e + c + d = (a + b - e) + c + d`]); + (REWRITE_WITH `u' / u + v' - v * u' / u = u' + v'`); + (ONCE_REWRITE_TAC[REAL_ARITH `a/x + b - m*e/x = c + b <=> (a - m*e)/x = c`]); + (NEW_GOAL `(u' - v * u') / u = u' <=> (u' - v * u') = u' * u`); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (ASM_REWRITE_TAC[]); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_WITH `u' - v * u' = u' * (u + v) - v * u'`); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_ADD_LDISTRIB;VECTOR_MUL_ASSOC]); + (REWRITE_TAC[VECTOR_ARITH `a + b + c + d = (x + m % y) + n % y + c + d <=> + (a - x) + (b - (m + n) % y) = vec 0 `]); + + (MATCH_MP_TAC (VECTOR_ARITH `a = vec 0 /\ b = vec 0 ==> a + b = vec 0`)); + (STRIP_TAC); + (REWRITE_TAC[VECTOR_ARITH + `(x % a - y % a = vec 0) <=> (x - y) % a = vec 0`; VECTOR_MUL_EQ_0]); + (DISJ1_TAC); + (REWRITE_TAC[REAL_ARITH `x - y / z * t = &0 <=> (y * t) / z = x`]); + (NEW_GOAL `(u' * u) / u = u' <=> (u' * u) = u' * u`); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (ASM_REWRITE_TAC[]); + (ONCE_ASM_REWRITE_TAC[]); + (REFL_TAC); + + (REWRITE_TAC[VECTOR_ARITH + `(x % a - y % a = vec 0) <=> (x - y) % a = vec 0`; VECTOR_MUL_EQ_0]); + (DISJ1_TAC); + (REAL_ARITH_TAC); + +(*CASE 2*) + + + (NEW_GOAL `v' / (u' + v') <= v`); + (REWRITE_WITH `v' / (u' + v') = &1 - u' /(u' + v')`); + (REWRITE_TAC[REAL_ARITH `a / x = &1 - b / x <=> (b + a) / x = &1`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (DISJ1_TAC); + (EXISTS_TAC `u' - u * (v'/ v)`); + (EXISTS_TAC `v' / v`); + (EXISTS_TAC `w:real`); + (EXISTS_TAC `z:real`); + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[REAL_LE_DIV]); + (REPEAT STRIP_TAC); + + (REWRITE_WITH `u' - u * v' / v = (u' * v - u * v' )/ v`); + (REWRITE_TAC[REAL_ARITH `(a - b * d) / c = a / c - b * d / c`]); + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_WITH `u' = (u' * v) / v <=> u' * v = (u' * v)`); + (MATCH_MP_TAC REAL_EQ_RDIV_EQ); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `u * v' = v' - v * v'`); + (REWRITE_TAC[REAL_ARITH `a * b = b - c * b <=> ((c + a) - &1) * b = &0`]); + (ASM_REWRITE_TAC[REAL_ARITH `v + u = u + v`]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `v' * u - (u' - u * u') = u * (u' + v') - u'`]); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + + (NEW_GOAL `v' <= v * (v' + u') <=> v' / (v' + u') <= v`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC REAL_LE_LDIV_EQ); + (ASM_REAL_ARITH_TAC); + (ONCE_ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[REAL_ADD_SYM]); + + (REWRITE_TAC[REAL_ARITH `a - e + b + c + d = (a + b - e) + c + d`]); + (REWRITE_WITH `u' + v' / v - u * v' / v = u' + v'`); + + (ONCE_REWRITE_TAC[REAL_ARITH `b + a/x - m*e/x = b + c <=> (a - m*e)/x = c`]); + (NEW_GOAL `(v' - u * v') / v = v' <=> (v' - u * v') = v' * v`); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (ASM_REWRITE_TAC[]); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_WITH `v' - u * v' = v' * (u + v) - u * v'`); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_ADD_LDISTRIB;VECTOR_MUL_ASSOC]); + (REWRITE_TAC[VECTOR_ARITH `a + b + c + d = (m % y) + (n % y + z) + c + d <=> (b - z) + (a - (m + n) % y) = vec 0 `]); + + (MATCH_MP_TAC (VECTOR_ARITH `a = vec 0 /\ b = vec 0 ==> b + a = vec 0`)); + (STRIP_TAC); + + (REWRITE_TAC[VECTOR_ARITH + `(x % a - y % a = vec 0) <=> (x - y) % a = vec 0`; VECTOR_MUL_EQ_0]); + (DISJ1_TAC); + (REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH + `(x % a - y % a = vec 0) <=> (x - y) % a = vec 0`; VECTOR_MUL_EQ_0]); + (DISJ1_TAC); + + (REWRITE_TAC[REAL_ARITH `x - y / z * t = &0 <=> (y * t) / z = x`]); + (NEW_GOAL `(v' * v) / v = v' <=> (v' * v) = v' * v`); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (ASM_REWRITE_TAC[]); + (ONCE_ASM_REWRITE_TAC[]); + (REFL_TAC); + +(* CASE 3 *) + + (NEW_GOAL `u' + v' = &0`); + (ASM_REAL_ARITH_TAC); + (DISJ1_TAC); + (EXISTS_TAC `&0` THEN EXISTS_TAC `&0`); + (EXISTS_TAC `w:real` THEN EXISTS_TAC `z:real`); + (NEW_GOAL `u'= &0 /\ v' = &0`); + (ASM_REAL_ARITH_TAC); + (UNDISCH_TAC `x' = u' % a + v' % b + w % c + z % (d:real^3)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LZERO; REAL_ARITH `&0 <= &0`]); + (REPEAT STRIP_TAC); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + +(* ================================ *) + + (UP_ASM_TAC THEN REWRITE_TAC[IN_UNION]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `convex hull {a, x, c, d} SUBSET convex hull {a, b, c, d:real^3}`); + (NEW_GOAL `convex hull {a, b, c, d:real^3} = + convex hull (convex hull {a, b, c, d:real^3})`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[CONVEX_HULL_EQ; CONVEX_CONVEX_HULL]); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC CONVEX_HULL_SUBSET); + (ONCE_REWRITE_TAC[SUBSET; IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `x'' = a:real^3`); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (ASM_SET_TAC[]); + (ASM_CASES_TAC `x'' = d:real^3`); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (ASM_SET_TAC[]); + (ASM_CASES_TAC `x'' = c:real^3`); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (ASM_SET_TAC[]); + (NEW_GOAL `x'' = u % a + v % (b:real^3)`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `(?s. p IN s /\ s SUBSET r) ==> p IN r`)); + (EXISTS_TAC `convex hull {a, b:real^3}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM]); + (EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC CONVEX_HULL_SUBSET); + (SET_TAC[]); + (ASM_SET_TAC[]); + +(* == *) + + (NEW_GOAL `convex hull {x, b, c, d} SUBSET convex hull {a, b, c, d:real^3}`); + (NEW_GOAL `convex hull {a, b, c, d:real^3} = + convex hull (convex hull {a, b, c, d:real^3})`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[CONVEX_HULL_EQ; CONVEX_CONVEX_HULL]); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC CONVEX_HULL_SUBSET); + (ONCE_REWRITE_TAC[SUBSET; IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `x'' = b:real^3`); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (ASM_SET_TAC[]); + (ASM_CASES_TAC `x'' = d:real^3`); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (ASM_SET_TAC[]); + (ASM_CASES_TAC `x'' = c:real^3`); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (ASM_SET_TAC[]); + (NEW_GOAL `x'' = u % a + v % (b:real^3)`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `(?s. p IN s /\ s SUBSET r) ==> p IN r`)); + (EXISTS_TAC `convex hull {a, b:real^3}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM]); + (EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC CONVEX_HULL_SUBSET); + (SET_TAC[]); + (ASM_SET_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 35 *) +let AFF_GE_BREAK_KY_LEMMA = prove_by_refinement ( + `!a b c d (x:real^3). + between x (c, d) /\ + DISJOINT {a, b} {c, d} /\ + DISJOINT {a, b} {c, x} /\ + DISJOINT {a, b} {x, d} ==> + aff_ge {a, b} {c, d} = aff_ge {a, b} {c, x} UNION aff_ge {a, b} {x, d}`, +[(REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (ASM_SIMP_TAC[AFF_GE_2_2]); + (REWRITE_TAC[SET_EQ_LEMMA; IN_UNION; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (* Break to 3 subgoal *) + + (ASM_CASES_TAC `u = &0`); + (REWRITE_WITH `v = &1`); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID; VECTOR_MUL_LID]); + (DISJ1_TAC); + + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real`); + (EXISTS_TAC `t3:real` THEN EXISTS_TAC `t4:real`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `&0 = t4`); + (DISJ1_TAC); + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real`); + (EXISTS_TAC `t3 - u * t4 / v` THEN EXISTS_TAC `t4 / v`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b * c / d <=> (b * c) / d <= a `]); + (REWRITE_WITH `(u * t4) / v <= t3 <=> (u * t4) <= t3 * v`); + (MATCH_MP_TAC REAL_LE_LDIV_EQ); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `u * t4 <= t3 * v <=> v * (t3 + t4) >= t4`); + (REWRITE_WITH `v * (t3 + t4) >= t4 <=> v * (t3 + t4) >= t4 * (u + v)`); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `t1 + t2 + t3 - u * t4 / v + t4 / v = t1 + t2 + t3 + t4`); + (REPEAT AP_TERM_TAC); + (REWRITE_TAC[REAL_ARITH + `t3 - u * t4 / v + t4 / v = t3 + t4 <=> (t4 - t4 * u) / v = t4`]); + + (REWRITE_WITH `(t4 - t4 * u) / v = t4 <=> (t4 - t4 * u) = t4 * v`); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `(t4 - t4 * u) = t4 * (u + v) - t4 * u`); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `t1 % a + t2 % b + (t3 - u * t4 / v) % c + t4 / v % (u % c + v % d) = + t1 % a + t2 % b + t3 % c + t4 % (d:real^3)`); + (REPEAT AP_TERM_TAC); + + (REWRITE_TAC[VECTOR_SUB_RDISTRIB; VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC]); + (REWRITE_TAC[VECTOR_ARITH + `(x % c - y % c + t % c + z % d = x % c + n % d) <=> + (t - y) % c + (z - n) %d = vec 0`]); + (REWRITE_WITH `t4 / v * u - u * t4 / v = &0`); + (REAL_ARITH_TAC); + (REWRITE_WITH `t4 / v * v - t4 = &0`); + (REWRITE_TAC[REAL_ARITH `a / b * c - d = &0 <=> (a * c) / b = d`]); + (REWRITE_WITH `(t4 * v) / v = t4 <=> (t4 * v) = t4 * v`); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `(u * (t3 + t4) >= t3)`); + (DISJ2_TAC); + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real`); + (EXISTS_TAC `t3 / u` THEN EXISTS_TAC `t4 - v * t3 / u`); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= a - b * c / d <=> (b * c) / d <= a `]); + (REWRITE_WITH `(v * t3) / u <= t4 <=> (v * t3) <= t4 * u`); + (MATCH_MP_TAC REAL_LE_LDIV_EQ); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `v * t3 <= t4 * u <=> u * (t3 + t4) >= t3`); + (REWRITE_WITH `u * (t3 + t4) >= t3 <=> u * (t3 + t4) >= t3 * (u + v)`); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `t1 + t2 + t3 / u + t4 - v * t3 / u = t1 + t2 + t3 + t4`); + (REPEAT AP_TERM_TAC); + (REWRITE_TAC[REAL_ARITH + `t3 / u + t4 - v * t3 / u = t3 + t4 <=> (t3 - t3 * v) / u = t3`]); + + (REWRITE_WITH `(t3 - t3 * v) / u = t3 <=> (t3 - t3 * v) = t3 * u`); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `(t3 - t3 * v) = t3 * (u + v) - t3 * v`); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `t1 % a + t2 % b + t3 / u % (u % c + v % d) + (t4 - v * t3 / u) % d = + t1 % a + t2 % b + t3 % c + t4 % (d:real^3)`); + (REPEAT AP_TERM_TAC); + + (REWRITE_TAC[VECTOR_SUB_RDISTRIB; VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC]); + (REWRITE_TAC[VECTOR_ARITH + `(x % c + y % d) + a - z % d = t % c + a <=> + (x - t) % c + (y - z) %d = vec 0`]); + (REWRITE_WITH `t3 / u * v - v * t3 / u = &0`); + (REAL_ARITH_TAC); + (REWRITE_WITH `t3 / u * u - t3 = &0`); + (REWRITE_TAC[REAL_ARITH `a / b * c - d = &0 <=> (a * c) / b = d`]); + (REWRITE_WITH `(t3 * u) / u = t3 <=> (t3 * u) = t3 * u`); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (NEW_GOAL `v * (t3 + t4) < t4 /\ u * (t3 + t4) < t3`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `(u + v) * (t3 + t4) < (t3 + t4)`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[REAL_MUL_LID]); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (NEW_GOAL `t3 = &0 /\ t4 = &0`); + (ASM_REAL_ARITH_TAC); + (DISJ1_TAC); + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real`); + (EXISTS_TAC `t3:real` THEN EXISTS_TAC `t4:real`); + (ASM_REWRITE_TAC[VECTOR_MUL_LZERO]); +(* finish the first subgoal *) + + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real`); + (EXISTS_TAC `t3 + t4 * u` THEN EXISTS_TAC `t4 * v`); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_ADD); + (ASM_SIMP_TAC[REAL_LE_MUL]); + (ASM_SIMP_TAC[REAL_LE_MUL]); + (REWRITE_WITH `t1 + t2 + (t3 + t4 * u) + t4 * v = + t1 + t2 + t3 + t4 * (u + v)`); + (REAL_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (REWRITE_WITH `t1 % a + t2 % b + (t3 + t4 * u) % c + (t4 * v) % d = + t1 % a + t2 % b + t3 % c + t4 % (u % c + v % (d:real^3))`); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real`); + (EXISTS_TAC `t3 * u` THEN EXISTS_TAC `t4 + t3 * v`); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[REAL_LE_MUL]); + (MATCH_MP_TAC REAL_LE_ADD); + (ASM_SIMP_TAC[REAL_LE_MUL]); + (REWRITE_WITH `t1 + t2 + t3 * u + t4 + t3 * v = + t1 + t2 + t3 * (u + v) + t4`); + (REAL_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (REWRITE_WITH `t1 % a + t2 % b + (t3 * u) % c + (t4 + t3 * v) % d = + t1 % a + t2 % b + t3 % (u % c + v % d) + t4 % (d:real^3)`); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 36 *) +let CONVEX_HULL_4_SUBSET_AFF_GE_2_2 = prove_by_refinement ( + `!a b c d:real^3. + convex hull ({a, b, c, d}) SUBSET aff_ge {a, b} {c, d}`, +[(REPEAT STRIP_TAC); + (ASM_CASES_TAC `DISJOINT {a, b} {c, d:real^3}`); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM; CONVEX_HULL_4]); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[AFF_GE_2_2]); + (REWRITE_TAC[IN_ELIM_THM]); + (EXISTS_TAC `u:real`); + (EXISTS_TAC `v:real`); + (EXISTS_TAC `w:real`); + (EXISTS_TAC `z:real`); + (ASM_REWRITE_TAC[]); + +(* asm cases 1 *) + (ASM_CASES_TAC `c = a:real^3`); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[AFF_GE_DISJOINT_DIFF]); + (ASM_CASES_TAC `b = a:real^3 \/ b = d`); + (REWRITE_WITH `{a, b:real^3} DIFF {a, d:real^3} = {}`); + (ASM_SET_TAC[]); + (ONCE_REWRITE_TAC[CONVEX_HULL_AFF_GE]); + (REWRITE_WITH `{a, b, a , d:real^3} = {a, d}`); + (TRUONG_SET_TAC[]); + (TRUONG_SET_TAC[]); + (REWRITE_WITH `{a, b:real^3} DIFF {a, d:real^3} = {b}`); + (TRUONG_SET_TAC[]); + (NEW_GOAL `DISJOINT {b:real^3} {a, d}`); + (TRUONG_SET_TAC[]); + (ASM_SIMP_TAC[Fan.AFF_GE_1_2]); + (REWRITE_WITH `{a, b, a , d:real^3} = {a, b, d}`); + (TRUONG_SET_TAC[]); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM; CONVEX_HULL_3]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `v:real` THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `w:real`); + (ASM_REWRITE_TAC[REAL_ARITH `a + b + c = b + a + c`]); + (VECTOR_ARITH_TAC); + +(* asm cases 2 *) + (ASM_CASES_TAC `c = b:real^3`); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[AFF_GE_DISJOINT_DIFF]); + (ASM_CASES_TAC `a = b:real^3 \/ a = d`); + (REWRITE_WITH `{a, b:real^3} DIFF {b, d:real^3} = {}`); + (ASM_SET_TAC[]); + (ONCE_REWRITE_TAC[CONVEX_HULL_AFF_GE]); + (REWRITE_WITH `{a, b, b , d:real^3} = {b, d}`); + (TRUONG_SET_TAC[]); + (TRUONG_SET_TAC[]); + (REWRITE_WITH `{a, b:real^3} DIFF {b, d:real^3} = {a}`); + (TRUONG_SET_TAC[]); + (NEW_GOAL `DISJOINT {a:real^3} {b, d}`); + (TRUONG_SET_TAC[]); + (ASM_SIMP_TAC[Fan.AFF_GE_1_2]); + (REWRITE_WITH `{a, b, b , d:real^3} = {a, b, d}`); + (TRUONG_SET_TAC[]); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM; CONVEX_HULL_3]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real` THEN EXISTS_TAC `w:real`); + (ASM_REWRITE_TAC[]); + +(* asm case 3 *) + (ASM_CASES_TAC `d = a:real^3`); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[AFF_GE_DISJOINT_DIFF]); + (ASM_CASES_TAC `b = a:real^3 \/ b = c`); + (REWRITE_WITH `{a, b:real^3} DIFF {c, a:real^3} = {}`); + (ASM_SET_TAC[]); + (ONCE_REWRITE_TAC[CONVEX_HULL_AFF_GE]); + (REWRITE_WITH `{a, b, c , a:real^3} = {a, c}`); + (TRUONG_SET_TAC[]); + (REWRITE_TAC[SET_RULE `{x, y} = {y, x}`]); + (TRUONG_SET_TAC[]); + + (REWRITE_WITH `{a, b:real^3} DIFF {c, a:real^3} = {b}`); + (TRUONG_SET_TAC[]); + (NEW_GOAL `DISJOINT {b:real^3} {c, a}`); + (TRUONG_SET_TAC[]); + (ASM_SIMP_TAC[Fan.AFF_GE_1_2]); + (REWRITE_WITH `{a, b, c, a:real^3} = {a, b, c}`); + (TRUONG_SET_TAC[]); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM; CONVEX_HULL_3]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `v:real` THEN EXISTS_TAC `w:real` THEN EXISTS_TAC `u:real`); + (ASM_REWRITE_TAC[REAL_ARITH `v + w + u = u + v + w`]); + (VECTOR_ARITH_TAC); + +(* last case *) + (NEW_GOAL `d = b:real^3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[AFF_GE_DISJOINT_DIFF]); + (ASM_CASES_TAC `a = b:real^3 \/ a = c`); + (REWRITE_WITH `{a, b:real^3} DIFF {c, b:real^3} = {}`); + (ASM_SET_TAC[]); + (ONCE_REWRITE_TAC[CONVEX_HULL_AFF_GE]); + (REWRITE_WITH `{a, b, c , b:real^3} = {c, b}`); + (TRUONG_SET_TAC[]); + (TRUONG_SET_TAC[]); + (REWRITE_WITH `{a, b:real^3} DIFF {c, b:real^3} = {a}`); + (TRUONG_SET_TAC[]); + (NEW_GOAL `DISJOINT {a:real^3} {c, b}`); + (TRUONG_SET_TAC[]); + (ASM_SIMP_TAC[Fan.AFF_GE_1_2]); + (REWRITE_WITH `{a, b, c , b:real^3} = {a, b, c}`); + (TRUONG_SET_TAC[]); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM; CONVEX_HULL_3]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u:real` THEN EXISTS_TAC `w:real` THEN EXISTS_TAC `v:real`); + (ASM_REWRITE_TAC[REAL_ARITH `a + b + c = a + c + b`]); + (VECTOR_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 37 *) +let AFF_INDEPENDENT_SET_OF_LIST_BARV = prove_by_refinement ( + `!V ul:(real^3)list.packing V /\ saturated V /\ barV V 3 ul + ==> ~ affine_dependent (set_of_list ul)`, +[(REPEAT STRIP_TAC); + (SUBGOAL_THEN `? u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]` CHOOSE_TAC); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `barV V 3 (ul:(real^3)list)`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `~affine_dependent {u0,u1,u2,u3:real^3}`); + (REWRITE_TAC[AFFINE_INDEPENDENT_IFF_CARD]); + (STRIP_TAC); + (REWRITE_TAC[Geomdetail.FINITE6]); + (NEW_GOAL `aff_dim {u0, u1, u2, u3:real^3} = &3`); + (REWRITE_WITH `{u0, u1, u2, u3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.MHFTTZN1); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[ARITH_RULE + `&3 = &(CARD {u0, u1, u2, u3:real^3}) - (&1):int + <=> &(CARD {u0, u1, u2, u3:real^3}) = (&4):int`]); + (ONCE_REWRITE_TAC[INT_OF_NUM_EQ]); + (REWRITE_TAC[Geomdetail.CARD4]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u1, u2, u3:real^3}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (NEW_GOAL `aff_dim {u0, u1, u2, u3} <= &(CARD {u0, u1, u2, u3:real^3}) - (&1):int`); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_TAC[Geomdetail.FINITE6]); + (NEW_GOAL `(&4):int <= &(CARD {u0, u1, u2, u3:real^3})`); + (ONCE_REWRITE_TAC[ARITH_RULE + `(&4):int <= &(CARD {u0, u1, u2, u3:real^3}) <=> + &3 <= &(CARD {u0, u1, u2, u3:real^3}) - (&1):int`]); + (ASM_MESON_TAC[]); + (NEW_GOAL `&(CARD {u0, u1, u2, u3:real^3}) <= (&4):int`); + (ONCE_REWRITE_TAC[INT_OF_NUM_LE]); + (REWRITE_TAC[Geomdetail.CARD4]); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} = 4`); + (ONCE_REWRITE_TAC[GSYM INT_OF_NUM_EQ]); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u2, u3:real^3}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (NEW_GOAL `aff_dim {u0, u1, u2, u3} <= &(CARD {u0, u1, u2, u3:real^3}) - (&1):int`); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_TAC[Geomdetail.FINITE6]); + (NEW_GOAL `(&4):int <= &(CARD {u0, u1, u2, u3:real^3})`); + (ONCE_REWRITE_TAC[ARITH_RULE + `(&4):int <= &(CARD {u0, u1, u2, u3:real^3}) <=> + &3 <= &(CARD {u0, u1, u2, u3:real^3}) - (&1):int`]); + (ASM_MESON_TAC[]); + (NEW_GOAL `&(CARD {u0, u1, u2, u3:real^3}) <= (&4):int`); + (ONCE_REWRITE_TAC[INT_OF_NUM_LE]); + (REWRITE_TAC[Geomdetail.CARD4]); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} = 4`); + (ONCE_REWRITE_TAC[GSYM INT_OF_NUM_EQ]); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u1, u0, u3:real^3}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (NEW_GOAL `aff_dim {u0, u1, u2, u3} <= &(CARD {u0, u1, u2, u3:real^3}) - (&1):int`); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_TAC[Geomdetail.FINITE6]); + (NEW_GOAL `(&4):int <= &(CARD {u0, u1, u2, u3:real^3})`); + (ONCE_REWRITE_TAC[ARITH_RULE + `(&4):int <= &(CARD {u0, u1, u2, u3:real^3}) <=> + &3 <= &(CARD {u0, u1, u2, u3:real^3}) - (&1):int`]); + (ASM_MESON_TAC[]); + (NEW_GOAL `&(CARD {u0, u1, u2, u3:real^3}) <= (&4):int`); + (ONCE_REWRITE_TAC[INT_OF_NUM_LE]); + (REWRITE_TAC[Geomdetail.CARD4]); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} = 4`); + (ONCE_REWRITE_TAC[GSYM INT_OF_NUM_EQ]); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} <= 3`); + (REWRITE_WITH `{u0, u1, u2, u3} = {u0, u2, u3:real^3}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (NEW_GOAL `aff_dim {u0, u1, u2, u3} <= &(CARD {u0, u1, u2, u3:real^3}) - (&1):int`); + (MATCH_MP_TAC AFF_DIM_LE_CARD); + (REWRITE_TAC[Geomdetail.FINITE6]); + (NEW_GOAL `(&4):int <= &(CARD {u0, u1, u2, u3:real^3})`); + (ONCE_REWRITE_TAC[ARITH_RULE + `(&4):int <= &(CARD {u0, u1, u2, u3:real^3}) <=> + &3 <= &(CARD {u0, u1, u2, u3:real^3}) - (&1):int`]); + (ASM_MESON_TAC[]); + (NEW_GOAL `&(CARD {u0, u1, u2, u3:real^3}) <= (&4):int`); + (ONCE_REWRITE_TAC[INT_OF_NUM_LE]); + (REWRITE_TAC[Geomdetail.CARD4]); + (NEW_GOAL `CARD {u0, u1, u2, u3:real^3} = 4`); + (ONCE_REWRITE_TAC[GSYM INT_OF_NUM_EQ]); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[set_of_list])]);; + +(* ======================================================================= *) +(* Lemma 38 *) +let VORONOI_LIST_3_SINGLETON_EXPLICIT = prove_by_refinement ( + `!V ul. + packing V /\ saturated V /\ barV V 3 ul + ==> (?a. voronoi_list V ul = {a} /\ + a = circumcenter (set_of_list ul) /\ + hl ul = dist (HD ul, a))`, +[(REPEAT STRIP_TAC); + (SUBGOAL_THEN `? u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]` CHOOSE_TAC); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + + (NEW_GOAL `~affine_dependent {u0,u1,u2,u3:real^3}`); + (ASM_MESON_TAC[set_of_list; AFF_INDEPENDENT_SET_OF_LIST_BARV]); + + (NEW_GOAL `barV V 3 ul`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[BARV; VORONOI_NONDG]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `initial_sublist ul (ul:(real^3)list) /\ 0 < LENGTH ul`); + (ASM_REWRITE_TAC[INITIAL_SUBLIST; LENGTH; + ARITH_RULE `0 < 3 + 1 /\ 0 < SUC (SUC (SUC (SUC 0)))`]); + (EXISTS_TAC `[]:(real^3)list`); + (REWRITE_TAC[APPEND]); + (NEW_GOAL `aff_dim (voronoi_list V (ul:(real^3)list)) + &(LENGTH ul) = &4`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[LENGTH; ARITH_RULE `3 + 1 = 4`]); + (DISCH_TAC); + (NEW_GOAL `aff_dim (voronoi_list V [u0; u1; u2; u3:real^3]) = &0`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[AFF_DIM_EQ_0]); + (REPEAT STRIP_TAC); + + (EXISTS_TAC `a:real^3`); + + (NEW_GOAL `a = circumcenter (set_of_list [u0; u1; u2; u3:real^3])`); + (REWRITE_TAC[set_of_list]); + (NEW_GOAL `!p. p IN affine hull {u0, u1, u2, u3:real^3} /\ + (?c. !w. w IN {u0, u1, u2, u3} ==> dist (p,w) = c) + ==> p = circumcenter {u0, u1, u2, u3}`); + (MATCH_MP_TAC Rogers.OAPVION3); + (ASM_REWRITE_TAC[]); + + (FIRST_X_ASSUM MATCH_MP_TAC); + (NEW_GOAL `a IN voronoi_list V [u0; u1; u2; u3:real^3]`); + (UP_ASM_TAC THEN TRUONG_SET_TAC[]); + (NEW_GOAL `affine hull {u0, u1, u2, u3:real^3} = (:real^3)`); + (ONCE_ASM_REWRITE_TAC[GSYM AFF_DIM_EQ_FULL]); + (REWRITE_TAC[DIMINDEX_3]); + (REWRITE_WITH `{u0, u1, u2, u3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC Rogers.MHFTTZN1); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[IN_UNIV]); + (EXISTS_TAC `dist (a,u0:real^3)`); + (UNDISCH_TAC `a IN voronoi_list V [u0; u1; u2; u3:real^3]`); + (REWRITE_TAC[VORONOI_LIST;VORONOI_SET; set_of_list; + IN_INTERS; voronoi_closed]); + (REPEAT STRIP_TAC); + (SWITCH_TAC); + + (NEW_GOAL `a IN {x | !w. V w ==> dist (x,u0) <= dist (x,w:real^3)}`); + (FIRST_X_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `u0:real^3` THEN REWRITE_TAC[]); + (TRUONG_SET_TAC[]); + + (NEW_GOAL `a IN {x | !w. V w ==> dist (x,u1) <= dist (x,w:real^3)}`); + (FIRST_X_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `u1:real^3` THEN REWRITE_TAC[]); + (TRUONG_SET_TAC[]); + + (NEW_GOAL `a IN {x | !w. V w ==> dist (x,u2) <= dist (x,w:real^3)}`); + (FIRST_X_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `u2:real^3` THEN REWRITE_TAC[]); + (TRUONG_SET_TAC[]); + + (NEW_GOAL `a IN {x | !w. V w ==> dist (x,u3) <= dist (x,w:real^3)}`); + (FIRST_X_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `u3:real^3` THEN REWRITE_TAC[]); + (TRUONG_SET_TAC[]); + + (REPLICATE_TAC 4 UP_ASM_TAC THEN REWRITE_TAC[IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `u0 IN V /\ u1 IN V /\ u2 IN V /\ (u3:real^3) IN V`); + (UNDISCH_TAC `barV V 3 (ul:(real^3)list)`); + (REWRITE_TAC[BARV]); + (DISCH_TAC); + (NEW_GOAL `initial_sublist [u0;u1;u2;u3] ul /\ + 0 < LENGTH [u0;u1;u2;u3:real^3]`); + (REWRITE_TAC[LENGTH; INITIAL_SUBLIST]); + (STRIP_TAC); + (EXISTS_TAC `[]:(real^3)list`); + (ASM_REWRITE_TAC[APPEND]); + (ARITH_TAC); + + (NEW_GOAL `voronoi_nondg V [u0;u1;u2;u3:real^3]`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[VORONOI_NONDG; set_of_list]); + (SET_TAC[]); + + (UNDISCH_TAC `w IN {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[Geomdetail.IN_SET4] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (NEW_GOAL `dist (a,u0) <= dist (a,u1:real^3)`); + (MATCH_MP_TAC (ASSUME `!w. V w ==> dist (a,u0) <= dist (a,w:real^3)`)); + (ASM_REWRITE_TAC[GSYM IN]); + (NEW_GOAL `dist (a,u1) <= dist (a,u0:real^3)`); + (MATCH_MP_TAC (ASSUME `!w. V w ==> dist (a,u1) <= dist (a,w:real^3)`)); + (ASM_REWRITE_TAC[GSYM IN]); + (ASM_REAL_ARITH_TAC); + + (ASM_REWRITE_TAC[]); + (NEW_GOAL `dist (a,u0) <= dist (a,u2:real^3)`); + (MATCH_MP_TAC (ASSUME `!w. V w ==> dist (a,u0) <= dist (a,w:real^3)`)); + (ASM_REWRITE_TAC[GSYM IN]); + (NEW_GOAL `dist (a,u2) <= dist (a,u0:real^3)`); + (MATCH_MP_TAC (ASSUME `!w. V w ==> dist (a,u2) <= dist (a,w:real^3)`)); + (ASM_REWRITE_TAC[GSYM IN]); + (ASM_REAL_ARITH_TAC); + + (ASM_REWRITE_TAC[]); + (NEW_GOAL `dist (a,u0) <= dist (a,u3:real^3)`); + (MATCH_MP_TAC (ASSUME `!w. V w ==> dist (a,u0) <= dist (a,w:real^3)`)); + (ASM_REWRITE_TAC[GSYM IN]); + (NEW_GOAL `dist (a,u3) <= dist (a,u0:real^3)`); + (MATCH_MP_TAC (ASSUME `!w. V w ==> dist (a,u3) <= dist (a,w:real^3)`)); + (ASM_REWRITE_TAC[GSYM IN]); + (ASM_REAL_ARITH_TAC); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[HL;HD]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ABBREV_TAC `S = set_of_list [u0; u1; u2; u3:real^3]`); + (NEW_GOAL `(!w. w IN S ==> radV S = dist (circumcenter S,w:real^3))`); + (MATCH_MP_TAC Rogers.OAPVION2); + (EXPAND_TAC "S" THEN DEL_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "S" THEN REWRITE_TAC[set_of_list]); + (TRUONG_SET_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 39 *) +let ORTHOGONAL_AFF_HULL_2_KY_LEMMA = prove_by_refinement ( + `!n a b s p:real^3. + orthogonal (a - b) n /\ s IN aff {a, b} /\ p IN aff {a, b} + ==> orthogonal (s - p) n`, +[(REWRITE_TAC[Trigonometry2.AFF2; IN; IN_ELIM_THM; orthogonal]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH `(t % a + (&1 - t) % b) - (t' % a + (&1 - t') % b) + = (t - t') % (a - b)`;DOT_LMUL;REAL_MUL_RZERO])]);; +(* ======================================================================= *) +(* Lemma 40 *) + +let DIST_PROJECTION_LT_LEMMA = prove_by_refinement ( + `!x a b:real^3. ?s. s IN aff {a, b} /\ + (!m n. m IN aff {a, b} /\ n IN aff {a, b} ==> +(dist (x, m) < dist (x, n) <=> dist (s,m) < dist (s,n)) /\ +(dist (x, m) <= dist (x, n) <=> dist (s,m) <= dist (s,n)))`, +[ (REPEAT STRIP_TAC); + (SUBGOAL_THEN `?s:real^3. s IN aff {a, b} /\ (x - s) dot (a - b) = &0` CHOOSE_TAC); + (REWRITE_TAC[Trigonometry2.EXISTS_PROJECTING_POINT2]) ; + (EXISTS_TAC `s:real^3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC); + (REPEAT STRIP_TAC); + (NEW_GOAL `orthogonal (a - b) (x - s:real^3)`); + (REWRITE_TAC[orthogonal]); + (ONCE_REWRITE_TAC[DOT_SYM] THEN ASM_REWRITE_TAC[]); + + (EQ_TAC); + (REPEAT STRIP_TAC); + (REWRITE_TAC[dist]); + (NEW_GOAL `norm (s - m:real^3) = abs (norm (s - m)) /\ + norm (s - n) = abs (norm (s - n))`); + (MESON_TAC[REAL_ABS_REFL;NORM_POS_LE]); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_LT_SQUARE_ABS]); + (NEW_GOAL `norm (x:real^3 - m) pow 2 < norm (x - n) pow 2`); + (ONCE_REWRITE_TAC[GSYM REAL_LT_SQUARE_ABS]); + + (NEW_GOAL `abs (norm (x - m:real^3)) = (norm (x - m)) /\ + abs (norm (x - n)) = (norm (x - n))`); + (MESON_TAC[REAL_ABS_REFL;NORM_POS_LE]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM dist]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `norm (x - m:real^3) pow 2 = norm (s - m) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (MATCH_MP_TAC ORTHOGONAL_AFF_HULL_2_KY_LEMMA); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `b:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `norm (x - n:real^3) pow 2 = norm (s - n) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (MATCH_MP_TAC ORTHOGONAL_AFF_HULL_2_KY_LEMMA); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `b:real^3`); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (STRIP_TAC); + (REWRITE_TAC[dist]); + (NEW_GOAL `norm (x - m:real^3) = abs (norm (x - m)) /\ + norm (x - n) = abs (norm (x - n))`); + (MESON_TAC[REAL_ABS_REFL;NORM_POS_LE]); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_LT_SQUARE_ABS]); + (NEW_GOAL `norm (s:real^3 - m) pow 2 < norm (s - n) pow 2`); + (ONCE_REWRITE_TAC[GSYM REAL_LT_SQUARE_ABS]); + + (NEW_GOAL `abs (norm (s - m:real^3)) = (norm (s - m)) /\ + abs (norm (s - n)) = (norm (s - n))`); + (MESON_TAC[REAL_ABS_REFL;NORM_POS_LE]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM dist]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `norm (x - m:real^3) pow 2 = norm (s - m) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (MATCH_MP_TAC ORTHOGONAL_AFF_HULL_2_KY_LEMMA); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `b:real^3`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `norm (x - n:real^3) pow 2 = norm (s - n) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (MATCH_MP_TAC ORTHOGONAL_AFF_HULL_2_KY_LEMMA); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `b:real^3`); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `orthogonal (a - b) (x - s:real^3)`); + (REWRITE_TAC[orthogonal]); + (ONCE_REWRITE_TAC[DOT_SYM] THEN ASM_REWRITE_TAC[]); + + (EQ_TAC); + (REPEAT STRIP_TAC); + (REWRITE_TAC[dist]); + (NEW_GOAL `norm (s - m:real^3) = abs (norm (s - m)) /\ + norm (s - n) = abs (norm (s - n))`); + (MESON_TAC[REAL_ABS_REFL;NORM_POS_LE]); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_LE_SQUARE_ABS]); + (NEW_GOAL `norm (x:real^3 - m) pow 2 <= norm (x - n) pow 2`); + (ONCE_REWRITE_TAC[GSYM REAL_LE_SQUARE_ABS]); + + (NEW_GOAL `abs (norm (x - m:real^3)) = (norm (x - m)) /\ + abs (norm (x - n)) = (norm (x - n))`); + (MESON_TAC[REAL_ABS_REFL;NORM_POS_LE]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM dist]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `norm (x - m:real^3) pow 2 = norm (s - m) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (MATCH_MP_TAC ORTHOGONAL_AFF_HULL_2_KY_LEMMA); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `b:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `norm (x - n:real^3) pow 2 = norm (s - n) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (MATCH_MP_TAC ORTHOGONAL_AFF_HULL_2_KY_LEMMA); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `b:real^3`); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (STRIP_TAC); + (REWRITE_TAC[dist]); + (NEW_GOAL `norm (x - m:real^3) = abs (norm (x - m)) /\ + norm (x - n) = abs (norm (x - n))`); + (MESON_TAC[REAL_ABS_REFL;NORM_POS_LE]); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_LE_SQUARE_ABS]); + (NEW_GOAL `norm (s:real^3 - m) pow 2 <= norm (s - n) pow 2`); + (ONCE_REWRITE_TAC[GSYM REAL_LE_SQUARE_ABS]); + + (NEW_GOAL `abs (norm (s - m:real^3)) = (norm (s - m)) /\ + abs (norm (s - n)) = (norm (s - n))`); + (MESON_TAC[REAL_ABS_REFL;NORM_POS_LE]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM dist]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `norm (x - m:real^3) pow 2 = norm (s - m) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (MATCH_MP_TAC ORTHOGONAL_AFF_HULL_2_KY_LEMMA); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `b:real^3`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `norm (x - n:real^3) pow 2 = norm (s - n) pow 2 + norm (x - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (MATCH_MP_TAC ORTHOGONAL_AFF_HULL_2_KY_LEMMA); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `b:real^3`); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC) +]);; + +(* ======================================================================= *) +(* Lemma 41 *) + +let SIMPLEX_FURTHEST_LT_2 = prove_by_refinement ( + `!a (s:real^N->bool). + FINITE s + ==> (!x. x IN convex hull s /\ ~(x IN s) + ==> (?y. y IN s /\ norm (x - a) < norm (y - a)))`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `(?y:real^N. y IN convex hull s /\ norm (x - a) < norm (y - a))`); + (ASM_SIMP_TAC[SIMPLEX_FURTHEST_LT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (ASM_CASES_TAC `y:real^N IN s`); + (EXISTS_TAC `y:real^N`); + (ASM_REWRITE_TAC[]); + (SUBGOAL_THEN `(?y. y:real^N IN s /\ + (!x. x IN convex hull s ==> norm (x - a) <= norm (y - a)))` + CHOOSE_TAC); + (MATCH_MP_TAC SIMPLEX_FURTHEST_LE); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `x:real^N IN convex hull s`); + (ASM_REWRITE_TAC[CONVEX_HULL_EMPTY]); + (SET_TAC[]); + (EXISTS_TAC `y':real^N`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (REAL_ARITH `m < norm (y-a:real^N) /\ norm (y-a) <= n ==> m < n`)); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC THEN FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 42 *) + +let DIST_BETWEEN_FURTHEST_LT = prove_by_refinement ( + `!x a b s:real^3. + between s (a, b) /\ ~(s = a) /\ ~(s = b) /\ ~(a = b) /\ + dist (x, b) <= dist (x, a) + ==> dist (x,s) < dist (x,a)`, +[(REPEAT GEN_TAC THEN REWRITE_TAC[BETWEEN_IN_CONVEX_HULL] THEN REPEAT STRIP_TAC + THEN NEW_GOAL `(?y:real^3. y IN {a,b} /\ norm (s - x) < norm (y - x))`); + (NEW_GOAL`(!h. h IN convex hull {a,b} /\ ~(h IN {a,b:real^3}) + ==> (?y. y IN {a,b} /\ norm (h - x) < norm (y - x)))`); + (MATCH_MP_TAC SIMPLEX_FURTHEST_LT_2 THEN REWRITE_TAC[Geomdetail.FINITE6]); + (FIRST_X_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC THEN UP_ASM_TAC); + (REWRITE_TAC[SET_RULE `a IN {m,n} <=> a = m \/ a = n`]); + (REWRITE_TAC[GSYM dist] THEN REPEAT STRIP_TAC); + (ASM_MESON_TAC[DIST_SYM]); + (ASM_MESON_TAC[DIST_SYM; REAL_ARITH `x < y /\ y <= z ==> x < z`])]);; + +(* ======================================================================= *) +(* Lemma 43 *) + +let ROGERS_EXPLICIT = prove_by_refinement ( + `!V ul. + saturated V /\ packing V /\ barV V 3 ul ==> + rogers V ul = convex hull + {HD ul, omega_list_n V ul 1, omega_list_n V ul 2, omega_list_n V ul 3}`, +[(REPEAT STRIP_TAC THEN REWRITE_TAC[ROGERS]); + (NEW_GOAL `?u0 u1 u2 u3. (ul:(real^3)list) = [u0:real^3;u1;u2;u3]`); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV_3_EXPLICIT]); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (FIRST_X_ASSUM CHOOSE_TAC); + (REWRITE_WITH `{j | j < LENGTH (ul:(real^3)list)} = {0, 1,2,3}`); + (ASM_REWRITE_TAC[LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`]); + (MESON_TAC[SET_OF_0_TO_3]); + (REWRITE_TAC[IMAGE]); + (AP_TERM_TAC); + (REWRITE_WITH `!x. x IN {0,1,2,3} <=> (x = 0 \/x = 1 \/x = 2 \/x = 3)`); + (SET_TAC[]); + (REWRITE_WITH + `!y. (?x. (x = 0 \/ x = 1 \/ x = 2 \/ x = 3) /\ y = omega_list_n V ul x) + <=> (y = omega_list_n V ul 0) \/ (y = omega_list_n V ul 1) \/ + (y = omega_list_n V ul 2) \/(y = omega_list_n V ul 3)`); + (SET_TAC[BETA_THM]); + (REWRITE_WITH + `{y | y = omega_list_n V ul 0 \/ y = omega_list_n V ul 1 \/ + y = omega_list_n V ul 2 \/ y = omega_list_n V ul 3} + = {omega_list_n V ul 0, omega_list_n V ul 1, + omega_list_n V ul 2, omega_list_n V ul 3}`); + (SET_TAC[]); + (REWRITE_WITH `omega_list_n V ul 0 = HD ul`); + (REWRITE_TAC[OMEGA_LIST_N])]);; + +(* ======================================================================= *) +(* Lemma 44 *) +let SEGMENT_INTER_CBALL_LEMMA = prove + (`!x r a (b:real^3). + dist (x, a) <= r /\ r <= dist (x, b) + ==> (?c. between c (a, b) /\ dist (x, c) = r)`, + REPEAT STRIP_TAC THEN ASM_CASES_TAC `dist(x:real^3,b) = r` THENL + [EXISTS_TAC `b:real^3` THEN ASM_REWRITE_TAC[BETWEEN_REFL]; + MP_TAC(ISPECL [`segment[a:real^3,b]`; `cball(x:real^3,r)`] + CONNECTED_INTER_FRONTIER) THEN + ANTS_TAC THENL + [REWRITE_TAC[CONNECTED_SEGMENT; GSYM MEMBER_NOT_EMPTY] THEN CONJ_TAC THENL + [EXISTS_TAC `a:real^3` THEN + ASM_REWRITE_TAC[IN_INTER; ENDS_IN_SEGMENT; IN_CBALL]; + EXISTS_TAC `b:real^3` THEN + ASM_REWRITE_TAC[IN_DIFF; ENDS_IN_SEGMENT; IN_CBALL] THEN + ASM_REAL_ARITH_TAC]; + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN MATCH_MP_TAC MONO_EXISTS THEN + REWRITE_TAC[FRONTIER_CBALL; IN_ELIM_THM; IN_INTER; + BETWEEN_IN_SEGMENT]]]);; + +(* ======================================================================= *) +(* Lemma 45 *) +let CLOSEST_POINT_SING = prove_by_refinement ( + `!a (b:real^3). closest_point {a} b = a`, +[(REPEAT GEN_TAC THEN REWRITE_TAC + [closest_point;SET_RULE `a IN {x} <=> a = x`]); + (MATCH_MP_TAC SELECT_UNIQUE); + (REWRITE_TAC[BETA_THM] THEN GEN_TAC THEN EQ_TAC); + (REPEAT STRIP_TAC); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 46 *) + +let MXI_EXPLICIT = prove_by_refinement( + `!V ul u0 u1 u2 u3. + packing V /\ saturated V /\ barV V 3 ul /\ ul = [u0;u1;u2;u3] /\ + hl (truncate_simplex 2 ul) < sqrt (&2) /\ sqrt (&2) <= hl ul + ==> (?s. between s (omega_list_n V ul 2, omega_list_n V ul 3) /\ + dist (u0, s) = sqrt (&2) /\ + mxi V ul = s)`, +[(REPEAT STRIP_TAC); + (NEW_GOAL + `?(s:real^3). between s (omega_list_n V ul 2, omega_list_n V ul 3) /\ + dist (u0, s) = sqrt (&2)`); + (MATCH_MP_TAC SEGMENT_INTER_CBALL_LEMMA); + STRIP_TAC; + + (REWRITE_WITH `dist (u0:real^3,omega_list_n V ul 2) = + hl (truncate_simplex 2 ul)`); + (ABBREV_TAC `vl = truncate_simplex 2 (ul:(real^3)list)`); + (REWRITE_WITH `hl (vl:(real^3)list) = + dist (circumcenter (set_of_list vl),HD vl)`); + (MATCH_MP_TAC Rogers.HL_EQ_DIST0); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (REWRITE_TAC[DIST_SYM]); + (AP_TERM_TAC); + (REWRITE_TAC[PAIR_EQ]); + (STRIP_TAC); + (EXPAND_TAC "vl"); + (DEL_TAC THEN ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; HD]); + (ASM_REWRITE_TAC[Marchal_cells.OMEGA_LIST_TRUNCATE_2]); + (REWRITE_WITH `omega_list V [u0; u1; u2] = omega_list V (vl:(real^3)list)`); + (EXPAND_TAC "vl"); + (DEL_TAC THEN ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC XNHPWAB1); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[IN] THEN EXPAND_TAC "vl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ASM_REAL_ARITH_TAC); + +(* ======================================================================== *) + + (NEW_GOAL `~affine_dependent {u0,u1,u2,u3:real^3}`); + (ASM_MESON_TAC[set_of_list; AFF_INDEPENDENT_SET_OF_LIST_BARV]); + + (REWRITE_WITH `dist (u0:real^3,omega_list_n V ul 3) = + hl (truncate_simplex 3 ul)`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3]); + (REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `3 = SUC 2`]); + (ONCE_REWRITE_TAC[ARITH_RULE `SUC 2 = 3`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3]); + + (NEW_GOAL `barV V 3 ul`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[BARV; VORONOI_NONDG]); + (REPEAT STRIP_TAC); + (NEW_GOAL `(?a. voronoi_list V ul = {a:real^3} /\ + a = circumcenter (set_of_list ul) /\ + hl ul = dist (HD ul,a))`); + (ASM_SIMP_TAC[VORONOI_LIST_3_SINGLETON_EXPLICIT]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[HD] THEN REPEAT STRIP_TAC); + (REWRITE_TAC[ASSUME `voronoi_list V [u0; u1; u2; u3] = {a:real^3}`]); + (REWRITE_TAC[CLOSEST_POINT_SING]); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + + (EXISTS_TAC `s:real^3`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[mxi]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `hl (truncate_simplex 2 (ul:(real^3)list)) < sqrt (&2)`); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (UP_ASM_TAC THEN MESON_TAC[]); + (MATCH_MP_TAC SELECT_UNIQUE); + (REPEAT STRIP_TAC); + (REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL;HD]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (EQ_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[DIST_SYM]); + + (DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN + REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; + CONVEX_HULL_2; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ABBREV_TAC `a = omega_list_n V [u0; u1; u2; u3:real^3] 2`); + (ABBREV_TAC `b = omega_list_n V [u0; u1; u2; u3:real^3] 3`); + (NEW_GOAL `s = u % a + v % (b:real^3)`); + (ASM_MESON_TAC[]); + (NEW_GOAL `?c. c IN aff {a, b} /\ (u0 - c) dot (a - b:real^3) = &0`); + (REWRITE_TAC[Trigonometry2.EXISTS_PROJECTING_POINT2]); + (FIRST_X_ASSUM CHOOSE_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[Trigonometry2.AFF2;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + + (NEW_GOAL `dist (u0, a:real^3) < sqrt (&2)`); + (REWRITE_WITH `dist (u0, a:real^3) = hl (truncate_simplex 2 (ul:(real^3)list))`); + (ABBREV_TAC `vl = truncate_simplex 2 (ul:(real^3)list)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_WITH `a:real^3 = omega_list V vl`); + (EXPAND_TAC "vl" THEN DEL_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; LENGTH; ARITH_RULE `SUC (SUC (SUC 0)) - 1 = 2`]); + (EXPAND_TAC "a"); + (REWRITE_TAC[Marchal_cells.OMEGA_LIST_TRUNCATE_2]); + (REWRITE_WITH `u0:real^3 = HD vl`); + (EXPAND_TAC "vl" THEN DEL_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; HD]); + (MATCH_MP_TAC Rogers.WAUFCHE2); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "vl" THEN DEL_TAC); + (ASM_REWRITE_TAC[IN]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3`); + (ASM_MESON_TAC [ARITH_RULE `2 <= 3 `]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `dist (u0, b:real^3) >= sqrt (&2)`); + (REWRITE_WITH `dist (u0, b:real^3) = hl (ul:(real^3)list)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (SUBGOAL_THEN `?m. voronoi_list V ul = {m:real^3} /\ + m = circumcenter (set_of_list ul) /\ + hl ul = dist (HD ul,m)` CHOOSE_TAC); + (ASM_SIMP_TAC [VORONOI_LIST_3_SINGLETON_EXPLICIT]); + (NEW_GOAL `(b:real^3) IN voronoi_list V ul`); + (EXPAND_TAC "b"); + (REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `3 = SUC 2`]); + (REWRITE_TAC[ARITH_RULE `SUC 2 = 3`; TRUNCATE_SIMPLEX_EXPLICIT_3]); + (REWRITE_TAC[ASSUME `ul = [u0; u1; u2; u3:real^3]`]); + (MATCH_MP_TAC CLOSEST_POINT_IN_SET); + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + (ASM_SET_TAC[]); + + (UP_ASM_TAC THEN UP_ASM_TAC THEN REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `voronoi_list V ul = {m:real^3}`]); + (REWRITE_TAC[IN_SING] THEN STRIP_TAC); + (REWRITE_WITH `u0:real^3 = HD ul`); + (ASM_REWRITE_TAC[HD]); + (REWRITE_TAC[ASSUME `b = m:real^3`]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)] + THEN ASM_REAL_ARITH_TAC); + +(* ======================================================================== *) + + (ASM_CASES_TAC `y = s:real^3`); + (ASM_MESON_TAC[]); + (NEW_GOAL `between y (a, b:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2;IN;IN_ELIM_THM]); + (EXISTS_TAC `u':real` THEN EXISTS_TAC `v':real` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `between s (a, b:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2;IN;IN_ELIM_THM]); + (EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real` THEN ASM_REWRITE_TAC[]); + (ASM_CASES_TAC `between y (s, a:real^3)`); + + (NEW_GOAL `dist (u0,y) < dist (u0,s:real^3)`); + (MATCH_MP_TAC DIST_BETWEEN_FURTHEST_LT); + (EXISTS_TAC `a:real^3`); + (REPEAT STRIP_TAC); + + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (NEW_GOAL `dist (y:real^3,u0) < sqrt (&2)`); + (REWRITE_TAC[ASSUME `y = a:real^3`]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `dist (u0:real^3,s) < sqrt (&2)`); + (REWRITE_TAC[ASSUME `s = a:real^3`]); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_WITH `dist (u0,y) = dist (y,u0:real^3)`); + (MESON_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + + (ASM_CASES_TAC `between s (y, a:real^3)`); + + (NEW_GOAL `dist (u0,s) < dist (u0,y:real^3)`); + (MATCH_MP_TAC DIST_BETWEEN_FURTHEST_LT); + (EXISTS_TAC `a:real^3`); + (REPEAT STRIP_TAC); + + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (NEW_GOAL `dist (u0,s:real^3) < sqrt (&2)`); + (REWRITE_TAC[ASSUME `s = a:real^3`]); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `dist (y, u0:real^3) < sqrt (&2)`); + (REWRITE_TAC[ASSUME `y = a:real^3`]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + + (REWRITE_WITH `dist (u0,y:real^3) = dist (y, u0)`); + (MESON_TAC[DIST_SYM]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_WITH `dist (u0,y) = dist (y,u0:real^3)`); + (MESON_TAC[DIST_SYM]); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (NEW_GOAL `collinear {y, s, a:real^3}`); + (MATCH_MP_TAC AFFINE_HULL_3_IMP_COLLINEAR); + (REWRITE_TAC[AFFINE_HULL_2;IN;IN_ELIM_THM]); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `v / (v - v')`); + (EXISTS_TAC `&1 - v / (v - v')`); + (REWRITE_TAC[REAL_ARITH `a + &1 - a = &1`]); + (REWRITE_TAC[VECTOR_ARITH `a = x1 % (u' % a + v' % b) + x2 % (u % a + v % b) + <=> (&1 - x1 * u' - x2 * u) % a - (x1 * v' + x2 * v) % b = vec 0`]); + (REWRITE_WITH `&1 - v / (v - v') * u' - (&1 - v / (v - v')) * u = &0`); + (REWRITE_TAC[REAL_ARITH `&1 - v / (v - v') * u' - (&1 - v / (v - v')) * u = + (&1 - u) + v * (u - u') / (v - v') `]); + (REWRITE_WITH `u - u' = v' - v:real`); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&1 - u + v * (v' - v) / (v - v') = &1 - u - v * (v - v') / (v - v')`]); + (REWRITE_WITH `(v - v') / (v - v') = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ARITH `b - a = &0 <=> a = b`]); + + (STRIP_TAC); + (NEW_GOAL `s = y:real^3`); + (REWRITE_TAC[ASSUME `y = u' % a + v' % (b:real^3)`; + ASSUME `s = u % a + v % (b:real^3)`]); + (NEW_GOAL `u = u':real`); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[ASSUME `v' = v:real`; ASSUME `u = u':real`]); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + + (REWRITE_WITH `v / (v - v') * v' + (&1 - v / (v - v')) * v = &0`); + (REWRITE_TAC[REAL_ARITH `v / (v - v') * v' + (&1 - v / (v - v')) * v = + v - v * (v - v') / (v - v') `]); + (REWRITE_WITH `(v - v') / (v - v') = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ARITH `b - a = &0 <=> a = b`]); + (STRIP_TAC); + (NEW_GOAL `s = y:real^3`); + (REWRITE_TAC[ASSUME `y = u' % a + v' % (b:real^3)`; + ASSUME `s = u % a + v % (b:real^3)`]); + (NEW_GOAL `u = u':real`); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[ASSUME `v' = v:real`; ASSUME `u = u':real`]); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `between a (s, y:real^3)`); + (UP_ASM_TAC THEN REWRITE_TAC[COLLINEAR_BETWEEN_CASES]); + (ASM_MESON_TAC[BETWEEN_SYM]); + (UP_ASM_TAC THEN REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN; + IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (NEW_GOAL `a = u'' % s + v'' % (y:real^3)`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `y = u' % a + v' % (b:real^3)`; + ASSUME `s = u % a + v % (b:real^3)`]); + + (REWRITE_TAC[VECTOR_ARITH + `a = u'' % (u % a + v % b) + v'' % (u' % a + v' % b) + <=> (u''* u + v'' * u' - &1) % a + (u'' * v + v'' * v') % b = vec 0`]); + (REWRITE_WITH `(u'' * v + v'' * v') = -- (u'' * u + v'' * u' - &1)`); + (REWRITE_TAC[REAL_ARITH `u'' * v + v'' * v' = --(u'' * u + v'' * u' - &1) <=> + u'' * (u + v) + v'' * (u' + v') = &1`]); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (REWRITE_TAC[VECTOR_ARITH `a % x + -- a % y = a % (x - y)`;VECTOR_MUL_EQ_0]); + (REPEAT STRIP_TAC); + (NEW_GOAL `u'' * u <= u'' * (u + v)`); + (REWRITE_TAC[REAL_ARITH `a * b <= a * (b + c) <=> &0 <= a * c`]); + (ASM_SIMP_TAC[REAL_LE_MUL]); + (NEW_GOAL `v'' * u' <= v'' * (u' + v')`); + (REWRITE_TAC[REAL_ARITH `a * b <= a * (b + c) <=> &0 <= a * c`]); + (ASM_SIMP_TAC[REAL_LE_MUL]); + (NEW_GOAL `u'' * (u + v) + v'' * (u' + v') = &1`); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (NEW_GOAL `v'' * u' = v'' * (u' + v')`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ARITH `a * b = a * (b + c) <=> &0 = a * c`]); + (DISCH_TAC); + (NEW_GOAL `u'' * u = u'' * (u + v)`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ARITH `a * b = a * (b + c) <=> &0 = a * c`]); + (DISCH_TAC); + + (NEW_GOAL `~(u'' = &0)`); + (STRIP_TAC); + (NEW_GOAL `a = y:real^3`); + (REWRITE_TAC[ASSUME `a = u'' % s + v'' % (y:real^3)`]); + (REWRITE_WITH `u'' = &0 /\ v'' = &1`); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (NEW_GOAL `dist (y, u0:real^3) < sqrt (&2)`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[GSYM (ASSUME `a = y:real^3`)]); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `v = &0`); + (MP_TAC (GSYM (ASSUME `&0 = u'' * v`))); + (REWRITE_TAC[REAL_ENTIRE]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `a = s:real^3`); + (REWRITE_TAC[ASSUME `s = u % a + v % (b:real^3)`]); + (REWRITE_WITH `u = &1 /\ v = &0`); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (NEW_GOAL `dist (u0:real^3, s) < sqrt (&2)`); + (REWRITE_TAC[GSYM (ASSUME `a = s:real^3`)]); + (ASM_MESON_TAC[]); + (NEW_GOAL `F`); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (DISCH_TAC); + (NEW_GOAL `dist (u0,a:real^3) >= sqrt (&2)`); + (REWRITE_TAC[(ASSUME `a = b:real^3`)]); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 47 *) +let CONVEX_HULL_4_IMP_2_2 = prove_by_refinement ( + `!a b c d p:real^3. + p IN convex hull {a,b,c,d} + ==> (?m n. between p (m,n) /\ between m (a,b) /\ between n (c,d))`, +[(REWRITE_TAC[CONVEX_HULL_4;IN;IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_CASES_TAC `u + v = &0`); + (NEW_GOAL `u = &0 /\ v = &0`); + (ASM_REAL_ARITH_TAC); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `p:real^3`); + (REWRITE_TAC[BETWEEN_REFL]); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM]); + (EXISTS_TAC `w:real` THEN EXISTS_TAC `z:real`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (ASM_CASES_TAC `w + z = &0`); + (NEW_GOAL `w = &0 /\ z = &0`); + (ASM_REAL_ARITH_TAC); + (EXISTS_TAC `p:real^3` THEN EXISTS_TAC `c:real^3`); + (REWRITE_TAC[BETWEEN_REFL]); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM]); + (EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (EXISTS_TAC `u/(u+v) % (a:real^3) + v /(u+v) % b`); + (EXISTS_TAC `w/(w+z) % (c:real^3) + z/(w+z) % d`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u + v` THEN EXISTS_TAC `w + z`); + (REPEAT STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH `x % (y/x % a + z/x % b) = (x/x) % (y %a + z % b)`]); + (REWRITE_WITH `(u+v)/(u+v) = &1 /\ (w+z)/(w+z) = &1`); + (STRIP_TAC); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (EXISTS_TAC `u / (u + v)` THEN EXISTS_TAC `v / (u + v)`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `u /(u + v) + v / (u + v) = (u+v)/(u+v)`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `w / (w + z)` THEN EXISTS_TAC `z / (w + z)`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `u /(u + v) + v / (u + v) = (u+v)/(u+v)`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[])]);; + +let MXI_EXPLICIT_OLD = prove_by_refinement( + `!V ul. packing V /\ saturated V /\ barV V 3 ul /\ ul = [u0;u1;u2;u3] /\ + hl (truncate_simplex 2 ul) < sqrt (&2) /\ sqrt (&2) <= hl ul + ==> (?s. between s (omega_list_n V ul 2, omega_list_n V ul 3) /\ + dist (u0, s) = sqrt (&2) /\ + mxi V ul = s)`, + [MESON_TAC[MXI_EXPLICIT]]);; + +(* ======================================================================= *) +(* Lemma 48 *) +let proj_point = new_definition +`!e x. proj_point e x = x - projection e x`;; + +let projection_proj_point = prove_by_refinement ( + `!e x. projection e x = x - proj_point e x`, +[ REWRITE_TAC[proj_point] THEN VECTOR_ARITH_TAC]);; + +let PRO_EXP = prove_by_refinement( + `!e x. proj_point e x = (x dot e) / (e dot e) % e`, +[REWRITE_TAC[projection;proj_point] THEN VECTOR_ARITH_TAC]);; + +(* ======================================================================= *) +(* Lemma 49 *) +let BETWEEN_PROJ_POINT = prove_by_refinement ( + `!a b x e. between x (a,b) ==> + between (proj_point e x) (proj_point e a, proj_point e b)`, +[(REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2;IN;IN_ELIM_THM; PRO_EXP]); + (REPEAT STRIP_TAC THEN EXISTS_TAC `u:real` THEN EXISTS_TAC `v:real`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; + VECTOR_ARITH `x % a = m % a + n % a <=> (x -m - n) % a = vec 0`; + REAL_ARITH `a / x - u * b / x - v * c / x = (a - u*b - v*c) / x`]); + (REWRITE_TAC[VECTOR_ARITH + `(u % a + v % b) dot e - u * (a dot e) - v * (b dot e) = &0`]); + (REWRITE_TAC[REAL_ARITH `&0/a = &0`]); + (VECTOR_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 50 *) +let PARALLEL_PROJECTION = prove_by_refinement ( + `!x y a:real^N b. between x (a, y) /\ ~(a = b) + ==> (?k. k <= &1 /\ &0 <= k /\ + projection (b - a) (x - a) = k % projection (b - a) (y - a))`, +[(REWRITE_TAC[projection; BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM] + THEN REPEAT STRIP_TAC); + (NEW_GOAL `(x - a) = v % (y - a:real^N)`); + (REWRITE_WITH `x - a:real^N = (u % a + v % y) - (u + v) % a`); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (VECTOR_ARITH_TAC); + (ASM_CASES_TAC `((y - a:real^N) dot (b - a) = &0)`); + (EXISTS_TAC `v:real`); + (REPEAT STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[DOT_LMUL;REAL_MUL_RZERO;Collect_geom.REAL_DIV_LZERO; + VECTOR_MUL_LZERO; VECTOR_SUB_RZERO]); + (EXISTS_TAC `((x - a) dot (b - a)) / ((y - a) dot (b - a:real^N))`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[DOT_LMUL; REAL_ARITH `(a * b) / c = a * (b / c)`]); + (REWRITE_WITH `((y - a) dot (b - a)) / ((y - a) dot (b - a:real^N)) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[DOT_LMUL; REAL_ARITH `(a * b) / c = a * (b / c)`]); + (REWRITE_WITH `((y - a) dot (b - a)) / ((y - a) dot (b - a:real^N)) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `((x - a) dot (b - a)) / ((y - a) dot (b - a:real^N)) % + ((y - a):real^N - ((y - a) dot (b - a)) / ((b - a) dot (b - a)) % + (b - a:real^N)) = + &1 / ((y - a) dot (b - a)) % + ((x - a) dot (b - a)) % (((y - a) - ((y - a) dot (b - a)) / ((b - a) dot + (b - a)) % (b - a)))`); + (VECTOR_ARITH_TAC); + (MATCH_MP_TAC Trigonometry2.VECTOR_MUL_R_TO_L); + (REPEAT STRIP_TAC); + (ASM_MESON_TAC[]); + (ABBREV_TAC `m = (y - a) dot (b - a:real^N)`); + (ABBREV_TAC `n = (x - a) dot (b - a:real^N)`); + (ABBREV_TAC `p = (b - a) dot (b - a:real^N)`); + (REWRITE_TAC[VECTOR_ARITH + `m % (x - n / p % (b - a)) = n % (y - m / p % (b - a)) <=> m % x = n % y`]); + (EXPAND_TAC "m" THEN EXPAND_TAC "n"); + (REWRITE_TAC[ASSUME `x - a = v % (y - a:real^N)`; VECTOR_MUL_ASSOC]); + (AP_THM_TAC THEN AP_TERM_TAC); + (VECTOR_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 51 *) +let NORM_PROJECTION_LE = prove_by_refinement( + `!x y a:real^N b. between x (a, y) /\ ~(a = b) + ==> norm (projection (b - a) (x - a)) <= norm (projection (b - a) (y - a))`, +[(REPEAT GEN_TAC THEN DISCH_TAC); + (SUBGOAL_THEN + `(?k. k <= &1 /\ &0 <= k /\ + projection (b - a) (x - a:real^N) = k % projection (b - a) (y - a))` + CHOOSE_TAC); + (ASM_SIMP_TAC[PARALLEL_PROJECTION]); + (ASM_REWRITE_TAC[NORM_MUL]); + (REWRITE_WITH `abs k = k`); + (ASM_SIMP_TAC[REAL_ABS_REFL]); + (REWRITE_TAC[REAL_ARITH `a * b <= b <=> &0 <= (&1 - a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[NORM_POS_LE])]);; + +(* ======================================================================= *) +(* Lemma 52 *) +let OMEGA_LIST_TRUNCATE_1_NEW1 = prove_by_refinement ( + `!V u0:real^3 u1 u2 u3. + omega_list_n V [u0;u1;u2] 1 = omega_list V [u0;u1] `, +[ (REPEAT GEN_TAC); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH [u0:real^3;u1] - 1 = 1`); + (REWRITE_TAC[LENGTH; ARITH_RULE `SUC (SUC 0) - 1 = 1`]); + (REWRITE_TAC[ARITH_RULE `1 = SUC 0`; OMEGA_LIST_N]); + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`;TRUNCATE_SIMPLEX_EXPLICIT_1;HD])]);; + +let OMEGA_LIST_TRUNCATE_1_NEW2 = prove_by_refinement ( + `!V u0:real^3 u1 u2 u3. + omega_list_n V [u0;u1] 1 = omega_list V [u0;u1] `, +[ (REPEAT GEN_TAC); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH [u0:real^3;u1] - 1 = 1`); + (REWRITE_TAC[LENGTH; ARITH_RULE `SUC (SUC 0) - 1 = 1`])]);; + +let OMEGA_LIST_TRUNCATE_2_NEW1 = prove_by_refinement ( + `!V u0:real^3 u1 u2 u3. + omega_list_n V [u0;u1;u2:real^3] 2 = omega_list V [u0;u1;u2]`, +[(REPEAT GEN_TAC); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH [u0:real^3;u1;u2] - 1 = 2`); + (REWRITE_TAC[LENGTH; ARITH_RULE `SUC (SUC (SUC 0)) - 1 = 2`])]);; + +(* ======================================================================= *) +(* Lemma 53 *) +let IN_AFFINE_KY_LEMMA1 = prove_by_refinement ( + `!x s. x IN s ==> x IN affine hull s`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[affine;hull;IN_INTERS]); + (REWRITE_TAC[IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN SWITCH_TAC THEN UP_ASM_TAC THEN SET_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 54 *) +let AFFINE_SUBSET_KY_LEMMA = prove_by_refinement ( +`!S B:real^N ->bool. S SUBSET B ==> affine hull S SUBSET affine hull B`, +[(REWRITE_TAC[SUBSET;AFFINE_HULL_EXPLICIT; IN;IN_ELIM_THM] THEN + REPEAT STRIP_TAC); + (EXISTS_TAC `s:real^N->bool`); + (EXISTS_TAC `u:real^N->real`); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 55 *) +let TRANSLATE_AFFINE_KY_LEMMA1 = prove_by_refinement( + `!a:real^3 b c x y z k. + a IN affine hull {x,y,z} /\ + b IN affine hull {x,y,z} /\ + c IN affine hull {x,y,z} + ==> a + k % (b - c) IN affine hull {x,y,z}`, +[(REWRITE_TAC[AFFINE_HULL_3;IN;IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `u + k * (u' - u'')`); + (EXISTS_TAC `v + k * (v' - v'')`); + (EXISTS_TAC `w + k * (w' - w'')`); + (STRIP_TAC); + (REWRITE_WITH + `(u + k * (u' - u'')) + (v + k * (v' - v'')) + w + k * (w' - w'') = + (u + v + w) + k * (u' + v' + w') - k * (u'' + v'' + w'')`); + (REAL_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_SUB_REFL;REAL_ADD_RID]); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 56 *) +let IN_AFFINE_HULL_KY_LEMMA3 = prove_by_refinement ( + `!x:real^3 y z p a r. + p + a IN affine hull {x,y,z} /\ + p + r % a IN affine hull {x,y,z} /\ + ~(r = &1) + ==> p IN affine hull {x,y,z}`, +[(REWRITE_TAC[AFFINE_HULL_3;IN;IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `u + (u' - u) / (&1 - r)`); + (EXISTS_TAC `v + (v' - v) / (&1 - r)`); + (EXISTS_TAC `w + (w' - w) / (&1 - r)`); + (STRIP_TAC); + (REWRITE_TAC [REAL_ARITH + `(u + (u' - u) / (&1 - r)) + (v + (v' - v) / (&1 - r)) + + w + (w' - w) / (&1 - r) + = (u + v + w) + ((u' + v' + w') - (u + v + w))/ (&1 - r)`]); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (REWRITE_WITH +`(u + (u' - u) / (&1 - r)) % (x:real^3) + + (v + (v' - v) / (&1 - r)) % y + + (w + (w' - w) / (&1 - r)) % z = + (p + a) - (&1/(&1 - r)) % ((p + a) - (p + r % a))`); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH + `p = (p + a) - &1 / (&1 - r) % ((p + a) - (p + r % a)) + <=> ((&1 - r) / (&1 - r) - &1) % a = vec 0`]); + (REWRITE_WITH `(&1 - r) / (&1 - r) = &1`); + + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_SUB_REFL;VECTOR_MUL_LZERO])]);; + +let IN_AFFINE_HULL_KY_LEMMA3_alt = prove_by_refinement ( + `!x:real^3 y z p a r. + p - a IN affine hull {x, y, z} /\ + p - r % a IN affine hull {x, y, z} /\ + ~(r = &1) + ==> p IN affine hull {x, y, z}`, +[(REWRITE_TAC[VECTOR_ARITH `p - a:real^3 = p + (-- a)`; + VECTOR_ARITH `--(r % a) = r % (-- a)`]); + (REWRITE_TAC[IN_AFFINE_HULL_KY_LEMMA3])]);; + +(* ======================================================================= *) +(* Lemma 57 *) +let IN_AFFINE_HULL_3_KY_LEMMA2 = prove_by_refinement ( + `!X Y Z a b c. X IN affine hull {a,b,c} /\ + Y IN affine hull {a,b,c} /\ + between Z (X,Y) + ==> Z IN affine hull {a,b,c:real^3}`, +[(REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2; + AFFINE_HULL_3;IN;IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `u'' * u + v'' * u'`); + (EXISTS_TAC `u'' * v + v'' * v'`); + (EXISTS_TAC `u'' * w + v'' * w'`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH + `(a * x + b * x') + (a * y + b * y') + (a * z + b * z') = + a * (x + y + z) + b * (x' + y' + z')`]); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 58 *) +let SUM_CLAUSES_alt = prove (`(!x f s. + FINITE s + ==> sum (x INSERT s) f = + (if x IN s then sum s f else f x + sum s f))`, REWRITE_TAC[SUM_CLAUSES]);; + +let SUM_DIS4 = prove_by_refinement ( + `!x:A y z t f. CARD {x,y, z, t} = 4 + ==> sum {x,y,z,t} f = f x + f y + f z + f t`, +[(REPEAT STRIP_TAC); + (REWRITE_WITH `sum {x,y, z, t} f = + (if x IN {y, z, t:A} then sum {y, z, t} f + else f x + sum {y, z, t} f)`); + (MATCH_MP_TAC SUM_CLAUSES_alt); + (REWRITE_TAC[Geomdetail.FINITE6]);(COND_CASES_TAC);(NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC + [SET_RULE `x IN {a,b,c} <=> x = a \/ x = b \/ x = c`]); + (REPEAT STRIP_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC + [SET_RULE `{y,y,z,t} = {y,z,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {y, z, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC + [SET_RULE `{z,y,z,t} = {y,z,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {y, z, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC + [SET_RULE `{t,y,z,t} = {y,z,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {y, z, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (REWRITE_WITH `sum {y, z, t} f = + (if y IN {z, t:A} then sum {z, t} f + else f y + sum {z, t} f)`); + (MATCH_MP_TAC SUM_CLAUSES_alt); + (REWRITE_TAC[Geomdetail.FINITE6]); + SWITCH_TAC; + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[SET_RULE `x IN {a,b} <=> x = a \/ x = b`]); + (REPEAT STRIP_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[SET_RULE `{x,z,z,t} = {x,z,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {x, z, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[SET_RULE `{x,t,z,t} = {x,z,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {x, z, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + SWITCH_TAC; + (REWRITE_WITH `sum {z, t:A} f = f z + f t`); + (MATCH_MP_TAC Collect_geom.SUM_DIS2 THEN STRIP_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[SET_RULE `{x,y,t,t} = {x,y,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {x, y, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 59 *) +let CARD4_IMP_DISTINCT = prove ( + `!a b c d. CARD {a, b, c, d} = 4 ==> ~(a = b)`, + (REPEAT STRIP_TAC THEN SWITCH_TAC THEN UP_ASM_TAC THEN + ASM_REWRITE_TAC[SET_RULE `{a,a,c,d} = {a,c,d}`] THEN STRIP_TAC) THEN + (ASM_MESON_TAC[Geomdetail.CARD3; ARITH_RULE `~(4 <= 3)`]));; + +(* ======================================================================= *) +(* Lemma 60 *) +let VSUM_CLAUSES_alt = prove (`(!x f s. + FINITE s + ==> vsum (x INSERT s) f = + (if x IN s then vsum s f else f x + vsum s f))`, REWRITE_TAC[VSUM_CLAUSES]);; +let VSUM_DIS4 = prove_by_refinement ( + `!x:A y z t (f:A->real^N). CARD {x,y, z, t} = 4 + ==> vsum {x,y,z,t} f = f x + f y + f z + f t`, +[(REPEAT STRIP_TAC); + (REWRITE_WITH `vsum {x,y, z, t} (f:A->real^N) = + (if x IN {y, z, t:A} then vsum {y, z, t} f + else f x + vsum {y, z, t} f)`); + (MATCH_MP_TAC VSUM_CLAUSES_alt); + (REWRITE_TAC[Geomdetail.FINITE6]);(COND_CASES_TAC);(NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC + [SET_RULE `x IN {a,b,c} <=> x = a \/ x = b \/ x = c`]); + (REPEAT STRIP_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC + [SET_RULE `{y,y,z,t} = {y,z,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {y, z, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC + [SET_RULE `{z,y,z,t} = {y,z,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {y, z, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC + [SET_RULE `{t,y,z,t} = {y,z,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {y, z, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (REWRITE_WITH `vsum {y, z, t} (f:A->real^N) = + (if y IN {z, t:A} then vsum {z, t} f + else f y + vsum {z, t} f)`); + (MATCH_MP_TAC VSUM_CLAUSES_alt); + (REWRITE_TAC[Geomdetail.FINITE6]); + SWITCH_TAC; + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[SET_RULE `x IN {a,b} <=> x = a \/ x = b`]); + (REPEAT STRIP_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[SET_RULE `{x,z,z,t} = {x,z,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {x, z, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[SET_RULE `{x,t,z,t} = {x,z,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {x, z, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + SWITCH_TAC; + (REWRITE_WITH `vsum {z, t:A} (f:A->real^N) = f z + f t`); + (MATCH_MP_TAC Collect_geom.VSUM_DIS2 THEN STRIP_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[SET_RULE `{x,y,t,t} = {x,y,t}`] THEN STRIP_TAC); + (NEW_GOAL `CARD {x, y, t:A} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 61 *) +let AFFINE_DEPENDENT_KY_LEMMA1 = prove_by_refinement ( + `!a:real^3 b c d p:real^3 k1 k2 k3 k4. + ~(affine_dependent {a,b,c,d}) /\ + CARD {a,b,c,d} = 4 /\ + p IN convex hull {a,b,c,d} /\ + k1 + k2 + k3 + k4 = &1 /\ + p = k1 % a + k2 % b + k3 % c + k4 % d /\ + k1 <= &0 ==> k1 = &0`, +[(REPEAT GEN_TAC); + (REWRITE_TAC[CONVEX_HULL_4; IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `k1 = &0`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (NEW_GOAL `affine_dependent {a,b,c,d:real^3}`); + (REWRITE_TAC[AFFINE_DEPENDENT_EXPLICIT]); + (EXISTS_TAC `{a,b,c,d:real^3}`); + (ABBREV_TAC `f = (\x:real^3. if x = a then u - k1 else + if x = b then v - k2 else + if x = c then w - k3 else + if x = d then z - k4 else &0)`); + (EXISTS_TAC `f:real^3->real`); + + (NEW_GOAL `f (a:real^3) = u - k1`); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `f (b:real^3) = v - k2`); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (NEW_GOAL `F` THEN UP_ASM_TAC THEN REWRITE_TAC[]); + (MATCH_MP_TAC CARD4_IMP_DISTINCT); + (EXISTS_TAC `c:real^3` THEN EXISTS_TAC `d:real^3`); + (ASM_REWRITE_TAC[SET_RULE `{a,b,c,d} = {b,a,c,d}`]); + (COND_CASES_TAC); + (REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `f (c:real^3) = w - k3`); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (NEW_GOAL `F` THEN UP_ASM_TAC THEN REWRITE_TAC[]); + (MATCH_MP_TAC CARD4_IMP_DISTINCT); + (EXISTS_TAC `b:real^3` THEN EXISTS_TAC `d:real^3`); + (ASM_REWRITE_TAC[SET_RULE `{c,a,b,d} = {a,b,c,d}`]); + (COND_CASES_TAC); + (NEW_GOAL `F` THEN UP_ASM_TAC THEN REWRITE_TAC[]); + (MATCH_MP_TAC CARD4_IMP_DISTINCT); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `d:real^3`); + (ASM_REWRITE_TAC[SET_RULE `{c,b,a,d} = {a,b,c,d}`]); + (COND_CASES_TAC); + (REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `f (d:real^3) = z - k4`); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (NEW_GOAL `F` THEN UP_ASM_TAC THEN REWRITE_TAC[]); + (MATCH_MP_TAC CARD4_IMP_DISTINCT); + (EXISTS_TAC `c:real^3` THEN EXISTS_TAC `b:real^3`); + (ASM_REWRITE_TAC[SET_RULE `{d,a,c, b} = {a,b,c,d}`]); + (COND_CASES_TAC); + (NEW_GOAL `F` THEN UP_ASM_TAC THEN REWRITE_TAC[]); + (MATCH_MP_TAC CARD4_IMP_DISTINCT); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `c:real^3`); + (ASM_REWRITE_TAC[SET_RULE `{d,b,a,c} = {a,b,c,d}`]); + (COND_CASES_TAC); + (NEW_GOAL `F` THEN UP_ASM_TAC THEN REWRITE_TAC[]); + (MATCH_MP_TAC CARD4_IMP_DISTINCT); + (EXISTS_TAC `a:real^3` THEN EXISTS_TAC `b:real^3`); + (ASM_REWRITE_TAC[SET_RULE `{d,c,a,b} = {a,b,c,d}`]); + (COND_CASES_TAC); + (REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (REPEAT STRIP_TAC); + (REWRITE_TAC[Geomdetail.FINITE6]); + (SET_TAC[]); + + (REWRITE_WITH `sum {a, b, c, d:real^3} f = f a + f b + f c + f d`); + (MATCH_MP_TAC SUM_DIS4); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH + `a - x + b - y + c - z + d - t = (a + b + c + d) - (x + y + z + t)`]); + (ASM_REWRITE_TAC[REAL_SUB_REFL]); + (EXISTS_TAC `a:real^3`); + (STRIP_TAC); + (SET_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (REWRITE_WITH `vsum {a, b, c, d:real^3} (\v. f v % v) = + (\v. f v % v) a + (\v. f v % v) b + (\v. f v % v) c + (\v. f v % v) d`); + (MATCH_MP_TAC VSUM_DIS4); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_ARITH ` + (u - k1) % a + (v - k2) % b + (w - k3) % c + (z - k4) % d = + (u % a + v % b + w % c + z % d) - (k1 % a + k2 % b + k3 % c + k4 % d)`]); + (ASM_MESON_TAC[VECTOR_ARITH `a:real^N - a = vec 0`]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 62 *) +let IN_2_2_IMP_CONVEX_HULL_4 = prove ( + `!a:real^N b x y m n p. + between p (m,n) /\ between m (a,b) /\ between n (x,y) + ==> p IN convex hull {a, b, x, y}`, + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;CONVEX_HULL_4; + IN;IN_ELIM_THM] THEN REPEAT STRIP_TAC) THEN + (ASM_REWRITE_TAC[]) THEN + (EXISTS_TAC `u * u'` THEN EXISTS_TAC `u * v'`) THEN + (EXISTS_TAC `v * u''` THEN EXISTS_TAC `v * v''`) THEN + (ASM_SIMP_TAC[REAL_LE_MUL; REAL_ARITH `a * x + a * y + b * z + b * t = + a * (x + y) + b * (z + t)`; REAL_MUL_RID]) THEN + (VECTOR_ARITH_TAC));; + +(* ======================================================================= *) +(* Lemma 63 *) +let BETWEEN_TRANS_3_CASES = prove_by_refinement ( + `!a b x y:real^3. between x (a,b) /\ between y (a,b) ==> + between x (a, y) \/ between x (y, b) `, +[(REPEAT STRIP_TAC); + (ASM_CASES_TAC `(a = b:real^3)`); + (UNDISCH_TAC `between x (a,b:real^3)`); + (UNDISCH_TAC `between y (a,b:real^3)`); + (ASM_REWRITE_TAC[BETWEEN_REFL_EQ]); + (REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[BETWEEN_REFL_EQ]); + + (ASM_CASES_TAC `between x (a,y:real^3)`); + (ASM_MESON_TAC[]); + (DISJ2_TAC); + (ONCE_REWRITE_TAC[BETWEEN_SYM]); + (MATCH_MP_TAC BETWEEN_TRANS_2); + (EXISTS_TAC `a:real^3` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `collinear {a,y,x:real^3}`); + (ONCE_REWRITE_TAC[SET_RULE `{a,y,x} = {x, a ,y}`]); + (MATCH_MP_TAC COLLINEAR_3_TRANS); + (EXISTS_TAC `b:real^3`); + (REPEAT STRIP_TAC); + (ONCE_REWRITE_TAC[SET_RULE `{x,a, b} = {a, x, b}`]); + (MATCH_MP_TAC BETWEEN_IMP_COLLINEAR); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a, b,y} = {a, y, b}`]); + (MATCH_MP_TAC BETWEEN_IMP_COLLINEAR); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[COLLINEAR_BETWEEN_CASES]); + + (ASM_CASES_TAC `between y (x,a:real^3)`); + (STRIP_TAC THEN ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[MESON[] `(A\/B\/C ==> B) <=> (C\/A ==> B)`]); + (REPEAT STRIP_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `x = y:real^3`); + (REWRITE_TAC[ASSUME `x = y:real^3`; BETWEEN_REFL]); + + (NEW_GOAL `F`); + (UNDISCH_TAC `between x (a,b:real^3)` THEN + UNDISCH_TAC `between y (a,b:real^3)` THEN + UNDISCH_TAC `between a (y,x:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (MP_TAC (ASSUME `a = u % y + v % x:real^3`)); + (REWRITE_TAC[ASSUME `y = u' % a + v' % b:real^3`; + ASSUME `x = u'' % a + v'' % b:real^3`]); + + (REWRITE_WITH `v' = &1 - u' /\ v = &1 - u /\ v'' = &1 - u''`); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC [VECTOR_ARITH ` + a = u % (u' % a + (&1 - u') % b) + (&1 - u) % (u'' % a + (&1 - u'') % b) + <=> (&1 - u * u' - (&1 - u) * u'') % (a - b) = vec 0`]); + (REWRITE_TAC[VECTOR_MUL_EQ_0]); + (ASM_REWRITE_TAC[VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (REWRITE_TAC[REAL_ARITH + `&1 - u * u' - (&1 - u) * u'' = u * (&1 - u') + (&1 - u) * (&1 - u'')`]); + (NEW_GOAL `&0 <= u * (&1 - u')`); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `&0 <= (&1 - u) * (&1 - u'')`); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (STRIP_TAC); + (NEW_GOAL `u * (&1 - u') = &0 /\ (&1 - u) * (&1 - u'') = &0`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ENTIRE]); + (REPEAT STRIP_TAC); + (ASM_REAL_ARITH_TAC); + + (UNDISCH_TAC `~between x (a,y:real^3)`); + (REWRITE_TAC[ASSUME `x = u'' % a + v'' % b:real^3`]); + (REWRITE_WITH `u'' = &1 /\ v'' = &0`); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO;VECTOR_ADD_RID; BETWEEN_REFL]); + + (UNDISCH_TAC `~between y (x,a:real^3)`); + (REWRITE_TAC[ASSUME `y = u' % a + v' % b:real^3`]); + (REWRITE_WITH `u' = &1 /\ v' = &0`); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO;VECTOR_ADD_RID; BETWEEN_REFL]); + + (UNDISCH_TAC `~between y (x,a:real^3)`); + (REWRITE_TAC[ASSUME `y = u' % a + v' % b:real^3`]); + (REWRITE_WITH `u' = &1 /\ v' = &0`); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO;VECTOR_ADD_RID; BETWEEN_REFL]); + (ASM_MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 64 *) + +let OMEGA_LIST_UP_TO_2 = prove_by_refinement ( + `! V ul. {omega_list_n V ul i | i <= 2} = + {omega_list_n V ul 0, omega_list_n V ul 1, omega_list_n V ul 2}`, +[(REPEAT GEN_TAC); + (REWRITE_WITH `{omega_list_n V ul i | i <= 2} = + IMAGE (omega_list_n V ul) {i| i <= 2}`); + (REWRITE_TAC[IMAGE] THEN SET_TAC[]); + (REWRITE_WITH ` + {omega_list_n V ul 0, omega_list_n V ul 1, omega_list_n V ul 2} + = IMAGE (omega_list_n V ul) {0,1,2}`); + (REWRITE_TAC[IMAGE] THEN SET_TAC[]); + (AP_TERM_TAC); + (REWRITE_TAC[SET_OF_0_TO_2])]);; + +(* ======================================================================= *) +(* Lemma 65 *) +let CONVEX_HULL_KY_LEMMA_5 = prove_by_refinement ( + `!a:real^3 b c d x y d p. + ~(affine_dependent {a,b,c,d}) /\ CARD {a,b,c,d} = 4 /\ ~(d = x) /\ + x IN convex hull {a,b,c} /\ between d (x,y) /\ + ~( p IN affine hull {a,b,d}) /\ + p IN convex hull {a,b,c,d} INTER convex hull {a,b,x,y} ==> + p IN convex hull {a,b,x,d}`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `p IN convex hull {a, b, x, y:real^3}`); + (ASM_SET_TAC[IN_INTER]); + (SUBGOAL_THEN `?m n:real^3. + between p (m,n) /\ between m (a,b) /\ between n (x,y)` CHOOSE_TAC); + (ASM_SIMP_TAC[CONVEX_HULL_4_IMP_2_2]); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + + (ASM_CASES_TAC `between n (x, d:real^3)`); + (MATCH_MP_TAC IN_2_2_IMP_CONVEX_HULL_4); + (EXISTS_TAC `m:real^3` THEN EXISTS_TAC `n:real^3`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `between n (x,d) \/ between n (d, y:real^3)`); + (MATCH_MP_TAC BETWEEN_TRANS_3_CASES); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `between n (d,y:real^3)`); + (ASM_MESON_TAC[]); + + (NEW_GOAL `?k1 k2. n = k1 % d + k2 % x:real^3 /\ k1 + k2 = &1 /\ k2 <= &0`); + (UP_ASM_TAC THEN UNDISCH_TAC `between d (x,y:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;IN;IN_ELIM_THM;CONVEX_HULL_2]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `u' + (v'/ v)`); + (EXISTS_TAC `-- ((u * v')/ v)`); + (REPEAT STRIP_TAC); + + (REWRITE_TAC[VECTOR_ARITH + `u' % (u % x + v % y) + v' % y = + (u' + v' / v) % (u % x + v % y) + --((u * v') / v) % x + <=> ((v /v - &1) * v') % y = vec 0`]); + (REWRITE_WITH `v / v = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (STRIP_TAC); + (NEW_GOAL `d = x:real^3`); + (REWRITE_TAC[ASSUME `d = u % x + v % y:real^3`]); + (REWRITE_WITH `v = &0 /\ u = &1`); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (ASM_MESON_TAC[]); + (VECTOR_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH `(u' + v' / v) + --((u * v') / v) = + u' + v' * ((&1 - u) / v)`]); + (REWRITE_WITH `(&1 - u) / v = &1`); + (REWRITE_WITH `&1 - u = v`); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_DIV_REFL); + (STRIP_TAC); + (NEW_GOAL `d = x:real^3`); + (REWRITE_TAC[ASSUME `d = u % x + v % y:real^3`]); + (REWRITE_WITH `v = &0 /\ u = &1`); + (ASM_REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `-- a <= &0 <=> &0 <= a`]); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_SIMP_TAC[REAL_LE_MUL]); + (FIRST_X_ASSUM CHOOSE_TAC THEN FIRST_X_ASSUM CHOOSE_TAC); + + (UNDISCH_TAC `between p (m,n:real^3)`); + (UNDISCH_TAC `between m (a,b:real^3)`); + (UNDISCH_TAC `x IN convex hull {a,b,c:real^3}`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL;CONVEX_HULL_2; + CONVEX_HULL_3;IN;IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[VECTOR_ADD_LDISTRIB;VECTOR_MUL_ASSOC]); + (REWRITE_TAC[VECTOR_ARITH + `(x % a + y % b) + z % d + x' % a + y' % b + z' % c = + z' % c + (x + x') % a + (y + y') % b + z % d`]); + + (REPEAT STRIP_TAC); + + (NEW_GOAL `v'' * k2 * w = &0`); + (MATCH_MP_TAC AFFINE_DEPENDENT_KY_LEMMA1); + (EXISTS_TAC `c:real^3` THEN EXISTS_TAC `a:real^3`); + (EXISTS_TAC `b:real^3` THEN EXISTS_TAC `d:real^3`); + (EXISTS_TAC `p:real^3`); + (EXISTS_TAC `u'' * u' + v'' * k2 * u` THEN + EXISTS_TAC `u'' * v' + v'' * k2 * v` THEN + EXISTS_TAC `v'' * k1`); + (STRIP_TAC); + (ONCE_REWRITE_TAC[SET_RULE `{c,a,b,d} = {a,b,c,d}`]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ONCE_REWRITE_TAC[SET_RULE `{c,a,b,d} = {a,b,c,d}`]); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{c,a,b,d} = {a,b,c,d}`]); + (ASM_SET_TAC[IN_INTER]); + (REWRITE_TAC[REAL_ARITH + `v'' * k2 * w + (u'' * u' + v'' * k2 * u) + + (u'' * v' + v'' * k2 * v) + v'' * k1 + = u'' * (u' + v') + v'' * (k1 + k2 * (u + v + w))`]); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `a * b * c <= &0 <=> &0 <= a * (-- b) * c`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `p IN affine hull {a,b,d:real^3}`); + (REWRITE_TAC[AFFINE_HULL_3;IN;IN_ELIM_THM]); + (EXISTS_TAC `u'' * u' + v'' * k2 * u` THEN + EXISTS_TAC `u'' * v' + v'' * k2 * v` THEN + EXISTS_TAC `v'' * k1`); + (STRIP_TAC); + (REWRITE_WITH `(u'' * u' + v'' * k2 * u) + (u'' * v' + v'' * k2 * v) + + v'' * k1 = u'' * (u' + v') + v'' * (k1 + k2 * (u + v + w)) - (v'' * k2 * w)`); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_MUL_RID]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[])]);; + +(* ======================================================================= *) +(* Lemma 66 *) +let KY_PERMUTES_2_PERMUTES_3 = prove (`!p. p permutes 0..2 ==> p permutes 0..3`, + (GEN_TAC THEN REWRITE_TAC[permutes]) THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN FIRST_ASSUM MATCH_MP_TAC + THEN UP_ASM_TAC THEN REWRITE_TAC[IN_NUMSEG] THEN ARITH_TAC);; + +(* ======================================================================= *) +(* Lemma 67 *) + +let TABLE_4 = prove ( + `!f. TABLE f 4 = [f 0; f 1; f 2; f 3] /\ + TABLE f 3 = [f 0; f 1; f 2] /\ + TABLE f 2 = [f 0; f 1] /\ + TABLE f 1 = [f 0] /\ + TABLE f 0 = []`, + REWRITE_TAC[TABLE;REVERSE_TABLE; ARITH_RULE + `4 = SUC 3 /\ 3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; REVERSE; APPEND]);; + +(* ======================================================================= *) +(* Lemma 68 *) +let MEM_LEFT_ACTION_LIST_2 = prove_by_refinement ( + `!(ul:(A)list) p x. + 2 <= LENGTH ul /\ p permutes (0..LENGTH ul - 2) + ==> (MEM x (left_action_list p ul) <=> MEM x ul)`, +[(REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[MEM_EXISTS_EL; Packing3.LENGTH_LEFT_ACTION_LIST]); + (EQ_TAC); + (STRIP_TAC); + (POP_ASSUM MP_TAC); + (ASM_SIMP_TAC[left_action_list; Packing3.EL_TABLE]); + (DISCH_TAC); + (ASM_CASES_TAC `i < LENGTH (ul:(A)list) - 1`); + (EXISTS_TAC `inverse (p:num->num) i`); + (REWRITE_TAC[]); + (ABBREV_TAC `n = LENGTH (ul:(A)list) - 1`); + (MP_TAC (ISPECL [`p:num->num`; `0..n-1`] PERMUTES_INVERSE)); + (ASM_REWRITE_TAC[] THEN DISCH_TAC); + (UNDISCH_TAC `p permutes 0..LENGTH (ul:(A)list) - 2`); + (REWRITE_WITH `LENGTH (ul:(A)list) - 2 = n -1`); + (ASM_ARITH_TAC); + (DISCH_TAC); + (NEW_GOAL `inverse p permutes 0..n - 1`); + (ASM_MESON_TAC[]); + + (MP_TAC (ISPECL [`inverse (p:num->num)`; `0..n-1`] Hypermap_and_fan.PERMUTES_IMP_INSIDE)); + (ASM_REWRITE_TAC[]); + (DISCH_THEN (MP_TAC o SPEC `i:num`)); + (ASM_SIMP_TAC[IN_NUMSEG; ARITH_RULE `i < n ==> i <= n - 1`; LE_0]); + (ASM_ARITH_TAC); + (NEW_GOAL `i = LENGTH (ul:(A)list) - 1`); + (ASM_ARITH_TAC); + (EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (ABBREV_TAC `n = LENGTH (ul:(A)list)`); + (NEW_GOAL `(inverse p) permutes 0..n-2`); + (ASM_MESON_TAC[PERMUTES_INVERSE]); + (UP_ASM_TAC THEN REWRITE_TAC[permutes]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `inverse p (n - 1) = n - 1`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN_NUMSEG_0]); + (ASM_ARITH_TAC); + + (STRIP_TAC); + (ASM_CASES_TAC `i < LENGTH (ul:(A)list) - 1`); + (EXISTS_TAC `(p:num->num) i`); + (NEW_GOAL `p (i:num) < LENGTH (ul:(A)list)`); + (UNDISCH_TAC `p permutes 0..LENGTH (ul:(A)list) - 2`); + (REWRITE_TAC[permutes]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `p (i:num) >= LENGTH (ul:(A)list)`); + (NEW_GOAL `p ((p:num->num) (i:num)) = p i`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN_NUMSEG_0]); + (ASM_ARITH_TAC); + (UNDISCH_TAC `!y. ?!x. (p:num->num) x = y`); + (REWRITE_TAC[EXISTS_UNIQUE]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?x. p x = (p:num->num) i /\ (!y'. p y' = p i ==> y' = x)`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `i = x':num`); + (FIRST_ASSUM MATCH_MP_TAC); + (REFL_TAC); + (NEW_GOAL `(p:num->num) i = x':num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_MESON_TAC[]); + (NEW_GOAL `i >= LENGTH (ul:(A)list)`); + (ASM_ARITH_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + (ASM_SIMP_TAC[left_action_list; Packing3.EL_TABLE]); + (REWRITE_WITH `inverse (p:num->num) (p i) = i`); + (ASM_MESON_TAC[PERMUTES_INVERSES]); + + (NEW_GOAL `i = LENGTH (ul:(A)list) - 1`); + (ASM_ARITH_TAC); + (EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (ABBREV_TAC `n = LENGTH (ul:(A)list)`); + (NEW_GOAL `n - 1 < n`); + (ASM_ARITH_TAC); + (ASM_SIMP_TAC[left_action_list; Packing3.EL_TABLE]); + (REWRITE_WITH `inverse (p:num->num) (n - 1) = n - 1`); + (NEW_GOAL `(inverse p) permutes 0..n-2`); + (ASM_MESON_TAC[PERMUTES_INVERSE]); + (UP_ASM_TAC THEN REWRITE_TAC[permutes]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN_NUMSEG_0]); + (ASM_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 69 *) +let SET_OF_LIST_LEFT_ACTION_LIST_2 = prove( + `!(ul:(A)list) p. 2 <= LENGTH ul /\ p permutes 0..LENGTH ul - 2 + ==> set_of_list (left_action_list p ul) = set_of_list ul`, + REPEAT STRIP_TAC THEN REWRITE_TAC[EXTENSION; IN_SET_OF_LIST] THEN + ASM_SIMP_TAC[MEM_LEFT_ACTION_LIST_2]);; + +(* ======================================================================= *) +(* Lemma 70 *) +let OMEGA_LIST_2_EXPLICIT_NEW = prove_by_refinement ( + `!a:real^3 b c d V ul. + saturated V /\ + packing V /\ + ul IN barV V 3 /\ + ul = [a; b; c; d] /\ + hl [a;b;c] < sqrt (&2) + ==> omega_list_n V ul 2 = circumcenter {a, b, c}`, +[(REPEAT STRIP_TAC); + (REWRITE_WITH `{a,b,c} = set_of_list [a; b; c:real^3]`); + (MESON_TAC[set_of_list]); + (REWRITE_WITH `circumcenter (set_of_list [a; b; c:real^3]) = omega_list V [a:real^3; b; c]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC XNHPWAB1); + (EXISTS_TAC `2`); + (MP_TAC (ASSUME `ul IN barV V 3`) THEN REWRITE_TAC[IN;BARV]); + + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[LENGTH;ARITH_RULE `SUC (SUC (SUC 0)) = 2 + 1`]); + (NEW_GOAL `initial_sublist vl (ul:(real^3)list)`); + (UNDISCH_TAC `initial_sublist vl [a:real^3; b; c]`); + (REWRITE_TAC[INITIAL_SUBLIST] THEN STRIP_TAC); + (EXISTS_TAC `APPEND yl [d:real^3]`); + (REWRITE_TAC[APPEND_ASSOC; GSYM (ASSUME `[a:real^3; b;c] = APPEND vl yl`)]); + (ASM_REWRITE_TAC[APPEND]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[OMEGA_LIST_TRUNCATE_2])]);; +(* ======================================================================= *) +(* Lemma 71 *) +let INTER_RCONE_GE_IMP_BETWEEN_PROJ_POINT = prove_by_refinement ( + `!a:real^3 b p r. + ~(a = b) /\ &0 <= r /\ p IN rcone_ge a b r INTER rcone_ge b a r ==> + between (proj_point (b - a) (p - a) + a) (a, b)`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[between;PRO_EXP] THEN ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[dist; VECTOR_ARITH `(k % x + a) - a = k % x /\ + m - (h % (m - n) + n) = (&1 - h) % (m - n)`]); + (ABBREV_TAC `h = ((p - a) dot (b - a)) / ((b - a) dot (b - a:real^3))`); + (REWRITE_TAC[NORM_MUL]); + (REWRITE_WITH `abs h = h /\ abs (&1 - h) = &1 - h`); + (REWRITE_TAC[REAL_ABS_REFL]); + (STRIP_TAC); + (EXPAND_TAC "h" THEN MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[GSYM NORM_POW_2; REAL_LE_POW_2]); + (SUBGOAL_THEN `p IN rcone_ge a (b:real^3) r` MP_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[rcone_ge;rconesgn;IN;IN_ELIM_THM]); + (STRIP_TAC); + (NEW_GOAL `&0 <= dist (p,a) * dist (b,a:real^3) * r`); + (ASM_SIMP_TAC[REAL_LE_MUL;DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (EXPAND_TAC "h" THEN REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (SUBGOAL_THEN `p IN rcone_ge b (a:real^3) r` MP_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[rcone_ge;rconesgn;IN;IN_ELIM_THM]); + (STRIP_TAC); + (REWRITE_WITH `((p - a) dot (b - a)) / ((b - a) dot (b - a)) <= &1 + <=> ((p - a) dot (b - a)) <= &1 * ((b - a) dot (b - a:real^3))`); + (MATCH_MP_TAC REAL_LE_LDIV_EQ); + (REWRITE_TAC[GSYM NORM_POW_2; GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT; + NORM_EQ_0; VECTOR_ARITH `b - a = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC [REAL_MUL_LID; REAL_ARITH `a <= b <=> ~(b < a)`]); + (STRIP_TAC); + (NEW_GOAL `(p - b) dot (a - b) + (p - a) dot (b - a) > + dist (p,b) * dist (a,b) * r + (b - a) dot (b - a:real^3)`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[VECTOR_ARITH `(p - b) dot (a - b) + (p - a) dot (b - a) = (b - a) dot (b - a)`; REAL_ARITH `~(x > y + x) <=> &0 <= y`]); + (ASM_SIMP_TAC[REAL_LE_MUL;DIST_POS_LE]); + (REAL_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 72 *) +let INTER_RCONE_GE_LT_lemma = prove_by_refinement ( + `!a:real^3 b p s h r. + ~(a = b) /\ s = midpoint (a, b) /\ &0 < r /\ ~(p = a) /\ ~(p = b) /\ + inv (&2) < r pow 2 /\ + between (proj_point (b - a) (p - a) + a) (a, s) /\ + p IN rcone_ge a b r INTER rcone_ge b a r ==> dist (s, p) < dist (s, a)`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `&0 <= r`); + (ASM_REAL_ARITH_TAC); + (ABBREV_TAC `p' = proj_point (b - a) (p - a) + a:real^3`); + (ABBREV_TAC `x = a + (dist (a, s) / dist (a, p':real^3)) % (p - a)`); + (NEW_GOAL `(p - a) dot (b - a:real^3) >= dist (p,a) * dist (b,a) * r`); + (SUBGOAL_THEN `p IN rcone_ge a (b:real^3) r` MP_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[rcone_ge;rconesgn;IN;IN_ELIM_THM]); + + (NEW_GOAL `between p (a, x:real^3)`); + (EXPAND_TAC "x" THEN REWRITE_TAC[between]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[dist; VECTOR_ARITH `(a + x) - a = x:real^3 /\ + ((a + k % (p - a) ) - p = (k - &1) % (p - a))`; NORM_MUL]); + (REWRITE_WITH `abs (norm (a - s) / norm (a - p':real^3)) = + norm (a - s) / norm (a - p')`); + (REWRITE_TAC[REAL_ABS_REFL]); + (SIMP_TAC[REAL_LE_DIV; NORM_POS_LE]); + (REWRITE_WITH `abs (norm (a - s) / norm (a - p':real^3) - &1) = + norm (a - s) / norm (a - p') - &1`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ONCE_REWRITE_TAC[NORM_ARITH `norm (a - b) = norm (b - a)`]); + (EXPAND_TAC "p'" THEN SIMP_TAC[VECTOR_ARITH `(k % s + a) - a = k % s`; + PRO_EXP; NORM_MUL;REAL_ABS_DIV; GSYM NORM_POW_2; REAL_LE_POW_2]); + (REWRITE_WITH `abs ((p - a) dot (b - a:real^3)) = (p - a) dot (b - a) /\ + abs (norm (b - a) pow 2) = norm (b - a) pow 2`); + (REWRITE_TAC[REAL_ABS_REFL; REAL_LE_POW_2]); + (NEW_GOAL `&0 <= dist (p,a) * dist (b,a:real^3) * r`); + (ASM_SIMP_TAC[REAL_LE_MUL;DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&0 <= x - &1 <=> &1 <= x`]); + (REWRITE_WITH `b = &2 % s - a:real^3`); + (ASM_REWRITE_TAC[midpoint] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `&2 % s - a - a = &2 % (s - a)`; NORM_MUL; + DOT_RMUL; MESON[REAL_ABS_REFL; REAL_ARITH `&0 <= &2`] `abs (&2) = &2`]); + (REWRITE_TAC[real_div; REAL_INV_MUL; REAL_INV_INV]); + + (REWRITE_TAC[REAL_ARITH `x * ((inv (&2) * inv (y)) * (&2 * x) pow 2) * + inv (&2) * inv (x) = (x * inv (x)) * (x pow 2) * inv (y)`]); + (REWRITE_WITH `norm (s - a:real^3) * inv (norm (s - a)) = &1`); + (MATCH_MP_TAC REAL_MUL_RINV); + (REWRITE_TAC[NORM_EQ_0]); + (ASM_REWRITE_TAC[midpoint; VECTOR_ARITH `inv (&2) % (a + b) - a = + inv (&2) % (b - a)`; VECTOR_MUL_EQ_0]); + (ASM_REWRITE_TAC[VECTOR_ARITH `b -a = vec 0 <=> a = b`]); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_MUL_LID; GSYM real_div]); + + + (NEW_GOAL `&0 < (p - a) dot (s - a:real^3)`); + (REWRITE_WITH `(p - a) dot (s - a:real^3) = inv (&2) * (p - a) dot (b - a)`); + (ASM_REWRITE_TAC[midpoint] THEN VECTOR_ARITH_TAC); + (MATCH_MP_TAC REAL_LT_MUL); + (REWRITE_TAC[REAL_ARITH `&0 < inv (&2)`]); + (NEW_GOAL `&0 < dist (p,a) * dist (b,a:real^3) * r`); + (ASM_SIMP_TAC[REAL_LT_MUL;DIST_POS_LT]); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `&1 <= norm (s - a) pow 2 / ((p - a) dot (s - a)) + <=> &1 * ((p - a) dot (s - a:real^3)) <= norm (s - a) pow 2 `); + (ASM_SIMP_TAC[REAL_LE_RDIV_EQ]); + (REWRITE_TAC[REAL_MUL_LID]); + (ONCE_REWRITE_TAC[VECTOR_ARITH `(p - a) dot (s - a) = + (p - a - (p' - a)) dot (s - a) + (p' - a) dot (s - a:real^3)`]); + (EXPAND_TAC "p'" THEN REWRITE_TAC[VECTOR_ARITH `(x + a) - a = x:real^3`]); + (REWRITE_TAC[GSYM projection_proj_point]); + (REWRITE_WITH `s - a:real^3 = inv (&2) % (b - a)`); + (ASM_REWRITE_TAC[midpoint] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_RMUL;Packing3.PROJECTION_ORTHOGONAL;REAL_MUL_RZERO; + REAL_ADD_LID]); + (REWRITE_WITH `proj_point (b - a) (p - a:real^3) = p' - a`); + (EXPAND_TAC "p'" THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `(p' - a) dot (b - a) = norm (p'- a) * norm (b - a:real^3)`); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ_EQ]); + (SUBGOAL_THEN `between p' (a, b:real^3)` MP_TAC); + (EXPAND_TAC "p'" THEN MATCH_MP_TAC INTER_RCONE_GE_IMP_BETWEEN_PROJ_POINT); + (EXISTS_TAC `r:real` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM REWRITE_ONLY_TAC); + (REWRITE_WITH `(u % a + v % b) - a = (u % a + v % b) - (u + v) % a:real^3`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (REWRITE_TAC[VECTOR_ARITH `(u % a + v % b) - (u + v) % a = v % (b - a)`; + NORM_MUL; VECTOR_MUL_ASSOC]); + (REWRITE_WITH `abs v = v`); + (ASM_SIMP_TAC[REAL_ABS_REFL]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `inv (&2) * norm (p' - a) * norm (b - a:real^3) <= + inv (&2) * norm (s - a) * norm (b - a)`); + (REWRITE_TAC[REAL_ARITH `a * x * b <= a * y * b <=> &0 <= (a * b) * (y - x)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `&0 <= inv (&2)`]); + (REWRITE_TAC[GSYM dist]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (UNDISCH_TAC `between p' (a,s:real^3)` THEN REWRITE_TAC[between]); + (DISCH_TAC THEN FIRST_ASSUM REWRITE_ONLY_TAC); + (REWRITE_TAC[REAL_ARITH `(a + b) - a = b`; DIST_POS_LE]); + + (NEW_GOAL `norm (inv (&2) % (b - a:real^3)) pow 2 = + inv (&2) * norm (s - a) * norm (b - a)`); + (REWRITE_TAC[NORM_MUL; REAL_POW_2; REAL_ARITH `abs (inv (&2)) = inv (&2)`]); + (REWRITE_TAC[REAL_ARITH + `(z * x) * z * x = z * y * x <=> (y - z * x) * x * z = &0`]); + (REWRITE_WITH `s - a:real^3 = inv (&2) % (b - a)`); + (ASM_REWRITE_TAC[midpoint] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; REAL_ARITH `abs (inv (&2)) = inv (&2)`]); + (REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (NEW_GOAL `x IN rcone_ge (a:real^3) b r`); + (EXPAND_TAC "x"); + (MATCH_MP_TAC RCONE_GE_TRANS); + (STRIP_TAC); + (SIMP_TAC[REAL_LE_DIV;DIST_POS_LE]); + (ASM_REWRITE_TAC[VECTOR_ARITH `(a:real^3) + p - a = p`]); + (ASM_SET_TAC[]); + + (NEW_GOAL `(p' - a) dot (b - a) = norm (p'- a) * norm (b - a:real^3)`); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ_EQ]); + (SUBGOAL_THEN `between p' (a, b:real^3)` MP_TAC); + (EXPAND_TAC "p'" THEN MATCH_MP_TAC INTER_RCONE_GE_IMP_BETWEEN_PROJ_POINT); + (EXISTS_TAC `r:real` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM REWRITE_ONLY_TAC); + (REWRITE_WITH `(u % a + v % b) - a = (u % a + v % b) - (u + v) % a:real^3`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (REWRITE_TAC[VECTOR_ARITH `(u % a + v % b) - (u + v) % a = v % (b - a)`; + NORM_MUL; VECTOR_MUL_ASSOC]); + (REWRITE_WITH `abs v = v`); + (ASM_SIMP_TAC[REAL_ABS_REFL]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `(x - s:real^3) dot (a - s) = &0`); + (EXPAND_TAC "x"); + (REWRITE_TAC[VECTOR_ARITH `((a + m % x) - s) dot (a - s) = (s - a) dot (s - a) - m * (x dot (s - a))`]); + + (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist]); + (REWRITE_WITH `(p - a) dot (s - a) = + (p - a - (p' - a)) dot (s - a) + (p' - a) dot (s - a:real^3)`); + (VECTOR_ARITH_TAC); + + (EXPAND_TAC "p'" THEN REWRITE_TAC[VECTOR_ARITH `(x + a) - a = x:real^3`]); + (REWRITE_TAC[GSYM projection_proj_point]); + (REWRITE_WITH `s - a:real^3 = inv (&2) % (b - a)`); + (ASM_REWRITE_TAC[midpoint] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_RMUL;Packing3.PROJECTION_ORTHOGONAL;REAL_MUL_RZERO; + REAL_ADD_LID]); + (REWRITE_WITH `proj_point (b - a) (p - a:real^3) = p' - a`); + (EXPAND_TAC "p'" THEN VECTOR_ARITH_TAC); + (FIRST_ASSUM REWRITE_ONLY_TAC); + (REWRITE_TAC[DOT_LMUL; NORM_MUL; REAL_ARITH `abs (inv (&2)) = inv (&2)`; + GSYM NORM_POW_2]); + (REWRITE_TAC [REAL_ARITH `m * m * (x pow 2) - (m * x) / y * m * y * x = &0 + <=> m * m * x * x * (y / y - &1) = &0 `]); + (REWRITE_WITH `norm (p' - a) / norm (p' - a:real^3) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[NORM_EQ_0]); + (EXPAND_TAC "p'" THEN REWRITE_TAC[VECTOR_ARITH `(x + a:real^3) - a = x`]); + (REWRITE_TAC[PRO_EXP;VECTOR_MUL_EQ_0]); + (ASM_REWRITE_TAC[VECTOR_ARITH `b - a = vec 0 <=> a = b`]); + (ONCE_REWRITE_TAC [REAL_ARITH `a / b = a * (&1 / b)`]); + (REWRITE_TAC[REAL_ENTIRE]); + (NEW_GOAL `~((p - a) dot (b - a:real^3) = &0)`); + (NEW_GOAL `&0 < dist (p,a) * dist (b,a:real^3) * r`); + (ASM_SIMP_TAC[REAL_LT_MUL; DIST_POS_LT]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Trigonometry2.NOT_EQ0_IMP_NEITHER_INVERT); + (REWRITE_TAC[GSYM NORM_POW_2; Trigonometry2.POW2_EQ_0; NORM_EQ_0]); + (ASM_REWRITE_TAC[VECTOR_ARITH `b - a = vec 0 <=> a = b`]); + (REAL_ARITH_TAC); + (NEW_GOAL `dist (s, x) < dist (s, a:real^3)`); + (NEW_GOAL `norm (a - x:real^3) pow 2 = norm (s - x) pow 2 + norm (a - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (ASM_REWRITE_TAC[orthogonal]); + (NEW_GOAL `norm (a - s) pow 2 > inv (&2) * norm (a - x:real^3) pow 2`); + (ONCE_REWRITE_TAC[NORM_ARITH `norm (x - y) = norm (y - x)`]); + (EXPAND_TAC "x" THEN REWRITE_TAC[VECTOR_ARITH `(x + y:real^3) - x = y`]); + (REWRITE_TAC[NORM_MUL]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[dist]); + (REWRITE_WITH `abs (norm (s - a) / norm (p' - a:real^3)) = + norm (s - a) / norm (p' - a)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (SIMP_TAC[REAL_LE_DIV;NORM_POS_LE]); + (REWRITE_TAC[REAL_ARITH `(x / y * z) pow 2 = x pow 2 * (z / y) pow 2`]); + (REWRITE_TAC[REAL_ARITH + `x pow 2 > a * x pow 2 * b <=> &0 < x pow 2 * (&1 - a * b)`]); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + + (REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT;NORM_EQ_0]); + (ASM_REWRITE_TAC[midpoint; VECTOR_ARITH `inv (&2) % (a + b) - a = + inv (&2) % (b - a)`; VECTOR_MUL_EQ_0]); + (ASM_REWRITE_TAC[VECTOR_ARITH `b -a = vec 0 <=> a = b`]); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&0 < &1 - a <=> a < &1`]); + (NEW_GOAL `norm (p' - a) >= r * norm (p - a:real^3)`); + (EXPAND_TAC "p'" THEN REWRITE_TAC[VECTOR_ARITH `(x + y:real^3) - y = x`]); + (REWRITE_TAC[PRO_EXP]); + (SUBGOAL_THEN `p IN rcone_ge (a:real^3) b r` MP_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[rcone_ge;rconesgn;IN;IN_ELIM_THM; dist]); + (STRIP_TAC); + (REWRITE_TAC[NORM_MUL;REAL_ABS_DIV;GSYM NORM_POW_2]); + (REWRITE_WITH `abs ((p - a) dot (b - a)) = (p - a) dot (b - a:real^3) /\ + abs (norm (b - a) pow 2) = norm (b - a) pow 2`); + (REWRITE_TAC[REAL_ABS_REFL;REAL_LE_POW_2]); + (NEW_GOAL `&0 <= norm (p - a) * norm (b - a:real^3) * r`); + (ASM_SIMP_TAC[REAL_LE_MUL; NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `a / x * y >= b <=> b <= (a * y) / x`]); + (REWRITE_WITH `r * norm (p - a) <= + (((p - a) dot (b - a)) * norm (b - a)) / norm (b - a) pow 2 + <=> (r * norm (p - a)) * norm (b - a) pow 2 <= + (((p - a) dot (b - a)) * norm (b - a:real^3))`); + (MATCH_MP_TAC REAL_LE_RDIV_EQ); + (REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT; NORM_EQ_0]); + (ASM_REWRITE_TAC[VECTOR_ARITH `b - a = vec 0 <=> a = b`]); + (REWRITE_TAC[REAL_ARITH + `(a * b) * x pow 2 <= m * x <=> &0 <= x * (m - b * x * a)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + + (REWRITE_TAC[REAL_POW_DIV;REAL_ARITH `a * b / c = (a * b) / c`]); + (REWRITE_WITH `(inv (&2) * norm (p - a) pow 2) / norm (p' - a) pow 2 < &1 + <=> (inv (&2) * norm (p - a) pow 2) < &1 * norm (p' - a:real^3) pow 2`); + (MATCH_MP_TAC REAL_LT_LDIV_EQ); + (REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]); + (STRIP_TAC); + (NEW_GOAL `norm (p - a:real^3) = &0`); + (NEW_GOAL `r * norm (p - a:real^3) = &0`); + (NEW_GOAL `&0 <= r * norm (p - a:real^3)`); + (ASM_SIMP_TAC[REAL_LE_MUL;NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ENTIRE]); + (REWRITE_WITH `~(r = &0)`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[NORM_EQ_0]); + (ASM_REWRITE_TAC[NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (REWRITE_TAC[REAL_MUL_LID]); + (NEW_GOAL `(r * norm (p - a)) pow 2 <= norm (p' - a:real^3) pow 2`); + (REWRITE_WITH `(r * norm (p - a)) pow 2 <= norm (p' - a:real^3) pow 2 + <=> r * norm (p - a) <= norm (p' - a)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Trigonometry2.POW2_COND); + (ASM_SIMP_TAC[REAL_LE_MUL;NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `inv (&2) * norm (p - a:real^3) pow 2 < (r * norm (p - a)) pow 2`); + (REWRITE_TAC[REAL_ARITH + `a * x pow 2 < (m * x) pow 2 <=> &0 < (m pow 2 - a) * (x pow 2)`]); + (MATCH_MP_TAC REAL_LT_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT; NORM_EQ_0]); + (ASM_REWRITE_TAC[VECTOR_ARITH `b - a = vec 0 <=> a = b`]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `norm (s - x) pow 2 < norm (a - s:real^3) pow 2`); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `dist (s,x) < dist (s,a:real^3) + <=> dist (s,x) pow 2 < dist (s,a) pow 2`); + (MATCH_MP_TAC Pack1.bp_bdt); + (REWRITE_TAC[DIST_POS_LE]); + (UP_ASM_TAC THEN REWRITE_TAC[GSYM dist] THEN MESON_TAC[DIST_SYM]); + + (ASM_CASES_TAC `(p = x:real^3)`); + (ASM_MESON_TAC[]); + (MATCH_MP_TAC DIST_BETWEEN_FURTHEST_LT); + (EXISTS_TAC `x:real^3`); + (REPEAT STRIP_TAC); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (UNDISCH_TAC `between p (a,x:real^3)`); + (FIRST_ASSUM REWRITE_ONLY_TAC); + (REWRITE_TAC[BETWEEN_REFL_EQ]); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + +let INTER_RCONE_GE_dist_lemma1 = INTER_RCONE_GE_LT_lemma;; + +(* ======================================================================= *) +(* Lemma 73 *) +(* ========================================================================== *) +let INTER_RCONE_GE_LE_lemma = prove_by_refinement ( + `!a:real^3 b p s h r. + ~(a = b) /\ s = midpoint (a, b) /\ &0 < r /\ ~(p = a) /\ ~(p = b) /\ + inv (&2) <= r pow 2 /\ + between (proj_point (b - a) (p - a) + a) (a, s) /\ + p IN rcone_ge a b r INTER rcone_ge b a r ==> dist (s, p) <= dist (s, a)`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `&0 <= r`); + (ASM_REAL_ARITH_TAC); + (ABBREV_TAC `p' = proj_point (b - a) (p - a) + a:real^3`); + (ABBREV_TAC `x = a + (dist (a, s) / dist (a, p':real^3)) % (p - a)`); + (NEW_GOAL `(p - a) dot (b - a:real^3) >= dist (p,a) * dist (b,a) * r`); + (SUBGOAL_THEN `p IN rcone_ge a (b:real^3) r` MP_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[rcone_ge;rconesgn;IN;IN_ELIM_THM]); + + (NEW_GOAL `between p (a, x:real^3)`); + (EXPAND_TAC "x" THEN REWRITE_TAC[between]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[dist; VECTOR_ARITH `(a + x) - a = x:real^3 /\ + ((a + k % (p - a) ) - p = (k - &1) % (p - a))`; NORM_MUL]); + (REWRITE_WITH `abs (norm (a - s) / norm (a - p':real^3)) = + norm (a - s) / norm (a - p')`); + (REWRITE_TAC[REAL_ABS_REFL]); + (SIMP_TAC[REAL_LE_DIV; NORM_POS_LE]); + (REWRITE_WITH `abs (norm (a - s) / norm (a - p':real^3) - &1) = + norm (a - s) / norm (a - p') - &1`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ONCE_REWRITE_TAC[NORM_ARITH `norm (a - b) = norm (b - a)`]); + (EXPAND_TAC "p'" THEN SIMP_TAC[VECTOR_ARITH `(k % s + a) - a = k % s`; + PRO_EXP; NORM_MUL;REAL_ABS_DIV; GSYM NORM_POW_2; REAL_LE_POW_2]); + (REWRITE_WITH `abs ((p - a) dot (b - a:real^3)) = (p - a) dot (b - a) /\ + abs (norm (b - a) pow 2) = norm (b - a) pow 2`); + (REWRITE_TAC[REAL_ABS_REFL; REAL_LE_POW_2]); + (NEW_GOAL `&0 <= dist (p,a) * dist (b,a:real^3) * r`); + (ASM_SIMP_TAC[REAL_LE_MUL;DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&0 <= x - &1 <=> &1 <= x`]); + (REWRITE_WITH `b = &2 % s - a:real^3`); + (ASM_REWRITE_TAC[midpoint] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `&2 % s - a - a = &2 % (s - a)`; NORM_MUL; + DOT_RMUL; MESON[REAL_ABS_REFL; REAL_ARITH `&0 <= &2`] `abs (&2) = &2`]); + (REWRITE_TAC[real_div; REAL_INV_MUL; REAL_INV_INV]); + + (REWRITE_TAC[REAL_ARITH `x * ((inv (&2) * inv (y)) * (&2 * x) pow 2) * + inv (&2) * inv (x) = (x * inv (x)) * (x pow 2) * inv (y)`]); + (REWRITE_WITH `norm (s - a:real^3) * inv (norm (s - a)) = &1`); + (MATCH_MP_TAC REAL_MUL_RINV); + (REWRITE_TAC[NORM_EQ_0]); + (ASM_REWRITE_TAC[midpoint; VECTOR_ARITH `inv (&2) % (a + b) - a = + inv (&2) % (b - a)`; VECTOR_MUL_EQ_0]); + (ASM_REWRITE_TAC[VECTOR_ARITH `b -a = vec 0 <=> a = b`]); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_MUL_LID; GSYM real_div]); + + + (NEW_GOAL `&0 < (p - a) dot (s - a:real^3)`); + (REWRITE_WITH `(p - a) dot (s - a:real^3) = inv (&2) * (p - a) dot (b - a)`); + (ASM_REWRITE_TAC[midpoint] THEN VECTOR_ARITH_TAC); + (MATCH_MP_TAC REAL_LT_MUL); + (REWRITE_TAC[REAL_ARITH `&0 < inv (&2)`]); + (NEW_GOAL `&0 < dist (p,a) * dist (b,a:real^3) * r`); + (ASM_SIMP_TAC[REAL_LT_MUL;DIST_POS_LT]); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `&1 <= norm (s - a) pow 2 / ((p - a) dot (s - a)) + <=> &1 * ((p - a) dot (s - a:real^3)) <= norm (s - a) pow 2 `); + (ASM_SIMP_TAC[REAL_LE_RDIV_EQ]); + (REWRITE_TAC[REAL_MUL_LID]); + (ONCE_REWRITE_TAC[VECTOR_ARITH `(p - a) dot (s - a) = + (p - a - (p' - a)) dot (s - a) + (p' - a) dot (s - a:real^3)`]); + (EXPAND_TAC "p'" THEN REWRITE_TAC[VECTOR_ARITH `(x + a) - a = x:real^3`]); + (REWRITE_TAC[GSYM projection_proj_point]); + (REWRITE_WITH `s - a:real^3 = inv (&2) % (b - a)`); + (ASM_REWRITE_TAC[midpoint] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_RMUL;Packing3.PROJECTION_ORTHOGONAL;REAL_MUL_RZERO; + REAL_ADD_LID]); + (REWRITE_WITH `proj_point (b - a) (p - a:real^3) = p' - a`); + (EXPAND_TAC "p'" THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `(p' - a) dot (b - a) = norm (p'- a) * norm (b - a:real^3)`); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ_EQ]); + (SUBGOAL_THEN `between p' (a, b:real^3)` MP_TAC); + (EXPAND_TAC "p'" THEN MATCH_MP_TAC INTER_RCONE_GE_IMP_BETWEEN_PROJ_POINT); + (EXISTS_TAC `r:real` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM REWRITE_ONLY_TAC); + (REWRITE_WITH `(u % a + v % b) - a = (u % a + v % b) - (u + v) % a:real^3`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (REWRITE_TAC[VECTOR_ARITH `(u % a + v % b) - (u + v) % a = v % (b - a)`; + NORM_MUL; VECTOR_MUL_ASSOC]); + (REWRITE_WITH `abs v = v`); + (ASM_SIMP_TAC[REAL_ABS_REFL]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `inv (&2) * norm (p' - a) * norm (b - a:real^3) <= + inv (&2) * norm (s - a) * norm (b - a)`); + (REWRITE_TAC[REAL_ARITH `a * x * b <= a * y * b <=> &0 <= (a * b) * (y - x)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `&0 <= inv (&2)`]); + (REWRITE_TAC[GSYM dist]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (UNDISCH_TAC `between p' (a,s:real^3)` THEN REWRITE_TAC[between]); + (DISCH_TAC THEN FIRST_ASSUM REWRITE_ONLY_TAC); + (REWRITE_TAC[REAL_ARITH `(a + b) - a = b`; DIST_POS_LE]); + + (NEW_GOAL `norm (inv (&2) % (b - a:real^3)) pow 2 = + inv (&2) * norm (s - a) * norm (b - a)`); + (REWRITE_TAC[NORM_MUL; REAL_POW_2; REAL_ARITH `abs (inv (&2)) = inv (&2)`]); + (REWRITE_TAC[REAL_ARITH + `(z * x) * z * x = z * y * x <=> (y - z * x) * x * z = &0`]); + (REWRITE_WITH `s - a:real^3 = inv (&2) % (b - a)`); + (ASM_REWRITE_TAC[midpoint] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; REAL_ARITH `abs (inv (&2)) = inv (&2)`]); + (REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (REAL_ARITH_TAC); + + (NEW_GOAL `x IN rcone_ge (a:real^3) b r`); + (EXPAND_TAC "x"); + (MATCH_MP_TAC RCONE_GE_TRANS); + (STRIP_TAC); + (SIMP_TAC[REAL_LE_DIV;DIST_POS_LE]); + (ASM_REWRITE_TAC[VECTOR_ARITH `(a:real^3) + p - a = p`]); + (ASM_SET_TAC[]); + + (NEW_GOAL `(p' - a) dot (b - a) = norm (p'- a) * norm (b - a:real^3)`); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ_EQ]); + (SUBGOAL_THEN `between p' (a, b:real^3)` MP_TAC); + (EXPAND_TAC "p'" THEN MATCH_MP_TAC INTER_RCONE_GE_IMP_BETWEEN_PROJ_POINT); + (EXISTS_TAC `r:real` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM REWRITE_ONLY_TAC); + (REWRITE_WITH `(u % a + v % b) - a = (u % a + v % b) - (u + v) % a:real^3`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (REWRITE_TAC[VECTOR_ARITH `(u % a + v % b) - (u + v) % a = v % (b - a)`; + NORM_MUL; VECTOR_MUL_ASSOC]); + (REWRITE_WITH `abs v = v`); + (ASM_SIMP_TAC[REAL_ABS_REFL]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `(x - s:real^3) dot (a - s) = &0`); + (EXPAND_TAC "x"); + (REWRITE_TAC[VECTOR_ARITH `((a + m % x) - s) dot (a - s) = (s - a) dot (s - a) - m * (x dot (s - a))`]); + + (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[dist]); + (REWRITE_WITH `(p - a) dot (s - a) = + (p - a - (p' - a)) dot (s - a) + (p' - a) dot (s - a:real^3)`); + (VECTOR_ARITH_TAC); + + (EXPAND_TAC "p'" THEN REWRITE_TAC[VECTOR_ARITH `(x + a) - a = x:real^3`]); + (REWRITE_TAC[GSYM projection_proj_point]); + (REWRITE_WITH `s - a:real^3 = inv (&2) % (b - a)`); + (ASM_REWRITE_TAC[midpoint] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[DOT_RMUL;Packing3.PROJECTION_ORTHOGONAL;REAL_MUL_RZERO; + REAL_ADD_LID]); + (REWRITE_WITH `proj_point (b - a) (p - a:real^3) = p' - a`); + (EXPAND_TAC "p'" THEN VECTOR_ARITH_TAC); + (FIRST_ASSUM REWRITE_ONLY_TAC); + (REWRITE_TAC[DOT_LMUL; NORM_MUL; REAL_ARITH `abs (inv (&2)) = inv (&2)`; + GSYM NORM_POW_2]); + (REWRITE_TAC [REAL_ARITH `m * m * (x pow 2) - (m * x) / y * m * y * x = &0 + <=> m * m * x * x * (y / y - &1) = &0 `]); + (REWRITE_WITH `norm (p' - a) / norm (p' - a:real^3) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[NORM_EQ_0]); + (EXPAND_TAC "p'" THEN REWRITE_TAC[VECTOR_ARITH `(x + a:real^3) - a = x`]); + (REWRITE_TAC[PRO_EXP;VECTOR_MUL_EQ_0]); + (ASM_REWRITE_TAC[VECTOR_ARITH `b - a = vec 0 <=> a = b`]); + (ONCE_REWRITE_TAC [REAL_ARITH `a / b = a * (&1 / b)`]); + (REWRITE_TAC[REAL_ENTIRE]); + (NEW_GOAL `~((p - a) dot (b - a:real^3) = &0)`); + (NEW_GOAL `&0 < dist (p,a) * dist (b,a:real^3) * r`); + (ASM_SIMP_TAC[REAL_LT_MUL; DIST_POS_LT]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Trigonometry2.NOT_EQ0_IMP_NEITHER_INVERT); + (REWRITE_TAC[GSYM NORM_POW_2; Trigonometry2.POW2_EQ_0; NORM_EQ_0]); + (ASM_REWRITE_TAC[VECTOR_ARITH `b - a = vec 0 <=> a = b`]); + (REAL_ARITH_TAC); + (NEW_GOAL `dist (s, x) <= dist (s, a:real^3)`); + (NEW_GOAL `norm (a - x:real^3) pow 2 = norm (s - x) pow 2 + norm (a - s) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (ASM_REWRITE_TAC[orthogonal]); + (NEW_GOAL `norm (a - s) pow 2 >= inv (&2) * norm (a - x:real^3) pow 2`); + (ONCE_REWRITE_TAC[NORM_ARITH `norm (x - y) = norm (y - x)`]); + (EXPAND_TAC "x" THEN REWRITE_TAC[VECTOR_ARITH `(x + y:real^3) - x = y`]); + (REWRITE_TAC[NORM_MUL]); + (ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[dist]); + (REWRITE_WITH `abs (norm (s - a) / norm (p' - a:real^3)) = + norm (s - a) / norm (p' - a)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (SIMP_TAC[REAL_LE_DIV;NORM_POS_LE]); + (REWRITE_TAC[REAL_ARITH `(x / y * z) pow 2 = x pow 2 * (z / y) pow 2`]); + (REWRITE_TAC[REAL_ARITH + `x pow 2 >= a * x pow 2 * b <=> &0 <= x pow 2 * (&1 - a * b)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + + (REWRITE_TAC[REAL_LE_POW_2]); + (REWRITE_TAC[REAL_ARITH `&0 <= &1 - a <=> a <= &1`]); + (NEW_GOAL `norm (p' - a) >= r * norm (p - a:real^3)`); + (EXPAND_TAC "p'" THEN REWRITE_TAC[VECTOR_ARITH `(x + y:real^3) - y = x`]); + (REWRITE_TAC[PRO_EXP]); + (SUBGOAL_THEN `p IN rcone_ge (a:real^3) b r` MP_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[rcone_ge;rconesgn;IN;IN_ELIM_THM; dist]); + (STRIP_TAC); + (REWRITE_TAC[NORM_MUL;REAL_ABS_DIV;GSYM NORM_POW_2]); + (REWRITE_WITH `abs ((p - a) dot (b - a)) = (p - a) dot (b - a:real^3) /\ + abs (norm (b - a) pow 2) = norm (b - a) pow 2`); + (REWRITE_TAC[REAL_ABS_REFL;REAL_LE_POW_2]); + (NEW_GOAL `&0 <= norm (p - a) * norm (b - a:real^3) * r`); + (ASM_SIMP_TAC[REAL_LE_MUL; NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `a / x * y >= b <=> b <= (a * y) / x`]); + (REWRITE_WITH `r * norm (p - a) <= + (((p - a) dot (b - a)) * norm (b - a)) / norm (b - a) pow 2 + <=> (r * norm (p - a)) * norm (b - a) pow 2 <= + (((p - a) dot (b - a)) * norm (b - a:real^3))`); + (MATCH_MP_TAC REAL_LE_RDIV_EQ); + (REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT; NORM_EQ_0]); + (ASM_REWRITE_TAC[VECTOR_ARITH `b - a = vec 0 <=> a = b`]); + (REWRITE_TAC[REAL_ARITH + `(a * b) * x pow 2 <= m * x <=> &0 <= x * (m - b * x * a)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + + (REWRITE_TAC[REAL_POW_DIV;REAL_ARITH `a * b / c = (a * b) / c`]); + (REWRITE_WITH `(inv (&2) * norm (p - a) pow 2) / norm (p' - a) pow 2 <= &1 + <=> (inv (&2) * norm (p - a) pow 2) <= &1 * norm (p' - a:real^3) pow 2`); + (MATCH_MP_TAC REAL_LE_LDIV_EQ); + (REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]); + (STRIP_TAC); + (NEW_GOAL `norm (p - a:real^3) = &0`); + (NEW_GOAL `r * norm (p - a:real^3) = &0`); + (NEW_GOAL `&0 <= r * norm (p - a:real^3)`); + (ASM_SIMP_TAC[REAL_LE_MUL;NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ENTIRE]); + (REWRITE_WITH `~(r = &0)`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[NORM_EQ_0]); + (ASM_REWRITE_TAC[NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (REWRITE_TAC[REAL_MUL_LID]); + (NEW_GOAL `(r * norm (p - a)) pow 2 <= norm (p' - a:real^3) pow 2`); + (REWRITE_WITH `(r * norm (p - a)) pow 2 <= norm (p' - a:real^3) pow 2 + <=> r * norm (p - a) <= norm (p' - a)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Trigonometry2.POW2_COND); + (ASM_SIMP_TAC[REAL_LE_MUL;NORM_POS_LE]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `inv (&2) * norm (p - a:real^3) pow 2 <= (r * norm (p - a)) pow 2`); + (REWRITE_TAC[REAL_ARITH + `a * x pow 2 <= (m * x) pow 2 <=> &0 <= (m pow 2 - a) * (x pow 2)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_LE_POW_2]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `norm (s - x) pow 2 <= norm (a - s:real^3) pow 2`); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `dist (s,x) <= dist (s,a:real^3) + <=> dist (s,x) pow 2 <= dist (s,a) pow 2`); + (MATCH_MP_TAC Trigonometry2.POW2_COND); + (REWRITE_TAC[DIST_POS_LE]); + (UP_ASM_TAC THEN REWRITE_TAC[GSYM dist] THEN MESON_TAC[DIST_SYM]); + + (ONCE_REWRITE_TAC[DIST_SYM]); + (REWRITE_TAC[dist]); + (NEW_GOAL `?y. y IN {a, x:real^3} /\ + (!m. m IN convex hull {a,x} ==> norm (m - s) <= norm (y - s))`); + (MATCH_MP_TAC SIMPLEX_FURTHEST_LE); + (REWRITE_TAC[Geomdetail.FINITE6]); + (SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[SET_RULE `a IN {x,y} <=> a = x \/ a = y`] + THEN STRIP_TAC); + (UP_ASM_TAC THEN FIRST_ASSUM REWRITE_ONLY_TAC); + (DISCH_TAC THEN FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL] THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN FIRST_ASSUM REWRITE_ONLY_TAC); + (DISCH_TAC); + (NEW_GOAL `norm (p - s) <= norm (x - s:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL] THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `norm (x - s) <= norm (a - s:real^3)`); + (REWRITE_TAC[GSYM dist]); + (ASM_MESON_TAC[DIST_SYM]); + (ASM_REAL_ARITH_TAC)]);; + +(* ======================================================================= *) +(* Lemma 74 *) + +let LEFT_ACTION_LIST_PROPERTIES = prove_by_refinement ( + `!V ul p u0 u1 u2 u3 k. + packing V /\ saturated V /\ barV V 3 ul /\ + hl (truncate_simplex 2 ul) < sqrt (&2) /\ sqrt (&2) <= hl ul /\ + p permutes 0..2 /\ + xl = left_action_list p ul + ==> xl IN barV V 3 /\ + omega_list_n V xl 2 = omega_list_n V ul 2 /\ + omega_list_n V xl 3 = omega_list_n V ul 3 /\ + mxi V xl = mxi V ul`, + +[(REPEAT GEN_TAC THEN STRIP_TAC); + (NEW_GOAL `barV V 3 xl`); + (REWRITE_TAC[BARV]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[Packing3.LENGTH_LEFT_ACTION_LIST]); + (UNDISCH_TAC `barV V 3 ul` THEN MESON_TAC[BARV]); + (ABBREV_TAC `zl:(real^3)list = truncate_simplex 2 xl`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `initial_sublist vl (zl:(real^3)list)`); + (REWRITE_TAC[VORONOI_NONDG]); + (STRIP_TAC); + (NEW_GOAL `LENGTH (vl:(real^3)list) <= LENGTH (zl:(real^3)list)`); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_LENGTH_LE); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `LENGTH (zl:(real^3)list) = 2 + 1`); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[Packing3.LENGTH_LEFT_ACTION_LIST]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_ARITH_TAC); + (NEW_GOAL `set_of_list vl SUBSET set_of_list (zl:(real^3)list)`); + (MATCH_MP_TAC Packing3.SET_OF_LIST_INITIAL_SUBLIST_SUBSET); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list zl SUBSET set_of_list (xl:(real^3)list)`); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Rogers.SET_OF_LIST_TRUNCATE_SIMPLEX_SUBSET); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[Packing3.LENGTH_LEFT_ACTION_LIST]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (NEW_GOAL `set_of_list xl SUBSET (V:real^3->bool)`); + (ASM_SIMP_TAC[Packing3.SET_OF_LIST_LEFT_ACTION_LIST; ARITH_RULE `2 = 3 - 1`]); + (REWRITE_WITH `set_of_list (left_action_list p ul) = + set_of_list (ul:(real^3)list)`); + (MATCH_MP_TAC SET_OF_LIST_LEFT_ACTION_LIST_2); + (NEW_GOAL `LENGTH ul = 3 + 1 /\ + CARD (set_of_list (ul:(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[ARITH_RULE `2 <= 3 + 1 /\ (3 + 1) - 2 = 2`]); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_SET_TAC[]); + + (ASM_CASES_TAC `LENGTH (vl:(real^3)list) = 4`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `a + x = x:int <=> a = &0`]); + (REWRITE_TAC[VORONOI_LIST]); + (REWRITE_WITH `vl = xl:(real^3)list`); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_UNIQUE); + (EXISTS_TAC `4`); + (EXISTS_TAC `xl:(real^3)list`); + (ASM_REWRITE_TAC[Packing3.INITIAL_SUBLIST_REFL]); + (REWRITE_TAC[Packing3.LENGTH_LEFT_ACTION_LIST]); + (NEW_GOAL `LENGTH (ul:(real^3)list) = 3 + 1 /\ CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `set_of_list (left_action_list p ul) = set_of_list (ul:(real^3)list)`); + (MATCH_MP_TAC SET_OF_LIST_LEFT_ACTION_LIST_2); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 4`); + (NEW_GOAL `LENGTH (ul:(real^3)list) = 3 + 1 /\ CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `2 <= 4 /\ 4 - 2 = 2`]); + (MP_TAC (ASSUME`barV V 3 ul`) THEN REWRITE_TAC[BARV; VORONOI_NONDG]); + (STRIP_TAC); + (NEW_GOAL `LENGTH (ul:(real^3)list) = 4`); + (NEW_GOAL `LENGTH (ul:(real^3)list) = 3 + 1 /\ CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC); + (NEW_GOAL `LENGTH (ul:(real^3)list) < 5 /\ + set_of_list ul SUBSET V /\ + aff_dim (voronoi_list V ul) + &(LENGTH ul) = &4`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[Packing3.INITIAL_SUBLIST_REFL]); + (ASM_ARITH_TAC); + (ONCE_REWRITE_TAC[GSYM VORONOI_LIST]); + (ASM_ARITH_TAC); + +(* ====== *) + + (REWRITE_WITH `aff_dim (voronoi_list V (vl:(real^3)list)) = + &3 - &(LENGTH vl - 1)`); + (MATCH_MP_TAC Packing3.AFF_DIM_VORONOI_LIST); + (MATCH_MP_TAC Packing3.BARV_INITIAL_SUBLIST); + (EXISTS_TAC `2`); + (EXISTS_TAC `left_action_list p (truncate_simplex 2 (ul:(real^3)list))`); + (ABBREV_TAC `yl = truncate_simplex 2 (ul:(real^3)list)`); + (NEW_GOAL `left_action_list p yl IN barV V 2 /\ + omega_list V (left_action_list p yl) = omega_list V yl`); + (MATCH_MP_TAC Rogers.YIFVQDV); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "yl"); + (REWRITE_TAC[IN]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (STRIP_TAC); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `left_action_list p (yl:(real^3)list) = zl`); + (EXPAND_TAC "zl" THEN EXPAND_TAC "yl"); + (REWRITE_TAC[ASSUME `xl:(real^3)list = left_action_list p ul`]); + (REWRITE_TAC[left_action_list]); + (NEW_GOAL `?u0 u1 u2 u3:real^3. ul = [u0; u1; u2; u3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[ASSUME `ul = [u0:real^3; u1; u2; u3]`]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_TAC[LENGTH; ARITH_RULE `SUC (SUC (SUC 0)) = 3 /\ + SUC (SUC (SUC (SUC 0))) = 4`]); + (REWRITE_TAC[TABLE_4]); + (REWRITE_TAC[ARITH_RULE `SUC 3 = 4`; TABLE_4]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (NEW_GOAL `!j. j < 3 ==> + EL (inverse p j) [u0; u1; u2:real^3] = EL (inverse p j) [u0; u1; u2; u3]`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `inverse (p:num->num) j = 0`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[EL;HD]); + (ASM_CASES_TAC `inverse (p:num->num) j = 1`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[EL;ARITH_RULE `1 = SUC 0`; TL; HD]); + (ASM_CASES_TAC `inverse (p:num->num) j = 2`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[EL;ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`; TL; HD]); + (NEW_GOAL `inverse (p:num->num) j > 2`); + (ASM_ARITH_TAC); + (NEW_GOAL `p (inverse p j) = inverse (p:num->num) j`); + (UNDISCH_TAC `p permutes 0..2`); + (REWRITE_TAC[permutes]); + (NEW_GOAL `~(inverse (p:num->num) j IN 0..2)`); + (REWRITE_TAC [IN_NUMSEG]); + (UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (NEW_GOAL `p (inverse (p:num->num) j) = j`); + (ASM_MESON_TAC[PERMUTES_INVERSES]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (ASM_MESON_TAC[ARITH_RULE `0 < 3 /\ 1 < 3 /\ 2 < 3`]); + + (ONCE_ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `&(LENGTH vl - 1):int = &(LENGTH (vl:(real^3)list)) - &1`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC INT_OF_NUM_SUB); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + +(* ======================================================================= *) + + (NEW_GOAL `vl = xl:(real^3)list`); + (NEW_GOAL `vl:(real^3)list = truncate_simplex (LENGTH vl - 1) xl /\ + LENGTH vl <= LENGTH xl`); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_IMP_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[] THEN ASM_ARITH_TAC); + (NEW_GOAL `?u0 u1 u2 u3. xl = [u0;u1;u2;u3:real^3]`); + (NEW_GOAL `LENGTH (xl:(real^3)list) = 4`); + (ASM_REWRITE_TAC[Packing3.LENGTH_LEFT_ACTION_LIST]); + (REWRITE_TAC[ARITH_RULE `4 = 3 + 1`]); + (ASM_MESON_TAC[Rogers.BARV_IMP_LENGTH_EQ_CARD]); + + (NEW_GOAL `?u0 q0. xl = CONS (u0:real^3) q0`); + (MATCH_MP_TAC Packing3.LENGTH_IMP_CONS); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC THEN EXISTS_TAC `u0:real^3`); + (NEW_GOAL `LENGTH (q0:(real^3)list) = 3`); + (UNDISCH_TAC `LENGTH (xl:(real^3)list) = 4` THEN + REWRITE_TAC[ASSUME `xl = CONS (u0:real^3) q0`; ARITH_RULE `4 = SUC 3`]); + (REWRITE_TAC[LENGTH]); + (ARITH_TAC); + + (NEW_GOAL `?u1 q1. q0 = CONS (u1:real^3) q1`); + (MATCH_MP_TAC Packing3.LENGTH_IMP_CONS); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC THEN EXISTS_TAC `u1:real^3`); + (NEW_GOAL `LENGTH (q1:(real^3)list) = 2`); + (UNDISCH_TAC `LENGTH (q0:(real^3)list) = 3` THEN + REWRITE_TAC[ASSUME `q0 = CONS (u1:real^3) q1`; ARITH_RULE `3 = SUC 2`]); + (REWRITE_TAC[LENGTH]); + (ARITH_TAC); + + (NEW_GOAL `?u2 q2. q1 = CONS (u2:real^3) q2`); + (MATCH_MP_TAC Packing3.LENGTH_IMP_CONS); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC THEN EXISTS_TAC `u2:real^3`); + (NEW_GOAL `LENGTH (q2:(real^3)list) = 1`); + (UNDISCH_TAC `LENGTH (q1:(real^3)list) = 2` THEN + REWRITE_TAC[ASSUME `q1 = CONS (u2:real^3) q2`; ARITH_RULE `2 = SUC 1`]); + (REWRITE_TAC[LENGTH]); + (ARITH_TAC); + + (NEW_GOAL `?u3. q2 = [u3:real^3]`); + (EXISTS_TAC `HD (q2:(real^3)list)`); + (UP_ASM_TAC THEN REWRITE_TAC[Packing3.LENGTH_1_LEMMA]); + (UP_ASM_TAC THEN STRIP_TAC THEN EXISTS_TAC `u3:real^3`); + (REWRITE_TAC[ASSUME `xl = CONS (u0:real^3) q0`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `zl = [u0;u1;u2:real^3]`); + (ASM_MESON_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC Packing3.INITIAL_SUBLIST_UNIQUE); + (EXISTS_TAC `LENGTH (xl:(real^3)list)` THEN EXISTS_TAC `xl:(real^3)list`); + (REWRITE_TAC[ASSUME `initial_sublist vl (xl:(real^3)list)`; + Packing3.INITIAL_SUBLIST_REFL; ASSUME `xl = [u0; u1; u2; u3:real^3]`; + LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`]); + + (ASM_CASES_TAC `LENGTH (vl:(real^3)list) = 1`); + (NEW_GOAL `vl = truncate_simplex 0 [u0;u1;u2;u3:real^3]`); + (REWRITE_WITH `[u0;u1;u2;u3:real^3] = xl /\ + 0 = LENGTH (vl:(real^3)list) - 1`); + (STRIP_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_0]); + (DISCH_TAC); + (NEW_GOAL `initial_sublist vl (zl:(real^3)list)`); + (REWRITE_TAC[INITIAL_SUBLIST]); + (EXISTS_TAC `[u1;u2:real^3]`); + (ASM_REWRITE_TAC[APPEND]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `LENGTH (vl:(real^3)list) = 2`); + (NEW_GOAL `vl = truncate_simplex 1 [u0;u1;u2;u3:real^3]`); + (MP_TAC (ASSUME `vl:(real^3)list = truncate_simplex (LENGTH vl - 1) xl /\ + LENGTH vl <= LENGTH xl`)); + (REWRITE_TAC[ASSUME `LENGTH (vl:(real^3)list) = 2`; + ARITH_RULE `2 - 1 = 1`; + ASSUME `xl = [u0;u1;u2;u3:real^3]`]); + (MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (DISCH_TAC); + (NEW_GOAL `initial_sublist vl (zl:(real^3)list)`); + (REWRITE_TAC[INITIAL_SUBLIST]); + (EXISTS_TAC `[u2:real^3]`); + (ASM_REWRITE_TAC[APPEND]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `LENGTH (vl:(real^3)list) = 3`); + (NEW_GOAL `vl = truncate_simplex 2 [u0;u1;u2;u3:real^3]`); + (REWRITE_WITH `[u0;u1;u2;u3:real^3] = xl /\ + 2 = LENGTH (vl:(real^3)list) - 1`); + (STRIP_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (DISCH_TAC); + (NEW_GOAL `initial_sublist vl (zl:(real^3)list)`); + (REWRITE_TAC[INITIAL_SUBLIST]); + (EXISTS_TAC `[]:(real^3)list`); + (ASM_REWRITE_TAC[APPEND]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `LENGTH (vl:(real^3)list) <= 4`); + (REWRITE_WITH `4 = LENGTH (xl:(real^3)list)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (ASM_REWRITE_TAC[Packing3.LENGTH_LEFT_ACTION_LIST]); + (REWRITE_TAC[ARITH_RULE `4 = 3 + 1`]); + (ASM_MESON_TAC[Rogers.BARV_IMP_LENGTH_EQ_CARD]); + (ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[VORONOI_NONDG]); + (NEW_GOAL `set_of_list xl = set_of_list (ul:(real^3)list)`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SET_OF_LIST_LEFT_ACTION_LIST_2); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 4`); + (NEW_GOAL `LENGTH (ul:(real^3)list) = 3 + 1 /\ CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ARITH_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `2 <= 4 /\ 4 - 2 = 2`]); + (REWRITE_WITH `LENGTH (xl:(real^3)list) = LENGTH (ul:(real^3)list)`); + (ASM_REWRITE_TAC[Packing3.LENGTH_LEFT_ACTION_LIST]); + (STRIP_TAC); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `3 + 1 = 4 /\ 4 < 5`]); + (ASM_REWRITE_TAC[VORONOI_LIST]); + (ONCE_REWRITE_TAC[GSYM VORONOI_LIST]); + (MP_TAC (ASSUME `barV V 3 ul`)); + (REWRITE_TAC[BARV]); + (STRIP_TAC); + (NEW_GOAL `voronoi_nondg V (ul:(real^3)list)`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[Packing3.INITIAL_SUBLIST_REFL]); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[VORONOI_NONDG]); + (MESON_TAC[]); + (STRIP_TAC); + (ASM_REWRITE_TAC[IN]); + +(* =============================================================== *) + + (NEW_GOAL `omega_list_n V xl 2 = omega_list_n V (ul:(real^3)list) 2`); + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?w0 w1 w2 w3. xl = [w0;w1;w2;w3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `u3 = w3:real^3`); + (UNDISCH_TAC `xl = left_action_list p (ul:(real^3)list)`); + (ASM_REWRITE_TAC[left_action_list; LENGTH; + ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`; TABLE_4]); + (REWRITE_TAC[CONS_11]); + (STRIP_TAC); + (NEW_GOAL `u3:real^3 = EL (inverse p 3) [u0; u1; u2; u3]`); + (REWRITE_WITH `inverse p 3 = 3`); + (REWRITE_WITH `!x. inverse (p:num->num) x = x <=> p x = x`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Hypermap.fixed_point_lemma); + (EXISTS_TAC `0..2`); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `p permutes 0..2` THEN REWRITE_TAC[permutes]); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN_NUMSEG_0] THEN ARITH_TAC); + (REWRITE_TAC[EL; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; HD]); + (ASM_MESON_TAC[]); +(* ======= *) + + (NEW_GOAL `{u0,u1,u2} = {w0,w1,w2:real^3}`); + (REWRITE_WITH `{u0,u1,u2} = {w0,w1,w2:real^3} <=> + {u0,u1,u2,u3} = {w0,w1,w2:real^3, w3}`); + (ASM_REWRITE_TAC[]); + +(* ========================================================================== *) + + (EQ_TAC); + (SET_TAC[]); + (MATCH_MP_TAC (SET_RULE `~(w3 IN {u0, u1, u2}) /\ ~ (w3 IN {w0, w1, w2}) ==> + ({u0, u1, u2, w3} = {w0, w1, w2, w3} ==> {u0, u1, u2} = {w0, w1, w2})`)); + (REPEAT STRIP_TAC); + (NEW_GOAL `set_of_list (ul:(real^3)list) = {u0,u1,u2}`); + (ASM_REWRITE_TAC[set_of_list]); + (UP_ASM_TAC THEN SET_TAC[]); + (NEW_GOAL `LENGTH ul = 3 + 1 /\ CARD (set_of_list (ul:(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD{u0,u1,u2:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (NEW_GOAL `CARD (set_of_list (ul:(real^3)list)) = CARD {u0, u1, u2:real^3}`); + (MATCH_MP_TAC Hypermap.lemma_card_eq_reflect THEN ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `set_of_list (xl:(real^3)list) = {w0,w1,w2}`); + (REWRITE_TAC[ASSUME `xl = [w0; w1; w2; w3:real^3]`;set_of_list]); + (UP_ASM_TAC THEN SET_TAC[]); + (NEW_GOAL `LENGTH xl = 3 + 1 /\ CARD (set_of_list (xl:(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD{w0,w1,w2:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (NEW_GOAL `CARD (set_of_list (xl:(real^3)list)) = CARD {w0, w1, w2:real^3}`); + (MATCH_MP_TAC Hypermap.lemma_card_eq_reflect THEN ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC); + + (REWRITE_WITH `{u0, u1, u2, u3:real^3} = set_of_list ul /\ + {w0, w1, w2, w3:real^3} = set_of_list xl`); + (REWRITE_TAC[ASSUME `xl = [w0; w1; w2; w3:real^3]`; set_of_list]); + (ASM_REWRITE_TAC[set_of_list]); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC SET_OF_LIST_LEFT_ACTION_LIST_2); + (REWRITE_TAC[LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`]); + (ASM_REWRITE_TAC[ARITH_RULE `2 <= 4 /\ 4 - 2 = 2`]); + (REWRITE_WITH `omega_list_n V ul 2 = circumcenter {u0,u1,u2:real^3} /\ + omega_list_n V xl 2 = circumcenter {w0,w1,w2:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC OMEGA_LIST_2_EXPLICIT_NEW); + (EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[IN]); + (REWRITE_WITH `[u0; u1; u2:real^3] = truncate_simplex 2 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC OMEGA_LIST_2_EXPLICIT_NEW); + (EXISTS_TAC `w3:real^3`); + (REWRITE_TAC[IN]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[HL; set_of_list]); + (ONCE_REWRITE_TAC[GSYM (ASSUME `{u0, u1, u2} = {w0, w1, w2:real^3}`)]); + (REWRITE_WITH `{u0, u1, u2} = set_of_list [u0;u1;u2:real^3]`); + (REWRITE_TAC[set_of_list]); + (ONCE_REWRITE_TAC[GSYM HL]); + (REWRITE_WITH `[u0; u1; u2:real^3] = truncate_simplex 2 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (ASM_REWRITE_TAC[]); + (AP_TERM_TAC); + (ASM_REWRITE_TAC[]); + +(* ===================================================================== *) + + (NEW_GOAL `omega_list_n V xl 3 = omega_list_n V (ul:(real^3)list) 3`); + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?w0 w1 w2 w3. xl = [w0;w1;w2;w3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (REWRITE_TAC[ARITH_RULE `3 = SUC 2`; Sphere.OMEGA_LIST_N]); + (REWRITE_TAC[ASSUME `omega_list_n V xl 2 = omega_list_n V ul 2`; ARITH_RULE `SUC 2 = 3`]); + (REWRITE_TAC[ASSUME `xl = [w0; w1; w2; w3:real^3]`; + ASSUME `ul = [u0:real^3; u1; u2; u3]`; + TRUNCATE_SIMPLEX_EXPLICIT_3; VORONOI_LIST; set_of_list]); + (REWRITE_WITH `{w0, w1, w2, w3} = {u0, u1, u2, u3:real^3}`); + (REWRITE_WITH `{w0:real^3, w1, w2, w3} = set_of_list xl /\ + {u0, u1, u2, u3:real^3} = set_of_list ul`); + (REWRITE_TAC[set_of_list; ASSUME `xl = [w0; w1; w2; w3:real^3]`; + ASSUME `ul = [u0:real^3; u1; u2; u3]`]); + (REWRITE_TAC[ASSUME `xl:(real^3)list = left_action_list p (ul:(real^3)list)`]); + (MATCH_MP_TAC SET_OF_LIST_LEFT_ACTION_LIST_2); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 4`); + (REWRITE_TAC[ARITH_RULE `4 = 3 + 1`]); + (NEW_GOAL `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3+ 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (ASM_REWRITE_TAC[ARITH_RULE `4 - 2 = 2 /\ 2 <= 4`]); + +(* ===================================================================== *) + + (NEW_GOAL `mxi V xl = mxi V (ul:(real^3)list)`); + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?w0 w1 w2 w3. xl = [w0;w1;w2;w3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `(?t. between t (omega_list_n V ul 2,omega_list_n V ul 3) /\ + dist (u0,t:real^3) = sqrt (&2) /\ + mxi V ul = t)`); + (MATCH_MP_TAC MXI_EXPLICIT); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `(?s. between s (omega_list_n V xl 2,omega_list_n V xl 3) /\ + dist (w0,s:real^3) = sqrt (&2) /\ + mxi V xl = s)`); + (MATCH_MP_TAC MXI_EXPLICIT); + (EXISTS_TAC `w1:real^3` THEN EXISTS_TAC `w2:real^3` THEN EXISTS_TAC `w3:real^3`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_WITH `hl (truncate_simplex 2 (xl:(real^3)list)) = + hl (truncate_simplex 2 (ul:(real^3)list))`); + (REWRITE_TAC[HL]); + (REWRITE_TAC[ASSUME `ul = [u0; u1; u2; u3:real^3]`; + ASSUME `xl = [w0; w1; w2; w3:real^3]`; TRUNCATE_SIMPLEX_EXPLICIT_2]); + (REWRITE_WITH `set_of_list [w0; w1; w2] = set_of_list [u0; u1; u2:real^3]`); + (REWRITE_TAC[set_of_list]); + (REWRITE_TAC[SET_EQ_LEMMA]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `x IN {w0, w1, w2, w3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC); + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list xl`); + (REWRITE_TAC[ASSUME `xl = [w0; w1; w2; w3:real^3]`; set_of_list]); + (REWRITE_TAC[IN_SET_OF_LIST]); + (REWRITE_WITH `MEM x xl <=> MEM (x:real^3) ul`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEM_LEFT_ACTION_LIST_2); + (REWRITE_WITH `LENGTH [u0; u1; u2; u3:real^3] = 4`); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `2 <= 4 /\ 4 - 2 = 2`]); + + (ASM_REWRITE_TAC[GSYM IN_SET_OF_LIST; set_of_list]); + (REWRITE_TAC[SET_RULE `x IN {a,b,c,d} <=> x = a \/ x = b \/ x = c \/ x = d`]); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (NEW_GOAL `F`); + (NEW_GOAL `u3:real^3 = EL 3 ul`); + (ASM_REWRITE_TAC[EL; TL; HD; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (UP_ASM_TAC THEN REWRITE_WITH `EL 3 (ul:(real^3)list) = EL (p 3) xl`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.EL_LEFT_ACTION_LIST); + (REWRITE_WITH `LENGTH [u0; u1; u2; u3:real^3] = 4`); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `2 <= 4 /\ 4 - 2 = 2`]); + (REWRITE_TAC[ARITH_RULE `4 - 1 = 3 /\ 3 < 4`]); + (MATCH_MP_TAC KY_PERMUTES_2_PERMUTES_3 ); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `(p:num->num) 3 = 3`); + (MP_TAC (ASSUME `p permutes 0..2`)); + (REWRITE_TAC[permutes; IN_NUMSEG]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + (REWRITE_TAC[ASSUME `xl = [w0; w1; w2; w3:real^3]`; EL; TL; HD; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (STRIP_TAC); + (NEW_GOAL `{w0, w1, w2} = {w0, w1, w2, w3:real^3}`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list xl`); + (REWRITE_TAC[ASSUME `xl = [w0; w1; w2; w3:real^3]`; set_of_list]); + (NEW_GOAL `CARD (set_of_list (xl:(real^3)list)) = 4`); + (REWRITE_WITH `LENGTH (xl:(real^3)list) = 3 + 1 /\ CARD (set_of_list xl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (STRIP_TAC); + (NEW_GOAL `CARD {w0, w1 , w2:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_MESON_TAC[ARITH_RULE `~(4 <= 3)`]); + (ASM_MESON_TAC[]); + + + (NEW_GOAL `x IN {u0, u1, u2, u3:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC); + (REWRITE_WITH `{u0, u1, u2, u3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_TAC[IN_SET_OF_LIST]); + (REWRITE_WITH `MEM x ul <=> MEM (x:real^3) xl`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEM_LEFT_ACTION_LIST_2); + (REWRITE_WITH `LENGTH [u0; u1; u2; u3:real^3] = 4`); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `2 <= 4 /\ 4 - 2 = 2`]); + (REWRITE_TAC[ASSUME `xl = [w0; w1; w2 ; w3:real^3]`; GSYM IN_SET_OF_LIST; set_of_list]); + (REWRITE_TAC[SET_RULE `x IN {a,b,c,d} <=> x = a \/ x = b \/ x = c \/ x = d`]); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (NEW_GOAL `F`); + (NEW_GOAL `w3:real^3 = EL 3 xl`); + (REWRITE_TAC[ASSUME `xl = [w0; w1; w2 ; w3:real^3]`; + EL; TL; HD; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + + (UP_ASM_TAC THEN REWRITE_WITH `EL 3 (xl:(real^3)list) = EL 3 ul`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `EL 3 xl = EL (p 3) (xl:(real^3)list)`); + (REWRITE_WITH `(p:num->num) 3 = 3`); + (MP_TAC (ASSUME `p permutes 0..2`)); + (REWRITE_TAC[permutes; IN_NUMSEG]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.EL_LEFT_ACTION_LIST); + (REWRITE_WITH `LENGTH [u0; u1; u2; u3:real^3] = 4`); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (REWRITE_TAC[ARITH_RULE `4 - 1 = 3 /\ 3 < 4`]); + (MATCH_MP_TAC KY_PERMUTES_2_PERMUTES_3 ); + (ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[EL; TL; HD; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (STRIP_TAC); + (NEW_GOAL `{u0, u1, u2} = {u0, u1, u2, u3:real^3}`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH `{u0, u1, u2, u3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (NEW_GOAL `CARD (set_of_list (ul:(real^3)list)) = 4`); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (STRIP_TAC); + (NEW_GOAL `CARD {u0, u1 , u2:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (ASM_MESON_TAC[ARITH_RULE `~(4 <= 3)`]); + (ASM_MESON_TAC[]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[HL]); + (REWRITE_WITH `set_of_list (xl:(real^3)list) = set_of_list ul`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SET_OF_LIST_LEFT_ACTION_LIST_2); + (REWRITE_WITH `LENGTH [u0; u1; u2; u3:real^3] = 4`); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0; u1; u2; u3:real^3]`)]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (REWRITE_TAC[ARITH_RULE `4 - 2 = 2 /\ 2 <= 4`]); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[GSYM HL]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (UNDISCH_TAC + `between s (omega_list_n V (xl:(real^3)list) 2,omega_list_n V xl 3)` + THEN REWRITE_TAC[ + ASSUME `omega_list_n V (xl:(real^3)list) 2 = omega_list_n V ul 2`; + ASSUME `omega_list_n V (xl:(real^3)list) 3 = omega_list_n V ul 3`] + THEN DISCH_TAC); + (ABBREV_TAC `s2:real^3 = omega_list_n V (ul:(real^3)list) 2`); + (ABBREV_TAC `s3:real^3 = omega_list_n V (ul:(real^3)list) 3`); + (ASM_REWRITE_TAC[]); + +(* ========================================================================== *) + + (ABBREV_TAC `zl = [u0; u1; u2:real^3]`); + (NEW_GOAL `zl = truncate_simplex 2 (ul:(real^3)list)`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (NEW_GOAL `barV V 2 zl`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3:num` THEN REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (REWRITE_WITH `[u0; u1; u2; u3:real^3] = ul`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `s2:real^3 = circumcenter (set_of_list zl)`); + (EXPAND_TAC "s2"); + (REWRITE_WITH `omega_list_n V ul 2 = omega_list V zl`); + (EXPAND_TAC "zl"); + (REWRITE_TAC[ASSUME `ul = [u0;u1;u2;u3:real^3]` ; OMEGA_LIST_TRUNCATE_2]); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `2`); + (ASM_REWRITE_TAC[IN]); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `(t - s2:real^3) dot (u0 - s2) = &0`); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + +(* ========================================================================== *) + + (MP_TAC (ASSUME `between t (s2, s3:real^3)`)); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL]); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ONCE_REWRITE_TAC[GSYM IN]); + (REWRITE_TAC[ASSUME `t = u % s2 + v % s3:real^3`]); + (NEW_GOAL `affine (affine hull voronoi_list V zl)`); + (REWRITE_TAC[AFFINE_AFFINE_HULL]); + (UP_ASM_TAC THEN REWRITE_TAC[affine]); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + + (NEW_GOAL `affine hull voronoi_list V zl INTER + affine hull set_of_list zl = {s2:real^3}`); + (REWRITE_TAC[ASSUME `s2:real^3 = circumcenter (set_of_list zl)`]); + (MATCH_MP_TAC Rogers.MHFTTZN3); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `s3:real^3 IN voronoi_list V zl`); + (NEW_GOAL `s3:real^3 IN voronoi_list V ul`); + (REWRITE_TAC[GSYM (ASSUME `omega_list_n V ul 3 = s3:real^3`)]); + (REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `3 = SUC 2`]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3; ARITH_RULE `SUC 2 = 3`]); + (MATCH_MP_TAC CLOSEST_POINT_IN_SET); + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); + (NEW_GOAL `voronoi_nondg V (ul:(real^3)list)`); + (MP_TAC (ASSUME `barV V 3 ul`) THEN REWRITE_TAC[BARV]); + (STRIP_TAC THEN FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `0 < 3 + 1`; Packing3.INITIAL_SUBLIST_REFL]); + (UP_ASM_TAC THEN REWRITE_TAC[VORONOI_NONDG]); + (STRIP_TAC); + (NEW_GOAL `aff_dim (voronoi_list V ul) = &0`); + (UP_ASM_TAC THEN MATCH_MP_TAC (ARITH_RULE `a = (&4:int) ==> + (x + a = &4 ==> x = &0)`)); + (REWRITE_TAC[INT_OF_NUM_EQ]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[AFF_DIM_EQ_0]); + (SET_TAC[]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; VORONOI_LIST; + set_of_list; VORONOI_SET]); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> (x IN A ==> x IN B)`)); + (SET_TAC[]); + (STRIP_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[IN_AFFINE_KY_LEMMA1]); + (ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (NEW_GOAL `u0 IN {u0, u1, u2:real^3}`); + (SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_AFFINE_KY_LEMMA1]); + + (NEW_GOAL `(s - s2:real^3) dot (w0 - s2) = &0`); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (MP_TAC (ASSUME `between s (s2, s3:real^3)`)); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL]); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ONCE_REWRITE_TAC[GSYM IN]); + (REWRITE_TAC[ASSUME `s = u % s2 + v % s3:real^3`]); + (NEW_GOAL `affine (affine hull voronoi_list V zl)`); + (REWRITE_TAC[AFFINE_AFFINE_HULL]); + (UP_ASM_TAC THEN REWRITE_TAC[affine]); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + + (NEW_GOAL `affine hull voronoi_list V zl INTER + affine hull set_of_list zl = {s2:real^3}`); + (REWRITE_TAC[ASSUME `s2:real^3 = circumcenter (set_of_list zl)`]); + (MATCH_MP_TAC Rogers.MHFTTZN3); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `s3:real^3 IN voronoi_list V zl`); + (NEW_GOAL `s3:real^3 IN voronoi_list V ul`); + (REWRITE_TAC[GSYM (ASSUME `omega_list_n V ul 3 = s3:real^3`)]); + (REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `3 = SUC 2`]); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3; ARITH_RULE `SUC 2 = 3`]); + (MATCH_MP_TAC CLOSEST_POINT_IN_SET); + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); + (NEW_GOAL `voronoi_nondg V (ul:(real^3)list)`); + (MP_TAC (ASSUME `barV V 3 ul`) THEN REWRITE_TAC[BARV]); + (STRIP_TAC THEN FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `0 < 3 + 1`; Packing3.INITIAL_SUBLIST_REFL]); + (UP_ASM_TAC THEN REWRITE_TAC[VORONOI_NONDG]); + (STRIP_TAC); + (NEW_GOAL `aff_dim (voronoi_list V ul) = &0`); + (UP_ASM_TAC THEN MATCH_MP_TAC (ARITH_RULE `a = (&4:int) ==> + (x + a = &4 ==> x = &0)`)); + (REWRITE_TAC[INT_OF_NUM_EQ]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[AFF_DIM_EQ_0]); + (SET_TAC[]); + + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; VORONOI_LIST; + set_of_list; VORONOI_SET]); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> (x IN A ==> x IN B)`)); + (SET_TAC[]); + (STRIP_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[IN_AFFINE_KY_LEMMA1]); + (ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC IN_AFFINE_KY_LEMMA1); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (MATCH_MP_TAC (SET_RULE `w0 IN {u0, u1, u2, u3:real^3} /\ ~(w0= u3) ==> + w0 IN {u0, u1, u2}`)); + (REWRITE_WITH `{u0, u1, u2, u3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `set_of_list ul = set_of_list (xl:(real^3)list)`); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC SET_OF_LIST_LEFT_ACTION_LIST_2); + (REWRITE_WITH `LENGTH [u0; u1; u2; u3:real^3] = 4`); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `2 <= 4 /\ 4 - 2 = 2`]); + (REWRITE_TAC[ASSUME `xl = [w0;w1;w2;w3:real^3]`; set_of_list]); + (REPEAT STRIP_TAC); + (SET_TAC[]); + (NEW_GOAL `w3 = u3:real^3`); + (REWRITE_WITH `w3:real^3 = EL (p 3) xl /\ u3:real^3 = EL 3 ul`); + (STRIP_TAC); + (REWRITE_WITH `(p:num->num) 3 = 3`); + (MP_TAC (ASSUME `p permutes 0..2`)); + (REWRITE_TAC[permutes; IN_NUMSEG]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + (REWRITE_TAC[ASSUME `xl = [w0; w1; w2 ; w3:real^3]`; + EL; TL; HD; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (ASM_REWRITE_TAC[EL; TL; HD; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.EL_LEFT_ACTION_LIST); + (REWRITE_WITH `LENGTH [u0; u1; u2; u3:real^3] = 4`); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `3 < 4 /\ 4 - 1 = 3`]); + (MATCH_MP_TAC KY_PERMUTES_2_PERMUTES_3); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `CARD {w0, w1, w2, w3:real^3} <= 3`); + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = {w0, w1, w2}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (NEW_GOAL `CARD {w0, w1, w2, w3:real^3} = 3 + 1`); + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list xl`); + (ASM_MESON_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (xl:(real^3)list) = 3 + 1 /\ CARD (set_of_list xl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `dist (u0:real^3, t) pow 2 = dist (s2, t) pow 2 + dist (u0, s2) pow 2`); + (REWRITE_TAC[dist]); + (MATCH_MP_TAC PYTHAGORAS); + (ASM_REWRITE_TAC[orthogonal]); + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `dist (u0,t:real^3) = sqrt (&2)`]); + (STRIP_TAC); + + + (NEW_GOAL `dist (w0:real^3, s) pow 2 = dist (s2, s) pow 2 + dist (w0, s2) pow 2`); + (REWRITE_TAC[dist]); + (MATCH_MP_TAC PYTHAGORAS); + (ASM_REWRITE_TAC[orthogonal]); + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `dist (w0,s:real^3) = sqrt (&2)`]); + (STRIP_TAC); + + (NEW_GOAL `dist (s2,t:real^3) pow 2 + dist (u0,s2) pow 2 = + dist (s2,s) pow 2 + dist (w0,s2) pow 2`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_WITH `dist (u0,s2:real^3) = dist (w0, s2)`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (NEW_GOAL `!w:real^3. w IN set_of_list zl ==> dist (s2,w) = hl zl`); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `zl:(real^3)list = truncate_simplex 2 ul`)]); + (MATCH_MP_TAC Rogers.HL_PROPERTIES); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2` THEN ASM_REWRITE_TAC[]); + (REWRITE_WITH `dist (s2,u0) = hl (zl:(real^3)list) /\ + dist (s2,w0:real^3) = hl zl`); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list] THEN SET_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (MATCH_MP_TAC (SET_RULE `w0 IN {u0, u1, u2, u3:real^3} /\ ~(w0= u3) ==> + w0 IN {u0, u1, u2}`)); + (REWRITE_WITH `{u0, u1, u2, u3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `set_of_list ul = set_of_list (xl:(real^3)list)`); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC SET_OF_LIST_LEFT_ACTION_LIST_2); + (REWRITE_WITH `LENGTH [u0; u1; u2; u3:real^3] = 4`); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `2 <= 4 /\ 4 - 2 = 2`]); + (REWRITE_TAC[ASSUME `xl = [w0;w1;w2;w3:real^3]`; set_of_list]); + (REPEAT STRIP_TAC); + (SET_TAC[]); + (NEW_GOAL `w3 = u3:real^3`); + (REWRITE_WITH `w3:real^3 = EL (p 3) xl /\ u3:real^3 = EL 3 ul`); + (STRIP_TAC); + (REWRITE_WITH `(p:num->num) 3 = 3`); + (MP_TAC (ASSUME `p permutes 0..2`)); + (REWRITE_TAC[permutes; IN_NUMSEG]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ARITH_TAC); + (REWRITE_TAC[ASSUME `xl = [w0; w1; w2 ; w3:real^3]`; + EL; TL; HD; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (ASM_REWRITE_TAC[EL; TL; HD; + ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.EL_LEFT_ACTION_LIST); + (REWRITE_WITH `LENGTH [u0; u1; u2; u3:real^3] = 4`); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `3 < 4 /\ 4 - 1 = 3`]); + (MATCH_MP_TAC KY_PERMUTES_2_PERMUTES_3); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `CARD {w0, w1, w2, w3:real^3} <= 3`); + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = {w0, w1, w2}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (NEW_GOAL `CARD {w0, w1, w2, w3:real^3} = 3 + 1`); + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list xl`); + (ASM_MESON_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (xl:(real^3)list) = 3 + 1 /\ CARD (set_of_list xl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH `a + b = c + b <=> a = c`]); + (STRIP_TAC); + (NEW_GOAL `dist (s2, t:real^3) = dist (s2, s)`); + (REWRITE_WITH `dist (s2, t:real^3) = dist (s2, s) <=> + dist (s2, t:real^3) pow 2 = dist (s2, s) pow 2`); + (MATCH_MP_TAC Trigonometry2.EQ_POW2_COND); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `between s (s2,s3:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `between t (s2,s3:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `dist (s2,t:real^3) = dist (s2,s)`); + (REWRITE_TAC[dist; ASSUME `s = u % s2 + v % (s3:real^3)`; + ASSUME `t:real^3 = u' % s2 + v' % s3`]); + (REWRITE_WITH `s2:real^3 - (u' % s2 + v' % s3) = + (u' + v') % s2 - (u' % s2 + v' % s3)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (REWRITE_WITH `s2:real^3 - (u % s2 + v % s3) = + (u + v) % s2 - (u % s2 + v % s3)`); + (ASM_REWRITE_TAC[VECTOR_MUL_LID]); + (REWRITE_TAC[VECTOR_ARITH `(a + b) % s2 - (a % s2 + b % s3) = b % (s2 - s3)`; + NORM_MUL; REAL_ARITH `x * y = z * y <=> (x - z) * y = &0`; REAL_ENTIRE]); + (REWRITE_WITH `abs v' = v' /\ abs v = v`); + (ASM_REWRITE_TAC[REAL_ABS_REFL]); + (STRIP_TAC); + (NEW_GOAL `u = u':real /\ v = v':real`); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[NORM_EQ_0; + VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (STRIP_TAC); + (NEW_GOAL `?a. voronoi_list V ul = {a:real^3} /\ + a = circumcenter (set_of_list ul) /\ + hl ul = dist (HD ul,a)`); + (MATCH_MP_TAC VORONOI_LIST_3_SINGLETON_EXPLICIT); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `(s3:real^3) IN voronoi_list V ul`); + (REWRITE_TAC [GSYM (ASSUME `omega_list_n V xl 3 = s3:real^3`)]); + (REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `3 = SUC 2`]); + (REWRITE_WITH `truncate_simplex (SUC 2) xl = (xl:(real^3)list)`); + (REWRITE_TAC[ASSUME `xl = [w0;w1;w2;w3:real^3]`; + TRUNCATE_SIMPLEX_EXPLICIT_3; ARITH_RULE `SUC 2 = 3`]); + (REWRITE_WITH `voronoi_list V xl = voronoi_list V (ul:(real^3)list)`); + (REWRITE_TAC[VORONOI_LIST]); + (AP_TERM_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SET_OF_LIST_LEFT_ACTION_LIST_2); + (REWRITE_WITH `LENGTH [u0; u1; u2; u3:real^3] = 4`); + (REWRITE_TAC[GSYM (ASSUME `ul = [u0;u1;u2;u3:real^3]`)]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `2 <= 4 /\ 4 - 2 = 2`]); + (MATCH_MP_TAC CLOSEST_POINT_IN_SET); + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); + (ASM_SET_TAC[]); + (NEW_GOAL `s3:real^3 = circumcenter (set_of_list ul)`); + (ASM_SET_TAC[]); + + (NEW_GOAL `(!w:real^3. w IN set_of_list ul + ==> dist (circumcenter (set_of_list ul),w) = hl ul)`); + (MATCH_MP_TAC Rogers.HL_PROPERTIES); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `dist (s3, u0:real^3) = hl (ul:(real^3)list)`); + (REWRITE_TAC[ASSUME `s3:real^3 = circumcenter (set_of_list ul)`]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + + (NEW_GOAL `(!w:real^3. w IN set_of_list zl + ==> dist (circumcenter (set_of_list zl),w) = hl zl)`); + (MATCH_MP_TAC Rogers.HL_PROPERTIES); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `dist (s2, u0:real^3) = hl (zl:(real^3)list)`); + (REWRITE_TAC[ASSUME `s2:real^3 = circumcenter (set_of_list zl)`]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list] THEN SET_TAC[]); + (NEW_GOAL `hl (ul:(real^3)list) = hl (zl:(real^3)list)`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `zl = + truncate_simplex 2 (ul:(real^3)list)`]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[])]);; + +(* ======================================================================== *) +(* Lemma 75 *) + +let MEM_LEFT_ACTION_LIST_3 = prove_by_refinement ( + `!(ul:(A)list) p x. + 3 <= LENGTH ul /\ p permutes (0..LENGTH ul - 3) + ==> (MEM x (left_action_list p ul) <=> MEM x ul)`, +[(REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[MEM_EXISTS_EL; Packing3.LENGTH_LEFT_ACTION_LIST]); + (EQ_TAC); + (STRIP_TAC); + (POP_ASSUM MP_TAC); + (ASM_SIMP_TAC[left_action_list; Packing3.EL_TABLE]); + (DISCH_TAC); + (ASM_CASES_TAC `i < LENGTH (ul:(A)list) - 2`); + (EXISTS_TAC `inverse (p:num->num) i`); + (REWRITE_TAC[]); + (ABBREV_TAC `n = LENGTH (ul:(A)list) - 2`); + (MP_TAC (ISPECL [`p:num->num`; `0..n-1`] PERMUTES_INVERSE)); + (ASM_REWRITE_TAC[] THEN DISCH_TAC); + (UNDISCH_TAC `p permutes 0..LENGTH (ul:(A)list) - 3`); + (REWRITE_WITH `LENGTH (ul:(A)list) - 3 = n -1`); + (ASM_ARITH_TAC); + (DISCH_TAC); + (NEW_GOAL `inverse p permutes 0..n - 1`); + (ASM_MESON_TAC[]); + (MP_TAC (ISPECL [`inverse (p:num->num)`; `0..n-1`] Hypermap_and_fan.PERMUTES_IMP_INSIDE)); + (ASM_REWRITE_TAC[]); + (DISCH_THEN (MP_TAC o SPEC `i:num`)); + (ASM_SIMP_TAC[IN_NUMSEG; ARITH_RULE `i < n ==> i <= n - 1`; LE_0]); + (ASM_ARITH_TAC); + +(* ====================================================================== *) + + (EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (ABBREV_TAC `n = LENGTH (ul:(A)list)`); + (NEW_GOAL `(inverse p) permutes 0..n-3`); + (ASM_MESON_TAC[PERMUTES_INVERSE]); + (UP_ASM_TAC THEN REWRITE_TAC[permutes]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `inverse p (i:num) = i`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN_NUMSEG]); + (STRIP_TAC); + (ASM_ARITH_TAC); + +(* ====================================================================== *) + + (STRIP_TAC); + (ASM_CASES_TAC `i < LENGTH (ul:(A)list) - 2`); + (EXISTS_TAC `(p:num->num) i`); + (NEW_GOAL `p (i:num) < LENGTH (ul:(A)list)`); + (UNDISCH_TAC `p permutes 0..LENGTH (ul:(A)list) - 3`); + (REWRITE_TAC[permutes]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `p (i:num) >= LENGTH (ul:(A)list)`); + (NEW_GOAL `p ((p:num->num) (i:num)) = p i`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN_NUMSEG_0]); + (ASM_ARITH_TAC); + (UNDISCH_TAC `!y. ?!x. (p:num->num) x = y`); + (REWRITE_TAC[EXISTS_UNIQUE]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?x. p x = (p:num->num) i /\ (!y'. p y' = p i ==> y' = x)`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `i = x':num`); + (FIRST_ASSUM MATCH_MP_TAC); + (REFL_TAC); + (NEW_GOAL `(p:num->num) i = x':num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_MESON_TAC[]); + (NEW_GOAL `i >= LENGTH (ul:(A)list)`); + (ASM_ARITH_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + (ASM_SIMP_TAC[left_action_list; Packing3.EL_TABLE]); + (REWRITE_WITH `inverse (p:num->num) (p i) = i`); + (ASM_MESON_TAC[PERMUTES_INVERSES]); + + + (EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (ABBREV_TAC `n = LENGTH (ul:(A)list)`); + (ASM_SIMP_TAC[left_action_list; Packing3.EL_TABLE]); + (REWRITE_WITH `inverse (p:num->num) i = i`); + (NEW_GOAL `(inverse p) permutes 0..n-3`); + (ASM_MESON_TAC[PERMUTES_INVERSE]); + (UP_ASM_TAC THEN REWRITE_TAC[permutes]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN_NUMSEG_0]); + (ASM_ARITH_TAC)]);; + +(* ====================================================================== *) +(* Lemma 76 *) +let SET_OF_LIST_LEFT_ACTION_LIST_3 = prove( + `!(ul:(A)list) p. 3 <= LENGTH ul /\ p permutes 0..LENGTH ul - 3 + ==> set_of_list (left_action_list p ul) = set_of_list ul`, + REPEAT STRIP_TAC THEN REWRITE_TAC[EXTENSION; IN_SET_OF_LIST] THEN + ASM_SIMP_TAC[MEM_LEFT_ACTION_LIST_3]);; + +(* ====================================================================== *) +(* Lemma 77 *) + + +let LEFT_ACTION_LIST_1_EXPLICIT = prove_by_refinement ( + `!ul u0 u1 u2 u3 p. packing V /\ barV V 3 ul /\ + ul = [u0;u1;u2;u3:real^3] /\ p permutes 0..1 ==> + (left_action_list p ul = ul \/ + left_action_list p ul = [u1;u0; u2;u3])`, +[(REPEAT GEN_TAC THEN DISCH_TAC); + (ASM_CASES_TAC `left_action_list p (ul: (real^3)list) = ul`); + (ASM_REWRITE_TAC[]); + (DISJ2_TAC); + (REWRITE_TAC[left_action_list]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 4`); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[TABLE_4]); + + (NEW_GOAL `!i. i IN 2..3 ==> inverse p i = i`); + (NEW_GOAL `(inverse p) permutes 0..1`); + (ASM_MESON_TAC[PERMUTES_INVERSE]); + (UP_ASM_TAC THEN REWRITE_TAC[permutes]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[IN_NUMSEG]); + (ASM_ARITH_TAC); + (NEW_GOAL `2 IN 2..3 /\ 3 IN 2..3`); + (REWRITE_TAC[IN_NUMSEG]); + (ASM_ARITH_TAC); + (ASM_SIMP_TAC[EL; TL; ARITH_RULE `2 = SUC 1 /\ 3 = SUC 2 /\ 1 = SUC 0`; HD]); + + + (REWRITE_TAC[ARITH_RULE `SUC 0 = 1`]); + (REWRITE_WITH `inverse p 0 = 1 /\ inverse p 1 = 0`); + (NEW_GOAL `(inverse p) permutes 0..1`); + (ASM_MESON_TAC[PERMUTES_INVERSE]); + (UP_ASM_TAC THEN REWRITE_TAC[permutes]); + (STRIP_TAC); + (ASM_CASES_TAC `inverse p 0 = 1`); + (ASM_REWRITE_TAC[]); + + (ABBREV_TAC `y:num = inverse p 1`); + (NEW_GOAL `?!x:num. inverse p x = y:num`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[EXISTS_UNIQUE]); + (STRIP_TAC); + (ASM_CASES_TAC `~(y IN 0..1)`); + (NEW_GOAL `inverse p y = y:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `y = x:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `1 = x:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `y = 1`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `?!x:num. inverse p x = 1`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[EXISTS_UNIQUE]); + (STRIP_TAC); + (NEW_GOAL `0 = x'`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `1 = x'`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[MESON[] `~ ~ s = s`; IN_NUMSEG_0]); + (DISCH_TAC); + (ASM_CASES_TAC `y = 1`); + + (NEW_GOAL `?!x:num. inverse p x = 1`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[EXISTS_UNIQUE]); + (STRIP_TAC); + (NEW_GOAL `0 = x'`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `1 = x'`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + (NEW_GOAL `F`); + +(* ========================= *) + + + (NEW_GOAL `inverse p 0 = 0 /\ inverse p 1 = 1`); + (ABBREV_TAC `y:num = inverse p 0`); + (ASM_CASES_TAC `~(y IN 0..1)`); + (NEW_GOAL `inverse p y = y:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?!x:num. inverse p x = y:num`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[EXISTS_UNIQUE]); + (STRIP_TAC); + (NEW_GOAL `y = x:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `0 = x:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_MESON_TAC[]); + (NEW_GOAL `y = 1`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `y = 0`); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `~(y IN 0..1)`); + (REWRITE_TAC[IN_NUMSEG_0]); + (ASM_ARITH_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (UP_ASM_TAC THEN REWRITE_TAC[MESON[] `~ ~ s = s`; IN_NUMSEG_0]); + (DISCH_TAC); + + (NEW_GOAL`y = 0`); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (ABBREV_TAC `z:num = inverse p 1`); + (ASM_CASES_TAC `~(z IN 0..1)`); + (NEW_GOAL `inverse p z = z:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?!x:num. inverse p x = z:num`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[EXISTS_UNIQUE]); + (STRIP_TAC); + (NEW_GOAL `z = x:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `1 = x`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[MESON[] `~ ~ s = s`; IN_NUMSEG_0]); + (DISCH_TAC); + + (ASM_CASES_TAC `z = 0`); + (NEW_GOAL `?!x:num. inverse p x = 0`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[EXISTS_UNIQUE]); + (STRIP_TAC); + (NEW_GOAL `1 = x:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `0 = x`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + + (UNDISCH_TAC `~(left_action_list p ul = ul:(real^3)list)`); + (REWRITE_TAC[]); + (REWRITE_TAC[left_action_list]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 4`); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[TABLE_4]); + (NEW_GOAL `2 IN 2..3 /\ 3 IN 2..3`); + (REWRITE_TAC[IN_NUMSEG]); + (ASM_ARITH_TAC); + (ASM_SIMP_TAC[EL; TL; ARITH_RULE `2 = SUC 1 /\ 3 = SUC 2 /\ 1 = SUC 0`; HD]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[EL; TL; ARITH_RULE `2 = SUC 1 /\ 3 = SUC 2 /\ 1 = SUC 0`; HD])]);; + + +(* ====================================================================== *) +(* Lemma 78 *) +(* ======================================================================= *) + +let LEFT_ACTION_LIST_1_PROPERTIES = prove_by_refinement ( + `!V ul p. + packing V /\ + saturated V /\ + barV V 3 ul /\ + p permutes 0..1 /\ + hl (truncate_simplex 1 ul) < sqrt (&2) /\ + sqrt (&2) <= hl ul /\ + xl = left_action_list p ul + ==> xl IN barV V 3 /\ + omega_list_n V xl 1 = omega_list_n V ul 1 /\ + omega_list_n V xl 2 = omega_list_n V ul 2 /\ + omega_list_n V xl 3 = omega_list_n V ul 3 /\ + mxi V xl = mxi V ul`, +[(REPEAT GEN_TAC THEN STRIP_TAC); + (ASM_CASES_TAC `xl = ul:(real^3)list`); + (REWRITE_TAC[ASSUME `xl = ul:(real^3)list`]); + (ASM_REWRITE_TAC[IN]); + (NEW_GOAL `?u0 u1 u2 u3:real^3. ul = [u0;u1;u2;u3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `xl = [u1;u0;u2;u3:real^3]`); + (NEW_GOAL `xl = ul \/ xl = [u1; u0; u2; u3:real^3]`); + (REWRITE_TAC[ASSUME `xl = left_action_list p (ul:(real^3)list)`]); + (MATCH_MP_TAC LEFT_ACTION_LIST_1_EXPLICIT); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (NEW_GOAL `[u1; u0; u2; u3] IN barV V 3`); + (REWRITE_TAC[IN; Sphere.BARV]); + (REWRITE_TAC[LENGTH; ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 3 + 1`]); + (GEN_TAC); + (ASM_CASES_TAC `LENGTH (vl:(real^3)list) = 1`); + (STRIP_TAC); + (NEW_GOAL `vl:(real^3)list = [HD vl]`); + (ASM_SIMP_TAC [Packing3.LENGTH_1_LEMMA]); + (NEW_GOAL `HD vl = HD ([u1; u0; u2; u3:real^3])`); + (MATCH_MP_TAC Packing3.HD_INITIAL_SUBLIST); + (ASM_REWRITE_TAC[]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[HD]); + (DISCH_TAC THEN SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (DISCH_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[VORONOI_NONDG; LENGTH; set_of_list; ARITH_RULE `SUC 0 < 5`; + Packing3.VORONOI_LIST_SING]); + (STRIP_TAC); + (NEW_GOAL `set_of_list (ul:(real^3)list) SUBSET V`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (REWRITE_WITH `aff_dim (voronoi_closed V (u1:real^3)) = &3`); + (MATCH_MP_TAC Packing3.AFF_DIM_VORONOI_CLOSED); + (ASM_MESON_TAC[]); + (ARITH_TAC); + + (ABBREV_TAC `k = LENGTH (vl:(real^3)list)`); + (ABBREV_TAC `zl = truncate_simplex (k - 1) (ul:(real^3)list)`); + (REWRITE_TAC[VORONOI_NONDG]); + (REPEAT STRIP_TAC); + (NEW_GOAL `LENGTH (vl:(real^3)list) <= LENGTH ([u1; u0; u2; u3:real^3])`); + (ASM_SIMP_TAC[Packing3.INITIAL_SUBLIST_LENGTH_LE]); + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH]); + (ARITH_TAC); + (NEW_GOAL `set_of_list vl SUBSET set_of_list [u1;u0;u2;u3:real^3]`); + (ASM_SIMP_TAC[Packing3.SET_OF_LIST_INITIAL_SUBLIST_SUBSET]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list]); + (ONCE_REWRITE_TAC[SET_RULE `{u1,u0,u2,u3:real^3} = {u0,u1,u2,u3}`]); + (REWRITE_WITH `{u0, u1, u2, u3:real^3} = set_of_list ul`); + (ASM_REWRITE_TAC[set_of_list]); + (NEW_GOAL `set_of_list ul SUBSET (V:real^3->bool)`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + + + (REWRITE_WITH `voronoi_list V vl = voronoi_list V (zl:(real^3)list)`); + (REWRITE_TAC[VORONOI_LIST]); + (REWRITE_WITH `set_of_list vl = set_of_list (zl:(real^3)list)`); + + (ASM_CASES_TAC `k = 2`); + (UNDISCH_TAC `truncate_simplex (k-1) ul = zl:(real^3)list`); + (ASM_REWRITE_TAC[ARITH_RULE `2 - 1 = 1`; TRUNCATE_SIMPLEX_EXPLICIT_1]); + (DISCH_TAC); + (NEW_GOAL `truncate_simplex 1 [u1; u0; u2; u3:real^3] = vl:(real^3)list /\ + 1 + 1 <= LENGTH [u1; u0; u2; u3]`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[ARITH_RULE `1 + 1 = 2`]); + (UP_ASM_TAC THEN REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (STRIP_TAC); + (REWRITE_TAC[GSYM (ASSUME `[u0;u1:real^3] = zl`); + GSYM (ASSUME `[u1;u0:real^3] = vl`); set_of_list]); + (SET_TAC[]); + + (ASM_CASES_TAC `k = 3`); + (UNDISCH_TAC `truncate_simplex (k-1) ul = zl:(real^3)list`); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2]); + (DISCH_TAC); + (NEW_GOAL `truncate_simplex 2 [u1; u0; u2; u3:real^3] = vl:(real^3)list /\ + 2 + 1 <= LENGTH [u1; u0; u2; u3]`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[ARITH_RULE `2 + 1 = 3`]); + (UP_ASM_TAC THEN REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2]); + (STRIP_TAC); + (REWRITE_TAC[GSYM (ASSUME `[u0;u1;u2:real^3] = zl`); + GSYM (ASSUME `[u1;u0;u2:real^3] = vl`); set_of_list]); + (SET_TAC[]); + + (ASM_CASES_TAC `k = 4`); + (UNDISCH_TAC `truncate_simplex (k-1) ul = zl:(real^3)list`); + (ASM_REWRITE_TAC[ARITH_RULE `4 - 1 = 3`; TRUNCATE_SIMPLEX_EXPLICIT_3]); + (DISCH_TAC); + (NEW_GOAL `truncate_simplex 3 [u1; u0; u2; u3:real^3] = vl:(real^3)list /\ + 3 + 1 <= LENGTH [u1; u0; u2; u3]`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[ARITH_RULE `3 + 1 = 4`]); + (UP_ASM_TAC THEN REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3]); + (STRIP_TAC); + (REWRITE_TAC[GSYM (ASSUME `[u0;u1;u2;u3:real^3] = zl`); + GSYM (ASSUME `[u1;u0;u2;u3:real^3] = vl`); set_of_list]); + (SET_TAC[]); + + (NEW_GOAL `LENGTH (vl:(real^3)list) <= LENGTH ([u1; u0; u2; u3:real^3])`); + (ASM_SIMP_TAC[Packing3.INITIAL_SUBLIST_LENGTH_LE]); + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH]); + (STRIP_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `LENGTH (vl:(real^3)list) = LENGTH (zl:(real^3)list)`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `truncate_simplex (k - 1) ul = zl:(real^3)list`)]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (NEW_GOAL `(k - 1) + 1 = k`); + (ASM_ARITH_TAC); + (REWRITE_WITH + `LENGTH (truncate_simplex (k - 1) (ul:(real^3)list)) = (k -1) + 1`); + (MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `LENGTH (vl:(real^3)list) <= LENGTH ([u1; u0; u2; u3:real^3])`); + (ASM_SIMP_TAC[Packing3.INITIAL_SUBLIST_LENGTH_LE]); + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH]); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (UNDISCH_TAC `barV V 3 ul` THEN REWRITE_TAC[BARV; VORONOI_NONDG]); + (STRIP_TAC); + (REWRITE_WITH `LENGTH (zl:(real^3)list) < 5 /\ + set_of_list zl SUBSET V /\ + aff_dim (voronoi_list V zl) + &(LENGTH zl) = &4`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_WITH `initial_sublist zl (ul:(real^3)list) /\ LENGTH zl = (k-1) + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `k -1 + 1 = k`); + (ASM_ARITH_TAC); + + (NEW_GOAL `LENGTH (vl:(real^3)list) <= LENGTH ([u1; u0; u2; u3:real^3])`); + (ASM_SIMP_TAC[Packing3.INITIAL_SUBLIST_LENGTH_LE]); + (UP_ASM_TAC THEN REWRITE_TAC[LENGTH]); + (ASM_ARITH_TAC); + (REWRITE_WITH `k -1 + 1 = k`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + + (NEW_GOAL `omega_list_n V [u1; u0; u2; u3:real^3] 1 = omega_list_n V ul 1`); + (REWRITE_WITH + `omega_list_n V [u1; u0; u2; u3] 1 = circumcenter {u1, u0:real^3}`); + (MATCH_MP_TAC OMEGA_LIST_1_EXPLICIT_NEW); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[HL;set_of_list]); + (ONCE_REWRITE_TAC[SET_RULE `{u1,u0} = {u0,u1}`]); + (REWRITE_WITH `radV {u0,u1:real^3} = + hl (truncate_simplex 1 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[HL; set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `omega_list_n V ul 1 = circumcenter {u0, u1:real^3}`); + (MATCH_MP_TAC OMEGA_LIST_1_EXPLICIT_NEW); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (REWRITE_TAC[IN]); + (ASM_REWRITE_TAC[HL;set_of_list]); + (REWRITE_WITH `radV {u0,u1:real^3} = + hl (truncate_simplex 1 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[HL; set_of_list; TRUNCATE_SIMPLEX_EXPLICIT_1]); + (ASM_REWRITE_TAC[]); + (AP_TERM_TAC); + (SET_TAC[]); + + + + (NEW_GOAL `omega_list_n V [u1; u0; u2; u3:real^3] 2 = omega_list_n V ul 2`); + (REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `2 = SUC 1`]); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2; VORONOI_LIST; set_of_list]); + (REWRITE_TAC[SET_RULE `{a,b,c} = {b,a,c}`]); + + (NEW_GOAL `omega_list_n V [u1; u0; u2; u3:real^3] 3 = omega_list_n V ul 3`); + (REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `3 = SUC 2`]); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 2 = 3`; TRUNCATE_SIMPLEX_EXPLICIT_3; VORONOI_LIST; set_of_list]); + (REWRITE_TAC[SET_RULE `{a,b,c,d} = {b,a,c,d}`]); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `hl (truncate_simplex 2 (ul:(real^3)list)) >= sqrt (&2)`); + (NEW_GOAL `mxi V [u0; u1; u2; u3:real^3] = omega_list_n V ul 2`); + (ASM_REWRITE_TAC[mxi]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `mxi V [u1; u0; u2; u3:real^3] = omega_list_n V [u1;u0;u2;u3] 2`); + (ASM_REWRITE_TAC[mxi]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (REWRITE_WITH `hl (truncate_simplex 2 [u1; u0; u2; u3:real^3]) = + hl (truncate_simplex 2 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; HL; set_of_list]); + (AP_TERM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (ASM_REWRITE_TAC[]); + +(* ================================================================== *) +(* New part *) + + (ABBREV_TAC `s2:real^3 = omega_list_n V ul 2`); + (ABBREV_TAC `s3:real^3 = omega_list_n V ul 3`); + (NEW_GOAL `(?t. between t (s2,s3) /\ dist (u0,t:real^3) = sqrt (&2) /\ + mxi V ul = t)`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "s3"); + (MATCH_MP_TAC MXI_EXPLICIT); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `a < b <=> ~(a >= b)`]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `(?s. between s (s2,s3) /\ dist (u1,s:real^3) = sqrt (&2) /\ + mxi V [u1;u0;u2;u3] = s)`); + (REWRITE_WITH `s2 = omega_list_n V [u1; u0; u2; u3] 2 /\ + s3 = omega_list_n V [u1; u0; u2; u3] 3`); + (ASM_MESON_TAC[]); + (MATCH_MP_TAC MXI_EXPLICIT); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `[u1; u0; u2; u3] IN barV V 3` THEN REWRITE_TAC[IN]); + (REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `a < b <=> ~(a >= b)`]); + (REWRITE_WITH `hl (truncate_simplex 2 [u1; u0; u2; u3:real^3]) = + hl (truncate_simplex 2 (ul:(real^3)list))`); + (ASM_REWRITE_TAC[HL; TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (AP_TERM_TAC THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `hl ([u1; u0; u2; u3:real^3]) = hl ((ul:(real^3)list))`); + (ASM_REWRITE_TAC[HL; TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (AP_TERM_TAC THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REPEAT STRIP_TAC); + + + (ABBREV_TAC `yl = truncate_simplex 2 (ul:(real^3)list)`); + (NEW_GOAL `yl = [u0;u1;u2:real^3]`); + (EXPAND_TAC "yl" THEN REWRITE_TAC[ + ASSUME `ul = [u0; u1; u2; u3:real^3]`; TRUNCATE_SIMPLEX_EXPLICIT_2]); + (NEW_GOAL `s2:real^3 = circumcenter (set_of_list yl)`); + (ASM_REWRITE_TAC[set_of_list]); + (EXPAND_TAC "s2"); + (MATCH_MP_TAC OMEGA_LIST_2_EXPLICIT_NEW); + (EXISTS_TAC `u3:real^3` THEN REWRITE_TAC[IN]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `[u0; u1; u2:real^3] = yl`); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + + + (NEW_GOAL `s2 IN voronoi_list V [u0;u1;u2:real^3]`); + (EXPAND_TAC "s2"); + (REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `2 = SUC 1`]); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC CLOSEST_POINT_IN_SET); + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); + (UNDISCH_TAC `barV V 3 ul` THEN REWRITE_TAC[BARV]); + (REPEAT STRIP_TAC); + (NEW_GOAL `voronoi_nondg V ([u0;u1;u2:real^3])`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[Sphere.INITIAL_SUBLIST; LENGTH; ARITH_RULE `0 < SUC (SUC (SUC 0))`]); + (EXISTS_TAC `[u3:real^3]` THEN ASM_REWRITE_TAC[APPEND]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[VORONOI_NONDG; LENGTH; + ARITH_RULE `SUC (SUC (SUC 0)) = 3`; AFF_DIM_EMPTY]); + (REWRITE_TAC[ARITH_RULE `-- &1 + &3:int = &3 - &1`]); + (REWRITE_TAC[MESON[INT_OF_NUM_SUB; ARITH_RULE `1 <= 3`] `&3:int - &1 = &(3 - 1)`]); + (REWRITE_TAC[ARITH_RULE `3 - 1= 2 /\ ~(&2:int = &4)`]); + + + (NEW_GOAL `s3 IN voronoi_list V [u0;u1;u2:real^3]`); + (EXPAND_TAC "s3"); + (REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `3 = SUC 2`]); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 2 = 3`; TRUNCATE_SIMPLEX_EXPLICIT_3]); + (MATCH_MP_TAC (SET_RULE `(?b. a IN b /\ b SUBSET c) ==> a IN c`)); + (EXISTS_TAC `voronoi_list V [u0; u1; u2; u3:real^3]`); + (STRIP_TAC); + (MATCH_MP_TAC CLOSEST_POINT_IN_SET); + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); + (UNDISCH_TAC `barV V 3 ul` THEN REWRITE_TAC[BARV]); + (REPEAT STRIP_TAC); + (NEW_GOAL `voronoi_nondg V ([u0;u1;u2;u3:real^3])`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[Sphere.INITIAL_SUBLIST; LENGTH; ARITH_RULE `0 < SUC (SUC (SUC (SUC 0)))`]); + (EXISTS_TAC `[]:(real^3)list` THEN ASM_REWRITE_TAC[APPEND]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[VORONOI_NONDG; LENGTH; + ARITH_RULE `SUC(SUC (SUC (SUC 0))) = 4`; AFF_DIM_EMPTY]); + (REWRITE_TAC[ARITH_RULE `-- &1 + &4:int = &4 - &1`]); + (REWRITE_TAC[MESON[INT_OF_NUM_SUB; ARITH_RULE `1 <= 4`] `&4:int - &1 = &(4 - 1)`]); + (REWRITE_TAC[ARITH_RULE `4 - 1= 3 /\ ~(&3:int = &4)`]); + (REWRITE_TAC[VORONOI_LIST; set_of_list; VORONOI_SET]); + (SET_TAC[]); + + (NEW_GOAL `!a:real^3. between a (s2,s3) ==> + a IN affine hull voronoi_list V [u0;u1;u2]`); + (GEN_TAC THEN REWRITE_TAC[BETWEEN_IN_CONVEX_HULL] THEN DISCH_TAC); + (MATCH_MP_TAC (SET_RULE `(?b. a IN b /\ b SUBSET c) ==> a IN c`)); + (EXISTS_TAC `affine hull {s2, s3:real^3}`); + (STRIP_TAC); + (MATCH_MP_TAC (SET_RULE `(?b. a IN b /\ b SUBSET c) ==> a IN c`)); + (EXISTS_TAC `convex hull {s2, s3:real^3}`); + (ASM_REWRITE_TAC[]); + (MESON_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC AFFINE_SUBSET_KY_LEMMA); + (ASM_SET_TAC[]); + + + (NEW_GOAL `s = t:real^3`); + (NEW_GOAL `norm (u0 - s:real^3) pow 2 = norm (s2 - s) pow 2 + norm (u0 - s2) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `[u0; u1; u2:real^3] = truncate_simplex 2 ul`); + (ASM_MESON_TAC[]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC (SET_RULE `(?b. a IN b /\ b SUBSET c) ==> a IN c`)); + (EXISTS_TAC `{u0,u1,u2:real^3}`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (SET_TAC[]); + (MATCH_MP_TAC (SET_RULE `(?b. a SUBSET b /\ b SUBSET c) ==> a SUBSET c`)); + (EXISTS_TAC `convex hull {u0,u1,u2:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SUBSET; IN_SET_IMP_IN_CONVEX_HULL_SET]); + + (NEW_GOAL `norm (u0 - t:real^3) pow 2 = norm (s2 - t) pow 2 + norm (u0 - s2) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `[u0; u1; u2:real^3] = truncate_simplex 2 ul`); + (ASM_MESON_TAC[]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC (SET_RULE `(?b. a IN b /\ b SUBSET c) ==> a IN c`)); + (EXISTS_TAC `{u0,u1,u2:real^3}`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (SET_TAC[]); + (MATCH_MP_TAC (SET_RULE `(?b. a SUBSET b /\ b SUBSET c) ==> a SUBSET c`)); + (EXISTS_TAC `convex hull {u0,u1,u2:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SUBSET; IN_SET_IMP_IN_CONVEX_HULL_SET]); + + + (NEW_GOAL `norm (u1 - s:real^3) pow 2 = norm (s2 - s) pow 2 + norm (u1 - s2) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `[u0; u1; u2:real^3] = truncate_simplex 2 ul`); + (ASM_MESON_TAC[]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC (SET_RULE `(?b. a IN b /\ b SUBSET c) ==> a IN c`)); + (EXISTS_TAC `{u0,u1,u2:real^3}`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (SET_TAC[]); + (MATCH_MP_TAC (SET_RULE `(?b. a SUBSET b /\ b SUBSET c) ==> a SUBSET c`)); + (EXISTS_TAC `convex hull {u0,u1,u2:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SUBSET; IN_SET_IMP_IN_CONVEX_HULL_SET]); + + (ABBREV_TAC `s1 = omega_list_n V (ul:(real^3)list) 1`); + + (NEW_GOAL `s1 = circumcenter (set_of_list [u0;u1:real^3])`); + (EXPAND_TAC "s1" THEN REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC OMEGA_LIST_1_EXPLICIT_NEW); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (REWRITE_TAC[IN] THEN ASM_REWRITE_TAC[]); + (REWRITE_WITH `[u0;u1:real^3] = truncate_simplex 1 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `s2 IN voronoi_list V [u0;u1:real^3]`); + (EXPAND_TAC "s2"); + (REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `2 = SUC 1`]); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC (SET_RULE `(?b. a IN b /\ b SUBSET c) ==> a IN c`)); + (EXISTS_TAC `voronoi_list V [u0; u1; u2:real^3]`); + (STRIP_TAC); + (MATCH_MP_TAC CLOSEST_POINT_IN_SET); + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); + (UNDISCH_TAC `barV V 3 ul` THEN REWRITE_TAC[BARV]); + (REPEAT STRIP_TAC); + (NEW_GOAL `voronoi_nondg V ([u0;u1;u2:real^3])`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[Sphere.INITIAL_SUBLIST; LENGTH; ARITH_RULE `0 < SUC (SUC (SUC 0))`]); + (EXISTS_TAC `[u3]:(real^3)list` THEN ASM_REWRITE_TAC[APPEND]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[VORONOI_NONDG; LENGTH; + ARITH_RULE `SUC (SUC (SUC 0)) = 3`; AFF_DIM_EMPTY]); + (REWRITE_TAC[ARITH_RULE `-- &1 + &3:int = &3 - &1`]); + (REWRITE_TAC[MESON[INT_OF_NUM_SUB; ARITH_RULE `1 <= 3`] `&3:int - &1 = &(3 - 1)`]); + (REWRITE_TAC[ARITH_RULE `3 - 1= 2 /\ ~(&2:int = &4)`]); + (REWRITE_TAC[VORONOI_LIST; set_of_list; VORONOI_SET]); + (SET_TAC[]); + + (NEW_GOAL `s1 IN voronoi_list V [u0;u1:real^3]`); + (EXPAND_TAC "s1"); + (REWRITE_TAC[OMEGA_LIST_N; ARITH_RULE `1 = SUC 0`]); + (ASM_REWRITE_TAC[ARITH_RULE `SUC 0 = 1`; TRUNCATE_SIMPLEX_EXPLICIT_1]); + (MATCH_MP_TAC CLOSEST_POINT_IN_SET); + (REWRITE_TAC[Packing3.CLOSED_VORONOI_LIST]); + (UNDISCH_TAC `barV V 3 ul` THEN REWRITE_TAC[BARV]); + (REPEAT STRIP_TAC); + (NEW_GOAL `voronoi_nondg V ([u0;u1:real^3])`); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[Sphere.INITIAL_SUBLIST; LENGTH; ARITH_RULE `0 < SUC (SUC 0)`]); + (EXISTS_TAC `[u2;u3:real^3]` THEN ASM_REWRITE_TAC[APPEND]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[VORONOI_NONDG; LENGTH; + ARITH_RULE `SUC (SUC 0) = 2`; AFF_DIM_EMPTY]); + (REWRITE_TAC[ARITH_RULE `-- &1 + &2:int = &2 - &1`]); + (REWRITE_TAC[MESON[INT_OF_NUM_SUB; ARITH_RULE `1 <= 2`] `&2:int - &1 = &(2 - 1)`]); + (REWRITE_TAC[ARITH_RULE `2 - 1= 1 /\ ~(&1:int = &4)`]); + + (NEW_GOAL `norm (u0 - s2:real^3) pow 2 = norm (s1 - s2) pow 2 + norm (u0 - s1) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `[u0; u1:real^3] = truncate_simplex 1 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + (REWRITE_WITH `circumcenter (set_of_list [u0; u1; u2:real^3]) = s2`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `(?b. a IN b /\ b SUBSET c) ==> a IN c`)); + (EXISTS_TAC `voronoi_list V [u0; u1:real^3]`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `(?b. a SUBSET b /\ b SUBSET c) ==> a SUBSET c`)); + (EXISTS_TAC `convex hull voronoi_list V [u0;u1:real^3]`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SUBSET; IN_SET_IMP_IN_CONVEX_HULL_SET]); + (REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC (SET_RULE `(?b. a IN b /\ b SUBSET c) ==> a IN c`)); + (EXISTS_TAC `convex hull {u0,u1:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (SET_TAC[]); + + (NEW_GOAL `norm (u1 - s2:real^3) pow 2 = norm (s1 - s2) pow 2 + norm (u1 - s1) pow 2`); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MHFTTZN4); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `1`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `[u0; u1:real^3] = truncate_simplex 1 ul`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `1 <= 3`]); + (REWRITE_WITH `circumcenter (set_of_list [u0; u1; u2:real^3]) = s2`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `(?b. a IN b /\ b SUBSET c) ==> a IN c`)); + (EXISTS_TAC `voronoi_list V [u0; u1:real^3]`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (SET_RULE `(?b. a SUBSET b /\ b SUBSET c) ==> a SUBSET c`)); + (EXISTS_TAC `convex hull voronoi_list V [u0;u1:real^3]`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SUBSET; IN_SET_IMP_IN_CONVEX_HULL_SET]); + (REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC (SET_RULE `(?b. a IN b /\ b SUBSET c) ==> a IN c`)); + (EXISTS_TAC `convex hull {u0,u1:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (SET_TAC[]); + (NEW_GOAL `norm (u0 - s1) = norm (u1 - s1:real^3)`); + (ASM_REWRITE_TAC[set_of_list; Rogers.CIRCUMCENTER_2; midpoint]); + (NORM_ARITH_TAC); + (NEW_GOAL `norm (u0 - s2) pow 2 = norm (u1 - s2:real^3) pow 2`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `norm (u0 - s) pow 2 = norm (u1 - s:real^3) pow 2`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `norm (s2 - s) pow 2 = norm (s2 - t:real^3) pow 2`); + (REWRITE_WITH `norm (s2 - s:real^3) pow 2 = + norm (u1 - s) pow 2 - norm (u1 - s2) pow 2`); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH `norm (s2 - t:real^3) pow 2 = + norm (u0 - t) pow 2 - norm (u0 - s2) pow 2`); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[ASSUME `norm (u0 - s2) pow 2 = norm (u1 - s2:real^3) pow 2`]); + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_TAC[GSYM dist]); + (ASM_REWRITE_TAC[]); + (ASM_CASES_TAC `s2 = s3:real^3`); + (UNDISCH_TAC `between s (s2,s3:real^3)`); + (UNDISCH_TAC `between t (s2,s3:real^3)`); + (REWRITE_TAC[ASSUME `s2 = s3:real^3`; BETWEEN_REFL_EQ]); + (MESON_TAC[]); + + (SWITCH_TAC); + (UP_ASM_TAC); + (UNDISCH_TAC `between s (s2,s3:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; IN; CONVEX_HULL_2; IN_ELIM_THM]); + (STRIP_TAC); + (REWRITE_TAC[ASSUME `s:real^3 = u % s2 + v % s3`]); + (REWRITE_WITH `norm (s2 - (u % s2 + v % s3)) = v * norm (s3 - s2:real^3)`); + (REWRITE_WITH `s2 - (u % s2 + v % s3) = (u + v) % s2 - (u % s2 + v % s3:real^3)`); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `(u + v) % s2 - (u % s2 + v % s3) = --v % (s3 - s2)`; NORM_MUL]); + (AP_THM_TAC THEN AP_TERM_TAC); + (ASM_REAL_ARITH_TAC); + + (UNDISCH_TAC `between t (s2,s3:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; IN; CONVEX_HULL_2; IN_ELIM_THM]); + (STRIP_TAC); + (REWRITE_TAC[ASSUME `t:real^3 = u' % s2 + v' % s3`]); + (REWRITE_WITH `norm (s2 - (u' % s2 + v' % s3)) = v' * norm (s3 - s2:real^3)`); + (REWRITE_WITH `s2 - (u' % s2 + v' % s3) = (u' + v') % s2 - (u' % s2 + v' % s3:real^3)`); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `(u' + v') % s2 - (u' % s2 + v' % s3) = --v' % (s3 - s2)`; NORM_MUL]); + (AP_THM_TAC THEN AP_TERM_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH + `(a * b) pow 2 = (c * b) pow 2 <=> (a pow 2 - c pow 2) * (b pow 2) = &0`]); + (STRIP_TAC); + (ASM_CASES_TAC `norm (s3 - s2:real^3) pow 2 = &0`); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[Trigonometry2.POW2_EQ_0]); + (REWRITE_TAC[NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (NEW_GOAL `v pow 2 - v' pow 2 = &0`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REWRITE_TAC[REAL_ENTIRE]); + (MESON_TAC[]); + (NEW_GOAL `v = v':real`); + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ARITH `a - b = &0 <=> a = b`]); + (ASM_MESON_TAC[Trigonometry2.EQ_POW2_COND]); + (NEW_GOAL `u = u':real`); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[])]);; + +(* ====================================================================== *) +(* Lemma 79 *) + +let NUMSEG_012 = prove_by_refinement ( + `{0,1,2} = 0..2`, +[(REWRITE_TAC[IN_NUMSEG_0; SET_EQ_LEMMA]); + (REPEAT STRIP_TAC); + (ASM_SET_TAC[ARITH_RULE `0 <= 2 /\ 1 <= 2 /\ 2 <= 2`]); + (UP_ASM_TAC THEN REWRITE_TAC[ARITH_RULE `x <= 2 <=> x = 0 \/ x = 1 \/ x = 2`]); + (SET_TAC[])]);; + +let SET_OF_LIST_TRUN2_LEFT_ACTION_LIST2 = prove_by_refinement ( + `!V ul p. packing V /\ saturated V /\ barV V 3 ul /\ + p permutes 0..2 ==> + (set_of_list (truncate_simplex 2 (left_action_list p ul)) = + set_of_list (truncate_simplex 2 ul))`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `?u0 u1 u2 u3:real^3. ul = [u0;u1;u2;u3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[left_action_list; LENGTH;TRUNCATE_SIMPLEX_EXPLICIT_2; + ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`; TABLE_4;set_of_list]); + + (NEW_GOAL `inverse (p:num->num) permutes 0..2`); + (ASM_SIMP_TAC[PERMUTES_INVERSE]); + (NEW_GOAL `!i. i IN {0,1,2} ==> inverse p i IN {0,1,2}`); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `inverse p permutes 0..2` THEN REWRITE_TAC[permutes]); + (REWRITE_TAC[EXISTS_UNIQUE] THEN REPEAT STRIP_TAC); + (ABBREV_TAC `j = inverse (p:num->num) i`); + (ASM_CASES_TAC `~(j IN 0..2)`); + (NEW_GOAL `F`); + (NEW_GOAL `inverse p j = j:num`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `?x:num. inverse p x = j:num /\ (!y'. inverse p y' = j ==> y' = x)`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `i = x:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_MESON_TAC[]); + (NEW_GOAL `j = x:num`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_MESON_TAC[]); + (NEW_GOAL `~(i IN 0..2)`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_NUMSEG]); + (ASM_SET_TAC[ARITH_RULE `0 <= 0 /\ 0 <= 1 /\ 0 <= 2 /\ 0 <= 2 /\ 1 <= 2 /\ 2 <= 2`]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_NUMSEG; SET_RULE `i IN {a,b,c} <=> i = a \/ i = b \/ i = c`]); + (ARITH_TAC); + (NEW_GOAL `EL 0 [u0; u1; u2; u3:real^3] = u0 /\ EL 1 [u0; u1; u2; u3] = u1 /\ + EL 2 [u0; u1; u2; u3] = u2`); + (REWRITE_TAC[EL;HD;ARITH_RULE `1 = SUC 0 /\ 2 = SUC 1`;TL]); + + (REWRITE_TAC[SET_EQ_LEMMA]); + (REPEAT STRIP_TAC); + (NEW_GOAL `!i. i IN {0,1,2} ==> + EL (inverse p i) [u0; u1; u2; u3:real^3] IN {u0,u1,u2}`); + (REPEAT STRIP_TAC); + (NEW_GOAL `inverse (p:num->num) i IN {0, 1, 2} `); + (ASM_SIMP_TAC[]); + (ASM_CASES_TAC `inverse (p:num->num) i = 0`); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + (ASM_CASES_TAC `inverse (p:num->num) i = 1`); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + (ASM_CASES_TAC `inverse (p:num->num) i = 2`); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + (NEW_GOAL `F`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (ASM_SET_TAC[]); + + (ASM_CASES_TAC `x = u0:real^3`); + (NEW_GOAL `?i. i IN {0,1,2} /\ inverse p i = 0`); + (UNDISCH_TAC `inverse p permutes 0..2` THEN + REWRITE_TAC[permutes; EXISTS_UNIQUE] THEN REPEAT STRIP_TAC); + (NEW_GOAL `?s. inverse (p:num->num) s = 0 /\ (!y'. inverse p y' = 0 ==> y' = s)`); + (ASM_REWRITE_TAC[]); + (FIRST_ASSUM CHOOSE_TAC); + (EXISTS_TAC `s:num`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NUMSEG_012]); + (ONCE_REWRITE_TAC[MESON[] `s <=> ~s ==> F`]); + (STRIP_TAC); + (NEW_GOAL `inverse p s = s:num`); + (FIRST_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `~(0 IN 0..2)`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_NUMSEG_0]); + (ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `x = EL (inverse p (i:num)) [u0;u1;u2;u3:real^3]`); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + + + (ASM_CASES_TAC `x = u1:real^3`); + (NEW_GOAL `?i. i IN {0,1,2} /\ inverse p i = 1`); + (UNDISCH_TAC `inverse p permutes 0..2` THEN + REWRITE_TAC[permutes; EXISTS_UNIQUE] THEN REPEAT STRIP_TAC); + (NEW_GOAL `?s. inverse (p:num->num) s = 1 /\ (!y'. inverse p y' = 1 ==> y' = s)`); + (ASM_REWRITE_TAC[]); + (FIRST_ASSUM CHOOSE_TAC); + (EXISTS_TAC `s:num`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NUMSEG_012]); + (ONCE_REWRITE_TAC[MESON[] `s <=> ~s ==> F`]); + (STRIP_TAC); + (NEW_GOAL `inverse p s = s:num`); + (FIRST_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `~(1 IN 0..2)`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_NUMSEG_0]); + (ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `x = EL (inverse p (i:num)) [u0;u1;u2;u3:real^3]`); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + + (ASM_CASES_TAC `x = u2:real^3`); + (NEW_GOAL `?i. i IN {0,1,2} /\ inverse p i = 2`); + (UNDISCH_TAC `inverse p permutes 0..2` THEN + REWRITE_TAC[permutes; EXISTS_UNIQUE] THEN REPEAT STRIP_TAC); + (NEW_GOAL `?s. inverse (p:num->num) s = 2 /\ (!y'. inverse p y' = 2 ==> y' = s)`); + (ASM_REWRITE_TAC[]); + (FIRST_ASSUM CHOOSE_TAC); + (EXISTS_TAC `s:num`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NUMSEG_012]); + (ONCE_REWRITE_TAC[MESON[] `s <=> ~s ==> F`]); + (STRIP_TAC); + (NEW_GOAL `inverse p s = s:num`); + (FIRST_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `~(2 IN 0..2)`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_NUMSEG_0]); + (ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `x = EL (inverse p (i:num)) [u0;u1;u2;u3:real^3]`); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (NEW_GOAL `F`); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[])]);; + + +(* ====================================================================== *) +(* Lemma 80 *) + +let SQRT2_LT_2 = prove_by_refinement ( + `sqrt (&2) < &2`, +[(REWRITE_WITH `sqrt (&2) < &2 <=> sqrt (&2) pow 2 < &2 pow 2`); + (MATCH_MP_TAC Pack1.bp_bdt); + (ASM_SIMP_TAC[SQRT_POS_LE; ARITH_RULE `&0 <= &2`]); + (ASM_SIMP_TAC[ARITH_RULE `&0 <= &2 /\ &2 pow 2 = &4 /\ &2 < &4`; + SQRT_POW_2])]);; + + +end;; diff --git a/text_formalization/packing/marchal_cells_3.hl b/text_formalization/packing/marchal_cells_3.hl new file mode 100755 index 0000000..b92e367 --- /dev/null +++ b/text_formalization/packing/marchal_cells_3.hl @@ -0,0 +1,7376 @@ + +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: *) +(* Chaper : Packing (Marchal Cells 3) *) +(* Date : May 14 2012 *) +(* ========================================================================= *) + +module Marchal_cells_3 = struct + +open Sphere;; +open Euler_main_theorem;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Pack2;; +open Packing3;; +open Rogers;; +open Vukhacky_tactics;; +open Marchal_cells;; +open Emnwuus;; +(* open Marchal_cells_2;; *) +open Marchal_cells_2_new;; +open Urrphbz1;; +open Lepjbdj;; +open Hdtfnfz;; +open Rvfxzbu;; +open Sltstlo;; +open Urrphbz2;; +open Urrphbz3;; +open Ynhyjit;; +open Njiutiu;; +open Tezffsk;; +open Qzksykg;; +open Ddzuphj;; +open Ajripqn;; +open Qzyzmjc;; +open Upfzbzm_support_lemmas;; + + +let TAKE_TAC = UP_ASM_TAC THEN REPEAT STRIP_TAC;; +(* ==================================================================== *) +(* Lemma 1 *) + +let HD_IN_ROGERS = prove ( + `!V ul. saturated V /\ packing V /\ barV V 3 ul ==> HD ul IN rogers V ul`, +REPEAT STRIP_TAC THEN +ASM_SIMP_TAC[ROGERS_EXPLICIT] THEN +MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET THEN SET_TAC[]);; + +(* ==================================================================== *) +(* Lemma 2 *) + +let ROGERS_SUBSET_VORONOI_CLOSED = prove_by_refinement ( + `!V ul. saturated V /\ packing V /\ barV V 3 ul ==> + rogers V ul SUBSET voronoi_closed V (HD ul)`, +[(REPEAT STRIP_TAC); + (ASM_SIMP_TAC[ROGERS_EXPLICIT]); + (NEW_GOAL `voronoi_closed V (HD ul) = + convex hull (voronoi_closed V ((HD ul):real^3))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[CONVEX_HULL_EQ]); + (REWRITE_TAC[Packing3.CONVEX_VORONOI_CLOSED]); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET); + + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (REWRITE_TAC[GSYM OMEGA_LIST_N]); + (REWRITE_WITH `voronoi_closed V (omega_list_n V ul 0) = + voronoi_list V (truncate_simplex 0 ul)`); + (ASM_REWRITE_TAC[OMEGA_LIST_N; TRUNCATE_SIMPLEX_EXPLICIT_0; VORONOI_LIST; + VORONOI_SET; set_of_list; HD] THEN SET_TAC[]); + + (NEW_GOAL `omega_list_n V ul 0 IN + voronoi_list V (truncate_simplex 0 ul)`); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (NEW_GOAL `omega_list_n V ul 1 IN + voronoi_list V (truncate_simplex 0 ul)`); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (NEW_GOAL `omega_list_n V ul 2 IN + voronoi_list V (truncate_simplex 0 ul)`); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (NEW_GOAL `omega_list_n V ul 3 IN + voronoi_list V (truncate_simplex 0 ul)`); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (ASM_SET_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 3 *) + +let HD_IN_MCELL = prove_by_refinement ( + `!V ul i r X . + packing V /\ + saturated V /\ + barV V 3 ul /\ + X = mcell i V ul /\ + ~(X = {}) /\ ~(i = 0) + ==> (HD ul IN X)`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ASM_REWRITE_TAC[HD]); + (ASM_CASES_TAC `i = 1`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell1]); + (COND_CASES_TAC); + (ASM_SIMP_TAC[IN_DIFF;IN_INTER; HD; TL; IN_CBALL; DIST_REFL; + TRUNCATE_SIMPLEX_EXPLICIT_1; rcone_gt; rconesgn]); + (REPEAT STRIP_TAC); + (REWRITE_WITH `u0 = HD ul /\ [u0; u1; u2; u3:real^3] = ul`); + (ASM_REWRITE_TAC[HD]); + (MATCH_MP_TAC HD_IN_ROGERS); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SQRT_POS_LE); + (REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[IN; IN_ELIM_THM; VECTOR_ARITH + `(u0 - u0) dot (u1 - u0) = &0`; DIST_REFL]); + (REAL_ARITH_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `X:real^3->bool = {}`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`; ASSUME `i = 1`; MCELL_EXPLICIT; mcell1]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REFL_TAC); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `i = 2`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2]); + (COND_CASES_TAC); + (LET_TAC); + (ASM_SIMP_TAC[IN_INTER; HD; TL; DIST_REFL; + TRUNCATE_SIMPLEX_EXPLICIT_1; rcone_ge; rconesgn; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[VECTOR_ARITH `(u0 - u0) dot (u1 - u0) = &0`]); + (REAL_ARITH_TAC); + (REWRITE_TAC[GSYM NORM_POW_2; GSYM dist; REAL_POW_2]); + (REWRITE_TAC[REAL_ARITH `a * a >= a * a * b <=> &0 <= a * a * (&1 - b)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (ABBREV_TAC `s = hl (truncate_simplex 1 [u0; u1; u2; u3:real^3])`); + (EXPAND_TAC "a"); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (REWRITE_WITH `s / sqrt (&2) <= &1 <=> s <= &1 * sqrt (&2)`); + (MATCH_MP_TAC REAL_LE_LDIV_EQ); + (MATCH_MP_TAC SQRT_POS_LT THEN REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (REWRITE_WITH `[u0; u1; u2; u3:real^3] = ul`); + (ASM_REWRITE_TAC[]); + (ABBREV_TAC `m = mxi V ul`); + (ABBREV_TAC `s3 = omega_list_n V ul 3`); + (REWRITE_WITH `aff_ge {u0, u1:real^3} {m, s3} u0 <=> + u0 IN aff_ge {u0, u1} {m, s3}`); + (REWRITE_TAC[IN]); + (NEW_GOAL `u0 IN convex hull {u0,u1,m,s3:real^3}`); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (SET_TAC[]); + (NEW_GOAL `convex hull {u0,u1,m,s3:real^3} SUBSET aff_ge {u0, u1} {m, s3}`); + (REWRITE_TAC[Marchal_cells_2_new.CONVEX_HULL_4_SUBSET_AFF_GE_2_2]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (NEW_GOAL `F`); + (NEW_GOAL `X:real^3->bool = {}`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`; ASSUME `i = 2`; MCELL_EXPLICIT; mcell2]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REFL_TAC); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `i = 3`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell3]); + (COND_CASES_TAC); + (REWRITE_TAC[set_of_list;TRUNCATE_SIMPLEX_EXPLICIT_2]); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (SET_TAC[]); + (NEW_GOAL `F`); + (NEW_GOAL `X:real^3->bool = {}`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`; ASSUME `i = 3`; MCELL_EXPLICIT; mcell3]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REFL_TAC); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `i >= 4`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4]); + (COND_CASES_TAC); + (REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC IN_SET_IMP_IN_CONVEX_HULL_SET); + (SET_TAC[]); + (NEW_GOAL `F`); + (NEW_GOAL `X:real^3->bool = {}`); + (SIMP_TAC[ASSUME `X = mcell i V ul`; ASSUME `i >= 4`; MCELL_EXPLICIT; mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REFL_TAC); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[])]);; + + +(* ==================================================================== *) +(* Lemma 4 *) + +let FINITE_MCELL_SET_lemma1 = prove_by_refinement ( + `!V ul i r X . + packing V /\ + saturated V /\ + barV V 3 ul /\ + X = mcell i V ul /\ + X SUBSET ball (vec 0, r) /\ + ~(X = {}) + ==> (!u. u IN set_of_list ul ==> u IN ball (vec 0, r + &6))`, +[(REPEAT STRIP_TAC); + +(* Case i = 0 *) + (ASM_CASES_TAC `i = 0`); + (UNDISCH_TAC `X = mcell i V ul`THEN ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell0]); + (STRIP_TAC); + (NEW_GOAL `!s. s IN rogers V ul ==> dist (HD ul, s) < &2`); + (REPEAT STRIP_TAC); + (NEW_GOAL `rogers V ul SUBSET voronoi_closed V (HD ul)`); + (ASM_SIMP_TAC[ROGERS_SUBSET_VORONOI_CLOSED]); + (NEW_GOAL `s:real^3 IN voronoi_closed V (HD ul)`); + (ASM_SET_TAC[]); + (UNDISCH_TAC `saturated (V:real^3->bool)`); + (REWRITE_TAC[saturated]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?y. y IN V /\ dist (s, y:real^3) < &2`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (UNDISCH_TAC `s:real^3 IN voronoi_closed V (HD ul)` THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (s,HD ul) <= dist (s,y:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REAL_ARITH_TAC); + (NEW_GOAL `?s. s:real^3 IN X`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `dist (HD ul, s:real^3) < &2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + + (NEW_GOAL `set_of_list (ul:(real^3)list) SUBSET ball (HD ul,&4)`); + (MATCH_MP_TAC BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Packing3.HD_IN_SET_OF_LIST); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (NEW_GOAL `u:real^3 IN ball (HD ul, &4)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL]); + (STRIP_TAC); + (NEW_GOAL `dist (vec 0,u) <= dist (vec 0, s) + dist (s, u:real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (s, u) <= dist (s, HD ul) + dist (HD ul, u:real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (vec 0,u) <= + dist (vec 0,s) + dist (s,HD ul) + dist (HD ul,u:real^3)`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `dist (s:real^3, HD ul) < &2`); + (ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `dist (vec 0,s:real^3) < r`); + (REWRITE_TAC[GSYM IN_BALL]); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC); + +(* Case i != 0 *) + + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `(HD ul):real^3 IN X`); + (MATCH_MP_TAC HD_IN_MCELL); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `(HD ul):real^3 IN ball (vec 0, r)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL] THEN STRIP_TAC); + (NEW_GOAL `dist (vec 0,u) <= dist (vec 0,HD ul) + dist (HD ul, u:real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `set_of_list (ul:(real^3)list) SUBSET ball (HD ul,&4)`); + (MATCH_MP_TAC BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[HD; set_of_list]); + (SET_TAC[]); + (NEW_GOAL `u:real^3 IN ball (HD ul, &4)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL]); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC)]);; + + +(* ==================================================================== *) +(* Lemma 5 *) + +let FINITE_MCELL_SET_LEMMA_concl = + `!V r. packing V /\ saturated V ==> + FINITE {X | X SUBSET ball (vec 0,r) /\ mcell_set V X}`;; +let FINITE_MCELL_SET_LEMMA = prove_by_refinement ( + FINITE_MCELL_SET_LEMMA_concl, + +[(REPEAT STRIP_TAC); + (REWRITE_WITH `FINITE {X | X SUBSET ball (vec 0,r) /\ mcell_set V X} <=> + FINITE {X | X SUBSET ball (vec 0,r) /\ mcell_set V X /\ ~(X = {})}`); + (ASM_CASES_TAC `{} IN {X | X SUBSET ball (vec 0,r) /\ mcell_set V X}`); + (REWRITE_WITH `{X | X SUBSET ball (vec 0,r) /\ mcell_set V X} = + {} INSERT {X | X SUBSET ball (vec 0,r) /\ mcell_set V X /\ ~(X = {})}`); + (ONCE_REWRITE_TAC[SET_RULE `A = B <=> B SUBSET A /\ A SUBSET B`]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[INSERT_SUBSET]); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + (REWRITE_TAC[SUBSET_INSERT_DELETE]); + (ONCE_REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN_DELETE] THEN REWRITE_TAC[IN_ELIM_THM]); + (SET_TAC[]); + (REWRITE_TAC[FINITE_INSERT]); + (REWRITE_WITH `{X | X SUBSET ball (vec 0,r) /\ mcell_set V X} = + {X | X SUBSET ball (vec 0,r) /\ mcell_set V X /\ ~(X = {})}`); + (ONCE_REWRITE_TAC[SET_RULE `A = B <=> B SUBSET A /\ A SUBSET B`]); + (REPEAT STRIP_TAC); + (SET_TAC[]); + (ONCE_REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] + THEN REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `{} IN {X | X SUBSET ball (vec 0,r) /\ mcell_set V X}`); + (ONCE_REWRITE_TAC[IN] THEN REWRITE_TAC[IN_ELIM_THM]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (ABBREV_TAC + `S = {X | X SUBSET ball (vec 0,r) /\ mcell_set V X /\ ~(X = {})}`); + (ABBREV_TAC `s1:(real^3->bool) = V INTER ball (vec 0, r + &6)`); + (ABBREV_TAC `s2 = {ul:(real^3)list | ?u0 u1 u2 u3. + u0 IN s1 /\ + u1 IN s1 /\ + u2 IN s1 /\ + u3 IN s1 /\ + ul = [u0; u1; u2; u3]}`); + (ABBREV_TAC `s3 = {(i:num, ul:(real^3)list) | i IN 0..4 /\ ul IN s2}`); + (NEW_GOAL`S SUBSET {X| ?t. t IN s3 /\ X = (\t. mcell (FST t) V (SND t)) t}`); + (EXPAND_TAC "S" THEN EXPAND_TAC "s3"); + (ONCE_REWRITE_TAC[SUBSET] THEN ONCE_REWRITE_TAC[IN] THEN + REWRITE_TAC[IN_ELIM_THM; FST; SND; mcell_set]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `((if i <= 4 then i else 4), ul:(real^3)list)`); + (ASM_REWRITE_TAC[FST;SND]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `(if i <= 4 then i else 4)` THEN EXISTS_TAC `ul:(real^3)list`); + (REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[IN_NUMSEG_0]); + (ASM_REWRITE_TAC[IN_NUMSEG_0] THEN ARITH_TAC); + (EXPAND_TAC "s2"); + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC THEN ONCE_REWRITE_TAC[IN]); + (REWRITE_TAC[IN_ELIM_THM]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (EXISTS_TAC `u2:real^3` THEN EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `!u:real^3. u IN set_of_list ul ==> u IN s1`); + (EXPAND_TAC "s1" THEN REPEAT STRIP_TAC); + (REWRITE_TAC[IN_INTER]); + (STRIP_TAC); + (NEW_GOAL `set_of_list ul SUBSET (V:real^3->bool)`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_MESON_TAC[IN]); + (ASM_SET_TAC[]); + (NEW_GOAL `!u:real^3. u IN set_of_list ul ==> u IN ball (vec 0,r + &6)`); + (MATCH_MP_TAC FINITE_MCELL_SET_lemma1); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `i:num` THEN + EXISTS_TAC `x:real^3->bool`); + (ASM_MESON_TAC[IN]); + (ASM_SIMP_TAC[]); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `i >= 4`); + (ASM_ARITH_TAC); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`]); + (MATCH_MP_TAC FINITE_SUBSET); + + (EXISTS_TAC `{X | ?t. t IN s3 /\ X = (\t. mcell (FST t) V (SND t)) t}`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (EXPAND_TAC "s3"); + (MATCH_MP_TAC FINITE_PRODUCT); + (REWRITE_TAC[FINITE_NUMSEG]); + (EXPAND_TAC "s2"); + (MATCH_MP_TAC FINITE_SET_LIST_LEMMA); + (EXPAND_TAC "s1"); + (MATCH_MP_TAC Packing3.KIUMVTC); + (ASM_REWRITE_TAC[])]);; + + + +(* ==================================================================== *) +(* Lemma 6 *) + +let CARD_BOUNDARY_INT_BALL_BOUND_1 = prove_by_refinement ( + `!x k1 k2. &0 < k1 /\ &0 < k2 ==> + (?C. !r. &1 <= r ==> + &(CARD (int_ball x (r + k1) DIFF int_ball x (r - k2))) <= C * r pow 2)`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `?C. !r. k2 + sqrt (&3) <= r + ==> &(CARD + (int_ball x (r + k1) DIFF int_ball x (r - k2))) <= + C * r pow 2`); + (MATCH_MP_TAC Vol1.bdt5_finiteness); + (ASM_REWRITE_TAC[]); + (TAKE_TAC); + (ABBREV_TAC `D = &(CARD (int_ball x ((k2 + sqrt (&3)) + k1)))`); + (EXISTS_TAC `max C D`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `k2 + sqrt (&3) <= r`); + (NEW_GOAL + `&(CARD (int_ball x (r + k1) DIFF int_ball x (r - k2))) <= C * r pow 2`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `C * r pow 2 <= max C D * r pow 2`); + (REWRITE_TAC[REAL_ARITH `a * b <= c * b <=> &0 <= (c - a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_LE_POW_2]); + (REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `&(CARD (int_ball x (r + k1) DIFF int_ball x (r - k2))) <= + &(CARD (int_ball x (r + k1)))`); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[Vol1.finite_int_ball]); + + (NEW_GOAL `&(CARD (int_ball x (r + k1))) <= D * r pow 2`); + (NEW_GOAL `&(CARD (int_ball x (r + k1))) <= D`); + (EXPAND_TAC "D"); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (REWRITE_TAC[Vol1.finite_int_ball; int_ball; Pack1.hinhcau_ball; SUBSET; + IN_INTER; IN_BALL]); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[]); + (NEW_GOAL `r + k1 <= (k2 + sqrt (&3)) + k1`); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `D <= D * r pow 2`); + (REWRITE_TAC[REAL_ARITH `a <= a * b <=> &0 <= a * (b - &1)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (EXPAND_TAC "D" THEN REWRITE_TAC[REAL_OF_NUM_LE; LE_0]); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (ONCE_REWRITE_TAC[REAL_ARITH `&1 = (&1) pow 2`]); + (REWRITE_WITH `(&1) pow 2 <= r pow 2 <=> &1 <= r`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC Collect_geom.POW2_COND_LT); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `D * r pow 2 <= max C D * r pow 2`); + (REWRITE_TAC[REAL_ARITH `a * b <= c * b <=> &0 <= (c - a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_LE_POW_2]); + (REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 7 *) +(* The following is a simplified version of Vol1.bdt5_finiteness, Vol1.bdt7_finiteness *) + +let CARD_BOUNDARY_INT_BALL_BOUND = prove_by_refinement ( + `!x k1 k2. + (?C. !r. &1 <= r ==> + &(CARD (int_ball x (r + k1) DIFF int_ball x (r - k2))) <= C * r pow 2)`, +[(REPEAT STRIP_TAC); + (ASM_CASES_TAC `&0 < k1 /\ &0 < k2`); + (ASM_MESON_TAC[CARD_BOUNDARY_INT_BALL_BOUND_1]); + (ASM_CASES_TAC `&0 < k2`); + (NEW_GOAL + `(?C. !r. &1 <= r ==> + &(CARD (int_ball x (r + &1) DIFF int_ball x (r - k2))) <= C * r pow 2)`); + (MATCH_MP_TAC CARD_BOUNDARY_INT_BALL_BOUND_1); + (ASM_REAL_ARITH_TAC); + (TAKE_TAC); + (EXISTS_TAC `C:real`); + (REPEAT STRIP_TAC); + (NEW_GOAL `&(CARD (int_ball x (r + k1) DIFF int_ball x (r - k2))) <= + &(CARD (int_ball x (r + &1) DIFF int_ball x (r - k2)))`); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (SIMP_TAC[FINITE_DIFF; Vol1.finite_int_ball]); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> A DIFF C SUBSET B DIFF C`)); + (REWRITE_TAC[int_ball; Pack1.hinhcau_ball; SUBSET; IN_INTER; IN_BALL]); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[]); + (NEW_GOAL `r + k1 <= r + &1`); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `&(CARD (int_ball x (r + &1) DIFF int_ball x (r - k2))) <= + C * r pow 2`); + (ASM_SIMP_TAC[]); + (ASM_REAL_ARITH_TAC); + + (ASM_CASES_TAC `&0 < k1`); + (NEW_GOAL + `(?C. !r. &1 <= r ==> + &(CARD (int_ball x (r + k1) DIFF int_ball x (r - &1))) <= C * r pow 2)`); + (MATCH_MP_TAC CARD_BOUNDARY_INT_BALL_BOUND_1); + (ASM_REAL_ARITH_TAC); + (TAKE_TAC); + (EXISTS_TAC `C:real`); + (REPEAT STRIP_TAC); + (NEW_GOAL `&(CARD (int_ball x (r + k1) DIFF int_ball x (r - k2))) <= + &(CARD (int_ball x (r + k1) DIFF int_ball x (r - &1)))`); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (SIMP_TAC[FINITE_DIFF; Vol1.finite_int_ball]); + (MATCH_MP_TAC (SET_RULE `B SUBSET A ==> C DIFF A SUBSET C DIFF B`)); + (REWRITE_TAC[int_ball; Pack1.hinhcau_ball; SUBSET; IN_INTER; IN_BALL]); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[]); + (NEW_GOAL `r - &1 <= r - k2`); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `&(CARD (int_ball x (r + k1) DIFF int_ball x (r - &1))) <= + C * r pow 2`); + (ASM_SIMP_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL + `(?C. !r. &1 <= r ==> + &(CARD (int_ball x (r + &1) DIFF int_ball x (r - &1))) <= C * r pow 2)`); + (MATCH_MP_TAC CARD_BOUNDARY_INT_BALL_BOUND_1); + (ASM_REAL_ARITH_TAC); + (TAKE_TAC); + (EXISTS_TAC `C:real`); + (REPEAT STRIP_TAC); + (NEW_GOAL `&(CARD (int_ball x (r + k1) DIFF int_ball x (r - k2))) <= + &(CARD (int_ball x (r + &1) DIFF int_ball x (r - &1)))`); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (SIMP_TAC[FINITE_DIFF; Vol1.finite_int_ball]); + (REWRITE_TAC[IN_DIFF; int_ball; Pack1.hinhcau_ball; SUBSET; IN_INTER; IN_BALL]); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `(!i. 1 <= i /\i <= 3 ==>integer (x'$i)) /\ + dist (x:real^3,x') < r - k2`); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + (NEW_GOAL `&(CARD (int_ball x (r + &1) DIFF int_ball x (r - &1))) <= + C * r pow 2`); + (ASM_SIMP_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 8 *) + +let CARD_INJ_LE = prove_by_refinement ( + `!s t f. FINITE s /\ FINITE t /\ INJ (f:A->B) s t ==> + CARD s <= CARD t`, +[(REWRITE_TAC[INJ] THEN REPEAT STRIP_TAC); + (REWRITE_WITH `CARD s = CARD (IMAGE (f:A->B) s)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC CARD_IMAGE_INJ); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC CARD_SUBSET); + (ASM_REWRITE_TAC[IMAGE; SUBSET]); + (UNDISCH_TAC `!x. x IN s ==> (f:A->B) x IN t`); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (SET_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 9 *) + +let BOUNDARY_VOLUME = prove_by_refinement ( + `!p:real^3 k1 k2. + ?C. (!r. &1 <= r ==> + vol (ball (p:real^3,r + k1) DIFF ball (p,r - k2)) <= C * r pow 2)`, +[(REPEAT STRIP_TAC); + + (ABBREV_TAC + `C = &4 / &3 * pi * (&3 * abs (k1 + k2) + &3 * k1 pow 2 + abs (k1 pow 3 + k2 pow 3))`); + (ABBREV_TAC `D = vol (ball (p:real^3, abs (k1 + k2)))`); + (ABBREV_TAC `E = max C (D:real)`); + (EXISTS_TAC `max (E:real) (&0)`); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `r + k1 <= r - k2`); + (REWRITE_WITH `ball (p,r + k1) DIFF ball (p:real^3,r - k2) = {}`); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> A DIFF B = {}`)); + (REWRITE_TAC[SUBSET; IN_BALL] THEN REPEAT STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[MEASURE_EMPTY]); + (NEW_GOAL `&0 * r pow 2 <= max E (&0) * r pow 2`); + (REWRITE_TAC[REAL_ARITH `a * x <= b * x <=> &0 <= (b - a) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[REAL_LE_POW_2] THEN REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (REWRITE_WITH `vol (ball (p,r + k1) DIFF ball (p,r - k2)) = + vol (ball (p,r + k1)) - vol (ball (p,r - k2))`); + (MATCH_MP_TAC MEASURE_DIFF_SUBSET); + (REWRITE_TAC[MEASURABLE_BALL; SUBSET; IN_BALL] THEN ASM_REAL_ARITH_TAC); + (REWRITE_TAC[VOLUME_BALL]); + (ASM_CASES_TAC `&0 <= r - k2`); + (NEW_GOAL `&0 <= r + k1`); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `vol (ball (p,r + k1)) - vol (ball (p,r - k2)) <= C * r pow 2`); + (ASM_SIMP_TAC [VOLUME_BALL]); + (EXPAND_TAC "C"); + (REWRITE_TAC[REAL_ARITH + `x * pi * a - x * pi * b <= (x * pi * c) * d <=> + &0 <= (x * pi) * (c * d - (a - b))`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[REAL_LE_MUL; REAL_LE_DIV; PI_POS_LE; REAL_ARITH `&0 <= &3 /\ &0 <= &4`]); + (REWRITE_TAC[REAL_ARITH `(r + k1) pow 3 - (r - k2) pow 3 = &3 * (k1 + k2) * + r pow 2 + &3 * (k1 pow 2 - k2 pow 2) * r + (k1 pow 3 + k2 pow 3)`]); + (REWRITE_TAC[REAL_ADD_RDISTRIB]); + (NEW_GOAL `(&3 * abs (k1 + k2)) * r pow 2 >= + &3 * (k1 * r pow 2 + k2 * r pow 2)`); + (REWRITE_TAC[REAL_ARITH + `(&3 * abs (k1 + k2)) * r pow 2 >= &3 * (k1 * r pow 2 + k2 * r pow 2) <=> + &0 <= &3 * r pow 2 * (abs (k1 + k2) - (k1 + k2))`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_ARITH `&0 <= &3`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_LE_POW_2]); + (REAL_ARITH_TAC); + + (NEW_GOAL `(&3 * k1 pow 2) * r pow 2 >= &3 * (k1 pow 2 - k2 pow 2) * r`); + (NEW_GOAL `(&3 * k1 pow 2) * r pow 2 >= (&3 * k1 pow 2) * r`); + (REWRITE_TAC[REAL_ARITH `x * y pow 2 >= x * y <=> &0 <= x * y * (y - &1)`]); + (ASM_SIMP_TAC[REAL_LE_MUL; REAL_LE_POW_2; REAL_ARITH `&1 <= a ==> &0 <= a`; + REAL_ARITH `&1 <= a ==> &0 <= (a - &1)`; REAL_ARITH `&0 <= &3`]); + (NEW_GOAL `(&3 * k1 pow 2) * r >= &3 * (k1 pow 2 - k2 pow 2) * r`); + (REWRITE_TAC[REAL_ARITH `(&3 * x) * r >= &3 * (x - y) * r <=> &0 <= y * r`]); + (ASM_SIMP_TAC[REAL_LE_MUL; REAL_LE_POW_2; REAL_ARITH `&1 <= a ==> &0 <= a`]); + (ASM_REAL_ARITH_TAC); + + + (NEW_GOAL `abs (k1 pow 3 + k2 pow 3) * r pow 2 >= k1 pow 3 + k2 pow 3`); + (NEW_GOAL `abs (k1 pow 3 + k2 pow 3) * r pow 2 >= + abs (k1 pow 3 + k2 pow 3)`); + (REWRITE_TAC[REAL_ARITH `x * y pow 2 >= x <=> &0 <= x * (y pow 2 - &1)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_ABS_POS]); + (REWRITE_TAC[REAL_ARITH `&0 <= a - &1 <=> &1 pow 2 <= a`]); + (REWRITE_WITH `&1 pow 2 <= r pow 2 <=> &1 <= r`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.POW2_COND_LT); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + + (NEW_GOAL `C * r pow 2 <= max E (&0) * r pow 2`); + (REWRITE_TAC[REAL_ARITH `a * x <= b * x <=> &0 <= (b - a) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[REAL_LE_POW_2] THEN ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `r < k2`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `vol (ball (p,r + k1)) - vol (ball (p,r - k2)) <= D * r pow 2`); + (REWRITE_WITH `ball (p:real^3,r - k2) = {}`); + (REWRITE_TAC[SET_RULE `s = {} <=> (!x. x IN s ==> F)`]); + (REWRITE_TAC[IN_BALL] THEN GEN_TAC); + (MP_TAC (MESON[DIST_POS_LE] `&0 <= dist (p, x:real^3)`)); + (ASM_REAL_ARITH_TAC); + + (REWRITE_TAC[MEASURE_EMPTY; REAL_ARITH `a - &0 = a`]); + (NEW_GOAL `vol (ball (p,r + k1)) <= D`); + (EXPAND_TAC "D" THEN MATCH_MP_TAC MEASURE_SUBSET); + (REWRITE_TAC[MEASURABLE_BALL; SUBSET; IN_BALL]); + (REPEAT STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `D <= D * r pow 2`); + (REWRITE_TAC[REAL_ARITH `x <= x * y pow 2 <=> &0 <= x * (y pow 2 - &1)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (EXPAND_TAC "D"); + (STRIP_TAC); + (MATCH_MP_TAC MEASURE_POS_LE); + (REWRITE_TAC[MEASURABLE_BALL]); + (REWRITE_TAC[REAL_ARITH `&0 <= a - &1 <=> &1 pow 2 <= a`]); + (REWRITE_WITH `&1 pow 2 <= r pow 2 <=> &1 <= r`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.POW2_COND_LT); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `D * r pow 2 <= max E (&0) * r pow 2`); + (REWRITE_TAC[REAL_ARITH `a * x <= b * x <=> &0 <= (b - a) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[REAL_LE_POW_2] THEN ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 10 *) + +let PACKING_BALL_BOUNDARY = prove_by_refinement ( + `!V p:real^3 k1 k2. packing V ==> + ?C. !r. &1 <= r + ==> &(CARD (V INTER ball (p,r + k1) DIFF V INTER ball (p,r - k2))) + <= C * r pow 2`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `?C. (!r. &1 <= r ==> + vol (ball (p:real^3,r + k1 + &1) DIFF ball (p,r - (k2 + &1))) <= + C * r pow 2)`); + (REWRITE_TAC[BOUNDARY_VOLUME]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `C:real`); + (REPEAT STRIP_TAC); + (ABBREV_TAC + `B = V INTER ball (p,r + k1) DIFF V INTER ball (p:real^3,r - k2)`); + (ABBREV_TAC `f = (\u:real^3. ball (u, &1))`); + (NEW_GOAL `FINITE (B:real^3->bool)`); + (EXPAND_TAC "B"); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `V INTER ball (p:real^3,r + k1)`); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA] THEN ASM_SET_TAC[]); + + (NEW_GOAL `sum B (\u:real^3. vol (f u)) = &(CARD B) * &4 / &3 * pi`); + (EXPAND_TAC "f"); + (SIMP_TAC[VOLUME_BALL; REAL_ARITH `&0 <= &1`]); + (ASM_SIMP_TAC [SUM_CONST]); + (REAL_ARITH_TAC); + + (NEW_GOAL `sum B (\u:real^3. vol (f u)) = vol (UNIONS (IMAGE f B))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC MEASURE_DISJOINT_UNIONS_IMAGE); + (EXPAND_TAC "f" THEN REWRITE_TAC[MEASURABLE_BALL] THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `DISJOINT s t <=> !x. ~(x IN s /\ x IN t)`]); + (REWRITE_TAC[IN_BALL]); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[] THEN ONCE_REWRITE_TAC[DIST_SYM] THEN STRIP_TAC); + (NEW_GOAL `dist (u, y) <= dist (u, x) + dist (x, y:real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `&2 <= dist (u, y:real^3)`); + (UNDISCH_TAC `packing V` THEN REWRITE_TAC[packing] THEN STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `vol (UNIONS (IMAGE f (B:real^3->bool))) <= + vol (ball (p,r + k1 + &1) DIFF ball (p,r - (k2 + &1)))`); + (EXPAND_TAC "f" THEN REWRITE_TAC[IMAGE]); + (MATCH_MP_TAC MEASURE_SUBSET); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC MEASURABLE_UNIONS); + (STRIP_TAC); + + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[MEASURABLE_BALL]); + + (ASM_SIMP_TAC[MEASURABLE_DIFF; MEASURABLE_BALL]); + (EXPAND_TAC "B"); + (REWRITE_TAC[SUBSET; IN_UNIONS; IN_BALL; IN_DIFF; IN_INTER]); + (REWRITE_TAC[IN_ELIM_THM; IN]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (p, x) <= dist (p, x') + dist (x', x:real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (x',x:real^3) < &1`); + (UNDISCH_TAC `(t:real^3->bool) x`); + (ASM_REWRITE_TAC[ball; IN_ELIM_THM]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `dist (p, x':real^3) < r - k2`); + (NEW_GOAL `dist (p, x') <= dist (p, x) + dist (x, x':real^3)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (x,x':real^3) < &1`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (UNDISCH_TAC `(t:real^3->bool) x`); + (ASM_REWRITE_TAC[ball; IN_ELIM_THM]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `&(CARD (B:real^3->bool)) <= &(CARD B) * &4 / &3 * pi`); + (REWRITE_TAC [REAL_ARITH `a <= a * b <=> &0 <= a * (b - &1)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_OF_NUM_LE; LE_0]); + (NEW_GOAL `#3.14159 < pi`); + (REWRITE_TAC[Flyspeck_constants.bounds]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `vol (ball (p:real^3,r + k1 + &1) DIFF ball (p,r - (k2 + &1))) <= + C * r pow 2`); + (ASM_SIMP_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 11 *) + +let MCELL_SUBSET_BALL_4 = prove_by_refinement ( + `!V X . + packing V /\ + saturated V /\ mcell_set V X + ==> (?p. X SUBSET ball (p, &4))`, +[(REWRITE_TAC[mcell_set_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `X:real^3->bool = {}`); + (EXISTS_TAC `(vec 0):real^3`); + (ASM_MESON_TAC[EMPTY_SUBSET]); + +(* Case i = 0 *) + (ASM_CASES_TAC `i = 0`); + (UNDISCH_TAC `X = mcell i V ul`THEN ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell0]); + (STRIP_TAC); + (NEW_GOAL `!s. s IN rogers V ul ==> dist (HD ul, s) < &2`); + (REPEAT STRIP_TAC); + (NEW_GOAL `rogers V ul SUBSET voronoi_closed V (HD ul)`); + (ASM_SIMP_TAC[ROGERS_SUBSET_VORONOI_CLOSED]); + (NEW_GOAL `s:real^3 IN voronoi_closed V (HD ul)`); + (ASM_SET_TAC[]); + (UNDISCH_TAC `saturated (V:real^3->bool)`); + (REWRITE_TAC[saturated]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?y. y IN V /\ dist (s, y:real^3) < &2`); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (UNDISCH_TAC `s:real^3 IN voronoi_closed V (HD ul)` THEN REWRITE_TAC[voronoi_closed; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (s,HD ul) <= dist (s,y:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ONCE_REWRITE_TAC[DIST_SYM] THEN ASM_REAL_ARITH_TAC); + (EXISTS_TAC `HD (ul:(real^3)list)`); + (REWRITE_TAC[SUBSET; IN_BALL]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (HD ul, x:real^3) < &2`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC); + +(* Case i = 4 *) + (ASM_CASES_TAC `i = 4`); + (UNDISCH_TAC `X = mcell i V ul` THEN + ASM_SIMP_TAC[MCELL_EXPLICIT; mcell4; ARITH_RULE `4 >= 4`]); + (COND_CASES_TAC); + (STRIP_TAC); + (EXISTS_TAC `omega_list V ul`); + (NEW_GOAL `ball (omega_list V ul,&4) = convex hull (ball (omega_list V ul,&4))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN REWRITE_TAC[CONVEX_HULL_EQ; CONVEX_BALL]); + (ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC CONVEX_HULL_SUBSET); + (REWRITE_TAC[SUBSET; IN_BALL] THEN REPEAT STRIP_TAC); + (REWRITE_WITH `omega_list V ul = circumcenter (set_of_list ul)`); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[IN]); + (REWRITE_WITH `dist (circumcenter (set_of_list ul),x:real^3) = hl ul`); + (NEW_GOAL `(!x:real^3. x IN set_of_list ul + ==> dist (circumcenter (set_of_list ul),x) = hl ul)`); + (MATCH_MP_TAC Rogers.HL_PROPERTIES); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `sqrt (&2) <= &2`); + (REWRITE_WITH `sqrt (&2) <= &2 <=> sqrt (&2) pow 2 <= &2 pow 2`); + (MATCH_MP_TAC Collect_geom.POW2_COND_LT); + (ASM_SIMP_TAC[SQRT_POS_LT; REAL_ARITH `&0 < &2`]); + (REWRITE_WITH `sqrt (&2) pow 2 = (&2)`); + (MATCH_MP_TAC SQRT_POW_2); + (REAL_ARITH_TAC); + (REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (STRIP_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + +(* Case i = 1 and i = 2 and i = 3 *) + + (ABBREV_TAC `s = omega_list_n V ul (i - 1)`); + (EXISTS_TAC `s:real^3`); + (MATCH_MP_TAC (SET_RULE `(?x. A SUBSET x /\ x SUBSET B) ==> A SUBSET B`)); + (EXISTS_TAC `UNIONS + {rogers V (left_action_list p ul) | p permutes 0..i - 1}`); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Qzksykg.QZKSYKG2); + (ASM_REWRITE_TAC[SET_RULE `i IN {0,1,2,3,4} <=> i=0\/i=1\/i=2\/i=3\/i=4`]); + (ASM_ARITH_TAC); + (REWRITE_TAC[SUBSET; IN_UNIONS; IN; IN_ELIM_THM; IN_BALL]); + (REPEAT STRIP_TAC); + (ABBREV_TAC `vl:(real^3)list = left_action_list p ul`); + (NEW_GOAL `rogers V vl SUBSET voronoi_closed V (HD vl)`); + (MATCH_MP_TAC ROGERS_SUBSET_VORONOI_CLOSED); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Qzksykg.QZKSYKG1); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_REWRITE_TAC[SET_RULE `i IN {0,1,2,3,4} <=> i=0\/i=1\/i=2\/i=3\/i=4`]); + (ASM_ARITH_TAC); + (ASM_SET_TAC[]); + +(* -------------------------------------------------------------------------- *) + + (NEW_GOAL `barV V 3 vl /\ + (!j. i - 1 <= j /\ j <= 3 + ==> omega_list_n V vl j = omega_list_n V ul j)`); + (ASM_CASES_TAC `i <= 1`); + (UNDISCH_TAC `p permutes 0..i - 1`); + (REWRITE_WITH `i - 1 = 0`); + (ASM_ARITH_TAC); + (REWRITE_TAC[Packing3.PERMUTES_TRIVIAL]); + (STRIP_TAC THEN EXPAND_TAC "vl" THEN REWRITE_TAC[ASSUME `p = I:num->num`; + Packing3.LEFT_ACTION_LIST_I]); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC Ynhyjit.YNHYJIT); + (EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (REWRITE_TAC[SET_RULE `i IN {2,3,4} <=> i = 2 \/ i = 3 \/ i = 4`]); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~(X = {}:real^3->bool)` THEN ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `i = 2`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell2; ARITH_RULE `2 - 1 = 1`]); + (COND_CASES_TAC); + (MESON_TAC[]); + (MESON_TAC[]); + (ASM_CASES_TAC `i = 3`); + (ASM_REWRITE_TAC[MCELL_EXPLICIT; mcell3; ARITH_RULE `3 - 1 = 2`]); + (COND_CASES_TAC); + (MESON_TAC[]); + (MESON_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `s IN voronoi_list V (truncate_simplex (i - 1) vl)`); + (REWRITE_WITH `s = omega_list_n V vl (i - 1)`); + (EXPAND_TAC "s"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_ARITH_TAC); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_IN_VORONOI_LIST); + (EXISTS_TAC `3`); + (ASM_REWRITE_TAC[] THEN ASM_ARITH_TAC); + + (NEW_GOAL `s:real^3 IN voronoi_closed V (HD vl)`); + (NEW_GOAL `voronoi_list V (truncate_simplex (i - 1) vl) SUBSET + voronoi_closed V (HD vl)`); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET]); + (NEW_GOAL `HD (vl:(real^3)list) IN + set_of_list (truncate_simplex (i - 1) vl)`); + (NEW_GOAL `LENGTH (vl:(real^3)list) = 3 + 1 /\ CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (REWRITE_WITH `HD (vl:(real^3)list) = HD (truncate_simplex (i - 1) vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (ASM_ARITH_TAC); + (MATCH_MP_TAC Packing3.HD_IN_SET_OF_LIST); + (NEW_GOAL `?u0 u1 u2 u3. vl = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ASM_CASES_TAC `i = 1`); + (ASM_REWRITE_TAC[ARITH_RULE `1 - 1 = 0`; + TRUNCATE_SIMPLEX_EXPLICIT_0; LENGTH] THEN ARITH_TAC); + (ASM_CASES_TAC `i = 2`); + (ASM_REWRITE_TAC[ARITH_RULE `2 - 1 = 1`; + TRUNCATE_SIMPLEX_EXPLICIT_1; LENGTH] THEN ARITH_TAC); + (ASM_CASES_TAC `i = 3`); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; + TRUNCATE_SIMPLEX_EXPLICIT_2; LENGTH] THEN ARITH_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_SET_TAC[]); + + (NEW_GOAL `dist (s, x:real^3) <= dist (s, HD vl) + dist (HD vl, x)`); + (REWRITE_TAC[DIST_TRIANGLE]); + (NEW_GOAL `dist (s:real^3, HD vl) < &2`); + (ONCE_REWRITE_TAC[DIST_SYM] THEN REWRITE_TAC[GSYM IN_BALL]); + (NEW_GOAL `voronoi_closed V ((HD vl):real^3) SUBSET ball (HD vl,&2)`); + (ASM_SIMP_TAC[Packing3.VORONOI_BALL2]); + (ASM_SET_TAC[]); + + (NEW_GOAL `dist (HD vl, x:real^3) < &2`); + (REWRITE_TAC[GSYM IN_BALL]); + (NEW_GOAL `voronoi_closed V ((HD vl):real^3) SUBSET ball (HD vl,&2)`); + (ASM_SIMP_TAC[Packing3.VORONOI_BALL2]); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 12 *) + +let HL_2 = prove_by_refinement ( + `!u v:real^3. hl [u; v] = inv (&2) * dist (u, v)`, +[(REWRITE_TAC[HL; set_of_list; radV] THEN REPEAT GEN_TAC THEN + MATCH_MP_TAC SELECT_UNIQUE THEN REPEAT STRIP_TAC THEN + REWRITE_TAC[BETA_THM; CIRCUMCENTER_2; midpoint] THEN EQ_TAC); + (REPEAT STRIP_TAC); + (REWRITE_WITH `y = dist (inv (&2) % (u + v),v:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[MESON [IN] `{a, b} s <=> s IN {a, b}`] THEN SET_TAC[]); + (NORM_ARITH_TAC); + (REPEAT STRIP_TAC); + (NEW_GOAL `w = u \/ w = v:real^3`); + (UP_ASM_TAC THEN REWRITE_TAC[MESON [IN] `{a, b} s <=> s IN {a, b}`] THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[] THEN NORM_ARITH_TAC); + (ASM_REWRITE_TAC[] THEN NORM_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 13 *) + +let HL_LE_SQRT2_IMP_BARV_1 = prove_by_refinement ( + `!V u0 u1. + saturated V /\ + packing V /\ + u0 IN V /\ + u1 IN V /\ + ~(u0 = u1) /\ + hl [u0;u1] < sqrt (&2) ==> barV V 1 [u0;u1:real^3]`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[BARV; LENGTH; ARITH_RULE `SUC (SUC 0) = 1 + 1`]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `LENGTH (vl:(real^3)list) = 1`); + (NEW_GOAL `initial_sublist vl [u0; u1:real^3] /\ LENGTH vl = 0 + 1`); + (ASM_REWRITE_TAC[] THEN ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_WITH + `initial_sublist vl [u0; u1:real^3] /\ LENGTH vl = 0 + 1 <=> + truncate_simplex 0 [u0;u1] = vl /\ 0 + 1 <= LENGTH [u0;u1:real^3]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_0]); + (REWRITE_TAC[VORONOI_NONDG; VORONOI_LIST; VORONOI_SET; set_of_list; LENGTH; + SET_RULE `INTERS {voronoi_closed V v | v IN {u0}} = voronoi_closed V u0`]); + (ASM_SIMP_TAC[Packing3.AFF_DIM_VORONOI_CLOSED]); + (REPEAT STRIP_TAC); + (ARITH_TAC); + (ASM_SET_TAC[]); + (ARITH_TAC); + + (ASM_CASES_TAC `LENGTH (vl:(real^3)list) = 2`); + (NEW_GOAL `initial_sublist vl [u0; u1:real^3] /\ LENGTH vl = 1 + 1`); + (ASM_REWRITE_TAC[] THEN ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_WITH + `initial_sublist vl [u0; u1:real^3] /\ LENGTH vl = 1 + 1 <=> + truncate_simplex 1 [u0;u1] = vl /\ 1 + 1 <= LENGTH [u0;u1:real^3]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1]); + (REWRITE_TAC[VORONOI_NONDG]); + (REWRITE_TAC[set_of_list; LENGTH]); + (REPEAT STRIP_TAC); + (ARITH_TAC); + (ASM_SET_TAC[]); + + (REWRITE_WITH + `aff_dim (voronoi_list V [u0; u1:real^3]) = + aff_dim (INTERS {bis (HD [u0; u1]) v | v | v IN set_of_list [u0; u1]})`); + (MATCH_MP_TAC Rogers.YIFVQDV_lemma_aff_dim); + (ASM_REWRITE_TAC[set_of_list; AFFINE_INDEPENDENT_2] THEN ASM_SET_TAC[]); + (REWRITE_TAC[set_of_list; SET_RULE `a IN {b,c} <=> a =b \/ a = c`; HD]); + (REWRITE_TAC[SET_RULE `INTERS {bis u0 v | v | v = u0 \/ v = u1} = + bis u0 u0 INTER bis u0 u1`]); + (REWRITE_WITH `!a:real^3. bis a a = (:real^3)`); + (REWRITE_TAC[bis] THEN SET_TAC[]); + (REWRITE_TAC[SET_RULE `(:real^3) INTER s = s`]); + (MATCH_MP_TAC (ARITH_RULE `a = &2 ==> a + &(SUC(SUC 0)) = (&4):int`)); + (REWRITE_WITH `&2 = &(dimindex (:3)) - &1:int`); + (REWRITE_TAC[DIMINDEX_3]); + (ARITH_TAC); + (REWRITE_TAC[Packing3.BIS_EQ_HYPERPLANE]); + (MATCH_MP_TAC AFF_DIM_HYPERPLANE); + (ASM_NORM_ARITH_TAC); + + (NEW_GOAL `F`); + (NEW_GOAL `initial_sublist vl [u0; u1:real^3] /\ + LENGTH vl = (LENGTH vl - 1) + 1`); + (ASM_REWRITE_TAC[] THEN ASM_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_WITH + `initial_sublist vl [u0; u1:real^3] /\ LENGTH vl = (LENGTH vl - 1) + 1 <=> + truncate_simplex (LENGTH vl - 1) [u0;u1] = vl /\ + (LENGTH vl - 1) + 1 <= LENGTH [u0;u1:real^3]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[LENGTH]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 14 *) + +let RCONE_GE_SUBSET = prove_by_refinement ( + `!a b u0:real^N u1. a <= b ==> rcone_ge u0 u1 b SUBSET rcone_ge u0 u1 a`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[rcone_ge; rconesgn; SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL +`&0 <= dist (x,u0:real^N) * dist (u1,u0) * b - dist (x,u0) * dist (u1,u0) * a`); + (REWRITE_TAC[REAL_ARITH `x * y * b - x * y * a = x * y * (b - a)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 15 *) + +let RCONE_GT_SUBSET = prove_by_refinement ( + `!a b u0:real^N u1. a <= b ==> rcone_gt u0 u1 b SUBSET rcone_gt u0 u1 a`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[rcone_gt; rconesgn; SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL +`&0 <= dist (x,u0:real^N) * dist (u1,u0) * b - dist (x,u0) * dist (u1,u0) * a`); + (REWRITE_TAC[REAL_ARITH `x * y * b - x * y * a = x * y * (b - a)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC)]);; + +(* ===================================================================== *) +(* The following lemmas are in the svn 126 of HOL *) +(* To be done by John Harrison *) +(* ===================================================================== *) +(* ==================================================================== *) +(* Lemma 16 *) + +let BOUNDED_SING = prove + (`!a. bounded {a}`, + REWRITE_TAC[BOUNDED_INSERT; BOUNDED_EMPTY]);; + +let SUBSPACE_BOUNDED_EQ_TRIVIAL = prove + (`!s:real^N->bool. subspace s ==> (bounded s <=> s = {vec 0})`, + REPEAT STRIP_TAC THEN EQ_TAC THEN SIMP_TAC[BOUNDED_SING] THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + DISCH_THEN(MP_TAC o MATCH_MP (SET_RULE + `~(s = {a}) ==> a IN s ==> ?b. b IN s /\ ~(b = a)`)) THEN + ASM_SIMP_TAC[SUBSPACE_0] THEN + DISCH_THEN(X_CHOOSE_THEN `v:real^N` STRIP_ASSUME_TAC) THEN + REWRITE_TAC[bounded; NOT_EXISTS_THM] THEN X_GEN_TAC `B:real` THEN + DISCH_THEN(MP_TAC o SPEC `(B + &1) / norm v % v:real^N`) THEN + ASM_SIMP_TAC[SUBSPACE_MUL; NORM_MUL; REAL_ABS_DIV; REAL_ABS_NORM] THEN + ASM_SIMP_TAC[REAL_DIV_RMUL; NORM_EQ_0] THEN REAL_ARITH_TAC);; + + let AFFINE_BOUNDED_EQ_TRIVIAL = prove + (`!s:real^N->bool. + affine s ==> (bounded s <=> s = {} \/ ?a. s = {a})`, + GEN_TAC THEN ASM_CASES_TAC `s:real^N->bool = {}` THEN + ASM_REWRITE_TAC[BOUNDED_EMPTY] THEN + FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [GSYM MEMBER_NOT_EMPTY]) THEN + DISCH_THEN(X_CHOOSE_THEN `b:real^N` MP_TAC) THEN + GEOM_ORIGIN_TAC `b:real^N` THEN SIMP_TAC[AFFINE_EQ_SUBSPACE] THEN + REPEAT STRIP_TAC THEN ASM_SIMP_TAC[SUBSPACE_BOUNDED_EQ_TRIVIAL] THEN + FIRST_ASSUM(MP_TAC o MATCH_MP SUBSPACE_0) THEN SET_TAC[]);; + + let AFFINE_BOUNDED_EQ_LOWDIM = prove + (`!s:real^N->bool. + affine s ==> (bounded s <=> aff_dim s <= &0)`, + SIMP_TAC[AFF_DIM_GE; INT_ARITH + `--(&1):int <= x ==> (x <= &0 <=> x = --(&1) \/ x = &0)`] THEN + SIMP_TAC[AFF_DIM_EQ_0; AFF_DIM_EQ_MINUS1; AFFINE_BOUNDED_EQ_TRIVIAL]);; + + let BOUNDED_HYPERPLANE_EQ_TRIVIAL = prove + (`!a b. bounded {x:real^N | a dot x = b} <=> + if a = vec 0 then ~(b = &0) else dimindex(:N) = 1`, + REPEAT GEN_TAC THEN ASM_CASES_TAC `a:real^N = vec 0` THEN + ASM_REWRITE_TAC[DOT_LZERO] THENL + [ASM_CASES_TAC `b = &0` THEN + ASM_REWRITE_TAC[EMPTY_GSPEC; BOUNDED_EMPTY] THEN + REWRITE_TAC[NOT_BOUNDED_UNIV; SET_RULE `{x | T} = UNIV`]; + ASM_SIMP_TAC[AFFINE_BOUNDED_EQ_LOWDIM; AFF_DIM_HYPERPLANE; + AFFINE_HYPERPLANE] THEN + REWRITE_TAC[INT_ARITH `a - &1:int <= &0 <=> a <= &1`; INT_OF_NUM_LE] THEN + MATCH_MP_TAC(ARITH_RULE `1 <= n ==> (n <= 1 <=> n = 1)`) THEN + REWRITE_TAC[DIMINDEX_GE_1]]);; + + let UNBOUNDED_HYPERPLANE = prove + (`!a b. ~(a = vec 0) ==> ~(bounded {x:real^3 | a dot x = b})`, + SIMP_TAC[BOUNDED_HYPERPLANE_EQ_TRIVIAL; DIMINDEX_3; ARITH]);; + +(* ==================================================================== *) +(* Lemma 17 *) + +let DIHV_SYM_2 = prove + (`!x y z t:real^3. dihV x y z t = dihV x y t z`, + REWRITE_TAC[dihV] THEN + REPEAT STRIP_TAC THEN REPEAT LET_TAC THEN + ASM_REWRITE_TAC[arcV; DOT_SYM; REAL_ARITH `a * b = b * a`]);; + +(* ==================================================================== *) +(* Lemma 18 *) + +let REAL_DIV_LE_1_TACTICS = prove_by_refinement ( + `!m n. &0 < n /\ m <= n ==> m / n <= &1`, +[(REPEAT STRIP_TAC); + (REWRITE_WITH `m / n <= &1 <=> m <= &1 * n`); + (MATCH_MP_TAC REAL_LE_LDIV_EQ); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 19 *) + +let REAL_DIV_GE_1_TACTICS = prove_by_refinement ( + `!m n. &0 < n /\ n <= m ==> &1 <= m / n`, +[(REPEAT STRIP_TAC); + (REWRITE_WITH `&1 <= m / n <=> &1 * n <= m`); + (MATCH_MP_TAC REAL_LE_RDIV_EQ); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 20 *) + +let REAL_DIV_LT_1_TACTICS = prove_by_refinement ( + `!m n. &0 < n /\ m < n ==> m / n < &1`, +[(REPEAT STRIP_TAC); + (REWRITE_WITH `m / n < &1 <=> m < &1 * n`); + (MATCH_MP_TAC REAL_LT_LDIV_EQ); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 21 *) + +let REAL_DIV_GT_1_TACTICS = prove_by_refinement ( + `!m n. &0 < n /\ n < m ==> &1 < m / n`, +[(REPEAT STRIP_TAC); + (REWRITE_WITH `&1 < m / n <=> &1 * n < m`); + (MATCH_MP_TAC REAL_LT_RDIV_EQ); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + + +(* ==================================================================== *) +(* The following lemmas help to prove that the *) +(* definition of dihX is well-defined *) +(* ==================================================================== *) +(* ==================================================================== *) +(* Lemma 22 *) + +let MCELL_ID_OMEGA_LIST_N = prove_by_refinement ( + `!V i j ul vl. packing V /\ saturated V /\ barV V 3 ul /\ barV V 3 vl /\ + (mcell i V ul = mcell j V vl) /\ + ~(negligible (mcell i V ul)) /\ + i IN {2, 3, 4} /\ + j IN {2, 3, 4} ==> + (i = j) /\ (!k. i - 1 <= k /\ k <= 3 + ==> omega_list_n V ul k = omega_list_n V vl k)`, +[(REPEAT GEN_TAC THEN STRIP_TAC); + (NEW_GOAL `i = j /\ mcell i V ul = mcell j V vl`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[SET_RULE `a INTER a = a` ]); + (STRIP_TAC); + (ASM_SET_TAC[]); + (STRIP_TAC); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `i = 4`); + (REPEAT STRIP_TAC); + (NEW_GOAL `k = 3`); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `omega_list_n V ul 3 = omega_list V ul`); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `(3 + 1) - 1 = 3`]); + + (REWRITE_WITH `omega_list_n V vl 3 = omega_list V vl`); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `(3 + 1) - 1 = 3`]); + + (REWRITE_WITH `omega_list V ul = circumcenter (set_of_list ul)`); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[IN]); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (SIMP_TAC[ASSUME `i = 4`; MCELL_EXPLICIT; ARITH_RULE `4 >= 4`;mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (REWRITE_WITH `omega_list V vl = circumcenter (set_of_list vl)`); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[IN]); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `j = 4`); + (ASM_ARITH_TAC); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`;mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (AP_TERM_TAC); + + (REWRITE_WITH `set_of_list ul = set_of_list (vl:(real^3)list) <=> + convex hull (set_of_list ul) = convex hull (set_of_list vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.CONVEX_HULL_EQ_EQ_SET_EQ); + (STRIP_TAC); + + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list] THEN STRIP_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (REWRITE_TAC[ASSUME `i = 4`]); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`;mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (MATCH_MP_TAC COPLANAR_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `?u0 u1 u2 u3. vl = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[set_of_list] THEN STRIP_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (REWRITE_TAC[ASSUME `mcell i V ul = mcell j V vl`]); + (REWRITE_WITH `j = 4`); + (ASM_ARITH_TAC); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`;mcell4]); + (COND_CASES_TAC); + (ASM_REWRITE_TAC[set_of_list]); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (MATCH_MP_TAC COPLANAR_SUBSET); + (EXISTS_TAC `affine hull {u0, u1, u2, u3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR]); + (MATCH_MP_TAC Rogers.AFF_DIM_LE_2_IMP_COPLANAR); + (MATCH_MP_TAC Njiutiu.AFF_DEPENDENT_AFF_DIM_4); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (MP_TAC (ASSUME `mcell i V ul = mcell j V vl`)); + (REWRITE_WITH `j = 4 /\ i = 4`); + (ASM_ARITH_TAC); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`;mcell4]); + (COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_TAC[]); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `j = 4 /\ i = 4`); + (ASM_ARITH_TAC); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`;mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `F`); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (REWRITE_WITH `j = 4 /\ i = 4`); + (ASM_ARITH_TAC); + (SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`;mcell4]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (ASM_MESON_TAC[]); + +(* Finish the case i = 4 *) +(* ========================================================================= *) + (NEW_GOAL `mcell i V ul SUBSET + UNIONS {rogers V (left_action_list p ul) | p permutes 0..i - 1}`); + (MATCH_MP_TAC Qzksykg.QZKSYKG2); + (ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]); + + (ABBREV_TAC `X = mcell i V ul`); + (NEW_GOAL `X INTER + UNIONS {rogers V (left_action_list p ul) | p permutes 0..i - 1} = X`); + (ASM_SET_TAC[]); + (NEW_GOAL `~negligible (X INTER + UNIONS {rogers V (left_action_list p ul) | p permutes 0..i - 1})`); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[INTER_UNIONS]); + (NEW_GOAL `!s:(real^3->bool)->bool. + ~negligible (UNIONS s) /\ FINITE s ==> (?t. t IN s /\ ~negligible t)`); + (MESON_TAC[NEGLIGIBLE_UNIONS]); + (REWRITE_TAC[SET_RULE + `{X INTER x | x IN {rogers V (left_action_list p ul) | p permutes 0..i - 1}} = + {X INTER rogers V (left_action_list p ul) | p permutes 0..i - 1}`]); + (ABBREV_TAC + `S = {X INTER rogers V (left_action_list p ul) | p permutes 0..i - 1}`); + (STRIP_TAC); + + (NEW_GOAL `(?t. t IN (S:(real^3->bool)->bool) /\ ~negligible t)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "S"); + (ABBREV_TAC `f = (\p. X INTER rogers V (left_action_list p ul))`); + (REWRITE_WITH + `{X INTER rogers V (left_action_list p ul) | p permutes 0..i - 1} = + {f p | p permutes 0..i-1}`); + (EXPAND_TAC "f" THEN REFL_TAC); + (ONCE_REWRITE_TAC[SET_RULE `{f x | P x} = {f x | x IN {x | P x}}`]); + + (REWRITE_TAC[SET_RULE `{f p | p IN {x | x permutes 0..i - 1} } = + {y | ?p. p IN {x | x permutes 0..i - 1} /\ y = f p}`]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (MATCH_MP_TAC FINITE_PERMUTATIONS); + (REWRITE_TAC[FINITE_NUMSEG]); + (UP_ASM_TAC THEN EXPAND_TAC "S" THEN REWRITE_TAC[IN; IN_ELIM_THM] + THEN STRIP_TAC); + + + + (NEW_GOAL `mcell j V vl SUBSET + UNIONS {rogers V (left_action_list q vl) | q permutes 0..j - 1}`); + (MATCH_MP_TAC Qzksykg.QZKSYKG2); + (ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]); + (NEW_GOAL `t SUBSET + UNIONS {rogers V (left_action_list q vl) | q permutes 0..j - 1}`); + (ASM_SET_TAC[]); + (NEW_GOAL `t INTER + UNIONS {rogers V (left_action_list q vl) | q permutes 0..j - 1} = t`); + (ASM_SET_TAC[]); + (NEW_GOAL `~negligible (t INTER + UNIONS {rogers V (left_action_list q vl) | q permutes 0..j - 1})`); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[INTER_UNIONS]); + (REWRITE_TAC[SET_RULE + `{t INTER x | x IN {rogers V (left_action_list q vl) | q permutes 0..j - 1}} = + {t INTER rogers V (left_action_list q vl) | q permutes 0..j - 1}`]); + + (NEW_GOAL `!s:(real^3->bool)->bool. + ~negligible (UNIONS s) /\ FINITE s ==> (?t. t IN s /\ ~negligible t)`); + (MESON_TAC[NEGLIGIBLE_UNIONS]); + (ABBREV_TAC + `R = {t INTER rogers V (left_action_list q vl) | q permutes 0..j - 1}`); + (STRIP_TAC); + + (NEW_GOAL `(?r. r IN (R:(real^3->bool)->bool) /\ ~negligible r)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "R"); + (ABBREV_TAC `f = (\q. t INTER rogers V (left_action_list q vl))`); + (REWRITE_WITH + `{t INTER rogers V (left_action_list q vl) | q permutes 0..j - 1} = + {f q | q permutes 0..j - 1}`); + (EXPAND_TAC "f" THEN REFL_TAC); + (ONCE_REWRITE_TAC[SET_RULE `{f x | P x} = {f x | x IN {x | P x}}`]); + + (REWRITE_TAC[SET_RULE `{f q | q IN {x | x permutes 0..j - 1} } = + {y | ?q. q IN {x | x permutes 0..j - 1} /\ y = f q}`]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (MATCH_MP_TAC FINITE_PERMUTATIONS); + (REWRITE_TAC[FINITE_NUMSEG]); + (UP_ASM_TAC THEN EXPAND_TAC "R" THEN REWRITE_TAC[IN; IN_ELIM_THM] + THEN STRIP_TAC); + (NEW_GOAL + `rogers V (left_action_list p ul) = rogers V (left_action_list q vl)`); + (MATCH_MP_TAC (MESON[] `(~A ==> F) ==> A`)); + (STRIP_TAC); + (NEW_GOAL `coplanar (rogers V (left_action_list p ul) INTER + rogers V (left_action_list q vl))`); + (MATCH_MP_TAC Rogers.DUUNHOR); + (ASM_REWRITE_TAC[IN]); + (STRIP_TAC); + + (MATCH_MP_TAC Qzksykg.QZKSYKG1); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell j V vl`)]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[ASSUME `X:real^3->bool = {}`; NEGLIGIBLE_EMPTY]); + + (MATCH_MP_TAC Qzksykg.QZKSYKG1); + (EXISTS_TAC `vl:(real^3)list` THEN EXISTS_TAC `j:num`); + (EXISTS_TAC `q:num->num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell j V vl`)]); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[ASSUME `X:real^3->bool = {}`; NEGLIGIBLE_EMPTY]); + (UNDISCH_TAC `~NULLSET r`); + (REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `rogers V (left_action_list p ul) INTER + rogers V (left_action_list q vl)`); + (STRIP_TAC); + (ASM_SIMP_TAC[COPLANAR_IMP_NEGLIGIBLE]); + (ASM_SET_TAC[]); + (ABBREV_TAC `xl:(real^3)list = (left_action_list p ul)`); + (ABBREV_TAC `yl:(real^3)list = (left_action_list q vl)`); + + + (NEW_GOAL `barV V 3 xl /\ + (!k. i - 1 <= k /\ k <= 3 + ==> omega_list_n V xl k = omega_list_n V ul k)`); + (MATCH_MP_TAC Ynhyjit.YNHYJIT); + (EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `j = 2`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[GSYM (ASSUME `mcell i V ul = X`); ASSUME `i = j:num`; + MCELL_EXPLICIT; mcell2; ASSUME `j = 2`]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `2 - 1 = 1`]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `j = 3`); + (ASM_SET_TAC[]); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[GSYM (ASSUME `mcell i V ul = X`); ASSUME `i = j:num`; + MCELL_EXPLICIT; mcell3; ASSUME `j = 3`]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + + (NEW_GOAL `barV V 3 yl /\ + (!k. j - 1 <= k /\ k <= 3 + ==> omega_list_n V yl k = omega_list_n V vl k)`); + (MATCH_MP_TAC Ynhyjit.YNHYJIT); + (EXISTS_TAC `q:num->num`); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `j = 2`); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[ASSUME `X = mcell j V vl`; MCELL_EXPLICIT; mcell2; ASSUME `j = 2`]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `2 - 1 = 1`]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `j = 3`); + (ASM_SET_TAC[]); + (UNDISCH_TAC `~NULLSET X`); + (REWRITE_TAC[ASSUME `X = mcell j V vl`; MCELL_EXPLICIT; mcell3; ASSUME `j = 3`]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + + (NEW_GOAL `!k. 0 <= k /\ k <= 3 + ==> omega_list_n V xl k = omega_list_n V yl k`); + (MATCH_MP_TAC Njiutiu.NJIUTIU); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `aff_dim (rogers V yl) <= &(dimindex (:3))`); + (REWRITE_TAC[AFF_DIM_LE_UNIV]); + (UP_ASM_TAC THEN REWRITE_TAC[DIMINDEX_3]); + (STRIP_TAC); + (NEW_GOAL `~(aff_dim (rogers V yl) <= &2)`); + (STRIP_TAC); + (UNDISCH_TAC `~NULLSET r` THEN REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `rogers V yl`); + (STRIP_TAC); + (MATCH_MP_TAC COPLANAR_IMP_NEGLIGIBLE); + (ASM_SIMP_TAC[Rogers.AFF_DIM_LE_2_IMP_COPLANAR]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (NEW_GOAL + `(!k. j - 1 <= k /\ k <= 3 ==> omega_list_n V xl k = omega_list_n V yl k)`); + (REPEAT STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `j = 2 \/ j = 3 \/ j = 4`); + (ASM_SET_TAC[]); + + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (ASM_MESON_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 23 *) + +let MCELL_ID_MXI = prove_by_refinement ( + `!V i j ul vl. + packing V /\ + saturated V /\ + barV V 3 ul /\ + barV V 3 vl /\ + HD ul = HD vl /\ + mcell i V ul = mcell j V vl /\ + ~NULLSET (mcell i V ul) /\ + i IN {2, 3} /\ + j IN {2, 3} + ==> mxi V ul = mxi V vl`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `i = j /\ + (!k. i - 1 <= k /\ k <= 3 + ==> omega_list_n V ul k = omega_list_n V vl k)`); + (MATCH_MP_TAC MCELL_ID_OMEGA_LIST_N); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ASM_CASES_TAC `hl (truncate_simplex 2 (ul:(real^3)list)) >= sqrt (&2)`); + (ASM_CASES_TAC `hl (truncate_simplex 2 (vl:(real^3)list)) >= sqrt (&2)`); + + (REWRITE_WITH `mxi V ul = omega_list_n V ul 2`); + (REWRITE_TAC[mxi] THEN COND_CASES_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `mxi V vl = omega_list_n V vl 2`); + (REWRITE_TAC[mxi] THEN COND_CASES_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ARITH `~(a >= b) <=> a < b`]); + (STRIP_TAC); + + (ABBREV_TAC `xl = truncate_simplex 2 (ul:(real^3)list)`); + (ABBREV_TAC `yl = truncate_simplex 2 (vl:(real^3)list)`); + + (NEW_GOAL `set_of_list (truncate_simplex (i - 1) (ul:(real^3)list)) = + set_of_list (truncate_simplex (i - 1) vl)`); + (NEW_GOAL `V INTER mcell i V ul = set_of_list (truncate_simplex (i - 1) ul)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (NEW_GOAL `V INTER mcell j V vl = set_of_list (truncate_simplex (j - 1) vl)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `F`); + (NEW_GOAL `hl (xl:(real^3)list) <= dist (omega_list V xl, HD xl)`); + (MATCH_MP_TAC Rogers.WAUFCHE1); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN] THEN EXPAND_TAC "xl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `hl yl = dist (omega_list V yl, HD yl)`); + (MATCH_MP_TAC Rogers.WAUFCHE2); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN]); + (EXPAND_TAC "yl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `omega_list V xl = omega_list V yl`); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH (xl:(real^3)list) = 3 /\ LENGTH (yl:(real^3)list) = 3`); + (EXPAND_TAC "xl" THEN EXPAND_TAC "yl"); + (REWRITE_TAC[ARITH_RULE `3 = 2 + 1`]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (REWRITE_TAC[ARITH_RULE `3 - 1 = 2`]); + (EXPAND_TAC "xl" THEN EXPAND_TAC "yl"); + (REWRITE_WITH + `truncate_simplex 2 ul = truncate_simplex (2 + 0) (ul:(real^3)list) /\ + truncate_simplex 2 vl = truncate_simplex (2 + 0) (vl:(real^3)list)`); + (REWRITE_TAC[ARITH_RULE `2 + 0 = 2`]); + (REWRITE_WITH + `omega_list_n V (truncate_simplex (2 + 0) ul) 2 = omega_list_n V ul 2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH + `omega_list_n V (truncate_simplex (2 + 0) vl) 2 = omega_list_n V vl 2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + (NEW_GOAL `HD (xl:(real^3)list) = HD yl`); + (EXPAND_TAC "xl" THEN EXPAND_TAC "yl"); + (REWRITE_WITH `HD (truncate_simplex 2 ul) = (HD ul):real^3`); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH `HD (truncate_simplex 2 vl) = (HD vl):real^3`); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `hl (yl:(real^3)list) = dist (omega_list V xl, HD xl)`); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + +(* ======================================================================= *) + + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ARITH `~(a >= b) <=> a < b`]); + (STRIP_TAC); + (ASM_CASES_TAC `hl (truncate_simplex 2 (vl:(real^3)list)) >= sqrt (&2)`); + + (ABBREV_TAC `xl = truncate_simplex 2 (ul:(real^3)list)`); + (ABBREV_TAC `yl = truncate_simplex 2 (vl:(real^3)list)`); + + (NEW_GOAL `set_of_list (truncate_simplex (i - 1) (ul:(real^3)list)) = + set_of_list (truncate_simplex (i - 1) vl)`); + (NEW_GOAL `V INTER mcell i V ul = set_of_list (truncate_simplex (i - 1) ul)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (NEW_GOAL `V INTER mcell j V vl = set_of_list (truncate_simplex (j - 1) vl)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `F`); + (NEW_GOAL `hl (yl:(real^3)list) <= dist (omega_list V yl, HD yl)`); + (MATCH_MP_TAC Rogers.WAUFCHE1); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN] THEN EXPAND_TAC "yl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `hl xl = dist (omega_list V xl, HD xl)`); + (MATCH_MP_TAC Rogers.WAUFCHE2); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN]); + (EXPAND_TAC "xl" THEN MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `omega_list V xl = omega_list V yl`); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH (xl:(real^3)list) = 3 /\ LENGTH (yl:(real^3)list) = 3`); + (EXPAND_TAC "xl" THEN EXPAND_TAC "yl"); + (REWRITE_TAC[ARITH_RULE `3 = 2 + 1`]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (REWRITE_TAC[ARITH_RULE `3 - 1 = 2`]); + (EXPAND_TAC "xl" THEN EXPAND_TAC "yl"); + (REWRITE_WITH + `truncate_simplex 2 ul = truncate_simplex (2 + 0) (ul:(real^3)list) /\ + truncate_simplex 2 vl = truncate_simplex (2 + 0) (vl:(real^3)list)`); + (REWRITE_TAC[ARITH_RULE `2 + 0 = 2`]); + (REWRITE_WITH + `omega_list_n V (truncate_simplex (2 + 0) ul) 2 = omega_list_n V ul 2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH + `omega_list_n V (truncate_simplex (2 + 0) vl) 2 = omega_list_n V vl 2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `HD (xl:(real^3)list) = HD yl`); + (EXPAND_TAC "xl" THEN EXPAND_TAC "yl"); + (REWRITE_WITH `HD (truncate_simplex 2 ul) = (HD ul):real^3`); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH `HD (truncate_simplex 2 vl) = (HD vl):real^3`); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `hl (xl:(real^3)list) = dist (omega_list V yl, HD yl)`); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ARITH `~(a >= b) <=> a < b`]); + (STRIP_TAC); + +(* ======================================================================= *) + + (NEW_GOAL `sqrt (&2) <= hl (ul:(real^3)list)`); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_CASES_TAC `i = 2`); + (REWRITE_TAC[MCELL_EXPLICIT; ASSUME `i = 2`; mcell2]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (NEW_GOAL `i = 3`); + (ASM_SET_TAC[]); + (REWRITE_TAC[MCELL_EXPLICIT; ASSUME `i = 3`; mcell3]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `sqrt (&2) <= hl (vl:(real^3)list)`); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[]); + (ASM_CASES_TAC `j = 2`); + (REWRITE_TAC[MCELL_EXPLICIT; ASSUME `j = 2`; mcell2]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (NEW_GOAL `j = 3`); + (ASM_SET_TAC[]); + (REWRITE_TAC[MCELL_EXPLICIT; ASSUME `j = 3`; mcell3]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (ABBREV_TAC `s2 = omega_list_n V ul 2`); + (ABBREV_TAC `s3 = omega_list_n V ul 3`); + (NEW_GOAL `s2 = omega_list_n V vl 2`); + (EXPAND_TAC "s2" THEN FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + (NEW_GOAL `s3 = omega_list_n V vl 3`); + (EXPAND_TAC "s3" THEN FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + (ABBREV_TAC `u0:real^3 = HD ul`); + + (NEW_GOAL `?s. between s (s2,s3) /\ + dist (u0,s) = sqrt (&2) /\ + mxi V ul = s`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "s3"); + (MATCH_MP_TAC MXI_EXPLICIT); + (NEW_GOAL `?v0 u1 u2 u3. ul = [v0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `v0:real^3 = HD ul`); + (REWRITE_TAC[ASSUME `ul = [v0;u1;u2;u3:real^3]`; HD]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?t. between t (s2,s3) /\ + dist (u0,t) = sqrt (&2) /\ + mxi V vl = t`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MXI_EXPLICIT); + (NEW_GOAL `?v0 u1 u2 u3. vl = [v0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[HD]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `!n. between n (s2, s3:real^3) ==> + dist (u0, n) pow 2 = dist (s2, n) pow 2 + dist (u0, s2) pow 2`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[dist]); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (ABBREV_TAC `zl = truncate_simplex 2 (ul:(real^3)list)`); + (REWRITE_WITH `s2:real^3 = circumcenter (set_of_list zl)`); + (REWRITE_WITH `s2 = omega_list V zl`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "zl"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_LEMMA); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN]); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool`); + (EXISTS_TAC `2`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `s2 IN voronoi_list V zl`); + (REWRITE_WITH `s2 = omega_list V zl`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "zl"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_LEMMA); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `2`); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `s3 IN voronoi_list V zl`); + (EXPAND_TAC "s3" THEN EXPAND_TAC "zl"); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3 /\ 3 <= 3`]); + (NEW_GOAL `affine hull {s2, s3} SUBSET affine hull voronoi_list V zl`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA); + (ASM_SET_TAC[]); + (NEW_GOAL `n IN affine hull {s2, s3:real^3}`); + (NEW_GOAL `convex hull {s2,s3} SUBSET affine hull {s2,s3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (NEW_GOAL `n IN convex hull {s2, s3:real^3}`); + (REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL]); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + + (MATCH_MP_TAC Marchal_cells_2_new.IN_AFFINE_KY_LEMMA1); + (REWRITE_WITH `u0:real^3 = HD zl`); + (EXPAND_TAC "zl" THEN EXPAND_TAC "u0"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Packing3.HD_IN_SET_OF_LIST); + + (REWRITE_WITH `LENGTH (zl:(real^3)list) = 2 + 1 /\ + CARD (set_of_list zl) = 2 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ARITH_TAC); + + (NEW_GOAL `dist (u0,s) pow 2 = dist (s2,s:real^3) pow 2 + dist (u0,s2) pow 2`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `dist (u0,t) pow 2 = dist (s2,t:real^3) pow 2 + dist (u0,s2) pow 2`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `dist (s2, s:real^3) = dist (s2, t)`); + (REWRITE_TAC[DIST_EQ]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + + (UNDISCH_TAC `between s (s2, s3:real^3)` THEN + UNDISCH_TAC `between t (s2, s3:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `dist (s2,s) = dist (s2,t:real^3)`); + (REWRITE_TAC[dist;ASSUME `s = u' % s2 + v' % s3:real^3`; + ASSUME `t = u % s2 + v % s3:real^3` ]); + (REWRITE_WITH `s2 - (u' % s2 + v' % s3) = + (u' + v') % s2 - (u' % s2 + v' % s3:real^3)`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `s2 - (u % s2 + v % s3) = + (u + v) % s2 - (u % s2 + v % s3:real^3)`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `(u + v) % s - (u % s + v % t) = v % (s - t)`]); + (REWRITE_TAC[NORM_MUL]); + (REWRITE_WITH `abs v = v /\ abs v' = v'`); + (ASM_SIMP_TAC[REAL_ABS_REFL]); + (REWRITE_TAC[REAL_ARITH `a * b = c * b <=> (a - c) * b = &0`;REAL_ENTIRE]); + (STRIP_TAC); + (REWRITE_WITH `v = v':real /\ u = u':real`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[NORM_EQ_0]); + (REWRITE_TAC[VECTOR_ARITH `a - b = vec 0 <=> a = b`] THEN STRIP_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `hl (ul:(real^3)list) <= dist (s3,u0:real^3)`); + (REWRITE_WITH `s3 = omega_list V ul /\ u0 = HD ul`); + (STRIP_TAC); + (REWRITE_TAC[GSYM (ASSUME `omega_list_n V ul 3 = s3`); OMEGA_LIST]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `(3 + 1) - 1 = 3`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Rogers.WAUFCHE1); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[IN]); + (ABBREV_TAC `zl:(real^3)list = truncate_simplex 2 ul`); + (NEW_GOAL `hl (zl:(real^3)list) = dist (s3, u0:real^3)`); + + + (REWRITE_WITH `s3 = omega_list V zl /\ u0 = HD zl`); + (STRIP_TAC); + (REWRITE_TAC[GSYM (ASSUME `s2:real^3 = s3`); OMEGA_LIST]); + (EXPAND_TAC "s2"); + + (REWRITE_WITH `LENGTH (zl:(real^3)list) = 2 + 1 /\ + CARD (set_of_list zl) = 2 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (REWRITE_TAC[ARITH_RULE `(2 + 1) - 1 = 2`]); + (EXPAND_TAC "zl"); + + (REWRITE_WITH `truncate_simplex 2 (ul:(real^3)list) = + truncate_simplex (2 + 0) (ul:(real^3)list)`); + (REWRITE_TAC[ARITH_RULE `2 + 0 = 2`]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (EXPAND_TAC "zl" THEN EXPAND_TAC "u0"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Rogers.WAUFCHE2); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN]); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[])]);; + + +(* ==================================================================== *) +(* Lemma 24 *) + +let AFFINE_HULL_3_INSERT = prove_by_refinement ( +`!a:real^3 S. + a IN affine hull S ==> affine hull (a INSERT S) = affine hull S`, +[(REPEAT STRIP_TAC); + (MATCH_MP_TAC AFFINE_HULLS_EQ); + (ASM_REWRITE_TAC[SET_SUBSET_AFFINE_HULL; INSERT_SUBSET]); + (MATCH_MP_TAC (SET_RULE `a:real^3 INSERT s SUBSET t ==> s SUBSET t`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL])]);; + +(* ==================================================================== *) +(* Lemma 25 *) + +let FINITE_EDGE_X2 = prove_by_refinement ( + `!(V:real^3->bool) e:real^3->bool u0 u1. + packing V /\ saturated V /\ e = {u0, u1} ==> + FINITE {X | mcell_set V X /\ edgeX V X e}`, +[(REPEAT STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | mcell_set V X /\ edgeX V X e /\ ~(X = {})} UNION {{}}`); + + (ONCE_REWRITE_TAC[SET_RULE `A /\ B <=> B /\ A`]); + (STRIP_TAC); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM; IN_UNION]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[MESON[IN] `{{}} x <=> x IN {{}}`; + SET_RULE `x IN {a} <=> x = a`]); + (MESON_TAC[]); + (REWRITE_TAC [FINITE_UNION; FINITE_SING]); + + (MATCH_MP_TAC FINITE_SUBSET); + (ABBREV_TAC `f = (\(i, ul). mcell i V ul)`); + (ABBREV_TAC `s = V INTER ball (u0:real^3, &4)`); + (ABBREV_TAC `S = {y | ?v0 v1 v2 v3:real^3. + v0 IN s /\ + v1 IN s /\ + v2 IN s /\ + v3 IN s /\ + y = [v0; v1; v2; v3]}`); + (ABBREV_TAC `S1 = {i, (ul:(real^3)list) | i IN 0..4 /\ ul IN S}`); + (EXISTS_TAC `{(f:num#(real^3)list->real^3->bool) x | x IN S1}`); + (STRIP_TAC); + (REWRITE_TAC[SET_RULE `{f x |x IN s } = {y | ?x. x IN s /\ y = f x}`]); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (EXPAND_TAC "S1"); + (MATCH_MP_TAC FINITE_PRODUCT); + (REWRITE_TAC[FINITE_NUMSEG]); + (EXPAND_TAC "S"); + (MATCH_MP_TAC Ajripqn.FINITE_SET_LIST_LEMMA); + (EXPAND_TAC "s"); + (MATCH_MP_TAC Pack2.KIUMVTC THEN ASM_SIMP_TAC[]); + + (EXPAND_TAC "f" THEN REWRITE_TAC[SUBSET; IN; IN_ELIM_THM; mcell_set_2]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `(i:num, ul:(real^3)list)`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "S1" THEN REWRITE_TAC[IN_ELIM_THM]); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `ul:(real^3)list`); + (ASM_REWRITE_TAC[IN_NUMSEG_0]); + (EXPAND_TAC "S" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (NEW_GOAL `?v0 v1 v2 v3. ul = [v0; v1; v2; v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + (EXISTS_TAC `v0:real^3` THEN EXISTS_TAC `v1:real^3` THEN + EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list ul SUBSET (s:real^3->bool)`); + (EXPAND_TAC "s"); + (REWRITE_TAC[SUBSET_INTER]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + + (NEW_GOAL `~NULLSET x`); + (UNDISCH_TAC `edgeX V x e`); + (REWRITE_TAC[edgeX; IN_ELIM_THM; VX]); + (COND_CASES_TAC); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `{ } (u:real^3)`); + (REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`] THEN SET_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `VX V x = V INTER x`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `V INTER (x:real^3->bool) = + set_of_list (truncate_simplex (i - 1) ul)`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (REWRITE_TAC[GSYM (ASSUME `ul = [v0;v1;v2;v3:real^3]`); + GSYM (ASSUME `x = mcell i V ul`)]); + (ASM_REWRITE_TAC[]); + (ASM_CASES_TAC `i = 0`); + (NEW_GOAL `F`); + (UNDISCH_TAC `edgeX V x e`); + (REWRITE_TAC[edgeX; IN_ELIM_THM]); + (REWRITE_WITH `VX V x = {}`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `{ } (u:real^3)`); + (REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`] THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN ARITH_TAC); + + (NEW_GOAL `u0 IN VX V x`); + (UNDISCH_TAC `edgeX V x e`); + (REWRITE_TAC[edgeX; IN_ELIM_THM; ASSUME `e = {u0, u1:real^3}`; IN]); + (REPEAT STRIP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[GSYM (ASSUME `ul = [v0; v1; v2; v3:real^3]`)]); + (STRIP_TAC); + (NEW_GOAL `set_of_list (truncate_simplex (i - 1) ul) SUBSET + set_of_list (ul:(real^3)list)`); + (MATCH_MP_TAC Rogers.SET_OF_LIST_TRUNCATE_SIMPLEX_SUBSET); + (ASM_REWRITE_TAC[LENGTH] THEN ASM_ARITH_TAC); + (ASM_SET_TAC[]); + (REWRITE_TAC[MESON[IN] `(s:real^3->bool) v <=> v IN s`]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[])]);; + + +(* ==================================================================== *) +(* Lemma 26 *) + +let CONTINUOUS_ON_LIFT_DOT2 = prove + (`!f:real^M->real^N g s. + f continuous_on s /\ g continuous_on s + ==> (\x. lift(f x dot g x)) continuous_on s`, + REPEAT GEN_TAC THEN + SUBGOAL_THEN `bilinear (\x y:real^N. lift(x dot y))` MP_TAC THENL + [REWRITE_TAC[bilinear; linear; DOT_LADD; DOT_RADD; DOT_LMUL; DOT_RMUL] THEN + REWRITE_TAC[LIFT_ADD; LIFT_CMUL]; + REWRITE_TAC[GSYM IMP_CONJ_ALT; GSYM CONJ_ASSOC] THEN + DISCH_THEN(MP_TAC o MATCH_MP BILINEAR_CONTINUOUS_ON_COMPOSE) THEN + REWRITE_TAC[]]);; + +let LIFT_MUL_CONTINUOUS_ON = prove + (`!f:real^N->real g s. + lift o f continuous_on s /\ lift o g continuous_on s ==> + lift o (\x. f x * g x) continuous_on s`, + REWRITE_TAC[o_DEF; LIFT_CMUL] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC CONTINUOUS_ON_MUL THEN + ASM_REWRITE_TAC[o_DEF]);; + +let LIFT_DIV_CONTINUOUS_ON = prove + (`!f:real^N->real g s. + lift o f continuous_on s /\ lift o g continuous_on s /\ + (!x. x IN s ==> ~(g x = &0))==> + lift o (\x. f x / g x) continuous_on s`, + REWRITE_TAC[o_DEF; LIFT_CMUL; real_div] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC CONTINUOUS_ON_MUL THEN + ASM_REWRITE_TAC[o_DEF] THEN + MATCH_MP_TAC(REWRITE_RULE[o_DEF] CONTINUOUS_ON_INV) THEN + ASM_REWRITE_TAC[]);; + +let LIFT_DOT_CONTINUOUS_ON = prove +(`!a:real^N b s. + (lift o ((\x. (x - a) dot b))) continuous_on s`, + REPEAT GEN_TAC THEN REWRITE_TAC[o_DEF] THEN + MATCH_MP_TAC CONTINUOUS_ON_LIFT_DOT2 THEN + ASM_SIMP_TAC[CONTINUOUS_ON_SUB; CONTINUOUS_ON_CONST; CONTINUOUS_ON_ID]);; + +let LIFT_NORM_CONTINUOUS_ON = prove + (`!a:real^N s. + (lift o ((\x. norm (x - a)))) continuous_on s`, + REPEAT GEN_TAC THEN REWRITE_TAC[o_DEF] THEN + MATCH_MP_TAC CONTINUOUS_ON_LIFT_NORM_COMPOSE THEN + ASM_SIMP_TAC[CONTINUOUS_ON_SUB; CONTINUOUS_ON_CONST; CONTINUOUS_ON_ID]);; + +(* ==================================================================== *) +(* Lemma 27 *) + +let aff_ge_alt = new_definition + `aff_ge_alt s t (v:real^3) <=> + (?f q. FINITE q /\ q SUBSET t /\ v = lin_combo (s UNION q) f /\ + (!w. q w ==> &0 <= f w) /\ + sum (s UNION q) f = &1)`;; + +let smallest_angle_set = new_definition + `!u0:real^3 u1 s. + smallest_angle_set s u0 u1 = + (@x. x IN s /\ (!y. y IN s ==> + ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0))))`;; + +let smallest_angle_line = new_definition + `!a b c d:real^3. + smallest_angle_line a b c d = smallest_angle_set (convex hull {a, b}) c d`;; + +let SMALLEST_ANGLE_LINE_EXISTS = prove_by_refinement ( + `!a b u0 u1. ~(u0 = u1) /\ ~(u0 IN convex hull {a, b}) ==> + (?x. (x IN convex hull {a, b:real^3} /\ + (!y. y IN convex hull {a, b} ==> + ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0)))))`, +[(REPEAT STRIP_TAC); + (ABBREV_TAC `f = (\x:real^3. ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0)))`); + + (REWRITE_WITH `!y:real^3. + ((y - u0) dot (u1 - u0)) / (norm (y - u0) * norm (u1 - u0)) = f y`); + (EXPAND_TAC "f" THEN REWRITE_TAC[]); + (MATCH_MP_TAC CONTINUOUS_ATTAINS_SUP); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMP_COMPACT_CONVEX_HULL); + (REWRITE_TAC[Geomdetail.FINITE6]); + (STRIP_TAC); + (REWRITE_TAC[CONVEX_HULL_EQ_EMPTY] THEN SET_TAC[]); + (ABBREV_TAC `f1 = (\x. (x - u0) dot (u1 - u0:real^3))`); + (ABBREV_TAC `f2 = (\x. norm (x - u0) * norm (u1 - u0:real^3))`); + (REWRITE_WITH `f = (\x:real^3. f1 x / f2 x)`); + (EXPAND_TAC "f" THEN EXPAND_TAC "f1" THEN EXPAND_TAC "f2"); + (REWRITE_TAC[]); + (MATCH_MP_TAC LIFT_DIV_CONTINUOUS_ON); + + (REPEAT STRIP_TAC); + (EXPAND_TAC "f1"); + (REWRITE_TAC[LIFT_DOT_CONTINUOUS_ON]); + (ABBREV_TAC `f3 = (\x:real^3. norm (u1 - u0:real^3))`); + (ABBREV_TAC `f4 = (\x:real^3. norm (x - u0:real^3))`); + (REWRITE_WITH `f2 = (\x:real^3. f4 x * f3 x)`); + (EXPAND_TAC "f2" THEN EXPAND_TAC "f3" THEN EXPAND_TAC "f4"); + (REWRITE_TAC[]); + (MATCH_MP_TAC LIFT_MUL_CONTINUOUS_ON); + (EXPAND_TAC "f3" THEN EXPAND_TAC "f4"); + (REWRITE_TAC[LIFT_NORM_CONTINUOUS_ON]); + (REWRITE_TAC[o_DEF; CONTINUOUS_ON_CONST]); + (UP_ASM_TAC THEN EXPAND_TAC "f2" THEN REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0]); + (ASM_REWRITE_TAC[VECTOR_ARITH `a - b = vec 0 <=> b = a`]); + (STRIP_TAC); + (ASM_MESON_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 28 *) + +let SMALLEST_ANGLE_IN_CONVEX_HULL = prove_by_refinement ( + `!m n p q x. + ~(p = q) /\ ~(p IN convex hull {m,n}) /\ x = smallest_angle_line m n p q + ==> x IN convex hull {m, n}`, +[(REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[smallest_angle_line; smallest_angle_set]); + (STRIP_TAC); + (ABBREV_TAC `X = (\x:real^3. x IN convex hull {m, n} /\ + (!y. y IN convex hull {m, n} + ==> ((y - p) dot (q - p)) / (norm (y - p) * norm (q - p)) <= + ((x - p) dot (q - p)) / (norm (x - p) * norm (q - p))))`); + (NEW_GOAL `(X:real^3->bool) x`); + (ASM_REWRITE_TAC[] THEN MATCH_MP_TAC SELECT_AX); + (EXPAND_TAC "X" THEN ASM_SIMP_TAC[SMALLEST_ANGLE_LINE_EXISTS]); + (UP_ASM_TAC THEN EXPAND_TAC "X" THEN MESON_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 29 *) + +let SMALLEST_ANGLE_LINE_PROPERTY = prove_by_refinement ( + `!m n u0 u1 x y. + ~(u0 = u1) /\ + ~(u0 IN convex hull {m,n}) /\ + x = smallest_angle_line m n u0 u1 /\ + y IN convex hull {m, n} + ==> ((y - u0) dot (u1 - u0)) / + (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / + (norm (x - u0) * norm (u1 - u0))`, +[(REPEAT STRIP_TAC); + (UNDISCH_TAC `x = smallest_angle_line m n u0 u1`); + (REWRITE_TAC[smallest_angle_line; smallest_angle_set]); + (STRIP_TAC); + (ABBREV_TAC `X = + (\x:real^3. x IN convex hull {m, n} /\ + (!y. y IN convex hull {m, n} + ==> ((y - u0) dot (u1 - u0)) / (norm (y - u0) * norm (u1 - u0)) <= + ((x - u0) dot (u1 - u0)) / (norm (x - u0) * norm (u1 - u0))))`); + (NEW_GOAL `(X:real^3->bool) x`); + (ASM_REWRITE_TAC[] THEN MATCH_MP_TAC SELECT_AX); + (EXPAND_TAC "X" THEN ASM_SIMP_TAC[SMALLEST_ANGLE_LINE_EXISTS]); + (UP_ASM_TAC THEN EXPAND_TAC "X" THEN ASM_MESON_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 30 *) + +let MCELL_SUBSET_BALL8_1 = prove_by_refinement ( + `!v:real^3 ul i V. + i<= 4 /\ packing V /\ saturated V /\ barV V 3 ul /\ v IN mcell i V ul ==> + mcell i V ul SUBSET ball (v, &8)`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `mcell i V ul SUBSET + UNIONS {rogers V (left_action_list p ul) | p permutes 0..i - 1}`); + (MATCH_MP_TAC Qzksykg.QZKSYKG2); + (ASM_REWRITE_TAC[SET_RULE `i IN {0,1,2,3,4}<=> i =0\/i=1\/i=2\/i=3\/i=4`]); + (ASM_ARITH_TAC); + (NEW_GOAL `UNIONS {rogers V (left_action_list p ul) | p permutes 0..i - 1} + SUBSET UNIONS {voronoi_closed V s | s IN set_of_list ul}`); + (REWRITE_TAC[SUBSET; IN_UNIONS; IN;IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `voronoi_closed V ((HD (left_action_list p ul)):real^3)`); + (STRIP_TAC); + (EXISTS_TAC `(HD (left_action_list p ul)):real^3`); + (REWRITE_TAC[MESON[IN] `(a:real^3->bool) s <=> s IN a`]); + (REWRITE_WITH + `set_of_list (ul:(real^3)list) = set_of_list (left_action_list p ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (ASM_CASES_TAC `i = 4`); + (MATCH_MP_TAC Packing3.SET_OF_LIST_LEFT_ACTION_LIST); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[ARITH_RULE `3 + 1 = 4`]); + + (ASM_CASES_TAC `i = 3`); + (MATCH_MP_TAC Marchal_cells_2_new.SET_OF_LIST_LEFT_ACTION_LIST_2); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[ARITH_RULE `(3 + 1) - 2 = 3 - 1 /\ 2 <= 3 + 1`]); + + (ASM_CASES_TAC `i = 2`); + (MATCH_MP_TAC Marchal_cells_2_new.SET_OF_LIST_LEFT_ACTION_LIST_3); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[ARITH_RULE `(3 + 1) - 3 = 2 - 1 /\ 3 <= 3 + 1`]); + + (NEW_GOAL `i <= 1`); + (ASM_ARITH_TAC); + (NEW_GOAL `p permutes 0..0`); + (ASM_MESON_TAC[ARITH_RULE `i <= 1 ==> i - 1 = 0`]); + (UP_ASM_TAC THEN REWRITE_TAC[Packing3.PERMUTES_TRIVIAL] THEN STRIP_TAC); + (ASM_REWRITE_TAC[Packing3.LEFT_ACTION_LIST_I]); + (MATCH_MP_TAC Packing3.HD_IN_SET_OF_LIST); + (REWRITE_TAC[Packing3.LENGTH_LEFT_ACTION_LIST]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[MESON[IN] `(a:real^3->bool) s <=> s IN a`]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `rogers V (left_action_list p ul) SUBSET + voronoi_closed V (HD (left_action_list p ul))`); + (MATCH_MP_TAC ROGERS_SUBSET_VORONOI_CLOSED); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Qzksykg.QZKSYKG1); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num` THEN + EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (REWRITE_TAC[SET_RULE `i IN {0,1,2,3,4} <=> i=0\/i=1\/i=2\/i=3\/i=4`]); + (ASM_ARITH_TAC); + (UNDISCH_TAC `v IN mcell i V ul` THEN SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `UNIONS {voronoi_closed V s | s IN set_of_list ul} SUBSET + UNIONS {ball (s:real^3, &2) | s IN set_of_list ul}`); + (NEW_GOAL `!s:real^3. voronoi_closed V s SUBSET ball (s, &2)`); + (ASM_SIMP_TAC[Packing3.VORONOI_BALL2]); + (UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `mcell i V ul SUBSET UNIONS {ball (s,&2) | s IN set_of_list ul}`); + (ABBREV_TAC `s1 = + UNIONS {rogers V (left_action_list p ul) | p permutes 0..i - 1}`); + (ABBREV_TAC `s2 = + UNIONS {voronoi_closed V (s:real^3) | s IN set_of_list ul}`); + (ABBREV_TAC `s3 = UNIONS {ball (s:real^3,&2) | s IN set_of_list ul}`); + (DEL_TAC THEN DEL_TAC THEN DEL_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[SUBSET; IN_UNIONS; IN; IN_ELIM_THM; IN_BALL]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?t. (?s. set_of_list ul s /\ t = ball (s:real^3,&2)) /\ t x`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `dist (s, x:real^3) < &2`); + (REWRITE_TAC[GSYM IN_BALL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `?t. (?s. set_of_list ul s /\ t = ball (s:real^3,&2)) /\ t v`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `dist (s', v:real^3) < &2`); + (REWRITE_TAC[GSYM IN_BALL]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `dist (v, x:real^3) <= dist (s', v) + dist (s', s) + dist (s, x)`); + (NORM_ARITH_TAC); + (NEW_GOAL `dist (s', s:real^3) < &4`); + (REWRITE_TAC[GSYM IN_BALL]); + + (NEW_GOAL `set_of_list ul SUBSET ball (s':real^3,&4)`); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[IN]); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 31 *) + +let MCELL_SUBSET_BALL8 = prove_by_refinement ( + `!v:real^3 ul i V. + packing V /\ saturated V /\ barV V 3 ul /\ v IN mcell i V ul ==> + mcell i V ul SUBSET ball (v, &8)`, +[(REPEAT STRIP_TAC); + (ASM_CASES_TAC `i <= 4`); + (ASM_SIMP_TAC[MCELL_SUBSET_BALL8_1]); + (UNDISCH_TAC `v IN mcell i V ul`); + (REWRITE_WITH `mcell i V ul = mcell 4 V ul`); + (ASM_SIMP_TAC[MCELL_EXPLICIT; ARITH_RULE `4 >= 4`; + ARITH_RULE `~(i <= 4)==>i >= 4`]); + (STRIP_TAC); + (ASM_SIMP_TAC[MCELL_SUBSET_BALL8_1; ARITH_RULE `4 <= 4`])]);; + +(* ==================================================================== *) +(* Lemma 32 *) + +let FINITE_MCELL_SET_LEMMA_2 = prove_by_refinement ( + `!V r s:real^3. + packing V /\ saturated V + ==> FINITE {X | X SUBSET ball (s,r) /\ mcell_set V X}`, +[(REPEAT STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (vec 0,norm (s:real^3) + r) /\ + mcell_set V X}`); + (STRIP_TAC); + (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA]); + (REWRITE_TAC[IN; SUBSET; IN_BALL; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (NEW_GOAL `dist (vec 0, x') <= norm s + dist (s, x':real^3)`); + (NORM_ARITH_TAC); + (NEW_GOAL `dist (s, x':real^3) < r`); + (ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (ASM_REWRITE_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 33 *) + +let CONIC_CAP_WEDGE_EQ_0 =prove_by_refinement ( + `!v0 v1 a r w1 w2. a < &1 /\ &0 < r /\ + vol (conic_cap v0 v1 r a INTER wedge v0 v1 w1 w2) = &0 ==> + coplanar {v0,v1,w1, w2:real^3}`, +[(REPEAT STRIP_TAC); + (MATCH_MP_TAC (MESON[] `(~A==> F) ==> A`) THEN STRIP_TAC); + (NEW_GOAL `~collinear {v0, v1, w1:real^3}`); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `w2:real^3` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `~collinear {v0, v1, w2:real^3}`); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`] THEN + EXISTS_TAC `w1:real^3` THEN ASM_REWRITE_TAC[]); + + (NEW_GOAL `vol (conic_cap v0 v1 r a INTER wedge v0 v1 w1 (w2:real^3)) = + (if &1 < a \/ r < &0 + then &0 + else azim v0 v1 w1 w2 / &3 * (&1 - max a (-- &1)) * r pow 3)`); + (ASM_MESON_TAC[VOLUME_CONIC_CAP_WEDGE]); + (UP_ASM_TAC THEN COND_CASES_TAC); + (STRIP_TAC THEN ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[REAL_ARITH `&0 = a <=> a = &0`; + REAL_ENTIRE; REAL_ARITH `a / &3 = &0 <=> a = &0`]); + (REWRITE_TAC[REAL_ARITH `&1 - max a (-- &1) = &0 <=> a = &1`]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `~coplanar {v0, v1, w1, w2:real^3}`); + (ASM_SIMP_TAC[AZIM_EQ_0_PI_IMP_COPLANAR]); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[] THEN MATCH_MP_TAC REAL_POW_NZ); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 34 *) + +let CONIC_CAP_AFF_GT_EQ_0 =prove_by_refinement ( + `!v0 v1 a r w1 w2. a < &1 /\ &0 < r /\ + vol (conic_cap v0 v1 r a INTER aff_gt {v0, v1} {w1, w2}) = &0 ==> + coplanar {v0,v1,w1, w2:real^3}`, +[(REPEAT STRIP_TAC); + (MATCH_MP_TAC (MESON[] `(~A==> F) ==> A`) THEN STRIP_TAC); + (NEW_GOAL `~collinear {v0, v1, w1:real^3}`); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (EXISTS_TAC `w2:real^3` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `~collinear {v0, v1, w2:real^3}`); + (MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`] THEN + EXISTS_TAC `w1:real^3` THEN ASM_REWRITE_TAC[]); + (ASM_CASES_TAC `azim v0 v1 w1 (w2:real^3) < pi`); + (NEW_GOAL `wedge v0 v1 w1 w2 = aff_gt {v0, v1} {w1, w2:real^3}`); + (ASM_MESON_TAC[WEDGE_LUNE]); + (ASM_MESON_TAC[ CONIC_CAP_WEDGE_EQ_0]); + + (ASM_CASES_TAC `azim v0 v1 w1 (w2:real^3) > pi`); + (NEW_GOAL `azim v0 v1 w2 (w1:real^3) = + (if azim v0 v1 w1 w2 = &0 then &0 else &2 * pi - azim v0 v1 w1 w2)`); + (MATCH_MP_TAC AZIM_COMPL); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN COND_CASES_TAC); + (UNDISCH_TAC `azim v0 v1 w1 (w2:real^3) > pi` THEN ASM_REWRITE_TAC[]); + (MESON_TAC[PI_POS_LE; REAL_ARITH `&0 > a <=> ~(&0 <= a)`]); + (STRIP_TAC); + (NEW_GOAL `azim v0 v1 w2 (w1:real^3) < pi`); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `wedge v0 v1 w2 w1 = aff_gt {v0, v1} {w1, w2:real^3}`); + (REWRITE_WITH `{w1, w2:real^3} = {w2, w1}`); + (SET_TAC[]); + + (UNDISCH_TAC `~coplanar {v0, v1, w1, w2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_MESON_TAC[WEDGE_LUNE]); + + (UNDISCH_TAC `~coplanar {v0, v1, w1, w2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {a,b,d,c}`]); + (ASM_MESON_TAC[ CONIC_CAP_WEDGE_EQ_0]); + + (NEW_GOAL `azim v0 v1 w1 (w2:real^3) = pi`); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[AZIM_EQ_0_PI_IMP_COPLANAR])]);; + +(* ==================================================================== *) +(* Lemma 35 *) + +let CONIC_CAP_INTER_CONVEX_HULL_4_GT_0 = prove_by_refinement ( + `!u0:real^3 u1 w1 w2 r a. + &0 < r /\ a < &1 /\ &0 <= a /\ ~coplanar {u0, u1, w1, w2} ==> + vol (conic_cap u0 u1 r a INTER convex hull {u0, u1, w1, w2}) > &0`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `measurable + (conic_cap u0 u1 r a INTER convex hull {u0, u1, w1, w2:real^3})`); + (MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[MEASURABLE_CONIC_CAP; MEASURABLE_CONVEX_HULL]); + (SIMP_TAC[MEASURABLE_CONVEX_HULL;FINITE_IMP_BOUNDED;Geomdetail.FINITE6]); + (REWRITE_TAC[REAL_ARITH `a > &0 <=> &0 <= a /\ ~(a = &0)`]); + (ASM_SIMP_TAC[MEASURE_POS_LE]); + (REWRITE_WITH + `vol (conic_cap u0 u1 r a INTER convex hull {u0, u1, w1, w2}) = &0 <=> + NULLSET (conic_cap u0 u1 r a INTER convex hull {u0, u1, w1, w2})`); + (ASM_SIMP_TAC[MEASURABLE_MEASURE_EQ_0]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `~(u0 = u1:real^3)`); + (STRIP_TAC); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}` THEN REWRITE_TAC[]); + (REWRITE_WITH `{u0, u1, w1, w2} = {u1:real^3, w1, w2}`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[COPLANAR_3]); + + (NEW_GOAL `?r1 a1. &0 < r1 /\ a1 < &1 /\ + conic_cap u0 u1 r1 a1 INTER aff_ge {u0, u1} {w1, w2:real^3} = + conic_cap u0 u1 r1 a1 INTER convex hull {u0, u1,w1, w2} /\ + conic_cap u0 u1 r1 a1 SUBSET conic_cap u0 u1 r a`); + (ABBREV_TAC `s = closest_point (affine hull {u1, w1, w2:real^3}) u0`); + (ABBREV_TAC `r2 = dist (u0:real^3, s)`); + (ABBREV_TAC `r1 = min r2 r`); + (ABBREV_TAC `s2 = smallest_angle_line w1 (w2:real^3) u0 u1`); + (ABBREV_TAC + `a2 = ((s2 - u0:real^3) dot (u1 - u0)) /(norm (s2 - u0) * norm (u1 - u0))`); + (ABBREV_TAC `a1 = max a2 a`); + (EXISTS_TAC `r1:real` THEN EXISTS_TAC `a1:real`); + (NEW_GOAL `&0 < r1 /\ a1 < &1`); + (EXPAND_TAC "r1" THEN EXPAND_TAC "a1"); + (REWRITE_TAC[REAL_ARITH `&0 < min a b <=> &0 < a /\ &0 < b`; + REAL_ARITH `max a b < &1 <=> a < &1 /\ b < &1`;]); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (EXPAND_TAC "r2"); + (MATCH_MP_TAC DIST_POS_LT); + (STRIP_TAC); + + (NEW_GOAL `u0 IN affine hull {u1, w1, w2:real^3}`); + (ASM_REWRITE_TAC[]); + (DEL_TAC THEN EXPAND_TAC "s"); + (MATCH_MP_TAC CLOSEST_POINT_IN_SET); + (REWRITE_TAC[CLOSED_AFFINE_HULL; AFFINE_HULL_EQ_EMPTY] THEN SET_TAC[]); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_WITH `affine hull {u0, u1, w1, w2} = + affine hull {u1:real^3, w1, w2}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR; COPLANAR_3]); + + (EXPAND_TAC "a2"); + (MATCH_MP_TAC REAL_DIV_LT_1_TACTICS); + + (NEW_GOAL `s2 IN convex hull {w1, w2:real^3}`); + (MATCH_MP_TAC SMALLEST_ANGLE_IN_CONVEX_HULL); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_WITH `affine hull {u0, u1, w1, w2} = + affine hull {u1:real^3, w1, w2}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + (NEW_GOAL `convex hull {w1, w2} SUBSET affine hull {u1, w1, w2:real^3}`); + (NEW_GOAL `convex hull {w1, w2} SUBSET affine hull {w1, w2:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (NEW_GOAL `affine hull {w1, w2} SUBSET affine hull {u1, w1, w2:real^3}`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA); + (SET_TAC[]); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + (REWRITE_TAC[COPLANAR_3; COPLANAR_AFFINE_HULL_COPLANAR]); + + (NEW_GOAL `~(s2 = u0:real^3)`); + (STRIP_TAC); + (UNDISCH_TAC `s2 IN convex hull {w1, w2:real^3}` THEN ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_WITH `affine hull {u0, u1, w1, w2} = + affine hull {u1:real^3, w1, w2}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + (NEW_GOAL `convex hull {w1, w2} SUBSET affine hull {u1, w1, w2:real^3}`); + (NEW_GOAL `convex hull {w1, w2} SUBSET affine hull {w1, w2:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (NEW_GOAL `affine hull {w1, w2} SUBSET affine hull {u1, w1, w2:real^3}`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA); + (SET_TAC[]); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + (REWRITE_TAC[COPLANAR_3; COPLANAR_AFFINE_HULL_COPLANAR]); + + (STRIP_TAC); + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + + (REWRITE_TAC[REAL_ARITH `a < b <=> (a <= b) /\ ~(a = b)`]); + (STRIP_TAC); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ]); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ_EQ]); + (STRIP_TAC); + + + (ABBREV_TAC `t1 = norm (s2 - u0:real^3)`); + (ABBREV_TAC `t2 = norm (u1 - u0:real^3)`); + (NEW_GOAL `~(t2 = &0)`); + (EXPAND_TAC "t2" THEN REWRITE_TAC[NORM_EQ_0; + VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `s2 = t1 / t2 % u1 + (t2 - t1) / t2 % u0:real^3`); + (REWRITE_TAC[VECTOR_ARITH `t1 / t2 % u1 + (t2 - t1) / t2 % u0:real^3 = + &1 / t2 % (t1 % u1 + (t2 - t1) % u0)`]); + (REWRITE_WITH `t1 % u1 + (t2 - t1) % u0 = t2 % (s2:real^3)`); + (UNDISCH_TAC `t1 % (u1 - u0) = t2 % (s2 - u0:real^3)` THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `&1 / t2 % t2 % s2 = (t2 / t2) % s2`]); + (REWRITE_WITH `t2 / t2 = &1`); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + (VECTOR_ARITH_TAC); + (UNDISCH_TAC `s2 IN convex hull {w1, w2:real^3}`); + (ASM_REWRITE_TAC[IN; CONVEX_HULL_2; IN_ELIM_THM]); + (STRIP_TAC); + (ABBREV_TAC `t = t1 / t2`); + (ABBREV_TAC `t' = (t1 - t2) / t2`); + + (NEW_GOAL `u1 IN affine hull {u0, w1, w2:real^3}`); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `t'/ t` THEN EXISTS_TAC `u / t` THEN EXISTS_TAC `v / t`); + (STRIP_TAC); + (ASM_REWRITE_TAC[REAL_ARITH `a / t + b/ t + c / t = (a + b + c) / t `]); + (REWRITE_WITH `t' + &1 = t`); + (EXPAND_TAC "t'" THEN EXPAND_TAC "t"); + (NEW_GOAL `t2 / t2 = &1`); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_DIV_REFL); + (EXPAND_TAC "t"); + (ONCE_REWRITE_TAC[REAL_ARITH `a / b = a * (&1 / b)`]); + (REWRITE_TAC[REAL_ENTIRE]); + (REWRITE_WITH `~(t1 = &0)`); + (EXPAND_TAC "t1" THEN REWRITE_TAC[NORM_EQ_0; VECTOR_ARITH + `a - b = vec 0 <=> a = b`] THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Trigonometry2.NOT_EQ0_IMP_NEITHER_INVERT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_ARITH `t' / t % u0 + u / t % w1 + v / t % w2 = + &1 / t % (t' % u0 + u % w1 + v % w2)`]); + (REWRITE_WITH `t' % u0 + u % w1 + v % w2 = t % u1:real^3`); + (EXPAND_TAC "t'"); + (UNDISCH_TAC `t % u1 + (t2 - t1) / t2 % u0 = u % w1 + v % w2:real^3` + THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `&1 / t % t % u = t / t % u`]); + (REWRITE_WITH `t / t = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (EXPAND_TAC "t"); + (ONCE_REWRITE_TAC[REAL_ARITH `a / b = a * (&1 / b)`]); + (REWRITE_TAC[REAL_ENTIRE]); + (REWRITE_WITH `~(t1 = &0)`); + (EXPAND_TAC "t1" THEN REWRITE_TAC[NORM_EQ_0; VECTOR_ARITH + `a - b = vec 0 <=> a = b`] THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Trigonometry2.NOT_EQ0_IMP_NEITHER_INVERT); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {b,a,c,d}`]); + + (REWRITE_WITH `affine hull {u1, u0, w1, w2} = + affine hull {u0:real^3, w1, w2}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[COPLANAR_3; COPLANAR_AFFINE_HULL_COPLANAR]); + + (NEW_GOAL `conic_cap (u0:real^3) u1 r1 a1 SUBSET conic_cap u0 u1 r a`); + (REWRITE_TAC[conic_cap; NORMBALL_BALL] THEN MATCH_MP_TAC + (SET_RULE `a SUBSET b /\ c SUBSET d ==> a INTER c SUBSET b INTER d`)); + (STRIP_TAC); + (MATCH_MP_TAC SUBSET_BALL); + (EXPAND_TAC "r1" THEN REAL_ARITH_TAC); + (MATCH_MP_TAC RCONE_GT_SUBSET); + (EXPAND_TAC "a1" THEN REAL_ARITH_TAC); + + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[SET_RULE `b = a <=> a SUBSET b /\ b SUBSET a`]); + (STRIP_TAC); + (MATCH_MP_TAC (SET_RULE `a SUBSET b ==> x INTER a SUBSET x INTER b`)); + (REWRITE_TAC[Marchal_cells_2_new.CONVEX_HULL_4_SUBSET_AFF_GE_2_2]); + (REWRITE_TAC[SUBSET; IN_INTER]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (UP_ASM_TAC); + (NEW_GOAL `DISJOINT {u0, u1:real^3} {w1, w2}`); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `w1 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_WITH `{u0, u1, w1, w2:real^3} = {u0, u1, w2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_CASES_TAC `w2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_WITH `{u0, u1, w1, w2:real^3} = {u0, u1, w1:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_SET_TAC[]); + + (ASM_SIMP_TAC[Marchal_cells_2_new.AFF_GE_2_2; CONVEX_HULL_4; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `t1:real` THEN EXISTS_TAC `t2:real` THEN + EXISTS_TAC `t3:real` THEN EXISTS_TAC `t4:real`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= t <=> ~(t < &0)`] THEN STRIP_TAC); + (NEW_GOAL `!x. x IN affine hull {u1, w1, w2} ==> + dist (u0,s:real^3) <= dist (u0,x:real^3)`); + (REPEAT STRIP_TAC THEN EXPAND_TAC "s"); + (MATCH_MP_TAC CLOSEST_POINT_LE); + (ASM_REWRITE_TAC[CLOSED_AFFINE_HULL]); + + (NEW_GOAL `&1 < t2 + t3+ t4`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `~(t2 + t3+ t4 = &0)`); + (ASM_REAL_ARITH_TAC); + + (ABBREV_TAC `y = t2 / (t2 + t3 + t4) % u1 + t3 / (t2 + t3 + t4) % w1 + + t4 / (t2 + t3 + t4) % w2:real^3`); + (NEW_GOAL `x = t1 % u0 + (t2 + t3 + t4) % (y:real^3)`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_ARITH + `t1 % u0 + t2 % u1 + t3 % w1 + t4 % w2 = + t1 % u0 + t % (t2 / t % u1 + t3 / t % w1 + t4 / t % w2) <=> + t2 % u1 + t3 % w1 + t4 % w2 = t / t % (t2 % u1 + t3 % w1 + t4 % w2)`]); + (REWRITE_WITH `(t2 + t3 + t4) / (t2 + t3 + t4) = &1`); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `y IN affine hull {u1, w1, w2:real^3}`); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `t2 / (t2 + t3 + t4)` THEN + EXISTS_TAC `t3 / (t2 + t3 + t4)` THEN EXISTS_TAC `t4 / (t2 + t3 + t4)`); + (ASM_REWRITE_TAC[REAL_ARITH `a/x + b/ x + c/ x = (a+b+c) / x`]); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + + (NEW_GOAL `dist (u0, s:real^3) <= dist (u0, y:real^3)`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `dist (u0, s) <= dist (u0, x:real^3)`); + (REWRITE_TAC[ASSUME `x = t1 % u0 + (t2 + t3 + t4) % y:real^3`; dist]); + (REWRITE_WITH `u0 - (t1 % u0 + (t2 + t3 + t4) % y) = + (t1 + t2 + t3 + t4) % u0 - (t1 % u0 + (t2 + t3 + t4) % y:real^3)`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH + `(t1 + t) % u0 - (t1 % u0 + t % y) = t % (u0 - y)`; NORM_MUL]); + (REWRITE_WITH `abs (t2 + t3 + t4) = t2 + t3 + t4`); + (REWRITE_TAC[REAL_ABS_REFL] THEN ASM_REAL_ARITH_TAC); + (REWRITE_TAC[GSYM dist]); + (NEW_GOAL `dist (u0, y:real^3) <= (t2 + t3 + t4) * dist (u0, y)`); + (REWRITE_TAC[REAL_ARITH `a <= b * a <=> &0 <= (b - &1) * a`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `x IN ball (u0:real^3, r1)`); + (UNDISCH_TAC `x IN conic_cap u0 (u1:real^3) r1 a1`); + (REWRITE_TAC[conic_cap; NORMBALL_BALL] THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL]); + (EXPAND_TAC "r1" THEN EXPAND_TAC "r2"); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + +(* ========================================================================= *) +(* OK here *) + + (REWRITE_TAC[REAL_ARITH `&0 <= t <=> ~(t < &0)`] THEN STRIP_TAC); + (NEW_GOAL `!y. y IN convex hull {w1, w2:real^3} + ==> ((y - u0) dot (u1 - u0)) / (norm (y - u0) * norm (u1 - u0)) <= + ((s2 - u0) dot (u1 - u0)) / (norm (s2 - u0) * norm (u1 - u0))`); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC SMALLEST_ANGLE_LINE_PROPERTY); + (EXISTS_TAC `w1:real^3` THEN EXISTS_TAC `w2:real^3`); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_WITH `affine hull {u0, u1, w1, w2} = + affine hull {u1:real^3, w1, w2}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + (NEW_GOAL `convex hull {w1, w2:real^3} SUBSET affine hull {u1,w1, w2}`); + (NEW_GOAL `convex hull {w1, w2:real^3} SUBSET affine hull {w1, w2}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (NEW_GOAL `affine hull {w1, w2:real^3} SUBSET affine hull {u1,w1, w2}`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA THEN SET_TAC[]); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR; COPLANAR_3]); + + (NEW_GOAL `~(t3+ t4 = &0)`); + (STRIP_TAC); + (NEW_GOAL `t3 = &0 /\ t4 = &0`); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `x = t1 % u0 + t2 % u1:real^3`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (NEW_GOAL `x:real^3 IN rcone_gt u0 u1 a1`); + (UNDISCH_TAC `x:real^3 IN conic_cap u0 u1 r1 a1`); + (REWRITE_TAC[conic_cap] THEN SET_TAC[conic_cap]); + (UP_ASM_TAC THEN REWRITE_TAC[rcone_gt; rconesgn; IN; IN_ELIM_THM] THEN STRIP_TAC); + + (NEW_GOAL `(x - u0) dot (u1 - u0:real^3) <= &0`); + (REWRITE_TAC[ASSUME `x = t1 % u0 + t2 % u1:real^3`]); + (REWRITE_WITH `(t1 % u0 + t2 % u1) - u0 = + (t1 % u0 + t2 % u1) - (t1 + t2 + t3 + t4) % u0:real^3`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[ASSUME `t3 = &0 /\ t4 = &0`; VECTOR_ARITH + `(t1 % u0 + t2 % u1) - (t1 + t2 + &0 + &0) % u0 = t2 % (u1 - u0)`; DOT_LMUL; + REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DOT_POS_LE] THEN ASM_REAL_ARITH_TAC); + (NEW_GOAL `&0 <= dist (x,u0) * dist (u1,u0:real^3) * a1`); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIST_POS_LE]); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + + (ABBREV_TAC `y = t3 / (t3 + t4) % w1 + t4 / (t3 + t4) % w2:real^3`); + (NEW_GOAL `x = t1 % u0 + t2 % u1 + (t3 + t4) % (y:real^3)`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_ARITH + `t1 % u0 + t2 % u1 + t3 % w1 + t4 % w2 = + t1 % u0 + t2 % u1 + t % (t3 / t % w1 + t4 / t % w2) <=> + t3 % w1 + t4 % w2 = t / t % (t3 % w1 + t4 % w2)`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `y IN convex hull {w1, w2:real^3}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM]); + (EXISTS_TAC `t3 / (t3 + t4)` THEN EXISTS_TAC `t4 / (t3 + t4)`); + (ASM_REWRITE_TAC[REAL_ARITH `a / x + b / x = (a + b) / x`]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (ASM_REAL_ARITH_TAC); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + + (ABBREV_TAC `f = (\y:real^3. + ((y - u0) dot (u1 - u0)) / (norm (y - u0:real^3) * norm (u1 - u0)))`); + + (NEW_GOAL `a1 < (f:real^3->real) x`); + (NEW_GOAL `x:real^3 IN rcone_gt u0 u1 a1`); + (UNDISCH_TAC `x:real^3 IN conic_cap u0 u1 r1 a1` THEN + REWRITE_TAC[conic_cap] THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[rcone_gt; rconesgn; IN; IN_ELIM_THM; dist]); + (STRIP_TAC THEN EXPAND_TAC "f"); + (REWRITE_WITH + `a1 < ((x - u0) dot (u1 - u0)) / (norm (x - u0) * norm (u1 - u0)) <=> + a1 * (norm (x - u0) * norm (u1 - u0)) < ((x - u0:real^3) dot (u1 - u0))`); + (MATCH_MP_TAC REAL_LT_RDIV_EQ); + (MATCH_MP_TAC REAL_LT_MUL); + (REWRITE_TAC[NORM_POS_LE; REAL_ARITH `a < b <=> (a <= b) /\ ~(b = a)`]); + (SIMP_TAC[NORM_EQ_0; VECTOR_ARITH `a - b = vec 0 <=> a = b`]); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (NEW_GOAL `u1 IN affine hull {u0, w1, w2:real^3}`); + (REWRITE_TAC[IN; IN_ELIM_THM; AFFINE_HULL_3]); + + (EXISTS_TAC `(t2 + t3 + t4) / t2` THEN EXISTS_TAC `(--t3) / t2` + THEN EXISTS_TAC `(--t4) / t2`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH + `(t2 + t3 + t4) / t2 + --t3 / t2 + --t4 / t2 = t2 / t2`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_WITH `(t2 + t3 + t4) = &1 - t1`); + (UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (NEW_GOAL `u0 - t1 % u0 - t3 % w1 - t4 % w2:real^3 = t2 % u1`); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(&1 - t1) / t2 % u0 + --t3 / t2 % u2 + --t4 / t2 % u3 = + (&1 / t2) % (u0 - t1 % u0 - t3 % u2 - t4 % u3)`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `t2 / t2 = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b,c,d} = {b,a,c,d}`]); + (ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_WITH `affine hull {u1, u0, w1, w2} = + affine hull {u0:real^3, w1, w2}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[COPLANAR_3; COPLANAR_AFFINE_HULL_COPLANAR]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `(f:real^3->real) y <= f s2`); + (EXPAND_TAC "f"); + (ASM_SIMP_TAC[]); + + (NEW_GOAL `&1 < t1 + t3+ t4`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `~(t1 + t3+ t4 = &0)`); + (ASM_REAL_ARITH_TAC); + + (ABBREV_TAC `w = t1 / (t1 + t3 + t4) % u0 + t3 / (t1 + t3 + t4) % w1 + + t4 / (t1 + t3 + t4) % w2:real^3`); + + (NEW_GOAL `(f:real^3->real) y = f w`); + (EXPAND_TAC "f"); + + (REWRITE_WITH `y:real^3 - u0 = + &1 / (t3 + t4) % (t3 % w1 + t4 % w2 - (t3 + t4) % u0)`); + (EXPAND_TAC "y"); + (REWRITE_TAC[VECTOR_ARITH + `(t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3) - u0 = + &1 / (t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0) <=> + (t3 + t4) / (t3 + t4) % u0 = u0`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; DOT_LMUL]); + + (REWRITE_WITH `w:real^3 - u0 = + &1 / (t1 + t3 + t4) % (t3 % w1 + t4 % w2 - (t3 + t4) % u0)`); + (EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `(t1 / (t1 + t3 + t4) % u0 + + t3 / (t1 + t3 + t4) % u2 + t4 / (t1 + t3 + t4) % u3) - u0 = + &1 / (t1 + t3 + t4) % (t3 % u2 + t4 % u3 - (t3 + t4) % u0) <=> + (t1 + t3 + t4) / (t1 + t3 + t4) % u0 = u0`]); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_MUL; DOT_LMUL]); + (REWRITE_WITH `abs (&1 / (t3 + t4)) = &1 / (t3 + t4)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (ASM_SIMP_TAC[REAL_LE_DIV;REAL_LE_ADD; REAL_ARITH `&0 <= &1`]); + (REWRITE_WITH `abs (&1 / (t1 + t3 + t4)) = &1 / (t1 + t3 + t4)`); + (REWRITE_TAC[REAL_ABS_REFL]); + (MATCH_MP_TAC REAL_LE_DIV THEN REWRITE_TAC[REAL_ARITH `&0 <= &1`]); + (ASM_REAL_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH `(a * x) / ((a * y) * z) = + (a * x) / (a * (y * z))`]); + (ABBREV_TAC + `b1 = norm (t3 % w1 + t4 % w2 - (t3 + t4) % u0) * norm (u1 - u0:real^3)`); + (NEW_GOAL `~(b1 = &0)`); + (EXPAND_TAC "b1" THEN ASM_REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; + VECTOR_ARITH `(a - b = vec 0 <=> a = b)/\(a + b-c = vec 0 <=> a + b = c)`]); + (STRIP_TAC); + + (NEW_GOAL `u0 IN convex hull {w1, w2:real^3}`); + (REWRITE_TAC[CONVEX_HULL_2; IN; IN_ELIM_THM]); + (EXISTS_TAC `t3 / (t3 + t4)` THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV THEN ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV THEN ASM_REAL_ARITH_TAC); + (ASM_SIMP_TAC[REAL_DIV_REFL; REAL_ARITH `a / x + b / x = (a + b) / x`]); + (SIMP_TAC[VECTOR_ARITH `a/ x % u + b/ x % v = &1/ x % (a % u + b % v)`]); + (REWRITE_TAC[ASSUME `t3 % w1 + t4 % w2 = (t3 + t4) % u0:real^3`; VECTOR_ARITH + `&1 / a % (a % b) = (a / a) % b`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + (VECTOR_ARITH_TAC); + + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_TAC[]); + (ONCE_REWRITE_TAC[GSYM COPLANAR_AFFINE_HULL_COPLANAR]); + (REWRITE_WITH `affine hull {u0, u1, w1, w2} = + affine hull {u1:real^3, w1, w2}`); + (MATCH_MP_TAC AFFINE_HULL_3_INSERT); + (NEW_GOAL `convex hull {w1, w2:real^3} SUBSET affine hull {u1,w1, w2}`); + (NEW_GOAL `convex hull {w1, w2:real^3} SUBSET affine hull {w1, w2}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (NEW_GOAL `affine hull {w1, w2:real^3} SUBSET affine hull {u1,w1, w2}`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA THEN SET_TAC[]); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + (REWRITE_TAC[COPLANAR_AFFINE_HULL_COPLANAR; COPLANAR_3]); + + (NEW_GOAL `~(&1 / (t3 + t4) = &0)`); + (MATCH_MP_TAC Trigonometry2.NOT_EQ0_IMP_NEITHER_INVERT); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `(&1 / (t3 + t4) * ((t3 % w1 + t4 % w2 - (t3 + t4) % u0) dot (u1 - u0))) / + (&1 / (t3 + t4) * b1) = + ((t3 % w1 + t4 % w2 - (t3 + t4) % u0) dot (u1 - u0:real^3)) / b1`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[Trigonometry1.REAL_DIV_MUL2]); + + (NEW_GOAL `~(&1 / (t1 + t3 + t4) = &0)`); + (MATCH_MP_TAC Trigonometry2.NOT_EQ0_IMP_NEITHER_INVERT); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `(&1 / (t1 + t3 + t4) * ((t3 % w1 + t4 % w2 - (t3 + t4) % u0) dot (u1 - u0))) / + (&1 / (t1 + t3 + t4) * b1) = + ((t3 % w1 + t4 % w2 - (t3 + t4) % u0) dot (u1 - u0:real^3)) / b1`); + (UP_ASM_TAC THEN UNDISCH_TAC `~(b1 = &0)` THEN + MESON_TAC[Trigonometry1.REAL_DIV_MUL2]); + + (NEW_GOAL `(f:real^3->real) x <= f w`); + (EXPAND_TAC "f"); + + (REWRITE_WITH + `((x - u0) dot (u1 - u0:real^3)) / (norm (x - u0) * norm (u1 - u0)) <= + ((w - u0) dot (u1 - u0)) / (norm (w - u0) * norm (u1 - u0)) <=> + ((x - u0) dot (u1 - u0)) * (norm (w - u0) * norm (u1 - u0)) <= + ((w - u0) dot (u1 - u0)) * (norm (x - u0) * norm (u1 - u0))`); + (MATCH_MP_TAC RAT_LEMMA4); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_REWRITE_TAC[NORM_POS_LT; VECTOR_ARITH `x - b = vec 0 <=> x = b`]); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}` THEN REWRITE_TAC[]); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `w1:real^3` THEN + EXISTS_TAC `w2:real^3`); + (ONCE_REWRITE_TAC[SET_RULE `{u0, u1, u2, u3} = {u1, u0, u2, u3}`]); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + (EXISTS_TAC `(t2 + t3 + t4) / t2` THEN EXISTS_TAC `(--t3) / t2` + THEN EXISTS_TAC `(--t4) / t2`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH + `(t2 + t3 + t4) / t2 + --t3 / t2 + --t4 / t2 = t2 / t2`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_WITH `(t2 + t3 + t4) = &1 - t1`); + (UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (NEW_GOAL `u0 - t1 % u0 - t3 % w1 - t4 % w2:real^3 = t2 % u1`); + (UP_ASM_TAC THEN VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[VECTOR_ARITH + `(&1 - t1) / t2 % u0 + --t3 / t2 % u2 + --t4 / t2 % u3 = + (&1 / t2) % (u0 - t1 % u0 - t3 % u2 - t4 % u3)`]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `t2 / t2 = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (VECTOR_ARITH_TAC); + + (MATCH_MP_TAC REAL_LT_MUL); + (REWRITE_TAC[REAL_ARITH `&0 < a <=> (&0 <= a) /\ ~(a = &0)`]); + (REWRITE_TAC[NORM_POS_LE; NORM_EQ_0; VECTOR_ARITH `x - y= vec 0 <=>x = y`]); + (STRIP_TAC); + + (EXPAND_TAC "w" THEN STRIP_TAC); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_TAC[coplanar]); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `w1:real^3` THEN + EXISTS_TAC `w2:real^3`); + (MATCH_MP_TAC (SET_RULE `u0 IN S /\ b SUBSET S ==> (u0 INSERT b) SUBSET S`)); + (REWRITE_TAC[SET_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[AFFINE_HULL_3; IN; IN_ELIM_THM]); + + (EXISTS_TAC `&0` THEN EXISTS_TAC `t3 / (t3 + t4)` + THEN EXISTS_TAC `t4 / (t3 + t4)`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 + t3 / (t3 + t4) + t4 / (t3 + t4) = + (t3 + t4) / (t3 + t4)`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[VECTOR_ARITH + `&0 % u1 + t3 / (t3 + t4) % u2 + t4 / (t3 + t4) % u3 = + (&1 / (t3 + t4)) % (t3 % u2 + t4 % u3)`]); + (UP_ASM_TAC THEN REWRITE_TAC[VECTOR_ARITH + `t1 / x % u0 + t3 / x % u2 + t4 / x % u3 = + (&1 / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `&1 / (t1 + t3 + t4) % (t1 % u0 + t3 % w1 + t4 % w2) = u0 <=> + t1 % u0 + t3 % w1 + t4 % w2 = (t1 + t3 + t4) % u0:real^3`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Collect_geom.CHANGE_SIDE); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[VECTOR_ARITH `t1 % u0 + t3 % u2 + t4 % u3 = (t1 + t3 + t4) % u0 + <=> t3 % u2 + t4 % u3 = (t3 + t4) % u0`]); + (STRIP_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `&1 / a * a = a / a`]); + (REWRITE_WITH `(t3 + t4) / (t3 + t4) = &1`); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + (VECTOR_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `x = t2 % u1 + (t1 + t3 + t4) % w:real^3`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `x % (t1 /x % u0 + t3 / x % u2 + t4 /x % u3) = + (x / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + (VECTOR_ARITH_TAC); + (ABBREV_TAC `t = t1 + t3 + t4`); + (REWRITE_WITH `(t2 % u1 + t % w) - u0:real^3 = + (t2 % u1 + t % w) - (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `t1 + t2 + t3 + t4 = t2 + t:real`); + (EXPAND_TAC "t" THEN REAL_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH + `(t2 % u1 + t % w) - (t2 + t) % u0 = t2 % (u1 - u0) + t % (w - u0)`]); + (ABBREV_TAC `x1 = u1 - u0:real^3`); + (ABBREV_TAC `x2 = w - u0:real^3`); + + (REWRITE_WITH `(t2 % x1 + t % x2) dot x1 = + t2 * norm x1 pow 2 + t * x2 dot (x1:real^3)`); + (REWRITE_TAC[NORM_POW_2]); + (VECTOR_ARITH_TAC); + + (NEW_GOAL `t2 * norm x1 pow 2 * norm x2 * norm x1 <= + t2 * (x2 dot x1) * norm x1 * norm (x1:real^3)`); + (REWRITE_TAC[REAL_POW_2; REAL_ARITH `t2 * (x1 * x1) * x2 * x1 <= + t2 * x3 * x1 * x1 <=> &0 <= (x1 pow 2) * (--t2) * (x2 * x1 - x3)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_SIMP_TAC[REAL_LE_MUL; NORM_POS_LE]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`]); + (STRIP_TAC); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_TAC[NORM_CAUCHY_SCHWARZ]); + + (NEW_GOAL + `t2 * (x2 dot x1) * norm x1 * norm x1 + t * (x2 dot x1) * norm x2 * norm x1 <= (x2 dot x1) * norm (t2 % x1 + t % x2) * norm (x1:real^3)`); + + (REWRITE_TAC[REAL_ARITH `t2 * x3 * x1 * x1 + t * x3 * x2 * x1 <= + x3 * x4 * x1 <=> &0 <= (x1 * x3) * (x4 - t2 * x1 - t * x2)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[NORM_POS_LE]); + (ASM_CASES_TAC `x2 dot (x1:real^3) < &0`); + (NEW_GOAL `F`); + (NEW_GOAL `(f:real^3->real) x <= &0`); + (EXPAND_TAC "f"); + (REWRITE_TAC[REAL_ARITH `a / b <= &0 <=> &0 <= (--a) / b`]); + (MATCH_MP_TAC REAL_LE_DIV); + (SIMP_TAC[NORM_POS_LE; REAL_LE_MUL]); + + (REWRITE_WITH `x = t2 % u1 + (t1 + t3 + t4) % w:real^3`); + (ASM_REWRITE_TAC[] THEN EXPAND_TAC "w"); + (REWRITE_TAC[VECTOR_ARITH + `x % (t1 /x % u0 + t3 / x % u2 + t4 /x % u3) = + (x / x) % (t1 % u0 + t3 % u2 + t4 % u3)`]); + (EXPAND_TAC "t"); + (REWRITE_WITH `(t1 + t3 + t4) / (t1 + t3 + t4) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_REWRITE_TAC[]); + (VECTOR_ARITH_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= --a <=> a <= &0`]); + (REWRITE_WITH `(t2 % u1 + (t1 + t3 + t4) % w) - u0:real^3 = + (t2 % u1 + (t1 + t3 + t4) % w) - (t1 + t2 + t3 + t4) % u0`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `(t2 % u1 + (t1 + t3 + t4) % w) - (t1 + t2 + t3 + t4) % u0 = + t2 % x1 + t % x2:real^3`); + (EXPAND_TAC "x1" THEN EXPAND_TAC "x2" THEN EXPAND_TAC "t" + THEN VECTOR_ARITH_TAC); + (NEW_GOAL `t % x2 dot (x1:real^3) <= &0`); + (REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= a * (--b)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (NEW_GOAL `t2 % x1 dot (x1:real^3) <= &0`); + (REWRITE_TAC[DOT_LMUL; REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (REWRITE_TAC[DOT_POS_LE]); + (REWRITE_TAC[DOT_LADD]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (UP_ASM_TAC THEN UNDISCH_TAC `a1 < (f:real^3->real) x`); + (EXPAND_TAC "a1" THEN UNDISCH_TAC `&0 <= a` THEN REAL_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + + (REWRITE_TAC [REAL_ARITH `&0 <= a - b * d - c <=> c <= a + (--b) * d`]); + (REWRITE_WITH `t * norm (x2:real^3) = abs t * norm x2`); + (AP_THM_TAC THEN AP_TERM_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[REAL_ABS_REFL]); + (EXPAND_TAC "t" THEN UNDISCH_TAC `t2 < &0` THEN + UNDISCH_TAC `t1 + t2 + t3 + t4 = &1` THEN REAL_ARITH_TAC); + (REWRITE_WITH `(--t2) * norm (x1:real^3) = abs (--t2) * norm x1`); + (AP_THM_TAC THEN AP_TERM_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[REAL_ABS_REFL]); + (UNDISCH_TAC `t2 < &0` THEN REAL_ARITH_TAC); + (REWRITE_TAC[GSYM NORM_MUL]); + (REWRITE_WITH + `norm (t % x2:real^3) = norm ((t2 % x1 + t % x2) + (--t2 % x1))`); + (AP_TERM_TAC THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[NORM_TRIANGLE]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `(f:real^3->real) x <= f s2`); + (UNDISCH_TAC `(f:real^3->real) y <= f s2`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + + (NEW_GOAL `(f:real^3->real) s2 <= a1`); + (EXPAND_TAC "f"); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "a1" THEN REAL_ARITH_TAC); + + (UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC `a1 < (f:real^3->real) x`); + (REAL_ARITH_TAC); + + (UP_ASM_TAC THEN STRIP_TAC); + +(* ========================================================================= *) + + (NEW_GOAL + `NULLSET (conic_cap u0 u1 r1 a1 INTER aff_ge {u0:real^3, u1} {w1, w2})`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `conic_cap u0 u1 r a INTER convex hull {u0:real^3, u1, w1, w2}`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (NEW_GOAL `vol (conic_cap u0 u1 r1 a1 INTER aff_ge {u0, u1} {w1, w2}) = &0`); + (ASM_SIMP_TAC[MEASURE_EQ_0]); + + (UP_ASM_TAC THEN REWRITE_WITH + `vol (conic_cap u0 u1 r1 a1 INTER aff_ge {u0, u1} {w1, w2}) = + vol (conic_cap u0 u1 r1 a1 INTER aff_gt {u0, u1} {w1, w2})`); + (MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF); + (REWRITE_WITH `conic_cap u0 u1 r1 a1 INTER aff_gt {u0, u1} {w1, w2} DIFF + conic_cap u0 u1 r1 a1 INTER aff_ge {u0, u1:real^3} {w1, w2} = + {}`); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> (C INTER A) DIFF (C INTER B) = {}`)); + (REWRITE_TAC[AFF_GT_SUBSET_AFF_GE]); + (REWRITE_TAC[SET_RULE `a UNION {} = a`]); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `aff_ge {u0, u1:real^3} {w1, w2} DIFF + aff_gt {u0, u1} {w1, w2}`); + (REWRITE_TAC[SET_RULE `A INTER B DIFF A INTER C SUBSET B DIFF C`]); + + (REWRITE_WITH `aff_ge {u0, u1:real^3} {w1, w2} = + aff_gt {u0, u1} {w1, w2} UNION + UNIONS {aff_ge {u0, u1} ({w1, w2} DELETE a) | a | a IN {w1, w2}}`); + (MATCH_MP_TAC AFF_GE_AFF_GT_DECOMP); + (REWRITE_TAC[Geomdetail.FINITE6]); + (REWRITE_TAC[DISJOINT]); + + (ASM_CASES_TAC `w1 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_WITH `{u0, u1, w1, w2} = {u0, u1, w2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + + (ASM_CASES_TAC `w2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_WITH `{u0, u1, w1, w2} = {u0, u1, w1:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC + `UNIONS {aff_ge {u0, u1:real^3} ({w1, w2} DELETE a) | a | a IN {w1, w2}}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + + (EXISTS_TAC + `aff_ge {u0, u1:real^3} {w1} UNION aff_ge {u0, u1:real^3} {w2}`); + (STRIP_TAC); + (MATCH_MP_TAC NEGLIGIBLE_UNION); + (STRIP_TAC); + + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, w1}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,w1:real^3} = {u0,u1} UNION {w1}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (MATCH_MP_TAC NEGLIGIBLE_SUBSET); + (EXISTS_TAC `affine hull {u0, u1:real^3, w2}`); + (STRIP_TAC); + (REWRITE_TAC[NEGLIGIBLE_AFFINE_HULL_3]); + (REWRITE_WITH `{u0,u1,w2:real^3} = {u0,u1} UNION {w2}`); + (SET_TAC[]); + (REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]); + (REWRITE_TAC[SET_RULE + `UNIONS {aff_ge {u0, u1} ({m, s3} DELETE a) | a | a IN {m, s3}} = + aff_ge {u0, u1} ({m, s3} DELETE s3) + UNION aff_ge {u0, u1} ({m, s3} DELETE m)`]); + (MATCH_MP_TAC (SET_RULE + `A SUBSET B /\ C SUBSET D ==> A UNION C SUBSET B UNION D`)); + (STRIP_TAC); + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `w1 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_WITH `{u0, u1, w1, w2} = {u0, u1, w2:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC AFF_GE_MONO_RIGHT); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[DISJOINT]); + (ASM_CASES_TAC `w2 IN {u0, u1:real^3}`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}`); + (REWRITE_WITH `{u0, u1, w1, w2} = {u0, u1, w1:real^3}`); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[COPLANAR_3]); + (UP_ASM_TAC THEN MESON_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + + (SET_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `~coplanar {u0, u1, w1, w2:real^3}` THEN REWRITE_TAC[]); + (MATCH_MP_TAC CONIC_CAP_AFF_GT_EQ_0); + (EXISTS_TAC `a1:real` THEN EXISTS_TAC `r1:real`); + (ASM_REWRITE_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 36 *) + +let MEASURABLE_BALL_AFF_GE = prove + (`!z r s t. measurable(ball(z,r) INTER aff_ge s t)`, + MESON_TAC[MEASURABLE_CONVEX; CONVEX_INTER; CONVEX_AFF_GE; CONVEX_BALL; + BOUNDED_INTER; BOUNDED_BALL]);; + +(* ==================================================================== *) +(* Currently added lemmas *) +(* Lemma 37 *) + +let FINITE_LIST_KY_LEMMA_2 = prove + (`!s:A->bool. + FINITE s + ==> FINITE + {y | ?u0 u1. + u0 IN s /\ + u1 IN s /\ + y = [u0; u1]}`, + REWRITE_TAC[SET_RULE + `{y | ?u0 u1. u0 IN s /\ u1 IN s /\ y = [u0; u1]} = + {[u0;u1] | u0 IN s /\ u1 IN s}`] THEN + REPEAT + (GEN_TAC THEN DISCH_TAC THEN + MATCH_MP_TAC FINITE_PRODUCT_DEPENDENT THEN ASM_REWRITE_TAC[]));; + +let FINITE_SET_PRODUCT_KY_LEMMA = prove ( + `!s:A->bool. + FINITE s ==> FINITE {{u0, u1:A} | u0 IN s /\ u1 IN s}`, + REPEAT + (GEN_TAC THEN DISCH_TAC THEN + MATCH_MP_TAC FINITE_PRODUCT_DEPENDENT THEN ASM_REWRITE_TAC[]));; + + +(* ==================================================================== *) +(* Lemma 38: BETA_PAIR_THM - formal proof by TCHales *) + +let pre_beta = prove_by_refinement +(`!g u' v'. (?f. (!u v. f { u, v } = (g:A->A->B) u v)) ==> + ((\ { u, v}. g u v) {u',v'} = g u' v')`, +[REWRITE_TAC[GABS_DEF;GEQ_DEF]; + SELECT_ELIM_TAC; + MESON_TAC[]]);; + +let WELLDEFINED_FUNCTION_2 = prove_by_refinement( +`(?f:C->D. (!x:A y:B. f(s x y) = t x y)) <=> + (!x x' y y'. (s x y = s x' y') ==> t x y = t x' y')`, +[ MATCH_MP_TAC EQ_TRANS ; + EXISTS_TAC `?f:C->D. !z. !x:A y:B. (s x y = z) ==> f z = t x y`; + CONJ_TAC; + MESON_TAC[]; + REWRITE_TAC[GSYM SKOLEM_THM]; + MESON_TAC[]]);; + +let well_defined_unordered_pair = prove_by_refinement +(`(?f. (!u v. f { u, v} = (g:A->A->B) u v)) <=> + (! u v. g u v = g v u)`, +[REWRITE_TAC[WELLDEFINED_FUNCTION_2]; + NEW_GOAL `!u v x' y'. + {u,v} = {x',y'} <=> (u:A = x' /\ v = y')\/ (u = y' /\ v = x')`; + SET_TAC[]; + ASM_REWRITE_TAC[]; + MESON_TAC[]]);; + +let BETA_PAIR_THM = prove_by_refinement( +`!g u' v'. (!u v. (g:A->A->B) u v = g v u) ==> + ((\ { u, v}. g u v) {u',v'} = g u' v')`, +[REPEAT STRIP_TAC; + MATCH_MP_TAC pre_beta; + REWRITE_TAC[well_defined_unordered_pair]; + ASM_REWRITE_TAC[]]);; + +(* ==================================================================== *) +(* Lemma 39 *) + +let DIHX_RANGE = prove_by_refinement ( + `!V X u v. &0 <= dihX V X (u,v) /\ dihX V X (u,v) <= pi`, +[(REWRITE_TAC[dihX] THEN REPEAT GEN_TAC); + (COND_CASES_TAC); + (REWRITE_TAC[PI_POS_LE; REAL_ARITH `a <= a`]); + (REPEAT LET_TAC THEN COND_CASES_TAC); + (REWRITE_TAC[dihu2; DIHV_RANGE]); + (COND_CASES_TAC); + (REWRITE_TAC[dihu3; DIHV_RANGE]); + (COND_CASES_TAC); + (REWRITE_TAC[dihu4; DIHV_RANGE]); + (REWRITE_TAC[PI_POS_LE; REAL_ARITH `a <= a`])]);; + +let DIHX_LE_PI = prove (`!V X u v. dihX V X (u,v) <= pi`, + MESON_TAC[DIHX_RANGE]);; + +(* ==================================================================== *) +(* Lemma 40 *) + +let BOUNDED_VOLUME_MCELL = prove_by_refinement ( + `!V. ?c. !X. saturated V /\ packing V /\ mcell_set V X ==> vol X <= c`, +[(GEN_TAC); + (ASM_CASES_TAC `saturated V /\ packing V`); + (EXISTS_TAC `&4 / &3 * pi * &8 pow 3`); + (REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[mcell_set_2; IN_ELIM_THM; IN]); + (STRIP_TAC); + (ASM_CASES_TAC `X:real^3->bool = {}`); + (REWRITE_TAC[MEASURE_EMPTY; ASSUME `X:real^3->bool = {}`]); + (REWRITE_TAC[REAL_ARITH `&0 <= &4 / &3 * pi * &8 pow 3 <=> &0 <= pi`]); + (REWRITE_TAC[PI_POS_LE]); + (UP_ASM_TAC THEN REWRITE_TAC[SET_RULE `~(x = {}) <=> (?v. v IN x)`]); + (STRIP_TAC); + (NEW_GOAL `vol X <= vol (ball (v, &8))`); + (MATCH_MP_TAC MEASURE_SUBSET); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[] THEN MATCH_MP_TAC MEASURABLE_MCELL); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[MEASURABLE_BALL]); + (ASM_REWRITE_TAC[] THEN MATCH_MP_TAC MCELL_SUBSET_BALL8); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN SIMP_TAC[VOLUME_BALL; REAL_ARITH `&0 <= &8`]); + (EXISTS_TAC `&0`); + (REPEAT STRIP_TAC THEN ASM_MESON_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 41 *) + +let LEFT_ACTION_LIST_2_EXISTS = prove_by_refinement ( + `!u0 u1 u2 x y z d:A. + CARD {u0, u1, u2, d} = 4 /\ {x, y, z} = {u0, u1, u2} + ==> (?p. p permutes 0..2 /\ + [x; y; z; d] = left_action_list p [u0; u1; u2; d])`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[left_action_list; LENGTH; TABLE_4; + ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`]); + (NEW_GOAL `{u0, u1, u2:A} = + {EL 0 [u0;u1;u2;d] , EL 1 [u0;u1;u2;d], EL 2 [u0;u1;u2;d]}`); + (REWRITE_TAC[EL; HD; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`; TL]); + (NEW_GOAL `{x, y, z:A} = + {EL 0 [u0;u1;u2;d] , EL 1 [u0;u1;u2;d], EL 2 [u0;u1;u2;d]}`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?i1. i1 IN {0,1,2} /\ EL i1 [u0;u1;u2;d] = x:A`); + (UP_ASM_TAC THEN SET_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC THEN SWITCH_TAC); + (NEW_GOAL `?i2. i2 IN {0,1,2} /\ EL i2 [u0;u1;u2;d] = y:A`); + (UP_ASM_TAC THEN SET_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC THEN SWITCH_TAC); + (NEW_GOAL `?i3. i3 IN {0,1,2} /\ EL i3 [u0;u1;u2;d] = z:A`); + (UP_ASM_TAC THEN SET_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC THEN SWITCH_TAC); + + (NEW_GOAL `~(i1 = i2) /\ ~(i1 = i3) /\ ~(i2 = i3:num)`); + (REPEAT STRIP_TAC); + (NEW_GOAL `{u0,u1,u2,d:A} = {x, z,d}`); + (ASM_SET_TAC[]); + (UNDISCH_TAC `CARD {u0,u1,u2,d:A} = 4` THEN ASM_REWRITE_TAC[]); + (MESON_TAC[Geomdetail.CARD3; ARITH_RULE `a <= 3 ==> ~(a = 4)`]); + (NEW_GOAL `{u0,u1,u2,d:A} = {x, y,d}`); + (ASM_SET_TAC[]); + (UNDISCH_TAC `CARD {u0,u1,u2,d:A} = 4` THEN ASM_REWRITE_TAC[]); + (MESON_TAC[Geomdetail.CARD3; ARITH_RULE `a <= 3 ==> ~(a = 4)`]); + (NEW_GOAL `{u0,u1,u2,d:A} = {x, y,d}`); + (ASM_SET_TAC[]); + (UNDISCH_TAC `CARD {u0,u1,u2,d:A} = 4` THEN ASM_REWRITE_TAC[]); + (MESON_TAC[Geomdetail.CARD3; ARITH_RULE `a <= 3 ==> ~(a = 4)`]); + (SWITCH_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REPEAT STRIP_TAC); + + (NEW_GOAL `{i1, i2, i3} = {0,1,2}`); + (ASM_SET_TAC[]); + + (ABBREV_TAC `p = (\i:num. if i = i1 then 0 + else if i = i2 then 1 + else if i = i3 then 2 + else i)`); + (NEW_GOAL `p i1 = 0 /\ p i2 = 1 /\ p (i3:num) = 2`); + (ASM_MESON_TAC[]); + + (EXISTS_TAC `p:num->num`); + (NEW_GOAL `p permutes 0..2`); + + (REWRITE_TAC[permutes; EXISTS_UNIQUE; IN_NUMSEG_0; + ARITH_RULE `a <= 2 <=> a = 0 \/ a = 1 \/ a = 2`; + SET_RULE `x = 0 \/ x = 1 \/ x = 2 <=> x IN {0,1,2}`]); + (NEW_GOAL `(!x. ~(x IN {0, 1, 2}) ==> p x = x)`); + (REPEAT STRIP_TAC); + (EXPAND_TAC "p"); + (COND_CASES_TAC); + (ASM_SET_TAC[]); + (COND_CASES_TAC); + (ASM_SET_TAC[]); + (COND_CASES_TAC); + (ASM_SET_TAC[]); + (REFL_TAC); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + + (ASM_CASES_TAC `y' = 0`); + (EXISTS_TAC `i1:num`); + (ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (ASM_CASES_TAC `y'' = i2:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 0` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i3:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 0` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `~(y'' IN {0,1,2})`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 0` THEN ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (ASM_SET_TAC[]); + + (ASM_CASES_TAC `y' = 1`); + (EXISTS_TAC `i2:num`); + (ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (ASM_CASES_TAC `y'' = i1:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 1` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i3:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 1` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `~(y'' IN {0,1,2})`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 1` THEN ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (ASM_SET_TAC[]); + + (ASM_CASES_TAC `y' = 2`); + (EXISTS_TAC `i3:num`); + (ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (ASM_CASES_TAC `y'' = i2:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 2` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i1:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 2` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `~(y'' IN {0,1,2})`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 2` THEN ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (ASM_SET_TAC[]); + + (NEW_GOAL `~(y' IN {0,1,2})`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (EXISTS_TAC `y':num`); + (ASM_SIMP_TAC[] THEN REPEAT STRIP_TAC); + + (ASM_CASES_TAC `y'' = i1:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = y'` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i2:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = y'` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i3:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = y'` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `(p:num->num) y'' = y''`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `inverse (p:num->num) 0 = i1 /\ + inverse p 1 = i2 /\ inverse p 2 = i3`); + (UP_ASM_TAC THEN MESON_TAC[PERMUTES_INVERSE_EQ; + ASSUME `(p:num->num) i1 = 0 /\ p i2 = 1 /\ p i3 = 2`]); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `inverse (p:num->num) 3 = 3`); + (NEW_GOAL `p 3 = 3`); + (MP_TAC (ASSUME `p permutes 0..2`) THEN REWRITE_TAC[permutes]); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[IN_NUMSEG_0] THEN ARITH_TAC); + (UP_ASM_TAC THEN UP_ASM_TAC THEN MESON_TAC[PERMUTES_INVERSE_EQ]); + (REWRITE_TAC[EL;HD; TL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`])]);; + +(* ==================================================================== *) +(* Lemma 42 *) +let LEFT_ACTION_LIST_3_EXISTS = prove_by_refinement ( + `!u0 u1 u2 u3 x y z t:A. + CARD {u0, u1, u2, u3} = 4 /\ {x, y, z, t} = {u0, u1, u2, u3} + ==> (?p. p permutes 0..3 /\ + [x; y; z; t] = left_action_list p [u0; u1; u2; u3])`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[left_action_list; LENGTH; TABLE_4; + ARITH_RULE `SUC (SUC (SUC (SUC 0))) = 4`]); + (NEW_GOAL `{u0, u1, u2, u3:A} = {EL 0 [u0;u1;u2;u3], EL 1 [u0;u1;u2;u3], + EL 2 [u0;u1;u2;u3], EL 3 [u0;u1;u2;u3]}`); + (REWRITE_TAC[EL; HD; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; TL]); + (NEW_GOAL `{x, y, z, t:A} = {EL 0 [u0;u1;u2;u3], EL 1 [u0;u1;u2;u3], + EL 2 [u0;u1;u2;u3], EL 3 [u0;u1;u2;u3]}`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?i1. i1 IN {0,1,2,3} /\ EL i1 [u0;u1;u2;u3] = x:A`); + (UP_ASM_TAC THEN SET_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC THEN SWITCH_TAC); + (NEW_GOAL `?i2. i2 IN {0,1,2,3} /\ EL i2 [u0;u1;u2;u3] = y:A`); + (UP_ASM_TAC THEN SET_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC THEN SWITCH_TAC); + (NEW_GOAL `?i3. i3 IN {0,1,2,3} /\ EL i3 [u0;u1;u2;u3] = z:A`); + (UP_ASM_TAC THEN SET_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC THEN SWITCH_TAC); + (NEW_GOAL `?i4. i4 IN {0,1,2,3} /\ EL i4 [u0;u1;u2;u3] = t:A`); + (UP_ASM_TAC THEN SET_TAC[]); + (FIRST_X_ASSUM CHOOSE_TAC THEN SWITCH_TAC); + + (NEW_GOAL `~(i1 = i2) /\ ~(i1 = i3) /\ ~(i1 = i4:num) /\ ~(i2 = i3) /\ + ~(i2 = i4) /\ ~(i3 = i4)`); + (REPEAT STRIP_TAC); + + (NEW_GOAL `x = y:A`); + (ASM_MESON_TAC[]); + (NEW_GOAL `{u0,u1,u2,u3:A} = {x, z,t}`); + (UNDISCH_TAC `{x, y, z, t:A} = {u0, u1, u2, u3}` THEN UP_ASM_TAC + THEN SET_TAC[]); + (UNDISCH_TAC `CARD {u0,u1,u2,u3:A} = 4` THEN + REWRITE_TAC[ASSUME `{u0, u1, u2, u3} = {x, z, t:A}`]); + (MESON_TAC[Geomdetail.CARD3; ARITH_RULE `a <= 3 ==> ~(a = 4)`]); + + (NEW_GOAL `x = z:A`); + (ASM_MESON_TAC[]); + (NEW_GOAL `{u0,u1,u2,u3:A} = {x, y,t}`); + (UNDISCH_TAC `{x, y, z, t:A} = {u0, u1, u2, u3}` THEN UP_ASM_TAC + THEN SET_TAC[]); + (UNDISCH_TAC `CARD {u0,u1,u2,u3:A} = 4` THEN + REWRITE_TAC[ASSUME `{u0, u1, u2, u3} = {x, y, t:A}`]); + (MESON_TAC[Geomdetail.CARD3; ARITH_RULE `a <= 3 ==> ~(a = 4)`]); + + (NEW_GOAL `x = t:A`); + (ASM_MESON_TAC[]); + (NEW_GOAL `{u0,u1,u2,u3:A} = {x, y, z}`); + (UNDISCH_TAC `{x, y, z, t:A} = {u0, u1, u2, u3}` THEN UP_ASM_TAC + THEN SET_TAC[]); + (UNDISCH_TAC `CARD {u0,u1,u2,u3:A} = 4` THEN + REWRITE_TAC[ASSUME `{u0, u1, u2, u3} = {x, y, z:A}`]); + (MESON_TAC[Geomdetail.CARD3; ARITH_RULE `a <= 3 ==> ~(a = 4)`]); + + (NEW_GOAL `y = z:A`); + (ASM_MESON_TAC[]); + (NEW_GOAL `{u0,u1,u2,u3:A} = {x, z,t}`); + (UNDISCH_TAC `{x, y, z, t:A} = {u0, u1, u2, u3}` THEN UP_ASM_TAC + THEN SET_TAC[]); + (UNDISCH_TAC `CARD {u0,u1,u2,u3:A} = 4` THEN + REWRITE_TAC[ASSUME `{u0, u1, u2, u3} = {x, z, t:A}`]); + (MESON_TAC[Geomdetail.CARD3; ARITH_RULE `a <= 3 ==> ~(a = 4)`]); + + (NEW_GOAL `y = t:A`); + (ASM_MESON_TAC[]); + (NEW_GOAL `{u0,u1,u2,u3:A} = {x, z,t}`); + (UNDISCH_TAC `{x, y, z, t:A} = {u0, u1, u2, u3}` THEN UP_ASM_TAC + THEN SET_TAC[]); + (UNDISCH_TAC `CARD {u0,u1,u2,u3:A} = 4` THEN + REWRITE_TAC[ASSUME `{u0, u1, u2, u3} = {x, z, t:A}`]); + (MESON_TAC[Geomdetail.CARD3; ARITH_RULE `a <= 3 ==> ~(a = 4)`]); + + (NEW_GOAL `z = t:A`); + (ASM_MESON_TAC[]); + (NEW_GOAL `{u0,u1,u2,u3:A} = {x, y,t}`); + (UNDISCH_TAC `{x, y, z, t:A} = {u0, u1, u2, u3}` THEN UP_ASM_TAC + THEN SET_TAC[]); + (UNDISCH_TAC `CARD {u0,u1,u2,u3:A} = 4` THEN + REWRITE_TAC[ASSUME `{u0, u1, u2, u3} = {x, y, t:A}`]); + (MESON_TAC[Geomdetail.CARD3; ARITH_RULE `a <= 3 ==> ~(a = 4)`]); + + (SWITCH_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN REPEAT STRIP_TAC); + + (NEW_GOAL `{i1, i2, i3,i4} = {0,1,2,3}`); + (REWRITE_TAC[SET_EQ_LEMMA]); + (REPEAT STRIP_TAC); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + + (ABBREV_TAC `p = (\i:num. if i = i1 then 0 + else if i = i2 then 1 + else if i = i3 then 2 + else if i = i4 then 3 + else i)`); + (NEW_GOAL `p i1 = 0 /\ p i2 = 1 /\ p (i3:num) = 2 /\ p i4 = 3`); + (REPEAT STRIP_TAC); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (EXPAND_TAC "p" THEN COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (REFL_TAC); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + + (EXISTS_TAC `p:num->num`); + (NEW_GOAL `p permutes 0..3`); + + (REWRITE_TAC[permutes; EXISTS_UNIQUE; IN_NUMSEG_0; + ARITH_RULE `a <= 3 <=> a = 0 \/ a = 1 \/ a = 2 \/ a = 3`; + SET_RULE `x = 0 \/ x = 1 \/ x = 2 \/ x = 3 <=> x IN {0,1,2,3}`]); + (NEW_GOAL `(!x. ~(x IN {0, 1, 2, 3}) ==> p x = x)`); + (REPEAT STRIP_TAC); + (EXPAND_TAC "p"); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~(x' IN {0, 1, 2, 3})` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~(x' IN {0, 1, 2, 3})` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~(x' IN {0, 1, 2, 3})` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~(x' IN {0, 1, 2, 3})` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (REFL_TAC); + + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + + (ASM_CASES_TAC `y' = 0`); + (EXISTS_TAC `i1:num`); + (ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (ASM_CASES_TAC `y'' = i2:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 0` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i3:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 0` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `y'' = i4:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 0` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `~(y'' IN {0,1,2,3})`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 0` THEN ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (REPLICATE_TAC 4 UP_ASM_TAC THEN REWRITE_TAC[] THEN + UNDISCH_TAC `{i1,i2,i3,i4} = {0,1,2,3}` THEN SET_TAC[]); + + (ASM_CASES_TAC `y' = 1`); + (EXISTS_TAC `i2:num`); + (ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (ASM_CASES_TAC `y'' = i1:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 1` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i3:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 1` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i4:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 1` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `~(y'' IN {0,1,2,3})`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 1` THEN ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (REPLICATE_TAC 4 UP_ASM_TAC THEN REWRITE_TAC[] THEN + UNDISCH_TAC `{i1,i2,i3,i4} = {0,1,2,3}` THEN SET_TAC[]); + + + (ASM_CASES_TAC `y' = 2`); + (EXISTS_TAC `i3:num`); + (ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (ASM_CASES_TAC `y'' = i1:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 2` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i2:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 2` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i4:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 2` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `~(y'' IN {0,1,2,3})`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 2` THEN ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (REPLICATE_TAC 4 UP_ASM_TAC THEN REWRITE_TAC[] THEN + UNDISCH_TAC `{i1,i2,i3,i4} = {0,1,2,3}` THEN SET_TAC[]); + + (ASM_CASES_TAC `y' = 3`); + (EXISTS_TAC `i4:num`); + (ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (ASM_CASES_TAC `y'' = i1:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 3` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i2:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 3` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i3:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 3` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `~(y'' IN {0,1,2,3})`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = 3` THEN ASM_SIMP_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (REPLICATE_TAC 4 UP_ASM_TAC THEN REWRITE_TAC[] THEN + UNDISCH_TAC `{i1,i2,i3,i4} = {0,1,2,3}` THEN SET_TAC[]); + + (NEW_GOAL `~(y' IN {0,1,2,3})`); + (REPLICATE_TAC 4 UP_ASM_TAC THEN SET_TAC[]); + (EXISTS_TAC `y':num`); + (ASM_SIMP_TAC[] THEN REPEAT STRIP_TAC); + + (ASM_CASES_TAC `y'' = i1:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = y'` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i2:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = y'` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i3:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = y'` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_CASES_TAC `y'' = i4:num`); + (NEW_GOAL `F`); + (UNDISCH_TAC `(p:num->num) y'' = y'` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `(p:num->num) y'' = y''`); + (FIRST_ASSUM MATCH_MP_TAC); + (REPLICATE_TAC 4 UP_ASM_TAC THEN REWRITE_TAC[] THEN + UNDISCH_TAC `{i1,i2,i3,i4} = {0,1,2,3}` THEN SET_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `inverse (p:num->num) 0 = i1 /\ inverse p 3 = i4 /\ + inverse p 1 = i2 /\ inverse p 2 = i3`); + (UP_ASM_TAC THEN MESON_TAC[PERMUTES_INVERSE_EQ; + ASSUME `(p:num->num) i1 = 0 /\ p i2 = 1 /\ p i3 = 2 /\ p i4 = 3`]); + (ASM_REWRITE_TAC[])]);; + + +(* ==================================================================== *) +(* Lemma 43 *) + +let lmfun_bounded = prove_by_refinement ( + `!h. &0 <= h ==> lmfun h <= h0 / (h0 - &1)`, +[(REPEAT STRIP_TAC THEN REWRITE_TAC[lmfun] THEN COND_CASES_TAC); + (REWRITE_TAC[REAL_ARITH `(h0 - h) / (h0 - &1) <= h0 / (h0 - &1) <=> + &0 <= h / (h0 - &1)`]); + (MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[h0] THEN ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[h0] THEN REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 44 *) + +let lmfun_pos_le = prove_by_refinement ( + `!h. &0 <= lmfun h`, +[(REPEAT STRIP_TAC THEN REWRITE_TAC[lmfun] THEN COND_CASES_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[h0] THEN REAL_ARITH_TAC); + (REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 45 *) +let BARV_CARD_LEMMA = prove ( + `!V ul k. + packing V /\ barV V k ul ==> CARD (set_of_list ul) = k + 1`, + MESON_TAC[Rogers.BARV_IMP_LENGTH_EQ_CARD]);; + +let BARV_LENGTH_LEMMA = prove ( + `!V ul k. + packing V /\ barV V k ul ==> LENGTH ul = k + 1`, + MESON_TAC[Rogers.BARV_IMP_LENGTH_EQ_CARD]);; + +(* ==================================================================== *) +(* Lemma 46 *) + +let MCELL_ID_MXI_2 = prove_by_refinement ( + `!V i j ul vl. + packing V /\ + saturated V /\ + barV V 3 ul /\ + barV V 3 vl /\ + mcell i V ul = mcell j V vl /\ + ~NULLSET (mcell i V ul) /\ + i IN {2, 3} /\ + j IN {2, 3} + ==> mxi V ul = mxi V vl`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `i = j /\ + (!k. i - 1 <= k /\ k <= 3 + ==> omega_list_n V ul k = omega_list_n V vl k)`); + (MATCH_MP_TAC MCELL_ID_OMEGA_LIST_N); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ASM_CASES_TAC `hl (truncate_simplex 2 (ul:(real^3)list)) >= sqrt (&2)`); + (ASM_CASES_TAC `hl (truncate_simplex 2 (vl:(real^3)list)) >= sqrt (&2)`); + + (REWRITE_WITH `mxi V ul = omega_list_n V ul 2`); + (REWRITE_TAC[mxi] THEN COND_CASES_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (REWRITE_WITH `mxi V vl = omega_list_n V vl 2`); + (REWRITE_TAC[mxi] THEN COND_CASES_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (ASM_MESON_TAC[]); + (ASM_MESON_TAC[]); + + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ARITH `~(a >= b) <=> a < b`]); + (STRIP_TAC); + + (ABBREV_TAC `xl = truncate_simplex 2 (ul:(real^3)list)`); + (ABBREV_TAC `yl = truncate_simplex 2 (vl:(real^3)list)`); + + (NEW_GOAL `set_of_list (truncate_simplex (i - 1) (ul:(real^3)list)) = + set_of_list (truncate_simplex (i - 1) vl)`); + (NEW_GOAL `V INTER mcell i V ul = set_of_list (truncate_simplex (i - 1) ul)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (NEW_GOAL `V INTER mcell j V vl = set_of_list (truncate_simplex (j - 1) vl)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `F`); + (NEW_GOAL `hl (xl:(real^3)list) <= dist (omega_list V xl, HD xl)`); + (MATCH_MP_TAC Rogers.WAUFCHE1); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN] THEN EXPAND_TAC "xl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `!w:real^3. w IN set_of_list yl + ==> dist (circumcenter (set_of_list yl),w) = hl yl`); + (MATCH_MP_TAC Rogers.HL_PROPERTIES); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "yl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_WITH `circumcenter (set_of_list yl) = + omega_list V (yl:(real^3)list)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN]); + (EXPAND_TAC "yl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (STRIP_TAC); + + (NEW_GOAL `hl yl = dist (omega_list V yl, HD xl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `HD (xl:(real^3)list) = HD (truncate_simplex (i - 1) ul)`); + (REWRITE_WITH `HD (xl:(real^3)list) = HD ul`); + (EXPAND_TAC "xl"); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `i IN {2,3}` THEN REWRITE_TAC[SET_RULE + `x IN {2,3} <=> x = 2 \/ x = 3`]); + (ARITH_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `HD (xl:(real^3)list) IN + set_of_list (truncate_simplex (i - 1) ul)`); + (REWRITE_TAC[ASSUME `HD (xl:(real^3)list) = + HD (truncate_simplex (i - 1) ul)`]); + (MATCH_MP_TAC Packing3.BARV_IMP_HD_IN_SET_OF_LIST); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `i - 1`); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `j IN {2,3}` THEN REWRITE_TAC[SET_RULE + `x IN {2,3} <=> x = 2 \/ x = 3`] THEN ARITH_TAC); + (UP_ASM_TAC); + (NEW_GOAL `set_of_list (truncate_simplex (j - 1) vl) SUBSET + set_of_list (yl:(real^3)list)`); + (EXPAND_TAC "yl"); + (MATCH_MP_TAC Rogers.TRUNCATE_SIMPLEX_SUBSET); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `j IN {2,3}` THEN REWRITE_TAC[SET_RULE + `x IN {2,3} <=> x = 2 \/ x = 3`]); + (ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (SET_TAC[]); + + (NEW_GOAL `omega_list V xl = omega_list V yl`); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH (xl:(real^3)list) = 3 /\ LENGTH (yl:(real^3)list) = 3`); + (EXPAND_TAC "xl" THEN EXPAND_TAC "yl"); + (REWRITE_TAC[ARITH_RULE `3 = 2 + 1`]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (REWRITE_TAC[ARITH_RULE `3 - 1 = 2`]); + (EXPAND_TAC "xl" THEN EXPAND_TAC "yl"); + (REWRITE_WITH + `truncate_simplex 2 ul = truncate_simplex (2 + 0) (ul:(real^3)list) /\ + truncate_simplex 2 vl = truncate_simplex (2 + 0) (vl:(real^3)list)`); + (REWRITE_TAC[ARITH_RULE `2 + 0 = 2`]); + (REWRITE_WITH + `omega_list_n V (truncate_simplex (2 + 0) ul) 2 = omega_list_n V ul 2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH + `omega_list_n V (truncate_simplex (2 + 0) vl) 2 = omega_list_n V vl 2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + + (ASM_REWRITE_TAC[]); + (NEW_GOAL `hl (yl:(real^3)list) = dist (omega_list V xl, HD xl)`); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + +(* ======================================================================= *) + + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ARITH `~(a >= b) <=> a < b`]); + (STRIP_TAC); + (ASM_CASES_TAC `hl (truncate_simplex 2 (vl:(real^3)list)) >= sqrt (&2)`); + + (ABBREV_TAC `xl = truncate_simplex 2 (ul:(real^3)list)`); + (ABBREV_TAC `yl = truncate_simplex 2 (vl:(real^3)list)`); + + (NEW_GOAL `set_of_list (truncate_simplex (i - 1) (ul:(real^3)list)) = + set_of_list (truncate_simplex (i - 1) vl)`); + (NEW_GOAL `V INTER mcell i V ul = set_of_list (truncate_simplex (i - 1) ul)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (NEW_GOAL `V INTER mcell j V vl = set_of_list (truncate_simplex (j - 1) vl)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `F`); + (NEW_GOAL `hl (yl:(real^3)list) <= dist (omega_list V yl, HD yl)`); + (MATCH_MP_TAC Rogers.WAUFCHE1); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN] THEN EXPAND_TAC "yl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `!w:real^3. w IN set_of_list xl + ==> dist (circumcenter (set_of_list xl),w) = hl xl`); + (MATCH_MP_TAC Rogers.HL_PROPERTIES); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "xl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_WITH `circumcenter (set_of_list xl) = + omega_list V (xl:(real^3)list)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN]); + (EXPAND_TAC "xl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (STRIP_TAC); + + (NEW_GOAL `hl xl = dist (omega_list V xl, HD yl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `HD (yl:(real^3)list) = HD (truncate_simplex (i - 1) vl)`); + (REWRITE_WITH `HD (yl:(real^3)list) = HD vl`); + (EXPAND_TAC "yl"); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `i IN {2,3}` THEN REWRITE_TAC[SET_RULE + `x IN {2,3} <=> x = 2 \/ x = 3`]); + (ARITH_TAC); + + (NEW_GOAL `HD (yl:(real^3)list) IN + set_of_list (truncate_simplex (i - 1) vl)`); + (REWRITE_TAC[ASSUME `HD (yl:(real^3)list) = + HD (truncate_simplex (i - 1) vl)`]); + (MATCH_MP_TAC Packing3.BARV_IMP_HD_IN_SET_OF_LIST); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `i - 1`); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `j IN {2,3}` THEN REWRITE_TAC[SET_RULE + `x IN {2,3} <=> x = 2 \/ x = 3`] THEN ARITH_TAC); + (UP_ASM_TAC); + (NEW_GOAL `set_of_list (truncate_simplex (i - 1) vl) SUBSET + set_of_list (xl:(real^3)list)`); + (EXPAND_TAC "xl"); + (REWRITE_TAC[GSYM (ASSUME + `set_of_list (truncate_simplex (i - 1) (ul:(real^3)list)) = + set_of_list (truncate_simplex (i - 1) vl)`)]); + (MATCH_MP_TAC Rogers.TRUNCATE_SIMPLEX_SUBSET); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `i IN {2,3}` THEN REWRITE_TAC[SET_RULE + `x IN {2,3} <=> x = 2 \/ x = 3`]); + (ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (SET_TAC[]); + + (NEW_GOAL `omega_list V xl = omega_list V yl`); + (REWRITE_TAC[OMEGA_LIST]); + (REWRITE_WITH `LENGTH (xl:(real^3)list) = 3 /\ LENGTH (yl:(real^3)list) = 3`); + (EXPAND_TAC "xl" THEN EXPAND_TAC "yl"); + (REWRITE_TAC[ARITH_RULE `3 = 2 + 1`]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (REWRITE_TAC[ARITH_RULE `3 - 1 = 2`]); + (EXPAND_TAC "xl" THEN EXPAND_TAC "yl"); + (REWRITE_WITH + `truncate_simplex 2 ul = truncate_simplex (2 + 0) (ul:(real^3)list) /\ + truncate_simplex 2 vl = truncate_simplex (2 + 0) (vl:(real^3)list)`); + (REWRITE_TAC[ARITH_RULE `2 + 0 = 2`]); + (REWRITE_WITH + `omega_list_n V (truncate_simplex (2 + 0) ul) 2 = omega_list_n V ul 2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (REWRITE_WITH + `omega_list_n V (truncate_simplex (2 + 0) vl) 2 = omega_list_n V vl 2`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1 /\ + CARD (set_of_list vl) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + + (NEW_GOAL `hl (xl:(real^3)list) = dist (omega_list V yl, HD yl)`); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[REAL_ARITH `~(a >= b) <=> a < b`]); + (STRIP_TAC); + +(* ======================================================================= *) + + (NEW_GOAL `sqrt (&2) <= hl (ul:(real^3)list)`); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_CASES_TAC `i = 2`); + (REWRITE_TAC[MCELL_EXPLICIT; ASSUME `i = 2`; mcell2]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (NEW_GOAL `i = 3`); + (ASM_SET_TAC[]); + (REWRITE_TAC[MCELL_EXPLICIT; ASSUME `i = 3`; mcell3]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `sqrt (&2) <= hl (vl:(real^3)list)`); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[]); + (ASM_CASES_TAC `j = 2`); + (REWRITE_TAC[MCELL_EXPLICIT; ASSUME `j = 2`; mcell2]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (NEW_GOAL `j = 3`); + (ASM_SET_TAC[]); + (REWRITE_TAC[MCELL_EXPLICIT; ASSUME `j = 3`; mcell3]); + (COND_CASES_TAC); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[NEGLIGIBLE_EMPTY]); + + (ABBREV_TAC `s2 = omega_list_n V ul 2`); + (ABBREV_TAC `s3 = omega_list_n V ul 3`); + (NEW_GOAL `s2 = omega_list_n V vl 2`); + (EXPAND_TAC "s2" THEN FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + (NEW_GOAL `s3 = omega_list_n V vl 3`); + (EXPAND_TAC "s3" THEN FIRST_ASSUM MATCH_MP_TAC); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_ARITH_TAC); + (ABBREV_TAC `u0:real^3 = HD ul`); + + (NEW_GOAL `?s. between s (s2,s3) /\ + dist (u0,s) = sqrt (&2) /\ + mxi V ul = s`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "s3"); + (MATCH_MP_TAC MXI_EXPLICIT); + (NEW_GOAL `?v0 u1 u2 u3. ul = [v0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `v0:real^3 = HD ul`); + (REWRITE_TAC[ASSUME `ul = [v0;u1;u2;u3:real^3]`; HD]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `v0:real^3 = HD vl`); + + (NEW_GOAL `?t. between t (s2,s3) /\ + dist (v0,t) = sqrt (&2) /\ + mxi V vl = t`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "v0"); + (MATCH_MP_TAC MXI_EXPLICIT); + (NEW_GOAL `?w0 u1 u2 u3. vl = [w0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `u1:real^3` THEN EXISTS_TAC `u2:real^3` THEN + EXISTS_TAC `u3:real^3`); + (ASM_REWRITE_TAC[HD]); + (EXPAND_TAC "v0"); + (REWRITE_TAC[ASSUME `vl = [w0;u1;u2;u3:real^3]`; HD]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `dist (u0:real^3, t) = sqrt (&2)`); + (NEW_GOAL `(t:real^3) IN voronoi_list V (truncate_simplex 2 vl)`); + (NEW_GOAL `s2 IN voronoi_list V (truncate_simplex 2 vl)`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (NEW_GOAL `s3 IN voronoi_list V (truncate_simplex 2 vl)`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[] THEN ARITH_TAC); + (NEW_GOAL `convex hull {s2, s3:real^3} SUBSET + convex hull (voronoi_list V (truncate_simplex 2 vl))`); + (MATCH_MP_TAC Marchal_cells.CONVEX_HULL_SUBSET THEN ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH + `convex hull voronoi_list V (truncate_simplex 2 vl) = + voronoi_list V (truncate_simplex 2 vl)`); + (REWRITE_TAC[CONVEX_HULL_EQ; CONVEX_VORONOI_LIST]); + (STRIP_TAC); + (NEW_GOAL `t IN convex hull {s2, s3:real^3}`); + (REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (NEW_GOAL `u0:real^3 IN set_of_list (truncate_simplex 2 vl)`); + (EXPAND_TAC "u0"); + + (NEW_GOAL `set_of_list (truncate_simplex (i - 1) (ul:(real^3)list)) = + set_of_list (truncate_simplex (i - 1) vl)`); + (NEW_GOAL `V INTER mcell i V ul = set_of_list (truncate_simplex (i - 1) ul)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (NEW_GOAL `V INTER mcell j V vl = set_of_list (truncate_simplex (j - 1) vl)`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (NEW_GOAL `i = 2 \/ i = 3`); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (REPEAT STRIP_TAC); + (ASM_ARITH_TAC); + (ASM_ARITH_TAC); + (UNDISCH_TAC `~NULLSET (mcell i V ul)`); + (ASM_REWRITE_TAC[NEGLIGIBLE_EMPTY]); + (ASM_MESON_TAC[]); + + (NEW_GOAL `HD (ul:(real^3)list) = HD (truncate_simplex (i - 1) ul)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `i IN {2,3}` THEN REWRITE_TAC[SET_RULE + `x IN {2,3} <=> x = 2 \/ x = 3`]); + (ARITH_TAC); + + (NEW_GOAL `HD (ul:(real^3)list) IN + set_of_list (truncate_simplex (i - 1) ul)`); + (REWRITE_TAC[ASSUME `HD (ul:(real^3)list) = + HD (truncate_simplex (i - 1) ul)`]); + (MATCH_MP_TAC Packing3.BARV_IMP_HD_IN_SET_OF_LIST); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `i - 1`); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `j IN {2,3}` THEN REWRITE_TAC[SET_RULE + `x IN {2,3} <=> x = 2 \/ x = 3`] THEN ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list (truncate_simplex (j - 1) vl) SUBSET + set_of_list (truncate_simplex 2 (vl:(real^3)list))`); + (MATCH_MP_TAC Rogers.TRUNCATE_SIMPLEX_SUBSET); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `j IN {2,3}` THEN REWRITE_TAC[SET_RULE + `x IN {2,3} <=> x = 2 \/ x = 3`]); + (ARITH_TAC); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (SET_TAC[]); + + + (NEW_GOAL `v0:real^3 IN set_of_list (truncate_simplex 2 vl)`); + (EXPAND_TAC "v0"); + (REWRITE_WITH `(HD vl):real^3 = HD (truncate_simplex 2 vl)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (vl:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `j IN {2,3}` THEN REWRITE_TAC[SET_RULE + `x IN {2,3} <=> x = 2 \/ x = 3`]); + (ARITH_TAC); + (MATCH_MP_TAC Packing3.BARV_IMP_HD_IN_SET_OF_LIST); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `2`); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `t:real^3 IN voronoi_closed V u0`); + (UNDISCH_TAC `t:real^3 IN voronoi_list V (truncate_simplex 2 vl)`); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET;]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN; IN_ELIM_THM; voronoi_closed]); + (STRIP_TAC); + (NEW_GOAL `dist (u0:real^3, t) <= dist (v0:real^3, t)`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (FIRST_ASSUM MATCH_MP_TAC THEN EXPAND_TAC "v0"); + (REWRITE_TAC[MESON[IN] `(V:real^3->bool) s <=> s IN V`]); + (NEW_GOAL `HD (vl:(real^3)list) IN set_of_list vl`); + (MATCH_MP_TAC Packing3.BARV_IMP_HD_IN_SET_OF_LIST); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list (vl:(real^3)list) SUBSET V`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + + (NEW_GOAL `t:real^3 IN voronoi_closed V v0`); + (UNDISCH_TAC `t:real^3 IN voronoi_list V (truncate_simplex 2 vl)`); + (REWRITE_TAC[VORONOI_LIST; VORONOI_SET;]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN; IN_ELIM_THM; voronoi_closed]); + (STRIP_TAC); + (NEW_GOAL `dist (v0:real^3, t) <= dist (u0:real^3, t)`); + (ONCE_REWRITE_TAC[DIST_SYM]); + (FIRST_ASSUM MATCH_MP_TAC THEN EXPAND_TAC "u0"); + (REWRITE_TAC[MESON[IN] `(V:real^3->bool) s <=> s IN V`]); + (NEW_GOAL `HD (ul:(real^3)list) IN set_of_list ul`); + (MATCH_MP_TAC Packing3.BARV_IMP_HD_IN_SET_OF_LIST); + (EXISTS_TAC `V:real^3->bool` THEN EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list (ul:(real^3)list) SUBSET V`); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ASM_REAL_ARITH_TAC); + + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `!n. between n (s2, s3:real^3) ==> + dist (u0, n) pow 2 = dist (s2, n) pow 2 + dist (u0, s2) pow 2`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[dist]); + (MATCH_MP_TAC PYTHAGORAS); + (REWRITE_TAC[orthogonal]); + (ABBREV_TAC `zl = truncate_simplex 2 (ul:(real^3)list)`); + (REWRITE_WITH `s2:real^3 = circumcenter (set_of_list zl)`); + (REWRITE_WITH `s2 = omega_list V zl`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "zl"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_LEMMA); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Rogers.XNHPWAB1); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN]); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (MATCH_MP_TAC Rogers.MHFTTZN4); + (EXISTS_TAC `V:real^3->bool`); + (EXISTS_TAC `2`); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `s2 IN voronoi_list V zl`); + (REWRITE_WITH `s2 = omega_list V zl`); + (EXPAND_TAC "s2" THEN EXPAND_TAC "zl"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_LEMMA); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Packing3.OMEGA_LIST_IN_VORONOI_LIST); + (EXISTS_TAC `2`); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + + (NEW_GOAL `s3 IN voronoi_list V zl`); + (EXPAND_TAC "s3" THEN EXPAND_TAC "zl"); + (MATCH_MP_TAC Rogers.OMEGA_LIST_N_IN_VORONOI_LIST_GEN); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3 /\ 3 <= 3`]); + (NEW_GOAL `affine hull {s2, s3} SUBSET affine hull voronoi_list V zl`); + (MATCH_MP_TAC Marchal_cells_2_new.AFFINE_SUBSET_KY_LEMMA); + (ASM_SET_TAC[]); + (NEW_GOAL `n IN affine hull {s2, s3:real^3}`); + (NEW_GOAL `convex hull {s2,s3} SUBSET affine hull {s2,s3:real^3}`); + (REWRITE_TAC[CONVEX_HULL_SUBSET_AFFINE_HULL]); + (NEW_GOAL `n IN convex hull {s2, s3:real^3}`); + (REWRITE_TAC[GSYM BETWEEN_IN_CONVEX_HULL]); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + + (MATCH_MP_TAC Marchal_cells_2_new.IN_AFFINE_KY_LEMMA1); + (REWRITE_WITH `u0:real^3 = HD zl`); + (EXPAND_TAC "zl" THEN EXPAND_TAC "u0"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Packing3.HD_IN_SET_OF_LIST); + + (REWRITE_WITH `LENGTH (zl:(real^3)list) = 2 + 1 /\ + CARD (set_of_list zl) = 2 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ARITH_TAC); + + (NEW_GOAL `dist (u0,s) pow 2 = dist (s2,s:real^3) pow 2 + dist (u0,s2) pow 2`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `dist (u0,t) pow 2 = dist (s2,t:real^3) pow 2 + dist (u0,s2) pow 2`); + (ASM_SIMP_TAC[]); + (NEW_GOAL `dist (s2, s:real^3) = dist (s2, t)`); + (REWRITE_TAC[DIST_EQ]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + + (UNDISCH_TAC `between s (s2, s3:real^3)` THEN + UNDISCH_TAC `between t (s2, s3:real^3)`); + (REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `dist (s2,s) = dist (s2,t:real^3)`); + (REWRITE_TAC[dist;ASSUME `s = u' % s2 + v' % s3:real^3`; + ASSUME `t = u % s2 + v % s3:real^3` ]); + (REWRITE_WITH `s2 - (u' % s2 + v' % s3) = + (u' + v') % s2 - (u' % s2 + v' % s3:real^3)`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_WITH `s2 - (u % s2 + v % s3) = + (u + v) % s2 - (u % s2 + v % s3:real^3)`); + (ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC); + (REWRITE_TAC[VECTOR_ARITH `(u + v) % s - (u % s + v % t) = v % (s - t)`]); + (REWRITE_TAC[NORM_MUL]); + (REWRITE_WITH `abs v = v /\ abs v' = v'`); + (ASM_SIMP_TAC[REAL_ABS_REFL]); + (REWRITE_TAC[REAL_ARITH `a * b = c * b <=> (a - c) * b = &0`;REAL_ENTIRE]); + (STRIP_TAC); + + (REWRITE_WITH `v = v':real /\ u = u':real`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[NORM_EQ_0]); + (REWRITE_TAC[VECTOR_ARITH `a - b = vec 0 <=> a = b`] THEN STRIP_TAC); + (NEW_GOAL `F`); + (NEW_GOAL `hl (ul:(real^3)list) <= dist (s3,u0:real^3)`); + (REWRITE_WITH `s3 = omega_list V ul /\ u0 = HD ul`); + (STRIP_TAC); + (REWRITE_TAC[GSYM (ASSUME `omega_list_n V ul 3 = s3`); OMEGA_LIST]); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `(3 + 1) - 1 = 3`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Rogers.WAUFCHE1); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[IN]); + (ABBREV_TAC `zl:(real^3)list = truncate_simplex 2 ul`); + (NEW_GOAL `hl (zl:(real^3)list) = dist (s3, u0:real^3)`); + + (REWRITE_WITH `s3 = omega_list V zl /\ u0 = HD zl`); + (STRIP_TAC); + (REWRITE_TAC[GSYM (ASSUME `s2:real^3 = s3`); OMEGA_LIST]); + (EXPAND_TAC "s2"); + + (REWRITE_WITH `LENGTH (zl:(real^3)list) = 2 + 1 /\ + CARD (set_of_list zl) = 2 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (REWRITE_TAC[ARITH_RULE `(2 + 1) - 1 = 2`]); + (EXPAND_TAC "zl"); + + (REWRITE_WITH `truncate_simplex 2 (ul:(real^3)list) = + truncate_simplex (2 + 0) (ul:(real^3)list)`); + (REWRITE_TAC[ARITH_RULE `2 + 0 = 2`]); + (MATCH_MP_TAC Packing3.OMEGA_LIST_N_LEMMA); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (EXPAND_TAC "zl" THEN EXPAND_TAC "u0"); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (MATCH_MP_TAC Rogers.WAUFCHE2); + (EXISTS_TAC `2` THEN ASM_REWRITE_TAC[IN]); + (EXPAND_TAC "zl"); + (MATCH_MP_TAC Packing3.TRUNCATE_SIMPLEX_BARV); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[ARITH_RULE `2 <= 3`]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 47 *) + +let DIHV_SYM_3 = prove_by_refinement ( + `!a b c d x y z t. + {a,b:real^3} = {c,d} /\ {x,y} = {z,t} ==> + dihV a b x y = dihV c d z t`, +[(REWRITE_TAC[SET_RULE `{a,b} = {c,d} <=> + (a = c /\ b = d) \/ (a = d /\ b = c)`]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[DIHV_SYM_2]); + (ASM_REWRITE_TAC[DIHV_SYM_2; DIHV_SYM]); + (ASM_REWRITE_TAC[DIHV_SYM_2; DIHV_SYM])]);; + +(* ==================================================================== *) +(* Lemma 48 *) + +let DIHX_SYM = prove_by_refinement ( + `!V X u v. + packing V /\ saturated V /\ mcell_set V X /\ {u, v} IN edgeX V X + ==> dihX V X (u,v) = dihX V X (v,u)`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[dihX]); + (COND_CASES_TAC); + (COND_CASES_TAC); + (REFL_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (DEL_TAC THEN REWRITE_TAC[cell_params_d] THEN REPEAT LET_TAC); + + (UNDISCH_TAC `{u, v} IN edgeX V X` THEN REWRITE_TAC[edgeX; IN;IN_ELIM_THM]); + (REWRITE_WITH `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `mcell_set V X` THEN REWRITE_TAC[mcell_set;IN_ELIM_THM;IN]); + (MESON_TAC[]); + (STRIP_TAC); + (MP_TAC (ASSUME `(V INTER X) (u':real^3)`) THEN + MP_TAC (ASSUME `(V INTER X) (v':real^3)`)); + (UNDISCH_TAC `mcell_set V X` THEN REWRITE_TAC[mcell_set_2;IN_ELIM_THM;IN]); + (STRIP_TAC); + (REWRITE_TAC[ASSUME `X = mcell i V ul''`]); + (REWRITE_WITH `(V INTER mcell i V ul'') = set_of_list (truncate_simplex (i-1) ul'')`); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell i V ul''`)]); + (STRIP_TAC); + (REWRITE_TAC[ARITH_RULE `1 <= i <=> ~(i = 0)`]); + (STRIP_TAC); + (MP_TAC (ASSUME `(V INTER X) (u':real^3)`)); + (REWRITE_WITH `V INTER X:real^3->bool = {}`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`]); + (SET_TAC[]); + (UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[NEGLIGIBLE_EMPTY]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `i <= 1`); + (NEW_GOAL `?w0 w1 w2 w3. ul'' = [w0;w1;w2;w3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (v':real^3)` THEN + UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (u':real^3)`); + (NEW_GOAL `i - 1 = 0`); + (UNDISCH_TAC `i <= 1` THEN ARITH_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_0; set_of_list; + MESON[IN] `(A:real^3->bool) b <=> b IN A`]); + (REWRITE_TAC[SET_RULE `a IN {b} <=> a = b`]); + (UNDISCH_TAC `~(u' = v':real^3)`); + (SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[ARITH_RULE `~(i <= 1) <=> 2 <= i`] + THEN STRIP_TAC); + +(* ========================================================================== *) + + (NEW_GOAL `?p. p permutes 0..i - 1 /\ + initial_sublist [u:real^3; v] (left_action_list p ul'')`); + (NEW_GOAL `?w0 w1 w2 w3. ul'' = [w0;w1;w2;w3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ASM_CASES_TAC `i = 2`); + (UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (v':real^3)` THEN + UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (u':real^3)`); + (NEW_GOAL `i - 1 = 1`); + (UNDISCH_TAC `i = 2` THEN ARITH_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list; + MESON[IN] `(A:real^3->bool) b <=> b IN A`]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `u = w0:real^3`); + (NEW_GOAL `v = w1:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC + `~(u' = v':real^3)` THEN UNDISCH_TAC `{u,v} = {u',v':real^3}` + THEN SET_TAC[]); + (EXISTS_TAC `I:num->num`); + (ASM_REWRITE_TAC[PERMUTES_I; Packing3.LEFT_ACTION_LIST_I]); + (REWRITE_WITH `initial_sublist [w0; w1] [w0; w1; w2; w3] /\ + LENGTH [w0;w1:real^3] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; LENGTH] THEN ARITH_TAC); + (NEW_GOAL `v = w0:real^3 /\ u = w1:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC + `~(u' = v':real^3)` THEN UNDISCH_TAC `{u,v} = {u',v':real^3}` + THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?p. p permutes 0..1 /\ + [w1; w0; w2; w3:real^3] = left_action_list p ul''`); + (MATCH_MP_TAC Qzksykg.TWO_REARRANGEMENT_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC); + (EXISTS_TAC `p:num->num` THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[GSYM + (ASSUME `[w1; w0; w2; w3] = left_action_list p [w0; w1; w2; w3:real^3]`)]); + (REWRITE_WITH `initial_sublist [w1; w0] [w1; w0; w2; w3] /\ + LENGTH [w1;w0:real^3] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; LENGTH] THEN ARITH_TAC); + + (ASM_CASES_TAC `i = 3`); + (UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (v':real^3)` THEN + UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (u':real^3)`); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2; + set_of_list; MESON[IN] `(A:real^3->bool) b <=> b IN A`]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `u IN {w0, w1, w2} /\ v IN {w0, w1, w2:real^3} /\ ~(u = v)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?a. {u,v, a} = {w0, w1, w2:real^3}`); + (NEW_GOAL `?w:real^3. w IN {w0, w1, w2} DIFF {u, v}`); + (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]); + (REWRITE_WITH `{w0, w1, w2} DIFF {u, v:real^3} = {} <=> + CARD ({w0, w1, w2} DIFF {u, v}) = 0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_EQ_0); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{w0, w1, w2:real^3}`); + (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]); + + (NEW_GOAL `CARD {w0, w1, w2} = CARD ({w0, w1, w2} DIFF {u, v:real^3}) + + CARD {u, v}`); + (MATCH_MP_TAC Hypermap.CARD_MINUS_DIFF_TWO_SET); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + (UP_ASM_TAC THEN REWRITE_WITH `CARD ({w0, w1, w2:real^3}) = 3`); + (ASM_CASES_TAC `CARD {w0,w1,w2:real^3} <= 2`); + (NEW_GOAL `F`); + (NEW_GOAL `CARD {w0, w1, w2, w3:real^3} = 4`); + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list ul''`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul'':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul'') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_WITH `CARD {w0, w1, w2, w3} = + CARD {w3, w0,w1,w2:real^3}`); + (AP_TERM_TAC THEN SET_TAC[]); + (NEW_GOAL `CARD ({w3, w0, w1, w2}) <= SUC (CARD {w0, w1, w2:real^3})`); + (SIMP_TAC[Geomdetail.CARD_CLAUSES_IMP; Geomdetail.FINITE6]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (ASM_MESON_TAC[]); + (NEW_GOAL `CARD {w0, w1, w2:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + + (SUBGOAL_THEN `CARD {u,v:real^3} <= 2` MP_TAC); + (REWRITE_TAC[Geomdetail.CARD2]); + (ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `w:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?p. p permutes 0..2 /\ + [u; v; a; w3] = left_action_list p [w0; w1; w2; w3:real^3]`); + (MATCH_MP_TAC LEFT_ACTION_LIST_2_EXISTS); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list ul''`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul'':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul'') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `[u; v; a; w3:real^3] = + left_action_list p [w0; w1; w2; w3]`)]); + (REWRITE_WITH `initial_sublist [u; v] [u; v; a; w3] /\ + LENGTH [u; v:real^3] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST; LENGTH; + TRUNCATE_SIMPLEX_EXPLICIT_1] THEN ARITH_TAC); + + (NEW_GOAL `i = 4`); + (ASM_ARITH_TAC); + (UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (v':real^3)` THEN + UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (u':real^3)`); + (ASM_REWRITE_TAC[ARITH_RULE `4 - 1 = 3`; TRUNCATE_SIMPLEX_EXPLICIT_3; + set_of_list; MESON[IN] `(A:real^3->bool) b <=> b IN A`]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `u IN {w0, w1, w2, w3} /\ v IN {w0, w1, w2, w3:real^3} /\ + ~(u = v)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?a b. {u,v,a,b} = {w0, w1, w2, w3:real^3}`); + + (NEW_GOAL `?w:real^3. w IN {w0, w1, w2, w3} DIFF {u, v}`); + (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]); + (REWRITE_WITH `{w0, w1, w2, w3} DIFF {u, v:real^3} = {} <=> + CARD ({w0, w1, w2, w3} DIFF {u, v}) = 0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_EQ_0); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{w0, w1, w2, w3:real^3}`); + (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]); + + (NEW_GOAL `CARD {w0, w1, w2, w3} = + CARD ({w0, w1, w2, w3} DIFF {u, v:real^3}) + CARD {u, v}`); + (MATCH_MP_TAC Hypermap.CARD_MINUS_DIFF_TWO_SET); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + + (UP_ASM_TAC THEN REWRITE_WITH `CARD ({w0, w1, w2, w3:real^3}) = 3 + 1`); + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list ul''`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul'':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul'') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD {u, v:real^3} <= 2`); + (REWRITE_TAC[Geomdetail.CARD2]); + (UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?m:real^3. m IN {w0, w1, w2, w3} DIFF {u, v, w}`); + (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]); + (REWRITE_WITH `{w0, w1, w2, w3} DIFF {u, v, w:real^3} = {} <=> + CARD ({w0, w1, w2, w3} DIFF {u, v, w}) = 0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_EQ_0); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{w0, w1, w2, w3:real^3}`); + (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]); + + (NEW_GOAL `CARD ({w0, w1, w2, w3} DIFF {u,v,w:real^3}) = + CARD {w0, w1, w2, w3} - CARD {u,v,w}`); + (MATCH_MP_TAC CARD_DIFF); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH `CARD ({w0, w1, w2, w3:real^3}) = 3 + 1`); + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list ul''`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul'':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul'') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD {u, v, w:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (EXISTS_TAC `w:real^3` THEN EXISTS_TAC `m:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN + UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?p. p permutes 0..3 /\ + [u; v; a; b] = left_action_list p [w0; w1; w2; w3:real^3]`); + (MATCH_MP_TAC LEFT_ACTION_LIST_3_EXISTS); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list ul''`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul'':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul'') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `[u; v; a; b:real^3] = + left_action_list p [w0; w1; w2; w3]`)]); + (REWRITE_WITH `initial_sublist [u; v] [u; v; a; b] /\ + LENGTH [u; v:real^3] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST; LENGTH; + TRUNCATE_SIMPLEX_EXPLICIT_1] THEN ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + +(* ========================================================================== *) + + (NEW_GOAL `?q. q permutes 0..i - 1 /\ + initial_sublist [v:real^3; u] (left_action_list q ul'')`); + (NEW_GOAL `?w0 w1 w2 w3. ul'' = [w0;w1;w2;w3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ASM_CASES_TAC `i = 2`); + (UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (v':real^3)` THEN + UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (u':real^3)`); + (NEW_GOAL `i - 1 = 1`); + (UNDISCH_TAC `i = 2` THEN ARITH_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; set_of_list; + MESON[IN] `(A:real^3->bool) b <=> b IN A`]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `v = w0:real^3`); + (NEW_GOAL `u = w1:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC + `~(u' = v':real^3)` THEN UNDISCH_TAC `{u,v} = {u',v':real^3}` + THEN SET_TAC[]); + (EXISTS_TAC `I:num->num`); + (ASM_REWRITE_TAC[PERMUTES_I; Packing3.LEFT_ACTION_LIST_I]); + (REWRITE_WITH `initial_sublist [w0; w1] [w0; w1; w2; w3] /\ + LENGTH [w0;w1:real^3] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; LENGTH] THEN ARITH_TAC); + (NEW_GOAL `u = w0:real^3 /\ v = w1:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UNDISCH_TAC + `~(u' = v':real^3)` THEN UNDISCH_TAC `{u,v} = {u',v':real^3}` + THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `?q. q permutes 0..1 /\ + [w1; w0; w2; w3:real^3] = left_action_list q ul''`); + (MATCH_MP_TAC Qzksykg.TWO_REARRANGEMENT_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC); + (EXISTS_TAC `q:num->num` THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[GSYM + (ASSUME `[w1; w0; w2; w3] = left_action_list q [w0; w1; w2; w3:real^3]`)]); + (REWRITE_WITH `initial_sublist [w1; w0] [w1; w0; w2; w3] /\ + LENGTH [w1;w0:real^3] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_1; LENGTH] THEN ARITH_TAC); + + (ASM_CASES_TAC `i = 3`); + (UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (v':real^3)` THEN + UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (u':real^3)`); + (ASM_REWRITE_TAC[ARITH_RULE `3 - 1 = 2`; TRUNCATE_SIMPLEX_EXPLICIT_2; + set_of_list; MESON[IN] `(A:real^3->bool) b <=> b IN A`]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `u IN {w0, w1, w2} /\ v IN {w0, w1, w2:real^3} /\ ~(u = v)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?a. {u,v, a} = {w0, w1, w2:real^3}`); + (NEW_GOAL `?w:real^3. w IN {w0, w1, w2} DIFF {u, v}`); + (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]); + (REWRITE_WITH `{w0, w1, w2} DIFF {u, v:real^3} = {} <=> + CARD ({w0, w1, w2} DIFF {u, v}) = 0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_EQ_0); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{w0, w1, w2:real^3}`); + (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]); + + (NEW_GOAL `CARD {w0, w1, w2} = CARD ({w0, w1, w2} DIFF {u, v:real^3}) + + CARD {u, v}`); + (MATCH_MP_TAC Hypermap.CARD_MINUS_DIFF_TWO_SET); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + (UP_ASM_TAC THEN REWRITE_WITH `CARD ({w0, w1, w2:real^3}) = 3`); + (ASM_CASES_TAC `CARD {w0,w1,w2:real^3} <= 2`); + (NEW_GOAL `F`); + (NEW_GOAL `CARD {w0, w1, w2, w3:real^3} = 4`); + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list ul''`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul'':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul'') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_WITH `CARD {w0, w1, w2, w3} = + CARD {w3, w0,w1,w2:real^3}`); + (AP_TERM_TAC THEN SET_TAC[]); + (NEW_GOAL `CARD ({w3, w0, w1, w2}) <= SUC (CARD {w0, w1, w2:real^3})`); + (SIMP_TAC[Geomdetail.CARD_CLAUSES_IMP; Geomdetail.FINITE6]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + (ASM_MESON_TAC[]); + (NEW_GOAL `CARD {w0, w1, w2:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN ARITH_TAC); + + (SUBGOAL_THEN `CARD {u,v:real^3} <= 2` MP_TAC); + (REWRITE_TAC[Geomdetail.CARD2]); + (ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + (EXISTS_TAC `w:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_WITH `{u,v,a} = {v, u, a:real^3}`); + (SET_TAC[]); + (STRIP_TAC); + + (NEW_GOAL `?q. q permutes 0..2 /\ + [v; u; a; w3] = left_action_list q [w0; w1; w2; w3:real^3]`); + (MATCH_MP_TAC LEFT_ACTION_LIST_2_EXISTS); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list ul''`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul'':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul'') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (EXISTS_TAC `q:num->num`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `[v; u; a; w3:real^3] = + left_action_list q [w0; w1; w2; w3]`)]); + (REWRITE_WITH `initial_sublist [v; u] [v; u; a; w3] /\ + LENGTH [v; u:real^3] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST; LENGTH; + TRUNCATE_SIMPLEX_EXPLICIT_1] THEN ARITH_TAC); + + (NEW_GOAL `i = 4`); + (ASM_ARITH_TAC); + (UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (v':real^3)` THEN + UNDISCH_TAC `set_of_list (truncate_simplex (i - 1) ul'') (u':real^3)`); + (ASM_REWRITE_TAC[ARITH_RULE `4 - 1 = 3`; TRUNCATE_SIMPLEX_EXPLICIT_3; + set_of_list; MESON[IN] `(A:real^3->bool) b <=> b IN A`]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `u IN {w0, w1, w2, w3} /\ v IN {w0, w1, w2, w3:real^3} /\ + ~(u = v)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?a b. {u,v,a,b} = {w0, w1, w2, w3:real^3}`); + + (NEW_GOAL `?w:real^3. w IN {w0, w1, w2, w3} DIFF {u, v}`); + (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]); + (REWRITE_WITH `{w0, w1, w2, w3} DIFF {u, v:real^3} = {} <=> + CARD ({w0, w1, w2, w3} DIFF {u, v}) = 0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_EQ_0); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{w0, w1, w2, w3:real^3}`); + (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]); + + (NEW_GOAL `CARD {w0, w1, w2, w3} = + CARD ({w0, w1, w2, w3} DIFF {u, v:real^3}) + CARD {u, v}`); + (MATCH_MP_TAC Hypermap.CARD_MINUS_DIFF_TWO_SET); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + + (UP_ASM_TAC THEN REWRITE_WITH `CARD ({w0, w1, w2, w3:real^3}) = 3 + 1`); + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list ul''`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul'':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul'') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD {u, v:real^3} <= 2`); + (REWRITE_TAC[Geomdetail.CARD2]); + (UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?m:real^3. m IN {w0, w1, w2, w3} DIFF {u, v, w}`); + (REWRITE_TAC[SET_RULE `(?x. x IN s) <=> ~(s = {})`]); + (REWRITE_WITH `{w0, w1, w2, w3} DIFF {u, v, w:real^3} = {} <=> + CARD ({w0, w1, w2, w3} DIFF {u, v, w}) = 0`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC CARD_EQ_0); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{w0, w1, w2, w3:real^3}`); + (REWRITE_TAC[Geomdetail.FINITE6] THEN SET_TAC[]); + + (NEW_GOAL `CARD ({w0, w1, w2, w3} DIFF {u,v,w:real^3}) = + CARD {w0, w1, w2, w3} - CARD {u,v,w}`); + (MATCH_MP_TAC CARD_DIFF); + (ASM_REWRITE_TAC[Geomdetail.FINITE6]); + + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_WITH `CARD ({w0, w1, w2, w3:real^3}) = 3 + 1`); + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list ul''`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul'':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul'') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD {u, v, w:real^3} <= 3`); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (EXISTS_TAC `w:real^3` THEN EXISTS_TAC `m:real^3`); + (UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC THEN + UP_ASM_TAC THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_WITH `{u,v,a,b} = {v, u, a, b:real^3}`); + (SET_TAC[]); + (STRIP_TAC); + + (NEW_GOAL `?q. q permutes 0..3 /\ + [v; u; a; b] = left_action_list q [w0; w1; w2; w3:real^3]`); + (MATCH_MP_TAC LEFT_ACTION_LIST_3_EXISTS); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `{w0, w1, w2, w3:real^3} = set_of_list ul''`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `LENGTH (ul'':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul'') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (EXISTS_TAC `q:num->num`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `[v; u; a; b:real^3] = + left_action_list q [w0; w1; w2; w3]`)]); + (REWRITE_WITH `initial_sublist [v; u] [v; u; a; b] /\ + LENGTH [v; u:real^3] = 1 + 1`); + (REWRITE_TAC[GSYM Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST; LENGTH; + TRUNCATE_SIMPLEX_EXPLICIT_1] THEN ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + +(* ========================================================================= *) + + (ABBREV_TAC `P = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [v; u] ul)`); + (NEW_GOAL `(P:num#(real^3)list->bool) (k, ul)`); + (REWRITE_TAC[GSYM (ASSUME `(@) (P:num#(real^3)list->bool) = k,ul`)]); + (MATCH_MP_TAC SELECT_AX); + + (EXISTS_TAC `(i:num, left_action_list q (ul'':(real^3)list))`); + (EXPAND_TAC "P" THEN REWRITE_TAC[BETA_THM]); + (ASM_REWRITE_TAC[IN]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC Qzksykg.QZKSYKG1); + (EXISTS_TAC `ul'':(real^3)list`); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `q:num->num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_REWRITE_TAC[GSYM Ajripqn.UP_TO_4_KY_LEMMA]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell i V ul''`)]); + (UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[NEGLIGIBLE_EMPTY]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Rvfxzbu.RVFXZBU); + (ASM_REWRITE_TAC[GSYM Ajripqn.UP_TO_4_KY_LEMMA]); + + + (ABBREV_TAC `Q = (\(k, ul). k <= 4 /\ + ul IN barV V 3 /\ + X = mcell k V ul /\ + initial_sublist [u; v] ul)`); + (NEW_GOAL `(Q:num#(real^3)list->bool) (k', ul')`); + (REWRITE_TAC[GSYM (ASSUME `(@) (Q:num#(real^3)list->bool) = k',ul'`)]); + (MATCH_MP_TAC SELECT_AX); + + (EXISTS_TAC `(i:num, left_action_list p (ul'':(real^3)list))`); + (EXPAND_TAC "Q" THEN REWRITE_TAC[BETA_THM]); + (ASM_REWRITE_TAC[IN]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC Qzksykg.QZKSYKG1); + (EXISTS_TAC `ul'':(real^3)list`); + (EXISTS_TAC `i:num` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_REWRITE_TAC[GSYM Ajripqn.UP_TO_4_KY_LEMMA]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell i V ul''`)]); + (UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[NEGLIGIBLE_EMPTY]); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Rvfxzbu.RVFXZBU); + (ASM_REWRITE_TAC[GSYM Ajripqn.UP_TO_4_KY_LEMMA]); + + (UP_ASM_TAC THEN EXPAND_TAC "Q" THEN REWRITE_TAC[] THEN DEL_TAC); + (UP_ASM_TAC THEN EXPAND_TAC "P" THEN REWRITE_TAC[IN] THEN DEL_TAC); + (REPEAT STRIP_TAC); + + (NEW_GOAL `i = k:num`); + (REWRITE_WITH `i = k /\ mcell i V ul'' = mcell k V ul`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[GSYM Ajripqn.UP_TO_4_KY_LEMMA]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell i V ul''`); + GSYM (ASSUME `X = mcell k V ul`); SET_RULE `a INTER a = a`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `i = k':num`); + (REWRITE_WITH `i = k' /\ mcell i V ul'' = mcell k' V ul'`); + (MATCH_MP_TAC Ajripqn.AJRIPQN); + (ASM_REWRITE_TAC[GSYM Ajripqn.UP_TO_4_KY_LEMMA]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell i V ul''`); GSYM (ASSUME `i = k:num`); + GSYM (ASSUME `X = mcell k' V ul'`); SET_RULE `a INTER a = a`]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `i = k /\ (!k. i - 1 <= k /\ k <= 3 + ==> omega_list_n V ul k = omega_list_n V ul' k)`); + (MATCH_MP_TAC MCELL_ID_OMEGA_LIST_N); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_MESON_TAC[]); + (STRIP_TAC); + (ASM_MESON_TAC[]); + (REWRITE_TAC[SET_RULE `a IN {m,n,p} <=> a = m \/ a = n \/ a = p`]); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (REWRITE_WITH `k' = k:num`); + (ASM_MESON_TAC[]); + + (ASM_CASES_TAC `i < 4`); + (NEW_GOAL `mxi V ul' = mxi V ul`); + (MATCH_MP_TAC MCELL_ID_MXI_2); + (EXISTS_TAC `k':num` THEN EXISTS_TAC `k:num`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k' V ul'`)]); + (REWRITE_TAC[ASSUME `X = mcell k V ul`; ASSUME `~NULLSET X`]); + (REWRITE_TAC[SET_RULE `a IN {b,c} <=> a = b \/ a = c`]); + (ASM_ARITH_TAC); + + (NEW_GOAL `HD ul = HD [v; u:real^3]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_INITIAL_SUBLIST); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `HD ul' = HD [u; v:real^3]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_INITIAL_SUBLIST); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `EL 1 ul = EL 1 ([v; u:real^3])`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `[v; u:real^3] = truncate_simplex 1 ul`); + (REWRITE_WITH `truncate_simplex 1 ul = [v;u:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `EL 1 ul' = EL 1 ([u; v:real^3])`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `[u; v:real^3] = truncate_simplex 1 ul'`); + (REWRITE_WITH `truncate_simplex 1 ul' =[u;v:real^3] /\ 1 + 1 <= LENGTH ul'`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_TAC[dihu2]); + (REWRITE_WITH `omega_list_n V ul 3 = omega_list_n V ul' 3`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_ARITH_TAC); + (ASM_REWRITE_TAC[EL; HD; TL; ARITH_RULE `1 = SUC 0`; DIHV_SYM]); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (COND_CASES_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (DEL_TAC THEN DEL_TAC); + (REWRITE_TAC[dihu3]); + (ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `1 = SUC 0`]); + + (REWRITE_WITH `EL 2 ul' = EL 2 (ul:(real^3)list)`); + (NEW_GOAL `set_of_list (truncate_simplex 2 (ul:(real^3)list)) = + set_of_list (truncate_simplex 2 ul')`); + (REWRITE_TAC[ARITH_RULE `2 = 3 - 1`]); + (REWRITE_WITH `set_of_list (truncate_simplex (3 - 1) ul) = + (V:real^3->bool) INTER X`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[ASSUME `X = mcell k V ul`; ASSUME `k = 3`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3 /\ 3 <= 4`]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k V ul`); GSYM (ASSUME `k = 3`)]); + (UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[NEGLIGIBLE_EMPTY]); + (REWRITE_TAC[ASSUME `X = mcell k' V ul'`]); + (REWRITE_WITH `k' = 3`); + (ASM_ARITH_TAC); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[ARITH_RULE `1 <= 3 /\ 3 <= 4`]); + (REWRITE_WITH `3 = k'`); + (ASM_ARITH_TAC); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k' V ul'`)]); + (UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[NEGLIGIBLE_EMPTY]); + + (NEW_GOAL `?y0 y1 y2 y3. ul = [y0;y1;y2;y3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `?z0 z1 z2 z3. ul' = [z0;z1;z2;z3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (UNDISCH_TAC `EL 1 ul = EL 1 [v; u:real^3]` THEN + UNDISCH_TAC `HD ul = HD [v; u:real^3]` + THEN ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `EL 1 ul' = EL 1 [u; v:real^3]` THEN + UNDISCH_TAC `HD ul' = HD [u; v:real^3]` + THEN ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `2 = SUC 1 /\ 1 = SUC 0`]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `set_of_list (truncate_simplex 2 (ul:(real^3)list)) = + set_of_list (truncate_simplex 2 ul')`); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_2; set_of_list]); + (NEW_GOAL `~(y2 IN {u, v:real^3})`); + (STRIP_TAC); + (NEW_GOAL `CARD (set_of_list (ul:(real^3)list)) <= 3`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH ` {v, u, y2, y3} = {v,u, y3:real^3}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN REWRITE_WITH`CARD (set_of_list (ul:(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (UP_ASM_TAC THEN SET_TAC[]); + + (REWRITE_TAC[DIHV_SYM]); + (UP_ASM_TAC THEN MESON_TAC[]); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (ASM_MESON_TAC[]); + + (NEW_GOAL `k = 4`); + (ASM_ARITH_TAC); + + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (NEW_GOAL `F`); + (ASM_ARITH_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (COND_CASES_TAC); + (COND_CASES_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + (ASM_MESON_TAC[]); + (COND_CASES_TAC); + + + (REWRITE_TAC[dihu4]); + +(* ========================================================================= *) + (MATCH_MP_TAC DIHV_SYM_3); + (REWRITE_TAC[EL]); + + (NEW_GOAL `HD ul = HD [v; u:real^3]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_INITIAL_SUBLIST); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `HD ul' = HD [u; v:real^3]`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Packing3.HD_INITIAL_SUBLIST); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + + (NEW_GOAL `EL 1 ul = EL 1 ([v; u:real^3])`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `[v; u:real^3] = truncate_simplex 1 ul`); + (REWRITE_WITH `truncate_simplex 1 ul = [v;u:real^3] /\ 1 + 1 <= LENGTH ul`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul) = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `EL 1 ul' = EL 1 ([u; v:real^3])`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_WITH `[u; v:real^3] = truncate_simplex 1 ul'`); + (REWRITE_WITH `truncate_simplex 1 ul' =[u;v:real^3] /\ 1 + 1 <= LENGTH ul'`); + (REWRITE_TAC[Packing3.TRUNCATE_SIMPLEX_INITIAL_SUBLIST]); + (ASM_REWRITE_TAC[LENGTH] THEN ARITH_TAC); + (MATCH_MP_TAC Packing3.EL_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul':(real^3)list) = 3 + 1 /\ + CARD (set_of_list ul') = 3 + 1`); + (MATCH_MP_TAC Rogers.BARV_IMP_LENGTH_EQ_CARD); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `?y0 y1 y2 y3. ul = [y0;y1;y2;y3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (NEW_GOAL `?z0 z1 z2 z3. ul' = [z0;z1;z2;z3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (UNDISCH_TAC `EL 1 ul = EL 1 [v; u:real^3]` THEN + UNDISCH_TAC `HD ul = HD [v; u:real^3]` THEN + UNDISCH_TAC `EL 1 ul' = EL 1 [u; v:real^3]` THEN + UNDISCH_TAC `HD ul' = HD [u; v:real^3]` THEN + ASM_REWRITE_TAC[EL;HD;TL; ARITH_RULE `3 = SUC 2 /\2 = SUC 1 /\ 1 = SUC 0`]); + (REPEAT STRIP_TAC); + (ASM_SET_TAC[]); + + (NEW_GOAL `~(z2 IN {u,v:real^3})`); + (STRIP_TAC); + (NEW_GOAL `CARD (set_of_list (ul':(real^3)list)) <= 3`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `{u, v, z2, z3} = {v,u, z3:real^3}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN REWRITE_WITH`CARD (set_of_list (ul':(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `~(z3 IN {u,v:real^3})`); + (STRIP_TAC); + (NEW_GOAL `CARD (set_of_list (ul':(real^3)list)) <= 3`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `{u, v, z2, z3} = {v,u, z2:real^3}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN REWRITE_WITH`CARD (set_of_list (ul':(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + + (NEW_GOAL `~(y2 IN {u,v:real^3})`); + (STRIP_TAC); + (NEW_GOAL `CARD (set_of_list (ul:(real^3)list)) <= 3`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `{v, u, y2, y3} = {v,u, y3:real^3}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN REWRITE_WITH`CARD (set_of_list (ul:(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `~(y3 IN {u,v:real^3})`); + (STRIP_TAC); + (NEW_GOAL `CARD (set_of_list (ul:(real^3)list)) <= 3`); + (ASM_REWRITE_TAC[set_of_list]); + (REWRITE_WITH `{v, u, y2, y3} = {v,u, y2:real^3}`); + (ASM_SET_TAC[]); + (REWRITE_TAC[Geomdetail.CARD3]); + (UP_ASM_TAC THEN REWRITE_WITH`CARD (set_of_list (ul:(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + + (NEW_GOAL `set_of_list (truncate_simplex 3 (ul:(real^3)list)) = + set_of_list (truncate_simplex 3 ul')`); + (REWRITE_WITH `set_of_list (truncate_simplex 3 (ul:(real^3)list)) = + V INTER X`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (REWRITE_TAC[ASSUME `X = mcell k V ul`; ASSUME `k = 4`; ARITH_RULE `3 = 4 - 1`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (REWRITE_TAC[ARITH_RULE `1 <= 4 /\ 4 <= 4`]); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k V ul`); GSYM (ASSUME `k = 4`)]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[NEGLIGIBLE_EMPTY]); + (REWRITE_TAC[ASSUME `X = mcell k' V ul'`]); + (REWRITE_WITH `k' = 4`); + (ASM_ARITH_TAC); + (REWRITE_TAC[ARITH_RULE `3 = 4 - 1`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (REWRITE_TAC[ARITH_RULE `1 <= 4 /\ 4 <= 4`]); + (REWRITE_WITH `4 = k'`); + (ASM_ARITH_TAC); + (REWRITE_TAC[GSYM (ASSUME `X = mcell k' V ul'`)]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UNDISCH_TAC `~NULLSET X` THEN MESON_TAC[NEGLIGIBLE_EMPTY]); + (UP_ASM_TAC); + (ASM_REWRITE_TAC[TRUNCATE_SIMPLEX_EXPLICIT_3; set_of_list]); + (ASM_SET_TAC[]); + + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REFL_TAC)]);; + +(* ==================================================================== *) +(* Lemma 49 *) + +let gammaY = new_definition + `!V X f. + gammaY V X f = + (\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * f (hl [u; v]) + else &0)`;; + +let gamma_y_lmfun_bound = prove_by_refinement ( + `!V. packing V /\ saturated V + ==> (?d. !X e. mcell_set V X /\ edgeX V X e ==> gammaY V X lmfun e <= d)`, +[(REPEAT STRIP_TAC); + (EXISTS_TAC `pi * h0 / (h0 - &1)`); + (REPEAT STRIP_TAC); + (ABBREV_TAC `f = (\u v. if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)`); + (REWRITE_WITH `gammaY V X lmfun = (\({u, v}). f u v)`); + (EXPAND_TAC "f" THEN REWRITE_TAC[gammaY]); + + (NEW_GOAL `!u v. (f:real^3->real^3->real) u v = f v u`); + (EXPAND_TAC "f" THEN REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]); + (REPEAT GEN_TAC THEN COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_WITH `dihX V X (u,v) = dihX V X (v,u)`); + (MATCH_MP_TAC DIHX_SYM); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REFL_TAC); + + (UNDISCH_TAC `edgeX V X e` THEN REWRITE_TAC[IN;IN_ELIM_THM; edgeX]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `(\({u, v}). f u v) {u, v} = + (f:real^3->real^3->real) u v`); + (MATCH_MP_TAC BETA_PAIR_THM); + (ASM_REWRITE_TAC[]); + + (EXPAND_TAC "f"); + (COND_CASES_TAC); + + (NEW_GOAL `dihX V X (u,v) * lmfun (hl [u;v]) <= pi * lmfun (hl [u;v])`); + (REWRITE_TAC[REAL_ARITH `a * x <= b * x <=> &0 <= (b - a) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[lmfun_pos_le; REAL_ARITH `&0 <= a - b <=> b <= a`; DIHX_LE_PI]); + + (NEW_GOAL `pi * lmfun (hl [u:real^3;v]) <= pi * h0 / (h0 - &1)`); + (REWRITE_TAC[REAL_ARITH `a * x <= a * y <=> &0 <= (y - x) * a`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[PI_POS_LE; REAL_ARITH `&0 <= a - b <=> b <= a`]); + (MATCH_MP_TAC lmfun_bounded); + (REWRITE_TAC[HL_2; REAL_ARITH `&0 <= inv (&2) * x <=> &0 <= x`; DIST_POS_LE]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[PI_POS_LE]); + (MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[h0] THEN REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 50 *) + +let BETA_SET_2_THM = prove + (`!g:(A->bool)->B u0 v0. (\({u, v}). g {u, v}) {u0, v0} = g {u0, v0}`, + GEN_TAC THEN REWRITE_TAC[GABS_DEF;GEQ_DEF] THEN + CONV_TAC SELECT_CONV THEN EXISTS_TAC `g:(A->bool)->B` THEN + REWRITE_TAC[]);; + +(* ==================================================================== *) +(* Lemma 51 *) +(* Formal proof by John Harrison *) + +let SUM_PAIR_2_SET = prove +(`!f s:real^N->bool d. + FINITE s +==> sum {(m,n) | m IN s /\ n IN s /\ ~(m = n) /\ dist(m,n) <= d} + (\(m,n). f {m, n}) = &2 * + sum {{m, n} | m IN s /\ n IN s /\ ~(m = n) /\ dist(m,n) <= d} f`, +REPEAT STRIP_TAC THEN MP_TAC(ISPECL + [`\(m:real^N,n). {m,n}`;`(\(m,n). f {m,n}):real^N#real^N->real`; + `{(m,n) | m IN s /\ n IN s /\ ~(m:real^N = n) /\ dist(m,n) <= d}`; + `{{m,n} | m IN s /\ n IN s /\ ~(m:real^N = n) /\ dist(m,n) <= d}`] + SUM_GROUP) THEN + ANTS_TAC THENL + [CONJ_TAC THENL + [ONCE_REWRITE_TAC[SET_RULE + `m IN s /\ n IN s /\ P m n <=> + m IN s /\ n IN {n | n IN s /\ P m n}`] THEN + MATCH_MP_TAC FINITE_PRODUCT_DEPENDENT THEN + ASM_SIMP_TAC[FINITE_RESTRICT]; + REWRITE_TAC[SUBSET; FORALL_IN_IMAGE; FORALL_IN_GSPEC] THEN SET_TAC[]]; + DISCH_THEN(SUBST1_TAC o SYM) THEN REWRITE_TAC[GSYM SUM_LMUL] THEN + MATCH_MP_TAC SUM_EQ THEN REWRITE_TAC[FORALL_IN_GSPEC] THEN + MAP_EVERY X_GEN_TAC [`m:real^N`; `n:real^N`] THEN STRIP_TAC THEN + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `sum {(m:real^N,n), (n,m)} (\(m,n). f {m,n})` THEN + CONJ_TAC THENL + [AP_THM_TAC THEN AP_TERM_TAC THEN GEN_REWRITE_TAC I [EXTENSION] THEN + REWRITE_TAC[FORALL_PAIR_THM] THEN + REWRITE_TAC[IN_ELIM_THM; PAIR_EQ; IN_INSERT; NOT_IN_EMPTY; + SET_RULE `{a,b} = {c,d} <=> a = c /\ b = d \/ a = d /\ b = c`] THEN + ASM_MESON_TAC[DIST_SYM]; + SIMP_TAC[SUM_CLAUSES; FINITE_INSERT; FINITE_EMPTY] THEN + ASM_REWRITE_TAC[IN_SING; NOT_IN_EMPTY; PAIR_EQ; REAL_ADD_RID] THEN + REWRITE_TAC[INSERT_AC] THEN REAL_ARITH_TAC]]);; + +(* ==================================================================== *) +(* Lemma 52 *) + +open Flyspeck_constants;; + +let H0_LT_SQRT2 = prove_by_refinement (`h0 < sqrt (&2)`, +[REWRITE_TAC[h0; GSYM sqrt2]; + NEW_GOAL `#1.414213 < sqrt2`; + REWRITE_TAC[bounds]; + ASM_REAL_ARITH_TAC]);; + +(* ==================================================================== *) +(* Lemma 53 *) + +let gamma_y_pos_le = prove_by_refinement ( + `!V X e. packing V /\ saturated V /\ mcell_set V X /\ edgeX V X e + ==> &0 <= gammaY V X lmfun e`, +[(REPEAT STRIP_TAC); + (REWRITE_TAC[gammaY]); + (NEW_GOAL `?u v. (VX V X u /\ VX V X v /\ ~(u = v)) /\ e = {u, v}`); + (UP_ASM_TAC THEN REWRITE_TAC[edgeX; IN_ELIM_THM]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ABBREV_TAC `f = (\u v. if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)`); + (REWRITE_WITH `(\({u, v}). if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0) = (\({u, v}). f u v)`); + (EXPAND_TAC "f" THEN REWRITE_TAC[]); + (REWRITE_WITH `(\({u:real^3, v}). f u v) {u, v} = (f:real^3->real^3->real) u v`); + (MATCH_MP_TAC BETA_PAIR_THM); + (EXPAND_TAC "f" THEN REPEAT STRIP_TAC); + (REPEAT COND_CASES_TAC); + (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]); + (REWRITE_WITH `dihX V X (u',v') = dihX V X (v',u')`); + (MATCH_MP_TAC DIHX_SYM); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`] THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (NEW_GOAL `F`); + (UP_ASM_TAC THEN REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SET_RULE `{a,b} = {b,a}`] THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (REFL_TAC); + (EXPAND_TAC "f"); + (COND_CASES_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[DIHX_POS;lmfun_pos_le]); + (REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 54 *) + +let CARD_LIST_klemma = prove_by_refinement ( + `!s t. FINITE (s:A->bool) /\ FINITE t ==> + CARD {CONS u0 y1 | u0 IN s /\ y1 IN t} = CARD s * CARD t`, +[(REPEAT STRIP_TAC); + (ABBREV_TAC `S = {u0:A, y1:(A)list| u0 IN s /\ y1 IN t}`); + (ABBREV_TAC `f = (\(u0:A, y1:(A)list). CONS u0 y1)`); + (REWRITE_WITH `{CONS u0 y1 | u0 IN s /\ y1 IN t} = + (IMAGE (f:A#(A)list->(A)list) S)`); + (EXPAND_TAC "f" THEN EXPAND_TAC "S" THEN REWRITE_TAC[IMAGE]); + (REWRITE_TAC[SET_RULE `A = B <=> A SUBSET B /\ B SUBSET A`]); + (STRIP_TAC); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `(u0:A,y1:(A)list)`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `u0:A` THEN EXISTS_TAC `y1:(A)list` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `x' = u0:A,y1:(A)list`] THEN STRIP_TAC); + (EXISTS_TAC `u0:A` THEN EXISTS_TAC `y1:(A)list` THEN ASM_REWRITE_TAC[]); + (REWRITE_WITH `CARD (IMAGE (f:A#(A)list->(A)list) S) = CARD S`); + (MATCH_MP_TAC CARD_IMAGE_INJ); + (STRIP_TAC); + (EXPAND_TAC "S" THEN EXPAND_TAC "f" THEN + REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `x = u0:A,y1:(A)list`; + ASSUME `y = u0':A,y1':(A)list`; CONS_11]); + (STRIP_TAC THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "S" THEN MATCH_MP_TAC FINITE_PRODUCT THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "S" THEN MATCH_MP_TAC CARD_PRODUCT THEN ASM_REWRITE_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 55 *) + +let CARD_LIST_klemma_2 = prove_by_refinement ( + `!s t. FINITE (s:A->bool) /\ FINITE t ==> + CARD {[u0;y1] | u0 IN s /\ y1 IN t} = CARD s * CARD t`, +[(REPEAT STRIP_TAC); + (ABBREV_TAC `S = {u0:A, y1:A| u0 IN s /\ y1 IN t}`); + (ABBREV_TAC `f = (\(u0:A, y1:A). [u0; y1])`); + (REWRITE_WITH `{[u0; y1] | u0 IN s /\ y1 IN t} = + (IMAGE (f:A#A->(A)list) S)`); + (EXPAND_TAC "f" THEN EXPAND_TAC "S" THEN REWRITE_TAC[IMAGE]); + (REWRITE_TAC[SET_RULE `A = B <=> A SUBSET B /\ B SUBSET A`]); + (STRIP_TAC); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `(u0:A,y1:A)`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `u0:A` THEN EXISTS_TAC `y1:A` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `x' = u0:A,y1:A`] THEN STRIP_TAC); + (EXISTS_TAC `u0:A` THEN EXISTS_TAC `y1:A` THEN ASM_REWRITE_TAC[]); + (REWRITE_WITH `CARD (IMAGE (f:A#A->(A)list) S) = CARD S`); + (MATCH_MP_TAC CARD_IMAGE_INJ); + (STRIP_TAC); + (EXPAND_TAC "S" THEN EXPAND_TAC "f" THEN + REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[ASSUME `x = u0:A,y1:A`; + ASSUME `y = u0':A,y1':A`]); + (REWRITE_TAC[PAIR_EQ]); + (STRIP_TAC); + (REWRITE_WITH `u0 = HD [u0':A; y1']`); + (UP_ASM_TAC THEN MESON_TAC[HD]); + (REWRITE_TAC[HD]); + (REWRITE_WITH `y1 = HD (TL [u0':A; y1'])`); + (UP_ASM_TAC THEN MESON_TAC[HD; TL]); + (REWRITE_TAC[HD; TL]); + (EXPAND_TAC "S" THEN MATCH_MP_TAC FINITE_PRODUCT THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "S" THEN MATCH_MP_TAC CARD_PRODUCT THEN ASM_REWRITE_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 56 *) + +let FINITE_LIST_klemma = prove ( + `!s t. FINITE (s:A->bool) /\ FINITE t ==> + FINITE {CONS u0 y1 | u0 IN s /\ y1 IN t}`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC FINITE_PRODUCT_DEPENDENT THEN ASM_REWRITE_TAC[]);; + +(* ==================================================================== *) +(* Lemma 57 *) + +let CARD_LIST_4_klemma = prove_by_refinement ( + `!s:A->bool. + FINITE s + ==> CARD + {y | ?u0 u1 u2 u3. + u0 IN s /\ + u1 IN s /\ + u2 IN s /\ + u3 IN s /\ + y = [u0; u1; u2; u3]} = CARD s * CARD s * CARD s * CARD s`, + +[(REPEAT STRIP_TAC); + (REWRITE_TAC[SET_RULE + `{y | ?u0 u1 u2 u3. u0 IN s /\ u1 IN s /\ u2 IN s /\ u3 IN s /\ + y = [u0; u1; u2; u3]} = + {CONS u0 y1 | u0 IN s /\ + y1 IN {CONS u1 y2 | u1 IN s /\ + y2 IN {[u2;u3] | u2 IN s /\ + u3 IN s}}}`]); + (NEW_GOAL `FINITE {[u2:A; u3] | u2 IN s /\ u3 IN s}`); + (MATCH_MP_TAC FINITE_PRODUCT_DEPENDENT THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `FINITE + {CONS u1 y2 | (u1:A) IN s /\ y2 IN {[u2; u3] | u2 IN s /\ u3 IN s}}`); + (MATCH_MP_TAC FINITE_PRODUCT_DEPENDENT THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `FINITE + {CONS u0 y1 | u0 IN s /\ + y1 IN {CONS u1 y2 | u1 IN s /\ + y2 IN {[u2:A; u3] | u2 IN s /\ u3 IN s}}}`); + (MATCH_MP_TAC FINITE_PRODUCT_DEPENDENT THEN ASM_REWRITE_TAC[]); + (REWRITE_WITH `CARD + {CONS u0 y1 | u0 IN s /\ + y1 IN + {CONS u1 y2 | u1 IN s /\ y2 IN {[u2:A; u3] | u2 IN s /\ u3 IN s}}} + = CARD s * + CARD {CONS u1 y2 | u1 IN s /\ y2 IN {[u2; u3] | u2 IN s /\ u3 IN s}}`); + (ASM_SIMP_TAC[CARD_LIST_klemma]); + (REWRITE_WITH + `CARD {CONS u1 y2 | u1 IN s /\ y2 IN {[u2:A; u3] | u2 IN s /\ u3 IN s}} + = CARD s * CARD {[u2; u3] | u2 IN s /\ u3 IN s}`); + (ASM_SIMP_TAC[CARD_LIST_klemma]); + + (REWRITE_WITH `CARD {[u2:A; u3] | u2 IN s /\ u3 IN s} = CARD s * CARD s`); + (ASM_SIMP_TAC[CARD_LIST_klemma_2])]);; + +(* ==================================================================== *) +(* Lemma 58 *) +let BOUNDS_VGEN_klemma = prove_by_refinement( + `!u0 V r. &0 <= r /\ packing V ==> + &(CARD (V INTER ball (u0,r))) <= (r + &1) pow 3`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `sum (V INTER ball (u0,r)) (\x. vol (ball (x:real^3, &1))) + = & (CARD (V INTER ball (u0,r))) * (&4 / &3 * pi)`); + (NEW_GOAL `&0 <= &1`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(\x. vol (ball (x,&1))) = (\x. &4 / &3 * pi)`); + (REWRITE_TAC[FUN_EQ_THM]); + (ASM_SIMP_TAC[VOLUME_BALL] THEN REAL_ARITH_TAC); + (MATCH_MP_TAC SUM_CONST); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (UP_ASM_TAC); + (ABBREV_TAC `f = (\x:real^3. ball (x, &1))`); + (REWRITE_WITH `(\x. vol (ball (x:real^3,&1))) = (\x. vol (f x))`); + (REWRITE_TAC[FUN_EQ_THM] THEN STRIP_TAC); + (EXPAND_TAC "f" THEN REWRITE_TAC[]); + (REWRITE_WITH `sum (V INTER ball (u0:real^3,r)) (\x. vol (f x)) = + vol (UNIONS (IMAGE f (V INTER ball (u0,r))))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC MEASURE_DISJOINT_UNIONS_IMAGE); + (EXPAND_TAC "f" THEN REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (REWRITE_TAC[MEASURABLE_BALL]); + (REWRITE_TAC[DISJOINT; SET_RULE `a = {} <=> ~(?s. s IN a)`]); + (REWRITE_TAC[IN_INTER; IN_BALL]); + (STRIP_TAC); + (UNDISCH_TAC `packing V` THEN REWRITE_TAC[packing]); + (REPEAT STRIP_TAC); + (NEW_GOAL `&2 <= dist (x,y:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (NEW_GOAL `dist (x,y) <= dist (x,s) + dist (y,s:real^3)`); + (NORM_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (STRIP_TAC); + (NEW_GOAL `vol (UNIONS (IMAGE f (V INTER ball (u0:real^3,r)))) + <= vol (ball (u0, r + &1))`); + (MATCH_MP_TAC MEASURE_SUBSET); + (EXPAND_TAC "f" THEN REWRITE_TAC[IMAGE; MEASURABLE_BALL]); + (STRIP_TAC); + (MATCH_MP_TAC MEASURABLE_UNIONS); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[MEASURABLE_BALL]); + (REWRITE_TAC[UNIONS_SUBSET; IN_INTER; IN_BALL; IN_ELIM_THM; SUBSET]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0, x') <= dist (u0,x:real^3) + dist (x, x')`); + (NORM_ARITH_TAC); + (NEW_GOAL `dist (x,x':real^3) < &1`); + (REWRITE_TAC[GSYM IN_BALL] THEN ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `&(CARD (V INTER ball (u0,r))) * &4 / &3 * pi <= + vol (ball (u0,r + &1))`); + (ASM_REAL_ARITH_TAC); + + (UP_ASM_TAC THEN REWRITE_WITH + `vol (ball (u0, r + &1)) = &4 / &3 * pi * (r + &1) pow 3`); + (NEW_GOAL `&0 <= r + &1`); + (ASM_REAL_ARITH_TAC); + (SIMP_TAC[VOLUME_BALL; ASSUME `&0 <= r + &1`]); + + (REWRITE_TAC[REAL_ARITH `a * &4 / &3 * pi <= &4 / &3 * pi * b <=> + &0 <= pi * (b - a)`]); + (STRIP_TAC); + (NEW_GOAL `&0 <= (r + &1) pow 3 - &(CARD (V INTER ball (u0:real^3,r)))`); + (MATCH_MP_TAC Real_ext.REAL_PROP_NN_LCANCEL); + (EXISTS_TAC `pi`); + (ASM_REWRITE_TAC[PI_POS]); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 59 *) + +let BOUNDS_V4_klemma = prove_by_refinement ( + `!u0 V. packing V ==> CARD (V INTER ball (u0, &4)) <= 125`, +[(REPEAT STRIP_TAC); + (NEW_GOAL `sum (V INTER ball (u0,&4)) (\x. vol (ball (x:real^3, &1))) + = & (CARD (V INTER ball (u0,&4))) * (&4 / &3 * pi)`); + (NEW_GOAL `&0 <= &1`); + (REAL_ARITH_TAC); + (REWRITE_WITH `(\x. vol (ball (x,&1))) = (\x. &4 / &3 * pi)`); + (REWRITE_TAC[FUN_EQ_THM]); + (ASM_SIMP_TAC[VOLUME_BALL] THEN REAL_ARITH_TAC); + (MATCH_MP_TAC SUM_CONST); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (UP_ASM_TAC); + (ABBREV_TAC `f = (\x:real^3. ball (x, &1))`); + (REWRITE_WITH `(\x. vol (ball (x:real^3,&1))) = (\x. vol (f x))`); + (REWRITE_TAC[FUN_EQ_THM] THEN STRIP_TAC); + (EXPAND_TAC "f" THEN REWRITE_TAC[]); + (REWRITE_WITH `sum (V INTER ball (u0:real^3,&4)) (\x. vol (f x)) = + vol (UNIONS (IMAGE f (V INTER ball (u0,&4))))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC MEASURE_DISJOINT_UNIONS_IMAGE); + (EXPAND_TAC "f" THEN REWRITE_TAC[] THEN REPEAT STRIP_TAC); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (REWRITE_TAC[MEASURABLE_BALL]); + (REWRITE_TAC[DISJOINT; SET_RULE `a = {} <=> ~(?s. s IN a)`]); + (REWRITE_TAC[IN_INTER; IN_BALL]); + (STRIP_TAC); + (UNDISCH_TAC `packing V` THEN REWRITE_TAC[packing]); + (REPEAT STRIP_TAC); + (NEW_GOAL `&2 <= dist (x,y:real^3)`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_SET_TAC[]); + (NEW_GOAL `dist (x,y) <= dist (x,s) + dist (y,s:real^3)`); + (NORM_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (STRIP_TAC); + (NEW_GOAL `vol (UNIONS (IMAGE f (V INTER ball (u0:real^3,&4)))) + <= vol (ball (u0, &5))`); + (MATCH_MP_TAC MEASURE_SUBSET); + (EXPAND_TAC "f" THEN REWRITE_TAC[IMAGE; MEASURABLE_BALL]); + (STRIP_TAC); + (MATCH_MP_TAC MEASURABLE_UNIONS); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE_EXPAND); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[MEASURABLE_BALL]); + (REWRITE_TAC[UNIONS_SUBSET; IN_INTER; IN_BALL; IN_ELIM_THM; SUBSET]); + (REPEAT STRIP_TAC); + (NEW_GOAL `dist (u0, x') <= dist (u0,x:real^3) + dist (x, x')`); + (NORM_ARITH_TAC); + (NEW_GOAL `dist (x,x':real^3) < &1`); + (REWRITE_TAC[GSYM IN_BALL] THEN ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `&(CARD (V INTER ball (u0,&4))) * &4 / &3 * pi <= + vol (ball (u0,&5))`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN REWRITE_WITH + `vol (ball (u0,&5)) = &4 / &3 * pi * (&5) pow 3`); + (SIMP_TAC[VOLUME_BALL; REAL_ARITH `&0 <= &5`]); + + (REWRITE_TAC[REAL_ARITH `a * &4 / &3 * pi <= &4 / &3 * pi * b <=> + &0 <= pi * (b - a)`]); + (STRIP_TAC); + (NEW_GOAL `&0 <= &5 pow 3 - &(CARD (V INTER ball (u0:real^3,&4)))`); + (MATCH_MP_TAC Real_ext.REAL_PROP_NN_LCANCEL); + (EXISTS_TAC `pi`); + (ASM_REWRITE_TAC[PI_POS]); + (REWRITE_TAC[GSYM REAL_OF_NUM_LE]); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 60 *) + +let CARD_MCELL_CONTAINS_POINT_klemma = prove_by_refinement ( + `?c. (!V u0. saturated V /\ packing V /\ u0 IN V + ==> CARD {X | mcell_set V X /\ VX V X u0} <= c)`, +[(EXISTS_TAC `1220703125`); + (REPEAT STRIP_TAC); + (ABBREV_TAC `S = {ul,i | barV V 3 ul /\ i IN 0..4 /\ + u0 IN set_of_list ul}`); + (NEW_GOAL `FINITE (S:(real^3)list#num->bool)`); + (REWRITE_WITH `S = {ul,i | ul IN {ul | barV V 3 ul /\ + u0 IN set_of_list ul} /\ i IN 0..4}`); + (EXPAND_TAC "S"); + (SET_TAC[]); + (MATCH_MP_TAC FINITE_PRODUCT); + (REWRITE_TAC[FINITE_NUMSEG]); + (MATCH_MP_TAC FINITE_SUBSET); + + (ABBREV_TAC `T1 = V INTER ball (u0:real^3, &4)`); + (NEW_GOAL `FINITE (T1:real^3->bool)`); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `{ul | ?v0 v1 v2 v3. + v0 IN T1 /\ v1 IN T1 /\ v2 IN T1 /\ v3 IN T1 /\ + ul = [v0;v1;v2;v3:real^3]}`); + (STRIP_TAC); + (MATCH_MP_TAC Ajripqn.FINITE_SET_LIST_LEMMA THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?v0 v1 v2 v3. x = [v0:real^3; v1; v2; v3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC THEN EXISTS_TAC `v0:real^3` THEN EXISTS_TAC + `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list (x:(real^3)list) SUBSET T1`); + (EXPAND_TAC "T1" THEN REWRITE_TAC[SUBSET_INTER]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:(real^3->bool)`); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `set_of_list (x:(real^3)list) u0` THEN ASM_REWRITE_TAC[IN]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + + (ABBREV_TAC `f = (\(ul,i). mcell i V ul)`); + (NEW_GOAL `{X | mcell_set V X /\ VX V X u0} SUBSET + (IMAGE (f:(real^3)list#num->real^3->bool) S) `); + (EXPAND_TAC "S" THEN EXPAND_TAC "f" THEN REWRITE_TAC[IMAGE]); + (REWRITE_TAC[mcell_set_2; SUBSET; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `ul:(real^3)list,i:num`); + (REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (REWRITE_TAC[MESON[IN] `(0..4) i <=> i IN 0..4`]); + (ASM_REWRITE_TAC[IN_NUMSEG_0]); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) i <=> i IN A`]); + (ASM_REWRITE_TAC[IN_NUMSEG_0]); + (NEW_GOAL `(u0:real^3) IN V INTER x`); + (REWRITE_WITH `V INTER x = VX V x`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[VX]); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) i <=> i IN A`]); + (SET_TAC[]); + (ASM_REWRITE_TAC[IN]); + (UP_ASM_TAC THEN REWRITE_WITH + `V INTER (x:real^3->bool) = set_of_list (truncate_simplex (i - 1) ul)`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `VX V x = V INTER x`); + + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[VX]); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) i <=> i IN A`]); + (SET_TAC[]); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `i = 0`); + (NEW_GOAL `F`); + (UNDISCH_TAC `VX V x u0` THEN ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC [Lepjbdj.LEPJBDJ_0]); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) i <=> i IN A`]); + (SET_TAC[]); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + (UNDISCH_TAC `VX V x u0` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) i <=> i IN A`]); + (SET_TAC[]); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) i <=> i IN A`]); + (MATCH_MP_TAC (SET_RULE `A SUBSET B ==> (u0 IN A ==> u0 IN B)`)); + (MATCH_MP_TAC Rogers.SET_OF_LIST_TRUNCATE_SIMPLEX_SUBSET); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC); + (MATCH_MP_TAC (ARITH_RULE `(?b. a:num <= b /\ b <= c) ==> a <= c`)); + (EXISTS_TAC `CARD (IMAGE (f:(real^3)list#num->real^3->bool) S)`); + (STRIP_TAC); + (MATCH_MP_TAC CARD_SUBSET); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_IMAGE); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC (ARITH_RULE `(?b. a:num <= b /\ b <= c) ==> a <= c`)); + (EXISTS_TAC `CARD (S:(real^3)list#num->bool)`); + (STRIP_TAC); + (MATCH_MP_TAC CARD_IMAGE_LE); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `S = {ul,i |ul IN {ul | barV V 3 ul /\ u0 IN set_of_list ul}/\ i IN 0..4}`); + (EXPAND_TAC "S" THEN SET_TAC[]); + (REWRITE_WITH + `CARD {ul,i |ul IN {ul | barV V 3 ul /\ u0 IN set_of_list ul}/\ i IN 0..4} = + CARD {ul | barV V 3 ul /\ u0 IN set_of_list ul} * CARD (0..4)`); + (MATCH_MP_TAC CARD_PRODUCT); + (REWRITE_TAC[FINITE_NUMSEG]); + (MATCH_MP_TAC FINITE_SUBSET); + + (ABBREV_TAC `T1 = V INTER ball (u0:real^3, &4)`); + (NEW_GOAL `FINITE (T1:real^3->bool)`); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `{ul | ?v0 v1 v2 v3. + v0 IN T1 /\ v1 IN T1 /\ v2 IN T1 /\ v3 IN T1 /\ + ul = [v0;v1;v2;v3:real^3]}`); + (STRIP_TAC); + (MATCH_MP_TAC Ajripqn.FINITE_SET_LIST_LEMMA THEN ASM_REWRITE_TAC[]); + + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?v0 v1 v2 v3. x = [v0:real^3; v1; v2; v3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC THEN EXISTS_TAC `v0:real^3` THEN EXISTS_TAC + `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list (x:(real^3)list) SUBSET T1`); + (EXPAND_TAC "T1" THEN REWRITE_TAC[SUBSET_INTER]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:(real^3->bool)`); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `set_of_list (x:(real^3)list) u0` THEN ASM_REWRITE_TAC[IN]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + + (REWRITE_TAC[CARD_NUMSEG; ARITH_RULE `(4 + 1) - 0 = 5`]); + (REWRITE_TAC[ARITH_RULE `a * 5 <= 1220703125 <=> a <= 244140625`]); + + (ABBREV_TAC `T1 = V INTER ball (u0:real^3, &4)`); + (NEW_GOAL `FINITE (T1:real^3->bool)`); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `{ul | barV V 3 ul /\ u0 IN set_of_list ul} SUBSET + {ul | ?v0 v1 v2 v3. + v0 IN T1 /\ v1 IN T1 /\ v2 IN T1 /\ v3 IN T1 /\ + ul = [v0;v1;v2;v3]}`); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?v0 v1 v2 v3. x = [v0:real^3; v1; v2; v3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC THEN EXISTS_TAC `v0:real^3` THEN EXISTS_TAC + `v1:real^3` THEN EXISTS_TAC `v2:real^3` THEN EXISTS_TAC `v3:real^3`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `set_of_list (x:(real^3)list) SUBSET T1`); + (EXPAND_TAC "T1" THEN REWRITE_TAC[SUBSET_INTER]); + (STRIP_TAC); + (MATCH_MP_TAC Packing3.BARV_SUBSET); + (EXISTS_TAC `3` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:(real^3->bool)`); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `set_of_list (x:(real^3)list) u0` THEN ASM_REWRITE_TAC[IN]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN SET_TAC[]); + + (MATCH_MP_TAC (ARITH_RULE `(?x. a <= x /\ x <= b:num) ==> a <= b`)); + (EXISTS_TAC `CARD {ul | ?v0 v1 v2 v3. + v0 IN T1 /\ + v1 IN T1 /\ + v2 IN T1 /\ + v3 IN T1 /\ + ul = [v0:real^3; v1; v2; v3]}`); + (STRIP_TAC); + (MATCH_MP_TAC CARD_SUBSET); + (ASM_REWRITE_TAC[] THEN MATCH_MP_TAC FINITE_SET_LIST_LEMMA); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH `CARD + {y | ?u0 u1 u2 u3. + u0 IN T1 /\ + u1 IN T1 /\ + u2 IN T1 /\ + u3 IN T1 /\ + y = [u0:real^3; u1; u2; u3:real^3]} = + CARD T1 * CARD T1 * CARD T1 * CARD T1`); + (ASM_SIMP_TAC [CARD_LIST_4_klemma]); + (NEW_GOAL `CARD (T1:real^3->bool) <= 125`); + (EXPAND_TAC "T1"); + (MATCH_MP_TAC BOUNDS_V4_klemma); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD (T1:real^3->bool) * CARD T1 <= 125 * 125`); + (MATCH_MP_TAC LE_MULT2); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD (T1:real^3->bool) * CARD T1 * CARD T1 <= 125 * 125 * 125`); + (MATCH_MP_TAC LE_MULT2); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `CARD (T1:real^3->bool) * CARD T1 * CARD T1 * CARD T1 <= + 125 * 125 * 125 * 125`); + (MATCH_MP_TAC LE_MULT2); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 61 *) + +(* deprecated by thales Jan 1, 2013. Replaced with version in bump.hl. *) + +(* + +let BOUND_BETA_BUMP_DEPRECATED = prove_by_refinement ( + `?c. !V X e. + saturated V /\ packing V /\ mcell_set V X /\ critical_edgeX V X e + ==> beta_bump V e X <= c`, +[(EXISTS_TAC `&614400`); + (REWRITE_TAC[mcell_set_2; IN_ELIM_THM; IN; beta_bump]); + (REPEAT STRIP_TAC THEN LET_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[cell_params]); + + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (STRIP_TAC); + (ABBREV_TAC `P = (\(k,ul'). k <= 4 /\ ul' IN barV V 3 /\ + mcell i V ul = mcell k V ul')`); + (NEW_GOAL `(P:(num#(real^3)list->bool)) (k,ul')`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SELECT_AX); + (EXISTS_TAC `(i:num,ul:(real^3)list)`); + (EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM]); + (ASM_REWRITE_TAC[IN]); + (UP_ASM_TAC THEN EXPAND_TAC "P"); + (REWRITE_TAC[BETA_THM; IN] THEN STRIP_TAC); + + (ABBREV_TAC `S = {e',e'',p,vl | 4 = k /\ + {e', e''} = critical_edgeX V X /\ + e' = e /\ + p permutes 0..3 /\ + left_action_list p ul' = vl /\ + {EL 0 vl, EL 1 vl} = e' /\ + {EL 2 vl, EL 3 vl} = e''}`); + + (NEW_GOAL `?u0 u1 u2 u3. ul = [u0;u1;u2;u3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ABBREV_TAC `K1 = {us:real^3->bool | us SUBSET set_of_list ul}`); + (NEW_GOAL `FINITE (K1:(real^3->bool)->bool)`); + (EXPAND_TAC "K1" THEN MATCH_MP_TAC FINITE_POWERSET); + (ASM_REWRITE_TAC[set_of_list; Geomdetail.FINITE6]); + + (NEW_GOAL `critical_edgeX V X SUBSET K1`); + (EXPAND_TAC "K1" THEN + REWRITE_TAC[critical_edgeX; edgeX; SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `(x:real^3->bool) SUBSET set_of_list ul`); + (REWRITE_TAC[ASSUME `x = {u, v:real^3}`; ASSUME `{u, v} = {u', v':real^3}`]); + (NEW_GOAL `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (NEW_GOAL `VX V X = {}`); + (ASM_REWRITE_TAC[VX]); + (UNDISCH_TAC `VX V X u'` THEN + ASM_REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`] THEN SET_TAC[]); + (NEW_GOAL + `V INTER (X:real^3->bool) = set_of_list (truncate_simplex (i - 1) ul)`); + (REWRITE_TAC[ASSUME `X = mcell i V ul`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_CASES_TAC `i = 0`); + (NEW_GOAL `F`); + (NEW_GOAL `VX V X = {}`); + (REWRITE_TAC[ASSUME `VX V X = V INTER X`; ASSUME `X = mcell i V ul`; + ASSUME `i = 0`]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `VX V X u'` THEN REWRITE_TAC[ASSUME `VX V X = {}`; + MESON[IN] `{} x <=> x IN {}`] THEN SET_TAC[]); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + (REWRITE_TAC[GSYM (ASSUME `mcell i V ul = mcell k V ul'`); + GSYM (ASSUME `X = mcell i V ul`)]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (REWRITE_TAC[NEGLIGIBLE_EMPTY; ASSUME `X = {}:real^3->bool`]); + (NEW_GOAL `VX V X = {}`); + (REWRITE_TAC[VX; ASSUME `NULLSET X`]); + (UNDISCH_TAC `VX V X u'` THEN REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`; + ASSUME `VX V X = {}`] THEN SET_TAC[]); + (NEW_GOAL `set_of_list (truncate_simplex (i - 1) ul) SUBSET + set_of_list (ul:(real^3)list)`); + (MATCH_MP_TAC Rogers.SET_OF_LIST_TRUNCATE_SIMPLEX_SUBSET); + (ASM_REWRITE_TAC[LENGTH] THEN ASM_ARITH_TAC); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + + (NEW_GOAL + `FINITE + (S:(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list->bool)`); + (EXPAND_TAC "S"); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{e',e'',p,vl | {e', e''} = critical_edgeX V X /\ + p permutes 0..3 /\ + left_action_list p ul' = vl:(real^3)list}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{e',e'',p,vl | (e':real^3->bool) IN K1 /\ e'' IN K1 /\ + p permutes 0..3 /\ + left_action_list p ul' = vl:(real^3)list}`); + (STRIP_TAC); + (ABBREV_TAC `S_temp = {e',e'',p | (e':real^3->bool) IN K1 /\ e'' IN K1 /\ + p permutes 0..3}`); + (ABBREV_TAC + `f_temp = (\(e':real^3->bool,e'':real^3->bool,p). + e',e'',p, (left_action_list p (ul':(real^3)list)))`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `IMAGE (f_temp:(real^3->bool)#(real^3->bool)#(num->num)->(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list) S_temp`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE); + + (REWRITE_WITH `S_temp = {e':real^3->bool,u | e' IN K1 /\ + u IN {e'', p | e'' IN K1 /\p permutes 0..3}}`); + (EXPAND_TAC "S_temp"); + (SET_TAC[]); + (ABBREV_TAC `K2 = {e'':real^3->bool, p | e'' IN K1 /\p permutes 0..3}`); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `K2 = {e'':real^3->bool,p | e'' IN K1 /\ p IN {p | p permutes 0..3}}`); + (EXPAND_TAC "K2" THEN SET_TAC[]); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM NUMSEG_LE; ARITH_RULE `a <= 3 <=> a < 4`; + Marchal_cells_2_new.SET_OF_0_TO_3; + Upfzbzm_support_lemmas.FINITE_PERMUTE_4]); + (EXPAND_TAC "f_temp" THEN EXPAND_TAC "S_temp" THEN REWRITE_TAC[IMAGE]); + (REWRITE_TAC[IN; SUBSET; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `e':real^3->bool,e'':real^3->bool,p:num->num`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `e':real^3->bool` THEN + EXISTS_TAC `e'':real^3->bool` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (SET_TAC[]); + + +(* ------------------------------------------------------------------------ *) +(* Finish proving S is FINITE *) +(* ------------------------------------------------------------------------ *) + + (MATCH_MP_TAC (REAL_ARITH `(?x. a <= x /\ x <= b) ==> a <= b`)); + (EXISTS_TAC + `sum (S:(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list->bool) + (\x. &100)`); + (STRIP_TAC); + (MATCH_MP_TAC SUM_LE); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "S" THEN REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `4 = k`); REAL_ARITH `a / &4 <= &100 <=> a <= &400`]); + (REWRITE_TAC[bump]); + (REWRITE_TAC[REAL_ARITH + `#0.005 * (&1 - a) - #0.005 * (&1 - b) <= &400 <=> + b - a <= &80000`]); + (MATCH_MP_TAC (REAL_ARITH `(&0 <= a /\ b <= c ==> b - a <= c)`)); + (STRIP_TAC); + (MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[Real_ext.REAL_LE_POW_2]); + (REWRITE_TAC[hplus; h0; REAL_ARITH + `a / (#1.3254 - #1.26) pow 2 <= &80000 <=> a <= #342.1728`]); + (NEW_GOAL `barV V 3 vl`); + (MATCH_MP_TAC Qzksykg.QZKSYKG1); + (EXISTS_TAC `ul':(real^3)list`); + (EXISTS_TAC `4` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[ARITH_RULE `4 - 1 = 3`]); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `mcell i V ul = mcell k V ul'`); + GSYM (ASSUME `X = mcell i V ul`)]); + (STRIP_TAC); + (NEW_GOAL `critical_edgeX V X = {}`); + (REWRITE_TAC[critical_edgeX ; edgeX; IN; IN_ELIM_THM; + SET_RULE `X = {} <=> ~(?s. s IN X)`]); + (STRIP_TAC); + (NEW_GOAL `NULLSET X`); + (ASM_MESON_TAC[NEGLIGIBLE_EMPTY]); + (UNDISCH_TAC `VX V X v'` THEN REWRITE_TAC[VX; ASSUME `NULLSET X`]); + (REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`] THEN SET_TAC[]); + (UNDISCH_TAC `critical_edgeX V X e`); + (REWRITE_TAC[ASSUME `critical_edgeX V X = {}`; MESON[IN] `{} x <=> x IN {}`] + THEN SET_TAC[]); + + + (NEW_GOAL `?v0 v1 v2 v3. vl = [v0;v1;v2;v3:real^3]`); + (MATCH_MP_TAC BARV_3_EXPLICIT); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[EL; ARITH_RULE `3 = SUC 2 /\ 2 = SUC 1 /\ 1 = SUC 0`; HD; TL]); + (REWRITE_TAC[ARITH_RULE `SUC (SUC 0) = 2`]); + (NEW_GOAL `(hl [v2; v3:real^3] - #1.26) pow 2 <= (&10) pow 2`); + (REWRITE_TAC[GSYM REAL_LE_SQUARE_ABS; REAL_ARITH `abs (&10) = &10`]); + (ASM_CASES_TAC `&0 <= hl [v2; v3:real^3] - #1.26`); + (REWRITE_WITH `abs (hl [v2; v3:real^3] - #1.26) = hl [v2; v3] - #1.26`); + (ASM_REAL_ARITH_TAC); + + (REWRITE_TAC[HL_2; + REAL_ARITH `inv (&2) * a - #1.26 <= &10 <=> a <= #22.52`]); + (NEW_GOAL `set_of_list vl SUBSET ball (v2:real^3,&4)`); + (MATCH_MP_TAC Qzyzmjc.BARV_3_IMP_FINITE_lemma2); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[set_of_list]); + (SET_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[set_of_list] THEN STRIP_TAC); + (SUBGOAL_THEN `v3:real^3 IN ball (v2, &k)` MP_TAC); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[IN_BALL; GSYM (ASSUME `4 = k`)]); + (REAL_ARITH_TAC); + (REWRITE_WITH `abs (hl [v2; v3] - #1.26) = #1.26 - hl [v2; v3:real^3]`); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a ==> #1.26 - a <= &10`)); + (REWRITE_TAC[HL_2] THEN NORM_ARITH_TAC); + (UP_ASM_TAC THEN REAL_ARITH_TAC); + (ASM_SIMP_TAC[SUM_CONST]); + + + (EXPAND_TAC "S"); + (MATCH_MP_TAC (REAL_ARITH `(?s. x <= s /\ s <= b) ==> x <= b`)); + (EXISTS_TAC `& (CARD {e',e'',p,vl | {e', e''} = critical_edgeX V X /\ + p permutes 0..3 /\ + left_action_list p ul' = vl:(real^3)list}) * &100 `); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a * &100 <= b * &100 <=> a <= b`]); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (STRIP_TAC); + (SET_TAC[]); + (MATCH_MP_TAC FINITE_SUBSET); + +(*****) + (EXISTS_TAC `{e',e'',p,vl | (e':real^3->bool) IN K1 /\ e'' IN K1 /\ + p permutes 0..3 /\ + left_action_list p ul' = vl:(real^3)list}`); + (STRIP_TAC); + (ABBREV_TAC `S_temp = {e',e'',p | (e':real^3->bool) IN K1 /\ e'' IN K1 /\ + p permutes 0..3}`); + (ABBREV_TAC + `f_temp = (\(e':real^3->bool,e'':real^3->bool,p). + e',e'',p, (left_action_list p (ul':(real^3)list)))`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `IMAGE (f_temp:(real^3->bool)#(real^3->bool)#(num->num)->(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list) S_temp`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE); + + (REWRITE_WITH `S_temp = {e':real^3->bool,u | e' IN K1 /\ + u IN {e'', p | e'' IN K1 /\p permutes 0..3}}`); + (EXPAND_TAC "S_temp"); + (SET_TAC[]); + (ABBREV_TAC `K2 = {e'':real^3->bool, p | e'' IN K1 /\p permutes 0..3}`); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `K2 = {e'':real^3->bool,p | e'' IN K1 /\ p IN {p | p permutes 0..3}}`); + (EXPAND_TAC "K2" THEN SET_TAC[]); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM NUMSEG_LE; ARITH_RULE `a <= 3 <=> a < 4`; + Marchal_cells_2_new.SET_OF_0_TO_3; + Upfzbzm_support_lemmas.FINITE_PERMUTE_4]); + (EXPAND_TAC "f_temp" THEN EXPAND_TAC "S_temp" THEN REWRITE_TAC[IMAGE]); + (REWRITE_TAC[IN; SUBSET; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `e':real^3->bool,e'':real^3->bool,p:num->num`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `e':real^3->bool` THEN + EXISTS_TAC `e'':real^3->bool` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + (SWITCH_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + + (MATCH_MP_TAC (REAL_ARITH `(?s. x <= s /\ s <= b) ==> x <= b`)); + (EXISTS_TAC `& (CARD {e',e'',p,vl | (e':real^3->bool) IN K1 /\ e'' IN K1 /\ + p permutes 0..3 /\ + left_action_list p ul' = vl:(real^3)list}) * &100 `); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a * &100 <= b * &100 <=> a <= b`]); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (STRIP_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + +(* **** *) + (ABBREV_TAC `S_temp = {e',e'',p | (e':real^3->bool) IN K1 /\ e'' IN K1 /\ + p permutes 0..3}`); + (ABBREV_TAC + `f_temp = (\(e':real^3->bool,e'':real^3->bool,p). + e',e'',p, (left_action_list p (ul':(real^3)list)))`); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `IMAGE (f_temp:(real^3->bool)#(real^3->bool)#(num->num)->(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list) S_temp`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE); + + (REWRITE_WITH `S_temp = {e':real^3->bool,u | e' IN K1 /\ + u IN {e'', p | e'' IN K1 /\p permutes 0..3}}`); + (EXPAND_TAC "S_temp"); + (SET_TAC[]); + (ABBREV_TAC `K2 = {e'':real^3->bool, p | e'' IN K1 /\p permutes 0..3}`); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `K2 = {e'':real^3->bool,p | e'' IN K1 /\ p IN {p | p permutes 0..3}}`); + (EXPAND_TAC "K2" THEN SET_TAC[]); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM NUMSEG_LE; ARITH_RULE `a <= 3 <=> a < 4`; + Marchal_cells_2_new.SET_OF_0_TO_3; + Upfzbzm_support_lemmas.FINITE_PERMUTE_4]); + (EXPAND_TAC "f_temp" THEN EXPAND_TAC "S_temp" THEN REWRITE_TAC[IMAGE]); + (REWRITE_TAC[IN; SUBSET; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `e':real^3->bool,e'':real^3->bool,p:num->num`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `e':real^3->bool` THEN + EXISTS_TAC `e'':real^3->bool` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + + + (MATCH_MP_TAC (REAL_ARITH `(?s. x <= s /\ s <= b) ==> x <= b`)); + (ABBREV_TAC `S_temp = {e',e'',p | (e':real^3->bool) IN K1 /\ e'' IN K1 /\ + p permutes 0..3}`); + (ABBREV_TAC + `f_temp = (\(e':real^3->bool,e'':real^3->bool,p). + e',e'',p, (left_action_list p (ul':(real^3)list)))`); + (EXISTS_TAC `& (CARD (IMAGE (f_temp:(real^3->bool)#(real^3->bool)#(num->num)->(real^3->bool)#(real^3->bool)#(num->num)#(real^3)list) S_temp)) * &100`); + + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a * &100 <= b * &100 <=> a <= b`]); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (STRIP_TAC); + (EXPAND_TAC "f_temp" THEN EXPAND_TAC "S_temp" THEN REWRITE_TAC[IMAGE]); + (REWRITE_TAC[IN; SUBSET; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `e':real^3->bool,e'':real^3->bool,p:num->num`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `e':real^3->bool` THEN + EXISTS_TAC `e'':real^3->bool` THEN EXISTS_TAC `p:num->num`); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC FINITE_IMAGE); + (REWRITE_WITH `S_temp = {e':real^3->bool,u | e' IN K1 /\ + u IN {e'', p | e'' IN K1 /\p permutes 0..3}}`); + (EXPAND_TAC "S_temp"); + (SET_TAC[]); + (ABBREV_TAC `K2 = {e'':real^3->bool, p | e'' IN K1 /\p permutes 0..3}`); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `K2 = {e'':real^3->bool,p | e'' IN K1 /\ p IN {p | p permutes 0..3}}`); + (EXPAND_TAC "K2" THEN SET_TAC[]); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM NUMSEG_LE; ARITH_RULE `a <= 3 <=> a < 4`; + Marchal_cells_2_new.SET_OF_0_TO_3; + Upfzbzm_support_lemmas.FINITE_PERMUTE_4]); + + (MATCH_MP_TAC (REAL_ARITH `(?s. x <= s /\ s <= b) ==> x <= b`)); + (EXISTS_TAC + `& (CARD (S_temp:(real^3->bool)#(real^3->bool)#(num->num)->bool)) * &100`); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `a * &100 <= b * &100 <=> a <= b`]); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_IMAGE_LE); + (REWRITE_WITH `S_temp = {e':real^3->bool,u | e' IN K1 /\ + u IN {e'', p | e'' IN K1 /\p permutes 0..3}}`); + (EXPAND_TAC "S_temp"); + (SET_TAC[]); + (ABBREV_TAC `K2 = {e'':real^3->bool, p | e'' IN K1 /\p permutes 0..3}`); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `K2 = {e'':real^3->bool,p | e'' IN K1 /\ p IN {p | p permutes 0..3}}`); + (EXPAND_TAC "K2" THEN SET_TAC[]); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM NUMSEG_LE; ARITH_RULE `a <= 3 <=> a < 4`; + Marchal_cells_2_new.SET_OF_0_TO_3; + Upfzbzm_support_lemmas.FINITE_PERMUTE_4]); + + (REWRITE_WITH `S_temp = {e':real^3->bool,u | e' IN K1 /\ + u IN {e'', p | e'' IN K1 /\p permutes 0..3}}`); + (EXPAND_TAC "S_temp"); + (SET_TAC[]); + (ABBREV_TAC `K2 = {e'':real^3->bool, p | e'' IN K1 /\p permutes 0..3}`); + (REWRITE_WITH `CARD {e':real^3->bool,u:(real^3->bool)#(num->num) | + e' IN K1 /\ u IN K2} = CARD K1 * CARD K2`); + (MATCH_MP_TAC CARD_PRODUCT); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + `K2 = {e'':real^3->bool,p | e'' IN K1 /\ p IN {p | p permutes 0..3}}`); + (EXPAND_TAC "K2" THEN SET_TAC[]); + (MATCH_MP_TAC FINITE_PRODUCT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM NUMSEG_LE; ARITH_RULE `a <= 3 <=> a < 4`; + Marchal_cells_2_new.SET_OF_0_TO_3; + Upfzbzm_support_lemmas.FINITE_PERMUTE_4]); + + (REWRITE_WITH `CARD (K2:(real^3->bool)#(num->num)->bool) = + CARD (K1:(real^3->bool)->bool) * CARD {p | p permutes 0..3}`); + (REWRITE_WITH + `K2 = {e'':real^3->bool,p | e'' IN K1 /\ p IN {p | p permutes 0..3}}`); + (EXPAND_TAC "K2" THEN SET_TAC[]); + (MATCH_MP_TAC CARD_PRODUCT); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM NUMSEG_LE; ARITH_RULE `a <= 3 <=> a < 4`; + Marchal_cells_2_new.SET_OF_0_TO_3; + Upfzbzm_support_lemmas.FINITE_PERMUTE_4]); + (REWRITE_WITH `CARD (K1:(real^3->bool)->bool) = 16`); + + (REWRITE_WITH `16 = 2 EXP (CARD (set_of_list (ul:(real^3)list)))`); + (REWRITE_WITH `CARD (set_of_list (ul:(real^3)list)) = 3 + 1`); + (MATCH_MP_TAC BARV_CARD_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ARITH_TAC); + (EXPAND_TAC "K1"); + (MATCH_MP_TAC CARD_POWERSET); + (ASM_REWRITE_TAC[set_of_list; Geomdetail.FINITE6]); + (REWRITE_WITH `CARD {p | p permutes 0..3} = FACT (CARD (0..3))`); + (MATCH_MP_TAC CARD_PERMUTATIONS); + (REWRITE_TAC[FINITE_NUMSEG]); + (REWRITE_TAC[CARD_NUMSEG; ARITH_RULE `16 * 16 * FACT ((3 + 1) - 0) = 6144`]); + + (REAL_ARITH_TAC)]);; + +*) + +(* ==================================================================== *) +(* Lemma 62 *) + +let MCELL_SUBSET_BALL8_2 = prove ( + `!V X v. packing V /\ saturated V /\ mcell_set V X /\ v IN X + ==> X SUBSET ball (v,&8)`, + REWRITE_TAC[mcell_set; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + UP_ASM_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + MATCH_MP_TAC MCELL_SUBSET_BALL8 THEN ASM_REWRITE_TAC[] THEN ASM_SET_TAC[]);; + +(* ==================================================================== *) +(* Lemma 63 *) +let critical_edge_subset_mcell = prove_by_refinement ( + `!V X x. packing V /\ saturated V /\ mcell_set V X /\ critical_edgeX V X x + ==> x SUBSET X`, +[(REWRITE_TAC[mcell_set_2; critical_edgeX; edgeX; IN_ELIM_THM; IN]); + (REPEAT STRIP_TAC); + (NEW_GOAL `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC THEN UNDISCH_TAC `VX V X u'` THEN + ASM_REWRITE_TAC[VX; MESON[IN] `{} u <=> u IN {}`] THEN SET_TAC[]); + (ASM_SET_TAC[])]);; + +(* ==================================================================== *) +(* Lemma 64 *) + +let EDGEX_SUBSET_MCELL = prove_by_refinement ( + `!V X e. packing V /\ saturated V /\ mcell_set V X /\ edgeX V X e + ==> e SUBSET X`, +[(REWRITE_TAC[edgeX; IN; IN_ELIM_THM; mcell_set] THEN REPEAT STRIP_TAC); + (NEW_GOAL `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num` THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC THEN UNDISCH_TAC `VX V X u` THEN + ASM_REWRITE_TAC[VX; MESON[IN] `{} x <=> x IN {}`] THEN SET_TAC[]); + (ASM_SET_TAC[])]);; + +let CRITICAL_EDGEX_SUBSET_MCELL = prove ( + `!V X e. packing V /\ saturated V /\ mcell_set V X /\ critical_edgeX V X e + ==> e SUBSET X`, + (REPEAT STRIP_TAC) THEN + (MATCH_MP_TAC EDGEX_SUBSET_MCELL) THEN + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]) THEN + (UP_ASM_TAC THEN REWRITE_TAC[critical_edgeX] THEN SET_TAC[]));; + +(* ==================================================================== *) +(* Lemma 65 *) + +let FINITE_VX = prove_by_refinement ( + `!V X. packing V /\ saturated V /\ mcell_set V X ==> FINITE (VX V X)`, +[(REWRITE_TAC[mcell_set_2; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_CASES_TAC `VX V X = {}`); + (ASM_REWRITE_TAC[FINITE_EMPTY]); + (REWRITE_WITH `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num` THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC THEN UNDISCH_TAC `~(VX V X = {})` THEN + ASM_REWRITE_TAC[VX]); + (ASM_CASES_TAC `V INTER (X:real^3->bool) = {}`); + (ASM_REWRITE_TAC[FINITE_EMPTY]); + (REWRITE_WITH + `(V:real^3->bool) INTER X = set_of_list (truncate_simplex (i-1) ul)`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_CASES_TAC `i = 0`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~(V INTER (X:real^3->bool) = {})`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + (STRIP_TAC); + (UNDISCH_TAC `~(VX V X = {})` THEN ASM_REWRITE_TAC[VX; NEGLIGIBLE_EMPTY]); + (REWRITE_TAC[FINITE_SET_OF_LIST])]);; + +(* ==================================================================== *) +(* Lemma 66 *) + +let CARD_EDGEX_LE_16 = prove_by_refinement ( + `!V X. packing V /\ saturated V /\ mcell_set V X + ==> CARD (edgeX V X) <= 16`, +[(REWRITE_TAC[edgeX] THEN REPEAT STRIP_TAC); + (ABBREV_TAC `S = {u, v | VX V X u /\ VX V X v /\ ~(u = v)}`); + (ABBREV_TAC `f = (\(u,v:real^3). {u,v})`); + (MATCH_MP_TAC (ARITH_RULE `(?x:num. y <= x /\ x <= z) ==> y <= z`)); + (EXISTS_TAC `CARD (IMAGE (f:(real^3#real^3)->(real^3->bool)) S)`); + (STRIP_TAC); + (MATCH_MP_TAC CARD_SUBSET); + (STRIP_TAC); + (EXPAND_TAC "f" THEN EXPAND_TAC "S" THEN + REWRITE_TAC[IMAGE; SUBSET; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `u:real^3,v:real^3` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `u:real^3` THEN EXISTS_TAC `v:real^3` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_IMAGE); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{u,v | u IN VX V X /\ v IN VX V X}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_PRODUCT); + (REWRITE_TAC[] THEN MATCH_MP_TAC FINITE_VX); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + + (MATCH_MP_TAC (ARITH_RULE `(?x:num. y <= x /\ x <= z) ==> y <= z`)); + (EXISTS_TAC `CARD (S:(real^3#real^3)->bool)`); + (STRIP_TAC); + (MATCH_MP_TAC CARD_IMAGE_LE); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{u,v | u IN VX V X /\ v IN VX V X}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_PRODUCT); + (REWRITE_TAC[] THEN MATCH_MP_TAC FINITE_VX); + (ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + + (MATCH_MP_TAC (ARITH_RULE `(?x:num. y <= x /\ x <= z) ==> y <= z`)); + (EXISTS_TAC `CARD {u,v | u IN VX V X /\ v IN VX V X}`); + (STRIP_TAC); + (MATCH_MP_TAC CARD_SUBSET); + (STRIP_TAC); + (ASM_SET_TAC[]); + (MATCH_MP_TAC FINITE_PRODUCT); + (REWRITE_TAC[] THEN MATCH_MP_TAC FINITE_VX); + (ASM_REWRITE_TAC[]); + (REWRITE_WITH + `CARD {u,v | u IN VX V X /\ v IN VX V X} = CARD (VX V X) * CARD (VX V X)`); + (MATCH_MP_TAC CARD_PRODUCT THEN ASM_SIMP_TAC[FINITE_VX]); + + (UNDISCH_TAC `mcell_set V X` THEN REWRITE_TAC[mcell_set_2; IN; IN_ELIM_THM]); + (STRIP_TAC); + + (ASM_CASES_TAC `VX V X = {}`); + (ASM_REWRITE_TAC[CARD_CLAUSES] THEN ARITH_TAC); + (REWRITE_WITH `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num` THEN ASM_REWRITE_TAC[] + THEN STRIP_TAC THEN UNDISCH_TAC `~(VX V X = {})` THEN + ASM_REWRITE_TAC[VX]); + (ASM_CASES_TAC `V INTER (X:real^3->bool) = {}`); + (ASM_REWRITE_TAC[CARD_CLAUSES] THEN ARITH_TAC); + (REWRITE_WITH + `(V:real^3->bool) INTER X = set_of_list (truncate_simplex (i-1) ul)`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (ASM_CASES_TAC `i = 0`); + (NEW_GOAL `F`); + (UNDISCH_TAC `~(V INTER (X:real^3->bool) = {})`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Lepjbdj.LEPJBDJ_0); + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[]); + (ASM_ARITH_TAC); + (STRIP_TAC); + (UNDISCH_TAC `~(VX V X = {})` THEN ASM_REWRITE_TAC[VX; NEGLIGIBLE_EMPTY]); + (NEW_GOAL `CARD (set_of_list (truncate_simplex (i - 1) ul)) <= + LENGTH (truncate_simplex (i - 1) (ul:(real^3)list))`); + (REWRITE_TAC[CARD_SET_OF_LIST_LE]); + (UP_ASM_TAC THEN REWRITE_WITH + `LENGTH (truncate_simplex (i - 1) (ul:(real^3)list)) = (i - 1 + 1)`); + (MATCH_MP_TAC Packing3.LENGTH_TRUNCATE_SIMPLEX); + (REWRITE_WITH `LENGTH (ul:(real^3)list) = 3 + 1`); + (MATCH_MP_TAC BARV_LENGTH_LEMMA); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ASM_ARITH_TAC); + (STRIP_TAC); + (ABBREV_TAC + `s = CARD (set_of_list (truncate_simplex (i - 1) (ul:(real^3)list)))`); + (NEW_GOAL `s <= 4`); + (ASM_ARITH_TAC); + (NEW_GOAL `s * s <= s * 4 /\ s * 4 <= 4 * 4`); + (ASM_REWRITE_TAC[LE_MULT_LCANCEL; LE_MULT_RCANCEL]); + (ASM_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 67 *) +let gamma_y_lmfun_bound2 = prove_by_refinement ( + `?d. (!V X e. packing V /\ saturated V /\ mcell_set V X /\ edgeX V X e ==> gammaY V X lmfun e <= d)`, +[ + (EXISTS_TAC `pi * h0 / (h0 - &1)`); + (REPEAT STRIP_TAC); + (ABBREV_TAC `f = (\u v. if {u, v} IN edgeX V X + then dihX V X (u,v) * lmfun (hl [u; v]) + else &0)`); + (REWRITE_WITH `gammaY V X lmfun = (\({u, v}). f u v)`); + (EXPAND_TAC "f" THEN REWRITE_TAC[gammaY]); + + (NEW_GOAL `!u v. (f:real^3->real^3->real) u v = f v u`); + (EXPAND_TAC "f" THEN REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[HL; set_of_list; SET_RULE `{a,b} = {b,a}`]); + (REPEAT GEN_TAC THEN COND_CASES_TAC); + (COND_CASES_TAC); + (REWRITE_WITH `dihX V X (u,v) = dihX V X (v,u)`); + (MATCH_MP_TAC DIHX_SYM); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN MESON_TAC[]); + (COND_CASES_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + (REFL_TAC); + + (UNDISCH_TAC `edgeX V X e` THEN REWRITE_TAC[IN;IN_ELIM_THM; edgeX]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH `(\({u, v}). f u v) {u, v} = + (f:real^3->real^3->real) u v`); + (MATCH_MP_TAC BETA_PAIR_THM); + (ASM_REWRITE_TAC[]); + + (EXPAND_TAC "f"); + (COND_CASES_TAC); + + (NEW_GOAL `dihX V X (u,v) * lmfun (hl [u;v]) <= pi * lmfun (hl [u;v])`); + (REWRITE_TAC[REAL_ARITH `a * x <= b * x <=> &0 <= (b - a) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[lmfun_pos_le; REAL_ARITH `&0 <= a - b <=> b <= a`; DIHX_LE_PI]); + + (NEW_GOAL `pi * lmfun (hl [u:real^3;v]) <= pi * h0 / (h0 - &1)`); + (REWRITE_TAC[REAL_ARITH `a * x <= a * y <=> &0 <= (y - x) * a`]); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[PI_POS_LE; REAL_ARITH `&0 <= a - b <=> b <= a`]); + (MATCH_MP_TAC lmfun_bounded); + (REWRITE_TAC[HL_2; REAL_ARITH `&0 <= inv (&2) * x <=> &0 <= x`; DIST_POS_LE]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (REWRITE_TAC[PI_POS_LE]); + (MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[h0] THEN REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 68 *) +let BOUND_GAMMA_X_lmfun = prove_by_refinement ( + `?c. + (!V X. packing V /\ saturated V /\ mcell_set V X ==> gammaX V X lmfun <= c)`, +[(MP_TAC gamma_y_lmfun_bound2 THEN STRIP_TAC); + (ABBREV_TAC `e = max d (&0)`); + (EXISTS_TAC `&4 / &3 * pi * (&8) pow 3 + (&8 * mm2 / pi) * &16 * e`); + (REPEAT STRIP_TAC); + (REWRITE_TAC[gammaX]); + (MATCH_MP_TAC (REAL_ARITH + `a <= x /\ &0 <= b /\ c <= y ==> a - b + c <= x + y`)); + (REPEAT STRIP_TAC); + (ASM_CASES_TAC `X:real^3->bool = {}`); + (ASM_REWRITE_TAC[MEASURE_EMPTY; + REAL_ARITH `&0 <= &4 / &3 * pi * &8 pow 3 <=> &0 <= pi`]); + (REWRITE_TAC[PI_POS_LE]); + (NEW_GOAL `?p:real^3. p IN X`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_WITH `&4 / &3 * pi * &8 pow 3 = vol (ball (p, &8))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN MATCH_MP_TAC VOLUME_BALL); + (REAL_ARITH_TAC); + (MATCH_MP_TAC MEASURE_SUBSET); + (REWRITE_TAC[MEASURABLE_BALL]); + (STRIP_TAC); + (UNDISCH_TAC `mcell_set V X` THEN REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_MCELL); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MCELL_SUBSET_BALL8_2); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 <= &2 * a <=> &0 <= a`]); + (MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (NEW_GOAL `#1.012080 < mm1`); + (REWRITE_TAC[Flyspeck_constants.bounds]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[PI_POS_LE]); + (REWRITE_TAC[total_solid]); + (MATCH_MP_TAC SUM_POS_LE); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC FINITE_VX); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[sol]); + + (NEW_GOAL `eventually_radial (x:real^3) X`); + (UNDISCH_TAC `mcell_set V X` THEN REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Urrphbz2.URRPHBZ2); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `VX V X = V INTER X`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC THEN UNDISCH_TAC `x IN VX V X`); + (ASM_REWRITE_TAC[VX] THEN SET_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[eventually_radial]); + (STRIP_TAC); + + (REWRITE_WITH `sol x X = &3 * vol (X INTER normball x r) / r pow 3`); + (MATCH_MP_TAC sol); + (REWRITE_TAC[GSYM Marchal_cells_2_new.RADIAL_VS_RADIAL_NORM; NORMBALL_BALL]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[MEASURABLE_BALL]); + (UNDISCH_TAC `mcell_set V X` THEN REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_MCELL); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `&0 <= &3 * a <=> &0 <= a`]); + (MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (MATCH_MP_TAC MEASURE_POS_LE); + (REWRITE_TAC[NORMBALL_BALL]); + (MATCH_MP_TAC MEASURABLE_INTER); + (REWRITE_TAC[MEASURABLE_BALL]); + (UNDISCH_TAC `mcell_set V X` THEN REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MEASURABLE_MCELL); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Real_ext.REAL_PROP_NN_POW); + (ASM_REAL_ARITH_TAC); + (ONCE_REWRITE_TAC[REAL_ARITH `a <= b <=> &0 <= b - a`]); + (REWRITE_TAC[REAL_ARITH `a * x - a * y = a * (x - y)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + + (REWRITE_TAC[REAL_ARITH `&0 <= &8 * a <=> &0 <= a`]); + (MATCH_MP_TAC REAL_LE_DIV); + (STRIP_TAC); + (NEW_GOAL `#0.02541 < mm2`); + (REWRITE_TAC[Flyspeck_constants.bounds]); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[PI_POS_LE]); + (REWRITE_TAC[GSYM gammaY]); + (ONCE_REWRITE_TAC[REAL_ARITH `&0 <= b - a <=> a <= b`]); + (NEW_GOAL `sum (edgeX V X) (gammaY V X lmfun) <= + sum (edgeX V X) (\x. e)`); + (MATCH_MP_TAC SUM_LE); + (REWRITE_TAC[Upfzbzm_support_lemmas.FINITE_edgeX]); + (REPEAT STRIP_TAC); + (NEW_GOAL `gammaY V X lmfun x <= d`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN]); + (ASM_REAL_ARITH_TAC); + + (NEW_GOAL `sum (edgeX V X) (\x. e) <= &16 * e`); + (REWRITE_WITH `sum (edgeX V X) (\x. e) = &(CARD (edgeX V X)) * e`); + (MATCH_MP_TAC SUM_CONST); + (REWRITE_TAC[Upfzbzm_support_lemmas.FINITE_edgeX]); + + (ONCE_REWRITE_TAC[REAL_ARITH `a <= b <=> &0 <= b - a`]); + (REWRITE_TAC[REAL_ARITH `a * x - b * x = x * (a - b)`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ONCE_REWRITE_TAC[REAL_ARITH `&0 <= b - a <=> a <= b`]); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_EDGEX_LE_16); + (ASM_REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + +(* ==================================================================== *) +(* Lemma 69 *) +(* ==================================================================== *) +(* Lemma 70 *) +(* ==================================================================== *) +(* Lemma 71 *) + + + +end;; diff --git a/text_formalization/packing/oxl_2012.hl b/text_formalization/packing/oxl_2012.hl new file mode 100644 index 0000000..519c5cd --- /dev/null +++ b/text_formalization/packing/oxl_2012.hl @@ -0,0 +1,6299 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Packing *) +(* Lemma: OXLZLEZ *) +(* Author: Nguyen Quang Truong *) +(* Date: 2012-12-21 *) +(* ========================================================================== *) + + + +module Oxl_2012 = struct + + +open Oxl_def;; + + +(* + +needs "/home/user1/flyspeck/working/boot.hl";; + + + +===================== dont worry about this ================ +needs "/home/user1/flyspeck/working/update_database_310.ml";; +needs "/home/user1/flyspeck/working/asm_search.ml";; +needs "/home/user1/flyspeck/working/Oxl_deff.hl";; + + + +needs "/home/user1/flyspeck/working/oxl_2012.hl";; + + + +*) + + + + + +let asms_search0 sths = + let rec immediatesublist l1 l2 = + match (l1,l2) with + [],_ -> true + | _,[] -> false + | (h1::t1,h2::t2) -> h1 = h2 & immediatesublist t1 t2 in + let rec sublist l1 l2 = + match (l1,l2) with + [],_ -> true + | _,[] -> false + | (h1::t1,h2::t2) -> immediatesublist l1 l2 or sublist l1 t2 in + let exists_subterm_satisfying p (n,th) = can (find_term p) (concl th) + and name_contains s (n,th) = sublist (explode s) (explode n) in + let rec filterpred tm = + match tm with + Comb(Var("",_),t) -> not o filterpred t + | Comb(Var("",_),Var(pat,_)) -> name_contains pat + | Comb(Var("",_),pat) -> exists_subterm_satisfying (aconv pat) + | pat -> exists_subterm_satisfying (can (term_match [] pat)) in + fun pats -> + let triv,nontriv = partition is_var pats in + (if triv <> [] then + warn true + ("Ignoring plain variables in search: "^ + end_itlist (fun s t -> s^", "^t) (map (fst o dest_var) triv)) + else ()); + (if nontriv = [] & triv <> [] then [] + else itlist (filter o filterpred) pats sths);; + +let asms_search tms = + let gstk = !current_goalstack in + match gstk with + [] -> [] + | (meta,gl::_,just)::_ + -> let (sths,_) = gl in + map snd (asms_search0 sths tms) + | _ -> failwith "asm_searchs: Invalid goal state";; + +let ASMS_SEARCH_TCL (tms:(term)list) (thstac:(thm)list->tactic) : tactic = + fun (gl:goal) -> + let (sths,tm) = gl in + let ths1 = map snd (asms_search0 sths tms) in + thstac ths1 gl;; + +let ASM_SEARCH_TCL (tms:(term)list) (thstac:thm->tactic) : tactic = + let foo ths = match ths with + [] -> failwith "ASM_SEARCH_TCL: No matching asms found" + | _ -> thstac (hd ths) in + ASMS_SEARCH_TCL tms foo;; + + + + +let ATTACH thm = MATCH_MP (MESON[]` ! a b. ( a ==> b ) ==> ( a <=> a /\ b )`) thm;; + +let NHANH tm = ONCE_REWRITE_TAC[ ATTACH (SPEC_ALL ( tm ))];; + +let PHA = REWRITE_TAC[ MESON[] ` (a/\b)/\c <=> a/\ b /\ c `; MESON[]` +a ==> b ==> c <=> a /\ b ==> c `];; + +let DOWN_TAC = REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[IMP_IMP] THEN PHA;; + + +let DOWN = FIRST_X_ASSUM MP_TAC;; + +let DOWNS n = REPLICATE_TAC n DOWN THEN PHA;; + +let REMOVE_TAC = FIRST_X_ASSUM MP_TAC THEN MATCH_MP_TAC (TAUT` a ==> b ==> a`);; + + +let types_thm th = let cl = concl th in +List.map dest_var (frees cl );; + +let seans_fn () = +let (tms,tm) = top_goal () in +let vss = map frees (tm::tms) in +let vs = setify (flat vss) in +map dest_var vs;; + + + + + +let PAT_REWRITE_TAC tm thms = +(CONV_TAC (PAT_CONV tm (REWRITE_CONV thms )));; + +let FOR_ASM th = +let th1 = REWRITE_RULE[MESON[]` a /\ b ==> c <=> +a ==> b ==> c `] th in +let th2 = SPEC_ALL th1 in UNDISCH_ALL th2;; + +(* change a th having form |- A ==> t to the form A |- t +to get ready to some other commands + + +|- A ==> t +----------- FOR_ASM +A |- t +*) + +let ASSUME_TAC2 = ASSUME_TAC o FOR_ASM;; + + +let PAT_ONCE_REWRITE_TAC tm thms = +(CONV_TAC (PAT_CONV tm (ONCE_REWRITE_CONV thms )));; + +let ASM_PAT_RW_TAC tm thms = EVERY_ASSUM (fun th -> +(CONV_TAC (PAT_CONV tm (ONCE_REWRITE_CONV +( th ::[ thms ] )))));; + +let PAT_TH_TAC tm th = +(CONV_TAC (PAT_CONV tm (REWRITE_CONV[th] )));; + + +let IMP_TO_EQ_RULE th = MATCH_MP (TAUT` (a ==> b ) ==> +( a <=> a /\ b )`) (SPEC_ALL th);; + +let NHANH_PAT tm th = PAT_ONCE_REWRITE_TAC tm +[ IMP_TO_EQ_RULE th ];; + + +let MAKE_FIRST_TAC tm = UNDISCH_TAC tm THEN DISCH_TAC;; + + +(* ---------- BG TEST ------------- *) + + + +let rec els L = match L with +[] -> p () +| (x::l) -> e x; els l;; + +let rec bls L = match L with +[] -> p () +| (x::l) -> b (); bls l;; + + + + + +(* ------------- *) + +let QU_OR_QXY = prove (` ! i. cc_qu_v11 cc i \/ cc_qx_v11 cc i \/ cc_qy_v11 cc i `, +REWRITE_TAC[cc_qu_v11; cc_qx_v11; cc_qy_v11] THEN MESON_TAC[]);; + +let QX_NN0 = REWRITE_RULE[REAL_ARITH` #0.0 = &0`] QX_NN;; +let QY_NN0 = REWRITE_RULE[REAL_ARITH` #0.0 = &0`] QY_NN;; + + +let MOD_REFL = REWRITE_RULE[MULT_CLAUSES] (SPECL [`m:num `;`1`] MOD_MULT);; + + +let SUM_POS_LT_NUMSEG = prove_by_refinement ( +`!m n f. m <= n /\ (!p. m <= p /\ p <= n ==> &0 < f p) ==> &0 < sum (m..n) f`, +[GEN_TAC; +INDUCT_TAC; +REWRITE_TAC[LE; SUM_CLAUSES_NUMSEG]; +SIMP_TAC[]; +GEN_TAC; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` 0`)); +ASM_REWRITE_TAC[LE]; + + +GEN_TAC; +ASM_CASES_TAC` m = SUC n `; +ASM_REWRITE_TAC[SUM_SING_NUMSEG]; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` SUC n `)); +FIRST_X_ASSUM MP_TAC; +CONV_TAC TAUT; + +STRIP_TAC; +SUBGOAL_THEN` &0 < sum (m..n) f ` MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +CONJ_TAC; +DOWN_TAC; +ARITH_TAC; +FIRST_X_ASSUM MP_TAC; +MESON_TAC[ARITH_RULE` a <= p ==> a <= SUC p `]; +REWRITE_TAC[SUM_CLAUSES_NUMSEG]; +ASM_REWRITE_TAC[]; +STRIP_TAC; +MATCH_MP_TAC REAL_LT_ADD; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[LE_REFL]]);; + + + + +let periodic_mult = prove_by_refinement ( +` periodic f n <=> !k p. f (k * n + p ) = f p `, +[REWRITE_TAC[periodic]; +EQ_TAC; +STRIP_TAC; +INDUCT_TAC; +REWRITE_TAC[MULT; ADD]; + +REWRITE_TAC[ADD1; NUM_RING` (k + 1) * n = k * n + n `]; +REWRITE_TAC[ARITH_RULE` (a + b) + c = a + b + (c:num) `]; +DOWN_TAC; +MESON_TAC[ADD_SYM]; + +DISCH_THEN (MP_TAC o (SPEC`1 `)); +REWRITE_TAC[MULT_CLAUSES]; +MESON_TAC[ADD_SYM]]);; + + + + +(* =================================================== *) +CHQSQEY_concl;; + + + + +let glt = `cc_bool_model_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0 /\ + indSet = 0..cc_card_v11 cc - 1 + ==> (?i j k. + ~(i = j \/ j = k \/ k = i) /\ + i IN indSet /\ + j IN indSet /\ + k IN indSet /\ + cc_4cell_v11 cc i /\ + cc_4cell_v11 cc j /\ + cc_4cell_v11 cc k)`;; + + +let e1 = (STRIP_TAC THEN ASSUME_TAC2 CC_CARD2 THEN +DOWN_TAC THEN NHANH periodic_fn THEN +ASM_CASES_TAC` ~ (?i. i IN indSet /\ cc_4cell_v11 cc i)` THENL [ + + +SUBGOAL_THEN` ! i. i IN indSet ==> cc_qy_v11 cc i ` MP_TAC THENL +[MP_TAC QU_OR_QXY THEN +REWRITE_TAC[cc_qu_v11; cc_qx_v11] THEN +FIRST_X_ASSUM MP_TAC THEN +MESON_TAC[]; + +REWRITE_TAC[cc_real_model_v11; cc_bool_model_v11]] THEN + +REPEAT STRIP_TAC THEN +SUBGOAL_THEN` ! i. i IN indSet ==> &0 < cc_gg_v11 cc i ` MP_TAC THENL [ + + +UNDISCH_TAC`!i. i IN indSet ==> cc_qy_v11 cc i` THEN +DISCH_THEN NHANH THEN +UNDISCH_TAC`!i. cc_qy_v11 cc i ==> #0.008 * cc_azim_v11 cc i <= cc_gg_v11 cc i` THEN +STRIP_TAC THEN +FIRST_ASSUM NHANH THEN +GEN_TAC THEN + +UNDISCH_TAC` !i. #0.606 <= cc_azim_v11 cc i ` THEN +DISCH_TAC THEN +FIRST_ASSUM (MP_TAC o (SPEC` i: num `)) THEN +REAL_ARITH_TAC; + +STRIP_TAC] THEN +SUBGOAL_THEN` &0 < sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) ` MP_TAC THENL + + +[MATCH_MP_TAC SUM_POS_LT_NUMSEG THEN CONJ_TAC THENL +[UNDISCH_TAC` ~ (cc_card_v11 cc = 0) ` THEN +ARITH_TAC; + +REPEAT STRIP_TAC THEN +FIRST_X_ASSUM MATCH_MP_TAC THEN +ASM_REWRITE_TAC[IN_NUMSEG]]; + + +UNDISCH_TAC` sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0 ` THEN +REAL_ARITH_TAC]; + +FIRST_X_ASSUM MP_TAC] THEN +REWRITE_TAC[] THEN STRIP_TAC THEN STRIP_TAC THEN +ASM_CASES_TAC` ~ ( ?j. j IN indSet /\ ~(j = i) /\ cc_4cell_v11 cc j)`);; + + + +let e2 = (FIRST_X_ASSUM MP_TAC THEN +REWRITE_TAC [ +MESON[]` ~(?j. j IN indSet /\ ~(j = i) /\ cc_4cell_v11 cc j) <=> +!j. j IN indSet /\ ~(j = i) ==> ~ cc_4cell_v11 cc j `] THEN + +STRIP_TAC THEN +SUBGOAL_THEN`!j. j IN indSet /\ ~(j = i) ==> cc_qy_v11 cc j ` MP_TAC THENL [ + + + +FIRST_ASSUM NHANH THEN +REPEAT STRIP_TAC THEN +MP_TAC (SPEC `j:num` QU_OR_QXY) THEN +FIRST_ASSUM MP_TAC THEN +SIMP_TAC[cc_qu_v11; cc_qx_v11]; + + +SUBGOAL_THEN` cc_qu_v11 cc i \/ cc_qx_v11 cc i ` MP_TAC] THENL [ + +MP_TAC (SPEC_ALL QU_OR_QXY) THEN +MATCH_MP_TAC (TAUT` ~ c ==> a \/ b \/ c ==> a \/ b `) THEN +ASM_REWRITE_TAC[cc_qy_v11]; + + +STRIP_TAC THEN +STRIP_TAC THEN +SUBGOAL_THEN` cc_qy_v11 cc (i + 1)` MP_TAC]);; + + + + +let e3 = (ASM_CASES_TAC` i < cc_card_v11 cc - 1 ` THENL [ +FIRST_ASSUM (MP_TAC o SPEC` i + 1 `) THEN ANTS_TAC THENL [ +ASM_REWRITE_TAC[ARITH_RULE`~( i + 1 = i ) `; IN_NUMSEG] THEN +FIRST_ASSUM MP_TAC THEN +ARITH_TAC; + +REWRITE_TAC[]]; + + + +UNDISCH_TAC` (i:num) IN indSet ` THEN +ASM_REWRITE_TAC[IN_NUMSEG] THEN +STRIP_TAC THEN +ASSUME_TAC2 (ARITH_RULE` ~(i < cc_card_v11 cc - 1) /\ i <= cc_card_v11 cc - 1 ==> cc_card_v11 cc - 1 = i `) THEN +UNDISCH_TAC` periodic (cc_qy_v11 cc) (cc_card_v11 cc) ` THEN +EXPAND_TAC "i" THEN +DOWN_TAC THEN +REWRITE_TAC[cc_bool_model_v11] THEN +NHANH (ARITH_RULE` ~( a = 0) ==> a - 1 + 1 = a `) THEN +SIMP_TAC[periodic] THEN + + +STRIP_TAC THEN +ONCE_REWRITE_TAC[ARITH_RULE` a = 0 + a `] THEN +ASM_REWRITE_TAC[] THEN +FIRST_X_ASSUM MATCH_MP_TAC THEN +ASM_REWRITE_TAC[IN_NUMSEG] THEN + +EXPAND_TAC "i" THEN +REWRITE_TAC[LE] THEN +MATCH_MP_TAC (ARITH_RULE` 2 <= a ==> ~( 0 = a - 1) `) THEN +FIRST_ASSUM ACCEPT_TAC]);; + + +let e4 = ( + + +(* ------------------------------------- *) +DOWN_TAC THEN +REWRITE_TAC[cc_real_model_v11] THEN +STRIP_TAC THEN +UNDISCH_TAC` !i. cc_qu_v11 cc i /\ cc_qy_v11 cc (i + 1) + ==> cc_eps <= cc_gg_v11 cc i + cc_gg3a_v11 cc (i + 1) ` THEN +STRIP_TAC THEN +FIRST_ASSUM (MP_TAC o SPEC_ALL) THEN +ANTS_TAC THENL [ASM_REWRITE_TAC[]; +MAKE_FIRST_TAC` !i. cc_qy_v11 cc i + ==> cc_gg3a_v11 cc i + cc_gg3b_v11 cc i <= cc_gg_v11 cc i `] THEN + +SUBGOAL_THEN` cc_gg3a_v11 cc ( i + 1) <= cc_gg_v11 cc ( i + 1) ` MP_TAC THENL [ +MATCH_MP_TAC REAL_LE_TRANS THEN +EXISTS_TAC` cc_gg3a_v11 cc (i + 1) + cc_gg3b_v11 cc (i + 1)` THEN + +CONJ_TAC THENL [ +REWRITE_TAC[REAL_LE_ADDR] THEN +FIRST_X_ASSUM MATCH_MP_TAC THEN +ASM_REWRITE_TAC[]; + +FIRST_X_ASSUM MATCH_MP_TAC THEN +ASM_REWRITE_TAC[]]; + + +PHA] THEN +NHANH (REAL_ARITH` a <= b /\ c <= d + a ==> c <= d + b `));; + + + +(* +`(cc_gg3a_v11 cc (i + 1) <= cc_gg_v11 cc (i + 1) /\ + cc_eps <= cc_gg_v11 cc i + cc_gg3a_v11 cc (i + 1)) /\ + cc_eps <= cc_gg_v11 cc i + cc_gg_v11 cc (i + 1) + ==> (?i j k. + ~(i = j \/ j = k \/ k = i) /\ + i IN indSet /\ + j IN indSet /\ + k IN indSet /\ + cc_4cell_v11 cc i /\ + cc_4cell_v11 cc j /\ + cc_4cell_v11 cc k)` + +*) + +(* ============================================= +================================================ +let WKR_COMPTED = prove_by_refinement (glt , + + +g glt;; + + + +els +[e1 ; e2 ; e3; e4; + +STRIP_TAC THEN +MP_TAC (SPECL [` cc_gg_v11 cc `;` cc_card_v11 cc`] periodic_sum) THEN +ANTS_TAC THENL [ +ASM_REWRITE_TAC[] THEN +UNDISCH_TAC` cc_bool_model_v11 cc ` THEN +SIMP_TAC[cc_bool_model_v11]; +DISCH_THEN (ASSUME_TAC o (SPEC` i:num`))] THEN +SUBGOAL_THEN` &0 <= sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) ` MP_TAC; + +ASM_CASES_TAC` i < cc_card_v11 cc - 1 `; +SUBGOAL_THEN` 0..cc_card_v11 cc - 1 = ((0..cc_card_v11 cc - 1) DIFF {i, i +1} ) UNION {i, i + 1}` MP_TAC THENL [ +MATCH_MP_TAC (SET_RULE` s SUBSET S ==> S = (S DIFF s) UNION s `) THEN +UNDISCH_TAC` (i:num) IN indSet` THEN +ASM_SIMP_TAC[INSERT_SUBSET; EMPTY_SUBSET] THEN + +REWRITE_TAC[IN_NUMSEG] THEN +FIRST_ASSUM MP_TAC THEN +ARITH_TAC; + + +DISCH_THEN SUBST1_TAC THEN +REWRITE_TAC[]]; + +SUBGOAL_THEN` ! f. sum ((0..cc_card_v11 cc - 1) DIFF {i, i + 1} UNION {i, i + 1}) f = sum ((0..cc_card_v11 cc - 1) DIFF {i, i + 1}) f + sum ({i, i + 1}) f ` MP_TAC THENL [ +GEN_TAC THEN +MATCH_MP_TAC SUM_UNION THEN +CONJ_TAC THENL [ +MESON_TAC[FINITE_NUMSEG; FINITE_DIFF]; +CONJ_TAC] THENL [ +MESON_TAC[FINITE_EMPTY; FINITE_INSERT]; +SET_TAC[]]; + + +SIMP_TAC[] THEN +STRIP_TAC THEN +MATCH_MP_TAC REAL_LE_ADD THEN +CONJ_TAC]; + + +MATCH_MP_TAC SUM_POS_LE THEN CONJ_TAC THENL [ +MESON_TAC[FINITE_NUMSEG; FINITE_DIFF]; +REPEAT STRIP_TAC]; + + + +REWRITE_TAC[REAL_ARITH` &0 = #0.0 `] THEN +MATCH_MP_TAC QY_NN THEN +ASM_REWRITE_TAC[cc_bool_model_v11; cc_real_model_v11] THEN +FIRST_ASSUM MATCH_MP_TAC + THEN +ASM_REWRITE_TAC[] THEN +FIRST_ASSUM MP_TAC THEN +REWRITE_TAC[IN_DIFF; IN_INSERT] THEN +MESON_TAC[]; + + + +MP_TAC (MATCH_MP Geomdetail.SUM_DIS2 (ARITH_RULE` ~( i = i + 1 ) `)) THEN +STRIP_TAC THEN +MATCH_MP_TAC REAL_LE_TRANS THEN +EXISTS_TAC` cc_eps:real` THEN +ASM_REWRITE_TAC[] THEN REWRITE_TAC[cc_eps] THEN +REAL_ARITH_TAC; + + +ASM_CASES_TAC` i = cc_card_v11 cc - 1 ` THENL [ +SUBGOAL_THEN` 0..cc_card_v11 cc - 1 = ((0..cc_card_v11 cc - 1) DIFF {i, 0}) UNION {i, 0}` MP_TAC THENL [ +MATCH_MP_TAC (SET_RULE` s SUBSET S ==> S = (S DIFF s) UNION s`) THEN +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_NUMSEG] THEN +FIRST_X_ASSUM MP_TAC THEN +UNDISCH_TAC` (i:num) IN indSet` THEN +ASM_REWRITE_TAC[IN_NUMSEG] THEN +SIMP_TAC[LE; LE_0]; + +DISCH_THEN SUBST1_TAC] THEN + +SUBGOAL_THEN` FINITE ((0..cc_card_v11 cc - 1) DIFF {i, 0}) /\ + FINITE {i, 0} /\ + DISJOINT ((0..cc_card_v11 cc - 1) DIFF {i, 0}) {i, 0} ` MP_TAC THENL [ +REWRITE_TAC[SET_RULE` DISJOINT (S DIFF s) s`] THEN +MESON_TAC[FINITE_NUMSEG; FINITE_INSERT; FINITE_EMPTY; FINITE_DIFF]; +NHANH (ISPECL[` cc_gg_v11 cc`;` (0..cc_card_v11 cc - 1) DIFF {i, 0}`;` {i, 0}`] SUM_UNION) THEN +SIMP_TAC[]] THEN + +STRIP_TAC THEN +MATCH_MP_TAC REAL_LE_ADD THEN +CONJ_TAC THENL [ +MATCH_MP_TAC SUM_POS_LE THEN +ASM_REWRITE_TAC[] THEN +GEN_TAC THEN +REWRITE_TAC[IN_DIFF; IN_INSERT] THEN +STRIP_TAC THEN +MATCH_MP_TAC QY_NN0 THEN +ASM_REWRITE_TAC[cc_bool_model_v11; cc_real_model_v11] THEN +FIRST_X_ASSUM MATCH_MP_TAC THEN +ASM_REWRITE_TAC[] THEN +FIRST_X_ASSUM MP_TAC THEN +CONV_TAC TAUT; + + +SUBGOAL_THEN` ~( i = 0) ` MP_TAC THENL [ +ASM_REWRITE_TAC[] THEN +UNDISCH_TAC` 2 <= cc_card_v11 cc ` THEN +ARITH_TAC; STRIP_TAC]] THEN + + + + +ASSUME_TAC2 (ISPECL [`i:num `;` 0`; ` cc_gg_v11 cc `] Geomdetail.SUM_DIS2) THEN +UNDISCH_TAC` cc_eps <= cc_gg_v11 cc i + cc_gg_v11 cc (i + 1) ` THEN +ASSUME_TAC2 (ARITH_RULE` 2 <= cc_card_v11 cc ==> cc_card_v11 cc - 1 + 1 = cc_card_v11 cc `) THEN +ASM_REWRITE_TAC[] THEN +UNDISCH_TAC` periodic (cc_gg_v11 cc) (cc_card_v11 cc) ` THEN +REWRITE_TAC[periodic] THEN +STRIP_TAC THEN +FIRST_ASSUM (MP_TAC o (SPEC` 0 `)) THEN +SIMP_TAC[ARITH_RULE` 0 + a = a `] THEN +REPEAT STRIP_TAC THEN +MATCH_MP_TAC REAL_LE_TRANS THEN +EXISTS_TAC` cc_eps:real ` THEN +ASM_REWRITE_TAC[cc_eps] THEN +REAL_ARITH_TAC; + + +UNDISCH_TAC` (i:num) IN indSet` THEN +ASM_REWRITE_TAC[IN_NUMSEG] THEN +REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN +ARITH_TAC]; + +ASM_REWRITE_TAC[REAL_ARITH` a <= b <=> ~( b < a ) `]; + +ASSUME_TAC2 QX_NN0 THEN +SUBGOAL_THEN` &0 <= sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc)` MP_TAC THENL [ + + +MATCH_MP_TAC SUM_POS_LE_NUMSEG THEN +REPEAT STRIP_TAC THEN +ASM_CASES_TAC` p = (i:num) ` THENL [ +ASM_REWRITE_TAC[]; + +MATCH_MP_TAC QY_NN0 THEN +ASM_REWRITE_TAC[] THEN +FIRST_X_ASSUM MATCH_MP_TAC THEN +ASM_REWRITE_TAC[IN_NUMSEG]]; +ASM_REWRITE_TAC[REAL_ARITH` a <= b <=> ~( b < a ) `]]; + +STRIP_TAC; +SUBGOAL_THEN` &0 <= sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc)` MP_TAC; + + +MATCH_MP_TAC SUM_POS_LE_NUMSEG; +REPEAT STRIP_TAC; +ASM_CASES_TAC` p = (i:num) `; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC QX_NN0; + +ASM_REWRITE_TAC[]; +MATCH_MP_TAC QY_NN0; + +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM MATCH_MP_TAC THEN +ASM_REWRITE_TAC[IN_NUMSEG]; + +ASM_REWRITE_TAC[REAL_ARITH` a <= b <=> ~( b < a ) `]; + + +(* *********** *) + +FIRST_X_ASSUM MP_TAC THEN +REWRITE_TAC[] THEN +STRIP_TAC THEN +ASM_CASES_TAC` ~(? k. (k IN indSet /\ ~(k = i) /\ ~(k = j)) /\ cc_4cell_v11 cc k)`; + + +FIRST_X_ASSUM MP_TAC THEN +REWRITE_TAC[MESON[]` ~(?x. p x /\ q x) <=> !x. p x ==> ~ q x `] THEN +STRIP_TAC THEN + +SUBGOAL_THEN` !k. k IN indSet /\ ~(k = i) /\ ~(k = j) ==> cc_qy_v11 cc k ` MP_TAC THENL [ +FIRST_X_ASSUM NHANH THEN +REPEAT STRIP_TAC THEN +MP_TAC (SPEC` k:num` QU_OR_QXY) THEN +ASM_REWRITE_TAC[cc_qu_v11; cc_qx_v11] ; + +STRIP_TAC THEN +ASM_CASES_TAC`~( ?qy. qy IN indSet /\ cc_qy_v11 cc qy)` THEN +FIRST_X_ASSUM MP_TAC THEN +FIRST_X_ASSUM MP_TAC THEN +PHA THEN +NHANH (SET_RULE` (!k. k IN indSet /\ ~(k = i) /\ ~(k = j) ==> cc_qy_v11 cc k) /\ + ~(?qy. qy IN indSet /\ cc_qy_v11 cc qy) ==> indSet SUBSET {i, j} `)] THEN +DOWN_TAC THEN +REWRITE_TAC[cc_real_model_v11] THEN +STRIP_TAC THEN +UNDISCH_TAC` sum (0..cc_card_v11 cc - 1) (cc_azim_v11 cc) = &2 * pi ` THEN +UNDISCH_TAC` !i. #0.606 <= cc_azim_v11 cc i ` THEN +NHANH (REAL_ARITH` #0.606 <= f i ==> &0 <= f i `) THEN +STRIP_TAC THEN STRIP_TAC; + + + +SUBGOAL_THEN` sum (0..cc_card_v11 cc - 1) (cc_azim_v11 cc) <= sum {i, j} (cc_azim_v11 cc) ` MP_TAC; + + +MATCH_MP_TAC SUM_SUBSET_SIMPLE THEN +UNDISCH_TAC` indSet SUBSET {i, j:num} ` THEN +ASM_SIMP_TAC[] THEN +MESON_TAC[FINITE_EMPTY; FINITE_INSERT]; + + +ASSUME_TAC2 (ISPECL [`j:num `;` i:num `;` cc_azim_v11 cc `] Geomdetail.SUM_DIS2) THEN +ONCE_REWRITE_TAC[INSERT_COMM] THEN +ASM_REWRITE_TAC[] THEN +UNDISCH_TAC` cc_4cell_v11 cc j ` THEN +UNDISCH_TAC` cc_4cell_v11 cc i ` THEN +UNDISCH_TAC` !i. cc_4cell_v11 cc i ==> cc_azim_v11 cc i < #2.8 ` THEN +DISCH_TAC THEN +FIRST_ASSUM NHANH THEN +REPEAT STRIP_TAC; + +MP_TAC (MESON[Flyspeck_constants.bounds]` #3.14159 < pi`) THEN +STRIP_TAC THEN +ASSUME_TAC2 ( +REAL_ARITH` &2 * pi <= cc_azim_v11 cc j + cc_azim_v11 cc i /\ +cc_azim_v11 cc j < #2.8 /\ cc_azim_v11 cc i < #2.8 ==> +pi < #2.8 `) THEN +REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN +REAL_ARITH_TAC; + + + + +(* + + 46 [`qy IN indSet`] + 47 [`cc_qy_v11 cc qy`] + 48 [`!i. #0.606 <= cc_azim_v11 cc i /\ &0 <= cc_azim_v11 cc i`] + 49 [`sum (0..cc_card_v11 cc - 1) (cc_azim_v11 cc) = &2 * pi`] + +`?i j k. + ~(i = j \/ j = k \/ k = i) /\ + i IN indSet /\ + j IN indSet /\ + k IN indSet /\ + cc_4cell_v11 cc i /\ + cc_4cell_v11 cc j /\ + cc_4cell_v11 cc k` + +*) + + + +SUBGOAL_THEN` ?ii jj. {ii, jj} = {i:num, j} /\ cc_qy_v11 cc (ii + 1)` MP_TAC; + +ASM_CASES_TAC` cc_qy_v11 cc ( (i:num) + 1) ` THENL [ +EXISTS_TAC` i:num ` THEN +EXISTS_TAC` j:num ` THEN +FIRST_X_ASSUM MP_TAC THEN +SIMP_TAC[]; + +EXISTS_TAC` j:num ` ] THEN +EXISTS_TAC` i:num ` THEN +REWRITE_TAC[ INSERT_COMM] THEN +SUBGOAL_THEN` ! m. ~cc_qy_v11 cc m ==> (m) MOD (cc_card_v11 cc) = (i:num) +\/ m MOD (cc_card_v11 cc) = j ` MP_TAC; + +GEN_TAC THEN +ASSUME_TAC2 (ARITH_RULE` 2 <= cc_card_v11 cc ==> ~( cc_card_v11 cc = 0)`) THEN +ABBREV_TAC ` nn = cc_card_v11 cc ` THEN +ASSUME_TAC2 (SPECL [`m:num `;` nn:num `] MOD_IN_NUMSEG) THEN +ASSUME_TAC2 (ISPECL [` cc_qy_v11 cc `;` nn: num `;` m:num `] periodic_mod) THEN +ABBREV_TAC`m1 = m MOD nn ` THEN +ASM_REWRITE_TAC[] THEN +STRIP_TAC THEN +SUBGOAL_THEN` m1 = (i:num) \/ m1 = j ` MP_TAC; + +UNDISCH_TAC` !k. k IN indSet /\ ~(k = i) /\ ~(k = j) ==> cc_qy_v11 cc k` THEN +DISCH_THEN (MP_TAC o (SPEC` m1 : num `)) THEN +UNDISCH_TAC` ~ cc_qy_v11 cc m1 ` THEN +UNDISCH_TAC` m1 IN 0..nn - 1 ` THEN +ASM_REWRITE_TAC[] THEN +CONV_TAC TAUT; + +SIMP_TAC[]; +(* *) + +(* + 50 [`~cc_qy_v11 cc (i + 1)`] + +`(!m. ~cc_qy_v11 cc m ==> m MOD cc_card_v11 cc = i \/ m MOD cc_card_v11 cc = j) + ==> cc_qy_v11 cc (j + 1)` + +*) + + + +ABBREV_TAC` nn = cc_card_v11 cc ` THEN +STRIP_TAC THEN +ASM_CASES_TAC` cc_qy_v11 cc (j + 1) ` THENL [ +FIRST_X_ASSUM ACCEPT_TAC; +SUBGOAL_THEN` ! m. ~(m IN indSet /\ (m + 1) MOD nn = m)` MP_TAC]; + +GEN_TAC THEN +ASM_REWRITE_TAC[IN_NUMSEG] THEN +STRIP_TAC THEN +ASM_CASES_TAC` m = nn - 1 `; + +ASSUME_TAC2 (ARITH_RULE` 2 <= nn /\ m = nn - 1 ==> m + 1 = 1 * nn + 0 `) THEN +MP_TAC (SPECL [` m + 1`;` nn: num `;` 1`; ` 0`] MOD_UNIQ) THEN + +ANTS_TAC THENL [ +ASM_REWRITE_TAC[] THEN +UNDISCH_TAC` 2 <= nn ` THEN +ARITH_TAC; + +DISCH_THEN SUBST_ALL_TAC THEN +UNDISCH_TAC` 0 = m` THEN +ASM_REWRITE_TAC[] THEN +UNDISCH_TAC` 2 <= nn ` THEN +ARITH_TAC ]; + +ASSUME_TAC2 (ARITH_RULE` m <= nn - 1 /\ ~(m = nn - 1) ==> m + 1 < nn`) THEN +MP_TAC (SPECL[` m + 1 `;` nn: num `;` 0 `;` m + 1 `] MOD_UNIQ) THEN +ANTS_TAC THENL [ +ASM_REWRITE_TAC[] THEN ARITH_TAC; +DISCH_THEN SUBST_ALL_TAC] THEN +UNDISCH_TAC` m + 1 = m` THEN ARITH_TAC; + + +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` i + 1 `)); +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` j + 1 `)); +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` i:num`)); +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` j:num`)); +REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); +UNDISCH_TAC` (i:num) IN indSet `; +UNDISCH_TAC` (j:num) IN indSet`; +SIMP_TAC[]; +REPEAT STRIP_TAC; +UNDISCH_TAC` (i + 1) MOD nn = i \/ (i + 1) MOD nn = j `; +UNDISCH_TAC` (j + 1) MOD nn = i \/ (j + 1) MOD nn = j`; +ASM_REWRITE_TAC[]; + +ASM_CASES_TAC` j + 1 = nn `; +ASM_REWRITE_TAC[]; + +(* +`nn MOD nn = i ==> ~((i + 1) MOD nn = j)` + +*) + + +ASSUME_TAC2 (ARITH_RULE` 2 <= nn ==> ~( nn = 0) `) THEN +ASSUME_TAC2 (SPEC`nn:num` (GEN_ALL MOD_REFL)) THEN +ASM_REWRITE_TAC[] THEN +DISCH_THEN (SUBST_ALL_TAC o SYM) THEN +REWRITE_TAC[ADD] THEN +ASSUME_TAC2 (ARITH_RULE` 2 <= nn ==> 1 < nn `) THEN +FIRST_ASSUM MP_TAC THEN +NHANH MOD_LT THEN +SIMP_TAC[] THEN +REPEAT STRIP_TAC THEN +FIRST_X_ASSUM (SUBST_ALL_TAC o SYM) THEN +SUBST_ALL_TAC (ARITH_RULE` 1 + 1 = 2 `) THEN + +UNDISCH_TAC` qy IN (indSet: num -> bool) ` THEN +ASM_REWRITE_TAC[IN_NUMSEG] THEN +UNDISCH_TAC` 2 = nn ` THEN +DISCH_THEN (SUBST_ALL_TAC o SYM) THEN +REWRITE_TAC[ARITH_RULE` 0 <= x /\ x <= 2 - 1 <=> x = 0 \/ x = 1 `]; + + +STRIP_TAC THENL [ + +FIRST_X_ASSUM SUBST_ALL_TAC THEN +UNDISCH_TAC` cc_4cell_v11 cc 0 ` THEN +UNDISCH_TAC` cc_qy_v11 cc 0 ` THEN +ASM_REWRITE_TAC[cc_qy_v11]; + +FIRST_X_ASSUM SUBST_ALL_TAC THEN +UNDISCH_TAC` cc_4cell_v11 cc 1 ` THEN +UNDISCH_TAC` cc_qy_v11 cc 1 ` THEN +ASM_REWRITE_TAC[cc_qy_v11]]; + +STRIP_TAC THEN +SUBGOAL_THEN` j + 1 < (nn: num) ` MP_TAC THENL [ +UNDISCH_TAC` j:num IN indSet` THEN +ASM_REWRITE_TAC[IN_NUMSEG] THEN +UNDISCH_TAC` ~( j + 1 = nn ) ` THEN +UNDISCH_TAC` 2 <= nn ` THEN +ARITH_TAC; + +NHANH MOD_LT THEN +ASM_REWRITE_TAC[] THEN +SIMP_TAC[]]; + +REWRITE_TAC[ARITH_RULE` (j + 1) + 1 = j + 2 `] THEN +ASM_CASES_TAC` j + 2 < nn` THENL [ +ASSUME_TAC2 (SPECL [`j + 2`;` nn:num `] MOD_LT) THEN +FIRST_X_ASSUM SUBST1_TAC THEN +ARITH_TAC; +STRIP_TAC]; + +ASSUME_TAC2 (ARITH_RULE` ~(j + 2 < nn) /\ j + 1 < nn ==> j + 2 = nn `) THEN +ASM_REWRITE_TAC[] THEN +ASSUME_TAC2 (ARITH_RULE` 2 <= nn ==> ~(nn = 0) `) THEN +ASSUME_TAC2 (SPEC`nn:num ` (GEN_ALL MOD_REFL)) THEN +ASM_REWRITE_TAC[] THEN +STRIP_TAC THEN +FIRST_X_ASSUM (SUBST_ALL_TAC o SYM) THEN +UNDISCH_TAC` qy:num IN indSet ` THEN +ASM_REWRITE_TAC[IN_NUMSEG] THEN +EXPAND_TAC "nn" THEN +REWRITE_TAC[ARITH_RULE` 0 <= qy /\ qy <= (0 + 2) - 1 <=> qy = 0 \/ qy = 1`] THEN +STRIP_TAC THENL [ + +UNDISCH_TAC` cc_qy_v11 cc qy ` THEN +UNDISCH_TAC` cc_4cell_v11 cc 0 ` THEN +ASM_SIMP_TAC[cc_qy_v11]; + +UNDISCH_TAC` cc_qy_v11 cc qy ` THEN +UNDISCH_TAC` cc_4cell_v11 cc i ` THEN +ASM_SIMP_TAC[cc_qy_v11; ADD]]; + + + + +STRIP_TAC THEN ABBREV_TAC` nn = cc_card_v11 cc ` THEN +SUBGOAL_THEN` ? nj k. nj < nn /\ nj + 1 = k * nn + jj /\ cc_qy_v11 cc nj ` MP_TAC; + +ASM_CASES_TAC` jj = 0 `; + +EXISTS_TAC` nn - 1 ` THEN +EXISTS_TAC` 1 ` THEN +FIRST_X_ASSUM SUBST_ALL_TAC THEN +ASSUME_TAC2 (ARITH_RULE` 2 <= nn ==> nn - 1 < nn /\ nn - 1 + 1 = 1 * nn + 0 `) THEN +ASM_SIMP_TAC[] THEN +ASSUME_TAC2 (ARITH_RULE` 2 <= nn ==> ~( nn - 1 = 0) `) THEN +ASM_CASES_TAC` nn - 1 = ii' ` THENL [ +UNDISCH_TAC` cc_qy_v11 cc (ii' + 1)` THEN +FIRST_X_ASSUM (SUBST_ALL_TAC o SYM) THEN +ASM_REWRITE_TAC[ARITH_RULE` 1 * n + 0 = 0 + n`] THEN +UNDISCH_TAC` periodic (cc_qy_v11 cc) nn ` THEN +SIMP_TAC[periodic] THEN +STRIP_TAC THEN +UNDISCH_TAC` {nn - 1, 0} = {i, j} ` THEN +UNDISCH_TAC` cc_4cell_v11 cc i ` THEN +UNDISCH_TAC` cc_4cell_v11 cc j ` THEN +REWRITE_TAC[cc_qy_v11] THEN +SET_TAC[]; + + +ASSUME_TAC2 (SET_RULE` ~(nn - 1 = 0) /\ ~(nn - 1 = ii') /\ {ii', 0} = {i, j} ==> ~( nn - 1 = i) /\ ~( nn - 1 = j ) `) THEN +FIRST_X_ASSUM MATCH_MP_TAC THEN +ASM_REWRITE_TAC[IN_NUMSEG; LE_REFL] THEN +MATCH_MP_TAC (ARITH_RULE` 2 <= nn ==> 0 <= nn - 1 `) THEN +FIRST_X_ASSUM ACCEPT_TAC]; + + +EXISTS_TAC` jj - 1 ` THEN +EXISTS_TAC` 0 ` THEN +REWRITE_TAC[MULT; ADD] THEN +CONJ_TAC THENL [ + MATCH_MP_TAC (ARITH_RULE` jj <= nn - 1 /\ ~( jj = 0) ==> jj - 1 < nn `) THEN +ASM_REWRITE_TAC[] THEN +SUBGOAL_THEN` jj:num IN indSet` MP_TAC THENL [ + + +MP_TAC (SET_RULE` jj IN {ii', jj:num}`) THEN +ASM_REWRITE_TAC[] THEN +ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY] THEN +UNDISCH_TAC` (i:num) IN indSet ` THEN +UNDISCH_TAC` (j:num) IN indSet ` THEN +ASM_REWRITE_TAC[] THEN +MESON_TAC[]; + +ASM_REWRITE_TAC[IN_NUMSEG] THEN +SIMP_TAC[]]; + + CONJ_TAC THENL [FIRST_X_ASSUM MP_TAC THEN +ARITH_TAC; REWRITE_TAC[]]]; + + +ASM_CASES_TAC` jj - 1 = ii' ` THENL [ + +UNDISCH_TAC` cc_qy_v11 cc (ii' + 1) ` THEN +EXPAND_TAC "ii'" THEN +ASSUME_TAC2 (ARITH_RULE` ~( jj = 0) ==> jj - 1 + 1 = jj `) THEN +FIRST_X_ASSUM SUBST1_TAC THEN +MP_TAC (SET_RULE` jj IN {ii', jj:num} `) THEN +ASM_REWRITE_TAC[] THEN +REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; cc_qy_v11 ] THEN +UNDISCH_TAC` cc_4cell_v11 cc i ` THEN +UNDISCH_TAC` cc_4cell_v11 cc j ` THEN +MESON_TAC[]; + +FIRST_X_ASSUM MATCH_MP_TAC THEN +CONJ_TAC]; + + + +ASM_REWRITE_TAC[IN_NUMSEG] THEN +MATCH_MP_TAC (ARITH_RULE` ~(jj = 0) /\ 0 <= jj /\ jj <= nn - 1 ==> 0 <= jj - 1 /\ jj - 1 <= nn - 1 `) THEN +ASM_REWRITE_TAC[] THEN +MP_TAC (SET_RULE` jj IN {ii', jj:num} `) THEN +ASM_REWRITE_TAC[GSYM IN_NUMSEG] THEN +REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY] THEN +UNDISCH_TAC` (i:num) IN indSet ` THEN +UNDISCH_TAC` (j:num) IN indSet ` THEN +ASM_REWRITE_TAC[] THEN +MESON_TAC[]; + +(* + 52 [`~(jj = 0)`] + 53 [`~(jj - 1 = ii')`] + +`~(jj - 1 = i) /\ ~(jj - 1 = j)` + +*) + + +SUBGOAL_THEN` ~( jj - 1 IN {ii', jj:num})` MP_TAC; +REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY]; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` ~( jj = 0) `; +ARITH_TAC; + +ASM_REWRITE_TAC[]; +SET_TAC[]; + +(* ================== *) + +STRIP_TAC; +(* + + 53 [`nj < nn`] + 54 [`nj + 1 = k * nn + jj`] + 55 [`cc_qy_v11 cc nj`] + +`?i j k. + ~(i = j \/ j = k \/ k = i) /\ + i IN indSet /\ + j IN indSet /\ + k IN indSet /\ + cc_4cell_v11 cc i /\ + cc_4cell_v11 cc j /\ + cc_4cell_v11 cc k` + + +*) + +ASSUME_TAC2 (ARITH_RULE` 2 <= nn ==> ~( nn = 0) `) THEN +ASSUME_TAC2 (SPECL [` ii' + 1 `;` nn:num `] DIVMOD_EXIST) THEN +FIRST_X_ASSUM MP_TAC THEN STRIP_TAC THEN +SUBGOAL_THEN` {nj, r, ii', jj:num} SUBSET indSet ` MP_TAC THENL [ +ONCE_REWRITE_TAC[INSERT_SUBSET] THEN +ONCE_REWRITE_TAC[INSERT_SUBSET] THEN +ASM_REWRITE_TAC[] THEN +CONJ_TAC THENL [ +REWRITE_TAC[IN_NUMSEG] THEN +UNDISCH_TAC` ~( nn = 0) ` THEN +UNDISCH_TAC` nj < nn:num ` THEN +ARITH_TAC; +CONJ_TAC] THENL [ + + REWRITE_TAC[IN_NUMSEG] THEN +UNDISCH_TAC` ~( nn = 0) ` THEN +UNDISCH_TAC` r < nn:num ` THEN +ARITH_TAC; + +UNDISCH_TAC` i:num IN indSet`] THEN +UNDISCH_TAC` j:num IN indSet` THEN +ASM_REWRITE_TAC[] THEN SET_TAC[]; + +STRIP_TAC]; + + +SUBGOAL_THEN` &0 <= sum ({nj, r, ii', jj}) (cc_gg_v11 cc)` MP_TAC; + + +UNDISCH_TAC` cc_qy_v11 cc (ii' + 1) ` THEN +ASM_REWRITE_TAC[] THEN +UNDISCH_TAC` periodic (cc_qy_v11 cc) nn ` THEN +REWRITE_TAC[periodic_mult] THEN +SIMP_TAC[] THEN +STRIP_TAC THEN +UNDISCH_TAC` cc_qy_v11 cc nj ` THEN +REWRITE_TAC[cc_qy_v11] THEN +REPEAT STRIP_TAC THEN +ASSUME_TAC2 (SET_RULE` {ii', jj} = {i, j} /\ cc_4cell_v11 cc i /\ cc_4cell_v11 cc j /\ +~ (cc_4cell_v11 cc nj) /\ ~( cc_4cell_v11 cc r) ==> DISJOINT {nj, r} {ii', jj}`) THEN +REWRITE_TAC[SET_RULE` {a,b,c,d} = {a,b} UNION {c,d} `] THEN +ASSUME_TAC (MESON[Geomdetail.FINITE6]` ! a (b:A). FINITE {a,b}`) THEN + +SUBGOAL_THEN` ! f. sum ({nj, r:num} UNION {i, j}) f = sum {nj, r} f + sum {i, j} f ` MP_TAC THENL [ +GEN_TAC THEN +MATCH_MP_TAC SUM_UNION THEN +UNDISCH_TAC` DISJOINT {nj, r} {ii', jj:num} ` THEN +ASM_SIMP_TAC[]; + + +SIMP_TAC[] THEN +STRIP_TAC]; + + +(* + + +61 [`!a b. FINITE {a, b}`] + 62 [`!f. sum ({nj, r} UNION {i, j}) f = sum {nj, r} f + sum {i, j} f`] + +`&0 <= sum {nj, r} (cc_gg_v11 cc) + sum {i, j} (cc_gg_v11 cc)` + + +*) + +SUBGOAL_THEN` (! i. cc_qy_v11 cc (i + 1) + ==> &0 <= cc_gg_v11 cc i + cc_gg3a_v11 cc (i + 1)) /\ + (! i. cc_qy_v11 cc i + ==> &0 <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i + 1)) ` MP_TAC; +CONJ_TAC; +(* AHTYRED ================= *) +GEN_TAC; +ASM_CASES_TAC` cc_qu_v11 cc i' `; +FIRST_X_ASSUM MP_TAC; +PHA; +UNDISCH_TAC` !i. cc_qu_v11 cc i /\ cc_qy_v11 cc (i + 1) + ==> cc_eps <= cc_gg_v11 cc i + cc_gg3a_v11 cc (i + 1) `; +DISCH_THEN NHANH; +REWRITE_TAC[cc_eps]; +REAL_ARITH_TAC; + + +MP_TAC (SPEC` i':num ` QU_OR_QXY); +ASM_REWRITE_TAC[]; +ASM_SEARCH_TCL [`#0.0 <= cc_gg_v11 cc i `] NHANH; +STRIP_TAC; +ASM_SEARCH_TCL [`&0 <= cc_gg3a_v11 cc i `] NHANH; +FIRST_X_ASSUM MP_TAC; +REAL_ARITH_TAC; + +ASM_SEARCH_TCL [` &0 <= cc_gg3a_v11 cc i`] NHANH; +STRIP_TAC; +ASM_SEARCH_TCL [` cc_gg3a_v11 cc i + cc_gg3b_v11 cc i <= cc_gg_v11 cc i`] (ASSUME_TAC2 o (SPEC` i':num `)); +MATCH_MP_TAC REAL_LE_ADD; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC` cc_gg3a_v11 cc i' + cc_gg3b_v11 cc i' `; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC REAL_LE_ADD; +CONJ_TAC; +ASM_SEARCH_TCL [` A ==> &0 <= cc_gg3a_v11 cc i' `] (MATCH_MP_TAC o (SPEC` i':num`)); +FIRST_X_ASSUM ACCEPT_TAC; +ASM_SEARCH_TCL [` A ==> &0 <= cc_gg3b_v11 cc i' `] (MATCH_MP_TAC o (SPEC` i':num`)); +FIRST_X_ASSUM ACCEPT_TAC; +(* AHTYRED ================= *) +(* + + 60 [`DISJOINT {nj, nj} {ii', jj}`] + 61 [`!a b. FINITE {a, b}`] + 62 [`!f. sum ({nj, nj} UNION {i, j}) f = sum {nj, nj} f + sum {i, j} f`] + +`!i. cc_qy_v11 cc i ==> &0 <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i + 1)` + +*) + +GEN_TAC; +ASM_CASES_TAC` cc_qu_v11 cc (i' + 1) `; +FIRST_X_ASSUM MP_TAC THEN PHA; +ASM_SEARCH_TCL [`cc_eps <= cc_gg3b_v11 cc i' + cc_gg_v11 cc i `] NHANH; +REWRITE_TAC[cc_eps]; +REAL_ARITH_TAC; + +SUBST_ALL_TAC (REAL_ARITH` #0.0 = &0 `); +ASM_SEARCH_TCL [` &0 <= cc_gg3b_v11 cc i`] NHANH; +MP_TAC (SPEC` i' + 1 ` QU_OR_QXY); +ASMS_SEARCH_TCL [` ~cc_qu_v11 cc (i' + 1) `] REWRITE_TAC; +ASM_SEARCH_TCL [` &0 <= cc_gg_v11 cc i `] NHANH; +ASM_SEARCH_TCL [` &0 <= cc_gg_v11 cc i `] NHANH; +ASM_SEARCH_TCL [` cc_gg3a_v11 cc i + ccy `] NHANH; +REPEAT STRIP_TAC; +(* 2 goals *) + +MATCH_MP_TAC REAL_LE_ADD; +ASMS_SEARCH_TCL [` &0 <= x `] REWRITE_TAC; +MATCH_MP_TAC REAL_LE_ADD; +ASMS_SEARCH_TCL [` &0 <= cc_gg3b_v11 cc i `] REWRITE_TAC; +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC` cc_gg3a_v11 cc (i' + 1) + cc_gg3b_v11 cc (i' + 1)`; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC REAL_LE_ADD; +UNDISCH_TAC` cc_qy_v11 cc (i' + 1)`; +ASMS_SEARCH_TCL [` cc_qy_v11 cc i ==> &0 <= x `] SIMP_TAC; + + + + + (* end the 2nd goal +(!i. cc_qy_v11 cc i ==> &0 <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i + 1)) +*) + +STRIP_TAC; +ASM_CASES_TAC` nj = (r:num) `; +FIRST_X_ASSUM (SUBST_ALL_TAC o SYM); +REWRITE_TAC[INSERT_INSERT; SUM_SING]; + +ASM_SEARCH_TCL [` {a,b} = {x,y} `] (SUBST1_TAC o SYM); +ASSUME_TAC2 (SET_RULE` ~(j = (i:num)) /\ {ii', jj} = {i, j} ==> ~( ii' = jj)`); +ASSUME_TAC2 (ISPECL [` ii':num `;` jj:num `;` cc_gg_v11 cc `] Geomdetail.SUM_DIS2); +FIRST_X_ASSUM SUBST1_TAC; +ASM_SEARCH_TCL [` cc_qy_v11 cc (i + 1) ==> x `] (MP_TAC o (SPEC` ii':num `)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[cc_qy_v11]; +ASM_SEARCH_TCL [` periodic `;` cc_gg3a_v11`] MP_TAC; +REWRITE_TAC[periodic_mult]; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +STRIP_TAC; +ASM_SEARCH_TCL [` cc_qy_v11 cc i ==> x `;` cc_gg3b_v11 `] (MP_TAC o (SPEC`nj: num`)); +ANTS_TAC; +ASM_REWRITE_TAC[cc_qy_v11]; +ASM_SEARCH_TCL [` periodic `;` cc_gg_v11`] MP_TAC; +REWRITE_TAC[periodic_mult]; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +STRIP_TAC; +ASM_SEARCH_TCL [` cc_qy_v11 cc i ==> a + b <= c`] (MP_TAC o (SPEC` nj: num `)); +ANTS_TAC; +ASM_REWRITE_TAC[cc_qy_v11]; +PHA; +REAL_ARITH_TAC; + + +ASM_SEARCH_TCL [` {a,b} = {c,d} `] (SUBST1_TAC o SYM); +ASSUME_TAC2 (ISPECL [`nj: num`;` r:num `;` cc_gg_v11 cc `] Geomdetail.SUM_DIS2); +ASSUME_TAC2 (SET_RULE` {ii', jj} = {i,j:num} /\ ~( j = i) ==> ~( ii' = jj) `); +ASSUME_TAC2 (ISPECL [`ii': num`;` jj:num `;` cc_gg_v11 cc `] Geomdetail.SUM_DIS2); +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM (MP_TAC o (SPEC ` nj: num`)); +ANTS_TAC; +ASM_REWRITE_TAC[cc_qy_v11]; +FIRST_X_ASSUM (MP_TAC o (SPEC ` ii': num`)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[cc_qy_v11]; +ASM_REWRITE_TAC[]; +ASM_SEARCH_TCL [` periodic `;` cc_gg3a_v11`] MP_TAC; +ASM_SEARCH_TCL [` periodic `;` cc_gg_v11`] MP_TAC; +SIMP_TAC[periodic_mult]; +STRIP_TAC THEN STRIP_TAC; +ASM_SEARCH_TCL [` cc_qy_v11 cc i ==> a + b <= c`] (MP_TAC o (SPEC` r:num `)); +ANTS_TAC; +ASM_REWRITE_TAC[cc_qy_v11]; +ASM_SEARCH_TCL [` cc_qy_v11 cc i ==> a + b <= c`] (MP_TAC o (SPEC` nj:num `)); +ANTS_TAC; +ASM_REWRITE_TAC[cc_qy_v11]; +ASM_SEARCH_TCL [` cc_qy_v11 cc i ==> &0 <= x`;` cc_gg3b_v11 `] (MP_TAC o (SPEC` r:num `)); +ANTS_TAC; +ASM_REWRITE_TAC[cc_qy_v11]; +ASM_SEARCH_TCL [` cc_qy_v11 cc i ==> &0 <= x`;` cc_gg3a_v11 `] (MP_TAC o (SPEC` nj:num `)); +ANTS_TAC; +ASM_REWRITE_TAC[cc_qy_v11]; +REAL_ARITH_TAC; + +(* =============xxxxx=========================== *) + +FIRST_X_ASSUM MP_TAC; +ASM_REWRITE_TAC[]; +ABBREV_TAC` sts = {nj, r, i, j:num} `; +NHANH (SET_RULE` s SUBSET S ==> (S DIFF s) UNION s = S `); +REPEAT STRIP_TAC; +SUBGOAL_THEN` &0 <= sum ((0..nn - 1) DIFF sts) (cc_gg_v11 cc) ` MP_TAC; +MATCH_MP_TAC SUM_POS_LE; +CONJ_TAC; +MATCH_MP_TAC FINITE_DIFF; +REWRITE_TAC[FINITE_NUMSEG]; +GEN_TAC; +REWRITE_TAC[IN_DIFF]; +STRIP_TAC; +MATCH_MP_TAC QY_NN0; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[cc_real_model_v11]; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` ~( (x:num) IN sts ) `; +EXPAND_TAC "sts"; +REWRITE_TAC[IN_INSERT]; +CONV_TAC TAUT; +STRIP_TAC; +SUBGOAL_THEN` &0 <= sum ((0..nn - 1)) (cc_gg_v11 cc)` MP_TAC; +SUBGOAL_THEN` sum (0..nn - 1) (cc_gg_v11 cc) = sum ((0..nn - 1) DIFF sts) (cc_gg_v11 cc) + sum sts (cc_gg_v11 cc)` MP_TAC; +ASM_SEARCH_TCL [` a UNION b = c `] (fun x -> PAT_ONCE_REWRITE_TAC`\x. x = y `[SYM x]); +MATCH_MP_TAC SUM_UNION; +CONJ_TAC; +MATCH_MP_TAC FINITE_DIFF; +REWRITE_TAC[FINITE_NUMSEG]; +CONJ_TAC; +EXPAND_TAC "sts"; +REWRITE_TAC[Geomdetail.FINITE6]; +SET_TAC[]; +DISCH_THEN SUBST1_TAC; +MATCH_MP_TAC REAL_LE_ADD; +ASM_REWRITE_TAC[]; + +NHANH (REAL_ARITH` &0 <= a ==> ~( a < &0) `); +ASM_REWRITE_TAC[]; + +FIRST_X_ASSUM MP_TAC; +REWRITE_TAC[]; +STRIP_TAC; + +EXISTS_TAC`i:num `; +EXISTS_TAC`j:num `; +EXISTS_TAC`k:num `; +ASM_REWRITE_TAC[]]);; +====================================== *) +(* xxxxx *) + +(* =========================== +let oxl6142 = prove_by_refinement (CHQSQEY_concl, +[GEN_TAC; +ABBREV_TAC` indSet = 0..cc_card_v11 cc - 1 `; +STRIP_TAC; +MP_TAC WKR_COMPTED; +ANTS_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; + +REWRITE_TAC[cc_size_v11]; +SUBGOAL_THEN` {i,j,k} SUBSET {i | i IN 0..cc_card_v11 cc - 1 /\ cc_4cell_v11 cc i}` MP_TAC; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_ELIM_THM]; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` FINITE {i | i IN indSet /\ cc_4cell_v11 cc i} ` MP_TAC; +MATCH_MP_TAC FINITE_SUBSET; +EXISTS_TAC` indSet:num -> bool `; +EXPAND_TAC "indSet"; +REWRITE_TAC[FINITE_NUMSEG]; +SET_TAC[]; +FIRST_X_ASSUM MP_TAC; +PHA; +NHANH CARD_SUBSET; +STRIP_TAC; +ASM_SEARCH_TCL [` a \/ b`] MP_TAC; +REWRITE_TAC[GSYM Geomdetail.CARD3]; +DISCH_THEN SUBST_ALL_TAC; +FIRST_X_ASSUM ACCEPT_TAC]);; + + +=============================== *) + +(* ================================================ *) + +(* let CHQSQEY = oxl6142;; *) + +let SUM_BETA = prove(` sum S (\x. f x) = sum S f `, +MATCH_MP_TAC SUM_EQ THEN +REWRITE_TAC[BETA_THM]);; + + +let LXDEYBO = prove_by_refinement (LXDEYBO_concl, +[ GEN_TAC; +REWRITE_TAC[cc_bool_model_v11; cc_real_model_v11; cc_size_v11]; +STRIP_TAC; +ABBREV_TAC` cd = CARD {i | i IN 0..cc_card_v11 cc - 1 /\ cc_4cell_v11 cc i}`; +ASM_CASES_TAC` 4 < cd `; +ABBREV_TAC` ss = {i | i IN 0..cc_card_v11 cc - 1 /\ cc_4cell_v11 cc i}`; +ABBREV_TAC` S = 0..cc_card_v11 cc - 1 `; +SUBGOAL_THEN` sum ss (cc_gg_v11 cc) <= sum S (cc_gg_v11 cc) ` MP_TAC; +MATCH_MP_TAC SUM_SUBSET_SIMPLE; +CONJ_TAC; +EXPAND_TAC "S"; +REWRITE_TAC[FINITE_NUMSEG]; +EXPAND_TAC "ss"; +CONJ_TAC; +SET_TAC[]; +REWRITE_TAC[IN_DIFF; IN_ELIM_THM; DE_MORGAN_THM]; +REPEAT STRIP_TAC; +FIRST_X_ASSUM MP_TAC; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC QY_NN0; +ASM_REWRITE_TAC[cc_bool_model_v11; cc_real_model_v11; cc_qy_v11]; + +STRIP_TAC; +SUBGOAL_THEN` sum ss (\i. a_spine5 + b_spine5 * cc_azim_v11 cc i ) <= sum ss (cc_gg_v11 cc ) ` MP_TAC; +MATCH_MP_TAC SUM_LE; +CONJ_TAC; +MATCH_MP_TAC FINITE_SUBSET; +EXISTS_TAC` S: num -> bool `; +CONJ_TAC; +EXPAND_TAC "S"; +REWRITE_TAC[FINITE_NUMSEG]; +EXPAND_TAC "ss"; +SET_TAC[]; +EXPAND_TAC "ss"; +REWRITE_TAC[IN_ELIM_THM]; +ASM_SEARCH_TCL [` cc_4cell_v11 cc i ==> a <= b `] NHANH; +SIMP_TAC[]; + +SUBGOAL_THEN` sum ss (cc_azim_v11 cc ) <= &2 * pi ` MP_TAC; +ASM_SEARCH_TCL [`sum S (cc_azim_v11 cc) = &2 * pi `] (SUBST1_TAC o SYM); +MATCH_MP_TAC SUM_SUBSET_SIMPLE; + +CONJ_TAC; +EXPAND_TAC "S"; +REWRITE_TAC[FINITE_NUMSEG]; +CONJ_TAC; +EXPAND_TAC "ss"; +SET_TAC[]; + +REPEAT STRIP_TAC; +ASM_SEARCH_TCL [` (!i. #0.606 <= cc_azim_v11 cc i) `] MP_TAC; +DISCH_THEN (MP_TAC o (SPEC`x:num `)); +REAL_ARITH_TAC; + + +ONCE_REWRITE_TAC[MESON[ABS_SIMP]` (\i. a + f i ) = (\i. (\j. a) i + f i)`]; +STRIP_TAC THEN STRIP_TAC; +SUBGOAL_THEN` sum ss (\i. (\j. a_spine5) i + b_spine5 * cc_azim_v11 cc i) = +sum ss (\j. a_spine5) + sum ss (\i. b_spine5 * cc_azim_v11 cc i)` MP_TAC; +MATCH_MP_TAC SUM_ADD; +MATCH_MP_TAC FINITE_SUBSET; +EXISTS_TAC` S:num -> bool`; +EXPAND_TAC "S"; +REWRITE_TAC[FINITE_NUMSEG]; +ASM_REWRITE_TAC[]; +EXPAND_TAC "ss"; +SET_TAC[]; + +REWRITE_TAC[SUM_LMUL]; +REWRITE_TAC[Sphere.b_spine5; Sphere.a_spine5]; +SUBGOAL_THEN` FINITE (S:num -> bool) ` MP_TAC; +EXPAND_TAC "S"; +REWRITE_TAC[FINITE_NUMSEG]; +STRIP_TAC; +SUBGOAL_THEN` ss SUBSET (S:num -> bool) ` ASSUME_TAC; +EXPAND_TAC "ss"; +SET_TAC[]; +SUBGOAL_THEN` FINITE (ss:num -> bool) ` MP_TAC; +MATCH_MP_TAC FINITE_SUBSET; +EXISTS_TAC`S: num -> bool `; +ASM_REWRITE_TAC[FINITE_NUMSEG]; +STRIP_TAC; +ASSUME_TAC2 (ISPECL [` #0.0560305 `;`ss:num -> bool`] SUM_CONST); +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (ARITH_RULE` 4 < cd ==> 5 <= cd `); +FIRST_X_ASSUM MP_TAC; +FIRST_X_ASSUM MP_TAC; +ASM_REWRITE_TAC[GSYM REAL_OF_NUM_LE]; +REPEAT STRIP_TAC; + +SUBGOAL_THEN` &0 <= sum ss (cc_gg_v11 cc)` ASSUME_TAC; +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC` sum ss (\i. (\j. a_spine5) i + b_spine5 * cc_azim_v11 cc i) `; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[Sphere.a_spine5; Sphere.b_spine5]; +REWRITE_TAC[REAL_ARITH` &0 <= a + -- b * x <=> b * x <= a `]; +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC` #0.0445813 * ( &2 * pi) `; +ASM_REWRITE_TAC[REAL_ARITH` #0.0445813 * a <= #0.0445813 * b <=> a <= b `]; +ASM_REWRITE_TAC[ISPECL [`ss:num -> bool `;` cc_azim_v11 cc `] (GEN_ALL SUM_BETA)]; +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC` &5 * #0.0560305`; +ASM_REWRITE_TAC[REAL_ARITH` &5 * #0.0560305 <= &cd * #0.0560305 <=> &5 <= &cd`]; +MP_TAC (prove(` pi < #3.1416 `, REWRITE_TAC[ Flyspeck_constants.bounds])); +REAL_ARITH_TAC; + + +SUBGOAL_THEN` &0 <= sum S (cc_gg_v11 cc)` MP_TAC; +UNDISCH_TAC` &0 <= sum ss (cc_gg_v11 cc) `; +UNDISCH_TAC` sum ss (cc_gg_v11 cc) <= sum S (cc_gg_v11 cc) `; +REAL_ARITH_TAC; +UNDISCH_TAC` sum S (cc_gg_v11 cc) < &0 `; +REAL_ARITH_TAC; + +FIRST_X_ASSUM MP_TAC; +ARITH_TAC]);; + + +(* ================================== *) + +let IMP_TAC = ONCE_REWRITE_TAC[TAUT` a /\ b ==> c <=> a ==> b ==> c `];; + + + +(* the concls *) + +let MTMLSRF_concl = +`!cc. cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0 + ==> (?i. 0 < i /\ + cc_gg_v11 cc i < &0 /\ + cc_qu_v11 cc i /\ + cc_4cell_v11 cc (i + 1) /\ + cc_4cell_v11 cc (i - 1))`;; + +let UNPNFVW_concl = +`!cc. cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0 + ==> cc_size_v11 cc (cc_qy_v11 cc) <= 1`;; + +let IPVICGW_concl = + `!cc. cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0 + ==> (!i. cc_small_v11 cc i)`;; +let RSIWAMP_concl = `!cc. cc_bool_model_v11 cc /\ cc_bool_prep_v11 cc /\ cc_real_model_v11 cc /\ + (sum (0..cc_card_v11 cc -1) (cc_gg_v11 cc) < &0) ==> (cc_card_v11 cc <= 4)`;; + + + + + + + + +let MTMLSRF = prove_by_refinement (MTMLSRF_concl, +[REWRITE_TAC[cc_bool_model_v11; cc_real_model_v11]; +REPEAT STRIP_TAC; +ASM_CASES_TAC` ~(? i. 0 < i /\ cc_gg_v11 cc i < &0) `; +FIRST_X_ASSUM MP_TAC; +REWRITE_TAC[MESON[]` ~(?i. p i /\ q i) <=> ! i. p i ==> ~(q i )`]; +STRIP_TAC; +SUBGOAL_THEN` &0 <= sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) ` MP_TAC; +MATCH_MP_TAC SUM_POS_LE_NUMSEG; +REPEAT STRIP_TAC; +ASM_CASES_TAC` p = 0 `; +ASM_SEARCH_TCL [` periodic `; `cc_gg_v11 `] MP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +REWRITE_TAC[periodic]; +DISCH_THEN (SUBST1_TAC o SYM o (SPEC` 0`)); +REWRITE_TAC[REAL_ARITH` &0 <= x <=> ~( x < &0) `]; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_SEARCH_TCL [` ~( x = 0) `] MP_TAC; +ARITH_TAC; +REWRITE_TAC[REAL_ARITH` &0 <= x <=> ~( x < &0) `]; +FIRST_X_ASSUM MATCH_MP_TAC; +FIRST_X_ASSUM MP_TAC; +ARITH_TAC; +ASM_REWRITE_TAC[REAL_ARITH` &0 <= x <=> ~( x < &0) `]; +FIRST_X_ASSUM MP_TAC; +REWRITE_TAC[]; +STRIP_TAC; +ASM_CASES_TAC` ~( ?i. 0 < i /\ + cc_gg_v11 cc i < &0 /\ + cc_qu_v11 cc i /\ + cc_4cell_v11 cc (i + 1) /\ + cc_4cell_v11 cc (i - 1) ) `; +FIRST_X_ASSUM MP_TAC; +REWRITE_TAC[MESON[]` ~(?i. p1 i /\ p2 i /\ p3 i /\ p4 i) <=> (! i. p1 i /\ p2 i /\ +p3 i ==> ~( p4 i))`]; +STRIP_TAC; +ABBREV_TAC` S = 1..cc_card_v11 cc `; +ABBREV_TAC` cb i <=> cc_gg_v11 cc i < &0 /\ cc_qu_v11 cc i `; +ABBREV_TAC` sa = { i | i IN S /\ cb i /\ cc_qy_v11 cc (i + 1) }`; +ABBREV_TAC` sb = { i | i IN S /\ cb i /\ cc_qy_v11 cc ( i - 1)}`; +ABBREV_TAC` ss = {i | (i:num) IN S /\ cb i} `; + + +ABBREV_TAC` saa = { i + 1 | i + 1 IN S /\ cc_qy_v11 cc (i + 1) /\ cb i} `; +ABBREV_TAC` sbb = { i | i IN S /\ cc_qy_v11 cc i /\ cb ( i + 1)}`; +ABBREV_TAC` sab = { i | i IN S /\ cc_qy_v11 cc i /\ (cb (i + 1) \/ (cb ( i - 1)))} `; + +SUBGOAL_THEN` DISJOINT ss (sab: num -> bool) ` MP_TAC; +EXPAND_TAC "sab"; +EXPAND_TAC "ss"; +ASM_SEARCH_TCL [` a /\ b <=> f i `] ( fun x -> REWRITE_TAC[GSYM x]); +REWRITE_TAC[cc_qu_v11; cc_qy_v11]; +SET_TAC[]; +SUBGOAL_THEN` FINITE (S:num -> bool) ` MP_TAC; +EXPAND_TAC "S"; +REWRITE_TAC[FINITE_NUMSEG]; +STRIP_TAC; +SUBGOAL_THEN` ss SUBSET (S:num -> bool) /\ sab SUBSET S ` ASSUME_TAC; +EXPAND_TAC "ss"; +EXPAND_TAC "sab"; +SET_TAC[]; +SUBGOAL_THEN` FINITE (ss:num -> bool) ` MP_TAC; +MATCH_MP_TAC FINITE_SUBSET; +EXISTS_TAC `S:num -> bool `; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` FINITE (sab:num -> bool) ` ASSUME_TAC; +MATCH_MP_TAC FINITE_SUBSET; +EXISTS_TAC `S:num -> bool `; +ASM_REWRITE_TAC[]; + +STRIP_TAC; +SUBGOAL_THEN` sum saa (cc_gg3a_v11 cc) + sum sbb (cc_gg3b_v11 cc) + sum ss (cc_gg_v11 cc) <= sum (ss UNION sab) (cc_gg_v11 cc)` MP_TAC; +ASM_SIMP_TAC[SUM_UNION]; +REWRITE_TAC[REAL_ARITH` a + b + c <= c + d <=> a + b <= d `]; +SUBGOAL_THEN` sbb SUBSET (sab:num -> bool) /\ saa SUBSET (sab:num -> bool) ` ASSUME_TAC; +EXPAND_TAC "saa"; +EXPAND_TAC "sbb"; +EXPAND_TAC "sab"; +CONJ_TAC; +REWRITE_TAC[SUBSET; IN_ELIM_THM]; +MESON_TAC[]; +REWRITE_TAC[SUBSET; IN_ELIM_THM]; +MESON_TAC[ARITH_RULE` (i + 1) - 1 = i `]; +SUBGOAL_THEN` !x. x IN saa ==> cc_qy_v11 cc x ` ASSUME_TAC; +EXPAND_TAC "saa"; +SET_TAC[]; +SUBGOAL_THEN` !x. x IN sbb ==> cc_qy_v11 cc x ` ASSUME_TAC; +EXPAND_TAC "sbb"; +SET_TAC[]; +SUBGOAL_THEN` !x. x IN sab ==> cc_qy_v11 cc x ` ASSUME_TAC; +EXPAND_TAC "sab"; +SET_TAC[]; +SUBGOAL_THEN` sum saa (cc_gg3a_v11 cc) <= sum sab (cc_gg3a_v11 cc) ` MP_TAC; +MATCH_MP_TAC SUM_SUBSET_SIMPLE; +ASM_REWRITE_TAC[IN_DIFF]; +FIRST_ASSUM NHANH; +ASM_SEARCH_TCL [` cc_qy_v11 cc i ==> c <= cc_gg3a_v11 cc i `] NHANH; +SIMP_TAC[]; + +SUBGOAL_THEN` sum sbb (cc_gg3b_v11 cc) <= + sum sab (cc_gg3b_v11 cc)` MP_TAC; +MATCH_MP_TAC SUM_SUBSET_SIMPLE; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[IN_DIFF]; +FIRST_ASSUM NHANH; +ASM_SEARCH_TCL [` cc_qy_v11 cc i ==> c <= cc_gg3b_v11 cc i `] NHANH THEN +SIMP_TAC[]; +SUBGOAL_THEN` sum sab (cc_gg3a_v11 cc) + sum sab (cc_gg3b_v11 cc) <= sum sab (cc_gg_v11 cc) ` MP_TAC; +ASSUME_TAC2 (ISPECL [` cc_gg3a_v11 cc `;` cc_gg3b_v11 cc `;` sab:num -> bool `] SUM_ADD); +FIRST_X_ASSUM (SUBST1_TAC o SYM); +MATCH_MP_TAC SUM_LE; +ASM_REWRITE_TAC[]; +FIRST_ASSUM NHANH; +ASM_SEARCH_TCL [` cc_qy_v11 cc i ==> a + b <= c`] NHANH; +SIMP_TAC[]; +REAL_ARITH_TAC; +STRIP_TAC; + +SUBGOAL_THEN`&0 <= sum saa (cc_gg3a_v11 cc) + + sum sbb (cc_gg3b_v11 cc) + + sum ss (cc_gg_v11 cc) ` MP_TAC; +SUBGOAL_THEN` sa SUBSET (ss:num -> bool) ` MP_TAC; +EXPAND_TAC "sa"; +EXPAND_TAC "ss"; +SET_TAC[]; +NHANH (SET_RULE` s SUBSET S ==> DISJOINT s (S DIFF s) /\ s UNION ( S DIFF s) = S`); +STRIP_TAC; +FIRST_ASSUM (SUBST1_TAC o SYM); +SUBGOAL_THEN` FINITE (sa:num -> bool) ` ASSUME_TAC; +MATCH_MP_TAC FINITE_SUBSET; +EXISTS_TAC` ss: num -> bool `; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` FINITE (ss DIFF (sa:num -> bool)) ` ASSUME_TAC; +MATCH_MP_TAC FINITE_DIFF; +FIRST_X_ASSUM ACCEPT_TAC; +ASM_SIMP_TAC[SUM_UNION]; + + +SUBGOAL_THEN` sum saa (cc_gg3a_v11 cc) = sum sa (\i. cc_gg3a_v11 cc (i + 1)) ` MP_TAC; +MATCH_MP_TAC (GSYM SUM_EQ_GENERAL); +ABBREV_TAC` nn = cc_card_v11 cc `; + +EXISTS_TAC`\i. if i = nn then 1 else i + 1 `; +CONJ_TAC; +GEN_TAC; +EXPAND_TAC "sa"; +EXPAND_TAC "saa"; +REWRITE_TAC[IN_ELIM_THM; EXISTS_UNIQUE]; +STRIP_TAC; +ASM_CASES_TAC` 0 < i' `; +EXISTS_TAC` i':num `; +ASM_REWRITE_TAC[]; +CONJ_TAC; +CONJ_TAC; +UNDISCH_TAC` i' + 1 IN S `; +FIRST_X_ASSUM MP_TAC; +EXPAND_TAC "S"; +REWRITE_TAC[IN_NUMSEG]; +ARITH_TAC; +SUBGOAL_THEN` ~(i' = (nn:num)) ` MP_TAC; +UNDISCH_TAC` i' + 1 IN S `; +EXPAND_TAC "S"; +REWRITE_TAC[IN_NUMSEG]; +ARITH_TAC; +SIMP_TAC[]; +GEN_TAC; + +EXPAND_TAC "S"; +REWRITE_TAC[IN_NUMSEG]; +ASM_CASES_TAC` y' = (nn:num) `; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM SUBST_ALL_TAC; +NHANH (ARITH_RULE` a + 1 = 1 ==> ~( 0 < a) `); +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[]; +ARITH_TAC; +SUBST_ALL_TAC (ARITH_RULE` ~( 0 < i') <=> i' = 0 `); +EXISTS_TAC `nn:num `; +ASM_REWRITE_TAC[]; +CONJ_TAC; +EXPAND_TAC "S"; +REWRITE_TAC[IN_NUMSEG; LE_REFL; ADD]; +MP_TAC (SPEC_ALL CC_CARD2); +ANTS_TAC; +ASM_REWRITE_TAC[cc_bool_model_v11; cc_real_model_v11]; +ASM_SIMP_TAC[ARITH_RULE` 2 <= nn ==> 1 <= nn `]; +STRIP_TAC; +ASM_SEARCH_TCL [` periodic`; `cc_gg_v11 `] MP_TAC; +ASM_SEARCH_TCL [` cc_bool_prep_v11 `] MP_TAC; +REWRITE_TAC[cc_bool_prep_v11]; +MP_TAC (SPEC_ALL periodic_fn); +ANTS_TAC; +ASM_REWRITE_TAC[cc_bool_model_v11]; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SIMP_TAC[Oxl_def.periodic]; +STRIP_TAC; +UNDISCH_TAC`(cb: num -> bool) i'`; +ASM_REWRITE_TAC[]; +ASM_SEARCH_TCL [` a /\ b <=> c `] (fun x -> REWRITE_TAC[GSYM x]); +FIRST_X_ASSUM MP_TAC; +UNDISCH_TAC` cc_qy_v11 cc (i' + 1) `; +ASM_SEARCH_TCL [` periodic `;` cc_qu_v11`] MP_TAC; +ASM_SEARCH_TCL [` periodic `;` cc_qy_v11`] MP_TAC; +ASM_SEARCH_TCL [` periodic `;` cc_gg_v11`] MP_TAC; +SIMP_TAC[Oxl_def.periodic]; +UNDISCH_TAC` i' = 0 `; +SIMP_TAC[ADD;ADD_SYM]; +MESON_TAC[ADD; ADD_SYM]; + +GEN_TAC; +EXPAND_TAC "S"; +REWRITE_TAC[IN_NUMSEG]; +ASM_CASES_TAC` y' = (nn:num) `; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[]; +ARITH_TAC; + + +GEN_TAC; +EXPAND_TAC "sa"; +EXPAND_TAC "saa"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +CONJ_TAC; +ASM_CASES_TAC` x = (nn: num) `; +EXISTS_TAC` 0`; +ASM_REWRITE_TAC[ADD]; +EXPAND_TAC "S"; +REWRITE_TAC[IN_NUMSEG]; +CONJ_TAC; +MP_TAC (SPEC_ALL CC_CARD2); +ANTS_TAC; +ASM_REWRITE_TAC[cc_bool_model_v11; cc_real_model_v11]; +ASM_REWRITE_TAC[]; +ARITH_TAC; + + +FIRST_X_ASSUM SUBST_ALL_TAC; +REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); +ASM_SEARCH_TCL [` a /\ b <=> c `] (fun x -> REWRITE_TAC[GSYM x]); +ASM_SEARCH_TCL [` periodic `;` cc_gg_v11 `] MP_TAC; +MP_TAC (SPEC_ALL periodic_fn); +ANTS_TAC; +ASM_REWRITE_TAC[cc_bool_model_v11]; +STRIP_TAC; +ASM_SEARCH_TCL [` periodic `;` cc_qy_v11 `] MP_TAC; +ASM_SEARCH_TCL [` periodic `;` cc_qu_v11 `] MP_TAC; +SIMP_TAC[Oxl_def.periodic]; +ASM_SEARCH_TCL [` cc_card_v11 cc = nn `] SUBST1_TAC; + +MESON_TAC[ADD; ADD_SYM]; +EXISTS_TAC `x:num `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` (x:num) IN S `; +EXPAND_TAC "S"; +REWRITE_TAC[IN_NUMSEG]; +FIRST_X_ASSUM MP_TAC; +ARITH_TAC; + +ASM_CASES_TAC` x = (nn:num) `; +ASM_REWRITE_TAC[]; +ASM_SEARCH_TCL [` periodic (cc_gg3a_v11 cc) `] MP_TAC; +REWRITE_TAC[Oxl_def.periodic]; +MESON_TAC[ADD_SYM]; +ASM_REWRITE_TAC[]; + +MP_TAC (SPEC_ALL periodic_fn); +ANTS_TAC; +ASM_REWRITE_TAC[cc_bool_model_v11]; +ABBREV_TAC` nn = cc_card_v11 cc `; +STRIP_TAC; +SUBGOAL_THEN ` ss DIFF sa SUBSET (sb: num -> bool) ` MP_TAC; +UNDISCH_TAC` {i | (i:num) IN S /\ cb i} = ss `; +STRIP_TAC; +EXPAND_TAC "ss"; +EXPAND_TAC "sa"; +EXPAND_TAC "sb"; + +REWRITE_TAC[SUBSET; IN_DIFF; IN_ELIM_THM]; +SUBGOAL_THEN` !x. (x IN S /\ cb x) ==> ~(cc_4cell_v11 cc (x + 1) /\ cc_4cell_v11 cc (x - 1))` MP_TAC; +GEN_TAC THEN STRIP_TAC; +FIRST_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` (x:num) IN S `; +EXPAND_TAC "S"; +REWRITE_TAC[IN_NUMSEG]; +ARITH_TAC; +REWRITE_TAC[cc_qy_v11]; +MESON_TAC[]; + + +SUBGOAL_THEN` sum sbb (cc_gg3b_v11 cc) = sum sb (\i. cc_gg3b_v11 cc ( i - 1))` MP_TAC; +MATCH_MP_TAC SUM_EQ_GENERAL; +EXISTS_TAC`\i. if i = nn then 1 else i + 1 `; +CONJ_TAC; +REWRITE_TAC[EXISTS_UNIQUE]; +GEN_TAC; +EXPAND_TAC "sb"; +REWRITE_TAC[IN_ELIM_THM]; +EXPAND_TAC "sbb"; +EXPAND_TAC "S"; +REWRITE_TAC[IN_NUMSEG]; +STRIP_TAC; +ASM_CASES_TAC` y = 1 `; +EXISTS_TAC` nn:num`; +REWRITE_TAC[IN_ELIM_THM]; +CONJ_TAC; +ASM_REWRITE_TAC[]; +CONJ_TAC; +STRIP_TAC; +MP_TAC (SPEC_ALL CC_CARD2); +ANTS_TAC; +ASM_REWRITE_TAC[cc_bool_model_v11; cc_real_model_v11]; +ASM_REWRITE_TAC[]; + +ARITH_TAC; +REWRITE_TAC[LE_REFL]; +FIRST_X_ASSUM SUBST_ALL_TAC; +FIRST_X_ASSUM MP_TAC; +FIRST_X_ASSUM MP_TAC; +ASM_SEARCH_TCL [` a /\ b <=> c `] MP_TAC; +DISCH_THEN (fun x -> REWRITE_TAC[GSYM x]); +ASM_SEARCH_TCL [` periodic (cc_gg_v11 cc) `] MP_TAC; +ASM_SEARCH_TCL [` periodic (cc_qy_v11 cc) `] MP_TAC; +ASM_SEARCH_TCL [` periodic (cc_qu_v11 cc) `] MP_TAC; +REWRITE_TAC[Oxl_def.periodic; SUB_REFL]; +MESON_TAC[ADD; ADD_SYM]; +GEN_TAC; +ASM_CASES_TAC` y' = (nn:num) `; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[]; +ARITH_TAC; +EXISTS_TAC` y - 1 `; +CONJ_TAC; +ASSUME_TAC2 (ARITH_RULE` 1 <= y /\ y <= nn ==> ~( y - 1 = nn) `); +ASM_REWRITE_TAC[IN_ELIM_THM]; +ASSUME_TAC2 (ARITH_RULE` 1 <= y /\ y <= nn ==> y - 1 + 1 = y /\ y - 1 <= nn`); +ASM_REWRITE_TAC[]; +UNDISCH_TAC` 1 <= y `; +UNDISCH_TAC` ~( y = 1) `; +ARITH_TAC; +GEN_TAC; + +ASM_CASES_TAC` y' = (nn:num) `; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[]; +STRIP_TAC; +FIRST_X_ASSUM MP_TAC; +UNDISCH_TAC` 1 <= y `; +ARITH_TAC; +GEN_TAC; +EXPAND_TAC "sbb"; +EXPAND_TAC "sb"; +EXPAND_TAC "S"; +REWRITE_TAC[IN_ELIM_THM; IN_NUMSEG]; +STRIP_TAC; +ASM_CASES_TAC` x = (nn: num) `; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM SUBST_ALL_TAC; +CONJ_TAC; +CONJ_TAC; +UNDISCH_TAC` 1 <= nn `; +ARITH_TAC; + +UNDISCH_TAC` (cb:num -> bool) (nn + 1) `; +UNDISCH_TAC` cc_qy_v11 cc nn `; +ASM_SEARCH_TCL [` a /\ b <=> c `] (fun x -> REWRITE_TAC[GSYM x]); +ASM_SEARCH_TCL [` periodic (cc_gg_v11 cc) `] MP_TAC; +ASM_SEARCH_TCL [` periodic (cc_qu_v11 cc) `] MP_TAC; +ASM_SEARCH_TCL [` periodic (cc_qy_v11 cc) `] MP_TAC; +REWRITE_TAC[Oxl_def.periodic; SUB_REFL]; +MESON_TAC[ADD; ADD_SYM]; + +REWRITE_TAC[SUB_REFL]; +ASM_SEARCH_TCL [` periodic (cc_gg3b_v11 cc) `] MP_TAC; +REWRITE_TAC[Oxl_def.periodic]; +MESON_TAC[ADD; ADD_SYM]; + +ASM_REWRITE_TAC[ARITH_RULE` (a + 1) - 1 = a /\ 1 <= a + 1`]; +UNDISCH_TAC` x <= (nn:num) `; +FIRST_X_ASSUM MP_TAC; +ARITH_TAC; + + +SIMP_TAC[]; + +REPEAT STRIP_TAC; +SUBGOAL_THEN` sum (ss DIFF sa) (\i. cc_gg3b_v11 cc (i - 1)) <= sum sb (\i. cc_gg3b_v11 cc (i - 1))` MP_TAC; +MATCH_MP_TAC SUM_SUBSET_SIMPLE; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` sb SUBSET (S:num -> bool) ` ASSUME_TAC; +EXPAND_TAC "sb"; +SET_TAC[]; +CONJ_TAC; +MATCH_MP_TAC FINITE_SUBSET; +EXISTS_TAC` S: num -> bool `; +ASM_REWRITE_TAC[]; + +EXPAND_TAC "sb"; +REWRITE_TAC[IN_DIFF; IN_ELIM_THM]; +ASM_SEARCH_TCL [` cc_qy_v11 cc i ==> &0 <= cc_gg3b_v11 cc i `] NHANH; +SIMP_TAC[]; + +STRIP_TAC; +SUBGOAL_THEN` &0 <= sum sa (\i. cc_gg3a_v11 cc (i + 1)) + + sum sa (cc_gg_v11 cc) ` ASSUME_TAC; +ASM_SIMP_TAC[GSYM SUM_ADD]; +MATCH_MP_TAC SUM_POS_LE; +ASM_REWRITE_TAC[]; +EXPAND_TAC "sa"; +REWRITE_TAC[IN_ELIM_THM]; +ASM_SEARCH_TCL [` a /\ b <=> c `] (fun x -> REWRITE_TAC[ GSYM x]); +ASM_SEARCH_TCL [` x /\ cc_qy_v11 cc (i + 1) ==> a `] MP_TAC; +REWRITE_TAC[cc_eps]; +MESON_TAC[REAL_ADD_SYM; REAL_ARITH` &0 <= #0.0057`; REAL_LE_TRANS]; + + +SUBGOAL_THEN` &0 <= sum (ss DIFF sa) (\i. cc_gg3b_v11 cc (i - 1)) + sum (ss DIFF sa) (cc_gg_v11 cc) ` ASSUME_TAC; +SUBGOAL_THEN` FINITE (ss DIFF (sa:num -> bool)) ` MP_TAC; +MATCH_MP_TAC FINITE_DIFF; +FIRST_X_ASSUM ACCEPT_TAC; +SIMP_TAC[GSYM SUM_ADD]; +STRIP_TAC; +MATCH_MP_TAC SUM_POS_LE; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` ss DIFF sa SUBSET (sb:num -> bool) `; +REWRITE_TAC[SUBSET]; +DISCH_THEN NHANH; +EXPAND_TAC "sb"; +EXPAND_TAC "S"; +REWRITE_TAC[IN_NUMSEG; IN_ELIM_THM]; +NHANH (ARITH_RULE` 1 <= x ==> x - 1 + 1 = x `); +ASM_SEARCH_TCL [` a /\ b <=> v`] (fun x -> REWRITE_TAC[GSYM x]); +ASM_SEARCH_TCL [` cc_qu_v11 cc (i + 1) /\ cc_qy_v11 cc i ==> a `] MP_TAC; +REWRITE_TAC[cc_eps]; +MESON_TAC[REAL_ADD_SYM; REAL_ARITH` &0 <= #0.0057`; REAL_LE_TRANS]; +REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC); +REAL_ARITH_TAC; + +SUBGOAL_THEN` ss UNION sab SUBSET (S:num -> bool) ` MP_TAC; +EXPAND_TAC "ss"; +EXPAND_TAC "sab"; +SET_TAC[]; +NHANH (SET_RULE` s SUBSET S ==> (S DIFF s ) UNION s = S /\ DISJOINT (S DIFF s) s`); +ABBREV_TAC` sg = ss UNION (sab:num -> bool) `; +STRIP_TAC; +SUBGOAL_THEN` FINITE (sg: num -> bool) ` ASSUME_TAC; +MATCH_MP_TAC FINITE_SUBSET; +EXISTS_TAC` S:num -> bool `; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` FINITE (S DIFF (sg:num -> bool)) ` ASSUME_TAC; +MATCH_MP_TAC FINITE_DIFF; +FIRST_X_ASSUM ACCEPT_TAC; +STRIP_TAC; +SUBGOAL_THEN` &0 <= sum S (cc_gg_v11 cc) ` MP_TAC; +ASM_SIMP_TAC[SUM_UNION]; +EXPAND_TAC "S"; +REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC); +ASM_SIMP_TAC[SUM_UNION]; +REPEAT STRIP_TAC; +MATCH_MP_TAC REAL_LE_ADD; +CONJ_TAC; +MATCH_MP_TAC SUM_POS_LE; +ASM_REWRITE_TAC[]; + +GEN_TAC; +EXPAND_TAC "sg"; +EXPAND_TAC "ss"; +REWRITE_TAC[IN_DIFF; IN_ELIM_THM; IN_UNION]; +ASM_SEARCH_TCL [` a /\ b <=> c `] (fun x -> REWRITE_TAC[GSYM x]); +REWRITE_TAC[DE_MORGAN_THM]; +IMP_TAC; +SIMP_TAC[]; +REPEAT STRIP_TAC; +UNDISCH_TAC` ~( cc_gg_v11 cc x < &0 ) `; +REAL_ARITH_TAC; +SUBGOAL_THEN ` cc_bool_model_v11 cc ` MP_TAC; +ASM_REWRITE_TAC[cc_bool_model_v11]; +NHANH (SPECL [`cc: cc_v11`;` x:num `] QY_QX_QU); +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` cc_real_model_v11 cc ` MP_TAC; +ASM_REWRITE_TAC[cc_real_model_v11]; +MESON_TAC[QY_NN0; QX_NN0]; +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC` sum saa (cc_gg3a_v11 cc) + + sum sbb (cc_gg3b_v11 cc) + + sum ss (cc_gg_v11 cc) `; +ASM_REWRITE_TAC[]; +ABBREV_TAC` nn = cc_card_v11 cc `; +STRIP_TAC; +UNDISCH_TAC` ~( nn = 0 ) `; +ASM_SEARCH_TCL [` periodic (cc_gg_v11 cc) `] MP_TAC; +PHA; +NHANH periodic_sum; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC ` 1 `)); +ASSUME_TAC2 (ARITH_RULE` ~( nn = 0) ==> nn - 1 + 1 = nn `); +ASM_REWRITE_TAC[]; +STRIP_TAC; +UNDISCH_TAC` &0 <= sum S (cc_gg_v11 cc) `; +ASM_REWRITE_TAC[REAL_ARITH` &0 <= x <=> ~( x < &0)`]; +FIRST_X_ASSUM MP_TAC; +SIMP_TAC[]]);; + + + + +let MOD_INJ1 = prove_by_refinement +(` ~( n = 0) /\ k < n /\ ~( k = 0) ==> (! x. ~( x MOD n = (x + k) MOD n)) `, +[REPEAT STRIP_TAC; +MP_TAC (SPECL [` n: num `;` x:num `;` x:num `;` x + k:num`] MOD_INJ); +ANTS_TAC; +ASM_REWRITE_TAC[IN_NUMSEG]; +DOWN_TAC; +SIMP_TAC[LE_REFL; ARITH_RULE` ~( n = 0) ==> x <= n - 1 + x `; ARITH_RULE` a <= a + x:num `]; +STRIP_TAC; +UNDISCH_TAC` k < (n:num) `; +ARITH_TAC; +UNDISCH_TAC` ~( k = 0) `; +ARITH_TAC]);; + + + + +(* TTTTTT *) + + + +(* ========================================== *) +(* WKR_COMPTED *) + + + +let WKR_COMPTED = prove_by_refinement (`cc_bool_model_v11 cc /\ +cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0 /\ + indSet = 0..cc_card_v11 cc - 1 + ==> (?i j k. + ~(i = j \/ j = k \/ k = i) /\ + i IN indSet /\ + j IN indSet /\ + k IN indSet /\ + cc_4cell_v11 cc i /\ + cc_4cell_v11 cc j /\ + cc_4cell_v11 cc k)`, [STRIP_TAC; +ASSUME_TAC2 (SPEC_ALL MTMLSRF); +ASSUME_TAC2 Oxl_def.CC_CARD2; +DOWN_TAC; +REWRITE_TAC[cc_real_model_v11; cc_qu_v11; cc_bool_model_v11]; +STRIP_TAC; +ASM_CASES_TAC` cc_card_v11 cc = 2 `; +ASM_SEARCH_TCL [` x = &2 * pi `] MP_TAC; +FIRST_ASSUM SUBST1_TAC; +REWRITE_TAC[ARITH_RULE` 2 - 1 = 1 `]; +MP_TAC (ARITH_RULE` 0 < 1 /\ 0 <= 1 `); +SIMP_TAC[SUM_CLAUSES_RIGHT; SUB_REFL; SUM_SING_NUMSEG]; +STRIP_TAC THEN STRIP_TAC; +ABBREV_TAC` nn = cc_card_v11 cc `; +SUBGOAL_THEN` {i MOD nn, (i + 1) MOD nn} SUBSET 0..nn - 1 ` MP_TAC; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; + +UNDISCH_TAC` ~(nn = 0) `; +MESON_TAC[Oxl_def.MOD_IN_NUMSEG]; +MP_TAC (SPECL [`1 `;` 2 `] (GEN_ALL MOD_INJ1)); +ANTS_TAC; +ARITH_TAC; +MP_TAC (SPECL [` 0`;` 2 - 1 `] CARD_NUMSEG); +ASM_REWRITE_TAC[ARITH_RULE` (2 - 1 + 1) - 0 = 2 `]; +REPEAT STRIP_TAC; +SUBGOAL_THEN` {i MOD 2, (i + 1) MOD 2} = 0..2 - 1` MP_TAC; +MATCH_MP_TAC CARD_SUBSET_EQ; +ASM_REWRITE_TAC[FINITE_NUMSEG; Geomdetail.CARD_SET2]; + + +DISCH_THEN (ASSUME_TAC o SYM); + +ASM_SEARCH_TCL [` sum s f = &2 * pi `] MP_TAC; +UNDISCH_TAC` nn = 2 `; +SIMP_TAC[]; +ASM_SIMP_TAC[]; +FIRST_X_ASSUM (MP_TAC o (SPEC` i: num `)); +SIMP_TAC[Geomdetail.SUM_DIS2]; +REPEAT STRIP_TAC; +SUBGOAL_THEN` cc_4cell_v11 cc (i MOD 2) /\ cc_4cell_v11 cc ((i + 1) MOD 2) ` MP_TAC; +UNDISCH_TAC ` ~( nn = 0 ) `; +UNDISCH_TAC` periodic (cc_4cell_v11 cc) nn `; +PHA; +UNDISCH_TAC` cc_4cell_v11 cc (i) `; +UNDISCH_TAC` cc_4cell_v11 cc (i + 1) `; +ASM_REWRITE_TAC[]; +MESON_TAC[Oxl_def.periodic_mod]; +ASM_SEARCH_TCL [` cc_azim_v11 `;` #2.8`] (NHANH_PAT` \x. x ==> y `); + +DOWN; +MP_TAC (prove(` #3.14159 < pi`, REWRITE_TAC[ Flyspeck_constants.bounds])); +REAL_ARITH_TAC; + + +ABBREV_TAC` nn = cc_card_v11 cc `; +EXISTS_TAC` (i - 1) MOD nn`; +EXISTS_TAC` (i) MOD nn`; +EXISTS_TAC` (i + 1) MOD nn`; +MP_TAC (ISPECL [` 1 `;`nn: num `] (GEN_ALL MOD_INJ1)); +MP_TAC (ISPECL [` 2 `;`nn: num `] (GEN_ALL MOD_INJ1)); +ANTS_TAC; +ASM_REWRITE_TAC[ARITH_RULE` ~( 2 = 0) /\ (2 < nn <=> 2 <= nn /\ ~( nn = 2))`]; +STRIP_TAC; +ANTS_TAC; +ASM_SIMP_TAC[ARITH_RULE` ~( 1 = 0) /\ ( 2 <= x ==> 1 < x)`]; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPEC` i: num `)); +FIRST_X_ASSUM (MP_TAC o (SPEC` i - 1 `)); +FIRST_ASSUM (MP_TAC o (SPEC` i - 1 `)); +UNDISCH_TAC` 0 < i `; +SIMP_TAC[ARITH_RULE` 0 < i ==> i - 1 + 1 = i /\ i - 1 + 2 = i + 1 `]; +REPLICATE_TAC 4 STRIP_TAC; +ASM_SIMP_TAC[MOD_IN_NUMSEG]; +ASM_SEARCH_TCL [` periodic `;` cc_4cell_v11 `] MP_TAC; +UNDISCH_TAC` cc_4cell_v11 cc (i - 1) `; +UNDISCH_TAC` cc_4cell_v11 cc (i) `; +UNDISCH_TAC` cc_4cell_v11 cc (i + 1) `; +UNDISCH_TAC` ~( nn = 0) `; +MESON_TAC[Oxl_def.periodic_mod]]);; + + + + +let oxl6142 = prove_by_refinement (CHQSQEY_concl, +[GEN_TAC; +ABBREV_TAC` indSet = 0..cc_card_v11 cc - 1 `; +STRIP_TAC; +MP_TAC WKR_COMPTED; +ANTS_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; + +REWRITE_TAC[cc_size_v11]; +SUBGOAL_THEN` {i,j,k} SUBSET {i | i IN 0..cc_card_v11 cc - 1 /\ cc_4cell_v11 cc i}` MP_TAC; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_ELIM_THM]; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` FINITE {i | i IN indSet /\ cc_4cell_v11 cc i} ` MP_TAC; +MATCH_MP_TAC FINITE_SUBSET; +EXISTS_TAC` indSet:num -> bool `; +EXPAND_TAC "indSet"; +REWRITE_TAC[FINITE_NUMSEG]; +SET_TAC[]; +FIRST_X_ASSUM MP_TAC; +PHA; +NHANH CARD_SUBSET; +STRIP_TAC; +ASM_SEARCH_TCL [` a \/ b`] MP_TAC; +REWRITE_TAC[GSYM Geomdetail.CARD3]; +DISCH_THEN SUBST_ALL_TAC; +FIRST_X_ASSUM ACCEPT_TAC]);; + + +let CHQSQEY = oxl6142;; + + +let THREE_LE_CC_CARD = prove_by_refinement (` cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0 + ==> 3 <= cc_card_v11 cc `, +[NHANH CHQSQEY; +REWRITE_TAC[cc_size_v11]; +ABBREV_TAC` sn = 0..cc_card_v11 cc - 1 `; +STRIP_TAC; +ASSUME_TAC (SET_RULE` {i | i IN sn /\ cc_4cell_v11 cc i} SUBSET sn`); +SUBGOAL_THEN` FINITE (sn:num -> bool) ` MP_TAC; +EXPAND_TAC "sn"; +REWRITE_TAC[FINITE_NUMSEG]; +FIRST_X_ASSUM MP_TAC; +PHA; +NHANH CARD_SUBSET; +STRIP_TAC; +ABBREV_TAC` c4 = CARD {i | i IN sn /\ cc_4cell_v11 cc i} `; +ASSUME_TAC2 (ARITH_RULE` 3 <= c4 /\ c4 <= CARD (sn:num -> bool) ==> 3 <= CARD sn`); +FIRST_X_ASSUM MP_TAC; +EXPAND_TAC "sn"; +REWRITE_TAC[CARD_NUMSEG]; +ARITH_TAC]);; + + + + +let THREE_MOD_CONSECUTIVES = prove_by_refinement ( +` 0 < i /\ 3 <= n ==> ~( (i - 1) MOD n = i MOD n \/ i MOD n = (i + 1) MOD n \/ +(i + 1) MOD n = (i - 1) MOD n )`, +[NHANH (ARITH_RULE` 3 <= n ==> 2 < n /\ 1 < n /\ ~(n = 0)`); +STRIP_TAC; +MP_TAC (SPECL [` 2`;` n:num `] (GEN_ALL MOD_INJ1)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +ARITH_TAC; +MP_TAC (SPECL [` 1`;` n:num `] (GEN_ALL MOD_INJ1)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +ARITH_TAC; +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC o (SPEC` i - 1 `)); +FIRST_X_ASSUM (ASSUME_TAC o (SPEC` i:num `)); +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` i - 1 `)); +REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC); +PHA; +ASSUME_TAC2 (ARITH_RULE` 0 < i ==> i - 1 + 1 = i /\ i - 1 + 2 = i + 1 `); +ASM_REWRITE_TAC[]; +MESON_TAC[]]);; + + + +let MOD_PERIOD_BOUNDED = prove_by_refinement ( +` ~( n = 0) /\ ~( k = 0) ==> (! x. (x + k) MOD n = x MOD n ==> n <= k ) `, +[REPEAT STRIP_TAC; +ASM_CASES_TAC` n <= (k:num) `; +ASM_REWRITE_TAC[]; +MP_TAC MOD_INJ1; +ANTS_TAC; +ASM_REWRITE_TAC[ARITH_RULE` a < (b:num) <=> ~(b <= a ) `]; +ASM_MESON_TAC[]]);; + + + +let MOD_PERIOD_BOUNDED2 = prove_by_refinement +(` ~(nn = 0) /\ m <= k /\ +(i + k ) MOD nn IN { (i + x) MOD nn | x < m } ==> nn <= k `, +[REWRITE_TAC[IN_ELIM_THM] ; +STRIP_TAC ; +MP_TAC (SPECL [` nn:num `;` k - (x:num) `] (GEN_ALL MOD_PERIOD_BOUNDED)) ; +ANTS_TAC ; +ASM_REWRITE_TAC[] ; +ASM_ARITH_TAC ; +DISCH_THEN (MP_TAC o (SPEC` i + (x:num) `)) ; +ANTS_TAC ; +ASSUME_TAC2 (ARITH_RULE` x < m /\ m <= (k:num) ==> (i + x) + k - x = i + k `) ; +ASM_REWRITE_TAC[] ; +ARITH_TAC]);; + + + +let CARD_EMPTY = el 0 (CONJUNCTS CARD_CLAUSES);; + +let CARD_INSERT = el 1 (CONJUNCTS CARD_CLAUSES);; +let SWITCH_TAC tm = UNDISCH_TAC tm THEN DISCH_THEN (ASSUME_TAC o GSYM);; + + + +(* ===================================== *) + + + + +let UNPNFVW = prove_by_refinement ( UNPNFVW_concl, + +[ NHANH THREE_LE_CC_CARD; +NHANH MTMLSRF; +NHANH CHQSQEY; +REPEAT STRIP_TAC; +ABBREV_TAC` indSet = 0..cc_card_v11 cc - 1 `; +MP_TAC WKR_COMPTED; +ANTS_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASSUME_TAC2 (SPEC_ALL LXDEYBO); +ABBREV_TAC` sz = cc_size_v11 cc (cc_4cell_v11 cc) ` ; +ASM_CASES_TAC` cc_size_v11 cc (cc_4cell_v11 cc) = 3 `; +ABBREV_TAC` nn = cc_card_v11 cc `; +UNDISCH_TAC` 3 <= nn `; +UNDISCH_TAC` 0 < i `; +PHA; +NHANH THREE_MOD_CONSECUTIVES; +REWRITE_TAC[GSYM Geomdetail.CARD3]; +ABBREV_TAC` ia = (i - 1) MOD nn `; +ABBREV_TAC` ib = i MOD nn `; +ABBREV_TAC ` ic = (i + 1) MOD nn `; +SUBGOAL_THEN` cc_4cell_v11 cc ia /\ cc_4cell_v11 cc ib /\ cc_4cell_v11 cc ic ` MP_TAC; +UNDISCH_TAC` cc_qu_v11 cc i `; +REWRITE_TAC[cc_qu_v11]; +ASM_SEARCH_TCL [` cc_bool_model_v11 `] MP_TAC; +REWRITE_TAC[cc_bool_model_v11]; +ASM_REWRITE_TAC[]; +ASM_MESON_TAC[periodic_mod]; +REPEAT STRIP_TAC; +ASSUME_TAC2 (ARITH_RULE` 3 <= nn ==> ~( nn = 0) `); +ASM_SEARCH_TCL [` cc_qu_v11 `] MP_TAC; +REWRITE_TAC[cc_qu_v11] THEN STRIP_TAC; +SUBGOAL_THEN`! i. cc_4cell_v11 cc (i MOD nn) = cc_4cell_v11 cc i ` MP_TAC; +GEN_TAC; +MATCH_MP_TAC (GSYM periodic_mod); +ASM_REWRITE_TAC[]; +ASM_SEARCH_TCL [` cc_bool_model_v11 `] MP_TAC; +SIMP_TAC[cc_bool_model_v11]; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +STRIP_TAC; + +SUBGOAL_THEN` {ia, ib, ic} SUBSET indSet:num -> bool ` MP_TAC; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +EXPAND_TAC "indSet"; +EXPAND_TAC "ia"; +EXPAND_TAC "ib"; +EXPAND_TAC "ic"; +UNDISCH_TAC` ~(nn = 0) `; +SIMP_TAC[MOD_IN_NUMSEG]; +STRIP_TAC; +SUBGOAL_THEN` {ia, ib, ic} SUBSET {i | i IN 0..cc_card_v11 cc - 1 /\ cc_4cell_v11 cc i} ` MP_TAC; +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_ELIM_THM]; +FIRST_X_ASSUM MP_TAC; +ASM_SIMP_TAC[INSERT_SUBSET]; +STRIP_TAC; +EXPAND_TAC "ia"; +EXPAND_TAC "ib"; +EXPAND_TAC "ic"; +ASMS_SEARCH_TCL [` X <=> cc_4cell_v11 cc i `] REWRITE_TAC; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM MP_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; + + +SUBGOAL_THEN` FINITE (indSet:num -> bool) ` ASSUME_TAC; +EXPAND_TAC "indSet"; +REWRITE_TAC[FINITE_NUMSEG]; +SUBGOAL_THEN`{ia, ib, ic} = {i | i IN indSet /\ cc_4cell_v11 cc i} ` ASSUME_TAC; +MATCH_MP_TAC CARD_SUBSET_EQ; +ASM_REWRITE_TAC[]; +CONJ_TAC; +MATCH_MP_TAC FINITE_SUBSET; +EXISTS_TAC` indSet:num -> bool `; +ASM_REWRITE_TAC[]; +SET_TAC[]; +UNDISCH_TAC` cc_size_v11 cc (cc_4cell_v11 cc) = 3 `; +REWRITE_TAC[cc_size_v11]; +EXPAND_TAC "indSet"; +EXPAND_TAC "nn"; +SIMP_TAC[]; + +ASM_CASES_TAC` cc_4cell_v11 cc ( (i + 2) MOD nn) `; +SUBGOAL_THEN` (i + 2) MOD nn IN {ia, ib, ic} ` MP_TAC; +ASM_REWRITE_TAC[]; +REWRITE_TAC[IN_ELIM_THM]; +ASM_REWRITE_TAC[]; +EXPAND_TAC "indSet"; +MATCH_MP_TAC MOD_IN_NUMSEG; +FIRST_X_ASSUM ACCEPT_TAC; +STRIP_TAC; +SUBGOAL_THEN` nn = 3 ` ASSUME_TAC; +FIRST_X_ASSUM MP_TAC; +REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY]; +STRIP_TAC; +FIRST_X_ASSUM MP_TAC; +ASSUME_TAC2 (ARITH_RULE` 0 < i ==> i + 2 = (i - 1) + 3 `); +ASM_REWRITE_TAC[]; +EXPAND_TAC "ia"; +STRIP_TAC; +MP_TAC (ARITH_RULE` ~( 3 = 0) `); +UNDISCH_TAC` ~( nn = 0) `; +PHA; +NHANH MOD_PERIOD_BOUNDED; +STRIP_TAC; +REWRITE_TAC[ARITH_RULE` a = 3 <=> a <= 3 /\ 3 <= a `]; +ASM_REWRITE_TAC[]; +FIRST_X_ASSUM MATCH_MP_TAC; +EXISTS_TAC` i - 1 `; +ASM_REWRITE_TAC[]; + +DOWN; +EXPAND_TAC "ib"; +ASSUME_TAC (ARITH_RULE` ~( 2 = 0) `); +ASSUME_TAC2 (SPECL [` nn: num `;` 2 `] (GEN_ALL MOD_PERIOD_BOUNDED)); +FIRST_ASSUM NHANH; +NHANH (ARITH_RULE` n <= 2 ==> ~( 3 <= n ) `); +ASM_REWRITE_TAC[]; +DOWN; +EXPAND_TAC "ic"; +ASSUME_TAC (ARITH_RULE` ~( 1 = 0) `); +ASSUME_TAC2 (SPECL [` nn: num `;` 1 `] (GEN_ALL MOD_PERIOD_BOUNDED)); +REWRITE_TAC[ARITH_RULE` a + 2 = (a + 1) + 1 `]; +FIRST_ASSUM NHANH; +NHANH (ARITH_RULE` n <= 1 ==> ~( 3 <= n ) `); +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` CARD (indSet:num -> bool) = nn ` MP_TAC; +EXPAND_TAC "indSet"; +REWRITE_TAC[CARD_NUMSEG]; +UNDISCH_TAC` ~( nn = 0) `; +ARITH_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (ISPECL [` {ia, ib, ic:num} `;` indSet:num -> bool `] CARD_SUBSET_EQ); +ANTS_TAC; +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[cc_size_v11]; +EXPAND_TAC "indSet"; +UNDISCH_TAC` nn = 3 `; +SIMP_TAC[cc_qy_v11]; +NHANH (SET_RULE` { i | i IN S /\ p i } = S ==> {i | i IN S /\ ~( p i)} = {} `); +SIMP_TAC[CARD_CLAUSES]; +REPEAT STRIP_TAC; +ARITH_TAC; +ASM_SEARCH_TCL [` cc_bool_prep_v11 `] MP_TAC; +REWRITE_TAC[cc_bool_prep_v11; cc_qy_v11]; + +ASM_SEARCH_TCL [` p ( x MOD n) <=> p x `] (fun x -> ONCE_REWRITE_TAC[GSYM x]) ; +DISCH_THEN (ASSUME_TAC2 o (SPEC` (i + 2)`)) ; +SUBGOAL_THEN` { ((i - 1) + x) MOD nn | x < 3} = {ia, ib, ic} ` MP_TAC ; +REWRITE_TAC[EXTENSION; IN_ELIM_THM] ; +GEN_TAC ; +REWRITE_TAC[ARITH_RULE` x < 3 <=> x = 0 \/ x = 1 \/ x = 2 `; IN_ELIM_THM; NOT_IN_EMPTY; IN_INSERT] ; +EXPAND_TAC "ia" ; +EXPAND_TAC "ib" ; +EXPAND_TAC "ic" ; +UNDISCH_TAC` 0 < i ` ; +NHANH (ARITH_RULE` 0 < i ==> (i - 1 ) + 0 = i - 1 /\ ( i - 1) + 1 = i /\ ( i - 1) + 2 = i + 1 `) ; + + +MESON_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` (i + 3) MOD nn IN {(i - 1 + x) MOD nn | x < 3} ` MP_TAC; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[IN_ELIM_THM]; +EXPAND_TAC "indSet"; +CONJ_TAC; +MATCH_MP_TAC MOD_IN_NUMSEG; +FIRST_X_ASSUM ACCEPT_TAC; +DOWN THEN DOWN; +ASM_REWRITE_TAC[ARITH_RULE` a + 3 = (a + 2 ) + 1 `]; +SIMP_TAC[]; + +ASSUME_TAC2 (ARITH_RULE` 0 < i ==> i + 3 = (i -1) + 4 `); +FIRST_ASSUM SUBST1_TAC; +MP_TAC (ARITH_RULE` 3 <= 4 `); +UNDISCH_TAC` ~( nn = 0) `; +PHA; +NHANH MOD_PERIOD_BOUNDED2; +STRIP_TAC; + + +ABBREV_TAC` id = ((i - 1) + 4) MOD nn `; +SUBGOAL_THEN` (! x. x IN {ia, ib, ic} ==> cc_4cell_v11 cc x)` ASSUME_TAC; +UNDISCH_TAC` cc_4cell_v11 cc ia `; +UNDISCH_TAC` cc_4cell_v11 cc ib `; +UNDISCH_TAC` cc_4cell_v11 cc ic `; +SET_TAC[]; + +SUBGOAL_THEN` ~( ((i + 2) MOD nn) IN {ia, ib, ic})` MP_TAC; +UNDISCH_TAC` ~cc_4cell_v11 cc (((i + 2)) MOD nn) `; +DOWN; +MESON_TAC[]; + + + +ABBREV_TAC` ie = (i + 2) MOD nn `; +STRIP_TAC; +MP_TAC (prove(` FINITE {ia, ib, ic:num}`, REWRITE_TAC[Geomdetail.FINITE6])); +NHANH (ISPEC`ie: num ` CARD_INSERT); +ABBREV_TAC` cells = {i | i IN indSet /\ cc_4cell_v11 cc i} `; +ASM_REWRITE_TAC[ADD1]; +STRIP_TAC; +SUBGOAL_THEN` CARD (indSet:num -> bool) = nn ` ASSUME_TAC; +EXPAND_TAC "indSet"; +REWRITE_TAC[CARD_NUMSEG]; +MATCH_MP_TAC (ARITH_RULE` ~(nn = 0) ==> (nn - 1 + 1) - 0 = nn `); +FIRST_X_ASSUM ACCEPT_TAC; +SUBGOAL_THEN` {ie, ia, ib, ic:num } SUBSET indSet ` MP_TAC; +ONCE_REWRITE_TAC[INSERT_SUBSET]; +ASM_REWRITE_TAC[]; +EXPAND_TAC "ie"; +EXPAND_TAC "indSet"; +MATCH_MP_TAC MOD_IN_NUMSEG; +FIRST_ASSUM ACCEPT_TAC; +STRIP_TAC; +SUBGOAL_THEN` {ie, ia, ib, ic:num} = indSet` MP_TAC; +MATCH_MP_TAC CARD_SUBSET_EQ; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` CARD ((ie:num) INSERT cells) <= CARD (indSet:num -> bool) ` MP_TAC; +MATCH_MP_TAC CARD_SUBSET; +DOWN; +ASM_SIMP_TAC[]; + + +ASM_REWRITE_TAC[]; +UNDISCH_TAC` nn <= 4 `; +ARITH_TAC; + +ASM_REWRITE_TAC[cc_size_v11; cc_qy_v11]; +STRIP_TAC; +ASSUME_TAC2 ( +SET_RULE` cc_4cell_v11 cc ia /\ cc_4cell_v11 cc ib /\ cc_4cell_v11 cc ic /\ +{ia, ib, ic} = cells /\ ~cc_4cell_v11 cc ie /\ ie INSERT cells = indSet +==> {i | i IN indSet /\ ~cc_4cell_v11 cc i} = {ie} `); +ASM_REWRITE_TAC[]; +REWRITE_TAC[LE_REFL; Geomdetail.CARD_SING]; +ASM_CASES_TAC` cc_size_v11 cc (cc_qy_v11 cc) <= 1 `; +FIRST_X_ASSUM ACCEPT_TAC; + +DOWN; +REWRITE_TAC[ARITH_RULE` ~( x <= 1) <=> 2 <= x `; cc_size_v11]; +ASM_REWRITE_TAC[]; +ABBREV_TAC` qyset = {i | i IN indSet /\ cc_qy_v11 cc i} `; +SUBGOAL_THEN` qyset SUBSET (indSet:num -> bool) ` MP_TAC; +EXPAND_TAC "qyset"; +SET_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` FINITE (indSet:num -> bool) ` ASSUME_TAC; +EXPAND_TAC "indSet"; +REWRITE_TAC[FINITE_NUMSEG]; +SUBGOAL_THEN` FINITE (qyset:num -> bool) ` ASSUME_TAC; +MATCH_MP_TAC FINITE_SUBSET; +EXISTS_TAC` indSet:num -> bool `; +ASM_REWRITE_TAC[]; +DOWN; +NHANH CHOOSE_SUBSET; +STRIP_TAC; +FIRST_X_ASSUM NHANH; +REWRITE_TAC[HAS_SIZE_2_EXISTS; +SET_RULE` (!z. z IN t <=> z = x \/ z = y) <=> {x,y} = t `]; +STRIP_TAC; +UNDISCH_TAC` ~(cc_size_v11 cc (cc_4cell_v11 cc) = 3) `; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASSUME_TAC2 (ARITH_RULE` 3 <= sz /\ ~( sz = 3) /\ sz <= 4 ==> sz = 4 `); +DOWN; +EXPAND_TAC "sz"; +REWRITE_TAC[cc_size_v11]; +ASM_REWRITE_TAC[]; +ABBREV_TAC` cells = {i | i IN indSet /\ cc_4cell_v11 cc i}`; +STRIP_TAC; + +SUBGOAL_THEN` indSet = qyset UNION cells /\ DISJOINT qyset (cells: num -> bool)` MP_TAC; +EXPAND_TAC "qyset"; +EXPAND_TAC "cells"; +REWRITE_TAC[cc_qy_v11]; +SET_TAC[]; +STRIP_TAC; +MP_TAC (SET_RULE` {i | i IN indSet /\ cc_4cell_v11 cc i} SUBSET indSet`); +SWITCH_TAC` indSet = qyset UNION (cells: num -> bool) `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` FINITE (indSet:num -> bool)`; +PHA; +NHANH (FINITE_SUBSET); +STRIP_TAC; +REPLICATE_TAC 27 DOWN; +PHA; +ASM_SEARCH_TCL [` cc_real_model_v11 `] MP_TAC; +ASM_SEARCH_TCL [` cc_bool_model_v11 `] MP_TAC; +REWRITE_TAC[cc_real_model_v11; cc_bool_model_v11]; +REPEAT STRIP_TAC; + +SUBGOAL_THEN` &0 <= sum indSet (cc_gg_v11 cc) ` MP_TAC; +EXPAND_TAC "indSet"; +SUBGOAL_THEN` sum (qyset UNION cells) (cc_gg_v11 cc) = sum qyset (cc_gg_v11 cc) + sum cells (cc_gg_v11 cc) ` SUBST1_TAC; +MATCH_MP_TAC SUM_UNION; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` ! j. cc_qy_v11 cc j ==> &0 <= cc_gg_v11 cc j ` ASSUME_TAC; +REPEAT STRIP_TAC; +MATCH_MP_TAC QY_NN0; +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN` sum t (cc_gg_v11 cc) <= sum qyset (cc_gg_v11 cc)` ASSUME_TAC; +MATCH_MP_TAC SUM_SUBSET_SIMPLE; +ASM_REWRITE_TAC[]; +EXPAND_TAC "qyset"; +REWRITE_TAC[IN_DIFF; IN_ELIM_THM]; +FIRST_ASSUM NHANH; + + +SIMP_TAC[]; +SUBGOAL_THEN` &2 * #0.606 * #0.008 <= sum qyset (cc_gg_v11 cc) ` ASSUME_TAC; +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC` sum t (cc_gg_v11 cc) `; +ASM_REWRITE_TAC[]; +EXPAND_TAC "t"; +SUBGOAL_THEN` sum {x, y} (cc_gg_v11 cc) = cc_gg_v11 cc x + cc_gg_v11 cc y ` SUBST1_TAC; +MATCH_MP_TAC Geomdetail.SUM_DIS2; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` cc_qy_v11 cc x /\ cc_qy_v11 cc y ` MP_TAC; +UNDISCH_TAC` t SUBSET (qyset: num -> bool) ` ; +EXPAND_TAC "t"; +EXPAND_TAC "qyset"; +SET_TAC[]; +STRIP_TAC; +ASM_SEARCH_TCL [`#0.008 `] (ASSUME_TAC2 o (SPEC` x:num `)); +DOWN; +ASM_SEARCH_TCL [`#0.008 `] (ASSUME_TAC2 o (SPEC` y:num `)); +DOWN; +ASM_SEARCH_TCL [`#0.606`] (MP_TAC o (SPEC` x:num `)); +ASM_SEARCH_TCL [`#0.606`] (MP_TAC o (SPEC` y:num `)); +REAL_ARITH_TAC; + + +SUBGOAL_THEN` ! i. i IN cells ==> a_spine5 + b_spine5 * cc_azim_v11 cc i <= cc_gg_v11 cc i` ASSUME_TAC; +EXPAND_TAC "cells"; +REWRITE_TAC[IN_ELIM_THM]; +ASM_SEARCH_TCL [` cc_4cell_v11 cc i ==> a_spine5 + b_spine5 * cc_azim_v11 cc i <= cc_gg_v11 cc i`] NHANH; +SIMP_TAC[]; +SUBGOAL_THEN` sum cells (\i. (\j. a_spine5) i + b_spine5 * cc_azim_v11 cc i) <= sum cells (cc_gg_v11 cc)` MP_TAC; +MATCH_MP_TAC SUM_LE; +ASM_REWRITE_TAC[]; + +ASM_SIMP_TAC[SUM_ADD; SUM_CONST; SUM_LMUL]; +REWRITE_TAC[ISPECL [` cells:num -> bool `; `cc_azim_v11 cc `] (GEN_ALL SUM_BETA)]; +STRIP_TAC; +SUBGOAL_THEN` ! f. sum (indSet:num -> bool) f = sum cells f + sum qyset f ` ASSUME_TAC; +GEN_TAC; +EXPAND_TAC "indSet"; +ONCE_REWRITE_TAC[REAL_ADD_SYM]; +MATCH_MP_TAC SUM_UNION; +ASM_REWRITE_TAC[]; +ASM_SEARCH_TCL [` x = &2 * pi`] MP_TAC; +ASM_SEARCH_TCL [` 0..m = t `] MP_TAC; +SIMP_TAC[]; +ASM_REWRITE_TAC[]; + +STRIP_TAC; +SUBGOAL_THEN` sum (qyset DIFF t) (cc_azim_v11 cc) = sum qyset (cc_azim_v11 cc) - sum t (cc_azim_v11 cc) ` ASSUME_TAC; +MATCH_MP_TAC SUM_DIFF; +ASM_REWRITE_TAC[]; +DOWN; +EXPAND_TAC "t"; +UNDISCH_TAC` ~( x = (y:num)) `; +SIMP_TAC[Geomdetail.SUM_DIS2]; +STRIP_TAC; +SUBGOAL_THEN` !s. FINITE s ==> &0 <= sum s (cc_azim_v11 cc) ` ASSUME_TAC; +GEN_TAC; +STRIP_TAC; +MATCH_MP_TAC SUM_POS_LE; +ASM_REWRITE_TAC[]; +REPEAT STRIP_TAC; +ASM_SEARCH_TCL [` #0.606 <= x `] (MP_TAC o (SPEC` x':num `)); +REAL_ARITH_TAC; +FIRST_ASSUM (MP_TAC o (SPEC` qyset DIFF {x, y:num}`)); +ANTS_TAC; +MATCH_MP_TAC FINITE_DIFF; +ASM_REWRITE_TAC[]; +PHA; +NHANH (REAL_ARITH` &0 <= x /\ x = y - z ==> z <= y `); +STRIP_TAC; +SUBGOAL_THEN` &2 * #0.606 <= sum qyset (cc_azim_v11 cc) ` MP_TAC; +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC` cc_azim_v11 cc x + cc_azim_v11 cc y `; +ASM_REWRITE_TAC[]; +ASM_SEARCH_TCL [` #0.606 <= x `] (MP_TAC o (SPEC` x:num `)); +ASM_SEARCH_TCL [` #0.606 <= x `] (MP_TAC o (SPEC` y:num `)); +REAL_ARITH_TAC; +STRIP_TAC; +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC` &2 * #0.606 * #0.008 + ( &4 * a_spine5 + b_spine5 * sum cells (cc_azim_v11 cc)) ` ; +ONCE_REWRITE_TAC[TAUT` a /\ b <=> b /\ a `]; +CONJ_TAC; +MATCH_MP_TAC REAL_LE_ADD2; +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[Sphere.a_spine5; Sphere.b_spine5]; +UNDISCH_TAC` sum cells (cc_azim_v11 cc) + sum qyset (cc_azim_v11 cc) = &2 * pi `; +SIMP_TAC[REAL_ARITH` a + b = c <=> a = c - b `]; +STRIP_TAC; +UNDISCH_TAC` &2 * #0.606 <= sum qyset (cc_azim_v11 cc) `; +MP_TAC (prove(` pi < #3.1416 `, REWRITE_TAC[ Flyspeck_constants.bounds])); +REAL_ARITH_TAC; +UNDISCH_TAC` sum indSet (cc_gg_v11 cc) < &0 `; +REAL_ARITH_TAC]);; + + + + +let CC_QU_SMALL_SITUATION = prove_by_refinement(` cc_bool_model_v11 cc /\ cc_real_model_v11 cc +==> !i. cc_qu_v11 cc i /\ + (~cc_small_v11 cc (i + 1) \/ ~cc_small_v11 cc (i)) + ==> cc_eps <= cc_gg_v11 cc i `, +[REWRITE_TAC[cc_bool_model_v11; cc_real_model_v11]; +STRIP_TAC; +ASM_SEARCH_TCL [` x ==> cc_small_v11 cc i`] MP_TAC; +UNDISCH_TAC ` !i. cc_qu_v11 cc i /\ ~cc_small_eta_v11 cc i + ==> cc_eps <= cc_gg_v11 cc i`; +UNDISCH_TAC`!i. cc_qu_v11 cc i /\ ~cc_small_eta_v11 cc (i + 1) + ==> cc_eps <= cc_gg_v11 cc i`; +MESON_TAC[]]);; + + + + +let CC_4CELL_QUQX = prove(` cc_4cell_v11 cc i <=> cc_qu_v11 cc i \/ cc_qx_v11 cc i `, +REWRITE_TAC[cc_qx_v11; cc_qu_v11] THEN CONV_TAC TAUT);; + + + +let QX_NN00 = prove(` cc_bool_model_v11 cc /\ cc_real_model_v11 cc ==> (! i. cc_qx_v11 cc i + ==> &0 <= cc_gg_v11 cc i) `, +REPEAT STRIP_TAC THEN ASM_SIMP_TAC[QX_NN0]);; + + +let QY_NN00 = prove(` cc_bool_model_v11 cc /\ cc_real_model_v11 cc ==> (! i. cc_qy_v11 cc i + ==> &0 <= cc_gg_v11 cc i) `, +REPEAT STRIP_TAC THEN ASM_SIMP_TAC[QY_NN0]);; + + + + +let NUMSEG_SET_VER = prove(` 0..m = { i | i <= m } `, +REWRITE_TAC[numseg] THEN +MP_TAC (ARITH_RULE`! x. (0 <= x /\ x <= m <=> x <= m)`) THEN +SET_TAC[]);; + + +let FINITE_INITIAL_SEG = REWRITE_RULE[NUMSEG_SET_VER] (SPEC `0` FINITE_NUMSEG);; + + +let FINITE_INITIAL_SEG2 = prove(` FINITE {i | i < (n:num)} `, +MATCH_MP_TAC (ISPECL [` {i | i < n:num } `;` {i | i <= (n:num) }`] FINITE_SUBSET) +THEN REWRITE_TAC[FINITE_INITIAL_SEG; SUBSET; IN_ELIM_THM; LT_IMP_LE]);; + + + + +let CARD_MOD_NUMSEG = prove_by_refinement( +` !m. m <= n ==> CARD {(i + k) MOD n | k | k < m} = m `, + +[INDUCT_TAC; +STRIP_TAC; +MP_TAC (ARITH_RULE`(!x. ~( x < 0))`); +SIMP_TAC[SET_RULE` (!x. ~(x < 0)) ==> {(i + k) MOD n | k < 0} = {} `; CARD_EMPTY]; +NHANH (ARITH_RULE` SUC m <= n ==> m <= n `); +FIRST_X_ASSUM NHANH; +REWRITE_TAC[ARITH_RULE` k < SUC m <=> k < m \/ k = m `]; +REWRITE_TAC[SET_RULE` {(i + k) MOD n | k < m \/ k = m} = (i + m) MOD n INSERT {(i + k) MOD n | k < m }`]; +STRIP_TAC; +SUBGOAL_THEN` ~( (i + m) MOD n IN {(i + k) MOD n | k < m})` ASSUME_TAC; + +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +MP_TAC (let tt = GEN_ALL MOD_INJ1 in +SPECL [` m - (k: num) `;` n: num `] tt); +ANTS_TAC; ASM_ARITH_TAC; +DISCH_THEN (ASSUME_TAC o (SPEC` i + (k:num) `)); +DOWN; +ASSUME_TAC2 (ARITH_RULE` k < (m:num) ==> (i + k) + m - k = i + m `); +ASM_REWRITE_TAC[]; +MP_TAC (ISPECL [`\k. ( i + k) MOD n `; `{ k | k < m:num} `] FINITE_IMAGE); +ANTS_TAC; +REWRITE_TAC[ FINITE_INITIAL_SEG2; IMAGE; IN_ELIM_THM]; +REWRITE_TAC[ IMAGE; IN_ELIM_THM]; + +ASM_REWRITE_TAC[SET_RULE` {y | ?x. x < m /\ y = (i + x) MOD n} = {(i + k) MOD n | k < m} `]; + +NHANH (ISPEC ` (i + m) MOD n ` CARD_INSERT); +ASM_REWRITE_TAC[]; +SIMP_TAC[]]);; + + + + +let MOD_NUMSEG = prove_by_refinement(` ~( n = 0 ) ==> (! i. 0..(n - 1) = {(i + k) MOD n | k | k < n })`, +[STRIP_TAC; +GEN_TAC; +SUBGOAL_THEN` {(i + k) MOD n | k | k < n} SUBSET 0..(n - 1) ` ASSUME_TAC; +REWRITE_TAC[SUBSET]; +GEN_TAC; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +ASM_REWRITE_TAC[]; +ASM_SIMP_TAC[MOD_IN_NUMSEG]; +MP_TAC (REWRITE_RULE[LE_REFL] (SPEC`n:num ` CARD_MOD_NUMSEG)); +STRIP_TAC; +MATCH_MP_TAC (GSYM CARD_SUBSET_EQ); +ASM_REWRITE_TAC[FINITE_NUMSEG; CARD_NUMSEG]; +UNDISCH_TAC` ~( n = 0) `; +ARITH_TAC]);; + + + + + +(* IPVICGW_concl;; *) + + + +let IPVICGW_C33 = prove_by_refinement(`! cc. (cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0) /\ + cc_card_v11 cc = 3 +==> (!i. cc_small_v11 cc i) `, + +[NHANH LXDEYBO; +NHANH CHQSQEY; +REWRITE_TAC[cc_size_v11]; +GEN_TAC; STRIP_TAC THEN ASSUME_TAC2 QY_NN00 THEN ASSUME_TAC2 QX_NN00; DOWN_TAC; +ABBREV_TAC` cells = {i | i IN 0..cc_card_v11 cc - 1 /\ cc_4cell_v11 cc i} `; +ABBREV_TAC` nn = cc_card_v11 cc `; +REWRITE_TAC[cc_bool_model_v11; cc_real_model_v11; cc_bool_prep_v11]; +STRIP_TAC; +SUBGOAL_THEN` cells SUBSET 0..nn - 1 ` ASSUME_TAC; +EXPAND_TAC "cells"; +SET_TAC[]; +ASSUME_TAC (SPECL [` 0`;` nn - 1 `] FINITE_NUMSEG); +MP_TAC (SPECL [` 0`;` nn - 1 `] CARD_NUMSEG); +ASM_SIMP_TAC[ARITH_RULE`(3 - 1 + 1) - 0 = 3 `]; +ASSUME_TAC2 (ISPECL [` cells:num -> bool `;` 0.. nn - 1 `] CARD_SUBSET); +REPLICATE_TAC 3 DOWN THEN PHA; +ASM_REWRITE_TAC[]; +ASM_SIMP_TAC[ARITH_RULE` 3 <= x ==> ( x <= y /\ y = 3 <=> x = 3 /\ y = 3) `]; +STRIP_TAC; +SUBGOAL_THEN` 0..3 - 1 = cells ` MP_TAC; +MATCH_MP_TAC (GSYM CARD_SUBSET_EQ); +ASM_REWRITE_TAC[]; +STRIP_TAC; +GEN_TAC; +ASM_CASES_TAC` ! i. i IN cells ==> cc_qy_v11 cc i `; +SUBGOAL_THEN` ! i. i IN cells ==> &0 <= cc_gg_v11 cc i ` ASSUME_TAC; +REPEAT STRIP_TAC; +ASM_SEARCH_TCL [` !i. cc_qy_v11 cc i ==> &0 <= cc_gg_v11 cc i `] MATCH_MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +FIRST_ASSUM ACCEPT_TAC; +SUBGOAL_THEN` &0 <= sum cells (cc_gg_v11 cc) ` ASSUME_TAC; +MATCH_MP_TAC SUM_POS_LE; +ASM_REWRITE_TAC[]; +EXPAND_TAC "cells"; +FIRST_X_ASSUM ACCEPT_TAC; +UNDISCH_TAC` sum (0..nn - 1) (cc_gg_v11 cc) < &0 `; +DOWN; +ASM_REWRITE_TAC[]; +REAL_ARITH_TAC; + +ASM_CASES_TAC` (!i. i IN cells ==> cc_qx_v11 cc i) `; +SUBGOAL_THEN` (!i. i IN cells ==> &0 <= cc_gg_v11 cc i)` MP_TAC; +GEN_TAC THEN STRIP_TAC; +ASM_SEARCH_TCL [` (!i. cc_qx_v11 cc i ==> &0 <= cc_gg_v11 cc i) `] MATCH_MP_TAC; +FIRST_ASSUM MATCH_MP_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +UNDISCH_TAC` FINITE (0..3 - 1 ) `; +PHA; +ASM_REWRITE_TAC[]; +NHANH SUM_POS_LE; +ASM_REWRITE_TAC[REAL_ARITH` &0 <= x <=> ~( x < &0) `]; +STRIP_TAC; +UNDISCH_TAC` sum (0..nn - 1) (cc_gg_v11 cc) < &0 `; +ASM_REWRITE_TAC[]; +DOWN; +REWRITE_TAC[ISPECL [`cells: num -> bool `;` cc_gg_v11 cc `] (GEN_ALL SUM_BETA)]; +SIMP_TAC[]; +DOWN; +REWRITE_TAC[MESON[]` ~(! x. P x ==> q x) <=> (? x. P x /\ ~( q x)) `]; +STRIP_TAC; +SUBGOAL_THEN` cc_4cell_v11 cc i' ` MP_TAC; +REPLICATE_TAC 2 DOWN THEN PHA; + +UNDISCH_TAC` {i | i IN 0..nn - 1 /\ cc_4cell_v11 cc i} = cells `; +DISCH_THEN (SUBST1_TAC o GSYM); + +SIMP_TAC[IN_ELIM_THM]; +ASM_REWRITE_TAC[CC_4CELL_QUQX]; +ASM_SEARCH_TCL [` !i. cc_qu_v11 cc i ==> --cc_eps <= cc_gg_v11 cc i `] NHANH; +REWRITE_TAC[cc_qu_v11; cc_hassmall_v11]; +STRIP_TAC; +ASM_CASES_TAC` cc_small_v11 cc (i' + 2) `; +UNDISCH_TAC` ~( cc_card_v11 cc = 0) `; +ASM_REWRITE_TAC[]; +NHANH MOD_NUMSEG; +ASM_REWRITE_TAC[]; +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC o (SPEC` i': num `)); +SUBGOAL_THEN` ! j. j IN cells ==> cc_small_v11 cc j ` ASSUME_TAC; +ASM_REWRITE_TAC[IN_ELIM_THM]; +REPEAT STRIP_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` ~( 3 = 0) `; +UNDISCH_TAC ` periodic (cc_small_v11 cc) (cc_card_v11 cc) `; +ASM_REWRITE_TAC[]; +PHA; +SIMP_TAC[GSYM Oxl_def.periodic_mod]; +REPLICATE_TAC 9 DOWN; +REWRITE_TAC[ARITH_RULE` k < 3 <=> k = 0 \/ k = 1 \/ k = 2 `]; +MESON_TAC[ADD_0]; + +UNDISCH_TAC` ~( 3 = 0) `; +UNDISCH_TAC ` periodic (cc_small_v11 cc) (cc_card_v11 cc) `; +ASM_REWRITE_TAC[]; +PHA; +NHANH ( GEN_ALL ( +SPEC` i:num` (GEN`m:num ` (SPEC_ALL Oxl_def.periodic_mod)))); +SIMP_TAC[]; +STRIP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +EXPAND_TAC "cells"; +MATCH_MP_TAC MOD_IN_NUMSEG; +ASM_REWRITE_TAC[]; + + +SUBGOAL_THEN` ~(cc_qu_v11 cc (i' + 1)) /\ ~(cc_qu_v11 cc (i' + 2)) ` MP_TAC; +ASM_REWRITE_TAC[cc_qu_v11; cc_hassmall_v11; ARITH_RULE` (x + 1) + 1 = x + 2 `]; +STRIP_TAC; +SUBGOAL_THEN`! i. cc_4cell_v11 cc i ` ASSUME_TAC; +GEN_TAC; +UNDISCH_TAC` ~( cc_card_v11 cc = 0) `; +UNDISCH_TAC ` periodic (cc_4cell_v11 cc) (cc_card_v11 cc) `; +ASM_REWRITE_TAC[]; +PHA; +NHANH ( GEN_ALL ( +SPEC` i:num` (GEN`m:num ` (SPEC_ALL Oxl_def.periodic_mod)))); +SIMP_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` i MOD 3 IN cells ` MP_TAC; +EXPAND_TAC "cells"; +MATCH_MP_TAC MOD_IN_NUMSEG; +ARITH_TAC; +ASM_SEARCH_TCL [` {i | i IN 0..nn - 1 /\ cc_4cell_v11 cc i} = cells `] (SUBST1_TAC o SYM); +SET_TAC[]; +FIRST_ASSUM (MP_TAC o (SPEC` i' + 1 `)); +FIRST_ASSUM (MP_TAC o (SPEC` i' + 2 `)); +DOWN; +ASM_REWRITE_TAC[CC_4CELL_QUQX]; + +REWRITE_TAC[GSYM CC_4CELL_QUQX]; +REPEAT STRIP_TAC; +SUBGOAL_THEN` cc_eps <= cc_gg_v11 cc (i' + 1 ) ` ASSUME_TAC; +ASM_SEARCH_TCL [` !i. cc_qx_v11 cc i /\ cc_small_v11 cc i /\ ~cc_small_v11 cc (i + 1) + ==> cc_eps <= cc_gg_v11 cc i`] MATCH_MP_TAC; +ASM_REWRITE_TAC[ARITH_RULE` (i + 1) + 1 = i + 2 `]; +SUBGOAL_THEN` cc_qu_v11 cc i' ` MP_TAC; +ASM_REWRITE_TAC[cc_qu_v11; cc_hassmall_v11]; +ASM_SEARCH_TCL [`!i. cc_qu_v11 cc i ==> --cc_eps <= cc_gg_v11 cc i`] NHANH; +ASM_SEARCH_TCL [` cc_qx_v11 cc i ==> &0 <= r`] (ASSUME_TAC2 o (SPEC` i' + 2 `)); +STRIP_TAC; +SUBGOAL_THEN` &0 <= sum (i'.. i' + 2) (cc_gg_v11 cc) ` ASSUME_TAC; +MP_TAC (ARITH_RULE` i' <= i' + 2 `); +SIMP_TAC[SUM_CLAUSES_LEFT]; +STRIP_TAC; +MP_TAC (ARITH_RULE` i' + 1 <= i' + 2 `); +SIMP_TAC[SUM_CLAUSES_LEFT; ARITH_RULE` (i + 1) + 1 = i + 2`; SUM_SING_NUMSEG]; +STRIP_TAC; + +UNDISCH_TAC` --cc_eps <= cc_gg_v11 cc i' `; +UNDISCH_TAC` cc_eps <= cc_gg_v11 cc (i' + 1) `; +UNDISCH_TAC` &0 <= cc_gg_v11 cc (i' + 2) `; +PHA; +REAL_ARITH_TAC; + +UNDISCH_TAC` ~( cc_card_v11 cc = 0) `; +ASM_SEARCH_TCL [` periodic (cc_gg_v11 cc) `] MP_TAC; +PHA; +NHANH Oxl_def.periodic_sum; +ASM_REWRITE_TAC[]; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` i':num `)); +REWRITE_TAC[ARITH_RULE` 3 - 1 + i = i + 2 `]; +DISCH_THEN (ASSUME_TAC o SYM); +UNDISCH_TAC` sum (0.. nn - 1 ) (cc_gg_v11 cc) < &0 `; +ASM_REWRITE_TAC[REAL_ARITH` a < &0 <=> ~( &0 <= a) `]]);; + + + + + + + +let UNIQUE_QY = prove_by_refinement +(` !cc. cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0 + ==> (! j. cc_qy_v11 cc j /\ j IN 0..cc_card_v11 cc - 1 ==> + (! k. ~( k = j) /\ k IN 0..cc_card_v11 cc - 1 + ==> ~(cc_qy_v11 cc k))) `, +[NHANH UNPNFVW; +REWRITE_TAC[cc_size_v11]; +REPEAT STRIP_TAC; +ABBREV_TAC ` qys = {i | i IN 0..cc_card_v11 cc - 1 /\ cc_qy_v11 cc i} `; +SUBGOAL_THEN` {j,k} SUBSET (qys: num -> bool) ` ASSUME_TAC; +EXPAND_TAC "qys"; +REWRITE_TAC[SUBSET; EMPTY_SUBSET; IN_ELIM_THM; IN_INSERT; NOT_IN_EMPTY]; +REPLICATE_TAC 6 DOWN THEN PHA; +MESON_TAC[]; +ASSUME_TAC (SPECL [` 0`;` cc_card_v11 cc - 1 `] FINITE_NUMSEG); +SUBGOAL_THEN` FINITE (qys: num -> bool) ` ASSUME_TAC; +MATCH_MP_TAC FINITE_SUBSET; +EXISTS_TAC` 0..cc_card_v11 cc - 1 `; +ASM_REWRITE_TAC[]; +EXPAND_TAC "qys"; +SET_TAC[]; +SUBGOAL_THEN` CARD {j:num, k} <= CARD (qys:num -> bool) ` MP_TAC; +MATCH_MP_TAC CARD_SUBSET; +ASM_REWRITE_TAC[]; +STRIP_TAC; +UNDISCH_TAC` ~( k = (j:num)) `; +REWRITE_TAC[]; + +ASM_CASES_TAC` k = (j:num) `; +FIRST_X_ASSUM ACCEPT_TAC; +DOWN; +REWRITE_TAC[GSYM Geomdetail.CARD2]; +DOWN; +REWRITE_TAC[INSERT_COMM]; +PHA; +NHANH (ARITH_RULE` a <= b /\ a = 2 ==> ~( b <= 1 )`); +ASM_REWRITE_TAC[]]);; + + + +let UNIQUE_QY2 = prove(`!cc. cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0 + ==> (! j. cc_qy_v11 cc j /\ j IN 0..cc_card_v11 cc - 1 ==> + (! k. cc_qy_v11 cc k/\ k IN 0..cc_card_v11 cc - 1 + ==> k = j)) `, +NHANH UNIQUE_QY THEN GEN_TAC THEN STRIP_TAC THEN +FIRST_X_ASSUM NHANH THEN MESON_TAC[]);; + + + +let ASM_SEARCH_TC = asms_search;; + + + +let IPVICGW_C43_C44 = prove_by_refinement +(`!cc. (cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0) /\ + cc_card_v11 cc = 4 + ==> (!i. cc_small_v11 cc i) `, +[ +NHANH CHQSQEY; +NHANH LXDEYBO; +GEN_TAC THEN STRIP_TAC; +ASSUME_TAC2 QX_NN00; +ASSUME_TAC2 QY_NN00; +SUBGOAL_THEN` cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0 ` MP_TAC; +ASM_REWRITE_TAC[]; +NHANH Oxl_def.periodic_fn; +REWRITE_TAC[cc_bool_model_v11; cc_real_model_v11; cc_bool_prep_v11]; +STRIP_TAC; +ABBREV_TAC` nn = cc_card_v11 cc `; +ASM_CASES_TAC` ! i. cc_small_v11 cc i `; +FIRST_X_ASSUM ACCEPT_TAC; +FIRST_X_ASSUM MP_TAC; +REWRITE_TAC[NOT_FORALL_THM]; +STRIP_TAC; +SUBGOAL_THEN` ~ cc_qu_v11 cc i /\ ~ cc_qu_v11 cc ( i + 3) ` MP_TAC; +ASM_REWRITE_TAC[cc_qu_v11; cc_hassmall_v11; DE_MORGAN_THM]; +DISJ1_TAC; +DISJ2_TAC; + +ASM_SEARCH_TCL [` periodic (cc_small_v11 cc) `] MP_TAC; +REWRITE_TAC[periodic]; +ASM_SIMP_TAC[ARITH_RULE` (i + 3) + 1 = i + 4 `]; +STRIP_TAC; +MP_TAC (SPEC` i:num` QU_OR_QXY); +MP_TAC (SPEC` i + 3` QU_OR_QXY); +ASM_REWRITE_TAC[]; +ONCE_REWRITE_TAC[DISJ_SYM]; +STRIP_TAC; +STRIP_TAC; +DOWN THEN DOWN; + +ASM_SEARCH_TCL [` periodic (cc_qy_v11 cc) `] MP_TAC; +ASSUME_TAC2 (ISPECL [` cc_qy_v11 cc `; `nn:num `;` i:num `] Oxl_def.periodic_mod); +ASSUME_TAC2 (ISPECL [` cc_qy_v11 cc `; `nn:num `;` i + 3`] Oxl_def.periodic_mod); +REPLICATE_TAC 2 (FIRST_X_ASSUM SUBST1_TAC); +ASM_REWRITE_TAC[]; +STRIP_TAC THEN STRIP_TAC; +MP_TAC (SPEC_ALL UNIQUE_QY2); +ANTS_TAC; +UNDISCH_TAC` sum (0..nn - 1) (cc_gg_v11 cc) < &0 `; +ASM_REWRITE_TAC[]; + +DISCH_THEN (MP_TAC o (SPEC` i MOD 4 `)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC MOD_IN_NUMSEG; +ARITH_TAC; +DISCH_THEN (MP_TAC o (SPEC` (i + 3) MOD 4 `)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC MOD_IN_NUMSEG; +ARITH_TAC; +MP_TAC (let th = GEN_ALL MOD_INJ1 in +SPECL [` 3 `;` 4 `] th); +ANTS_TAC; +ARITH_TAC; +SIMP_TAC[]; + +SUBGOAL_THEN` ~ cc_qy_v11 cc ((i + 1) MOD 4) /\ ~( cc_qy_v11 cc ((i + 2) MOD 4)) ` ASSUME_TAC; +MP_TAC (SPEC_ALL UNIQUE_QY); +ANTS_TAC; +UNDISCH_TAC` sum (0..nn - 1) (cc_gg_v11 cc) < &0 `; +ASM_REWRITE_TAC[]; +DISCH_THEN (MP_TAC o (SPEC`(i + 3) MOD 4 `)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +SWITCH_TAC` nn = 4 `; +ASM_SIMP_TAC[GSYM periodic_mod; MOD_IN_NUMSEG]; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPEC` (i + 1) MOD 4 `)); +ANTS_TAC; +SWITCH_TAC` nn = 4 `; +ASM_SIMP_TAC[MOD_IN_NUMSEG]; +MP_TAC (let t = GEN_ALL MOD_INJ1 in SPECL [`2`; ` 4 `] t); +ANTS_TAC; +ARITH_TAC; +DISCH_THEN (MP_TAC o (SPEC` i + 1 `)); +ASM_SIMP_TAC[ARITH_RULE` (i + 1) + 2 = i + 3 `]; + + +FIRST_X_ASSUM (MP_TAC o (SPEC` (i + 2) MOD 4 `)); +ANTS_TAC; +SWITCH_TAC` nn = 4 `; +MP_TAC (let t = GEN_ALL MOD_INJ1 in SPECL [` 1 `;` 4 `] t); +ANTS_TAC; +ARITH_TAC; +ASM_SIMP_TAC[ARITH_RULE` i + 3 = (i + 2) + 1 `; MOD_IN_NUMSEG]; +SIMP_TAC[]; +MP_TAC (SPEC`(i + 1) MOD 4 ` QU_OR_QXY); +MP_TAC (SPEC`(i + 2) MOD 4 ` QU_OR_QXY); +ASM_SIMP_TAC[]; +ONCE_REWRITE_TAC[DISJ_SYM]; +STRIP_TAC THEN STRIP_TAC; +REPLICATE_TAC 3 DOWN THEN PHA; +SWITCH_TAC` nn = 4 `; +ASM_REWRITE_TAC[]; +ASM_SIMP_TAC[GSYM periodic_mod]; +STRIP_TAC; +ASSUME_TAC2 (ISPECL [` cc_gg_v11 cc `;` nn: num `] periodic_sum); +SUBGOAL_THEN` &0 <= sum (i..nn - 1 + i) (cc_gg_v11 cc)` MP_TAC; +MATCH_MP_TAC SUM_POS_LE; +REWRITE_TAC[FINITE_NUMSEG]; +GEN_TAC; +EXPAND_TAC "nn"; +REWRITE_TAC[IN_NUMSEG; ARITH_RULE` i <= x /\ x <= 4 - 1 + i <=> x = i \/ x = i + 1 \/ x = i + 2 \/ x = i + 3 `]; +REPLICATE_TAC 8 DOWN THEN PHA; +ASM_SEARCH_TCL [` cc_qy_v11 cc i ==> &0 <= cc_gg_v11 cc i `] MP_TAC; +ASM_SEARCH_TCL [` cc_qx_v11 cc i ==> &0 <= x `] MP_TAC; +MESON_TAC[]; +ASM_REWRITE_TAC[REAL_ARITH` &0 <= a <=> ~( a < &0) `]; +SUBGOAL_THEN` cc_small_v11 cc (i + 1) /\ cc_small_v11 cc (i + 2) ` MP_TAC; +DOWN; +SWITCH_TAC` nn = 4 `; +ASM_SIMP_TAC[GSYM periodic_mod]; +SIMP_TAC[ARITH_RULE` (i + 1) + 1 = i + 2 `; cc_qu_v11; cc_hassmall_v11]; +STRIP_TAC; + +(* =========== *) + + +SUBGOAL_THEN` cc_eps <= cc_gg_v11 cc i ` MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` -- cc_eps <= cc_gg_v11 cc (i + 1) ` MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +UNDISCH_TAC` cc_qu_v11 cc ((i + 1) MOD 4 )`; +SWITCH_TAC` nn = 4 `; +ASM_SIMP_TAC[GSYM Oxl_def.periodic_mod]; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc (i + 2)` MP_TAC; +ASM_SEARCH_TCL [` cc_qx_v11 cc i ==> &0 <= x `] MATCH_MP_TAC; +UNDISCH_TAC` cc_qx_v11 cc (( i + 2) MOD 4 ) `; +SWITCH_TAC` nn = 4 `; +ASM_SIMP_TAC[GSYM Oxl_def.periodic_mod]; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc (i + 3) ` MP_TAC; +ASM_SEARCH_TCL [` cc_qy_v11 cc i ==> &0 <= cc_gg_v11 cc i `] MATCH_MP_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +REPEAT STRIP_TAC; +SUBGOAL_THEN` &0 <= sum (0..nn - 1) (cc_gg_v11 cc) ` MP_TAC; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (ISPECL [` cc_gg_v11 cc `;` nn:num `] Oxl_def.periodic_sum); +FIRST_X_ASSUM (MP_TAC o SYM o (SPEC_ALL)); +ASM_SIMP_TAC[]; +STRIP_TAC; +SIMP_TAC[ARITH_RULE` 4 - 1 + i = i + 3 `; SUM_CLAUSES_LEFT; ARITH_RULE` i <= i + 3 /\ i + 1 <= i + 3 /\ (i + 1) + 1 <= i + 3 /\ ((i +1) + 1) + 1 = i + 3 `]; +REWRITE_TAC[SUM_SING_NUMSEG; ARITH_RULE` (i + 1) + 1 = i + 2 `]; +UNDISCH_TAC` &0 <= cc_gg_v11 cc (i + 2) `; +UNDISCH_TAC` &0 <= cc_gg_v11 cc (i + 3) `; +UNDISCH_TAC` cc_eps <= cc_gg_v11 cc (i) `; +UNDISCH_TAC` --cc_eps <= cc_gg_v11 cc (i + 1) `; +PHA; +REAL_ARITH_TAC; + + + +ASM_REWRITE_TAC[REAL_ARITH` &0 <= x <=> ~( x < &0) `]; + + + + + +REPLICATE_TAC 3 DOWN THEN PHA; +SWITCH_TAC` nn = 4 `; +ASM_SIMP_TAC[GSYM Oxl_def.periodic_mod]; +STRIP_TAC; + + +ASM_SEARCH_TCL [` !i. cc_qu_v11 cc i /\ cc_qy_v11 cc (i + 1) + ==> xac <= cc_gg_v11 cc i + cc_gg3a_v11 cc (i + 1) `] (MP_TAC o (SPEC` i + 2 `)); +ANTS_TAC; +ASM_REWRITE_TAC[ARITH_RULE` (i + 2) + 1 = i + 3 `]; +ASM_REWRITE_TAC[ARITH_RULE` (i + 2) + 1 = i + 3 `]; +SUBGOAL_THEN` cc_gg3a_v11 cc (i + 3) + cc_gg3b_v11 cc (i + 3) <= cc_gg_v11 cc ( i + 3) ` MP_TAC; +FIRST_ASSUM MATCH_MP_TAC; +FIRST_ASSUM ACCEPT_TAC; +STRIP_TAC; +SUBGOAL_THEN` &0 <= cc_gg3b_v11 cc (i + 3) ` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +STRIP_TAC; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc (i + 2) + cc_gg_v11 cc (i + 3)` MP_TAC; +REPLICATE_TAC 3 DOWN THEN PHA; +REAL_ARITH_TAC; + + + +ASM_SEARCH_TCL [` cc_qx_v11 cc (i) ==> &0 <= x `] (ASSUME_TAC2 o (SPEC` i + 1 `)); +ASM_SEARCH_TCL [` cc_qx_v11 cc (i) ==> &0 <= x `] (ASSUME_TAC2 o (SPEC` i + 1 `)); +ASM_SEARCH_TCL [` cc_qx_v11 cc (i) ==> &0 <= x `] (ASSUME_TAC2 o (SPEC` i:num `)); +STRIP_TAC; +SUBGOAL_THEN` &0 <= sum (0..nn - 1 ) (cc_gg_v11 cc) ` MP_TAC; +ASSUME_TAC2 (ISPECL [` cc_gg_v11 cc `; `nn:num `] Oxl_def.periodic_sum); +FIRST_X_ASSUM (SUBST1_TAC o SYM o (SPEC` i:num `)); +EXPAND_TAC "nn"; +REWRITE_TAC[ARITH_RULE` 4 - 1 + i = i + 3 `]; +SIMP_TAC[ARITH_RULE` 4 - 1 + i = i + 3 `; SUM_CLAUSES_LEFT; ARITH_RULE` i <= i + 3 /\ i + 1 <= i + 3 /\ (i + 1) + 1 <= i + 3 /\ ((i +1) + 1) + 1 = i + 3 `]; +REWRITE_TAC[SUM_SING_NUMSEG; ARITH_RULE` (i + 1) + 1 = i + 2 `]; +DOWN THEN DOWN THEN DOWN THEN PHA; +REAL_ARITH_TAC; +ASM_REWRITE_TAC[REAL_ARITH` &0 <= x <=> ~( x < &0) `]; +REPLICATE_TAC 3 DOWN THEN PHA; +SWITCH_TAC` nn = 4 `; +ASM_SIMP_TAC[GSYM Oxl_def.periodic_mod]; +STRIP_TAC; + +(* =================== *) +ASM_SEARCH_TCL [` !i. cc_qu_v11 cc i /\ cc_qy_v11 cc (i + 1) + ==> xax <= cc_gg_v11 cc i + cc_gg3a_v11 cc (i + 1) `] (MP_TAC o (SPEC` i + 2 `)); +ANTS_TAC; +ASM_REWRITE_TAC[ARITH_RULE` (i + 2) + 1 = i + 3 `]; +ASM_REWRITE_TAC[ARITH_RULE` (i + 2) + 1 = i + 3 `]; +SUBGOAL_THEN` cc_gg3a_v11 cc (i + 3) + cc_gg3b_v11 cc (i + 3) <= cc_gg_v11 cc ( i + 3) ` MP_TAC; +FIRST_ASSUM MATCH_MP_TAC; +FIRST_ASSUM ACCEPT_TAC; +STRIP_TAC; +SUBGOAL_THEN` &0 <= cc_gg3b_v11 cc (i + 3) ` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +FIRST_X_ASSUM ACCEPT_TAC; +STRIP_TAC; + +SUBGOAL_THEN` &0 <= cc_gg_v11 cc (i + 2) + cc_gg_v11 cc (i + 3)` MP_TAC; +REPLICATE_TAC 3 DOWN THEN PHA; +REAL_ARITH_TAC; +STRIP_TAC; +SUBGOAL_THEN` cc_small_v11 cc ( i + 1) ` MP_TAC; +UNDISCH_TAC` cc_qu_v11 cc (i + 1) `; +SIMP_TAC[cc_qu_v11; cc_hassmall_v11]; +STRIP_TAC; +ASM_SEARCH_TCL [`!i. cc_qx_v11 cc i /\ cc_small_v11 cc (i + 1) /\ ~cc_small_v11 cc i + ==> cc_eps <= cc_gg_v11 cc i `] (ASSUME_TAC2 o SPEC_ALL); +SUBGOAL_THEN` -- cc_eps <= cc_gg_v11 cc ( i + 1) ` MP_TAC; +FIRST_ASSUM MATCH_MP_TAC; +FIRST_X_ASSUM ACCEPT_TAC; + +REPEAT STRIP_TAC; +SUBGOAL_THEN` &0 <= sum (0..nn - 1) (cc_gg_v11 cc) ` MP_TAC; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (ISPECL [` cc_gg_v11 cc `;` nn:num `] Oxl_def.periodic_sum); +FIRST_X_ASSUM (MP_TAC o SYM o (SPEC_ALL)); + + +ASM_SIMP_TAC[]; +STRIP_TAC; +EXPAND_TAC "nn"; +REWRITE_TAC[ARITH_RULE` 4 - 1 + i = i + 3 `]; +SIMP_TAC[ARITH_RULE` 4 - 1 + i = i + 3 `; SUM_CLAUSES_LEFT; ARITH_RULE` i <= i + 3 /\ i + 1 <= i + 3 /\ (i + 1) + 1 <= i + 3 /\ ((i +1) + 1) + 1 = i + 3 `]; +REWRITE_TAC[SUM_SING_NUMSEG; ARITH_RULE` (i + 1) + 1 = i + 2 `]; + + +REPLICATE_TAC 4 DOWN THEN PHA; +DOWN; +REAL_ARITH_TAC; + + + +ASM_REWRITE_TAC[REAL_ARITH` &0 <= a <=> ~( a < &0) `]; +STRIP_TAC; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc i + cc_gg_v11 cc (i + 1) ` MP_TAC; +ASM_CASES_TAC` cc_qy_v11 cc (i + 1) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +ASM_CASES_TAC` cc_qx_v11 cc (i + 1) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +MP_TAC (SPEC` i + 1 ` QU_OR_QXY); +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASM_SEARCH_TCL [` cc_qu_v11 cc ( i + 1) /\ cc_qy_v11 cc i `] (ASSUME_TAC2 o SPEC_ALL); +ASM_SEARCH_TCL [` cc_gg3a_v11 cc i + x <= y `] (ASSUME_TAC2 o SPEC_ALL); +ASM_SEARCH_TCL [` x ==> &0 <= cc_gg3a_v11 cc i `] (ASSUME_TAC2 o SPEC_ALL); +DOWNS 3; +REWRITE_TAC[]; +REAL_ARITH_TAC; + + +STRIP_TAC; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc (i + 2) + cc_gg_v11 cc (i + 3) ` MP_TAC; +ASM_CASES_TAC` cc_qy_v11 cc (i + 2) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +ASM_CASES_TAC` cc_qx_v11 cc (i + 2) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; + +MP_TAC (SPEC ` i + 2 ` QU_OR_QXY); +ASM_REWRITE_TAC[]; +SUBGOAL_THEN`~ cc_small_v11 cc (i + 4) ` MP_TAC; +UNDISCH_TAC` periodic (cc_small_v11 cc) nn `; +ASM_SIMP_TAC[Oxl_def.periodic]; +ASM_SEARCH_TCL [` cc_qu_v11 cc i ==> -- x <= y `] NHANH; +STRIP_TAC; + + +REWRITE_TAC[cc_qu_v11; cc_hassmall_v11; ARITH_RULE` (i + 2) + 1 = i + 3 `]; +STRIP_TAC; +ASM_SEARCH_TCL [` !i. cc_qx_v11 cc i /\ cc_small_v11 cc (i) /\ ~cc_small_v11 cc (i + 1) + ==> cc_eps <= cc_gg_v11 cc i ` ] (MP_TAC o (SPEC` i + 3 `)); +ANTS_TAC; +ASM_REWRITE_TAC[ARITH_RULE` (i + 3) + 1 = i + 4 `]; +DOWN; +REAL_ARITH_TAC; +STRIP_TAC; + +SUBGOAL_THEN` &0 <= sum (0..nn - 1) (cc_gg_v11 cc) ` MP_TAC; +SWITCH_TAC ` nn = 4 `; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (ISPECL [` cc_gg_v11 cc `; ` nn:num `] Oxl_def.periodic_sum); +FIRST_X_ASSUM (SUBST1_TAC o SYM o SPEC_ALL); +FIRST_X_ASSUM (SUBST1_TAC o SYM); +SIMP_TAC[ARITH_RULE`4 - 1 + i = i + 3 `; SUM_CLAUSES_LEFT; ARITH_RULE` i <= i + (j:num) /\ i + 1 <= i + 3 /\ (i + 1) + 1 <= i + 3 `; LE_TRANS]; +REWRITE_TAC[ARITH_RULE` ((i + 1) + 1) + 1 = i + 3 `; SUM_SING_NUMSEG]; + +DOWNS 2; +REWRITE_TAC[ARITH_RULE` (i + 1) + 1 = i + 2 `]; +REAL_ARITH_TAC; +ASM_REWRITE_TAC[REAL_ARITH` &0 <= x <=> ~( x < &0) `]; + + +(* pkpk *) + +SUBGOAL_THEN` &0 <= cc_gg_v11 cc i + cc_gg_v11 cc (i + 1) ` ASSUME_TAC; +ASM_CASES_TAC` cc_qy_v11 cc (i + 1) ` ; +SWITCH_TAC` nn = 4 `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +ASM_CASES_TAC` cc_qx_v11 cc (i + 1) `; +SWITCH_TAC` nn = 4 `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +MP_TAC (SPEC` i + 1 ` QU_OR_QXY); +ASM_REWRITE_TAC[]; +ASM_SEARCH_TCL [` cc_qu_v11 cc i ==> -- x <= y `] NHANH; +STRIP_TAC; +SUBGOAL_THEN` cc_eps <= cc_gg_v11 cc i ` MP_TAC; +FIRST_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +DOWNS 2; +SIMP_TAC[cc_qu_v11; cc_hassmall_v11]; +DOWN; +REAL_ARITH_TAC; + +SUBGOAL_THEN` ~cc_small_v11 cc (i + 4) ` ASSUME_TAC; +ASM_SEARCH_TCL [` periodic (cc_small_v11 cc) `] MP_TAC; +SIMP_TAC[Oxl_def.periodic]; +SWITCH_TAC` nn = 4 `; +ASM_SIMP_TAC[]; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc (i + 2) + cc_gg_v11 cc (i + 3) ` MP_TAC; +ASM_CASES_TAC` cc_qy_v11 cc ( i + 2) \/ cc_qx_v11 cc (i + 2)`; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +DOWN THEN STRIP_TAC; +ASM_SIMP_TAC[]; +ASM_SIMP_TAC[]; +MP_TAC (SPEC` i + 2 ` QU_OR_QXY); +DOWN; +SIMP_TAC[DE_MORGAN_THM]; +ASM_SEARCH_TCL [` cc_qu_v11 cc i ==> -- x <= y `] NHANH; +STRIP_TAC THEN STRIP_TAC; +SUBGOAL_THEN` cc_eps <= cc_gg_v11 cc (i + 3) ` MP_TAC; +ASM_SEARCH_TCL [` !i. cc_qx_v11 cc i /\ cc_small_v11 cc i /\ ~cc_small_v11 cc (i + 1) + ==> cc_eps <= cc_gg_v11 cc i `] MATCH_MP_TAC; +UNDISCH_TAC` ~cc_small_v11 cc (i + 4) `; +ASM_SIMP_TAC[ARITH_RULE` (i + 3) + 1 = i + 4 `]; +UNDISCH_TAC` cc_qu_v11 cc (i + 2) `; +SIMP_TAC[cc_qu_v11; cc_hassmall_v11; ARITH_RULE` (i + 2) + 1 = i + 3 `]; +DOWN; +REAL_ARITH_TAC; + + +STRIP_TAC; +SUBGOAL_THEN` &0 <= sum (0..nn - 1) (cc_gg_v11 cc) ` MP_TAC; +ASSUME_TAC2 (ISPECL [` cc_gg_v11 cc `;` nn:num `] Oxl_def.periodic_sum); +FIRST_X_ASSUM (SUBST1_TAC o SYM o SPEC_ALL); +ASM_REWRITE_TAC[ARITH_RULE` 4 - 1 + i = i + 3 `]; +SIMP_TAC[SUM_CLAUSES_LEFT; ARITH_RULE` i <= i + 3 /\ i + 1 <= i + 3 /\ (i + 1) + 1 = i + 2 /\ i + 2 <= i + 3 /\ (i + 2 ) + 1 = i + 3 /\ (i + 1) + 2 = i + 3 `]; +REWRITE_TAC[SUM_SING_NUMSEG]; +DOWNS 3; +REAL_ARITH_TAC; +ASM_REWRITE_TAC[REAL_ARITH` &0 <= x <=> ~( x < &0) `]]);; + + + + + +let EXISTS_QY_CARD5 = prove_by_refinement +(` (cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0) /\ + cc_card_v11 cc = 5 +==> (? i. i < 5 /\ cc_qy_v11 cc i)`, +[NHANH UNPNFVW; +NHANH LXDEYBO; +REWRITE_TAC[cc_size_v11; cc_qy_v11]; +MP_TAC (SET_RULE` DISJOINT {i | i IN 0..cc_card_v11 cc - 1 /\ cc_4cell_v11 cc i} {i | i IN 0..cc_card_v11 cc - 1 /\ ~cc_4cell_v11 cc i}`); +MP_TAC (SET_RULE` {i | i IN 0..cc_card_v11 cc - 1 /\ cc_4cell_v11 cc i} UNION {i | i IN 0..cc_card_v11 cc - 1 /\ ~cc_4cell_v11 cc i} = 0..cc_card_v11 cc - 1`); +REPEAT STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +ABBREV_TAC ` s1 = {i | i IN 0..5 - 1 /\ cc_4cell_v11 cc i}`; +ABBREV_TAC ` s2 = {i | i IN 0..5 - 1 /\ ~cc_4cell_v11 cc i}`; +SUBGOAL_THEN` CARD (s1 UNION (s2:num -> bool)) = CARD s1 + CARD s2 ` MP_TAC; +MATCH_MP_TAC CARD_UNION; +ASM_REWRITE_TAC[GSYM DISJOINT]; +ASM_REWRITE_TAC[GSYM FINITE_UNION; FINITE_NUMSEG]; +ASM_SIMP_TAC[CARD_NUMSEG; ARITH_RULE` (5 - 1 + 1) - 0 = 5 `]; +STRIP_TAC; +ASSUME_TAC2 (ARITH_RULE` 5 = CARD (s1:num -> bool) + CARD (s2:num -> bool) /\ CARD s1 <= 4 /\ CARD s2 <= 1 +==> CARD s2 = 1 `); +DOWN; +ASM_CASES_TAC` (s2:num -> bool) = {} `; +ASM_REWRITE_TAC[CARD_EMPTY; ARITH_RULE` ~( 0 = 1) `]; +DOWN; +REWRITE_TAC[GSYM MEMBER_NOT_EMPTY]; +FIRST_X_ASSUM (SUBST1_TAC o SYM); +EXPAND_TAC "s2"; +SIMP_TAC[IN_ELIM_THM; IN_NUMSEG; ARITH_RULE`x <= 5 - 1 <=> x < 5 `; LE_0]]);; + + + + +let NUMSEG_INTER_22 = prove_by_refinement( +` ~(nn = 0) ==> ( (i <= x /\ x <= i + nn - 1) <=> (? k. k < nn /\ x = i + k )) `, +[STRIP_TAC; +EQ_TAC; +STRIP_TAC; +EXISTS_TAC` x - (i:num) `; +DOWN_TAC; +ARITH_TAC; +STRIP_TAC; +DOWN_TAC; +ARITH_TAC]);; + + +let PERIODIC_IMAGE_EQUAL = prove_by_refinement( +` ~( nn = 0) /\ periodic (f:num -> A) nn ==> IMAGE f (0..nn - 1) = IMAGE f (i..i + nn - 1) `, +[NHANH MOD_NUMSEG; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` i:num `)); +SIMP_TAC[]; +ASSUME_TAC2 ( +REWRITE_RULE[RIGHT_FORALL_IMP_THM] (ISPECL [` f:num -> A `;` nn:num `] Oxl_def.periodic_mod)); +FIRST_X_ASSUM (ASSUME_TAC o GSYM); +ASM_SIMP_TAC[IMAGE; IN_ELIM_THM; IN_NUMSEG]; +ASM_SIMP_TAC[NUMSEG_INTER_22]; +DOWN; +SET_TAC[]]);; + + + +let IMAGE_NUMSEG222 = prove_by_refinement +(`~(nn = 0) /\ periodic (f:num -> A) nn + ==> ! i. { f k | k IN 0..nn - 1} = { f (i + k) | k IN 0..nn - 1 } `, +[STRIP_TAC THEN GEN_TAC THEN DOWN_TAC; +NHANH PERIODIC_IMAGE_EQUAL; +REWRITE_TAC[IMAGE; IN_NUMSEG; LE_0]; +STRIP_TAC; +DOWN; +ASM_SIMP_TAC[NUMSEG_INTER_22; ARITH_RULE`~(n = 0) ==> (x < (n:num) <=> x <= n - 1) `]; +DOWN_TAC; +SET_TAC[]]);; + + + + + +let LITTLE_CC_GGB = prove(`(!i. cc_qy_v11 cc i + ==> cc_gg3a_v11 cc i + cc_gg3b_v11 cc i <= cc_gg_v11 cc i ) /\ + (!i. cc_qy_v11 cc i ==> &0 <= cc_gg3a_v11 cc i) /\ +( !i. cc_qu_v11 cc (i + 1) /\ cc_qy_v11 cc i + ==> &0 <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i + 1)) +==> cc_qu_v11 cc (i + 1) /\ cc_qy_v11 cc i +==> &0 <= cc_gg_v11 cc i + cc_gg_v11 cc (i + 1) `, +STRIP_TAC THEN FIRST_X_ASSUM NHANH THEN FIRST_X_ASSUM NHANH THEN +FIRST_X_ASSUM NHANH THEN REAL_ARITH_TAC);; + + +let LITTLE_CC_GGA = prove(` (!i. cc_qy_v11 cc i + ==> cc_gg3a_v11 cc i + cc_gg3b_v11 cc i <= cc_gg_v11 cc i ) /\ + (!i. cc_qy_v11 cc i ==> &0 <= cc_gg3b_v11 cc i) /\ +(!i. cc_qu_v11 cc i /\ cc_qy_v11 cc (i + 1) + ==> &0 <= cc_gg_v11 cc i + cc_gg3a_v11 cc (i + 1)) +==> cc_qu_v11 cc (i) /\ cc_qy_v11 cc (i + 1) +==> &0 <= cc_gg_v11 cc i + cc_gg_v11 cc (i + 1) `, +STRIP_TAC THEN FIRST_X_ASSUM NHANH THEN FIRST_X_ASSUM NHANH THEN +FIRST_X_ASSUM NHANH THEN REAL_ARITH_TAC);; + + + + + + +let QU_IMP_SMALL = +prove(` cc_qu_v11 cc i ==> cc_small_v11 cc i /\ cc_small_v11 cc ( i + 1) `, +SIMP_TAC[cc_qu_v11; cc_hassmall_v11]);; + + + + + +let IPVICGW_C5_QX_ALONG_NOT_SMALL = prove_by_refinement( +` !cc. ((cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0) /\ + cc_card_v11 cc = 5 ) /\ + ~cc_small_v11 cc i /\ cc_qx_v11 cc i /\ cc_qx_v11 cc ( i + 4) ==> F `, +[REPEAT STRIP_TAC; +ASSUME_TAC2 QY_NN00 THEN ASSUME_TAC2 QX_NN00; +ASSUME_TAC2 EXISTS_QY_CARD5; +DOWN_TAC; +NHANH Oxl_def.periodic_fn; +REWRITE_TAC[cc_bool_model_v11; cc_real_model_v11]; +ONCE_REWRITE_TAC[TAUT` ~ a <=> a ==> F `]; +IMP_TAC; +IMP_TAC; +STRIP_TAC; +STRIP_TAC; +STRIP_TAC; + +ABBREV_TAC` nn = cc_card_v11 cc `; +ASSUME_TAC2 (ISPECL [`nn:num `;` cc_qy_v11 cc `] (GEN_ALL IMAGE_NUMSEG222)); +SUBGOAL_THEN` cc_qy_v11 cc i' IN {cc_qy_v11 cc k | k IN 0..nn - 1}` MP_TAC; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` i': num `; +ASM_REWRITE_TAC[IN_NUMSEG_0; ARITH_RULE` a <= 5 - 1 <=> a < 5 `]; +FIRST_ASSUM (SUBST1_TAC o (SPEC` i:num `)); + +ASM_REWRITE_TAC[IN_ELIM_THM; IN_NUMSEG_0; ARITH_RULE` 5 - 1 = 4 `]; +STRIP_TAC; +ASM_CASES_TAC` k = 0 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWN; +REWRITE_TAC[ADD_0]; +UNDISCH_TAC` cc_qx_v11 cc i `; +SIMP_TAC[cc_qx_v11; cc_qy_v11]; + +ASM_CASES_TAC` k = 4`; +FIRST_X_ASSUM SUBST_ALL_TAC; +DOWNS 2; +UNDISCH_TAC` cc_qx_v11 cc (i + 4) `; +SIMP_TAC[cc_qx_v11; cc_qy_v11]; +ASM_CASES_TAC` k = 1 `; + +FIRST_X_ASSUM SUBST_ALL_TAC; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc (i + 1) + cc_gg_v11 cc (i + 2) ` MP_TAC; +ASM_CASES_TAC` cc_qy_v11 cc (i + 2) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; + + +ASM_CASES_TAC` cc_qx_v11 cc (i + 2 ) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +MP_TAC (SPEC` i + 2 ` QU_OR_QXY); +ASM_SIMP_TAC[]; + +STRIP_TAC; +ASM_SEARCH_TCL [` cc_qu_v11 cc (i + 1) /\ x ==> xpapxa <= cc_gg3b_v11 cc i + cc_gg_v11 cc j `] (MP_TAC o (SPEC ` i + 1 `)); +ANTS_TAC; +ASM_REWRITE_TAC[ARITH_RULE` (i + 1) + 1 = i + 2 `]; +STRIP_TAC; +MP_TAC (SPEC ` i + 1 ` (GEN`i:num ` LITTLE_CC_GGB)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +ANTS_TAC; +ASM_REWRITE_TAC[ARITH_RULE` (x + 1) + 1 = x + 2 `]; +ASM_SIMP_TAC[ARITH_RULE` (x + 1) + 1 = x + 2 `; Oxl_def.cc_eps]; + + +STRIP_TAC; +SWITCH_TAC` nn = 5 `; +SUBGOAL_THEN`~ cc_small_v11 cc (i + 5) ` ASSUME_TAC; +ASM_SIMP_TAC[ Oxl_def.periodic]; +ASM_SEARCH_TCL [` periodic (cc_small_v11 cc) `] MP_TAC; +SIMP_TAC[ Oxl_def.periodic]; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc (i + 3) + cc_gg_v11 cc (i + 4) ` ASSUME_TAC; +ASM_CASES_TAC` cc_qy_v11 cc ( i + 3) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +ASM_CASES_TAC` cc_qx_v11 cc (i + 3 ) ` ; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +MP_TAC (SPEC` i + 3 ` QU_OR_QXY); +ASM_REWRITE_TAC[]; +NHANH QU_IMP_SMALL; +REWRITE_TAC[ARITH_RULE` (i + 3 ) + 1 = i + 4 `]; +ASM_SEARCH_TCL [` cc_qu_v11 cc i ==> -- x <= y `] NHANH; +STRIP_TAC; +ASM_SEARCH_TCL [` a /\ b /\ ~ cc_small_v11 cc (i + 1) ==> cc_eps <= y `] (MP_TAC o (SPEC` i + 4 `)); +ANTS_TAC; +ASM_SEARCH_TCL [` 5 = n `] (SUBST_ALL_TAC o SYM); +ASM_REWRITE_TAC[ARITH_RULE` (i + 4) + 1 = i + 5 `]; +UNDISCH_TAC` --cc_eps <= cc_gg_v11 cc ( i + 3) `; +REAL_ARITH_TAC; + +SUBGOAL_THEN` &0 <= cc_gg_v11 cc i ` ASSUME_TAC; +ASM_SIMP_TAC[]; +SUBGOAL_THEN` &0 <= sum (0..nn - 1) (cc_gg_v11 cc ) ` MP_TAC; +ASSUME_TAC2 (ISPECL [` cc_gg_v11 cc `;` nn:num `] Oxl_def.periodic_sum); +FIRST_X_ASSUM (SUBST1_TAC o SYM o (SPEC` i:num `)); +EXPAND_TAC "nn"; +SIMP_TAC[ARITH_RULE` 5 - 1 + i = i + 4 /\ i <= i + 4 /\ i + 1 <= i + 4 /\ (i +1) + 1 <= i + 4 /\ ((i + 1) + 1) + 1 <= i + 4`; SUM_CLAUSES_LEFT]; +REWRITE_TAC[GSYM ADD_ASSOC]; +CONV_TAC NUM_REDUCE_CONV; +REWRITE_TAC[SUM_SING_NUMSEG]; +DOWNS 2; +UNDISCH_TAC` &0 <= cc_gg_v11 cc (i + 1) + cc_gg_v11 cc (i + 2) `; +REAL_ARITH_TAC; +ASM_REWRITE_TAC[ARITH_RULE` ~( &0 <= x) <=> x < &0 `]; + +(* ========== *) +ASM_CASES_TAC` k = 2 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc (i + 1) + cc_gg_v11 cc (i + 2) ` ASSUME_TAC; +ASM_CASES_TAC` cc_qy_v11 cc (i + 1) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +ASM_CASES_TAC` cc_qx_v11 cc (i + 1) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +MP_TAC (SPEC` i + 1 ` QU_OR_QXY); +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (SPEC `i + 1 ` (GEN `i: num ` LITTLE_CC_GGA)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +ANTS_TAC; +ASM_REWRITE_TAC[ARITH_RULE` (i + 1) + 1 = i + 2 `]; +REWRITE_TAC[Oxl_def.cc_eps; ARITH_RULE` (a + 1) + 1 = a + 2 `]; + + + + + +SUBGOAL_THEN` ~ cc_small_v11 cc ( i + 5) ` ASSUME_TAC; +ASM_SEARCH_TCL [` periodic (cc_small_v11 cc) `] MP_TAC; +REWRITE_TAC[Oxl_def.periodic]; +ASM_SIMP_TAC[]; + +SUBGOAL_THEN` &0 <= cc_gg_v11 cc ( i + 3) + cc_gg_v11 cc (i + 4) ` ASSUME_TAC; +ASM_CASES_TAC` cc_qy_v11 cc (i + 3 ) ` ; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +ASM_CASES_TAC` cc_qx_v11 cc (i + 3) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +MP_TAC (SPEC` i + 3 ` QU_OR_QXY); +ASM_REWRITE_TAC[]; + + +(* ??? *) + +ASM_SEARCH_TCL [` -- x <= y `] NHANH; +REWRITE_TAC[cc_qu_v11; cc_hassmall_v11; ARITH_RULE` (i + 3) + 1 = i + 4 `]; +STRIP_TAC; +ASM_SEARCH_TCL [` a /\ b /\ ~ p (i + 1) ==> cc_eps <= x `] (MP_TAC o (SPEC` i + 4 `)); +ANTS_TAC; +ASM_REWRITE_TAC[ARITH_RULE` (i + 4) + 1 = i + 5 `]; +DOWN; +REAL_ARITH_TAC; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc i ` ASSUME_TAC; +ASM_SIMP_TAC[]; + +SUBGOAL_THEN` &0 <= sum (0..nn - 1) (cc_gg_v11 cc) ` MP_TAC; +ASSUME_TAC2 (ISPECL [` cc_gg_v11 cc `;` nn:num `] Oxl_def.periodic_sum); + + +FIRST_X_ASSUM (MP_TAC o SYM o (SPEC` i :num `)); +ASM_SIMP_TAC[ARITH_RULE` 5 - 1 + i = i + 4 `; SUM_CLAUSES_LEFT; ARITH_RULE` i <= i + 4 /\ i + 1 <= i + 4 /\ (i + 1) + 1 = i + 2 `]; +STRIP_TAC; +SIMP_TAC[SUM_CLAUSES_LEFT; ARITH_RULE` i + 2 <= i + 4 /\ (i + 2) + 1 = i + 3 /\ i + 3 <= i + 4 /\ (i + 3 ) + 1 = i + 4 `; SUM_SING_NUMSEG]; +DOWNS 4; +DOWN; +REAL_ARITH_TAC; + +ASM_REWRITE_TAC[REAL_ARITH` ~( &0 <= x) <=> x < &0 `]; + + + + +ASM_CASES_TAC` k = 3 `; +FIRST_X_ASSUM SUBST_ALL_TAC; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc ( i + 2) + cc_gg_v11 cc (i + 3) ` ASSUME_TAC; +ASM_CASES_TAC` cc_qy_v11 cc ( i + 2) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +ASM_CASES_TAC` cc_qx_v11 cc (i + 2) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +MP_TAC (SPEC` i + 2 ` QU_OR_QXY); +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (SPEC` i + 2 ` (GEN`i:num ` LITTLE_CC_GGA)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +ANTS_TAC; +ASM_REWRITE_TAC[ARITH_RULE` (i + 2) + 1 = i + 3 `]; + +SIMP_TAC[ARITH_RULE` (i + 2) + 1 = i + 3 `; Oxl_def.cc_eps]; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc i + cc_gg_v11 cc (i + 1) ` ASSUME_TAC; +ASM_CASES_TAC` cc_qy_v11 cc (i + 1) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +ASM_CASES_TAC` cc_qx_v11 cc (i + 1) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +MP_TAC (SPEC` i + 1 ` QU_OR_QXY); +ASM_SIMP_TAC[]; +ASM_SEARCH_TCL [` x ==> -- y <= z `] NHANH; +REWRITE_TAC[cc_qu_v11; cc_hassmall_v11]; +STRIP_TAC; +ASM_SEARCH_TCL [` a /\ b (i + 1 ) /\ ~ c ==> cc_eps <= x `] (MP_TAC o SPEC_ALL); +ANTS_TAC; +ASM_REWRITE_TAC[]; +DOWN; +REAL_ARITH_TAC; + + +SUBGOAL_THEN` &0 <= cc_gg_v11 cc ( i + 4 ) ` ASSUME_TAC THEN +ASM_SIMP_TAC[]; + +SUBGOAL_THEN` &0 <= sum (0..nn - 1) (cc_gg_v11 cc) ` MP_TAC; +ASSUME_TAC2 (ISPECL [` cc_gg_v11 cc `;` nn:num `] Oxl_def.periodic_sum); +FIRST_X_ASSUM (MP_TAC o SYM o (SPEC` i :num `)); +ASM_SIMP_TAC[ARITH_RULE` 5 - 1 + i = i + 4 `; SUM_CLAUSES_LEFT; ARITH_RULE` i <= i + 4 /\ i + 1 <= i + 4 /\ (i + 1) + 1 = i + 2 `]; +STRIP_TAC; +SIMP_TAC[SUM_CLAUSES_LEFT; ARITH_RULE` i + 2 <= i + 4 /\ (i + 2) + 1 = i + 3 /\ i + 3 <= i + 4 /\ (i + 3 ) + 1 = i + 4 `; SUM_SING_NUMSEG]; +REMOVE_TAC; +DOWNS 4; +REAL_ARITH_TAC; +ASM_REWRITE_TAC[REAL_ARITH` ~( &0 <= x) <=> x < &0 `]; + +ASM_REWRITE_TAC[REAL_ARITH` ~( &0 <= x ) <=> x < &0 `]; +DOWNS 5; +UNDISCH_TAC` k <= 4 `; +ARITH_TAC]);; + + + + + + + +let CARD5_1074_LE_QYI = prove_by_refinement(` (cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0 ) /\ +(!i. cc_4cell_v11 cc i + ==> a_spine5 + b_spine5 * cc_azim_v11 cc i <= cc_gg_v11 cc i ) /\ +( !i. cc_qy_v11 cc i ==> #0.008 * cc_azim_v11 cc i <= cc_gg_v11 cc i ) /\ +cc_qy_v11 cc i /\ cc_card_v11 cc = 5 /\ +periodic (cc_gg_v11 cc) (cc_card_v11 cc ) /\ +(!i. #0.606 <= cc_azim_v11 cc i ) /\ +sum (0..cc_card_v11 cc - 1) (cc_azim_v11 cc) = &2 * pi /\ + #1.074 <= cc_azim_v11 cc i +==> &0 <= sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) `, + +[NHANH UNPNFVW; + +REWRITE_TAC[TAUT` a /\ b /\ c <=> (a/\b) /\ c `]; +IMP_TAC; +STRIP_TAC; +DISCH_TAC; +ABBREV_TAC` S = { i + k | k | k < 5 /\ cc_qy_v11 cc (i + k ) } ` ; +SUBGOAL_THEN` i IN (S:num -> bool) ` ASSUME_TAC; +EXPAND_TAC "S"; +REWRITE_TAC[IN_ELIM_THM]; +EXISTS_TAC` 0 `; +ASM_REWRITE_TAC[ADD_CLAUSES]; +ARITH_TAC; +SUBGOAL_THEN` S SUBSET { i + k | k | k < 5 } ` ASSUME_TAC; +EXPAND_TAC "S"; +CONV_TAC SET_RULE; +ASSUME_TAC (SPEC` 5 ` FINITE_NUMSEG_LT ); +SUBGOAL_THEN` IMAGE (\k. i + k ) { m | m < 5} = {i + k | k < 5 }` ASSUME_TAC; +REWRITE_TAC[EXTENSION; IN_IMAGE; IN_ELIM_THM]; +GEN_TAC; +MESON_TAC[]; +UNDISCH_TAC` FINITE {m | m < 5} `; +NHANH (ISPEC `(\x. (i:num) + x ) ` FINITE_IMAGE); +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` sum {i:num} ( cc_azim_v11 cc ) <= sum S ( cc_azim_v11 cc ) ` ASSUME_TAC; +MATCH_MP_TAC SUM_SUBSET_SIMPLE; +CONJ_TAC; +MATCH_MP_TAC FINITE_SUBSET; +EXISTS_TAC` {i + k | k < 5 } ` ; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; +GEN_TAC THEN STRIP_TAC; +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC` #0.606 `; +ASM_REWRITE_TAC[]; +REAL_ARITH_TAC; + +MP_TAC (ISPECL [` cc_gg_v11 cc `;` 5 `] Oxl_def.periodic_sum); +ANTS_TAC; +UNDISCH_TAC` periodic (cc_gg_v11 cc) (cc_card_v11 cc) `; +ASM_SIMP_TAC[]; +STRIP_TAC; +ARITH_TAC; +DISCH_THEN (ASSUME_TAC o SYM o SPEC_ALL); +ABBREV_TAC` SS = {i + k | k | k < 5 /\ ~cc_qy_v11 cc (i + k)} `; +SUBGOAL_THEN` S INTER (SS: num -> bool) = {} ` ASSUME_TAC; +EXPAND_TAC "S"; +EXPAND_TAC "SS"; +CONV_TAC SET_RULE; +SUBGOAL_THEN` { i + k | k | k < 5 } = S UNION (SS: num -> bool)` ASSUME_TAC; +EXPAND_TAC "S"; +EXPAND_TAC "SS"; +CONV_TAC SET_RULE; +ASM_REWRITE_TAC[numseg]; +SUBGOAL_THEN` {x | i <= x /\ x <= 5 - 1 + i} = {i + k | k < 5 } ` ASSUME_TAC; +REWRITE_TAC[EXTENSION; IN_ELIM_THM]; +GEN_TAC; +EQ_TAC; +STRIP_TAC; +EXISTS_TAC` x - (i:num) `; +DOWN THEN DOWN; +ARITH_TAC; +STRIP_TAC; +DOWNS 2; +ARITH_TAC; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 UNIQUE_QY; +DOWN THEN PHA; +DISCH_THEN (MP_TAC o (SPEC` i MOD 5 ` )); +ASM_REWRITE_TAC[]; +ANTS_TAC; +MP_TAC (ARITH_RULE` ~( 5 = 0 ) `); +SIMP_TAC[Oxl_def.MOD_IN_NUMSEG]; +ASSUME_TAC2 Oxl_def.periodic_fn; +DOWN; +ASM_REWRITE_TAC[]; +STRIP_TAC; +DOWN THEN PHA; +SIMP_TAC [ GSYM Oxl_def.periodic_mod]; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` cc_qy_v11 cc (i MOD 5 ) ` ASSUME_TAC; +ASSUME_TAC2 Oxl_def.periodic_fn; +DOWN; +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (ARITH_RULE` ~( 5 = 0 ) `); +DOWN THEN PHA; +SIMP_TAC [ GSYM Oxl_def.periodic_mod]; +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN` FINITE (S: num -> bool) ` MP_TAC; +MATCH_MP_TAC FINITE_SUBSET; +EXISTS_TAC` {i + k | k < 5} `; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` FINITE (SS: num -> bool) ` MP_TAC; +MATCH_MP_TAC FINITE_SUBSET; +EXISTS_TAC` {i + k | k < 5} `; +ASM_REWRITE_TAC[]; +CONV_TAC SET_RULE; +PHA THEN STRIP_TAC; +SUBGOAL_THEN` DISJOINT S (SS: num -> bool) ` MP_TAC; +ASM_REWRITE_TAC[DISJOINT]; +DOWN THEN DOWN THEN PHA; +SIMP_TAC[SUM_UNION]; +STRIP_TAC; +SUBGOAL_THEN`!i. cc_qy_v11 cc (i MOD 5 ) = cc_qy_v11 cc i ` ASSUME_TAC; +MATCH_MP_TAC (* Xwitccn. *) Oxl_def.PERIODIC_PROPERTY; +ASSUME_TAC2 Oxl_def.periodic_fn; +DOWN; +ASM_SIMP_TAC[]; +STRIP_TAC; +ARITH_TAC; +ASSUME_TAC2 Oxl_def.periodic_fn; +DOWN THEN ASM_REWRITE_TAC[] THEN STRIP_TAC; + + + + +SUBGOAL_THEN` S = {i:num } ` ASSUME_TAC; +REWRITE_TAC[EXTENSION; IN_INSERT; NOT_IN_EMPTY]; +EXPAND_TAC "S"; +REWRITE_TAC[IN_ELIM_THM]; +GEN_TAC; +EQ_TAC; +STRIP_TAC; +ASM_CASES_TAC` k = 0 `; +DOWN THEN DOWN THEN ARITH_TAC; + +UNDISCH_TAC` !k. ~(k = i MOD 5) /\ k IN 0..5 - 1 ==> ~cc_qy_v11 cc k `; +DISCH_THEN (MP_TAC o (SPEC` ( i + k ) MOD 5 `)); +ANTS_TAC; +CONJ_TAC; + + +MP_TAC (SPECL [` k:num `;` 5 `] Oxl_def.MOD_INJ1_ALT); +ANTS_TAC; +ASM_REWRITE_TAC[]; +ARITH_TAC; +SIMP_TAC[]; +MATCH_MP_TAC Oxl_def.MOD_IN_NUMSEG; +ARITH_TAC; +ASM_REWRITE_TAC[]; + +STRIP_TAC; +EXISTS_TAC` 0 `; +ASM_REWRITE_TAC[ADD_CLAUSES]; +ARITH_TAC; + +SUBGOAL_THEN` SS = { i + k | k < 5 } DIFF S ` ASSUME_TAC; +ASM_REWRITE_TAC[]; +MATCH_MP_TAC (SET_RULE` SS INTER S = {} ==> SS = ( S UNION SS ) DIFF S `); +UNDISCH_TAC` (S:num -> bool) INTER SS = {} `; +ASM_REWRITE_TAC[INTER_COMM]; +SUBGOAL_THEN` SS = { i + k | 0 < k /\ k < 5 } ` ASSUME_TAC; +DOWN; +FIRST_X_ASSUM SUBST1_TAC; +SIMP_TAC[]; +DISCH_TAC; +REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_DIFF; IN_INSERT; NOT_IN_EMPTY]; +GEN_TAC; +MESON_TAC[ARITH_RULE` ~( 0 < k ) <=> x + k = x `]; + +SUBGOAL_THEN` cc_bool_model_v11 cc /\ cc_real_model_v11 cc ` MP_TAC; +ASM_REWRITE_TAC[]; +REWRITE_TAC[cc_bool_model_v11; cc_real_model_v11]; +STRIP_TAC; +SUBGOAL_THEN` ! i. i IN SS ==> + a_spine5 + b_spine5 * cc_azim_v11 cc i <= cc_gg_v11 cc i ` ASSUME_TAC; +EXPAND_TAC "SS"; +REWRITE_TAC[IN_ELIM_THM]; +GEN_TAC THEN STRIP_TAC; +ASM_SEARCH_TCL [` !i. cc_4cell_v11 cc i ==> + a_spine5 + b_spine5 * cc_azim_v11 cc i <= cc_gg_v11 cc i `] MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +DOWN THEN DOWN; +SIMP_TAC[cc_qy_v11]; + +DOWN; +UNDISCH_TAC` FINITE (SS: num -> bool) `; +PHA; +NHANH SUM_LE; +UNDISCH_TAC` {i + k | k < 5} = S UNION SS `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +UNDISCH_TAC` SS = {i + k | k < 5} DIFF S `; +UNDISCH_TAC` SS = {i + k | 0 < k /\ k < 5} `; +ASM_REWRITE_TAC[]; +DISCH_THEN (ASSUME_TAC o SYM); +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[SUM_SING; ETA_AX]; +SUBGOAL_THEN`! a f. (\(i:num). (a:real) + f i ) = (\i. (\i. a ) i + f i )` ASSUME_TAC; +REWRITE_TAC[BETA_THM]; +FIRST_X_ASSUM (fun x -> ONCE_REWRITE_TAC[x]); +IMP_TAC; +ASM_SIMP_TAC[SUM_ADD; Vol1.SUM_CONST2; SUM_LMUL]; +SUBGOAL_THEN` CARD {i + k | k < 5 } = 5 ` ASSUME_TAC; +MATCH_MP_TAC Topology.CARD_FINITE_SERIES_EQ; +GEN_TAC THEN GEN_TAC; +ARITH_TAC; +SUBGOAL_THEN` CARD ({i + k | k < 5} DIFF {i}) = CARD {i + k | k < 5} - CARD {i} ` ASSUME_TAC; +MATCH_MP_TAC CARD_DIFF; +ASM_REWRITE_TAC[INSERT_SUBSET]; + +REWRITE_TAC[EMPTY_SUBSET; IN_ELIM_THM]; +EXISTS_TAC` 0 `; +CONJ_TAC; +ARITH_TAC; +ARITH_TAC; +DOWN; +ASM_REWRITE_TAC[CARD_SING]; +STRIP_TAC THEN STRIP_TAC; +MP_TAC (GSYM (SPECL [` cc_azim_v11 cc `;` 5`] Oxl_def.periodic_sum)); +ANTS_TAC; +UNDISCH_TAC` periodic (cc_azim_v11 cc) (cc_card_v11 cc)`; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +STRIP_TAC; +ARITH_TAC; +ASM_REWRITE_TAC[ARITH_RULE` 5 - 1 = 4 `]; +STRIP_TAC; +STRIP_TAC; +UNDISCH_TAC` sum (0..cc_card_v11 cc - 1) (cc_azim_v11 cc) = &2 * pi `; +ASM_REWRITE_TAC[ARITH_RULE` 5 - 1 = 4 `]; +SUBGOAL_THEN` i.. 4 + i = S UNION SS ` ASSUME_TAC; +ASM_REWRITE_TAC[]; +REWRITE_TAC[numseg; EXTENSION; IN_ELIM_THM]; +GEN_TAC; +EQ_TAC; +STRIP_TAC; +EXISTS_TAC` x - (i:num) `; +DOWN THEN DOWN; +ARITH_TAC; +STRIP_TAC; +DOWN THEN DOWN; +ARITH_TAC; + + +FIRST_ASSUM SUBST1_TAC; +ASSUME_TAC2 (ISPECL [` cc_azim_v11 cc `;` S: num -> bool `;` SS: num -> bool `] SUM_UNION); +FIRST_ASSUM SUBST1_TAC; +ASM_REWRITE_TAC[SUM_SING; REAL_ARITH` a + b = x <=> b = x - a` ]; +STRIP_TAC; +UNDISCH_TAC` &4 * a_spine5 + b_spine5 * sum SS (\i. cc_azim_v11 cc i) <= + sum SS (cc_gg_v11 cc) `; +ASM_REWRITE_TAC[ETA_AX]; +UNDISCH_TAC` #1.074 <= cc_azim_v11 cc i `; +REWRITE_TAC[Sphere.a_spine5; Sphere.b_spine5]; +MP_TAC ( +REWRITE_RULE[] ( +REWRITE_CONV[Flyspeck_constants.bounds]` #3.14159 < pi /\ pi < #3.1416 `)); +STRIP_TAC THEN STRIP_TAC; +MATCH_MP_TAC (REAL_ARITH` &0 <= x + b ==> b <= c ==> &0 <= x + c `); +SUBGOAL_THEN` #0.008 * cc_azim_v11 cc i <= cc_gg_v11 cc i ` ASSUME_TAC; +ASM_SIMP_TAC[]; +DOWNS 4; +REAL_ARITH_TAC]);; + + + + +let MOD_INJ11 = REWRITE_RULE[GSYM RIGHT_FORALL_IMP_THM] MOD_INJ1;; + + +let PI_BOUNDS = REWRITE_RULE[] (REWRITE_CONV[Flyspeck_constants.bounds]` #3.14159 < pi /\ pi < #3.1416 `);; + + + + +let CARD5_LT_1074_QYI = +prove_by_refinement (` (cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0 ) /\ + +cc_qy_v11 cc i /\ cc_card_v11 cc = 5 /\ + cc_azim_v11 cc i < #1.074 +==> &0 <= sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) `, +[REPEAT STRIP_TAC; +ASSUME_TAC2 QY_NN00 THEN ASSUME_TAC2 QX_NN00; +ASSUME_TAC2 EXISTS_QY_CARD5; +DOWN_TAC; +NHANH Oxl_def.periodic_fn; +STRIP_TAC; +SUBGOAL_THEN` cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc ` MP_TAC; +ASM_REWRITE_TAC[]; +REWRITE_TAC[cc_bool_model_v11; cc_real_model_v11]; +STRIP_TAC THEN ASSUME_TAC2 UNIQUE_QY; + + + + + + + +ASM_CASES_TAC` cc_small_eta_v11 cc i \/ cc_small_eta_v11 cc ( i + 1) `; +SUBGOAL_THEN` a_spine5 + b_spine5 * cc_azim_v11 cc i <= cc_gg_v11 cc i ` ASSUME_TAC; +UNDISCH_TAC` !i. cc_qy_v11 cc i /\ + cc_small_eta_v11 cc i /\ + cc_small_eta_v11 cc (i + 1) + ==> a_spine5 + b_spine5 * cc_azim_v11 cc i <= cc_gg_v11 cc i `; +UNDISCH_TAC` !i. cc_qy_v11 cc i /\ + ~cc_small_eta_v11 cc i /\ + cc_small_eta_v11 cc (i + 1) /\ + cc_azim_v11 cc i < #1.074 + ==> a_spine5 + b_spine5 * cc_azim_v11 cc i <= cc_gg_v11 cc i `; +UNDISCH_TAC` !i. cc_qy_v11 cc i /\ + cc_small_eta_v11 cc i /\ + ~cc_small_eta_v11 cc (i + 1) /\ + cc_azim_v11 cc i < #1.074 + ==> a_spine5 + b_spine5 * cc_azim_v11 cc i <= cc_gg_v11 cc i `; +UNDISCH_TAC` cc_azim_v11 cc i < #1.074 `; +UNDISCH_TAC` cc_qy_v11 cc i `; +DOWN; +MESON_TAC[]; + + +MP_TAC (REWRITE_RULE[RIGHT_FORALL_IMP_THM ] (ISPECL [` cc_qy_v11 cc `;` 5 `] periodic_mod)); +ANTS_TAC; +UNDISCH_TAC` periodic (cc_qy_v11 cc) (cc_card_v11 cc ) `; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +STRIP_TAC; +ARITH_TAC; +DISCH_THEN (ASSUME_TAC o GSYM); +UNDISCH_TAC` !j. cc_qy_v11 cc j + ==> j IN 0..cc_card_v11 cc - 1 + ==> (!k. ~(k = j) + ==> k IN 0..cc_card_v11 cc - 1 + ==> ~cc_qy_v11 cc k) `; +PHA; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPEC` i MOD 5 ` )); +ANTS_TAC; +ASM_REWRITE_TAC[]; +ASSUME_TAC (ARITH_RULE` ~( 5 = 0) `); +ASM_SIMP_TAC[Oxl_def.MOD_IN_NUMSEG]; +STRIP_TAC; +SUBGOAL_THEN` ! k. 0 < k /\ k < 5 ==> ~cc_qy_v11 cc ((i + k) MOD 5 ) ` ASSUME_TAC; +GEN_TAC THEN STRIP_TAC; + + +FIRST_X_ASSUM MATCH_MP_TAC; +ASSUME_TAC (ARITH_RULE` ~( 5 = 0) `); +ASM_SIMP_TAC[Oxl_def.MOD_IN_NUMSEG]; +MATCH_MP_TAC (GSYM MOD_INJ11); +ASM_REWRITE_TAC[ARITH_RULE` ~( 0 = x) <=> 0 < x `]; +ARITH_TAC; + +SUBGOAL_THEN` !k. k < 5 ==> a_spine5 + b_spine5 * cc_azim_v11 cc (i + k ) <= cc_gg_v11 cc (i + k ) ` ASSUME_TAC; +GEN_TAC; +ASM_CASES_TAC` k = 0 `; +ASM_REWRITE_TAC[ADD_CLAUSES]; +STRIP_TAC; +UNDISCH_TAC` !i. cc_4cell_v11 cc i + ==> a_spine5 + b_spine5 * cc_azim_v11 cc i <= cc_gg_v11 cc i `; +DISCH_THEN MATCH_MP_TAC; +UNDISCH_TAC` !k. 0 < k /\ k < 5 ==> ~cc_qy_v11 cc ((i + k) MOD 5) `; +ASM_REWRITE_TAC[]; +REWRITE_TAC[cc_qy_v11]; +DISCH_THEN MATCH_MP_TAC; +DOWN THEN DOWN THEN SIMP_TAC[]; +ARITH_TAC; +MP_TAC (ISPECL [` cc_gg_v11 cc `;` 5 `] Oxl_def.periodic_sum); +ANTS_TAC; +ASM_REWRITE_TAC[]; + +UNDISCH_TAC` periodic (cc_gg_v11 cc) (cc_card_v11 cc) `; +ASM_SIMP_TAC[]; +ARITH_TAC; + +DISCH_THEN (ASSUME_TAC o GSYM); +ASM_REWRITE_TAC[ARITH_RULE` 5 - 1 = 4 `]; +SUBGOAL_THEN` ! j. j IN (i..4 + i) ==> a_spine5 + b_spine5 * cc_azim_v11 cc (j) <= + cc_gg_v11 cc (j) ` ASSUME_TAC; +GEN_TAC; +REWRITE_TAC[IN_NUMSEG]; +ABBREV_TAC` ij = j - (i:num) `; +NHANH (ARITH_RULE` (i:num) <= j ==> j = i + ( j - i) ` ); +ASM_REWRITE_TAC[]; +STRIP_TAC; +UNDISCH_TAC` j = i + ij:num `; +DISCH_THEN SUBST1_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +EXPAND_TAC "ij"; +UNDISCH_TAC` j <= 4 + i `; +ARITH_TAC; +UNDISCH_TAC` !j. j IN i..4 + i + ==> a_spine5 + b_spine5 * cc_azim_v11 cc j <= cc_gg_v11 cc j ` ; +NHANH (REWRITE_RULE[GSYM IN_NUMSEG] SUM_LE_NUMSEG); + + +REWRITE_TAC[SUM_ADD_NUMSEG; ETA_AX;SUM_CONST_NUMSEG; SUM_LMUL]; +REWRITE_TAC[ARITH_RULE` ((4 + i) + 1) - i = 5 `]; +IMP_TAC; +STRIP_TAC; +SUBST_ALL_TAC (ARITH_RULE` 5 - 1 = 4 `); +ASM_REWRITE_TAC[]; +MATCH_MP_TAC (REAL_ARITH` c <= b ==> b <= a ==> c <= a `); +UNDISCH_TAC` sum (0..cc_card_v11 cc - 1) (cc_azim_v11 cc) = &2 * pi `; +MP_TAC (ISPECL [` cc_azim_v11 cc `;` 5 `] Oxl_def.periodic_sum); +ANTS_TAC; +UNDISCH_TAC` periodic (cc_azim_v11 cc) (cc_card_v11 cc) ` ; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +ARITH_TAC; + + +ASM_SIMP_TAC[ARITH_RULE` 5 - 1 + i = 4 + i `]; +STRIP_TAC THEN STRIP_TAC; +REWRITE_TAC[Sphere.a_spine5; Sphere.b_spine5]; +MP_TAC PI_BOUNDS; +REAL_ARITH_TAC; + +UNDISCH_TAC` ~(cc_small_eta_v11 cc i \/ cc_small_eta_v11 cc (i + 1)) `; +REWRITE_TAC[DE_MORGAN_THM]; +STRIP_TAC; + + +FIRST_ASSUM (MP_TAC o (SPEC` i MOD 5 `)); +PHA; +MP_TAC ( +REWRITE_RULE[RIGHT_FORALL_IMP_THM ] (ISPECL [` cc_qy_v11 cc `;` 5 `] Oxl_def.periodic_mod)); +ANTS_TAC; +ABBREV_TAC` nn = cc_card_v11 cc `; +SUBST_ALL_TAC (MESON[]` nn = 5 <=> 5 = nn `); +ASM_REWRITE_TAC[]; +DISCH_THEN (ASSUME_TAC o GSYM); + + +ASM_REWRITE_TAC[]; +ANTS_TAC; +ASSUME_TAC (ARITH_RULE` ~( 5 = 0) `); +ASM_SIMP_TAC[MOD_IN_NUMSEG]; +STRIP_TAC; +SUBGOAL_THEN` ! k. 0 < k /\ k < 5 ==> ~ cc_qy_v11 cc ( i + k ) ` ASSUME_TAC; +GEN_TAC THEN STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` (i + k) MOD 5 `)); +ANTS_TAC; +ASSUME_TAC (ARITH_RULE` ~( 5 = 0) `); +ASM_SIMP_TAC[MOD_IN_NUMSEG]; +MATCH_MP_TAC (GSYM MOD_INJ11); +ASM_REWRITE_TAC[ARITH_RULE` ~( 0 = k ) <=> 0 < k `]; +ASM_SIMP_TAC[]; + + + +ARITH_TAC; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` ! i. -- cc_eps <= cc_gg_v11 cc i ` ASSUME_TAC; +GEN_TAC; +ASM_CASES_TAC` cc_qy_v11 cc i'' ` ; +DOWN; +ASM_SEARCH_TCL [` cc_qy_v11 cc i ==> &0 <= cc_gg_v11 cc i `] NHANH; +REWRITE_TAC[Oxl_def.cc_eps]; +REAL_ARITH_TAC; +ASM_CASES_TAC` cc_qx_v11 cc i'' ` ; +DOWN; +ASM_SEARCH_TCL [` cc_qx_v11 cc i ==> &0 <= cc_gg_v11 cc i `] NHANH; +REWRITE_TAC[Oxl_def.cc_eps]; +REAL_ARITH_TAC; +MP_TAC (SPEC` i'':num ` QU_OR_QXY); +ASM_REWRITE_TAC[]; + + + + + + + + + + + + +SUBGOAL_THEN` &0 <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i + 1) + cc_gg_v11 cc (i + 2) ` ASSUME_TAC; +ASM_CASES_TAC` cc_qu_v11 cc (i + 1 ) ` ; +ASM_SEARCH_TCL [`cc_qu_v11 cc i /\ ~cc_small_eta_v11 cc i`;` cc_eps <= x`] (MP_TAC o (SPEC ` i + 1 `)); +ANTS_TAC; +ASM_REWRITE_TAC[]; + +FIRST_X_ASSUM (MP_TAC o (SPEC ` i + 2 `)); +PHA; +MATCH_MP_TAC (REAL_ARITH` &0 <= x ==> -- a <= z /\ a <= y ==> &0 <= x + y + z `); +UNDISCH_TAC` cc_qy_v11 cc i `; +ASM_REWRITE_TAC[]; +ASM_CASES_TAC` cc_qx_v11 cc (i + 1 ) `; + + + +ASM_CASES_TAC` ~ cc_small_v11 cc ( i + 2 ) ` ; +SUBGOAL_THEN` ~ cc_qu_v11 cc ( i + 1) /\ ~ cc_qu_v11 cc ( i + 2) ` ASSUME_TAC; +DOWN; +SIMP_TAC[cc_qu_v11; cc_hassmall_v11; ARITH_RULE` (i + 1 ) + 1 = i + 2 `]; +MP_TAC (SPEC` i + 1 ` QU_OR_QXY); +MP_TAC (SPEC` i + 2 ` QU_OR_QXY); +ASM_REWRITE_TAC[]; + +DISCH_TAC; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc (i + 2) ` ASSUME_TAC; +UNDISCH_TAC` !i. cc_qx_v11 cc i ==> &0 <= cc_gg_v11 cc i `; +UNDISCH_TAC` !i. cc_qy_v11 cc i ==> &0 <= cc_gg_v11 cc i `; +DOWN; +MESON_TAC[]; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc ( i + 1) ` MP_TAC; +UNDISCH_TAC` cc_qx_v11 cc (i + 1) `; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` &0 <= cc_gg3b_v11 cc i ` MP_TAC; +UNDISCH_TAC` cc_qy_v11 cc i `; +ASM_REWRITE_TAC[]; +DOWN; +REAL_ARITH_TAC; + +ASM_CASES_TAC` ~ cc_small_v11 cc (i + 1) `; +ASM_SEARCH_TCL [` cc_qx_v11 cc i /\ cc_small_v11 cc (i + 1) /\ ~cc_small_v11 cc i + ==> cc_eps <= cc_gg_v11 cc i`] (MP_TAC o (SPEC` i + 1 `)); +ANTS_TAC; +ASM_REWRITE_TAC[ARITH_RULE` ( i + 1) + 1 = i + 2 `]; +UNDISCH_TAC` ~ ~cc_small_v11 cc (i + 2) `; +SIMP_TAC[]; + + +FIRST_X_ASSUM (MP_TAC o (SPEC ` i + 2 `)); +SUBGOAL_THEN` &0 <= cc_gg3b_v11 cc i ` MP_TAC; +ASM_SIMP_TAC[]; +REAL_ARITH_TAC; + +ASM_SEARCH_TCL [` !i. cc_qx_v11 cc (i + 1) /\ cc_hassmall_v11 cc (i + 1) /\ cc_qy_v11 cc i + ==> cc_eps <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i + 1) `] (MP_TAC o (SPEC ` i :num ` )); +ANTS_TAC; +DOWN THEN DOWN; +ASM_SIMP_TAC[cc_hassmall_v11; ARITH_RULE` (i + 1) + 1 = i + 2 `]; +SUBGOAL_THEN` -- cc_eps <= cc_gg_v11 cc (i + 2) ` MP_TAC; +ASM_REWRITE_TAC[]; +REAL_ARITH_TAC; + + +MP_TAC (SPEC` i + 1 ` QU_OR_QXY); +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` ~ cc_qy_v11 cc (i + 1) ` MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ARITH_TAC; +SIMP_TAC[]; + +SUBGOAL_THEN` &0 <= cc_gg3a_v11 cc i + cc_gg_v11 cc ( i + 3) + cc_gg_v11 cc ( i + 4 ) ` ASSUME_TAC; +ASM_CASES_TAC` ~ cc_small_v11 cc ( i + 4 ) ` ; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc (i + 3) /\ &0 <= cc_gg_v11 cc (i + 4 ) ` ASSUME_TAC; +SUBGOAL_THEN` ~cc_qu_v11 cc (i + 3) /\ ~cc_qu_v11 cc ( i + 4) ` MP_TAC; +DOWN; +SIMP_TAC[cc_qu_v11; cc_hassmall_v11; ARITH_RULE` (i + 3 ) + 1 = i + 4 `]; +STRIP_TAC; +MP_TAC (SPEC` i + 3 ` QU_OR_QXY); +MP_TAC (SPEC` i + 4 ` QU_OR_QXY); +ASM_REWRITE_TAC[]; +UNDISCH_TAC` !i. cc_qx_v11 cc i ==> &0 <= cc_gg_v11 cc i `; +UNDISCH_TAC` !i. cc_qy_v11 cc i ==> &0 <= cc_gg_v11 cc i `; +MESON_TAC[]; +SUBGOAL_THEN` &0 <= cc_gg3a_v11 cc i ` MP_TAC; +ASM_SIMP_TAC[]; +DOWN; +REAL_ARITH_TAC; +DOWN; +REWRITE_TAC[]; +SUBGOAL_THEN` ~cc_small_eta_v11 cc ((i + 5 ) MOD 5 ) ` ASSUME_TAC; +MP_TAC ( +REWRITE_RULE[RIGHT_FORALL_IMP_THM] ( +ISPECL [` cc_small_eta_v11 cc `; ` 5 `] Oxl_def.periodic_mod)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +ABBREV_TAC` nn = cc_card_v11 cc `; +SUBST_ALL_TAC (MESON[]` nn = 5 <=> 5 = nn `); +ASM_REWRITE_TAC[]; + +DISCH_THEN (ASSUME_TAC o GSYM); +ONCE_REWRITE_TAC[ARITH_RULE` i + 5 = 1 * 5 + i `]; +REWRITE_TAC[MOD_MULT_ADD]; +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC ( +REWRITE_RULE[RIGHT_FORALL_IMP_THM] ( +ISPECL [` cc_small_eta_v11 cc `; ` 5 `] Oxl_def.periodic_mod)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +ABBREV_TAC` nn = cc_card_v11 cc `; +SUBST_ALL_TAC (MESON[]` nn = 5 <=> 5 = nn `); +ASM_REWRITE_TAC[]; +DISCH_THEN (ASSUME_TAC o GSYM); + +UNDISCH_TAC` ~cc_small_eta_v11 cc ((i + 5) MOD 5) `; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASM_CASES_TAC` cc_qu_v11 cc (i + 4 ) ` ; +UNDISCH_TAC` !i. cc_qu_v11 cc i /\ ~cc_small_eta_v11 cc (i + 1) + ==> cc_eps <= cc_gg_v11 cc i `; +DISCH_THEN (MP_TAC o (SPEC` i + 4 `)); +ANTS_TAC; +ASM_REWRITE_TAC[ARITH_RULE` (i + 4 ) + 1 = i + 5 `]; +SUBGOAL_THEN` --cc_eps <= cc_gg_v11 cc (i + 3) ` MP_TAC; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` &0 <= cc_gg3a_v11 cc i ` MP_TAC; +ASM_SIMP_TAC[]; +REAL_ARITH_TAC; + +ASM_CASES_TAC` cc_qx_v11 cc ( i + 4) `; +ASM_CASES_TAC`~ cc_small_v11 cc ( i + 5 ) `; +UNDISCH_TAC` !i. cc_qx_v11 cc i /\ cc_small_v11 cc i /\ ~cc_small_v11 cc (i + 1) + ==> cc_eps <= cc_gg_v11 cc i `; +DISCH_THEN (MP_TAC o (SPEC` i + 4 `)); +ANTS_TAC; +ASM_REWRITE_TAC[ARITH_RULE` (i + 4 ) + 1 = i + 5 ` ]; +SUBGOAL_THEN` -- cc_eps <= cc_gg_v11 cc ( i + 3 ) ` MP_TAC; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` &0 <= cc_gg3a_v11 cc i ` MP_TAC; +ASM_SIMP_TAC[]; +REAL_ARITH_TAC; + +UNDISCH_TAC` !i. cc_qx_v11 cc i /\ cc_hassmall_v11 cc i /\ cc_qy_v11 cc (i + 1) + ==> cc_eps <= cc_gg_v11 cc i + cc_gg3a_v11 cc (i + 1) `; +DISCH_THEN (MP_TAC o (SPEC` i + 4 `)); +ANTS_TAC; +DOWN; +ASM_SIMP_TAC[cc_hassmall_v11; ARITH_RULE` (i + 4) + 1 = i + 5 `]; +STRIP_TAC; +SUBGOAL_THEN` cc_qy_v11 cc ((i + 5) MOD 5 ) ` MP_TAC; +ONCE_REWRITE_TAC[ARITH_RULE` i + 5 = 1 * 5 + i `]; +REWRITE_TAC[MOD_MULT_ADD]; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[ARITH_RULE` (i + 4) + 1 = i + 5 `]; +UNDISCH_TAC` periodic (cc_gg3a_v11 cc) (cc_card_v11 cc) `; +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC (let tt = REWRITE_RULE[RIGHT_FORALL_IMP_THM] Oxl_def.periodic_mod in +ISPECL [` cc_gg3a_v11 cc `; ` 5 `] tt); +ANTS_TAC; +ASM_REWRITE_TAC[]; +ARITH_TAC; +DISCH_THEN (ASSUME_TAC o GSYM); + +SUBGOAL_THEN` cc_gg3a_v11 cc ((i + 5) MOD 5) = cc_gg3a_v11 cc (i) ` MP_TAC; +ONCE_REWRITE_TAC[ARITH_RULE` i + 5 = 1 * 5 + i `]; +REWRITE_TAC[MOD_MULT_ADD]; +ASM_REWRITE_TAC[]; +ASM_SIMP_TAC[]; + +STRIP_TAC; +SUBGOAL_THEN` -- cc_eps <= cc_gg_v11 cc (i + 3 ) ` MP_TAC; +ASM_REWRITE_TAC[]; +REAL_ARITH_TAC; +SUBGOAL_THEN` ~ cc_qy_v11 cc (( i + 4 ) MOD 5) ` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASSUME_TAC (ARITH_RULE` ~( 5 = 0) `); +ASM_SIMP_TAC[MOD_IN_NUMSEG]; +MATCH_MP_TAC (GSYM MOD_INJ11); +ARITH_TAC; +MP_TAC (SPEC` i + 4 ` QU_OR_QXY); +DOWN; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +ASM_SEARCH_TCL [` cc_gg3a_v11 cc i + x <= y`] (ASSUME_TAC2 o SPEC_ALL); +MP_TAC (ARITH_RULE` ~( 5 = 0) `); +UNDISCH_TAC` periodic (cc_gg_v11 cc ) (cc_card_v11 cc) `; +ASM_REWRITE_TAC[]; +PHA; +NHANH Oxl_def.periodic_sum; +STRIP_TAC; +FIRST_X_ASSUM (ASSUME_TAC o GSYM); +ASM_SIMP_TAC[]; +ONCE_REWRITE_TAC[ADD_SYM]; +SIMP_TAC[SUM_CLAUSES_LEFT; ARITH_RULE` 5 - 1 = 4 /\ i <= i + 4 /\ i + 1 <= i + 4 /\ +i + 2 <= i + 4 /\ i + 3 <= i + 4 /\ i + 4 <= i + 4 /\ (i + 1 ) + 1 = i + 2 `]; +SIMP_TAC[SUM_CLAUSES_LEFT; ARITH_RULE` (i + 1) + 2 <= i + 4 /\ ((i + 1) + 2) + 1 = i + 4`]; +REWRITE_TAC[SUM_SING_NUMSEG; ARITH_RULE` (i + 1) + 2 = i + 3 `]; +UNDISCH_TAC` cc_gg3a_v11 cc i + cc_gg3b_v11 cc i <= cc_gg_v11 cc i `; +UNDISCH_TAC` &0 <= cc_gg3a_v11 cc i + cc_gg_v11 cc (i + 3) + cc_gg_v11 cc (i + 4) `; +UNDISCH_TAC` &0 <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i + 1) + cc_gg_v11 cc (i + 2) `; +REAL_ARITH_TAC]);; + + + + + + + +let PRE_IPVICGW = prove_by_refinement ( +` (cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0) /\ + cc_card_v11 cc = 5 +==> &0 <= sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) `, +[NHANH EXISTS_QY_CARD5; +STRIP_TAC; +ASM_CASES_TAC` cc_azim_v11 cc i < #1.074 `; +ASSUME_TAC2 CARD5_LT_1074_QYI; +ASM_REWRITE_TAC[]; + +MATCH_MP_TAC CARD5_1074_LE_QYI; +ASM_REWRITE_TAC[REAL_ARITH` x <= y <=> ~( y < x ) `]; +ASSUME_TAC2 QY_NN00 THEN ASSUME_TAC2 QX_NN00; +ASSUME_TAC2 EXISTS_QY_CARD5; +DOWN_TAC; +NHANH Oxl_def.periodic_fn; +REWRITE_TAC[cc_bool_model_v11; cc_real_model_v11]; +ONCE_REWRITE_TAC[TAUT` ~ a <=> a ==> F `]; +IMP_TAC; +IMP_TAC; +STRIP_TAC; +STRIP_TAC; +STRIP_TAC; + +ABBREV_TAC` nn = cc_card_v11 cc `; +ASM_REWRITE_TAC[REAL_ARITH` ~( a < b) <=> b <= a `]; +DOWN; +SUBST_ALL_TAC (MESON[]` nn = 5 <=> 5 = nn `); +ASM_REWRITE_TAC[]]);; + + + +let CC_CARD_LESS_THAN_5 = prove_by_refinement(` cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0 + ==> cc_card_v11 cc <= 5 `, + + +[NHANH LXDEYBO; +NHANH UNPNFVW; +REWRITE_TAC[cc_size_v11; cc_qy_v11]; +MP_TAC (SET_RULE` DISJOINT {i | i IN 0..cc_card_v11 cc - 1 /\ ~cc_4cell_v11 cc i} {i | i IN 0..cc_card_v11 cc - 1 /\ cc_4cell_v11 cc i} `); +MP_TAC (SET_RULE` {i | i IN 0..cc_card_v11 cc - 1 /\ ~cc_4cell_v11 cc i} UNION {i | i IN 0..cc_card_v11 cc - 1 /\ cc_4cell_v11 cc i} = 0..cc_card_v11 cc - 1 `); +REPEAT STRIP_TAC; +ABBREV_TAC` s1 = {i | i IN 0..cc_card_v11 cc - 1 /\ ~cc_4cell_v11 cc i} `; +ABBREV_TAC` s2 = {i | i IN 0..cc_card_v11 cc - 1 /\ cc_4cell_v11 cc i}`; +SUBGOAL_THEN` FINITE (s1:num -> bool) ` ASSUME_TAC; +MATCH_MP_TAC FINITE_SUBSET; +EXISTS_TAC` 0.. cc_card_v11 cc - 1 `; +REWRITE_TAC[FINITE_NUMSEG]; +EXPAND_TAC "s1"; +SET_TAC[]; +SUBGOAL_THEN` FINITE (s2:num -> bool) ` ASSUME_TAC; +MATCH_MP_TAC FINITE_SUBSET; +EXISTS_TAC` 0.. cc_card_v11 cc - 1 `; +REWRITE_TAC[FINITE_NUMSEG]; +EXPAND_TAC "s2"; +SET_TAC[]; + +MP_TAC (ISPECL [` s1:num -> bool `; ` s2: num -> bool `] CARD_UNION); +ANTS_TAC; +ASM_REWRITE_TAC[GSYM DISJOINT]; + + + +ASM_REWRITE_TAC[CARD_NUMSEG]; +ASSUME_TAC2 (prove(` cc_bool_model_v11 cc ==> ~( cc_card_v11 cc = 0) `, SIMP_TAC[cc_bool_model_v11])); +ASM_SEARCH_TCL [` x <= 1 `] MP_TAC; +ASM_SEARCH_TCL [` x <= 4 `] MP_TAC; +ARITH_TAC]);; + + + + + +let IPVICGW = prove_by_refinement(`!cc. cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0 + ==> (!i. cc_small_v11 cc i)`, +[NHANH CC_CARD_LESS_THAN_5 ; NHANH THREE_LE_CC_CARD; +PHA; REWRITE_TAC[ARITH_RULE` 3 <= x /\ x <= 5 <=> x = 3 \/ x = 4 \/ x = 5 `]; +MESON_TAC[IPVICGW_C43_C44; IPVICGW_C33; PRE_IPVICGW; REAL_ARITH` a < b ==> ~( b <= a )`]]);; + + + + +let RSIWAMP = prove_by_refinement ( +`!cc. cc_bool_model_v11 cc /\ cc_bool_prep_v11 cc /\ cc_real_model_v11 cc /\ + (sum (0..cc_card_v11 cc -1) (cc_gg_v11 cc) < &0) ==> (cc_card_v11 cc <= 4)`, +[NHANH CC_CARD_LESS_THAN_5; +REWRITE_TAC[ARITH_RULE` a <= 5 <=> a <= 4 \/ a = 5 `]; +GEN_TAC THEN STRIP_TAC; +ASSUME_TAC2 PRE_IPVICGW; +DOWN; +ASM_REWRITE_TAC[REAL_ARITH` &0 <= x <=> ~( x < &0 ) `]]);; + + + + + + + +let C5_QY_ALONG_NOT_SMALL1 = prove_by_refinement +(` (!i. cc_qx_v11 cc i ==> &0 <= cc_gg_v11 cc i) /\ +(!i. cc_qy_v11 cc i ==> &0 <= cc_gg_v11 cc i) /\ +(!i. cc_qy_v11 cc i + ==> cc_gg3a_v11 cc i + cc_gg3b_v11 cc i <= cc_gg_v11 cc i) /\ + (!i. cc_qy_v11 cc i ==> &0 <= cc_gg3a_v11 cc i) /\ + (!i. cqu cc (i + 1) /\ cc_qy_v11 cc i + ==> cc_eps <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i + 1)) /\ + (!i. cc_qx_v11 cc i /\ cc_small_v11 cc i /\ ~cc_small_v11 cc (i + 1) + ==> cc_eps <= cc_gg_v11 cc i) /\ +( !i. cqu cc i ==> --cc_eps <= cc_gg_v11 cc i ) /\ +~ cc_small_v11 cc i /\ ~cc_small_v11 cc (i + 5) /\ + ~cc_small_v11 cc i /\ + cc_qy_v11 cc i /\ + cqu cc (i + 1) /\ cc_qx_v11 cc (i + 4) /\ +( !cc i. + cqu cc i <=> + cc_hassmall_v11 cc i /\ cc_4cell_v11 cc i /\ cc_subcrit_v11 cc i ) /\ +( !cc i. + cc_hassmall_v11 cc i <=> + cc_small_v11 cc i /\ cc_small_v11 cc (i + 1) ) /\ + +bb = (cqu cc (i + 2) \/ cc_qx_v11 cc (i + 2) \/ cc_qy_v11 cc (i + 2)) /\ +bb /\ +(! i. cqu cc i \/ cc_qx_v11 cc i \/ cc_qy_v11 cc i ) /\ +(((!i. cc_qy_v11 cc i + ==> cc_gg3a_v11 cc i + cc_gg3b_v11 cc i <= cc_gg_v11 cc i) /\ + (!i. cc_qy_v11 cc i ==> &0 <= cc_gg3a_v11 cc i) /\ + (!i. cqu cc (i + 1) /\ cc_qy_v11 cc i + ==> cc_eps <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i + 1)) + ==> cqu cc (i + 1) /\ cc_qy_v11 cc i + ==> cc_eps <= cc_gg_v11 cc i + cc_gg_v11 cc (i + 1))) +==> &0 <= sum (i..i + 4) (cc_gg_v11 cc) `, +[ASM_SIMP_TAC[SUM_CLAUSES_LEFT; ARITH_RULE` i <= i + 4 /\ i + 1 <= i + 4 /\ (i + 1) + 1 = i + 2 `]; +SIMP_TAC[SUM_CLAUSES_LEFT; ARITH_RULE` i + 2 <= i + 4 /\ (i + 2) + 1 = i + 3 /\ i + 3 <= i + 4 /\ (i + 3 ) + 1 = i + 4 `; SUM_SING_NUMSEG]; +STRIP_TAC; +FIRST_X_ASSUM MP_TAC; +ANTS_TAC; +ASM_REWRITE_TAC[]; +ANTS_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` -- cc_eps <= cc_gg_v11 cc (i + 2) ` ASSUME_TAC; +ASM_CASES_TAC` cc_qy_v11 cc (i + 2) ` ; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc ( i + 2) ` MP_TAC; +ASM_SIMP_TAC[]; +REWRITE_TAC[Oxl_def.cc_eps]; +REAL_ARITH_TAC; +ASM_CASES_TAC` cc_qx_v11 cc (i + 2) ` ; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc ( i + 2) ` MP_TAC; +ASM_SIMP_TAC[]; +REWRITE_TAC[Oxl_def.cc_eps]; +REAL_ARITH_TAC; +UNDISCH_TAC` bb: bool `; + +FIRST_X_ASSUM SUBST1_TAC; +REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN SIMP_TAC[]; +STRIP_TAC THEN STRIP_TAC; +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN` &0 <= cc_gg_v11 cc (i + 3) + cc_gg_v11 cc (i + 4) ` ASSUME_TAC; +ASM_CASES_TAC` cc_qy_v11 cc (i + 3) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +ASM_CASES_TAC` cc_qx_v11 cc (i + 3) ` ; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +FIRST_ASSUM (MP_TAC o (SPEC` i + 3 `)); +REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN SIMP_TAC[]; +FIRST_X_ASSUM NHANH; +ASM_REWRITE_TAC[cc_hassmall_v11; ARITH_RULE` (i + 3) + 1 = i + 4 `]; +REPEAT STRIP_TAC; +SUBGOAL_THEN` cc_eps <= cc_gg_v11 cc (i + 4) ` MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[ARITH_RULE` (i + 4) + 1 = i + 5 `]; +DOWN; +REAL_ARITH_TAC; +DOWNS 3; +REAL_ARITH_TAC]);; + + + + + + +let C5_QY_ALONG_NOT_SMALL2 = prove_by_refinement +(` (!i. (cqx: cc_v11 -> num -> bool) cc i ==> &0 <= (ggg: cc_v11 -> num -> real) cc i) /\ + (!i. cqy cc i ==> &0 <= (ggg: cc_v11 -> num -> real) cc i) /\ + (!i. cqy cc i ==> gga cc i + ggb cc i <= (ggg: cc_v11 -> num -> real) cc i) /\ + (!i. cqy cc i ==> &0 <= gga cc i) /\ + (!i. cqu cc (i + 1) /\ cqy cc i + ==> cc_eps <= ggb cc i + (ggg: cc_v11 -> num -> real) cc (i + 1)) /\ + (!i. (cqx: cc_v11 -> num -> bool) cc i /\ csmall cc i /\ ~csmall cc (i + 1) + ==> cc_eps <= (ggg: cc_v11 -> num -> real) cc i) /\ + (!i. cqu cc i ==> --cc_eps <= (ggg: cc_v11 -> num -> real) cc i) /\ + ~csmall cc i /\ + ~csmall cc (i + 5) /\ + ~csmall cc i /\ + cqy cc i /\ + cqu cc (i + 1) /\ + (cqx: cc_v11 -> num -> bool) cc (i + 4) /\ + (!cc i. + cqu cc i <=> + hasmal cc i /\ fcell cc i /\ subcrt cc i) /\ + (!cc i. + hasmal cc i <=> + csmall cc i /\ csmall cc (i + 1)) /\ + (bb <=> cqu cc (i + 2) \/ (cqx: cc_v11 -> num -> bool) cc (i + 2) \/ cqy cc (i + 2)) /\ + bb /\ + (!i. cqu cc i \/ (cqx: cc_v11 -> num -> bool) cc i \/ cqy cc i) /\ + ((!i. cqy cc i ==> gga cc i + ggb cc i <= (ggg: cc_v11 -> num -> real) cc i) /\ + (!i. cqy cc i ==> &0 <= gga cc i) /\ + (!i. cqu cc (i + 1) /\ cqy cc i + ==> cc_eps <= ggb cc i + (ggg: cc_v11 -> num -> real) cc (i + 1)) + ==> cqu cc (i + 1) /\ cqy cc i + ==> cc_eps <= (ggg: cc_v11 -> num -> real) cc i + (ggg: cc_v11 -> num -> real) cc (i + 1)) + ==> &0 <= sum (i..i + 4) ((ggg: cc_v11 -> num -> real) cc) `, +[ASM_SIMP_TAC[SUM_CLAUSES_LEFT; ARITH_RULE` i <= i + 4 /\ i + 1 <= i + 4 /\ (i + 1) + 1 = i + 2 `]; +SIMP_TAC[SUM_CLAUSES_LEFT; ARITH_RULE` i + 2 <= i + 4 /\ (i + 2) + 1 = i + 3 /\ i + 3 <= i + 4 /\ (i + 3 ) + 1 = i + 4 `; SUM_SING_NUMSEG]; +STRIP_TAC; +FIRST_X_ASSUM MP_TAC; +ANTS_TAC; +ASM_REWRITE_TAC[]; +ANTS_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` -- cc_eps <= (ggg: cc_v11 -> num -> real) cc (i + 2) ` ASSUME_TAC; +ASM_CASES_TAC` (cqy: cc_v11 -> num -> bool) cc (i + 2) ` ; +SUBGOAL_THEN` &0 <= (ggg: cc_v11 -> num -> real) cc ( i + 2) ` MP_TAC; +ASM_SIMP_TAC[]; +REWRITE_TAC[Oxl_def.cc_eps]; +REAL_ARITH_TAC; +ASM_CASES_TAC` (cqx: cc_v11 -> num -> bool) cc (i + 2) ` ; +SUBGOAL_THEN` &0 <= (ggg: cc_v11 -> num -> real) cc ( i + 2) ` MP_TAC; +ASM_SIMP_TAC[]; +REWRITE_TAC[Oxl_def.cc_eps]; +REAL_ARITH_TAC; +UNDISCH_TAC` bb: bool `; + +FIRST_X_ASSUM SUBST1_TAC; +REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN SIMP_TAC[]; +STRIP_TAC THEN STRIP_TAC; +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN` &0 <= (ggg: cc_v11 -> num -> real) cc (i + 3) + (ggg: cc_v11 -> num -> real) cc (i + 4) ` ASSUME_TAC; +ASM_CASES_TAC` (cqy: cc_v11 -> num -> bool) cc (i + 3) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +ASM_CASES_TAC` (cqx: cc_v11 -> num -> bool) cc (i + 3) ` ; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +FIRST_ASSUM (MP_TAC o (SPEC` i + 3 `)); +REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN SIMP_TAC[]; +FIRST_X_ASSUM NHANH; +ASM_REWRITE_TAC[ARITH_RULE` (i + 3) + 1 = i + 4 `]; +REPEAT STRIP_TAC; +SUBGOAL_THEN` cc_eps <= (ggg: cc_v11 -> num -> real) cc (i + 4) ` MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[ARITH_RULE` (i + 4) + 1 = i + 5 `]; +DOWN; +REAL_ARITH_TAC; +DOWNS 3; +REAL_ARITH_TAC]);; + + + + + + + +let LITTLE_CC_GGAA = prove(` (!i. cc_qy_v11 cc i + ==> cc_gg3a_v11 cc i + cc_gg3b_v11 cc i <= cc_gg_v11 cc i ) /\ + (!i. cc_qy_v11 cc i ==> &0 <= cc_gg3b_v11 cc i) /\ +(!i. cc_qx_v11 cc i /\ cc_hassmall_v11 cc i /\ cc_qy_v11 cc (i + 1) + ==> cc_eps <= cc_gg_v11 cc i + cc_gg3a_v11 cc (i + 1)) +==> cc_qx_v11 cc (i) /\ cc_hassmall_v11 cc i /\ cc_qy_v11 cc (i + 1) +==> cc_eps <= cc_gg_v11 cc i + cc_gg_v11 cc (i + 1) `, +STRIP_TAC THEN FIRST_X_ASSUM NHANH THEN FIRST_X_ASSUM NHANH THEN +FIRST_X_ASSUM NHANH THEN REAL_ARITH_TAC);; + + +let LITTLE_CC_GGBB = prove(` (!i. cc_qy_v11 cc i + ==> cc_gg3a_v11 cc i + cc_gg3b_v11 cc i <= cc_gg_v11 cc i ) /\ + (!i. cc_qy_v11 cc i ==> &0 <= cc_gg3a_v11 cc i) /\ +(!i. cc_qx_v11 cc (i + 1) /\ cc_hassmall_v11 cc (i + 1) /\ cc_qy_v11 cc i + ==> cc_eps <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i + 1)) +==> cc_qx_v11 cc (i + 1) /\ cc_hassmall_v11 cc (i + 1) /\ cc_qy_v11 cc i +==> cc_eps <= cc_gg_v11 cc i + cc_gg_v11 cc (i + 1) `, +STRIP_TAC THEN FIRST_X_ASSUM NHANH THEN FIRST_X_ASSUM NHANH THEN +FIRST_X_ASSUM NHANH THEN REAL_ARITH_TAC);; + + + + + + + + + +let C5_QX_NEXT_TO_QY = prove_by_refinement(`((cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0) /\ + cc_card_v11 cc = 5) /\ + ~cc_small_v11 cc i /\ + cc_qy_v11 cc (i) /\ + cc_qx_v11 cc (i + 1) + ==> F `, + +[ +REPEAT STRIP_TAC; +ASSUME_TAC2 UNIQUE_QY; +ASSUME_TAC2 QY_NN00; ASSUME_TAC2 QX_NN00; +ASSUME_TAC2 EXISTS_QY_CARD5; +DOWN_TAC; +NHANH Oxl_def.periodic_fn; + +REWRITE_TAC[cc_bool_model_v11; cc_real_model_v11]; +ONCE_REWRITE_TAC[TAUT` ~ a <=> a ==> F `]; +IMP_TAC; +IMP_TAC; +STRIP_TAC; +STRIP_TAC; +STRIP_TAC; + +ABBREV_TAC` nn = cc_card_v11 cc ` ; +SUBGOAL_THEN` ~ cc_small_v11 cc (i + nn) ` ASSUME_TAC; +ASM_SEARCH_TCL [` periodic ( cc_small_v11 cc) `] MP_TAC; +SIMP_TAC[Oxl_def.periodic]; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` ~ cc_qu_v11 cc (i + 4 ) ` ASSUME_TAC; +SWITCH_TAC` nn = 5 `; +ASM_REWRITE_TAC[cc_qu_v11; cc_hassmall_v11 ; ARITH_RULE` (i + 4) + 1 = i + 5 `]; +ASSUME_TAC2 (ISPECL [` cc_qy_v11 cc `;` nn:num` ;` i:num `] Oxl_def.periodic_mod); +ASSUME_TAC2 (ISPECL [` cc_qx_v11 cc `;` nn:num` ;` i + 4 `] Oxl_def.periodic_mod); +ASSUME_TAC2 (ISPECL [` cc_qy_v11 cc `;` nn:num` ;` i + 4 `] Oxl_def.periodic_mod); +SUBGOAL_THEN` ~ cc_qy_v11 cc (i + 4) ` ASSUME_TAC; +DOWN THEN DOWN THEN DOWN; +REPLICATE_TAC 3 (DISCH_THEN (ASSUME_TAC o SYM)); +FIRST_ASSUM (SUBST1_TAC o SYM); +SUBGOAL_THEN` cc_qy_v11 cc (i MOD nn) /\ (i MOD nn) IN 0..nn - 1` MP_TAC; +SWITCH_TAC` nn = 5 `; +ASM_SIMP_TAC[MOD_IN_NUMSEG]; +ASM_SEARCH_TCL [` cc_qy_v11 cc x /\ x IN 0..nn - 1 `] NHANH; +STRIP_TAC; + +FIRST_X_ASSUM MATCH_MP_TAC; +SWITCH_TAC` nn = 5 `; +ASM_SIMP_TAC[MOD_IN_NUMSEG]; +MP_TAC (SPECL [` 4 `;` nn:num `] (GEN_ALL MOD_INJ1)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +EXPAND_TAC "nn"; +ARITH_TAC; +SIMP_TAC[]; +MP_TAC (SPEC` i + 4 ` QU_OR_QXY); +ASM_REWRITE_TAC[]; +STRIP_TAC; +REPLICATE_TAC 5 DOWN; +REPLICATE_TAC 3 (DISCH_THEN (ASSUME_TAC o SYM)); +STRIP_TAC; +SWITCH_TAC` nn = 5 `; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc i + cc_gg_v11 cc (i + 1) + cc_gg_v11 cc (i + 2 ) ` ASSUME_TAC; +ASM_CASES_TAC` cc_qy_v11 cc (i + 2) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +ASM_CASES_TAC` cc_qx_v11 cc (i + 2) ` ; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +MP_TAC (SPEC` i + 2 ` QU_OR_QXY); +ASM_REWRITE_TAC[]; +ASM_SEARCH_TCL [` -- cc_eps <= x `] NHANH; +NHANH QU_IMP_SMALL; +STRIP_TAC; +ASM_CASES_TAC` cc_small_v11 cc (i + 1) `; +SUBGOAL_THEN` cc_eps <= cc_gg_v11 cc i + cc_gg_v11 cc (i + 1) ` ASSUME_TAC; +MP_TAC LITTLE_CC_GGBB; +PHA; +ANTS_TAC; +ASM_REWRITE_TAC[cc_hassmall_v11; ARITH_RULE` (i + 1) + 1 = i + 2 `]; +SIMP_TAC[]; +DOWNS 3; +REAL_ARITH_TAC; +SUBGOAL_THEN` cc_eps <= cc_gg_v11 cc (i + 1) ` ASSUME_TAC; +ASM_SEARCH_TCL [` a /\ b (i + 1) /\ ~ c ==> cc_eps <= x `;` cc_small_v11 `] MATCH_MP_TAC; +ASM_SIMP_TAC[ARITH_RULE` (i + 1 ) + 1 = i + 2 `]; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc i ` MP_TAC; +ASM_SIMP_TAC[]; +DOWNS 3; +REAL_ARITH_TAC; + + + + + +SUBGOAL_THEN` &0 <= cc_gg_v11 cc (i + 3) + cc_gg_v11 cc (i + 4 ) ` ASSUME_TAC; +ASM_CASES_TAC` cc_qy_v11 cc (i + 3) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +ASM_CASES_TAC` cc_qx_v11 cc (i + 3) ` ; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +MP_TAC (SPEC` i + 3 ` QU_OR_QXY); +ASM_REWRITE_TAC[]; +NHANH QU_IMP_SMALL; +REWRITE_TAC[ARITH_RULE` (i + 3) + 1 = i + 4 `]; +STRIP_TAC; +ASM_SEARCH_TCL [` a /\ b /\ ~ c (i + 1) ==> cc_eps <= x `] (MP_TAC o (SPEC` i + 4 `)); +ANTS_TAC; +ASM_REWRITE_TAC[ARITH_RULE` (i + 4) + 1 = i + 5 `]; +SUBGOAL_THEN` -- cc_eps <= cc_gg_v11 cc (i + 3) ` MP_TAC; +ASM_SIMP_TAC[]; +REAL_ARITH_TAC; + + +SUBGOAL_THEN` &0 <= sum (0..nn - 1) (cc_gg_v11 cc) ` MP_TAC; +ASSUME_TAC2 (ISPECL [` cc_gg_v11 cc `;` nn:num ` ] Oxl_def.periodic_sum); +FIRST_X_ASSUM (SUBST1_TAC o SYM o (SPEC_ALL)); +EXPAND_TAC "nn"; +SIMP_TAC[ARITH_RULE` 5 - 1 + i = i + 4 `; SUM_CLAUSES_LEFT; ARITH_RULE` i <= i + 4 /\ i + 1 <= i + 4 /\ (i + 1) + 1 = i + 2 `]; +SIMP_TAC[SUM_CLAUSES_LEFT; ARITH_RULE` i + 2 <= i + 4 /\ (i + 2) + 1 = i + 3 /\ i + 3 <= i + 4 /\ (i + 3 ) + 1 = i + 4 `; SUM_SING_NUMSEG]; DOWNS 2; +REAL_ARITH_TAC; +ASM_REWRITE_TAC[REAL_ARITH` ~( &0 <= x) <=> x < &0 `]]);; + + + + + + +let LEAST_BOUND_CC_GG = prove(` (!i. cc_qu_v11 cc i ==> --cc_eps <= cc_gg_v11 cc i) /\ + (!i. cc_qx_v11 cc i ==> &0 <= cc_gg_v11 cc i) /\ + (!i. cc_qy_v11 cc i ==> &0 <= cc_gg_v11 cc i) +==> (! i. -- cc_eps <= cc_gg_v11 cc i) `, +SUBGOAL_THEN` -- cc_eps <= &0 ` MP_TAC THENL [ +REWRITE_TAC[Oxl_def.cc_eps] THEN +REAL_ARITH_TAC; MESON_TAC[REAL_LE_TRANS; QU_OR_QXY]]);; + + + + + + + +let C5_QX_NEXT_TO_QY_LEFT = prove_by_refinement(` ((cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0) /\ + cc_card_v11 cc = 5) /\ + ~cc_small_v11 cc i /\ + cc_qx_v11 cc i /\ + cc_qy_v11 cc (i + 4) /\ +cc_qx_v11 cc ( i + 3 ) + ==> F `, +[ +REPEAT STRIP_TAC; +ASSUME_TAC2 UNIQUE_QY; +ASSUME_TAC2 QY_NN00; ASSUME_TAC2 QX_NN00; +ASSUME_TAC2 EXISTS_QY_CARD5; +DOWN_TAC; +NHANH Oxl_def.periodic_fn; + +REWRITE_TAC[cc_bool_model_v11; cc_real_model_v11]; +ONCE_REWRITE_TAC[TAUT` ~ a <=> a ==> F `]; +IMP_TAC; +IMP_TAC; +STRIP_TAC; +STRIP_TAC; +STRIP_TAC; + +ABBREV_TAC` nn = cc_card_v11 cc ` ; +SUBGOAL_THEN` ~ cc_small_v11 cc (i + nn) ` ASSUME_TAC; +ASM_SEARCH_TCL [` periodic ( cc_small_v11 cc) `] MP_TAC; +SIMP_TAC[Oxl_def.periodic]; +ASM_REWRITE_TAC[]; + +SWITCH_TAC` nn = 5 `; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc (i + 2) + cc_gg_v11 cc (i + 3) + cc_gg_v11 cc (i + 4) ` ASSUME_TAC; + + +ASM_CASES_TAC` cc_qy_v11 cc ( i + 2 ) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +ASM_CASES_TAC` cc_qx_v11 cc ( i + 2 ) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +MP_TAC (SPEC` i + 2 ` QU_OR_QXY); +ASM_SIMP_TAC[]; +ASM_SEARCH_TCL [` cc_qu_v11 cc i ==> -- x <= y `] NHANH; +NHANH QU_IMP_SMALL; +REWRITE_TAC[ARITH_RULE` (i + 2) + 1 = i + 3 `]; +STRIP_TAC; +ASM_CASES_TAC` cc_small_v11 cc (i + 4) `; +MP_TAC (SPEC` i + 3 ` (GEN` i:num ` LITTLE_CC_GGAA)); +PHA; +ANTS_TAC; +ASM_REWRITE_TAC[ARITH_RULE` (i + 3) + 1 = i + 4 `; cc_hassmall_v11]; + +ASM_REWRITE_TAC[ARITH_RULE` (i + 3) + 1 = i + 4 `]; +ASSUME_TAC2 LEAST_BOUND_CC_GG; +FIRST_X_ASSUM (MP_TAC o (SPEC` i + 2 `)); +REAL_ARITH_TAC; +ASM_SEARCH_TCL [` a /\ b /\ ~ c (i + 1) ==> cc_eps <= y `] (MP_TAC o (SPEC` i + 3 `)); +ANTS_TAC; +ASM_REWRITE_TAC[ARITH_RULE` (i + 3) + 1 = i + 4 `]; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc (i + 4) ` MP_TAC; +ASM_SIMP_TAC[]; +UNDISCH_TAC` --cc_eps <= cc_gg_v11 cc (i + 2) ` ; +REAL_ARITH_TAC; + +SUBGOAL_THEN` &0 <= cc_gg_v11 cc i + cc_gg_v11 cc ( i + 1) ` ASSUME_TAC; +ASM_CASES_TAC` cc_qy_v11 cc (i + 1) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +ASM_CASES_TAC` cc_qx_v11 cc (i + 1) `; +MATCH_MP_TAC REAL_LE_ADD; +ASM_SIMP_TAC[]; +MP_TAC (SPEC` i + 1 ` QU_OR_QXY); +ASM_REWRITE_TAC[]; +NHANH QU_IMP_SMALL; +STRIP_TAC; +ASM_SEARCH_TCL [` a /\ b (i + 1) /\ ~ c (i) ==> cc_eps <= y `] (ASSUME_TAC2 o (SPEC` i:num `)); +ASSUME_TAC2 LEAST_BOUND_CC_GG; +FIRST_X_ASSUM (MP_TAC o (SPEC` i + 1 `)); +DOWN; +REAL_ARITH_TAC; + + +SUBGOAL_THEN` &0 <= sum (0..nn - 1) (cc_gg_v11 cc) ` MP_TAC; +ASSUME_TAC2 (ISPECL [` cc_gg_v11 cc `;` nn:num ` ] Oxl_def.periodic_sum); +FIRST_X_ASSUM (SUBST1_TAC o SYM o (SPEC_ALL)); +EXPAND_TAC "nn"; +SIMP_TAC[ARITH_RULE` 5 - 1 + i = i + 4 `; SUM_CLAUSES_LEFT; ARITH_RULE` i <= i + 4 /\ i + 1 <= i + 4 /\ (i + 1) + 1 = i + 2 `]; +SIMP_TAC[SUM_CLAUSES_LEFT; ARITH_RULE` i + 2 <= i + 4 /\ (i + 2) + 1 = i + 3 /\ i + 3 <= i + 4 /\ (i + 3 ) + 1 = i + 4 `; SUM_SING_NUMSEG]; + + + + DOWNS 2; +REAL_ARITH_TAC; +ASM_REWRITE_TAC[REAL_ARITH` ~( &0 <= x) <=> x < &0 `]]);; + + + + + + +let BOOL_MODEL_PERIODIC_SMALL = prove(` cc_bool_model_v11 cc ==> +periodic (cc_small_v11 cc ) (cc_card_v11 cc) `, +SIMP_TAC[cc_bool_model_v11]);; + + + + + +let QY_UNIQUE_ANY_SEGMENGT = prove_by_refinement +(` cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0 + ==> (!j. cc_qy_v11 cc j + ==> (!k. ~(k = j) /\ k IN j..cc_card_v11 cc - 1 + j + ==> ~cc_qy_v11 cc k)) `, +[NHANH UNIQUE_QY; +NHANH Oxl_def.periodic_fn; +REWRITE_TAC[cc_bool_model_v11]; +REPEAT STRIP_TAC; +ABBREV_TAC` nn = cc_card_v11 cc `; +FIRST_X_ASSUM (MP_TAC o (SPEC` j MOD nn`)); +ANTS_TAC; +ASM_SIMP_TAC[MOD_IN_NUMSEG]; +ASSUME_TAC2 (ISPECL [` cc_qy_v11 cc `;` nn:num `;`j:num `] Oxl_def.periodic_mod); +FIRST_X_ASSUM (SUBST1_TAC o SYM); +FIRST_ASSUM ACCEPT_TAC; +MP_TAC (SPECL [` k - (j:num) `;` nn:num `] (GEN_ALL MOD_INJ1)); +ANTS_TAC; +UNDISCH_TAC` k IN j..nn - 1 + j `; +ASM_REWRITE_TAC[IN_NUMSEG; ARITH_RULE` j <= (k:num) <=> j = k \/ j < k `]; +UNDISCH_TAC` ~( nn = 0) `; +ARITH_TAC; +UNDISCH_TAC` k IN j..nn - 1 + j `; +ASM_REWRITE_TAC[IN_NUMSEG]; +STRIP_TAC; +DISCH_THEN (MP_TAC o (SPEC` j:num `)); +ASM_SIMP_TAC[ARITH_RULE` j <= k ==> j + k - j = (k:num) `]; +STRIP_TAC; +STRIP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` k MOD nn `)); +ANTS_TAC; +ASM_SIMP_TAC[GSYM IN_NUMSEG; MOD_IN_NUMSEG]; +ASSUME_TAC2 (ISPECL [` cc_qy_v11 cc `;` nn:num `;`k:num `] Oxl_def.periodic_mod); +FIRST_X_ASSUM (SUBST1_TAC o SYM); +ASM_REWRITE_TAC[]]);; + + + + + + +let periodic_mod1 = +REWRITE_RULE[RIGHT_FORALL_IMP_THM] periodic_mod;; + + + + + +let LITTLE_CC_GG3BB = prove(` (!i. cc_qy_v11 cc i ==> &0 <= cc_gg3b_v11 cc i) /\ + (!i. cc_qu_v11 cc (i + 1) /\ cc_qy_v11 cc i + ==> &0 <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i + 1)) /\ +(! i. cc_qy_v11 cc i ==> &0 <= cc_gg_v11 cc i ) /\ +(! i. cc_qx_v11 cc i ==> &0 <= cc_gg_v11 cc i ) /\ + cc_qy_v11 cc i + ==> &0 <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i + 1) `, +MP_TAC (SPEC` i + 1 ` QU_OR_QXY) THEN +MESON_TAC[REAL_ARITH` &0 <= a /\ &0 <= b ==> &0 <= a + b `]);; + + + +let MOD_ADD_CANCEL = +REWRITE_RULE[ARITH_RULE` 1 * n + p = p + n ` ] ( +SPEC` 1 ` MOD_MULT_ADD);; + + + +let LITTLE_CC_GG3AA = prove_by_refinement( +` (!i. cc_qy_v11 cc i ==> &0 <= cc_gg3a_v11 cc i) /\ + (!i. cc_qu_v11 cc i /\ cc_qy_v11 cc (i + 1) + ==> &0 <= cc_gg_v11 cc i + cc_gg3a_v11 cc (i + 1)) /\ +(! i. cc_qy_v11 cc i ==> &0 <= cc_gg_v11 cc i ) /\ +(! i. cc_qx_v11 cc i ==> &0 <= cc_gg_v11 cc i ) /\ +periodic (cc_qy_v11 cc ) nn /\ +periodic (cc_gg3a_v11 cc ) nn /\ +~( nn = 0) + /\ cc_qy_v11 cc i + ==> &0 <= cc_gg_v11 cc ( i + nn - 1 ) + cc_gg3a_v11 cc (i) `, +[ASM_CASES_TAC` cc_qx_v11 cc (i + nn - 1) \/ cc_qy_v11 cc ( i + nn - 1 ) `; +DOWN; +MESON_TAC[REAL_ARITH` &0 <= a /\ &0 <= b ==> &0 <= a + b `]; +MP_TAC (SPEC` i + nn - 1 ` QU_OR_QXY); +ASM_REWRITE_TAC[]; +ABBREV_TAC` nii = i + nn - 1 `; +STRIP_TAC; +STRIP_TAC; +UNDISCH_TAC` !i. cc_qu_v11 cc i /\ cc_qy_v11 cc (i + 1) + ==> &0 <= cc_gg_v11 cc i + cc_gg3a_v11 cc (i + 1) `; +DISCH_THEN (MP_TAC o (SPEC` nii: num `)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (ARITH_RULE ` ~( nn = 0) ==> (i + nn - 1 ) + 1 = i + nn `); +DOWN; +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +ASSUME_TAC2 (ISPECL [` cc_qy_v11 cc `;` nn:num `] periodic_mod1); +FIRST_X_ASSUM (ASSUME_TAC o GSYM); +SUBGOAL_THEN` cc_qy_v11 cc ((i + nn) MOD nn) ` ASSUME_TAC; +REWRITE_TAC[MOD_ADD_CANCEL]; +ASM_REWRITE_TAC[]; +DOWN; +ASM_SIMP_TAC[]; + +SUBGOAL_THEN` nii + 1 = i + nn ` ASSUME_TAC; +EXPAND_TAC "nii"; +UNDISCH_TAC` ~( nn = 0) `; +ARITH_TAC; +ASM_REWRITE_TAC[]; + +ASSUME_TAC2 (ISPECL [` cc_gg3a_v11 cc `; `nn:num `] periodic_mod1); +FIRST_X_ASSUM (ASSUME_TAC o GSYM); +SUBGOAL_THEN` cc_gg3a_v11 cc ((i + nn) MOD nn) = cc_gg3a_v11 cc i ` MP_TAC; +REWRITE_TAC[MOD_ADD_CANCEL]; +ASM_REWRITE_TAC[]; + +ASM_SIMP_TAC[]]);; + + + +let SUM_NUMSEG2 = +SIMP_RULE[ARITH_RULE`m <= m + 1`; SUM_SING_NUMSEG] (SPEC` m + 1` (GEN` n:num ` (SPEC_ALL SUM_CLAUSES_LEFT)));; + +let SUM_NUMSEG33 = +SIMP_RULE[ARITH_RULE`m <= m + 2 /\ m + 2 = (m + 1 ) + 1`; SUM_NUMSEG2] (SPEC` m + 2` (GEN` n:num ` (SPEC_ALL SUM_CLAUSES_LEFT)));; + + +let SUM_NUMSEG3 = +REWRITE_RULE[ARITH_RULE` (a + 1) + 1 = a + 2 `] SUM_NUMSEG33;; + + +let SUM_NUMSEG44 = +SIMP_RULE[ARITH_RULE`m <= m + 3 /\ m + 3 = (m + 1 ) + 2 `; SUM_NUMSEG3] (SPEC` m + 3` (GEN` n:num ` (SPEC_ALL SUM_CLAUSES_LEFT)));; + +let SUM_NUMSEG4 = +REWRITE_RULE[ARITH_RULE` (m + 1) + 2 = m + 3 /\ (m + 1) + 1 = m + 2 `] SUM_NUMSEG44;; + + + + + +let UTEOITF_concl = `!cc. cc_bool_model_v11 cc /\ cc_bool_prep_v11 cc /\ cc_real_model_v11 cc /\ + (sum (0..cc_card_v11 cc -1) (cc_gg_v11 cc) < &0) ==> (!i. cc_4cell_v11 cc i)`;; + + + +let UTEOITF = prove_by_refinement(UTEOITF_concl, +[GEN_TAC; +NHANH RSIWAMP; +STRIP_TAC THEN ASSUME_TAC2 QY_NN00 THEN ASSUME_TAC2 QX_NN00; +ASM_CASES_TAC` !i. cc_4cell_v11 cc i `; +ASM_REWRITE_TAC[]; +DOWN; +REWRITE_TAC[NOT_FORALL_THM; GSYM cc_qy_v11]; +STRIP_TAC; +ASSUME_TAC2 RSIWAMP; +ASSUME_TAC2 THREE_LE_CC_CARD; +ASSUME_TAC2 IPVICGW; +ASSUME_TAC2 UNIQUE_QY; +DOWN_TAC; +NHANH Oxl_def.periodic_fn; +REWRITE_TAC[cc_bool_model_v11; cc_real_model_v11]; +ABBREV_TAC` nn = cc_card_v11 cc `; +STRIP_TAC; + + + +ASM_CASES_TAC` nn = 3 `; +SUBGOAL_THEN` &0 <= cc_gg3a_v11 cc i /\ &0 <= cc_gg3b_v11 cc i ` MP_TAC; +ASM_SIMP_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` &0 <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i + 1) ` ASSUME_TAC; +ASM_CASES_TAC` cc_qy_v11 cc (i + 1) `; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc ( i + 1) ` MP_TAC; +ASM_SIMP_TAC[]; +UNDISCH_TAC` &0 <= cc_gg3b_v11 cc i `; +REAL_ARITH_TAC; +ASM_CASES_TAC` cc_qx_v11 cc (i + 1) `; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc ( i + 1) ` MP_TAC; +ASM_SIMP_TAC[]; +UNDISCH_TAC` &0 <= cc_gg3b_v11 cc i `; +REAL_ARITH_TAC; +MP_TAC (SPEC` i + 1 ` QU_OR_QXY); +ASM_REWRITE_TAC[]; +STRIP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +MP_TAC (GSYM ( +ISPECL [` cc_qy_v11 cc `;` nn:num `] periodic_mod1)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` nn = 3 `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` cc_qy_v11 cc ((1 * 3 + i ) MOD 3) ` MP_TAC; +REWRITE_TAC[MOD_MULT_ADD]; +ASM_REWRITE_TAC[]; + + +MP_TAC LITTLE_CC_GG3AA; +ANTS_TAC; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` cc_gg3a_v11 cc i + cc_gg3b_v11 cc (i) <= cc_gg_v11 cc i ` ASSUME_TAC; +ASM_SIMP_TAC[]; +STRIP_TAC THEN STRIP_TAC; +SUBGOAL_THEN` &0 <= sum (0..nn - 1) (cc_gg_v11 cc) ` MP_TAC; +ASSUME_TAC2 ( +ISPECL [` cc_gg_v11 cc `;` nn:num `] periodic_sum); +FIRST_X_ASSUM (ASSUME_TAC o GSYM); + +ASM_REWRITE_TAC[]; +EXPAND_TAC "nn"; +REWRITE_TAC[ARITH_RULE` 3 - 1 = 2 /\ 2 + i = i + 2`; SUM_NUMSEG3]; + +UNDISCH_TAC` &0 <= cc_gg_v11 cc (i + nn - 1) + cc_gg3a_v11 cc i `; +UNDISCH_TAC` &0 <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i + 1) `; +UNDISCH_TAC` cc_gg3a_v11 cc i + cc_gg3b_v11 cc i <= cc_gg_v11 cc i `; +EXPAND_TAC "nn"; +REWRITE_TAC[ARITH_RULE` 3 - 1 = 2 `]; +PHA; +REAL_ARITH_TAC; + +ASM_REWRITE_TAC[REAL_ARITH` &0 <= x <=> ~( x < &0 ) `]; +ASSUME_TAC2 (ISPECL [` cc_gg_v11 cc `;` nn:num `] periodic_sum); +FIRST_X_ASSUM (ASSUME_TAC o GSYM); +DOWN; +FIRST_X_ASSUM (MP_TAC o (SPEC` i MOD nn`)); +ASSUME_TAC2 (ISPECL [` cc_qy_v11 cc `; `nn:num `] periodic_mod1); +FIRST_X_ASSUM (ASSUME_TAC o GSYM); +ANTS_TAC; +ASM_SIMP_TAC[MOD_IN_NUMSEG]; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPEC` (i + 1) MOD nn `)); +ANTS_TAC; +ASM_SIMP_TAC[MOD_IN_NUMSEG]; +MATCH_MP_TAC (GSYM MOD_INJ11); +ASM_REWRITE_TAC[]; +UNDISCH_TAC` 3 <= nn `; +ARITH_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASM_CASES_TAC` cc_qx_v11 cc (i + 1 ) `; +ASM_SEARCH_TCL [` !i. cc_qx_v11 cc (i + 1) /\ cc_hassmall_v11 cc (i + 1) /\ cc_qy_v11 cc i + ==> cc_eps <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i + 1)`] (MP_TAC o (SPEC` i:num `)); +ANTS_TAC; +ASM_REWRITE_TAC[cc_hassmall_v11]; +STRIP_TAC; + + +SUBGOAL_THEN` &0 <= cc_gg_v11 cc (i + 3 ) + cc_gg3a_v11 cc ((i + 3) + 1 ) ` ASSUME_TAC; +ASM_CASES_TAC` cc_qu_v11 cc ( i + 3) `; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (ARITH_RULE` ~( nn = 3) /\ 3 <= nn /\ nn <= 4 ==> 4 = nn`); +SUBGOAL_THEN` cc_qy_v11 cc ((i + 4 ) MOD 4 ) ` MP_TAC; +REWRITE_TAC[MOD_ADD_CANCEL]; +ASM_REWRITE_TAC[]; + +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[ARITH_RULE` (i + 3) + 1 = i + 4 `]; + +REWRITE_TAC[ARITH_RULE` (i + 3) + 1 = i + 4 `]; +ASSUME_TAC2 (ARITH_RULE` ~( nn = 3) /\ 3 <= nn /\ nn <= 4 ==> 4 = nn`); +SUBGOAL_THEN` cc_qy_v11 cc ((i + 4) MOD 4 ) ` ASSUME_TAC; +REWRITE_TAC[MOD_ADD_CANCEL]; +ASM_REWRITE_TAC[]; +DOWN; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` &0 <= cc_gg3a_v11 cc (i + nn) ` MP_TAC; +ASM_SIMP_TAC[]; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc ( i + 3) ` MP_TAC; +MP_TAC (SPEC` i + 3 ` QU_OR_QXY); +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASM_SIMP_TAC[]; +ASM_SIMP_TAC[]; +REAL_ARITH_TAC; + +ASSUME_TAC2 LEAST_BOUND_CC_GG; +STRIP_TAC; +SUBGOAL_THEN` &0 <= sum (0..nn - 1) (cc_gg_v11 cc) ` MP_TAC; +ASM_REWRITE_TAC[]; + + +ASSUME_TAC2 (ARITH_RULE` ~( nn = 3) /\ 3 <= nn /\ nn <= 4 ==> 4 = nn`); +EXPAND_TAC "nn"; +REWRITE_TAC[ARITH_RULE` 4 - 1 + i = i + 3 `; SUM_NUMSEG4]; +ASSUME_TAC2 ( +ISPECL [` cc_gg3a_v11 cc `;` nn:num `] periodic_mod1); +FIRST_X_ASSUM (ASSUME_TAC o GSYM); +SUBGOAL_THEN` cc_gg3a_v11 cc (((i + 3) + 1) MOD 4) = cc_gg3a_v11 cc i ` ASSUME_TAC; +REWRITE_TAC[ARITH_RULE` (i + 3) + 1 = i + 4 `; MOD_ADD_CANCEL]; +ASM_REWRITE_TAC[]; +DOWN; +ASM_REWRITE_TAC[]; +DISCH_THEN SUBST_ALL_TAC; +UNDISCH_TAC` cc_eps <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i + 1) `; +UNDISCH_TAC` &0 <= cc_gg_v11 cc (i + 3) + cc_gg3a_v11 cc i`; +SUBGOAL_THEN` -- cc_eps <= cc_gg_v11 cc ( i + 2) ` MP_TAC; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` cc_gg3a_v11 cc i + cc_gg3b_v11 cc i <= cc_gg_v11 cc i ` ASSUME_TAC; +ASM_SIMP_TAC[]; +DOWN; +PHA; +REAL_ARITH_TAC; +ASM_REWRITE_TAC[REAL_ARITH` &0 <= x <=> ~( x < &0 ) `]; +MP_TAC (SPEC` i + 1 ` QU_OR_QXY); +ASM_REWRITE_TAC[]; +STRIP_TAC; + + + + +(* ========================== *) +ASSUME_TAC2 LEAST_BOUND_CC_GG; +DOWN; + +FIRST_ASSUM (MP_TAC o (SPEC ` (i + 2) MOD nn `)); +ANTS_TAC; +ASM_SIMP_TAC[MOD_IN_NUMSEG]; +MATCH_MP_TAC (GSYM MOD_INJ11); +ASM_REWRITE_TAC[ARITH_RULE` ~( 0 = 2) `]; +UNDISCH_TAC` 3 <= nn `; +ARITH_TAC; +STRIP_TAC; +FIRST_ASSUM (MP_TAC o (SPEC ` (i + 3) MOD nn `)); +ANTS_TAC; +ASM_SIMP_TAC[MOD_IN_NUMSEG]; +MATCH_MP_TAC (GSYM MOD_INJ11); +ASM_REWRITE_TAC[ARITH_RULE` ~( 0 = 3) `]; +UNDISCH_TAC` 3 <= nn `; +UNDISCH_TAC` ~( nn = 3)`; +ARITH_TAC; +STRIP_TAC; +DOWN THEN DOWN; +ASM_REWRITE_TAC[]; +STRIP_TAC THEN STRIP_TAC; + +ASM_CASES_TAC` cc_qx_v11 cc ( i + 2 ) `; +SUBGOAL_THEN` &0 <= cc_gg_v11 cc ( i + 2) ` ASSUME_TAC; +ASM_SIMP_TAC[]; +MP_TAC LITTLE_CC_GG3BB; +ANTS_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +MP_TAC LITTLE_CC_GG3AA; +ANTS_TAC; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (ARITH_RULE` 3 <= nn /\ nn <= 4 /\ ~( nn = 3) ==> 4 = nn `); +EXPAND_TAC "nn"; +REWRITE_TAC[ARITH_RULE` 4 - 1 = 3 `]; +SUBGOAL_THEN` cc_gg3a_v11 cc i + cc_gg3b_v11 cc i <= cc_gg_v11 cc i ` MP_TAC; +ASM_SIMP_TAC[]; +REPEAT STRIP_TAC; +SUBGOAL_THEN` &0 <= sum (0..nn - 1 ) (cc_gg_v11 cc) ` MP_TAC; +EXPAND_TAC "nn"; +ASM_REWRITE_TAC[ARITH_RULE` 4 - 1 = 3 /\ 3 + i = i + 3`]; +REWRITE_TAC[SUM_NUMSEG4]; +UNDISCH_TAC` &0 <= cc_gg_v11 cc (i + 3) + cc_gg3a_v11 cc i `; +UNDISCH_TAC` cc_gg3a_v11 cc i + cc_gg3b_v11 cc i <= cc_gg_v11 cc i `; +UNDISCH_TAC` &0 <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i + 1) `; +UNDISCH_TAC` &0 <= cc_gg_v11 cc (i + 2) `; +PHA; +REAL_ARITH_TAC; + + +ASM_REWRITE_TAC[REAL_ARITH` &0 <= x <=> ~( x < &0 ) `]; +ASM_CASES_TAC` cc_qx_v11 cc ( i + 3) `; + + + +ASSUME_TAC2 (ARITH_RULE` 3 <= nn /\ nn <= 4 /\ ~( nn = 3) ==> 4 = nn `); +SUBGOAL_THEN` cc_qy_v11 cc ((i + 4) MOD 4) ` ASSUME_TAC; +REWRITE_TAC[MOD_ADD_CANCEL]; +ASM_REWRITE_TAC[]; +DOWN; +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASM_SEARCH_TCL [` cc_eps <= x + cc_gg3a_v11 cc i `] (MP_TAC o (SPEC` i + 3 `)); +ANTS_TAC; +ASM_REWRITE_TAC[ARITH_RULE` (i + 3) + 1 = i + 4 `; cc_hassmall_v11]; +STRIP_TAC; +MP_TAC LITTLE_CC_GG3BB; +ANTS_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; + +STRIP_TAC; +SUBGOAL_THEN` -- cc_eps <= cc_gg_v11 cc (i + 2) ` MP_TAC; +ASM_SIMP_TAC[]; +STRIP_TAC; + +SUBGOAL_THEN` cc_gg3a_v11 cc ((i + 4) MOD 4) = cc_gg3a_v11 cc i ` MP_TAC; +REWRITE_TAC[MOD_ADD_CANCEL]; +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (ISPECL [` cc_gg3a_v11 cc `;` nn:num `] periodic_mod1); +FIRST_X_ASSUM (ASSUME_TAC o GSYM); +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (ISPECL [` cc_gg3a_v11 cc `;` nn:num `] periodic_mod1); +FIRST_X_ASSUM (ASSUME_TAC o GSYM); +ASM_REWRITE_TAC[]; +STRIP_TAC; + +STRIP_TAC; +SUBGOAL_THEN` &0 <= sum (0..nn - 1) (cc_gg_v11 cc ) ` MP_TAC; +ASM_REWRITE_TAC[]; +EXPAND_TAC "nn"; +REWRITE_TAC[ARITH_RULE` 4 - 1 + i = i + 3 `; SUM_NUMSEG4]; +SUBGOAL_THEN` cc_gg3a_v11 cc i + cc_gg3b_v11 cc i <= cc_gg_v11 cc i ` MP_TAC; +ASM_SIMP_TAC[]; + +UNDISCH_TAC` &0 <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i + 1) `; +UNDISCH_TAC` cc_eps <= cc_gg_v11 cc (i + 3) + cc_gg3a_v11 cc ((i + 3) + 1) `; +PHA; +ASM_REWRITE_TAC[ARITH_RULE` (i + 3) + 1 = i + 4 `]; +SUBGOAL_THEN` --cc_eps <= cc_gg_v11 cc (i + 2) ` MP_TAC; +ASM_REWRITE_TAC[]; +REAL_ARITH_TAC; +DOWN; +ASM_REWRITE_TAC[ARITH_RULE` &0 <= x <=> ~( x < &0 ) `]; + + + + + + + + + +MP_TAC (SPEC` i + 2 ` QU_OR_QXY); +MP_TAC (SPEC` i + 3 ` QU_OR_QXY); +ASM_REWRITE_TAC[]; +STRIP_TAC; +STRIP_TAC; +SUBGOAL_THEN` #0.008 * cc_azim_v11 cc i <= cc_gg_v11 cc i ` ASSUME_TAC; +ASM_SIMP_TAC[]; +ASSUME_TAC2 (ISPECL [` cc_azim_v11 cc `;` nn:num `] periodic_sum); +ASM_SEARCH_TCL [` &2 * pi `] MP_TAC; +FIRST_X_ASSUM (ASSUME_TAC o GSYM); +DOWN; +SIMP_TAC[]; +ASSUME_TAC2 (ARITH_RULE` 3 <= nn /\ nn <= 4 /\ ~( nn = 3) ==> 4 = nn `); +EXPAND_TAC "nn"; +REWRITE_TAC[ARITH_RULE` 4 - 1 + i = i + 3 /\ 4 - 1 = 3 `]; +REPEAT STRIP_TAC; +UNDISCH_TAC` sum (i..i + 3) (cc_azim_v11 cc) = &2 * pi `; +REWRITE_TAC[SUM_NUMSEG4]; +STRIP_TAC; + +ASM_CASES_TAC` #2.089 <= cc_azim_v11 cc i ` ; +ASM_SEARCH_TCL [`#0.161517`] (ASSUME_TAC2 o (SPEC` i + 1 `)); +ASM_SEARCH_TCL [`!i. cc_qu_v11 cc i + ==> #0.161517 - #0.119482 * cc_azim_v11 cc i <= cc_gg_v11 cc i`] (ASSUME_TAC2 o (SPEC` i + 2 `)); +ASM_SEARCH_TCL [`!i. cc_qu_v11 cc i + ==> #0.161517 - #0.119482 * cc_azim_v11 cc i <= cc_gg_v11 cc i`] (ASSUME_TAC2 o (SPEC` i + 3 `)); +SUBGOAL_THEN` &0 <= sum (0..nn - 1) (cc_gg_v11 cc ) ` MP_TAC; +EXPAND_TAC "nn"; +REWRITE_TAC[ARITH_RULE` 4 - 1 = 3 `]; +ASM_REWRITE_TAC[SUM_NUMSEG4]; +DOWNS 4; +DOWN; +UNDISCH_TAC` #0.008 * cc_azim_v11 cc i <= cc_gg_v11 cc i `; +MP_TAC (PI_BOUNDS); +REAL_ARITH_TAC; + +ASM_REWRITE_TAC[REAL_ARITH` &0 <= x <=> ~( x < &0) `]; + + +ASM_CASES_TAC` cc_azim_v11 cc i <= #1.946 `; +UNDISCH_TAC` !i. cc_qu_v11 cc i + ==> -- #0.0659 + #0.042 * cc_azim_v11 cc i <= cc_gg_v11 cc i `; +STRIP_TAC; +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` i + 1 `)); +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` i + 2 `)); +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` i + 3 `)); +SUBGOAL_THEN` &0 <= sum (0..nn - 1) (cc_gg_v11 cc) ` MP_TAC; +EXPAND_TAC "nn"; +REWRITE_TAC[ARITH_RULE` 4 - 1 = 3 `]; +ASM_REWRITE_TAC[SUM_NUMSEG4]; +DOWNS 3; +UNDISCH_TAC` cc_azim_v11 cc i <= #1.946 `; +UNDISCH_TAC` cc_azim_v11 cc i + + cc_azim_v11 cc (i + 1) + + cc_azim_v11 cc (i + 2) + + cc_azim_v11 cc (i + 3) = + &2 * pi `; +MP_TAC PI_BOUNDS; +UNDISCH_TAC` #0.008 * cc_azim_v11 cc i <= cc_gg_v11 cc i `; +REAL_ARITH_TAC; + +ASM_REWRITE_TAC[REAL_ARITH` &0 <= x <=> ~( x < &0) `]; +ASM_CASES_TAC` cc_small_eta_v11 cc i /\ + cc_small_eta_v11 cc (i + 1) `; +UNDISCH_TAC` !i. cc_qy_v11 cc i /\ + cc_small_eta_v11 cc i /\ + cc_small_eta_v11 cc (i + 1) /\ + #1.946 <= cc_azim_v11 cc i /\ + cc_azim_v11 cc i <= #2.089 + ==> #3.0 * cc_eps <= cc_gg_v11 cc i `; +DISCH_THEN (MP_TAC o (SPEC` i:num `)); +ANTS_TAC; +ASM_REWRITE_TAC[]; +DOWNS 3; +REAL_ARITH_TAC; +STRIP_TAC; +SUBGOAL_THEN` -- cc_eps <= cc_gg_v11 cc (i + 1) /\ +-- cc_eps <= cc_gg_v11 cc (i + 2) /\ +-- cc_eps <= cc_gg_v11 cc (i + 3) ` MP_TAC; +ASM_REWRITE_TAC[]; +STRIP_TAC; +SUBGOAL_THEN` &0 <= sum (0..nn - 1) (cc_gg_v11 cc ) ` MP_TAC; +EXPAND_TAC "nn"; +REWRITE_TAC[ARITH_RULE` 4 - 1 = 3 `]; +ASM_REWRITE_TAC[SUM_NUMSEG4]; +DOWNS 4; +REAL_ARITH_TAC; +ASM_REWRITE_TAC[REAL_ARITH` &0 <= x <=> ~( x < &0) `]; + + +UNDISCH_TAC` sum (0..nn - 1) (cc_gg_v11 cc) < &0 `; +EXPAND_TAC "nn"; +REWRITE_TAC[ARITH_RULE` 4 - 1 = 3 `]; +ASM_REWRITE_TAC[]; +REWRITE_TAC[REAL_ARITH` a < &0 <=> ~( &0 <= a ) `; SUM_NUMSEG4]; +STRIP_TAC; + + + +UNDISCH_TAC`~(cc_small_eta_v11 cc i /\ cc_small_eta_v11 cc (i + 1)) `; +REWRITE_TAC[DE_MORGAN_THM]; +STRIP_TAC; +ASSUME_TAC2 (ISPECL [` cc_small_eta_v11 cc `; `nn:num `] periodic_mod1); +FIRST_X_ASSUM (ASSUME_TAC o GSYM); +SUBGOAL_THEN` ~cc_small_eta_v11 cc ((i + 4) MOD 4)` ASSUME_TAC; +REWRITE_TAC[MOD_ADD_CANCEL]; +ASM_REWRITE_TAC[]; +DOWN; +ASM_REWRITE_TAC[]; +STRIP_TAC; +UNDISCH_TAC` !i. cc_qu_v11 cc i /\ ~cc_small_eta_v11 cc (i + 1) + ==> cc_eps <= cc_gg_v11 cc i `; +DISCH_THEN (MP_TAC o (SPEC` i + 3 `)); +ANTS_TAC; +ASM_REWRITE_TAC[ARITH_RULE` (i + 3) + 1 = i + 4 `]; +STRIP_TAC; +SUBGOAL_THEN` -- cc_eps <= cc_gg_v11 cc (i + 2 ) ` ASSUME_TAC; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` &0 <= cc_gg3b_v11 cc i + cc_gg_v11 cc (i + 1) `ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` &0 <= cc_gg3a_v11 cc i /\ cc_gg3a_v11 cc i + cc_gg3b_v11 cc i <= cc_gg_v11 cc i ` ASSUME_TAC; +ASM_SIMP_TAC[]; + +SUBGOAL_THEN` &0 <= + cc_gg_v11 cc i + + cc_gg_v11 cc (i + 1) + + cc_gg_v11 cc (i + 2) + + cc_gg_v11 cc (i + 3) ` MP_TAC; +DOWNS 4; +REAL_ARITH_TAC; +ASM_REWRITE_TAC[]; + +UNDISCH_TAC` !i. cc_qu_v11 cc i /\ ~cc_small_eta_v11 cc i ==> cc_eps <= cc_gg_v11 cc i `; +DISCH_THEN (MP_TAC o (SPEC` i + 1 `)); +ANTS_TAC; +ASM_REWRITE_TAC[]; + +SUBGOAL_THEN` -- cc_eps <= cc_gg_v11 cc (i + 2 ) ` ASSUME_TAC; + +ASM_REWRITE_TAC[]; +UNDISCH_TAC` !i. cc_qu_v11 cc i /\ cc_qy_v11 cc (i + 1) + ==> &0 <= cc_gg_v11 cc i + cc_gg3a_v11 cc (i + 1) `; +DISCH_THEN (MP_TAC o (SPEC` i + 3 `)); +ANTS_TAC; +ASM_REWRITE_TAC[ARITH_RULE` (i + 3) + 1 = i + 4 `]; +SUBGOAL_THEN` cc_qy_v11 cc ((i + nn) MOD nn) ` MP_TAC; +REWRITE_TAC[MOD_ADD_CANCEL]; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[]; +DOWN; +SUBGOAL_THEN` &0 <= cc_gg3b_v11 cc i /\ cc_gg3a_v11 cc i + cc_gg3b_v11 cc i <= cc_gg_v11 cc i ` MP_TAC; +ASM_SIMP_TAC[]; + +SUBGOAL_THEN` cc_gg3a_v11 cc (((i + 3) + 1) MOD 4) = cc_gg3a_v11 cc i ` MP_TAC; +REWRITE_TAC[ARITH_RULE` (i + 3) + 1 = i + 4 `; MOD_ADD_CANCEL]; +ASM_SIMP_TAC[]; +MATCH_MP_TAC (GSYM periodic_mod); +ASM_REWRITE_TAC[]; + + +ASSUME_TAC2 (ISPECL [` cc_gg3a_v11 cc `;` nn:num `] periodic_mod1); +FIRST_X_ASSUM (ASSUME_TAC o GSYM); +ASM_REWRITE_TAC[]; +SIMP_TAC[]; +STRIP_TAC; +UNDISCH_TAC` ~(&0 <= + cc_gg_v11 cc i + + cc_gg_v11 cc (i + 1) + + cc_gg_v11 cc (i + 2) + + cc_gg_v11 cc (i + 3)) `; +SUBGOAL_THEN` -- cc_eps <= cc_gg_v11 cc (i + 2) ` MP_TAC; +ASM_REWRITE_TAC[]; +REAL_ARITH_TAC]);; + + + +let GRHIDFA_ALT = prove_by_refinement(`!cc. cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0 + ==> ~(cc_card_v11 cc = 4) `, +[NHANH UTEOITF; +NHANH IPVICGW; +REPEAT STRIP_TAC; +ASSUME_TAC2 QY_NN00 THEN ASSUME_TAC2 QX_NN00; +DOWN_TAC; +NHANH Oxl_def.periodic_fn; +REWRITE_TAC[cc_bool_model_v11; cc_real_model_v11]; +ONCE_REWRITE_TAC[TAUT` ~ a <=> a ==> F `]; +ABBREV_TAC` nn = cc_card_v11 cc `; +STRIP_TAC; +ABBREV_TAC ` squ = { i | i <= 3 /\ cc_qu_v11 cc i } `; +SWITCH_TAC` nn = 4 `; +ASSUME_TAC (SPECL [` 0 `;` 3 `] FINITE_NUMSEG); +SUBGOAL_THEN` squ SUBSET 0..3 ` ASSUME_TAC; +EXPAND_TAC "squ"; +REWRITE_TAC[numseg; LE_0]; +CONV_TAC SET_RULE; +SUBGOAL_THEN` FINITE (squ: num -> bool) ` ASSUME_TAC; +MATCH_MP_TAC FINITE_SUBSET; +EXISTS_TAC` 0..3 `; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` ! i. cc_qu_v11 cc i \/ cc_qx_v11 cc i ` ASSUME_TAC; +ASM_REWRITE_TAC[cc_qx_v11]; +MESON_TAC[]; +ABBREV_TAC` sqx = { i | i <= 3 /\ cc_qx_v11 cc i } ` ; +SUBGOAL_THEN` sqx UNION squ = 0..3` ASSUME_TAC; +EXPAND_TAC "squ"; +EXPAND_TAC "sqx"; +REWRITE_TAC[numseg; LE_0]; +UNDISCH_TAC` !i. cc_qu_v11 cc i \/ cc_qx_v11 cc i `; +REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_UNION]; +MESON_TAC[]; + + +SUBGOAL_THEN` DISJOINT sqx (squ:num -> bool) ` ASSUME_TAC; +EXPAND_TAC "squ" THEN EXPAND_TAC "sqx"; +REWRITE_TAC[cc_qx_v11]; +CONV_TAC SET_RULE; + +SUBGOAL_THEN` sqx SUBSET 0..3 ` ASSUME_TAC; +EXPAND_TAC "sqx"; +REWRITE_TAC[numseg; LE_0]; +CONV_TAC SET_RULE; +SUBGOAL_THEN` FINITE (sqx:num -> bool) ` ASSUME_TAC; +MATCH_MP_TAC FINITE_SUBSET; +EXISTS_TAC` 0..3 `; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` DISJOINT squ (sqx: num -> bool) ` ASSUME_TAC; +ONCE_REWRITE_TAC[DISJOINT_SYM]; +ASM_REWRITE_TAC[]; + + +SUBGOAL_THEN`! f. sum (squ UNION sqx) f = sum squ f + sum (sqx:num -> bool) f ` ASSUME_TAC; +GEN_TAC; +MATCH_MP_TAC SUM_UNION; +ASM_REWRITE_TAC[]; + +MP_TAC (ISPECL [` squ: num -> bool `;` sqx: num -> bool `] CARD_UNION); +ANTS_TAC; +ASM_REWRITE_TAC[GSYM DISJOINT]; +UNDISCH_TAC` sqx UNION squ = 0..3 `; +REWRITE_TAC[UNION_COMM]; +STRIP_TAC; +ASM_REWRITE_TAC[CARD_NUMSEG; ARITH_RULE` (3 + 1) - 0 = 4 `]; +STRIP_TAC; SUBGOAL_THEN` !i. i IN squ + ==> #0.161517 - #0.119482 * cc_azim_v11 cc i <= cc_gg_v11 cc i ` ASSUME_TAC; +EXPAND_TAC "squ"; +REWRITE_TAC[IN_ELIM_THM]; +GEN_TAC THEN STRIP_TAC; +ASM_SIMP_TAC[]; + +SUBGOAL_THEN` ! i. i IN sqx +==> #0.213849 - #0.119482 * cc_azim_v11 cc i <= cc_gg_v11 cc i ` ASSUME_TAC; +EXPAND_TAC "sqx"; +REWRITE_TAC[IN_ELIM_THM]; +GEN_TAC THEN STRIP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[cc_hassmall_v11]; + +ASM_CASES_TAC` CARD (squ: num -> bool) <= 2 ` ; +SWITCH_TAC` squ UNION sqx = 0..3 `; +SUBGOAL_THEN` sum squ (\i. #0.161517 - #0.119482 * cc_azim_v11 cc i ) <= + sum squ (cc_gg_v11 cc) ` ASSUME_TAC; +MATCH_MP_TAC SUM_LE; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` sum sqx (\i. #0.213849 - #0.119482 * cc_azim_v11 cc i ) <= + sum sqx (cc_gg_v11 cc) ` ASSUME_TAC; +MATCH_MP_TAC SUM_LE; +ASM_REWRITE_TAC[]; + +UNDISCH_TAC` sum (0..nn - 1) (cc_gg_v11 cc) < &0 `; +EXPAND_TAC "nn"; +REWRITE_TAC[ARITH_RULE` 4 - 1 = 3 `]; +ASM_REWRITE_TAC[ARITH_RULE` ~( x < &0 ) <=> &0 <= x `]; +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC` sum squ (\i. #0.161517 - #0.119482 * cc_azim_v11 cc i) + +sum sqx (\i. #0.213849 - #0.119482 * cc_azim_v11 cc i ) `; +CONJ_TAC; +ASM_SIMP_TAC[SUM_SUB; SUM_LMUL; SUM_CONST]; +UNDISCH_TAC` sum (0..nn - 1) (cc_azim_v11 cc) = &2 * pi `; +EXPAND_TAC "nn"; +REWRITE_TAC[ARITH_RULE` 4 - 1 = 3 `]; +ASM_REWRITE_TAC[ETA_AX]; +UNDISCH_TAC` nn = CARD (squ: num -> bool) + CARD (sqx: num -> bool) `; +UNDISCH_TAC` CARD (squ: num -> bool) <= 2 `; +REWRITE_TAC[GSYM REAL_OF_NUM_LE; GSYM REAL_OF_NUM_EQ; GSYM REAL_OF_NUM_ADD]; +EXPAND_TAC "nn"; +MP_TAC PI_BOUNDS; +REAL_ARITH_TAC; + +DOWNS 2; +REAL_ARITH_TAC; + + +ASM_CASES_TAC` ! i. i < 4 ==> cc_qu_v11 cc i ` ; +SUBGOAL_THEN` ! i. 0 <= i /\ i <= 3 ==> -- #0.0659 + #0.042 * cc_azim_v11 cc i <= cc_gg_v11 cc i ` ASSUME_TAC; +REWRITE_TAC[ARITH_RULE` 0 <= x /\ x <= 3 <=> x < 4 `]; +FIRST_X_ASSUM NHANH; +ASM_SIMP_TAC[]; + +DOWN; +PHA; +NHANH SUM_LE_NUMSEG; +REWRITE_TAC[SUM_ADD_NUMSEG; SUM_LMUL; ETA_AX; SUM_CONST_NUMSEG]; +REWRITE_TAC[ARITH_RULE` ( 3 + 1 ) - 0 = 4`]; +UNDISCH_TAC` sum (0..nn - 1) (cc_azim_v11 cc) = &2 * pi `; +EXPAND_TAC "nn"; +REWRITE_TAC[ARITH_RULE` 4 - 1 = 3 `]; +SIMP_TAC[]; +REPEAT STRIP_TAC; +SUBGOAL_THEN` &0 <= sum (0..3) (cc_gg_v11 cc) ` MP_TAC; +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC` &4 * -- #0.0659 + #0.042 * &2 * pi `; +DOWN THEN SIMP_TAC[]; +MP_TAC PI_BOUNDS; +REAL_ARITH_TAC; +ASM_REWRITE_TAC[REAL_ARITH` ~( &0 <= x ) <=> x < &0 `]; +UNDISCH_TAC` sum (0..nn - 1) (cc_gg_v11 cc) < &0 `; +EXPAND_TAC "nn"; +SIMP_TAC[ARITH_RULE` 4 - 1 = 3 `]; +SUBGOAL_THEN` ? i. i < 4 /\ ~ cc_qu_v11 cc i ` ASSUME_TAC; +DOWN; +MESON_TAC[]; +DOWN THEN STRIP_TAC; +SUBGOAL_THEN` cc_qx_v11 cc i ` ASSUME_TAC; +ASM_REWRITE_TAC[cc_qx_v11]; + +SUBGOAL_THEN` CARD (sqx:num -> bool) <= 1 ` ASSUME_TAC; +UNDISCH_TAC` nn = CARD (squ:num -> bool) + CARD (sqx:num -> bool) `; +UNDISCH_TAC` ~(CARD (squ:num -> bool) <= 2) `; +EXPAND_TAC "nn"; +ARITH_TAC; +SUBGOAL_THEN` ! j. j <= 3 /\ ~(j = i) ==> cc_qu_v11 cc j ` ASSUME_TAC; +GEN_TAC THEN STRIP_TAC; +ASM_CASES_TAC` cc_qx_v11 cc j `; +SUBGOAL_THEN` {i, j:num} SUBSET sqx ` ASSUME_TAC; +EXPAND_TAC "sqx"; +REWRITE_TAC[IN_ELIM_THM; INSERT_SUBSET; EMPTY_SUBSET]; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` i < 4 `; +ARITH_TAC; + +UNDISCH_TAC` ~( j = (i:num)) ` ; +REWRITE_TAC[GSYM Geomdetail.CARD2; INSERT_COMM]; +STRIP_TAC; +SUBGOAL_THEN` CARD {i, j:num} <= CARD (sqx:num -> bool)` ASSUME_TAC; +MATCH_MP_TAC CARD_SUBSET; +ASM_REWRITE_TAC[]; +DOWN; +ASM_REWRITE_TAC[]; +NHANH (ARITH_RULE` 2 <= a ==> ~( a <= 1 ) `); +ASM_REWRITE_TAC[]; +UNDISCH_TAC` !i. cc_qu_v11 cc i \/ cc_qx_v11 cc i `; +DISCH_THEN (MP_TAC o (SPEC` j:num `)); +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (ISPECL [` cc_qu_v11 cc `;` nn:num `] periodic_mod1); +FIRST_X_ASSUM (ASSUME_TAC o GSYM); + +MP_TAC (ISPECL [` 3`] Hypermap.LE_MOD_SUC); +REWRITE_TAC[ARITH_RULE` SUC 3 = 4 `]; +STRIP_TAC; + +SUBGOAL_THEN` i MOD nn = i ` ASSUME_TAC; +MATCH_MP_TAC MOD_LT; +UNDISCH_TAC` i < 4 `; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` !j. j <= 3 /\ ~(j = i) ==> cc_qu_v11 cc j `; +EXPAND_TAC "i"; +STRIP_TAC; + +SUBGOAL_THEN` cc_qu_v11 cc (( i + 1) MOD 4 ) ` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +UNDISCH_TAC` nn = CARD (squ:num -> bool) + CARD (sqx: num -> bool) `; +DISCH_THEN (ASSUME_TAC o SYM); +CONJ_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` 4 = nn `; +SIMP_TAC[]; +STRIP_TAC; +MATCH_MP_TAC (GSYM MOD_INJ11); +EXPAND_TAC "nn"; +ARITH_TAC; + +SUBGOAL_THEN` cc_qu_v11 cc (( i + 2) MOD 4 ) ` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +UNDISCH_TAC` nn = CARD (squ:num -> bool) + CARD (sqx: num -> bool) `; +DISCH_THEN (ASSUME_TAC o SYM); +CONJ_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` 4 = nn `; +SIMP_TAC[]; +STRIP_TAC; +MATCH_MP_TAC (GSYM MOD_INJ11); +EXPAND_TAC "nn"; +ARITH_TAC; + + +SUBGOAL_THEN` cc_qu_v11 cc (( i + 3) MOD 4 ) ` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +UNDISCH_TAC` nn = CARD (squ:num -> bool) + CARD (sqx: num -> bool) `; +DISCH_THEN (ASSUME_TAC o SYM); +CONJ_TAC; +ASM_REWRITE_TAC[]; +UNDISCH_TAC` 4 = nn `; +SIMP_TAC[]; +STRIP_TAC; +MATCH_MP_TAC (GSYM MOD_INJ11); +EXPAND_TAC "nn"; +ARITH_TAC; + +DOWNS 3; +UNDISCH_TAC` nn = CARD (squ:num -> bool) + CARD (sqx: num -> bool) `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_REWRITE_TAC[]; +ASM_CASES_TAC` cc_crit_v11 cc i `; +STRIP_TAC; +UNDISCH_TAC` nn = 4 /\ + (?i. cc_4cell_v11 cc i /\ + cc_crit_v11 cc i /\ + cc_qu_v11 cc (i + 1) /\ + cc_qu_v11 cc (i + 2) /\ + cc_qu_v11 cc (i + 3)) + ==> &0 <= sum (0..nn - 1) (cc_gg_v11 cc) `; +ANTS_TAC; +ASM_REWRITE_TAC[]; +EXISTS_TAC` i:num `; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[REAL_ARITH` ~( &0 <= x ) <=> x < &0 `]; +ASM_CASES_TAC` cc_subcrit_v11 cc i `; +UNDISCH_TAC` cc_qx_v11 cc i `; +REWRITE_TAC[cc_qx_v11; cc_qu_v11]; +ASM_REWRITE_TAC[cc_hassmall_v11]; + + +SUBGOAL_THEN` cc_crit_v11 cc i \/ cc_subcrit_v11 cc i \/ cc_supercrit_v11 cc i ` ASSUME_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; + +DOWN; +ASM_REWRITE_TAC[]; + +STRIP_TAC; +SUBGOAL_THEN` #0.00457511 + #0.00609451 * cc_azim_v11 cc i <= cc_gg_v11 cc i ` MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[cc_hassmall_v11]; +STRIP_TAC; + +SUBGOAL_THEN` ! i. cc_hassmall_v11 cc i ` ASSUME_TAC; +ASM_REWRITE_TAC[cc_hassmall_v11]; +UNDISCH_TAC` !i. cc_qu_v11 cc i + ==> -- #0.0142852 + #0.00609451 * cc_azim_v11 cc i <= cc_gg_v11 cc i `; +DISCH_THEN NHANH; +STRIP_TAC; + + + + + +UNDISCH_TAC` sum (0..nn - 1) (cc_gg_v11 cc) < &0 `; +UNDISCH_TAC` sum (0..nn - 1) (cc_azim_v11 cc) = &2 * pi `; +ASSUME_TAC2 (ISPECL [` cc_gg_v11 cc `;`nn:num `] periodic_sum); +FIRST_X_ASSUM (ASSUME_TAC o GSYM); +ASSUME_TAC2 (ISPECL [` cc_azim_v11 cc `;`nn:num `] periodic_sum); +FIRST_X_ASSUM (ASSUME_TAC o GSYM); +ASM_REWRITE_TAC[]; + +UNDISCH_TAC` 4 = nn `; +STRIP_TAC; +EXPAND_TAC "nn"; +REWRITE_TAC[ARITH_RULE` 4 - 1 + i = i + 3 `]; +REWRITE_TAC[SUM_NUMSEG4]; + +UNDISCH_TAC ` -- #0.0142852 + #0.00609451 * cc_azim_v11 cc (i + 3) <= + cc_gg_v11 cc (i + 3) `; +UNDISCH_TAC ` -- #0.0142852 + #0.00609451 * cc_azim_v11 cc (i + 2) <= + cc_gg_v11 cc (i + 2) `; +UNDISCH_TAC ` -- #0.0142852 + #0.00609451 * cc_azim_v11 cc (i + 1) <= + cc_gg_v11 cc (i + 1) `; +UNDISCH_TAC` #0.00457511 + #0.00609451 * cc_azim_v11 cc i <= cc_gg_v11 cc i `; +PHA; +MP_TAC PI_BOUNDS; +REAL_ARITH_TAC]);; + + + + + +let LUIKGMH_concl = `!cc. cc_bool_model_v11 cc /\ cc_bool_prep_v11 cc /\ cc_real_model_v11 cc /\ + (sum (0..cc_card_v11 cc -1) (cc_gg_v11 cc) < &0) ==> (4 <= cc_card_v11 cc)`;; + + + +let GRHIDFA_concl = `!cc. cc_bool_model_v11 cc /\ cc_bool_prep_v11 cc /\ cc_real_model_v11 cc /\ + (sum (0..cc_card_v11 cc -1) (cc_gg_v11 cc) < &0) ==> (F)`;; + + + +let NOT_QY_LEM = prove(` !cc. cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0 + ==> (!i. ~ cc_qy_v11 cc i) `, NHANH UTEOITF THEN SIMP_TAC[cc_qy_v11]);; + + + +let LUIKGMH = prove_by_refinement(LUIKGMH_concl, +[NHANH NOT_QY_LEM; +REPEAT STRIP_TAC; +ASSUME_TAC2 QY_NN00 THEN ASSUME_TAC2 QX_NN00; +ASSUME_TAC2 THREE_LE_CC_CARD; +DOWN_TAC; +NHANH Oxl_def.periodic_fn; +REWRITE_TAC[cc_bool_model_v11; cc_real_model_v11]; +STRIP_TAC; +ABBREV_TAC` nn = cc_card_v11 cc `; +ASM_CASES_TAC` nn = 3 `; +SUBGOAL_THEN` ! i. cc_qu_v11 cc i /\ cc_gg_v11 cc i < &0 ==> cc_azim_v11 cc i < #1.65 ` ASSUME_TAC; +GEN_TAC THEN STRIP_TAC; +SUBGOAL_THEN` -- #0.0659 + #0.042 * cc_azim_v11 cc i <= cc_gg_v11 cc i ` MP_TAC; +ASM_SIMP_TAC[]; +DOWN THEN PHA; +NHANH (REAL_ARITH` x < &0 /\ a <= x ==> a < &0 `); +STRIP_TAC; +DOWN; +CONV_TAC REAL_FIELD; + + +ABBREV_TAC` sxx = { i | i <= 2 /\ cc_qu_v11 cc i /\ cc_gg_v11 cc i < &0 }`; +SUBGOAL_THEN` ! i. cc_qu_v11 cc i \/ cc_qx_v11 cc i ` ASSUME_TAC; +GEN_TAC; +MP_TAC (SPEC` i:num ` QU_OR_QXY); +ASM_REWRITE_TAC[]; +ASM_CASES_TAC` (sxx:num -> bool) = {} `; +SUBGOAL_THEN` ! i. i <= 2 ==> &0 <= cc_gg_v11 cc i ` ASSUME_TAC; +GEN_TAC THEN STRIP_TAC; +ASM_CASES_TAC` cc_qx_v11 cc i `; +ASM_SIMP_TAC[]; +FIRST_X_ASSUM (MP_TAC o (SPEC`i:num `)); +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASM_CASES_TAC` cc_gg_v11 cc i < &0 `; +SUBGOAL_THEN` i IN (sxx:num -> bool) ` MP_TAC; +EXPAND_TAC "sxx"; +REWRITE_TAC[IN_ELIM_THM]; +ASM_REWRITE_TAC[]; +ASM_REWRITE_TAC[NOT_IN_EMPTY]; +DOWN; +REAL_ARITH_TAC; + +UNDISCH_TAC` sum (0..nn - 1) (cc_gg_v11 cc ) < &0 `; +ASM_REWRITE_TAC[ARITH_RULE` 3 - 1 = 0 + 2 `; SUM_NUMSEG3; ADD]; +REWRITE_TAC[REAL_ARITH` x < &0 <=> ~( &0 <= x) `]; +DOWN; + +MESON_TAC[LE_0; SUM_POS_LE_NUMSEG]; + +DOWN; +REWRITE_TAC[Local_lemmas.EMPTY_NOT_EXISTS_IN]; +STRIP_TAC; +ASM_CASES_TAC` ? y. y IN sxx /\ ~( y = x:num ) `; +DOWN THEN STRIP_TAC; +ASSUME_TAC (SET_RULE` DISJOINT {x,y:num} ( (0..2) DIFF {x,y}) `); +ABBREV_TAC` sc = (0..2) DIFF {x,y} `; +SUBGOAL_THEN` x <= 2 /\ y <= 2 /\ 0 <= x /\ 0 <= y` MP_TAC; +UNDISCH_TAC` x IN (sxx: num -> bool) `; +UNDISCH_TAC` y IN (sxx: num -> bool) `; +EXPAND_TAC "sxx"; +SIMP_TAC[IN_ELIM_THM; LE_0]; +STRIP_TAC; +SUBGOAL_THEN` 0..2 = {x,y} UNION sc ` ASSUME_TAC; +EXPAND_TAC "sc"; + +SUBGOAL_THEN` x IN 0..2 /\ y IN 0..2 ` MP_TAC; +ASM_REWRITE_TAC[IN_NUMSEG]; +CONV_TAC SET_RULE; +SUBGOAL_THEN` CARD {x,y:num} = 2 ` ASSUME_TAC; +ASM_REWRITE_TAC[Geomdetail.CARD2]; +UNDISCH_TAC` sum (0..nn - 1) (cc_gg_v11 cc ) < &0 `; +ASM_REWRITE_TAC[ARITH_RULE` 3 - 1 = 2 `]; +ASSUME_TAC (SPECL [` 0 `;` 2 `] FINITE_NUMSEG); +ASSUME_TAC (ISPECL [` x:num `;` y:num `] Hypermap.FINITE_TWO_ELEMENTS); +SUBGOAL_THEN` FINITE (sc:num -> bool) ` ASSUME_TAC; +EXPAND_TAC "sc"; +MATCH_MP_TAC FINITE_DIFF; +FIRST_ASSUM ACCEPT_TAC; + + +STRIP_TAC; +UNDISCH_TAC` sum (0..nn - 1) (cc_azim_v11 cc) = &2 * pi `; +ASM_REWRITE_TAC[ARITH_RULE` 3 - 1 = 2 `]; +ASM_SIMP_TAC[SUM_UNION]; +ASSUME_TAC2 ( +ISPECL [` {x:num, y} `;` sc:num -> bool `] ( +REWRITE_RULE[GSYM DISJOINT] CARD_UNION)); +DOWN; +ASM_REWRITE_TAC[]; +MP_TAC (SPECL [` 0 `;` 2 `] CARD_NUMSEG); +ASM_SIMP_TAC[ARITH_RULE` ( 2 + 1) - 0 = 3 `]; +PHA THEN STRIP_TAC; +SUBGOAL_THEN` sum {x,y} (cc_azim_v11 cc) <= &(CARD {x,y}) * ( #1.65) ` ASSUME_TAC; +MATCH_MP_TAC SUM_BOUND; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` {x,y} SUBSET (sxx: num -> bool) ` MP_TAC; +ASM_REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET]; + +REWRITE_TAC[SUBSET]; +DISCH_THEN NHANH; +GEN_TAC THEN STRIP_TAC; +MATCH_MP_TAC REAL_LT_IMP_LE; +FIRST_X_ASSUM MATCH_MP_TAC; +DOWN; +EXPAND_TAC "sxx"; +REWRITE_TAC[IN_ELIM_THM]; +SIMP_TAC[]; + + +SUBGOAL_THEN` sum sc (cc_azim_v11 cc) < &(CARD sc) * ( #2.8) ` ASSUME_TAC; +MATCH_MP_TAC SUM_BOUND_LT_ALL; +ASM_REWRITE_TAC[]; +CONJ_TAC; +STRIP_TAC; +FIRST_X_ASSUM SUBST_ALL_TAC; +UNDISCH_TAC` 3 = 2 + (CARD ({}:num -> bool))` ; +REWRITE_TAC[CARD_EMPTY]; +ARITH_TAC; +GEN_TAC THEN STRIP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` x':num `)); +SIMP_TAC[cc_qu_v11; cc_qx_v11]; +MESON_TAC[]; + + +DOWNS 2; +NHANH (REAL_ARITH` a <= aa /\ b < bb ==> a + b < aa + bb `); +ASM_REWRITE_TAC[]; +STRIP_TAC; +UNDISCH_TAC` 3 = 2 + CARD (sc:num -> bool) `; +REWRITE_TAC[ARITH_RULE` 3 = 2 + x <=> x = 1 `]; +DISCH_THEN (SUBST_ALL_TAC); +DOWN; +MP_TAC PI_BOUNDS; +REAL_ARITH_TAC; + +SUBGOAL_THEN` ! i. #2.3 < cc_azim_v11 cc i ==> cc_eps <= cc_gg_v11 cc i ` ASSUME_TAC; +GEN_TAC; +FIRST_X_ASSUM (MP_TAC o (SPEC` i:num `)); +STRIP_TAC; +STRIP_TAC; +MATCH_MP_TAC REAL_LE_TRANS; +EXISTS_TAC` -- #0.0659 + #0.042 * cc_azim_v11 cc i `; +ASM_SIMP_TAC[]; +DOWN; +REWRITE_TAC[cc_eps]; +REAL_ARITH_TAC; +ASM_SIMP_TAC[]; + +ASSUME_TAC2 ( +SET_RULE` x IN sxx /\ ~(?y. y IN sxx /\ ~(y = x)) ==> sxx = {x:num} `); +ABBREV_TAC` sc = (0..2) DIFF sxx `; +ASSUME_TAC (SPECL [` 0 `;` 2 `] FINITE_NUMSEG); +SUBGOAL_THEN` FINITE ((0..2) DIFF sxx ) ` ASSUME_TAC; +DOWN; +REWRITE_TAC[FINITE_DIFF]; +DOWNS 3; +ASM_REWRITE_TAC[]; +STRIP_TAC; +UNDISCH_TAC` x IN (sxx:num -> bool) `; +EXPAND_TAC "sxx"; +REWRITE_TAC[IN_ELIM_THM]; +STRIP_TAC; +SUBGOAL_THEN` x IN (0..2) ` ASSUME_TAC; +ASM_REWRITE_TAC[IN_NUMSEG; LE_0]; + +DOWN; +NHANH (SET_RULE` x IN S ==> DISJOINT {x} (S DIFF {x}) `); +ASM_REWRITE_TAC[]; +STRIP_TAC; +ASSUME_TAC2 (SET_RULE` x IN (0..2) ==> {x} UNION ((0..2) DIFF {x}) = (0..2) `); +MP_TAC (ISPECL [` {x:num } `;`sc: num -> bool `] CARD_UNION); +ANTS_TAC; +ASM_REWRITE_TAC[GSYM DISJOINT]; +UNDISCH_TAC` FINITE ((0..2) DIFF {x})`; +ASM_REWRITE_TAC[FINITE_SING]; +DOWN; +ASM_SIMP_TAC[CARD_SING; CARD_NUMSEG; ARITH_RULE` (2 + 1) - 0 = 3 `]; +REWRITE_TAC[ARITH_RULE` 3 = 1 + x <=> x = 2 `]; +PHA THEN STRIP_TAC; +SUBGOAL_THEN` FINITE (sc:num -> bool) ` ASSUME_TAC; +EXPAND_TAC "sc"; +FIRST_X_ASSUM ACCEPT_TAC; +ASM_CASES_TAC` ! i. i IN sc ==> +cc_azim_v11 cc i <= #2.3 ` ; +DOWNS 2; +NHANH SUM_LE; +REWRITE_TAC[ETA_AX]; +IMP_TAC; +ASM_SIMP_TAC[SUM_CONST]; +PHA THEN STRIP_TAC; + +UNDISCH_TAC` sum (0..nn - 1) (cc_azim_v11 cc) = &2 * pi `; +ASM_REWRITE_TAC[ARITH_RULE` 3 - 1 = 2 `]; +UNDISCH_TAC` {x} UNION sc = 0..2 `; +DISCH_THEN (SUBST1_TAC o SYM); +ASM_SIMP_TAC[SUM_UNION; FINITE_SING; SUM_SING]; +SUBGOAL_THEN` cc_azim_v11 cc x < #1.65 ` MP_TAC; +FIRST_X_ASSUM MATCH_MP_TAC; +ASM_REWRITE_TAC[]; +DOWN; +MP_TAC PI_BOUNDS; +REAL_ARITH_TAC; +DOWN; +REWRITE_TAC[MESON[]` (~(! i. p i ==> q i)) <=> (? i. p i /\ ~ q i ) `]; +REWRITE_TAC[REAL_ARITH` ~( x <= y ) <=> y < x `]; +STRIP_TAC; + + +FIRST_ASSUM (ASSUME_TAC2 o (SPEC` i:num `)); +ASSUME_TAC2 (SET_RULE` (i:num) IN sc ==> sc = {i} UNION (sc DIFF {i})`); +ABBREV_TAC` scc = sc DIFF {i:num} `; +SUBGOAL_THEN` FINITE ( sc DIFF {i:num}) ` ASSUME_TAC; +MATCH_MP_TAC FINITE_DIFF; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` ! j. j IN sc ==> &0 <= cc_gg_v11 cc j ` ASSUME_TAC; +EXPAND_TAC "sc"; +UNDISCH_TAC` sxx = {x:num} `; +DISCH_THEN (SUBST1_TAC o SYM); +EXPAND_TAC "sxx"; +REWRITE_TAC[IN_DIFF; IN_NUMSEG; IN_ELIM_THM; LE_0; DE_MORGAN_THM]; +GEN_TAC THEN IMP_TAC; +SIMP_TAC[]; +PHA THEN STRIP_TAC; +MP_TAC (SPEC` j:num` QU_OR_QXY); +ASM_REWRITE_TAC[]; +DOWN; +REAL_ARITH_TAC; + +UNDISCH_TAC` sum (0.. nn - 1) (cc_gg_v11 cc ) < &0 `; +ASM_SIMP_TAC[ARITH_RULE` 3 - 1 = 2 `]; +UNDISCH_TAC` {x} UNION sc = 0..2 `; +DISCH_THEN (SUBST1_TAC o SYM); +UNDISCH_TAC ` sc = {i:num} UNION scc `; +DISCH_THEN (ASSUME_TAC o SYM); +ASM_SIMP_TAC[SUM_UNION; FINITE_SING; SUM_SING]; +FIRST_X_ASSUM (ASSUME_TAC o SYM); +UNDISCH_TAC` FINITE (sc DIFF {i:num}) `; + +MP_TAC (SET_RULE` DISJOINT {i} (sc DIFF {i:num} ) `); +ASM_SIMP_TAC[SUM_UNION; FINITE_SING; SUM_SING]; +PHA THEN STRIP_TAC; +SUBGOAL_THEN` -- cc_eps <= cc_gg_v11 cc x ` ASSUME_TAC; +ASSUME_TAC2 (LEAST_BOUND_CC_GG); +ASM_REWRITE_TAC[]; +SUBGOAL_THEN` &0 <= sum scc (cc_gg_v11 cc) ` ASSUME_TAC; +MATCH_MP_TAC SUM_POS_LE; +ASM_REWRITE_TAC[]; +EXPAND_TAC "scc"; +REWRITE_TAC[IN_DIFF]; +FIRST_X_ASSUM NHANH; +SIMP_TAC[]; +DOWNS 3; +UNDISCH_TAC` cc_eps <= cc_gg_v11 cc i `; +REAL_ARITH_TAC; +DOWN; +UNDISCH_TAC` 3 <= nn `; +ARITH_TAC]);; + + + +let GRHIDFA = prove(GRHIDFA_concl, +PHA THEN NHANH LUIKGMH THEN NHANH GRHIDFA_ALT THEN NHANH RSIWAMP +THEN GEN_TAC THEN STRIP_TAC THEN DOWNS 3 THEN ARITH_TAC);; + + + +(* =================================================== *) + +(* ================= + + +search[name "RSI"];; + + + +g ` !cc. ((cc_bool_model_v11 cc /\ + cc_bool_prep_v11 cc /\ + cc_real_model_v11 cc /\ + sum (0..cc_card_v11 cc - 1) (cc_gg_v11 cc) < &0) /\ + cc_card_v11 cc = 5 ) /\ + ~cc_small_v11 cc i /\ cc_qx_v11 cc i /\ cc_qx_v11 cc ( i + 4) ==> F `;; + + +els [REPEAT STRIP_TAC; +ASSUME_TAC2 QY_NN00 THEN ASSUME_TAC2 QX_NN00; +ASSUME_TAC2 EXISTS_QY_CARD5; +DOWN_TAC; +NHANH Oxl_def.periodic_fn; +REWRITE_TAC[cc_bool_model_v11; cc_real_model_v11]; +ONCE_REWRITE_TAC[TAUT` ~ a <=> a ==> F `]; +IMP_TAC; +IMP_TAC; +STRIP_TAC; +STRIP_TAC; +STRIP_TAC; + +ABBREV_TAC` nn = cc_card_v11 cc `];; + + + + + + + +ASM_REWRITE_TAC[]; +ASSUME_TAC2 (ISPECL [` cc_gg_v11 cc `; ` nn:num `] Oxl_def.periodic_sum); +SUBGOAL_THEN` cc_gg_v11 cc i' + cc_gg_v11 cc (i' + 1) + cc_gg_v11 cc (i' + 3 - 1) = sum (0..nn - 1) (cc_gg_v11 cc) ` MP_TAC; +FIRST_X_ASSUM (SUBST1_TAC o SYM o (SPEC` i':num `)); +ASM_SIMP_TAC[ARITH_RULE` 3 - 1 + i = i + 2 `]; +SIMP_TAC[SUM_CLAUSES_LEFT; ARITH_RULE` i <= i + 2 /\ i + 1 <= i + 2 /\ (i + 1) + 1 = i + 2 `; SUM_SING_NUMSEG]; +SIMP_TAC[ARITH_RULE` 3 - 1 = 2 `]; +SIMP_TAC[Oxl_def.cc_eps]; +NHANH (REAL_ARITH` &2 * #0.0057 <= x ==> ~( x < &0 ) `); +ASM_REWRITE_TAC[]; + +ASSUME_TAC2 (ARITH_RULE` nn <= 4 /\ 3 <= nn /\ ~( nn = 3) ==> nn = 4 `); +ASSUME_TAC2 (ISPECL [` cc_gg_v11 cc `; ` nn:num `] Oxl_def.periodic_sum); +UNDISCH_TAC` sum (0..nn - 1) (cc_gg_v11 cc) < &0`; +FIRST_X_ASSUM (SUBST1_TAC o SYM o (SPEC` i':num `)); +ASM_SIMP_TAC[ARITH_RULE` 4 - 1 + i = i + 3 `]; +SIMP_TAC[SUM_CLAUSES_LEFT; ARITH_RULE` i <= i + 3 /\ i + 1 <= i + 3 /\ (i + 1) + 1 = i + 2 `; SUM_SING_NUMSEG]; +SIMP_TAC[SUM_CLAUSES_LEFT; ARITH_RULE` i + 2 <= i + 3 /\ (i + 2) + 1 = i + 3`; SUM_SING_NUMSEG]; +ASSUME_TAC2 LEAST_BOUND_CC_GG; +FIRST_X_ASSUM (ASSUME_TAC o (SPEC `i' + 2 `)); +DOWN; +UNDISCH_TAC` &2 * cc_eps <= + cc_gg_v11 cc i' + cc_gg_v11 cc (i' + 1) + cc_gg_v11 cc (i' + nn - 1) `; +ASM_SIMP_TAC[ARITH_RULE` 4 - 1 = 3 `; Oxl_def.cc_eps]];; + + + + + + + +*) + + +end;; diff --git a/text_formalization/packing/pack1.hl b/text_formalization/packing/pack1.hl new file mode 100644 index 0000000..6a6752e --- /dev/null +++ b/text_formalization/packing/pack1.hl @@ -0,0 +1,620 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Packing *) +(* Author: Nguyen Tat Thang *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + + + +module type Pack1_type = sig +end;; + +flyspeck_needs "volume/vol1.hl";; + +module Pack1 (* : Pack1_type *) = struct + + + + + (* *) + + + + let int_ball = Vol1.int_ball;; + let hinhcau_ball = Vol1.hinhcau_ball;; + let finite_int_ball = Vol1.finite_int_ball;; + let FINITE_IMAGE_INJ = Vol1.FINITE_IMAGE_INJ;; + + let ASM_SET_TAC l = + (TRY(POP_ASSUM_LIST(MP_TAC o end_itlist CONJ))) THEN SET_TAC l;; + + +let packing = new_definition `packing (S:real^3 -> bool) = (!u v. S u /\ S v /\ ~(u = v) ==> (&2 <= dist( u, v)))`;; + +let map3=new_definition `(map3:real^3 -> real^3 ->real^3) x p = lambda i. floor(&2* (x$i - p$i))`;; + +let bound_square=prove( `!(a:real)(b:real)(c:real). (a<=b /\ b<=c) ==> b pow 2 <= max ( a pow 2) (c pow 2)`, +REPEAT STRIP_TAC THEN DISJ_CASES_TAC(REAL_ARITH `&0<= b \/ b< &0`) +THENL [MP_TAC(MESON[REAL_POW_LE2] `&0<= b /\ b<= c ==> b pow 2 <= c pow 2`) THEN ASM_SIMP_TAC[REAL_LE_MAX];MP_TAC(REAL_ARITH `b< &0 /\a<= b ==> &0<= -- b /\ --b<= --a`)] THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(MESON[REAL_POW_LE2] `&0<= -- b /\ --b<= --a ==> --b pow 2 <= --a pow 2`) THEN ASM_REWRITE_TAC[] THEN MESON_TAC[REAL_LE_MAX;REAL_ARITH `--(x:real) pow 2= x pow 2`]);; + + +let cauchy_ineq=prove( `!(a:real)(b:real). (a+b) pow 2<= &2* (a pow 2+ b pow 2)`,REPEAT GEN_TAC THEN ONCE_REWRITE_TAC[REAL_ARITH `(x:real) <= y <=> &0<= y - x`] THEN REWRITE_TAC[REAL_FIELD `&2 * (a pow 2 + b pow 2) - (a + b) pow 2 = (a- b) pow 2`] + THEN REWRITE_TAC[REAL_FIELD `(a- b) pow 2 = (a-b) * (a-b)`;REAL_LE_SQUARE]);; + +let bdt_emveque=prove(`!(r:real). &0 <= &8* (r pow 2) + &6`,GEN_TAC +THEN MP_TAC(MESON[REAL_LE_SQUARE; REAL_FIELD `r pow 2= r * r`] `&0<= r pow 2`) THEN +DISCH_TAC THEN MP_TAC(MESON[REAL_LE_MUL;REAL_ARITH `&0<= &8`] `&0<= r pow 2 ==> &0<= &8* (r pow 2)`) +THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC);; + + +let norm_abs= MESON[NORM_POS_LE;REAL_ARITH `&0<= a ==> abs a= a`] `!(x:real^3 ). norm x= abs (norm x)`;; + +let bp_bdt=prove( `!(a:real)(b:real). (&0<= a /\ &0<= b) ==> (a< b <=> a pow 2 < b pow 2)`,REPEAT GEN_TAC +THEN REWRITE_TAC[GSYM REAL_ABS_REFL] THEN ONCE_REWRITE_TAC[MESON[] `x:real = y<=> y=x`] THEN STRIP_TAC +THEN ASM_MESON_TAC[REAL_LT_SQUARE_ABS]);; + +let bdt_emnguchua=prove( `!(k:real). floor (&2* k)* floor( &2*k)<= &2*( &4* (k pow 2) + &1)`, + GEN_TAC THEN MP_TAC(SPEC ` &2*k:real` FLOOR) THEN REWRITE_TAC[REAL_ARITH `a:real < b+ &1 <=> a- &1 < b`] + THEN STRIP_TAC THEN MP_TAC(SPECL [`&2 * k - &1:real`;`floor (&2 * k):real`;`&2 * k` ] bound_square) + THEN ASM_SIMP_TAC[REAL_ARITH `a:real < b ==> a<= b`] + THEN DISCH_TAC THEN MATCH_MP_TAC(REAL_ARITH `floor (&2 * k) pow 2 <= max ((&2 * k - &1) pow 2) ((&2 * k) pow 2) /\ max ((&2 * k - &1) pow 2) ((&2 * k) pow 2) <= &2 * (&4 * k pow 2 + &1) ==> floor (&2 * k) * floor (&2 * k) <= &2 * (&4 * k pow 2 + &1)`) + THEN ASM_SIMP_TAC[] THEN REWRITE_TAC[REAL_MAX_LE] THEN SIMP_TAC[cauchy_ineq;REAL_FIELD `&2 * k - &1= (&2 * k) + ( -- &1)`;REAL_FIELD `(&2 * k) pow 2 = &4 * (k pow 2 )`; REAL_ARITH `( -- &1) pow 2 = &1`] THEN SIMP_TAC[cauchy_ineq;REAL_FIELD `&4 * (k pow 2 )= (&2 * k) pow 2`; + REAL_ARITH ` &1= ( -- &1) pow 2`] +THEN ONCE_REWRITE_TAC[REAL_ARITH `&2 * ((&2 * k) pow 2 + &1)= &2 * ((&2 * k) pow 2 + ( -- &1) pow 2)`] + THEN REWRITE_TAC[cauchy_ineq] THEN REWRITE_TAC[REAL_FIELD `(&2 * k) pow 2 <= &2 * ((&2 * k) pow 2 + -- &1 pow 2) <=> &4* (k pow 2)<= &8* (k pow 2) + &2`] + THEN ONCE_REWRITE_TAC[REAL_ARITH `a<=b <=> &0<= b-a `;REAL_FIELD `&8 * k pow 2 + &2- &4 * k pow 2= &4 * k pow 2 + &2`] + THEN ONCE_REWRITE_TAC[REAL_FIELD `(&8 * k pow 2 + &2) - &4 * k pow 2= &4 * k pow 2 + &2`] + THEN MP_TAC(MESON[REAL_LE_SQUARE; REAL_FIELD `k pow 2 = k * k`] `&0<= k pow 2`) THEN +DISCH_TAC THEN MP_TAC(MESON[REAL_LE_MUL;REAL_ARITH `&0<= &4`] `&0<= k pow 2 ==> &0<= &4* (k pow 2)`) +THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC);; + + + +let map3_define=prove(`!(v:real^3)(p:real^3)(r:real). &0<=r /\ v IN ball(p,r) +==> map3 p v IN ball(vec 0, sqrt(&8* (r pow 2) + &6))`,REPEAT GEN_TAC THEN REWRITE_TAC[ball;IN_ELIM_THM] + THEN REWRITE_TAC[dist;VECTOR_ARITH `vec 0 - map3 (p:real^3) v = -- map3 p v`;NORM_NEG] + THEN MP_TAC (SPEC `(&8* (r pow 2) + &6):real` SQRT_POS_LE) + THEN SIMP_TAC[bdt_emveque] THEN DISCH_TAC THEN ASSUME_TAC(ISPEC `(p:real^3- v):real^3` NORM_POS_LE) THEN ASSUME_TAC(ISPEC `(map3 (p:real^3) v):real^3` NORM_POS_LE) THEN REWRITE_TAC[MESON[] `a/\b ==> c <=> a==> b==> c`] + THEN DISCH_TAC THEN ASM_SIMP_TAC[bp_bdt] THEN SIMP_TAC[NORM_POW_2;DOT_3] THEN REWRITE_TAC[map3] + THEN SIMP_TAC[LAMBDA_BETA;DIMINDEX_3;ARITH_RULE `1<=1/\1<=3 /\ 1<=2 /\ 2<= 3 /\ 1<= 3 /\ 3<=3`] + THEN DISCH_TAC THEN MP_TAC(SPEC `((p:real^3)$1 - (v:real^3)$1):real` bdt_emnguchua) THEN MP_TAC(SPEC `((p:real^3)$2 - (v:real^3)$2):real` bdt_emnguchua) + THEN MP_TAC(SPEC `((p:real^3)$3 - (v:real^3)$3):real` bdt_emnguchua) + THEN REPEAT DISCH_TAC THEN MATCH_MP_TAC(REAL_ARITH `q:real <= &2 * (&4 * ((p:real^3)$1 - (v:real^3)$1) pow 2 + &1) + + &2 * (&4 * (p$2 - v$2) pow 2 + &1) + &2 * (&4 * (p$3 - v$3) pow 2 + &1) /\ &2 * (&4 * (p$3 - v$3) pow 2 + &1) + + &2 * (&4 * (p$2 - v$2) pow 2 + &1) + &2 * (&4 * (p$1 - v$1) pow 2 + &1) < sqrt (&8 * r pow 2 + &6) pow 2 +==> q< sqrt (&8 * r pow 2 + &6) pow 2`) + THEN ASM_SIMP_TAC[REAL_ARITH `floor (&2 * ((p:real^3)$3 - (v:real^3)$3)) * floor (&2 * (p$3 - v$3)):real <= + &2 * (&4 * (p$3 - v$3) pow 2 + &1) /\ floor (&2 * (p$2 - v$2)) * floor (&2 * (p$2 - v$2)) <= + &2 * (&4 * (p$2 - v$2) pow 2 + &1) /\ floor (&2 * (p$1 - v$1)) * floor (&2 * (p$1 - v$1)) <= + &2 * (&4 * (p$1 - v$1) pow 2 + &1) ==> floor (&2 * (p$1 - v$1)) * floor (&2 * (p$1 - v$1)) + + floor (&2 * (p$2 - v$2)) * floor (&2 * (p$2 - v$2)) + + floor (&2 * (p$3 - v$3)) * floor (&2 * (p$3 - v$3)) <= + &2 * (&4 * (p$1 - v$1) pow 2 + &1) + + &2 * (&4 * (p$2 - v$2) pow 2 + &1) + + &2 * (&4 * (p$3 - v$3) pow 2 + &1)`] + THEN REWRITE_TAC[REAL_FIELD `&2 * (&4 * ((p:real^3)$3 - (v:real^3)$3) pow 2 + &1) + + &2 * (&4 * (p$2 - v$2) pow 2 + &1) + + &2 * (&4 * (p$1 - v$1) pow 2 + &1)= &8 * ( (p$1 - v$1) pow 2 + (p$2 - v$2) pow 2 + (p$3 - v$3) pow 2) + &6`] + THEN ASSUME_TAC (SPEC `r:real` bdt_emveque) THEN ASM_SIMP_TAC[SQRT_POW_2] + THEN REWRITE_TAC[REAL_ARITH `a + &6 < b+ &6 <=> a< b`] THEN SIMP_TAC[REAL_ARITH `&0< &8`;REAL_LT_LMUL_EQ] + THEN ASM_REWRITE_TAC[GSYM VECTOR_SUB_COMPONENT;DIMINDEX_3] THEN REWRITE_TAC[REAL_ARITH `a pow 2= a*a`] + THEN ASM_MESON_TAC[REAL_ARITH `a pow 2= a*a`]);; + + +let floor_ineq=prove( `!(x:real)(y:real). floor x = floor y ==> abs (x- y)< &1`,REPEAT STRIP_TAC THEN MP_TAC(SPEC `x:real` FLOOR) THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(SPEC `y:real` FLOOR) + THEN REPEAT STRIP_TAC THEN MP_TAC (REAL_ARITH `floor y <= x /\ y < floor y + &1 ==> y< x+ &1`) + THEN ASM_REWRITE_TAC[] THEN MP_TAC (REAL_ARITH `floor y <= y /\ x < floor y + &1 ==> x< y+ &1`) + THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC);; + + +let bdt_canbatrenbon=prove( `sqrt ( &3/ &4)< &2`,MP_TAC (SPEC `&3 / &4 :real` SQRT_POS_LE) THEN REWRITE_TAC[REAL_ARITH `&0<= &3/ &4`] THEN REWRITE_TAC[REAL_ARITH ` &0<=a:real <=> a = abs a`] THEN MP_TAC(SPEC `&2:real` REAL_ABS_REFL) + THEN REWRITE_TAC[REAL_ARITH ` &0 <= &2`] THEN REWRITE_TAC[MESON[] `a:real = b ==> c:real = d ==> c< b <=> a:real = b ==> c:real = d ==> d< a`] THEN REWRITE_TAC[REAL_LT_SQUARE_ABS] THEN SIMP_TAC[REAL_ARITH `&2 pow 2 = &4`;SQRT_POW_2;REAL_ARITH `&0<= &3/ &4`] THEN REAL_ARITH_TAC);; + + +let inj_map3=prove(`!(p:real^3)(r:real) (S:real^3 -> bool). (&0 <= r) /\ (packing S) ==> INJ (map3 p) (S INTER ball(p,r)) (int_ball (vec 0) (sqrt( &8 * (r pow 2) + &6)))`,REPEAT GEN_TAC THEN REWRITE_TAC[INJ] THEN STRIP_TAC THEN REWRITE_TAC[int_ball;IN_ELIM_THM] THEN REWRITE_TAC[IN_INTER;hinhcau_ball] THEN ASM_SIMP_TAC[map3_define] THEN REWRITE_TAC[IN_ELIM_THM] THEN REWRITE_TAC[map3] THEN SIMP_TAC[LAMBDA_BETA;DIMINDEX_3;ARITH_RULE `1<=1/\1<=3 /\ 1<=2 /\ 2<= 3 /\ 1<= 3 /\ 3<=3`] + THEN REWRITE_TAC[FLOOR;(* GSYM INTEGER_IS_INT *)] THEN REWRITE_TAC[CART_EQ] + THEN SIMP_TAC[LAMBDA_BETA;DIMINDEX_3] THEN REPEAT GEN_TAC THEN REWRITE_TAC[FORALL_3] + THEN REWRITE_TAC[MESON[] `a/\b/\c/\d/\e ==> f <=> a==>b==>c==>d ==>e==>f`] + THEN REPLICATE_TAC 5 DISCH_TAC THEN MP_TAC(SPECL [`&2 * ((p:real^3)$1 - (x:real^3)$1):real`;`&2 * ((p:real^3)$1 - (y:real^3)$1):real`] floor_ineq) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(SPECL [`&2 * ((p:real^3)$2 - (x:real^3)$2):real`;`&2 * ((p:real^3)$2 - (y:real^3)$2):real`] floor_ineq) THEN ASM_REWRITE_TAC[] THEN MP_TAC(SPECL [`&2 * ((p:real^3)$3 - (x:real^3)$3):real`;`&2 * ((p:real^3)$3 - (y:real^3)$3):real`] floor_ineq) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[REAL_FIELD `&2 * ((a:real) - b) - &2 * (a- c)= &2*(c - b) `] THEN REWRITE_TAC[REAL_ABS_MUL] THEN MP_TAC(SPEC `&2:real` REAL_ABS_REFL) THEN REWRITE_TAC[REAL_ARITH ` &0 <= &2`] + THEN SIMP_TAC[] THEN REWRITE_TAC[REAL_ARITH ` &2* a< b <=> a< b/ &2`] + THEN REWRITE_TAC[MESON[REAL_ARITH `&1/ &2= abs (&1/ &2)`;REAL_LT_SQUARE_ABS;REAL_ARITH ` (&1/ &2) pow 2 = &1/ &4`] `abs (a:real) < &1/ &2 <=> a pow 2 < &1/ &4`] THEN REPEAT DISCH_TAC THEN SUBGOAL_THEN `norm(y:real^3 - x)< sqrt(&3/ &4)` MP_TAC +THENL [REWRITE_TAC[vector_norm;dist] THEN MP_TAC(SPEC `((y:real^3 - x) dot (y - x)):real` SQRT_POS_LE) + THEN REWRITE_TAC[DOT_POS_LE] THEN REWRITE_TAC[REAL_ARITH `&0<= a <=> a= abs a`] + THEN REWRITE_TAC[MESON[] `a:real= b ==> a< sqrt (&3 / &4) <=> a= b ==> b < sqrt (&3 / &4)`] + THEN DISCH_TAC THEN MP_TAC (SPEC `&3 / &4 :real` SQRT_POS_LE) THEN REWRITE_TAC[REAL_ARITH `&0<= &3/ &4`] + THEN REWRITE_TAC[REAL_ARITH `&0<= a <=> a= abs a`] THEN REWRITE_TAC[MESON[] `a:real= b ==> c< a <=> a= b ==> c < b`] + THEN SIMP_TAC[REAL_LT_SQUARE_ABS;REAL_ARITH `&1/ &2= abs (&1/ &2)`;MESON[SQRT_POW_2;REAL_ARITH `&0<= &3/ &4`] `(sqrt (&3 / &4)) pow 2= &3/ &4`;SQRT_POW_2;DOT_POS_LE] THEN REWRITE_TAC[DOT_3;DIMINDEX_3] THEN REWRITE_TAC[VECTOR_SUB_COMPONENT;REAL_ARITH `(a:real) * a= a pow 2`] THEN ASM_MESON_TAC[REAL_ARITH `a:real< &1/ &4 /\ b< &1/ &4 /\ c< &1/ &4 ==> a+b+c < &3/ &4`]; DISCH_TAC THEN MP_TAC(MESON[REAL_RAT_REDUCE_CONV `sqrt (&3 / &4) < &2`;REAL_ARITH `a:real a< c`] `norm (y:real^3 - x) < sqrt (&3 / &4)/\ sqrt (&3 / &4) < &2 ==> norm (y- x)< &2`) + THEN ASM_REWRITE_TAC[bdt_canbatrenbon] THEN UNDISCH_TAC `(packing (S:real^3 -> bool)):bool` + THEN REWRITE_TAC[packing] THEN REWRITE_TAC[dist] THEN DISCH_TAC THEN FIRST_X_ASSUM(MP_TAC o SPECL [`y:real^3`;`x:real^3`]) THEN UNDISCH_TAC `((x:real^3) IN (S:real^3 -> bool) /\ x IN ball (p:real^3,r)):bool` + THEN UNDISCH_TAC `((y:real^3) IN (S:real^3 -> bool) /\ y IN ball (p:real^3,r)):bool` + THEN SIMP_TAC[SET_RULE `(a:real^3) IN (S:real^3 -> bool ) <=> S a`] THEN REPLICATE_TAC 2 DISCH_TAC + THEN REWRITE_TAC[REAL_ARITH `a:real < &2 <=> ~( &2<= a)`] + THEN REWRITE_TAC[MESON[] `a ==> b==> c <=> a/\b ==> c`] THEN ONCE_REWRITE_TAC[MESON[] ` ~ (P:bool) ==> Q <=> (~ Q ==> P)`] THEN SIMP_TAC[]]);; + + +(*-----------------------------------------------------------------*) +(* Lemma 5.1 [KIUMVTC] Finiteness of packing inter ball *) +(*-----------------------------------------------------------------*) + + + +let KIUMVTC=prove(`!(p:real^3)(r:real) (S:real^3 -> bool).(&0 <= r) /\ (packing S) ==> FINITE (S INTER ball(p,r))`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC(ISPECL [`(map3 (p:real^3)):real^3 -> real^3`;`(S INTER ball(p,r)):real^3 ->bool`;`(int_ball (vec 0) (sqrt( &8 * (r pow 2) + &6))):real^3 ->bool`] FINITE_IMAGE_INJ ) + THEN ASM_SIMP_TAC[map3_define;finite_int_ball;inj_map3] + THEN REWRITE_TAC[int_ball;IN_INTER] THEN REWRITE_TAC[hinhcau_ball;IN_ELIM_THM;LAMBDA_BETA;DIMINDEX_3] + THEN ASM_SIMP_TAC[map3_define] THEN REWRITE_TAC[map3;IN_ELIM_THM;LAMBDA_BETA;DIMINDEX_3] + THEN REPEAT STRIP_TAC THEN ASM_SIMP_TAC[LAMBDA_BETA;DIMINDEX_3] THEN MESON_TAC[FLOOR;(* GSYM INTEGER_IS_INT *)]);; + +(*-----------------------------------------------------------------*) +(* About voronoi_open cell *) +(*-----------------------------------------------------------------*) + + + +let voronoi_open = new_definition `voronoi_open S v = { x | !w. ((S w) /\ ~(w=v)) ==> (dist( x, v) < dist( x, w)) }`;; + +let bis = new_definition `bis u v = {x | dist(x,u) = dist(x,v)}`;; + +let nua_kg=new_definition `nua_kg (u:real^3) (v:real^3) = {x:real^3 | dist(x,u) < dist(x,v)}`;; + +let saturated=new_definition `saturated S= (!x. ?(y:real^N). y IN S /\ dist (x,y)< &2)`;; + +let voronoi_version2=prove( `!(v:real^3) (S:real^3-> bool). voronoi_open S v = INTERS {nua_kg x y | y IN (S DELETE v)/\ x= v}`, +REPEAT GEN_TAC THEN REWRITE_TAC[EXTENSION;GSYM SUBSET_ANTISYM_EQ;voronoi_open;INTERS] + THEN REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC +THENL [REWRITE_TAC[SUBSET;IN_ELIM_THM] THEN GEN_TAC THEN DISCH_TAC THEN GEN_TAC THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC + THEN FIRST_X_ASSUM CHOOSE_TAC THEN FIRST_ASSUM (MP_TAC o ISPEC `y:real^3`) THEN UNDISCH_TAC `(((y:real^3) IN S DELETE (v:real^3) /\ x' = v) /\ u = nua_kg x' y):bool` THEN REWRITE_TAC[DELETE;IN_ELIM_THM] THEN SIMP_TAC[SET_RULE `y:real^3 IN S <=> S y`] +THEN REWRITE_TAC[nua_kg;IN_ELIM_THM];REWRITE_TAC[SUBSET;IN_ELIM_THM] THEN GEN_TAC THEN DISCH_TAC] THEN GEN_TAC THEN FIRST_X_ASSUM(MP_TAC o ISPEC ` (nua_kg (v:real^3) (w:real^3)):real^3 ->bool`) THEN REWRITE_TAC[nua_kg;IN_ELIM_THM] THEN DISCH_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `(?(x:real^3) (y:real^3). + (y IN S DELETE v /\ x = v) /\ + {x | dist (x,v) < dist (x,w)} = {x' | dist (x',x) < dist (x',y)})` ASSUME_TAC +THENL [EXISTS_TAC `(v):real^3` THEN EXISTS_TAC `w:real^3` THEN +ASM_REWRITE_TAC[DELETE;IN_ELIM_THM;SET_RULE `w:real^3 IN S <=> S w`];UNDISCH_TAC `((?(x:real^3) (y:real^3). + (y IN S DELETE v /\ x = (v:real^3)) /\ + {x | dist (x,v) < dist (x,w)} = {x' | dist (x',x) < dist (x',y)}) + ==> dist (x,v) < dist (x,w)):bool` THEN ASM_REWRITE_TAC[]]);; + + +let norm_ineq_lt= prove(`!(x:real^3)(y:real^3). norm x< norm y <=> x dot x < y dot y`,REPEAT GEN_TAC THEN REWRITE_TAC[MESON[NORM_POS_LE;REAL_ARITH ` &0<= a <=> a = abs a`] `norm (x:real^3) < norm (y:real^3) <=> abs (norm x) < abs (norm y)`] THEN MESON_TAC[REAL_LT_SQUARE_ABS;NORM_POW_2]);; + + +let nua_kg_version2=prove(`!(v:real^3)(y:real^3). ?(a:real^3)(b:real). nua_kg v y= { x:real^3 | x dot a < b}`, +REPEAT GEN_TAC THEN EXISTS_TAC `&2 %(y:real^3 - v):real^3` THEN EXISTS_TAC `((y:real^3)$1 * y$1+ y$2 * y$2 + y$3 * y$3 - (v:real^3)$1 * v$1- v$2 * v$2 - v$3 * v$3 ):real` THEN REWRITE_TAC[nua_kg;EXTENSION;IN_ELIM_THM] THEN GEN_TAC + THEN REWRITE_TAC[dist;norm_ineq_lt] THEN REWRITE_TAC[DOT_3] THEN ONCE_REWRITE_TAC[REAL_ARITH `a:real < b <=> &0< b - a`] + THEN REWRITE_TAC[VECTOR_MUL_COMPONENT;VECTOR_SUB_COMPONENT] THEN REWRITE_TAC[REAL_FIELD `(((x:real^3)$1 - (y:real^3)$1) * (x$1 - y$1) + + (x$2 - y$2) * (x$2 - y$2) + + (x$3 - y$3) * (x$3 - y$3)) - + ((x$1 - (v:real^3)$1) * (x$1 - v$1) + + (x$2 - v$2) * (x$2 - v$2) + + (x$3 - v$3) * (x$3 - v$3))= (y$1 * y$1 + y$2 * y$2 + y$3 * y$3 - v$1 * v$1 - v$2 * v$2 - v$3 * v$3) - + (x$1 * &2 * (y$1 - v$1) + x$2 * &2 * (y$2 - v$2) + x$3 * &2 * (y$3 - v$3))`]);; + + +let convex_nua_kg=prove(`!(v:real^3)(y:real^3). convex (nua_kg v y)`,REPEAT GEN_TAC THEN MP_TAC(ISPECL [`v:real^3`;`y:real^3`] nua_kg_version2) THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN ASM_SIMP_TAC[] + THEN ONCE_REWRITE_TAC[CONVEX_HALFSPACE_LT;DOT_SYM] THEN MESON_TAC[CONVEX_HALFSPACE_LT]);; + + +(*------------------------------------------------------------*) +(* Convexity of Voronoi *) +(*------------------------------------------------------------*) + + + +let convex_voronoi=prove( `!(v:real^3) (S:real^3-> bool). convex (voronoi_open S v)`,REPEAT GEN_TAC THEN MP_TAC(ISPECL [`v:real^3`;`S:real^3 -> bool`] voronoi_version2) THEN SIMP_TAC[] THEN DISCH_TAC THEN SUBGOAL_THEN `! s. s IN {nua_kg (x:real^3) (y:real^3) | y IN S DELETE (v:real^3) /\ x = v} ==> convex s` MP_TAC THENL [GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN MESON_TAC[convex_nua_kg];MESON_TAC[CONVEX_INTERS]]);; + + +(*------------------------------------------------------------*) +(* Boundness of voronoi_open *) +(*------------------------------------------------------------*) + + +let bound_voronoi=prove( `!(v:real^3) (S:real^3-> bool). saturated S ==> bounded(voronoi_open S v)`, +REPEAT GEN_TAC THEN DISJ_CASES_TAC (MESON[] `bounded (voronoi_open (S:real^3 ->bool) (v:real^3)) \/ ~(bounded (voronoi_open S v))`) + THENL [ASM_MESON_TAC[];UNDISCH_TAC `(~ bounded (voronoi_open (S:real^3 ->bool) (v:real^3))):bool` + THEN REWRITE_TAC[bounded] THEN REWRITE_TAC[MESON[] `~(?(a:real). !(x:real^3). x IN voronoi_open (S:real^3->bool) (v:real^3) +==> norm x <= a) <=> !(a:real). +~ (!(x:real^3). x IN voronoi_open (S:real^3->bool) (v:real^3) ==> norm x <= a)`] + THEN REWRITE_TAC[MESON[] `~(!x. x IN voronoi_open (S:real^3->bool) (v:real^3) ==> norm x <= a) +<=> ? (x:real^3). ~ ( x IN voronoi_open S v ==> norm x <= a)`] +THEN REWRITE_TAC[MESON[NOT_IMP] `~((x:real^3) IN voronoi_open (S:real^3->bool) (v:real^3) ==> norm x <= a) +<=> x IN voronoi_open S v /\ ~ (norm x <= a)`] + THEN REWRITE_TAC[REAL_ARITH ` ~ (norm (x:real^3)<= a:real) <=> a< norm x`] + THEN DISCH_TAC THEN FIRST_X_ASSUM(MP_TAC o SPEC `norm (v:real^3) + &2:real`) + THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN UNDISCH_TAC `(x:real^3 +IN voronoi_open (S:real^3->bool) (v:real^3) /\ norm (v:real^3)+ &2 < norm x):bool` +THEN REWRITE_TAC[voronoi_open;saturated;IN_ELIM_THM] + THEN REPEAT STRIP_TAC THEN FIRST_X_ASSUM(MP_TAC o SPEC `(x):real^3`) + THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC + THEN UNDISCH_TAC `(!(w:real^3). S w /\ ~(w = v:real^3) ==> dist (x,v) < dist (x,w)):bool` + THEN DISCH_TAC THEN FIRST_X_ASSUM(MP_TAC o SPEC `y:real^3`) + THEN MP_TAC(MESON[REAL_ARITH `norm (v:real^3) + &2 < norm (x:real^3) ==> &2 < norm x - norm v`; +MESON[REAL_ABS_SUB_NORM;REAL_ABS_LE;REAL_ARITH `(a:real)<= b /\ b<= c ==> a<= c`] `norm (x:real^3) - norm (v:real^3) +<= norm (x- v)`;REAL_ARITH `a:real < b /\ b<= c ==> a< c`] `norm (v:real^3) + &2 < norm (x:real^3) ==> &2< norm ( x - v)`) + THEN ASM_REWRITE_TAC[] THEN UNDISCH_TAC `(y:real^3 IN (S:real^3 -> bool) /\ dist (x,y) < &2):bool` THEN STRIP_TAC + THEN REWRITE_TAC[GSYM dist] THEN DISCH_TAC THEN SUBGOAL_THEN `~ (y:real^3 = v)` MP_TAC +THENL [(*1*)DISJ_CASES_TAC(MESON[] `(y:real^3 = v) \/ ~(y=v)`) THENL [UNDISCH_TAC `(dist (x:real^3,y) < &2):bool` +THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[REAL_ARITH ` ~ (dist (x:real^3,v) < &2) <=> &2<= dist(x, v)`] +THEN ASM_MESON_TAC[REAL_ARITH `&2< a ==> &2 <= a`];ASM_MESON_TAC[]];(*2*)ASM_SIMP_TAC[SET_RULE `y:real^3 IN S <=> S y`] + THEN DISCH_TAC THEN ASM_SIMP_TAC[SET_RULE `y:real^3 IN S <=> S y`] THEN UNDISCH_TAC `(y IN (S:real^3 ->bool)):bool` + THEN REWRITE_TAC[SET_RULE `y IN (S:real^3 ->bool) <=> S y`] THEN SIMP_TAC[] THEN DISCH_TAC +THEN UNDISCH_TAC `(dist (x:real^3,y) < &2):bool` THEN UNDISCH_TAC `(&2 < dist (x,v:real^3)):bool` THEN REAL_ARITH_TAC]]);; + +(*--------------------------------------------------------------*) + + +let open_nua_kg=prove(`!(v:real^3)(y:real^3). open (nua_kg v y)`,REPEAT GEN_TAC THEN MP_TAC(ISPECL [`v:real^3`;`y:real^3`] nua_kg_version2) THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN ASM_SIMP_TAC[] + THEN ONCE_REWRITE_TAC[OPEN_HALFSPACE_LT;DOT_SYM] THEN MESON_TAC[OPEN_HALFSPACE_LT]);; + + + +let map_to_nua_kg=new_definition`map_to_nua_kg ((x:real^3), (y:real^3))= nua_kg x y`;; + + +let surj_map_to_nua_kg=prove(`!(v:real^3)(S:real^3 ->bool). IMAGE (map_to_nua_kg) ({v:real^3} CROSS ((S DELETE v) INTER ball(v, &4))) = {nua_kg (x:real^3) (y:real^3) | (y IN (S DELETE v)) /\ (x = v) /\ (y IN ball(v, &4))}`, +REWRITE_TAC[IMAGE] THEN REWRITE_TAC[map_to_nua_kg] THEN REPEAT GEN_TAC THEN REWRITE_TAC[IN_CROSS;map_to_nua_kg;IN_ELIM_THM] THEN ONCE_REWRITE_TAC[GSYM SUBSET_ANTISYM_EQ] THEN STRIP_TAC +THENL [(*1*)REWRITE_TAC[SUBSET;IN_ELIM_THM] THEN GEN_TAC THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC + THEN MP_TAC(ISPEC `x':real^3 # real^3` PAIR_SURJECTIVE) THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN UNDISCH_TAC `(x':real^3 # real^3 IN {v:real^3} CROSS ((S:real^3 -> bool) DELETE v INTER ball (v,&4)) /\ x = map_to_nua_kg x'):bool` THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[IN_CROSS;IN_SING] THEN REWRITE_TAC[map_to_nua_kg;IN_INTER] + THEN REPEAT STRIP_TAC THEN EXISTS_TAC `x'':real^3` THEN EXISTS_TAC `y:real^3` THEN ASM_SIMP_TAC[];(*2*)REWRITE_TAC[SUBSET;IN_ELIM_THM] THEN GEN_TAC THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN EXISTS_TAC `(x':real^3, y:real^3):real^3 # real^3` THEN ASM_REWRITE_TAC[IN_SING;IN_CROSS;map_to_nua_kg;IN_INTER]]);; + + + +let finite_voronoi2=prove(`!(v:real^3)(S:real^3 ->bool). packing S ==> FINITE ({nua_kg (x:real^3) (y:real^3) | y IN (S DELETE v)/\ x= v /\ y IN ball(v, &4)})`,REPEAT STRIP_TAC THEN REWRITE_TAC[GSYM surj_map_to_nua_kg] + THEN SUBGOAL_THEN `FINITE ({v:real^3} CROSS (S:real^3 ->bool DELETE v INTER ball (v,&4)))` ASSUME_TAC THENL [(*1*)MATCH_MP_TAC FINITE_CROSS THEN SIMP_TAC[FINITE_SING] THEN MATCH_MP_TAC FINITE_SUBSET + THEN EXISTS_TAC `((S:real^3->bool) INTER ball(v:real^3, &4)):real^3 ->bool` + THEN REWRITE_TAC[SUBSET_INTER] THEN ASM_MESON_TAC[REAL_ARITH `&0<= &4`;KIUMVTC;SET_RULE `S DELETE v INTER ball (v,&4) SUBSET S /\ + S DELETE v INTER ball (v,&4) SUBSET ball (v,&4)`];(*2*)ASM_MESON_TAC[FINITE_IMAGE]]);; + + +let real_sub_norm=prove(`!(x:real^3)(y:real^3)(z:real^3). dist (x,z) - dist (y,z)<= dist (x,y)`, +REWRITE_TAC[dist] THEN MESON_TAC[VECTOR_ARITH `x:real^3 - y= (x-z) - (y - z)`;REAL_ABS_SUB_NORM;REAL_ABS_LE;REAL_ARITH `a<= b /\ b<= c ==> a<= c`]);; + + +let not_open = prove (`!s:real^N->bool. ~ (open s) <=> ?a x. a IN s /\ (!n. ~(x n IN s)) /\ (x --> a) sequentially`, + REWRITE_TAC[OPEN_CLOSED; CLOSED_LIMPT; LIMPT_SEQUENTIAL] THEN + REWRITE_TAC[NOT_FORALL_THM; NOT_IMP; IN_DELETE; IN_DIFF; IN_UNIV] THEN + MESON_TAC[]);; + +let not_open_voronoi1 = prove (`!x y v (w:real^N) (A:real^N -> bool). FINITE A /\ (x --> w) sequentially /\ (!n. dist(x n,v) >= dist(x n,y n)) /\ ~(?N. !n. N < n ==> ~(y n IN A)) ==> ?a. a IN A /\ dist(w,v) >= dist(w,a)`, REPEAT GEN_TAC THEN ASM_CASES_TAC `A:real^N->bool = {}` THEN ASM_REWRITE_TAC[NOT_IN_EMPTY] THEN REWRITE_TAC[NOT_EXISTS_THM; NOT_FORALL_THM; NOT_IMP] THEN REPEAT STRIP_TAC THEN REWRITE_TAC[MESON[] `(?a. P a /\ Q a) <=> ~(!a. P a ==> ~Q a)`] THEN REWRITE_TAC[real_ge; REAL_NOT_LE] THEN DISCH_TAC THEN SUBGOAL_THEN `?e. &0 < e /\ !a. a IN A ==> dist(w:real^N,v) + e <= dist(w,a)` STRIP_ASSUME_TAC THENL [EXISTS_TAC `inf(IMAGE (\a:real^N. dist(w,a) - dist(w,v)) A)` THEN ASM_REWRITE_TAC[REAL_ARITH `x + inf s <= y <=> inf s <= y - x`] THEN ASM_SIMP_TAC[REAL_LT_INF_FINITE; REAL_INF_LE_FINITE; FINITE_IMAGE;IMAGE_EQ_EMPTY] THEN ASM_REWRITE_TAC[FORALL_IN_IMAGE; EXISTS_IN_IMAGE; REAL_SUB_LT] THEN MESON_TAC[REAL_LE_REFL]; FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [LIM_SEQUENTIALLY]) THEN DISCH_THEN(MP_TAC o SPEC `e / &2`) THEN ASM_REWRITE_TAC[REAL_HALF] THEN DISCH_THEN(X_CHOOSE_THEN `N:num` (LABEL_TAC "*")) THEN FIRST_X_ASSUM(X_CHOOSE_THEN `n:num` MP_TAC o SPEC `N:num`) THEN STRIP_TAC THEN REMOVE_THEN "*" (MP_TAC o SPEC `n:num`) THEN FIRST_X_ASSUM(MP_TAC o SPEC `n:num`) THEN REPEAT(FIRST_X_ASSUM(MP_TAC o SPEC `(y:num->real^N) n`)) THEN ASM_SIMP_TAC[LT_IMP_LE] THEN NORM_ARITH_TAC]);; + + + +let not_open_voronoi2 = prove (`!x v w:real^N.(x --> w) sequentially /\(?N. !n. N < n ==> &2 <= dist(x n, v))==> &2 <= dist(w,v)`, REWRITE_TAC[dist] THEN REPEAT STRIP_TAC THEN MP_TAC(ISPECL [`sequentially`; `\n. (x:num->real^N) n - v`; `w - v:real^N`; `&2`] LIM_NORM_LBOUND) THEN ASM_SIMP_TAC[LIM_SUB; LIM_CONST; TRIVIAL_LIMIT_SEQUENTIALLY] THEN DISCH_THEN MATCH_MP_TAC THEN REWRITE_TAC[EVENTUALLY_SEQUENTIALLY] THEN EXISTS_TAC `N + 1` THEN ASM_REWRITE_TAC[ARITH_RULE `N + 1 <= n <=> N < n`]);; + + +let not_in_voronoi=prove( `!(x:real^3)(v:real^3)(S:real^3 -> bool). ~ (x IN voronoi_open S v) <=> ?y. y IN S /\ ~ (y = v) /\ dist (x,y)<= dist (x,v)`, +REWRITE_TAC[voronoi_open;IN_ELIM_THM] THEN REWRITE_TAC[NOT_FORALL_THM] THEN REWRITE_TAC[NOT_IMP] THEN MESON_TAC[SET_RULE ` y IN S <=> S y`;REAL_ARITH `~ (a< b) <=> b<= a`]);; + +let not_open_voronoi3=prove( `!(v:real^3)(S:real^3 -> bool). ~ (open (voronoi_open S v)) ==> ?x a y. a IN (voronoi_open S v) /\ (!n. ~ (x n IN (voronoi_open S v))) /\ (x --> a) sequentially /\ (!n. (y n IN S) /\ ~ (y n = v) /\ dist (x n, y n)<= dist (x n, v))`, +REWRITE_TAC[not_open] THEN REPEAT GEN_TAC THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN FIRST_X_ASSUM CHOOSE_TAC +THEN EXISTS_TAC `x:num -> real^3` THEN EXISTS_TAC `a:real^3` THEN ASM_SIMP_TAC[] THEN DISJ_CASES_TAC (MESON[] `( ?y. (!n. (y:num->real^3) n IN (S:real^3 ->bool) /\ ~(y n = v) /\ dist (x n,y n) <= dist (x n,v))) \/ ~ (?y. !n. (y n IN S /\ ~(y n = v) /\ dist (x n,y n) <= dist (x n,v)))`) THENL [(*1*)ASM_MESON_TAC[];(*2*)UNDISCH_TAC `~(?y. (!n. (y:num->real^3) n IN (S:real^3 ->bool) /\ ~(y n = v) /\ dist (x n,y n) <= dist (x n,v))):bool` THEN REWRITE_TAC[NOT_EXISTS_THM;NOT_FORALL_THM] THEN UNDISCH_TAC `((a:real^3) IN voronoi_open (S:real^3->bool) (v:real^3) /\ (!n. ~((x:num ->real^3) n IN voronoi_open S v)) /\ (x --> a) sequentially):bool` THEN REWRITE_TAC[not_in_voronoi] THEN MESON_TAC[]]);; + + +let voronoi_in_ball=prove(`!(x:real^3)(v:real^3)(S:real^3 -> bool).packing S /\ saturated S /\( x IN voronoi_open S v) ==> dist(x,v)< &2`,REWRITE_TAC[saturated;packing;voronoi_open;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN UNDISCH_TAC `(!(x:real^3). ?(y:real^3). y IN (S:real^3 ->bool) /\ dist (x,y) < &2):bool` THEN DISCH_TAC THEN FIRST_X_ASSUM(MP_TAC o SPEC `x:real^3`) THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN SUBGOAL_THEN `(S:real^3->bool) (y:real^3)` MP_TAC +THENL [(*1*)ASM_MESON_TAC[SET_RULE `(y:real^3) IN (S:real^3 -> bool) ==> S y`];(*2*)DISCH_TAC THEN UNDISCH_TAC `(!(w:real^3). (S:real^3->bool) w /\ ~(w = v) ==> dist (x:real^3,v) < dist (x,w)):bool` THEN DISCH_TAC THEN FIRST_X_ASSUM(MP_TAC o SPEC `y:real^3`) THEN DISJ_CASES_TAC (MESON[] ` (y:real^3 = v) \/ ~ (y = v)`) THENL [(*2a*)ASM_MESON_TAC[];(*2b*)ASM_SIMP_TAC[] + THEN UNDISCH_TAC `((y:real^3) IN (S:real^3->bool) /\ dist (x:real^3,y) < &2):bool` THEN STRIP_TAC THEN ASM_MESON_TAC[REAL_ARITH `a a< c`]]]);; + + + + +(*----------------------------------------------------------------*) +(* Openness *) +(*----------------------------------------------------------------*) + + +let open_voronoi=prove( `!(v:real^3)(S:real^3 -> bool).packing S /\ saturated S ==> open (voronoi_open S v)`,REPEAT STRIP_TAC THEN DISJ_CASES_TAC (MESON[] ` open (voronoi_open (S:real^3 ->bool) (v:real^3)) \/ ~ (open (voronoi_open S v))`) THENL [(*1*)ASM_MESON_TAC[];(*2*)MP_TAC(ISPECL [`v:real^3`;`S:real^3 -> bool`] not_open_voronoi3) THEN ASM_SIMP_TAC[] THEN ONCE_REWRITE_TAC[MESON[] `~ p <=> p ==> F`] THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN FIRST_X_ASSUM CHOOSE_TAC + THEN UNDISCH_TAC `((a:real^3) IN voronoi_open (S:real^3->bool) (v:real^3) /\ + (!n. ~((x:num ->real^3) n IN voronoi_open S v)) /\ + (x --> a) sequentially /\ + (!n. (y:num -> real^3) n IN S /\ ~(y n = v) /\ dist (x n,y n) <= dist (x n,v))):bool` THEN REPEAT STRIP_TAC + THEN DISJ_CASES_TAC(MESON[] `(?(N:num). !n. N< n ==> ~((y:num -> real^3) n IN ball(v, &4))) \/ ~ (?N. !n. N< n ==> ~(y n IN ball(v, &4)))`) THENL [(*2a*)UNDISCH_TAC `( (?(N:num). !n. N< n ==> ~((y:num -> real^3) n IN ball(v, &4)))):bool` THEN REWRITE_TAC[ball;IN_ELIM_THM] THEN REWRITE_TAC[REAL_ARITH ` ~ (a:real< b) <=> b<= a`] THEN STRIP_TAC + THEN SUBGOAL_THEN `!(n:num). N< n ==> &2 <= dist((x:num -> real^3) n,v)` MP_TAC +THENL [(*2a1*)REPEAT STRIP_TAC THEN MP_TAC(MESON[DIST_SYM] `dist ((x:num->real^3) n,(y:num -> real^3) n) <= dist (x n,v:real^3) ==> dist(x n, y n) <= dist (v, x n)`) THEN ASM_REWRITE_TAC[] THEN UNDISCH_TAC `(!(n:num). N < n ==> &4 <= dist (v:real^3,(y:num -> real^3) n)):bool` THEN DISCH_TAC THEN FIRST_X_ASSUM(MP_TAC o SPEC `n:num`) THEN ASM_REWRITE_TAC[] + THEN MESON_TAC[REAL_ARITH `a:real <= b ==> (a+ b) <= &2* b`; DIST_TRIANGLE;REAL_ARITH `a<= b /\ b<= c ==> a<= c`;DIST_SYM;REAL_ARITH `&4<= &2* a <=> &2<= a`];(*2a2*)DISCH_TAC THEN MP_TAC(MESON[] `(!(n:num). (N:num) < n ==> &2 <= dist ((x:num -> real^3) n,v:real^3)) ==> (? (M:num). (!(n:num). M < n ==> &2 <= dist (x n,v)))`) THEN ASM_SIMP_TAC[] THEN ONCE_REWRITE_TAC[MESON[] `~ p <=> p ==> F`] THEN DISCH_TAC THEN MP_TAC(ISPECL [`x:num ->real^3`;`v:real^3`;`a:real^3`] not_open_voronoi2) + THEN ASM_SIMP_TAC[] THEN REWRITE_TAC[REAL_ARITH `~ (a<= b ) <=> b< a`] THEN ASM_MESON_TAC[voronoi_in_ball]];(*2b*)MP_TAC(ISPECL [`x:num ->real^3`;`y:num -> real^3`;`v:real^3`;`a:real^3`;`(((S:real^3 ->bool) INTER ball(v:real^3, &4)) DELETE v):real^3 -> bool`] not_open_voronoi1) THEN ASM_REWRITE_TAC[IN_INTER;REAL_ARITH `a:real >= b <=> b<= a`] THEN REWRITE_TAC[IN_DELETE] THEN ASM_SIMP_TAC[IN_INTER] THEN MP_TAC(ISPECL [`v:real^3`;` &4:real`;`S:real^3 ->bool`] KIUMVTC ) THEN ASM_REWRITE_TAC[REAL_ARITH `&0<= &4`;DELETE_SUBSET;FINITE_SUBSET] THEN DISCH_TAC THEN MP_TAC (MESON[DELETE_SUBSET;FINITE_SUBSET] ` (FINITE ((S:real^3->bool) INTER ball (v:real^3,&4))) ==> (FINITE ((S INTER ball (v,&4)) DELETE v))`) THEN ASM_REWRITE_TAC[] + THEN UNDISCH_TAC `((a:real^3) IN voronoi_open (S:real^3 -> bool) (v:real^3)):bool` THEN REWRITE_TAC[voronoi_open;IN_ELIM_THM] THEN REWRITE_TAC[NOT_IMP] THEN SIMP_TAC[NOT_EXISTS_THM] THEN REPEAT STRIP_TAC THEN UNDISCH_TAC ` (!(w:real^3). (S:real^3 ->bool) w /\ ~(w = v) ==> dist (a:real^3,v) < dist (a,w)):bool` THEN DISCH_TAC THEN FIRST_X_ASSUM(MP_TAC o SPEC `a':real^3`) THEN ASM_MESON_TAC[SET_RULE `(a':real^3) IN (S:real^3 -> bool) <=> S a'`;REAL_ARITH ` a:real <= b <=> ~ (b< a)`]]]);; + + +(*----------------------------------------------------------------*) +(* Lemma 5.2 [DRUQUFE]About voronoi_open, this is not element *) +(*----------------------------------------------------------------*) + + +let DRUQUFE=prove(`!(v:real^3)(S:real^3 -> bool).packing S /\ saturated S ==> convex (voronoi_open S v) /\ bounded (voronoi_open S v) /\ open (voronoi_open S v) /\ measurable ( voronoi_open S v)`,MESON_TAC[convex_voronoi;bound_voronoi;open_voronoi;MEASURABLE_OPEN]);; + +(*----------------------------------------------------------------*) +(* The following is to prove Lemma 5.3 *) +(*----------------------------------------------------------------*) + + +let measurable_voronoi=prove(`!(v:real^3)(S:real^3 -> bool).packing S /\ saturated S ==> measurable ( voronoi_open S v)`, MESON_TAC[DRUQUFE]);; + +(* + let negligible_fun = new_definition `negligible_fun f S = (? (C:real). (&0<= C)/\ ! (r:real) (p:real^3). ( &1 <= r) ==> (sum (S INTER ball(p,r)) f) <= C * (r pow 2))`;; +*) + + + let negligible_fun_p = new_definition `negligible_fun_p f S p = (? (C:real). (&0<= C)/\ ! (r:real). ( &1 <= r) ==> (sum (S INTER ball(p,r)) f) <= C * (r pow 2))`;; + + + let fcc_compatible= new_definition `fcc_compatible f S = (!v. v IN S ==> sqrt( &32) <= measure(voronoi_open S v) + f v)`;; + + + let packing_subset_unions_ball=prove( `! (S:real^3 ->bool) (p:real^3) (r:real). ((UNIONS {ball(v:real^3, &1) | v IN S}) INTER ball(p,r)) SUBSET UNIONS {ball(v:real^3, &1) | v IN (S INTER ball (p,r+ &1))}`,REPEAT GEN_TAC THEN REWRITE_TAC[SUBSET;IN_INTER;UNIONS] THEN GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN EXISTS_TAC `ball(v:real^3, &1):real^3 ->bool` THEN STRIP_TAC THENL [(*1*)EXISTS_TAC `(v):real^3` THEN ASM_SIMP_TAC[] THEN UNDISCH_TAC `(x:real^3 IN u):bool` + THEN ASM_REWRITE_TAC[] THEN UNDISCH_TAC `(x IN ball (p:real^3,r)):bool` THEN REWRITE_TAC[ball;IN_ELIM_THM] THEN REWRITE_TAC[dist] THEN REWRITE_TAC[MESON[VECTOR_ARITH `(p:real^3- x) + (x- v)= p - v`] `norm (p:real^3 - v) < r + &1 <=> norm ((p- x) + (x- v))< r+ &1`] THEN MESON_TAC[NORM_SUB;NORM_TRIANGLE;REAL_ARITH `a e< d+ c`]; (*2*)ASM_MESON_TAC[SET_RULE `u = ball(v:real^3, &1):real^3 ->bool /\ x IN u ==> (x:real^3) IN ball (v,&1)`]]);; + + +let measurable_packing_lm1=prove(`! (S:real^3 ->bool) (p:real^3) (r:real). measurable((UNIONS {ball(v:real^3, &1) | v IN S}) INTER ball(p,r))`,let em=CONJUNCT2 INTER_SUBSET in REPEAT GEN_TAC THEN MATCH_MP_TAC (ISPEC `(UNIONS {ball(v:real^3, &1) | v IN S} INTER ball(p,r)):real^3 ->bool` MEASURABLE_OPEN) THEN STRIP_TAC THENL [(*1*)MESON_TAC[BOUNDED_SUBSET;em;BOUNDED_BALL];(*2*)MATCH_MP_TAC OPEN_INTER THEN SIMP_TAC[OPEN_BALL] THEN MATCH_MP_TAC OPEN_UNIONS THEN GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN MESON_TAC[OPEN_BALL]]);; + + +let map_to_ball=new_definition`map_to_ball (x:real^3)= ball(x, &1)`;; + + +let surj_map_to_ball=prove(`!(S:real^3 ->bool). IMAGE (map_to_ball) S = {ball(x:real^3, &1) | x IN S}`, +REWRITE_TAC[IMAGE] THEN REWRITE_TAC[map_to_ball] THEN REPEAT GEN_TAC THEN REWRITE_TAC[map_to_ball;IN_ELIM_THM] THEN ONCE_REWRITE_TAC[GSYM SUBSET_ANTISYM_EQ] THEN STRIP_TAC +THENL [(*1*)REWRITE_TAC[SUBSET;IN_ELIM_THM] THEN GEN_TAC THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC;(*2*)REWRITE_TAC[SUBSET;IN_ELIM_THM] THEN GEN_TAC THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC]);; + +let finite_set_packing_in_ball=prove(`! (S:real^3 ->bool) (p:real^3) (r:real). &0<= r /\ packing S ==> FINITE ({ball(v:real^3, &1) | v IN (S INTER ball (p,r+ &1))})`,REPEAT STRIP_TAC THEN REWRITE_TAC[GSYM surj_map_to_ball] + THEN MATCH_MP_TAC FINITE_IMAGE THEN ASM_MESON_TAC[KIUMVTC;REAL_ARITH `&0<= r ==> &0<= r+ &1`]);; + + +let measurable_packing_lm2=prove(`! (S:real^3 ->bool) (p:real^3) (r:real). &0<= r /\packing S ==> measurable (UNIONS {ball(v:real^3, &1) | v IN (S INTER ball (p,r+ &1))})`, REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURABLE_UNIONS + THEN ASM_SIMP_TAC[finite_set_packing_in_ball] THEN GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM;MEASURABLE_BALL] THEN MESON_TAC[MEASURABLE_BALL]);; + + +let measure_ineq_lm53_1=prove( `! (S:real^3 ->bool) (p:real^3) (r:real). &0<= r /\packing S ==> measure ((UNIONS {ball(v:real^3, &1) | v IN S}) INTER ball(p,r)) <= measure(UNIONS {ball(v:real^3, &1) | v IN (S INTER ball (p,r+ &1))})`,MESON_TAC[MEASURE_SUBSET;packing_subset_unions_ball;measurable_packing_lm1;measurable_packing_lm2]);; + +(*--------------------*) +(* Step 1 *) +(*--------------------*) + +let measure_ineq_lm53_2=prove(`! (S:real^3 ->bool) (p:real^3) (r:real). &0<= r /\packing S ==> measure ((UNIONS {ball(v:real^3, &1) | v IN S}) INTER ball(p,r)) <= & (CARD {ball(v:real^3, &1) | v IN (S INTER ball (p,r+ &1))}) * &4*pi/ &3`, +REPEAT STRIP_TAC THEN MP_TAC(ISPECL [`S:real^3 ->bool`;`p:real^3`;`r:real`] measure_ineq_lm53_1) + THEN ASM_REWRITE_TAC[] THEN SUBGOAL_THEN `measure (UNIONS {ball (v,&1) | v IN (S:real^3 ->bool) INTER ball (p:real^3,r + &1)}) <= &(CARD {ball (v,&1) | v IN S INTER ball (p,r + &1)}) * &4 * pi / &3` (fun th -> MESON_TAC[th;REAL_ARITH `a<=b /\b <= c ==> a<= c`]) THEN MP_TAC(ISPEC `{ball (v,&1) | v IN (S:real^3 ->bool) INTER ball (p:real^3,r + &1)}` MEASURE_UNIONS_LE) + THEN ASM_SIMP_TAC[finite_set_packing_in_ball] + THEN SUBGOAL_THEN `(!(s:real^3 ->bool).s IN {ball (v,&1) | v IN (S:real^3 ->bool) INTER ball (p:real^3,r + &1)} ==> measurable s )` (fun thm -> SIMP_TAC[thm;MEASURABLE_BALL]) +THENL [(*1*)GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM;MEASURABLE_BALL] THEN MESON_TAC[MEASURABLE_BALL];(*2*)SUBGOAL_THEN `sum {ball (v,&1) | v IN (S:real^3 ->bool) INTER ball (p:real^3,r + &1)} (\s. measure s)= sum {ball (v,&1) | v IN (S:real^3 ->bool) INTER ball (p:real^3,r + &1)} (\s. &4 * pi/ &3)` MP_TAC THENL [(*2a*)MATCH_MP_TAC SUM_EQ THEN GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN ASM_REWRITE_TAC[] THEN MESON_TAC[VOLUME_BALL;REAL_ARITH `&0<= &1`;REAL_FIELD `&4* pi/ &3 = &4 / &3 * pi * ( &1 pow 3)`];(*2b*)SIMP_TAC[] THEN SUBGOAL_THEN `sum {ball (v:real^3,&1) | v IN (S:real^3 -> bool) INTER ball (p:real^3,r + &1)} (\s. &4 * pi / &3)= &(CARD {ball (v,&1) | v IN (S:real^3 ->bool) INTER ball (p:real^3,r + &1)}) * &4 * pi / &3` (fun th -> SIMP_TAC[th]) THEN MP_TAC(ISPECL [`&4 * pi / &3:real`;`{ball (v,&1) | v IN (S:real^3 ->bool) INTER ball (p:real^3,r + &1)}:(real^3 -> bool) -> bool`] SUM_CONST) THEN DISCH_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_MESON_TAC[finite_set_packing_in_ball;REAL_ARITH `&0<= r ==> &0 <= r+ &1`]]]);; + + +let card_eq_ball_point=prove( `! (S:real^3 ->bool) (p:real^3) (r:real). &0<= r /\packing S ==> CARD {ball(v:real^3, &1) | v IN (S INTER ball (p,r+ &1))}= CARD(S INTER ball (p,r+ &1))`,REPEAT STRIP_TAC THEN SIMP_TAC[GSYM surj_map_to_ball] THEN MATCH_MP_TAC CARD_IMAGE_INJ THEN ASM_SIMP_TAC[KIUMVTC;REAL_ARITH `&0<= r ==> &0<= r+ &1`] THEN REPEAT GEN_TAC THEN REWRITE_TAC[map_to_ball;IN_INTER] THEN REPEAT STRIP_TAC THEN UNDISCH_TAC `(packing(S:real^3 ->bool)):bool` THEN REWRITE_TAC[packing] THEN DISCH_TAC THEN FIRST_X_ASSUM(MP_TAC o SPECL [`x:real^3`;`y:real^3`]) THEN ASM_REWRITE_TAC[IN_INTER;SET_RULE ` (z:real^3) IN (S:real^3 ->bool) <=> S z`] THEN ASM_SIMP_TAC[SET_RULE ` (z:real^3) IN (S:real^3 ->bool) ==> S z`] THEN FIRST_X_ASSUM(fun th -> MP_TAC(th)) THEN REWRITE_TAC[EXTENSION] THEN DISCH_TAC THEN FIRST_X_ASSUM(MP_TAC o SPEC `x:real^3`) THEN REWRITE_TAC[ball;IN_ELIM_THM;VECTOR_ARITH `x:real^3 - x = vec 0`] THEN REWRITE_TAC[DIST_REFL;REAL_ARITH ` &0< &1`] THEN MESON_TAC[DIST_SYM;REAL_ARITH `a< &1 ==> ~ (&2<= a)`]);; + + + +(*------------------------------------------------------------------------------------------------------*) +(*Some results involving in set of balls or set of voronoi_open cells (finiteness,being image of another set)*) +(*------------------------------------------------------------------------------------------------------*) + + +let voronoi_subset_ball=prove( `!(x:real^3)(v:real^3)(S:real^3 -> bool).packing S /\ saturated S ==> (voronoi_open S v) SUBSET ball(v, &2)`, REWRITE_TAC[SUBSET;ball] THEN REWRITE_TAC[voronoi_in_ball;IN_ELIM_THM] THEN MESON_TAC[voronoi_in_ball;DIST_SYM]);; + + +let all_voronoi_subset_ball=prove(`!(v:real^3)(S:real^3 ->bool)(p:real^3)(r:real). packing S /\ saturated S /\ v IN ball(p, r+ &1) ==> (voronoi_open S v) SUBSET ball(p, r+ &3) `, REPEAT STRIP_TAC THEN MATCH_MP_TAC(SET_RULE `voronoi_open (S:real^3 -> bool) (v:real^3) SUBSET ball(v:real^3, &2) /\ ball(v:real^3, &2 ) SUBSET ball(p:real^3, r+ &3) ==> voronoi_open S v SUBSET ball (p,r + &3)`) THEN ASM_SIMP_TAC[ voronoi_subset_ball] THEN UNDISCH_TAC `((v:real^3) IN ball (p:real^3,r + &1)):bool` THEN REWRITE_TAC[ball;SUBSET;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN MP_TAC(ISPECL [`p:real^3`;`v:real^3`;`x:real^3`] DIST_TRIANGLE) THEN ASM_MESON_TAC[REAL_ARITH ` a< (r:real) + &1 /\ b< &2 /\ c <= a + b ==> c< r + &3`]);; + + +let unions_voronoi_subset_ball=prove( `!(S:real^3 ->bool)(p:real^3)(r:real). packing S /\ saturated S ==> UNIONS {voronoi_open S v | v IN ball(p, r+ &1)} SUBSET ball(p, r+ &3)`, REPEAT STRIP_TAC THEN REWRITE_TAC[SUBSET;UNIONS;IN_ELIM_THM] THEN GEN_TAC THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN UNDISCH_TAC `((?(v:real^3). v IN ball (p:real^3,r + &1) /\ u = voronoi_open (S:real^3 ->bool) v) /\ (x:real^3) IN u):bool` + THEN REPEAT STRIP_TAC THEN UNDISCH_TAC `(x:real^3 IN u:real^3 ->bool):bool` THEN ASM_REWRITE_TAC[] THEN MP_TAC(ISPECL [`v:real^3`;`S:real^3 ->bool`;`p:real^3`;`r:real`] all_voronoi_subset_ball) THEN ASM_SIMP_TAC[] THEN SET_TAC[]);; + +let unions_voronoi_center_in_ball_subset_ball=prove( `!(S:real^3 ->bool)(p:real^3)(r:real). packing S /\ saturated S ==> UNIONS {voronoi_open w v | v IN (S INTER ball(p, r+ &1)) /\ w = S} SUBSET ball(p, r+ &3)`,REPEAT STRIP_TAC THEN REWRITE_TAC[SUBSET;UNIONS;IN_ELIM_THM] THEN GEN_TAC THEN REPEAT STRIP_TAC THEN UNDISCH_TAC `(x:real^3 IN u:real^3 ->bool):bool` THEN ASM_REWRITE_TAC[] THEN MP_TAC(ISPECL [`v:real^3`;`S:real^3 ->bool`;`p:real^3`;`r:real`] all_voronoi_subset_ball) THEN ASM_SIMP_TAC[] THEN ASM_SET_TAC[]);; + + +let map_to_voronoi=new_definition`map_to_voronoi ((x:real^3), (S:real^3 -> bool))= voronoi_open S x`;; + + +let surj_map_to_voronoi=prove(`!(M:real^3 ->bool)(S:real^3 ->bool). IMAGE (map_to_voronoi) (M CROSS {S}) = {voronoi_open S v | v IN M}`,REWRITE_TAC[IMAGE] THEN REWRITE_TAC[map_to_voronoi] THEN REPEAT GEN_TAC THEN REWRITE_TAC[IN_CROSS;map_to_voronoi;IN_ELIM_THM] THEN ONCE_REWRITE_TAC[GSYM SUBSET_ANTISYM_EQ] THEN STRIP_TAC THENL [(*1*) REWRITE_TAC[SUBSET;IN_ELIM_THM] THEN GEN_TAC THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN MP_TAC(ISPEC `x':real^3 # (real^3->bool)` PAIR_SURJECTIVE) THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN UNDISCH_TAC `(x':real^3 # (real^3 -> bool) IN ((M:real^3 ->bool) CROSS {S:real^3 -> bool}) /\ x = map_to_voronoi x'):bool` THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[IN_CROSS;IN_SING] THEN REWRITE_TAC[map_to_voronoi;IN_INTER] THEN REPEAT STRIP_TAC THEN EXISTS_TAC `x'':real^3` THEN ASM_SIMP_TAC[];(*2*)REWRITE_TAC[SUBSET;IN_ELIM_THM] THEN GEN_TAC THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN EXISTS_TAC `(v:real^3, S:real^3->bool):real^3 # (real^3 ->bool)` THEN ASM_REWRITE_TAC[IN_SING;IN_CROSS;map_to_voronoi;IN_INTER]]);; + +let surj_map_to_voronoi_db=prove( `! (S:real^3 ->bool) (p:real^3) (r:real). IMAGE (map_to_voronoi) ((S INTER ball (p,r + &1)) CROSS {S})= {voronoi_open w v | v IN (S INTER ball (p,r+ &1)) /\ w = S}`, REWRITE_TAC[IMAGE] THEN REWRITE_TAC[map_to_voronoi] THEN REPEAT GEN_TAC THEN REWRITE_TAC[IN_CROSS;map_to_voronoi;IN_ELIM_THM] THEN ONCE_REWRITE_TAC[GSYM SUBSET_ANTISYM_EQ] THEN STRIP_TAC THENL [(*1*)REWRITE_TAC[SUBSET;IN_ELIM_THM] THEN GEN_TAC THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN MP_TAC(ISPEC `x':real^3 # (real^3->bool)` PAIR_SURJECTIVE) THEN STRIP_TAC THEN UNDISCH_TAC `(x':real^3 # (real^3 -> bool) IN ((S:real^3 ->bool INTER ball (p:real^3,r + &1)) CROSS {S:real^3 -> bool}) /\ x = map_to_voronoi x'):bool` THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[IN_CROSS;IN_SING] THEN REWRITE_TAC[map_to_voronoi;IN_INTER] THEN REPEAT STRIP_TAC THEN EXISTS_TAC `y:real^3 ->bool` THEN EXISTS_TAC `x'':real^3` THEN ASM_SIMP_TAC[];(*2*) REWRITE_TAC[SUBSET;IN_ELIM_THM] THEN GEN_TAC THEN REPEAT STRIP_TAC THEN EXISTS_TAC `(v, w):real^3 # (real^3 ->bool)` THEN ASM_REWRITE_TAC[IN_SING;IN_CROSS;map_to_voronoi;IN_INTER]]);; + + + +let finite_set_voronoi_center_in_ball=prove(`! (S:real^3 ->bool) (p:real^3) (r:real). &0<= r /\ packing S ==> FINITE ({voronoi_open w v | v IN (S INTER ball (p,r+ &1)) /\ w= S})`, REPEAT STRIP_TAC THEN REWRITE_TAC[GSYM surj_map_to_voronoi_db] THEN MATCH_MP_TAC FINITE_IMAGE THEN ASM_MESON_TAC[KIUMVTC;FINITE_CROSS;FINITE_SING;REAL_ARITH `&0<= r ==> &0<= r+ &1`]);; + + + +let measurable_unions_voronoi=prove(`! (S:real^3 ->bool) (p:real^3) (r:real). &0<= r /\packing S /\ saturated S==> measurable (UNIONS {voronoi_open w v | v IN (S INTER ball (p,r+ &1)) /\ w = S})`, REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURABLE_UNIONS THEN ASM_SIMP_TAC[finite_set_voronoi_center_in_ball] THEN GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN ASM_MESON_TAC[measurable_voronoi]);; + +let negligible_voronoi=prove( `!(S:real^3 ->bool)(p:real^3)(r:real). (!s t. + s IN {voronoi_open w v | v IN S INTER ball (p,r + &1) /\ w = S} /\ + t IN {voronoi_open w v | v IN S INTER ball (p,r + &1) /\ w = S} /\ + ~(s = t) + ==> negligible (s INTER t))`,REPEAT GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC (MESON[NEGLIGIBLE_EMPTY] `(s:real^3->bool) INTER (t:real^3 ->bool) = {} ==> negligible (s INTER t)`) THEN ASM_REWRITE_TAC[] THEN SUBGOAL_THEN ` ~ (v:real^3 = v')` MP_TAC +THENL [(*1*)UNDISCH_TAC `( ~(s:real^3 ->bool = t)):bool` THEN REWRITE_TAC[MESON[] ` ~ p ==> ~q <=> q ==> p`] THEN ASM_MESON_TAC[];(*2*)DISCH_TAC THEN ASM_CASES_TAC `?(x:real^3). x IN (voronoi_open (S:real^3 ->bool) (v:real^3) INTER voronoi_open S (v':real^3))` THEN ASM_REWRITE_TAC[SET_RULE `(B:real^3 -> bool)= {} <=> ~ (?(x:real^3). x IN B)`] THEN FIRST_X_ASSUM CHOOSE_TAC THEN UNDISCH_TAC `((x:real^3) IN (voronoi_open (S:real^3 ->bool) (v:real^3) INTER voronoi_open S (v':real^3))):bool` THEN REWRITE_TAC[voronoi_open] THEN REWRITE_TAC[IN_INTER;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN FIRST_X_ASSUM(MP_TAC o SPEC `v:real^3`) THEN FIRST_X_ASSUM(MP_TAC o SPEC `v':real^3`) THEN ASM_SIMP_TAC[MESON[] `e=f <=> f=e`;SET_RULE `(v':real^3) IN (S:real^3 ->bool) INTER ball (p:real^3,r + &1) ==> S v'`] THEN MP_TAC(SET_RULE `(v':real^3) IN (S:real^3 ->bool) INTER ball (p:real^3,r + &1) ==> S v'`) THEN ASM_SIMP_TAC[] THEN MP_TAC(SET_RULE `(v:real^3) IN (S:real^3 ->bool) INTER ball (p:real^3,r + &1) ==> S v`) THEN ASM_SIMP_TAC[] THEN REAL_ARITH_TAC]);; + +let inj_map_to_voronoi=prove( `!(S:real^3 ->bool)(p:real^3)(r:real) (x:real^3 # (real^3 -> bool)) (y:real^3 # (real^3 -> bool)). + x IN ((S INTER ball (p,r + &1)) CROSS {S}) /\ + y IN (S INTER ball (p,r + &1)) CROSS {S} /\ + map_to_voronoi x = map_to_voronoi y + ==> x = y`,REPEAT GEN_TAC THEN MP_TAC(ISPEC `x:real^3 # (real^3->bool)` PAIR_SURJECTIVE) THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN ASM_SIMP_TAC[] THEN MP_TAC(ISPEC `y:real^3 # (real^3->bool)` PAIR_SURJECTIVE) THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[IN_CROSS;IN_SING] THEN SIMP_TAC[map_to_voronoi] + THEN REWRITE_TAC[PAIR_EQ] THEN REWRITE_TAC[IN_INTER] THEN REPEAT STRIP_TAC THEN UNDISCH_TAC `(voronoi_open (y':real^3->bool) (x':real^3) = voronoi_open (y'':real^3->bool) (x'':real^3)):bool` THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN +SUBGOAL_THEN `x':real^3 IN voronoi_open (S:real^3 ->bool) x'` MP_TAC THENL [(*1*)REWRITE_TAC[voronoi_open;IN_ELIM_THM] +THEN REWRITE_TAC[DIST_REFL] THEN REWRITE_TAC[GSYM DIST_NZ] THEN MESON_TAC[];(*2*)ASM_REWRITE_TAC[] THEN +REWRITE_TAC[voronoi_open;IN_ELIM_THM] THEN DISCH_TAC THEN FIRST_X_ASSUM(MP_TAC o SPEC `x':real^3`) THEN ASM_SIMP_TAC[DIST_REFL;SET_RULE `(x':real^3) IN (S:real^3 ->bool) ==> S x'`] THEN REWRITE_TAC[REAL_ARITH `dist(x':real^3,x'':real^3) < &0 <=> ~ (&0<= dist (x',x''))`] THEN MESON_TAC[DIST_POS_LE]]);; + +let measure_unions_sum_voronoi = prove + (`!(S:real^3 ->bool)(p:real^3)(r:real). + &0 <= r/\ packing S /\ saturated S + ==> measure(UNIONS { voronoi_open w v | + v IN (S INTER ball(p, r+ &1)) /\ w = S}) = + sum (S INTER ball(p, r+ &1)) (\v. measure (voronoi_open S v))`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPECL [`\s:real^3->bool. measure s`; + `{voronoi_open w v | + v IN (S:real^3 ->bool INTER ball(p:real^3, r+ &1)) /\ w = S}`] + MEASURE_NEGLIGIBLE_UNIONS) THEN REWRITE_TAC[negligible_voronoi] THEN + ASM_SIMP_TAC[finite_set_voronoi_center_in_ball;IN_ELIM_THM; + measurable_voronoi;HAS_MEASURE_MEASURE] THEN ANTS_TAC THENL + [MP_TAC(MESON[HAS_MEASURE_MEASURE;measurable_voronoi] + `&0 <= r/\ packing (S:real^3 ->bool) /\ saturated S + ==> (!(s:real^3 ->bool). (?(v:real^3) (w:real^3->bool). + (v IN S INTER ball (p:real^3,r + &1) /\ w = S) /\ + s = voronoi_open w v) ==> s has_measure (measure s))`) THEN + ASM_SIMP_TAC[] THEN + MESON_TAC[]; + DISCH_THEN SUBST1_TAC THEN + REPEAT DISCH_TAC THEN + REWRITE_TAC[GSYM surj_map_to_voronoi_db] THEN MP_TAC(ISPECL + [`map_to_voronoi:real^3#(real^3->bool)->real^3->bool`; + `(\s:real^3->bool. measure s):(real^3-> bool) -> real`; + `(((S:real^3 ->bool) INTER ball (p:real^3,r + &1)) CROSS {S}) + :real^3#(real^3->bool)->bool`] SUM_IMAGE) THEN + REWRITE_TAC[inj_map_to_voronoi] THEN SIMP_TAC[] THEN DISCH_TAC THEN + MATCH_MP_TAC SUM_EQ_GENERAL THEN + EXISTS_TAC `FST:real^3# (real^3 ->bool) -> real^3` + THEN REPEAT STRIP_TAC THENL [(*1*)REWRITE_TAC[EXISTS_UNIQUE] THEN + EXISTS_TAC `(y:real^3,S:real^3->bool):real^3 # (real^3 ->bool)` THEN + ASM_REWRITE_TAC[IN_CROSS;IN_SING;FST] THEN GEN_TAC THEN + MP_TAC(ISPEC `y':real^3 # (real^3 ->bool)` PAIR_SURJECTIVE) THEN + DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN + ASM_REWRITE_TAC[] THEN REWRITE_TAC[IN_CROSS;IN_SING] THEN + MESON_TAC[]; + (*2*) + UNDISCH_TAC `(x:real^3 # (real^3 ->bool) IN (S:real^3 ->bool INTER + ball (p:real^3,r + &1)) CROSS {S}):bool` THEN + MP_TAC(ISPEC `x:real^3 # (real^3 ->bool)` PAIR_SURJECTIVE) THEN + DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN + ASM_REWRITE_TAC[] THEN REWRITE_TAC[IN_CROSS] THEN MESON_TAC[]; + (*3*) + MP_TAC(ISPEC `x:real^3 # (real^3 ->bool)` PAIR_SURJECTIVE) THEN + DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN + FIRST_X_ASSUM CHOOSE_TAC THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[o_THM] THEN ASM_MESON_TAC[map_to_voronoi;IN_CROSS;IN_SING]]]);; + +(*------------------------*) +(* Step 2 *) +(*------------------------*) + +let sum_measure_voronoi_le_ball=prove( `!(S:real^3 ->bool)(p:real^3)(r:real). &0<= r/\ packing S /\ saturated S ==> sum (S INTER ball (p,r + &1)) (\v. measure (voronoi_open S v)) <= measure (ball(p,r+ &3))`, REPEAT STRIP_TAC THEN ASM_SIMP_TAC[GSYM measure_unions_sum_voronoi] THEN ASM_MESON_TAC[MEASURE_SUBSET;measurable_unions_voronoi; unions_voronoi_center_in_ball_subset_ball;MEASURABLE_BALL;REAL_ARITH `&0<= r ==> &0<= r+ &3`]);; + +(*------------------------*) +(* Step 3 *) +(*------------------------*) + +let ineq_lm5_3_step3=prove(`!(S:real^3 ->bool)(p:real^3)(r:real)(A:real^3 ->real). &0<= r/\ packing S /\ saturated S /\ (fcc_compatible A S)==> sqrt( &32) * &(CARD(S INTER ball (p,r + &1))) <= sum (S INTER ball (p,r + &1)) (\v. (A v + measure (voronoi_open S v)))`,REWRITE_TAC[fcc_compatible] THEN REPEAT STRIP_TAC THEN SUBGOAL_THEN ` sum ((S:real^3 ->bool) INTER ball (p:real^3,r + &1)) (\v. sqrt( &32))<= sum (S INTER ball (p,r + &1)) (\v. A v + measure (voronoi_open S v)) ` MP_TAC +THENL [(*1*)MATCH_MP_TAC SUM_LE THEN ASM_SIMP_TAC[KIUMVTC;REAL_ARITH `&0<= r ==> &0<= r + &1`] THEN ASM_MESON_TAC[fcc_compatible;REAL_ARITH `a+b= b+a`;SET_RULE `x IN A INTER B ==> x IN A`];(*2*)ASM_SIMP_TAC[SUM_CONST;KIUMVTC;REAL_ARITH `&0<= r ==> &0<= r + &1`] THEN REAL_ARITH_TAC]);; + + +(*------------------------*) +(* Step 4 *) +(*------------------------*) + + +let ineq_lm5_3_step4=prove( + `!(c:real). (&0<= c) ==> ? (c':real). + !(r:real). (&1 <=r) ==> + ( pi/ sqrt( &18)*( &1+ &3/ r) pow 3 + c*((r+ &1) pow 2)/ (r pow 3 * sqrt( &32)) <= pi/ sqrt( &18) + c'/r)`, + REPEAT STRIP_TAC THEN + EXISTS_TAC `((pi/ sqrt( &18))* ( &9+ &27+ &27) + c* (&1/ sqrt( &32) + &2/ sqrt( &32)+ &1/ sqrt( &32))):real` THEN + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[REAL_ARITH `a:real<= b <=> &0<= b-a`] THEN ASM_SIMP_TAC[REAL_FIELD ` &1<= r==>(pi / sqrt (&18) + + (pi / sqrt (&18) * (&9 + &27 + &27) + + (c:real) * (&1 / sqrt (&32) + &2 / sqrt (&32) + &1 / sqrt (&32))) / + (r:real)) - + (pi / sqrt (&18) * ((&1 + &3 / r) pow 3) + + c * (r + &1) pow 2 / (r pow 3 * sqrt (&32))) =( (&1/ r) * pi/ sqrt( &18)) * ( (&27/r)*( r- &1)+ ( &27/(r pow 2)) * (r pow 2 - &1)) + ( (&1/ r)*c)* (( &2/(r* sqrt( &32)))*(r- &1) + (&1/ (r pow 2 * sqrt( &32))) * (r pow 2 - &1))`] + THEN REWRITE_TAC[REAL_FIELD `(&1 / (r:real) * pi / sqrt (&18)) * + (&27 / r * (r - &1) + &27 / r pow 2 * (r pow 2 - &1)) + + (&1 / r * (c:real)) * + (&2 / (r * sqrt (&32)) * (r - &1) + + &1 / (r pow 2 * sqrt (&32)) * (r pow 2 - &1))= (&1 / r * pi / sqrt (&18)) * + (&27 / r * (r - &1) + (&27 / r pow 2) * (r - &1) *(r + &1)) + + (&1 / r * c) * + (&2 / (r * sqrt (&32)) * (r - &1) + + &1 / (r pow 2 * sqrt (&32)) * (r - &1)*(r + &1))`] THEN MP_TAC(PI_POS_LE) THEN MP_TAC(REAL_ARITH `&1<= r:real ==> &0<= r- &1`) THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH `&1<= r:real ==> &0<= r+ &1`) THEN ASM_REWRITE_TAC[] THEN MP_TAC(MESON[REAL_ARITH `&0<= &18 /\ &0<= &32`;SQRT_POS_LE] `&0<= sqrt( &18) /\ &0<= sqrt( &32)`) THEN MP_TAC(REAL_ARITH `&1<= r:real ==> &0<=r `) THEN ASM_REWRITE_TAC[] THEN MP_TAC(SPEC `r:real` REAL_LE_SQUARE) THEN REWRITE_TAC[REAL_ARITH ` r * r:real = r pow 2`] THEN MP_TAC(REAL_ARITH ` &0<= &1 /\ &0<= &27 /\ &0<= &2`) THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC (SPECL [`(&1 / (r:real) * pi / sqrt (&18)) * + (&27 / r * (r - &1) + &27 / r pow 2 * (r - &1) * (r + &1)):real`;`(&1 / r * (c:real)) * + (&2 / (r * sqrt (&32)) * (r - &1) + + &1 / (r pow 2 * sqrt (&32)) * (r - &1) * (r + &1)):real`] REAL_LE_ADD) THEN MP_TAC(MESON[REAL_LE_DIV;REAL_ARITH `&0<= &1`;REAL_LE_MUL;REAL_LE_ADD;REAL_ARITH ` a:real <= b /\ b<= c ==> a<= c`] `&0<= r /\ &0 <= pi /\ &0 <= sqrt (&18) ==> &0<= &1 / r * pi / sqrt (&18)`) THEN ASM_SIMP_TAC[] THEN MP_TAC(MESON[REAL_LE_DIV;REAL_ARITH `&0<= &1/\ &0<= &27`;REAL_ARITH `r- &1<= r+ &1`;REAL_LE_MUL;REAL_LE_ADD;REAL_ARITH ` a:real <= b /\ b<= c ==> a<= c`] `&0<= r pow 2 /\ &0<= r/\ &0<= r- &1 /\ &0 <= pi /\ &0 <= sqrt (&18) ==> &0<= (&27 / r * (r - &1) + &27 / r pow 2 * (r - &1) * (r + &1))`) THEN ASM_SIMP_TAC[REAL_LE_MUL] THEN REPEAT DISCH_TAC THEN MP_TAC(MESON[REAL_LE_DIV;REAL_ARITH `&0<= &1`;REAL_LE_MUL;REAL_LE_ADD;REAL_ARITH ` a:real <= b /\ b<= c ==> a<= c`] `&0<= r /\ &0 <= pi /\ &0 <= c ==> &0<= &1 / r * (c:real)`) THEN ASM_SIMP_TAC[] THEN DISCH_TAC + THEN MATCH_MP_TAC(SPECL [`&1 / (r:real) * (c:real):real`;`&2 / (r * sqrt (&32)) * (r - &1) + + &1 / (r pow 2 * sqrt (&32)) * (r - &1) * (r + &1):real`] REAL_LE_MUL) THEN ASM_SIMP_TAC[REAL_LE_DIV;REAL_LE_MUL;REAL_LE_ADD;REAL_ARITH ` a<= b /\ b<= c ==> a<= c`] THEN MATCH_MP_TAC(SPECL [`&2 / (r * sqrt (&32)) * (r - &1):real`;`&1 / (r pow 2 * sqrt (&32)) * (r - &1) * (r + &1):real`] REAL_LE_ADD) THEN ASM_MESON_TAC[REAL_LE_DIV;REAL_LE_MUL;REAL_LE_ADD;REAL_ARITH ` a:real <= b /\ b<= c ==> a<= c`]);; + +(*-----------------------------------------------------------------*) +(* Lemma 5.3 If exist fcc_compatible,negligible fun then OK *) +(*-----------------------------------------------------------------*) + +(* thales modified below to make the dependence on p explicit. *) + +let JGXZYGW=prove( + `!(S:real^3 ->bool) (p:real^3). packing S /\ saturated S /\ (? (A:real^3 ->real).(fcc_compatible A S)/\ (negligible_fun_p A S p)) ==> ? (c:real). (!(r:real). &1<= r ==> measure ((UNIONS {ball(v:real^3, &1) | v IN S}) INTER ball(p,r))/ measure (ball(p, r))<= pi/ sqrt( &18) + c/ r)`, +REPEAT GEN_TAC THEN +REWRITE_TAC[negligible_fun_p;fcc_compatible] THEN +REPEAT STRIP_TAC THEN +MP_TAC(SPEC `C:real` ineq_lm5_3_step4) THEN +ASM_SIMP_TAC[] THEN +REPEAT STRIP_TAC THEN +EXISTS_TAC `c':real` THEN +REPEAT STRIP_TAC THEN +FIRST_X_ASSUM(MP_TAC o SPEC `r:real`) THEN +ASM_SIMP_TAC[] THEN +SUBGOAL_THEN `measure (UNIONS {ball (v,&1) | v IN (S:real^3 ->bool)} INTER ball (p:real^3,r:real)) / + measure (ball (p,r))<= pi / sqrt (&18) * (&1 + &3 / r) pow 3 + + (C:real) * (r + &1) pow 2 / (r pow 3 * sqrt (&32))` (fun th -> ASM_MESON_TAC[th;REAL_ARITH `a<=b/\ b<= c ==> a<= c`]) THEN +MP_TAC(SPECL [`S:real^3 ->bool`;`p:real^3`;`r:real`] measure_ineq_lm53_2) THEN +ASM_SIMP_TAC[REAL_ARITH `&1<= r ==> &0<= r`] THEN +DISCH_TAC THEN +MP_TAC(SPECL [`S:real^3 ->bool`;`p:real^3`;`r:real`;`A:real^3 ->real`] ineq_lm5_3_step3) THEN +ASM_SIMP_TAC[REAL_ARITH `&1<= r ==> &0<= r`;fcc_compatible] THEN +ASM_SIMP_TAC[SUM_ADD;KIUMVTC;REAL_ARITH `&1<=r ==> &0<= r + &1`;] THEN +FIRST_X_ASSUM(MP_TAC o SPECL [`r+ &1:real`]) THEN +ASM_SIMP_TAC[REAL_ARITH `&1<=r ==> &1<= r+ &1`] THEN +MP_TAC(SPECL [`S:real^3 ->bool`;`p:real^3`;`r:real`] sum_measure_voronoi_le_ball) THEN +ASM_SIMP_TAC[REAL_ARITH `&1<= r ==> &0<= r`] THEN +REPEAT DISCH_TAC THEN +MP_TAC(REAL_ARITH `sum ((S:real^3 ->bool) INTER ball (p:real^3,r + &1)) (\v:real^3. measure (voronoi_open S v)) <= + measure (ball (p,r + &3)) + /\ sum (S INTER ball (p,r + &1)) (A:real^3 ->real) <= (C:real) * (r + &1) pow 2 /\ sqrt (&32) * &(CARD (S INTER ball (p,r + &1))) <= + sum (S INTER ball (p,r + &1)) A + + sum (S INTER ball (p,r + &1)) (\v:real^3. measure (voronoi_open S v)) + ==> sqrt (&32) * &(CARD (S INTER ball (p,r + &1))) <= C * (r + &1) pow 2 + measure (ball (p,r + &3))`) THEN +ASM_SIMP_TAC[] + THEN +ASM_SIMP_TAC[VOLUME_BALL;REAL_ARITH `&1<= r ==> &0<= r+ &3`] THEN +ASM_SIMP_TAC[REAL_FIELD `&1<= r ==> &4 / &3 * pi * (r + &3) pow 3 = ( &1 + &3/ r) pow 3 * (&4 / &3 * pi * r pow 3)`] THEN +ASM_SIMP_TAC[GSYM (ISPECL [`p:real^3`;`r:real`] VOLUME_BALL);REAL_ARITH `&1<= r ==> &0<= r`] THEN +ONCE_REWRITE_TAC[REAL_ARITH `sqrt (&32) * &(CARD ((S:real^3 -> bool) INTER ball (p:real^3,r + &1))) = &(CARD (S INTER ball (p,r + &1))) * sqrt (&32)`] THEN +SIMP_TAC[GSYM REAL_LE_RDIV_EQ;MESON[SQRT_POS_LT;REAL_ARITH `&0< &32`] `&0< sqrt( &32)`] THEN +DISCH_TAC THEN +SUBGOAL_THEN `measure (UNIONS {ball (v,&1) | v IN (S:real^3->bool)} INTER ball (p:real^3,r:real))<= ((C:real) * (r + &1) pow 2 + (&1 + &3 / r) pow 3 * measure (ball (p,r))) / + sqrt (&32) * &4 * pi / &3` MP_TAC THENL [(*1*)UNDISCH_TAC `(measure (UNIONS {ball (v,&1) | v IN (S:real^3 ->bool)} INTER ball (p:real^3,r:real)) <= + &(CARD {ball (v,&1) | v IN S INTER ball (p,r + &1)}) * &4 * pi / &3):bool` THEN +SUBGOAL_THEN `&(CARD {ball (v,&1) | v IN (S:real^3 ->bool) INTER ball (p:real^3,r + &1)}) * &4 * pi / &3 <= ((C:real) * (r + &1) pow 2 + (&1 + &3 / r) pow 3 * measure (ball (p,r))) / + sqrt (&32) * + &4 * + pi / &3` (fun th -> MESON_TAC[th;REAL_ARITH `a<= b /\ b<= c ==> a<= c`]) THEN +ASM_MESON_TAC[card_eq_ball_point;REAL_ARITH `&1<= r ==> &0<= r`;REAL_OF_NUM_EQ;MESON[PI_POS;REAL_ARITH `&0< &4 /\ &0< &3`;REAL_LT_MUL;REAL_LT_DIV] `&0< &4 * pi/ &3`;REAL_ARITH `a<= b /\ b<= c ==> a<= c`;REAL_LE_RMUL_EQ];(*2*)ASM_SIMP_TAC[VOLUME_BALL;REAL_ARITH `&1<= r ==> &0<= r`] + THEN +MP_TAC(MESON[REAL_ARITH `&1<= r ==> &0< r`;PI_POS;REAL_ARITH `&0< &4 /\ &0< &3`;REAL_LT_MUL;REAL_LT_DIV;REAL_POW_LT] `&1<= r ==> &0< &4/ &3 *pi * r pow 3`) THEN +ASM_SIMP_TAC[] THEN +SIMP_TAC[REAL_LE_LDIV_EQ] THEN +SUBGOAL_THEN `((C:real) * (r + &1) pow 2 + (&1 + &3 / r) pow 3 * &4 / &3 * pi * r pow 3) / + sqrt (&32) * + &4 * + pi / &3= (pi / sqrt (&18) * (&1 + &3 / r) pow 3 + + C * (r + &1) pow 2 / (r pow 3 * sqrt (&32))) * + &4 / &3 * + pi * + r pow 3` (fun th -> MESON_TAC[th]) THEN +REWRITE_TAC[REAL_FIELD `((a:real) + b)/ c * d= ((a + b)*d )/c /\ ((x:real) + y ) * z = x *z + y* z`] THEN +ASM_SIMP_TAC[REAL_EQ_LDIV_EQ;MESON[SQRT_POS_LT;REAL_ARITH `&0< &32`] `&0< sqrt( &32)`;REAL_FIELD `((x:real) + y ) * z = x *z + y* z`] THEN +SUBGOAL_THEN `(C * (r + &1) pow 2) * &4 * pi / &3 = ((C * (r + &1) pow 2 / (r pow 3 * sqrt (&32))) * &4 / &3 * pi * r pow 3) * + sqrt (&32) /\ ((&1 + &3 / r) pow 3 * &4 / &3 * pi * r pow 3) * &4 * pi / &3 = ((pi / sqrt (&18) * (&1 + &3 / r) pow 3) * &4 / &3 * pi * r pow 3) * + sqrt (&32)` (fun th -> MESON_TAC[th;REAL_ARITH ` a= b /\ d= c ==> a+ d= c+ b`]) THEN +STRIP_TAC +THENL +[(*2a*)REWRITE_TAC[REAL_FIELD `((C * (r + &1) pow 2 / (r pow 3 * sqrt (&32))) * &4 / &3 * pi * r pow 3) * + sqrt (&32)= ((C * (r + &1) pow 2 / (r pow 3 * sqrt (&32)))*(r pow 3 * sqrt (&32)))* (&4 / &3 * pi)`] + THEN +MATCH_MP_TAC (REAL_FIELD `~ (r pow 3 * sqrt (&32) = &0)==>(C * (r + &1) pow 2) * &4 * pi / &3= ((C * (r + &1) pow 2 / (r pow 3 * sqrt (&32)))*(r pow 3 * sqrt (&32)))* (&4 / &3 * pi)`) THEN +ASM_MESON_TAC[REAL_DIV_RMUL;REAL_MUL_ASSOC;REAL_MUL_SYM;REAL_ENTIRE;MESON[REAL_POW_NZ;REAL_ARITH `&1<= r ==> ~ (r= &0)`] `&1<=r ==> ~ (r pow 3 = &0)`;MESON[REAL_ARITH `&0< x ==> ~ (x= &0)`;SQRT_POS_LT;REAL_ARITH `&0< &32`] ` ~ (sqrt( &32) = &0)`];(*2b*)REWRITE_TAC[REAL_FIELD `((pi / sqrt (&18) * (&1 + &3 / r) pow 3) * &4 / &3 * pi * r pow 3) * + sqrt (&32)= ((pi* sqrt( &32) / sqrt (&18)) * (&1 + &3 / r) pow 3) * &4 / &3 * pi * r pow 3`] + THEN +SUBGOAL_THEN `sqrt (&32) / sqrt (&18)= &4/ &3` (fun th -> REWRITE_TAC[th;REAL_FIELD `((&1 + &3 / r) pow 3 * &4 / &3 * pi * r pow 3) * &4 * pi / &3 = ((pi * &4/ &3) * (&1 + &3 / r) pow 3) * &4 / &3 * pi * r pow 3`]) THEN +ONCE_REWRITE_TAC[REAL_ARITH ` &32= &4 pow 2 * &2 /\ &18= &3 pow 2 * &2`] THEN +SIMP_TAC[SQRT_MUL;REAL_ARITH ` &0<= &2 /\ &0<= &3 pow 2 /\ &0<= &4 pow 2`;POW_2_SQRT;REAL_ARITH `&0<= &3 /\ &0<= &4`] THEN +MATCH_MP_TAC(REAL_FIELD `~ (sqrt( &2) = &0) ==> (&4 * sqrt (&2)) / (&3 * sqrt (&2)) = &4 / &3`) THEN +MESON_TAC[REAL_ARITH `&0< x ==> ~ (x= &0)`;MESON[SQRT_POS_LT;REAL_ARITH `&0< &2`] ` &0< sqrt ( &2)`]]]);; + + +(*-------------------------------------------------------------------*) + +end;; diff --git a/text_formalization/packing/pack2.hl b/text_formalization/packing/pack2.hl new file mode 100644 index 0000000..1ae5e56 --- /dev/null +++ b/text_formalization/packing/pack2.hl @@ -0,0 +1,561 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Packing *) +(* Author: John Harrison *) +(* Date: 2010-03-16 *) +(* *) +(* This proves theorems about closed Voronoi cells and transfers the main *) +(* results proved in Pack1 by Nguyen Tat Thang from open to closed cells. *) +(* ========================================================================== *) + +module type Pack2_type = sig +end;; + +flyspeck_needs "packing/pack1.hl";; + +module Pack2 (* : Pack1_type *) = struct + +(* ------------------------------------------------------------------------- *) +(* Slight variants of definitions, mainly to use IN. *) +(* ------------------------------------------------------------------------- *) + +let PACKING = prove + (`!s. packing s <=> !u v. u IN s /\ v IN s /\ dist(u,v) < &2 ==> u = v`, + REWRITE_TAC[IN; GSYM REAL_NOT_LE] THEN MESON_TAC[Pack1.packing]);; + +let VORONOI_OPEN = prove + (`!s v. voronoi_open s v = + {x | !w. w IN s /\ ~(w = v) ==> dist(x,v) < dist(x,w)}`, + REWRITE_TAC[Sphere.voronoi_open; IN]);; + +let VORONOI_CLOSED = prove + (`!s v. voronoi_closed s v = {x | !w. w IN s ==> dist(x,v) <= dist(x,w)}`, + REWRITE_TAC[Sphere.voronoi_closed; IN]);; + +(* ------------------------------------------------------------------------- *) +(* Minor variant of KIUMVTC without 0 <= r condition. *) +(* ------------------------------------------------------------------------- *) + +let KIUMVTC = prove + (`!p r S. packing S ==> FINITE(S INTER ball(p,r))`, + REPEAT STRIP_TAC THEN ASM_CASES_TAC `&0 <= r` THENL + [ASM_SIMP_TAC[Pack1.KIUMVTC]; + FIRST_ASSUM(MP_TAC o MATCH_MP (REAL_ARITH `~(&0 <= v) ==> v <= &0`)) THEN + SIMP_TAC[INTER_EMPTY; BALL_EMPTY; FINITE_EMPTY]]);; + +(* ------------------------------------------------------------------------- *) +(* The basic lemmas about closed Voronoi cells. *) +(* ------------------------------------------------------------------------- *) + +let BIS_LE = prove + (`!u v. bis_le u v = + {x | (&2 % (v - u)) dot x <= norm(v) pow 2 - norm(u) pow 2}`, + REPEAT GEN_TAC THEN REWRITE_TAC[Sphere.bis_le; dist; NORM_LE] THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM; DOT_LMUL; DOT_LSUB; DOT_RSUB] THEN + REWRITE_TAC[NORM_POW_2; DOT_SYM] THEN REAL_ARITH_TAC);; + +let BIS_LT = prove + (`!u v. bis_lt u v = + {x | (&2 % (v - u)) dot x < norm(v) pow 2 - norm(u) pow 2}`, + REPEAT GEN_TAC THEN REWRITE_TAC[Sphere.bis_lt; dist; NORM_LT] THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM; DOT_LMUL; DOT_LSUB; DOT_RSUB] THEN + REWRITE_TAC[NORM_POW_2; DOT_SYM] THEN REAL_ARITH_TAC);; + +let VORONOI_CLOSED_ALT = prove + (`!s v. voronoi_closed s v = + {x | !w. w IN s /\ ~(w = v) ==> dist(x,v) <= dist(x,w)}`, + REWRITE_TAC[VORONOI_CLOSED; EXTENSION; IN_ELIM_THM] THEN + MESON_TAC[REAL_LE_REFL]);; + +let VORONOI_CLOSED_AS_INTERSECTION = prove + (`!s v. voronoi_closed s v = INTERS (IMAGE (bis_le v) (s DELETE v))`, + REWRITE_TAC[Sphere.bis_le; VORONOI_CLOSED_ALT; INTERS_IMAGE] THEN + REWRITE_TAC[IN_DELETE; IN_ELIM_THM]);; + +let VORONOI_OPEN_AS_INTERSECTION = prove + (`!s v. voronoi_open s v = INTERS (IMAGE (bis_lt v) (s DELETE v))`, + REWRITE_TAC[Sphere.bis_lt; VORONOI_OPEN; INTERS_IMAGE] THEN + REWRITE_TAC[IN_DELETE; IN_ELIM_THM]);; + +let CLOSED_VORONOI_CLOSED = prove + (`!s v. closed(voronoi_closed s v)`, + REPEAT GEN_TAC THEN REWRITE_TAC[VORONOI_CLOSED_AS_INTERSECTION] THEN + MATCH_MP_TAC CLOSED_INTERS THEN + REWRITE_TAC[FORALL_IN_IMAGE; BIS_LE; CLOSED_HALFSPACE_LE]);; + +let VORONOI_CLOSED_SUBSET_BALL = prove + (`!s v:real^N. saturated s ==> voronoi_closed s v SUBSET ball(v,&2)`, + REPEAT STRIP_TAC THEN REWRITE_TAC[VORONOI_CLOSED; SUBSET] THEN + REWRITE_TAC[IN_ELIM_THM; IN_BALL] THEN + X_GEN_TAC `x:real^N` THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `x:real^N` o GEN_REWRITE_RULE I + [Pack1.saturated]) THEN + DISCH_THEN(X_CHOOSE_THEN `y:real^N` (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC)) THEN + FIRST_X_ASSUM(MP_TAC o SPEC `y:real^N`) THEN + ASM_REWRITE_TAC[] THEN NORM_ARITH_TAC);; + +let BOUNDED_VORONOI_CLOSED = prove + (`!s v. saturated s ==> bounded(voronoi_closed s v)`, + MESON_TAC[VORONOI_CLOSED_SUBSET_BALL; BOUNDED_SUBSET; BOUNDED_BALL]);; + +let COMPACT_VORONOI_CLOSED = prove + (`!s v. saturated s ==> compact(voronoi_closed s v)`, + MESON_TAC[COMPACT_EQ_BOUNDED_CLOSED; CLOSED_VORONOI_CLOSED; + BOUNDED_VORONOI_CLOSED]);; + +let CONVEX_VORONOI_CLOSED = prove + (`!s v. convex(voronoi_closed s v)`, + REPEAT GEN_TAC THEN REWRITE_TAC[VORONOI_CLOSED_AS_INTERSECTION] THEN + MATCH_MP_TAC CONVEX_INTERS THEN + REWRITE_TAC[FORALL_IN_IMAGE; BIS_LE; CONVEX_HALFSPACE_LE]);; + +let BASE_IN_VORONOI_CLOSED = prove + (`!s v. v IN voronoi_closed s v`, + REWRITE_TAC[Sphere.voronoi_closed; DIST_REFL; DIST_POS_LE; IN_ELIM_THM]);; + +let CBALL_SUBSET_VORONOI_CLOSED = prove + (`!s v:real^3. packing s /\ v IN s ==> cball(v,&1) SUBSET voronoi_closed s v`, + REWRITE_TAC[PACKING; SUBSET; VORONOI_CLOSED_ALT; IN_CBALL; IN_ELIM_THM] THEN + REPEAT GEN_TAC THEN STRIP_TAC THEN X_GEN_TAC `x:real^3` THEN + DISCH_TAC THEN X_GEN_TAC `w:real^3` THEN STRIP_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPECL [`v:real^3`; `w:real^3`]) THEN + ASM_REWRITE_TAC[] THEN REPEAT(POP_ASSUM MP_TAC) THEN NORM_ARITH_TAC);; + +let VORONOI_CLOSED_PARTITION_STRONG = prove + (`!s. closed s /\ ~(s = {}) + ==> UNIONS { voronoi_closed s v |v| v IN s} = (:real^3)`, + GEN_TAC THEN STRIP_TAC THEN ONCE_REWRITE_TAC[SIMPLE_IMAGE] THEN + REWRITE_TAC[UNIONS_IMAGE; EXTENSION; IN_UNIV; IN_ELIM_THM] THEN + REWRITE_TAC[VORONOI_CLOSED; IN_ELIM_THM] THEN + X_GEN_TAC `x:real^3` THEN EXISTS_TAC `closest_point s (x:real^3)` THEN + MATCH_MP_TAC CLOSEST_POINT_EXISTS THEN ASM_REWRITE_TAC[]);; + +let PACKING_IMP_CLOSED = prove + (`!s. packing s ==> closed s`, + REWRITE_TAC[PACKING; dist] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC DISCRETE_IMP_CLOSED THEN EXISTS_TAC `&2` THEN + CONV_TAC REAL_RAT_REDUCE_CONV THEN ASM_MESON_TAC[NORM_SUB]);; + +let SATURATED_IMP_NONEMPTY = prove + (`!s. saturated s ==> ~(s = {})`, + REWRITE_TAC[Pack1.saturated] THEN SET_TAC[]);; + +let VORONOI_CLOSED_PARTITION = prove + (`!s. packing s /\ saturated s + ==> UNIONS { voronoi_closed s v |v| v IN s} = (:real^3)`, + SIMP_TAC[VORONOI_CLOSED_PARTITION_STRONG; PACKING_IMP_CLOSED; + SATURATED_IMP_NONEMPTY]);; + +let VORONOI_CLOSED_AS_FINITE_INTERSECTION = prove + (`!s v. packing s /\ saturated s /\ v IN s + ==> voronoi_closed s v = + INTERS (IMAGE (bis_le v) ((s INTER ball(v,&4)) DELETE v))`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC SUBSET_ANTISYM THEN CONJ_TAC THENL + [REWRITE_TAC[VORONOI_CLOSED_AS_INTERSECTION] THEN SET_TAC[]; ALL_TAC] THEN + REWRITE_TAC[SUBSET] THEN X_GEN_TAC `p:real^3` THEN + DISCH_TAC THEN + SUBGOAL_THEN + `?p':real^3. aff_ge {v} {p} INTER voronoi_closed s v = segment[v,p']` + STRIP_ASSUME_TAC THENL + [MATCH_MP_TAC HALFLINE_INTER_COMPACT_SEGMENT THEN + ASM_SIMP_TAC[COMPACT_VORONOI_CLOSED; CONVEX_VORONOI_CLOSED; + BASE_IN_VORONOI_CLOSED]; + ALL_TAC] THEN + MATCH_MP_TAC(TAUT `(~p ==> F) ==> p`) THEN DISCH_TAC THEN + SUBGOAL_THEN + `(v:real^3) IN voronoi_closed s v /\ p' IN voronoi_closed s v /\ + p' IN aff_ge {v} {p}` + STRIP_ASSUME_TAC THENL + [ASM_MESON_TAC[ENDS_IN_SEGMENT; IN_INTER]; ALL_TAC] THEN + SUBGOAL_THEN `p' IN ball(v:real^3,&2)` ASSUME_TAC THENL + [ASM_MESON_TAC[VORONOI_CLOSED_SUBSET_BALL; SUBSET]; ALL_TAC] THEN + SUBGOAL_THEN + `?q:real^3. + q IN ball(v,&2) /\ + q IN INTERS(IMAGE (bis_le v) ((s INTER ball (v,&4)) DELETE v)) /\ + ~(q IN voronoi_closed s v)` + STRIP_ASSUME_TAC THENL + [ASM_CASES_TAC `p IN ball(v:real^3,&2)` THENL + [ASM_MESON_TAC[]; ALL_TAC] THEN + ASM_CASES_TAC `p:real^3 = v` THENL [ASM_MESON_TAC[]; ALL_TAC] THEN + SUBGOAL_THEN + `?t. &0 <= t /\ t < &1 /\ p':real^3 = (&1 - t) % v + t % p` + STRIP_ASSUME_TAC THENL + [UNDISCH_TAC `(p':real^3) IN aff_ge {v} {p}` THEN + ASM_REWRITE_TAC[HALFLINE; IN_SEGMENT; IN_ELIM_THM] THEN + MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `t:real` THEN STRIP_TAC THEN + SUBGOAL_THEN `dist(v:real^3,p') < dist(v,p)` MP_TAC THENL + [ASM_MESON_TAC[IN_BALL; REAL_ARITH `x < &2 /\ ~(y < &2) ==> x < y`]; + ASM_REWRITE_TAC[]] THEN + REWRITE_TAC[VECTOR_ARITH + `(&1 - t) % x + t % y:real^N = x + t % (y - x)`] THEN + REWRITE_TAC[NORM_ARITH `dist(v:real^N,v + x) = norm x`; NORM_MUL] THEN + REWRITE_TAC[dist; NORM_SUB] THEN + ONCE_REWRITE_TAC[REAL_ARITH `x * y < y <=> x * y < &1 * y`] THEN + ASM_SIMP_TAC[REAL_LT_RMUL_EQ; NORM_POS_LT; VECTOR_SUB_EQ] THEN + ASM_REAL_ARITH_TAC; + ALL_TAC] THEN + MP_TAC(ISPECL [`v:real^3`; `&2`] OPEN_BALL) THEN + REWRITE_TAC[open_def] THEN DISCH_THEN(MP_TAC o SPEC `p':real^3`) THEN + ASM_REWRITE_TAC[LEFT_IMP_EXISTS_THM; dist] THEN + X_GEN_TAC `e:real` THEN STRIP_TAC THEN + ABBREV_TAC `u = t + min (e / &2 / norm(p - v:real^3)) ((&1 - t) / &2)` THEN + SUBGOAL_THEN `&0 < u /\ t < u /\ u < &1` STRIP_ASSUME_TAC THENL + [EXPAND_TAC "u" THEN MATCH_MP_TAC(REAL_ARITH + `&0 < x /\ &0 <= t /\ t < &1 + ==> &0 < t + min x ((&1 - t) / &2) /\ t < t + min x ((&1 - t) / &2) /\ + t + min x ((&1 - t) / &2) < &1`) THEN + ASM_SIMP_TAC[REAL_HALF; REAL_LT_DIV; NORM_POS_LT; VECTOR_SUB_EQ]; + ALL_TAC] THEN + EXISTS_TAC `(&1 - u) % v + u % p:real^3` THEN REPEAT CONJ_TAC THENL + [FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_SIMP_TAC[NORM_MUL; GSYM REAL_LT_RDIV_EQ; NORM_POS_LT; VECTOR_SUB_EQ; + VECTOR_ARITH + `((&1 - u) % v + u % p) - ((&1 - t) % v + t % p):real^N = + (u - t) % (p - v)`] THEN + EXPAND_TAC "u" THEN REWRITE_TAC[REAL_ADD_SUB] THEN + MATCH_MP_TAC(REAL_ARITH + `&0 < z /\ &0 < y /\ x = z / &2 ==> abs(min x y) < z`) THEN + ASM_SIMP_TAC[REAL_HALF; REAL_LT_DIV; NORM_POS_LT; VECTOR_SUB_EQ] THEN + REWRITE_TAC[real_div; REAL_MUL_AC] THEN ASM_REAL_ARITH_TAC; + MATCH_MP_TAC IN_CONVEX_SET THEN ASM_SIMP_TAC[REAL_LT_IMP_LE] THEN + CONJ_TAC THENL + [MATCH_MP_TAC CONVEX_INTERS THEN + REWRITE_TAC[FORALL_IN_IMAGE; BIS_LE; CONVEX_HALFSPACE_LE]; + UNDISCH_TAC `(v:real^3) IN voronoi_closed s v` THEN + REWRITE_TAC[VORONOI_CLOSED_AS_INTERSECTION] THEN SET_TAC[]]; + DISCH_TAC THEN + SUBGOAL_THEN `((&1 - u) % v + u % p:real^3) IN + (aff_ge {v} {p} INTER voronoi_closed s v)` + MP_TAC THENL + [ASM_REWRITE_TAC[IN_INTER; HALFLINE; IN_ELIM_THM] THEN + ASM_MESON_TAC[REAL_LT_IMP_LE]; + ASM_REWRITE_TAC[GSYM BETWEEN_IN_SEGMENT] THEN + REWRITE_TAC[between; VECTOR_ARITH + `(&1 - u) % x + u % y:real^N = x + u % (y - x)`] THEN + REWRITE_TAC[NORM_ARITH `dist(v:real^N,v + x) = norm x`; + NORM_ARITH `dist(v + x:real^N,v + y) = norm(x - y)`] THEN + REWRITE_TAC[GSYM VECTOR_SUB_RDISTRIB; NORM_MUL] THEN + ASM_REWRITE_TAC[REAL_ENTIRE; NORM_EQ_0; VECTOR_SUB_EQ; REAL_ARITH + `x * a:real = y * a + z * a <=> a * (x - y - z) = &0`] THEN + ASM_REAL_ARITH_TAC]]; + MP_TAC(ISPEC `s:real^3->bool` VORONOI_CLOSED_PARTITION) THEN + ASM_REWRITE_TAC[EXTENSION; IN_UNIV] THEN + DISCH_THEN(MP_TAC o SPEC `q:real^3`) THEN REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[SIMPLE_IMAGE] THEN + REWRITE_TAC[UNIONS_IMAGE; IN_ELIM_THM] THEN + DISCH_THEN(X_CHOOSE_THEN `w:real^3` STRIP_ASSUME_TAC) THEN + UNDISCH_TAC + `(q:real^3) IN INTERS(IMAGE (bis_le v) + ((s INTER ball(v,&4)) DELETE v))` THEN + REWRITE_TAC[IN_INTERS; FORALL_IN_IMAGE] THEN + DISCH_THEN(MP_TAC o SPEC `w:real^3`) THEN + ASM_REWRITE_TAC[NOT_IMP; IN_DELETE; IN_INTER; IN_BALL] THEN + ASM_CASES_TAC `w:real^3 = v` THENL [ASM_MESON_TAC[]; ALL_TAC] THEN + ASM_REWRITE_TAC[] THEN CONJ_TAC THENL + [MATCH_MP_TAC(NORM_ARITH + `!q. dist(q,w) <= dist(q,v) /\ dist(v,q) < &2 ==> dist(v,w) < &4`) THEN + EXISTS_TAC `q:real^3` THEN + RULE_ASSUM_TAC(REWRITE_RULE[VORONOI_CLOSED; IN_ELIM_THM; IN_BALL]) THEN + ASM_SIMP_TAC[]; + REWRITE_TAC[Sphere.bis_le; IN_ELIM_THM] THEN + RULE_ASSUM_TAC(REWRITE_RULE[VORONOI_CLOSED; IN_ELIM_THM]) THEN + ASM_MESON_TAC[REAL_LE_TRANS]]]);; + +let POLYHEDRON_VORONOI_CLOSED = prove + (`!s v. packing s /\ saturated s /\ v IN s + ==> polyhedron(voronoi_closed s v)`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[VORONOI_CLOSED_AS_FINITE_INTERSECTION] THEN + MATCH_MP_TAC POLYHEDRON_INTERS THEN + ASM_SIMP_TAC[FINITE_IMAGE; FINITE_DELETE; FINITE_INTER; + KIUMVTC; FORALL_IN_IMAGE] THEN + REWRITE_TAC[BIS_LE; POLYHEDRON_HALFSPACE_LE]);; + +let POLYTOPE_VORONOI_CLOSED = prove + (`!s v. packing s /\ saturated s /\ v IN s + ==> polytope(voronoi_closed s v)`, + SIMP_TAC[POLYTOPE_EQ_BOUNDED_POLYHEDRON; POLYHEDRON_VORONOI_CLOSED; + BOUNDED_VORONOI_CLOSED]);; + +let MEASURABLE_VORONOI_CLOSED = prove + (`!s v. saturated s ==> measurable(voronoi_closed s v)`, + SIMP_TAC[MEASURABLE_COMPACT; COMPACT_VORONOI_CLOSED]);; + +(* ------------------------------------------------------------------------- *) +(* Relate closed and open Voronoi cells. *) +(* ------------------------------------------------------------------------- *) + +let CLOSED_BIS_LE = prove + (`!u v. closed(bis_le u v)`, + REWRITE_TAC[BIS_LE; CLOSED_HALFSPACE_LE]);; + +let OPEN_BIS_LT = prove + (`!u v. open(bis_lt u v)`, + REWRITE_TAC[BIS_LT; OPEN_HALFSPACE_LT]);; + +let INTERIOR_BIS_LE = prove + (`!u v. ~(v = u) ==> interior(bis_le u v) = bis_lt u v`, + SIMP_TAC[BIS_LE; BIS_LT; INTERIOR_HALFSPACE_LE; + VECTOR_ARITH `&2 % (v - w):real^N = vec 0 <=> v = w`]);; + +let CLOSURE_BIS_LT = prove + (`!u v. ~(v = u) ==> closure(bis_lt u v) = bis_le u v`, + SIMP_TAC[BIS_LE; BIS_LT; CLOSURE_HALFSPACE_LT; + VECTOR_ARITH `&2 % (v - w):real^N = vec 0 <=> v = w`]);; + +let CLOSURE_VORONOI_OPEN = prove + (`!S v:real^N. closure(voronoi_open S v) = voronoi_closed S v`, + SIMP_TAC[VORONOI_CLOSED_AS_INTERSECTION; VORONOI_OPEN_AS_INTERSECTION] THEN + SIMP_TAC[CLOSURE_INTERS_CONVEX_OPEN; FORALL_IN_IMAGE; BIS_LT; + OPEN_HALFSPACE_LT; CONVEX_HALFSPACE_LT] THEN + REPEAT GEN_TAC THEN COND_CASES_TAC THENL + [POP_ASSUM MP_TAC THEN MATCH_MP_TAC(TAUT `~p ==> p ==> q`) THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + EXISTS_TAC `v:real^N` THEN REWRITE_TAC[INTERS_IMAGE; IN_ELIM_THM] THEN + SIMP_TAC[Sphere.bis_lt; IN_DELETE; IN_ELIM_THM; DIST_REFL; DIST_POS_LT]; + AP_TERM_TAC THEN REWRITE_TAC[GSYM IMAGE_o] THEN MATCH_MP_TAC(SET_RULE + `(!x. x IN s ==> f x = g x) ==> IMAGE f s = IMAGE g s`) THEN + SIMP_TAC[IN_DELETE; o_THM; CLOSURE_BIS_LT]]);; + +let INTERIOR_VORONOI_CLOSED_INTERIOR = prove + (`!S v. interior(voronoi_closed S v) = interior(voronoi_open S v)`, + REPEAT GEN_TAC THEN REWRITE_TAC[GSYM CLOSURE_VORONOI_OPEN] THEN + MATCH_MP_TAC CONVEX_INTERIOR_CLOSURE THEN + REWRITE_TAC[VORONOI_OPEN_AS_INTERSECTION] THEN + MATCH_MP_TAC CONVEX_INTERS THEN + REWRITE_TAC[FORALL_IN_IMAGE; BIS_LT; CONVEX_HALFSPACE_LT]);; + +let INTERIOR_VORONOI_CLOSED = prove + (`!S v. packing S /\ saturated S + ==> interior(voronoi_closed S v) = voronoi_open S v`, + SIMP_TAC[INTERIOR_VORONOI_CLOSED_INTERIOR; Pack1.open_voronoi; + INTERIOR_OPEN]);; + +let VORONOI_OPEN_AS_FINITE_INTERSECTION = prove + (`!s v. packing s /\ saturated s /\ v IN s + ==> voronoi_open s v = + INTERS(IMAGE (bis_lt v) ((s INTER ball(v,&4)) DELETE v))`, + REPEAT STRIP_TAC THEN ASM_SIMP_TAC[GSYM INTERIOR_VORONOI_CLOSED] THEN + ASM_SIMP_TAC[VORONOI_CLOSED_AS_FINITE_INTERSECTION] THEN + ASM_SIMP_TAC[INTERIOR_FINITE_INTERS; FINITE_IMAGE; KIUMVTC; + FORALL_IN_IMAGE; FINITE_DELETE] THEN + AP_TERM_TAC THEN REWRITE_TAC[GSYM IMAGE_o] THEN MATCH_MP_TAC(SET_RULE + `(!x. x IN s ==> f x = g x) ==> IMAGE f s = IMAGE g s`) THEN + SIMP_TAC[IN_DELETE; o_THM; INTERIOR_BIS_LE]);; + +let VORONOI_OPEN_SUBSET_CLOSED = prove + (`!S v:real^N. (voronoi_open S v) SUBSET (voronoi_closed S v)`, + REWRITE_TAC[GSYM CLOSURE_VORONOI_OPEN; CLOSURE_SUBSET]);; + +(* ------------------------------------------------------------------------- *) +(* And so. *) +(* ------------------------------------------------------------------------- *) + +let MEASURE_VORONOI_CLOSED_OPEN = prove + (`!s v:real^N. measure(voronoi_closed s v) = measure(voronoi_open s v)`, + REPEAT GEN_TAC THEN REWRITE_TAC[GSYM CLOSURE_VORONOI_OPEN] THEN + MATCH_MP_TAC MEASURE_NEGLIGIBLE_SYMDIFF THEN + MATCH_MP_TAC NEGLIGIBLE_SUBSET THEN + EXISTS_TAC `frontier(voronoi_open s (v:real^N))` THEN + SIMP_TAC[NEGLIGIBLE_CONVEX_FRONTIER; Geomdetail.VORONOI_CONV] THEN + REWRITE_TAC[frontier] THEN MATCH_MP_TAC(SET_RULE + `i SUBSET s /\ s SUBSET c + ==> (c DIFF s UNION s DIFF c) SUBSET (c DIFF i)`) THEN + REWRITE_TAC[INTERIOR_SUBSET; CLOSURE_SUBSET]);; + +let INTER_VORONOI_SUBSET_BISECTOR = prove + (`!s u v:real^N. + u IN s /\ v IN s + ==> (voronoi_closed s u) INTER (voronoi_closed s v) + SUBSET {x | (&2 % (u - v)) dot x = norm(u) pow 2 - norm(v) pow 2}`, + REPEAT STRIP_TAC THEN ASM_CASES_TAC `u:real^N = v` THENL + [ASM_REWRITE_TAC[VECTOR_SUB_REFL; REAL_SUB_REFL; DOT_LZERO; DOT_LMUL; + REAL_MUL_RZERO] THEN + SET_TAC[]; + REWRITE_TAC[VORONOI_CLOSED_AS_INTERSECTION; INTERS_IMAGE] THEN + REWRITE_TAC[IN_INTER; SUBSET; BIS_LE; IN_ELIM_THM] THEN + X_GEN_TAC `w:real^N` THEN DISCH_THEN(CONJUNCTS_THEN2 + (MP_TAC o SPEC `v:real^N`) (MP_TAC o SPEC `u:real^N`)) THEN + ASM_REWRITE_TAC[IN_DELETE] THEN + REWRITE_TAC[DOT_LMUL; DOT_LSUB] THEN REWRITE_TAC[DOT_SYM] THEN + REAL_ARITH_TAC]);; + +let NEGLIGIBLE_INTER_VORONOI_CLOSED = prove + (`!s u v:real^N. + u IN s /\ v IN s /\ ~(u = v) + ==> negligible((voronoi_closed s u) INTER (voronoi_closed s v))`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET THEN EXISTS_TAC + `{x:real^N | (&2 % (u - v)) dot x = norm(u) pow 2 - norm(v) pow 2}` THEN + ASM_SIMP_TAC[INTER_VORONOI_SUBSET_BISECTOR] THEN + MATCH_MP_TAC NEGLIGIBLE_HYPERPLANE THEN + ASM_SIMP_TAC[VECTOR_MUL_EQ_0; VECTOR_SUB_EQ] THEN REAL_ARITH_TAC);; + +(* ------------------------------------------------------------------------- *) +(* Transfer theorems from Pack1 to closed cells where applicable. *) +(* ------------------------------------------------------------------------- *) + +let voronoi_version2 = prove + (`!(v:real^3) (S:real^3-> bool). + voronoi_closed S v = INTERS {bis_le x y | y IN (S DELETE v) /\ x = v}`, + REWRITE_TAC[VORONOI_CLOSED_AS_INTERSECTION; GSYM SIMPLE_IMAGE] THEN + REPEAT GEN_TAC THEN AP_TERM_TAC THEN SET_TAC[]);; + +let convex_voronoi = prove + (`!(v:real^3) (S:real^3-> bool). convex(voronoi_closed S v)`, + REWRITE_TAC[CONVEX_VORONOI_CLOSED]);; + +let bound_voronoi = prove + (`!(v:real^3) (S:real^3-> bool). + saturated S ==> bounded(voronoi_closed S v)`, + SIMP_TAC[BOUNDED_VORONOI_CLOSED]);; + +let finite_voronoi2 = prove + (`!(v:real^3)(S:real^3 ->bool). + packing S + ==> FINITE {bis_le (x:real^3) (y:real^3) | + y IN (S DELETE v) /\ x = v /\ y IN ball(v, &4)}`, + REWRITE_TAC[PACKING] THEN REPEAT STRIP_TAC THEN + REWRITE_TAC[SET_RULE `{f x y | P y /\ x = v /\ Q y} = + IMAGE (f v) {y | P y /\ Q y}`] THEN + MATCH_MP_TAC FINITE_IMAGE THEN MATCH_MP_TAC DISCRETE_BOUNDED_IMP_FINITE THEN + EXISTS_TAC `&2` THEN CONV_TAC REAL_RAT_REDUCE_CONV THEN CONJ_TAC THENL + [REWRITE_TAC[IN_ELIM_THM; IN_DELETE; GSYM dist] THEN ASM_MESON_TAC[]; + MATCH_MP_TAC BOUNDED_SUBSET THEN EXISTS_TAC `ball(v:real^3,&4)` THEN + REWRITE_TAC[BOUNDED_BALL] THEN SET_TAC[]]);; + +let not_in_voronoi = prove + (`!(x:real^3)(v:real^3)(S:real^3 -> bool). + ~(x IN voronoi_closed S v) <=> + ?y. y IN S /\ ~ (y = v) /\ dist (x,y) < dist (x,v)`, + REWRITE_TAC[VORONOI_CLOSED_ALT; IN_ELIM_THM] THEN MESON_TAC[REAL_NOT_LE]);; + +let voronoi_in_ball = prove + (`!(x:real^3)(v:real^3)(S:real^3 -> bool). + packing S /\ saturated S /\ (x IN voronoi_closed S v) + ==> dist(x,v) < &2`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPECL [`S:real^3->bool`; `v:real^3`] VORONOI_CLOSED_SUBSET_BALL) THEN + ASM_SIMP_TAC[SUBSET; IN_BALL; REAL_LT_IMP_LE; DIST_SYM]);; + +let DRUQUFE = prove + (`!(v:real^3)(S:real^3 -> bool). + packing S /\ saturated S + ==> convex (voronoi_closed S v) /\ + bounded (voronoi_closed S v) /\ + closed (voronoi_closed S v) /\ + measurable ( voronoi_closed S v)`, + SIMP_TAC[CONVEX_VORONOI_CLOSED; BOUNDED_VORONOI_CLOSED; + CLOSED_VORONOI_CLOSED; MEASURABLE_VORONOI_CLOSED]);; + +let measurable_voronoi = prove + (`!(v:real^3)(S:real^3 -> bool). + packing S /\ saturated S ==> measurable ( voronoi_closed S v)`, + SIMP_TAC[MEASURABLE_VORONOI_CLOSED]);; + +let fcc_compatible = prove + (`fcc_compatible f S <=> + (!v. v IN S ==> sqrt(&32) <= measure(voronoi_closed S v) + f v)`, + REWRITE_TAC[Pack1.fcc_compatible; MEASURE_VORONOI_CLOSED_OPEN]);; + +let voronoi_subset_ball = prove + (`!(x:real^3)(v:real^3)(S:real^3 -> bool). + packing S /\ saturated S ==> (voronoi_closed S v) SUBSET ball(v, &2)`, + SIMP_TAC[VORONOI_CLOSED_SUBSET_BALL]);; + +let all_voronoi_subset_ball = prove + (`!(v:real^3)(S:real^3 ->bool)(p:real^3)(r:real). + packing S /\ saturated S /\ v IN ball(p, r + &1) + ==> (voronoi_closed S v) SUBSET ball(p, r + &3)`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC(SET_RULE + `voronoi_closed (S:real^3 -> bool) (v:real^3) SUBSET ball(v:real^3, &2) /\ + ball(v:real^3, &2 ) SUBSET ball(p:real^3, r+ &3) + ==> voronoi_closed S v SUBSET ball (p,r + &3)`) THEN + ASM_SIMP_TAC[voronoi_subset_ball] THEN + UNDISCH_TAC `((v:real^3) IN ball (p:real^3,r + &1)):bool` THEN + REWRITE_TAC[ball;SUBSET;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + MP_TAC(ISPECL [`p:real^3`;`v:real^3`;`x:real^3`] DIST_TRIANGLE) THEN + ASM_MESON_TAC[REAL_ARITH + ` a< (r:real) + &1 /\ b< &2 /\ c <= a + b ==> c < r + &3`]);; + +let unions_voronoi_subset_ball = prove + (`!(S:real^3 ->bool)(p:real^3)(r:real). + packing S /\ saturated S + ==> UNIONS {voronoi_closed S v | v IN ball(p, r+ &1)} + SUBSET ball(p, r+ &3)`, + REWRITE_TAC[UNIONS_SUBSET; FORALL_IN_GSPEC] THEN + SIMP_TAC[all_voronoi_subset_ball]);; + +let unions_voronoi_center_in_ball_subset_ball = prove + (`!(S:real^3 ->bool)(p:real^3)(r:real). + packing S /\ saturated S + ==> UNIONS {voronoi_closed w v | v IN (S INTER ball(p, r+ &1)) /\ + w = S} SUBSET ball(p, r+ &3)`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `UNIONS {voronoi_closed S (v:real^3) | v IN ball(p, r+ &1)}` THEN + ASM_SIMP_TAC[unions_voronoi_subset_ball] THEN + MATCH_MP_TAC SUBSET_UNIONS THEN + REWRITE_TAC[SUBSET; FORALL_IN_GSPEC] THEN + REWRITE_TAC[IN_ELIM_THM; IN_INTER] THEN MESON_TAC[]);; + +let finite_set_voronoi_center_in_ball = prove + (`!(S:real^3 ->bool) (p:real^3) (r:real). + &0 <= r /\ packing S + ==> FINITE({voronoi_closed w v | v IN (S INTER ball (p,r+ &1)) /\ + w = S})`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[SET_RULE `{f x y | y IN t /\ x = s} = IMAGE (f s) t`] THEN + MATCH_MP_TAC FINITE_IMAGE THEN ASM_SIMP_TAC[KIUMVTC]);; + +let measurable_unions_voronoi = prove + (`!(S:real^3 ->bool) (p:real^3) (r:real). + &0 <= r /\ packing S /\ saturated S + ==> measurable(UNIONS {voronoi_closed w v | + v IN (S INTER ball (p,r+ &1)) /\ w = S})`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC MEASURABLE_UNIONS THEN + ASM_SIMP_TAC[finite_set_voronoi_center_in_ball] THEN + GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + ASM_MESON_TAC[measurable_voronoi]);; + +let negligible_voronoi = prove + (`!(S:real^3 ->bool)(p:real^3)(r:real). (!s t. + s IN {voronoi_closed w v | v IN S INTER ball (p,r + &1) /\ w = S} /\ + t IN {voronoi_closed w v | v IN S INTER ball (p,r + &1) /\ w = S} /\ + ~(s = t) + ==> negligible (s INTER t))`, + REWRITE_TAC[IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC NEGLIGIBLE_INTER_VORONOI_CLOSED THEN ASM_MESON_TAC[IN_INTER]);; + +let measure_unions_sum_voronoi = prove + (`!(S:real^3 ->bool)(p:real^3)(r:real). + &0 <= r /\ packing S /\ saturated S + ==> measure(UNIONS {voronoi_closed w v | + v IN (S INTER ball(p, r + &1)) /\ w = S}) = + sum (S INTER ball(p, r + &1)) (\v. measure (voronoi_closed S v))`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[SET_RULE `{f x y | y IN t /\ x = s} = IMAGE (f s) t`] THEN + MATCH_MP_TAC MEASURE_NEGLIGIBLE_UNIONS_IMAGE THEN + ASM_SIMP_TAC[MEASURABLE_VORONOI_CLOSED; KIUMVTC; IN_INTER] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC NEGLIGIBLE_INTER_VORONOI_CLOSED THEN + ASM_REWRITE_TAC[]);; + +let sum_measure_voronoi_le_ball = prove + (`!(S:real^3 ->bool)(p:real^3)(r:real). + &0<= r /\ packing S /\ saturated S + ==> sum (S INTER ball (p,r + &1)) (\v. measure (voronoi_closed S v)) + <= measure (ball(p,r+ &3))`, + REWRITE_TAC[MEASURE_VORONOI_CLOSED_OPEN; + Pack1.sum_measure_voronoi_le_ball]);; + +let ineq_lm5_3_step3 = prove + (`!(S:real^3 ->bool)(p:real^3)(r:real)(A:real^3 ->real). + &0 <= r /\ packing S /\ saturated S /\ (fcc_compatible A S) + ==> sqrt(&32) * &(CARD(S INTER ball(p,r + &1))) + <= sum (S INTER ball (p,r + &1)) + (\v. (A v + measure (voronoi_closed S v)))`, + REWRITE_TAC[MEASURE_VORONOI_CLOSED_OPEN; + Pack1.ineq_lm5_3_step3]);; + +end;; diff --git a/text_formalization/packing/pack3.hl b/text_formalization/packing/pack3.hl new file mode 100644 index 0000000..0617f78 --- /dev/null +++ b/text_formalization/packing/pack3.hl @@ -0,0 +1,2529 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Packing *) +(* Author: Alexey Solovyev *) +(* Date: 2010-03-15 *) +(* Proofs of: KIUMVTC, TIWWFYQ, DRUQUFE *) +(* ========================================================================== *) + + +flyspeck_needs "general/sphere.hl";; +flyspeck_needs "packing/pack_defs.hl";; +flyspeck_needs "packing/pack2.hl";; + + +module Packing3 = struct + + +open Sphere;; +open Pack_defs;; + + +let REMOVE_ASSUM = POP_ASSUM (fun th -> ALL_TAC);; + + +(* Alternative definition of the packing *) +let packing_lt = prove(`packing (V:real^3 -> bool) = + (!u:real^3 v:real^3. (u IN V) /\ (v IN V) /\ (dist( u, v) < &2) ==> + (u = v))`, + REWRITE_TAC[packing;IN;REAL_ARITH `x ~(y<= x)`] + THEN MESON_TAC[]);; + + +let BIS_SYM = prove(`!p (q:real^N). bis p q = bis q p`, + REWRITE_TAC[bis] THEN SET_TAC[]);; + + + + +(***********************************************************************************) +(***********************************************************************************) +(***********************************************************************************) + + +(*********************************) +(* Auxiliary general definitions *) +(*********************************) + +let discrete = new_definition `discrete S <=> ?e. &0 < e /\ (!x y. x IN S /\ y IN S /\ dist(x, y) < e ==> x = y)`;; + + +(****************************) +(* Auxiliary general lemmas *) +(****************************) + +let IMAGE_LEMMA = prove(`!s f. IMAGE f s = {f x | x IN s}`, SET_TAC[IMAGE]);; + + +let CHOICE_LEMMA = MESON[] `!y (P:A->bool). ((?x. P x) /\ (!x. P x ==> (x = y))) ==> (@x. P x) = y`;; + + +let SING_GSPEC_APP = prove(`!(f:A->B) a. {f x | x = a} = {f a}`, + REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN_SING] THEN + REPEAT STRIP_TAC THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL [ ASM_REWRITE_TAC[]; ALL_TAC ] THEN + EXISTS_TAC `a:A` THEN ASM_REWRITE_TAC[]);; + + +let SING_UNION_EQ_INSERT = prove(`!s x:A. {x} UNION s = x INSERT s`, SET_TAC[]);; + + +let IN_TRANS = prove(`!(x:A) s t. x IN t /\ t SUBSET s ==> x IN s`, SIMP_TAC[SUBSET]);; + + +let PROJECTION_ORTHOGONAL = prove(`!d v:real^N. projection d v dot d = &0`, + REWRITE_TAC[DOT_SYM; projection; VECTOR_SUB_PROJECT_ORTHOGONAL]);; + + + +let LENGTH_IMP_CONS = prove(`!l:(A)list. 1 <= LENGTH l ==> ?h t. l = CONS h t`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`l:(A)list`; `PRE (LENGTH (l:(A)list))`] LENGTH_EQ_CONS) THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= n ==> SUC (PRE n) = n`] THEN + STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`h:A`; `t:(A)list`] THEN + ASM_REWRITE_TAC[]);; + + + +let LENGTH_1_LEMMA = prove(`!ul:(A)list. LENGTH ul = 1 ==> ul = [HD ul]`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC `ul:(A)list` LENGTH_IMP_CONS) THEN + ASM_REWRITE_TAC[LE_REFL] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[HD] THEN + SUBGOAL_THEN `t:(A)list = []` (fun th -> REWRITE_TAC[th]) THEN + MP_TAC (ISPEC `ul:(A)list` LENGTH_TL) THEN + ASM_REWRITE_TAC[NOT_CONS_NIL; TL; SUB_REFL; LENGTH_EQ_NIL]);; + + + + +let PERMUTES_TRIVIAL = prove(`!p. p permutes 0..0 <=> p = I`, + GEN_TAC THEN EQ_TAC THENL + [ + REWRITE_TAC[permutes; FUN_EQ_THM; I_THM; IN_NUMSEG; DE_MORGAN_THM; LE_0; NOT_LE] THEN + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `x = 0` THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `0`) THEN + REWRITE_TAC[EXISTS_UNIQUE] THEN + STRIP_TAC THEN REMOVE_ASSUM THEN + SUBGOAL_THEN `x' = 0` ASSUME_TAC THENL + [ + ASM_CASES_TAC `x' = 0` THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x':num`) THEN + ASM_REWRITE_TAC[ARITH_RULE `0 < x' <=> ~(x' = 0)`]; + ALL_TAC + ] THEN + + UNDISCH_TAC `(p:num->num) x' = 0` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + SIMP_TAC[PERMUTES_I]);; + + +let CONTAINS_BALL_AFFINE_HULL = prove(`!s (x:real^N) r. &0 < r /\ ball (x,r) SUBSET s ==> affine hull s = UNIV`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC SUBSET_ANTISYM THEN + REWRITE_TAC[SUBSET_UNIV] THEN + MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `affine hull (ball (x:real^N,r))` THEN + ASM_SIMP_TAC[HULL_MONO] THEN + SUBGOAL_THEN `affine hull ball (x:real^N,r) = UNIV` (fun th -> REWRITE_TAC[th; SUBSET_REFL]) THEN + MATCH_MP_TAC AFFINE_HULL_OPEN THEN + ASM_REWRITE_TAC[OPEN_BALL; BALL_EQ_EMPTY; REAL_NOT_LE]);; + + +(* conv (A UNION B) = conv(A UNION conv B) *) +let CONV_UNION_lemma = prove(`!A B:real^N->bool. convex hull (A UNION B) = convex hull (A UNION convex hull B)`, + REPEAT GEN_TAC THEN + MATCH_MP_TAC CONVEX_HULLS_EQ THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `convex hull (A UNION B:real^N->bool)` THEN + REWRITE_TAC[HULL_SUBSET] THEN + MATCH_MP_TAC HULL_MONO THEN + REWRITE_TAC[SUBSET; IN_UNION] THEN + GEN_TAC THEN + DISCH_THEN DISJ_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + DISJ2_TAC THEN + POP_ASSUM MP_TAC THEN SPEC_TAC (`x:real^N`, `x:real^N`) THEN + REWRITE_TAC[GSYM SUBSET; HULL_SUBSET]; + ALL_TAC + ] THEN + + MATCH_MP_TAC SUBSET_TRANS THEN + EXISTS_TAC `convex hull (A:real^N->bool) UNION convex hull (B:real^N->bool)` THEN + CONJ_TAC THENL + [ + REWRITE_TAC[SUBSET; IN_UNION] THEN + GEN_TAC THEN DISCH_THEN DISJ_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + DISJ1_TAC THEN + POP_ASSUM MP_TAC THEN SPEC_TAC (`x:real^N`, `x:real^N`) THEN + REWRITE_TAC[GSYM SUBSET; HULL_SUBSET]; + ALL_TAC + ] THEN + + REWRITE_TAC[HULL_UNION_SUBSET]);; + + +let CONVEX_HULL_EQ_EQ_SET_EQ = prove(`!s t:real^N->bool. ~affine_dependent s /\ ~affine_dependent t ==> + (convex hull s = convex hull t <=> s = t)`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `FINITE (s:real^N->bool) /\ FINITE (t:real^N->bool)` ASSUME_TAC THENL + [ + ASM_SIMP_TAC[AFFINE_INDEPENDENT_IMP_FINITE]; + ALL_TAC + ] THEN + + EQ_TAC THEN SIMP_TAC[] THEN + DISCH_TAC THEN + + SUBGOAL_THEN `s = {x | x extreme_point_of convex hull s}:real^N->bool` ASSUME_TAC THENL + [ + MP_TAC (ISPEC `s:real^N->bool` EXTREME_POINT_OF_CONVEX_HULL_AFFINE_INDEPENDENT) THEN + ASM_REWRITE_TAC[EXTENSION; IN_ELIM_THM; EQ_SYM_EQ]; + ALL_TAC + ] THEN + SUBGOAL_THEN `t = {x | x extreme_point_of convex hull t}:real^N->bool` ASSUME_TAC THENL + [ + MP_TAC (ISPEC `t:real^N->bool` EXTREME_POINT_OF_CONVEX_HULL_AFFINE_INDEPENDENT) THEN + ASM_REWRITE_TAC[EXTENSION; IN_ELIM_THM; EQ_SYM_EQ]; + ALL_TAC + ] THEN + POP_ASSUM (fun th -> ONCE_REWRITE_TAC[th]) THEN + POP_ASSUM (fun th -> ONCE_REWRITE_TAC[th]) THEN + ASM_REWRITE_TAC[]);; + + +(* Lemmas about intersections *) + +let HULL_INTER_SUBSET_INTER_HULL = prove(`!P s (t:A->bool). P hull (s INTER t) SUBSET P hull s INTER P hull t`, + REWRITE_TAC[SUBSET_INTER] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC HULL_MONO THEN REWRITE_TAC[INTER_SUBSET]);; + + +let HULL_INTER_EQ_INTER = prove(`!P s (t:A->bool). P s /\ P t ==> P hull (s INTER t) = s INTER t`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC SUBSET_ANTISYM THEN + REWRITE_TAC[HULL_SUBSET] THEN + MP_TAC (SPEC_ALL HULL_INTER_SUBSET_INTER_HULL) THEN + ASM_SIMP_TAC[HULL_P]);; + + +let SUBSET_INTERS = prove(`!(s:A->bool) f. s SUBSET INTERS f <=> (!t. t IN f ==> s SUBSET t)`, SET_TAC[]);; + + +let HULL_INTERS_SUBSET_INTERS_HULL = prove(`!P:((A->bool)->bool) s. P hull (INTERS s) SUBSET INTERS {P hull t | t IN s}`, + REPEAT GEN_TAC THEN + REWRITE_TAC[SUBSET_INTERS; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC HULL_MONO THEN + REWRITE_TAC[SUBSET; IN_INTERS; IN_ELIM_THM] THEN + GEN_TAC THEN DISCH_THEN (MP_TAC o SPEC `t':A->bool`) THEN + ASM_REWRITE_TAC[]);; + + +let HULL_INTERS_EQ_INTERS = prove(`!P:((A->bool)->bool) s. (!t. t IN s ==> P t) ==> P hull (INTERS s) = INTERS s`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC SUBSET_ANTISYM THEN + REWRITE_TAC[HULL_SUBSET] THEN + MP_TAC (SPEC_ALL HULL_INTERS_SUBSET_INTERS_HULL) THEN + SUBGOAL_THEN `{P hull t | t IN s} = s:(A->bool)->bool` (fun th -> SIMP_TAC[th]) THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN GEN_TAC THEN + EQ_TAC THENL + [ + REWRITE_TAC[GSYM EXTENSION] THEN + STRIP_TAC THEN + ASM_SIMP_TAC[HULL_P]; + ALL_TAC + ] THEN + REWRITE_TAC[GSYM EXTENSION] THEN + DISCH_TAC THEN EXISTS_TAC `x:A->bool` THEN + ASM_SIMP_TAC[HULL_P]);; + + + + + + + + +let INTERS_2_LEMMA = prove(`!a b f. INTERS {f x | x IN {a, b}} = f a INTER f b`, SET_TAC[INTERS]);; + + +let INTER_INTERS = prove(`!(s:A->bool) (f:(B->bool)) (P:B->(A->bool)). ~(f = {}) ==> s INTER INTERS {P t | t IN f} = INTERS {s INTER P t | t IN f}`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[EXTENSION; IN_INTER; IN_INTERS; IN_ELIM_THM] THEN + GEN_TAC THEN EQ_TAC THENL + [ + REPEAT STRIP_TAC THEN + ASM SET_TAC[]; + + ALL_TAC + ] THEN + REPEAT STRIP_TAC THENL + [ + SUBGOAL_THEN `?t':B. t' IN (f:B->bool)` MP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o check (is_neg o concl)) THEN + REWRITE_TAC[EXTENSION; NOT_IN_EMPTY] THEN + REWRITE_TAC[NOT_FORALL_THM]; + ALL_TAC + ] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `(s:A->bool) INTER (P (t':B))`) THEN + ANTS_TAC THENL + [ + EXISTS_TAC `t':B` THEN + ASM_REWRITE_TAC[IN_INTER]; + ALL_TAC + ] THEN + SIMP_TAC[IN_INTER]; + + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `(s:A->bool) INTER (P (t':B))`) THEN + ANTS_TAC THENL + [ + EXISTS_TAC `t':B` THEN + ASM_REWRITE_TAC[IN_INTER]; + ALL_TAC + ] THEN + SIMP_TAC[IN_INTER]);; + + + +let INTERS_UNIV = prove(`!f:(A->bool)->bool. INTERS f = INTERS (f DELETE UNIV)`, + GEN_TAC THEN REWRITE_TAC[EXTENSION; IN_INTERS; IN_ELIM_THM; IN_DELETE; IN_UNIV] THEN + MESON_TAC[]);; + + + +let INTERS_INTER_INTERS = prove(`!f g. INTERS f INTER INTERS g = INTERS (f UNION g)`, SET_TAC[]);; + + + +let INTERS_INTER_INTERS_ALT = prove(`!(f:B->bool) g (P:B->(A->bool)). INTERS {P x | x IN f} INTER INTERS {P y | y IN g} = INTERS {P u | u IN (f UNION g)}`, + SET_TAC[]);; + + + +let REAL_DIV_LE_1 = prove(`!a b. &0 < b ==> (a / b <= &1 <=> a <= b)`, + MESON_TAC[REAL_LE_LDIV_EQ; REAL_MUL_LID]);; + + + +(* Union of finite sets is finite *) +let UNIONS_FINITE_LEMMA = prove(`!(g:(A->bool)->bool) (P:(A->bool)->(A->bool)). FINITE g /\ (!t. t IN g ==> FINITE (P t)) ==> FINITE (UNIONS {P t | t IN g})`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPEC `{(P:(A->bool)->(A->bool)) t | t IN g}` FINITE_FINITE_UNIONS) THEN + SUBGOAL_THEN `FINITE {(P:(A->bool)->(A->bool)) t | t IN (g:(A->bool)->bool)}` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[SIMPLE_IMAGE] THEN + ASM_SIMP_TAC[FINITE_IMAGE]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + ASM_MESON_TAC[]);; + + + +(* Lemmas about min and max for finite sets of real numbers *) +let REAL_FINITE_MIN_EXISTS = prove(`!S:real->bool. FINITE S /\ ~(S = {}) ==> ?m. m IN S /\ (!x. x IN S ==> m <= x)`, + MESON_TAC[INF_FINITE]);; + + +let REAL_FINITE_MAX_EXISTS = prove(`!S:real->bool. FINITE S /\ ~(S = {}) ==> ?m. m IN S /\ (!x. x IN S ==> x <= m)`, + MESON_TAC[SUP_FINITE]);; + + +let REAL_FINITE_ARGMIN = prove(`!(f:A->real) (S:A->bool). FINITE S /\ ~(S = {}) ==> ?a. a IN S /\ (!x. x IN S ==> f a <= f x)`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `?m. m IN IMAGE (f:A->real) S /\ !y. y IN IMAGE f S ==> m <= y` MP_TAC THENL + [ + MATCH_MP_TAC REAL_FINITE_MIN_EXISTS THEN + ASM_MESON_TAC[IMAGE_EQ_EMPTY; FINITE_IMAGE]; + + ALL_TAC + ] THEN + + REWRITE_TAC[IN_IMAGE] THEN + MESON_TAC[]);; + + +let REAL_FINITE_ARGMAX = prove(`!(f:A->real) (S:A->bool). FINITE S /\ ~(S = {}) ==> ?a. a IN S /\ (!x. x IN S ==> f x <= f a)`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `?m. m IN IMAGE (f:A->real) S /\ !y. y IN IMAGE f S ==> y <= m` MP_TAC THENL + [ + MATCH_MP_TAC REAL_FINITE_MAX_EXISTS THEN + ASM_MESON_TAC[IMAGE_EQ_EMPTY; FINITE_IMAGE]; + + ALL_TAC + ] THEN + + REWRITE_TAC[IN_IMAGE] THEN + MESON_TAC[]);; + + + +(***************************) +(* Properties of bisectors *) +(***************************) + +let BIS_EQ_HYPERPLANE = prove(`!u v. bis u v = {x | &2 % (v - u) dot x = v dot v - u dot u}`, + REWRITE_TAC[bis; EXTENSION; IN_ELIM_THM; dist; NORM_EQ] THEN + REWRITE_TAC[DOT_LSUB; DOT_RSUB; DOT_RMUL; DOT_SYM] THEN + REAL_ARITH_TAC);; + + +let BIS_LE_EQ_HALFSPACE = prove(`!u v. bis_le u v = {x | &2 % (v - u) dot x <= v dot v - u dot u}`, + REWRITE_TAC[bis_le; EXTENSION; IN_ELIM_THM; dist; NORM_LE] THEN + REWRITE_TAC[DOT_LSUB; DOT_RSUB; DOT_RMUL; DOT_SYM] THEN + REAL_ARITH_TAC);; + + +let CONVEX_BIS_LE = prove(`!u v:real^N. convex (bis_le u v)`, + REWRITE_TAC[BIS_LE_EQ_HALFSPACE; CONVEX_HALFSPACE_LE]);; + + + +let CLOSED_BIS_LE = prove(`!u v:real^N. closed (bis_le u v)`, + REWRITE_TAC[BIS_LE_EQ_HALFSPACE; CLOSED_HALFSPACE_LE]);; + + +let CONVEX_BIS = prove(`!u v:real^N. convex(bis u v)`, + REWRITE_TAC[BIS_EQ_HYPERPLANE; CONVEX_HYPERPLANE]);; + + +let POLYHEDRON_BIS = prove(`!u v:real^N. polyhedron (bis u v)`, + ASM_REWRITE_TAC[BIS_EQ_HYPERPLANE; POLYHEDRON_HYPERPLANE]);; + + + +let AFFINE_BIS = prove(`!a b:real^N. affine (bis a b)`, + REWRITE_TAC[BIS_EQ_HYPERPLANE; AFFINE_HYPERPLANE]);; + + +let AFFINE_HULL_INTERS_BIS = prove(`!(p:real^N) s. affine hull INTERS {bis p u | u IN s} = INTERS {bis p u | u IN s}`, + REPEAT GEN_TAC THEN + MATCH_MP_TAC HULL_INTERS_EQ_INTERS THEN + REWRITE_TAC[IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[AFFINE_BIS]);; + + + +(* Auxiliary lemma for distances and points inside an interval *) +let MID_POINT_EXISTS = prove(`!(v:real^N) w (d:real). &0 <= d /\ d <= dist(v, w) ==> ?x. between x (v,w) /\ dist(v,x) = d`, + REPEAT GEN_TAC THEN + DISJ_CASES_TAC (TAUT `dist(v:real^N, w) = &0 \/ ~(dist(v, w) = &0)`) THENL + [ + ASM_SIMP_TAC[REAL_LE_ANTISYM] THEN DISCH_TAC THEN + EXISTS_TAC `v:real^N` THEN + ASM_SIMP_TAC[BETWEEN_IN_SEGMENT; ENDS_IN_SEGMENT; DIST_REFL]; + + ALL_TAC + ] THEN + SUBGOAL_TAC "A" `&0 < dist(v:real^N, w)` [ ASM_MESON_TAC[REAL_ARITH `&0 <= a /\ ~(a = &0) ==> &0 < a`; DIST_POS_LE] ] THEN + REPEAT STRIP_TAC THEN + EXISTS_TAC `(v:real^N) + (d:real / dist(v, w)) % (w - v)` THEN + CONJ_TAC THENL + [ + REWRITE_TAC[BETWEEN_IN_CONVEX_HULL; CONVEX_HULL_2_ALT; IN_ELIM_THM] THEN + EXISTS_TAC `d / dist(v:real^N, w)` THEN + ASM_SIMP_TAC [REAL_LT_IMP_LE; REAL_LE_DIV; REAL_DIV_LE_1]; + + ASM_REWRITE_TAC[dist; NORM_EQ_SQUARE] THEN + REWRITE_TAC[VECTOR_ARITH `v - (v + a % (b - c)) = a % (c - b)`] THEN + REWRITE_TAC[DOT_RMUL; DOT_LMUL] THEN + REWRITE_TAC[GSYM NORM_POW_2; GSYM dist; REAL_POW_2] THEN + REMOVE_THEN "A" MP_TAC THEN + CONV_TAC REAL_FIELD + ]);; + + + +(********************************************************) +(* Proof that V(v,r) is finite begins here *) +(********************************************************) + +(* General properties of discrete sets *) + +(* Any discrete set is closed *) +let CLOSED_DISCRETE = prove(`!A. discrete A ==> closed A`, + REWRITE_TAC[discrete] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC DISCRETE_IMP_CLOSED THEN + EXISTS_TAC `e:real` THEN ASM_REWRITE_TAC[GSYM dist; DIST_SYM] THEN + ASM_MESON_TAC[]);; + + +(* Any subset of a discrete set is discrete *) +let DISCRETE_SUBSET = prove(`!A B:real^N -> bool. discrete A /\ B SUBSET A ==> discrete B`, + REWRITE_TAC[discrete; SUBSET] THEN REPEAT STRIP_TAC THEN + EXISTS_TAC `e:real` THEN ASM_REWRITE_TAC[] THEN + ASM_MESON_TAC[]);; + + +(* A discrete and bounded set is compact *) +let DISCRETE_IMP_BOUNDED_EQ_COMPACT = prove(`!S. discrete S ==> (bounded S <=> compact S)`, + MESON_TAC[CLOSED_DISCRETE; BOUNDED_CLOSED_IMP_COMPACT; COMPACT_IMP_BOUNDED]);; + + + +(* If S is discrete, then there is an open cover by balls b such that |b INTER S| = 1 *) +let DISCRETE_OPEN_COVER = prove(`!S:real^N->bool. discrete S ==> ?f. (!b. b IN f ==> open b /\ (b INTER S) HAS_SIZE 1) /\ S SUBSET UNIONS f`, + REWRITE_TAC[discrete] THEN REPEAT STRIP_TAC THEN + EXISTS_TAC `{ball(x, e) | x IN (S:real^N->bool)}` THEN + REWRITE_TAC[IN_ELIM_THM; SUBSET; UNIONS] THEN + CONJ_TAC THEN REPEAT STRIP_TAC THENL + [ + ASM_SIMP_TAC[OPEN_BALL]; + CONV_TAC HAS_SIZE_CONV THEN + EXISTS_TAC `x:real^N` THEN + ASM_REWRITE_TAC[INTER; ball; IN_ELIM_THM; EXTENSION; IN_SING] THEN + ASM_MESON_TAC[DIST_EQ_0]; + EXISTS_TAC `ball(x:real^N, e)` THEN + ASM_REWRITE_TAC[CENTRE_IN_BALL] THEN + EXISTS_TAC `x:real^N` THEN ASM_REWRITE_TAC[] + ]);; + + +(* Discrete and bounded S is finite *) +let DISCRETE_BOUNDED_IMP_FINITE = prove(`!S:real^N->bool. discrete S /\ bounded S ==> FINITE S`, + REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN + MP_TAC (ISPEC `S:real^N->bool` DISCRETE_IMP_BOUNDED_EQ_COMPACT) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + + REWRITE_TAC[COMPACT_EQ_HEINE_BOREL] THEN + REPEAT STRIP_TAC THEN + MP_TAC (SPEC `S:real^N -> bool` DISCRETE_OPEN_COVER) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (X_CHOOSE_THEN `f:(real^N->bool)->bool` MP_TAC) THEN + FIRST_X_ASSUM ((LABEL_TAC "A") o (SPEC `f:(real^N->bool)->bool`)) THEN + DISCH_THEN (LABEL_TAC "B") THEN + REMOVE_THEN "A" MP_TAC THEN ASM_SIMP_TAC[] THEN + DISCH_THEN (X_CHOOSE_THEN `g:(real^N->bool)->bool` MP_TAC) THEN + STRIP_TAC THEN + SUBGOAL_THEN `FINITE (S INTER UNIONS (g:(real^N->bool)->bool))` ASSUME_TAC THENL + [ + REWRITE_TAC[INTER_UNIONS] THEN + MATCH_MP_TAC UNIONS_FINITE_LEMMA THEN + ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN + REMOVE_THEN "B" (MP_TAC o (SPEC `x:real^N -> bool`) o CONJUNCT1) THEN + MP_TAC (SET_RULE `x:(real^N->bool) IN g /\ g SUBSET f ==> x IN f`) THEN ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + SIMP_TAC[INTER_COMM; HAS_SIZE]; + ALL_TAC + ] THEN + ASM_MESON_TAC[SET_RULE `S SUBSET A ==> S INTER A = S`]);; + + + + +(* Proof of the main lemma begins here *) + +(* A packing is a discrete set *) +let PACKING_IMP_DISCRETE = prove(`!V. packing V ==> discrete V`, + REWRITE_TAC[packing_lt; discrete] THEN REPEAT STRIP_TAC THEN + EXISTS_TAC `&2` THEN ASM_REWRITE_TAC[REAL_ARITH `&0 < &2`]);; + +(* Main lemma: if V is a packing then (V INTER ball) is finite *) +let KIUMVTC = prove(`!(p:real^3) r V. packing V ==> FINITE (V INTER ball(p, r))`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC DISCRETE_BOUNDED_IMP_FINITE THEN CONJ_TAC THENL + [ + ALL_TAC; + ASM_SIMP_TAC[BOUNDED_INTER; BOUNDED_BALL] + ] THEN + MATCH_MP_TAC DISCRETE_SUBSET THEN + EXISTS_TAC `V:real^3->bool` THEN + ASM_SIMP_TAC[PACKING_IMP_DISCRETE] THEN + SET_TAC[]);; + + + + + +(****************************************************) +(* TIWWFYQ *) +(* If a packing is saturated, then every point of *) +(* the space is inside some Voronoi (closed) cell *) +(****************************************************) + + +(* AS: real^N <== pacling:real^N *) +let TIWWFYQ = prove(`!V (p:real^3). packing V /\ saturated V ==> (?v. v IN V /\ p IN voronoi_closed V v)`, + REWRITE_TAC[saturated] THEN REPEAT STRIP_TAC THEN + ABBREV_TAC `S = V INTER ball(p:real^3, &2)` THEN + SUBGOAL_THEN `?v:real^3. v IN S /\ !w. w IN S ==> dist(v, p) <= dist(w, p)` MP_TAC THENL + [ + MATCH_MP_TAC REAL_FINITE_ARGMIN THEN + EXPAND_TAC "S" THEN + ASM_SIMP_TAC[KIUMVTC] THEN + REWRITE_TAC[SET_RULE `~(S = {}) <=> ?a. a IN S`] THEN + EXPAND_TAC "S" THEN REWRITE_TAC[ball; INTER; IN_ELIM_THM] THEN + ASM_MESON_TAC[]; + + ALL_TAC + ] THEN + STRIP_TAC THEN + EXISTS_TAC `v:real^3` THEN + REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN EXPAND_TAC "S" THEN POP_ASSUM (fun th -> ALL_TAC) THEN + ASM_SIMP_TAC[IN_INTER] THEN + DISCH_THEN (LABEL_TAC "A") THEN + DISCH_THEN (LABEL_TAC "B") THEN + REWRITE_TAC[voronoi_closed; IN_ELIM_THM] THEN GEN_TAC THEN + GEN_REWRITE_TAC LAND_CONV [GSYM IN] THEN + DISJ_CASES_TAC (TAUT `w:real^3 IN ball(p, &2) \/ ~(w IN ball(p, &2))`) THENL + [ + ASM_MESON_TAC[DIST_SYM]; + SUBGOAL_THEN `&2 <= dist(p:real^3, w)` MP_TAC THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[ball; IN_ELIM_THM; REAL_NOT_LT]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `dist(p:real^3, v) < &2` MP_TAC THENL + [ + REMOVE_THEN "A" MP_TAC THEN SIMP_TAC[ball; IN_ELIM_THM]; + ALL_TAC + ] THEN + + REAL_ARITH_TAC + ]);; + + + + + +(*******************************) +(* Porperties of Voronoi cells *) +(*******************************) + +(* v IN voronoi_closed V v *) +let CENTER_IN_VORONOI_CELL = prove(`!V (v:real^3). v IN voronoi_closed V v /\ v IN voronoi_open V v`, + REPEAT GEN_TAC THEN + SUBGOAL_THEN `v IN voronoi_open V (v:real^3)` ASSUME_TAC THENL + [ + REWRITE_TAC[voronoi_open; IN_ELIM_THM; DIST_REFL] THEN + SIMP_TAC[DIST_POS_LT]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `voronoi_open V (v:real^3)` THEN + ASM_REWRITE_TAC[Pack2.VORONOI_OPEN_SUBSET_CLOSED]);; + + + +(* voronoi_closed V v contains a ball *) +let VORONOI_CLOSED_CONTAINS_BALL = prove(`!V (v:real^3). packing V ==> ?r. &0 < r /\ ball (v, r) SUBSET voronoi_closed V v`, + REWRITE_TAC[packing; voronoi_closed] THEN + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `v:real^3 IN V` THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[IN] THEN DISCH_TAC THEN + EXISTS_TAC `&1` THEN + REWRITE_TAC[REAL_LT_01; ball; SUBSET; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `w = v:real^3` THEN ASM_REWRITE_TAC[REAL_LE_REFL] THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`v:real^3`; `w:real^3`]) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + SUBGOAL_THEN `&2 - dist(x,v:real^3) <= dist(x,w:real^3)` MP_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `a - b <= c <=> a <= b + c:real`] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `dist (v,w:real^3)` THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (ISPECL [`v:real^3`; `x:real^3`; `w:real^3`] DIST_TRIANGLE) THEN + REWRITE_TAC[DIST_SYM]; + ALL_TAC + ] THEN + + UNDISCH_TAC `dist (v,x:real^3) < &1` THEN + REWRITE_TAC[DIST_SYM] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `?s. &0 < s /\ ball (v:real^3, s) INTER V = {}` STRIP_ASSUME_TAC THENL + [ + SUBGOAL_THEN `~(ball (v:real^3, &1) INTER V = {}) ==> ?x. ball (v:real^3, &1) INTER V = {x}` MP_TAC THENL + [ + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY; IN_INTER; EXTENSION; IN_SING; ball; IN_ELIM_THM] THEN + STRIP_TAC THEN + EXISTS_TAC `x:real^3` THEN + GEN_TAC THEN EQ_TAC THENL + [ + STRIP_TAC THEN + SUBGOAL_THEN `dist (x:real^3, x') < &2` MP_TAC THENL + [ + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `dist (x,v) + dist(v:real^3,x')` THEN + REWRITE_TAC[DIST_TRIANGLE; REAL_ARITH `&2 = &1 + &1`] THEN + MATCH_MP_TAC REAL_LT_ADD2 THEN + ASM_REWRITE_TAC[DIST_SYM]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPECL [`x:real^3`; `x':real^3`]) THEN + POP_ASSUM MP_TAC THEN REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN SIMP_TAC[IN] THEN + DISCH_TAC THEN DISCH_TAC THEN + ASM_CASES_TAC `x' = x:real^3` THEN ASM_REWRITE_TAC[REAL_NOT_LT]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + ASM_CASES_TAC `ball (v:real^3, &1) INTER V = {}` THEN ASM_REWRITE_TAC[] THENL + [ + EXISTS_TAC `&1` THEN + ASM_REWRITE_TAC[REAL_LT_01]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + EXISTS_TAC `dist (v:real^3, x)` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC DIST_POS_LT THEN + DISCH_THEN (ASSUME_TAC o SYM) THEN + UNDISCH_TAC `ball (v:real^3, &1) INTER V = {x}` THEN + ASM_REWRITE_TAC[EXTENSION; IN_INTER; IN_SING; NOT_FORALL_THM] THEN + EXISTS_TAC `x:real^3` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN + REWRITE_TAC[EXTENSION; IN_INTER; ball; IN_ELIM_THM; NOT_IN_EMPTY; IN_SING] THEN + REPEAT STRIP_TAC THEN + FIRST_ASSUM (MP_TAC o SPEC `x:real^3`) THEN + REWRITE_TAC[] THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x':real^3`) THEN + SUBGOAL_THEN `dist (v,x':real^3) < &1` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LT_TRANS THEN + EXISTS_TAC `dist (v, x:real^3)` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + UNDISCH_TAC `dist (v,x':real^3) < dist (v,x)` THEN + ASM_REWRITE_TAC[REAL_LT_REFL]; + ALL_TAC + ] THEN + + EXISTS_TAC `s / &2` THEN + POP_ASSUM MP_TAC THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < s / &2 <=> &0 < s`; ball; SUBSET; IN_ELIM_THM; EXTENSION; IN_INTER; NOT_IN_EMPTY; DE_MORGAN_THM; REAL_NOT_LT] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `w:real^3`) THEN + ASM_REWRITE_TAC[IN] THEN DISCH_TAC THEN + SUBGOAL_THEN `s - dist(x,v:real^3) <= dist(x,w:real^3)` MP_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `a - b <= c <=> a <= b + c:real`] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `dist (v,w:real^3)` THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (ISPECL [`v:real^3`; `x:real^3`; `w:real^3`] DIST_TRIANGLE) THEN + REWRITE_TAC[DIST_SYM]; + ALL_TAC + ] THEN + + UNDISCH_TAC `dist (v, x:real^3) < s / &2` THEN + UNDISCH_TAC `&0 < s` THEN + REWRITE_TAC[DIST_SYM] THEN + REAL_ARITH_TAC);; + + + +(* aff_dim voronoi_closed V v = 3 *) +let AFF_DIM_VORONOI_CLOSED = prove(`!V v. packing V ==> aff_dim (voronoi_closed V v) = &3`, + REWRITE_TAC[GSYM DIMINDEX_3; AFF_DIM_EQ_FULL] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC CONTAINS_BALL_AFFINE_HULL THEN + MP_TAC (SPEC_ALL VORONOI_CLOSED_CONTAINS_BALL) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`v:real^3`; `r:real`] THEN + ASM_REWRITE_TAC[]);; + + + + + +(* For a saturated packing each Voronoi cell is inside a ball of radius 2 *) +let VORONOI_BALL2 = prove(`!V (v:real^N). saturated V ==> voronoi_closed V v SUBSET ball(v, &2)`, + REWRITE_TAC[saturated; voronoi_closed] THEN REPEAT STRIP_TAC THEN + REWRITE_TAC[SUBSET; ball; IN_ELIM_THM] THEN + X_GEN_TAC `y:real^N` THEN + ONCE_REWRITE_TAC[TAUT `(A ==> B) <=> (~B ==> ~A)`] THEN + REWRITE_TAC[REAL_NOT_LT; NOT_FORALL_THM; NOT_IMP; REAL_NOT_LE] THEN + FIRST_X_ASSUM ((X_CHOOSE_THEN `w:real^N` MP_TAC) o SPEC `y:real^N`) THEN + REWRITE_TAC[IN] THEN REPEAT STRIP_TAC THEN + EXISTS_TAC `w:real^N` THEN + ASM_REWRITE_TAC[] THEN REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN + REWRITE_TAC[DIST_SYM] THEN + REAL_ARITH_TAC);; + + +(* A Voronoi cell is bounded (for a saturated packing) *) +let BOUNDED_VORONOI_CLOSED = prove(`!V (v:real^N). saturated V ==> bounded (voronoi_closed V v)`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC BOUNDED_SUBSET THEN + ASM_MESON_TAC[VORONOI_BALL2; BOUNDED_BALL]);; + + +(* A closed Voronoi cell is an intersection of bisector half-spaces *) +let VORONOI_CLOSED_EQ_INTERS_BIS_LE = prove(`!S v:real^N. voronoi_closed S v = INTERS {bis_le v w | w IN S}`, + REPEAT GEN_TAC THEN + REWRITE_TAC[voronoi_closed; bis_le; INTERS; IN_ELIM_THM] THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM; IN] THEN GEN_TAC THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + ASM_MESON_TAC[]; + FIRST_X_ASSUM (MP_TAC o (SPEC `bis_le v (w:real^N)`) o check (is_forall o concl)) THEN + ANTS_TAC THEN REWRITE_TAC[bis_le; IN_ELIM_THM] THEN + EXISTS_TAC `w:real^N` THEN ASM_REWRITE_TAC[] + ]);; + + +(* The same result with excluded point v *) +let VORONOI_CLOSED_EQ_INTERS_BIS_LE_ALT = prove(`!S v:real^N. voronoi_closed S v = INTERS {bis_le v w | w | w IN S /\ ~(w = v)}`, + REPEAT GEN_TAC THEN + REWRITE_TAC[voronoi_closed; bis_le] THEN + REWRITE_TAC[EXTENSION; IN_INTERS; IN_ELIM_THM; IN] THEN GEN_TAC THEN + EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + ASM_MESON_TAC[]; + DISJ_CASES_TAC (TAUT `w:real^N = v \/ ~(w = v)`) THENL + [ + ASM_REWRITE_TAC[REAL_LE_REFL]; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o (SPEC `bis_le v (w:real^N)`) o check (is_forall o concl)) THEN + ANTS_TAC THEN REWRITE_TAC[bis_le; IN_ELIM_THM] THEN + EXISTS_TAC `w:real^N` THEN ASM_REWRITE_TAC[] + ]);; + + + +(* A closed Voronoi cell is an intersection of bisectors for w IN ball(v, 4) *) +let VORONOI_INTER_BIS_LE = prove(`!V (v:real^3). packing V /\ saturated V /\ (v IN V) ==> + (voronoi_closed V v =INTERS { bis_le v u | u | u IN V /\ u IN ball(v, &4) /\ ~(u=v) })`, + REWRITE_TAC[VORONOI_CLOSED_EQ_INTERS_BIS_LE_ALT; saturated] THEN REPEAT STRIP_TAC THEN + REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN DISCH_THEN (LABEL_TAC "A") THEN DISCH_TAC THEN + REWRITE_TAC[EXTENSION; IN_INTERS] THEN GEN_TAC THEN EQ_TAC THENL + [ + SET_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[IN_ELIM_THM] THEN + DISCH_THEN (LABEL_TAC "B") THEN REPEAT STRIP_TAC THEN + + DISJ_CASES_TAC (TAUT `(w:real^3) IN ball(v:real^3, &4) \/ ~(w IN ball(v, &4))`) THENL + [ + REPLICATE_TAC 5 (POP_ASSUM MP_TAC) THEN SET_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `x:real^3 IN ball(v, &2)` (LABEL_TAC "C") THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[ball; IN_ELIM_THM] THEN + ONCE_REWRITE_TAC[TAUT `~A ==> B <=> ~B ==> A`] THEN + REWRITE_TAC[REAL_NOT_LT] THEN DISCH_TAC THEN + MP_TAC (ISPECL [`v:real^3`; `x:real^3`; `&2`] MID_POINT_EXISTS) THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 <= &2`] THEN + DISCH_THEN (X_CHOOSE_THEN `q:real^3` MP_TAC) THEN + REWRITE_TAC[between] THEN STRIP_TAC THEN + REMOVE_THEN "A" ((X_CHOOSE_THEN `p:real^3` MP_TAC) o SPEC `q:real^3`) THEN STRIP_TAC THEN + REMOVE_THEN "B" (MP_TAC o SPEC `bis_le v (p:real^3)`) THEN + ANTS_TAC THENL + [ + EXISTS_TAC `p:real^3` THEN ASM_REWRITE_TAC[ball; IN_ELIM_THM] THEN + CONJ_TAC THENL + [ + MP_TAC (ISPECL [`v:real^3`; `q:real^3`; `p:real^3`] DIST_TRIANGLE) THEN + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[DIST_NZ] THEN + MP_TAC (ISPECL [`v:real^3`; `p:real^3`; `q:real^3`] DIST_TRIANGLE) THEN + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN REWRITE_TAC[DIST_SYM] THEN + REAL_ARITH_TAC; + + ALL_TAC + ] THEN + + REWRITE_TAC[bis_le; IN_ELIM_THM] THEN + SUBGOAL_TAC "A" `dist(x:real^3, v) = &2 + dist(q, x)` [ASM_SIMP_TAC[DIST_SYM]] THEN + MP_TAC (ISPECL [`x:real^3`; `q:real^3`; `p:real^3`] DIST_TRIANGLE) THEN + REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC; + + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + ASM_REWRITE_TAC[bis_le; ball; IN_ELIM_THM; REAL_NOT_LT] THEN + MP_TAC (ISPECL [`v:real^3`; `x:real^3`; `w:real^3`] DIST_TRIANGLE) THEN + REWRITE_TAC[DIST_SYM] THEN REAL_ARITH_TAC);; + + + +(* A closed Voronoi cell is an intersection of finitely many closed half-spaces *) +let VORONOI_CLOSED_EQ_FINITE_INTERS_BIS_LE = prove(`!V (v:real^3). packing V /\ saturated V /\ (v IN V) ==> + ?W. W SUBSET V /\ ~(v IN W) /\ FINITE W /\ + voronoi_closed V v = INTERS { bis_le v u | u | u IN W }`, + REPEAT GEN_TAC THEN + DISCH_TAC THEN + FIRST_ASSUM (MP_TAC o (fun th -> MATCH_MP VORONOI_INTER_BIS_LE th)) THEN + DISCH_TAC THEN + EXISTS_TAC `(V:real^3->bool) INTER ball(v,&4) DELETE v` THEN + REPEAT STRIP_TAC THENL + [ + SET_TAC[]; + ASM SET_TAC[]; + MATCH_MP_TAC FINITE_SUBSET THEN + EXISTS_TAC `V INTER ball(v:real^3,&4)` THEN + CONJ_TAC THENL + [ + ASM_MESON_TAC[KIUMVTC]; + ALL_TAC + ] THEN + SET_TAC[]; + + ASM_REWRITE_TAC[] THEN + SET_TAC[] + ]);; + + + +(* A closed Voronoi cell is a polyhedron *) + +(* AS: real^N (requires packing:real^N) *) +let VORONOI_POLYHEDRON = prove(`!V (v:real^3). packing V /\ saturated V /\ (v IN V) ==> + polyhedron (voronoi_closed V v)`, + REPEAT GEN_TAC THEN + DISCH_THEN (MP_TAC o (fun th -> MATCH_MP VORONOI_CLOSED_EQ_FINITE_INTERS_BIS_LE th)) THEN + STRIP_TAC THEN + REWRITE_TAC[polyhedron] THEN + EXISTS_TAC `{bis_le v (u:real^3) | u IN W}` THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + REWRITE_TAC[GSYM IMAGE_LEMMA] THEN + MATCH_MP_TAC FINITE_IMAGE THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[IN_ELIM_THM; BIS_LE_EQ_HALFSPACE] THEN + REPEAT STRIP_TAC THEN + EXISTS_TAC `&2 % (u - v:real^3)` THEN + EXISTS_TAC `(u:real^3) dot u - (v:real^3) dot v` THEN + ASM_REWRITE_TAC[VECTOR_MUL_EQ_0; REAL_ARITH `~(&2 = &0)`; VECTOR_SUB_EQ] THEN + ASM SET_TAC[]);; + + +(* A closed Voronoi cell is convex *) +let CONVEX_VORONOI_CLOSED = prove(`!S v:real^N. convex(voronoi_closed S v)`, + REPEAT GEN_TAC THEN + REWRITE_TAC[VORONOI_CLOSED_EQ_INTERS_BIS_LE] THEN + MATCH_MP_TAC CONVEX_INTERS THEN + REWRITE_TAC[IN_ELIM_THM] THEN + MESON_TAC[CONVEX_BIS_LE]);; + + +(* A closed Voronoi cell is closed *) +let CLOSED_VORONOI_CLOSED = prove(`!S v:real^N. closed(voronoi_closed S v)`, + REPEAT GEN_TAC THEN + REWRITE_TAC[VORONOI_CLOSED_EQ_INTERS_BIS_LE] THEN + MATCH_MP_TAC CLOSED_INTERS THEN + REWRITE_TAC[IN_ELIM_THM] THEN + MESON_TAC[CLOSED_BIS_LE]);; + +(* A closed Voronoi cell is compact if a packing is saturated (for boundness) *) +let COMPACT_VORONOI_CLOSED = prove(`!S v. saturated S ==> compact (voronoi_closed S v)`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC BOUNDED_CLOSED_IMP_COMPACT THEN + ASM_SIMP_TAC[CLOSED_VORONOI_CLOSED; BOUNDED_VORONOI_CLOSED]);; + + +(****************************************************************) +(* DRUQUFE: *) +(* For a saturated packing, each closed Voronoi closed cell is *) +(* compact, convex, and measurable *) +(****************************************************************) + +(* AS: real^N, remove `packing` *) +let DRUQUFE = prove(`!V (v:real^3). packing V /\ saturated V ==> + compact (voronoi_closed V v) /\ convex (voronoi_closed V v) /\ measurable (voronoi_closed V v)`, + REPEAT STRIP_TAC THENL + [ + ASM_SIMP_TAC[COMPACT_VORONOI_CLOSED]; + REWRITE_TAC[CONVEX_VORONOI_CLOSED]; + MATCH_MP_TAC MEASURABLE_CONVEX THEN + ASM_SIMP_TAC[CONVEX_VORONOI_CLOSED; BOUNDED_VORONOI_CLOSED] + ]);; + + + + + + +(*************************************************************) + + +(*******************************************) +(* Some results for initial sublists *) +(*******************************************) + +let INITIAL_SUBLIST_APPEND = prove(`!ul vl. initial_sublist ul (APPEND ul vl)`, + REWRITE_TAC[INITIAL_SUBLIST] THEN + MESON_TAC[]);; + + +let INITIAL_SUBLIST_HEAD_EQ = prove(`!xl zl hx tx hz tz. xl = CONS hx tx /\ zl = CONS hz tz /\ initial_sublist xl zl ==> hx = hz`, + REPEAT GEN_TAC THEN + REWRITE_TAC[INITIAL_SUBLIST] THEN + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + ASM_REWRITE_TAC[APPEND] THEN + MESON_TAC[injectivity "list"]);; + + +let INITIAL_SUBLIST_HEAD_EQ_2 = prove(`!xl yl zl hx tx hy ty. xl = CONS hx tx /\ yl = CONS hy ty /\ initial_sublist xl zl /\ initial_sublist yl zl ==> hx = hy`, + MESON_TAC[INITIAL_SUBLIST_HEAD_EQ; INITIAL_SUBLIST; APPEND]);; + + + +let INITIAL_SUBLIST_TAIL = prove(`!xl zl hx tx. xl = CONS hx tx /\ initial_sublist xl zl ==> initial_sublist tx (TL zl)`, + REWRITE_TAC[INITIAL_SUBLIST] THEN + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + ASM_REWRITE_TAC[APPEND] THEN + DISCH_TAC THEN + ASM_REWRITE_TAC[TL] THEN + MESON_TAC[]);; + + +(* Two initial sublists of the same list and of the same size are equal *) +let INITIAL_SUBLIST_UNIQUE = prove(`!n (xl:(A)list) yl zl. initial_sublist xl zl /\ initial_sublist yl zl /\ LENGTH xl = n /\ LENGTH yl = n ==> xl = yl`, + INDUCT_TAC THEN REPEAT STRIP_TAC THENL + [ + ASM_MESON_TAC[LENGTH_EQ_NIL]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`xl:(A)list`; `n:num`] LENGTH_EQ_CONS) THEN + MP_TAC (ISPECL [`yl:(A)list`; `n:num`] LENGTH_EQ_CONS) THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[injectivity "list"] THEN + CONJ_TAC THENL + [ + ASM_MESON_TAC[INITIAL_SUBLIST_HEAD_EQ_2]; + ALL_TAC + ] THEN + + ASM_MESON_TAC[INITIAL_SUBLIST_TAIL]);; + + +(* Transitivity for initial sublists *) +let INITIAL_SUBLIST_TRANS = prove(`!(xl:(A)list) yl zl. initial_sublist xl yl /\ initial_sublist yl zl ==> initial_sublist xl zl`, + REWRITE_TAC[INITIAL_SUBLIST] THEN + REPEAT STRIP_TAC THEN + ASM_MESON_TAC[APPEND_ASSOC]);; + + +(* initial_sublist is reflexive *) +let INITIAL_SUBLIST_REFL = prove(`!ul. initial_sublist ul ul`, MESON_TAC[INITIAL_SUBLIST; APPEND_NIL]);; + + +(* An empty list is an initial sublist of any list *) +let INITIAL_SUBLIST_NIL = prove(`!zl. initial_sublist [] zl`, + REWRITE_TAC[INITIAL_SUBLIST; APPEND] THEN MESON_TAC[]);; + + +(* There exists initial sublists of all acceptable lengths *) +let INITIAL_SUBLIST_EXISTS_ALT = prove(`!n (zl:(A)list) k. LENGTH zl = n /\ k <= n ==> ?xl. initial_sublist xl zl /\ LENGTH xl = k`, + INDUCT_TAC THEN REPEAT STRIP_TAC THENL + [ + EXISTS_TAC `[]:(A)list` THEN + REWRITE_TAC[INITIAL_SUBLIST_NIL] THEN + POP_ASSUM MP_TAC THEN + SIMP_TAC[LE; LENGTH]; + + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`zl:(A)list`; `n:num`] LENGTH_EQ_CONS) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + SUBGOAL_THEN `?yl:(A)list. initial_sublist yl t /\ LENGTH yl = k - 1` MP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPECL [`t:(A)list`; `k - 1`]) THEN + ASM_SIMP_TAC[ARITH_RULE `k <= SUC n ==> k - 1 <= n`]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + DISJ_CASES_TAC (ARITH_RULE `k = 0 \/ 0 < k`) THENL + [ + EXISTS_TAC `[]:(A)list` THEN + ASM_REWRITE_TAC[INITIAL_SUBLIST_NIL; LENGTH]; + ALL_TAC + ] THEN + + EXISTS_TAC `CONS (h:A) yl` THEN + ASM_REWRITE_TAC[INITIAL_SUBLIST; APPEND; LENGTH] THEN + CONJ_TAC THENL + [ + REPLICATE_TAC 2 (POP_ASSUM (fun th -> ALL_TAC)) THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[INITIAL_SUBLIST] THEN + MESON_TAC[]; + + POP_ASSUM MP_TAC THEN + ARITH_TAC + ]);; + + + +let INITIAL_SUBLIST_EXISTS = prove(`!zl k. k <= LENGTH zl ==> (?xl. initial_sublist xl zl /\ LENGTH xl = k)`, + MESON_TAC[INITIAL_SUBLIST_EXISTS_ALT]);; + + +(* The length of an initial sublist does not exceed the length of the list itself *) +let INITIAL_SUBLIST_LENGTH_LE = prove(`!xl zl. initial_sublist xl zl ==> LENGTH xl <= LENGTH zl`, + REWRITE_TAC[INITIAL_SUBLIST] THEN REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[LENGTH_APPEND] THEN + ARITH_TAC);; + + +(* Structure of initial sublists of APPEND ul vl *) +let INITIAL_SUBLIST_APPEND_2 = prove(`!(xl:(A)list) ul vl. initial_sublist xl (APPEND ul vl) <=> initial_sublist xl ul \/ (?yl. initial_sublist yl vl /\ xl = APPEND ul yl)`, + REPEAT STRIP_TAC THEN EQ_TAC THENL + [ + ABBREV_TAC `k = LENGTH (xl:(A)list)` THEN + DISJ_CASES_TAC (ARITH_RULE `k:num <= LENGTH (ul:(A)list) \/ LENGTH ul < k`) THENL + [ + DISCH_TAC THEN + DISJ1_TAC THEN + MP_TAC (ISPECL [`ul:(A)list`; `k:num`] INITIAL_SUBLIST_EXISTS) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + MP_TAC (ISPECL [`xl':(A)list`; `ul:(A)list`; `APPEND (ul:(A)list) vl`] INITIAL_SUBLIST_TRANS) THEN + ASM_REWRITE_TAC[INITIAL_SUBLIST_APPEND] THEN + ASM_MESON_TAC[INITIAL_SUBLIST_UNIQUE]; + + ALL_TAC + ] THEN + + DISCH_TAC THEN + DISJ2_TAC THEN + SUBGOAL_THEN `?yl:(A)list. initial_sublist yl vl /\ LENGTH yl = k - LENGTH (ul:(A)list)` MP_TAC THENL + [ + MP_TAC (ISPECL [`vl:(A)list`; `k - LENGTH (ul:(A)list)`] INITIAL_SUBLIST_EXISTS) THEN + ANTS_TAC THENL + [ + POP_ASSUM (MP_TAC o (fun th -> MATCH_MP INITIAL_SUBLIST_LENGTH_LE th)) THEN + ASM_REWRITE_TAC[LENGTH_APPEND] THEN + POP_ASSUM MP_TAC THEN + ARITH_TAC; + + MESON_TAC[] + ]; + + ALL_TAC + ] THEN + + STRIP_TAC THEN + EXISTS_TAC `yl:(A)list` THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `initial_sublist (APPEND (ul:(A)list) yl) (APPEND ul vl) /\ LENGTH (APPEND ul yl) = k` MP_TAC THENL + [ + CONJ_TAC THENL + [ + POP_ASSUM (fun th -> ALL_TAC) THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[INITIAL_SUBLIST] THEN + MESON_TAC[APPEND_ASSOC]; + REWRITE_TAC[LENGTH_APPEND] THEN + POP_ASSUM MP_TAC THEN + POP_ASSUM (fun th -> ALL_TAC) THEN POP_ASSUM (fun th -> ALL_TAC) THEN + POP_ASSUM MP_TAC THEN + ARITH_TAC + ]; + + ALL_TAC + ] THEN + + ASM_MESON_TAC[INITIAL_SUBLIST_UNIQUE]; + + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THENL + [ + ASM_MESON_TAC[INITIAL_SUBLIST_TRANS; INITIAL_SUBLIST_APPEND]; + ASM_MESON_TAC[INITIAL_SUBLIST; APPEND_ASSOC] + ]);; + + + +(* Initial sublists of an one-element list *) +let INITIAL_SUBLIST_SING = prove(`!(v:A) xl. initial_sublist xl [v] <=> xl = [] \/ xl = [v]`, + REPEAT GEN_TAC THEN EQ_TAC THENL + [ + DISCH_TAC THEN + FIRST_ASSUM (MP_TAC o (fun th -> MATCH_MP INITIAL_SUBLIST_LENGTH_LE th)) THEN + REWRITE_TAC[LENGTH; SYM ONE] THEN + DISCH_TAC THEN + DISJ_CASES_TAC (ARITH_RULE `LENGTH (xl:(A)list) = 0 \/ 1 <= LENGTH xl`) THENL + [ + ASM_MESON_TAC[LENGTH_EQ_NIL]; + ALL_TAC + ] THEN + DISJ2_TAC THEN + MP_TAC (ISPECL [`1`; `LENGTH (xl:(A)list)`] LE_ANTISYM) THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `initial_sublist [v:A] [v] /\ LENGTH [v] = 1` ASSUME_TAC THENL + [ + REWRITE_TAC[INITIAL_SUBLIST; LENGTH; SYM ONE; APPEND] THEN MESON_TAC[]; + ALL_TAC + ] THEN + ASM_MESON_TAC[INITIAL_SUBLIST_UNIQUE]; + + ALL_TAC + ] THEN + + STRIP_TAC THENL + [ + ASM_REWRITE_TAC[INITIAL_SUBLIST_NIL]; + ASM_REWRITE_TAC[INITIAL_SUBLIST; APPEND] THEN MESON_TAC[] + ]);; + + +(* Initial sublists of APPEND ul [v] *) +let INITIAL_SUBLIST_APPEND_SING = prove(`!xl ul (v:A). initial_sublist xl (APPEND ul [v]) <=> initial_sublist xl ul \/ xl = APPEND ul [v]`, + REPEAT GEN_TAC THEN + REWRITE_TAC[INITIAL_SUBLIST_APPEND_2; INITIAL_SUBLIST_SING] THEN EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + ASM_REWRITE_TAC[]; + DISJ1_TAC THEN POP_ASSUM MP_TAC THEN + ASM_REWRITE_TAC[APPEND_NIL] THEN + SIMP_TAC[INITIAL_SUBLIST_REFL]; + ASM_REWRITE_TAC[]; + ASM_REWRITE_TAC[]; + DISJ2_TAC THEN + EXISTS_TAC `[v:A]` THEN + ASM_REWRITE_TAC[] + ]);; + + +(* (HD ul) is an initial sublist of ul *) +let INITIAL_SUBLIST_HD = prove(`!ul:(A)list. 1 <= LENGTH ul ==> initial_sublist [HD ul] ul`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC `ul:(A)list` LENGTH_IMP_CONS) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[HD; INITIAL_SUBLIST; APPEND] THEN + EXISTS_TAC `t:(A)list` THEN + REWRITE_TAC[]);; + +(* (BUTLAST ul) is an initial sublist of ul *) +let BUTLAST_INITIAL_SUBLIST = prove(`!ul:(A)list. 1 <= LENGTH ul ==> initial_sublist (BUTLAST ul) ul`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPEC `ul:(A)list` APPEND_BUTLAST_LAST) THEN + REWRITE_TAC[GSYM LENGTH_EQ_NIL] THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= a ==> ~(a = 0)`] THEN + REWRITE_TAC[INITIAL_SUBLIST] THEN + DISCH_TAC THEN + EXISTS_TAC `[LAST ul:A]` THEN + ASM_REWRITE_TAC[]);; + + +(**********************************************************) + +(**********************************) +(* Additional properties of lists *) +(**********************************) + +let LENGTH_BUTLAST = prove(`!ul:(A)list. 1 <= LENGTH ul ==> LENGTH (BUTLAST ul) = LENGTH ul - 1`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPEC `ul:(A)list` APPEND_BUTLAST_LAST) THEN + REWRITE_TAC[GSYM LENGTH_EQ_NIL] THEN + ASM_SIMP_TAC[ARITH_RULE `1 <= a ==> ~(a = 0)`] THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [GSYM th]) THEN + REWRITE_TAC[LENGTH_APPEND; LENGTH] THEN + ARITH_TAC);; + + + + +let HD_IN_SET_OF_LIST = prove(`!ul:(A)list. 1 <= LENGTH ul ==> HD ul IN set_of_list ul`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[IN_SET_OF_LIST] THEN + ONCE_REWRITE_TAC[GSYM EL] THEN + MATCH_MP_TAC MEM_EL THEN + POP_ASSUM MP_TAC THEN + ARITH_TAC);; + + +let HD_INITIAL_SUBLIST = prove(`!xl yl:(A)list. 1 <= LENGTH yl /\ initial_sublist yl xl ==> HD yl = HD xl`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC `yl:(A)list` LENGTH_IMP_CONS) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPEC `xl:(A)list` LENGTH_IMP_CONS) THEN + SUBGOAL_THEN `1 <= LENGTH (xl:(A)list)` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC LE_TRANS THEN + EXISTS_TAC `LENGTH (yl:(A)list)` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC INITIAL_SUBLIST_LENGTH_LE THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC INITIAL_SUBLIST_HEAD_EQ THEN + MAP_EVERY EXISTS_TAC [`yl:(A)list`; `xl:(A)list`; `t':(A)list`; `t:(A)list`] THEN + ASM_REWRITE_TAC[HD]);; + + +let SET_OF_LIST_INITIAL_SUBLIST_SUBSET = prove(`!vl ul:(A)list. initial_sublist vl ul ==> set_of_list vl SUBSET set_of_list ul`, + REWRITE_TAC[INITIAL_SUBLIST] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[SET_OF_LIST_APPEND; SUBSET_UNION]);; + + +let LENGTH_REVERSE = prove(`!ul:(A)list. LENGTH (REVERSE ul) = LENGTH ul`, + LIST_INDUCT_TAC THEN REWRITE_TAC[REVERSE; LENGTH] THEN + ASM_REWRITE_TAC[LENGTH_APPEND; LENGTH] THEN + ARITH_TAC);; + + +let EL_REVERSE = prove(`!(ul:(A)list) i. i < LENGTH ul ==> EL i (REVERSE ul) = EL (LENGTH ul - 1 - i) ul`, + LIST_INDUCT_TAC THENL + [ + REWRITE_TAC[LENGTH] THEN ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[LENGTH; REVERSE; EL_APPEND; LENGTH_REVERSE] THEN + REPEAT STRIP_TAC THEN + COND_CASES_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `i:num`) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + SUBGOAL_THEN `SUC (LENGTH t) - 1 - i = SUC (LENGTH (t:(A)list) - 1 - i)` (fun th -> REWRITE_TAC[th]) THENL + [ + POP_ASSUM MP_TAC THEN + ARITH_TAC; + ALL_TAC + ] THEN + + REWRITE_TAC[EL; TL]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `LENGTH (t:(A)list) = i` (fun th -> REWRITE_TAC[th]) THENL + [ + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + ARITH_TAC; + ALL_TAC + ] THEN + + REWRITE_TAC[ARITH_RULE `i - i = 0`; ARITH_RULE `SUC i - 1 - i = 0`] THEN + REWRITE_TAC[EL; HD]);; + + + +let LENGTH_TABLE = prove(`!(f:num->A) n. LENGTH (TABLE f n) = n`, + GEN_TAC THEN INDUCT_TAC THEN REWRITE_TAC[TABLE; REVERSE_TABLE; REVERSE] THENL + [ + REWRITE_TAC[LENGTH]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[GSYM TABLE; LENGTH_APPEND; LENGTH] THEN + ARITH_TAC);; + + +let EL_TABLE = prove(`!(f:num->A) n i. i < n ==> EL i (TABLE f n) = f i`, + REPEAT GEN_TAC THEN SPEC_TAC (`n:num`, `n:num`) THEN + INDUCT_TAC THENL [ ARITH_TAC; ALL_TAC ] THEN + REWRITE_TAC[TABLE; REVERSE_TABLE; REVERSE; EL_APPEND] THEN + REWRITE_TAC[GSYM TABLE; LENGTH_TABLE] THEN + DISCH_TAC THEN COND_CASES_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + SUBGOAL_THEN `i = n:num` (fun th -> REWRITE_TAC[th]) THENL + [ + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[ARITH_RULE `n - n = 0`; EL; HD]);; + + + +let LENGTH_LEFT_ACTION_LIST = prove(`!(ul:(A)list) p. LENGTH (left_action_list p ul) = LENGTH ul`, + REWRITE_TAC[left_action_list; LENGTH_TABLE]);; + + + +let EL_LEFT_ACTION_LIST = prove(`!(ul:(A)list) p i. p permutes (0..LENGTH ul - 1) /\ i < LENGTH ul + ==> EL i ul = EL (p i) (left_action_list p ul)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[left_action_list] THEN + ABBREV_TAC `n = LENGTH (ul:(A)list)` THEN + SUBGOAL_THEN `(p:num->num) i < n` ASSUME_TAC THENL + [ + MP_TAC (ISPECL [`p:num->num`; `0..n - 1`] Hypermap_and_fan.PERMUTES_IMP_INSIDE) THEN + ASM_REWRITE_TAC[IN_NUMSEG] THEN + DISCH_THEN (MP_TAC o SPEC `i:num`) THEN + ASM_REWRITE_TAC[ARITH_RULE `0 <= i`] THEN + ASM_SIMP_TAC[ARITH_RULE `i < n ==> i <= n - 1`] THEN + UNDISCH_TAC `i < n:num` THEN + ARITH_TAC; + ALL_TAC + ] THEN + ASM_SIMP_TAC[EL_TABLE] THEN + AP_THM_TAC THEN AP_TERM_TAC THEN + MP_TAC (ISPECL [`p:num->num`; `0..n-1`] PERMUTES_INVERSES) THEN + ASM_REWRITE_TAC[] THEN + SIMP_TAC[]);; + + +let MEM_LEFT_ACTION_LIST = prove(`!(ul:(A)list) p x. p permutes (0..LENGTH ul - 1) + ==> (MEM x (left_action_list p ul) <=> MEM x ul)`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `n = LENGTH (ul:(A)list)` THEN + ASM_REWRITE_TAC[MEM_EXISTS_EL; LENGTH_LEFT_ACTION_LIST] THEN + EQ_TAC THENL + [ + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + ASM_SIMP_TAC[left_action_list; EL_TABLE] THEN + DISCH_TAC THEN + EXISTS_TAC `inverse (p:num->num) i` THEN + REWRITE_TAC[] THEN + MP_TAC (ISPECL [`p:num->num`; `0..n-1`] PERMUTES_INVERSE) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (ISPECL [`inverse (p:num->num)`; `0..n-1`] Hypermap_and_fan.PERMUTES_IMP_INSIDE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `i:num`) THEN + ASM_SIMP_TAC[IN_NUMSEG; ARITH_RULE `i < n ==> i <= n - 1`; LE_0] THEN + UNDISCH_TAC `i < n:num` THEN ARITH_TAC; + ALL_TAC + ] THEN + STRIP_TAC THEN + EXISTS_TAC `(p:num->num) i` THEN + MP_TAC (SPEC_ALL EL_LEFT_ACTION_LIST) THEN + ASM_SIMP_TAC[] THEN DISCH_TAC THEN + MP_TAC (ISPECL [`p:num->num`; `0..n-1`] Hypermap_and_fan.PERMUTES_IMP_INSIDE) THEN + ASM_REWRITE_TAC[IN_NUMSEG] THEN DISCH_THEN (MP_TAC o SPEC `i:num`) THEN + UNDISCH_TAC `i < n:num` THEN + ARITH_TAC);; + + +let SET_OF_LIST_LEFT_ACTION_LIST = prove(`!(ul:(A)list) p. p permutes 0..LENGTH ul - 1 + ==> set_of_list (left_action_list p ul) = set_of_list ul`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[EXTENSION; IN_SET_OF_LIST] THEN + ASM_SIMP_TAC[MEM_LEFT_ACTION_LIST]);; + + + +let CARD_SET_OF_LIST_EQ_LENGTH_IMP_ALL_DISTINCT = prove(`!ul:(A)list. CARD (set_of_list ul) = LENGTH ul + ==> (!i j. i < LENGTH ul /\ j < LENGTH ul /\ ~(i = j) ==> ~(EL i ul = EL j ul))`, + LIST_INDUCT_TAC THEN REWRITE_TAC[set_of_list; LENGTH; CARD_CLAUSES; ARITH_RULE `~(j < 0)`] THEN + SIMP_TAC[CARD_CLAUSES; FINITE_SET_OF_LIST] THEN + COND_CASES_TAC THENL + [ + MP_TAC (ISPEC `t:(A)list` CARD_SET_OF_LIST_LE) THEN + ARITH_TAC; + ALL_TAC + ] THEN + + REWRITE_TAC[ARITH_RULE `SUC n = SUC m <=> n = m`] THEN + DISCH_THEN (fun th -> FIRST_X_ASSUM (ASSUME_TAC o (fun th2 -> MATCH_MP th2 th))) THEN + REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN + + MP_TAC (SPEC `i:num` num_CASES) THEN STRIP_TAC THENL + [ + ASM_REWRITE_TAC[EL; HD] THEN + MP_TAC (SPEC `j:num` num_CASES) THEN STRIP_TAC THENL + [ + UNDISCH_TAC `~(i = j:num)` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[EL; TL] THEN + DISCH_TAC THEN UNDISCH_TAC `~(h:A IN set_of_list t)` THEN + ASM_REWRITE_TAC[IN_SET_OF_LIST] THEN + MATCH_MP_TAC (ISPECL [`t:(A)list`; `n:num`] MEM_EL) THEN + UNDISCH_TAC `j = SUC n` THEN UNDISCH_TAC `j < SUC (LENGTH (t:(A)list))` THEN + ARITH_TAC; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[EL; TL] THEN + MP_TAC (SPEC `j:num` num_CASES) THEN STRIP_TAC THENL + [ + ASM_REWRITE_TAC[EL; HD] THEN + DISCH_THEN (ASSUME_TAC o SYM) THEN UNDISCH_TAC `~(h:A IN set_of_list t)` THEN + ASM_REWRITE_TAC[IN_SET_OF_LIST] THEN + MATCH_MP_TAC (ISPECL [`t:(A)list`; `n:num`] MEM_EL) THEN + UNDISCH_TAC `i = SUC n` THEN UNDISCH_TAC `i < SUC (LENGTH (t:(A)list))` THEN + ARITH_TAC; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[EL; TL] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + REPLICATE_TAC 5 (POP_ASSUM MP_TAC) THEN + ARITH_TAC);; + + +let LENGTH_DROP = prove(`!i ul:(A)list. i < LENGTH ul ==> LENGTH (DROP ul i) = LENGTH ul - 1`, + INDUCT_TAC THENL + [ + GEN_TAC THEN + REWRITE_TAC[DROP] THEN DISCH_TAC THEN + MATCH_MP_TAC LENGTH_TL THEN + ASM_REWRITE_TAC[GSYM LENGTH_EQ_NIL] THEN POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN + REWRITE_TAC[DROP; LENGTH] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `TL ul:(A)list`) THEN + SUBGOAL_THEN `LENGTH (TL ul) = LENGTH (ul:(A)list) - 1` ASSUME_TAC THENL + [ + MATCH_MP_TAC LENGTH_TL THEN + ASM_REWRITE_TAC[GSYM LENGTH_EQ_NIL] THEN POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + + ANTS_TAC THENL + [ + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + ARITH_TAC);; + + + +let EL_DROP = prove(`!i j ul:(A)list. i < LENGTH ul /\ j < LENGTH ul - 1 ==> + EL j (DROP ul i) = if (j < i) then EL j ul else EL (j + 1) ul`, + INDUCT_TAC THEN INDUCT_TAC THEN REPEAT STRIP_TAC THEN REWRITE_TAC[DROP; EL; LT_REFL; ARITH_RULE `0 + 1 = SUC 0`] THENL + [ + REWRITE_TAC[ARITH_RULE `~(x < 0)`; ARITH_RULE `SUC j + 1 = SUC (SUC j)`; EL]; + REWRITE_TAC[ARITH_RULE `0 < SUC i`; HD]; + ALL_TAC + ] THEN + + REWRITE_TAC[ARITH_RULE `SUC j + 1 = SUC (SUC j)`; ARITH_RULE `SUC j < SUC i <=> j < i`; TL; EL] THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`j:num`; `TL ul:(A)list`]) THEN + SUBGOAL_THEN `LENGTH (TL ul:(A)list) = LENGTH ul - 1` ASSUME_TAC THENL + [ + MATCH_MP_TAC LENGTH_TL THEN + REWRITE_TAC[GSYM LENGTH_EQ_NIL] THEN POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[ARITH_RULE `j + 1 = SUC j`; EL] THEN + DISCH_THEN MATCH_MP_TAC THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + ARITH_TAC);; + + +let LIST_EL_EQ = prove(`!ul vl:(A)list. ul = vl <=> + (LENGTH ul = LENGTH vl /\ (!j. j < LENGTH ul ==> EL j ul = EL j vl))`, + REPEAT STRIP_TAC THEN + EQ_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + SPEC_TAC (`vl:(A)list`, `vl:(A)list`) THEN SPEC_TAC (`ul:(A)list`, `ul:(A)list`) THEN + LIST_INDUCT_TAC THEN LIST_INDUCT_TAC THEN SIMP_TAC[LENGTH_EQ_NIL; EQ_SYM_EQ; LENGTH; ARITH_RULE `~(0 = SUC a)`] THEN + REMOVE_ASSUM THEN + REWRITE_TAC[ARITH_RULE `SUC a = SUC b <=> a = b`] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `t':(A)list`) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL + [ + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `SUC j`) THEN + ASM_REWRITE_TAC[ARITH_RULE `SUC a < SUC b <=> a < b`; EL; TL]; + ALL_TAC + ] THEN + DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `0`) THEN + ASM_SIMP_TAC[ARITH_RULE `0 < SUC a`; EL; HD]);; + + +let LEFT_ACTION_LIST_I = prove(`!ul:(A)list. left_action_list I ul = ul`, + ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN + GEN_TAC THEN REWRITE_TAC[LIST_EL_EQ] THEN + ABBREV_TAC `k = LENGTH (ul:(A)list)` THEN + ASM_REWRITE_TAC[LENGTH_LEFT_ACTION_LIST] THEN + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[left_action_list; EL_TABLE; INVERSE_I; I_THM]);; + + + + +let SET_OF_LIST_DELETE_SUBSET_DROP = prove(`!j ul:(A)list. j < LENGTH ul ==> + set_of_list ul DELETE (EL j ul) SUBSET set_of_list (DROP ul j)`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `k = LENGTH (ul:(A)list)` THEN + ASM_REWRITE_TAC[SUBSET; IN_SET_OF_LIST; IN_DELETE; MEM_EXISTS_EL] THEN + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`j:num`; `ul:(A)list`] LENGTH_DROP) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ASM_CASES_TAC `i:num < j` THENL + [ + EXISTS_TAC `i:num` THEN + MP_TAC (ARITH_RULE `i < j /\ j < k ==> i < k - 1`) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (ISPECL [`j:num`; `i:num`; `ul:(A)list`] EL_DROP) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + EXISTS_TAC `i - 1` THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[NOT_LT; LE_LT] THEN + STRIP_TAC THENL + [ + MP_TAC (ARITH_RULE `j < k /\ i < k /\ j < i ==> i - 1 < k - 1`) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (ISPECL [`j:num`; `i - 1`; `ul:(A)list`] EL_DROP) THEN + ASM_SIMP_TAC[ARITH_RULE `j < i ==> ~(i - 1 < j)`] THEN + MP_TAC (ARITH_RULE `j < i ==> i - 1 + 1 = i`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + UNDISCH_TAC `x:A = EL i ul` THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]));; + + + + +let SET_OF_LIST_DELETE_EQ_DROP = prove(`!j ul:(A)list. CARD (set_of_list ul) = LENGTH ul /\ j < LENGTH ul + ==> set_of_list ul DELETE (EL j ul) = set_of_list (DROP ul j)`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC SUBSET_ANTISYM THEN + ASM_SIMP_TAC[SET_OF_LIST_DELETE_SUBSET_DROP] THEN + ABBREV_TAC `k = LENGTH (ul:(A)list)` THEN + MP_TAC (SPECL [`j:num`; `ul:(A)list`] LENGTH_DROP) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_REWRITE_TAC[SUBSET; IN_SET_OF_LIST; IN_DELETE; MEM_EXISTS_EL] THEN + GEN_TAC THEN STRIP_TAC THEN + POP_ASSUM (ASSUME_TAC o SYM) THEN + MP_TAC (SPECL [`j:num`; `i:num`; `ul:(A)list`] EL_DROP) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (ARITH_RULE `i < k - 1 ==> i < k`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + + MP_TAC (SPEC `ul:(A)list` CARD_SET_OF_LIST_EQ_LENGTH_IMP_ALL_DISTINCT) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + + COND_CASES_TAC THENL + [ + DISCH_TAC THEN + CONJ_TAC THENL + [ + EXISTS_TAC `i:num` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_SIMP_TAC[ARITH_RULE `i < j ==> ~(i = j:num)`]; + ALL_TAC + ] THEN + + DISCH_TAC THEN + CONJ_TAC THENL + [ + EXISTS_TAC `i + 1` THEN + ASM_SIMP_TAC[ARITH_RULE `i < k - 1 ==> i + 1 < k`]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_SIMP_TAC[ARITH_RULE `i < k - 1 ==> i + 1 < k`] THEN + UNDISCH_TAC `~(i < j:num)` THEN ARITH_TAC);; + + + + + +(**********************************************************) + +(*****************************************) +(* Properties of barV *) +(*****************************************) + +(* barV(k) SUBSET V *) +let BARV_SUBSET = prove(`!V k ul. barV V k ul ==> set_of_list ul SUBSET V`, + REPEAT GEN_TAC THEN + REWRITE_TAC[BARV; VORONOI_NONDG; INITIAL_SUBLIST] THEN + STRIP_TAC THEN + POP_ASSUM (MP_TAC o SPEC `ul:(real^3)list`) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[ARITH_RULE `0 < k + 1`] THEN + EXISTS_TAC `[]:(real^3)list` THEN + REWRITE_TAC[APPEND_NIL]; + SIMP_TAC[] + ]);; + + + +(* barV(k) = (h:t) for some h, t *) +let BARV_CONS = prove(`!V k ul. barV V k ul ==> ?h t. ul = CONS h t /\ h = HD ul`, + REPEAT GEN_TAC THEN + REWRITE_TAC[BARV] THEN + DISCH_THEN (MP_TAC o CONJUNCT1) THEN + REWRITE_TAC[GSYM ADD1; LENGTH_EQ_CONS] THEN + ASM_MESON_TAC[HD]);; + + + +(* An initial sublist of barV(k) is barV(length - 1) *) +let BARV_INITIAL_SUBLIST = prove(`!V k ul vl. barV V k ul /\ initial_sublist vl ul /\ 0 < LENGTH vl ==> barV V ((LENGTH vl) - 1) vl`, + REWRITE_TAC[BARV] THEN + REPEAT STRIP_TAC THENL + [ + ASM_SIMP_TAC[ARITH_RULE `0 < a ==> a - 1 + 1 = a`]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`vl':(real^3)list`; `vl:(real^3)list`; `ul:(real^3)list`] INITIAL_SUBLIST_TRANS) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `vl':(real^3)list`) THEN + ASM_SIMP_TAC[]);; + + +(* barV V 0 [v] (if v IN V) *) +let BARV_0 = prove(`!V v. packing V /\ v IN V ==> barV V 0 [v]`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[BARV; VORONOI_NONDG; LENGTH; ARITH] THEN + REWRITE_TAC[INITIAL_SUBLIST_SING] THEN + GEN_TAC THEN + STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[LENGTH; ARITH] THEN + ASM_SIMP_TAC[set_of_list; SUBSET; IN_SING] THEN + ASM_REWRITE_TAC[VORONOI_LIST; set_of_list; VORONOI_SET; IN_SING; SING_GSPEC_APP; INTERS_1] THEN + ASM_SIMP_TAC[AFF_DIM_VORONOI_CLOSED] THEN + INT_ARITH_TAC);; + + +(* ul IN barV V k ==> k <= 3 *) +let BARV_IMP_K_LE_3 = prove(`!V ul k. barV V k ul ==> k <= 3`, + REWRITE_TAC[BARV; VORONOI_NONDG] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `ul:(real^3)list`) THEN + ASM_REWRITE_TAC[INITIAL_SUBLIST_REFL; ARITH_RULE `0 < k + 1`] THEN + ARITH_TAC);; + + +(* ul IN barV V k ul ==> HD ul IN set_of_list ul *) +let BARV_IMP_HD_IN_SET_OF_LIST = prove(`!V k ul. barV V k ul ==> HD ul IN set_of_list ul`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC HD_IN_SET_OF_LIST THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[BARV] THEN + ARITH_TAC);; + + + + +(* Lemma for truncate_simplex operation *) +let TRUNCATE_SIMPLEX_INITIAL_SUBLIST = prove(`!k xl (zl:(A)list). truncate_simplex k zl = xl /\ k + 1 <= LENGTH zl <=> initial_sublist xl zl /\ LENGTH xl = k + 1`, + REPEAT GEN_TAC THEN EQ_TAC THENL + [ + REWRITE_TAC[TRUNCATE_SIMPLEX] THEN + STRIP_TAC THEN + POP_ASSUM (MP_TAC o (fun th -> MATCH_MP INITIAL_SUBLIST_EXISTS th)) THEN + ASM_MESON_TAC[]; + STRIP_TAC THEN + MP_TAC (ISPECL [`xl:(A)list`; `zl:(A)list`] INITIAL_SUBLIST_LENGTH_LE) THEN + ASM_SIMP_TAC[] THEN + DISCH_TAC THEN + REWRITE_TAC[TRUNCATE_SIMPLEX] THEN + ASM_MESON_TAC[INITIAL_SUBLIST_UNIQUE] + ]);; + + + +let TRUNCATE_SIMPLEX_BARV = prove(`!V r k zl. barV V k zl /\ r <= k ==> barV V r (truncate_simplex r zl)`, + REPEAT STRIP_TAC THEN + SUBGOAL_TAC "A" `LENGTH (zl:(real^3)list) = k + 1` [ ASM_MESON_TAC[BARV] ] THEN + ABBREV_TAC `xl:(real^3)list = truncate_simplex r zl` THEN + SUBGOAL_THEN `initial_sublist xl (zl:(real^3)list) /\ LENGTH xl = r + 1` STRIP_ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM TRUNCATE_SIMPLEX_INITIAL_SUBLIST] THEN + ASM_SIMP_TAC[ARITH_RULE `r <= k ==> r + 1 <= k + 1`]; + ALL_TAC + ] THEN + MP_TAC (ISPECL [`V:real^3->bool`; `k:num`; `zl:(real^3)list`; `xl:(real^3)list`] BARV_INITIAL_SUBLIST) THEN + ASM_SIMP_TAC[ARITH_RULE `0 < r + 1`; ARITH_RULE `(r + 1) - 1 = r`]);; + + + +let TRUNCATE_SIMPLEX_REFL = prove(`!k ul:(A)list. LENGTH ul = k + 1 ==> truncate_simplex k ul = ul`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`k:num`; `ul:(A)list`; `ul:(A)list`] TRUNCATE_SIMPLEX_INITIAL_SUBLIST) THEN + ASM_REWRITE_TAC[LE_REFL; INITIAL_SUBLIST_REFL]);; + + + +let TRUNCATE_0_EQ_HEAD = prove(`!ul:(A)list. 1 <= LENGTH ul ==> truncate_simplex 0 ul = [HD ul]`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`0`; `[HD ul]:(A)list`; `ul:(A)list`] TRUNCATE_SIMPLEX_INITIAL_SUBLIST) THEN + ASM_REWRITE_TAC[ARITH] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ASM_SIMP_TAC[INITIAL_SUBLIST_HD; LENGTH; ARITH]);; + + +let LENGTH_TRUNCATE_SIMPLEX = prove(`!k ul:(A)list. k + 1 <= LENGTH ul ==> LENGTH (truncate_simplex k ul) = k + 1`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`k:num`; `truncate_simplex k ul:(A)list`; `ul:(A)list`] TRUNCATE_SIMPLEX_INITIAL_SUBLIST) THEN + ASM_SIMP_TAC[]);; + + + +let TRUNCATE_SIMPLEX_EQ_BUTLAST = prove(`!ul:(A)list. 2 <= LENGTH ul ==> truncate_simplex (LENGTH ul - 2) ul = BUTLAST ul`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`LENGTH (ul:(A)list) - 2`; `BUTLAST (ul:(A)list)`; `ul:(A)list`] TRUNCATE_SIMPLEX_INITIAL_SUBLIST) THEN + ASM_SIMP_TAC[ARITH_RULE `2 <= a ==> a - 2 + 1 = a - 1 /\ a - 1 <= a`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ASM_SIMP_TAC[ARITH_RULE `2 <= a ==> 1 <= a`; BUTLAST_INITIAL_SUBLIST; LENGTH_BUTLAST]);; + + +let HD_TRUNCATE_SIMPLEX = prove(`!(ul:(A)list) j. j + 1 <= LENGTH ul ==> HD (truncate_simplex j ul) = HD ul`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`j:num`; `truncate_simplex j (ul:(A)list)`; `ul:(A)list`] TRUNCATE_SIMPLEX_INITIAL_SUBLIST) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + MATCH_MP_TAC HD_INITIAL_SUBLIST THEN + ASM_REWRITE_TAC[ARITH_RULE `1 <= j + 1`]);; + + +let TRUNCATE_TRUNCATE_SIMPLEX = prove(`!(ul:(A)list) i j. i <= j /\ j + 1 <= LENGTH ul ==> + truncate_simplex i (truncate_simplex j ul) = truncate_simplex i ul`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `xl = truncate_simplex j (ul:(A)list)` THEN + SUBGOAL_THEN `i + 1 <= LENGTH (xl:(A)list) /\ i + 1 <= LENGTH (ul:(A)list) /\ initial_sublist (xl:(A)list) ul` STRIP_ASSUME_TAC THENL + [ + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + MP_TAC (SPECL [`j:num`; `truncate_simplex j (ul:(A)list)`; `ul:(A)list`] TRUNCATE_SIMPLEX_INITIAL_SUBLIST) THEN + ASM_SIMP_TAC[] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + ARITH_TAC; + ALL_TAC + ] THEN + MP_TAC (SPECL [`i:num`; `truncate_simplex i (xl:(A)list)`; `xl:(A)list`] TRUNCATE_SIMPLEX_INITIAL_SUBLIST) THEN + MP_TAC (SPECL [`i:num`; `truncate_simplex i (ul:(A)list)`; `ul:(A)list`] TRUNCATE_SIMPLEX_INITIAL_SUBLIST) THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC INITIAL_SUBLIST_UNIQUE THEN + MAP_EVERY EXISTS_TAC [`i + 1`; `ul:(A)list`] THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC INITIAL_SUBLIST_TRANS THEN + EXISTS_TAC `xl:(A)list` THEN + ASM_REWRITE_TAC[]);; + + +let INITIAL_SUBLIST_IMP_TRUNCATE_SIMPLEX = prove(`!xl yl:(A)list. initial_sublist yl xl /\ 1 <= LENGTH yl ==> + yl = truncate_simplex (LENGTH yl - 1) xl /\ LENGTH yl <= LENGTH xl`, + REPEAT STRIP_TAC THENL + [ + MP_TAC (SPECL [`LENGTH (yl:(A)list) - 1`; `yl:(A)list`; `xl:(A)list`] TRUNCATE_SIMPLEX_INITIAL_SUBLIST) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + SUBGOAL_THEN `LENGTH yl = LENGTH (yl:(A)list) - 1 + 1` MP_TAC THENL + [ + UNDISCH_TAC `1 <= LENGTH (yl:(A)list)` THEN ARITH_TAC; + ALL_TAC + ] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[INITIAL_SUBLIST_LENGTH_LE]);; + + +let LIST_EQ_TRUNCATE_SIMPLEX_APPEND_LAST = prove(`!ul:(A)list. 2 <= LENGTH ul ==> + ul = APPEND (truncate_simplex (LENGTH ul - 2) ul) [LAST ul]`, + ASM_SIMP_TAC[TRUNCATE_SIMPLEX_EQ_BUTLAST] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC (GSYM APPEND_BUTLAST_LAST) THEN + REWRITE_TAC[EQ_SYM_EQ; GSYM LENGTH_EQ_NIL] THEN + POP_ASSUM MP_TAC THEN ARITH_TAC);; + + +let TRUNCATE_SIMPLEX_ADD1 = prove(`!(ul:(A)list) k. k + 2 <= LENGTH ul ==> + truncate_simplex (k + 1) ul = APPEND (truncate_simplex k ul) [LAST (truncate_simplex (k + 1) ul)]`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `xl:(A)list = truncate_simplex (k + 1) ul` THEN + SUBGOAL_THEN `truncate_simplex k ul = truncate_simplex k xl:(A)list` (fun th -> REWRITE_TAC[th]) THENL + [ + EXPAND_TAC "xl" THEN + MATCH_MP_TAC (GSYM TRUNCATE_TRUNCATE_SIMPLEX) THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + SUBGOAL_THEN `LENGTH (xl:(A)list) = k + 2` ASSUME_TAC THENL + [ + EXPAND_TAC "xl" THEN + REWRITE_TAC[ARITH_RULE `k + 2 = (k + 1) + 1`] THEN + MATCH_MP_TAC LENGTH_TRUNCATE_SIMPLEX THEN + ASM_REWRITE_TAC[ARITH_RULE `(k + 1) + 1 = k + 2`]; + ALL_TAC + ] THEN + SUBGOAL_THEN `k = LENGTH (xl:(A)list) - 2` (fun th -> REWRITE_TAC[th]) THENL + [ + POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC LIST_EQ_TRUNCATE_SIMPLEX_APPEND_LAST THEN + POP_ASSUM MP_TAC THEN ARITH_TAC);; + + + +let EL_TRUNCATE_SIMPLEX = prove(`!ul:(A)list k j. k + 1 <= LENGTH ul /\ j <= k ==> EL j (truncate_simplex k ul) = EL j ul`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `vl:(A)list = truncate_simplex k ul` THEN + SUBGOAL_THEN `?yl:(A)list. ul = APPEND vl yl /\ LENGTH vl = k + 1` CHOOSE_TAC THENL + [ + MP_TAC (SPECL [`k:num`; `vl:(A)list`; `ul:(A)list`] TRUNCATE_SIMPLEX_INITIAL_SUBLIST) THEN + ASM_REWRITE_TAC[INITIAL_SUBLIST] THEN + STRIP_TAC THEN + EXISTS_TAC `yl:(A)list` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[EL_APPEND; ARITH_RULE `j < k + 1 <=> j <= k`]);; + + + +let TRUNCATE_SIMPLEX_ADD1_ALT = prove(`!ul:(A)list k. k + 2 <= LENGTH ul + ==> truncate_simplex (k + 1) ul = APPEND (truncate_simplex k ul) [EL (k + 1) ul]`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL TRUNCATE_SIMPLEX_ADD1) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th]) THEN + AP_TERM_TAC THEN + + MP_TAC (SPECL [`k + 1`; `ul:(A)list`] LENGTH_TRUNCATE_SIMPLEX) THEN + ASM_SIMP_TAC[ARITH_RULE `k + 2 <= a ==> (k + 1) + 1 <= a`] THEN + DISCH_TAC THEN + + MP_TAC (ISPEC `(truncate_simplex (k + 1) ul:(A)list)` LAST_EL) THEN + ASM_REWRITE_TAC[GSYM LENGTH_EQ_NIL; ARITH_RULE `~(a + 1 = 0)`; ARITH_RULE `(a + 1) - 1 = a`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MP_TAC (SPECL [`ul:(A)list`; `k + 1`; `k + 1`] EL_TRUNCATE_SIMPLEX) THEN + ASM_SIMP_TAC[ARITH_RULE `k + 2 <= a ==> (k + 1) + 1 <= a`; LE_REFL]);; + + + +(****************************************************) + +(***************************************************************************) +(* Properties of voronoi_set (Omega(V, W)) and voronoi_list (Omega(V, vl)) *) +(***************************************************************************) + + +(* Equivalent definitions for intersections of one and two Voronoi cells *) +let VORONOI_SET_SING = prove(`!V (u:real^3). voronoi_set V {u} = voronoi_closed V u`, + REWRITE_TAC[VORONOI_SET; IN_SING; EXTENSION; IN_INTERS; IN_ELIM_THM] THEN + MESON_TAC[]);; + + +let VORONOI_LIST_SING = prove(`!V (u:real^3). voronoi_list V [u] = voronoi_closed V u`, + REWRITE_TAC[VORONOI_LIST; set_of_list; VORONOI_SET_SING]);; + + +(* Omega(V, v) INTER Omega(V, u) *) +let VORONOI_SET_2 = prove(`!V (u:real^3) v. voronoi_set V {u, v} = voronoi_closed V v INTER voronoi_closed V u`, + REWRITE_TAC[VORONOI_SET; INTERS_2_LEMMA; INTER_COMM]);; + + +(* Omega(V, v) INTER A(u, v) *) +let VORONOI_SET_2_BIS = prove(`!V (u:real^3) v. u IN V /\ v IN V ==> voronoi_set V {u, v} = voronoi_closed V v INTER bis u v`, + REWRITE_TAC[IN] THEN REPEAT STRIP_TAC THEN + REWRITE_TAC[VORONOI_SET_2; bis; voronoi_closed; EXTENSION; IN_INTER; IN_ELIM_THM] THEN + REPEAT GEN_TAC THEN EQ_TAC THEN SIMP_TAC[] THEN + ASM_MESON_TAC[REAL_ARITH `a <= b /\ b <= a ==> a = b`]);; + + +(* Omega(V, v) INTER A+(u, v) *) +let VORONOI_SET_2_BIS_LE = prove(`!V (u:real^3) v. u IN V /\ v IN V ==> voronoi_set V {u, v} = voronoi_closed V v INTER bis_le u v`, + REWRITE_TAC[IN] THEN REPEAT STRIP_TAC THEN + REWRITE_TAC[VORONOI_SET_2; bis_le; voronoi_closed; EXTENSION; IN_INTER; IN_ELIM_THM] THEN + REPEAT GEN_TAC THEN EQ_TAC THEN SIMP_TAC[] THEN + ASM_MESON_TAC[REAL_LE_TRANS]);; + + +(* The result for lists of arbitrary length *) +let VORONOI_LIST_BIS = prove(`!V ul (h:real^3) t. set_of_list ul SUBSET V /\ ul = CONS h t ==> voronoi_list V ul = voronoi_closed V h INTER (INTERS {bis h u | u | u IN set_of_list t})`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `V (h:real^3) /\ (!u. u IN set_of_list t ==> V u)` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + DISCH_THEN (LABEL_TAC "A") THEN DISCH_TAC THEN + REMOVE_THEN "A" MP_TAC THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[set_of_list] THEN + SET_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[VORONOI_LIST; VORONOI_SET; bis; EXTENSION; IN_INTER; IN_INTERS; IN_ELIM_THM] THEN + X_GEN_TAC `y:real^3` THEN EQ_TAC THEN REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `voronoi_closed V (h:real^3)`) THEN + ASM_REWRITE_TAC[set_of_list] THEN + ANTS_TAC THEN REWRITE_TAC[] THEN + EXISTS_TAC `h:real^3` THEN + REWRITE_TAC[COMPONENT]; + + ASM_REWRITE_TAC[] THEN POP_ASSUM (fun th -> ALL_TAC) THEN + SUBGOAL_THEN `y:real^3 IN voronoi_closed V h` ASSUME_TAC THENL + [ + POP_ASSUM (fun th -> ALL_TAC) THEN + POP_ASSUM (MP_TAC o SPEC `voronoi_closed V (h:real^3)`) THEN + ANTS_TAC THEN REWRITE_TAC[] THEN + EXISTS_TAC `h:real^3` THEN + ASM_REWRITE_TAC[set_of_list; COMPONENT]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `y:real^3 IN voronoi_closed V u` ASSUME_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `voronoi_closed V (u:real^3)` o check (is_forall o concl)) THEN + ANTS_TAC THEN REWRITE_TAC[] THEN + EXISTS_TAC `u:real^3` THEN + ASM_REWRITE_TAC[set_of_list; IN_INSERT]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[voronoi_closed; IN_ELIM_THM] THEN + DISCH_THEN (ASSUME_TAC o SPEC `u:real^3`) THEN + DISCH_THEN (ASSUME_TAC o SPEC `h:real^3`) THEN + ASM_MESON_TAC[REAL_ARITH `a <= b /\ b <= a ==> a = b`]; + + + ASM_REWRITE_TAC[voronoi_closed; IN_ELIM_THM] THEN GEN_TAC THEN + POP_ASSUM (fun th -> ALL_TAC) THEN + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[set_of_list; IN_INSERT] THEN + POP_ASSUM (MP_TAC o SPEC `bis h (v:real^3)`) THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[bis; voronoi_closed; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THENL + [ + ASM_MESON_TAC[]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) THEN + ANTS_TAC THENL + [ + EXISTS_TAC `v:real^3` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ASM_MESON_TAC[] + ]);; + + + + +(* Used below *) +let VORONOI_INTER_BIS_EQ_INTER_BIS_LE = prove(`!V v u. v IN V /\ u IN V ==> voronoi_closed V v INTER bis u v = voronoi_closed V v INTER bis_le u v`, + REWRITE_TAC[voronoi_closed; bis; bis_le; IN] THEN + REPEAT STRIP_TAC THEN + REWRITE_TAC[EXTENSION; IN_INTER; IN_ELIM_THM] THEN + ASM_MESON_TAC[REAL_EQ_IMP_LE; REAL_LE_ANTISYM]);; + + + +let LIST_SUBSET = prove(`!V ul (h:A) t. ((set_of_list ul) SUBSET V /\ ul = CONS h t) ==> h IN V /\ (!u. u IN set_of_list t ==> u IN V)`, + REPEAT GEN_TAC THEN + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + DISCH_THEN (LABEL_TAC "A") THEN + DISCH_TAC THEN REMOVE_THEN "A" MP_TAC THEN + ASM_REWRITE_TAC[set_of_list; INSERT_SUBSET] THEN + SET_TAC[]);; + + + +(* Omega(V,h:t) = Omega(V,h) INTER INTERS {A+(u, h) | u IN t} *) +let VORONOI_LIST_BIS_LE = prove(`!V ul (h:real^3) t. set_of_list ul SUBSET V /\ ul = CONS h t ==> voronoi_list V ul = voronoi_closed V h INTER (INTERS {bis_le u h| u | u IN set_of_list t})`, + REPEAT GEN_TAC THEN + DISCH_TAC THEN + MP_TAC (ISPECL [`V:real^3->bool`; `ul:(real^3)list`; `h:real^3`; `t:(real^3)list`] LIST_SUBSET) THEN + FIRST_ASSUM ((fun th -> REWRITE_TAC[th]) o (fun th -> MATCH_MP VORONOI_LIST_BIS th)) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + DISJ_CASES_TAC (TAUT `set_of_list (t:(real^3)list) = {} \/ ~(set_of_list t = {})`) THENL + [ + ASM_REWRITE_TAC[NOT_IN_EMPTY] THEN SET_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[INTER_INTERS] THEN + REWRITE_TAC[EXTENSION; IN_INTERS; IN_ELIM_THM] THEN + ASM_MESON_TAC[BIS_SYM; VORONOI_INTER_BIS_EQ_INTER_BIS_LE]);; + + + + +(* Voronoi list is bounded *) +let BOUNDED_VORONOI_LIST = prove(`!V k ul. saturated V /\ barV V k ul ==> bounded (voronoi_list V ul)`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM (MP_TAC o (fun th -> MATCH_MP BARV_SUBSET th)) THEN + FIRST_X_ASSUM (MP_TAC o (fun th -> MATCH_MP BARV_CONS th)) THEN + STRIP_TAC THEN POP_ASSUM (fun th -> ALL_TAC) THEN + DISCH_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `h:real^3`; `t:(real^3)list`] VORONOI_LIST_BIS_LE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MATCH_MP_TAC BOUNDED_INTER THEN + DISJ1_TAC THEN + ASM_SIMP_TAC[BOUNDED_VORONOI_CLOSED]);; + + + +(* Omega(V, h:t) INTER A(h, v) = Omega(V, (h:t) ++ [v]) *) +let VORONOI_LIST_INTER_BIS = prove(`!V ul v h t. set_of_list ul SUBSET V /\ v IN V /\ ul = CONS h t ==> + (voronoi_list V ul) INTER (bis h v) = voronoi_list V (APPEND ul [v])`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `h:real^3`; `t:(real^3)list`] VORONOI_LIST_BIS) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[APPEND] THEN + MP_TAC (SPECL [`V:real^3->bool`; `CONS (h:real^3) (APPEND t [v])`; `h:real^3`; `APPEND t [v:real^3]`] VORONOI_LIST_BIS) THEN + SUBGOAL_THEN `set_of_list (CONS (h:real^3) (APPEND t [v])) SUBSET V` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[GSYM APPEND] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[SUBSET; IN_SET_OF_LIST; MEM_APPEND; MEM] THEN + REPEAT STRIP_TAC THENL + [ + ASM_MESON_TAC[SUBSET; IN_SET_OF_LIST]; + ASM_MESON_TAC[] + ]; + + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[IN_SET_OF_LIST; MEM_APPEND; MEM] THEN + SET_TAC[]);; + + + +(* Canonical representations of Omega(V, vl) as a polyhedron *) + + +let SUPSET_INTER = prove(`!s t u. s SUBSET t /\ s = u ==> s = t INTER u`, SET_TAC[]);; + + +let INTER_AFFINE_HULL = prove(`!(s:real^N->bool). s = affine hull s INTER s`, + GEN_TAC THEN MATCH_MP_TAC SUPSET_INTER THEN + MESON_TAC[CLOSURE_SUBSET; CLOSURE_SUBSET_AFFINE_HULL; SUBSET_TRANS]);; + + + +(* "Almost canonical" polyhedron representation for Omega(V, ul) *) + +let VORONOI_LIST_ALMOST_CANONICAL_0 = prove(`!V ul (h:real^3) t. packing V /\ saturated V /\ set_of_list ul SUBSET V /\ ul = CONS h t + ==> ?K. FINITE K /\ voronoi_list V ul = INTERS K /\ + (!a. a IN K ==> (?v. v IN V /\ (a = bis_le v h \/ a = bis_le h v)))`, + REPEAT GEN_TAC THEN + DISCH_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `h:real^3`; `t:(real^3)list`] VORONOI_LIST_BIS_LE) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MP_TAC (ISPECL [`V:real^3->bool`; `ul:(real^3)list`; `h:real^3`; `t:(real^3)list`] LIST_SUBSET) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `h:real^3`] VORONOI_CLOSED_EQ_FINITE_INTERS_BIS_LE) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + EXISTS_TAC `{bis_le h u | u IN (W:real^3->bool)} UNION {bis_le u (h:real^3) | u IN set_of_list t}` THEN + REPEAT STRIP_TAC THENL + [ + REWRITE_TAC[FINITE_UNION] THEN + REWRITE_TAC[GSYM IMAGE_LEMMA] THEN + CONJ_TAC THEN MATCH_MP_TAC FINITE_IMAGE THEN ASM_REWRITE_TAC[FINITE_SET_OF_LIST]; + + REWRITE_TAC[INTERS_INTER_INTERS]; + + ASM SET_TAC[] + ]);; + + + +let VORONOI_LIST_ALMOST_CANONICAL = prove(`!V ul (h:real^3) t. packing V /\ saturated V /\ set_of_list ul SUBSET V /\ ul = CONS h t + ==> ?K. FINITE K /\ voronoi_list V ul = affine hull (voronoi_list V ul) INTER INTERS K /\ + (!a. a IN K ==> (?v. v IN V /\ ~(v = h) /\ (a = bis_le v h \/ a = bis_le h v)))`, + REPEAT GEN_TAC THEN + DISCH_THEN (MP_TAC o (fun th -> MATCH_MP VORONOI_LIST_ALMOST_CANONICAL_0 th)) THEN + STRIP_TAC THEN + EXISTS_TAC `K DELETE (:real^3)` THEN + ASM_REWRITE_TAC[FINITE_DELETE; GSYM INTERS_UNIV; IN_DELETE] THEN + REWRITE_TAC[INTER_AFFINE_HULL] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `a:real^3->bool`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (CHOOSE_THEN ASSUME_TAC) THEN + EXISTS_TAC `v:real^3` THEN ASM_REWRITE_TAC[] THEN + DISJ_CASES_TAC (TAUT `~(v:real^3 = h) \/ (v = h)`) THEN ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o check (is_conj o concl)) THEN + ASM_REWRITE_TAC[bis_le; REAL_LE_REFL] THEN + ASM SET_TAC[]);; + + + + + +(* For a canonical polyhedron representation we need to find a minimal intersection *) +let lemma1 = prove(`!f P. FINITE f /\ P f ==> (?n g. g SUBSET f /\ g HAS_SIZE n /\ P g)`, MESON_TAC[FINITE_HAS_SIZE; SUBSET_REFL]);; + +(* Lemma about minimal intersection *) +(* The proof is a modification of the proof of POLYHEDRON_INTER_AFFINE_MINIMAL *) +let MINIMAL_INTERS_EXISTS = prove(`!(s:A->bool) f. FINITE f /\ s = INTERS f ==> (?g. g SUBSET f /\ s = INTERS g /\ (!g'. g' PSUBSET g ==> s PSUBSET INTERS g'))`, + REPEAT GEN_TAC THEN + DISCH_THEN (MP_TAC o (fun th -> MATCH_MP lemma1 th)) THEN + GEN_REWRITE_TAC LAND_CONV [num_WOP] THEN + DISCH_THEN(X_CHOOSE_THEN `n:num` (CONJUNCTS_THEN2 MP_TAC ASSUME_TAC)) THEN + MATCH_MP_TAC MONO_EXISTS THEN + SIMP_TAC[HAS_SIZE; GSYM CONJ_ASSOC] THEN + X_GEN_TAC `g:(A->bool)->bool` THEN STRIP_TAC THEN + X_GEN_TAC `g':(A->bool)->bool` THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `CARD(g':(A->bool)->bool)`) THEN + ANTS_TAC THENL [ASM_MESON_TAC[CARD_PSUBSET]; ALL_TAC] THEN + REWRITE_TAC[NOT_EXISTS_THM; HAS_SIZE] THEN + DISCH_THEN(MP_TAC o SPEC `g':(A->bool)->bool`) THEN + MATCH_MP_TAC(TAUT `a /\ b /\ (~c ==> d) ==> ~(a /\ b /\ c) ==> d`) THEN + CONJ_TAC THENL [ASM_MESON_TAC[PSUBSET; SUBSET_TRANS]; ALL_TAC] THEN + CONJ_TAC THENL [ASM_MESON_TAC[PSUBSET; FINITE_SUBSET]; ALL_TAC] THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC(SET_RULE `s SUBSET t ==> ~(s = t) ==> s PSUBSET t`) THEN + FIRST_X_ASSUM MP_TAC THEN + SET_TAC[]);; + + + +(* Variation of the previous lemma: the proof is exactly the same *) +let MINIMAL_INTER_INTERS_EXISTS = prove(`!(s:A->bool) t f. FINITE f /\ s = t INTER INTERS f ==> (?g. g SUBSET f /\ s = t INTER INTERS g /\ (!g'. g' PSUBSET g ==> s PSUBSET t INTER INTERS g'))`, + REPEAT GEN_TAC THEN + DISCH_THEN (MP_TAC o (fun th -> MATCH_MP lemma1 th)) THEN + GEN_REWRITE_TAC LAND_CONV [num_WOP] THEN + DISCH_THEN(X_CHOOSE_THEN `n:num` (CONJUNCTS_THEN2 MP_TAC ASSUME_TAC)) THEN + MATCH_MP_TAC MONO_EXISTS THEN + SIMP_TAC[HAS_SIZE; GSYM CONJ_ASSOC] THEN + X_GEN_TAC `g:(A->bool)->bool` THEN STRIP_TAC THEN + X_GEN_TAC `g':(A->bool)->bool` THEN DISCH_TAC THEN + FIRST_X_ASSUM(MP_TAC o SPEC `CARD(g':(A->bool)->bool)`) THEN + ANTS_TAC THENL [ASM_MESON_TAC[CARD_PSUBSET]; ALL_TAC] THEN + REWRITE_TAC[NOT_EXISTS_THM; HAS_SIZE] THEN + DISCH_THEN(MP_TAC o SPEC `g':(A->bool)->bool`) THEN + MATCH_MP_TAC(TAUT `a /\ b /\ (~c ==> d) ==> ~(a /\ b /\ c) ==> d`) THEN + CONJ_TAC THENL [ASM_MESON_TAC[PSUBSET; SUBSET_TRANS]; ALL_TAC] THEN + CONJ_TAC THENL [ASM_MESON_TAC[PSUBSET; FINITE_SUBSET]; ALL_TAC] THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC(SET_RULE `s SUBSET t ==> ~(s = t) ==> s PSUBSET t`) THEN + FIRST_X_ASSUM MP_TAC THEN + SET_TAC[]);; + + + + +(* Canonical polyhedron representation for Omega(V, ul) *) +let VORONOI_LIST_CANONICAL = prove(`!V ul (h:real^3) t. packing V /\ saturated V /\ set_of_list ul SUBSET V /\ ul = CONS h t + ==> ?K. FINITE K /\ voronoi_list V ul = affine hull (voronoi_list V ul) INTER INTERS K /\ + (!a. a IN K ==> (?v. v IN V /\ ~(v = h) /\ (a = bis_le v h \/ a = bis_le h v))) /\ + (!K'. K' PSUBSET K ==> voronoi_list V ul PSUBSET affine hull (voronoi_list V ul) INTER INTERS K')`, + REPEAT GEN_TAC THEN + DISCH_THEN (MP_TAC o (fun th -> MATCH_MP VORONOI_LIST_ALMOST_CANONICAL th)) THEN + STRIP_TAC THEN + + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN + DISCH_THEN (LABEL_TAC "A") THEN + DISCH_THEN (LABEL_TAC "B") THEN + DISCH_THEN (LABEL_TAC "C") THEN + + MP_TAC (ISPECL [`voronoi_list (V:real^3->bool) ul`; `affine hull (voronoi_list (V:real^3->bool) ul)`; `K:(real^3->bool)->bool`] MINIMAL_INTER_INTERS_EXISTS) THEN + + USE_THEN "A" (fun th -> REWRITE_TAC[th]) THEN + ANTS_TAC THENL + [ + ASM_MESON_TAC[]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + EXISTS_TAC `g:(real^3->bool)->bool` THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THENL + [ + ASM_MESON_TAC[FINITE_SUBSET]; + ASM_MESON_TAC[]; + POP_ASSUM MP_TAC THEN + REPLICATE_TAC 2 (POP_ASSUM (fun th -> ALL_TAC)) THEN + REPLICATE_TAC 2 (POP_ASSUM MP_TAC) THEN + REWRITE_TAC[SUBSET] THEN MESON_TAC[] + ]);; + + +(* voronoi_list is a polyhedron *) +let POLYHEDRON_VORONOI_LIST = prove(`!V ul. packing V /\ saturated V /\ set_of_list ul SUBSET V + ==> polyhedron (voronoi_list V ul)`, + REPEAT STRIP_TAC THEN + DISJ_CASES_TAC (ISPEC `ul:(real^3)list` list_CASES) THENL + [ + ASM_REWRITE_TAC[VORONOI_LIST; set_of_list; VORONOI_SET; NOT_IN_EMPTY] THEN + SUBGOAL_THEN `{voronoi_closed V (v:real^3) | v | F} = {}` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[EXTENSION; NOT_IN_EMPTY; IN_ELIM_THM]; + ALL_TAC + ] THEN + REWRITE_TAC[INTERS_0; POLYHEDRON_UNIV]; + ALL_TAC + ] THEN + + POP_ASSUM STRIP_ASSUME_TAC THEN + ASM_SIMP_TAC[VORONOI_LIST_BIS] THEN + + MATCH_MP_TAC POLYHEDRON_INTER THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC VORONOI_POLYHEDRON THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC IN_TRANS THEN + EXISTS_TAC `set_of_list ul:real^3->bool` THEN + ASM_REWRITE_TAC[IN_SET_OF_LIST; MEM]; + ALL_TAC + ] THEN + + MATCH_MP_TAC POLYHEDRON_INTERS THEN + CONJ_TAC THENL + [ + ONCE_REWRITE_TAC[GSYM IMAGE_LEMMA] THEN + MATCH_MP_TAC FINITE_IMAGE THEN + REWRITE_TAC[FINITE_SET_OF_LIST]; + ALL_TAC + ] THEN + + REWRITE_TAC[IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[POLYHEDRON_BIS]);; + + +(* voronoi_list is a polytope *) +let POLYTOPE_VORONOI_LIST = prove(`!V ul. packing V /\ saturated V /\ set_of_list ul SUBSET V /\ ~(ul = []) + ==> polytope (voronoi_list V ul)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[POLYTOPE_EQ_BOUNDED_POLYHEDRON] THEN + ASM_SIMP_TAC[POLYHEDRON_VORONOI_LIST] THEN + MP_TAC (ISPEC `ul:(real^3)list` list_CASES) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + ASM_SIMP_TAC[VORONOI_LIST_BIS] THEN + MATCH_MP_TAC BOUNDED_SUBSET THEN + EXISTS_TAC `voronoi_closed V (h:real^3)` THEN + REWRITE_TAC[INTER_SUBSET] THEN + ASM_SIMP_TAC[BOUNDED_VORONOI_CLOSED]);; + + +let POLYTOPE_VORONOI_LIST_BARV = prove(`!V ul k. packing V /\ saturated V /\ barV V k ul ==> polytope (voronoi_list V ul)`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC POLYTOPE_VORONOI_LIST THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC BARV_SUBSET THEN + EXISTS_TAC `k:num` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[GSYM LENGTH_EQ_NIL] THEN + POP_ASSUM MP_TAC THEN SIMP_TAC[BARV; ARITH_RULE `~(k + 1 = 0)`]);; + + +(* closed (voronoi_list V ul) *) +let CLOSED_VORONOI_LIST = prove(`!V ul. closed (voronoi_list V ul)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[VORONOI_LIST; VORONOI_SET] THEN + MATCH_MP_TAC CLOSED_INTERS THEN + REWRITE_TAC[IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[CLOSED_VORONOI_CLOSED]);; + + +(* convex (voronoi_list V ul) *) +let CONVEX_VORONOI_LIST = prove(`!V ul. convex (voronoi_list V ul)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[VORONOI_LIST; VORONOI_SET] THEN + MATCH_MP_TAC CONVEX_INTERS THEN + REWRITE_TAC[IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[CONVEX_VORONOI_CLOSED]);; + + + +(* aff_dim voronoi_list *) +let AFF_DIM_VORONOI_LIST = prove(`!V ul k. barV V k ul ==> aff_dim (voronoi_list V ul) = &3 - &k`, + REWRITE_TAC[BARV; VORONOI_NONDG] THEN REPEAT STRIP_TAC THEN + POP_ASSUM (MP_TAC o SPEC `ul:(real^3)list`) THEN + ASM_REWRITE_TAC[ARITH_RULE `0 < k + 1`; INITIAL_SUBLIST_REFL] THEN + REWRITE_TAC[GSYM INT_OF_NUM_ADD] THEN INT_ARITH_TAC);; + + +(* voronoi_list V vl SUBSET voronoi_closed V (HD vl) *) +let VORONOI_LIST_SUBSET_VORONOI_CLOSED = prove(`!V vl. 1 <= LENGTH vl ==> voronoi_list V vl SUBSET voronoi_closed V (HD vl)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[SUBSET; VORONOI_LIST; VORONOI_SET; IN_INTERS; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `voronoi_closed V ((HD vl):real^3)`) THEN + ANTS_TAC THENL + [ + EXISTS_TAC `HD vl:real^3` THEN + REWRITE_TAC[] THEN + MATCH_MP_TAC HD_IN_SET_OF_LIST THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[]);; + + + +(************************************************************) + +(*****************************************************) +(* General properties of omega_list_n and omega_list *) +(*****************************************************) + +(* omega_k(u) = omega_k (d_(k+i) u) *) +let OMEGA_LIST_N_LEMMA = prove(`!V ul k i. k + i + 1 <= LENGTH ul ==> omega_list_n V ul k = omega_list_n V (truncate_simplex (k + i) ul) k`, + GEN_TAC THEN GEN_TAC THEN + INDUCT_TAC THEN REWRITE_TAC[OMEGA_LIST_N] THEN REPEAT STRIP_TAC THENL + [ + MATCH_MP_TAC (GSYM HD_TRUNCATE_SIMPLEX) THEN + POP_ASSUM MP_TAC THEN ARITH_TAC; + ALL_TAC + ] THEN + MP_TAC (ISPECL [`ul:(real^3)list`; `SUC k`; `SUC k + i`] TRUNCATE_TRUNCATE_SIMPLEX) THEN + ASM_REWRITE_TAC[ARITH_RULE `a:num <= a + i`; ARITH_RULE `(a + b) + 1 = a + b + 1`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + AP_TERM_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `i + 1`) THEN + ASM_REWRITE_TAC[ARITH_RULE `k + (i + 1) + 1 = SUC k + i + 1`] THEN + SIMP_TAC[ARITH_RULE `k + i + 1 = SUC k + i`]);; + + +(* omega(d_k u) = omega_k (u) *) +let OMEGA_LIST_LEMMA = prove(`!V ul k. k + 1 <= LENGTH ul ==> omega_list V (truncate_simplex k ul) = omega_list_n V ul k`, + REPEAT STRIP_TAC THEN REWRITE_TAC[OMEGA_LIST] THEN + MP_TAC (ISPECL [`k:num`; `truncate_simplex k (ul:(real^3)list)`; `ul:(real^3)list`] TRUNCATE_SIMPLEX_INITIAL_SUBLIST) THEN + ASM_SIMP_TAC[ARITH_RULE `(k + 1) - 1 = k`] THEN + DISCH_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `k:num`; `0`] OMEGA_LIST_N_LEMMA) THEN + ASM_SIMP_TAC[ADD_CLAUSES]);; + + + +let BARV_IMP_VORONOI_LIST_NOT_EMPTY = prove(`!V ul k. barV V k ul ==> ~(voronoi_list V ul = {})`, + REPEAT STRIP_TAC THEN + UNDISCH_TAC `barV V k ul` THEN DISCH_TAC THEN FIRST_ASSUM MP_TAC THEN + REWRITE_TAC[BARV; VORONOI_NONDG] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `ul:(real^3)list`) THEN + ASM_REWRITE_TAC[INITIAL_SUBLIST_REFL; ARITH_RULE `0 < k + 1`; DE_MORGAN_THM] THEN + DISJ2_TAC THEN DISJ2_TAC THEN + REWRITE_TAC[AFF_DIM_EMPTY; GSYM INT_OF_NUM_ADD] THEN + SUBGOAL_THEN `&k <= int_of_num 3` MP_TAC THENL + [ + REWRITE_TAC[INT_OF_NUM_LE] THEN + MATCH_MP_TAC BARV_IMP_K_LE_3 THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `ul:(real^3)list`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + INT_ARITH_TAC);; + + +(* omega_i IN voronoi_list V (d_i ul) *) +let OMEGA_LIST_N_IN_VORONOI_LIST = prove(`!V ul k i. barV V k ul /\ i <= k + ==> omega_list_n V ul i IN voronoi_list V (truncate_simplex i ul)`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `LENGTH (ul:(real^3)list) = k + 1` ASSUME_TAC THENL + [ + UNDISCH_TAC `barV V k ul` THEN + SIMP_TAC[BARV]; + ALL_TAC + ] THEN + DISJ_CASES_TAC (SPEC `i:num` num_CASES) THENL + [ + ASM_REWRITE_TAC[OMEGA_LIST_N] THEN + MP_TAC (ISPEC `ul:(real^3)list` TRUNCATE_0_EQ_HEAD) THEN + ASM_REWRITE_TAC[ARITH_RULE `1 <= k + 1`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[VORONOI_LIST_SING; CENTER_IN_VORONOI_CELL]; + ALL_TAC + ] THEN + POP_ASSUM CHOOSE_TAC THEN + ASM_REWRITE_TAC[OMEGA_LIST_N] THEN + MP_TAC (ISPECL [`voronoi_list V (truncate_simplex i ul):real^3->bool`; `omega_list_n V ul n`] CLOSEST_POINT_EXISTS) THEN + ANTS_TAC THENL + [ + REWRITE_TAC[CLOSED_VORONOI_LIST] THEN + MATCH_MP_TAC BARV_IMP_VORONOI_LIST_NOT_EMPTY THEN + EXISTS_TAC `i:num` THEN + MATCH_MP_TAC TRUNCATE_SIMPLEX_BARV THEN + EXISTS_TAC `k:num` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[]);; + + +(* omega ul IN voronoi_list V ul *) +let OMEGA_LIST_IN_VORONOI_LIST = prove(`!V ul k. barV V k ul ==> omega_list V ul IN voronoi_list V ul`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[OMEGA_LIST] THEN + MP_TAC (SPECL [`V:real^3->bool`; `ul:(real^3)list`; `k:num`; `k:num`] OMEGA_LIST_N_IN_VORONOI_LIST) THEN + ASM_REWRITE_TAC[LE_REFL] THEN + SUBGOAL_THEN `LENGTH (ul:(real^3)list) = k + 1` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN SIMP_TAC[BARV]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `truncate_simplex k ul = ul:(real^3)list` (fun th -> REWRITE_TAC[th]) THENL + [ + MP_TAC (ISPECL [`k:num`; `ul:(real^3)list`; `ul:(real^3)list`] TRUNCATE_SIMPLEX_INITIAL_SUBLIST) THEN + ASM_REWRITE_TAC[LE_REFL; INITIAL_SUBLIST_REFL]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[ARITH_RULE `(k + 1) - 1 = k`]);; + + + +end;; diff --git a/text_formalization/packing/pack_concl.hl b/text_formalization/packing/pack_concl.hl new file mode 100644 index 0000000..9288093 --- /dev/null +++ b/text_formalization/packing/pack_concl.hl @@ -0,0 +1,357 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Packing *) +(* Author: Thomas C. Hales *) +(* Date: 2010-02-21 *) +(* ========================================================================== *) + +(* +Main conclusions of the chapter "Packing" +The last section "Counting Spheres" has not been typed up. It is waiting for the proof +of the existence of the correspondence needed in GOTCJAH. +*) + +module Pack_concl = struct + +let GLTVHUM_concl = `!V (u0:real^3) p. packing V /\ saturated V /\ (u0 IN V) ==> + (p IN voronoi_closed V u0 <=> + (?vl. vl IN barV V 3 /\ p IN rogers V vl /\ (truncate_simplex 0 vl = [u0])))`;; + +let DUUNHOR_concl = `!V ul vl. ul IN barV V 3 /\ vl IN barV V 3 /\ + ~(rogers V ul = rogers V vl) ==> + coplanar (rogers V ul INTER rogers V vl)`;; + +let QXSKIIT_concl = + `!(vf:A->real^N) b . FINITE (IMAGE vf (:A)) /\ + ~ affine_dependent (IMAGE vf (:A)) /\ (!i j. (vf i = vf j) ==> (b i = b j)) + ==> (?!p. p IN affine hull (IMAGE vf (:A)) /\ (!i j. (p dot (vf i - vf j) = (b i - b j))))`;; + +(* +let OAPVION_concl = `!S. ~(S = {}) /\ ~affine_dependent S ==> + ?!p. ?c. (p IN affine hull S) /\ (!(v:real^N). (v IN S) ==> (dist(p,v) = c))`;; +*) + +let OAPVION1_concl = `!(S:real^N->bool). ~(S = {}) /\ ~affine_dependent S ==> + (circumcenter S) IN (affine hull S)`;; + +let OAPVION2_concl = `!(S:real^N->bool). ~affine_dependent S ==> + (!w. w IN S ==> (radV S = dist(circumcenter S, w)))`;; + +let OAPVION3_concl = `!(S:real^N->bool). ~affine_dependent S ==> + (!p. (p IN affine hull S) /\ (?c. !w. (w IN S) ==> (dist(p,w) = c)) ==> (p = circumcenter S))`;; + +let MHFTTZN1_concl = `!V ul k. (k <= 3) /\ saturated V /\ packing V /\ barV V k ul ==> + aff_dim (set_of_list ul) = int_of_num k`;; + +let MHFTTZN2_concl = `!V ul k. (k <= 3) /\ saturated V /\ packing V /\ barV V k ul ==> + (!p. p IN affine hull voronoi_list V ul <=> (!u. (u IN set_of_list ul ==> p IN bis (HD ul) u)))`;; + +let MHFTTZN3_concl = `!V ul k. (k <= 3) /\ saturated V /\ packing V /\ barV V k ul ==> + ((affine hull (voronoi_list V ul)) INTER (affine hull (set_of_list ul)) = + { circumcenter (set_of_list ul) } )`;; + +let MHFTTZN4_concl = `!V ul k u v q. (k <= 3) /\ saturated V /\ packing V /\ barV V k ul /\ (q = circumcenter (set_of_list ul)) /\ + u IN affine hull voronoi_list V ul /\ v IN affine hull (set_of_list ul) ==> + ((u - q) dot (v - q) = &0)`;; + +(* CHNGQBD *) + + +let XYOFCGX_concl = + `!V S (p:real^3). S SUBSET V /\ ~affine_dependent S /\ + (p = circumcenter S) /\ (radV S < sqrt(&2)) ==> + (!u v. u IN S /\ v IN (V DIFF S) ==>dist(v,p) > dist(u,p))`;; + +let XNHPWAB1_concl = +`!V ul k. saturated V /\ packing V /\ (k <= 3) /\ (ul IN barV V k) /\ (hl ul < sqrt(&2)) ==> + (omega_list V ul = circumcenter (set_of_list ul))`;; + +let XNHPWAB2_concl = +`!V ul k. saturated V /\ packing V /\ (k <= 3) /\ (ul IN barV V k) /\ (hl ul < sqrt(&2)) ==> + (omega_list V ul IN convex hull (set_of_list ul))`;; + +(* +let XNHPWAB3_concl = +`!V ul k. saturated V /\ packing V /\ (k <= 3) /\ (ul IN barV V k) /\ (hl ul < sqrt(&2)) ==> + (aff_dim (IMAGE (omega_list_n V ul) (0..k)) = &k)`;; +*) + +let XNHPWAB3_concl = +`!V ul k. saturated V /\ packing V /\ (k <= 3) /\ (ul IN barV V k) /\ (hl ul < sqrt(&2)) ==> + (aff_dim { omega_list_n V ul j | j IN (0..k)} = &k)`;; + +let XNHPWAB4_concl = +`!V ul k. saturated V /\ packing V /\ (k <= 3) /\ (ul IN barV V k) /\ (hl ul < sqrt(&2)) ==> + (! i j. (i < j) /\ (j <= k) ==> hl(truncate_simplex i ul) < hl(truncate_simplex j ul))`;; + + +let WAUFCHE1_concl = + `!V ul k. saturated V /\ packing V /\ ul IN barV V k ==> hl ul <= + dist(omega_list V ul, HD ul)`;; + +let WAUFCHE2_concl = + `!V ul k. saturated V /\ packing V /\ ul IN barV V k /\ + hl ul < sqrt(&2) ==> (hl ul = dist(omega_list V ul, HD ul))`;; + + +(* rearrangement *) + +let YIFVQDV_concl = `!V ul k p. packing V /\ saturated V /\ ul IN barV V k /\ + hl ul < sqrt(&2) /\ p permutes (0..k) ==> + (left_action_list p ul IN barV V k) /\ (omega_list V (left_action_list p ul) = omega_list V ul)`;; + +let KSOQKWL_concl = `!V ul p k. saturated V /\ packing V /\ ul IN barV V k /\ hl ul < sqrt(&2) /\ +p permutes (0..k) /\ (rogers V ul = rogers V (left_action_list p ul)) ==> (p = I)`;; + +(* TSIVSKG *) + + +let IVFICRK_concl = + `(!k. ?g. (BIJ g { (i,sigma ) | i IN 0..(k+1) /\ sigma permutes (0..k) } { p | p permutes (0..(k+1)) }) + /\ (!(ul:(A)list) j. (LENGTH ul = k+2) /\ j <= k ==> + (EL j ( left_action_list (g(i,sigma)) ul) = EL j (left_action_list sigma (DROP ul i) ))))`;; + +let WQPRRDY_concl = + `!V ul k. saturated V /\ packing V /\ ul IN barV V k /\ hl ul < sqrt(&2) ==> + (convex hull (set_of_list ul) = UNIONS { rogers V (left_action_list p ul) | p permutes (0..k) })`;; + + +let MXI_EXISTS_concl = `!V ul. saturated V /\ packing V /\ barV V 3 ul /\ + sqrt(&2) <= hl ul ==> + (mxi V ul IN convex hull { omega_list_n V ul 2 , omega_list_n V ul 3 }) /\ + (dist(mxi V ul, HD ul) = sqrt(&2))`;; + + +(* BGXEVQU , skip. Expand out using permutes *) + +let EMNWUUS1_concl = `!V ul. saturated V /\ packing V /\ barV V 3 ul ==> + (hl ul < sqrt(&2) <=> ~(mcell4 V ul = {}))`;; + +let EMNWUUS2_concl = `!V ul. saturated V /\ packing V /\ barV V 3 ul ==> + (hl ul < sqrt(&2) <=> (mcell0 V ul = {}) /\ (mcell1 V ul = {}) /\ (mcell2 V ul = {}) /\ + (mcell3 V ul = {}))`;; + +let SLTSTLO1_concl = `!V ul p. saturated V /\ packing V /\ barV V 3 ul /\ (p IN rogers V ul) ==> + (?i. (i <= 4) /\ (p IN mcell i V ul))`;; + +let SLTSTLO2_concl = `!V ul. ?Z. !p. saturated V /\ packing V /\ barV V 3 ul ==> + (NULLSET Z) /\ (p IN rogers V ul DIFF Z ==> (?!i. (i <= 4) /\ (p IN mcell i V ul)))`;; + +let RVFXZBU1_concl = `!V ul vl i j. saturated V /\ packing V /\ + barV V 3 ul /\ barV V 3 vl /\ ~(i=j) ==> + NULLSET (mcell i V ul INTER mcell j V vl)`;; + +let RVFXZBU2_concl = `!V ul vl i. saturated V /\ packing V /\ barV V 3 ul /\ barV V 3 vl /\ + ~(NULLSET (mcell i V ul INTER mcell i V vl)) ==> + (?p. p permutes 0..(i-1) /\ (vl = left_action_list p ul))`;; + +let RVFXZBU3_concl = `!V ul i p. saturated V /\ packing V /\ barV V 3 ul /\ + (p permutes 0..(i-1)) ==> (mcell i V (left_action_list p ul) = mcell i V ul)`;; + +let LEPJBDJ_concl = `!V ul k. + saturated V /\ packing V /\ barV V 3 ul /\ (1 <= k) /\ (k <= 4) /\ + ~(mcell k V ul = {})==> + (V INTER mcell k V ul = set_of_list (truncate_simplex (k-1) ul))`;; + +let LEPJBDJ_0_concl = + `!V ul. + saturated V /\ + packing V /\ + barV V 3 ul + ==> V INTER mcell 0 V ul = {}`;; + +let HDTFNFZ_concl = +`!V ul k v X. + saturated V /\ + packing V /\ + barV V 3 ul /\ + X = mcell k V ul /\ ~(NULLSET X) + ==> VX V X = V INTER X`;; + +let URRPHBZ1_concl = `!V ul k. + saturated V /\ packing V /\ barV V 3 ul ==> + measurable (mcell k V ul)`;; + +let URRPHBZ2_concl = `!V ul k v. + saturated V /\ packing V /\ barV V 3 ul /\ (v IN V)==> + eventually_radial v (mcell k V ul)`;; + +let URRPHBZ3_concl = `!V ul k v. + saturated V /\ packing V /\ barV V 3 ul /\ ~(NULLSET (mcell k V ul)) /\ + (v IN V DIFF VX V (mcell k V ul))==> + (?t. t > &0 /\ (!p. p IN mcell k V ul ==> t < dist(p,v)))`;; + +let QZYZMJC_concl = `!V v X. + saturated V /\ packing V /\ (v IN V) ==> + (sum { X | mcell_set V X /\ v IN VX V X } (\t. sol v t) = &4 * pi)`;; + + +(* +let IJEKNGA_concl = +*) + +(* +JGXZYGW already done by Nguyen Tat Thang +*) + + +(* These individual statements rather than the entire lemma are what we need. *) + +let KIZHLTL1_concl = `!(V:real^3->bool). ?c. !r. saturated V /\ packing V /\ (&1 <= r) ==> + (sum { X | X SUBSET ball(vec 0,r) /\ (mcell_set V X) } vol + c*r pow 2 + <= sum (V INTER ball(vec 0,r)) (\u. vol(voronoi_open V u)))`;; + +let KIZHLTL2_concl = `!(V:real^3->bool). ?c. !r. saturated V /\ packing V /\ (&1 <= r) ==> + ( &(CARD(V INTER ball(vec 0,r)))* &8*mm1 + c*r pow 2 + <= (&2*mm1/pi)* sum { X | X SUBSET ball(vec 0, r) /\ mcell_set V X } + (total_solid V) )`;; + +let KIZHLTL3_concl = `!(V:real^3->bool) f. ?c. !r. saturated V /\ packing V /\ (&1 <= r) /\ + (?c1. !x. &2 <= x /\ x < sqrt(&8) ==> abs( f x) <= c1) + ==> + (( &8 * mm2 /pi)* + sum { X | X SUBSET ball(vec 0, r) /\ mcell_set V X } + ( \ X. sum (edgeX V X) ( \ {u,v}. (dihX V X (u ,v))*f (hl[u;v]))) + +c*r pow 2 <= + &8*mm2 * + sum (V INTER ball(vec 0,r)) + ( \u. sum { v | v IN V /\ ~(u=v) /\ dist(u,v) < sqrt(&8)} + ( \v. f(hl [u;v]))))`;; + +let OXLZLEZ_concl = `!V. (saturated V /\ packing V ) ==> cell_cluster_estimate_v1 V`;; + +let TSKAJXY_statement = new_definition + `TSKAJXY_statement <=> + (!V X. + saturated V /\ + packing V /\ + mcell_set V X /\ + critical_edgeX V X = {} + ==> gammaX V X lmfun >= &0)`;; + +let UPFZBZM_concl = + `!V. saturated V /\ packing V /\ cell_cluster_estimate_v1 V /\ + TSKAJXY_statement /\ + lmfun_inequality V ==> + (?G. negligible_fun_0 G V /\ fcc_compatible G V)`;; + +(* Deprecated Dec 31, 2012 +let UPFZBZM_concl = `!V. saturated V /\ packing V /\ cell_cluster_estimate_v1 V /\ + marchal_inequality /\ + lmfun_inequality V ==> (?G. negligible_fun_0 G V /\ fcc_compatible G V)`;; +*) + +(* RDW modified Dec 31, 2012 *) + +let RDWKARC_concl = `~kepler_conjecture /\ + (!V. packing V /\ saturated V ==> cell_cluster_estimate_v1 V) /\ TSKAJXY_statement + ==> (?V. packing V /\ V SUBSET ball_annulus /\ ~(lmfun_ineq_center V))`;; + +let GOTCJAH_concl = `!s f (v:real^3) b WF h k. + polyhedron s /\ bounded s /\ (?r. r> &0 /\ ball(vec 0,r) SUBSET s) /\ + f facet_of s /\ + f = { p | p dot v = b } INTER s /\ + topological_component_yfan (vec 0,fan_of_polyhedron s) WF /\ + ~(f INTER WF = {}) /\ + rcone_gt (vec 0) v h SUBSET WF /\ + (k = CARD {u | u extreme_point_of f }) + ==> &2 * pi - &2* &k * asn (h* sin(pi/ &k)) <= sol (vec 0) WF`;; + +(* Dec 28, 2011, content merged from scattered files *) + + let TIWWFYQ_concl = `!V (p:real^3). packing V /\ saturated V ==> (?v. v IN V /\ p IN voronoi_closed V v)`;; + + + let VORONOI_BALL2_concl = `!V (v:real^3). packing V /\ saturated V /\ (v IN V) ==> voronoi_closed V v SUBSET ball(v, &2)`;; + + let VORONOI_INTER_BIS_LE_concl = `!V (v:real^3). packing V /\ saturated V /\ (v IN V) ==> + (voronoi_closed V v =INTERS { bis_le v u | u IN V /\ u IN ball(v, &4) /\ ~(u=v) })`;; + + let VORONOI_POLYHEDRON_concl = `!V (v:real^3). packing V /\ saturated V /\ (v IN V) ==> + polyhedron (voronoi_closed V v)`;; + + let RHWVGNP_concl = VORONOI_POLYHEDRON_concl;; + + let DRUQUFE_concl = `!V (v:real^3). packing V /\ saturated V ==> + compact (voronoi_closed V v) /\ convex (voronoi_closed V v) /\ measurable (voronoi_closed V v)`;; + + let BBDTRGC_VORONOI_SET = Sphere.VORONOI_SET;; + + let BBDTRGC_VORONOI_LIST = Sphere.VORONOI_LIST;; + + let NOPZSEH = Sphere.BARV;; + + let JNRJQSM = Sphere.TRUNCATE_SIMPLEX;; + + let KHEJKCI_concl = `!V k ul. saturated V /\ packing V /\ vor_list V k ul ==> + ((voronoi_list V ul) face_of (voronoi_closed V (HD ul)) )`;; + + let JJGTQMN = Sphere.OMEGA_LIST;; + + let PHZVPFY = Sphere.ROGERS;; + + + (* deprecated, replaced with GRUTOTI1_concl + + let GRUTOTI_concl = + `!V u0 u1 e. + saturated V /\ packing V /\ + u0 IN V /\ u1 IN V /\ + dist (u0, u1) < sqrt (&2) /\ + e = {u0, u1} ==> + sum {X | e IN (edgeX V X)} (\t. dihX V t (u0,u1)) = &2 * pi`;; + + *) + +let GRUTOTI1_concl = +`!V u0 u1 e. + saturated V /\ + packing V /\ + u0 IN V /\ + u1 IN V /\ + ~(u0 = u1) /\ + hl [u0;u1] < sqrt (&2) /\ + e = {u0, u1} + ==> sum {X | mcell_set V X /\ e IN edgeX V X } (\t. dihX V t (u0,u1)) = + &2 * pi`;; + +let REUHADY_concl = `!V u0 u1 vl1 vl2 v1 v2 e. + saturated V /\ packing V /\ + dist(u0,u1) < sqrt8 /\ + e = {u0,u1} /\ + ~(azim u0 u1 w1 w2 = &0) /\ + hl vl1 < sqrt2 /\ hl vl2 < sqrt2 /\ + vl1 IN barV V 2 /\ vl2 IN barV V 2 /\ + set_of_list (truncate_simplex 1 vl1)= e /\ + set_of_list (truncate_simplex 1 vl2) =e /\ + v1 = EL 2 vl1 /\ + v2 = EL 2 vl2 /\ + (!X. X IN mcell_set V /\ e IN edgeX V X ==> + (X SUBSET wedge_ge u0 u1 v1 v2 \/ + X SUBSET wedge_ge u0 u1 v2 v1)) ==> + (sum {X | mcell_set V X /\ e IN edgeX V X /\ X SUBSET wedge_ge u0 u1 v1 v2 } + (\t. dihX V t (u0,u1)) = azim u0 u1 v1 v2)`;; + +(* WEDGE_GE_ALMOST_DISJOINT gives the intersection of wedges hypothesis in the following verion *) + +let REUHADY_concl_version2 = `!V u0 u1 vl1 vl2 v1 v2 e. + saturated V /\ packing V /\ + dist(u0,u1) < sqrt8 /\ + e = {u0,u1} /\ + wedge_ge u0 u1 v1 v2 INTER wedge_ge u0 u1 v2 v1 SUBSET aff_ge {u0,u1} {v1} UNION aff_ge {u0,u1} {v2} /\ + hl vl1 < sqrt2 /\ hl vl2 < sqrt2 /\ + vl1 IN barV V 2 /\ vl2 IN barV V 2 /\ + set_of_list (truncate_simplex 1 vl1)= e /\ + set_of_list (truncate_simplex 1 vl2) =e /\ + v1 = EL 2 vl1 /\ + v2 = EL 2 vl2 /\ + (!X. X IN mcell_set V /\ e IN edgeX V X ==> + (X SUBSET wedge_ge u0 u1 v1 v2 \/ + X SUBSET wedge_ge u0 u1 v2 v1)) ==> + (sum {X | mcell_set V X /\ e IN edgeX V X /\ X SUBSET wedge_ge u0 u1 v1 v2 } + (\t. dihX V t (u0,u1)) = azim u0 u1 v1 v2)`;; + + + +end;; diff --git a/text_formalization/packing/pack_defs.hl b/text_formalization/packing/pack_defs.hl new file mode 100644 index 0000000..ab143e4 --- /dev/null +++ b/text_formalization/packing/pack_defs.hl @@ -0,0 +1,306 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Packing *) +(* Author: Thomas C. Hales *) +(* Date: 2010-02-21 *) +(* ========================================================================== *) + +(* definitions needed for the chapter Packing *) + + +flyspeck_needs "volume/vol1.hl";; + +module Pack_defs = struct + + let sol = Vol1.sol;; + + let negligible_fun_p = new_definition `negligible_fun_p f S (p:real^N) = (? (C:real). (&0<= C)/\ ! (r:real). ( &1 <= r) ==> (sum (S INTER ball(p,r)) f) <= C * (r pow 2))`;; + + let negligible_fun_0 = new_definition `negligible_fun_0 f S = negligible_fun_p f S ((vec:num->real^3) 0)`;; + + let fcc_compatible= new_definition `fcc_compatible f (S:real^N->bool) = (!v. v IN S ==> sqrt( &32) <= measure(voronoi_open S v) + f v)`;; + + let kepler_conjecture = new_definition `kepler_conjecture = (!V. packing V /\ saturated V ==> (?(c:real). !(r:real). (&1<= r ==> vol ((UNIONS {ball(v:real^3, &1) | v IN V}) INTER ball(vec 0 ,r))/ vol (ball(vec 0, r))<= pi/ sqrt( &18) + c/ r)))`;; + +let HL = new_definition `hl (ul:(real^N)list) = radV (set_of_list ul)`;; + +let REVERSE_TABLE = define `(REVERSE_TABLE (f:num->A) 0 = []) /\ + (REVERSE_TABLE f (SUC i) = CONS (f i) ( REVERSE_TABLE f i))`;; + +let TABLE = new_definition `!(f:num->A) k. TABLE f k = REVERSE (REVERSE_TABLE f k)`;; + +let left_action = new_definition `!p f x. left_action (p:A->C) (f:A->B) x = f(inverse p x)`;; + +let left_action_list = new_definition `left_action_list p (ul:(A)list) = TABLE (\i. EL (inverse p i) ul) (LENGTH ul)`;; + +let DROP = define `(DROP (ul:(A)list) 0 = TL ul) /\ (DROP ul (SUC i) = CONS(HD ul) (DROP (TL ul) i))`;; + +let mxi = new_definition `!V ul. mxi V ul = + if (hl (truncate_simplex 2 ul) >= sqrt(&2)) + then omega_list_n V ul 2 + else (@p. ((p IN convex hull + { omega_list_n V ul 2 , omega_list_n V ul 3}) /\ + (dist(p, HD ul) = sqrt(&2))))`;; + +let mcell0 = + new_definition `!V ul. mcell0 V ul = rogers V ul DIFF ball(HD ul,sqrt(&2))`;; + +(* June 17, 2011, changed to mcell1, mcell2 to + weak ineq sqrt(&2) <= hl ul to fix an error + reported by Ky *) + +let mcell1 = new_definition `!V ul. mcell1 V ul = + if (sqrt(&2) <= hl ul) + then + rogers V ul INTER cball(HD ul, (sqrt (&2))) DIFF + rcone_gt (HD ul) (HD (TL ul)) + (hl (truncate_simplex 1 ul ) / (sqrt(&2))) + else {}`;; + +let mcell2 = new_definition `!V ul. mcell2 V ul = + if (hl (truncate_simplex 1 ul) < sqrt(&2)) /\ (sqrt(&2) <= hl ul) + then + (let a = hl (truncate_simplex 1 ul ) / (sqrt(&2)) in + rcone_ge (HD ul) (HD (TL ul)) a INTER + rcone_ge (HD (TL ul)) (HD ul) a INTER + aff_ge { HD ul, (HD (TL ul)) } { mxi V ul, omega_list_n V ul 3 }) + else {}`;; + +let mcell3 = new_definition `!V (ul:(real^3)list). mcell3 V ul = + if (hl (truncate_simplex 2 ul) < sqrt(&2)) /\ (sqrt(&2) <= hl ul) then + convex hull (set_of_list (truncate_simplex 2 ul) UNION { mxi V ul }) + else {}`;; + +let mcell4 = new_definition `!V ul. mcell4 (V:real^3->bool) (ul:(real^3)list) = + if (hl ul < sqrt(&2)) + then convex hull (set_of_list ul) + else {}`;; + +let mcell = new_definition `!(V:real^3->bool) ul. (mcell i V ul) = + if (i=0) then mcell0 V ul else if (i=1) then mcell1 V ul else if (i=2) then mcell2 V ul + else if (i=3) then mcell3 V ul else mcell4 V ul`;; + +let mcell_set = new_definition `mcell_set V = +{ X | ?i ul. (X = mcell i V ul) /\ ul IN barV V 3 }`;; + + +let cell_params = new_definition `!V X. cell_params V X = @(k,ul). + (k <= 4) /\ (ul IN barV V 3) /\ (X = mcell k V ul)`;; + +let VX = new_definition + `!V X. + VX V X = + (if NULLSET X + then {} + else let k,ul = cell_params V X in + (if k = 0 then {} else + set_of_list (truncate_simplex (k - 1) ul)))`;; + +let edgeX = new_definition `!V X. edgeX V X = { ({u,v}) | VX V X u /\ VX V X v /\ ~(u=v) }`;; + +let total_solid = new_definition `!V X x. total_solid V X = sum ( VX V X ) (\(x:real^3). (sol x X))`;; + +(* The definition of dihX is rather awkward, because a cell is essentially a quotient + type, so it is not natural to make definitions with cells as a parameter. + Several lemmas will have to be proved to make these definitions useable, such as + dihX V (mcell 4 V ul) ((EL 0 ul),(EL 1 ul)) = dihV (EL 0 ul) (EL 1 ul) (EL 2 ul) (EL 3 ul). +*) + + +(* deprecated 1/16/2012, tchales +let dihX2 = new_definition `!V X v0 (v1:real^3). dihX2 V X (v0,v1) = + (let (k,ul) = cell_params V X in + dihV v0 v1 (mxi V ul) (omega_list_n V ul 3))`;; +p +(* The sum has a single term *) + +let dihX3 = new_definition `!V X v0 (v1:real^3). dihX3 V X (v0,v1) = + (let (k,ul) = cell_params V X in + sum { (vl,p) | p permutes {0,1,2} /\ + (vl = left_action_list p ul) /\ (v0 = EL 0 vl) /\ (v1 = EL 1 vl) } + ( \ (vl,p) . dihV v0 v1 (EL 2 vl) (mxi V ul) ))`;; + +(* The sum has two terms. Take the average *) + +let dihX4 = new_definition `!V X v0 (v1:real^3). dihX4 V X (v0,v1) = + (let (k,ul) = cell_params V X in + (&1 / &2) * sum { (vl,p) | p permutes {0,1,2,3} /\ + (vl = left_action_list p ul) /\ (v0 = EL 0 vl) /\ (v1 = EL 1 vl) } + ( \ (vl,p). dihV v0 v1 (EL 2 vl) (EL 3 ul) ))`;; + +let dihX = new_definition `!V X v0 (v1:real^3). dihX V X (v0,v1) = + if (NULLSET X) then &0 else + (let (k,ul) = cell_params V X in + if (k=2) then dihX2 V X (v0,v1) + else if (k=3) then dihX3 V X (v0,v1) + else if (k=4) then dihX4 V X (v0,v1) + else &0)`;; +*) + +let dihu2 = new_definition `!V ul. dihu2 V ul = + dihV (EL 0 ul) (EL 1 ul) (mxi V ul) (omega_list_n V ul 3)`;; + +let dihu3 = new_definition `!V ul. dihu3 V ul = + dihV (EL 0 ul) (EL 1 ul) (EL 2 ul) (mxi V ul)`;; + +let dihu4 = new_definition `!(ul:((real^3)list)). dihu4 ul = + dihV (EL 0 ul) (EL 1 ul) (EL 2 ul) (EL 3 ul)`;; + +let cell_params_d = new_definition `!V X. cell_params_d V X vl = @(k,ul). + (k <= 4) /\ (ul IN barV V 3) /\ (X = mcell k V ul) /\ + (initial_sublist vl ul)`;; + +let dihX = new_definition `!V X v0 v1. dihX V X (v0,v1) = + if (NULLSET X) then &0 else + (let (k,ul) = cell_params_d V X [v0;v1] in + if (k=2) then dihu2 V ul + else if (k=3) then dihu3 V ul + else if (k=4) then dihu4 ul + else &0)`;; + + + let sol0 = new_definition `sol0 = &3 * acs (&1 / &3) - pi`;; + let tau0 = new_definition `tau0 = &4 * pi - &20 * sol0`;; + let mm1 = new_definition `mm1 = sol0 * sqrt(&8)/tau0`;; + let mm2 = new_definition `mm2 = (&6 * sol0 - pi) * sqrt(&2) /(&6 * tau0)`;; + let hplus = new_definition `hplus = #1.3254`;; + +(* + let marchal_quartic = new_definition `marchal_quartic h = + (sqrt(&2)-h)*(hplus - h)*(&17*h - &9*(h pow 2) - &3)/ + ((sqrt(&2) - &1)*(hplus - &1))`;; +*) + + let marchal = new_definition `marchal h = + (if (h <= sqrt(&2)) then marchal_quartic h else &0)`;; + +(* changed March 16, 2012, following Ky's suggestion. *) + +let gammaX = new_definition `!V X f. + gammaX V X f = vol(X) - (&2*mm1 / pi)*total_solid V X + + (&8*mm2/ pi) * sum (edgeX V X) (\{u,v}. (if {u,v} IN edgeX V X then (dihX V X (u ,v))* f(hl [u;v]) else (&0)))`;; + +(* + let gammaX = new_definition `!V X f. + gammaX V X f = vol(X) - (&2*mm1 / pi)*total_solid V X + + (&8*mm2/ pi) * sum (edgeX V X) (\{u,v}. (dihX V X (u ,v))* f(hl [u;v]))`;; +*) + +(* OBSOLETE, Dec 31, 2012: +let marchal_inequality = new_definition `marchal_inequality = + (!V X. saturated V /\ packing V /\ mcell_set V X ==> + gammaX V X marchal >= &0)`;; +*) + +let h0 = new_definition `h0 = #1.26`;; + +let lfun = new_definition `lfun h = (h0 - h)/(h0 - &1)`;; + +let lmfun = new_definition `lmfun h = if (h<=h0) then (h0 - h)/(h0 - &1) else &0`;; + +let hminus = new_definition `hminus = @x. #1.2 <= x /\ x < #1.3 /\ marchal_quartic x = lmfun x`;; + +let critical_edgeX =new_definition + `critical_edgeX V X = { {u,v} | {u,v} IN edgeX V X /\ hminus <= hl [u;v] /\ + hl[u;v] <= hplus}`;; + +let subcritical_edgeX =new_definition + `subcritical_edgeX V X = { {u,v} | {u,v} IN edgeX V X /\ hl [u;v] < hminus }`;; + +let critical_weight = new_definition + `! V X. critical_weight V X = &1/ &(CARD (critical_edgeX V X))`;; + +let bump = new_definition `!h. bump h = #0.005*(&1 - ((h- h0) pow 2)/((hplus - h0) pow 2))`;; + +let critical_edge_y = new_definition `critical_edge_y y = ((&2*hminus <= y) /\ (y <= &2 *hplus))`;; + +(* deprecated Dec 1, 2012 +let beta_bump_y = new_definition `beta_bump_y y1 y2 y3 y4 y5 y6 = + (if critical_edge_y y1 then &1 else &0) * + (if critical_edge_y y2 then &0 else &1) * + (if critical_edge_y y3 then &0 else &1) * + (if critical_edge_y y4 then &1 else &0) * + (if critical_edge_y y5 then &0 else &1) * + (if critical_edge_y y6 then &0 else &1) * + (bump (y1/ &2) - bump (y4 / &2))`;; +*) + +let wtcount3_y = new_definition `wtcount3_y y1 y2 y3 = + (if critical_edge_y y1 then 1 else 0) + + (if critical_edge_y y2 then 1 else 0) + + (if critical_edge_y y3 then 1 else 0) `;; + +let wtcount6_y = new_definition + `wtcount6_y y1 y2 y3 y4 y5 y6 = wtcount3_y y1 y2 y3 + wtcount3_y y4 y5 y6`;; + +let cell_cluster = new_definition +`!V e. cell_cluster V e = { X | e IN critical_edgeX V X /\ mcell_set V X }`;; + +(* Next definitions deprecated, Dec 1, 2012. + Obsolete Jan 2, 2013. *) + +(* +let beta_bump = new_definition `!V e X. beta_bump V e X = + (let (k,ul) = cell_params V X in + sum { (e',e'',p,vl) | (k=4) /\ (critical_edgeX V X = {e',e''}) /\ (e =e') /\ p permutes 0..3 + /\ (vl = left_action_list p ul) /\ (e' = {EL 0 vl, EL 1 vl}) /\ (e'' = {EL 2 vl, EL 3 vl} ) } + ( \ (e',e'',p,vl). (bump(hl [EL 0 vl; EL 1 vl]) - bump(hl [EL 2 vl; EL 3 vl]) )/ &4 ))`;; + +let cluster_gammaX = new_definition `!V e Z. cluster_gammaX V e Z= + sum Z ( \ X. gammaX V X lmfun * critical_weight V X + beta_bump V e X )`;; + +let cell_cluster_estimate = new_definition `!V. cell_cluster_estimate V = (!e. + (cluster_gammaX V e (cell_cluster V e) >= &0))`;; + + (* average over all 4 = 2! x 2! possible representations *) + +let beta_bumpA = new_definition `!V e X. beta_bumpA V e X = + (let (k,ul) = cell_params V X in + sum { (e',e'',p,vl) | (k=4) /\ (critical_edgeX V X = {e',e''}) /\ (e =e') /\ p permutes 0..3 /\ + (!e'''. e''' IN edgeX V X ==> ((e''' = e') \/ (e''' = e'') \/ (e''' IN subcritical_edgeX V X))) + /\ (vl = left_action_list p ul) /\ (e' = {EL 0 vl, EL 1 vl}) /\ (e'' = {EL 2 vl, EL 3 vl} ) } + ( \ (e',e'',p,vl). (bump(hl [EL 0 vl; EL 1 vl]) - bump(hl [EL 2 vl; EL 3 vl]) )/ &4 ))`;; + +let cluster_gamma_AX = new_definition `!V e Z. cluster_gamma_AX V e Z= + sum Z ( \ X. gammaX V X lmfun * critical_weight V X + beta_bumpA V e X )`;; + +let cell_cluster_estimate_A = new_definition `!V. cell_cluster_estimate_A V = (!e. + (cluster_gamma_AX V e (cell_cluster V e) >= &0))`;; + +*) + +let beta_bump_v1 = new_definition `!V e X. beta_bump_v1 V e X = + let e' = VX V X DIFF e in + ( + if (X IN mcell_set V /\ ~NULLSET X /\ e IN critical_edgeX V X /\ e' IN critical_edgeX V X /\ + (!f. f IN edgeX V X ==> (f = e) \/ (f = e') \/ (f IN subcritical_edgeX V X))) + then bump (radV e) - bump (radV e') + else (&0) + )`;; + +let cluster_gamma_v1 = new_definition `!V e Z. cluster_gamma_v1 V e Z= + sum Z ( \ X. gammaX V X lmfun * critical_weight V X + beta_bump_v1 V e X )`;; + +let cell_cluster_estimate_v1 = new_definition `!V. cell_cluster_estimate_v1 V = (!e. + (cluster_gamma_v1 V e (cell_cluster V e) >= &0))`;; + +let lmfun_inequality = new_definition + `!(V:real^N->bool). lmfun_inequality V = (!u. u IN V ==> + sum { v | v IN V /\ ~(u=v) /\ dist(u,v) <= &2*h0 } ( \v. lmfun (hl [u;v]) ) <= &12)`;; + +let ball_annulus = new_definition + `ball_annulus = cball((vec 0:real^3) , &2 * h0) DIFF ball(vec 0, &2)`;; + +let lmfun_ineq_center = new_definition `!(V:real^N->bool). lmfun_ineq_center V = + sum V ( \v. lmfun (hl [vec 0;v]) ) <= &12`;; + +let fan_of_polyhedron = new_definition `fan_of_polyhedron s = + { (v:real^3) | v extreme_point_of s } , + { {v,w} | ~(v=w) /\ (convex hull {v,w}) face_of s }`;; + + + end;; + + + diff --git a/text_formalization/packing/sum_gammaX_lmfun_estimate.hl b/text_formalization/packing/sum_gammaX_lmfun_estimate.hl new file mode 100755 index 0000000..fecf58c --- /dev/null +++ b/text_formalization/packing/sum_gammaX_lmfun_estimate.hl @@ -0,0 +1,1470 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Authour : VU KHAC KY *) +(* Book lemma: UPFZBZM *) +(* SUM_GAMMAX_LMFUN_ESTIMATE - a supported lemma. *) +(* Chaper : Packing (Clusters) *) +(* *) +(* ========================================================================= *) + +module Sum_gammax_lmfun_estimate = struct + +open Sphere;; +open Euler_main_theorem;; +open Pack_defs;; +open Pack_concl;; +open Pack1;; +open Pack2;; +open Packing3;; +open Rogers;; +open Vukhacky_tactics;; +open Marchal_cells;; +open Emnwuus;; +(* open Marchal_cells_2;; *) +open Marchal_cells_2_new;; +open Urrphbz1;; +open Lepjbdj;; +open Hdtfnfz;; +open Rvfxzbu;; +open Sltstlo;; +open Urrphbz2;; +open Urrphbz3;; +open Ynhyjit;; +open Njiutiu;; +open Tezffsk;; +open Qzksykg;; +open Ddzuphj;; +open Ajripqn;; +open Qzyzmjc;; +open Upfzbzm_support_lemmas;; +open Marchal_cells_3;; +open Grutoti;; + +let TSKAJXY_statement = new_definition + `TSKAJXY_statement <=> + (!V X. + saturated V /\ + packing V /\ + mcell_set V X /\ + critical_edgeX V X = {} + ==> gammaX V X lmfun >= &0)`;; + +let SUM_GAMMAX_LMFUN_ESTIMATE_concl = + `!V. ?c. !r. saturated V /\ packing V /\ &1 <= r /\ + cell_cluster_estimate_v1 V /\ TSKAJXY_statement ==> + c * r pow 2 <= sum {X | X SUBSET ball (vec 0, r) /\ mcell_set V X} + (\X. gammaX V X lmfun)`;; + +(* ========================================================================= *) +(* ========================================================================= *) + +let SUM_GAMMAX_LMFUN_ESTIMATE = prove_by_refinement ( + SUM_GAMMAX_LMFUN_ESTIMATE_concl, + +[(GEN_TAC); + +(* ================== Choose the constants ================================= *) + + (NEW_GOAL `?cc1. (&1 <= cc1) /\ (!V X. + packing V /\ saturated V /\ mcell_set V X + ==> gammaX V X lmfun <= cc1)`); + (MP_TAC BOUND_GAMMA_X_lmfun THEN STRIP_TAC); + (EXISTS_TAC `max (c:real) (&1)`); + (STRIP_TAC); + (REAL_ARITH_TAC); + (REPEAT STRIP_TAC); + (NEW_GOAL `gammaX V X lmfun <= c`); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL `?cc2. (&1 <= cc2) /\ + (!V u0. + saturated V /\ packing V /\ u0 IN V + ==> & (CARD {X | mcell_set V X /\ VX V X u0}) <= cc2)`); + + (MP_TAC CARD_MCELL_CONTAINS_POINT_klemma); + (STRIP_TAC); + (EXISTS_TAC `max (&c:real) (&1)`); + (STRIP_TAC); + (REAL_ARITH_TAC); + (REPEAT STRIP_TAC); + (NEW_GOAL `&(CARD {X | mcell_set V X /\ VX V X u0}) <= (&c:real)`); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (ASM_MESON_TAC[]); + (ABBREV_TAC `s = &(CARD {X | mcell_set V X /\ VX V X u0})`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL + `?cc3. &1 <= cc3 /\ + (!V X e. + saturated V /\ packing V /\ mcell_set V X /\ critical_edgeX V X e + ==> beta_bump_v1 V e X <= cc3)`); + (MP_TAC Bump.BOUND_BETA_BUMP THEN STRIP_TAC); + (EXISTS_TAC `max (c:real) (&1)`); + (STRIP_TAC); + (REAL_ARITH_TAC); + (REPEAT STRIP_TAC); + (NEW_GOAL `beta_bump_v1 V e X <= c`); + (ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (NEW_GOAL + `?cc4. &1 <= cc4 /\ + (!V u0. + saturated V /\ packing V /\ u0 IN V + ==> &(CARD {X | mcell_set V X /\ VX V X u0}) <= cc4)`); + (MP_TAC CARD_MCELL_CONTAINS_POINT_klemma THEN STRIP_TAC); + (EXISTS_TAC `max (&c) (&1)`); + (STRIP_TAC); + (REAL_ARITH_TAC); + (REPEAT STRIP_TAC); + (NEW_GOAL `&(CARD {X | mcell_set V X /\ VX V X u0}) <= &c`); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (ASM_MESON_TAC[]); + (ABBREV_TAC `s = &(CARD {X | mcell_set V X /\ VX V X u0})`); + (ASM_REAL_ARITH_TAC); + (UP_ASM_TAC THEN STRIP_TAC); + + (ASM_CASES_TAC `saturated V /\ packing V`); + + (NEW_GOAL + `?dd1. !r. &1 <= r ==> + &(CARD (V INTER ball ((vec 0):real^3,r) DIFF V INTER ball (vec 0,r - &8))) <= + dd1 * r pow 2`); + + (REWRITE_WITH `!r p. V INTER ball (p:real^3,r) DIFF V INTER ball (p,r - &8) + = V INTER ball (p:real^3,r + &0) DIFF V INTER ball (p,r - &8)`); + (ASM_REWRITE_TAC[REAL_ARITH `a + &0 = a`]); + (ASM_SIMP_TAC[PACKING_BALL_BOUNDARY]); + (TAKE_TAC); + + (ABBREV_TAC `dd2 = max dd1 (&1)`); + (ABBREV_TAC `dd = &1 / &2 * dd2 * (&4) pow 3 * cc2 * cc1`); + + (NEW_GOAL + `?dd3. !r. &1 <= r ==> + &(CARD (V INTER ball ((vec 0):real^3,r) DIFF V INTER ball (vec 0,r - &16))) <= + dd3 * r pow 2`); + + (REWRITE_WITH `!r p. V INTER ball (p:real^3,r) DIFF V INTER ball (p,r - &16) + = V INTER ball (p:real^3,r + &0) DIFF V INTER ball (p,r - &16)`); + (ASM_REWRITE_TAC[REAL_ARITH `a + &0 = a`]); + (ASM_SIMP_TAC[PACKING_BALL_BOUNDARY]); + (TAKE_TAC); + + (ABBREV_TAC `dd4 = max dd3 (&1)`); + (ABBREV_TAC `ss1 = (&4) pow 3 * cc4 * cc3`); + (ABBREV_TAC `ss = &1 / &2 * dd4 * ss1`); + + (ABBREV_TAC `c:real = -- (dd + ss)`); + (EXISTS_TAC `c:real`); + + +(* ============================================================================ *) + + (REPEAT STRIP_TAC); + (NEW_GOAL `!X. mcell_set V X /\ critical_edgeX V X = {} ==> + gammaX V X lmfun >= &0`); + (UP_ASM_TAC THEN REWRITE_TAC[TSKAJXY_statement]); + (STRIP_TAC); + (ASM_SIMP_TAC[]); + + (ABBREV_TAC `B = {X | X SUBSET ball (vec 0, r) /\ mcell_set V X}`); + (ABBREV_TAC `B0 = {X | X SUBSET ball (vec 0,r) /\ mcell_set V X /\ + critical_edgeX V X = {}}`); + (ABBREV_TAC `B1 = {X | X SUBSET ball (vec 0,r) /\ mcell_set V X /\ + ~(critical_edgeX V X = {})}`); + (NEW_GOAL `FINITE (B1:(real^3->bool)->bool)`); + (EXPAND_TAC "B1"); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (vec 0,r) /\ mcell_set V X}`); + (STRIP_TAC); + (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA]); + (SET_TAC[]); + + (REWRITE_WITH `B = B0 UNION B1:(real^3->bool)->bool`); + (EXPAND_TAC "B" THEN EXPAND_TAC "B1" THEN EXPAND_TAC "B0"); + (SET_TAC[]); + (REWRITE_WITH `sum (B0 UNION B1) (\X. gammaX V X lmfun) = + sum B0 (\X. gammaX V X lmfun) + sum B1 (\X. gammaX V X lmfun)`); + (MATCH_MP_TAC SUM_UNION); + (REPEAT STRIP_TAC); + (EXPAND_TAC "B0"); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (vec 0,r) /\ mcell_set V X}`); + (STRIP_TAC); + (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA]); + (SET_TAC[]); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "B1" THEN EXPAND_TAC "B0"); + (SET_TAC[]); + (MATCH_MP_TAC (REAL_ARITH `&0 <= b /\ a <= c ==> a <= b + c`)); + (STRIP_TAC); + (MATCH_MP_TAC SUM_POS_LE); + (STRIP_TAC); + (EXPAND_TAC "B0"); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (vec 0,r) /\ mcell_set V X}`); + (STRIP_TAC); + (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA]); + (SET_TAC[]); + (REWRITE_TAC[BETA_THM; REAL_ARITH `&0 <= a <=> a >= &0`]); + (EXPAND_TAC "B0" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_SIMP_TAC[]); + + (REWRITE_WITH + `sum B1 (\X. gammaX V X lmfun) = + sum B1 (\X. (gammaX V X lmfun) * + sum (critical_edgeX V X) (\e. critical_weight V X))`); + (MATCH_MP_TAC SUM_EQ); + (EXPAND_TAC "B1" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[critical_weight]); + (REWRITE_WITH + `sum (critical_edgeX V x) (\e. &1 / &(CARD (critical_edgeX V x))) = + &(CARD (critical_edgeX V x)) * (&1 / &(CARD (critical_edgeX V x)))`); + (MATCH_MP_TAC SUM_CONST); + (REWRITE_TAC[FINITE_critical_edgeX]); + (REWRITE_TAC[REAL_ARITH `a * &1 / a = a / a`]); + (REWRITE_WITH `&(CARD (critical_edgeX V x)) / &(CARD (critical_edgeX V x)) = &1`); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_OF_NUM_EQ]); + (REWRITE_WITH `CARD (critical_edgeX V x) = 0 <=> critical_edgeX V x = {}`); + (MATCH_MP_TAC CARD_EQ_0); + (REWRITE_TAC[FINITE_critical_edgeX]); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + +(* ------------------------------------------------------------------------- *) +(* Hint: - See proofs of KIZHLTL1; KIZHLTL2 to adapt *) +(* ------------------------------------------------------------------------- *) + + (REWRITE_TAC[GSYM SUM_LMUL]); + + (ABBREV_TAC `T1:real^3->bool = V INTER ball (vec 0, r)`); + (ABBREV_TAC `T2 = {{u0, u1:real^3} | u0 IN T1 /\ u1 IN T1 /\ ~(u0 = u1) /\ + hl [u0; u1] <= hplus}`); + (NEW_GOAL `FINITE (T2:(real^3->bool)->bool)`); + (EXPAND_TAC "T2" THEN MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{{u0, u1:real^3} | u0 IN T1 /\ u1 IN T1}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SET_PRODUCT_KY_LEMMA); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC Pack2.KIUMVTC); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + + (REWRITE_WITH + `sum B1 (\X. sum (critical_edgeX V X) + (\x. gammaX V X lmfun * critical_weight V X)) = + sum B1 (\X. sum {y:real^3->bool| y IN T2 /\ critical_edgeX V X y} + (\x. gammaX V X lmfun * critical_weight V X))`); + (MATCH_MP_TAC SUM_EQ); + (EXPAND_TAC "B1" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_TAC[SET_RULE `a = b <=> b SUBSET a /\ a SUBSET b`]); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[SET_RULE `A SUBSET {y | T2 y /\ A y} <=> A SUBSET T2`]); + (EXPAND_TAC "T2" THEN REWRITE_TAC[SUBSET; critical_edgeX; IN; IN_ELIM_THM; edgeX]); + (REPEAT STRIP_TAC); + (EXPAND_TAC "T1" THEN REWRITE_TAC[IN_ELIM_THM]); + (EXISTS_TAC `u':real^3` THEN EXISTS_TAC `v':real^3`); + (REWRITE_TAC[ASSUME `~(u' = v':real^3)`]); + + (REWRITE_TAC[ASSUME `x' = {u, v:real^3}`; MESON[IN] `V (x:real^3) <=> x IN V`; + GSYM (ASSUME `{u, v} = {u', v':real^3}`); IN_INTER]); + + (NEW_GOAL `VX V x = V INTER x`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (UNDISCH_TAC `mcell_set V x` THEN REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (STRIP_TAC); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (NEW_GOAL `VX V x = {}`); + (REWRITE_TAC[VX]); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `VX V x u'` THEN ASM_REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`]); + (SET_TAC[]); + + (STRIP_TAC); + (ASM_SET_TAC[]); + (STRIP_TAC); + (ASM_SET_TAC[]); + (REWRITE_WITH `hl [u'; v':real^3] = hl [u; v:real^3]`); + (ASM_REWRITE_TAC[HL; set_of_list]); + (ASM_REWRITE_TAC[]); + + (ABBREV_TAC `f = (\X. (\x:real^3->bool. + gammaX V X lmfun * critical_weight V X))`); + (REWRITE_WITH + `sum B1 (\X. sum {y | y IN T2 /\ critical_edgeX V X y} + (\x:real^3->bool. gammaX V X lmfun * critical_weight V X)) = + sum B1 (\X. sum {y | y IN T2 /\ critical_edgeX V X y} + (\x:real^3->bool. f X x))`); + (EXPAND_TAC "f" THEN REFL_TAC); + (REWRITE_WITH + `sum B1 (\X. sum {y | y IN T2 /\ critical_edgeX V X y} (\x. f X x)) = + sum T2 (\x. sum {X | X IN B1 /\ critical_edgeX V X x} (\X. f X x))`); + (ASM_SIMP_TAC[SUM_SUM_RESTRICT]); + + (EXPAND_TAC "B1" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REWRITE_TAC[MESON[] `(A/\B/\C)/\D <=> A/\B/\C/\D`]); + (REWRITE_WITH +`sum T2 (\x. sum + {X | X SUBSET ball (vec 0,r) /\ mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ critical_edgeX V X x} + (\X. f X x)) = + sum T2 (\x. sum {X | mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ critical_edgeX V X x} + (\X. f X x)) - +sum T2 (\x. sum {X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ critical_edgeX V X x} + (\X. f X x))`); + (REWRITE_TAC[REAL_ARITH `a = b - c <=> b = a + c`]); + (REWRITE_WITH +` sum T2 + (\x. sum + {X | X SUBSET ball (vec 0,r) /\ mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ critical_edgeX V X x} + (\X. f X x)) + + sum T2 + (\x. sum + {X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ critical_edgeX V X x} + (\X. f X x)) = + sum T2 + (\x. (\x. sum + {X | X SUBSET ball (vec 0,r) /\ mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ critical_edgeX V X x} + (\X. f X x)) x + +(\x. sum + {X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ critical_edgeX V X x} + (\X. f X x)) x)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC SUM_ADD); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SUM_EQ); + (REWRITE_TAC[BETA_THM] THEN REPEAT STRIP_TAC); + + (REWRITE_WITH +`sum + {X | X SUBSET ball (vec 0,r) /\ + mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ + critical_edgeX V X x} + (\X. f X x) + + sum + {X | ~(X SUBSET ball (vec 0,r)) /\ + mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ + critical_edgeX V X x} + (\X. f X x) = + sum ({X | X SUBSET ball (vec 0,r) /\ + mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ + critical_edgeX V X x} UNION + {X | ~(X SUBSET ball (vec 0,r)) /\ + mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ + critical_edgeX V X x}) + (\X. f X x)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC SUM_UNION); + (REPEAT STRIP_TAC); + + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `B1:(real^3->bool)->bool`); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "B1" THEN SET_TAC[]); + + (UP_ASM_TAC THEN EXPAND_TAC "T2"); + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (vec 0,r + &8) /\ mcell_set V X}`); + (STRIP_TAC); + (ASM_SIMP_TAC[Marchal_cells_3.FINITE_MCELL_SET_LEMMA]); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `x SUBSET VX V x'`); + (UNDISCH_TAC `critical_edgeX V x' x` THEN REWRITE_TAC[critical_edgeX;edgeX]); + (REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[ASSUME `x = {u, v:real^3}`; ASSUME `{u, v:real^3} = {u', v'}`]); + (SET_TAC[ASSUME `VX V x' u'`; ASSUME `VX V x' v'`]); + (NEW_GOAL `VX V x' = V INTER x'`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (UNDISCH_TAC `mcell_set V x'` THEN REWRITE_TAC[mcell_set; IN_ELIM_THM; IN]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (NEW_GOAL `VX V x' = {}`); + (ASM_REWRITE_TAC[VX]); + (UNDISCH_TAC `x SUBSET VX V x'` THEN REWRITE_TAC[ASSUME `VX V x' = {}`]); + (REWRITE_TAC[ASSUME `x = {u0, u1:real^3}`] THEN SET_TAC[]); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) x <=> x IN A`; IN_BALL]); + (NEW_GOAL `dist (vec 0, x'') <= dist (vec 0, u0:real^3) + dist (u0, x'')`); + (NORM_ARITH_TAC); + (NEW_GOAL `dist (vec 0, u0:real^3) < r`); + (REWRITE_TAC[GSYM IN_BALL]); + (UNDISCH_TAC `(T1:real^3->bool) u0` THEN EXPAND_TAC "T1"); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) x <=> x IN A`] THEN SET_TAC[]); + (NEW_GOAL `dist (u0, x'':real^3) < &8`); + (REWRITE_TAC[GSYM IN_BALL]); + (NEW_GOAL `x' SUBSET ball (u0:real^3,&8)`); + (UNDISCH_TAC `mcell_set V x'` THEN REWRITE_TAC[mcell_set; IN_ELIM_THM; IN]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC MCELL_SUBSET_BALL8); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[GSYM (ASSUME `x' = mcell i V ul`)]); + (UNDISCH_TAC `x SUBSET VX V x'` THEN UNDISCH_TAC `VX V x' = V INTER x'`); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + (SUBGOAL_THEN `(x'':real^3) IN x'` MP_TAC); + (UNDISCH_TAC `(x':real^3->bool) x''` THEN SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + + (REWRITE_WITH ` ({X | X SUBSET ball (vec 0,r) /\ + mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ + critical_edgeX V X x} UNION + {X | ~(X SUBSET ball (vec 0,r)) /\ + mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ + critical_edgeX V X x}) = + {X | mcell_set V X /\ ~(critical_edgeX V X = {}) /\ critical_edgeX V X x}`); + (SET_TAC[]); + (REWRITE_WITH + `(\x. sum + {X | mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ critical_edgeX V X x} (\X. f X x)) = + (\x. sum + {X | mcell_set V X /\ critical_edgeX V X x} (\X. f X x))`); + (REWRITE_TAC[FUN_EQ_THM]); + (STRIP_TAC); + (REWRITE_WITH +`{X | mcell_set V X /\ + ~(!x. critical_edgeX V X x <=> {} x) /\ critical_edgeX V X x} = + {X | mcell_set V X /\ critical_edgeX V X x}`); + (REWRITE_TAC[SET_RULE `A = B <=> A SUBSET B /\ B SUBSET A`]); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[MESON[IN] `(A:(real^3->bool)->bool) x <=> x IN A`]); + (SET_TAC[]); + (ASM_REWRITE_TAC[]); + + (REWRITE_WITH + ` (\x. sum + {X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ + ~(critical_edgeX V X = {}) /\ critical_edgeX V X x} (\X. f X x)) = + (\x. sum + {X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ + critical_edgeX V X x} (\X. f X x))`); + (REWRITE_TAC[FUN_EQ_THM]); + (STRIP_TAC); + (REWRITE_WITH +`{X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ + ~(!x. critical_edgeX V X x <=> {} x) /\ critical_edgeX V X x} = + {X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ critical_edgeX V X x}`); + (REWRITE_TAC[SET_RULE `A = B <=> A SUBSET B /\ B SUBSET A`]); + (STRIP_TAC); + (SET_TAC[]); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM]); + (GEN_TAC THEN DISCH_TAC); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REPEAT STRIP_TAC); + (SWITCH_TAC THEN UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[MESON[IN] `(A:(real^3->bool)->bool) x <=> x IN A`]); + (SET_TAC[]); + +(* OK here *) + + (MATCH_MP_TAC (REAL_ARITH `(?x. c <= x /\ a + x <= b) ==> a <= b - c`)); + (EXISTS_TAC `dd * r pow 2`); + (STRIP_TAC); + + (ABBREV_TAC + `T3:real^3->bool = V INTER ball (vec 0, r) DIFF ball (vec 0, r - &8)`); + (ABBREV_TAC `T4 = {{u0:real^3, u1} | u0 IN T3 /\ u1 IN T3 /\ + ~(u0 = u1) /\ hl [u0; u1] <= hplus}`); + (REWRITE_WITH `sum T2 + (\x. sum + {X | ~(X SUBSET ball (vec 0,r)) /\ + mcell_set V X /\ + critical_edgeX V X x} + (\X. f X x)) = sum T4 + (\x. sum + {X | ~(X SUBSET ball (vec 0,r)) /\ + mcell_set V X /\ + critical_edgeX V X x} + (\X. f X x))`); + + (EXPAND_TAC "T2"); + (MATCH_MP_TAC SUM_SUPERSET); + (STRIP_TAC); + (EXPAND_TAC "T4" THEN EXPAND_TAC "T1" THEN EXPAND_TAC "T3" THEN SET_TAC[]); + + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (REWRITE_WITH + `{X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ critical_edgeX V X x} = + {}`); + (REWRITE_TAC[SET_RULE `x = {} <=> ~(?s. s IN x)`]); + (REWRITE_TAC[IN; IN_ELIM_THM] THEN STRIP_TAC); + + (NEW_GOAL `(x:real^3->bool) SUBSET s`); + (MATCH_MP_TAC CRITICAL_EDGEX_SUBSET_MCELL); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + + (NEW_GOAL `?p:real^3. p IN s DIFF ball (vec 0,r)`); + (UNDISCH_TAC `~(s SUBSET ball ((vec 0):real^3,r))` THEN SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[IN_DIFF; IN_BALL; REAL_ARITH + `~(a < r) <=> r <= a`] THEN STRIP_TAC); + (NEW_GOAL `s SUBSET ball (p:real^3,&8)`); + (MATCH_MP_TAC MCELL_SUBSET_BALL8_2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `u0:real^3 IN ball (p,&8) /\ u1 IN ball (p,&8)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL] THEN STRIP_TAC); + (UNDISCH_TAC `~(T4:(real^3->bool)->bool) x`); + (REWRITE_TAC[MESON[IN] `(T4:(real^3->bool)->bool) x <=> x IN T4`]); + (EXPAND_TAC "T4" THEN EXPAND_TAC "T3" THEN REWRITE_TAC[IN_INTER; IN_DIFF; IN_BALL]); + (REWRITE_TAC[IN; IN_ELIM_THM]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN ASM_REWRITE_TAC[]); + (UNDISCH_TAC `(T1:(real^3->bool)) u0` THEN + UNDISCH_TAC `(T1:(real^3->bool)) u1`); + (REWRITE_WITH `!x. T1 x <=> x:real^3 IN T1`); + (ASM_REWRITE_TAC[IN]); + (EXPAND_TAC "T1" THEN REWRITE_TAC[IN_INTER; IN_BALL]); + (REWRITE_TAC[IN] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `dist (vec 0,p) <= dist (p, u0) + dist (vec 0, u0:real^3)`); + (NORM_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `dist (vec 0,p) <= dist (p, u1) + dist (vec 0, u1:real^3)`); + (NORM_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[SUM_CLAUSES]); + + (MATCH_MP_TAC (REAL_ARITH `(?x. a <= x /\ x <= b) ==> a <= b`)); + (EXISTS_TAC `sum T4 (\x:real^3->bool. cc2 * cc1)`); + (STRIP_TAC); + (MATCH_MP_TAC SUM_LE); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{{u0:real^3, u1} | u0 IN T3 /\ u1 IN T3}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (ABBREV_TAC `S_temp = {u0, u1:real^3 | u0 IN T3 /\ u1 IN T3}`); + (ABBREV_TAC `f_temp = (\(u0,u1:real^3). {u0, u1})`); + (EXISTS_TAC `IMAGE (f_temp:real^3#real^3->real^3->bool) S_temp`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE); + (EXPAND_TAC "S_temp" THEN MATCH_MP_TAC FINITE_PRODUCT THEN REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `T1:real^3->bool`); + (STRIP_TAC); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (EXPAND_TAC "f_temp" THEN EXPAND_TAC "S_temp" THEN + REWRITE_TAC[IMAGE; SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u0:real^3, u1:real^3` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (REWRITE_TAC[IN] THEN EXPAND_TAC "T4" THEN EXPAND_TAC "T3" THEN + REWRITE_TAC[ABS_SIMP; IN_DIFF; IN_INTER; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (MATCH_MP_TAC (REAL_ARITH `(?x. a <= x /\ x <= b) ==> a <= b`)); + (EXISTS_TAC + `sum {X| ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ critical_edgeX V X x} + (\x. cc1)`); + (STRIP_TAC); + (MATCH_MP_TAC SUM_LE); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | mcell_set V X /\ edgeX V X x}`); + (STRIP_TAC); + (MATCH_MP_TAC Marchal_cells_3.FINITE_EDGE_X2); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[critical_edgeX] THEN SET_TAC[]); + (REWRITE_TAC[BETA_THM; ABS_SIMP; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXPAND_TAC "f"); + (NEW_GOAL `critical_weight V x' <= &1`); + (REWRITE_TAC[critical_weight]); + (REWRITE_WITH `&1 / &(CARD (critical_edgeX V x')) <= &1 <=> + &1 <= &(CARD (critical_edgeX V x'))`); + (MATCH_MP_TAC Packing3.REAL_DIV_LE_1); + (REWRITE_TAC[REAL_OF_NUM_LT; ARITH_RULE `0 < a <=> ~(a = 0)`]); + (REWRITE_WITH `CARD (critical_edgeX V x') = 0 <=> critical_edgeX V x' = {}`); + (MATCH_MP_TAC CARD_EQ_0); + (REWRITE_TAC[critical_edgeX; edgeX] THEN MATCH_MP_TAC FINITE_SUBSET); + + (EXISTS_TAC `{{u0:real^3, u1} | u0 IN VX V x' /\ u1 IN VX V x'}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (ABBREV_TAC `S_temp = {u0, u1:real^3 | u0 IN VX V x' /\ u1 IN VX V x'}`); + (ABBREV_TAC `f_temp = (\(u0,u1:real^3). {u0, u1})`); + (EXISTS_TAC `IMAGE (f_temp:real^3#real^3->real^3->bool) S_temp`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE); + (EXPAND_TAC "S_temp" THEN MATCH_MP_TAC FINITE_PRODUCT THEN REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_VX); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "f_temp" THEN EXPAND_TAC "S_temp" THEN + REWRITE_TAC[IMAGE; SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u0':real^3, u1':real^3` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `u0':real^3` THEN EXISTS_TAC `u1':real^3` THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (REWRITE_TAC[REAL_OF_NUM_LE; ARITH_RULE `1 <= a <=> ~(a = 0)`]); + (REWRITE_WITH `CARD (critical_edgeX V x') = 0 <=> critical_edgeX V x' = {}`); + (MATCH_MP_TAC CARD_EQ_0); + (REWRITE_TAC[critical_edgeX; edgeX] THEN MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{{u0:real^3, u1} | u0 IN VX V x' /\ u1 IN VX V x'}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (ABBREV_TAC `S_temp = {u0, u1:real^3 | u0 IN VX V x' /\ u1 IN VX V x'}`); + (ABBREV_TAC `f_temp = (\(u0,u1:real^3). {u0, u1})`); + (EXISTS_TAC `IMAGE (f_temp:real^3#real^3->real^3->bool) S_temp`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_IMAGE); + (EXPAND_TAC "S_temp" THEN MATCH_MP_TAC FINITE_PRODUCT THEN REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_VX); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "f_temp" THEN EXPAND_TAC "S_temp" THEN + REWRITE_TAC[IMAGE; SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u0':real^3, u1':real^3` THEN ASM_REWRITE_TAC[]); + (EXISTS_TAC `u0':real^3` THEN EXISTS_TAC `u1':real^3` THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN SET_TAC[]); + (NEW_GOAL `&0 <= critical_weight V x'`); + (REWRITE_TAC[critical_weight] THEN MATCH_MP_TAC REAL_LE_DIV); + (REWRITE_TAC[REAL_ARITH `&0 <= &1`; REAL_OF_NUM_LE]); + (ARITH_TAC); + (NEW_GOAL `gammaX V x' lmfun <= cc1`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `gammaX V x' lmfun * critical_weight V x' <= cc1 * critical_weight V x'`); + + (ONCE_REWRITE_TAC[REAL_ARITH `(a <= b <=> &0 <= b - a)`]); + (REWRITE_TAC[REAL_ARITH `a * x - b * x = (a - b) * x`]); + (MATCH_MP_TAC REAL_LE_MUL THEN ASM_REAL_ARITH_TAC); + + (NEW_GOAL `cc1 * critical_weight V x' <= cc1`); + (ONCE_REWRITE_TAC[REAL_ARITH `(a <= b <=> &0 <= b - a)`]); + (REWRITE_WITH `!x b. b - b * x = b * (&1 - x)`); + (REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL THEN STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_WITH + `sum + {X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ critical_edgeX V X x} + (\x. cc1) = + &(CARD + {X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ critical_edgeX V X x}) + * cc1`); + (MATCH_MP_TAC SUM_CONST); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | mcell_set V X /\ edgeX V X x}`); + (STRIP_TAC); + (MATCH_MP_TAC Marchal_cells_3.FINITE_EDGE_X2); + (EXISTS_TAC `u0:real^3` THEN EXISTS_TAC `u1:real^3` THEN ASM_REWRITE_TAC[]); + (REWRITE_TAC[critical_edgeX] THEN SET_TAC[]); + + (ONCE_REWRITE_TAC[REAL_ARITH `(a <= b <=> &0 <= b - a)`]); + (REWRITE_TAC[REAL_ARITH `a * x - b * x = x * (a - b)`]); + (MATCH_MP_TAC REAL_LE_MUL THEN STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL + ` &(CARD + {X | ~(X SUBSET ball (vec 0,r)) /\ mcell_set V X /\ critical_edgeX V X x}) + <= &(CARD {X | mcell_set V X /\ VX V X u0})`); + (REWRITE_TAC[REAL_OF_NUM_LE] THEN MATCH_MP_TAC CARD_SUBSET); + (STRIP_TAC); + (ASM_REWRITE_TAC[critical_edgeX; edgeX; IN; IN_ELIM_THM]); + (SET_TAC[]); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (u0,&8) /\ mcell_set V X}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_MCELL_SET_LEMMA_2); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SUBSET]); + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (MATCH_MP_TAC MCELL_SUBSET_BALL8_2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `VX V x' = V INTER x'`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (UNDISCH_TAC `mcell_set V x'` THEN + REWRITE_TAC[mcell_set; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `VX V x' u0` THEN ASM_REWRITE_TAC[VX]); + (REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`]); + (SET_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + + (NEW_GOAL `&(CARD {X | mcell_set V X /\ VX V X u0}) <= cc2`); + (ASM_MESON_TAC[]); + + (ABBREV_TAC `s1_temp = &(CARD + {X | ~(X SUBSET ball (vec 0,r)) /\ + mcell_set V X /\ + critical_edgeX V X x})`); + (ABBREV_TAC `s2_temp = &(CARD {X | mcell_set V X /\ VX V X u0})`); + (ASM_REAL_ARITH_TAC); + + (ABBREV_TAC `g = (\x:real^3->bool. cc2 * cc1)`); + + (REWRITE_WITH + `sum T4 (g:(real^3->bool)->real) = + &1 / &2 * + sum {m,n | m IN T3 /\ n IN T3 /\ ~(m = n) /\ dist (m,n) <= &2 * hplus} + (\(m:real^3,n). g {m, n})`); + (ONCE_REWRITE_TAC[REAL_ARITH `a = &1 / &2 * b <=> b = &2 * a`]); + (EXPAND_TAC "T4"); + (REWRITE_TAC[HL_2; REAL_ARITH `inv (&2) * a <= b <=> a <= &2 * b`]); + (MATCH_MP_TAC SUM_PAIR_2_SET); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `T1:real^3->bool`); + (STRIP_TAC); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (REWRITE_TAC[REAL_ARITH `&1 / &2 * s <= t <=> s <= &2 * t`]); + + (ABBREV_TAC + `h = (\m:real^3. {n | n IN T3 /\ ~(m = n) /\ dist (m,n) <= &2 * hplus})`); + (REWRITE_WITH + `{m,n | m IN T3 /\ n IN T3 /\ ~(m = n) /\ dist (m,n) <= &2 * hplus} = + {m:real^3,n | m IN T3 /\ n IN h m}`); + (EXPAND_TAC "h"); + (SET_TAC[PAIR_EQ]); + (ABBREV_TAC `k = (\m n. (g:(real^3->bool)->real) {m,n})`); + (REWRITE_WITH `(\(m,n). (g:(real^3->bool)->real) {m, n}) = (\(m,n). k m n)`); + (REWRITE_TAC[FUN_EQ_THM]); + (STRIP_TAC); + (NEW_GOAL `(x:real^3#real^3) = FST x, SND x`); + (REWRITE_TAC[PAIR]); + (ONCE_REWRITE_TAC[ASSUME `(x:real^3#real^3) = FST x, SND x`]); + (EXPAND_TAC "k" THEN REWRITE_TAC[]); + (REWRITE_WITH + `sum {m:real^3,n:real^3 | m IN T3 /\ n IN h m} (\(m,n). k m n) = + sum T3 (\m. sum (h m) (k m))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC SUM_SUM_PRODUCT); + (STRIP_TAC); + + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `T1:real^3->bool`); + (STRIP_TAC); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (REPEAT STRIP_TAC); + (EXPAND_TAC "h"); + + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `T3:real^3->bool`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `T1:real^3->bool`); + (STRIP_TAC); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (SET_TAC[]); + + (EXPAND_TAC "k" THEN EXPAND_TAC "g"); + (NEW_GOAL `sum T3 (\m. sum ((h:real^3->real^3->bool) m) (\n. cc2 * cc1)) <= + sum T3 (\m. (&4) pow 3 * cc2 * cc1)`); + (MATCH_MP_TAC SUM_LE); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `T1:real^3->bool`); + (STRIP_TAC); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (EXPAND_TAC "h" THEN REPEAT STRIP_TAC THEN REWRITE_TAC[]); + (REWRITE_WITH + `sum {n:real^3 | n IN T3 /\ ~(x = n) /\ + dist (x,n) <= &2 * hplus} (\n. cc2 * cc1) = + &(CARD {n | n IN T3 /\ ~(x = n) /\ dist (x,n) <= &2 * hplus}) * + (cc2 * cc1)`); + (MATCH_MP_TAC SUM_CONST); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `T3:real^3->bool`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `T1:real^3->bool`); + (STRIP_TAC); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (SET_TAC[]); + + (ONCE_REWRITE_TAC[REAL_ARITH `(a <= b <=> &0 <= b - a)`]); + (REWRITE_TAC[REAL_ARITH `a * x - b * x = (a - b) * x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ONCE_REWRITE_TAC[GSYM (REAL_ARITH `(a <= b <=> &0 <= b - a)`)]); + + + (NEW_GOAL + `&(CARD {n | n IN T3 /\ ~(x = n) /\ dist (x,n) <= &2 * hplus}) <= + &(CARD (V INTER ball (x:real^3, &3)))`); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (STRIP_TAC); + (EXPAND_TAC "T3" THEN REWRITE_TAC[IN_DIFF; IN_BALL]); + (REWRITE_TAC[IN_INTER; IN_BALL; IN_ELIM_THM; SUBSET; IN]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `&2 * hplus < &3`); + (REWRITE_TAC[hplus] THEN REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `&(CARD (V INTER ball (x:real^3,&3))) <= &4 pow 3`); + (REWRITE_TAC[REAL_ARITH `&4 = &3 + &1`]); + (MATCH_MP_TAC BOUNDS_VGEN_klemma); + (ASM_REWRITE_TAC[REAL_ARITH `&0 <= &3`]); + (ABBREV_TAC + `s1 = &(CARD {n:real^3 | n IN T3 /\ ~(x = n) /\ dist (x,n) <= &2 * hplus})`); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `sum T3 (\m:real^3. &4 pow 3 * cc2 * cc1) <= &2 * dd * r pow 2`); + (REWRITE_WITH + `sum T3 (\m:real^3. &4 pow 3 * cc2 * cc1) = + &(CARD T3) * &4 pow 3 * cc2 * cc1`); + (MATCH_MP_TAC SUM_CONST); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `T1:real^3->bool`); + (STRIP_TAC); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (EXPAND_TAC "dd"); + + (ONCE_REWRITE_TAC[REAL_ARITH `(a <= b <=> &0 <= b - a)`]); + (REWRITE_TAC[REAL_ARITH + `&2 * (&1 / &2 * dd2 * &4 pow 3 * cc2 * cc1) * r pow 2 - + &(CARD (T3:real^3->bool)) * &4 pow 3 * cc2 * cc1 = + (&4 pow 3 * cc2 * cc1) * (dd2 * r pow 2 - &(CARD T3))`]); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (REWRITE_TAC[REAL_ARITH `&0 <= &4 pow 3 * x <=> &0 <= x`]); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + (ONCE_REWRITE_TAC[GSYM (REAL_ARITH `(a <= b <=> &0 <= b - a)`)]); + (EXPAND_TAC "T3"); + + (ONCE_REWRITE_TAC[SET_RULE `A INTER B DIFF C = A INTER B DIFF A INTER C`]); + (MATCH_MP_TAC (REAL_ARITH `(?x. a <= x /\ x <= b) ==> a <= b`)); + (EXISTS_TAC `dd1 * r pow 2`); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[REAL_ARITH `(a <= b <=> &0 <= b - a)`]); + (REWRITE_TAC[REAL_ARITH `a * x - b * x = (a - b ) * x`]); + (MATCH_MP_TAC REAL_LE_MUL THEN STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_LE_POW_2]); + (ASM_REAL_ARITH_TAC); + +(* ======================================================================== *) +(* CHECK DEN DAY LA OK ROI - (._o) (0_o) *) +(* ==================================================================== *) + + (REWRITE_WITH + `sum T2 (\x. sum {X | mcell_set V X /\ critical_edgeX V X x} (\X. f X x)) = + sum T2 (\e. cluster_gamma_v1 V e (cell_cluster V e)) - + sum T2 (\x. sum {X | mcell_set V X /\ critical_edgeX V X x} (beta_bump_v1 V x))`); + (REWRITE_TAC[REAL_ARITH `a = b - c <=> b = a + c`]); + (ABBREV_TAC + `f1 = (\x. sum {X | mcell_set V X /\ critical_edgeX V X x} (\X. f X x))`); + (ABBREV_TAC + `f2 = (\x. sum {X | mcell_set V X /\ critical_edgeX V X x} (beta_bump_v1 V x))`); + (REWRITE_WITH + `sum T2 (\e. cluster_gamma_v1 V e (cell_cluster V e)) = + sum T2 (\e:real^3->bool. f1 e + f2 e)`); + (MATCH_MP_TAC SUM_EQ); + (EXPAND_TAC "T2" THEN REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXPAND_TAC "f1" THEN EXPAND_TAC "f2" THEN REWRITE_TAC[cluster_gamma_v1; cell_cluster]); + (REWRITE_TAC[FUN_EQ_THM] THEN REPEAT STRIP_TAC); + (EXPAND_TAC "f"); + (REWRITE_TAC[SET_RULE `{X | x IN critical_edgeX V X /\ mcell_set V X} = + {X | mcell_set V X /\ critical_edgeX V X x}`]); + (MATCH_MP_TAC SUM_ADD); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (u0,&8) /\ mcell_set V X}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_MCELL_SET_LEMMA_2); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[SUBSET]); + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (MATCH_MP_TAC MCELL_SUBSET_BALL8_2); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `VX V x' = V INTER x'`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (UNDISCH_TAC `mcell_set V x'` THEN + REWRITE_TAC[mcell_set; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[]); + (STRIP_TAC); + (UNDISCH_TAC `critical_edgeX V x' x` THEN + REWRITE_TAC[critical_edgeX; edgeX; IN; IN_ELIM_THM] THEN STRIP_TAC); + (NEW_GOAL `VX V x' u0`); + (NEW_GOAL `u0 = u' \/ u0 = v':real^3`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[ASSUME `u0 = u':real^3`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `u0 = v':real^3`]); + (ASM_REWRITE_TAC[]); + + (UNDISCH_TAC `VX V x' u0` THEN ASM_REWRITE_TAC[VX]); + (REWRITE_TAC[MESON[IN] `{} x <=> x IN {}`]); + (SET_TAC[]); + + (NEW_GOAL `VX V x' u0`); + (UNDISCH_TAC `mcell_set V x'` THEN + REWRITE_TAC[mcell_set; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (UNDISCH_TAC `critical_edgeX V x' x` THEN + REWRITE_TAC[critical_edgeX; edgeX; IN; IN_ELIM_THM] THEN STRIP_TAC); + (NEW_GOAL `u0 = u' \/ u0 = v':real^3`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (REWRITE_TAC[ASSUME `u0 = u':real^3`]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ASSUME `u0 = v':real^3`]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN UP_ASM_TAC THEN SET_TAC[]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SUM_ADD); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC (REAL_ARITH `&0 <= a /\ b + x <= &0 ==> x <= a - b`)); + (STRIP_TAC); + (MATCH_MP_TAC SUM_POS_LE); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "T2" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + + (UNDISCH_TAC `cell_cluster_estimate_v1 V`); + (REWRITE_TAC[cell_cluster_estimate_v1]); + (REWRITE_TAC[REAL_ARITH `&0 <= a <=> a >= &0`] THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (ABBREV_TAC + `f1 = (\x. sum {X | X SUBSET ball (vec 0, r + &8) /\ + ~(X SUBSET ball (vec 0, r - &8)) /\ + mcell_set V X /\ + critical_edgeX V X x} (beta_bump_v1 V x))`); + (ABBREV_TAC + `f2 = (\x. sum {X | X SUBSET ball (vec 0, r - &8) /\ mcell_set V X /\ + critical_edgeX V X x} (beta_bump_v1 V x))`); + (REWRITE_WITH + `sum T2 (\x. sum {X | mcell_set V X /\ critical_edgeX V X x} (beta_bump_v1 V x)) + = sum (T2:(real^3->bool)->bool) f1 + sum T2 f2`); + (REWRITE_WITH + `sum (T2:(real^3->bool)->bool) f1 + sum T2 f2 = sum T2 (\x. f1 x + f2 x)`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC SUM_ADD); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC SUM_EQ); + (EXPAND_TAC "T2" THEN REWRITE_TAC[IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (EXPAND_TAC "f1" THEN EXPAND_TAC "f2"); + (ABBREV_TAC + `s1 = {X | X SUBSET ball (vec 0,r + &8) /\ ~(X SUBSET ball (vec 0,r - &8)) /\ + mcell_set V X /\ critical_edgeX V X x}`); + (ABBREV_TAC `s2 = {X | X SUBSET ball (vec 0,r - &8) /\ mcell_set V X /\ + critical_edgeX V X x}`); + (REWRITE_WITH `{X | mcell_set V X /\ critical_edgeX V X x} = s1 UNION s2`); + (EXPAND_TAC "s1" THEN EXPAND_TAC "s2" THEN + REWRITE_TAC[SET_EQ_LEMMA; IN_UNION; IN_ELIM_THM; IN]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + + (ASM_CASES_TAC `x' SUBSET ball ((vec 0):real^3,r - &8)`); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[SUBSET; IN_DIFF; IN_BALL]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `x' SUBSET ball (u0:real^3, &8)`); + (MATCH_MP_TAC MCELL_SUBSET_BALL8_2); + + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `x:real^3->bool SUBSET x'`); + (MATCH_MP_TAC CRITICAL_EDGEX_SUBSET_MCELL); + (EXISTS_TAC `V:real^3->bool`); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (SET_TAC[]); + (NEW_GOAL `dist (u0:real^3, x'') < &8`); + (REWRITE_TAC[GSYM IN_BALL] THEN ASM_SET_TAC[]); + (NEW_GOAL `dist (vec 0, x'') <= dist (u0, x'') + dist (vec 0, u0:real^3)`); + (NORM_ARITH_TAC); + (NEW_GOAL `dist (vec 0, u0:real^3) < r`); + (REWRITE_TAC[GSYM IN_BALL]); + (UNDISCH_TAC `(T1:real^3->bool) u0`); + (EXPAND_TAC "T1" THEN REWRITE_TAC[MESON[IN] `(A:real^3->bool) x <=> x IN A`]); + (SET_TAC[]); + (ASM_REAL_ARITH_TAC); + (ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SUM_UNION); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (vec 0,r + &8) /\ mcell_set V X}`); + (STRIP_TAC); + (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA_2]); + (ASM_SET_TAC[]); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (vec 0,r - &8) /\ mcell_set V X}`); + (STRIP_TAC); + (ASM_SIMP_TAC[FINITE_MCELL_SET_LEMMA_2]); + (ASM_SET_TAC[]); + +(* ======================================================================== *) +(* ======================================================================== *) + + (EXPAND_TAC "s1" THEN EXPAND_TAC "s2" THEN SET_TAC[]); + + (REWRITE_WITH `sum (T2:(real^3->bool)->bool) f2 = &0`); + (EXPAND_TAC "f2"); + (REWRITE_TAC[SET_RULE + `!V r x. {X | X SUBSET ball (vec 0,r - &8) /\ mcell_set V X /\ + critical_edgeX V X x} = + {X | X IN {X| X SUBSET ball (vec 0,r - &8) /\ mcell_set V X} /\ + critical_edgeX V X x}`]); + (REWRITE_WITH + `sum T2 + (\x. sum + {X | X IN {X | X SUBSET ball (vec 0,r - &8) /\ mcell_set V X} /\ + critical_edgeX V X x} + (beta_bump_v1 V x)) = + sum T2 + (\x. sum + {X | X IN {X | X SUBSET ball (vec 0,r - &8) /\ mcell_set V X} /\ + critical_edgeX V X x} + (\X. beta_bump_v1 V x X))`); + (REWRITE_WITH `!x V. (\X. beta_bump_v1 V x X) = beta_bump_v1 V x`); + (REWRITE_TAC[FUN_EQ_THM] THEN ASM_REWRITE_TAC[]); + + (ABBREV_TAC `t = {X | X SUBSET ball (vec 0,r - &8) /\ mcell_set V X}`); + (ABBREV_TAC `g = beta_bump_v1 V`); + (ABBREV_TAC `s = T2:(real^3->bool)->bool`); + (REWRITE_WITH + `sum s (\x. sum {X | X IN t /\ critical_edgeX V X x} (\X. g x X)) = + sum t (\X. sum {x | x IN s /\ critical_edgeX V X x} (\x. g x X))`); + (MATCH_MP_TAC SUM_SUM_RESTRICT); + (STRIP_TAC); + (EXPAND_TAC "s" THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "t"); + (MATCH_MP_TAC FINITE_MCELL_SET_LEMMA); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "s" THEN EXPAND_TAC "t" THEN EXPAND_TAC "g"); + (MATCH_MP_TAC SUM_EQ_0); + (REWRITE_TAC[IN; IN_ELIM_THM] THEN REWRITE_TAC[] THEN REPEAT STRIP_TAC); + + (REWRITE_WITH `{x' | T2 x' /\ critical_edgeX V x x'} = + {x' | x' IN critical_edgeX V x}`); + (MATCH_MP_TAC (SET_RULE `A SUBSET B /\ B SUBSET A ==> A = B`)); + (STRIP_TAC); + (SET_TAC[]); + (ASM_REWRITE_TAC[IN]); + (REWRITE_TAC[GSYM (ASSUME `{{u0:real^3, u1} | u0 IN T1 /\ u1 IN T1 /\ + ~(u0 = u1) /\ hl [u0; u1] <= hplus} = s`)]); + + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM; critical_edgeX; edgeX]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `u':real^3` THEN EXISTS_TAC `v':real^3` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "T1"); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) x <=> x IN A`; IN_INTER; IN_BALL]); + (NEW_GOAL `VX V x = V INTER x`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (UNDISCH_TAC `mcell_set V x` THEN REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (STRIP_TAC); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[IN]); + (STRIP_TAC THEN UNDISCH_TAC `VX V x u'`); + (ASM_REWRITE_TAC[VX; MESON[IN] `{} x <=> x IN {}`] THEN SET_TAC[]); + (REWRITE_WITH `u':real^3 IN V /\ v' IN V`); + (ASM_SET_TAC[]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `u':real^3 IN ball (vec 0, r - &8)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL] THEN REAL_ARITH_TAC); + (NEW_GOAL `v':real^3 IN ball (vec 0, r - &8)`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL] THEN REAL_ARITH_TAC); + (REWRITE_WITH `hl [u'; v':real^3] = hl [u; v:real^3]`); + (REWRITE_TAC[HL; set_of_list]); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (EXISTS_TAC `u:real^3` THEN EXISTS_TAC `v:real^3`); + (ASM_REWRITE_TAC[]); + (EXISTS_TAC `u':real^3` THEN EXISTS_TAC `v':real^3`); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC Bump.SUM_BETA_BUMP_LEMMA); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[REAL_ARITH `a + &0 = a`]); + (EXPAND_TAC "T2"); + (REWRITE_TAC[HL_2; REAL_ARITH `inv (&2) * a <= b <=> a <= &2 * b`]); + (REWRITE_WITH + `sum {{u0:real^3, u1} | u0 IN T1 /\ u1 IN T1 /\ ~(u0 = u1) /\ + dist (u0,u1) <= &2 * hplus} f1 = + &1 / &2 * + sum {m,n | m IN T1 /\ n IN T1 /\ ~(m = n) /\ dist (m,n) <= &2 * hplus} + (\(m,n). f1 {m, n})`); + (REWRITE_TAC[REAL_ARITH `a = &1 / &2 * b <=> b = &2 * a`]); + (MATCH_MP_TAC SUM_PAIR_2_SET); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA); + (ASM_REWRITE_TAC[]); + + (ABBREV_TAC + `T3 = V INTER ball ((vec 0):real^3,r) DIFF ball (vec 0, r - &16)`); + (REWRITE_WITH + `sum {m:real^3,n | m IN T1 /\ n IN T1 /\ ~(m = n) /\ dist (m,n) <= &2 * hplus} + (\(m,n). f1 {m, n}) = + sum {m,n | m IN T3 /\ n IN T1 /\ ~(m = n) /\ dist (m,n) <= &2 * hplus} + (\(m,n). f1 {m, n})`); + (MATCH_MP_TAC SUM_SUPERSET); + (STRIP_TAC); + (EXPAND_TAC "T1" THEN EXPAND_TAC "T3" THEN + REWRITE_TAC[SUBSET; IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (EXISTS_TAC `m:real^3` THEN EXISTS_TAC `n:real^3` THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "T1" THEN UNDISCH_TAC + `(V INTER ball ((vec 0):real^3,r) DIFF ball (vec 0,r - &16)) m` THEN + REWRITE_TAC[MESON[IN] `(A:real^3->bool) x <=> x IN A`]); + (SET_TAC[]); + (EXPAND_TAC "T1" THEN EXPAND_TAC "T3" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "f1"); + (REWRITE_WITH + `{X | X SUBSET ball (vec 0,r + &8) /\ + ~(X SUBSET ball (vec 0,r - &8)) /\ + mcell_set V X /\ + critical_edgeX V X {m, n}} = {}`); + (REWRITE_TAC[SET_RULE `y = {} <=> ~(?x. x IN y)`]); + (REPEAT STRIP_TAC); + (UNDISCH_TAC `~(?m n. + ((V INTER ball (vec 0,r) DIFF ball (vec 0,r - &16)) m /\ + (V INTER ball (vec 0,r)) n /\ + ~(m = n) /\ + dist (m:real^3,n) <= &2 * hplus) /\ + x = m,n) ` THEN REWRITE_TAC[]); + (EXISTS_TAC `m:real^3` THEN EXISTS_TAC `n:real^3`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) x <=> x IN A`]); + (EXPAND_TAC "T3" THEN REWRITE_TAC[IN_DIFF; IN; IN_BALL]); + (ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (NEW_GOAL `?p:real^3. p IN x' /\ ~(p IN ball (vec 0,r - &8))`); + (UNDISCH_TAC `~(x' SUBSET ball ((vec 0):real^3,r - &8))`); + (SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[IN_BALL]); + (NEW_GOAL `x' SUBSET ball (p:real^3, &8)`); + (MATCH_MP_TAC MCELL_SUBSET_BALL8_2); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `m:real^3 IN x'`); + (UNDISCH_TAC `critical_edgeX V x' {m, n}` THEN + REWRITE_TAC[critical_edgeX; edgeX; IN_ELIM_THM; IN]); + (REPEAT STRIP_TAC); + + (NEW_GOAL `VX V x' = V INTER x'`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (UNDISCH_TAC `mcell_set V x'` THEN REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (STRIP_TAC); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[IN]); + (STRIP_TAC THEN UNDISCH_TAC `VX V x' u'`); + (ASM_REWRITE_TAC[VX; MESON[IN] `{} x <=> x IN {}`] THEN SET_TAC[]); + + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) x <=> x IN A`]); + (ASM_SET_TAC[]); + (NEW_GOAL `dist (p, m:real^3) < &8`); + (REWRITE_TAC[GSYM IN_BALL]); + (ASM_SET_TAC[]); + (NEW_GOAL `dist (vec 0, p) <= dist (vec 0, m:real^3) + dist (p, m)`); + (NORM_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[SUM_CLAUSES]); + + (ABBREV_TAC + `g = (\m:real^3. {n | n IN T1 /\ ~(m = n) /\ dist (m,n) <= &2 * hplus})`); + (REWRITE_WITH + `{m,n | m IN T3 /\ n IN T1 /\ ~(m = n) /\ dist (m,n) <= &2 * hplus} = + {m,n:real^3 | m IN T3 /\ n IN g m}`); + (EXPAND_TAC "g" THEN ASM_REWRITE_TAC[] THEN SET_TAC[]); + (ABBREV_TAC `h = (\m. (\n. (f1:(real^3->bool)->real) {m, n}))`); + (REWRITE_WITH `(\(m,n). (f1:(real^3->bool)->real) {m, n}) = + (\(m,n). h m n)`); + (REWRITE_TAC[FUN_EQ_THM]); + (STRIP_TAC THEN ASM_REWRITE_TAC[]); + (NEW_GOAL `x:real^3#real^3 = FST x, SND x`); + (REWRITE_TAC[PAIR]); + (ONCE_ASM_REWRITE_TAC[]); + (EXPAND_TAC "h" THEN REWRITE_TAC[]); + + (REWRITE_WITH `sum {m,n | m IN T3 /\ n IN g m} (\(m,n). h m n) = + sum T3 (\m. sum (g m) ((h:real^3->real^3->real) m))`); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC SUM_SUM_PRODUCT); + (STRIP_TAC); + + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `V:real^3->bool INTER ball (vec 0,r)`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "T3" THEN SET_TAC[]); + + (REPEAT STRIP_TAC); + (EXPAND_TAC "g" THEN REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `V:real^3->bool INTER ball (vec 0,r)`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "T1" THEN SET_TAC[]); + + (NEW_GOAL + `sum T3 (\m. sum ((g:real^3->real^3->bool) m) (h m)) <= + sum T3 (\n:real^3. ss1)`); + (MATCH_MP_TAC SUM_LE); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `V:real^3->bool INTER ball (vec 0,r)`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "T3" THEN SET_TAC[]); + (REPEAT STRIP_TAC THEN REWRITE_TAC[]); + + (NEW_GOAL `sum ((g:real^3->real^3->bool) x) (h x) <= sum (g x) (\x. cc4 * cc3)`); + (MATCH_MP_TAC SUM_LE); + (STRIP_TAC); + (EXPAND_TAC "g" THEN REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `V:real^3->bool INTER ball (vec 0,r)`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "T1" THEN SET_TAC[]); + + (REPEAT STRIP_TAC THEN EXPAND_TAC "h" THEN REWRITE_TAC[]); + (EXPAND_TAC "f1"); + (ABBREV_TAC `S1 = {X | X SUBSET ball (vec 0,r + &8) /\ + ~(X SUBSET ball (vec 0,r - &8)) /\ + mcell_set V X /\ + critical_edgeX V X {x, x'}}`); + (NEW_GOAL `sum (S1:(real^3->bool)->bool) (beta_bump_v1 V {x, x'}) <= + sum S1 (\x. cc3)`); + (MATCH_MP_TAC SUM_LE); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (vec 0,r + &8) /\ mcell_set V X}`); + (STRIP_TAC); + (REPEAT STRIP_TAC THEN REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_MCELL_SET_LEMMA); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "S1" THEN SET_TAC[]); + (REPEAT STRIP_TAC); + (REWRITE_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC); + (UP_ASM_TAC THEN EXPAND_TAC "S1" THEN REWRITE_TAC[IN; IN_ELIM_THM]); + (STRIP_TAC THEN ASM_REWRITE_TAC[]); + + (NEW_GOAL `sum S1 (\x:real^3->bool. cc3) = &(CARD S1) * cc3`); + (MATCH_MP_TAC SUM_CONST); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (vec 0,r + &8) /\ mcell_set V X}`); + (STRIP_TAC); + (REPEAT STRIP_TAC THEN REWRITE_TAC[]); + (MATCH_MP_TAC FINITE_MCELL_SET_LEMMA); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "S1" THEN SET_TAC[]); + (NEW_GOAL `&(CARD (S1:(real^3->bool)->bool)) <= cc4`); + (NEW_GOAL `&(CARD (S1:(real^3->bool)->bool)) <= + &(CARD {X | mcell_set V X /\ VX V X x})`); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (STRIP_TAC); + (EXPAND_TAC "S1" THEN + REWRITE_TAC[SUBSET; IN; IN_ELIM_THM; critical_edgeX; edgeX] THEN + REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `x:real^3 = u' \/ x = v'`); + (ASM_SET_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + (ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `{X | X SUBSET ball (x:real^3, &8) /\ mcell_set V X}`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_MCELL_SET_LEMMA_2); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[SUBSET; IN; IN_ELIM_THM] THEN REPEAT STRIP_TAC); + (REWRITE_TAC[MESON[IN] `(A:real^3->bool) x <=> x IN A`]); + (NEW_GOAL `VX V x'' = V INTER x''`); + (MATCH_MP_TAC Hdtfnfz.HDTFNFZ); + (UNDISCH_TAC `mcell_set V x''` THEN REWRITE_TAC[mcell_set; IN; IN_ELIM_THM]); + (STRIP_TAC); + (EXISTS_TAC `ul:(real^3)list` THEN EXISTS_TAC `i:num`); + (ASM_REWRITE_TAC[IN]); + (STRIP_TAC THEN UNDISCH_TAC `VX V x'' x`); + (ASM_REWRITE_TAC[VX; MESON[IN] `{} x <=> x IN {}`] THEN SET_TAC[]); + (NEW_GOAL `x'' SUBSET ball (x:real^3, &8)`); + (MATCH_MP_TAC MCELL_SUBSET_BALL8_2); + (EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]); + (ASM_SET_TAC[]); + (ASM_SET_TAC[]); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `&(CARD {X | mcell_set V X /\ VX V X x}) <= cc4`); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `x IN (T3:real^3->bool)` THEN EXPAND_TAC "T3"); + (SET_TAC[]); + (ABBREV_TAC `s_temp = &(CARD {X | mcell_set V X /\ VX V X x})`); + (ASM_REAL_ARITH_TAC); + (NEW_GOAL `sum (S1:(real^3->bool)->bool) (\x. cc3) <= cc4 * cc3`); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[REAL_ARITH `a <= b <=> &0 <= b - a`]); + (ONCE_REWRITE_TAC[REAL_ARITH `a * x - b * x = (a - b) * x`]); + (MATCH_MP_TAC REAL_LE_MUL THEN STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ABBREV_TAC `s_temp = sum (S1:(real^3->bool)->bool) (\x. cc3)`); + (ASM_REAL_ARITH_TAC); + + + + (NEW_GOAL `sum ((g:real^3->real^3->bool) x) (\x. cc4 * cc3) <= ss1`); + (REWRITE_WITH + `sum ((g:real^3->real^3->bool) x) (\x. cc4 * cc3) = + &(CARD (g x)) * cc4 * cc3`); + (MATCH_MP_TAC SUM_CONST); + (EXPAND_TAC "g"); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `T1:real^3->bool`); + (STRIP_TAC); + (EXPAND_TAC "T1" THEN MATCH_MP_TAC FINITE_PACK_LEMMA); + (ASM_REWRITE_TAC[]); + (SET_TAC[]); + + (NEW_GOAL `&(CARD ((g:real^3->real^3->bool) x)) <= + &(CARD (V INTER ball (x:real^3, &3)))`); + (REWRITE_TAC[REAL_OF_NUM_LE]); + (MATCH_MP_TAC CARD_SUBSET); + (STRIP_TAC); + (EXPAND_TAC "g" THEN EXPAND_TAC "T1" THEN + REWRITE_TAC[SUBSET; IN; IN_ELIM_THM; IN_INTER; IN_BALL]); + (REPEAT STRIP_TAC); + (ASM_REWRITE_TAC[]); + (NEW_GOAL `&2 * hplus < &3`); + (REWRITE_TAC[hplus] THEN REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (ASM_SIMP_TAC[FINITE_PACK_LEMMA]); + + (EXPAND_TAC "ss1"); + (ONCE_REWRITE_TAC[REAL_ARITH `a <= b <=> &0 <= b - a`]); + (ONCE_REWRITE_TAC[REAL_ARITH `a * x - b * x = (a - b) * x`]); + (MATCH_MP_TAC REAL_LE_MUL THEN STRIP_TAC); + (ONCE_REWRITE_TAC[GSYM (REAL_ARITH `a <= b <=> &0 <= b - a`)]); + (NEW_GOAL `&(CARD (V INTER ball (x:real^3,&3))) <= &4 pow 3`); + (REWRITE_TAC[REAL_ARITH `&4 = &3 + &1`]); + (MATCH_MP_TAC BOUNDS_VGEN_klemma); + (ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + + (ASM_REAL_ARITH_TAC); + + (EXPAND_TAC "g"); + (REWRITE_TAC[REAL_ARITH `&1 / &2 * x + a <= &0 <=> x <= &2 * (-- a)`]); + (REWRITE_TAC[REAL_ARITH `c * r pow 2 + d * r pow 2 = (c + d) * r pow 2`]); + (REWRITE_WITH `(c:real) + dd = -- ss`); + (EXPAND_TAC "c"); + (REAL_ARITH_TAC); + (REWRITE_TAC[REAL_ARITH `&2 * --(--ss * r pow 2) = &2 * ss * r pow 2`]); + (NEW_GOAL `sum T3 (\n:real^3. ss1) <= &2 * ss * r pow 2`); + (REWRITE_WITH `sum T3 (\n:real^3. ss1) = &(CARD (T3)) * ss1`); + (MATCH_MP_TAC SUM_CONST); + (MATCH_MP_TAC FINITE_SUBSET); + (EXISTS_TAC `(V:real^3->bool) INTER ball (vec 0,r)`); + (STRIP_TAC); + (MATCH_MP_TAC FINITE_PACK_LEMMA THEN ASM_REWRITE_TAC[]); + (EXPAND_TAC "T3" THEN SET_TAC[]); + (EXPAND_TAC "ss"); + (REWRITE_TAC[REAL_ARITH + `&2 * (&1 / &2 * dd4 * ss1) * r pow 2 = (dd4 * r pow 2) * ss1`]); + (ONCE_REWRITE_TAC[REAL_ARITH `a <= b <=> &0 <= b - a`]); + (ONCE_REWRITE_TAC[REAL_ARITH `a * x - b * x = (a - b) * x`]); + (MATCH_MP_TAC REAL_LE_MUL THEN STRIP_TAC); + (ONCE_REWRITE_TAC[GSYM (REAL_ARITH `a <= b <=> &0 <= b - a`)]); + (EXPAND_TAC "T3"); + (ONCE_REWRITE_TAC[SET_RULE `A INTER B DIFF C = A INTER B DIFF A INTER C`]); + + (MATCH_MP_TAC (REAL_ARITH `(?x. a <= x /\ x <= b) ==> a <= b`)); + (EXISTS_TAC `dd3 * r pow 2`); + (STRIP_TAC); + (FIRST_ASSUM MATCH_MP_TAC); + (ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[REAL_ARITH `(a <= b <=> &0 <= b - a)`]); + (REWRITE_TAC[REAL_ARITH `a * x - b * x = (a - b ) * x`]); + (MATCH_MP_TAC REAL_LE_MUL THEN STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (REWRITE_TAC[REAL_LE_POW_2]); + (EXPAND_TAC "ss1"); + (MATCH_MP_TAC REAL_LE_MUL); + (STRIP_TAC); + (ASM_REAL_ARITH_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REAL_ARITH_TAC); + + (REWRITE_WITH + `sum T3 (\m:real^3. sum {n | n IN T1 /\ ~(m = n) /\ dist (m,n) <= &2 * hplus} + (h m)) = + sum T3 (\m. sum (g m) (h m))`); + (EXPAND_TAC "g" THEN REWRITE_TAC[]); + (ASM_REAL_ARITH_TAC); + + (EXISTS_TAC `&0`); + (REPEAT STRIP_TAC); + (NEW_GOAL `F`); + (UNDISCH_TAC `~(saturated V /\ packing V)` THEN ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[])]);; + + +end;; diff --git a/text_formalization/strictbuild.hl b/text_formalization/strictbuild.hl new file mode 100644 index 0000000..ede756c --- /dev/null +++ b/text_formalization/strictbuild.hl @@ -0,0 +1,243 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Build for all chapters *) +(* Author: Thomas C. Hales *) +(* Date: 2010-07-14 *) +(* ========================================================================== *) + + +(* + Build file for Flyspeck project. + ocaml needs to be built with Unix. + ocamlmktop unix.cma str.cma nums.cma -o ocampl + + the system dependent string flyspeck should be set to the "text_formalization" path. + For example, on my system, I have added a line to my .bashrc file + export FLYSPECK_DIR="$HOME/Desktop/flyspeck_google/source/text_formalization" + + hol-light should already be loaded + #use "hol.ml";; + + *) +#load "str.cma";; + +(* HOL LIGHT *) +hol_version;; +needs "Multivariate/flyspeck.ml";; +needs "Rqe/num_calc_simp.ml";; + + +(* + +*) +let flyspeck_dir = + (try Sys.getenv "FLYSPECK_DIR" with Not_found -> Sys.getcwd());; + +let hollight_dir = + (try Sys.getenv "HOLLIGHT_DIR" with Not_found -> Sys.getcwd());; + + +(* bug: process_to_string does not close forked processes. + For example process_to_string ("date | grep 'Nov'" ), + leaves a process in the background. + I'm not sure why this happens. *) + +let process_to_string unixstring = + let p = Unix.open_process_in unixstring + and b = Buffer.create 64 in + let rec read () = Buffer.add_channel b p 1; read () in + try read () with End_of_file -> (Unix.close_process_in p; Buffer.contents b);; + +let load_date = process_to_string "date";; + +(* potential bug: + the svn version does not reflect recent commits, unless followed by an update. +*) + +let flyspeck_version() = "Flyspeck "^ + process_to_string ("svn info "^flyspeck_dir^ " | grep Revision");; + +let hollight_version() = "HOL Light "^ + process_to_string ("svnversion "^hollight_dir);; + +let ocaml_version() = "Ocaml "^Sys.ocaml_version;; + +let build_date() = "Build: " ^ process_to_string "date";; +let build_user() = "User: " ^ process_to_string "whoami";; +let indent = " ";; + +let build_report s = build_date() ^ + indent ^ build_user() ^ + indent ^ hollight_version() ^ + indent ^ flyspeck_version() ^ + indent ^ ocaml_version() ^ "\n" ^ indent^ s^ "\n";; + +let fullpath s = Filename.concat flyspeck_dir s;; + + +(* +Sys.command("svn info "^flyspeck_dir^" | grep Revison");; +*) + + + +(* boolean valued versions of Harrison's load files that return false + if load was not a success *) + +let use_file_b s = + if not(Sys.file_exists s) + then (report ("File not found "^s); false) + else + (Toploop.use_file Format.std_formatter s) or + (Format.print_string("Error in included file "^s); + Format.print_newline(); false);; + +let load_on_path_b p s = + let s' = file_on_path p s in + let fileid = (Filename.basename s',Digest.file s') in + (use_file_b s' && (loaded_files := fileid::(!loaded_files);true));; + +let loadb s = load_on_path_b (!load_path) s;; + +let needb s = + let s' = file_on_path (!load_path) s in + let fileid = (Filename.basename s',Digest.file s') in + if List.mem fileid (!loaded_files) + then (Format.print_string("File \""^s^"\" already loaded\n");true) + else loadb s;; + +(* debugging *) +loadt (fullpath "general/parser_verbose.hl");; +loadt (fullpath "general/debug.hl");; +Debug.set_verbose_parsing();; + + +(* limit changes in the state of the proof assistant *) + +let CHEAT_TAC = FAIL_TAC "cheaters never prosper";; +let new_axiom _ = failwith "new_axiom has been disabled.";; +let mk_thm _ = failwith "mk_thm has been disabled. Use mk_fthm";; + +loadt (fullpath "general/state_manager.hl");; +let reneeds s = loadt (fullpath s);; +let rflyspeck_needs = reneeds;; + +State_manager.neutralize_state();; + +let fileid s = + let s' = file_on_path (!load_path) (fullpath s) in + (Filename.basename s',Digest.file s');; + +(* The dependency calculation in flyspeck_needs still has a bug if the + file does not load correctly, but it calls another file that does load + correctly. It seems that the correctly loaded modules disappear from + the scope when the error is encountered. Thus, they should be + filtered out as well from the depend statement. For now, we offer + depend_reset to clear the error. +*) + +let (flyspeck_needs,filetable,depend,depend_reset) = + let ftable = ref [("pervasives",List.length (constants()))] in + (* associate constants with files *) + let depend = ref ([]:((string*Digest.t)*(string*Digest.t)) list) in + (* dependency table *) + let host = ref (fileid "build.hl") in + let fn = fun s-> + let id = fileid s in + if (List.mem id (!loaded_files)) + then Format.print_string("File \""^s^"\" already loaded\n") + else + ( + if List.mem (!host,id) (!depend) then failwith "There may be circular needs."; + depend := (!host,id)::(!depend); + let h = !host in + let _ = (host := id) in + let b= needb (fullpath s) in + let _ = (host := h) in + let _ = try State_manager.neutralize_state () with + Failure msg -> Format.print_string("File \""^s^ + "\"corrupted neutral state.\n"^msg^"\n") in + if b then ( + (ftable:= (s,List.length(constants()))::(!ftable)); + Format.print_string("File \""^s^"\" successfully loaded\n")) + else (depend := filter ((<>) (h,id)) (!depend); + failwith ("Aborting Flyspeck Needs "^s)) + ) in + (fn,(fun () -> !ftable),(fun() -> !depend),(fun() -> (depend:=[])));; + + + +(* disable "needs" for now *) +(* +let needs' = needs;; +let needs _ = failwith "Use flyspeck_needs rather than needs";; +*) + +(* utilities *) +flyspeck_needs "general/print_types.hl";; +flyspeck_needs "general/update_database_310.ml";; +flyspeck_needs "general/prove_by_refinement.hl";; +(* flyspeck_needs "general/flyspeck_utility.hl";; *) +let dest_goal gl = gl;; +let goal_asms = fst;; +let goal_concl = snd;; +let mk_goal(asl,w) = (asl,w);; + +(* verbose error reporting *) + + +let prove_by_refinement = Debug.verbose Prove_by_refinement.prove_by_refinement;; +let prove = Debug.verbose prove;; +let new_definition = Debug.verbose_1 new_definition;; +let ABBREV_TAC = Debug.verbose_1 ABBREV_TAC;; +let EXISTS_TAC = Debug.verbose_1 EXISTS_TAC;; + +(* This next one gets iterated in FIRST_ASSUM and creates multiple error messages *) +(* let ISPECL = Debug.verbose_thm ISPECL;; *) + +flyspeck_needs "build.hl";; + +let build_and_report() = + let s = try + (let _ = map flyspeck_needs Build.build_sequence in "full load completed") + with Failure t -> t in + let oc = open_out_gen [Open_append;Open_text] 436 (fullpath "log.txt") in + (Pervasives.output_string oc (build_report s); close_out oc);; + +let build_silent() = + let s = try + (let _ = map flyspeck_needs Build.build_sequence in "full load completed") + with Failure t -> t in + build_report s;; + +let try_do f = + let rec try_dof = function + [] -> [] + | (x::t) -> + try + (let y = f x in y:: try_dof t) + with Failure _ -> [] in + try_dof;; + +let already_loaded s = + let s' = file_on_path (!load_path) s in + let fileid = (Filename.basename s',Digest.file s') in + List.mem fileid (!loaded_files);; + +let new_build_silent() = + let loaded = try_do (fun s -> flyspeck_needs s; s) Build.build_sequence in + let unloaded = filter(not o already_loaded) Build.build_sequence in + (loaded,unloaded);; + +let rec cut_after f a acc = function + | [] -> acc + | b::bs -> if (f b =a) then (b::acc) else cut_after f a (b::acc) bs;; + +let reset_after s = + (loaded_files := cut_after fst s [] (List.rev (!loaded_files)));; + +let reset () = (reset_after "hol_pervasives.hl"; depend_reset());; + +(* let reset() = reset_after "flyspeck.ml";; *) + diff --git a/text_formalization/tame/ArcProperties.hl b/text_formalization/tame/ArcProperties.hl new file mode 100644 index 0000000..52ada78 --- /dev/null +++ b/text_formalization/tame/ArcProperties.hl @@ -0,0 +1,1091 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Author: Alexey Solovyev *) +(* Date: 2010-06-17 *) +(* ===========================================================================*) + + +(**********************************************) +(* Properties of the function arc (arclegnth) *) +(**********************************************) + + +(* Some auxiliary results *) +flyspeck_needs "trigonometry/trigonometry.hl";; +(* lmfun, h0 definitions *) +flyspeck_needs "packing/pack_defs.hl";; + + +module Arc_properties = struct + + +let REMOVE_ASSUM = POP_ASSUM (fun th -> ALL_TAC);; + + +(* Some general results *) + +(* Limit is a local notion *) +let REALLIM_ATREAL_LOCAL = prove(`!f g x y. (g ---> y) (atreal x) /\ + (?s. real_open s /\ x IN s /\ (!y. y IN s ==> f y = g y)) + ==> (f ---> y) (atreal x)`, + REWRITE_TAC[REALLIM_ATREAL; real_open] THEN + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:real`) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN POP_ASSUM MP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `e:real`) THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + EXISTS_TAC `min e' d` THEN + CONJ_TAC THENL + [ + REWRITE_TAC[real_min] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + GEN_TAC THEN + STRIP_TAC THEN + SUBGOAL_THEN `(f:real->real) x' = (g:real->real) x'` (fun th -> REWRITE_TAC[th]) THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MATCH_MP_TAC REAL_LTE_TRANS THEN + EXISTS_TAC `min e' d` THEN + ASM_REWRITE_TAC[REAL_MIN_MIN]; + ALL_TAC; + ] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LTE_TRANS THEN + EXISTS_TAC `min e' d` THEN + ASM_REWRITE_TAC[REAL_MIN_MIN]);; + + + + +(* Derivative is a local notion *) +let HAS_REAL_DERIVATIVE_LOCAL = prove(`!f g x g'x. (g has_real_derivative g'x) (atreal x) + /\ (?s. real_open s /\ x IN s /\ (!y. y IN s ==> f y = g y)) + ==> (f has_real_derivative g'x) (atreal x)`, + REWRITE_TAC[HAS_REAL_DERIVATIVE_ATREAL] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC REALLIM_ATREAL_LOCAL THEN + EXISTS_TAC `\y. (g y - (g:real->real) x) / (y - x)` THEN + ASM_REWRITE_TAC[] THEN + EXISTS_TAC `s:real->bool` THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + FIRST_ASSUM (MP_TAC o SPEC `x:real`) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `y:real`) THEN + ASM_SIMP_TAC[]);; + + + + +let REAL_LT_ONE_LDIV = prove(`!a b. &0 < b /\ a < b ==> a / b < &1`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[REAL_FIELD `&0 < b ==> (a / b < &1 <=> &0 < (b - a) / b)`] THEN + ASM_SIMP_TAC[Trigonometry2.REAL_LT_DIV_0] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC);; + + + +(****************************************************************) + + +(* The derivative of arc (x, b, 2) *) +let arc_derivative = + let der0 = REAL_DIFF_CONV `((\x. acs ((x * x + b * b - &2 * &2) / (&2 * x * b))) has_real_derivative f) (atreal x)` in + let der1 = REWRITE_RULE [REAL_ADD_RID; REAL_SUB_RZERO; REAL_MUL_RID; REAL_MUL_LID] der0 in + let der2 = REWRITE_RULE [IMP_IMP] (DISCH_ALL der1) in + let der_tm = (rand o rator) (concl der1) in + let concl0 = list_mk_comb (`(has_real_derivative)`, [`\x. arclength x b (&2)`; der_tm; `atreal x within real_interval [&2,#2.52]`]) in + let goal0 = list_mk_forall ([`x:real`; `b:real`], (mk_imp (`(&2 <= x /\ x <= #2.52) /\ (&2 <= b /\ b <= #2.52)`, concl0))) in + prove(goal0, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC HAS_REAL_DERIVATIVE_ATREAL_WITHIN THEN + MATCH_MP_TAC HAS_REAL_DERIVATIVE_LOCAL THEN + EXISTS_TAC `(\x. acs ((x * x + b * b - &2 * &2) / (&2 * x * b)))` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC der2 THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC (REAL_ARITH `&0 <= a /\ a < &1 ==> abs a < &1`) THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_DIV THEN + SUBGOAL_THEN `&2 * &2 <= x * x /\ &2 * &2 <= b * b` ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM REAL_POW_2] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_POW_LE2 THEN ASM_REWRITE_TAC[REAL_ARITH `&0 <= &2`]; + ALL_TAC + ] THEN + CONJ_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + MATCH_MP_TAC REAL_LE_MUL THEN + REWRITE_TAC[REAL_ARITH `&0 <= &2`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_SIMP_TAC[REAL_ARITH `&2 <= x ==> &0 <= x`] + ]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LT_ONE_LDIV THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LT_MUL THEN + REWRITE_TAC[REAL_ARITH `&0 < &2`] THEN + MATCH_MP_TAC REAL_LT_MUL THEN + ASM_SIMP_TAC[REAL_ARITH `&2 <= x ==> &0 < x`]; + ALL_TAC + ] THEN + + REWRITE_TAC[REAL_ARITH `x * x + b * b - &2 * &2 < &2 * x * b <=> (x - b) * (x - b) < &2 * &2`] THEN + REWRITE_TAC[GSYM REAL_POW_2] THEN + REWRITE_TAC[GSYM REAL_LT_SQUARE_ABS] THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[Trigonometry2.NOT_MUL_EQ0_EQ] THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + EXISTS_TAC `real_interval (#1.9,#2.6)` THEN + REWRITE_TAC[REAL_OPEN_REAL_INTERVAL; IN_REAL_INTERVAL] THEN + CONJ_TAC THENL + [ + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC Trigonometry1.ACS_ARCLENGTH THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC);; + + + +(**************************************************************) + + + +(* Numerical approximations for cos and acos *) + + +let COS_EQ_NEG_SIN = prove(`!x. cos (x + pi / &2) = --sin x`, + REWRITE_TAC[COS_SIN; REAL_ARITH `a - (b + a) = --b`; SIN_NEG]);; + + + + +let COS_DERIVATIVES = prove(`!x n. ((\x. cos (x + &n * pi / &2)) has_real_derivative cos (x + &(n + 1) * pi / &2)) (atreal x)`, + REPEAT GEN_TAC THEN REWRITE_TAC[] THEN + MP_TAC (REAL_DIFF_CONV `((\x. cos (x + &n * pi / &2)) has_real_derivative f) (atreal x)`) THEN + SUBGOAL_THEN `(&1 + &0) * --sin (x + &n * pi / &2) = cos (x + &(n + 1) * pi / &2)` (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[REAL_ARITH `(&1 + &0) * --a = --a`] THEN + REWRITE_TAC[GSYM REAL_OF_NUM_ADD] THEN + REWRITE_TAC[REAL_ARITH `x + (a + &1) * t = (x + a * t) + t`] THEN + REWRITE_TAC[COS_EQ_NEG_SIN]);; + + + + +let REAL_TAYLOR_COS_RAW = prove(`!x n. abs (cos x - sum (0..n) (\k. if (EVEN k) then ((-- &1) pow (k DIV 2) * x pow k) / &(FACT k) else &0)) <= + abs x pow (n + 1) / &(FACT (n + 1))`, + REPEAT GEN_TAC THEN + MP_TAC (SPECL [`(\i x. cos (x + &i * pi / &2))`; `n:num`; `UNIV:real->bool`; `&1`] REAL_TAYLOR) THEN + ANTS_TAC THENL + [ + REWRITE_TAC[is_realinterval; IN_UNIV; WITHINREAL_UNIV; COS_DERIVATIVES; COS_BOUND]; + ALL_TAC + ] THEN + REWRITE_TAC[IN_UNIV] THEN + DISCH_THEN (MP_TAC o SPECL [`&0`; `x:real`]) THEN + REWRITE_TAC[REAL_MUL_LZERO; REAL_ADD_RID; REAL_ADD_LID; REAL_SUB_RZERO; REAL_MUL_LID] THEN + SUBGOAL_THEN `!i. cos (&i * pi / &2) * x pow i / &(FACT i) = if EVEN i then (-- &1 pow (i DIV 2) * x pow i) / &(FACT i) else &0` (fun th -> SIMP_TAC[th]) THEN + GEN_TAC THEN + ASM_CASES_TAC `EVEN i` THEN ASM_REWRITE_TAC[] THENL + [ + POP_ASSUM MP_TAC THEN + REWRITE_TAC[EVEN_EXISTS] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `(2 * m) DIV 2 = m` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC DIV_MULT THEN + ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[GSYM REAL_OF_NUM_MUL] THEN + REWRITE_TAC[REAL_ARITH `(&2 * a) * b / &2 = a * b`] THEN + REWRITE_TAC[COS_NPI] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + SUBGOAL_THEN `cos (&i * pi / &2) = &0` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[COS_ZERO] THEN + DISJ1_TAC THEN EXISTS_TAC `i:num` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[REAL_MUL_LZERO]);; + + +let SUM_PAIR_0 = prove(`!f n. sum (0..2 * n + 1) f = sum(0..n) (\i. f (2 * i) + f (2 * i + 1))`, + REPEAT GEN_TAC THEN + MP_TAC (SPECL [`f:num->real`; `0`; `n:num`] SUM_PAIR) THEN + REWRITE_TAC[ARITH_RULE `2 * 0 = 0`]);; + + +let REAL_TAYLOR_COS = prove(`!x n. abs (cos x - sum (0..n) (\i. (-- &1) pow i * x pow (2 * i) / &(FACT (2 * i)))) <= abs x pow (2*n + 2) / &(FACT (2*n + 2))`, + REPEAT GEN_TAC THEN + MP_TAC (SPECL [`x:real`; `2 * n + 1`] REAL_TAYLOR_COS_RAW) THEN + REWRITE_TAC[SUM_PAIR_0; EVEN_DOUBLE; ARITH_RULE `(2 * n + 1) + 1 = 2 *n + 2`] THEN + SUBGOAL_THEN `!i. ~(EVEN (2 * i + 1))` MP_TAC THENL + [ + GEN_TAC THEN REWRITE_TAC[NOT_EVEN] THEN + REWRITE_TAC[ARITH_ODD; ODD_ADD; ODD_MULT]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> SIMP_TAC[th]) THEN + SUBGOAL_THEN `!i. (2 * i) DIV 2 = i` MP_TAC THENL + [ + GEN_TAC THEN + MATCH_MP_TAC DIV_MULT THEN + REWRITE_TAC[ARITH]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; REAL_ADD_RID]) THEN + REWRITE_TAC[REAL_ARITH `(a * b) / c = a * b / c`]);; + + + + + +let gen_sum_thm n = + let SUM_lemma n = + let tm = list_mk_comb (`sum:(num->bool)->(num->real)->real`, [mk_comb (`(..) 0`, mk_small_numeral n); `f:num->real`]) in + let suc_th = REWRITE_RULE[EQ_CLAUSES] (REWRITE_CONV[ARITH] (mk_eq (mk_small_numeral n, mk_comb (`SUC`, mk_small_numeral (n - 1))))) in + let th1 = REWRITE_CONV[suc_th] tm in + REWRITE_RULE[SUM_CLAUSES_NUMSEG; ARITH] th1 in + let rec rewriter th n = + if n > 0 then + rewriter (REWRITE_RULE[SUM_lemma n; GSYM REAL_ADD_ASSOC] th) (n - 1) + else + th in + GEN_ALL (rewriter (SUM_lemma n) (n - 1));; + + + +(* Evaluates cos at a given point using n terms from the cosine Taylor series *) +let cos_eval x n = + let th1 = (SPECL [x; mk_small_numeral n] REAL_TAYLOR_COS) in + let th2 = REWRITE_RULE[gen_sum_thm n] th1 in + let th4 = CONV_RULE (NUM_REDUCE_CONV) th2 in + let th5 = CONV_RULE (DEPTH_CONV REAL_INT_POW_CONV) th4 in + CONV_RULE (REAL_RAT_REDUCE_CONV) th5;; + + + + +(************************************************************************) + + + +(***************************) +(* Properties of arc a b c *) +(***************************) + + +(* arc a b 2 <= arc a b c *) +let arc_lemma1 = prove(`!a b c. &2 <= a /\ a <= #2.52 /\ + &2 <= b /\ b <= #2.52 /\ + &2 <= c /\ c <= #2.52 + ==> arclength a b (&2) <= arclength a b c`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `arclength a b (&2) = acs ((a * a + b * b - &2 * &2) / (&2 * a * b))` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC Trigonometry1.ACS_ARCLENGTH THEN + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + SUBGOAL_THEN `arclength a b c = acs ((a * a + b * b - c * c) / (&2 * a * b))` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC Trigonometry1.ACS_ARCLENGTH THEN + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + MATCH_MP_TAC ACS_MONO_LE THEN + + ABBREV_TAC `a2:real = a * a` THEN + ABBREV_TAC `b2:real = b * b` THEN + ABBREV_TAC `c2:real = c * c` THEN + ABBREV_TAC `ab2:real = &2 * a * b` THEN + + SUBGOAL_THEN `&4 <= a2 /\ a2 <= #6.3504 /\ &4 <= b2 /\ b2 <= #6.3504 /\ &4 <= c2 /\ c2 <= #6.3504` ASSUME_TAC THENL + [ + REMOVE_ASSUM THEN + REPLICATE_TAC 3 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + REWRITE_TAC[REAL_ARITH `&4 = &2 * &2`; REAL_ARITH `#6.3504 = #2.52 * #2.52`] THEN + REWRITE_TAC[GSYM REAL_POW_2; GSYM REAL_LE_SQUARE_ABS] THEN + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `&8 <= ab2 /\ ab2 <= #12.7008` ASSUME_TAC THENL + [ + EXPAND_TAC "ab2" THEN + REWRITE_TAC[REAL_ARITH `&8 = &2 * &2 * &2`; REAL_ARITH `#12.7008 = &2 * #2.52 * #2.52`] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_LMUL THEN REWRITE_TAC[REAL_ARITH `&0 <= &2`] THENL + [ + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 <= &2`]; + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_SIMP_TAC[REAL_ARITH `&2 <= a ==> &0 <= a`] + ]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `&0 < ab2` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LTE_TRANS THEN + EXISTS_TAC `&8` THEN ASM_REWRITE_TAC[REAL_ARITH `&0 < &8`]; + ALL_TAC + ] THEN + + REPEAT CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `&0` THEN + REWRITE_TAC[REAL_ARITH `-- &1 <= &0`] THEN + MATCH_MP_TAC REAL_LE_DIV THEN + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC; + + ASM_SIMP_TAC[REAL_LE_DIV2_EQ] THEN + REMOVE_ASSUM THEN REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + + MATCH_MP_TAC Trigonometry2.REAL_LE_LDIV THEN + ASM_REWRITE_TAC[] THEN + + MAP_EVERY EXPAND_TAC ["a2"; "b2"; "ab2"] THEN + ONCE_REWRITE_TAC[REAL_ARITH `a + b - c <= d <=> a + b - d <= c`] THEN + REWRITE_TAC[REAL_RING `a * a + b * b - &2 * a * b = (a - b) * (a - b)`] THEN + REWRITE_TAC[GSYM REAL_POW_2; GSYM REAL_LE_SQUARE_ABS] THEN + REPLICATE_TAC 9 REMOVE_ASSUM THEN + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC + ]);; + + +(*************************************************************) + + +(* arc a b c = arc b a c *) +let ups_x_sym = prove(`!a b c. ups_x a b c = ups_x b a c`, + REWRITE_TAC[Sphere.ups_x] THEN REAL_ARITH_TAC);; + + +let arc_sym = prove(`!a b c. arclength a b c = arclength b a c`, + REWRITE_TAC[Sphere.arclength; ups_x_sym] THEN + REWRITE_TAC[REAL_ARITH `c - a - b = c - b - a`]);; + + + +(*************************************************************) + +(* arc x b 2 is concave *) + + +(* A corrected version of the theorem from realanalysis.ml *) +let REAL_CONVEX_ON_SECOND_DERIVATIVE = prove + (`!f f' f'' s. + is_realinterval s /\ ~(?a. s = {a}) /\ + (!x. x IN s ==> (f has_real_derivative f'(x)) (atreal x within s)) /\ + (!x. x IN s ==> (f' has_real_derivative f''(x)) (atreal x within s)) + ==> (f real_convex_on s <=> !x. x IN s ==> &0 <= f''(x))`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC EQ_TRANS THEN EXISTS_TAC + `!x y. x IN s /\ y IN s /\ x <= y ==> (f':real->real)(x) <= f'(y)` THEN + CONJ_TAC THENL + [MATCH_MP_TAC REAL_CONVEX_ON_DERIVATIVE_INCREASING; + CONV_TAC SYM_CONV THEN MATCH_MP_TAC HAS_REAL_DERIVATIVE_INCREASING] THEN + ASM_REWRITE_TAC[]);; + + + +(* arc is concave (-arc is convex) *) + +let arc_concave = prove(`!b. &2 <= b /\ b <= #2.52 ==> (\x. -- arclength x b (&2)) real_convex_on (real_interval [&2, #2.52])`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`\x. --arclength x b (&2)`; + `\x. (x * x - (b * b - &4)) / x * inv (sqrt (&4 * (x * x) * (b * b) - (x * x + b * b - &4) pow 2))`; + `\x. inv (sqrt (&4 * (x * x) * (b * b) - (x * x + b * b - &4) pow 2)) * ((x * x + (b * b - &4)) / (x * x) - ((&2 * b * b - &2 * x * x + &8) * (x * x - (b * b - &4))) / (&4 * (x * x) * (b * b) - (x * x + b * b - &4) pow 2))`; + `real_interval [&2,#2.52]` + ] REAL_CONVEX_ON_SECOND_DERIVATIVE) THEN + ANTS_TAC THENL + [ + REWRITE_TAC[IS_REALINTERVAL_INTERVAL] THEN + CONJ_TAC THENL + [ + REWRITE_TAC[NOT_EXISTS_THM] THEN GEN_TAC THEN + DISCH_TAC THEN + SUBGOAL_THEN `&2 = a /\ #2.52 = a` MP_TAC THENL + [ + REWRITE_TAC[GSYM IN_SING] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[IN_REAL_INTERVAL] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + REWRITE_TAC[IN_REAL_INTERVAL] THEN + GEN_TAC THEN DISCH_TAC THEN + REWRITE_TAC[REAL_ARITH `a * inv(b) = --(a * --inv(b))`] THEN + MATCH_MP_TAC HAS_REAL_DERIVATIVE_NEG THEN + MP_TAC (SPEC_ALL arc_derivative) THEN + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[REAL_ARITH `(x + x) * &2 * x * b - (x * x + b * b - &2 * &2) * &2 * b = &2 * b * (x * x - (b * b - &4))`] THEN + SUBGOAL_THEN `&0 < &2 * x * b` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LT_MUL THEN + REWRITE_TAC[REAL_ARITH `&0 < &2`] THEN + MATCH_MP_TAC REAL_LT_MUL THEN + ASM_SIMP_TAC[REAL_ARITH `&2 <= x ==> &0 < x`]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `(&2 * b * (x * x - (b * b - &4))) / (&2 * x * b) pow 2 = (x * x - (b * b - &4)) / x * inv(&2 * x * b)` (fun th -> REWRITE_TAC[th]) THENL + [ + POP_ASSUM MP_TAC THEN + CONV_TAC REAL_FIELD; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!a b c. (c * inv(a)) * --inv(b) = c * --inv(a * b)` (fun th -> ONCE_REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[REAL_INV_MUL] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `&0 <= &1 - ((x * x + b * b - &2 * &2) / (&2 * x * b)) pow 2` ASSUME_TAC THENL + [ + REWRITE_TAC[REAL_POW_DIV] THEN + REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`] THEN + MATCH_MP_TAC Trigonometry2.REAL_LE_LDIV THEN + CONJ_TAC THENL + [ + REWRITE_TAC[REAL_POW_2] THEN + MATCH_MP_TAC REAL_LT_MUL THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_POW_LE2 THEN + CONJ_TAC THENL + [ + SUBGOAL_THEN `&2 * &2 <= x * x /\ &2 * &2 <= b * b` MP_TAC THENL + [ + REWRITE_TAC[GSYM REAL_POW_2] THEN + REWRITE_TAC[GSYM REAL_LE_SQUARE_ABS] THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[REAL_ARITH `x * x + b * b - &2 * &2 <= &2 * x * b <=> (x - b) pow 2 <= &2 pow 2`] THEN + REWRITE_TAC[GSYM REAL_LE_SQUARE_ABS] THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + FIRST_ASSUM (ASSUME_TAC o MATCH_MP REAL_LT_IMP_LE) THEN + ASM_SIMP_TAC[Trigonometry1.SQRT_MUL_L] THEN + SUBGOAL_THEN `(&2 * x * b) pow 2 * (&1 - ((x * x + b * b - &2 * &2) / (&2 * x * b)) pow 2) = &4 * (x * x) * b * b - (x * x + b * b - &4) pow 2` MP_TAC THENL + [ + REWRITE_TAC[REAL_POW_DIV; REAL_ARITH `a * (&1 - c) = a - a * c`] THEN + FIRST_ASSUM (ASSUME_TAC o MATCH_MP REAL_POW_LT) THEN + ASM_SIMP_TAC[REAL_FIELD `&0 < a ==> a * c / a = c`] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + + REWRITE_TAC[IN_REAL_INTERVAL] THEN + GEN_TAC THEN DISCH_TAC THEN + REAL_DIFF_TAC THEN + + SUBGOAL_THEN `&0 < &4 * (x * x) * b * b - (x * x + b * b - &4) pow 2` ASSUME_TAC THENL + [ + REWRITE_TAC[REAL_RING `&4 * (x * x) * b * b - (x * x + b * b - &4) pow 2 = (&2 pow 2 - (x - b) pow 2) * ((x + b) pow 2 - &2 pow 2)`] THEN + MATCH_MP_TAC REAL_LT_MUL THEN + ONCE_REWRITE_TAC[REAL_ARITH `&0 < a - b <=> b < a`] THEN + REWRITE_TAC[GSYM REAL_LT_SQUARE_ABS] THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + ASM_SIMP_TAC[] THEN + FIRST_X_ASSUM (ASSUME_TAC o MATCH_MP SQRT_POS_LT) THEN + ASM_SIMP_TAC[REAL_POS_NZ; REAL_ARITH `&2 <= x ==> ~(x = &0)`]; + ALL_TAC + ] THEN + + REWRITE_TAC[REAL_MUL_LID; REAL_MUL_RID; REAL_ADD_RID; ARITH_RULE `2 - 1 = 1`; REAL_POW_1; REAL_SUB_RZERO] THEN + REWRITE_TAC[REAL_INV_MUL] THEN + FIRST_ASSUM (ASSUME_TAC o MATCH_MP REAL_LT_IMP_LE) THEN + ASM_SIMP_TAC[SQRT_POW_2] THEN + REPEAT (POP_ASSUM MP_TAC) THEN + CONV_TAC REAL_FIELD; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[IN_REAL_INTERVAL] THEN + GEN_TAC THEN DISCH_TAC THEN + MATCH_MP_TAC REAL_LE_MUL THEN + + SUBGOAL_THEN `&0 < &4 * (x * x) * b * b - (x * x + b * b - &4) pow 2` ASSUME_TAC THENL + [ + REWRITE_TAC[REAL_RING `&4 * (x * x) * b * b - (x * x + b * b - &4) pow 2 = (&2 pow 2 - (x - b) pow 2) * ((x + b) pow 2 - &2 pow 2)`] THEN + MATCH_MP_TAC REAL_LT_MUL THEN + ONCE_REWRITE_TAC[REAL_ARITH `&0 < a - b <=> b < a`] THEN + REWRITE_TAC[GSYM REAL_LT_SQUARE_ABS] THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_INV THEN + MATCH_MP_TAC SQRT_POS_LE THEN + MATCH_MP_TAC REAL_LT_IMP_LE THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ABBREV_TAC `t:real = x * x` THEN + ABBREV_TAC `u:real = b * b` THEN + + REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`] THEN + SUBGOAL_THEN `&0 < t` ASSUME_TAC THENL + [ + EXPAND_TAC "t" THEN + MATCH_MP_TAC REAL_LT_MUL THEN + ASM_SIMP_TAC[REAL_ARITH `&2 <= x ==> &0 < x`]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[RAT_LEMMA4] THEN + ONCE_REWRITE_TAC[REAL_ARITH `a <= b <=> &0 <= b - a`] THEN + + ABBREV_TAC `f = \t. (t + u - &4) * (&4 * t * u - (t + u - &4) pow 2) - ((&2 * u - &2 * t + &8) * (t - (u - &4))) * t` THEN + FIRST_ASSUM (MP_TAC o (fun th -> AP_THM th `t:real`)) THEN + BETA_TAC THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ABBREV_TAC `f' = \t. &3 * (-- &2 * t * u + t * (t + &8) + u pow 2) + &8 * u - &80` THEN + ABBREV_TAC `f'' = \t. &6 * (t - u + &4)` THEN + + SUBGOAL_THEN `&4 <= t /\ &4 <= u /\ t <= #6.3504 /\ u <= #6.3504` ASSUME_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `&4 = &2 * &2`; REAL_ARITH `#6.3504 = #2.52 * #2.52`] THEN + EXPAND_TAC "t" THEN EXPAND_TAC "u" THEN + REWRITE_TAC[GSYM REAL_POW_2] THEN + REWRITE_TAC[GSYM REAL_LE_SQUARE_ABS] THEN + FIRST_X_ASSUM (MP_TAC o check (is_conj o concl)) THEN + REPEAT (FIRST_X_ASSUM (MP_TAC o check (is_binop `(<=):real->real->bool` o concl))) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + SUBGOAL_THEN `&0 <= t /\ &0 <= u` ASSUME_TAC THENL + [ + ASM_SIMP_TAC[REAL_ARITH `&4 <= t ==> &0 <= t`]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `(f:real->real) (&4)` THEN + CONJ_TAC THENL + [ + EXPAND_TAC "f" THEN + REWRITE_TAC[REAL_ARITH `&4 + u - &4 = u`] THEN + REWRITE_TAC[REAL_ARITH `a - &2 * &4 + &8 = a`] THEN + REWRITE_TAC[REAL_ARITH `u * (&4 * &4 * u - u pow 2) - ((&2 * u) * (&4 - (u - &4))) * &4 = u * (&24 * u - u * u - &64)`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[] THEN + ABBREV_TAC `g = \u. &24 * u - u * u - &64` THEN + FIRST_ASSUM (MP_TAC o (fun th -> AP_THM th `u:real`)) THEN + BETA_TAC THEN DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `(g:real->real) (&4)` THEN + CONJ_TAC THENL + [ + EXPAND_TAC "g" THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + MATCH_MP_TAC HAS_REAL_DERIVATIVE_INCREASING_IMP THEN + EXISTS_TAC `\u. &24 - &2 * u` THEN + EXISTS_TAC `real_interval [&4,#6.3504]` THEN + REWRITE_TAC[IS_REALINTERVAL_INTERVAL] THEN + CONJ_TAC THENL + [ + REPEAT STRIP_TAC THEN + EXPAND_TAC "g" THEN + REAL_DIFF_TAC THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[IN_REAL_INTERVAL; REAL_ARITH `&4 <= &4 /\ &4 <= #6.3504`] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC HAS_REAL_DERIVATIVE_INCREASING_IMP THEN + MAP_EVERY EXISTS_TAC [`f':real->real`; `real_interval [&4,#6.3504]`] THEN + ASM_REWRITE_TAC[IN_REAL_INTERVAL; REAL_ARITH `&4 <= &4 /\ &4 <= #6.3504`] THEN + REWRITE_TAC[IS_REALINTERVAL_INTERVAL] THEN + CONJ_TAC THENL + [ + REPEAT STRIP_TAC THEN + EXPAND_TAC "f" THEN EXPAND_TAC "f'" THEN + REAL_DIFF_TAC THEN + REWRITE_TAC[ARITH_RULE `2 - 1 = 1`] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + X_GEN_TAC `y:real` THEN DISCH_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `(f':real->real) (&4)` THEN + CONJ_TAC THENL + [ + EXPAND_TAC "f'" THEN + REWRITE_TAC[REAL_ARITH `&3 * (-- &2 * &4 * u + &4 * (&4 + &8) + u pow 2) + &8 * u - &80 = &3 * (u - &8 / &3) pow 2 + &128 / &3`] THEN + MATCH_MP_TAC REAL_LE_ADD THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_MUL THEN + REWRITE_TAC[REAL_POW_2; REAL_LE_SQUARE] THEN + REAL_ARITH_TAC; + REAL_ARITH_TAC + ]; + ALL_TAC + ] THEN + + MATCH_MP_TAC HAS_REAL_DERIVATIVE_INCREASING_IMP THEN + MAP_EVERY EXISTS_TAC [`f'':real->real`; `real_interval [&4,#6.3504]`] THEN + ASM_REWRITE_TAC[IN_REAL_INTERVAL; REAL_ARITH `&4 <= &4 /\ &4 <= #6.3504`] THEN + REWRITE_TAC[IS_REALINTERVAL_INTERVAL] THEN + CONJ_TAC THENL + [ + REPEAT STRIP_TAC THEN + EXPAND_TAC "f'" THEN EXPAND_TAC "f''" THEN + REAL_DIFF_TAC THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + EXPAND_TAC "f''" THEN + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC);; + + + +(* arc x b 2 >= arc (2 h0) b 2 + lmfun(x / 2) * (arc 2 b 2 - arc (2 h0) b 2) *) + +let arc_lemma3 = prove(`!x b. (&2 <= x /\ x <= #2.52) /\ (&2 <= b /\ b <= #2.52) + ==> arclength x b (&2) >= + arclength (#2.52) b (&2) + + lmfun(x / &2) * (arclength (&2) b (&2) - arclength (#2.52) b (&2))`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL arc_concave) THEN + ASM_REWRITE_TAC[real_convex_on] THEN + DISCH_THEN (MP_TAC o SPECL [`&2`; `#2.52`; `lmfun (x / &2)`; `&1 - lmfun (x / &2)`]) THEN + REWRITE_TAC[IN_REAL_INTERVAL; REAL_LE_REFL; REAL_ARITH `&2 <= #2.52`; REAL_ARITH `a + &1 - a = &1`] THEN + SUBGOAL_THEN `&0 <= lmfun (x / &2) /\ &0 <= &1 - lmfun (x / &2)` ASSUME_TAC THENL + [ + REWRITE_TAC[Pack_defs.lmfun; Pack_defs.h0] THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `lmfun (x / &2) * &2 + (&1 - lmfun (x / &2)) * #2.52 = x` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[Pack_defs.lmfun; Pack_defs.h0] THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + REAL_ARITH_TAC);; + + + + +(********************************************************) + + + + +let ABS_LE_BOUNDS = prove(`!x a e. abs (x - a) <= e <=> a - e <= x /\ x <= a + e`, + REAL_ARITH_TAC);; + + + + +(* Estimates for the proof of arc_lemma4 *) + +let estimate0 = prove(`arclength (&2) #2.52 (&2) - arclength #2.52 #2.52 (&2) >= #0.073`, + SUBGOAL_THEN `arclength #2.52 #2.52 (&2) = acs ((#2.52 * #2.52 + #2.52 * #2.52 - (&2) * (&2)) / (&2 * #2.52 * #2.52))` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC Trigonometry1.ACS_ARCLENGTH THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + SUBGOAL_THEN `arclength (&2) #2.52 (&2) = acs (((&2) * (&2) + #2.52 * #2.52 - (&2) * (&2)) / (&2 * (&2) * #2.52))` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC Trigonometry1.ACS_ARCLENGTH THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + CONV_TAC REAL_RAT_REDUCE_CONV THEN + REWRITE_TAC[REAL_ARITH `#0.073 = #0.8892 - #0.8162`] THEN + MATCH_MP_TAC (REAL_ARITH `a >= b /\ c <= d ==> a - c >= b - d`) THEN + CONJ_TAC THENL + [ + SUBGOAL_THEN `#0.8892 = acs (cos #0.8892)` (fun th -> ONCE_REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC (GSYM ACS_COS) THEN + MP_TAC PI_APPROX_32 THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[real_ge] THEN + MATCH_MP_TAC ACS_MONO_LE THEN + REWRITE_TAC[COS_BOUNDS] THEN + CONJ_TAC THENL + [ + CONV_TAC REAL_RAT_LE_CONV; + MP_TAC (CONJUNCT1 (REWRITE_RULE[ABS_LE_BOUNDS] (cos_eval `#0.8892` 2))) THEN + REAL_ARITH_TAC + ]; + + SUBGOAL_THEN `#0.8162 = acs (cos #0.8162)` (fun th -> ONCE_REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC (GSYM ACS_COS) THEN + MP_TAC PI_APPROX_32 THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + MATCH_MP_TAC ACS_MONO_LE THEN + REWRITE_TAC[COS_BOUNDS] THEN + CONJ_TAC THENL + [ + MP_TAC ((CONJUNCT2 o REWRITE_RULE[ABS_LE_BOUNDS]) (cos_eval `#0.8162` 3)) THEN + REAL_ARITH_TAC; + CONV_TAC REAL_RAT_LE_CONV + ] + ]);; + + +let estimate1 = prove(`!x. &2 <= x /\ x <= #2.52 ==> &1 / &4 * --inv (sqrt (&1 - (x / &4) pow 2)) <= -- #0.28`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[REAL_ARITH `&1 / &4 * --a <= --b <=> &4 * b <= a`] THEN + ONCE_REWRITE_TAC[REAL_ARITH `&4 * #0.28 = inv (inv (&4 * #0.28))`] THEN + MATCH_MP_TAC REAL_LE_INV2 THEN + SUBGOAL_THEN `&0 < &1 - (x / &4) pow 2` ASSUME_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `&0 < &1 - a <=> a < &1`] THEN + ONCE_REWRITE_TAC[REAL_ARITH `&1 = &1 pow 2`] THEN + MATCH_MP_TAC REAL_POW_LT2 THEN + REWRITE_TAC[ARITH_RULE `~(2 = 0)`] THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC SQRT_POS_LT THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_LSQRT THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE] THEN + CONJ_TAC THENL + [ + REAL_ARITH_TAC; + ALL_TAC + ] THEN + ONCE_REWRITE_TAC[REAL_ARITH `&1 - a <= b <=> &1 - b <= a`] THEN + REWRITE_TAC[REAL_POW_2] THEN + REWRITE_TAC[REAL_ARITH `a <= x / &4 * x / &4 <=> &16 * a <= x * x`] THEN + CONV_TAC REAL_RAT_REDUCE_CONV THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `&2 * &2` THEN + CONJ_TAC THENL + [ + CONV_TAC REAL_RAT_REDUCE_CONV; + REWRITE_TAC[GSYM REAL_POW_2] THEN + MATCH_MP_TAC REAL_POW_LE2 THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 <= &2`] + ]);; + + + + +let estimate2 = prove(`!x. &2 <= x /\ x <= #2.52 + ==> (&2 * &2 * #2.52 * x * x - (&3969 / &625 + x * x - &4) * &126 / &25) / (&2 * #2.52 * x) pow 2 <= #0.13 /\ + &0 <= (&2 * &2 * #2.52 * x * x - (&3969 / &625 + x * x - &4) * &126 / &25) / (&2 * #2.52 * x) pow 2`, + GEN_TAC THEN DISCH_TAC THEN + SUBGOAL_THEN `&0 < (&2 * #2.52 * x) pow 2` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_POW_LT THEN + POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + ASM_SIMP_TAC[REAL_LE_LDIV_EQ; REAL_LE_RDIV_EQ; REAL_MUL_LZERO] THEN + ABBREV_TAC `t:real = x * x` THEN + SUBGOAL_THEN `&2 * &2 <= t /\ t <= #2.52 * #2.52` MP_TAC THENL + [ + EXPAND_TAC "t" THEN + REWRITE_TAC[GSYM REAL_POW_2] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_POW_LE2 THEN ASM_REWRITE_TAC[] THENL + [ + REAL_ARITH_TAC; + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `&2` THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 <= &2`] + ]; + ALL_TAC + ] THEN + + REWRITE_TAC[REAL_POW_2] THEN + ASM_REWRITE_TAC[REAL_ARITH `(a * b * x) * a * b * x = (a * b) * (a * b) * (x * x)`] THEN + REAL_ARITH_TAC);; + + + +let estimate3 = prove(`!x. &2 <= x /\ x <= #2.52 ==> + inv (sqrt (&1 - ((&3969 / &625 + x * x - &4) / (&2 * #2.52 * x)) pow 2)) <= &2 /\ + &0 <= inv (sqrt (&1 - ((&3969 / &625 + x * x - &4) / (&2 * #2.52 * x)) pow 2))`, + GEN_TAC THEN DISCH_TAC THEN + SUBGOAL_THEN `inv (&2) <= sqrt (&1 - ((&3969 / &625 + x * x - &4) / (&2 * #2.52 * x)) pow 2)` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LE_RSQRT THEN + REWRITE_TAC[REAL_ARITH `a <= &1 - c <=> c <= &1 - a`; REAL_INV_INV] THEN + REWRITE_TAC[REAL_POW_DIV; REAL_POW_2] THEN + REWRITE_TAC[REAL_ARITH `(a * b * x) * a * b * x = (a * b * a * b) * x * x`] THEN + ABBREV_TAC `t:real = x * x` THEN + SUBGOAL_THEN `&4 <= t /\ t <= #6.3504` ASSUME_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `&4 = &2 * &2`; REAL_ARITH `#6.3504 = #2.52 * #2.52`] THEN + EXPAND_TAC "t" THEN + REWRITE_TAC[GSYM REAL_POW_2] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_POW_LE2 THEN ASM_REWRITE_TAC[] THENL + [ + REAL_ARITH_TAC; + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC + ]; + ALL_TAC + ] THEN + + CONV_TAC (DEPTH_CONV REAL_RAT_MUL_CONV) THEN + SUBGOAL_THEN `&0 < &15876 / &625 * t` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + ASM_SIMP_TAC[REAL_LE_LDIV_EQ] THEN + REWRITE_TAC[REAL_ARITH `a + t - b = (a - b) + t`; REAL_ARITH `a * b * t = (a * b) * t`] THEN + CONV_TAC REAL_RAT_REDUCE_CONV THEN + REWRITE_TAC[REAL_ARITH `(a + t) * (a + t) <= b * t <=> (b / &2 - a - t) * (b / &2 - a - t) <= b * b / &4 - a * b`] THEN + CONV_TAC REAL_RAT_REDUCE_CONV THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `&4 * &4` THEN + CONJ_TAC THENL + [ + REWRITE_TAC[GSYM REAL_POW_2] THEN + MATCH_MP_TAC REAL_POW_LE2 THEN + FIRST_X_ASSUM (MP_TAC o check (is_conj o concl)) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + ONCE_REWRITE_TAC[REAL_ARITH `&2 = inv (inv (&2))`] THEN + MATCH_MP_TAC REAL_LE_INV2 THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < inv (&2)`; REAL_INV_INV]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_INV THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `inv (&2)` THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 <= inv (&2)`]);; + + + +(* arc 2 x 2 - arc (2 h0) x 2 >= 0.073 *) + +let arc_lemma4 = prove(`!x. &2 <= x /\ x <= #2.52 + ==> arclength (&2) x (&2) - arclength (#2.52) x (&2) >= #0.073`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[REAL_ARITH `a - b >= c <=> b - a <= --c`] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `arclength #2.52 #2.52 (&2) - arclength (&2) #2.52 (&2)` THEN + REWRITE_TAC[REWRITE_RULE [REAL_ARITH `a - b >= c <=> b - a <= --c`] estimate0] THEN + ONCE_REWRITE_TAC[arc_sym] THEN + MP_TAC (SPECL [`\x. arclength x #2.52 (&2) - arclength x (&2) (&2)`; + `\x. (&2 * &2 * #2.52 * x * x - (&3969 / &625 + x * x - &4) * &126 / &25) / (&2 * #2.52 * x) pow 2 * + --inv (sqrt (&1 - ((&3969 / &625 + x * x - &4) / (&2 * #2.52 * x)) pow 2)) - + &1 / &4 * --inv (sqrt (&1 - (x / &4) pow 2))`; + `real_interval [&2, #2.52]`] + HAS_REAL_DERIVATIVE_INCREASING) THEN + + ANTS_TAC THENL + [ + REWRITE_TAC[IS_REALINTERVAL_INTERVAL] THEN + CONJ_TAC THENL + [ + REWRITE_TAC[NOT_EXISTS_THM] THEN GEN_TAC THEN + DISCH_TAC THEN + SUBGOAL_THEN `&2 = a /\ #2.52 = a` MP_TAC THENL + [ + REWRITE_TAC[GSYM IN_SING] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[IN_REAL_INTERVAL] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + REWRITE_TAC[IN_REAL_INTERVAL] THEN + X_GEN_TAC `y:real` THEN DISCH_TAC THEN + MATCH_MP_TAC HAS_REAL_DERIVATIVE_SUB THEN + CONJ_TAC THENL + [ + MP_TAC (SPECL [`y:real`; `#2.52`] arc_derivative) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[REAL_ARITH `(y + y) * a * y * b = &2 * a * b * y * y`] THEN + ONCE_REWRITE_TAC[REAL_ARITH `a + b - &4 = b + (a - &4)`] THEN + CONV_TAC REAL_RAT_REDUCE_CONV THEN + REWRITE_TAC[REAL_ARITH `&2 * y * #2.52 = &2 * #2.52 * y`]; + ALL_TAC + ] THEN + MP_TAC (SPECL [`y:real`; `&2`] arc_derivative) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + CONV_TAC REAL_RAT_REDUCE_CONV THEN + REWRITE_TAC[REAL_ARITH `(y + y) * &2 * y * &2 - (y * y + &0) * &4 = &4 * (y pow 2)`] THEN + ASM_SIMP_TAC[REAL_FIELD `&2 <= y ==> ((y * y + &0) / (&2 * y * &2)) pow 2 = (y / &4) pow 2`] THEN + ASM_SIMP_TAC[REAL_FIELD `&2 <= y ==> (&4 * y pow 2) / (&2 * y * &2) pow 2 = &1 / &4`]; + ALL_TAC + ] THEN + + BETA_TAC THEN + DISCH_TAC THEN + + FIRST_ASSUM (fun th -> SUBGOAL_THEN ((fst o dest_eq o concl) th) MP_TAC) THENL + [ + REPEAT (POP_ASSUM (fun th -> ALL_TAC)) THEN + REWRITE_TAC[IN_REAL_INTERVAL] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC (REAL_ARITH `(?c d. c <= a /\ b <= d /\ &0 <= c - d) ==> &0 <= a - b`) THEN + MAP_EVERY EXISTS_TAC [`#0.13 * (-- &2)`; `-- #0.28`] THEN + CONJ_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `a * --b <= c * --d <=> c * d <= a * b`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_SIMP_TAC[estimate2; estimate3]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[estimate1] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + DISCH_THEN (MP_TAC o SPECL [`x:real`; `#2.52`]) THEN + ASM_REWRITE_TAC[IN_REAL_INTERVAL; REAL_ARITH `&2 <= #2.52 /\ #2.52 <= #2.52`] + );; + + + + + +(* arclength (2 h0) (2 h0) 2 >= 0.816 *) + +let arc_lemma5 = prove(`arclength #2.52 #2.52 (&2) >= #0.816`, + SUBGOAL_THEN `arclength #2.52 #2.52 (&2) = acs ((#2.52 * #2.52 + #2.52 * #2.52 - (&2) * (&2)) / (&2 * #2.52 * #2.52))` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC Trigonometry1.ACS_ARCLENGTH THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + CONV_TAC (REAL_RAT_REDUCE_CONV) THEN + SUBGOAL_THEN `#0.816 = acs (cos (#0.816))` MP_TAC THENL + [ + MATCH_MP_TAC (GSYM ACS_COS) THEN + MP_TAC PI_APPROX_32 THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th]) THEN + REWRITE_TAC[real_ge] THEN + MATCH_MP_TAC ACS_MONO_LE THEN + REWRITE_TAC[COS_BOUNDS] THEN + CONJ_TAC THENL + [ + CONV_TAC REAL_RAT_LE_CONV; + MP_TAC (CONJUNCT1 (REWRITE_RULE [ABS_LE_BOUNDS] (cos_eval `#0.816` 2))) THEN + REAL_ARITH_TAC + ]);; + + + + + + +end;; + diff --git a/text_formalization/tame/CDTETAT.hl b/text_formalization/tame/CDTETAT.hl new file mode 100644 index 0000000..3538b4d --- /dev/null +++ b/text_formalization/tame/CDTETAT.hl @@ -0,0 +1,324 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Contains proofs of CDTETAT and SZIPOAS *) +(* ========================================================================== *) + + +flyspeck_needs "tame/TameGeneral.hl";; +flyspeck_needs "tame/ssreflect/tame_lemmas-compiled.hl";; + + + +module Cdtetat_tame = struct + + +open Hypermap_and_fan;; +open Fan_defs;; +open Tame_defs;; +open Tame_general;; +open Tame_lemmas;; + + + +(* This approximation of pi is sufficient for the next lemma *) +let PI_APPROX_4 = prove(`#3.1415 <= pi /\ pi <= #3.1416`, + MP_TAC PI_APPROX_32 THEN REAL_ARITH_TAC);; + + + +(* This lemma is a part of the proof of CDTETAT *) +let CDTETAT_lemma1 = prove(`!p t:num. &p * (#0.852) + &t * (#1.15) <= &2 * pi /\ &2 * pi < &p * #1.9 + &t * pi ==> + (p, t) IN { (0,3), (0,4), (0,5), (1,2), (1,3), (1,4), + (2,1), (2,2), (2,3), (3,1), (3,2), (3,3), + (4,0), (4,1),(4,2), (5,0), (5,1), + (6,0), (6,1), (7,0) }`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `p <= 7` ASSUME_TAC THENL + [ + REMOVE_ASSUM THEN + POP_ASSUM (MP_TAC o (fun th -> MATCH_MP (REAL_ARITH `&p * #0.852 + &t * #1.15 <= &2 * pi ==> &p <= (&2 * pi) / #0.852`) th)) THEN + DISCH_TAC THEN + SUBGOAL_THEN `p < 8` (fun th -> MP_TAC th THEN ARITH_TAC) THEN + REWRITE_TAC[GSYM REAL_OF_NUM_LT] THEN + POP_ASSUM MP_TAC THEN MP_TAC PI_APPROX_4 THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `&t <= (&2 * #3.1416 - &p * #0.852) / #1.15` MP_TAC THENL + [ + REMOVE_ASSUM THEN REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + MP_TAC PI_APPROX_4 THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `&2 - (&p * #1.9) / pi < &t` MP_TAC THENL + [ + MP_TAC (REAL_FIELD `&0 < pi ==> &2 - (&p * #1.9) / pi = (&2 * pi - &p * #1.9) / pi`) THEN + SUBGOAL_TAC "A" `&0 < pi` [ MP_TAC PI_APPROX_4 THEN REAL_ARITH_TAC ] THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th]) THEN + ASM_SIMP_TAC[REAL_LT_LDIV_EQ] THEN + REMOVE_ASSUM THEN REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN + REMOVE_ASSUM THEN REMOVE_ASSUM THEN + DISCH_TAC THEN DISCH_TAC THEN + + SUBGOAL_THEN `&2 - (&p * #1.9) / #3.1415 < &t` MP_TAC THENL + [ + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `&2 - (&p * #1.9) / pi` THEN + ASM_REWRITE_TAC[REAL_ARITH `a - b <= a - c <=> c <= b`] THEN + REWRITE_TAC[real_div] THEN + MATCH_MP_TAC REAL_LE_LMUL THEN + REWRITE_TAC[REAL_ARITH `&0 <= &p * #1.9`] THEN + MATCH_MP_TAC REAL_LE_INV2 THEN + MP_TAC PI_APPROX_4 THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + REMOVE_ASSUM THEN + DISCH_THEN (LABEL_TAC "A") THEN DISCH_THEN (LABEL_TAC "B") THEN + + DISJ_CASES_TAC (ARITH_RULE `7 < p \/ p < 8`) THENL + [ + ASM_MESON_TAC[NOT_LE]; + ALL_TAC + ] THEN + POP_ASSUM (fun th -> ASSUME_TAC (REWRITE_RULE[gen_NUM_CASES 8] th)) THEN + + POP_ASSUM MP_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM (fun th -> SUBST_ALL_TAC th) THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + CONV_TAC REAL_RAT_REDUCE_CONV THEN REPEAT STRIP_TAC THENL + [ + SUBGOAL_THEN `2 < t /\ t < 6` ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM REAL_OF_NUM_LT] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + ASM SET_TAC[ARITH_RULE `2 < t /\ t < 6 ==> t = 3 \/ t = 4 \/ t = 5`]; + + SUBGOAL_THEN `1 < t /\ t < 5` ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM REAL_OF_NUM_LT] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + ASM SET_TAC[ARITH_RULE `1 < t /\ t < 5 ==> t = 2 \/ t = 3 \/ t = 4`]; + + SUBGOAL_THEN `0 < t /\ t < 4` ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM REAL_OF_NUM_LT] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + ASM SET_TAC[ARITH_RULE `0 < t /\ t < 4 ==> t = 1 \/ t = 2 \/ t = 3`]; + + SUBGOAL_THEN `0 < t /\ t < 4` ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM REAL_OF_NUM_LT] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + ASM SET_TAC[ARITH_RULE `0 < t /\ t < 4 ==> t = 1 \/ t = 2 \/ t = 3`]; + + SUBGOAL_THEN `t < 3` ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM REAL_OF_NUM_LT] THEN + POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + ASM SET_TAC[ARITH_RULE `t < 3 ==> t = 0 \/ t = 1 \/ t = 2`]; + + SUBGOAL_THEN `t < 2` ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM REAL_OF_NUM_LT] THEN + POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + ASM SET_TAC[ARITH_RULE `t < 2 ==> t = 0 \/ t = 1`]; + + SUBGOAL_THEN `t < 2` ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM REAL_OF_NUM_LT] THEN + POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + ASM SET_TAC[ARITH_RULE `t < 2 ==> t = 0 \/ t = 1`]; + + SUBGOAL_THEN `t < 1` ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM REAL_OF_NUM_LT] THEN + POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + ASM SET_TAC[ARITH_RULE `t < 1 ==> t = 0`] + ]);; + + + +(* CDTETAT (with assumptions) *) + +let CDTETAT = prove(`kcblrqc_ineq_def ==> !V x. contravening V /\ x IN dart_of_fan (V,ESTD V) ==> + (let (p,q,r) = type_of_node (hypermap_of_fan (V, ESTD V)) x in + ((p,q+r) IN { (0,3), (0,4), (0,5), (1,2), (1,3), (1,4), + (2,1), (2,2), (2,3), (3,1), (3,2), (3,3), + (4,0), (4,1),(4,2), (5,0), (5,1), + (6,0), (6,1), (7,0) }))`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPEC `V:real^3->bool` CONTRAVENING_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (ISPECL [`hypermap_of_fan (V:real^3->bool,ESTD V)`; `x:real^3#real^3`] NODE_TYPE_lemma) THEN + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN; Jgtdebu.JGTDEBU4] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + CONV_TAC let_CONV THEN + ABBREV_TAC `H = hypermap_of_fan (V,ESTD V)` THEN + ABBREV_TAC `A = {y:real^3#real^3 | y IN node H x /\ CARD (face H y) = 3}` THEN + ABBREV_TAC `B = {y:real^3#real^3 | y IN node H x /\ CARD (face H y) = 4}` THEN + ABBREV_TAC `C = {y:real^3#real^3 | y IN node H x /\ CARD (face H y) >= 5}` THEN + MATCH_MP_TAC CDTETAT_lemma1 THEN + + MP_TAC (SPECL [`V:real^3->bool`; `ESTD (V:real^3->bool)`; `x:real^3#real^3`] SUM_AZIM_DART_FULLY_SURROUNDED) THEN + MP_TAC (SPECL [`V:real^3->bool`; `ESTD (V:real^3->bool)`; `x:real^3#real^3`] FULLY_SURROUNDED_NODE_DECOMPOSITION) THEN + + ASM_SIMP_TAC[CONTRAVENING_IMP_FULLY_SURROUNDED] THEN + CONV_TAC (DEPTH_CONV let_CONV) THEN + ASM_REWRITE_TAC[] THEN + ABBREV_TAC `D = {y:real^3#real^3 | y IN node H x /\ CARD (face H y) >= 4}` THEN + + DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + DISCH_THEN (CONJUNCTS_THEN2 (fun th -> ALL_TAC) MP_TAC) THEN + STRIP_TAC THEN + + SUBGOAL_THEN `&(CARD (B:real^3#real^3->bool) + CARD (C:real^3#real^3->bool)) = &(CARD (D:real^3#real^3->bool))` MP_TAC THENL + [ + REWRITE_TAC[REAL_OF_NUM_EQ] THEN + MATCH_MP_TAC CARD_UNION_EQ THEN + ASM_SIMP_TAC[GSYM DISJOINT]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM ((fun th -> ALL_TAC) o check (is_eq o concl)) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + + SUBGOAL_THEN `!y:real^3#real^3. y IN node H x ==> y IN dart_of_fan (V,ESTD V)` ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM SUBSET] THEN + MP_TAC (SPECL [`V:real^3->bool`; `ESTD (V:real^3->bool)`; `x:real^3#real^3`] NODE_SUBSET_DART_OF_FAN) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!y. y IN A ==> azim_dart (V,ESTD V) y < #1.9 /\ #0.852 < azim_dart (V,ESTD V) y` ASSUME_TAC THENL + [ + EXPAND_TAC "A" THEN GEN_TAC THEN + REWRITE_TAC[IN_ELIM_THM] THEN DISCH_TAC THEN + MP_TAC TRIANGULAR_FACE_AZIM_DART_BOUNDS THEN + UNDISCH_TAC `kcblrqc_ineq_def` THEN SIMP_TAC[kcblrqc_ineq_def] THEN DISCH_THEN (fun th -> ALL_TAC) THEN + DISCH_THEN (MP_TAC o SPECL [`V:real^3->bool`; `y:real^3#real^3`]) THEN + ASM_SIMP_TAC[REAL_ARITH `a < #1.893 ==> a < #1.9`]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!y. y IN D ==> azim_dart (V,ESTD V) y < pi /\ #1.15 < azim_dart (V,ESTD V) y` ASSUME_TAC THENL + [ + EXPAND_TAC "D" THEN GEN_TAC THEN + REWRITE_TAC[IN_ELIM_THM] THEN DISCH_TAC THEN + MP_TAC (SPEC `V:real^3->bool` non_triangular_face_azim_dart_bound) THEN ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `y:real^3#real^3`) THEN + ASM_SIMP_TAC[ARITH_RULE `3 < a <=> a >= 4`] THEN + MP_TAC (SPECL [`V:real^3->bool`] CONTRAVENING_IMP_FULLY_SURROUNDED) THEN + ASM_REWRITE_TAC[fully_surrounded] THEN + DISCH_THEN (MP_TAC o SPEC `y:real^3#real^3`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_ADD2 THEN + ONCE_REWRITE_TAC[GSYM REAL_LE_NEG] THEN + GEN_REWRITE_TAC (PAT_CONV `(\f. --sum A f <= x /\ --sum D f <= y)`) [GSYM ETA_AX] THEN + REWRITE_TAC[GSYM SUM_NEG] THEN + REWRITE_TAC[REAL_NEG_RMUL] THEN + CONJ_TAC THEN MATCH_MP_TAC SUM_BOUND THEN ASM_SIMP_TAC[REAL_LE_NEG; REAL_LT_IMP_LE]; + + SUBGOAL_THEN `x:real^3#real^3 IN A \/ x IN D` MP_TAC THENL + [ + REWRITE_TAC[GSYM IN_UNION] THEN + FIRST_X_ASSUM (MP_TAC o check (is_eq o concl)) THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[Hypermap.node_refl]; + ALL_TAC + ] THEN + + STRIP_TAC THENL + [ + MATCH_MP_TAC REAL_LTE_ADD2 THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC SUM_BOUND_LT THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE] THEN + EXISTS_TAC `x:real^3#real^3` THEN + ASM_SIMP_TAC[]; + MATCH_MP_TAC SUM_BOUND THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE] + ]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LET_ADD2 THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC SUM_BOUND THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE]; + MATCH_MP_TAC SUM_BOUND_LT THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE] THEN + EXISTS_TAC `x:real^3#real^3` THEN + POP_ASSUM MP_TAC THEN ASM_SIMP_TAC[] + ] + ]);; + + + + + +(* SZIPOAS *) + +let SZIPOAS = prove(`kcblrqc_ineq_def ==> + !V. contravening V ==> tame_11b (hypermap_of_fan (V, ESTD V))`, + REPEAT STRIP_TAC THEN REWRITE_TAC[tame_11b] THEN + MP_TAC (ISPEC `V:real^3->bool` CONTRAVENING_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + GEN_TAC THEN + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN] THEN + DISCH_TAC THEN + + MP_TAC (SPECL [`V:real^3->bool`; `ESTD (V:real^3->bool)`; `x:real^3#real^3`] FULLY_SURROUNDED_IMP_CARD_NODE_EQ_SUM_NODE_TYPE) THEN + ASM_SIMP_TAC[CONTRAVENING_IMP_FULLY_SURROUNDED; Jgtdebu.JGTDEBU4] THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`V:real^3->bool`; `x:real^3#real^3`] o MATCH_MP CDTETAT) THEN + ASM_REWRITE_TAC[type_of_node] THEN + CONV_TAC (DEPTH_CONV let_CONV) THEN + ABBREV_TAC `H = hypermap_of_fan (V,ESTD(V))` THEN + ABBREV_TAC `p = CARD (set_of_triangles_meeting_node H (x:real^3#real^3))` THEN + ABBREV_TAC `q = CARD (set_of_quadrilaterals_meeting_node H (x:real^3#real^3))` THEN + ABBREV_TAC `r = CARD (set_of_exceptional_meeting_node H (x:real^3#real^3))` THEN + + REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; PAIR_EQ] THEN + ARITH_TAC);; + + +end;; diff --git a/text_formalization/tame/CKQOWSA.hl b/text_formalization/tame/CKQOWSA.hl new file mode 100644 index 0000000..d99c64d --- /dev/null +++ b/text_formalization/tame/CKQOWSA.hl @@ -0,0 +1,580 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Tame Hypermap *) +(* Author: Alexey Solovyev *) +(* Date: 2010-07-07 *) +(* (V,ESTD V) is a fan *) +(* ========================================================================== *) + +flyspeck_needs "tame/CKQOWSA_4.hl";; +flyspeck_needs "tame/tame_defs.hl";; +flyspeck_needs "packing/pack2.hl";; + + +module Ckqowsa = struct + + +open Fan_defs;; +open Ckqowsa_3_points;; +open Ckqowsa_4_points;; + + +let packing = prove(`!V. packing V <=> (!v w. v IN V /\ w IN V /\ ~(v = w) ==> &2 <= dist (v,w))`, + REWRITE_TAC[Sphere.packing; IN]);; + + +(* UNIONS (ESTD V) SUBSET V /\ graph (ESTD V) *) + +let ESTD_fan0 = prove(`!V. UNIONS (ESTD V) SUBSET V /\ graph (ESTD V)`, + REPEAT STRIP_TAC THENL + [ + REWRITE_TAC[SUBSET; IN_UNIONS; Tame_defs.ESTD; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[Collect_geom.IN_SET2] THEN + DISCH_THEN DISJ_CASES_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[graph; Tame_defs.ESTD; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[HAS_SIZE_2_EXISTS] THEN + MAP_EVERY EXISTS_TAC [`v:real^3`; `w:real^3`] THEN + ASM_REWRITE_TAC[Collect_geom.IN_SET2]);; + + +(* fan1 (V,ESTD V) <=> FINITE V /\ ~(V = {}) *) + +let ESTD_fan1 = prove(`!V. V SUBSET ball_annulus /\ packing V /\ ~(V = {}) ==> fan1 (vec 0:real^3, V, ESTD V)`, + SIMP_TAC[Pack_defs.ball_annulus; fan1; SUBSET_EMPTY] THEN + REWRITE_TAC[SUBSET; cball; IN_DIFF; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `V = V INTER ball(vec 0:real^3, &4)` (fun th -> ONCE_REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[EXTENSION; IN_INTER; ball; IN_ELIM_THM] THEN + GEN_TAC THEN + EQ_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `&2 * h0` THEN + ASM_SIMP_TAC[Sphere.h0] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + ASM_SIMP_TAC[Pack2.KIUMVTC]);; + + + +(* fan2 (V,ESTD V) <=> ~(vec 0 IN V) *) + +let ESTD_fan2 = prove(`!V. V SUBSET ball_annulus ==> fan2 (vec 0, V, ESTD V)`, + REWRITE_TAC[SUBSET] THEN + REPEAT STRIP_TAC THEN + REWRITE_TAC[fan2] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `vec 0:real^3`) THEN + ASM_REWRITE_TAC[in_ball_annulus]);; + + +(* fan6 (V,ESTD V) <=> ~collinear {vec 0, e} *) + +let ESTD_fan6 = prove(`!V. V SUBSET ball_annulus /\ packing V ==> fan6 (vec 0, V, ESTD V)`, + REWRITE_TAC[SUBSET; Sphere.packing; fan6; Tame_defs.ESTD; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[] THEN + ASM_REWRITE_TAC[SET_RULE `{vec 0:real^3} UNION {v,w} = {vec 0,v,w}`] THEN + MATCH_MP_TAC estd_non_collinear_lemma THEN + ASM_SIMP_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + REPEAT (FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl))) THEN + ASM_SIMP_TAC[IN]);; + + +(* fan7 *) + +(* 2 points *) + +let fan7_2 = prove(`!V v w. V SUBSET ball_annulus /\ packing V /\ v IN V /\ w IN V + ==> aff_ge {vec 0} {v} INTER aff_ge {vec 0} {w} = aff_ge {vec 0} ({v} INTER {w})`, + REWRITE_TAC[SUBSET; packing] THEN + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `v = w:real^3` THENL + [ + ASM_REWRITE_TAC[INTER_ACI]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `{v} INTER {w:real^3} = {}` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[EXTENSION; NOT_IN_EMPTY; IN_SING; IN_INTER] THEN + GEN_TAC THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[CONTRAPOS_THM] THEN + STRIP_TAC THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING] THEN + REWRITE_TAC[EXTENSION; IN_SING; HALFLINE; IN_INTER; IN_ELIM_THM; VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + GEN_TAC THEN + EQ_TAC THENL + [ + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `t = &0` THENL [ ASM_REWRITE_TAC[VECTOR_MUL_LZERO]; ALL_TAC ] THEN + UNDISCH_TAC `x = t % v:real^3` THEN + DISCH_THEN (MP_TAC o AP_TERM `\v:real^3. inv t % v`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; VECTOR_MUL_LID] THEN + ABBREV_TAC `c = inv t * t'` THEN + SUBGOAL_THEN `&0 <= c` ASSUME_TAC THENL [ EXPAND_TAC "c" THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LE_INV THEN ASM_REWRITE_TAC[]; ALL_TAC ] THEN + SUBGOAL_THEN `abs c = c` ASSUME_TAC THENL [ ASM_REWRITE_TAC[REAL_ABS_REFL]; ALL_TAC ] THEN + DISCH_THEN (LABEL_TAC "v") THEN + ASM_CASES_TAC `c <= &1` THENL + [ + SUBGOAL_THEN `&2 + &2 <= norm (v:real^3) + dist (v,w)` MP_TAC THENL + [ + MATCH_MP_TAC REAL_LE_ADD2 THEN + ASM_SIMP_TAC[] THEN + REPEAT (FIRST_X_ASSUM (MP_TAC o SPEC `v:real^3`)) THEN + ASM_SIMP_TAC[in_ball_annulus]; + ALL_TAC + ] THEN + + REMOVE_THEN "v" (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[dist; NORM_MUL; VECTOR_ARITH `c % w - w = --(&1 - c) % w:real^3`] THEN + REWRITE_TAC[REAL_ABS_NEG] THEN + SUBGOAL_THEN `abs (&1 - c) = &1 - c` (fun th -> REWRITE_TAC[th]) THENL [ ASM_REWRITE_TAC[REAL_ABS_REFL; REAL_ARITH `&0 <= &1 - c <=> c <= &1`]; ALL_TAC ] THEN + REWRITE_TAC[REAL_ARITH `c * nw + (&1 - c) * nw = nw`] THEN + REPEAT (FIRST_X_ASSUM (MP_TAC o SPEC `w:real^3`)) THEN + ASM_REWRITE_TAC[in_ball_annulus; Sphere.h0] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_NOT_LE] THEN DISCH_TAC THEN + SUBGOAL_THEN `&2 + &2 <= norm (w:real^3) + dist (v,w)` MP_TAC THENL + [ + MATCH_MP_TAC REAL_LE_ADD2 THEN + ASM_SIMP_TAC[] THEN + REPEAT (FIRST_X_ASSUM (MP_TAC o SPEC `w:real^3`)) THEN + ASM_SIMP_TAC[in_ball_annulus]; + ALL_TAC + ] THEN + + USE_THEN "v" (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[dist; NORM_MUL; VECTOR_ARITH `c % w - w = (c - &1) % w:real^3`] THEN + SUBGOAL_THEN `abs (c - &1) = c - &1` (fun th -> REWRITE_TAC[th]) THENL [ ASM_SIMP_TAC[REAL_ABS_REFL; REAL_ARITH `&1 < c ==> &0 <= c - &1`]; ALL_TAC ] THEN + REWRITE_TAC[REAL_ARITH `nw + (c - &1) * nw = c * nw`] THEN + UNDISCH_TAC `abs c = c` THEN DISCH_THEN (fun th -> ONCE_REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[GSYM NORM_MUL] THEN + REPEAT (FIRST_X_ASSUM (MP_TAC o SPEC `v:real^3`)) THEN + ASM_REWRITE_TAC[in_ball_annulus; Sphere.h0] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN EXISTS_TAC `&0` THEN ASM_REWRITE_TAC[VECTOR_MUL_LZERO; REAL_LE_REFL]);; + + +(* 3 points *) + +let fan7_3 = prove(`!V e u. V SUBSET ball_annulus /\ packing V /\ u IN V /\ e IN ESTD V + ==> aff_ge {vec 0} {u} INTER aff_ge {vec 0} e = aff_ge {vec 0} ({u} INTER e)`, + REWRITE_TAC[SUBSET; Tame_defs.ESTD; IN_ELIM_THM; packing] THEN + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `~(v = vec 0:real^3) /\ ~(w = vec 0:real^3)` ASSUME_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `v:real^3`) THEN + MAP_EVERY (fun tm -> FIRST_ASSUM (MP_TAC o SPEC tm)) [`v:real^3`; `w:real^3`] THEN + ASM_SIMP_TAC[in_ball_annulus]; + ALL_TAC + ] THEN + + ASM_CASES_TAC `u:real^3 IN e` THENL + [ + SUBGOAL_THEN `{u:real^3} INTER e = {u}` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[EXTENSION; IN_INTER; IN_SING] THEN + GEN_TAC THEN + EQ_TAC THENL + [ + SIMP_TAC[]; + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) + ]; + ALL_TAC + ] THEN + + REWRITE_TAC[GSYM SUBSET_INTER_ABSORPTION] THEN + ASM_SIMP_TAC[aff_ge_0_2; HALFLINE] THEN + POP_ASSUM MP_TAC THEN + ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; SUBSET; IN_ELIM_THM; VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + REPEAT STRIP_TAC THENL + [ + MAP_EVERY EXISTS_TAC [`t:real`; `&0`]; + MAP_EVERY EXISTS_TAC [`&0`; `t:real`] + ] THEN + ASM_REWRITE_TAC[REAL_LE_REFL; VECTOR_MUL_LZERO; VECTOR_ADD_LID; VECTOR_ADD_RID]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `{u:real^3} INTER e = {}` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[EXTENSION; NOT_IN_EMPTY; IN_INTER; IN_SING] THEN + GEN_TAC THEN STRIP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + + REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING] THEN + ASM_CASES_TAC `aff_ge {vec 0} {u:real^3} INTER aff_ge {vec 0} e = {vec 0}` THEN ASM_REWRITE_TAC[] THEN + + SUBGOAL_THEN `?p. ~(p = vec 0:real^3) /\ p IN aff_ge {vec 0} {u} INTER aff_ge {vec 0} e` MP_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REWRITE_TAC[EXTENSION; IN_SING; NOT_FORALL_THM] THEN + DISCH_THEN (CHOOSE_THEN MP_TAC) THEN + ASM_CASES_TAC `x = vec 0:real^3` THENL + [ + ASM_REWRITE_TAC[IN_INTER; points_in_aff_ge_0_2; ENDS_IN_HALFLINE]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + EXISTS_TAC `x:real^3` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[IN_INTER] THEN STRIP_TAC THEN + UNDISCH_TAC `p IN aff_ge {vec 0} {u:real^3}` THEN + ASM_SIMP_TAC[HALFLINE; VECTOR_MUL_RZERO; VECTOR_ADD_LID; IN_ELIM_THM] THEN STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + ASM_CASES_TAC `t = &0` THEN ASM_REWRITE_TAC[VECTOR_MUL_LZERO] THEN + DISCH_THEN (MP_TAC o AP_TERM `\v:real^3. inv t % v`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; VECTOR_MUL_LID] THEN + DISCH_TAC THEN + + SUBGOAL_THEN `u:real^3 IN aff_ge {vec 0} {v,w}` ASSUME_TAC THENL + [ + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + UNDISCH_TAC `p IN aff_ge {vec 0:real^3} {v,w}` THEN + ASM_SIMP_TAC[aff_ge_0_2; IN_ELIM_THM] THEN + STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`inv t * t1`; `inv t * t2`] THEN + SUBGOAL_THEN `&0 <= inv t` ASSUME_TAC THENL [ MATCH_MP_TAC REAL_LE_INV THEN ASM_REWRITE_TAC[]; ALL_TAC ] THEN + REWRITE_TAC[CONJ_ASSOC] THEN + CONJ_TAC THENL [ CONJ_TAC THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; ALL_TAC ] THEN + ASM_REWRITE_TAC[] THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC LEMMA_3_POINTS_FINAL THEN + MAP_EVERY EXISTS_TAC [`v:real^3`; `w:real^3`; `u:real^3`] THEN + ASM_SIMP_TAC[] THEN + UNDISCH_TAC `~(u:real^3 IN e)` THEN + ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; DE_MORGAN_THM] THEN + ASM_SIMP_TAC[]);; + + + +(* 4 points *) + +let fan7_4_0 = prove(`!V e1 e2. V SUBSET ball_annulus /\ packing V /\ e1 IN ESTD V /\ e2 IN ESTD V /\ + (e1 INTER e2) HAS_SIZE 0 + ==> aff_ge {vec 0} e1 INTER aff_ge {vec 0} e2 = aff_ge {vec 0} (e1 INTER e2)`, + REWRITE_TAC[SUBSET; packing; HAS_SIZE_0; Tame_defs.ESTD; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + FIRST_ASSUM (fun th -> REWRITE_TAC[th]) THEN + ASM_REWRITE_TAC[AFF_GE_EQ_AFFINE_HULL; AFFINE_HULL_SING] THEN + MATCH_MP_TAC LEMMA_4_POINTS_FINAL THEN + ASM_SIMP_TAC[] THEN + REPEAT CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN + SET_TAC[]);; + + + +let fan7_4_1_one_case = prove(`!V v1 v2 v3 v4. V SUBSET ball_annulus /\ packing V /\ v1 IN V /\ v2 IN V /\ v3 IN V /\ v4 IN V /\ + ~(v1 = v3) /\ ~(v2 = v4) /\ v1 = v2 /\ ~(v3 = v4) /\ + dist (v1,v3) <= &2 * h0 /\ dist (v2,v4) <= &2 * h0 + ==> aff_ge {vec 0} {v1,v3} INTER aff_ge {vec 0} {v2,v4} = aff_ge {vec 0} ({v1,v3} INTER {v2,v4})`, + REWRITE_TAC[SUBSET; packing] THEN REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `{v2,v3} INTER {v2,v4} = {v2:real^3}` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[EXTENSION; IN_INTER; IN_SING; IN_INSERT; NOT_IN_EMPTY] THEN + GEN_TAC THEN + ASM_CASES_TAC `x = v2:real^3` THEN ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN POP_ASSUM MP_TAC THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[th]); + ALL_TAC + ] THEN + + SUBGOAL_THEN `~(v2 = vec 0:real^3) /\ ~(v3 = vec 0:real^3) /\ ~(v4 = vec 0:real^3)` ASSUME_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `x:real^3`) THEN + MAP_EVERY (fun tm -> FIRST_ASSUM (MP_TAC o SPEC tm)) [`v2:real^3`; `v3:real^3`; `v4:real^3`] THEN + ASM_SIMP_TAC[in_ball_annulus]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[aff_ge_0_2] THEN + REWRITE_TAC[EXTENSION; IN_INTER; HALFLINE; VECTOR_MUL_RZERO; VECTOR_ADD_LID; IN_ELIM_THM] THEN + GEN_TAC THEN EQ_TAC THENL + [ + STRIP_TAC THEN + POP_ASSUM (LABEL_TAC "x2" o SYM) THEN + UNDISCH_TAC `x = t1 % v2 + t2 % v3:real^3` THEN + DISCH_THEN (LABEL_TAC "x1" o SYM) THEN + + ASM_CASES_TAC `t1 <= t1'` THENL + [ + ASM_CASES_TAC `t2 = &0` THENL + [ + EXISTS_TAC `t1:real` THEN + REMOVE_THEN "x1" MP_TAC THEN + ASM_SIMP_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID]; + ALL_TAC + ] THEN + + REMOVE_THEN "x1" (MP_TAC o AP_TERM `\v:real^3. inv t2 % v`) THEN + REMOVE_THEN "x2" (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; VECTOR_ADD_LDISTRIB; REAL_MUL_LINV; VECTOR_MUL_LID] THEN + REWRITE_TAC[VECTOR_ARITH `a % v2 + v3:real^3 = b % v2 + c % v4 <=> v3 = (b - a) % v2 + c % v4`] THEN + REWRITE_TAC[GSYM REAL_SUB_LDISTRIB] THEN DISCH_TAC THEN + SUBGOAL_THEN `v3:real^3 IN aff_ge {vec 0} {v2, v4}` ASSUME_TAC THENL + [ + ASM_SIMP_TAC[aff_ge_0_2; IN_ELIM_THM] THEN + MAP_EVERY EXISTS_TAC [`inv t2 * (t1' - t1)`; `inv t2 * t2'`] THEN + SUBGOAL_THEN `&0 <= inv t2` ASSUME_TAC THENL [ MATCH_MP_TAC REAL_LE_INV THEN ASM_REWRITE_TAC[]; ALL_TAC ] THEN + REWRITE_TAC[] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[REAL_ARITH `&0 <= t1' - t1 <=> t1 <= t1'`]; + ALL_TAC + ] THEN + + MATCH_MP_TAC (TAUT `F ==> A`) THEN + MATCH_MP_TAC LEMMA_3_POINTS_FINAL THEN + MAP_EVERY EXISTS_TAC [`v2:real^3`; `v4:real^3`; `v3:real^3`] THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN REMOVE_ASSUM THEN + ASM_SIMP_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `v1 = v2:real^3` THEN DISCH_THEN (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_NOT_LE] THEN DISCH_TAC THEN + ASM_CASES_TAC `t2' = &0` THENL + [ + EXISTS_TAC `t1':real` THEN + REMOVE_THEN "x2" MP_TAC THEN + ASM_SIMP_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID]; + ALL_TAC + ] THEN + + REMOVE_THEN "x2" (MP_TAC o AP_TERM `\v:real^3. inv t2' % v`) THEN + REMOVE_THEN "x1" (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; VECTOR_ADD_LDISTRIB; REAL_MUL_LINV; VECTOR_MUL_LID] THEN + REWRITE_TAC[VECTOR_ARITH `a % v2 + v4:real^3 = b % v2 + c % v3 <=> v4 = (b - a) % v2 + c % v3`] THEN + REWRITE_TAC[GSYM REAL_SUB_LDISTRIB] THEN DISCH_TAC THEN + SUBGOAL_THEN `v4:real^3 IN aff_ge {vec 0} {v2, v3}` ASSUME_TAC THENL + [ + ASM_SIMP_TAC[aff_ge_0_2; IN_ELIM_THM] THEN + MAP_EVERY EXISTS_TAC [`inv t2' * (t1 - t1')`; `inv t2' * t2`] THEN + SUBGOAL_THEN `&0 <= inv t2'` ASSUME_TAC THENL [ MATCH_MP_TAC REAL_LE_INV THEN ASM_REWRITE_TAC[]; ALL_TAC ] THEN + REWRITE_TAC[] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_SIMP_TAC[REAL_ARITH `t1' < t1 ==> &0 <= t1 - t1'`]; + ALL_TAC + ] THEN + + MATCH_MP_TAC (TAUT `F ==> A`) THEN + MATCH_MP_TAC LEMMA_3_POINTS_FINAL THEN + MAP_EVERY EXISTS_TAC [`v2:real^3`; `v3:real^3`; `v4:real^3`] THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN REMOVE_ASSUM THEN + ASM_SIMP_TAC[] THEN + UNDISCH_TAC `v1 = v2:real^3` THEN DISCH_THEN (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + + STRIP_TAC THEN + CONJ_TAC THEN MAP_EVERY EXISTS_TAC [`t:real`; `&0`] THEN ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID; REAL_LE_REFL]);; + + + +let fan7_4_1_cases = prove(`!v w v' w':A. ~(v = w) /\ ~(v' = w') /\ ({v,w} INTER {v',w'}) HAS_SIZE 1 + ==> (v = v' /\ ~(w = w')) \/ (v = w' /\ ~(w = v')) \/ + (w = v' /\ ~(v = w')) \/ (w = w' /\ ~(v = v'))`, + REPEAT STRIP_TAC THEN + POP_ASSUM (LABEL_TAC "A") THEN + ASM_CASES_TAC `v = v':A` THEN ASM_REWRITE_TAC[] THENL + [ + DISJ1_TAC THEN + DISCH_TAC THEN + REMOVE_THEN "A" MP_TAC THEN + ASM_REWRITE_TAC[INTER_ACI] THEN + REWRITE_TAC[HAS_SIZE_1_EXISTS; EXISTS_UNIQUE; NOT_EXISTS_THM; DE_MORGAN_THM; IN_INSERT; NOT_IN_EMPTY] THEN + ASM_MESON_TAC[]; + ALL_TAC + ] THEN + + ASM_CASES_TAC `v = w':A` THEN ASM_REWRITE_TAC[] THENL + [ + DISJ1_TAC THEN + DISCH_TAC THEN + REMOVE_THEN "A" MP_TAC THEN + ASM_REWRITE_TAC[INTER_ACI; Collect_geom.PER_SET2] THEN + REWRITE_TAC[HAS_SIZE_1_EXISTS; EXISTS_UNIQUE; NOT_EXISTS_THM; DE_MORGAN_THM; IN_INSERT; NOT_IN_EMPTY] THEN + ASM_MESON_TAC[]; + ALL_TAC + ] THEN + + ASM_CASES_TAC `w = v':A` THEN ASM_REWRITE_TAC[] THEN + REMOVE_THEN "A" MP_TAC THEN + REWRITE_TAC[HAS_SIZE_1_EXISTS; EXISTS_UNIQUE; IN_INTER; IN_INSERT; NOT_IN_EMPTY] THEN + ASM_MESON_TAC[]);; + + + + +let fan7_4_1 = prove(`!V e1 e2. V SUBSET ball_annulus /\ packing V /\ e1 IN ESTD V /\ e2 IN ESTD V /\ + (e1 INTER e2) HAS_SIZE 1 + ==> aff_ge {vec 0} e1 INTER aff_ge {vec 0} e2 = aff_ge {vec 0} (e1 INTER e2)`, + REWRITE_TAC[Tame_defs.ESTD; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + + MP_TAC (ISPECL [`v:real^3`; `w:real^3`; `v':real^3`; `w':real^3`] fan7_4_1_cases) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THENL + [ + MATCH_MP_TAC fan7_4_1_one_case THEN + EXISTS_TAC `V:real^3->bool` THEN + ASM_REWRITE_TAC[]; + + GEN_REWRITE_TAC (PAT_CONV `\x. s INTER aff_ge {vec 0:real^3} x = aff_ge {vec 0} (t INTER x)`) [Collect_geom.PER_SET2] THEN + MATCH_MP_TAC fan7_4_1_one_case THEN + EXISTS_TAC `V:real^3->bool` THEN + ASM_REWRITE_TAC[DIST_SYM]; + + GEN_REWRITE_TAC (PAT_CONV `\x. aff_ge {vec 0:real^3} x INTER s = aff_ge {vec 0} (x INTER t)`) [Collect_geom.PER_SET2] THEN + MATCH_MP_TAC fan7_4_1_one_case THEN + EXISTS_TAC `V:real^3->bool` THEN + ASM_REWRITE_TAC[DIST_SYM] THEN + UNDISCH_TAC `dist (v,w:real^3) <= &2 * h0` THEN + ASM_SIMP_TAC[]; + + ONCE_REWRITE_TAC[Collect_geom.PER_SET2] THEN + MATCH_MP_TAC fan7_4_1_one_case THEN + EXISTS_TAC `V:real^3->bool` THEN + ASM_REWRITE_TAC[DIST_SYM] THEN + UNDISCH_TAC `dist (v,w:real^3) <= &2 * h0` THEN + ASM_SIMP_TAC[] + ]);; + + + +let fan7_4_2 = prove(`!V e1 e2. e1 IN ESTD V /\ e2 IN ESTD V /\ (e1 INTER e2) HAS_SIZE 2 + ==> aff_ge {vec 0} e1 INTER aff_ge {vec 0} e2 = aff_ge {vec 0} (e1 INTER e2)`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `(e1:real^3->bool) HAS_SIZE 2 /\ (e2:real^3->bool) HAS_SIZE 2` STRIP_ASSUME_TAC THENL + [ + MP_TAC (SPEC_ALL ESTD_fan0) THEN REWRITE_TAC[graph] THEN + STRIP_TAC THEN + CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_SIMP_TAC[GSYM IN]; + ALL_TAC + ] THEN + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN + REWRITE_TAC[HAS_SIZE] THEN REPEAT DISCH_TAC THEN + + SUBGOAL_THEN `e1:real^3->bool = e2` MP_TAC THENL + [ + MATCH_MP_TAC EQ_TRANS THEN + EXISTS_TAC `e1 INTER e2:real^3->bool` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC EQ_SYM THEN + MATCH_MP_TAC CARD_SUBSET_EQ THEN + ASM_REWRITE_TAC[INTER_SUBSET]; + MATCH_MP_TAC CARD_SUBSET_EQ THEN + ASM_REWRITE_TAC[INTER_SUBSET] + ]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[INTER_ACI]);; + + + + +let ESTD_fan7 = prove(`!V. V SUBSET ball_annulus /\ packing V ==> fan7 (vec 0, V, ESTD V)`, + REWRITE_TAC[fan7; IN_UNION; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THENL + [ + SUBGOAL_THEN `?n. n <= 2 /\ (e1:real^3->bool) INTER e2 HAS_SIZE n` MP_TAC THENL + [ + SUBGOAL_THEN `e1:real^3->bool HAS_SIZE 2` MP_TAC THENL + [ + MP_TAC (SPEC `V:real^3->bool` ESTD_fan0) THEN + REWRITE_TAC[graph] THEN STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + UNDISCH_TAC `e1 IN ESTD V` THEN + SIMP_TAC[IN]; + ALL_TAC + ] THEN + + REWRITE_TAC[HAS_SIZE] THEN + STRIP_TAC THEN + EXISTS_TAC `CARD (e1 INTER e2:real^3->bool)` THEN + REWRITE_TAC[] THEN + SUBGOAL_THEN `FINITE (e1 INTER e2:real^3->bool)` ASSUME_TAC THENL + [ + MATCH_MP_TAC FINITE_SUBSET THEN + EXISTS_TAC `e1:real^3->bool` THEN + ASM_REWRITE_TAC[INTER_SUBSET]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (fun th -> REWRITE_TAC [SYM th]) THEN + MATCH_MP_TAC CARD_SUBSET THEN + ASM_REWRITE_TAC[INTER_SUBSET]; + ALL_TAC + ] THEN + + REWRITE_TAC[ARITH_RULE `n <= 2 <=> n = 0 \/ n = 1 \/ n = 2`] THEN + REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THENL + [ + MATCH_MP_TAC fan7_4_0 THEN + EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC fan7_4_1 THEN + EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC fan7_4_2 THEN + EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[] + ]; + + ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[INTER_ACI] THEN + MATCH_MP_TAC fan7_3 THEN + EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]; + + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC fan7_3 THEN + EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[]; + + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC fan7_2 THEN + EXISTS_TAC `V:real^3->bool` THEN ASM_REWRITE_TAC[] + ]);; + + +(* CKQOWSA *) + +let CKQOWSA = prove(`!V. V SUBSET ball_annulus /\ packing V /\ ~(V = {}) ==> FAN (vec 0,V,ESTD V)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[Fan_defs.FAN] THEN + ASM_SIMP_TAC[ESTD_fan0; ESTD_fan1; ESTD_fan2; ESTD_fan6; ESTD_fan7]);; + + +end;; diff --git a/text_formalization/tame/CKQOWSA_3.hl b/text_formalization/tame/CKQOWSA_3.hl new file mode 100644 index 0000000..39095fb --- /dev/null +++ b/text_formalization/tame/CKQOWSA_3.hl @@ -0,0 +1,1455 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Tame Hypermap *) +(* Author: Alexey Solovyev *) +(* Date: 2010-07-07 *) +(* (V,ESTD V) is a fan (3-point case) *) +(* ========================================================================== *) + +flyspeck_needs "fan/fan_defs.hl";; +flyspeck_needs "packing/pack_defs.hl";; + +flyspeck_needs "tame/Inequalities.hl";; + + +module Ckqowsa_3_points = struct + + +open Fan_defs;; + + +let REMOVE_ASSUM = POP_ASSUM (fun th -> ALL_TAC);; + + + +let coplanar_eq_coplanar_alt = prove(`!s:real^N->bool. 2 <= dimindex(:N) ==> (coplanar s <=> coplanar_alt s)`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[COPLANAR; Collect_geom.coplanar_alt]);; + + + + +let in_ball_annulus = prove(`!v. v IN ball_annulus <=> &2 <= norm v /\ norm v <= &2 * h0 /\ ~(v = vec 0)`, + REWRITE_TAC[Pack_defs.ball_annulus] THEN + REWRITE_TAC[IN_DIFF; cball; ball; IN_ELIM_THM; DIST_0] THEN + REWRITE_TAC[GSYM NORM_EQ_0] THEN + REAL_ARITH_TAC);; + + + + +let projection_lemma = prove(`!v n:real^N. ~(n = vec 0) ==> + ?a x. (v dot n) / (n dot n) = a /\ x dot n = &0 /\ v = x + a % n`, + REWRITE_TAC[GSYM NORM_EQ_0] THEN + REPEAT STRIP_TAC THEN + EXISTS_TAC `(v dot n:real^N) / (n dot n)` THEN + EXISTS_TAC `v - (v dot n:real^N) / (n dot n) % n` THEN + REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + REWRITE_TAC[DOT_LSUB; DOT_LMUL; DOT_SQUARE_NORM] THEN + POP_ASSUM MP_TAC THEN + CONV_TAC REAL_FIELD; + ALL_TAC + ] THEN + VECTOR_ARITH_TAC);; + + + + +let dist_lower_bound = prove(`!v1 v2 n:real^N. ~(n = vec 0) ==> + dist (v1, v2) pow 2 >= ((v1 - v2) dot n) pow 2 / (n dot n)`, + REPEAT STRIP_TAC THEN + FIRST_ASSUM MP_TAC THEN + REWRITE_TAC[dist; GSYM DOT_SQUARE_NORM; GSYM NORM_EQ_0] THEN + MP_TAC (SPECL [`v1:real^N`; `n:real^N`] projection_lemma) THEN + MP_TAC (SPECL [`v2:real^N`; `n:real^N`] projection_lemma) THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[VECTOR_ARITH `((x' + a' % n) - (x + a % n)) dot ((x' + a' % n) - (x + a % n:real^N)) = (x' - x) dot (x' - x) + (a' - a) pow 2 * (n dot n) + &2 * (a' - a) * (x' dot n - x dot n)`] THEN + ASM_REWRITE_TAC[VECTOR_ARITH `((x' + a' % n:real^N) - (x + a % n)) dot n = (a' - a) * (n dot n) + x' dot n - x dot n`] THEN + REWRITE_TAC[REAL_MUL_RZERO; REAL_SUB_RZERO; REAL_ADD_RID] THEN + REWRITE_TAC[REAL_POW_MUL; DOT_SQUARE_NORM] THEN + ASM_SIMP_TAC[REAL_FIELD `~(n = &0) ==> (a pow 2 * n pow 2 pow 2) / n pow 2 = a pow 2 * n pow 2`] THEN + REWRITE_TAC[REAL_ARITH `a + b >= b <=> &0 <= a`] THEN + REWRITE_TAC[GSYM DOT_SQUARE_NORM] THEN + REWRITE_TAC[DOT_POS_LE]);; + + + + + +let non_collinear_lemma = prove(`!v w. v IN ball_annulus /\ w IN ball_annulus /\ &2 <= dist (v,w) /\ &0 < v dot w + ==> ~(collinear {vec 0, v, w})`, + REWRITE_TAC[COLLINEAR_BETWEEN_CASES; DE_MORGAN_THM] THEN + REWRITE_TAC[in_ball_annulus; Pack_defs.h0; REAL_ARITH `&2 * #1.26 = #2.52`] THEN + REPEAT GEN_TAC THEN DISCH_THEN STRIP_ASSUME_TAC THEN + CONJ_TAC THENL + [ + REWRITE_TAC[BETWEEN_DOT] THEN + REWRITE_TAC[VECTOR_SUB_LZERO; VECTOR_SUB_RZERO; NORM_NEG; DOT_LNEG] THEN + MATCH_MP_TAC (REAL_ARITH `&0 < a /\ &0 <= b ==> ~(--a = b)`) THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + REWRITE_TAC[NORM_POS_LE]; + ALL_TAC + ] THEN + + REWRITE_TAC[between; DIST_0] THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REWRITE_TAC[DIST_SYM] THEN + REAL_ARITH_TAC);; + + + + + + + + + + + +let aff_ge_0_2 = prove(`!u v:real^N. ~(u = vec 0) /\ ~(v = vec 0) ==> aff_ge {vec 0} {u,v} = {y | ?t1 t2. &0 <= t1 /\ &0 <= t2 /\ y = t1 % u + t2 % v}`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `DISJOINT {vec 0} {u:real^N, v}` ASSUME_TAC THENL + [ + REWRITE_TAC[DISJOINT; EXTENSION; IN_INTER; IN_INSERT; NOT_IN_EMPTY; DE_MORGAN_THM] THEN + ASM_MESON_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[Fan.AFF_GE_1_2] THEN + REWRITE_TAC[EXTENSION] THEN GEN_TAC THEN + REWRITE_TAC[IN_ELIM_THM] THEN + EQ_TAC THEN STRIP_TAC THENL + [ + MAP_EVERY EXISTS_TAC [`t2:real`; `t3:real`] THEN + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN + VECTOR_ARITH_TAC; + MAP_EVERY EXISTS_TAC [`&1 - t1 - t2`; `t1:real`; `t2:real`] THEN + ASM_REWRITE_TAC[] THEN CONJ_TAC THENL + [ + REAL_ARITH_TAC; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN + VECTOR_ARITH_TAC + ]);; + + + +let in_aff_ge_0_2 = prove(`!v1 v2 w. v1 IN ball_annulus /\ v2 IN ball_annulus /\ w IN ball_annulus /\ + &2 <= dist (v1,w) /\ &2 <= dist (v2,w) /\ + w IN aff_ge {vec 0} {v1,v2} + ==> ?t1 t2. &0 < t1 /\ &0 < t2 /\ w = t1 % v1 + t2 % v2`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `~(w = vec 0:real^3) /\ ~(v1 = vec 0:real^3) /\ ~(v2 = vec 0:real^3)` ASSUME_TAC THENL + [ + REPEAT (POP_ASSUM MP_TAC) THEN + REWRITE_TAC[in_ball_annulus; GSYM NORM_EQ_0] THEN + SIMP_TAC[REAL_ARITH `&2 <= a ==> ~(a = &0)`]; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl)) THEN + ASM_SIMP_TAC[aff_ge_0_2] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`t1:real`; `t2:real`] THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < t <=> &0 <= t /\ ~(t = &0)`] THEN + CONJ_TAC THEN DISCH_TAC THENL + [ + SUBGOAL_THEN `collinear {vec 0:real^3,v2,w}` MP_TAC THENL + [ + ONCE_REWRITE_TAC[COLLINEAR_LEMMA_ALT] THEN + ASM_REWRITE_TAC[] THEN + EXISTS_TAC `t2:real` THEN + VECTOR_ARITH_TAC; + ALL_TAC + ]; + + SUBGOAL_THEN `collinear {vec 0:real^3,v1,w}` MP_TAC THENL + [ + ONCE_REWRITE_TAC[COLLINEAR_LEMMA_ALT] THEN + ASM_REWRITE_TAC[] THEN + EXISTS_TAC `t1:real` THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] + ] THEN + + REWRITE_TAC[] THEN + MATCH_MP_TAC non_collinear_lemma THEN + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID; DOT_RMUL; VECTOR_ADD_RID] THEN + MATCH_MP_TAC REAL_LT_MUL THEN + REWRITE_TAC[REAL_ARITH `&0 < t <=> &0 <= t /\ ~(t = &0)`] THEN + ASM_REWRITE_TAC[DOT_POS_LE; DOT_EQ_0] THEN + DISCH_TAC THEN UNDISCH_TAC `w = t1 % v1 + t2 % v2:real^3` THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID]);; + + + +let in_aff_ge_0_2_imp_dot_pos = prove(`!v1 v2 w:real^N. &0 < v1 dot v2 /\ w IN aff_ge {vec 0} {v1,v2} /\ ~(w = vec 0) + ==> &0 < v1 dot w /\ &0 < v2 dot w`, + REPEAT GEN_TAC THEN DISCH_THEN STRIP_ASSUME_TAC THEN + SUBGOAL_THEN `~(v1 = vec 0:real^N) /\ ~(v2 = vec 0:real^N)` ASSUME_TAC THENL + [ + CONJ_TAC THEN DISCH_TAC THEN UNDISCH_TAC `&0 < v1:real^N dot v2` THEN + ASM_REWRITE_TAC[DOT_LZERO; DOT_RZERO; REAL_LT_REFL]; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl)) THEN + ASM_SIMP_TAC[aff_ge_0_2] THEN + REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN + ASM_REWRITE_TAC[DOT_RADD; DOT_RMUL] THEN + ASM_CASES_TAC `t1 = &0` THENL + [ + ASM_REWRITE_TAC[REAL_MUL_LZERO; REAL_ADD_LID] THEN + ASM_CASES_TAC `t2 = &0` THENL + [ + UNDISCH_TAC `w = t1 % v1 + t2 % v2:real^N` THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID]; + ALL_TAC + ] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LT_MUL THEN + ASM_REWRITE_TAC[DOT_POS_LT; REAL_ARITH `&0 < t <=> &0 <= t /\ ~(t = &0)`]; + ALL_TAC + ] THEN + + CONJ_TAC THEN MATCH_MP_TAC REAL_LTE_ADD THENL + [ + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LT_MUL THEN + ASM_REWRITE_TAC[DOT_POS_LT] THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < t <=> &0 <= t /\ ~(t = &0)`]; + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE] + ]; + + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LT_MUL THEN + ASM_REWRITE_TAC[DOT_SYM] THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < t <=> &0 <= t /\ ~(t = &0)`]; + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[DOT_POS_LE] + ] + ]);; + + + +let aff_ge_eq_lemma = prove(`!a v1 v2 u:real^N. &0 < a /\ u = a % v2 /\ ~(v1 = vec 0) /\ ~(v2 = vec 0) + ==> aff_ge {vec 0} {v1,v2} = aff_ge {vec 0} {v1,u}`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `~(u:real^N = vec 0)` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[VECTOR_MUL_EQ_0] THEN + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + ASM_SIMP_TAC[aff_ge_0_2] THEN + REWRITE_TAC[EXTENSION; IN_ELIM_THM] THEN + GEN_TAC THEN EQ_TAC THENL + [ + STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`t1:real`; `t2 * inv(a)`] THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_INV THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE]; + ALL_TAC + ] THEN + + REWRITE_TAC[VECTOR_ARITH `(t2 * inva ) % a % v2 = (t2 * (inva * a)) % v2:real^N`] THEN + ASM_SIMP_TAC[REAL_FIELD `&0 < a ==> inv a * a = &1`] THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`t1:real`; `t2 * a`] THEN + ASM_REWRITE_TAC[VECTOR_ARITH `(t2 * a) % v2 = t2 % a % v2:real^N`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE]);; + + + + +let triangle_height_lemma = prove(`!v w:real^3. ~(w = vec 0) + ==> ?a n. v = a % w + n /\ n dot w = &0 /\ norm n = norm (v cross w) / norm w`, + REPEAT STRIP_TAC THEN FIRST_ASSUM MP_TAC THEN + REWRITE_TAC[GSYM NORM_EQ_0] THEN + DISCH_TAC THEN + EXISTS_TAC `(v:real^3 dot w) / (w dot w)` THEN + EXISTS_TAC `v - (v:real^3 dot w) / (w dot w) % w` THEN + REPEAT CONJ_TAC THENL + [ + VECTOR_ARITH_TAC; + REWRITE_TAC[DOT_LSUB; DOT_LMUL; DOT_SQUARE_NORM] THEN + POP_ASSUM MP_TAC THEN + CONV_TAC REAL_FIELD; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!x:real^3. norm x = abs (norm x)` (fun th -> ONCE_REWRITE_TAC[th]) THENL + [ + GEN_TAC THEN MP_TAC (ISPEC `x:real^3` NORM_POS_LE) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[GSYM REAL_ABS_DIV] THEN + REWRITE_TAC[REAL_EQ_SQUARE_ABS] THEN + REWRITE_TAC[NORM_POW_2; NORM_CROSS] THEN + REWRITE_TAC[REAL_POW_DIV; REAL_POW_MUL] THEN + REWRITE_TAC[SIN_SQUARED_VECTOR_ANGLE] THEN + ASM_CASES_TAC `v:real^3 = vec 0` THEN ASM_REWRITE_TAC[] THENL + [ + REWRITE_TAC[NORM_0; DOT_LZERO; REAL_POW_ZERO; Collect_geom.REAL_DIV_LZERO; VECTOR_MUL_LZERO; VECTOR_SUB_RZERO] THEN + REWRITE_TAC[ARITH_RULE `~(2 = 0)`] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + REWRITE_TAC[DOT_LSUB; DOT_RSUB; DOT_LMUL; DOT_RMUL] THEN + REWRITE_TAC[DOT_SQUARE_NORM] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[GSYM NORM_EQ_0] THEN + REWRITE_TAC[DOT_SYM] THEN + CONV_TAC REAL_FIELD);; + + + +let in_aff_ge_dist_lemma = prove(`!v1 v2 n1 n2 a b w:real^N. ~(w = vec 0) /\ ~(v1 = vec 0) /\ ~(v2 = vec 0) /\ + w IN aff_ge {vec 0} {v1, v2} /\ + v1 = a % w + n1 /\ v2 = b % w + n2 /\ + n1 dot w = &0 /\ n2 dot w = &0 + ==> norm (n1 - n2) = norm n1 + norm n2`, + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `n1:real^N = vec 0` THENL + [ + ASM_REWRITE_TAC[NORM_0; VECTOR_SUB_LZERO; NORM_NEG; REAL_ADD_LID]; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl)) THEN + ASM_SIMP_TAC[aff_ge_0_2] THEN + REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN + SUBGOAL_THEN `n1:real^N dot w = t1 * (n1 dot n1) + t2 * (n1 dot n2)` MP_TAC THENL + [ + POP_ASSUM (fun th -> ONCE_REWRITE_TAC[th]) THEN + ASM_REWRITE_TAC[DOT_RADD; DOT_RMUL] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + SUBGOAL_THEN `n2:real^N dot w = t1 * (n1 dot n2) + t2 * (n2 dot n2)` MP_TAC THENL + [ + POP_ASSUM (fun th -> ONCE_REWRITE_TAC[th]) THEN + ASM_REWRITE_TAC[DOT_RADD; DOT_RMUL; DOT_SYM] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + POP_ASSUM (LABEL_TAC "A") THEN + ASM_REWRITE_TAC[] THEN + + ASM_CASES_TAC `t2 = &0` THENL + [ + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + ASM_CASES_TAC `t1 = &0` THENL + [ + REMOVE_THEN "A" MP_TAC THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID]; + ALL_TAC + ] THEN + REWRITE_TAC[REAL_MUL_LZERO; REAL_ADD_RID] THEN + ASM_REWRITE_TAC[REAL_ENTIRE; EQ_SYM_EQ] THEN + ASM_REWRITE_TAC[DOT_EQ_0]; + ALL_TAC + ] THEN + + REPEAT (DISCH_THEN (ASSUME_TAC o SYM)) THEN + SUBGOAL_THEN `n1:real^N dot n2 = --(t1 / t2) * (n1 dot n1)` ASSUME_TAC THENL + [ + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN + CONV_TAC REAL_FIELD; + ALL_TAC + ] THEN + + SUBGOAL_THEN `n1 dot n2:real^N <= &0` MP_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[REAL_ARITH `--a * b <= &0 <=> &0 <= a * b`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + REWRITE_TAC[DOT_POS_LE] THEN + MATCH_MP_TAC REAL_LE_DIV THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REMOVE_ASSUM THEN DISCH_TAC THEN + + UNDISCH_TAC `~(n1 = vec 0:real^N)` THEN + REWRITE_TAC[GSYM NORM_EQ_0] THEN + DISCH_TAC THEN + SUBGOAL_THEN `(n1:real^N dot n2) pow 2 = (norm n1 pow 2) * (norm n2 pow 2)` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REMOVE_ASSUM THEN + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN + REWRITE_TAC[DOT_SQUARE_NORM] THEN + CONV_TAC REAL_FIELD; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN + REWRITE_TAC[GSYM REAL_POW_MUL] THEN + REWRITE_TAC[GSYM REAL_EQ_SQUARE_ABS; REAL_ABS_MUL; REAL_ABS_NORM] THEN + SUBGOAL_THEN `abs (n1:real^N dot n2) = --(n1 dot n2)` (fun th -> REWRITE_TAC[th]) THENL + [ + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_TAC THEN + SUBGOAL_THEN `norm (n1:real^N) + norm (n2:real^N) = abs (norm n1 + norm n2) /\ norm (n1 - n2) = abs (norm (n1 - n2))` (fun th -> ONCE_REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[REAL_ABS_NORM] THEN + MP_TAC (ISPEC `n1:real^N` NORM_POS_LE) THEN + MP_TAC (ISPEC `n2:real^N` NORM_POS_LE) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + REWRITE_TAC[REAL_EQ_SQUARE_ABS] THEN + REWRITE_TAC[GSYM DOT_SQUARE_NORM] THEN + REWRITE_TAC[DOT_LSUB; DOT_RSUB; DOT_SYM; REAL_POW_2; REAL_ADD_LDISTRIB; REAL_ADD_RDISTRIB] THEN + ASM_REWRITE_TAC[DOT_SQUARE_NORM] THEN + POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC);; + + + +let in_aff_ge_dist_lower_bound = prove(`!v1 v2 w. ~(v1 = vec 0) /\ ~(v2 = vec 0) /\ ~(w = vec 0) /\ + w IN aff_ge {vec 0} {v1, v2} + ==> dist (v1,v2) >= (norm (v1 cross w) + norm (v2 cross w)) / norm w`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`v1:real^3`; `w:real^3`] triangle_height_lemma) THEN + MP_TAC (SPECL [`v2:real^3`; `w:real^3`] triangle_height_lemma) THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + + MP_TAC (ISPECL [`v1:real^3`; `v2:real^3`; `n':real^3`; `n:real^3`; `a':real`; `a:real`; `w:real^3`] in_aff_ge_dist_lemma) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + DISCH_TAC THEN + + SUBGOAL_THEN `dist (v1,v2:real^3) = sqrt ((a - a') pow 2* norm (w:real^3) pow 2 + (n - n':real^3) dot (n - n'))` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[dist; vector_norm] THEN + ASM_REWRITE_TAC[DOT_LSUB; DOT_RSUB; DOT_LMUL; DOT_RMUL; DOT_RADD; DOT_LADD; DOT_SYM] THEN + AP_TERM_TAC THEN + REWRITE_TAC[GSYM vector_norm; DOT_SQUARE_NORM] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + REWRITE_TAC[real_ge] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `sqrt ((n:real^3 - n') dot (n - n'))` THEN + CONJ_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REWRITE_TAC[GSYM vector_norm; NORM_SUB] THEN + ASM_SIMP_TAC[] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC SQRT_MONO_LE THEN + REWRITE_TAC[DOT_POS_LE] THEN + REWRITE_TAC[REAL_ARITH `a <= b + a <=> &0 <= b`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + REWRITE_TAC[Trigonometry1.REAL_LE_POW_2]);; + + + +let triangle_area_lower_bound = prove(`!v w. v IN ball_annulus /\ w IN ball_annulus /\ dist (v,w) = &2 + ==> #1.48 * sqrt(&3) <= norm (v cross w)`, + REWRITE_TAC[in_ball_annulus; Sphere.h0; REAL_ARITH `&2 * #1.26 = #2.52`] THEN + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `~(v = vec 0:real^3) /\ ~(w = vec 0:real^3)` ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM NORM_EQ_0] THEN + ASM_SIMP_TAC[REAL_ARITH `&2 <= n ==> ~(n = &0)`]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[Trigonometry1.NORM_CROSS] THEN + REWRITE_TAC[Trigonometry2.UPS_X_AND_HERON] THEN + REWRITE_TAC[REAL_ARITH `a <= b / &2 <=> &2 * a <= b`] THEN + SUBGOAL_THEN `&2 * #1.48 * sqrt (&3) = sqrt(&6 * &2 * (&4 - #2.52) * (&4 - #2.52))` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[REAL_ARITH `&6 * &2 * (&4 - #2.52) * (&4 - #2.52) = &2 pow 2 * (#1.48) pow 2 * &3`] THEN + ASSUME_TAC (REAL_ARITH `&0 <= &2 pow 2 /\ &0 <= #1.48 pow 2 * &3 /\ &0 <= &3 /\ &0 <= #1.48 pow 2`) THEN + ASM_SIMP_TAC[SQRT_MUL] THEN + REWRITE_TAC[POW_2_SQRT_ABS] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC SQRT_MONO_LE THEN + CONJ_TAC THENL + [ + CONV_TAC REAL_RAT_REDUCE_CONV; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_MUL2 THEN + CONJ_TAC THENL [ REAL_ARITH_TAC; ALL_TAC ] THEN + CONJ_TAC THENL + [ + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + CONJ_TAC THENL [ REAL_ARITH_TAC; ALL_TAC ] THEN + + MATCH_MP_TAC REAL_LE_MUL2 THEN + CONJ_TAC THENL [ REAL_ARITH_TAC; ALL_TAC ] THEN + CONJ_TAC THENL + [ + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + CONJ_TAC THENL [ REAL_ARITH_TAC; ALL_TAC ] THEN + + MATCH_MP_TAC REAL_LE_MUL2 THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC);; + + + + +let DIST_LOWER_BOUND_lemma = prove(`!v1 v2 w. v1 IN ball_annulus /\ v2 IN ball_annulus /\ w IN ball_annulus /\ + w IN aff_ge {vec 0} {v1, v2} /\ + dist (v1, w) = &2 /\ + dist (v2, w) = &2 + ==> &1 <= dist (v1,v2)`, + REWRITE_TAC[in_ball_annulus] THEN + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `~(v1 = vec 0:real^3) /\ ~(v2 = vec 0:real^3) /\ ~(w = vec 0:real^3)` ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM NORM_EQ_0] THEN + ASM_SIMP_TAC[REAL_ARITH `&2 <= n ==> ~(n = &0)`]; + ALL_TAC + ] THEN + MP_TAC (SPEC_ALL in_aff_ge_dist_lower_bound) THEN + ASM_REWRITE_TAC[real_ge] THEN + MP_TAC (SPECL [`v1:real^3`; `w:real^3`] triangle_area_lower_bound) THEN + MP_TAC (SPECL [`v2:real^3`; `w:real^3`] triangle_area_lower_bound) THEN + ASM_REWRITE_TAC[in_ball_annulus] THEN + REPEAT DISCH_TAC THEN + + SUBGOAL_THEN `&1 <= sqrt (&3)` ASSUME_TAC THENL + [ + ONCE_REWRITE_TAC[GSYM SQRT_1] THEN + MATCH_MP_TAC SQRT_MONO_LE THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `#1.48 * sqrt(&3) / #1.26` THEN + CONJ_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `(#1.48 * sqrt (&3) + #1.48 * sqrt (&3)) / (&2 * h0)` THEN + CONJ_TAC THENL + [ + REWRITE_TAC[Sphere.h0] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `(norm (v1 cross w) + norm (v2 cross w)) / norm w` THEN + CONJ_TAC THENL + [ + SUBGOAL_THEN `&0 < &2 * h0 /\ &0 < norm (w:real^3)` ASSUME_TAC THENL + [ + ASM_SIMP_TAC[Sphere.h0; REAL_ARITH `&2 <= n ==> &0 < n`] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + ASM_SIMP_TAC[RAT_LEMMA4] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + REPEAT CONJ_TAC THENL + [ + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + MATCH_MP_TAC REAL_LE_ADD2 THEN + ASM_REWRITE_TAC[]; + REWRITE_TAC[NORM_POS_LE]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]);; + + + + + +let aff_ge_trans = prove(`!v1 v2 v3 v:real^N. v3 IN aff_ge {vec 0} {v1,v2} /\ + v IN aff_ge {vec 0} {v1,v3} /\ ~(v = vec 0) /\ ~(v1 = vec 0) /\ ~(v2 = vec 0) /\ ~(v3 = vec 0) + ==> v3 IN aff_ge {vec 0} {v,v2}`, + REPEAT STRIP_TAC THEN + REPEAT (FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl))) THEN + ASM_SIMP_TAC[aff_ge_0_2] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + ASM_CASES_TAC `t1' = &0` THENL + [ + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID] THEN + DISCH_TAC THEN + MAP_EVERY EXISTS_TAC [`inv (t2')`; `&0`] THEN + POP_ASSUM MP_TAC THEN + POP_ASSUM (fun th -> SIMP_TAC[th; REAL_LE_INV]) THEN + REWRITE_TAC[REAL_LE_REFL] THEN + DISCH_TAC THEN + REWRITE_TAC[VECTOR_ARITH `a % b % v = (a * b) % (v:real^N)`] THEN + SUBGOAL_THEN `inv t2' * t2' = &1` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC REAL_MUL_LINV THEN + DISCH_TAC THEN UNDISCH_TAC `v:real^N = t2' % v3` THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO]; + ALL_TAC + ] THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_TAC THEN + MAP_EVERY EXISTS_TAC [`t1 / (t1' + t2' * t1)`; `t2 * t1' / (t1' + t2' * t1)`] THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `&0 < t1' + t2' * t1` ASSUME_TAC THENL + [ + MATCH_MP_TAC (REAL_ARITH `&0 < a /\ &0 <= b ==> &0 < a + b`) THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < a <=> &0 <= a /\ ~(a = &0)`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPEAT CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_DIV THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE]; + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_DIV THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN + REWRITE_TAC[VECTOR_ARITH `t1 / a % (t1' % (v1:real^N) + t2' % (t1 % v1 + t2 % v2)) + (t2 * t1' / a) % v2 = (t1 * (t1' + t2' * t1) / a) % v1 + (t2 * (t1' + t2' * t1) / a) % v2`] THEN + SIMP_TAC[REAL_FIELD `&0 < a ==> b * a / a = b`]);; + + + +let rotation_dist_decrease = prove(`!v w u:real^N. norm u = norm v /\ &0 <= v dot w /\ ~(w = vec 0) /\ + u IN aff_ge {vec 0} {v,w} + ==> dist (u,w) <= dist (v,w)`, + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `v:real^N = vec 0` THENL + [ + UNDISCH_TAC `norm (u:real^N) = norm (v:real^N)` THEN + ASM_REWRITE_TAC[NORM_0; NORM_EQ_0] THEN + DISCH_TAC THEN ASM_REWRITE_TAC[REAL_LE_REFL]; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl)) THEN + ASM_SIMP_TAC[aff_ge_0_2] THEN + REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN + REWRITE_TAC[dist] THEN + ONCE_REWRITE_TAC[GSYM REAL_ABS_NORM] THEN + REWRITE_TAC[REAL_LE_SQUARE_ABS] THEN + REWRITE_TAC[NORM_POW_2] THEN + REWRITE_TAC[VECTOR_ARITH `(u:real^N - w) dot (u - w) = u dot u + w dot w - &2 * u dot w`] THEN + ASM_REWRITE_TAC[DOT_SQUARE_NORM] THEN + REWRITE_TAC[REAL_ARITH `a + b - &2*c <= a + b - &2*d <=> &0 <= c - d`] THEN + REWRITE_TAC[VECTOR_ARITH `(t1 % v + t2 % w:real^N) dot w - v dot w = t1 * (v dot w) + t2 * (w dot w) - v dot w`] THEN + REWRITE_TAC[REAL_ARITH `&0 <= a + c - b <=> b <= a + c`] THEN + SUBGOAL_THEN `norm (u:real^N) pow 2 = t1 * t1 * (v dot v:real^N) + t2 * t2 * (w dot w:real^N) + &2 * t1 * t2 * (v dot w)` MP_TAC THENL + [ + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[NORM_POW_2] THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[NORM_POW_2] THEN DISCH_TAC THEN + SUBGOAL_THEN `t1 <= &1` ASSUME_TAC THENL + [ + MP_TAC (REAL_ARITH `&0 <= t1 ==> t1 = abs (t1)`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th]) THEN + ONCE_REWRITE_TAC[REAL_ARITH `&1 = abs (&1)`] THEN + REWRITE_TAC[REAL_LE_SQUARE_ABS; REAL_POW_2] THEN + MATCH_MP_TAC REAL_LE_RCANCEL_IMP THEN + EXISTS_TAC `v:real^N dot v` THEN + CONJ_TAC THENL + [ + ASM_REWRITE_TAC[DOT_POS_LT]; + ALL_TAC + ] THEN + POP_ASSUM (fun th -> GEN_REWRITE_TAC (RAND_CONV o DEPTH_CONV) [th]) THEN + REWRITE_TAC[REAL_MUL_LID; REAL_MUL_ASSOC] THEN + REWRITE_TAC[REAL_ARITH `a <= a + c <=> &0 <= c`] THEN + MATCH_MP_TAC REAL_LE_ADD THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[DOT_POS_LE] THENL + [ + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[REAL_ARITH `&0 <= &2`]; + ALL_TAC + ] THEN + + ABBREV_TAC `x = t2 * (w:real^N dot w)` THEN + ABBREV_TAC `y = (v:real^N dot w)` THEN + SUBGOAL_THEN `&0 <= t1 * y + x` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LE_ADD THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + EXPAND_TAC "x" THEN MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[DOT_POS_LE]; + ALL_TAC + ] THEN + POP_ASSUM (MP_TAC o REWRITE_RULE[GSYM REAL_ABS_REFL]) THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[SYM th]) THEN + UNDISCH_TAC `&0 <= y` THEN + DISCH_TAC THEN FIRST_ASSUM MP_TAC THEN + REWRITE_TAC[GSYM REAL_ABS_REFL] THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[REAL_LE_SQUARE_ABS] THEN + SUBGOAL_THEN `(v dot v:real^N) * (w dot w:real^N) = t1 * t1 * (v dot v:real^N) * (w dot w:real^N) + x pow 2 + &2 * t1 * y * x` ASSUME_TAC THENL + [ + EXPAND_TAC "x" THEN + REWRITE_TAC[REAL_ARITH `t1 * t1 * v * w + (t2 * w) pow 2 + &2 * t1 * y * t2 * w = (t1 * t1 * v + t2 * (t2 * w) + &2 * t1 * t2 * y) * w`] THEN + REWRITE_TAC[REAL_EQ_MUL_RCANCEL] THEN + DISJ1_TAC THEN ASM_REWRITE_TAC[] THEN + REPLICATE_TAC 4 REMOVE_ASSUM THEN + POP_ASSUM ACCEPT_TAC; + ALL_TAC + ] THEN + SUBGOAL_THEN `(t1 * abs y + x) pow 2 = x pow 2 + &2 * t1 * y * x + t1 * t1 * (y pow 2)` (fun th -> REWRITE_TAC[th]) THENL + [ + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[REAL_ADD_ASSOC] THEN + SUBGOAL_THEN `x pow 2 + &2 * t1 * y * x = (v dot v) * (w dot w) - t1 pow 2 * (v dot v:real^N) * (w dot w:real^N)` (fun th -> REWRITE_TAC[th]) THENL + [ + POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[REAL_ARITH `a <= v * w - t pow 2 * v * w + t * t * a <=> &0 <= (&1 - t * t) * (v * w - a)`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + CONJ_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `&0 <= &1 - t1 * t1 <=> t1 * t1 <= &1 * &1`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + EXPAND_TAC "y" THEN + REWRITE_TAC[REAL_ARITH `&0 <= v * w - vw <=> vw <= v * w`] THEN + REWRITE_TAC[DOT_SQUARE_NORM; GSYM REAL_POW_MUL] THEN + REWRITE_TAC[Trigonometry2.SQUARE_NORM_CAUCHY_SCHWARZ_POW2]);; + + + + + + +let pos_vector_angle_bounds = prove(`!v u:real^N. v dot u > &0 ==> &0 <= vector_angle v u /\ vector_angle v u <= pi / &2`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + REWRITE_TAC[VECTOR_ANGLE_RANGE] THEN + REWRITE_TAC[vector_angle] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[REAL_LE_REFL] THEN + SUBGOAL_THEN `pi / &2 = acs (cos (pi / &2))` MP_TAC THENL + [ + MATCH_MP_TAC (GSYM ACS_COS) THEN + MP_TAC PI_POS THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th]) THEN + MATCH_MP_TAC ACS_MONO_LE THEN + REWRITE_TAC[COS_PI2; REAL_ARITH `-- &1 <= &0`] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_DIV THEN + ASM_SIMP_TAC[REAL_ARITH `a > &0 ==> &0 <= a`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + REWRITE_TAC[NORM_POS_LE]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[DE_MORGAN_THM] THEN + SIMP_TAC[Trigonometry1.NORM_CAUCHY_SCHWARZ_FRAC]);; + + + + + + +let rotation_lemma = prove(`!v (u:real^N). ~collinear {vec 0, v, u} /\ norm v = norm u + ==> ?f. f(lift (&0)) = v /\ f(lift (&1)) = u /\ + (!t. ?a b. f t = a % v + b % u) /\ + (!t. norm (f t) = norm v) /\ + (!t. t IN interval [lift (&0), lift (&1)] ==> f t IN aff_ge {vec 0} {v, u}) /\ + f continuous_on UNIV`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `~(v:real^N = vec 0) /\ ~(u:real^N = vec 0) /\ ~(v = u) /\ ~(u = --v)` ASSUME_TAC THENL + [ + UNDISCH_TAC `~collinear {vec 0:real^N,v,u}` THEN + SIMP_TAC[COLLINEAR_LEMMA_ALT; DE_MORGAN_THM] THEN + ASM_SIMP_TAC[GSYM NORM_EQ_0; NOT_EXISTS_THM] THEN + STRIP_TAC THEN + FIRST_ASSUM (MP_TAC o SPEC `&1`) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `-- &1`) THEN + SIMP_TAC[VECTOR_MUL_LID; VECTOR_MUL_LNEG]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `norm (u:real^N) > &0 /\ ~(norm u = &0)` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[real_gt; NORM_POS_LT; NORM_EQ_0]; + ALL_TAC + ] THEN + + ABBREV_TAC `phi = vector_angle (v:real^N) (u:real^N)` THEN + ABBREV_TAC `e:real^N = inv (sin phi) % u - cos phi % inv(sin phi) % v` THEN + + SUBGOAL_THEN `&0 < sin phi` ASSUME_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `&0 < a <=> &0 <= a /\ ~(a = &0)`] THEN + EXPAND_TAC "phi" THEN + REWRITE_TAC[SIN_VECTOR_ANGLE_POS] THEN + REWRITE_TAC[SIN_VECTOR_ANGLE_EQ_0] THEN + ASM_REWRITE_TAC[VECTOR_ANGLE_EQ_0; VECTOR_ANGLE_EQ_PI; DE_MORGAN_THM] THEN + REWRITE_TAC[VECTOR_ARITH `a % u + a % v = vec 0 <=> a % u = a % (--v:real^N)`] THEN + ASM_REWRITE_TAC[VECTOR_MUL_LCANCEL]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `(u dot u) * (v dot v) - (u:real^N dot v) pow 2 > &0` ASSUME_TAC THENL + [ + REWRITE_TAC[DOT_SQUARE_NORM] THEN + REWRITE_TAC[REAL_ARITH `a - b > &0 <=> b <= a /\ ~(b = a)`] THEN + REWRITE_TAC[GSYM REAL_POW_MUL] THEN + CONJ_TAC THENL + [ + REWRITE_TAC[Trigonometry2.SQUARE_NORM_CAUCHY_SCHWARZ_POW2]; + ALL_TAC + ] THEN + REWRITE_TAC[GSYM REAL_EQ_SQUARE_ABS] THEN + REWRITE_TAC[REAL_ABS_MUL; REAL_ABS_NORM] THEN + ASM_REWRITE_TAC[NORM_CAUCHY_SCHWARZ_ABS_EQ; DE_MORGAN_THM] THEN + REWRITE_TAC[VECTOR_ARITH `--a % v = a % (--v:real^N)`] THEN + ASM_REWRITE_TAC[VECTOR_MUL_LCANCEL; VECTOR_ARITH `v = --u <=> u = --v:real^N`]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `e:real^N dot v = &0` ASSUME_TAC THENL + [ + EXPAND_TAC "e" THEN + REWRITE_TAC[DOT_LSUB; DOT_LMUL] THEN + REWRITE_TAC[REAL_ARITH `a * b - c * a * d = a * (b - c * d)`] THEN + REWRITE_TAC[REAL_ENTIRE] THEN + DISJ2_TAC THEN + EXPAND_TAC "phi" THEN ASM_REWRITE_TAC[COS_VECTOR_ANGLE] THEN + ASM_REWRITE_TAC[DOT_SYM; DOT_SQUARE_NORM] THEN + UNDISCH_TAC `norm (u:real^N) > &0 /\ ~(norm u = &0)` THEN + CONV_TAC REAL_FIELD; + ALL_TAC + ] THEN + + ABBREV_TAC `d = norm (u:real^N) pow 4 - (u dot v) pow 2` THEN + SUBGOAL_THEN `&0 < d` ASSUME_TAC THENL + [ + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + ASM_REWRITE_TAC[DOT_SQUARE_NORM] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `inv (sin phi) pow 2 = norm (u:real^N) pow 4 / d /\ cos phi pow 2 = (u dot v) pow 2 / norm u pow 4` ASSUME_TAC THENL + [ + REWRITE_TAC[REAL_POW_INV] THEN + EXPAND_TAC "phi" THEN + ASM_REWRITE_TAC[SIN_SQUARED_VECTOR_ANGLE; COS_VECTOR_ANGLE; DOT_SYM] THEN + UNDISCH_TAC `norm (u:real^N) > &0 /\ ~(norm u = &0)` THEN + POP_ASSUM MP_TAC THEN EXPAND_TAC "d" THEN + CONV_TAC REAL_FIELD; + ALL_TAC + ] THEN + + SUBGOAL_THEN `e:real^N dot e = v:real^N dot v` ASSUME_TAC THENL + [ + EXPAND_TAC "e" THEN + REWRITE_TAC[VECTOR_ARITH `(a % u - b % a % v) dot (a % u - b % a % v) = (a pow 2) * ((u dot u) + (b pow 2) * v dot v - &2 * b * (u dot v:real^N))`] THEN + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "phi" THEN ASM_REWRITE_TAC[COS_VECTOR_ANGLE; DOT_SYM] THEN + ASM_REWRITE_TAC[DOT_SQUARE_NORM] THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + UNDISCH_TAC `norm (u:real^N) > &0 /\ ~(norm u = &0)` THEN + CONV_TAC REAL_FIELD; + ALL_TAC + ] THEN + + ABBREV_TAC `f = (\t:real^1. cos (phi * drop t) % (v:real^N) + sin (phi * drop t) % e)` THEN + EXISTS_TAC `f:real^1->real^N` THEN + REPEAT CONJ_TAC THENL + [ + (* f(0) = v *) + EXPAND_TAC "f" THEN BETA_TAC THEN + REWRITE_TAC[LIFT_DROP; REAL_MUL_RZERO] THEN + REWRITE_TAC[COS_0; SIN_0] THEN + VECTOR_ARITH_TAC; + + (* f(1) = u *) + EXPAND_TAC "f" THEN BETA_TAC THEN + REWRITE_TAC[LIFT_DROP; REAL_MUL_RID] THEN + EXPAND_TAC "e" THEN + REWRITE_TAC[VECTOR_ARITH `s % (is % u - c % is % v) = (s * is) % (u - c % v)`] THEN + ASM_SIMP_TAC[REAL_FIELD `&0 < s ==> s * inv (s) = &1`] THEN + VECTOR_ARITH_TAC; + + (* f(t) = a v + b u *) + GEN_TAC THEN + EXPAND_TAC "f" THEN EXPAND_TAC "e" THEN + EXISTS_TAC `cos (phi * drop (t:real^1)) - sin(phi * drop t) * cos phi * inv(sin phi)` THEN + EXISTS_TAC `sin (phi * drop (t:real^1)) * inv(sin phi)` THEN + VECTOR_ARITH_TAC; + + (* |f(t)| = |v| *) + GEN_TAC THEN + REWRITE_TAC[NORM_EQ] THEN + EXPAND_TAC "f" THEN BETA_TAC THEN + REWRITE_TAC[VECTOR_ARITH `(c % v + s % e:real^N) dot (c % v + s % e) = (c pow 2) * (v dot v) + (s pow 2) * (e dot e) + &2 * c * s * (e dot v)`] THEN + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[REAL_ARITH `c pow 2 * v + s pow 2 * v + &2 * c * s * &0 = (s pow 2 + c pow 2) * v`] THEN + REWRITE_TAC[SIN_CIRCLE] THEN + REAL_ARITH_TAC; + + (* f(t) IN aff_ge 0 {v, u} *) + GEN_TAC THEN REWRITE_TAC[IN_INTERVAL] THEN + DISCH_THEN (MP_TAC o SPEC `1`) THEN + REWRITE_TAC[LE_REFL; DIMINDEX_1] THEN + REWRITE_TAC[GSYM drop; LIFT_DROP] THEN + DISCH_TAC THEN + ASM_SIMP_TAC[aff_ge_0_2] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + EXPAND_TAC "f" THEN EXPAND_TAC "e" THEN + + MAP_EVERY EXISTS_TAC [`cos (phi * drop (t:real^1)) - sin (phi * drop t) * cos phi * inv(sin phi)`; `sin (phi * drop (t:real^1)) * inv(sin phi)`] THEN + SUBGOAL_THEN `&0 < phi /\ phi < pi` ASSUME_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `&0 < phi <=> ~(phi = &0) /\ &0 <= phi`; REAL_ARITH `phi < pi <=> phi <= pi /\ ~(phi = pi)`] THEN + EXPAND_TAC "phi" THEN REWRITE_TAC[VECTOR_ANGLE_RANGE] THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THEN DISCH_TAC THEN UNDISCH_TAC `&0 < sin phi` THEN ASM_REWRITE_TAC[SIN_0; SIN_PI; REAL_LT_REFL]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + REWRITE_TAC[GSYM real_div; REAL_ARITH `&0 <= a - b * c * d <=> (b * c) * d <= a / &1`] THEN + MP_TAC (GEN_ALL RAT_LEMMA4) THEN + DISCH_THEN (MP_TAC o SPECL [`sin (phi * drop (t:real^1)) * cos phi`; `&1`; `cos (phi * drop (t:real^1))`; `sin phi`]) THEN + ASM_REWRITE_TAC[REAL_LT_01] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[REAL_ARITH `(s1 * c) * &1 <= c1 * s <=> &0 <= s * c1 - c * s1`] THEN + REWRITE_TAC[GSYM SIN_SUB] THEN + MATCH_MP_TAC SIN_POS_PI_LE THEN + REWRITE_TAC[REAL_ARITH `phi - phi * t = phi * (&1 - t)`] THEN + CONJ_TAC THENL [ MATCH_MP_TAC REAL_LE_MUL THEN ASM_SIMP_TAC[REAL_LT_IMP_LE; REAL_ARITH `t <= &1 ==> &0 <= &1 - t`]; ALL_TAC ] THEN + ONCE_REWRITE_TAC[REAL_ARITH `pi = pi * &1`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_MUL THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC SIN_POS_PI_LE THEN + CONJ_TAC THENL [ MATCH_MP_TAC REAL_LE_MUL THEN ASM_SIMP_TAC[REAL_LT_IMP_LE]; ALL_TAC ] THEN + ONCE_REWRITE_TAC[REAL_ARITH `pi = pi * &1`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_INV THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE]; + ALL_TAC + ] THEN + VECTOR_ARITH_TAC; + + (* f is continuous *) + EXPAND_TAC "f" THEN + MATCH_MP_TAC CONTINUOUS_ON_ADD THEN + CONJ_TAC THEN MATCH_MP_TAC CONTINUOUS_ON_VMUL THENL + [ + MATCH_MP_TAC CONTINUOUS_AT_IMP_CONTINUOUS_ON THEN + REPEAT STRIP_TAC THEN + REWRITE_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS1] THEN + SUBGOAL_THEN `(\t:real^1. cos (phi * drop t)) = cos o (\t. phi * drop t)` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[FUN_EQ_THM; o_THM]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_CONTINUOUS_AT_COMPOSE THEN + REWRITE_TAC[REAL_CONTINUOUS_WITHIN_COS] THEN + REWRITE_TAC[drop] THEN + MATCH_MP_TAC REAL_CONTINUOUS_LMUL THEN + MATCH_MP_TAC REAL_CONTINUOUS_AT_COMPONENT THEN + REWRITE_TAC[DIMINDEX_1] THEN ARITH_TAC; + + MATCH_MP_TAC CONTINUOUS_AT_IMP_CONTINUOUS_ON THEN + REPEAT STRIP_TAC THEN + REWRITE_TAC[GSYM REAL_CONTINUOUS_CONTINUOUS1] THEN + SUBGOAL_THEN `(\t:real^1. sin (phi * drop t)) = sin o (\t. phi * drop t)` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[FUN_EQ_THM; o_THM]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_CONTINUOUS_AT_COMPOSE THEN + REWRITE_TAC[REAL_CONTINUOUS_WITHIN_SIN] THEN + REWRITE_TAC[drop] THEN + MATCH_MP_TAC REAL_CONTINUOUS_LMUL THEN + MATCH_MP_TAC REAL_CONTINUOUS_AT_COMPONENT THEN + REWRITE_TAC[DIMINDEX_1] THEN ARITH_TAC + ] + ]);; + + + + + + + +let dot_pos_lemma = prove(`!v w. v IN ball_annulus /\ w IN ball_annulus /\ dist (v,w) <= &2 * h0 ==> v dot w > &0`, + REWRITE_TAC[in_ball_annulus] THEN + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[dist] THEN DISCH_TAC THEN + SUBGOAL_THEN `(v - w) dot (v:real^3 - w) <= (&2 * h0) * (&2 * h0)` MP_TAC THENL + [ + REWRITE_TAC[DOT_SQUARE_NORM; REAL_POW_2] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[NORM_POS_LE]; + ALL_TAC + ] THEN + ASM_CASES_TAC `v:real^3 dot w > &0` THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[REAL_NOT_LE] THEN + REWRITE_TAC[VECTOR_ARITH `(v - w:real^3) dot (v - w) = v dot v + w dot w - &2 * (v dot w)`] THEN + MATCH_MP_TAC REAL_LTE_TRANS THEN + EXISTS_TAC `(v dot v:real^3) + (w dot w:real^3)` THEN + CONJ_TAC THENL + [ + REWRITE_TAC[Pack_defs.h0; DOT_SQUARE_NORM] THEN + SUBGOAL_THEN `&2 * &2 <= norm (v:real^3) pow 2 /\ &2 * &2 <= norm (w:real^3) pow 2` MP_TAC THENL + [ + REWRITE_TAC[REAL_POW_2] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_MUL2 THEN ASM_REWRITE_TAC[REAL_ARITH `&0 <= &2`]; + ALL_TAC + ] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[REAL_ARITH `v + w <= v + w - &2 * vw <=> vw <= &0`] THEN + POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC);; + + + +let dist_decreasing_ivt_lemma = prove(`!f (v:real^N) t1 d. &0 <= t1 /\ + f continuous_on UNIV /\ + dist (f(lift t1), v) <= d /\ + d <= dist (f(lift (&0)), v) + ==> ?t. t IN interval [lift (&0), lift t1] /\ dist (f t, v) = d`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`(lift o (\x. dist (x,v:real^N))) o (f:real^1->real^N)`; `lift (&0)`; `lift t1`; `d:real`; `1`] IVT_DECREASING_COMPONENT_1) THEN + ASM_REWRITE_TAC[LIFT_DROP; LE_REFL; DIMINDEX_1] THEN + ANTS_TAC THENL + [ + REPEAT CONJ_TAC THENL + [ + REPEAT STRIP_TAC THEN + MATCH_MP_TAC CONTINUOUS_AT_COMPOSE THEN + UNDISCH_TAC `(f:real^1->real^N) continuous_on UNIV` THEN + REWRITE_TAC[CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN; WITHIN_UNIV; IN_UNIV] THEN + DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `lift o (\x. dist (x,v:real^N)) = (lift o norm) o (\x. x - v)` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[FUN_EQ_THM; o_THM; dist]; + ALL_TAC + ] THEN + MATCH_MP_TAC CONTINUOUS_AT_COMPOSE THEN + REWRITE_TAC[CONTINUOUS_AT_LIFT_NORM] THEN + MATCH_MP_TAC CONTINUOUS_SUB THEN + REWRITE_TAC[CONTINUOUS_AT_ID; CONTINUOUS_CONST]; + ASM_REWRITE_TAC[o_THM; GSYM drop; LIFT_DROP]; + ASM_REWRITE_TAC[o_THM; GSYM drop; LIFT_DROP] + ]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + EXISTS_TAC `x:real^1` THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[o_THM; GSYM drop; LIFT_DROP]);; + + + + +let lemma_3_points = prove(`!v1 v2 v3. v3 IN aff_ge {vec 0} {v1,v2} /\ + v1 IN ball_annulus /\ v2 IN ball_annulus /\ v3 IN ball_annulus /\ + dist (v1,v2) <= &2 * h0 /\ &2 <= dist (v1,v3) /\ &2 <= dist (v2,v3) + ==> ?v. v IN ball_annulus /\ + v3 IN aff_ge {vec 0} {v,v2} /\ + dist (v,v2) <= &2 * h0 /\ dist (v,v3) = &2`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`v1:real^3`; `v2:real^3`] dot_pos_lemma) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + REPLICATE_TAC 3 (FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl))) THEN + REWRITE_TAC[IMP_IMP] THEN DISCH_TAC THEN FIRST_ASSUM MP_TAC THEN + REWRITE_TAC[in_ball_annulus] THEN + DISCH_TAC THEN + + MP_TAC (SPECL [`v1:real^3`; `v2:real^3`; `v3:real^3`] in_aff_ge_0_2) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + POP_ASSUM (LABEL_TAC "A" o SYM) THEN + + ABBREV_TAC `u:real^3 = (norm (v1:real^3) / norm (v3:real^3)) % v3` THEN + + MP_TAC (ISPECL [`v1:real^3`; `u:real^3`] rotation_lemma) THEN + SUBGOAL_THEN `~collinear {vec 0, v1, v3:real^3}` ASSUME_TAC THENL + [ + MATCH_MP_TAC non_collinear_lemma THEN + ASM_REWRITE_TAC[] THEN + REMOVE_THEN "A" (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[DOT_RADD; DOT_RMUL] THEN + MATCH_MP_TAC REAL_LT_ADD THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[] THENL + [ + ASM_REWRITE_TAC[DOT_POS_LT]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[GSYM real_gt]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `dist (u,v3:real^3) < &2` ASSUME_TAC THENL + [ + REWRITE_TAC[dist] THEN + EXPAND_TAC "u" THEN + REWRITE_TAC[VECTOR_ARITH `a % v3 - v3 = (a - &1) % v3:real^3`] THEN + REWRITE_TAC[NORM_MUL] THEN + SUBGOAL_THEN `norm (v3:real^3) = abs (norm v3)` MP_TAC THENL + [ + ASM_SIMP_TAC[REAL_ARITH `&2 <= n3 ==> n3 = abs(n3)`]; + ALL_TAC + ] THEN + DISCH_TAC THEN + FIRST_ASSUM (fun th -> ONCE_REWRITE_TAC[th]) THEN + REWRITE_TAC[GSYM REAL_ABS_MUL] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[REAL_FIELD `&2 <= n3 ==> (n1 / n3 - &1) * n3 = (n1 - n3)`] THEN + REPEAT (FIRST_X_ASSUM (MP_TAC o check (is_conj o concl))) THEN + REWRITE_TAC[Pack_defs.h0] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + ANTS_TAC THENL + [ + CONJ_TAC THENL + [ + UNDISCH_TAC `~collinear {vec 0:real^3,v1,v3}` THEN + MP_TAC (ISPECL [`&1`; `norm (v1:real^3) / norm (v3:real^3)`; `v1:real^3`; `v3:real^3`] COLLINEAR_SCALE_ALL) THEN + ANTS_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `~(&1 = &0)`] THEN + MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`) THEN + MATCH_MP_TAC REAL_LT_DIV THEN + ASM_SIMP_TAC[REAL_ARITH `&2 <= n ==> &0 < n`]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[VECTOR_MUL_LID]; + ALL_TAC + ] THEN + + EXPAND_TAC "u" THEN + REWRITE_TAC[NORM_MUL] THEN + SUBGOAL_THEN `abs (norm (v1:real^3) / norm (v3:real^3)) = norm v1 / norm v3` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[REAL_ABS_REFL] THEN + MATCH_MP_TAC REAL_LE_DIV THEN + REWRITE_TAC[NORM_POS_LE]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[REAL_FIELD `&2 <= n3 ==> n1 / n3 * n3 = n1`]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + MP_TAC (ISPECL [`f:real^1->real^3`; `v3:real^3`; `&1`; `&2`] dist_decreasing_ivt_lemma) THEN + ASM_SIMP_TAC[REAL_ARITH `dist (u:real^3,v3) < &2 ==> dist(u,v3) <= &2`; REAL_LE_01] THEN + STRIP_TAC THEN + EXISTS_TAC `(f:real^1->real^3) t` THEN + ASM_REWRITE_TAC[] THEN + + SUBGOAL_THEN `aff_ge {vec 0} {v1:real^3,v3} = aff_ge {vec 0} {v1,u}` ASSUME_TAC THENL + [ + MATCH_MP_TAC aff_ge_eq_lemma THEN + EXISTS_TAC `norm (v1:real^3) / norm (v3:real^3)` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LT_DIV THEN + ASM_SIMP_TAC[REAL_ARITH `&2 <= n ==> &0 < n`]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + ASM_REWRITE_TAC[GSYM NORM_EQ_0] THEN + ASM_REWRITE_TAC[NORM_EQ_0]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + MATCH_MP_TAC aff_ge_trans THEN + EXISTS_TAC `v1:real^3` THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `t:real^1`) THEN + ASM_REWRITE_TAC[] THEN + SIMP_TAC[] THEN + DISCH_TAC THEN + ASM_REWRITE_TAC[GSYM NORM_EQ_0] THEN + ASM_REWRITE_TAC[NORM_EQ_0]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `dist (v1,v2:real^3)` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC rotation_dist_decrease THEN + ASM_SIMP_TAC[REAL_ARITH `a > &0 ==> &0 <= a`] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `t:real^1`) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[aff_ge_0_2] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + REMOVE_THEN "A" (fun th -> REWRITE_TAC[SYM th]) THEN + STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`t1' + t2' * t1:real`; `t2' * t2:real`] THEN + REPEAT CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_ADD THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE]; + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN + VECTOR_ARITH_TAC);; + + + + + +let LEMMA_3_POINTS = prove(`!v1 v2 v3. v3 IN aff_ge {vec 0} {v1,v2} /\ + v1 IN ball_annulus /\ v2 IN ball_annulus /\ v3 IN ball_annulus /\ + dist (v1,v2) <= &2 * h0 /\ + &2 <= dist (v1,v3) /\ + &2 <= dist (v2,v3) + ==> (?v1' v2'. v3 IN aff_ge {vec 0} {v1',v2'} /\ + v1' IN ball_annulus /\ v2' IN ball_annulus /\ v3 IN ball_annulus /\ + dist (v1',v2') <= &2 * h0 /\ + dist (v1',v3) = &2 /\ + dist (v2',v3) = &2)`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL lemma_3_points) THEN + ASM_REWRITE_TAC[real_ge] THEN + DISCH_THEN (X_CHOOSE_THEN `v1':real^3` MP_TAC) THEN + STRIP_TAC THEN + + MP_TAC (SPECL [`v2:real^3`; `v1':real^3`; `v3:real^3`] lemma_3_points) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + ASM_REWRITE_TAC[SET_RULE `{v2,v1'} = {v1',v2}`]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[DIST_SYM; real_ge; REAL_LE_REFL]; + ALL_TAC + ] THEN + + DISCH_THEN (X_CHOOSE_THEN `v2':real^3` MP_TAC) THEN + STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`v1':real^3`; `v2':real^3`] THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + ASSUME_TAC (SET_RULE `{v1':real^3,v2'} = {v2',v1'}`) THEN + POP_ASSUM (fun th -> ONCE_REWRITE_TAC [th]) THEN + ASM_REWRITE_TAC[]; + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[DIST_SYM] + ]);; + + + +let LEMMA_3_POINTS_FINAL = prove(`!v1 v2 v3. + v3 IN aff_ge {vec 0} {v1,v2} /\ + v1 IN ball_annulus /\ v2 IN ball_annulus /\ v3 IN ball_annulus /\ + dist (v1,v2) <= &2 * h0 /\ + &2 <= dist (v1,v3) /\ + &2 <= dist (v2,v3) + ==> F`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o MATCH_MP LEMMA_3_POINTS) THEN + REPEAT STRIP_TAC THEN + REPLICATE_TAC 3 (FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl))) THEN + REWRITE_TAC[in_ball_annulus] THEN + REPEAT STRIP_TAC THEN + + MP_TAC (SPECL [`vec 0:real^3`; `v1':real^3`; `v2':real^3`; `v3:real^3`] Collect_geom.POLFLZY) THEN + REWRITE_TAC[Tame_inequalities.DELTA_EQ_DELTA_X] THEN + + CONV_TAC (DEPTH_CONV let_CONV) THEN + SUBGOAL_THEN `coplanar_alt {vec 0, v1':real^3, v2', v3}` (fun th -> REWRITE_TAC[th]) THENL + [ + MP_TAC (ISPEC `{vec 0,v1',v2',v3:real^3}` coplanar_eq_coplanar_alt) THEN + REWRITE_TAC[DIMINDEX_3] THEN ANTS_TAC THENL [ ARITH_TAC; ALL_TAC ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[coplanar] THEN + + MAP_EVERY EXISTS_TAC [`vec 0:real^3`; `v1':real^3`; `v2':real^3`] THEN + REWRITE_TAC[AFFINE_HULL_3; VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + REWRITE_TAC[SUBSET; IN_INSERT; NOT_IN_EMPTY; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THENL + [ + MAP_EVERY EXISTS_TAC [`&1`; `&0`; `&0`] THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID] THEN + REAL_ARITH_TAC; + MAP_EVERY EXISTS_TAC [`&0`; `&1`; `&0`] THEN + ASM_REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO; VECTOR_ADD_RID] THEN + REAL_ARITH_TAC; + MAP_EVERY EXISTS_TAC [`&0`; `&0`; `&1`] THEN + ASM_REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_LZERO; VECTOR_ADD_LID] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + SUBGOAL_THEN `~(v1':real^3 = vec 0) /\ ~(v2':real^3 = vec 0)` ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM NORM_EQ_0] THEN + ASM_SIMP_TAC[REAL_ARITH `&2 <= norm n ==> ~(norm n = &0)`]; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl)) THEN + ASM_SIMP_TAC[aff_ge_0_2] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`&1 - t1 - t2`; `t1:real`; `t2:real`] THEN + ASM_REWRITE_TAC[] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC (REAL_ARITH `a >= #13.0 ==> ~(a = &0)`) THEN + ASM_REWRITE_TAC[REAL_ARITH `&2 pow 2 = #4.0`] THEN + MATCH_MP_TAC (REWRITE_RULE [Tame_inequalities.INEQ_ALT; ALL] Tame_inequalities.delta_x_3_points) THEN + REWRITE_TAC[DIST_0] THEN + + SUBGOAL_THEN `!a. &2 <= a ==> #4.0 <= a pow 2` (fun th -> ASM_SIMP_TAC[th]) THENL + [ + REPEAT STRIP_TAC THEN REWRITE_TAC[REAL_ARITH `#4.0 = &2 * &2`; REAL_POW_2] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!a. &2 <= a /\ a <= &2 * h0 ==> a pow 2 <= #6.3504` (fun th -> ASM_SIMP_TAC[th]) THENL + [ + REWRITE_TAC[Pack_defs.h0; REAL_ARITH `&2 * #1.26 = #2.52`] THEN + REPEAT STRIP_TAC THEN REWRITE_TAC[REAL_ARITH `#6.3504 = #2.52 * #2.52`; REAL_POW_2] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_SIMP_TAC[REAL_ARITH `&2 <= a ==> &0 <= a`]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`v1':real^3`; `v2':real^3`; `v3:real^3`] DIST_LOWER_BOUND_lemma) THEN + ASM_REWRITE_TAC[in_ball_annulus] THEN + DISCH_TAC THEN + SUBGOAL_THEN `!a. &1 <= a /\ a <= &2 * h0 ==> #0.64 <= a pow 2 /\ a pow 2 <= #6.3504` (fun th -> ASM_SIMP_TAC[th]) THEN + REWRITE_TAC[Pack_defs.h0; REAL_ARITH `&2 * #1.26 = #2.52`] THEN + REPEAT STRIP_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `#0.64 = #0.8 * #0.8`; REAL_POW_2] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[REAL_ARITH `#6.3504 = #2.52 * #2.52`; REAL_POW_2] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_SIMP_TAC[REAL_ARITH `&1 <= a ==> &0 <= a`]);; + + + + + +end;; diff --git a/text_formalization/tame/CKQOWSA_4.hl b/text_formalization/tame/CKQOWSA_4.hl new file mode 100644 index 0000000..f585c89 --- /dev/null +++ b/text_formalization/tame/CKQOWSA_4.hl @@ -0,0 +1,4272 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Tame Hypermap *) +(* Author: Alexey Solovyev *) +(* Date: 2010-07-07 *) +(* (V,ESTD V) is a fan (4-point case) *) +(* ========================================================================== *) + +flyspeck_needs "tame/CKQOWSA_3.hl";; + + +module Ckqowsa_4_points = struct + + +open Ckqowsa_3_points;; + + + +(* General *) + +let IN_INTERVAL_1 = prove(`!a b c. lift c IN interval [lift a, lift b] <=> a <= c /\ c <= b`, + REPEAT STRIP_TAC THEN + SIMP_TAC[IN_INTERVAL; DIMINDEX_1; ARITH_RULE `1 <= i /\ i <= 1 <=> i = 1`] THEN + REWRITE_TAC[GSYM drop; LIFT_DROP] THEN + EQ_TAC THEN SIMP_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `1`) THEN + SIMP_TAC[]);; + + +let DIST_SQR = prove(`!v (w:real^N) d. dist(v,w) = d <=> dist(v,w) pow 2 = d pow 2 /\ &0 <= d`, + REPEAT STRIP_TAC THEN EQ_TAC THEN STRIP_TAC THENL + [ + FIRST_X_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[DIST_POS_LE]; + ASSUME_TAC (REAL_ARITH `!d. &0 <= d ==> d = abs(d)`) THEN + FIRST_ASSUM (MP_TAC o SPEC `d:real`) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `dist(v:real^N,w)`) THEN + ASM_REWRITE_TAC[DIST_POS_LE] THEN + REPLICATE_TAC 2 (DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th])) THEN + ASM_REWRITE_TAC[REAL_EQ_SQUARE_ABS] + ]);; + + +let estd_non_collinear_lemma = prove(`!v w. v IN ball_annulus /\ w IN ball_annulus /\ + &2 <= dist (v,w) /\ dist (v,w) <= &2 * h0 + ==> ~collinear {vec 0, v, w}`, + REWRITE_TAC[in_ball_annulus] THEN + REWRITE_TAC[COLLINEAR_BETWEEN_CASES; between; DIST_0; DIST_SYM] THEN + REWRITE_TAC[Sphere.h0] THEN + REAL_ARITH_TAC);; + + + +let zero_not_between = prove(`!v w:real^N. ~between (vec 0) (v, w) ==> ~(v = vec 0) /\ ~(w = vec 0) /\ + (!a b. a < &0 /\ &0 < b ==> ~(a % w = b % v))`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + SUBGOAL_THEN `~(v = vec 0:real^N) /\ ~(w = vec 0:real^N)` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REWRITE_TAC[GSYM NORM_EQ_0] THEN + REWRITE_TAC[between; DIST_0] THEN + ASM_CASES_TAC `norm (v:real^N) = &0` THEN ASM_REWRITE_TAC[] THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[NORM_EQ_0] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[DIST_0; REAL_ADD_LID]; + ALL_TAC + ] THEN + ASM_CASES_TAC `norm (w:real^N) = &0` THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[NORM_EQ_0] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[DIST_0; REAL_ADD_RID]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + + REPEAT STRIP_TAC THEN + UNDISCH_TAC `~between (vec 0:real^N) (v,w)` THEN + REWRITE_TAC[between; DIST_0] THEN + POP_ASSUM (MP_TAC o AP_TERM `\v:real^N. inv(a) % v`) THEN + REWRITE_TAC[VECTOR_MUL_ASSOC] THEN + ASM_SIMP_TAC[REAL_ARITH `a < &0 ==> ~(a = &0)`; REAL_MUL_LINV; VECTOR_MUL_LID] THEN + DISCH_TAC THEN + REWRITE_TAC[dist; VECTOR_ARITH `v - a % v = (&1 - a) % v:real^N`] THEN + REWRITE_TAC[NORM_MUL] THEN + + SUBGOAL_THEN `&0 <= --(inv a * b)` ASSUME_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `&0 <= --(a * b) <=> &0 <= --a * b`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE] THEN + REWRITE_TAC[GSYM REAL_INV_NEG] THEN + MATCH_MP_TAC REAL_LE_INV THEN + ASM_SIMP_TAC[REAL_ARITH `a < &0 ==> &0 <= --a`]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `abs (&1 - inv a * b) = &1 - inv a * b` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[REAL_ABS_REFL] THEN + REWRITE_TAC[REAL_ARITH `&1 - a = &1 + (--a)`] THEN + MATCH_MP_TAC REAL_LE_ADD THEN + ASM_REWRITE_TAC[REAL_LE_01]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `abs (inv a * b) = --(inv a * b)` (fun th -> REWRITE_TAC[th]) THENL + [ + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + + REAL_ARITH_TAC);; + + +let zero_not_between_estd = prove(`!v w. v IN ball_annulus /\ w IN ball_annulus /\ dist (v,w) <= &2 * h0 + ==> ~between (vec 0) (v,w)`, + REWRITE_TAC[in_ball_annulus; between; DIST_0; Sphere.h0] THEN + REAL_ARITH_TAC);; + + + +(******************************************************************) + +(* Some properties of projections *) + +let projection = Sphere.projection;; + + +let PROJECTION_ORTHOGONAL = prove(`!d v:real^N. projection d v dot d = &0`, + REWRITE_TAC[DOT_SYM; projection; VECTOR_SUB_PROJECT_ORTHOGONAL]);; + + +let VECTOR_PROJECTION = prove(`!d v:real^N. v = projection d v + (v dot d) / (d dot d) % d`, + REWRITE_TAC[projection] THEN VECTOR_ARITH_TAC);; + + + +let PROJECTION_0 = prove(`!d:real^N. projection d (vec 0) = vec 0`, + REWRITE_TAC[projection; DOT_LZERO; real_div; REAL_MUL_LZERO] THEN + VECTOR_ARITH_TAC);; + + +let PROJECTION_ZERO = prove(`!d:real^N. ~(d = vec 0) ==> projection d d = vec 0`, + REWRITE_TAC[GSYM NORM_EQ_0] THEN GEN_TAC THEN DISCH_TAC THEN + REWRITE_TAC[NORM_EQ_0; projection; DOT_SQUARE_NORM] THEN + SUBGOAL_THEN `norm d pow 2 / norm (d:real^N) pow 2 = &1` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[real_div; REAL_POW_2; REAL_INV_MUL] THEN + REWRITE_TAC[REAL_ARITH `(d * d) * id * id = d * (d * id) * id`] THEN + ASM_SIMP_TAC[REAL_MUL_RINV; REAL_MUL_LID]; + ALL_TAC + ] THEN + VECTOR_ARITH_TAC);; + + +let PROJECTION_LINEAR = prove(`!(d:real^N) v w a. projection d (v + w) = projection d v + projection d w /\ + projection d (a % v) = a % projection d v`, + REPEAT GEN_TAC THEN + REWRITE_TAC[projection; DOT_LMUL; DOT_LADD; real_div; REAL_ADD_RDISTRIB; VECTOR_SUB_LDISTRIB; VECTOR_MUL_ASSOC; REAL_MUL_ASSOC] THEN + REWRITE_TAC[VECTOR_ADD_RDISTRIB] THEN + VECTOR_ARITH_TAC);; + + +let PROJECTION_NEG = prove(`!(d:real^N) v. projection d (--v) = --projection d v`, + REWRITE_TAC[VECTOR_ARITH `--v:real^N = -- &1 % v`; PROJECTION_LINEAR]);; + + +let PROJECTION_SUB = prove(`!(d:real^N) v w. projection d (v - w) = projection d v - projection d w`, + REWRITE_TAC[VECTOR_ARITH `a - b:real^N = a + (--b)`; PROJECTION_LINEAR; PROJECTION_NEG]);; + + + +let PROJECTION_DIST2 = prove(`!d v w:real^N. ~(d = vec 0) ==> + dist (projection d v, projection d w) pow 2 = dist (v,w) pow 2 - ((v - w) dot d) pow 2 / (norm d pow 2)`, + REWRITE_TAC[GSYM NORM_EQ_0] THEN REPEAT STRIP_TAC THEN + REWRITE_TAC[dist; projection] THEN + REWRITE_TAC[VECTOR_ARITH `v - a % d - (w - b % d) = (v - w) - (a - b) % d:real^N`] THEN + + ABBREV_TAC `x = v - w:real^N` THEN + ABBREV_TAC `y = ((v dot d) / (d dot d) - (w dot d) / (d dot d)) % d:real^N` THEN + + SUBGOAL_THEN `!a. a / (d dot d) * (d dot d:real^N) = a` ASSUME_TAC THENL + [ + REWRITE_TAC[real_div; DOT_SQUARE_NORM; REAL_POW_2; REAL_INV_MUL] THEN + REWRITE_TAC[REAL_ARITH `(a * id * id) * d * d = a * (id * (id * d) * d)`] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_MUL_LID; REAL_MUL_RID]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `x:real^N dot y = y dot y` ASSUME_TAC THENL + [ + EXPAND_TAC "y" THEN + REWRITE_TAC[real_div] THEN + REWRITE_TAC[GSYM REAL_SUB_RDISTRIB; GSYM DOT_LSUB] THEN + EXPAND_TAC "x" THEN + REWRITE_TAC[DOT_LMUL; DOT_RMUL; DOT_SYM] THEN + REWRITE_TAC[REAL_ARITH `(dv * id) * (dv * id) * d = ((dv * dv * id) * id) * d`] THEN + ASM_REWRITE_TAC[GSYM real_div] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[NORM_POW_2; DOT_LSUB; DOT_RSUB; DOT_SYM] THEN + REWRITE_TAC[REAL_ARITH `x - y - (y - y) = x - z <=> y = z`] THEN + EXPAND_TAC "y" THEN + REWRITE_TAC[real_div] THEN + ASM_REWRITE_TAC[GSYM REAL_SUB_RDISTRIB; GSYM DOT_LSUB] THEN + REWRITE_TAC[DOT_LMUL; DOT_RMUL] THEN + ASM_REWRITE_TAC[GSYM real_div; DOT_SYM] THEN + REAL_ARITH_TAC);; + + + +let PROJECTION_SUM_DIST = prove(`!(d:real^N) x y a b. x dot d = &0 /\ y dot d = &0 + ==> dist (x + a % d, y + b % d) pow 2 = dist (x, y) pow 2 + (a - b) pow 2 * (d dot d)`, + REPEAT STRIP_TAC THEN + GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [dist] THEN + REWRITE_TAC[VECTOR_ARITH `(x + a % d) - (y + b % d) = (x - y) + (a - b) % d:real^N`] THEN + SUBGOAL_THEN `(x - y:real^N) dot ((a - b) % d) = &0` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[DOT_RMUL; DOT_LSUB; REAL_MUL_RZERO; REAL_SUB_RZERO]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[Trigonometry2.PITHAGO_THEOREM] THEN + REWRITE_TAC[GSYM dist] THEN + REWRITE_TAC[NORM_MUL; REAL_POW_MUL; REAL_POW2_ABS; DOT_SQUARE_NORM]);; + + + +let PROJECTION_DIST_SPECIAL_EQ = prove(`!d x v w:real^N. ~(d = vec 0) /\ x dot d = &0 + ==> dist (x + (v - projection d v), w) pow 2 = dist (x, projection d w) pow 2 - dist (projection d v, projection d w) pow 2 + dist (v, w) pow 2`, + REWRITE_TAC[GSYM NORM_EQ_0] THEN + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `!a. a / (d dot d) * (d dot d:real^N) = a` ASSUME_TAC THENL + [ + REWRITE_TAC[real_div; DOT_SQUARE_NORM; REAL_POW_2; REAL_INV_MUL] THEN + REWRITE_TAC[REAL_ARITH `(a * id * id) * d * d = a * (id * (id * d) * d)`] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; REAL_MUL_LID; REAL_MUL_RID]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `dist (x + v - projection d v, w) pow 2 = dist (x, projection d w) pow 2 + ((v - w) dot d:real^N) pow 2 / norm d pow 2` (fun th -> REWRITE_TAC[th]) THENL + [ + MP_TAC (SPECL [`d:real^N`; `w:real^N`] VECTOR_PROJECTION) THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [th]) THEN + SUBGOAL_THEN `v - projection d (v:real^N) = (v dot d) / (d dot d) % d` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[projection] THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + ASM_SIMP_TAC[PROJECTION_ORTHOGONAL; PROJECTION_SUM_DIST] THEN + REWRITE_TAC[real_div] THEN + REWRITE_TAC[GSYM REAL_SUB_RDISTRIB; GSYM DOT_LSUB] THEN + REWRITE_TAC[REAL_ARITH `(a * b) pow 2 * c = ((a pow 2 * b) * b) * c`] THEN + ASM_REWRITE_TAC[GSYM real_div; NORM_POW_2]; + ALL_TAC + ] THEN + MP_TAC (SPECL [`d:real^N`; `v:real^N`; `w:real^N`] PROJECTION_DIST2) THEN + ASM_REWRITE_TAC[GSYM NORM_EQ_0] THEN + REAL_ARITH_TAC);; + + + +let PROJECTION_DIST_SPECIAL_LE = prove(`!d x v w:real^N. ~(d = vec 0) /\ x dot d = &0 /\ dist (x, projection d w) <= dist (projection d v, projection d w) + ==> dist (x + v - projection d v, w) <= dist (v, w)`, + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[dist] THEN ONCE_REWRITE_TAC[GSYM REAL_ABS_NORM] THEN + REWRITE_TAC[REAL_LE_SQUARE_ABS] THEN + REWRITE_TAC[GSYM dist] THEN + ASM_SIMP_TAC[PROJECTION_DIST_SPECIAL_EQ] THEN + REAL_ARITH_TAC);; + + + +(***********************************************) + + +(* General properties of affine hull and aff_ge *) + +let aff_ge_0_2_eq_segment = prove(`!v:real^N. aff_ge {vec 0} {vec 0,v} = segment [vec 0,v] /\ aff_ge {vec 0} {v,vec 0} = segment [vec 0,v]`, + GEN_TAC THEN + REWRITE_TAC[SET_RULE `{v:real^N, vec 0} = {vec 0,v}`] THEN + ONCE_REWRITE_TAC[AFF_GE_DISJOINT_DIFF] THEN + REWRITE_TAC[SET_RULE `{vec 0} DIFF {vec 0,v:real^N} = {}`] THEN + REWRITE_TAC[GSYM CONVEX_HULL_AFF_GE; SEGMENT_CONVEX_HULL]);; + + +let in_segment_imp_in_aff_ge_0_2 = prove(`!v v1 v2:real^N. v IN segment [v1,v2] ==> v IN aff_ge {vec 0} {v1,v2}`, + REPEAT GEN_TAC THEN + ASM_CASES_TAC `v1:real^N = vec 0` THENL + [ + ASM_SIMP_TAC[aff_ge_0_2_eq_segment]; + ALL_TAC + ] THEN + ASM_CASES_TAC `v2:real^N = vec 0` THENL + [ + ASM_REWRITE_TAC[aff_ge_0_2_eq_segment; SEGMENT_SYM]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[aff_ge_0_2] THEN + REWRITE_TAC[IN_SEGMENT; IN_ELIM_THM] THEN + STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`&1 - u`; `u:real`] THEN + ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `u <= &1` THEN REAL_ARITH_TAC);; + + + +let points_in_aff_ge_0_2 = prove(`!v1 v2:real^N. vec 0 IN aff_ge {vec 0} {v1, v2} /\ + v1 IN aff_ge {vec 0} {v1, v2} /\ + v2 IN aff_ge {vec 0} {v1, v2}`, + REPEAT GEN_TAC THEN + ASM_CASES_TAC `v1:real^N = vec 0` THENL + [ + ASM_REWRITE_TAC[aff_ge_0_2_eq_segment; ENDS_IN_SEGMENT]; + ALL_TAC + ] THEN + ASM_CASES_TAC `v2:real^N = vec 0` THENL + [ + ASM_REWRITE_TAC[aff_ge_0_2_eq_segment; ENDS_IN_SEGMENT]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[aff_ge_0_2; IN_ELIM_THM] THEN + REPEAT CONJ_TAC THENL + [ + MAP_EVERY EXISTS_TAC [`&0`; `&0`]; + MAP_EVERY EXISTS_TAC [`&1`; `&0`]; + MAP_EVERY EXISTS_TAC [`&0`; `&1`] + ] THEN + REWRITE_TAC[REAL_LE_REFL; REAL_LE_01; VECTOR_MUL_LZERO; VECTOR_ADD_LID; VECTOR_MUL_LID; VECTOR_ADD_RID]);; + + + +let aff_ge_0_2_SUBSET = prove(`!v1 v2 v w:real^N. ~(v1 = vec 0) /\ ~(v2 = vec 0) /\ + v IN aff_ge {vec 0} {v1,v2} /\ w IN aff_ge {vec 0} {v1,v2} + ==> aff_ge {vec 0} {v,w} SUBSET aff_ge {vec 0} {v1,v2}`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`{vec 0:real^N}`; `{v1:real^N,v2}`] CONVEX_AFF_GE) THEN + REWRITE_TAC[CONVEX_CONTAINS_SEGMENT] THEN DISCH_TAC THEN + ASM_CASES_TAC `v:real^N = vec 0` THENL + [ + ASM_REWRITE_TAC[aff_ge_0_2_eq_segment] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[points_in_aff_ge_0_2]; + ALL_TAC + ] THEN + ASM_CASES_TAC `w:real^N = vec 0` THENL + [ + ASM_REWRITE_TAC[aff_ge_0_2_eq_segment] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[points_in_aff_ge_0_2]; + ALL_TAC + ] THEN + REPEAT (FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl))) THEN + ASM_SIMP_TAC[aff_ge_0_2; IN_ELIM_THM; SUBSET] THEN + REPEAT STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`t1'' * t1 + t2'' * t1'`; `t1'' * t2 + t2'' * t2'`] THEN + REWRITE_TAC[CONJ_ASSOC] THEN + CONJ_TAC THENL + [ + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_ADD THEN CONJ_TAC THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + VECTOR_ARITH_TAC);; + + + +let segment_inter_aff_ge_ends = prove(`!v1 v2 v w n:real^N. ~(v1 = vec 0) /\ ~(v2 = vec 0) /\ + v1 dot n = &0 /\ v2 dot n = &0 /\ + v dot n = &0 /\ ~(w dot n = &0) /\ + ~(segment [v,w] INTER aff_ge {vec 0} {v1,v2} = {}) + ==> v IN aff_ge {vec 0} {v1,v2}`, + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + REWRITE_TAC[IN_INTER; IN_SEGMENT] THEN + REPEAT STRIP_TAC THEN + FIRST_ASSUM MP_TAC THEN + SUBGOAL_THEN `?t1 t2. &0 <= t1 /\ &0 <= t2 /\ x = t1 % v1 + t2 % v2:real^N` MP_TAC THENL + [ + POP_ASSUM MP_TAC THEN + ASM_SIMP_TAC[aff_ge_0_2; IN_ELIM_THM]; + ALL_TAC + ] THEN + STRIP_TAC THEN + SUBGOAL_THEN `u = &0` ASSUME_TAC THENL + [ + POP_ASSUM (MP_TAC o AP_TERM `\v:real^N. v dot n`) THEN + FIRST_X_ASSUM (MP_TAC o AP_TERM `\v:real^N. v dot n`) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ASM_REWRITE_TAC[DOT_LADD; DOT_LMUL; REAL_MUL_RZERO; REAL_ADD_LID] THEN + UNDISCH_TAC `~(w dot n:real^N = &0)` THEN + CONV_TAC REAL_FIELD; + ALL_TAC + ] THEN + UNDISCH_TAC `x = (&1 - u) % v + u % w:real^N` THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + REMOVE_ASSUM THEN + REWRITE_TAC[REAL_SUB_RZERO; VECTOR_MUL_LZERO; VECTOR_MUL_LID; VECTOR_ADD_RID] THEN + DISCH_THEN (fun th -> ASM_REWRITE_TAC[SYM th]));; + + + + +let in_affine_hull_lemma = prove(`!v1 v2 v:real^N. ~collinear {vec 0,v1,v2} /\ v IN affine hull {vec 0,v1,v2} + ==> ?t1 t2. v = t1 % v1 + t2 % v2 /\ + (!t1' t2'. v = t1' % v1 + t2' % v2 ==> t1' = t1 /\ t2' = t2)`, + REWRITE_TAC[AFFINE_HULL_3; IN_ELIM_THM] THEN + REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + REPEAT STRIP_TAC THEN + UNDISCH_TAC `~collinear {vec 0,v1,v2:real^N}` THEN DISCH_TAC THEN + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[COLLINEAR_LEMMA] THEN + FIRST_X_ASSUM MP_TAC THEN ONCE_REWRITE_TAC[SET_RULE `{vec 0:real^N,v1,v2} = {vec 0,v2,v1}`] THEN + REWRITE_TAC[COLLINEAR_LEMMA; DE_MORGAN_THM; NOT_EXISTS_THM] THEN + REPEAT STRIP_TAC THEN + + MAP_EVERY EXISTS_TAC [`v':real`; `w:real`] THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THENL + [ + ASM_CASES_TAC `t1' = v':real` THEN ASM_REWRITE_TAC[] THEN + SUBGOAL_TAC "A" `~(v' - t1' = &0)` [ POP_ASSUM MP_TAC THEN REAL_ARITH_TAC ] THEN + FIRST_X_ASSUM (MP_TAC o check (is_eq o concl)) THEN + REWRITE_TAC[VECTOR_ARITH `t1 % v1 + t2 % v2 = t1' % v1 + t2' % v2 <=> (t1 - t1') % v1 = (t2' - t2) % v2:real^N`] THEN + DISCH_THEN (MP_TAC o AP_TERM `(\v:real^N. inv(v' - t1') % v)`) THEN BETA_TAC THEN + REWRITE_TAC[VECTOR_MUL_ASSOC] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; VECTOR_MUL_LID]; + ASM_CASES_TAC `t2' = w:real` THEN ASM_REWRITE_TAC[] THEN + SUBGOAL_TAC "A" `~(w - t2' = &0)` [ POP_ASSUM MP_TAC THEN REAL_ARITH_TAC ] THEN + FIRST_X_ASSUM (MP_TAC o check (is_eq o concl)) THEN + REWRITE_TAC[VECTOR_ARITH `t1 % v1 + t2 % v2 = t1' % v1 + t2' % v2 <=> (t2 - t2') % v2 = (t1' - t1) % v1:real^N`] THEN + DISCH_THEN (MP_TAC o AP_TERM `(\v:real^N. inv(w - t2') % v)`) THEN BETA_TAC THEN + REWRITE_TAC[VECTOR_MUL_ASSOC] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; VECTOR_MUL_LID] + ]);; + + + + +let affine_hull_3_plane = prove(`!v1 v2 n:real^3. ~collinear {vec 0,v1,v2} /\ ~(n = vec 0) /\ + v1 dot n = &0 /\ v2 dot n = &0 + ==> affine hull {vec 0,v1,v2} = {v | v dot n = &0}`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `dim {n,v1,v2:real^3} = 3` ASSUME_TAC THENL + [ + ONCE_REWRITE_TAC[DIM_INSERT] THEN + SUBGOAL_THEN `~(n IN span {v1,v2:real^3})` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[SPAN_2; IN_UNIV; IN_ELIM_THM] THEN + STRIP_TAC THEN + POP_ASSUM (MP_TAC o AP_TERM `(dot) (n:real^3)`) THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + SIMP_TAC[DOT_RADD; DOT_RMUL; DOT_SYM] THEN + ASM_REWRITE_TAC[REAL_MUL_RZERO; REAL_ADD_LID; DOT_EQ_0]; + ALL_TAC + ] THEN + + ONCE_REWRITE_TAC[DIM_INSERT] THEN + SUBGOAL_THEN `~(v1:real^3 IN span {v2})` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[SPAN_SING; IN_ELIM_THM; IN_UNIV] THEN + UNDISCH_TAC `~collinear {vec 0:real^3,v1,v2}` THEN + ONCE_REWRITE_TAC[SET_RULE `{vec 0:real^3,v1,v2} = {vec 0,v2,v1}`] THEN + SIMP_TAC[COLLINEAR_LEMMA; DE_MORGAN_THM]; + ALL_TAC + ] THEN + REWRITE_TAC[DIM_SING] THEN + UNDISCH_TAC `~collinear {vec 0:real^3,v1,v2}` THEN + SIMP_TAC[COLLINEAR_LEMMA; DE_MORGAN_THM] THEN + ARITH_TAC; + ALL_TAC + ] THEN + MP_TAC (ISPEC `{n:real^3,v1,v2}` DIM_EQ_FULL) THEN + ASM_REWRITE_TAC[AFFINE_HULL_3; DIMINDEX_3; SPAN_3; IN_UNIV; EXTENSION; IN_ELIM_THM] THEN DISCH_TAC THEN + REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + GEN_TAC THEN + EQ_TAC THENL + [ + STRIP_TAC THEN ASM_REWRITE_TAC[DOT_LADD; DOT_LMUL; REAL_MUL_RZERO; REAL_ADD_RID]; + ALL_TAC + ] THEN + POP_ASSUM (MP_TAC o SPEC `x:real^3`) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[DOT_LADD; DOT_LMUL; REAL_MUL_RZERO; REAL_ADD_RID] THEN + ASM_REWRITE_TAC[REAL_ENTIRE; DOT_EQ_0] THEN + DISCH_TAC THEN + MAP_EVERY EXISTS_TAC [`&1 - v - w`; `v:real`; `w:real`] THEN + CONJ_TAC THENL [ REAL_ARITH_TAC; ALL_TAC ] THEN + ASM_REWRITE_TAC[] THEN VECTOR_ARITH_TAC);; + + + + +let intersection_point_exists = prove(`!v1 v2 n v w:real^3. + ~collinear {vec 0,v1,v2} /\ ~(n = vec 0) /\ + v1 dot n = &0 /\ v2 dot n = &0 /\ + v dot n <= &0 /\ + &0 <= w dot n + ==> ?p. p IN segment [v,w] INTER affine hull {vec 0,v1,v2}`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[IN_INTER; IN_SEGMENT; affine_hull_3_plane; IN_ELIM_THM] THEN + ABBREV_TAC `d = (\u. ((&1 - u) % v + u % w) dot n:real^3)` THEN + SUBGOAL_THEN `?u. (&0 <= u /\ u <= &1) /\ d u = &0` ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM IN_REAL_INTERVAL] THEN + MATCH_MP_TAC REAL_IVT_INCREASING THEN + REWRITE_TAC[REAL_LE_01] THEN + EXPAND_TAC "d" THEN + ASM_REWRITE_TAC[REAL_SUB_RZERO; VECTOR_MUL_LZERO; VECTOR_ADD_RID; VECTOR_MUL_LID; REAL_SUB_REFL] THEN + ASM_REWRITE_TAC[VECTOR_ADD_LID] THEN + EXPAND_TAC "d" THEN + REWRITE_TAC[VECTOR_ARITH `((&1 - u) % v + u % w:real^3) dot n = v dot n + u * ((w - v) dot n)`] THEN + MATCH_MP_TAC REAL_CONTINUOUS_ON_ADD THEN + REWRITE_TAC[REAL_CONTINUOUS_ON_CONST] THEN + MATCH_MP_TAC REAL_CONTINUOUS_ON_MUL THEN + REWRITE_TAC[REAL_CONTINUOUS_ON_CONST; REAL_CONTINUOUS_ON_ID]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + EXISTS_TAC `(&1 - u) % v + u % w:real^3` THEN + POP_ASSUM MP_TAC THEN EXPAND_TAC "d" THEN SIMP_TAC[] THEN + DISCH_TAC THEN + EXISTS_TAC `u:real` THEN ASM_REWRITE_TAC[]);; + + + + + +let aux_ineq = prove(`!a b x. &0 < a /\ &0 < b /\ x = (&1 - a * a - b * b) / (&2 * a * b) /\ -- &1 <= x /\ x <= &1 + ==> x * (&1 - a) <= b`, + REPEAT GEN_TAC THEN + REWRITE_TAC[GSYM IMP_IMP] THEN + DISCH_TAC THEN DISCH_TAC THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REPEAT DISCH_TAC THEN + + SUBGOAL_THEN `&0 < &2 * a * b` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LT_MUL THEN + REWRITE_TAC[REAL_ARITH `&0 < &2`] THEN + MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + SUBGOAL_THEN `&1 <= (a + b) pow 2` ASSUME_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o check (is_binop `(<=):real->real->bool` o concl)) THEN + MP_TAC (GEN_ALL RAT_LEMMA4) THEN + DISCH_THEN (MP_TAC o SPECL [`&1 - a * a - b * b`; `&1`; `&1`; `&2 * a * b`]) THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`; REAL_ARITH `&1 / &1 = &1`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + SUBGOAL_THEN `(a - b) pow 2 <= &1` ASSUME_TAC THENL + [ + UNDISCH_TAC `-- &1 <= (&1 - a * a - b * b) / (&2 * a * b)` THEN + MP_TAC (GEN_ALL RAT_LEMMA4) THEN + DISCH_THEN (MP_TAC o SPECL [`-- &1`; `&2 * a * b`; `&1 - a * a - b * b`; `&1`]) THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < &1`; REAL_ARITH `-- &1 / &1 = -- &1`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + DISJ_CASES_TAC (REAL_ARITH `&0 < &1 - a \/ &1 - a = &0 \/ &1 - a < &0`) THENL + [ + ASM_CASES_TAC `(&1 - a * a - b * b) / (&2 * a * b) < &0` THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `&0` THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE] THEN + REWRITE_TAC[REAL_ARITH `a * b <= &0 <=> &0 <= (--a) * b`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE; REAL_ARITH `x < &0 ==> &0 <= --x`]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[REAL_NOT_LT] THEN DISCH_TAC THEN + ONCE_REWRITE_TAC[REAL_ARITH `x <= b <=> x <= &1 * b`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE] THEN + REWRITE_TAC[REAL_ARITH `&1 - a <= b <=> &1 <= a + b`] THEN + SUBGOAL_THEN `&0 <= a + b` MP_TAC THENL + [ + MATCH_MP_TAC REAL_LE_ADD THEN ASM_SIMP_TAC[REAL_LT_IMP_LE]; + ALL_TAC + ] THEN + ONCE_REWRITE_TAC[GSYM REAL_ABS_REFL] THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[SYM th]) THEN + ONCE_REWRITE_TAC[REAL_ARITH `&1 = abs(&1)`] THEN + ASM_REWRITE_TAC[REAL_LE_SQUARE_ABS; REAL_ARITH `&1 pow 2 = &1`]; + ALL_TAC + ] THEN + POP_ASSUM DISJ_CASES_TAC THENL + [ + ASM_SIMP_TAC[REAL_MUL_RZERO; REAL_LT_IMP_LE]; + ALL_TAC + ] THEN + ASM_CASES_TAC `&0 < (&1 - a * a - b * b) / (&2 * a * b)` THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `&0` THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE] THEN + REWRITE_TAC[REAL_ARITH `a * b <= &0 <=> &0 <= a * (--b)`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE; REAL_ARITH `x < &0 ==> &0 <= --x`]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[REAL_NOT_LT] THEN DISCH_TAC THEN + ONCE_REWRITE_TAC[REAL_ARITH `x * y <= b <=> (--x) * (--y) <= &1 * b`] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_SIMP_TAC[REAL_ARITH `x <= &0 ==> &0 <= --x`; REAL_ARITH `&1 - a < &0 ==> &0 <= --(&1 - a)`] THEN + ASM_REWRITE_TAC[REAL_ARITH `-- x <= &1 <=> -- &1 <= x`] THEN + REMOVE_ASSUM THEN REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[ABS_SQUARE_LE_1] THEN + REAL_ARITH_TAC);; + + + +let rotation_dist_decrease_lemma = prove(`!v w u:real^N. u IN aff_ge {vec 0} {v,w} /\ norm u = norm v + ==> dist (u,w) <= dist (v,w)`, + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `v:real^N = vec 0` THENL + [ + UNDISCH_TAC `norm (u:real^N) = norm (v:real^N)` THEN + ASM_REWRITE_TAC[NORM_0; NORM_EQ_0] THEN + SIMP_TAC[REAL_LE_REFL]; + ALL_TAC + ] THEN + ASM_CASES_TAC `w:real^N = vec 0` THENL + [ + ASM_REWRITE_TAC[DIST_0; REAL_LE_REFL]; + ALL_TAC + ] THEN + REWRITE_TAC[dist] THEN + ONCE_REWRITE_TAC[GSYM REAL_ABS_NORM] THEN + REWRITE_TAC[REAL_LE_SQUARE_ABS] THEN + REWRITE_TAC[NORM_POW_2; DOT_LSUB; DOT_RSUB] THEN + ASM_REWRITE_TAC[DOT_SYM; DOT_SQUARE_NORM] THEN + REWRITE_TAC[REAL_ARITH `v - uw - (uw - w) <= v - vw - (vw - w) <=> vw <= uw`] THEN + SUBGOAL_THEN `~(u = vec 0:real^N)` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[GSYM NORM_EQ_0] THEN + ASM_REWRITE_TAC[NORM_EQ_0]; + ALL_TAC + ] THEN + + MAP_EVERY ABBREV_TAC [`v':real^N = inv (norm v) % v`; `w':real^N = inv (norm w) % w`; `u':real^N = inv (norm u) % u`] THEN + SUBGOAL_THEN `norm (v':real^N) = &1 /\ norm (w':real^N) = &1 /\ norm (u':real^N) = &1` ASSUME_TAC THENL + [ + REPLICATE_TAC 3 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN + REWRITE_TAC[GSYM NORM_EQ_0; NORM_MUL] THEN + SUBGOAL_THEN `!v:real^N. abs (inv (norm v)) = inv (norm v)` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[REAL_ABS_REFL] THEN + GEN_TAC THEN MATCH_MP_TAC REAL_LE_INV THEN + REWRITE_TAC[NORM_POS_LE]; + ALL_TAC + ] THEN + SIMP_TAC[REAL_MUL_LINV]; + ALL_TAC + ] THEN + SUBGOAL_THEN `v:real^N = norm v % v' /\ w:real^N = norm w % w' /\ u:real^N = norm u % u'` ASSUME_TAC THENL + [ + REMOVE_ASSUM THEN + REPLICATE_TAC 3 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN + REWRITE_TAC[VECTOR_ARITH `a % b % v = (a * b) % v:real^N`; GSYM NORM_EQ_0] THEN + SIMP_TAC[REAL_MUL_RINV] THEN + REWRITE_TAC[VECTOR_MUL_LID]; + ALL_TAC + ] THEN + SUBGOAL_THEN `?a b. &0 <= a /\ &0 <= b /\ u':real^N = a % v' + b % w'` ASSUME_TAC THENL + [ + REMOVE_ASSUM THEN REMOVE_ASSUM THEN + REPLICATE_TAC 3 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl)) THEN + ASM_SIMP_TAC[aff_ge_0_2] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN + REWRITE_TAC[GSYM NORM_EQ_0] THEN REPEAT STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`t1:real`; `inv (norm (v:real^N)) * t2 * norm (w:real^N)`] THEN + CONJ_TAC THEN ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_MUL THEN + CONJ_TAC THENL [ MATCH_MP_TAC REAL_LE_INV THEN REWRITE_TAC[NORM_POS_LE]; ALL_TAC ] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[NORM_POS_LE]; + ALL_TAC + ] THEN + REWRITE_TAC[VECTOR_ARITH `(vv * t2 * ww) % iw % w = (vv * t2 * (ww * iw)) % (w:real^N)`] THEN + ASM_SIMP_TAC[REAL_MUL_RINV; REAL_MUL_RID] THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN + POP_ASSUM (fun th -> ONCE_REWRITE_TAC[th]) THEN + REPLICATE_TAC 3 (FIRST_X_ASSUM ((fun th -> ALL_TAC) o check (is_eq o concl))) THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[DOT_LMUL; DOT_RMUL] THEN + MATCH_MP_TAC REAL_LE_LMUL THEN ASM_REWRITE_TAC[NORM_POS_LE] THEN + MATCH_MP_TAC REAL_LE_LMUL THEN ASM_REWRITE_TAC[NORM_POS_LE] THEN + + ASM_CASES_TAC `a = &0` THENL + [ + UNDISCH_TAC `u':real^N = a % v' + b % w'` THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID] THEN + DISCH_THEN (MP_TAC o AP_TERM `norm:real^N->real`) THEN + ASM_REWRITE_TAC[NORM_MUL; REAL_MUL_LZERO; REAL_ADD_LID] THEN + ASM_SIMP_TAC[REAL_ARITH `&0 <= b ==> abs b = b`; REAL_MUL_RID] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[DOT_LMUL; DOT_SQUARE_NORM; REAL_MUL_LID] THEN + ASM_REWRITE_TAC[VECTOR_ANGLE; REAL_POW_2; REAL_MUL_LID] THEN + REWRITE_TAC[COS_BOUNDS]; + ALL_TAC + ] THEN + + ASM_CASES_TAC `b = &0` THENL + [ + UNDISCH_TAC `u':real^N = a % v' + b % w'` THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID] THEN + DISCH_THEN (MP_TAC o AP_TERM `norm:real^N -> real`) THEN + ASM_SIMP_TAC[NORM_MUL; REAL_ARITH `&0 <= t1 ==> abs t1 = t1`; REAL_MUL_RID] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[DOT_LMUL; REAL_MUL_LID; REAL_LE_REFL]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[DOT_LADD; DOT_LMUL; DOT_SQUARE_NORM; REAL_POW_2; REAL_MUL_RID] THEN + REWRITE_TAC[REAL_ARITH `vw <= a * vw + b <=> vw * (&1 - a) <= b`] THEN + MATCH_MP_TAC aux_ineq THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < a <=> &0 <= a /\ ~(a = &0)`] THEN + CONJ_TAC THENL + [ + UNDISCH_TAC `u':real^N = a % v' + b % w'` THEN + DISCH_THEN (MP_TAC o AP_TERM `norm:real^N->real`) THEN + ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[GSYM REAL_ABS_NORM] THEN + ONCE_REWRITE_TAC[REAL_ARITH `&1 = abs(&1)`] THEN + REWRITE_TAC[REAL_EQ_SQUARE_ABS; NORM_POW_2; DOT_LADD; DOT_RADD; DOT_SYM; DOT_LMUL; DOT_RMUL] THEN + ASM_REWRITE_TAC[DOT_SQUARE_NORM; REAL_MUL_RID; REAL_POW_2; REAL_MUL_RID] THEN + REWRITE_TAC[REAL_ARITH `abs(&1) = &1`] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + CONV_TAC REAL_FIELD; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[VECTOR_ANGLE; REAL_MUL_LID; COS_BOUNDS]);; + + + +let rotation_dist_decrease_special_case = prove(`!(v:real^N) w u a. &0 <= a /\ w = --a % v /\ norm u = norm v ==> dist (u,w) <= dist (v,w)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[dist] THEN ONCE_REWRITE_TAC[GSYM REAL_ABS_NORM] THEN + REWRITE_TAC[REAL_LE_SQUARE_ABS] THEN + REWRITE_TAC[NORM_POW_2; DOT_LSUB; DOT_RSUB] THEN + REWRITE_TAC[DOT_SYM; DOT_SQUARE_NORM] THEN + ASM_REWRITE_TAC[DOT_RMUL] THEN + REWRITE_TAC[REAL_ARITH `vv - uv - (uv - ww) <= vv - v2 - (v2 - ww) <=> --uv <= --v2`] THEN + REWRITE_TAC[REAL_NEG_LMUL; REAL_NEG_NEG] THEN + MATCH_MP_TAC REAL_LE_LMUL THEN ASM_REWRITE_TAC[] THEN + ASM_REWRITE_TAC[VECTOR_ANGLE] THEN + REPEAT (MATCH_MP_TAC REAL_LE_LMUL THEN REWRITE_TAC[NORM_POS_LE]) THEN + REWRITE_TAC[VECTOR_ANGLE_REFL] THEN + ASM_CASES_TAC `v:real^N = vec 0` THEN ASM_REWRITE_TAC[] THENL + [ + REWRITE_TAC[vector_angle; REAL_LE_REFL]; + REWRITE_TAC[COS_0; COS_BOUNDS] + ]);; + + + + +(******************************************************************) + +(* Lemmas about continuous functions *) + + +let continuous_lemma_inc = prove(`!f c t1. &0 <= t1 /\ + f real_continuous_on real_interval [&0,t1] /\ + f (&0) <= c /\ c <= f t1 + ==> ?x. &0 <= x /\ x <= t1 /\ f x = c /\ + (!t. &0 <= t /\ t < x ==> f t < c)`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `s = {t | &0 <= t /\ t <= t1 /\ c <= f t}` THEN + SUBGOAL_THEN `t1:real IN s` ASSUME_TAC THENL + [ + EXPAND_TAC "s" THEN ASM_REWRITE_TAC[IN_ELIM_THM; REAL_LE_REFL]; + ALL_TAC + ] THEN + EXISTS_TAC `inf s` THEN + MP_TAC (SPEC `s:real->bool` INF) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + CONJ_TAC THENL [ EXISTS_TAC `t1:real` THEN ASM_REWRITE_TAC[]; EXISTS_TAC `&0` ] THEN + GEN_TAC THEN EXPAND_TAC "s" THEN + SIMP_TAC[IN_ELIM_THM]; + ALL_TAC + ] THEN + STRIP_TAC THEN + + (* 0 <= inf s *) + SUBGOAL_THEN `&0 <= inf s` ASSUME_TAC THENL + [ + POP_ASSUM (MP_TAC o SPEC `&0`) THEN + ANTS_TAC THEN SIMP_TAC[] THEN + GEN_TAC THEN EXPAND_TAC "s" THEN + SIMP_TAC[IN_ELIM_THM]; + ALL_TAC + ] THEN + + (* inf s <= t1 *) + SUBGOAL_THEN `inf s <= t1` ASSUME_TAC THENL + [ + REMOVE_ASSUM THEN POP_ASSUM (MP_TAC o SPEC `t1:real`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + (* f t < c for all t IN [0,inf s) *) + SUBGOAL_THEN `!t. &0 <= t /\ t < inf s ==> f t < c` ASSUME_TAC THENL + [ + GEN_TAC THEN + DISCH_THEN (LABEL_TAC "A") THEN + SUBGOAL_THEN `&0 <= t /\ t <= t1` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LT_IMP_LE THEN + MATCH_MP_TAC REAL_LTE_TRANS THEN + EXISTS_TAC `inf s` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + USE_THEN "A" MP_TAC THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[REAL_NOT_LT; DE_MORGAN_THM] THEN + DISCH_TAC THEN DISJ2_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + EXPAND_TAC "s" THEN ASM_REWRITE_TAC[IN_ELIM_THM]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + + (* f(inf s) = c *) + DISJ_CASES_TAC (REAL_ARITH `c < f (inf s) \/ f (inf s) = c \/ f (inf s) < c`) THENL + [ + (* f(inf s) > c *) + MP_TAC (SPECL [`f:real->real`; `&0`; `inf s`; `c:real`] REAL_IVT_INCREASING) THEN + ANTS_TAC THENL + [ + ASM_SIMP_TAC[REAL_LT_IMP_LE] THEN + MATCH_MP_TAC REAL_CONTINUOUS_ON_SUBSET THEN + EXISTS_TAC `real_interval [&0,t1]` THEN + ASM_REWRITE_TAC[] THEN + ASM_REWRITE_TAC[SUBSET_REAL_INTERVAL; REAL_LE_REFL]; + ALL_TAC + ] THEN + REWRITE_TAC[IN_REAL_INTERVAL] THEN + STRIP_TAC THEN + ASM_CASES_TAC `x = inf s` THENL + [ + UNDISCH_TAC `f (x:real) = c:real` THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:real`) THEN + ASM_REWRITE_TAC[REAL_ARITH `x < inf s <=> x <= inf s /\ ~(x = inf s)`] THEN + REWRITE_TAC[REAL_LT_REFL]; + ALL_TAC + ] THEN + POP_ASSUM DISJ_CASES_TAC THEN ASM_REWRITE_TAC[] THEN + + (* f(inf s) < c *) + UNDISCH_TAC `f real_continuous_on real_interval [&0,t1]` THEN + REWRITE_TAC[real_continuous_on] THEN + DISCH_THEN (MP_TAC o SPEC `inf s`) THEN + ASM_REWRITE_TAC[IN_REAL_INTERVAL] THEN + DISCH_THEN (MP_TAC o SPEC `c - f (inf s)`) THEN + ANTS_TAC THENL + [ + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + STRIP_TAC THEN + ABBREV_TAC `p = inf s + min (d / &2) (t1 - inf s)` THEN + SUBGOAL_THEN `!t. &0 <= t /\ t <= p ==> f t < c` ASSUME_TAC THENL + [ + GEN_TAC THEN + ASM_CASES_TAC `t < inf s` THENL + [ + DISCH_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_NOT_LT] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `t:real`) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `p:real` THEN + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "p" THEN + REWRITE_TAC[REAL_ARITH `a + b <= t1 <=> b <= t1 - a`] THEN + REWRITE_TAC[REAL_MIN_MIN]; + ALL_TAC + ] THEN + MATCH_MP_TAC (REAL_ARITH `!a. &0 < d /\ a < d /\ &0 <= a ==> abs a < d`) THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 <= a - b <=> b <= a`] THEN + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `p - inf s` THEN + ASM_REWRITE_TAC[REAL_ARITH `a - b <= c - b <=> a <= c`] THEN + EXPAND_TAC "p" THEN + REWRITE_TAC[REAL_ARITH `(a + b) - a = b`] THEN + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `d / &2` THEN + ASM_SIMP_TAC[REAL_MIN_MIN; REAL_ARITH `&0 < d ==> d / &2 < d`]; + ALL_TAC + ] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + SUBGOAL_THEN `p <= inf s` MP_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + GEN_TAC THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[REAL_NOT_LE] THEN + DISCH_TAC THEN FIRST_X_ASSUM (MP_TAC o SPEC `x:real`) THEN + EXPAND_TAC "s" THEN REWRITE_TAC[IN_ELIM_THM; DE_MORGAN_THM] THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE] THEN + ASM_CASES_TAC `&0 <= x` THEN ASM_REWRITE_TAC[] THEN + SIMP_TAC[REAL_NOT_LE]; + ALL_TAC + ] THEN + SUBGOAL_THEN `inf s < p` MP_TAC THENL + [ + EXPAND_TAC "p" THEN + REWRITE_TAC[REAL_ARITH `a < a + b <=> &0 < b`] THEN + ASM_SIMP_TAC[REAL_LT_MIN; REAL_ARITH `&0 < d ==> &0 < d / &2`] THEN + ASM_CASES_TAC `inf s = t1` THENL + [ + UNDISCH_TAC `f (inf s) < c` THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + UNDISCH_TAC `c <= f (t1:real)` THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < t1 - inf s <=> inf s <= t1 /\ ~(inf s = t1)`]; + ALL_TAC + ] THEN + REAL_ARITH_TAC);; + + + +let continuous_lemma_dec = prove(`!f c t1. &0 <= t1 /\ + f real_continuous_on real_interval [&0,t1] /\ + c <= f (&0) /\ f t1 <= c + ==> ?x. &0 <= x /\ x <= t1 /\ f x = c /\ + (!t. &0 <= t /\ t < x ==> c < f t)`, + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`\t. --(f:real->real) t`; `--c:real`; `t1:real`] continuous_lemma_inc) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL + [ + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_CONTINUOUS_ON_NEG THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[REAL_LE_NEG]; + ALL_TAC + ] THEN + STRIP_TAC THEN + EXISTS_TAC `x:real` THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + ONCE_REWRITE_TAC[REAL_ARITH `a = b <=> --a = --b`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + GEN_TAC THEN STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `t:real`) THEN + ASM_REWRITE_TAC[REAL_LT_NEG]);; + + + + + + + + + +(******************************************************) + +(* Rotation lemmas *) + + +let rotation_lemma_special = prove(`!v w n:real^N. ~(v = vec 0) /\ ~(w = vec 0) /\ + (v dot n = &0) /\ (w dot n = &0) /\ + 3 <= dimindex(:N) ==> + ?f:real^1->real^N. f continuous_on UNIV /\ + f(lift (&0)) = v /\ f(lift (&1)) = norm v / norm w % w /\ + (!t. norm (f t) = norm v /\ f t dot n = &0) /\ + (!t. &0 <= t /\ t <= &1 ==> dist (f (lift t), w) <= dist (v, w)) /\ + (~collinear {vec 0, v, w} ==> (!t. &0 <= t /\ t <= &1 ==> f (lift t) IN aff_ge {vec 0} {v, w}))`, + REPEAT GEN_TAC THEN STRIP_TAC THEN + SUBGOAL_THEN `~(norm (v:real^N) = &0) /\ ~(norm (w:real^N) = &0)` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[NORM_EQ_0]; + ALL_TAC + ] THEN + + ABBREV_TAC `u = norm (v:real^N) / norm w % w:real^N` THEN + SUBGOAL_THEN `norm (u:real^N) = norm (v:real^N)` ASSUME_TAC THENL + [ + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[NORM_MUL; REAL_ABS_DIV; REAL_ABS_NORM; real_div] THEN + ASM_SIMP_TAC[GSYM REAL_MUL_ASSOC; REAL_MUL_LINV; REAL_MUL_RID]; + ALL_TAC + ] THEN + SUBGOAL_THEN `~(u = vec 0:real^N)` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[GSYM NORM_EQ_0]; + ALL_TAC + ] THEN + SUBGOAL_THEN `aff_ge {vec 0} {v,w} = aff_ge {vec 0:real^N} {v,u}` ASSUME_TAC THENL + [ + MATCH_MP_TAC aff_ge_eq_lemma THEN + EXISTS_TAC `norm (v:real^N) / norm (w:real^N)` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LT_DIV THEN + ASM_REWRITE_TAC[NORM_POS_LE; REAL_ARITH `&0 < a <=> &0 <= a /\ ~(a = &0)`]; + ALL_TAC + ] THEN + SUBGOAL_THEN `collinear {vec 0, v, w:real^N} <=> collinear {vec 0, v, u}` (fun th -> REWRITE_TAC[th]) THENL + [ + MP_TAC (ISPECL [`&1`; `norm (v:real^N) / norm (w:real^N)`; `v:real^N`; `w:real^N`] COLLINEAR_SCALE_ALL) THEN + ANTS_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `~(&1 = &0)`] THEN + MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`) THEN + MATCH_MP_TAC REAL_LT_DIV THEN + ASM_REWRITE_TAC[NORM_POS_LT]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[VECTOR_MUL_LID]; + ALL_TAC + ] THEN + + ASM_CASES_TAC `~collinear {vec 0,v,u:real^N}` THENL + [ + MP_TAC (SPECL [`v:real^N`; `u:real^N`] rotation_lemma) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + EXISTS_TAC `f:real^1->real^N` THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + GEN_TAC THEN + UNDISCH_TAC `!t:real^1. ?a b. f t = a % v + b % u:real^N` THEN + DISCH_THEN (MP_TAC o SPEC `t:real^1`) THEN STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `f (lift (&1)) = u:real^N` THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + EXPAND_TAC "u" THEN + REWRITE_TAC[DOT_LADD; DOT_LMUL] THEN + ASM_REWRITE_TAC[REAL_MUL_RZERO; REAL_ADD_LID]; + ALL_TAC + ] THEN + CONJ_TAC THENL + [ + REPEAT STRIP_TAC THEN + MATCH_MP_TAC rotation_dist_decrease_lemma THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[IN_INTERVAL_1]; + ALL_TAC + ] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[IN_INTERVAL_1]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN + ASM_REWRITE_TAC[COLLINEAR_LEMMA_ALT] THEN + STRIP_TAC THEN + FIRST_ASSUM (MP_TAC o AP_TERM `norm:real^N->real`) THEN + ASM_REWRITE_TAC[NORM_MUL] THEN + ASM_REWRITE_TAC[REAL_ARITH `v = c * v <=> v * (c - &1) = &0`; REAL_ENTIRE; REAL_ARITH `abs c - &1 = &0 <=> c = &1 \/ c = -- &1`] THEN + DISCH_THEN DISJ_CASES_TAC THENL + [ + EXISTS_TAC `(\t:real^1. v:real^N)` THEN + ASM_REWRITE_TAC[CONTINUOUS_ON_CONST; VECTOR_MUL_LID; REAL_LE_REFL]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `?e:real^N. e dot v = &0 /\ norm e = norm v /\ e dot n = &0` ASSUME_TAC THENL + [ + SUBGOAL_THEN `dim {v:real^N,n} < dimindex (:N)` ASSUME_TAC THENL + [ + MATCH_MP_TAC LET_TRANS THEN + EXISTS_TAC `2` THEN + ASM_SIMP_TAC[ARITH_RULE `3 <= a ==> 2 < a`] THEN + MATCH_MP_TAC LE_TRANS THEN + EXISTS_TAC `CARD {v:real^N,n}` THEN + SUBGOAL_THEN `FINITE {v:real^N,n}` ASSUME_TAC THENL + [ + REWRITE_TAC[FINITE_INSERT; FINITE_EMPTY]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[DIM_LE_CARD] THEN + REWRITE_TAC[Geomdetail.CARD2]; + ALL_TAC + ] THEN + MP_TAC (SPEC `{v:real^N,n}` ORTHOGONAL_TO_SUBSPACE_EXISTS) THEN + ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; orthogonal] THEN + STRIP_TAC THEN + EXISTS_TAC `norm (v:real^N) / norm (x:real^N) % x:real^N` THEN + FIRST_ASSUM (MP_TAC o SPEC `v:real^N`) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `n:real^N`) THEN + REWRITE_TAC[] THEN REPEAT DISCH_TAC THEN + ASM_REWRITE_TAC[NORM_MUL; REAL_ABS_DIV; REAL_ABS_NORM; real_div; GSYM REAL_MUL_ASSOC; DOT_LMUL; REAL_MUL_RZERO] THEN + UNDISCH_TAC `~(x:real^N = vec 0)` THEN + SIMP_TAC[GSYM NORM_EQ_0; REAL_MUL_LINV; REAL_MUL_RID]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + + ABBREV_TAC `f = (\t:real^1. cos (pi * drop t) % v + sin (pi * drop t) % e:real^N)` THEN + EXISTS_TAC `f:real^1->real^N` THEN + + CONJ_TAC THENL + [ + EXPAND_TAC "f" THEN + MATCH_MP_TAC CONTINUOUS_ON_ADD THEN + CONJ_TAC THEN MATCH_MP_TAC CONTINUOUS_ON_VMUL THENL + [ + SUBGOAL_THEN `lift o (\t:real^1. cos (pi * drop t)) = (lift o cos o drop) o (\t:real^1. pi % t)` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[FUN_EQ_THM; o_THM; DROP_CMUL]; + ALL_TAC + ] THEN + MATCH_MP_TAC CONTINUOUS_ON_COMPOSE THEN + CONJ_TAC THENL [ MATCH_MP_TAC CONTINUOUS_ON_CMUL THEN REWRITE_TAC [CONTINUOUS_ON_ID]; ALL_TAC ] THEN + MATCH_MP_TAC CONTINUOUS_AT_IMP_CONTINUOUS_ON THEN + GEN_TAC THEN DISCH_TAC THEN + MP_TAC (SPEC `drop (x:real^1)` REAL_CONTINUOUS_AT_COS) THEN + REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS_ATREAL; LIFT_DROP]; + + SUBGOAL_THEN `lift o (\t:real^1. sin (pi * drop t)) = (lift o sin o drop) o (\t:real^1. pi % t)` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[FUN_EQ_THM; o_THM; DROP_CMUL]; + ALL_TAC + ] THEN + MATCH_MP_TAC CONTINUOUS_ON_COMPOSE THEN + CONJ_TAC THENL [ MATCH_MP_TAC CONTINUOUS_ON_CMUL THEN REWRITE_TAC [CONTINUOUS_ON_ID]; ALL_TAC ] THEN + MATCH_MP_TAC CONTINUOUS_AT_IMP_CONTINUOUS_ON THEN + GEN_TAC THEN DISCH_TAC THEN + MP_TAC (SPEC `drop (x:real^1)` REAL_CONTINUOUS_AT_SIN) THEN + REWRITE_TAC[REAL_CONTINUOUS_CONTINUOUS_ATREAL; LIFT_DROP]; + ]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + EXPAND_TAC "f" THEN + REWRITE_TAC[LIFT_DROP; REAL_MUL_RZERO; COS_0; SIN_0; VECTOR_MUL_LID; VECTOR_MUL_LZERO; VECTOR_ADD_RID]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + EXPAND_TAC "f" THEN + ASM_REWRITE_TAC[LIFT_DROP; REAL_MUL_RID; COS_PI; SIN_PI; VECTOR_MUL_LZERO; VECTOR_ADD_RID]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!t:real^1. norm ((f:real^1->real^N) t) = norm (v:real^N)` ASSUME_TAC THENL + [ + EXPAND_TAC "f" THEN + GEN_TAC THEN + ONCE_REWRITE_TAC[GSYM REAL_ABS_NORM] THEN + REWRITE_TAC[REAL_EQ_SQUARE_ABS] THEN + ASM_REWRITE_TAC[NORM_POW_2; DOT_LADD; DOT_RADD; DOT_LMUL; DOT_RMUL; DOT_SYM; REAL_MUL_RZERO; REAL_ADD_LID; REAL_ADD_RID] THEN + ASM_REWRITE_TAC[DOT_SQUARE_NORM] THEN + REWRITE_TAC[REAL_ARITH `c * c * n + s * s * n = (s pow 2 + c pow 2) * n`] THEN + REWRITE_TAC[SIN_CIRCLE; REAL_MUL_LID]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + GEN_TAC THEN EXPAND_TAC "f" THEN + ASM_REWRITE_TAC[DOT_LADD; DOT_LMUL; REAL_MUL_RZERO; REAL_ADD_RID]; + ALL_TAC + ] THEN + + GEN_TAC THEN DISCH_TAC THEN + MATCH_MP_TAC rotation_dist_decrease_special_case THEN + ASM_REWRITE_TAC[] THEN + EXISTS_TAC `norm(w:real^N) / norm(v:real^N)` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_DIV THEN + REWRITE_TAC[NORM_POS_LE]; + ALL_TAC + ] THEN + UNDISCH_TAC `norm (v:real^N) / norm (w:real^N) % w = u` THEN + DISCH_THEN (MP_TAC o AP_TERM `\x:real^N. norm (w:real^N) / norm (v:real^N) % x`) THEN + REWRITE_TAC[VECTOR_MUL_ASSOC; real_div] THEN + ONCE_REWRITE_TAC[REAL_ARITH `(w * iv) * v * iw = (w * iw) * (v * iv)`] THEN + ASM_SIMP_TAC[REAL_MUL_RINV; REAL_MUL_LID; VECTOR_MUL_LID] THEN + VECTOR_ARITH_TAC);; + + + +(* Consider properties of intersecting segments *) +let aff_ge_inter_segments = prove(`!v w u p:real^N. ~collinear {vec 0, v, u} /\ p IN aff_ge {vec 0} {v, u} /\ + ~(segment [v, w] INTER aff_ge {vec 0} {u} = {}) + ==> ~(segment [p, w] INTER aff_ge {vec 0} {u} = {})`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `(?x y. &0 <= x /\ x <= &1 /\ &0 <= y /\ (&1 - x) % p + x % w:real^N = y % u) ==> ~(segment [p,w] INTER aff_ge {vec 0} {u} = {})` MP_TAC THENL + [ + STRIP_TAC THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + REWRITE_TAC[IN_INTER; IN_SEGMENT; HALFLINE; VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + EXISTS_TAC `(&1 - x) % p + x % w:real^N` THEN + CONJ_TAC THENL + [ + REMOVE_ASSUM THEN + EXISTS_TAC `x:real` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[IN_ELIM_THM] THEN + EXISTS_TAC `y:real` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[TAUT `~(A ==> ~B) <=> A /\ B`] THEN + REMOVE_ASSUM THEN + + SUBGOAL_THEN `~(v = vec 0:real^N) /\ ~(u = vec 0:real^N)` ASSUME_TAC THENL + [ + UNDISCH_TAC `~collinear {vec 0, v, u:real^N}` THEN + SIMP_TAC[COLLINEAR_LEMMA; DE_MORGAN_THM]; + ALL_TAC + ] THEN + + UNDISCH_TAC `p IN aff_ge {vec 0:real^N} {v, u}` THEN + ASM_SIMP_TAC[aff_ge_0_2; IN_ELIM_THM] THEN + STRIP_TAC THEN + + SUBGOAL_THEN `?a c. &0 <= a /\ a <= &1 /\ &0 <= c /\ (&1 - a) % v + a % w = c % u:real^N` MP_TAC THENL + [ + UNDISCH_TAC `~(segment [v,w] INTER aff_ge {vec 0} {u:real^N} = {})` THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY; IN_INTER; IN_SEGMENT; HALFLINE; IN_ELIM_THM] THEN + REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`u':real`; `t:real`] THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + STRIP_TAC THEN + + ASM_CASES_TAC `a = &0` THENL + [ + MAP_EVERY EXISTS_TAC [`&0`; `t1 * c + t2:real`] THEN + REWRITE_TAC[REAL_LE_REFL; REAL_LE_01; VECTOR_MUL_LZERO; VECTOR_ADD_RID; REAL_SUB_RZERO; VECTOR_MUL_LID] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_ADD THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `(&1 - a) % v + a % w = c % u:real^N` THEN + ASM_REWRITE_TAC[REAL_SUB_RZERO; VECTOR_MUL_LID; VECTOR_MUL_LZERO; VECTOR_ADD_RID] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o AP_TERM `\x:real^N. inv a % x` o check (is_eq o concl)) THEN + ASM_REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; VECTOR_MUL_LID] THEN + REWRITE_TAC[VECTOR_ARITH `v + w = z <=> w = z - v:real^N`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[VECTOR_ARITH `x % (a % u - b % v) = (x * a) % u + (--x * b) % v:real^N`] THEN + REWRITE_TAC[VECTOR_ARITH `y % u - (a % v + b % u) = (y - b) % u + (--a) % v:real^N`] THEN + + ABBREV_TAC `b = inv a * (&1 - a)` THEN + ABBREV_TAC `d = inv a * c` THEN + + ASM_CASES_TAC `t1 = &0` THENL + [ + MAP_EVERY EXISTS_TAC [`&0`; `t2:real`] THEN + ASM_REWRITE_TAC[REAL_LE_REFL; REAL_LE_01; REAL_MUL_LZERO; VECTOR_MUL_LZERO; REAL_MUL_LNEG; VECTOR_MUL_LNEG; REAL_SUB_RZERO; REAL_SUB_REFL; REAL_MUL_LID]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `&0 <= b /\ &0 <= d` ASSUME_TAC THENL + [ + SUBGOAL_THEN `&0 <= inv a` ASSUME_TAC THENL [ MATCH_MP_TAC REAL_LE_INV THEN ASM_REWRITE_TAC[]; ALL_TAC ] THEN + EXPAND_TAC "b" THEN EXPAND_TAC "d" THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[REAL_ARITH `&0 <= &1 - a <=> a <= &1`]; + ALL_TAC + ] THEN + + ABBREV_TAC `x = t1 / (b + t1)` THEN + MAP_EVERY EXISTS_TAC [`x:real`; `(&1 - x) * t2 + x * d`] THEN + SUBGOAL_THEN `&0 <= x /\ x <= &1` ASSUME_TAC THENL + [ + EXPAND_TAC "x" THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_DIV THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_ADD THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC Trigonometry2.REAL_LE_LDIV THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LET_ADD THEN + ASM_REWRITE_TAC[REAL_LT_LE]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[REAL_ARITH `t1 <= b + t1 <=> &0 <= b`]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_ADD THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[REAL_ARITH `&0 <= &1 - x <=> x <= &1`]; + ALL_TAC + ] THEN + + REWRITE_TAC[REAL_ARITH `((&1 - x) * t2 + x * d) - (&1 - x) * t2 = x * d`] THEN + SUBGOAL_THEN `--x * b = --((&1 - x) * t1)` (fun th -> REWRITE_TAC[th]) THEN + SUBGOAL_THEN `&1 - x = b * x * inv t1` (fun th -> REWRITE_TAC[th]) THENL + [ + EXPAND_TAC "x" THEN + SUBGOAL_THEN `~(b + t1 = &0)` ASSUME_TAC THENL + [ + MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`) THEN + MATCH_MP_TAC REAL_LET_ADD THEN + ASM_REWRITE_TAC[REAL_LT_LE]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_EQ_LCANCEL_IMP THEN + EXISTS_TAC `b + t1:real` THEN + FIRST_ASSUM (fun th -> REWRITE_TAC[th; real_div]) THEN + REWRITE_TAC[REAL_ARITH `bt * (&1 - t1 * ibt) = bt - t1 * (bt * ibt)`] THEN + REWRITE_TAC[REAL_ARITH `bt * b * (t * ibt) * it = (bt * ibt) * (t * it) * b`] THEN + ASM_SIMP_TAC[REAL_MUL_RINV] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + REWRITE_TAC[GSYM REAL_MUL_ASSOC] THEN + ASM_SIMP_TAC[REAL_MUL_LINV] THEN + REAL_ARITH_TAC);; + + + +(* A special version of the rotation lemma for intersecting segments *) +let rotation_lemma_segments = prove(`!v w u n:real^N. 3 <= dimindex (:N) /\ + ~(v = vec 0) /\ ~(u = vec 0) /\ + v dot n = &0 /\ w dot n = &0 /\ u dot n = &0 /\ + ~(segment [vec 0,u] INTER segment [v,w] = {}) + ==> ?f:real^1->real^N. f continuous_on UNIV /\ + f (lift (&0)) = v /\ + f (lift (&1)) = norm v / norm u % u /\ + (!t. norm (f t) = norm v /\ f t dot n = &0) /\ + (!t. &0 <= t /\ t <= &1 ==> dist (f (lift t), u) <= dist (v, u) /\ + dist (f (lift t), w) <= dist (v, w)) /\ + (!t. &0 <= t /\ t <= &1 ==> ~(segment [f (lift t), w] INTER aff_ge {vec 0} {u} = {}))`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `~collinear {vec 0, v, w:real^N} ==> ~(w = vec 0) /\ (!t. ~((&1 - t) % v + t % w = vec 0))` ASSUME_TAC THENL + [ + REWRITE_TAC[COLLINEAR_LEMMA; DE_MORGAN_THM; NOT_EXISTS_THM] THEN STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + GEN_TAC THEN + ASM_CASES_TAC `t = &0` THEN ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID; REAL_SUB_RZERO; VECTOR_MUL_LID] THEN + DISCH_THEN (MP_TAC o AP_TERM `\x:real^N. inv t % x`) THEN + REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; VECTOR_MUL_LID; VECTOR_MUL_RZERO] THEN + ASM_REWRITE_TAC[VECTOR_ARITH `a % v + w = vec 0 <=> w = (--a) % v:real^N`]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `~(segment [v,w] INTER aff_ge {vec 0} {u:real^N} = {})` ASSUME_TAC THENL + [ + UNDISCH_TAC `~(segment [vec 0,u] INTER segment [v,w:real^N] = {})` THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY; IN_INTER] THEN + STRIP_TAC THEN + EXISTS_TAC `x:real^N` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC Hypermap.lemma_in_subset THEN + EXISTS_TAC `segment [vec 0,u:real^N]` THEN + ASM_REWRITE_TAC[SEGMENT_SUBSET_HALFLINE]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `?x c. &0 <= x /\ x <= &1 /\ &0 <= c /\ (&1 - x) % v + x % w = c % u:real^N` MP_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY; IN_INTER; IN_SEGMENT; HALFLINE; IN_ELIM_THM] THEN + REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`u':real`; `t:real`] THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + STRIP_TAC THEN + + ASM_CASES_TAC `~collinear {vec 0, v, u:real^N}` THENL + [ + MP_TAC (SPECL [`v:real^N`; `u:real^N`; `n:real^N`] rotation_lemma_special) THEN + ASM_SIMP_TAC[] THEN + STRIP_TAC THEN + EXISTS_TAC `f:real^1->real^N` THEN + ASM_REWRITE_TAC[] THEN + + ASM_CASES_TAC `w = vec 0:real^N` THENL + [ + ASM_REWRITE_TAC[DIST_0; REAL_LE_REFL] THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + REPEAT STRIP_TAC THEN + EXISTS_TAC `vec 0:real^N` THEN + REWRITE_TAC[IN_INTER; ENDS_IN_SEGMENT; ENDS_IN_HALFLINE]; + ALL_TAC + ] THEN + + ASM_CASES_TAC `~collinear {vec 0, v, w:real^N}` THENL + [ + FIRST_ASSUM (fun th -> FIRST_X_ASSUM (MP_TAC o MATCH_MP th)) THEN + STRIP_TAC THEN + CONJ_TAC THEN GEN_TAC THEN DISCH_TAC THENL + [ + ASM_SIMP_TAC[] THEN + MATCH_MP_TAC rotation_dist_decrease_lemma THEN + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `?a b. &0 <= a /\ &0 <= b /\ u = a % v + b % w:real^N` MP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPEC `x:real`) THEN + DISCH_TAC THEN + UNDISCH_TAC `(&1 - x) % v + x % w = c % u:real^N` THEN + ASM_CASES_TAC `c = &0` THENL [ ASM_REWRITE_TAC[VECTOR_MUL_LZERO]; ALL_TAC ] THEN + DISCH_THEN (MP_TAC o AP_TERM `\v:real^N. inv c % v`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; VECTOR_ADD_LDISTRIB; REAL_MUL_LINV; VECTOR_MUL_LID] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MAP_EVERY EXISTS_TAC [`inv c * (&1 - x)`; `inv c * x`] THEN + REWRITE_TAC[] THEN + SUBGOAL_THEN `&0 <= inv c` ASSUME_TAC THENL [ MATCH_MP_TAC REAL_LE_INV THEN ASM_REWRITE_TAC[]; ALL_TAC ] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[REAL_ARITH `&0 <= &1 - x <=> x <= &1`]; + ALL_TAC + ] THEN + STRIP_TAC THEN + + ASM_SIMP_TAC[aff_ge_0_2; IN_ELIM_THM] THEN + REPLICATE_TAC 2 (FIRST_X_ASSUM (MP_TAC o SPEC `t:real`)) THEN + ASM_SIMP_TAC[aff_ge_0_2; IN_ELIM_THM] THEN + STRIP_TAC THEN DISCH_THEN (fun th -> ALL_TAC) THEN + MAP_EVERY EXISTS_TAC [`t1 + t2 * a:real`; `t2 * b:real`] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_ADD THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + CONJ_TAC THENL [ MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[]; ALL_TAC ] THEN + ASM_REWRITE_TAC[] THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC aff_ge_inter_segments THEN + EXISTS_TAC `v:real^N` THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + CONJ_TAC THEN GEN_TAC THEN DISCH_TAC THENL + [ + ASM_SIMP_TAC[] THEN + SUBGOAL_THEN `c = &0` ASSUME_TAC THENL + [ + UNDISCH_TAC `~ ~collinear {vec 0, v, w:real^N}` THEN + ASM_REWRITE_TAC[COLLINEAR_LEMMA; DE_MORGAN_THM] THEN + STRIP_TAC THEN + UNDISCH_TAC `~collinear {vec 0, v, u:real^N}` THEN + ASM_REWRITE_TAC[COLLINEAR_LEMMA; DE_MORGAN_THM; NOT_EXISTS_THM] THEN + DISCH_TAC THEN + ASM_CASES_TAC `c = &0` THEN ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `(&1 - x) % v + x % w = c % u:real^N` THEN + DISCH_THEN (MP_TAC o AP_TERM `\x:real^N. inv c % x`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; VECTOR_MUL_LID] THEN + ASM_REWRITE_TAC[VECTOR_ARITH `a % (b % v + c % v) = (a * b + a * c) % v`]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `~(x = &0)` ASSUME_TAC THENL + [ + ASM_CASES_TAC `x = &0` THEN ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `(&1 - x) % v + x % w = c % u:real^N` THEN + ASM_REWRITE_TAC[REAL_SUB_RZERO; VECTOR_MUL_LID; VECTOR_MUL_LZERO; VECTOR_ADD_RID]; + ALL_TAC + ] THEN + + MATCH_MP_TAC rotation_dist_decrease_special_case THEN + EXISTS_TAC `inv x * (&1 - x)` THEN + ASM_SIMP_TAC[] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[REAL_ARITH `&0 <= &1 - x <=> x <= &1`] THEN + MATCH_MP_TAC REAL_LE_INV THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + UNDISCH_TAC `(&1 - x) % v + x % w = c % u:real^N` THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO] THEN + REWRITE_TAC[VECTOR_ARITH `a % v + x % w = vec 0:real^N <=> x % w = --a % v`] THEN + DISCH_THEN (MP_TAC o AP_TERM `\v:real^N. inv x % v`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; VECTOR_MUL_LID] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + MATCH_MP_TAC aff_ge_inter_segments THEN + EXISTS_TAC `v:real^N` THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN + REWRITE_TAC[] THEN + MP_TAC (ISPECL [`vec 0:real^N`; `u:real^N`; `v:real^N`] (GEN_ALL (CONJUNCT1 Collect_geom.PER_SET3))) THEN + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th]) THEN + ASM_REWRITE_TAC[COLLINEAR_LEMMA; DE_MORGAN_THM] THEN + DISCH_THEN (X_CHOOSE_THEN `b:real` (LABEL_TAC "v" o SYM)) THEN + ASM_CASES_TAC `&0 <= b` THENL + [ + EXISTS_TAC `\t:real^1. v:real^N` THEN + ASM_REWRITE_TAC[CONTINUOUS_ON_CONST; REAL_LE_REFL] THEN + REMOVE_THEN "v" (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[NORM_MUL; real_div; GSYM REAL_MUL_ASSOC] THEN + UNDISCH_TAC `~(u = vec 0:real^N)` THEN + REWRITE_TAC[GSYM NORM_EQ_0] THEN + SIMP_TAC[REAL_MUL_RINV; REAL_MUL_RID] THEN + SUBGOAL_THEN `abs b = b` (fun th -> REWRITE_TAC[th]) THEN + ASM_REWRITE_TAC[REAL_ABS_REFL]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_NOT_LE] THEN DISCH_TAC THEN + MP_TAC (SPECL [`v:real^N`; `u:real^N`; `n:real^N`] rotation_lemma_special) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + EXISTS_TAC `f:real^1->real^N` THEN + ASM_SIMP_TAC[] THEN + + ASM_CASES_TAC `w = vec 0:real^N` THENL + [ + ASM_REWRITE_TAC[DIST_0; REAL_LE_REFL] THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + REPEAT STRIP_TAC THEN + EXISTS_TAC `vec 0:real^N` THEN + REWRITE_TAC[IN_INTER; ENDS_IN_SEGMENT; ENDS_IN_HALFLINE]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `?d. &0 <= d /\ w = d % u:real^N` ASSUME_TAC THENL + [ + SUBGOAL_THEN `~(x = &0)` ASSUME_TAC THENL + [ + DISCH_TAC THEN + UNDISCH_TAC `(&1 - x) % v + x % w = c % u:real^N` THEN + ASM_REWRITE_TAC[REAL_SUB_RZERO; VECTOR_MUL_LID; VECTOR_MUL_LZERO; VECTOR_ADD_RID] THEN + REMOVE_THEN "v" (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[VECTOR_ARITH `b % u = c % u <=> (c + --b) % u = vec 0:real^N`; VECTOR_MUL_EQ_0] THEN + MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`) THEN + MATCH_MP_TAC REAL_LET_ADD THEN + ASM_REWRITE_TAC[REAL_NEG_GT0]; + ALL_TAC + ] THEN + + UNDISCH_TAC `(&1 - x) % v + x % w = c % u:real^N` THEN + DISCH_THEN (MP_TAC o AP_TERM `\v:real^N. inv x % v`) THEN + ASM_SIMP_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; REAL_MUL_LINV; VECTOR_MUL_LID] THEN + REWRITE_TAC[VECTOR_ARITH `a + w = b <=> w = b - a:real^N`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REMOVE_THEN "v" (fun th -> REWRITE_TAC[SYM th; VECTOR_MUL_ASSOC; GSYM VECTOR_SUB_RDISTRIB]) THEN + ABBREV_TAC `d = inv x * c - ((inv x * (&1 - x)) * b)` THEN + + EXISTS_TAC `d:real` THEN + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "d" THEN + REWRITE_TAC[GSYM REAL_MUL_ASSOC; GSYM REAL_SUB_LDISTRIB] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + CONJ_TAC THENL [ MATCH_MP_TAC REAL_LE_INV THEN ASM_REWRITE_TAC[]; ALL_TAC ] THEN + REWRITE_TAC[REAL_ARITH `c - a * b = c + a * (--b)`] THEN + MATCH_MP_TAC REAL_LE_ADD THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[REAL_NEG_GE0; REAL_ARITH `&0 <= &1 - x <=> x <= &1`] THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + CONJ_TAC THEN GEN_TAC THEN DISCH_TAC THENL + [ + MATCH_MP_TAC rotation_dist_decrease_special_case THEN + EXISTS_TAC `--inv b * d` THEN + ASM_SIMP_TAC[] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[GSYM REAL_INV_NEG] THEN + MATCH_MP_TAC REAL_LE_INV THEN + ASM_SIMP_TAC[REAL_NEG_GE0; REAL_LT_IMP_LE]; + ALL_TAC + ] THEN + + REMOVE_THEN "v" (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_ARITH `--(--inv b * d) * b = d * b * inv b`] THEN + ASM_SIMP_TAC[REAL_ARITH `b < &0 ==> ~(b = &0)`; REAL_MUL_RINV; REAL_MUL_RID]; + ALL_TAC + ] THEN + + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY; IN_INTER; IN_SEGMENT; HALFLINE; IN_ELIM_THM] THEN + EXISTS_TAC `w:real^N` THEN + CONJ_TAC THENL + [ + EXISTS_TAC `&1` THEN + ASM_REWRITE_TAC[REAL_LE_01; REAL_LE_REFL; REAL_SUB_REFL; VECTOR_MUL_LZERO; VECTOR_ADD_LID; VECTOR_MUL_LID]; + ALL_TAC + ] THEN + EXISTS_TAC `d:real` THEN + ASM_REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID]);; + + + + +(* Rotation about an axis lemma *) +let rotation_about_axis = prove(`!d v w:real^N. 3 <= dimindex (:N) /\ ~(d = vec 0) /\ + ~(projection d w = vec 0) /\ + ~(projection d v = vec 0) + ==> ?(f:real^1->real^N) a b. &0 < a /\ + f continuous_on UNIV /\ + f(lift (&0)) = v /\ + f(lift (&1)) = a % w + b % d /\ + (!t c. dist (f t, c % d) = dist (v, c % d)) /\ + (!t. &0 <= t /\ t <= &1 ==> dist (f (lift t), w) <= dist (v, w))`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `~(norm (projection d (v:real^N)) = &0) /\ ~(norm (projection d (w:real^N)) = &0)` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[NORM_EQ_0]; + ALL_TAC + ] THEN + MP_TAC (SPECL [`projection d (v:real^N)`; `projection d (w:real^N)`; `d:real^N`] rotation_lemma_special) THEN + ASM_REWRITE_TAC[PROJECTION_ORTHOGONAL] THEN + + DISCH_THEN (X_CHOOSE_THEN `g:real^1->real^N` MP_TAC) THEN + STRIP_TAC THEN + + EXISTS_TAC `\t:real^1. g t + (v - projection d (v:real^N))` THEN + EXISTS_TAC `norm (projection d (v:real^N)) / norm (projection d (w:real^N))` THEN + ABBREV_TAC `a = norm (projection d (v:real^N)) / norm (projection d (w:real^N))` THEN + EXISTS_TAC `(v dot (d:real^N)) / norm d pow 2 - a * (w dot d) / norm d pow 2` THEN + + CONJ_TAC THENL + [ + EXPAND_TAC "a" THEN + MATCH_MP_TAC REAL_LT_DIV THEN + ASM_REWRITE_TAC[NORM_POS_LT]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + MATCH_MP_TAC CONTINUOUS_ON_ADD THEN + ASM_REWRITE_TAC[CONTINUOUS_ON_CONST]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[projection; VECTOR_SUB_LDISTRIB; NORM_POW_2; real_div; VECTOR_MUL_ASSOC; VECTOR_SUB_RDISTRIB] THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + REPEAT GEN_TAC THEN + REWRITE_TAC[DIST_EQ] THEN + ASM_SIMP_TAC[PROJECTION_DIST_SPECIAL_EQ; PROJECTION_LINEAR; PROJECTION_ZERO] THEN + ASM_REWRITE_TAC[VECTOR_MUL_RZERO; DIST_0] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + REPEAT STRIP_TAC THEN + REWRITE_TAC[] THEN + MATCH_MP_TAC PROJECTION_DIST_SPECIAL_LE THEN + ASM_SIMP_TAC[]);; + + + + + +(******************************************************) + +(* The main lemma: continuous intersection of [f(t),w] and aff_ge {0} {v1,v2} *) + +let continuous_solution_aux = prove(`!a11 a12 a21 a22 f g t1 t2. + f real_continuous_on real_interval [t1,t2] /\ + g real_continuous_on real_interval [t1,t2] /\ + ~(a11 * a22 - a12 * a21 = &0) + ==> ?x1 x2. x1 real_continuous_on real_interval [t1,t2] /\ + x2 real_continuous_on real_interval [t1,t2] /\ + (!t. a11 * x1 t + a12 * x2 t = f t /\ + a21 * x1 t + a22 * x2 t = g t /\ + (!y1 y2. a11 * y1 + a12 * y2 = f t /\ + a21 * y1 + a22 * y2 = g t ==> y1 = x1 t /\ y2 = x2 t))`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `d = a11 * a22 - a12 * a21` THEN + MAP_EVERY EXISTS_TAC [`\t. (a22 * (f:real->real) t - a12 * (g:real->real) t) * inv(d)`; `\t. (a11 * (g:real->real) t - a21 * (f:real->real) t) * inv d`] THEN + REPEAT CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_CONTINUOUS_ON_RMUL THEN + MATCH_MP_TAC REAL_CONTINUOUS_ON_SUB THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_CONTINUOUS_ON_LMUL THEN ASM_REWRITE_TAC[]; + MATCH_MP_TAC REAL_CONTINUOUS_ON_RMUL THEN + MATCH_MP_TAC REAL_CONTINUOUS_ON_SUB THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_CONTINUOUS_ON_LMUL THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + GEN_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + BETA_TAC THEN + CONV_TAC REAL_FIELD);; + + + +let continuous_intersection_point = prove(`!v1 v2 n (f:real^1->real^3) w t1. + ~collinear {vec 0,v1,v2} /\ + f continuous_on interval [lift (&0), lift (t1)] /\ &0 <= t1 /\ + v1 dot n = &0 /\ v2 dot n = &0 /\ + &0 < w dot n /\ + (!t. &0 <= t /\ t <= t1 ==> f (lift t) dot n <= &0) + ==> (?a b. a real_continuous_on real_interval [&0, t1] /\ + b real_continuous_on real_interval [&0, t1] /\ + (!t. &0 <= t /\ t <= t1 ==> segment [f (lift t),w] INTER affine hull {vec 0,v1,v2} = {a t % v1 + b t % v2}))`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `u0 = (\t. --((f o lift) t dot n:real^3) / (w dot n - ((f o lift) t dot n)))` THEN + ABBREV_TAC `f1 = (\t. ((f o lift) t dot v1:real^3) + u0 t * (w - (f o lift) t) dot v1)` THEN + ABBREV_TAC `f2 = (\t. ((f o lift) t dot v2:real^3) + u0 t * (w - (f o lift) t) dot v2)` THEN + MP_TAC (SPECL [`v1 dot v1:real^3`; `v1 dot v2:real^3`; `v1 dot v2:real^3`; `v2 dot v2:real^3`; `f1:real->real`; `f2:real->real`; `&0`; `t1:real`] continuous_solution_aux) THEN + ANTS_TAC THENL + [ + SUBGOAL_THEN `!v:real^3. (\t. (f o lift) t dot v) real_continuous_on real_interval [&0,t1]` ASSUME_TAC THENL + [ + GEN_TAC THEN REWRITE_TAC[REAL_CONTINUOUS_ON] THEN + SUBGOAL_THEN `lift o (\t. (f o lift) t dot v:real^3) o drop = (lift o (\y. v dot y)) o f` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[FUN_EQ_THM; o_THM; DOT_SYM; LIFT_DROP]; + ALL_TAC + ] THEN + MATCH_MP_TAC CONTINUOUS_ON_COMPOSE THEN + ASM_REWRITE_TAC[IMAGE_LIFT_REAL_INTERVAL; CONTINUOUS_ON_LIFT_DOT]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `u0 real_continuous_on real_interval[&0,t1]` ASSUME_TAC THENL + [ + EXPAND_TAC "u0" THEN + REWRITE_TAC[real_div] THEN + MATCH_MP_TAC REAL_CONTINUOUS_ON_MUL THEN + CONJ_TAC THENL [ MATCH_MP_TAC REAL_CONTINUOUS_ON_NEG THEN ASM_REWRITE_TAC[]; ALL_TAC ] THEN + REWRITE_TAC[REAL_CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC REAL_CONTINUOUS_INV_WITHINREAL THEN + CONJ_TAC THENL + [ + POP_ASSUM MP_TAC THEN SPEC_TAC (`x:real`, `x:real`) THEN + ONCE_REWRITE_TAC[GSYM REAL_CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN] THEN + MATCH_MP_TAC REAL_CONTINUOUS_ON_SUB THEN ASM_REWRITE_TAC[REAL_CONTINUOUS_ON_CONST]; + ALL_TAC + ] THEN + MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`) THEN + REWRITE_TAC[REAL_ARITH `a - b = a + (--b)`] THEN + MATCH_MP_TAC REAL_LTE_ADD THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:real`) THEN + ASM_REWRITE_TAC[GSYM IN_REAL_INTERVAL; o_THM] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + EXPAND_TAC "f1" THEN + MATCH_MP_TAC REAL_CONTINUOUS_ON_ADD THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_CONTINUOUS_ON_MUL THEN + ASM_REWRITE_TAC[VECTOR_ARITH `(w - f) dot v = w dot v - f dot v:real^3`] THEN + MATCH_MP_TAC REAL_CONTINUOUS_ON_SUB THEN + ASM_REWRITE_TAC[REAL_CONTINUOUS_ON_CONST]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + EXPAND_TAC "f2" THEN + MATCH_MP_TAC REAL_CONTINUOUS_ON_ADD THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_CONTINUOUS_ON_MUL THEN + ASM_REWRITE_TAC[VECTOR_ARITH `(w - f) dot v = w dot v - f dot v:real^3`] THEN + MATCH_MP_TAC REAL_CONTINUOUS_ON_SUB THEN + ASM_REWRITE_TAC[REAL_CONTINUOUS_ON_CONST]; + ALL_TAC + ] THEN + + REWRITE_TAC[REAL_ARITH `v11 * v22 - v12 * v12 = &0 <=> v12 pow 2 = v11 * v22`] THEN + ASM_REWRITE_TAC[DOT_CAUCHY_SCHWARZ_EQUAL]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`x1:real->real`; `x2:real->real`] THEN + ASM_REWRITE_TAC[] THEN + GEN_TAC THEN DISCH_TAC THEN + + REPEAT (FIRST_X_ASSUM (MP_TAC o SPEC `t:real`)) THEN + ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THEN + + REWRITE_TAC [SET_RULE `!s (x:A). s = {x} <=> (?x. x IN s) /\ (!y. y IN s ==> y = x)`] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC intersection_point_exists THEN + EXISTS_TAC `n:real^3` THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE] THEN + DISCH_TAC THEN + UNDISCH_TAC `&0 < w dot n:real^3` THEN + ASM_REWRITE_TAC[DOT_RZERO; REAL_LT_REFL]; + ALL_TAC + ] THEN + + GEN_TAC THEN REWRITE_TAC[IN_INTER; IN_SEGMENT; AFFINE_HULL_3; IN_ELIM_THM; VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + STRIP_TAC THEN + SUBGOAL_THEN `u:real = u0 (t:real)` ASSUME_TAC THENL + [ + UNDISCH_TAC `y:real^3 = (&1 - u) % f (lift t) + u % w` THEN + DISCH_THEN (MP_TAC o AP_TERM `(\y:real^3. y dot n)`) THEN + FIRST_X_ASSUM (fun th -> REWRITE_TAC[th]) THEN + ASM_REWRITE_TAC[DOT_LADD; DOT_LMUL; REAL_MUL_RZERO; REAL_ADD_RID] THEN + EXPAND_TAC "u0" THEN + REWRITE_TAC[o_THM] THEN + SUBGOAL_THEN `&0 < w:real^3 dot n - f (lift t) dot n` MP_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `a - b = a + (--b)`] THEN + MATCH_MP_TAC REAL_LTE_ADD THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 <= --a <=> a <= &0`]; + ALL_TAC + ] THEN + CONV_TAC REAL_FIELD; + ALL_TAC + ] THEN + + SUBGOAL_THEN `v:real = x1 (t:real) /\ w':real = x2 t` ASSUME_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[VECTOR_ARITH `(v1 dot v1) * v + (v1 dot v2:real^3) * w' = (v % v1 + w' % v2) dot v1`] THEN + REWRITE_TAC[VECTOR_ARITH `(v1 dot v2) * v + (v2 dot v2:real^3) * w' = (v % v1 + w' % v2) dot v2`] THEN + EXPAND_TAC "f1" THEN EXPAND_TAC "f2" THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th; o_THM]) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[] THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + UNDISCH_TAC `y:real^3 = v % v1 + w' % v2` THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ASM_REWRITE_TAC[]);; + + + +let in_aff_ge_cases_lemma = prove(`!v1 v2 v w:real^N. ~collinear {vec 0,v1,v2} /\ ~(between (vec 0) (v,w)) /\ + v IN affine hull {vec 0,v1,v2} /\ w IN aff_ge {vec 0} {v1,v2} + ==> v IN aff_ge {vec 0} {v1,v2} \/ + v1 IN aff_ge {vec 0} {v,w} \/ + v2 IN aff_ge {vec 0} {v,w}`, + REPEAT STRIP_TAC THEN + UNDISCH_TAC `~collinear {vec 0, v1, v2:real^N}` THEN DISCH_TAC THEN + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[COLLINEAR_LEMMA; DE_MORGAN_THM; NOT_EXISTS_THM] THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o MATCH_MP zero_not_between) THEN + STRIP_TAC THEN + + ASM_CASES_TAC `v:real^N IN aff_ge {vec 0} {v1,v2}` THEN ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `?t1 t2. v:real^N = t1 % v1 + t2 % v2 /\ (t1 < &0 \/ t2 < &0)` MP_TAC THENL + [ + UNDISCH_TAC `v IN affine hull {vec 0, v1, v2:real^N}` THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[AFFINE_HULL_3; IN_ELIM_THM; VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + ASM_SIMP_TAC[aff_ge_0_2; IN_ELIM_THM; NOT_EXISTS_THM] THEN + DISCH_TAC THEN STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`v':real`; `w':real`] THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`v':real`; `w':real`]) THEN + REWRITE_TAC[DE_MORGAN_THM; REAL_NOT_LE] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REPEAT (DISCH_THEN (CHOOSE_THEN MP_TAC)) THEN + DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "v" o SYM) ASSUME_TAC) THEN + + SUBGOAL_THEN `?t3 t4. w:real^N = t3 % v1 + t4 % v2 /\ &0 <= t3 /\ &0 <= t4` MP_TAC THENL + [ + UNDISCH_TAC `w:real^N IN aff_ge {vec 0} {v1,v2}` THEN + ASM_SIMP_TAC[aff_ge_0_2; IN_ELIM_THM] THEN + STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`t1':real`; `t2':real`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REPEAT (DISCH_THEN (CHOOSE_THEN MP_TAC)) THEN + DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "w" o SYM) ASSUME_TAC) THEN + + SUBGOAL_THEN `~(v = vec 0:real^N)` ASSUME_TAC THENL + [ + ASM_CASES_TAC `v = vec 0:real^N` THEN ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `~(v IN aff_ge {vec 0} {v1,v2:real^N})` THEN + ASM_REWRITE_TAC[points_in_aff_ge_0_2]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[aff_ge_0_2; IN_ELIM_THM] THEN + ASM_CASES_TAC `t3 = &0` THENL + [ + REMOVE_THEN "w" (MP_TAC o SYM) THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID] THEN + ASM_CASES_TAC `t4 = &0` THENL [ ASM_REWRITE_TAC[VECTOR_MUL_LZERO]; ALL_TAC ] THEN + DISCH_THEN (MP_TAC o AP_TERM `\w:real^N. inv(t4) % w`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; VECTOR_MUL_LID] THEN + DISCH_TAC THEN + DISJ2_TAC THEN + MAP_EVERY EXISTS_TAC [`&0`; `inv t4`] THEN + ASM_SIMP_TAC[REAL_LE_INV; REAL_LE_REFL; VECTOR_MUL_LZERO; VECTOR_ADD_LID]; + ALL_TAC + ] THEN + ASM_CASES_TAC `t4 = &0` THENL + [ + REMOVE_THEN "w" (MP_TAC o SYM) THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID] THEN + DISCH_THEN (MP_TAC o AP_TERM `\w:real^N. inv(t3) % w`) THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_LINV; VECTOR_MUL_LID] THEN + DISCH_THEN (ASSUME_TAC o SYM) THEN + DISJ1_TAC THEN + MAP_EVERY EXISTS_TAC [`&0`; `inv t3`] THEN + ASM_SIMP_TAC[REAL_LE_INV; REAL_LE_REFL; VECTOR_MUL_LZERO; VECTOR_ADD_LID]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `&0 < t3 /\ &0 < t4` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[REAL_ARITH `&0 < a <=> &0 <= a /\ ~(a = &0)`]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `~(t2 * t3 - t1 * t4 = &0)` ASSUME_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `a - b = &0 <=> a = b`] THEN + ASM_CASES_TAC `t1 < &0` THENL + [ + DISCH_TAC THEN + REMOVE_THEN "w" (MP_TAC o AP_TERM `(\x:real^N. t1 % x)`) THEN + ASM_REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; REAL_MUL_AC] THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ONCE_REWRITE_TAC[REAL_MUL_AC] THEN + ONCE_REWRITE_TAC[GSYM VECTOR_MUL_ASSOC] THEN + ONCE_REWRITE_TAC[GSYM VECTOR_ADD_LDISTRIB] THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + SUBGOAL_THEN `t2 < &0` ASSUME_TAC THENL + [ + UNDISCH_TAC `t1 < &0 \/ t2 < &0` THEN + POP_ASSUM MP_TAC THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + + DISCH_TAC THEN + REMOVE_THEN "w" (MP_TAC o AP_TERM `(\x:real^N. t2 % x)`) THEN + ASM_REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC; REAL_MUL_AC] THEN + ONCE_REWRITE_TAC[REAL_MUL_AC] THEN + ONCE_REWRITE_TAC[GSYM VECTOR_MUL_ASSOC] THEN + ASM_REWRITE_TAC[GSYM VECTOR_ADD_LDISTRIB] THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + ABBREV_TAC `d:real = t2 * t3 - t1 * t4` THEN + SUBGOAL_THEN `v2:real^N = inv(d) % (t3 % v + (--t1) % w)` ASSUME_TAC THENL + [ + MATCH_MP_TAC VECTOR_MUL_LCANCEL_IMP THEN + EXISTS_TAC `d:real` THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_RINV; VECTOR_MUL_LID] THEN + REMOVE_THEN "w" (MP_TAC o AP_TERM `\w:real^N. (--t1) % w`) THEN + REMOVE_THEN "v" (MP_TAC o AP_TERM `\v:real^N. t3 % v`) THEN + BETA_TAC THEN EXPAND_TAC "d" THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + SUBGOAL_THEN `v1:real^N = --inv(d) % (t4 % v + (--t2) % w)` ASSUME_TAC THENL + [ + MATCH_MP_TAC VECTOR_MUL_LCANCEL_IMP THEN + EXISTS_TAC `d:real` THEN + ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_RNEG; REAL_MUL_RINV] THEN + REMOVE_THEN "w" (MP_TAC o AP_TERM `\w:real^N. t2 % w`) THEN + REMOVE_THEN "v" (MP_TAC o AP_TERM `\v:real^N. t4 % v`) THEN + BETA_TAC THEN EXPAND_TAC "d" THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + ASM_CASES_TAC `t1 < &0` THENL + [ + ASM_CASES_TAC `t2 < &0` THENL + [ + ASM_CASES_TAC `d < &0` THENL + [ + DISJ1_TAC THEN + MAP_EVERY EXISTS_TAC [`(--inv d) * t4`; `(--inv d) * (--t2)`] THEN + ASM_REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC] THEN + REWRITE_TAC[GSYM REAL_INV_NEG] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_MUL THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_INV THEN + ASM_SIMP_TAC[REAL_NEG_GE0; REAL_LT_IMP_LE]; + ASM_SIMP_TAC[REAL_NEG_GE0; REAL_LT_IMP_LE] THEN + MATCH_MP_TAC REAL_LE_INV THEN + ASM_SIMP_TAC[REAL_NEG_GE0; REAL_LT_IMP_LE] + ]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_NOT_LT] THEN DISCH_TAC THEN + DISJ2_TAC THEN + MAP_EVERY EXISTS_TAC [`inv d * t3`; `inv d * (--t1)`] THEN + ASM_REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_SIMP_TAC[REAL_NEG_GE0; REAL_LT_IMP_LE] THEN MATCH_MP_TAC REAL_LE_INV THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_NOT_LT] THEN DISCH_TAC THEN + SUBGOAL_THEN `&0 <= inv d` ASSUME_TAC THENL + [ + EXPAND_TAC "d" THEN + MATCH_MP_TAC REAL_LE_INV THEN + REWRITE_TAC[REAL_ARITH `a - t1 * t4 = a + (--t1) * t4`] THEN + MATCH_MP_TAC REAL_LE_ADD THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_SIMP_TAC[REAL_NEG_GE0; REAL_LT_IMP_LE]; + ALL_TAC + ] THEN + + DISJ2_TAC THEN + MAP_EVERY EXISTS_TAC [`inv d * t3`; `inv d * (--t1)`] THEN + ASM_REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_SIMP_TAC[REAL_NEG_GE0; REAL_LT_IMP_LE]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `&0 <= t1 /\ t2 < &0` ASSUME_TAC THENL + [ + UNDISCH_TAC `t1 < &0 \/ t2 < &0` THEN + ASM_REWRITE_TAC[GSYM REAL_NOT_LT]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `&0 <= --inv d` ASSUME_TAC THENL + [ + REWRITE_TAC[GSYM REAL_INV_NEG] THEN + EXPAND_TAC "d" THEN + MATCH_MP_TAC REAL_LE_INV THEN + REWRITE_TAC[REAL_ARITH `--(t2 * t3 - t1 * t4) = (--t2) * t3 + t1 * t4`] THEN + MATCH_MP_TAC REAL_LE_ADD THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_SIMP_TAC[REAL_NEG_GE0; REAL_LT_IMP_LE]; + ALL_TAC + ] THEN + + DISJ1_TAC THEN + MAP_EVERY EXISTS_TAC [`--inv d * t4`; `--inv d * (--t2)`] THEN + ASM_REWRITE_TAC[VECTOR_ADD_LDISTRIB; VECTOR_MUL_ASSOC] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_SIMP_TAC[REAL_NEG_GE0; REAL_LT_IMP_LE]);; + + + +let segment_intersects_aff_ge_lemma = prove(`!v1 v2 v w:real^N. ~collinear {vec 0,v1,v2} /\ ~between (vec 0) (v,w) /\ + v IN affine hull {vec 0,v1,v2} /\ w IN affine hull {vec 0,v1,v2} /\ + ~(segment [v,w] INTER aff_ge {vec 0} {v1,v2} = {}) + ==> v IN aff_ge {vec 0} {v1,v2} \/ + v1 IN aff_ge {vec 0} {v,w} \/ + v2 IN aff_ge {vec 0} {v,w}`, + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + DISCH_THEN (X_CHOOSE_THEN `p:real^N` MP_TAC) THEN + REWRITE_TAC[IN_INTER] THEN DISCH_THEN (CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN DISCH_TAC THEN + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[IN_SEGMENT] THEN STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + ASM_CASES_TAC `u = &0` THENL + [ + ASM_REWRITE_TAC[REAL_SUB_RZERO; VECTOR_MUL_LZERO; VECTOR_MUL_LID; VECTOR_ADD_RID] THEN + DISCH_THEN (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + DISCH_THEN (LABEL_TAC "p" o SYM) THEN + + FIRST_ASSUM (MP_TAC o MATCH_MP zero_not_between) THEN + STRIP_TAC THEN + + MP_TAC (SPECL [`v1:real^N`; `v2:real^N`; `v:real^N`; `p:real^N`] in_aff_ge_cases_lemma) THEN + ASM_REWRITE_TAC[] THEN + + ANTS_TAC THENL + [ + REWRITE_TAC[BETWEEN_IN_SEGMENT] THEN DISCH_TAC THEN + UNDISCH_TAC `~between (vec 0:real^N) (v,w)` THEN + REWRITE_TAC[BETWEEN_IN_SEGMENT] THEN + MATCH_MP_TAC Hypermap.lemma_in_subset THEN + EXISTS_TAC `segment [v,p:real^N]` THEN + ASM_REWRITE_TAC[SUBSET_SEGMENT; ENDS_IN_SEGMENT]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `p IN aff_ge {vec 0:real^N} {v,w}` ASSUME_TAC THENL + [ + MATCH_MP_TAC in_segment_imp_in_aff_ge_0_2 THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + STRIP_TAC THEN ASM_REWRITE_TAC[] THENL + [ + DISJ2_TAC THEN DISJ1_TAC THEN + MATCH_MP_TAC Hypermap.lemma_in_subset THEN + EXISTS_TAC `aff_ge {vec 0} {v:real^N,p}` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC aff_ge_0_2_SUBSET THEN + ASM_REWRITE_TAC[points_in_aff_ge_0_2]; + ALL_TAC + ] THEN + DISJ2_TAC THEN DISJ2_TAC THEN + MATCH_MP_TAC Hypermap.lemma_in_subset THEN + EXISTS_TAC `aff_ge {vec 0} {v:real^N,p}` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC aff_ge_0_2_SUBSET THEN + ASM_REWRITE_TAC[points_in_aff_ge_0_2]);; + + + + +(* The main lemma *) + +let continuous_lemma_aff_ge = prove(`!v1 v2 (f:real^1->real^3) w h. &0 <= h /\ + f continuous_on interval [lift (&0), lift h] /\ + ~(segment [f (lift (&0)), w] INTER aff_ge {vec 0} {v1,v2} = {}) /\ + (!t. t IN interval [lift (&0), lift h] ==> ~between (vec 0) (f t, w)) /\ + ~collinear {vec 0,v1,v2} + ==> (!t. t IN interval [lift (&0), lift h] ==> ~(segment [f t, w] INTER aff_ge {vec 0} {v1,v2} = {})) \/ + (?x. &0 <= x /\ x <= h /\ + (!t. t IN interval [lift (&0), lift x] ==> ~(segment [f t, w] INTER aff_ge {vec 0} {v1,v2} = {})) /\ + (f (lift x) IN aff_ge {vec 0} {v1,v2} \/ v1 IN aff_ge {vec 0} {f (lift x), w} \/ v2 IN aff_ge {vec 0} {f (lift x), w}))`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `!y b. (lift y) IN interval [lift (&0), lift b] <=> &0 <= y /\ y <= b` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[IN_INTERVAL_1]; + ALL_TAC + ] THEN + + (* Aux *) + SUBGOAL_THEN `lift (&0) IN interval [lift (&0), lift h]` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[IN_INTERVAL_1; REAL_LE_REFL]; + ALL_TAC + ] THEN + + (* v1, v2, w != 0 *) + SUBGOAL_THEN `~(v1:real^3 = vec 0) /\ ~(v2:real^3 = vec 0) /\ ~(w:real^3 = vec 0)` ASSUME_TAC THENL + [ + UNDISCH_TAC `~collinear {vec 0,v1,v2:real^3}` THEN + SIMP_TAC[COLLINEAR_LEMMA; DE_MORGAN_THM] THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `lift (&0)`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o MATCH_MP zero_not_between) THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + + (* ~between (vec 0) (f(t), w) expanded *) + SUBGOAL_THEN `!t. &0 <= t /\ t <= h ==> ~(f (lift t) = vec 0) /\ (!u. &0 <= u /\ u <= &1 ==> ~((&1 - u) % f (lift t) + u % w = vec 0:real^3))` (LABEL_TAC "fw") THENL + [ + GEN_TAC THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `lift t`) THEN + ASM_REWRITE_TAC[IN_INTERVAL_1] THEN + DISCH_THEN (MP_TAC o MATCH_MP zero_not_between) THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + + GEN_TAC THEN DISCH_TAC THEN + ASM_CASES_TAC `u = &0` THENL + [ + ASM_REWRITE_TAC[REAL_SUB_RZERO; VECTOR_MUL_LID; VECTOR_MUL_LZERO; VECTOR_ADD_RID]; + ALL_TAC + ] THEN + ASM_CASES_TAC `u = &1` THENL + [ + ASM_REWRITE_TAC[REAL_SUB_REFL; VECTOR_MUL_LZERO; VECTOR_ADD_LID; VECTOR_MUL_LID]; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`--u:real`; `&1 - u`]) THEN + ANTS_TAC THENL + [ + REPLICATE_TAC 3 (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + REWRITE_TAC[VECTOR_ARITH `--u % (w:real^N) = (&1 - u) % x <=> (&1 - u) % x + u % w = vec 0`]; + ALL_TAC + ] THEN + + (* First case *) + ASM_CASES_TAC `!t. t IN interval [lift (&0),lift h] ==> ~(segment [f t,w] INTER aff_ge {vec 0} {v1,v2:real^3} = {})` THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[NOT_FORALL_THM] THEN + REWRITE_TAC[TAUT `~(A ==> ~B) <=> A /\ B`] THEN + DISCH_THEN (X_CHOOSE_THEN `t1:real^1` (LABEL_TAC "A")) THEN + + (* Find a normal vector to the plane of aff_ge {vec 0} {v1,v2} *) + SUBGOAL_THEN `?n:real^3. ~(n = vec 0) /\ v1 dot n = &0 /\ v2 dot n = &0 /\ f (lift (&0)) dot n <= &0` MP_TAC THENL + [ + ASM_CASES_TAC `f (lift (&0)) dot (v1:real^3 cross v2) <= &0` THENL + [ + EXISTS_TAC `v1 cross v2` THEN + ASM_REWRITE_TAC[CROSS_EQ_0; DOT_CROSS_SELF]; + ALL_TAC + ] THEN + EXISTS_TAC `--(v1 cross v2)` THEN + ASM_REWRITE_TAC[VECTOR_NEG_EQ_0; CROSS_EQ_0; DOT_RNEG; DOT_CROSS_SELF] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + STRIP_TAC THEN + + (* Aux *) + SUBGOAL_THEN `!p. p IN aff_ge {vec 0} {v1,v2:real^3} ==> p dot n = &0` ASSUME_TAC THENL + [ + GEN_TAC THEN ASM_SIMP_TAC[aff_ge_0_2; IN_ELIM_THM] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[DOT_LADD; DOT_LMUL; REAL_MUL_RZERO; REAL_ADD_LID]; + ALL_TAC + ] THEN + + (* Need for the next two cases *) + UNDISCH_TAC `~(segment [f (lift (&0)), w] INTER aff_ge {vec 0:real^3} {v1,v2} = {})` THEN DISCH_TAC THEN + FIRST_ASSUM MP_TAC THEN REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + DISCH_THEN (X_CHOOSE_THEN `p:real^3` (LABEL_TAC "B")) THEN + FIRST_ASSUM (MP_TAC o REWRITE_RULE [IN_INTER; IN_SEGMENT]) THEN + DISCH_THEN (CONJUNCTS_THEN2 (X_CHOOSE_THEN `up:real` MP_TAC) ASSUME_TAC) THEN + GEN_REWRITE_TAC LAND_CONV [CONJ_ASSOC] THEN + DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC (LABEL_TAC "p1" o SYM)) THEN + FIRST_ASSUM (MP_TAC o SPEC `p:real^3`) THEN + FIRST_ASSUM (fun th -> CHANGED_TAC (REWRITE_TAC[th])) THEN DISCH_TAC THEN + + (* w dot n < 0 *) + DISJ_CASES_TAC (REAL_ARITH `w:real^3 dot n < &0 \/ w dot n = &0 \/ &0 < w dot n`) THENL + [ + SUBGOAL_THEN `up = &0` ASSUME_TAC THENL + [ + REMOVE_THEN "p1" (MP_TAC o AP_TERM `\v:real^3. v dot n`) THEN + ASM_REWRITE_TAC[DOT_LADD; DOT_LMUL; REAL_MUL_RZERO; REAL_ADD_LID] THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + DISCH_TAC THEN + MATCH_MP_TAC (REAL_ARITH `&0 < --a ==> ~(a = &0)`) THEN + REWRITE_TAC[REAL_ARITH `--(a * b + c * d) = a * (--b) + c * (--d)`] THEN + MATCH_MP_TAC REAL_LET_ADD THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 <= &1 - up <=> up <= &1`; REAL_NEG_GE0]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LT_MUL THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < up <=> &0 <= up /\ ~(up = &0)`; REAL_NEG_GT0]; + ALL_TAC + ] THEN + + REMOVE_THEN "p1" MP_TAC THEN + ASM_REWRITE_TAC[REAL_SUB_RZERO; VECTOR_MUL_LZERO; VECTOR_ADD_RID; VECTOR_MUL_LID] THEN + DISCH_TAC THEN + EXISTS_TAC `&0` THEN + ASM_REWRITE_TAC[REAL_LE_REFL; REAL_LE_01; INTERVAL_SING; IN_SING] THEN + GEN_TAC THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + EXISTS_TAC `p:real^3` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + (* w dot n = 0 *) + FIRST_X_ASSUM DISJ_CASES_TAC THENL + [ + ASM_CASES_TAC `w:real^3 IN aff_ge {vec 0} {v1,v2}` THENL + [ + SUBGOAL_THEN `~(segment [f (t1:real^1),w] INTER aff_ge {vec 0} {v1,v2:real^3} = {})` MP_TAC THENL + [ + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + EXISTS_TAC `w:real^3` THEN + REWRITE_TAC[IN_INTER; ENDS_IN_SEGMENT] THEN POP_ASSUM (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + EXISTS_TAC `&0` THEN + ASM_REWRITE_TAC[REAL_LE_REFL; INTERVAL_SING; IN_SING] THEN + CONJ_TAC THENL + [ + GEN_TAC THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + EXISTS_TAC `p:real^3` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC segment_intersects_aff_ge_lemma THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `lift (&0)`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + + ASM_SIMP_TAC[affine_hull_3_plane] THEN + ASM_REWRITE_TAC[IN_ELIM_THM] THEN + SUBGOAL_THEN `~(up = &1)` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN REWRITE_TAC[CONTRAPOS_THM] THEN DISCH_TAC THEN + REMOVE_THEN "p1" MP_TAC THEN ASM_REWRITE_TAC[REAL_SUB_REFL; VECTOR_MUL_LID; VECTOR_MUL_LZERO; VECTOR_ADD_LID] THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + REMOVE_THEN "p1" (MP_TAC o AP_TERM `\v:real^3. v dot n`) THEN + ASM_REWRITE_TAC[DOT_LADD; DOT_LMUL; REAL_MUL_RZERO] THEN + POP_ASSUM MP_TAC THEN CONV_TAC REAL_FIELD; + ALL_TAC + ] THEN + + (* Remove unnessary assumptions before considering the last case *) + POP_ASSUM MP_TAC THEN REPLICATE_TAC 5 REMOVE_ASSUM THEN DISCH_TAC THEN + + (* w dot n > 0 *) + + (* Consider two major cases: f(t) intersects affine hull {vec 0,v1,v2} at some point or not *) + SUBGOAL_THEN `?r. &0 <= r /\ r <= h /\ + (!t. &0 <= t /\ t <= r ==> f (lift t) dot (n:real^3) <= &0) /\ + (((!t. &0 <= t /\ t <= r ==> ~(segment [f (lift t), w] INTER aff_ge {vec 0} {v1,v2} = {})) /\ f (lift r) IN aff_ge {vec 0} {v1, v2}) \/ + (?t1. &0 <= t1 /\ t1 <= r /\ segment [f (lift t1), w] INTER aff_ge {vec 0} {v1,v2} = {}))` MP_TAC THENL + [ + ASM_CASES_TAC `!t. &0 <= t /\ t <= h ==> f (lift t) dot (n:real^3) <= &0` THENL + [ + EXISTS_TAC `h:real` THEN + ASM_REWRITE_TAC[REAL_LE_REFL] THEN + DISJ2_TAC THEN + EXISTS_TAC `drop (t1:real^1)` THEN + ASM_REWRITE_TAC[LIFT_DROP] THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`drop (t1:real^1)`; `h:real`]) THEN + ASM_REWRITE_TAC[LIFT_DROP]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN REWRITE_TAC[NOT_FORALL_THM] THEN + DISCH_THEN (X_CHOOSE_THEN `tt:real` MP_TAC) THEN + REWRITE_TAC[TAUT `~(A ==> B) <=> A /\ ~B`; REAL_NOT_LE] THEN + DISCH_TAC THEN + MP_TAC (SPECL [`\t:real. f (lift t) dot n:real^3`; `&0`; `tt:real`] continuous_lemma_inc) THEN + ANTS_TAC THENL + [ + ASM_SIMP_TAC[REAL_LT_IMP_LE] THEN + REWRITE_TAC[REAL_CONTINUOUS_ON] THEN + SUBGOAL_THEN `lift o (\t:real. f (lift t) dot n:real^3) o drop = (lift o (\y:real^3. n dot y)) o f` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[FUN_EQ_THM; o_THM; LIFT_DROP; DOT_SYM]; + ALL_TAC + ] THEN + MATCH_MP_TAC CONTINUOUS_ON_COMPOSE THEN + REWRITE_TAC[IMAGE_LIFT_REAL_INTERVAL; CONTINUOUS_ON_LIFT_DOT] THEN + MATCH_MP_TAC CONTINUOUS_ON_SUBSET THEN + EXISTS_TAC `interval [lift (&0), lift (h)]` THEN + ASM_REWRITE_TAC[SUBSET_INTERVAL_1; LIFT_DROP; REAL_LE_REFL]; + ALL_TAC + ] THEN + BETA_TAC THEN STRIP_TAC THEN + EXISTS_TAC `x:real` THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `tt:real` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + CONJ_TAC THENL + [ + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `t = x:real` THENL [ ASM_SIMP_TAC[REAL_ARITH `a = &0 ==> a <= &0`]; ALL_TAC ] THEN + MATCH_MP_TAC REAL_LT_IMP_LE THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[REAL_LT_LE]; + ALL_TAC + ] THEN + + ASM_CASES_TAC `?t1. &0 <= t1 /\ t1 <= x /\ segment [f (lift t1),w:real^3] INTER aff_ge {vec 0} {v1,v2} = {}` THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[NOT_EXISTS_THM; DE_MORGAN_THM] THEN + DISCH_TAC THEN + SUBGOAL_THEN `!t. &0 <= t /\ t <= x ==> ~(segment [f (lift t),w:real^3] INTER aff_ge {vec 0} {v1,v2} = {})` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `t:real`) THEN + ASM_REWRITE_TAC[DE_MORGAN_THM]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:real`) THEN + ASM_REWRITE_TAC[REAL_LE_REFL; GSYM MEMBER_NOT_EMPTY] THEN + DISCH_THEN (X_CHOOSE_THEN `p:real^3` MP_TAC) THEN + REWRITE_TAC[IN_INTER; IN_SEGMENT] THEN + STRIP_TAC THEN + UNDISCH_TAC `p = (&1 - u) % f (lift x) + u % w:real^3` THEN DISCH_THEN (LABEL_TAC "p1" o SYM) THEN + FIRST_ASSUM (MP_TAC o AP_TERM `\v:real^3. v dot n`) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `p:real^3`) THEN + ASM_REWRITE_TAC[DOT_LADD; DOT_LMUL; REAL_MUL_RZERO; REAL_ADD_LID] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[REAL_ENTIRE] THEN + ASM_SIMP_TAC[REAL_ARITH `&0 < w dot n ==> ~(w:real^3 dot n = &0)`] THEN + DISCH_TAC THEN + REMOVE_THEN "p1" MP_TAC THEN + ASM_SIMP_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID; REAL_SUB_RZERO; VECTOR_MUL_LID]; + ALL_TAC + ] THEN + + + (* Deal with two possible cases *) + STRIP_TAC THENL + [ + EXISTS_TAC `r:real` THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `drop (t:real^1)`) THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`drop (t:real^1)`; `r:real`]) THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[LIFT_DROP; MEMBER_NOT_EMPTY]; + ALL_TAC + ] THEN + + (* The main case *) + MP_TAC (SPECL [`v1:real^3`; `v2:real^3`; `n:real^3`; `f:real^1->real^3`; `w:real^3`; `r:real`] continuous_intersection_point) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC CONTINUOUS_ON_SUBSET THEN + EXISTS_TAC `interval [lift (&0), lift h]` THEN + ASM_REWRITE_TAC[SUBSET_INTERVAL_1; LIFT_DROP; REAL_LE_REFL]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + + (* Aux *) + SUBGOAL_THEN `!t. &0 <= t /\ t <= r ==> a t % v1 + b t % v2:real^3 IN segment [f (lift t),w] INTER affine hull {vec 0,v1,v2}` (LABEL_TAC "a1") THENL + [ + REPEAT STRIP_TAC THEN FIRST_X_ASSUM (MP_TAC o SPEC `t:real`) THEN + ASM_REWRITE_TAC[EXTENSION; IN_SING; IN_INTER] THEN + DISCH_THEN (MP_TAC o SPEC `a (t:real) % v1 + b t % v2:real^3`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + (* Aux *) + SUBGOAL_THEN `!t. &0 <= t /\ t <= r ==> ?u. &0 <= u /\ u <= &1 /\ a t % v1 + b t % v2 = (&1 - u) % f (lift t) + u % w:real^3` (LABEL_TAC "a2") THENL + [ + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `t:real`) THEN + ASM_REWRITE_TAC[IN_INTER; IN_SEGMENT] THEN + STRIP_TAC THEN + EXISTS_TAC `u:real` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + (* Aux *) + SUBGOAL_THEN `!t. &0 <= t /\ t <= r /\ &0 <= a t /\ &0 <= b t ==> (?x. x IN segment [f (lift t),w:real^3] INTER aff_ge {vec 0} {v1,v2})` (LABEL_TAC "a3") THENL + [ + REPEAT STRIP_TAC THEN + EXISTS_TAC `a (t:real) % (v1:real^3) + b t % v2` THEN + REWRITE_TAC[IN_INTER] THEN + REMOVE_THEN "a1" (MP_TAC o SPEC `t:real`) THEN + ASM_SIMP_TAC[IN_INTER] THEN DISCH_TAC THEN + ASM_SIMP_TAC[aff_ge_0_2; IN_ELIM_THM] THEN + MAP_EVERY EXISTS_TAC [`(a:real->real) t`; `(b:real->real) t`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + (* Aux *) + SUBGOAL_THEN `!t. &0 <= t /\ t <= r /\ ~(segment [f (lift t),w] INTER aff_ge {vec 0:real^3} {v1,v2} = {}) ==> &0 <= a t /\ &0 <= b t` (LABEL_TAC "a4") THENL + [ + GEN_TAC THEN DISCH_THEN STRIP_ASSUME_TAC THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM MEMBER_NOT_EMPTY; IN_INTER] THEN + STRIP_TAC THEN + SUBGOAL_THEN `x:real^3 IN segment [f (lift t),w] INTER affine hull {vec 0,v1,v2}` MP_TAC THENL + [ + ASM_REWRITE_TAC[IN_INTER] THEN + MATCH_MP_TAC Hypermap.lemma_in_subset THEN + EXISTS_TAC `aff_ge {vec 0:real^3} {v1,v2}` THEN + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[SET_RULE `{vec 0:real^3,v1,v2} = {vec 0} UNION {v1,v2}`] THEN + REWRITE_TAC[AFF_GE_SUBSET_AFFINE_HULL]; + ALL_TAC + ] THEN + DISCH_TAC THEN FIRST_ASSUM MP_TAC THEN + FIRST_ASSUM (ASSUME_TAC o REWRITE_RULE[IN_INTER]) THEN + MP_TAC (ISPECL [`v1:real^3`; `v2:real^3`; `x:real^3`] in_affine_hull_lemma) THEN + ASM_REWRITE_TAC[] THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + + MAP_EVERY (fun s -> REMOVE_THEN s (fun th -> ALL_TAC)) ["a1"; "a2"; "a3"] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `t:real`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[IN_SING] THEN + DISCH_THEN (LABEL_TAC "x1" o SYM) THEN + STRIP_TAC THEN + FIRST_X_ASSUM (LABEL_TAC "x2" o SYM o check (is_eq o concl)) THEN + UNDISCH_TAC `x IN aff_ge {vec 0} {v1,v2:real^3}` THEN + MP_TAC (ISPECL [`v1:real^3`; `v2:real^3`] aff_ge_0_2) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (fun th -> REWRITE_TAC[th; IN_ELIM_THM]) THEN + STRIP_TAC THEN + SUBGOAL_THEN `a (t:real) = t1'':real /\ b (t:real) = t2:real` MP_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + REMOVE_THEN "x1" (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + SUBGOAL_THEN `t1''' = t1'':real /\ t2' = t2:real` MP_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + (* Aux *) + SUBGOAL_THEN `&0 <= a (&0) /\ &0 <= b (&0)` (LABEL_TAC "a5") THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[REAL_LE_REFL; REAL_LE_01]; + ALL_TAC + ] THEN + + + (* Cases for a(t) and b(t) *) + SUBGOAL_THEN `?x. &0 <= x /\ x <= r /\ (!t. &0 <= t /\ t <= x ==> &0 <= a t /\ &0 <= b t) /\ (a x = &0 \/ b x = &0)` MP_TAC THENL + [ + (* 0 <= a(t) for all t *) + ASM_CASES_TAC `!t. &0 <= t /\ t <= r ==> &0 <= a t` THENL + [ + MP_TAC (SPECL [`b:real->real`; `&0`; `t1':real`] continuous_lemma_dec) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL + [ + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_CONTINUOUS_ON_SUBSET THEN + EXISTS_TAC `real_interval [&0,r]` THEN + ASM_REWRITE_TAC[SUBSET_REAL_INTERVAL; REAL_LE_REFL]; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o check (is_eq o concl)) THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[REAL_NOT_LE; GSYM MEMBER_NOT_EMPTY] THEN + DISCH_TAC THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE]; + ALL_TAC + ] THEN + STRIP_TAC THEN + + EXISTS_TAC `x:real` THEN + SUBGOAL_THEN `x <= r` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `t1':real` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + GEN_TAC THEN DISCH_TAC THEN + CONJ_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `x:real` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_CASES_TAC `t = x:real` THEN ASM_REWRITE_TAC[REAL_LE_REFL] THEN + MATCH_MP_TAC REAL_LT_IMP_LE THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[REAL_ARITH `t < x <=> t <= x /\ ~(t = x)`]; + ALL_TAC + ] THEN + + (* a(ta) < 0 *) + POP_ASSUM MP_TAC THEN + REWRITE_TAC[NOT_FORALL_THM; TAUT `~(A ==> B) <=> A /\ ~B`; REAL_NOT_LE] THEN + DISCH_THEN (X_CHOOSE_THEN `ta:real` ASSUME_TAC) THEN + + MP_TAC (SPECL [`a:real->real`; `&0`; `ta:real`] continuous_lemma_dec) THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE] THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC REAL_CONTINUOUS_ON_SUBSET THEN + EXISTS_TAC `real_interval [&0,r]` THEN + ASM_REWRITE_TAC[SUBSET_REAL_INTERVAL; REAL_LE_REFL]; + ALL_TAC + ] THEN + DISCH_THEN (X_CHOOSE_THEN `xa:real` MP_TAC) THEN + STRIP_TAC THEN + SUBGOAL_THEN `!t. &0 <= t /\ t <= xa ==> &0 <= a t` MP_TAC THENL + [ + GEN_TAC THEN DISCH_TAC THEN + ASM_CASES_TAC `t = xa:real` THEN ASM_REWRITE_TAC[REAL_LE_REFL] THEN + MATCH_MP_TAC REAL_LT_IMP_LE THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[REAL_ARITH `t < xa <=> t <= xa /\ ~(t = xa)`]; + ALL_TAC + ] THEN + REMOVE_ASSUM THEN DISCH_TAC THEN + + (* 0 <= b(t) for all t *) + ASM_CASES_TAC `!t. &0 <= t /\ t <= r ==> &0 <= b t` THENL + [ + EXISTS_TAC `xa:real` THEN + SUBGOAL_THEN `xa <= r` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `ta:real` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + GEN_TAC THEN DISCH_TAC THEN + CONJ_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `xa:real` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + (* b(tb) < 0 *) + POP_ASSUM MP_TAC THEN + REWRITE_TAC[NOT_FORALL_THM; TAUT `~(A ==> B) <=> A /\ ~B`; REAL_NOT_LE] THEN + DISCH_THEN (X_CHOOSE_THEN `tb:real` ASSUME_TAC) THEN + + MP_TAC (SPECL [`b:real->real`; `&0`; `tb:real`] continuous_lemma_dec) THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE] THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC REAL_CONTINUOUS_ON_SUBSET THEN + EXISTS_TAC `real_interval [&0,r]` THEN + ASM_REWRITE_TAC[SUBSET_REAL_INTERVAL; REAL_LE_REFL]; + ALL_TAC + ] THEN + DISCH_THEN (X_CHOOSE_THEN `xb:real` MP_TAC) THEN + STRIP_TAC THEN + SUBGOAL_THEN `!t. &0 <= t /\ t <= xb ==> &0 <= b t` MP_TAC THENL + [ + GEN_TAC THEN DISCH_TAC THEN + ASM_CASES_TAC `t = xb:real` THEN ASM_REWRITE_TAC[REAL_LE_REFL] THEN + MATCH_MP_TAC REAL_LT_IMP_LE THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[REAL_ARITH `t < xa <=> t <= xa /\ ~(t = xa)`]; + ALL_TAC + ] THEN + REMOVE_ASSUM THEN DISCH_TAC THEN + + EXISTS_TAC `min xa xb` THEN + ASM_REWRITE_TAC[REAL_LE_MIN] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `xa:real` THEN + REWRITE_TAC[REAL_MIN_MIN] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `ta:real` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + CONJ_TAC THENL + [ + GEN_TAC THEN DISCH_TAC THEN + CONJ_TAC THEN FIRST_X_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[real_min] THEN + COND_CASES_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + (* The final stage *) + DISCH_THEN (CHOOSE_THEN MP_TAC) THEN + ONCE_REWRITE_TAC[TAUT `A /\ B /\ C /\ D <=> (A /\ B) /\ C /\ D`] THEN + DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC MP_TAC) THEN + DISCH_THEN (CONJUNCTS_THEN ASSUME_TAC) THEN + + EXISTS_TAC `x:real` THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `r:real` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + CONJ_TAC THENL + [ + GEN_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`drop (t:real^1)`; `x:real`]) THEN + REWRITE_TAC[LIFT_DROP] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_TAC THEN + REMOVE_THEN "a3" (MP_TAC o SPEC `drop (t:real^1)`) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL [ MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `x:real` THEN ASM_REWRITE_TAC[]; ALL_TAC ] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + SIMP_TAC[LIFT_DROP]; + ALL_TAC + ] THEN + + (* The final case split: a x = 0 or b x = 0 *) + POP_ASSUM DISJ_CASES_TAC THENL + [ + DISJ2_TAC THEN DISJ2_TAC THEN + REMOVE_THEN "fw" (MP_TAC o SPEC `x:real`) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `r:real` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + STRIP_TAC THEN + ASM_SIMP_TAC[aff_ge_0_2; IN_ELIM_THM] THEN + REMOVE_THEN "a2" (MP_TAC o SPEC `x:real`) THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID] THEN + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + ASM_CASES_TAC `b (x:real) = &0` THENL [ ASM_SIMP_TAC[VECTOR_MUL_LZERO]; ALL_TAC ] THEN + DISCH_THEN (MP_TAC o AP_TERM `\v:real^3. inv ((b:real->real) x) % v`) THEN + REWRITE_TAC[VECTOR_MUL_ASSOC; VECTOR_ADD_LDISTRIB] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; VECTOR_MUL_LID] THEN + DISCH_TAC THEN + MAP_EVERY EXISTS_TAC [`inv (b (x:real)) * (&1 - u)`; `inv (b (x:real)) * u`] THEN + REWRITE_TAC[] THEN + SUBGOAL_THEN `&0 <= inv (b (x:real))` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LE_INV THEN + REPLICATE_TAC 2 (FIRST_X_ASSUM (MP_TAC o SPEC `x:real`)) THEN + ASM_SIMP_TAC[REAL_LE_REFL]; + ALL_TAC + ] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_MUL THEN CONJ_TAC THEN ASM_REWRITE_TAC[REAL_ARITH `&0 <= &1 - u <=> u <= &1`]; + ALL_TAC + ] THEN + + DISJ2_TAC THEN DISJ1_TAC THEN + REMOVE_THEN "fw" (MP_TAC o SPEC `x:real`) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `r:real` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + STRIP_TAC THEN + ASM_SIMP_TAC[aff_ge_0_2; IN_ELIM_THM] THEN + REMOVE_THEN "a2" (MP_TAC o SPEC `x:real`) THEN + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_RID] THEN + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + ASM_CASES_TAC `a (x:real) = &0` THENL [ ASM_SIMP_TAC[VECTOR_MUL_LZERO]; ALL_TAC ] THEN + DISCH_THEN (MP_TAC o AP_TERM `\v:real^3. inv ((a:real->real) x) % v`) THEN + REWRITE_TAC[VECTOR_MUL_ASSOC; VECTOR_ADD_LDISTRIB] THEN + ASM_SIMP_TAC[REAL_MUL_LINV; VECTOR_MUL_LID] THEN + DISCH_TAC THEN + MAP_EVERY EXISTS_TAC [`inv (a (x:real)) * (&1 - u)`; `inv (a (x:real)) * u`] THEN + REWRITE_TAC[] THEN + SUBGOAL_THEN `&0 <= inv (a (x:real))` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LE_INV THEN + REPLICATE_TAC 2 (FIRST_X_ASSUM (MP_TAC o SPEC `x:real`)) THEN + ASM_SIMP_TAC[REAL_LE_REFL]; + ALL_TAC + ] THEN + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_MUL THEN CONJ_TAC THEN ASM_REWRITE_TAC[REAL_ARITH `&0 <= &1 - u <=> u <= &1`] +);; + + + + +(* v1 and v3 in a 4-point configuration are separated by the plane affine hull {0,v2,v4} *) + +let separation_plane_4_points = prove(`!v1 v2 v3 v4:real^3. v1 IN ball_annulus /\ v2 IN ball_annulus /\ v3 IN ball_annulus /\ v4 IN ball_annulus /\ + dist (v2, v4) <= &2 * h0 /\ dist (v1, v3) <= &2 * h0 /\ &2 <= dist (v2, v4) /\ + &2 <= dist (v1, v2) /\ &2 <= dist (v1, v4) /\ + &2 <= dist (v2, v3) /\ &2 <= dist (v3, v4) /\ + ~(segment [v1, v3] INTER aff_ge {vec 0} {v2, v4} = {}) + ==> ?n. ~(n = vec 0) /\ v2 dot n = &0 /\ v4 dot n = &0 /\ + v1 dot n < &0 /\ &0 < v3 dot n`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `~(v1 = vec 0:real^3) /\ ~(v2 = vec 0:real^3) /\ ~(v3 = vec 0:real^3) /\ ~(v4 = vec 0:real^3)` ASSUME_TAC THENL + [ + REPEAT (FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl))) THEN + SIMP_TAC[in_ball_annulus]; + ALL_TAC + ] THEN + SUBGOAL_THEN `~collinear {vec 0, v2, v4:real^3}` ASSUME_TAC THENL + [ + ASM_SIMP_TAC[estd_non_collinear_lemma]; + ALL_TAC + ] THEN + SUBGOAL_THEN `~between (vec 0) (v1:real^3,v3)` ASSUME_TAC THENL + [ + ASM_SIMP_TAC[zero_not_between_estd]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `?n:real^3. ~(n = vec 0) /\ v2 dot n = &0 /\ v4 dot n = &0 /\ v1 dot n <= &0` MP_TAC THENL + [ + ASM_CASES_TAC `v1 dot (v2 cross v4) <= &0` THENL + [ + EXISTS_TAC `v2 cross v4` THEN + ASM_REWRITE_TAC[CROSS_EQ_0; DOT_CROSS_SELF]; + ALL_TAC + ] THEN + EXISTS_TAC `--(v2 cross v4)` THEN + ASM_REWRITE_TAC[VECTOR_NEG_EQ_0; CROSS_EQ_0; DOT_RNEG; DOT_CROSS_SELF] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + STRIP_TAC THEN + + EXISTS_TAC `n:real^3` THEN + SUBGOAL_THEN `~(v1 IN aff_ge {vec 0:real^3} {v2, v4}) /\ ~(v3 IN aff_ge {vec 0} {v2, v4})` ASSUME_TAC THENL + [ + CONJ_TAC THEN DISCH_TAC THEN MATCH_MP_TAC LEMMA_3_POINTS_FINAL THENL + [ + MAP_EVERY EXISTS_TAC [`v2:real^3`; `v4:real^3`; `v1:real^3`]; + MAP_EVERY EXISTS_TAC [`v2:real^3`; `v4:real^3`; `v3:real^3`] + ] THEN + ASM_REWRITE_TAC[DIST_SYM]; + ALL_TAC + ] THEN + SUBGOAL_THEN `~(v2 IN aff_ge {vec 0:real^3} {v1, v3}) /\ ~(v4 IN aff_ge {vec 0:real^3} {v1, v3})` ASSUME_TAC THENL + [ + CONJ_TAC THEN DISCH_TAC THEN MATCH_MP_TAC LEMMA_3_POINTS_FINAL THENL + [ + MAP_EVERY EXISTS_TAC [`v1:real^3`; `v3:real^3`; `v2:real^3`]; + MAP_EVERY EXISTS_TAC [`v1:real^3`; `v3:real^3`; `v4:real^3`] + ] THEN + ASM_REWRITE_TAC[DIST_SYM]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + ASM_CASES_TAC `v1 dot n:real^3 = &0` THENL + [ + ASM_CASES_TAC `v3 dot n:real^3 = &0` THENL + [ + MP_TAC (ISPECL [`v2:real^3`; `v4:real^3`; `v1:real^3`; `v3:real^3`] segment_intersects_aff_ge_lemma) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[affine_hull_3_plane; IN_ELIM_THM]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MP_TAC (ISPECL [`v2:real^3`; `v4:real^3`; `v1:real^3`; `v3:real^3`; `n:real^3`] segment_inter_aff_ge_ends) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + CONJ_TAC THENL [ ASM_REWRITE_TAC[REAL_LT_LE]; ALL_TAC ] THEN + DISJ_CASES_TAC (REAL_ARITH `v3 dot n:real^3 < &0 \/ v3 dot n = &0 \/ &0 < v3 dot n`) THENL + [ + UNDISCH_TAC `~(segment [v1:real^3,v3] INTER aff_ge {vec 0} {v2,v4} = {})` THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + REWRITE_TAC[IN_INTER; IN_SEGMENT] THEN + ASM_SIMP_TAC[aff_ge_0_2; IN_ELIM_THM] THEN + STRIP_TAC THEN + POP_ASSUM (MP_TAC o AP_TERM `\v:real^3. v dot n`) THEN + ASM_REWRITE_TAC[DOT_LADD; DOT_LMUL; REAL_MUL_RZERO; REAL_ADD_LID] THEN + ASM_CASES_TAC `u = &0` THEN ASM_REWRITE_TAC[] THENL + [ + ASM_REWRITE_TAC[REAL_SUB_RZERO; REAL_MUL_LZERO; REAL_MUL_LID; REAL_ADD_RID]; + ALL_TAC + ] THEN + SUBGOAL_THEN `(&1 - u) * (v1 dot n:real^3) + u * (v3 dot n) < &0` MP_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `(&1 - u) * a + u * b < &0 <=> &0 < u * --b + (&1 - u) * --a`] THEN + MATCH_MP_TAC REAL_LTE_ADD THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LT_MUL THEN + ASM_REWRITE_TAC[REAL_NEG_GT0; REAL_LT_LE]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[REAL_NEG_GE0; REAL_LT_LE] THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 <= &1 - u <=> u <= &1`]; + ALL_TAC + ] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + POP_ASSUM DISJ_CASES_TAC THENL + [ + MP_TAC (ISPECL [`v2:real^3`; `v4:real^3`; `v3:real^3`; `v1:real^3`; `n:real^3`] segment_inter_aff_ge_ends) THEN + ASM_REWRITE_TAC[SEGMENT_SYM]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]);; + + + + + +(************************************************************************************) + + + +(* The first rotation lemma for a 4-point configuration *) +let lemma_4_points_rotation1 = prove(`!v1 v2 v3 v4. v1 IN ball_annulus /\ v2 IN ball_annulus /\ v3 IN ball_annulus /\ v4 IN ball_annulus /\ + dist (v1, v3) <= &2 * h0 /\ dist (v2, v4) <= &2 * h0 /\ + &2 <= dist (v1, v2) /\ &2 <= dist (v1, v4) /\ + &2 <= dist (v2, v3) /\ &2 <= dist (v3, v4) /\ + &2 <= dist (v2, v4) /\ + ~(segment [v1, v3] INTER aff_ge {vec 0} {v2, v4} = {}) + ==> (?v1'. v1' IN ball_annulus /\ norm v1' = norm v1 /\ + dist (v1', v3) <= &2 * h0 /\ + dist (v1', v2) = dist (v1, v2) /\ dist (v1', v4) = &2 /\ + ~(segment [v1',v3] INTER aff_ge {vec 0} {v2,v4} = {}))`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `~collinear {vec 0, v2, v4:real^3}` ASSUME_TAC THENL + [ + MATCH_MP_TAC estd_non_collinear_lemma THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `~(v1 = vec 0:real^3) /\ ~(v2 = vec 0:real^3) /\ ~(v3 = vec 0:real^3) /\ ~(v4 = vec 0:real^3)` ASSUME_TAC THENL + [ + REPEAT (FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl))) THEN + SIMP_TAC[in_ball_annulus]; + ALL_TAC + ] THEN + + MP_TAC (SPEC_ALL separation_plane_4_points) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + + MP_TAC (ISPECL [`v2:real^3`; `v1:real^3`; `v3:real^3`] rotation_about_axis) THEN + ASM_REWRITE_TAC[DIMINDEX_3; LE_REFL; projection] THEN + ANTS_TAC THENL + [ + CONJ_TAC THEN DISCH_THEN (MP_TAC o AP_TERM `\x:real^3. x dot n`) THEN ASM_REWRITE_TAC[DOT_LSUB; DOT_LMUL; DOT_LZERO; REAL_MUL_RZERO; REAL_SUB_RZERO] THENL + [ + ASM_SIMP_TAC[REAL_ARITH `&0 < a ==> ~(a = &0)`]; + ASM_SIMP_TAC[REAL_LT_IMP_NE] + ]; + ALL_TAC + ] THEN + STRIP_TAC THEN + + SUBGOAL_THEN `!t. (f:real^1->real^3) t IN ball_annulus` ASSUME_TAC THENL + [ + GEN_TAC THEN REWRITE_TAC[in_ball_annulus] THEN + REWRITE_TAC[GSYM NORM_EQ_0] THEN + SUBGOAL_THEN `norm ((f:real^1->real^3) t) = norm (v1:real^3)` (fun th -> REWRITE_TAC[th]) THENL + [ + FIRST_X_ASSUM (MP_TAC o SPECL [`t:real^1`; `&0`]) THEN + SIMP_TAC[VECTOR_MUL_LZERO; DIST_0]; + ALL_TAC + ] THEN + REWRITE_TAC[NORM_EQ_0] THEN + REWRITE_TAC[GSYM in_ball_annulus] THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`v2:real^3`; `v4:real^3`; `f:real^1->real^3`; `v3:real^3`; `&1`] continuous_lemma_aff_ge) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[REAL_LE_01] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC CONTINUOUS_ON_SUBSET THEN + EXISTS_TAC `(:real^1)` THEN + ASM_REWRITE_TAC[SUBSET_UNIV]; + ALL_TAC + ] THEN + GEN_TAC THEN DISCH_TAC THEN + MATCH_MP_TAC zero_not_between_estd THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `dist (v1:real^3,v3)` THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `drop (t:real^1)`) THEN + ANTS_TAC THENL + [ + POP_ASSUM MP_TAC THEN + SUBGOAL_THEN `t = lift (drop (t:real^1))` (fun th -> GEN_REWRITE_TAC (LAND_CONV o ONCE_DEPTH_CONV) [th]) THENL + [ + REWRITE_TAC[LIFT_DROP]; + ALL_TAC + ] THEN + REWRITE_TAC[IN_INTERVAL_1]; + ALL_TAC + ] THEN + REWRITE_TAC[LIFT_DROP]; + ALL_TAC + ] THEN + + DISCH_THEN DISJ_CASES_TAC THENL + [ + MATCH_MP_TAC (TAUT `F ==> A`) THEN + POP_ASSUM (MP_TAC o SPEC `lift (&1)`) THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + REWRITE_TAC[IN_INTERVAL_1; REAL_LE_REFL; REAL_LE_01] THEN + REWRITE_TAC[IN_INTER; IN_SEGMENT] THEN + ASM_SIMP_TAC[aff_ge_0_2; IN_ELIM_THM] THEN + STRIP_TAC THEN + POP_ASSUM (MP_TAC o AP_TERM `\x:real^3. x dot n`) THEN + ASM_REWRITE_TAC[DOT_LADD; DOT_LMUL; REAL_MUL_RZERO; REAL_ADD_RID] THEN + MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`) THEN + REWRITE_TAC[REAL_ARITH `(&1 - u) * a * b + u * b = b * (a * (&1 - u) + u)`] THEN + MATCH_MP_TAC REAL_LT_MUL THEN + ASM_REWRITE_TAC[] THEN + ASM_CASES_TAC `u = &0` THENL + [ + ASM_REWRITE_TAC[REAL_SUB_RZERO; REAL_MUL_RID; REAL_ADD_RID]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LET_ADD THEN + ASM_REWRITE_TAC[REAL_LT_LE] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE; REAL_ARITH `&0 <= &1 - u <=> u <= &1`]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN + DISCH_THEN (CHOOSE_THEN MP_TAC) THEN + REWRITE_TAC[CONJ_ASSOC] THEN + DISCH_THEN (CONJUNCTS_THEN ASSUME_TAC) THEN + + SUBGOAL_THEN `!t. &2 <= dist (f (t:real^1), v2:real^3)` ASSUME_TAC THENL + [ + GEN_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`t:real^1`; `&1`]) THEN + ASM_SIMP_TAC[VECTOR_MUL_LID]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!t. &0 <= t /\ t <= &1 ==> dist (f (lift t),v3:real^3) <= &2 * h0` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `dist (v1:real^3, v3)` THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `dist (f (lift x), v4:real^3) < &2` ASSUME_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o check (is_disj o concl)) THEN + ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN + REWRITE_TAC[REAL_NOT_LT; DE_MORGAN_THM] THEN + DISCH_TAC THEN + + REPEAT CONJ_TAC THEN DISCH_TAC THEN MATCH_MP_TAC LEMMA_3_POINTS_FINAL THENL + [ + MAP_EVERY EXISTS_TAC [`v2:real^3`; `v4:real^3`; `f (lift x):real^3`] THEN + ASM_REWRITE_TAC[DIST_SYM]; + MAP_EVERY EXISTS_TAC [`f (lift x):real^3`; `v3:real^3`; `v2:real^3`] THEN + ASM_SIMP_TAC[DIST_SYM]; + MAP_EVERY EXISTS_TAC [`f (lift x):real^3`; `v3:real^3`; `v4:real^3`] THEN + ASM_SIMP_TAC[]; + ]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`f:real^1->real^3`; `v4:real^3`; `x:real`; `&2`] dist_decreasing_ivt_lemma) THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE] THEN + STRIP_TAC THEN + EXISTS_TAC `(f:real^1->real^3) t` THEN + + SUBGOAL_THEN `!t:real^1. dist ((f t):real^3,v2) = dist (v1,v2)` ASSUME_TAC THENL + [ + GEN_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`t':real^1`; `&1`]) THEN + SIMP_TAC[VECTOR_MUL_LID]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[] THEN + CONJ_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o SPECL [`t:real^1`; `&0`]) THEN + SIMP_TAC[VECTOR_MUL_LZERO; DIST_0]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o SPEC `drop (t:real^1)`) THEN + ANTS_TAC THENL + [ + REWRITE_TAC[GSYM IN_INTERVAL_1; LIFT_DROP] THEN + MATCH_MP_TAC Hypermap.lemma_in_subset THEN + EXISTS_TAC `interval [lift (&0), lift x]` THEN + ASM_REWRITE_TAC[SUBSET_INTERVAL] THEN + REWRITE_TAC[DIMINDEX_1; ARITH_RULE `1 <= i /\ i <= 1 <=> i = 1`] THEN + SIMP_TAC[] THEN + ASM_REWRITE_TAC[GSYM drop; LIFT_DROP; REAL_LE_REFL]; + ALL_TAC + ] THEN + + REWRITE_TAC[LIFT_DROP]);; + + + + +(*****************************************************************************************) + + +let lemma_4_points_rotation1_full = prove(`!v1 v2 v3 v4. v1 IN ball_annulus /\ v2 IN ball_annulus /\ v3 IN ball_annulus /\ v4 IN ball_annulus /\ + dist (v1,v3) <= &2 * h0 /\ dist (v2,v4) <= &2 * h0 /\ + &2 <= dist (v1,v2) /\ &2 <= dist (v1,v4) /\ + &2 <= dist (v2,v3) /\ &2 <= dist (v3,v4) /\ + &2 <= dist (v2,v4) /\ + ~(segment [v1,v3] INTER aff_ge {vec 0} {v2, v4} = {}) + ==> (?v1' v3'. v1' IN ball_annulus /\ v3' IN ball_annulus /\ + norm v1' = norm v1 /\ norm v3' = norm v3 /\ + dist (v1',v3') <= &2 * h0 /\ + dist (v1',v2) = &2 /\ dist (v1',v4) = &2 /\ + dist (v2,v3') = &2 /\ dist (v3',v4) = &2 /\ + ~(segment [v1',v3'] INTER aff_ge {vec 0} {v2, v4} = {}))`, + REPEAT STRIP_TAC THEN + (* v1 about v2 *) + MP_TAC (SPEC_ALL lemma_4_points_rotation1) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + SUBGOAL_THEN `&2 <= dist (v1':real^3,v2)` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + UNDISCH_TAC `norm (v1':real^3) = norm (v1:real^3)` THEN + REPEAT (FIRST_X_ASSUM ((fun th -> ALL_TAC) o check (free_in `v1:real^3` o concl))) THEN + DISCH_TAC THEN + + (* v1 about v4 *) + MP_TAC (SPECL [`v1':real^3`; `v4:real^3`; `v3:real^3`; `v2:real^3`] lemma_4_points_rotation1) THEN + ASM_REWRITE_TAC[REAL_LE_REFL; DIST_SYM; Collect_geom.PER_SET2] THEN + REMOVE_ASSUM THEN + REPEAT (FIRST_X_ASSUM ((fun th -> ALL_TAC) o check (free_in `v1':real^3` o concl))) THEN + DISCH_THEN (X_CHOOSE_THEN `v1':real^3` MP_TAC) THEN STRIP_TAC THEN + + (* v3 about v2 *) + MP_TAC (SPECL [`v3:real^3`; `v2:real^3`; `v1':real^3`; `v4:real^3`] lemma_4_points_rotation1) THEN + ASM_REWRITE_TAC[DIST_SYM; REAL_LE_REFL; SEGMENT_SYM] THEN + DISCH_THEN (X_CHOOSE_THEN `v3':real^3` MP_TAC) THEN + REWRITE_TAC[DIST_SYM] THEN STRIP_TAC THEN + UNDISCH_TAC `norm (v3':real^3) = norm (v3:real^3)` THEN + SUBGOAL_THEN `&2 <= dist (v2:real^3,v3')` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REPEAT (FIRST_X_ASSUM ((fun th -> ALL_TAC) o check (free_in `v3:real^3` o concl))) THEN + DISCH_TAC THEN + + (* v3 about v4 *) + MP_TAC (SPECL [`v3':real^3`; `v4:real^3`; `v1':real^3`; `v2:real^3`] lemma_4_points_rotation1) THEN + ASM_REWRITE_TAC[REAL_LE_REFL; DIST_SYM; Collect_geom.PER_SET2; SEGMENT_SYM] THEN + REPEAT (FIRST_X_ASSUM ((fun th -> ALL_TAC) o check (free_in `v3':real^3` o concl))) THEN + DISCH_THEN (X_CHOOSE_THEN `v3':real^3` MP_TAC) THEN STRIP_TAC THEN + + MAP_EVERY EXISTS_TAC [`v1':real^3`; `v3':real^3`] THEN + ASM_REWRITE_TAC[DIST_SYM; SEGMENT_SYM]);; + + + +(*******************************************************************************************) + + +(* Auxiliary result for the second rotation lemma *) + +let segment_inter_conv = prove(`!v1 v2 v3 v4 n:real^N. ~(v2 = vec 0) /\ ~(v4 = vec 0) /\ ~(v2 = v4) /\ + ~(projection (v4 - v2) (--v2) = vec 0) /\ + ~(segment [v1, v3] INTER aff_ge {vec 0} {v2, v4} = {}) /\ + v1 dot n < &0 /\ &0 < v3 dot n /\ v2 dot n = &0 /\ v4 dot n = &0 /\ + ~(segment [projection (v4 - v2) (v1 - v2), projection (v4 - v2) (v3 - v2)] INTER + aff_ge {vec 0} {projection (v4 - v2) (--v2)} = {}) + ==> ~(segment [v1, v3] INTER convex hull {vec 0, v2, v4} = {})`, + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + REWRITE_TAC[IN_SEGMENT; CONVEX_HULL_3_ALT; IN_INTER; IN_ELIM_THM; VECTOR_SUB_RZERO; VECTOR_ADD_LID] THEN + + UNDISCH_TAC `~(segment [v1,v3] INTER aff_ge {vec 0} {v2,v4:real^N} = {})` THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY; IN_SEGMENT; IN_INTER] THEN + ASM_SIMP_TAC[aff_ge_0_2; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + EXISTS_TAC `x:real^N` THEN + CONJ_TAC THENL + [ + EXISTS_TAC `u:real` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MAP_EVERY EXISTS_TAC [`t1:real`; `t2:real`] THEN + FIRST_ASSUM (fun th -> REWRITE_TAC[th]) THEN + ASM_REWRITE_TAC[] THEN + + ABBREV_TAC `d = v4 - v2:real^N` THEN + ABBREV_TAC `v = v1 - v2:real^N` THEN + ABBREV_TAC `w = v3 - v2:real^N` THEN + + FIRST_X_ASSUM (MP_TAC o check (is_neg o concl)) THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY; IN_INTER; IN_SEGMENT; HALFLINE; IN_ELIM_THM] THEN + DISCH_THEN (X_CHOOSE_THEN `px:real^N` MP_TAC) THEN + DISCH_THEN (CONJUNCTS_THEN2 (X_CHOOSE_THEN `up:real` MP_TAC) (X_CHOOSE_THEN `tp:real` MP_TAC)) THEN + REWRITE_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + STRIP_TAC THEN POP_ASSUM (LABEL_TAC "px1") THEN + ONCE_REWRITE_TAC[CONJ_ASSOC] THEN + DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC (LABEL_TAC "px2")) THEN + + SUBGOAL_THEN `(&1 - u) % v + u % w = t2 % d + (&1 - t1 - t2) % (--v2:real^N)` MP_TAC THENL + [ + REPLICATE_TAC 4 REMOVE_ASSUM THEN + REPLICATE_TAC 3 (POP_ASSUM (fun th -> REWRITE_TAC[SYM th])) THEN + REWRITE_TAC [VECTOR_ARITH `(&1 - u) % (v1 - v2) + u % (v3 - v2) = ((&1 - u) % v1 + u % v3) - v2:real^N`] THEN + FIRST_X_ASSUM (fun th -> CHANGED_TAC (REWRITE_TAC[SYM th])) THEN + ASM_REWRITE_TAC[] THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `~(d = vec 0:real^N)` ASSUME_TAC THENL + [ + EXPAND_TAC "d" THEN + ASM_REWRITE_TAC[VECTOR_SUB_EQ]; + ALL_TAC + ] THEN + + DISCH_THEN (MP_TAC o AP_TERM `\v:real^N. projection d v`) THEN + REWRITE_TAC[PROJECTION_LINEAR] THEN + ASM_SIMP_TAC[PROJECTION_ZERO; VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + + SUBGOAL_THEN `projection d (--v2) dot n = &0 /\ projection d v dot n = v1 dot n /\ projection d w dot n = v3 dot n:real^N` ASSUME_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["d"; "v"; "w"] THEN + REWRITE_TAC[projection] THEN + ASM_REWRITE_TAC[DOT_LSUB; DOT_LNEG; DOT_LMUL; REAL_SUB_REFL; REAL_MUL_RZERO] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_TAC THEN + FIRST_ASSUM (MP_TAC o AP_TERM `\v:real^N. v dot n`) THEN + USE_THEN "px2" MP_TAC THEN USE_THEN "px1" (fun th -> REWRITE_TAC[th]) THEN + DISCH_THEN (MP_TAC o AP_TERM `\v:real^N. v dot n`) THEN + ASM_REWRITE_TAC[DOT_LADD; DOT_LMUL; REAL_MUL_RZERO] THEN + DISCH_THEN (LABEL_TAC "A" o SYM) THEN DISCH_THEN (LABEL_TAC "B") THEN + + SUBGOAL_THEN `u = up:real` ASSUME_TAC THENL + [ + MATCH_MP_TAC EQ_TRANS THEN + ABBREV_TAC `a = v1 dot n:real^N` THEN + ABBREV_TAC `b = v3 dot n:real^N` THEN + EXISTS_TAC `a / (a - b)` THEN + SUBGOAL_THEN `~(a - b = &0)` ASSUME_TAC THENL + [ + MATCH_MP_TAC (REAL_ARITH `&0 < b + --a ==> ~(a - b = &0)`) THEN + MATCH_MP_TAC REAL_LT_ADD THEN + ASM_REWRITE_TAC[REAL_NEG_GT0]; + ALL_TAC + ] THEN + + CONJ_TAC THEN MATCH_MP_TAC REAL_EQ_RCANCEL_IMP THEN EXISTS_TAC `a - b:real` THEN REWRITE_TAC[real_div; GSYM REAL_MUL_ASSOC] THEN ASM_SIMP_TAC[REAL_MUL_LINV] THENL + [ + REMOVE_THEN "B" MP_TAC THEN REAL_ARITH_TAC; + ALL_TAC + ] THEN + REMOVE_THEN "A" MP_TAC THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + REMOVE_THEN "px2" MP_TAC THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]) THEN + ASM_REWRITE_TAC[VECTOR_MUL_RCANCEL] THEN + UNDISCH_TAC `&0 <= tp` THEN + REAL_ARITH_TAC);; + + + + +(* The second rotation lemma for a 4-point configuration *) + +let lemma_4_points_rotation2 = prove(`!v1 v2 v3 v4. v1 IN ball_annulus /\ v2 IN ball_annulus /\ v3 IN ball_annulus /\ v4 IN ball_annulus /\ + dist (v1,v3) <= &2 * h0 /\ dist (v2,v4) <= &2 * h0 /\ + &2 <= dist (v1,v2) /\ &2 <= dist (v1,v4) /\ + &2 <= dist (v2,v3) /\ &2 <= dist (v3,v4) /\ + &2 <= dist (v2,v4) /\ + ~(segment [v1,v3] INTER convex hull {vec 0,v2,v4} = {}) + ==> (?v1'. v1' IN ball_annulus /\ norm v1' = &2 /\ + dist (v1',v3) <= &2 * h0 /\ + dist (v1',v2) = dist (v1,v2) /\ + dist (v1',v4) = dist (v1,v4) /\ + ~(segment [v1',v3] INTER convex hull {vec 0,v2,v4} = {}))`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `?u t2 t4. (&0 <= u /\ u <= &1 /\ &0 <= t2 /\ &0 <= t4 /\ t2 + t4 <= &1) /\ (&1 - u) % (v1 - v2) + u % (v3 - v2) = t4 % (v4 - v2) + (&1 - t2 - t4) % (--v2:real^3)` MP_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY; IN_INTER; IN_SEGMENT; CONVEX_HULL_3_ALT; IN_ELIM_THM] THEN + REWRITE_TAC[VECTOR_SUB_RZERO; VECTOR_ADD_LID] THEN + REPEAT STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`u:real`; `u':real`; `v:real`] THEN + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[VECTOR_ARITH `(&1 - u) % (v1 - v2) + u % (v3 - v2) = ((&1 - u) % v1 + u % v3) - v2:real^3`] THEN + POP_ASSUM MP_TAC THEN + FIRST_X_ASSUM (fun th -> CHANGED_TAC (REWRITE_TAC[SYM th])) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `~collinear {vec 0, v2, v4:real^3} /\ ~(v2 = vec 0) /\ ~(v4 = vec 0)` ASSUME_TAC THENL + [ + REPLICATE_TAC 3 (FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl))) THEN + SIMP_TAC[in_ball_annulus] THEN + REPEAT DISCH_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[] THEN + MATCH_MP_TAC estd_non_collinear_lemma THEN + ASM_REWRITE_TAC[in_ball_annulus]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `~(segment [v1,v3] INTER aff_ge {vec 0} {v2,v4:real^3} = {})` MP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o check (is_neg o concl)) THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY; IN_INTER] THEN + STRIP_TAC THEN EXISTS_TAC `x:real^3` THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC Hypermap.lemma_in_subset THEN + EXISTS_TAC `convex hull {vec 0,v2,v4:real^3}` THEN + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[CONVEX_HULL_3_ALT; aff_ge_0_2; SUBSET; IN_ELIM_THM; VECTOR_SUB_RZERO; VECTOR_ADD_LID] THEN + REPEAT STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`u:real`; `v:real`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM ((fun th -> ALL_TAC) o check (is_neg o concl)) THEN + DISCH_TAC THEN + + MAP_EVERY (fun tm -> DISCH_THEN (X_CHOOSE_THEN tm MP_TAC)) [`u:real`; `t2:real`; `t4:real`] THEN + DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC (LABEL_TAC "A")) THEN + + MP_TAC (SPEC_ALL separation_plane_4_points) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + + ABBREV_TAC `v:real^3 = v1 - v2` THEN + ABBREV_TAC `w:real^3 = v3 - v2` THEN + ABBREV_TAC `d:real^3 = v4 - v2` THEN + + SUBGOAL_THEN `~(d = vec 0:real^3)` ASSUME_TAC THENL + [ + EXPAND_TAC "d" THEN + REWRITE_TAC[GSYM NORM_EQ_0; GSYM dist; DIST_SYM] THEN + ASM_SIMP_TAC[REAL_ARITH `&2 <= a ==> ~(a = &0)`]; + ALL_TAC + ] THEN + + (* Rotation *) + MP_TAC (ISPECL [`projection d v:real^3`; `projection d w:real^3`; `projection d (--v2):real^3`; `d:real^3`] rotation_lemma_segments) THEN + SUBGOAL_THEN `~(projection d (--v2) = vec 0:real^3)` ASSUME_TAC THENL + [ + EXPAND_TAC "d" THEN + REWRITE_TAC[projection] THEN + ABBREV_TAC `k = (--v2 dot (v4 - v2:real^3)) / ((v4 - v2) dot (v4 - v2))` THEN + ASM_CASES_TAC `k = &0` THENL + [ + ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_SUB_RZERO; VECTOR_NEG_EQ_0]; + ALL_TAC + ] THEN + + DISCH_THEN (MP_TAC o AP_TERM `\v:real^3. inv (k) % v`) THEN + ASM_SIMP_TAC[VECTOR_SUB_LDISTRIB; VECTOR_MUL_ASSOC; REAL_MUL_LINV] THEN + REWRITE_TAC[VECTOR_MUL_LID; VECTOR_MUL_RZERO] THEN + REWRITE_TAC[VECTOR_ARITH `a % (--v2) - (v4 - v2) = vec 0 <=> v4 = (&1 - a) % v2:real^3`] THEN + UNDISCH_TAC `~collinear {vec 0,v2,v4} /\ ~(v2 = vec 0) /\ ~(v4 = vec 0:real^3)` THEN + SIMP_TAC[COLLINEAR_LEMMA_ALT; DE_MORGAN_THM; NOT_EXISTS_THM]; + ALL_TAC + ] THEN + + ANTS_TAC THENL + [ + SUBGOAL_THEN `v dot n = v1 dot n /\ w dot n = v3 dot n /\ d dot n:real^3 = &0` ASSUME_TAC THENL + [ + MAP_EVERY EXPAND_TAC ["v"; "w"; "d"] THEN + ASM_REWRITE_TAC[DOT_LSUB; REAL_SUB_RZERO]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[DIMINDEX_3; LE_REFL; PROJECTION_ORTHOGONAL] THEN + + CONJ_TAC THENL + [ + DISCH_THEN (MP_TAC o AP_TERM `\x:real^3. x dot n`) THEN + REWRITE_TAC[projection] THEN + ASM_REWRITE_TAC[DOT_LSUB; DOT_LMUL; DOT_LZERO; REAL_MUL_RZERO; REAL_SUB_RZERO] THEN + ASM_SIMP_TAC[REAL_ARITH `a < &0 ==> ~(a = &0)`]; + ALL_TAC + ] THEN + + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + REWRITE_TAC[IN_INTER; IN_SEGMENT; VECTOR_MUL_RZERO; VECTOR_ADD_LID] THEN + EXISTS_TAC `(&1 - t2 - t4) % projection d (--v2:real^3)` THEN + CONJ_TAC THENL + [ + EXISTS_TAC `&1 - t2 - t4` THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 <= &1 - t2 - t4 <=> t2 + t4 <= &1`] THEN + MATCH_MP_TAC (REAL_ARITH `&0 <= t2 /\ &0 <= t4 ==> &1 - t2 - t4 <= &1`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + EXISTS_TAC `u:real` THEN + ASM_REWRITE_TAC[] THEN + REMOVE_THEN "A" (MP_TAC o AP_TERM `\v:real^3. projection d v`) THEN + REWRITE_TAC[PROJECTION_LINEAR] THEN + ASM_SIMP_TAC[PROJECTION_ZERO; VECTOR_MUL_RZERO; VECTOR_ADD_LID]; + ALL_TAC + ] THEN + + DISCH_THEN (X_CHOOSE_THEN `g:real^1->real^3` STRIP_ASSUME_TAC) THEN + + (* f(t) *) + ABBREV_TAC `f = (\t:real^1. (g t + v - projection d v) + v2:real^3)` THEN + + (* f(0) = v1 and (f(1) dot n) = 0 *) + SUBGOAL_THEN `f (lift (&0)) = v1:real^3 /\ f (lift (&1)) dot n = &0` ASSUME_TAC THENL + [ + EXPAND_TAC "f" THEN + ASM_REWRITE_TAC[VECTOR_ARITH `pv + v - pv = v:real^3`] THEN + CONJ_TAC THENL + [ + EXPAND_TAC "v" THEN VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + REWRITE_TAC[DOT_LADD; DOT_LMUL] THEN + SUBGOAL_THEN `d dot n:real^3 = &0` ASSUME_TAC THENL [ EXPAND_TAC "d" THEN ASM_REWRITE_TAC[DOT_LSUB; REAL_SUB_RZERO]; ALL_TAC ] THEN + SUBGOAL_THEN `(v - projection d v) dot n:real^3 = &0` (fun th -> REWRITE_TAC[th]) THENL + [ + GEN_REWRITE_TAC (PAT_CONV `\x:real^3. (x - y) dot z = &0`) [VECTOR_PROJECTION] THEN + REWRITE_TAC[VECTOR_ARITH `(a + b) - a = b:real^3`] THEN + ASM_REWRITE_TAC[DOT_LMUL; REAL_MUL_RZERO]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[projection; DOT_LSUB; DOT_LMUL; DOT_LNEG; REAL_MUL_RZERO; REAL_SUB_LZERO; REAL_NEG_0; REAL_ADD_LID]; + ALL_TAC + ] THEN + + (* d(f(t), v2) = d(v1, v2) *) + SUBGOAL_THEN `!t. dist (f (t:real^1), v2:real^3) = dist (v1, v2) /\ dist (f t, v4) = dist (v1, v4)` ASSUME_TAC THENL + [ + GEN_TAC THEN EXPAND_TAC "f" THEN + REWRITE_TAC[dist; VECTOR_ARITH `(a + b) - b = a:real^3 - vec 0`] THEN + REWRITE_TAC[VECTOR_ARITH `((a + b - c) + v2) - v4 = (a + b - c) - (v4 - v2:real^3)`] THEN + REWRITE_TAC[GSYM dist; DIST_EQ] THEN + ASM_SIMP_TAC[PROJECTION_DIST_SPECIAL_EQ; PROJECTION_ZERO] THEN + ASM_REWRITE_TAC[PROJECTION_0; DIST_0] THEN + EXPAND_TAC "v" THEN EXPAND_TAC "d" THEN REWRITE_TAC[dist] THEN + REWRITE_TAC[VECTOR_ARITH `v1 - v2 - (v4 - v2) = v1 - v4:real^3`] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + (* d(f(t), v3) <= d(v1,v3) <= 2 h0 *) + SUBGOAL_THEN `!t. &0 <= t /\ t <= &1 ==> dist (f (lift t), v3:real^3) <= &2 * h0` MP_TAC THENL + [ + REPEAT STRIP_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `dist (v1,v3:real^3)` THEN + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "f" THEN + REWRITE_TAC[dist] THEN + ASM_REWRITE_TAC[VECTOR_ARITH `((g + v - pv) + v2) - v3:real^3 = (g + v - pv) - (v3 - v2)`] THEN + GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [VECTOR_ARITH `v1 - v3 = (v1 - v2) - (v3 - v2:real^3)`] THEN + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[GSYM dist] THEN + MATCH_MP_TAC PROJECTION_DIST_SPECIAL_LE THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + (* |f(t)| <= |v1| *) + SUBGOAL_THEN `!t. &0 <= t /\ t <= &1 ==> norm (f (lift t):real^3) <= norm (v1:real^3)` MP_TAC THENL + [ + REPEAT STRIP_TAC THEN + EXPAND_TAC "f" THEN + ASM_REWRITE_TAC[VECTOR_ARITH `(g + v - pv) + v2:real^3 = (g + v - pv) - (--v2)`] THEN + GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [VECTOR_ARITH `v1 = (v1 - v2) - (--v2:real^3)`] THEN + ASM_REWRITE_TAC[] THEN + REWRITE_TAC[GSYM dist] THEN + MATCH_MP_TAC PROJECTION_DIST_SPECIAL_LE THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + REPEAT DISCH_TAC THEN + + (* If 2 <= |f(t)|, then f IN ball_annulus *) + SUBGOAL_THEN `!t. &0 <= t /\ t <= &1 /\ &2 <= norm (f (lift t):real^3) ==> f (lift t) IN ball_annulus` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[in_ball_annulus; GSYM NORM_EQ_0; REAL_ARITH `&2 <= a ==> ~(a = &0)`] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `norm (v1:real^3)` THEN + ASM_SIMP_TAC[] THEN + UNDISCH_TAC `v1 IN ball_annulus` THEN + SIMP_TAC[in_ball_annulus]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `f:real^1->real^3 continuous_on interval [lift (&0), lift (&1)]` ASSUME_TAC THENL + [ + EXPAND_TAC "f" THEN + REPEAT (MATCH_MP_TAC CONTINUOUS_ON_ADD THEN REWRITE_TAC[CONTINUOUS_ON_CONST]) THEN + MATCH_MP_TAC CONTINUOUS_ON_SUBSET THEN + EXISTS_TAC `UNIV:real^1->bool` THEN + ASM_REWRITE_TAC[SUBSET_UNIV]; + ALL_TAC + ] THEN + + REPLICATE_TAC 2 (FIRST_X_ASSUM (MP_TAC o check (free_in `g:real^1->real^3` o concl))) THEN + SUBGOAL_THEN `!t:real^1. projection d (g t) = (g t):real^3` MP_TAC THENL + [ + GEN_TAC THEN REWRITE_TAC[projection] THEN + ASM_REWRITE_TAC[real_div; REAL_MUL_LZERO; VECTOR_MUL_LZERO; VECTOR_SUB_RZERO]; + ALL_TAC + ] THEN + + REPEAT (FIRST_X_ASSUM ((fun th -> ALL_TAC) o check (free_in `g:real^1->real^3` o concl))) THEN + REPEAT DISCH_TAC THEN + + ASM_CASES_TAC `!h. &0 <= h /\ h <= &1 ==> &2 <= norm (f (lift h):real^3)` THENL + [ + MATCH_MP_TAC (TAUT `F ==> A`) THEN + MP_TAC (SPECL [`v2:real^3`; `v4:real^3`; `f:real^1->real^3`; `v3:real^3`; `&1`] continuous_lemma_aff_ge) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[REAL_LE_01] THEN + GEN_TAC THEN DISCH_TAC THEN + SUBGOAL_THEN `t:real^1 = lift (drop t)` (fun th -> ONCE_REWRITE_TAC[th]) THENL [ REWRITE_TAC[LIFT_DROP]; ALL_TAC ] THEN + SUBGOAL_THEN `&0 <= drop (t:real^1) /\ drop t <= &1` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[GSYM IN_INTERVAL_1; LIFT_DROP]; + ALL_TAC + ] THEN + MATCH_MP_TAC zero_not_between_estd THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + DISCH_THEN DISJ_CASES_TAC THENL + [ + MP_TAC (ISPECL [`v2:real^3`; `v4:real^3`; `f (lift (&1)):real^3`; `v3:real^3`; `n:real^3`] segment_inter_aff_ge_ends) THEN + ASM_SIMP_TAC[REAL_ARITH `&0 < a ==> ~(a = &0)`; IN_INTERVAL_1; REAL_LE_REFL; REAL_LE_01] THEN + DISCH_TAC THEN + MATCH_MP_TAC LEMMA_3_POINTS_FINAL THEN + MAP_EVERY EXISTS_TAC [`v2:real^3`; `v4:real^3`; `f (lift (&1)):real^3`] THEN + ASM_SIMP_TAC[DIST_SYM; REAL_LE_REFL; REAL_LE_01]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN STRIP_TAC THEN MATCH_MP_TAC LEMMA_3_POINTS_FINAL THENL + [ + MAP_EVERY EXISTS_TAC [`v2:real^3`; `v4:real^3`; `f (lift x):real^3`] THEN + ASM_SIMP_TAC[DIST_SYM]; + MAP_EVERY EXISTS_TAC [`f (lift x):real^3`; `v3:real^3`; `v2:real^3`] THEN + ASM_SIMP_TAC[DIST_SYM]; + MAP_EVERY EXISTS_TAC [`f (lift x):real^3`; `v3:real^3`; `v4:real^3`] THEN + ASM_SIMP_TAC[DIST_SYM] + ]; + ALL_TAC + ] THEN + + (* ?h. f(h) <= 2 *) + POP_ASSUM MP_TAC THEN REWRITE_TAC[NOT_FORALL_THM; NOT_IMP; REAL_NOT_LE] THEN + DISCH_THEN (CHOOSE_THEN ASSUME_TAC) THEN + + SUBGOAL_THEN `?s. &0 <= s /\ s <= &1 /\ norm (f (lift s):real^3) = &2 /\ (!t. &0 <= t /\ t <= s ==> &2 <= norm (f (lift t)))` MP_TAC THENL + [ + MP_TAC (SPECL [`\t:real. norm (f (lift t):real^3)`; `&2`; `h:real`] continuous_lemma_dec) THEN + ANTS_TAC THENL + [ + ASM_SIMP_TAC[REAL_LT_IMP_LE] THEN + UNDISCH_TAC `v1 IN ball_annulus` THEN + SIMP_TAC[in_ball_annulus] THEN DISCH_TAC THEN + REWRITE_TAC[REAL_CONTINUOUS_ON; IMAGE_LIFT_REAL_INTERVAL] THEN + SUBGOAL_THEN `lift o (\t. norm (f (lift t):real^3)) o drop = (lift o norm) o f` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[FUN_EQ_THM; o_THM; LIFT_DROP]; + ALL_TAC + ] THEN + MATCH_MP_TAC CONTINUOUS_ON_COMPOSE THEN + REWRITE_TAC[CONTINUOUS_ON_LIFT_NORM] THEN + MATCH_MP_TAC CONTINUOUS_ON_SUBSET THEN + EXISTS_TAC `interval [lift (&0), lift (&1)]` THEN + ASM_REWRITE_TAC[SUBSET_INTERVAL_1; LIFT_DROP; REAL_LE_REFL]; + ALL_TAC + ] THEN + + BETA_TAC THEN STRIP_TAC THEN + EXISTS_TAC `x:real` THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL [ MATCH_MP_TAC REAL_LE_TRANS THEN EXISTS_TAC `h:real` THEN ASM_REWRITE_TAC[]; ALL_TAC ] THEN + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `t = x:real` THENL [ ASM_REWRITE_TAC[REAL_LE_REFL]; ALL_TAC ] THEN + MATCH_MP_TAC REAL_LT_IMP_LE THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[REAL_LT_LE]; + ALL_TAC + ] THEN + STRIP_TAC THEN + SUBGOAL_THEN `!t. t <= s ==> t <= &1` ASSUME_TAC THENL + [ + REPEAT STRIP_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `s:real` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + (* The main step *) + MP_TAC (SPECL [`v2:real^3`; `v4:real^3`; `f:real^1->real^3`; `v3:real^3`; `s:real`] continuous_lemma_aff_ge) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC CONTINUOUS_ON_SUBSET THEN + EXISTS_TAC `interval [lift (&0), lift (&1)]` THEN + ASM_REWRITE_TAC[SUBSET_INTERVAL_1; LIFT_DROP; REAL_LE_REFL]; + ALL_TAC + ] THEN + + GEN_TAC THEN DISCH_TAC THEN + SUBGOAL_THEN `t:real^1 = lift (drop t)` (fun th -> ONCE_REWRITE_TAC[th]) THENL [ REWRITE_TAC[LIFT_DROP]; ALL_TAC ] THEN + SUBGOAL_THEN `&0 <= drop (t:real^1) /\ drop t <= s` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[GSYM IN_INTERVAL_1; LIFT_DROP]; + ALL_TAC + ] THEN + MATCH_MP_TAC zero_not_between_estd THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + ONCE_REWRITE_TAC[DISJ_SYM] THEN + DISCH_THEN DISJ_CASES_TAC THENL + [ + MATCH_MP_TAC (TAUT `F ==> A`) THEN + POP_ASSUM MP_TAC THEN STRIP_TAC THEN MATCH_MP_TAC LEMMA_3_POINTS_FINAL THENL + [ + MAP_EVERY EXISTS_TAC [`v2:real^3`; `v4:real^3`; `f (lift x):real^3`] THEN + ASM_SIMP_TAC[DIST_SYM]; + MAP_EVERY EXISTS_TAC [`f (lift x):real^3`; `v3:real^3`; `v2:real^3`] THEN + ASM_SIMP_TAC[DIST_SYM]; + MAP_EVERY EXISTS_TAC [`f (lift x):real^3`; `v3:real^3`; `v4:real^3`] THEN + ASM_SIMP_TAC[DIST_SYM] + ]; + ALL_TAC + ] THEN + + EXISTS_TAC `f (lift s):real^3` THEN + ASM_SIMP_TAC[REAL_LE_REFL] THEN + + (* [f(s), v3] INTER convex hull {0,v2,v4} *) + MATCH_MP_TAC segment_inter_conv THEN + ASM_REWRITE_TAC[] THEN + + MP_TAC (SPECL [`f (lift s):real^3`; `v2:real^3`; `v3:real^3`; `v4:real^3`] separation_plane_4_points) THEN + ANTS_TAC THENL + [ + ASM_SIMP_TAC[REAL_LE_REFL] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[IN_INTERVAL_1; REAL_LE_REFL]; + ALL_TAC + ] THEN + + REPEAT (FIRST_X_ASSUM ((fun th -> ALL_TAC) o check (free_in `n:real^3` o concl))) THEN + STRIP_TAC THEN + EXISTS_TAC `n:real^3` THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + ONCE_REWRITE_TAC[VECTOR_ARITH `v2 = v4:real^3 <=> v4 - v2 = vec 0`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[IN_INTERVAL_1; REAL_LE_REFL]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `projection d (f (lift s) - v2:real^3) = projection d (g (lift s))` (fun th -> REWRITE_TAC[th]) THENL + [ + EXPAND_TAC "f" THEN + REWRITE_TAC[VECTOR_ARITH `(a + v2) - v2 = a:real^3`] THEN + REWRITE_TAC[PROJECTION_LINEAR] THEN + SUBGOAL_THEN `?a. v - projection d v = a % d:real^3` MP_TAC THENL + [ + EXISTS_TAC `(v dot d:real^3) / (d dot d)` THEN + REWRITE_TAC[projection] THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + STRIP_TAC THEN + ASM_SIMP_TAC[PROJECTION_LINEAR; PROJECTION_ZERO; VECTOR_MUL_RZERO; VECTOR_ADD_RID]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[]);; + + + +(******************************************************************) + + +let lemma_4_points_rotation2_full = prove(`!v1 v2 v3 v4. v1 IN ball_annulus /\ v2 IN ball_annulus /\ v3 IN ball_annulus /\ v4 IN ball_annulus /\ + dist (v1,v3) <= &2 * h0 /\ dist (v2,v4) <= &2 * h0 /\ + &2 <= dist (v1,v2) /\ &2 <= dist (v1,v4) /\ + &2 <= dist (v2,v3) /\ &2 <= dist (v3,v4) /\ + &2 <= dist (v2,v4) /\ + ~(segment [v1,v3] INTER convex hull {vec 0, v2, v4} = {}) + ==> (?v1' v3'. v1' IN ball_annulus /\ v3' IN ball_annulus /\ + norm v1' = &2 /\ norm v3' = &2 /\ + dist (v1',v3') <= &2 * h0 /\ + dist (v1',v2) = dist (v1,v2) /\ dist (v1',v4) = dist (v1,v4) /\ + dist (v2,v3') = dist (v2,v3) /\ dist (v3',v4) = dist (v3,v4) /\ + ~(segment [v1',v3'] INTER aff_ge {vec 0} {v2, v4} = {}))`, + REPEAT STRIP_TAC THEN + (* v1 about v2-v4 *) + MP_TAC (SPEC_ALL lemma_4_points_rotation2) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + EXISTS_TAC `v1':real^3` THEN + ASM_REWRITE_TAC[] THEN + + (* v3 about v2-v4 *) + MP_TAC (SPECL [`v3:real^3`; `v2:real^3`; `v1':real^3`; `v4:real^3`] lemma_4_points_rotation2) THEN + ASM_REWRITE_TAC[REAL_LE_REFL; DIST_SYM; SEGMENT_SYM] THEN + DISCH_THEN (X_CHOOSE_THEN `v3':real^3` MP_TAC) THEN REWRITE_TAC[DIST_SYM] THEN + STRIP_TAC THEN + EXISTS_TAC `v3':real^3` THEN + ASM_REWRITE_TAC[DIST_SYM] THEN + + POP_ASSUM MP_TAC THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY; IN_INTER] THEN + STRIP_TAC THEN + EXISTS_TAC `x:real^3` THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC Hypermap.lemma_in_subset THEN + EXISTS_TAC `convex hull {vec 0, v2, v4:real^3}` THEN + ASM_REWRITE_TAC[] THEN + UNDISCH_TAC `v2 IN ball_annulus` THEN + UNDISCH_TAC `v4 IN ball_annulus` THEN + SIMP_TAC[in_ball_annulus; aff_ge_0_2] THEN + REPEAT DISCH_TAC THEN + REWRITE_TAC[SUBSET; CONVEX_HULL_3_ALT; IN_ELIM_THM; VECTOR_SUB_RZERO; VECTOR_ADD_LID] THEN + REPEAT STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`u:real`; `v:real`] THEN + ASM_REWRITE_TAC[]);; + + + + +(******************************************************************************************) + + +(* Prove that a certain configuration of 4 points is impossible *) + +let lemma_4_points_circumcenter = prove(`!v1 v2 v3 v4. ~(collinear {vec 0,v2,v4}) /\ + v2 IN ball_annulus /\ v4 IN ball_annulus /\ + ~(segment [v1,v3] INTER aff_ge {vec 0} {v2,v4} = {}) /\ + norm v1 = &2 /\ norm v3 = &2 /\ + dist (v1,v2) = &2 /\ dist (v1,v4) = &2 /\ + dist (v3,v2) = &2 /\ dist (v3,v4) = &2 + ==> norm(v1 + v3) = &2 * eta_y (norm v2) (norm v4) (dist (v2,v4))`, + REWRITE_TAC[in_ball_annulus] THEN + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `!v w:real^3. norm v = &2 /\ dist (v,w) = &2 ==> v dot w = norm w pow 2 / &2` ASSUME_TAC THENL + [ + REWRITE_TAC[DIST_SQR; REAL_ARITH `&0 <= &2`] THEN + REWRITE_TAC[dist; NORM_POW_2] THEN + REWRITE_TAC[DOT_LSUB; DOT_RSUB; DOT_SQUARE_NORM; DOT_SYM] THEN + REPEAT GEN_TAC THEN + STRIP_TAC THEN POP_ASSUM MP_TAC THEN + ASM_REWRITE_TAC[] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + FIRST_ASSUM (MP_TAC o SPECL [`v1:real^3`; `v2:real^3`]) THEN + FIRST_ASSUM (MP_TAC o SPECL [`v1:real^3`; `v4:real^3`]) THEN + FIRST_ASSUM (MP_TAC o SPECL [`v3:real^3`; `v2:real^3`]) THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`v3:real^3`; `v4:real^3`]) THEN + ASM_REWRITE_TAC[DOT_SYM] THEN + REPEAT STRIP_TAC THEN + + ABBREV_TAC `v = inv(&2) % (v1 + v3:real^3)` THEN + + SUBGOAL_THEN `v:real^3 IN affine hull {vec 0,v2,v4}` ASSUME_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o check (is_neg o concl)) THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + REWRITE_TAC[IN_INTER; IN_SEGMENT] THEN + ASM_SIMP_TAC[aff_ge_0_2; IN_ELIM_THM] THEN + STRIP_TAC THEN + SUBGOAL_THEN `x:real^3 dot v1 = x dot v3` MP_TAC THENL + [ + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + ASM_REWRITE_TAC[DOT_LADD; DOT_LMUL; DOT_SYM]; + ALL_TAC + ] THEN + POP_ASSUM (LABEL_TAC "A" o SYM) THEN + ASM_REWRITE_TAC[DOT_LADD; DOT_LMUL] THEN + ASM_REWRITE_TAC[DOT_SYM; DOT_SQUARE_NORM; REAL_ARITH `&2 pow 2 = &4`] THEN + ONCE_REWRITE_TAC[REAL_ARITH `a = b <=> a - b = &0`] THEN + REWRITE_TAC[REAL_ARITH `((&1 - u) * &4 + u * a13) - ((&1 - u) * a13 + u * &4) = &2 * u * (a13 - &4) - (a13 - &4)`] THEN + + ASM_CASES_TAC `v1:real^3 dot v3 = &4` THENL + [ + DISCH_THEN (fun th -> ALL_TAC) THEN + SUBGOAL_THEN `norm (v3) % v1:real^3 = norm (v1) % v3` MP_TAC THENL + [ + REWRITE_TAC[GSYM NORM_CAUCHY_SCHWARZ_EQ] THEN + ASM_REWRITE_TAC[DOT_SYM] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[VECTOR_ARITH `&2 % v1 = &2 % v3 <=> v1 = v3`] THEN + DISCH_TAC THEN UNDISCH_TAC `x = (&1 - u) % v1 + u % v3:real^3` THEN + EXPAND_TAC "v" THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[VECTOR_ARITH `(&1 - u) % v1 + u % v1 = v1:real^3`] THEN + EXPAND_TAC "x" THEN + REWRITE_TAC[VECTOR_ARITH `inv(&2) % (v1 + v1) = v1:real^3`] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[AFFINE_HULL_3; IN_ELIM_THM] THEN + MAP_EVERY EXISTS_TAC [`&1 - t1 - t2`; `t1:real`; `t2:real`] THEN + CONJ_TAC THENL [ REAL_ARITH_TAC; ALL_TAC ] THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + DISCH_TAC THEN + SUBGOAL_THEN `u = inv(&2)` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + CONV_TAC REAL_FIELD; + ALL_TAC + ] THEN + + SUBGOAL_THEN `v = x:real^3` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "v" THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + EXPAND_TAC "x" THEN + REWRITE_TAC[AFFINE_HULL_3; IN_ELIM_THM] THEN + MAP_EVERY EXISTS_TAC [`&1 - t1 - t2`; `t1:real`; `t2:real`] THEN + CONJ_TAC THENL [ REAL_ARITH_TAC; ALL_TAC ] THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `dist (v:real^3,v2) = norm v /\ dist (v,v4) = norm v` ASSUME_TAC THENL + [ + REWRITE_TAC[DIST_SQR] THEN + REWRITE_TAC[dist; NORM_POS_LE; NORM_POW_2] THEN + REWRITE_TAC[DOT_LSUB; DOT_RSUB] THEN + REWRITE_TAC[REAL_ARITH `a - b - c = a <=> b + c = &0`] THEN + EXPAND_TAC "v" THEN + REWRITE_TAC[DOT_LMUL; DOT_RMUL; DOT_LADD; DOT_RADD] THEN + ASM_REWRITE_TAC[DOT_SYM; DOT_SQUARE_NORM] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `v:real^3 = circumcenter {vec 0,v2,v4}` ASSUME_TAC THENL + [ + MATCH_MP_TAC (GEN_ALL Collect_geom.DIST_EQ_IS_UNIQUE) THEN + MAP_EVERY EXISTS_TAC [`v2:real^3`; `v4:real^3`; `vec 0:real^3`] THEN + ASM_REWRITE_TAC[DIST_0] THEN + MP_TAC (SPECL [`vec 0:real^3`; `v2:real^3`; `v4:real^3`] Collect_geom.CIRCUMCENTER_PROPTIES) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + FIRST_ASSUM (MP_TAC o SPEC `vec 0:real^3`) THEN + SIMP_TAC[IN_INSERT; DIST_0] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + FIRST_ASSUM (MP_TAC o SPEC `v2:real^3`) THEN + FIRST_ASSUM (MP_TAC o SPEC `v4:real^3`) THEN + SIMP_TAC[IN_INSERT] THEN + REPEAT (DISCH_THEN (fun th -> ALL_TAC)) THEN + REWRITE_TAC[SUBSET; IN_INSERT; NOT_IN_EMPTY] THEN + GEN_TAC THEN + STRIP_TAC THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `norm (v:real^3) = radV {vec 0,v2,v4:real^3}` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[GSYM DIST_0; DIST_SYM] THEN + MP_TAC (GEN_ALL Collect_geom.NOT_COL_IMP_RADV_PROPERTIY) THEN + DISCH_THEN (MP_TAC o SPECL [`vec 0:real^3`; `v2:real^3`; `v4:real^3`]) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MATCH_MP_TAC o GSYM) THEN + ONCE_REWRITE_TAC[GSYM IN] THEN + REWRITE_TAC[IN_INSERT]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN + MP_TAC (SPECL [`v4:real^3`; `v2:real^3`; `vec 0:real^3`; `norm (v2:real^3)`; `norm (v4:real^3)`; `dist (v2:real^3,v4:real^3)`] Collect_geom.CDEUSDF) THEN + REWRITE_TAC[Collect_geom.dist3; DIST_0; DIST_SYM] THEN + SUBGOAL_THEN `{v4,v2,vec 0:real^3} = {vec 0,v2,v4}` (fun th -> ONCE_REWRITE_TAC[th]) THENL + [ + SET_TAC[]; + ALL_TAC + ] THEN + REMOVE_ASSUM THEN + ASM_REWRITE_TAC[] THEN + REPLICATE_TAC 2 (DISCH_THEN (CONJUNCTS_THEN2 (fun th -> ALL_TAC) MP_TAC)) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + EXPAND_TAC "v" THEN + REWRITE_TAC[NORM_MUL] THEN + REAL_ARITH_TAC);; + + + +let PARALLELOGRAM_LAW = prove(`!v1 v2:real^N. &2 * (norm v1 pow 2 + norm v2 pow 2) = norm (v1 + v2) pow 2 + norm (v1 - v2) pow 2`, + REPEAT GEN_TAC THEN + REWRITE_TAC[NORM_POW_2] THEN + VECTOR_ARITH_TAC);; + + + +let lemma_4_points_contradiction = prove(`!v1 v2 v3 v4. + v2 IN ball_annulus /\ v4 IN ball_annulus /\ + &2 <= dist (v2,v4) /\ dist (v2,v4) <= &2 * h0 /\ + ~(segment [v1,v3] INTER aff_ge {vec 0} {v2, v4} = {}) /\ + norm v1 = &2 /\ norm v3 = &2 /\ + dist (v1,v2) = &2 /\ dist (v1,v4) = &2 /\ + dist (v3,v2) = &2 /\ dist (v3,v4) = &2 /\ + dist (v1,v3) <= &2 * h0 + ==> F`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `~collinear {vec 0:real^3,v2,v4}` ASSUME_TAC THENL + [ + MATCH_MP_TAC estd_non_collinear_lemma THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MP_TAC (SPEC_ALL lemma_4_points_circumcenter) THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + MP_TAC (ISPECL [`v1:real^3`; `v3:real^3`] PARALLELOGRAM_LAW) THEN + ASM_REWRITE_TAC[GSYM dist] THEN + MATCH_MP_TAC (REAL_ARITH `a < b ==> ~(b = a)`) THEN + CONV_TAC REAL_RAT_REDUCE_CONV THEN + ONCE_REWRITE_TAC[REAL_ARITH `&16 = (&16 - (&2 * h0) pow 2) + (&2 * h0) pow 2`] THEN + MATCH_MP_TAC REAL_LTE_ADD2 THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `&4 * #2.2` THEN + CONJ_TAC THENL + [ + REWRITE_TAC[REAL_POW_MUL] THEN + MATCH_MP_TAC REAL_LE_MUL2 THEN + ASM_REWRITE_TAC[Collect_geom.REAL_LE_POW_2; REAL_ARITH `&2 pow 2 <= &4`] THEN + + MP_TAC Tame_inequalities.ETA_Y_4_POINTS_INEQ THEN + + REWRITE_TAC[Tame_inequalities.INEQ_ALT; ALL] THEN + DISCH_THEN MATCH_MP_TAC THEN + REPEAT (FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl))) THEN + ASM_SIMP_TAC[in_ball_annulus]; + ALL_TAC + ] THEN + REWRITE_TAC[Sphere.h0] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + REWRITE_TAC[GSYM REAL_LE_SQUARE_ABS] THEN + REWRITE_TAC[dist; REAL_ABS_NORM] THEN + REWRITE_TAC[GSYM dist] THEN + UNDISCH_TAC `dist(v1,v3:real^3) <= &2 * h0` THEN + REWRITE_TAC[Sphere.h0] THEN REAL_ARITH_TAC);; + + + +(* The final result *) + +let LEMMA_4_POINTS_FINAL = prove(`!v1 v2 v3 v4. v1 IN ball_annulus /\ v2 IN ball_annulus /\ v3 IN ball_annulus /\ v4 IN ball_annulus /\ + dist (v1, v3) <= &2 * h0 /\ dist (v2, v4) <= &2 * h0 /\ + &2 <= dist (v1,v2) /\ &2 <= dist (v1,v4) /\ + &2 <= dist (v2,v3) /\ &2 <= dist (v3,v4) /\ + &2 <= dist (v1,v3) /\ &2 <= dist (v2,v4) + ==> aff_ge {vec 0} {v1,v3} INTER aff_ge {vec 0} {v2,v4} = {vec 0}`, + REPEAT STRIP_TAC THEN + ASM_CASES_TAC `aff_ge {vec 0} {v1,v3} INTER aff_ge {vec 0} {v2,v4} = {vec 0:real^3}` THEN ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `?p. ~(p = vec 0:real^3) /\ p IN aff_ge {vec 0} {v1,v3} INTER aff_ge {vec 0} {v2,v4}` MP_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REWRITE_TAC[EXTENSION; IN_SING; NOT_FORALL_THM] THEN + DISCH_THEN (CHOOSE_THEN MP_TAC) THEN + ASM_CASES_TAC `x = vec 0:real^3` THENL + [ + ASM_REWRITE_TAC[IN_INTER; points_in_aff_ge_0_2]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + EXISTS_TAC `x:real^3` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + SUBGOAL_THEN `~(v1 = vec 0:real^3) /\ ~(v2 = vec 0:real^3) /\ ~(v3 = vec 0:real^3) /\ ~(v4 = vec 0:real^3)` ASSUME_TAC THENL + [ + REPEAT (FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl))) THEN + SIMP_TAC[in_ball_annulus]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[aff_ge_0_2; IN_ELIM_THM; IN_INTER] THEN + STRIP_TAC THEN + UNDISCH_TAC `p = t1 % v1 + t2 % v3:real^3` THEN + POP_ASSUM (LABEL_TAC "p2" o SYM) THEN + DISCH_THEN (LABEL_TAC "p1" o SYM) THEN + + SUBGOAL_THEN `!v v1 v2 v3 v4 t1 t2 t1' t2'. &0 <= t1 /\ &0 <= t2 /\ &0 <= t1' /\ &0 <= t2' /\ ~(v = vec 0) /\ + t1 % v1 + t2 % v3 = v /\ t1' % v2 + t2' % v4 = v /\ + t1' + t2' <= t1 + t2 + ==> ~(segment [v1,v3] INTER convex hull {vec 0,v2,v4:real^3} = {})` ASSUME_TAC THENL + [ + REPEAT REMOVE_ASSUM THEN + REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `&0 < t1 + t2` ASSUME_TAC THENL + [ + ASM_CASES_TAC `t1 = &0` THENL + [ + UNDISCH_TAC `t1 % v1 + t2 % v3:real^3 = v` THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID] THEN + ASM_CASES_TAC `t2 = &0` THENL + [ + POP_ASSUM (fun th -> REWRITE_TAC[th; VECTOR_MUL_LZERO; VECTOR_ADD_LID]) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + DISCH_TAC THEN + ASM_REWRITE_TAC[REAL_ADD_LID; REAL_LT_LE]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LTE_ADD THEN + ASM_REWRITE_TAC[REAL_LT_LE]; + ALL_TAC + ] THEN + + REWRITE_TAC[IN_INTER; IN_SEGMENT; CONVEX_HULL_3_ALT; IN_ELIM_THM] THEN + EXISTS_TAC `inv (t1 + t2) % v:real^3` THEN + CONJ_TAC THENL + [ + EXISTS_TAC `t2 * inv (t1 + t2)` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_INV THEN ASM_SIMP_TAC[REAL_LT_IMP_LE]; + ALL_TAC + ] THEN + + CONJ_TAC THENL + [ + REWRITE_TAC[GSYM real_div] THEN + MATCH_MP_TAC Trigonometry2.REAL_LE_LDIV THEN + ASM_REWRITE_TAC[REAL_ARITH `t2 <= t1 + t2 <=> &0 <= t1`]; + ALL_TAC + ] THEN + + UNDISCH_TAC `t1 % v1 + t2 % v3:real^3 = v` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + SUBGOAL_THEN `&1 - t2 * inv(t1 + t2) = t1 * inv (t1 + t2)` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC REAL_EQ_RCANCEL_IMP THEN + EXISTS_TAC `t1 + t2:real` THEN + REWRITE_TAC[REAL_SUB_RDISTRIB] THEN + ONCE_REWRITE_TAC[GSYM REAL_MUL_ASSOC] THEN + ASM_SIMP_TAC[REAL_ARITH `&0 < a ==> ~(a = &0)`; REAL_MUL_LINV] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + REWRITE_TAC[VECTOR_ADD_LID; VECTOR_SUB_RZERO] THEN + MAP_EVERY EXISTS_TAC [`inv (t1 + t2) * t1'`; `inv (t1 + t2) * t2'`] THEN + REWRITE_TAC[CONJ_ASSOC] THEN + CONJ_TAC THENL + [ + CONJ_TAC THENL + [ + CONJ_TAC THEN MATCH_MP_TAC REAL_LE_MUL THEN ASM_REWRITE_TAC[] THEN MATCH_MP_TAC REAL_LE_INV THEN ASM_SIMP_TAC[REAL_LT_IMP_LE]; + ALL_TAC + ] THEN + + REWRITE_TAC[GSYM REAL_ADD_LDISTRIB; REAL_MUL_AC; GSYM real_div] THEN + MATCH_MP_TAC Trigonometry2.REAL_LE_LDIV THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + UNDISCH_TAC `t1' % v2 + t2' % v4:real^3 = v` THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + VECTOR_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `?v1 v2 v3 v4. v1 IN ball_annulus /\ v2 IN ball_annulus /\ v3 IN ball_annulus /\ v4 IN ball_annulus /\ + dist (v1,v3) <= &2 * h0 /\ dist (v2,v4) <= &2 * h0 /\ + &2 <= dist (v1,v2) /\ &2 <= dist (v1,v4) /\ + &2 <= dist (v2,v3) /\ &2 <= dist (v3,v4) /\ + &2 <= dist (v2,v4) /\ + ~(segment [v1,v3] INTER convex hull {vec 0,v2,v4} = {})` MP_TAC THENL + [ + ASM_CASES_TAC `t1' + t2' <= t1 + t2:real` THENL + [ + MAP_EVERY EXISTS_TAC [`v1:real^3`; `v2:real^3`; `v3:real^3`; `v4:real^3`] THEN + ASM_REWRITE_TAC[] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MAP_EVERY EXISTS_TAC [`p:real^3`; `t1:real`; `t2:real`; `t1':real`; `t2':real`] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + POP_ASSUM MP_TAC THEN REWRITE_TAC[REAL_NOT_LE] THEN + DISCH_TAC THEN + MAP_EVERY EXISTS_TAC [`v2:real^3`; `v1:real^3`; `v4:real^3`; `v3:real^3`] THEN + ASM_REWRITE_TAC[DIST_SYM] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + MAP_EVERY EXISTS_TAC [`p:real^3`; `t1':real`; `t2':real`; `t1:real`; `t2:real`] THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE]; + ALL_TAC + ] THEN + + REPEAT REMOVE_ASSUM THEN + STRIP_TAC THEN + + (* First rotation *) + MP_TAC (SPEC_ALL lemma_4_points_rotation2_full) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + + (* Second rotation *) + MP_TAC (SPECL [`v1':real^3`; `v2:real^3`; `v3':real^3`; `v4:real^3`] lemma_4_points_rotation1_full) THEN + ASM_REWRITE_TAC[] THEN + MAP_EVERY (fun tm -> REPEAT (FIRST_X_ASSUM ((fun th -> ALL_TAC) o check (free_in tm o concl)))) [`v1:real^3`; `v3:real^3`; `v1':real^3`; `v3':real^3`] THEN + + STRIP_TAC THEN + MATCH_MP_TAC lemma_4_points_contradiction THEN + MAP_EVERY EXISTS_TAC [`v1'':real^3`; `v2:real^3`; `v3'':real^3`; `v4:real^3`] THEN + ASM_REWRITE_TAC[DIST_SYM]);; + + + + +end;; diff --git a/text_formalization/tame/CRTTXAT.hl b/text_formalization/tame/CRTTXAT.hl new file mode 100644 index 0000000..f628f3e --- /dev/null +++ b/text_formalization/tame/CRTTXAT.hl @@ -0,0 +1,584 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Tame Hypermap *) +(* Author: Alexey Solovyev *) +(* Date: 2010-06-17 *) +(* ========================================================================== *) + +(******************************) +(* Proof of CRTTXAT (tame_9a) *) +(******************************) + + +flyspeck_needs "tame/TameGeneral.hl";; +flyspeck_needs "tame/ArcProperties.hl";; + + +module Crttxat_tame = struct + + +open Fan_defs;; +open Tame_defs;; +open Tame_general;; +open Hypermap_and_fan;; +open Arc_properties;; + + + +(* An auxiliary result about sums over a face *) +let ORBIT_MAP_PAIR_SUM_lemma = prove(`!P s f g (x:A#A). FINITE s /\ f permutes s /\ + (!y. y IN orbit_map f x ==> f y = (SND y, g y)) + ==> sum (orbit_map f x) (\x. P (FST x)) = sum (orbit_map f x) (\x. P (SND x))`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `k = CARD (orbit_map f (x:A#A))` THEN + MP_TAC (ISPECL [`(\x:A#A. (P:A->real) (FST x))`; `s:A#A->bool`; `f:A#A->A#A`; `x:A#A`; `k:num`; `1`] SUM_ORBIT) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MP_TAC (ISPECL [`(\x:A#A. (P:A->real) (SND x))`; `s:A#A->bool`; `f:A#A->A#A`; `x:A#A`; `k:num`; `0`] SUM_ORBIT) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[ARITH_RULE `1 + k - 1 = (k - 1) + 1`] THEN + GEN_REWRITE_TAC (DEPTH_CONV o (PAT_CONV `\x. sum (x..m) f`)) [ARITH_RULE `1 = 0 + 1`] THEN + REWRITE_TAC[SUM_OFFSET; ARITH_RULE `0 + a = a`] THEN + MATCH_MP_TAC SUM_EQ THEN + X_GEN_TAC `i:num` THEN BETA_TAC THEN + REWRITE_TAC[ARITH_RULE `i + 1 = 1 + i`] THEN + REWRITE_TAC[Hypermap.addition_exponents; Hypermap.POWER_1; o_THM] THEN + ABBREV_TAC `y:A#A = (f POWER i) x` THEN + SUBGOAL_THEN `y:A#A IN orbit_map f x` ASSUME_TAC THENL + [ + EXPAND_TAC "y" THEN + REWRITE_TAC[Hypermap.lemma_in_orbit]; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o SPEC `y:A#A`) THEN + ASM_SIMP_TAC[]);; + + + + +let FACE_SUM_lemma = prove(`!V E x P. FAN (vec 0,V,E) /\ x IN dart1_of_fan (V,E) + ==> sum (face (hypermap_of_fan (V,E)) x) (\x. P (FST x)) = + sum (face (hypermap_of_fan (V,E)) x) (\x. P (SND x))`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[Hypermap.face] THEN + MATCH_MP_TAC ORBIT_MAP_PAIR_SUM_lemma THEN + EXISTS_TAC `dart (hypermap_of_fan (V,E))` THEN + EXISTS_TAC `(\x. SND (face_map (hypermap_of_fan (V,E)) x))` THEN + REWRITE_TAC[Hypermap.hypermap_lemma; GSYM Hypermap.face] THEN + ASM_SIMP_TAC[Hypermap.face_map; HYPERMAP_OF_FAN] THEN + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `y IN dart1_of_fan (V:real^3->bool,E)` ASSUME_TAC THENL + [ + MATCH_MP_TAC Hypermap.lemma_in_subset THEN + EXISTS_TAC `face (hypermap_of_fan (V,E)) x` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC FACE_SUBSET_DART1_OF_FAN THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[f_fan_pair_ext] THEN + MP_TAC (ISPEC `y:real^3#real^3` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[f_fan_pair]);; + + + + + +let CRTTXAT_lemma1 = prove(`!V f. simple_hypermap (hypermap_of_fan (V,ESTD V)) ==> + contravening V /\ f IN face_set (hypermap_of_fan (V,ESTD V)) ==> + sum f (\x. lmfun (h_dart x)) >= &12 + &(CARD f) - &(CARD V)`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + DISCH_THEN (CONJUNCTS_THEN2 (LABEL_TAC "A") MP_TAC) THEN + MP_TAC (SPEC_ALL CONTRAVENING_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + USE_THEN "A" MP_TAC THEN + REWRITE_TAC[contravening] THEN + REPLICATE_TAC 2 (DISCH_THEN (CONJUNCTS_THEN2 (fun th -> ALL_TAC) MP_TAC)) THEN + DISCH_THEN (CONJUNCTS_THEN2 MP_TAC (fun th -> ALL_TAC)) THEN + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `sum f (\x:real^3#real^3. lmfun (h_dart x)) = sum {FST x | x IN f} (\v. lmfun ((norm v) / &2))` ASSUME_TAC THENL + [ + REWRITE_TAC[IMAGE_LEMMA; h_dart] THEN + SUBGOAL_THEN `(\x:real^3#real^3. lmfun (norm (FST x) / &2)) = (\v. lmfun (norm v / &2)) o FST` ASSUME_TAC THENL + [ + REWRITE_TAC[FUN_EQ_THM; o_THM]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC EQ_SYM THEN + MATCH_MP_TAC SUM_IMAGE THEN + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL (SPECL [`V:real^3->bool`; `ESTD V`] HYPERMAP_OF_FAN_FACE_NODE_INJ)) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + ABBREV_TAC `A = {FST (x:real^3#real^3) | x IN f}` THEN + + SUBGOAL_THEN `A:real^3->bool SUBSET V` ASSUME_TAC THENL + [ + EXPAND_TAC "A" THEN REWRITE_TAC[SUBSET; IN_ELIM_THM] THEN + X_GEN_TAC `v:real^3` THEN DISCH_THEN (CHOOSE_THEN MP_TAC) THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[Hypermap.face_set; Hypermap.set_of_orbits; GSYM Hypermap.face; IN_ELIM_THM] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + SUBGOAL_THEN `x:real^3#real^3 IN dart (hypermap_of_fan (V,ESTD V))` MP_TAC THENL + [ + MATCH_MP_TAC Hypermap.lemma_in_subset THEN + EXISTS_TAC `f:real^3#real^3->bool` THEN + ASM_SIMP_TAC[Hypermap.lemma_face_subset]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN] THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `ESTD V`; `x'':real^3`; `y:real^3`] PAIR_IN_DART_OF_FAN) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `A:real^3->bool = V DIFF (V DIFF A)` MP_TAC THENL + [ + MATCH_MP_TAC DIFF_LEMMA THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> ONCE_REWRITE_TAC[th]) THEN + SUBGOAL_THEN `FINITE (V:real^3->bool)` ASSUME_TAC THENL + [ + UNDISCH_TAC `FAN (vec 0, V, ESTD V)` THEN + SIMP_TAC[Fan_defs.FAN; Fan_defs.fan1]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `sum (V DIFF (V DIFF A)) (\v:real^3. lmfun (norm v / &2)) = scriptL V - sum (V DIFF A) (\v. lmfun (norm v / &2))` MP_TAC THENL + [ + REWRITE_TAC[scriptL] THEN + MATCH_MP_TAC SUM_DIFF THEN + ASM_REWRITE_TAC[SUBSET_DIFF]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MATCH_MP_TAC (REAL_ARITH `a >= c /\ b <= --d ==> a - b >= c + d`) THEN + FIRST_X_ASSUM (MP_TAC o check (fun th -> rand (concl th) = `&12`)) THEN + SIMP_TAC[real_ge; real_gt; REAL_LT_IMP_LE] THEN DISCH_TAC THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `&(CARD (V:real^3->bool DIFF A)) * &1` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC SUM_BOUND THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC FINITE_DIFF THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + X_GEN_TAC `v:real^3` THEN REWRITE_TAC[IN_DIFF] THEN + STRIP_TAC THEN + MP_TAC (SPEC_ALL CONTRAVENING_LMFUN_BOUND) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `CARD (V:real^3->bool DIFF A) = CARD V - CARD A /\ CARD A <= CARD V` MP_TAC THENL + [ + CONJ_TAC THENL + [ + MATCH_MP_TAC CARD_DIFF THEN + ASM_REWRITE_TAC[]; + MATCH_MP_TAC CARD_SUBSET THEN + ASM_REWRITE_TAC[] + ]; + ALL_TAC + ] THEN + + STRIP_TAC THEN + MP_TAC (SPECL [`CARD (A:real^3->bool)`; `CARD (V:real^3->bool)`] REAL_OF_NUM_SUB) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th; REAL_MUL_RID; REAL_NEG_SUB]) THEN + SUBGOAL_THEN `CARD (A:real^3->bool) = CARD (f:real^3#real^3->bool)` MP_TAC THENL + [ + EXPAND_TAC "A" THEN + REWRITE_TAC[IMAGE_LEMMA] THEN + MATCH_MP_TAC CARD_IMAGE_INJ THEN + CONJ_TAC THENL + [ + REPEAT GEN_TAC THEN + MP_TAC (SPEC_ALL (SPECL [`V:real^3->bool`; `ESTD V`] HYPERMAP_OF_FAN_FACE_NODE_INJ)) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl)) THEN + REWRITE_TAC[Hypermap.face_set; Hypermap.set_of_orbits; GSYM Hypermap.face] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[Hypermap.FACE_FINITE]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[REAL_LE_REFL]);; + + + + + + + +(* Another expression for the perimeter of f *) +let CRTTXAT_lemma2 = prove(`!V f. FAN (vec 0,V,ESTD V) /\ f IN face_set (hypermap_of_fan (V,ESTD V)) + ==> sum f (\(v,w). arcV (vec 0) v w) = sum f (\(v,w). arclength (norm v) (norm w) (dist (v,w)))`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC SUM_EQ THEN + GEN_TAC THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `v:real^3` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `w:real^3` ASSUME_TAC) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + REWRITE_TAC[GSYM DIST_0] THEN + MATCH_MP_TAC Trigonometry1.arcVarc THEN + + SUBGOAL_THEN `(v,w) IN dart_of_fan (V,ESTD V)` ASSUME_TAC THENL + [ + MATCH_MP_TAC Hypermap.lemma_in_subset THEN + EXISTS_TAC `f:real^3#real^3->bool` THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl)) THEN + REWRITE_TAC[Hypermap.face_set; Hypermap.set_of_orbits; GSYM Hypermap.face; IN_ELIM_THM] THEN + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN] THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC FACE_SUBSET_DART_OF_FAN THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPECL [`V:real^3->bool`; `ESTD V`; `v:real^3`; `w:real^3`] PAIR_IN_DART_OF_FAN) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o check (fun th -> rand (concl th) = `(vec 0:real^3,V,ESTD V)`)) THEN + REWRITE_TAC[Fan_defs.FAN; Fan_defs.fan2] THEN + POP_ASSUM MP_TAC THEN + SET_TAC[]);; + + + +(* A variation of the first lemma *) +let CRTTXAT_lemma1' = prove(`!V f. simple_hypermap (hypermap_of_fan (V,ESTD V)) ==> + contravening V /\ f IN face_set (hypermap_of_fan (V,ESTD V)) ==> + sum f (\x. lmfun (norm (SND x) / &2)) >= &12 + &(CARD f) - &(CARD V)`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL CONTRAVENING_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + SUBGOAL_THEN `sum f (\x:real^3#real^3. lmfun (norm (SND x) / &2)) = sum f (\x. lmfun (h_dart x))` (fun th -> REWRITE_TAC[th]) THENL + [ + FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl)) THEN + REWRITE_TAC[Hypermap.face_set; Hypermap.set_of_orbits; GSYM Hypermap.face] THEN + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN] THEN + REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN + ASM_REWRITE_TAC[h_dart] THEN + MATCH_MP_TAC (GSYM FACE_SUM_lemma) THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC CONTRAVENING_IMP_IN_DART1_OF_FAN THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MP_TAC (SPEC_ALL CRTTXAT_lemma1) THEN + ASM_SIMP_TAC[]);; + + + + + +(* LEMMA: aux *) +let SUM_RMUL_BOUND = prove(`!(s:A->bool) f g c. FINITE s /\ + (!x. x IN s ==> c <= g x /\ &0 <= f x) + ==> sum s (\x. f x) * c <= sum s (\x. f x * g x)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[GSYM SUM_RMUL] THEN + MATCH_MP_TAC SUM_LE THEN + ASM_REWRITE_TAC[] THEN GEN_TAC THEN + DISCH_TAC THEN + MATCH_MP_TAC REAL_LE_LMUL THEN + ASM_SIMP_TAC[]);; + + + + +(* Main theorem *) +let CRTTXAT_concl = `!V. contravening V /\ (perimeterbound (V, ESTD V))==> + tame_9a (hypermap_of_fan (V, ESTD V))`;; + + + +let CRTTXAT_assum = mk_imp (list_mk_conj [`!V. contravening V ==> simple_hypermap (hypermap_of_fan (V,ESTD V))`], CRTTXAT_concl);; + + +(* g(CRTTXAT_assum);; *) +let CRTTXAT = prove(CRTTXAT_assum, + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `V:real^3->bool`) THEN + MP_TAC (SPEC_ALL CONTRAVENING_FAN) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN DISCH_TAC THEN + + REWRITE_TAC[tame_9a] THEN + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN] THEN + REPEAT STRIP_TAC THENL + [ + MP_TAC (SPEC_ALL CONTRAVENING_IMP_CARD_FACE_GE_3) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o SPEC `x:real^3#real^3`) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + ABBREV_TAC `f = face (hypermap_of_fan (V,ESTD V)) x` THEN + ABBREV_TAC `k = CARD (f:real^3#real^3->bool)` THEN + + FIRST_X_ASSUM (MP_TAC o check (fun th -> rator (concl th) = `perimeterbound`)) THEN + REWRITE_TAC[perimeterbound] THEN + DISCH_THEN (MP_TAC o SPEC `f:(real^3#real^3->bool)`) THEN + + SUBGOAL_THEN `f IN face_set_of_fan (V,ESTD V) /\ FINITE f` MP_TAC THENL + [ + EXPAND_TAC "f" THEN REWRITE_TAC[Hypermap.FACE_FINITE] THEN + REWRITE_TAC[face_set_of_fan; Hypermap.face_set; Hypermap.set_of_orbits; GSYM Hypermap.face] THEN + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + EXISTS_TAC `x:real^3#real^3` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SIMP_TAC[face_set_of_fan] THEN DISCH_TAC THEN + MP_TAC (SPEC_ALL CRTTXAT_lemma2) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_TAC THEN + + SUBGOAL_THEN `!v w. (v:real^3,w:real^3) IN f ==> &2 <= norm v /\ norm v <= #2.52 /\ &2 <= norm w /\ norm w <= #2.52 /\ &2 <= dist (v,w) /\ dist (v,w) <= #2.52` ASSUME_TAC THENL + [ + REPEAT GEN_TAC THEN DISCH_TAC THEN + SUBGOAL_THEN `v,w IN dart_of_fan (V,ESTD V)` ASSUME_TAC THENL + [ + MATCH_MP_TAC Hypermap.lemma_in_subset THEN + EXISTS_TAC `f:real^3#real^3->bool` THEN + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "f" THEN + MATCH_MP_TAC FACE_SUBSET_DART_OF_FAN THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + SUBGOAL_THEN `v:real^3 IN V /\ w IN V` ASSUME_TAC THENL + [ + MATCH_MP_TAC PAIR_IN_DART_OF_FAN THEN + EXISTS_TAC `ESTD V` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPEC_ALL CONTRAVENING_DIST) THEN + MP_TAC (SPECL [`V:real^3->bool`; `w:real^3`] CONTRAVENING_DIST) THEN + MP_TAC (SPECL [`V:real^3->bool`; `v:real^3,w:real^3`] CONTRAVENING_DART_DIST) THEN + ASM_REWRITE_TAC[DIST_0; REAL_ARITH `&2 = #2.0`] THEN + SIMP_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `sum f (\x:real^3#real^3. arclength (#2.52) (norm (SND x)) (&2) + lmfun (h_dart x) * (arclength (&2) (norm (SND x)) (&2) - arclength (#2.52) (norm (SND x)) (&2))) <= &2 * pi` MP_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `sum f (\(v:real^3,w:real^3). arclength (norm v) (norm w) (&2))` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC SUM_LE THEN + ASM_REWRITE_TAC[] THEN + GEN_TAC THEN + MP_TAC (ISPEC `x':real^3#real^3` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `v:real^3` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `w:real^3` ASSUME_TAC) THEN + ASM_REWRITE_TAC[GSYM real_ge] THEN DISCH_TAC THEN + REWRITE_TAC[h_dart] THEN + MATCH_MP_TAC arc_lemma3 THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`v:real^3`; `w:real^3`]) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `sum f (\(v:real^3,w:real^3). arclength (norm v) (norm w) (dist (v,w)))` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC SUM_LE THEN + ASM_REWRITE_TAC[] THEN GEN_TAC THEN + MP_TAC (ISPEC `x':real^3#real^3` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MATCH_MP_TAC arc_lemma1 THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`x'':real^3`; `y:real^3`]) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[SUM_ADD] THEN + ABBREV_TAC `s1 = sum f (\x:real^3#real^3. arclength #2.52 #2.52 (&2) + lmfun (norm (SND x) / &2) * (arclength #2.52 (&2) (&2) - arclength #2.52 #2.52 (&2)))` THEN + ABBREV_TAC `s2 = sum f (\x:real^3#real^3. arclength #2.52 (norm (SND x)) (&2))` THEN + ABBREV_TAC `s3 = sum f (\x:real^3#real^3. lmfun (h_dart x) * (arclength (&2) (norm (SND x)) (&2) - arclength #2.52 (norm (SND x)) (&2)))` THEN + DISCH_TAC THEN + + SUBGOAL_THEN `s1:real <= s2` ASSUME_TAC THENL + [ + EXPAND_TAC "s1" THEN EXPAND_TAC "s2" THEN + MATCH_MP_TAC SUM_LE THEN + ASM_REWRITE_TAC[] THEN GEN_TAC THEN + MP_TAC (ISPEC `x':real^3#real^3` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + REWRITE_TAC[GSYM real_ge] THEN + MP_TAC (SPECL [`norm (y:real^3)`; `#2.52`] arc_lemma3) THEN + REWRITE_TAC[arc_sym] THEN + DISCH_THEN MATCH_MP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`x'':real^3`; `y:real^3`]) THEN + ASM_SIMP_TAC[] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `(&12 + &k - &(CARD (V:real^3->bool))) * #0.073 <= s3` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `sum f (\x:real^3#real^3. lmfun (h_dart x)) * #0.073` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_RMUL THEN + MP_TAC (SPEC_ALL CRTTXAT_lemma1) THEN + ASM_SIMP_TAC[REAL_ARITH `&0 <= #0.073`; real_ge]; + ALL_TAC + ] THEN + + EXPAND_TAC "s3" THEN + MATCH_MP_TAC SUM_RMUL_BOUND THEN + ASM_REWRITE_TAC[] THEN + GEN_TAC THEN MP_TAC (ISPEC `x':real^3#real^3` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + CONJ_TAC THENL + [ + REWRITE_TAC[GSYM real_ge] THEN + MATCH_MP_TAC arc_lemma4 THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`x'':real^3`; `y:real^3`]) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[h_dart; Pack_defs.lmfun; Pack_defs.h0] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `(&k) * (arclength #2.52 #2.52 (&2)) + (&12 + &k - &(CARD (V:real^3->bool))) * #0.073 <= s1` ASSUME_TAC THENL + [ + REPLICATE_TAC 5 REMOVE_ASSUM THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[SUM_ADD] THEN + ASM_SIMP_TAC[SUM_CONST] THEN + REWRITE_TAC[REAL_ARITH `a + b <= a + c <=> b <= c`] THEN + REWRITE_TAC[SUM_RMUL] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `sum f (\x:real^3#real^3. lmfun (norm (SND x) / &2)) * #0.073` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_RMUL THEN + REWRITE_TAC[REAL_ARITH `&0 <= #0.073`; GSYM real_ge] THEN + MP_TAC (SPEC_ALL CRTTXAT_lemma1') THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_LMUL THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC SUM_POS_LE THEN + ASM_REWRITE_TAC[Pack_defs.lmfun; Pack_defs.h0] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + REWRITE_TAC[GSYM real_ge] THEN + MP_TAC (SPEC `#2.52` arc_lemma4) THEN + REWRITE_TAC[arc_sym] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `&k * arclength #2.52 #2.52 (&2) + (&2) * (&12 + &k - &(CARD (V:real^3->bool))) * #0.073 <= &2 * pi` MP_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `(s1:real) + s3` THEN + CONJ_TAC THENL + [ + REWRITE_TAC[REAL_ARITH `c + &2 * a * b = (c + a * b) + a * b`] THEN + MATCH_MP_TAC REAL_LE_ADD2 THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `(s2:real) + s3` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_ADD2 THEN + ASM_REWRITE_TAC[REAL_LE_REFL]; + ALL_TAC + ] THEN + + DISCH_TAC THEN + SUBGOAL_THEN `&k * (arclength #2.52 #2.52 (&2) + #0.146) <= &2 * pi + (&(CARD (V:real^3->bool)) - &12) * #0.146` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `&k * (#0.816 + #0.146) <= &2 * #3.1416 + &3 * #0.146` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `&k * (arclength #2.52 #2.52 (&2) + #0.146)` THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LE_LMUL THEN + REWRITE_TAC[REAL_ARITH `&0 <= &k`; REAL_ARITH `a + b <= c + b <=> a <= c`] THEN + ASM_REWRITE_TAC[GSYM real_ge; arc_lemma5]; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `&2 * pi + (&(CARD (V:real^3->bool)) - &12) * #0.146` THEN + CONJ_TAC THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC REAL_LE_ADD2 THEN + CONJ_TAC THENL + [ + MP_TAC PI_APPROX_32 THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + MATCH_MP_TAC REAL_LE_RMUL THEN + REWRITE_TAC[REAL_ARITH `&0 <= #0.146`; REAL_ARITH `a - &12 <= &3 <=> a <= &15`] THEN + REWRITE_TAC[REAL_OF_NUM_LE] THEN + FIRST_X_ASSUM (MP_TAC o check (fun th -> rator (concl th) = `contravening`)) THEN + REWRITE_TAC[contravening] THEN + SIMP_TAC[ARITH_RULE `a = 13 \/ a = 14 \/ a = 15 ==> a <= 15`]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `&k <= #6.99` MP_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + DISJ_CASES_TAC (ARITH_RULE `k <= 6 \/ 7 <= k`) THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[GSYM REAL_OF_NUM_LE] THEN + REAL_ARITH_TAC);; + + + + + +end;; diff --git a/text_formalization/tame/FATUGPD.hl b/text_formalization/tame/FATUGPD.hl new file mode 100755 index 0000000..36afe91 --- /dev/null +++ b/text_formalization/tame/FATUGPD.hl @@ -0,0 +1,1580 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALISATION *) +(* *) +(* Lemma: FATUGPD *) +(* Chapter: Tame *) +(* Author: Vuong Anh Quyen *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + +flyspeck_needs "hypermap/hypermap.hl";; +flyspeck_needs "fan/fan_defs.hl";; +flyspeck_needs "fan/planarity.hl";; +flyspeck_needs "leg/geomdetail.hl";; +flyspeck_needs "packing/pack2.hl";; (* for KIUMVTC *) +flyspeck_needs "packing/pack_defs.hl";; (* for h0 def and others *) +flyspeck_needs "trigonometry/trig1.hl";; +flyspeck_needs "general/prove_by_refinement.hl";; +flyspeck_needs "tame/tame_concl.hl";; +flyspeck_needs "tame/tame_defs.hl";; (* was commented out *) + +module Fatugpd = struct + +open Hypermap;; +open Fan_defs;; +open Fan;; +open Planarity;; +open Pack_defs;; +open Pack1;; +open Pack2;; +open Tame_defs;; +open Trigonometry1;; +open Tame_defs;; +open Prove_by_refinement;; + +let JBDNJJB = Planarity.JBDNJJB;; + +(* my assumptions *) + + let UBHDEUU2_concl = Tame_concl.UBHDEUU2_concl;; + + let UBHDEUU2_hypothesis = new_definition (mk_eq(`UBHDEUU2_hypothesis:bool`,UBHDEUU2_concl));; + + let UBHDEUU2_quasi = UNDISCH(MATCH_MP (TAUT `(x = y) ==> (x ==> y)`) UBHDEUU2_hypothesis);; + + + (* my tatics *) + +let Q_LABEL_TAC term phr = UNDISCH_THEN term (LABEL_TAC phr);; + +let Q_ABBREV_TAC term str = (ABBREV_TAC term) THEN + FIRST_X_ASSUM (LABEL_TAC str);; + +let Q_EXPAND_TAC str = (USE_THEN str (fun thm -> ONCE_REWRITE_TAC[GSYM thm]));; + +(* some of my lemmas that may help others *) +let NOT_EMPTY_IMAGE = prove +( ` !(S:A -> bool) (f:A->B). ~( S = {}) ==> ~( IMAGE f S = {})`, SET_TAC[]);; + +(* lemma about sup of function on finite set *) +let finite_num_func_attain_max = +prove_by_refinement( +`! (S:A->bool) (f:A->num). FINITE S /\ ~ (S = {}) + ==> (? x. x IN S /\ (! y. y IN S ==> f y <= f x))`, +[ + (REPEAT STRIP_TAC); + +(* subgoal 1 *) + (SUBGOAL_THEN +` FINITE (IMAGE (& o(f:A->num)) (S:A->bool)) /\ ~ (IMAGE (& o f) S = {})` +ASSUME_TAC); + CONJ_TAC; +(* subgoal 1.1 *) + (ASM_SIMP_TAC[FINITE_IMAGE]); +(* subgoal 2.1 *) + (ASM_SIMP_TAC[NOT_EMPTY_IMAGE]); + + (FIRST_ASSUM(MP_TAC o (MATCH_MP SUP_FINITE))); + (CONV_TAC(PAT_CONV `\k. _ IN k /\ _ ==> _` (REWRITE_CONV[IMAGE]))); + (PURE_REWRITE_TAC[IN_ELIM_THM]); + STRIP_TAC; + (EXISTS_TAC `x:A`); + (ASM_SIMP_TAC[]); + (REPEAT STRIP_TAC); + (FIRST_X_ASSUM(MP_TAC o SPEC ` (& o (f:A->num)) y`)); + +(* subgoal 2 *) + (SUBGOAL_THEN ` (& o (f:A->num)) y IN IMAGE (& o f) S` ASSUME_TAC); + (PURE_REWRITE_TAC[IMAGE;IN_ELIM_THM]); + (EXISTS_TAC `y:A` THEN ASM_SIMP_TAC[]); + + (ASM_SIMP_TAC[o_THM; REAL_OF_NUM_LE]); +]);; + + +(* lemma about property of sup *) +let sup_property1 = prove_by_refinement( +`! (S:real->bool). ~(S = {}) /\(?b. !x. x IN S ==> x <= b) ==> + (! epsilon. epsilon > &0 ==> ?x. x IN S /\ x > sup S - epsilon)`, +[ +(GEN_TAC THEN DISCH_THEN (MP_TAC o (MATCH_MP SUP))); +(STRIP_TAC THEN GEN_TAC); +(DISCH_THEN (ASSUME_TAC o (MATCH_MP (ARITH_RULE +` epsilon > &0 ==> ~ ( sup (S:real->bool) <= sup S - epsilon)`)))); +(MATCH_MP_TAC (MESON[] +`! (P:A->bool) (Q:A->bool). ~(!(x:A). P x ==> ~ (Q x)) + ==> (?(x:A). P x /\ Q x)`)); +(PURE_REWRITE_TAC[ARITH_RULE +`~(x > sup S - epsilon) <=> x <= sup S - epsilon`]); +(ASM_MESON_TAC[]);]);; + + +(* lemma about maximal of num bounded function *) + +let bdd_num_func_attain_max = prove_by_refinement( +`! (S:A ->bool) (f:A-> num). ~(S = {})/\(?m. !x. x IN S ==> f x <= m) + ==> (?x. x IN S /\ (!y. y IN S ==> f y <= f x))`, +[ +(REPEAT STRIP_TAC); +(* subgoal 1 *) +(SUBGOAL_THEN `~( IMAGE (& o (f:A->num)) (S:A->bool) = {}) + /\ (? b. ! y. y IN (IMAGE (& o f) S) ==> y <= b)` ASSUME_TAC); +(CONJ_TAC); + +(* subgoal 1.1 *) +(ASM_SET_TAC[]); + +(* subgoal 1.2 *) +(EXISTS_TAC `& (m:num)`); +(PURE_REWRITE_TAC[IN_ELIM_THM;IMAGE;o_THM]); +(REPEAT STRIP_TAC); +(ONCE_ASM_REWRITE_TAC[]); +(ASM_SIMP_TAC[REAL_OF_NUM_LE]); + +(FIRST_ASSUM (MP_TAC o MATCH_MP SUP)); +(ABBREV_TAC `p = sup (IMAGE (& o (f:A->num)) (S:A->bool))` THEN STRIP_TAC); +(* subgoal 2 *) +(SUBGOAL_THEN +`?z. z IN (IMAGE (& o (f:A->num)) (S:A->bool)) /\ z > p - &1` MP_TAC); +(EXPAND_TAC "p"); +(FIRST_ASSUM (MP_TAC o (SPEC `&1`) o (MATCH_MP sup_property1))); +(SIMP_TAC[ARITH_RULE `&1 > &0`]); + +(PURE_REWRITE_TAC[IN_ELIM_THM;IMAGE;o_THM] THEN STRIP_TAC ); +(EXISTS_TAC `x:A`); +(ASM_SIMP_TAC[] THEN REPEAT STRIP_TAC); +(MATCH_MP_TAC (ARITH_RULE ` n < (m:num) + 1 ==> n <= m`)); +(* subgoal 3 *) +(SUBGOAL_THEN +`&((f:A->num) y) IN (IMAGE (& o f) (S:A->bool))` ASSUME_TAC); +(ASM_SIMP_TAC[IN_ELIM_THM;o_THM;IMAGE]); +(EXISTS_TAC `y:A`); +(ASM_SIMP_TAC[]); + +(* subgoal 4 *) +(SUBGOAL_THEN `&((f:A->num) y) <= p` ASSUME_TAC); +(ASM_SIMP_TAC[]); + +(MATCH_MP_TAC + (fst(EQ_IMP_RULE (SPECL [`(f:A->num) y`;`f x + 1`] REAL_OF_NUM_LT)))); +(PURE_REWRITE_TAC[GSYM REAL_OF_NUM_ADD]); +(ASM_ARITH_TAC); +]);; + + +let BIJ_CARD_EQ = prove +( `! (V:A->bool) (U:B->bool) (f:A->B). FINITE V /\ BIJ f V U + ==> CARD U = CARD V`, +REPEAT GEN_TAC THEN REWRITE_TAC[BIJ;INJ;SURJ] THEN STRIP_TAC THEN +MATCH_MP_TAC CARD_EQ_CARD_IMP THEN ASM_SIMP_TAC[] THEN +ONCE_REWRITE_TAC[CARD_EQ_SYM] THEN REWRITE_TAC[eq_c] +THEN EXISTS_TAC `f:A->B` THEN ASM_MESON_TAC[]);; + + +(* another property of sup *) +let SUP_lt = prove_by_refinement( +`! (S:real -> bool) (b:real). +~(S = {}) /\ FINITE S /\ (!x. x IN S ==> x < b) ==> sup S < b`, +[ +(REPEAT STRIP_TAC); +(FIRST_ASSUM (fun thm -> (MATCH_MP_TAC thm))); +(ASM_SIMP_TAC[SUP_FINITE]); +]);; + + +(* epsilon lemma *) +let epsilon_lemma = prove_by_refinement( + `! (a:real) b. a < b ==> ? epsilon. epsilon > &0 /\ b > a + epsilon`, +[ +(REPEAT STRIP_TAC); +(EXISTS_TAC `(b - a) / &2`); +ASM_ARITH_TAC; +]);; + +let normalize = new_definition `!(v:real^N). normalize v = inv (norm v) % v`;; + +let norm_normalize = prove_by_refinement( + `! (v:real^3). ~(v = vec 0) ==> norm (normalize v) = &1 `, +[ +(GEN_TAC THEN STRIP_TAC); +(PURE_REWRITE_TAC[normalize;NORM_MUL;REAL_ABS_INV;REAL_ABS_NORM]); +(MATCH_MP_TAC REAL_MUL_LINV); +(ASM_MESON_TAC[NORM_EQ_0]); +]);; + + +let normalize_vec_0 = prove_by_refinement( + `normalize (vec 0:real^N) = (vec 0:real^N)`, +[(PURE_REWRITE_TAC[normalize;REAL_INV_0;NORM_0;VECTOR_MUL_LZERO]); +VECTOR_ARITH_TAC;]);; + + +let norm_mul_normalize = prove_by_refinement( +`! (v:real^3).(norm v) % (normalize v) = v`, +[ +(GEN_TAC); +(ASM_CASES_TAC `v:real^3 = vec 0`); + +(* subgoal 1 *) +(ASM_SIMP_TAC[normalize_vec_0; VECTOR_MUL_RZERO]); + +(* subgoal 2 *) +(PURE_REWRITE_TAC[normalize;VECTOR_MUL_ASSOC]); +(SUBGOAL_THEN `~(norm (v:real^3) = &0)` (ASSUME_TAC o MATCH_MP REAL_MUL_RINV)); +(ASM_MESON_TAC[NORM_EQ_0]); +(ASM_SIMP_TAC[VECTOR_MUL_LID]);]);; + + +let dot_normalize = prove_by_refinement( + `! v:real^3. v dot (normalize v) = norm v`, +[ +(GEN_TAC); +(ASM_CASES_TAC `v:real^3 = vec 0`); + +(* subgoal 1 *) +(ASM_SIMP_TAC[NORM_0;DOT_LZERO]); + +(* subgoal 2 *) +(SUBGOAL_THEN ` norm (v:real^3) * (v dot normalize v) = norm v pow 2` MP_TAC); +(ONCE_REWRITE_TAC[GSYM DOT_RMUL]); +(ASM_SIMP_TAC[norm_mul_normalize;DOT_SQUARE_NORM]); + +(ONCE_REWRITE_TAC[REAL_POW_2]); +(MATCH_MP_TAC (REWRITE_RULE [TAUT `A /\ B ==> C <=> A ==> (B ==> C)`] REAL_EQ_LCANCEL_IMP)); +(ASM_SIMP_TAC[NORM_EQ_0]);]);; + + +let fourier = prove_by_refinement( + ` ! (v:real^3) (e1:real^3) e2 e3. orthonormal e1 e2 e3 +==> v = (v dot e1) % e1 + (v dot e2) % e2 + (v dot e3) % e3`, +[ +(REPEAT STRIP_TAC); +(FIRST_ASSUM (ASSUME_TAC o (MATCH_MP ORTHONORMAL_IMP_SPANNING))); +(UNDISCH_TAC `orthonormal (e1:real^3) e2 e3`); +(ONCE_REWRITE_TAC[orthonormal]); +(REPEAT STRIP_TAC); +(ABBREV_TAC `(u:real^3) = (v dot e1) % e1 + (v dot e2) % e2 + (v dot e3) % e3`); +(* subgoal 1 *) +(SUBGOAL_THEN ` (v:real^3) dot e1 = u dot e1 ` ASSUME_TAC); +(EXPAND_TAC "u"); +(ASM_SIMP_TAC[DOT_LADD;DOT_LMUL;DOT_SYM;REAL_MUL_RZERO; +REAL_ADD_RID;REAL_MUL_RID]); + +(* subgoal 2 *) +(SUBGOAL_THEN ` (v:real^3) dot e2 = u dot e2 ` ASSUME_TAC); +(EXPAND_TAC "u"); +(ASM_SIMP_TAC[DOT_LADD;DOT_LMUL;DOT_SYM;REAL_MUL_RZERO; +REAL_ADD_RID;REAL_MUL_RID;REAL_ADD_LID]); + +(* subgoal 3 *) +(SUBGOAL_THEN ` (v:real^3) dot e3 = u dot e3 ` ASSUME_TAC); +(EXPAND_TAC "u"); +(ASM_SIMP_TAC[DOT_LADD;DOT_LMUL;DOT_SYM;REAL_MUL_RZERO; +REAL_ADD_RID;REAL_MUL_RID;REAL_ADD_LID]); + +(* subgoal 4 *) +(SUBGOAL_THEN `(v:real^3) - u IN span {e1:real^3, e2, e3}` MP_TAC); +(ASM_SET_TAC[]); + +(SIMP_TAC[SPAN_3;IN_ELIM_THM;IN_UNIV]); +(STRIP_TAC); + +(* subgoal 5 *) +(SUBGOAL_THEN `((v:real^3) - u) dot (v - u) = &0` MP_TAC); +(PURE_REWRITE_TAC[DOT_LSUB]); +(ASM_SIMP_TAC[DOT_RMUL;DOT_RADD;REAL_SUB_REFL]); + +(ASM_SIMP_TAC[DOT_EQ_0;VECTOR_SUB_EQ]);]);; + + +let norm_lemma1 = prove_by_refinement( +`! (v:real^3) (e1:real^3) e2 e3. orthonormal e1 e2 e3 ==> + norm v = sqrt ((v dot e1) pow 2 + (v dot e2) pow 2 + (v dot e3) pow 2)`, +[ +(REPEAT STRIP_TAC); +(PURE_REWRITE_TAC[vector_norm]); +(FIRST_ASSUM (ASSUME_TAC o MATCH_MP fourier)); +(FIRST_ASSUM (fun thm -> CONV_TAC (PAT_CONV `\x. sqrt (x dot x) = _` (ONCE_REWRITE_CONV[thm])))); +(PURE_REWRITE_TAC[DOT_RADD;DOT_LADD;DOT_RMUL;DOT_LMUL; +REAL_ADD_RDISTRIB;REAL_ADD_LDISTRIB]); +(ONCE_REWRITE_TAC[REAL_MUL_ASSOC]); +(ONCE_REWRITE_TAC[GSYM REAL_POW_2]); +(FIRST_ASSUM (MP_TAC o MATCH_MP +(fst (EQ_IMP_RULE (SPECL [`e1:real^3`;`e2:real^3`;`e3:real^3`] orthonormal))))); +STRIP_TAC; +(ASM_SIMP_TAC[DOT_SYM;REAL_MUL_RZERO;REAL_ADD_RID; +REAL_ADD_LID;REAL_MUL_RID]);]);; + + +let coordinates_lemma = prove_by_refinement( + `! (v:real^3) (e1:real^3) e2 e3 (x:real) y z. orthonormal e1 e2 e3 /\ + v = x % e1 + y % e2 + z % e3 ==> + x = v dot e1 /\ y = v dot e2 /\ z = v dot e3`, +[ +(REPEAT GEN_TAC); +(STRIP_TAC); +(FIRST_ASSUM (fun thm -> MP_TAC (SPEC `v:real^3` (MATCH_MP fourier thm)))); +(ASM_MESON_TAC[ORTHONORMAL_IMP_INDEPENDENT_EXPLICIT]);]);; + + +let dot_coordinates = prove_by_refinement( + `! v:real^3 u e1 e2 e3. orthonormal e1 e2 e3 + ==> v dot u = (v dot e1) * (u dot e1) + (v dot e2) * (u dot e2) + + (v dot e3) * (u dot e3)`, +[ +(REPEAT STRIP_TAC); +(FIRST_ASSUM((LABEL_TAC "a") o (MATCH_MP (SPEC `u:real^3` fourier)))); +(USE_THEN "a" (fun thm -> (CONV_TAC (PAT_CONV `\x. A dot x = B` + (ONCE_REWRITE_CONV[thm]))))); +(ONCE_REWRITE_TAC[VECTOR_ARITH `(v:real^3) dot (a % e1 + b % e2 + c % e3) = + (v dot e1) * a + (v dot e2 ) * b + (v dot e3) * c`]); +(SIMP_TAC[]);]);; + + +let dot_coordinates_2 = prove_by_refinement( + `! (v:real^3) u e1 e2 e3 x y z a b c. orthonormal e1 e2 e3 /\ + v = x % e1 + y % e2 + z % e3 /\ u = a % e1 + b % e2 + c % e3 + ==> v dot u = x * a + y * b + z * c`, +[(ONCE_REWRITE_TAC[orthonormal]); +(REPEAT STRIP_TAC); +(ONCE_ASM_REWRITE_TAC[]); +(ASM_SIMP_TAC[DOT_SYM;DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL]); +ARITH_TAC;]);; + + +let norm_lemma2 = prove_by_refinement( + `! (v:real^3) e1 e2 e3 x y z. orthonormal e1 e2 e3 /\ + v = x % e1 + y % e2 + z % e3 ==> + norm v = sqrt (x pow 2 + y pow 2 + z pow 2)`, +[ +(REPEAT GEN_TAC); +(DISCH_TAC); +(FIRST_ASSUM (fun thm -> ONCE_REWRITE_TAC [ MATCH_MP norm_lemma1 (CONJUNCT1 thm)])); +(FIRST_ASSUM (fun thm -> SIMP_TAC[ MATCH_MP coordinates_lemma thm]));]);; + + +let dot_gt_0 = prove_by_refinement( + `! v:real^3 u. &0 < v dot u <=> &0 < v dot normalize u `, +[ +(REPEAT GEN_TAC); +(ASM_CASES_TAC `u:real^3 = vec 0`); + +(* subgoal 1 *) +(ASM_SIMP_TAC[normalize_vec_0]); + +(* subgoal 2 *) +( CONV_TAC(PAT_CONV `\x. &0 < A dot x <=> B`(ONCE_REWRITE_CONV[GSYM norm_mul_normalize]))); +(PURE_REWRITE_TAC[DOT_RMUL]); +(MATCH_MP_TAC (CONJUNCT1 REAL_LT_MUL_EQ)); +(MATCH_MP_TAC (REAL_ARITH `&0 <= x /\ ~(x = &0) ==> &0 < x`)); +(ASM_SIMP_TAC[NORM_POS_LE;NORM_EQ_0]);]);; + + +let dot_eq_0 = prove_by_refinement( +`! v:real^3 u. v dot u = &0 <=> (normalize v) dot u = &0`, +[ +(REPEAT GEN_TAC); +(ASM_CASES_TAC `v:real^3 = vec 0`); + +(* subgoal 1 *) +(ASM_SIMP_TAC[normalize_vec_0]); + +(* subgoal 2 *) +(CONV_TAC(PAT_CONV `\x. x dot y = &0 <=> A` +(ONCE_REWRITE_CONV[GSYM norm_mul_normalize]))); +(ONCE_REWRITE_TAC[DOT_LMUL]); +(CONV_TAC(PAT_CONV `\x. x <=> A` (ONCE_REWRITE_CONV +[ARITH_RULE `&0 = norm (v:real^3) * &0`]))); +(ONCE_REWRITE_TAC[REAL_EQ_MUL_LCANCEL]); +(ASM_SIMP_TAC[NORM_EQ_0]);]);; + + +let azim_ge_azim_dart = prove_by_refinement( + `! (V:real^3->bool) E w u v. FAN (vec 0, V, E) /\ w IN V /\ +u IN set_of_edge w V E /\ v IN set_of_edge w V E /\ ~(w = u) /\ ~(v = u) + ==> azim (vec 0) w u v >= azim_dart (V,E) (w,u)`, +[ +(REPEAT STRIP_TAC); +(ASM_SIMP_TAC[azim_dart]); +(PURE_REWRITE_TAC[azim_fan]); + +(* subgoal 1 *) +(SUBGOAL_THEN `CARD (set_of_edge (w:real^3) V E) > 1` ASSUME_TAC); +(MP_TAC (SPECL [`vec 0:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`; +`u:real^3`;`w:real^3`] Fan.remark1_fan)); +(ASM_SIMP_TAC[]); +(STRIP_TAC); +(MP_TAC(ISPECL [`v:real^3`;`u:real^3`] Hypermap.CARD_TWO_ELEMENTS)); +(ASM_SIMP_TAC[]); +(MATCH_MP_TAC (ARITH_RULE `(a:num) <= b ==> a = 2 ==> b > 1`)); +(MATCH_MP_TAC CARD_SUBSET); +(ASM_SET_TAC[]); + +(ASM_SIMP_TAC[]); +(* subgoal 2 *) +(SUBGOAL_THEN `~(set_of_edge (w:real^3) V E = {u})` ASSUME_TAC); +(ONCE_REWRITE_TAC[TAUT ` ~A <=> A ==> F`]); +(DISCH_THEN (MP_TAC o (AP_TERM `(\(S:real^3->bool). CARD S)`))); +(SIMP_TAC[BETA_THM;Geomdetail.CARD_SING]); +(ASM_ARITH_TAC); +(MP_TAC (SPECL [`vec 0 :real^3`;`V:real^3 -> bool`; +`E:(real^3->bool)->bool`;`w:real^3`;`u:real^3`] Fan.SIGMA_FAN)); +(ASM_SIMP_TAC[]); +STRIP_TAC; +(ASM_SIMP_TAC[ARITH_RULE `a >= b <=> b <= a`]);]);; + + +(* FATUGPD *) + +(* definitions in the proof *) + +let set_of_iso = new_definition +` set_of_iso W = {w| w IN W /\ set_of_edge w W (ECTC W) = {}}`;; + + +(* lemmas prepared for the proof *) +let lemma1 = prove_by_refinement( + `! (S:real^3->bool). packing S /\ S SUBSET ball_annulus ==> FINITE S`, +[ +(REPEAT STRIP_TAC); + +(* subgoal 1 *) +(SUBGOAL_THEN ` (S:real^3->bool) = S INTER ball (vec 0,&3 * h0)` ASSUME_TAC); + +(MATCH_MP_TAC (SET_RULE `! U V. U SUBSET ball_annulus /\ ball_annulus SUBSET V ==> (U = U INTER V)`)); +(ASM_SIMP_TAC[ball_annulus;ball;cball;IN_DIFF;SUBSET;IN_ELIM_THM;h0]); +(REPEAT STRIP_TAC ); +(MATCH_MP_TAC (ARITH_RULE ` u <= &2 * #1.26 ==> u < &3 * #1.26`)); +(ASM_SIMP_TAC[]); + +(ONCE_ASM_REWRITE_TAC[]); +(ASM_SIMP_TAC[KIUMVTC]);]);; + + +let lemma2 = prove_by_refinement( + `! (V:real^3 -> bool) v. packing V /\ FINITE V /\ v IN V +==> ? epsilon. epsilon > &0 /\ + (! w. w IN V /\ ~(w = v) /\ ~(w IN set_of_edge v V (ECTC V)) + ==> dist (v,w) > &2 + epsilon )`, +[ +(REPEAT STRIP_TAC); +(ABBREV_TAC `(S:real^3->bool) = {w|w IN V /\ ~(w = v) /\ ~(w IN set_of_edge v V (ECTC V))}`); + +(ASM_CASES_TAC `(S:real^3 ->bool) = {}`); + +(* subgoal 1 *) +(EXISTS_TAC `&1`); +(SIMP_TAC[ARITH_RULE `&1 > &0`]); +(REPEAT STRIP_TAC); +(* subgoal 1.1 *) +(SUBGOAL_THEN `~((S:real^3->bool) = {})` ASSUME_TAC); +(ASM_SET_TAC[]); + +(ASM_MESON_TAC[]); + +(* subgoal 2 *) + +(* subgoal 2.1 *) +(SUBGOAL_THEN `FINITE (S:real^3 -> bool)` ASSUME_TAC); +(MATCH_MP_TAC + (ISPECL [`(S:real^3-> bool)`;`(V:real^3 ->bool)`] FINITE_SUBSET)); +(ASM_SET_TAC[]); + +(ABBREV_TAC `(f:real^3 -> real) = (\w. dist (v,w))`); +(* subgoal 2.2 *) +(SUBGOAL_THEN `&2 < inf (IMAGE (f:real^3 -> real) (S:real^3 ->bool))` ASSUME_TAC); +(* subgoal 2.2.1 *) +(SUBGOAL_THEN + `FINITE (IMAGE (f:real^3 ->real) S) /\ ~ (IMAGE f S = {})` ASSUME_TAC); +(ASM_SIMP_TAC[FINITE_IMAGE;NOT_EMPTY_IMAGE]); + +(ASM_SIMP_TAC[REAL_LT_INF_FINITE]); +(EXPAND_TAC "S"); +(PURE_REWRITE_TAC[IN_ELIM_THM;IMAGE]); +(REPEAT STRIP_TAC); +(ONCE_ASM_REWRITE_TAC[]); +(EXPAND_TAC "f"); +(MATCH_MP_TAC (ARITH_RULE `! (a:real). &2 <= a /\ ~(&2 = a) ==> &2 < a`)); +CONJ_TAC; +(* subgoal 2.2.3 *) +(UNDISCH_TAC `packing (V:real^3 -> bool)`); +(PURE_REWRITE_TAC[packing]); +(DISCH_THEN (fun thm -> MATCH_MP_TAC (ISPECL [`x':real^3`;`v:real^3`] thm))); +(ASM_MESON_TAC[IN]); + +(* subgoal 2.2.4 *) +(SUBGOAL_THEN `&2 = dist (v,x') ==> (x' IN set_of_edge v V (ECTC V))` ASSUME_TAC); +(STRIP_TAC); +(PURE_REWRITE_TAC[set_of_edge]); +(ASM_SIMP_TAC[ECTC;IN_ELIM_THM]); +(EXISTS_TAC `v:real^3`); +(EXISTS_TAC `x':real^3`); +(ASM_SIMP_TAC[]); + +(ASM_MESON_TAC[]); + +(FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP epsilon_lemma))); +(FIRST_X_ASSUM CHOOSE_TAC); +(EXISTS_TAC `epsilon:real`); +(ASM_SIMP_TAC[]); +(REPEAT STRIP_TAC); +(MATCH_MP_TAC (ARITH_RULE `! u:real v w. u >= v /\ v > w ==> u > w`)); +(EXISTS_TAC `inf (IMAGE (f:real^3 -> real) (S:real^3 -> bool))`); +(ASM_SIMP_TAC[]); + +(* subgoal 2.3 *) +(SUBGOAL_THEN `dist (v,w:real^3) IN (IMAGE (f:real^3 -> real) S)` ASSUME_TAC); +(PURE_REWRITE_TAC[IMAGE;IN_ELIM_THM]); +(EXISTS_TAC `w:real^3`); +(CONJ_TAC); + +(* subgoal 2.3.1 *) +(EXPAND_TAC "S"); +(ASM_SIMP_TAC[IN_ELIM_THM]); + +(* subgoal 2.3.2 *) +(EXPAND_TAC "f"); +(SIMP_TAC[]); + +(* subgoal 2.3.3 *) +(SUBGOAL_THEN `~(IMAGE (f:real^3 -> real) S = {}) + /\ (? b:real. !x. x IN (IMAGE f S) ==> b <= x )` ASSUME_TAC); +(ASM_SIMP_TAC[NOT_EMPTY_IMAGE]); +(EXISTS_TAC `&2`); +STRIP_TAC; +(EXPAND_TAC "f"); +(PURE_REWRITE_TAC[IN_ELIM_THM;IMAGE]); +(REPEAT STRIP_TAC); +(ONCE_ASM_REWRITE_TAC[]); +(SIMP_TAC[]); +(UNDISCH_TAC `packing (V:real^3 -> bool)`); +(PURE_REWRITE_TAC[packing]); +(DISCH_THEN (fun thm -> MP_TAC (ISPECL [`v:real^3`;`x':real^3`] thm))); +(MATCH_MP_TAC (TAUT `U ==> ((U ==> V)==> V) `)); + +(CONV_TAC (PAT_CONV `\x y. x /\ y /\ _ ` (ONCE_REWRITE_CONV[GSYM IN]))); +(ASM_SIMP_TAC[]); +(UNDISCH_TAC `(x':real^3) IN S`); +(EXPAND_TAC "S"); +(PURE_REWRITE_TAC[IN_ELIM_THM]); +(SIMP_TAC[]); + +(FIRST_X_ASSUM (ASSUME_TAC o (MATCH_MP INF))); +(ONCE_REWRITE_TAC[ARITH_RULE `a >= b <=> b <= a`]); +(FIRST_X_ASSUM (fun thm -> MATCH_MP_TAC (CONJUNCT1 thm))); +(ASM_SIMP_TAC[]); ]);; + + +let lemma3 = prove_by_refinement( + `! (w:real^3) (W:real^3 -> bool). packing W /\ w IN W /\ +~(set_of_edge w W (ECTC W) = {}) /\ ~(surrounded_node (W,(ECTC W)) w) +==> ?u. (u IN set_of_edge w W (ECTC W)) /\ (azim_dart (W, (ECTC W)) (w,u) >= pi)`, +[ +(PURE_REWRITE_TAC[surrounded_node]); +(PURE_REWRITE_TAC[GSYM EXISTS_NOT_THM]); +(PURE_REWRITE_TAC[TAUT `~(A ==> B) <=> A /\ ~B`]); +(PURE_REWRITE_TAC[ARITH_RULE `~ (a < pi) <=> a >= pi`]); +(PURE_REWRITE_TAC[dart_of_fan]); +(PURE_REWRITE_TAC[SET_RULE `x IN A UNION B <=> x IN A \/ x IN B`]); +(SIMP_TAC[IN_ELIM_THM]); +(REPEAT STRIP_TAC); + +(* subgoal 1 *) +(SUBGOAL_THEN `set_of_edge (w:real^3) (W:real^3 ->bool) (ECTC W) = {}` ASSUME_TAC); +(FIRST_X_ASSUM (fun thm -> ALL_TAC)); +(FIRST_X_ASSUM (fun thm -> ONCE_REWRITE_TAC[GSYM thm])); +(ASM_SIMP_TAC[]); +(ASM_MESON_TAC[]); + +(* subgoal 2 *) +(EXISTS_TAC `SND (x:real^3 # real^3)`); +(Q_LABEL_TAC `FST (x:real^3 # real^3) = w` "a"); +(USE_THEN "a" (fun thm -> SIMP_TAC[PAIR; GSYM thm])); +(ASM_SIMP_TAC[]); +(PURE_REWRITE_TAC[IN_ELIM_THM;set_of_edge]); + +(* subgoal 2.1 *) +(SUBGOAL_THEN `w:real^3 = v` (LABEL_TAC "b")); +(REMOVE_THEN "a" (fun thm -> PURE_REWRITE_TAC[GSYM thm])); +(ASM_SIMP_TAC[]); +(ASM_SIMP_TAC[]); +(UNDISCH_TAC `{v:real^3,w':real^3} IN ECTC (W:real^3 -> bool)`); +(REWRITE_TAC[ECTC;IN_ELIM_THM;Geomdetail.PAIR_EQ_EXPAND]); +(STRIP_TAC); + +(* subgoal 2.2 *) +(ASM_SIMP_TAC[]); + +(* subgoal 2.3 *) +(ASM_SIMP_TAC[]);]);; + + + +let lemma4 = prove_by_refinement( + `! w:real^3 u v. + ~collinear {vec 0, w, u} /\ ~collinear {vec 0, w, v} /\ + azim (vec 0) w u v >= pi + ==> (w cross u) dot v <= &0`, +[ +(REPEAT STRIP_TAC); +(MP_TAC (SPECL [`w:real^3`;`u:real^3`;`v:real^3`] JBDNJJB)); +(ASM_SIMP_TAC[]); +STRIP_TAC; +(ABBREV_TAC `(a:real) = ((w:real^3) cross u) dot v`); +(MATCH_MP_TAC (SPECL [`t:real`;`a:real`;`&0`] REAL_LE_LCANCEL_IMP)); +(ASM_SIMP_TAC[]); +(Q_LABEL_TAC `sin (azim (vec 0) w u v ) = t * a` "b"); +(USE_THEN "b" (fun thm -> (ONCE_REWRITE_TAC[GSYM thm; REAL_MUL_RZERO]))); + +(* subgoal 1 *) +(SUBGOAL_THEN `azim (vec 0 :real^3) w u v < &2 * pi` ASSUME_TAC); +(SIMP_TAC[SPECL [`vec 0:real^3`;`w:real^3`;`u:real^3`;`v:real^3`] azim]); + +(ABBREV_TAC `b:real = azim (vec 0:real^3) w u v`); +(ONCE_REWRITE_TAC[ARITH_RULE `m <= &0 <=> &0 <= -- m `]); +(ONCE_REWRITE_TAC[GSYM SIN_NEG]); +(ONCE_REWRITE_TAC[GSYM SIN_PERIODIC]); + +(* subgoal 2 *) +(SUBGOAL_THEN `-- pi < --b + &2 * pi /\ --b + &2 * pi <= pi` ASSUME_TAC); +ASM_ARITH_TAC; + +(ABBREV_TAC `c:real = --b + &2 * pi`); +(FIRST_ASSUM (ASSUME_TAC o (MATCH_MP SIN_NEGPOS_PI))); +(ONCE_REWRITE_TAC[ARITH_RULE `&0 <= x <=> x = &0 \/ &0 < x`]); +(ONCE_ASM_REWRITE_TAC[]); +(MATCH_MP_TAC (ARITH_RULE ` (&0 <= c /\ c <= pi) ==> ((c = &0 \/ c = pi) \/ &0 < c /\ c < pi)`)); +(ASM_SIMP_TAC[]); +(EXPAND_TAC "c"); +(MATCH_MP_TAC (ARITH_RULE `b < a ==> &0 <= --b + a`)); +(ASM_SIMP_TAC[]);]);; + + +let lemma5 = prove_by_refinement( + `! (V:real^3 -> bool) v. packing V /\ V SUBSET ball_annulus /\ v IN V + ==> ! u. (u IN set_of_edge v V (ECTC V)) ==> v dot u > &0`, +[ +(REPEAT STRIP_TAC); +(* subgoal 1 *) +(SUBGOAL_THEN `!(w:real^3). w IN V ==> w dot w >= &4` (LABEL_TAC "a")); +(REPEAT STRIP_TAC); +(MP_TAC (SET_RULE `(w:real^3) IN V /\ V SUBSET ball_annulus ==> w IN ball_annulus`)); +(ASM_SIMP_TAC[]); +(PURE_REWRITE_TAC[ball_annulus]); +(PURE_REWRITE_TAC[DIFF;ball;IN_ELIM_THM]); +(PURE_REWRITE_TAC[REAL_ARITH `~(a < &2) <=> a >= &2`]); +(PURE_REWRITE_TAC[dist; DIST_SYM;VECTOR_SUB_RZERO]); +(PURE_REWRITE_TAC[NORM_GE_SQUARE]); + +(SIMP_TAC[ARITH_RULE `~(&2 <= &0) /\ &2 pow 2 = &4`]); +(MATCH_MP_TAC (ARITH_RULE `&2 * a > &0 ==> a > &0`)); +(ONCE_REWRITE_TAC[VECTOR_ARITH `&2 * (v dot u) = v dot v + u dot u - (v - u) dot (v - u)`]); + +(* subgoal 2 *) +(SUBGOAL_THEN `(v:real^3 - u) dot (v - u) = &4 /\ u IN V` MP_TAC); +(UNDISCH_TAC `u:real^3 IN set_of_edge v V (ECTC V)`); +(SIMP_TAC[set_of_edge;ECTC;IN_ELIM_THM]); +STRIP_TAC; +(ONCE_REWRITE_TAC[DOT_SQUARE_NORM]); +(ONCE_REWRITE_TAC[GSYM dist]); +(FIRST_ASSUM (MP_TAC o (MATCH_MP (fst (EQ_IMP_RULE Geomdetail.PAIR_EQ_EXPAND))))); +(REPEAT STRIP_TAC); + +(* subgoal 2.1 *) +(ASM_SIMP_TAC[]); +ARITH_TAC; +(* subgoal 2.2 *) +(ONCE_REWRITE_TAC[DIST_SYM]); +(ASM_SIMP_TAC[]); +ARITH_TAC; + +(STRIP_TAC); +(ASM_SIMP_TAC[]); +(MATCH_MP_TAC (ARITH_RULE `a >= &4 /\ b >= &4 ==> a + b - &4 > &0`)); +(USE_THEN "a" (fun thm -> MP_TAC( SPEC `v:real^3` thm))); +(USE_THEN "a" (fun thm -> MP_TAC( SPEC `u:real^3` thm))); +(ASM_SIMP_TAC[]);]);; + + +let lemma6 = prove_by_refinement( + `! v:real^3 u (phi:real) e1 e2 e3. e1 = normalize v /\ + orthonormal e1 e2 e3 /\ + u = (cos phi * norm v) % e1 + (sin phi * norm v) % e2 +==> norm u = norm v`, +[ +(REPEAT STRIP_TAC); +(* subgoal 1 *) +(SUBGOAL_THEN `orthonormal e1 e2 e3 /\ + u:real^3 = (cos (phi:real) * norm (v:real^3)) % e1 + (sin phi * norm v) % e2 + &0 % e3` ASSUME_TAC); +(ASM_SIMP_TAC[]); +VECTOR_ARITH_TAC; + +(FIRST_X_ASSUM (ASSUME_TAC o MATCH_MP (SPECL [`u:real^3`;`e1:real^3`;`e2:real^3`;`e3:real^3`; +` cos (phi:real) * norm (v:real^3)`;`sin (phi:real) * norm (v:real^3)`;`&0`] +norm_lemma2))); +(ONCE_ASM_REWRITE_TAC[]); +(ONCE_REWRITE_TAC[ARITH_RULE `( a * m) pow 2 + (b * m) pow 2 + &0 pow 2 += (b pow 2 + a pow 2) * m pow 2`]); +(SIMP_TAC[SIN_CIRCLE;REAL_MUL_LID]); +(MATCH_MP_TAC POW_2_SQRT); +(SIMP_TAC[NORM_POS_LE]);]);; + + +let lemma7 = prove_by_refinement( + `! v:real^3 u (phi:real) e1 e2 e3. e1 = normalize v /\ + orthonormal e1 e2 e3 /\ &0 < phi /\ phi < pi /\ &0 < norm v /\ + u = (cos phi * norm v) % e1 + (sin phi * norm v) % e2 +==> (! w:real^3. &0 < w dot e1 /\ w dot e2 <= &0 + ==> dist (v,w) < dist (u,w))`, +[ +(REPEAT STRIP_TAC); +(PURE_REWRITE_TAC[dist;NORM_LT]); +(ONCE_REWRITE_TAC[ARITH_RULE `a < b <=> &0 < b - a `]); +(ONCE_REWRITE_TAC[VECTOR_ARITH `(u - w) dot (u - w) - (v - w) dot (v - w) = + u dot u - v dot v - &2 * ((u - v) dot w )`]); +(ONCE_REWRITE_TAC[DOT_SQUARE_NORM]); + +(* subgoal 1 *) +(SUBGOAL_THEN `norm (u:real^3) = norm (v:real^3)` ASSUME_TAC); +(MATCH_MP_TAC (SPECL [`v:real^3`;`u:real^3`;`phi:real`; `e1:real^3`; +`e2:real^3`;`e3:real^3`] lemma6)); +(ASM_SIMP_TAC[]); + +(FIRST_ASSUM (fun thm -> SIMP_TAC[thm; ARITH_RULE `a - a - b = --b`])); +(ONCE_REWRITE_TAC[ARITH_RULE `&0 < --(&2 * a) <=> a < &0`]); + +(* subgoal 2 *) +(SUBGOAL_THEN `v:real^3 = (norm v) % e1` (LABEL_TAC "v_coordinate")); +(ASM_SIMP_TAC[norm_mul_normalize]); + +(Q_LABEL_TAC `orthonormal e1 e2 e3` "base"); +(USE_THEN "base" (ASSUME_TAC o MATCH_MP (SPECL [`(u - v):real^3`;`w:real^3`; +`e1:real^3`;`e2:real^3`;`e3:real^3`] dot_coordinates))); +(ONCE_ASM_REWRITE_TAC[]); + +(* subgoal 3 *) +(SUBGOAL_THEN `(u:real^3 - v) dot e1 = (cos phi - &1) * norm v /\ +(u - v) dot e2 = sin phi * norm v /\ (u - v) dot e3 = &0` MP_TAC); +(ONCE_REWRITE_TAC[EQ_SYM_EQ]); +(MATCH_MP_TAC (SPECL [`u:real^3 - v`;`e1:real^3`;`e2:real^3`;`e3:real^3`; +`(cos phi - &1) * norm v`;`sin phi * norm v`;`&0`] coordinates_lemma)); +(USE_THEN "base" (fun thm -> SIMP_TAC[thm])); +(USE_THEN "v_coordinate" (fun thm -> CONV_TAC( PAT_CONV +`\x. U - x = _` (ONCE_REWRITE_CONV[thm])))); +(Q_LABEL_TAC `u:real^3 = (cos phi * norm (v:real^3)) % e1 + (sin phi * norm v) % e2` "u"); +(USE_THEN "u" (fun thm -> ONCE_REWRITE_TAC[thm])); +(VECTOR_ARITH_TAC); +(DISCH_THEN (LABEL_TAC "c")); +(USE_THEN "c" (fun thm -> ONCE_REWRITE_TAC[thm])); +(PURE_REWRITE_TAC[REAL_MUL_LZERO;REAL_ADD_RID]); +(MATCH_MP_TAC (REAL_ARITH `a < &0 /\ b <= &0 ==> a + b < &0`)); +CONJ_TAC; + +(* subgoal 4 *) +(ONCE_REWRITE_TAC[REAL_ARITH +`((a - &1) * b) * c < &0 <=> &0 < ((&1 - a) * b) * c`]); +(MATCH_MP_TAC REAL_LT_MUL); +(ASM_SIMP_TAC[]); +(MATCH_MP_TAC REAL_LT_MUL); +(ASM_SIMP_TAC[]); +(ONCE_REWRITE_TAC[REAL_ARITH +`&0 < &1 - a <=> (a <= &1 /\ ~(a = &1))`]); +(SIMP_TAC[COS_BOUNDS;COS_ONE_2PI]); +(ONCE_REWRITE_TAC[ TAUT `~(A \/ B) <=> ~A /\ ~B`]); +(STRIP_TAC); + +(* subgoal 4.1 *) +(ONCE_REWRITE_TAC[TAUT `~A <=> A ==> F`]); +(STRIP_TAC); +(FIRST_X_ASSUM(LABEL_TAC "phi")); + + +(* subgoal 4.1.1 *) +(SUBGOAL_THEN `0 < n:num` ASSUME_TAC); +(ONCE_REWRITE_TAC[GSYM REAL_OF_NUM_LT]); +(MATCH_MP_TAC (SPECL [`&0`;`&(n:num)`;`&2 * pi`] +REAL_LT_RCANCEL_IMP)); +(SIMP_TAC[ARITH_RULE `&0 * &2 * pi = &0`; +ARITH_RULE `&0 < &2 * a <=> &0 < a`]); +(USE_THEN "phi" (fun thm -> ONCE_REWRITE_TAC[GSYM thm])); +(ASM_SIMP_TAC[PI_POS]); + +(* subgoal 4.1.2 *) +(SUBGOAL_THEN `n:num < 1` ASSUME_TAC); +(ONCE_REWRITE_TAC[GSYM REAL_OF_NUM_LT]); +(MATCH_MP_TAC (SPECL [`&(n:num)`;`&1`;`&2 * pi`] +REAL_LT_RCANCEL_IMP)); +(SIMP_TAC[ARITH_RULE `&1 * &2 * pi = &2 * pi`; +ARITH_RULE `&0 < &2 * a <=> &0 < a`]); +(USE_THEN "phi" (fun thm -> ONCE_REWRITE_TAC[GSYM thm])); +(SIMP_TAC[PI_POS]); +(MATCH_MP_TAC(ARITH_RULE `a < pi /\ pi < b ==> a < b`)); +(ASM_SIMP_TAC[]); +(MATCH_MP_TAC(ARITH_RULE `&0 < a ==> a < &2 * a`)); +(SIMP_TAC[PI_POS]); +(ASM_MESON_TAC[ARITH_RULE `~(0 < n:num /\ n < 1)`]); + +(* subgoal 4.2 *) +(ONCE_REWRITE_TAC[TAUT `~A <=> A ==> F`]); +(STRIP_TAC); +(FIRST_X_ASSUM(LABEL_TAC "phi")); +(* subgoal 4.2.1 *) +(SUBGOAL_THEN `~(&0 < phi:real)` ASSUME_TAC); +(USE_THEN "phi" (fun thm -> ONCE_REWRITE_TAC[thm])); +(ONCE_REWRITE_TAC[ARITH_RULE `~(&0 < -- a) <=> &0 <= a`]); +(MATCH_MP_TAC REAL_LE_MUL); +(SIMP_TAC[REAL_POS]); +(MATCH_MP_TAC (ARITH_RULE `&0 < a ==> &0 <= a`)); +(MATCH_MP_TAC REAL_LT_MUL); +(SIMP_TAC[PI_POS]); +ARITH_TAC; +(ASM_MESON_TAC[]); + +(* subgoal 5 *) +(ONCE_REWRITE_TAC[ARITH_RULE `a * b <= &0 <=> &0 <= a * (--b)`]); +(MATCH_MP_TAC REAL_LE_MUL); +(ONCE_REWRITE_TAC[ARITH_RULE `&0 <= -- a <=> a <= &0`]); +(ASM_SIMP_TAC[]); +(MATCH_MP_TAC REAL_LE_MUL); +(SIMP_TAC[NORM_POS_LE]); +(MATCH_MP_TAC SIN_POS_PI_LE); +(ASM_ARITH_TAC);]);; + + +let lemma8 = prove_by_refinement( +`! w:real^3 W:real^3->bool. w IN W +==> set_of_edge w W (ECTC W) = {v| v IN W /\ dist (w,v) = &2}`, +[ +(REPEAT STRIP_TAC); +(MATCH_MP_TAC SUBSET_ANTISYM); +CONJ_TAC; + +(* subgoal 1 *) +(PURE_REWRITE_TAC[SUBSET]); +(GEN_TAC); +(SIMP_TAC[set_of_edge;ECTC;IN_ELIM_THM]); +(STRIP_TAC); +(SUBGOAL_THEN `dist (w:real^3,x) = dist (v:real^3,w'')` ASSUME_TAC); +(MATCH_MP_TAC Geomdetail.DIST_PAIR_LEMMA); +(ASM_SIMP_TAC[]); +(ASM_ARITH_TAC); + +(* subgoal 2 *) +(PURE_REWRITE_TAC[SUBSET]); +(GEN_TAC); +(SIMP_TAC[set_of_edge;ECTC;IN_ELIM_THM]); +(STRIP_TAC); +(EXISTS_TAC `w:real^3`); +(EXISTS_TAC `x:real^3`); +(ASM_SIMP_TAC[]); +(ONCE_REWRITE_TAC[DIST_NZ]); +(ASM_ARITH_TAC);]);; + + +(* main proof *) + +let FATUGPD_quasi = prove_by_refinement( ` UBHDEUU2_hypothesis ==> (!V. packing V /\ V SUBSET ball_annulus +==> (?W phi. BIJ phi V W /\ (!v. v IN V ==> norm(v) = norm(phi v)) /\ + (!w. w IN W ==> (set_of_edge w W (ECTC W) = {}) \/ (surrounded_node (W,(ECTC W)) w))))`, +[ +DISCH_TAC; +GEN_TAC; +STRIP_TAC; +(ABBREV_TAC + `S = {(U:real^3->bool)| FINITE U /\ packing U /\ + (?phi. BIJ phi (V:real^3->bool) U /\ + (! v. v IN V ==> norm v = norm (phi v)))}`); +(ABBREV_TAC + `(f:(real^3 ->bool)->num) = + (\U. CARD (set_of_iso U))`); + +(* subgoal 1 *) +(SUBGOAL_THEN `FINITE (V:real^3->bool)` (LABEL_TAC "finite_v")); +(ASM_SIMP_TAC[lemma1]); + +(* subgoal 2 *) +(SUBGOAL_THEN `! (U:real^3 ->bool). U IN S ==> FINITE U` (LABEL_TAC "finite_u")); +(EXPAND_TAC "S"); +(SIMP_TAC[IN_ELIM_THM]); + +(* subgoal 3 *) +(SUBGOAL_THEN + `~ ((S:(real^3->bool)->bool) = {}) /\ + (?m. !U. U IN S ==> (f:(real^3->bool)->num) U <= m)` (LABEL_TAC "asm1")); +CONJ_TAC; + +(* subgoal 3.1 *) +(PURE_REWRITE_TAC[GSYM MEMBER_NOT_EMPTY]); +(EXISTS_TAC `V:real^3->bool`); +(EXPAND_TAC "S"); +(ASM_SIMP_TAC[IN_ELIM_THM]); +(EXISTS_TAC `(I:real^3->real^3)`); +CONJ_TAC; + +(* subgoal 3.1.1 *) +(SIMP_TAC[BIJ;INJ;SURJ;I_THM]); +(SET_TAC[]); + +(* subgoal 3.1.2 *) +(SIMP_TAC[I_THM]); + +(* subgoal 3.2 *) +(EXISTS_TAC `CARD (V:real^3->bool)`); +(GEN_TAC); + +(* subgoal 3.2.1 *) +(SUBGOAL_THEN `! (U:real^3->bool). U IN S ==> CARD U = CARD (V:real^3->bool)` MP_TAC); +(GEN_TAC); +(EXPAND_TAC "S"); +(PURE_REWRITE_TAC[IN_ELIM_THM]); +STRIP_TAC; +(MATCH_MP_TAC BIJ_CARD_EQ); +(EXISTS_TAC `phi:real^3->real^3`); +(ASM_SIMP_TAC[]); + +(DISCH_THEN (MP_TAC o (fun thm -> (SPEC `U:real^3 ->bool` thm)))); +(MATCH_MP_TAC (TAUT ` (p ==> (q ==> r)) ==> ((p ==> q) ==> (p ==> r))`)); +(REPEAT STRIP_TAC); + +(* subgoal 3.2.2 *) +(SUBGOAL_THEN `(f:(real^3->bool) -> num) U <= CARD U` ASSUME_TAC); +(EXPAND_TAC "f"); +(MATCH_MP_TAC CARD_SUBSET); +CONJ_TAC; + +(* subgoal 3.2.2.1 *) +(SET_TAC[set_of_iso]); + +(* subgoal 3.2.2.2 *) +(UNDISCH_TAC `(U:real^3->bool) IN (S:(real^3->bool)->bool)`); +(ASM_SIMP_TAC[]); + +ASM_ARITH_TAC; + +(REMOVE_THEN "asm1" (ASSUME_TAC o (MATCH_MP bdd_num_func_attain_max))); +(FIRST_X_ASSUM CHOOSE_TAC); +(EXISTS_TAC `U:real^3->bool`); + +(FIRST_X_ASSUM MP_TAC); +(STRIP_TAC); +(UNDISCH_TAC `U:real^3 -> bool IN S`); +(EXPAND_TAC "S"); +(SIMP_TAC[IN_ELIM_THM]); +(REPEAT STRIP_TAC); +(EXISTS_TAC `phi:real^3 ->real^3`); +(ASM_SIMP_TAC[]); +(REPEAT STRIP_TAC); + +(* subgoal 4 *) +(SUBGOAL_THEN `! v:real^3. v IN U ==> norm v <= &2 * h0 /\ ~(norm v < &2)` +(LABEL_TAC "norm_bdd")); +GEN_TAC; +(UNDISCH_TAC `BIJ phi (V:real^3->bool) (U:real^3->bool)`); +(PURE_REWRITE_TAC[BIJ;SURJ]); +( STRIP_TAC); +(STRIP_TAC); +(FIRST_ASSUM (fun thm -> MP_TAC (SPEC `v:real^3` thm))); +(FIRST_ASSUM (fun thm -> SIMP_TAC[thm])); +STRIP_TAC; +(UNDISCH_TAC `! v:real^3. v IN V ==> norm v = norm ((phi:real^3 -> real^3) v)`); +(DISCH_THEN (fun thm -> MP_TAC (SPEC `y:real^3` thm))); +(ASM_SIMP_TAC[]); +(MATCH_MP_TAC (ARITH_RULE +`a <= &2 * h0 /\ ~(a < &2) ==> a = b ==> b <= &2 * h0 /\ ~(b < &2)`)); + +(* subgoal 4.1 *) +(SUBGOAL_THEN `y:real^3 IN ball_annulus` MP_TAC); +(MATCH_MP_TAC (SET_RULE `y:real^3 IN V /\ V SUBSET ball_annulus ==> y IN ball_annulus`)); +(ASM_SIMP_TAC[]); + +(PURE_REWRITE_TAC[IN_ELIM_THM;ball_annulus;DIFF;cball;ball]); +(SIMP_TAC[DIST_0]); + +(* subgoal 5 *) +(SUBGOAL_THEN `(U:real^3 -> bool) SUBSET ball_annulus` (LABEL_TAC "u_annu")); +(PURE_REWRITE_TAC[SUBSET]); +GEN_TAC; +STRIP_TAC; +(PURE_REWRITE_TAC[IN_ELIM_THM;ball_annulus;DIFF;cball;ball]); +(SIMP_TAC[DIST_0]); +(ASM_SIMP_TAC[]); + +(* subgoal 6 *) +(SUBGOAL_THEN `! v:real^3. v IN U ==> ~(v = vec 0)` (LABEL_TAC "not_0")); +(GEN_TAC); +STRIP_TAC; +(ONCE_REWRITE_TAC[GSYM NORM_POS_LT]); +(MATCH_MP_TAC (ARITH_RULE `~(norm (v:real^3) < &2) ==> &0 < norm v`)); +(ASM_SIMP_TAC[]); + +(* subgoal 7 *) +(SUBGOAL_THEN `!v:real^3. v IN set_of_edge w U (ECTC U) + ==> ~(collinear {vec 0, w, v})` (LABEL_TAC "not_li")); +(GEN_TAC); +(MP_TAC (SPECL [`w:real^3`;`U:real^3->bool`] lemma8)); +(ASM_SIMP_TAC[]); +(SIMP_TAC[IN_ELIM_THM;ECTC]); +(MATCH_MP_TAC (TAUT `(B ==> C) ==> (A ==> B ==> C)`)); +STRIP_TAC; +(ONCE_REWRITE_TAC[COLLINEAR_BETWEEN_CASES]); +(ONCE_REWRITE_TAC[TAUT `~(A \/ B \/ C) <=> ~A /\ ~B /\ ~C`]); +(ONCE_REWRITE_TAC[between]); +(ONCE_REWRITE_TAC[DIST_0]); +(CONV_TAC (PAT_CONV `\x. A /\ ~( _ = x + _ ) /\ ~( _ = _ + x)` +(ONCE_REWRITE_CONV[DIST_SYM]))); +(ASM_SIMP_TAC[]); +(MATCH_MP_TAC (ARITH_RULE +`(a <= &2 * #1.26) /\ ~(a < &2) /\ (b <= &2 * #1.26) /\ ~(b < &2) +==> ~(&2 = a + b) /\ ~(b = &2 + a) /\ ~(a = b + &2)`)); +(ONCE_REWRITE_TAC[GSYM h0]); +(ASM_SIMP_TAC[]); + +(ASM_CASES_TAC `~(set_of_edge (w:real^3) (U:real^3->bool) (ECTC U) = {}) /\ + ~(surrounded_node (U,ECTC U) w)`); + +(ABBREV_TAC `result:bool = (set_of_edge w U (ECTC U) = {} \/ surrounded_node (U,ECTC U) w)`); +(MP_TAC (SPECL [`U:real^3 -> bool`;`w:real^3`] lemma2)); +(ASM_SIMP_TAC[]); +(STRIP_TAC); +(MP_TAC (SPECL[`w:real^3`;`U:real^3->bool`] lemma3)); +(ASM_SIMP_TAC[]); +(STRIP_TAC); +(Q_ABBREV_TAC `e1:real^3 = normalize w` "e1"); +(Q_ABBREV_TAC `y:real^3 = w cross u` "y_axis"); +(Q_ABBREV_TAC `e2:real^3 = normalize y` "e2"); +(Q_ABBREV_TAC `e3:real^3 = e1 cross e2` "e3"); + +(* subgoal 8 *) +(SUBGOAL_THEN `orthonormal (e1:real^3) e2 e3` ASSUME_TAC); +(PURE_REWRITE_TAC[orthonormal]); +(ONCE_REWRITE_TAC[GSYM NORM_EQ_1]); +(* subgoal 8.1 *) +(SUBGOAL_THEN `norm (e1:real^3) = &1` ASSUME_TAC); +(Q_EXPAND_TAC "e1"); +(MATCH_MP_TAC norm_normalize); +(ASM_SIMP_TAC[]); + +(* subgoal 8.2 *) +(SUBGOAL_THEN `norm (e2:real^3) = &1` ASSUME_TAC); +(Q_EXPAND_TAC "e2"); +(MATCH_MP_TAC norm_normalize); +(Q_EXPAND_TAC "y_axis"); +(ONCE_REWRITE_TAC[CROSS_EQ_0]); +(ASM_SIMP_TAC[]); + +(* subgoal 8.3 *) +(SUBGOAL_THEN `(e1:real^3) dot e2 = &0` ASSUME_TAC); +(Q_EXPAND_TAC "e1"); +(ONCE_REWRITE_TAC[GSYM dot_eq_0]); +(Q_EXPAND_TAC "e2"); +(ONCE_REWRITE_TAC[DOT_SYM]); +(ONCE_REWRITE_TAC[GSYM dot_eq_0]); +(Q_EXPAND_TAC "y_axis"); +(SIMP_TAC[DOT_CROSS_SELF]); + +(* subgoal 8.4 *) +(SUBGOAL_THEN `(e1:real^3) dot e3 = &0 /\ e2 dot e3 = &0` ASSUME_TAC); +(Q_EXPAND_TAC "e3"); +(SIMP_TAC[DOT_CROSS_SELF]); + +(* subgoal 8.5 *) +(SUBGOAL_THEN `norm (e3:real^3) = &1` ASSUME_TAC); +(Q_EXPAND_TAC "e3"); +(MP_TAC(ISPECL [`e1:real^3`;`e2:real^3`] NORM_CROSS_DOT)); +(ASM_SIMP_TAC[REAL_POW_2;REAL_MUL_RZERO;REAL_ADD_RID;REAL_MUL_RID]); +(ONCE_REWRITE_TAC[GSYM REAL_POW_2]); +(STRIP_TAC); +(MP_TAC(SPECL [`norm (e3:real^3)`;`2`] REAL_POW_EQ_1_IMP)); +(ASM_SIMP_TAC[ARITH_RULE `~(2 = 0)`]); +(STRIP_TAC); +(MATCH_MP_TAC (ARITH_RULE `abs x = &1 /\ &0 <= x ==> x = &1`)); +(ASM_SIMP_TAC[NORM_POS_LE]); + +(ASM_SIMP_TAC[]); +(ONCE_REWRITE_TAC[DOT_SQUARE_NORM]); +(ASM_SIMP_TAC[REAL_POW_2]); +ARITH_TAC; + +(* subgoal 9 *) +(SUBGOAL_THEN `!v:real^3. v IN set_of_edge w U (ECTC U) + ==> v dot e2 <= &0` ASSUME_TAC); +(GEN_TAC); +(STRIP_TAC); +(ONCE_REWRITE_TAC[DOT_SYM]); +(ONCE_REWRITE_TAC[ARITH_RULE `a <= &0 <=> &0 < --a \/ a = &0`]); +(ONCE_REWRITE_TAC[VECTOR_ARITH `--((e2:real^3) dot v) = (--v) dot e2`]); +(Q_EXPAND_TAC "e2"); +(ONCE_REWRITE_TAC[GSYM dot_gt_0]); +(ONCE_REWRITE_TAC[GSYM dot_eq_0]); +(ONCE_REWRITE_TAC[VECTOR_ARITH ` --(v:real^3) dot y = -- (y dot v)`]); +(ONCE_REWRITE_TAC[ARITH_RULE ` (&0 < --a \/ a = &0 )<=> a <= &0`]); +(Q_EXPAND_TAC "y_axis"); +(ASM_CASES_TAC `v:real^3 = u`); + +(* subgoal 9.1 *) +(FIRST_ASSUM(fun thm -> SIMP_TAC[thm;DOT_CROSS_SELF])); + ARITH_TAC; + +(* subgoal 9.2 *) +(MP_TAC (SPECL [`w:real^3`;`u:real^3`;`v:real^3`] lemma4)); +(ASM_SIMP_TAC[]); +(MATCH_MP_TAC (TAUT `A ==> (A ==>B) ==> B`)); +(MP_TAC (SPEC `U:real^3 -> bool` UBHDEUU2_quasi)); +(ASM_SIMP_TAC[]); +(DISCH_TAC); +(MP_TAC (SPECL [`U:real^3->bool`;`(ECTC U):(real^3->bool)->bool`;`w:real^3`; +`u:real^3`;`v:real^3`] azim_ge_azim_dart)); +(ASM_SIMP_TAC[]); + +(* subgoal 9.2.1 *) +(SUBGOAL_THEN `~(w:real^3 = u)` ASSUME_TAC); +(UNDISCH_TAC `u:real^3 IN set_of_edge w U (ECTC U)`); +(MP_TAC(SPECL [`w:real^3`;`U:real^3->bool`] lemma8)); +(ASM_SIMP_TAC[IN_ELIM_THM]); +(STRIP_TAC); +(STRIP_TAC); +(ONCE_REWRITE_TAC[GSYM DIST_EQ_0]); +(ASM_ARITH_TAC); + +(ASM_SIMP_TAC[]); +(ASM_ARITH_TAC); + +(* subgoal 10 *) +(SUBGOAL_THEN `?(a:real). &0 < a /\ a < pi /\ + (&2 - &2 * cos a ) * ( norm (w:real^3) pow 2) < epsilon pow 2` ASSUME_TAC); +(MP_TAC (SPEC `&0` REAL_CONTINUOUS_AT_COS)); +(ONCE_REWRITE_TAC[real_continuous_atreal]); +(DISCH_THEN (MP_TAC o (SPEC +`epsilon pow 2 / (&2 * norm(w:real^3) pow 2)`))); + +(* subgoal 10.1 *) +(SUBGOAL_THEN +`&0 < epsilon pow 2/ (&2 * norm (w:real^3) pow 2)` ASSUME_TAC); +(MATCH_MP_TAC REAL_LT_DIV); +(CONJ_TAC); + +(* subgoal 10.1.1 *) +(MATCH_MP_TAC REAL_POW_LT); +(ASM_SIMP_TAC[ARITH_RULE `&0 < a <=> a > &0`]); + +(* subgoal 10.1.2 *) +(MATCH_MP_TAC (ARITH_RULE ` &0 < a ==> &0 < &2 * a`)); +(MATCH_MP_TAC REAL_POW_LT); +(ASM_SIMP_TAC[NORM_POS_LT]); + +(ASM_SIMP_TAC[COS_0;REAL_MUL_RID;REAL_SUB_RZERO]); +(DISCH_THEN CHOOSE_TAC); +(FIRST_X_ASSUM MP_TAC); +STRIP_TAC; +(Q_ABBREV_TAC `m:real = min (d / &2) (pi / &2)` "phi"); +(EXISTS_TAC `m:real`); + (* subgoal 10.2 *) +(SUBGOAL_THEN `&0 < m:real` ASSUME_TAC); +(Q_EXPAND_TAC "phi"); +(SIMP_TAC[REAL_LT_MIN;PI2_BOUNDS]); +(MATCH_MP_TAC REAL_LT_DIV); +(ASM_ARITH_TAC); + +(* subgoal 10.3 *) +(SUBGOAL_THEN `m < pi` ASSUME_TAC); +(Q_EXPAND_TAC "phi"); +(ONCE_REWRITE_TAC[REAL_MIN_LT]); +(DISJ2_TAC); +(MATCH_MP_TAC (REAL_ARITH `&0 < a ==> a / &2 < a`)); +(SIMP_TAC[PI_POS]); + +(ASM_SIMP_TAC[]); +(ONCE_REWRITE_TAC [REAL_ARITH `(&2 - &2 * a) * b = (&1 - a) * (&2 * b)`]); +(MP_TAC (SPECL [`&1 - cos (m:real)`;`epsilon:real pow 2`; +`&2 * norm (w:real^3) pow 2`] REAL_LT_RDIV_EQ)); + +(* subgoal 10.4 *) +(SUBGOAL_THEN `&0 < &2 * norm (w:real^3) pow 2` ASSUME_TAC); +(ONCE_REWRITE_TAC[ARITH_RULE `&0 < &2 * a <=> &0 < a`]); +(MATCH_MP_TAC REAL_POW_LT); +(ASM_SIMP_TAC[NORM_POS_LT]); + +(ASM_SIMP_TAC[]); +(MATCH_MP_TAC (TAUT `A ==> (A <=> B ) ==> B`)); +(MATCH_MP_TAC (REAL_ARITH `abs a < b ==> a < b`)); +(ONCE_REWRITE_TAC[REAL_ARITH `abs (a - b) = abs (b - a)`]); +(FIRST_ASSUM (fun thm -> MATCH_MP_TAC thm)); + +(* subgoal 10.5 *) +(SUBGOAL_THEN `abs (m:real) = m` ASSUME_TAC); +(ONCE_REWRITE_TAC[REAL_ABS_REFL]); +(ASM_ARITH_TAC); +(ASM_SIMP_TAC[]); +(Q_EXPAND_TAC "phi"); +(ONCE_REWRITE_TAC[REAL_MIN_LT]); +(DISJ1_TAC); + ASM_ARITH_TAC; + +(FIRST_X_ASSUM CHOOSE_TAC); +(Q_ABBREV_TAC `s:real^3 = + (cos a * norm (w:real^3)) % e1 + (sin a * norm w) % e2` "subs_point"); +(Q_ABBREV_TAC `U':real^3 -> bool = s INSERT (U DELETE w)` "new_set"); + +(* subgoal 11 *) +(SUBGOAL_THEN `!(v:real^3). v IN U /\ ~(v = w) ==> &2 < dist (s,v)` +(LABEL_TAC "dist_gt_2")); +(GEN_TAC); +(STRIP_TAC); +(ASM_CASES_TAC `(v:real^3) IN set_of_edge w U (ECTC U)`); + +(* subgoal 11.1 *) +(SUBGOAL_THEN `dist ((w:real^3),v) = &2` ASSUME_TAC); +(FIRST_X_ASSUM MP_TAC); +(MP_TAC (SPECL [`w:real^3`;`U:real^3->bool`] lemma8)); +(ASM_SIMP_TAC[]); +(MATCH_MP_TAC (TAUT `B ==> (A ==> B)`)); +(SIMP_TAC[IN_ELIM_THM]); + +(FIRST_X_ASSUM (fun thm -> ONCE_REWRITE_TAC[GSYM thm])); +(MP_TAC (SPECL [`w:real^3`;`s:real^3`;`a:real`; +`e1:real^3`;`e2:real^3`;`e3:real^3`] lemma7)); +(ASM_SIMP_TAC[NORM_POS_LT]); +(DISCH_THEN (fun thm -> MATCH_MP_TAC (SPEC `v:real^3` thm))); +(ASM_SIMP_TAC[]); +(Q_EXPAND_TAC "e1"); +(ONCE_REWRITE_TAC[GSYM dot_gt_0]); +(ONCE_REWRITE_TAC[ARITH_RULE `&0 < a <=> a > &0`]); +(ONCE_REWRITE_TAC[DOT_SYM]); +(MP_TAC (SPECL [`U:real^3->bool`;`w:real^3`] lemma5)); +(ASM_SIMP_TAC[]); + +(* subgoal 11.2 *) +(ONCE_REWRITE_TAC[DIST_SYM]); +(MATCH_MP_TAC (REAL_ARITH `&2 < dist (v:real^3,w) - dist (s,w) /\ +dist (v,w) - dist (s,w) <= a ==> &2 < a`)); +(SIMP_TAC[Pack1.real_sub_norm]); +(MATCH_MP_TAC (REAL_ARITH +`a > &2 + (epsilon:real) /\ b < epsilon ==> &2 < a - b`)); +(ONCE_REWRITE_TAC[DIST_SYM]); +(ASM_SIMP_TAC[]); +(ONCE_REWRITE_TAC[DIST_SYM]); +(PURE_REWRITE_TAC[dist]); +(ONCE_REWRITE_TAC[NORM_LT_SQUARE]); +(ASM_SIMP_TAC[ARITH_RULE `&0 < a <=> a > &0`]); + +(* subgoal 11.2.1 *) +(SUBGOAL_THEN `s:real^3 - w = ((cos (a:real) - &1) * norm (w:real^3)) % e1 + +(sin a * norm w) % e2 + &0 % e3` ASSUME_TAC); +(* subgoal 11.2.1.1 *) +(SUBGOAL_THEN `w:real^3 = norm w % e1` ASSUME_TAC); +(Q_EXPAND_TAC "e1"); +(SIMP_TAC[norm_mul_normalize]); + +(FIRST_X_ASSUM(fun thm -> CONV_TAC(PAT_CONV `\x. s - x = A` +(ONCE_REWRITE_CONV[thm])))); +(Q_EXPAND_TAC "subs_point"); +(SIMP_TAC[VECTOR_MUL_LZERO;VECTOR_ADD_RID]); +(ONCE_REWRITE_TAC[VECTOR_ARITH +`(a % (e1:real^3) + b % e2) - c % e1 = (a - c) % e1 + b % e2`]); +(SIMP_TAC[ARITH_RULE `a * b - b = (a - &1) * b`]); +(MP_TAC (SPECL +[`s:real^3 - w`;`s:real^3 - w`;`e1:real^3`;`e2:real^3`;`e3:real^3`; +`(cos a - &1) * norm (w:real^3)`;`sin a * norm (w:real^3)`;`&0`; +`(cos a - &1) * norm (w:real^3)`;`sin a * norm (w:real^3)`;`&0`] +dot_coordinates_2)); +(ASM_SIMP_TAC[]); +(MATCH_MP_TAC (TAUT `B ==> A ==> B`)); +(ONCE_REWRITE_TAC [REAL_ARITH +`(a * b) * a * b + (c * b) * c * b + &0 * &0 = (a * a + c * c) * b pow 2`]); +(ONCE_REWRITE_TAC [REAL_ARITH +`(a - &1) * (a - &1) + b * b = &1 - &2 * a + b pow 2 + a pow 2`]); +(SIMP_TAC[SIN_CIRCLE]); +(ASM_SIMP_TAC[REAL_ARITH `&1 - b + &1 = &2 - b`]); + +(* subgoal 12 *) +(SUBGOAL_THEN `!(v:real^3). v IN U' /\ ~(v = s) ==> &2 < dist (s,v)` +(LABEL_TAC "iso")); +(GEN_TAC); +(Q_EXPAND_TAC "new_set"); +(SIMP_TAC[IN_INSERT; TAUT ` ((A \/ B) /\ ~A) <=> (~A /\ B)`]); +(SIMP_TAC[IN_DELETE]); +(ASM_SIMP_TAC[]); + +(* subgoal 13 *) +(SUBGOAL_THEN `~(s:real^3 IN U)` ASSUME_TAC); +(ONCE_REWRITE_TAC[SET_RULE `~(x IN S) <=> (!y. y IN S ==> ~(x = y))`]); +GEN_TAC; +STRIP_TAC; +(ASM_CASES_TAC `y':real^3 = w`); + +(* subgoal 13.1 *) +(ASM_SIMP_TAC[]); +(* subgoal 13.1.1 *) +(SUBGOAL_THEN `w:real^3 = norm w % e1 + &0 % e2 + &0 % e3` ASSUME_TAC); +(SIMP_TAC[ VECTOR_ARITH `a % e1 + &0 % e2 + &0 % e3 = a % e1`]); +(Q_EXPAND_TAC "e1"); +(SIMP_TAC[norm_mul_normalize]); + +(FIRST_X_ASSUM (fun thm -> ONCE_REWRITE_TAC[thm])); +(USE_THEN "subs_point" (fun thm -> ONCE_REWRITE_TAC[GSYM thm])); +(CONV_TAC(PAT_CONV `\x. ~(x = A)` (ONCE_REWRITE_CONV[ +VECTOR_ARITH `a % e1 + b % e2 = a % e1 + b % e2 + &0 % e3`]))); +(MP_TAC ( SPECL [`e1:real^3`;`e2:real^3`;`e3:real^3`; +`cos a * norm (w:real^3)`;`sin a * norm (w:real^3)`;`&0`; +`norm (w:real^3)`;`&0`;`&0`] ORTHONORMAL_IMP_INDEPENDENT_EXPLICIT )); +(MATCH_MP_TAC(TAUT `(A /\ ~C) ==> ((A ==> ( B <=> C)) ==> ~B) `)); +(ASM_SIMP_TAC[]); +(MATCH_MP_TAC (TAUT `~B ==> ~ (A /\ B)`)); +(SIMP_TAC[REAL_ENTIRE]); +(SIMP_TAC[TAUT `~(A \/ B) <=> ~A /\ ~B`]); +CONJ_TAC; + +(* subgoal 13.1.2 *) +(ASM_SIMP_TAC[PI_WORKS]); +(* subgoal 13.1.3 *) +(MATCH_MP_TAC(ARITH_RULE `&0 < x ==> ~(x = &0)`)); +(ASM_SIMP_TAC[NORM_POS_LT]); + +(* subgoal 13.2 *) +(ONCE_REWRITE_TAC[DIST_NZ]); +(MATCH_MP_TAC (ARITH_RULE `&2 < a ==> &0 < a`)); +(USE_THEN "dist_gt_2" (fun thm -> MATCH_MP_TAC thm)); +(ASM_SIMP_TAC[]); + + +(* subgoal 14 *) +(SUBGOAL_THEN `U':real^3 -> bool IN S` ASSUME_TAC); +(EXPAND_TAC "S"); +(SIMP_TAC[IN_ELIM_THM]); + +(* subgoal 14.1 *) +(SUBGOAL_THEN `norm (s:real^3) = norm (w:real^3)` ASSUME_TAC); +(MP_TAC (SPECL [`w:real^3`;`s:real^3`;`a:real`; +`e1:real^3`;`e2:real^3`;`e3:real^3`] lemma6)); +(ASM_SIMP_TAC[]); + +(* subgoal 14.2 *) +(SUBGOAL_THEN `FINITE (U':real^3->bool)` ASSUME_TAC); +(Q_EXPAND_TAC "new_set"); +(ONCE_REWRITE_TAC[FINITE_INSERT]); +(ASM_SIMP_TAC[FINITE_DELETE]); + +(* subgoal 14.3 *) +(SUBGOAL_THEN `packing (U':real^3 -> bool)` ASSUME_TAC); +(PURE_REWRITE_TAC[packing]); +(REPEAT GEN_TAC); +(CONV_TAC(PAT_CONV `\x. x /\ x /\ A ==> B` +(ONCE_REWRITE_CONV[GSYM IN]))); +(STRIP_TAC); +(ASM_CASES_TAC `u':real^3 = s`); + +(* subgoal 14.3.1 *) +(ASM_SIMP_TAC[]); +(MATCH_MP_TAC (ARITH_RULE `&2 < a ==> &2 <= a`)); +(FIRST_ASSUM (fun thm -> MATCH_MP_TAC thm)); +(ASM_SIMP_TAC[]); +(FIRST_X_ASSUM(fun thm-> ONCE_REWRITE_TAC[GSYM thm])); +(ASM_SIMP_TAC[EQ_SYM_EQ]); + +(ASM_CASES_TAC `v:real^3 = s`); + +(* subgoal 14.3.2.1 *) +(ASM_SIMP_TAC[]); +(ONCE_REWRITE_TAC[DIST_SYM]); +(MATCH_MP_TAC (ARITH_RULE `&2 < a ==> &2 <= a`)); +(FIRST_ASSUM (fun thm -> MATCH_MP_TAC thm)); +(ASM_SIMP_TAC[]); + +(* subgoal 14.3.2.2 *) +(UNDISCH_TAC `u':real^3 IN U'`); +(Q_EXPAND_TAC "new_set"); +(ASM_SIMP_TAC[IN_INSERT;IN_DELETE]); +(STRIP_TAC); +(UNDISCH_TAC `v:real^3 IN U'`); +(Q_EXPAND_TAC "new_set"); +(ASM_SIMP_TAC[IN_INSERT;IN_DELETE]); +(STRIP_TAC); +(UNDISCH_TAC `packing (U:real^3->bool)`); +(PURE_REWRITE_TAC[packing]); +(DISCH_THEN (fun thm -> MATCH_MP_TAC (SPECL [`u':real^3`;`v:real^3`] thm))); +(CONV_TAC(PAT_CONV `\x. x /\ x /\ A` (ONCE_REWRITE_CONV[GSYM IN]))); +(ASM_SIMP_TAC[]); + +(ASM_SIMP_TAC[]); +(Q_ABBREV_TAC `(h:real^3->real^3) = (\v. if v = w then s else v)` "h"); +(EXISTS_TAC `(h:real^3->real^3) o (phi:real^3->real^3)`); +(CONJ_TAC); + +(* subgoal 14.4 *) +(MATCH_MP_TAC Hypermap.COMPOSE_BIJ); +(EXISTS_TAC `U:real^3->bool`); +(ASM_SIMP_TAC[]); +(* subgoal 14.4.1 *) +(SUBGOAL_THEN `!v:real^3. v IN U ==> (h:real^3->real^3) v IN U'` ASSUME_TAC); +(REPEAT STRIP_TAC); +(Q_EXPAND_TAC "h"); +(SIMP_TAC[BETA_THM]); +(COND_CASES_TAC); +(* subgoal 14.4.1.1 *) +(Q_EXPAND_TAC "new_set"); +(SET_TAC[]); +(* subgoal 14.5.1.2 *) +(Q_EXPAND_TAC "new_set"); +(SIMP_TAC[IN_INSERT]); +(DISJ2_TAC); +(ASM_SIMP_TAC[IN_DELETE]); + +(ASM_SIMP_TAC[BIJ;INJ;SURJ]); +(CONJ_TAC); + +(* subgoal 14.5.2 *) +(REPEAT STRIP_TAC); +(UNDISCH_TAC `(h:real^3->real^3) x = h y'`); +(Q_EXPAND_TAC "h"); +(SIMP_TAC[BETA_THM]); +(COND_CASES_TAC); + +(* subgoal 14.5.2.1 *) +(COND_CASES_TAC); +(* subgoal 14.5.2.1.1 *) +(ASM_SIMP_TAC[]); +(* subgoal 14.5.2.1.2 *) +(ASM_MESON_TAC[]); + +(* subgoal 14.5.2.2 *) +(COND_CASES_TAC); + +(* subgoal 14.5.2.2.1 *) +(ASM_MESON_TAC[]); + +(* subgoal 14.5.2.2.2 *) +(SIMP_TAC []); + +(* subgoal 14.5.3 *) +(REPEAT STRIP_TAC); +(ASM_CASES_TAC `x:real^3 = s`); + +(* subgoal 14.5.3.1 *) +(EXISTS_TAC `w:real^3`); +(ASM_SIMP_TAC[]); +(Q_EXPAND_TAC "h"); +(SIMP_TAC[BETA_THM]); + +(* subgoal 14.5.3.2 *) +(EXISTS_TAC `x:real^3`); +(UNDISCH_TAC `x:real^3 IN U'`); +(Q_EXPAND_TAC "new_set"); +(ASM_SIMP_TAC[IN_INSERT;IN_DELETE]); +(STRIP_TAC); +(Q_EXPAND_TAC "h"); +(ASM_SIMP_TAC[BETA_THM]); + +(REPEAT STRIP_TAC); +(SIMP_TAC[o_THM]); + +(* subgoal 14.6 *) +(SUBGOAL_THEN `! x:real^3. x IN U ==> norm x = norm ((h:real^3->real^3) x)` MATCH_MP_TAC); +(REPEAT STRIP_TAC); +(Q_EXPAND_TAC "h"); +(SIMP_TAC[BETA_THM]); +(COND_CASES_TAC); +(* subgoal 14.6.1 *) +(ASM_SIMP_TAC[]); + +(* subgoal 14.6.2 *) +(SIMP_TAC[]); + +(UNDISCH_TAC `BIJ (phi:real^3->real^3) V U`); +(SIMP_TAC[BIJ]); +(DISCH_THEN (fun thm -> MP_TAC (CONJUNCT1 thm))); +(SIMP_TAC[INJ]); +(DISCH_THEN (fun thm -> MATCH_MP_TAC (CONJUNCT1 thm))); +(ASM_SIMP_TAC[]); + +(* subgoal 15 *) +(SUBGOAL_THEN `~((f:(real^3->bool)->num) U' <= f U)` ASSUME_TAC); +(ONCE_REWRITE_TAC[ ARITH_RULE `~((a:num) <= b) <=> (b < a)`]); +(EXPAND_TAC "f"); +(MATCH_MP_TAC CARD_PSUBSET); +(CONJ_TAC); + +(* subgoal 15.1 *) +(ONCE_REWRITE_TAC[PSUBSET_ALT]); +(CONJ_TAC); + +(* subgoal 15.1.1 *) +(ONCE_REWRITE_TAC[SUBSET]); +GEN_TAC; +(ONCE_REWRITE_TAC[set_of_iso]); +(SIMP_TAC[IN_ELIM_THM]); +(STRIP_TAC); + +(* subgoal 15.1.1.1 *) +(SUBGOAL_THEN `x:real^3 IN U'` ASSUME_TAC); +(Q_EXPAND_TAC "new_set"); +(SIMP_TAC[IN_INSERT]); +DISJ2_TAC; +(SIMP_TAC[IN_DELETE]); +(ASM_SIMP_TAC[]); +(ASM_MESON_TAC[]); + +(ASM_SIMP_TAC[]); +(ONCE_REWRITE_TAC[GSYM SUBSET_EMPTY]); +(UNDISCH_TAC `set_of_edge x U (ECTC U) = {}`); +(DISCH_THEN(fun thm -> ONCE_REWRITE_TAC[GSYM thm])); +(MP_TAC (SPECL [`x:real^3`;`U:real^3->bool`] lemma8)); +(ASM_SIMP_TAC[]); +(MATCH_MP_TAC (TAUT `B ==> (A ==> B)`)); +(MP_TAC (SPECL [`x:real^3`;`U':real^3->bool`] lemma8)); +(ASM_SIMP_TAC[]); +(MATCH_MP_TAC (TAUT `B ==> (A ==> B)`)); +(SIMP_TAC[SUBSET;IN_ELIM_THM]); +GEN_TAC; +(Q_EXPAND_TAC "new_set"); +(SIMP_TAC[IN_INSERT;IN_DELETE]); +(MATCH_MP_TAC (TAUT `(D ==> ~A) ==> (A \/ B /\ C) /\ D ==> B`)); +(MATCH_MP_TAC (TAUT `(B ==> ~A) ==> (A ==> ~B)`)); +STRIP_TAC; +(ASM_SIMP_TAC[]); +(ONCE_REWRITE_TAC[DIST_SYM]); +(MATCH_MP_TAC (ARITH_RULE `&2 < a ==> ~(a = &2)`)); +(USE_THEN "dist_gt_2" (fun thm -> MATCH_MP_TAC thm)); +(ASM_SIMP_TAC[]); +(ASM_SET_TAC[]); + +(* subgoal 15.2 *) +(EXISTS_TAC `s:real^3`); +(CONJ_TAC); +(* subgoal 15.2.1 *) +(SIMP_TAC[set_of_iso;IN_ELIM_THM]); +(* subgoal 15.2.1.1 *) +(SUBGOAL_THEN `s:real^3 IN U'` ASSUME_TAC); +(Q_EXPAND_TAC "new_set"); +(SET_TAC[]); + +(ASM_SIMP_TAC[]); +(MP_TAC (SPECL [`s:real^3`;`U':real^3->bool`] lemma8)); +(ASM_SIMP_TAC[]); +(MATCH_MP_TAC (TAUT ` B ==> A ==> B`)); +(ONCE_REWRITE_TAC[SET_RULE `{x| P x} = {} <=> !x. ~(P x)`]); +(GEN_TAC); +(MATCH_MP_TAC (TAUT ` (A ==> ~B) ==> ~(A /\ B)`)); +(STRIP_TAC); +(ASM_CASES_TAC `v:real^3 = s`); + +(* subgoal 15.2.1.2 *) +(ASM_SIMP_TAC[DIST_REFL]); +ARITH_TAC; +(* subgoal 15.2.1.3 *) +(MATCH_MP_TAC (ARITH_RULE `&2 < a ==> ~ (a = &2)`)); +(USE_THEN "iso" (fun thm -> MATCH_MP_TAC thm)); +(ASM_SIMP_TAC[]); + +(* subgoal 15.2.2 *) +(ASM_SIMP_TAC[set_of_iso;IN_ELIM_THM]); +(MATCH_MP_TAC ( ISPECL [`set_of_iso (U':real^3->bool)`; +`U':real^3->bool`] FINITE_SUBSET)); +(ASM_SIMP_TAC[set_of_iso]); +(SET_TAC[]); + +(ASM_MESON_TAC[]); +(ASM_MESON_TAC[]); +]);; + +end;; diff --git a/text_formalization/tame/HRXEFDM.hl b/text_formalization/tame/HRXEFDM.hl new file mode 100644 index 0000000..a59699f --- /dev/null +++ b/text_formalization/tame/HRXEFDM.hl @@ -0,0 +1,284 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Tame Hypermap *) +(* Author: Alexey Solovyev *) +(* Date: 2010-06-17 *) +(* Note: use Tame_lemmas.sum_tauVEF_upper_bound because the theorem below *) +(* has unproved assumptions *) +(* ========================================================================== *) + +(* Proof of HRXEFDM *) + +flyspeck_needs "tame/TameGeneral.hl";; + + +module Hrxefdm_tame = struct + + +open Hypermap;; +open Fan_defs;; +open Tame_defs;; +open Tame_general;; +open Hypermap_and_fan;; + + +let tauVEF_alt1 = prove(`!V E f. conforming (V,E) /\ f IN face_set_of_fan (V,E) ==> + tauVEF (V,E,f) = sol (vec 0) (dartset_leads_into (vec 0,V,E) f) + (&2 - &(CARD f)) * sol0 - sol0 / pi * sum f (\x. azim_dart (V,E) x * (lmfun (h_dart x) - &1))`, + REWRITE_TAC[face_set_of_fan; conforming; conforming_solid_angle] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `f:real^3#real^3->bool`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o let_RULE) THEN + DISCH_THEN (CONJUNCTS_THEN2 (fun th -> ALL_TAC) MP_TAC) THEN + DISCH_THEN (CONJUNCTS_THEN2 (fun th -> ALL_TAC) MP_TAC) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + + REWRITE_TAC[tauVEF] THEN + REWRITE_TAC[REAL_ARITH `a * (&1 + b * (&1 - c)) = a - b * (a * (c - &1))`] THEN + SUBGOAL_THEN `FINITE (f:real^3#real^3->bool)` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REWRITE_TAC[face_set; set_of_orbits; GSYM face] THEN + REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN + ASM_REWRITE_TAC[FACE_FINITE]; + ALL_TAC + ] THEN + + ASM_SIMP_TAC[SUM_SUB; SUM_LMUL; SUM_CONST] THEN + REAL_ARITH_TAC);; + + + +let tauVEF_alt2 = prove(`!V E f. conforming (V,E) /\ f IN face_set_of_fan (V,E) + ==> tauVEF (V,E,f) = sol (vec 0) (dartset_leads_into (vec 0,V,E) f) * (&1 + sol0 / pi) - sol0 / pi * sum f (\x. azim_dart (V,E) x * lmfun (h_dart x))`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[tauVEF_alt1] THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REWRITE_TAC[conforming; conforming_solid_angle; face_set_of_fan] THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `f:real^3#real^3->bool`) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[let_RULE th]) THEN + + SUBGOAL_THEN `FINITE (f:real^3#real^3->bool)` ASSUME_TAC THENL + [ + POP_ASSUM MP_TAC THEN + REWRITE_TAC[face_set; set_of_orbits; GSYM face] THEN + REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN + ASM_REWRITE_TAC[FACE_FINITE]; + ALL_TAC + ] THEN + + REWRITE_TAC[REAL_ARITH `a * (b - &1) = a * b - a`] THEN + ASM_SIMP_TAC[SUM_SUB; SUM_CONST] THEN + + MP_TAC PI_POS THEN + CONV_TAC REAL_FIELD);; + + + + +let CHOICE_CONST_LEMMA = prove(`!f s. (!x y. x IN s /\ y IN s ==> f x = f y) ==> (!x. x IN s ==> f x = f (CHOICE s))`, + MESON_TAC[CHOICE]);; + + +let scriptL_lemma = prove(`!V E. FAN (vec 0,V,E) + ==> scriptL V = sum (node_set (hypermap_of_fan (V,E))) (\n. lmfun (h_dart (CHOICE n)))`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[scriptL] THEN + MP_TAC (SPEC_ALL NODE_SET_AS_IMAGE) THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + + SUBGOAL_THEN `(\v:real^3. lmfun (norm v / &2)) = (\n. lmfun (h_dart (CHOICE n))) o (f:real^3->(real^3#real^3->bool))` MP_TAC THENL + [ + ASM_REWRITE_TAC[FUN_EQ_THM; o_THM; h_dart]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MATCH_MP_TAC (GSYM SUM_IMAGE) THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`x:real^3`; `y:real^3`]) THEN + ASM_SIMP_TAC[]);; + + + +let HRXEFDM_lemma1 = prove(`!V E. FAN (vec 0,V,E) ==> + sum (face_set_of_fan (V,E)) (\f. sum f (\x. azim_dart (V,E) x * lmfun (h_dart x))) + = &2 * pi * scriptL V`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `!n. n IN node_set (hypermap_of_fan (V,E)) ==> sum n (azim_dart (V,E)) = &2 * pi` ASSUME_TAC THENL + [ + GEN_TAC THEN + REWRITE_TAC[node_set; set_of_orbits; GSYM node] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + ASM_SIMP_TAC[dart; HYPERMAP_OF_FAN] THEN + STRIP_TAC THEN + MP_TAC (SPEC_ALL SUM_AZIM_DART) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + REWRITE_TAC[face_set_of_fan; DART_SUM_lemma] THEN + REWRITE_TAC[GSYM (SPEC_ALL DART_SUM_lemma)] THEN + ABBREV_TAC `g = (\n. sum n (\x. azim_dart (V,E) x * lmfun (h_dart x)))` THEN + MP_TAC (ISPECL [`g:(real^3#real^3->bool)->real`; `node_set (hypermap_of_fan (V,E))`] SUM_RESTRICT) THEN + REWRITE_TAC[FINITE_HYPERMAP_ORBITS] THEN + DISCH_TAC THEN + + SUBGOAL_THEN `!n. n IN node_set (hypermap_of_fan (V,E)) ==> g n = &2 * pi * lmfun (h_dart (CHOICE n))` MP_TAC THENL + [ + REMOVE_ASSUM THEN GEN_TAC THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + DISCH_TAC THEN + FIRST_ASSUM (fun th -> FIRST_X_ASSUM (ASSUME_TAC o (fun th2 -> MATCH_MP th2 th))) THEN + MP_TAC (ISPECL [`(\x. azim_dart (V,E) x * lmfun (h_dart x))`; `n:real^3#real^3->bool`] SUM_RESTRICT) THEN + SUBGOAL_THEN `FINITE (n:real^3#real^3->bool)` ASSUME_TAC THENL + [ + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[node_set; set_of_orbits; GSYM node] THEN + REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN + ASM_REWRITE_TAC[NODE_FINITE]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN + + ABBREV_TAC `c = lmfun (h_dart (CHOICE (n:real^3#real^3->bool)))` THEN + SUBGOAL_THEN `!x. (if x IN n then azim_dart (V,E) x * lmfun (h_dart x) else &0) = (if x IN n then azim_dart (V,E) x * c else &0)` MP_TAC THENL + [ + GEN_TAC THEN + ASM_CASES_TAC `x:real^3#real^3 IN n` THEN ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `h_dart (x:real^3#real^3) = h_dart (CHOICE (n:real^3#real^3->bool))` (fun th -> ASM_REWRITE_TAC[th]) THEN + MP_TAC (ISPECL [`h_dart:real^3#real^3->real`; `n:real^3#real^3->bool`] CHOICE_CONST_LEMMA) THEN + ANTS_TAC THENL + [ + REPEAT STRIP_TAC THEN + REWRITE_TAC[h_dart] THEN + AP_THM_TAC THEN AP_TERM_TAC THEN + AP_TERM_TAC THEN + MP_TAC (SPEC_ALL FST_NODE_lemma) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + REMOVE_ASSUM THEN + DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o check (is_eq o concl)) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MP_TAC (ISPECL [`(\x. azim_dart (V,E) x * c)`; `n:real^3#real^3->bool`] SUM_RESTRICT) THEN + ASM_SIMP_TAC[SUM_RMUL; ETA_AX] THEN + REWRITE_TAC[REAL_MUL_ASSOC]; + ALL_TAC + ] THEN + + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + DISCH_TAC THEN + SUBGOAL_THEN `!x. (if x IN node_set (hypermap_of_fan (V,E)) then g x else &0) = (if x IN node_set (hypermap_of_fan (V,E)) then &2 * pi * lmfun (h_dart (CHOICE x)) else &0)` MP_TAC THENL + [ + GEN_TAC THEN + ASM_CASES_TAC `x IN node_set (hypermap_of_fan (V,E))` THEN ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MP_TAC (ISPECL [`(\x:real^3#real^3->bool. &2 * pi * lmfun (h_dart (CHOICE x)))`; `node_set (hypermap_of_fan (V,E))`] SUM_RESTRICT) THEN + REWRITE_TAC[FINITE_HYPERMAP_ORBITS] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[SUM_LMUL] THEN + ASM_SIMP_TAC[scriptL_lemma]);; + + + + + +let solid_angle_sum_assumption = `!V E. sum (face_set_of_fan (V,E)) (\f. sol (vec 0) (dartset_leads_into (vec 0,V,E) f) ) = &4 * pi`;; + + + +let HRXEFDM_concl = `!V. contravening V ==> + ( sum (face_set_of_fan (V,ESTD V)) (\ f. tauVEF (V,ESTD V,f) ) < &4 * pi - &20 * sol0 )`;; + + +let HRXEFDM_concl2 = mk_imp (list_mk_conj [`!V. contravening V ==> conforming (V,ESTD V)`; + solid_angle_sum_assumption], HRXEFDM_concl);; + + + + +(* g (HRXEFDM_concl2);; *) +let HRXEFDM = prove(HRXEFDM_concl2, + REPEAT STRIP_TAC THEN + REPEAT (FIRST_X_ASSUM (ASSUME_TAC o SPEC `V:real^3->bool`)) THEN + POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (SPEC_ALL CONTRAVENING_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + FIRST_X_ASSUM (ASSUME_TAC o SPEC `ESTD V`) THEN + + SUBGOAL_THEN `FINITE (face_set_of_fan (V,ESTD V))` ASSUME_TAC THENL + [ + REWRITE_TAC[face_set_of_fan; FINITE_HYPERMAP_ORBITS]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `sum (face_set_of_fan (V,ESTD V)) (\f. tauVEF (V,ESTD V,f)) = &4 * pi * (&1 + sol0 / pi) - sol0 / pi * &2 * pi * scriptL V` ASSUME_TAC THENL + [ + MP_TAC (ISPECL [`\f. tauVEF (V,ESTD V,f)`; `face_set_of_fan (V,ESTD V)`] SUM_RESTRICT) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + ABBREV_TAC `g = (\f. sol (vec 0) (dartset_leads_into (vec 0,V,ESTD V) f) * (&1 + sol0 / pi) - sol0 / pi * sum f (\x. azim_dart (V,ESTD V) x * lmfun (h_dart x)))` THEN + + SUBGOAL_THEN `!x. (if x IN face_set_of_fan (V,ESTD V) then tauVEF (V,ESTD V,x) else &0) = (if x IN face_set_of_fan (V,ESTD V) then g x else &0)` (fun th -> REWRITE_TAC[th]) THENL + [ + X_GEN_TAC `f:real^3#real^3->bool` THEN + ASM_CASES_TAC `f IN face_set_of_fan (V,ESTD V)` THEN ASM_REWRITE_TAC[] THEN + EXPAND_TAC "g" THEN + MATCH_MP_TAC tauVEF_alt2 THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (ISPECL [`(\x. g x):(real^3#real^3->bool)->real`; `face_set_of_fan (V,ESTD V)`] SUM_RESTRICT) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + + ASM_SIMP_TAC[SUM_SUB; SUM_RMUL; SUM_LMUL] THEN + ASM_SIMP_TAC[HRXEFDM_lemma1] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + ASSUME_TAC PI_POS THEN + + ASM_SIMP_TAC[REAL_FIELD `&0 < pi ==> &4 * pi * (&1 + sol0 / pi) = &4 * pi + &4 * sol0`] THEN + ASM_SIMP_TAC[REAL_FIELD `&0 < pi ==> sol0 / pi * &2 * pi * a = &2 * a * sol0`] THEN + REWRITE_TAC[REAL_ARITH `(&4 * pi + &4 * a) - (&2 * b * a) = (&4 * pi - &20 * a) + &2 * a * (&12 - b)`] THEN + REWRITE_TAC[REAL_ARITH `a + b < a <=> b < &0`] THEN + ONCE_REWRITE_TAC[REAL_ARITH `&0 = (&2 * sol0) * &0`] THEN + REWRITE_TAC[REAL_MUL_ASSOC] THEN + MATCH_MP_TAC REAL_LT_LMUL THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC REAL_LT_MUL THEN + REWRITE_TAC[REAL_ARITH `&0 < &2`; sol0_POS]; + ALL_TAC + ] THEN + + REWRITE_TAC[REAL_ARITH `a - b < &0 <=> b > a`] THEN + FIRST_X_ASSUM (MP_TAC o check (fun th -> rator (concl th) = `contravening`)) THEN + SIMP_TAC[contravening]);; + + + +end;; diff --git a/text_formalization/tame/Inequalities.hl b/text_formalization/tame/Inequalities.hl new file mode 100644 index 0000000..8d8a17b --- /dev/null +++ b/text_formalization/tame/Inequalities.hl @@ -0,0 +1,740 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Tame Hypermap *) +(* Author: Alexey Solovyev *) +(* Date: 2010-07-07 *) +(* Some nonlinear (polynomial) inequalities *) +(* ========================================================================== *) + +flyspeck_needs "general/sphere.hl";; +flyspeck_needs "trigonometry/trigonometry.hl";; +flyspeck_needs "nonlinear/ineq.hl";; + + +module Tame_inequalities = struct + + +let let_RULE = fun th -> REWRITE_RULE[DEPTH_CONV let_CONV (concl th)] th;; + +let REMOVE_ASSUM = POP_ASSUM (fun th -> ALL_TAC);; + + + +(* Alternative form for ineq *) +let INEQ_ALT = prove(`!A bounds. ineq bounds A <=> (ALL (\(a,x,b). a <= x /\ x <= b) bounds ==> A)`, + GEN_TAC THEN + MATCH_MP_TAC list_INDUCT THEN REPEAT STRIP_TAC THENL + [ + REWRITE_TAC[Sphere.ineq; ALL]; + ALL_TAC + ] THEN + MP_TAC (ISPEC `a0:real#real#real` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `a:real` MP_TAC) THEN + DISCH_THEN (CHOOSE_THEN MP_TAC) THEN + MP_TAC (ISPEC `y:real#real` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `x:real` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `b:real` MP_TAC) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ASM_SIMP_TAC[Sphere.ineq; ALL; IMP_IMP]);; + + + +(**************************************************) + +let lemma = prove(`!a b c x x0 x1. a < &0 /\ x0 <= x /\ x <= x1 ==> a*x*x + b*x + c >= a*x0*x0 + b*x0 + c \/ a*x*x + b*x + c >= a*x1*x1 + b*x1 + c`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[REAL_ARITH `a*x*x + b*x + c >= a*x0*x0 + b*x0 + c <=> &0 <= (x - x0) * (a * x0 + a * x + b)`] THEN + DISJ_CASES_TAC (REAL_ARITH `&0 <= a * x0 + a * x + b \/ a * x0 + a * x + b < &0`) THENL + [ + DISJ1_TAC THEN + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 <= x - x0 <=> x0 <= x`]; + DISJ2_TAC THEN + REWRITE_TAC[REAL_ARITH `(x - x1) * (a * x1 + a * x + b) = (x1 - x) * --(a * x1 + a * x + b)`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 <= x1 - x <=> x <= x1`; REAL_ARITH `&0 <= --a <=> a <= &0`] THEN + MATCH_MP_TAC REAL_LE_TRANS THEN + EXISTS_TAC `a * x0 + a * x + b:real` THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE] THEN + REWRITE_TAC[REAL_ARITH `a + b <= c + b <=> a <= c`] THEN + REWRITE_TAC[REAL_ARITH `a * x1 <= a * x0 <=> &0 <= --a * (x1 - x0)`] THEN + MATCH_MP_TAC REAL_LE_MUL THEN + REPEAT (POP_ASSUM MP_TAC) THEN + REAL_ARITH_TAC + ]);; + + +let lemma' = prove(`!f a b c x x0 x1. f = (\x. a*x*x + b*x + c) /\ x0 <= x /\ x <= x1 /\ a < &0 ==> f x >= f x0 \/ f x >= f x1`, + REPEAT STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC lemma THEN + ASM_REWRITE_TAC[]);; + + +let lemma1 = prove(`!x1 x2 x3 x4 x5 x6. #4.0 <= x1 /\ x1 <= #6.3504 /\ #4.0 <= x4 ==> delta_x x1 x2 x3 x4 x5 x6 >= delta_x #4.0 x2 x3 x4 x5 x6 \/ delta_x x1 x2 x3 x4 x5 x6 >= delta_x #6.3504 x2 x3 x4 x5 x6`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `!x1. delta_x x1 x2 x3 x4 x5 x6 = (\x. delta_x x x2 x3 x4 x5 x6) x1` (fun th -> ONCE_REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC lemma' THEN + ASM_REWRITE_TAC[Sphere.delta_x; FUN_EQ_THM] THEN + MAP_EVERY EXISTS_TAC [`--x4`; `x4*(x2+x3-x4+x5+x6)+x2*x5+x3*x6-x3*x5-x2*x6`; `x2*x5*(x3-x2+x4-x5+x6) + x3*x6*(x2-x3+x4+x5-x6)-x2*x3*x4-x4*x5*x6`] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC);; + + +let lemma2 = prove(`!x1 x2 x3 x4 x5 x6. #4.0 <= x2 /\ x2 <= #6.3504 /\ #4.0 <= x5 ==> delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 #4.0 x3 x4 x5 x6 \/ delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 #6.3504 x3 x4 x5 x6`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `!x2. delta_x x1 x2 x3 x4 x5 x6 = (\x. delta_x x1 x x3 x4 x5 x6) x2` (fun th -> ONCE_REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[]; + ALL_TAC + ] THEN + + MATCH_MP_TAC lemma' THEN + ASM_REWRITE_TAC[Sphere.delta_x; FUN_EQ_THM] THEN + MAP_EVERY EXISTS_TAC [`--x5`; `x5*(x1+x3+x4-x5+x6)+x1*x4+x3*x6-x3*x4-x1*x6`; `x1*x4*(--x1+x3-x4+x5+x6) + x3*x6*(x1-x3+x4+x5-x6)-x1*x3*x5-x4*x5*x6`] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC);; + + +let lemma3 = prove(`!x1 x2 x3 x4 x5 x6. #4.0 <= x3 /\ x3 <= #6.3504 /\ #4.0 <= x6 ==> delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 x2 #4.0 x4 x5 x6 \/ delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 x2 #6.3504 x4 x5 x6`, + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x2 x x4 x5 x6) x3`)] THEN + MATCH_MP_TAC lemma' THEN + ASM_REWRITE_TAC[Sphere.delta_x; FUN_EQ_THM] THEN + MAP_EVERY EXISTS_TAC [`--x6`; `x6*(x1+x2-x6+x4+x5)+x1*x4+x2*x5-x2*x4-x1*x5`; `x2*x5*(x1-x2+x4-x5+x6) + x1*x4*(--x1+x2-x4+x5+x6)-x1*x2*x6-x4*x5*x6`] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC);; + + +let lemma4 = prove(`!x1 x2 x3 x4 x5 x6. #4.0 <= x4 /\ x4 <= #6.3504 /\ #4.0 <= x1 ==> delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 x2 x3 #4.0 x5 x6 \/ delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 x2 x3 #6.3504 x5 x6`, + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x2 x3 x x5 x6) x4`)] THEN + MATCH_MP_TAC lemma' THEN + ASM_REWRITE_TAC[Sphere.delta_x; FUN_EQ_THM] THEN + MAP_EVERY EXISTS_TAC [`--x1`; `x1*(--x1+x2+x3+x5+x6)+x2*x5+x3*x6-x2*x3-x5*x6`; `x2*x5*(x1-x2+x3-x5+x6) + x3*x6*(x1+x2-x3+x5-x6)-x1*x3*x5-x1*x2*x6`] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC);; + + +let lemma5 = prove(`!x1 x2 x3 x4 x5 x6. #4.0 <= x5 /\ x5 <= #6.3504 /\ #4.0 <= x2 ==> delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 x2 x3 x4 #4.0 x6 \/ delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 x2 x3 x4 #6.3504 x6`, + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x2 x3 x4 x x6) x5`)] THEN + MATCH_MP_TAC lemma' THEN + ASM_REWRITE_TAC[Sphere.delta_x; FUN_EQ_THM] THEN + MAP_EVERY EXISTS_TAC [`--x2`; `x2*(x1+x3-x2+x4+x6)+x1*x4+x3*x6-x1*x3-x4*x6`; `x1*x4*(--x1+x2+x3-x4+x6) + x3*x6*(x1+x2-x3+x4-x6)-x2*x3*x4-x1*x2*x6`] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC);; + + +let lemma6 = prove(`!x1 x2 x3 x4 x5 x6. #4.0 <= x6 /\ x6 <= #6.3504 /\ #4.0 <= x3 ==> delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 x2 x3 x4 x5 #4.0 \/ delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 x2 x3 x4 x5 #6.3504`, + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x2 x3 x4 x5 x) x6`)] THEN + MATCH_MP_TAC lemma' THEN + ASM_REWRITE_TAC[Sphere.delta_x; FUN_EQ_THM] THEN + MAP_EVERY EXISTS_TAC [`--x3`; `x3*(x1+x2-x3+x4+x5)+x1*x4+x2*x5-x1*x2-x4*x5`; `x2*x5*(x1-x2+x3+x4-x5) + x1*x4*(--x1+x2+x3-x4+x5)-x2*x3*x4-x1*x3*x5`] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC);; + + + + + + +let main_lemma = prove(`!(f:real->real) x x0 x1 m. (f x >= f x0 \/ f x >= f x1) /\ f x0 >= m /\ f x1 >= m ==> f x >= m`, + REWRITE_TAC[real_ge] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC REAL_LE_TRANS THENL + [ + EXISTS_TAC `(f:real->real) x0` THEN + ASM_REWRITE_TAC[]; + EXISTS_TAC `(f:real->real) x1` THEN + ASM_REWRITE_TAC[] + ]);; + + +(* delta_x > 0 for x IN [4,4 h0^2] *) + +let delta_x_pos = prove(`!x1 x2 x3 x4 x5 x6. ineq [#4.0,x1,#6.3504; + #4.0,x2,#6.3504; + #4.0,x3,#6.3504; + #4.0,x4,#6.3504; + #4.0,x5,#6.3504; + #4.0,x6,#6.3504] (delta_x x1 x2 x3 x4 x5 x6 >= #128.0)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[INEQ_ALT; ALL] THEN + REPEAT STRIP_TAC THEN + ASSUME_TAC (REAL_ARITH `#4.0 <= #4.0 /\ #4.0 <= #6.3504`) THEN + + (* x1 *) + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x x2 x3 x4 x5 x6) x1`)] THEN + MATCH_MP_TAC main_lemma THEN + MAP_EVERY EXISTS_TAC [`#4.0`; `#6.3504`] THEN + ASM_SIMP_TAC[lemma1] THEN + CONJ_TAC THEN + + (* x2 *) + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x x3 x4 x5 x6) x2`)] THEN + MATCH_MP_TAC main_lemma THEN + MAP_EVERY EXISTS_TAC [`#4.0`; `#6.3504`] THEN + ASM_SIMP_TAC[lemma2] THEN + CONJ_TAC THEN + + (* x3 *) + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x2 x x4 x5 x6) x3`)] THEN + MATCH_MP_TAC main_lemma THEN + MAP_EVERY EXISTS_TAC [`#4.0`; `#6.3504`] THEN + ASM_SIMP_TAC[lemma3] THEN + CONJ_TAC THEN + + (* x4 *) + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x2 x3 x x5 x6) x4`)] THEN + MATCH_MP_TAC main_lemma THEN + MAP_EVERY EXISTS_TAC [`#4.0`; `#6.3504`] THEN + ASM_SIMP_TAC[lemma4] THEN + CONJ_TAC THEN + + (* x5 *) + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x2 x3 x4 x x6) x5`)] THEN + MATCH_MP_TAC main_lemma THEN + MAP_EVERY EXISTS_TAC [`#4.0`; `#6.3504`] THEN + ASM_SIMP_TAC[lemma5] THEN + CONJ_TAC THEN + + (* x6 *) + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x2 x3 x4 x5 x) x6`)] THEN + MATCH_MP_TAC main_lemma THEN + MAP_EVERY EXISTS_TAC [`#4.0`; `#6.3504`] THEN + ASM_SIMP_TAC[lemma6] THEN + CONJ_TAC THEN + + (* Final stage *) + REWRITE_TAC[Sphere.delta_x] THEN + CONV_TAC REAL_RAT_REDUCE_CONV);; + + +let lemma3 = prove(`!x1 x2 x3 x4 x5 x6. #4.0 <= x3 /\ x3 <= #6.3504 /\ #0.64 <= x6 ==> delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 x2 #4.0 x4 x5 x6 \/ delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 x2 #6.3504 x4 x5 x6`, + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x2 x x4 x5 x6) x3`)] THEN + MATCH_MP_TAC lemma' THEN + ASM_REWRITE_TAC[Sphere.delta_x; FUN_EQ_THM] THEN + MAP_EVERY EXISTS_TAC [`--x6`; `x6*(x1+x2-x6+x4+x5)+x1*x4+x2*x5-x2*x4-x1*x5`; `x2*x5*(x1-x2+x4-x5+x6) + x1*x4*(--x1+x2-x4+x5+x6)-x1*x2*x6-x4*x5*x6`] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC);; + + + +let lemma6 = prove(`!x1 x2 x3 x4 x5 x6. #0.64 <= x6 /\ x6 <= #6.3504 /\ #4.0 <= x3 ==> delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 x2 x3 x4 x5 #0.64 \/ delta_x x1 x2 x3 x4 x5 x6 >= delta_x x1 x2 x3 x4 x5 #6.3504`, + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x2 x3 x4 x5 x) x6`)] THEN + MATCH_MP_TAC lemma' THEN + ASM_REWRITE_TAC[Sphere.delta_x; FUN_EQ_THM] THEN + MAP_EVERY EXISTS_TAC [`--x3`; `x3*(x1+x2-x3+x4+x5)+x1*x4+x2*x5-x1*x2-x4*x5`; `x2*x5*(x1-x2+x3+x4-x5) + x1*x4*(--x1+x2+x3-x4+x5)-x2*x3*x4-x1*x3*x5`] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC);; + + + +(* delta_x > 0 for a special configuration of three points *) + +let delta_x_3_points = prove(`!x1 x2 x3 x6. ineq [#4.0,x1,#6.3504; + #4.0,x2,#6.3504; + #4.0,x3,#6.3504; + #0.64,x6,#6.3504] (delta_x x1 x2 x3 (#4.0) (#4.0) x6 >= #13.0)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[INEQ_ALT; ALL] THEN + REPEAT STRIP_TAC THEN + ASSUME_TAC (REAL_ARITH `#4.0 <= #4.0 /\ #4.0 <= #6.3504`) THEN + + (* x1 *) + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x x2 x3 x4 x5 x6) x1`)] THEN + MATCH_MP_TAC main_lemma THEN + MAP_EVERY EXISTS_TAC [`#4.0`; `#6.3504`] THEN + ASM_SIMP_TAC[lemma1] THEN + CONJ_TAC THEN + + (* x2 *) + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x x3 x4 x5 x6) x2`)] THEN + MATCH_MP_TAC main_lemma THEN + MAP_EVERY EXISTS_TAC [`#4.0`; `#6.3504`] THEN + ASM_SIMP_TAC[lemma2] THEN + CONJ_TAC THEN + + (* x3 *) + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x2 x x4 x5 x6) x3`)] THEN + MATCH_MP_TAC main_lemma THEN + MAP_EVERY EXISTS_TAC [`#4.0`; `#6.3504`] THEN + ASM_SIMP_TAC[lemma3] THEN + CONJ_TAC THEN + + (* x6 *) + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. delta_x x1 x2 x3 x4 x5 x) x6`)] THEN + MATCH_MP_TAC main_lemma THEN + MAP_EVERY EXISTS_TAC [`#0.64`; `#6.3504`] THEN + ASM_SIMP_TAC[lemma6] THEN + CONJ_TAC THEN + + (* Final stage *) + REWRITE_TAC[Sphere.delta_x] THEN + CONV_TAC REAL_RAT_REDUCE_CONV);; + + + +(************************************************************) + + +(* eta_y pow 2 <= #2.2 *) + + +let lemma1 = prove(`!x1 x2 x3. #4.0 <= x1 /\ x1 <= #6.3504 ==> + #2.2 * ups_x x1 x2 x3 - x1 * x2 * x3 >= #2.2 * ups_x #4.0 x2 x3 - #4.0 * x2 * x3 \/ + #2.2 * ups_x x1 x2 x3 - x1 * x2 * x3 >= #2.2 * ups_x #6.3504 x2 x3 - #6.3504 * x2 * x3`, + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. #2.2 * ups_x x x2 x3 - x * x2 * x3) x1`)] THEN + MATCH_MP_TAC lemma' THEN + ASM_REWRITE_TAC[Sphere.ups_x; FUN_EQ_THM] THEN + MAP_EVERY EXISTS_TAC [`-- #2.2`; `#2.2*(&2 * x3 + &2 * x2) - x2 * x3`; `#2.2 * (&2 * x2 * x3 - x2*x2 - x3*x3)`] THEN + REAL_ARITH_TAC);; + + +let lemma2 = prove(`!x1 x2 x3. #4.0 <= x2 /\ x2 <= #6.3504 ==> + #2.2 * ups_x x1 x2 x3 - x1 * x2 * x3 >= #2.2 * ups_x x1 #4.0 x3 - x1 * #4.0 * x3 \/ + #2.2 * ups_x x1 x2 x3 - x1 * x2 * x3 >= #2.2 * ups_x x1 #6.3504 x3 - x1 * #6.3504 * x3`, + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. #2.2 * ups_x x1 x x3 - x1 * x * x3) x2`)] THEN + MATCH_MP_TAC lemma' THEN + ASM_REWRITE_TAC[Sphere.ups_x; FUN_EQ_THM] THEN + MAP_EVERY EXISTS_TAC [`-- #2.2`; `#2.2*(&2 * x1 + &2 * x3) - x1 * x3`; `#2.2 * (&2 * x1 * x3 - x1*x1 - x3*x3)`] THEN + REAL_ARITH_TAC);; + + +let lemma3 = prove(`!x1 x2 x3. #4.0 <= x3 /\ x3 <= #6.3504 ==> + #2.2 * ups_x x1 x2 x3 - x1 * x2 * x3 >= #2.2 * ups_x x1 x2 #4.0 - x1 * x2 * #4.0 \/ + #2.2 * ups_x x1 x2 x3 - x1 * x2 * x3 >= #2.2 * ups_x x1 x2 #6.3504 - x1 * x2 * #6.3504`, + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. #2.2 * ups_x x1 x2 x - x1 * x2 * x) x3`)] THEN + MATCH_MP_TAC lemma' THEN + ASM_REWRITE_TAC[Sphere.ups_x; FUN_EQ_THM] THEN + MAP_EVERY EXISTS_TAC [`-- #2.2`; `#2.2*(&2 * x1 + &2 * x2) - x2 * x1`; `#2.2 * (&2 * x2 * x1 - x2*x2 - x1*x1)`] THEN + REAL_ARITH_TAC);; + + + +let eta_x_ineq_lemma = prove(`!x1 x2 x3. ineq [#4.0,x1,#6.3504; + #4.0,x2,#6.3504; + #4.0,x3,#6.3504] + (#2.2 * ups_x x1 x2 x3 - x1 * x2 * x3 >= &0)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[INEQ_ALT; ALL] THEN + REPEAT STRIP_TAC THEN + ASSUME_TAC (REAL_ARITH `#4.0 <= #4.0 /\ #4.0 <= #6.3504`) THEN + + (* x1 *) + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. #2.2 * ups_x x x2 x3 - x * x2 * x3) x1`)] THEN + MATCH_MP_TAC main_lemma THEN + MAP_EVERY EXISTS_TAC [`#4.0`; `#6.3504`] THEN + ASM_SIMP_TAC[lemma1] THEN + CONJ_TAC THEN + + (* x2 *) + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. #2.2 * ups_x x1 x x3 - x1 * x * x3) x2`)] THEN + MATCH_MP_TAC main_lemma THEN + MAP_EVERY EXISTS_TAC [`#4.0`; `#6.3504`] THEN + ASM_SIMP_TAC[lemma2] THEN + CONJ_TAC THEN + + (* x3 *) + ONCE_REWRITE_TAC[SYM (BETA_CONV `(\x. #2.2 * ups_x x1 x2 x - x1 * x2 * x) x3`)] THEN + MATCH_MP_TAC main_lemma THEN + MAP_EVERY EXISTS_TAC [`#4.0`; `#6.3504`] THEN + ASM_SIMP_TAC[lemma3] THEN + CONJ_TAC THEN + + (* Final stage *) + REWRITE_TAC[Sphere.ups_x] THEN + CONV_TAC REAL_RAT_REDUCE_CONV);; + + + +let ETA_Y_4_POINTS_INEQ = prove(`!y1 y2 y3. ineq[(&2, y1, &2 * h0); (&2, y2, &2 * h0); (&2, y3, &2 * h0)] + (eta_y y1 y2 y3 pow 2 <= #2.2)`, + REWRITE_TAC[INEQ_ALT; ALL; Sphere.h0; REAL_ARITH `&2 * #1.26 = #2.52`] THEN + REPEAT GEN_TAC THEN DISCH_TAC THEN + REWRITE_TAC[Sphere.eta_y; Sphere.eta_x] THEN + CONV_TAC (DEPTH_CONV let_CONV) THEN + MAP_EVERY ABBREV_TAC [`x1 = y1 * y1:real`; `x2 = y2 * y2:real`; `x3 = y3 * y3:real`] THEN + SUBGOAL_THEN `!y. &2 <= y /\ y <= #2.52 ==> #4.0 <= y * y /\ y * y <= #6.3504` ASSUME_TAC THENL + [ + GEN_TAC THEN + REWRITE_TAC[REAL_ARITH `#4.0 = &2 * &2`; REAL_ARITH `#6.3504 = #2.52 * #2.52`] THEN + REWRITE_TAC[GSYM REAL_POW_2] THEN + REWRITE_TAC[GSYM REAL_LE_SQUARE_ABS] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + MAP_EVERY (fun tm -> FIRST_ASSUM (MP_TAC o SPEC tm)) [`y1:real`; `y2:real`; `y3:real`] THEN + REMOVE_ASSUM THEN ASM_REWRITE_TAC[] THEN + REPEAT DISCH_TAC THEN + MP_TAC (SPEC_ALL eta_x_ineq_lemma) THEN + ASM_REWRITE_TAC[INEQ_ALT; ALL] THEN + DISCH_TAC THEN + + SUBGOAL_THEN `&0 < x1 * x2 * x3` ASSUME_TAC THENL + [ + ASSUME_TAC (REAL_ARITH `!x. #4.0 <= x ==> &0 < x`) THEN + MATCH_MP_TAC REAL_LT_MUL THEN ASM_SIMP_TAC[] THEN + MATCH_MP_TAC REAL_LT_MUL THEN ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `&0 < ups_x x1 x2 x3` ASSUME_TAC THENL + [ + MATCH_MP_TAC (REAL_ARITH `#2.2 * u - x1 * x2 * x3 >= &0 /\ &0 < x1 * x2 * x3 ==> &0 < u`) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `&0 <= (x1 * x2 * x3) / ups_x x1 x2 x3` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LE_DIV THEN + ASM_SIMP_TAC[REAL_LT_IMP_LE]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[SQRT_POW_2] THEN + ONCE_REWRITE_TAC[REAL_ARITH `#2.2 = #2.2 / &1`] THEN + ASSUME_TAC (REAL_ARITH `&0 < &1`) THEN + ASM_SIMP_TAC[RAT_LEMMA4] THEN + REPLICATE_TAC 4 REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC);; + + + + + + + + +(*************************************************************) + + + + + + + +let DELTA_X4_MONO_LT_4 = prove(`!x1 x2 x3 a x5 x6 b. a < b /\ &0 < x1 + ==> delta_x4 x1 x2 x3 b x5 x6 < + delta_x4 x1 x2 x3 a x5 x6`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[Sphere.delta_x4] THEN + REWRITE_TAC[REAL_ARITH `a - b + c + d - e + f < a - g + c + d - e + h <=> f - b < h - g`] THEN + REWRITE_TAC[REAL_ARITH `x1*(--x1+x2+x3-b+x5+x6)-x1*b = --(&2*x1*b) + x1*(--x1+x2+x3+x5+x6)`] THEN + REWRITE_TAC[REAL_ARITH `--a + b < --c + b <=> c < a`] THEN + MATCH_MP_TAC REAL_LT_LMUL THEN + REWRITE_TAC[REAL_ARITH `&0 < &2`] THEN + MATCH_MP_TAC REAL_LT_LMUL THEN + ASM_REWRITE_TAC[]);; + + + +let DELTA_X4_MONO_LE_4 = prove(`!x1 x2 x3 a x5 x6 b. a < b /\ &0 <= x1 + ==> delta_x4 x1 x2 x3 b x5 x6 <= + delta_x4 x1 x2 x3 a x5 x6`, + REPEAT STRIP_TAC THEN + MP_TAC (REAL_ARITH `&0 <= x1 ==> x1 = &0 \/ &0 < x1`) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THENL + [ + ASM_REWRITE_TAC[Sphere.delta_x4] THEN + REAL_ARITH_TAC; + MATCH_MP_TAC REAL_LT_IMP_LE THEN + ASM_SIMP_TAC[DELTA_X4_MONO_LT_4] + ]);; + + + +let REAL_LT_SQUARE_POS = prove(`!x y. &0 < x /\ x < y ==> x pow 2 < y pow 2`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[GSYM REAL_LT_SQUARE_ABS] THEN + SUBGOAL_THEN `abs x = x` ASSUME_TAC THENL + [ + ASM_SIMP_TAC[REAL_ABS_REFL; REAL_LT_IMP_LE]; + ALL_TAC + ] THEN + SUBGOAL_THEN `abs y = y` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[REAL_ABS_REFL] THEN + MATCH_MP_TAC REAL_LT_IMP_LE THEN + MATCH_MP_TAC REAL_LT_TRANS THEN + EXISTS_TAC `x:real` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]);; + + + +let ATN2_ACS_LEMMA = prove(`!a b. b * b < a ==> + pi / &2 + atn2(sqrt(a - b*b), --b) = acs(b/sqrt(a))`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `&0 < a` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `b*b:real` THEN + ASM_REWRITE_TAC[REAL_LE_SQUARE]; + ALL_TAC + ] THEN + + MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + + SUBGOAL_THEN `sqrt a pow 2 = a` ASSUME_TAC THENL + [ + ASM_REWRITE_TAC[SQRT_POW2]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `atn2 (sqrt(a - b*b),--b) = --atn2(sqrt(a-b*b),b)` MP_TAC THENL + [ + MATCH_MP_TAC Trigonometry1.ATN2_RNEG THEN + DISJ2_TAC THEN + MATCH_MP_TAC SQRT_POS_LT THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < a - b <=> b < a`]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th; REAL_ARITH `a + --b = a - b`]) THEN + SUBGOAL_THEN `atn2(sqrt(a - b*b), b) = atn2(sqrt(&1 - (b/sqrt a) pow 2),b/sqrt a)` MP_TAC THENL + [ + MP_TAC (SPECL [`sqrt(&1 - (b/sqrt a) pow 2)`; `sqrt a`; `b/sqrt a`] (GEN_ALL Trigonometry2.POS_COMPATIBLE_WITH_ATN2)) THEN + SUBGOAL_THEN `&0 < sqrt a` ASSUME_TAC THENL + [ + MATCH_MP_TAC SQRT_POS_LT THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ASM_SIMP_TAC[REAL_FIELD `&0 < a ==> a * b / a = b`] THEN + + SUBGOAL_THEN `a - b*b = (sqrt a) pow 2 * (&1 - (b/sqrt a) pow 2)` MP_TAC THENL + [ + ASM_REWRITE_TAC[REAL_POW_DIV] THEN + ASM_SIMP_TAC[REAL_FIELD `&0 < a ==> a * (&1 - b/a) = a - b`] THEN + REWRITE_TAC[REAL_POW_2]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MP_TAC (SPECL [`sqrt a pow 2`; `&1 - (b/sqrt a) pow 2`] SQRT_MUL) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[REAL_POW_DIV] THEN + REWRITE_TAC[REAL_ARITH `&0 <= &1 - b <=> b <= &1`] THEN + MATCH_MP_TAC Trigonometry2.REAL_LE_LDIV THEN + ASM_SIMP_TAC[REAL_POW_2; REAL_ARITH `b < a ==> b <= a`]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MATCH_MP_TAC (GSYM Trigonometry2.acs_atn2) THEN + REWRITE_TAC[REAL_ARITH `-- &1 <= x /\ x <= &1 <=> abs x <= &1`] THEN + ONCE_REWRITE_TAC[REAL_ARITH `&1 = abs(&1)`] THEN + REWRITE_TAC[REAL_LE_SQUARE_ABS] THEN + REWRITE_TAC[REAL_POW_DIV] THEN + ASM_REWRITE_TAC[REAL_POW_2; REAL_ARITH `&1 * &1 = &1`] THEN + MATCH_MP_TAC Trigonometry2.REAL_LE_LDIV THEN + ASM_SIMP_TAC[REAL_ARITH `b < a ==> b <= a`]);; + + + +let DELTA_X_AND_DELTA_X4 = prove(`!x1 x2 x3 x4 x5 x6. + (let d4 = delta_x4 x1 x2 x3 x4 x5 x6 in + let d = delta_x x1 x2 x3 x4 x5 x6 in + let v1 = ups_x x1 x2 x6 in + let v2 = ups_x x1 x3 x5 in + &4 * x1 * d = v1 * v2 - d4 * d4)`, + REPEAT GEN_TAC THEN + REPEAT (CONV_TAC let_CONV) THEN + REWRITE_TAC[Sphere.delta_x4; Sphere.delta_x; Sphere.ups_x] THEN + REAL_ARITH_TAC);; + + +let DELTA_EQ_DELTA_X = prove(`!x1 x2 x3 x4 x5 x6. + delta x1 x2 x3 x6 x5 x4 = delta_x x1 x2 x3 x4 x5 x6`, + REPEAT GEN_TAC THEN + REWRITE_TAC[Sphere.delta_x; Collect_geom.delta] THEN + REAL_ARITH_TAC);; + + + + + +let DIH_X_MONO_LT_4 = prove(`!x1 x2 x3 a x5 x6 b. a < b /\ + &0 < x1 /\ + &0 < delta_x x1 x2 x3 a x5 x6 /\ + &0 < delta_x x1 x2 x3 b x5 x6 + ==> dih_x x1 x2 x3 a x5 x6 < dih_x x1 x2 x3 b x5 x6`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[let_RULE Sphere.dih_x] THEN + ABBREV_TAC `da = delta_x x1 x2 x3 a x5 x6` THEN + ABBREV_TAC `db = delta_x x1 x2 x3 b x5 x6` THEN + SUBGOAL_THEN `&0 < &4 * x1 * da /\ &0 < &4 * x1 * db` MP_TAC THENL + [ + CONJ_TAC THEN + MATCH_MP_TAC REAL_LT_MUL THEN + REWRITE_TAC[REAL_ARITH `&0 < &4`] THEN + MATCH_MP_TAC REAL_LT_MUL THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + EXPAND_TAC "da" THEN EXPAND_TAC "db" THEN + REWRITE_TAC[let_RULE DELTA_X_AND_DELTA_X4] THEN + REWRITE_TAC[REAL_ARITH `&0 < a - b <=> b < a`] THEN + ABBREV_TAC `d4a = delta_x4 x1 x2 x3 a x5 x6` THEN + ABBREV_TAC `d4b = delta_x4 x1 x2 x3 b x5 x6` THEN + ABBREV_TAC `v1 = ups_x x1 x2 x6` THEN + ABBREV_TAC `v2 = ups_x x1 x3 x5` THEN + + STRIP_TAC THEN + FIRST_ASSUM (MP_TAC o (fun th -> MATCH_MP ATN2_ACS_LEMMA th)) THEN + POP_ASSUM MP_TAC THEN + FIRST_ASSUM (MP_TAC o (fun th -> MATCH_MP ATN2_ACS_LEMMA th)) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_TAC THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + + MATCH_MP_TAC ACS_MONO_LT THEN + SUBGOAL_THEN `!a b. b * b < a ==> -- &1 <= b / sqrt(a) /\ b / sqrt a <= &1` ASSUME_TAC THENL + [ + REPEAT GEN_TAC THEN DISCH_TAC THEN + REWRITE_TAC[REAL_ARITH `-- &1 <= x /\ x <= &1 <=> abs x <= &1`] THEN + ONCE_REWRITE_TAC[REAL_ARITH `&1 = abs(&1)`] THEN + REWRITE_TAC[REAL_LE_SQUARE_ABS] THEN + REWRITE_TAC[REAL_POW_DIV] THEN + + SUBGOAL_THEN `&0 < a'` ASSUME_TAC THENL + [ + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `b' * b':real` THEN + ASM_SIMP_TAC[REAL_LE_SQUARE; REAL_ARITH `b < a ==> b <= a`]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `sqrt a' pow 2 = a'` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[SQRT_POW2] THEN + ASM_SIMP_TAC[REAL_ARITH `&0 < a ==> &0 <= a`]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[REAL_POW_2; REAL_ARITH `&1 * &1 = &1`] THEN + MATCH_MP_TAC Trigonometry2.REAL_LE_LDIV THEN + ASM_SIMP_TAC[REAL_ARITH `b < a ==> b <= a`]; + ALL_TAC + ] THEN + + POP_ASSUM (fun th -> ASM_SIMP_TAC[th]) THEN + REWRITE_TAC[real_div] THEN + MATCH_MP_TAC REAL_LT_RMUL THEN + REWRITE_TAC[REAL_LT_INV_EQ] THEN + CONJ_TAC THENL + [ + MP_TAC (SPEC_ALL DELTA_X4_MONO_LT_4) THEN + ASM_REWRITE_TAC[]; + MATCH_MP_TAC SQRT_POS_LT THEN + MATCH_MP_TAC REAL_LET_TRANS THEN + EXISTS_TAC `d4a * d4a:real` THEN + ASM_REWRITE_TAC[REAL_LE_SQUARE] + ]);; + + + + + + +let DIH_Y_INEQ_concl = mk_imp ((hd (Ineq.getexact "2570626711")).ineq, + `ineq [(#2.0,y1,#2.52); + (#2.0,y2,#2.52); + (#2.0,y3,#2.52); + (#2.52,y4,#5.04); + (#2.0,y5,#2.52); + (#2.0,y6,#2.52)] + (dih_y y1 y2 y3 y4 y5 y6 > #1.15 \/ delta_y y1 y2 y3 y4 y5 y6 <= &0)`);; + + +g(DIH_Y_INEQ_concl);; +let DIH_Y_INEQ = prove(DIH_Y_INEQ_concl, + REWRITE_TAC[Pack_defs.h0; REAL_ARITH `&2 * #1.26 = #2.52`] THEN + REWRITE_TAC[INEQ_ALT; ALL] THEN + REPEAT STRIP_TAC THEN + DISJ_CASES_TAC (REAL_ARITH `delta_y y1 y2 y3 y4 y5 y6 <= &0 \/ delta_y y1 y2 y3 y4 y5 y6 > &0`) THENL + [ + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + DISJ1_TAC THEN + REWRITE_TAC[real_gt] THEN + MATCH_MP_TAC REAL_LTE_TRANS THEN + EXISTS_TAC `dih_y y1 y2 y3 #2.52 y5 y6` THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`y1:real`; `y2:real`; `y3:real`; `#2.52`; `y5:real`; `y6:real`]) THEN + ASM_SIMP_TAC[REAL_LE_REFL; real_gt] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + POP_ASSUM MP_TAC THEN + + REWRITE_TAC[let_RULE Sphere.dih_y; Sphere.delta_y] THEN + MAP_EVERY ABBREV_TAC [`x1 = y1 * y1`; `x2 = y2 * y2`; `x3 = y3 * y3`; `x4 = y4 * y4`; `x5 = y5 * y5`; `x6 = y6 * y6`] THEN + REWRITE_TAC[REAL_ARITH `a <= b <=> a < b \/ a = b`] THEN + ASM_CASES_TAC `dih_x x1 x2 x3 (#2.52 * #2.52) x5 x6 = dih_x x1 x2 x3 x4 x5 x6` THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[real_gt] THEN + DISCH_TAC THEN + MATCH_MP_TAC DIH_X_MONO_LT_4 THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + + SUBGOAL_THEN `!y. #2.0 <= y /\ y <= #2.52 ==> #4.0 <= y * y /\ y * y <= #6.3504` ASSUME_TAC THENL + [ + GEN_TAC THEN REWRITE_TAC[REAL_ARITH `#4.0 = #2.0 * #2.0`; REAL_ARITH `#6.3504 = #2.52 * #2.52`] THEN + REWRITE_TAC[GSYM REAL_POW_2] THEN + REWRITE_TAC[GSYM REAL_LE_SQUARE_ABS] THEN + REAL_ARITH_TAC; + ALL_TAC + ] THEN + + SUBGOAL_THEN `#2.52 * #2.52 < x4` (fun th -> REWRITE_TAC[th]) THENL + [ + EXPAND_TAC "x4" THEN + REWRITE_TAC[GSYM REAL_POW_2] THEN + MATCH_MP_TAC REAL_LT_SQUARE_POS THEN + ASM_REWRITE_TAC[REAL_ARITH `&0 < #2.52`; REAL_ARITH `a < b <=> a <= b /\ ~(a = b)`] THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[CONTRAPOS_THM] THEN + EXPAND_TAC "x4" THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]); + ALL_TAC + ] THEN + + MAP_EVERY (fun tm -> FIRST_ASSUM (MP_TAC o SPEC tm)) [`y1:real`; `y2:real`; `y3:real`; `y5:real`; `y6:real`] THEN + REMOVE_ASSUM THEN REMOVE_ASSUM THEN + REPLICATE_TAC 6 (POP_ASSUM (fun th -> REWRITE_TAC[th])) THEN + ASM_REWRITE_TAC[] THEN + REPEAT REMOVE_ASSUM THEN REPEAT DISCH_TAC THEN + ASM_SIMP_TAC[REAL_ARITH `#4.0 <= x1 ==> &0 < x1`] THEN + MATCH_MP_TAC REAL_LTE_TRANS THEN + EXISTS_TAC `#128.0` THEN + REWRITE_TAC[REAL_ARITH `&0 < #128.0`; GSYM real_ge] THEN + + MP_TAC delta_x_pos THEN + REWRITE_TAC[INEQ_ALT; ALL] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC);; + + + + + + + + +end;; diff --git a/text_formalization/tame/JGTDEBU.hl b/text_formalization/tame/JGTDEBU.hl new file mode 100644 index 0000000..8e3c064 --- /dev/null +++ b/text_formalization/tame/JGTDEBU.hl @@ -0,0 +1,256 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Tame Hypermap *) +(* Author: Alexey Solovyev *) +(* Date: 2013-01-22 *) +(* JGTDEBU: general properties of a contravening packing *) +(* ========================================================================== *) + +needs "fan/hypermap_iso-compiled.hl";; +needs "tame/TameGeneral.hl";; + + +module Jgtdebu = struct + +parse_as_infix("iso",(24,"right"));; +open Tame_defs;; +open Fan_defs;; +open Hypermap_iso;; +open Hypermap_and_fan;; +open Tame_general;; + +let contravening_imp_conforming = prove(`!V. contravening V ==> + conforming_fan (vec 0,V,ESTD V)`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC Conforming.PIIJBJK THEN + MP_TAC (SPEC `V:real^3->bool` Tame_general.CONTRAVENING_FAN) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ASM_REWRITE_TAC[Planarity.fan80] THEN + CONJ_TAC THEN REPEAT GEN_TAC THEN REPEAT DISCH_TAC THENL + [ + MATCH_MP_TAC (ARITH_RULE `a >= 3 ==> a > 1`) THEN + MATCH_MP_TAC SURROUNDED_IMP_CARD_SET_OF_EDGE_GE_3 THEN + ASM_SIMP_TAC[CONTRAVENING_IMP_SURROUNDED]; + ALL_TAC + ] THEN + SUBGOAL_THEN `v,u IN dart_of_fan (V,ESTD V)` ASSUME_TAC THENL + [ + REWRITE_TAC[dart_of_fan; IN_UNION; IN_ELIM_THM] THEN DISJ2_TAC THEN + EXISTS_TAC `v:real^3` THEN EXISTS_TAC `u:real^3` THEN ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + ASM_SIMP_TAC[GSYM CONTRAVENING_IMP_AZIM_DART_EQ_AZIM; AZIM_DART_POS] THEN + MP_TAC (SPEC `V:real^3->bool` CONTRAVENING_IMP_FULLY_SURROUNDED) THEN + ASM_SIMP_TAC[fully_surrounded]);; + + +(* 1 *) +let JGTDEBU1 = prove(`!V. contravening V + ==> planar_hypermap (hypermap_of_fan (V, ESTD V))`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC `V:real^3->bool` Tame_general.CONTRAVENING_FAN) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `ESTD V`] fan_hypermaps_iso) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (MP_TAC o MATCH_MP iso_planar) THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + ASM_SIMP_TAC[Conforming.GGRLKHP; contravening_imp_conforming]);; + + +(* 2 *) +let JGTDEBU2 = prove(`!V. contravening V ==> + plain_hypermap (hypermap_of_fan (V,ESTD V))`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC PLAIN_HYPERMAP_OF_FAN THEN + ASM_SIMP_TAC[CONTRAVENING_FAN]);; + + +(* 3 *) +let JGTDEBU3 = prove(`!V. contravening V + ==> connected_hypermap (hypermap_of_fan (V, ESTD V))`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC `V:real^3->bool` Tame_general.CONTRAVENING_FAN) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `ESTD V`] fan_hypermaps_iso) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (MP_TAC o MATCH_MP iso_connected) THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + ASM_SIMP_TAC[Conforming.WGVWSKE; contravening_imp_conforming]);; + + +(* 4 *) +let JGTDEBU4 = prove(`!V. contravening V ==> + simple_hypermap (hypermap_of_fan (V, ESTD V))`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC `V:real^3->bool` Tame_general.CONTRAVENING_FAN) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `ESTD V`] fan_hypermaps_iso) THEN + ASM_REWRITE_TAC[] THEN DISCH_THEN (MP_TAC o MATCH_MP iso_simple) THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + ASM_SIMP_TAC[Conforming.SRPRNPL; contravening_imp_conforming]);; + + +(* 5 *) +let JGTDEBU5 = prove(`!V. contravening V ==> + is_edge_nondegenerate (hypermap_of_fan (V,ESTD V))`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC HYPERMAP_OF_FAN_EDGE_NONDEGENERATE THEN + ASM_SIMP_TAC[CONTRAVENING_FAN; CONTRAVENING_IMP_FULLY_SURROUNDED]);; + + +(* 6 *) +let JGTDEBU6 = prove(`!V. contravening V ==> + no_loops (hypermap_of_fan (V,ESTD V))`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC HYPERMAP_OF_FAN_NO_LOOPS THEN + ASM_SIMP_TAC[CONTRAVENING_FAN]);; + + +(* 7 *) +let JGTDEBU7 = prove(`!V. contravening V ==> + is_no_double_joints (hypermap_of_fan (V,ESTD V))`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC HYPERMAP_OF_FAN_NO_DOUBLE_JOINTS THEN + ASM_SIMP_TAC[CONTRAVENING_FAN]);; + + +(* number_of_faces (hypermap_of_fan (V, ESTD V)) >= 3 *) +let CONTRAVENING_HAS_SIZE_lemma = prove(`!V. contravening V ==> ?n. n > 0 /\ V HAS_SIZE n`, + GEN_TAC THEN DISCH_THEN (LABEL_TAC "A") THEN + MP_TAC (SPEC_ALL CONTRAVENING_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + REMOVE_THEN "A" MP_TAC THEN + REWRITE_TAC[contravening] THEN + REPLICATE_TAC 4 (DISCH_THEN (CONJUNCTS_THEN2 (fun th -> ALL_TAC) MP_TAC)) THEN + DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC (fun th -> ALL_TAC)) THEN + EXISTS_TAC `CARD (V:real^3->bool)` THEN + ASM_SIMP_TAC[ARITH_RULE `a = 13 \/ a = 14 \/ a = 15 ==> a > 0`] THEN + REWRITE_TAC[HAS_SIZE] THEN + REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[Fan_defs.FAN; Fan_defs.fan1] THEN + SIMP_TAC[]);; + + +(* 8 *) +let JGTDEBU8 = prove(`!V. contravening V ==> + number_of_faces (hypermap_of_fan (V,ESTD V)) >= 3`, + GEN_TAC THEN DISCH_THEN (LABEL_TAC "A") THEN + MP_TAC (SPEC `V:real^3->bool` JGTDEBU4) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (SPEC_ALL CONTRAVENING_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + USE_THEN "A" MP_TAC THEN + REWRITE_TAC[contravening] THEN + REPLICATE_TAC 5 (DISCH_THEN (CONJUNCTS_THEN2 (fun th -> ALL_TAC) MP_TAC)) THEN + DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC (fun th -> ALL_TAC)) THEN + REWRITE_TAC[Hypermap.number_of_faces] THEN + SUBGOAL_THEN `?v:real^3. v IN V` MP_TAC THENL + [ + MP_TAC (SPEC `V:real^3->bool` CONTRAVENING_HAS_SIZE_lemma) THEN + ASM_REWRITE_TAC[ARITH_RULE `n > 0 <=> ~(n = 0)`] THEN + STRIP_TAC THEN + MP_TAC (SPEC `n:num` num_CASES) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o check (is_binary "HAS_SIZE" o concl)) THEN + ASM_REWRITE_TAC[HAS_SIZE_CLAUSES] THEN + STRIP_TAC THEN + EXISTS_TAC `a:real^3` THEN + POP_ASSUM MP_TAC THEN + SIMP_TAC[INSERT; EXTENSION; IN_ELIM_THM]; + ALL_TAC + ] THEN + STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `ESTD (V:real^3->bool)`; `v:real^3`] DART_EXISTS) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + ABBREV_TAC `H = hypermap_of_fan (V,ESTD V)` THEN + SUBGOAL_THEN `v,w IN dart1_of_fan (V:real^3->bool,ESTD V)` ASSUME_TAC THENL + [ + MATCH_MP_TAC SURROUNDED_IMP_IN_DART1_OF_FAN THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + ABBREV_TAC `A = {face H y | y | y IN dart H /\ T /\ y IN node H (v:real^3,w:real^3)}` THEN + SUBGOAL_THEN `A SUBSET face_set (H:(real^3#real^3)hypermap)` ASSUME_TAC THENL + [ + EXPAND_TAC "A" THEN + REWRITE_TAC[SUBSET; IN_ELIM_THM] THEN + GEN_TAC THEN STRIP_TAC THEN + ASM_REWRITE_TAC[GSYM Hypermap.lemma_in_face_set] THEN + EXPAND_TAC "H" THEN + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN]; + ALL_TAC + ] THEN + ONCE_REWRITE_TAC[GE] THEN + MATCH_MP_TAC LE_TRANS THEN + EXISTS_TAC `CARD (A:(real^3#real^3->bool)->bool)` THEN + CONJ_TAC THENL + [ + EXPAND_TAC "A" THEN + MP_TAC (ISPECL [`H:(real^3#real^3)hypermap`; `v:real^3,w:real^3`; `(\x:real^3#real^3. T)`] SIMPLE_HYPERMAP_lemma) THEN + REMOVE_ASSUM THEN REMOVE_ASSUM THEN + ASM_REWRITE_TAC[ETA_AX] THEN + EXPAND_TAC "H" THEN + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN] THEN + SIMP_TAC[SIMPLE_HYPERMAP_lemma] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + SUBGOAL_THEN `{y:real^3#real^3 | y IN node H (v,w)} = node H (v,w)` MP_TAC THENL + [ + REWRITE_TAC[EXTENSION; IN_ELIM_THM]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[GSYM GE] THEN + EXPAND_TAC "H" THEN + MATCH_MP_TAC SURROUNDED_IMP_CARD_NODE_GE_3 THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + + + MATCH_MP_TAC CARD_SUBSET THEN + ASM_REWRITE_TAC[Hypermap.FINITE_HYPERMAP_ORBITS] + );; + + +(* 10 *) +(* tame_10 (hypermap_of_fan (V, ESTD V)) *) +let JGTDEBU10 = prove(`!V. contravening V ==> tame_10 (hypermap_of_fan (V,ESTD V))`, + GEN_TAC THEN DISCH_THEN (LABEL_TAC "A") THEN + MP_TAC (SPEC_ALL CONTRAVENING_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + REMOVE_THEN "A" MP_TAC THEN + REWRITE_TAC[contravening; tame_10; Hypermap.number_of_nodes] THEN + REPLICATE_TAC 4 (DISCH_THEN (CONJUNCTS_THEN2 (fun th -> ALL_TAC) MP_TAC)) THEN + DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC (fun th -> ALL_TAC)) THEN + MP_TAC (SPECL [`V:real^3->bool`; `ESTD V`] NODE_SET_AS_IMAGE) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `CARD(IMAGE (f:real^3 -> ((real^3#real^3) -> bool)) V) = CARD V` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC CARD_IMAGE_INJ THEN + FIRST_X_ASSUM (MP_TAC o check (fun th -> rand (concl th) = `(vec 0:real^3,V:real^3->bool,ESTD V)`)) THEN + REWRITE_TAC[Fan_defs.FAN; Fan_defs.fan1] THEN + ASM_SIMP_TAC[] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + REPEAT STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPECL [`x:real^3`; `y:real^3`]) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY]);; + + +(* 11 *) +(* tame_11a (hypermap_of_fan (V, ESTD V)) *) +let JGTDEBU11 = prove(`!V. contravening V ==> tame_11a (hypermap_of_fan (V,ESTD V))`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL CONTRAVENING_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + REWRITE_TAC[tame_11a] THEN + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN] THEN + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `ESTD (V:real^3->bool)`; `x:real^3#real^3`] IN_DART_OF_FAN) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `ESTD (V:real^3->bool)`; `v:real^3`; `w:real^3`] SURROUNDED_IMP_IN_DART1_OF_FAN) THEN + MP_TAC (SPEC_ALL CONTRAVENING_IMP_SURROUNDED) THEN + ASM_SIMP_TAC[] THEN REPEAT DISCH_TAC THEN + MATCH_MP_TAC SURROUNDED_IMP_CARD_NODE_GE_3 THEN + ASM_REWRITE_TAC[]);; + + +end;; diff --git a/text_formalization/tame/TameGeneral.hl b/text_formalization/tame/TameGeneral.hl new file mode 100644 index 0000000..2125e77 --- /dev/null +++ b/text_formalization/tame/TameGeneral.hl @@ -0,0 +1,1117 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Tame Hypermap *) +(* Author: Alexey Solovyev *) +(* Date: 2010-06-17 *) +(* ========================================================================== *) + +(* General properties of a contravening packing *) + + +flyspeck_needs "leg/collect_geom.hl";; +flyspeck_needs "trigonometry/trigonometry.hl";; +flyspeck_needs "nonlinear/ineq.hl";; + +flyspeck_needs "fan/HypermapAndFan.hl";; +flyspeck_needs "tame/CKQOWSA.hl";; +flyspeck_needs "tame/tame_defs.hl";; + + +module Tame_general = struct + +open Fan_defs;; +open Hypermap_and_fan;; +open Tame_defs;; + + + +(* Non-linear inequalities *) +(* let tame_hypermap_calcs_concl = new_definition Tame_defs.tame_hypermap_calcs;; *) + + +(* tame ==> restricted *) +let RUNOQPQ = prove(`!(H:(A)hypermap). tame_hypermap H ==> restricted_hypermap H`, + GEN_TAC THEN REWRITE_TAC[tame_hypermap; restricted_hypermap] THEN + SIMP_TAC[tame_1; tame_2; tame_3; tame_5a; tame_9a] THEN + REPEAT STRIP_TAC THENL + [ + FIRST_X_ASSUM (MP_TAC o check (fun th -> (concl th) = `tame_8 (H:(A)hypermap)`)) THEN + REWRITE_TAC[tame_8; Hypermap.number_of_faces; Hypermap.face_set; Hypermap.set_of_orbits] THEN + SUBGOAL_THEN `{orbit_map (face_map (H:(A)hypermap)) x | x | x IN dart H} = {}` (fun th -> REWRITE_TAC[th]) THENL + [ + ASM_REWRITE_TAC[EXTENSION; NOT_IN_EMPTY] THEN + X_GEN_TAC `ff:A->bool` THEN + REWRITE_TAC[IN_ELIM_THM]; + ALL_TAC + ] THEN + REWRITE_TAC[CARD_CLAUSES; ARITH_RULE `~(0 >= 3)`]; + + MP_TAC (SPEC `H:(A)hypermap` Hypermap.lemmaZHQCZLX) THEN + ASM_SIMP_TAC[is_node_nondegenerate; GSYM GE]; + + POP_ASSUM MP_TAC THEN + REWRITE_TAC[Hypermap.face_set; Hypermap.set_of_orbits] THEN + ONCE_REWRITE_TAC[GSYM Hypermap.face] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + STRIP_TAC THEN + ASM_SIMP_TAC[] + ]);; + + +(* UBHDEUU1 = CKQOWSA *) +let UBHDEUU1 = Ckqowsa.CKQOWSA;; + + +(* (V,ECTC V) is a fan *) +let UBHDEUU2 = prove(`!V. packing V /\ V SUBSET ball_annulus /\ ~(V = {}) ==> FAN(vec 0, V, ECTC V)`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC Topology.CTVTAQA THEN + EXISTS_TAC `ESTD V` THEN + ASM_SIMP_TAC[UBHDEUU1] THEN + REWRITE_TAC[ECTC; ESTD; SUBSET; IN_ELIM_THM] THEN + REPEAT STRIP_TAC THEN + MAP_EVERY EXISTS_TAC [`v:real^3`; `w:real^3`] THEN + ASM_SIMP_TAC[Sphere.h0; REAL_ARITH `a = &2 ==> a <= &2 * #1.26`]);; + + + +(*********************) +(* Numerical results *) +(*********************) + +let COS_PI3 = prove(`cos (pi / &3) = &1 / &2`, + REWRITE_TAC[COS_SIN] THEN + REWRITE_TAC[REAL_ARITH `pi / &2 - pi / &3 = pi / &6`] THEN + REWRITE_TAC[SIN_PI6]);; + + +let ACS_2 = prove(`acs (&1 / &2) = pi / &3`, + REWRITE_TAC[SYM COS_PI3] THEN + MATCH_MP_TAC ACS_COS THEN + REWRITE_TAC[REAL_ARITH `(&0 <= a / &3 <=> &0 <= a) /\ (a / &3 <= a <=> &0 <= a)`] THEN + MATCH_MP_TAC REAL_LT_IMP_LE THEN + REWRITE_TAC[PI_POS]);; + + +let sol0_POS = prove(`&0 < sol0`, + REWRITE_TAC[Pack_defs.sol0] THEN + REWRITE_TAC[REAL_ARITH `&0 < &3 * a - pi <=> pi / &3 < a`] THEN + REWRITE_TAC[SYM ACS_2] THEN + MATCH_MP_TAC ACS_MONO_LT THEN + REAL_ARITH_TAC);; + + +(****************************************) + + + +(*******************************************************************************************) +(* Connections between algebraic definitions in Sphere and geometric definitions elsewhere *) +(*******************************************************************************************) + +(* ly = lmfun *) +let ly_EQ_lmfun = prove(`!x:real^3#real^3. norm (FST x) <= &2 * h0 ==> lmfun (h_dart x) = ly (norm (FST x))`, + REWRITE_TAC[Pack_defs.lmfun; Sphere.ly; Sphere.interp; h_dart; Pack_defs.h0] THEN + REAL_ARITH_TAC);; + + + +(* sol0 = const1 * pi *) +let sol0_EQ_sol_y = prove(`sol0 = sol_y (&2) (&2) (&2) (&2) (&2) (&2)`, + REWRITE_TAC[Pack_defs.sol0; Sphere.sol_y; Sphere.dih_y; Sphere.dih_x; Sphere.delta_x4; Sphere.delta_x] THEN + CONV_TAC (DEPTH_CONV let_CONV) THEN + CONV_TAC (REAL_RAT_REDUCE_CONV) THEN + MP_TAC (SPEC `&1 / &3` Trigonometry2.acs_atn2) THEN + CONV_TAC (REAL_RAT_REDUCE_CONV) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC [REAL_ARITH `&3 * (a - b) - c = (a + d) + (a + d) + (a + d) - c <=> --b = d`] THEN + MP_TAC (SPECL [`sqrt (&8 / &9)`; `&1 / &3`] Trigonometry1.ATN2_RNEG) THEN + CONV_TAC (REAL_RAT_REDUCE_CONV) THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + SUBGOAL_THEN `sqrt (&2048) = &48 * sqrt (&8 / &9) /\ -- &16 = &48 * (-- &1 / &3)` ASSUME_TAC THENL + [ + MP_TAC (SPECL [`&48`; `&8 / &9`] Vol1.SQRT_MUL_POW_2) THEN + CONV_TAC (REAL_RAT_REDUCE_CONV); + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC (GSYM Trigonometry1.ATN2_LMUL_EQ) THEN + REAL_ARITH_TAC);; + + +(* sol0 = const1 *) +let sol0_over_pi_EQ_const1 = prove(`sol0 / pi = const1`, + REWRITE_TAC[sol0_EQ_sol_y; Sphere.const1]);; + + + +(* Alternative form for ineq *) +let INEQ_ALT = prove(`!A bounds. ineq bounds A <=> (ALL (\(a,x,b). a <= x /\ x <= b) bounds ==> A)`, + GEN_TAC THEN + MATCH_MP_TAC list_INDUCT THEN REPEAT STRIP_TAC THENL + [ + REWRITE_TAC[Sphere.ineq; ALL]; + ALL_TAC + ] THEN + MP_TAC (ISPEC `a0:real#real#real` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `a:real` MP_TAC) THEN + DISCH_THEN (CHOOSE_THEN MP_TAC) THEN + MP_TAC (ISPEC `y:real#real` PAIR_SURJECTIVE) THEN + DISCH_THEN (X_CHOOSE_THEN `x:real` MP_TAC) THEN + DISCH_THEN (X_CHOOSE_THEN `b:real` MP_TAC) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + ASM_SIMP_TAC[Sphere.ineq; ALL; IMP_IMP]);; + + +(* delta = delta_x *) +let DELTA_EQ_DELTA_X = prove(`!x1 x2 x3 x4 x5 x6. + delta x1 x2 x3 x6 x5 x4 = delta_x x1 x2 x3 x4 x5 x6`, + REPEAT GEN_TAC THEN + REWRITE_TAC[Sphere.delta_x; Collect_geom.delta] THEN + REAL_ARITH_TAC);; + + +(* Connection between delta_x and delta_x4 *) +let DELTA_X_AND_DELTA_X4 = prove(`!x1 x2 x3 x4 x5 x6. + (let d4 = delta_x4 x1 x2 x3 x4 x5 x6 in + let d = delta_x x1 x2 x3 x4 x5 x6 in + let v1 = ups_x x1 x2 x6 in + let v2 = ups_x x1 x3 x5 in + &4 * x1 * d = v1 * v2 - d4 * d4)`, + REPEAT GEN_TAC THEN + REPEAT (CONV_TAC let_CONV) THEN + REWRITE_TAC[Sphere.delta_x4; Sphere.delta_x; Sphere.ups_x] THEN + REAL_ARITH_TAC);; + + + + +(* dihV = dih_y *) +let DIHV_EQ_DIH_Y = prove(`!v0:real^3 v1 v2 v3. ~collinear {v0, v1, v2} /\ ~collinear {v0, v1, v3} + ==> (let v01 = dist (v0, v1) in + let v02 = dist (v0, v2) in + let v03 = dist (v0, v3) in + let v12 = dist (v1, v2) in + let v13 = dist (v1, v3) in + let v23 = dist (v2, v3) in + dihV v0 v1 v2 v3 = dih_y v01 v02 v03 v23 v13 v12)`, + REPEAT GEN_TAC THEN + DISCH_TAC THEN + FIRST_ASSUM (MP_TAC o (fun th -> CONJUNCT2 (MATCH_MP (let_RULE Trigonometry.OJEKOJF) th))) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REPEAT (CONV_TAC let_CONV) THEN + MAP_EVERY ABBREV_TAC [`v01 = dist(v0:real^3,v1)`; `v02 = dist(v0:real^3,v2)`; + `v03 = dist(v0:real^3,v3)`; `v12 = dist(v1:real^3,v2)`; + `v13 = dist(v1:real^3,v3)`; `v23 = dist(v2:real^3,v3)`; + `d = delta_x (v01 pow 2) (v02 pow 2) (v03 pow 2) (v23 pow 2) (v13 pow 2) (v12 pow 2)`; + `d4 = delta_x4 (v01 pow 2) (v02 pow 2) (v03 pow 2) (v23 pow 2) (v13 pow 2) (v12 pow 2)`] THEN + REWRITE_TAC[let_RULE Sphere.dih_y; let_RULE Sphere.dih_x; GSYM REAL_POW_2] THEN + ASM_REWRITE_TAC[REAL_ARITH `a - b = a + c <=> c = --b`] THEN + + MATCH_MP_TAC Trigonometry1.ATN2_RNEG THEN + DISJ_CASES_TAC (TAUT `~(d4 = &0) \/ d4 = &0`) THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC SQRT_POS_LT THEN + + MP_TAC (let_RULE (SPECL [`v01 pow 2`; `v02 pow 2`; `v03 pow 2`; `v23 pow 2`; `v13 pow 2`; `v12 pow 2`] DELTA_X_AND_DELTA_X4)) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th; REAL_ARITH `a - &0 * &0 = a`]) THEN + + MP_TAC (let_RULE Trigonometry2.NOT_COLLINEAR_IMP_UPS_LT) THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (INST [`v3:real^3`,`v2:real^3`] (let_RULE Trigonometry2.NOT_COLLINEAR_IMP_UPS_LT)) THEN + ASM_REWRITE_TAC[] THEN + REPEAT DISCH_TAC THEN + MATCH_MP_TAC REAL_LT_MUL THEN + ASM_REWRITE_TAC[]);; + + + + + +(************************************************************************************) + + + (* Properties of a contravening packing *) + + (* LEMMA: aux *) + let DIFF_LEMMA = prove(`!A B. A SUBSET B ==> (A = B DIFF (B DIFF A))`, + REWRITE_TAC[SUBSET; EXTENSION; IN_DIFF; DE_MORGAN_THM] THEN + REWRITE_TAC[TAUT `P /\ (~P \/ Q) <=> P /\ Q`] THEN + REPEAT STRIP_TAC THEN EQ_TAC THEN ASM_SIMP_TAC[]);; + + + +(* (V,ESTD V) is a fan for a contravening packing V *) +let CONTRAVENING_FAN = prove(`!V. contravening V ==> FAN (vec 0,V,ESTD V)`, + REWRITE_TAC[contravening] THEN + GEN_TAC THEN REWRITE_TAC[GSYM IMP_IMP] THEN + REPLICATE_TAC 5 DISCH_TAC THEN + REPEAT (DISCH_THEN (fun th -> ALL_TAC)) THEN + MATCH_MP_TAC Ckqowsa.CKQOWSA THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM (LABEL_TAC "A") THEN DISCH_TAC THEN REMOVE_THEN "A" MP_TAC THEN + ASM_REWRITE_TAC[CARD_CLAUSES] THEN + ARITH_TAC);; + + + + +(* LEMMA: aux *) +let CONTRAVENING_IMP_SURROUNDED = prove(`!V v. contravening V /\ v IN V ==> surrounded_node (V,ESTD V) v`, + ASM_SIMP_TAC[contravening]);; + + +let CONTRAVENING_IMP_FULLY_SURROUNDED = prove(`!V. FAN (vec 0,V,ESTD V) /\ contravening V + ==> fully_surrounded (V,ESTD V)`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[FULLY_SURROUNDED] THEN + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[CONTRAVENING_IMP_SURROUNDED]);; + + + +(* LEMMA: general *) +let CONTRAVENING_IMP_IN_DART1_OF_FAN = prove(`!V x. contravening V /\ x IN dart_of_fan (V,ESTD V) + ==> x IN dart1_of_fan (V,ESTD V)`, + REPEAT GEN_TAC THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + ASSUME_TAC (SPEC `V:real^3->bool` CONTRAVENING_FAN) THEN + MATCH_MP_TAC SURROUNDED_IMP_IN_DART1_OF_FAN THEN + ASM_SIMP_TAC[] THEN + MATCH_MP_TAC CONTRAVENING_IMP_SURROUNDED THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL [`V:real^3->bool`; `ESTD V`; `x':real^3`; `y:real^3`] PAIR_IN_DART_OF_FAN) THEN + ASM_SIMP_TAC[]);; + + +(* LEMMA: general *) +let CONTRAVENING_IMP_DART_FST_NEQ_SND = prove(`!V x. contravening V /\ x IN dart_of_fan (V,ESTD V) + ==> ~(FST x = SND x)`, + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + MP_TAC (SPEC_ALL CONTRAVENING_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (SPEC_ALL CONTRAVENING_IMP_IN_DART1_OF_FAN) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `ESTD V`; `x:real^3#real^3`] IN_DART1_OF_FAN) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `ESTD V`] THEN + ASM_REWRITE_TAC[]);; + + + + +(* LEMMA: general *) +let CONTRAVENING_DIST = prove(`!V v. contravening V /\ v IN V + ==> #2.0 <= dist(vec 0, v) /\ dist(vec 0,v) <= #2.52 + /\ (!w. w IN V /\ ~(v = w) ==> #2.0 <= dist(v, w))`, + REPEAT GEN_TAC THEN + REWRITE_TAC[contravening] THEN + DISCH_THEN (CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN + DISCH_THEN (CONJUNCTS_THEN2 MP_TAC (MP_TAC o CONJUNCT1)) THEN + REWRITE_TAC[Pack_defs.ball_annulus; Pack_defs.h0; REAL_ARITH `&2 * #1.26 = #2.52`] THEN + REWRITE_TAC[SUBSET; IN_DIFF; cball; ball; IN_ELIM_THM; REAL_NOT_LT] THEN + DISCH_THEN (MP_TAC o SPEC `v:real^3`) THEN + ASM_SIMP_TAC[REAL_ARITH `&2 = #2.0`] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + REWRITE_TAC[Sphere.packing; REAL_ARITH `#2.0 = &2`] THEN + ASM SET_TAC[]);; + + +(* LEMMA: aux *) +let IN_ESTD = prove(`!V v w. {v,w} IN ESTD V <=> v IN V /\ w IN V /\ ~(v = w) /\ dist(v,w) <= #2.52`, + REPEAT GEN_TAC THEN + REWRITE_TAC[ESTD; Pack_defs.h0; REAL_ARITH `&2 * #1.26 = #2.52`] THEN + EQ_TAC THENL + [ + REWRITE_TAC[IN_ELIM_THM] THEN + STRIP_TAC THEN + SUBGOAL_THEN `(v:real^3 = v' /\ w:real^3 = w') \/ (v = w' /\ w = v')` MP_TAC THENL + [ + POP_ASSUM MP_TAC THEN SET_TAC[]; + ALL_TAC + ] THEN + ASM_MESON_TAC[DIST_SYM]; + SET_TAC[] + ]);; + + +(* LEMMA: general *) +let CONTRAVENING_ESTD_DIST = prove(`!V v w. contravening V /\ v IN V /\ w IN V /\ {v,w} IN ESTD V + ==> #2.0 <= dist(v,w) /\ dist(v,w) <= #2.52`, + REPEAT GEN_TAC THEN + REWRITE_TAC[contravening; IN_ESTD; Sphere.packing] THEN + DISCH_THEN (CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN + DISCH_THEN (MP_TAC o CONJUNCT1) THEN + ASM_REWRITE_TAC[REAL_ARITH `#2.0 = &2`] THEN + ASM SET_TAC[]);; + + + +(* LEMMA: general *) +let CONTRAVENING_DART_DIST = prove(`!V x. contravening V /\ x IN dart_of_fan (V,ESTD V) + ==> #2.0 <= dist x /\ dist x <= #2.52`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + MP_TAC (SPEC_ALL CONTRAVENING_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `ESTD V`; `x:real^3#real^3`] IN_DART_OF_FAN) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC CONTRAVENING_ESTD_DIST THEN + EXISTS_TAC `V:real^3->bool` THEN + ASM_REWRITE_TAC[] THEN + MP_TAC (SPECL [`V:real^3->bool`; `ESTD V`; `v:real^3`; `w:real^3`] SURROUNDED_IMP_IN_DART1_OF_FAN) THEN + MP_TAC (SPEC_ALL CONTRAVENING_IMP_SURROUNDED) THEN + ASM_REWRITE_TAC[] THEN + DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + REWRITE_TAC[dart1_of_fan; IN_ELIM_THM; PAIR_EQ] THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[]);; + + + + +(* LEMMA: general *) +let CONTRAVENING_LMFUN_BOUND = prove(`!V v. contravening V /\ v IN V + ==> lmfun (norm v / &2) <= &1`, + REPEAT GEN_TAC THEN + DISCH_THEN (MP_TAC o (fun th -> MATCH_MP CONTRAVENING_DIST th)) THEN + REWRITE_TAC[DIST_SYM] THEN + REWRITE_TAC[dist; VECTOR_SUB_RZERO; Pack_defs.lmfun; Pack_defs.h0] THEN + REAL_ARITH_TAC);; + + + + + +(* LEMMA: aux *) +let CONTRAVENING_IMP_AZIM_DART_EQ_AZIM = prove(`!V v w. contravening V /\ (v,w) IN dart_of_fan (V,ESTD V) + ==> azim_dart (V,ESTD V) (v,w) = azim (vec 0) v w (sigma_fan (vec 0) V (ESTD V) v w)`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL CONTRAVENING_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `v:real^3,w:real^3`] CONTRAVENING_IMP_DART_FST_NEQ_SND) THEN + MP_TAC (SPECL [`V:real^3->bool`; `ESTD V`; `v:real^3`] SURROUNDED_IMP_CARD_SET_OF_EDGE_GE_3) THEN + MP_TAC (SPECL [`V:real^3->bool`; `v:real^3`] CONTRAVENING_IMP_SURROUNDED) THEN + MP_TAC (SPECL [`V:real^3->bool`; `ESTD V`; `v:real^3`; `w:real^3`] PAIR_IN_DART_OF_FAN) THEN + ASM_SIMP_TAC[] THEN REPEAT STRIP_TAC THEN + ASM_SIMP_TAC[azim_dart; azim_fan; ARITH_RULE `a >= 3 ==> a > 1`]);; + + + + +(* 0, v, w, and sigma(v)(w) are not coplanar *) +let CONTRAVENING_IMP_NOT_COPLANAR = prove(`!V v w. contravening V /\ (v,w) IN dart_of_fan (V,ESTD V) + ==> ~coplanar {vec 0, v, w, sigma_fan (vec 0) V (ESTD V) v w}`, + REPEAT GEN_TAC THEN DISCH_TAC THEN + MP_TAC (SPEC_ALL CONTRAVENING_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `v:real^3,w:real^3`] CONTRAVENING_IMP_IN_DART1_OF_FAN) THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (SPECL [`vec 0:real^3`; `v:real^3`; `w:real^3`; `sigma_fan (vec 0) V (ESTD V) v w`] AZIM_EQ_0_PI_EQ_COPLANAR) THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC DART1_NOT_COLLINEAR_2 THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + REWRITE_TAC[DE_MORGAN_THM] THEN + ASM_SIMP_TAC[GSYM CONTRAVENING_IMP_AZIM_DART_EQ_AZIM] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`) THEN + MATCH_MP_TAC AZIM_DART_POS THEN + ASM_REWRITE_TAC[]; + MATCH_MP_TAC (REAL_ARITH `a < pi ==> ~(a = pi)`) THEN + MP_TAC (SPEC_ALL CONTRAVENING_IMP_FULLY_SURROUNDED) THEN + ASM_REWRITE_TAC[fully_surrounded] THEN + DISCH_THEN (MP_TAC o SPEC `v:real^3,w:real^3`) THEN + ASM_SIMP_TAC[] + ]);; + + + + + +(* azim_dart = dih_y *) +let CONTRAVENING_AZIM_DART_EQ_DIH_Y = prove(`!V v w. contravening V /\ (v,w) IN dart_of_fan (V,ESTD V) + ==> let w' = sigma_fan (vec 0) V (ESTD V) v w in + let y1 = norm v in + let y2 = norm w in + let y3 = norm w' in + let y4 = dist (w,w') in + let y5 = dist (v,w') in + let y6 = dist (v,w) in + azim_dart (V,ESTD V) (v,w) = dih_y y1 y2 y3 y4 y5 y6`, + REPEAT STRIP_TAC THEN REPEAT (CONV_TAC let_CONV) THEN + MP_TAC (SPEC_ALL CONTRAVENING_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ABBREV_TAC `w' = sigma_fan (vec 0) V (ESTD V) v w` THEN + MP_TAC (SPEC_ALL CONTRAVENING_IMP_AZIM_DART_EQ_AZIM) THEN + MP_TAC (SPEC_ALL CONTRAVENING_IMP_NOT_COPLANAR) THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + + SUBGOAL_THEN `~collinear {vec 0, v, w:real^3} /\ ~collinear {vec 0, v, w'}` ASSUME_TAC THENL + [ + CONJ_TAC THEN MATCH_MP_TAC NOT_COPLANAR_NOT_COLLINEAR THENL + [ + EXISTS_TAC `w':real^3` THEN ASM_REWRITE_TAC[]; + EXISTS_TAC `w:real^3` THEN ASM_REWRITE_TAC[SET_RULE `{a:real^3,b,c,d} = {a,b,d,c}`] + ]; + ALL_TAC + ] THEN + + MP_TAC ((let_RULE o SPECL [`vec 0:real^3`; `v:real^3`; `w:real^3`; `w':real^3`]) DIHV_EQ_DIH_Y) THEN + ASM_REWRITE_TAC[DIST_0] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + MATCH_MP_TAC AZIM_DIHV_SAME THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + MP_TAC (SPEC_ALL CONTRAVENING_IMP_FULLY_SURROUNDED) THEN + ASM_REWRITE_TAC[fully_surrounded] THEN + DISCH_THEN (MP_TAC o SPEC `v:real^3,w:real^3`) THEN + ASM_SIMP_TAC[]);; + + + + +(* Lower bound for CARD(face) in a contravening packing *) +let CONTRAVENING_IMP_CARD_FACE_GE_3 = prove(`!V. contravening V + ==> (!x. x IN dart_of_fan (V,ESTD V) ==> CARD (face (hypermap_of_fan (V,ESTD V)) x) >= 3)`, + MESON_TAC[CONTRAVENING_FAN; FULLY_SURROUNDED_IMP_CARD_FACE_GE_3; CONTRAVENING_IMP_FULLY_SURROUNDED]);; + + + +(* Alternative form for type_of_node H x *) +let NODE_TYPE_lemma = prove(`!H (x:A). simple_hypermap H /\ x IN dart H + ==> type_of_node H x = CARD {y | y IN node H x /\ CARD (face H y) = 3}, + CARD {y | y IN node H x /\ CARD (face H y) = 4}, + CARD {y | y IN node H x /\ CARD (face H y) >= 5}`, + REPEAT GEN_TAC THEN + DISCH_THEN (MP_TAC o (fun th -> MATCH_MP SIMPLE_HYPERMAP_lemma th)) THEN + REWRITE_TAC[type_of_node] THEN + REWRITE_TAC[set_of_triangles_meeting_node; set_of_quadrilaterals_meeting_node; set_of_exceptional_meeting_node] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]));; + + +(* CARD (node) = p + q + r *) +let FULLY_SURROUNDED_IMP_CARD_NODE_EQ_SUM_NODE_TYPE = + prove(`!V E x. FAN (vec 0,V,E) /\ simple_hypermap (hypermap_of_fan (V,E)) /\ + fully_surrounded (V,E) /\ x IN dart_of_fan (V,E) + ==> (let p,q,r = type_of_node (hypermap_of_fan (V,E)) x in + CARD (node (hypermap_of_fan (V,E)) x) = p + q + r)`, + REPEAT STRIP_TAC THEN + MP_TAC (ISPECL [`hypermap_of_fan (V:real^3->bool,E)`; `x:real^3#real^3`] NODE_TYPE_lemma) THEN + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN] THEN + DISCH_THEN (fun th -> ALL_TAC) THEN + CONV_TAC let_CONV THEN + ABBREV_TAC `H = hypermap_of_fan (V:real^3->bool,E)` THEN + ABBREV_TAC `A = {y:real^3#real^3 | y IN node H x /\ CARD (face H y) = 3}` THEN + ABBREV_TAC `B = {y:real^3#real^3 | y IN node H x /\ CARD (face H y) = 4}` THEN + ABBREV_TAC `C = {y:real^3#real^3 | y IN node H x /\ CARD (face H y) >= 5}` THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `x:real^3#real^3`] FULLY_SURROUNDED_NODE_DECOMPOSITION) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (MP_TAC o let_RULE) THEN + ABBREV_TAC `D = {y:real^3#real^3 | y IN node H x /\ CARD (face H y) >= 4}` THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + + SUBGOAL_THEN `CARD (B:real^3#real^3->bool) + CARD (C:real^3#real^3->bool) = CARD (D:real^3#real^3->bool)` MP_TAC THENL + [ + MATCH_MP_TAC CARD_UNION_EQ THEN + ASM_SIMP_TAC[GSYM DISJOINT]; + ALL_TAC + ] THEN + + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MATCH_MP_TAC EQ_SYM THEN + MATCH_MP_TAC CARD_UNION_EQ THEN + ASM_SIMP_TAC[Hypermap.NODE_FINITE; GSYM DISJOINT]);; + + + +(******************************************************************************) + + +(* tauVEF = taum for a triangular face *) +let tauVEF_EQ_taum = prove(`!V f. contravening V /\ + f IN face_set_of_fan (V,ESTD V) /\ + CARD (f) = 3 + ==> (!v w. (v,w) IN f ==> + let w' = sigma_fan (vec 0) V (ESTD V) v w in + let y1 = norm v in + let y2 = norm w in + let y3 = norm w' in + let y4 = dist(w,w') in + let y5 = dist(v,w') in + let y6 = dist(v,w) in + tauVEF (V,ESTD V,f) = taum y1 y2 y3 y4 y5 y6)`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL CONTRAVENING_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + UNDISCH_TAC `f IN face_set_of_fan (V,ESTD V)` THEN + REWRITE_TAC[face_set_of_fan; Hypermap.face_set; Hypermap.set_of_orbits; GSYM Hypermap.face; IN_ELIM_THM] THEN + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN] THEN + STRIP_TAC THEN + SUBGOAL_THEN `face (hypermap_of_fan (V,ESTD V)) (v,w) = f` MP_TAC THENL + [ + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC (GSYM Hypermap.lemma_face_identity) THEN + POP_ASSUM (fun th -> ASM_REWRITE_TAC[SYM th]); + ALL_TAC + ] THEN + SUBGOAL_THEN `(v,w) IN dart1_of_fan (V,ESTD V)` MP_TAC THENL + [ + MATCH_MP_TAC Hypermap.lemma_in_subset THEN + EXISTS_TAC `f:real^3#real^3->bool` THEN + ASM_REWRITE_TAC[] THEN + MATCH_MP_TAC FACE_SUBSET_DART1_OF_FAN THEN + ASM_SIMP_TAC[CONTRAVENING_IMP_IN_DART1_OF_FAN]; + ALL_TAC + ] THEN + REMOVE_ASSUM THEN REMOVE_ASSUM THEN + REPEAT DISCH_TAC THEN + REPEAT (CONV_TAC let_CONV) THEN + ABBREV_TAC `w' = sigma_fan (vec 0) V (ESTD V) v w` THEN + REWRITE_TAC[tauVEF] THEN + MP_TAC (let_RULE (SPECL [`V:real^3->bool`; `ESTD V`; `v:real^3`; `w:real^3`] TRIANGULAR_FACE)) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + SUBGOAL_THEN `(w,w') IN dart1_of_fan (V,ESTD V) /\ w',v IN dart1_of_fan (V,ESTD V)` ASSUME_TAC THENL + [ + CONJ_TAC THEN MATCH_MP_TAC IN_FACE_IMP_IN_DART1_OF_FAN THEN EXISTS_TAC `v:real^3,w:real^3` THEN ASM_REWRITE_TAC[IN_INSERT]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + ASM_SIMP_TAC[Hypermap.FINITE_TWO_ELEMENTS; Hypermap.FINITE_SINGLETON; SUM_CLAUSES; SUM_SING] THEN + SUBGOAL_THEN `~(v,w IN {(w,w'), (w':real^3,v:real^3)})` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[IN_INSERT; PAIR_EQ; NOT_IN_EMPTY; DE_MORGAN_THM] THEN + MP_TAC (ISPECL [`V:real^3->bool`; `ESTD V`; `v:real^3`; `w:real^3`] PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + SUBGOAL_THEN `~(w,w' IN {(w':real^3,v:real^3)})` (fun th -> REWRITE_TAC[th]) THENL + [ + REWRITE_TAC[IN_SING; PAIR_EQ] THEN + MP_TAC (ISPECL [`V:real^3->bool`; `ESTD V`; `w:real^3`; `w':real^3`] PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[sol0_over_pi_EQ_const1] THEN + ABBREV_TAC `a1 = azim_dart (V,ESTD V) (v,w)` THEN + ABBREV_TAC `a2 = azim_dart (V,ESTD V) (w,w')` THEN + ABBREV_TAC `a3 = azim_dart (V,ESTD V) (w',v)` THEN + ABBREV_TAC `l1 = lmfun (h_dart (v:real^3,w:real^3))` THEN + ABBREV_TAC `l2 = lmfun (h_dart (w:real^3,w':real^3))` THEN + ABBREV_TAC `l3 = lmfun (h_dart (w':real^3,v:real^3))` THEN + SUBGOAL_THEN `(pi + sol0) = pi * (&1 + const1)` (fun th -> REWRITE_TAC[th]) THENL + [ + MP_TAC sol0_over_pi_EQ_const1 THEN + MP_TAC PI_POS THEN + CONV_TAC REAL_FIELD; + ALL_TAC + ] THEN + + REWRITE_TAC[Sphere.taum; Sphere.sol_y; Sphere.lnazim] THEN + SUBGOAL_THEN `v,w IN dart_of_fan (V,ESTD V) /\ w,w' IN dart_of_fan (V,ESTD V) /\ w',v IN dart_of_fan (V,ESTD V)` ASSUME_TAC THENL + [ + REPEAT CONJ_TAC THEN MATCH_MP_TAC Hypermap.lemma_in_subset THEN EXISTS_TAC `dart1_of_fan (V,ESTD V)` THEN ASM_REWRITE_TAC[DART1_OF_FAN_SUBSET_DART_OF_FAN]; + ALL_TAC + ] THEN + + MP_TAC (let_RULE (SPECL [`V:real^3->bool`; `v:real^3`; `w:real^3`] CONTRAVENING_AZIM_DART_EQ_DIH_Y)) THEN + MP_TAC (let_RULE (SPECL [`V:real^3->bool`; `w:real^3`; `w':real^3`] CONTRAVENING_AZIM_DART_EQ_DIH_Y)) THEN + MP_TAC (let_RULE (SPECL [`V:real^3->bool`; `w':real^3`; `v:real^3`] CONTRAVENING_AZIM_DART_EQ_DIH_Y)) THEN + ASM_REWRITE_TAC[DIST_SYM] THEN + REPEAT (DISCH_THEN (fun th -> REWRITE_TAC[SYM th])) THEN + + MP_TAC (SPEC `v:real^3,w:real^3` ly_EQ_lmfun) THEN + MP_TAC (SPEC `w:real^3,w':real^3` ly_EQ_lmfun) THEN + MP_TAC (SPEC `w':real^3,v:real^3` ly_EQ_lmfun) THEN + + MP_TAC (SPECL [`V:real^3->bool`; `v:real^3`] CONTRAVENING_DIST) THEN + MP_TAC (SPECL [`V:real^3->bool`; `w:real^3`] CONTRAVENING_DIST) THEN + MP_TAC (SPECL [`V:real^3->bool`; `w':real^3`] CONTRAVENING_DIST) THEN + + ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `w' IN V /\ w IN V /\ v IN (V:real^3->bool)` (fun th -> REWRITE_TAC[th]) THENL + [ + MP_TAC (SPECL [`V:real^3->bool`; `ESTD V`; `v:real^3`; `w:real^3`] PAIR_IN_DART_OF_FAN) THEN + MP_TAC (SPECL [`V:real^3->bool`; `ESTD V`; `w:real^3`; `w':real^3`] PAIR_IN_DART_OF_FAN) THEN + MP_TAC (SPECL [`V:real^3->bool`; `ESTD V`; `w':real^3`; `v:real^3`] PAIR_IN_DART_OF_FAN) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + SIMP_TAC[DIST_0; Pack_defs.h0; REAL_ARITH `&2 * #1.26 = #2.52`] THEN + REPEAT (DISCH_THEN (fun th -> ALL_TAC)) THEN + REAL_ARITH_TAC);; + + +let CONTRAVENING_TAUVEF_EQ_TAUM = prove(`!V v w. contravening V /\ + (v,w) IN dart_of_fan (V,ESTD V) /\ + CARD (face (hypermap_of_fan (V,ESTD V)) (v,w)) = 3 + ==> let w' = sigma_fan (vec 0) V (ESTD V) v w in + let y1 = norm v in + let y2 = norm w in + let y3 = norm w' in + let y4 = dist(w,w') in + let y5 = dist(v,w') in + let y6 = dist(v,w) in + tauVEF (V,ESTD V,face (hypermap_of_fan (V,ESTD V)) (v,w)) = taum y1 y2 y3 y4 y5 y6`, + REPEAT STRIP_TAC THEN + MP_TAC (SPEC_ALL CONTRAVENING_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (SPECL [`V:real^3->bool`; `face (hypermap_of_fan (V,ESTD V)) (v,w)`] tauVEF_EQ_taum) THEN + ANTS_TAC THENL + [ + ASM_REWRITE_TAC[face_set_of_fan; Hypermap.face_set; Hypermap.set_of_orbits; GSYM Hypermap.face] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + EXISTS_TAC `v:real^3,w:real^3` THEN + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN]; + ALL_TAC + ] THEN + DISCH_THEN MATCH_MP_TAC THEN + REWRITE_TAC[Hypermap.face_refl]);; + + +(* Bounds for distances in a triangular face *) + +let CONTRAVENING_TRIANGULAR_FACE_DIST = prove(`!V v w. contravening V /\ (v,w) IN dart_of_fan (V,ESTD V) /\ + CARD (face (hypermap_of_fan (V,ESTD V)) (v,w)) = 3 + ==> let w' = sigma_fan (vec 0) V (ESTD V) v w in + let y1 = norm v in + let y2 = norm w in + let y3 = norm w' in + let y4 = dist(w,w') in + let y5 = dist(v,w') in + let y6 = dist(v,w) in + (&2 <= y1 /\ y1 <= #2.52) /\ + (&2 <= y2 /\ y2 <= #2.52) /\ + (&2 <= y3 /\ y3 <= #2.52) /\ + (&2 <= y4 /\ y4 <= #2.52) /\ + (&2 <= y5 /\ y5 <= #2.52) /\ + (&2 <= y6 /\ y6 <= #2.52)`, + REPEAT STRIP_TAC THEN CONV_TAC (DEPTH_CONV let_CONV) THEN + MP_TAC (SPEC_ALL CONTRAVENING_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + ABBREV_TAC `w' = sigma_fan (vec 0) V (ESTD V) v w` THEN + MP_TAC (SPECL [`V:real^3->bool`; `ESTD V`; `v:real^3`; `w:real^3`] TRIANGULAR_FACE) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL + [ + MATCH_MP_TAC CONTRAVENING_IMP_IN_DART1_OF_FAN THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + CONV_TAC (DEPTH_CONV let_CONV) THEN + DISCH_THEN (CONJUNCTS_THEN2 ASSUME_TAC (fun th -> ALL_TAC)) THEN + SUBGOAL_THEN `w,w' IN dart_of_fan (V,ESTD V) /\ w',v IN dart_of_fan (V,ESTD V)` ASSUME_TAC THENL + [ + CONJ_TAC THEN MATCH_MP_TAC Hypermap.lemma_in_subset THEN + EXISTS_TAC `face (hypermap_of_fan (V,ESTD V)) (v,w)` THEN + ASM_SIMP_TAC[FACE_SUBSET_DART_OF_FAN; IN_INSERT]; + ALL_TAC + ] THEN + SUBGOAL_THEN `v IN V /\ w IN V /\ w' IN (V:real^3->bool)` ASSUME_TAC THENL + [ + MP_TAC (SPECL [`V:real^3->bool`; `ESTD V`; `v:real^3`; `w:real^3`] PAIR_IN_DART_OF_FAN) THEN + MP_TAC (SPECL [`V:real^3->bool`; `ESTD V`; `w:real^3`; `w':real^3`] PAIR_IN_DART_OF_FAN) THEN + ASM_SIMP_TAC[]; + ALL_TAC + ] THEN + REWRITE_TAC[REAL_ARITH `&2 = #2.0`] THEN + MP_TAC (SPECL [`V:real^3->bool`; `v:real^3`] CONTRAVENING_DIST) THEN + MP_TAC (SPECL [`V:real^3->bool`; `w:real^3`] CONTRAVENING_DIST) THEN + MP_TAC (SPECL [`V:real^3->bool`; `w':real^3`] CONTRAVENING_DIST) THEN + ASM_REWRITE_TAC[DIST_0] THEN + REPEAT (DISCH_THEN (fun th -> REWRITE_TAC[th])) THEN + MAP_EVERY (fun tm -> MP_TAC (SPECL [`V:real^3->bool`; tm] CONTRAVENING_DART_DIST)) [`v:real^3,w:real^3`; `w:real^3,w':real^3`; `w':real^3,v:real^3`] THEN + ASM_SIMP_TAC[DIST_SYM]);; + + +(* Bounds for azim_dart in a triangular face *) + +let azim_dart_bounds_3_list = map (fun id -> (hd (Ineq.getexact id)).ineq) ["5735387903"; "5490182221"];; + +let azim_dart_bounds_3 = list_mk_conj azim_dart_bounds_3_list;; + +let TRIANGULAR_FACE_AZIM_DART_BOUNDS_concl = mk_imp (azim_dart_bounds_3, + `!V x. contravening V /\ + x IN dart_of_fan (V,ESTD V) /\ + CARD (face (hypermap_of_fan (V,ESTD V)) x) = 3 + ==> #0.852 < azim_dart (V,ESTD V) x /\ azim_dart (V,ESTD V) x < #1.893`);; + +(* g(TRIANGULAR_FACE_AZIM_DART_BOUNDS_concl);; *) +let TRIANGULAR_FACE_AZIM_DART_BOUNDS = prove(TRIANGULAR_FACE_AZIM_DART_BOUNDS_concl, + REWRITE_TAC[Ineq.dart_std3; INEQ_ALT; ALL; Pack_defs.h0; REAL_ARITH `&2 * #1.26 = #2.52`] THEN + STRIP_TAC THEN + + REPEAT GEN_TAC THEN STRIP_TAC THEN + POP_ASSUM MP_TAC THEN + MP_TAC (SPEC_ALL CONTRAVENING_FAN) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + + MP_TAC (SPECL [`V:real^3->bool`; `ESTD V`; `x:real^3#real^3`] IN_DART_OF_FAN) THEN + ASM_REWRITE_TAC[] THEN STRIP_TAC THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + MP_TAC (SPEC_ALL CONTRAVENING_AZIM_DART_EQ_DIH_Y) THEN + ASM_REWRITE_TAC[] THEN CONV_TAC (DEPTH_CONV let_CONV) THEN + ABBREV_TAC `w' = sigma_fan (vec 0) V (ESTD V) v w` THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + + MP_TAC (SPEC_ALL CONTRAVENING_TRIANGULAR_FACE_DIST) THEN + ASM_REWRITE_TAC[] THEN + CONV_TAC (DEPTH_CONV let_CONV) THEN + REWRITE_TAC[REAL_ARITH `&2 = #2.0`] THEN + DISCH_TAC THEN + + CONJ_TAC THENL + [ + REWRITE_TAC[GSYM real_gt] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[]; + FIRST_X_ASSUM MATCH_MP_TAC THEN + ASM_REWRITE_TAC[] + ]);; + + + +(******************************************************************************) + +(* Properties of rho_node (might be useful) *) +(* +let RHO_NODE_lemma = prove(`!V E f x. FAN (vec 0,V,E) /\ simple_hypermap (hypermap_of_fan (V,E)) /\ + f IN face_set (hypermap_of_fan (V,E)) /\ x IN f + ==> ?!w. (FST x,w) IN f`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[EXISTS_UNIQUE] THEN + EXISTS_TAC `SND (x:real^3#real^3)` THEN + ASM_REWRITE_TAC[PAIR] THEN + REPEAT STRIP_TAC THEN + MP_TAC (INST [`FST (x:real^3#real^3),y:real^3`, `y:real^3#real^3`] (SPEC_ALL HYPERMAP_OF_FAN_FACE_NODE_INJ)) THEN + ASM_REWRITE_TAC[] THEN + ONCE_REWRITE_TAC[GSYM PAIR] THEN + REWRITE_TAC[PAIR_EQ; EQ_SYM_EQ]);; + + + + +let RHO_NODE_LEMMA = prove(`!V E f x. FAN (vec 0,V,E) /\ simple_hypermap (hypermap_of_fan (V,E)) /\ + f IN face_set (hypermap_of_fan (V,E)) /\ x IN f + ==> rho_node (V,E,f) (FST x) = SND x`, + REPEAT GEN_TAC THEN + DISCH_TAC THEN + MP_TAC (SPEC_ALL RHO_NODE_lemma) THEN ASM_REWRITE_TAC[EXISTS_UNIQUE] THEN + STRIP_TAC THEN + SUBGOAL_THEN `w = SND (x:real^3#real^3)` ASSUME_TAC THENL + [ + MATCH_MP_TAC EQ_SYM THEN + POP_ASSUM (fun th -> MATCH_MP_TAC th) THEN + ASM_REWRITE_TAC[PAIR]; + ALL_TAC + ] THEN + REWRITE_TAC[rho_node] THEN + MATCH_MP_TAC SELECT_UNIQUE THEN + GEN_TAC THEN BETA_TAC THEN + EQ_TAC THENL + [ + DISCH_TAC THEN + FIRST_X_ASSUM (MP_TAC o SPEC `y:real^3`) THEN + ASM_REWRITE_TAC[]; + DISCH_THEN (fun th -> ASM_REWRITE_TAC[th]) + ]);; + + + + +let RHO_NODE_EQ_FACE_MAP = prove(`!V E x f. FAN (vec 0,V,E) /\ simple_hypermap (hypermap_of_fan (V,E)) /\ + x IN dart1_of_fan (V,E) /\ f = face (hypermap_of_fan (V,E)) x + ==> f_fan_pair_ext (V,E) x = (rho_node (V,E,f) (FST x), (rho_node (V,E,f) POWER 2) (FST x))`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[Hypermap.POWER_2; o_THM] THEN + ABBREV_TAC `w = rho_node (V:real^3->bool,E:(real^3->bool)->bool,f:real^3#real^3->bool) (FST (x:real^3#real^3))` THEN + MATCH_MP_TAC HYPERMAP_OF_FAN_FACE_NODE_INJ THEN + MAP_EVERY EXISTS_TAC [`V:real^3->bool`; `E:(real^3->bool)->bool`; `f:real^3#real^3->bool`] THEN + ASM_REWRITE_TAC[] THEN + + SUBGOAL_THEN `f IN face_set (hypermap_of_fan (V,E))` MP_TAC THENL + [ + ASM_REWRITE_TAC[Hypermap.face_set; Hypermap.set_of_orbits; GSYM Hypermap.face] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + EXISTS_TAC `x:real^3#real^3` THEN + REWRITE_TAC[] THEN + MATCH_MP_TAC Hypermap.lemma_in_subset THEN + EXISTS_TAC `dart1_of_fan (V:real^3->bool,E)` THEN + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN] THEN + REWRITE_TAC[DART1_OF_FAN_SUBSET_DART_OF_FAN]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + + SUBGOAL_THEN `f_fan_pair_ext (V,E) x IN f` MP_TAC THENL + [ + ASM_REWRITE_TAC[Hypermap.face; Hypermap.face_map] THEN + ASM_SIMP_TAC[HYPERMAP_OF_FAN; Hypermap.in_orbit_map1]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + + CONJ_TAC THENL + [ + REWRITE_TAC[rho_node] THEN + MATCH_MP_TAC (BETA_RULE (ISPECL [`(\w':real^3. (w:real^3,w') IN face (hypermap_of_fan (V,E)) x)`] SELECT_AX)) THEN + POP_ASSUM MP_TAC THEN + MP_TAC (SPEC_ALL RHO_NODE_LEMMA) THEN + ASM_REWRITE_TAC[Hypermap.face_refl] THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[f_fan_pair_ext; f_fan_pair] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_TAC THEN + EXISTS_TAC `inverse_sigma_fan (vec 0) V E y x'` THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + MP_TAC (SPEC_ALL RHO_NODE_LEMMA) THEN + ASM_REWRITE_TAC[Hypermap.face_refl] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + MP_TAC (ISPEC `x:real^3#real^3` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN ASM_REWRITE_TAC[f_fan_pair_ext; f_fan_pair]);; + + + +let RHO_NODE_POWER_EQ_FACE_MAP_POWER = prove(`!V E x f. FAN (vec 0,V,E) /\ simple_hypermap (hypermap_of_fan (V,E)) /\ + x IN dart1_of_fan (V,E) /\ f = face (hypermap_of_fan (V,E)) x + ==> !i. (f_fan_pair_ext (V,E) POWER i) x = + ((\x. rho_node (V,E,f) (FST x), (rho_node (V,E,f) POWER 2) (FST x)) POWER i) x`, + REPEAT STRIP_TAC THEN + ABBREV_TAC `g = (\x:real^3#real^3. rho_node (V:real^3->bool,E:(real^3->bool)->bool,f:real^3#real^3->bool) (FST x), (rho_node (V,E,f) POWER 2) (FST x))` THEN + SUBGOAL_THEN `f IN face_set (hypermap_of_fan (V,E))` MP_TAC THENL + [ + ASM_REWRITE_TAC[Hypermap.face_set; Hypermap.set_of_orbits; GSYM Hypermap.face] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + EXISTS_TAC `x:real^3#real^3` THEN + REWRITE_TAC[] THEN + MATCH_MP_TAC Hypermap.lemma_in_subset THEN + EXISTS_TAC `dart1_of_fan (V:real^3->bool,E)` THEN + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN] THEN + REWRITE_TAC[DART1_OF_FAN_SUBSET_DART_OF_FAN]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[] THEN + + SPEC_TAC (`i:num`,`i:num`) THEN + INDUCT_TAC THENL + [ + REWRITE_TAC[Hypermap.POWER]; + ALL_TAC + ] THEN + + REWRITE_TAC[ARITH_RULE `SUC i = 1 + i`; Hypermap.addition_exponents; Hypermap.POWER_1; o_THM] THEN + ABBREV_TAC `y = (f_fan_pair_ext (V,E) POWER i) x` THEN + MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `y:real^3#real^3`; `f:real^3#real^3->bool`] RHO_NODE_EQ_FACE_MAP) THEN + FIRST_X_ASSUM (MP_TAC o check (fun th -> rand (rator (concl th)) = `y:real^3#real^3`)) THEN + ASM_REWRITE_TAC[] THEN + + SUBGOAL_THEN `y IN face (hypermap_of_fan (V,E)) x` ASSUME_TAC THENL + [ + POP_ASSUM (fun th -> REWRITE_TAC[SYM th]) THEN + ASM_SIMP_TAC[Hypermap.face; Hypermap.face_map; HYPERMAP_OF_FAN] THEN + REWRITE_TAC[Hypermap.orbit_map; IN_ELIM_THM] THEN + EXISTS_TAC `i:num` THEN + REWRITE_TAC[GE; LE_0]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `face (hypermap_of_fan (V,E)) x = face (hypermap_of_fan (V,E)) y` ASSUME_TAC THENL + [ + MATCH_MP_TAC Hypermap.lemma_face_identity THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `y IN dart1_of_fan (V:real^3->bool,E)` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC Hypermap.lemma_in_subset THEN + EXISTS_TAC `face (hypermap_of_fan (V,E)) x` THEN + ASM_SIMP_TAC[FACE_SUBSET_DART1_OF_FAN]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[SYM th]) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + EXPAND_TAC "g" THEN BETA_TAC THEN + ASM_REWRITE_TAC[]);; + + + + + +let ORBIT_MAP_FUN_EQ_lemma = prove(`!(f:A->A) g x. (!y. y IN orbit_map f x ==> g y = f y) + ==> orbit_map g x = orbit_map f x`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC Hypermap.lemma_orbit_eq THEN + INDUCT_TAC THEN REWRITE_TAC[Hypermap.POWER] THEN + REWRITE_TAC[GSYM Hypermap.POWER] THEN + ASM_REWRITE_TAC[Hypermap.COM_POWER; o_THM] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + REWRITE_TAC[Hypermap.lemma_in_orbit]);; + + + + +let RHO_NODE_face = prove(`!V E x f. FAN (vec 0,V,E) /\ simple_hypermap (hypermap_of_fan (V,E)) /\ + x IN dart1_of_fan (V,E) /\ f = face (hypermap_of_fan (V,E)) x + ==> f = orbit_map (\x. rho_node (V,E,f) (FST x), (rho_node (V,E,f) POWER 2) (FST x)) x`, + REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN + SUBGOAL_THEN `orbit_map (f_fan_pair_ext (V,E)) x = face (hypermap_of_fan (V,E)) x` ASSUME_TAC THENL + [ + ASM_SIMP_TAC[Hypermap.face; Hypermap.face_map; HYPERMAP_OF_FAN]; + ALL_TAC + ] THEN + FIRST_ASSUM (fun th -> GEN_REWRITE_TAC LAND_CONV [SYM th]) THEN + MATCH_MP_TAC EQ_SYM THEN + MATCH_MP_TAC ORBIT_MAP_FUN_EQ_lemma THEN + ASM_REWRITE_TAC[] THEN + REPEAT STRIP_TAC THEN + MATCH_MP_TAC EQ_SYM THEN BETA_TAC THEN + MATCH_MP_TAC RHO_NODE_EQ_FACE_MAP THEN + ASM_REWRITE_TAC[] THEN + CONJ_TAC THENL + [ + MATCH_MP_TAC Hypermap.lemma_in_subset THEN + EXISTS_TAC `face (hypermap_of_fan (V,E)) x` THEN + ASM_SIMP_TAC[FACE_SUBSET_DART1_OF_FAN]; + ALL_TAC + ] THEN + MATCH_MP_TAC Hypermap.lemma_face_identity THEN + ASM_REWRITE_TAC[]);; + + + +let RHO_NODE_POWER = prove(`!V E f x. FAN (vec 0,V,E) /\ simple_hypermap (hypermap_of_fan (V,E)) /\ + x IN dart1_of_fan (V,E) /\ f = face (hypermap_of_fan (V,E)) x + ==> !i. ((\x. rho_node (V,E,f) (FST x),(rho_node (V,E,f) POWER 2) (FST x)) POWER i) x + = (\x. (rho_node (V,E,f) POWER i) (FST x), (rho_node (V,E,f) POWER (i + 1)) (FST x)) x`, + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `f IN face_set (hypermap_of_fan (V,E))` MP_TAC THENL + [ + ASM_REWRITE_TAC[Hypermap.face_set; Hypermap.set_of_orbits; GSYM Hypermap.face] THEN + REWRITE_TAC[IN_ELIM_THM] THEN + EXISTS_TAC `x:real^3#real^3` THEN + ASM_SIMP_TAC[Hypermap.dart; HYPERMAP_OF_FAN] THEN + MATCH_MP_TAC Hypermap.lemma_in_subset THEN + EXISTS_TAC `dart1_of_fan (V:real^3->bool,E)` THEN + ASM_REWRITE_TAC[DART1_OF_FAN_SUBSET_DART_OF_FAN]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN DISCH_TAC THEN + + SPEC_TAC (`i:num`, `i:num`) THEN + INDUCT_TAC THEN BETA_TAC THENL + [ + REWRITE_TAC[Hypermap.POWER; ARITH_RULE `0 + 1 = 1`; Hypermap.POWER_1; I_THM] THEN + MP_TAC (SPEC_ALL RHO_NODE_LEMMA) THEN + ASM_REWRITE_TAC[Hypermap.face_refl] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[Hypermap.COM_POWER; o_THM; PAIR_EQ] THEN + REWRITE_TAC[ARITH_RULE `SUC i + 1 = 2 + i`] THEN + REWRITE_TAC[Hypermap.addition_exponents; o_THM]);; + +*) + +(* Alternative definition of the perimeter of a face *) +(* +let PERIMETER_lemma = prove(`!V E x f. FAN (vec 0,V,E) /\ simple_hypermap (hypermap_of_fan (V,E)) /\ + x IN dart1_of_fan (V,E) /\ f = face (hypermap_of_fan (V,E)) x + ==> per (V,E,f) (FST x) (CARD f) = sum f (\(v,w). arcV (vec 0) v w)`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[per] THEN + ABBREV_TAC `g = (\x:real^3#real^3. rho_node (V:real^3->bool,E:(real^3->bool)->bool,f:real^3#real^3->bool) (FST x), (rho_node (V,E,f) POWER 2) (FST x))` THEN + ABBREV_TAC `orbit = orbit_map (f_fan_pair_ext (V,E)) x` THEN + + SUBGOAL_THEN `0 < CARD (orbit:real^3#real^3->bool)` ASSUME_TAC THENL + [ + SUBGOAL_THEN `FINITE (orbit:real^3#real^3->bool)` ASSUME_TAC THENL + [ + EXPAND_TAC "orbit" THEN + MATCH_MP_TAC Hypermap.lemma_orbit_finite THEN + EXISTS_TAC `dart_of_fan (V,E)` THEN + ASM_SIMP_TAC[ISPEC `vec 0:real^3` FINITE_DART_OF_FAN; F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN]; + ALL_TAC + ] THEN + DISJ_CASES_TAC (ARITH_RULE `0 < CARD (orbit:real^3#real^3->bool) \/ CARD orbit = 0`) THEN ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN + POP_ASSUM (MP_TAC o (MATCH_MP CARD_EQ_0)) THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_TAC THEN + MP_TAC (ISPECL [`f_fan_pair_ext (V,E)`; `x:real^3#real^3`] Hypermap.orbit_reflect) THEN + ASM_REWRITE_TAC[NOT_IN_EMPTY]; + ALL_TAC + ] THEN + + SUBGOAL_THEN `!i. arcV (vec 0:real^3) ((rho_node (V:real^3->bool,E:(real^3->bool)->bool,f:real^3#real^3->bool) POWER i) (FST (x:real^3#real^3))) ((rho_node (V,E,f) POWER (i + 1)) (FST x)) = ((\(v,w). arcV (vec 0) v w) o (\i. (g POWER i) x)) i` MP_TAC THENL + [ + REWRITE_TAC[LAMBDA_PAIR; o_THM] THEN BETA_TAC THEN + MP_TAC (SPEC_ALL RHO_NODE_POWER) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]); + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + + SUBGOAL_THEN `f:real^3#real^3->bool = IMAGE (\i. (g:real^3#real^3->real^3#real^3 POWER i) x) (0..CARD f - 1)` MP_TAC THENL + [ + ASM_REWRITE_TAC[GSYM IMAGE_LEMMA; IN_NUMSEG; LE_0] THEN + ASM_SIMP_TAC[Hypermap.face; Hypermap.face_map; HYPERMAP_OF_FAN] THEN + MP_TAC (ISPECL [`dart_of_fan (V:real^3->bool,E)`; `f_fan_pair_ext (V,E)`; `x:real^3#real^3`; `CARD (orbit_map (f_fan_pair_ext (V,E)) x)`] FINITE_ORBIT_MAP) THEN + ASM_SIMP_TAC[SPEC `vec 0:real^3` FINITE_DART_OF_FAN; F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN] THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC LAND_CONV [th]) THEN + MP_TAC (SPEC_ALL RHO_NODE_POWER_EQ_FACE_MAP_POWER) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + POP_ASSUM MP_TAC THEN + SIMP_TAC[ARITH_RULE `0 < c ==> !i. i < c <=> i <= c - 1`]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> GEN_REWRITE_TAC (RAND_CONV o ONCE_DEPTH_CONV) [th]) THEN + REWRITE_TAC[ETA_AX] THEN + + MATCH_MP_TAC (GSYM SUM_IMAGE) THEN + + X_GEN_TAC `n:num` THEN X_GEN_TAC `m:num` THEN + REWRITE_TAC[IN_NUMSEG; LE_0] THEN + ASM_SIMP_TAC[Hypermap.face; Hypermap.face_map; HYPERMAP_OF_FAN] THEN + MP_TAC (SPEC_ALL RHO_NODE_POWER_EQ_FACE_MAP_POWER) THEN + ASM_REWRITE_TAC[] THEN + DISCH_THEN (fun th -> REWRITE_TAC[GSYM th]) THEN + + STRIP_TAC THEN + SUBGOAL_THEN `inj_orbit (f_fan_pair_ext (V,E)) x (CARD (f:real^3#real^3->bool) - 1)` MP_TAC THENL + [ + MP_TAC (ISPECL [`dart_of_fan (V:real^3->bool,E)`; `f_fan_pair_ext (V,E)`; `x:real^3#real^3`] Hypermap.lemma_segment_orbit) THEN + ASM_SIMP_TAC[ISPEC `vec 0:real^3` FINITE_DART_OF_FAN; F_FAN_PAIR_EXT_PERMUTES_DART_OF_FAN] THEN + DISCH_THEN (MP_TAC o SPEC `CARD (f:real^3#real^3->bool) - 1`) THEN + ASM_SIMP_TAC[Hypermap.face; Hypermap.face_map; HYPERMAP_OF_FAN] THEN + ANTS_TAC THENL + [ + REPLICATE_TAC 3 REMOVE_ASSUM THEN POP_ASSUM MP_TAC THEN + ARITH_TAC; + SIMP_TAC[] + ]; + ALL_TAC + ] THEN + + REWRITE_TAC[Hypermap.lemma_inj_orbit] THEN + DISCH_THEN MATCH_MP_TAC THEN + ASM_SIMP_TAC[Hypermap.face; Hypermap.face_map; HYPERMAP_OF_FAN]);; +*) + + +end;; diff --git a/text_formalization/tame/dont_repeat_yourself.hl b/text_formalization/tame/dont_repeat_yourself.hl new file mode 100644 index 0000000..b5a4850 --- /dev/null +++ b/text_formalization/tame/dont_repeat_yourself.hl @@ -0,0 +1,84 @@ +(* ========================================================================== *) +(* FLYSPECK - TEXT FORMALIZATION *) +(* *) +(* Chapter: Nonlinear *) +(* Author: Thomas C. Hales *) +(* Date: 2012-04-15 *) +(* ========================================================================== *) + + +flyspeck_needs "../graph_generator/graph_control.hl";; + +(* Let's check that repeated values are compatible *) + +module Dont_repeat_yourself = struct + +open Hales_tactic;; + +(* +glpk/minorlp/tame_table.mod repeats inequalities from ineq.hl, as does +glpk/minorlp/OXLZLEZ.mod + +These have been checked by hand, but it isn't automated. + +TODO: automate comparison of graph_control with Bauer Nipkow values. +*) + +(* Table A, B, D *) + + +let table_a = Tame_defs.a_tame;; +let table_b = Tame_defs.b_tame;; +let table_d = Tame_defs.d_tame;; +let squander = Tame_defs.tgt;; + +let table_a_bn = Tame_classification.bn_excessTCount;; +let table_b_bn = Tame_classification.bn_squanderVertex;; +let table_d_bn = Tame_classification.bn_squanderFace;; +let squander_bn = Tame_classification.bn_squanderTarget;; + +let table_a_gg = Graph_control.flyspeck_properties.Graph_control.table_weight_a;; +let table_b_gg = Graph_control.flyspeck_properties.Graph_control.table_weight_b;; +let table_d_gg = Graph_control.flyspeck_properties.Graph_control.table_weight_d;; +let squander_gg = Graph_control.flyspeck_properties.Graph_control.squander_target;; + +let table_multiplier = new_definition `table_multiplier = &10000`;; + +let a_bn_eq = prove_by_refinement( + `a_tame * table_multiplier = &bn_excessTCount`, + (* {{{ proof *) + [ + REWRITE_TAC[table_a;table_a_bn;table_multiplier]; + BY(ARITH_TAC) + ]);; + (* }}} *) + +let COND_MUL = prove_by_refinement( + `!a b c d. (if a then (b*d) else (c*d)) = (if a then b else c)*d`, + (* {{{ proof *) + [ + BY(MESON_TAC[]) + ]);; + (* }}} *) + +let b_bn_eq = prove_by_refinement( + `!p q. b_tame p q * table_multiplier = &(bn_squanderVertex p q)`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REWRITE_TAC[table_b_bn]; + BY(REPEAT(COND_CASES_TAC) THEN ASM_REWRITE_TAC[squander;table_b;table_b_bn;table_multiplier;PAIR_EQ;squander_bn;GSYM COND_MUL] THEN TRY (ARITH_TAC)) + ]);; + (* }}} *) + +let d_bn_eq = prove_by_refinement( + `!n. d_tame n * table_multiplier = &(bn_squanderFace n)`, + (* {{{ proof *) + [ + REPEAT GEN_TAC; + REWRITE_TAC[table_d_bn]; + BY((REPEAT(COND_CASES_TAC) THEN ASM_REWRITE_TAC[table_d;squander;squander_bn;table_multiplier;PAIR_EQ;squander_bn]) THEN TRY(ARITH_TAC)) + ]);; + (* }}} *) + + end;; diff --git a/text_formalization/tame/ssreflect/FNJLBXS-compiled.hl b/text_formalization/tame/ssreflect/FNJLBXS-compiled.hl new file mode 100644 index 0000000..b33970f --- /dev/null +++ b/text_formalization/tame/ssreflect/FNJLBXS-compiled.hl @@ -0,0 +1,1828 @@ +prioritize_overload `:real^N`;; +needs "tame/ssreflect/sort-compiled.hl";; + +(* Module Fnjlbxs*) +module Fnjlbxs = struct + +open Ssrfun;; +open Ssrbool;; +open Ssrnat;; +open Seq;; +open Seq2;; +open Sort;; +open Tame_defs;; +open Fan_defs;; + +(* Lemma packing *) +let packing = Sections.section_proof ["V"] +`packing V <=> (!u v. u IN V /\ v IN V /\ ~(u = v) ==> &2 <= dist (u,v))` +[ + (((((use_arg_then2 ("Sphere.packing", [Sphere.packing]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("IN", [IN])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); +];; +let inE = CONJUNCT2 IN_ELIM_THM;; + +(* Section MoreList *) +Sections.begin_section "MoreList";; + +(* Lemma uniq_lift *) +let uniq_lift = Sections.section_proof ["l"] +`uniq (map lift l) <=> uniq l` +[ + (((((use_arg_then2 ("map_inj_uniq", [map_inj_uniq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("LIFT_EQ", [LIFT_EQ]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_sum_continuous *) +let list_sum_continuous = Sections.section_proof ["f";"s";"s'";"net"] +`lift o f continuous_on (UNIV:real^N->bool) /\ + (!k. LENGTH (s' k) = LENGTH s) /\ + (!i. i < LENGTH s ==> ((\k. EL i (s' k)) --> EL i s) net) ==> + ((\k. list_sum (s' k) f) ---> list_sum s f) net` +[ + ((BETA_TAC THEN (case THEN (move ["f_cont"]))) THEN (((THENL) (((use_arg_then2 ("s'", [])) (disch_tac [])) THEN (clear_assumption "s'") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN (move ["s'"])) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LENGTH", [LENGTH]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("LENGTH_EQ_NIL", [LENGTH_EQ_NIL]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["_"])) THEN (((use_arg_then2 ("REALLIM_CONST", [REALLIM_CONST]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["len_eq"])) THEN (move ["s'_to"])); + ((fun arg_tac -> arg_tac (Arg_term (`!k. s' k = EL 0 (s' k) :: TL (s' k)`))) (term_tac (have_gen_tac [](move ["s'_eq"])))); + ((BETA_TAC THEN (move ["k"])) THEN ((((use_arg_then2 ("EL", [EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CONS_HD_TL", [CONS_HD_TL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LENGTH_EQ_NIL", [LENGTH_EQ_NIL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("len_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_SUC", [NOT_SUC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_ROT (-1)) (((((use_arg_then2 ("s'_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("list_sum_cons", [list_sum_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REALLIM_ADD", [REALLIM_ADD]))(thm_tac (new_rewrite [] []))))) THEN (split_tac))); + ((THENL_FIRST) ((((use_arg_then2 ("IH", [])) (disch_tac [])) THEN (clear_assumption "IH") THEN (DISCH_THEN apply_tac)) THEN (split_tac)) ((BETA_TAC THEN (move ["k"])) THEN (((fun arg_tac -> (use_arg_then2 ("len_eq", [])) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("s'_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("LENGTH", [LENGTH]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqSS", [eqSS]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((BETA_TAC THEN (move ["i"]) THEN (move ["i_lt"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL EL_TL)))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("s'_to", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SUC i`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_lt", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("ADD1", [ADD1]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("EL", [EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("TL", [TL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("LIM_REAL_CONTINUOUS_FUNCTION", [LIM_REAL_CONTINUOUS_FUNCTION]))(thm_tac (new_rewrite [] [])))); + ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(thm_tac (new_rewrite [] [])))) THEN (split_tac)); + (((use_arg_then2 ("CONTINUOUS_ON_INTERIOR", [CONTINUOUS_ON_INTERIOR])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`UNIV`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("INTERIOR_UNIV", [INTERIOR_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("s'_to", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("gtS0", [gtS0]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("EL", [EL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("HD", [HD]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_sum_continuous_alt *) +let list_sum_continuous_alt = Sections.section_proof ["f";"s";"v";"net"] +`lift o f continuous_on (UNIV:real^N->bool) /\ + (!i. i < LENGTH s ==> ((\k. v k i) --> EL i s) net) ==> + ((\k. list_sum (mkseq (v k) (LENGTH s)) f) ---> list_sum s f) net` +[ + (BETA_TAC THEN (case THEN ((move ["f_cont"]) THEN (move ["v_to"])))); + (((((use_arg_then2 ("list_sum_continuous", [list_sum_continuous]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_cont", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["i"]) THEN (move ["i_lt"])); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`!k. EL i (mkseq (v k) (sizel s)) = v k i`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) (((((use_arg_then2 ("v_to", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((BETA_TAC THEN (move ["k"])) THEN ((((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("nth_mkseq", [nth_mkseq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section MoreList *) +let uniq_lift = Sections.finalize_theorem uniq_lift;; +let list_sum_continuous = Sections.finalize_theorem list_sum_continuous;; +let list_sum_continuous_alt = Sections.finalize_theorem list_sum_continuous_alt;; +Sections.end_section "MoreList";; + +(* Section MoreMinK *) +Sections.begin_section "MoreMinK";; + +(* Lemma min_k_continuous *) +let min_k_continuous = Sections.section_proof ["k";"n";"f";"net"] +`(!i. i < n ==> f i real_continuous net) ==> + (\x. min_k k (mkseq (\i. f i x) n)) real_continuous net` +[ + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`k < n:num`))) (disch_eq_tac "k_lt" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + ((((use_arg_then2 ("min_k", [min_k]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`\x. _ x`))) (term_tac (set_tac "r")))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`r = \x. EL k (nseq n ((@)UNIV))`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((((use_arg_then2 ("REAL_CONTINUOUS_CONST", [REAL_CONTINUOUS_CONST]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["m"]) THEN (simp_tac)) THEN ((use_arg_then2 ("ge_length_imp_EL_eq", [ge_length_imp_EL_eq])) (thm_tac apply_tac))); + (((((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_merge_sort", [size_merge_sort]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_nseq", [size_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("real_continuous", [real_continuous]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REALLIM)))(thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> arg_tac (Arg_term (`trivial_limit net`))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["f_cont"]) THEN (move ["e"]) THEN (move ["e_gt0"])); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`?y. (?x. netord net x y) /\ + (!x. netord net x y ==> (!i:num. i < n ==> abs (f i x - f i (netlimit net)) < e))`))) (term_tac (have_gen_tac []ALL_TAC)))); + ((((use_arg_then2 ("MONO_EXISTS", [MONO_EXISTS])) (thm_tac apply_tac)) THEN (move ["y"]) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["all_f"])) THEN ((((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (move ["x"]) THEN (move ["net_x"]))); + (repeat_tactic 1 9 (((use_arg_then2 ("min_k", [min_k]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`merge_sort (<=) _`))) (term_tac (set_tac "s"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`merge_sort (<=) _`))) (term_tac (set_tac "s'")))); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("s'_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_merge_sort", [size_merge_sort]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("s_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sort_continuous", [sort_continuous])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`mkseq (\i. f i x) n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`mkseq (\i. f i (netlimit net)) n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("s'_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_merge_sort", [real_merge_sort]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("k_lt", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["i"]) THEN (move ["i_lt"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("nth_mkseq", [nth_mkseq]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("all_f", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`?y x. netord net x y`))) (term_tac (have_gen_tac [](move ["ord_xy"])))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_cont", [])) (fun fst_arg -> (use_arg_then2 ("k_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["y"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["x"])) THEN (move ["h"]) THEN (move ["_"])) THEN (((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac))) THEN (done_tac)); + (((THENL) (((use_arg_then2 ("f_cont", [])) (disch_tac [])) THEN (clear_assumption "f_cont") THEN ((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["m"]) THEN (move ["IH"]))]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + ((((use_arg_then2 ("ord_xy", [])) (disch_tac [])) THEN (clear_assumption "ord_xy") THEN BETA_TAC THEN (case THEN (move ["y"])) THEN (case THEN (move ["x"])) THEN (move ["ord_xy"])) THEN (((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac))) THEN (done_tac)); + ((BETA_TAC THEN (move ["f_cont"])) THEN (((use_arg_then2 ("IH", [])) (disch_tac [])) THEN (clear_assumption "IH") THEN BETA_TAC) THEN ((THENL) (ANTS_TAC) [((move ["i"]) THEN (move ["i_lt_m"]) THEN (move ["e'"]) THEN (move ["e'_gt0"])); ALL_TAC])); + (((((use_arg_then2 ("f_cont", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e'_gt0", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("i_lt_m", [])) (disch_tac [])) THEN (clear_assumption "i_lt_m") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f_cont", [])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("ltnSn", [ltnSn])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((use_arg_then2 ("IMP_IMP", [IMP_IMP]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("NET_DILEMMA", [NET_DILEMMA])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["y"])) THEN (case THEN (move ["x_ord"])) THEN (move ["h"])); + (((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("x_ord", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `i < SUC m <=> i = m \/ i < m`)))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["ord_xy"]) THEN (move ["i"]))); + ((THENL_FIRST) ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (move ["i_lt_m"])]) ((((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("ord_xy", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma min_k_limit *) +let min_k_limit = Sections.section_proof ["k";"s";"s'";"net"] +`(!n. LENGTH (s' n) = LENGTH s) /\ + (!i. i < LENGTH s ==> ((\n. EL i (s' n)) ---> EL i s) net) ==> + ((\n. min_k k (s' n)) ---> min_k k s) net` +[ + (BETA_TAC THEN (case THEN ((move ["len_eq"]) THEN (move ["s'_to"])))); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`k < LENGTH s`))) (disch_eq_tac "k_lt" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`(\n. min_k k (s' n)) = (\n. min_k k s)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((((use_arg_then2 ("REALLIM_CONST", [REALLIM_CONST]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((repeat_tactic 1 9 (((use_arg_then2 ("min_k", [min_k]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["m"]) THEN (simp_tac)) THEN ((use_arg_then2 ("ge_length_imp_EL_eq", [ge_length_imp_EL_eq])) (thm_tac apply_tac))); + (((((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size_merge_sort", [size_merge_sort]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("len_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("s'_to", [])) (disch_tac [])) THEN (clear_assumption "s'_to") THEN BETA_TAC) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REALLIM)))(thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> arg_tac (Arg_term (`trivial_limit net`))) (disch_tac [])) THEN case THEN (simp_tac) THEN (move ["el_cont"]) THEN (move ["e"]) THEN (move ["e_gt0"])); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`?y. (?x. netord net x y) /\ + (!x. netord net x y ==> (!i. i < LENGTH s ==> abs (EL i (s' x) - EL i s) < e))`))) (term_tac (have_gen_tac []ALL_TAC)))); + ((((use_arg_then2 ("MONO_EXISTS", [MONO_EXISTS])) (thm_tac apply_tac)) THEN (move ["y"]) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["all_el"])) THEN ((((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (move ["x"]) THEN (move ["net_x"]))); + (repeat_tactic 1 9 (((use_arg_then2 ("min_k", [min_k]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`merge_sort (<=) _`))) (term_tac (set_tac "l"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`merge_sort (<=) _`))) (term_tac (set_tac "l'")))); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("l_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("l'_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_merge_sort", [size_merge_sort]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("len_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("l_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("l'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sort_continuous", [sort_continuous])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`s' x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("l_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("l'_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_merge_sort", [real_merge_sort]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("len_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("k_lt", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["i"]) THEN (move ["i_lt"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("EL_nth", [EL_nth]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("len_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("all_el", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`?y x. netord net x y`))) (term_tac (have_gen_tac [](move ["ord_xy"])))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("el_cont", [])) (fun fst_arg -> (use_arg_then2 ("k_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["y"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["x"])) THEN (move ["h"]) THEN (move ["_"])) THEN (((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac))) THEN (done_tac)); + (((THENL) (((use_arg_then2 ("el_cont", [])) (disch_tac [])) THEN (clear_assumption "el_cont") THEN ((use_arg_then2 ("len_eq", [])) (disch_tac [])) THEN (clear_assumption "len_eq") THEN ((use_arg_then2 ("s'", [])) (disch_tac [])) THEN (clear_assumption "s'") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("LENGTH", [LENGTH]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["s'"]) THEN (move ["len_eq"]) THEN (move ["el_cont"]))); + ((((fun arg_tac -> (use_arg_then2 ("IH", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`\n. TL (s' n)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (repeat_tactic 1 9 ((ANTS_TAC)))); + ((THENL_LAST) ((BETA_TAC THEN (move ["n"])) THEN ((((use_arg_then2 ("LENGTH_TL", [LENGTH_TL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("len_eq", []))(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("len_eq", [])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("LENGTH", [LENGTH]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + (BETA_TAC THEN (move ["i"]) THEN (move ["i_lt"]) THEN (move ["e'"]) THEN (move ["e'_gt0"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("el_cont", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SUC i`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e'_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_lt", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("EL", [EL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("TL", [TL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("el_cont", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("gtS0", [gtS0]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((((use_arg_then2 ("IMP_IMP", [IMP_IMP]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("NET_DILEMMA", [NET_DILEMMA])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["y"])) THEN (case THEN (move ["x_ord"])) THEN (move ["h"])); + ((THENL_FIRST) (((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("x_ord", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["ord_xy"]) THEN ((THENL) case [(move ["_"]); (move ["i"])]))) ((((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] [])))) THEN (move ["i_lt"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("EL", [EL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("TL", [TL]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("ord_xy", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +let min_dist_k = new_definition + `min_dist_k k (l:(real^N)list) = min_k 0 (map (\v. dist (v, EL k l)) (delete_at k l))`;; + +(* Lemma min_dist_k_limit *) +let min_dist_k_limit = Sections.section_proof ["k";"s";"s'";"net"] +`(!n. LENGTH (s' n) = LENGTH s) /\ + (!i. i < LENGTH s ==> ((\n. EL i (s' n)) --> EL i s) net) ==> + ((\n. min_dist_k k (s' n)) ---> min_dist_k k s) net` +[ + (BETA_TAC THEN (case THEN (move ["len_eq"])) THEN (move ["s'_to"])); + (repeat_tactic 1 9 (((use_arg_then2 ("min_dist_k", [min_dist_k]))(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("min_k_limit", [min_k_limit])) (thm_tac apply_tac)) THEN ((THENL) (split_tac) [(move ["n"]); (move ["i"])]) THEN ((((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size_map", [size_map]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size_delete_at", [size_delete_at]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("len_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((in_tac ["len_eq"] true (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (BETA_TAC THEN (move ["i_lt"]))); + ((fun arg_tac -> arg_tac (Arg_term (`(\n. EL i (map (\v. dist (v, EL k (s' n))) (delete_at k (s' n)))) = + (\n. norm (EL i (delete_at k (s' n)) - EL k (s' n)))`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] []))))) THEN (move ["n"]) THEN (simp_tac)) THEN ((((use_arg_then2 ("EL_map", [EL_map]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_delete_at", [size_delete_at]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("len_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("EL_map", [EL_map]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_delete_at", [size_delete_at]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((use_arg_then2 ("LIM_REAL_CONTINUOUS_FUNCTION", [LIM_REAL_CONTINUOUS_FUNCTION])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("REAL_CONTINUOUS_NORM_AT", [REAL_CONTINUOUS_NORM_AT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LIM_SUB", [LIM_SUB]))(thm_tac (new_rewrite [] [])))))); + ((THENL_ROT (-1)) (((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN ((fun arg_tac -> arg_tac (Arg_term (`k < sizel s`))) (disch_eq_tac "k_lt" [])) THEN case THEN (simp_tac) THEN (move ["i_lt"]) THEN (process_fst_eq_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`!n. delete_at k (s' n) = s' n`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((BETA_TAC THEN (move ["n"])) THEN ((((use_arg_then2 ("delete_at_eq_imp", [delete_at_eq_imp]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("len_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((((fun arg_tac -> (use_arg_then2 ("delete_at_eq_imp", [delete_at_eq_imp])) (fun fst_arg -> (use_arg_then2 ("k_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s'_to", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`!n. EL k (s' n) = EL k s`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((((use_arg_then2 ("LIM_CONST", [LIM_CONST]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((BETA_TAC THEN (move ["n"])) THEN ((use_arg_then2 ("ge_length_imp_EL_eq", [ge_length_imp_EL_eq])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("len_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!n. EL i (delete_at k (s' n)) = EL (if i < k then i else SUC i) (s' n)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((BETA_TAC THEN (move ["n"])) THEN ((((use_arg_then2 ("EL_delete_at", [EL_delete_at]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_delete_at", [size_delete_at]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("len_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("k_lt", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("EL_delete_at", [EL_delete_at]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_delete_at", [size_delete_at]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("k_lt", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("s'_to", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("k_lt", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma min_dist_min *) +let min_dist_min = Sections.section_proof ["l";"k"] +`!i. i < sizel l /\ ~(i = k) ==> min_dist_k k l <= dist (EL i l, EL k l)` +[ + ((BETA_TAC THEN (move ["i"]) THEN (case THEN ((move ["i_lt"]) THEN (move ["neq"])))) THEN ((((use_arg_then2 ("min_dist_k", [min_dist_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("min_k", [min_k]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`map _1 _2`))) (term_tac (set_tac "s"))); + ((fun arg_tac -> (use_arg_then2 ("real_merge_sort", [real_merge_sort])) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["sort"]))); + (((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))); + (((((use_arg_then2 ("size_merge_sort", [size_merge_sort]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_map", [size_map]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_delete_at", [size_delete_at]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN ((use_arg_then2 ("neq", [])) (disch_tac [])) THEN (clear_assumption "neq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b. a <= b <=> a <= b \/ b = a`)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_term (`_1 = _2`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + ((((fun arg_tac -> (use_arg_then2 ("nth0_sorted_imp", [nth0_sorted_imp])) (fun fst_arg -> (use_arg_then2 ("sort", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mapP", [mapP]))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> arg_tac (Arg_term (`EL i l`))) (term_tac exists_tac)) THEN (simp_tac)) THEN (((use_arg_then2 ("MEM_EXISTS_EL", [MEM_EXISTS_EL]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`if i < k then i else i - 1`))) (term_tac (set_tac "j"))); + ((fun arg_tac -> arg_tac (Arg_term (`j < sizel (delete_at k l)`))) (term_tac (have_gen_tac [](move ["j_lt"])))); + (((((use_arg_then2 ("size_delete_at", [size_delete_at]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("j_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("neq", [])) (disch_tac [])) THEN (clear_assumption "neq") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((use_arg_then2 ("j", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("EL_delete_at", [EL_delete_at]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("j_lt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + (congr_tac (`EL _ l`)); + ((((use_arg_then2 ("j_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("neq", [])) (disch_tac [])) THEN (clear_assumption "neq") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma min_dist_exists *) +let min_dist_exists = Sections.section_proof ["l";"k"] +`2 <= sizel l ==> + ?m. m < sizel l /\ ~(m = k) /\ min_dist_k k l = dist (EL m l, EL k l)` +[ + ((BETA_TAC THEN (move ["size_ge"])) THEN (((use_arg_then2 ("min_dist_k", [min_dist_k]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`map _1 _2`))) (term_tac (set_tac "s"))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mem_min_k", [mem_min_k])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)); + (((((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_map", [size_map]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_delete_at", [size_delete_at]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_ge", [])) (disch_tac [])) THEN (clear_assumption "size_ge") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then2 ("MEM_EXISTS_EL", [MEM_EXISTS_EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("size_map", [size_map]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_delete_at", [size_delete_at]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["i"])) THEN (case THEN (move ["i_lt"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`if i < k then i else SUC i`))) (term_tac (set_tac "m"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`m < sizel l`))) (term_tac (have_gen_tac [](move ["m_lt"])))) ((((use_arg_then2 ("m_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) (((use_arg_then2 ("m", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("m_lt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)) ((((use_arg_then2 ("m_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EL_map", [EL_map]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_delete_at", [size_delete_at]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))); + (((((use_arg_then2 ("EL_delete_at", [EL_delete_at]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("m_def", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_delete_at", [size_delete_at]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma min_distP *) +let min_distP = Sections.section_proof ["l";"k";"x"] +`2 <= sizel l ==> (min_dist_k k l = x <=> + ?m. m < sizel l /\ ~(m = k) /\ dist (EL m l, EL k l) = x /\ + (!i. i < sizel l /\ ~(i = k) ==> x <= dist (EL i l, EL k l)) )` +[ + (BETA_TAC THEN (move ["size_ge"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("min_dist_exists", [min_dist_exists])) (fun fst_arg -> (use_arg_then2 ("size_ge", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["r"])) THEN (case THEN (move ["r_lt"])) THEN (case THEN (move ["rnk"])) THEN (move ["r_dist_eq"])); + ((THENL) (split_tac) [(((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))); ((case THEN (move ["m"])) THEN (case THEN (move ["m_lt"])) THEN (case THEN (move ["mnk"])) THEN (case THEN (move ["dist_eq"])) THEN (move ["dist_le"]))]); + (((use_arg_then2 ("r", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("r_lt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rnk", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("r_dist_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["i"]) THEN (case THEN (move ["i_lt"])) THEN (move ["neq"]))); + ((((use_arg_then2 ("min_dist_min", [min_dist_min]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("REAL_LE_ANTISYM", [REAL_LE_ANTISYM]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (split_tac)); + (((((use_arg_then2 ("dist_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("min_dist_min", [min_dist_min]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("r_dist_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist_le", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma min_dist_imp_packing *) +let min_dist_imp_packing = Sections.section_proof ["l"] +`(!i. i < sizel l ==> &2 <= min_dist_k i l) ==> packing (set_of_list l)` +[ + (((((use_arg_then2 ("packing", [packing]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))))) THEN (move ["h"]) THEN (move ["u"]) THEN (move ["v"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("MEM_EXISTS_EL", [MEM_EXISTS_EL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["i"])) THEN (case THEN (move ["i_lt"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (case THEN ALL_TAC) THEN (case THEN (move ["j"])) THEN (case THEN (move ["j_lt"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["neq"])); + ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`min_dist_k j l`))) (term_tac exists_tac))); + ((((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("min_dist_min", [min_dist_min]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_lt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("neq", [])) (disch_tac [])) THEN (clear_assumption "neq") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma packing_eq_min_dist *) +let packing_eq_min_dist = Sections.section_proof ["l"] +`uniq l /\ 2 <= sizel l ==> + (packing (set_of_list l) <=> !i. i < sizel l ==> &2 <= min_dist_k i l)` +[ + ((THENL_LAST) ((BETA_TAC THEN (case THEN ((move ["uniq_l"]) THEN (move ["size_ge"])))) THEN (split_tac)) (((use_arg_then2 ("min_dist_imp_packing", [min_dist_imp_packing])) (disch_tac [])) THEN (clear_assumption "min_dist_imp_packing") THEN (exact_tac))); + (((((use_arg_then2 ("packing", [packing]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))))) THEN (move ["pack"]) THEN (move ["k"]) THEN (move ["k_lt"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("min_dist_exists", [min_dist_exists])) (fun fst_arg -> (use_arg_then2 ("size_ge", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["m"])) THEN (case THEN (move ["m_lt"])) THEN (case THEN (move ["n_mk"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("pack", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("MEM_EL", [MEM_EL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("nth_uniq", [nth_uniq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma min_dist_imp_uniq *) +let min_dist_imp_uniq = Sections.section_proof ["l"] +`(!i. i < sizel l ==> &0 < min_dist_k i l) ==> uniq l` +[ + ((THENL_FIRST) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sizel l < 2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("uniq_small_size", [uniq_small_size])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("NOT_LT", [NOT_LT]))(thm_tac (new_rewrite [] [])))) THEN (move ["size_ge"]) THEN (move ["n0"])); + ((((fun arg_tac -> (use_arg_then2 ("uniq_nthP", [uniq_nthP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["j"]) THEN (case THEN (move ["i_lt_j"])) THEN (move ["j_lt"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`i < sizel l`))) (term_tac (have_gen_tac [](move ["i_lt"])))) ((((use_arg_then2 ("j_lt", [])) (disch_tac [])) THEN (clear_assumption "j_lt") THEN ((use_arg_then2 ("i_lt_j", [])) (disch_tac [])) THEN (clear_assumption "i_lt_j") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("n0", [])) (fun fst_arg -> (use_arg_then2 ("j_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac)) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("EL_nth", [EL_nth]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))) THEN (move ["el_eq"]))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("min_dist_exists", [min_dist_exists])) (fun fst_arg -> (use_arg_then2 ("size_ge", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["m"])) THEN (case THEN (move ["m_lt"])) THEN (case THEN (move ["n_mj"])) THEN (move ["dist_eq"])); + ((((use_arg_then2 ("dist_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NOT_LT", [REAL_NOT_LT]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("min_dist_min", [min_dist_min])) (fun fst_arg -> (use_arg_then2 ("i_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)) ((((use_arg_then2 ("i_lt_j", [])) (disch_tac [])) THEN (clear_assumption "i_lt_j") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("dist_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("el_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIST_REFL", [DIST_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma uniq_min_distP *) +let uniq_min_distP = Sections.section_proof ["l"] +`uniq l <=> sizel l < 2 \/ (!i. i < sizel l ==> &0 < min_dist_k i l)` +[ + ((THENL_LAST) (split_tac) (((THENL) case [(DISCH_THEN (fun snd_th -> (use_arg_then2 ("uniq_small_size", [uniq_small_size])) (thm_tac (match_mp_then snd_th MP_TAC)))); (DISCH_THEN (fun snd_th -> (use_arg_then2 ("min_dist_imp_uniq", [min_dist_imp_uniq])) (thm_tac (match_mp_then snd_th MP_TAC))))]) THEN (done_tac))); + ((BETA_TAC THEN (move ["uniq_l"])) THEN (((THENL) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sizel l < 2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); ALL_TAC]) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("NOT_LT", [NOT_LT]))(thm_tac (new_rewrite [] [])))) THEN (move ["size_ge"])) THEN ((DISJ2_TAC) THEN (move ["k"]) THEN (move ["k_lt"]))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("min_dist_exists", [min_dist_exists])) (fun fst_arg -> (use_arg_then2 ("size_ge", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["m"])) THEN (case THEN (move ["m_lt"])) THEN (case THEN (move ["n_mk"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (in_tac ["uniq_l"] false (((fun arg_tac -> (use_arg_then2 ("uniq_nthP", [uniq_nthP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN ((use_arg_then2 ("m_lt", [])) (disch_tac [])) THEN (clear_assumption "m_lt") THEN ((use_arg_then2 ("n_mk", [])) (disch_tac [])) THEN (clear_assumption "n_mk") THEN BETA_TAC) THEN (((THENL) ((fun arg_tac -> arg_tac (Arg_term (`m < k:num`))) (term_tac (wlog_tac ALL_TAC[`m`; `k`]))) [(move ["h"]); (move ["m_lt_k"])]) THEN (move ["n_mk"]) THEN (move ["m_lt"]) THEN (move ["k_lt"]))); + (((THENL) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`m < k:num`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [((DISCH_THEN (fun snd_th -> (use_arg_then2 ("h", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); ALL_TAC]) THEN ((TRY done_tac))); + ((((((use_arg_then2 ("NOT_LT", [NOT_LT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LE_LT", [LE_LT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_mk", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbF", [orbF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("h", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_LT_LE", [REAL_LT_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIST_POS_LE", [DIST_POS_LE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("uniq_l", [])) (fun fst_arg -> (use_arg_then2 ("m_lt_k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("k_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac)); + (((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIST_EQ_0", [DIST_EQ_0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma uniq_open *) +let uniq_open = Sections.section_proof ["l"] +`uniq l ==> ?e. &0 < e /\ + (!s. sizel s = sizel l /\ (!i. i < sizel l ==> dist (EL i s, EL i l) < e) ==> uniq s)` +[ + ((BETA_TAC THEN (move ["uniq_l"])) THEN (((use_arg_then2 ("uniq_l", [])) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("uniq_min_distP", [uniq_min_distP]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`sizel l < 2`))) (disch_eq_tac "size_ge" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`&1`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("REAL_LT_01", [REAL_LT_01]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["s"]) THEN (case THEN (move ["size_eq"])) THEN (move ["_"]))); + (((((use_arg_then2 ("uniq_small_size", [uniq_small_size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((in_tac ["size_ge"] false (((use_arg_then2 ("NOT_LT", [NOT_LT]))(thm_tac (new_rewrite [] []))))) THEN (BETA_TAC THEN (move ["h"]))); + ((fun arg_tac -> arg_tac (Arg_term (`mkseq (\i. min_dist_k i l) (sizel l)`))) (term_tac (set_tac "r"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`sizel r = sizel l`))) (term_tac (have_gen_tac [](move ["size_r"])))) (((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`min_k 0 r / &2`))) (term_tac exists_tac)) THEN ((THENL) (split_tac) [ALL_TAC; ((move ["s"]) THEN (case THEN ((move ["size_eq"]) THEN (move ["dist_lt"]))))])); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mem_min_k", [mem_min_k])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("r", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)) (((((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_r", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_ge", [])) (disch_tac [])) THEN (clear_assumption "size_ge") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((BETA_TAC THEN (move ["mem_r"])) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_index", [nth_index])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("mem_r", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LT_DIV", [REAL_LT_DIV]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("nth_mkseq", [nth_mkseq]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_r", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("uniq_nthP", [uniq_nthP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["j"]) THEN (case THEN ((move ["i_lt_j"]) THEN (move ["j_lt"])))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`i < sizel s`))) (term_tac (have_gen_tac [](move ["i_lt"])))) ((((use_arg_then2 ("i_lt_j", [])) (disch_tac [])) THEN (clear_assumption "i_lt_j") THEN ((use_arg_then2 ("j_lt", [])) (disch_tac [])) THEN (clear_assumption "j_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("EL_nth", [EL_nth]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("DIST_LE_0", [DIST_LE_0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_NOT_LE", [REAL_NOT_LE]))(thm_tac (new_rewrite [] []))))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`min_k 0 r <= dist (EL i l, EL j l)`))) (term_tac (have_gen_tac []ALL_TAC)))); + (in_tac ["dist_lt"] false (((use_arg_then2 ("size_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DIST_TRIANGLE", [DIST_TRIANGLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`EL i l`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`EL i s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`EL j l`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DIST_TRIANGLE", [DIST_TRIANGLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`EL i s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`EL j s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`EL j l`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((fun arg_tac -> (use_arg_then2 ("dist_lt", [])) (fun fst_arg -> (use_arg_then2 ("j_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then2 ("dist_lt", [])) (fun fst_arg -> (use_arg_then2 ("i_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`min_dist_k j l`))) (term_tac exists_tac))); + ((THENL_FIRST) ((((use_arg_then2 ("min_dist_min", [min_dist_min]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_lt", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))) ((((use_arg_then2 ("i_lt_j", [])) (disch_tac [])) THEN (clear_assumption "i_lt_j") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((use_arg_then2 ("r_def", [])) (disch_tac [])) THEN (clear_assumption "r_def") THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("f_equal", [f_equal])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`\x. nth (&0) x j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC); + (((((use_arg_then2 ("nth_mkseq", [nth_mkseq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("BETA_THM", [BETA_THM]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("EL_nth", [EL_nth]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_r", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("min_k0_le_EL", [min_k0_le_EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_r", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma uniq_real_open *) +let uniq_real_open = Sections.section_proof ["l"] +`uniq l ==> ?e. &0 < e /\ + (!s. sizel s = sizel l /\ (!i. i < sizel l ==> abs (EL i s - EL i l) < e) ==> uniq s)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("uniq_lift", [uniq_lift]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("uniq_open", [uniq_open])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["e"])) THEN (case THEN (move ["e_gt0"])) THEN (move ["h"])); + (((use_arg_then2 ("e", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("e_gt0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIST_LIFT", [DIST_LIFT]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["s"]) THEN (case THEN (move ["size_eq"])) THEN (move ["dist_lt"]))); + ((((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN (DISCH_THEN apply_tac)) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("size_map", [size_map]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["i"]) THEN (move ["i_lt"]))); + (((repeat_tactic 1 9 (((use_arg_then2 ("EL_map", [EL_map]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dist_lt", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section MoreMinK *) +let min_k_continuous = Sections.finalize_theorem min_k_continuous;; +let min_k_limit = Sections.finalize_theorem min_k_limit;; +let min_dist_k_limit = Sections.finalize_theorem min_dist_k_limit;; +let min_dist_min = Sections.finalize_theorem min_dist_min;; +let min_dist_exists = Sections.finalize_theorem min_dist_exists;; +let min_distP = Sections.finalize_theorem min_distP;; +let min_dist_imp_packing = Sections.finalize_theorem min_dist_imp_packing;; +let packing_eq_min_dist = Sections.finalize_theorem packing_eq_min_dist;; +let min_dist_imp_uniq = Sections.finalize_theorem min_dist_imp_uniq;; +let uniq_min_distP = Sections.finalize_theorem uniq_min_distP;; +let uniq_open = Sections.finalize_theorem uniq_open;; +let uniq_real_open = Sections.finalize_theorem uniq_real_open;; +Sections.end_section "MoreMinK";; + +(* Section MoreSortedReal *) +Sections.begin_section "MoreSortedReal";; + +(* Lemma real_sorted_lt2 *) +let real_sorted_lt2 = Sections.section_proof ["l";"l'";"s";"s'";"r"] +`sorted (<=) s l /\ sorted (<=) s' l' /\ sizel l' = sizel l /\ + r < sizel l /\ EL r l < EL r l' /\ + (!i. i < sizel l /\ EL i l <= EL r l ==> EL i l <= EL i l') /\ + (!i. i < sizel l /\ EL r l < EL i l ==> EL r l < EL i l') ==> + ?k. k < sizel l /\ (!i. i < k ==> EL i s = EL i s') /\ EL k s < EL k s'` +[ + (BETA_TAC THEN (case THEN (move ["sort_s"])) THEN (case THEN (move ["sort_s'"])) THEN (case THEN (move ["size_eq"])) THEN (case THEN (move ["r_lt"])) THEN (case THEN (move ["el_r_lt"])) THEN (case THEN (move ["el_le"])) THEN (move ["el_gt"])); + ((((use_arg_then2 ("sort_s'", [])) (disch_tac [])) THEN ((use_arg_then2 ("sort_s", [])) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("sorted", [sorted]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["ord_s"]) THEN (move ["perm_s"]))) THEN (case THEN ((move ["ord_s'"]) THEN (move ["perm_s'"]))))); + (((fun arg_tac -> arg_tac (Arg_term (`sizel l`))) (term_tac (set_tac "n"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`EL r l`))) (term_tac (set_tac "u")))); + ((fun arg_tac -> arg_tac (Arg_term (`mkseq (\i. if EL i l <= u then EL i l else u) n`))) (term_tac (set_tac "m"))); + ((fun arg_tac -> arg_tac (Arg_term (`merge_sort (<=) m`))) (term_tac (set_tac "t"))); + ((((fun arg_tac -> (use_arg_then2 ("real_merge_sort", [real_merge_sort])) (fun fst_arg -> (use_arg_then2 ("m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("t_def", []))(thm_tac (new_rewrite [] [])))) THEN (move ["sort_t"]))); + ((fun arg_tac -> arg_tac (Arg_term (`sizel t = n /\ sizel m = n /\ sizel s' = n /\ sizel l' = n /\ sizel s = n`))) (term_tac (have_gen_tac [](move ["sizes"])))); + (((((fun arg_tac -> (use_arg_then2 ("sorted_size", [sorted_size])) (fun fst_arg -> (use_arg_then2 ("sort_t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("sorted_size", [sorted_size])) (fun fst_arg -> (use_arg_then2 ("sort_s'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("sorted_size", [sorted_size])) (fun fst_arg -> (use_arg_then2 ("sort_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("m_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("real_sorted_lt", [real_sorted_lt])) (fun fst_arg -> (use_arg_then2 ("sort_t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sort_s'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)); + ((THENL_ROT (-1)) (((repeat_tactic 1 9 (((use_arg_then2 ("sizes", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (split_tac))); + (((use_arg_then2 ("r", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("r_lt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("m_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EL_mkseq", [EL_mkseq]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)))); + (((((use_arg_then2 ("u_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["i"]) THEN (move ["i_lt"])) THEN ((((use_arg_then2 ("m_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EL_mkseq", [EL_mkseq]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`EL i l <= u`))) (disch_eq_tac "neq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("el_le", [])) (disch_tac [])) THEN (clear_assumption "el_le") THEN (exact_tac)) THEN (done_tac))); + (((((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("el_gt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NOT_LE", [REAL_NOT_LE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("sizes", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["k"])) THEN (case THEN (move ["k_lt"])) THEN (case THEN (move ["el_eq"])) THEN (move ["el_k_lt"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("perm_eq_filter", [perm_eq_filter])) (fun fst_arg -> (use_arg_then2 ("perm_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`\x. x <= u`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["perm_l0"]))); + ((fun arg_tac -> arg_tac (Arg_term (`\x. x <= u`))) (term_tac (set_tac "a"))); + ((fun arg_tac -> arg_tac (Arg_term (`filter a l`))) (term_tac (set_tac "l0"))); + ((fun arg_tac -> arg_tac (Arg_term (`sizel l0`))) (term_tac (set_tac "n0"))); + ((fun arg_tac -> arg_tac (Arg_term (`n0 <= n:num`))) (term_tac (have_gen_tac [](move ["n0_le"])))); + (((((use_arg_then2 ("n0_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("l0_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("count_filter", [count_filter]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("count_size", [count_size]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`filter a s = take n0 s`))) (term_tac (have_gen_tac [](move ["take_eq"])))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ordered_cat_filter", [ordered_cat_filter])) (fun fst_arg -> (use_arg_then2 ("ord_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("u", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("f_equal", [f_equal])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`take n0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("a_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("take_size_cat", [take_size_cat]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("count_filter", [count_filter]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("iffLR", [iffLR])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("perm_eqP", [perm_eqP])) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("l", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("perm_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("count_filter", [count_filter]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("l0_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`perm_eq l (l0 ++ filter (predC a) l)`))) (term_tac (have_gen_tac []ALL_TAC))); + (((((use_arg_then2 ("perm_eq_sym", [perm_eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("l0_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("perm_filterC", [perm_filterC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_eq_refl", [perm_eq_refl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("perm_eq_bij", [perm_eq_bij])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["p"])) THEN (case THEN (move ["p_perm"])) THEN (move ["nth_eq"]))); + ((fun arg_tac -> arg_tac (Arg_term (` i < n ==> p i < n:num`))) (term_tac (have_gen_tac ["i"](move ["p_lt"])))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PERMUTES_IN_IMAGE", [PERMUTES_IN_IMAGE])) (fun fst_arg -> (use_arg_then2 ("p_perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("leq0n", [leq0n]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`take n0 s = take n0 t`))) (term_tac (have_gen_tac [](move ["st_eq"])))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`perm_eq m (l0 ++ nseq (n - n0) u)`))) (term_tac (have_gen_tac [](move ["perm_m"]))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ordered_cat_filter", [ordered_cat_filter])) (fun fst_arg -> (use_arg_then2 ("ord_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("u", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("a_def", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("sort_t", [])) (disch_tac [])) THEN (clear_assumption "sort_t") THEN BETA_TAC) THEN ((((use_arg_then2 ("sorted", [sorted]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["ord_t"]) THEN (move ["perm_t"]))))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`t = filter a s ++ nseq (n - n0) u`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("take_size_cat", [take_size_cat]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("take_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_takel", [size_takel]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`_1 ++ _2`))) (term_tac (set_tac "t2"))) THEN ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ordered_eq", [ordered_eq])) (fun fst_arg -> (use_arg_then2 ("ord_t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("t2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + (((THENL) (split_tac) [((move ["x"]) THEN (move ["y"])); ALL_TAC]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("REAL_LE_ANTISYM", [REAL_LE_ANTISYM]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("t2_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (split_tac)); + (((use_arg_then2 ("perm_eq_trans", [perm_eq_trans])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("m", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("perm_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("perm_eq_trans", [perm_eq_trans])) (fun fst_arg -> (use_arg_then2 ("perm_m", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("perm_eq_cat", [perm_eq_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_eq_refl", [perm_eq_refl]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_eq_sym", [perm_eq_sym]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("ordered_cat", [ordered_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ordered_filter", [ordered_filter]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ordered_real_nseq", [ordered_real_nseq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (simp_tac)); + (((((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_nseq", [mem_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("perm_eq_permutesP", [perm_eq_permutesP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_cat", [size_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_nseq", [size_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n0_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sizes", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("subnKC", [subnKC])) (fun fst_arg -> (use_arg_then2 ("n0_le", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((use_arg_then2 ("p", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("p_perm", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["i"]) THEN (move ["i_lt"])) THEN (((fun arg_tac -> (use_arg_then2 ("nth_eq", [])) (fun fst_arg -> (use_arg_then2 ("i_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC)); + (((fun arg_tac -> arg_tac (Arg_term (`i < n0:num`))) (disch_eq_tac "i_n0" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((repeat_tactic 1 9 (((use_arg_then2 ("nth_cat", [nth_cat]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n0_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_n0", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("COND_CLAUSES", [COND_CLAUSES]))(thm_tac (new_rewrite [] [])))))) THEN (move ["eq"])); + ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("m_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_mkseq", [nth_mkseq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("p_lt", []))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("p_lt", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("i_n0", [])) (disch_tac [])) THEN (clear_assumption "i_n0") THEN BETA_TAC) THEN ((((use_arg_then2 ("n0_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("mem_nth", [mem_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))))); + (((((use_arg_then2 ("l0_def", []))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("nth_cat", [nth_cat]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n0_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_n0", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("COND_CLAUSES", [COND_CLAUSES]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_nseq", [nth_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn_sub2r", [ltn_sub2r]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("n0_le", [])) (disch_tac [])) THEN (clear_assumption "n0_le") THEN ((use_arg_then2 ("i_n0", [])) (disch_tac [])) THEN (clear_assumption "i_n0") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then2 ("m_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_mkseq", [nth_mkseq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("p_lt", []))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EL_nth", [EL_nth]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("p_lt", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["eq"])); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mem_nth", [mem_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i - n0:num`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`filter (predC a) l`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("count_filter", [count_filter]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("count_predC", [count_predC])) (fun fst_arg -> (use_arg_then2 ("a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("l", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("count_filter", [count_filter]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("l0_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n0_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] [])))))); + (((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `!x. n0 <= n:num ==> (n0 + x = n <=> x = n - n0)`)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((((use_arg_then2 ("ltn_sub2r", [ltn_sub2r]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) ((((use_arg_then2 ("n0_le", [])) (disch_tac [])) THEN (clear_assumption "n0_le") THEN ((use_arg_then2 ("i_n0", [])) (disch_tac [])) THEN (clear_assumption "i_n0") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("predC", [predC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac)); + (((use_arg_then2 ("k", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("k_lt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`k < n0:num`))) (term_tac (have_gen_tac [](move ["k_lt_n0"]))))); + (((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("EL_take", [EL_take])) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("st_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EL_take", [EL_take]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("el_k_lt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_lt"])); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("EL_take", [EL_take])) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("EL_take", [EL_take])) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("st_eq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("EL_take", [EL_take]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sizes", []))(thm_tac (new_rewrite [] [])))))) THEN (TRY (((((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN ((use_arg_then2 ("k_lt_n0", [])) (disch_tac [])) THEN (clear_assumption "k_lt_n0") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac))))); + ((((use_arg_then2 ("el_eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("contraT", [contraT])) (disch_tac [])) THEN (clear_assumption "contraT") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("NOT_LT", [NOT_LT]))(thm_tac (new_rewrite [] [])))) THEN (move ["n0_le_k"]))); + ((fun arg_tac -> arg_tac (Arg_term (`count (predC a) s' <= n - n0`))) (term_tac (have_gen_tac []ALL_TAC))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("cat_take_drop", [cat_take_drop])) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("count_cat", [count_cat]))(thm_tac (new_rewrite [] []))))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`count (predC a) (take n0 s') = 0`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + ((((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_trans", [leq_trans])) (disch_tac [])) THEN (clear_assumption "leq_trans") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`sizel (dropl n0 s')`))) (term_tac exists_tac))); + (((((use_arg_then2 ("count_size", [count_size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sizes", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("count0", [count0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("predC", [predC]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("ETA_AX", [ETA_AX]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("all_EL_P", [all_EL_P]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_takel", [size_takel]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sizes", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["i"]) THEN (move ["i_lt"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`i < n:num /\ i < k`))) (term_tac (have_gen_tac [](move ["i_lt2"])))) ((((use_arg_then2 ("n0_le_k", [])) (disch_tac [])) THEN (clear_assumption "n0_le_k") THEN ((use_arg_then2 ("n0_le", [])) (disch_tac [])) THEN (clear_assumption "n0_le") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("EL_take", [EL_take]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sizes", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("el_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("EL_take", [EL_take])) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sizes", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("st_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EL_take", [EL_take]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sizes", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`EL i s <- filter a s`))) (term_tac (have_gen_tac []ALL_TAC)))) (((((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("take_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("EL_take", [EL_take])) (fun fst_arg -> (use_arg_then2 ("n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sizes", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("MEM_EL", [MEM_EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_takel", [size_takel]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sizes", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`count (predC a) l' >= (n - n0) + 1`))) (term_tac (have_gen_tac []ALL_TAC)))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("iffLR", [iffLR])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("perm_eqP", [perm_eqP])) (fun fst_arg -> (use_arg_then2 ("s'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("l'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("perm_s'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("REAL_OF_NUM_GE", [REAL_OF_NUM_GE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("count_eq_list_sum_iota", [count_eq_list_sum_iota])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> (use_arg_then2 ("permutes_imp_perm_eq_iota", [permutes_imp_perm_eq_iota])) (fun fst_arg -> (use_arg_then2 ("p_perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((THENL_FIRST) ((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `0 < n ==> n - 1 + 1 = n`)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sizes", []))(thm_tac (new_rewrite [] [])))))) ((((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("list_sum_perm_eq", [list_sum_perm_eq])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("list_sum_nth", [list_sum_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("subnKC", [subnKC])) (fun fst_arg -> (use_arg_then2 ("n0_le", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("iota_add", [iota_add]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_sum_cat", [list_sum_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`list_sum _1 _2`))) (term_tac (set_tac "s1"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`list_sum _1 _2`))) (term_tac (set_tac "s2")))); + ((fun arg_tac -> arg_tac (Arg_term (`sizel (filter (predC a) l) = n - n0`))) (term_tac (have_gen_tac [](move ["C_size"])))); + ((((use_arg_then2 ("count_filter", [count_filter]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("count_predC", [count_predC])) (fun fst_arg -> (use_arg_then2 ("a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("l", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC)); + (((((use_arg_then2 ("count_filter", [count_filter]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("l0_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n0_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n0_le", [])) (disch_tac [])) THEN (clear_assumption "n0_le") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`s2 = &(n - n0)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("C_size", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("count_predT", [count_predT]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("count_eq_list_sum_iota", [count_eq_list_sum_iota])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("C_size", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("predT", [predT]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("s2_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("list_sum_nth_eq", [list_sum_nth_eq])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac)); + (((repeat_tactic 1 9 (((use_arg_then2 ("size_iota", [size_iota]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["i"]) THEN (move ["i_lt"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`n0 + i < n:num`))) (term_tac (have_gen_tac [](move ["n0i"])))) ((((use_arg_then2 ("n0_le", [])) (disch_tac [])) THEN (clear_assumption "n0_le") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("nth_iota", [nth_iota]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("nth_mkseq", [nth_mkseq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("nth_eq", [])) (fun fst_arg -> (use_arg_then2 ("n0i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("nth_cat", [nth_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n0_def", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `~(n0 + i < n0:num)`)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("addKn", [addKn]))(thm_tac (new_rewrite [] []))))) THEN (move ["eq"]))); + (((fun arg_tac -> (use_arg_then2 ("el_gt", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`p (n0 + i:num)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((((use_arg_then2 ("EL_nth", [EL_nth]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sizes", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("p_lt", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("predC", [predC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_NOT_LE", [REAL_NOT_LE]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mem_nth", [mem_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`filter (predC a) l`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("C_size", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_lt", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((((((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("p_lt", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("predC", [predC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_NOT_LE", [REAL_NOT_LE]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`s1 >= &1`))) (term_tac (have_gen_tac []ALL_TAC)))); + (((((use_arg_then2 ("REAL_OF_NUM_ADD", [REAL_OF_NUM_ADD]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("REAL_OF_NUM_SUB", [REAL_OF_NUM_SUB])) (fun fst_arg -> (use_arg_then2 ("n0_le", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`?i:num. p i = r /\ i < n0`))) (term_tac (have_gen_tac []ALL_TAC)))); + (BETA_TAC THEN (case THEN (move ["i"])) THEN (case THEN ((move ["pi_eq"]) THEN (move ["i_lt"])))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("count_uniq_mem", [count_uniq_mem])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`iota 0 n0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("iota_uniq", [iota_uniq]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("mem_iota", [mem_iota]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq0n", [leq0n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_lt", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((((fun arg_tac -> (use_arg_then2 ("count_eq_list_sum_iota", [count_eq_list_sum_iota])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_iota", [size_iota]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_ge", [real_ge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("list_sum_nth_le2", [list_sum_nth_le2])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac)) THEN (((((use_arg_then2 ("size_iota", [size_iota]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["j"]) THEN (move ["j_lt"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("nth_iota", [nth_iota]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("pred1", [pred1]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`j = i`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`i < n:num`))) (term_tac (have_gen_tac [](move ["i_lt_n"])))) ((((use_arg_then2 ("n0_le", [])) (disch_tac [])) THEN (clear_assumption "n0_le") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_mkseq", [nth_mkseq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("pi_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("predC", [predC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("EL_nth", [EL_nth]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_NOT_LE", [REAL_NOT_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("el_r_lt", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PERMUTES_SURJECTIVE", [PERMUTES_SURJECTIVE])) (fun fst_arg -> (use_arg_then2 ("p_perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("r", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["i"])) THEN (move ["pi_eq"])); + (((use_arg_then2 ("i", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("pi_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then2 ("contraT", [contraT])) (disch_tac [])) THEN (clear_assumption "contraT") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("NOT_LT", [NOT_LT]))(thm_tac (new_rewrite [] [])))) THEN (move ["n0_le_i"]))); + ((fun arg_tac -> arg_tac (Arg_term (`i < n:num`))) (term_tac (have_gen_tac [](move ["i_lt"])))); + (((use_arg_then2 ("contraT", [contraT])) (disch_tac [])) THEN (clear_assumption "contraT") THEN (DISCH_THEN apply_tac) THEN (move ["not_lt"])); + ((((use_arg_then2 ("p_perm", [])) (disch_tac [])) THEN (clear_assumption "p_perm") THEN BETA_TAC) THEN ((((use_arg_then2 ("permutes", [permutes]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))))); + ((THENL_FIRST) (((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq0n", [leq0n]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("NOT_LE", [NOT_LE]))(thm_tac (new_rewrite [] []))))) THEN (ANTS_TAC)) ((((use_arg_then2 ("r_lt", [])) (disch_tac [])) THEN (clear_assumption "r_lt") THEN ((use_arg_then2 ("not_lt", [])) (disch_tac [])) THEN (clear_assumption "not_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("pi_eq", []))(thm_tac (new_rewrite [] [])))) THEN (move ["eq"])) THEN (((use_arg_then2 ("not_lt", [])) (disch_tac [])) THEN (clear_assumption "not_lt") THEN BETA_TAC) THEN ((((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("r_lt", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("nth_eq", [])) (fun fst_arg -> (use_arg_then2 ("i_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("pi_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EL_nth", [EL_nth]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("u_def", []))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("nth_cat", [nth_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n0_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_LE", [NOT_LE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n0_le_i", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("mem_nth", [mem_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`filter (predC a) l`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i - n0:num`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)); + ((((use_arg_then2 ("C_size", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN ((use_arg_then2 ("n0_le_i", [])) (disch_tac [])) THEN (clear_assumption "n0_le_i") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("predC", [predC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section MoreSortedReal *) +let real_sorted_lt2 = Sections.finalize_theorem real_sorted_lt2;; +Sections.end_section "MoreSortedReal";; + +(* Section SomeResults *) +Sections.begin_section "SomeResults";; + +(* Lemma packing_empty *) +let packing_empty = Sections.section_proof [] +`packing {}` +[ + (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Sphere.packing_lt)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma in_ball_annulus *) +let in_ball_annulus = Sections.section_proof ["v"] +`v IN ball_annulus <=> &2 <= norm v /\ norm v <= &2 * h0` +[ + ((((use_arg_then2 ("Pack_defs.ball_annulus", [Pack_defs.ball_annulus]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_CBALL", [IN_CBALL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_BALL", [IN_BALL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_RZERO)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NOT_LT", [REAL_NOT_LT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CONJ_SYM", [CONJ_SYM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma closed_ball_annulus *) +let closed_ball_annulus = Sections.section_proof [] +`closed ball_annulus` +[ + (((((use_arg_then2 ("Pack_defs.ball_annulus", [Pack_defs.ball_annulus]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CLOSED_DIFF", [CLOSED_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("OPEN_BALL", [OPEN_BALL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CLOSED_CBALL", [CLOSED_CBALL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma finite_packing_ball_annulus *) +let finite_packing_ball_annulus = Sections.section_proof ["V"] +`packing V /\ V SUBSET ball_annulus ==> FINITE V` +[ + (BETA_TAC THEN (case THEN ((move ["pack"]) THEN (move ["subV"])))); + ((fun arg_tac -> arg_tac (Arg_term (`?r. V SUBSET ball(vec 0, r)`))) (term_tac (have_gen_tac [](case THEN (move ["r"]))))); + (((fun arg_tac -> arg_tac (Arg_term (`&5`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("subV", [])) (disch_tac [])) THEN (clear_assumption "subV") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Pack_defs.ball_annulus", [Pack_defs.ball_annulus]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_CBALL", [IN_CBALL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_BALL", [IN_BALL]))(thm_tac (new_rewrite [] []))))))); + ((BETA_TAC THEN (move ["h"]) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("h", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("Pack_defs.h0", [Pack_defs.h0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("SUBSET_INTER_ABSORPTION", [SUBSET_INTER_ABSORPTION]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))); + (((use_arg_then2 ("Packing3.KIUMVTC", [Packing3.KIUMVTC])) (disch_tac [])) THEN (clear_assumption "Packing3.KIUMVTC") THEN (exact_tac)); +];; + +(* Lemma ECTC_sub_ESTD *) +let ECTC_sub_ESTD = Sections.section_proof ["V"] +`ECTC V SUBSET ESTD V` +[ + (((((use_arg_then2 ("ECTC", [ECTC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ESTD", [ESTD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["x"]) THEN (case THEN (move ["v"])) THEN (case THEN (move ["w"])) THEN (case THEN (move ["h"])) THEN (move ["x_eq"])); + ((((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("w", [])) (term_tac exists_tac))) THEN ((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Sphere.h0", [Sphere.h0]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma in_set_of_edge_ECTC *) +let in_set_of_edge_ECTC = Sections.section_proof ["V";"v"] +`v IN V ==> (!u. u IN set_of_edge v V (ECTC V) <=> u IN V /\ dist (u, v) = &2)` +[ + (((((use_arg_then2 ("set_of_edge", [set_of_edge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ECTC", [ECTC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["vV"]) THEN (move ["u"])); + ((THENL_ROT (-1)) (((THENL) (split_tac) [((case THEN ALL_TAC) THEN (case THEN (move ["x"])) THEN (case THEN (move ["y"])) THEN (case THEN (move ["h"])) THEN (move ["eq"]) THEN (move ["uV"])); (case THEN ((move ["uV"]) THEN (move ["d_eq"])))]) THEN ((((use_arg_then2 ("uV", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac ->(use_arg_then2 ("andTb", [andTb]))(fun tmp_arg1 -> (use_arg_then2 ("andbT", [andbT]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))))); + ((THENL_LAST) ((((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("u", [])) (term_tac exists_tac))) THEN (repeat_tactic 1 9 (((split_tac) THEN ((TRY done_tac)))))) ((((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("d_eq", [])) (disch_tac [])) THEN (clear_assumption "d_eq") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("DIST_REFL", [DIST_REFL]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + (in_tac ["eq"] false (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Collect_geom.PAIR_EQ_EXPAND)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC THEN (case THEN ALL_TAC) THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma vector_eq_neg *) +let vector_eq_neg = Sections.section_proof ["v"] +`(v:real^N = --v) <=> (v = vec 0)` +[ + (VECTOR_ARITH_TAC); +];; + +(* Lemma bij_scriptL *) +let bij_scriptL = Sections.section_proof ["f";"V";"W"] +`BIJ f V W /\ (!v. v IN V ==> norm v = norm (f v)) ==> + scriptL W = scriptL V` +[ + (((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (case THEN ((case THEN ((move ["_"]) THEN (move ["inj_f"]))) THEN (move ["surj_f"])))) THEN (move ["norm_eq"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("Tame_defs.scriptL", [Tame_defs.scriptL]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("Hypermap_iso.surj_image", [Hypermap_iso.surj_image])) (fun fst_arg -> (use_arg_then2 ("surj_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_IMAGE", [SUM_IMAGE]))(thm_tac (new_rewrite [] []))))); + ((BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN (move ["x_in"])) THEN (case THEN (move ["y_in"])) THEN (move ["f_eq"])) THEN (((use_arg_then2 ("inj_f", [])) (disch_tac [])) THEN (clear_assumption "inj_f") THEN (DISCH_THEN apply_tac)) THEN (done_tac)); + ((((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["v"]) THEN (move ["v_in"]) THEN (simp_tac)) THEN ((((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("norm_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma lmfun_ge0 *) +let lmfun_ge0 = Sections.section_proof ["h"] +`&0 <= lmfun h` +[ + (((((use_arg_then2 ("Sphere.lmfun", [Sphere.lmfun]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Sphere.h0", [Sphere.h0]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma lmfun_in_ball_annulus *) +let lmfun_in_ball_annulus = Sections.section_proof ["v"] +`v IN ball_annulus ==> lmfun (norm v / &2) <= &1` +[ + (((((use_arg_then2 ("in_ball_annulus", [in_ball_annulus]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Sphere.lmfun", [Sphere.lmfun]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Sphere.h0", [Sphere.h0]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma scriptL_le_card *) +let scriptL_le_card = Sections.section_proof ["V"] +`packing V /\ V SUBSET ball_annulus ==> scriptL V <= &(CARD V)` +[ + ((BETA_TAC THEN (case THEN ((move ["packV"]) THEN (move ["subV"])))) THEN (((fun arg_tac -> (use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&(CARD V)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("Tame_defs.scriptL", [Tame_defs.scriptL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_BOUND", [SUM_BOUND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("finite_packing_ball_annulus", [finite_packing_ball_annulus]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["v"]) THEN (move ["vV"]) THEN (simp_tac)); + ((((use_arg_then2 ("lmfun_in_ball_annulus", [lmfun_in_ball_annulus]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subV", [])) (disch_tac [])) THEN (clear_assumption "subV") THEN BETA_TAC) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN (done_tac)); +];; + +(* Lemma card_counterexample_ge13 *) +let card_counterexample_ge13 = Sections.section_proof ["V"] +`packing V /\ V SUBSET ball_annulus /\ scriptL V > &12 + ==> 13 <= CARD V` +[ + (BETA_TAC THEN (case THEN (move ["packV"])) THEN (case THEN (move ["subV"]))); + ((((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("NOT_LE", [NOT_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NOT_LT", [REAL_NOT_LT]))(thm_tac (new_rewrite [] []))))) THEN (move ["card_lt"]))); + ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`&(CARD V)`))) (term_tac exists_tac))); + (((((use_arg_then2 ("scriptL_le_card", [scriptL_le_card]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OF_NUM_LE", [REAL_OF_NUM_LE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_lt", [])) (disch_tac [])) THEN (clear_assumption "card_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma piecewise_real_continuous *) +let piecewise_real_continuous = Sections.section_proof ["a";"b";"t";"f1";"f2";"f"] +`f1 real_continuous_on (real_interval [a,t]) /\ f2 real_continuous_on (real_interval [t,b]) /\ + f1 t = f2 t /\ f = (\x. if x <= t then f1 x else f2 x) ==> + f real_continuous_on (real_interval [a,b])` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("real_continuous_on", [real_continuous_on]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["f1_cont"])) THEN (case THEN (move ["f2_cont"])) THEN (case THEN (move ["f12_eq"])) THEN (move ["f_eq"]) THEN (move ["x"]) THEN (move ["e"]) THEN (case THEN ((move ["x_in"]) THEN (move ["e_gt0"])))); + ((THENL) (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `x < t \/ t < x \/ x = t`))) (disch_tac [])) THEN case) [(move ["h"]); ALL_TAC]); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f1_cont", [])) (fun fst_arg -> (use_arg_then2 ("e_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("x_in", []))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))) THEN ALL_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d_gt0"])) THEN (move ["ineq"]))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`min d (t - x)`))) (term_tac exists_tac)) THEN (split_tac)) ((((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN ((use_arg_then2 ("d_gt0", [])) (disch_tac [])) THEN (clear_assumption "d_gt0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["y_ineq"]) THEN (move ["xy_lt"])))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`y < t`))) (term_tac (have_gen_tac [](move ["y_lt"])))) ((((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN ((use_arg_then2 ("xy_lt", [])) (disch_tac [])) THEN (clear_assumption "xy_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("xy_lt", [])) (disch_tac [])) THEN (clear_assumption "xy_lt") THEN ((use_arg_then2 ("y_lt", [])) (disch_tac [])) THEN (clear_assumption "y_lt") THEN ((use_arg_then2 ("y_ineq", [])) (disch_tac [])) THEN (clear_assumption "y_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (case THEN (move ["h"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f2_cont", [])) (fun fst_arg -> (use_arg_then2 ("e_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("x_in", []))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))) THEN ALL_TAC THEN (case THEN (move ["d"])) THEN (case THEN (move ["d_gt0"])) THEN (move ["ineq"]))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`min d (x - t)`))) (term_tac exists_tac)) THEN (split_tac)) ((((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN ((use_arg_then2 ("d_gt0", [])) (disch_tac [])) THEN (clear_assumption "d_gt0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["y_ineq"]) THEN (move ["xy_lt"])))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`t < y`))) (term_tac (have_gen_tac [](move ["y_lt"])))) ((((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN ((use_arg_then2 ("xy_lt", [])) (disch_tac [])) THEN (clear_assumption "xy_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_NOT_LT", [REAL_NOT_LT]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("y_lt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("xy_lt", [])) (disch_tac [])) THEN (clear_assumption "xy_lt") THEN ((use_arg_then2 ("y_lt", [])) (disch_tac [])) THEN (clear_assumption "y_lt") THEN ((use_arg_then2 ("y_ineq", [])) (disch_tac [])) THEN (clear_assumption "y_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f2_cont", [])) (fun fst_arg -> (use_arg_then2 ("t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("f1_cont", [])) (fun fst_arg -> (use_arg_then2 ("t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("h", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("x_in", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + (BETA_TAC THEN (case THEN (move ["d1"])) THEN (case THEN (move ["d1_gt0"])) THEN (move ["ineq1"]) THEN (case THEN (move ["d2"])) THEN (case THEN (move ["d2_gt0"])) THEN (move ["ineq2"])); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`min d1 d2`))) (term_tac exists_tac)) THEN (split_tac)) ((((use_arg_then2 ("d2_gt0", [])) (disch_tac [])) THEN (clear_assumption "d2_gt0") THEN ((use_arg_then2 ("d1_gt0", [])) (disch_tac [])) THEN (clear_assumption "d1_gt0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (BETA_TAC THEN (move ["y"]) THEN (case THEN ((move ["y_ineq"]) THEN (move ["xy_lt"])))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_LET_TOTAL", [REAL_LET_TOTAL])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["xy_ineq"])); + (((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("h", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xy_ineq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("ineq1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xy_ineq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_ineq", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("xy_lt", [])) (disch_tac [])) THEN (clear_assumption "xy_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("h", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NOT_LT", [REAL_NOT_LT]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("xy_ineq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f12_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("ineq2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xy_lt", [])) (disch_tac [])) THEN (clear_assumption "xy_lt") THEN ((use_arg_then2 ("y_ineq", [])) (disch_tac [])) THEN (clear_assumption "y_ineq") THEN ((use_arg_then2 ("xy_ineq", [])) (disch_tac [])) THEN (clear_assumption "xy_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma piecewise_real_continuous_univ *) +let piecewise_real_continuous_univ = Sections.section_proof ["t";"f1";"f2";"f"] +`f1 real_continuous_on UNIV /\ f2 real_continuous_on UNIV /\ f1 t = f2 t /\ + f = (\x. if x <= t then f1 x else f2 x) ==> + f real_continuous_on UNIV` +[ + (BETA_TAC THEN (case THEN (move ["f1_cont"])) THEN (case THEN (move ["f2_con"])) THEN (case THEN (move ["f12_eq"])) THEN (move ["f_eq"])); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`!a b. f real_continuous_on real_interval (a,b)`))) (term_tac (have_gen_tac [](move ["cont_int"]))))); + (((((use_arg_then2 ("REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT", [REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_OPEN_UNIV", [REAL_OPEN_UNIV]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["x"]) THEN (move ["_"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("cont_int", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x - &1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x + &1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((((use_arg_then2 ("REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT", [REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_OPEN_REAL_INTERVAL", [REAL_OPEN_REAL_INTERVAL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("IN_REAL_INTERVAL", [IN_REAL_INTERVAL]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((BETA_TAC THEN (move ["a"]) THEN (move ["b"])) THEN (((use_arg_then2 ("REAL_CONTINUOUS_ON_SUBSET", [REAL_CONTINUOUS_ON_SUBSET])) (disch_tac [])) THEN (clear_assumption "REAL_CONTINUOUS_ON_SUBSET") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`real_interval [a,b]`))) (term_tac exists_tac))); + ((((use_arg_then2 ("REAL_INTERVAL_OPEN_SUBSET_CLOSED", [REAL_INTERVAL_OPEN_SUBSET_CLOSED]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("piecewise_real_continuous", [piecewise_real_continuous])) (fun fst_arg -> (use_arg_then2 ("f_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f12_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((split_tac) THEN ((((fun arg_tac -> (use_arg_then2 ("REAL_CONTINUOUS_ON_SUBSET", [REAL_CONTINUOUS_ON_SUBSET])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(:real)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET_UNIV", [SUBSET_UNIV]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma lmfun_continuous *) +let lmfun_continuous = Sections.section_proof [] +`lmfun real_continuous_on UNIV` +[ + ((fun arg_tac -> arg_tac (Arg_term (`lmfun = (\x. if x <= h0 then (h0 - x) / (h0 - &1) else &0)`))) (term_tac (have_gen_tac [](move ["eq"])))); + (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Sphere.lmfun", [Sphere.lmfun]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_ROT (1)) ((((fun arg_tac -> (use_arg_then2 ("piecewise_real_continuous_univ", [piecewise_real_continuous_univ])) (fun fst_arg -> (use_arg_then2 ("eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (split_tac))); + ((((use_arg_then2 ("REAL_CONTINUOUS_ON_CONST", [REAL_CONTINUOUS_ON_CONST]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_ON_RMUL", [REAL_CONTINUOUS_ON_RMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_ON_SUB", [REAL_CONTINUOUS_ON_SUB]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("REAL_CONTINUOUS_ON_ID", [REAL_CONTINUOUS_ON_ID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_CONTINUOUS_ON_CONST", [REAL_CONTINUOUS_ON_CONST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma lmfun_norm2_continuous *) +let lmfun_norm2_continuous = Sections.section_proof [] +`lift o (\v:real^N. lmfun (norm v / &2)) continuous_on UNIV` +[ + ((((use_arg_then2 ("CONTINUOUS_AT_IMP_CONTINUOUS_ON", [CONTINUOUS_AT_IMP_CONTINUOUS_ON]))(thm_tac (new_rewrite [] [])))) THEN (move ["x"]) THEN (move ["_"])); + (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`(\v. lmfun (norm v / &2)) = lmfun o (\v:real^N. norm v / &2)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("REAL_CONTINUOUS_AT_COMPOSE", [REAL_CONTINUOUS_AT_COMPOSE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_CONTINUOUS_RMUL", [REAL_CONTINUOUS_RMUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_CONTINUOUS_NORM_AT", [REAL_CONTINUOUS_NORM_AT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("REAL_CONTINUOUS_ATREAL_WITHINREAL", [REAL_CONTINUOUS_ATREAL_WITHINREAL]))(thm_tac (new_rewrite [] [])))); + ((((use_arg_then2 ("lmfun_continuous", [lmfun_continuous])) (disch_tac [])) THEN (clear_assumption "lmfun_continuous") THEN BETA_TAC) THEN ((((use_arg_then2 ("REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT", [REAL_CONTINUOUS_ON_EQ_REAL_CONTINUOUS_AT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_OPEN_UNIV", [REAL_OPEN_UNIV]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((DISCH_THEN apply_tac) THEN (((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma simple_card_inequality *) +let simple_card_inequality = Sections.section_proof ["r";"s";"t"] +`measurable s /\ + pairwise DISJOINT t /\ &0 < r /\ + (!x. x IN t ==> measurable x /\ r <= measure x /\ x SUBSET s) ==> + FINITE t /\ &(CARD t) <= floor (measure s / r)` +[ + (BETA_TAC THEN (case THEN (move ["vol_s"])) THEN (case THEN (move ["disjoint"])) THEN (case THEN (move ["r_gt0"])) THEN (move ["in_t"])); + ((fun arg_tac -> arg_tac (Arg_term (`!b. b SUBSET t /\ FINITE b ==> r * &(CARD b) <= measure (UNIONS b)`))) (term_tac (have_gen_tac [](move ["ineq"])))); + ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["b"]) THEN (case THEN ((move ["b_sub"]) THEN (move ["fin_b"])))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("HAS_MEASURE_DISJOINT_UNIONS", [HAS_MEASURE_DISJOINT_UNIONS])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`\x. measure x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fin_b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((repeat_tactic 1 9 (((use_arg_then2 ("HAS_MEASURE_MEASURABLE_MEASURE", [HAS_MEASURE_MEASURABLE_MEASURE]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((THENL) (split_tac) [((move ["y"]) THEN (move ["yb"])); ((move ["x"]) THEN (move ["y"]) THEN (move ["in_b"]))]) (((((use_arg_then2 ("in_t", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("b_sub", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("disjoint", [])) (disch_tac [])) THEN (clear_assumption "disjoint") THEN BETA_TAC) THEN (((use_arg_then2 ("pairwise", [pairwise]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN ((((use_arg_then2 ("in_b", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("b_sub", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("CARD_EQ_SUM", [CARD_EQ_SUM]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SUM_LMUL", [SUM_LMUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_LE", [SUM_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fin_b", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("b_sub", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["xt"]) THEN (simp_tac)); + (((((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_t", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!b. b SUBSET t /\ FINITE b ==> measure (UNIONS b) <= measure s`))) (term_tac (have_gen_tac [](move ["ineq2"])))); + ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["b"]) THEN (case THEN ((move ["b_sub"]) THEN (move ["fin_b"])))); + ((((use_arg_then2 ("MEASURE_SUBSET", [MEASURE_SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vol_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEASURABLE_UNIONS", [MEASURABLE_UNIONS]))(thm_tac (new_rewrite [] []))))); + ((((((use_arg_then2 ("fin_b", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("b_sub", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["xt"])) THEN (((use_arg_then2 ("in_t", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((((use_arg_then2 ("UNIONS_SUBSET", [UNIONS_SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("b_sub", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["xt"])) THEN (((use_arg_then2 ("in_t", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`FINITE t`))) (term_tac (have_gen_tac [](move ["fin_t"])))); + (((use_arg_then2 ("contraT", [contraT])) (disch_tac [])) THEN (clear_assumption "contraT") THEN (DISCH_THEN apply_tac) THEN (move ["inf_t"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_ARCH", [REAL_ARCH])) (fun fst_arg -> (use_arg_then2 ("r_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`measure s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["n"])) THEN (move ["ineq3"])); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("CHOOSE_SUBSET_STRONG", [CHOOSE_SUBSET_STRONG])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("inf_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] []))))) THEN (ANTS_TAC)) ((ALL_TAC) THEN (done_tac))); + (BETA_TAC THEN (case THEN (move ["b"])) THEN (case THEN (move ["b_sub"])) THEN (case THEN ((move ["fin_b"]) THEN (move ["card_b"])))); + (((use_arg_then2 ("ineq3", [])) (disch_tac [])) THEN (clear_assumption "ineq3") THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq2", [])) (fun fst_arg -> (use_arg_then2 ("b_sub", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fin_b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (use_arg_then2 ("b_sub", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fin_b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((use_arg_then2 ("card_b", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("fin_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq2", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("SUBSET_REFL", [SUBSET_REFL])) (fun fst_arg -> (use_arg_then2 ("t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fin_t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("SUBSET_REFL", [SUBSET_REFL])) (fun fst_arg -> (use_arg_then2 ("t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fin_t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["h"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("h", [])) (thm_tac (match_mp_then snd_th MP_TAC))))); + ((((((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_RDIV_EQ", [REAL_LE_RDIV_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("FLOOR_MONO", [FLOOR_MONO])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("FLOOR_NUM", [FLOOR_NUM]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma card_packing_ball_annulus *) +let card_packing_ball_annulus = Sections.section_proof ["V"] +`packing V /\ V SUBSET ball_annulus ==> CARD V <= 43` +[ + (BETA_TAC THEN (case THEN ((move ["pack"]) THEN (move ["subV"])))); + ((fun arg_tac -> arg_tac (Arg_term (`IMAGE (\v. ball (v, &1)) V`))) (term_tac (set_tac "t"))); + (((fun arg_tac -> (use_arg_then2 ("CARD_IMAGE_INJ", [CARD_IMAGE_INJ])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`\v. ball (v,&1)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("finite_packing_ball_annulus", [finite_packing_ball_annulus]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN (move ["xV"])) THEN (case THEN (move ["yV"])) THEN (simp_tac) THEN (move ["ball_eq"])); + ((in_tac ["pack"] false (((use_arg_then2 ("Sphere.packing_lt", [Sphere.packing_lt]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("pack", [])) (disch_tac [])) THEN (clear_assumption "pack") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("yV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xV", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))))); + ((((fun arg_tac -> (use_arg_then2 ("ball_eq", [])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("CENTRE_IN_BALL", [CENTRE_IN_BALL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_01", [REAL_LT_01]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("IN_BALL", [IN_BALL]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + (((use_arg_then2 ("REAL_OF_NUM_LE", [REAL_OF_NUM_LE]))(gsym_then (thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`&43 = floor (measure (ball (vec 0:real^3, #3.52)) / measure (ball (vec 0:real^3, &1)))`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("VOLUME_BALL", [VOLUME_BALL]))(thm_tac (new_rewrite [] []))))) THEN (TRY ((arith_tac)))); + ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`_ * pi`))) (term_tac (set_tac "a")))); + ((((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_INV_MUL", [REAL_INV_MUL]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!x y. (a * x) * inv a * y = (a * inv a) * x * y`)))(thm_tac (new_rewrite [] [])))); + ((THENL_FIRST) (((use_arg_then2 ("REAL_MUL_RINV", [REAL_MUL_RINV]))(thm_tac (new_rewrite [] [])))) ((((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("PI_POS", [PI_POS])) (disch_tac [])) THEN (clear_assumption "PI_POS") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FLOOR_UNIQUE", [FLOOR_UNIQUE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("INTEGER_CLOSED", [INTEGER_CLOSED]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then2 ("simple_card_inequality", [simple_card_inequality]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEASURABLE_BALL", [MEASURABLE_BALL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + (((((use_arg_then2 ("pairwise", [pairwise]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("DISJOINT", [DISJOINT]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["u"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["uV"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["v"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["vV"])); + ((((use_arg_then2 ("contraR", [contraR])) (disch_tac [])) THEN (clear_assumption "contraR") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_BALL", [IN_BALL]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN ((move ["du"]) THEN (move ["dv"]))))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`u = v`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((ALL_TAC) THEN (done_tac))); + ((in_tac ["pack"] false (((use_arg_then2 ("Sphere.packing_lt", [Sphere.packing_lt]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("pack", [])) (disch_tac [])) THEN (clear_assumption "pack") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("uV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vV", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DIST_TRIANGLE", [DIST_TRIANGLE])) (fun fst_arg -> (use_arg_then2 ("u", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dv", [])) (disch_tac [])) THEN (clear_assumption "dv") THEN ((use_arg_then2 ("du", [])) (disch_tac [])) THEN (clear_assumption "du") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) (split_tac) ((((use_arg_then2 ("VOLUME_BALL", [VOLUME_BALL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PI_POS", [PI_POS])) (disch_tac [])) THEN (clear_assumption "PI_POS") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"]) THEN (case THEN (move ["v"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["vV"])); + (((((use_arg_then2 ("MEASURABLE_BALL", [MEASURABLE_BALL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("VOLUME_BALL", [VOLUME_BALL]))(thm_tac (new_rewrite [] [])))))) THEN (TRY ((arith_tac)))); + (((((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_BALL", [IN_BALL]))(thm_tac (new_rewrite [] [])))))) THEN (move ["x"])); + (in_tac ["subV"] false ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Pack_defs.ball_annulus", [Pack_defs.ball_annulus]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_CBALL", [IN_CBALL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Sphere.h0", [Sphere.h0]))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("subV", [])) (fun fst_arg -> (use_arg_then2 ("vV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DIST_TRIANGLE", [DIST_TRIANGLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma SIN_NEG_PI_2PI *) +let SIN_NEG_PI_2PI = Sections.section_proof ["x"] +`pi <= x /\ x <= &2 * pi ==> sin x <= &0` +[ + (BETA_TAC THEN (move ["x_ineq"])); + ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `x = (x - pi) + pi`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SIN_PERIODIC_PI", [SIN_PERIODIC_PI]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NEG_LE0", [REAL_NEG_LE0]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("SIN_POS_PI_LE", [SIN_POS_PI_LE])) (disch_tac [])) THEN (clear_assumption "SIN_POS_PI_LE") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma not_surrounded_imp_on_one_side_of_plane *) +let not_surrounded_imp_on_one_side_of_plane = Sections.section_proof ["V";"E";"v"] +`FAN (vec 0,V,E) ==> v IN V ==> ~(set_of_edge v V E = {}) ==> ~(surrounded_node (V,E) v) ==> + ?n. ~(n = vec 0) /\ v dot n = &0 /\ (!w. w IN set_of_edge v V E ==> w dot n <= &0)` +[ + ((((use_arg_then2 ("surrounded_node", [surrounded_node]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_FORALL_THM", [NOT_FORALL_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IMP", [NOT_IMP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NOT_LT", [REAL_NOT_LT]))(thm_tac (new_rewrite [] []))))); + ((BETA_TAC THEN (move ["fan"]) THEN (move ["vV"]) THEN (move ["not_isolated"]) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["v1"]) THEN (move ["w"]))) THEN (simp_tac) THEN (case THEN ((case THEN (move ["in_vw"])) THEN (move ["v1_eq"]) THEN (move ["ge_pi"])))) THEN (in_tac ["ge_pi"; "in_vw"] false (((use_arg_then2 ("v1_eq", []))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart1_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["in1_vw"])))); + ((((use_arg_then2 ("in_vw", [])) (disch_tac [])) THEN (clear_assumption "in_vw") THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1_of_fan", [dart1_of_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart_of_fan", [dart_of_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_PAIR_THM", [IN_ELIM_PAIR_THM]))(thm_tac (new_rewrite [] []))))) THEN (case THEN ((TRY done_tac)))); + ((((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["v'"])) THEN (case THEN (move ["h1"]))) THEN ((((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (move ["eq"]))); + ((((use_arg_then2 ("h1", [])) (disch_tac [])) THEN (clear_assumption "h1") THEN BETA_TAC) THEN ((((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("not_isolated", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`v cross w`))) (term_tac exists_tac)); + (((((use_arg_then2 ("DOT_CROSS_SELF", [DOT_CROSS_SELF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CROSS_EQ_0", [CROSS_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)); + ((((fun arg_tac -> (use_arg_then2 ("Hypermap_and_fan.DART1_NOT_COLLINEAR", [Hypermap_and_fan.DART1_NOT_COLLINEAR])) (fun fst_arg -> (use_arg_then2 ("fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (done_tac)); + (BETA_TAC THEN (move ["w2"]) THEN (move ["in_w2"])); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`sin (azim (vec 0) v w w2) <= &0`))) (term_tac (have_gen_tac [](move ["sin_le0"]))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Trigonometry.JBDNJJB", [Trigonometry.JBDNJJB])) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("Trigonometry2.re_eqvl", [Trigonometry2.re_eqvl]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["t_gt0"]))); + ((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("f_equal", [f_equal])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`real_mul (inv t)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC); + ((THENL_FIRST) ((((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LINV", [REAL_MUL_LINV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] [])))))) ((((use_arg_then2 ("t_gt0", [])) (disch_tac [])) THEN (clear_assumption "t_gt0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("DOT_SYM", [DOT_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("REAL_LE_NEG", [REAL_LE_NEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_NEG_0", [REAL_NEG_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NEG_RMUL", [REAL_NEG_RMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_MUL", [REAL_LE_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NEG_GE0", [REAL_NEG_GE0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sin_le0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("REAL_LE_INV", [REAL_LE_INV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("t_gt0", [])) (disch_tac [])) THEN (clear_assumption "t_gt0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`w = w2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))); (move ["n_ww2"])]); + (((((use_arg_then2 ("AZIM_REFL", [AZIM_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SIN_0", [SIN_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_LAST) ((((use_arg_then2 ("SIN_NEG_PI_2PI", [SIN_NEG_PI_2PI])) (disch_tac [])) THEN (clear_assumption "SIN_NEG_PI_2PI") THEN (DISCH_THEN apply_tac)) THEN (split_tac)) (((((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("azim", [azim]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (fun fst_arg -> (use_arg_then2 ("ge_pi", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("real_ge", [real_ge]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> (use_arg_then2 ("Fatugpd.azim_ge_azim_dart", [Fatugpd.azim_ge_azim_dart])) (fun fst_arg -> (use_arg_then2 ("fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Hypermap_and_fan.PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ", [Hypermap_and_fan.PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ])) (fun fst_arg -> (use_arg_then2 ("fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("in1_vw", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_ww2", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("vV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_w2", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Hypermap_and_fan.PAIR_IN_DART1_OF_FAN", [Hypermap_and_fan.PAIR_IN_DART1_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("in1_vw", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma perturbation_lemma *) +let perturbation_lemma = Sections.section_proof ["d";"S";"v";"n"] +`&0 < d /\ ~(n = vec 0) /\ v dot n = &0 /\ (!w. w IN S ==> w dot n <= &0 /\ &0 < w dot v) ==> + ?v2. norm v2 = norm v /\ (!w. w IN S ==> dist (v, w) < dist (v2, w)) /\ dist (v, v2) < d` +[ + (BETA_TAC THEN (case THEN (move ["d_gt0"])) THEN (case THEN (move ["n_n0"])) THEN (case THEN (move ["vn0"])) THEN (move ["w_dot"])); + ((THENL) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`S = {}`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (move ["nS"])]); + (((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("DIST_REFL", [DIST_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_gt0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`~(v = vec 0)`))) (term_tac (have_gen_tac [](move ["v_n0"])))); + ((((use_arg_then2 ("nS", [])) (disch_tac [])) THEN (clear_assumption "nS") THEN BETA_TAC) THEN ((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (move ["xS"]))); + (((fun arg_tac -> (use_arg_then2 ("w_dot", [])) (fun fst_arg -> (use_arg_then2 ("xS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["_"]))); + ((((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("DOT_RZERO", [DOT_RZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_REFL", [REAL_LT_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`max (&0) (&1 - (d * d) / (&4 * (v dot v)))`))) (term_tac (set_tac "a"))); + ((fun arg_tac -> arg_tac (Arg_term (`sqrt ((v dot v) * (&1 - a * a) / (n dot n))`))) (term_tac (set_tac "b"))); + ((fun arg_tac -> arg_tac (Arg_term (`&0 <= a /\ a < &1`))) (term_tac (have_gen_tac [](move ["a_ineq"])))); + ((((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MAX_MAX", [REAL_MAX_MAX]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MAX_LT", [REAL_MAX_LT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_01", [REAL_LT_01]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!x. &1 - x < &1 <=> &0 < x`)))(thm_tac (new_rewrite [] [])))); + (((((use_arg_then2 ("REAL_LT_DIV", [REAL_LT_DIV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LT_MUL", [REAL_LT_MUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("d_gt0", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("DOT_POS_LT", [DOT_POS_LT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("v_n0", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`a % v + b % n`))) (term_tac exists_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`&0 <= (v dot v) * (&1 - a * a) / (n dot n)`))) (term_tac (have_gen_tac [](move ["h1"])))); + ((((use_arg_then2 ("REAL_LE_MUL", [REAL_LE_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_DIV", [REAL_LE_DIV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DOT_POS_LE", [DOT_POS_LE]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `&0 <= &1 - a * a <=> a * a <= &1`)))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ABS_SQUARE_LE_1", [ABS_SQUARE_LE_1]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a_ineq", [])) (disch_tac [])) THEN (clear_assumption "a_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`b * b * (n dot n) = (&1 - a * a) * (v dot v)`))) (term_tac (have_gen_tac [](move ["bn_eq"])))); + ((((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("b_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SQRT_POW_2", [SQRT_POW_2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("REAL_MUL_LINV", [REAL_MUL_LINV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DOT_EQ_0", [DOT_EQ_0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("NORM_EQ", [NORM_EQ]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DOT_RADD", [DOT_RADD]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DOT_LADD", [DOT_LADD]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DOT_RMUL", [DOT_RMUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DOT_LMUL", [DOT_LMUL]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("DOT_SYM", [DOT_SYM])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vn0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bn_eq", []))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (split_tac) ((arith_tac) THEN (done_tac))); + ((THENL_ROT (-1)) (split_tac)); + ((((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL NORM_LT_SQUARE)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_gt0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_theorem (VECTOR_ARITH `!v n a b. v - (a % v + b % n) = (&1 - a) % v - b % n`)))(thm_tac (new_rewrite [] [])))); + ((repeat_tactic 1 9 (((use_arg_then2 ("DOT_RSUB", [DOT_RSUB]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DOT_LSUB", [DOT_LSUB]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DOT_RMUL", [DOT_RMUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DOT_LMUL", [DOT_LMUL]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("DOT_SYM", [DOT_SYM])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vn0", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_RZERO", [REAL_MUL_RZERO]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("bn_eq", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("REAL_SUB_RZERO", [REAL_SUB_RZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_SUB_LZERO", [REAL_SUB_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LNEG", [REAL_MUL_LNEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_SUB_RDISTRIB", [REAL_SUB_RDISTRIB]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `(&1 - a) * (&1 - a) - --(&1 - a * a) = &2 * (&1 - a)`)))(thm_tac (new_rewrite [] [])))); + ((THENL_FIRST) ((((use_arg_then2 ("REAL_LT_RDIV_EQ", [REAL_LT_RDIV_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DOT_POS_LT", [DOT_POS_LT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_RDIV_EQ", [REAL_LT_RDIV_EQ]))(gsym_then (thm_tac (new_rewrite [] [])))))) ((arith_tac) THEN (done_tac))); + (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!x. &0 < x /\ &1 - x / &4 <= a ==> &1 - a < x / &2`)))(thm_tac (new_rewrite [] [])))); + ((((use_arg_then2 ("REAL_LT_DIV", [REAL_LT_DIV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_SQUARE", [REAL_LT_SQUARE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DOT_POS_LT", [DOT_POS_LT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("v_n0", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_POS_NZ", [REAL_POS_NZ]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_INV_MUL", [REAL_INV_MUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("real_div", [real_div]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] [(`_ * &4`)])))) THEN (((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MAX_MAX", [REAL_MAX_MAX]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (move ["w"]) THEN (move ["wS"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("NORM_LT", [NORM_LT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DOT_RSUB", [DOT_RSUB]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DOT_LSUB", [DOT_LSUB]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DOT_RADD", [DOT_RADD]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DOT_LADD", [DOT_LADD]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DOT_RMUL", [DOT_RMUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DOT_LMUL", [DOT_LMUL]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("DOT_SYM", [DOT_SYM])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vn0", []))(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_RZERO", [REAL_MUL_RZERO]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_ADD_RID", [REAL_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_LID", [REAL_ADD_LID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bn_eq", []))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`a * a * (v dot v) + (&1 - a * a) * (v dot v) = v dot v`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_NEG_ADD", [REAL_NEG_ADD]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LT_RADD", [REAL_LT_RADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("REAL_LT_LADD", [REAL_LT_LADD]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("DOT_SYM", [DOT_SYM])) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("DOT_SYM", [DOT_SYM])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`!x y. --x + --x < --(a * x) + --(b * y) + --(a * x) + --(b * y) <=> (a - &1) * x < b * --y`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("REAL_LTE_TRANS", [REAL_LTE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LTE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`&0`))) (term_tac exists_tac))); + ((((use_arg_then2 ("REAL_LE_MUL", [REAL_LE_MUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_NEG_GE0", [REAL_NEG_GE0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("w_dot", [])) (fun fst_arg -> (use_arg_then2 ("wS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("b_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SQRT_POS_LE", [SQRT_POS_LE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("REAL_NEG_GT0", [REAL_NEG_GT0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_NEG_LMUL", [REAL_NEG_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_MUL", [REAL_LT_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("w_dot", [])) (fun fst_arg -> (use_arg_then2 ("wS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("a_ineq", [])) (disch_tac [])) THEN (clear_assumption "a_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma COMPACT_SUP_SET *) +let COMPACT_SUP_SET = Sections.section_proof ["f";"s"] +`compact s /\ lift o f continuous_on s + ==> compact {x | x IN s /\ (!y. y IN s ==> f y <= f x)}` +[ + ((fun arg_tac -> arg_tac (Arg_term (`GSPEC _`))) (term_tac (set_tac "c"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`c SUBSET s`))) (term_tac (have_gen_tac [](move ["cs"])))) (((((use_arg_then2 ("c_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("COMPACT_EQ_BOUNDED_CLOSED", [COMPACT_EQ_BOUNDED_CLOSED]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN ((move ["boundedS"]) THEN (move ["closedS"]))) THEN (move ["f_cont"])) THEN (split_tac)); + ((((fun arg_tac -> (use_arg_then2 ("BOUNDED_SUBSET", [BOUNDED_SUBSET])) (fun fst_arg -> (use_arg_then2 ("boundedS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (done_tac)); + (in_tac ["closedS"] true (repeat_tactic 1 9 (((use_arg_then2 ("CLOSED_SEQUENTIAL_LIMITS", [CLOSED_SEQUENTIAL_LIMITS]))(thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ((move ["x_in_c"]) THEN (move ["x_to_y"])))) THEN ((((use_arg_then2 ("c_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`!n. x n IN s`))) (term_tac (have_gen_tac [](move ["x_in_s"])))) ((BETA_TAC THEN (move ["n"])) THEN (((use_arg_then2 ("cs", [])) (disch_tac [])) THEN (clear_assumption "cs") THEN BETA_TAC) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`y IN s`))) (term_tac (have_gen_tac [](move ["ys"])))) ((((fun arg_tac -> (use_arg_then2 ("closedS", [])) (fun fst_arg -> (use_arg_then2 ("x_to_y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (done_tac))); + (((((use_arg_then2 ("ys", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["a"]) THEN (move ["as"])); + ((((use_arg_then2 ("f_cont", [])) (disch_tac [])) THEN (clear_assumption "f_cont") THEN BETA_TAC) THEN ((((use_arg_then2 ("CONTINUOUS_ON_SEQUENTIALLY", [CONTINUOUS_ON_SEQUENTIALLY]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("x_to_y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ys", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x_in_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)))); + (((((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL TENDSTO_REAL)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["lim"])); + (((fun arg_tac -> (use_arg_then2 ("REALLIM_LBOUND", [REALLIM_LBOUND])) (fun fst_arg -> (use_arg_then2 ("lim", [lim])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((((use_arg_then2 ("TRIVIAL_LIMIT_SEQUENTIALLY", [TRIVIAL_LIMIT_SEQUENTIALLY]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALWAYS_EVENTUALLY)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (move ["n"])); + ((((fun arg_tac -> (use_arg_then2 ("x_in_c", [])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("c_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"]))) THEN (DISCH_THEN apply_tac) THEN (done_tac)); +];; + +(* Finalization of the section SomeResults *) +let packing_empty = Sections.finalize_theorem packing_empty;; +let in_ball_annulus = Sections.finalize_theorem in_ball_annulus;; +let closed_ball_annulus = Sections.finalize_theorem closed_ball_annulus;; +let finite_packing_ball_annulus = Sections.finalize_theorem finite_packing_ball_annulus;; +let ECTC_sub_ESTD = Sections.finalize_theorem ECTC_sub_ESTD;; +let in_set_of_edge_ECTC = Sections.finalize_theorem in_set_of_edge_ECTC;; +let vector_eq_neg = Sections.finalize_theorem vector_eq_neg;; +let bij_scriptL = Sections.finalize_theorem bij_scriptL;; +let lmfun_ge0 = Sections.finalize_theorem lmfun_ge0;; +let lmfun_in_ball_annulus = Sections.finalize_theorem lmfun_in_ball_annulus;; +let scriptL_le_card = Sections.finalize_theorem scriptL_le_card;; +let card_counterexample_ge13 = Sections.finalize_theorem card_counterexample_ge13;; +let piecewise_real_continuous = Sections.finalize_theorem piecewise_real_continuous;; +let piecewise_real_continuous_univ = Sections.finalize_theorem piecewise_real_continuous_univ;; +let lmfun_continuous = Sections.finalize_theorem lmfun_continuous;; +let lmfun_norm2_continuous = Sections.finalize_theorem lmfun_norm2_continuous;; +let simple_card_inequality = Sections.finalize_theorem simple_card_inequality;; +let card_packing_ball_annulus = Sections.finalize_theorem card_packing_ball_annulus;; +let SIN_NEG_PI_2PI = Sections.finalize_theorem SIN_NEG_PI_2PI;; +let not_surrounded_imp_on_one_side_of_plane = Sections.finalize_theorem not_surrounded_imp_on_one_side_of_plane;; +let perturbation_lemma = Sections.finalize_theorem perturbation_lemma;; +let COMPACT_SUP_SET = Sections.finalize_theorem COMPACT_SUP_SET;; +Sections.end_section "SomeResults";; + +(* Section VectorOfList *) +Sections.begin_section "VectorOfList";; +let vector_of_list = new_definition `vector_of_list d list = + lambda i. if (i - 1) DIV d < LENGTH list then (EL ((i - 1) DIV d) list)$((i - 1) MOD d + 1) else &0`;; +let list_of_vector = new_definition `list_of_vector d n v = TABLE (\k. lambda i. v$(k * d + i)) n`;; +let LAMBDA_BETA = GEN_ALL LAMBDA_BETA;; + +(* Lemma vector_of_list_nil *) +let vector_of_list_nil = Sections.section_proof ["d"] +`vector_of_list d [] = vec 0` +[ + ((((((use_arg_then2 ("vector_of_list", [vector_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LAMBDA_UNIQUE", [LAMBDA_UNIQUE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("vec", [vec]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_ineq"])) THEN ((((use_arg_then2 ("LAMBDA_BETA", [LAMBDA_BETA]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)))); + ((((use_arg_then2 ("LENGTH", [LENGTH]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma length_list_of_vector *) +let length_list_of_vector = Sections.section_proof ["d";"n";"v"] +`LENGTH (list_of_vector d n v) = n` +[ + (((((use_arg_then2 ("list_of_vector", [list_of_vector]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Packing3.LENGTH_TABLE", [Packing3.LENGTH_TABLE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sum_lemma *) +let sum_lemma = Sections.section_proof ["n";"k";"f"] +`sum (1..k * n) f = sum (1..n) (\j. sum (1..k) (\i. f ((j - 1) * k + i)))` +[ + ((THENL_FIRST) (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IH"]))]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("muln0", [muln0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL SUM_CLAUSES_NUMSEG)))(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `1 <= SUC n`)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("mulnSr", [mulnSr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_ADD_SPLIT", [SUM_ADD_SPLIT]))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("REAL_EQ_ADD_LCANCEL", [REAL_EQ_ADD_LCANCEL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("addnC", [addnC])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`k * n:num`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_OFFSET", [SUM_OFFSET]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["i"])) THEN ((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mulnC", [mulnC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(Sections.add_section_var (mk_var ("d", (`:num`))));; +(Sections.add_section_var (mk_var ("list", (`:(real^N)list`))));; +(Sections.add_section_hyp "d_eq" (`dimindex (:N) = d`));; +(Sections.add_section_hyp "dim_ge" (`d * LENGTH list <= dimindex (:M)`));; + +(* Lemma vector_of_list_comp0 *) +let vector_of_list_comp0 = Sections.section_proof ["i"] +`d * LENGTH list + 1 <= i /\ i <= dimindex (:M) ==> + (vector_of_list d list:real^M)$i = &0` +[ + (BETA_TAC THEN (move ["i_ineqs"])); + ((THENL_FIRST) ((((use_arg_then2 ("vector_of_list", [vector_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LAMBDA_BETA", [LAMBDA_BETA]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) ((((use_arg_then2 ("i_ineqs", [])) (disch_tac [])) THEN (clear_assumption "i_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`~((i - 1) DIV d < LENGTH list)`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))))))); + ((fun arg_tac -> arg_tac (Arg_term (`~(d = 0)`))) (term_tac (have_gen_tac [](move ["dn0"])))); + ((((fun arg_tac -> (use_arg_then2 ("DIMINDEX_GE_1", [DIMINDEX_GE_1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(:N)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("d_eq", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then2 ("NOT_LT", [NOT_LT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("DIV_MULT", [DIV_MULT])) (fun fst_arg -> (use_arg_then2 ("dn0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("DIV_MONO", [DIV_MONO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dn0", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("i_ineqs", [])) (disch_tac [])) THEN (clear_assumption "i_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma vector_of_list_comp *) +let vector_of_list_comp = Sections.section_proof ["k";"i"] +`(1 <= i /\ i <= d) /\ k < LENGTH list ==> + (vector_of_list d list:real^M)$(k * d + i) = (EL k list)$i` +[ + (BETA_TAC THEN (case THEN (move ["i_ineq"])) THEN (move ["k_lt"])); + ((((use_arg_then2 ("vector_of_list", [vector_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LAMBDA_BETA", [LAMBDA_BETA]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((THENL_FIRST) (split_tac) ((((use_arg_then2 ("i_ineq", [])) (disch_tac [])) THEN (clear_assumption "i_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("LE_TRANS", [LE_TRANS])) (disch_tac [])) THEN (clear_assumption "LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`d * LENGTH list`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("dim_ge", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("LE_TRANS", [LE_TRANS])) (disch_tac [])) THEN (clear_assumption "LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`k * d + d:num`))) (term_tac exists_tac))); + ((((use_arg_then2 ("LE_ADD_LCANCEL", [LE_ADD_LCANCEL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_ineq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `k * d + d = d * SUC k`)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("LE_MULT_LCANCEL", [LE_MULT_LCANCEL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DIVMOD_UNIQ", [DIVMOD_UNIQ])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(k * d + i) - 1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i - 1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["div_mod"]))); + (((repeat_tactic 1 9 (((use_arg_then2 ("div_mod", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("k_lt", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (TRY (((((use_arg_then2 ("i_ineq", [])) (disch_tac [])) THEN (clear_assumption "i_ineq") THEN BETA_TAC) THEN (arith_tac))))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`i - 1 + 1 = i`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((ALL_TAC) THEN (done_tac))); + ((((use_arg_then2 ("i_ineq", [])) (disch_tac [])) THEN (clear_assumption "i_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma vector_of_list_left_inverse *) +let vector_of_list_left_inverse = Sections.section_proof [] +`list_of_vector d (LENGTH list) ((vector_of_list d list):real^M) = list` +[ + (((((use_arg_then2 ("Packing3.LIST_EL_EQ", [Packing3.LIST_EL_EQ]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("list_of_vector", [list_of_vector]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Packing3.LENGTH_TABLE", [Packing3.LENGTH_TABLE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["k"]) THEN (move ["k_lt"])); + (((((use_arg_then2 ("Packing3.EL_TABLE", [Packing3.EL_TABLE]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("LAMBDA_UNIQUE", [LAMBDA_UNIQUE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("d_eq", []))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_ineq"])); + ((((use_arg_then2 ("vector_of_list_comp", [vector_of_list_comp]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma dot_vector_of_list *) +let dot_vector_of_list = Sections.section_proof [] +`(vector_of_list d list:real^M) dot (vector_of_list d list) = + sum (1..LENGTH list) (\i. (EL (i - 1) list) dot (EL (i - 1) list))` +[ + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(d = 0)`))) (term_tac (have_gen_tac [](move ["d_n0"])))) ((((fun arg_tac -> (use_arg_then2 ("DIMINDEX_GE_1", [DIMINDEX_GE_1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(:N)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("d_eq", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`LENGTH list <= dimindex (:M)`))) (term_tac (have_gen_tac [](move ["len_le"])))); + ((((use_arg_then2 ("LE_TRANS", [LE_TRANS])) (disch_tac [])) THEN (clear_assumption "LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`d * LENGTH list`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("dim_ge", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + (((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `!a. a = 1 * a`)))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("LE_MULT_RCANCEL", [LE_MULT_RCANCEL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d_n0", [])) (disch_tac [])) THEN (clear_assumption "d_n0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("dot", [dot]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("subnKC", [subnKC])) (fun fst_arg -> (use_arg_then2 ("dim_ge", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_ADD_SPLIT", [SUM_ADD_SPLIT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("LE_ADDR", [LE_ADDR]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((use_arg_then2 ("REAL_ADD_RID", [REAL_ADD_RID]))(gsym_then (thm_tac (new_rewrite [] [(`sum (1..LENGTH list) _`)]))))); + ((THENL_ROT (-1)) (congr_tac (`_1 + _2:real`))); + (((use_arg_then2 ("SUM_EQ_0_NUMSEG", [SUM_EQ_0_NUMSEG])) (thm_tac apply_tac)) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac)); + ((THENL_FIRST) ((((use_arg_then2 ("vector_of_list", [vector_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LAMBDA_BETA", [LAMBDA_BETA]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) ((((use_arg_then2 ("i_ineq", [])) (disch_tac [])) THEN (clear_assumption "i_ineq") THEN ((use_arg_then2 ("dim_ge", [])) (disch_tac [])) THEN (clear_assumption "dim_ge") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`~((i - 1) DIV d < LENGTH list)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) (((simp_tac) THEN (((use_arg_then2 ("REAL_MUL_LZERO", [REAL_MUL_LZERO]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("NOT_LT", [NOT_LT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LE_RDIV_EQ", [LE_RDIV_EQ]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("i_ineq", [])) (disch_tac [])) THEN (clear_assumption "i_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then2 ("sum_lemma", [sum_lemma]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_eq", []))(thm_tac (new_rewrite [] []))))) THEN (move ["k"]) THEN (move ["k_ineq"]) THEN (simp_tac))); + ((((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["i"])) THEN ((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (move ["i_ineq"]) THEN (simp_tac))); + (((((use_arg_then2 ("vector_of_list_comp", [vector_of_list_comp]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("i_ineq", []))(thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("k_ineq", [])) (disch_tac [])) THEN (clear_assumption "k_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma vector_of_list_norm_bound *) +let vector_of_list_norm_bound = Sections.section_proof ["r"] +`(!x:real^N. MEM x list ==> norm x <= r) ==> + norm (vector_of_list d list:real^M) <= sqrt (&(LENGTH list)) * r` +[ + (BETA_TAC THEN (move ["norm_le"])); + ((THENL) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`list = []`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (move ["list_not_nil"])]); + (((((use_arg_then2 ("LENGTH", [LENGTH]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vector_of_list_nil", [vector_of_list_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NORM_0", [NORM_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SQRT_0", [SQRT_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LZERO", [REAL_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`&0 <= r`))) (term_tac (have_gen_tac [](move ["r_pos"])))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`0 < LENGTH list`))) (term_tac (have_gen_tac [](move ["len_pos"])))) ((((use_arg_then2 ("list_not_nil", [])) (disch_tac [])) THEN (clear_assumption "list_not_nil") THEN BETA_TAC) THEN (((use_arg_then2 ("LENGTH_EQ_NIL", [LENGTH_EQ_NIL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> (use_arg_then2 ("norm_le", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("MEM_EL", [MEM_EL])) (fun fst_arg -> (use_arg_then2 ("len_pos", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((fun arg_tac -> (use_arg_then2 ("NORM_POS_LE", [NORM_POS_LE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`EL 0 list`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("vector_norm", [vector_norm]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dot_vector_of_list", [dot_vector_of_list]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`LENGTH list`))) (term_tac (set_tac "n"))); + ((fun arg_tac -> arg_tac (Arg_term (`sqrt (&n) * r = sqrt (&n * r pow 2)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("SQRT_MUL", [SQRT_MUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LE_POW_2", [REAL_LE_POW_2]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_POS", [REAL_POS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("POW_2_SQRT", [POW_2_SQRT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("SQRT_MONO_LE", [SQRT_MONO_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_POS_LE_NUMSEG", [SUM_POS_LE_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (move ["i"]) THEN (move ["_"])) THEN (((use_arg_then2 ("DOT_POS_LE", [DOT_POS_LE]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((fun arg_tac -> (use_arg_then2 ("CARD_NUMSEG_1", [CARD_NUMSEG_1])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then2 ("SUM_BOUND", [SUM_BOUND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_ineq"]) THEN (simp_tac)); + ((((use_arg_then2 ("DOT_SQUARE_NORM", [DOT_SQUARE_NORM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_SQUARE_ABS", [REAL_LE_SQUARE_ABS]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_ABS_NORM", [REAL_ABS_NORM]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("iffRL", [iffRL])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("REAL_ABS_REFL", [REAL_ABS_REFL])) (fun fst_arg -> (use_arg_then2 ("r", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("norm_le", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM_EL", [MEM_EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("i_ineq", [])) (disch_tac [])) THEN (clear_assumption "i_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section VectorOfList *) +let vector_of_list_nil = Sections.finalize_theorem vector_of_list_nil;; +let length_list_of_vector = Sections.finalize_theorem length_list_of_vector;; +let sum_lemma = Sections.finalize_theorem sum_lemma;; +let vector_of_list_comp0 = Sections.finalize_theorem vector_of_list_comp0;; +let vector_of_list_comp = Sections.finalize_theorem vector_of_list_comp;; +let vector_of_list_left_inverse = Sections.finalize_theorem vector_of_list_left_inverse;; +let dot_vector_of_list = Sections.finalize_theorem dot_vector_of_list;; +let vector_of_list_norm_bound = Sections.finalize_theorem vector_of_list_norm_bound;; +Sections.end_section "VectorOfList";; + +(* Lemma infnorm_lt *) +let infnorm_lt = Sections.section_proof ["e"] +`!(v:real^N). (!i. 1 <= i /\ i <= dimindex (:N) ==> abs (v$i) < e) ==> + infnorm v < e` +[ + ((THENL_ROT (-1)) ((BETA_TAC THEN (move ["v"]) THEN (move ["ineqs"])) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL infnorm)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_SUP_LT_FINITE)))(thm_tac (new_rewrite [] []))))))); + ((BETA_TAC THEN (move ["x"])) THEN (((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["i"])) THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("ineqs", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (simp_tac)) THEN (done_tac)); + (split_tac); + ((fun arg_tac -> arg_tac (Arg_term (`GSPEC _`))) (term_tac (set_tac "s"))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`s = IMAGE (\i. abs (v$i)) (1..dimindex (:N))`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + (((((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL CONJ_ACI)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`abs (v$1)`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`1`))) (term_tac exists_tac))); + (((((use_arg_then2 ("DIMINDEX_GE_1", [DIMINDEX_GE_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LE_REFL", [LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma lim_not_equal *) +let lim_not_equal = Sections.section_proof ["a";"b";"f";"g"] +`~(a = b) /\ (f --> a) sequentially /\ (g --> b) sequentially ==> + ?N. !n. N <= n ==> ~(f n = g n)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("LIM_SEQUENTIALLY", [LIM_SEQUENTIALLY]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DIST_NZ", [DIST_NZ]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["n_ab"])) THEN (case THEN ((move ["f_to_a"]) THEN (move ["g_to_b"])))); + ((fun arg_tac -> arg_tac (Arg_term (`dist (a, b) / &2`))) (term_tac (set_tac "e"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < e`))) (term_tac (have_gen_tac [](move ["e_gt0"])))) (((((use_arg_then2 ("e_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LT_DIV", [REAL_LT_DIV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_ab", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); + (((fun arg_tac -> (use_arg_then2 ("g_to_b", [])) (fun fst_arg -> (use_arg_then2 ("e_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then2 ("f_to_a", [])) (fun fst_arg -> (use_arg_then2 ("e_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN ((move ["n1"]) THEN (move ["ineq1"]))) THEN (case THEN ((move ["n2"]) THEN (move ["ineq2"])))); + (((fun arg_tac -> arg_tac (Arg_term (`n1 + n2:num`))) (term_tac exists_tac)) THEN (move ["n"]) THEN (move ["le_n"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`n1 <= n /\ n2 <= n:num`))) (term_tac (have_gen_tac [](move ["n_ineqs"])))) ((((use_arg_then2 ("le_n", [])) (disch_tac [])) THEN (clear_assumption "le_n") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("ineq2", [])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then2 ("ineq1", [])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("n_ineqs", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DIST_TRIANGLE", [DIST_TRIANGLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`g n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DIST_TRIANGLE", [DIST_TRIANGLE])) (fun fst_arg -> (use_arg_then2 ("a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f n`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_def", [])) (disch_tac [])) THEN (clear_assumption "e_def") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Section VectorOfList_Sets *) +Sections.begin_section "VectorOfList_Sets";; +(Sections.add_section_var (mk_var ("k", (`:num`))));; +(Sections.add_section_hyp "dim_ge" (`3 * k <= dimindex (:M)`));; + +(* Section Lim_inS *) +Sections.begin_section "Lim_inS";; +(Sections.add_section_var (mk_var ("S", (`:(real^3)list -> bool`))));; + +(* Lemma lim_inS_EL *) +let lim_inS_EL = Sections.section_proof ["v";"y"] +`(!n. v n IN IMAGE (vector_of_list 3) S) /\ (v --> y:real^M) sequentially + ==> !i. i < k ==> ((\n. EL i (list_of_vector 3 k (v n):(real^3)list)) + --> EL i (list_of_vector 3 k y:(real^3)list)) sequentially` +[ + (((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LIM_SEQUENTIALLY", [LIM_SEQUENTIALLY]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["vS"])) THEN (move ["v_to_y"]) THEN (move ["i"]) THEN (move ["i_lt_k"]) THEN (move ["e"]) THEN (move ["e_gt0"]) THEN (simp_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < e / sqrt (&3)`))) (term_tac (have_gen_tac [](move ["e3_gt0"])))) (((((use_arg_then2 ("REAL_LT_DIV", [REAL_LT_DIV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("e_gt0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SQRT_POS_LT", [SQRT_POS_LT]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); + (((fun arg_tac -> (use_arg_then2 ("v_to_y", [])) (fun fst_arg -> (use_arg_then2 ("e3_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["N"])) THEN (move ["d_lt"])); + ((((use_arg_then2 ("N", [])) (term_tac exists_tac)) THEN (move ["n"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("d_lt", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("NORM_BOUND_COMPONENT_LT", [NORM_BOUND_COMPONENT_LT])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["bounds"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("list_of_vector", [list_of_vector]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("Packing3.EL_TABLE", [Packing3.EL_TABLE]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`_1 - _2:real^3`))) (term_tac (set_tac "z"))); + ((((fun arg_tac -> (use_arg_then2 ("NORM_LE_INFNORM", [NORM_LE_INFNORM])) (fun fst_arg -> (use_arg_then2 ("z", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("REAL_LET_TRANS", [REAL_LET_TRANS])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("DIMINDEX_3", [DIMINDEX_3]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LTE_TRANS", [REAL_LTE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LTE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`sqrt (&3) * (e / sqrt (&3))`))) (term_tac exists_tac))); + ((THENL_ROT (-1)) (split_tac)); + ((((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_LINV", [REAL_MUL_LINV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("SQRT_EQ_0", [SQRT_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((((use_arg_then2 ("REAL_LT_LMUL", [REAL_LT_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SQRT_POS_LT", [SQRT_POS_LT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("infnorm_lt", [infnorm_lt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIMINDEX_3", [DIMINDEX_3]))(thm_tac (new_rewrite [] []))))) THEN (move ["j"]) THEN (move ["j_ineqs"])); + ((((use_arg_then2 ("z_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LAMBDA_BETA", [LAMBDA_BETA]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIMINDEX_3", [DIMINDEX_3]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))); + (((((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("bounds", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dim_ge", [])) (disch_tac [])) THEN (clear_assumption "dim_ge") THEN ((use_arg_then2 ("i_lt_k", [])) (disch_tac [])) THEN (clear_assumption "i_lt_k") THEN ((use_arg_then2 ("j_ineqs", [])) (disch_tac [])) THEN (clear_assumption "j_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; +(Sections.add_section_hyp "inS_imp" (`!l. l IN S ==> LENGTH l <= k`));; + +(* Lemma lim_inS_eq *) +let lim_inS_eq = Sections.section_proof ["v";"y"] +`(!n. v n IN IMAGE (vector_of_list 3) S) /\ (v --> y) sequentially + ==> vector_of_list 3 (list_of_vector 3 k y:(real^3)list):real^M = y` +[ + (((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LIM_SEQUENTIALLY", [LIM_SEQUENTIALLY]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["vS"]) THEN (move ["v_to_y"])))); + (((((use_arg_then2 ("vector_of_list", [vector_of_list]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LAMBDA_UNIQUE", [LAMBDA_UNIQUE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("length_list_of_vector", [length_list_of_vector]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_ineqs"])); + (((fun arg_tac -> arg_tac (Arg_term (`(i - 1) DIV 3 < k`))) (disch_eq_tac "h" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((THENL_FIRST) ((((use_arg_then2 ("list_of_vector", [list_of_vector]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Packing3.EL_TABLE", [Packing3.EL_TABLE]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("LAMBDA_BETA", [LAMBDA_BETA]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIMINDEX_3", [DIMINDEX_3]))(thm_tac (new_rewrite [] [])))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((((use_arg_then2 ("ADD_ASSOC", [ADD_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIVISION", [DIVISION]))(gsym_then (thm_tac (new_rewrite [] [])))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`i - 1 + 1 = i`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((ALL_TAC) THEN (done_tac))); + ((((use_arg_then2 ("i_ineqs", [])) (disch_tac [])) THEN (clear_assumption "i_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`!e. &0 < e ==> abs(y$i) < e`))) (term_tac (have_gen_tac []ALL_TAC)))); + ((((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("NOT_FORALL_THM", [NOT_FORALL_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IMP", [NOT_IMP]))(thm_tac (new_rewrite [] []))))) THEN (move ["yn0"]))); + (((fun arg_tac -> arg_tac (Arg_term (`abs (y$i)`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("yn0", [])) (disch_tac [])) THEN (clear_assumption "yn0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((BETA_TAC THEN (move ["e"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("v_to_y", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["N"])) THEN (move ["hh"])) THEN (((fun arg_tac -> (use_arg_then2 ("hh", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("LE_REFL", [LE_REFL])) (fun fst_arg -> (use_arg_then2 ("N", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC)); + (((((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("NORM_BOUND_COMPONENT_LT", [NORM_BOUND_COMPONENT_LT])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("i_ineqs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))); + (((use_arg_then2 ("VECTOR_SUB_COMPONENT", [VECTOR_SUB_COMPONENT]))(thm_tac (new_rewrite [] [])))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`v N$i = &0`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((((use_arg_then2 ("REAL_SUB_RZERO", [REAL_SUB_RZERO]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((fun arg_tac -> (use_arg_then2 ("vS", [])) (fun fst_arg -> (use_arg_then2 ("N", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["x"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("inS_imp", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["len_leq"])); + (((((use_arg_then2 ("vector_of_list_comp0", [vector_of_list_comp0]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("DIMINDEX_3", [DIMINDEX_3]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_ineqs", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)); + ((((use_arg_then2 ("leq_trans", [leq_trans])) (disch_tac [])) THEN (clear_assumption "leq_trans") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`3 * k`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("dim_ge", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_mul2l", [leq_mul2l]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((((use_arg_then2 ("leq_trans", [leq_trans])) (disch_tac [])) THEN (clear_assumption "leq_trans") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`3 * k + 1`))) (term_tac exists_tac)) THEN (split_tac)) ((((use_arg_then2 ("len_leq", [])) (disch_tac [])) THEN (clear_assumption "len_leq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`(a DIV d) * d <= a`))) (term_tac (have_gen_tac ["a"; "d"](move ["div"])))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`d = 0`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("muln0", [muln0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq0n", [leq0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DIVISION", [DIVISION])) (fun fst_arg -> (use_arg_then2 ("eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [2] [])))) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN BETA_TAC) THEN ((((use_arg_then2 ("leqNgt", [leqNgt]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("leq_pmul2r", [leq_pmul2r])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("i_ineqs", [])) (disch_tac [])) THEN (clear_assumption "i_ineqs") THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("div", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i - 1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section Lim_inS *) +let lim_inS_EL = Sections.finalize_theorem lim_inS_EL;; +let lim_inS_eq = Sections.finalize_theorem lim_inS_eq;; +Sections.end_section "Lim_inS";; + +(* Section ContinuousOnCompact *) +Sections.begin_section "ContinuousOnCompact";; +(Sections.add_section_var (mk_var ("S", (`:(real^3)list -> bool`))));; +(Sections.add_section_hyp "inS" (`!l. l IN S ==> LENGTH l = k`));; +(Sections.add_section_hyp "compactS" (`compact (IMAGE (vector_of_list 3) S:real^M->bool)`));; +(Sections.add_section_hyp "n_S_empty" (`~(S = {})`));; + +(* Lemma max_onS *) +let max_onS = Sections.section_proof ["f"] +`(lift o f o set_of_list o (list_of_vector 3 k:real^M->(real^3)list)) + continuous_on (IMAGE (vector_of_list 3) S) ==> + ?W. W IN IMAGE set_of_list S /\ (!V. V IN IMAGE set_of_list S ==> f V <= f W)` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("CONTINUOUS_ATTAINS_SUP", [CONTINUOUS_ATTAINS_SUP])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then2 ("compactS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IMAGE_EQ_EMPTY", [IMAGE_EQ_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_S_empty", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["v"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["l"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["lS"]) THEN (move ["le"])); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`set_of_list l`))) (term_tac exists_tac)) THEN (split_tac)) (((use_arg_then2 ("l", [])) (term_tac exists_tac)) THEN (done_tac))); + (BETA_TAC THEN (move ["V"]) THEN (case THEN (move ["y"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["yS"])); + ((THENL_FIRST) ((((fun arg_tac -> (use_arg_then2 ("le", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vector_of_list 3 y:real^M`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)) (((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (done_tac))); + (((fun arg_tac -> (use_arg_then2 ("inS", [])) (fun fst_arg -> (use_arg_then2 ("lS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then2 ("inS", [])) (fun fst_arg -> (use_arg_then2 ("yS", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (move ["y_eq"]) THEN (move ["l_eq"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y_eq", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("l_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("vector_of_list_left_inverse", [vector_of_list_left_inverse]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIMINDEX_3", [DIMINDEX_3]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("l_eq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section ContinuousOnCompact *) +let max_onS = Sections.finalize_theorem max_onS;; +Sections.end_section "ContinuousOnCompact";; +(Sections.add_section_var (mk_var ("S", (`:(real^3)list -> bool`))));; + +(* Section NormSet *) +Sections.begin_section "NormSet";; +(Sections.add_section_var (mk_var ("g", (`:num -> real`))));; +(Sections.add_section_hyp "inS" (`!l. l IN S <=> LENGTH l = k /\ (!i. i < k ==> norm (EL i l) = g i)`));; + +(* Lemma closedNormS *) +let closedNormS = Sections.section_proof [] +`closed (IMAGE (vector_of_list 3) S:real^M->bool)` +[ + (((((use_arg_then2 ("CLOSED_SEQUENTIAL_LIMITS", [CLOSED_SEQUENTIAL_LIMITS]))(thm_tac (new_rewrite [] [])))) THEN (move ["v"]) THEN (move ["y"]) THEN (case THEN ((move ["vn_eq"]) THEN (move ["v_to_y"])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`list_of_vector 3 k y`))) (term_tac exists_tac)) THEN (split_tac)); + ((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("lim_inS_eq", [lim_inS_eq])) (fun fst_arg -> (use_arg_then2 ("v_to_y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("S", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vn_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac) THEN (move ["l"]))); + (((((use_arg_then2 ("inS", []))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leqnn", [leqnn])) (disch_tac [])) THEN (clear_assumption "leqnn") THEN (exact_tac)) THEN (done_tac)); + (((((use_arg_then2 ("inS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("length_list_of_vector", [length_list_of_vector]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["i"]) THEN (move ["i_lt_k"])); + ((fun arg_tac -> arg_tac (Arg_term (`EL i _`))) (term_tac (set_tac "x"))); + ((((fun arg_tac -> (use_arg_then2 ("CONTINUOUS_AT_LIFT_NORM", [CONTINUOUS_AT_LIFT_NORM])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("CONTINUOUS_AT_SEQUENTIALLY", [CONTINUOUS_AT_SEQUENTIALLY]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("x_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("lim_inS_EL", [lim_inS_EL])) (fun fst_arg -> (use_arg_then2 ("vn_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v_to_y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i_lt_k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC)); + ((fun arg_tac -> arg_tac (Arg_term (`(lift o norm) o _`))) (term_tac (set_tac "r"))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`r = (\n. lift (g i))`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + (((((use_arg_then2 ("LIM_CONST_EQ", [LIM_CONST_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("TRIVIAL_LIMIT_SEQUENTIALLY", [TRIVIAL_LIMIT_SEQUENTIALLY]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("LIFT_EQ", [LIFT_EQ]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); + (((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN (move ["n"]) THEN (simp_tac)); + ((((fun arg_tac -> (use_arg_then2 ("vn_eq", [])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inS", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["l"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (case THEN (move ["len_eq"])) THEN (move ["norm_eq"]))); + (((((use_arg_then2 ("len_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("vector_of_list_left_inverse", [vector_of_list_left_inverse]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIMINDEX_3", [DIMINDEX_3]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("len_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("norm_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section NormSet *) +let closedNormS = Sections.finalize_theorem closedNormS;; +Sections.end_section "NormSet";; +(Sections.add_section_hyp "inS" (`!l. l IN S <=> set_of_list l SUBSET ball_annulus /\ + packing (set_of_list l) /\ LENGTH l = k /\ uniq l`));; + +(* Lemma closedS *) +let closedS = Sections.section_proof [] +`closed (IMAGE (vector_of_list 3) S:real^M->bool)` +[ + (((((use_arg_then2 ("CLOSED_SEQUENTIAL_LIMITS", [CLOSED_SEQUENTIAL_LIMITS]))(thm_tac (new_rewrite [] [])))) THEN (move ["v"]) THEN (move ["y"]) THEN (case THEN ((move ["vn_eq"]) THEN (move ["v_to_y"])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`list_of_vector 3 k y`))) (term_tac exists_tac)) THEN (split_tac)); + ((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("lim_inS_eq", [lim_inS_eq])) (fun fst_arg -> (use_arg_then2 ("v_to_y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("S", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vn_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac) THEN (move ["l"]))); + (((((use_arg_then2 ("inS", []))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leqnn", [leqnn])) (disch_tac [])) THEN (clear_assumption "leqnn") THEN (exact_tac)) THEN (done_tac)); + (((((use_arg_then2 ("inS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("length_list_of_vector", [length_list_of_vector]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)); + (((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM_EXISTS_EL", [MEM_EXISTS_EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("length_list_of_vector", [length_list_of_vector]))(thm_tac (new_rewrite [] []))))) THEN (move ["a"]) THEN (case THEN (move ["i"])) THEN (case THEN ((move ["i_lt"]) THEN (move ["a_eq"])))); + ((((use_arg_then2 ("closed_ball_annulus", [closed_ball_annulus])) (disch_tac [])) THEN (clear_assumption "closed_ball_annulus") THEN BETA_TAC) THEN (((use_arg_then2 ("CLOSED_SEQUENTIAL_LIMITS", [CLOSED_SEQUENTIAL_LIMITS]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`\n. EL i (list_of_vector 3 k (v n))`))) (term_tac exists_tac)); + (((((use_arg_then2 ("a_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("lim_inS_EL", [lim_inS_EL])) (fun fst_arg -> (use_arg_then2 ("S", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (move ["n"]) THEN (simp_tac)); + ((((fun arg_tac -> (use_arg_then2 ("vn_eq", [])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["l"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (case THEN (move ["sub_l"])) THEN (case THEN (move ["_"])) THEN (move ["len_eq"]))); + ((((use_arg_then2 ("len_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("vector_of_list_left_inverse", [vector_of_list_left_inverse]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIMINDEX_3", [DIMINDEX_3]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("sub_l", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM_EL", [MEM_EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("len_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_ROT (-1)) (split_tac)); + (((((fun arg_tac -> (use_arg_then2 ("uniq_nthP", [uniq_nthP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("length_list_of_vector", [length_list_of_vector]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["j"]) THEN (case THEN ((move ["i_lt_j"]) THEN (move ["j_lt"])))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`i < k:num`))) (term_tac (have_gen_tac [](move ["i_lt"])))) ((((use_arg_then2 ("i_lt_j", [])) (disch_tac [])) THEN (clear_assumption "i_lt_j") THEN ((use_arg_then2 ("j_lt", [])) (disch_tac [])) THEN (clear_assumption "j_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("EL_nth", [EL_nth]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("length_list_of_vector", [length_list_of_vector]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`EL i _`))) (term_tac (set_tac "a"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`EL j _`))) (term_tac (set_tac "b")))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("lim_inS_EL", [lim_inS_EL])) (fun fst_arg -> (use_arg_then2 ("vn_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v_to_y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("lim_inS_EL", [lim_inS_EL])) (fun fst_arg -> (use_arg_then2 ("vn_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v_to_y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((fun arg_tac -> arg_tac (Arg_term (`\n. _ n`))) (term_tac (set_tac "f2"))); + ((fun arg_tac -> arg_tac (Arg_term (`\n. _ n`))) (term_tac (set_tac "f1"))); + ((((use_arg_then2 ("a_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("b_def", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LIM_SEQUENTIALLY", [LIM_SEQUENTIALLY]))(thm_tac (new_rewrite [] [])))))); + (BETA_TAC THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("REAL_LT_01", [REAL_LT_01])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (case THEN (move ["n1"])) THEN (move ["d2b"]) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("REAL_LT_01", [REAL_LT_01])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (case THEN (move ["n2"])) THEN (move ["d1a"])); + (((fun arg_tac -> (use_arg_then2 ("d2b", [])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("leq_addr", [leq_addr])) (fun fst_arg -> (use_arg_then2 ("n2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then2 ("d1a", [])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("leq_addl", [leq_addl])) (fun fst_arg -> (use_arg_then2 ("n1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((use_arg_then2 ("f1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((((fun arg_tac -> (use_arg_then2 ("vn_eq", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n1 + n2:num`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inS", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["l"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (case THEN (move ["_"])) THEN (case THEN (move ["pack"])) THEN (case THEN (move ["len_eq"])) THEN (move ["uniq_l"]))); + (((((use_arg_then2 ("len_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("vector_of_list_left_inverse", [vector_of_list_left_inverse]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIMINDEX_3", [DIMINDEX_3]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("len_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["da"]) THEN (move ["db"])); + ((in_tac ["uniq_l"] false (((fun arg_tac -> (use_arg_then2 ("uniq_nthP", [uniq_nthP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (in_tac ["pack"] false (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Sphere.packing_lt)))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("uniq_l", [])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("i_lt_j", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("len_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("j_lt", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("EL_nth", [EL_nth]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("len_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["neq"]))); + ((((use_arg_then2 ("neq", [])) (disch_tac [])) THEN (clear_assumption "neq") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (move ["eq"])) THEN (((use_arg_then2 ("pack", [])) (disch_tac [])) THEN (clear_assumption "pack") THEN (DISCH_THEN apply_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("MEM_EL", [MEM_EL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("len_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("da", [])) (disch_tac [])) THEN (clear_assumption "da") THEN ((use_arg_then2 ("db", [])) (disch_tac [])) THEN (clear_assumption "db") THEN ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DIST_TRIANGLE", [DIST_TRIANGLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`EL i l`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`EL j l`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Sphere.packing)))(thm_tac (new_rewrite [] [])))) THEN (move ["a"]) THEN (move ["b"])); + ((((use_arg_then2 ("IN", [IN]))(gsym_then (thm_tac (new_rewrite [] [(`set_of_list _ a`)]))))) THEN (((use_arg_then2 ("IN", [IN]))(gsym_then (thm_tac (new_rewrite [] [(`set_of_list _ b`)]))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("MEM_EXISTS_EL", [MEM_EXISTS_EL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("length_list_of_vector", [length_list_of_vector]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] []))))); + (BETA_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["i"])) THEN (case THEN ((move ["i_lt"]) THEN (move ["a_eq"]))) THEN (case THEN ALL_TAC) THEN (case THEN (move ["j"])) THEN (case THEN ((move ["j_lt"]) THEN (move ["b_eq"]))) THEN (move ["n_ab"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("lim_inS_EL", [lim_inS_EL])) (fun fst_arg -> (use_arg_then2 ("vn_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v_to_y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("lim_inS_EL", [lim_inS_EL])) (fun fst_arg -> (use_arg_then2 ("vn_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v_to_y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((fun arg_tac -> arg_tac (Arg_term (`\n. _ n`))) (term_tac (set_tac "f2"))); + ((fun arg_tac -> arg_tac (Arg_term (`\n. _ n`))) (term_tac (set_tac "f1"))); + (((((use_arg_then2 ("a_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("b_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["f2b"]) THEN (move ["f1a"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("LIM_NORM_LBOUND", [LIM_NORM_LBOUND])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sequentially`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`\n. f1 n - f2 n:real^3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((((use_arg_then2 ("TRIVIAL_LIMIT_SEQUENTIALLY", [TRIVIAL_LIMIT_SEQUENTIALLY]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("LIM_SUB", [LIM_SUB]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EVENTUALLY_SEQUENTIALLY", [EVENTUALLY_SEQUENTIALLY]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("lim_not_equal", [lim_not_equal])) (fun fst_arg -> (use_arg_then2 ("n_ab", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f1a", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f2b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["N"])) THEN (move ["neq"])); + ((((use_arg_then2 ("N", [])) (term_tac exists_tac)) THEN (move ["n"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("neq", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN ((((use_arg_then2 ("dist", [dist]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + ((((fun arg_tac -> (use_arg_then2 ("vn_eq", [])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Sphere.packing", [Sphere.packing]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["l"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (case THEN (move ["_"])) THEN (case THEN ((move ["pack"]) THEN (move ["len_eq"]))))); + (((((use_arg_then2 ("len_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("vector_of_list_left_inverse", [vector_of_list_left_inverse]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIMINDEX_3", [DIMINDEX_3]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("len_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["el_neq"])); + (((((use_arg_then2 ("pack", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN", [IN]))(gsym_then (thm_tac (new_rewrite [] [(`set_of_list l _`)]))))) THEN (((use_arg_then2 ("IN", [IN]))(gsym_then (thm_tac (new_rewrite [] [(`set_of_list l _`)]))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("MEM_EL", [MEM_EL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("len_eq", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma compactS *) +let compactS = Sections.section_proof [] +`compact (IMAGE (vector_of_list 3) S:real^M->bool)` +[ + ((((use_arg_then2 ("COMPACT_EQ_BOUNDED_CLOSED", [COMPACT_EQ_BOUNDED_CLOSED]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("closedS", [closedS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("bounded", [bounded]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`sqrt (&k) * (&2 * h0)`))) (term_tac exists_tac)); + (((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (move ["v"]) THEN (case THEN (move ["l"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (case THEN (move ["sub_l"])) THEN (case THEN (move ["_"])) THEN (move ["len_eq"])); + (in_tac ["dim_ge"] true (((use_arg_then2 ("len_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((fun arg_tac -> (use_arg_then2 ("vector_of_list_norm_bound", [vector_of_list_norm_bound])) (fun fst_arg -> (use_arg_then2 ("dim_ge", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIMINDEX_3", [DIMINDEX_3]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"])); + (((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("sub_l", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("Pack_defs.ball_annulus", [Pack_defs.ball_annulus]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_CBALL_0", [IN_CBALL_0]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma set_of_listS *) +let set_of_listS = Sections.section_proof ["V"] +`V IN (IMAGE set_of_list S) <=> + packing V /\ V SUBSET ball_annulus /\ CARD V = k` +[ + (((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inS", []))(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [((case THEN (move ["l"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (case THEN ((move ["len_eq"]) THEN (move ["uniq_l"])))); ((case THEN (move ["pack"])) THEN (case THEN (move ["sub"])) THEN (move ["card_eq"]))])); + (((((use_arg_then2 ("card_set_of_list_uniq", [card_set_of_list_uniq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("len_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`list_of_set V`))) (term_tac exists_tac)); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("finite_packing_ball_annulus", [finite_packing_ball_annulus])) (fun fst_arg -> (use_arg_then2 ("pack", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sub", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finV"]))); + (((((use_arg_then2 ("SET_OF_LIST_OF_SET", [SET_OF_LIST_OF_SET]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("sub", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pack", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LENGTH_LIST_OF_SET", [LENGTH_LIST_OF_SET]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("card_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("uniq_list_of_set", [uniq_list_of_set]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma scriptL_eq *) +let scriptL_eq = Sections.section_proof ["v"] +`v:real^M IN IMAGE (vector_of_list 3) S ==> + scriptL (set_of_list (list_of_vector 3 k v)) + = list_sum (list_of_vector 3 k v:(real^3)list) (\v. lmfun (norm v / &2))` +[ + (((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inS", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["l"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN ((move ["len_eq"]) THEN (move ["uniq_l"])))); + ((((use_arg_then2 ("scriptL", [scriptL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("len_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("vector_of_list_left_inverse", [vector_of_list_left_inverse]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIMINDEX_3", [DIMINDEX_3]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("len_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("list_sum_set_of_list", [list_sum_set_of_list]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma scriptL_continuous *) +let scriptL_continuous = Sections.section_proof [] +`(lift o scriptL o set_of_list o (list_of_vector 3 k:real^M->(real^3)list)) + continuous_on (IMAGE (vector_of_list 3) S)` +[ + ((((use_arg_then2 ("CONTINUOUS_ON_SEQUENTIALLY", [CONTINUOUS_ON_SEQUENTIALLY]))(thm_tac (new_rewrite [] [])))) THEN (move ["v"]) THEN (move ["a"]) THEN (case THEN (move ["a_in"])) THEN (case THEN (move ["v_in"])) THEN (move ["v_to_a"])); + ((fun arg_tac -> arg_tac (Arg_term (`_ o v`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`f = lift o (\n. list_sum (list_of_vector 3 k (v n)) (\v:real^3. lmfun (norm v / &2)))`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq_ext", [eq_ext]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))))) THEN (move ["n"])) THEN (((use_arg_then2 ("scriptL_eq", [scriptL_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("scriptL_eq", [scriptL_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL TENDSTO_REAL)))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("list_sum_continuous", [list_sum_continuous]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lmfun_norm2_continuous", [lmfun_norm2_continuous]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("length_list_of_vector", [length_list_of_vector]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["i"]) THEN (move ["i_lt"])); + ((((fun arg_tac -> (use_arg_then2 ("lim_inS_EL", [lim_inS_EL])) (fun fst_arg -> (use_arg_then2 ("S", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma min_dist_k_continuous *) +let min_dist_k_continuous = Sections.section_proof ["j"] +`(lift o min_dist_k j o (list_of_vector 3 k:real^M->(real^3)list)) + continuous_on (IMAGE (vector_of_list 3) S)` +[ + ((((use_arg_then2 ("CONTINUOUS_ON_SEQUENTIALLY", [CONTINUOUS_ON_SEQUENTIALLY]))(thm_tac (new_rewrite [] [])))) THEN (move ["v"]) THEN (move ["a"]) THEN (case THEN (move ["a_in"])) THEN (case THEN (move ["v_in"])) THEN (move ["v_to_a"])); + ((repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL TENDSTO_REAL)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_ASSOC", [o_ASSOC]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("ETA_AX", [ETA_AX])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`min_dist_k j o _`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("min_dist_k_limit", [min_dist_k_limit]))(thm_tac (new_rewrite [] []))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("length_list_of_vector", [length_list_of_vector]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["i"]) THEN (move ["i_lt"])); + ((((fun arg_tac -> (use_arg_then2 ("lim_inS_EL", [lim_inS_EL])) (fun fst_arg -> (use_arg_then2 ("S", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section VectorOfList_Sets *) +let lim_inS_EL = Sections.finalize_theorem lim_inS_EL;; +let lim_inS_eq = Sections.finalize_theorem lim_inS_eq;; +let max_onS = Sections.finalize_theorem max_onS;; +let closedNormS = Sections.finalize_theorem closedNormS;; +let closedS = Sections.finalize_theorem closedS;; +let compactS = Sections.finalize_theorem compactS;; +let set_of_listS = Sections.finalize_theorem set_of_listS;; +let scriptL_eq = Sections.finalize_theorem scriptL_eq;; +let scriptL_continuous = Sections.finalize_theorem scriptL_continuous;; +let min_dist_k_continuous = Sections.finalize_theorem min_dist_k_continuous;; +Sections.end_section "VectorOfList_Sets";; + +(* Section FNJLBXS *) +Sections.begin_section "FNJLBXS";; + +(* Lemma sup_in_unions *) +let sup_in_unions = Sections.section_proof ["f";"S"] +`FINITE S ==> ~(UNIONS S = {}) /\ + (!s. s IN S ==> s = {} \/ ?u. u IN s /\ (!y. y IN s ==> f y <= f u)) ==> + ?v. v IN UNIONS S /\ (!y. y IN UNIONS S ==> f y <= f v)` +[ + ((((use_arg_then2 ("S", [])) (disch_tac [])) THEN (clear_assumption "S") THEN ((use_arg_then2 ("FINITE_INDUCT_STRONG", [FINITE_INDUCT_STRONG])) (thm_tac apply_tac))) THEN (((repeat_tactic 0 10 (((use_arg_then2 ("UNIONS_0", [UNIONS_0]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["t"]) THEN (move ["S"]) THEN (case THEN (move ["IH"])) THEN (case THEN (move ["tnS"])) THEN (move ["finS"]))); + (((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL UNIONS_INSERT)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["not_empty"])) THEN (move ["h"])); + (((use_arg_then2 ("IH", [])) (disch_tac [])) THEN (clear_assumption "IH") THEN ((fun arg_tac -> arg_tac (Arg_term (`UNIONS S = {}`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`~(t = {})`))) (term_tac (have_gen_tac [](move ["t_not_empty"])))); + ((((use_arg_then2 ("not_empty", [])) (disch_tac [])) THEN (clear_assumption "not_empty") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("UNION_EMPTY", [UNION_EMPTY]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("t_not_empty", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac)); + ((THENL_FIRST) (ANTS_TAC) ((BETA_TAC THEN (move ["s"]) THEN (move ["sS"])) THEN (((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN (DISCH_THEN apply_tac)) THEN (done_tac))); + ((BETA_TAC THEN (case THEN (move ["u1"])) THEN (case THEN (move ["u1_in"])) THEN (move ["u1_ineq"])) THEN (((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (simp_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`t = {}`))) (disch_eq_tac "t_eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((use_arg_then2 ("u1", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("u1_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("t_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (simp_tac)) THEN (((((use_arg_then2 ("t_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["u0"])) THEN (case THEN (move ["u0t"])) THEN (move ["u0_ineq"]))); + ((THENL) (((fun arg_tac -> arg_tac (Arg_term (`f u1 <= f u0`))) (disch_eq_tac "ineq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) [((use_arg_then2 ("u0", [])) (term_tac exists_tac)); ((use_arg_then2 ("u1", [])) (term_tac exists_tac))]); + (((((use_arg_then2 ("u0t", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["y"])); + ((((THENL) case [(DISCH_THEN (fun snd_th -> (use_arg_then2 ("u0_ineq", [])) (thm_tac (match_mp_then snd_th MP_TAC)))); (DISCH_THEN (fun snd_th -> (use_arg_then2 ("u1_ineq", [])) (thm_tac (match_mp_then snd_th MP_TAC))))]) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then2 ("u1_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["y"])); + ((((THENL) case [(DISCH_THEN (fun snd_th -> (use_arg_then2 ("u0_ineq", [])) (thm_tac (match_mp_then snd_th MP_TAC)))); (DISCH_THEN (fun snd_th -> (use_arg_then2 ("u1_ineq", [])) (thm_tac (match_mp_then snd_th MP_TAC))))]) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; +let type150 = define_finite_type 150;; + +(* Lemma type150_ineq *) +let type150_ineq = Sections.section_proof [] +`!k. k <= 43 ==> 3 * k <= dimindex (:150)` +[ + ((((fun arg_tac -> (use_arg_then2 ("DIMINDEX_UNIQUE", [DIMINDEX_UNIQUE])) (fun fst_arg -> (use_arg_then2 ("type150", [type150])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma scriptL_attains_max_in_ball_annulus *) +let scriptL_attains_max_in_ball_annulus = Sections.section_proof [] +`?W. packing W /\ W SUBSET ball_annulus /\ + (!V. packing V /\ V SUBSET ball_annulus ==> scriptL V <= scriptL W)` +[ + ((fun arg_tac -> arg_tac (Arg_term (`\k. {V | packing V /\ V SUBSET ball_annulus /\ CARD V = k}`))) (term_tac (set_tac "G"))); + ((fun arg_tac -> arg_tac (Arg_term (`packing V /\ V SUBSET ball_annulus <=> V IN UNIONS (IMAGE G (0..43))`))) (term_tac (have_gen_tac ["V"](move ["in_eq"])))); + (((((use_arg_then2 ("UNIONS_IMAGE", [UNIONS_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("G_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [(case THEN ((move ["packV"]) THEN (move ["subV"]))); ((case THEN (move ["k"])) THEN (simp_tac))])); + (((fun arg_tac -> arg_tac (Arg_term (`CARD V`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("subV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("packV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq0n", [leq0n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_packing_ball_annulus", [card_packing_ball_annulus]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("CONJ_ASSOC", [CONJ_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_eq", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("sup_in_unions", [sup_in_unions]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + (((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("UNIONS_IMAGE", [UNIONS_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("G_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (((fun arg_tac -> arg_tac (Arg_term (`{}`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`0`))) (term_tac exists_tac)))); + ((THENL_FIRST) (split_tac) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("packing_empty", [packing_empty]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EMPTY_SUBSET", [EMPTY_SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CARD_CLAUSES", [CARD_CLAUSES]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (move ["s"]) THEN (case THEN (move ["k"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["k_ineq"])); + (((fun arg_tac -> arg_tac (Arg_term (`G k = {}`))) (disch_eq_tac "Gk_n_empty" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((fun arg_tac -> (use_arg_then2 ("type150_ineq", [type150_ineq])) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("k_ineq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["dim_ge"]))); + ((fun arg_tac -> arg_tac (Arg_term (`{l | set_of_list l SUBSET ball_annulus /\ packing (set_of_list l) /\ + LENGTH l = k /\ uniq l}`))) (term_tac (set_tac "S"))); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("set_of_listS", [set_of_listS])) (fun fst_arg -> (use_arg_then2 ("S", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("dim_ge", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((THENL) (ANTS_TAC) [ALL_TAC; (move ["inS"])])) (((((use_arg_then2 ("S_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`G k = IMAGE set_of_list S`))) (term_tac (have_gen_tac [](move ["Gk_eq"])))); + (((((use_arg_then2 ("G_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inS", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("max_onS", [max_onS])) (fun fst_arg -> (use_arg_then2 ("S", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("dim_ge", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)) (((((use_arg_then2 ("S_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac))); + ((THENL_FIRST) (ANTS_TAC) (((((fun arg_tac -> (use_arg_then2 ("compactS", [compactS])) (fun fst_arg -> (use_arg_then2 ("dim_ge", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("S_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac))); + ((THENL_FIRST) (ANTS_TAC) (((((fun arg_tac -> (use_arg_then2 ("IMAGE_EQ_EMPTY", [IMAGE_EQ_EMPTY])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`set_of_list`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Gk_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((((use_arg_then2 ("Gk_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN apply_tac) THEN ((((fun arg_tac -> (use_arg_then2 ("scriptL_continuous", [scriptL_continuous])) (fun fst_arg -> (use_arg_then2 ("dim_ge", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("S_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma FNJLBXS *) +let FNJLBXS = Sections.section_proof ["V"] +`packing V /\ V SUBSET ball_annulus ==> + (?W phi. BIJ phi V W /\ packing W /\ W SUBSET ball_annulus /\ (!v. v IN V ==> norm(v) = norm(phi v)) /\ + (!w. w IN W ==> (set_of_edge w W (ESTD W) = {}) \/ (surrounded_node (W,(ESTD W)) w)))` +[ + (BETA_TAC THEN (case THEN ((move ["packV"]) THEN (move ["subV"])))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("card_packing_ball_annulus", [card_packing_ball_annulus])) (fun fst_arg -> (use_arg_then2 ("packV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("type150_ineq", [type150_ineq])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["dim_ge"])); + ((fun arg_tac -> arg_tac (Arg_term (`CARD V`))) (term_tac (set_tac "k"))); + ((fun arg_tac -> arg_tac (Arg_term (`{l | set_of_list l SUBSET ball_annulus /\ packing (set_of_list l) /\ LENGTH l = k /\ uniq l}`))) (term_tac (set_tac "S"))); + ((fun arg_tac -> arg_tac (Arg_term (`{l | LENGTH l = k /\ (!i. i < k ==> norm (EL i l:real^3) = norm (EL i (list_of_set V)))}`))) (term_tac (set_tac "N"))); + ((fun arg_tac -> arg_tac (Arg_term (`IMAGE (vector_of_list 3) S INTER IMAGE (vector_of_list 3) N:real^150->bool`))) (term_tac (set_tac "R"))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("finite_packing_ball_annulus", [finite_packing_ball_annulus])) (fun fst_arg -> (use_arg_then2 ("packV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finV"]))); + ((fun arg_tac -> arg_tac (Arg_term (`compact R`))) (term_tac (have_gen_tac [](move ["compactR"])))); + ((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("INTER_COMM", [INTER_COMM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CLOSED_INTER_COMPACT", [CLOSED_INTER_COMPACT]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("compactS", [compactS])) (fun fst_arg -> (use_arg_then2 ("dim_ge", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("S_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("closedNormS", [closedNormS])) (fun fst_arg -> (use_arg_then2 ("dim_ge", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`\i. norm (EL i (list_of_set V))`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("N_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`~(R = {})`))) (term_tac (have_gen_tac [](move ["R_n_empty"])))); + ((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`vector_of_list 3 (list_of_set V)`))) (term_tac exists_tac))); + ((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("S_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("N_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("FUN_IN_IMAGE", [FUN_IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LENGTH_LIST_OF_SET", [LENGTH_LIST_OF_SET]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("SET_OF_LIST_OF_SET", [SET_OF_LIST_OF_SET]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("uniq_list_of_set", [uniq_list_of_set]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`\j. min_dist_k j o (list_of_vector 3 k:real^150 -> (real^3)list)`))) (term_tac (set_tac "f"))); + ((fun arg_tac -> arg_tac (Arg_term (`\j x. min_k j (mkseq (\i. f i x) k)`))) (term_tac (set_tac "c"))); + ((fun arg_tac -> arg_tac (Arg_term (`(lift o c j) continuous_on R`))) (term_tac (have_gen_tac ["j"](move ["c_cont"])))); + (((((use_arg_then2 ("CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN", [CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["x"]) THEN (move ["xR"])); + (((((use_arg_then2 ("c_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("min_k_continuous", [min_k_continuous]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_lt_k"])); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL REAL_CONTINUOUS_CONTINUOUS1)))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("CONTINUOUS_WITHIN_SUBSET", [CONTINUOUS_WITHIN_SUBSET])) (thm_tac apply_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`IMAGE (vector_of_list 3) S`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("INTER_SUBSET", [INTER_SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("xR", [])) (disch_tac [])) THEN (clear_assumption "xR") THEN BETA_TAC) THEN (((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["xS"]) THEN (move ["_"]))))); + ((((use_arg_then2 ("xS", [])) (disch_tac [])) THEN (clear_assumption "xS") THEN ((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN BETA_TAC) THEN (((use_arg_then2 ("CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN", [CONTINUOUS_ON_EQ_CONTINUOUS_WITHIN]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((fun arg_tac -> (use_arg_then2 ("min_dist_k_continuous", [min_dist_k_continuous])) (fun fst_arg -> (use_arg_then2 ("dim_ge", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("S_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`\f s. {x:real^150 | x IN s /\ (!y. y IN s ==> f y <= f x)}`))) (term_tac (set_tac "sup_set"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`sup_set f s SUBSET s`))) (term_tac (have_gen_tac ["f"; "s"](move ["sup_sub"])))) (((((use_arg_then2 ("sup_set_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`compact s /\ s SUBSET R ==> compact (sup_set (c j) s)`))) (term_tac (have_gen_tac ["j"; "s"](move ["sup_comp"])))); + ((BETA_TAC THEN (case THEN ((move ["comp_s"]) THEN (move ["s_sub"])))) THEN ((((use_arg_then2 ("sup_set_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + (((((use_arg_then2 ("COMPACT_SUP_SET", [COMPACT_SUP_SET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("comp_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("CONTINUOUS_ON_SUBSET", [CONTINUOUS_ON_SUBSET])) (fun fst_arg -> (use_arg_then2 ("R", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s_sub", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`compact s /\ s SUBSET R /\ ~(s = {}) ==> ~(sup_set (c j) s = {})`))) (term_tac (have_gen_tac ["j"; "s"](move ["sup_n_empty"])))); + (BETA_TAC THEN (case THEN (move ["comp_s"])) THEN (case THEN ((move ["s_sub"]) THEN (move ["s_n"])))); + ((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("sup_set_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CONTINUOUS_ATTAINS_SUP", [CONTINUOUS_ATTAINS_SUP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s_n", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("comp_s", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("ETA_AX", [ETA_AX]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg])))) THEN (((fun arg_tac -> (use_arg_then2 ("CONTINUOUS_ON_SUBSET", [CONTINUOUS_ON_SUBSET])) (fun fst_arg -> (use_arg_then2 ("R", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`?C. C 0 = sup_set (c 0) R /\ !i. C (SUC i) = sup_set (c i) (C i)`))) (term_tac (have_gen_tac [](case THEN ((move ["C"]) THEN (case THEN ((move ["C0"]) THEN (move ["CS"])))))))); + ((general_rec_exists_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`compact (C i) /\ C i SUBSET R /\ ~(C i = {})`))) (term_tac (have_gen_tac ["i"](move ["C_props"])))); + (((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN elim) [ALL_TAC; ALL_TAC; ALL_TAC; ((move ["i"]) THEN (move ["IH"]))]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("C0", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("CS", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sup_sub", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sup_comp", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SUBSET_REFL", [SUBSET_REFL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("sup_n_empty", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SUBSET_REFL", [SUBSET_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("sup_n_empty", []))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))) THEN ((use_arg_then2 ("SUBSET_TRANS", [SUBSET_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`C i`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("IH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sup_sub", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`i <= j:num ==> C j SUBSET C i`))) (term_tac (have_gen_tac ["i"; "j"](move ["C_sub"])))); + (((THENL) (((use_arg_then2 ("j", [])) (disch_tac [])) THEN (clear_assumption "j") THEN ((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN case) [ALL_TAC; (move ["i"])]) THEN ((THENL) elim [ALL_TAC; ((move ["j"]) THEN (move ["jH"]))]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("SUBSET_REFL", [SUBSET_REFL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (TRY ((arith_tac)))); + ((BETA_TAC THEN (move ["_"])) THEN ((use_arg_then2 ("SUBSET_TRANS", [SUBSET_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`C j`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("CS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("jH", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("leq0n", [leq0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) (((((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_eqVlt", [leq_eqVlt]))(thm_tac (new_rewrite [] []))))) THEN ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (move ["i_lt_j"])])) ((((use_arg_then2 ("SUBSET_REFL", [SUBSET_REFL]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((use_arg_then2 ("SUBSET_TRANS", [SUBSET_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`C j`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("CS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sup_sub", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("jH", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("C_props", [])) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["Ck_sub"])) THEN (case THEN (move ["w"])) THEN (move ["w_in"]))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Packing3.IN_TRANS", [Packing3.IN_TRANS])) (fun fst_arg -> (use_arg_then2 ("w_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("Ck_sub", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("S_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("N_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["wl"])) THEN (case THEN (move ["w_eq"])) THEN (move ["wl_props"]) THEN (case THEN (move ["wl'"])) THEN (case THEN (move ["w_eq'"])) THEN (move ["wl'_props"])); + ((fun arg_tac -> arg_tac (Arg_term (`wl' = wl`))) (term_tac (have_gen_tac [](move ["eq"])))); + ((((use_arg_then2 ("w_eq", [])) (disch_tac [])) THEN (clear_assumption "w_eq") THEN BETA_TAC) THEN ((((use_arg_then2 ("w_eq'", []))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("f_equal", [f_equal])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`list_of_vector 3 k:real^150->(real^3)list`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))))); + (((((use_arg_then2 ("wl'_props", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("wl_props", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("vector_of_list_left_inverse", [vector_of_list_left_inverse]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIMINDEX_3", [DIMINDEX_3]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("wl_props", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("wl'_props", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((in_tac ["wl'_props"] false (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w_eq'", [])) (disch_tac [])) THEN (clear_assumption "w_eq'") THEN ((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]))); + ((((fun arg_tac -> arg_tac (Arg_term (`set_of_list wl`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`\x. EL (indexl x (list_of_set V)) wl`))) (term_tac exists_tac))) THEN (split_tac)); + ((((fun arg_tac -> (use_arg_then2 ("SET_OF_LIST_OF_SET", [SET_OF_LIST_OF_SET])) (fun fst_arg -> (use_arg_then2 ("finV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then2 ("BIJ_from_lists", [BIJ_from_lists]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("uniq_list_of_set", [uniq_list_of_set]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("wl_props", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("LENGTH_LIST_OF_SET", [LENGTH_LIST_OF_SET]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then2 ("wl_props", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [((move ["v"]) THEN (move ["vV"])); ((move ["y"]) THEN (move ["y_wl"]))])); + ((simp_tac) THEN (((use_arg_then2 ("wl'_props", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("EL_index", [EL_index]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("MEM_LIST_OF_SET", [MEM_LIST_OF_SET]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("k_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("LENGTH_LIST_OF_SET", [LENGTH_LIST_OF_SET]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM_LIST_OF_SET", [MEM_LIST_OF_SET]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`i <= k:num ==> w IN C i`))) (term_tac (have_gen_tac ["i"](move ["w_in_all"])))); + ((BETA_TAC THEN (move ["i_le"])) THEN ((((fun arg_tac -> (use_arg_then2 ("Packing3.IN_TRANS", [Packing3.IN_TRANS])) (fun fst_arg -> (use_arg_then2 ("w_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("C_sub", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("contraT", [contraT])) (disch_tac [])) THEN (clear_assumption "contraT") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["not_iso"]) THEN (move ["not_surr"]))))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`?wl'. wl' IN N /\ wl' IN S /\ (?n. n < k:num /\ + (!i. i < n ==> c i (vector_of_list 3 wl') = c i w) /\ c n w < c n (vector_of_list 3 wl'))`))) (term_tac (have_gen_tac []ALL_TAC)))); + (((((use_arg_then2 ("implybF", [implybF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_EXISTS_THM", [NOT_EXISTS_THM]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("NOT_EXISTS_THM", [NOT_EXISTS_THM]))(thm_tac (new_rewrite [] []))))) THEN (move ["wl'"])); + ((((fun arg_tac -> arg_tac (Arg_term (`wl' IN N`))) (disch_eq_tac "w'N" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN (((fun arg_tac -> arg_tac (Arg_term (`wl' IN S`))) (disch_eq_tac "w'S" [])) THEN case THEN (simp_tac) THEN (move ["n"]) THEN (process_fst_eq_tac))); + ((((use_arg_then2 ("implybF", [implybF]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["n_lt"])) THEN (case THEN (move ["ci_eq"])) THEN (move ["cn_lt"])); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`i <= n:num ==> vector_of_list 3 wl' IN C i`))) (term_tac (have_gen_tac ["i"](move ["w'C"]))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`w IN C (SUC n)`))) (term_tac (have_gen_tac []ALL_TAC))) (((((fun arg_tac -> (use_arg_then2 ("Packing3.IN_TRANS", [Packing3.IN_TRANS])) (fun fst_arg -> (use_arg_then2 ("w_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("C_sub", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((((use_arg_then2 ("CS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sup_set_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_FORALL_THM", [NOT_FORALL_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IMP", [NOT_IMP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NOT_LE", [REAL_NOT_LE]))(thm_tac (new_rewrite [] []))))); + ((DISJ2_TAC) THEN ((fun arg_tac -> arg_tac (Arg_term (`vector_of_list 3 wl'`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("w'C", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_ROT (-1)) ((((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN elim) [ALL_TAC; ((move ["i"]) THEN (move ["IH"]))]) THEN (move ["i_le"])) THEN ((((fun arg_tac ->(use_arg_then2 ("C0", []))(fun tmp_arg1 -> (use_arg_then2 ("CS", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sup_set_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))))); + ((THENL_FIRST) ((((use_arg_then2 ("IH", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) ((((use_arg_then2 ("i_le", [])) (disch_tac [])) THEN (clear_assumption "i_le") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((BETA_TAC THEN (move ["y"]) THEN (move ["y_in"])) THEN (((fun arg_tac -> (use_arg_then2 ("w_in_all", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SUC i`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)) ((((use_arg_then2 ("n_lt", [])) (disch_tac [])) THEN (clear_assumption "n_lt") THEN ((use_arg_then2 ("i_le", [])) (disch_tac [])) THEN (clear_assumption "i_le") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("CS", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sup_set_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("y_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))); + (((((use_arg_then2 ("ci_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("R_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("FUN_IN_IMAGE", [FUN_IN_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (move ["y"]) THEN (move ["yR"])); + ((((fun arg_tac -> (use_arg_then2 ("w_in_all", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("leq0n", [leq0n])) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("C0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sup_set_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("yR", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)))); + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`n = 0`))) (disch_eq_tac "n_eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) (((((use_arg_then2 ("ci_eq", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("lt0n", [lt0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("cn_lt", [])) (disch_tac [])) THEN (clear_assumption "cn_lt") THEN BETA_TAC) THEN (((use_arg_then2 ("n_eq", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("y_wl", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("MEM_EXISTS_EL", [MEM_EXISTS_EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["r"])) THEN (case THEN (move ["r_lt"])) THEN (move ["y_eq"]))); + ((fun arg_tac -> arg_tac (Arg_term (`min_dist_k r wl`))) (term_tac (set_tac "dy"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`sizel wl = k`))) (term_tac (have_gen_tac [](move ["size_eq"])))) (((((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("wl_props", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`?e. &0 < e /\ (!i. i < k /\ ~(i = r) ==> dist (EL i wl, y) = dy \/ dy + e <= dist (EL i wl, y))`))) (term_tac (have_gen_tac [](case THEN ((move ["e"]) THEN (case THEN ((move ["e_gt0"]) THEN (move ["e_cond"])))))))); + ((fun arg_tac -> arg_tac (Arg_term (`map (\v. dist (v, y)) wl`))) (term_tac (set_tac "dl"))); + ((fun arg_tac -> arg_tac (Arg_term (`\x. x = &0 \/ x = dy`))) (term_tac (set_tac "a"))); + ((fun arg_tac -> arg_tac (Arg_term (`if all a dl then &1 else min_k 0 (filter (predC a) dl) - dy`))) (term_tac (set_tac "e"))); + ((use_arg_then2 ("e", [])) (term_tac exists_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!i. i < k ==> dist (EL i wl, y) <- dl`))) (term_tac (have_gen_tac [](move ["in_dl"])))); + ((BETA_TAC THEN (move ["i"]) THEN (move ["i_ineqs"])) THEN ((((use_arg_then2 ("MEM_EXISTS_EL", [MEM_EXISTS_EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dl_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_map", [size_map]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] [])))))); + (((use_arg_then2 ("i", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("EL_map", [EL_map]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!i. i < k ==> (dist (EL i wl, y) = &0 <=> i = r)`))) (term_tac (have_gen_tac [](move ["dist_n0"])))); + ((THENL_LAST) ((BETA_TAC THEN (move ["i"]) THEN (move ["i_lt"])) THEN ((THENL) (split_tac) [ALL_TAC; (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))])) (((((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIST_REFL", [DIST_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("DIST_EQ_0", [DIST_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("nth_uniq", [nth_uniq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("e_def", [])) (disch_tac [])) THEN (clear_assumption "e_def") THEN ((fun arg_tac -> arg_tac (Arg_term (`all a dl`))) (disch_eq_tac "all_dl" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((((use_arg_then2 ("REAL_LT_01", [REAL_LT_01]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_lt"])) THEN (DISJ1_TAC)); + ((in_tac ["all_dl"] false ((((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac))) THEN (((fun arg_tac -> (use_arg_then2 ("all_dl", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dist (EL i wl, y)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC)); + (((((use_arg_then2 ("in_dl", []))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("dist_n0", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (in_tac ["all_dl"] false ((((use_arg_then2 ("has_predC", [has_predC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("has_count", [has_count]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("count_filter", [count_filter]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> arg_tac (Arg_term (`filter _1 _2`))) (term_tac (set_tac "dl2"))) THEN (BETA_TAC THEN (move ["e_eq"])) THEN (split_tac)); + ((((fun arg_tac -> (use_arg_then2 ("mem_min_k", [mem_min_k])) (fun fst_arg -> (use_arg_then2 ("all_dl", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dl2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dl2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("predC", [predC]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("dl_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mapP", [mapP]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("MEM_EXISTS_EL", [MEM_EXISTS_EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["neq"])) THEN (case THEN (move ["v"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["i"])) THEN (case THEN (move ["i_lt"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["eq"])); + ((((use_arg_then2 ("e_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_SUB_LT", [REAL_SUB_LT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_LE", [REAL_LT_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("neq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("dy_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("min_dist_min", [min_dist_min]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_lt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist_n0", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["i"]) THEN (case THEN ((move ["i_lt"]) THEN (move ["n_ir"])))) THEN (((fun arg_tac -> arg_tac (Arg_term (`_1 = _2`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`dist (EL i wl, y) <- dl2`))) (term_tac (have_gen_tac []ALL_TAC))); + (((((use_arg_then2 ("dl2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_dl", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("predC", [predC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist_n0", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("e_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_SUB_ADD2", [REAL_SUB_ADD2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM_EXISTS_EL", [MEM_EXISTS_EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["j"])) THEN (case THEN (move ["j_lt"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("min_k0_le_EL", [min_k0_le_EL]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`set_of_list wl`))) (term_tac (set_tac "W"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`y IN W`))) (term_tac (have_gen_tac [](move ["yW"])))) (((((use_arg_then2 ("W_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("Ckqowsa.CKQOWSA", [Ckqowsa.CKQOWSA])) (fun fst_arg -> (use_arg_then2 ("W", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("wl_props", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ((THENL) (ANTS_TAC) [ALL_TAC; (move ["fanW"])])); + ((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`2 <= k`))) (term_tac (have_gen_tac [](move ["k_ge2"])))); + ((((use_arg_then2 ("not_iso", [])) (disch_tac [])) THEN (clear_assumption "not_iso") THEN BETA_TAC) THEN ((((use_arg_then2 ("set_of_edge", [set_of_edge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ESTD", [ESTD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + (BETA_TAC THEN (case THEN (move ["u"])) THEN (case THEN (move ["v"])) THEN (case THEN ALL_TAC) THEN (case THEN ALL_TAC) THEN (case THEN (move ["u'"])) THEN (case THEN (move ["v'"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["u'W"])) THEN (case THEN (move ["v'W"])) THEN (case THEN (move ["neq_uv'"])) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"])); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`2 <= CARD W`))) (term_tac (have_gen_tac []ALL_TAC)))) (((((use_arg_then2 ("W_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_set_of_list_uniq", [card_set_of_list_uniq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Hypermap.CARD_TWO_ELEMENTS", [Hypermap.CARD_TWO_ELEMENTS])) (fun fst_arg -> (use_arg_then2 ("v'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("u'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("CARD_SUBSET", [CARD_SUBSET]))(thm_tac (new_rewrite [] []))))); + ((((((use_arg_then2 ("W_def", []))(gsym_then (thm_tac (new_rewrite [2] []))))) THEN (((use_arg_then2 ("FINITE_SET_OF_LIST", [FINITE_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"]) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL_FIRST) (((fun arg_tac -> (use_arg_then2 ("packing_eq_min_dist", [packing_eq_min_dist])) (fun fst_arg -> (use_arg_then2 ("wl", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)) ((((use_arg_then2 ("wl_props", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((((use_arg_then2 ("W_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("wl_props", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] []))))) THEN (move ["min_dist_ge"])); + ((fun arg_tac -> arg_tac (Arg_term (`dy <= &2 * h0`))) (term_tac (have_gen_tac [](move ["dy_le"])))); + ((((use_arg_then2 ("not_iso", [])) (disch_tac [])) THEN (clear_assumption "not_iso") THEN BETA_TAC) THEN ((((use_arg_then2 ("set_of_edge", [set_of_edge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ESTD", [ESTD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("dy_def", []))(gsym_then (thm_tac (new_rewrite [] []))))))); + (BETA_TAC THEN (case THEN (move ["u"])) THEN (case THEN (move ["v"])) THEN (case THEN ALL_TAC) THEN (case THEN ALL_TAC) THEN (case THEN (move ["u'"])) THEN (case THEN (move ["v'"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["u'W"])) THEN (case THEN (move ["v'W"])) THEN (case THEN (move ["neq_uv'"])) THEN (move ["dist_le"])); + ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Geomdetail.PAIR_EQ_EXPAND)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("W_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM_EXISTS_EL", [MEM_EXISTS_EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (BETA_TAC THEN (move ["eq_cases"]) THEN (case THEN (move ["i"])) THEN (case THEN (move ["i_lt"])) THEN (move ["v_eq"]) THEN (move ["_"])); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`i = r`))) (disch_eq_tac "ir" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("neq_uv'", [])) (disch_tac [])) THEN (clear_assumption "neq_uv'") THEN ((use_arg_then2 ("eq_cases", [])) (disch_tac [])) THEN (clear_assumption "eq_cases") THEN case THEN (move ["eq"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ir", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`dist (u',v')`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("dist_le", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("eq_cases", [])) (disch_tac [])) THEN (clear_assumption "eq_cases") THEN case THEN (move ["eq"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("v_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("min_dist_min", [min_dist_min]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`{w | w IN W /\ dist (w, y) = dy}`))) (term_tac (set_tac "X"))); + (in_tac ["r_lt"] false (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`w IN X ==> w IN set_of_edge y W (ESTD W)`))) (term_tac (have_gen_tac ["w"](move ["subX"])))); + (((((use_arg_then2 ("set_of_edge", [set_of_edge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ESTD", [ESTD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("X_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["v"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["vW"])) THEN (move ["dist_eq"]) THEN (move ["eq"])); + (((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN (repeat_tactic 1 9 (((split_tac) THEN ((TRY done_tac)))))); + ((((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("v", [])) (term_tac exists_tac))) THEN ((((use_arg_then2 ("vW", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("yW", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dy_le", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("DIST_EQ_0", [DIST_EQ_0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist_eq", []))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("min_dist_ge", [])) (fun fst_arg -> (use_arg_then2 ("r_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("dy_def", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`w IN X ==> dist (w, y) = dy /\ w IN W`))) (term_tac (have_gen_tac ["w"](move ["inX"])))) (((((use_arg_then2 ("X_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("not_surrounded_imp_on_one_side_of_plane", [not_surrounded_imp_on_one_side_of_plane])) (fun fst_arg -> (use_arg_then2 ("fanW", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("yW", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("not_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("not_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (BETA_TAC THEN (case THEN (move ["b"])) THEN (case THEN (move ["b_n0"])) THEN (case THEN (move ["y_dot_b"])) THEN (move ["b_cond"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("perturbation_lemma", [perturbation_lemma])) (fun fst_arg -> (use_arg_then2 ("e_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("b_n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y_dot_b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("X", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((THENL) (ANTS_TAC) [((move ["w"]) THEN (move ["wX"])); ALL_TAC])); + ((((use_arg_then2 ("b_cond", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("subX", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_gt", [real_gt]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Ckqowsa_3_points.dot_pos_lemma", [Ckqowsa_3_points.dot_pos_lemma]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("inX", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dy_le", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + ((in_tac ["wl_props"] false (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("wl_props", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("yW", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("inX", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("b_n0", [])) (disch_tac [])) THEN (clear_assumption "b_n0") THEN ((use_arg_then2 ("y_dot_b", [])) (disch_tac [])) THEN (clear_assumption "y_dot_b") THEN ((use_arg_then2 ("b_cond", [])) (disch_tac [])) THEN (clear_assumption "b_cond") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"])); + (BETA_TAC THEN (case THEN (move ["u"])) THEN (case THEN (move ["norm_u"])) THEN (case THEN (move ["dist_uX"])) THEN (move ["dist_yu"])); + ((fun arg_tac -> arg_tac (Arg_term (`mkseq (\i. if i = r then u else EL i wl) k`))) (term_tac (set_tac "ul"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`sizel ul = k`))) (term_tac (have_gen_tac [](move ["size_ul"])))) (((((use_arg_then2 ("ul_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`EL r ul = u /\ (!i. i < k /\ ~(i = r) ==> EL i ul = EL i wl)`))) (term_tac (have_gen_tac [](move ["el_ul"])))); + ((((((use_arg_then2 ("ul_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("EL_mkseq", [EL_mkseq]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))) THEN (move ["i"]) THEN (move ["i_ineqs"])) THEN (((use_arg_then2 ("EL_mkseq", [EL_mkseq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((use_arg_then2 ("sup_comp", [])) (disch_tac [])) THEN (clear_assumption "sup_comp") THEN ((use_arg_then2 ("sup_sub", [])) (disch_tac [])) THEN (clear_assumption "sup_sub") THEN ((use_arg_then2 ("sup_set_def", [])) (disch_tac [])) THEN (clear_assumption "sup_set_def") THEN ((use_arg_then2 ("R_n_empty", [])) (disch_tac [])) THEN (clear_assumption "R_n_empty") THEN ((use_arg_then2 ("compactR", [])) (disch_tac [])) THEN (clear_assumption "compactR") THEN ((use_arg_then2 ("R_def", [])) (disch_tac [])) THEN (clear_assumption "R_def") THEN ((use_arg_then2 ("subV", [])) (disch_tac [])) THEN (clear_assumption "subV") THEN ((use_arg_then2 ("packV", [])) (disch_tac [])) THEN (clear_assumption "packV") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"])); + (((use_arg_then2 ("ul", [])) (term_tac exists_tac)) THEN (split_tac)); + (((((use_arg_then2 ("N_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_ul", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["i"]) THEN (move ["i_lt"])); + (((use_arg_then2 ("wl'_props", [])) (disch_tac [])) THEN (clear_assumption "wl'_props") THEN BETA_TAC THEN (case THEN (move ["_"])) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((fun arg_tac -> arg_tac (Arg_term (`i = r`))) (disch_eq_tac "ir" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("ir", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("el_ul", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("y_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`min_dist_k r wl < min_dist_k r ul /\ + (!i. i < k /\ ~(i = r) /\ min_dist_k i wl <= dy ==> min_dist_k i wl <= min_dist_k i ul) /\ + (!i. i < k /\ ~(i = r) /\ dy < min_dist_k i wl ==> dy < min_dist_k i ul)`))) (term_tac (have_gen_tac []ALL_TAC)))); + (BETA_TAC THEN (case THEN (move ["dist_r"])) THEN (case THEN (move ["dist_le"])) THEN (move ["dist_gt"])); + ((THENL_ROT (-1)) (split_tac)); + ((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("c_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("min_k", [min_k]))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`k = sizel (mkseq (\i. f i w) k)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [1] []))))))) ((((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("real_sorted_lt2", [real_sorted_lt2])) (disch_tac [])) THEN (clear_assumption "real_sorted_lt2") THEN (DISCH_THEN apply_tac)) THEN (((fun arg_tac -> arg_tac (Arg_term (`mkseq (\i. f i (vector_of_list 3 ul)) k`))) (term_tac exists_tac)) THEN ((use_arg_then2 ("r", [])) (term_tac exists_tac)))); + ((repeat_tactic 1 9 (((use_arg_then2 ("real_merge_sort", [real_merge_sort]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("r_lt", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("EL_mkseq", [EL_mkseq]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac))); + (((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w_eq", []))(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + (((((use_arg_then2 ("size_eq", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("size_ul", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("vector_of_list_left_inverse", [vector_of_list_left_inverse]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIMINDEX_3", [DIMINDEX_3]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("size_ul", []))(fun tmp_arg1 -> (use_arg_then2 ("size_eq", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((split_tac) THEN (move ["i"]) THEN (case THEN (move ["i_lt"]))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("EL_mkseq", [EL_mkseq]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("size_eq", []))(gsym_then (thm_tac (new_rewrite [1; 2; 3] []))))) THEN (((use_arg_then2 ("size_ul", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] []))))) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("vector_of_list_left_inverse", [vector_of_list_left_inverse]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIMINDEX_3", [DIMINDEX_3]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("size_ul", []))(fun tmp_arg1 -> (use_arg_then2 ("size_eq", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dy_def", []))(thm_tac (new_rewrite [] []))))) THEN (move ["h"]))); + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`i = r`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("dist_le", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`i = r`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("dist_gt", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dy_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("S_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_ul", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_ball_annulus", [in_ball_annulus]))(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [(move ["v"]); ALL_TAC])); + (((((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM_EXISTS_EL", [MEM_EXISTS_EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_ul", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["i"])) THEN (case THEN (move ["i_lt"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("wl_props", [])) (disch_tac [])) THEN (clear_assumption "wl_props") THEN BETA_TAC) THEN (((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("W_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["in_ba"])) THEN (move ["_"]))); + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`i = r`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) (((repeat_tactic 1 9 (((use_arg_then2 ("el_ul", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("in_ball_annulus", [in_ball_annulus]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_ba", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM_EL", [MEM_EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("el_ul", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("norm_u", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_ball_annulus", [in_ball_annulus]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_ba", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`!i. i < sizel ul ==> &2 <= min_dist_k i ul`))) (term_tac (have_gen_tac [](move ["ge2"]))))); + ((((((fun arg_tac -> (use_arg_then2 ("min_dist_imp_packing", [min_dist_imp_packing])) (fun fst_arg -> (use_arg_then2 ("ge2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("min_dist_imp_uniq", [min_dist_imp_uniq]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("ge2", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("size_ul", []))(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["i_lt"])); + (((fun arg_tac -> arg_tac (Arg_term (`i = r`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN ((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("dy", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("dy_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("min_dist_ge", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`dy < min_dist_k i wl`))) (disch_eq_tac "neq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("dy", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("dy_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("min_dist_ge", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dist_gt", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`min_dist_k i wl`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("min_dist_ge", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dist_le", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_NOT_LT", [REAL_NOT_LT]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((use_arg_then2 ("C0", [])) (disch_tac [])) THEN (clear_assumption "C0") THEN ((use_arg_then2 ("sup_n_empty", [])) (disch_tac [])) THEN (clear_assumption "sup_n_empty") THEN ((use_arg_then2 ("c_cont", [])) (disch_tac [])) THEN (clear_assumption "c_cont") THEN ((use_arg_then2 ("c_def", [])) (disch_tac [])) THEN (clear_assumption "c_def") THEN ((use_arg_then2 ("f_def", [])) (disch_tac [])) THEN (clear_assumption "f_def") THEN ((use_arg_then2 ("finV", [])) (disch_tac [])) THEN (clear_assumption "finV") THEN ((use_arg_then2 ("N_def", [])) (disch_tac [])) THEN (clear_assumption "N_def") THEN ((use_arg_then2 ("S_def", [])) (disch_tac [])) THEN (clear_assumption "S_def") THEN ((use_arg_then2 ("k_def", [])) (disch_tac [])) THEN (clear_assumption "k_def") THEN ((use_arg_then2 ("dim_ge", [])) (disch_tac [])) THEN (clear_assumption "dim_ge") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"])); + (((use_arg_then2 ("not_surr", [])) (disch_tac [])) THEN (clear_assumption "not_surr") THEN ((use_arg_then2 ("not_iso", [])) (disch_tac [])) THEN (clear_assumption "not_iso") THEN ((use_arg_then2 ("w_in_all", [])) (disch_tac [])) THEN (clear_assumption "w_in_all") THEN ((use_arg_then2 ("wl'_props", [])) (disch_tac [])) THEN (clear_assumption "wl'_props") THEN ((use_arg_then2 ("wl_props", [])) (disch_tac [])) THEN (clear_assumption "wl_props") THEN ((use_arg_then2 ("w_eq", [])) (disch_tac [])) THEN (clear_assumption "w_eq") THEN ((use_arg_then2 ("w_in", [])) (disch_tac [])) THEN (clear_assumption "w_in") THEN ((use_arg_then2 ("Ck_sub", [])) (disch_tac [])) THEN (clear_assumption "Ck_sub") THEN ((use_arg_then2 ("C_sub", [])) (disch_tac [])) THEN (clear_assumption "C_sub") THEN ((use_arg_then2 ("C_props", [])) (disch_tac [])) THEN (clear_assumption "C_props") THEN ((use_arg_then2 ("CS", [])) (disch_tac [])) THEN (clear_assumption "CS") THEN BETA_TAC THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"]) THEN (move ["_"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`2 <= sizel ul /\ 2 <= sizel wl`))) (term_tac (have_gen_tac [](case THEN ((move ["ul_ge2"]) THEN (move ["wl_ge2"])))))) ((ALL_TAC) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`m < k /\ ~(m = r) ==> dy < dist (EL m wl, u)`))) (term_tac (have_gen_tac ["m"](move ["dist_m_u"])))); + (BETA_TAC THEN (case THEN ((move ["m_lt"]) THEN (move ["m_neq"])))); + (((fun arg_tac -> arg_tac (Arg_term (`EL m wl IN X`))) (disch_eq_tac "el_inX" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LET_TRANS", [REAL_LET_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`dist (y, EL m wl)`))) (term_tac exists_tac))); + (((((use_arg_then2 ("dist_uX", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inX", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DIST_TRIANGLE", [DIST_TRIANGLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`EL m wl`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("u", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("dist_yu", [])) (disch_tac [])) THEN (clear_assumption "dist_yu") THEN BETA_TAC) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] []))))); + ((THENL_LAST) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("e_cond", [])) (fun fst_arg -> (use_arg_then2 ("m_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("m_neq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("el_inX", [])) (disch_tac [])) THEN (clear_assumption "el_inX") THEN ((use_arg_then2 ("contraR", [contraR])) (disch_tac [])) THEN (clear_assumption "contraR") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("NOT_IMP", [NOT_IMP]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["dist_eq"]) THEN (move ["_"]))))); + (((((use_arg_then2 ("X_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("W_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM_EL", [MEM_EL]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (split_tac); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("min_dist_exists", [min_dist_exists])) (fun fst_arg -> (use_arg_then2 ("ul_ge2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("r", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("size_ul", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["m"])) THEN (case THEN (move ["m_lt"])) THEN (case THEN (move ["m_neq"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("el_ul", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dy_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist_m_u", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_ROT (-1)) (((split_tac) THEN (move ["i"]) THEN (case THEN (move ["i_lt"])) THEN (case THEN (move ["i_neq"])) THEN (move ["ineq"])) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("min_dist_exists", [min_dist_exists])) (fun fst_arg -> (use_arg_then2 ("ul_ge2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("size_ul", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["m"])) THEN (case THEN (move ["m_lt"])) THEN (case THEN (move ["m_neq"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`m = r`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("el_ul", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist_m_u", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("el_ul", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN ((use_arg_then2 ("REAL_LTE_TRANS", [REAL_LTE_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`min_dist_k i wl`))) (term_tac exists_tac))); + (((((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("min_dist_min", [min_dist_min]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`m = r`))) (disch_eq_tac "mr" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((((use_arg_then2 ("mr", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("el_ul", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("dy", [])) (term_tac exists_tac))); + (((((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dist_m_u", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then2 ("el_ul", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("min_dist_min", [min_dist_min]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section FNJLBXS *) +let sup_in_unions = Sections.finalize_theorem sup_in_unions;; +let type150_ineq = Sections.finalize_theorem type150_ineq;; +let scriptL_attains_max_in_ball_annulus = Sections.finalize_theorem scriptL_attains_max_in_ball_annulus;; +let FNJLBXS = Sections.finalize_theorem FNJLBXS;; +Sections.end_section "FNJLBXS";; + +(* Section FCDJDOT *) +Sections.begin_section "FCDJDOT";; + +(* Lemma not_surrounded_ECTC *) +let not_surrounded_ECTC = Sections.section_proof ["V";"v"] +`packing V /\ V SUBSET ball_annulus /\ + v IN V /\ ~(surrounded_node (V, ECTC V) v) ==> + (?W f. BIJ f V W /\ packing W /\ W SUBSET ball_annulus /\ + (!u. u IN V ==> norm u = norm (f u)) /\ + set_of_edge (f v) W (ECTC W) = {})` +[ + (BETA_TAC THEN (case THEN (move ["packV"])) THEN (case THEN (move ["subV"])) THEN (case THEN (move ["vV"])) THEN (move ["n_surr"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("finite_packing_ball_annulus", [finite_packing_ball_annulus])) (fun fst_arg -> (use_arg_then2 ("packV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finV"]))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Tame_general.UBHDEUU2", [Tame_general.UBHDEUU2])) (fun fst_arg -> (use_arg_then2 ("packV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((THENL) (ANTS_TAC) [ALL_TAC; (move ["fanV"])])); + ((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`set_of_edge v V (ECTC V) = {}`))) (disch_eq_tac "n_iso" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((use_arg_then2 ("V", [])) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`I`))) (term_tac exists_tac))) THEN ((((use_arg_then2 ("Hypermap.I_BIJ", [Hypermap.I_BIJ]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("not_surrounded_imp_on_one_side_of_plane", [not_surrounded_imp_on_one_side_of_plane])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n_iso", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["n"])) THEN (case THEN (move ["n_n0"])) THEN (case THEN (move ["v_dot_n"])) THEN (move ["w_dot_n"])); + ((fun arg_tac -> arg_tac (Arg_term (`set_of_edge v V (ECTC V)`))) (term_tac (set_tac "X"))); + ((fun arg_tac -> arg_tac (Arg_term (`(V DELETE v) DIFF X`))) (term_tac (set_tac "Y"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`FINITE Y`))) (term_tac (have_gen_tac [](move ["finY"])))) (((((use_arg_then2 ("Y_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("FINITE_DIFF", [FINITE_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_DELETE", [FINITE_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`y IN Y <=> y IN V /\ &2 < dist (y, v)`))) (term_tac (have_gen_tac ["y"](move ["inY"])))); + ((THENL_ROT (-1)) (((((use_arg_then2 ("Y_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("X_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_set_of_edge_ECTC", [in_set_of_edge_ECTC]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (split_tac))); + ((THENL_LAST) ((BETA_TAC THEN (case THEN ((move ["yV"]) THEN (move ["dist_gt"])))) THEN ((((use_arg_then2 ("yV", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)) ((((use_arg_then2 ("dist_gt", [])) (disch_tac [])) THEN (clear_assumption "dist_gt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("dist_gt", [])) (disch_tac [])) THEN (clear_assumption "dist_gt") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("DIST_REFL", [DIST_REFL]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((BETA_TAC THEN (case THEN ALL_TAC) THEN (case THEN (move ["yV"])) THEN (move ["ynv"])) THEN (((((use_arg_then2 ("yV", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_LT_LE", [REAL_LT_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((in_tac ["packV"] false (((use_arg_then2 ("packing", [packing]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("packV", [])) (disch_tac [])) THEN (clear_assumption "packV") THEN (DISCH_THEN apply_tac)) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`x IN X <=> x IN V /\ dist (x, v) = &2`))) (term_tac (have_gen_tac ["x"](move ["inX"])))); + (((((use_arg_then2 ("X_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_set_of_edge_ECTC", [in_set_of_edge_ECTC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`y IN V /\ ~(y = v) /\ ~(y IN Y) ==> y IN X`))) (term_tac (have_gen_tac ["y"](move ["not_inY"])))); + ((((((use_arg_then2 ("Y_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`if Y = {} then &1 else min (&1) (inf (IMAGE (\x. dist (x,v) - &2) Y))`))) (term_tac (set_tac "e"))); + ((fun arg_tac -> arg_tac (Arg_term (`&0 < e`))) (term_tac (have_gen_tac [](move ["e_gt0"])))); + ((THENL_FIRST) ((((use_arg_then2 ("e_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_term (`Y = {}`))) (disch_eq_tac "Y0" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))) (((use_arg_then2 ("REAL_LT_01", [REAL_LT_01])) (disch_tac [])) THEN (clear_assumption "REAL_LT_01") THEN (exact_tac))); + ((((use_arg_then2 ("REAL_LT_MIN", [REAL_LT_MIN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_01", [REAL_LT_01]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("REAL_LT_INF_FINITE", [REAL_LT_INF_FINITE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IMAGE_EQ_EMPTY", [IMAGE_EQ_EMPTY]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"]) THEN (case THEN (move ["y"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("inY", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`e <= &1`))) (term_tac (have_gen_tac [](move ["e_le1"])))) ((((use_arg_then2 ("e_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("perturbation_lemma", [perturbation_lemma])) (fun fst_arg -> (use_arg_then2 ("X", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("e_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n_n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v_dot_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)); + ((BETA_TAC THEN (move ["w"]) THEN (move ["wX"])) THEN ((((use_arg_then2 ("w_dot_n", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("wX", [])) (disch_tac [])) THEN (clear_assumption "wX") THEN ((use_arg_then2 ("subV", [])) (disch_tac [])) THEN (clear_assumption "subV") THEN BETA_TAC) THEN (((((use_arg_then2 ("X_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_set_of_edge_ECTC", [in_set_of_edge_ECTC]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_gt", [real_gt]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["subV"]) THEN (case THEN ((move ["wV"]) THEN (move ["dist_eq"]))))); + ((((use_arg_then2 ("Ckqowsa_3_points.dot_pos_lemma", [Ckqowsa_3_points.dot_pos_lemma])) (disch_tac [])) THEN (clear_assumption "Ckqowsa_3_points.dot_pos_lemma") THEN (DISCH_THEN apply_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("subV", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("Sphere.h0", [Sphere.h0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist_eq", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + (BETA_TAC THEN (case THEN (move ["u"])) THEN (case THEN (move ["norm_eq"])) THEN (case THEN (move ["dist_lt"])) THEN (move ["dist_vu"])); + ((fun arg_tac -> arg_tac (Arg_term (`~(v = u)`))) (term_tac (have_gen_tac [](move ["n_vu"])))); + ((((use_arg_then2 ("contraT", [contraT])) (disch_tac [])) THEN (clear_assumption "contraT") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] [])))) THEN (move ["v_eq_u"]))); + ((((use_arg_then2 ("n_iso", [])) (disch_tac [])) THEN (clear_assumption "n_iso") THEN BETA_TAC) THEN ((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("dist_lt", [])) (thm_tac (match_mp_then snd_th MP_TAC)))))); + (((((use_arg_then2 ("v_eq_u", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_REFL", [REAL_LT_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`~(u IN V)`))) (term_tac (have_gen_tac [](move ["nuV"])))); + ((((use_arg_then2 ("contraT", [contraT])) (disch_tac [])) THEN (clear_assumption "contraT") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] [])))) THEN (move ["uV"])) THEN (in_tac ["packV"] false (((use_arg_then2 ("packing", [packing]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("e_le1", [])) (disch_tac [])) THEN (clear_assumption "e_le1") THEN ((use_arg_then2 ("dist_vu", [])) (disch_tac [])) THEN (clear_assumption "dist_vu") THEN ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("packV", [])) (fun fst_arg -> (use_arg_then2 ("vV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("uV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n_vu", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`u INSERT (V DELETE v)`))) (term_tac (set_tac "W"))); + ((fun arg_tac -> arg_tac (Arg_term (`\x. if x = v then u else x`))) (term_tac (set_tac "f"))); + ((((use_arg_then2 ("W", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("f", [])) (term_tac exists_tac))) THEN (split_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(CARD V = 0)`))) (term_tac (have_gen_tac [](move ["card_n0"])))) (((((use_arg_then2 ("CARD_EQ_0", [CARD_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN (done_tac))); + ((((use_arg_then2 ("Hypermap_iso.finite_surj_eq_bij", [Hypermap_iso.finite_surj_eq_bij]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("W_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_INSERT", [FINITE_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("CARD_CLAUSES", [CARD_CLAUSES]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_DELETE", [FINITE_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("finV", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nuV", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("CARD_DELETE", [CARD_DELETE]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("vV", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then2 ("card_n0", [])) (disch_tac [])) THEN (clear_assumption "card_n0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ((THENL) (split_tac) [((move ["x"]) THEN (move ["xV"])); ALL_TAC])); + ((((fun arg_tac -> arg_tac (Arg_term (`x = v`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN ((((use_arg_then2 ("xV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((THENL) (BETA_TAC THEN (move ["x"]) THEN ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (case THEN ((move ["xV"]) THEN (move ["xnv"])))])) [((use_arg_then2 ("v", [])) (term_tac exists_tac)); ((use_arg_then2 ("x", [])) (term_tac exists_tac))]) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`x IN V ==> norm x = norm (f x)`))) (term_tac (have_gen_tac ["x"](move ["norm_eqV"])))); + ((BETA_TAC THEN (move ["xV"])) THEN ((((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (((fun arg_tac -> arg_tac (Arg_term (`x = v`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("norm_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`!x. x IN V /\ ~(x = v) ==> &2 < dist (x, u)`))) (term_tac (have_gen_tac [](move ["dist_gt2"])))); + ((BETA_TAC THEN (move ["x"]) THEN (case THEN ((move ["xV"]) THEN (move ["xnv"])))) THEN (in_tac ["packV"] false (((use_arg_then2 ("packing", [packing]))(thm_tac (new_rewrite [] [])))))); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`x IN Y`))) (disch_eq_tac "xY" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("not_inY", [])) (fun fst_arg -> (use_arg_then2 ("xY", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("xV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("xnv", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("dist_lt", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("REAL_LET_TRANS", [REAL_LET_TRANS])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("packV", [])) (disch_tac [])) THEN (clear_assumption "packV") THEN (DISCH_THEN apply_tac)) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(Y = {})`))) (term_tac (have_gen_tac [](move ["Yn0"])))) ((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("packV", [])) (fun fst_arg -> (use_arg_then2 ("xV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("xnv", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("dist_vu", [])) (disch_tac [])) THEN (clear_assumption "dist_vu") THEN ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DIST_TRIANGLE", [DIST_TRIANGLE])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("u", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`e <= dist (x, v) - &2`))) (term_tac (have_gen_tac []ALL_TAC)))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("e_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Yn0", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_MIN_LE", [REAL_MIN_LE]))(thm_tac (new_rewrite [] []))))) THEN (DISJ2_TAC)); + ((((use_arg_then2 ("REAL_INF_LE_FINITE", [REAL_INF_LE_FINITE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IMAGE_EQ_EMPTY", [IMAGE_EQ_EMPTY]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`dist (x, v) - &2`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); + ((((use_arg_then2 ("packing", [packing]))(thm_tac (new_rewrite [] [])))) THEN ((THENL) (split_tac) [((move ["x"]) THEN (move ["y"])); ALL_TAC])); + (((((use_arg_then2 ("W_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))))) THEN (in_tac ["packV"] false (((use_arg_then2 ("packing", [packing]))(thm_tac (new_rewrite [] [])))))); + ((THENL_LAST) (BETA_TAC THEN (case THEN ALL_TAC) THEN ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (case THEN ((move ["xV"]) THEN (move ["xnv"])))]) THEN (case THEN ALL_TAC) THEN ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (case THEN ((move ["yV"]) THEN (move ["ynv"])))]) THEN ((TRY done_tac)) THEN (move ["neq"])) ((((use_arg_then2 ("packV", [])) (disch_tac [])) THEN (clear_assumption "packV") THEN (DISCH_THEN apply_tac)) THEN (done_tac))); + (((((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist_gt2", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist_gt2", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((in_tac ["subV"] true ((repeat_tactic 1 9 (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_ball_annulus", [in_ball_annulus]))(thm_tac (new_rewrite [] []))))))) THEN ((THENL) (split_tac) [(move ["x"]); ALL_TAC])); + ((((use_arg_then2 ("W_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))); + (((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (case THEN ((move ["xV"]) THEN (move ["xnv"])))]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("norm_eq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("subV", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((THENL) (split_tac) [((move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("norm_eqV", [])) (thm_tac (match_mp_then snd_th MP_TAC))))); ALL_TAC]) THEN ((TRY done_tac))); + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (move ["x"])) THEN ((((use_arg_then2 ("in_set_of_edge_ECTC", [in_set_of_edge_ECTC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("f_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("W_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("dist_gt2", [])) (disch_tac [])) THEN (clear_assumption "dist_gt2") THEN ((use_arg_then2 ("contraTF", [contraTF])) (disch_tac [])) THEN (clear_assumption "contraTF") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("NOT_FORALL_THM", [NOT_FORALL_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IMP", [NOT_IMP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) (BETA_TAC THEN (case THEN ALL_TAC) THEN ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [1] [])))); (case THEN ((move ["xV"]) THEN (move ["xnv"]) THEN (move ["dist_eq2"])))])) ((((use_arg_then2 ("DIST_REFL", [DIST_REFL]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (repeat_tactic 1 9 (((split_tac) THEN ((TRY done_tac))))) THEN ((((use_arg_then2 ("dist_eq2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_REFL", [REAL_LT_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma isolated_node_norm_ECTC *) +let isolated_node_norm_ECTC = Sections.section_proof ["V";"v"] +`packing V /\ V SUBSET ball_annulus /\ + (!W. packing W /\ W SUBSET ball_annulus ==> scriptL W <= scriptL V) /\ + v IN V /\ set_of_edge v V (ECTC V) = {} + ==> norm v = &2` +[ + (BETA_TAC THEN (case THEN (move ["packV"])) THEN (case THEN (move ["subV"])) THEN (case THEN (move ["maxV"])) THEN (case THEN (move ["vV"])) THEN (move ["edges0"])); + ((THENL) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_LET_TOTAL", [REAL_LET_TOTAL])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`norm v`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [ALL_TAC; (move ["norm_gt2"])]); + ((in_tac ["subV"] false (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("subV", [])) (fun fst_arg -> (use_arg_then2 ("vV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("in_ball_annulus", [in_ball_annulus]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("finite_packing_ball_annulus", [finite_packing_ball_annulus])) (fun fst_arg -> (use_arg_then2 ("packV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["finV"]))); + ((fun arg_tac -> arg_tac (Arg_term (`{dist (u, v) - &2 | u | u IN V /\ ~(u = v)}`))) (term_tac (set_tac "D"))); + ((fun arg_tac -> arg_tac (Arg_term (`FINITE D`))) (term_tac (have_gen_tac [](move ["finD"])))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`D = IMAGE (\x. dist (x,v) - &2) (V DELETE v)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) (((((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_DELETE", [FINITE_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("D_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])); + (((THENL) (split_tac) [((case THEN (move ["u"])) THEN (case THEN (move ["h"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); ((case THEN (move ["u"])) THEN (case THEN (move ["x_eq"])) THEN (move ["h"]))]) THEN ((use_arg_then2 ("u", [])) (term_tac exists_tac)) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`~(D = {})`))) (term_tac (have_gen_tac [](move ["D_n0"])))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`~(V DELETE v = {})`))) (term_tac (have_gen_tac []ALL_TAC)))); + (((repeat_tactic 1 9 (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["u"])) THEN (case THEN ((move ["uV"]) THEN (move ["unv"])))); + (((fun arg_tac -> arg_tac (Arg_term (`dist (u, v) - &2`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("D_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("u", [])) (term_tac exists_tac)) THEN (done_tac)); + ((((use_arg_then2 ("maxV", [])) (disch_tac [])) THEN (clear_assumption "maxV") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("NOT_FORALL_THM", [NOT_FORALL_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] []))))) THEN (move ["inV"]))); + ((fun arg_tac -> arg_tac (Arg_term (`(&2 / norm v) % v`))) (term_tac (set_tac "w"))); + ((fun arg_tac -> arg_tac (Arg_term (`norm w = &2`))) (term_tac (have_gen_tac [](move ["norm_w"])))); + ((((use_arg_then2 ("w_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("NORM_MUL", [NORM_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_MUL", [REAL_ABS_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_INV", [REAL_ABS_INV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_NORM", [REAL_ABS_NORM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("REAL_MUL_LINV", [REAL_MUL_LINV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("norm_gt2", [])) (disch_tac [])) THEN (clear_assumption "norm_gt2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`~(w = --w:real^3)`))) (term_tac (have_gen_tac [](move ["neg_w"])))); + ((((use_arg_then2 ("norm_w", [])) (disch_tac [])) THEN (clear_assumption "norm_w") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("vector_eq_neg", [vector_eq_neg]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("NORM_0", [NORM_0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`{w:real^3, --w}`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("NOT_IMP", [NOT_IMP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NOT_LE", [REAL_NOT_LE]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`V = {v}`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])) THEN ((THENL) (split_tac) [(move ["xV"]); ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))])); + ((((fun arg_tac -> (use_arg_then2 ("inV", [])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("xV", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); + ((THENL_ROT (-1)) (split_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("Tame_defs.scriptL", [Tame_defs.scriptL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_SING", [SUM_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_CLAUSES", [SUM_CLAUSES]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_SING", [FINITE_SING]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_SING", [SUM_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SING", [IN_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("neg_w", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("NORM_NEG", [NORM_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("norm_w", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("Sphere.lmfun", [Sphere.lmfun])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&2 / &2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Sphere.h0", [Sphere.h0]))(thm_tac (new_rewrite [] []))))); + ((in_tac ["subV"] false (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("lmfun_in_ball_annulus", [lmfun_in_ball_annulus])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("subV", [])) (fun fst_arg -> (use_arg_then2 ("vV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then2 ("packing", [packing]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("in_ball_annulus", [in_ball_annulus]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (case THEN ALL_TAC) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN ((repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`--w:real^3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] []))))) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (VECTOR_ARITH `w - --w = &2 % w:real^3`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NORM_MUL", [NORM_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("norm_w", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((BETA_TAC THEN (move ["x"]) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("NORM_NEG", [NORM_NEG]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("norm_w", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Sphere.h0", [Sphere.h0]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`min (inf D) (norm v - &2) / norm v`))) (term_tac (set_tac "e"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < norm v`))) (term_tac (have_gen_tac [](move ["norm_gt0"])))) ((((use_arg_then2 ("norm_gt2", [])) (disch_tac [])) THEN (clear_assumption "norm_gt2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`&0 < inf D`))) (term_tac (have_gen_tac [](move ["inf_gt0"])))); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_LT_INF_FINITE", [REAL_LT_INF_FINITE])) (fun fst_arg -> (use_arg_then2 ("finD", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("D_n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("D_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"]) THEN (case THEN (move ["u"])) THEN (case THEN (case THEN ((move ["uV"]) THEN (move ["nuv"])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("edges0", [])) (disch_tac [])) THEN (clear_assumption "edges0") THEN ((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_SUB_LT", [REAL_SUB_LT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NOT_LT", [REAL_NOT_LT]))(thm_tac (new_rewrite [] []))))) THEN (move ["dist_le"]))); + (((use_arg_then2 ("u", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("set_of_edge", [set_of_edge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ECTC", [ECTC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("uV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("u", [])) (term_tac exists_tac))) THEN (repeat_tactic 1 9 (((split_tac) THEN ((TRY done_tac)))))); + ((in_tac ["packV"] false (((use_arg_then2 ("packing", [packing]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_ANTISYM", [REAL_LE_ANTISYM]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dist_le", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("packV", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`&0 < e`))) (term_tac (have_gen_tac [](move ["e_gt0"])))); + ((((((use_arg_then2 ("e_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LT_DIV", [REAL_LT_DIV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_MIN", [REAL_LT_MIN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inf_gt0", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("norm_gt2", [])) (disch_tac [])) THEN (clear_assumption "norm_gt2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`e < &1`))) (term_tac (have_gen_tac [](move ["e_lt1"])))); + (((((use_arg_then2 ("e_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Arc_properties.REAL_LT_ONE_LDIV", [Arc_properties.REAL_LT_ONE_LDIV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MIN_LT", [REAL_MIN_LT]))(thm_tac (new_rewrite [] []))))) THEN (split_tac) THEN (((use_arg_then2 ("norm_gt2", [])) (disch_tac [])) THEN (clear_assumption "norm_gt2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(&1 - e) % v`))) (term_tac (set_tac "w"))); + ((fun arg_tac -> arg_tac (Arg_term (`norm w < norm v`))) (term_tac (have_gen_tac [](move ["norm_w_lt"])))); + ((((use_arg_then2 ("w_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("NORM_MUL", [NORM_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`norm v`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [2] [])))))); + (((((use_arg_then2 ("REAL_LT_RMUL", [REAL_LT_RMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("norm_gt0", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("e_gt0", [])) (disch_tac [])) THEN (clear_assumption "e_gt0") THEN ((use_arg_then2 ("e_lt1", [])) (disch_tac [])) THEN (clear_assumption "e_lt1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`&2 <= norm w`))) (term_tac (have_gen_tac [](move ["norm_w_ge2"])))); + ((((use_arg_then2 ("w_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("e_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("NORM_MUL", [NORM_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("REAL_DIV_1", [REAL_DIV_1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL RAT_LEMMA3)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("norm_gt0", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_01", [REAL_LT_01]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("REAL_INV_1", [REAL_INV_1]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_MUL", [REAL_ABS_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_INV", [REAL_ABS_INV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_NORM", [REAL_ABS_NORM]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_LINV", [REAL_MUL_LINV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("REAL_POS_NZ", [REAL_POS_NZ])) (fun fst_arg -> (use_arg_then2 ("norm_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); + (in_tac ["subV"] false ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("in_ball_annulus", [in_ball_annulus]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Sphere.h0", [Sphere.h0]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`dist (v, w) = min (inf D) (norm v - &2)`))) (term_tac (have_gen_tac [](move ["d_vw"])))); + ((((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (VECTOR_ARITH `!v. v - (&1 - e) % v = e % v`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NORM_MUL", [NORM_MUL]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("e_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_MUL", [REAL_ABS_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_INV", [REAL_ABS_INV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_NORM", [REAL_ABS_NORM]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_LINV", [REAL_MUL_LINV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("REAL_POS_NZ", [REAL_POS_NZ])) (fun fst_arg -> (use_arg_then2 ("norm_gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_MUL_RID", [REAL_MUL_RID]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("norm_gt2", [])) (disch_tac [])) THEN (clear_assumption "norm_gt2") THEN ((use_arg_then2 ("inf_gt0", [])) (disch_tac [])) THEN (clear_assumption "inf_gt0") THEN ((fun arg_tac -> (use_arg_then2 ("subV", [])) (fun fst_arg -> (use_arg_then2 ("vV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`~(w IN V DELETE v)`))) (term_tac (have_gen_tac [](move ["in_w"])))); + (((((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] []))))) THEN (DISJ1_TAC)); + ((((use_arg_then2 ("packV", [])) (disch_tac [])) THEN (clear_assumption "packV") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (move ["wV"])) THEN ((((use_arg_then2 ("packing", [packing]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("NOT_FORALL_THM", [NOT_FORALL_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("NOT_IMP", [NOT_IMP]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("w", [])) (term_tac exists_tac))) THEN (repeat_tactic 1 9 (((split_tac) THEN ((TRY done_tac)))))); + ((((use_arg_then2 ("norm_w_lt", [])) (disch_tac [])) THEN (clear_assumption "norm_w_lt") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LT_REFL", [REAL_LT_REFL]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("d_vw", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inf_gt0", [])) (disch_tac [])) THEN (clear_assumption "inf_gt0") THEN ((use_arg_then2 ("norm_gt2", [])) (disch_tac [])) THEN (clear_assumption "norm_gt2") THEN ((fun arg_tac -> (use_arg_then2 ("subV", [])) (fun fst_arg -> (use_arg_then2 ("vV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`w INSERT (V DELETE v)`))) (term_tac (set_tac "W"))); + ((((use_arg_then2 ("maxV", [])) (disch_tac [])) THEN (clear_assumption "maxV") THEN ((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac) THEN (move ["_"])) THEN ((((use_arg_then2 ("NOT_FORALL_THM", [NOT_FORALL_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IMP", [NOT_IMP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NOT_LE", [REAL_NOT_LE]))(thm_tac (new_rewrite [] [])))))); + ((THENL_ROT (-1)) (((use_arg_then2 ("W", [])) (term_tac exists_tac)) THEN (split_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("Tame_defs.scriptL", [Tame_defs.scriptL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("W_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_CLAUSES", [SUM_CLAUSES]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_DELETE", [FINITE_DELETE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("in_w", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("SUM_DELETE", [SUM_DELETE]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`lmfun (norm v / &2) < lmfun (norm w / &2)`))) (term_tac (have_gen_tac []ALL_TAC)))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("norm_w_lt", [])) (disch_tac [])) THEN (clear_assumption "norm_w_lt") THEN ((fun arg_tac -> (use_arg_then2 ("subV", [])) (fun fst_arg -> (use_arg_then2 ("vV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("Sphere.lmfun", [Sphere.lmfun]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Sphere.h0", [Sphere.h0]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((THENL_ROT (-1)) (((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("packing", [packing]))(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [((move ["x"]) THEN (move ["y"])); (move ["x"])]))); + ((((use_arg_then2 ("W_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("in_ball_annulus", [in_ball_annulus]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Sphere.h0", [Sphere.h0]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); ALL_TAC]) ((((fun arg_tac -> (use_arg_then2 ("subV", [])) (fun fst_arg -> (use_arg_then2 ("vV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("norm_w_lt", [])) (disch_tac [])) THEN (clear_assumption "norm_w_lt") THEN ((use_arg_then2 ("norm_w_ge2", [])) (disch_tac [])) THEN (clear_assumption "norm_w_ge2") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((BETA_TAC THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("subV", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("W_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))))) THEN (in_tac ["packV"] false (((use_arg_then2 ("packing", [packing]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`z IN V /\ ~(z = v) ==> &2 <= dist (z, w)`))) (term_tac (have_gen_tac ["z"](move ["h"])))); + ((THENL_ROT (-1)) ((BETA_TAC THEN (case THEN ((move ["zV"]) THEN (move ["znv"])))) THEN (((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`dist (z, v) - dist (v, w)`))) (term_tac exists_tac)) THEN (split_tac))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DIST_TRIANGLE", [DIST_TRIANGLE])) (fun fst_arg -> (use_arg_then2 ("z", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`dist (z, v) - inf D`))) (term_tac exists_tac))); + ((THENL_LAST) ((((use_arg_then2 ("d_vw", []))(thm_tac (new_rewrite [] [])))) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`inf D <= dist (z,v) - &2`))) (term_tac (have_gen_tac []ALL_TAC)))) ((arith_tac) THEN (done_tac))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("REAL_INF_LE_FINITE", [REAL_INF_LE_FINITE])) (fun fst_arg -> (use_arg_then2 ("finD", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("D_n0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))); + (((fun arg_tac -> arg_tac (Arg_term (`dist (z,v) - &2`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("D_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + (((use_arg_then2 ("z", [])) (term_tac exists_tac)) THEN (done_tac)); + ((THENL_LAST) (BETA_TAC THEN (case THEN ALL_TAC) THEN ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (case THEN ((move ["xV"]) THEN (move ["xnv"])))]) THEN (case THEN ALL_TAC) THEN ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (case THEN ((move ["yV"]) THEN (move ["ynv"])))]) THEN ((TRY done_tac)) THEN (move ["neq"])) ((((use_arg_then2 ("packV", [])) (disch_tac [])) THEN (clear_assumption "packV") THEN (DISCH_THEN apply_tac)) THEN (done_tac))); + (((((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma not_surrounded_node_norm_ECTC *) +let not_surrounded_node_norm_ECTC = Sections.section_proof ["V";"v"] +`packing V /\ V SUBSET ball_annulus /\ + (!W. packing W /\ W SUBSET ball_annulus ==> scriptL W <= scriptL V) /\ + v IN V /\ ~(surrounded_node (V, ECTC V) v) + ==> norm v = &2` +[ + (BETA_TAC THEN (case THEN (move ["packV"])) THEN (case THEN (move ["subV"])) THEN (case THEN (move ["maxV"])) THEN (case THEN (move ["vV"])) THEN (move ["n_surr"])); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("not_surrounded_ECTC", [not_surrounded_ECTC])) (fun fst_arg -> (use_arg_then2 ("packV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("n_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["W"]) THEN (case THEN (move ["f"])) THEN (case THEN (move ["bij_f"])) THEN (case THEN (move ["packW"])) THEN (case THEN (move ["subW"])) THEN (case THEN (move ["normW"])) THEN (move ["isoW"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`packing U /\ U SUBSET ball_annulus ==> scriptL U <= scriptL W`))) (term_tac (have_gen_tac ["U"](move ["maxW"])))); + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("maxV", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((fun arg_tac -> (use_arg_then2 ("bij_scriptL", [bij_scriptL])) (fun fst_arg -> (use_arg_then2 ("bij_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((THENL_LAST) (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("isolated_node_norm_ECTC", [isolated_node_norm_ECTC])) (fun fst_arg -> (use_arg_then2 ("packW", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subW", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("maxW", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("isoW", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)) ((((use_arg_then2 ("normW", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("bij_f", [])) (disch_tac [])) THEN (clear_assumption "bij_f") THEN BETA_TAC) THEN (((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma radV_2 *) +let radV_2 = Sections.section_proof ["a";"b"] +`radV {a,b} = norm (b - a) / &2` +[ + ((((fun arg_tac -> (use_arg_then2 ("Rogers.OAPVION2", [Rogers.OAPVION2])) (fun fst_arg -> (use_arg_then2 ("b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("AFFINE_INDEPENDENT_2", [AFFINE_INDEPENDENT_2]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("Rogers.CIRCUMCENTER_2", [Rogers.CIRCUMCENTER_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("midpoint", [midpoint]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`inv(&2) % (a + b) - b = inv (&2) % (a - b)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((VECTOR_ARITH_TAC) THEN (done_tac))); + (((((use_arg_then2 ("NORM_MUL", [NORM_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_INV", [REAL_ABS_INV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ABS_NUM", [REAL_ABS_NUM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NORM_SUB", [NORM_SUB]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma hl2 *) +let hl2 = Sections.section_proof ["a";"b"] +`hl [a;b] = norm (b - a) / &2` +[ + (((((use_arg_then2 ("Pack_defs.HL", [Pack_defs.HL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL set_of_list)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("radV_2", [radV_2]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma lmfun_ineq_center_scriptL *) +let lmfun_ineq_center_scriptL = Sections.section_proof ["V"] +`lmfun_ineq_center V <=> scriptL V <= &12` +[ + (((((use_arg_then2 ("Pack_defs.lmfun_ineq_center", [Pack_defs.lmfun_ineq_center]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("scriptL", [scriptL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hl2", [hl2]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL VECTOR_SUB_RZERO)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma FCDJDOT *) +let FCDJDOT = Sections.section_proof [] +`pack_ineq_def_a ==> + (?W. packing W /\ W SUBSET ball_annulus /\ scriptL W > &12) ==> + (?V. contravening V)` +[ + (BETA_TAC THEN (move ["ineqs"]) THEN (case THEN (move ["W0"])) THEN (move ["W0_props"])); + (((use_arg_then2 ("scriptL_attains_max_in_ball_annulus", [scriptL_attains_max_in_ball_annulus])) (disch_tac [])) THEN (clear_assumption "scriptL_attains_max_in_ball_annulus") THEN BETA_TAC THEN (case THEN (move ["W1"])) THEN (case THEN (move ["packW1"])) THEN (case THEN (move ["subW1"])) THEN (move ["W1max"])); + ((fun arg_tac -> arg_tac (Arg_term (`scriptL W1 > &12`))) (term_tac (have_gen_tac [](move ["W1_gt12"])))); + ((((fun arg_tac -> (use_arg_then2 ("W1max", [])) (fun fst_arg -> (use_arg_then2 ("W0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("W0_props", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] []))))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("REAL_LTE_TRANS", [REAL_LTE_TRANS])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("real_gt", [real_gt]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FNJLBXS", [FNJLBXS])) (fun fst_arg -> (use_arg_then2 ("packW1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subW1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["V"])) THEN (case THEN (move ["f"])) THEN (case THEN (move ["bij_f"])) THEN (case THEN (move ["packV"])) THEN (case THEN (move ["subV"])) THEN (case THEN (move ["norm_eq"])) THEN (move ["V_ESTD"])); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("bij_scriptL", [bij_scriptL])) (fun fst_arg -> (use_arg_then2 ("bij_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("norm_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["LV_eq"]))); + (((use_arg_then2 ("V", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("contravening", [contravening]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("packV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LV_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("W1_gt12", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + (((split_tac) THEN ((TRY done_tac))) THEN (split_tac)); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Counting_spheres.DLWCHEM", [Counting_spheres.DLWCHEM])) (fun fst_arg -> (use_arg_then2 ("packV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineqs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((((use_arg_then2 ("lmfun_ineq_center_scriptL", [lmfun_ineq_center_scriptL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NOT_LE", [REAL_NOT_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LV_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_gt", [real_gt]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL_ROT (-1)) ((split_tac) THEN (move ["v"]) THEN (move ["vV"]))); + (((fun arg_tac -> arg_tac (Arg_term (`surrounded_node _1 v`))) (disch_eq_tac "h" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((fun arg_tac -> (use_arg_then2 ("not_surrounded_node_norm_ECTC", [not_surrounded_node_norm_ECTC])) (fun fst_arg -> (use_arg_then2 ("packV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("V_ESTD", [])) (fun fst_arg -> (use_arg_then2 ("vV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (case THEN ((TRY done_tac)) THEN (move ["set0"])) THEN (((use_arg_then2 ("contraT", [contraT])) (disch_tac [])) THEN (clear_assumption "contraT") THEN (DISCH_THEN apply_tac) THEN (move ["_"]))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Counting_spheres.XULJEPR", [Counting_spheres.XULJEPR])) (fun fst_arg -> (use_arg_then2 ("packV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("subV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineqs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("implybF", [implybF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IMP", [NOT_IMP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lmfun_ineq_center_scriptL", [lmfun_ineq_center_scriptL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NOT_LE", [REAL_NOT_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LV_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_gt", [real_gt]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("W1_gt12", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN (repeat_tactic 1 9 (((split_tac) THEN ((TRY done_tac)))))); + ((((fun arg_tac -> (use_arg_then2 ("isolated_node_norm_ECTC", [isolated_node_norm_ECTC])) (fun fst_arg -> (use_arg_then2 ("packV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (repeat_tactic 1 9 (((split_tac) THEN ((TRY done_tac)))))); + ((((use_arg_then2 ("set0", [])) (disch_tac [])) THEN (clear_assumption "set0") THEN ((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["x"])))); + (((repeat_tactic 1 9 (((use_arg_then2 ("set_of_edge", [set_of_edge]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))))) THEN (((fun arg_tac -> (use_arg_then2 ("ECTC_sub_ESTD", [ECTC_sub_ESTD])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["subCS"]))); + ((BETA_TAC THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("subCS", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (move ["inS"]) THEN (move ["xV"])) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); + ((BETA_TAC THEN (move ["u"]) THEN (case THEN (move ["uV"])) THEN (move ["nuv"])) THEN (((use_arg_then2 ("set0", [])) (disch_tac [])) THEN (clear_assumption "set0") THEN ((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac))); + (((((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_NOT_LE", [REAL_NOT_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Pack_defs.h0", [Pack_defs.h0]))(thm_tac (new_rewrite [] []))))) THEN (move ["dist_lt"])); + (((use_arg_then2 ("u", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("set_of_edge", [set_of_edge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Tame_general.IN_ESTD", [Tame_general.IN_ESTD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("uV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vV", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nuv", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("dist_lt", [])) (disch_tac [])) THEN (clear_assumption "dist_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section FCDJDOT *) +let not_surrounded_ECTC = Sections.finalize_theorem not_surrounded_ECTC;; +let isolated_node_norm_ECTC = Sections.finalize_theorem isolated_node_norm_ECTC;; +let not_surrounded_node_norm_ECTC = Sections.finalize_theorem not_surrounded_node_norm_ECTC;; +let radV_2 = Sections.finalize_theorem radV_2;; +let hl2 = Sections.finalize_theorem hl2;; +let lmfun_ineq_center_scriptL = Sections.finalize_theorem lmfun_ineq_center_scriptL;; +let FCDJDOT = Sections.finalize_theorem FCDJDOT;; +Sections.end_section "FCDJDOT";; + +(* Close the module *) +end;; diff --git a/text_formalization/tame/ssreflect/KCBLRQC-compiled.hl b/text_formalization/tame/ssreflect/KCBLRQC-compiled.hl new file mode 100644 index 0000000..8db48dc --- /dev/null +++ b/text_formalization/tame/ssreflect/KCBLRQC-compiled.hl @@ -0,0 +1,1054 @@ +needs "../formal_lp/hypermap/ineqs/lp_ineqs_proofs-compiled.hl";; +needs "../formal_lp/hypermap/ineqs/lp_main_estimate-compiled.hl";; +needs "tame/CDTETAT.hl";; + +(* Module Kcblrqc*) +module Kcblrqc = struct + +open Ssrbool;; +open Ssrnat;; +open Hypermap;; +open Lp_ineqs_proofs;; +open Lp_main_estimate;; +open Tame_lemmas;; +open Tame_defs;; +open Tame_general;; +open Hypermap_and_fan;; +open Hypermap_iso;; +let a_azim = new_definition `a_azim f_test V d = + (let H = hypermap_of_fan (V,ESTD V) in + let s = {y | y IN node H d /\ f_test (CARD (face H y))} in + sum s (azim_dart (V,ESTD V)) / &(CARD s))`;; +let a_tau = new_definition `a_tau f_test V d = + (let H = hypermap_of_fan (V,ESTD V) in + let s = {y | y IN node H d /\ f_test (CARD (face H y))} in + sum s (\y. tauVEF (V, ESTD V, face H y)) / &(CARD s))`;; + +(* Lemma a_sum_mul *) +let a_sum_mul = Sections.section_proof ["s";"f"] +`FINITE s ==> &(CARD s) * (sum s f / &(CARD s)) = sum s f` +[ + ((BETA_TAC THEN (move ["fin_s"])) THEN (((fun arg_tac -> arg_tac (Arg_term (`CARD s = 0`))) (disch_eq_tac "card0" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + ((((use_arg_then2 ("card0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LZERO", [REAL_MUL_LZERO]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("card0", [])) (disch_tac [])) THEN (clear_assumption "card0") THEN BETA_TAC) THEN (((((use_arg_then2 ("CARD_EQ_0", [CARD_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_CLAUSES", [SUM_CLAUSES]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((use_arg_then2 ("REAL_DIV_LMUL", [REAL_DIV_LMUL]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_OF_NUM_EQ", [REAL_OF_NUM_EQ]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Contravening *) +Sections.begin_section "Contravening";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_hyp "contrV" (`contravening V`));; + +(* Let h_fan *) +Sections.add_section_lemma "h_fan" (Sections.section_proof [] +`lp_fan (V,ESTD V)` +[ + ((((use_arg_then2 ("contravening_lp_fan", [contravening_lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let fanV *) +Sections.add_section_lemma "fanV" (Sections.section_proof [] +`FAN (vec 0,V,ESTD V)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; + +(* Let f_surr *) +Sections.add_section_lemma "f_surr" (Sections.section_proof [] +`fully_surrounded (V,ESTD V)` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; + +(* Let simpleH *) +Sections.add_section_lemma "simpleH" (Sections.section_proof [] +`simple_hypermap (hypermap_of_fan (V,ESTD V))` +[ + ((((use_arg_then2 ("Jgtdebu.JGTDEBU4", [Jgtdebu.JGTDEBU4]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let dartH *) +Sections.add_section_lemma "dartH" (Sections.section_proof [] +`dart (hypermap_of_fan (V,ESTD V)) = dart_of_fan (V,ESTD V)` +[ + ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let finite_sets *) +Sections.add_section_lemma "finite_sets" (Sections.section_proof ["n";"d"] +`FINITE {y | y IN node (hypermap_of_fan (V,ESTD V)) d + /\ CARD (face (hypermap_of_fan (V,ESTD V)) y) = n} + /\ FINITE {y | y IN node (hypermap_of_fan (V,ESTD V)) d + /\ n <= CARD (face (hypermap_of_fan (V,ESTD V)) y)}` +[ + ((split_tac) THEN ((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`node (hypermap_of_fan (V,ESTD V)) d`))) (term_tac exists_tac)) THEN (((((use_arg_then2 ("NODE_FINITE", [NODE_FINITE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; + +(* Section SumEqs *) +Sections.begin_section "SumEqs";; +(Sections.add_section_var (mk_var ("p", (`:num`))); Sections.add_section_var (mk_var ("q", (`:num`))); Sections.add_section_var (mk_var ("r", (`:num`))));; + +(* Lemma anglesum *) +let anglesum = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + /\ (p,q,r) = type_of_node (hypermap_of_fan (V,ESTD V)) d + ==> (&p) * a_azim ((=) 3) V d + (&q) * a_azim ((=) 4) V d + + (&r) * a_azim ((<=) 5) V d = &2 * pi` +[ + ((BETA_TAC THEN (case THEN (move ["d_in"]))) THEN (((((use_arg_then2 ("NODE_TYPE_lemma", [NODE_TYPE_lemma]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))))) THEN (move ["eqs"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE a_azim)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("GE", [GE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`4`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H"))); + ((repeat_tactic 1 9 (((use_arg_then2 ("a_sum_mul", [a_sum_mul]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE SUM_AZIM_DART_FULLY_SURROUNDED))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("REAL_EQ_ADD_LCANCEL", [REAL_EQ_ADD_LCANCEL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_UNION", [SUM_UNION]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("finite_sets", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("DISJOINT", [DISJOINT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); + ((congr_tac (`sum _1 _2`)) THEN ((TRY done_tac))); + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andb_orr", [andb_orr]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `!a. a >= 4 <=> a = 4 \/ 5 <= a`)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma anglesum_lo_approx *) +let anglesum_lo_approx = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + /\ (p,q,r) = type_of_node (hypermap_of_fan (V,ESTD V)) d + ==> #6.28318 <= (&p) * a_azim ((=) 3) V d + (&q) * a_azim ((=) 4) V d + + (&r) * a_azim ((<=) 5) V d` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("anglesum", [anglesum])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("PI_APPROX_32", [PI_APPROX_32])) (disch_tac [])) THEN (clear_assumption "PI_APPROX_32") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma anglesum_hi_approx *) +let anglesum_hi_approx = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + /\ (p,q,r) = type_of_node (hypermap_of_fan (V,ESTD V)) d + ==> (&p) * a_azim ((=) 3) V d + (&q) * a_azim ((=) 4) V d + + (&r) * a_azim ((<=) 5) V d <= #6.28319` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("anglesum", [anglesum])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("PI_APPROX_32", [PI_APPROX_32])) (disch_tac [])) THEN (clear_assumption "PI_APPROX_32") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma tausum_eq *) +let tausum_eq = Sections.section_proof ["d"] +`let H = hypermap_of_fan (V,ESTD V) in + d IN dart_of_fan (V,ESTD V) + /\ (p,q,r) = type_of_node H d + ==> (&p) * a_tau ((=) 3) V d + (&q) * a_tau ((=) 4) V d + (&r) * a_tau ((<=) 5) V d + = sum (set_of_face_meeting_node H d) (\f. tauVEF (V,ESTD V,f))` +[ + (((CONV_TAC let_CONV) THEN ALL_TAC THEN (case THEN (move ["d_in"]))) THEN (((((use_arg_then2 ("NODE_TYPE_lemma", [NODE_TYPE_lemma]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("GE", [GE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))))) THEN (move ["eqs"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE a_tau)))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`4`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("a_sum_mul", [a_sum_mul]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("set_of_face_meeting_node", [set_of_face_meeting_node]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H"))); + (repeat_tactic 1 9 (((use_arg_then2 ("SUM_UNION", [SUM_UNION]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("finite_sets", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("DISJOINT", [DISJOINT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("FINITE_UNION", [FINITE_UNION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("finite_sets", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("DISJOINT", [DISJOINT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("IN_INTER", [IN_INTER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`(\y. tauVEF (V, ESTD V, face H y)) = (\f. tauVEF (V,ESTD V,f)) o face H`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("SUM_IMAGE", [SUM_IMAGE]))(gsym_then (thm_tac (new_rewrite [] []))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andb_orr", [andb_orr]))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["x_in_n"])) THEN (move ["card_x"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["y_in_n"])) THEN (move ["card_y"]) THEN (move ["face_eq"])); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("SIMPLE_HYPERMAP_IMP_FACE_INJ", [SIMPLE_HYPERMAP_IMP_FACE_INJ])) (fun fst_arg -> (use_arg_then2 ("face_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x_in_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y_in_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("simpleH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (done_tac)); + ((congr_tac (`sum _1 _2`)) THEN ((TRY done_tac))); + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andb_orr", [andb_orr]))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (move ["f"])); + ((THENL) (split_tac) [((case THEN (move ["x"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (case THEN (move ["x_in"])) THEN (move ["card_x"])); ((case THEN (move ["y"])) THEN (case THEN (move ["y_in"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))]); + (((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("x_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_node_subset", [lemma_node_subset])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN (done_tac)); + (((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("y_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FULLY_SURROUNDED_IMP_CARD_FACE_GE_3", [FULLY_SURROUNDED_IMP_CARD_FACE_GE_3])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] []))))); + ((THENL_LAST) (ANTS_TAC) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma tausum_triangles *) +let tausum_triangles = Sections.section_proof ["d"] +`let H = hypermap_of_fan (V,ESTD V) in + d IN dart_of_fan (V,ESTD V) + /\ p,q,r = type_of_node H d + ==> (&p) * a_tau ((=) 3) V d + = sum {f | f IN set_of_face_meeting_node H d /\ CARD(f)=3 } (\f. tauVEF (V, ESTD V,f))` +[ + (((CONV_TAC let_CONV) THEN ALL_TAC THEN (case THEN (move ["d_in"]))) THEN (((((use_arg_then2 ("NODE_TYPE_lemma", [NODE_TYPE_lemma]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("GE", [GE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))))) THEN (move ["eqs"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE a_tau)))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("a_sum_mul", [a_sum_mul]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H"))); + ((fun arg_tac -> arg_tac (Arg_term (`(\y. tauVEF (V, ESTD V, face H y)) = (\f. tauVEF (V,ESTD V,f)) o face H`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("SUM_IMAGE", [SUM_IMAGE]))(gsym_then (thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["x_in_n"])) THEN (move ["card_x"]) THEN (case THEN ALL_TAC) THEN (case THEN (move ["y_in_n"])) THEN (move ["card_y"]) THEN (move ["face_eq"])); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("SIMPLE_HYPERMAP_IMP_FACE_INJ", [SIMPLE_HYPERMAP_IMP_FACE_INJ])) (fun fst_arg -> (use_arg_then2 ("face_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x_in_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y_in_n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("simpleH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (done_tac)); + ((congr_tac (`sum _1 _2`)) THEN ((TRY done_tac))); + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_of_face_meeting_node", [set_of_face_meeting_node]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["f"])); + ((THENL) (split_tac) [((case THEN (move ["x"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (case THEN (move ["x_in"])) THEN (move ["card_x"])); ((case THEN ALL_TAC) THEN (case THEN (move ["y"])) THEN (case THEN (move ["y_in"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (move ["card_y"]))]); + (((((use_arg_then2 ("card_x", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("x_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_node_subset", [lemma_node_subset])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN (done_tac)); + (((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("y_in", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("card_y", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section Tgt *) +Sections.begin_section "Tgt";; +(Sections.add_section_hyp "h_main" (`lp_main_estimate`));; + +(* Lemma tausum_upper_bound *) +let tausum_upper_bound = Sections.section_proof ["d"] +`let H = hypermap_of_fan (V,ESTD V) in + d IN dart_of_fan (V,ESTD V) + ==> sum (set_of_face_meeting_node H d) (\f. tauVEF (V,ESTD V,f)) <= #1.541` +[ + ((CONV_TAC let_CONV) THEN (move ["d_in"])); + ((THENL_ROT (-1)) ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`&4 * pi - &20 * sol0`))) (term_tac exists_tac)) THEN (split_tac))); + ((((use_arg_then2 ("Flyspeck_constants.bounds", [Flyspeck_constants.bounds])) (disch_tac [])) THEN (clear_assumption "Flyspeck_constants.bounds") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sum_tauVEF_upper_bound", [sum_tauVEF_upper_bound])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)); + ((((use_arg_then2 ("contrV", [])) (disch_tac [])) THEN (clear_assumption "contrV") THEN BETA_TAC) THEN (((use_arg_then2 ("contravening", [contravening]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s"))); + ((BETA_TAC THEN (move ["ineq"])) THEN (((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then2 ("s", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("SUM_SUBSET_SIMPLE", [SUM_SUBSET_SIMPLE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_HYPERMAP_ORBITS", [FINITE_HYPERMAP_ORBITS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + (((((use_arg_then2 ("set_of_face_meeting_node", [set_of_face_meeting_node]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["f"]) THEN (case THEN (move ["y"])) THEN (case THEN (move ["y_in"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("IN_DIFF", [IN_DIFF]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["f"]) THEN (case THEN (move ["f_in"])) THEN (move ["_"])); + ((((use_arg_then2 ("f_in", [])) (disch_tac [])) THEN (clear_assumption "f_in") THEN ((use_arg_then2 ("f", [])) (disch_tac [])) THEN (clear_assumption "f") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_tau", [lp_tau]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("contravening_lp_tau", [contravening_lp_tau]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Tgt *) +let tausum_upper_bound = Sections.finalize_theorem tausum_upper_bound;; +Sections.end_section "Tgt";; + +(* Finalization of the section SumEqs *) +let anglesum = Sections.finalize_theorem anglesum;; +let anglesum_lo_approx = Sections.finalize_theorem anglesum_lo_approx;; +let anglesum_hi_approx = Sections.finalize_theorem anglesum_hi_approx;; +let tausum_eq = Sections.finalize_theorem tausum_eq;; +let tausum_triangles = Sections.finalize_theorem tausum_triangles;; +let tausum_upper_bound = Sections.finalize_theorem tausum_upper_bound;; +Sections.end_section "SumEqs";; + +(* Section Ineqs *) +Sections.begin_section "Ineqs";; + +(* Let y_bounds *) +Sections.add_section_lemma "y_bounds" (Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + ==> &2 <= y1_fan d /\ &2 <= y2_fan d /\ &2 <= y3_fan (V,ESTD V) d + /\ &2 <= y4_fan (V,ESTD V) d /\ &2 <= y5_fan (V,ESTD V) d /\ &2 <= y6_fan d + /\ &2 <= y8_fan (V,ESTD V) d /\ &2 <= y9_fan (V,ESTD V) d + /\ y1_fan d <= #2.52 /\ y2_fan d <= #2.52 /\ y3_fan (V,ESTD V) d <= #2.52 + /\ y4_fan (V,ESTD V) d <= #2.52 /\ y5_fan (V,ESTD V) d <= #2.52 /\ y6_fan d <= #2.52 + /\ y8_fan (V,ESTD V) d <= #2.52 /\ y9_fan (V,ESTD V) d <= #2.52` +[ + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (move ["h_fan"]) THEN (move ["d_in"]))); + ((((fun arg_tac -> (use_arg_then2 ("y1_lo", [y1_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_lo", [y2_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_lo", [y3_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4_lo", [y4_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_lo", [y5_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y6_lo", [y6_lo])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y8_lo", [y8_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_lo", [y9_lo]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("y1_hi", [y1_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y2_hi", [y2_hi])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y3_hi", [y3_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4_hi_std2", [y4_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y5_hi_std2", [y5_hi_std2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("y6_hi_std2", [y6_hi_std2])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y8_hi_std", [y8_hi_std]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y9_hi_std", [y9_hi_std]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +]);; + +(* Let eqs *) +Sections.add_section_lemma "eqs" (Sections.section_proof [] +`#2.0 = &2 /\ &2 * h0 = #2.52 /\ #0.0 = &0 /\ #5.04 = &4 * h0` +[ + ((((use_arg_then2 ("Sphere.h0", [Sphere.h0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +]);; + +(* Section A_azim3 *) +Sections.begin_section "A_azim3";; +(Sections.add_section_var (mk_var ("p", (`:num`))); Sections.add_section_var (mk_var ("q", (`:num`))); Sections.add_section_var (mk_var ("r", (`:num`))));; + +(* Section Lo *) +Sections.begin_section "Lo";; +(Sections.add_section_hyp "ineq" ((hd (Ineq.getexact "5735387903")).ineq));; + +(* Lemma azimp_lo *) +let azimp_lo = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + /\ (p,q,r) = type_of_node (hypermap_of_fan (V,ESTD V)) d + /\ ~(p = 0) + ==> #0.852 <= a_azim ((=) 3) V d` +[ + ((BETA_TAC THEN (case THEN (move ["d_in"]))) THEN (((((use_arg_then2 ("NODE_TYPE_lemma", [NODE_TYPE_lemma]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["neq"]))); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE a_azim)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H"))); + ((((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_RMUL", [SUM_RMUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_NEG", [REAL_LE_NEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_NEG", [SUM_NEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_BOUND_GEN", [SUM_BOUND_GEN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("finite_sets", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("CARD_EQ_0", [CARD_EQ_0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("neq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN (move ["x_in"])) THEN (move ["card_x"])); + ((((use_arg_then2 ("REAL_NEG_LMUL", [REAL_NEG_LMUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_NEG", [REAL_LE_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_RMUL", [REAL_LE_RMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_INV", [REAL_LE_INV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_POS", [REAL_POS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (move ["h_fan"]))); + ((fun arg_tac -> arg_tac (Arg_term (`x IN dart_of_fan (V,ESTD V)`))) (term_tac (have_gen_tac [](move ["x_in"])))); + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_node_subset", [lemma_node_subset])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN (done_tac)); + ((((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_gt", [real_gt]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (in_tac ["ineq"] false ((((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ineq.dart_std3", [Ineq.dart_std3]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_bounds", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4'_eq_y4", [y4'_eq_y4]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("y_bounds", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("List_hypermap.darts_k", [List_hypermap.darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Lo *) +let azimp_lo = Sections.finalize_theorem azimp_lo;; +Sections.end_section "Lo";; + +(* Section Hi *) +Sections.begin_section "Hi";; +(Sections.add_section_hyp "ineq" ((hd (Ineq.getexact "5490182221")).ineq));; + +(* Lemma azimp_hi *) +let azimp_hi = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + ==> a_azim ((=) 3) V d <= #1.9` +[ + ((BETA_TAC THEN (move ["d_in"])) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE a_azim)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`GSPEC _`))) (term_tac (set_tac "s"))); + (((fun arg_tac -> arg_tac (Arg_term (`CARD s = 0`))) (disch_eq_tac "card0" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((((use_arg_then2 ("card0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_INV_0", [REAL_INV_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RZERO", [REAL_MUL_RZERO]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < &(CARD s)`))) (term_tac (have_gen_tac [](move ["gt0"])))) (((((use_arg_then2 ("REAL_LT_LE", [REAL_LT_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_POS", [REAL_POS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OF_NUM_EQ", [REAL_OF_NUM_EQ]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("REAL_LE_LMUL_EQ", [REAL_LE_LMUL_EQ])) (fun fst_arg -> (use_arg_then2 ("gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a_sum_mul", [a_sum_mul]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("s_def", []))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("SUM_BOUND", [SUM_BOUND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("finite_sets", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN (move ["x_in_n"])) THEN (move ["card_x"])); + ((fun arg_tac -> arg_tac (Arg_term (`x IN dart_of_fan (V,ESTD V)`))) (term_tac (have_gen_tac [](move ["x_in"])))); + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_node_subset", [lemma_node_subset])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN (done_tac)); + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (move ["h_fan"]))); + ((THENL_LAST) (((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`#1.893`))) (term_tac exists_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] []))))); + (in_tac ["ineq"] false ((((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ineq.dart_std3", [Ineq.dart_std3]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_bounds", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4'_eq_y4", [y4'_eq_y4]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("y_bounds", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("List_hypermap.darts_k", [List_hypermap.darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Hi *) +let azimp_hi = Sections.finalize_theorem azimp_hi;; +Sections.end_section "Hi";; + +(* Finalization of the section A_azim3 *) +let azimp_lo = Sections.finalize_theorem azimp_lo;; +let azimp_hi = Sections.finalize_theorem azimp_hi;; +Sections.end_section "A_azim3";; + +(* Section A_azim4_excep *) +Sections.begin_section "A_azim4_excep";; +(Sections.add_section_var (mk_var ("p", (`:num`))); Sections.add_section_var (mk_var ("q", (`:num`))); Sections.add_section_var (mk_var ("r", (`:num`))));; + +(* Section Lo *) +Sections.begin_section "Lo";; +(Sections.add_section_hyp "ineq" ((hd (Ineq.getexact "2570626711")).ineq));; + +(* Lemma azimq_lo *) +let azimq_lo = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + /\ (p,q,r) = type_of_node (hypermap_of_fan (V,ESTD V)) d + /\ ~(q = 0) + ==> #1.15 <= a_azim ((=) 4) V d` +[ + ((BETA_TAC THEN (case THEN (move ["d_in"]))) THEN (((((use_arg_then2 ("NODE_TYPE_lemma", [NODE_TYPE_lemma]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("GE", [GE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["neq"]))); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE a_azim)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`4`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H"))); + ((((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_RMUL", [SUM_RMUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_NEG", [REAL_LE_NEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_NEG", [SUM_NEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_BOUND_GEN", [SUM_BOUND_GEN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("finite_sets", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("CARD_EQ_0", [CARD_EQ_0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("neq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN (move ["x_in"])) THEN (move ["card_x"]) THEN (simp_tac)); + ((((use_arg_then2 ("REAL_NEG_LMUL", [REAL_NEG_LMUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_NEG", [REAL_LE_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_RMUL", [REAL_LE_RMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_INV", [REAL_LE_INV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_POS", [REAL_POS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (move ["h_fan2"]))); + ((fun arg_tac -> arg_tac (Arg_term (`x IN dart_of_fan (V,ESTD V)`))) (term_tac (have_gen_tac [](move ["x_in"])))); + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_node_subset", [lemma_node_subset])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN (done_tac)); + ((((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_gt", [real_gt]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Tame_inequalities.DIH_Y_INEQ))) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y1_fan x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y2_fan x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y3_fan (V,ESTD V) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y4'_fan (V,ESTD V) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,ESTD V) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (ANTS_TAC)); + ((repeat_tactic 1 9 (((use_arg_then2 ("y_bounds", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4'_hi", [y4'_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y4'_lo_2h0", [y4'_lo_2h0])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`CARD (face H x)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("h_fan", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("List_hypermap.darts_k", [List_hypermap.darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x_in", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_x", [])) (disch_tac [])) THEN (clear_assumption "card_x") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (case THEN ((TRY done_tac))); + (((use_arg_then2 ("x_in", [])) (disch_tac [])) THEN (clear_assumption "x_in") THEN ((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"])); + ((repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ys_eq", [ys_eq])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("REAL_NOT_LE", [REAL_NOT_LE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE Tame_lemmas.fully_surrounded_delta_pos)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma azimr_lo *) +let azimr_lo = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + /\ (p,q,r) = type_of_node (hypermap_of_fan (V,ESTD V)) d + /\ ~(r = 0) + ==> #1.15 <= a_azim ((<=) 5) V d` +[ + ((BETA_TAC THEN (case THEN (move ["d_in"]))) THEN (((((use_arg_then2 ("NODE_TYPE_lemma", [NODE_TYPE_lemma]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("GE", [GE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["neq"]))); + (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE a_azim)))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H"))); + ((((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_RMUL", [SUM_RMUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_NEG", [REAL_LE_NEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_NEG", [SUM_NEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_BOUND_GEN", [SUM_BOUND_GEN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("finite_sets", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("CARD_EQ_0", [CARD_EQ_0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("neq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN (move ["x_in"])) THEN (move ["card_x"]) THEN (simp_tac)); + ((((use_arg_then2 ("REAL_NEG_LMUL", [REAL_NEG_LMUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_NEG", [REAL_LE_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_RMUL", [REAL_LE_RMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_INV", [REAL_LE_INV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_POS", [REAL_POS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (move ["h_fan2"]))); + ((fun arg_tac -> arg_tac (Arg_term (`x IN dart_of_fan (V,ESTD V)`))) (term_tac (have_gen_tac [](move ["x_in"])))); + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_node_subset", [lemma_node_subset])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN (done_tac)); + ((((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_gt", [real_gt]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Tame_inequalities.DIH_Y_INEQ))) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y1_fan x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y2_fan x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y3_fan (V,ESTD V) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y4'_fan (V,ESTD V) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y5_fan (V,ESTD V) x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`y6_fan x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (ANTS_TAC)); + ((repeat_tactic 1 9 (((use_arg_then2 ("y_bounds", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4'_hi", [y4'_hi]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y4'_lo_2h0", [y4'_lo_2h0])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`CARD (face H x)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("h_fan", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("List_hypermap.darts_k", [List_hypermap.darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x_in", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("card_x", [])) (disch_tac [])) THEN (clear_assumption "card_x") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (case THEN ((TRY done_tac))); + (((use_arg_then2 ("x_in", [])) (disch_tac [])) THEN (clear_assumption "x_in") THEN ((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (move ["vw_in"])); + ((repeat_tactic 1 9 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ys_eq", [ys_eq])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("REAL_NOT_LE", [REAL_NOT_LE]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE Tame_lemmas.fully_surrounded_delta_pos)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Lo *) +let azimq_lo = Sections.finalize_theorem azimq_lo;; +let azimr_lo = Sections.finalize_theorem azimr_lo;; +Sections.end_section "Lo";; + +(* Section Hi *) +Sections.begin_section "Hi";; + +(* Lemma azimq_hi *) +let azimq_hi = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + ==> a_azim ((=) 4) V d <= pi` +[ + ((BETA_TAC THEN (move ["d_in"])) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE a_azim)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`4`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`GSPEC _`))) (term_tac (set_tac "s"))); + (((fun arg_tac -> arg_tac (Arg_term (`CARD s = 0`))) (disch_eq_tac "card0" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((((use_arg_then2 ("card0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_INV_0", [REAL_INV_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RZERO", [REAL_MUL_RZERO]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("PI_POS", [PI_POS])) (disch_tac [])) THEN (clear_assumption "PI_POS") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < &(CARD s)`))) (term_tac (have_gen_tac [](move ["gt0"])))) (((((use_arg_then2 ("REAL_LT_LE", [REAL_LT_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_POS", [REAL_POS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OF_NUM_EQ", [REAL_OF_NUM_EQ]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("REAL_LE_LMUL_EQ", [REAL_LE_LMUL_EQ])) (fun fst_arg -> (use_arg_then2 ("gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a_sum_mul", [a_sum_mul]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("s_def", []))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("SUM_BOUND", [SUM_BOUND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("finite_sets", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN (move ["x_in_n"])) THEN (move ["card_x"])); + ((fun arg_tac -> arg_tac (Arg_term (`x IN dart_of_fan (V,ESTD V)`))) (term_tac (have_gen_tac [](move ["x_in"])))); + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_node_subset", [lemma_node_subset])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN (done_tac)); + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (move ["h_fan"]))); + ((((use_arg_then2 ("azim_hi", [azim_hi]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma azimq_hi_approx *) +let azimq_hi_approx = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + ==> a_azim ((=) 4) V d <= #3.141593` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("azimq_hi", [azimq_hi])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((use_arg_then2 ("PI_APPROX_32", [PI_APPROX_32])) (disch_tac [])) THEN (clear_assumption "PI_APPROX_32") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma azimr_hi *) +let azimr_hi = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + ==> a_azim ((<=) 5) V d <= pi` +[ + ((BETA_TAC THEN (move ["d_in"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE a_azim)))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`GSPEC _`))) (term_tac (set_tac "s"))); + (((fun arg_tac -> arg_tac (Arg_term (`CARD s = 0`))) (disch_eq_tac "card0" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((((use_arg_then2 ("card0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_INV_0", [REAL_INV_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RZERO", [REAL_MUL_RZERO]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("PI_POS", [PI_POS])) (disch_tac [])) THEN (clear_assumption "PI_POS") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < &(CARD s)`))) (term_tac (have_gen_tac [](move ["gt0"])))) (((((use_arg_then2 ("REAL_LT_LE", [REAL_LT_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_POS", [REAL_POS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OF_NUM_EQ", [REAL_OF_NUM_EQ]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("REAL_LE_LMUL_EQ", [REAL_LE_LMUL_EQ])) (fun fst_arg -> (use_arg_then2 ("gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a_sum_mul", [a_sum_mul]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("s_def", []))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("SUM_BOUND", [SUM_BOUND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("finite_sets", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN (move ["x_in_n"])) THEN (move ["card_x"])); + ((fun arg_tac -> arg_tac (Arg_term (`x IN dart_of_fan (V,ESTD V)`))) (term_tac (have_gen_tac [](move ["x_in"])))); + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_node_subset", [lemma_node_subset])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN (done_tac)); + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (move ["h_fan"]))); + ((((use_arg_then2 ("azim_hi", [azim_hi]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section Hi *) +let azimq_hi = Sections.finalize_theorem azimq_hi;; +let azimq_hi_approx = Sections.finalize_theorem azimq_hi_approx;; +let azimr_hi = Sections.finalize_theorem azimr_hi;; +Sections.end_section "Hi";; + +(* Finalization of the section A_azim4_excep *) +let azimq_lo = Sections.finalize_theorem azimq_lo;; +let azimr_lo = Sections.finalize_theorem azimr_lo;; +let azimq_hi = Sections.finalize_theorem azimq_hi;; +let azimq_hi_approx = Sections.finalize_theorem azimq_hi_approx;; +let azimr_hi = Sections.finalize_theorem azimr_hi;; +Sections.end_section "A_azim4_excep";; + +(* Section A_tau *) +Sections.begin_section "A_tau";; +(Sections.add_section_var (mk_var ("p", (`:num`))); Sections.add_section_var (mk_var ("q", (`:num`))); Sections.add_section_var (mk_var ("r", (`:num`))));; +(Sections.add_section_hyp "h_main" (`lp_main_estimate`));; + +(* Lemma taup_lo *) +let taup_lo = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + ==> &0 <= a_tau ((=) 3) V d` +[ + ((BETA_TAC THEN (move ["d_in"])) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE a_tau)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`GSPEC _`))) (term_tac (set_tac "s"))); + ((((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_MUL", [REAL_LE_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_INV", [REAL_LE_INV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_POS", [REAL_POS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("SUM_POS_LE", [SUM_POS_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("finite_sets", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN (move ["x_in_n"])) THEN (move ["card_f"]) THEN (simp_tac)); + (((((fun arg_tac -> (use_arg_then2 ("ineq_tau3_tauVEF_std", [ineq_tau3_tauVEF_std])) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)); + ((BETA_TAC THEN (move ["v1"]) THEN (move ["v2"]) THEN (move ["v3"]) THEN (move ["cond"])) THEN (((use_arg_then2 ("h_main", [])) (disch_tac [])) THEN (clear_assumption "h_main") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_main_estimate", [lp_main_estimate]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (done_tac)); + ((((use_arg_then2 ("List_hypermap.darts_k", [List_hypermap.darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_node_subset", [lemma_node_subset])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN (done_tac)); +];; + +(* Lemma tauq_lo *) +let tauq_lo = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + /\ (p,q,r) = type_of_node (hypermap_of_fan (V,ESTD V)) d + /\ ~(q = 0) + ==> #0.206 <= a_tau ((=) 4) V d` +[ + ((BETA_TAC THEN (case THEN (move ["d_in"]))) THEN (((((use_arg_then2 ("NODE_TYPE_lemma", [NODE_TYPE_lemma]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("GE", [GE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["neq"]))); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE a_tau)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`4`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H"))); + ((((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_RMUL", [SUM_RMUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_NEG", [REAL_LE_NEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_NEG", [SUM_NEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_BOUND_GEN", [SUM_BOUND_GEN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("finite_sets", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("CARD_EQ_0", [CARD_EQ_0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("neq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN (move ["x_in"])) THEN (move ["card_x"]) THEN (simp_tac)); + ((((use_arg_then2 ("REAL_NEG_LMUL", [REAL_NEG_LMUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_NEG", [REAL_LE_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_RMUL", [REAL_LE_RMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_INV", [REAL_LE_INV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_POS", [REAL_POS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("ineq_tau4_tauVEF_std", [ineq_tau4_tauVEF_std])) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)); + ((BETA_TAC THEN (move ["v1"]) THEN (move ["v2"]) THEN (move ["v3"]) THEN (move ["cond"])) THEN (((use_arg_then2 ("h_main", [])) (disch_tac [])) THEN (clear_assumption "h_main") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_main_estimate", [lp_main_estimate]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (done_tac)); + ((((use_arg_then2 ("List_hypermap.darts_k", [List_hypermap.darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_x", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_node_subset", [lemma_node_subset])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN (done_tac)); +];; + +(* Lemma taur_lo *) +let taur_lo = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + /\ (p,q,r) = type_of_node (hypermap_of_fan (V,ESTD V)) d + /\ ~(r = 0) + ==> #0.4819 <= a_tau ((<=) 5) V d` +[ + ((BETA_TAC THEN (case THEN (move ["d_in"]))) THEN (((((use_arg_then2 ("NODE_TYPE_lemma", [NODE_TYPE_lemma]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("GE", [GE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["neq"]))); + (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE a_tau)))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H"))); + ((((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_RMUL", [SUM_RMUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_NEG", [REAL_LE_NEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_NEG", [SUM_NEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_BOUND_GEN", [SUM_BOUND_GEN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("finite_sets", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("CARD_EQ_0", [CARD_EQ_0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("neq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN (move ["x_in_n"])) THEN (move ["card_x"]) THEN (simp_tac)); + ((((use_arg_then2 ("REAL_NEG_LMUL", [REAL_NEG_LMUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_NEG", [REAL_LE_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_RMUL", [REAL_LE_RMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_INV", [REAL_LE_INV]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_POS", [REAL_POS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`x IN dart H`))) (term_tac (have_gen_tac [](move ["x_in"])))); + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_node_subset", [lemma_node_subset])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Crttxat_tame.CRTTXAT", [Crttxat_tame.CRTTXAT])) (fun fst_arg -> (use_arg_then2 ("contrV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_perimeter_bound", [fully_surrounded_perimeter_bound])) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("Jgtdebu.JGTDEBU4", [Jgtdebu.JGTDEBU4])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("tame_9a", [tame_9a]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] []))))) THEN (move ["card_f_ineq"])); + ((fun arg_tac -> arg_tac (Arg_term (`CARD (face H x) = 5 \/ CARD (face H x) = 6`))) (term_tac (have_gen_tac []ALL_TAC))); + ((((use_arg_then2 ("card_x", [])) (disch_tac [])) THEN (clear_assumption "card_x") THEN ((fun arg_tac -> (use_arg_then2 ("card_f_ineq", [])) (fun fst_arg -> (use_arg_then2 ("x_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (case THEN (move ["card_eq"])); + (((((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("ineq_tau5_tauVEF_std", [ineq_tau5_tauVEF_std])) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)); + ((BETA_TAC THEN (move ["v1"]) THEN (move ["v2"]) THEN (move ["v3"]) THEN (move ["cond"])) THEN (((use_arg_then2 ("h_main", [])) (disch_tac [])) THEN (clear_assumption "h_main") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_main_estimate", [lp_main_estimate]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (done_tac)); + (((((use_arg_then2 ("List_hypermap.darts_k", [List_hypermap.darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((((use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LE_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`#0.712`))) (term_tac exists_tac)) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("ineq_tau6_tauVEF_std", [ineq_tau6_tauVEF_std])) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)); + ((BETA_TAC THEN (move ["v1"]) THEN (move ["v2"]) THEN (move ["v3"]) THEN (move ["cond"])) THEN (((use_arg_then2 ("h_main", [])) (disch_tac [])) THEN (clear_assumption "h_main") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_main_estimate", [lp_main_estimate]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (done_tac)); + (((((use_arg_then2 ("List_hypermap.darts_k", [List_hypermap.darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section A_tau *) +let taup_lo = Sections.finalize_theorem taup_lo;; +let tauq_lo = Sections.finalize_theorem tauq_lo;; +let taur_lo = Sections.finalize_theorem taur_lo;; +Sections.end_section "A_tau";; + +(* Section Case50 *) +Sections.begin_section "Case50";; +(Sections.add_section_hyp "h_main" (`lp_main_estimate`));; +(Sections.add_section_hyp "ineq1" ((hd (Ineq.getexact "4652969746 1")).ineq));; +(Sections.add_section_hyp "ineq2" ((hd (Ineq.getexact "4652969746 2")).ineq));; + +(* Lemma case50_ineq *) +let case50_ineq = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + /\ type_of_node (hypermap_of_fan (V,ESTD V)) d = (5,0,0) + ==> #0.04 <= &5 * a_tau ((=) 3) V d` +[ + ((BETA_TAC THEN (case THEN (move ["d_in"]))) THEN ((((use_arg_then2 ("NODE_TYPE_lemma", [NODE_TYPE_lemma]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))))); + ((fun arg_tac -> arg_tac (Arg_term (`GSPEC _`))) (term_tac (set_tac "s"))); + ((fun arg_tac -> arg_tac (Arg_term (`CARD (GSPEC _)`))) (term_tac (set_tac "q"))); + ((fun arg_tac -> arg_tac (Arg_term (`CARD (GSPEC _)`))) (term_tac (set_tac "r"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`FINITE s`))) (term_tac (have_gen_tac [](move ["fin_s"])))) ((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((BETA_TAC THEN (move ["eqs"])) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE a_tau)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqs", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a_sum_mul", [a_sum_mul]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((fun arg_tac -> arg_tac (Arg_term (`y IN s ==> y IN darts_k 3 (hypermap_of_fan (V,ESTD V))`))) (term_tac (have_gen_tac ["y"](move ["in_s3"])))); + (((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("List_hypermap.darts_k", [List_hypermap.darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["y_in_n"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_node_subset", [lemma_node_subset])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`y IN s ==> y IN dart_of_fan (V,ESTD V)`))) (term_tac (have_gen_tac ["y"](move ["in_s"])))); + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("in_s3", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (((((use_arg_then2 ("List_hypermap.darts_k", [List_hypermap.darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`!y. y IN s ==> y4_fan (V,ESTD V) y <= #2.1771`))) (disch_eq_tac "y4_ge" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + ((((use_arg_then2 ("y4_ge", [])) (disch_tac [])) THEN (clear_assumption "y4_ge") THEN BETA_TAC) THEN (((((use_arg_then2 ("NOT_FORALL_THM", [NOT_FORALL_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IMP", [NOT_IMP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NOT_LE", [REAL_NOT_LE]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["x"])) THEN (case THEN (move ["x_in_s"])) THEN (move ["x_ineq"]))); + ((((fun arg_tac -> (use_arg_then2 ("INSERT_DELETE", [INSERT_DELETE])) (fun fst_arg -> (use_arg_then2 ("x_in_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_CLAUSES", [SUM_CLAUSES]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_DELETE", [FINITE_DELETE]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((THENL_ROT (-1)) (((((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_ADD_RID", [REAL_ADD_RID]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_ADD2", [REAL_LE_ADD2]))(thm_tac (new_rewrite [] []))))) THEN (split_tac))); + (((((use_arg_then2 ("SUM_POS_LE", [SUM_POS_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_DELETE", [FINITE_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fin_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (case THEN (move ["y_in_s"])) THEN (move ["_"]) THEN (simp_tac)); + ((((fun arg_tac -> (use_arg_then2 ("ineq_tau3_tauVEF_std", [ineq_tau3_tauVEF_std])) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("in_s3", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + ((BETA_TAC THEN (move ["v1"]) THEN (move ["v2"]) THEN (move ["v3"]) THEN (move ["cond"])) THEN (((use_arg_then2 ("h_main", [])) (disch_tac [])) THEN (clear_assumption "h_main") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_main_estimate", [lp_main_estimate]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (move ["h_fan2"]))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("dart3_tauVEF_eq_taum", [dart3_tauVEF_eq_taum])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("in_s3", [])) (fun fst_arg -> (use_arg_then2 ("x_in_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (in_tac ["ineq1"] false ((((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> (use_arg_then2 ("in_s", [])) (fun fst_arg -> (use_arg_then2 ("x_in_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["x_in"]))); + (((((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ineq1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_bounds", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y_bounds", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("REAL_SUB_RZERO", [REAL_SUB_RZERO]))(gsym_then (thm_tac (new_rewrite [] [(`sum s _`)]))))); + ((fun arg_tac -> arg_tac (Arg_term (`&0 = #0.312 * sum s (\y. azim_dart (V,ESTD V) y - &2 * pi / &5)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] []))))) THEN (DISJ2_TAC)); + ((((use_arg_then2 ("SUM_SUB", [SUM_SUB]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("SUM_CONST", [SUM_CONST])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&2 * pi / &5`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_SUB_0", [REAL_SUB_0]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("anglesum", [anglesum])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`CARD s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("q", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("r", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)) ((((use_arg_then2 ("NODE_TYPE_lemma", [NODE_TYPE_lemma]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_LZERO", [REAL_MUL_LZERO]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ADD_RID", [REAL_ADD_RID]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eqs", []))(gsym_then (thm_tac (new_rewrite [1] [])))))); + ((((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE a_azim)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("s_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("a_sum_mul", [a_sum_mul]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("ETA_AX", [ETA_AX])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`azim_dart _`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("SUM_LMUL", [SUM_LMUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_SUB", [SUM_SUB]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("REAL_LE_NEG", [REAL_LE_NEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_NEG", [SUM_NEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_BOUND_GEN", [SUM_BOUND_GEN]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fin_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (((((use_arg_then2 ("CARD_EQ_0", [CARD_EQ_0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + (BETA_TAC THEN (move ["x"]) THEN (move ["x_in_s"]) THEN (simp_tac)); + ((((use_arg_then2 ("REAL_LE_NEG", [REAL_LE_NEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_NEG_NEG", [REAL_NEG_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NEG_LMUL", [REAL_NEG_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NEG_NEG", [REAL_NEG_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_div", [real_div]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (move ["h_fan2"]))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("dart3_tauVEF_eq_taum", [dart3_tauVEF_eq_taum])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("in_s3", [])) (fun fst_arg -> (use_arg_then2 ("x_in_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("in_s", [])) (fun fst_arg -> (use_arg_then2 ("x_in_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("y4'_eq_y4", [y4'_eq_y4])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("in_s3", [])) (fun fst_arg -> (use_arg_then2 ("x_in_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (in_tac ["ineq2"] false ((((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("ineq2", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 11 0 (((fun arg_tac -> (use_arg_then2 ("y_bounds", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("in_s", [])) (fun fst_arg -> (use_arg_then2 ("x_in_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("y4_ge", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Case50 *) +let case50_ineq = Sections.finalize_theorem case50_ineq;; +Sections.end_section "Case50";; + +(* Let aux_ge *) +Sections.add_section_lemma "aux_ge" (Sections.section_proof ["a"] +`a > &0 ==> a >= &0` +[ + ((arith_tac) THEN (done_tac)); +]);; + +(* Let aux_ineq *) +Sections.add_section_lemma "aux_ineq" (Sections.section_proof ["n";"a";"b";"d"] +`(!x. x IN darts_k n (hypermap_of_fan (V,ESTD V)) + ==> tauVEF (V,ESTD V,face (hypermap_of_fan (V,ESTD V)) x) + + a * azim_dart (V,ESTD V) x + b >= &0) + /\ d IN dart_of_fan (V,ESTD V) /\ + ~(CARD {y | y IN node (hypermap_of_fan (V,ESTD V)) d + /\ CARD (face (hypermap_of_fan (V,ESTD V)) y) = n} = 0) + ==> &0 <= a_tau ((=) n) V d + a * a_azim ((=) n) V d + b` +[ + (BETA_TAC THEN (case THEN (move ["ineq"])) THEN (case THEN (move ["d_in"])) THEN (move ["card_n0"])); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE a_tau)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE a_azim)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H"))); + ((fun arg_tac -> arg_tac (Arg_term (`GSPEC _`))) (term_tac (set_tac "s"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`FINITE s`))) (term_tac (have_gen_tac [](move ["fin_s"])))) ((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < &(CARD s)`))) (term_tac (have_gen_tac [](move ["gt0"])))) (((((use_arg_then2 ("REAL_LT_LE", [REAL_LT_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_POS", [REAL_POS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OF_NUM_EQ", [REAL_OF_NUM_EQ]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("REAL_LE_LMUL_EQ", [REAL_LE_LMUL_EQ])) (fun fst_arg -> (use_arg_then2 ("gt0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_RZERO", [REAL_MUL_RZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_LDISTRIB", [REAL_ADD_LDISTRIB]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x * (a * z + b) = a * (x * z) + x * b:real`))) (term_tac (have_gen_tac ["x"; "z"](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("a_sum_mul", [a_sum_mul]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SUM_CONST", [SUM_CONST]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SUM_LMUL", [SUM_LMUL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_ADD", [SUM_ADD]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SUM_ADD", [SUM_ADD]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("SUM_POS_LE", [SUM_POS_LE])) (fun fst_arg -> (use_arg_then2 ("fin_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (case THEN (move ["x_in_n"])) THEN (move ["card_x"])); + ((((use_arg_then2 ("real_ge", [real_ge]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("List_hypermap.darts_k", [List_hypermap.darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_x", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("d_in", [])) (disch_tac [])) THEN (clear_assumption "d_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_node_subset", [lemma_node_subset])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN apply_tac) THEN (done_tac)); +]);; + +(* Section P1 *) +Sections.begin_section "P1";; +(Sections.add_section_hyp "ineq" ((hd (Ineq.getexact "3296257235")).ineq));; + +(* Lemma p1_ineq *) +let p1_ineq = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + /\ ~(FST (type_of_node (hypermap_of_fan (V,ESTD V)) d) = 0) + ==> #0.77 <= a_tau ((=) 3) V d + #0.626 * a_azim ((=) 3) V d` +[ + ((((use_arg_then2 ("REAL_SUB_LE", [REAL_SUB_LE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (case THEN (move ["d_in"]))) THEN (((((use_arg_then2 ("NODE_TYPE_lemma", [NODE_TYPE_lemma]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] []))))) THEN (move ["neq0"]))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("aux_ineq", [])) (fun fst_arg -> (use_arg_then2 ("neq0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac) THEN (move ["x"]) THEN (move ["x_in3"])) THEN ((((use_arg_then2 ("aux_ge", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_sub", [real_sub]))(gsym_then (thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("x_in3", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("List_hypermap.darts_k", [List_hypermap.darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["x_in"])) THEN (move ["_"]))); + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (move ["h_fan"]))); + ((((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart3_tauVEF_eq_taum", [dart3_tauVEF_eq_taum]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4'_eq_y4", [y4'_eq_y4]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (in_tac ["ineq"] false ((((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ineq.dart_std3", [Ineq.dart_std3]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_bounds", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_bounds", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section P1 *) +let p1_ineq = Sections.finalize_theorem p1_ineq;; +Sections.end_section "P1";; + +(* Section P2 *) +Sections.begin_section "P2";; +(Sections.add_section_hyp "ineq" ((hd (Ineq.getexact "8519146937")).ineq));; + +(* Lemma p2_ineq *) +let p2_ineq = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + /\ ~(FST (type_of_node (hypermap_of_fan (V,ESTD V)) d) = 0) + ==> -- #0.32 <= a_tau ((=) 3) V d - #0.259 * a_azim ((=) 3) V d` +[ + ((((use_arg_then2 ("REAL_SUB_LE", [REAL_SUB_LE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NEG_NEG", [REAL_NEG_NEG]))(thm_tac (new_rewrite [] []))))); + ((BETA_TAC THEN (case THEN (move ["d_in"]))) THEN (((((use_arg_then2 ("NODE_TYPE_lemma", [NODE_TYPE_lemma]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LNEG", [REAL_MUL_LNEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["neq0"]))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("aux_ineq", [])) (fun fst_arg -> (use_arg_then2 ("neq0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac) THEN (move ["x"]) THEN (move ["x_in3"])) THEN (((use_arg_then2 ("aux_ge", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("x_in3", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("List_hypermap.darts_k", [List_hypermap.darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["x_in"])) THEN (move ["_"]))); + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN (((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LNEG", [REAL_MUL_LNEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_sub", [real_sub]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["h_fan"]))); + ((((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart3_tauVEF_eq_taum", [dart3_tauVEF_eq_taum]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4'_eq_y4", [y4'_eq_y4]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (in_tac ["ineq"] false ((((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ineq.dart_std3", [Ineq.dart_std3]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_bounds", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_bounds", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section P2 *) +let p2_ineq = Sections.finalize_theorem p2_ineq;; +Sections.end_section "P2";; + +(* Section P3 *) +Sections.begin_section "P3";; +(Sections.add_section_hyp "ineq" ((hd (Ineq.getexact "4667071578")).ineq));; + +(* Lemma p3_ineq *) +let p3_ineq = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + /\ ~(FST (type_of_node (hypermap_of_fan (V,ESTD V)) d) = 0) + ==> -- #0.724 <= a_tau ((=) 3) V d - #0.507 * a_azim ((=) 3) V d` +[ + ((((use_arg_then2 ("REAL_SUB_LE", [REAL_SUB_LE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NEG_NEG", [REAL_NEG_NEG]))(thm_tac (new_rewrite [] []))))); + ((BETA_TAC THEN (case THEN (move ["d_in"]))) THEN (((((use_arg_then2 ("NODE_TYPE_lemma", [NODE_TYPE_lemma]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LNEG", [REAL_MUL_LNEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["neq0"]))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("aux_ineq", [])) (fun fst_arg -> (use_arg_then2 ("neq0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac) THEN (move ["x"]) THEN (move ["x_in3"])) THEN (((use_arg_then2 ("aux_ge", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("x_in3", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("List_hypermap.darts_k", [List_hypermap.darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["x_in"])) THEN (move ["_"]))); + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN (clear_assumption "h_fan") THEN BETA_TAC) THEN (((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LNEG", [REAL_MUL_LNEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_sub", [real_sub]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["h_fan"]))); + ((((use_arg_then2 ("azim_fan_eq_dih_y", [azim_fan_eq_dih_y]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart3_tauVEF_eq_taum", [dart3_tauVEF_eq_taum]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y4'_eq_y4", [y4'_eq_y4]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (in_tac ["ineq"] false ((((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ineq.dart_std3", [Ineq.dart_std3]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("ineq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_bounds", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_bounds", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section P3 *) +let p3_ineq = Sections.finalize_theorem p3_ineq;; +Sections.end_section "P3";; + +(* Section Q1 *) +Sections.begin_section "Q1";; +(Sections.add_section_hyp "ineq1" ((hd (Ineq.getexact "7043724150 a")).ineq));; +(Sections.add_section_hyp "ineq2" ((hd (Ineq.getexact "7043724150 a reduced v2")).ineq));; +(Sections.add_section_hyp "ineq3" ((hd (Ineq.getexact "3287695934")).ineq));; + +(* Lemma q1_ineq *) +let q1_ineq = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + /\ ~(FST (SND (type_of_node (hypermap_of_fan (V,ESTD V)) d)) = 0) + ==> #6.248 <= a_tau ((=) 4) V d + #4.72 * a_azim ((=) 4) V d` +[ + ((((use_arg_then2 ("REAL_SUB_LE", [REAL_SUB_LE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (case THEN (move ["d_in"]))) THEN (((((use_arg_then2 ("NODE_TYPE_lemma", [NODE_TYPE_lemma]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SND", [SND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] []))))) THEN (move ["neq0"]))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("aux_ineq", [])) (fun fst_arg -> (use_arg_then2 ("neq0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac) THEN (move ["x"]) THEN (move ["x_in4"])); + ((((use_arg_then2 ("x_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("List_hypermap.darts_k", [List_hypermap.darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["x_in"])) THEN (move ["_"]))); + (((((use_arg_then2 ("real_sub", [real_sub]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq122_tauVEF", [ineq122_tauVEF])) (fun fst_arg -> (use_arg_then2 ("ineq1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_bounds", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section Q1 *) +let q1_ineq = Sections.finalize_theorem q1_ineq;; +Sections.end_section "Q1";; + +(* Section Q2 *) +Sections.begin_section "Q2";; +(Sections.add_section_hyp "ineq1" ((hd (Ineq.getexact "6944699408 a")).ineq));; +(Sections.add_section_hyp "ineq2" ((hd (Ineq.getexact "6944699408 a reduced")).ineq));; +(Sections.add_section_hyp "ineq3" ((hd (Ineq.getexact "3287695934")).ineq));; + +(* Lemma q2_ineq *) +let q2_ineq = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + /\ ~(FST (SND (type_of_node (hypermap_of_fan (V,ESTD V)) d)) = 0) + ==> #1.707 <= a_tau ((=) 4) V d + #0.972 * a_azim ((=) 4) V d` +[ + ((((use_arg_then2 ("REAL_SUB_LE", [REAL_SUB_LE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (case THEN (move ["d_in"]))) THEN (((((use_arg_then2 ("NODE_TYPE_lemma", [NODE_TYPE_lemma]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SND", [SND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] []))))) THEN (move ["neq0"]))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("aux_ineq", [])) (fun fst_arg -> (use_arg_then2 ("neq0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac) THEN (move ["x"]) THEN (move ["x_in4"])); + ((((use_arg_then2 ("x_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("List_hypermap.darts_k", [List_hypermap.darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["x_in"])) THEN (move ["_"]))); + (((((use_arg_then2 ("real_sub", [real_sub]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq121_tauVEF", [ineq121_tauVEF])) (fun fst_arg -> (use_arg_then2 ("ineq1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_bounds", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section Q2 *) +let q2_ineq = Sections.finalize_theorem q2_ineq;; +Sections.end_section "Q2";; + +(* Section Q3 *) +Sections.begin_section "Q3";; +(Sections.add_section_hyp "ineq1" ((hd (Ineq.getexact "4240815464 a")).ineq));; +(Sections.add_section_hyp "ineq2" ((hd (Ineq.getexact "4240815464 a reduced")).ineq));; +(Sections.add_section_hyp "ineq3" ((hd (Ineq.getexact "3287695934")).ineq));; + +(* Lemma q3_ineq *) +let q3_ineq = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + /\ ~(FST (SND (type_of_node (hypermap_of_fan (V,ESTD V)) d)) = 0) + ==> #1.433 <= a_tau ((=) 4) V d + #0.7573 * a_azim ((=) 4) V d` +[ + ((((use_arg_then2 ("REAL_SUB_LE", [REAL_SUB_LE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (case THEN (move ["d_in"]))) THEN (((((use_arg_then2 ("NODE_TYPE_lemma", [NODE_TYPE_lemma]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SND", [SND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] []))))) THEN (move ["neq0"]))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("aux_ineq", [])) (fun fst_arg -> (use_arg_then2 ("neq0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac) THEN (move ["x"]) THEN (move ["x_in4"])); + ((((use_arg_then2 ("x_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("List_hypermap.darts_k", [List_hypermap.darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["x_in"])) THEN (move ["_"]))); + (((((use_arg_then2 ("real_sub", [real_sub]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ineq120_tauVEF", [ineq120_tauVEF])) (fun fst_arg -> (use_arg_then2 ("ineq1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineq3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_bounds", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section Q3 *) +let q3_ineq = Sections.finalize_theorem q3_ineq;; +Sections.end_section "Q3";; + +(* Section Q4 *) +Sections.begin_section "Q4";; +(Sections.add_section_hyp "h_main" ((hd (Ineq.getexact "3862621143 revised")).ineq));; +(Sections.add_section_hyp "h_reduced" ((hd (Ineq.getexact "3862621143 side")).ineq));; +(Sections.add_section_hyp "h_front" ((hd (Ineq.getexact "3862621143 front")).ineq));; +(Sections.add_section_hyp "h_back" ((hd (Ineq.getexact "3862621143 back")).ineq));; +(Sections.add_section_hyp "h_back2" ((hd (Ineq.getexact "6988401556")).ineq));; +(Sections.add_section_hyp "h_y4" ((hd (Ineq.getexact "3287695934")).ineq));; + +(* Lemma q4_ineq *) +let q4_ineq = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + /\ ~(FST (SND (type_of_node (hypermap_of_fan (V,ESTD V)) d)) = 0) + ==> -- #0.777 <= a_tau ((=) 4) V d - #0.453 * a_azim ((=) 4) V d` +[ + ((((use_arg_then2 ("REAL_SUB_LE", [REAL_SUB_LE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NEG_NEG", [REAL_NEG_NEG]))(thm_tac (new_rewrite [] []))))); + ((BETA_TAC THEN (case THEN (move ["d_in"]))) THEN (((((use_arg_then2 ("NODE_TYPE_lemma", [NODE_TYPE_lemma]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SND", [SND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LNEG", [REAL_MUL_LNEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["neq0"]))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("aux_ineq", [])) (fun fst_arg -> (use_arg_then2 ("neq0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac) THEN (move ["x"]) THEN (move ["x_in4"])) THEN ((((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LNEG", [REAL_MUL_LNEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_sub", [real_sub]))(gsym_then (thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("x_in4", [])) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("List_hypermap.darts_k", [List_hypermap.darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["x_in"])) THEN (move ["_"]))); + (((((use_arg_then2 ("ineq119_tauVEF", [ineq119_tauVEF]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("y_bounds", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section Q4 *) +let q4_ineq = Sections.finalize_theorem q4_ineq;; +Sections.end_section "Q4";; + +(* Finalization of the section Ineqs *) +let azimp_lo = Sections.finalize_theorem azimp_lo;; +let azimp_hi = Sections.finalize_theorem azimp_hi;; +let azimq_lo = Sections.finalize_theorem azimq_lo;; +let azimr_lo = Sections.finalize_theorem azimr_lo;; +let azimq_hi = Sections.finalize_theorem azimq_hi;; +let azimq_hi_approx = Sections.finalize_theorem azimq_hi_approx;; +let azimr_hi = Sections.finalize_theorem azimr_hi;; +let taup_lo = Sections.finalize_theorem taup_lo;; +let tauq_lo = Sections.finalize_theorem tauq_lo;; +let taur_lo = Sections.finalize_theorem taur_lo;; +let case50_ineq = Sections.finalize_theorem case50_ineq;; +let p1_ineq = Sections.finalize_theorem p1_ineq;; +let p2_ineq = Sections.finalize_theorem p2_ineq;; +let p3_ineq = Sections.finalize_theorem p3_ineq;; +let q1_ineq = Sections.finalize_theorem q1_ineq;; +let q2_ineq = Sections.finalize_theorem q2_ineq;; +let q3_ineq = Sections.finalize_theorem q3_ineq;; +let q4_ineq = Sections.finalize_theorem q4_ineq;; +Sections.end_section "Ineqs";; +let add_ineqs_hyp = + let imp_th = (UNDISCH o MATCH_MP EQ_IMP) kcblrqc_ineq_def in + let ths = CONJUNCTS imp_th in + fun th -> + itlist PROVE_HYP ths th;; +let ineq_table = + let r = add_ineqs_hyp o UNDISCH_ALL o SPEC_ALL o REWRITE_RULE[GSYM IMP_IMP] o let_RULE in + let neg = ONCE_REWRITE_RULE[GSYM REAL_LE_NEG] in + let move_l = ONCE_REWRITE_RULE[GSYM REAL_SUB_0] in + [ + "anglesum_lo", r anglesum_lo_approx; + "anglesum_hi", (neg o r) anglesum_hi_approx; + "tausum", (SYM o move_l o r) tausum_eq; + "azimp_lo", (r o r) azimp_lo; + "azimp_hi", (neg o r o r) azimp_hi; + "azimq_lo", (r o r) azimq_lo; + "azimq_hi", (neg o r o r) azimq_hi_approx; + "azimr_lo", (r o r) azimr_lo; + "azimr_hi", (neg o r o r) azimr_hi; + "taup_lo", (r o r) taup_lo; + "tauq_lo", (r o r) tauq_lo; + "taur_lo", (r o r) taur_lo; + "case50", (r o r) case50_ineq; + "p1", (r o r) p1_ineq; + "p2", (r o r) p2_ineq; + "p3", (r o r) p3_ineq; + "q1", (r o r) q1_ineq; + "q2", (r o r) q2_ineq; + "q3", (r o r) q3_ineq; + "q4", (r o r) q4_ineq; + "tausum_tri", (SYM o move_l o r) tausum_triangles; + "tausum_hi", (neg o r o r) tausum_upper_bound; + ];; +let mul_ineq c_tm ineq_th = + if (is_eq (concl ineq_th)) then + AP_TERM (mk_comb (`( * ):real->real->real`, c_tm)) ineq_th + else + let pos_ineq = REAL_ARITH (mk_binary "real_le" (`&0`, c_tm)) in + MATCH_MP REAL_LE_LMUL (CONJ pos_ineq ineq_th);; +let add_ineqs th1 th2 = MATCH_MP REAL_LE_ADD2 (CONJ th1 th2);; +let get_ineq (p,q,r) (name, c_tm) = + let p_tm = mk_small_numeral p and + q_tm = mk_small_numeral q and + r_tm = mk_small_numeral r in + let th0 = assoc name ineq_table in + let type_tm = mk_pair (p_tm, mk_pair (q_tm, r_tm)) in + let type_th = ASSUME (mk_eq (`type_of_node (hypermap_of_fan (V,ESTD V)) d`, type_tm)) in + let th1 = (DISCH_ALL o INST[p_tm, `p:num`; q_tm, `q:num`; r_tm, `r:num`]) th0 in + let th2 = (UNDISCH_ALL o REWRITE_RULE[type_th; ARITH]) th1 in + let th3 = mul_ineq c_tm th2 in + if (is_eq (concl th3)) then + MATCH_MP REAL_EQ_IMP_LE th3 + else + th3;; +let lp_data = [ + (4,0,0), ["anglesum_lo", `#0.259`; "p2", `#4.0`]; + (5,0,0), ["case50", `&1`]; + (6,0,0), ["anglesum_hi", `#0.626`; "p1", `#6.0`]; + (7,0,0), ["anglesum_hi", `#0.626`; "p1", `#7.0`]; + (2,1,0), ["anglesum_lo", `#0.453`; "p2", `#0.435`; + "p3", `#1.565`; "q4", `#1.0`; "azimp_lo", `#0.00012`]; + (3,1,0), ["anglesum_lo", `#0.259`; "p2", `#3.0`; + "q4", `#0.572`; "tauq_lo", `#0.428`; "azimq_lo", `#0.000116`]; + (4,1,0), ["anglesum_hi", `#0.626`; "p1", `#4.0`; + "q3", `#0.8266`; "tauq_lo", `#0.1734`; "azimq_lo", `#0.00001582`]; + (5,1,0), ["anglesum_hi", `#0.626`; "p1", `#5.0`; + "q3", `#0.8266`; "tauq_lo", `#0.1734`; "azimq_lo", `#0.00001582`]; + (1,2,0), ["anglesum_lo", `#0.453`; "p2", `#0.218`; + "p3", `#0.782`; "q4", `#2.0`; "azimp_hi", `#0.000064`]; + (2,2,0), ["taup_lo", `#2.0`; "tauq_lo", `#2.0`]; + (3,2,0), ["anglesum_hi", `#0.626`; "p1", `#3.0`; + "q3", `#1.6532`; "tauq_lo", `#0.3468`; "azimq_lo", `#0.00003164`]; + (0,3,0), ["tauq_lo", `#3.0`]; + (1,3,0), ["taup_lo", `#1.0`; "tauq_lo", `#3.0`]; + (2,3,0), ["anglesum_hi", `#0.7573`; "p1", `#2.0`; + "q3", `#3.0`; "azimp_lo", `#0.2626`]; + (0,4,0), ["anglesum_hi", `#0.7573`; "q3", `#4.0`]; + (0,5,0), ["anglesum_hi", `#0.972`; "q2", `#5.0`]; + (1,4,0), ["anglesum_hi", `#0.7573`; "p1", `#1.0`; + "q3", `#4.0`; "azimp_lo", `#0.1313`]; + (3,3,0), ["anglesum_hi", `#0.972`; "p1", `#3.0`; + "q2", `#3.0`; "azimp_lo", `#1.038`]; + (4,2,0), ["anglesum_hi", `#0.7573`; "p1", `#4.0`; + "q3", `#2.0`; "azimp_lo", `#0.5252`]; + (6,1,0), ["anglesum_hi", `#4.72`; "p1", `#6.0`; + "q1", `#1.0`; "azimp_lo", `#24.564`]; + (3,0,3), ["anglesum_hi", `#0.626`; "p1", `#3.0`; "azimr_lo", `#1.878`; + "taur_lo", `#3.0`; "tausum_hi", `&1`]; + (3,1,2), ["anglesum_hi", `#0.7573`; "p1", `#3.0`; + "q3", `#1.0`; "azimp_lo", `#0.3939`; "azimr_lo", `#1.5146`; + "taur_lo", `#2.0`; "tausum_hi", `&1`]; + (3,2,1), ["anglesum_hi", `#0.7573`; "p1", `#3.0`; + "q3", `#2.0`; "azimp_lo", `#0.3939`; "azimr_lo", `#0.7573`; + "taur_lo", `#1.0`; "tausum_hi", `&1`]; + (4,0,2), ["anglesum_hi", `#0.626`; "p1", `#4.0`; "azimr_lo", `#1.252`; + "taur_lo", `#2.0`; "tausum_hi", `&1`]; + (4,1,1), ["anglesum_hi", `#0.626`; "p1", `#4.0`; "q3", `#0.827`; + "azimr_lo", `#0.626`; "tauq_lo", `#0.173`; "azimq_hi", `#0.0002871`; + "taur_lo", `#1.0`; "tausum_hi", `&1`]; + (6,0,1), ["anglesum_hi", `#0.626`; "p1", `#6.0`; "azimr_lo", `#0.626`; + "taur_lo", `#1.0`; "tausum_hi", `&1`]; + (5,0,1), ["anglesum_hi", `#0.626`; "p1", `#5.0`; "azimr_lo", `#0.626`; + "tausum", `&1`; "tausum_tri", `-- &1`]; +];; +let get_b_tame_ineq node_type = + let data = assoc node_type lp_data @ ["tausum", `-- &1`] in + let ths = map (get_ineq node_type) data in + let sum = end_itlist add_ineqs ths in + let conv = BINOP_CONV (NUM_REDUCE_CONV THENC REWRITE_CONV[DECIMAL] THENC REAL_POLY_CONV) in + CONV_RULE conv sum;; + +(* Section KCBLRQC *) +Sections.begin_section "KCBLRQC";; +(Sections.add_section_hyp "h_main" (`lp_main_estimate`));; +(Sections.add_section_hyp "ineqs" (`kcblrqc_ineq_def`));; + +(* Lemma KCBLRQC *) +let KCBLRQC = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + ==> let H = hypermap_of_fan (V,ESTD V) in + let (p,q,r) = type_of_node H d in + (r > 0) \/ (sum (set_of_face_meeting_node H d) (\f. tauVEF (V,ESTD V,f)) >= b_tame p q)` +[ + ((BETA_TAC THEN (move ["d_in"])) THEN (CONV_TAC let_CONV)); + ((THENL_FIRST) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("NODE_TYPE_lemma", [NODE_TYPE_lemma])) (fun fst_arg -> (use_arg_then2 ("simpleH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)) ((ALL_TAC) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`CARD _`))) (term_tac (set_tac "p"))); + ((fun arg_tac -> arg_tac (Arg_term (`CARD _`))) (term_tac (set_tac "q"))); + ((fun arg_tac -> arg_tac (Arg_term (`CARD _`))) (term_tac (set_tac "r"))); + ((BETA_TAC THEN (move ["type_eq"])) THEN (((use_arg_then2 ("type_eq", []))(thm_tac (new_rewrite [] [])))) THEN (CONV_TAC let_CONV)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Cdtetat_tame.CDTETAT", [Cdtetat_tame.CDTETAT])) (fun fst_arg -> (use_arg_then2 ("ineqs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("contrV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("type_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LET_DEF", [LET_DEF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LET_END_DEF", [LET_END_DEF]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["pq_in"])); + (((fun arg_tac -> arg_tac (Arg_term (`r > 0`))) (disch_eq_tac "r_gt0" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`r = 0`))) (term_tac (have_gen_tac [](move ["r0"])))) ((((use_arg_then2 ("r_gt0", [])) (disch_tac [])) THEN (clear_assumption "r_gt0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("type_eq", [])) (disch_tac [])) THEN (clear_assumption "type_eq") THEN ((use_arg_then2 ("pq_in", [])) (disch_tac [])) THEN (clear_assumption "pq_in") THEN BETA_TAC) THEN ((((use_arg_then2 ("r0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addn0", [addn0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 20 0 (((fun arg_tac ->(use_arg_then2 ("IN_SING", [IN_SING]))(fun tmp_arg1 -> (use_arg_then2 ("IN_INSERT", [IN_INSERT]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 20 0 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (0,3,0)))) (disch_tac [])) THEN BETA_TAC) THEN (REWRITE_TAC[b_tame; PAIR_EQ; ARITH]) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (0,4,0)))) (disch_tac [])) THEN BETA_TAC) THEN (REWRITE_TAC[b_tame; PAIR_EQ; ARITH]) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (0,5,0)))) (disch_tac [])) THEN BETA_TAC) THEN (REWRITE_TAC[b_tame; PAIR_EQ; ARITH; tgt]) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (1,2,0)))) (disch_tac [])) THEN BETA_TAC) THEN (REWRITE_TAC[b_tame; PAIR_EQ; ARITH; tgt]) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (1,3,0)))) (disch_tac [])) THEN BETA_TAC) THEN (REWRITE_TAC[b_tame; PAIR_EQ; ARITH; tgt]) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (1,4,0)))) (disch_tac [])) THEN BETA_TAC) THEN (REWRITE_TAC[b_tame; PAIR_EQ; ARITH; tgt]) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (2,1,0)))) (disch_tac [])) THEN BETA_TAC) THEN (REWRITE_TAC[b_tame; PAIR_EQ; ARITH; tgt]) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (2,2,0)))) (disch_tac [])) THEN BETA_TAC) THEN (REWRITE_TAC[b_tame; PAIR_EQ; ARITH; tgt]) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (2,3,0)))) (disch_tac [])) THEN BETA_TAC) THEN (REWRITE_TAC[b_tame; PAIR_EQ; ARITH; tgt]) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (3,1,0)))) (disch_tac [])) THEN BETA_TAC) THEN (REWRITE_TAC[b_tame; PAIR_EQ; ARITH; tgt]) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (3,2,0)))) (disch_tac [])) THEN BETA_TAC) THEN (REWRITE_TAC[b_tame; PAIR_EQ; ARITH; tgt]) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (3,3,0)))) (disch_tac [])) THEN BETA_TAC) THEN (REWRITE_TAC[b_tame; PAIR_EQ; ARITH; tgt]) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (4,0,0)))) (disch_tac [])) THEN BETA_TAC) THEN (REWRITE_TAC[b_tame; PAIR_EQ; ARITH; tgt]) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (4,1,0)))) (disch_tac [])) THEN BETA_TAC) THEN (REWRITE_TAC[b_tame; PAIR_EQ; ARITH; tgt]) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (4,2,0)))) (disch_tac [])) THEN BETA_TAC) THEN (REWRITE_TAC[b_tame; PAIR_EQ; ARITH; tgt]) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (5,0,0)))) (disch_tac [])) THEN BETA_TAC) THEN (REWRITE_TAC[b_tame; PAIR_EQ; ARITH; tgt]) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (5,1,0)))) (disch_tac [])) THEN BETA_TAC) THEN (REWRITE_TAC[b_tame; PAIR_EQ; ARITH; tgt]) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (6,0,0)))) (disch_tac [])) THEN BETA_TAC) THEN (REWRITE_TAC[b_tame; PAIR_EQ; ARITH; tgt]) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (6,1,0)))) (disch_tac [])) THEN BETA_TAC) THEN (REWRITE_TAC[b_tame; PAIR_EQ; ARITH; tgt]) THEN (arith_tac) THEN (done_tac))); + ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (7,0,0)))) (disch_tac [])) THEN BETA_TAC) THEN (REWRITE_TAC[b_tame; PAIR_EQ; ARITH; tgt]) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section KCBLRQC *) +let KCBLRQC = Sections.finalize_theorem KCBLRQC;; +Sections.end_section "KCBLRQC";; + +(* Section BDJYFFB *) +Sections.begin_section "BDJYFFB";; +(Sections.add_section_hyp "h_main" (`lp_main_estimate`));; +(Sections.add_section_hyp "ineqs" (`kcblrqc_ineq_def`));; + +(* Lemma BDJYFFB1 *) +let BDJYFFB1 = Sections.section_proof [] +`tame_12o (hypermap_of_fan (V,ESTD V))` +[ + (((((use_arg_then2 ("tame_12o", [tame_12o]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("node_type_exceptional_face", [node_type_exceptional_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("node_exceptional_face", [node_exceptional_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("exceptional_face", [exceptional_face]))(thm_tac (new_rewrite [] []))))) THEN (move ["d"])); + (((fun arg_tac -> arg_tac (Arg_term (`CARD _ >= 5`))) (disch_eq_tac "card_f" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`d IN dart_of_fan (V,ESTD V)`))) (term_tac (have_gen_tac [](move ["d_in"])))); + ((((fun arg_tac -> (use_arg_then2 ("Add_triangle.fully_surrounded_dart_of_fan_eq", [Add_triangle.fully_surrounded_dart_of_fan_eq])) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("CARD_FACE_GT_1", [CARD_FACE_GT_1])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_f", [])) (disch_tac [])) THEN (clear_assumption "card_f") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("NODE_TYPE_lemma", [NODE_TYPE_lemma])) (fun fst_arg -> (use_arg_then2 ("simpleH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)) ((ALL_TAC) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`CARD _`))) (term_tac (set_tac "p"))); + ((fun arg_tac -> arg_tac (Arg_term (`CARD _`))) (term_tac (set_tac "q"))); + ((fun arg_tac -> arg_tac (Arg_term (`CARD _`))) (term_tac (set_tac "r"))); + (BETA_TAC THEN (move ["type_eq"])); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FULLY_SURROUNDED_IMP_CARD_NODE_EQ_SUM_NODE_TYPE", [FULLY_SURROUNDED_IMP_CARD_NODE_EQ_SUM_NODE_TYPE])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("simpleH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("type_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LET_DEF", [LET_DEF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LET_END_DEF", [LET_END_DEF]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["card_node_eq"])); + ((fun arg_tac -> arg_tac (Arg_term (`FINITE {x | x IN node (hypermap_of_fan (V,ESTD V)) d + /\ CARD (face (hypermap_of_fan (V,ESTD V)) x) >= 5}`))) (term_tac (have_gen_tac [](move ["fin_s"])))); + (((use_arg_then2 ("FINITE_SUBSET", [FINITE_SUBSET])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`node (hypermap_of_fan (V,ESTD V)) d`))) (term_tac exists_tac))); + ((((((use_arg_then2 ("NODE_FINITE", [NODE_FINITE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"]) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`1 <= r`))) (term_tac (have_gen_tac [](move ["r_ge1"])))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`~(r = 0)`))) (term_tac (have_gen_tac []ALL_TAC)))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("r_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("CARD_EQ_0", [CARD_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("MEMBER_NOT_EMPTY", [MEMBER_NOT_EMPTY]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((use_arg_then2 ("d", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("node_refl", [node_refl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Cdtetat_tame.CDTETAT", [Cdtetat_tame.CDTETAT])) (fun fst_arg -> (use_arg_then2 ("ineqs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("contrV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("type_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LET_DEF", [LET_DEF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LET_END_DEF", [LET_END_DEF]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["pqr_in"])); + ((THENL_ROT (-1)) (split_tac)); + ((((use_arg_then2 ("r_ge1", [])) (disch_tac [])) THEN (clear_assumption "r_ge1") THEN ((use_arg_then2 ("pqr_in", [])) (disch_tac [])) THEN (clear_assumption "pqr_in") THEN BETA_TAC) THEN ((repeat_tactic 20 0 (((fun arg_tac ->(use_arg_then2 ("IN_SING", [IN_SING]))(fun tmp_arg1 -> (use_arg_then2 ("IN_INSERT", [IN_INSERT]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 20 0 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))))); + ((repeat_tactic 0 20 (case)) THEN (TRY ((arith_tac)))); + ((BETA_TAC THEN (move ["p_eq"]) THEN (move ["qr_eq"]) THEN (move ["r_ge1"])) THEN (((use_arg_then2 ("type_eq", [])) (disch_tac [])) THEN (clear_assumption "type_eq") THEN BETA_TAC) THEN (((use_arg_then2 ("p_eq", []))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`q = 0 /\ r = 1`))) (term_tac (have_gen_tac [](case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))))) ((((use_arg_then2 ("r_ge1", [])) (disch_tac [])) THEN (clear_assumption "r_ge1") THEN ((use_arg_then2 ("qr_eq", [])) (disch_tac [])) THEN (clear_assumption "qr_eq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((BETA_TAC THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (6,0,1)))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("r_ge1", [])) (disch_tac [])) THEN (clear_assumption "r_ge1") THEN ((use_arg_then2 ("pqr_in", [])) (disch_tac [])) THEN (clear_assumption "pqr_in") THEN BETA_TAC) THEN ((repeat_tactic 20 0 (((fun arg_tac ->(use_arg_then2 ("IN_SING", [IN_SING]))(fun tmp_arg1 -> (use_arg_then2 ("IN_INSERT", [IN_INSERT]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 30 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))))); + ((repeat_tactic 0 20 (case)) THEN (TRY ((arith_tac)))); + ((BETA_TAC THEN (move ["p_eq"]) THEN (move ["qr_eq"]) THEN (move ["r_ge1"]) THEN (move ["_"])) THEN (((use_arg_then2 ("type_eq", [])) (disch_tac [])) THEN (clear_assumption "type_eq") THEN BETA_TAC) THEN (((use_arg_then2 ("p_eq", []))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`q = 0 /\ r = 3 \/ q = 1 /\ r = 2 \/ q = 2 /\ r = 1`))) (term_tac (have_gen_tac []ALL_TAC))) ((((use_arg_then2 ("qr_eq", [])) (disch_tac [])) THEN (clear_assumption "qr_eq") THEN ((use_arg_then2 ("r_ge1", [])) (disch_tac [])) THEN (clear_assumption "r_ge1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (3,0,3)))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (3,1,2)))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (3,2,1)))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((BETA_TAC THEN (move ["p_eq"]) THEN (move ["qr_eq"]) THEN (move ["r_ge1"]) THEN (move ["_"])) THEN (((use_arg_then2 ("type_eq", [])) (disch_tac [])) THEN (clear_assumption "type_eq") THEN BETA_TAC) THEN (((use_arg_then2 ("p_eq", []))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`q = 0 /\ r = 2 \/ q = 1 /\ r = 1`))) (term_tac (have_gen_tac []ALL_TAC))) ((((use_arg_then2 ("qr_eq", [])) (disch_tac [])) THEN (clear_assumption "qr_eq") THEN ((use_arg_then2 ("r_ge1", [])) (disch_tac [])) THEN (clear_assumption "r_ge1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) case ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (4,0,2)))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((BETA_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (move ["type_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (4,1,1)))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma BDJYFFB2 *) +let BDJYFFB2 = Sections.section_proof ["d"] +`let H = hypermap_of_fan (V,ESTD V) in + d IN dart_of_fan (V,ESTD V) /\ type_of_node H d = (5,0,1) + ==> #0.63 < sum {f | f IN set_of_face_meeting_node H d /\ CARD f = 3} + (\f. tauVEF (V, ESTD V,f))` +[ + ((CONV_TAC let_CONV) THEN ALL_TAC THEN (case THEN (move ["d_in"])) THEN (move ["type_eq"])); + (((fun arg_tac -> arg_tac (Arg_theorem (get_b_tame_ineq (5,0,1)))) (disch_tac [])) THEN BETA_TAC); + ((fun arg_tac -> arg_tac (Arg_term (`sum _1 _2`))) (term_tac (set_tac "s"))); + ((arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section BDJYFFB *) +let BDJYFFB1 = Sections.finalize_theorem BDJYFFB1;; +let BDJYFFB2 = Sections.finalize_theorem BDJYFFB2;; +Sections.end_section "BDJYFFB";; + +(* Finalization of the section Contravening *) +let anglesum = Sections.finalize_theorem anglesum;; +let anglesum_lo_approx = Sections.finalize_theorem anglesum_lo_approx;; +let anglesum_hi_approx = Sections.finalize_theorem anglesum_hi_approx;; +let tausum_eq = Sections.finalize_theorem tausum_eq;; +let tausum_triangles = Sections.finalize_theorem tausum_triangles;; +let tausum_upper_bound = Sections.finalize_theorem tausum_upper_bound;; +let azimp_lo = Sections.finalize_theorem azimp_lo;; +let azimp_hi = Sections.finalize_theorem azimp_hi;; +let azimq_lo = Sections.finalize_theorem azimq_lo;; +let azimr_lo = Sections.finalize_theorem azimr_lo;; +let azimq_hi = Sections.finalize_theorem azimq_hi;; +let azimq_hi_approx = Sections.finalize_theorem azimq_hi_approx;; +let azimr_hi = Sections.finalize_theorem azimr_hi;; +let taup_lo = Sections.finalize_theorem taup_lo;; +let tauq_lo = Sections.finalize_theorem tauq_lo;; +let taur_lo = Sections.finalize_theorem taur_lo;; +let case50_ineq = Sections.finalize_theorem case50_ineq;; +let p1_ineq = Sections.finalize_theorem p1_ineq;; +let p2_ineq = Sections.finalize_theorem p2_ineq;; +let p3_ineq = Sections.finalize_theorem p3_ineq;; +let q1_ineq = Sections.finalize_theorem q1_ineq;; +let q2_ineq = Sections.finalize_theorem q2_ineq;; +let q3_ineq = Sections.finalize_theorem q3_ineq;; +let q4_ineq = Sections.finalize_theorem q4_ineq;; +let KCBLRQC = Sections.finalize_theorem KCBLRQC;; +let BDJYFFB1 = Sections.finalize_theorem BDJYFFB1;; +let BDJYFFB2 = Sections.finalize_theorem BDJYFFB2;; +Sections.end_section "Contravening";; + +(* Close the module *) +end;; diff --git a/text_formalization/tame/ssreflect/MQMSMAB-compiled.hl b/text_formalization/tame/ssreflect/MQMSMAB-compiled.hl new file mode 100644 index 0000000..5a95da1 --- /dev/null +++ b/text_formalization/tame/ssreflect/MQMSMAB-compiled.hl @@ -0,0 +1,89 @@ +needs "../formal_lp/hypermap/ineqs/lp_ineqs_proofs-compiled.hl";; +needs "../formal_lp/hypermap/ineqs/lp_main_estimate-compiled.hl";; +needs "tame/CDTETAT.hl";; +needs "tame/ssreflect/KCBLRQC-compiled.hl";; + +(* Module Mqmsmab*) +module Mqmsmab = struct + +open Ssrbool;; +open Ssrnat;; +open Hypermap;; +open Tame_lemmas;; +open Tame_defs;; +open Tame_general;; +open Hypermap_and_fan;; +open Hypermap_iso;; +open Kcblrqc;; +open Jgtdebu;; +open Cdtetat_tame;; +open Lp_ineqs_proofs;; +open Lp_main_estimate;; + +(* Section MQMSMAB *) +Sections.begin_section "MQMSMAB";; +(Sections.add_section_hyp "ineqs" (`kcblrqc_ineq_def`));; +(Sections.add_section_hyp "h_main" (`lp_main_estimate`));; + +(* Lemma MQMSMAB *) +let MQMSMAB = Sections.section_proof ["V"] +`contravening V ==> tame_hypermap (hypermap_of_fan (V, ESTD V))` +[ + ((((use_arg_then2 ("tame_hypermap", [tame_hypermap]))(thm_tac (new_rewrite [] [])))) THEN (move ["contrV"])); + ((fun arg_tac -> (use_arg_then2 ("contravening_lp_fan", [contravening_lp_fan])) (fun fst_arg -> (use_arg_then2 ("contrV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["h_fan"]))); + ((((use_arg_then2 ("h_fan", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_fan", [lp_fan]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["fanV"])) THEN (case THEN (move ["f_surr"])) THEN (case THEN (move ["subV"])) THEN (move ["packV"]))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (move ["_"]))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Crttxat_tame.CRTTXAT", [Crttxat_tame.CRTTXAT])) (fun fst_arg -> (use_arg_then2 ("JGTDEBU4", [JGTDEBU4])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("contrV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_perimeter_bound", [fully_surrounded_perimeter_bound])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["card"]))); + ((((use_arg_then2 ("card", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card", [])) (disch_tac [])) THEN (clear_assumption "card") THEN BETA_TAC) THEN ((((use_arg_then2 ("tame_9a", [tame_9a]))(thm_tac (new_rewrite [] [])))) THEN (move ["card_ineq"]))); + ((((use_arg_then2 ("JGTDEBU10", [JGTDEBU10]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("JGTDEBU11", [JGTDEBU11]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SZIPOAS", [SZIPOAS]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("BDJYFFB1", [BDJYFFB1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("tame_1", [tame_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("JGTDEBU1", [JGTDEBU1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("JGTDEBU2", [JGTDEBU2]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("tame_2", [tame_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("JGTDEBU3", [JGTDEBU3]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("JGTDEBU4", [JGTDEBU4]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("tame_3", [tame_3]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("JGTDEBU5", [JGTDEBU5]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("tame_4", [tame_4]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("JGTDEBU6", [JGTDEBU6]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("tame_5a", [tame_5a]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("JGTDEBU7", [JGTDEBU7]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("tame_8", [tame_8]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("JGTDEBU8", [JGTDEBU8]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 12 0 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("tame_13a", [tame_13a]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("admissible_weight", [admissible_weight]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("total_weight", [total_weight]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H"))); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`\f. tauVEF (V,ESTD V,f)`))) (term_tac exists_tac)) THEN (split_tac))); + ((((use_arg_then2 ("REAL_LET_TRANS", [REAL_LET_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`&4 * pi - &20 * sol0`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("tgt", [tgt]))(thm_tac (new_rewrite [] []))))); + ((THENL_LAST) (split_tac) ((((use_arg_then2 ("Flyspeck_constants.bounds", [Flyspeck_constants.bounds])) (disch_tac [])) THEN (clear_assumption "Flyspeck_constants.bounds") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sum_tauVEF_upper_bound", [sum_tauVEF_upper_bound])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("contrV", [])) (disch_tac [])) THEN (clear_assumption "contrV") THEN BETA_TAC) THEN (((((use_arg_then2 ("contravening", [contravening]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_gt", [real_gt]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("adm_1", [adm_1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("adm_2", [adm_2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("adm_3", [adm_3]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)); + (BETA_TAC THEN (move ["d"]) THEN (move ["d_in"])); + ((fun arg_tac -> arg_tac (Arg_term (`CARD (face H d) = k ==> d IN darts_k k H`))) (term_tac (have_gen_tac ["k"](move ["d_in_k"])))); + (((((use_arg_then2 ("List_hypermap.darts_k", [List_hypermap.darts_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`a >= 3 /\ a <= 6 ==> a = 3 \/ a = 4 \/ a = 5 \/ a = 6`))) (term_tac (have_gen_tac ["a"](move ["ineq"])))) ((arith_tac) THEN (done_tac))); + (((fun arg_tac -> (use_arg_then2 ("card_ineq", [])) (fun fst_arg -> (use_arg_then2 ("d_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("ineq", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC); + ((repeat_tactic 1 9 (case)) THEN (BETA_TAC THEN (move ["card_eq"])) THEN ((((use_arg_then2 ("card_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_tame", [d_tame]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_ge", [real_ge]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 20 (((use_arg_then2 ("ARITH_EQ", [ARITH_EQ]))(fun arg -> ONCE_REWRITE_TAC[get_arg_thm arg]))))); + ((((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("ineq_tau3_tauVEF_std", [ineq_tau3_tauVEF_std])) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REFL_CLAUSE", [REFL_CLAUSE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_in_k", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (move ["a"]) THEN (move ["b"]) THEN (move ["c"]) THEN (move ["cond"])) THEN (((use_arg_then2 ("h_main", [])) (disch_tac [])) THEN (clear_assumption "h_main") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_main_estimate", [lp_main_estimate]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("ineq_tau4_tauVEF_std", [ineq_tau4_tauVEF_std])) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REFL_CLAUSE", [REFL_CLAUSE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_in_k", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (move ["a"]) THEN (move ["b"]) THEN (move ["c"]) THEN (move ["cond"])) THEN (((use_arg_then2 ("h_main", [])) (disch_tac [])) THEN (clear_assumption "h_main") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_main_estimate", [lp_main_estimate]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("ineq_tau5_tauVEF_std", [ineq_tau5_tauVEF_std])) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REFL_CLAUSE", [REFL_CLAUSE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_in_k", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (move ["a"]) THEN (move ["b"]) THEN (move ["c"]) THEN (move ["cond"])) THEN (((use_arg_then2 ("h_main", [])) (disch_tac [])) THEN (clear_assumption "h_main") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_main_estimate", [lp_main_estimate]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("ineq_tau6_tauVEF_std", [ineq_tau6_tauVEF_std])) (fun fst_arg -> (use_arg_then2 ("h_fan", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REFL_CLAUSE", [REFL_CLAUSE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("d_in_k", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (move ["a"]) THEN (move ["b"]) THEN (move ["c"]) THEN (move ["cond"])) THEN (((use_arg_then2 ("h_main", [])) (disch_tac [])) THEN (clear_assumption "h_main") THEN BETA_TAC) THEN ((((use_arg_then2 ("lp_main_estimate", [lp_main_estimate]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((split_tac) THEN (move ["d"])); + (((fun arg_tac -> arg_tac (Arg_term (`CARD _`))) (term_tac (set_tac "r"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`CARD _`))) (term_tac (set_tac "p"))) THEN ((fun arg_tac -> arg_tac (Arg_term (`CARD _`))) (term_tac (set_tac "q"))) THEN (BETA_TAC THEN (case THEN (move ["d_in"])) THEN (move ["r0"]))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`type_of_node H d = p,q,0`))) (term_tac (have_gen_tac [](move ["type_eq"])))) ((((use_arg_then2 ("type_of_node", [type_of_node]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE KCBLRQC))) (fun fst_arg -> (use_arg_then2 ("contrV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h_main", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineqs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("d_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("type_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("LET_DEF", [LET_DEF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LET_END_DEF", [LET_END_DEF]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("GT", [GT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LT_REFL", [LT_REFL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orFb", [orFb]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (case THEN (move ["d_in"])) THEN (move ["type_eq"])) THEN ((((use_arg_then2 ("a_tame", [a_tame]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_ge", [real_ge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE BDJYFFB2))) (fun fst_arg -> (use_arg_then2 ("contrV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h_main", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ineqs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("d", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((THENL_FIRST) (((((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("type_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (ANTS_TAC)) ((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`GSPEC _`))) (term_tac (set_tac "s"))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`s = set_of_triangles_meeting_node H d`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((ALL_TAC) THEN (done_tac))); + ((((use_arg_then2 ("s_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_of_triangles_meeting_node", [set_of_triangles_meeting_node]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("set_of_face_meeting_node", [set_of_face_meeting_node]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("inE", [inE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["f"])); + ((THENL) (split_tac) [((case THEN ALL_TAC) THEN (case THEN (move ["y"])) THEN (case THEN (move ["y_in"])) THEN (move ["f_eq"]) THEN (move ["card_f"])); ((case THEN (move ["y"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["y_in"])) THEN (case THEN (move ["card_f"])) THEN (move ["y_in_n"]) THEN (move ["f_eq"]))]); + (((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("f_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [2] [])))) THEN (((use_arg_then2 ("card_f", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((use_arg_then2 ("y", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Finalization of the section MQMSMAB *) +let MQMSMAB = Sections.finalize_theorem MQMSMAB;; +Sections.end_section "MQMSMAB";; + +(* Close the module *) +end;; diff --git a/text_formalization/tame/ssreflect/seq2-compiled.hl b/text_formalization/tame/ssreflect/seq2-compiled.hl new file mode 100644 index 0000000..afa8ef8 --- /dev/null +++ b/text_formalization/tame/ssreflect/seq2-compiled.hl @@ -0,0 +1,2046 @@ +needs "Examples/seq-compiled.hl";; +flyspeck_needs "hypermap/hypermap.hl";; + +(* Module Seq2*) +module Seq2 = struct + +open Ssrbool;; +open Ssrnat;; +open Seq;; +parse_as_infix ("::", (12, "right"));; +override_interface ("::", `CONS`);; +make_overloadable "++" `:A -> A -> A`;; +overload_interface ("++", `cat`);; +parse_as_infix("<-", (11, "right"));; +override_interface("<-", `MEM`);; +let delete_at = (GEN_ALL o define) `delete_at i [] = [] /\ delete_at 0 (h :: t) = t /\ + delete_at (SUC i) (h :: t) = h :: delete_at i t`;; +let delete1 = (GEN_ALL o define) + `delete1 x [] = [] /\ delete1 x (h :: t) = if x = h then t else h :: delete1 x t`;; +let butlast = (GEN_ALL o define) + `butlast [] = [] /\ butlast [h] = [] /\ butlast (h :: (h2 :: t)) = h :: butlast (h2 :: t)`;; +let list_sum = new_definition `list_sum s f = foldr (\a b. f a + b) (&0) s`;; +let list_sumn = new_definition `list_sumn s f = foldr (\a b. f a + b) 0 s`;; +let next_el = new_definition `next_el s x = + if (indexl x s = sizel s - 1) then (headl x s) else (nth x s (indexl x s + 1))`;; +let prev_el = new_definition `prev_el s x = + if ~(MEM x s) then x + else if (indexl x s = 0) then (last x s) else (nth x s (indexl x s - 1))`;; +let EL = GEN_ALL EL;; +let HD = GEN_ALL HD;; +let TL = GEN_ALL TL;; +let MEM = GEN_ALL MEM;; +let ALL = GEN_ALL ALL;; +let ALL2 = GEN_ALL ALL2;; +let uniq = GEN_ALL uniq;; +let foldr = GEN_ALL foldr;; +let iter = GEN_ALL iter;; +let undup = GEN_ALL undup;; +let iota = GEN_ALL iota;; +let map = GEN_ALL map;; +let zip = GEN_ALL zip;; +let take = GEN_ALL Seq.take;; + +(* Lemma pair_expand *) +let pair_expand = Sections.section_proof ["p"] +`p = FST p, SND p` +[ + ((ALL_TAC) THEN (done_tac)); +];; + +(* Section SeqList *) +Sections.begin_section "SeqList";; + +(* Lemma ALL_all *) +let ALL_all = Sections.section_proof [] +`ALL = all` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] []))))) THEN (move ["P"])) THEN ((THENL) elim [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN ((((use_arg_then2 ("ALL", [ALL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("all", [all]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma APPEND_cat *) +let APPEND_cat = Sections.section_proof [] +`APPEND = cat` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] []))))) THEN ((THENL) elim [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN ((((use_arg_then2 ("APPEND", [APPEND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma head_HD *) +let head_HD = Sections.section_proof ["x0";"s"] +`0 < sizel s ==> headl x0 s = HD s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["_"]))]) THEN ((((fun arg_tac ->(use_arg_then2 ("size_nil", [size_nil]))(fun tmp_arg1 -> (use_arg_then2 ("head", [head]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac ->(use_arg_then2 ("ltn0", [ltn0]))(fun tmp_arg1 -> (use_arg_then2 ("HD", [HD]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma EL_nth *) +let EL_nth = Sections.section_proof ["x0";"s";"i"] +`i < sizel s ==> EL i s = nth x0 s i` +[ + ((((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN ((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IH"]))]) THEN ((THENL) case [ALL_TAC; ((move ["h"]) THEN (move ["t"]))])) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("EL", [EL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LENGTH", [LENGTH]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("HD", [HD]))(thm_tac (new_rewrite [] [])))))) THEN (TRY ((arith_tac)))); + ((((((use_arg_then2 ("TL", [TL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))) THEN (move ["n_lt"])) THEN (((use_arg_then2 ("IH", [])) (disch_tac [])) THEN (clear_assumption "IH") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma EL_map *) +let EL_map = Sections.section_proof ["i";"s";"f"] +`i < LENGTH s ==> EL i (map f s) = f (EL i s)` +[ + ((((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (BETA_TAC THEN (move ["i_lt"])) THEN ((((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(@)UNIV`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_map", [size_map]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((((fun arg_tac -> (use_arg_then2 ("nth_map", [nth_map])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(@)UNIV`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_term (`(@)UNIV`))) (term_tac exists_tac)) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("EL_nth", [EL_nth]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma EL_mkseq *) +let EL_mkseq = Sections.section_proof ["i";"f";"n"] +`i < n ==> EL i (mkseq f n) = f i` +[ + ((BETA_TAC THEN (move ["i_lt"])) THEN ((((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(@)UNIV`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("nth_mkseq", [nth_mkseq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma all_EL_P *) +let all_EL_P = Sections.section_proof ["a";"s"] +`(!i. i < sizel s ==> a (EL i s)) <=> all a s` +[ + ((THENL) (split_tac) [(move ["h"]); ((move ["all_s"]) THEN (move ["i"]) THEN (move ["i_lt"]))]); + ((((fun arg_tac -> (use_arg_then2 ("all_nthP", [all_nthP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(@)UNIV`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["i_lt"])); + (((((use_arg_then2 ("EL_nth", [EL_nth]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("h", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((in_tac ["all_s"] false (((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((((use_arg_then2 ("all_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM_EL", [MEM_EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma EL_take *) +let EL_take = Sections.section_proof ["n";"i";"s"] +`i < n /\ i < sizel s ==> EL i (take n s) = EL i s` +[ + (BETA_TAC THEN (case THEN ((move ["i_lt_n"]) THEN (move ["i_lt"])))); + ((THENL_FIRST) ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(@)UNIV`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_take", [size_take]))(thm_tac (new_rewrite [] [])))))) ((((use_arg_then2 ("i_lt_n", [])) (disch_tac [])) THEN (clear_assumption "i_lt_n") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("nth_take", [nth_take]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma EL_index *) +let EL_index = Sections.section_proof ["x";"s"] +`x <- s ==> EL (indexl x s) s = x` +[ + ((BETA_TAC THEN (move ["mem_x"])) THEN ((((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(@)UNIV`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("nth_index", [nth_index]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ALL2_cat *) +let ALL2_cat = Sections.section_proof ["f";"s1";"t1";"s2";"t2"] +`sizel s1 = sizel s2 ==> + (ALL2 f (s1 ++ t1) (s2 ++ t2) <=> ALL2 f s1 s2 /\ ALL2 f t1 t2)` +[ + ((((THENL) (((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["h1"]) THEN (move ["r1"]) THEN (move ["Ih"]))]) THEN ((THENL) case [ALL_TAC; ((move ["h2"]) THEN (move ["r2"]))])) THEN ((repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("size_cons", [size_cons]))(fun tmp_arg1 -> (use_arg_then2 ("size_nil", [size_nil]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ALL2", [ALL2]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (TRY ((arith_tac)))); + (((((use_arg_then2 ("eqSS", [eqSS]))(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("Ih", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andbA", [andbA]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section SeqList *) +let ALL_all = Sections.finalize_theorem ALL_all;; +let APPEND_cat = Sections.finalize_theorem APPEND_cat;; +let head_HD = Sections.finalize_theorem head_HD;; +let EL_nth = Sections.finalize_theorem EL_nth;; +let EL_map = Sections.finalize_theorem EL_map;; +let EL_mkseq = Sections.finalize_theorem EL_mkseq;; +let all_EL_P = Sections.finalize_theorem all_EL_P;; +let EL_take = Sections.finalize_theorem EL_take;; +let EL_index = Sections.finalize_theorem EL_index;; +let ALL2_cat = Sections.finalize_theorem ALL2_cat;; +Sections.end_section "SeqList";; + +(* Section Misc *) +Sections.begin_section "Misc";; + +(* Lemma length_le_1 *) +let length_le_1 = Sections.section_proof ["s"] +`LENGTH s <= 1 ==> s = [] \/ s = [HD s]` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN case) [ALL_TAC; ((move ["h"]) THEN ((THENL) case [ALL_TAC; ((move ["h2"]) THEN (move ["t"]))]))]) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("LENGTH", [LENGTH]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("HD", [HD]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma count0 *) +let count0 = Sections.section_proof ["P";"s"] +`count P s = 0 <=> all (predC P) s` +[ + (((((use_arg_then2 ("all_predC", [all_predC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_count", [has_count]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma count_filterI *) +let count_filterI = Sections.section_proof ["a1";"a2";"s"] +`count a1 (filter a2 s) = count (predI a1 a2) s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN ((((use_arg_then2 ("filter", [filter]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("count", [count]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("predI", [predI]))(thm_tac (new_rewrite [1] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("IH", []))(gsym_then (thm_tac (new_rewrite [] []))))))); + ((((fun arg_tac -> arg_tac (Arg_term (`a2 h`))) (disch_tac [])) THEN case THEN (simp_tac)) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("count", [count]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma seq_eq_mkseq *) +let seq_eq_mkseq = Sections.section_proof ["x0";"s"] +`s = mkseq (nth x0 s) (sizel s)` +[ + (((fun arg_tac -> (use_arg_then2 ("eq_from_nth", [eq_from_nth])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac)) THEN (((((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["i"]) THEN (move ["i_lt"])) THEN (((use_arg_then2 ("nth_mkseq", [nth_mkseq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma seq_wf_ind *) +let seq_wf_ind = Sections.section_proof ["P"] +`(!s:(A)list. (!l. LENGTH l < LENGTH s ==> P l) ==> P s) ==> (!s. P s)` +[ + (((fun arg_tac -> (use_arg_then2 ("WF_MEASURE", [WF_MEASURE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`LENGTH:(A)list->num`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + ((((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL WF_IND)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEASURE", [MEASURE]))(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("P", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (move ["h"]) THEN (move ["h2"]) THEN (move ["s"])) THEN (((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma length_eq_imp_length_tl_eq *) +let length_eq_imp_length_tl_eq = Sections.section_proof ["s1";"s2"] +`LENGTH (s1:(A)list) = LENGTH (s2:(A)list) ==> + LENGTH (TL s1) = LENGTH (TL s2)` +[ + ((((THENL) (((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]))]) THEN (move ["s2"])) THEN (((use_arg_then2 ("LENGTH", [LENGTH]))(thm_tac (new_rewrite [] []))))); + ((((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LENGTH_EQ_NIL", [LENGTH_EQ_NIL]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["len_eq"])) THEN ((((use_arg_then2 ("TL", [TL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LENGTH_TL", [LENGTH_TL]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("len_eq", [])) (disch_tac [])) THEN (clear_assumption "len_eq") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("LENGTH", [LENGTH]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("len_eq", [])) (disch_tac [])) THEN (clear_assumption "len_eq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma ge_length_imp_EL_eq *) +let ge_length_imp_EL_eq = Sections.section_proof ["k";"s1";"s2"] +`LENGTH s1 = LENGTH s2 /\ LENGTH s1 <= k ==> EL k s1 = EL k s2` +[ + ((((THENL) (((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN ((use_arg_then2 ("k", [])) (disch_tac [])) THEN (clear_assumption "k") THEN elim) [ALL_TAC; ((move ["k"]) THEN (move ["IH"]))]) THEN (move ["s1"]) THEN (move ["s2"])) THEN (repeat_tactic 1 9 (((use_arg_then2 ("EL", [EL]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("leqn0", [leqn0]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["len_eq"]) THEN (move ["s1_0"])))) THEN (((use_arg_then2 ("s1_0", [])) (disch_tac [])) THEN ((use_arg_then2 ("len_eq", [])) (disch_tac [])) THEN (clear_assumption "len_eq") THEN BETA_TAC)); + ((((((use_arg_then2 ("s1_0", []))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LENGTH_EQ_NIL", [LENGTH_EQ_NIL]))(thm_tac (new_rewrite [] [])))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (BETA_TAC THEN (case THEN ((move ["len_eq"]) THEN (move ["len_le"])))); + (((fun arg_tac -> arg_tac (Arg_term (`LENGTH s2 = 0`))) (disch_eq_tac "s2_len" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((use_arg_then2 ("s2_len", [])) (disch_tac [])) THEN ((use_arg_then2 ("len_eq", [])) (disch_tac [])) THEN (clear_assumption "len_eq") THEN BETA_TAC) THEN (((((use_arg_then2 ("s2_len", []))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("LENGTH_EQ_NIL", [LENGTH_EQ_NIL]))(thm_tac (new_rewrite [] [])))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("IH", [])) (disch_tac [])) THEN (clear_assumption "IH") THEN (DISCH_THEN apply_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("length_eq_imp_length_tl_eq", [length_eq_imp_length_tl_eq])) (fun fst_arg -> (use_arg_then2 ("len_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((THENL_FIRST) (((use_arg_then2 ("LENGTH_TL", [LENGTH_TL]))(thm_tac (new_rewrite [] [])))) ((((use_arg_then2 ("s2_len", [])) (disch_tac [])) THEN (clear_assumption "s2_len") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("LENGTH", [LENGTH]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("len_eq", [])) (disch_tac [])) THEN (clear_assumption "len_eq") THEN ((use_arg_then2 ("len_le", [])) (disch_tac [])) THEN (clear_assumption "len_le") THEN ((use_arg_then2 ("s2_len", [])) (disch_tac [])) THEN (clear_assumption "s2_len") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma mem_nseq *) +let mem_nseq = Sections.section_proof ["n";"x";"y"] +`y <- nseq n x <=> 0 < n /\ y = x` +[ + (((((use_arg_then2 ("MEM_EXISTS_EL", [MEM_EXISTS_EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_nseq", [size_nseq]))(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [((case THEN (move ["i"])) THEN (case THEN (move ["i_lt"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); ((case THEN (move ["n_gt0"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))])); + (((((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(@)UNIV`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_nseq", [size_nseq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("nth_nseq", [nth_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_lt", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`0`))) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(@)UNIV`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_nseq", [size_nseq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("nth_nseq", [nth_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_gt0", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_flatten *) +let mem_flatten = Sections.section_proof ["x";"L"] +`MEM x (flatten L) <=> ?l. MEM l L /\ MEM x l` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("L", [])) (disch_tac [])) THEN (clear_assumption "L") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) (((((use_arg_then2 ("flatten0", [flatten0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((((use_arg_then2 ("flatten_cons", [flatten_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_cat", [mem_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] []))))); + (((THENL) ((THENL) (split_tac) [((THENL) case [(move ["xh"]); ((case THEN (move ["l"])) THEN (move ["h"]))]); ((case THEN (move ["l"])) THEN (case THEN ((move ["h1"]) THEN (move ["xl"]))))]) [((use_arg_then2 ("h", [])) (term_tac exists_tac)); ((use_arg_then2 ("l", [])) (term_tac exists_tac)); (ALL_TAC)]) THEN (BETA_TAC THEN ((TRY done_tac)))); + (((THENL) (((use_arg_then2 ("h1", [])) (disch_tac [])) THEN (clear_assumption "h1") THEN case) [((((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); (move ["lt"])]) THEN (DISJ2_TAC) THEN ((use_arg_then2 ("l", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma size1 *) +let size1 = Sections.section_proof ["x"] +`sizel [x] = 1` +[ + (((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma size1_eq *) +let size1_eq = Sections.section_proof ["s"] +`sizel s = 1 <=> ?x. s = [x]` +[ + ((THENL_LAST) ((THENL) (split_tac) [ALL_TAC; ((case THEN (move ["x"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))]) ((((use_arg_then2 ("size1", [size1]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]))]) ((((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqSS", [eqSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_eq0", [size_eq0]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("h", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma cons_head_drop1 *) +let cons_head_drop1 = Sections.section_proof ["x0";"s"] +`0 < sizel s ==> s = (headl x0 s) :: (dropl 1 s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]))]) THEN ((repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("size_nil", [size_nil]))(fun tmp_arg1 -> (use_arg_then2 ("ltn0", [ltn0]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("head", [head]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("drop", [drop]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma last_eq *) +let last_eq = Sections.section_proof ["a";"b";"s"] +`0 < sizel s ==> last a s = last b s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["_"]))]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("last", [last]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma last_drop *) +let last_drop = Sections.section_proof ["x0";"s";"n"] +`n < sizel s ==> last x0 (dropl n s) = last x0 s` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]) THEN ((THENL) case [ALL_TAC; (move ["n"])]))]) THEN (((((fun arg_tac ->(use_arg_then2 ("size_nil", [size_nil]))(fun tmp_arg1 -> (use_arg_then2 ("size_cons", [size_cons]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("drop", [drop]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))) THEN (move ["n_lt"]))); + (((((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("last", [last]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("last_eq", [last_eq])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("n_lt", [])) (disch_tac [])) THEN (clear_assumption "n_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Finalization of the section Misc *) +let length_le_1 = Sections.finalize_theorem length_le_1;; +let count0 = Sections.finalize_theorem count0;; +let count_filterI = Sections.finalize_theorem count_filterI;; +let seq_eq_mkseq = Sections.finalize_theorem seq_eq_mkseq;; +let seq_wf_ind = Sections.finalize_theorem seq_wf_ind;; +let length_eq_imp_length_tl_eq = Sections.finalize_theorem length_eq_imp_length_tl_eq;; +let ge_length_imp_EL_eq = Sections.finalize_theorem ge_length_imp_EL_eq;; +let mem_nseq = Sections.finalize_theorem mem_nseq;; +let mem_flatten = Sections.finalize_theorem mem_flatten;; +let size1 = Sections.finalize_theorem size1;; +let size1_eq = Sections.finalize_theorem size1_eq;; +let cons_head_drop1 = Sections.finalize_theorem cons_head_drop1;; +let last_eq = Sections.finalize_theorem last_eq;; +let last_drop = Sections.finalize_theorem last_drop;; +Sections.end_section "Misc";; + +(* Section MoreZip *) +Sections.begin_section "MoreZip";; + +(* Lemma mem_zip *) +let mem_zip = Sections.section_proof ["s1";"s2";"a";"b"] +`MEM (a,b) (zip s1 s2) ==> MEM a s1 /\ MEM b s2` +[ + ((((THENL) (((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((THENL) case [ALL_TAC; ((move ["h2"]) THEN (move ["t2"]))])) THEN ((((use_arg_then2 ("zip", [zip]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))))); + (((THENL) case [(case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); (DISCH_THEN (fun snd_th -> (use_arg_then2 ("Ih", [])) (thm_tac (match_mp_then snd_th MP_TAC))))]) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Lemma EL_zip *) +let EL_zip = Sections.section_proof ["s1";"s2";"i"] +`sizel s1 = sizel s2 /\ i < sizel s1 + ==> EL i (zip s1 s2) = (EL i s1, EL i s2)` +[ + (BETA_TAC THEN (case THEN ((move ["size_eq"]) THEN (move ["i_lt"])))); + ((fun arg_tac -> arg_tac (Arg_term (`HD s1`))) (term_tac (set_tac "x0"))); + ((fun arg_tac -> arg_tac (Arg_term (`HD s2`))) (term_tac (set_tac "y0"))); + ((THENL_FIRST) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x0,y0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`zip s1 s2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) (((((use_arg_then2 ("size1_zip", [size1_zip]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("i_lt", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("nth_zip", [nth_zip]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("EL_nth", [EL_nth]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma take_zip *) +let take_zip = Sections.section_proof ["s1";"s2";"n"] +`take n (zip s1 s2) = zip (take n s1) (take n s2)` +[ + ((((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["h1"]) THEN (move ["t1"]) THEN (move ["Ih1"]))]) THEN ((THENL) case [ALL_TAC; ((move ["h2"]) THEN (move ["t2"]))])) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("take", [take]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("zip", [zip]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("take", [take]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("zip", [zip]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((THENL) case [ALL_TAC; (move ["n"])]) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("take", [take]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("zip", [zip]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma drop_zip *) +let drop_zip = Sections.section_proof ["s1";"s2";"n"] +`dropl n (zip s1 s2) = zip (dropl n s1) (dropl n s2)` +[ + ((((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["h1"]) THEN (move ["t2"]) THEN (move ["Ih1"]))]) THEN ((THENL) case [ALL_TAC; ((move ["h2"]) THEN (move ["t2"]))])) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("drop", [drop]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("zip", [zip]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("drop", [drop]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("zip", [zip]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((THENL) case [ALL_TAC; (move ["n"])]) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("drop", [drop]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("zip", [zip]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma rot_zip *) +let rot_zip = Sections.section_proof ["s1";"s2";"n"] +`sizel s1 = sizel s2 + ==> rot n (zip s1 s2) = zip (rot n s1) (rot n s2)` +[ + (BETA_TAC THEN (move ["size_eq"])); + (((((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("drop_zip", [drop_zip]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("take_zip", [take_zip]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("zip_cat", [zip_cat]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("rot", [rot]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rotr_zip *) +let rotr_zip = Sections.section_proof ["s1";"s2";"n"] +`sizel s1 = sizel s2 + ==> rotr n (zip s1 s2) = zip (rotr n s1) (rotr n s2)` +[ + (BETA_TAC THEN (move ["size_eq"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size1_zip", [size1_zip]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("rot_zip", [rot_zip]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section MoreZip *) +let mem_zip = Sections.finalize_theorem mem_zip;; +let EL_zip = Sections.finalize_theorem EL_zip;; +let take_zip = Sections.finalize_theorem take_zip;; +let drop_zip = Sections.finalize_theorem drop_zip;; +let rot_zip = Sections.finalize_theorem rot_zip;; +let rotr_zip = Sections.finalize_theorem rotr_zip;; +Sections.end_section "MoreZip";; + +(* Section MoreUniq *) +Sections.begin_section "MoreUniq";; + +(* Lemma uniq_small_size *) +let uniq_small_size = Sections.section_proof ["l"] +`sizel l < 2 ==> uniq l` +[ + (((THENL) (((use_arg_then2 ("l", [])) (disch_tac [])) THEN (clear_assumption "l") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]))]) THEN ((((use_arg_then2 ("uniq", [uniq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + (((THENL) (((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN case) [ALL_TAC; ((move ["h2"]) THEN (move ["t"]))]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("uniq", [uniq]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma mem_imp_not_uniq_cat *) +let mem_imp_not_uniq_cat = Sections.section_proof ["x";"l1";"l2"] +`MEM x l1 /\ MEM x l2 ==> ~(uniq (cat l1 l2))` +[ + ((BETA_TAC THEN (case THEN ((move ["x_l1"]) THEN (move ["x_l2"])))) THEN ((((use_arg_then2 ("cat_uniq", [cat_uniq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hasP", [hasP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + ((DISJ2_TAC) THEN (DISJ1_TAC) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma uniq_nthP *) +let uniq_nthP = Sections.section_proof ["x0";"s"] +`uniq s <=> (!i j. i < j /\ j < sizel s ==> ~(nth x0 s i = nth x0 s j))` +[ + ((THENL_FIRST) (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN ((((use_arg_then2 ("uniq", [uniq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((THENL) (split_tac) [((case THEN ((move ["n_mem"]) THEN (move ["uniq_t"]))) THEN (move ["i"]) THEN (move ["j"]) THEN (case THEN ((move ["i_lt_j"]) THEN (move ["j_lt"])))); (move ["h"])]); + ((((THENL) (((use_arg_then2 ("j_lt", [])) (disch_tac [])) THEN (clear_assumption "j_lt") THEN ((use_arg_then2 ("i_lt_j", [])) (disch_tac [])) THEN (clear_assumption "i_lt_j") THEN ((use_arg_then2 ("j", [])) (disch_tac [])) THEN (clear_assumption "j") THEN ((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN case) [ALL_TAC; (move ["i"])]) THEN ((THENL) case [ALL_TAC; (move ["j"])])) THEN (TRY ((arith_tac)))); + (((((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))))) THEN (move ["_"]) THEN (move ["j_lt"])); + ((((use_arg_then2 ("n_mem", [])) (disch_tac [])) THEN (clear_assumption "n_mem") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_nth", [mem_nth]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((repeat_tactic 1 9 (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))))) THEN (move ["i_lt_j"]) THEN (move ["j_lt"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("iffLR", [iffLR])) (fun fst_arg -> (use_arg_then2 ("IH", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("uniq_t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (split_tac); + ((((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (move ["mem_h"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("NOT_FORALL_THM", [NOT_FORALL_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("NOT_IMP", [NOT_IMP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> arg_tac (Arg_term (`0`))) (term_tac exists_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`SUC (indexl h t)`))) (term_tac exists_tac))); + (((((use_arg_then2 ("gtS0", [gtS0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_index", [nth_index]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("IH", []))(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["j"]) THEN (case THEN ((move ["i_lt_j"]) THEN (move ["j_lt"])))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SUC i`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SUC j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("j_lt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_lt_j", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma uniq_map_nth *) +let uniq_map_nth = Sections.section_proof ["x0";"p";"s"] +`uniq s /\ uniq p /\ all (\i:num. i < sizel s) p + ==> uniq (map (nth x0 s) p)` +[ + (((((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ALL_TAC THEN (case THEN (move ["uniq_s"])) THEN (case THEN (move ["uniq_p"])) THEN (move ["in_p"])); + (((((use_arg_then2 ("map_inj_in_uniq", [map_inj_in_uniq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["i"]) THEN (move ["j"]) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["i_p"]) THEN (move ["j_p"])))); + (((((fun arg_tac -> (use_arg_then2 ("nth_uniq", [nth_uniq])) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("in_p", []))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma uniq_index_inj *) +let uniq_index_inj = Sections.section_proof ["x";"y";"s"] +`uniq s /\ x <- s /\ y <- s ==> (indexl x s = indexl y s <=> x = y)` +[ + ((BETA_TAC THEN (case THEN (move ["uniq_s"])) THEN (case THEN (move ["xs"])) THEN (move ["ys"])) THEN ((THENL) (split_tac) [ALL_TAC; ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))])); + ((((use_arg_then2 ("ys", [])) (disch_tac [])) THEN (clear_assumption "ys") THEN ((use_arg_then2 ("xs", [])) (disch_tac [])) THEN (clear_assumption "xs") THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("MEM_EXISTS_EL", [MEM_EXISTS_EL]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["i"])) THEN (case THEN (move ["i_lt"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (case THEN (move ["j"])) THEN (case THEN (move ["j_lt"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))); + ((((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(@)UNIV`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("index_uniq", [index_uniq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section MoreUniq *) +let uniq_small_size = Sections.finalize_theorem uniq_small_size;; +let mem_imp_not_uniq_cat = Sections.finalize_theorem mem_imp_not_uniq_cat;; +let uniq_nthP = Sections.finalize_theorem uniq_nthP;; +let uniq_map_nth = Sections.finalize_theorem uniq_map_nth;; +let uniq_index_inj = Sections.finalize_theorem uniq_index_inj;; +Sections.end_section "MoreUniq";; + +(* Section MoreIndex *) +Sections.begin_section "MoreIndex";; + +(* Lemma index_nil *) +let index_nil = Sections.section_proof ["x"] +`indexl x [] = 0` +[ + (((((use_arg_then2 ("index", [index]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find", [find]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma index_cons *) +let index_cons = Sections.section_proof ["x";"h";"t"] +`indexl x (h :: t) = if x = h then 0 else SUC (indexl x t)` +[ + (((((use_arg_then2 ("index", [index]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("find", [find]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pred1", [pred1]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("pred1", [pred1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index", [index]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((fun arg_tac -> arg_tac (Arg_term (`x = h`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN (done_tac)); +];; + +(* Lemma index_eq_size *) +let index_eq_size = Sections.section_proof ["x";"s"] +`~(MEM x s) <=> indexl x s = sizel s` +[ + (((((use_arg_then2 ("index", [index]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_pred1", [has_pred1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("has_find", [has_find]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn_neqAle", [ltn_neqAle]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find_size", [find_size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma index_head *) +let index_head = Sections.section_proof ["x0";"s"] +`indexl (headl x0 s) s = 0` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]))]) THEN ((((use_arg_then2 ("index", [index]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("find", [find]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("head", [head]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pred1", [pred1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma index_take *) +let index_take = Sections.section_proof ["s";"n";"x"] +`indexl x (take n s) = if indexl x s < n then (indexl x s) else n` +[ + ((((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((THENL) case [ALL_TAC; (move ["n"])])) THEN ((((use_arg_then2 ("take", [take]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("index_nil", [index_nil]))(thm_tac (new_rewrite [] [])))))) THEN (TRY ((arith_tac)))); + (repeat_tactic 1 9 (((use_arg_then2 ("index_cons", [index_cons]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`x = h`))) (disch_eq_tac "x_eq_h" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_term (`_1 < n:num`))) (disch_tac [])) THEN case) THEN (done_tac)); +];; + +(* Lemma index_drop_le *) +let index_drop_le = Sections.section_proof ["s";"n";"x"] +`n <= indexl x s ==> indexl x (dropl n s) = indexl x s - n` +[ + ((((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((THENL) case [ALL_TAC; (move ["n"])])) THEN ((((use_arg_then2 ("drop", [drop]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("index_nil", [index_nil]))(thm_tac (new_rewrite [] [])))))) THEN (TRY ((arith_tac)))); + (repeat_tactic 1 9 (((use_arg_then2 ("index_cons", [index_cons]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`x = h`))) (disch_eq_tac "x_eq_h" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((arith_tac) THEN (done_tac))); + ((((((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subSS", [subSS]))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("Ih", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma index_drop_uniq *) +let index_drop_uniq = Sections.section_proof ["s";"n";"x"] +`uniq s ==> + indexl x (dropl n s) = if n <= indexl x s then (indexl x s - n) else (sizel s - n)` +[ + (BETA_TAC THEN (move ["uniq_s"])); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`n < sizel s`))) (disch_eq_tac "n_lt" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + ((((use_arg_then2 ("drop_oversize", [drop_oversize]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("index_nil", [index_nil]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("n_lt", [])) (disch_tac [])) THEN (clear_assumption "n_lt") THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("index_size", [index_size])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`n:num <= _`))) (disch_eq_tac "n_le" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("index_drop_le", [index_drop_le]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("size_drop", [size_drop]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index_eq_size", [index_eq_size]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((use_arg_then2 ("uniq_s", [])) (disch_tac [])) THEN (clear_assumption "uniq_s") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (move ["mem_drop"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("cat_take_drop", [cat_take_drop])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("mem_imp_not_uniq_cat", [mem_imp_not_uniq_cat])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mem_drop", [mem_drop]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("index_mem", [index_mem]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index_take", [index_take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_take", [size_take]))(thm_tac (new_rewrite [] []))))); + ((in_tac ["n_le"] false (((use_arg_then2 ("NOT_LE", [NOT_LE]))(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("n_le", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("n_lt", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section MoreIndex *) +let index_nil = Sections.finalize_theorem index_nil;; +let index_cons = Sections.finalize_theorem index_cons;; +let index_eq_size = Sections.finalize_theorem index_eq_size;; +let index_head = Sections.finalize_theorem index_head;; +let index_take = Sections.finalize_theorem index_take;; +let index_drop_le = Sections.finalize_theorem index_drop_le;; +let index_drop_uniq = Sections.finalize_theorem index_drop_uniq;; +Sections.end_section "MoreIndex";; + +(* Section MorePermEq *) +Sections.begin_section "MorePermEq";; + +(* Lemma perm_eq_cat *) +let perm_eq_cat = Sections.section_proof ["s1";"t1";"s2";"t2"] +`perm_eq s1 s2 /\ perm_eq t1 t2 ==> perm_eq (s1 ++ t1) (s2 ++ t2)` +[ + ((((repeat_tactic 1 9 (((use_arg_then2 ("perm_eqP", [perm_eqP]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("count_cat", [count_cat]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac)); +];; + +(* Lemma perm_eq0r *) +let perm_eq0r = Sections.section_proof ["s"] +`perm_eq s [] <=> s = []` +[ + (((THENL) (split_tac) [(DISCH_THEN (fun snd_th -> (use_arg_then2 ("perm_eq_size", [perm_eq_size])) (thm_tac (match_mp_then snd_th MP_TAC)))); (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("perm_eq_refl", [perm_eq_refl]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_eq0", [size_eq0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_eq0l *) +let perm_eq0l = Sections.section_proof ["s"] +`perm_eq [] s <=> s = []` +[ + (((((use_arg_then2 ("perm_eq_sym", [perm_eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_eq0r", [perm_eq0r]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_eq_pred1P *) +let perm_eq_pred1P = Sections.section_proof ["s1";"s2"] +`perm_eq s1 s2 <=> (!x. count (pred1 x) s1 = count (pred1 x) s2)` +[ + ((THENL_FIRST) ((THENL) (split_tac) [ALL_TAC; (move ["count_eq"])]) (((((use_arg_then2 ("perm_eqP", [perm_eqP]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac))); + ((((((use_arg_then2 ("perm_eq", [perm_eq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("same_count1", [same_count1]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["_"])) THEN (done_tac)); +];; + +(* Lemma perm_eq_filter *) +let perm_eq_filter = Sections.section_proof ["a";"s1";"s2"] +`perm_eq s1 s2 ==> perm_eq (filter a s1) (filter a s2)` +[ + ((((repeat_tactic 1 9 (((use_arg_then2 ("perm_eqP", [perm_eqP]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("count_filterI", [count_filterI]))(thm_tac (new_rewrite [] [])))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_eq_undup *) +let perm_eq_undup = Sections.section_proof ["s1";"s2"] +`perm_eq s1 s2 ==> perm_eq (undup s1) (undup s2)` +[ + ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["h_mem"])); + ((((use_arg_then2 ("perm_eq_pred1P", [perm_eq_pred1P]))(thm_tac (new_rewrite [] [])))) THEN (move ["x"])); + (((repeat_tactic 1 9 (((use_arg_then2 ("count_uniq_mem", [count_uniq_mem]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("undup_uniq", [undup_uniq]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mem_undup", [mem_undup]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("h_mem", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_eq_map *) +let perm_eq_map = Sections.section_proof ["f";"s1";"s2"] +`perm_eq s1 s2 ==> perm_eq (map f s1) (map f s2)` +[ + ((((repeat_tactic 1 9 (((use_arg_then2 ("perm_eqP", [perm_eqP]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("count_map", [count_map]))(thm_tac (new_rewrite [] [])))))) THEN (move ["eq"]) THEN (move ["P"])) THEN (done_tac)); +];; + +(* Lemma uniq_perm_eq_alt *) +let uniq_perm_eq_alt = Sections.section_proof ["s1";"s2"] +`uniq s1 /\ sizel s1 = sizel s2 /\ (!x. x <- s1 <=> x <- s2) + ==> perm_eq s1 s2` +[ + (BETA_TAC THEN (case THEN (move ["uniq1"])) THEN (case THEN (move ["size_eq"])) THEN (move ["mem"])); + (((use_arg_then2 ("uniq_perm_eq", [uniq_perm_eq])) (thm_tac apply_tac)) THEN (repeat_tactic 1 9 (((split_tac) THEN ((TRY done_tac)))))); + ((((fun arg_tac -> (use_arg_then2 ("perm_uniq", [perm_uniq])) (fun fst_arg -> (use_arg_then2 ("mem", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma all_perm_eq *) +let all_perm_eq = Sections.section_proof ["a";"s1";"s2"] +`perm_eq s1 s2 ==> (all a s1 <=> all a s2)` +[ + ((BETA_TAC THEN (move ["perm"])) THEN (((use_arg_then2 ("perm", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("perm_eqP", [perm_eqP]))(thm_tac (new_rewrite [] [])))) THEN (move ["eq"]))); + (((repeat_tactic 1 9 (((use_arg_then2 ("all_count", [all_count]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("perm_eq_size", [perm_eq_size])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section MorePermEq *) +let perm_eq_cat = Sections.finalize_theorem perm_eq_cat;; +let perm_eq0r = Sections.finalize_theorem perm_eq0r;; +let perm_eq0l = Sections.finalize_theorem perm_eq0l;; +let perm_eq_pred1P = Sections.finalize_theorem perm_eq_pred1P;; +let perm_eq_filter = Sections.finalize_theorem perm_eq_filter;; +let perm_eq_undup = Sections.finalize_theorem perm_eq_undup;; +let perm_eq_map = Sections.finalize_theorem perm_eq_map;; +let uniq_perm_eq_alt = Sections.finalize_theorem uniq_perm_eq_alt;; +let all_perm_eq = Sections.finalize_theorem all_perm_eq;; +Sections.end_section "MorePermEq";; + +(* Section MoreSubseq *) +Sections.begin_section "MoreSubseq";; + +(* Lemma all_subseq *) +let all_subseq = Sections.section_proof ["s1";"s2";"P"] +`subseq s1 s2 /\ all P s2 ==> all P s1` +[ + (((((use_arg_then2 ("all_filterP", [all_filterP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["sub"]) THEN (move ["eq"])))) THEN (((use_arg_then2 ("sub", [])) (disch_tac [])) THEN (clear_assumption "sub") THEN BETA_TAC)); + ((((((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("subseq_filter", [subseq_filter]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma subseq_tl *) +let subseq_tl = Sections.section_proof ["h";"t";"s"] +`subseq (h :: t) s ==> subseq t s` +[ + ((BETA_TAC THEN (move ["h"])) THEN ((use_arg_then2 ("subseq_trans", [subseq_trans])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`h :: t`))) (term_tac exists_tac)) THEN (((use_arg_then2 ("subseq_cons", [subseq_cons]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section MoreSubseq *) +let all_subseq = Sections.finalize_theorem all_subseq;; +let subseq_tl = Sections.finalize_theorem subseq_tl;; +Sections.end_section "MoreSubseq";; + +(* Section Delete *) +Sections.begin_section "Delete";; +(Sections.add_section_type (mk_var ("x", (`:A`))));; +(Sections.add_section_type (mk_var ("s", (`:(A)list`))); Sections.add_section_type (mk_var ("s1", (`:(A)list`))); Sections.add_section_type (mk_var ("s2", (`:(A)list`))));; +(Sections.add_section_var (mk_var ("x0", (`:A`))));; + +(* Lemma delete1_eq_at *) +let delete1_eq_at = Sections.section_proof ["x";"s"] +`delete1 x s = delete_at (indexl x s) s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN ((((use_arg_then2 ("delete1", [delete1]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("delete_at", [delete_at]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("index_cons", [index_cons]))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> arg_tac (Arg_term (`x = h`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN ((((use_arg_then2 ("delete_at", [delete_at]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("IH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma delete1_hd *) +let delete1_hd = Sections.section_proof ["h";"t"] +`delete1 h (h :: t) = t` +[ + ((((use_arg_then2 ("delete1", [delete1]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma count_delete_at *) +let count_delete_at = Sections.section_proof ["i";"s";"P"] +`i < sizel s ==> + count P (delete_at i s) = count P s - if P (nth x0 s i) then 1 else 0` +[ + ((((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN ((THENL) case [ALL_TAC; (move ["i"])])) THEN ((((use_arg_then2 ("delete_at", [delete_at]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LENGTH", [LENGTH]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("count", [count]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (TRY ((arith_tac)))); + (((((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))) THEN (move ["i_lt"])); + ((((use_arg_then2 ("IH", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`if P h then 1 else 0`))) (term_tac (set_tac "n"))); + ((fun arg_tac -> arg_tac (Arg_term (`if _1 then _2 else _3`))) (term_tac (set_tac "k"))); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`count P t = 0`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`k = 0 \/ k = 1`))) (term_tac (have_gen_tac []ALL_TAC))) ((((use_arg_then2 ("k_def", [])) (disch_tac [])) THEN (clear_assumption "k_def") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`k = 0`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((repeat_tactic 1 9 (((use_arg_then2 ("subn0", [subn0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("k_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`~P (nth x0 t i)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((ALL_TAC) THEN (done_tac)))); + ((((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN ((((use_arg_then2 ("count0", [count0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("all_predC", [all_predC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("hasPn", [hasPn]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (DISCH_THEN apply_tac) THEN (((use_arg_then2 ("mem_nth", [mem_nth]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma count_delete1 *) +let count_delete1 = Sections.section_proof ["x";"s";"P"] +`x <- s ==> count P (delete1 x s) = count P s - if P x then 1 else 0` +[ + ((BETA_TAC THEN (move ["mem_x"])) THEN ((((use_arg_then2 ("delete1_eq_at", [delete1_eq_at]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("count_delete_at", [count_delete_at]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("nth_index", [nth_index]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma delete_at_eq *) +let delete_at_eq = Sections.section_proof ["i";"s"] +`delete_at i s = s <=> sizel s <= i` +[ + ((THENL_ROT (-1)) ((((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN ((THENL) case [ALL_TAC; (move ["i"])])) THEN ((((use_arg_then2 ("delete_at", [delete_at]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LENGTH", [LENGTH]))(thm_tac (new_rewrite [] []))))) THEN (TRY ((arith_tac))))); + (((((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eqseq_cons", [eqseq_cons]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `!n. ~(SUC n <= 0)`)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `(!n. n = n:num)`))) (disch_tac [])) THEN BETA_TAC THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sizel t`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))); + ((((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [1] []))))) THEN ((((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LENGTH", [LENGTH]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma delete_at_eq_imp *) +let delete_at_eq_imp = Sections.section_proof ["i";"s"] +`~(i < sizel s) ==> delete_at i s = s` +[ + (((((use_arg_then2 ("leqNgt", [leqNgt]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("delete_at_eq", [delete_at_eq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma not_mem_delete1 *) +let not_mem_delete1 = Sections.section_proof ["x";"s"] +`~(x <- s) ==> delete1 x s = s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN (((((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("delete1", [delete1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IH", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) THEN (done_tac)); +];; + +(* Lemma size_delete_at *) +let size_delete_at = Sections.section_proof ["i";"s"] +`sizel (delete_at i s) = sizel s - if i < sizel s then 1 else 0` +[ + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`i < sizel s`))) (disch_eq_tac "lt" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) (((((use_arg_then2 ("delete_at_eq_imp", [delete_at_eq_imp]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("subn0", [subn0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("count_predT", [count_predT]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("count_delete_at", [count_delete_at]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("predT", [predT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma size_delete1 *) +let size_delete1 = Sections.section_proof ["x";"s"] +`sizel (delete1 x s) = sizel s - if x <- s then 1 else 0` +[ + (((((use_arg_then2 ("delete1_eq_at", [delete1_eq_at]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_delete_at", [size_delete_at]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma subseq_delete_at *) +let subseq_delete_at = Sections.section_proof ["i";"s"] +`subseq (delete_at i s) s` +[ + ((((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN ((THENL) case [ALL_TAC; (move ["i"])])) THEN ((((use_arg_then2 ("delete_at", [delete_at]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("subseq0", [subseq0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("subseq_cons", [subseq_cons]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("cat1s", [cat1s]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("cat1s", [cat1s])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("subseq_cat", [subseq_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subseq_refl", [subseq_refl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma subseq_delete1 *) +let subseq_delete1 = Sections.section_proof ["x";"s"] +`subseq (delete1 x s) s` +[ + (((((use_arg_then2 ("delete1_eq_at", [delete1_eq_at]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subseq_delete_at", [subseq_delete_at]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_delete_at *) +let mem_delete_at = Sections.section_proof ["i";"s";"y"] +`y <- delete_at i s ==> y <- s` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("mem_subseq", [mem_subseq])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (DISCH_THEN apply_tac) THEN (((use_arg_then2 ("subseq_delete_at", [subseq_delete_at])) (disch_tac [])) THEN (clear_assumption "subseq_delete_at") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma mem_delete1 *) +let mem_delete1 = Sections.section_proof ["x";"y";"s"] +`y <- delete1 x s ==> y <- s` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("mem_subseq", [mem_subseq])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (DISCH_THEN apply_tac) THEN (((use_arg_then2 ("subseq_delete1", [subseq_delete1])) (disch_tac [])) THEN (clear_assumption "subseq_delete1") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma perm_eq_delete_at *) +let perm_eq_delete_at = Sections.section_proof ["i";"s1";"s2"] +`i < sizel s1 /\ perm_eq s1 s2 ==> + perm_eq (delete_at i s1) (delete_at (indexl (nth x0 s1 i) s2) s2)` +[ + ((BETA_TAC THEN (case THEN ((move ["i_lt"]) THEN (move ["p_eq"])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`nth x0 s1 i`))) (term_tac (set_tac "x")))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x <- s2`))) (term_tac (have_gen_tac [](move ["x_s2"])))) (((((fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (use_arg_then2 ("p_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("x_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_nth", [mem_nth]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("perm_eqP", [perm_eqP]))(thm_tac (new_rewrite [] [])))) THEN (move ["P"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("count_delete_at", [count_delete_at]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("p_eq", [])) (disch_tac [])) THEN (clear_assumption "p_eq") THEN BETA_TAC) THEN ((((use_arg_then2 ("perm_eqP", [perm_eqP]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("x_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_index", [nth_index]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_eq_delete_at_1 *) +let perm_eq_delete_at_1 = Sections.section_proof ["i";"s1";"s2"] +`i < sizel s1 /\ perm_eq s1 s2 ==> + perm_eq (delete_at i s1) (delete1 (nth x0 s1 i) s2)` +[ + ((((use_arg_then2 ("delete1_eq_at", [delete1_eq_at]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_eq_delete_at", [perm_eq_delete_at])) (disch_tac [])) THEN (clear_assumption "perm_eq_delete_at") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma perm_eq_delete1 *) +let perm_eq_delete1 = Sections.section_proof ["x";"s1";"s2"] +`perm_eq s1 s2 ==> perm_eq (delete1 x s1) (delete1 x s2)` +[ + ((THENL_ROT (-1)) ((BETA_TAC THEN (move ["p_eq"])) THEN (((fun arg_tac -> arg_tac (Arg_term (`x <- s1`))) (disch_eq_tac "mem" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)))); + (((repeat_tactic 1 9 (((use_arg_then2 ("not_mem_delete1", [not_mem_delete1]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (use_arg_then2 ("p_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("perm_eqP", [perm_eqP]))(thm_tac (new_rewrite [] [])))) THEN (move ["P"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("count_delete1", [count_delete1]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (use_arg_then2 ("p_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("p_eq", [])) (disch_tac [])) THEN (clear_assumption "p_eq") THEN BETA_TAC) THEN ((((use_arg_then2 ("perm_eqP", [perm_eqP]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_eq_cons_delete_at *) +let perm_eq_cons_delete_at = Sections.section_proof ["i";"s"] +`i < sizel s ==> perm_eq (nth x0 s i :: delete_at i s) s` +[ + ((BETA_TAC THEN (move ["i_lt"])) THEN ((((use_arg_then2 ("perm_eqP", [perm_eqP]))(thm_tac (new_rewrite [] [])))) THEN (move ["P"])) THEN ((((use_arg_then2 ("count", [count]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("count_delete_at", [count_delete_at]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`P _`))) (disch_eq_tac "Px" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) (((((use_arg_then2 ("subn0", [subn0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`0 < count P s`))) (term_tac (have_gen_tac []ALL_TAC)))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("has_count", [has_count]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hasP", [hasP]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`nth x0 s i`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("Px", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("EL_nth", [EL_nth]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("MEM_EL", [MEM_EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma perm_eq_cons_delete1 *) +let perm_eq_cons_delete1 = Sections.section_proof ["x";"s"] +`x <- s ==> perm_eq (x :: delete1 x s) s` +[ + ((use_arg_then2 ("perm_eq_cons_delete_at", [perm_eq_cons_delete_at])) (fun arg -> thm_tac MP_TAC arg THEN (move ["th"]))); + ((BETA_TAC THEN (move ["xs"])) THEN ((((use_arg_then2 ("delete1_eq_at", [delete1_eq_at]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_index", [nth_index])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("th", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_delete_at *) +let nth_delete_at = Sections.section_proof ["i";"s";"k"] +`nth x0 (delete_at k s) i = nth x0 s (if i < k then i else SUC i)` +[ + ((((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN ((use_arg_then2 ("k", [])) (disch_tac [])) THEN (clear_assumption "k") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IHs"]))]) THEN ((THENL) case [ALL_TAC; (move ["k"])]) THEN (move ["i"])) THEN ((((use_arg_then2 ("delete_at", [delete_at]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN case) [ALL_TAC; (move ["i"])]) THEN ((((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("gtS0", [gtS0]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fun_if", [fun_if]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IHs", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_delete1 *) +let nth_delete1 = Sections.section_proof ["x0";"x";"s";"i"] +`nth x0 (delete1 x s) i = nth x0 s (if i < indexl x s then i else SUC i)` +[ + (((((use_arg_then2 ("delete1_eq_at", [delete1_eq_at]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_delete_at", [nth_delete_at]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma EL_delete_at *) +let EL_delete_at = Sections.section_proof ["i";"k";"s"] +`i < sizel (delete_at k s) ==> + EL i (delete_at k s) = EL (if i < k then i else SUC i) s` +[ + (((use_arg_then2 ("size_delete_at", [size_delete_at]))(thm_tac (new_rewrite [] [])))); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`k < sizel s`))) (disch_eq_tac "k_lt" [])) THEN case THEN (simp_tac) THEN (move ["i_lt"]) THEN (process_fst_eq_tac))); + (((((use_arg_then2 ("delete_at_eq_imp", [delete_at_eq_imp]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((use_arg_then2 ("perm_eq_cons_delete_at", [perm_eq_cons_delete_at])) (fun arg -> thm_tac MP_TAC arg THEN (move ["th"]))); + ((((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_delete_at", [size_delete_at]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("k_lt", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("nth_delete_at", [nth_delete_at]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EL_nth", [EL_nth]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma uniq_delete_at *) +let uniq_delete_at = Sections.section_proof ["i";"s"] +`uniq s ==> uniq (delete_at i s)` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("subseq_uniq", [subseq_uniq])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (DISCH_THEN apply_tac) THEN ((use_arg_then2 ("subseq_delete_at", [subseq_delete_at])) (thm_tac apply_tac)) THEN (done_tac)); +];; + +(* Lemma uniq_delete1 *) +let uniq_delete1 = Sections.section_proof ["x";"s"] +`uniq s ==> uniq (delete1 x s)` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("subseq_uniq", [subseq_uniq])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (DISCH_THEN apply_tac) THEN ((use_arg_then2 ("subseq_delete1", [subseq_delete1])) (thm_tac apply_tac)) THEN (done_tac)); +];; + +(* Lemma mem_delete1_uniq *) +let mem_delete1_uniq = Sections.section_proof ["x";"s"] +`uniq s /\ x <- s ==> (!y. y <- delete1 x s <=> ~(y = x) /\ y <- s)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN (((((use_arg_then2 ("delete1", [delete1]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL uniq)))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ALL_TAC) THEN (case THEN ((move ["h_mem"]) THEN (move ["uniq_t"]))))); + (((fun arg_tac -> arg_tac (Arg_term (`x = h`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((BETA_TAC THEN (move ["y"])) THEN ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)); + ((BETA_TAC THEN (move ["y_mem"])) THEN ((((use_arg_then2 ("y_mem", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then2 ("h_mem", [])) (disch_tac [])) THEN (clear_assumption "h_mem") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("andb_orr", [andb_orr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andNb", [andNb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orFb", [orFb]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); + ((BETA_TAC THEN (move ["x_mem"]) THEN (move ["y"])) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`y = h`))) (disch_eq_tac "eq2" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((((use_arg_then2 ("IH", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section Delete *) +let delete1_eq_at = Sections.finalize_theorem delete1_eq_at;; +let delete1_hd = Sections.finalize_theorem delete1_hd;; +let count_delete_at = Sections.finalize_theorem count_delete_at;; +let count_delete1 = Sections.finalize_theorem count_delete1;; +let delete_at_eq = Sections.finalize_theorem delete_at_eq;; +let delete_at_eq_imp = Sections.finalize_theorem delete_at_eq_imp;; +let not_mem_delete1 = Sections.finalize_theorem not_mem_delete1;; +let size_delete_at = Sections.finalize_theorem size_delete_at;; +let size_delete1 = Sections.finalize_theorem size_delete1;; +let subseq_delete_at = Sections.finalize_theorem subseq_delete_at;; +let subseq_delete1 = Sections.finalize_theorem subseq_delete1;; +let mem_delete_at = Sections.finalize_theorem mem_delete_at;; +let mem_delete1 = Sections.finalize_theorem mem_delete1;; +let perm_eq_delete_at = Sections.finalize_theorem perm_eq_delete_at;; +let perm_eq_delete_at_1 = Sections.finalize_theorem perm_eq_delete_at_1;; +let perm_eq_delete1 = Sections.finalize_theorem perm_eq_delete1;; +let perm_eq_cons_delete_at = Sections.finalize_theorem perm_eq_cons_delete_at;; +let perm_eq_cons_delete1 = Sections.finalize_theorem perm_eq_cons_delete1;; +let nth_delete_at = Sections.finalize_theorem nth_delete_at;; +let nth_delete1 = Sections.finalize_theorem nth_delete1;; +let EL_delete_at = Sections.finalize_theorem EL_delete_at;; +let uniq_delete_at = Sections.finalize_theorem uniq_delete_at;; +let uniq_delete1 = Sections.finalize_theorem uniq_delete1;; +let mem_delete1_uniq = Sections.finalize_theorem mem_delete1_uniq;; +Sections.end_section "Delete";; + +(* Section ListsAndSets *) +Sections.begin_section "ListsAndSets";; + +(* Lemma list_of_empty_set *) +let list_of_empty_set = Sections.section_proof [] +`list_of_set {} = []` +[ + (((((use_arg_then2 ("LENGTH_EQ_NIL", [LENGTH_EQ_NIL]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("LENGTH_LIST_OF_SET", [LENGTH_LIST_OF_SET]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("CARD_CLAUSES", [CARD_CLAUSES]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("FINITE_EMPTY", [FINITE_EMPTY]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma set_of_list_subseq *) +let set_of_list_subseq = Sections.section_proof ["s1";"s2"] +`subseq s1 s2 ==> set_of_list s1 SUBSET set_of_list s2` +[ + (((((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (move ["s12"]) THEN (move ["x"])) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (move ["mem"])) THEN (((fun arg_tac -> (use_arg_then2 ("mem_subseq", [mem_subseq])) (fun fst_arg -> (use_arg_then2 ("s12", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma set_of_list_filter *) +let set_of_list_filter = Sections.section_proof ["P";"s"] +`set_of_list (filter P s) = {x | MEM x s /\ P x}` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((((use_arg_then2 ("filter", [filter]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("set_of_list", [set_of_list]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("EMPTY_GSPEC", [EMPTY_GSPEC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`P h`))) (disch_eq_tac "c" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL set_of_list)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN BETA_TAC) THEN (SET_TAC[]) THEN (done_tac)); + ((((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("c", [])) (disch_tac [])) THEN (clear_assumption "c") THEN BETA_TAC) THEN (SET_TAC[]) THEN (done_tac)); +];; + +(* Lemma set_of_list_undup *) +let set_of_list_undup = Sections.section_proof ["s"] +`set_of_list (undup s) = set_of_list s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((((use_arg_then2 ("undup", [undup]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((((fun arg_tac -> arg_tac (Arg_term (`MEM h t`))) (disch_eq_tac "mem_h" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL set_of_list)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ABSORPTION", [ABSORPTION]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma set_of_list_flatten *) +let set_of_list_flatten = Sections.section_proof ["s"] +`set_of_list (flatten s) = UNIONS {set_of_list l | MEM l s}` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((((use_arg_then2 ("flatten", [flatten]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("foldr", [foldr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("set_of_list", [set_of_list]))(thm_tac (new_rewrite [] [])))) THEN (SET_TAC[]) THEN (done_tac)); + (((((use_arg_then2 ("flatten", [flatten]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("APPEND_cat", [APPEND_cat]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SET_OF_LIST_APPEND", [SET_OF_LIST_APPEND]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] []))))) THEN (SET_TAC[]) THEN (done_tac)); +];; + +(* Lemma uniq_list_of_set *) +let uniq_list_of_set = Sections.section_proof ["s"] +`FINITE s ==> uniq (list_of_set s)` +[ + ((BETA_TAC THEN (move ["fin_s"])) THEN (((use_arg_then2 ("count_mem_uniq", [count_mem_uniq])) (thm_tac apply_tac)) THEN (move ["x"]))); + ((((use_arg_then2 ("MEM_LIST_OF_SET", [MEM_LIST_OF_SET]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`x IN s`))) (disch_eq_tac "xs" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + ((((((use_arg_then2 ("count0", [count0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["y"])) THEN (((((use_arg_then2 ("MEM_LIST_OF_SET", [MEM_LIST_OF_SET]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("predC", [predC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pred1", [pred1]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["ys"]))); + ((((use_arg_then2 ("xs", [])) (disch_tac [])) THEN (clear_assumption "xs") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`list_of_set s`))) (term_tac (set_tac "l"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x <- l`))) (term_tac (have_gen_tac [](move ["xl"])))) (((((use_arg_then2 ("l_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("MEM_LIST_OF_SET", [MEM_LIST_OF_SET]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`0 < sizel l`))) (term_tac (have_gen_tac [](move ["l_gt0"])))) ((((use_arg_then2 ("xl", [])) (disch_tac [])) THEN (clear_assumption "xl") THEN BETA_TAC) THEN ((((use_arg_then2 ("has_pred1", [has_pred1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("has_find", [has_find]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`count (predC (pred1 x)) l = sizel l - 1`))) (term_tac (have_gen_tac []ALL_TAC)))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("count_predC", [count_predC])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`pred1 x`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("l", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("xl", [])) (disch_tac [])) THEN (clear_assumption "xl") THEN BETA_TAC) THEN ((((use_arg_then2 ("has_pred1", [has_pred1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("has_count", [has_count]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("count_filter", [count_filter]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> arg_tac (Arg_term (`filter _1 l`))) (term_tac (set_tac "l2")))); + ((((use_arg_then2 ("anti_leq", [anti_leq])) (disch_tac [])) THEN (clear_assumption "anti_leq") THEN (DISCH_THEN apply_tac)) THEN (split_tac)); + ((((use_arg_then2 ("l2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((THENL) (((use_arg_then2 ("xl", [])) (disch_tac [])) THEN (clear_assumption "xl") THEN ((use_arg_then2 ("l", [])) (disch_tac [])) THEN (clear_assumption "l") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN ((((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("filter", [filter]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("predC", [predC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pred1", [pred1]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("predC", [predC]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("pred1", [pred1]))(gsym_then (thm_tac (new_rewrite [] []))))))); + ((THENL) case [((((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)); (move ["mem_x"])]); + ((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("count_filter", [count_filter]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("count_size", [count_size])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`predC (pred1 x)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`0 < sizel t`))) (term_tac (have_gen_tac []ALL_TAC))) ((((use_arg_then2 ("mem_x", [])) (disch_tac [])) THEN (clear_assumption "mem_x") THEN BETA_TAC) THEN ((((use_arg_then2 ("has_pred1", [has_pred1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("has_find", [has_find]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); + ((((fun arg_tac -> arg_tac (Arg_term (`h = x`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("IH", [])) (fun fst_arg -> (use_arg_then2 ("mem_x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("LENGTH_LIST_OF_SET", [LENGTH_LIST_OF_SET])) (fun fst_arg -> (use_arg_then2 ("fin_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("l_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["size_eq"]))); + ((((use_arg_then2 ("leq_trans", [leq_trans])) (disch_tac [])) THEN (clear_assumption "leq_trans") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`CARD (set_of_list l DELETE x)`))) (term_tac exists_tac))); + ((((use_arg_then2 ("CARD_DELETE", [CARD_DELETE]))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_SET_OF_LIST", [FINITE_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xl", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("l_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SET_OF_LIST_OF_SET", [SET_OF_LIST_OF_SET]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("l_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`set_of_list l2 = s DELETE x`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))))))); + (((((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CARD_SET_OF_LIST_LE", [CARD_SET_OF_LIST_LE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_DELETE", [IN_DELETE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (move ["y"])); + (((((use_arg_then2 ("l2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("l_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("MEM_LIST_OF_SET", [MEM_LIST_OF_SET]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("predC", [predC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pred1", [pred1]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("andbC", [andbC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_eq_list_of_set *) +let perm_eq_list_of_set = Sections.section_proof ["l";"s"] +`FINITE s ==> + (perm_eq l (list_of_set s) <=> sizel l = CARD s /\ (!x. x <- l <=> x IN s))` +[ + ((BETA_TAC THEN (move ["fin_s"])) THEN ((THENL) (split_tac) [(move ["p_eq"]); (case THEN ((move ["size_eq"]) THEN (move ["mem_eq"])))])); + (((((fun arg_tac -> (use_arg_then2 ("perm_eq_size", [perm_eq_size])) (fun fst_arg -> (use_arg_then2 ("p_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LENGTH_LIST_OF_SET", [LENGTH_LIST_OF_SET]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))) THEN (move ["y"])); + (((((fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (use_arg_then2 ("p_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM_LIST_OF_SET", [MEM_LIST_OF_SET]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_LAST) ((((use_arg_then2 ("uniq_perm_eq", [uniq_perm_eq]))(thm_tac (new_rewrite [] [])))) THEN ((THENL) (split_tac) [ALL_TAC; (move ["y"])])) ((((use_arg_then2 ("MEM_LIST_OF_SET", [MEM_LIST_OF_SET]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("uniq_list_of_set", [uniq_list_of_set]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> (use_arg_then2 ("uniq_size_uniq", [uniq_size_uniq])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("uniq_list_of_set", [uniq_list_of_set])) (fun fst_arg -> (use_arg_then2 ("fin_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [2] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("LENGTH_LIST_OF_SET", [LENGTH_LIST_OF_SET]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["y"])); + ((((use_arg_then2 ("MEM_LIST_OF_SET", [MEM_LIST_OF_SET]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma perm_eq_set_of_list *) +let perm_eq_set_of_list = Sections.section_proof ["l";"s"] +`FINITE s /\ perm_eq l (list_of_set s) ==> set_of_list l = s` +[ + (BETA_TAC THEN (case THEN (move ["fin_s"])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["mem"])); + ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem", []))(thm_tac (new_rewrite [] []))))) THEN (move ["x"])) THEN (((use_arg_then2 ("MEM_LIST_OF_SET", [MEM_LIST_OF_SET]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma card_set_of_list_uniq *) +let card_set_of_list_uniq = Sections.section_proof ["l"] +`uniq l ==> CARD (set_of_list l) = sizel l` +[ + ((BETA_TAC THEN (move ["uniq_l"])) THEN (((use_arg_then2 ("anti_leq", [anti_leq])) (disch_tac [])) THEN (clear_assumption "anti_leq") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("CARD_SET_OF_LIST_LE", [CARD_SET_OF_LIST_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("LENGTH_LIST_OF_SET", [LENGTH_LIST_OF_SET]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_SET_OF_LIST", [FINITE_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("uniq_leq_size", [uniq_leq_size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("uniq_l", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["mem_x"])); + (((((use_arg_then2 ("MEM_LIST_OF_SET", [MEM_LIST_OF_SET]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_SET_OF_LIST", [FINITE_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma BIJ_from_lists *) +let BIJ_from_lists = Sections.section_proof ["s1";"s2"] +`uniq s1 /\ uniq s2 /\ sizel s1 = sizel s2 ==> + BIJ (\x. EL (indexl x s1) s2) (set_of_list s1) (set_of_list s2)` +[ + (BETA_TAC THEN (case THEN (move ["uniq_s1"])) THEN (case THEN (move ["uniq_s2"])) THEN (move ["size_eq"])); + (((((use_arg_then2 ("BIJ", [BIJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("INJ", [INJ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SURJ", [SURJ]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac)); + ((THENL) (split_tac) [((move ["x"]) THEN (move ["mem_x"])); ((move ["x"]) THEN (move ["y"]) THEN (case THEN (move ["xs1"])) THEN (case THEN (move ["ys2"])))]); + (((((use_arg_then2 ("MEM_EL", [MEM_EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(@)UNIV`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("nth_uniq", [nth_uniq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("uniq_index_inj", [uniq_index_inj]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((split_tac) THEN (move ["x"]) THEN (move ["mem_x"])) (((((use_arg_then2 ("MEM_EL", [MEM_EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`nth ((@)UNIV) s1 (indexl x s2)`))) (term_tac exists_tac)); + ((((use_arg_then2 ("mem_nth", [mem_nth]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("index_uniq", [index_uniq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("EL_index", [EL_index]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma set_of_list_iota *) +let set_of_list_iota = Sections.section_proof ["m";"n"] +`set_of_list (iota m n) = if n = 0 then {} else m..m + n - 1` +[ + (((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_iota", [mem_iota]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"])); + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN case) [ALL_TAC; (move ["n"])]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("eqS0", [eqS0]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((fun arg_tac ->(use_arg_then2 ("NOT_IN_EMPTY", [NOT_IN_EMPTY]))(fun tmp_arg1 -> (use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma perm_eq_set_of_list_eq *) +let perm_eq_set_of_list_eq = Sections.section_proof ["s1";"s2"] +`perm_eq s1 s2 ==> set_of_list s1 = set_of_list s2` +[ + ((((((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))))) THEN (move ["perm"]) THEN (move ["x"])) THEN (((fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section ListsAndSets *) +let list_of_empty_set = Sections.finalize_theorem list_of_empty_set;; +let set_of_list_subseq = Sections.finalize_theorem set_of_list_subseq;; +let set_of_list_filter = Sections.finalize_theorem set_of_list_filter;; +let set_of_list_undup = Sections.finalize_theorem set_of_list_undup;; +let set_of_list_flatten = Sections.finalize_theorem set_of_list_flatten;; +let uniq_list_of_set = Sections.finalize_theorem uniq_list_of_set;; +let perm_eq_list_of_set = Sections.finalize_theorem perm_eq_list_of_set;; +let perm_eq_set_of_list = Sections.finalize_theorem perm_eq_set_of_list;; +let card_set_of_list_uniq = Sections.finalize_theorem card_set_of_list_uniq;; +let BIJ_from_lists = Sections.finalize_theorem BIJ_from_lists;; +let set_of_list_iota = Sections.finalize_theorem set_of_list_iota;; +let perm_eq_set_of_list_eq = Sections.finalize_theorem perm_eq_set_of_list_eq;; +Sections.end_section "ListsAndSets";; + +(* Section ListSum *) +Sections.begin_section "ListSum";; +(Sections.add_section_type (mk_var ("f", (`:A->real`))));; + +(* Lemma list_sum_nil *) +let list_sum_nil = Sections.section_proof ["f"] +`list_sum [] f = &0` +[ + (((((use_arg_then2 ("list_sum", [list_sum]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("foldr", [foldr]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_sum_cons *) +let list_sum_cons = Sections.section_proof ["h";"t";"f"] +`list_sum (h :: t) f = f h + list_sum t f` +[ + (((((use_arg_then2 ("list_sum", [list_sum]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("foldr", [foldr]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("list_sum", [list_sum]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma list_sum_cat *) +let list_sum_cat = Sections.section_proof ["s1";"s2";"f"] +`list_sum (s1 ++ s2) f = list_sum s1 f + list_sum s2 f` +[ + (((THENL) (((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN ((((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("list_sum_nil", [list_sum_nil]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_ADD_LID", [REAL_ADD_LID]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((repeat_tactic 1 9 (((use_arg_then2 ("list_sum_cons", [list_sum_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_sum_add *) +let list_sum_add = Sections.section_proof ["s";"f1";"f2"] +`list_sum s (\x. f1 x + f2 x) = list_sum s f1 + list_sum s f2` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("list_sum_nil", [list_sum_nil]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_ADD_LID", [REAL_ADD_LID]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("list_sum_cons", [list_sum_cons]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + ((((use_arg_then2 ("IH", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma list_sum_lmul *) +let list_sum_lmul = Sections.section_proof ["s";"f";"c"] +`list_sum s (\x. c * f x) = c * list_sum s f` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("list_sum_nil", [list_sum_nil]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_MUL_RZERO", [REAL_MUL_RZERO]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((repeat_tactic 1 9 (((use_arg_then2 ("list_sum_cons", [list_sum_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IH", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma list_sum_rmul *) +let list_sum_rmul = Sections.section_proof ["s";"f";"c"] +`list_sum s (\x. f x * c) = c * list_sum s f` +[ + (((((use_arg_then2 ("list_sum_lmul", [list_sum_lmul]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_sum_delete1 *) +let list_sum_delete1 = Sections.section_proof ["x";"s";"f"] +`list_sum (delete1 x s) f = list_sum s f - if x <- s then f x else &0` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN ((((use_arg_then2 ("delete1", [delete1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("list_sum_nil", [list_sum_nil]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_SUB_RZERO", [REAL_SUB_RZERO]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`x = h`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) (((((use_arg_then2 ("list_sum_cons", [list_sum_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("list_sum_cons", [list_sum_cons]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IH", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma list_sum_perm_eq *) +let list_sum_perm_eq = Sections.section_proof ["s1";"s2";"f"] +`perm_eq s1 s2 ==> list_sum s1 f = list_sum s2 f` +[ + ((THENL_FIRST) (((THENL) (((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN (move ["s2"])) (((((use_arg_then2 ("perm_eq0l", [perm_eq0l]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((BETA_TAC THEN (move ["p_eq"])) THEN (((use_arg_then2 ("list_sum_cons", [list_sum_cons]))(thm_tac (new_rewrite [] []))))); + ((THENL_ROT (-1)) (((fun arg_tac -> (use_arg_then2 ("IH", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`delete1 h s2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("list_sum_delete1", [list_sum_delete1]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (use_arg_then2 ("p_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`t = delete1 h (h :: t)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((((use_arg_then2 ("perm_eq_delete1", [perm_eq_delete1]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("delete1", [delete1]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma list_sum_nseq *) +let list_sum_nseq = Sections.section_proof ["x";"n";"f"] +`list_sum (nseq n x) f = &n * f x` +[ + (((THENL) (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN elim) [ALL_TAC; ((move ["n"]) THEN (move ["IH"]))]) THEN ((((use_arg_then2 ("nseq", [nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ncons", [ncons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iter", [iter]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("list_sum_nil", [list_sum_nil]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_MUL_LZERO", [REAL_MUL_LZERO]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("list_sum_cons", [list_sum_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ncons", [ncons]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nseq", [nseq]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ADD1", [ADD1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OF_NUM_ADD", [REAL_OF_NUM_ADD]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma list_sum_eq *) +let list_sum_eq = Sections.section_proof ["s";"f";"g"] +`(!x. x <- s ==> f x = g x) ==> list_sum s f = list_sum s g` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN (((repeat_tactic 0 10 (((use_arg_then2 ("list_sum_nil", [list_sum_nil]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))) THEN (move ["eq"]))); + ((THENL_FIRST) ((repeat_tactic 1 9 (((use_arg_then2 ("list_sum_cons", [list_sum_cons]))(thm_tac (new_rewrite [] []))))) THEN (congr_tac (`_1 + _2:real`))) ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((((use_arg_then2 ("IH", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["x"]) THEN (move ["mem_x"])) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma list_sum_nth_eq *) +let list_sum_nth_eq = Sections.section_proof ["x1";"x2";"s1";"s2";"f";"g"] +`sizel s1 = sizel s2 /\ + (!i. i < sizel s1 ==> f (nth x1 s1 i) = g (nth x2 s2 i)) ==> + list_sum s1 f = list_sum s2 g` +[ + ((((THENL) (((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN ((THENL) case [ALL_TAC; ((move ["a"]) THEN (move ["b"]))])) THEN ((repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("size_cons", [size_cons]))(fun tmp_arg1 -> (use_arg_then2 ("size_nil", [size_nil]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("list_sum_nil", [list_sum_nil]))(thm_tac (new_rewrite [] [])))))) THEN (TRY ((arith_tac)))); + (((((use_arg_then2 ("eqSS", [eqSS]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["size_eq"])) THEN (move ["el_eq"])) THEN (repeat_tactic 1 9 (((use_arg_then2 ("list_sum_cons", [list_sum_cons]))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) (congr_tac (`_1 + _2:real`)) ((((fun arg_tac -> (use_arg_then2 ("el_eq", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("gtS0", [gtS0])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sizel t`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("IH", [])) (fun fst_arg -> (use_arg_then2 ("b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["i"]) THEN (move ["i_lt"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("iffRL", [iffRL])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ltSS", [ltSS])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sizel t`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("el_eq", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_sum_const *) +let list_sum_const = Sections.section_proof ["s";"c"] +`list_sum s (\x. c) = &(sizel s) * c` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("list_sum_nil", [list_sum_nil]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_MUL_LZERO", [REAL_MUL_LZERO]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("list_sum_cons", [list_sum_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ADD1", [ADD1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OF_NUM_ADD", [REAL_OF_NUM_ADD]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IH", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma list_sum_eq0 *) +let list_sum_eq0 = Sections.section_proof ["s";"f"] +`(!x. x <- s ==> f x = &0) ==> list_sum s f = &0` +[ + ((BETA_TAC THEN (move ["eq0"])) THEN ((((fun arg_tac -> (use_arg_then2 ("REAL_MUL_RZERO", [REAL_MUL_RZERO])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&(sizel s)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("list_sum_const", [list_sum_const]))(gsym_then (thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("list_sum_eq", [list_sum_eq])) (disch_tac [])) THEN (clear_assumption "list_sum_eq") THEN (DISCH_THEN apply_tac) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("eq0", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Lemma list_sum_ge0 *) +let list_sum_ge0 = Sections.section_proof ["s";"f"] +`(!x. x <- s ==> &0 <= f x) ==> &0 <= list_sum s f` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN ((((fun arg_tac ->(use_arg_then2 ("list_sum_nil", [list_sum_nil]))(fun tmp_arg1 -> (use_arg_then2 ("list_sum_cons", [list_sum_cons]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((THENL_LAST) (((((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN (move ["f_ge0"])) THEN ((((use_arg_then2 ("REAL_LE_ADD", [REAL_LE_ADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IH", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))))) (((use_arg_then2 ("f_ge0", [])) (disch_tac [])) THEN (clear_assumption "f_ge0") THEN (exact_tac))); + ((BETA_TAC THEN (move ["x"]) THEN (move ["mem_x"])) THEN (((use_arg_then2 ("f_ge0", [])) (disch_tac [])) THEN (clear_assumption "f_ge0") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma list_sum_nth_le2 *) +let list_sum_nth_le2 = Sections.section_proof ["x1";"x2";"s";"t";"f";"g"] +`sizel t = sizel s /\ + (!i. i < sizel s ==> f (nth x1 s i) <= g (nth x2 t i)) ==> + list_sum s f <= list_sum t g` +[ + ((((THENL) (((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h1"]) THEN (move ["t1"]) THEN (move ["IH1"]))]) THEN ((THENL) case [ALL_TAC; ((move ["h2"]) THEN (move ["t2"]))])) THEN ((repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("list_sum_nil", [list_sum_nil]))(fun tmp_arg1 -> (use_arg_then2 ("list_sum_cons", [list_sum_cons]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (TRY ((arith_tac)))); + ((((use_arg_then2 ("eqSS", [eqSS]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["size_eq"])) THEN (move ["h"])); + ((((use_arg_then2 ("REAL_LE_ADD2", [REAL_LE_ADD2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IH1", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((BETA_TAC THEN (move ["i"]) THEN (move ["i_lt"])) THEN (((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SUC i`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_lt", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("gtS0", [gtS0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma list_sum_undup *) +let list_sum_undup = Sections.section_proof ["s";"f"] +`list_sum s f = list_sum (undup s) (\x. &(count (pred1 x) s) * f x)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN ((((use_arg_then2 ("undup", [undup]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("list_sum_nil", [list_sum_nil]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("list_sum_cons", [list_sum_cons]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("count", [count]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OF_NUM_ADD", [REAL_OF_NUM_ADD]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_ADD_RDISTRIB", [REAL_ADD_RDISTRIB]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_sum_add", [list_sum_add]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`h <- t`))) (disch_eq_tac "mem_h" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((use_arg_then2 ("IH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((congr_tac (`_1 + _2:real`)) THEN ((TRY done_tac)))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("list_sum_perm_eq", [list_sum_perm_eq])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`undup t`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`h :: delete1 h (undup t)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))); + (((((use_arg_then2 ("perm_eq_sym", [perm_eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_eq_cons_delete1", [perm_eq_cons_delete1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_undup", [mem_undup]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("list_sum_cons", [list_sum_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pred1", [pred1]))(thm_tac (new_rewrite [1] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("REAL_ADD_RID", [REAL_ADD_RID])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f h`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("REAL_EQ_ADD_LCANCEL", [REAL_EQ_ADD_LCANCEL]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_sum_eq0", [list_sum_eq0]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["x"])); + (((((use_arg_then2 ("mem_delete1_uniq", [mem_delete1_uniq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("undup_uniq", [undup_uniq]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mem_undup", [mem_undup]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["h"]) THEN (simp_tac)); + (((((use_arg_then2 ("pred1", [pred1]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("h", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_MUL_LZERO", [REAL_MUL_LZERO]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("list_sum_cons", [list_sum_cons]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("IH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("pred1", [pred1]))(thm_tac (new_rewrite [1] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_MUL_LID", [REAL_MUL_LID]))(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_ADD_ASSOC", [REAL_ADD_ASSOC]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_EQ_ADD_RCANCEL", [REAL_EQ_ADD_RCANCEL]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`count (pred1 h) t = 0`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("mem_h", [])) (disch_tac [])) THEN (clear_assumption "mem_h") THEN BETA_TAC) THEN ((((use_arg_then2 ("has_pred1", [has_pred1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("has_count", [has_count]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("REAL_MUL_LZERO", [REAL_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_RID", [REAL_ADD_RID]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("REAL_ADD_RID", [REAL_ADD_RID])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`f h`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("REAL_EQ_ADD_LCANCEL", [REAL_EQ_ADD_LCANCEL]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_sum_eq0", [list_sum_eq0]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mem_undup", [mem_undup]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pred1", [pred1]))(thm_tac (new_rewrite [] []))))) THEN (move ["x"]) THEN (move ["mem_x"]) THEN (simp_tac)); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`~(h = x)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) (((simp_tac) THEN (((use_arg_then2 ("REAL_MUL_LZERO", [REAL_MUL_LZERO]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("mem_h", [])) (disch_tac [])) THEN (clear_assumption "mem_h") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_sum_set_of_list *) +let list_sum_set_of_list = Sections.section_proof ["s";"f"] +`uniq s ==> list_sum s f = sum (set_of_list s) f` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN ((((use_arg_then2 ("set_of_list", [set_of_list]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("list_sum_nil", [list_sum_nil]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("SUM_CLAUSES", [SUM_CLAUSES]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_SET_OF_LIST", [FINITE_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((((((use_arg_then2 ("uniq", [uniq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_sum_cons", [list_sum_cons]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("IH", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_sum_list_of_set *) +let list_sum_list_of_set = Sections.section_proof ["s";"f"] +`FINITE s ==> list_sum (list_of_set s) f = sum s f` +[ + ((BETA_TAC THEN (move ["fin_s"])) THEN ((((use_arg_then2 ("list_sum_set_of_list", [list_sum_set_of_list]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uniq_list_of_set", [uniq_list_of_set]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("SET_OF_LIST_OF_SET", [SET_OF_LIST_OF_SET]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_sum_nth *) +let list_sum_nth = Sections.section_proof ["x0";"s";"f"] +`list_sum s f = list_sum (iota 0 (sizel s)) (\i. f (nth x0 s i))` +[ + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("list_sum_nth_eq", [list_sum_nth_eq])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + (((((use_arg_then2 ("size_iota", [size_iota]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["i"]) THEN (move ["i_lt"])); + (((((use_arg_then2 ("nth_iota", [nth_iota]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_sum_EL *) +let list_sum_EL = Sections.section_proof ["s";"f"] +`~(s = []) ==> list_sum s f = sum (0..sizel s - 1) (\i. f (EL i s))` +[ + ((((use_arg_then2 ("size_eq0", [size_eq0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["size_neq"])); + ((((fun arg_tac -> (use_arg_then2 ("list_sum_nth", [list_sum_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(@)UNIV`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_sum_set_of_list", [list_sum_set_of_list]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("iota_uniq", [iota_uniq]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("set_of_list_iota", [set_of_list_iota]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_neq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["ineqs"]) THEN (simp_tac))); + (((((use_arg_then2 ("EL_nth", [EL_nth]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("size_neq", [])) (disch_tac [])) THEN (clear_assumption "size_neq") THEN ((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma list_sum_EL_alt *) +let list_sum_EL_alt = Sections.section_proof ["s";"f"] +`list_sum s f = sum (1..sizel s) (\i. f (EL (i - 1) s))` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]))]) THEN (((fun arg_tac ->(use_arg_then2 ("size_nil", [size_nil]))(fun tmp_arg1 -> (use_arg_then2 ("size_cons", [size_cons]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("list_sum_nil", [list_sum_nil]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL SUM_CLAUSES_NUMSEG)))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ADD1", [ADD1]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("SUM_OFFSET", [SUM_OFFSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_sum_EL", [list_sum_EL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("NOT_CONS_NIL", [NOT_CONS_NIL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (move ["i"]) THEN (move ["ineqs"]) THEN (simp_tac))); + (((((use_arg_then2 ("ADD1", [ADD1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_sum_iota *) +let list_sum_iota = Sections.section_proof ["m";"n";"g"] +`list_sum (iota m n) g = if (n = 0) then &0 else sum (m..m + n - 1) g` +[ + ((((use_arg_then2 ("list_sum_set_of_list", [list_sum_set_of_list]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("iota_uniq", [iota_uniq]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("set_of_list_iota", [set_of_list_iota]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> arg_tac (Arg_term (`n = 0`))) (disch_tac [])) THEN case THEN (simp_tac)) THEN (((use_arg_then2 ("SUM_CLAUSES", [SUM_CLAUSES]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma count_eq_list_sum *) +let count_eq_list_sum = Sections.section_proof ["a";"s"] +`&(count a s) = list_sum s (\x. if a x then &1 else &0)` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN ((((use_arg_then2 ("count", [count]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac ->(use_arg_then2 ("list_sum_nil", [list_sum_nil]))(fun tmp_arg1 -> (use_arg_then2 ("list_sum_cons", [list_sum_cons]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("REAL_OF_NUM_ADD", [REAL_OF_NUM_ADD]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IH", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("fun_if", [fun_if]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma count_eq_nsum *) +let count_eq_nsum = Sections.section_proof ["a";"s"] +`~(s = []) ==> count a s = nsum (0..sizel s - 1) (\i. if a (EL i s) then 1 else 0)` +[ + (BETA_TAC THEN (move ["s_n_nil"])); + (((((use_arg_then2 ("REAL_OF_NUM_EQ", [REAL_OF_NUM_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("count_eq_list_sum", [count_eq_list_sum]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_sum_EL", [list_sum_EL]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("REAL_OF_NUM_SUM", [REAL_OF_NUM_SUM]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("fun_if", [fun_if]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma count_eq_list_sum_iota *) +let count_eq_list_sum_iota = Sections.section_proof ["x0";"a";"s"] +`&(count a s) = list_sum (iota 0 (sizel s)) (\i. if a (nth x0 s i) then &1 else &0)` +[ + ((((use_arg_then2 ("count_eq_list_sum", [count_eq_list_sum]))(thm_tac (new_rewrite [] [])))) THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("list_sum_nth_eq", [list_sum_nth_eq])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac))); + ((((((use_arg_then2 ("size_iota", [size_iota]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["i"]) THEN (move ["i_lt"])) THEN ((((use_arg_then2 ("nth_iota", [nth_iota]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section ListSum *) +let list_sum_nil = Sections.finalize_theorem list_sum_nil;; +let list_sum_cons = Sections.finalize_theorem list_sum_cons;; +let list_sum_cat = Sections.finalize_theorem list_sum_cat;; +let list_sum_add = Sections.finalize_theorem list_sum_add;; +let list_sum_lmul = Sections.finalize_theorem list_sum_lmul;; +let list_sum_rmul = Sections.finalize_theorem list_sum_rmul;; +let list_sum_delete1 = Sections.finalize_theorem list_sum_delete1;; +let list_sum_perm_eq = Sections.finalize_theorem list_sum_perm_eq;; +let list_sum_nseq = Sections.finalize_theorem list_sum_nseq;; +let list_sum_eq = Sections.finalize_theorem list_sum_eq;; +let list_sum_nth_eq = Sections.finalize_theorem list_sum_nth_eq;; +let list_sum_const = Sections.finalize_theorem list_sum_const;; +let list_sum_eq0 = Sections.finalize_theorem list_sum_eq0;; +let list_sum_ge0 = Sections.finalize_theorem list_sum_ge0;; +let list_sum_nth_le2 = Sections.finalize_theorem list_sum_nth_le2;; +let list_sum_undup = Sections.finalize_theorem list_sum_undup;; +let list_sum_set_of_list = Sections.finalize_theorem list_sum_set_of_list;; +let list_sum_list_of_set = Sections.finalize_theorem list_sum_list_of_set;; +let list_sum_nth = Sections.finalize_theorem list_sum_nth;; +let list_sum_EL = Sections.finalize_theorem list_sum_EL;; +let list_sum_EL_alt = Sections.finalize_theorem list_sum_EL_alt;; +let list_sum_iota = Sections.finalize_theorem list_sum_iota;; +let count_eq_list_sum = Sections.finalize_theorem count_eq_list_sum;; +let count_eq_nsum = Sections.finalize_theorem count_eq_nsum;; +let count_eq_list_sum_iota = Sections.finalize_theorem count_eq_list_sum_iota;; +Sections.end_section "ListSum";; + +(* Section ListSumn *) +Sections.begin_section "ListSumn";; +(Sections.add_section_type (mk_var ("f", (`:A->num`))));; + +(* Lemma list_sumn_nil *) +let list_sumn_nil = Sections.section_proof ["f"] +`list_sumn [] f = 0` +[ + (((((use_arg_then2 ("list_sumn", [list_sumn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("foldr", [foldr]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma list_sumn_cons *) +let list_sumn_cons = Sections.section_proof ["h";"t";"f"] +`list_sumn (CONS h t) f = f h + list_sumn t f` +[ + (((((use_arg_then2 ("list_sumn", [list_sumn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("foldr", [foldr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_sumn", [list_sumn]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma list_sum_eq_list_sumn *) +let list_sum_eq_list_sumn = Sections.section_proof ["s";"f"] +`list_sum s ((&) o f) = &(list_sumn s f)` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) (((((use_arg_then2 ("list_sum_nil", [list_sum_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_sumn_nil", [list_sumn_nil]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("list_sumn_cons", [list_sumn_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_sum_cons", [list_sum_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_OF_NUM_ADD", [REAL_OF_NUM_ADD]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma count_flatten *) +let count_flatten = Sections.section_proof ["s";"a"] +`count a (flatten s) = list_sumn (map (count a) s) I` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((((use_arg_then2 ("flatten", [flatten]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("foldr", [foldr]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("count", [count]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("map", [map]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_sumn_nil", [list_sumn_nil]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("flatten", [flatten]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("map", [map]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("list_sumn_cons", [list_sumn_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ih", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("count_cat", [count_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_eq_flatten *) +let perm_eq_flatten = Sections.section_proof ["s1";"s2"] +`perm_eq s1 s2 ==> perm_eq (flatten s1) (flatten s2)` +[ + ((BETA_TAC THEN (move ["perm"])) THEN ((((use_arg_then2 ("perm_eqP", [perm_eqP]))(thm_tac (new_rewrite [] [])))) THEN (move ["a"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("count_flatten", [count_flatten]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_OF_NUM_EQ", [REAL_OF_NUM_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("list_sum_eq_list_sumn", [list_sum_eq_list_sumn]))(gsym_then (thm_tac (new_rewrite [] []))))))); + (((use_arg_then2 ("list_sum_perm_eq", [list_sum_perm_eq])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("perm_eq_map", [perm_eq_map]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section ListSumn *) +let list_sumn_nil = Sections.finalize_theorem list_sumn_nil;; +let list_sumn_cons = Sections.finalize_theorem list_sumn_cons;; +let list_sum_eq_list_sumn = Sections.finalize_theorem list_sum_eq_list_sumn;; +let count_flatten = Sections.finalize_theorem count_flatten;; +let perm_eq_flatten = Sections.finalize_theorem perm_eq_flatten;; +Sections.end_section "ListSumn";; + +(* Section PermEqPermutes *) +Sections.begin_section "PermEqPermutes";; +(Sections.add_section_var (mk_var ("x0", (`:A`))));; + +(* Lemma perm_eq_bij *) +let perm_eq_bij = Sections.section_proof ["s1";"s2"] +`perm_eq s1 s2 ==> + (?p. p permutes (0..sizel s1 - 1) /\ (!i. i < sizel s1 ==> nth x0 s2 i = nth x0 s1 (p i)))` +[ + (((THENL) (((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN (move ["s2"])); + (((((use_arg_then2 ("perm_eq0l", [perm_eq0l]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`I`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("sub0n", [sub0n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NUMSEG_SING", [NUMSEG_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PERMUTES_SING", [PERMUTES_SING]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] []))))) THEN (move ["perm"])); + (((fun arg_tac -> (use_arg_then2 ("IH", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`delete1 h s2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("IH", [])) (disch_tac [])) THEN (clear_assumption "IH") THEN BETA_TAC THEN (move ["_"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("delete1_hd", [delete1_hd])) (fun fst_arg -> (use_arg_then2 ("h", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("t", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("perm_eq_delete1", [perm_eq_delete1])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (BETA_TAC THEN (case THEN (move ["q"])) THEN (case THEN (move ["perm_q"])) THEN (move ["del_eq"])); + ((fun arg_tac -> arg_tac (Arg_term (`indexl h s2`))) (term_tac (set_tac "k"))); + ((fun arg_tac -> arg_tac (Arg_term (`\i. if sizel t < i then i else + if i = k then 0 else SUC (q (if i < k then i else i - 1))`))) (term_tac (set_tac "p"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`h <- s2`))) (term_tac (have_gen_tac [](move ["hs2"])))) (((((fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`k < sizel s2`))) (term_tac (have_gen_tac [](move ["k_lt"])))) (((((use_arg_then2 ("k_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`sizel t = sizel s2 - 1`))) (term_tac (have_gen_tac [](move ["size_t"])))) (((((fun arg_tac -> (use_arg_then2 ("perm_eq_size", [perm_eq_size])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`i < k:num ==> p i = SUC (q i)`))) (term_tac (have_gen_tac ["i"](move ["p1"])))) (((((use_arg_then2 ("p_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_t", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`p k = 0`))) (term_tac (have_gen_tac [](move ["p2"])))) (((((use_arg_then2 ("p_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_t", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`k < i:num /\ i <= sizel t ==> p i = SUC (q (i - 1))`))) (term_tac (have_gen_tac ["i"](move ["p3"])))); + (((((use_arg_then2 ("p_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_t", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`sizel t < i ==> p i = i`))) (term_tac (have_gen_tac ["i"](move ["p4"])))) ((((((use_arg_then2 ("p_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("perm_q", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("PERMUTES_FINITE_SURJECTIVE", [PERMUTES_FINITE_SURJECTIVE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("leq0n", [leq0n]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + (BETA_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["q_in"])) THEN (move ["q_exists"])); + (((use_arg_then2 ("p", [])) (term_tac exists_tac)) THEN (split_tac)); + ((((use_arg_then2 ("PERMUTES_FINITE_SURJECTIVE", [PERMUTES_FINITE_SURJECTIVE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("leq0n", [leq0n]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((THENL_FIRST) ((THENL) (split_tac) [((move ["n"]) THEN (move ["n_le"])); ALL_TAC]) (((((use_arg_then2 ("p4", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("NOT_LE", [NOT_LE]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((THENL_ROT (-1)) ((split_tac) THEN (move ["n"]) THEN (move ["n_le"]))); + (((THENL) (((use_arg_then2 ("n_le", [])) (disch_tac [])) THEN (clear_assumption "n_le") THEN ((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN case) [ALL_TAC; (move ["n"])]) THEN (move ["n_le"])); + (((use_arg_then2 ("k", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("p2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_t", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((((fun arg_tac -> (use_arg_then2 ("q_exists", [])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)) ((((use_arg_then2 ("n_le", [])) (disch_tac [])) THEN (clear_assumption "n_le") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (BETA_TAC THEN (case THEN (move ["m"])) THEN (case THEN (move ["m_le"])) THEN (move ["q_eq"])); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`if m < k then m else m + 1`))) (term_tac exists_tac)) THEN (split_tac)) ((((use_arg_then2 ("n_le", [])) (disch_tac [])) THEN (clear_assumption "n_le") THEN ((use_arg_then2 ("m_le", [])) (disch_tac [])) THEN (clear_assumption "m_le") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`m < k:num`))) (disch_eq_tac "m_lt_k" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("p1", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("p3", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ADD1", [ADD1]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("q_eq", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("n_le", [])) (disch_tac [])) THEN (clear_assumption "n_le") THEN ((use_arg_then2 ("m_le", [])) (disch_tac [])) THEN (clear_assumption "m_le") THEN ((use_arg_then2 ("m_lt_k", [])) (disch_tac [])) THEN (clear_assumption "m_lt_k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ltngtP", [ltngtP])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(move ["n_lt"]); ALL_TAC]); + (((((use_arg_then2 ("p1", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN ((use_arg_then2 ("n_lt", [])) (disch_tac [])) THEN (clear_assumption "n_lt") THEN ((use_arg_then2 ("n_le", [])) (disch_tac [])) THEN (clear_assumption "n_le") THEN ((fun arg_tac -> (use_arg_then2 ("q_in", [])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("size_t", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((THENL_LAST) ((THENL) case [(move ["k_lt"]); (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))]) (((((use_arg_then2 ("p2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq0n", [leq0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("p3", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((fun arg_tac -> (use_arg_then2 ("q_in", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`n - 1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("leq_sub2r", [leq_sub2r]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac))) THEN (((use_arg_then2 ("n_le", [])) (disch_tac [])) THEN (clear_assumption "n_le") THEN ((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (BETA_TAC THEN (move ["i"]) THEN (move ["i_lt"])); + ((THENL) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ltngtP", [ltngtP])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(move ["i_lt_k"]); ALL_TAC]); + ((THENL_FIRST) ((((fun arg_tac -> (use_arg_then2 ("del_eq", [])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)) ((((use_arg_then2 ("size_t", [])) (disch_tac [])) THEN (clear_assumption "size_t") THEN ((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN ((use_arg_then2 ("i_lt_k", [])) (disch_tac [])) THEN (clear_assumption "i_lt_k") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("nth_delete1", [nth_delete1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("k_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_lt_k", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("COND_CLAUSES", [COND_CLAUSES]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("p1", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_LAST) ((THENL) case [(move ["k_lt_i"]); (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))]) (((((use_arg_then2 ("p2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("k_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_index", [nth_index]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((THENL_FIRST) ((((fun arg_tac -> (use_arg_then2 ("del_eq", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i - 1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (ANTS_TAC)) ((((use_arg_then2 ("k_lt_i", [])) (disch_tac [])) THEN (clear_assumption "k_lt_i") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("nth_delete1", [nth_delete1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("k_def", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `k < i ==> ~(i - 1 < k) /\ SUC (i - 1) = i`)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("COND_CLAUSES", [COND_CLAUSES]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("p3", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("k_lt_i", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma permutes_imp_perm_eq_iota *) +let permutes_imp_perm_eq_iota = Sections.section_proof ["p";"n"] +`p permutes 0..n + ==> perm_eq (mkseq p (n + 1)) (iota 0 (n + 1))` +[ + (BETA_TAC THEN (move ["p_perm"])); + (((((use_arg_then2 ("uniq_perm_eq_alt", [uniq_perm_eq_alt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_iota", [size_iota]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (split_tac)); + (((((fun arg_tac -> (use_arg_then2 ("uniq_nthP", [uniq_nthP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["j"]) THEN (case THEN ((move ["i_lt"]) THEN (move ["j_lt"])))); + ((THENL_FIRST) ((repeat_tactic 1 9 (((use_arg_then2 ("nth_mkseq", [nth_mkseq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) ((((use_arg_then2 ("j_lt", [])) (disch_tac [])) THEN (clear_assumption "j_lt") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("PERMUTES_INJECTIVE", [PERMUTES_INJECTIVE])) (fun fst_arg -> (use_arg_then2 ("p_perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("p_perm", [])) (disch_tac [])) THEN (clear_assumption "p_perm") THEN BETA_TAC) THEN ((((use_arg_then2 ("PERMUTES_FINITE_SURJECTIVE", [PERMUTES_FINITE_SURJECTIVE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("leq0n", [leq0n]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + (BETA_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["p_ineqs"])) THEN (move ["p_exists"]) THEN (move ["i"])); + (((((use_arg_then2 ("mem_iota", [mem_iota]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM_EXISTS_EL", [MEM_EXISTS_EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq0n", [leq0n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN ((THENL) (split_tac) [((case THEN (move ["j"])) THEN (case THEN (move ["j_lt"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); ALL_TAC])); + ((((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("nth_mkseq", [nth_mkseq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("j_lt", [])) (disch_tac [])) THEN (clear_assumption "j_lt") THEN ((fun arg_tac -> (use_arg_then2 ("p_ineqs", [])) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then2 ("ADD1", [ADD1]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))))) THEN (move ["i_le"])); + (((fun arg_tac -> (use_arg_then2 ("p_exists", [])) (fun fst_arg -> (use_arg_then2 ("i_le", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["j"])) THEN (case THEN (move ["j_le"])) THEN (move ["pj_eq"])); + (((use_arg_then2 ("j", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("nth_mkseq", [nth_mkseq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltE", [ltE]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("leqSS", [leqSS]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma perm_eq_iota *) +let perm_eq_iota = Sections.section_proof ["s1";"s2"] +`perm_eq s1 s2 ==> + (?l. perm_eq l (iota 0 (sizel s1)) /\ s2 = map (nth x0 s1) l)` +[ + ((THENL) (((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]))]); + (((((use_arg_then2 ("perm_eq0l", [perm_eq0l]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iota", [iota]))(thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> arg_tac (Arg_term (`[]`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("perm_eq_refl", [perm_eq_refl]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("map", [map]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((BETA_TAC THEN (move ["perm"])) THEN (((fun arg_tac -> (use_arg_then2 ("perm_eq_bij", [perm_eq_bij])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["p"])) THEN (case THEN (move ["p_perm"])) THEN (move ["nth_eq"]))); + ((fun arg_tac -> arg_tac (Arg_term (`sizel t`))) (term_tac (set_tac "n"))); + ((fun arg_tac -> arg_tac (Arg_term (`mkseq p (SUC n)`))) (term_tac exists_tac)); + ((((use_arg_then2 ("ADD1", [ADD1]))(thm_tac (new_rewrite [1; 2] [])))) THEN (((use_arg_then2 ("permutes_imp_perm_eq_iota", [permutes_imp_perm_eq_iota]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> (use_arg_then2 ("eq_from_nth", [eq_from_nth])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("size_map", [size_map]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("perm_eq_size", [perm_eq_size])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + (BETA_TAC THEN (move ["i"]) THEN (move ["i_lt"])); + ((((use_arg_then2 ("nth_map", [nth_map]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x0", [])) (term_tac exists_tac)) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("nth_mkseq", [nth_mkseq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("nth_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_eq_permutesP *) +let perm_eq_permutesP = Sections.section_proof ["s1";"s2"] +`perm_eq s1 s2 <=> + sizel s1 = sizel s2 /\ + ?p. p permutes 0..sizel s1 - 1 /\ (!i. i < sizel s1 ==> nth x0 s2 i = nth x0 s1 (p i))` +[ + ((THENL) (split_tac) [(move ["perm"]); ((case THEN (move ["size_eq"])) THEN (case THEN (move ["p"])) THEN (case THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("permutes_imp_perm_eq_iota", [permutes_imp_perm_eq_iota])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["perm"]) THEN (move ["nth_eq"]))))]); + (((((fun arg_tac -> (use_arg_then2 ("perm_eq_size", [perm_eq_size])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ((use_arg_then2 ("perm_eq_bij", [perm_eq_bij])) (thm_tac apply_tac)) THEN (done_tac)); + (((((use_arg_then2 ("perm_eqP", [perm_eqP]))(thm_tac (new_rewrite [] [])))) THEN (move ["a"])) THEN ((((use_arg_then2 ("REAL_OF_NUM_EQ", [REAL_OF_NUM_EQ]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("count_eq_list_sum_iota", [count_eq_list_sum_iota])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))))); + (((fun arg_tac -> arg_tac (Arg_term (`sizel s1 = 0`))) (disch_eq_tac "eq0" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((((use_arg_then2 ("size_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("iota", [iota]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("list_sum_nil", [list_sum_nil]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (in_tac ["perm"] false (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `!n. ~(n = 0) ==> n - 1 + 1 = n`))) (fun fst_arg -> (use_arg_then2 ("eq0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("list_sum_perm_eq", [list_sum_perm_eq])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("list_sum_nth_eq", [list_sum_nth_eq])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac))); + (((((use_arg_then2 ("size_mkseq", [size_mkseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_iota", [size_iota]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["i"]) THEN (move ["i_lt"])); + (((((use_arg_then2 ("nth_mkseq", [nth_mkseq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("nth_iota", [nth_iota]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("add0n", [add0n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section PermEqPermutes *) +let perm_eq_bij = Sections.finalize_theorem perm_eq_bij;; +let permutes_imp_perm_eq_iota = Sections.finalize_theorem permutes_imp_perm_eq_iota;; +let perm_eq_iota = Sections.finalize_theorem perm_eq_iota;; +let perm_eq_permutesP = Sections.finalize_theorem perm_eq_permutesP;; +Sections.end_section "PermEqPermutes";; + +(* Section BelastButlast *) +Sections.begin_section "BelastButlast";; + +(* Lemma head_belast *) +let head_belast = Sections.section_proof ["x0";"x";"s"] +`0 < sizel s ==> headl x0 (belast x s) = x` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["_"]))]) (((((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("belast", [belast]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("head", [head]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_belast *) +let nth_belast = Sections.section_proof ["x0";"s";"x";"i"] +`i < sizel s ==> + nth x0 (belast x s) i = if i = 0 then x else nth x0 s (i - 1)` +[ + ((((THENL) (((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN ((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((THENL) case [ALL_TAC; ((move ["i"]) THEN (move ["x"]))])) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((BETA_TAC THEN (move ["x"]) THEN (move ["lt"])) THEN ((((use_arg_then2 ("nth0", [nth0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("head_belast", [head_belast]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqS0", [eqS0]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["i_lt"])); + ((((use_arg_then2 ("belast", [belast]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] []))))); + ((((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN case) [ALL_TAC; (move ["j"])]) THEN (simp_tac)) THEN ((((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqS0", [eqS0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma take_belast *) +let take_belast = Sections.section_proof ["s";"x";"n"] +`n < sizel s /\ 0 < n ==> take n (belast x s) = x :: take (n - 1) s` +[ + ((((THENL) (((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN ((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]))]) THEN ((THENL) case [ALL_TAC; ((move ["n"]) THEN (move ["x"]))])) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("belast", [belast]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("take", [take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))) THEN (move ["ineqs"])); + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN ((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN case) [(move ["_"]); ((move ["n"]) THEN (move ["ineqs"]))]) (((((use_arg_then2 ("ONE", [ONE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("subnn", [subnn]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("take", [take]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + (((((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("take", [take]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("gtS0", [gtS0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma butlast_eq_take *) +let butlast_eq_take = Sections.section_proof ["s"] +`butlast s = take (sizel s - 1) s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN ((THENL) case [ALL_TAC; ((move ["h2"]) THEN (move ["t"]))]) THEN (move ["Ih"]))]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("butlast", [butlast]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("take", [take]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subnn", [subnn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("take", [take]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("take", [take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma butlast_cons *) +let butlast_cons = Sections.section_proof ["h";"t"] +`butlast (h :: t) = if t = [] then [] else h :: butlast t` +[ + (((THENL) (((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN case) [ALL_TAC; ((move ["h2"]) THEN (move ["t"]))]) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("butlast", [butlast]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("NOT_CONS_NIL", [NOT_CONS_NIL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma butlast_BUTLAST *) +let butlast_BUTLAST = Sections.section_proof [] +`butlast = BUTLAST` +[ + (((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))); + (((THENL) elim [ALL_TAC; ((move ["h"]) THEN ((THENL) case [ALL_TAC; ((move ["h2"]) THEN (move ["t"]))]) THEN (move ["Ih"]))]) THEN ((((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL BUTLAST)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("butlast", [butlast]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("NOT_CONS_NIL", [NOT_CONS_NIL]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma size_butlast *) +let size_butlast = Sections.section_proof ["s"] +`sizel (butlast s) = sizel s - 1` +[ + (((((use_arg_then2 ("butlast_eq_take", [butlast_eq_take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_take", [size_take]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma butlast_belast *) +let butlast_belast = Sections.section_proof ["s";"x"] +`0 < sizel s ==> belast x s = x :: butlast s` +[ + (((THENL) (((use_arg_then2 ("x", [])) (disch_tac [])) THEN (clear_assumption "x") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN ((THENL) case [ALL_TAC; ((move ["h2"]) THEN (move ["t"]))]) THEN (move ["Ih"]) THEN (move ["x"]) THEN (move ["_"]))]) THEN ((repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("size_nil", [size_nil]))(fun tmp_arg1 -> (use_arg_then2 ("ltn0", [ltn0]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("belast", [belast]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("butlast", [butlast]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("Ih", [])) (disch_tac [])) THEN (clear_assumption "Ih") THEN BETA_TAC) THEN (((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("gtS0", [gtS0]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("belast", [belast]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma cat_butlast_last *) +let cat_butlast_last = Sections.section_proof ["x0";"s"] +`0 < sizel s ==> s = butlast s ++ [last x0 s]` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN ((THENL) case [ALL_TAC; ((move ["h2"]) THEN (move ["t"]))]) THEN (move ["Ih"]) THEN (move ["_"]))]) THEN ((repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("size_nil", [size_nil]))(fun tmp_arg1 -> (use_arg_then2 ("ltn0", [ltn0]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("butlast", [butlast]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("last", [last]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("Ih", [])) (disch_tac [])) THEN (clear_assumption "Ih") THEN BETA_TAC) THEN (((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("gtS0", [gtS0]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("last", [last]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [1] []))))) THEN (done_tac)); +];; + +(* Finalization of the section BelastButlast *) +let head_belast = Sections.finalize_theorem head_belast;; +let nth_belast = Sections.finalize_theorem nth_belast;; +let take_belast = Sections.finalize_theorem take_belast;; +let butlast_eq_take = Sections.finalize_theorem butlast_eq_take;; +let butlast_cons = Sections.finalize_theorem butlast_cons;; +let butlast_BUTLAST = Sections.finalize_theorem butlast_BUTLAST;; +let size_butlast = Sections.finalize_theorem size_butlast;; +let butlast_belast = Sections.finalize_theorem butlast_belast;; +let cat_butlast_last = Sections.finalize_theorem cat_butlast_last;; +Sections.end_section "BelastButlast";; + +(* Section MoreRot *) +Sections.begin_section "MoreRot";; + +(* Lemma rot_nil *) +let rot_nil = Sections.section_proof ["n"] +`rot n [] = []` +[ + (((((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("drop", [drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("take", [take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rotr_nil *) +let rotr_nil = Sections.section_proof ["n"] +`rotr n [] = []` +[ + (((((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot_nil", [rot_nil]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_eq_rot *) +let perm_eq_rot = Sections.section_proof ["n";"s"] +`perm_eq (rot n s) s` +[ + (((((use_arg_then2 ("perm_rot", [perm_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_eq_refl", [perm_eq_refl]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_rot *) +let nth_rot = Sections.section_proof ["x0";"s";"k";"i"] +`k <= sizel s /\ i < sizel s + ==> nth x0 (rot k s) i = nth x0 s ((k + i) MOD sizel s)` +[ + (BETA_TAC THEN (move ["ineqs"])); + ((((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_cat", [nth_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`i:num < _`))) (disch_eq_tac "i_lt" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((((use_arg_then2 ("nth_drop", [nth_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MOD_LT", [MOD_LT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`i - (sizel s - k) = (k + i) - sizel s`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) (((use_arg_then2 ("nth_take", [nth_take]))(thm_tac (new_rewrite [] [])))) ((((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`k + i = 1 * sizel s + ((k + i) - sizel s)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [2] []))))))) ((((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("MOD_MULT_ADD", [MOD_MULT_ADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MOD_LT", [MOD_LT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma rot_to_index_explicit *) +let rot_to_index_explicit = Sections.section_proof ["s";"x"] +`MEM x s + ==> rot (indexl x s) s = x :: dropl 1 (rot (indexl x s) s)` +[ + (BETA_TAC THEN (move ["mem_x"])); + ((fun arg_tac -> arg_tac (Arg_term (`0 < sizel s /\ indexl x s < sizel s`))) (term_tac (have_gen_tac [](move ["ineqs"])))); + (((((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_x", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("has_predT", [has_predT]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hasP", [hasP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("predT", [predT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac)); + (((((fun arg_tac -> (use_arg_then2 ("cons_head_drop1", [cons_head_drop1])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [1] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN ((congr_tac (`_1 :: _2`)) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("nth0", [nth0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_rot", [nth_rot]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltnW", [ltnW]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("addn0", [addn0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MOD_LT", [MOD_LT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("nth_index", [nth_index]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma rot_to_index *) +let rot_to_index = Sections.section_proof ["s";"x"] +`MEM x s ==> ?t. rot (indexl x s) s = x :: t` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("rot_to_index_explicit", [rot_to_index_explicit])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`dropl 1 (rot (indexl x s) s)`))) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma shift_right *) +let shift_right = Sections.section_proof ["h";"t"] +`rotr 1 [] = [] /\ + rotr 1 (h :: t) = belast (last h t) (h :: t)` +[ + (((((use_arg_then2 ("rotr_nil", [rotr_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lastI", [lastI]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("rotr1_rcons", [rotr1_rcons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("belast", [belast]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma nth_shift_left *) +let nth_shift_left = Sections.section_proof ["x0";"s";"i"] +`i < sizel s ==> + nth x0 (rot 1 s) i = if (i = sizel s - 1) then nth x0 s 0 else nth x0 s (i + 1)` +[ + (BETA_TAC THEN (move ["i_lt"])); + ((((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_cat", [nth_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn_neqAle", [ltn_neqAle]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`i = sizel s - 1`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((THENL_FIRST) ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_take", [nth_take]))(thm_tac (new_rewrite [] []))))) ((((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((congr_tac (`nth x0 s _`)) THEN (((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`i <= sizel s - 1`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))))) ((((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("nth_drop", [nth_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addnC", [addnC]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN ((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma nth_shift_right *) +let nth_shift_right = Sections.section_proof ["x0";"s";"i"] +`i < sizel s ==> + nth x0 (rotr 1 s) i = if (i = 0) then nth x0 s (sizel s - 1) else nth x0 s (i - 1)` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["Ih"]) THEN (move ["i_lt"]))]) (((((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("shift_right", [shift_right]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("belast", [belast]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`i = 0`))) (disch_eq_tac "i_eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) (((((use_arg_then2 ("i_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("last_nth", [last_nth])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((fun arg_tac -> (use_arg_then2 ("num_CASES", [num_CASES])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN ((TRY done_tac)) THEN (case THEN (move ["m"])) THEN (move ["i_eq"])); + ((((use_arg_then2 ("i_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lastI", [lastI]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EQ_SYM_EQ", [EQ_SYM_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_rcons", [nth_rcons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_belast", [size_belast]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("i_eq", [])) (disch_tac [])) THEN (clear_assumption "i_eq") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma rot_rot_eq_rot *) +let rot_rot_eq_rot = Sections.section_proof ["s";"m";"n"] +`?k. rot m (rot n s) = rot k s` +[ + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`m <= sizel s`))) (disch_eq_tac "m_le" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + (((use_arg_then2 ("n", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("rot_oversize", [rot_oversize]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("m_le", [])) (disch_tac [])) THEN (clear_assumption "m_le") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`n <= sizel s`))) (disch_eq_tac "n_le" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + (((use_arg_then2 ("m", [])) (term_tac exists_tac)) THEN ((((fun arg_tac -> (use_arg_then2 ("rot_oversize", [rot_oversize])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("n_le", [])) (disch_tac [])) THEN (clear_assumption "n_le") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("rot_add_mod", [rot_add_mod]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`if _ then _1 else _2`))) (term_tac (set_tac "k"))); + (((use_arg_then2 ("k", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma index_rot *) +let index_rot = Sections.section_proof ["s";"n";"x"] +`uniq s /\ n < sizel s /\ MEM x s ==> + indexl x (rot n s) = if n <= indexl x s then (indexl x s - n) + else (indexl x s + sizel s - n)` +[ + (BETA_TAC THEN (case THEN (move ["uniq_s"])) THEN (case THEN (move ["n_lt"])) THEN (move ["mem_x"])); + ((((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("index_cat", [index_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("index_drop_uniq", [index_drop_uniq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("index_take", [index_take]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`indexl x s`))) (term_tac (set_tac "i"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`i < sizel s`))) (term_tac (have_gen_tac [](move ["i_lt"])))) ((((use_arg_then2 ("mem_x", [])) (disch_tac [])) THEN (clear_assumption "mem_x") THEN BETA_TAC) THEN ((((use_arg_then2 ("index_mem", [index_mem]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("i_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("n_lt", [])) (disch_tac [])) THEN (clear_assumption "n_lt") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma rotr1_eq_cons *) +let rotr1_eq_cons = Sections.section_proof ["h";"t"] +`rotr 1 (h :: t) = last h t :: belast h t` +[ + (((((use_arg_then2 ("lastI", [lastI]))(thm_tac (new_rewrite [1] [])))) THEN (((use_arg_then2 ("rotr1_rcons", [rotr1_rcons]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section MoreRot *) +let rot_nil = Sections.finalize_theorem rot_nil;; +let rotr_nil = Sections.finalize_theorem rotr_nil;; +let perm_eq_rot = Sections.finalize_theorem perm_eq_rot;; +let nth_rot = Sections.finalize_theorem nth_rot;; +let rot_to_index_explicit = Sections.finalize_theorem rot_to_index_explicit;; +let rot_to_index = Sections.finalize_theorem rot_to_index;; +let shift_right = Sections.finalize_theorem shift_right;; +let nth_shift_left = Sections.finalize_theorem nth_shift_left;; +let nth_shift_right = Sections.finalize_theorem nth_shift_right;; +let rot_rot_eq_rot = Sections.finalize_theorem rot_rot_eq_rot;; +let index_rot = Sections.finalize_theorem index_rot;; +let rotr1_eq_cons = Sections.finalize_theorem rotr1_eq_cons;; +Sections.end_section "MoreRot";; + +(* Section NextPrev *) +Sections.begin_section "NextPrev";; + +(* Lemma next_el_outside *) +let next_el_outside = Sections.section_proof ["s";"x"] +`~(MEM x s) ==> next_el s x = x` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("index_eq_size", [index_eq_size]))(thm_tac (new_rewrite [] []))))) THEN (move ["i_eq"])); + ((((use_arg_then2 ("next_el", [next_el]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_eq", []))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]))]) (((((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sub0n", [sub0n]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("head", [head]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `!n. ~(SUC n = SUC n - 1)`)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((repeat_tactic 1 9 (((use_arg_then2 ("nth_default", [nth_default]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma prev_el_outside *) +let prev_el_outside = Sections.section_proof ["s";"x"] +`~(MEM x s) ==> prev_el s x = x` +[ + (((((use_arg_then2 ("prev_el", [prev_el]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma next_el_rot *) +let next_el_rot = Sections.section_proof ["x";"s"] +`MEM x s ==> + next_el s x = headl x (rot (indexl x s + 1) s)` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["x_list"]))]) ((((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("next_el", [next_el]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`indexl x _ = _2`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot_oversize", [rot_oversize]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth0", [nth0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_cat", [nth_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subn_gt0", [subn_gt0]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("LT_LE", [LT_LE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addn1", [addn1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltE", [ltE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x_list", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqSS", [eqSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((((use_arg_then2 ("nth_drop", [nth_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addn0", [addn0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma prev_el_rot *) +let prev_el_rot = Sections.section_proof ["x";"s"] +`MEM x s ==> + prev_el s x = headl x (rotr 1 (rot (indexl x s) s))` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["x_list"]))]) ((((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("prev_el", [prev_el]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x_list", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`indexl x _ = _2`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot0", [rot0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lastI", [lastI]))(thm_tac (new_rewrite [2] [])))) THEN (((use_arg_then2 ("rotr1_rcons", [rotr1_rcons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("head", [head]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("last", [last]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("rot_add_mod", [rot_add_mod]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("leq_pred", [leq_pred]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq_eqVlt", [leq_eqVlt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`indexl x (CONS h t) = 1`))) (disch_eq_tac "eq2" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((((use_arg_then2 ("eq2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subnn", [subnn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth0", [nth0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addn1", [addn1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("rot_oversize", [rot_oversize]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leqnn", [leqnn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`SUC (sizel t) < sizel t + indexl x (CONS h t)`))) (term_tac (have_gen_tac [](move ["neq"])))) ((((use_arg_then2 ("eq2", [])) (disch_tac [])) THEN (clear_assumption "eq2") THEN ((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("leqNgt", [leqNgt]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("neq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("rot", [rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth0", [nth0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_cat", [nth_cat]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subn_gt0", [subn_gt0]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`(sizel t + indexl x (CONS h t)) - SUC (sizel t) < sizel (CONS h t)`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))))); + ((((use_arg_then2 ("eq2", [])) (disch_tac [])) THEN (clear_assumption "eq2") THEN ((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN ((use_arg_then2 ("x_list", [])) (disch_tac [])) THEN (clear_assumption "x_list") THEN BETA_TAC) THEN ((((use_arg_then2 ("index_mem", [index_mem]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("nth_drop", [nth_drop]))(thm_tac (new_rewrite [] [])))) THEN ((congr_tac (`nth x _1 _2`)) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma next_el_alt *) +let next_el_alt = Sections.section_proof ["x0";"x";"s"] +`MEM x s ==> next_el s x = nth x0 (rot 1 s) (indexl x s)` +[ + ((BETA_TAC THEN (move ["xs"])) THEN ((((use_arg_then2 ("next_el", [next_el]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("nth_shift_left", [nth_shift_left])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("nth0", [nth0]))(gsym_then (thm_tac (new_rewrite [] []))))))); + ((((fun arg_tac -> arg_tac (Arg_term (`indexl x s = _`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN ((use_arg_then2 ("set_nth_default", [set_nth_default])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN ((use_arg_then2 ("xs", [])) (disch_tac [])) THEN (clear_assumption "xs") THEN BETA_TAC) THEN (((use_arg_then2 ("index_mem", [index_mem]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma prev_el_alt *) +let prev_el_alt = Sections.section_proof ["x0";"x";"s"] +`MEM x s ==> prev_el s x = nth x0 (rotr 1 s) (indexl x s)` +[ + ((BETA_TAC THEN (move ["xs"])) THEN ((((use_arg_then2 ("prev_el", [prev_el]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xs", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((fun arg_tac -> (use_arg_then2 ("nth_shift_right", [nth_shift_right])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("nth_last", [nth_last]))(gsym_then (thm_tac (new_rewrite [] []))))))); + ((((fun arg_tac -> arg_tac (Arg_term (`indexl x s = _`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN ((use_arg_then2 ("set_nth_default", [set_nth_default])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN ((use_arg_then2 ("xs", [])) (disch_tac [])) THEN (clear_assumption "xs") THEN BETA_TAC) THEN (((use_arg_then2 ("index_mem", [index_mem]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma mem_next_el *) +let mem_next_el = Sections.section_proof ["x";"s"] +`MEM x s ==> MEM (next_el s x) s` +[ + ((BETA_TAC THEN (move ["xs"])) THEN ((((fun arg_tac -> (use_arg_then2 ("next_el_alt", [next_el_alt])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`HD s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mem_rot", [mem_rot])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_nth", [mem_nth]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma mem_prev_el *) +let mem_prev_el = Sections.section_proof ["x";"s"] +`MEM x s ==> MEM (prev_el s x) s` +[ + ((BETA_TAC THEN (move ["xs"])) THEN ((((fun arg_tac -> (use_arg_then2 ("prev_el_alt", [prev_el_alt])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`HD s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("mem_rotr", [mem_rotr])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_nth", [mem_nth]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_rotr", [size_rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma prev_next_id *) +let prev_next_id = Sections.section_proof ["x";"s"] +`uniq s ==> prev_el s (next_el s x) = x` +[ + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`MEM x s`))) (disch_eq_tac "xs" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) (((((use_arg_then2 ("next_el_outside", [next_el_outside]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("prev_el_outside", [prev_el_outside]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (BETA_TAC THEN (move ["uniq_s"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`0 < sizel s`))) (term_tac (have_gen_tac [](move ["size_gt"])))) (((((use_arg_then2 ("has_predT", [has_predT]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hasP", [hasP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("predT", [predT]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("prev_el_alt", [prev_el_alt])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`HD s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mem_next_el", [mem_next_el]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("next_el_alt", [next_el_alt])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`HD s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("nth_shift_left", [nth_shift_left]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`indexl x s = sizel s - 1`))) (disch_eq_tac "eq1" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((((use_arg_then2 ("nth_shift_right", [nth_shift_right]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("index_uniq", [index_uniq]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("eq1", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_index", [nth_index]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("nth_shift_right", [nth_shift_right]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("index_uniq", [index_uniq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uniq_s", []))(thm_tac (new_rewrite [] [])))))) THEN (TRY (((((use_arg_then2 ("xs", [])) (disch_tac [])) THEN (clear_assumption "xs") THEN ((use_arg_then2 ("eq1", [])) (disch_tac [])) THEN (clear_assumption "eq1") THEN BETA_TAC) THEN (((use_arg_then2 ("index_mem", [index_mem]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (arith_tac))))); + (((((use_arg_then2 ("addn1", [addn1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eqS0", [eqS0]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_index", [nth_index]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma next_prev_id *) +let next_prev_id = Sections.section_proof ["x";"s"] +`uniq s ==> next_el s (prev_el s x) = x` +[ + ((THENL_LAST) (((fun arg_tac -> arg_tac (Arg_term (`MEM x s`))) (disch_eq_tac "xs" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) (((((use_arg_then2 ("prev_el_outside", [prev_el_outside]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("next_el_outside", [next_el_outside]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((BETA_TAC THEN (move ["uniq_s"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`HD s`))) (term_tac (set_tac "x0")))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`0 < sizel s`))) (term_tac (have_gen_tac [](move ["size_gt"])))) (((((use_arg_then2 ("has_predT", [has_predT]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("hasP", [hasP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("predT", [predT]))(thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("x", [])) (term_tac exists_tac)) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("next_el_alt", [next_el_alt])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mem_prev_el", [mem_prev_el]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("prev_el_alt", [prev_el_alt])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("nth_shift_right", [nth_shift_right]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((fun arg_tac -> arg_tac (Arg_term (`indexl x s = 0`))) (disch_eq_tac "eq1" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((((use_arg_then2 ("nth_shift_left", [nth_shift_left]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("index_uniq", [index_uniq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uniq_s", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (TRY (((((use_arg_then2 ("size_gt", [])) (disch_tac [])) THEN (clear_assumption "size_gt") THEN BETA_TAC) THEN (arith_tac))))); + (((((use_arg_then2 ("eq1", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_index", [nth_index]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("nth_shift_left", [nth_shift_left]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("index_uniq", [index_uniq]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("uniq_s", []))(thm_tac (new_rewrite [] [])))))) THEN (TRY (((((use_arg_then2 ("xs", [])) (disch_tac [])) THEN (clear_assumption "xs") THEN ((use_arg_then2 ("eq1", [])) (disch_tac [])) THEN (clear_assumption "eq1") THEN BETA_TAC) THEN (((use_arg_then2 ("index_mem", [index_mem]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (arith_tac))))); + ((fun arg_tac -> arg_tac (Arg_term (`~(indexl x s - 1 = sizel s - 1)`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))))); + ((((use_arg_then2 ("xs", [])) (disch_tac [])) THEN (clear_assumption "xs") THEN ((use_arg_then2 ("eq1", [])) (disch_tac [])) THEN (clear_assumption "eq1") THEN BETA_TAC) THEN (((use_arg_then2 ("index_mem", [index_mem]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then2 ("subnK", [subnK]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("nth_index", [nth_index]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("eq1", [])) (disch_tac [])) THEN (clear_assumption "eq1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma next_el_mod *) +let next_el_mod = Sections.section_proof ["x0";"s";"x"] +`MEM x s + ==> next_el s x = nth x0 s ((indexl x s + 1) MOD sizel s)` +[ + ((BETA_TAC THEN (move ["xs"])) THEN ((((use_arg_then2 ("next_el", [next_el]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth0", [nth0]))(gsym_then (thm_tac (new_rewrite [] []))))))); + ((fun arg_tac -> arg_tac (Arg_term (`sizel s`))) (term_tac (set_tac "n"))); + ((fun arg_tac -> arg_tac (Arg_term (`1 <= n /\ ~(n = 0)`))) (term_tac (have_gen_tac [](case THEN ((move ["ge1"]) THEN (move ["neq0"])))))); + ((((use_arg_then2 ("xs", [])) (disch_tac [])) THEN (clear_assumption "xs") THEN BETA_TAC) THEN (((((use_arg_then2 ("MEM_EXISTS_EL", [MEM_EXISTS_EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["i"]))) THEN (arith_tac) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`indexl x s = _`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("subnK", [subnK]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("muln1", [muln1])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("MOD_MULT", [MOD_MULT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((use_arg_then2 ("set_nth_default", [set_nth_default])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("lt0n", [lt0n]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`indexl x s + 1 < n`))) (term_tac (have_gen_tac [](move ["lt"])))); + ((((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN ((use_arg_then2 ("xs", [])) (disch_tac [])) THEN (clear_assumption "xs") THEN BETA_TAC) THEN ((((use_arg_then2 ("index_mem", [index_mem]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + (((((use_arg_then2 ("MOD_LT", [MOD_LT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN ((use_arg_then2 ("set_nth_default", [set_nth_default])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma next_el_power *) +let next_el_power = Sections.section_proof ["x0";"s";"x";"i"] +`uniq s /\ MEM x s + ==> (next_el s POWER i) x = nth x0 s ((indexl x s + i) MOD (sizel s))` +[ + (BETA_TAC THEN (case THEN ((move ["uniq_s"]) THEN (move ["mem_x"])))); + ((fun arg_tac -> arg_tac (Arg_term (`sizel s`))) (term_tac (set_tac "n"))); + ((fun arg_tac -> arg_tac (Arg_term (`indexl x s`))) (term_tac (set_tac "k"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`k < n:num`))) (term_tac (have_gen_tac [](move ["k_lt"])))) (((((use_arg_then2 ("k_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((THENL) (((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN elim) [ALL_TAC; ((move ["i"]) THEN (move ["Ih"]))]); + (((((use_arg_then2 ("Hypermap.POWER_0", [Hypermap.POWER_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("addn0", [addn0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MOD_LT", [MOD_LT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("k_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_index", [nth_index]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`~(n = 0)`))) (term_tac (have_gen_tac [](move ["neq0"])))); + ((((use_arg_then2 ("mem_x", [])) (disch_tac [])) THEN (clear_assumption "mem_x") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("n_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_eq0", [size_eq0]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((use_arg_then2 ("Hypermap.COM_POWER", [Hypermap.COM_POWER]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Ih", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("next_el_mod", [next_el_mod]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("mem_nth", [mem_nth]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIVISION", [DIVISION]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("index_uniq", [index_uniq])) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIVISION", [DIVISION]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + (congr_tac (`nth x0 s _`)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`k + SUC i = (k + i) + 1`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("MOD_ADD_MOD", [MOD_ADD_MOD])) (fun fst_arg -> (use_arg_then2 ("neq0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`k + i:num`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`n = 1`))) (disch_eq_tac "eq1" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) (((((use_arg_then2 ("eq1", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("MOD_1", [MOD_1]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("MOD_LT", [MOD_LT])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (((use_arg_then2 ("neq0", [])) (disch_tac [])) THEN (clear_assumption "neq0") THEN ((use_arg_then2 ("eq1", [])) (disch_tac [])) THEN (clear_assumption "eq1") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma next_el_orbit *) +let next_el_orbit = Sections.section_proof ["s";"x"] +`uniq s /\ MEM x s + ==> orbit_map (next_el s) x = set_of_list s` +[ + (BETA_TAC THEN (case THEN ((move ["uniq_s"]) THEN (move ["mem_x"])))); + ((fun arg_tac -> arg_tac (Arg_term (`sizel s`))) (term_tac (set_tac "n"))); + ((fun arg_tac -> arg_tac (Arg_term (`HD s`))) (term_tac (set_tac "x0"))); + ((fun arg_tac -> arg_tac (Arg_term (`~(n = 0)`))) (term_tac (have_gen_tac [](move ["neq0"])))); + ((((use_arg_then2 ("mem_x", [])) (disch_tac [])) THEN (clear_assumption "mem_x") THEN ((use_arg_then2 ("contraL", [contraL])) (disch_tac [])) THEN (clear_assumption "contraL") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("n_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_eq0", [size_eq0]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((use_arg_then2 ("Hypermap.orbit_map", [Hypermap.orbit_map]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("EXTENSION", [EXTENSION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["d"])); + ((THENL) (split_tac) [((case THEN (move ["i"])) THEN (case THEN (move ["i_ge0"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); (move ["mem_d"])]); + (((((fun arg_tac -> (use_arg_then2 ("next_el_power", [next_el_power])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mem_nth", [mem_nth]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIVISION", [DIVISION]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`indexl x s`))) (term_tac (set_tac "k"))); + ((fun arg_tac -> arg_tac (Arg_term (`indexl d s`))) (term_tac (set_tac "i"))); + ((fun arg_tac -> arg_tac (Arg_term (`k < n /\ i < n:num`))) (term_tac (have_gen_tac [](case THEN ((move ["k_lt"]) THEN (move ["i_lt"])))))); + (((((use_arg_then2 ("n_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("k_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("i_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`n - k + i:num`))) (term_tac exists_tac)); + ((((use_arg_then2 ("GE", [GE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LE_0", [LE_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("next_el_power", [next_el_power])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("k_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`k + n - k + i = n + i:num`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("mul1n", [mul1n])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("MOD_MULT_ADD", [MOD_MULT_ADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MOD_LT", [MOD_LT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("i_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("nth_index", [nth_index]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma next_el_rot_eq *) +let next_el_rot_eq = Sections.section_proof ["s";"n"] +`uniq s ==> next_el (rot n s) = next_el s` +[ + ((BETA_TAC THEN (move ["uniq_s"])) THEN ((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (move ["x"]))); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`n < sizel s`))) (disch_eq_tac "n_lt" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + (((((use_arg_then2 ("rot_oversize", [rot_oversize]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("NOT_LT", [NOT_LT]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`MEM x s`))) (disch_eq_tac "mem_x" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("next_el_outside", [next_el_outside]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("mem_rot", [mem_rot]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`MEM x (rot n s)`))) (term_tac (have_gen_tac [](move ["mem_rot"])))) ((((use_arg_then2 ("mem_rot", [mem_rot]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("next_el_rot", [next_el_rot]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth0", [nth0]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("index_rot", [index_rot]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`indexl x s`))) (term_tac (set_tac "i"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`i < sizel s`))) (term_tac (have_gen_tac [](move ["i_lt"])))) ((((use_arg_then2 ("mem_x", [])) (disch_tac [])) THEN (clear_assumption "mem_x") THEN BETA_TAC) THEN (((use_arg_then2 ("index_mem", [index_mem]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`0 < sizel s`))) (term_tac (have_gen_tac [](move ["size_gt0"])))); + (((THENL) (((use_arg_then2 ("mem_x", [])) (disch_tac [])) THEN (clear_assumption "mem_x") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]))]) THEN ((((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("gtS0", [gtS0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`i + 1 <= sizel s /\ n <= sizel s /\ i - n + 1 <= sizel s /\ ~(0 = sizel s)`))) (term_tac (have_gen_tac [](move ["ineqs"])))); + ((((use_arg_then2 ("n_lt", [])) (disch_tac [])) THEN (clear_assumption "n_lt") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`n:num <= _`))) (disch_eq_tac "n_le" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("nth_rot", [nth_rot]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("addn0", [addn0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIVISION", [DIVISION]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("MOD_LT", [MOD_LT])) (fun fst_arg -> (use_arg_then2 ("n_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("MOD_ADD_MOD", [MOD_ADD_MOD]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + (((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`n + i - n + 1 = i + 1`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("n_le", [])) (disch_tac [])) THEN (clear_assumption "n_le") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`(i + sizel s - n) + 1 <= sizel s`))) (term_tac (have_gen_tac [](move ["ineq2"])))) ((((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN ((use_arg_then2 ("n_le", [])) (disch_tac [])) THEN (clear_assumption "n_le") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("nth_rot", [nth_rot]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_rot", [size_rot]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIVISION", [DIVISION]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("addn0", [addn0]))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("MOD_LT", [MOD_LT])) (fun fst_arg -> (use_arg_then2 ("n_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("MOD_ADD_MOD", [MOD_ADD_MOD]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`n + (i + sizel s - n) + 1 = 1 * sizel s + (i + 1)`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("n_lt", [])) (disch_tac [])) THEN (clear_assumption "n_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("MOD_MULT_ADD", [MOD_MULT_ADD]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma next_el_inj *) +let next_el_inj = Sections.section_proof ["s";"x";"y"] +`uniq s ==> (next_el s x = next_el s y <=> x = y)` +[ + ((BETA_TAC THEN (move ["uniq_s"])) THEN ((THENL) (split_tac) [ALL_TAC; ((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))])); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`MEM x s`))) (disch_eq_tac "mem_x" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + (((((use_arg_then2 ("next_el_outside", [next_el_outside]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (move ["x_eq"])); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`~MEM y s`))) (term_tac (have_gen_tac [](move ["mem_y"]))))) ((((use_arg_then2 ("x_eq", [])) (disch_tac [])) THEN (clear_assumption "x_eq") THEN BETA_TAC) THEN (((use_arg_then2 ("next_el_outside", [next_el_outside]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("mem_x", [])) (disch_tac [])) THEN (clear_assumption "mem_x") THEN ((use_arg_then2 ("contra", [contra])) (disch_tac [])) THEN (clear_assumption "contra") THEN (DISCH_THEN apply_tac) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("mem_next_el", [mem_next_el])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("x_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`MEM y s`))) (disch_eq_tac "mem_y" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + ((((fun arg_tac -> (use_arg_then2 ("next_el_outside", [next_el_outside])) (fun fst_arg -> (use_arg_then2 ("mem_y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (move ["y_eq"])); + ((((fun arg_tac -> (use_arg_then2 ("mem_next_el", [mem_next_el])) (fun fst_arg -> (use_arg_then2 ("mem_x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("mem_y", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("congr1", [congr1])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`prev_el s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (repeat_tactic 1 9 (((use_arg_then2 ("prev_next_id", [prev_next_id]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma prev_el_rot_eq *) +let prev_el_rot_eq = Sections.section_proof ["s";"n"] +`uniq s ==> prev_el (rot n s) = prev_el s` +[ + ((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (move ["uniq_s"]) THEN (move ["x"])); + (((((fun arg_tac -> (use_arg_then2 ("next_el_inj", [next_el_inj])) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("next_el_rot_eq", [next_el_rot_eq])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("next_prev_id", [next_prev_id]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("rot_uniq", [rot_uniq]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma prev_el_inj *) +let prev_el_inj = Sections.section_proof ["s";"x";"y"] +`uniq s ==> (prev_el s x = prev_el s y <=> x = y)` +[ + ((BETA_TAC THEN (move ["uniq_s"])) THEN (((THENL) (split_tac) [ALL_TAC; (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))]) THEN ((TRY done_tac)))); + (((((fun arg_tac -> (use_arg_then2 ("next_el_inj", [next_el_inj])) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("next_prev_id", [next_prev_id]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma next_el_permutes *) +let next_el_permutes = Sections.section_proof ["s"] +`uniq s ==> (next_el s) permutes (set_of_list s)` +[ + ((((((use_arg_then2 ("permutes", [permutes]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] []))))) THEN (move ["uniq_s"])) THEN ((THENL) (split_tac) [(move ["x"]); (move ["y"])])); + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("next_el_outside", [next_el_outside])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (done_tac)); + ((((use_arg_then2 ("EXISTS_UNIQUE_ALT", [EXISTS_UNIQUE_ALT]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_term (`prev_el s y`))) (term_tac exists_tac)) THEN (move ["z"]))); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("prev_el_inj", [prev_el_inj])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`next_el s z`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("prev_next_id", [prev_next_id]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (use_arg_then2 ("z", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma inverse_next_el *) +let inverse_next_el = Sections.section_proof ["s"] +`uniq s ==> inverse (next_el s) = prev_el s` +[ + ((((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (move ["uniq_s"]) THEN (move ["x"])); + (((((fun arg_tac -> (use_arg_then2 ("PERMUTES_INVERSE_EQ", [PERMUTES_INVERSE_EQ])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("next_el_permutes", [next_el_permutes])) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("next_prev_id", [next_prev_id]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma prev_el_permutes *) +let prev_el_permutes = Sections.section_proof ["s"] +`uniq s ==> (prev_el s) permutes (set_of_list s)` +[ + ((BETA_TAC THEN (move ["uniq_s"])) THEN ((((use_arg_then2 ("inverse_next_el", [inverse_next_el]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("PERMUTES_INVERSE", [PERMUTES_INVERSE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("next_el_permutes", [next_el_permutes]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma inverse_prev_el *) +let inverse_prev_el = Sections.section_proof ["s"] +`uniq s ==> inverse (prev_el s) = next_el s` +[ + ((BETA_TAC THEN (move ["uniq_s"])) THEN ((((use_arg_then2 ("inverse_next_el", [inverse_next_el]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL PERMUTES_INVERSE_INVERSE))) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("next_el_permutes", [next_el_permutes])) (fun fst_arg -> (use_arg_then2 ("uniq_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma next_el_rotr_eq *) +let next_el_rotr_eq = Sections.section_proof ["s";"n"] +`uniq s ==> next_el (rotr n s) = next_el s` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("next_el_rot_eq", [next_el_rot_eq])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["eq"])) THEN ((((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma prev_el_rotr_eq *) +let prev_el_rotr_eq = Sections.section_proof ["s";"n"] +`uniq s ==> prev_el (rotr n s) = prev_el s` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("prev_el_rot_eq", [prev_el_rot_eq])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (move ["eq"])) THEN ((((use_arg_then2 ("rotr", [rotr]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma next_el_hd_cons2 *) +let next_el_hd_cons2 = Sections.section_proof ["h1";"h2";"t"] +`next_el (h1 :: (h2 :: t)) h1 = h2` +[ + ((((use_arg_then2 ("next_el", [next_el]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Seq.index_head", [Seq.index_head]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`0 = _`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("eq", [])) (disch_tac [])) THEN (clear_assumption "eq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("addn1", [addn1]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma next_el_hd_cons *) +let next_el_hd_cons = Sections.section_proof ["h";"t"] +`0 < sizel t ==> next_el (h :: t) h = HD t` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN case) [ALL_TAC; ((move ["h2"]) THEN (move ["t"]))]) (((((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("next_el_hd_cons2", [next_el_hd_cons2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HD", [HD]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma next_el_hd_belast *) +let next_el_hd_belast = Sections.section_proof ["h";"t"] +`1 < sizel t ==> next_el (belast h t) h = HD t` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN case) [ALL_TAC; ((move ["h2"]) THEN (move ["t"]))]) (((((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("belast", [belast]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HD", [HD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ONE", [ONE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN case) [ALL_TAC; ((move ["h3"]) THEN (move ["t"]))]) (((((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("belast", [belast]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("next_el_hd_cons2", [next_el_hd_cons2]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma next_el_last *) +let next_el_last = Sections.section_proof ["x0";"s"] +`0 < sizel s /\ uniq s ==> next_el s (last x0 s) = HD s` +[ + ((THENL_FIRST) ((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (case THEN (move ["_"])) THEN (move ["uniq_s"]))]) (((((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + (((((use_arg_then2 ("next_el", [next_el]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("last", [last]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("index_last", [index_last]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_cons", [size_cons]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("succnK", [succnK]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("head", [head]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("HD", [HD]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma prev_el_hd *) +let prev_el_hd = Sections.section_proof ["x0";"s"] +`0 < sizel s ==> prev_el s (HD s) = last x0 s` +[ + (((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN case) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["_"]))]) THEN ((repeat_tactic 0 10 (((use_arg_then2 ("size_nil", [size_nil]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("HD", [HD]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("prev_el", [prev_el]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("Seq.index_head", [Seq.index_head]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("last", [last]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section NextPrev *) +let next_el_outside = Sections.finalize_theorem next_el_outside;; +let prev_el_outside = Sections.finalize_theorem prev_el_outside;; +let next_el_rot = Sections.finalize_theorem next_el_rot;; +let prev_el_rot = Sections.finalize_theorem prev_el_rot;; +let next_el_alt = Sections.finalize_theorem next_el_alt;; +let prev_el_alt = Sections.finalize_theorem prev_el_alt;; +let mem_next_el = Sections.finalize_theorem mem_next_el;; +let mem_prev_el = Sections.finalize_theorem mem_prev_el;; +let prev_next_id = Sections.finalize_theorem prev_next_id;; +let next_prev_id = Sections.finalize_theorem next_prev_id;; +let next_el_mod = Sections.finalize_theorem next_el_mod;; +let next_el_power = Sections.finalize_theorem next_el_power;; +let next_el_orbit = Sections.finalize_theorem next_el_orbit;; +let next_el_rot_eq = Sections.finalize_theorem next_el_rot_eq;; +let next_el_inj = Sections.finalize_theorem next_el_inj;; +let prev_el_rot_eq = Sections.finalize_theorem prev_el_rot_eq;; +let prev_el_inj = Sections.finalize_theorem prev_el_inj;; +let next_el_permutes = Sections.finalize_theorem next_el_permutes;; +let inverse_next_el = Sections.finalize_theorem inverse_next_el;; +let prev_el_permutes = Sections.finalize_theorem prev_el_permutes;; +let inverse_prev_el = Sections.finalize_theorem inverse_prev_el;; +let next_el_rotr_eq = Sections.finalize_theorem next_el_rotr_eq;; +let prev_el_rotr_eq = Sections.finalize_theorem prev_el_rotr_eq;; +let next_el_hd_cons2 = Sections.finalize_theorem next_el_hd_cons2;; +let next_el_hd_cons = Sections.finalize_theorem next_el_hd_cons;; +let next_el_hd_belast = Sections.finalize_theorem next_el_hd_belast;; +let next_el_last = Sections.finalize_theorem next_el_last;; +let prev_el_hd = Sections.finalize_theorem prev_el_hd;; +Sections.end_section "NextPrev";; + +(* Close the module *) +end;; diff --git a/text_formalization/tame/ssreflect/sort-compiled.hl b/text_formalization/tame/ssreflect/sort-compiled.hl new file mode 100644 index 0000000..5404281 --- /dev/null +++ b/text_formalization/tame/ssreflect/sort-compiled.hl @@ -0,0 +1,646 @@ +needs "tame/ssreflect/seq2-compiled.hl";; + +(* Module Sort*) +module Sort = struct + +open Ssrbool;; +open Ssrnat;; +open Seq;; +open Seq2;; +let general_rec_exists_tac g = ((apply_tac o DISCH_ALL o prove_general_recursive_function_exists o snd) g) g;; +let ordered = (GEN_ALL o define) `(ordered R [] <=> T) /\ + (ordered R (h :: t) <=> ordered R t /\ all (R h) t)`;; +let sorted = new_definition `sorted R s s0 <=> ordered R s /\ perm_eq s s0`;; +let merge = (GEN_ALL o define) `merge R [] s2 = s2 /\ merge R s1 [] = s1 /\ + merge R (CONS h1 t1) (CONS h2 t2) = + if (R h1 h2) then CONS h1 (merge R t1 (CONS h2 t2)) else CONS h2 (merge R (CONS h1 t1) t2)`;; + +(* Lemma merge_ineqs *) +let merge_ineqs = Sections.section_proof ["s"] +`~(LENGTH s <= 1) ==> LENGTH (take (LENGTH s DIV 2) s) < LENGTH s /\ + LENGTH (dropl (LENGTH s DIV 2) s) < LENGTH s` +[ + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(2 = 0)`))) (term_tac (have_gen_tac [](move ["n20"])))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> arg_tac (Arg_term (`sizel s`))) (term_tac (set_tac "n")))); + (((((use_arg_then2 ("size_take", [size_take]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_drop", [size_drop]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma merge_sort_exists *) +let merge_sort_exists = Sections.section_proof [] +`?f. !R s. f R s = if LENGTH s <= 1 then s else + merge R (f R (take (LENGTH s DIV 2) s)) (f R (dropl (LENGTH s DIV 2) s))` +[ + (general_rec_exists_tac); + ((fun arg_tac -> arg_tac (Arg_term (`MEASURE (LENGTH o SND)`))) (term_tac exists_tac)); + (((((use_arg_then2 ("WF_MEASURE", [WF_MEASURE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("MEASURE", [MEASURE]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN ((split_tac) THEN (move ["s"]) THEN (move ["ineq"])) THEN (((use_arg_then2 ("merge_ineqs", [merge_ineqs]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; +let merge_sort = new_specification ["merge_sort"] merge_sort_exists;; +let min_k = new_definition `min_k k (l:(real)list) = EL k (merge_sort (<=) l)`;; + +(* Section Merge *) +Sections.begin_section "Merge";; + +(* Lemma perm_eq_merge *) +let perm_eq_merge = Sections.section_proof ["R";"s1";"s2"] +`perm_eq (merge R s1 s2) (s1 ++ s2)` +[ + (((((use_arg_then2 ("perm_eqP", [perm_eqP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("count_cat", [count_cat]))(thm_tac (new_rewrite [] []))))) THEN (move ["P"])); + (((THENL) (((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["h1"]) THEN (move ["t1"]) THEN (move ["IH1"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["h2"]) THEN (move ["t2"]) THEN (move ["IH2"]))]) THEN ((((use_arg_then2 ("merge", [merge]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("count", [count]))(thm_tac (new_rewrite [] [])))))) THEN (TRY ((arith_tac)))); + ((((fun arg_tac -> arg_tac (Arg_term (`R h1 h2`))) (disch_tac [])) THEN case THEN (simp_tac)) THEN ((((use_arg_then2 ("count", [count]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac ->(use_arg_then2 ("IH1", []))(fun tmp_arg1 -> (use_arg_then2 ("IH2", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("count", [count]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma all_merge *) +let all_merge = Sections.section_proof ["R";"s1";"s2";"P"] +`all P (merge R s1 s2) <=> all P s1 /\ all P s2` +[ + (((THENL) (((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["h1"]) THEN (move ["t1"]) THEN (move ["IH1"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["h2"]) THEN (move ["t2"]) THEN (move ["IH2"]))]) THEN ((((use_arg_then2 ("merge", [merge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("all", [all]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((((fun arg_tac -> arg_tac (Arg_term (`R h1 h2`))) (disch_tac [])) THEN case THEN (simp_tac)) THEN ((((use_arg_then2 ("all", [all]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac ->(use_arg_then2 ("IH1", []))(fun tmp_arg1 -> (use_arg_then2 ("IH2", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("all", [all]))(thm_tac (new_rewrite [] [])))))) THEN (REWRITE_TAC[CONJ_ACI]) THEN (done_tac)); +];; + +(* Finalization of the section Merge *) +let perm_eq_merge = Sections.finalize_theorem perm_eq_merge;; +let all_merge = Sections.finalize_theorem all_merge;; +Sections.end_section "Merge";; + +(* Section Ordered *) +Sections.begin_section "Ordered";; +(Sections.add_section_var (mk_var ("x0", (`:A`))));; +(Sections.add_section_var (mk_var ("R", (`:A->A->bool`))));; + +(* Lemma ordered1 *) +let ordered1 = Sections.section_proof ["x"] +`ordered R [x]` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("ordered", [ordered]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("all", [all]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ordered_cat *) +let ordered_cat = Sections.section_proof ["s1";"s2"] +`ordered R (s1 ++ s2) <=> + ordered R s1 /\ ordered R s2 /\ all (\x. all (R x) s2) s1` +[ + (((THENL) (((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN ((((use_arg_then2 ("cat", [cat]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ordered", [ordered]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("all", [all]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("IH", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("all_cat", [all_cat]))(thm_tac (new_rewrite [] [])))))); + ((REWRITE_TAC[CONJ_ACI]) THEN (done_tac)); +];; + +(* Lemma ordered_nthP *) +let ordered_nthP = Sections.section_proof ["s"] +`ordered R s <=> (!i j. i < j /\ j < sizel s ==> R (nth x0 s i) (nth x0 s j))` +[ + ((split_tac) THEN ((THENL) (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN ((((use_arg_then2 ("ordered", [ordered]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LENGTH", [LENGTH]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))))); + ((THENL_LAST) ((BETA_TAC THEN (case THEN ((move ["ord"]) THEN (move ["all_t"]))) THEN ((THENL) case [ALL_TAC; (move ["i"])]) THEN ((THENL) case [ALL_TAC; (move ["j"])])) THEN (TRY ((arith_tac))) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))))) THEN (move ["ineqs"]))) ((((use_arg_then2 ("IH", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("all_t", [])) (disch_tac [])) THEN (clear_assumption "all_t") THEN BETA_TAC) THEN (((fun arg_tac -> (use_arg_then2 ("all_nthP", [all_nthP])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (exact_tac) THEN (done_tac)); + ((BETA_TAC THEN (move ["cond"])) THEN (split_tac)); + (((use_arg_then2 ("IH", [])) (disch_tac [])) THEN (clear_assumption "IH") THEN (DISCH_THEN apply_tac) THEN (move ["i"]) THEN (move ["j"]) THEN (move ["ineqs"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("cond", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SUC i`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SUC j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ineqs", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))))) THEN (exact_tac) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("all_nthP", [all_nthP])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (move ["j"]) THEN (move ["j_lt"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("cond", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`SUC j`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("gtS0", [gtS0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("j_lt", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))))) THEN (exact_tac)); +];; + +(* Lemma ordered_nseq *) +let ordered_nseq = Sections.section_proof ["n";"x"] +`R x x ==> ordered R (nseq n x)` +[ + ((BETA_TAC THEN (move ["Rxx"])) THEN (((((use_arg_then2 ("ordered_nthP", [ordered_nthP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size_nseq", [size_nseq]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]) THEN (move ["j"]) THEN (case THEN (move ["i_lt_j"])) THEN (move ["j_lt"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("nth_nseq", [nth_nseq]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("j_lt", []))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`i < n:num`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((ALL_TAC) THEN (done_tac))); + ((((use_arg_then2 ("i_lt_j", [])) (disch_tac [])) THEN (clear_assumption "i_lt_j") THEN ((use_arg_then2 ("j_lt", [])) (disch_tac [])) THEN (clear_assumption "j_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma ordered_subseq *) +let ordered_subseq = Sections.section_proof ["s1";"s2"] +`subseq s1 s2 /\ ordered R s2 ==> ordered R s1` +[ + (((THENL) (((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["h1"]) THEN (move ["t1"]) THEN (move ["IH1"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["h2"]) THEN (move ["t2"]) THEN (move ["IH2"]))]) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ordered", [ordered]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL subseq)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)))); + ((THENL_ROT (-1)) ((((fun arg_tac -> arg_tac (Arg_term (`h1 = h2`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN (BETA_TAC THEN (case THEN (move ["sub"])) THEN (case THEN ((move ["ord2"]) THEN (move ["all2"])))))); + ((((use_arg_then2 ("IH2", [])) (disch_tac [])) THEN (clear_assumption "IH2") THEN BETA_TAC) THEN ((((use_arg_then2 ("ordered", [ordered]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sub", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ord2", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((fun arg_tac -> (use_arg_then2 ("IH1", [])) (fun fst_arg -> (use_arg_then2 ("sub", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["x"]) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("mem_subseq", [mem_subseq])) (fun fst_arg -> (use_arg_then2 ("sub", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["mem_x"])); + ((((use_arg_then2 ("all2", [])) (disch_tac [])) THEN (clear_assumption "all2") THEN BETA_TAC) THEN ((((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (exact_tac) THEN (done_tac)); +];; + +(* Lemma ordered_delete_at *) +let ordered_delete_at = Sections.section_proof ["i";"s"] +`ordered R s ==> ordered R (delete_at i s)` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("ordered_subseq", [ordered_subseq])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (DISCH_THEN apply_tac) THEN (((use_arg_then2 ("subseq_delete_at", [subseq_delete_at])) (disch_tac [])) THEN (clear_assumption "subseq_delete_at") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma ordered_delete1 *) +let ordered_delete1 = Sections.section_proof ["x";"s"] +`ordered R s ==> ordered R (delete1 x s)` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("ordered_subseq", [ordered_subseq])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (DISCH_THEN apply_tac) THEN (((use_arg_then2 ("subseq_delete1", [subseq_delete1])) (disch_tac [])) THEN (clear_assumption "subseq_delete1") THEN (exact_tac)) THEN (done_tac)); +];; + +(* Lemma ordered_filter *) +let ordered_filter = Sections.section_proof ["a";"s"] +`ordered R s ==> ordered R (filter a s)` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("ordered_subseq", [ordered_subseq])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (DISCH_THEN apply_tac) THEN (((use_arg_then2 ("filter_subseq", [filter_subseq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Section OrderedMergeGeneral *) +Sections.begin_section "OrderedMergeGeneral";; +(Sections.add_section_var (mk_var ("S", (`:A -> bool`))));; +(Sections.add_section_hyp "R_trans" (`!x y z. x IN S /\ y IN S /\ z IN S ==> R x y /\ R y z ==> R x z`));; +(Sections.add_section_hyp "R_total" (`!x y. x IN S /\ y IN S ==> R x y \/ R y x`));; + +(* Lemma ordered_merge_general *) +let ordered_merge_general = Sections.section_proof ["s1";"s2"] +`set_of_list s1 SUBSET S /\ set_of_list s2 SUBSET S ==> + ordered R s1 /\ ordered R s2 ==> ordered R (merge R s1 s2)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_SET_OF_LIST", [IN_SET_OF_LIST]))(thm_tac (new_rewrite [] [])))))); + (((THENL) (((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["h1"]) THEN (move ["t1"]) THEN (move ["IH1"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["h2"]) THEN (move ["t2"]) THEN (move ["IH2"]))]) THEN ((((use_arg_then2 ("merge", [merge]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("ordered", [ordered]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (BETA_TAC THEN (case THEN ((move ["s1S"]) THEN (move ["s2S"]))) THEN (case THEN ((case THEN ((move ["ord1"]) THEN (move ["all1"]))) THEN (case THEN ((move ["ord2"]) THEN (move ["all2"])))))); + ((fun arg_tac -> arg_tac (Arg_term (`(!x. x <- t2 ==> x IN S) /\ (!x. x <- t1 ==> x IN S)`))) (term_tac (have_gen_tac [](case THEN ((move ["t2S"]) THEN (move ["t1S"])))))); + ((((use_arg_then2 ("s1S", [])) (disch_tac [])) THEN (clear_assumption "s1S") THEN ((use_arg_then2 ("s2S", [])) (disch_tac [])) THEN (clear_assumption "s2S") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`h1 IN S /\ h2 IN S`))) (term_tac (have_gen_tac [](move ["hS"])))) ((((fun arg_tac -> (use_arg_then2 ("s2S", [])) (fun fst_arg -> (use_arg_then2 ("h2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then2 ("s1S", [])) (fun fst_arg -> (use_arg_then2 ("h1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (done_tac))); + ((((fun arg_tac -> arg_tac (Arg_term (`R h1 h2`))) (disch_eq_tac "h12" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN (((use_arg_then2 ("ordered", [ordered]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("IH1", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ordered", [ordered]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("all_merge", [all_merge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("all", [all]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("all1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h12", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("all2", [])) (disch_tac [])) THEN (clear_assumption "all2") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["all2"]) THEN (move ["x"]) THEN (move ["mem_x"]))); + (((((fun arg_tac -> (use_arg_then2 ("R_trans", [])) (fun fst_arg -> (use_arg_then2 ("h12", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("hS", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("all2", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("t2S", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("IH2", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ordered", [ordered]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("all_merge", [all_merge]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("all", [all]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("all2", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("R_total", [])) (fun fst_arg -> (use_arg_then2 ("h1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("h2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("hS", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("h12", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orFb", [orFb]))(thm_tac (new_rewrite [] []))))) THEN (move ["h21"])) THEN ((((use_arg_then2 ("h21", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("all1", [])) (disch_tac [])) THEN (clear_assumption "all1") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["all1"]) THEN (move ["x"]) THEN (move ["mem_x"]))); + (((((fun arg_tac -> (use_arg_then2 ("R_trans", [])) (fun fst_arg -> (use_arg_then2 ("h21", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("hS", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("all1", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("t1S", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section OrderedMergeGeneral *) +let ordered_merge_general = Sections.finalize_theorem ordered_merge_general;; +Sections.end_section "OrderedMergeGeneral";; +(Sections.add_section_hyp "R_asym" (`!x y. R x y /\ R y x ==> x = y`));; + +(* Lemma ordered_eq *) +let ordered_eq = Sections.section_proof ["s1";"s2"] +`perm_eq s1 s2 /\ ordered R s1 /\ ordered R s2 ==> s1 = s2` +[ + (((THENL) (((use_arg_then2 ("s2", [])) (disch_tac [])) THEN (clear_assumption "s2") THEN ((use_arg_then2 ("s1", [])) (disch_tac [])) THEN (clear_assumption "s1") THEN elim) [ALL_TAC; ((move ["h1"]) THEN (move ["t1"]) THEN (move ["IH1"]))]) THEN ((THENL) elim [ALL_TAC; ((move ["h2"]) THEN (move ["t2"]) THEN (move ["IH2"]))]) THEN ((repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("perm_eq0l", [perm_eq0l]))(fun tmp_arg1 -> (use_arg_then2 ("perm_eq0r", [perm_eq0r]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("NOT_CONS_NIL", [NOT_CONS_NIL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((repeat_tactic 1 9 (((use_arg_then2 ("ordered", [ordered]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["p_eq"])) THEN (case THEN (case THEN ((move ["ord1"]) THEN (move ["all1"])))) THEN (case THEN ((move ["ord2"]) THEN (move ["all2"])))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`h1 = h2`))) (term_tac (have_gen_tac [](move ["eq12"]))))); + ((in_tac ["p_eq"] true (((use_arg_then2 ("eq12", []))(thm_tac (new_rewrite [] []))))) THEN (congr_tac (`CONS h2 _2`))); + ((((use_arg_then2 ("IH1", [])) (disch_tac [])) THEN (clear_assumption "IH1") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("ord1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ord2", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("perm_cons", [perm_cons])) (fun fst_arg -> (use_arg_then2 ("h2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (use_arg_then2 ("p_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["mem_eq"]))); + ((((fun arg_tac -> (use_arg_then2 ("mem_eq", [])) (fun fst_arg -> (use_arg_then2 ("h2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then2 ("mem_eq", [])) (fun fst_arg -> (use_arg_then2 ("h1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("MEM", [MEM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac))); + ((case THEN (simp_tac) THEN (move ["mem12"])) THEN (case THEN (simp_tac) THEN (move ["mem21"])) THEN (((use_arg_then2 ("R_asym", [])) (disch_tac [])) THEN (clear_assumption "R_asym") THEN (DISCH_THEN apply_tac))); + ((((use_arg_then2 ("all2", [])) (disch_tac [])) THEN (clear_assumption "all2") THEN ((use_arg_then2 ("all1", [])) (disch_tac [])) THEN (clear_assumption "all1") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("mem21", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (move ["R12"]) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("mem12", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN (move ["R21"])) THEN (done_tac)); +];; + +(* Lemma ordered_merge_delete_at_eq *) +let ordered_merge_delete_at_eq = Sections.section_proof ["x0";"i";"s"] +`i < sizel s /\ ordered R s ==> + merge R [nth x0 s i] (delete_at i s) = s` +[ + ((BETA_TAC THEN (case THEN ((move ["i_lt"]) THEN (move ["ord"])))) THEN (((use_arg_then2 ("ordered_eq", [ordered_eq])) (disch_tac [])) THEN (clear_assumption "ordered_eq") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("ord", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)); + ((((use_arg_then2 ("perm_eq_trans", [perm_eq_trans])) (disch_tac [])) THEN (clear_assumption "perm_eq_trans") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`nth x0 s i :: delete_at i s`))) (term_tac exists_tac))); + (((((use_arg_then2 ("perm_eq_cons_delete_at", [perm_eq_cons_delete_at]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("cat1s", [cat1s])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`nth x0 s i`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`delete_at i s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("perm_eq_merge", [perm_eq_merge]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((THENL) (((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN ((use_arg_then2 ("i", [])) (disch_tac [])) THEN (clear_assumption "i") THEN ((use_arg_then2 ("ord", [])) (disch_tac [])) THEN (clear_assumption "ord") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN elim) [ALL_TAC; ((move ["h"]) THEN (move ["t"]) THEN (move ["IH"]))]) THEN (((((use_arg_then2 ("size", [size]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LENGTH", [LENGTH]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltn0", [ltn0]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ordered", [ordered]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["ord"])) THEN (move ["h_all"]))); + (((THENL) elim [ALL_TAC; ((move ["i"]) THEN (move ["iIH"]))]) THEN (((((use_arg_then2 ("nth", [nth]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("delete_at", [delete_at]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("ltSS", [ltSS]))(thm_tac (new_rewrite [] [])))))) THEN (move ["i_lt"]))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`merge R [h] t = h :: t`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((((use_arg_then2 ("ordered", [ordered]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((THENL) (((use_arg_then2 ("h_all", [])) (disch_tac [])) THEN (clear_assumption "h_all") THEN ((use_arg_then2 ("t", [])) (disch_tac [])) THEN (clear_assumption "t") THEN case) [ALL_TAC; ((move ["h'"]) THEN (move ["t'"]))]) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("merge", [merge]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("all", [all]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); + (repeat_tactic 1 9 (((use_arg_then2 ("merge", [merge]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`nth x0 t i`))) (term_tac (set_tac "x"))); + ((THENL_ROT (-1)) (((fun arg_tac -> arg_tac (Arg_term (`R x h`))) (disch_eq_tac "Rxh" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + ((((use_arg_then2 ("ordered", [ordered]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("IH", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("all_merge", [all_merge]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("all", [all]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((((use_arg_then2 ("h_all", [])) (disch_tac [])) THEN (clear_assumption "h_all") THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["h_all"])) THEN (split_tac)) (((((use_arg_then2 ("h_all", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_nth", [mem_nth]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((BETA_TAC THEN (move ["x'"]) THEN (move ["mem"])) THEN ((((use_arg_then2 ("h_all", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mem_delete_at", [mem_delete_at])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("ordered", [ordered]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("all", [all]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Rxh", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ordered_delete_at", [ordered_delete_at]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`x = h`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + ((((use_arg_then2 ("h_all", [])) (disch_tac [])) THEN (clear_assumption "h_all") THEN BETA_TAC) THEN (((((use_arg_then2 ("andbb", [andbb]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (move ["h_all"]) THEN (move ["x'"]) THEN (move ["mem"])) THEN (((use_arg_then2 ("h_all", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("mem_delete_at", [mem_delete_at])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)) THEN (done_tac)); + ((((use_arg_then2 ("R_asym", [])) (disch_tac [])) THEN (clear_assumption "R_asym") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("Rxh", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("h_all", [])) (disch_tac [])) THEN (clear_assumption "h_all") THEN BETA_TAC) THEN ((((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC))) THEN (DISCH_THEN apply_tac)); + (((((use_arg_then2 ("x_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_nth", [mem_nth]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ordered_merge_delete1_eq *) +let ordered_merge_delete1_eq = Sections.section_proof ["x";"s"] +`x <- s /\ ordered R s ==> merge R [x] (delete1 x s) = s` +[ + (BETA_TAC THEN (case THEN ((move ["xs"]) THEN (move ["ord"])))); + (((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_index", [nth_index])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`(@)(UNIV)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("delete1_eq_at", [delete1_eq_at]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ordered_merge_delete_at_eq", [ordered_merge_delete_at_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ord", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Ordered *) +let ordered1 = Sections.finalize_theorem ordered1;; +let ordered_cat = Sections.finalize_theorem ordered_cat;; +let ordered_nthP = Sections.finalize_theorem ordered_nthP;; +let ordered_nseq = Sections.finalize_theorem ordered_nseq;; +let ordered_subseq = Sections.finalize_theorem ordered_subseq;; +let ordered_delete_at = Sections.finalize_theorem ordered_delete_at;; +let ordered_delete1 = Sections.finalize_theorem ordered_delete1;; +let ordered_filter = Sections.finalize_theorem ordered_filter;; +let ordered_merge_general = Sections.finalize_theorem ordered_merge_general;; +let ordered_eq = Sections.finalize_theorem ordered_eq;; +let ordered_merge_delete_at_eq = Sections.finalize_theorem ordered_merge_delete_at_eq;; +let ordered_merge_delete1_eq = Sections.finalize_theorem ordered_merge_delete1_eq;; +Sections.end_section "Ordered";; + +(* Section Sorted *) +Sections.begin_section "Sorted";; +(Sections.add_section_var (mk_var ("R", (`:A->A->bool`))));; +(Sections.add_section_var (mk_var ("x0", (`:A`))));; + +(* Lemma sorted_size *) +let sorted_size = Sections.section_proof ["s1";"s2"] +`sorted R s1 s2 ==> sizel s1 = sizel s2` +[ + (((((use_arg_then2 ("sorted", [sorted]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["_"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("perm_eq_size", [perm_eq_size])) (thm_tac (match_mp_then snd_th MP_TAC))))))) THEN (done_tac)); +];; + +(* Lemma sorted_mem *) +let sorted_mem = Sections.section_proof ["s1";"s2"] +`sorted R s1 s2 ==> (!x. x <- s1 <=> x <- s2)` +[ + (((((use_arg_then2 ("sorted", [sorted]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["_"]) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (thm_tac (match_mp_then snd_th MP_TAC))))))) THEN (done_tac)); +];; + +(* Lemma size_merge *) +let size_merge = Sections.section_proof ["s1";"s2"] +`sizel (merge R s1 s2) = sizel s1 + sizel s2` +[ + ((((use_arg_then2 ("size_cat", [size_cat]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((use_arg_then2 ("perm_eq_size", [perm_eq_size])) (thm_tac apply_tac)) THEN ((use_arg_then2 ("perm_eq_merge", [perm_eq_merge])) (thm_tac apply_tac)) THEN (done_tac)); +];; + +(* Lemma sorted_delete_at_1 *) +let sorted_delete_at_1 = Sections.section_proof ["i";"s1";"s2"] +`i < sizel s1 /\ sorted R s1 s2 ==> + sorted R (delete_at i s1) (delete1 (nth x0 s1 i) s2)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("sorted", [sorted]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["i_lt"])) THEN (case THEN ((move ["ord"]) THEN (move ["p_eq"])))) THEN ((((use_arg_then2 ("ordered_delete_at", [ordered_delete_at]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("perm_eq_delete_at_1", [perm_eq_delete_at_1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sorted_delete_1_at *) +let sorted_delete_1_at = Sections.section_proof ["i";"s1";"s2"] +`i < sizel s2 /\ sorted R s1 s2 ==> + sorted R (delete1 (nth x0 s2 i) s1) (delete_at i s2)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("sorted", [sorted]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["i_lt"])) THEN (case THEN ((move ["ord"]) THEN (move ["p_eq"])))); + (((((use_arg_then2 ("ordered_delete1", [ordered_delete1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("perm_eq_sym", [perm_eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_eq_delete_at_1", [perm_eq_delete_at_1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("perm_eq_sym", [perm_eq_sym]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sorted_delete1 *) +let sorted_delete1 = Sections.section_proof ["x";"s1";"s2"] +`sorted R s1 s2 ==> sorted R (delete1 x s1) (delete1 x s2)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("sorted", [sorted]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["ord"]) THEN (move ["p_eq"])))) THEN ((((use_arg_then2 ("ordered_delete1", [ordered_delete1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("perm_eq_delete1", [perm_eq_delete1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sorted_filter *) +let sorted_filter = Sections.section_proof ["a";"s";"l"] +`sorted R s l ==> sorted R (filter a s) (filter a l)` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("sorted", [sorted]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["ord_s"]) THEN (move ["perm_s"])))); + (((((fun arg_tac -> (use_arg_then2 ("ordered_subseq", [ordered_subseq])) (fun fst_arg -> (use_arg_then2 ("ord_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("filter_subseq", [filter_subseq]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("perm_eq_filter", [perm_eq_filter]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma perm_eq_merge_sort *) +let perm_eq_merge_sort = Sections.section_proof ["s"] +`perm_eq (merge_sort R s) s` +[ + (((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN ((use_arg_then2 ("seq_wf_ind", [seq_wf_ind])) (thm_tac apply_tac)) THEN (move ["s"]) THEN (move ["IH"])); + ((((use_arg_then2 ("merge_sort", [merge_sort]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_term (`LENGTH s <= 1`))) (disch_eq_tac "ineq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) THEN (repeat_tactic 0 10 (((use_arg_then2 ("perm_eq_refl", [perm_eq_refl]))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`_ DIV 2`))) (term_tac (set_tac "n"))); + ((((fun arg_tac -> (use_arg_then2 ("perm_eq_trans", [perm_eq_trans])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`merge_sort R (take n s) ++ merge_sort R (dropl n s)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN (split_tac)); + ((((use_arg_then2 ("perm_eq_merge", [perm_eq_merge]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("cat_take_drop", [cat_take_drop])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [3] []))))) THEN ((use_arg_then2 ("perm_eq_cat", [perm_eq_cat])) (thm_tac apply_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("IH", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("n_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("merge_ineqs", [merge_ineqs]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma size_merge_sort *) +let size_merge_sort = Sections.section_proof ["l"] +`sizel (merge_sort R l) = sizel l` +[ + (((use_arg_then2 ("perm_eq_size", [perm_eq_size])) (thm_tac apply_tac)) THEN (((use_arg_then2 ("perm_eq_merge_sort", [perm_eq_merge_sort]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Section SortedEq *) +Sections.begin_section "SortedEq";; +(Sections.add_section_hyp "R_asym" (`!x y. R x y /\ R y x ==> x = y`));; + +(* Lemma sorted_eq *) +let sorted_eq = Sections.section_proof ["s1";"s2";"s"] +`sorted R s1 s /\ sorted R s2 s ==> s1 = s2` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("sorted", [sorted]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((case THEN ((move ["ord1"]) THEN (move ["p1"]))) THEN (case THEN ((move ["ord2"]) THEN (move ["p2"])))))); + ((((fun arg_tac -> (use_arg_then2 ("ordered_eq", [ordered_eq])) (fun fst_arg -> (use_arg_then2 ("R_asym", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("ord1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ord2", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("perm_eq_trans", [perm_eq_trans])) (fun fst_arg -> (use_arg_then2 ("p1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_eq_sym", [perm_eq_sym]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section SortedEq *) +let sorted_eq = Sections.finalize_theorem sorted_eq;; +Sections.end_section "SortedEq";; + +(* Section SortedNth0 *) +Sections.begin_section "SortedNth0";; + +(* Lemma nth0_sorted_imp *) +let nth0_sorted_imp = Sections.section_proof ["l";"s"] +`sorted R s l ==> (!y. y <- l /\ ~(y = nth x0 s 0) ==> R (nth x0 s 0) y)` +[ + (((((use_arg_then2 ("sorted", [sorted]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("ordered_nthP", [ordered_nthP])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["sort"]) THEN (move ["perm"]))) THEN (move ["y"])); + ((((fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["ys"]) THEN (move ["y_neq"])))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_index", [nth_index])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ys", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("sort", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ys", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("y_neq", [])) (disch_tac [])) THEN (clear_assumption "y_neq") THEN ((use_arg_then2 ("contraR", [contraR])) (disch_tac [])) THEN (clear_assumption "contraR") THEN (DISCH_THEN apply_tac)) THEN (((((use_arg_then2 ("lt0n", [lt0n]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] []))))) THEN (move ["eq0"]))); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_index", [nth_index])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("ys", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq0", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(Sections.add_section_hyp "R_anti" (`!x y. R x y /\ R y x ==> x = y`));; + +(* Lemma nth0_sorted_eq *) +let nth0_sorted_eq = Sections.section_proof ["x";"l";"s"] +`sorted R s l /\ 0 < sizel l ==> + (nth x0 s 0 = x <=> (x <- l /\ !y. y <- l /\ ~(y = x) ==> R x y))` +[ + ((BETA_TAC THEN (case THEN ((move ["sort"]) THEN (move ["size_gt0"])))) THEN (((use_arg_then2 ("sort", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("sorted", [sorted]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN ((move ["ord"]) THEN (move ["perm"]))))); + ((THENL) (split_tac) [(((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))); (case THEN ((move ["mem_x"]) THEN (move ["r_xy"])))]); + ((((fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_nth", [mem_nth]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("perm_eq_size", [perm_eq_size])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("nth0_sorted_imp", [nth0_sorted_imp])) (disch_tac [])) THEN (clear_assumption "nth0_sorted_imp") THEN (exact_tac)); + ((((use_arg_then2 ("contraT", [contraT])) (disch_tac [])) THEN (clear_assumption "contraT") THEN (DISCH_THEN apply_tac) THEN (move ["neq"])) THEN (((use_arg_then2 ("neq", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("implybF", [implybF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("R_anti", [])) (disch_tac [])) THEN (clear_assumption "R_anti") THEN (DISCH_THEN apply_tac)) THEN ((((use_arg_then2 ("r_xy", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("neq", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("mem_nth", [mem_nth]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("perm_eq_size", [perm_eq_size])) (fun fst_arg -> (use_arg_then2 ("perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (use_arg_then2 ("nth0_sorted_imp", [nth0_sorted_imp])) (fun fst_arg -> (use_arg_then2 ("sort", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Finalization of the section SortedNth0 *) +let nth0_sorted_imp = Sections.finalize_theorem nth0_sorted_imp;; +let nth0_sorted_eq = Sections.finalize_theorem nth0_sorted_eq;; +Sections.end_section "SortedNth0";; +(Sections.add_section_hyp "R_trans" (`!x y z. R x y /\ R y z ==> R x z`));; + +(* Lemma sorted_le *) +let sorted_le = Sections.section_proof ["l";"l'";"s";"s'"] +`sorted R s l /\ sorted R s' l' /\ sizel l' = sizel l /\ + (!i. i < sizel l ==> R (nth x0 l i) (nth x0 l' i)) ==> + (!i. i < sizel l ==> R (nth x0 s i) (nth x0 s' i))` +[ + ((BETA_TAC THEN (case THEN (move ["sort_s"])) THEN (case THEN (move ["sort_s'"])) THEN (case THEN (move ["l_l'"])) THEN (move ["ineqs"]) THEN (move ["i"]) THEN (move ["i_lt"])) THEN (((use_arg_then2 ("sort_s'", [])) (disch_tac [])) THEN ((use_arg_then2 ("sort_s", [])) (disch_tac [])) THEN BETA_TAC)); + ((fun arg_tac -> arg_tac (Arg_term (`sizel l`))) (term_tac (set_tac "n"))); + ((repeat_tactic 1 9 (((use_arg_then2 ("sorted", [sorted]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["ord_s"]) THEN (move ["perm_s"]))) THEN (case THEN ((move ["ord_s'"]) THEN (move ["perm_s'"])))); + ((fun arg_tac -> arg_tac (Arg_term (`sizel s = n /\ sizel s' = n`))) (term_tac (have_gen_tac [](move ["sizes"])))); + (((((fun arg_tac -> (use_arg_then2 ("perm_eq_size", [perm_eq_size])) (fun fst_arg -> (use_arg_then2 ("perm_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("perm_eq_size", [perm_eq_size])) (fun fst_arg -> (use_arg_then2 ("perm_s'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`?t. t HAS_SIZE (n - i) /\ (!k. k IN t ==> k < n /\ R (nth x0 s i) (nth x0 s' k))`))) (term_tac (have_gen_tac []ALL_TAC)))); + ((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["t"])) THEN (case THEN ALL_TAC) THEN (case THEN (move ["fin_t"])) THEN (move ["card_t"]) THEN (move ["R_in_t"])); + ((THENL) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`?k. k IN t /\ k < i:num`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [((case THEN (move ["k"])) THEN (case THEN ((move ["kt"]) THEN (move ["k_lt"])))); ALL_TAC]); + ((((use_arg_then2 ("R_trans", [])) (disch_tac [])) THEN (clear_assumption "R_trans") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`nth x0 s' k`))) (term_tac exists_tac))); + (((((use_arg_then2 ("R_in_t", []))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (in_tac ["ord_s'"] false (((fun arg_tac -> (use_arg_then2 ("ordered_nthP", [ordered_nthP])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ord_s'", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((use_arg_then2 ("NOT_EXISTS_THM", [NOT_EXISTS_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] []))))) THEN (move ["h"])); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`t = i..n - 1`))) (term_tac (have_gen_tac [](move ["t_eq"]))))) (((((use_arg_then2 ("R_in_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("t_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((use_arg_then2 ("CARD_SUBSET_EQ", [CARD_SUBSET_EQ])) (thm_tac apply_tac)) THEN ((((use_arg_then2 ("CARD_NUMSEG", [CARD_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card_t", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))))); + ((THENL_LAST) (split_tac) ((((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((BETA_TAC THEN (move ["k"]) THEN (move ["kt"])) THEN (((fun arg_tac -> (use_arg_then2 ("R_in_t", [])) (fun fst_arg -> (use_arg_then2 ("kt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("k", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("kt", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + (in_tac ["perm_s"] false (((use_arg_then2 ("perm_eq_sym", [perm_eq_sym]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("perm_eq_bij", [perm_eq_bij])) (fun fst_arg -> (use_arg_then2 ("perm_s'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("perm_eq_bij", [perm_eq_bij])) (fun fst_arg -> (use_arg_then2 ("perm_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("n_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sizes", []))(thm_tac (new_rewrite [] [])))))); + (BETA_TAC THEN (case THEN (move ["p"])) THEN (case THEN (move ["p_perm"])) THEN (move ["p_eq"]) THEN (case THEN (move ["q"])) THEN (case THEN (move ["q_perm"])) THEN (move ["q_eq"])); + ((fun arg_tac -> arg_tac (Arg_term (`j < n:num ==> p j < n`))) (term_tac (have_gen_tac ["j"](move ["p_lt"])))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PERMUTES_IN_IMAGE", [PERMUTES_IN_IMAGE])) (fun fst_arg -> (use_arg_then2 ("p_perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leq0n", [leq0n]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`j < n:num ==> q j < n`))) (term_tac (have_gen_tac ["j"](move ["q_lt"])))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PERMUTES_IN_IMAGE", [PERMUTES_IN_IMAGE])) (fun fst_arg -> (use_arg_then2 ("q_perm", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("leq0n", [leq0n]))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_term (`IMAGE (q o p) (i..n - 1)`))) (term_tac exists_tac)) THEN (split_tac)); + ((((use_arg_then2 ("HAS_SIZE", [HAS_SIZE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_IMAGE", [FINITE_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((THENL_LAST) ((((use_arg_then2 ("CARD_IMAGE_INJ", [CARD_IMAGE_INJ]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("CARD_NUMSEG", [CARD_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))) ((((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"]))); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PERMUTES_INJECTIVE", [PERMUTES_INJECTIVE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`q o p`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`0..n-1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("PERMUTES_COMPOSE", [PERMUTES_COMPOSE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("IN_IMAGE", [IN_IMAGE]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] []))))) THEN (move ["k"]) THEN (case THEN (move ["j"])) THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (move ["j_ineqs"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`j < n:num`))) (term_tac (have_gen_tac [](move ["j_lt"])))) ((((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN ((use_arg_then2 ("j_ineqs", [])) (disch_tac [])) THEN (clear_assumption "j_ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("q_lt", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("p_lt", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("q_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("p_lt", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((((fun arg_tac -> (use_arg_then2 ("ineqs", [])) (fun fst_arg -> (fun arg_tac -> (use_arg_then2 ("p_lt", [])) (fun fst_arg -> (use_arg_then2 ("j_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("p_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["Rj"]))); + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`i = j`))) (disch_eq_tac "eq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) ((((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("R_trans", [])) (disch_tac [])) THEN (clear_assumption "R_trans") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`nth x0 s j`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("Rj", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + (in_tac ["ord_s"] false (((fun arg_tac -> (use_arg_then2 ("ordered_nthP", [ordered_nthP])) (fun fst_arg -> (use_arg_then2 ("x0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("ord_s", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sizes", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("j_lt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("LT_LE", [LT_LE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(Sections.add_section_hyp "R_total" (`!x y. R x y \/ R y x`));; + +(* Lemma ordered_merge *) +let ordered_merge = Sections.section_proof ["s1";"s2"] +`ordered R s1 /\ ordered R s2 ==> ordered R (merge R s1 s2)` +[ + ((BETA_TAC THEN (case THEN ((move ["ord1"]) THEN (move ["ord2"])))) THEN ((((fun arg_tac -> (use_arg_then2 ("ordered_merge_general", [ordered_merge_general])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`UNIV`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_UNIV", [IN_UNIV]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("SUBSET_UNIV", [SUBSET_UNIV]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma ordered_merge_sort *) +let ordered_merge_sort = Sections.section_proof ["s"] +`ordered R (merge_sort R s)` +[ + ((((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN ((use_arg_then2 ("seq_wf_ind", [seq_wf_ind])) (thm_tac apply_tac)) THEN (move ["s"]) THEN (move ["IH"])) THEN (((use_arg_then2 ("merge_sort", [merge_sort]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> arg_tac (Arg_term (`LENGTH s <= 1`))) (disch_eq_tac "ineq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((fun arg_tac -> (use_arg_then2 ("length_le_1", [length_le_1])) (fun fst_arg -> (use_arg_then2 ("ineq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("ordered", [ordered]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("all", [all]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("ordered_merge", [ordered_merge])) (disch_tac [])) THEN (clear_assumption "ordered_merge") THEN (DISCH_THEN apply_tac)) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("IH", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("merge_ineqs", [merge_ineqs]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sorted_merge_sort *) +let sorted_merge_sort = Sections.section_proof ["s"] +`sorted R (merge_sort R s) s` +[ + (((((use_arg_then2 ("sorted", [sorted]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ordered_merge_sort", [ordered_merge_sort]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_eq_merge_sort", [perm_eq_merge_sort]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Sorted *) +let sorted_size = Sections.finalize_theorem sorted_size;; +let sorted_mem = Sections.finalize_theorem sorted_mem;; +let size_merge = Sections.finalize_theorem size_merge;; +let sorted_delete_at_1 = Sections.finalize_theorem sorted_delete_at_1;; +let sorted_delete_1_at = Sections.finalize_theorem sorted_delete_1_at;; +let sorted_delete1 = Sections.finalize_theorem sorted_delete1;; +let sorted_filter = Sections.finalize_theorem sorted_filter;; +let perm_eq_merge_sort = Sections.finalize_theorem perm_eq_merge_sort;; +let size_merge_sort = Sections.finalize_theorem size_merge_sort;; +let sorted_eq = Sections.finalize_theorem sorted_eq;; +let nth0_sorted_imp = Sections.finalize_theorem nth0_sorted_imp;; +let nth0_sorted_eq = Sections.finalize_theorem nth0_sorted_eq;; +let sorted_le = Sections.finalize_theorem sorted_le;; +let ordered_merge = Sections.finalize_theorem ordered_merge;; +let ordered_merge_sort = Sections.finalize_theorem ordered_merge_sort;; +let sorted_merge_sort = Sections.finalize_theorem sorted_merge_sort;; +Sections.end_section "Sorted";; + +(* Section SortedReal *) +Sections.begin_section "SortedReal";; +prioritize_real();; + +(* Lemma ordered_real_nseq *) +let ordered_real_nseq = Sections.section_proof ["n";"x"] +`ordered (<=) (nseq n x)` +[ + (((((use_arg_then2 ("ordered_nseq", [ordered_nseq]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma ordered_cat_filter *) +let ordered_cat_filter = Sections.section_proof ["s";"v"] +`ordered (<=) s ==> + s = filter (\x. x <= v) s ++ filter (predC (\x. x <= v)) s` +[ + ((BETA_TAC THEN (move ["ord_s"])) THEN ((fun arg_tac -> arg_tac (Arg_term (`_1 ++ _2`))) (term_tac (set_tac "s2")))); + ((THENL_FIRST) (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("ordered_eq", [ordered_eq])) (fun fst_arg -> (use_arg_then2 ("ord_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (split_tac)) ((BETA_TAC THEN (move ["x"]) THEN (move ["y"])) THEN (((use_arg_then2 ("REAL_LE_ANTISYM", [REAL_LE_ANTISYM]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((use_arg_then2 ("s2_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("perm_eq_sym", [perm_eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_filterC", [perm_filterC]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("perm_eq_refl", [perm_eq_refl]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ordered_cat", [ordered_cat]))(thm_tac (new_rewrite [] []))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("ordered_filter", [ordered_filter]))(thm_tac (new_rewrite [] []))))) THEN ((simp_tac THEN TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("allP", [allP]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("mem_filter", [mem_filter]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("predC", [predC]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["x"]) THEN (case THEN ((move ["x_le"]) THEN (move ["mem_x"]))) THEN (move ["y"]) THEN (case THEN ((move ["y_gt"]) THEN (move ["mem_y"])))); + ((((use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE])) (disch_tac [])) THEN (clear_assumption "REAL_LT_IMP_LE") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("REAL_LET_TRANS", [REAL_LET_TRANS])) (disch_tac [])) THEN (clear_assumption "REAL_LET_TRANS") THEN (DISCH_THEN apply_tac)) THEN ((use_arg_then2 ("v", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("REAL_NOT_LE", [REAL_NOT_LE]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma real_merge_sort *) +let real_merge_sort = Sections.section_proof ["s"] +`sorted (<=) (merge_sort (<=) s) s` +[ + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sorted_merge_sort", [sorted_merge_sort])) (fun fst_arg -> (use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("REAL_LE_TOTAL", [REAL_LE_TOTAL])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +];; + +(* Lemma ants *) +let ants = Sections.section_proof ["P";"Q";"R"] +`P /\ (Q ==> R) ==> ((P ==> Q) ==> R)` +[ + ((BETA_TAC THEN (case THEN ((move ["p"]) THEN (move ["qr"]))) THEN (move ["pq"])) THEN ((((use_arg_then2 ("qr", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("pq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma sort_continuous *) +let sort_continuous = Sections.section_proof ["l";"l'";"s";"s'";"e"] +`sorted (<=) s l /\ sorted (<=) s' l' /\ sizel l = sizel l' /\ + (!i. i < sizel l ==> abs (nth (&0) l i - nth (&0) l' i) < e) ==> + (!i. i < sizel l ==> abs (nth (&0) s i - nth (&0) s' i) < e)` +[ + (((use_arg_then2 ("l'", [])) (disch_tac [])) THEN (clear_assumption "l'") THEN ((use_arg_then2 ("s'", [])) (disch_tac [])) THEN (clear_assumption "s'") THEN ((use_arg_then2 ("s", [])) (disch_tac [])) THEN (clear_assumption "s") THEN ((use_arg_then2 ("l", [])) (disch_tac [])) THEN (clear_assumption "l") THEN ((use_arg_then2 ("seq_wf_ind", [seq_wf_ind])) (thm_tac apply_tac)) THEN (move ["l"]) THEN (move ["IH"]) THEN (move ["s"]) THEN (move ["s'"]) THEN (move ["l'"]) THEN (case THEN (move ["sort_s"])) THEN (case THEN (move ["sort_s'"])) THEN (case THEN (move ["l_l'"])) THEN (move ["ineqs"]) THEN (move ["i"]) THEN (move ["i_ineq"])); + ((fun arg_tac -> arg_tac (Arg_term (`sizel s = sizel l /\ sizel s' = sizel l`))) (term_tac (have_gen_tac [](move ["h_size"])))); + (((((fun arg_tac -> (use_arg_then2 ("sorted_size", [sorted_size])) (fun fst_arg -> (use_arg_then2 ("sort_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("sorted_size", [sorted_size])) (fun fst_arg -> (use_arg_then2 ("sort_s'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("l_l'", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`nth (&0) s i`))) (term_tac (set_tac "x"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x <- s`))) (term_tac (have_gen_tac [](move ["xs"])))) (((((use_arg_then2 ("x_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_nth", [mem_nth]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("h_size", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x <- l`))) (term_tac (have_gen_tac [](move ["xl"])))) ((((fun arg_tac -> (use_arg_then2 ("sorted_mem", [sorted_mem])) (fun fst_arg -> (use_arg_then2 ("sort_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`nth (&0) l' (indexl x l)`))) (term_tac (set_tac "x'"))); + ((fun arg_tac -> arg_tac (Arg_term (`abs (x - x') < e`))) (term_tac (have_gen_tac [](move ["x_ineq"])))); + (((((use_arg_then2 ("x'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_index", [nth_index])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("l", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("ineqs", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x' <- l'`))) (term_tac (have_gen_tac [](move ["x'_l'"])))) (((((use_arg_then2 ("x'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("mem_nth", [mem_nth]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("l_l'", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`x' <- s'`))) (term_tac (have_gen_tac [](move ["x'_s'"])))) ((((fun arg_tac -> (use_arg_then2 ("sorted_mem", [sorted_mem])) (fun fst_arg -> (use_arg_then2 ("sort_s'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("IH", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`delete1 x l`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`delete_at i s`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`delete1 x' s'`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`delete_at (indexl x l) l'`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("IH", [])) (disch_tac [])) THEN (clear_assumption "IH") THEN BETA_TAC THEN (move ["_"])); + ((THENL_FIRST) (((((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_delete1", [size_delete1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xl", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("COND_CLAUSES", [COND_CLAUSES]))(thm_tac (new_rewrite [] []))))) THEN (ANTS_TAC)) ((((use_arg_then2 ("i_ineq", [])) (disch_tac [])) THEN (clear_assumption "i_ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("ants", [ants])) (disch_tac [])) THEN (clear_assumption "ants") THEN (DISCH_THEN apply_tac)) THEN ((THENL) (split_tac) [ALL_TAC; (move ["IH"])])); + ((((use_arg_then2 ("x_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("sorted_delete_at_1", [sorted_delete_at_1]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("h_size", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("x'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("sorted_delete_1_at", [sorted_delete_1_at]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("l_l'", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((use_arg_then2 ("size_delete_at", [size_delete_at]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("l_l'", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("xl", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (move ["k"]) THEN (move ["k_lt"])); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("size_delete_at", [size_delete_at])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`indexl x l`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("l'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("size_delete1", [size_delete1])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("l", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC); + (((((use_arg_then2 ("l_l'", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("xl", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["size1"]) THEN (move ["size2"])); + (((((use_arg_then2 ("nth_delete1", [nth_delete1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_delete_at", [nth_delete_at]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ineqs", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("k_lt", [])) (disch_tac [])) THEN (clear_assumption "k_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`nth _1 _2 _3`))) (term_tac (set_tac "y"))); + (((fun arg_tac -> arg_tac (Arg_term (`i <= indexl x' s'`))) (disch_eq_tac "i_le" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + ((((use_arg_then2 ("i_le", [])) (disch_tac [])) THEN (clear_assumption "i_le") THEN BETA_TAC) THEN (((use_arg_then2 ("leq_eqVlt", [leq_eqVlt]))(thm_tac (new_rewrite [] [])))) THEN ((THENL) case [(move ["eq"]); (move ["i_lt"])])); + (((((use_arg_then2 ("y_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_index", [nth_index]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`y <= x'`))) (term_tac (have_gen_tac []ALL_TAC))); + ((((use_arg_then2 ("sort_s'", [])) (disch_tac [])) THEN (clear_assumption "sort_s'") THEN BETA_TAC) THEN (((((use_arg_then2 ("sorted", [sorted]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("ordered_nthP", [ordered_nthP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_index", [nth_index])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("index_mem", [index_mem]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`SUC i < sizel l`))) (term_tac (have_gen_tac [](move ["Si"])))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("iffRL", [iffRL])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("index_mem", [index_mem])) (fun fst_arg -> (use_arg_then2 ("x'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x'_s'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (((use_arg_then2 ("h_size", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`x <= nth (&0) s (SUC i)`))) (term_tac (have_gen_tac []ALL_TAC))); + ((((use_arg_then2 ("sort_s", [])) (disch_tac [])) THEN (clear_assumption "sort_s") THEN BETA_TAC) THEN (((((use_arg_then2 ("sorted", [sorted]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("ordered_nthP", [ordered_nthP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("h_size", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Si", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltnSn", [ltnSn]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((fun arg_tac -> (use_arg_then2 ("IH", [])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("ants", [ants])) (disch_tac [])) THEN (clear_assumption "ants") THEN (DISCH_THEN apply_tac)) THEN (split_tac)) ((((use_arg_then2 ("Si", [])) (disch_tac [])) THEN (clear_assumption "Si") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("nth_delete_at", [nth_delete_at]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ltnn", [ltnn]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_delete1", [nth_delete1]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_lt", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("y_def", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); + (in_tac ["i_le"] false (((use_arg_then2 ("ltnNge", [ltnNge]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`x' <= y`))) (term_tac (have_gen_tac []ALL_TAC))); + ((((use_arg_then2 ("sort_s'", [])) (disch_tac [])) THEN (clear_assumption "sort_s'") THEN BETA_TAC) THEN (((((use_arg_then2 ("sorted", [sorted]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("ordered_nthP", [ordered_nthP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("nth_index", [nth_index])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("s'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("y_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + ((((use_arg_then2 ("h_size", []))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`i - 1 < i`))) (term_tac (have_gen_tac [](move ["Pi"])))) ((((use_arg_then2 ("i_le", [])) (disch_tac [])) THEN (clear_assumption "i_le") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`nth (&0) s (i - 1) <= x`))) (term_tac (have_gen_tac []ALL_TAC))); + ((((use_arg_then2 ("sort_s", [])) (disch_tac [])) THEN (clear_assumption "sort_s") THEN BETA_TAC) THEN (((((use_arg_then2 ("sorted", [sorted]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("ordered_nthP", [ordered_nthP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)))); + (((((use_arg_then2 ("h_size", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("i_ineq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) ((((use_arg_then2 ("x_ineq", [])) (disch_tac [])) THEN (clear_assumption "x_ineq") THEN ((fun arg_tac -> (use_arg_then2 ("IH", [])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`i - 1`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((use_arg_then2 ("ants", [ants])) (disch_tac [])) THEN (clear_assumption "ants") THEN (DISCH_THEN apply_tac)) THEN (split_tac)) ((((use_arg_then2 ("i_ineq", [])) (disch_tac [])) THEN (clear_assumption "i_ineq") THEN ((use_arg_then2 ("i_le", [])) (disch_tac [])) THEN (clear_assumption "i_le") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("nth_delete_at", [nth_delete_at]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Pi", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("nth_delete1", [nth_delete1]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(i - 1 < indexl x' s')`))) (term_tac (have_gen_tac []((((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))))) ((((use_arg_then2 ("i_le", [])) (disch_tac [])) THEN (clear_assumption "i_le") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((((fun arg_tac -> (use_arg_then2 ("ltn_predK", [ltn_predK])) (fun fst_arg -> (use_arg_then2 ("Pi", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_def", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma min_exists *) +let min_exists = Sections.section_proof ["P";"n"] +`P (n:num) ==> ?m. P m /\ (!i. P i ==> m <= i)` +[ + (((use_arg_then2 ("n", [])) (disch_tac [])) THEN (clear_assumption "n") THEN ((use_arg_then2 ("num_WF", [num_WF])) (thm_tac apply_tac)) THEN (move ["n"]) THEN (move ["IH"]) THEN (move ["Pn"])); + ((THENL) (((fun arg_tac -> (use_arg_then2 ("EXCLUDED_MIDDLE", [EXCLUDED_MIDDLE])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`!i:num. i < n ==> ~P i`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(move ["h"]); ALL_TAC]); + (((use_arg_then2 ("n", [])) (term_tac exists_tac)) THEN (((((use_arg_then2 ("Pn", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (move ["i"]))); + ((((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac)) THEN (((use_arg_then2 ("NOT_LE", [NOT_LE]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (((((use_arg_then2 ("NOT_FORALL_THM", [NOT_FORALL_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NOT_IMP", [NOT_IMP]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["k"])) THEN (case THEN (move ["k_lt"])) THEN (move ["Pk"])); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("IH", [])) (fun fst_arg -> (use_arg_then2 ("k_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("Pk", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC THEN (case THEN (move ["m"])) THEN (move ["conds"])) THEN ((use_arg_then2 ("m", [])) (term_tac exists_tac)) THEN (done_tac)); +];; + +(* Lemma min_exists_alt *) +let min_exists_alt = Sections.section_proof ["P"] +`(?n:num. P n) ==> ?m. P m /\ (!i. P i ==> m <= i)` +[ + ((BETA_TAC THEN (case THEN (move ["n"])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("min_exists", [min_exists])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (done_tac)); +];; + +(* Lemma real_sorted_lt *) +let real_sorted_lt = Sections.section_proof ["l";"l'";"s";"s'"] +`sorted (<=) s l /\ sorted (<=) s' l' /\ sizel l' = sizel l /\ + (!i. i < sizel l ==> EL i l <= EL i l') /\ + (?i. i < sizel l /\ EL i l < EL i l') ==> + ?k. k < sizel l /\ (!i. i < k ==> EL i s = EL i s') /\ EL k s < EL k s'` +[ + (BETA_TAC THEN (case THEN (move ["sort_s"])) THEN (case THEN (move ["sort_s'"])) THEN (case THEN (move ["size_eq"])) THEN (case THEN (move ["el_le"])) THEN (case THEN (move ["r"])) THEN (case THEN (move ["r_lt"])) THEN (move ["el_lt"])); + ((((use_arg_then2 ("sort_s'", [])) (disch_tac [])) THEN ((use_arg_then2 ("sort_s", [])) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("sorted", [sorted]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN ((move ["ord_s"]) THEN (move ["perm_s"]))) THEN (case THEN ((move ["ord_s'"]) THEN (move ["perm_s'"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`sizel s = sizel l /\ sizel s' = sizel l`))) (term_tac (have_gen_tac [](move ["sizes"])))); + (((((fun arg_tac -> (use_arg_then2 ("perm_eq_size", [perm_eq_size])) (fun fst_arg -> (use_arg_then2 ("perm_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("perm_eq_size", [perm_eq_size])) (fun fst_arg -> (use_arg_then2 ("perm_s'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`~(l = []) /\ ~(l' = [])`))) (term_tac (have_gen_tac [](move ["not_nil"])))); + (((repeat_tactic 1 9 (((use_arg_then2 ("size_eq0", [size_eq0]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("r_lt", [])) (disch_tac [])) THEN (clear_assumption "r_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`list_sum l I < list_sum l' I`))) (term_tac (have_gen_tac [](move ["sum_neq"])))); + ((repeat_tactic 1 9 (((use_arg_then2 ("list_sum_EL", [list_sum_EL]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("size_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_LT", [SUM_LT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FINITE_NUMSEG", [FINITE_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_NUMSEG", [IN_NUMSEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("leq0n", [leq0n]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((THENL_FIRST) ((THENL) (split_tac) [((move ["i"]) THEN (move ["i_le"])); ALL_TAC]) ((((use_arg_then2 ("el_le", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("r_lt", [])) (disch_tac [])) THEN (clear_assumption "r_lt") THEN ((use_arg_then2 ("i_le", [])) (disch_tac [])) THEN (clear_assumption "i_le") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (((use_arg_then2 ("r", [])) (term_tac exists_tac)) THEN (((use_arg_then2 ("el_lt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("r_lt", [])) (disch_tac [])) THEN (clear_assumption "r_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sorted_le", [sorted_le])) (fun fst_arg -> (use_arg_then2 ("REAL_LE_TRANS", [REAL_LE_TRANS])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sort_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("sort_s'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("size_eq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN ((THENL) (ANTS_TAC) [((move ["i"]) THEN (move ["i_lt"])); (move ["s_le"])])); + (((repeat_tactic 1 9 (((use_arg_then2 ("EL_nth", [EL_nth]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("el_le", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`?m. m < sizel l /\ ~(EL m s = EL m s')`))) (term_tac (have_gen_tac []ALL_TAC)))); + ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("min_exists_alt", [min_exists_alt])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (move ["m"])) THEN (case THEN ALL_TAC) THEN (case THEN ((move ["m_lt"]) THEN (move ["m_neq"]))) THEN (move ["m_min"])); + (((use_arg_then2 ("m", [])) (term_tac exists_tac)) THEN ((((use_arg_then2 ("m_lt", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN ((THENL) (split_tac) [((move ["i"]) THEN (move ["i_lt"])); ALL_TAC])); + ((((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN ((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("m_min", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (((use_arg_then2 ("m_lt", [])) (disch_tac [])) THEN (clear_assumption "m_lt") THEN ((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("s_le", [])) (fun fst_arg -> (use_arg_then2 ("m_lt", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((repeat_tactic 1 9 (((use_arg_then2 ("EL_nth", [EL_nth]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sizes", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_LE_LT", [REAL_LE_LT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("m_neq", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("sum_neq", [])) (disch_tac [])) THEN (clear_assumption "sum_neq") THEN ((use_arg_then2 ("contraLR", [contraLR])) (disch_tac [])) THEN (clear_assumption "contraLR") THEN (DISCH_THEN apply_tac)); + ((((((use_arg_then2 ("NOT_EXISTS_THM", [NOT_EXISTS_THM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_and", [negb_and]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negbK", [negbK]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NOT_LT", [REAL_NOT_LT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_LT", [REAL_LE_LT]))(thm_tac (new_rewrite [] []))))) THEN (move ["h"])) THEN (DISJ2_TAC)); + ((((fun arg_tac -> (use_arg_then2 ("list_sum_perm_eq", [list_sum_perm_eq])) (fun fst_arg -> (use_arg_then2 ("perm_s", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("list_sum_perm_eq", [list_sum_perm_eq])) (fun fst_arg -> (use_arg_then2 ("perm_s'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("list_sum_nth_eq", [list_sum_nth_eq])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac apply_tac)) THEN (((repeat_tactic 1 9 (((use_arg_then2 ("sizes", []))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("I_THM", [I_THM]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (move ["i"]) THEN (move ["i_lt"]))); + ((repeat_tactic 1 9 (((use_arg_then2 ("EL_nth", [EL_nth]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("sizes", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("i_lt", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +];; + +(* Finalization of the section SortedReal *) +let ordered_real_nseq = Sections.finalize_theorem ordered_real_nseq;; +let ordered_cat_filter = Sections.finalize_theorem ordered_cat_filter;; +let real_merge_sort = Sections.finalize_theorem real_merge_sort;; +let ants = Sections.finalize_theorem ants;; +let sort_continuous = Sections.finalize_theorem sort_continuous;; +let min_exists = Sections.finalize_theorem min_exists;; +let min_exists_alt = Sections.finalize_theorem min_exists_alt;; +let real_sorted_lt = Sections.finalize_theorem real_sorted_lt;; +Sections.end_section "SortedReal";; + +(* Section MinK *) +Sections.begin_section "MinK";; + +(* Lemma min_k_ordered *) +let min_k_ordered = Sections.section_proof ["i";"j";"list"] +`j < LENGTH list /\ i <= j ==> min_k i list <= min_k j list` +[ + (((((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("min_k", [min_k]))(thm_tac (new_rewrite [] [])))))) THEN ALL_TAC THEN (case THEN (move ["j_lt"])) THEN (move ["i_le_j"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`i < sizel list`))) (term_tac (have_gen_tac [](move ["i_lt"])))) ((((use_arg_then2 ("j_lt", [])) (disch_tac [])) THEN (clear_assumption "j_lt") THEN ((use_arg_then2 ("i_le_j", [])) (disch_tac [])) THEN (clear_assumption "i_le_j") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_merge_sort", [size_merge_sort]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((THENL_FIRST) ((THENL) (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("iffLR", [iffLR])) (fun fst_arg -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("leq_eqVlt", [leq_eqVlt])) (fun fst_arg -> (use_arg_then2 ("i", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("i_le_j", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case) [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); (move ["i_lt_j"])]) ((((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("real_merge_sort", [real_merge_sort])) (fun fst_arg -> (use_arg_then2 ("list", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (((((use_arg_then2 ("sorted", [sorted]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("ordered_nthP", [ordered_nthP])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_merge_sort", [size_merge_sort]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma mem_min_k *) +let mem_min_k = Sections.section_proof ["k";"list"] +`k < LENGTH list ==> min_k k list <- list` +[ + (((((use_arg_then2 ("min_k", [min_k]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (move ["k_lt"])); + ((((fun arg_tac -> (use_arg_then2 ("real_merge_sort", [real_merge_sort])) (fun fst_arg -> (use_arg_then2 ("list", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("sorted", [sorted]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("perm_eq_mem", [perm_eq_mem])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("MEM_EL", [MEM_EL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("size_merge_sort", [size_merge_sort]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma min_k0_le_EL *) +let min_k0_le_EL = Sections.section_proof ["l"] +`!i. i < sizel l ==> min_k 0 l <= EL i l` +[ + ((THENL_FIRST) ((BETA_TAC THEN (move ["i"]) THEN (move ["i_lt"])) THEN ((((use_arg_then2 ("min_k", [min_k]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("EL_nth", [EL_nth])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size_merge_sort", [size_merge_sort]))(thm_tac (new_rewrite [] []))))))) ((((use_arg_then2 ("i_lt", [])) (disch_tac [])) THEN (clear_assumption "i_lt") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b. a <= b <=> a <= b \/ a = b`)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_term (`_1 = _2`))) (disch_eq_tac "neq" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac))); + (((fun arg_tac -> (use_arg_then2 ("real_merge_sort", [real_merge_sort])) (fun fst_arg -> (use_arg_then2 ("l", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("nth0_sorted_imp", [nth0_sorted_imp])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (DISCH_THEN apply_tac)); + (((((use_arg_then2 ("MEM_EL", [MEM_EL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("size", [size]))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); +];; + +(* Finalization of the section MinK *) +let min_k_ordered = Sections.finalize_theorem min_k_ordered;; +let mem_min_k = Sections.finalize_theorem mem_min_k;; +let min_k0_le_EL = Sections.finalize_theorem min_k0_le_EL;; +Sections.end_section "MinK";; + +(* Close the module *) +end;; diff --git a/text_formalization/tame/ssreflect/tame_lemmas-compiled.hl b/text_formalization/tame/ssreflect/tame_lemmas-compiled.hl new file mode 100644 index 0000000..e1c44b8 --- /dev/null +++ b/text_formalization/tame/ssreflect/tame_lemmas-compiled.hl @@ -0,0 +1,899 @@ +flyspeck_needs "../formal_lp/hypermap/ssreflect/add_triangle-compiled.hl";; + +(* Module Tame_lemmas*) +module Tame_lemmas = struct + +let reflection = new_definition `reflection n x = x - (&2 * (x dot n) / (n dot n)) % n`;; +let kcblrqc_ineq_tml = + let has_id = (fun t -> not(intersect ["KCBLRQC"] (Ineq.flypaper_ids t) = [])) in + let extra_ids = [ + "3287695934"; + "6988401556"; + "3862621143 back"; + "3862621143 front"; + "3862621143 side"; + "4240815464 a reduced"; + "6944699408 a reduced"; + "7043724150 a reduced v2"; + ] in + let idl = (filter (fun t -> has_id t or mem t.idv extra_ids) !Ineq.ineqs) in + let tml = map (fun t -> t.ineq) idl in + end_itlist (curry mk_conj) tml;; +let kcblrqc_ineq_def = new_definition + (mk_eq (`kcblrqc_ineq_def:bool`, kcblrqc_ineq_tml));; +open Tame_general;; +open Add_triangle;; +open Fan_defs;; +open Pack_defs;; +open Hypermap;; +open Hypermap_and_fan;; +open Hypermap_iso;; +open Ssrbool;; +open Ssrnat;; + +(* Section Reflection *) +Sections.begin_section "Reflection";; +let VECTOR_MUL_RZERO = GEN_ALL VECTOR_MUL_RZERO;; +let VECTOR_SUB_RZERO = GEN_ALL VECTOR_SUB_RZERO;; +let VECTOR_SUB_RDISTRIB = GEN_ALL VECTOR_SUB_RDISTRIB;; +let VECTOR_ADD_RDISTRIB = GEN_ALL VECTOR_ADD_RDISTRIB;; +let VECTOR_SUB_LDISTRIB = GEN_ALL VECTOR_SUB_LDISTRIB;; +(Sections.add_section_type (mk_var ("x", (`:real^N`))); Sections.add_section_type (mk_var ("y", (`:real^N`))); Sections.add_section_type (mk_var ("d", (`:real^N`))));; + +(* Lemma reflection_at0 *) +let reflection_at0 = Sections.section_proof ["x"] +`reflection (vec 0) x = x` +[ + (((((use_arg_then2 ("reflection", [reflection]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_MUL_RZERO", [VECTOR_MUL_RZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_SUB_RZERO", [VECTOR_SUB_RZERO]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma reflection_eq *) +let reflection_eq = Sections.section_proof ["n";"x"] +`x dot n = &0 ==> reflection n x = x` +[ + ((((use_arg_then2 ("reflection", [reflection]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LZERO", [REAL_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_RZERO", [REAL_MUL_RZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_MUL_LZERO", [VECTOR_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_SUB_RZERO", [VECTOR_SUB_RZERO]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma reflection_eq2 *) +let reflection_eq2 = Sections.section_proof ["n";"x"] +`reflection n x = x <=> x dot n = &0` +[ + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`n = vec 0`))) (disch_eq_tac "n0" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) (((((use_arg_then2 ("n0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("reflection_at0", [reflection_at0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DOT_RZERO", [DOT_RZERO]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((THENL_LAST) (split_tac) (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("reflection_eq", [reflection_eq])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN (done_tac))); + ((((use_arg_then2 ("reflection", [reflection]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (VECTOR_ARITH `!x y. x - y = x <=> y = vec 0`)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_MUL_EQ_0", [VECTOR_MUL_EQ_0]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("n0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orbF", [orbF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_INV_EQ_0", [REAL_INV_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DOT_EQ_0", [DOT_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("n0", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma reflection0 *) +let reflection0 = Sections.section_proof ["n"] +`reflection n (vec 0) = vec 0` +[ + (((((use_arg_then2 ("reflection_eq", [reflection_eq]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("DOT_LZERO", [DOT_LZERO]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma reflection_sub *) +let reflection_sub = Sections.section_proof ["n";"x";"y"] +`reflection n (x - y) = reflection n x - reflection n y` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("reflection", [reflection]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("DOT_LSUB", [DOT_LSUB]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_SUB_LDISTRIB", [REAL_SUB_LDISTRIB]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_SUB_RDISTRIB", [REAL_SUB_RDISTRIB]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("VECTOR_SUB_RDISTRIB", [VECTOR_SUB_RDISTRIB]))(thm_tac (new_rewrite [] [])))) THEN (VECTOR_ARITH_TAC) THEN (done_tac)); +];; + +(* Lemma reflection_add *) +let reflection_add = Sections.section_proof ["n";"x";"y"] +`reflection n (x + y) = reflection n x + reflection n y` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("reflection", [reflection]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("DOT_LADD", [DOT_LADD]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_ADD_LDISTRIB", [REAL_ADD_LDISTRIB]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_RDISTRIB", [REAL_ADD_RDISTRIB]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("VECTOR_ADD_RDISTRIB", [VECTOR_ADD_RDISTRIB]))(thm_tac (new_rewrite [] [])))) THEN (VECTOR_ARITH_TAC) THEN (done_tac)); +];; + +(* Lemma reflection_cmul *) +let reflection_cmul = Sections.section_proof ["n";"c";"x"] +`reflection n (c % x) = c % reflection n x` +[ + ((repeat_tactic 1 9 (((use_arg_then2 ("reflection", [reflection]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("DOT_LMUL", [DOT_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("VECTOR_SUB_LDISTRIB", [VECTOR_SUB_LDISTRIB]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("VECTOR_MUL_ASSOC", [VECTOR_MUL_ASSOC]))(thm_tac (new_rewrite [] []))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_ASSOC", [REAL_MUL_ASSOC]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma norm_reflection *) +let norm_reflection = Sections.section_proof ["n";"x"] +`norm (reflection n x) = norm x` +[ + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`n = vec 0`))) (disch_eq_tac "n0" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) (((((use_arg_then2 ("n0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("reflection_at0", [reflection_at0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("reflection", [reflection]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("NORM_EQ", [NORM_EQ]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DOT_LSUB", [DOT_LSUB]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DOT_RSUB", [DOT_RSUB]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DOT_RMUL", [DOT_RMUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DOT_LMUL", [DOT_LMUL]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DOT_SYM", [DOT_SYM])) (fun fst_arg -> (use_arg_then2 ("n", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`~(n dot n = &0)`))) (term_tac (have_gen_tac []ALL_TAC)))) ((CONV_TAC REAL_FIELD) THEN (done_tac))); + ((((use_arg_then2 ("DOT_EQ_0", [DOT_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma dist_reflection *) +let dist_reflection = Sections.section_proof ["n";"x";"y"] +`dist (reflection n x, reflection n y) = dist (x, y)` +[ + (((repeat_tactic 1 9 (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("reflection_sub", [reflection_sub]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("norm_reflection", [norm_reflection]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma dist_reflection_special *) +let dist_reflection_special = Sections.section_proof ["n";"x";"y"] +`y dot n = &0 ==> dist (reflection n x, y) = dist (x, y)` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("reflection_eq", [reflection_eq])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [1] [])))))) THEN (((use_arg_then2 ("dist_reflection", [dist_reflection]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma reflection_dot *) +let reflection_dot = Sections.section_proof ["n";"x"] +`(reflection n x) dot n = --(x dot n)` +[ + ((THENL_FIRST) (((fun arg_tac -> arg_tac (Arg_term (`n = vec 0`))) (disch_eq_tac "n0" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)) (((((use_arg_then2 ("n0", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DOT_RZERO", [DOT_RZERO]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_NEG_0", [REAL_NEG_0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((((use_arg_then2 ("reflection", [reflection]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DOT_LSUB", [DOT_LSUB]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DOT_LMUL", [DOT_LMUL]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("n0", [])) (disch_tac [])) THEN (clear_assumption "n0") THEN BETA_TAC) THEN (((use_arg_then2 ("DOT_EQ_0", [DOT_EQ_0]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (CONV_TAC REAL_FIELD) THEN (done_tac)); +];; + +(* Lemma dist_reflection_lemma *) +let dist_reflection_lemma = Sections.section_proof ["n";"x";"y"] +`dist (reflection n x, y) pow 2 + = dist (x, y) pow 2 + &4 * ((y dot n) * (x dot n)) / (n dot n)` +[ + (((fun arg_tac -> arg_tac (Arg_term (`n = vec 0`))) (disch_eq_tac "n0" [])) THEN case THEN (simp_tac) THEN (process_fst_eq_tac)); + (((((use_arg_then2 ("n0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("reflection_at0", [reflection_at0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DOT_RZERO", [DOT_RZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_LZERO", [REAL_MUL_LZERO]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_MUL_RZERO", [REAL_MUL_RZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_RID", [REAL_ADD_RID]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("Collect_geom.DIST_POW2_DOT", [Collect_geom.DIST_POW2_DOT]))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> arg_tac (Arg_term (`y = reflection n y + (&2 * (y dot n) / (n dot n)) % n`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [1; 2] []))))))); + ((((use_arg_then2 ("reflection", [reflection]))(thm_tac (new_rewrite [] [])))) THEN (VECTOR_ARITH_TAC) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`&2 * _`))) (term_tac (set_tac "a"))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`b - (c + d) = (b - c) - d:real^N`))) (term_tac (have_gen_tac ["b"; "c"; "d"](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((VECTOR_ARITH_TAC) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`(b - c) dot (b - c) = b dot b + c dot c - &2 * (b dot c:real^N)`))) (term_tac (have_gen_tac ["b"; "c"](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("DOT_LSUB", [DOT_LSUB]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DOT_RSUB", [DOT_RSUB]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DOT_SYM", [DOT_SYM])) (fun fst_arg -> (use_arg_then2 ("b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("c", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (VECTOR_ARITH_TAC) THEN (done_tac)); + ((((use_arg_then2 ("Collect_geom.DIST_POW2_DOT", [Collect_geom.DIST_POW2_DOT]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dist_reflection", [dist_reflection]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("DOT_LSUB", [DOT_LSUB]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DOT_LMUL", [DOT_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DOT_RMUL", [DOT_RMUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("reflection_dot", [reflection_dot]))(thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("n0", [])) (disch_tac [])) THEN (clear_assumption "n0") THEN BETA_TAC) THEN (((use_arg_then2 ("DOT_EQ_0", [DOT_EQ_0]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((CONV_TAC REAL_FIELD) THEN (done_tac)); +];; + +(* Finalization of the section Reflection *) +let reflection_at0 = Sections.finalize_theorem reflection_at0;; +let reflection_eq = Sections.finalize_theorem reflection_eq;; +let reflection_eq2 = Sections.finalize_theorem reflection_eq2;; +let reflection0 = Sections.finalize_theorem reflection0;; +let reflection_sub = Sections.finalize_theorem reflection_sub;; +let reflection_add = Sections.finalize_theorem reflection_add;; +let reflection_cmul = Sections.finalize_theorem reflection_cmul;; +let norm_reflection = Sections.finalize_theorem norm_reflection;; +let dist_reflection = Sections.finalize_theorem dist_reflection;; +let dist_reflection_special = Sections.finalize_theorem dist_reflection_special;; +let reflection_dot = Sections.finalize_theorem reflection_dot;; +let dist_reflection_lemma = Sections.finalize_theorem dist_reflection_lemma;; +Sections.end_section "Reflection";; + +(* Section Misc *) +Sections.begin_section "Misc";; +(Sections.add_section_type (mk_var ("v", (`:real^3`))));; + +(* Lemma delta_y_pos *) +let delta_y_pos = Sections.section_proof ["v";"w";"w'"] +`let y1 = norm v in + let y2 = norm w in + let y3 = norm w' in + let y4 = dist (w,w') in + let y5 = dist (v,w') in + let y6 = dist (v,w) in + &0 <= delta_y y1 y2 y3 y4 y5 y6` +[ + (repeat_tactic 1 9 ((CONV_TAC let_CONV))); + ((((use_arg_then2 ("Sphere.delta_y", [Sphere.delta_y]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DELTA_EQ_DELTA_X", [DELTA_EQ_DELTA_X]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DIST_0", [DIST_0]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] []))))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Collect_geom.DELTA_POS_4POINTS", [Collect_geom.DELTA_POS_4POINTS])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0:real^3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma quadratic_root_plus_works *) +let quadratic_root_plus_works = Sections.section_proof ["a";"b";"c"] +`~(a = &0) /\ &0 <= b pow 2 - &4 * a * c ==> + let x = quadratic_root_plus (a,b,c) in + a * x pow 2 + b * x + c = &0` +[ + ((BETA_TAC THEN (move ["ineqs"])) THEN (CONV_TAC let_CONV)); + (((fun arg_tac -> (use_arg_then2 ("Collect_geom2.FACTOR_OF_QUADRARTIC", [Collect_geom2.FACTOR_OF_QUADRARTIC])) (fun fst_arg -> (use_arg_then2 ("ineqs", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))); + ((((use_arg_then2 ("Sphere.quadratic_root_plus", [Sphere.quadratic_root_plus]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma quadratic_root_plus_eq *) +let quadratic_root_plus_eq = Sections.section_proof ["a";"b";"c";"x"] +`&0 < a /\ &0 <= b pow 2 - &4 * a * c + /\ &0 <= b /\ (a * x pow 2 + b * x + c = &0) /\ &0 <= x + ==> quadratic_root_plus (a,b,c) = x` +[ + (BETA_TAC THEN (case THEN (move ["a_gt0"])) THEN (case THEN (move ["disc_ge0"])) THEN (case THEN (move ["b_ge0"])) THEN (case THEN (move ["x_root"])) THEN (move ["x_ge0"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(a = &0)`))) (term_tac (have_gen_tac [](move ["a_neq"])))) ((((use_arg_then2 ("a_gt0", [])) (disch_tac [])) THEN (clear_assumption "a_gt0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Collect_geom2.FACTOR_OF_QUADRARTIC", [Collect_geom2.FACTOR_OF_QUADRARTIC])) (fun fst_arg -> (use_arg_then2 ("a_neq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("disc_ge0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("x_root", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Sphere.quadratic_root_plus", [Sphere.quadratic_root_plus]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a_neq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orFb", [orFb]))(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_SUB_0", [REAL_SUB_0]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); ALL_TAC]) THEN ((TRY done_tac)) THEN (move ["x_eq"])); + ((fun arg_tac -> arg_tac (Arg_term (`x <= &0`))) (term_tac (have_gen_tac []ALL_TAC))); + (((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`&0 <= u ==> (--b - u) / (&2 * a) <= &0`))) (term_tac (have_gen_tac ["u"](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))) ((((use_arg_then2 ("SQRT_POS_LE", [SQRT_POS_LE]))(thm_tac (new_rewrite [] [])))) THEN (done_tac))); + ((BETA_TAC THEN (move ["u_ge0"])) THEN (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!x. x <= &0 <=> ~(&0 < x)`)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_POS_LT", [REAL_MUL_POS_LT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("negb_or", [negb_or]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&0 < inv (&2 * a)`))) (term_tac (have_gen_tac [](move ["h1"])))) (((((use_arg_then2 ("REAL_LT_INV", [REAL_LT_INV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_MUL", [REAL_LT_MUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("a_gt0", []))(thm_tac (new_rewrite [] []))))) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("h1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("real_lt", [real_lt])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_LT", [REAL_LE_LT]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("h1", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)); + ((((use_arg_then2 ("b_ge0", [])) (disch_tac [])) THEN (clear_assumption "b_ge0") THEN ((use_arg_then2 ("u_ge0", [])) (disch_tac [])) THEN (clear_assumption "u_ge0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((THENL_FIRST) ((((use_arg_then2 ("REAL_LE_LT", [REAL_LE_LT]))(thm_tac (new_rewrite [] [])))) THEN case) ((((use_arg_then2 ("x_ge0", [])) (disch_tac [])) THEN (clear_assumption "x_ge0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + (BETA_TAC THEN (move ["x_eq0"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`c = &0`))) (term_tac (have_gen_tac [](move ["c_eq0"])))) ((((use_arg_then2 ("x_root", [])) (disch_tac [])) THEN (clear_assumption "x_root") THEN BETA_TAC) THEN ((((use_arg_then2 ("x_eq0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_RZERO", [REAL_MUL_RZERO]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ADD_LID", [REAL_ADD_LID]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac))); + ((((use_arg_then2 ("Sphere.quadratic_root_plus", [Sphere.quadratic_root_plus]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("c_eq0", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_MUL_RZERO", [REAL_MUL_RZERO]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_SUB_RZERO", [REAL_SUB_RZERO]))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("POW_2_SQRT", [POW_2_SQRT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("REAL_ADD_LINV", [REAL_ADD_LINV]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_MUL_LZERO", [REAL_MUL_LZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("x_eq0", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma quadratic_root_plus_gt_eq *) +let quadratic_root_plus_gt_eq = Sections.section_proof ["a";"b";"c";"x";"y"] +`&0 < a /\ &0 <= b pow 2 - &4 * a * c + /\ a * x pow 2 + b * x + c = &0 /\ a * y pow 2 + b * y + c = &0 /\ y < x + ==> quadratic_root_plus (a,b,c) = x` +[ + (BETA_TAC THEN (case THEN (move ["a_gt0"])) THEN (case THEN (move ["disc_ge0"])) THEN (case THEN (move ["x_root"])) THEN (case THEN (move ["y_root"])) THEN (move ["y_lt_x"])); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`~(a = &0)`))) (term_tac (have_gen_tac [](move ["a_neq"])))) ((((use_arg_then2 ("a_gt0", [])) (disch_tac [])) THEN (clear_assumption "a_gt0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Collect_geom2.FACTOR_OF_QUADRARTIC", [Collect_geom2.FACTOR_OF_QUADRARTIC])) (fun fst_arg -> (use_arg_then2 ("a_neq", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("disc_ge0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["h"]))); + ((((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN ((fun arg_tac -> (use_arg_then2 ("h", [])) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("x_root", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_root", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("eq_sym", [eq_sym])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a_neq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("orFb", [orFb]))(thm_tac (new_rewrite [] []))))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("REAL_SUB_0", [REAL_SUB_0]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Sphere.quadratic_root_plus", [Sphere.quadratic_root_plus]))(gsym_then (thm_tac (new_rewrite [1] [])))))) THEN ALL_TAC THEN ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); ALL_TAC]) THEN ((TRY done_tac)) THEN (move ["x_eq"])); + ((THENL_LAST) ((case THEN (move ["y_eq"])) THEN (((use_arg_then2 ("y_lt_x", [])) (disch_tac [])) THEN (clear_assumption "y_lt_x") THEN BETA_TAC) THEN ((((use_arg_then2 ("x_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("y_eq", []))(thm_tac (new_rewrite [] [])))))) ((arith_tac) THEN (done_tac))); + ((THENL_FIRST) ((repeat_tactic 1 9 (((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LT_RMUL_EQ", [REAL_LT_RMUL_EQ]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("REAL_LT_INV", [REAL_LT_INV]))(fun tmp_arg1 -> (fun arg_tac ->(use_arg_then2 ("REAL_LT_MUL", [REAL_LT_MUL]))(fun tmp_arg1 -> (use_arg_then2 ("a_gt0", []))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] [])))))) ((arith_tac) THEN (done_tac))); + ((((fun arg_tac -> (use_arg_then2 ("SQRT_POS_LE", [SQRT_POS_LE])) (fun fst_arg -> (use_arg_then2 ("disc_ge0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma quadratic_root_plus_disc0_eq *) +let quadratic_root_plus_disc0_eq = Sections.section_proof ["a";"b";"c";"x"] +`~(a = &0) /\ b pow 2 - &4 * a * c = &0 + /\ a * x pow 2 + b * x + c = &0 + ==> quadratic_root_plus (a,b,c) = x` +[ + (BETA_TAC THEN (case THEN (move ["a_neq0"])) THEN (case THEN (move ["disc0"])) THEN (move ["x_root"])); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Collect_geom2.FACTOR_OF_QUADRARTIC", [Collect_geom2.FACTOR_OF_QUADRARTIC])) (fun fst_arg -> (use_arg_then2 ("a_neq0", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("b", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("c", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("x", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)); + (((((use_arg_then2 ("disc0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_REFL", [REAL_LE_REFL]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("x_root", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a_neq0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("orFb", [orFb]))(thm_tac (new_rewrite [] []))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("REAL_SUB_0", [REAL_SUB_0]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Sphere.quadratic_root_plus", [Sphere.quadratic_root_plus]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN ((THENL) case [(((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))); ALL_TAC]) THEN ((TRY done_tac))); + ((((((use_arg_then2 ("disc0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SQRT_0", [SQRT_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_SUB_RZERO", [REAL_SUB_RZERO]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_ADD_RID", [REAL_ADD_RID]))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Misc *) +let delta_y_pos = Sections.finalize_theorem delta_y_pos;; +let quadratic_root_plus_works = Sections.finalize_theorem quadratic_root_plus_works;; +let quadratic_root_plus_eq = Sections.finalize_theorem quadratic_root_plus_eq;; +let quadratic_root_plus_gt_eq = Sections.finalize_theorem quadratic_root_plus_gt_eq;; +let quadratic_root_plus_disc0_eq = Sections.finalize_theorem quadratic_root_plus_disc0_eq;; +Sections.end_section "Misc";; + +(* Section FullySurrounded *) +Sections.begin_section "FullySurrounded";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_hyp "fanV" (`FAN (vec 0,V,E)`));; +(Sections.add_section_hyp "f_surr" (`fully_surrounded (V,E)`));; + +(* Let dart1_eq *) +Sections.add_section_lemma "dart1_eq" (Sections.section_proof [] +`dart_of_fan (V,E) = dart1_of_fan (V,E)` +[ + ((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let confV *) +Sections.add_section_lemma "confV" (Sections.section_proof [] +`conforming_fan (vec 0,V,E)` +[ + ((((use_arg_then2 ("fully_surrounded_imp_conforming", [fully_surrounded_imp_conforming]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let dartH *) +Sections.add_section_lemma "dartH" (Sections.section_proof [] +`dart (hypermap_of_fan (V,E)) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Lemma dart_leads_into_eq1 *) +let dart_leads_into_eq1 = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + ==> dart_leads_into (vec 0) V E v w + = dartset_leads_into_fan (vec 0) V E + (IMAGE (ext_dart (V,E)) (face (hypermap_of_fan (V,E)) (v,w)))` +[ + (BETA_TAC THEN (move ["vw_in"])); + ((fun arg_tac -> (use_arg_then2 ("fan_hypermaps_iso_explicit2", [fan_hypermaps_iso_explicit2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["iso"]))); + ((fun arg_tac -> arg_tac (Arg_term (`ext_dart _`))) (term_tac (set_tac "h"))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H"))); + ((((fun arg_tac -> (use_arg_then2 ("iso_components", [iso_components])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`face _1 _2`))) (term_tac (set_tac "f1"))); + ((THENL_ROT (-1)) (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Planarity.DARTSET_LEADS_INTO_FAN", [Planarity.DARTSET_LEADS_INTO_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`h (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("h_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("ext_dart", [ext_dart]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Fan.pr2", [Fan.pr2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Fan.pr3", [Fan.pr3]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("fully_surrounded_imp_fan80", [fully_surrounded_imp_fan80]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f1_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("face_refl", [face_refl]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (simp_tac) THEN (move ["u"]) THEN (move ["uV"])); + ((((use_arg_then2 ("fully_surrounded_card_set_of_edge1", [fully_surrounded_card_set_of_edge1]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +];; + +(* Lemma dart_leads_into_same *) +let dart_leads_into_same = Sections.section_proof ["f";"v";"w";"x";"y"] +`f IN face_set (hypermap_of_fan (V,E)) + /\ (v,w) IN f /\ (x,y) IN f + ==> dart_leads_into (vec 0) V E v w = dart_leads_into (vec 0) V E x y` +[ + (BETA_TAC THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (case THEN (case THEN ((move ["a"]) THEN (move ["b"])))) THEN (case THEN (move ["ab_in"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (case THEN ((move ["vw_in"]) THEN (move ["xy_in"])))); + ((fun arg_tac -> arg_tac (Arg_term (`x,y IN dart_of_fan (V,E) /\ v,w IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["all_in"])))); + (((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("IN_TRANS", [IN_TRANS])) (fun fst_arg -> (use_arg_then2 ("xy_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("IN_TRANS", [IN_TRANS])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("lemma_face_subset", [lemma_face_subset]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("dart_leads_into_eq1", [dart_leads_into_eq1]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`a,b`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`v,w`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("lemma_face_identity", [lemma_face_identity])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`a,b`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`x,y`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Lemma fully_surrounded_sol *) +let fully_surrounded_sol = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + ==> sol (vec 0) (dart_leads_into (vec 0) V E v w) + = &2 * pi + sum (face (hypermap_of_fan (V,E)) (v,w)) (\x. azim_dart (V,E) x - pi)` +[ + (BETA_TAC THEN (move ["vw_in"])); + ((fun arg_tac -> (use_arg_then2 ("fan_hypermaps_iso_explicit2", [fan_hypermaps_iso_explicit2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["iso"]))); + ((((use_arg_then2 ("confV", [])) (disch_tac [])) THEN (clear_assumption "confV") THEN BETA_TAC) THEN ((((use_arg_then2 ("Conforming.conforming_fan", [Conforming.conforming_fan]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE Conforming.conforming_solid_angle_fan)))(thm_tac (new_rewrite [] [])))))); + (BETA_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["_"])) THEN (case THEN (move ["f_sol"])) THEN (move ["_"])); + ((((use_arg_then2 ("dart_leads_into_eq1", [dart_leads_into_eq1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_sol", []))(thm_tac (new_rewrite [] []))))); + (((((fun arg_tac -> (use_arg_then2 ("iso_components", [iso_components])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("lemma_in_face_set", [lemma_in_face_set]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("hyp_iso_dart", [hyp_iso_dart])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((congr_tac (`_1 + _2:real`)) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`x IN face (hypermap_of_fan (V,E)) (v,w) ==> x IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac ["x"](move ["in_face"])))); + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN ((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("lemma_face_subset", [lemma_face_subset]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("SUM_IMAGE", [SUM_IMAGE]))(thm_tac (new_rewrite [] [])))); + (BETA_TAC THEN (move ["x"]) THEN (move ["y"]) THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("in_face", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (move ["x_in"]) THEN (case THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("in_face", [])) (thm_tac (match_mp_then snd_th MP_TAC))))) THEN (move ["y_in"]) THEN (DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC))))); + (((((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (BETA_TAC THEN (case THEN ((move ["a"]) THEN (move ["b"]))) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("in_face", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (move ["d_in"]))); + (((((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("ext_dart", [ext_dart]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Fan.pr2", [Fan.pr2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Fan.pr3", [Fan.pr3]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("azim_dart_eq_azim_fan", [azim_dart_eq_azim_fan]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fully_surrounded_sum_sol *) +let fully_surrounded_sum_sol = Sections.section_proof [] +`sum (face_set (hypermap_of_fan (V,E))) + (\f. sol (vec 0) (dartset_leads_into_fan (vec 0) V E (IMAGE (ext_dart (V,E)) f))) + = &4 * pi` +[ + ((fun arg_tac -> (use_arg_then2 ("fan_hypermaps_iso_explicit2", [fan_hypermaps_iso_explicit2])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["iso"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Conforming.SUM_SOL_IN_FACE_SET_EQ_4PI", [Conforming.SUM_SOL_IN_FACE_SET_EQ_4PI])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("confV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((THENL_ROT (-1)) ((((fun arg_tac -> (use_arg_then2 ("iso_face_set", [iso_face_set])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("SUM_IMAGE", [SUM_IMAGE]))(thm_tac (new_rewrite [] [])))))); + ((BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("SUM_EQ", [SUM_EQ])) (thm_tac apply_tac)) THEN (move ["f"]) THEN (move ["_"]) THEN (simp_tac)) THEN (((use_arg_then2 ("o_THM", [o_THM]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + (BETA_TAC THEN (move ["f1"]) THEN (move ["f2"])); + (BETA_TAC THEN (case THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["x"])) THEN (case THEN (move ["x_in"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))) THEN (case THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN (case THEN (move ["y"])) THEN (case THEN (move ["y_in"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((DISCH_THEN (fun snd_th -> (fun arg_tac -> (use_arg_then2 ("image_inj_gen", [image_inj_gen])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dart (hypermap_of_fan (V,E))`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("lemma_face_subset", [lemma_face_subset]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andbT", [andbT]))(thm_tac (new_rewrite [] [])))))); + (((fun arg_tac -> (use_arg_then2 ("hyp_iso_inj", [hyp_iso_inj])) (fun fst_arg -> (use_arg_then2 ("iso", [iso])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +];; + +(* Lemma fully_surrounded_not_coplanar *) +let fully_surrounded_not_coplanar = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + ==> ~(coplanar {vec 0, v, w, sigma_fan (vec 0) V E v w})` +[ + ((BETA_TAC THEN (move ["vw_in"])) THEN (((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (move ["vw_in1"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["vw'_in"]))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _1 V _2 v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`{vec 0, v, w, w'} = {vec 0, w', v, w}`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem ((GEN_ALL o CONJUNCT2 o CONJUNCT2) Collect_geom.PER_SET3))) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); + ((((fun arg_tac -> (use_arg_then2 ("Planarity.properties_fully_surrounded", [Planarity.properties_fully_surrounded])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_azim_dart_eq_azim", [fully_surrounded_azim_dart_eq_azim])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("inE_eq_in_dart1", [inE_eq_in_dart1])) (fun fst_arg -> (use_arg_then2 ("V", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("vw_in1", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_switch", [dart1_switch]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("vw'_in", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("AZIM_DART_POS", [AZIM_DART_POS])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("f_surr", [])) (disch_tac [])) THEN (clear_assumption "f_surr") THEN BETA_TAC) THEN ((((use_arg_then2 ("fully_surrounded", [fully_surrounded]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fully_surrounded_delta_pos *) +let fully_surrounded_delta_pos = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) ==> + let w' = sigma_fan (vec 0) V E v w in + let y1 = norm v in + let y2 = norm w in + let y3 = norm w' in + let y4 = dist (w,w') in + let y5 = dist (v,w') in + let y6 = dist (v,w) in + &0 < delta_y y1 y2 y3 y4 y5 y6` +[ + (((((use_arg_then2 ("Sphere.delta_y", [Sphere.delta_y]))(thm_tac (new_rewrite [] [])))) THEN (move ["vw_in"])) THEN (repeat_tactic 1 9 ((CONV_TAC let_CONV)))); + ((((use_arg_then2 ("DELTA_EQ_DELTA_X", [DELTA_EQ_DELTA_X]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("Trigonometry1.DIST_L_ZERO", [Trigonometry1.DIST_L_ZERO]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] []))))))); + (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Collect_geom2.POS_EQ_NOT_COPLANANR)))(thm_tac (new_rewrite [] [])))); + ((THENL_FIRST) ((((use_arg_then2 ("Ckqowsa_3_points.coplanar_eq_coplanar_alt", [Ckqowsa_3_points.coplanar_eq_coplanar_alt]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DIMINDEX_3", [DIMINDEX_3]))(thm_tac (new_rewrite [] [])))))) ((arith_tac) THEN (done_tac))); + (((use_arg_then2 ("fully_surrounded_not_coplanar", [fully_surrounded_not_coplanar])) (disch_tac [])) THEN (clear_assumption "fully_surrounded_not_coplanar") THEN (exact_tac)); +];; + +(* Lemma fully_surrounded_azim_eq_dih_y *) +let fully_surrounded_azim_eq_dih_y = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) ==> + let w' = sigma_fan (vec 0) V E v w in + let y1 = norm v in + let y2 = norm w in + let y3 = norm w' in + let y4 = dist (w,w') in + let y5 = dist (v,w') in + let y6 = dist (v,w) in + azim_dart (V,E) (v,w) = dih_y y1 y2 y3 y4 y5 y6` +[ + ((BETA_TAC THEN (move ["vw_in"])) THEN (repeat_tactic 1 9 ((CONV_TAC let_CONV))) THEN (((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (move ["vw_in1"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1])) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["vw'_in"]))); + ((((use_arg_then2 ("fully_surrounded_azim_dart_eq_azim", [fully_surrounded_azim_dart_eq_azim]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("AZIM_DIVH", [AZIM_DIVH]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("DART1_NOT_COLLINEAR", [DART1_NOT_COLLINEAR])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("fully_surrounded_azim_dart_eq_azim", [fully_surrounded_azim_dart_eq_azim]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("f_surr", [])) (disch_tac [])) THEN (clear_assumption "f_surr") THEN BETA_TAC) THEN ((((use_arg_then2 ("fully_surrounded", [fully_surrounded]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)))); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE DIHV_EQ_DIH_Y)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((fun arg_tac -> (use_arg_then2 ("DART1_NOT_COLLINEAR", [DART1_NOT_COLLINEAR])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("Trigonometry1.DIST_L_ZERO", [Trigonometry1.DIST_L_ZERO]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fully_surrounded_sol_eq_sol_y *) +let fully_surrounded_sol_eq_sol_y = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) /\ + CARD (face (hypermap_of_fan (V,E)) (v,w)) = 3 ==> + let w' = sigma_fan (vec 0) V E v w in + let y1 = norm v in + let y2 = norm w in + let y3 = norm w' in + let y4 = dist (w,w') in + let y5 = dist (v,w') in + let y6 = dist (v,w) in + sol (vec 0) (dart_leads_into (vec 0) V E v w) = sol_y y1 y2 y3 y4 y5 y6` +[ + ((BETA_TAC THEN (case THEN ((move ["vw_in"]) THEN (move ["card3"])))) THEN (repeat_tactic 1 9 ((CONV_TAC let_CONV))) THEN (((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (move ["vw_in1"]))); + ((((use_arg_then2 ("fully_surrounded_sol", [fully_surrounded_sol]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE TRIANGULAR_FACE))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["f_eq"]) THEN (move ["eqs"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H"))); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart_of_fan (V,E) /\ w,w' IN dart_of_fan (V,E) /\ w',v IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["all_in"])))); + ((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 ((split_tac))) THEN ((use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`face H (v,w)`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("lemma_face_subset", [lemma_face_subset]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`~(v = w) /\ ~(w' = v) /\ ~(w = w')`))) (term_tac (have_gen_tac [](move ["neqs"])))); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ", [PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); + ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("SUM_SING", [SUM_SING]))(fun tmp_arg1 -> (use_arg_then2 ("SUM_CLAUSES", [SUM_CLAUSES]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("FINITE_INSERT", [FINITE_INSERT]))(fun tmp_arg1 -> (use_arg_then2 ("FINITE_EMPTY", [FINITE_EMPTY]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("IN_SING", [IN_SING]))(fun tmp_arg1 -> (use_arg_then2 ("IN_INSERT", [IN_INSERT]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("neqs", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("neqs", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE fully_surrounded_azim_eq_dih_y)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("Sphere.sol_y", [Sphere.sol_y]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma tauVEF_alt1 *) +let tauVEF_alt1 = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + ==> let f = face (hypermap_of_fan (V,E)) (v,w) in + tauVEF (V,E,f) = sol (vec 0) (dart_leads_into (vec 0) V E v w) + + (&2 - &(CARD f)) * sol0 + - sol0 / pi * sum f (\x. azim_dart (V,E) x * (lmfun (h_dart x) - &1))` +[ + ((BETA_TAC THEN (move ["vw_in"])) THEN (CONV_TAC let_CONV)); + ((((use_arg_then2 ("Tame_defs.tauVEF", [Tame_defs.tauVEF]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("fully_surrounded_sol", [fully_surrounded_sol]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H"))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FACE_FINITE", [FACE_FINITE])) (fun fst_arg -> (use_arg_then2 ("H", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`v,w`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["fin_f"]))); + (((fun arg_tac -> arg_tac (Arg_theorem (REAL_ARITH `!a b c. a * (&1 + b * (&1 - c)) = a - b * (a * (c - &1))`)))(thm_tac (new_rewrite [] [])))); + (((repeat_tactic 1 9 (((use_arg_then2 ("SUM_SUB", [SUM_SUB]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("SUM_LMUL", [SUM_LMUL]))(thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("SUM_CONST", [SUM_CONST])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`pi`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma tauVEF_alt2 *) +let tauVEF_alt2 = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + ==> let f = face (hypermap_of_fan (V,E)) (v,w) in + tauVEF (V,E,f) = sol (vec 0) (dart_leads_into (vec 0) V E v w) * (&1 + sol0 / pi) + - sol0 / pi * sum f (\x. azim_dart (V,E) x * lmfun (h_dart x))` +[ + ((BETA_TAC THEN (move ["vw_in"])) THEN (CONV_TAC let_CONV)); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE tauVEF_alt1)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("fully_surrounded_sol", [fully_surrounded_sol]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H"))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FACE_FINITE", [FACE_FINITE])) (fun fst_arg -> (use_arg_then2 ("H", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`v,w`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["fin_f"]))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`a * (b - &1) = a * b - a`))) (term_tac (have_gen_tac ["a"; "b"](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("SUM_SUB", [SUM_SUB]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("SUM_CONST", [SUM_CONST])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`pi`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("PI_POS", [PI_POS])) (disch_tac [])) THEN (clear_assumption "PI_POS") THEN BETA_TAC) THEN (CONV_TAC REAL_FIELD) THEN (done_tac)); +];; + +(* Lemma tauVEF_alt2_alt *) +let tauVEF_alt2_alt = Sections.section_proof ["f"] +`f IN face_set (hypermap_of_fan (V,E)) + ==> tauVEF (V,E,f) + = sol (vec 0) (dartset_leads_into_fan (vec 0) V E (IMAGE (ext_dart (V,E)) f)) + * (&1 + sol0 / pi) + - sol0 / pi * sum f (\x. azim_dart (V,E) x * lmfun (h_dart x))` +[ + (((DISCH_THEN (fun snd_th -> (use_arg_then2 ("lemma_face_representation", [lemma_face_representation])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (case THEN (case THEN ((move ["v"]) THEN (move ["w"]))))) THEN ((((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["vw_in"])) THEN (move ["f_eq"]))); + (((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [1] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE tauVEF_alt2)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart_leads_into_eq1", [dart_leads_into_eq1]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma tauVEF_alt3 *) +let tauVEF_alt3 = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + ==> let f = face (hypermap_of_fan (V,E)) (v,w) in + tauVEF (V,E,f) = sum f (\x. (&1 + sol0 / pi * (&1 - lmfun (h_dart x))) + * azim_dart (V,E) x - pi - sol0) + &2 * (pi + sol0)` +[ + ((BETA_TAC THEN (move ["vw_in"])) THEN (CONV_TAC let_CONV)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`a * x - b - c = x * a - (b + c):real`))) (term_tac (have_gen_tac ["a"; "x"; "b"; "c"](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H"))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("FACE_FINITE", [FACE_FINITE])) (fun fst_arg -> (use_arg_then2 ("H", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`v,w`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["fin_f"]))); + ((((use_arg_then2 ("SUM_SUB", [SUM_SUB]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("SUM_CONST", [SUM_CONST])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`pi + sol0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("Tame_defs.tauVEF", [Tame_defs.tauVEF]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma sum_tauVEF_upper_bound *) +let sum_tauVEF_upper_bound = Sections.section_proof [] +`&12 <= scriptL V ==> + sum (face_set (hypermap_of_fan (V,E))) (\f. tauVEF (V,E,f)) + <= &4 * pi - &20 * sol0` +[ + ((((fun arg_tac -> (use_arg_then2 ("SUM_EQ", [SUM_EQ])) (fun fst_arg -> (use_arg_then2 ("tauVEF_alt2_alt", [tauVEF_alt2_alt])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (move ["ineq"])); + ((((use_arg_then2 ("SUM_SUB", [SUM_SUB]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("FINITE_HYPERMAP_ORBITS", [FINITE_HYPERMAP_ORBITS]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((fun arg_tac -> (use_arg_then2 ("SUM_LMUL", [SUM_LMUL])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`sol0 / pi`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("SUM_RMUL", [SUM_RMUL])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`&1 + sol0 / pi`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + (((use_arg_then2 ("fully_surrounded_sum_sol", [fully_surrounded_sum_sol]))(thm_tac (new_rewrite [] [])))); + ((((use_arg_then2 ("Tame_defs.face_set_of_fan", [Tame_defs.face_set_of_fan]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Hrxefdm_tame.HRXEFDM_lemma1", [Hrxefdm_tame.HRXEFDM_lemma1]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`(&4 * pi) * (&1 + s / pi) - s / pi * &2 * pi * v = &4 * pi - (&2 * v - &4) * s`))) (term_tac (have_gen_tac ["v"; "s"](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("PI_NZ", [PI_NZ])) (disch_tac [])) THEN (clear_assumption "PI_NZ") THEN BETA_TAC) THEN (CONV_TAC REAL_FIELD) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("real_sub", [real_sub]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LE_LADD", [REAL_LE_LADD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_NEG", [REAL_LE_NEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LE_RMUL", [REAL_LE_RMUL]))(thm_tac (new_rewrite [] []))))); + (((fun arg_tac -> (use_arg_then2 ("REAL_LT_IMP_LE", [REAL_LT_IMP_LE])) (fun fst_arg -> (use_arg_then2 ("sol0_POS", [sol0_POS])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))); + ((((use_arg_then2 ("ineq", [])) (disch_tac [])) THEN (clear_assumption "ineq") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); +];; + +(* Lemma fully_surrounded_dot_cross *) +let fully_surrounded_dot_cross = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + ==> &0 < v dot (w cross sigma_fan (vec 0) V E v w)` +[ + (BETA_TAC THEN (move ["vw_in"])); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("Trigonometry.JBDNJJB", [Trigonometry.JBDNJJB])) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("Trigonometry2.re_eqvl", [Trigonometry2.re_eqvl]))(thm_tac (new_rewrite [] [])))) THEN ALL_TAC THEN (case THEN (move ["t"])) THEN (case THEN (move ["t_gt0"]))); + (((((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("fully_surrounded_azim_dart_eq_azim", [fully_surrounded_azim_dart_eq_azim]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))) THEN (move ["sin_eq"])); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`&0 < sin (azim_dart (V,E) (v,w))`))) (term_tac (have_gen_tac []ALL_TAC)))); + ((((use_arg_then2 ("sin_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Trigonometry1.cross_triple", [Trigonometry1.cross_triple]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DOT_SYM", [DOT_SYM]))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("REAL_MUL_POS_LT", [REAL_MUL_POS_LT]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("t_gt0", [])) (disch_tac [])) THEN (clear_assumption "t_gt0") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("SIN_POS_PI", [SIN_POS_PI]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("AZIM_DART_POS", [AZIM_DART_POS]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("f_surr", [])) (disch_tac [])) THEN (clear_assumption "f_surr") THEN BETA_TAC) THEN ((((use_arg_then2 ("fully_surrounded", [fully_surrounded]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Section BallAnnulus *) +Sections.begin_section "BallAnnulus";; +(Sections.add_section_hyp "subV" (`V SUBSET ball_annulus`));; + +(* Let v_norm *) +Sections.add_section_lemma "v_norm" (Sections.section_proof ["v"] +`v IN V ==> norm v <= &2 * h0 /\ &2 <= norm v` +[ + ((in_tac ["subV"] false (((use_arg_then2 ("SUBSET", [SUBSET]))(thm_tac (new_rewrite [] []))))) THEN ((DISCH_THEN (fun snd_th -> (use_arg_then2 ("subV", [])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC) THEN ((((use_arg_then2 ("Ckqowsa_3_points.in_ball_annulus", [Ckqowsa_3_points.in_ball_annulus]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac)) THEN (done_tac)); +]);; + +(* Lemma fully_surrounded_lnazim *) +let fully_surrounded_lnazim = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) ==> + let w' = sigma_fan (vec 0) V E v w in + let y1 = norm v in + let y2 = norm w in + let y3 = norm w' in + let y4 = dist (w,w') in + let y5 = dist (v,w') in + let y6 = dist (v,w) in + azim_dart (V,E) (v,w) * lmfun (h_dart (v,w)) = lnazim y1 y2 y3 y4 y5 y6` +[ + ((BETA_TAC THEN (move ["vw_in"])) THEN (repeat_tactic 1 9 ((CONV_TAC let_CONV)))); + ((((use_arg_then2 ("Sphere.lnazim", [Sphere.lnazim]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE fully_surrounded_azim_eq_dih_y))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("REAL_MUL_SYM", [REAL_MUL_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("ly_EQ_lmfun", [ly_EQ_lmfun]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("v_norm", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Lemma fully_surrounded_tau_eq_taum *) +let fully_surrounded_tau_eq_taum = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + /\ CARD (face (hypermap_of_fan (V,E)) (v,w)) = 3 + ==> let w' = sigma_fan (vec 0) V E v w in + let y1 = norm v in + let y2 = norm w in + let y3 = norm w' in + let y4 = dist (w,w') in + let y5 = dist (v,w') in + let y6 = dist (v,w) in + tauVEF (V,E,face (hypermap_of_fan (V,E)) (v,w)) = taum y1 y2 y3 y4 y5 y6` +[ + ((BETA_TAC THEN (case THEN ((move ["vw_in"]) THEN (move ["card3"])))) THEN (repeat_tactic 1 9 ((CONV_TAC let_CONV))) THEN (((use_arg_then2 ("vw_in", [])) (disch_tac [])) THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (move ["vw_in1"]))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE TRIANGULAR_FACE))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["f_eq"]) THEN (move ["eqs"]))))); + ((fun arg_tac -> (use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["dartH"]) THEN (move ["_"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan _`))) (term_tac (set_tac "H"))); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart_of_fan (V,E) /\ w,w' IN dart_of_fan (V,E) /\ w',v IN dart_of_fan (V,E)`))) (term_tac (have_gen_tac [](move ["all_in"])))); + ((((use_arg_then2 ("dartH", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 ((split_tac))) THEN ((use_arg_then2 ("IN_TRANS", [IN_TRANS])) (thm_tac apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`face H (v,w)`))) (term_tac exists_tac)) THEN ((((use_arg_then2 ("lemma_face_subset", [lemma_face_subset]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dartH", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`~(v = w) /\ ~(w' = v) /\ ~(w = w')`))) (term_tac (have_gen_tac [](move ["neqs"])))); + (((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ", [PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); + ((((use_arg_then2 ("H_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE tauVEF_alt2)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] []))))); + ((((use_arg_then2 ("f_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("SUM_SING", [SUM_SING]))(fun tmp_arg1 -> (use_arg_then2 ("SUM_CLAUSES", [SUM_CLAUSES]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((fun arg_tac ->(use_arg_then2 ("FINITE_INSERT", [FINITE_INSERT]))(fun tmp_arg1 -> (use_arg_then2 ("FINITE_EMPTY", [FINITE_EMPTY]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("IN_SING", [IN_SING]))(fun tmp_arg1 -> (use_arg_then2 ("IN_INSERT", [IN_INSERT]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("neqs", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("neqs", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE fully_surrounded_lnazim)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE fully_surrounded_sol_eq_sol_y)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] []))))); + (((((use_arg_then2 ("Sphere.taum", [Sphere.taum]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("sol0_over_pi_EQ_const1", [sol0_over_pi_EQ_const1]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section BallAnnulus *) +let fully_surrounded_lnazim = Sections.finalize_theorem fully_surrounded_lnazim;; +let fully_surrounded_tau_eq_taum = Sections.finalize_theorem fully_surrounded_tau_eq_taum;; +Sections.end_section "BallAnnulus";; + +(* Finalization of the section FullySurrounded *) +let dart_leads_into_eq1 = Sections.finalize_theorem dart_leads_into_eq1;; +let dart_leads_into_same = Sections.finalize_theorem dart_leads_into_same;; +let fully_surrounded_sol = Sections.finalize_theorem fully_surrounded_sol;; +let fully_surrounded_sum_sol = Sections.finalize_theorem fully_surrounded_sum_sol;; +let fully_surrounded_not_coplanar = Sections.finalize_theorem fully_surrounded_not_coplanar;; +let fully_surrounded_delta_pos = Sections.finalize_theorem fully_surrounded_delta_pos;; +let fully_surrounded_azim_eq_dih_y = Sections.finalize_theorem fully_surrounded_azim_eq_dih_y;; +let fully_surrounded_sol_eq_sol_y = Sections.finalize_theorem fully_surrounded_sol_eq_sol_y;; +let tauVEF_alt1 = Sections.finalize_theorem tauVEF_alt1;; +let tauVEF_alt2 = Sections.finalize_theorem tauVEF_alt2;; +let tauVEF_alt2_alt = Sections.finalize_theorem tauVEF_alt2_alt;; +let tauVEF_alt3 = Sections.finalize_theorem tauVEF_alt3;; +let sum_tauVEF_upper_bound = Sections.finalize_theorem sum_tauVEF_upper_bound;; +let fully_surrounded_dot_cross = Sections.finalize_theorem fully_surrounded_dot_cross;; +let fully_surrounded_lnazim = Sections.finalize_theorem fully_surrounded_lnazim;; +let fully_surrounded_tau_eq_taum = Sections.finalize_theorem fully_surrounded_tau_eq_taum;; +Sections.end_section "FullySurrounded";; + +(* Section EnclosedTauq *) +Sections.begin_section "EnclosedTauq";; + +(* Lemma taum_sym *) +let taum_sym = Sections.section_proof ["y1";"y2";"y3";"y4";"y5";"y6"] +`taum y1 y2 y3 y4 y5 y6 = taum y3 y2 y1 y6 y5 y4` +[ + ((use_arg_then2 ("Nonlinear_lemma.dih_y_sym", [Nonlinear_lemma.dih_y_sym])) (fun arg -> thm_tac MP_TAC arg THEN (move ["sym"]))); + ((((use_arg_then2 ("eq_sym", [eq_sym]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Sphere.taum", [Sphere.taum]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Sphere.sol_y", [Sphere.sol_y]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("Sphere.lnazim", [Sphere.lnazim]))(thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sym", [])) (fun fst_arg -> (use_arg_then2 ("y3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sym", [])) (fun fst_arg -> (use_arg_then2 ("y2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sym", [])) (fun fst_arg -> (use_arg_then2 ("y1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`a + b + c - d = c + b + a - d:real`))) (term_tac (have_gen_tac ["a"; "b"; "c"; "d"](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((use_arg_then2 ("Sphere.sol_y", [Sphere.sol_y]))(gsym_then (thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`a + b + c = c + b + a:real`))) (term_tac (have_gen_tac ["a"; "b"; "c"](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("Sphere.lnazim", [Sphere.lnazim]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((use_arg_then2 ("Sphere.taum", [Sphere.taum]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_var (mk_var ("E", (`:(real^3->bool)->bool`))));; +(Sections.add_section_hyp "fanV" (`FAN (vec 0,V,E)`));; +(Sections.add_section_hyp "f_surr" (`fully_surrounded (V,E)`));; + +(* Let dart1_eq *) +Sections.add_section_lemma "dart1_eq" (Sections.section_proof [] +`dart_of_fan (V,E) = dart1_of_fan (V,E)` +[ + ((((use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Let dartH *) +Sections.add_section_lemma "dartH" (Sections.section_proof [] +`dart (hypermap_of_fan (V,E)) = dart_of_fan (V,E)` +[ + ((((use_arg_then2 ("COMPONENTS_HYPERMAP_OF_FAN", [COMPONENTS_HYPERMAP_OF_FAN]))(thm_tac (new_rewrite [] [])))) THEN (done_tac)); +]);; + +(* Lemma fully_surrounded_enclosed *) +let fully_surrounded_enclosed = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + ==> let w' = sigma_fan (vec 0) V E v w in + let u = sigma_fan (vec 0) V E w' v in + let y1 = norm v in + let y2 = norm w in + let y3 = norm w' in + let y4 = dist(w,w') in + let y5 = dist(v,w') in + let y6 = dist(v,w) in + let y7 = norm u in + let y8 = dist(w',u) in + let y9 = dist(w,u) in + dist (v,u) = enclosed y1 y5 y6 y4 y2 y3 y7 y8 y9` +[ + ((BETA_TAC THEN (move ["vw_in"])) THEN (repeat_tactic 11 0 ((CONV_TAC let_CONV)))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E w' v`))) (term_tac (set_tac "u"))); + (((use_arg_then2 ("Enclosed.enclosed", [Enclosed.enclosed]))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE Collect_geom2.CAYLEYR_5POINTS))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0:real^3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("u", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DIST_0", [DIST_0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Mur.muR", [Mur.muR]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`muR _1 _2 _3 _4 _5 _6 _7 _8 _9`))) (term_tac (set_tac "p"))); + (BETA_TAC THEN (move ["p0"])); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`quadratic_root_plus (abc_of_quadratic p) = dist (u,v) pow 2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + (((((use_arg_then2 ("POW_2_SQRT", [POW_2_SQRT]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("DIST_POS_LE", [DIST_POS_LE]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`?a b c x. (p = \x. a * x pow 2 + b * x + c) + /\ &0 < a /\ &0 <= b pow 2 - &4 * a * c + /\ (p (dist (x, v) * dist (x, v)) = &0 /\ dist (x, v) < dist (u, v) + \/ b pow 2 - &4 * a * c = &0)`))) (term_tac (have_gen_tac []ALL_TAC)))); + (BETA_TAC THEN (case THEN (move ["a"])) THEN (case THEN (move ["b"])) THEN (case THEN (move ["c"])) THEN (case THEN (move ["x"])) THEN (case THEN (move ["p_eq"])) THEN (case THEN (move ["a_gt0"])) THEN (case THEN (move ["disc_ge0"])) THEN (move ["h"])); + ((((use_arg_then2 ("p_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Nonlinear_lemma.abc_quadratic", [Nonlinear_lemma.abc_quadratic]))(thm_tac (new_rewrite [] []))))); + ((THENL_ROT (-1)) ((THENL) (((use_arg_then2 ("h", [])) (disch_tac [])) THEN (clear_assumption "h") THEN case) [((case THEN (move ["px0"])) THEN (move ["dist_lt"])); (move ["disc0"])])); + (((use_arg_then2 ("quadratic_root_plus_disc0_eq", [quadratic_root_plus_disc0_eq])) (disch_tac [])) THEN (clear_assumption "quadratic_root_plus_disc0_eq") THEN (DISCH_THEN apply_tac)); + (((((use_arg_then2 ("disc0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_POS_NZ", [REAL_POS_NZ]))(thm_tac (new_rewrite [] [])))) THEN ((simp_tac THEN TRY done_tac)) THEN (((use_arg_then2 ("p0", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("p_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((((use_arg_then2 ("quadratic_root_plus_gt_eq", [quadratic_root_plus_gt_eq])) (disch_tac [])) THEN (clear_assumption "quadratic_root_plus_gt_eq") THEN (DISCH_THEN apply_tac)) THEN ((fun arg_tac -> arg_tac (Arg_term (`dist (x, v) * dist (x, v)`))) (term_tac exists_tac))); + ((((use_arg_then2 ("a_gt0", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("disc_ge0", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("px0", [])) (disch_tac [])) THEN (clear_assumption "px0") THEN ((use_arg_then2 ("p0", [])) (disch_tac [])) THEN (clear_assumption "p0") THEN BETA_TAC) THEN (((((use_arg_then2 ("p_eq", []))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))) THEN (simp_tac))); + (((((use_arg_then2 ("REAL_LT_SQUARE_ABS", [REAL_LT_SQUARE_ABS]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_ABS_NORM", [REAL_ABS_NORM]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("dist", [dist]))(gsym_then (thm_tac (new_rewrite [] []))))))) THEN (done_tac)); + ((((use_arg_then2 ("p_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Mur.muRa)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("FUN_EQ_THM", [FUN_EQ_THM]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Collect_geom.LEMMA50)))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`ups_x _1 _2 _3`))) (term_tac (set_tac "a"))); + ((fun arg_tac -> arg_tac (Arg_term (`cayleytr _1 _2 _3 _4 _5 _6 _7 _8 _9 _10`))) (term_tac (set_tac "b"))); + ((fun arg_tac -> arg_tac (Arg_term (`cayleyR _1 _2 _3 _4 _5 _6 _7 _8 _9 _10`))) (term_tac (set_tac "c"))); + ((fun arg_tac -> arg_tac (Arg_term (`reflection (w cross w') u`))) (term_tac (set_tac "y"))); + (((((use_arg_then2 ("a", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("b", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("c", [])) (term_tac exists_tac)) THEN ((use_arg_then2 ("y", [])) (term_tac exists_tac))) THEN (simp_tac)) THEN (split_tac)); + (((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem ((GEN_ALL o let_RULE) Trigonometry2.NOT_COLLINEAR_IMP_UPS_LT))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0:real^3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + (((repeat_tactic 1 9 (((use_arg_then2 ("DIST_0", [DIST_0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (DISCH_THEN apply_tac)); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_not_coplanar", [fully_surrounded_not_coplanar])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("Planarity.notcoplanar_imp_notcollinear_fan", [Planarity.notcoplanar_imp_notcollinear_fan])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC); + ((((((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Collect_geom.PER_SET3)))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (split_tac); + ((((use_arg_then2 ("b_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("c_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Collect_geom.DISCRIMINANT_OF_CAY)))(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("DELTA_EQ_DELTA_X", [DELTA_EQ_DELTA_X]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("Sphere.delta_y", [Sphere.delta_y]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("u", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))); + ((THENL_LAST) (repeat_tactic 1 9 (((use_arg_then2 ("REAL_LE_MUL", [REAL_LE_MUL]))(thm_tac (new_rewrite [] []))))) ((arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE delta_y_pos)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_card_face_alt", [fully_surrounded_card_face_alt])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN case THEN (move ["card_f"])); + ((DISJ2_TAC) THEN ((((use_arg_then2 ("b_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("a_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("c_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Collect_geom.DISCRIMINANT_OF_CAY)))(thm_tac (new_rewrite [] [])))))); + ((repeat_tactic 1 9 (((use_arg_then2 ("DELTA_EQ_DELTA_X", [DELTA_EQ_DELTA_X]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("Sphere.delta_y", [Sphere.delta_y]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("u", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`u = w`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((((use_arg_then2 ("u_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE TRIANGULAR_FACE))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_ENTIRE", [REAL_ENTIRE]))(thm_tac (new_rewrite [] []))))) THEN (DISJ2_TAC) THEN (DISJ2_TAC)); + ((((use_arg_then2 ("Sphere.delta_y", [Sphere.delta_y]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DELTA_EQ_DELTA_X", [DELTA_EQ_DELTA_X]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("Trigonometry1.DIST_L_ZERO", [Trigonometry1.DIST_L_ZERO]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] []))))))); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE Collect_geom.POLFLZY)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("Ckqowsa_3_points.coplanar_eq_coplanar_alt", [Ckqowsa_3_points.coplanar_eq_coplanar_alt]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((use_arg_then2 ("DIMINDEX_3", [DIMINDEX_3]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac)); + (((fun arg_tac -> arg_tac (Arg_theorem ((GEN_ALL o CONJUNCT2) Collect_geom2.PER_SET4)))(thm_tac (new_rewrite [] [])))); + ((((use_arg_then2 ("COPLANAR_SMALL", [COPLANAR_SMALL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("CARD_CLAUSES", [CARD_CLAUSES]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac ->(use_arg_then2 ("FINITE_INSERT", [FINITE_INSERT]))(fun tmp_arg1 -> (use_arg_then2 ("FINITE_EMPTY", [FINITE_EMPTY]))(fun tmp_arg2 -> arg_tac (Arg_theorem (CONJ (get_arg_thm tmp_arg1) (get_arg_thm tmp_arg2))))))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + (((repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (simp_tac) THEN (((use_arg_then2 ("Geomdetail.CARD3", [Geomdetail.CARD3]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((DISJ1_TAC) THEN (split_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE Collect_geom2.CAYLEYR_5POINTS))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0:real^3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`vec 0`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("DIST_0", [DIST_0]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("REAL_POW_2", [REAL_POW_2]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("y", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("y_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("norm_reflection", [norm_reflection]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("dist_reflection_special", [dist_reflection_special]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DOT_CROSS_SELF", [DOT_CROSS_SELF]))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + ((repeat_tactic 1 9 (((use_arg_then2 ("dist", [dist]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_ABS_NORM", [REAL_ABS_NORM]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (use_arg_then2 ("REAL_ABS_NORM", [REAL_ABS_NORM])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`u - v:real^3`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LT_SQUARE_ABS", [REAL_LT_SQUARE_ABS]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("dist", [dist]))(gsym_then (thm_tac (new_rewrite [] []))))))); + ((((use_arg_then2 ("y_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dist_reflection_lemma", [dist_reflection_lemma]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> arg_tac (Arg_term (`w cross w'`))) (term_tac (set_tac "n"))); + ((fun arg_tac -> arg_tac (Arg_term (`~(n = vec 0)`))) (term_tac (have_gen_tac [](move ["n0"])))); + ((((use_arg_then2 ("n_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("CROSS_EQ_0", [CROSS_EQ_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_not_coplanar", [fully_surrounded_not_coplanar])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN (fun snd_th -> (use_arg_then2 ("Planarity.notcoplanar_imp_notcollinear_fan", [Planarity.notcoplanar_imp_notcollinear_fan])) (thm_tac (match_mp_then snd_th MP_TAC)))) THEN BETA_TAC THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`&0 < v dot n /\ u dot n < &0`))) (term_tac (have_gen_tac [](move ["ineqs"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`&4 * _`))) (term_tac (set_tac "t"))); + ((THENL_FIRST) (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`t < &0`))) (term_tac (have_gen_tac []ALL_TAC)))) ((arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("t_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_LT_NEG", [REAL_LT_NEG]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("REAL_NEG_0", [REAL_NEG_0]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NEG_RMUL", [REAL_NEG_RMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_LT_MUL", [REAL_LT_MUL]))(thm_tac (new_rewrite [] []))))); + ((THENL_FIRST) (((((use_arg_then2 ("real_div", [real_div]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NEG_LMUL", [REAL_NEG_LMUL]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NEG_RMUL", [REAL_NEG_RMUL]))(thm_tac (new_rewrite [] []))))) THEN (split_tac)) ((arith_tac) THEN (done_tac))); + ((repeat_tactic 1 9 (((use_arg_then2 ("REAL_LT_MUL", [REAL_LT_MUL]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("REAL_LT_INV", [REAL_LT_INV]))(thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 0 10 (((use_arg_then2 ("DOT_POS_LT", [DOT_POS_LT]))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN BETA_TAC) THEN (arith_tac) THEN (done_tac)); + ((((use_arg_then2 ("n_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [1] []))))) THEN (((use_arg_then2 ("fully_surrounded_dot_cross", [fully_surrounded_dot_cross]))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] []))))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] []))))); + (BETA_TAC THEN (case THEN (move ["fan2"])) THEN (case THEN (move ["dart2_eq"])) THEN (move ["f_surr2"])); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`&0 < w' dot (w cross u)`))) (term_tac (have_gen_tac []ALL_TAC)))); + (((((use_arg_then2 ("CROSS_SKEW", [CROSS_SKEW]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DOT_RNEG", [DOT_RNEG]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DOT_SYM", [DOT_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("Trigonometry1.cross_triple", [Trigonometry1.cross_triple]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DOT_SYM", [DOT_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("REAL_NEG_GT0", [REAL_NEG_GT0]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`u = sigma_fan (vec 0) V ({w,w'} INSERT E) w' w`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] [])))))))); + (((((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_dot_cross", [fully_surrounded_dot_cross])) (fun fst_arg -> (use_arg_then2 ("fan2", [fan2])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr2", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE n_split_fan_face))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_f", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["eq1"]) THEN (move ["_"]))))); + ((((use_arg_then2 ("eq1", [])) (disch_tac [])) THEN (clear_assumption "eq1") THEN BETA_TAC) THEN (((((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("n_fan_pair", [n_fan_pair]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("u_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; +(Sections.add_section_hyp "subV" (`V SUBSET ball_annulus`));; + +(* Lemma fully_surrounded_tau_eq_tauq *) +let fully_surrounded_tau_eq_tauq = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,E) + /\ CARD (face (hypermap_of_fan (V,E)) (v,w)) = 4 + ==> let w' = sigma_fan (vec 0) V E v w in + let u = sigma_fan (vec 0) V E w' v in + let y1 = norm v in + let y2 = norm w in + let y3 = norm w' in + let y4 = dist(w,w') in + let y5 = dist(v,w') in + let y6 = dist(v,w) in + let y7 = norm u in + let y8 = dist(w',u) in + let y9 = dist(w,u) in + tauVEF (V,E,face (hypermap_of_fan (V,E)) (v,w)) = tauq y1 y2 y3 y4 y5 y6 y7 y8 y9` +[ + ((BETA_TAC THEN (case THEN ((move ["vw_in"]) THEN (move ["card4"])))) THEN (repeat_tactic 11 0 ((CONV_TAC let_CONV)))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fan_split_fan_face", [fan_split_fan_face])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE face_split_fan_face_explicit))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((THENL_FIRST) (((((use_arg_then2 ("card4", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `4 - 1 = 3`)))(thm_tac (new_rewrite [] []))))) THEN (ANTS_TAC)) ((arith_tac) THEN (done_tac))); + (((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E v w`))) (term_tac (set_tac "w'"))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _ V E w' v`))) (term_tac (set_tac "w2"))); + ((fun arg_tac -> arg_tac (Arg_term (`_ INSERT E`))) (term_tac (set_tac "E2"))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan (V,E2)`))) (term_tac (set_tac "H2"))); + (BETA_TAC THEN (case THEN (move ["_"])) THEN (case THEN (move ["cards_eq"])) THEN (case THEN (move ["in_face"])) THEN (move ["neqs"]) THEN (case THEN (move ["fan2"])) THEN (case THEN (move ["dart2_eq"])) THEN (move ["f_surr2"])); + ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart_of_fan (V,E2) /\ w',w IN dart_of_fan (V,E2)`))) (term_tac (have_gen_tac [](move ["all_in2"])))); + (((((use_arg_then2 ("dart2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("IN_INSERT", [IN_INSERT]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("vw_in", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((THENL_FIRST) (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE tau_split_fan_face_add))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) ((((use_arg_then2 ("card4", []))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + ((((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("E2_def", []))(thm_tac (new_rewrite [] []))))); + ((repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (let_RULE fully_surrounded_tau_eq_taum)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac))); + ((fun arg_tac -> arg_tac (Arg_term (`hypermap_of_fan (V,E)`))) (term_tac (set_tac "H"))); + ((fun arg_tac -> arg_tac (Arg_term (`split_fan_face (V,E) (v,w) = (V,E2)`))) (term_tac (have_gen_tac [](move ["split_eq"])))); + (((((use_arg_then2 ("split_fan_face", [split_fan_face]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("E2_def", []))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E2 v w = w'`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`n_fan_pair (V,E2) (v,w) = n_fan_pair (V,E) (v,w)`))) (term_tac (have_gen_tac []ALL_TAC)))); + ((((repeat_tactic 1 9 (((use_arg_then2 ("n_fan_pair", [n_fan_pair]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((((use_arg_then2 ("split_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("n_split_fan_face_eq1", [n_split_fan_face_eq1])) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("FST", [FST]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((use_arg_then2 ("neqs", []))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)); + (((((use_arg_then2 ("split_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart2_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("IN_UNION", [IN_UNION]))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan (vec 0) V E2 w' w = w2`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))); + (((THENL_ROT 1)) ((fun arg_tac -> arg_tac (Arg_term (`n_fan_pair (V,E2) (w',w) = n_fan_pair (V,E) (w',v)`))) (term_tac (have_gen_tac []ALL_TAC)))); + ((((repeat_tactic 1 9 (((use_arg_then2 ("n_fan_pair", [n_fan_pair]))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w2_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("PAIR_EQ", [PAIR_EQ]))(thm_tac (new_rewrite [] []))))) THEN ALL_TAC THEN (case THEN (move ["_"])) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE n_split_fan_face))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)); + ((((((use_arg_then2 ("H_def", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("card4", []))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `3 < 4`)))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (((use_arg_then2 ("split_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_def", []))(thm_tac (new_rewrite [] []))))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("Sphere.tauq", [Sphere.tauq]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("taum_sym", [taum_sym])) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`norm w2`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Finalization of the section EnclosedTauq *) +let taum_sym = Sections.finalize_theorem taum_sym;; +let fully_surrounded_enclosed = Sections.finalize_theorem fully_surrounded_enclosed;; +let fully_surrounded_tau_eq_tauq = Sections.finalize_theorem fully_surrounded_tau_eq_tauq;; +Sections.end_section "EnclosedTauq";; + +(* Section Contravening *) +Sections.begin_section "Contravening";; +(Sections.add_section_var (mk_var ("V", (`:real^3->bool`))));; +(Sections.add_section_hyp "contrV" (`contravening V`));; + +(* Let fanV *) +Sections.add_section_lemma "fanV" (Sections.section_proof [] +`FAN (vec 0,V,ESTD V)` +[ + (((fun arg_tac -> (use_arg_then2 ("CONTRAVENING_FAN", [CONTRAVENING_FAN])) (fun fst_arg -> (use_arg_then2 ("contrV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +]);; + +(* Let f_surr *) +Sections.add_section_lemma "f_surr" (Sections.section_proof [] +`fully_surrounded (V,ESTD V)` +[ + (((fun arg_tac -> (use_arg_then2 ("CONTRAVENING_IMP_FULLY_SURROUNDED", [CONTRAVENING_IMP_FULLY_SURROUNDED])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +]);; + +(* Let dart1_eq *) +Sections.add_section_lemma "dart1_eq" (Sections.section_proof [] +`dart_of_fan (V,ESTD V) = dart1_of_fan (V,ESTD V)` +[ + (((fun arg_tac -> (use_arg_then2 ("fully_surrounded_dart_of_fan_eq", [fully_surrounded_dart_of_fan_eq])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (exact_tac)); +]);; + +(* Lemma contravening_non_triangular_face_dist *) +let contravening_non_triangular_face_dist = Sections.section_proof ["v";"w"] +`v,w IN dart_of_fan (V,ESTD V) + /\ 3 < CARD (face (hypermap_of_fan (V,ESTD V)) (v,w)) + ==> let w' = sigma_fan (vec 0) V (ESTD V) v w in + let y1 = norm v in + let y2 = norm w in + let y3 = norm w' in + let y4 = dist (w,w') in + let y5 = dist (v,w') in + let y6 = dist (v,w) in + (&2 <= y1 /\ y1 <= &2 * h0) /\ + (&2 <= y2 /\ y2 <= &2 * h0) /\ + (&2 <= y3 /\ y3 <= &2 * h0) /\ + (&2 * h0 <= y4 /\ y4 <= &4 * h0) /\ + (&2 <= y5 /\ y5 <= &2 * h0) /\ + (&2 <= y6 /\ y6 <= &2 * h0)` +[ + ((BETA_TAC THEN (case THEN ((move ["vw_in"]) THEN (move ["card_gt3"])))) THEN (repeat_tactic 1 9 ((CONV_TAC let_CONV)))); + ((((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (ARITH_RULE `&2 * #1.26 = #2.52 /\ &2 = #2.0`)))(thm_tac (new_rewrite [] [])))))); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`v,w IN dart1_of_fan (V,ESTD V)`))) (term_tac (have_gen_tac [](move ["vw_in1"])))) ((((use_arg_then2 ("dart1_eq", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (done_tac))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sigma_fan_inV", [sigma_fan_inV])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["w'_in"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sigma_in_dart1", [sigma_in_dart1])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in1", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["vw'_in"]))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("sigma_fan_not_fixed", [sigma_fan_not_fixed])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["w'_neq_w"]))); + ((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("fully_surrounded_diag_not_in_dart", [fully_surrounded_diag_not_in_dart])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_gt3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (move ["not_diag"]))); + ((fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("PAIR_IN_DART_OF_FAN", [PAIR_IN_DART_OF_FAN])) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN (case THEN ((move ["v_in"]) THEN (move ["w_in"]))))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _1 V _2 v w`))) (term_tac (set_tac "w'"))); + ((repeat_tactic 1 9 (((use_arg_then2 ("Trigonometry1.DIST_L_ZERO", [Trigonometry1.DIST_L_ZERO]))(gsym_then (thm_tac (new_rewrite [] [])))))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("CONTRAVENING_DIST", [CONTRAVENING_DIST])) (fun fst_arg -> (use_arg_then2 ("contrV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))); + (((((use_arg_then2 ("andbC", [andbC]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 0 4 (((fun arg_tac -> (use_arg_then2 ("CONTRAVENING_DART_DIST", [CONTRAVENING_DART_DIST])) (fun fst_arg -> (use_arg_then2 ("contrV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN ((TRY done_tac)) THEN (repeat_tactic 1 9 (((use_arg_then2 ("andTb", [andTb]))(thm_tac (new_rewrite [] [])))))) THEN (split_tac)); + ((((use_arg_then2 ("not_diag", [])) (disch_tac [])) THEN (clear_assumption "not_diag") THEN BETA_TAC) THEN ((((use_arg_then2 ("dart1_eq", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("dart1_of_fan", [dart1_of_fan]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("IN_ELIM_THM", [IN_ELIM_THM]))(thm_tac (new_rewrite [] [])))) THEN (simp_tac) THEN (repeat_tactic 1 9 (((use_arg_then2 ("NOT_EXISTS_THM", [NOT_EXISTS_THM]))(thm_tac (new_rewrite [] []))))))); + ((((fun arg_tac -> (fun arg_tac -> (conv_thm_tac DISCH_THEN) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (thm_tac MP_TAC)) THEN BETA_TAC) THEN ((simp_tac) THEN (((use_arg_then2 ("IN_ESTD", [IN_ESTD]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_in", []))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("w'_neq_w", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (arith_tac) THEN (done_tac)); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (use_arg_then2 ("DIST_TRIANGLE_LE", [DIST_TRIANGLE_LE])) (fun fst_arg -> (use_arg_then2 ("w", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("v", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (disch_tac [])) THEN (DISCH_THEN apply_tac)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`&4 * #1.26 = #2.52 + #2.52`))) (term_tac (have_gen_tac [](((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))))) ((arith_tac) THEN (done_tac))); + (((((use_arg_then2 ("REAL_LE_ADD2", [REAL_LE_ADD2]))(thm_tac (new_rewrite [] [])))) THEN (((use_arg_then2 ("DIST_SYM", [DIST_SYM]))(thm_tac (new_rewrite [] [])))) THEN (((fun arg_tac -> (use_arg_then2 ("DIST_SYM", [DIST_SYM])) (fun fst_arg -> (use_arg_then2 ("w'", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> (use_arg_then2 ("CONTRAVENING_DART_DIST", [CONTRAVENING_DART_DIST])) (fun fst_arg -> (use_arg_then2 ("contrV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); +];; + +(* Section Ineqs *) +Sections.begin_section "Ineqs";; +(Sections.add_section_hyp "ineqs" (`kcblrqc_ineq_def`));; + +(* Lemma non_triangular_face_azim_dart_bound *) +let non_triangular_face_azim_dart_bound = Sections.section_proof ["d"] +`d IN dart_of_fan (V,ESTD V) + /\ 3 < CARD (face (hypermap_of_fan (V,ESTD V)) d) + ==> #1.15 < azim_dart (V,ESTD V) d` +[ + (((use_arg_then2 ("d", [])) (disch_tac [])) THEN (clear_assumption "d") THEN case THEN (move ["v"]) THEN (move ["w"]) THEN (case THEN ((move ["vw_in"]) THEN (move ["card_gt3"])))); + ((((fun arg_tac -> arg_tac (Arg_theorem (let_RULE CONTRAVENING_AZIM_DART_EQ_DIH_Y)))(thm_tac (new_rewrite [] [])))) THEN ((TRY done_tac)) THEN (((use_arg_then2 ("real_gt", [real_gt]))(gsym_then (thm_tac (new_rewrite [] [])))))); + ((fun arg_tac -> arg_tac (Arg_term (`sigma_fan _1 V _2 v w`))) (term_tac (set_tac "w'"))); + (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL Tame_inequalities.DIH_Y_INEQ))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`norm v`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`norm w`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`norm w'`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dist (w,w')`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dist (v,w')`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (fun arg_tac -> arg_tac (Arg_term (`dist (v,w)`))) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun arg -> thm_tac MP_TAC arg THEN ALL_TAC)) THEN (ANTS_TAC)); + ((((use_arg_then2 ("ineqs", [])) (disch_tac [])) THEN (clear_assumption "ineqs") THEN BETA_TAC) THEN ((((use_arg_then2 ("kcblrqc_ineq_def", [kcblrqc_ineq_def]))(thm_tac (new_rewrite [] [])))) THEN (((conv_thm_tac DISCH_THEN)(thm_tac (new_rewrite [] []))))) THEN (done_tac)); + (((((use_arg_then2 ("INEQ_ALT", [INEQ_ALT]))(thm_tac (new_rewrite [] [])))) THEN (repeat_tactic 1 9 (((fun arg_tac -> arg_tac (Arg_theorem (GEN_ALL ALL)))(thm_tac (new_rewrite [] []))))) THEN (simp_tac)) THEN (ANTS_TAC)); + ((THENL_FIRST) ((fun arg_tac -> arg_tac (Arg_term (`#2.0 = &2 /\ #2.52 = &2 * h0 /\ #5.04 = &4 * h0`))) (term_tac (have_gen_tac [](move ["eqs"])))) ((((use_arg_then2 ("h0", [h0]))(thm_tac (new_rewrite [] [])))) THEN (arith_tac) THEN (done_tac))); + (((repeat_tactic 1 9 (((use_arg_then2 ("eqs", []))(thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (repeat_tactic 12 0 (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE contravening_non_triangular_face_dist))) (fun fst_arg -> (use_arg_then2 ("vw_in", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("card_gt3", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] [])))))) THEN (done_tac)); + (((((use_arg_then2 ("REAL_NOT_LT", [REAL_NOT_LT]))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((use_arg_then2 ("w'_def", []))(gsym_then (thm_tac (new_rewrite [] []))))) THEN (((fun arg_tac -> (fun arg_tac -> (fun arg_tac -> arg_tac (Arg_theorem (let_RULE fully_surrounded_delta_pos))) (fun fst_arg -> (use_arg_then2 ("fanV", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg))) (fun fst_arg -> (use_arg_then2 ("f_surr", [])) (fun snd_arg -> combine_args_then arg_tac fst_arg snd_arg)))(thm_tac (new_rewrite [] []))))) THEN (done_tac)); +];; + +(* Finalization of the section Ineqs *) +let non_triangular_face_azim_dart_bound = Sections.finalize_theorem non_triangular_face_azim_dart_bound;; +Sections.end_section "Ineqs";; + +(* Finalization of the section Contravening *) +let contravening_non_triangular_face_dist = Sections.finalize_theorem contravening_non_triangular_face_dist;; +let non_triangular_face_azim_dart_bound = Sections.finalize_theorem non_triangular_face_azim_dart_bound;; +Sections.end_section "Contravening";; + +(* Close the module *) +end;; diff --git a/text_formalization/tame/tame_concl.hl b/text_formalization/tame/tame_concl.hl new file mode 100644 index 0000000..19ffb53 --- /dev/null +++ b/text_formalization/tame/tame_concl.hl @@ -0,0 +1,108 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Conclusions *) +(* Chapter: Tame Hypermap *) +(* Author: Thomas C. Hales *) +(* Date: 2010-02-27 *) +(* ========================================================================== *) + +(* +Conclusions file for Tame Hypermap +*) + + +flyspeck_needs "hypermap/hypermap.hl";; +flyspeck_needs "fan/fan_defs.hl";; +flyspeck_needs "packing/pack_defs.hl";; +flyspeck_needs "tame/tame_defs.hl";; + +module Tame_concl = struct + + let PPHEUFG_concl = `!(H:(A)hypermap). tame_hypermap H <=> tame_hypermap (opposite_hypermap H)`;; + + let RUNOQPQ_concl = `!(H:(A)hypermap). tame_hypermap H ==> restricted_hypermap H`;; + + (* WTEMDTA_concl skipped. Tame hypermap classification theorem. *) + + let UBHDEUU1_concl = `! V. packing V /\ V SUBSET ball_annulus ==> FAN(vec 0, V, ESTD V)`;; + + let UBHDEUU2_concl = `! V. packing V /\ V SUBSET ball_annulus ==> FAN(vec 0, V, ECTC V)`;; + + let FATUGPD_concl = `!V. packing V /\ V SUBSET ball_annulus ==> + (?W phi. BIJ phi V W /\ (!v. v IN V ==> norm(v) = norm(phi v)) /\ + (!w. w IN W ==> (set_of_edge w W (ECTC W) = {}) \/ (surrounded_node (W,(ECTC W)) w)))`;; + + let FJLBXS_concl = `!V. packing V /\ V SUBSET ball_annulus ==> + (?W phi. BIJ phi V W /\ (!v. v IN V ==> norm(v) = norm(phi v)) /\ + (!w. w IN W ==> (set_of_edge w W (ESTD W) = {}) \/ (surrounded_node (W,(ESTD W)) w)))`;; + + let FCDJDOT_concl = `(?W. packing W /\ W SUBSET ball_annulus /\ scriptL W > &12) ==> + (?V. contravening V)`;; + + let HRXEFDM_concl = `!V. contravening V ==> + ( sum (face_set_of_fan (V,ESTD V)) (\ f. tauVEF (V,ESTD V,f) ) < &4 * pi - &20 * sol0 )`;; + + let JGTDEBU1_concl = `!V. contravening V ==> + planar_hypermap (hypermap_of_fan (V, ESTD V))`;; + + let JGTDEBU2_concl = `!V. contravening V ==> + plain_hypermap (hypermap_of_fan (V, ESTD V))`;; + + let JGTDEBU3_concl = `!V. contravening V ==> + connected_hypermap (hypermap_of_fan (V, ESTD V))`;; + + let JGTDEBU4_concl = `!V. contravening V ==> + simple_hypermap (hypermap_of_fan (V, ESTD V))`;; + + let JGTDEBU5_concl = `!V. contravening V ==> + is_edge_nondegenerate (hypermap_of_fan (V, ESTD V))`;; + + let JGTDEBU6_concl = `!V. contravening V ==> + no_loops (hypermap_of_fan (V, ESTD V))`;; + + let JGTDEBU7_concl = `!V. contravening V ==> + is_no_double_joints (hypermap_of_fan (V, ESTD V))`;; + + let JGTDEBU8_concl = `!V. contravening V ==> + number_of_faces (hypermap_of_fan (V, ESTD V)) >= 3 `;; + + let JGTDEBU10_concl = `!V. contravening V ==> + tame_10 (hypermap_of_fan (V, ESTD V))`;; + + let JGTDEBU11_concl = `!V. contravening V ==> + tame_11a (hypermap_of_fan (V, ESTD V))`;; + + let CDTETAT_concl = `!V x. contravening V /\ x IN dart_of_fan (V,ESTD V) /\ tame_hypermap_calcs ==> + (let (p,q,r) = type_of_node (hypermap_of_fan (V, ESTD V)) x in + ((p,q+r) IN { (0,3), (0,4), (0,5), (1,2), (1,3), (1,4), + (2,1), (2,2), (2,3), (3,1), (3,2), (3,3), + (4,0), (4,1),(4,2), (5,0), (5,1), + (6,0), (6,1), (7,0) }))`;; + + let SZIPOAS_concl = `!V. contravening V /\ tame_hypermap_calcs ==> + tame_11b (hypermap_of_fan (V, ESTD V))`;; + + let KCBLRQC_concl = `!V x. contravening V /\ x IN dart_of_fan (V,ESTD V) /\ tame_hypermap_calcs ==> + (let H = hypermap_of_fan (V,ESTD V) in + let (p,q,r) = type_of_node H x in + (r > 0) \/ (sum (set_of_face_meeting_node H x) (\ f. tauVEF (V,ESTD V,f)) >= b_tame p q))`;; + + let BDJYFFB1_concl = `!V x. contravening V /\ x IN dart_of_fan (V, ESTD V) /\ tame_hypermap_calcs ==> + tame_12o ( hypermap_of_fan (V,ESTD V) ) `;; + + let BDJYFFB2_concl = `!V x. contravening V /\ x IN dart_of_fan (V, ESTD V) /\ tame_hypermap_calcs ==> + (let H = hypermap_of_fan (V,ESTD V) in + (type_of_node H x = (5,0,1)) ==> + sum {f | f IN set_of_face_meeting_node H x /\ CARD(f)=3 } (\f. tauVEF (V, ESTD V,f)) > #0.63)`;; + + let CRTTXAT_concl = `!V. contravening V /\ tame_hypermap_calcs /\ (perimeterbound (V, ESTD V))==> + tame_9a (hypermap_of_fan (V, ESTD V))`;; + + +(* main result of the chapter. *) + + let MQMSMAB_concl = `!V. contravening V /\ tame_hypermap_calcs /\ (perimeterbound (V, ESTD V))==> + tame_hypermap (hypermap_of_fan (V, ESTD V))`;; + +end;; diff --git a/text_formalization/tame/tame_defs.hl b/text_formalization/tame/tame_defs.hl new file mode 100644 index 0000000..c1a869c --- /dev/null +++ b/text_formalization/tame/tame_defs.hl @@ -0,0 +1,312 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Definitions *) +(* Chapter: Tame Hypermap *) +(* Author: Thomas C. Hales *) +(* Date: 2010-02-27 *) +(* ========================================================================== *) + +(* +Definitions file for Tame Hypermap +*) + +flyspeck_needs "hypermap/hypermap.hl";; +flyspeck_needs "fan/fan_defs.hl";; +flyspeck_needs "packing/pack_defs.hl";; + +module Tame_defs = struct + + + + +(* +let edge_nondegenerate = new_definition `edge_nondegenerate (H:(A)hypermap) + <=> !(x:A).(x IN dart H) ==> ~ (edge_map H x = x)`;; +*) + +let is_edge_nondegenerate = new_definition `is_edge_nondegenerate (H:(A)hypermap) <=> + (!x:A. x IN dart H ==> ~(edge_map H x = x))`;; + +let is_node_nondegenerate = new_definition `is_node_nondegenerate (H:(A)hypermap) <=> + (!x:A. x IN dart H ==> ~(node_map H x = x))`;; + + + +(* no_loops does not restrict x,y to be darts. But edge H is the + identitiy outside darts, so this is OK. *) + +let no_loops = new_definition `no_loops (H:(A) hypermap) <=> ! (x:A) (y:A). x IN edge H y /\ x IN node H y ==> x = y`;; + +(* this definition is more complicated than it needs to be. It is + better to use hypermap.hl is_no_double_joints *) + +(* + let hypermap_no_double_joins = new_definition + `hypermap_no_double_joins (H:(A) hypermap) <=> + ! (x:A) (y:A) (z:A) (t:A) (u:A) (v:A). x IN node H z /\ y IN (edge H x INTER node H t) /\ ~ (x = y) + /\ ~(z IN node H t) /\ u IN node H z /\ v IN (edge H u INTER node H t) + /\ ~(u = v) ==> x IN edge H u`;; +*) + +let is_no_double_joints = new_definition `is_no_double_joints (H:(A)hypermap) + <=> (!x y. x IN dart H /\ y IN node H x /\ edge_map H y IN node H (edge_map H x) ==> x = y)`;; + +let exceptional_face = new_definition `exceptional_face (H:(A)hypermap) (x:A) <=> CARD (face H x) >= 5`;; + +let set_of_triangles_meeting_node = new_definition + `set_of_triangles_meeting_node (H:(A)hypermap) (x:A) = + {face H (y:A) |y | y IN dart H /\ CARD (face H y) = 3 /\ y IN node H x }`;; + +let set_of_quadrilaterals_meeting_node = new_definition + `set_of_quadrilaterals_meeting_node (H:(A)hypermap) (x:A) = + {face (H:(A)hypermap) (y:A)|y | y IN dart H /\ CARD (face H y) = 4 /\ y IN node H x}`;; + +let set_of_exceptional_meeting_node = new_definition + `set_of_exceptional_meeting_node (H:(A)hypermap) (x:A) = + {face H (y:A) | y | (y IN (dart H)) /\ (CARD (face H y) >= 5) /\ (y IN node H x)}`;; + +let set_of_face_meeting_node = new_definition + `set_of_face_meeting_node (H:(A)hypermap) (x:A) = + {face H (y:A)|y| y IN dart H /\ y IN node H x}`;; + +let type_of_node = new_definition + `type_of_node (H:(A)hypermap) (x:A) = + (CARD (set_of_triangles_meeting_node H x), + CARD (set_of_quadrilaterals_meeting_node H x), + CARD (set_of_exceptional_meeting_node H x ))`;; + +let node_type_exceptional_face = new_definition + `node_type_exceptional_face (H:(A)hypermap) (x:A) <=> + exceptional_face H x /\ (CARD (node H x) = 6) ==> type_of_node H x = (5,0,1)`;; + +let node_exceptional_face = new_definition + `node_exceptional_face (H:(A)hypermap) (x:A) <=> + exceptional_face H x ==> CARD (node H x) <= 6`;; + + +let tgt = new_definition `tgt = #1.541`;; + +(* b table constants corrected 2010-06-17 *) + + let b_tame = new_definition + `b_tame p q= + if p,q =0,3 then #0.618 + else if p,q=0,4 then #0.97 + else if p,q=1,2 then #0.656 + else if p,q=1,3 then #0.618 + else if p,q=2,1 then #0.797 + else if p,q=2,2 then #0.412 + else if p,q=2,3 then #1.2851 + else if p,q=3,1 then #0.311 + else if p,q=3,2 then #0.817 + else if p,q=4,0 then #0.347 + else if p,q=4,1 then #0.366 + else if p,q=5,0 then #0.04 + else if p,q=5,1 then #1.136 + else if p,q=6,0 then #0.686 + else if p,q=7,0 then #1.450 + else tgt`;; + + +let d_tame = new_definition `d_tame n = + if n = 3 then &0 else + if n = 4 then #0.206 else + if n = 5 then #0.4819 else + if n = 6 then #0.712 else tgt`;; + +(* tchales, changed n=6 case from 0.7578, 1/15/2012 to match May 2011 + redo in main_estimate_ineq.hl and graph generator. *) + +let a_tame = new_definition `a_tame = #0.63`;; + +let total_weight = new_definition + `total_weight (H:(A)hypermap) (w:(A->bool)->real) = sum (face_set H) w`;; + +let adm_1 = new_definition + `adm_1 (H:(A)hypermap) (w:(A->bool)->real) <=> (!x:A. x IN dart H ==> w (face H x) >= d_tame (CARD (face H x)))`;; + +let adm_2 = new_definition + `adm_2 (H:(A)hypermap) (w:(A->bool)->real) <=> + (!x:A. x IN dart H /\ (CARD (set_of_exceptional_meeting_node H x) = 0) ==> + ((sum (set_of_face_meeting_node H x) w) >= + (b_tame (CARD (set_of_triangles_meeting_node H x)) (CARD (set_of_quadrilaterals_meeting_node H x)))))`;; + +let adm_3 = new_definition + `adm_3 (H:(A)hypermap) (w:(A->bool)->real) <=> + (!x:A. x IN dart H /\ type_of_node H x = 5, 0, 1 ==> + (sum (set_of_triangles_meeting_node H x) w) >= a_tame)`;; + +let admissible_weight = new_definition + `admissible_weight (H:(A)hypermap) (w:(A->bool)->real) <=> + adm_1 H w /\ adm_2 H w /\ adm_3 H w`;; + + +(* def of tame *) + +let tame_1 = new_definition + `tame_1 (H:(A)hypermap) <=> + plain_hypermap (H:(A)hypermap) /\ planar_hypermap (H:(A)hypermap)`;; + +let tame_2 = new_definition + `tame_2 (H:(A)hypermap) <=> + connected_hypermap H /\ simple_hypermap H`;; + +let tame_3 = new_definition + `tame_3 (H:(A)hypermap) <=> is_edge_nondegenerate H `;; + +let tame_4 = new_definition + `tame_4 (H:(A)hypermap) <=> no_loops H`;; + +let tame_5a = new_definition + `tame_5a (H:(A)hypermap) <=> is_no_double_joints H`;; + +let tame_8 = new_definition + `tame_8 (H:(A)hypermap) <=> number_of_faces H >= 3`;; + +let tame_9a = new_definition + `tame_9a (H:(A)hypermap) <=> + (!(x:A). x IN dart H ==> CARD (face H x) >= 3 /\ CARD (face H x) <= 6)`;; + +let tame_10 = new_definition + `tame_10 (H:(A)hypermap) <=> + number_of_nodes H IN { 13, 14, 15 } `;; + +let tame_11a = new_definition + `tame_11a (H:(A)hypermap) <=> + (!(x:A). x IN dart H ==> CARD (node H x) >= 3)`;; + +let tame_11b = new_definition + `tame_11b (H:(A)hypermap) <=> + (!(x:A). x IN dart H ==> CARD (node H x) <= 7)`;; + +let tame_12o = new_definition + `tame_12o (H:(A)hypermap) <=> + (! (x:A). node_type_exceptional_face H x /\ node_exceptional_face H x)`;; + +let tame_13a = new_definition + `tame_13a (H:(A)hypermap) <=> + (?(w:(A->bool)->real). admissible_weight H w /\ total_weight H w < tgt)`;; + +let tame_hypermap = new_definition + `tame_hypermap (H:(A)hypermap) <=> + tame_1 H /\ tame_2 H /\ tame_3 H /\ tame_4 H /\ + tame_5a H /\ tame_8 H /\ tame_9a H /\ + tame_10 H /\ tame_11a H /\ tame_11b H /\ tame_12o H /\ tame_13a H`;; + +let opposite_hypermap = new_definition + `opposite_hypermap (H:(A)hypermap) = + hypermap ((dart H),face_map H o node_map H , inverse(node_map H),inverse(face_map H))`;; + + +let ESTD = new_definition + `ESTD (V:real^3->bool) = {{v,w}| v IN V /\ w IN V /\ ~(v = w) /\ dist(v,w) <= (&2)*h0}`;; + +let ECTC = new_definition + `ECTC (V:real^3 -> bool) = {{v,w}| v IN V /\ w IN V /\ ~(v = w) /\ dist(v,w) = &2 }`;; + +(* +let isolated_node = new_definition + `isolated_node v V E = (set_of_edge v V E = {})`;; +*) + +let azim_dart = new_definition + `azim_dart (V,E) (v,w) = if (v=w) then &2 * pi else azim_fan (vec 0) V E v w`;; + +let dart1_of_fan = new_definition + `dart1_of_fan ((V:A->bool),(E:(A->bool)->bool)) = { (v,w) | {v,w} IN E }`;; + +let dart_of_fan = new_definition + `dart_of_fan (V,E) = + { (v,v) | v IN V /\ set_of_edge (v:real^3) V E = {} } UNION { (v,w) | {v,w} IN E }`;; + + (* in fan/introduction.hl a dart is a 4-tuple. Here it is a pair. Here is the correspondence *) + +let extended_dart = new_definition + `extended_dart (V,E) (v,w) = i_fan (vec 0) V E (vec 0, v, w, w)`;; + +let contracted_dart = new_definition + `contracted_dart (x:A,v:B,w:C,w1:D) = (v,w)`;; + +(* e_fan, n_fan, f_fan of fan/introduction.hl, restricted to pairs *) + +let e_fan_pair = new_definition `e_fan_pair (V,E) (v,w) = (w,v)`;; + +let n_fan_pair = new_definition + `n_fan_pair (V,E) (v,w) = v,sigma_fan (vec 0) V E v w`;; + +let f_fan_pair = new_definition + `f_fan_pair (V,E) (v,w) = w,(inverse_sigma_fan (vec 0) V E w v)`;; + +let hypermap_of_fan = new_definition + `hypermap_of_fan (V,E) = + (let p = ( \ t. res (t (V,E) ) (dart1_of_fan (V,E)) ) in + hypermap( dart_of_fan (V,E) , p e_fan_pair, p n_fan_pair, p f_fan_pair))`;; + +let face_set_of_fan = new_definition + `face_set_of_fan (V,E) = face_set (hypermap_of_fan (V,E))`;; + + +(* compare fan80 and fan81, which define fully_surrounded *) + +let surrounded_node = new_definition + `surrounded_node (V,E) v = + !x. (x IN dart_of_fan (V,E)) /\ (FST x = v) ==> azim_dart (V,E) x < pi`;; + +let scriptL = new_definition + `scriptL V = sum V ( \ (v:real^3) . lmfun (norm v / &2)) `;; + + let contravening = new_definition + `contravening V <=> packing V /\ V SUBSET ball_annulus /\ scriptL V > &12 /\ + (!W. packing W /\ W SUBSET ball_annulus ==> scriptL W <= scriptL V) /\ + (CARD V = 13 \/ CARD V = 14 \/ CARD V = 15) /\ + (!v. v IN V ==> surrounded_node (V, ESTD V) v) /\ + (!v. v IN V ==> (surrounded_node (V, ECTC V) v \/ (norm v = &2) ))`;; + +let topological_component_yfan = new_definition + `topological_component_yfan ((x:real^3),(V:real^3->bool),E) = + { connected_component (yfan (x,V,E)) y | y | y IN yfan (x,V,E) }`;; + +(* there is a function dart_leads_into in fan/introduction.hl. This is a bit simpler. *) + +let dart_leads_into1 = new_definition + `dart_leads_into1 (x,V,E) (v,u) = @s. s IN topological_component_yfan (x,V,E) /\ + (?eps. (eps < &1) /\ + rw_dart_fan x V E (x,v,u,sigma_fan x V E v u) eps SUBSET s)`;; + +let dartset_leads_into = new_definition + `dartset_leads_into (x,V,E) ds = + @s. (!y. (y IN ds) ==> (s=dart_leads_into1 (x,V,E) y))`;; + +(* node(x) not needed, use FST x *) + +let h_dart = new_definition `h_dart (x:real^3#B) = norm (FST x) / &2`;; + +let tauVEF = new_definition `tauVEF (V,E,f) = + sum f ( \ x. azim_dart (V,E) x * (&1 + (sol0/pi) * (&1 - lmfun (h_dart x)))) + (pi + sol0)*(&2 - &(CARD(f)))`;; + + +let restricted_hypermap = new_definition `restricted_hypermap (H:(A)hypermap) <=> + is_no_double_joints H /\ ~(dart H = {}) /\ planar_hypermap H /\ connected_hypermap H /\ + plain_hypermap H /\ simple_hypermap H /\ is_edge_nondegenerate H /\ is_node_nondegenerate H /\ + (!f. f IN face_set H ==> CARD(f) >= 3)`;; + +(* deprecated 2013-2-22 : Use rho_node1 which has been developed further, + per -> . + perimeterbound -> . They haven't been developed. + *) + +let rho_node = new_definition + `rho_node (V:A1,E:A2,f:A3#A4->bool) v = @w. (v,w) IN f`;; + +let per = new_definition +`per(V,E,f) v k = sum (0..k-1) + ( \ i. arcV (vec 0) ((rho_node (V,E,f) POWER i) v) ((rho_node (V,E,f) POWER (i+1)) v))`;; + +let perimeterbound = new_definition `perimeterbound (V,E) = + (!f. f IN face_set_of_fan (V,E) ==> + sum f (\ (v,w). arcV (vec 0) (v:real^3) w ) <= &2 * pi)`;; + + +end;; + diff --git a/text_formalization/tame/tame_opposite.hl b/text_formalization/tame/tame_opposite.hl new file mode 100644 index 0000000..08738eb --- /dev/null +++ b/text_formalization/tame/tame_opposite.hl @@ -0,0 +1,616 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Lemma: PPHEUFG *) +(* Chapter: Tame Hypermap *) +(* Authors: Trieu Thi Diep, Alexey Solovyev *) +(* Date: 2010-02-26 *) +(* ========================================================================== *) + + + +module type Tame_opposite_type = sig + +end;; + +flyspeck_needs "hypermap/hypermap.hl";; +flyspeck_needs "tame/tame_defs.hl";; + +module Tame_opposite = struct + + +open Hypermap;; +open Tame_defs;; + + +(* LEMMA: general *) +let tuple_opposite_hypermap = prove +(`!(H:(A)hypermap). tuple_hypermap (opposite_hypermap H) = ((dart H),face_map H o node_map H , inverse(node_map H),inverse(face_map H))`, + GEN_TAC THEN REWRITE_TAC[opposite_hypermap] THEN + REWRITE_TAC[GSYM hypermap_tybij] THEN + MP_TAC (SPEC `H:(A)hypermap` hypermap_lemma) THEN + STRIP_TAC THEN + ASM_SIMP_TAC[PERMUTES_INVERSE; PERMUTES_COMPOSE] THEN + REWRITE_TAC[FUN_EQ_THM; o_THM; I_THM] THEN + MP_TAC (ISPECL [`(node_map H):A->A`; `(dart H):A->bool`] PERMUTES_INVERSES_o) THEN + MP_TAC (ISPECL [`(face_map H):A->A`; `(dart H):A->bool`] PERMUTES_INVERSES_o) THEN + ASM_SIMP_TAC[FUN_EQ_THM; o_THM; I_THM]);; + + + + +(* LEMMA: plain (tame_1a) *) +let opposite_hypermap_plain = prove ( `!(H:(A)hypermap). + plain_hypermap H ==> plain_hypermap (opposite_hypermap H)`, + GEN_TAC THEN + REWRITE_TAC[plain_hypermap] THEN + DISCH_TAC THEN + REWRITE_TAC[edge_map; tuple_opposite_hypermap] THEN + SUBGOAL_THEN `(face_map (H:(A)hypermap) o node_map H) o face_map H o node_map H = (face_map H) o ((node_map H) o (face_map H) o (edge_map H)) o (edge_map H) o (node_map H)` MP_TAC THENL + [ + POP_ASSUM MP_TAC THEN + SIMP_TAC[FUN_EQ_THM; o_THM; I_THM]; + ALL_TAC + ] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + REWRITE_TAC[hypermap_cyclic; I_O_ID]);; + + + +(* LEMMA: general *) +let opposite_components = prove(`!(H:(A)hypermap) x. + dart (opposite_hypermap H) = dart H /\ + node (opposite_hypermap H) x = node H x /\ + face (opposite_hypermap H) x = face H x`, + REPEAT GEN_TAC THEN REWRITE_TAC[dart; tuple_opposite_hypermap] THEN + CONJ_TAC THENL + [ + REWRITE_TAC[node; node_map; tuple_opposite_hypermap] THEN + REWRITE_TAC[GSYM node_map]; + REWRITE_TAC[face; face_map; tuple_opposite_hypermap] THEN + REWRITE_TAC[GSYM face_map] + ] THEN + MATCH_MP_TAC lemma_card_inverse_map_eq THEN + EXISTS_TAC `(dart H):A->bool` THEN + REWRITE_TAC[hypermap_lemma]);; + + + + +(* LEMMA: simple (tame_2b) *) +let opposite_hypermap_simple = prove ( `!(H:(A)hypermap). + simple_hypermap H ==> simple_hypermap (opposite_hypermap H)`, + GEN_TAC THEN + REWRITE_TAC[simple_hypermap; opposite_components] THEN + REWRITE_TAC[dart; tuple_opposite_hypermap]);; + + + +(* LEMMA: general *) +let hypermap_eq_lemma = prove(`!(H:(A)hypermap). tuple_hypermap H = dart H,edge_map H,node_map H,face_map H`, + GEN_TAC THEN + MP_TAC (ISPEC `tuple_hypermap (H:(A)hypermap)` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN + MP_TAC (ISPEC `y:(A->A)#(A->A)#(A->A)` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN + MP_TAC (ISPEC `y':(A->A)#(A->A)` PAIR_SURJECTIVE) THEN + STRIP_TAC THEN + ASM_REWRITE_TAC[PAIR_EQ] THEN + ASM_REWRITE_TAC[dart; edge_map; node_map; face_map]);; + + + +(* LEMMA: general *) +let opposite_opposite_hypermap_eq_hypermap = prove(`!(H:(A)hypermap). opposite_hypermap (opposite_hypermap H) = H`, + ONCE_REWRITE_TAC[GSYM hypermap_tybij] THEN + GEN_TAC THEN + AP_TERM_TAC THEN + REWRITE_TAC[tuple_opposite_hypermap; hypermap_eq_lemma; PAIR_EQ] THEN + REWRITE_TAC[dart; face_map; node_map; tuple_opposite_hypermap] THEN + REWRITE_TAC[GSYM dart; GSYM face_map; GSYM node_map] THEN + REWRITE_TAC[GSYM inverse2_hypermap_maps] THEN + CONJ_TAC THEN MATCH_MP_TAC (GEN_ALL PERMUTES_INVERSE_INVERSE) THEN + EXISTS_TAC `dart (H:(A)hypermap)` THEN + REWRITE_TAC[hypermap_lemma]);; + + + + + +(* LEMMA: aux *) +let truncated_path_lemma = prove(`!(H:(A)hypermap) p q n. is_path H p n /\ + (!i. i <= n ==> q i = p i) + ==> is_path H q n`, + REPLICATE_TAC 3 GEN_TAC THEN + INDUCT_TAC THEN REWRITE_TAC[is_path] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) THEN + ASM_REWRITE_TAC[] THEN + ANTS_TAC THENL + [ + GEN_TAC THEN + ASM_SIMP_TAC[ARITH_RULE `i <= n ==> i <= SUC n`]; + ALL_TAC + ] THEN + FIRST_ASSUM (MP_TAC o SPEC `n:num`) THEN + FIRST_ASSUM (MP_TAC o SPEC `SUC n`) THEN + REWRITE_TAC[LE_REFL; ARITH_RULE `n <= SUC n`] THEN + ASM_SIMP_TAC[]);; + + + +(* LEMMA: general *) +let opposite_path = prove(`!(H:(A)hypermap) p n. is_path H p n ==> + ?q m. is_path (opposite_hypermap H) q m /\ + q 0 = p 0 /\ q m = p n`, + GEN_TAC THEN GEN_TAC THEN + INDUCT_TAC THEN REWRITE_TAC[is_path] THENL + [ + MAP_EVERY EXISTS_TAC [`p:num->A`; `0`] THEN + REWRITE_TAC[is_path]; + ALL_TAC + ] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) THEN + ASM_REWRITE_TAC[] THEN + STRIP_TAC THEN + FIRST_X_ASSUM (MP_TAC o check (fun th -> rator (rator (concl th)) = `go_one_step (H:(A)hypermap)`)) THEN + REWRITE_TAC[go_one_step] THEN + STRIP_TAC THENL + [ + EXISTS_TAC `(\i:num. if i <= m then (q:num->A) i else (if i = m + 1 then inverse (node_map H) (q m) else edge_map H ((p:num->A) n)))` THEN + EXISTS_TAC `SUC(SUC m)` THEN + BETA_TAC THEN + ASM_SIMP_TAC[LE_0; ARITH_RULE `~(SUC (SUC m) <= m)`; ARITH_RULE `~(SUC(SUC m) = m + 1)`] THEN + REWRITE_TAC[is_path] THEN + REPEAT STRIP_TAC THENL + [ + MATCH_MP_TAC truncated_path_lemma THEN + EXISTS_TAC `q:num->A` THEN + ASM_SIMP_TAC[]; + + ASM_REWRITE_TAC[LE_REFL; ARITH_RULE `~(m = m + 1)`; ARITH_RULE `~(SUC m <= m)`; ARITH_RULE `SUC m = m + 1`] THEN + REWRITE_TAC[go_one_step] THEN + DISJ2_TAC THEN DISJ1_TAC THEN + GEN_REWRITE_TAC (RAND_CONV o DEPTH_CONV) [node_map] THEN + REWRITE_TAC[tuple_opposite_hypermap]; + + ASM_REWRITE_TAC[ARITH_RULE `~(SUC m <= m) /\ ~(SUC (SUC m) <= m) /\ ~(SUC (SUC m) = m + 1) /\ SUC m = m + 1`] THEN + REWRITE_TAC[go_one_step] THEN + DISJ2_TAC THEN DISJ2_TAC THEN + REWRITE_TAC[face_map] THEN + REWRITE_TAC[tuple_opposite_hypermap] THEN + MP_TAC (SPEC `H:(A)hypermap` inverse2_hypermap_maps) THEN + SIMP_TAC[o_THM; FUN_EQ_THM]; + ]; + + EXISTS_TAC `(\i:num. if i <= m then (q:num->A) i else (if i = m + 1 then ((face_map H) o (node_map H)) (q m) else node_map H ((p:num->A) n)))` THEN + EXISTS_TAC `SUC(SUC m)` THEN + BETA_TAC THEN + ASM_SIMP_TAC[LE_0; ARITH_RULE `~(SUC (SUC m) <= m)`; ARITH_RULE `~(SUC(SUC m) = m + 1)`] THEN + REWRITE_TAC[is_path] THEN + REPEAT STRIP_TAC THENL + [ + MATCH_MP_TAC truncated_path_lemma THEN + EXISTS_TAC `q:num->A` THEN + ASM_SIMP_TAC[]; + + ASM_REWRITE_TAC[LE_REFL; ARITH_RULE `~(m = m + 1)`; ARITH_RULE `~(SUC m <= m)`; ARITH_RULE `SUC m = m + 1`] THEN + REWRITE_TAC[go_one_step] THEN + DISJ1_TAC THEN + GEN_REWRITE_TAC (RAND_CONV o DEPTH_CONV) [edge_map] THEN + REWRITE_TAC[tuple_opposite_hypermap]; + + ASM_REWRITE_TAC[ARITH_RULE `~(SUC m <= m) /\ ~(SUC (SUC m) <= m) /\ ~(SUC (SUC m) = m + 1) /\ SUC m = m + 1`] THEN + REWRITE_TAC[go_one_step] THEN + DISJ2_TAC THEN DISJ2_TAC THEN + REWRITE_TAC[face_map] THEN + REWRITE_TAC[tuple_opposite_hypermap] THEN + REWRITE_TAC[GSYM face_map] THEN + REWRITE_TAC[o_THM] THEN + MP_TAC (ISPECL [`face_map (H:(A)hypermap)`; `dart (H:(A)hypermap)`] PERMUTES_INVERSES_o) THEN + REWRITE_TAC[hypermap_lemma; FUN_EQ_THM; o_THM; I_THM] THEN + SIMP_TAC[]; + ]; + + EXISTS_TAC `(\i:num. if i <= m then (q:num->A) i else (if i = m + 1 then inverse (node_map H) (q m) else face_map H ((p:num->A) n)))` THEN + EXISTS_TAC `SUC(SUC m)` THEN + BETA_TAC THEN + ASM_SIMP_TAC[LE_0; ARITH_RULE `~(SUC (SUC m) <= m)`; ARITH_RULE `~(SUC(SUC m) = m + 1)`] THEN + REWRITE_TAC[is_path] THEN + REPEAT STRIP_TAC THENL + [ + MATCH_MP_TAC truncated_path_lemma THEN + EXISTS_TAC `q:num->A` THEN + ASM_SIMP_TAC[]; + + ASM_REWRITE_TAC[LE_REFL; ARITH_RULE `~(m = m + 1)`; ARITH_RULE `~(SUC m <= m)`; ARITH_RULE `SUC m = m + 1`] THEN + REWRITE_TAC[go_one_step] THEN + DISJ2_TAC THEN DISJ1_TAC THEN + GEN_REWRITE_TAC (RAND_CONV o DEPTH_CONV) [node_map] THEN + REWRITE_TAC[tuple_opposite_hypermap]; + + ASM_REWRITE_TAC[ARITH_RULE `~(SUC m <= m) /\ ~(SUC (SUC m) <= m) /\ ~(SUC (SUC m) = m + 1) /\ SUC m = m + 1`] THEN + REWRITE_TAC[go_one_step] THEN + DISJ1_TAC THEN + REWRITE_TAC[edge_map] THEN + REWRITE_TAC[tuple_opposite_hypermap] THEN + MP_TAC (ISPECL [`node_map (H:(A)hypermap)`; `dart (H:(A)hypermap)`] PERMUTES_INVERSES_o) THEN + REWRITE_TAC[hypermap_lemma; FUN_EQ_THM; o_THM; I_THM] THEN + SIMP_TAC[] + ] + ]);; + + + +(* LEMMA: general *) +let opposite_path_alt = prove(`!(H:(A)hypermap) q m. is_path (opposite_hypermap H) q m + ==> (?p n. is_path H p n /\ + p 0 = q 0 /\ p n = q m)`, + REPEAT STRIP_TAC THEN + ONCE_REWRITE_TAC[GSYM opposite_opposite_hypermap_eq_hypermap] THEN + MATCH_MP_TAC opposite_path THEN + ASM_REWRITE_TAC[]);; + + + +(* LEMMA: general *) +let opposite_sets_of_components = prove(`!H:(A)hypermap. + node_set (opposite_hypermap H) = node_set H /\ + face_set (opposite_hypermap H) = face_set H /\ + set_of_components (opposite_hypermap H) = set_of_components H`, + REPEAT GEN_TAC THEN + REWRITE_TAC[node_set; face_set; set_of_orbits] THEN + REWRITE_TAC[GSYM node; GSYM face; opposite_components] THEN + REWRITE_TAC[dart; tuple_opposite_hypermap] THEN + SUBGOAL_THEN `!x y:A. (?(p:num->A) n. p 0 = x /\ p n = y /\ is_path H p n) <=> (?(q:num->A) m. q 0 = x /\ q m = y /\ is_path (opposite_hypermap H) q m)` ASSUME_TAC THENL + [ + REPEAT GEN_TAC THEN EQ_TAC THEN STRIP_TAC THENL + [ + ONCE_REWRITE_TAC[TAUT `A /\ B /\ C <=> C /\ A /\ B`] THEN + REPLICATE_TAC 2 (FIRST_X_ASSUM ((fun th -> REWRITE_TAC[SYM th]) o check (is_eq o concl))) THEN + MATCH_MP_TAC opposite_path THEN + ASM_REWRITE_TAC[]; + ONCE_REWRITE_TAC[TAUT `A /\ B /\ C <=> C /\ A /\ B`] THEN + REPLICATE_TAC 2 (FIRST_X_ASSUM ((fun th -> REWRITE_TAC[SYM th]) o check (is_eq o concl))) THEN + MATCH_MP_TAC opposite_path_alt THEN + ASM_REWRITE_TAC[] + ]; + ALL_TAC + ] THEN + REWRITE_TAC[set_of_components; set_part_components; dart; tuple_opposite_hypermap] THEN + ASM_REWRITE_TAC[GSYM dart; comb_component; is_in_component]);; + + + + +(* LEMMA: connected (tame_2a) *) +let opposite_hypermap_connected = prove ( +`!(H:(A)hypermap).connected_hypermap H ==> connected_hypermap (opposite_hypermap H)`, + REWRITE_TAC[connected_hypermap;number_of_components; opposite_sets_of_components]);; + + + +(* LEMMA: is_edge_nondegenerate (tame_3) *) +let opposite_nondegenerate = prove (`!(H:(A)hypermap). + plain_hypermap H /\ is_edge_nondegenerate H ==> is_edge_nondegenerate (opposite_hypermap H)`, + GEN_TAC THEN + REWRITE_TAC[plain_hypermap; is_edge_nondegenerate] THEN + REPEAT STRIP_TAC THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + REWRITE_TAC[dart; edge_map; tuple_opposite_hypermap] THEN + REWRITE_TAC[GSYM dart] THEN + DISCH_TAC THEN FIRST_X_ASSUM (MP_TAC o check (is_forall o concl)) THEN + ONCE_REWRITE_TAC[TAUT `(A ==> ~B) <=> (B ==> ~A)`] THEN + REWRITE_TAC[NOT_FORALL_THM; TAUT `~(A ==> ~B) <=> A /\ B`] THEN + REWRITE_TAC[o_THM] THEN DISCH_TAC THEN + EXISTS_TAC `node_map H (x:A)` THEN + ASM_SIMP_TAC[lemma_dart_invariant] THEN + POP_ASSUM (fun th -> GEN_REWRITE_TAC (LAND_CONV o DEPTH_CONV) [SYM th]) THEN + MP_TAC (REWRITE_RULE[FUN_EQ_THM; o_THM; I_THM] hypermap_lemma) THEN + SIMP_TAC[]);; + + + + +(* LEMMA: is_no_double_joints (tame_5a) *) +let opposite_no_double_joints = prove(`!H:(A)hypermap. + is_no_double_joints H /\ plain_hypermap H + ==> is_no_double_joints (opposite_hypermap H)`, + GEN_TAC THEN REWRITE_TAC[is_no_double_joints; edge_map_convolution] THEN + STRIP_TAC THEN + REWRITE_TAC[tuple_opposite_hypermap; opposite_components; edge_map] THEN + REPEAT STRIP_TAC THEN + ABBREV_TAC `z:A = node_map H y` THEN + ABBREV_TAC `u:A = node_map H x` THEN + SUBGOAL_THEN `z:A = u:A ==> x:A = y` MATCH_MP_TAC THENL + [ + EXPAND_TAC "z" THEN EXPAND_TAC "u" THEN + SIMP_TAC[node_map_injective; EQ_SYM]; + ALL_TAC + ] THEN + MATCH_MP_TAC EQ_SYM THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + SUBGOAL_THEN `node H (y:A) = node H x` ASSUME_TAC THENL + [ + MATCH_MP_TAC EQ_SYM THEN + MATCH_MP_TAC lemma_node_identity THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + + REPEAT CONJ_TAC THENL + [ + EXPAND_TAC "u" THEN + ASM_SIMP_TAC[lemma_dart_invariant]; + + SUBGOAL_THEN `node H (u:A) = node H y` ASSUME_TAC THENL + [ + MATCH_MP_TAC EQ_SYM THEN + MATCH_MP_TAC lemma_node_identity THEN + ASM_REWRITE_TAC[] THEN + EXPAND_TAC "u" THEN + MATCH_MP_TAC lemma_in_node1 THEN + REWRITE_TAC[node_refl]; + ALL_TAC + ] THEN + POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN + EXPAND_TAC "z" THEN + MATCH_MP_TAC lemma_in_node1 THEN + REWRITE_TAC[node_refl]; + ALL_TAC + ] THEN + + ASM_REWRITE_TAC[o_THM] THEN + SUBGOAL_THEN `!v w:A. v IN node H w ==> node_map H v IN node H (node_map H w)` MATCH_MP_TAC THENL + [ + REPEAT STRIP_TAC THEN + MATCH_MP_TAC lemma_in_node1 THEN + SUBGOAL_THEN `node H (node_map H (w:A)) = node H w` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC EQ_SYM THEN + MATCH_MP_TAC lemma_node_identity THEN + MATCH_MP_TAC lemma_in_node1 THEN + REWRITE_TAC[node_refl]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[]; + ALL_TAC + ] THEN + FIRST_X_ASSUM (MP_TAC o check (is_binary "IN" o concl)) THEN + REWRITE_TAC[o_THM] THEN + EXPAND_TAC "z" THEN EXPAND_TAC "u" THEN + SIMP_TAC[]);; + + + +(* LEMMA: general *) +let plain_hypermap_edge = prove(`!(H:(A)hypermap) x. + plain_hypermap H ==> edge H x = {x, edge_map H x}`, + REPEAT GEN_TAC THEN REWRITE_TAC[plain_hypermap] THEN + DISCH_TAC THEN + REWRITE_TAC[edge] THEN + SPEC_TAC (`x:A`, `x:A`) THEN + MATCH_MP_TAC lemma_orbit_convolution_map THEN + ASM_REWRITE_TAC[]);; + + +(* LEMMA: no_loops (tame_4) *) +let opposite_no_loops = prove(`!H:(A)hypermap. + no_loops H /\ plain_hypermap H + ==> no_loops (opposite_hypermap H)`, + GEN_TAC THEN REWRITE_TAC[no_loops] THEN + STRIP_TAC THEN + FIRST_ASSUM (MP_TAC o (fun th -> MATCH_MP plain_hypermap_edge th)) THEN + FIRST_ASSUM (MP_TAC o (fun th -> MATCH_MP opposite_hypermap_plain th)) THEN + DISCH_THEN (MP_TAC o (fun th -> MATCH_MP plain_hypermap_edge th)) THEN + POP_ASSUM MP_TAC THEN REWRITE_TAC[edge_map_convolution] THEN + DISCH_TAC THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + DISCH_TAC THEN + REWRITE_TAC[opposite_components; edge_map; tuple_opposite_hypermap; o_THM] THEN + REWRITE_TAC[Collect_geom.IN_SET2] THEN + REPEAT STRIP_TAC THEN + SUBGOAL_THEN `node_map H (x:A) = node_map H y ==> x = y` MATCH_MP_TAC THENL + [ + REWRITE_TAC[node_map_injective]; + ALL_TAC + ] THEN + FIRST_X_ASSUM MATCH_MP_TAC THEN + CONJ_TAC THENL + [ + ASM_REWRITE_TAC[o_THM; Collect_geom.IN_SET2]; + MATCH_MP_TAC lemma_in_node1 THEN + SUBGOAL_THEN `node H (node_map H (y:A)) = node H y` (fun th -> REWRITE_TAC[th]) THENL + [ + MATCH_MP_TAC EQ_SYM THEN + MATCH_MP_TAC lemma_node_identity THEN + MATCH_MP_TAC lemma_in_node1 THEN + REWRITE_TAC[node_refl]; + ALL_TAC + ] THEN + ASM_REWRITE_TAC[] + ]);; + + + +(* LEMMA: aux *) +let edge_CARD_dart = prove(`!H:(A)hypermap. + plain_hypermap H /\ is_edge_nondegenerate H ==> + CARD (dart H) = 2 * number_of_edges H`, + GEN_TAC THEN + REWRITE_TAC[plain_hypermap; is_edge_nondegenerate] THEN + STRIP_TAC THEN + REWRITE_TAC[number_of_edges; edge_set] THEN + MATCH_MP_TAC (REWRITE_RULE[number_of_orbits] lemma_card_eq) THEN + REWRITE_TAC[hypermap_lemma] THEN + REPEAT STRIP_TAC THEN + MP_TAC (SPECL [`(dart H):A->bool`; `(edge_map H):A->A`] lemma_orbit_of_size_2) THEN + REWRITE_TAC[hypermap_lemma] THEN + DISCH_THEN (fun th -> REWRITE_TAC[th]) THEN + FIRST_X_ASSUM (MP_TAC o SPEC `x:A`) THEN + FIRST_X_ASSUM (MP_TAC o check (is_eq o concl)) THEN + ASM_SIMP_TAC[FUN_EQ_THM; o_THM; I_THM]);; + + +(* LEMMA: aux *) +let edge_CARD = prove(`!H:(A)hypermap. + plain_hypermap H /\ is_edge_nondegenerate H ==> + number_of_edges H = CARD (dart H) DIV 2`, + GEN_TAC THEN + DISCH_THEN (ASSUME_TAC o (fun th -> MATCH_MP edge_CARD_dart th)) THEN + MATCH_MP_TAC EQ_SYM THEN MATCH_MP_TAC DIV_UNIQ THEN + EXISTS_TAC `0` THEN ASM_REWRITE_TAC[] THEN + ARITH_TAC);; + + + + +(* LEMMA: planar (tame_1b) *) +let opposite_planar = prove ( `!(H:(A)hypermap). + planar_hypermap H /\ is_edge_nondegenerate H /\ plain_hypermap H + ==> planar_hypermap (opposite_hypermap H)`, + GEN_TAC THEN REWRITE_TAC[planar_hypermap] THEN + REWRITE_TAC[number_of_nodes; number_of_faces; number_of_components] THEN + REWRITE_TAC[opposite_sets_of_components] THEN + DISCH_THEN (CONJUNCTS_THEN2 MP_TAC ASSUME_TAC) THEN + MP_TAC (SPEC `opposite_hypermap (H:(A)hypermap)` edge_CARD) THEN + ASM_SIMP_TAC[opposite_hypermap_plain; opposite_nondegenerate] THEN + MP_TAC (SPEC `H:(A)hypermap` edge_CARD) THEN + ASM_SIMP_TAC[dart; tuple_opposite_hypermap]);; + + + + +(* LEMMA: tame_8 *) +let CARD_faces1 = prove (`! (H:(A)hypermap). + tame_8 H ==> tame_8 (opposite_hypermap H) `, + REWRITE_TAC[tame_8; number_of_faces; opposite_sets_of_components]);; + + + +(* LEMMA: tame_9a *) +let CARD_in_face = prove ( `!(H:(A)hypermap). + tame_9a H ==> tame_9a (opposite_hypermap H) `, + REWRITE_TAC[tame_9a; opposite_components] THEN + SIMP_TAC[dart; tuple_opposite_hypermap]);; + + +(* LEMMA: tame_10 *) +let CARD_nodes = prove (`!H:(A)hypermap. + tame_10 H ==> tame_10 (opposite_hypermap H)`, + REWRITE_TAC[tame_10; opposite_sets_of_components; number_of_nodes]);; + + +(* LEMMA: tame_11a /\ tame_11b *) +let CARD_in_node = prove ( `!(H:(A)hypermap). + tame_11a H /\ tame_11b H ==> + tame_11a (opposite_hypermap H) /\ tame_11b (opposite_hypermap H)`, + REWRITE_TAC[tame_11a; tame_11b; opposite_components] THEN + SIMP_TAC[dart; tuple_opposite_hypermap]);; + + + +(* LEMMA: general *) +let the_SAME_orbit_triangles = prove (`!(H:(A)hypermap) x. + set_of_triangles_meeting_node H x = + set_of_triangles_meeting_node (opposite_hypermap H) x`, + REPEAT GEN_TAC THEN + REWRITE_TAC[set_of_triangles_meeting_node] THEN + REWRITE_TAC[opposite_components] THEN + REWRITE_TAC[dart; tuple_opposite_hypermap]);; + + +(* LEMMA: general *) +let the_SAME_orbit_quadrilaterals = prove (`!(H:(A)hypermap) x. + set_of_quadrilaterals_meeting_node H x = + set_of_quadrilaterals_meeting_node (opposite_hypermap H) x`, + REPEAT GEN_TAC THEN + REWRITE_TAC[set_of_quadrilaterals_meeting_node] THEN + REWRITE_TAC[opposite_components; dart; tuple_opposite_hypermap]);; + + +(* LEMMA: general *) +let the_SAME_orbit_exceptional = prove (`!(H:(A)hypermap) x. + set_of_exceptional_meeting_node H x = + set_of_exceptional_meeting_node (opposite_hypermap H) x`, + REPEAT GEN_TAC THEN + REWRITE_TAC[set_of_exceptional_meeting_node] THEN + REWRITE_TAC[opposite_components; dart; tuple_opposite_hypermap]);; + + + +(* LEMMA: general *) +let the_SAME_orbit_face = prove (`!(H:(A)hypermap) x. + set_of_face_meeting_node H x = set_of_face_meeting_node (opposite_hypermap H) x`, + REPEAT GEN_TAC THEN + REWRITE_TAC[set_of_face_meeting_node] THEN + REWRITE_TAC[opposite_components; dart; tuple_opposite_hypermap]);; + + +(* LEMMA: general *) +let the_SAME_type = prove(`!H (x:A). type_of_node H x = type_of_node (opposite_hypermap H) x`, + REWRITE_TAC[type_of_node; PAIR_EQ] THEN + REWRITE_TAC[GSYM the_SAME_orbit_triangles] THEN + REWRITE_TAC[GSYM the_SAME_orbit_quadrilaterals] THEN + REWRITE_TAC[GSYM the_SAME_orbit_exceptional]);; + + + +(* LEMMA: tame_12o *) +let opposite_tame_12o = prove(`!H:(A)hypermap. tame_12o H ==> tame_12o (opposite_hypermap H)`, + REWRITE_TAC[tame_12o] THEN + REWRITE_TAC[node_type_exceptional_face; exceptional_face] THEN + REWRITE_TAC[node_exceptional_face] THEN + SIMP_TAC[opposite_components; GSYM the_SAME_type] THEN + SIMP_TAC[exceptional_face; opposite_components]);; + + +(* LEMMA: tame_13a *) +let opposite_tame_13a = prove(`!H:(A)hypermap. + tame_13a H ==> tame_13a (opposite_hypermap H)`, + GEN_TAC THEN REWRITE_TAC[tame_13a] THEN + REWRITE_TAC[admissible_weight; adm_1; adm_2; adm_3] THEN + REWRITE_TAC[GSYM the_SAME_type] THEN + REWRITE_TAC[GSYM the_SAME_orbit_exceptional] THEN + REWRITE_TAC[GSYM the_SAME_orbit_quadrilaterals] THEN + REWRITE_TAC[GSYM the_SAME_orbit_triangles] THEN + REWRITE_TAC[GSYM the_SAME_orbit_face] THEN + REWRITE_TAC[opposite_components] THEN + STRIP_TAC THEN + EXISTS_TAC `w:(A->bool)->real` THEN + ASM_REWRITE_TAC[] THEN + POP_ASSUM MP_TAC THEN + REWRITE_TAC[total_weight] THEN + REWRITE_TAC[opposite_sets_of_components]);; + + + + +(* LEMMA: tame H ==> tame (opposite H) *) +let tame_opposite_hypermap = prove ( `!(H:(A)hypermap). tame_hypermap H ==> tame_hypermap (opposite_hypermap H)`, + GEN_TAC THEN REWRITE_TAC[tame_hypermap; tame_1; tame_2; tame_3; tame_4; tame_5a] THEN + SIMP_TAC[opposite_hypermap_plain; opposite_planar; opposite_hypermap_connected; opposite_hypermap_simple] THEN + SIMP_TAC[opposite_nondegenerate; opposite_no_loops; opposite_no_double_joints] THEN + SIMP_TAC[CARD_faces1; CARD_in_face; CARD_nodes; CARD_in_node] THEN + SIMP_TAC[opposite_tame_12o; opposite_tame_13a]);; + + + + +(* LEMMA: the main result *) +let PPHEUFG = prove (`!(H:(A)hypermap). tame_hypermap H <=> tame_hypermap (opposite_hypermap H)`, + GEN_TAC THEN EQ_TAC THENL + [ + REWRITE_TAC[tame_opposite_hypermap]; + DISCH_TAC THEN + ONCE_REWRITE_TAC[GSYM opposite_opposite_hypermap_eq_hypermap] THEN + MATCH_MP_TAC tame_opposite_hypermap THEN + ASM_REWRITE_TAC[] + ]);; + + + + + +end;; diff --git a/text_formalization/trigonometry/HVIHVEC.hl b/text_formalization/trigonometry/HVIHVEC.hl new file mode 100644 index 0000000..39c5e28 --- /dev/null +++ b/text_formalization/trigonometry/HVIHVEC.hl @@ -0,0 +1,53 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Trigonometry *) +(* Author: John Harrison *) +(* Date: 2011-07-01 *) +(* ========================================================================== *) + +(* ========================================================================= *) +(* A missing lemma from the trig chapter. *) +(* ========================================================================= *) + +module Hvihvec = struct + +let VECTOR_ANGLE_DOUBLECROSS = prove + (`!u v w. + ~(w = vec 0) /\ u dot w = &0 /\ v dot w = &0 + ==> vector_angle (u cross w) (v cross w) = vector_angle u v`, + REPEAT GEN_TAC THEN ASM_CASES_TAC `u:real^3 = vec 0` THENL + [ASM_REWRITE_TAC[vector_angle; CROSS_0]; ALL_TAC] THEN + ASM_CASES_TAC `v:real^3 = vec 0` THENL + [ASM_REWRITE_TAC[vector_angle; CROSS_0]; ALL_TAC] THEN + STRIP_TAC THEN + SUBGOAL_THEN `~(u cross w = vec 0) /\ ~(v cross w = vec 0)` ASSUME_TAC THENL + [REPEAT(POP_ASSUM MP_TAC) THEN REWRITE_TAC[GSYM DOT_EQ_0] THEN VEC3_TAC; + ALL_TAC] THEN + ASM_SIMP_TAC[VECTOR_ANGLE_EQ] THEN + SIMP_TAC[vector_norm; GSYM SQRT_MUL; DOT_POS_LE] THEN + ASM_REWRITE_TAC[DOT_CROSS; REAL_MUL_LZERO; REAL_SUB_RZERO] THEN + REWRITE_TAC[REAL_ARITH `(x * y) * (z * y):real = (y * y) * x * z`] THEN + SIMP_TAC[SQRT_MUL; DOT_POS_LE; REAL_LE_SQUARE; REAL_LE_MUL] THEN + SIMP_TAC[SQRT_POW_2; DOT_POS_LE; GSYM REAL_POW_2] THEN REAL_ARITH_TAC);; + +let HVIHVEC = prove + (`!v0 v1 v2 v3. + ~(v0 = v1) + ==> dihV v0 v1 v2 v3 = + let w1 = v1 - v0 + and w2 = v2 - v0 + and w3 = v3 - v0 in + vector_angle (w1 cross w2) (w1 cross w3)`, + let lemma = prove + (`(v1 dot v1) % v2 - (v2 dot v1) % v1 = (v1 cross v2) cross v1`,VEC3_TAC) in + REPEAT GEN_TAC THEN CONV_TAC(ONCE_DEPTH_CONV let_CONV) THEN + GEN_GEOM_ORIGIN_TAC `v0:real^3` [] THEN + REWRITE_TAC[dihV] THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN + REWRITE_TAC[VECTOR_SUB_RZERO] THEN + REWRITE_TAC[ARCV_ANGLE; angle; VECTOR_SUB_RZERO] THEN + REWRITE_TAC[lemma] THEN + REPEAT STRIP_TAC THEN MATCH_MP_TAC VECTOR_ANGLE_DOUBLECROSS THEN + ASM_REWRITE_TAC[] THEN VEC3_TAC);; + +end;; diff --git a/text_formalization/trigonometry/delta_x.hl b/text_formalization/trigonometry/delta_x.hl new file mode 100755 index 0000000..a18cce1 --- /dev/null +++ b/text_formalization/trigonometry/delta_x.hl @@ -0,0 +1,230 @@ + + +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* COMPLEMENT LEMMAS FOR EULER TRIANGLE LEMMA *) +(* *) +(* LEMMA ABOUT DELTA_X *) +(* *) +(* Authour : VU KHAC KY *) +(* *) +(* Date: 2010-04-02 *) +(* ========================================================================= *) + + +(* ========================================================================= *) +(* SOME USEFUL TACTICS *) +(* ========================================================================= *) + +module Delta_x = struct + +open Sphere;; +open Trigonometry1;; +open Trigonometry2;; +open Prove_by_refinement;; + +let UP_ASM_TAC = FIRST_X_ASSUM MP_TAC;; + +let DEL_TAC = FIRST_X_ASSUM MP_TAC THEN MATCH_MP_TAC (MESON[] `a ==> b ==> a`);; + +let SWITCH_TAC = + FIRST_X_ASSUM MP_TAC THEN + FIRST_X_ASSUM MP_TAC THEN + MATCH_MP_TAC (MESON[] `(a ==> b ==> c) ==> (b ==> a ==> c)`) THEN + DISCH_TAC THEN + DISCH_TAC;; + +(* ========================================================================= *) +(* THE FIRST LEMMA *) +(* ========================================================================= *) + +let compute_delta_x_t = + `!v0:real^3 v1 v2 v3 x1 x2 x3 x4 x5 x6. + x1, x2, x3, x4, x5, x6 = xlist v0 v1 v2 v3 + ==> delta_x x1 x2 x3 x4 x5 x6 = + (let a = v1 - v0 in + let b = v2 - v0 in + let c = v3 - v0 in + &4 * + (a$1 * b$2 * c$3 - a$1 * b$3 * c$2 - + a$2 * b$1 * c$3 + a$2 * b$3 * c$1 + + a$3 * b$1 * c$2 - a$3 * b$2 * c$1) pow 2 )`;; + +let COMPUTE_DELTA_X = prove_by_refinement (compute_delta_x_t, +[(REPEAT GEN_TAC); + (REWRITE_TAC[delta_x;xlist;ylist]); + (REPEAT LET_TAC THEN DISCH_TAC); + + (UP_ASM_TAC THEN UP_ASM_TAC THEN PURE_REWRITE_TAC[PAIR_EQ]); + (PURE_ONCE_REWRITE_TAC[DIST_SYM]); + (REPEAT DISCH_TAC); + + (SUBGOAL_THEN + `(a:real^3) dot a = x1 /\ (b:real ^3) dot b = x2 /\ (c:real^3) dot c = x3` + ASSUME_TAC); + (* Begin subgoal 1 *) + + (EXPAND_TAC "a" THEN EXPAND_TAC "b" THEN EXPAND_TAC "c"); + (UP_ASM_TAC THEN UP_ASM_TAC); + (PURE_REWRITE_TAC[dist]); + (MESON_TAC[NORM_POW_2]); + (* End subgoal 1 *) + + (SUBGOAL_THEN + `(b:real^3) dot b + (c:real^3) dot c - &2 * (b dot c) = x4 /\ + (a:real^3) dot a + (c:real^3) dot c - &2 * (a dot c) = x5 /\ + (a:real^3) dot a + (b:real^3) dot b - &2 * (a dot b) = x6` + ASSUME_TAC); + (* Begin subgoal 2 *) + + DEL_TAC; + (PURE_ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (PURE_ONCE_ASM_REWRITE_TAC[]); + DEL_TAC; + (UP_ASM_TAC THEN PURE_ONCE_REWRITE_TAC[dist]); + STRIP_TAC; + (EXPAND_TAC "a" THEN EXPAND_TAC "b" THEN EXPAND_TAC "c"); + (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6"); + (PURE_ONCE_REWRITE_TAC[NORM_POW_2]); + VECTOR_ARITH_TAC; + (* End subgoal 2 *) + + ( SUBGOAL_THEN `(x1:real) * x4 * (--x1 + x2 + x3 - x4 + x5 + x6) + + x2 * x5 * (x1 - x2 + x3 + x4 - x5 + x6) + + x3 * x6 * (x1 + x2 - x3 + x4 + x5 - x6) - + x2 * x3 * x4 - x1 * x3 * x5 - x1 * x2 * x6 - + x4 * x5 * x6 = + &4 * (a dot a) * (b dot b) * ((c:real^3) dot c) + - (&4) * (a dot a) * (b dot c) * (b dot c) + - (&4) * (a dot c) * (a dot c) * (b dot b) + - (&4) * (a dot b) * (a dot b) * (c dot c) + + (&8) * (a dot b) * (a dot c) * (b dot c)` ASSUME_TAC); + (* Begin subgoal 3 *) + + (UP_ASM_TAC THEN UP_ASM_TAC THEN REPEAT STRIP_TAC); + (EXPAND_TAC "x1" THEN EXPAND_TAC "x2" THEN EXPAND_TAC "x3"); + (EXPAND_TAC "x4" THEN EXPAND_TAC "x5" THEN EXPAND_TAC "x6" ); + (REAL_ARITH_TAC); + (* End subgoal 3 *) + + (PURE_ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[DOT_3;POW_2] THEN REAL_ARITH_TAC)]);; + +(* ========================================================================= *) +(* THE SECOND LEMMA: delta_x = &4 * (det A) pow 2 *) +(* ========================================================================= *) + +let delta_x_det_x_t = + `!(v0:real^3) v1 v2 v3 x1 x2 x3 x4 x5 x6 A:real^3^3. + x1, x2, x3, x4, x5, x6 = xlist v0 v1 v2 v3 /\ + A$1 = v1 - v0 /\ + A$2 = v2 - v0 /\ + A$3 = v3 - v0 + ==> (delta_x x1 x2 x3 x4 x5 x6 = &4 * det A pow 2)`;; + +let DELTA_X_DET_3 = prove_by_refinement (delta_x_det_x_t , +[(REPEAT STRIP_TAC); + (MP_TAC (SPEC_ALL DET_3) THEN DISCH_TAC); + (ASM_REWRITE_TAC[]); + (MP_TAC COMPUTE_DELTA_X); + (REPEAT LET_TAC THEN STRIP_TAC); + (EXPAND_TAC "a" THEN EXPAND_TAC "b" THEN EXPAND_TAC "c"); + (ASM_SIMP_TAC[] THEN REAL_ARITH_TAC)]);; + +(* ========================================================================= *) +(* THE THIRD LEMMA: *) +(* delta > &0 ==> v0 v1 v2 are not collinear *) +(* v0 v1 v3 are not collinear *) +(* v0 v2 v3 are not collinear *) +(* ========================================================================= *) + +let delta_x_collinear_t = + `!(v0:real^3) v1 v2 v3 (x1:real) x2 x3 x4 x5 x6. + ( x1, x2, x3, x4, x5, x6 = xlist v0 v1 v2 v3) + ==> (&0 < (delta_x x1 x2 x3 x4 x5 x6)) + ==> ~collinear {v0, v1, v2} /\ + ~collinear {v0, v1, v3} /\ + ~collinear {v0, v3, v2}`;; + +let DELTA_X_LT_0_COLLINEAR = prove_by_refinement (delta_x_collinear_t, +[(REPEAT GEN_TAC THEN DISCH_TAC); + (ASM_SIMP_TAC[COMPUTE_DELTA_X]); + (REPEAT LET_TAC); + (PURE_REWRITE_TAC[PAIR_EQ]); + STRIP_TAC; + (PURE_ONCE_REWRITE_TAC[collinear]); + (REPEAT STRIP_TAC); (* Break the proof into 3 subgoals *) + + (* -------------- Begin subgoal 1----------------------------------------- *) + + SWITCH_TAC; + UP_ASM_TAC; + (MATCH_MP_TAC (REAL_ARITH `&0 = a ==> &0 < a ==> F`)); + + (SUBGOAL_THEN `?m n. a = m % (u:real^3) /\ b = n % u` CHOOSE_TAC); + (EXPAND_TAC "a" THEN EXPAND_TAC "b"); + (ASM_MESON_TAC[SET_RULE `v0 IN {v0, v1, v2} /\ + v1 IN {v0, v1, v2} /\ + v2 IN {v0, v1, v2} `]); + + (FIRST_X_ASSUM CHOOSE_TAC); + + (SUBGOAL_THEN + `!i. (a:real^3)$i = m * (u:real^3)$i /\ (b:real^3)$i = n * u$i` + ASSUME_TAC); + (ASM_MESON_TAC[VECTOR_MUL_COMPONENT]); + + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + + (* -------------- End subgoal 1----------------------------------------- ---*) + + (* -------------- Begin subgoal 2 ----------------------------------------- *) + + SWITCH_TAC; + UP_ASM_TAC; + (MATCH_MP_TAC (REAL_ARITH `&0 = a ==> &0 < a ==> F`)); + + (SUBGOAL_THEN `?m n. a = m % (u:real^3) /\ c = n % u` CHOOSE_TAC); + (EXPAND_TAC "a" THEN EXPAND_TAC "c"); + (ASM_MESON_TAC[SET_RULE `v0 IN {v0, v1, v2} /\ + v1 IN {v0, v1, v2} /\ + v2 IN {v0, v1, v2} `]); + + (FIRST_X_ASSUM CHOOSE_TAC); + + (SUBGOAL_THEN + `!i. (a:real^3)$i = m * (u:real^3)$i /\ (c:real^3)$i = n * u$i` + ASSUME_TAC); + (ASM_MESON_TAC[VECTOR_MUL_COMPONENT]); + + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + +(* -------------- End subgoal 2----------------------------------------- ---*) + +(* -------------- Begin subgoal 3 ----------------------------------------- *) + + SWITCH_TAC; + UP_ASM_TAC; + (MATCH_MP_TAC (REAL_ARITH `&0 = a ==> &0 < a ==> F`)); + + (SUBGOAL_THEN `?m n. c = m % (u:real^3) /\ b = n % u` CHOOSE_TAC); + (EXPAND_TAC "b" THEN EXPAND_TAC "c"); + (ASM_MESON_TAC[SET_RULE `v0 IN {v0, v1, v2} /\ + v1 IN {v0, v1, v2} /\ + v2 IN {v0, v1, v2} `]); + + (FIRST_X_ASSUM CHOOSE_TAC); + + (SUBGOAL_THEN + `!i. (c:real^3)$i = m * (u:real^3)$i /\ (b:real^3)$i = n * u$i` + ASSUME_TAC); + (ASM_MESON_TAC[VECTOR_MUL_COMPONENT]); + + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC)]);; + + (* -------------- End subgoal 3 and also end main goal -------------------- *) + +end;; diff --git a/text_formalization/trigonometry/euler_complement.hl b/text_formalization/trigonometry/euler_complement.hl new file mode 100755 index 0000000..20d79c9 --- /dev/null +++ b/text_formalization/trigonometry/euler_complement.hl @@ -0,0 +1,872 @@ + +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* COMPLEMENT LEMMAS FOR EULER TRIANGLE LEMMA *) +(* *) +(* LEMMA ABOUT RESCALING *) +(* *) +(* Authour : VU KHAC KY *) +(* *) +(* ========================================================================= *) + + +flyspeck_needs "trigonometry/delta_x.hl";; + +(* ========================================================================= *) +(* SOME USEFUL TACTICS *) +(* ========================================================================= *) +module Euler_complement = struct + +open Sphere;; +open Trigonometry1;; +open Trigonometry2;; +open Prove_by_refinement;; +open Delta_x;; + +let UP_ASM_TAC = FIRST_X_ASSUM MP_TAC;; + +let DEL_TAC = FIRST_X_ASSUM MP_TAC THEN MATCH_MP_TAC (MESON[] `a ==> b ==> a`);; + +let SWITCH_TAC = + FIRST_X_ASSUM MP_TAC THEN + FIRST_X_ASSUM MP_TAC THEN + MATCH_MP_TAC (MESON[] `(a ==> b ==> c) ==> (b ==> a ==> c)`) THEN + DISCH_TAC THEN + DISCH_TAC;; + +(* ========================================================================= *) +(* THE FIRST LEMMA *) +(* ========================================================================= *) + +let euler_after_rescale_t = + `!v0:real^3 v1 v2 v3. + norm (v1 - v0) = &1 + ==> norm (v2 - v0) = &1 + ==> norm (v3 - v0) = &1 + ==> &2 * + (&1 + + (v2 - v0) dot (v3 - v0) + + (v3 - v0) dot (v1 - v0) + + (v1 - v0) dot (v2 - v0)) = + &8 - + (v2 - v3) dot (v2 - v3) - + (v1 - v3) dot (v1 - v3) - + (v1 - v2) dot (v1 - v2)`;; + +let LEMMA_FOR_EULER_AFTER_RESCALE = prove_by_refinement (euler_after_rescale_t, + +[(REPEAT GEN_TAC THEN REPEAT DISCH_TAC); +(ABBREV_TAC `a = v1:real^3 - v0`); +(ABBREV_TAC `b = v2:real^3 - v0`); +(ABBREV_TAC `c = v3:real^3 - v0`); + + (ONCE_REWRITE_TAC[VECTOR_ARITH `x:real^3 - y = (x - v0) - (y - v0)`]); + (PURE_ONCE_ASM_REWRITE_TAC[]); + (DEL_TAC THEN DEL_TAC THEN DEL_TAC); + (REWRITE_TAC[VECTOR_ARITH + `(x:real^3 - y) dot (x - y) = x dot x + y dot y - &2 * x dot y`]) ; + + (PURE_ONCE_REWRITE_TAC[GSYM NORM_POW_2]); + (PURE_ONCE_ASM_REWRITE_TAC[]); + (PURE_ONCE_REWRITE_TAC[REAL_ARITH `&1 pow 2 = &1`]); + (PURE_REWRITE_TAC[DOT_SYM]); + REAL_ARITH_TAC]);; + +(*========================================================================= *) +(* *) +(* THE SECOND LEMMA : DIHV UNCHANGED *) +(* *) +(* =========================================================================*) + +let dihv_rescale_unchanged_t = + +`!v0 v1 v2 v3 w0 w1:real^3 w2 w3 m n p. + v1 - v0 = m % (w1 - w0) /\ + v2 - v0 = n % (w2 - w0) /\ + v3 - v0 = p % (w3 - w0) /\ + &0 < m /\ + &0 < n /\ + &0 < p + ==> dihV v0 v1 v2 v3 = dihV w0 w1 w2 w3`;; + +let DIHV_RESCALE_UNCHANGED = prove_by_refinement (dihv_rescale_unchanged_t , + +[(REPEAT GEN_TAC THEN REPEAT STRIP_TAC); +(REWRITE_TAC[dihV] THEN REPEAT LET_TAC); +(REWRITE_TAC[arcV]); +(AP_TERM_TAC); +(REWRITE_TAC[VECTOR_SUB_RZERO]); + + (* Begin subgoal 1 *) + + (SUBGOAL_THEN `vap':real^3 = (m * m * n) % vap` ASSUME_TAC); + (EXPAND_TAC "vap'" THEN EXPAND_TAC "vap"); + (PURE_ONCE_REWRITE_TAC[ASSUME `(vc':real^3) = m % vc`]); + (PURE_ONCE_REWRITE_TAC[ASSUME `(va':real^3) = n % va`]); + (PURE_REWRITE_TAC[DOT_LMUL;DOT_RMUL]); + (REWRITE_TAC[VECTOR_SUB_LDISTRIB;VECTOR_MUL_ASSOC]); + (REWRITE_TAC[REAL_ARITH `(a * b * c) * d = (a * b * d) * c`]); + (AP_TERM_TAC); + (AP_THM_TAC THEN AP_TERM_TAC THEN AP_THM_TAC THEN AP_TERM_TAC); + REAL_ARITH_TAC; + (* End subgoal 1 *) + + (* Begin subgoal 2 *) + + (SUBGOAL_THEN `vbp':real^3 = (m * m * p) % vbp` ASSUME_TAC); + (EXPAND_TAC "vbp'" THEN EXPAND_TAC "vbp"); + (PURE_ONCE_REWRITE_TAC[ASSUME `(vc':real^3) = m % vc`]); + (PURE_ONCE_REWRITE_TAC[ASSUME `(vb':real^3) = p % vb`]); + (PURE_REWRITE_TAC[DOT_LMUL;DOT_RMUL]); + (REWRITE_TAC[VECTOR_SUB_LDISTRIB;VECTOR_MUL_ASSOC]); + (REWRITE_TAC[REAL_ARITH `(a * b * c) * d = (a * b * d) * c`]); + (AP_TERM_TAC); + (AP_THM_TAC THEN AP_TERM_TAC THEN AP_THM_TAC THEN AP_TERM_TAC); + REAL_ARITH_TAC; + (* End subgoal 2 *) + +(PURE_ONCE_ASM_REWRITE_TAC[]); +(PURE_REWRITE_TAC[DOT_LMUL;DOT_RMUL]); +(PURE_REWRITE_TAC[NORM_MUL]); +(PURE_ONCE_REWRITE_TAC[REAL_ARITH `(a * b) * c * d = (a * c) * b * d`]); +(PURE_REWRITE_TAC[REAL_ABS_MUL]); + + + (SUBGOAL_THEN `&0 <= m /\ &0 <= n /\ &0 <= p` ASSUME_TAC); + ASM_REAL_ARITH_TAC; + + (SUBGOAL_THEN `abs m = m /\ abs n = n /\ abs p = p` ASSUME_TAC); + (UP_ASM_TAC THEN MESON_TAC[GSYM REAL_ABS_REFL]); + +(UP_ASM_TAC THEN STRIP_TAC); +(PURE_ONCE_ASM_REWRITE_TAC[]); +(PURE_ONCE_REWRITE_TAC[REAL_MUL_ASSOC]); +(PURE_ONCE_REWRITE_TAC[REAL_ARITH + `(m * m * m * p) * m * n = (m * m * n) * m * m * p`]); +(ABBREV_TAC `s = (m * m * n) * m * m * p`); +(PURE_ONCE_REWRITE_TAC[GSYM REAL_MUL_ASSOC]); +(PURE_REWRITE_TAC[real_div;REAL_INV_MUL]); +(PURE_ONCE_REWRITE_TAC[REAL_ARITH `(a * b * c) = (c * b) * a`]); +(REWRITE_TAC[REAL_ARITH `((a * b) * c) * d * e = (((c * d) * b) * a) * e`]); +(AP_THM_TAC THEN AP_TERM_TAC); +(AP_THM_TAC THEN AP_TERM_TAC); + +(PURE_ONCE_REWRITE_TAC[GSYM REAL_MUL_LID]); +(ONCE_REWRITE_TAC[REAL_ARITH `&1 * x * y = x * y`]); +(AP_THM_TAC THEN AP_TERM_TAC); +(MATCH_MP_TAC REAL_MUL_LINV); +(EXPAND_TAC "s"); +(MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`)); +(ASM_MESON_TAC[REAL_LT_MUL])]);; + +(*===========================================================================*) +(* THE THIRD LEMMA : *) +(* The lemmas help to compute p after rescaling *) +(* (in general) *) +(* *) +(*===========================================================================*) + +let compute_euler_p_after_rescale_t = +`!v0:real^3 v1 v2 v3 v0' v1' v2' v3' m n p. + v1 - v0 = m % (v1' - v0') /\ + v2 - v0 = n % (v2' - v0') /\ + v3 - v0 = p % (v3' - v0') /\ + &0 < m /\ + &0 < n /\ + &0 < p + ==> euler_p v0 v1 v2 v3 = (m * n * p) * euler_p v0' v1' v2' v3'`;; + + +let COMPUTE_EULER_P_AFTER_RESCALE = + prove_by_refinement (compute_euler_p_after_rescale_t, + +[(REPEAT GEN_TAC THEN STRIP_TAC); +(REWRITE_TAC[euler_p]); +(PURE_ONCE_REWRITE_TAC[ylist]); +(REPEAT LET_TAC); +(REPLICATE_TAC 8 UP_ASM_TAC); +(PURE_REWRITE_TAC[PAIR_EQ]); +(PURE_ONCE_REWRITE_TAC[DIST_SYM]); +(PURE_REWRITE_TAC[dist]); +(REPEAT STRIP_TAC); +(ASM_REWRITE_TAC[]); +(EXPAND_TAC "y1'" THEN EXPAND_TAC "y2'" THEN EXPAND_TAC "y3'"); +(EXPAND_TAC "y1" THEN EXPAND_TAC "y2" THEN EXPAND_TAC "y3"); +(REPLICATE_TAC 3 UP_ASM_TAC); +(REPLICATE_TAC 6 DEL_TAC); +(REPLICATE_TAC 3 UP_ASM_TAC); +(REPLICATE_TAC 6 DEL_TAC); +(REPEAT STRIP_TAC); + +(PURE_ONCE_ASM_REWRITE_TAC[]); +(REPLICATE_TAC 6 DEL_TAC); +(PURE_ONCE_ASM_REWRITE_TAC[]); +(PURE_ONCE_REWRITE_TAC[NORM_MUL]); + + + (SUBGOAL_THEN `&0 <= m /\ &0 <= n /\ &0 <= p` ASSUME_TAC); + (ASM_MESON_TAC[REAL_ARITH `&0 < a ==> &0 <= a`]); + (SUBGOAL_THEN `abs m = m /\ abs n = n /\ abs p = p` ASSUME_TAC); + (UP_ASM_TAC THEN MESON_TAC[REAL_ABS_REFL]); + +(PURE_ONCE_ASM_REWRITE_TAC[]); +(PURE_REWRITE_TAC[DOT_RMUL;DOT_LMUL]); +REAL_ARITH_TAC]);; + +(* ========================================================================= *) +(* THE 4-TH LEMMA *) +(* This lemma is for computing delta_x *) +(* *) +(* ========================================================================= *) + +let VECTOR_EQ_COMPONENT = prove + (`!x:real^N y i. x = y ==> x$i = y$i`, + REPEAT GEN_TAC THEN + SUBGOAL_THEN `?k. 1 <= k /\ k <= dimindex(:N) /\ !z:real^N. z$i = z$k` + CHOOSE_TAC THENL + [REWRITE_TAC[FINITE_INDEX_INRANGE]; + ASM_SIMP_TAC[vector_sub; CART_EQ; LAMBDA_BETA]]);; + +let compute_delta_x_after_rescale_t = + `!v0 v1 v2 v3 v0' v1' v2' v3' m n p x1 x2 x3 x4 x5 x6 x1' x2' x3' x4' x5' x6'. + v1:real^3 - v0 = m % (v1' - v0') /\ + v2 - v0 = n % (v2' - v0') /\ + v3 - v0 = p % (v3' - v0') /\ + &0 <= m /\ + &0 <= n /\ + &0 <= p /\ + x1',x2',x3',x4',x5',x6' = xlist v0' v1' v2' v3' /\ + x1,x2,x3,x4,x5,x6 = xlist v0 v1 v2 v3 /\ + &0 <= delta_x x1' x2' x3' x4' x5' x6' + ==> delta_x x1 x2 x3 x4 x5 x6 = + (m * n * p) * (m * n * p) * delta_x x1' x2' x3' x4' x5' x6'`;; + + +let COMPUTE_DELTA_X_AFTER_RESCALE = + +prove_by_refinement (compute_delta_x_after_rescale_t , + +[(REPEAT GEN_TAC THEN REPEAT STRIP_TAC); + + (SUBGOAL_THEN `delta_x x1 x2 x3 x4 x5 x6 = + (let a = v1:real^3 - v0 in + let b = v2 - v0 in + let c = v3 - v0 in + &4 * (a$1 * b$2 * c$3 - a$1 * b$3 * c$2 - a$2 * b$1 * c$3 + + a$2 * b$3 * c$1 + a$3 * b$1 * c$2 - a$3 * b$2 * c$1) pow 2)` + ASSUME_TAC); + (ASM_MESON_TAC[COMPUTE_DELTA_X]); + + (SUBGOAL_THEN `delta_x x1' x2' x3' x4' x5' x6' = + (let a' = v1':real^3 - v0' in + let b' = v2' - v0' in + let c' = v3' - v0' in + &4 * (a'$1 * b'$2 * c'$3 - a'$1 * b'$3 * c'$2 - a'$2 * b'$1 * c'$3 + + a'$2 * b'$3 * c'$1 + a'$3 * b'$1 * c'$2 - a'$3 * b'$2 * c'$1) pow 2)` + ASSUME_TAC); + (ASM_MESON_TAC[COMPUTE_DELTA_X]); + +(ASM_REWRITE_TAC[]); +(REPEAT LET_TAC); + + (SUBGOAL_THEN `(a:real^3)$1 = m * (a':real^3)$1 /\ + (b:real^3)$1 = n * (b':real^3)$1 /\ + (c:real^3)$1 = p * (c':real^3)$1 /\ + a$2 = m * a'$2 /\ + a$3 = m * a'$3 /\ + b$2 = n * b'$2 /\ + b$3 = n * b'$3 /\ + c$2 = p * c'$2 /\ + c$3 = p * c'$3` ASSUME_TAC); + + (ASM_MESON_TAC[VECTOR_EQ_COMPONENT;VECTOR_MUL_COMPONENT]); +(ONCE_ASM_REWRITE_TAC[]); +(REWRITE_TAC[POW_2]); +REAL_ARITH_TAC]);; + +(* =========================================================================*) +(* THE 5-TH LEMMA : *) +(* Similar lemma for computing Sqrt(delta_x) *) +(*==========================================================================*) + +let sqrt_delta_x_after_rescale = +`!v0 v1 v2 v3 v0' v1' v2' v3' m n p x1 x2 x3 x4 x5 x6 x1' x2' x3' x4' x5' x6'. + v1:real^3 - v0 = m % (v1' - v0') /\ + v2 - v0 = n % (v2' - v0') /\ + v3 - v0 = p % (v3' - v0') /\ + &0 <= m /\ + &0 <= n /\ + &0 <= p /\ + x1',x2',x3',x4',x5',x6' = xlist v0' v1' v2' v3' /\ + x1,x2,x3,x4,x5,x6 = xlist v0 v1 v2 v3 /\ + &0 <= delta_x x1' x2' x3' x4' x5' x6' + ==> sqrt (delta_x x1 x2 x3 x4 x5 x6) = + (m * n * p) * sqrt (delta_x x1' x2' x3' x4' x5' x6')`;; + +let SQRT_DELTA_X_AFTER_RESCALE = +prove_by_refinement (sqrt_delta_x_after_rescale, + +[(REPEAT GEN_TAC THEN REPEAT STRIP_TAC); + + (SUBGOAL_THEN + `delta_x x1 x2 x3 x4 x5 x6 = + (m * n * p) * (m * n * p) * delta_x x1' x2' x3' x4' x5' x6'` + ASSUME_TAC); + (ASM_MESON_TAC[COMPUTE_DELTA_X_AFTER_RESCALE]); + +(PURE_ONCE_ASM_REWRITE_TAC[]); +(ABBREV_TAC `S = m * n * p`); +(PURE_REWRITE_TAC[REAL_MUL_ASSOC]); + + (SUBGOAL_THEN + `sqrt ((S * S) * delta_x x1' x2' x3' x4' x5' x6') = + sqrt (S * S) * sqrt (delta_x x1' x2' x3' x4' x5' x6')` + ASSUME_TAC); + (MATCH_MP_TAC SQRT_MUL); + (EXPAND_TAC "S"); + (ASM_MESON_TAC[REAL_LE_MUL]); + +(PURE_ONCE_ASM_REWRITE_TAC[]); +(AP_THM_TAC THEN AP_TERM_TAC); + + (SUBGOAL_THEN `sqrt (S * S) = sqrt S pow 2` ASSUME_TAC); + (REWRITE_TAC[REAL_POW_2]); + (MATCH_MP_TAC SQRT_MUL); + (EXPAND_TAC "S"); + (ASM_MESON_TAC[REAL_LE_MUL]); + +(PURE_ONCE_ASM_REWRITE_TAC[]); +(MATCH_MP_TAC SQRT_POW_2); +(EXPAND_TAC "S"); +(ASM_MESON_TAC[REAL_LE_MUL])]);; + + +(* ===========================================================================*) +(* THE SIXTH LEMMA : *) +(* *) +(* This following sub-lemma is necessary for proving the 6-th Lemma *) +(* *) +(* ===========================================================================*) + +let SQRT_OF_POW_2_LE = prove_by_refinement ( + `!x. (&0 <= x) ==> sqrt (x pow 2) = x`, + +[(GEN_TAC THEN DISCH_TAC); + (REWRITE_TAC[REAL_POW_2]); + (SUBGOAL_THEN `sqrt (x * x) = (sqrt x) pow 2` ASSUME_TAC); (PURE_REWRITE_TAC[REAL_POW_2]); + (MATCH_MP_TAC SQRT_MUL); + (ASM_REWRITE_TAC[]); + (PURE_ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[SQRT_POW_2])]);; + +(* ===========================================================================*) +(* THE SIXTH LEMMA : *) +(* This lemma says that if the Euler formulation holds *) +(* for the case where x1 = x2 = x3 = 1 then it holds for all cases *) +(* *) +(* ===========================================================================*) + +let EULER_FORMULA_RESCALE = prove_by_refinement ( + `(!v0 v1:real^3 v2 v3 p x1 x2 x3 x4 x5 x6 alpha1 alpha2 alpha3 d w1 w2 w3. + p = euler_p v0 v1 v2 v3 /\ + x1,x2,x3,x4,x5,x6 = xlist v0 v1 v2 v3 /\ + alpha1 = dihV v0 v1 v2 v3 /\ + alpha2 = dihV v0 v2 v3 v1 /\ + alpha3 = dihV v0 v3 v1 v2 /\ + d = delta_x x1 x2 x3 x4 x5 x6 /\ + w1 = v1 - v0 /\ + w2 = v2 - v0 /\ + w3 = v3 - v0 /\ + &0 < d /\ + norm w1 = &1 /\ + norm w2 = &1 /\ + norm w3 = &1 + ==> alpha1 + alpha2 + alpha3 - pi = pi - &2 * atn2 (sqrt d,&2 * p)) + ==> (!v0 v1:real^3 v2 v3. + let p = euler_p v0 v1 v2 v3 in + let x1,x2,x3,x4,x5,x6 = xlist v0 v1 v2 v3 in + let alpha1 = dihV v0 v1 v2 v3 in + let alpha2 = dihV v0 v2 v3 v1 in + let alpha3 = dihV v0 v3 v1 v2 in + let d = delta_x x1 x2 x3 x4 x5 x6 in + &0 < d + ==> alpha1 + alpha2 + alpha3 - pi = pi - &2 * atn2 (sqrt d,&2 * p))`, + +(* -------------------------------------------------------------------------*) +(* Rescale by considering new points v1',v2',v3' *) +(* -------------------------------------------------------------------------*) + +[(DISCH_TAC THEN REPEAT GEN_TAC THEN REPEAT LET_TAC THEN DISCH_TAC); + +(ABBREV_TAC `v1' = v0 + inv (norm(v1:real^3 - v0)) % (v1 - v0)`); +(ABBREV_TAC `v2' = v0 + inv (norm(v2:real^3 - v0)) % (v2 - v0)`); +(ABBREV_TAC `v3' = v0 + inv (norm(v3:real^3 - v0)) % (v3 - v0)`); +(ABBREV_TAC `w1' = (v1':real^3) - v0`); +(ABBREV_TAC `w2' = (v2':real^3) - v0`); +(ABBREV_TAC `w3' = (v3':real^3)- v0`); + +(* -------------------------------------------------------------------------*) +(* Subgoal 1: &0 < norm (v1 - v0) *) +(* &0 < norm (v2 - v0) *) +(* &0 < norm (v3 - v0) *) +(* -------------------------------------------------------------------------*) + + (SUBGOAL_THEN + `&0 < norm (v1:real^3 - v0) /\ + &0 < norm (v2:real^3 - v0) /\ + &0 < norm (v3:real^3 - v0)` + ASSUME_TAC); + + (PURE_ONCE_REWRITE_TAC[NORM_POS_LT]); + (PURE_REWRITE_TAC[VECTOR_ARITH `(a - b = vec 0) <=> (a = b)`; + MESON[] `(a <=> b) <=> ~ a <=> ~ b`]); + (REPEAT CONJ_TAC); (* Break into 3 subgoal *) + + STRIP_TAC; + (SUBGOAL_THEN `collinear {v0:real^3 , v1, v2}` ASSUME_TAC); + (PURE_ONCE_ASM_REWRITE_TAC[]); + (PURE_REWRITE_TAC[collinear; SET_RULE `{a, a, b} = {a , b}`]); + (EXISTS_TAC `v2:real^3 - v0`); + (REPEAT GEN_TAC); + (REWRITE_TAC[SET_RULE ` x IN {a, b} <=> (x = a \/ x = b)`]); + STRIP_TAC; (* Break into 4 subgoals *) + + (PURE_ONCE_ASM_REWRITE_TAC[]); + (EXISTS_TAC `&0` THEN VECTOR_ARITH_TAC); + (PURE_ONCE_ASM_REWRITE_TAC[]); + (EXISTS_TAC `-- &1` THEN VECTOR_ARITH_TAC); + (PURE_ONCE_ASM_REWRITE_TAC[]); + (EXISTS_TAC `&1` THEN VECTOR_ARITH_TAC); + (PURE_ONCE_ASM_REWRITE_TAC[]); + (EXISTS_TAC `&0` THEN VECTOR_ARITH_TAC); + (ASM_MESON_TAC[DELTA_X_LT_0_COLLINEAR]); + + STRIP_TAC; + (SUBGOAL_THEN `collinear {v0:real^3 , v1, v2}` ASSUME_TAC); + (PURE_ONCE_ASM_REWRITE_TAC[]); + (PURE_REWRITE_TAC[collinear; SET_RULE `{a, b, a} = {a , b}`]); + (EXISTS_TAC `v1:real^3 - v0`); + (REPEAT GEN_TAC); + (REWRITE_TAC[SET_RULE ` x IN {a, b} <=> (x = a \/ x = b)`]); + STRIP_TAC; (* Break into 4 subgoals *) + + (PURE_ONCE_ASM_REWRITE_TAC[]); + (EXISTS_TAC `&0` THEN VECTOR_ARITH_TAC); + (PURE_ONCE_ASM_REWRITE_TAC[]); + (EXISTS_TAC `-- &1` THEN VECTOR_ARITH_TAC); + (PURE_ONCE_ASM_REWRITE_TAC[]); + (EXISTS_TAC `&1` THEN VECTOR_ARITH_TAC); + (PURE_ONCE_ASM_REWRITE_TAC[]); + (EXISTS_TAC `&0` THEN VECTOR_ARITH_TAC); + (ASM_MESON_TAC[DELTA_X_LT_0_COLLINEAR]); + + STRIP_TAC; + (SUBGOAL_THEN `collinear {v0:real^3 , v1, v3}` ASSUME_TAC); + (PURE_ONCE_ASM_REWRITE_TAC[]); + (PURE_REWRITE_TAC[collinear; SET_RULE `{a, b, a} = {a , b}`]); + (EXISTS_TAC `v1:real^3 - v0`); + (REPEAT GEN_TAC); + (REWRITE_TAC[SET_RULE ` x IN {a, b} <=> (x = a \/ x = b)`]); + STRIP_TAC; (* Break into 4 subgoals *) + + (PURE_ONCE_ASM_REWRITE_TAC[]); + (EXISTS_TAC `&0` THEN VECTOR_ARITH_TAC); + (PURE_ONCE_ASM_REWRITE_TAC[]); + (EXISTS_TAC `-- &1` THEN VECTOR_ARITH_TAC); + (PURE_ONCE_ASM_REWRITE_TAC[]); + (EXISTS_TAC `&1` THEN VECTOR_ARITH_TAC); + (PURE_ONCE_ASM_REWRITE_TAC[]); + (EXISTS_TAC `&0` THEN VECTOR_ARITH_TAC); + (ASM_MESON_TAC[DELTA_X_LT_0_COLLINEAR]); + + +(* -------------------------------------------------------------------------*) +(* Subgoal 2: w1', w2', w3' havnorms equal 1 *) +(* -------------------------------------------------------------------------*) + + (SUBGOAL_THEN + `norm (w1':real^3) = &1 /\ + norm (w2':real^3) = &1 /\ + norm (w3':real^3) = &1` + ASSUME_TAC); + + (EXPAND_TAC "w1'" THEN EXPAND_TAC "w2'" THEN EXPAND_TAC "w3'"); + (UP_ASM_TAC THEN REPLICATE_TAC 3 DEL_TAC THEN DISCH_TAC); + (EXPAND_TAC "v1'" THEN EXPAND_TAC "v2'" THEN EXPAND_TAC "v3'"); + (ONCE_REWRITE_TAC[VECTOR_ARITH `((a:real^3) + b) - a = b`]); + (REWRITE_TAC[NORM_MUL;REAL_ABS_INV]); + + (SUBGOAL_THEN + `abs (norm (v1 - v0)) = norm (v1:real^3 - v0) /\ + abs (norm (v2 - v0)) = norm (v2:real^3 - v0) /\ + abs (norm (v3 - v0)) = norm (v3:real^3 - v0)` + ASSUME_TAC); + (SIMP_TAC[NORM_POS_LE;REAL_ABS_REFL]); + + (ONCE_ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[REAL_ARITH `&0 < a ==> ~(a = &0)`;REAL_MUL_LINV]); + +(* ------------------------------------------------------------------------- *) +(* SUBGOAL 3 : *) +(* alpha1, alpha2, alpha3 arunchanged *) +(* ------------------------------------------------------------------------- *) + +(ABBREV_TAC `alpha1' = dihV (v0:real^3) v1' v2' v3'`); +(ABBREV_TAC `alpha2' = dihV (v0:real^3) v2' v3' v1'`); +(ABBREV_TAC `alpha3' = dihV (v0:real^3) v3' v1' v2'`); + + (SUBGOAL_THEN + `alpha1:real = alpha1' /\ alpha2:real = alpha2' /\ alpha3:real = alpha3'` + ASSUME_TAC); + (EXPAND_TAC "alpha1" THEN EXPAND_TAC "alpha2" THEN EXPAND_TAC "alpha3"); + (EXPAND_TAC "alpha1'" THEN EXPAND_TAC "alpha2'" THEN EXPAND_TAC "alpha3'"); + (ABBREV_TAC `m = inv (norm (v1:real^3 - v0))`); + (ABBREV_TAC `n = inv (norm (v2:real^3 - v0))`); + (ABBREV_TAC `q = inv (norm (v3:real^3 - v0))`); + + (SUBGOAL_THEN + ` v1' - v0 = m % (v1:real^3 - v0) /\ + v2' - v0 = n % (v2:real^3 - v0) /\ + v3' - v0 = q % (v3:real^3 - v0)` + ASSUME_TAC); + (EXPAND_TAC "v1'" THEN EXPAND_TAC "v2'" THEN EXPAND_TAC "v3'"); + (VECTOR_ARITH_TAC); + + (SUBGOAL_THEN `&0 < m /\ &0 < n /\ &0 < q ` ASSUME_TAC); + (EXPAND_TAC "m" THEN EXPAND_TAC "n" THEN EXPAND_TAC "q"); + (REPLICATE_TAC 8 DEL_TAC THEN UP_ASM_TAC THEN STRIP_TAC); + (ASM_MESON_TAC[REAL_LT_INV]); + + (ASM_MESON_TAC[DIHV_RESCALE_UNCHANGED]); + + +(* ========================================================================== *) +(* Subgoal 4: *) +(* (x1',x2',x3,'x4',x5',x6') = xlist (v0:real^3) v1' v2' v3' *) +(* ========================================================================== *) + +(ABBREV_TAC `p' = euler_p (v0:real^3) v1' v2' v3'`); +(ABBREV_TAC `x1' = dist (v0:real^3,v1') pow 2`); +(ABBREV_TAC `x2' = dist (v0:real^3,v2') pow 2`); +(ABBREV_TAC `x3' = dist (v0:real^3,v3') pow 2`); +(ABBREV_TAC `x4' = dist (v2':real^3,v3') pow 2`); +(ABBREV_TAC `x5' = dist (v1':real^3,v3') pow 2`); +(ABBREV_TAC `x6' = dist (v1':real^3,v2') pow 2`); +(ABBREV_TAC `d' = delta_x (x1':real) x2' x3' x4' x5' x6' `); + + (SUBGOAL_THEN + `x1':real,x2',x3',x4',x5',x6' = + xlist (v0:real^3) v1' v2' v3'` + ASSUME_TAC); + + (REWRITE_TAC[xlist;ylist]); + (REPEAT LET_TAC); + (UP_ASM_TAC THEN PURE_REWRITE_TAC[PAIR_EQ] THEN STRIP_TAC); + (ASM_MESON_TAC[PAIR_EQ]); + +(* --------------------------------------------------------------------------*) +(* Subgoal 5: *) +(* p' = k * p with somk *) +(*---------------------------------------------------------------------------*) + +(ABBREV_TAC `t1 = inv (norm ((v1:real^3) - v0)) `); +(ABBREV_TAC `t2 = inv (norm ((v2:real^3) - v0)) `); +(ABBREV_TAC `t3 = inv (norm ((v3:real^3) - v0)) `); + + (SUBGOAL_THEN `p' = (t1 * t2 * t3) * p` ASSUME_TAC); + (EXPAND_TAC "p" THEN EXPAND_TAC "p'"); + (MATCH_MP_TAC COMPUTE_EULER_P_AFTER_RESCALE); + (EXPAND_TAC "v1'" THEN EXPAND_TAC "v2'" THEN EXPAND_TAC "v3'"); + (REWRITE_TAC[VECTOR_ARITH `((a:real^3) + b) - a = b`]); + (EXPAND_TAC "t1" THEN EXPAND_TAC "t2" THEN EXPAND_TAC "t3"); + (ASM_MESON_TAC[REAL_LT_INV]); + +(* --------------------------------------------------------------------------*) +(* Subgoal 6: *) +(* d' = k * d with somk *) +(*---------------------------------------------------------------------------*) + + (SUBGOAL_THEN `d' = (t1 * t2 * t3) * (t1 * t2 * t3) * d` ASSUME_TAC); + (EXPAND_TAC "d" THEN EXPAND_TAC "d'"); + (MATCH_MP_TAC COMPUTE_DELTA_X_AFTER_RESCALE); + (EXISTS_TAC `v0:real^3`); + (EXISTS_TAC `v1':real^3`); + (EXISTS_TAC `v2':real^3`); + (EXISTS_TAC `v3':real^3`); + (EXISTS_TAC `v0:real^3`); + (EXISTS_TAC `v1:real^3`); + (EXISTS_TAC `v2:real^3`); + (EXISTS_TAC `v3:real^3`); + (EXPAND_TAC "v1'" THEN EXPAND_TAC "v2'" THEN EXPAND_TAC "v3'"); + (REWRITE_TAC[VECTOR_ARITH `((a:real^3) + b) - a = b`]); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `&0 < t1 /\ &0 < t2 /\ &0 < t3 /\ &0 < d` ASSUME_TAC); + (EXPAND_TAC "t1" THEN EXPAND_TAC "t2" THEN EXPAND_TAC "t3"); + (REPLICATE_TAC 18 DEL_TAC); + (UP_ASM_TAC THEN REPLICATE_TAC 6 DEL_TAC THEN UP_ASM_TAC); + (MESON_TAC[REAL_LT_INV]); + + (UP_ASM_TAC THEN MESON_TAC[REAL_ARITH `&0 < a ==> &0 <= a`]); + + +(* -------------------------------------------------------------------------- *) +(* Subgoal 7: *) +(* This part is thproof of d' > 0 *) +(* -------------------------------------------------------------------------- *) + + + (SUBGOAL_THEN `&0 < d'` ASSUME_TAC); + (PURE_ONCE_ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `&0 < t1 /\ &0 < t2 /\ &0 < t3 /\ &0 < d` ASSUME_TAC); + (EXPAND_TAC "t1" THEN EXPAND_TAC "t2" THEN EXPAND_TAC "t3"); + (REPLICATE_TAC 19 DEL_TAC); + (UP_ASM_TAC THEN REPLICATE_TAC 6 DEL_TAC THEN UP_ASM_TAC); + (MESON_TAC[REAL_LT_INV]); + + (UP_ASM_TAC THEN MESON_TAC[REAL_LT_MUL]); + +(*---------------------------------------------------------------------------*) +(* Subgoal 8: *) +(* atn2 (sqrt d,&2 * p) is unchanged *) +(*---------------------------------------------------------------------------*) + + (SUBGOAL_THEN `&2 * atn2 (sqrt (d':real), &2 * (p':real)) = + &2 * atn2 (sqrt (d:real), &2 * (p:real))` ASSUME_TAC); + AP_TERM_TAC; + (* Sugoal 8.1 *) + + (SUBGOAL_THEN `&0 < sqrt d /\ &0 < sqrt d'` ASSUME_TAC); + (MESON_TAC[ASSUME `&0 < d`; ASSUME `&0 < d'`; SQRT_POS_LT]); + (* Sugoal 8.2 *) + (SUBGOAL_THEN `atn2 (sqrt d,&2 * p) = atn ((&2 * p) / sqrt d)` + ASSUME_TAC); + (FIRST_ASSUM MP_TAC THEN MESON_TAC[ATN2_BREAKDOWN]); + (* Sugoal 8.3 *) + + (SUBGOAL_THEN `atn2 (sqrt d',&2 * p') = atn ((&2 * p') / sqrt d')` + ASSUME_TAC); + (MESON_TAC[ASSUME `&0 < sqrt d /\ &0 < sqrt d'`; ATN2_BREAKDOWN]); + + (ONCE_ASM_REWRITE_TAC[]); + AP_TERM_TAC; + (DEL_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN STRIP_TAC); + + (* Sugoal 8.4 *) + (SUBGOAL_THEN `((&2 * p') / sqrt d' = (&2 * p) / sqrt d) <=> + &2 * p' = ((&2 * p) / sqrt d) * sqrt d'` + ASSUME_TAC); + (UP_ASM_TAC THEN MESON_TAC[REAL_EQ_LDIV_EQ]); + + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `((x * y) / b) * c = x * (c * y) / b`]); + AP_TERM_TAC; + DEL_TAC; + (PURE_ASM_REWRITE_TAC[REAL_EQ_LDIV_EQ]); + (PURE_ONCE_REWRITE_TAC[REAL_ARITH `(x * y) / b = (x / b) * y`]); + (AP_THM_TAC THEN AP_TERM_TAC); + (ABBREV_TAC `S = t1 * t2 * t3`); + (REWRITE_TAC[REAL_MUL_ASSOC;GSYM REAL_POW_2]); + + (* Subgoal 8.5 *) + (SUBGOAL_THEN `sqrt (S pow 2 * d) = sqrt (S pow 2) * sqrt d` ASSUME_TAC); + (MATCH_MP_TAC SQRT_MUL); + (ASM_SIMP_TAC[REAL_ARITH `&0 < a ==> &0 <= a`]); + (MESON_TAC[REAL_LE_POW_2]); + + (ONCE_ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[REAL_ARITH `(a * b) / c = a * (b / c)`]); + + (* Subgoal 8.6 *) + (SUBGOAL_THEN `sqrt d / sqrt d = &1` ASSUME_TAC); + (MATCH_MP_TAC REAL_DIV_REFL); + (ASM_SIMP_TAC[REAL_ARITH `&0 < a ==> ~ (a = &0)`]); + + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_MUL_RID]); + (MATCH_MP_TAC (GSYM SQRT_OF_POW_2_LE)); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`)); + (EXPAND_TAC "S"); + + (* Subgoal 8.7 *) + (SUBGOAL_THEN `&0 < t1 /\ &0 < t2 /\ &0 < t3 /\ &0 < d` ASSUME_TAC); + (EXPAND_TAC "t1" THEN EXPAND_TAC "t2" THEN EXPAND_TAC "t3"); + (REPLICATE_TAC 19 DEL_TAC); + (ASM_MESON_TAC[REAL_LT_INV]); + (UP_ASM_TAC THEN MESON_TAC[REAL_LT_MUL]); + +(*---------------------------------------------------------------------------*) +(* SUBGOAL 9 : *) +(* Finish the lemma about rescaling *) +(*---------------------------------------------------------------------------*) + + (SUBGOAL_THEN + `alpha1' + alpha2' + alpha3' - pi = pi - &2 * atn2 (sqrt d',&2 * p')` + ASSUME_TAC); + (ASM_MESON_TAC[]); + +(ASM_MESON_TAC[])]);; + +(* ==========================================================================*) +(* LEMMA 7 : *) +(* ~ collinear {a, b, c} ==> norm(a - b) > &0 *) +(* ==========================================================================*) + +let COLLINEAR_NORM_LT_0 = prove_by_refinement ( + `!(a:real^3) b c. ~collinear {a, b, c} ==> &0 < norm (a - b)`, + +[(REPEAT GEN_TAC THEN REPEAT STRIP_TAC); +(REWRITE_TAC[NORM_POS_LT]); +STRIP_TAC; +(UP_ASM_TAC THEN PURE_ONCE_REWRITE_TAC[ + VECTOR_ARITH `(a:real^3) - b = vec 0 <=> b - a = vec 0`]); +STRIP_TAC; + + (SUBGOAL_THEN `collinear {(a:real^3), b, c}` ASSUME_TAC); + (MATCH_MP_TAC (GEN_ALL ALLEMI_COLLINEAR)); + (ASM_REWRITE_TAC[]); + (MESON_TAC [VECTOR_ARITH `a dot vec 0 = &0`; + VECTOR_ARITH `a % vec 0 = vec 0`; + VECTOR_ARITH `(&0) % c = vec 0`]); +(ASM_MESON_TAC[])]);; + +(* ========================================================================= *) +(* LEMMA 8: *) +(* ========================================================================= *) + +let REAL_LT_RSQRT2 = prove + (`!x y. x pow 2 < y ==> -- sqrt y < x`, + REPEAT STRIP_TAC THEN + MATCH_MP_TAC(REAL_ARITH `abs x < a ==> -- a < x`) THEN + REWRITE_TAC[GSYM POW_2_SQRT_ABS] THEN + MATCH_MP_TAC SQRT_MONO_LT THEN + ASM_REWRITE_TAC[REAL_POW_2; REAL_LE_SQUARE]);; + +let EULER_TRIANGLE_REAL_INTERVAL = prove_by_refinement ( + `!s a b c. + s = {x | &0 < ups_x x b c - x * b * c} /\ &0 < ups_x a b c - a * b * c + ==> is_realinterval s`, + +[(REPEAT GEN_TAC THEN STRIP_TAC); +(ABBREV_TAC `d = b * c * b * c / &4 - b * c * (b + c) + &4 * b * c `); +(ABBREV_TAC `f = (\a. a - b - c + b * c / &2)`); + +(* ------------------------------------------------------------------------- *) +(* SUBGOAL 1 *) +(* ------------------------------------------------------------------------- *) + + + (SUBGOAL_THEN `&0 < d` ASSUME_TAC); + (EXPAND_TAC "d" THEN DEL_TAC THEN DEL_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[ups_x] THEN DISCH_TAC); + (MATCH_MP_TAC (REAL_ARITH + `&0 <= (a - b - c + b * c / &2) pow 2 /\ + &0 < S - (a - b - c + b * c / &2) pow 2 ==> &0 < S`)); + (REWRITE_TAC[REAL_LE_POW_2]); + ASM_REAL_ARITH_TAC; + +(* ------------------------------------------------------------------------- *) +(* SUBGOAL 2 *) +(* ------------------------------------------------------------------------- *) + + (SUBGOAL_THEN + `!(z:real). z IN s <=> f z < sqrt d /\ --sqrt d < f z` + ASSUME_TAC); + GEN_TAC; + (ONCE_ASM_REWRITE_TAC[] THEN ONCE_ASM_REWRITE_TAC[IN_ELIM_THM]); + (EQ_TAC); (* Break into 2 subgoal 2.1 and 2.2 *) + + (REWRITE_TAC[ups_x] THEN DISCH_TAC); + (SUBGOAL_THEN `(f (z:real)) pow 2 < d /\ (f z) pow 2 < d` ASSUME_TAC); + (EXPAND_TAC "d" THEN EXPAND_TAC "f"); + (PURE_REWRITE_TAC[REAL_POW_2]); + (ASM_REAL_ARITH_TAC); + (ASM_MESON_TAC[REAL_LT_RSQRT;REAL_LT_RSQRT2]); + + (REWRITE_TAC[ups_x] THEN EXPAND_TAC "f"); + STRIP_TAC; + (REWRITE_TAC[REAL_ARITH + `(--z * z - b * b - c * c + &2 * z * c + &2 * z * b + &2 * b * c) - + z * b * c = + (b * c * b * c / &4 - b * c * (b + c) + &4 * b * c) - + (z - b - c + b * c / &2) pow 2`]); + (REWRITE_TAC[REAL_ARITH `&0 < a - b <=> b < a`]); + (PURE_ONCE_ASM_REWRITE_TAC[]); + (REPLICATE_TAC 2 UP_ASM_TAC THEN PURE_REWRITE_TAC[MESON[REAL_BOUNDS_LT] + `(a < x ==> -- x < a ==> y) <=> abs a < x ==> y` ]); + DISCH_TAC; + + (SUBGOAL_THEN `d = sqrt d pow 2` ASSUME_TAC); + (ASM_MESON_TAC[REAL_ARITH `&0 < a ==> &0 <= a`; SQRT_POW_2]); + (PURE_ONCE_ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[GSYM REAL_LT_SQUARE_ABS]); + (MATCH_MP_TAC (REAL_ARITH `x = sqrt d /\ y < sqrt d ==> y < x`)); + (ASM_REWRITE_TAC[]); + (PURE_REWRITE_TAC[REAL_ABS_REFL]); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> &0 <= x`)); + (ASM_MESON_TAC[SQRT_POS_LT]); + +(* ------------------------------------------------------------------------- *) +(* LAST SUBGOALS *) +(* ------------------------------------------------------------------------- *) + +(REWRITE_TAC[is_realinterval]); +(REPEAT GEN_TAC THEN STRIP_TAC); +(ONCE_ASM_REWRITE_TAC[]); +CONJ_TAC; + + (SUBGOAL_THEN `f (c':real) <= f b'` ASSUME_TAC); + (EXPAND_TAC "f" THEN ASM_REAL_ARITH_TAC); + (SUBGOAL_THEN `f (b':real) < sqrt d` ASSUME_TAC); + (EXPAND_TAC "f" THEN ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC); + + (SUBGOAL_THEN `f (a':real) <= f c'` ASSUME_TAC); + (EXPAND_TAC "f" THEN ASM_REAL_ARITH_TAC); + (SUBGOAL_THEN `-- sqrt d < f (a':real)` ASSUME_TAC); + (EXPAND_TAC "f" THEN ASM_MESON_TAC[]); + (ASM_REAL_ARITH_TAC)]);; + +(* ==========================================================================*) +(* LEMMA 10: *) +(* *) +(* ==========================================================================*) + +let OJEKOJF2 = + prove (`!v0:real^3 v1 v2 v3. + let ga = dihV v0 v1 v2 v3 in + let v01 = dist (v0,v1) pow 2 in + let v02 = dist (v0,v2) pow 2 in + let v03 = dist (v0,v3) pow 2 in + let v12 = dist (v1,v2) pow 2 in + let v13 = dist (v1,v3) pow 2 in + let v23 = dist (v2,v3) pow 2 in + ~collinear {v0, v1, v2} /\ ~collinear {v0, v1, v3} + ==> ga = + pi / &2 - + atn2 + (sqrt (&4 * v01 * delta_x v01 v02 v03 v23 v13 v12), + delta_x4 v01 v02 v03 v23 v13 v12)`, + MP_TAC OJEKOJF THEN REPEAT LET_TAC THEN MESON_TAC[]);; + +let COMPUTE_DIHV_ATN2 = prove +(`!(v0:real^3) v1 v2 v3 gamma x1 x2 x3 x4 x5 x6. + gamma = dihV v0 v1 v2 v3 /\ + x1 = dist (v0,v1) pow 2 /\ + x2 = dist (v0,v2) pow 2 /\ + x3 = dist (v0,v3) pow 2 /\ + x6 = dist (v1,v2) pow 2 /\ + x5 = dist (v1,v3) pow 2 /\ + x4 = dist (v2,v3) pow 2 /\ + ~collinear {v0, v1, v2} /\ + ~collinear {v0, v1, v3} + ==> gamma = pi / &2 - atn2( sqrt ( &4 * x1 * delta_x x1 x2 x3 x4 x5 x6), + delta_x4 x1 x2 x3 x4 x5 x6)`, +REPEAT STRIP_TAC THEN MP_TAC OJEKOJF2 THEN REPEAT LET_TAC THEN +ASM_REWRITE_TAC[] THEN EXPAND_TAC "ga" THEN +EXPAND_TAC "v01" THEN EXPAND_TAC "v02" THEN EXPAND_TAC "v03" THEN +EXPAND_TAC "v13" THEN EXPAND_TAC "v23" THEN EXPAND_TAC "v12" THEN +DISCH_TAC THEN FIRST_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]);; + +end;; diff --git a/text_formalization/trigonometry/euler_main_theorem.hl b/text_formalization/trigonometry/euler_main_theorem.hl new file mode 100755 index 0000000..3024927 --- /dev/null +++ b/text_formalization/trigonometry/euler_main_theorem.hl @@ -0,0 +1,522 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* COMPLEMENT LEMMAS FOR EULER TRIANGLE LEMMA *) +(* *) +(* EULER TRIANGLE LEMMA *) +(* *) +(* Authour : VU KHAC KY *) +(* Date : 2010-04-02 *) +(* Books name: JLPSDHF *) +(* ========================================================================= *) + + +(* =========================================================================*) +(* *) +(* BEGIN THE MAIN THEORM ABOUT EULER ANGLE SUM *) +(* *) +(*==========================================================================*) + + +flyspeck_needs "general/sphere.hl";; + +flyspeck_needs "general/prove_by_refinement.hl";; + +flyspeck_needs "trigonometry/trig1.hl";; +flyspeck_needs "trigonometry/trig2.hl";; +flyspeck_needs "trigonometry/delta_x.hl";; +flyspeck_needs "trigonometry/euler_complement.hl";; +flyspeck_needs "trigonometry/euler_multivariate.hl";; + + + +module Euler_main_theorem = struct + +open Sphere;; +open Trigonometry1;; +open Trigonometry2;; +open Prove_by_refinement;; +open Delta_x;; +open Euler_complement;; +open Euler_multivariate;; + +let euler_angle_sum_rescale = + ` !v0:real^3 v1 v2 v3 p x1 x2 x3 x4 x5 x6 alpha1 alpha2 alpha3 d w1 w2 w3. + p = euler_p v0 v1 v2 v3 /\ + x1,x2,x3,x4,x5,x6 = xlist v0 v1 v2 v3 /\ + alpha1 = dihV v0 v1 v2 v3 /\ + alpha2 = dihV v0 v2 v3 v1 /\ + alpha3 = dihV v0 v3 v1 v2 /\ + d = delta_x x1 x2 x3 x4 x5 x6 /\ + w1 = v1 - v0 /\ + w2 = v2 - v0 /\ + w3 = v3 - v0 /\ + &0 < d /\ + norm w1 = &1 /\ + norm w2 = &1 /\ + norm w3 = &1 + ==> alpha1 + alpha2 + alpha3 - pi = pi - &2 * atn2 (sqrt d,&2 * p)`;; + +let EULER_ANGLE_SUM_rescal = prove_by_refinement (euler_angle_sum_rescale , + +[ (REPEAT GEN_TAC) ; + (REPEAT STRIP_TAC); + (REPLICATE_TAC 11 UP_ASM_TAC); + (FIRST_ASSUM MP_TAC THEN SWITCH_TAC THEN FIRST_ASSUM MP_TAC); + (REWRITE_TAC[euler_p;xlist;ylist]); + (REPEAT LET_TAC); + (REPEAT UP_ASM_TAC THEN REWRITE_TAC[PAIR_EQ] THEN REPEAT STRIP_TAC); + +(* ==========================================================================*) +(* 3 FIRST SUBGOALS: *) +(* ==========================================================================*) + + (SUBGOAL_THEN + ` ~collinear {(v0:real^3), v1, v2} /\ + ~collinear {v0, v1, v3} /\ + ~collinear {v0, v3, v2}` + ASSUME_TAC); + (ASM_MESON_TAC[DELTA_X_LT_0_COLLINEAR]); + + (SUBGOAL_THEN `y1 = &1 /\ y2 = &1 /\ y3 = &1` ASSUME_TAC); + (EXPAND_TAC "y1" THEN EXPAND_TAC "y2" THEN EXPAND_TAC "y3"); + (PURE_ONCE_REWRITE_TAC[DIST_SYM]); + (PURE_ONCE_REWRITE_TAC[dist]); + (ASM_MESON_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (SUBGOAL_THEN `x1 = &1 /\ x2 = &1 /\ x3 = &1` ASSUME_TAC); + (ASM_REWRITE_TAC[]); + (ONCE_ASM_REWRITE_TAC[REAL_POW_2]); + REAL_ARITH_TAC; + (UP_ASM_TAC THEN STRIP_TAC); + +(* ==========================================================================*) +(* Subgoal 4: Comput p and delta *) +(* ==========================================================================*) + + (SUBGOAL_THEN + `&2 * p = &8 - x4 - x5 - x6 /\ d = ups_x x4 x5 x6 - x4 * x5 * x6` + ASSUME_TAC); + + (SUBGOAL_THEN + `x4 = (v2 - v3) dot (v2 - v3:real^3) /\ + x5 = (v1 - v3) dot (v1 - v3) /\ + x6 = (v1 - v2) dot (v1 - v2)` + ASSUME_TAC); + + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6"); + (ONCE_REWRITE_TAC[dist]); + (REWRITE_TAC[NORM_POW_2]); + + CONJ_TAC; (* Break into 2 subgoals *) + + (REPEAT UP_ASM_TAC THEN DISCH_TAC THEN DISCH_TAC); + (DEL_TAC THEN REPEAT DISCH_TAC); + (ONCE_ASM_REWRITE_TAC[]); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC [REAL_MUL_LID]); + (EXPAND_TAC "w1'" THEN EXPAND_TAC "w2'" THEN EXPAND_TAC "w3'"); + (EXPAND_TAC "y4" THEN EXPAND_TAC "y5" THEN EXPAND_TAC "y6"); + (REWRITE_TAC[dist]); + (REWRITE_TAC[NORM_POW_2]); + (ASM_MESON_TAC[LEMMA_FOR_EULER_AFTER_RESCALE]); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ups_x;delta_x]); + (ONCE_ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + +(* ========================================================================= *) +(* Re-comput alpha1, alpha2, alpha3 . *) +(* ========================================================================= *) + +(* ------------------------------------------------------------------------- *) +(* Subgoal 5: alpha1 *) +(* ------------------------------------------------------------------------- *) + + + (SUBGOAL_THEN + `alpha1 = + pi / &2 - + atn2 (sqrt (&4 * x1 * delta_x x1 x2 x3 x4 x5 x6),delta_x4 x1 x2 x3 x4 x5 x6)` + ASSUME_TAC); + + (REPLICATE_TAC 7 DEL_TAC THEN UP_ASM_TAC THEN DISCH_TAC); + (MP_TAC COMPUTE_DIHV_ATN2); + (ASM_MESON_TAC[COMPUTE_DIHV_ATN2]); + +(* ------------------------------------------------------------------------- *) +(* Subgoal 6: alpha2 *) +(* ------------------------------------------------------------------------- *) + + (SUBGOAL_THEN + `alpha2 = + pi / &2 - + atn2 (sqrt (&4 * x2 * delta_x x2 x3 x1 x5 x6 x4),delta_x4 x2 x3 x1 x5 x6 x4)` + ASSUME_TAC); + + (REPLICATE_TAC 8 DEL_TAC); + + (SUBGOAL_THEN + `x4 = dist (v2:real^3,v3) pow 2 /\ + x5 = dist (v3,v1) pow 2 /\ + x6 = dist (v2,v1) pow 2 /\ + ~collinear {v0, v2, v3} /\ + ~collinear {v0, v2, v1}` + ASSUME_TAC); + (ASM_MESON_TAC[DIST_SYM;SET_RULE `{v0,v1, v2} = {v0,v2,v1}`]); + + (REPLICATE_TAC 13 UP_ASM_TAC THEN REPLICATE_TAC 3 DEL_TAC); + (REPEAT DISCH_TAC); + (ONCE_ASM_REWRITE_TAC[]); + (EXPAND_TAC "y1" THEN EXPAND_TAC "y2" THEN EXPAND_TAC "y3"); + (ASM_MESON_TAC[COMPUTE_DIHV_ATN2]); + +(* ------------------------------------------------------------------------- *) +(* Subgoal 7: alpha3 *) +(* ------------------------------------------------------------------------- *) + + + (SUBGOAL_THEN + `alpha3 = + pi / &2 - + atn2 (sqrt (&4 * x3 * delta_x x3 x1 x2 x6 x4 x5),delta_x4 x3 x1 x2 x6 x4 x5)` + ASSUME_TAC); + + (REPLICATE_TAC 9 DEL_TAC); + + (SUBGOAL_THEN + `x5 = dist (v3:real^3,v1) pow 2 /\ + x4 = dist (v3,v2) pow 2 /\ + x6 = dist (v1,v2) pow 2 /\ + ~collinear {v0, v3, v1} /\ + ~collinear {v0, v3, v2}` + ASSUME_TAC); + (ASM_MESON_TAC[DIST_SYM;SET_RULE `{v0,v1, v2} = {v0,v2,v1}`]); + + (REPLICATE_TAC 13 UP_ASM_TAC THEN REPLICATE_TAC 3 DEL_TAC); + (REPEAT DISCH_TAC); + (ONCE_ASM_REWRITE_TAC[]); + (EXPAND_TAC "y1" THEN EXPAND_TAC "y2" THEN EXPAND_TAC "y3"); + (ASM_MESON_TAC[COMPUTE_DIHV_ATN2]); + +(* ------------------------------------------------------------------------- *) +(* Subgoal 8: delta_x is symmetry *) +(* ------------------------------------------------------------------------- *) + + (SUBGOAL_THEN + `delta_x x2 x3 x1 x5 x6 x4 = d /\ delta_x x3 x1 x2 x6 x4 x5 = d` + ASSUME_TAC); + + (SUBGOAL_THEN + `x2, x3, x1, x5, x6, x4 = xlist (v0:real^3) v2 v3 v1` + ASSUME_TAC); + (REWRITE_TAC[xlist;ylist]); + (REPEAT LET_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[PAIR_EQ] THEN STRIP_TAC); + (ASM_MESON_TAC[DIST_SYM]); + + (SUBGOAL_THEN + `x3, x1, x2, x6, x4, x5 = xlist (v0:real^3) v3 v1 v2` + ASSUME_TAC); + (REWRITE_TAC[xlist;ylist]); + (REPEAT LET_TAC); + (UP_ASM_TAC THEN REWRITE_TAC[PAIR_EQ] THEN STRIP_TAC); + (ASM_MESON_TAC[DIST_SYM]); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[delta_x]); + REAL_ARITH_TAC; + +(* ------------------------------------------------------------------------- *) +(* Subgoal 9: Th simplest form of alpha1,2,3 *) +(* ------------------------------------------------------------------------- *) + + (SUBGOAL_THEN + `alpha1 = + pi / &2 - atn ((-- &2 * x4 + &2 * x5 + &2 * x6 - x5 * x6) / sqrt (&4 * d)) /\ + alpha2 = + pi / &2 - atn ((-- &2 * x5 + &2 * x6 + &2 * x4 - x6 * x4) / sqrt (&4 * d)) /\ + alpha3 = + pi / &2 - atn ((-- &2 * x6 + &2 * x4 + &2 * x5 - x4 * x5) / sqrt (&4 * d))` + ASSUME_TAC); + + (ABBREV_TAC `4D = &4 * d`); + (REPLICATE_TAC 21 UP_ASM_TAC THEN REPLICATE_TAC 9 DEL_TAC); + (REPEAT DISCH_TAC); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `a - x = a - y <=> x = y`]); + + (REWRITE_TAC[GSYM (ASSUME `d = delta_x x1 x2 x3 x4 x5 x6`)]); + (REWRITE_TAC[ASSUME `delta_x x2 x3 x1 x5 x6 x4 = d /\ + delta_x x3 x1 x2 x6 x4 x5 = d`]); + + (REWRITE_TAC[delta_x4]); + (REWRITE_TAC[ASSUME `x1 = &1`]); + (REWRITE_TAC[ASSUME `x2 = &1`]); + (REWRITE_TAC[ASSUME `x3 = &1`]); + (REWRITE_TAC[REAL_MUL_LID;REAL_MUL_RID]); + + (REWRITE_TAC[REAL_ARITH + `-- &1 - x4 + x5 + x6 - x5 * x6 + -- &1 + &1 + &1 - x4 + x5 + x6 + = (-- &2 * x4 + &2 * x5 + &2 * x6 - x5 * x6) /\ + -- &1 - x5 + x6 + x4 - x6 * x4 + -- &1 + &1 + &1 - x5 + x6 + x4 + = (-- &2 * x5 + &2 * x6 + &2 * x4 - x6 * x4) /\ + -- &1 - x6 + x4 + x5 - x4 * x5 + -- &1 + &1 + &1 - x6 + x4 + x5 + = (-- &2 * x6 + &2 * x4 + &2 * x5 - x4 * x5)`]); + (EXPAND_TAC "4D"); + + (SUBGOAL_THEN `&0 < sqrt (&4 * d)` ASSUME_TAC); + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_MESON_TAC[REAL_ARITH `&0 < &4`;REAL_LT_MUL]); + + (ASM_MESON_TAC[ATN2_BREAKDOWN]); + +(* ------------------------------------------------------------------------- *) +(* Subgoal 10, 11: Something remains *) +(* ------------------------------------------------------------------------- *) + + (ABBREV_TAC `a = (x4:real)`); + (ABBREV_TAC `b = (x5:real)`); + (ABBREV_TAC `c = (x6:real)`); + + (SUBGOAL_THEN + `atn2 (sqrt d,&2 * p) = atn ((&8 - a - b - c) / sqrt d)` + ASSUME_TAC); + (SUBGOAL_THEN `&0 < sqrt d ` ASSUME_TAC); + (MATCH_MP_TAC SQRT_POS_LT THEN ASM_MESON_TAC[]); + + (ASM_MESON_TAC[ATN2_BREAKDOWN]); + + + (SUBGOAL_THEN `sqrt (&4 * d) = &2 * sqrt d` ASSUME_TAC); + (SUBGOAL_THEN `sqrt (&4 * d) = sqrt (&4) * sqrt d` ASSUME_TAC); + (MATCH_MP_TAC SQRT_MUL); + ASM_REAL_ARITH_TAC; + (ASM_REWRITE_TAC[]); + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_TAC[REAL_ARITH `&4 = &2 * &2 `]); + (REWRITE_TAC[MESON[SQRT_MUL;REAL_ARITH `&0 <= &2`] + `sqrt (&2 * &2) = sqrt (&2) * sqrt (&2)`]); + (REWRITE_TAC[GSYM POW_2]); + (MATCH_MP_TAC SQRT_POW_2); + REAL_ARITH_TAC; + + (REPLICATE_TAC 7 UP_ASM_TAC THEN REPLICATE_TAC 3 DEL_TAC); + (REPLICATE_TAC 16 UP_ASM_TAC THEN REPLICATE_TAC 3 DEL_TAC); + (REPEAT STRIP_TAC); + (ONCE_ASM_REWRITE_TAC[]); + +(* ------------------------------------------------------------------------- *) +(* Subgoal 12: &0 < a, b , c < &4 *) +(* ------------------------------------------------------------------------- *) + + (SUBGOAL_THEN `a < &4 /\ b < &4 /\ c < &4` ASSUME_TAC); + (EXPAND_TAC "a" THEN EXPAND_TAC "b" THEN EXPAND_TAC "c"); + (ASM_REWRITE_TAC[REAL_ARITH `&4 = &2 pow 2`]); + (REPEAT STRIP_TAC); + + (MATCH_MP_TAC REAL_POW_LT2); + (EXPAND_TAC "y4"); + (REWRITE_TAC[ARITH_RULE `~(2 = 0)`; DIST_POS_LE]); + (MATCH_MP_TAC (REAL_ARITH + `dist (v0:real^3,v2) = &1 /\ dist (v0,v3) = &1 /\ + dist (v2,v3) < dist (v0:real^3,v2) + dist (v0,v3) + ==> dist (v2,v3) < &2`)); + STRIP_TAC; + (ASM_REWRITE_TAC[]); + STRIP_TAC; + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (REAL_ARITH `a <= b /\ ~(a = b) ==> a < b`)); + (REWRITE_TAC[DIST_TRIANGLE_ALT]); + (REWRITE_TAC[dist]); + (MATCH_MP_TAC (MESON[] `~(a pow 2 = b pow 2) ==> ~(a = b)`)); + (REWRITE_TAC[REAL_ARITH `(a + b) pow 2 = a pow 2 + b pow 2 + &2 * a * b`]); + (REWRITE_TAC[NORM_POW_2]); + (ABBREV_TAC `m = v0:real^3 - v2`); + (ABBREV_TAC `n = v0:real^3 - v3`); + (SUBGOAL_THEN `v2:real^3 - v3 = n - m` ASSUME_TAC); + (EXPAND_TAC "m" THEN EXPAND_TAC "n" THEN VECTOR_ARITH_TAC); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[NORM_POW_2]); + (REWRITE_TAC[VECTOR_ARITH + `(m - n) dot (m - n) = m dot m + n dot n - &2 * m dot n`]); + (REWRITE_TAC[REAL_ARITH `a + b - &2 * c = b + a + &2 * d <=> --c = d`]); + (MATCH_MP_TAC (MESON[] `~(a pow 2 = b pow 2) ==> ~(a = b)`)); + (PURE_ONCE_REWRITE_TAC[REAL_ARITH `(--x) pow 2 = x pow 2`]); + (PURE_ONCE_REWRITE_TAC[REAL_ARITH `(x * y) pow 2 = (y pow 2) * (x pow 2)`]); + (REWRITE_TAC [NORM_POW_2]); + (ONCE_REWRITE_TAC[VECTOR_ARITH `(n dot m) = (--n) dot (--m)`]); + + (REWRITE_TAC[MESON[] `(a <=> b) <=> (~b <=> ~a)`; DOT_CAUCHY_SCHWARZ_EQUAL]); + (EXPAND_TAC "n" THEN EXPAND_TAC "m"); + (ONCE_REWRITE_TAC[VECTOR_ARITH `--(x - y) = y - x:real^3`]); + (ONCE_REWRITE_TAC[GSYM COLLINEAR_3]); + (PURE_ONCE_REWRITE_TAC[SET_RULE `{a, b , c} = {b, a, c}`]); + (ASM_REWRITE_TAC[]); + + + + (MATCH_MP_TAC REAL_POW_LT2); + (EXPAND_TAC "y5"); + (REWRITE_TAC[ARITH_RULE `~(2 = 0)`; DIST_POS_LE]); + (MATCH_MP_TAC (REAL_ARITH + `dist (v0:real^3,v1) = &1 /\ dist (v0,v3) = &1 /\ + dist (v1,v3) < dist (v0:real^3,v1) + dist (v0,v3) + ==> dist (v1,v3) < &2`)); + STRIP_TAC; + (ASM_REWRITE_TAC[]); + STRIP_TAC; + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (REAL_ARITH `a <= b /\ ~(a = b) ==> a < b`)); + (REWRITE_TAC[DIST_TRIANGLE_ALT]); + (REWRITE_TAC[dist]); + (MATCH_MP_TAC (MESON[] `~(a pow 2 = b pow 2) ==> ~(a = b)`)); + (REWRITE_TAC[REAL_ARITH `(a + b) pow 2 = a pow 2 + b pow 2 + &2 * a * b`]); + (REWRITE_TAC[NORM_POW_2]); + (ABBREV_TAC `m = v0:real^3 - v1`); + (ABBREV_TAC `n = v0:real^3 - v3`); + (SUBGOAL_THEN `v1:real^3 - v3 = n - m` ASSUME_TAC); + (EXPAND_TAC "m" THEN EXPAND_TAC "n" THEN VECTOR_ARITH_TAC); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[NORM_POW_2]); + (REWRITE_TAC[VECTOR_ARITH + `(m - n) dot (m - n) = m dot m + n dot n - &2 * m dot n`]); + (REWRITE_TAC[REAL_ARITH `a + b - &2 * c = b + a + &2 * d <=> --c = d`]); + (MATCH_MP_TAC (MESON[] `~(a pow 2 = b pow 2) ==> ~(a = b)`)); + (PURE_ONCE_REWRITE_TAC[REAL_ARITH `(--x) pow 2 = x pow 2`]); + (PURE_ONCE_REWRITE_TAC[REAL_ARITH `(x * y) pow 2 = (y pow 2) * (x pow 2)`]); + (REWRITE_TAC [NORM_POW_2]); + (ONCE_REWRITE_TAC[VECTOR_ARITH `(n dot m) = (--n) dot (--m)`]); + + (REWRITE_TAC[MESON[] `(a <=> b) <=> (~b <=> ~a)`; DOT_CAUCHY_SCHWARZ_EQUAL]); + (EXPAND_TAC "n" THEN EXPAND_TAC "m"); + (ONCE_REWRITE_TAC[VECTOR_ARITH `--(x - y) = y - x:real^3`]); + (ONCE_REWRITE_TAC[GSYM COLLINEAR_3]); + (PURE_ONCE_REWRITE_TAC[SET_RULE `{a, b , c} = {b, c, a}`]); + (ASM_REWRITE_TAC[]); + + + + (MATCH_MP_TAC REAL_POW_LT2); + (EXPAND_TAC "y6"); + (REWRITE_TAC[ARITH_RULE `~(2 = 0)`; DIST_POS_LE]); + (MATCH_MP_TAC (REAL_ARITH + `dist (v0:real^3,v1) = &1 /\ dist (v0,v3) = &1 /\ + dist (v1,v3) < dist (v0:real^3,v1) + dist (v0,v3) + ==> dist (v1,v3) < &2`)); + STRIP_TAC; + (ASM_REWRITE_TAC[]); + STRIP_TAC; + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (REAL_ARITH `a <= b /\ ~(a = b) ==> a < b`)); + (REWRITE_TAC[DIST_TRIANGLE_ALT]); + (REWRITE_TAC[dist]); + (MATCH_MP_TAC (MESON[] `~(a pow 2 = b pow 2) ==> ~(a = b)`)); + (REWRITE_TAC[REAL_ARITH `(a + b) pow 2 = a pow 2 + b pow 2 + &2 * a * b`]); + (REWRITE_TAC[NORM_POW_2]); + (ABBREV_TAC `m = v0:real^3 - v1`); + (ABBREV_TAC `n = v0:real^3 - v2`); + (SUBGOAL_THEN `v1:real^3 - v2 = n - m` ASSUME_TAC); + (EXPAND_TAC "m" THEN EXPAND_TAC "n" THEN VECTOR_ARITH_TAC); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[NORM_POW_2]); + (REWRITE_TAC[VECTOR_ARITH + `(m - n) dot (m - n) = m dot m + n dot n - &2 * m dot n`]); + (REWRITE_TAC[REAL_ARITH `a + b - &2 * c = b + a + &2 * d <=> --c = d`]); + (MATCH_MP_TAC (MESON[] `~(a pow 2 = b pow 2) ==> ~(a = b)`)); + (PURE_ONCE_REWRITE_TAC[REAL_ARITH `(--x) pow 2 = x pow 2`]); + (PURE_ONCE_REWRITE_TAC[REAL_ARITH `(x * y) pow 2 = (y pow 2) * (x pow 2)`]); + (REWRITE_TAC [NORM_POW_2]); + (ONCE_REWRITE_TAC[VECTOR_ARITH `(n dot m) = (--n) dot (--m)`]); + + (REWRITE_TAC[MESON[] `(a <=> b) <=> (~b <=> ~a)`; DOT_CAUCHY_SCHWARZ_EQUAL]); + (EXPAND_TAC "n" THEN EXPAND_TAC "m"); + (ONCE_REWRITE_TAC[VECTOR_ARITH `--(x - y) = y - x:real^3`]); + (ONCE_REWRITE_TAC[GSYM COLLINEAR_3]); + (PURE_ONCE_REWRITE_TAC[SET_RULE `{a, b , c} = {b, c, a}`]); + (ASM_REWRITE_TAC[]); + + + + (SUBGOAL_THEN `&0 < a /\ &0 < b /\ &0 < c` ASSUME_TAC); + (EXPAND_TAC "a" THEN EXPAND_TAC "b" THEN EXPAND_TAC "c"); + (ASM_REWRITE_TAC[]); + + STRIP_TAC; + + (MATCH_MP_TAC REAL_POW_LT); + (EXPAND_TAC "y4"); + (REWRITE_TAC[dist]); + (MATCH_MP_TAC (NORM_ARITH `~(v2 = v3) ==> &0 < norm (v2 - v3)`)); + STRIP_TAC; + (MATCH_MP_TAC (MESON[] + ` collinear {v0:real^3, v2, v3} /\ ~ collinear {v0, v2, v3} ==> F`)); + (CONJ_TAC); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `{a, b , b} = {a, b}`]); + (ASM_MESON_TAC[COLLINEAR_2]); + (ASM_MESON_TAC[]); + + STRIP_TAC; + (MATCH_MP_TAC REAL_POW_LT); + (EXPAND_TAC "y5"); + (REWRITE_TAC[dist]); + (MATCH_MP_TAC (NORM_ARITH `~(v1 = v3) ==> &0 < norm (v1 - v3)`)); + STRIP_TAC; + (MATCH_MP_TAC (MESON[] + ` collinear {v0:real^3, v3, v1} /\ ~ collinear {v0, v3, v1} ==> F`)); + (CONJ_TAC); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[SET_RULE `{a, b , b} = {a, b}`]); + (ASM_MESON_TAC[COLLINEAR_2]); + (ASM_MESON_TAC[]); + + + (MATCH_MP_TAC REAL_POW_LT); + (EXPAND_TAC "y6"); + (REWRITE_TAC[dist]); + (MATCH_MP_TAC (NORM_ARITH `~(v1 = v2) ==> &0 < norm (v1 - v2)`)); + STRIP_TAC; + (MATCH_MP_TAC (MESON[] + ` collinear {v0:real^3, v1, v2} /\ ~ collinear {v0, v1, v2} ==> F`)); + (CONJ_TAC); + + (REWRITE_TAC[ASSUME `v1 :real^3 = v2`]); + (REWRITE_TAC[SET_RULE `{a, b , b} = {a, b}`]); + (ASM_MESON_TAC[COLLINEAR_2]); + (ASM_MESON_TAC[]); + +(* ------------------------------------------------------------------------- *) +(* FINISH the EULER LEMMA *) +(* ------------------------------------------------------------------------- *) + + (REPLICATE_TAC 3 UP_ASM_TAC); + (REPLICATE_TAC 9 DEL_TAC); + (UP_ASM_TAC THEN REPLICATE_TAC 13 DEL_TAC THEN UP_ASM_TAC); + (REPEAT DEL_TAC THEN REPEAT DISCH_TAC); + (ASM_REWRITE_TAC[]); + (MP_TAC DERIVATIVE_WRT_A_Euler_lemma THEN LET_TAC); + (ASM_MESON_TAC[])]);; + + +let euler_triangle_t = `!v0 v1 v2 v3:real^3. + let p = euler_p v0 v1 v2 v3 in + let (x1,x2,x3,x4,x5,x6) = xlist v0 v1 v2 v3 in + let alpha1 = dihV v0 v1 v2 v3 in + let alpha2 = dihV v0 v2 v3 v1 in + let alpha3 = dihV v0 v3 v1 v2 in + let d = delta_x x1 x2 x3 x4 x5 x6 in + ((&0 < d) ==> + (alpha1 + alpha2 + alpha3 - pi = pi - &2 * atn2(sqrt(d), (&2 * p))))`;; + +let EULER_TRIANGLE = prove_by_refinement (euler_triangle_t , + [MATCH_MP_TAC EULER_FORMULA_RESCALE; + MP_TAC EULER_ANGLE_SUM_rescal; + MESON_TAC[]]);; + + + +end;; diff --git a/text_formalization/trigonometry/euler_multivariate.hl b/text_formalization/trigonometry/euler_multivariate.hl new file mode 100755 index 0000000..e4f3859 --- /dev/null +++ b/text_formalization/trigonometry/euler_multivariate.hl @@ -0,0 +1,3272 @@ +(* ========================================================================= *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* COMPLEMENT LEMMAS FOR EULER TRIANGLE LEMMA *) +(* *) +(* LEMMA ABOUT DERIVATIVES *) +(* *) +(* Authour : VU KHAC KY *) +(* *) +(* ========================================================================= *) + +flyspeck_needs "trigonometry/euler_complement.hl";; + +module Euler_multivariate = struct + +open Sphere;; +open Trigonometry1;; +open Trigonometry2;; +open Prove_by_refinement;; +open Delta_x;; +open Euler_complement;; + +(* ========================================================================= *) +(* *) +(* SOME NECESSARY LEMMAS *) +(* *) +(* ========================================================================= *) + +(* ========================================================================= *) +(* LEMMA 1 *) +(* ========================================================================= *) + +let REDUCE_WITH_DIV_Euler_lemma = prove_by_refinement + (`!x y z . ~ (y = &0) /\ ~ (z = &0) ==> x * y / (z * y) = x / z`, +[ (REPEAT STRIP_TAC); + (MATCH_MP_TAC REAL_EQ_LCANCEL_IMP); + (EXISTS_TAC `z:real`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `a * b * c = (a * c) * b`]); + + (SUBGOAL_THEN `z * x / z = x` ASSUME_TAC); + (MATCH_MP_TAC REAL_DIV_LMUL); + (ASM_REWRITE_TAC[]); + + (PURE_ONCE_ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (MESON[REAL_MUL_LID] `a = &1 ==> a * b = b`)); + (REWRITE_TAC[REAL_ARITH `a * b / c = (a * b) / c`]); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; MESON[] `~(a \/ b) <=> ~a /\ ~b`]); + (ASM_REWRITE_TAC[])]);; + + +(* ========================================================================= *) +(* LEMMAS MODIFIED FROM j.HARRISON FILES *) +(* ========================================================================= *) + +let HAS_REAL_DERIVATIVE_ZERO_CONSTANT2 = prove ( + +`!f a b c s. + is_realinterval s /\ (a IN s) /\ + (!x. x IN s ==> (f has_real_derivative &0) (atreal x within s)) /\ + (f a = c ) + ==> (!x. x IN s ==> f x = c)`, + MP_TAC HAS_REAL_DERIVATIVE_ZERO_CONSTANT THEN + MESON_TAC[]);; + +(* ------------------------------------------------------------------------- *) + +let HAS_REAL_DERIVATIVE_CHAIN2 = prove + (`!P f g x s. + (!x. P x ==> (g has_real_derivative g' x) (atreal x)) + ==> ((f has_real_derivative f') (atreal x within s) /\ P (f x)) + ==> ((\x. g (f x)) has_real_derivative f' * g' (f x)) + (atreal x within s) `, + REPEAT GEN_TAC THEN + MP_TAC HAS_REAL_DERIVATIVE_CHAIN THEN + MESON_TAC[]);; + +(* ========================================================================= *) +(* LEMMAS ABOUT INTERVALS *) +(* ========================================================================= *) + + +let INTERVAL_DIVIDE_Euler_lemma = prove_by_refinement + (`!c. &0 < (&4 - c) * c ==> &0 < c /\ c < &4`, +[(REPEAT STRIP_TAC); + + (MATCH_MP_TAC (REAL_ARITH `~(&0 <= -- x) ==> &0 < x`)); + STRIP_TAC; + (SUBGOAL_THEN `(&4 - c) * (-- c) < &0` ASSUME_TAC); + ASM_REAL_ARITH_TAC; + (SUBGOAL_THEN `&0 <= (&4 - c) * (-- c)` ASSUME_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[]); + ASM_REAL_ARITH_TAC; + ASM_REAL_ARITH_TAC; + + (MATCH_MP_TAC (REAL_ARITH `~(&0 <= x - &4) ==> x < &4`)); + STRIP_TAC; + (SUBGOAL_THEN `(c - &4) * c < &0` ASSUME_TAC); + ASM_REAL_ARITH_TAC; + (SUBGOAL_THEN `&0 <= (c - &4) * c` ASSUME_TAC); + (MATCH_MP_TAC REAL_LE_MUL); + (ASM_REWRITE_TAC[]); + ASM_REAL_ARITH_TAC; + ASM_REAL_ARITH_TAC]);; + +(* ---------------------------------------------------------------------------*) + +let SQRT_RULE_Euler_lemma = prove + (`!x y. x pow 2 = y /\ &0 <= x ==> x = sqrt y`, + REPEAT STRIP_TAC THEN + REWRITE_TAC[GSYM (ASSUME `x pow 2 = y`);REAL_POW_2] THEN + ASM_SIMP_TAC[SQRT_MUL] THEN + ASM_MESON_TAC[GSYM REAL_POW_2;SQRT_POW_2]);; + + +let REAL_INTERVAL_Euler_lemma = prove +( `!a b. let P1 = {x| x < a} in + let P2 = {x| a < x} in + let P3 = {x| a < x /\ x < b} in + is_realinterval P1 /\ is_realinterval P2 /\ is_realinterval P3`, + REPEAT GEN_TAC THEN + REPEAT LET_TAC THEN + EXPAND_TAC "P1" THEN EXPAND_TAC "P2" THEN EXPAND_TAC "P3" THEN + REWRITE_TAC[is_realinterval] THEN + REWRITE_TAC[IN_ELIM_THM] THEN REAL_ARITH_TAC);; + +(* ========================================================================= *) +(* FIRST LEMMA ABOUT DERIVATIVE *) +(* ========================================================================= *) + + +let DERIVATIVE_WRT_C1_Euler_lemma = prove_by_refinement ( + + `!P. is_realinterval P /\ (&2) IN P /\ + (!x. x IN P ==> ~ (x = &0) /\ ~ (&4 - x = &0)) ==> + (!c. c IN P ==> --pi / &2 - &2 * atn (&1 - c / &2) + + &2 * atn ((&4 - c) / c) = &0) `, + +[ (GEN_TAC THEN STRIP_TAC); + (MATCH_MP_TAC HAS_REAL_DERIVATIVE_ZERO_CONSTANT2 THEN EXISTS_TAC `&2`); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `&1 - &2 / &2 = &0`;ATN_0]); + (REWRITE_TAC[REAL_ARITH + `(--a / &2 - &2 * &0 + &2 * s = &0) <=> s = a / &4`]); + (REWRITE_TAC[REAL_ARITH `(&4 - &2) / &2 = &1`;ATN_1]); + (GEN_TAC THEN STRIP_TAC); + + (SUBGOAL_THEN `~(c = &0) /\ ~(&4 - c = &0)` ASSUME_TAC); + (* Subgoal 1 *) + (UP_ASM_TAC THEN ASM_REWRITE_TAC[]); + (UP_ASM_TAC THEN STRIP_TAC); + + (ABBREV_TAC + `f = (\c. --pi / &2 - &2 * atn (&1 - c / &2) + &2 * atn ((&4 - c) / c))`); + (ABBREV_TAC `F1 = (\c. atn (&1 - c / &2))`); + (ABBREV_TAC `F2 = (\c. atn ((&4 - c) / c))`); + + (SUBGOAL_THEN + `f = (\c:real. --pi / &2 - &2 * F1 c + &2 * F2 c)` ASSUME_TAC); + (* Subgoal 2 *) + (EXPAND_TAC "f" THEN EXPAND_TAC "F1" THEN EXPAND_TAC "F2"); + (MESON_TAC[]); + + (ASM_REWRITE_TAC[] THEN DEL_TAC); + (ABBREV_TAC `g' = (\x. inv (&1 + x pow 2))`); + + (SUBGOAL_THEN + `!c. (:real) c ==> (atn has_real_derivative (g':real->real) c) (atreal c)` + ASSUME_TAC); + (* Subgoal 3 *) + (EXPAND_TAC "g'"); + (REWRITE_TAC[EQ_UNIV; HAS_REAL_DERIVATIVE_ATN]); + +(* ------------------------------------------------------------------------- *) +(* Compute the derivative of F1 *) +(* ------------------------------------------------------------------------- *) + + (ABBREV_TAC `f1 = (\c. &1 - c / &2)`); + + (SUBGOAL_THEN `F1 = (\c:real. atn (f1 c))` ASSUME_TAC); + (* Subgoal 4 *) + (EXPAND_TAC "F1" THEN EXPAND_TAC "f1" THEN MESON_TAC[]); + + (SUBGOAL_THEN + `(F1 has_real_derivative (-- &1 / &2) * g' ((f1:real -> real) c)) + (atreal c within P)` ASSUME_TAC); + (* Subgoal 5 *) + (ONCE_ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `(f1 has_real_derivative -- &1 / &2) (atreal c within P) /\ + (:real) (f1 c)` ASSUME_TAC); + (* Subgoal 5.1 *) + CONJ_TAC; (* break into 2 subgoal 5.1.1 & 5.1.2 *) + (EXPAND_TAC "f1" THEN REAL_DIFF_TAC THEN REAL_ARITH_TAC); (*End 5.1.1*) + (MESON_TAC[EQ_UNIV;IN_UNIV; IN]); (* End 5.1.2 *) + (* End subgoal 5.1 *) + + (UP_ASM_TAC THEN DEL_TAC THEN DEL_TAC THEN UP_ASM_TAC); + (MP_TAC HAS_REAL_DERIVATIVE_CHAIN2); + (MESON_TAC[HAS_REAL_DERIVATIVE_CHAIN2]); + (* End subgoal 5 *) + + (SUBGOAL_THEN + `-- &1 / &2 / (&2 - c + c * c / &4) = -- &1 / &2 * g' ((f1:real -> real) c)` + ASSUME_TAC); + (* Subgoal 6 *) + (EXPAND_TAC "g'" THEN EXPAND_TAC "f1"); + (REWRITE_TAC[REAL_ARITH + `&1 + (&1 - c / &2) pow 2 = &2 - c + c * c / &4`]); + (ABBREV_TAC `m = -- &1 / &2`); + (ABBREV_TAC `n = (&2 - c + c * c / &4)`); + + (SUBGOAL_THEN `m = (m * inv n) * n ==> (m / n = m * inv n)` ASSUME_TAC); + (MATCH_MP_TAC (MESON[] `(a <=> b) ==> (b ==> a)`)); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (EXPAND_TAC "n"); + (REWRITE_TAC[REAL_ARITH + `&2 - c + c * c / &4 = &1 + (&1 - c / &2) pow 2 `]); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a ==> &0 < &1 + a`)); + (REWRITE_TAC[REAL_LE_POW_2]); + + (FIRST_X_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[GSYM REAL_MUL_ASSOC]); + (MATCH_MP_TAC (MESON[REAL_MUL_RID] `x = &1 ==> a = a * x`)); + (MATCH_MP_TAC REAL_MUL_LINV); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> ~ (x = &0)`)); + (EXPAND_TAC "n"); + (REWRITE_TAC[REAL_ARITH + `&2 - c + c * c / &4 = &1 + (&1 - c / &2) pow 2 `]); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a ==> &0 < &1 + a`)); + (REWRITE_TAC[REAL_LE_POW_2]); + + (SUBGOAL_THEN + `(F1 has_real_derivative -- &1 / &2 / (&2 - c + c * c / &4)) + (atreal c within P)` ASSUME_TAC); + (* Subgoal 7 *) + (ASM_MESON_TAC[]); + + (UP_ASM_TAC THEN REPLICATE_TAC 4 DEL_TAC THEN REPEAT DISCH_TAC); + SWITCH_TAC; + +(* ------------------------------------------------------------------------- *) +(* Compute the derivative of F2 *) +(* ------------------------------------------------------------------------- *) + + (ABBREV_TAC `f2 = (\c. (&4 - c) / c)`); + + (SUBGOAL_THEN `F2 = (\c:real. atn (f2 c))` ASSUME_TAC); + (* Subgoal 8 *) + (EXPAND_TAC "F2" THEN EXPAND_TAC "f2" THEN MESON_TAC[]); + + (SUBGOAL_THEN + `(F2 has_real_derivative (-- &4 / (c * c)) * g' ((f2:real -> real) c)) + (atreal c within P)` ASSUME_TAC); + (* Subgoal 9 *) + (ONCE_ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `(f2 has_real_derivative (-- &4 / (c * c))) (atreal c within P) /\ + (:real) (f2 c)` ASSUME_TAC); + (* Subgoal 9.1 *) + CONJ_TAC; (* Break into 2 subgoals *) + + (EXPAND_TAC "f2" THEN REAL_DIFF_TAC); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_POW_2]); + (AP_THM_TAC THEN AP_TERM_TAC); + REAL_ARITH_TAC; + (MESON_TAC[EQ_UNIV;IN_UNIV; IN]); + + (UP_ASM_TAC THEN DEL_TAC THEN DEL_TAC THEN UP_ASM_TAC); + (MP_TAC HAS_REAL_DERIVATIVE_CHAIN2); + (MESON_TAC[HAS_REAL_DERIVATIVE_CHAIN2]); + + (SUBGOAL_THEN + `-- &1 / &2 / (&2 - c + c * c / &4) = + -- &4 / (c * c) * g' ((f2:real -> real) c)` ASSUME_TAC); + (* Subgoal 10 *) + (EXPAND_TAC "g'" THEN EXPAND_TAC "f2"); + (REWRITE_TAC[REAL_POW_DIV]); + + (SUBGOAL_THEN + `&1 + (&4 - c) pow 2 / c pow 2 = (&16 - &8 * c + &2 * c * c) / (c * c)` + ASSUME_TAC); + (REWRITE_TAC[REAL_ARITH + `(&16 - &8 * c + &2 * c * c) = c * c + (&4 - c) pow 2`]); + (REWRITE_TAC[REAL_ARITH `(a + b) / c = a / c + b / c`]); + (REWRITE_TAC[REAL_POW_2]); + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC (REAL_DIV_REFL)); + (REWRITE_TAC[REAL_ENTIRE; MESON[] `~(x \/ y) <=> ~ x /\ ~ y`]); + (ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_INV_DIV]); + (REWRITE_TAC[REAL_ARITH `t / x * y / z = (y / x) * (t / z)`]); + + (SUBGOAL_THEN `(c * c) / (c * c) = &1` ASSUME_TAC); + (MATCH_MP_TAC (REAL_DIV_REFL)); + (REWRITE_TAC[REAL_ENTIRE; MESON[] `~(x \/ y) <=> ~ x /\ ~ y`]); + (ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[REAL_MUL_LID]); + (REWRITE_TAC[REAL_ARITH + `&16 - &8 * c + &2 * c * c = (&2 - c + c * c / &4) * &8`]); + (REWRITE_TAC[REAL_ARITH `-- &4 = (-- &1 / &2) * &8`]); + (REWRITE_TAC[EQ_SYM_EQ]); + + (ABBREV_TAC `m = -- &1 / &2`); + (ABBREV_TAC `n = (&2 - c + c * c / &4)`); + (REWRITE_TAC[REAL_ARITH `(a * b) / c = a * (b / c)`]); + (MATCH_MP_TAC REDUCE_WITH_DIV_Euler_lemma); + (REWRITE_TAC[REAL_ARITH `~ (&8 = &0)`]); + (EXPAND_TAC "n"); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> ~ (x = &0)`)); + (REWRITE_TAC[REAL_ARITH + `&2 - c + c * c / &4 = &1 + (&1 - c / &2) pow 2 `]); + (MATCH_MP_TAC (REAL_ARITH `&0 <= a ==> &0 < &1 + a`)); + (REWRITE_TAC[REAL_LE_POW_2]); + + (SUBGOAL_THEN + `(F2 has_real_derivative + -- &1 / &2 / (&2 - c + c * c / &4))(atreal c within P)` ASSUME_TAC); + (* Subgoal 11 *) + (ASM_MESON_TAC[]); + + (UP_ASM_TAC THEN REPLICATE_TAC 5 DEL_TAC THEN DISCH_TAC); + +(* ------------------------------------------------------------------------- *) +(* Compute the derivative of f *) +(* ------------------------------------------------------------------------- *) + + (ABBREV_TAC `f' = -- &1 / &2 / (&2 - c + c * c / &4)`); + (ABBREV_TAC `F3 = (\c:real. F1 c - F2 c)`); + + (SUBGOAL_THEN + `(F3 has_real_derivative &0) (atreal c within P)` ASSUME_TAC); + (EXPAND_TAC "F3"); + (ASM_MESON_TAC[HAS_REAL_DERIVATIVE_SUB; REAL_ARITH `a - a = &0`]); + + (ABBREV_TAC `2F3 = (\c:real. &2 * F3 c)`); + + (SUBGOAL_THEN + `(2F3 has_real_derivative (&2) * (&0)) (atreal c within P)` ASSUME_TAC); + (EXPAND_TAC "2F3"); + (DEL_TAC THEN UP_ASM_TAC); + (MP_TAC HAS_REAL_DERIVATIVE_LMUL_WITHIN); + (MESON_TAC[]); + + (SUBGOAL_THEN + `(\c:real. --pi / &2 - &2 * F1 c + &2 * F2 c) = (\c:real. --pi / &2 - 2F3 c)` + ASSUME_TAC); + (EXPAND_TAC "2F3"); + (EXPAND_TAC "F3"); + (REWRITE_TAC[REAL_ARITH `a - &2 * (x - y) = a - &2 * x + &2 * y`]); + + (ONCE_ASM_REWRITE_TAC[] THEN DEL_TAC); + + (SUBGOAL_THEN `((\c. --pi / &2) has_real_derivative &0) + (atreal c within P)` ASSUME_TAC); + (REAL_DIFF_TAC THEN REAL_ARITH_TAC); + + (UP_ASM_TAC THEN UP_ASM_TAC); + (MP_TAC HAS_REAL_DERIVATIVE_SUB); + (MESON_TAC [REAL_ARITH `&2 * &0 = &0 /\ &0 - &0 = &0`; + HAS_REAL_DERIVATIVE_SUB])]);; + + + + + +let DERIVATIVE_WRT_A_Euler_lemma = prove_by_refinement ( + `! a b c. + let d = ups_x a b c - a * b * c in + ((&0 < d) /\ (&0 < a /\ &0 < b /\ &0 < c) /\ + (a < &4 /\ b < &4 /\ c < &4) ==> + pi / &2 - atn ((-- &2 * a + &2 * b + &2 * c - b * c) / (&2 * sqrt d)) + + pi / &2 - atn ((-- &2 * b + &2 * c + &2 * a - c * a) / (&2 * sqrt d)) + + pi / &2 - atn ((-- &2 * c + &2 * a + &2 * b - a * b) / (&2 * sqrt d)) - pi = + pi - &2 * atn ((&8 - a - b - c) / sqrt d))`, + +[ (REPEAT GEN_TAC THEN LET_TAC THEN STRIP_TAC); + (REWRITE_TAC[REAL_ARITH ` pi / &2 - x + pi / &2 - y + pi / &2 - z - pi = + pi - t <=> -- pi / &2 - x - y - z + t = &0`]); + + (ABBREV_TAC `s = {(x:real) | &0 < ups_x x b c - x * b * c }`); + + +(* ========================================================================= *) +(* The main subgoal. *) +(* ========================================================================= *) + + (SUBGOAL_THEN `!a. (a IN s) ==> --pi / &2 - + atn + ((-- &2 * a + &2 * b + &2 * c - b * c) / + (&2 * sqrt (ups_x a b c - a * b * c))) - + atn + ((-- &2 * b + &2 * c + &2 * a - c * a) / + (&2 * sqrt (ups_x a b c - a * b * c))) - + atn + ((-- &2 * c + &2 * a + &2 * b - a * b) / + (&2 * sqrt (ups_x a b c - a * b * c))) + + &2 * atn ((&8 - a - b - c) / sqrt (ups_x a b c - a * b * c)) = + &0` ASSUME_TAC); + + (MATCH_MP_TAC HAS_REAL_DERIVATIVE_ZERO_CONSTANT2 THEN EXISTS_TAC + `b + c - (b * c) / & 2`); + (REPEAT CONJ_TAC); (* Break into 3 Subgoals *) + + (EXPAND_TAC "s"); + (ASM_MESON_TAC[EULER_TRIANGLE_REAL_INTERVAL]); (* End subgoal 1 *) + +(* ------------------------------------------------------------------------- *) +(* b + c - (b * c) / &2 IN s *) +(* ------------------------------------------------------------------------- *) + + (EXPAND_TAC "s" THEN ASM_REWRITE_TAC[IN_ELIM_THM]); + (ABBREV_TAC `a' = b + c - (b * c) / &2`); + (MATCH_MP_TAC (REAL_ARITH `&0 < d /\ d <= x ==> &0 < x`)); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "d" THEN REWRITE_TAC[ups_x]); + (ONCE_REWRITE_TAC [REAL_ARITH `a <= b <=> &0 <= b - a `]); + + (SUBGOAL_THEN + `(--a' * a' - b * b - c * c + &2 * a' * c + &2 * a' * b + &2 * b * c) - + a' * b * c - + ((--a * a - b * b - c * c + &2 * a * c + &2 * a * b + &2 * b * c) - + a * b * c) = + (a - a') pow 2` + ASSUME_TAC); + (EXPAND_TAC "a'" THEN REAL_ARITH_TAC); + + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[REAL_LE_POW_2]); + +(* ========================================================================= *) +(* *) +(* BEGIN COMPUTE DERIVATIVES *) +(* *) +(* ========================================================================= *) + (GEN_TAC THEN DISCH_TAC); + (ABBREV_TAC `Da = (-- &2 * a' + &2 * b + &2 * c - b * c)`); + (ABBREV_TAC `Db = (-- &2 * b + &2 * c + &2 * a' - a' * c)`); + (ABBREV_TAC `Dc = (-- &2 * c + &2 * a' + &2 * b - a' * b)`); + (ABBREV_TAC `D' = ups_x a' b c - a' * b * c`); + + (SUBGOAL_THEN `&0 < D'` ASSUME_TAC); + (* Subgoal 3.1 *) + + (REPLICATE_TAC 5 UP_ASM_TAC THEN EXPAND_TAC "s"); + (PURE_ASM_REWRITE_TAC[IN_ELIM_THM] THEN MESON_TAC[]); + +(* --------------------------------------------------------------------------*) +(* Subgoal 3.2 *) +(* Derivative of sqrt (ups_x x b c - x * b * c) *) +(* --------------------------------------------------------------------------*) + + (ABBREV_TAC `G = (\x. sqrt (ups_x x b c - x * b * c))`); + (ABBREV_TAC `G' = (-- &2 * a' + &2 * b + &2 * c - b * c) * + inv (&2 * sqrt (ups_x a' b c - a' * b * c))`); + (SUBGOAL_THEN ` (G has_real_derivative G') (atreal a' within s)` ASSUME_TAC); + (ABBREV_TAC `f = (\x. ups_x x b c - x * b * c)`); + + (SUBGOAL_THEN `G = (\x:real. sqrt (f x))` ASSUME_TAC); + (* Subgoal 3.2.1 *) + (EXPAND_TAC "f" THEN ASM_REWRITE_TAC[]); + + (ABBREV_TAC `g' = (\x. inv (&2 * sqrt x))`); + (ABBREV_TAC `f' = -- &2 * a' + &2 * b + &2 * c - b * c`); + + (SUBGOAL_THEN `G' = f' * (g' ((f:real->real) a'))` ASSUME_TAC); + (* Subgoal 3.2.2 *) + (EXPAND_TAC "G'" THEN EXPAND_TAC "f'"); + (EXPAND_TAC "g'" THEN EXPAND_TAC "f" ); + (REWRITE_TAC[]); + + (ABBREV_TAC `P = {x:real | &0 < x}`); + + (SUBGOAL_THEN + `!x. P x ==> (sqrt has_real_derivative (g':real->real) x) (atreal x)` + ASSUME_TAC); + (* Subgoal 3.2.3 *) + (EXPAND_TAC "g'" THEN REWRITE_TAC[BETA_THM]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN_ELIM_THM]); + (REWRITE_TAC[HAS_REAL_DERIVATIVE_SQRT]); + + (SUBGOAL_THEN + `(f has_real_derivative f') (atreal a' within s) /\ + (P:real->bool) ((f:real->real) a')` + ASSUME_TAC); + (* Subgoal 3.2.4 *) + CONJ_TAC; + + (* Subgoal 3.2.4.1 *) + (EXPAND_TAC "f" THEN EXPAND_TAC "f'"); + (REWRITE_TAC[ups_x]); + (REAL_DIFF_TAC THEN REAL_ARITH_TAC); + (* Subgoal 3.2.4.2 *) + (EXPAND_TAC "P" THEN REWRITE_TAC[IN_ELIM_THM]); + + (SUBGOAL_THEN `!x. (x:real) IN s ==> &0 < f x` ASSUME_TAC); + (* Subgoal 3.2.4.1.1 *) + (EXPAND_TAC "s" THEN REWRITE_TAC[IN_ELIM_THM]); + (EXPAND_TAC "f" THEN MESON_TAC[]); + (FIRST_ASSUM MATCH_MP_TAC THEN ASM_REWRITE_TAC[]); + + (ONCE_ASM_REWRITE_TAC[]); + (* End Subgoal 3.2.4 *) + + (REPLICATE_TAC 2 UP_ASM_TAC); + (MP_TAC HAS_REAL_DERIVATIVE_CHAIN2 THEN MESON_TAC[]); +(* --------------------------------------------------------------------------*) +(* Subgoal 3.3 *) +(* Derivative of &2 * sqrt (ups_x x b c - x * b * c) *) +(* --------------------------------------------------------------------------*) + + (ABBREV_TAC `2G = (\x. &2 * sqrt (ups_x x b c - x * b * c))`); + + (SUBGOAL_THEN + `(2G has_real_derivative &2 * G') (atreal a' within s)` ASSUME_TAC); + + (SUBGOAL_THEN `2G = (\x:real. &2 * G x)` ASSUME_TAC); + (EXPAND_TAC "2G" THEN EXPAND_TAC "G" THEN MESON_TAC[]); + + (PURE_ONCE_ASM_REWRITE_TAC[]); + (DEL_TAC THEN DEL_TAC ); + (FIRST_X_ASSUM MP_TAC); + (MP_TAC HAS_REAL_DERIVATIVE_LMUL_WITHIN THEN MESON_TAC[]); + +(* --------------------------------------------------------------------------*) +(* Subgoal 3.4 *) +(* Derivative of (-- &2 * x + &2 * b + &2 * c - b * c) / *) +(* &2 * sqrt (ups_x x b c - x * b * c) *) +(* --------------------------------------------------------------------------*) + + (ABBREV_TAC `f1 = (\x. -- &2 * x + &2 * b + &2 * c - b * c)`); + (ABBREV_TAC `F12 = (\x. (-- &2 * x + &2 * b + &2 * c - b * c) / + (&2 * sqrt (ups_x x b c - x * b * c)))`); + (SUBGOAL_THEN + `(F12 has_real_derivative (-- &2 * 2G (a':real) - (f1 a' * &2 * G')) / + 2G a' pow 2) (atreal a' within s)` + ASSUME_TAC); + + (SUBGOAL_THEN ` F12 = (\x:real. f1 x / 2G x)` ASSUME_TAC); + (* Subgoal 3.4.1 *) + (EXPAND_TAC "F12" THEN EXPAND_TAC "2G" THEN EXPAND_TAC "f1"); + (ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `(f1 has_real_derivative -- &2) (atreal a' within s) /\ + (2G has_real_derivative &2 * G') (atreal a' within s) /\ + ~(2G a' = &0)` + ASSUME_TAC); + (* Subgoal 3.4.2 *) + (ASM_REWRITE_TAC[]); + (REPEAT CONJ_TAC); (* Break into 2 subgoals *) + + (EXPAND_TAC "f1" THEN REAL_DIFF_TAC THEN REAL_ARITH_TAC); + (EXPAND_TAC "2G"); + (MATCH_MP_TAC + (MESON[REAL_ENTIRE] `~ (x = &0) /\ ~ (y = &0) ==> ~ (x * y = &0)`)); + (REWRITE_TAC[REAL_ARITH `~(&2 = &0)`]); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> ~(x = &0)`)); + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + + (FIRST_X_ASSUM MP_TAC); + (MP_TAC HAS_REAL_DERIVATIVE_DIV_WITHIN); + (MESON_TAC[]); + +(* --------------------------------------------------------------------------*) +(* Subgoal 3.5 *) +(* Derivative of atn ((-- &2 * a + &2 * b + &2 * c - b * c) / *) +(* &2 * sqrt (ups_x x b c - x * b * c)) *) +(* --------------------------------------------------------------------------*) + + (ABBREV_TAC `F1 = (\x. atn ((-- &2 * x + &2 * b + &2 * c - b * c) / (&2 * + sqrt (ups_x x b c - x * b * c))))`); + + (SUBGOAL_THEN + `(F1 has_real_derivative + (-- &2 * 2G a' - f1 a' * &2 * G') / 2G a' pow 2 * inv (&1 + F12 a' pow 2)) + (atreal a' within s)` + ASSUME_TAC); + + (SUBGOAL_THEN `F1 = (\x. atn (F12 (x:real)))` ASSUME_TAC); + (* Subgoal 3.5.1 *) + (EXPAND_TAC "F1" THEN EXPAND_TAC "F12"); + (REWRITE_TAC[]); + + (PURE_ONCE_ASM_REWRITE_TAC[]); + (REPLICATE_TAC 2 DEL_TAC); + (ABBREV_TAC `g' = (\x. inv (&1 + x pow 2))`); + (ABBREV_TAC `f' = (-- &2 * 2G (a':real) - f1 a' * &2 * G') / 2G a' pow 2`); + + (SUBGOAL_THEN + `!x. (:real) x ==> (atn has_real_derivative (g':real->real) x) (atreal x)` + ASSUME_TAC); + (* Subgoal 3.5.3 *) + (EXPAND_TAC "g'" THEN REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[EQ_UNIV; HAS_REAL_DERIVATIVE_ATN]); + + (SUBGOAL_THEN `(F12 has_real_derivative f') (atreal a' within s) /\ + (:real) ((F12:real->real) a')` + ASSUME_TAC); + (ASM_REWRITE_TAC[]); + (MESON_TAC[EQ_UNIV;IN_UNIV; IN]); + + (SUBGOAL_THEN + `inv (&1 + F12 a' pow 2) = g' ((F12:real-> real) a')` + ASSUME_TAC); + (* Subgoal 3.5.2 *) + (EXPAND_TAC "F12" THEN EXPAND_TAC "g'"); + (MESON_TAC[]); + + (ONCE_ASM_REWRITE_TAC[]); + DEL_TAC ; + (REPLICATE_TAC 2 UP_ASM_TAC); + (MP_TAC HAS_REAL_DERIVATIVE_CHAIN2); + (MESON_TAC[]); + +(* ========================================================================= *) +(* THIS PART TO TO REDUCE THE DERIVATIVE OF F1 *) +(* Derivative of F1 is -- &1 / sqrt d *) +(* ========================================================================= *) + +(* --------------------------------------------------------------------------*) +(* Subgoal 3.6 *) +(* (&2 * sqrt D') pow 2 = &4 * D' *) +(* --------------------------------------------------------------------------*) + + (SUBGOAL_THEN `(&2 * sqrt D') pow 2 = &4 * D'` ASSUME_TAC); + (REWRITE_TAC[REAL_POW_2]); + (REWRITE_TAC[REAL_ARITH `(&2 * a) * &2 * b = &4 * (a * b)`]); + (REWRITE_TAC[GSYM REAL_POW_2]); + AP_TERM_TAC; + (MATCH_MP_TAC SQRT_POW_2 THEN ASM_REAL_ARITH_TAC); + +(* --------------------------------------------------------------------------*) +(* Subgoal 3.7 *) +(* Reduce: inv (&1 + F12 a' pow 2) *) +(* --------------------------------------------------------------------------*) + + (SUBGOAL_THEN + `inv (&1 + F12 (a':real) pow 2) = (&4 * D') / (&4 * D' + Da pow 2)` + ASSUME_TAC); + (EXPAND_TAC "F12"); + (REWRITE_TAC[REAL_POW_DIV]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[MESON[REAL_INV_DIV] + `(&4 * D') / (&4 * D' + Da pow 2) = + inv ((&4 * D' + Da pow 2) / (&4 * D'))`]); + AP_TERM_TAC; + (REWRITE_TAC[REAL_ARITH `(a + b) / c = a / c + b / c`]); + (AP_THM_TAC THEN AP_TERM_TAC); + (MATCH_MP_TAC (GSYM REAL_DIV_REFL)); + (REWRITE_TAC[MESON[] `~(a = b) <=> ~(b = a)`;REAL_ENTIRE; + MESON[] `~(a \/ b) <=> ~a /\ ~b`]); + ASM_REAL_ARITH_TAC; + +(* --------------------------------------------------------------------------*) +(* Subgoal 3.8 *) +(* Reduce: Derivative of F1 *) +(* --------------------------------------------------------------------------*) + + (SUBGOAL_THEN + `(F1 has_real_derivative -- &1 / sqrt D') (atreal a' within s)` + ASSUME_TAC); + + (SUBGOAL_THEN `2G (a':real) = &2 * sqrt D'` ASSUME_TAC); + (* Subgoal 3.8.1 *) + (EXPAND_TAC "2G" THEN EXPAND_TAC "D'"); + (REWRITE_TAC[]); + + (SUBGOAL_THEN `f1 (a':real) = (Da:real)` ASSUME_TAC); + (* Subgoal 3.8.2 *) + (EXPAND_TAC "f1" THEN EXPAND_TAC "Da"); + (REWRITE_TAC[]); + + (SUBGOAL_THEN `&0 < sqrt D'` ASSUME_TAC); + (* Subgoal 3.8.3 *) + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `(-- &2 * 2G (a':real) - f1 a' * &2 * G') / 2G a' pow 2 * + inv (&1 + F12 a' pow 2) = + -- &1 / sqrt D'` + ASSUME_TAC); + (* Subgoal 3.8.4 *) + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `(a / b * b / c) = (a / b * b) / c`]); + (SIMP_TAC[REAL_DIV_RMUL]); + + (SUBGOAL_THEN `~(&4 * D' = &0)` ASSUME_TAC); + (* Subgoal 3.8.4.1 *) + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~ (a = &0)`)); + (MATCH_MP_TAC REAL_LT_MUL); + ASM_REAL_ARITH_TAC; + + (ABBREV_TAC `M = (-- &2 * &2 * sqrt D' - Da * &2 * G')`); + + (SUBGOAL_THEN `G' = Da * inv (&2 * sqrt D')` ASSUME_TAC); + (* Subgoal 3.8.4.2 *) + (EXPAND_TAC "G'" THEN EXPAND_TAC "Da" THEN EXPAND_TAC "D'"); + (AP_THM_TAC THEN AP_TERM_TAC); + (EXPAND_TAC "f1" THEN REAL_ARITH_TAC); + + (SUBGOAL_THEN `M = -- (&4 * D' + Da pow 2) / sqrt D'` ASSUME_TAC); + (* Subgoal 3.8.4.3 *) + (EXPAND_TAC "M"); + (REWRITE_TAC[REAL_ARITH `-- &2 * &2 * x = -- &4 * x`]); + (ONCE_ASM_REWRITE_TAC[]); + (ABBREV_TAC `X = -- &4 * sqrt D' - Da * &2 * Da * inv (&2 * sqrt D')`); + (ABBREV_TAC `Y = --(&4 * D' + Da pow 2)`); + (ABBREV_TAC `Z = sqrt D'`); + + (SUBGOAL_THEN `X * Z = Y ==> X = Y / Z ` ASSUME_TAC); + (* Subgoal 3.8.4.3.1 *) + (ASM_SIMP_TAC[REAL_EQ_RDIV_EQ]); + + (FIRST_X_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "X" THEN EXPAND_TAC "Y" THEN EXPAND_TAC "Z"); + (REWRITE_TAC[REAL_SUB_RDISTRIB; REAL_NEG_ADD]); + (REWRITE_TAC[REAL_ARITH ` (a * b * a * c) * d = a pow 2 * c * b * d`]); + + (SUBGOAL_THEN `inv (&2 * sqrt D') * &2 * sqrt D' = &1` ASSUME_TAC); + (MATCH_MP_TAC REAL_MUL_LINV); + (REWRITE_TAC[REAL_ENTIRE; MESON[] `~(a \/ b) <=> ~a /\ ~b`]); + (REWRITE_TAC[REAL_ARITH `~(&2 = &0)`]); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~ (a = &0)`)); + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `a - b = a + --b`;REAL_MUL_RID]); + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_TAC[REAL_ARITH `(--a * b) * c = -- (a * (b * c))`]); + (REPEAT AP_TERM_TAC); + (REWRITE_TAC[GSYM REAL_POW_2]); + (EXPAND_TAC "Z"); + (MATCH_MP_TAC SQRT_POW_2); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`)); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `M / (&4 * D') * &4 * D' = M` ASSUME_TAC); + (* Subgoal 3.8.4.4 *) + (ASM_MESON_TAC[REAL_DIV_RMUL]); + + (ONCE_ASM_REWRITE_TAC[]); + (ONCE_ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC [REAL_ARITH `a / b / c = a / c / b`]); + (AP_THM_TAC THEN AP_TERM_TAC); + (MATCH_MP_TAC (REAL_ARITH `a / a = &1 ==> -- a / a = -- &1`)); + (MATCH_MP_TAC REAL_DIV_REFL); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~ (a = &0)`)); + (MATCH_MP_TAC REAL_LTE_ADD); + (REWRITE_TAC[REAL_LE_POW_2]); + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_REWRITE_TAC[]); + (REAL_ARITH_TAC); + (* End of subgoal 3.8.4 *) + + (ASM_MESON_TAC[]); + +(* Delete unnecessary assumptions in assumption list *) + + (UP_ASM_TAC THEN REPLICATE_TAC 3 DEL_TAC); + (UP_ASM_TAC THEN REPLICATE_TAC 3 DEL_TAC); + (REPEAT DISCH_TAC); + + +(* ================ END DIFF F1 ============================================ *) + +(* --------------------------------------------------------------------------*) +(* Subgoal 3.9 *) +(* Derivative of (-- &2 * b + &2 * c + &2 * a - c * a) / *) +(* &2 * sqrt (ups_x x b c - x * b * c) *) +(* --------------------------------------------------------------------------*) + + (ABBREV_TAC `f2 = (\x. -- &2 * b + &2 * c + &2 * x - c * x)`); + (ABBREV_TAC `F22 = (\x. (-- &2 * b + &2 * c + &2 * x - c * x) / (&2 * + sqrt (ups_x x b c - x * b * c)))`); + + (SUBGOAL_THEN + `(F22 has_real_derivative ((&2 - c) * 2G (a':real) - + f2 a' * &2 * G') / 2G a' pow 2) (atreal a' within s)` + ASSUME_TAC); + + (SUBGOAL_THEN ` F22 = (\x:real. f2 x / 2G x )` ASSUME_TAC); + (* Subgoal 3.9.1 *) + (EXPAND_TAC "F22" THEN EXPAND_TAC "2G" THEN EXPAND_TAC "f2"); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `(f2 has_real_derivative &2 - c) (atreal a' within s) /\ + (2G has_real_derivative &2 * G') (atreal a' within s) /\ + ~(2G a' = &0)` ASSUME_TAC); + (* Subgoal 3.9.2 *) + (ASM_REWRITE_TAC[]); + (REPEAT CONJ_TAC); (* Break into 2 subgoals *) + + (EXPAND_TAC "f2" THEN REAL_DIFF_TAC THEN REAL_ARITH_TAC); + (EXPAND_TAC "2G"); + (MATCH_MP_TAC + (MESON[REAL_ENTIRE] `~ (x = &0) /\ ~ (y = &0) ==> ~ (x * y = &0)`)); + (REWRITE_TAC[REAL_ARITH `~(&2 = &0)`]); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> ~(x = &0)`)); + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (FIRST_X_ASSUM MP_TAC); + (MP_TAC HAS_REAL_DERIVATIVE_DIV_WITHIN); + (MESON_TAC[]); + +(* --------------------------------------------------------------------------*) +(* Subgoal 3.10 *) +(* Derivative of atn ((-- &2 * b + &2 * c + &2 * a - c * a) / *) +(* &2 * sqrt (ups_x x b c - x * b * c)) *) +(* --------------------------------------------------------------------------*) + + (ABBREV_TAC `F2 = (\x. atn ((-- &2 * b + &2 * c + &2 * x - c * x) /(&2 * + sqrt (ups_x x b c - x * b * c))))`); + + (SUBGOAL_THEN `(F2 has_real_derivative + ((&2 - c) * 2G a' - f2 a' * &2 * G') / 2G a' pow 2 * inv (&1 + F22 a' pow 2)) + (atreal a' within s)` + ASSUME_TAC); + + (SUBGOAL_THEN `F2 = (\x. atn (F22 (x:real)))` ASSUME_TAC); + (* Subgoal 3.10.1 *) + (EXPAND_TAC "F2" THEN EXPAND_TAC "F22"); + (REWRITE_TAC[]); + + (PURE_ONCE_ASM_REWRITE_TAC[]); + (REPLICATE_TAC 2 DEL_TAC); + (ABBREV_TAC `g' = (\x. inv (&1 + x pow 2))`); + (ABBREV_TAC `f' = ((&2 - c) * 2G a' - f2 a' * &2 * G') / + 2G (a':real) pow 2`); + + (SUBGOAL_THEN + `!x. (:real) x ==> (atn has_real_derivative (g':real->real) x) (atreal x)` + ASSUME_TAC); + (* Subgoal 3.10.2 *) + (EXPAND_TAC "g'" THEN REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[EQ_UNIV;HAS_REAL_DERIVATIVE_ATN]); + + (SUBGOAL_THEN `(F22 has_real_derivative f') (atreal a' within s) /\ + (:real) ((F22:real->real) a')` + ASSUME_TAC); + (ASM_REWRITE_TAC[]); + (MESON_TAC[EQ_UNIV;IN_UNIV;IN]); + + (SUBGOAL_THEN + `inv (&1 + F22 a' pow 2) = g' ((F22:real-> real) a')` + ASSUME_TAC); + (* Subgoal 3.10.3 *) + (EXPAND_TAC "F22" THEN EXPAND_TAC "g'"); + (REWRITE_TAC[]); + + (ONCE_ASM_REWRITE_TAC[]); + DEL_TAC ; + (REPLICATE_TAC 2 UP_ASM_TAC); + (MP_TAC HAS_REAL_DERIVATIVE_CHAIN2); + (MESON_TAC[]); + +(* ========================================================================= *) +(* THIS PART TO TO REDUCE THE DERIVATIVE OF F2 *) +(* Derivative of F2 is ..... / sqrt d *) +(* ========================================================================= *) + +(* --------------------------------------------------------------------------*) +(* Subgoal 3.11 *) +(* (&2 * sqrt D') pow 2 = &4 * D' *) +(* --------------------------------------------------------------------------*) + + (SUBGOAL_THEN `(&2 * sqrt D') pow 2 = &4 * D'` ASSUME_TAC); + (REWRITE_TAC[REAL_POW_2]); + (REWRITE_TAC[REAL_ARITH `(&2 * a) * &2 * b = &4 * (a * b)`]); + (REWRITE_TAC[GSYM REAL_POW_2]); + AP_TERM_TAC; + (MATCH_MP_TAC SQRT_POW_2 THEN ASM_REAL_ARITH_TAC); + +(* --------------------------------------------------------------------------*) +(* Subgoal 3.12 *) +(* Reduce: inv (&1 + F22 a' pow 2) *) +(* --------------------------------------------------------------------------*) + + (SUBGOAL_THEN + `inv (&1 + F22 (a':real) pow 2) = (&4 * D') / (&4 * D' + Db pow 2)` + ASSUME_TAC); + (EXPAND_TAC "F22"); + (REWRITE_TAC[REAL_POW_DIV]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[MESON[REAL_INV_DIV] + `(&4 * D') / (&4 * D' + Db pow 2) = + inv ((&4 * D' + Db pow 2) / (&4 * D'))`]); + AP_TERM_TAC; + (REWRITE_TAC[REAL_ARITH `(a + b) / c = a / c + b / c`]); + (EXPAND_TAC "Db"); + (REWRITE_TAC[REAL_ARITH `a + b + c - x * y = a + b + c - y * x`]); + (AP_THM_TAC THEN AP_TERM_TAC); + (MATCH_MP_TAC (GSYM REAL_DIV_REFL)); + (REWRITE_TAC[MESON[] `~(a = b) <=> ~(b = a)`;REAL_ENTIRE; + MESON[] `~(a \/ b) <=> ~a /\ ~b`]); + ASM_REAL_ARITH_TAC; + + +(* --------------------------------------------------------------------------*) +(* Subgoal 3.13 *) +(* Reduce: Derivative of F2 *) +(* --------------------------------------------------------------------------*) + + (SUBGOAL_THEN + `(F2 has_real_derivative + (-- &2 * c + &2 * a' + &2 * b - a' * b) / (a' * (&4 - a')) / sqrt D') + (atreal a' within s)` + ASSUME_TAC); + + (SUBGOAL_THEN `2G (a':real) = &2 * sqrt D'` ASSUME_TAC); + (* Subgoal 3.13.1 *) + (EXPAND_TAC "2G" THEN EXPAND_TAC "D'"); + (REWRITE_TAC[]); + + (SUBGOAL_THEN `f2 (a':real) = (Db:real)` ASSUME_TAC); + (* Subgoal 3.13.2 *) + (EXPAND_TAC "f2" THEN EXPAND_TAC "Db"); + (REAL_ARITH_TAC); + + (SUBGOAL_THEN `&0 < sqrt D'` ASSUME_TAC); + (* Subgoal 3.13.3 *) + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN ` + ((&2 - c) * 2G a' - f2 a' * &2 * G') / 2G a' pow 2 * + inv (&1 + F22 a' pow 2) = + (-- &2 * c + &2 * a' + &2 * b - a' * b) / (a' * (&4 - a')) / sqrt D' ` + ASSUME_TAC); + (* Subgoal 3.13.4 *) + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `(a / b * b / c) = (a / b * b) / c`]); + (SIMP_TAC[REAL_DIV_RMUL]); + + + (SUBGOAL_THEN `~(&4 * D' = &0)` ASSUME_TAC); + (* Subgoal 3.13.4.1 *) + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~ (a = &0)`)); + (MATCH_MP_TAC REAL_LT_MUL); + ASM_REAL_ARITH_TAC; + + (ABBREV_TAC `M = (&2 - c) * &2 * sqrt D' - Db * &2 * G'`); + + (SUBGOAL_THEN `G' = Da * inv (&2 * sqrt D')` ASSUME_TAC); + (* Subgoal 3.13.4.2 *) + (EXPAND_TAC "G'" THEN EXPAND_TAC "Da" THEN EXPAND_TAC "D'"); + (REWRITE_TAC[]); + + (SUBGOAL_THEN `M = ((&4 - &2 * c) * D' - Da * Db) / sqrt D'` ASSUME_TAC); + (* Subgoal 3.13.4.3 *) + (EXPAND_TAC "M"); + (REWRITE_TAC[REAL_ARITH `(&2 - c) * &2 * x = (&4 - &2 * c) * x`]); + (ONCE_ASM_REWRITE_TAC[]); + (ABBREV_TAC `X = (&4 - &2 * c) * sqrt D' - + Db * &2 * Da * inv (&2 * sqrt D')`); + (ABBREV_TAC `Y = (&4 - &2 * c) * D' - Da * Db`); + (ABBREV_TAC `Z = sqrt D'`); + + (SUBGOAL_THEN `X * Z = Y ==> X = Y / Z ` ASSUME_TAC); + (* Subgoal 3.13.4.3.1 *) + (ASM_SIMP_TAC[REAL_EQ_RDIV_EQ]); + + + (FIRST_X_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "X" THEN EXPAND_TAC "Y" THEN EXPAND_TAC "Z"); + (ABBREV_TAC `m = &4 - &2 * c`); + (REWRITE_TAC[REAL_SUB_RDISTRIB;REAL_NEG_ADD]); + (REWRITE_TAC[REAL_ARITH ` (a * b * c * d) * e = (c * a) * (d * b * e)`]); + + (SUBGOAL_THEN `inv (&2 * sqrt D') * &2 * sqrt D' = &1` ASSUME_TAC); + (* Subgoal 3.13.4.3.2 *) + (MATCH_MP_TAC REAL_MUL_LINV); + (REWRITE_TAC[REAL_ENTIRE; MESON[] `~(a \/ b) <=> ~a /\ ~b`]); + (REWRITE_TAC[REAL_ARITH `~(&2 = &0)`]); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~ (a = &0)`)); + (ASM_REWRITE_TAC[]); + + (PURE_ONCE_ASM_REWRITE_TAC[]); + (EXPAND_TAC "Y"); + (REWRITE_TAC[REAL_MUL_RID]); + (AP_THM_TAC THEN AP_TERM_TAC); + (EXPAND_TAC "m" THEN EXPAND_TAC "Z"); + (REWRITE_TAC[REAL_ARITH `(a * b) * c = a * b * c`]); + (REPEAT AP_TERM_TAC); + (REWRITE_TAC[GSYM REAL_POW_2]); + (MATCH_MP_TAC SQRT_POW_2); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`)); + (ASM_REWRITE_TAC[]); + (* End of Subgoal 3.13.4.3 *) + + + (SUBGOAL_THEN `M / (&4 * D') * &4 * D' = M` ASSUME_TAC); + (* Subgoal 3.13.4.4 *) + (ASM_SIMP_TAC[REAL_DIV_RMUL]); + + (PURE_ONCE_ASM_REWRITE_TAC[] THEN DEL_TAC); + + (SUBGOAL_THEN + `M = ((-- &2 * c + &2 * a' + &2 * b - a' * b) * (&4 - c) * c)/ sqrt D'` + ASSUME_TAC); + (* Subgoal 3.13.4.5 *) + (ONCE_ASM_REWRITE_TAC[]); + (AP_THM_TAC THEN AP_TERM_TAC); + (EXPAND_TAC "D'" THEN REWRITE_TAC[ups_x]); + (EXPAND_TAC "Da" THEN EXPAND_TAC "Db" THEN EXPAND_TAC "f2"); + (EXPAND_TAC "Dc"); + REAL_ARITH_TAC; + + (UP_ASM_TAC THEN DEL_TAC THEN REPEAT DISCH_TAC); + (ONCE_ASM_REWRITE_TAC[]); + (EXPAND_TAC "Dc"); + (REWRITE_TAC[REAL_ARITH `a / b / c = a / c / b`]); + (AP_THM_TAC THEN AP_TERM_TAC); + + (SUBGOAL_THEN + `&4 * D' + Db pow 2 = a' * (&4 - a') * (&4 - c) * c` ASSUME_TAC); + (* Subgoal 3.13.4.6 *) + (EXPAND_TAC "Db" THEN EXPAND_TAC "f2" THEN REWRITE_TAC[POW_2] ); + (EXPAND_TAC "D'" THEN REWRITE_TAC[ups_x]); + REAL_ARITH_TAC; + + (ONCE_ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[REAL_ARITH `(a * b) / c = a * b / c`]); + + (* --------------------------------------------------------------- *) + (* ~ ( c = &4) /\ ~ (c = &0) *) + (* --------------------------------------------------------------- *) + + (SUBGOAL_THEN `~ (c = &4) /\ ~ (c = &0)` ASSUME_TAC); + ASM_REAL_ARITH_TAC; + (SUBGOAL_THEN `~ ((&4 - c) * c = &0)` ASSUME_TAC); + (REWRITE_TAC[REAL_ENTIRE;MESON[] `~(a \/ b) <=> ~a /\ ~b`]); + (ASM_REWRITE_TAC[REAL_ARITH ` ~(a - b = &0) <=> ~ (a = b)`]); + + (* --------------------------------------------------------------- *) + (* ~ ( a' = &4) /\ ~ (a' = &0) *) + (* --------------------------------------------------------------- *) + + (SUBGOAL_THEN `~ (a' = &4) /\ ~ (a' = &0)` ASSUME_TAC); + (REPEAT STRIP_TAC); (* 2 Subgoals *) + + (SUBGOAL_THEN ` D' = -- ((c + b - &4) pow 2)` ASSUME_TAC); + (EXPAND_TAC "D'" ); + (REWRITE_TAC[ups_x]); + (ONCE_ASM_REWRITE_TAC[]); + REAL_ARITH_TAC; + (SUBGOAL_THEN `D' <= &0` ASSUME_TAC); + (ASM_REWRITE_TAC[REAL_ARITH `-- c <= &0 <=> &0 <= c`]); + (MESON_TAC[REAL_LE_POW_2]); + (MP_TAC (ASSUME `&0 < D'`)); + (FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + + + (SUBGOAL_THEN ` D' = -- ((c - b) pow 2)` ASSUME_TAC); + (EXPAND_TAC "D'" ); + (REWRITE_TAC[ups_x]); + (ONCE_ASM_REWRITE_TAC[]); + REAL_ARITH_TAC; + (SUBGOAL_THEN `D' <= &0` ASSUME_TAC); + (ASM_REWRITE_TAC[REAL_ARITH `-- c <= &0 <=> &0 <= c`]); + (MESON_TAC[REAL_LE_POW_2]); + (MP_TAC (ASSUME `&0 < D'`)); + (FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + + + (SUBGOAL_THEN `~ (a' * (&4 - a') = &0)` ASSUME_TAC); + (REWRITE_TAC[REAL_ENTIRE;MESON[] `~(a \/ b) <=> ~a /\ ~b`]); + (ASM_REWRITE_TAC[REAL_ARITH ` ~(a - b = &0) <=> ~ (a = b)`]); + + (* --------------------------------------------------------------- *) + (* continue *) + (* --------------------------------------------------------------- *) + + (ABBREV_TAC `x = -- &2 * c + &2 * a' + &2 * b - a' * b`); + (ABBREV_TAC `y = (&4 - c) * c`); + (REWRITE_TAC[REAL_ARITH `a * b * c = (a * b) * c`]); + (ABBREV_TAC `z = a' * (&4 - a')`); + (ASM_SIMP_TAC[REDUCE_WITH_DIV_Euler_lemma]); + (ASM_MESON_TAC[]); + + (UP_ASM_TAC THEN REPLICATE_TAC 3 DEL_TAC); + (UP_ASM_TAC THEN REPLICATE_TAC 3 DEL_TAC THEN REPEAT DISCH_TAC); + +(* ================ END DIFF 2 ============================================= *) + + + +(* --------------------------------------------------------------------------*) +(* Subgoal 14 *) +(* Derivative of (-- &2 * c + &2 * a + &2 * b - a * b) / *) +(* &2 * sqrt (ups_x x b c - x * b * c) *) +(* --------------------------------------------------------------------------*) + + (ABBREV_TAC `f3 = (\x. -- &2 * c + &2 * x + &2 * b - x * b)`); + (ABBREV_TAC `F32 = (\x. (-- &2 * c + &2 * x + &2 * b - x * b) / + (&2 * sqrt (ups_x x b c - x * b * c)))`); + + (SUBGOAL_THEN + `(F32 has_real_derivative ((&2 - b) * 2G (a':real) - + f3 a' * &2 * G') / 2G a' pow 2) (atreal a' within s)` + ASSUME_TAC); + + (SUBGOAL_THEN ` F32 = (\x:real. f3 x / 2G x )` ASSUME_TAC); + (* Subgoal 3.14.1 *) + (EXPAND_TAC "F32" THEN EXPAND_TAC "2G" THEN EXPAND_TAC "f3"); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `(f3 has_real_derivative &2 - b) (atreal a' within s) /\ + (2G has_real_derivative &2 * G') (atreal a' within s) /\ + ~(2G a' = &0)` ASSUME_TAC); + (* Subgoal 3.14.2 *) + (ASM_REWRITE_TAC[]); + (REPEAT CONJ_TAC); (* Break into 2 subgoals *) + + (EXPAND_TAC "f3" THEN REAL_DIFF_TAC THEN REAL_ARITH_TAC); + (EXPAND_TAC "2G"); + (MATCH_MP_TAC + (MESON[REAL_ENTIRE] `~ (x = &0) /\ ~ (y = &0) ==> ~ (x * y = &0)`)); + (REWRITE_TAC[REAL_ARITH `~(&2 = &0)`]); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> ~(x = &0)`)); + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (FIRST_X_ASSUM MP_TAC); + (MP_TAC HAS_REAL_DERIVATIVE_DIV_WITHIN); + (MESON_TAC[]); + + +(* --------------------------------------------------------------------------*) +(* Subgoal 3.15 *) +(* Derivative of atn ((-- &2 * c + &2 * a + &2 * b - a * b) / *) +(* &2 * sqrt (ups_x x b c - x * b * c)) *) +(* --------------------------------------------------------------------------*) + + (ABBREV_TAC `F3 = (\x. atn ((-- &2 * c + &2 * x + &2 * b - x * b) /(&2 * + sqrt (ups_x x b c - x * b * c))))`); + + (SUBGOAL_THEN `(F3 has_real_derivative + ((&2 - b) * 2G a' - f3 a' * &2 * G') / 2G a' pow 2 * inv (&1 + F32 a' pow 2)) + (atreal a' within s)` + ASSUME_TAC); + + (SUBGOAL_THEN `F3 = (\x. atn (F32 (x:real)))` ASSUME_TAC); + (* Subgoal 3.15.1 *) + (EXPAND_TAC "F3" THEN EXPAND_TAC "F32"); + (REWRITE_TAC[]); + + (PURE_ONCE_ASM_REWRITE_TAC[]); + (REPLICATE_TAC 2 DEL_TAC); + (ABBREV_TAC `g' = (\x. inv (&1 + x pow 2))`); + (ABBREV_TAC `f' = ((&2 - b) * 2G a' - f3 a' * &2 * G') / + 2G (a':real) pow 2`); + + (SUBGOAL_THEN + `!x. (:real) x ==> (atn has_real_derivative (g':real->real) x) (atreal x)` + ASSUME_TAC); + (* Subgoal 3.15.2 *) + (EXPAND_TAC "g'" THEN REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[EQ_UNIV;HAS_REAL_DERIVATIVE_ATN]); + + (SUBGOAL_THEN `(F32 has_real_derivative f') (atreal a' within s) /\ + (:real) ((F32:real->real) a')` + ASSUME_TAC); + (ASM_REWRITE_TAC[]); + (MESON_TAC[EQ_UNIV;IN_UNIV;IN]); + + (SUBGOAL_THEN + `inv (&1 + F32 a' pow 2) = g' ((F32:real-> real) a')` + ASSUME_TAC); + (* Subgoal 3.15.3 *) + (EXPAND_TAC "F32" THEN EXPAND_TAC "g'"); + (REWRITE_TAC[]); + + (ONCE_ASM_REWRITE_TAC[]); + DEL_TAC ; + (REPLICATE_TAC 2 UP_ASM_TAC); + (MP_TAC HAS_REAL_DERIVATIVE_CHAIN2); + (MESON_TAC[]); + +(* ========================================================================= *) +(* THIS PART TO TO REDUCE THE DERIVATIVE OF F3 *) +(* Derivative of F3 is ..... / sqrt d *) +(* ========================================================================= *) + + +(* --------------------------------------------------------------------------*) +(* Subgoal 3.16 *) +(* (&2 * sqrt D') pow 2 = &4 * D' *) +(* --------------------------------------------------------------------------*) + + (SUBGOAL_THEN `(&2 * sqrt D') pow 2 = &4 * D'` ASSUME_TAC); + (REWRITE_TAC[REAL_POW_2]); + (REWRITE_TAC[REAL_ARITH `(&2 * a) * &2 * b = &4 * (a * b)`]); + (REWRITE_TAC[GSYM REAL_POW_2]); + AP_TERM_TAC; + (MATCH_MP_TAC SQRT_POW_2 THEN ASM_REAL_ARITH_TAC); + +(* --------------------------------------------------------------------------*) +(* Subgoal 3.17 *) +(* Reduce: inv (&1 + F32 a' pow 2) *) +(* --------------------------------------------------------------------------*) + + (SUBGOAL_THEN + `inv (&1 + F32 (a':real) pow 2) = (&4 * D') / (&4 * D' + Dc pow 2)` + ASSUME_TAC); + (EXPAND_TAC "F32"); + (REWRITE_TAC[REAL_POW_DIV]); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[MESON[REAL_INV_DIV] + `(&4 * D') / (&4 * D' + Dc pow 2) = + inv ((&4 * D' + Dc pow 2) / (&4 * D'))`]); + AP_TERM_TAC; + (REWRITE_TAC[REAL_ARITH `(a + b) / c = a / c + b / c`]); + (EXPAND_TAC "Dc"); + (REWRITE_TAC[REAL_ARITH `a + b + c - x * y = a + b + c - y * x`]); + (AP_THM_TAC THEN AP_TERM_TAC); + (MATCH_MP_TAC (GSYM REAL_DIV_REFL)); + (REWRITE_TAC[MESON[] `~(a = b) <=> ~(b = a)`;REAL_ENTIRE; + MESON[] `~(a \/ b) <=> ~a /\ ~b`]); + ASM_REAL_ARITH_TAC; + +(* --------------------------------------------------------------------------*) +(* Subgoal 3.18 *) +(* Reduce: Derivative of F3 *) +(* --------------------------------------------------------------------------*) + + (SUBGOAL_THEN + `(F3 has_real_derivative + (-- &2 * b + &2 * a' + &2 * c - a' * c) / (a' * (&4 - a')) / sqrt D') + (atreal a' within s)` + ASSUME_TAC); + + (SUBGOAL_THEN `2G (a':real) = &2 * sqrt D'` ASSUME_TAC); + (* Subgoal 3.18.1 *) + (EXPAND_TAC "2G" THEN EXPAND_TAC "D'"); + (REWRITE_TAC[]); + + (SUBGOAL_THEN `f3 (a':real) = (Dc:real)` ASSUME_TAC); + (* Subgoal 3.18.2 *) + (EXPAND_TAC "f3" THEN EXPAND_TAC "Dc"); + (REAL_ARITH_TAC); + + (SUBGOAL_THEN `&0 < sqrt D'` ASSUME_TAC); + (* Subgoal 3.18.3 *) + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN ` + ((&2 - b) * 2G a' - f3 a' * &2 * G') / 2G a' pow 2 * + inv (&1 + F32 a' pow 2) = + (-- &2 * b + &2 * a' + &2 * c - a' * c) / (a' * (&4 - a')) / sqrt D' ` + ASSUME_TAC); + (* Subgoal 3.18.4 *) + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `(a / b * b / c) = (a / b * b) / c`]); + (SIMP_TAC[REAL_DIV_RMUL]); + + (SUBGOAL_THEN `~(&4 * D' = &0)` ASSUME_TAC); + (* Subgoal 3.18.4.1 *) + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~ (a = &0)`)); + (MATCH_MP_TAC REAL_LT_MUL); + (ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC); + + (ABBREV_TAC `M = (&2 - b) * &2 * sqrt D' - Dc * &2 * G'`); + + (SUBGOAL_THEN `G' = Da * inv (&2 * sqrt D')` ASSUME_TAC); + (* Subgoal 3.18.4.2 *) + (EXPAND_TAC "G'" THEN EXPAND_TAC "Da" THEN EXPAND_TAC "D'"); + (REWRITE_TAC[]); + + (SUBGOAL_THEN `M = ((&4 - &2 * b) * D' - Da * Dc) / sqrt D'` ASSUME_TAC); + (* Subgoal 3.18.4.3 *) + (EXPAND_TAC "M"); + (REWRITE_TAC[REAL_ARITH `(&2 - b) * &2 * x = (&4 - &2 * b) * x`]); + (ONCE_ASM_REWRITE_TAC[]); + (ABBREV_TAC `X = (&4 - &2 * b) * sqrt D' - + Dc * &2 * Da * inv (&2 * sqrt D')`); + (ABBREV_TAC `Y = (&4 - &2 * b) * D' - Da * Dc`); + (ABBREV_TAC `Z = sqrt D'`); + + (SUBGOAL_THEN `X * Z = Y ==> X = Y / Z ` ASSUME_TAC); + (* Subgoal 3.18.4.3.1 *) + (ASM_SIMP_TAC[REAL_EQ_RDIV_EQ]); + + (FIRST_X_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "X" THEN EXPAND_TAC "Y" THEN EXPAND_TAC "Z"); + (ABBREV_TAC `m = &4 - &2 * b`); + (REWRITE_TAC[REAL_SUB_RDISTRIB;REAL_NEG_ADD]); + (REWRITE_TAC[REAL_ARITH ` (a * b * c * d) * e = (c * a) * (d * b * e)`]); + + (SUBGOAL_THEN `inv (&2 * sqrt D') * &2 * sqrt D' = &1` ASSUME_TAC); + (* Subgoal 3.18.4.3.2 *) + (MATCH_MP_TAC REAL_MUL_LINV); + (REWRITE_TAC[REAL_ENTIRE;MESON[] `~(a \/ b) <=> ~a /\ ~b`]); + (REWRITE_TAC[REAL_ARITH `~(&2 = &0)`]); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~ (a = &0)`)); + (ASM_REWRITE_TAC[]); + + (PURE_ONCE_ASM_REWRITE_TAC[]); + (EXPAND_TAC "Y"); + (REWRITE_TAC[REAL_MUL_RID]); + (AP_THM_TAC THEN AP_TERM_TAC); + (EXPAND_TAC "m" THEN EXPAND_TAC "Z"); + (REWRITE_TAC[REAL_ARITH `(a * b) * c = a * b * c`]); + (REPEAT AP_TERM_TAC); + (REWRITE_TAC[GSYM REAL_POW_2]); + (MATCH_MP_TAC SQRT_POW_2); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`)); + (ASM_REWRITE_TAC[]); + (* End of Subgoal 3.18.4.3 *) + + (SUBGOAL_THEN `M / (&4 * D') * &4 * D' = M` ASSUME_TAC); + (* Subgoal 3.18.4.4 *) + (ASM_SIMP_TAC[REAL_DIV_RMUL]); + + (PURE_ONCE_ASM_REWRITE_TAC[] THEN DEL_TAC); + + (SUBGOAL_THEN + `M = ((-- &2 * b + &2 * a' + &2 * c - a' * c) * (&4 - b) * b)/ sqrt D'` + ASSUME_TAC); + (* Subgoal 3.18.4.5 *) + (ONCE_ASM_REWRITE_TAC[]); + (AP_THM_TAC THEN AP_TERM_TAC); + (EXPAND_TAC "D'" THEN REWRITE_TAC[ups_x]); + (EXPAND_TAC "Da" THEN EXPAND_TAC "Dc" THEN EXPAND_TAC "f3"); + REAL_ARITH_TAC; + + (UP_ASM_TAC THEN DEL_TAC THEN REPEAT DISCH_TAC); + (ONCE_ASM_REWRITE_TAC[]); + (EXPAND_TAC "Dc"); + (REWRITE_TAC[REAL_ARITH `a / b / c = a / c / b`]); + (AP_THM_TAC THEN AP_TERM_TAC); + + (SUBGOAL_THEN + `&4 * D' + f3 a' pow 2 = a' * (&4 - a') * (&4 - b) * b` ASSUME_TAC); + (* Subgoal 3.18.4.6 *) + (EXPAND_TAC "f3" THEN REWRITE_TAC[POW_2] ); + (EXPAND_TAC "D'" THEN REWRITE_TAC[ups_x]); + REAL_ARITH_TAC; + + (ONCE_ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[REAL_ARITH `(a * b) / c = a * b / c`]); + + (* --------------------------------------------------------------- *) + (* ~ ( b = &4) /\ ~ (b = &0) *) + (* --------------------------------------------------------------- *) + + (SUBGOAL_THEN `~ (b = &4) /\ ~ (b = &0)` ASSUME_TAC); + (ASM_REAL_ARITH_TAC); + + (SUBGOAL_THEN `~ ((&4 - b) * b = &0)` ASSUME_TAC); + (REWRITE_TAC[REAL_ENTIRE;MESON[] `~(a \/ b) <=> ~a /\ ~b`]); + (ASM_REWRITE_TAC[REAL_ARITH ` ~(a - b = &0) <=> ~ (a = b)`]); + + (* --------------------------------------------------------------- *) + (* ~ ( a' = &4) /\ ~ (a' = &0) *) + (* --------------------------------------------------------------- *) + + (SUBGOAL_THEN `~ (a' = &4) /\ ~ (a' = &0)` ASSUME_TAC); + (REPEAT STRIP_TAC); (* 2 Subgoals *) + + (SUBGOAL_THEN ` D' = -- ((c + b - &4) pow 2)` ASSUME_TAC); + (EXPAND_TAC "D'" ); + (REWRITE_TAC[ups_x]); + (ONCE_ASM_REWRITE_TAC[]); + REAL_ARITH_TAC; + (SUBGOAL_THEN `D' <= &0` ASSUME_TAC); + (ASM_REWRITE_TAC[REAL_ARITH `-- c <= &0 <=> &0 <= c`]); + (MESON_TAC[REAL_LE_POW_2]); + (MP_TAC (ASSUME `&0 < D'`)); + (FIRST_ASSUM MP_TAC THEN REAL_ARITH_TAC); + + (SUBGOAL_THEN ` D' = -- ((c - b) pow 2)` ASSUME_TAC); + (EXPAND_TAC "D'" ); + (REWRITE_TAC[ups_x]); + (ONCE_ASM_REWRITE_TAC[]); + REAL_ARITH_TAC; + (SUBGOAL_THEN `D' <= &0` ASSUME_TAC); + (ASM_REWRITE_TAC[REAL_ARITH `-- c <= &0 <=> &0 <= c`]); + (MESON_TAC[REAL_LE_POW_2]); + (MP_TAC (ASSUME `&0 < D'`)); + (FIRST_ASSUM MP_TAC THEN REAL_ARITH_TAC); + + (SUBGOAL_THEN `~ (a' * (&4 - a') = &0)` ASSUME_TAC); + (REWRITE_TAC[REAL_ENTIRE; MESON[] `~(a \/ b) <=> ~a /\ ~b`]); + (ASM_REWRITE_TAC[REAL_ARITH ` ~(a - b = &0) <=> ~ (a = b)`]); + + (* --------------------------------------------------------------- *) + (* continue *) + (* --------------------------------------------------------------- *) + + (ABBREV_TAC `x = -- &2 * b + &2 * a' + &2 * c - a' * c`); + (ABBREV_TAC `y = (&4 - b) * b`); + (REWRITE_TAC[REAL_ARITH `a * b * c = (a * b) * c`]); + (ABBREV_TAC `z = a' * (&4 - a')`); + (ASM_SIMP_TAC[REDUCE_WITH_DIV_Euler_lemma]); + (ASM_MESON_TAC[]); + + (UP_ASM_TAC THEN REPLICATE_TAC 3 DEL_TAC); + (UP_ASM_TAC THEN REPLICATE_TAC 3 DEL_TAC THEN REPEAT DISCH_TAC); + +(* ================ END DIFF 3 ============================================= *) + + +(* --------------------------------------------------------------------------*) +(* Subgoal 3.19. *) +(* Derivative of (&8 - a - b - c) / sqrt (ups_x a b c - a * b * c) *) +(* --------------------------------------------------------------------------*) + + (ABBREV_TAC `f4 = (\x. (&8 - x - b - c))`); + (ABBREV_TAC `F42 = (\x. (&8 - x - b - c) / sqrt (ups_x x b c - x * b * c))`); + + (SUBGOAL_THEN + `(F42 has_real_derivative (-- &1 * G a' - f4 a' * G') / G a' pow 2) + (atreal a' within s)` + ASSUME_TAC); + + (SUBGOAL_THEN ` F42 = (\x:real. f4 x / G x)` ASSUME_TAC); + (* Subgoal 3.19.1 *) + (EXPAND_TAC "F42" THEN EXPAND_TAC "G" THEN EXPAND_TAC "f4"); + (REWRITE_TAC[]); + + (PURE_ONCE_ASM_REWRITE_TAC[] THEN REPLICATE_TAC 2 DEL_TAC); + + (SUBGOAL_THEN `(f4 has_real_derivative -- &1) (atreal a' within s) /\ + (G has_real_derivative G') (atreal a' within s) /\ + ~(G a' = &0)` ASSUME_TAC); + (* Subgoal 3.19.2 *) + (ASM_REWRITE_TAC[]); + CONJ_TAC; (* Break into 2 subgoals *) + + (EXPAND_TAC "f4" THEN REAL_DIFF_TAC THEN REAL_ARITH_TAC); + (* End one of 2 subgoals *) + (EXPAND_TAC "G"); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~ (a = &0)`)); + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + + (FIRST_X_ASSUM MP_TAC); + (MP_TAC HAS_REAL_DERIVATIVE_DIV_WITHIN); + (MESON_TAC[]); + +(* --------------------------------------------------------------------------*) +(* Subgoal 3.20. *) +(* Derivative of atn ((&8 - a - b - c) / sqrt (ups_x a b c - a * b * c)) *) +(* --------------------------------------------------------------------------*) + + (ABBREV_TAC + `F4 = (\x. atn ((&8 - x - b - c) / (sqrt (ups_x x b c - x * b * c))))`); + + (SUBGOAL_THEN + `(F4 has_real_derivative + (-- &1 * G a' - f4 a' * G') / G a' pow 2 * inv (&1 + F42 a' pow 2)) + (atreal a' within s)` + ASSUME_TAC); + + (SUBGOAL_THEN `F4 = (\x. atn (F42 (x:real)))` ASSUME_TAC); + (* Subgoal 3.20.1 *) + (EXPAND_TAC "F4" THEN EXPAND_TAC "F42"); + (REWRITE_TAC[]); + + (PURE_ONCE_ASM_REWRITE_TAC[]); + (REPLICATE_TAC 2 DEL_TAC); + (ABBREV_TAC `g' = (\x. inv (&1 + x pow 2))`); + (ABBREV_TAC `f' = ( -- &1 * G (a':real) - f4 a' * G') / G a' pow 2`); + + (SUBGOAL_THEN + `inv (&1 + F42 a' pow 2) = g' ((F42:real-> real) a')` + ASSUME_TAC); + (* Subgoal 3.20.2 *) + (EXPAND_TAC "F42" THEN EXPAND_TAC "g'"); + (REWRITE_TAC[]); + + (SUBGOAL_THEN + `!x. (:real) x ==> (atn has_real_derivative (g':real->real) x) (atreal x)` + ASSUME_TAC); + (* Subgoal 3.20.3 *) + (EXPAND_TAC "g'" THEN REWRITE_TAC[BETA_THM]); + (REWRITE_TAC[EQ_UNIV;HAS_REAL_DERIVATIVE_ATN]); + + (SUBGOAL_THEN + `(F42 has_real_derivative f') (atreal a' within s) /\ + (:real) ((F42:real->real) a')` + ASSUME_TAC); + (* Subgoal 3.20.4 *) + (ASM_REWRITE_TAC[]); + (MESON_TAC[EQ_UNIV;IN_UNIV;IN]); + + (ONCE_ASM_REWRITE_TAC[]); + (REPLICATE_TAC 2 UP_ASM_TAC); + (MP_TAC HAS_REAL_DERIVATIVE_CHAIN2); + (MESON_TAC[]); + + +(* ========================================================================= *) +(* THIS PART TO TO REDUCE THE DERIVATIVE OF F4 *) +(* Derivative of F4 is ..... ........ *) +(* ========================================================================= *) +(* Subgoal 3.21 *) +(* ------------------------------------------------------------------------- *) + + (SUBGOAL_THEN + `(F4 has_real_derivative (a' - b - c) / &2 / (&4 - a') / sqrt D') + (atreal a' within s)` + ASSUME_TAC); + + (SUBGOAL_THEN `G (a':real) = sqrt D'` ASSUME_TAC); + (* Subgoal 3.21.1 *) + (EXPAND_TAC "G" THEN EXPAND_TAC "D'"); + (REWRITE_TAC[]); + + (ABBREV_TAC `D4 = &8 - a' - b - c`); + + (SUBGOAL_THEN `f4 (a':real) = (D4:real)` ASSUME_TAC); + (* Subgoal 3.21.2 *) + (EXPAND_TAC "f4" THEN EXPAND_TAC "D4"); + (REWRITE_TAC[]); + + (SUBGOAL_THEN `&0 < sqrt D'` ASSUME_TAC); + (* Subgoal 3.21.3 *) + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `(-- &1 * G a' - f4 a' * G') / G a' pow 2 * inv (&1 + F42 a' pow 2) = + (a' - b - c) / &2 / (&4 - a') / sqrt D'` + ASSUME_TAC); + (* Subgoal 3.21.4 *) + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `sqrt D' pow 2 = D'` ASSUME_TAC); + (* Subgoal 3.21.4.1 *) + (MATCH_MP_TAC SQRT_POW_2); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`)); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `inv (&1 + F42 (a':real) pow 2) = D' / (D' + D4 pow 2)` ASSUME_TAC); + (* Subgoal 3.21.4.2 *) + (EXPAND_TAC "F42"); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_POW_DIV]); + (ONCE_ASM_REWRITE_TAC[]); + (PURE_ONCE_REWRITE_TAC[GSYM REAL_INV_DIV]); + AP_TERM_TAC; + (PURE_ONCE_REWRITE_TAC[REAL_INV_DIV]); + (REWRITE_TAC[REAL_ARITH `(a + b) / c = a / c + b / c`]); + (AP_THM_TAC THEN AP_TERM_TAC); + (MATCH_MP_TAC (GSYM REAL_DIV_REFL)); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~ (&0 = a)`)); + (ASM_REWRITE_TAC[]); + + (ONCE_ASM_REWRITE_TAC[] THEN DEL_TAC THEN DEL_TAC); + (PURE_REWRITE_TAC[REAL_ARITH `-- &1 * x = -- x`]); + (ABBREV_TAC `M = -- sqrt D' - D4 * G'`); + + (SUBGOAL_THEN + `D' + D4 pow 2 = (&4 - a') * (&4 - b) * (&4 - c)` ASSUME_TAC); + (* Subgoal 3.21.4.3 *) + (EXPAND_TAC "D4"); + (EXPAND_TAC "D'" THEN REWRITE_TAC[ups_x]); + (EXPAND_TAC "f4"); + REAL_ARITH_TAC; + + (SUBGOAL_THEN `G' = Da * inv (&2 * sqrt D')` ASSUME_TAC); + (* Subgoal 3.21.4.4 *) + (EXPAND_TAC "G'" THEN EXPAND_TAC "Da"); + (REPEAT AP_TERM_TAC); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `M = (a' - b - c) * ((&4 - b) * (&4 - c)) / &2 / sqrt D'` ASSUME_TAC); + (* Subgoal 3.21.4.5 *) + (EXPAND_TAC "M"); + (UP_ASM_TAC THEN UP_ASM_TAC THEN DEL_TAC THEN REPEAT DISCH_TAC); + (ONCE_ASM_REWRITE_TAC[]); + (ABBREV_TAC `X = --sqrt D' - D4 * Da * inv (&2 * sqrt D') `); + (REWRITE_TAC[REAL_ARITH `a * (b * c) / d / e = ((a * b * c) / d) / e`]); + (ABBREV_TAC `Y = ((a' - b - c) * (&4 - b) * (&4 - c)) / &2`); + (ABBREV_TAC `Z = sqrt D'`); + + (SUBGOAL_THEN `X * Z = Y ==> X = Y / Z ` ASSUME_TAC); + (* Subgoal 3.21.4.5.1 *) + (ASM_SIMP_TAC[REAL_EQ_RDIV_EQ]); + + (FIRST_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "X" THEN EXPAND_TAC "Y" THEN EXPAND_TAC "Z"); + (REWRITE_TAC[REAL_SUB_RDISTRIB]); + + (SUBGOAL_THEN `--sqrt D' * sqrt D' = -- D'` ASSUME_TAC); + (* Subgoal 3.21.4.5.2 *) + (MATCH_MP_TAC (REAL_ARITH `a * b = c ==> -- a * b = -- c`)); + (REWRITE_TAC[GSYM REAL_POW_2]); + (MATCH_MP_TAC SQRT_POW_2); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> &0 <= x`)); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `(D4 * Da * inv (&2 * sqrt D')) * sqrt D' = D4 * Da / &2` ASSUME_TAC); + (* Subgoal 3.21.4.5.3 *) + (REWRITE_TAC[REAL_INV_MUL]); + (REWRITE_TAC[REAL_ARITH + `(a * b * c * d) * e = (a * b * c) * (d * e)`]); + + (SUBGOAL_THEN `inv (sqrt D') * sqrt D' = &1 ` ASSUME_TAC); + (MATCH_MP_TAC REAL_MUL_LINV); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> ~(x = &0)`)); + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[REAL_MUL_RID]); + REAL_ARITH_TAC; + + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "D'" THEN EXPAND_TAC "D4" THEN EXPAND_TAC "Da"); + (REWRITE_TAC[ups_x]); + (EXPAND_TAC "f4"); + (REAL_ARITH_TAC); + (* End Subgoal 3.21.4.5 *) + + (REWRITE_TAC[REAL_ARITH `a / b * c / d = (a / b * c) / d`]); + + (SUBGOAL_THEN `(M / D' * D') = M` ASSUME_TAC); + (MATCH_MP_TAC REAL_DIV_RMUL); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> ~ ( x = &0) `)); + (ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `(a * x / b / c) / d = (a * x / d) / b / c`]); + (AP_THM_TAC THEN AP_TERM_TAC); + (ONCE_REWRITE_TAC[REAL_ARITH ` a/ &2 / b = a / b / &2`]); + (AP_THM_TAC THEN AP_TERM_TAC); + (ABBREV_TAC `S = (&4 - b) * (&4 - c)`); + + (* ----------------------------------------------------- *) + (* ~ ( c = &4) *) + (* ----------------------------------------------------- *) + (SUBGOAL_THEN `~ (&4 - b = &0) /\ ~ (&4 - c = &0)` ASSUME_TAC); + ASM_REAL_ARITH_TAC; + + (* ----------------------------------------------------- *) + (* ~ (a' = &4) *) + (* ----------------------------------------------------- *) + + (SUBGOAL_THEN `~ (&4 - a' = &0)` ASSUME_TAC); + (MATCH_MP_TAC (REAL_ARITH `~ (x = &4) ==> ~ (&4 - x = &0)`)); + STRIP_TAC; + + (SUBGOAL_THEN ` D' = -- ((b + c - &4) pow 2)` ASSUME_TAC); + (EXPAND_TAC "D'" ); + (REWRITE_TAC[ups_x]); + (ONCE_ASM_REWRITE_TAC[]); + REAL_ARITH_TAC; + + (SUBGOAL_THEN `D' <= &0` ASSUME_TAC); + (ASM_REWRITE_TAC[REAL_ARITH `-- a <= &0 <=> &0 <= a`]); + (MESON_TAC[REAL_LE_POW_2]); + + (MP_TAC (ASSUME `&0 < D'`)); + (FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + +(* ===================================================================== *) + + (* ----------------------------------------------------- *) + (* Continue *) + (* ----------------------------------------------------- *) + + (SUBGOAL_THEN `~ (S = &0)` ASSUME_TAC); + (EXPAND_TAC "S"); + (REWRITE_TAC [REAL_ENTIRE;MESON[] `~(a \/ b) <=> ~a /\ ~b `]); + (ASM_REWRITE_TAC[]); + + (ASM_MESON_TAC[REDUCE_WITH_DIV_Euler_lemma]); + (* End of subgoal *) + + (ASM_MESON_TAC[]); + (UP_ASM_TAC); + (DEL_TAC THEN UP_ASM_TAC); + (DEL_TAC THEN DEL_TAC THEN DEL_TAC); + (REPEAT DISCH_TAC); + + +(* ================ END DIFF 4 ============================================== *) + + +(* ========================================================================= *) +(* END OF THE FIRST GOAL *) +(* ========================================================================= *) + +(* ------------------------------------------------------------------------- *) +(* Subgoal 3.22 *) +(* ------------------------------------------------------------------------- *) + + (ABBREV_TAC `FUNCTION = (\a. --pi / &2 - + atn + ((-- &2 * a + &2 * b + &2 * c - b * c) / + (&2 * sqrt (ups_x a b c - a * b * c))) - + atn + ((-- &2 * b + &2 * c + &2 * a - c * a) / + (&2 * sqrt (ups_x a b c - a * b * c))) - + atn + ((-- &2 * c + &2 * a + &2 * b - a * b) / + (&2 * sqrt (ups_x a b c - a * b * c))) + + &2 * atn ((&8 - a - b - c) / sqrt (ups_x a b c - a * b * c)))`); + + (SUBGOAL_THEN + `FUNCTION = (\(a:real). --pi / &2 - F1 a - F2 a - F3 a + &2 * F4 a)` + ASSUME_TAC); + (EXPAND_TAC "FUNCTION"); + (EXPAND_TAC "F1" THEN EXPAND_TAC "F2"); + (EXPAND_TAC "F3" THEN EXPAND_TAC "F4"); + (REWRITE_TAC[]); + + (ABBREV_TAC `F1' = -- &1 / sqrt D'`); + (ABBREV_TAC `F2' = + (-- &2 * c + &2 * a' + &2 * b - a' * b) / (a' * (&4 - a')) / sqrt D'`); + (ABBREV_TAC `F3' = + (-- &2 * b + &2 * a' + &2 * c - a' * c) / (a' * (&4 - a')) / sqrt D'`); + (ABBREV_TAC `F4' = (a' - b - c) / &2 / (&4 - a') / sqrt D'`); + +(* ------------------------------------------------------------------------- *) +(* Subgoal 3.23 *) +(* ------------------------------------------------------------------------- *) + + (SUBGOAL_THEN ` &0 - F1' - F2' - F3' + &2 * F4' = &0` ASSUME_TAC); + (EXPAND_TAC "F1'" THEN EXPAND_TAC "F2'"); + (EXPAND_TAC "F3'" THEN EXPAND_TAC "F4'"); + (REWRITE_TAC[REAL_ARITH `&0 - a - b - c + d = &0 <=> a + b + c = d `]); + (REWRITE_TAC[REAL_ARITH `a / x + b / x = (a + b) / x`]); + (REWRITE_TAC[REAL_ARITH `a * b / c / d / e = ((a * b / c) / d) / e`]); + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_TAC[REAL_ARITH + `(-- &2 * c + &2 * a' + &2 * b - a' * b) + + -- &2 * b + &2 * a' + &2 * c - a' * c = + a' * (&4 - b - c)`]); + + (* --------------------------------------------------------------- *) + (* ~ ( a' = &4) /\ ~ (a' = &0) *) + (* --------------------------------------------------------------- *) + + (SUBGOAL_THEN `~ (&4 - a' = &0) /\ ~ (a' = &0)` ASSUME_TAC); + (REWRITE_TAC[REAL_ARITH `~ (&4 - a' = &0) <=> ~ (a' = &4)`]); + (REPEAT STRIP_TAC); (* 2 Subgoals *) + + (SUBGOAL_THEN ` D' = -- ((c + b - &4) pow 2)` ASSUME_TAC); + (EXPAND_TAC "D'" ); + (REWRITE_TAC[ups_x]); + (ONCE_ASM_REWRITE_TAC[]); + REAL_ARITH_TAC; + (SUBGOAL_THEN `D' <= &0` ASSUME_TAC); + (ASM_REWRITE_TAC[REAL_ARITH `-- c <= &0 <=> &0 <= c`]); + (MESON_TAC[REAL_LE_POW_2]); + (MP_TAC (ASSUME `&0 < D'`)); + (FIRST_ASSUM MP_TAC THEN REAL_ARITH_TAC); + + (SUBGOAL_THEN ` D' = -- ((c - b) pow 2)` ASSUME_TAC); + (EXPAND_TAC "D'" ); + (REWRITE_TAC[ups_x]); + (ONCE_ASM_REWRITE_TAC[]); + REAL_ARITH_TAC; + (SUBGOAL_THEN `D' <= &0` ASSUME_TAC); + (ASM_REWRITE_TAC[REAL_ARITH `-- c <= &0 <=> &0 <= c`]); + (MESON_TAC[REAL_LE_POW_2]); + (MP_TAC (ASSUME `&0 < D'`)); + (FIRST_ASSUM MP_TAC THEN REAL_ARITH_TAC); + + (SUBGOAL_THEN `~ (a' * (&4 - a') = &0)` ASSUME_TAC); + (REWRITE_TAC[REAL_ENTIRE;MESON[] `~(a \/ b) <=> ~a /\ ~b`]); + (ASM_REWRITE_TAC[]); + + (REWRITE_TAC[REAL_ARITH `&2 * x / &2 = x`]); + + (SUBGOAL_THEN `-- &1 = -- (&4 - a') / (&4 - a')` ASSUME_TAC); + (MATCH_MP_TAC (REAL_ARITH `(a = b/c) ==> (-- a = -- b/c)`)); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `(-- x /y + z = t / y) <=> (z = (t + x) / y)`]); + (REWRITE_TAC[REAL_ARITH `a - x - y + z - a = z - x - y`]); + (REWRITE_TAC[REAL_ARITH `(x * y) / (x * z) = y * x / (z * x)`]); + (MATCH_MP_TAC REDUCE_WITH_DIV_Euler_lemma); + (ASM_REWRITE_TAC[]); + + (UP_ASM_TAC THEN REPLICATE_TAC 4 DEL_TAC); + (REPLICATE_TAC 5 (UP_ASM_TAC THEN DEL_TAC)); + (REPEAT DISCH_TAC); + +(* ------------------------------------------------------------------------- *) +(* Subgoal 3.24 *) +(* ------------------------------------------------------------------------- *) + + (ABBREV_TAC `FUNC1 = (\(a:real). F1 a + F2 a + F3 a)`); + (ABBREV_TAC `FUNC2 = (\(a:real). --pi / &2 + &2 * F4 a)`); + + (SUBGOAL_THEN + `(FUNC1 has_real_derivative F1' + F2' + F3') (atreal a' within s)` + ASSUME_TAC); + (ABBREV_TAC `X = (\(a:real). F2 a + F3 a)`); + (ABBREV_TAC `X' = F2' + F3'`); + + (SUBGOAL_THEN + `(X has_real_derivative X') (atreal a' within s)` ASSUME_TAC); + (* Subgoal 3.24.1 *) + (EXPAND_TAC "X" THEN EXPAND_TAC "X'"); + (ASM_SIMP_TAC[HAS_REAL_DERIVATIVE_ADD]); + + (SUBGOAL_THEN `FUNC1 = (\(a:real). F1 a + X a)` ASSUME_TAC); + (* Subgoal 3.24.2 *) + (EXPAND_TAC "X"); + (ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[HAS_REAL_DERIVATIVE_ADD]); + +(* ------------------------------------------------------------------------- *) +(* Subgoal 3.25 *) +(* ------------------------------------------------------------------------- *) + + (SUBGOAL_THEN + `(FUNC2 has_real_derivative &0 + &2 * F4') (atreal a' within s)` + ASSUME_TAC); + (ABBREV_TAC `X = (\(a:real). -- pi / &2)`); + (ABBREV_TAC `Y = (\(a:real). &2 * F4 a)`); + + (SUBGOAL_THEN + `(X has_real_derivative &0) (atreal a' within s)` ASSUME_TAC); + (* Subgoal 3.25.1 *) + (EXPAND_TAC "X"); + (REAL_DIFF_TAC); + (REWRITE_TAC[]); + + (SUBGOAL_THEN + `(Y has_real_derivative &2 * F4') (atreal a' within s)` ASSUME_TAC); + (* Subgoal 3.25.2 *) + (EXPAND_TAC "Y"); + (MATCH_MP_TAC HAS_REAL_DERIVATIVE_LMUL_WITHIN); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `FUNC2 = (\(a:real). X a + Y a)` ASSUME_TAC); + (* Subgoal 3.25.3 *) + (EXPAND_TAC "X" THEN EXPAND_TAC "Y"); + (ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (ASM_SIMP_TAC[HAS_REAL_DERIVATIVE_ADD]); + +(* ------------------------------------------------------------------------- *) +(* Subgoal 3.26 *) +(* ------------------------------------------------------------------------- *) + + (SUBGOAL_THEN `FUNCTION = (\(a:real). FUNC2 a - FUNC1 a)` ASSUME_TAC); + (EXPAND_TAC "FUNC1" THEN EXPAND_TAC "FUNC2"); + (REWRITE_TAC[REAL_ARITH `(a + b) - (c + d + e) = a - c - d - e + b`]); + (ASM_REWRITE_TAC[]); + +(* ------------------------------------------------------------------------- *) +(* Subgoal 3.27 *) +(* ------------------------------------------------------------------------- *) + + (SUBGOAL_THEN + `(FUNCTION has_real_derivative &0 - F1' - F2' - F3' + &2 * F4') + (atreal a' within s)` + ASSUME_TAC); + (REWRITE_TAC[REAL_ARITH `a - c - d - e + b = (a + b) - (c + d + e)`]); + (ASM_MESON_TAC[HAS_REAL_DERIVATIVE_SUB]); + + (ASM_MESON_TAC[]); + + +(* ========================================================================= *) +(* *) +(* FINISH COMPUTE FIRST DERIVATIVES *) +(* *) +(* ========================================================================= *) + + +(* ------------------------------------------------------------------------- *) +(* SUBGOAL 4.1 *) +(* ~ ( c = &4) /\ ~ (c = &0) *) +(* ------------------------------------------------------------------------- *) + + (SUBGOAL_THEN `~ (c = &4) /\ ~ (c = &0)` ASSUME_TAC); + ASM_REAL_ARITH_TAC; + +(* ------------------------------------------------------------------------- *) +(* SUBGOAL 4.2 *) +(* Reduce the expression *) +(* ------------------------------------------------------------------------- *) + + (PURE_REWRITE_TAC[REAL_ARITH + `&8 - (b + c - (b * c) / &2) - b - c = + &8 + (b * c) / &2 - &2 * b - &2 * c`]); + (PURE_REWRITE_TAC[REAL_ARITH + `-- &2 * (b + c - (b * c) / &2) + &2 * b + &2 * c - b * c = &0 `]); + (REWRITE_TAC[REAL_ARITH `&0 * x = &0 /\ &0 / x = &0`; + ATN_0; REAL_ARITH `a - &0 = a`]); + (PURE_REWRITE_TAC[REAL_ARITH + `-- &2 * b + &2 * c + &2 * (b + c - (b * c) / &2) - + c * (b + c - (b * c) / &2) = + (&1 - b / &2) * (&4 - c) * c `]); + (PURE_REWRITE_TAC[REAL_ARITH + `-- &2 * c + &2 * (b + c - (b * c) / &2) + + &2 * b - (b + c - (b * c) / &2) * b = + (&1 - c / &2) * (&4 - b) * b`]); + (PURE_REWRITE_TAC[ups_x]); + (PURE_REWRITE_TAC[REAL_ARITH + `(--(b + c - (b * c) / &2) * (b + c - (b * c) / &2) - b * b - c * c + + &2 * (b + c - (b * c) / &2) * c + + &2 * (b + c - (b * c) / &2) * b + + &2 * b * c) - + (b + c - (b * c) / &2) * b * c = + (((&4 - b) * b) * (&4 - c) * c) / &4`]); + + +(* ------------------------------------------------------------------------- *) +(* SUBGOAL 4. *) +(* *) +(* ------------------------------------------------------------------------- *) + + + (SUBGOAL_THEN + `!r b. c IN r /\ + is_realinterval r /\ + b IN r /\ + (!y. y IN r ==> &0 < ((&4 - y) * y) * (&4 - c) * c) + ==> --pi / &2 - + atn + (((&1 - b / &2) * (&4 - c) * c) / + (&2 * sqrt ((((&4 - b) * b) * (&4 - c) * c) / &4))) - + atn + (((&1 - c / &2) * (&4 - b) * b) / + (&2 * sqrt ((((&4 - b) * b) * (&4 - c) * c) / &4))) + + &2 * + atn + ((&8 + (b * c) / &2 - &2 * b - &2 * c) / + sqrt ((((&4 - b) * b) * (&4 - c) * c) / &4)) = + &0` + ASSUME_TAC); + + (REPEAT GEN_TAC THEN STRIP_TAC); + SWITCH_TAC; + (FIRST_X_ASSUM MP_TAC THEN SPEC_TAC (`b':real`, `x:real`) ); + (MATCH_MP_TAC HAS_REAL_DERIVATIVE_ZERO_CONSTANT2 THEN EXISTS_TAC `c:real`); + (ASM_REWRITE_TAC[]); + STRIP_TAC; (* Break into 2 Subgoals *) + + (* The first one *) + (ABBREV_TAC `C = (&4 - c) * c`); + (ABBREV_TAC + `FUNCTION = (\x. --pi / &2 - + atn + (((&1 - x / &2) * C) / (&2 * sqrt ((((&4 - x) * x) * C) / &4))) - + atn + (((&1 - c / &2) * (&4 - x) * x) / + (&2 * sqrt ((((&4 - x) * x) * C) / &4))) + + &2 * + atn + ((&8 + (x * c) / &2 - &2 * x - &2 * c) / + sqrt ((((&4 - x) * x) * C) / &4)))`); + (ABBREV_TAC + `F1 = (\x. atn + (((&1 - x / &2) * C) / (&2 * sqrt ((((&4 - x) * x) * C) / &4))))`); + (ABBREV_TAC + `F2 = (\x. atn + (((&1 - c / &2) * (&4 - x) * x) / + (&2 * sqrt ((((&4 - x) * x) * C) / &4))))`); + (ABBREV_TAC + `F3 = (\x. atn + ((&8 + (x * c) / &2 - &2 * x - &2 * c) / + sqrt ((((&4 - x) * x) * C) / &4)))`); + + (SUBGOAL_THEN + `FUNCTION = (\(x:real). --pi / &2 - F1 x - F2 x + &2 * F3 x)` + ASSUME_TAC); + (EXPAND_TAC "F1" THEN EXPAND_TAC "F2" THEN EXPAND_TAC "F3"); + (EXPAND_TAC "FUNCTION"); + (REWRITE_TAC[]); + + (GEN_TAC THEN DISCH_TAC); + + +(* ------------------------------------------------------------------------- *) +(* SUBGOAL 4. *) +(* *) +(* ------------------------------------------------------------------------- *) + + (ABBREV_TAC `D' = (((&4 - x) * x) * C) / &4`); + (SUBGOAL_THEN `&0 < D'` ASSUME_TAC); + (* Subgoal *) + (EXPAND_TAC "D'" THEN DEL_TAC); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 < a / &4`)); + UP_ASM_TAC; + (ASM_MESON_TAC[]); + +(* --------------------------------------------------------------------------*) +(* Derivativ of sqrt ((((&4 - x) * x) * C) / &4) *) +(* --------------------------------------------------------------------------*) + + (ABBREV_TAC `G = (\x. sqrt ((((&4 - x) * x) * C) / &4))`); + (ABBREV_TAC `G' = + (((&4 - &2 * x) * C) / &4) * inv (&2 * sqrt ((((&4 - x) * x) * C) / &4))`); + + (SUBGOAL_THEN `(G has_real_derivative G') (atreal x within r)` ASSUME_TAC); + (* Subgoal *) + + (ABBREV_TAC `f = (\x. (((&4 - x) * x) * C) / &4)`); + + (SUBGOAL_THEN `G = (\x:real. sqrt (f x))` ASSUME_TAC); + (* Subgoal *) + (EXPAND_TAC "f" THEN ASM_REWRITE_TAC[]); + + (ABBREV_TAC `g' = (\x. inv (&2 * sqrt x))`); + (ABBREV_TAC `f' = ((&4 - &2 * x) * C)/ &4 `); + (ABBREV_TAC `P = {x:real | &0 < x}`); + + (SUBGOAL_THEN + `!x. P x ==> (sqrt has_real_derivative (g':real->real) x) (atreal x)` + ASSUME_TAC); + (* Subgoal *) + (EXPAND_TAC "g'" THEN REWRITE_TAC[BETA_THM]); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN_ELIM_THM]); + (REWRITE_TAC[HAS_REAL_DERIVATIVE_SQRT]); + + (SUBGOAL_THEN + `(f has_real_derivative f') (atreal x within r) /\ + (P:real->bool) (f x)` ASSUME_TAC); + (* Subgoal *) + + CONJ_TAC; + (EXPAND_TAC "f" THEN EXPAND_TAC "f'"); + (REAL_DIFF_TAC THEN REAL_ARITH_TAC); + (EXPAND_TAC "P" THEN REWRITE_TAC[IN_ELIM_THM]); + (EXPAND_TAC "f"); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `G' = f' * (g' ((f:real->real) x))` ASSUME_TAC); + (* Subgoal *) + (EXPAND_TAC "G'" THEN EXPAND_TAC "f'"); + (EXPAND_TAC "g'" THEN EXPAND_TAC "f" ); + (REWRITE_TAC[]); + + (ONCE_ASM_REWRITE_TAC[]); + (DEL_TAC THEN UP_ASM_TAC THEN UP_ASM_TAC); + (MP_TAC HAS_REAL_DERIVATIVE_CHAIN2 THEN MESON_TAC[]); + +(* --------------------------------------------------------------------------*) +(* Derivative of &2 * sqrt ((((&4 - x) * x) * C) / &4) *) +(* --------------------------------------------------------------------------*) + + (ABBREV_TAC `2G = (\x. &2 * sqrt ((((&4 - x) * x) * C) / &4))`); + (SUBGOAL_THEN + `(2G has_real_derivative &2 * G') (atreal x within r)` ASSUME_TAC); + + (SUBGOAL_THEN `2G = (\x:real. &2 * G x)` ASSUME_TAC); + (EXPAND_TAC "2G" THEN EXPAND_TAC "G" THEN MESON_TAC[]); + + (ONCE_ASM_REWRITE_TAC[]); + (DEL_TAC THEN DEL_TAC ); + (FIRST_X_ASSUM MP_TAC); + (MP_TAC HAS_REAL_DERIVATIVE_LMUL_WITHIN THEN MESON_TAC[]); + +(* --------------------------------------------------------------------------*) +(* Derivative of ((&1 - x / &2) * C) / *) +(* (&2 * sqrt ((((&4 - x) * x) * C) / &4)) *) +(* --------------------------------------------------------------------------*) + + (ABBREV_TAC `f1 = (\x. (&1 - x / &2) * C)`); + (ABBREV_TAC `F12 = + (\x. ((&1 - x / &2) * C) / (&2 * sqrt ((((&4 - x) * x) * C) / &4)))`); + + (SUBGOAL_THEN + `(F12 has_real_derivative + ((-- &1 / &2 * C) * 2G x - f1 x * &2 * G') / 2G x pow 2) + (atreal x within r)` + ASSUME_TAC); + + (SUBGOAL_THEN `F12 = (\x:real. f1 x / 2G x)` ASSUME_TAC); + (* Subgoal *) + (EXPAND_TAC "F12" THEN EXPAND_TAC "2G" THEN EXPAND_TAC "f1"); + (REWRITE_TAC[]); + + (ASM_REWRITE_TAC[] THEN DEL_TAC); + + (SUBGOAL_THEN + `(f1 has_real_derivative (-- &1 / &2) * C) (atreal x within r) /\ + (2G has_real_derivative &2 * G') (atreal x within r) /\ ~(2G x = &0)` + ASSUME_TAC); + (* Subgoal *) + (ASM_REWRITE_TAC[]); + CONJ_TAC; (* Break into 2 subgoals *) + + (EXPAND_TAC "f1" THEN REAL_DIFF_TAC THEN REAL_ARITH_TAC); + (EXPAND_TAC "2G"); + (MATCH_MP_TAC (MESON[REAL_ENTIRE] + `~ (x = &0) /\ ~ (y = &0) ==> ~ (x * y = &0)`)); + (REWRITE_TAC[REAL_ARITH `~(&2 = &0)`]); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~ (a = &0)`)); + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + + UP_ASM_TAC; + (MP_TAC HAS_REAL_DERIVATIVE_DIV_WITHIN); + (MESON_TAC[]); + +(* --------------------------------------------------------------------------*) +(* Derivative of atn ((&1 - x / &2) * C) / *) +(* (&2 * sqrt ((((&4 - x) * x) * C) / &4)) *) +(* --------------------------------------------------------------------------*) + + (SUBGOAL_THEN + `(F1 has_real_derivative + ((-- &1 / &2 * C) * 2G x - f1 x * &2 * G') / 2G x pow 2 * + inv (&1 + F12 x pow 2)) + (atreal x within r)` + ASSUME_TAC); + + (SUBGOAL_THEN `F1 = (\x:real. atn (F12 x))` ASSUME_TAC); + (* Subgoal *) + (EXPAND_TAC "F1" THEN EXPAND_TAC "F12"); + (REWRITE_TAC[]); + + (ONCE_ASM_REWRITE_TAC[]); + DEL_TAC; + (ABBREV_TAC `g' = (\x. inv (&1 + x pow 2))`); + (ABBREV_TAC `f' = + ((-- &1 / &2 * C) * 2G (x:real) - f1 x * &2 * G') / 2G x pow 2`); + + (SUBGOAL_THEN + `inv (&1 + F12 x pow 2) = g' ((F12:real-> real) x)` + ASSUME_TAC); + (* Subgoal *) + (EXPAND_TAC "F12" THEN EXPAND_TAC "g'"); + (REWRITE_TAC[]); + + (ONCE_ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `!x. (:real) x ==> (atn has_real_derivative (g':real->real) x) (atreal x)` + ASSUME_TAC); + (* Subgoal *) + (EXPAND_TAC "g'"); + (REWRITE_TAC[EQ_UNIV; HAS_REAL_DERIVATIVE_ATN]); + + + (SUBGOAL_THEN + `(F12 has_real_derivative f') (atreal x within r) /\ + (:real) (F12 x)` ASSUME_TAC); + (* Subgoal *) + (ASM_REWRITE_TAC[]); + (MESON_TAC[EQ_UNIV;IN_UNIV; IN]); + + (REPLICATE_TAC 2 UP_ASM_TAC); + (MP_TAC HAS_REAL_DERIVATIVE_CHAIN2); + (MESON_TAC[]); + +(* --------------------------------------------------------------------------*) +(* *) +(* *) +(* --------------------------------------------------------------------------*) + + (ABBREV_TAC `X = (&4 - x) * x`); + (SUBGOAL_THEN `~(X = &0)` ASSUME_TAC); + STRIP_TAC; + (SUBGOAL_THEN `D' = &0` ASSUME_TAC); + (EXPAND_TAC "D'"); + (REWRITE_TAC[REAL_ARITH `(a * x)/ &4 = a * (x / &4)`]); + (ONCE_ASM_REWRITE_TAC[]); + REAL_ARITH_TAC; + (MP_TAC (ASSUME `&0 < D'`)); + (FIRST_ASSUM MP_TAC THEN REAL_ARITH_TAC); + + (SUBGOAL_THEN `~(&4 - x = &0) /\ ~(x = &0)` ASSUME_TAC); + (UP_ASM_TAC THEN EXPAND_TAC "X"); + (REWRITE_TAC[REAL_ENTIRE]); + (MESON_TAC[]); + + (SUBGOAL_THEN + `inv (&1 + F12 (x:real) pow 2) = X / (X + C - X * C / &4)` + ASSUME_TAC); + (ONCE_REWRITE_TAC[GSYM REAL_INV_DIV]); + AP_TERM_TAC; + (REWRITE_TAC[REAL_ARITH `(a + b)/ c = a / c + b / c`]); + + (SUBGOAL_THEN `X / X = &1` ASSUME_TAC); + (ASM_SIMP_TAC[REAL_DIV_REFL]); + + (ONCE_ASM_REWRITE_TAC[]); + (AP_TERM_TAC); + (EXPAND_TAC "F12"); + (REWRITE_TAC[REAL_POW_DIV]); + (REWRITE_TAC[REAL_POW_2]); + (REWRITE_TAC[REAL_ARITH `(&2 * a) * &2 * a = &4 * a pow 2`]); + (ONCE_ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `sqrt ((X * C) / &4) pow 2 = (X * C) / &4` ASSUME_TAC); + (MATCH_MP_TAC SQRT_POW_2); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> &0 <= x`)); + (ASM_REWRITE_TAC[]); + + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `&4 * (X * C) / & 4 = X * C`]); + (REWRITE_TAC[REAL_ARITH + `((&1 - x / &2) * C) * (&1 - x / &2) * C = + ((&1 - ((&4 - x) * x) / &4) * C) * C`]); + (ONCE_ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `~(C = &0)` ASSUME_TAC); + STRIP_TAC; + (SUBGOAL_THEN `D' = &0` ASSUME_TAC); + (EXPAND_TAC "D'"); + (REWRITE_TAC[REAL_ARITH `(a * x)/ &4 = (a / &4) * x`]); + (ONCE_ASM_REWRITE_TAC[]); + REAL_ARITH_TAC; + (MP_TAC (ASSUME `&0 < D'`)); + (FIRST_ASSUM MP_TAC THEN REAL_ARITH_TAC); + + (SUBGOAL_THEN + `(((&1 - X / &4) * C) * C) / (X * C) = ((&1 - X / &4) * C) / X` + ASSUME_TAC); + (ONCE_REWRITE_TAC[REAL_ARITH `((a * b) * c) / d = (a * b) * c / d`]); + (MATCH_MP_TAC REDUCE_WITH_DIV_Euler_lemma); + (ASM_REWRITE_TAC[]); + + (ONCE_ASM_REWRITE_TAC[]); + (AP_THM_TAC THEN AP_TERM_TAC); + REAL_ARITH_TAC; + +(* --------------------------------------------------------------------------*) +(* *) +(* *) +(* --------------------------------------------------------------------------*) + +(SUBGOAL_THEN `&2 * sqrt ((X * C) / &4) = sqrt (X * C)` ASSUME_TAC); +(MATCH_MP_TAC (REAL_ARITH + `(&2 * sqrt x = sqrt (&4) * sqrt x) /\ (sqrt (&4) * sqrt x = y) + ==> &2 * sqrt x = y`)); +(ASM_REWRITE_TAC[]); + CONJ_TAC; + + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_TAC[REAL_ARITH `&4 = &2 * &2`]); + (SIMP_TAC[REAL_ARITH `&0 <= &2`; SQRT_MUL]); + (SIMP_TAC[GSYM REAL_POW_2; GSYM SQRT_POW_2; REAL_ARITH `&0 <= &2`]); + + (PURE_ONCE_REWRITE_TAC[REAL_ARITH `X * C = &4 * (X * C) / &4`]); + (ASM_REWRITE_TAC[]); + (PURE_ONCE_REWRITE_TAC[REAL_ARITH `&4 * (a * b) / &4 = a * b`]); + (MATCH_MP_TAC (GSYM SQRT_MUL)); + (REWRITE_TAC[REAL_ARITH `&0 <= &4`]); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`)); + (ASM_REWRITE_TAC[]); + +(* --------------------------------------------------------------------------*) +(* *) +(* --------------------------------------------------------------------------*) + + (SUBGOAL_THEN `2G (x:real) = sqrt (X * C)` ASSUME_TAC); + (EXPAND_TAC "2G"); + (ONCE_ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `G' = ((&4 - &2 * x) * C) / &4 * inv (sqrt (X * C))` ASSUME_TAC); + (EXPAND_TAC "G'"); + (REPEAT AP_TERM_TAC); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `&0 < X * C` ASSUME_TAC); + (EXPAND_TAC "X" THEN ASM_MESON_TAC[]); + + (SUBGOAL_THEN + `(-- &1 / &2 * C) * 2G (x:real) - f1 x * &2 * G' = + -- &2 * C * C / sqrt (X * C)` ASSUME_TAC); + (ONCE_ASM_REWRITE_TAC[]); + (EXPAND_TAC "f1"); + (ONCE_REWRITE_TAC[REAL_ARITH + `a * &2 * b / &4 * c = (a * &2 * b / &4) * c`]); + (ONCE_REWRITE_TAC[REAL_ARITH + `((&1 - x / &2) * C) * &2 * ((&4 - &2 * x) * C) / &4 = + (&4 - (&4 - x) * x) * C * C / &2`]); + (ONCE_ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `(-- &1 / &2 * C) * sqrt (X * C) = (-- &1 / &2 * C * X * C) / sqrt (X * C)` + ASSUME_TAC); + (REWRITE_TAC[REAL_ARITH + `(-- &1 / &2 * C * X * C) / Y = (-- &1 / &2 * C) * (X * C) / Y `]); + AP_TERM_TAC; + + + (SUBGOAL_THEN + `sqrt (X * C) * sqrt (X * C) = (X * C) ==> + sqrt (X * C) = (X * C) / sqrt (X * C)` ASSUME_TAC); + (MATCH_MP_TAC (MESON[] `(a <=> b) ==> (a ==> b)`)); + (MATCH_MP_TAC (GSYM REAL_EQ_RDIV_EQ)); + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + + (FIRST_X_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[GSYM REAL_POW_2]); + (MATCH_MP_TAC SQRT_POW_2); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`)); + (ASM_REWRITE_TAC[]); + + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `-- a * b * c / x = -- (a * b * c) / x`]); + (REWRITE_TAC[REAL_ARITH `a / x - y = -- b / x <=> (a + b) / x = y`]); + (REWRITE_TAC[REAL_ARITH + `-- &1 / &2 * C * X * C + &2 * C * C = (&4 - X) * C * C / &2`]); + (ABBREV_TAC `m = (&4 - X) * C * C / &2`); + (ABBREV_TAC `n = sqrt (X * C)`); + + (SUBGOAL_THEN `m = (m * inv n) * n ==> m / n = m * inv n` ASSUME_TAC); + (MATCH_MP_TAC (MESON[] `(a <=> b) ==> (a ==> b)`)); + (MATCH_MP_TAC (GSYM REAL_EQ_LDIV_EQ)); + (EXPAND_TAC "n"); + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + + (FIRST_X_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[REAL_ARITH `(m * inv n) * n = m * (inv n * n)`]); + (MATCH_MP_TAC (MESON[REAL_MUL_RID] + `inv n * n = &1 ==> m = m * inv n * n`)); + (MATCH_MP_TAC REAL_MUL_LINV); + (MATCH_MP_TAC (REAL_ARITH `&0 < n ==> ~ (n = &0)`)); + (EXPAND_TAC "n"); + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + +(* --------------------------------------------------------------------------*) +(* *) +(* *) +(* --------------------------------------------------------------------------*) + +(SUBGOAL_THEN + `(F1 has_real_derivative -- &2 * C / (X + C - X * C / &4) / sqrt (X * C)) + (atreal x within r)` + ASSUME_TAC); + + (SUBGOAL_THEN `2G (x:real) pow 2 = X * C` ASSUME_TAC); + (MATCH_MP_TAC (REAL_ARITH + `2G (x:real) pow 2 = &4 * D' /\ &4 * D' = X * C ==> + 2G (x:real) pow 2 = X * C`)); + (ASM_REWRITE_TAC[REAL_ARITH `(&4 * z = x * y) <=> ((x * y) / &4 = z)`]); + (EXPAND_TAC "D'"); + (REWRITE_TAC[REAL_ARITH `&4 * (X * C) / &4 = X * C`]); + (MATCH_MP_TAC SQRT_POW_2); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> &0 <= x`)); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `((-- &1 / &2 * C) * 2G (x:real) - f1 x * &2 * G') / 2G x pow 2 * + inv (&1 + F12 x pow 2) = + -- &2 * C / (X + C - X * C / &4) / sqrt (X * C)` + ASSUME_TAC); + (ASM_REWRITE_TAC[]); + (ABBREV_TAC `m = X + C - X * C / &4`); + (REWRITE_TAC[REAL_ARITH `-- &2 * C / m / n = (-- &2 * C) / m / n`]); + (REWRITE_TAC[REAL_ARITH + `(-- a * b * c / d) / e * f / g = (-- a * b * c * f) / e / g / d`]); + (REPEAT (AP_THM_TAC THEN AP_TERM_TAC)); + (REWRITE_TAC[REAL_ARITH + `(-- a * b * c * d) / e = (-- a * b) * (d * c) / e`]); + (MATCH_MP_TAC (MESON[REAL_MUL_RID] `x = &1 ==> (y * x = y)`)); + (MATCH_MP_TAC REAL_DIV_REFL); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> ~(x = &0)`)); + (ASM_REWRITE_TAC[]); + +(ASM_MESON_TAC[]); + +(UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC THEN REPLICATE_TAC 4 DEL_TAC); +(REPLICATE_TAC 3 UP_ASM_TAC THEN REPLICATE_TAC 4 DEL_TAC); +(REPEAT DISCH_TAC); + +(* --------------------------------------------------------------------------*) +(* *) +(* *) +(* --------------------------------------------------------------------------*) + +(ABBREV_TAC `f2 = (\x. (&1 - c / &2) * (&4 - x) * x)`); +(ABBREV_TAC + `F22 = (\x. ((&1 - c / &2) * (&4 - x) * x) / + (&2 * sqrt ((((&4 - x) * x) * C) / &4)))`); + + (SUBGOAL_THEN + `(F22 has_real_derivative + (((&1 - c / &2) * (&4 - &2 * x)) * 2G x - f2 x * &2 * G') / 2G x pow 2) + (atreal x within r)` + ASSUME_TAC); + + (SUBGOAL_THEN `F22 = (\x:real. f2 x / 2G x)` ASSUME_TAC); + (* Subgoal *) + (EXPAND_TAC "F22" THEN EXPAND_TAC "2G" THEN EXPAND_TAC "f2"); + (REWRITE_TAC[]); + + (ONCE_ASM_REWRITE_TAC[] THEN DEL_TAC); + + (SUBGOAL_THEN + `(f2 has_real_derivative (&1 - c / &2) * (&4 - &2 * x)) + (atreal x within r) /\ + (2G has_real_derivative &2 * G') (atreal x within r) /\ ~(2G x = &0)` + ASSUME_TAC); + (* Subgoal *) + (ASM_REWRITE_TAC[]); + CONJ_TAC; (* Break into 2 subgoals *) + + (EXPAND_TAC "f2" THEN REAL_DIFF_TAC THEN REAL_ARITH_TAC); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~ (a = &0)`)); + (EXPAND_TAC "2G"); + (MATCH_MP_TAC (REAL_ARITH `&0 < &2 /\ &0 < x ==> &0 < &2 * x`)); + (REWRITE_TAC[REAL_ARITH `&0 < &2`]); + (MATCH_MP_TAC SQRT_POS_LT); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> &0 < x / &4`)); + (ASM_REWRITE_TAC[]); + + UP_ASM_TAC; + (MP_TAC HAS_REAL_DERIVATIVE_DIV_WITHIN); + (MESON_TAC[]); + + +(* --------------------------------------------------------------------------*) +(* Derivative of atn ((&1 - c / &2) * (&4 - x) * x) / *) +(* (&2 * sqrt ((((&4 - x) * x) * C) / &4)) *) +(* --------------------------------------------------------------------------*) + + (SUBGOAL_THEN + `(F2 has_real_derivative + (((&1 - c / &2) * (&4 - &2 * x)) * 2G x - f2 x * &2 * G') / 2G x pow 2 * + inv (&1 + F22 x pow 2)) + (atreal x within r)` + ASSUME_TAC); + + (SUBGOAL_THEN `F2 = (\x:real. atn (F22 x))` ASSUME_TAC); + (* Subgoal *) + (EXPAND_TAC "F2" THEN EXPAND_TAC "F22"); + (REWRITE_TAC[]); + + (ONCE_ASM_REWRITE_TAC[]); + DEL_TAC; + (ABBREV_TAC `g' = (\x. inv (&1 + x pow 2))`); + (ABBREV_TAC `f' = + (((&1 - c / &2) * (&4 - &2 * x)) * 2G x - f2 x * &2 * G') / 2G x pow 2`); + + (SUBGOAL_THEN + `inv (&1 + F22 x pow 2) = g' ((F22:real-> real) x)` + ASSUME_TAC); + (* Subgoal *) + (EXPAND_TAC "F22" THEN EXPAND_TAC "g'"); + (MESON_TAC[]); + + (ONCE_ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `!x. (:real) x ==> (atn has_real_derivative (g':real->real) x) (atreal x)` + ASSUME_TAC); + (* Subgoal *) + (EXPAND_TAC "g'"); + (REWRITE_TAC[EQ_UNIV; HAS_REAL_DERIVATIVE_ATN]); + + + (SUBGOAL_THEN + `(F22 has_real_derivative f') (atreal x within r) /\ + (:real) (F22 x)` ASSUME_TAC); + (* Subgoal *) + (ASM_REWRITE_TAC[]); + (MESON_TAC[EQ_UNIV;IN_UNIV; IN]); + + (REPLICATE_TAC 2 UP_ASM_TAC); + (MP_TAC HAS_REAL_DERIVATIVE_CHAIN2); + (MESON_TAC[]); + +(* --------------------------------------------------------------------------*) +(* *) +(* *) +(* --------------------------------------------------------------------------*) + + (SUBGOAL_THEN + `inv (&1 + F22 (x:real) pow 2) = C / (X + C - X * C / &4)` + ASSUME_TAC); + (ONCE_REWRITE_TAC[GSYM REAL_INV_DIV]); + AP_TERM_TAC; + (REWRITE_TAC[REAL_ARITH `(a + b - d)/ c = b / c + (a - d) / c`]); + + (SUBGOAL_THEN `C / C = &1` ASSUME_TAC); + (MATCH_MP_TAC REAL_DIV_REFL); + (EXPAND_TAC "C"); + (REWRITE_TAC[REAL_ENTIRE; MESON[] `~ (a \/ b) <=> ~a /\ ~b`]); + (ASM_REWRITE_TAC[REAL_ARITH `~ (&4 - x = &0) <=> ~(x = &4)`]); + + (ONCE_ASM_REWRITE_TAC[]); + (AP_TERM_TAC); + (EXPAND_TAC "F22"); + (REWRITE_TAC[REAL_POW_DIV]); + (REWRITE_TAC[REAL_POW_2]); + (REWRITE_TAC[REAL_ARITH `(x * a) * x * a = x pow 2 * a pow 2`]); + (ONCE_ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `sqrt ((X * C) / &4) pow 2 = (X * C) / &4` ASSUME_TAC); + (MATCH_MP_TAC SQRT_POW_2); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> &0 <= x`)); + (ASM_REWRITE_TAC[]); + + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `&2 pow 2 * (X * C) / & 4 = X * C`]); + + (SUBGOAL_THEN + `((&1 - c / &2) pow 2 * X pow 2) / (X * C) = + ((&1 - C / &4) * X) * X / (C * X)` ASSUME_TAC); + (EXPAND_TAC "C"); + (REWRITE_TAC[REAL_ARITH + `(&1 - c / &2) pow 2 = &1 - ((&4 - c) * c) / &4`]); + (REWRITE_TAC[REAL_ARITH `a * b pow 2 = (a * b) * b`]); + (ONCE_REWRITE_TAC[REAL_ARITH `((a * d) * b) / c = (a * d) * (b / c)`]); + (REPEAT AP_TERM_TAC); + (REWRITE_TAC[REAL_MUL_SYM]); + + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `(a - a * b) / c = ((&1 - b) * a) / c`]); + (MATCH_MP_TAC REDUCE_WITH_DIV_Euler_lemma); + (ASM_REWRITE_TAC[]); + (EXPAND_TAC "C"); + (REWRITE_TAC[REAL_ENTIRE; MESON[] `~ (a \/ b) <=> ~a /\ ~b`]); + (ASM_REWRITE_TAC[REAL_ARITH `~ (&4 - x = &0) <=> ~(x = &4)`]); + +(* --------------------------------------------------------------------------*) +(* *) +(* *) +(* --------------------------------------------------------------------------*) + +(SUBGOAL_THEN `&2 * sqrt ((X * C) / &4) = sqrt (X * C)` ASSUME_TAC); +(MATCH_MP_TAC (REAL_ARITH + `(&2 * sqrt x = sqrt (&4) * sqrt x) /\ (sqrt (&4) * sqrt x = y) + ==> &2 * sqrt x = y`)); +(ASM_REWRITE_TAC[]); + CONJ_TAC; + + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_TAC[REAL_ARITH `&4 = &2 * &2`]); + (SIMP_TAC[REAL_ARITH `&0 <= &2`; SQRT_MUL]); + (SIMP_TAC[GSYM REAL_POW_2; GSYM SQRT_POW_2; REAL_ARITH `&0 <= &2`]); + + (PURE_ONCE_REWRITE_TAC[REAL_ARITH `X * C = &4 * (X * C) / &4`]); + (ASM_REWRITE_TAC[]); + (PURE_ONCE_REWRITE_TAC[REAL_ARITH `&4 * (a * b) / &4 = a * b`]); + (MATCH_MP_TAC (GSYM SQRT_MUL)); + (REWRITE_TAC[REAL_ARITH `&0 <= &4`]); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`)); + (ASM_REWRITE_TAC[]); + +(* --------------------------------------------------------------------------*) +(* *) +(* --------------------------------------------------------------------------*) + + (SUBGOAL_THEN `2G (x:real) = sqrt (X * C)` ASSUME_TAC); + (EXPAND_TAC "2G"); + (ONCE_ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `G' = ((&4 - &2 * x) * C) / &4 * inv (sqrt (X * C))` ASSUME_TAC); + (EXPAND_TAC "G'"); + (REPEAT AP_TERM_TAC); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `((&1 - c / &2) * (&4 - &2 * x)) * 2G x - f2 x * &2 * G' = + ((&1 - c / &2) * (&4 - &2 * x)) * (X * C) / &2 / sqrt (X * C)` + ASSUME_TAC); + + (ONCE_ASM_REWRITE_TAC[]); + (EXPAND_TAC "f2"); + (ONCE_REWRITE_TAC[REAL_ARITH + `(a * b) * &2 * (c * d) / &4 * e = (a * c) * (b * d * e) / &2`]); + (ABBREV_TAC `m = (&1 - c / &2) * (&4 - &2 * x)`); + (ONCE_REWRITE_TAC[REAL_ARITH `m * x - m * y = m * (x - y)`]); + AP_TERM_TAC; + (ONCE_ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `sqrt (X * C) = (X * C) / sqrt (X * C)` ASSUME_TAC); + (SUBGOAL_THEN + `sqrt (X * C) * sqrt (X * C) = (X * C) ==> + sqrt (X * C) = (X * C) / sqrt (X * C)` ASSUME_TAC); + (MATCH_MP_TAC (MESON[] `(a <=> b) ==> (a ==> b)`)); + (MATCH_MP_TAC (GSYM REAL_EQ_RDIV_EQ)); + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + + (FIRST_X_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[GSYM REAL_POW_2]); + (MATCH_MP_TAC SQRT_POW_2); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> &0 <= a`)); + (ASM_REWRITE_TAC[]); + + (ABBREV_TAC `n = (X * C) / &2 / sqrt (X * C)`); + (ABBREV_TAC `n' = inv (sqrt (X * C))`); + (PURE_ONCE_ASM_REWRITE_TAC[]); + (EXPAND_TAC "n" THEN EXPAND_TAC "n'"); + (REWRITE_TAC[REAL_ARITH `a / x - y = a / &2 / x <=> a / & 2 / x = y`]); + (REWRITE_TAC[REAL_ARITH `(a * b * c) / x = (a * b) / x * c`]); + (ABBREV_TAC `t = (X * C) / &2`); + (ABBREV_TAC `r' = sqrt (X * C)`); + + (SUBGOAL_THEN `t = (t * inv r') * r' ==> t / r' = t * inv r'` + ASSUME_TAC); + (MATCH_MP_TAC (MESON[] `(a <=> b) ==> (a ==> b)`)); + (MATCH_MP_TAC (GSYM REAL_EQ_LDIV_EQ)); + (EXPAND_TAC "r'"); + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + + (FIRST_X_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[REAL_ARITH `(m * inv n) * n = m * (inv n * n)`]); + (MATCH_MP_TAC (MESON[REAL_MUL_RID] + `inv r' * r' = &1 ==> m = m * inv r' * r'`)); + (MATCH_MP_TAC REAL_MUL_LINV); + (MATCH_MP_TAC (REAL_ARITH `&0 < n ==> ~ (n = &0)`)); + (EXPAND_TAC "r'"); + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + + +(* --------------------------------------------------------------------------*) +(* *) +(* *) +(* --------------------------------------------------------------------------*) + +(SUBGOAL_THEN + `(F2 has_real_derivative + ((&2 - c) * (&2 - x)) * C / &2 / (X + C - X * C / &4) / sqrt (X * C)) + (atreal x within r)` + ASSUME_TAC); + + (SUBGOAL_THEN `2G (x:real) pow 2 = X * C` ASSUME_TAC); + (MATCH_MP_TAC (REAL_ARITH + `2G (x:real) pow 2 = &4 * D' /\ &4 * D' = X * C ==> + 2G (x:real) pow 2 = X * C`)); + (ASM_REWRITE_TAC[REAL_ARITH `(&4 * z = x * y) <=> ((x * y) / &4 = z)`]); + (EXPAND_TAC "D'"); + (REWRITE_TAC[REAL_ARITH `&4 * (X * C) / &4 = X * C`]); + (MATCH_MP_TAC SQRT_POW_2); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> &0 <= x`)); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `(((&1 - c / &2) * (&4 - &2 * x)) * 2G x - f2 x * &2 * G') / 2G x pow 2 * + inv (&1 + F22 x pow 2) = + ((&2 - c) * (&2 - x)) * C / &2 / (X + C - X * C / &4) / sqrt (X * C)` + ASSUME_TAC); + (ASM_REWRITE_TAC[]); + (ABBREV_TAC `m = X + C - X * C / &4`); + (REWRITE_TAC[REAL_ARITH + `(a * b / c / d) / e * f / g = (a * f * (b / e)) / c / g / d`]); + (REWRITE_TAC[REAL_ARITH + `(a * b / c / d / e)= (a * b) / c / d / e`]); + + (REPEAT(AP_THM_TAC THEN AP_TERM_TAC)); + (REWRITE_TAC[REAL_ARITH + `((&1 - c / &2) * (&4 - &2 * x)) = ((&2 - c) * (&2 - x))`]); + AP_TERM_TAC; + (MATCH_MP_TAC (MESON[REAL_MUL_RID] `x = &1 ==> (y * x = y)`)); + (MATCH_MP_TAC REAL_DIV_REFL); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> ~(x = &0)`)); + (ASM_REWRITE_TAC[]); + +(ASM_MESON_TAC[]); +(UP_ASM_TAC THEN REPLICATE_TAC 9 DEL_TAC); +(REPEAT DISCH_TAC); + +(* Begin Diff 3 *) + +(ABBREV_TAC `f3 = (\x. (&8 + (x * c) / &2 - &2 * x - &2 * c))`); +(ABBREV_TAC + `F32 = (\x.(&8 + (x * c) / &2 - &2 * x - &2 * c) / + sqrt ((((&4 - x) * x) * C) / &4))`); + + (SUBGOAL_THEN + `(F32 has_real_derivative + ((c / &2 - &2) * G x - f3 x * G') / G x pow 2) (atreal x within r)` + ASSUME_TAC); + + (SUBGOAL_THEN `F32 = (\x:real. f3 x / G x)` ASSUME_TAC); + (* Subgoal *) + (EXPAND_TAC "F32" THEN EXPAND_TAC "G" THEN EXPAND_TAC "f3"); + (REWRITE_TAC[]); + + (ONCE_ASM_REWRITE_TAC[] THEN DEL_TAC); + + (SUBGOAL_THEN + `(f3 has_real_derivative (c / &2 - &2)) + (atreal x within r) /\ + (G has_real_derivative G') (atreal x within r) /\ ~(G x = &0)` + ASSUME_TAC); + (* Subgoal *) + (ASM_REWRITE_TAC[]); + CONJ_TAC; (* Break into 2 subgoals *) + + (EXPAND_TAC "f3" THEN REAL_DIFF_TAC THEN REAL_ARITH_TAC); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~ (a = &0)`)); + (EXPAND_TAC "G"); + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + + UP_ASM_TAC; + (MP_TAC HAS_REAL_DERIVATIVE_DIV_WITHIN); + (MESON_TAC[]); + + +(* --------------------------------------------------------------------------*) +(* Derivative of atn (....) *) +(* --------------------------------------------------------------------------*) + + (SUBGOAL_THEN + `(F3 has_real_derivative + ((c / &2 - &2) * G x - f3 x * G') / G x pow 2 * inv (&1 + F32 x pow 2)) + (atreal x within r)` + ASSUME_TAC); + + (SUBGOAL_THEN `F3 = (\x:real. atn (F32 x))` ASSUME_TAC); + (* Subgoal *) + (EXPAND_TAC "F3" THEN EXPAND_TAC "F32"); + (REWRITE_TAC[]); + + (ONCE_ASM_REWRITE_TAC[]); + DEL_TAC; + (ABBREV_TAC `g' = (\x. inv (&1 + x pow 2))`); + (ABBREV_TAC `f' = ((c / &2 - &2) * G (x:real) - f3 x * G') / G x pow 2`); + + (SUBGOAL_THEN + `inv (&1 + F32 x pow 2) = g' ((F32:real-> real) x)` + ASSUME_TAC); + (* Subgoal *) + (EXPAND_TAC "F32" THEN EXPAND_TAC "g'"); + (MESON_TAC[]); + + (ONCE_ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `!x. (:real) x ==> (atn has_real_derivative (g':real->real) x) (atreal x)` + ASSUME_TAC); + (* Subgoal *) + (EXPAND_TAC "g'"); + (REWRITE_TAC[EQ_UNIV; HAS_REAL_DERIVATIVE_ATN]); + + (SUBGOAL_THEN + `(F32 has_real_derivative f') (atreal x within r) /\ + (:real) (F32 x)` ASSUME_TAC); + (* Subgoal *) + (ASM_REWRITE_TAC[]); + (MESON_TAC[EQ_UNIV;IN_UNIV; IN]); + + (REPLICATE_TAC 2 UP_ASM_TAC); + (MP_TAC HAS_REAL_DERIVATIVE_CHAIN2); + (MESON_TAC[]); + +(* --------------------------------------------------------------------------*) +(* *) +(* *) +(* --------------------------------------------------------------------------*) + + (SUBGOAL_THEN + `inv (&1 + F32 (x:real) pow 2) = (x * c) / (x * c + (&4 - x) * (&4 - c))` + ASSUME_TAC); + (ONCE_REWRITE_TAC[GSYM REAL_INV_DIV]); + AP_TERM_TAC; + (REWRITE_TAC[REAL_ARITH `(a + b) / c = a / c + b / c`]); + + (SUBGOAL_THEN `(x * c) / (x * c) = &1` ASSUME_TAC); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; MESON[] `~ (a \/ b) <=> ~a /\ ~b`]); + (ASM_REWRITE_TAC[]); + + (ONCE_ASM_REWRITE_TAC[]); + (AP_TERM_TAC); + (EXPAND_TAC "F32"); + (REWRITE_TAC[REAL_POW_DIV]); + (ONCE_ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `sqrt ((X * C) / &4) pow 2 = (X * C) / &4` ASSUME_TAC); + (MATCH_MP_TAC SQRT_POW_2); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> &0 <= x`)); + (ASM_REWRITE_TAC[]); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `(x * a) * x * a = x pow 2 * a pow 2`]); + (REWRITE_TAC[REAL_ARITH + `&8 + (x * c) / &2 - &2 * x - &2 * c = ((&4 - x) * (&4 - c)) / &2`]); + (REWRITE_TAC[REAL_POW_DIV]); + (REWRITE_TAC[REAL_ARITH `&2 pow 2 = &4`]); + (ABBREV_TAC `m = ((&4 - x) * (&4 - c)) pow 2 / &4`); + (ABBREV_TAC `n = ((X * C) / &4)`); + (ABBREV_TAC `p = ((&4 - x) * (&4 - c)) / (x * c)`); + + (SUBGOAL_THEN `m = p * n ==> (m / n = p)` ASSUME_TAC); + (MATCH_MP_TAC (MESON[] `(b <=> a) ==> (a ==> b)`)); + (MATCH_MP_TAC REAL_EQ_LDIV_EQ); + (EXPAND_TAC "n"); + (ASM_REWRITE_TAC[]); + + (FIRST_X_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "m" THEN EXPAND_TAC "n" THEN EXPAND_TAC "p"); + (REWRITE_TAC[REAL_ARITH `(a / x) * (b / y) = (a * b) / x / y`]); + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_TAC[REAL_ARITH `(a * b * c) / x = a * (b * c) / x`]); + (REWRITE_TAC[REAL_POW_2]); + AP_TERM_TAC; + (EXPAND_TAC "X" THEN EXPAND_TAC "C"); + (REWRITE_TAC[REAL_ARITH `((a * b) * c * d) / e = (a * c) * (b * d) / e`]); + (MATCH_MP_TAC (MESON[REAL_MUL_RID] `y = &1 ==> x = x * y`)); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; MESON[] `~ (a \/ b) <=> ~a /\ ~b`]); + (ASM_REWRITE_TAC[]); + +(* --------------------------------------------------------------------------*) +(* *) +(* *) +(* --------------------------------------------------------------------------*) + + + (SUBGOAL_THEN `G (x:real) = sqrt ((X * C) / &4)` ASSUME_TAC); + (EXPAND_TAC "G"); + (ONCE_ASM_REWRITE_TAC[]); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `G' = ((&4 - &2 * x) * C) / &4 * inv (sqrt (X * C))` ASSUME_TAC); + (EXPAND_TAC "G'"); + (REPEAT AP_TERM_TAC); + (MATCH_MP_TAC (REAL_ARITH + `(&2 * sqrt x = sqrt (&4) * sqrt x) /\ (sqrt (&4) * sqrt x = y) + ==> &2 * sqrt x = y`)); + (ASM_REWRITE_TAC[]); + CONJ_TAC; + + (AP_THM_TAC THEN AP_TERM_TAC); + (REWRITE_TAC[REAL_ARITH `&4 = &2 * &2`]); + (SIMP_TAC[REAL_ARITH `&0 <= &2`; SQRT_MUL]); + (SIMP_TAC[GSYM REAL_POW_2; GSYM SQRT_POW_2; REAL_ARITH `&0 <= &2`]); + + (PURE_ONCE_REWRITE_TAC[REAL_ARITH `X * C = &4 * (X * C) / &4`]); + (ASM_REWRITE_TAC[]); + (PURE_ONCE_REWRITE_TAC[REAL_ARITH `&4 * (a * b) / &4 = a * b`]); + (MATCH_MP_TAC (GSYM SQRT_MUL)); + (REWRITE_TAC[REAL_ARITH `&0 <= &4`]); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> &0 <= x`)); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `(c / &2 - &2) * G x - f3 x * G' = + (--C * ((&4 - x) * (&4 - c))) / &2 / sqrt (X * C)` ASSUME_TAC); + + (ONCE_ASM_REWRITE_TAC[]); + (EXPAND_TAC "f3"); + + (SUBGOAL_THEN `sqrt ((X * C) / &4) = sqrt (X * C) / &2` ASSUME_TAC); + (SUBGOAL_THEN `&2 = sqrt (&4) ` ASSUME_TAC); + (MATCH_MP_TAC (REAL_ARITH + `(&2) = sqrt (&2) * sqrt (&2) /\ sqrt (&2) * sqrt (&2) = sqrt (&4) ==> + &2 = sqrt (&4)`)); + CONJ_TAC; + (REWRITE_TAC[GSYM REAL_POW_2]); + (MATCH_MP_TAC (GSYM SQRT_POW_2)); + REAL_ARITH_TAC; + + (REWRITE_TAC[REAL_ARITH `&4 = &2 * &2`]); + (MESON_TAC[SQRT_MUL; REAL_ARITH `&0 <= &2`]); + (ONCE_ASM_REWRITE_TAC[]); + (EXPAND_TAC "D'"); + (MATCH_MP_TAC SQRT_DIV); + (REWRITE_TAC[REAL_ARITH `&0 <= &4`]); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> &0 <= x`)); + (ASM_REWRITE_TAC[]); + +(ONCE_ASM_REWRITE_TAC[]); +(REWRITE_TAC[REAL_ARITH + `(c / &2 - &2) * x / &2 = --(&4 - c) / &4 * x`]); +(REWRITE_TAC[REAL_ARITH + `(&8 + (x * c) / &2 - &2 * x - &2 * c) * s / &4 * r = + ((&4 - x) * (&4 - c)) * s / &8 * r`]); + + (SUBGOAL_THEN `--(&4 - c) / &4 * sqrt (X * C) = + (--(&4 - c) / &4 * (X * C)) / sqrt (X * C)` ASSUME_TAC); + + (REWRITE_TAC[REAL_ARITH + `(--(&4 - c) / &4 * X * C) / Y = (--(&4 - c) / &4) * (X * C) / Y `]); + AP_TERM_TAC; + + (SUBGOAL_THEN + `sqrt (X * C) * sqrt (X * C) = (X * C) ==> + sqrt (X * C) = (X * C) / sqrt (X * C)` ASSUME_TAC); + (MATCH_MP_TAC (MESON[] `(a <=> b) ==> (a ==> b)`)); + (MATCH_MP_TAC (GSYM REAL_EQ_RDIV_EQ)); + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + + (FIRST_X_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[GSYM REAL_POW_2]); + (MATCH_MP_TAC SQRT_POW_2); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> &0 <= x`)); + (ASM_REWRITE_TAC[]); + + (PURE_ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ARITH `a / x - y = b / x <=> (a - b) / x = y`]); + (EXPAND_TAC "X" THEN EXPAND_TAC "C"); + (REWRITE_TAC[REAL_ARITH + `((&4 - x) * (&4 - c)) * + ((&4 - &2 * x) * (&4 - c) * c) / &8 * N = (((&4 - x) * (&4 - c)) * + ((&4 - &2 * x) * (&4 - c) * c) / &8) * N `]); +(ABBREV_TAC + `m = ((&4 - x) * (&4 - c)) * ((&4 - &2 * x) * (&4 - c) * c) / &8`); +(ASM_REWRITE_TAC[]); +(ABBREV_TAC `n = sqrt (X * C)`); + + (SUBGOAL_THEN + `(--(&4 - c) / &4 * X * C - (--C * (&4 - x) * (&4 - c)) / &2) = m` + ASSUME_TAC); + (EXPAND_TAC "X" THEN EXPAND_TAC "C" THEN EXPAND_TAC "m"); + REAL_ARITH_TAC; + +(ONCE_ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `m = (m * inv n) * n ==> m / n = m * inv n` ASSUME_TAC); + (MATCH_MP_TAC (MESON[] `(a <=> b) ==> (a ==> b)`)); + (MATCH_MP_TAC (GSYM REAL_EQ_LDIV_EQ)); + (EXPAND_TAC "n"); + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + + (FIRST_X_ASSUM MATCH_MP_TAC); + (REWRITE_TAC[REAL_ARITH `(m * inv n) * n = m * (inv n * n)`]); + (MATCH_MP_TAC (MESON[REAL_MUL_RID] + `inv r' * r' = &1 ==> m = m * inv r' * r'`)); + (MATCH_MP_TAC REAL_MUL_LINV); + (MATCH_MP_TAC (REAL_ARITH `&0 < n ==> ~ (n = &0)`)); + (EXPAND_TAC "n"); + (MATCH_MP_TAC SQRT_POS_LT); + ASM_REAL_ARITH_TAC; + (ASM_REWRITE_TAC[]); + +(* --------------------------------------------------------------------------*) +(* *) +(* *) +(* --------------------------------------------------------------------------*) + + +(ABBREV_TAC `F12 = + (\x. ((&1 - x / &2) * C) / (&2 * sqrt ((((&4 - x) * x) * C) / &4)))`); + + (SUBGOAL_THEN `sqrt ((X * C) / &4) pow 2 = (X * C) / &4` ASSUME_TAC); + (MATCH_MP_TAC SQRT_POW_2); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> &0 <= x`)); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `X + C - X * C / &4 = (&1 + F12 (x:real) pow 2 ) * X` ASSUME_TAC); + + (EXPAND_TAC "X" THEN EXPAND_TAC "C" THEN EXPAND_TAC "F12"); + (ONCE_ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[REAL_POW_DIV]); + (ONCE_REWRITE_TAC[REAL_POW_2]); + (ONCE_REWRITE_TAC[REAL_ARITH `(&2 * a) * &2 * a = &4 * a pow 2`]); + (ONCE_ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[REAL_ARITH `&4 * x / &4 = x`]); + (ONCE_REWRITE_TAC[REAL_ARITH + `((&1 - x / &2) * C) * (&1 - x / &2) * C = + (&1 - ((&4 - x) * x) / &4) * C * C`]); + (ONCE_ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `&1 = (X * C) / (X * C)` ASSUME_TAC); + (REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC REAL_DIV_REFL); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> ~ (x = &0)`)); + (ASM_REWRITE_TAC[]); + + (ONCE_REWRITE_TAC[REAL_ARITH `(&1 - x) * y = y - x * y`]); + (ONCE_ASM_REWRITE_TAC[]); + (ONCE_REWRITE_TAC[REAL_ARITH `a / x + b / x = (a + b) / x`]); + (ONCE_REWRITE_TAC[REAL_ARITH + `X * C + C * C - X / &4 * C * C = (X + C - X * C / &4) * C`]); + (ONCE_REWRITE_TAC[REAL_ARITH `(a * b) / c * d = a * (d * b) / c`]); + (MATCH_MP_TAC (MESON[REAL_MUL_RID] `x = &1 ==> (a = a * x)`)); + (MATCH_MP_TAC REAL_DIV_REFL); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> ~ (x = &0)`)); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `~ (X + C - X * C / &4 = &0)` ASSUME_TAC); + (ONCE_ASM_REWRITE_TAC[]); + (REWRITE_TAC[REAL_ENTIRE; MESON[] `~(a \/ b) <=> ~ a /\ ~ b`]); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> ~ (x = &0)`)); + (MATCH_MP_TAC (REAL_ARITH `&0 <= x ==> &0 < &1 + x`)); + (REWRITE_TAC[REAL_LE_POW_2]); + + (UP_ASM_TAC THEN DEL_TAC THEN DEL_TAC THEN DEL_TAC THEN REPEAT DISCH_TAC); + +(* --------------------------------------------------------------------------*) +(* *) +(* *) +(* --------------------------------------------------------------------------*) + + +(SUBGOAL_THEN + `(F3 has_real_derivative + (-- &2 * C * (&2 * x + &2 * c - x * c)) / &8 / (X + C - X * C / &4) / + sqrt (X * C)) (atreal x within r)` + ASSUME_TAC); + + (SUBGOAL_THEN `G (x:real) pow 2 = (X * C) / &4` ASSUME_TAC); + (EXPAND_TAC "G"); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC SQRT_POW_2); + (MATCH_MP_TAC (REAL_ARITH `&0 < x ==> &0 <= x`)); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN + `((c / &2 - &2) * G x - f3 x * G') / G x pow 2 * inv (&1 + F32 x pow 2) = + (-- &2 * C * (&2 * x + &2 * c - x * c)) / &8 / (X + C - X * C / &4) / + sqrt (X * C)` ASSUME_TAC); + (ONCE_ASM_REWRITE_TAC[] THEN DEL_TAC); + (REWRITE_TAC[REAL_ARITH + `(a / b / c / d) * f / g = (a * f) / b / d / g / c `]); + (REPEAT(AP_THM_TAC THEN AP_TERM_TAC)); + + (ABBREV_TAC + `x1 = (x * c + (&4 - x) * (&4 - c))`); + (ABBREV_TAC + `x2 = &2 * x + &2 * c - x * c`); + + (SUBGOAL_THEN + `X + C - X * C / &4 = x1 * x2 / &8` ASSUME_TAC); + (EXPAND_TAC "X" THEN EXPAND_TAC "C" THEN EXPAND_TAC "x1" THEN EXPAND_TAC "x2"); + (REAL_ARITH_TAC); + +(ONCE_ASM_REWRITE_TAC[]); +(REWRITE_TAC[REAL_ARITH `(--x * a * b) * c * d = --x * (a * c) * (b * d)`]); +(ASM_REWRITE_TAC[]); + +(SUBGOAL_THEN `~ (x1 = &0) /\ ~ (x2 = &0)` ASSUME_TAC); +(REPEAT STRIP_TAC); + + (SUBGOAL_THEN `X + C - X * C / &4 = &0` ASSUME_TAC); + (MATCH_MP_TAC + (MESON[REAL_MUL_LZERO] `(x = x1 * x2 / &8) /\ (x1 = &0) ==> (x = &0)`)); + (ASM_REWRITE_TAC[]); + (MP_TAC (ASSUME `~(X + C - X * C / &4 = &0)`)); + (FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + + (SUBGOAL_THEN `X + C - X * C / &4 = &0` ASSUME_TAC); + (MATCH_MP_TAC + (MESON[REAL_MUL_RZERO; REAL_ARITH `&0 / x = &0`] + `(x = x1 * x2 / &8) /\ (x2 = &0) ==> (x = &0)`)); + (ASM_REWRITE_TAC[]); + (MP_TAC (ASSUME `~(X + C - X * C / &4 = &0)`)); + (FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC); + +(REWRITE_TAC[EQ_SYM_EQ]); +(REWRITE_TAC[REAL_ARITH `(-- &2 * C * x2) / &8 / (x1 * x2 / &8) = + (-- &2 * C) * (x2 / &8) / (x1 * x2 / &8)`]); +(SUBGOAL_THEN + `(-- &2 * C) * x2 / &8 / (x1 * x2 / &8) = (-- &2 * C) / x1 ` ASSUME_TAC); +(MATCH_MP_TAC REDUCE_WITH_DIV_Euler_lemma); +(ASM_REWRITE_TAC[]); +(MATCH_MP_TAC (REAL_ARITH `~(x = &0) ==> ~(x / &8 = &0)`)); +(ASM_REWRITE_TAC[]); +(ASM_REWRITE_TAC[]); +(EXPAND_TAC "D'"); +(AP_THM_TAC THEN AP_TERM_TAC); +(REWRITE_TAC[REAL_ARITH `x / &2 = (x * &2) / &4 `]); +(PURE_ONCE_REWRITE_TAC[REAL_ARITH `a / (b / &4) = a / (&1 * b / &4) `]); +(PURE_ONCE_REWRITE_TAC[REAL_ARITH `((--C * X * C) * &2) / &4 = + (-- &2 * C) * (X * C) / &4 `]); +(PURE_REWRITE_TAC[EQ_SYM_EQ]); +(PURE_REWRITE_TAC[REAL_ARITH `(a * b / c) / d = a * (b/ c/ d)`]); +(PURE_ONCE_REWRITE_TAC[REAL_ARITH `a = b <=> a = b / &1`]); +(MATCH_MP_TAC REDUCE_WITH_DIV_Euler_lemma); +(REWRITE_TAC[REAL_ARITH `~(&1 = &0)`]); +(MATCH_MP_TAC (REAL_ARITH `&0 < x ==> ~ (x / &4 = &0)`)); +(ASM_REWRITE_TAC[]); + +(ASM_MESON_TAC[]); +(UP_ASM_TAC THEN UP_ASM_TAC THEN REPLICATE_TAC 8 DEL_TAC THEN REPEAT DISCH_TAC); + + +(ABBREV_TAC `F1' = -- &2 * C / (X + C - X * C / &4) / sqrt (X * C)`); +(ABBREV_TAC `F2' = + ((&2 - c) * (&2 - x)) * C / &2 / (X + C - X * C / &4) / sqrt (X * C)`); + +(ABBREV_TAC `F3' = + (-- &2 * C * (&2 * x + &2 * c - x * c)) / &8 / + (X + C - X * C / &4) / sqrt (X * C)`); + + +(SUBGOAL_THEN `&0 - (F1' + F2') + &2 * F3' = &0` ASSUME_TAC); +(REWRITE_TAC[REAL_ARITH `&0 - (a + b) + c = &0 <=> a + b - c = &0`]); +(EXPAND_TAC "F1'" THEN EXPAND_TAC "F2'" THEN EXPAND_TAC "F3'"); +(ONCE_REWRITE_TAC[REAL_ARITH `--a / x + b / x - &2 * c / x = (--a + b - &2 * c) / x`]); + + +(ABBREV_TAC `m = sqrt (X * C)`); +(ABBREV_TAC `n = X + C - X * C / &4`); +(REWRITE_TAC[REAL_ARITH `-- &2 * x / a + y * z / a - &2 * t / a = +(-- &2 * x + y * z - &2 * t) / a `]); + +(SUBGOAL_THEN `(-- &2 * C + + ((&2 - c) * (&2 - x)) * C / &2 - + &2 * (-- &2 * C * (&2 * x + &2 * c - x * c)) / &8) = &0 ` ASSUME_TAC); +(EXPAND_TAC "C"); + REAL_ARITH_TAC; +(ASM_REWRITE_TAC[]); + +(SUBGOAL_THEN `&0 / n = &0 ` ASSUME_TAC); +(MATCH_MP_TAC (REAL_ARITH `~(x = &0) ==> &0 / x = &0`)); +(ASM_REWRITE_TAC[]); + +(ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (REAL_ARITH `~(x = &0) ==> &0 / x = &0`)); + (EXPAND_TAC "m"); + (MATCH_MP_TAC (REAL_ARITH `&0 < a ==> ~(a = &0)`)); + (MATCH_MP_TAC SQRT_POS_LT); + (ASM_REWRITE_TAC[]); + + (ABBREV_TAC `FUN1 = (\x:real. --pi / &2 - F1 x - F2 x)`); + (ABBREV_TAC `FUN2 = (\x:real. F1 x + F2 x)`); + + (SUBGOAL_THEN `(FUN2 has_real_derivative F1' + F2') (atreal x within r)` ASSUME_TAC); + (EXPAND_TAC "FUN2"); + (ASM_SIMP_TAC[HAS_REAL_DERIVATIVE_ADD]); + + (SUBGOAL_THEN `(FUN1 has_real_derivative &0 - (F1' + F2')) (atreal x within r)` ASSUME_TAC); + (SUBGOAL_THEN `FUN1 = (\x:real. --pi / &2 - FUN2 x)` ASSUME_TAC); + (EXPAND_TAC "FUN1" THEN EXPAND_TAC "FUN2"); + (REWRITE_TAC[REAL_ARITH `a - (b + c) = a - b - c`]); + + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `((\x:real. --pi / &2) has_real_derivative &0 ) + (atreal x within r)` ASSUME_TAC); +(REAL_DIFF_TAC); + (MESON_TAC[]); + + (UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC); + (MP_TAC HAS_REAL_DERIVATIVE_SUB THEN MESON_TAC[]); + + (ABBREV_TAC `FUN3 = (\x:real. &2 * F3 x)`); + (SUBGOAL_THEN `(FUN3 has_real_derivative &2 * F3') (atreal x within r)` ASSUME_TAC); + (EXPAND_TAC "FUN3"); + (MP_TAC (ASSUME `(F3 has_real_derivative F3') (atreal x within r)`)); + (MP_TAC HAS_REAL_DERIVATIVE_LMUL_WITHIN THEN MESON_TAC[]); + + + (SUBGOAL_THEN `(FUNCTION has_real_derivative &0 - (F1' + F2') + &2 * F3') (atreal x within r)` ASSUME_TAC); + + (SUBGOAL_THEN `(\x. --pi / &2 - F1 x - F2 x + &2 * F3 x) = (\x:real. FUN1 x + FUN3 x)` ASSUME_TAC); + (EXPAND_TAC "FUN1" THEN EXPAND_TAC "FUN3"); + (MESON_TAC[]); + + (ASM_REWRITE_TAC[]); + (ASM_MESON_TAC[HAS_REAL_DERIVATIVE_ADD]); + (ASM_MESON_TAC[]); + +(* ========================================================================= *) + + (SUBGOAL_THEN `&0 < (&4 - c) * c` ASSUME_TAC); + (MATCH_MP_TAC REAL_LT_MUL); + ASM_REAL_ARITH_TAC; + + (SUBGOAL_THEN `sqrt ((((&4 - c) * c) * (&4 - c) * c) / &4) = + ((&4 - c) * c) / &2` ASSUME_TAC); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (MATCH_MP_TAC SQRT_RULE_Euler_lemma); + ASM_REAL_ARITH_TAC; + + (ASM_REWRITE_TAC[REAL_ARITH `&2 * x / &2 = x`]); + (REWRITE_TAC[REAL_ARITH + `&8 + (c * c) / &2 - &2 * c - &2 * c = (&4 - c) * ((&4 - c) / &2)`]); + (REWRITE_TAC[REAL_ARITH `((&4 - c) * c) / &2 = c * ((&4 - c) / &2)`]); + (REWRITE_TAC[REAL_ARITH `(a * b) / (c * d) = a * b / (c * d)`]); + + (SUBGOAL_THEN `(&4 - c) * (&4 - c) / &2 / (c * (&4 - c) / &2) = (&4 - c) / c` ASSUME_TAC); + + (MATCH_MP_TAC REDUCE_WITH_DIV_Euler_lemma); + (ASM_REWRITE_TAC[]); + ASM_REAL_ARITH_TAC; + + (ONCE_ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `(&1 - c / &2) * (&4 - c) * c / ((&4 - c) * c) = (&1 - c / &2)` ASSUME_TAC); + (REWRITE_TAC[REAL_ARITH `a * b * c / d = a * (b * c) / d`]); + (MATCH_MP_TAC (MESON[REAL_MUL_RID] `x = &1 ==> a * x = a`)); + (MATCH_MP_TAC REAL_DIV_REFL); + (REWRITE_TAC[REAL_ENTIRE; MESON[] `~ (a \/ b) <=> ~a /\ ~b`]); + ASM_REAL_ARITH_TAC; + + (ASM_REWRITE_TAC[REAL_ARITH `a - b - b = a - &2 * b`]); + + (ABBREV_TAC `P = {x| &0 < x /\ x < &4}`); + + (SUBGOAL_THEN `is_realinterval P` ASSUME_TAC); + (EXPAND_TAC "P"); + (MP_TAC REAL_INTERVAL_Euler_lemma); + (REPEAT LET_TAC); + (UP_ASM_TAC THEN MESON_TAC[]); + + (SUBGOAL_THEN `&2 IN P` ASSUME_TAC); + (EXPAND_TAC "P"); + (REWRITE_TAC [IN_ELIM_THM]); + REAL_ARITH_TAC; + + (SUBGOAL_THEN `!x. x IN P ==> ~(x = &0) /\ ~(&4 - x = &0)` ASSUME_TAC); + (GEN_TAC THEN EXPAND_TAC "P"); + (REWRITE_TAC [IN_ELIM_THM]); + REAL_ARITH_TAC; + + (SUBGOAL_THEN `(c:real) IN P` ASSUME_TAC); + (EXPAND_TAC "P"); + (ASM_REWRITE_TAC [IN_ELIM_THM]); + + (REPLICATE_TAC 4 UP_ASM_TAC); + (MP_TAC DERIVATIVE_WRT_C1_Euler_lemma); + (MESON_TAC[DERIVATIVE_WRT_C1_Euler_lemma]); + + (ABBREV_TAC `R = {x:real| &0 < x /\ x < &4}`); + + (SUBGOAL_THEN `(c:real) IN R` ASSUME_TAC); + (EXPAND_TAC"R" THEN ASM_REWRITE_TAC[IN_ELIM_THM]); + (SUBGOAL_THEN `is_realinterval R` ASSUME_TAC); + (EXPAND_TAC"R" THEN REWRITE_TAC[is_realinterval]); + (REWRITE_TAC[IN_ELIM_THM]); + (REPEAT STRIP_TAC); + (MATCH_MP_TAC (REAL_ARITH `&0 < a' /\ a' <= c ==> &0 < c`)); + (ASM_REWRITE_TAC[]); + (MATCH_MP_TAC (REAL_ARITH `c' <= b' /\ b' < &4 ==> c' < &4`)); + (ASM_REWRITE_TAC[]); + + (SUBGOAL_THEN `!y. y IN R ==> &0 < ((&4 - y) * y) * (&4 - c) * c` ASSUME_TAC); + + (GEN_TAC THEN EXPAND_TAC "R" THEN REWRITE_TAC[IN_ELIM_THM]); + STRIP_TAC; + (MATCH_MP_TAC REAL_LT_MUL); + STRIP_TAC; + (MATCH_MP_TAC REAL_LT_MUL); + ASM_REAL_ARITH_TAC; + (MATCH_MP_TAC REAL_LT_MUL); +ASM_REAL_ARITH_TAC; + + (SUBGOAL_THEN `(b:real) IN R` ASSUME_TAC); + (EXPAND_TAC"R" THEN ASM_REWRITE_TAC[IN_ELIM_THM]); + + (REPLICATE_TAC 4 UP_ASM_TAC THEN DEL_TAC THEN UP_ASM_TAC); + (MESON_TAC[]); + + + (EXPAND_TAC "d"); + (FIRST_X_ASSUM MATCH_MP_TAC); + (EXPAND_TAC "s" THEN ASM_REWRITE_TAC[IN_ELIM_THM]) +]);; + +end;; diff --git a/text_formalization/trigonometry/trig1.hl b/text_formalization/trigonometry/trig1.hl new file mode 100644 index 0000000..f6ef344 --- /dev/null +++ b/text_formalization/trigonometry/trig1.hl @@ -0,0 +1,1004 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Trigonometry *) +(* Author: Jason Rute, Thomas C. Hales *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + + + +module type Trigonometry1_type = sig + (* ADD *) + +end;; + +(* +Formal Proofs Blueprint Chapter on Trigonometry +some proofs copied from John Harrison. +*) + +flyspeck_needs "general/sphere.hl";; + + +module Trigonometry1 (* : Trigonometry1_type *) = struct + + let atn2 = Sphere.atn2;; + let arclength = Sphere.arclength;; + let ups_x = Sphere.ups_x;; + +prioritize_real();; + + +(* This is close to CIRCLE_SINCOS *) + +let atn2_spec_t = `!x y. ?r. ((-- pi < atn2(x, y)) /\ (atn2(x,y) <= pi) /\ + (x = r* (cos(atn2(x,y)))) /\ (y = r* (sin (atn2( x, y)))) /\ + (&0 <= r))`;; + +let acs_atn2_t = `!y. (-- &1 <= y /\ y <= &1) ==> (acs y = pi/(&2) - atn2(sqrt(&1 - y pow 2),y))`;; + +let arcVarc_t = `!u v w:real^3. ~(u=v) /\ ~(u=w) ==> arcV u v w = arclength (dist( u, v)) (dist( u, w)) (dist( v, w))`;; + +let law_of_cosines_t = `!a b c. (&0 < a) /\ (&0 < b) /\ (&0 <= c) /\ (c <= a + b) /\ (a <= b + c) /\ (b <= c + a) ==> + ((c pow 2) = (a pow 2) + (b pow 2) - &2 * a * b * (cos(arclength a b c)))`;; + +let law_of_sines_t = `!a b c. (&0 < a) /\ (&0 < b) /\ (&0 <= c) /\ (c <= a + b) /\ (a <= b + c) /\ (b <= c + a) ==> + (&2 * a * b * sin (arclength a b c) = sqrt(ups_x (a pow 2) (b pow 2) (c pow 2)))`;; + +let cross_mag_t = `!u v. norm (u cross v) = (norm u) * (norm v) * sin(arcV (vec 0) u v)`;; + +let cross_skew_t = `!u v. (u cross v) = -- (v cross u)`;; + +let cross_triple_t = `!u v w. (u cross v) dot w = (v cross w) dot u`;; + + +(* law of cosines *) + +let spherical_loc_t = `!v0 va vb vc:real^3. + ~(collinear {v0,va,vc}) /\ ~(collinear {v0,vb,vc}) ==> + ( + let gamma = dihV v0 vc va vb in + let a = arcV v0 vb vc in + let b = arcV v0 va vc in + let c = arcV v0 va vb in + (cos(gamma) = (cos(c) - cos(a)*cos(b))/(sin(a)*sin(b))))`;; + +let spherical_loc2_t = `!v0 va vb vc:real^3. + ~(collinear {v0,va,vc}) /\ ~(collinear {v0,vb,vc}) ==> + ( + let alpha = dihV v0 va vb vc in + let beta = dihV v0 vb va vc in + let gamma = dihV v0 vc vb va in + let c = arcV v0 va vb in + (cos(c) = (cos(gamma) + cos(alpha)*cos(beta))/(sin(alpha)*sin(beta))))`;; + +let dih_formula_t = `!v0 v1 v2 v3:real^3. + ~(collinear {v0,v1,v2}) /\ ~(collinear {v0,v1,v3}) ==> + ( + let (x1,x2,x3,x4,x5,x6) = xlist v0 v1 v2 v3 in + (dihV v0 v1 v2 v3 = dih_x x1 x2 x3 x4 x5 x6) + )`;; + +let dih_x_acs_t = `!x1 x2 x3 x4 x5 x6. + (&0 < ups_x x1 x2 x6) /\ (&0 < ups_x x1 x3 x5) /\ (&0 <= delta_x x1 x2 x3 x4 x5 x6) /\ (&0 <= x1) ==> + dih_x x1 x2 x3 x4 x5 x6 = acs ((delta_x4 x1 x2 x3 x4 x5 x6)/ + ((sqrt (ups_x x1 x2 x6)) * (sqrt (ups_x x1 x3 x5))))`;; + +let beta_cone_t = `!v0 v1 v2 v3:real^3. + ~(collinear {v0,v1,v2}) /\ ~(collinear {v0,v1,v3}) /\ + (dihV v0 v3 v1 v2 = pi/(&2)) ==> + (dihV v0 v1 v2 v3 = beta (arcV v0 v1 v3) (arcV v0 v1 v2))`;; + +let euler_triangle_t = `!v0 v1 v2 v3:real^3. + let p = euler_p v0 v1 v2 v3 in + let (x1,x2,x3,x4,x5,x6) = xlist v0 v1 v2 v3 in + let alpha1 = dihV v0 v1 v2 v3 in + let alpha2 = dihV v0 v2 v3 v1 in + let alpha3 = dihV v0 v3 v1 v2 in + let d = delta_x x1 x2 x3 x4 x5 x6 in + ((&0 < d) ==> + (alpha1 + alpha2 + alpha3 - pi = pi - &2 * atn2(sqrt(d), (&2 * p))))`;; + +let polar_cycle_rotate_t = `!V psi u f. + (!x y. f (x,y) = (x*cos psi + y*sin psi, -- x*sin psi + y*cos psi)) /\ + FINITE V /\ V u ==> + (polar_cycle (IMAGE f V) (f u) = f (polar_cycle V u))`;; + +let thetaij_t = `!theta1 theta2 k12 k21 theta12 theta21. + (&0 <= theta1) /\ (theta1 < &2 * pi) /\ (&0 <= theta2) /\ (theta2 < &2 * pi) /\ + (theta12 = theta2 - theta1 + &2 * pi * (&k12)) /\ + (theta21 = theta1 - theta2 + &2 * pi * (&k21)) /\ + (&0 <= theta12) /\ (theta12 < &2 * pi) /\ + (&0 <= theta21) /\ (theta21 < &2 * pi) ==> + ((theta12+theta21) = (if (theta1=theta2) then (&0) else (&2 * pi)))`;; + +(* JMR: Changed `polar_angle (FST u) (SND u)` to `Arg(complex u)` *) + +let thetapq_wind_t = `!W n thetapq kpq. + (!x y. (W (x,y) ==> (~(x= &0) /\ ~(y = &0)))) /\ + (W HAS_SIZE n) /\ + (!u v. W u /\ W v ==> + ((thetapq u v = Arg(complex v) - Arg(complex u) + &2 * pi * kpq u v) /\ (&0 <= thetapq u v) /\ (thetapq u v < &2 * pi))) + ==> + ((!u i j. (W u /\ (0 <= i) /\ (i <= j) /\ (j < n)) ==> + thetapq u (ITER i (polar_cycle W) u) + thetapq (ITER i (polar_cycle W) u) (ITER j (polar_cycle W) u) = thetapq u (ITER j (polar_cycle W) u)) /\ + ((!u v. (W u /\ W v) ==> (Arg(complex u) = Arg(complex v))) \/ + (!u. (W u) ==> (sum(0 .. n-1) (\i. thetapq (ITER i (polar_cycle W) u) (ITER (SUC i) (polar_cycle W) u)) = &2 * pi)) ))`;; + +let zenith_t = `!u v w:real^3. ~(u=v) /\ ~(w = v) ==> + (?u' r phi e3. + (phi = arcV v u w) /\ (r = dist( u, v)) /\ ((dist( w, v)) % e3 = (w-v)) /\ + ( u' dot e3 = &0) /\ (u = v + u' + (r*cos(phi)) % e3))`;; + +(* spherical_coord_t deprecated, replaced with Harrison's SPHERICAL_COORDINATES theorem, + which is worded slightly differently. +*) + +let polar_coord_zenith_t = `!u v w u' n. + ~(collinear {u,v,w}) /\ (aff {u,v,w} u') /\ ~(u' = v) /\ + (n = (w - v) cross (u - v)) ==> + (arcV v (v + n) u' = pi/ (&2))`;; + +let azim_pair_t = `!v w w1 w2. + let a1 = azim v w w1 w2 in + let a2 = azim v w w2 w1 in + (cyclic_set {w1,w2} v w) ==> + (a1 + a2 = (if (a1 = &0) then (&0) else (&2 * pi)))`;; + +let azim_cycle_sum_t = `!W v w n. + (cyclic_set W v w) /\ + (W HAS_SIZE n) ==> + (!p i j. (W p /\ (0 <= i) /\ (i <= j) /\ (j < n)) ==> + ((!q. W q ==> (azim v w p q = &0) ) \/ + (sum(0 .. n-1) (\i. azim v w (ITER i (azim_cycle W v w) p) (ITER (SUC i) (azim_cycle W v w) p)) = &2 * pi )))`;; + +let dih_azim_t = `!v w v1 v2. + ~(collinear {v,w,v1}) /\ ~(collinear {v,w,v2}) ==> + (cos(azim v w v1 v2) = cos(dihV v w v1 v2))`;; + +let sph_triangle_ineq_t = `!p u v w:real^3. + ~(collinear {p,u,w}) /\ ~(collinear {p,u,v}) /\ ~(collinear {p,v,w}) ==> + (arcV p u w <= arcV p u v + arcV p v w)`;; + +let sph_triangle_ineq_sum_t = `!p:real^3 u r. + (!i. (i < r) ==> ~(collinear {p,u i, u (SUC i)})) /\ + ~(collinear {p,u 0, u r}) ==> + (arcV p (u 0) (u r) <= sum(0 .. r-1) (\i. arcV p (u i) (u (SUC i))))`;; + +let azim_t = `!v w w1 w2 e1 e2 e3. + ?psi h1 h2 r1 r2. + ~collinear {v, w, w1} /\ + ~collinear {v, w, w2} /\ + orthonormal e1 e2 e3 /\ + (dist( w, v) % e3 = w - v) + ==> &0 <= azim v w w1 w2 /\ + azim v w w1 w2 < &2 * pi /\ + &0 < r1 /\ + &0 < r2 /\ + w1 = + (r1 * cos psi) % e1 + (r1 * sin psi) % e2 + h1 % (w - v) /\ + (w2 = + (r2 * cos (psi + azim v w w1 w2)) % e1 + + (r2 * sin (psi + azim v w w1 w2)) % e2 + + h2 % (w - v))`;; + +(* signature for trig theorems. + This is the list of theorems that should be provided by + an implementation of the blueprint on trig. + The signature can be extended, but care needs to made + in removing anything, because it may create incompatibilities + with other pieces of code. *) + +(* In every case, there is a term giving the precise theorem to + be proved *) + + +module type Trigsig = sig + val atn2_spec : thm (* atn2_spec_t *) + val acs_atn2: thm (* acs_atn2_t *) + val arcVarc : thm (* arcVarc_t *) + val law_of_cosines : thm (* law_of_cosines_t *) + val law_of_sines : thm (* law_of_sines_t *) + val cross_mag : thm (* cross_mag_t *) + val cross_skew : thm (* cross_skew_t *) + val cross_triple : thm (* cross_triple_t *) + val spherical_loc : thm (* spherical_loc_t *) + val spherical_loc2 : thm (* spherical_loc2_t *) + val dih_formula : thm (* dih_formula_t *) + val dih_x_acs : thm (* dih_x_acs_t *) + val beta_cone : thm (* beta_cone_t *) + val euler_triangle : thm (* euler_triangle_t *) +(* val polar_coords : thm (* polar_coords_t *) *) + val polar_cycle_rotate : thm (* polar_cycle_rotate_t *) + val thetaij : thm (* thetaij_t *) + val thetapq_wind : thm (* thetapq_wind_t *) + val zenith : thm (* zenith_t *) +(* val spherical_coord : thm (* spherical_coord_t *) *) + val polar_coord_zenith : thm (* polar_coord_zenith_t *) + val azim_pair : thm (* azim_pair_t *) + val azim_cycle_sum : thm (* azim_cycle_sum_t *) + val dih_azim : thm (* dih_azim_t *) + val sph_triangle_ineq : thm (* sph_triangle_ineq_t *) + val sph_triangle_ineq_sum : thm (* sph_triangle_ineq_sum_t *) + val azim : thm (* azim_t *) +end;; + +(* Here is a single axiom that permits a quick implementation of the + module with the given signature. + The axiom can be used so that the proofs in different chapters can + proceed independently. *) + +(* +let trig_term_list = new_definition (mk_eq (`trig_term:bool`, (list_mk_conj + [ + atn2_spec_t ; + acs_atn2_t ; + arcVarc_t ; + law_of_cosines_t ; + law_of_sines_t ; + cross_mag_t ; + cross_skew_t ; + cross_triple_t ; + spherical_loc_t ; + spherical_loc2_t ; + dih_formula_t ; + dih_x_acs_t ; + beta_cone_t ; + euler_triangle_t ; + polar_cycle_rotate_t ; + thetaij_t ; + thetapq_wind_t ; + zenith_t ; + polar_coord_zenith_t ; + azim_pair_t ; + azim_cycle_sum_t ; + dih_azim_t ; + sph_triangle_ineq_t ; + sph_triangle_ineq_sum_t ; + azim_t; + ])));; +*) + + + (* ---------------------------------------------------------------------- *) + (* These are theorems proved in HOL Light, but not in the *) + (* Multivariate files. Unless noted, all proofs by John Harrison. *) + (* ---------------------------------------------------------------------- *) + + (* REAL_LE_POW_2 is in HOL-Light Examples/transc.ml. *) + (* Also called REAL_LE_SQUARE_POW in Examples/analysis.ml. *) + + let REAL_LE_POW_2 = prove + (`!x. &0 <= x pow 2`, + REWRITE_TAC[REAL_POW_2; REAL_LE_SQUARE]);; + + (* REAL_DIV_MUL2 is in HOL-Light Examples/analysis.ml. *) + (* Proof in now trivial *) + + let REAL_DIV_MUL2 = REAL_FIELD + `!x z. ~(x = &0) /\ ~(z = &0) ==> !y. y / z = (x * y) / (x * z)`;; + + (* ---------------------------------------------------------------------- *) + (* Useful theorems about real numbers. *) + (* ---------------------------------------------------------------------- *) + + let REAL_LT_MUL_3 = prove + (`!x y z. &0 < x /\ &0 < y /\ &0 < z ==> &0 < x * y * z`, + REPEAT STRIP_TAC THEN MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC [] THEN + MATCH_MP_TAC REAL_LT_MUL THEN ASM_REWRITE_TAC []);; + + let SQRT_MUL_L = prove + (`!x y. &0 <= x /\ &0 <= y ==> x * sqrt y = sqrt(x pow 2 * y)`, + REPEAT STRIP_TAC THEN ASM_SIMP_TAC [REAL_LE_POW_2; SQRT_MUL; POW_2_SQRT]);; + + let SQRT_MUL_R = prove + (`!x y. &0 <= x /\ &0 <= y ==> sqrt x * y = sqrt(x * y pow 2)`, + REPEAT STRIP_TAC THEN ASM_SIMP_TAC [REAL_LE_POW_2; SQRT_MUL; POW_2_SQRT]);; + + (* ---------------------------------------------------------------------- *) + (* Basic trig results not included in Examples/transc.ml *) + (* ---------------------------------------------------------------------- *) + + (* Next two proofs similar to TAN_PERIODIC_NPI in *) + (* Examples/transc.ml by John Harrison *) + (* They are no longer needed, but may be useful later. *) + + let SIN_PERIODIC_N2PI = prove + (`!x n. sin(x + &n * (&2 * pi)) = sin(x)`, + GEN_TAC THEN INDUCT_TAC THEN REWRITE_TAC[REAL_MUL_LZERO; REAL_ADD_RID] THEN + REWRITE_TAC[GSYM REAL_OF_NUM_SUC; REAL_ADD_RDISTRIB; REAL_MUL_LID] THEN + ASM_REWRITE_TAC[REAL_ADD_ASSOC; SIN_PERIODIC]);; + + let COS_PERIODIC_N2PI = prove + (`!x n. cos(x + &n * (&2 * pi)) = cos(x)`, + GEN_TAC THEN INDUCT_TAC THEN REWRITE_TAC[REAL_MUL_LZERO; REAL_ADD_RID] THEN + REWRITE_TAC[GSYM REAL_OF_NUM_SUC; REAL_ADD_RDISTRIB; REAL_MUL_LID] THEN + ASM_REWRITE_TAC[REAL_ADD_ASSOC; COS_PERIODIC]);; + + let CIRCLE_SINCOS_PI = prove + (`!x y. (x pow 2 + y pow 2 = &1) ==> + ?t. (--pi < t /\ t <= pi) /\ ((x = cos(t)) /\ (y = sin(t)))`, + ASM_MESON_TAC [CIRCLE_SINCOS; SINCOS_PRINCIPAL_VALUE]);; + + let SIN_NEGPOS_PI = prove + (`!x. (--pi < x /\ x <= pi) ==> + (sin x < &0 <=> --pi < x /\ x < &0) /\ + (sin x = &0 <=> (x = &0 \/ x = pi)) /\ + (&0 < sin x <=> &0 < x /\ x < pi)`, + STRIP_TAC THEN STRIP_TAC THEN SUBGOAL_THEN + `if (sin x < &0) then (sin x < &0 <=> --pi < x /\ x < &0) else + if (sin x = &0) then (sin x = &0 <=> (x = &0 \/ x = pi)) else + (&0 < sin x <=> &0 < x /\ x < pi)` MP_TAC THENL + [ SUBGOAL_TAC "a" `--pi < x /\ x < &0 ==> sin x < &0` + [ MP_TAC (REWRITE_RULE [SIN_NEG] (SPEC `--x:real` SIN_POS_PI)) THEN + REAL_ARITH_TAC ] THEN + SUBGOAL_TAC "b" `x = &0 ==> sin x = &0` + [ STRIP_TAC THEN ASM_REWRITE_TAC [SIN_0] ] THEN + SUBGOAL_TAC "c" `x = pi ==> sin x = &0` + [ STRIP_TAC THEN ASM_REWRITE_TAC [SIN_PI] ] THEN + LABEL_TAC "d" (SPEC `x:real` SIN_POS_PI) THEN + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC ]);; + + let COS_NEGPOS_PI = prove + (`!x. (--pi < x /\ x <= pi) ==> + (cos x < &0 <=> (--pi < x /\ x < --(pi / &2)) \/ + (pi / &2 < x /\ x <= pi)) /\ + (cos x = &0 <=> (x = --(pi / &2) \/ x = pi / &2)) /\ + (&0 < cos x <=> --(pi / &2) < x /\ x < pi / &2)`, + STRIP_TAC THEN STRIP_TAC THEN SUBGOAL_THEN + `if (cos x < &0) then (cos x < &0 <=> (--pi < x /\ x < --(pi / &2)) \/ + (pi / &2 < x /\ x <= pi)) else + if (cos x = &0) then + (cos x = &0 <=> (x = --(pi / &2) \/ x = pi / &2)) else + (&0 < cos x <=> --(pi / &2) < x /\ x < pi / &2)` MP_TAC THENL + [ SUBGOAL_TAC "a" `--pi < x /\ x < --(pi / &2) ==> cos x < &0` + [ MP_TAC (REWRITE_RULE [COS_PERIODIC_PI] + (SPEC `x + pi:real` COS_POS_PI2)) THEN + REAL_ARITH_TAC ] THEN + SUBGOAL_TAC "b" `pi / &2 < x /\ x <= pi ==> cos x < &0` + [ MP_TAC (REWRITE_RULE [SIN_NEG; GSYM COS_SIN] + (SPEC `--(pi / &2 - x)` SIN_POS_PI2)) THEN + SUBGOAL_TAC "b1" `x = pi ==> cos x < &0` + [ STRIP_TAC THEN ASM_REWRITE_TAC [COS_PI; REAL_ARITH `&0 < &1`] THEN + REAL_ARITH_TAC ] THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC ] THEN + SUBGOAL_TAC "c" `x = --(pi / &2) ==> cos x = &0` + [ STRIP_TAC THEN ASM_REWRITE_TAC [COS_NEG; COS_PI2] ] THEN + SUBGOAL_TAC "d" `x = pi / &2 ==> cos x = &0` + [ STRIP_TAC THEN ASM_REWRITE_TAC [COS_PI2] ] THEN + LABEL_TAC "e" (SPEC `x:real` COS_POS_PI) THEN + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC; + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC ]);; + + + (* ----------------------------------------------------------------------- *) + (* Theory of atan_2 function. See sphere.hl for the definiton. *) + (* ----------------------------------------------------------------------- *) + + (* lemma:atn2_spec *) + + let dist_lemma = prove + (`!x y. ~(x = &0) \/ ~(y = &0) ==> + (x / sqrt(x pow 2 + y pow 2)) pow 2 + + (y / sqrt(x pow 2 + y pow 2)) pow 2 = &1 /\ + &0 < sqrt(x pow 2 + y pow 2)`, + STRIP_TAC THEN STRIP_TAC THEN STRIP_TAC THEN + SUBGOAL_TAC "sum_pos" `&0 < x pow 2 + y pow 2 /\ &0 <= x pow 2 + y pow 2` + [ MP_TAC (SPEC `x:real` REAL_LE_POW_2) THEN + MP_TAC (SPEC `y:real` REAL_LE_POW_2) THEN + IMP_RES_THEN MP_TAC (SPECL [`x:real`; `2`] REAL_POW_NZ) THEN + IMP_RES_THEN MP_TAC (SPECL [`y:real`; `2`] REAL_POW_NZ) THEN + REAL_ARITH_TAC ] THEN + POP_ASSUM MP_TAC THEN STRIP_TAC THEN + ASM_SIMP_TAC [REAL_POW_DIV; SQRT_POW_2; SQRT_POS_LT] THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + CONV_TAC REAL_FIELD);; + + let ATAN2_EXISTS = prove + (`!x y. ?t. (--pi < t /\ t <= pi) /\ + x = sqrt(x pow 2 + y pow 2) * cos t /\ + y = sqrt(x pow 2 + y pow 2) * sin t`, + REPEAT STRIP_TAC THEN ASM_CASES_TAC `(x = &0) /\ (y = &0)` THENL + [ ASM_REWRITE_TAC [(SPEC `2` REAL_POW_ZERO)] THEN + NUM_REDUCE_TAC THEN CONV_TAC REAL_RAT_REDUCE_CONV THEN + REWRITE_TAC [SQRT_0] THEN EXISTS_TAC `pi` THEN MP_TAC PI_POS THEN + REAL_ARITH_TAC ; + IMP_RES_THEN STRIP_ASSUME_TAC + (REWRITE_RULE [TAUT `(~A \/ ~B) <=> ~(A /\ B)`] dist_lemma) THEN + IMP_RES_THEN STRIP_ASSUME_TAC CIRCLE_SINCOS_PI THEN + POP_ASSUM (MP_TAC o GSYM) THEN POP_ASSUM (MP_TAC o GSYM) THEN + STRIP_TAC THEN STRIP_TAC THEN EXISTS_TAC `t:real` THEN + ASM_REWRITE_TAC [] THEN + POP_ASSUM (K ALL_TAC) THEN POP_ASSUM (K ALL_TAC) THEN + POP_ASSUM (K ALL_TAC) THEN POP_ASSUM (K ALL_TAC) THEN + POP_ASSUM MP_TAC THEN CONV_TAC REAL_FIELD ]);; + + (* The official Kepler definition (atn2) is different, but it was easier *) + (* to start with this one and prove it is equivalent. *) + + let ATAN2_TEMP_DEF = new_definition + `atan2_temp (x,y) = if (x = &0 /\ y = &0) + then pi + else @t. (--pi < t /\ t <= pi) /\ + x = sqrt(x pow 2 + y pow 2) * cos t /\ + y = sqrt(x pow 2 + y pow 2) * sin t`;; + + let ATAN2_TEMP = prove + (`!x y. (--pi < atan2_temp (x,y) /\ atan2_temp (x,y) <= pi) /\ + x = sqrt(x pow 2 + y pow 2) * cos (atan2_temp (x,y)) /\ + y = sqrt(x pow 2 + y pow 2) * sin (atan2_temp (x,y))`, + STRIP_TAC THEN STRIP_TAC THEN REWRITE_TAC [ATAN2_TEMP_DEF] THEN + COND_CASES_TAC THENL + [ ASM_REWRITE_TAC [(SPEC `2` REAL_POW_ZERO)] THEN + NUM_REDUCE_TAC THEN CONV_TAC REAL_RAT_REDUCE_CONV THEN + REWRITE_TAC [SQRT_0] THEN MP_TAC PI_POS THEN + REAL_ARITH_TAC ; + REWRITE_TAC [(SELECT_RULE (SPECL [`x:real`;`y:real`] ATAN2_EXISTS))]]);; + + let ATAN2_TEMP_SPEC = prove + (`!x y. ?r. ((-- pi < atan2_temp(x, y)) /\ (atan2_temp(x,y) <= pi) /\ + (x = r* (cos(atan2_temp(x,y)))) /\ (y = r* (sin (atan2_temp( x, y)))) /\ + (&0 <= r))`, + STRIP_TAC THEN STRIP_TAC THEN EXISTS_TAC `sqrt(x pow 2 + y pow 2)` THEN + REWRITE_TAC [ATAN2_TEMP] THEN SUBGOAL_TAC "sum_pos" `&0 <= x pow 2 + y pow 2` + [ MP_TAC (SPEC `x:real` REAL_LE_POW_2) THEN + MP_TAC (SPEC `y:real` REAL_LE_POW_2) THEN + REAL_ARITH_TAC ] THEN + MP_TAC (SPEC `x pow 2 + y pow 2` SQRT_POS_LE) THEN POP_ASSUM MP_TAC THEN + REAL_ARITH_TAC);; + + let ATAN2_TEMP_BREAKDOWN = prove + (`!x y. (&0 < x ==> atan2_temp(x,y) = atn(y / x)) /\ + (&0 < y ==> atan2_temp(x,y) = pi / &2 - atn(x / y)) /\ + (y < &0 ==> atan2_temp(x,y) = --(pi / &2) - atn(x / y)) /\ + (y = &0 /\ x <= &0 ==> atan2_temp(x,y) = pi)`, + REPEAT GEN_TAC THEN REPEAT CONJ_TAC THENL + [ STRIP_ASSUME_TAC (SPECL [`x:real`;`y:real`] ATAN2_TEMP) THEN + ABBREV_TAC `t = atan2_temp (x,y)` THEN + ABBREV_TAC `r = sqrt (x pow 2 + y pow 2)` THEN STRIP_TAC THEN + SUBGOAL_TAC "r_pos" `&0 < r` + [ EXPAND_TAC "r" THEN MP_TAC (SPECL [`x:real`;`y:real`] dist_lemma) THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC] THEN + SUBGOAL_TAC "tan" `(r * sin t) / (r * cos t) = tan t` + [ REWRITE_TAC [tan] THEN POP_ASSUM MP_TAC THEN CONV_TAC REAL_FIELD ] THEN + ASM_REWRITE_TAC [] THEN MATCH_MP_TAC (GSYM TAN_ATN) THEN + POP_ASSUM (K ALL_TAC) THEN + POP_ASSUM (fun th -> POP_ASSUM MP_TAC THEN ASSUME_TAC th) THEN + ASM_SIMP_TAC [GSYM COS_NEGPOS_PI; REAL_LT_MUL_EQ] THEN REAL_ARITH_TAC ; + + STRIP_ASSUME_TAC (SPECL [`x:real`;`y:real`] ATAN2_TEMP) THEN + ABBREV_TAC `t = atan2_temp (x,y)` THEN + ABBREV_TAC `r = sqrt (x pow 2 + y pow 2)` THEN STRIP_TAC THEN + SUBGOAL_TAC "r_pos" `&0 < r` + [ EXPAND_TAC "r" THEN MP_TAC (SPECL [`x:real`;`y:real`] dist_lemma) THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC] THEN + SUBGOAL_TAC "tan" `(r * cos t) / (r * sin t) = inv (tan t)` + [ REWRITE_TAC [tan] THEN POP_ASSUM MP_TAC THEN + CONV_TAC REAL_FIELD ] THEN + ASM_REWRITE_TAC [GSYM TAN_COT] THEN + SUBGOAL_THEN `pi / &2 - t = atn (tan (pi / &2 - t))` + (fun th -> REWRITE_TAC [GSYM th] THEN REAL_ARITH_TAC) THEN + MATCH_MP_TAC (GSYM TAN_ATN) THEN + SUBGOAL_THEN `&0 < t /\ t < pi` + (fun th -> MP_TAC th THEN REAL_ARITH_TAC) THEN + POP_ASSUM (K ALL_TAC) THEN + POP_ASSUM (fun th -> POP_ASSUM MP_TAC THEN ASSUME_TAC th) THEN + ASM_SIMP_TAC [GSYM SIN_NEGPOS_PI; REAL_LT_MUL_EQ] THEN REAL_ARITH_TAC ; + + STRIP_ASSUME_TAC (SPECL [`x:real`;`y:real`] ATAN2_TEMP) THEN + ABBREV_TAC `t = atan2_temp (x,y)` THEN + ABBREV_TAC `r = sqrt (x pow 2 + y pow 2)` THEN STRIP_TAC THEN + SUBGOAL_TAC "r_pos" `&0 < r` + [ EXPAND_TAC "r" THEN MP_TAC (SPECL [`x:real`;`y:real`] dist_lemma) THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC] THEN + SUBGOAL_TAC "tan" `(r * cos t) / (r * sin t) = --inv (tan (--t))` + [ REWRITE_TAC [TAN_NEG; REAL_INV_NEG] THEN + REWRITE_TAC [tan; REAL_NEG_NEG] THEN + POP_ASSUM MP_TAC THEN CONV_TAC REAL_FIELD ] THEN + ASM_REWRITE_TAC [GSYM TAN_COT; ATN_NEG] THEN + SUBGOAL_THEN `pi / &2 + t = atn (tan (pi / &2 + t))` + (fun th -> REWRITE_TAC [REAL_ARITH `pi / &2 - --t = pi / &2 + t`;GSYM th] + THEN REAL_ARITH_TAC) THEN + MATCH_MP_TAC (GSYM TAN_ATN) THEN + SUBGOAL_THEN `--pi < t /\ t < &0` + (fun th -> MP_TAC th THEN REAL_ARITH_TAC) THEN + POP_ASSUM (K ALL_TAC) THEN + POP_ASSUM (fun th -> POP_ASSUM (MP_TAC o (REWRITE_RULE [GSYM REAL_NEG_GT0])) + THEN ASSUME_TAC th) THEN + ASM_SIMP_TAC [GSYM SIN_NEGPOS_PI; REAL_LT_MUL_EQ; REAL_NEG_RMUL] THEN + REAL_ARITH_TAC ; + + ASM_CASES_TAC `x = &0` THENL + [ STRIP_TAC THEN ASM_REWRITE_TAC [ATAN2_TEMP_DEF]; + ALL_TAC] THEN + STRIP_ASSUME_TAC (SPECL [`x:real`;`y:real`] ATAN2_TEMP) THEN + ABBREV_TAC `t = atan2_temp (x,y)` THEN + ABBREV_TAC `r = sqrt (x pow 2 + y pow 2)` THEN STRIP_TAC THEN + SUBGOAL_TAC "r_pos" `&0 < r` + [ EXPAND_TAC "r" THEN MP_TAC (SPECL [`x:real`;`y:real`] dist_lemma) THEN + POP_ASSUM MP_TAC THEN FIND_ASSUM MP_TAC `~(x = &0)` THEN + REAL_ARITH_TAC ] THEN + SUBGOAL_TAC "sin_cos" `sin t = &0 /\ cos t < &0 ==> t = pi` + [ ASM_SIMP_TAC [SIN_NEGPOS_PI; COS_NEGPOS_PI] THEN MP_TAC PI_POS THEN + REAL_ARITH_TAC ] THEN + POP_ASSUM MATCH_MP_TAC THEN + SUBGOAL_TAC "x_pos" `&0 < --x` + [ FIND_ASSUM MP_TAC `x <= &0` THEN FIND_ASSUM MP_TAC `~(x = &0)` THEN + REAL_ARITH_TAC ] THEN + POP_ASSUM MP_TAC THEN + POP_ASSUM (fun th -> POP_ASSUM (K ALL_TAC) THEN POP_ASSUM MP_TAC THEN + ASSUME_TAC th) THEN + ASM_SIMP_TAC [REAL_LT_MUL_EQ; REAL_NEG_RMUL] THEN POP_ASSUM MP_TAC THEN + CONV_TAC REAL_FIELD]);; + + let ATAN2_TEMP_ALT = prove + (`!x y. atan2_temp (x,y) = + if ( abs y < x ) then atn(y / x) else + (if (&0 < y) then ((pi / &2) - atn(x / y)) else + (if (y < &0) then (-- (pi/ &2) - atn (x / y)) else ( pi )))`, + STRIP_TAC THEN STRIP_TAC THEN COND_CASES_TAC THENL + [ SUBGOAL_THEN `&0 < x` + (fun th -> SIMP_TAC [th; ATAN2_TEMP_BREAKDOWN]) THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + COND_CASES_TAC THENL + [ SUBGOAL_THEN `&0 < y` + (fun th -> SIMP_TAC [th; ATAN2_TEMP_BREAKDOWN]) THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + COND_CASES_TAC THENL + [ SUBGOAL_THEN `y < &0` + (fun th -> SIMP_TAC [th; ATAN2_TEMP_BREAKDOWN]) THEN + POP_ASSUM MP_TAC THEN REAL_ARITH_TAC; + SUBGOAL_THEN `y = &0` + (fun th -> POP_ASSUM (K ALL_TAC) THEN POP_ASSUM (K ALL_TAC) THEN + ASSUME_TAC th) THENL + [ POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC ; + SUBGOAL_THEN `x <= &0` + (fun th -> ASM_SIMP_TAC [th; ATAN2_TEMP_BREAKDOWN]) THEN + POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REAL_ARITH_TAC ]]]]);; + + (* Show that the working def and the official def are equivalent. *) + + let ATAN_TEMP_ATN2 = prove + (`atn2 = atan2_temp`, + REWRITE_TAC [FORALL_PAIR_THM; FUN_EQ_THM; atn2; ATAN2_TEMP_ALT]);; + + (* These three and the definition should suffice as the basic *) + (* specifications for atn2. No more need for atan2_temp.*) + + let atn2_spec = prove + (atn2_spec_t, + REWRITE_TAC [ATAN_TEMP_ATN2; ATAN2_TEMP_SPEC]);; + + let ATN2_BREAKDOWN = prove + (`!x y. (&0 < x ==> atn2 (x,y) = atn(y / x)) /\ + (&0 < y ==> atn2 (x,y) = pi / &2 - atn(x / y)) /\ + (y < &0 ==> atn2 (x,y) = --(pi / &2) - atn(x / y)) /\ + (y = &0 /\ x <= &0 ==> atn2(x,y) = pi)`, + REWRITE_TAC [ATAN_TEMP_ATN2; ATAN2_TEMP_BREAKDOWN]);; + + let ATN2_CIRCLE = prove + (`!x y. (--pi < atan2_temp (x,y) /\ atan2_temp (x,y) <= pi) /\ + x = sqrt(x pow 2 + y pow 2) * cos (atan2_temp (x,y)) /\ + y = sqrt(x pow 2 + y pow 2) * sin (atan2_temp (x,y))`, + REWRITE_TAC [ATAN_TEMP_ATN2; ATAN2_TEMP]);; + + (* Useful properties of atn2. *) + + let ATN2_0_1 = prove + (`atn2 (&0, &1) = pi / &2`, + ASSUME_TAC (REAL_ARITH `&0 < &1`) THEN + ASM_SIMP_TAC [ATN2_BREAKDOWN] THEN CONV_TAC REAL_RAT_REDUCE_CONV THEN + REWRITE_TAC [ATN_0] THEN REAL_ARITH_TAC);; + + let ATN2_0_NEG_1 = prove + (`atn2 (&0, --(&1)) = --(pi / &2)`, + ASSUME_TAC (REAL_ARITH `--(&1) < &0`) THEN + ASM_SIMP_TAC [ATN2_BREAKDOWN] THEN CONV_TAC REAL_RAT_REDUCE_CONV THEN + REWRITE_TAC [ATN_0] THEN REAL_ARITH_TAC);; + + let ATN2_LMUL_EQ = prove + (`!a x y. &0 < a ==> atn2(a * x, a * y) = atn2 (x, y)`, + REPEAT STRIP_TAC THEN STRIP_ASSUME_TAC + (REAL_ARITH `&0 < x \/ &0 < y \/ y < &0 \/ (y = &0 /\ x <= &0)`) THENL + [ SUBGOAL_TAC "pos_x" `&0 < a * x` + [ let th = SPECL [`&0`;`x:real`;`a:real`] REAL_LT_LMUL_EQ in + let th2 = REWRITE_RULE [REAL_MUL_RZERO] th in + ASM_SIMP_TAC [th2] ] ; + SUBGOAL_TAC "pos_y" `&0 < a * y` + [ let th = SPECL [`&0`;`y:real`;`a:real`] REAL_LT_LMUL_EQ in + let th2 = REWRITE_RULE [REAL_MUL_RZERO] th in + ASM_SIMP_TAC [th2] ] ; + SUBGOAL_TAC "neg_y" `a * y < &0` + [ let th = SPECL [`y:real`;`&0`;`a:real`] REAL_LT_LMUL_EQ in + let th2 = REWRITE_RULE [REAL_MUL_RZERO] th in + ASM_SIMP_TAC [th2] ] ; + SUBGOAL_TAC "other" `a * y = &0 /\ a * x <= &0` + [ ASM_REWRITE_TAC [REAL_MUL_RZERO] THEN + let th = SPECL [`x:real`;`&0`;`a:real`] REAL_LE_LMUL_EQ in + let th2 = REWRITE_RULE [REAL_MUL_RZERO] th in + ASM_SIMP_TAC [th2] ] ] THEN + let th1 = SPECL [`x:real`;`y:real`] ATN2_BREAKDOWN in + let th2 = SPECL [`a * x:real`;`a * y:real`] ATN2_BREAKDOWN in + let th3 = REAL_ARITH `!x. (x < &0 \/ &0 < x) ==> ~(&0 = x)` in + ASM_SIMP_TAC [th1; th2; th3; GSYM (SPEC `a:real` REAL_DIV_MUL2)] );; + + let ATN2_RNEG = prove + (`!x y. (~(y = &0) \/ &0 < x) ==> atn2(x,--y) = --(atn2(x,y))`, + STRIP_TAC THEN STRIP_TAC THEN STRIP_ASSUME_TAC + (REAL_ARITH `&0 < x \/ &0 < y \/ y < &0 \/ (y = &0 /\ x <= &0)`) THENL + [ ASM_REWRITE_TAC [] ; + ASM_SIMP_TAC [REAL_LT_IMP_NE] THEN SUBGOAL_TAC "neg" `--y < &0` + [ ASM_REWRITE_TAC [REAL_NEG_LT0] ] ; + ASM_SIMP_TAC [REAL_LT_IMP_NE] THEN SUBGOAL_TAC "pos" `&0 < --y` + [ ASM_REWRITE_TAC [REAL_NEG_GT0] ] ; + ASM_REWRITE_TAC [real_lt] ] THEN + let th1 = SPECL [`x:real`;`y:real`] ATN2_BREAKDOWN in + let th2 = SPECL [`x:real`;`--y:real`] ATN2_BREAKDOWN in + let th3 = REAL_ARITH `(--x)/y = --(x/y)` in + let th4 = REAL_FIELD `(y < &0 \/ &0 < y) ==> x / (--y) = --(x/y)` in + ASM_SIMP_TAC [th1; th2; th3; th4; ATN_NEG] THEN REAL_ARITH_TAC);; + + (* lemma:acs_atn2 *) + + let acs_atn2 = prove + (acs_atn2_t, + STRIP_TAC THEN ASM_CASES_TAC `y = &1 \/ y = --(&1)` THENL + [ POP_ASSUM DISJ_CASES_TAC THENL + [ ASM_REWRITE_TAC [] THEN CONV_TAC REAL_RAT_REDUCE_CONV THEN + REWRITE_TAC [ACS_1; SQRT_0; ATN2_0_1] THEN REAL_ARITH_TAC ; + ASM_REWRITE_TAC [] THEN CONV_TAC REAL_RAT_REDUCE_CONV THEN + REWRITE_TAC [ACS_NEG_1; SQRT_0; ATN2_0_NEG_1] THEN REAL_ARITH_TAC ] ; + STRIP_TAC THEN + SUBGOAL_TAC "sqrt" `&0 < sqrt (&1 - y pow 2)` + [ MATCH_MP_TAC SQRT_POS_LT THEN + SUBGOAL_THEN `&0 <= y pow 2 /\ y pow 2 < &1` + (fun th -> MP_TAC th THEN REAL_ARITH_TAC) THEN + REWRITE_TAC [REAL_LE_POW_2; REAL_ARITH `a < &1 <=> a < &1 pow 2`; + GSYM REAL_LT_SQUARE_ABS ] THEN + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC ] THEN + ASM_SIMP_TAC [ATN2_BREAKDOWN] THEN MATCH_MP_TAC ACS_ATN THEN + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC ]);; + + (* ----------------------------------------------------------------------- *) + (* Theory of triangles (without vectors). Includes laws of cosines/sines. *) + (* ----------------------------------------------------------------------- *) + + let UPS_X_SQUARES = prove + (`!a b c. ups_x (a * a) (b * b) (c * c) = + &16 * ((a + b + c) / &2) * + (((a + b + c) / &2) - a) * + (((a + b + c) / &2) - b) * + (((a + b + c) / &2) - c)`, + REPEAT STRIP_TAC THEN REWRITE_TAC [ups_x] THEN REAL_ARITH_TAC);; + + (* Theorems assuming a, b, c are lengths of a triangle (c not 0). *) + + let TRI_UPS_X_POS = prove + (`!a b c. (&0 < a) /\ (&0 < b) /\ (&0 <= c) /\ (c <= a + b) /\ (a <= b + c) /\ (b <= c + a) ==> + &0 <= ups_x (a * a) (b * b) (c * c)`, + REPEAT STRIP_TAC THEN REWRITE_TAC [UPS_X_SQUARES] THEN + REPEAT (MATCH_MP_TAC REAL_LE_MUL THEN STRIP_TAC) THENL + [ REAL_ARITH_TAC ; + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC ; + SUBGOAL_THEN `&2 * a <= a + b + c` + (fun th -> MP_TAC th THEN REAL_ARITH_TAC) THEN + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC ; + SUBGOAL_THEN `&2 * b <= a + b + c` + (fun th -> MP_TAC th THEN REAL_ARITH_TAC) THEN + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC ; + SUBGOAL_THEN `&2 * c <= a + b + c` + (fun th -> MP_TAC th THEN REAL_ARITH_TAC) THEN + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC ]);; + + let TRI_SQUARES_BOUNDS = prove + (`!a b c. (&0 < a) /\ (&0 < b) /\ (&0 <= c) /\ (c <= a + b) /\ (a <= b + c) /\ (b <= c + a) ==> + --(&1) <= ((a * a) + (b * b) - (c * c)) / (&2 * a * b) /\ + ((a * a) + (b * b) - (c * c)) / (&2 * a * b) <= &1`, + REPEAT STRIP_TAC THEN + SUBGOAL_TAC "2ab_pos" `&0 < &2 * a * b` + [ ASM_SIMP_TAC [REAL_LT_MUL_3; REAL_ARITH `&0 < &2`] ] THENL + [ SUBGOAL_TAC "abc_square" `c*c <= (a + b) * (a + b)` + [ MATCH_MP_TAC (REWRITE_RULE [IMP_IMP] REAL_LE_MUL2) THEN + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC ] THEN + ASM_SIMP_TAC [REAL_LE_RDIV_EQ] THEN REMOVE_THEN "abc_square" MP_TAC THEN + REAL_ARITH_TAC ; + SUBGOAL_TAC "abc_square" `(a - b) * (a - b) <= c*c` + [ DISJ_CASES_TAC (REAL_ARITH `a <= b \/ b <= a`) THENL + [ SUBST1_TAC (REAL_ARITH `(a-b)*(a-b)=(b-a)*(b-a)`); ALL_TAC ] THEN + MATCH_MP_TAC (REWRITE_RULE [IMP_IMP] REAL_LE_MUL2) THEN + REPEAT (POP_ASSUM MP_TAC) THEN REAL_ARITH_TAC ] THEN + ASM_SIMP_TAC [REAL_LE_LDIV_EQ] THEN REMOVE_THEN "abc_square" MP_TAC THEN + REAL_ARITH_TAC ]);; + + let ATN2_ARCLENGTH = prove + (`!a b c. (&0 < a) /\ (&0 < b) /\ (&0 <= c) /\ (c <= a + b) /\ (a <= b + c) /\ (b <= c + a) ==> + arclength a b c = pi / &2 - atn2(sqrt(ups_x (a*a) (b*b) (c*c)), (a*a) + (b*b) - (c*c))`, + REPEAT STRIP_TAC THEN + let th = REAL_ARITH `c * c - a * a - b * b = --(a * a + b * b - c * c)` in + REWRITE_TAC [arclength; th; ATN2_RNEG] THEN + SUBGOAL_THEN `~(a * a + b * b - c * c = &0) \/ + &0 < sqrt(ups_x (a*a) (b*b) (c*c))` + (fun th -> ASM_SIMP_TAC [th; ATN2_RNEG] THEN + REAL_ARITH_TAC) THEN + REWRITE_TAC [TAUT `(~A \/ B) <=> (A ==> B)`] THEN STRIP_TAC THEN + SUBGOAL_TAC "c_ab" `c*c = a*a + b*b` + [ POP_ASSUM MP_TAC THEN REAL_ARITH_TAC ] THEN + REMOVE_THEN "c_ab" (fun th -> REWRITE_TAC [ups_x; th]) THEN + MATCH_MP_TAC SQRT_POS_LT THEN + CONV_TAC (DEPTH_BINOP_CONV `(<)` REAL_POLY_CONV) THEN + MATCH_MP_TAC REAL_LT_MUL_3 THEN STRIP_TAC THENL + [ REAL_ARITH_TAC ; + ASM_SIMP_TAC [REAL_POW_LT] ]);; + + let TRI_LEMMA = prove + (`!a b c. (&0 < a) /\ (&0 < b) /\ (&0 <= c) /\ (c <= a + b) /\ (a <= b + c) /\ (b <= c + a) ==> + (&2 * a * b) * (a * a + b * b - c * c) / (&2 * a * b) = + a * a + b * b - c * c`, + REPEAT STRIP_TAC THEN + SUBGOAL_TAC "2ab_pos" `&0 < &2 * a * b` + [ ASM_SIMP_TAC [REAL_LT_MUL_3; REAL_ARITH `&0 < &2`] ] THEN + SUBGOAL_TAC "2ab_not0" `~(&2 * a * b = &0)` + [ POP_ASSUM MP_TAC THEN REAL_ARITH_TAC ] THEN + ASM_SIMP_TAC [REAL_DIV_LMUL]);; + + let TRI_UPS_X_SQUARES = prove + (`!a b c. (&0 < a) /\ (&0 < b) /\ (&0 <= c) /\ (c <= a + b) /\ (a <= b + c) /\ (b <= c + a) ==> + ups_x (a * a) (b * b) (c * c) = + (&2 * a * b) pow 2 * (&1 - ((a * a + b * b - c * c) / (&2 * a * b)) pow 2)`, + REPEAT STRIP_TAC THEN + ASM_SIMP_TAC [ups_x; REAL_SUB_LDISTRIB; GSYM REAL_POW_MUL; TRI_LEMMA] THEN + REAL_ARITH_TAC);; + + let TRI_UPS_X_SQRT = prove + (`!a b c. (&0 < a) /\ (&0 < b) /\ (&0 <= c) /\ (c <= a + b) /\ (a <= b + c) /\ (b <= c + a) ==> + sqrt(ups_x (a * a) (b * b) (c * c)) = + (&2 * a * b) * sqrt(&1 - ((a * a + b * b - c * c) / (&2 * a * b)) pow 2)`, + REPEAT STRIP_TAC THEN + SUBGOAL_TAC "2ab_pos" `&0 < &2 * a * b` + [ ASM_SIMP_TAC [REAL_LT_MUL_3; REAL_ARITH `&0 < &2`] ] THEN + SUBGOAL_TAC "other_pos" `&0 <= &1 - ((a * a + b * b - c * c) / (&2 * a * b)) pow 2` + [ SUBGOAL_THEN `((a * a + b * b - c * c) / (&2 * a * b)) pow 2 <= &1` + (fun th -> MP_TAC th THEN REAL_ARITH_TAC) THEN + ASM_SIMP_TAC [ABS_SQUARE_LE_1; REAL_ABS_BOUNDS; TRI_SQUARES_BOUNDS] ] THEN + ASM_SIMP_TAC [SQRT_MUL_L; REAL_LT_IMP_LE; TRI_UPS_X_SQUARES] );; + + let ACS_ARCLENGTH = prove + (`!a b c. (&0 < a) /\ (&0 < b) /\ (&0 <= c) /\ (c <= a + b) /\ (a <= b + c) /\ (b <= c + a) ==> + arclength a b c = acs (((a * a) + (b * b) - (c * c)) / (&2 * a * b))`, + REPEAT STRIP_TAC THEN ASM_SIMP_TAC [ATN2_ARCLENGTH; TRI_SQUARES_BOUNDS; acs_atn2] THEN + SUBGOAL_TAC "2ab_pos" `&0 < &2 * a * b` + [ ASM_SIMP_TAC [REAL_LT_MUL_3; REAL_ARITH `&0 < &2`] ] THEN + SUBGOAL_THEN + `(sqrt (ups_x (a * a) (b * b) (c * c)), a * a + b * b - c * c) = + ((&2 * a * b) * sqrt (&1 - ((a * a + b * b - c * c) / (&2 * a * b)) pow 2), + (&2 * a * b) * ((a * a + b * b - c * c) / (&2 * a * b)))` + (fun th -> ASM_SIMP_TAC [ATN2_LMUL_EQ; th]) THEN + ASM_SIMP_TAC [TRI_UPS_X_SQRT; TRI_LEMMA]);; + + let law_of_cosines = prove + (law_of_cosines_t, + REPEAT STRIP_TAC THEN + REWRITE_TAC [REAL_ARITH `&2 * a * b * x = (&2 * a * b) * x`] THEN + ASM_SIMP_TAC [ACS_ARCLENGTH; TRI_SQUARES_BOUNDS; COS_ACS; TRI_LEMMA] THEN + REAL_ARITH_TAC);; + + let law_of_sines = prove + (law_of_sines_t, + REPEAT STRIP_TAC THEN + REWRITE_TAC [REAL_ARITH `&2 * a * b * x = (&2 * a * b) * x`; + REAL_ARITH `x pow 2 = x * x` ] THEN + ASM_SIMP_TAC [ACS_ARCLENGTH; TRI_SQUARES_BOUNDS; SIN_ACS; TRI_UPS_X_SQRT]);; + + (* ----------------------------------------------------------------------- *) + (* Cross product properties. *) + (* ----------------------------------------------------------------------- *) + + let DIST_TRIANGLE_DETAILS = prove + (`~(u = v) /\ ~(u = w) <=> + &0 < dist(u,v) /\ &0 < dist(u,w) /\ + &0 <= dist(v,w) /\ + dist(v,w) <= dist(u,v) + dist(u,w) /\ + dist(u,v) <= dist(u,w) + dist(v,w) /\ + dist(u,w) <= dist(v,w) + dist(u,v)`, + NORM_ARITH_TAC);; + + let arcVarc = prove + (arcVarc_t, + SIMP_TAC [DIST_TRIANGLE_DETAILS; arcV; ACS_ARCLENGTH] THEN + REPEAT STRIP_TAC THEN AP_TERM_TAC THEN + REWRITE_TAC [DOT_NORM_NEG; dist] THEN + let tha = NORM_ARITH `norm (v - u) = norm (u - v)` in + let thb = NORM_ARITH `norm (w - u) = norm (u - w)` in + let thc = NORM_ARITH `norm (v - u - (w - u)) = norm (v - w)` in + REWRITE_TAC [tha; thb; thc] THEN CONV_TAC REAL_FIELD);; + + let DIST_LAW_OF_COS = prove + (`(dist(v:real^3,w)) pow 2 = (dist(u,v)) pow 2 + (dist(u,w)) pow 2 - + &2 * (dist(u,v)) * (dist(u,w)) * cos (arcV u v w)`, + ASM_CASES_TAC `~(u = v:real^3) /\ ~(u = w)` THEN POP_ASSUM MP_TAC THENL + [ ASM_SIMP_TAC [arcVarc] THEN + REWRITE_TAC [law_of_cosines; DIST_TRIANGLE_DETAILS]; + REWRITE_TAC [TAUT `~(~A /\ ~B) <=> (A \/ B)`] THEN STRIP_TAC THEN + ASM_REWRITE_TAC [DIST_REFL; DIST_SYM] THEN REAL_ARITH_TAC]);; + + let DIST_L_ZERO = prove + (`!v. dist(vec 0, v) = norm v`, + NORM_ARITH_TAC);; + + (* I would like to change this to real^N but that means changing arcV to real^N *) + + let DOT_COS = prove + (`u:real^3 dot v = (norm u) * (norm v) * cos (arcV (vec 0) u v)`, + MP_TAC (INST [`vec 0:real^3`,`u:real^3`; + `u:real^3`,`v:real^3`; + `v:real^3`,`w:real^3`] DIST_LAW_OF_COS) THEN + SUBGOAL_THEN + `dist(u:real^3,v) pow 2 = + dist(vec 0, v) pow 2 + dist(vec 0, u) pow 2 - &2 * u dot v` + (fun th -> REWRITE_TAC [th; DIST_L_ZERO] THEN REAL_ARITH_TAC) THEN + REWRITE_TAC [NORM_POW_2; dist; DOT_RSUB; DOT_LSUB; + DOT_SYM; DOT_LZERO; DOT_RZERO] THEN + REAL_ARITH_TAC);; + + (* DIMINDEX_3, FORALL_3, SUM_3, DOT_3, VECTOR_3, FORALL_VECTOR_3 *) + (* are all very useful. Any time you see a theorem you need with *) + (* 1 <= i /\ i <= dimindex(:3), first use INST_TYPE and then rewrite *) + (* with DIMINDEX_3 and FORALL_3 or see if it's in the list below. *) + + let CART_EQ_3 = prove + (`!x y. (x:A^3) = y <=> x$1 = y$1 /\ x$2 = y$2 /\ x$3 = y$3`, + REWRITE_TAC [CART_EQ; DIMINDEX_3; FORALL_3]);; + + let LAMBDA_BETA_3 = prove + (`((lambda) g:A^3) $1 = g 1 /\ + ((lambda) g:A^3) $2 = g 2 /\ + ((lambda) g:A^3) $3 = g 3`, + let th = REWRITE_RULE [DIMINDEX_3; FORALL_3] + (INST_TYPE [`:3`,`:B`] LAMBDA_BETA) in + REWRITE_TAC [th]);; + + let VEC_COMPONENT_3 = prove + (`!k. (vec k :real^3)$1 = &k /\ + (vec k :real^3)$2 = &k /\ + (vec k :real^3)$3 = &k`, + let th = REWRITE_RULE [DIMINDEX_3; FORALL_3] + (INST_TYPE [`:3`,`:N`] VEC_COMPONENT) in + REWRITE_TAC [th]);; + + let VECTOR_ADD_COMPONENT_3 = prove + (`!x:real^3 y. (x + y)$1 = x$1 + y$1 /\ + (x + y)$2 = x$2 + y$2 /\ + (x + y)$3 = x$3 + y$3`, + let th = REWRITE_RULE [DIMINDEX_3; FORALL_3] + (INST_TYPE [`:3`,`:N`] VECTOR_ADD_COMPONENT) in + REWRITE_TAC [th]);; + + let VECTOR_SUB_COMPONENT_3 = prove + (`!x:real^3 y. (x - y)$1 = x$1 - y$1 /\ + (x - y)$2 = x$2 - y$2 /\ + (x - y)$3 = x$3 - y$3`, + let th = REWRITE_RULE [DIMINDEX_3; FORALL_3] + (INST_TYPE [`:3`,`:N`] VECTOR_SUB_COMPONENT) in + REWRITE_TAC [th]);; + + let VECTOR_NEG_COMPONENT_3 = prove + (`!x:real^3. (--x)$1 = --(x$1) /\ + (--x)$2 = --(x$2) /\ + (--x)$3 = --(x$3)`, + let th = REWRITE_RULE [DIMINDEX_3; FORALL_3] + (INST_TYPE [`:3`,`:N`] VECTOR_NEG_COMPONENT) in + REWRITE_TAC [th]);; + + let VECTOR_MUL_COMPONENT_3 = prove + (`!c x:real^3. (c % x)$1 = c * x$1 /\ + (c % x)$2 = c * x$2 /\ + (c % x)$3 = c * x$3`, + let th = REWRITE_RULE [DIMINDEX_3; FORALL_3] + (INST_TYPE [`:3`,`:N`] VECTOR_MUL_COMPONENT) in + REWRITE_TAC [th]);; + + (* COND_COMPONENT_3 - no need, COND_COMPONENT works fine. *) + + let BASIS_3 = prove + (`(basis 1:real^3)$1 = &1 /\ (basis 1:real^3)$2 = &0 /\ (basis 1:real^3)$3 = &0 /\ + (basis 2:real^3)$1 = &0 /\ (basis 2:real^3)$2 = &1 /\ (basis 2:real^3)$3 = &0 /\ + (basis 3:real^3)$1 = &0 /\ (basis 3:real^3)$2 = &0 /\ (basis 3:real^3)$3 = &1`, + REWRITE_TAC [basis; + REWRITE_RULE [DIMINDEX_3; FORALL_3] + (INST_TYPE [`:3`,`:B`] LAMBDA_BETA)] THEN + ARITH_TAC);; + + let COMPONENTS_3 = prove + (`!v. v:real^3 = v$1 % basis 1 + v$2 % basis 2 + v$3 % basis 3`, + REWRITE_TAC [CART_EQ_3; VECTOR_ADD_COMPONENT_3; + VECTOR_MUL_COMPONENT_3; BASIS_3] THEN REAL_ARITH_TAC);; + + let VECTOR_COMPONENTS_3 = prove + (`!a b c. vector [a;b;c]:real^3 = a % basis 1 + b % basis 2 + c % basis 3`, + let th = REWRITE_RULE [VECTOR_3] + (ISPEC `vector [a;b;c]:real^3` COMPONENTS_3) in + REWRITE_TAC [th]);; + + let cross_skew = prove + (cross_skew_t, + REWRITE_TAC [CART_EQ_3; CROSS_COMPONENTS; VECTOR_NEG_COMPONENT_3] THEN + REAL_ARITH_TAC);; + + let cross_triple = prove + (cross_triple_t, + REWRITE_TAC [ DOT_3; CROSS_COMPONENTS] THEN REAL_ARITH_TAC);; + + let NORM_CAUCHY_SCHWARZ_FRAC = prove + (`!(u:real^N) v. ~(u = vec 0) /\ ~(v = vec 0) ==> + -- &1 <= (u dot v) / (norm u * norm v) /\ + (u dot v) / (norm u * norm v) <= &1`, + REPEAT STRIP_TAC THEN + SUBGOAL_TAC "norm_pos" `&0 < norm (u:real^N) * norm (v:real^N)` + [ POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN + SIMP_TAC [GSYM NORM_POS_LT; IMP_IMP; REAL_LT_MUL] ] THEN + MP_TAC (SPECL [`u:real^N`;`v:real^N`] NORM_CAUCHY_SCHWARZ_ABS) THEN + ASM_SIMP_TAC [REAL_ABS_BOUNDS; REAL_LE_RDIV_EQ; REAL_LE_LDIV_EQ] THEN + REAL_ARITH_TAC);; + + let CROSS_LZERO = prove + (`!x. (vec 0) cross x = vec 0`, + REWRITE_TAC [CART_EQ_3; CROSS_COMPONENTS; VEC_COMPONENT_3] THEN + REAL_ARITH_TAC);; + + let CROSS_RZERO = prove + (`!x. x cross (vec 0) = vec 0`, + REWRITE_TAC [CART_EQ_3; CROSS_COMPONENTS; VEC_COMPONENT_3] THEN + REAL_ARITH_TAC);; + + let CROSS_SQUARED = prove + (`!u v. (u cross v) dot (u cross v) = + (ups_x (u dot u) (v dot v) ((u - v) dot (u - v))) / &4`, + REWRITE_TAC [DOT_3; CROSS_COMPONENTS; ups_x; VECTOR_SUB_COMPONENT_3] THEN + REAL_ARITH_TAC);; + + let DIST_UPS_X_POS = prove + (`~(u = v) /\ ~(u = w) ==> + &0 <= ups_x (dist(u,v) pow 2) (dist(u,w) pow 2) (dist(v,w) pow 2)`, + REWRITE_TAC [DIST_TRIANGLE_DETAILS; TRI_UPS_X_POS; REAL_POW_2]);; + + let SQRT_DIV_R = prove + (`&0 <= x /\ &0 <= y ==> sqrt (x) / y = sqrt (x/ (y pow 2)) /\ &0 <= x/(y pow 2)`, + SIMP_TAC [SQRT_DIV; REAL_LE_POW_2; POW_2_SQRT; REAL_LE_DIV]);; + + let NORM_CROSS = prove + (`!u v. ~(vec 0 = u) /\ ~(vec 0 = v) ==> + norm (u cross v) = + sqrt (ups_x ((norm u) pow 2) + ((norm v) pow 2) + ((dist(u,v)) pow 2)) / &2`, + REPEAT GEN_TAC THEN DISCH_TAC THEN IMP_RES_THEN MP_TAC DIST_UPS_X_POS THEN + REWRITE_TAC [DIST_L_ZERO] THEN + SIMP_TAC[SQRT_DIV_R; REAL_ARITH `&0 <= &2`; REAL_ARITH `&2 pow 2 = &4`] THEN + DISCH_TAC THEN MATCH_MP_TAC (GSYM SQRT_UNIQUE) THEN + REWRITE_TAC [dist; NORM_POW_2; CROSS_SQUARED] THEN NORM_ARITH_TAC);; + + let VECTOR_LAW_OF_SINES = prove + (`~(vec 0 = u:real^3) /\ ~(vec 0 = v) ==> + &2 * (norm u) * (norm v) * sin (arcV (vec 0) u v) = + sqrt (ups_x (norm u pow 2) (norm v pow 2) (dist (u,v) pow 2))`, + SIMP_TAC [arcVarc; DIST_TRIANGLE_DETAILS; law_of_sines; DIST_L_ZERO]);; + + let cross_mag = prove + (cross_mag_t, + REPEAT STRIP_TAC THEN + REWRITE_TAC [arcVarc; VECTOR_SUB_RZERO] THEN + ASM_CASES_TAC `(u:real^3) = vec 0 \/ (v:real^3) = vec 0` THENL + [ POP_ASSUM STRIP_ASSUME_TAC THEN + ASM_REWRITE_TAC [CROSS_LZERO; CROSS_RZERO; NORM_0] THEN REAL_ARITH_TAC ; + POP_ASSUM MP_TAC THEN + REWRITE_TAC [DE_MORGAN_THM; MESON [] `a = vec 0 <=> vec 0 = a`] THEN + SIMP_TAC [NORM_CROSS; GSYM VECTOR_LAW_OF_SINES] THEN REAL_ARITH_TAC ]);; + + + +end;; + diff --git a/text_formalization/trigonometry/trig2.hl b/text_formalization/trigonometry/trig2.hl new file mode 100644 index 0000000..064b0f1 --- /dev/null +++ b/text_formalization/trigonometry/trig2.hl @@ -0,0 +1,5197 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Trigonometry *) +(* Author: Nguyen Quang Truong *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + +module type Trigonometry2_type = sig + (* add *) +end;; + +flyspeck_needs "general/sphere.hl";; +flyspeck_needs "leg/collect_geom.hl";; +flyspeck_needs "trigonometry/trig1.hl";; + +module Trigonometry2 (* : Trigonometry2_type *) = struct + +(* imports *) + + let delta_x4 = Sphere.delta_x4;; + let atn2 = Sphere.atn2;; +(* let beta = Sphere.beta;; *) + let aff = Sphere.aff;; + let cyclic_set = Sphere.cyclic_set;; + let ups_x = Sphere.ups_x;; + + let COL_EQ_UPS_0 = Collect_geom.COL_EQ_UPS_0;; + + let acs_atn2 = Trigonometry1.acs_atn2;; + + let BY = Hales_tactic.BY;; + +(* ========== QUANG TRUONG ========== *) +let cosV = new_definition` cosV u v = (u dot v) / (norm u * norm v) `;; +let sinV = new_definition` sinV u v = sqrt ( &1 - cosV u v pow 2 ) `;; + + +let SET_TAC = +let basicthms = +[NOT_IN_EMPTY; IN_UNIV; IN_UNION; IN_INTER; IN_DIFF; IN_INSERT; +IN_DELETE; IN_REST; IN_INTERS; IN_UNIONS; IN_IMAGE] in +let allthms = basicthms @ map (REWRITE_RULE[IN]) basicthms @ +[IN_ELIM_THM; IN] in +let PRESET_TAC = +TRY(POP_ASSUM_LIST(MP_TAC o end_itlist CONJ)) THEN +REPEAT COND_CASES_TAC THEN +REWRITE_TAC[EXTENSION; SUBSET; PSUBSET; DISJOINT; SING] THEN +REWRITE_TAC allthms in +fun ths -> +PRESET_TAC THEN +(if ths = [] then ALL_TAC else MP_TAC(end_itlist CONJ ths)) THEN +MESON_TAC[];; + +let SET_RULE tm = prove(tm,SET_TAC[]);; + +let PHA = REWRITE_TAC[ MESON[] ` (a/\b)/\c <=> a/\ b /\ c `; MESON[]` +a ==> b ==> c <=> a /\ b ==> c `];; + +let NGOAC = REWRITE_TAC[ MESON[] ` a/\b/\c <=> (a/\b)/\c `];; + +let DAO = NGOAC THEN REWRITE_TAC[ MESON[]` a /\ b <=> b /\ a`];; + +let PHAT = REWRITE_TAC[ MESON[] ` (a\/b)\/c <=> a\/b\/c `];; + +let NGOACT = REWRITE_TAC[ GSYM (MESON[] ` (a\/b)\/c <=> a\/b\/c `)];; + +let KHANANG = PHA THEN REWRITE_TAC[ MESON[]` ( a\/ b ) /\ c <=> a /\ c \/ b /\ c `] THEN +REWRITE_TAC[ MESON[]` a /\ ( b \/ c ) <=> a /\ b \/ a /\ c `];; + +let ATTACH thm = MATCH_MP (MESON[]` ! a b. ( a ==> b ) ==> ( a <=> a /\ b )`) thm;; + +let NHANH tm = ONCE_REWRITE_TAC[ ATTACH (SPEC_ALL ( tm ))];; +let LET_TR = CONV_TAC (TOP_DEPTH_CONV let_CONV);; + +let DOWN_TAC = REPEAT (FIRST_X_ASSUM MP_TAC) THEN REWRITE_TAC[IMP_IMP] THEN PHA;; +let IMP_IMP_TAC = REWRITE_TAC[GSYM IMP_IMP] ;; + + + + +let NOT_EQ_IMPCOS_ARC = prove(`~( v0 = (u:real^N) ) /\ ~ ( v0 = w ) ==> cos (arcV v0 u w) = +((u - v0) dot (w - v0)) / (norm (u - v0) * norm (w - v0))`, +REWRITE_TAC[GSYM VECTOR_SUB_EQ; GSYM NORM_EQ_0] THEN +NHANH (MESON[NORM_POS_LE]` ~(norm (x:real^N) = &0 ) ==> &0 <= norm x `) THEN +REWRITE_TAC[REAL_ARITH` ~ ( a = &0 ) /\ &0 <= a <=> +&0 < a `] THEN +SIMP_TAC[NORM_SUB] THEN +MP_TAC (SPECL[` u - (v0:real^N)`; `v0 - (w :real^N) `] NORM_CAUCHY_SCHWARZ_ABS) THEN +NHANH (REAL_LT_MUL) THEN PHA THEN +REWRITE_TAC[MESON[REAL_LE_DIV2_EQ; REAL_FIELD ` &0 < a ==> a / a = &1 `]` a <= b /\ l1 /\ l2 /\ &0 < b <=> +a / b <= &1 /\ l1 /\ l2 /\ &0 < b `] THEN +NHANH (MESON[REAL_LT_IMP_LE; REAL_ABS_REFL; REAL_ABS_DIV]` +abs b / a <= &1 /\ l1 /\ l2 /\ &0 < a ==> +abs ( b / a ) <= &1 `) THEN +ONCE_REWRITE_TAC[ GSYM REAL_ABS_NEG] THEN +REWRITE_TAC[REAL_ARITH` -- ( a / b ) = ( --a ) / b `; +VECTOR_ARITH` --((u - v0) dot (v0 - w)) = ((u - v0) dot (w - v0)) `] THEN +REWRITE_TAC[REAL_ABS_BOUNDS; arcV] THEN +SIMP_TAC[NORM_SUB] THEN MESON_TAC[COS_ACS]);; + + + +let COLLINEAR_TRANSABLE = prove( +`collinear {(a:real^N), b, c} <=> collinear {vec 0, b - a, c - a}`, +REWRITE_TAC[collinear; IN_INSERT; NOT_IN_EMPTY] THEN EQ_TAC THENL +[STRIP_TAC THEN EXISTS_TAC `u: real^N` THEN REPEAT GEN_TAC THEN +ASM_MESON_TAC[VECTOR_ARITH` ( a - c ) - ( b - c ) = a - (b:real^N)`; +VECTOR_SUB_REFL; VECTOR_ARITH` vec 0 - ( a - b ) = b - a `; +VECTOR_ARITH` a - vec 0 = a `]; STRIP_TAC THEN EXISTS_TAC `u:real^N` +THEN REPEAT GEN_TAC] THEN ASM_MESON_TAC[VECTOR_ARITH` ( a - c ) - ( b - c ) = a - (b:real^N)`; +VECTOR_SUB_REFL; VECTOR_ARITH` vec 0 - ( a - b ) = b - a `; +VECTOR_ARITH` a - vec 0 = a `]);; + + + + + +let ALLEMI_COLLINEAR = prove(`((vc - v0) dot ((vc: real^N) - v0)) % (va - v0) = +((va - v0) dot (vc - v0)) % (vc - v0) +==> collinear {v0, vc, va}`, +ASM_CASES_TAC ` (vc - v0) dot (vc - (v0:real^N)) = &0 ` THENL +[FIRST_X_ASSUM MP_TAC THEN REWRITE_TAC[DOT_EQ_0; VECTOR_SUB_EQ] THEN +SIMP_TAC[INSERT_INSERT; COLLINEAR_2]; FIRST_X_ASSUM MP_TAC THEN +PHA THEN NHANH (MESON[]` ~( a = &0 ) /\ b = c ==> &1 / a % b = +&1 / a % c `) THEN SIMP_TAC[VECTOR_MUL_ASSOC] THEN PHA THEN +ONCE_REWRITE_TAC[MESON[]` a /\b ==> c <=> a ==> b ==> c `] THEN +SIMP_TAC[REAL_FIELD` ~ ( a = &0 ) ==> &1 / a * a = &1 `; +VECTOR_MUL_LID] THEN ONCE_REWRITE_TAC[COLLINEAR_TRANSABLE ] THEN +MESON_TAC[COLLINEAR_LEMMA]]);; + + +let NOT_VEC0_IMP_LE1 = prove(`~( x = vec 0 ) /\ ~( y = vec 0 ) ==> +abs (( x dot y )/ (( norm x ) * ( norm y ))) <= &1 `, +REWRITE_TAC[GSYM NORM_POS_LT; REAL_ABS_DIV; REAL_ABS_MUL; REAL_ABS_NORM] THEN +NHANH (REAL_LT_MUL) THEN +SIMP_TAC[REAL_LE_LDIV_EQ; REAL_MUL_LID; NORM_CAUCHY_SCHWARZ_ABS]);; + +let sin_acs_t = prove(`! y. (-- &1 <= y /\ y <= &1) ==> (sin (acs(y)) = sqrt(&1 - y pow 2))`, +REPEAT STRIP_TAC THEN MATCH_MP_TAC(GSYM SQRT_UNIQUE) THEN +ASM_SIMP_TAC[ACS_BOUNDS; SIN_POS_PI_LE; REAL_EQ_SUB_RADD] THEN +ASM_MESON_TAC[COS_ACS; SIN_CIRCLE]);; + + +let ABS_LE_1_IMP_SIN_ACS = prove(`!y. abs y <= &1 ==> sin (acs y) = sqrt (&1 - y pow 2)`, +SIMP_TAC[REAL_ABS_BOUNDS; sin_acs_t]);; + + +let NOT_2EQ_IMP_SIN_ARCV = prove(`~( v0 = va) /\ ~(v0 = (vb:real^N)) ==> +sin ( arcV v0 va vb ) = sqrt +(&1 - +(((va - v0) dot (vb - v0)) / (norm (va - v0) * norm (vb - v0))) pow 2) `, +REWRITE_TAC[arcV] THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN NHANH (NOT_VEC0_IMP_LE1 ) THEN +SIMP_TAC[ABS_LE_1_IMP_SIN_ACS]);; + + +let ABS_NOT_EQ_NORM_MUL = prove(` ~ ( abs ( x dot y ) = norm x * norm y ) <=> +abs ( x dot y ) < norm x * norm y `, +SIMP_TAC[REAL_LT_LE; NORM_CAUCHY_SCHWARZ_ABS]);; + + + +let SQUARE_NORM_CAUCHY_SCHWARZ_POW2 = prove(`((x:real^N) dot y) pow 2 <= (norm x * norm y) pow 2`, +REWRITE_TAC[GSYM REAL_LE_SQUARE_ABS] THEN +MESON_TAC[GSYM REAL_ABS_REFL; REAL_LE_MUL; NORM_POS_LE; +NORM_CAUCHY_SCHWARZ_ABS]);; + +let REAL_LE_POW_2 = prove(` ! x. &0 <= x pow 2 `, +REWRITE_TAC[REAL_POW_2; REAL_LE_SQUARE]);; + +let SQRT_SEPARATED = prove(`sqrt (((norm x * norm y) pow 2 - ((x:real^N) dot y) pow 2) / (norm x * norm y) pow 2) = +sqrt ((norm x * norm y) pow 2 - (x dot y) pow 2) / +sqrt ((norm x * norm y) pow 2)`, +MP_TAC SQUARE_NORM_CAUCHY_SCHWARZ_POW2 THEN +ONCE_REWRITE_TAC[GSYM REAL_SUB_LE] THEN SIMP_TAC[REAL_LE_POW_2; SQRT_DIV]);; + + + + +let COMPUTE_NORM_OF_P = prove(`norm ((vc dot vc) % va - (va dot vc) % vc) = +sqrt ((vc dot vc) * ((va dot va) * (vc dot vc) - (va dot vc) pow 2))`, +REWRITE_TAC[vector_norm; DOT_LSUB; DOT_RSUB; DOT_LMUL; DOT_RMUL] THEN +MATCH_MP_TAC (MESON[]` a = b ==> P a = P b `) THEN SIMP_TAC[DOT_SYM] THEN REAL_ARITH_TAC);; + + + + +let MOVE_NORM_OUT_OF_SQRT = prove(`sqrt (norm (vc:real^N) pow 2 * ((norm va * norm vc) pow 2 - (va dot vc) pow 2)) = +norm vc * sqrt ((norm va * norm vc) pow 2 - (va dot vc) pow 2)`, +MP_TAC (MESON[SQUARE_NORM_CAUCHY_SCHWARZ_POW2]` +((va: real^N) dot vc) pow 2 <= (norm va * norm vc) pow 2 `) THEN +ONCE_REWRITE_TAC[GSYM REAL_SUB_LE] THEN +SIMP_TAC[REAL_LE_POW_2; SQRT_MUL; NORM_POS_LE; POW_2_SQRT]);; + +let PI2_EQ_ACS0 = prove(` pi / &2 = acs ( &0 ) `, +MP_TAC (REAL_ARITH` -- &1 <= &0 /\ &0 <= &1 `) THEN +NHANH ACS_BOUNDS THEN STRIP_TAC THEN MATCH_MP_TAC COS_INJ_PI +THEN ASM_SIMP_TAC[COS_PI2; COS_ACS] THEN ASSUME_TAC PI_POS +THEN ASM_REAL_ARITH_TAC);; + +let ANGLE_EQ_ARCV = prove(`! vap vbp. angle (vap,vec 0,vbp) = arcV (vec 0) vap vbp `, +REWRITE_TAC[arcV; angle; vector_angle] THEN REPEAT STRIP_TAC THEN +COND_CASES_TAC THENL [POP_ASSUM DISJ_CASES_TAC THENL [ +ASM_SIMP_TAC[DOT_LZERO; REAL_ARITH` &0 / a = &0 `; PI2_EQ_ACS0]; +ASM_SIMP_TAC[DOT_RZERO; REAL_ARITH` &0 / a = &0 `; PI2_EQ_ACS0]]; +REWRITE_TAC[]]);; + + +let dihV = prove(`! w0 w1 w2 w3. dihV w0 w1 w2 w3 = +(let va = w2 - w0 in +let vb = w3 - w0 in +let vc = w1 - w0 in +let vap = (vc dot vc) % va - (va dot vc) % vc in +let vbp = (vc dot vc) % vb - (vb dot vc) % vc in arcV (vec 0) vap vbp)`, +SIMP_TAC[dihV; ANGLE_EQ_ARCV]);; +(* lemma 16 *) + +let RLXWSTK = prove(`! (v0: real^N) va vb vc. let gam = dihV v0 vc va vb in +let a = arcV v0 vc vb in +let b = arcV v0 vc va in +let c = arcV v0 va vb in +~collinear {v0, vc, va} /\ ~collinear {v0, vc, vb} +==> cos gam = (cos c - cos a * cos b) / ( sin a * sin b )`, +REPEAT GEN_TAC THEN REPEAT LET_TAC THEN EXPAND_TAC "gam" THEN +REWRITE_TAC[dihV] THEN LET_TR THEN +NHANH (ONCE_REWRITE_RULE[GSYM CONTRAPOS_THM] ALLEMI_COLLINEAR) THEN +ONCE_REWRITE_TAC[VECTOR_ARITH` a = b <=> vec 0 = a - b `] THEN +SIMP_TAC[NOT_EQ_IMPCOS_ARC; VECTOR_SUB_RZERO ] THEN +ABBREV_TAC ` (va_v0p: real^N) = ((vc - v0) dot (vc - v0)) % (va - v0) - +((va - v0) dot (vc - v0)) % (vc - v0) ` THEN +ABBREV_TAC ` (vb_v0p :real^N) = ((vc - v0) dot (vc - v0)) % (vb - v0) - +((vb - v0) dot (vc - v0)) % (vc - v0) ` THEN +EXPAND_TAC "c" THEN EXPAND_TAC "a" THEN EXPAND_TAC "b" THEN +NHANH (MESON[COLLINEAR_2; INSERT_INSERT; INSERT_AC]` +~collinear {v0, vc, va} ==> ~( v0 = vc) /\ ~( v0 = va ) `) THEN +SIMP_TAC[NOT_2EQ_IMP_SIN_ARCV; NOT_EQ_IMPCOS_ARC] THEN +ONCE_REWRITE_TAC[COLLINEAR_TRANSABLE] THEN +REWRITE_TAC[GSYM NORM_CAUCHY_SCHWARZ_EQUAL] THEN +ONCE_REWRITE_TAC[VECTOR_ARITH` a = b <=> b - a = vec 0`] THEN +SIMP_TAC[ GSYM NORM_EQ_0] THEN ONCE_REWRITE_TAC[ GSYM DE_MORGAN_THM] THEN +REWRITE_TAC[GSYM REAL_ENTIRE] THEN SIMP_TAC[REAL_FIELD`~ ( c = &0 ) ==> +&1 - ( b / c ) pow 2 = ( c pow 2 - b pow 2) / c pow 2 `] THEN +SIMP_TAC[SQRT_SEPARATED] THEN SIMP_TAC[REAL_LE_MUL; NORM_POS_LE; POW_2_SQRT] THEN +SIMP_TAC[REAL_FIELD` x / (( b / a ) * ( c / aa )) = ( x * a * aa ) / ( b * c ) `] THEN +REWRITE_TAC[REAL_SUB_RDISTRIB; REAL_MUL_AC; REAL_ENTIRE; DE_MORGAN_THM] THEN +SIMP_TAC[REAL_FIELD` ~( a = &0 ) /\ ~( b = &0 ) +==> x / ( a * b ) * a * b * c = x * c `; +REAL_FIELD` ~( a = &0 ) /\ ~ ( b = &0 ) /\ ~ ( c = &0) ==> +x / ( a * c ) * y / ( b * c ) * a * b * c * c = x * y `] THEN +STRIP_TAC THEN EXPAND_TAC "va_v0p" THEN EXPAND_TAC "vb_v0p" THEN +REWRITE_TAC[COMPUTE_NORM_OF_P] THEN +REWRITE_TAC[ GSYM NORM_POW_2; REAL_ARITH` a pow 2 * b pow 2 = ( a * b ) pow 2`] THEN +ABBREV_TAC `vaa = ( va - (v0:real^N))` THEN +ABBREV_TAC `vbb = ( vb - (v0:real^N))` THEN +ABBREV_TAC `vcc = ( vc - (v0:real^N))` THEN +SIMP_TAC[MOVE_NORM_OUT_OF_SQRT; DOT_LSUB; DOT_RSUB] THEN +SIMP_TAC[MOVE_NORM_OUT_OF_SQRT; DOT_LSUB; DOT_RSUB; +DOT_LMUL; DOT_RMUL; DOT_SYM; GSYM NORM_POW_2] THEN +REWRITE_TAC[REAL_ARITH` ( a * b ) * a * c = a pow 2 * b * c `] THEN +REWRITE_TAC[REAL_FIELD` a / ( b * c ) = ( a / b ) / c `] THEN +MATCH_MP_TAC (MESON[]` a = b ==> a / c = b / c `) THEN +MATCH_MP_TAC (MESON[]` a = b ==> a / c = b / c `) THEN +REWRITE_TAC[REAL_ARITH` norm vcc pow 2 * norm vcc pow 2 * (vaa dot vbb) - +norm vcc pow 2 * (vbb dot vcc) * (vaa dot vcc) - +((vaa dot vcc) * norm vcc pow 2 * (vbb dot vcc) - +(vaa dot vcc) * (vbb dot vcc) * norm vcc pow 2) = +norm vcc pow 2 * ( norm vcc pow 2 * (vaa dot vbb) - (vaa dot vcc) * (vbb dot vcc) ) `] THEN +UNDISCH_TAC `~ ( norm (vcc:real^N) = &0 ) ` THEN CONV_TAC REAL_FIELD);; + + + + + + +let SIN_POW2_EQ_1_SUB_COS_POW2 = prove(` sin x pow 2 = &1 - cos x pow 2 `, +MP_TAC (SPEC_ALL SIN_CIRCLE) THEN REAL_ARITH_TAC);; + + + + +let LE_AND_NOT_0_EQ_LT = REAL_ARITH` &0 <= a /\ ~( a = &0 ) <=> &0 < a `;; + +let ABS_REFL = REAL_ABS_REFL;; +let LT_IMP_ABS_REFL = MESON[REAL_ABS_REFL; REAL_LT_IMP_LE]`&0 < a ==> abs a = a`;; + + +let ABS_MUL = REAL_ABS_MUL;; +let NOT_COLLINEAR_IMP_NOT_SIN0 = prove(`~collinear {v0, va, vb} ==> ~(sin ( arcV v0 va vb ) = &0)`, +SIMP_TAC[] THEN NHANH (MESON[INSERT_AC; COLLINEAR_2]` ~collinear {v0, va, vb} +==> ~( v0 = va ) /\ ~(v0 = vb) `) THEN +SIMP_TAC[NOT_2EQ_IMP_SIN_ARCV] THEN +ONCE_REWRITE_TAC[VECTOR_ARITH` a = b <=> b - a = vec 0 `] THEN +SIMP_TAC[ GSYM NORM_POS_LT] THEN +STRIP_TAC THEN +MATCH_MP_TAC (MESON[SQRT_EQ_0]` &0 <= x /\ ~( x = &0 ) ==> ~( sqrt x = &0 ) `) THEN +DOWN_TAC THEN +ONCE_REWRITE_TAC[ COLLINEAR_TRANSABLE ] THEN +REWRITE_TAC[ GSYM NORM_CAUCHY_SCHWARZ_EQUAL; ABS_NOT_EQ_NORM_MUL; +LE_AND_NOT_0_EQ_LT ] THEN +SIMP_TAC[REAL_FIELD`&0 < a /\ &0 < aa ==> &1 - ( b / ( a * aa )) pow 2 += ( ( a * aa ) pow 2 - b pow 2 ) / ( a * aa ) pow 2 `] THEN +STRIP_TAC THEN +MATCH_MP_TAC (SPEC_ALL REAL_LT_DIV) THEN +REWRITE_TAC[REAL_SUB_LT; GSYM REAL_LT_SQUARE_ABS] THEN +ONCE_REWRITE_TAC[REAL_ARITH` &0 = &0 pow 2 `] THEN +DOWN_TAC THEN +REWRITE_TAC[REAL_SUB_LT; GSYM REAL_LT_SQUARE_ABS; REAL_ABS_0; +ABS_MUL] THEN +SIMP_TAC[LT_IMP_ABS_REFL; REAL_LT_MUL ]);; +let REAL_LE_LDIV = +MESON[REAL_LE_LDIV_EQ; REAL_MUL_LID]` +! x z. &0 < z /\ x <= z ==> x / z <= &1 `;; +let NOT_IDEN_IMP_ABS_LE = prove(`~(v0 = va) /\ ~(v0 = vb) +==> abs (((va - v0) dot (vb - v0)) / (norm (va - v0) * norm (vb - v0))) <= +&1`, ONCE_REWRITE_TAC[VECTOR_ARITH` a = b <=> b - a = vec 0`] THEN +SIMP_TAC[REAL_ABS_DIV; REAL_ABS_MUL; REAL_ABS_NORM; GSYM NORM_POS_LT] THEN +STRIP_TAC THEN MATCH_MP_TAC REAL_LE_LDIV +THEN ASM_SIMP_TAC[REAL_LT_MUL; REAL_MUL_LID; +REAL_DIV_1; NORM_CAUCHY_SCHWARZ_ABS]);; + +let ABS_1 = REAL_ABS_1;; +let PROVE_SIN_LE = prove(`~(v0 = va) /\ ~(v0 = vb) ==> &0 <= sin ( arcV v0 va vb )`, +SIMP_TAC[NOT_2EQ_IMP_SIN_ARCV; arcV] THEN +NGOAC THEN NHANH (NOT_IDEN_IMP_ABS_LE ) THEN +SIMP_TAC[ABS_LE_1_IMP_SIN_ACS] THEN STRIP_TAC THEN MATCH_MP_TAC SQRT_POS_LE THEN +DOWN_TAC THEN ONCE_REWRITE_TAC[ GSYM ABS_1] THEN +ASM_SIMP_TAC[REAL_SUB_LE; GSYM ABS_1; REAL_LE_SQUARE_ABS] THEN +SIMP_TAC[REAL_ARITH`( &1 ) pow 2 = &1`; ABS_1]);; + + + +let MUL_POW2 = REAL_ARITH` (a*b) pow 2 = a pow 2 * b pow 2 `;; + + + + +let COMPUTE_SIN_DIVH_POW2 = prove(`! (v0: real^N) va vb vc. +let betaa = dihV v0 vc va vb in +let a = arcV v0 vc vb in +let b = arcV v0 vc va in +let c = arcV v0 va vb in +let p = +&1 - cos a pow 2 - cos b pow 2 - cos c pow 2 + +&2 * cos a * cos b * cos c in +~collinear {v0, vc, va} /\ ~collinear {v0, vc, vb} ==> +( sin betaa ) pow 2 = p / ((sin a * sin b) pow 2) `, + +REPEAT STRIP_TAC THEN MP_TAC (SPEC_ALL RLXWSTK ) THEN +REPEAT LET_TAC THEN SIMP_TAC[SIN_POW2_EQ_1_SUB_COS_POW2 ] THEN +REPEAT STRIP_TAC THEN REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN +NHANH (NOT_COLLINEAR_IMP_NOT_SIN0) THEN +EXPAND_TAC "a" THEN EXPAND_TAC "b" THEN PHA THEN +SIMP_TAC[REAL_FIELD` ~( a = &0 ) /\ ~ ( b = &0 ) ==> +&1 - ( x / ( a * b )) pow 2 = (( a * b ) pow 2 - x pow 2 ) / (( a * b ) pow 2 ) `] THEN +ASM_SIMP_TAC[] THEN STRIP_TAC THEN +MATCH_MP_TAC (MESON[]` a = b ==> a / x = b / x `) THEN +EXPAND_TAC "p" THEN SIMP_TAC[MUL_POW2; SIN_POW2_EQ_1_SUB_COS_POW2] THEN +REAL_ARITH_TAC);; + + + + +let PROVE_P_LE = prove(`!(v0:real^N) va vb vc. +let a = arcV v0 vc vb in +let b = arcV v0 vc va in +let c = arcV v0 va vb in +let p = +&1 - cos a pow 2 - cos b pow 2 - cos c pow 2 + +&2 * cos a * cos b * cos c in +~collinear {v0, vc, va} /\ ~collinear {v0, vc, vb} ==> &0 <= p`, +REPEAT GEN_TAC THEN MP_TAC (SPEC_ALL COMPUTE_SIN_DIVH_POW2 ) THEN +REPEAT LET_TAC THEN REWRITE_TAC[MESON[]` ( a ==> b ) ==> a ==> c <=> +a /\ b ==> c `] THEN NHANH (NOT_COLLINEAR_IMP_NOT_SIN0) THEN +ASM_SIMP_TAC[] THEN STRIP_TAC THEN FIRST_X_ASSUM MP_TAC THEN +ASM_SIMP_TAC[REAL_FIELD` ~( a = &0 ) /\ ~( b = &0 ) ==> +( x = y / ( a * b ) pow 2 <=> x * ( a * b ) pow 2 = y ) `] THEN +MESON_TAC[GSYM MUL_POW2; REAL_LE_POW_2]);; + + +let POW2_COND = MESON[REAL_ABS_REFL; REAL_LE_SQUARE_ABS]` ! a b. &0 <= a /\ &0 <= b ==> +( a <= b <=> a pow 2 <= b pow 2 ) `;; + + +let EQ_POW2_COND = prove(`!a b. &0 <= a /\ &0 <= b ==> (a = b <=> a pow 2 = b pow 2)`, +REWRITE_TAC[REAL_ARITH` a = b <=> a <= b /\ b <= a `] THEN SIMP_TAC[POW2_COND]);; + +let NOT_COLLINEAR_IMP_2_UNEQUAL = MESON[INSERT_INSERT; COLLINEAR_2; INSERT_AC]` +~collinear {v0, va, vb} ==> ~(v0 = va) /\ ~(v0 = vb) `;; + + +let NOT_COLL_IM_SIN_LT = prove(`~collinear {v0, va, vb} ==> &0 < sin (arcV v0 va vb)`, +REWRITE_TAC[GSYM LE_AND_NOT_0_EQ_LT] THEN +NHANH (NOT_COLLINEAR_IMP_2_UNEQUAL ) THEN +SIMP_TAC[NOT_COLLINEAR_IMP_NOT_SIN0; PROVE_SIN_LE]);; + +let ARC_SYM = prove(` arcV v0 vc vb = arcV v0 vb vc `, +SIMP_TAC[arcV; DOT_SYM; REAL_MUL_SYM]);; + + +let DIV_POW2 = REAL_FIELD` ( a / b ) pow 2 = a pow 2 / b pow 2 `;; + + +ONCE_REWRITE_RULE[GSYM CONTRAPOS_THM] ALLEMI_COLLINEAR;; + +let SIN_MUL_EXPAND = prove(` !(v0:real^N) va vb vc. +let gam = dihV v0 vc va vb in +let bet = dihV v0 vb vc va in +let a = arcV v0 vc vb in +let b = arcV v0 vc va in +let c = arcV v0 va vb in +let p = +&1 - cos a pow 2 - cos b pow 2 - cos c pow 2 + +&2 * cos a * cos b * cos c in +~collinear {v0, vc, va} /\ ~collinear {v0, vc, vb} /\ +~ collinear {v0,va,vb} ==> +sin gam * sin bet = p / ( sin b * sin c * ( sin a pow 2 )) `, +REPEAT GEN_TAC THEN +MP_TAC (COMPUTE_SIN_DIVH_POW2) THEN +REPEAT LET_TAC THEN +REPEAT STRIP_TAC THEN +MATCH_MP_TAC (MESON[EQ_POW2_COND]` &0 <= a /\ &0 <= b /\ a pow 2 = b pow 2 +==> a = b `) THEN +CONJ_TAC THENL [ REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN +EXPAND_TAC "gam" THEN EXPAND_TAC "betaa" THEN +EXPAND_TAC "bet" THEN REWRITE_TAC[dihV] THEN LET_TR THEN +NHANH (ONCE_REWRITE_RULE[GSYM CONTRAPOS_THM] ALLEMI_COLLINEAR) THEN +ONCE_REWRITE_TAC[SET_RULE` {a,b} = {b,a}`] THEN +NHANH (ONCE_REWRITE_RULE[GSYM CONTRAPOS_THM] ALLEMI_COLLINEAR) THEN +ONCE_REWRITE_TAC[VECTOR_ARITH ` a = b <=> vec 0 = a - b `] THEN +REPEAT STRIP_TAC THEN MATCH_MP_TAC REAL_LE_MUL THEN +ASM_SIMP_TAC[PROVE_SIN_LE]; REWRITE_TAC[]] THEN +CONJ_TAC THENL [MP_TAC (SPEC_ALL PROVE_P_LE ) THEN +REPEAT LET_TAC THEN +DOWN_TAC THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +STRIP_TAC THEN +FIRST_X_ASSUM MP_TAC THEN +ASM_SIMP_TAC[] THEN +MATCH_MP_TAC (MESON[]` (! a. a = b ==> &0 <= a ==> P a ) +==> &0 <= b ==> P b `) THEN +GEN_TAC THEN STRIP_TAC THEN +UNDISCH_TAC `~collinear {v0, vc, (vb: real^N)}` THEN +UNDISCH_TAC `~collinear {v0, vc, (va: real^N)}` THEN +UNDISCH_TAC `~collinear {v0, va, (vb: real^N)}` THEN +NHANH (NOT_COLL_IM_SIN_LT ) THEN +NHANH (REAL_LT_IMP_LE) THEN +REPEAT STRIP_TAC THEN +MATCH_MP_TAC REAL_LE_DIV THEN +ASM_SIMP_TAC[REAL_LE_MUL; REAL_LE_POW_2]; REWRITE_TAC[]] THEN +EXPAND_TAC "gam" THEN EXPAND_TAC "betaa" THEN EXPAND_TAC "bet" THEN +SIMP_TAC[MUL_POW2] THEN +REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN +PHA THEN +FIRST_X_ASSUM MP_TAC THEN +SIMP_TAC[] THEN +DISCH_TAC THEN +ONCE_REWRITE_TAC[SET_RULE` {a,b} = {b,a}`] THEN +FIRST_X_ASSUM MP_TAC THEN +SIMP_TAC[] THEN +REWRITE_TAC[REAL_FIELD` a / x * aa / y = ( a * aa ) / ( x * y ) `] THEN +REPEAT STRIP_TAC THEN +ASM_SIMP_TAC[ARC_SYM] THEN +ONCE_REWRITE_TAC[ARC_SYM] THEN +ASM_SIMP_TAC[] THEN +SIMP_TAC[DIV_POW2; REAL_ARITH` ((sin a * sin b) pow 2 * (sin c * sin a) pow 2) = +(sin b * sin c * sin a pow 2) pow 2 `] THEN +MATCH_MP_TAC (MESON[]` a = b ==> a / x = b / x `) THEN +EXPAND_TAC "p'" THEN +EXPAND_TAC "p" THEN +EXPAND_TAC "a" THEN +EXPAND_TAC "b" THEN +EXPAND_TAC "c" THEN +EXPAND_TAC "a'" THEN +EXPAND_TAC "b'" THEN +EXPAND_TAC "c'" THEN +SIMP_TAC[ARC_SYM] THEN +REAL_ARITH_TAC);; + +(* +let DIHV_SYM = prove(`dihV a b x y = dihV a b y x `, +REWRITE_TAC[dihV] THEN LET_TR THEN SIMP_TAC[DOT_SYM; ARC_SYM]);; +replaced Feb 13, 2013. Merged with version in Multivariate/flyspeck.ml. +*) + +let DIHV_SYM = prove + (`!v0 v1 v2 v3:real^N. + dihV v0 v1 v3 v2 = dihV v0 v1 v2 v3`, + REPEAT GEN_TAC THEN REWRITE_TAC[DIHV] THEN + CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN + REWRITE_TAC[DOT_SYM; ANGLE_SYM]);; + + +(* lemma 17 *) + +(* (* redone below *) +let NLVWBBW = prove(` !(v0:real^N) va vb vc. +let al = dihV v0 va vb vc in +let ga = dihV v0 vc va vb in +let be = dihV v0 vb vc va in +let a = arcV v0 vc vb in +let b = arcV v0 vc va in +let c = arcV v0 va vb in +let p = +&1 - cos a pow 2 - cos b pow 2 - cos c pow 2 + +&2 * cos a * cos b * cos c in +~collinear {v0, vc, va} /\ ~collinear {v0, vc, vb} /\ +~ collinear {v0,va,vb} ==> +cos c * sin al * sin be = cos ga + cos al * cos be `, +REPEAT GEN_TAC THEN MP_TAC RLXWSTK THEN REPEAT LET_TAC THEN +EXPAND_TAC "al" THEN EXPAND_TAC "be" THEN EXPAND_TAC "ga" THEN +EXPAND_TAC "gam" THEN SIMP_TAC[INSERT_AC] THEN STRIP_TAC THEN +MP_TAC SIN_MUL_EXPAND THEN REPEAT LET_TAC THEN EXPAND_TAC "bet" THEN +SIMP_TAC[INSERT_AC; DIHV_SYM; ARC_SYM] THEN +ONCE_REWRITE_TAC[MESON[DIHV_SYM]` aa * sin (dihV v0 va vb vc) * sin (dihV v0 vb va vc) = +aa * sin (dihV v0 va vc vb) * sin (dihV v0 vb vc va)`] THEN +DISCH_TAC THEN ONCE_REWRITE_TAC[MESON[INSERT_AC]`~collinear {v0, va, vc} /\ +~collinear {v0, vb, vc} /\ ~collinear {v0, va, vb} <=> +~collinear {v0, vc, va} /\ ~collinear {v0, vb, va} /\ +~collinear {v0, vc, vb} `] THEN FIRST_X_ASSUM MP_TAC THEN +SIMP_TAC[] THEN DOWN_TAC THEN SIMP_TAC[ARC_SYM; DIHV_SYM] THEN +STRIP_TAC THEN REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN +NHANH (NOT_COLLINEAR_IMP_NOT_SIN0) THEN ASM_SIMP_TAC[ARC_SYM] THEN +REPEAT STRIP_TAC THEN UNDISCH_TAC `~( sin a = &0 )` THEN +UNDISCH_TAC `~( sin b = &0 )` THEN UNDISCH_TAC `~( sin c = &0 )` THEN +PHA THEN SIMP_TAC[REAL_FIELD `~(c = &0) /\ ~(b = &0) /\ ~(a = &0) +==> x / (a * b) + y / (b * c) * z / (c * a) = ( x * c pow 2 + y * z ) / ( b * a * c pow 2 ) `] THEN +STRIP_TAC THEN REWRITE_TAC[REAL_ARITH` a * ( x / y ) = ( a * x ) / y `] THEN +MATCH_MP_TAC (MESON[]` a = b ==> a / x = b / x `) THEN +SIMP_TAC[SIN_POW2_EQ_1_SUB_COS_POW2] THEN REAL_ARITH_TAC);; +*) + +(* tchales removed extraneous p from statement *) + +let NLVWBBW = prove(` !(v0:real^N) va vb vc. +let al = dihV v0 va vb vc in +let ga = dihV v0 vc va vb in +let be = dihV v0 vb vc va in +let a = arcV v0 vc vb in +let b = arcV v0 vc va in +let c = arcV v0 va vb in +~collinear {v0, vc, va} /\ ~collinear {v0, vc, vb} /\ +~ collinear {v0,va,vb} ==> +cos c * sin al * sin be = cos ga + cos al * cos be `, +REPEAT GEN_TAC THEN MP_TAC RLXWSTK THEN REPEAT LET_TAC THEN +EXPAND_TAC "al" THEN EXPAND_TAC "be" THEN EXPAND_TAC "ga" THEN +EXPAND_TAC "gam" THEN SIMP_TAC[INSERT_AC] THEN STRIP_TAC THEN +MP_TAC SIN_MUL_EXPAND THEN REPEAT LET_TAC THEN EXPAND_TAC "bet" THEN +SIMP_TAC[INSERT_AC; DIHV_SYM; ARC_SYM] THEN +ONCE_REWRITE_TAC[MESON[DIHV_SYM]` aa * sin (dihV v0 va vb vc) * sin (dihV v0 vb va vc) = +aa * sin (dihV v0 va vc vb) * sin (dihV v0 vb vc va)`] THEN +DISCH_TAC THEN ONCE_REWRITE_TAC[MESON[INSERT_AC]`~collinear {v0, va, vc} /\ +~collinear {v0, vb, vc} /\ ~collinear {v0, va, vb} <=> +~collinear {v0, vc, va} /\ ~collinear {v0, vb, va} /\ +~collinear {v0, vc, vb} `] THEN FIRST_X_ASSUM MP_TAC THEN +SIMP_TAC[] THEN DOWN_TAC THEN SIMP_TAC[ARC_SYM; DIHV_SYM] THEN +STRIP_TAC THEN REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN +NHANH (NOT_COLLINEAR_IMP_NOT_SIN0) THEN ASM_SIMP_TAC[ARC_SYM] THEN +REPEAT STRIP_TAC THEN UNDISCH_TAC `~( sin a = &0 )` THEN +UNDISCH_TAC `~( sin b = &0 )` THEN UNDISCH_TAC `~( sin c = &0 )` THEN +PHA THEN SIMP_TAC[REAL_FIELD `~(c = &0) /\ ~(b = &0) /\ ~(a = &0) +==> x / (a * b) + y / (b * c) * z / (c * a) = ( x * c pow 2 + y * z ) / ( b * a * c pow 2 ) `] THEN +STRIP_TAC THEN REWRITE_TAC[REAL_ARITH` a * ( x / y ) = ( a * x ) / y `] THEN +MATCH_MP_TAC (MESON[]` a = b ==> a / x = b / x `) THEN +SIMP_TAC[SIN_POW2_EQ_1_SUB_COS_POW2] THEN REAL_ARITH_TAC);; + + +let COMPUTE_NORM_POW2 = prove(` +norm ((vc dot vc) % vb - (vb dot vc) % vc ) pow 2 = ((norm vc pow 2 + norm vc pow 2) - dist (vc,vc) pow 2) / &2 * +(((norm vc pow 2 + norm vc pow 2) - dist (vc,vc) pow 2) / &2 * +((norm vb pow 2 + norm vb pow 2) - dist (vb,vb) pow 2) / &2 - +((norm vb pow 2 + norm vc pow 2) - dist (vb,vc) pow 2) / &2 * +((norm vb pow 2 + norm vc pow 2) - dist (vb,vc) pow 2) / &2) - +((norm vb pow 2 + norm vc pow 2) - dist (vb,vc) pow 2) / &2 * +(((norm vc pow 2 + norm vc pow 2) - dist (vc,vc) pow 2) / &2 * +((norm vc pow 2 + norm vb pow 2) - dist (vc,vb) pow 2) / &2 - +((norm vb pow 2 + norm vc pow 2) - dist (vb,vc) pow 2) / &2 * +((norm vc pow 2 + norm vc pow 2) - dist (vc,vc) pow 2) / &2) `, +MATCH_MP_TAC (MESON[]`(! c. c = b ==> a = c ) ==> a = b`) THEN REPEAT STRIP_TAC THEN +SIMP_TAC[NORM_POW_2] THEN SIMP_TAC[GSYM dist; +VECTOR_SUB_RZERO; DOT_LSUB; DOT_RSUB; DOT_LMUL; +DOT_RMUL; DOT_NORM_NEG] THEN ASM_SIMP_TAC[]);; + + +let UPS_X_AND_HERON = prove(`ups_x (x1 pow 2) (x2 pow 2) (x6 pow 2) = +(x1 + x2 + x6) * (x1 + x2 - x6) * (x2 + x6 - x1) * (x6 + x1 - x2)`, +SIMP_TAC[ups_x] THEN REAL_ARITH_TAC);; + + +let UPS_X_POS = prove(`dist (v0,v1) pow 2 = v01 /\ +dist (v0,v2) pow 2 = v02 /\ +dist (v1,v2) pow 2 = v12 +==> &0 <= ups_x v01 v02 v12`, +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +SIMP_TAC[UPS_X_AND_HERON] THEN +DISCH_TAC THEN +MATCH_MP_TAC REAL_LE_MUL THEN +SIMP_TAC[DIST_POS_LE; REAL_LE_ADD] THEN +MATCH_MP_TAC REAL_LE_MUL THEN +CONJ_TAC THENL [ +MESON_TAC[ONCE_REWRITE_RULE[REAL_ARITH` a <= b + c <=> &0 <= b + c - a `] +DIST_TRIANGLE; DIST_SYM; DIST_POS_LE]; +MATCH_MP_TAC REAL_LE_MUL] THEN +MESON_TAC[ONCE_REWRITE_RULE[REAL_ARITH` a <= b + c <=> &0 <= b + c - a `] +DIST_TRIANGLE; DIST_SYM; DIST_POS_LE]);; + + +let DIST_TRANSABLE = prove(` dist ( a - v0, b ) = dist ( a , b + v0 ) `, +REWRITE_TAC[dist; VECTOR_ARITH` a - v0 - b = (a:real^N) - ( b + v0 ) `]);; + +prove(` v2 - v0 = va /\ +v3 - v0 = vb ==> dist (va,vb) = dist ( v2,v3) `, +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +SIMP_TAC[DIST_TRANSABLE; VECTOR_ARITH` a - b + b = ( a:real^N)`]);; + +let REAL_LE_SQUARE_POW = +MESON[REAL_POW_2; REAL_LE_SQUARE]`! x. &0 <= x pow 2 `;; + + +(* +g ` dist ((v0:real^N),v1) pow 2 = v01 /\ +dist (v0,v2) pow 2 = v02 /\ +dist (v0,v3) pow 2 = v03 /\ +dist (v1,v2) pow 2 = v12 /\ +dist (v1,v3) pow 2 = v13 /\ +dist (v2,v3) pow 2 = v23 /\ +~collinear {v0, v1, v2} /\ +~collinear {v0, v1, v3} +==> (let va = v2 - v0 in +let vb = v3 - v0 in +let vc = v1 - v0 in +let vap = (vc dot vc) % va - (va dot vc) % vc in +let vbp = (vc dot vc) % vb - (vb dot vc) % vc in +(((vap - vec 0) dot (vbp - vec 0)) / +(norm (vap - vec 0) * norm (vbp - vec 0)))) = +(delta_x4 v01 v02 v03 v23 v13 v12 / +sqrt (ups_x v01 v02 v12 * ups_x v01 v03 v13))`;; + +e (REPEAT LET_TAC THEN STRIP_TAC);; +e (EXPAND_TAC "vap" THEN EXPAND_TAC "vbp");; +e (ONCE_REWRITE_TAC[MESON[NORM_POS_LE; POW_2_SQRT]` norm x = sqrt ( norm x pow 2 ) `] THEN REWRITE_TAC[MESON[REAL_LE_POW_2; SQRT_MUL]` sqrt ( x pow 2 ) * sqrt ( y pow 2 ) = sqrt ( x pow 2 * y pow 2 ) `]);; +e (SIMP_TAC[VECTOR_SUB_RZERO; COMPUTE_NORM_POW2 ] THEN REWRITE_TAC[GSYM (MESON[NORM_POS_LE; POW_2_SQRT]` norm x = sqrt ( norm x pow 2 ) `)] THEN REWRITE_TAC[DIST_REFL; REAL_SUB_RZERO; REAL_ARITH` &0 pow 2 = &0`] THEN EXPAND_TAC "va" THEN EXPAND_TAC "vb" THEN EXPAND_TAC "vc" THEN SIMP_TAC[VECTOR_ARITH` a - b - (c - b ) = a -(c:real^N)`; GSYM dist] THEN FIRST_X_ASSUM MP_TAC);; + e (NHANH (MESON[COLLINEAR_2; INSERT_INSERT]` ~ collinear {a,b,c} ==> ~( a = b ) `) THEN REWRITE_TAC[DIST_NZ] THEN NHANH (REAL_FIELD` &0 < a ==> &1 = ( &1 / &4 * (a pow 2 ))/ ( &1 / &4 * (a pow 2 )) `) THEN ONCE_REWRITE_TAC[MESON[REAL_MUL_LID]` l ==> a = b <=> l ==> a = &1 * b `]);; +e (ABBREV_TAC ` as = (&1 / &4 * dist ((v0:real^N),v1) pow 2 ) ` THEN SIMP_TAC[REAL_FIELD` a / b * aa / bb = ( a * aa ) / ( b * bb ) `] THEN STRIP_TAC THEN MATCH_MP_TAC (MESON[]` a = aa /\ b = bb ==> a / b = aa / bb `));; +e (CONJ_TAC THENL [ SIMP_TAC[GSYM NORM_POW_2; GSYM dist] THEN ASM_SIMP_TAC[] THEN SIMP_TAC[DIST_SYM; DOT_LSUB; DOT_RSUB; DOT_LMUL; DOT_RMUL] THEN SIMP_TAC[DOT_NORM_NEG] THEN EXPAND_TAC "va" THEN EXPAND_TAC "vb" THEN EXPAND_TAC "vc" THEN REWRITE_TAC[ VECTOR_ARITH` a - b - ( c - b ) = a - (c:real^N)`] THEN REWRITE_TAC[GSYM dist] THEN EXPAND_TAC "as" THEN UNDISCH_TAC `&1 / &4 * dist ((v0:real^N),v1) pow 2 = as` THEN FIRST_X_ASSUM MP_TAC THEN PHA THEN MATCH_MP_TAC (MESON[]` a ==> b ==> a `) THEN ASM_SIMP_TAC[DIST_SYM; DIST_REFL; delta_x4] THEN REAL_ARITH_TAC; UNDISCH_TAC`&1 / &4 * dist ((v0:real^N),v1) pow 2 = as`] THEN MP_TAC (SPEC ` dist ((v0:real^N),v1)` REAL_LE_POW_2) THEN PHA THEN NHANH (REAL_ARITH `&0 <= a /\ &1 / &4 * a = as ==> &0 <= as `) THEN REWRITE_TAC[MESON[POW_2_SQRT]` da /\ &0 <= a ==> p1 = a * p2 <=> da /\ &0 <= a ==> p1 = sqrt ( a pow 2 ) * p2 `] THEN DOWN_TAC THEN NHANH (MESON[UPS_X_POS; DIST_SYM ]`dist (v0,v1) pow 2 = v01 /\ dist (v0,v2) pow 2 = v02 /\ dist (v0,v3) pow 2 = v03 /\ dist (v1,v2) pow 2 = v12 /\ dist (v1,v3) pow 2 = v13 /\ dist (v2,v3) pow 2 = v23 /\ l ==> &0 <= ups_x v01 v02 v12 /\ &0 <= ups_x v01 v03 v13 `) THEN NHANH (REAL_LE_MUL));; +e (SIMP_TAC[REAL_LE_SQUARE_POW; GSYM SQRT_MUL] THEN STRIP_TAC THEN MATCH_MP_TAC (MESON[]` a = b ==> p a = p b `) THEN REPLICATE_TAC 6 (FIRST_X_ASSUM MP_TAC) THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN REPEAT STRIP_TAC THEN ASM_SIMP_TAC[DIST_SYM] THEN DOWN_TAC THEN NHANH (MESON[prove(` v2 - v0 = va /\ v3 - v0 = vb ==> dist (va,vb) = dist ( v2,v3) `, ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN SIMP_TAC[DIST_TRANSABLE; VECTOR_ARITH` a - b + b = ( a:real^N)`]); DIST_SYM]` v2 - v0 = va /\ v3 - v0 = vb /\ v1 - v0 = vc /\ l ==> dist (va,vb ) = dist (v2,v3) /\ dist (vb,vc) = dist(v1,v3) /\ dist (va,vc) = dist (v1,v2)`) THEN SIMP_TAC[ups_x] THEN STRIP_TAC THEN REAL_ARITH_TAC);; + +let PROVE_DELTA_OVER_SQRT_2UPS = top_thm();; +*) + +let PROVE_DELTA_OVER_SQRT_2UPS = prove_by_refinement( +` dist ((v0:real^N),v1) pow 2 = v01 /\ +dist (v0,v2) pow 2 = v02 /\ +dist (v0,v3) pow 2 = v03 /\ +dist (v1,v2) pow 2 = v12 /\ +dist (v1,v3) pow 2 = v13 /\ +dist (v2,v3) pow 2 = v23 /\ +~collinear {v0, v1, v2} /\ +~collinear {v0, v1, v3} +==> (let va = v2 - v0 in +let vb = v3 - v0 in +let vc = v1 - v0 in +let vap = (vc dot vc) % va - (va dot vc) % vc in +let vbp = (vc dot vc) % vb - (vb dot vc) % vc in +(((vap - vec 0) dot (vbp - vec 0)) / +(norm (vap - vec 0) * norm (vbp - vec 0)))) = +(delta_x4 v01 v02 v03 v23 v13 v12 / +sqrt (ups_x v01 v02 v12 * ups_x v01 v03 v13))`, + (* {{{ proof *) + [ + (REPEAT LET_TAC THEN STRIP_TAC); + (EXPAND_TAC "vap" THEN EXPAND_TAC "vbp"); + (ONCE_REWRITE_TAC[MESON[NORM_POS_LE; POW_2_SQRT]` norm x = sqrt ( norm x pow 2 ) `] THEN REWRITE_TAC[MESON[REAL_LE_POW_2; SQRT_MUL]` sqrt ( x pow 2 ) * sqrt ( y pow 2 ) = sqrt ( x pow 2 * y pow 2 ) `]); + (SIMP_TAC[VECTOR_SUB_RZERO; COMPUTE_NORM_POW2 ] THEN REWRITE_TAC[GSYM (MESON[NORM_POS_LE; POW_2_SQRT]` norm x = sqrt ( norm x pow 2 ) `)] THEN REWRITE_TAC[DIST_REFL; REAL_SUB_RZERO; REAL_ARITH` &0 pow 2 = &0`] THEN EXPAND_TAC "va" THEN EXPAND_TAC "vb" THEN EXPAND_TAC "vc" THEN SIMP_TAC[VECTOR_ARITH` a - b - (c - b ) = a -(c:real^N)`; GSYM dist] THEN FIRST_X_ASSUM MP_TAC); + (NHANH (MESON[COLLINEAR_2; INSERT_INSERT]` ~ collinear {a,b,c} ==> ~( a = b ) `) THEN REWRITE_TAC[DIST_NZ] THEN NHANH (REAL_FIELD` &0 < a ==> &1 = ( &1 / &4 * (a pow 2 ))/ ( &1 / &4 * (a pow 2 )) `) THEN ONCE_REWRITE_TAC[MESON[REAL_MUL_LID]` l ==> a = b <=> l ==> a = &1 * b `]); + (ABBREV_TAC ` as = (&1 / &4 * dist ((v0:real^N),v1) pow 2 ) ` THEN SIMP_TAC[REAL_FIELD` a / b * aa / bb = ( a * aa ) / ( b * bb ) `] THEN STRIP_TAC THEN MATCH_MP_TAC (MESON[]` a = aa /\ b = bb ==> a / b = aa / bb `)); + (CONJ_TAC THENL [ SIMP_TAC[GSYM NORM_POW_2; GSYM dist] THEN ASM_SIMP_TAC[] THEN SIMP_TAC[DIST_SYM; DOT_LSUB; DOT_RSUB; DOT_LMUL; DOT_RMUL] THEN SIMP_TAC[DOT_NORM_NEG] THEN EXPAND_TAC "va" THEN EXPAND_TAC "vb" THEN EXPAND_TAC "vc" THEN REWRITE_TAC[ VECTOR_ARITH` a - b - ( c - b ) = a - (c:real^N)`] THEN REWRITE_TAC[GSYM dist] THEN EXPAND_TAC "as" THEN UNDISCH_TAC `&1 / &4 * dist ((v0:real^N),v1) pow 2 = as` THEN FIRST_X_ASSUM MP_TAC THEN PHA THEN MATCH_MP_TAC (MESON[]` a ==> b ==> a `) THEN ASM_SIMP_TAC[DIST_SYM; DIST_REFL; delta_x4] THEN REAL_ARITH_TAC; UNDISCH_TAC`&1 / &4 * dist ((v0:real^N),v1) pow 2 = as`] THEN MP_TAC (SPEC ` dist ((v0:real^N),v1)` REAL_LE_POW_2) THEN PHA THEN NHANH (REAL_ARITH `&0 <= a /\ &1 / &4 * a = as ==> &0 <= as `) THEN REWRITE_TAC[MESON[POW_2_SQRT]` da /\ &0 <= a ==> p1 = a * p2 <=> da /\ &0 <= a ==> p1 = sqrt ( a pow 2 ) * p2 `] THEN DOWN_TAC THEN NHANH (MESON[UPS_X_POS; DIST_SYM ]`dist (v0,v1) pow 2 = v01 /\ dist (v0,v2) pow 2 = v02 /\ dist (v0,v3) pow 2 = v03 /\ dist (v1,v2) pow 2 = v12 /\ dist (v1,v3) pow 2 = v13 /\ dist (v2,v3) pow 2 = v23 /\ l ==> &0 <= ups_x v01 v02 v12 /\ &0 <= ups_x v01 v03 v13 `) THEN NHANH (REAL_LE_MUL)); + BY((SIMP_TAC[REAL_LE_SQUARE_POW; GSYM SQRT_MUL] THEN STRIP_TAC THEN MATCH_MP_TAC (MESON[]` a = b ==> p a = p b `) THEN REPLICATE_TAC 6 (FIRST_X_ASSUM MP_TAC) THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN REPEAT STRIP_TAC THEN ASM_SIMP_TAC[DIST_SYM] THEN DOWN_TAC THEN NHANH (MESON[prove(` v2 - v0 = va /\ v3 - v0 = vb ==> dist (va,vb) = dist ( v2,v3) `, ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN SIMP_TAC[DIST_TRANSABLE; VECTOR_ARITH` a - b + b = ( a:real^N)`]); DIST_SYM]` v2 - v0 = va /\ v3 - v0 = vb /\ v1 - v0 = vc /\ l ==> dist (va,vb ) = dist (v2,v3) /\ dist (vb,vc) = dist(v1,v3) /\ dist (va,vc) = dist (v1,v2)`) THEN SIMP_TAC[ups_x] THEN STRIP_TAC THEN REAL_ARITH_TAC)) + ]);; + (* }}} *) + +let FOR_LEMMA19 = prove(`!(v0:real^N) v1 v2 v3. +let ga = dihV v0 v1 v2 v3 in +let v01 = dist (v0,v1) pow 2 in +let v02 = dist (v0,v2) pow 2 in +let v03 = dist (v0,v3) pow 2 in +let v12 = dist (v1,v2) pow 2 in +let v13 = dist (v1,v3) pow 2 in +let v23 = dist (v2,v3) pow 2 in +~collinear {v0, v1, v2} /\ ~collinear {v0, v1, v3} +==> ga = +acs +(delta_x4 v01 v02 v03 v23 v13 v12 / +sqrt (ups_x v01 v02 v12 * ups_x v01 v03 v13))`, +REPEAT STRIP_TAC THEN REPEAT LET_TAC THEN EXPAND_TAC "ga" THEN +SIMP_TAC[dihV; arcV] THEN REPEAT LET_TAC THEN REPEAT STRIP_TAC THEN +MATCH_MP_TAC (MESON[]` a = b ==> p a = p b `) THEN MP_TAC +PROVE_DELTA_OVER_SQRT_2UPS THEN REPEAT LET_TAC THEN +ASM_MESON_TAC[]);; + + +let COMPUTE_DELTA_OVER = prove(`dist ((v0:real^N),v1) pow 2 = v01 /\ +dist (v0,v2) pow 2 = v02 /\ +dist (v0,v3) pow 2 = v03 /\ +dist (v1,v2) pow 2 = v12 /\ +dist (v1,v3) pow 2 = v13 /\ +dist (v2,v3) pow 2 = v23 /\ +~collinear {v0, v1, v2} /\ +~collinear {v0, v1, v3} +==> ((((v1 - v0) dot (v1 - v0)) % (v2 - v0) - +((v2 - v0) dot (v1 - v0)) % (v1 - v0)) dot +(((v1 - v0) dot (v1 - v0)) % (v3 - v0) - +((v3 - v0) dot (v1 - v0)) % (v1 - v0))) / +(norm +(((v1 - v0) dot (v1 - v0)) % (v2 - v0) - +((v2 - v0) dot (v1 - v0)) % (v1 - v0)) * +norm +(((v1 - v0) dot (v1 - v0)) % (v3 - v0) - +((v3 - v0) dot (v1 - v0)) % (v1 - v0))) = +delta_x4 v01 v02 v03 v23 v13 v12 / +sqrt (ups_x v01 v02 v12 * ups_x v01 v03 v13)`, +MP_TAC PROVE_DELTA_OVER_SQRT_2UPS THEN REWRITE_TAC[VECTOR_ARITH` a - vec 0 = a `] +THEN LET_TR THEN SIMP_TAC[]);; + + + + + + + + +let POS_COMPATIBLE_WITH_ATN2 = prove(` &0 < a ==> atn2 (x,y) = atn2 (a * x,a * y)`, +SIMP_TAC[atn2; REAL_FIELD` &0 < a ==> ( a * b ) / (a * c ) = b / c `] THEN +SIMP_TAC[ABS_MUL] THEN REWRITE_TAC[REAL_ARITH` a * y < &0 <=> &0 < a * ( -- y )`; +REAL_ARITH` b < &0 <=> &0 < -- b `] THEN +SIMP_TAC[ABS_MUL; LT_IMP_ABS_REFL; REAL_LT_LMUL_EQ; REAL_LT_MUL_EQ]);; + + + +let NOT_COLLINEAR_IMP_UPS_LT = prove( ` +~( collinear {(v0:real^3),v1,v2} ) ==> +let v01 = dist (v0,v1) pow 2 in +let v02 = dist (v0,v2) pow 2 in +let v12 = dist (v1,v2) pow 2 in +&0 < ups_x v01 v02 v12 `, +REPEAT (LET_TAC THEN (REPEAT STRIP_TAC)) THEN +REWRITE_TAC[REAL_ARITH `&0 < x <=> (&0 <= x /\ ~(x = &0))`] THEN +ASM_MESON_TAC[COL_EQ_UPS_0;UPS_X_POS]);; + +(* +let NOT_COLLINEAR_IMP_UPS_LT = New_axiom ` +~( collinear {(v0:real^N),v1,v2} ) ==> +let v01 = dist (v0,v1) pow 2 in +let v02 = dist (v0,v2) pow 2 in +let v12 = dist (v1,v2) pow 2 in +&0 < ups_x v01 v02 v12 `;; +*) + +(* Jason have proved the following lemma in the first half +of this file *) + +(* +let acs_atn2_t = `!y. (-- &1 <= y /\ y <= &1) ==> (acs y = pi/(&2) - atn2(sqrt(&1 - y pow 2),y))`;; +let acs_atn2 = new_axiom acs_atn2_t;; +*) + +let REAL_LT_DIV_0 = prove(` ! a b. &0 < b ==> ( &0 < a / b <=> &0 < a ) `, +REPEAT STRIP_TAC THEN EQ_TAC THENL +[ASSUME_TAC (UNDISCH (SPEC `b:real` REAL_LT_IMP_NZ)) THEN +ASM_MESON_TAC[REAL_LT_MUL; REAL_DIV_LMUL]; +ASM_SIMP_TAC[REAL_LT_DIV]]);; + +let REAL_LE_RDIV_0 = prove(` ! a b. &0 < b ==> ( &0 <= a / b <=> &0 <= a ) `, +REWRITE_TAC[REAL_ARITH ` &0 <= a <=> &0 < a \/ a = &0 `] THEN +SIMP_TAC[REAL_LT_DIV_0] THEN +SIMP_TAC[REAL_FIELD `&0 < b ==> ( a / b = &0 <=> a = &0 ) `]);; + +let POW_2 = REAL_POW_2;; + +let NOT_ZERO_EQ_POW2_LT = prove(` ~( a = &0 ) <=> &0 < a pow 2 `, +SIMP_TAC[GSYM LE_AND_NOT_0_EQ_LT; POW_2; +REAL_ENTIRE; REAL_LE_SQUARE]);; + +(* lemma 18 *) +let OJEKOJF = prove(`!(v0:real^3) v1 v2 v3. + let ga = dihV v0 v1 v2 v3 in + let v01 = dist (v0,v1) pow 2 in + let v02 = dist (v0,v2) pow 2 in + let v03 = dist (v0,v3) pow 2 in + let v12 = dist (v1,v2) pow 2 in + let v13 = dist (v1,v3) pow 2 in + let v23 = dist (v2,v3) pow 2 in + ~collinear {v0, v1, v2} /\ ~collinear {v0, v1, v3} + ==> ga = acs (delta_x4 v01 v02 v03 v23 v13 v12 / + sqrt (ups_x v01 v02 v12 * ups_x v01 v03 v13)) /\ + ga = pi / &2 - atn2( sqrt ( &4 * v01 * delta_x v01 v02 v03 v23 v13 v12 ), + delta_x4 v01 v02 v03 v23 v13 v12 ) `, +REPEAT STRIP_TAC THEN +MP_TAC (SPEC_ALL (INST_TYPE [`:3`,`:N`] FOR_LEMMA19) ) THEN REPEAT LET_TAC THEN +SIMP_TAC[] THEN DOWN_TAC THEN NGOAC THEN +REWRITE_TAC[MESON[]`l/\ ( a ==> b ) <=>( a ==> b ) /\ l `] THEN PHA THEN +NHANH (COMPUTE_DELTA_OVER ) THEN +NHANH (ONCE_REWRITE_RULE[GSYM CONTRAPOS_THM] ALLEMI_COLLINEAR) THEN +ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN +ABBREV_TAC ` (w1:real^3) = ((v1 - v0) dot (v1 - v0)) % (v2 - v0) -((v2 - v0) dot (v1 - v0)) % (v1 - v0)` THEN +ABBREV_TAC ` (w2:real^3) = ((v1 - v0) dot (v1 - v0)) % (v3 - v0) -((v3 - v0) dot (v1 - v0)) % (v1 - v0) ` THEN +ONCE_REWRITE_TAC[MESON[]`( a/\ b ) /\ c /\ d <=>a /\ c /\ b /\ d `] THEN +NHANH (NOT_VEC0_IMP_LE1) THEN PHA THEN +REWRITE_TAC[MESON[]` P a /\ a = b <=> a = b /\ P b `] THEN +SIMP_TAC[REAL_ABS_BOUNDS; acs_atn2; REAL_ARITH ` a - x =a - y <=> x = y `] THEN +NHANH (NOT_COLLINEAR_IMP_UPS_LT ) THEN +LET_TR THEN +PHA THEN +NHANH (MESON[REAL_LT_MUL]` &0 < x /\ a1 /\ &0 < y /\ a2 ==> &0 < x * y `) THEN +STRIP_TAC THEN FIRST_X_ASSUM MP_TAC THEN +ASM_SIMP_TAC[] THEN NHANH SQRT_POS_LT THEN +SIMP_TAC[MESON[POS_COMPATIBLE_WITH_ATN2]` &0 < a ==>atn2 ( x, y / a ) = atn2 ( a * x , a * ( y / a ) ) `] THEN +SIMP_TAC[REAL_FIELD` &0 < a ==> a * ( y / a ) = y `] THEN +REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN +PHA THEN NGOAC THEN REWRITE_TAC[GSYM REAL_ABS_BOUNDS] THEN +ONCE_REWRITE_TAC[GSYM ABS_1] THEN +SIMP_TAC[REAL_LE_SQUARE_ABS; REAL_ARITH` a <= &1 <=> &0 <= &1 - a `; REAL_ARITH` ( &1 ) pow 2 = &1 `; ABS_1] THEN +DAO THEN ONCE_REWRITE_TAC[GSYM IMP_IMP] THEN +SIMP_TAC[REAL_FIELD` &0 < a ==> &1 - ( b / a ) pow 2= ( a pow 2 - b pow 2 ) / ( a pow 2 ) `] THEN +NHANH (REAL_LT_IMP_NZ) THEN NHANH (REAL_LT_IMP_LE) THEN +SIMP_TAC[NOT_ZERO_EQ_POW2_LT; REAL_LE_RDIV_0 ; SQRT_DIV] THEN +NHANH (REAL_LT_IMP_LE) THEN SIMP_TAC[SQRT_DIV; REAL_LE_POW2] THEN +SIMP_TAC[SQRT_DIV; REAL_LE_POW2; POW_2_SQRT; REAL_FIELD` &0 < a ==>a * b / a = b `] THEN +REPEAT STRIP_TAC THEN +MATCH_MP_TAC(MESON[]` a = b ==> atn2 ( sqrt a, c ) = atn2 ( sqrt b, c ) `) THEN +ASM_SIMP_TAC[SQRT_WORKS; ups_x; delta_x4; delta_x] THEN +REAL_ARITH_TAC +);; + +(* Thales note: 2010-2-7, Here is N.Q. Truong's version that relied on an axiom. *) + +(* + +let OJEKOJF = prove(`!(v0:real^3) v1 v2 v3. +let ga = dihV v0 v1 v2 v3 in +let v01 = dist (v0,v1) pow 2 in +let v02 = dist (v0,v2) pow 2 in +let v03 = dist (v0,v3) pow 2 in +let v12 = dist (v1,v2) pow 2 in +let v13 = dist (v1,v3) pow 2 in +let v23 = dist (v2,v3) pow 2 in +~collinear {v0, v1, v2} /\ ~collinear {v0, v1, v3} +==> ga = acs (delta_x4 v01 v02 v03 v23 v13 v12 / +sqrt (ups_x v01 v02 v12 * ups_x v01 v03 v13)) /\ +ga = pi / &2 - atn2( sqrt ( &4 * v01 * delta_x v01 v02 v03 v23 v13 v12 ), +delta_x4 v01 v02 v03 v23 v13 v12 ) `, +REPEAT STRIP_TAC THEN +MP_TAC (SPEC_ALL FOR_LEMMA19 ) THEN REPEAT LET_TAC THEN +SIMP_TAC[] THEN DOWN_TAC THEN NGOAC THEN +REWRITE_TAC[MESON[]`l/\ ( a ==> b ) <=>( a ==> b ) /\ l `] THEN PHA THEN +NHANH (COMPUTE_DELTA_OVER ) THEN +NHANH (ONCE_REWRITE_RULE[GSYM CONTRAPOS_THM] ALLEMI_COLLINEAR) THEN +ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN +ABBREV_TAC ` (w1:real^3) = ((v1 - v0) dot (v1 - v0)) % (v2 - v0) - +((v2 - v0) dot (v1 - v0)) % (v1 - v0)` THEN +ABBREV_TAC ` (w2:real^3) = ((v1 - v0) dot (v1 - v0)) % (v3 - v0) - +((v3 - v0) dot (v1 - v0)) % (v1 - v0) ` THEN +ONCE_REWRITE_TAC[MESON[]`( a/\ b ) /\ c /\ d <=> +a /\ c /\ b /\ d `] THEN NHANH (NOT_VEC0_IMP_LE1) THEN PHA THEN +REWRITE_TAC[MESON[]` P a /\ a = b <=> a = b /\ P b `] THEN +SIMP_TAC[REAL_ABS_BOUNDS; acs_atn2; REAL_ARITH ` a - x = +a - y <=> x = y `] THEN NHANH (NOT_COLLINEAR_IMP_UPS_LT ) THEN +LET_TR THEN PHA THEN NHANH (MESON[REAL_LT_MUL]` &0 < x /\ a1 /\ &0 < y /\ a2 ==> +&0 < x * y `) THEN STRIP_TAC THEN FIRST_X_ASSUM MP_TAC THEN +ASM_SIMP_TAC[] THEN NHANH SQRT_POS_LT THEN +SIMP_TAC[MESON[POS_COMPATIBLE_WITH_ATN2]` &0 < a ==> +atn2 ( x, y / a ) = atn2 ( a * x , a * ( y / a ) ) `] THEN +SIMP_TAC[REAL_FIELD` &0 < a ==> a * ( y / a ) = y `] THEN +REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN +PHA THEN NGOAC THEN REWRITE_TAC[GSYM REAL_ABS_BOUNDS] THEN +ONCE_REWRITE_TAC[GSYM ABS_1] THEN +SIMP_TAC[REAL_LE_SQUARE_ABS; REAL_ARITH` a <= &1 <=> +&0 <= &1 - a `; REAL_ARITH` ( &1 ) pow 2 = &1 `; ABS_1] THEN +DAO THEN ONCE_REWRITE_TAC[GSYM IMP_IMP] THEN +SIMP_TAC[REAL_FIELD` &0 < a ==> &1 - ( b / a ) pow 2 += ( a pow 2 - b pow 2 ) / ( a pow 2 ) `] THEN +NHANH (REAL_LT_IMP_NZ) THEN NHANH (REAL_LT_IMP_LE) THEN +SIMP_TAC[NOT_ZERO_EQ_POW2_LT; REAL_LE_RDIV_0 ; SQRT_DIV] THEN +NHANH (REAL_LT_IMP_LE) THEN SIMP_TAC[SQRT_DIV; REAL_LE_POW2] THEN +SIMP_TAC[SQRT_DIV; REAL_LE_POW2; POW_2_SQRT; REAL_FIELD` &0 < a ==> +a * b / a = b `] THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC +(MESON[]` a = b ==> atn2 ( sqrt a, c ) = atn2 ( sqrt b, c ) `) THEN +ASM_SIMP_TAC[SQRT_WORKS; ups_x; delta_x4; delta_x] THEN +REAL_ARITH_TAC);; +*) + + + + +let LEMMA16_INTERPRETE = prove(`!(v0: real^N) va vb vc. +~collinear {v0, vc, va} /\ ~collinear {v0, vc, vb} +==> cos (dihV v0 vc va vb) = +(cos (arcV v0 va vb) - +cos (arcV v0 vc vb) * cos (arcV v0 vc va)) / +(sin (arcV v0 vc vb) * sin (arcV v0 vc va))`, +MP_TAC RLXWSTK THEN REPEAT LET_TAC THEN SIMP_TAC[]);; + + + +let NOT_COLLINEAR_IMP_VEC_FOR_DIHV = ONCE_REWRITE_RULE[GSYM VECTOR_SUB_EQ] +(ONCE_REWRITE_RULE[GSYM CONTRAPOS_THM] ALLEMI_COLLINEAR);; + +let ACS = ACS_BOUNDS;; +let NOT_COLLINEAR_IMP_DIHV_BOUNDED = prove( +` ~( collinear {v0,v1,v2} ) /\ ~( collinear {v0,v1,v3} ) +==> &0 <= dihV v0 v1 v2 v3 /\ dihV v0 v1 v2 v3 <= pi`, +REWRITE_TAC[dihV; arcV] THEN REPEAT LET_TAC THEN +NHANH (NOT_COLLINEAR_IMP_VEC_FOR_DIHV ) THEN +ASM_SIMP_TAC[VECTOR_SUB_RZERO] THEN +ONCE_REWRITE_TAC[MESON[]` ( a/\b) /\c /\d <=> +a /\c/\b/\d`] THEN NHANH (NOT_VEC0_IMP_LE1) THEN +SIMP_TAC[REAL_ABS_BOUNDS; ACS]) ;; + + + +let DIHV_FORMULAR = prove(` dihV v0 v1 v2 v3 = arcV (vec 0) +(((v1 - v0) dot (v1 - v0)) % (v2 - v0) - +((v2 - v0) dot (v1 - v0)) % (v1 - v0)) +(((v1 - v0) dot (v1 - v0)) % (v3 - v0) - +((v3 - v0) dot (v1 - v0)) % (v1 - v0)) `, REWRITE_TAC[dihV] +THEN REPEAT LET_TAC THEN REWRITE_TAC[]);; + + +let COS_POW2_INTER = prove(` cos x pow 2 = &1 - sin x pow 2 `, +MP_TAC (SPEC_ALL SIN_CIRCLE) THEN REAL_ARITH_TAC);; + +(* lemma 19 *) +(* +let ISTYLPH = prove(` ! (v0:real^N) v1 v2 v3. +&0 <= cos (arcV (v0:real^N) v2 v3) /\ +dihV v0 v3 v1 v2 = pi / &2 /\ +~ collinear {v0,v1,v2} /\ +~ collinear {v0,v1,v3} /\ +~ collinear {v0,v2,v3} /\ +psi = arcV v0 v2 v3 /\ +tte = arcV v0 v1 v2 ==> +dihV v0 v1 v2 v3 = beta psi tte `, +REPEAT GEN_TAC THEN +ONCE_REWRITE_TAC[MESON[]` a /\ b ==> c <=> +a ==> b ==> c `] THEN +DISCH_TAC THEN +ONCE_REWRITE_TAC[SET_RULE` {a,b} = {b,a} `] THEN +REWRITE_TAC[ MESON[]` a /\ b /\ c /\ d /\ e <=> +a /\ b /\ (c /\ d )/\ e`] THEN +NHANH (LEMMA16_INTERPRETE ) THEN +PURE_ONCE_REWRITE_TAC[MESON[]` a = b /\ P a <=> a = b +/\ P b `] THEN +SIMP_TAC[COS_PI2] THEN +NHANH (NOT_COLLINEAR_IMP_NOT_SIN0) THEN +PHA THEN +ONCE_REWRITE_TAC[MESON[REAL_ENTIRE]`~( a = &0 ) /\ a1 /\ ~( b = &0 ) /\ &0 = l /\ ll +<=> a1 /\ ~ ( b * a = &0 ) /\ &0 = l /\ ll`] THEN +ONCE_REWRITE_TAC[SET_RULE` {a,b} = {b,a} `] THEN +ONCE_REWRITE_TAC[MESON[]`a /\ ~( aa = &0 ) /\ b /\ c <=> +~( aa = &0 ) /\ c /\ a /\ b `] THEN +ABBREV_TAC `TU = sin (arcV v0 v3 v2) * sin (arcV v0 v3 (v1:real^N))` THEN +ABBREV_TAC `MA = (cos (arcV v0 v1 v2) - cos (arcV v0 v3 v2) * cos (arcV v0 v3 (v1:real^N)))` THEN +NHANH (MESON[REAL_FIELD`~( b = &0 ) /\ a / b = &0 ==> a = &0 `]` +~(TU = &0) /\ +&0 = MA / TU /\ ll ==> MA = &0 `) THEN +REWRITE_TAC[dihV;beta; arcV] THEN +REPEAT LET_TAC THEN +STRIP_TAC THEN +MATCH_MP_TAC (MESON[]` a = b ==> P a = P b `) THEN +REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN +NHANH ( NOT_COLLINEAR_IMP_VEC_FOR_DIHV ) THEN +ASM_SIMP_TAC[] THEN +PHA THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +SIMP_TAC[GSYM NOT_EQ_IMPCOS_ARC] THEN +DOWN_TAC THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +SIMP_TAC[] THEN +STRIP_TAC THEN +EXPAND_TAC "va" THEN +EXPAND_TAC "vb" THEN +EXPAND_TAC "vc" THEN +UNDISCH_TAC `vb' = v2 - (v0:real^N)` THEN +UNDISCH_TAC `va' = v1 - (v0:real^N)` THEN +UNDISCH_TAC `vc' = v3 - (v0:real^N)` THEN +PHA THEN SIMP_TAC[GSYM DIHV_FORMULAR] THEN +ASM_SIMP_TAC[LEMMA16_INTERPRETE] THEN +DISCH_TAC THEN +UNDISCH_TAC `&0 = MA ` THEN +ASM_SIMP_TAC[REAL_ARITH` &0 = a - b <=> a = b `; ARC_SYM; +REAL_ARITH` a * b * a = b * a pow 2 `] THEN +SIMP_TAC[COS_POW2_INTER; REAL_SUB_LDISTRIB; REAL_MUL_RID; +REAL_ARITH` a - ( a - b ) = b `] THEN +UNDISCH_TAC `~collinear {v0, v1,(v3:real^N)}` THEN +NHANH (NOT_COLLINEAR_IMP_NOT_SIN0) THEN +PHA THEN SIMP_TAC[REAL_FIELD` ~( a = &0 ) ==> +( b * a pow 2) / ( a * c ) = (b * a) / c `] THEN +UNDISCH_TAC` ~collinear {v0, v1, (v2:real^N)}` THEN +NHANH (NOT_COLL_IM_SIN_LT) THEN +NHANH (REAL_LT_IMP_LE) THEN +UNDISCH_TAC `&0 <= cos (arcV v0 v2 (v3:real^N))` THEN +PHA THEN +NHANH (MESON[REAL_LE_MUL; REAL_LE_DIV]` +&0 <= a1 /\aa /\aa1/\ +&0 <= a3 /\aa2/\aa3/\ +&0 <= a2 /\ lll ==> &0 <= ( a1 * a2 )/ a3 `) THEN +STRIP_TAC THEN +FIRST_X_ASSUM MP_TAC THEN +SIMP_TAC[MESON[POW_2_SQRT]`&0 <= a ==> ( a = b +<=> sqrt ( a pow 2 ) = b )`] THEN +STRIP_TAC THEN +MATCH_MP_TAC (MESON[]` a = b ==> P a = P b `) THEN +EXPAND_TAC "psi" THEN +EXPAND_TAC "tte" THEN +UNDISCH_TAC `va' = (vc:real^N)` THEN +UNDISCH_TAC `vb' = (va:real^N)` THEN +UNDISCH_TAC `vc' = (vb:real^N)` THEN +UNDISCH_TAC ` vb = v3 - v0 /\ vc = v1 - v0 /\ va = v2 - (v0 :real^N)` THEN +PHA THEN SIMP_TAC[GSYM arcV] THEN +STRIP_TAC THEN +SIMP_TAC[REAL_FIELD` ( a / b ) pow 2 = a pow 2 / b pow 2 `] THEN +MATCH_MP_TAC (MESON[]` a = b /\ aa = bb ==> a / aa += b / bb `) THEN +SIMP_TAC[SIN_POW2_EQ_1_SUB_COS_POW2; GSYM POW_2] THEN +SIMP_TAC[REAL_ARITH`(A * B ) pow 2 = A pow 2 * +B pow 2 `; SIN_POW2_EQ_1_SUB_COS_POW2] THEN +ASM_SIMP_TAC[] THEN REAL_ARITH_TAC);; +*) + + + + + + + + +let INTERS_SUBSET = SET_RULE` P a ==> INTERS { x | P x } SUBSET a `;; + +let AFFINE_SET_GENERARTED2 = prove(` affine {x | ? t. x = t % u + ( &1 - t ) % v } `, +REWRITE_TAC[affine; IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN +EXISTS_TAC `t * u' + (t':real) * v'` THEN FIRST_X_ASSUM MP_TAC THEN +SIMP_TAC[REAL_ARITH` a + b = c <=> a = c - b `] THEN +DISCH_TAC THEN ASM_SIMP_TAC[] THEN CONV_TAC VECTOR_ARITH);; + +let BASED_POINT2 = prove(` {(u:real^N),v} SUBSET {x | ? t. x = t % u + ( &1 - t ) % v } `, +SIMP_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_ELIM_THM] THEN CONJ_TAC THENL +[EXISTS_TAC ` &1 ` THEN CONV_TAC VECTOR_ARITH; EXISTS_TAC ` &0 `] THEN +CONV_TAC VECTOR_ARITH);; + +let AFFINE_AFF = prove(` affine ( aff s ) `, +SIMP_TAC[aff; AFFINE_AFFINE_HULL]);; + +let INSERT_EMPTY_SUBSET = prove(`(x INSERT s SUBSET t <=> x IN t /\ s SUBSET t) +/\ (!s. {} SUBSET s)`, SIMP_TAC[INSERT_SUBSET; EMPTY_SUBSET]);; + + + +let IN_P_HULL_INSERT = prove(`a IN P hull (a INSERT s)`, +MATCH_MP_TAC (SET_RULE` a IN A /\ A SUBSET P hull A ==> a IN P hull A `) THEN +SIMP_TAC[IN_INSERT; HULL_SUBSET]);; + +let UV_IN_AFF2 = MESON[INSERT_AC;IN_P_HULL_INSERT ]` +u IN affine hull {u,v}/\ v IN affine hull {u,v}`;; + + +let AFF2 = prove(` ! u (v:real^N). aff {u,v} = {x | ? t. x = t % u + ( &1 - t ) % v } `, +SIMP_TAC[GSYM SUBSET_ANTISYM_EQ] THEN REPEAT STRIP_TAC THENL +[SIMP_TAC[aff; hull] THEN MATCH_MP_TAC (INTERS_SUBSET) THEN +SIMP_TAC[BASED_POINT2 ;AFFINE_SET_GENERARTED2 ]; +SIMP_TAC[SUBSET; IN_ELIM_THM]] THEN REPEAT STRIP_TAC THEN +MP_TAC (MESON[AFFINE_AFF]` affine ( aff {u, (v:real^N)})`) THEN +ASM_SIMP_TAC[aff; affine] THEN +MESON_TAC[UV_IN_AFF2; REAL_RING` a + &1 - a = &1 `]);; + + +GEN_ALL (SPECL [`p - (v0:real^N)`;`(u:real^N) - v0 `] +VECTOR_SUB_PROJECT_ORTHOGONAL);; + +SPECL[` (u - (v:real^N))`;` (p:real^N)`] +VECTOR_SUB_PROJECT_ORTHOGONAL;; + + +let EXISTS_PROJECTING_POINT = prove( +`! (p:real^N) u v. ? pp. (u + pp ) IN aff {u,v} /\ (p - pp ) dot ( u - v ) = &0 `, +REPEAT STRIP_TAC THEN MP_TAC (SPECL[` (u - (v:real^N))`;` (p:real^N)`] +VECTOR_SUB_PROJECT_ORTHOGONAL) THEN STRIP_TAC THEN +EXISTS_TAC `((u - v) dot p) / ((u - v) dot (u - v)) % (u - (v:real^N))` THEN +ONCE_REWRITE_TAC[DOT_SYM] THEN +CONJ_TAC THENL [SIMP_TAC[AFF2; IN_ELIM_THM; VECTOR_ARITH` a + x % ( a - b ) = +(&1 + x ) % a + ( &1 - ( &1 + x )) % b `] THEN MESON_TAC[] ; +ASM_MESON_TAC[DOT_SYM]]);; + + +let UV_IN_AFF2_IMP_TRANSABLE = prove(`! v0 v1 u v. +u IN aff {v0,v1} /\ v IN aff {v0,v1} ==> +( ( u - v0 ) dot ( v1 - v0 )) * ( ( v - v0) dot ( v1 - v0 )) = +(( v1 - v0 ) dot ( v1 - v0 ) ) * ((u - v0 ) dot ( v - v0 )) `, +REPEAT GEN_TAC THEN REWRITE_TAC[AFF2; IN_ELIM_THM] THEN +STRIP_TAC THEN ASM_SIMP_TAC[VECTOR_ARITH`(t % v0 + (&1 - t) % v1) - v0 += ( &1 - t ) % ( v1 - v0 )`] THEN SIMP_TAC[DOT_LMUL; DOT_RMUL] THEN +REAL_ARITH_TAC);; + +let WHEN_K_POS_ARCV_STABLE = prove(` &0 < k ==> +arcV ( vec 0 ) u v = arcV ( vec 0 ) u ( k % v ) `, +REWRITE_TAC[arcV; VECTOR_SUB_RZERO; DOT_RMUL; NORM_MUL] THEN +SIMP_TAC[LT_IMP_ABS_REFL; REAL_FIELD`&0 < a ==> ( a * b ) / +( d * a * s ) = b / ( d * s ) `]);; + + +let ARCV_VEC0_FORM = prove(`arcV v0 u v = arcV (vec 0) (u - v0) (v - v0)`, +REWRITE_TAC[arcV; VECTOR_SUB_RZERO]);; + +let WHEN_K_POS_ARCV_STABLE2 = prove(` k < &0 ==> +arcV ( vec 0 ) u v = arcV ( vec 0 ) u ( ( -- k) % v ) `, +REWRITE_TAC[REAL_ARITH` n < &0 <=> &0 < -- n `; +WHEN_K_POS_ARCV_STABLE ]);; + +let WHEN_K_DIFF0_ARCV = prove(` ~ ( k = &0 ) ==> +arcV ( vec 0 ) u v = arcV ( vec 0 ) u ( ( abs k ) % v ) `, +REWRITE_TAC[REAL_ABS_NZ; WHEN_K_POS_ARCV_STABLE ]);; + + + +let PITHAGO_THEOREM = prove(`x dot y = &0 +==> norm (x + y) pow 2 = norm x pow 2 + norm y pow 2 /\ +norm (x - y) pow 2 = norm x pow 2 + norm y pow 2`, +SIMP_TAC[NORM_POW_2; DOT_LADD; DOT_RADD; DOT_RSUB; DOT_LSUB; DOT_SYM] THEN +REAL_ARITH_TAC);; + + +let NORM_SUB_INVERTABLE = NORM_ARITH` norm (x - y) = norm (y - x)`;; + + + +let OTHORGONAL_WITH_COS = prove(` ! v0 v1 w (p:real^N). +~(v0 = w) /\ +~(v0 = v1) /\ +(w - p) dot (v1 - v0) = &0 +==> cos (arcV v0 v1 w) = +((p - v0) dot (v1 - v0)) / (norm (v1 - v0) * norm (w - v0))`, +REPEAT GEN_TAC THEN SIMP_TAC[NOT_EQ_IMPCOS_ARC] THEN +REPEAT STRIP_TAC THEN +MATCH_MP_TAC (MESON[]` a = b ==> a / c = b / c `) THEN +ONCE_REWRITE_TAC[REAL_RING` a = b <=> a - b = &0 `] THEN +ONCE_REWRITE_TAC[MESON[DOT_SYM]` a dot b - c = b dot a - c `] THEN +FIRST_X_ASSUM MP_TAC THEN SIMP_TAC[GSYM DOT_LSUB; VECTOR_ARITH` +w - v0 - (p - v0) = w - (p:real^N)`; REAL_SUB_RZERO; DOT_SYM]);; + + +let SIMPLIZE_COS_IF_OTHOR = prove(` ! v0 v1 w (p:real^N). +~(v0 = w) /\ +~(v0 = v1) /\ ( p - v0 ) = k % (v1 - v0 ) /\ +(w - p) dot (v1 - v0) = &0 +==> cos (arcV v0 v1 w) = +k * norm ( v1 - v0 ) / norm (w - v0) `, +SIMP_TAC[OTHORGONAL_WITH_COS; DOT_LMUL; GSYM NORM_POW_2] THEN +REPEAT STRIP_TAC THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN REWRITE_TAC[GSYM NORM_POS_LT] +THEN CONV_TAC REAL_FIELD);; + + +let SIN_EQ_SQRT_ONE_SUB = prove(` ~((v0:real^N) = va) /\ ~(v0 = vb) ==> +sin ( arcV v0 va vb ) = sqrt ( &1 - cos ( arcV v0 va vb ) pow 2 ) `, +DISCH_TAC THEN MATCH_MP_TAC (SIN_COS_SQRT) THEN ASM_SIMP_TAC[PROVE_SIN_LE]);; + + + +let SIN_DI_HOC = prove(`~((v0:real^N) = w) /\ ~(v0 = vb) /\ p IN aff {v0, w} /\ (p - vb) dot (w - v0) = &0 +==> sin (arcV v0 w vb) = norm (p - vb) / norm (vb - v0)`, +SIMP_TAC[SIN_EQ_SQRT_ONE_SUB] THEN ONCE_REWRITE_TAC[REAL_ARITH` a = &0 <=> -- a = &0 `] THEN +SIMP_TAC[GSYM DOT_LNEG; VECTOR_NEG_SUB; OTHORGONAL_WITH_COS] THEN +SIMP_TAC[AFF2; IN_ELIM_THM; VECTOR_ARITH` p = t % v0 + (&1 - t) % w +<=> p - v0 = (&1 - t ) % ( w - v0 ) `] THEN +STRIP_TAC THEN ASM_SIMP_TAC[DOT_LMUL; GSYM NORM_POW_2] THEN +ONCE_REWRITE_TAC[MESON[REAL_LE_DIV; POW_2_SQRT; NORM_POS_LE]` +norm a / norm b = sqrt (( norm a / norm b ) pow 2 ) `] THEN +MATCH_MP_TAC (MESON[]` a = b ==> p a = p b `) THEN +UNDISCH_TAC` ~(v0 = (w:real^N))` THEN UNDISCH_TAC`~(v0 = (vb:real^N))` THEN +ONCE_REWRITE_TAC[VECTOR_ARITH` a = b <=> (b:real^N) - a = vec 0 `] THEN +SIMP_TAC[ GSYM NORM_POS_LT; REAL_FIELD` &0 < a ==> +( c * a pow 2 ) / ( a * b ) = (c * a )/ b /\ +&1 - ( b / a ) pow 2 = ( a pow 2 - b pow 2 ) / a pow 2 `] THEN +REPEAT STRIP_TAC THEN SIMP_TAC[DIV_POW2] THEN +MATCH_MP_TAC (MESON[]` a = b ==> a / x = b / x `) THEN +SIMP_TAC[MUL_POW2] THEN ONCE_REWRITE_TAC[MESON[REAL_POW2_ABS]` +a pow 2 * t = ( abs a ) pow 2 * t`] THEN +SIMP_TAC[GSYM MUL_POW2; GSYM NORM_MUL] THEN DOWN_TAC THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN SIMP_TAC[] THEN +NHANH (MESON[]` a = b ==> ( vb - (p:real^N)) dot a += ( vb - (p:real^N)) dot b `) THEN +REWRITE_TAC[DOT_RMUL; MESON[]` ( a /\ x * t = c ) /\ +&0 = t /\ l <=> a /\ c = x * ( &0 ) /\ t = &0 /\ l `; +REAL_MUL_RZERO] THEN NHANH (PITHAGO_THEOREM) THEN +SIMP_TAC[VECTOR_ARITH` vb - p + p - v0 = vb - (v0:real^N)`] THEN +STRIP_TAC THEN SIMP_TAC[NORM_SUB] THEN REAL_ARITH_TAC );; + + +let CHANG_BIET_GI = prove(`pu - p = (&1 - t) % (w - p) ==> pu IN aff {p, w}`, +REWRITE_TAC[AFF2; IN_ELIM_THM; VECTOR_ARITH`pu - p = (&1 - t) % (w - p) <=> +pu = t % p + ( &1 - t ) % w `] THEN MESON_TAC[]);; + + +let SUB_DOT_EQ_0_INVERTALE = prove(` ( a - b ) dot c = &0 <=> ( b - a ) dot c = &0 `, +SIMP_TAC[DOT_LSUB] THEN REAL_ARITH_TAC);; + + +let SIN_DI_HOC2 = ONCE_REWRITE_RULE[SUB_DOT_EQ_0_INVERTALE] SIN_DI_HOC;; + + + +let KEY_LEMMA_FOR_ANGLES = prove(`! (p:real^N) u v w pu pv. pu IN aff {p,w} /\ pv IN aff {p,w} /\ +( u - pu ) dot (w - p ) = &0 /\ +( v - pv ) dot (w - p ) = &0 /\ +~( p = u \/ p = v \/ p = w ) ==> +cos ( arcV p w u + arcV p w v ) - cos ( arcV p u v ) = +(-- ( v - pv ) dot ( u - pu ) - norm ( v - pv ) * norm ( u - pu )) / +(norm ( p - u ) * norm ( p - v ))`, +SIMP_TAC[COS_ADD; AFF2; IN_ELIM_THM; VECTOR_ARITH` pu = t % p + (&1 - t) % w <=> pu - p = ( &1 - t ) % (w - p ) `; +DE_MORGAN_THM] THEN +REPEAT STRIP_TAC THEN +DOWN_TAC THEN +NHANH (MESON[SIMPLIZE_COS_IF_OTHOR]` pu - p = (&1 - t) % (w - p) /\ +pv - p = (&1 - t') % (w - p) /\ +(u - pu) dot (w - p) = &0 /\ +(v - pv) dot (w - p) = &0 /\ +~(p = u) /\ +~(p = v) /\ +~(p = w) ==> cos (arcV p w u) = +(&1 - t ) * norm (w - p) / norm (u - p) /\ +cos (arcV p w v) = +( &1 - t') * norm (w - p ) / norm ( v - p ) `) THEN +NHANH (CHANG_BIET_GI) THEN +NHANH (MESON[SIN_DI_HOC2]`(a11 /\ pu IN aff {p, w}) /\ +(a22 /\ pv IN aff {p, w}) /\ +(u - pu) dot (w - p) = &0 /\ +(v - pv) dot (w - p) = &0 /\ +~(p = u) /\ +~(p = v) /\ +~(p = w) ==> +sin (arcV p w u) = norm ( pu - u ) / norm ( u - p ) /\ +sin (arcV p w v) = norm ( pv - v ) / norm ( v - p ) `) THEN +STRIP_TAC THEN +ASM_SIMP_TAC[NOT_EQ_IMPCOS_ARC; REAL_FIELD` a / b * aa / bb += ( a * aa ) / ( b * bb ) `; REAL_RING` (a * b ) * c * d = a * c * b * d `; +REAL_FIELD` a * b / c = ( a * b ) / c `; REAL_FIELD ` a / b - c / b += ( a - c ) / b `; NORM_SUB] THEN +MATCH_MP_TAC (MESON[]` a = b ==> a / x = b / x `) THEN +SIMP_TAC[NORM_SUB; REAL_MUL_SYM; REAL_ARITH` a - b - c = v - b <=> +a - c - v = &0 `] THEN +REWRITE_TAC[MESON[VECTOR_ARITH` a - b = a - x + x - (b:real^N)`]` +a - (u - p) dot (v - p) = a - (u - pu + pu - p) dot (v - pv + pv - p) `; +DOT_LADD; DOT_RADD] THEN +ASM_SIMP_TAC[DOT_LMUL; DOT_RMUL; DOT_SYM; REAL_MUL_RZERO; +REAL_ADD_RID; GSYM NORM_POW_2; GSYM POW_2; NORM_SUB;DOT_LNEG; +REAL_ADD_LID] THEN REAL_ARITH_TAC);; + + + + + +let ARCV_BOUNDED = prove(` ~( v0 = u ) /\ ~ ( v0 = v ) ==> +&0 <= arcV v0 u v /\ arcV v0 u v <= pi`, +NHANH (NOT_IDEN_IMP_ABS_LE) THEN REWRITE_TAC[arcV; REAL_ABS_BOUNDS] +THEN SIMP_TAC[ACS_BOUNDS]);; + + +(* This lemma in Multivariate/transc.ml +let COS_MONO_LT_EQ = new_axiom +`!x y. &0 <= x /\ x <= pi /\ &0 <= y /\ y <= pi +==> (cos(x) < cos(y) <=> y < x)`;; +*) + + +let COS_MONOPOLY = prove( +` ! a b. &0 <= a /\ a <= pi /\ &0 <= b /\ b <= pi ==> +( a < b <=> cos b < cos a ) `, MESON_TAC[COS_MONO_LT_EQ]);; + +let COS_MONOPOLY_EQ = prove( +` ! a b. &0 <= a /\ a <= pi /\ &0 <= b /\ b <= pi ==> +( a <= b <=> cos b <= cos a ) `, +REPEAT STRIP_TAC THEN REWRITE_TAC[GSYM REAL_NOT_LT] +THEN ASM_MESON_TAC[COS_MONOPOLY ]);; + + +let END_POINT_ADD_IN_AFF2 = prove(`!k (u:real^N) v. u + k % (u - v) IN aff {u, v} /\ +u + k % (v - u ) IN aff {u,v} `, +REWRITE_TAC[AFF2; VECTOR_ARITH` u + k % (u - v) = +( &1 + k ) % u + ( &1 - ( &1 + k )) % v `] THEN +SIMP_TAC[VECTOR_ARITH` u + k % (v - u) = +(&1 - k) % u + (&1 - (&1 - k)) % v`] THEN SET_TAC[]);; + +let EXISTS_PROJECTING_POINT2 = prove(`!(p:real^N) u v0 . ?pp. pp IN aff {u, v0} /\ (p - pp) dot (u - v0) = &0`, +REPEAT GEN_TAC THEN MP_TAC (SPECL[` u - (v0:real^N) `; `p - ( v0 :real^N)`] +VECTOR_SUB_PROJECT_ORTHOGONAL) THEN +SIMP_TAC[DOT_SYM; VECTOR_ARITH` a - b - c = a - ( b + (c:real^N))`] THEN +ONCE_REWRITE_TAC[INSERT_AC] THEN MESON_TAC[END_POINT_ADD_IN_AFF2 ]);; + + +let KEY_LEMMA_FOR_ANGLES1 = +ONCE_REWRITE_RULE[ INSERT_AC] KEY_LEMMA_FOR_ANGLES;; + +SPECL[`p:real^N`; `u:real^N`; `v:real^N`;`x:real^N`;`ux:real^N`;`vx:real^N`] +KEY_LEMMA_FOR_ANGLES1;; + +let ARCV_INEQUALTY = prove(`! p u v (x:real^N). ~ ( p = x ) /\ ~( p = u ) /\ ~( p = v ) ==> +arcV p u v <= arcV p u x + arcV p x v `, +NHANH (ARCV_BOUNDED) THEN +REPEAT GEN_TAC THEN +ASM_CASES_TAC` pi <= arcV p u x + arcV p x (v:real^N)` THENL +[ASM_MESON_TAC[REAL_LE_TRANS]; +PHA THEN +NHANH (MESON[ARCV_BOUNDED ]`~(p = x) /\ ~(p = u) /\ ~(p = v) /\ l +==> &0 <= arcV p u x /\ &0 <= arcV p x v `) THEN +NHANH (REAL_LE_ADD) THEN +DOWN_TAC THEN +NHANH (REAL_ARITH` ~(a <= b ) ==> b <= a `) THEN +SIMP_TAC[COS_MONOPOLY_EQ ] THEN +MP_TAC (MESON[EXISTS_PROJECTING_POINT2]` ? (ux:real^N) vx. +ux IN aff {x,p} /\ vx IN aff {x,p} /\ +( u - ux ) dot (x - p ) = &0 /\ +( v - vx ) dot ( x - p ) = &0 `) THEN +REPEAT STRIP_TAC THEN +DOWN_TAC THEN +REWRITE_TAC[MESON[]` ux IN aff {x, p} /\ +vx IN aff {x, p} /\ +(u - ux) dot (x - p) = &0 /\ +(v - vx) dot (x - p) = &0 /\a11/\a22 /\ +~(p = x) /\ +~(p = u) /\ +~(p = v) /\ l <=> a11 /\ a22 /\ l /\ ux IN aff {x, p} /\ +vx IN aff {x, p} /\ +(u - ux) dot (x - p) = &0 /\ +(v - vx) dot (x - p) = &0 /\ +~(p = u \/ p = v \/ p = x) `] THEN +NHANH (SPECL[`p:real^N`; `u:real^N`; `v:real^N`;`x:real^N`;`ux:real^N`;`vx:real^N`] +KEY_LEMMA_FOR_ANGLES1) THEN +ONCE_REWRITE_TAC[REAL_ARITH` a <= b <=> a - b <= &0 `] THEN +SIMP_TAC[ARC_SYM; DE_MORGAN_THM] THEN +ONCE_REWRITE_TAC[GSYM VECTOR_SUB_EQ] THEN +SIMP_TAC[GSYM NORM_POS_LT; REAL_FIELD` a / ( b * c ) = ( a / b) / c `] THEN +SIMP_TAC[REAL_ARITH` (a/ b ) / c <= &0 <=> &0 <= (( -- a ) / b ) / c `; +REAL_LE_RDIV_0] THEN +STRIP_TAC THEN +REWRITE_TAC[REAL_ARITH`&0 <= -- ( a - b ) <=> a <= b `] THEN +MESON_TAC[NORM_NEG; NORM_CAUCHY_SCHWARZ]]);; + +let KEITDWB = ARCV_INEQUALTY;; +(* June *) + +(* +g `! (p:real^N) (n:num) fv. +2 <= n /\ (!i. i <= n ==> ~(p = fv i)) +==> arcV p (fv 0) (fv n) <= +sum (0..n - 1) (\i. arcV p (fv i) (fv (i + 1)))`;; + +e (GEN_TAC);; +e (INDUCT_TAC);; +e (SIMP_TAC[ARITH_RULE` ~( 2 <= 0 ) `]);; +e (SPEC_TAC (`n:num`,` a:num`));; +e (INDUCT_TAC);; +e (SIMP_TAC[ONE; ARITH_RULE` ~(2 <= SUC 0) `]);; +e (SPEC_TAC(`a:num`,`u:num`));; +e (INDUCT_TAC);; +e (SIMP_TAC[ARITH_RULE` 2 <= 2 `;ARITH_RULE `SUC ( SUC 0 ) = 2 ` ]);; +e (SIMP_TAC[ARITH_RULE` 0 < 1 /\ 2 - 1 = 1 `;ARITH_RULE` 0 <= 1 `; SUM_CLAUSES_RIGHT]);; +e (SIMP_TAC[SUB_REFL; SUM_SING_NUMSEG; ADD; ARITH_RULE` 1 + 1 = 2 `; ARITH_RULE` i <= 2 <=> i = 0 \/ i = 1 \/ i = 2 `]);; +e (SIMP_TAC[MESON[]` (! a. a = x \/ a = y \/ a = z ==> Q a ) <=> Q x /\ Q y /\ Q z `]);; +e (MP_TAC ARCV_INEQUALTY );; +e (SIMP_TAC[IN_INSERT; NOT_IN_EMPTY]);; +e (GEN_TAC);; +e (MP_TAC (ARITH_RULE` 2 <= SUC ( SUC u )`));; +e (ABBREV_TAC ` ed = ( SUC (SUC u ))`);; +e (REWRITE_TAC[ADD1; ARITH_RULE` a <= b + 1 <=> a <= b \/ a = b + 1 `; MESON[]` (! x. p x \/ x = a ==> h x ) <=> (! x. p x ==> h x ) /\ h a `]);; +e (PHA);; +e (ONCE_REWRITE_TAC[MESON[]` a /\ b/\ c/\ d <=> b /\ d /\ a /\ c `]);; +e (REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC));; +e (PHA);; +e (NHANH (MESON[]`(!fv. 2 <= ed /\ (!i. i <= ed ==> ~(p = fv i)) ==> Q fv) /\a1 /\a2 /\a3 /\ 2 <= ed /\ (!i. i <= ed ==> ~(p = fv i)) ==> Q fv `));; +e (NHANH (ARITH_RULE` 2 <= d ==> 0 < d - 1 + 1 /\ 0 <= d - 1 + 1 `));; +e (SIMP_TAC[ARITH_RULE` 2 <= a ==> ( a + 1 ) - 1 = a - 1 + 1 `; SUM_CLAUSES_RIGHT]);; +e (ASM_SIMP_TAC[ARITH_RULE` (ed - 1 + 1) - 1 = ed - 1 `]);; +e (SIMP_TAC[ARITH_RULE` 2 <= d ==> d - 1 + 1 = d `]);; +e (PHA);; +e (REWRITE_TAC[MESON[ARITH_RULE` 2 = ed + 1 ==> ~( 2 <= ed ) `]` ( a \/ 2 = ed + 1) /\ aa /\ 2 <= ed /\ ll <=> a /\ aa /\ 2 <= ed /\ ll `]);; +e (STRIP_TAC THEN FIRST_X_ASSUM MP_TAC);; +e (MATCH_MP_TAC (REAL_ARITH` a <= b + c ==> b <= x ==> a <= x + c `));; +e (FIRST_X_ASSUM MP_TAC);; +e (NHANH (MESON[LE_REFL; LE_0]` (! i. i <= d ==> p i ) ==> p ( 0 ) /\ p ( d ) `));; +e (MP_TAC (ARCV_INEQUALTY));; +e (ASM_SIMP_TAC[IN_INSERT; NOT_IN_EMPTY]);; + +let FGNMPAV = top_thm();; +*) + +let FGNMPAV = prove_by_refinement( +`! (p:real^N) (n:num) fv. +2 <= n /\ (!i. i <= n ==> ~(p = fv i)) +==> arcV p (fv 0) (fv n) <= +sum (0..n - 1) (\i. arcV p (fv i) (fv (i + 1)))`, + (* {{{ proof *) + [ + (GEN_TAC); + (INDUCT_TAC); + BY((SIMP_TAC[ARITH_RULE` ~( 2 <= 0 ) `])); + (SPEC_TAC (`n:num`,` a:num`)); + (INDUCT_TAC); + BY((SIMP_TAC[ONE; ARITH_RULE` ~(2 <= SUC 0) `])); + (SPEC_TAC(`a:num`,`u:num`)); + (INDUCT_TAC); + (SIMP_TAC[ARITH_RULE` 2 <= 2 `;ARITH_RULE `SUC ( SUC 0 ) = 2 ` ]); + (SIMP_TAC[ARITH_RULE` 0 < 1 /\ 2 - 1 = 1 `;ARITH_RULE` 0 <= 1 `; SUM_CLAUSES_RIGHT]); + (SIMP_TAC[SUB_REFL; SUM_SING_NUMSEG; ADD; ARITH_RULE` 1 + 1 = 2 `; ARITH_RULE` i <= 2 <=> i = 0 \/ i = 1 \/ i = 2 `]); + (SIMP_TAC[MESON[]` (! a. a = x \/ a = y \/ a = z ==> Q a ) <=> Q x /\ Q y /\ Q z `]); + (MP_TAC ARCV_INEQUALTY ); + BY((SIMP_TAC[IN_INSERT; NOT_IN_EMPTY])); + (GEN_TAC); + (MP_TAC (ARITH_RULE` 2 <= SUC ( SUC u )`)); + (ABBREV_TAC ` ed = ( SUC (SUC u ))`); + (REWRITE_TAC[ADD1; ARITH_RULE` a <= b + 1 <=> a <= b \/ a = b + 1 `; MESON[]` (! x. p x \/ x = a ==> h x ) <=> (! x. p x ==> h x ) /\ h a `]); + (PHA); + (ONCE_REWRITE_TAC[MESON[]` a /\ b/\ c/\ d <=> b /\ d /\ a /\ c `]); + (REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC)); + (PHA); + (NHANH (MESON[]`(!fv. 2 <= ed /\ (!i. i <= ed ==> ~(p = fv i)) ==> Q fv) /\a1 /\a2 /\a3 /\ 2 <= ed /\ (!i. i <= ed ==> ~(p = fv i)) ==> Q fv `)); + (NHANH (ARITH_RULE` 2 <= d ==> 0 < d - 1 + 1 /\ 0 <= d - 1 + 1 `)); + (SIMP_TAC[ARITH_RULE` 2 <= a ==> ( a + 1 ) - 1 = a - 1 + 1 `; SUM_CLAUSES_RIGHT]); + (ASM_SIMP_TAC[ARITH_RULE` (ed - 1 + 1) - 1 = ed - 1 `]); + (SIMP_TAC[ARITH_RULE` 2 <= d ==> d - 1 + 1 = d `]); + (PHA); + (REWRITE_TAC[MESON[ARITH_RULE` 2 = ed + 1 ==> ~( 2 <= ed ) `]` ( a \/ 2 = ed + 1) /\ aa /\ 2 <= ed /\ ll <=> a /\ aa /\ 2 <= ed /\ ll `]); + (STRIP_TAC THEN FIRST_X_ASSUM MP_TAC); + (MATCH_MP_TAC (REAL_ARITH` a <= b + c ==> b <= x ==> a <= x + c `)); + (FIRST_X_ASSUM MP_TAC); + (NHANH (MESON[LE_REFL; LE_0]` (! i. i <= d ==> p i ) ==> p ( 0 ) /\ p ( d ) `)); + (MP_TAC (ARCV_INEQUALTY)); + BY((ASM_SIMP_TAC[IN_INSERT; NOT_IN_EMPTY])) + ]);; + (* }}} *) + +let IMP_TAC = ONCE_REWRITE_TAC[MESON[]` a/\ b ==> c +<=> a ==> b ==> c `];; + +(* +g ` &0 <= t12 /\ t12 < &2 * pi /\ t12 = &2 * pi * real_of_int k12 +==> t12 = &0 `;; + +e (ASM_CASES_TAC` (k12:int) < &0 `);; +e (MP_TAC (PI_POS));; +e (DOWN_TAC);; +e (SIMP_TAC[GSYM REAL_NEG_GT0; int_lt; int_of_num_th]);; +e (NGOAC THEN NHANH (REAL_LT_MUL));; +e (REWRITE_TAC[REAL_ARITH` &0 < -- a * b <=> &2 * b * a < &0 `]);; +e (MESON_TAC[REAL_ARITH` ~( a < &0 /\ &0 <= a ) `]);; +e (ASM_CASES_TAC `(k12:int) = &0 `);; +e (ASM_SIMP_TAC[int_of_num_th; REAL_MUL_RZERO]);; +e (DOWN_TAC);; +e (NGOAC);; +e (REWRITE_TAC[ARITH_RULE` ~(k12 < &0) /\ ~((k12:int) = &0) <=> &1 <= k12 `]);; +e (SIMP_TAC[int_le; int_of_num_th]);; +e (MP_TAC PI_POS);; +e (PHA);; +e (ONCE_REWRITE_TAC[MESON[REAL_LE_LMUL_EQ]` &0 < pi /\ &1 <= aa /\ l <=> &0 < pi /\ pi * &1 <= pi * aa /\ l `]);; +e (REWRITE_TAC[REAL_ARITH` a * &1 <= b <=> &2 * a <= &2 * b `]);; +e (MESON_TAC[REAL_ARITH` ~( a < b /\ b <= a ) `]);; + +let IN_A_PERIOD_IDE0 = top_thm();; +*) + +let IN_A_PERIOD_IDE0 = prove_by_refinement( +` &0 <= t12 /\ t12 < &2 * pi /\ t12 = &2 * pi * real_of_int k12 +==> t12 = &0 `, + (* {{{ proof *) + [ + (ASM_CASES_TAC` (k12:int) < &0 `); + (MP_TAC (PI_POS)); + (DOWN_TAC); + (SIMP_TAC[GSYM REAL_NEG_GT0; int_lt; int_of_num_th]); + (NGOAC THEN NHANH (REAL_LT_MUL)); + (REWRITE_TAC[REAL_ARITH` &0 < -- a * b <=> &2 * b * a < &0 `]); + BY((MESON_TAC[REAL_ARITH` ~( a < &0 /\ &0 <= a ) `])); + (ASM_CASES_TAC `(k12:int) = &0 `); + BY((ASM_SIMP_TAC[int_of_num_th; REAL_MUL_RZERO])); + (DOWN_TAC); + (NGOAC); + (REWRITE_TAC[ARITH_RULE` ~(k12 < &0) /\ ~((k12:int) = &0) <=> &1 <= k12 `]); + (SIMP_TAC[int_le; int_of_num_th]); + (MP_TAC PI_POS); + (PHA); + (ONCE_REWRITE_TAC[MESON[REAL_LE_LMUL_EQ]` &0 < pi /\ &1 <= aa /\ l <=> &0 < pi /\ pi * &1 <= pi * aa /\ l `]); + (REWRITE_TAC[REAL_ARITH` a * &1 <= b <=> &2 * a <= &2 * b `]); + BY((MESON_TAC[REAL_ARITH` ~( a < b /\ b <= a ) `])) + ]);; + (* }}} *) + + + +let UNIQUE_PROPERTY_IN_A_PERIOD = prove( +`&0 <= t12 /\ t12 < &2 * pi /\ &0 <= a /\ a < &2 * pi /\ +t12 = a + &2 * pi * real_of_int k12 ==> t12 = a `, +NHANH (REAL_FIELD` &0 <= t12 /\ +t12 < &2 * pi /\ +&0 <= a /\ +a < &2 * pi /\ ll ==> t12 + -- a < &2 * pi /\ +-- ( t12 + -- a ) < &2 * pi `) THEN +ASM_CASES_TAC` &0 <= t12 + -- a ` THENL [ +REWRITE_TAC[REAL_ARITH` a = b + c <=> a + -- b = c `] THEN +STRIP_TAC THEN +ONCE_REWRITE_TAC[REAL_ARITH` a = b <=> a + -- b = &0 `] THEN +DOWN_TAC THEN +MESON_TAC[IN_A_PERIOD_IDE0 ]; +SIMP_TAC[REAL_ARITH` a = b + c * d * e <=> +-- ( a + -- b ) = c * d * ( -- e ) `; GSYM int_neg_th] THEN +STRIP_TAC THEN +ONCE_REWRITE_TAC[REAL_ARITH` a = b <=> -- ( a + -- b ) = &0 `] THEN +DOWN_TAC THEN +NHANH (REAL_ARITH` ~(&0 <= b ) ==> &0 <= -- b `) THEN +MESON_TAC[IN_A_PERIOD_IDE0 ]]);; + + +(* +g `!t1 t2 k12 k21. +&0 <= t1 /\ +t1 < &2 * pi /\ +&0 <= t2 /\ +t2 < &2 * pi /\ +&0 <= t12 /\ +t12 < &2 * pi /\ +&0 <= t21 /\ +t21 < &2 * pi /\ +t12 = t1 - t2 + &2 * pi * real_of_int k12 /\ +t21 = t2 - t1 + &2 * pi * real_of_int k21 +==> (t1 = t2 ==> t12 + t21 = &0) /\ (~(t1 = t2) ==> t12 + t21 = &2 * pi)`;; + +e (REPEAT STRIP_TAC);; +e (DOWN_TAC);; +e (DAO);; +e (IMP_TAC);; +e (SIMP_TAC[REAL_SUB_REFL; REAL_ADD_LID; REAL_ADD_RID]);; +e (NHANH (MESON[IN_A_PERIOD_IDE0]` t21 = &2 * pi * real_of_int k21 /\ t12 = &2 * pi * real_of_int k12 /\ t21 < &2 * pi /\ &0 <= t21 /\ t12 < &2 * pi /\ &0 <= t12 /\ l ==> &0 = t12 /\ &0 = t21 `));; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (SIMP_TAC[REAL_ADD_LID]);; + +e (DOWN_TAC);; +e (SPEC_TAC(`t1:real`,` t1:real`));; +e (SPEC_TAC(`t2:real`,` t2:real`));; +e (SPEC_TAC(`t12:real`,` t12:real`));; +e (SPEC_TAC(`t21:real`,` t21:real`));; +e (SPEC_TAC(`k12:int`,` k12:int`));; +e (SPEC_TAC(`k21:int`,` k21:int`));; +e (MATCH_MP_TAC (MESON[REAL_ARITH` a <= b \/ b <= a `]` (! a1 b1 a2 b2 a b. P a1 b1 a2 b2 a b <=> P b1 a1 b2 a2 b a ) /\ (! a2 b2. L a2 b2 <=> L b2 a2 ) /\ (! a1 b1 a2 b2 a b. P a1 b1 a2 b2 a b /\ a <= (b:real) ==> L a2 b2 ) ==> (! a1 b1 a2 b2 a b. P a1 b1 a2 b2 a b ==> L a2 b2 ) `));; +e (CONJ_TAC);; +e (MESON_TAC[]);; + e (CONJ_TAC);; +e (SIMP_TAC[REAL_ADD_SYM]);; +e (NHANH (REAL_FIELD` &0 <= t1 /\ t1 < &2 * pi /\ &0 <= t2 /\ t2 < &2 * pi /\ &0 <= t12 /\ t12 < &2 * pi /\ l ==> t1 - t2 < &2 * pi`));; +e (REPEAT STRIP_TAC);; +e (REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC));; +e (ONCE_REWRITE_TAC[REAL_ARITH` a <= b <=> &0 <= b - a `]);; +e (PHA);; +e (ONCE_REWRITE_TAC[GSYM REAL_SUB_0]);; +e (NHANH (REAL_FIELD` ~( t2 = &0) /\ t2 < pp /\ &0 <= t2 ==> &0 <= pp - t2 /\ pp - t2 < pp `));; +e (FIRST_X_ASSUM MP_TAC);; +e (ONCE_REWRITE_TAC[REAL_ARITH` a - b + &2* pi * c = &2 * pi - ( b - a ) + &2 * pi * ( c - &1 ) `]);; +e (ABBREV_TAC ` ttt = &2 * pi - (t1 - t2)`);; +e (ONCE_REWRITE_TAC[MESON[int_of_num_th]` &1 = real_of_int (&1)`]);; +e (DOWN_TAC);; +e (REWRITE_TAC[GSYM int_sub_th]);; +e (NHANH (MESON[UNIQUE_PROPERTY_IN_A_PERIOD]` &0 <= t12 /\ t12 < &2 * pi /\ &0 <= t21 /\ t21 < &2 * pi /\ t12 = t1 - t2 + &2 * pi * real_of_int k12 /\ &2 * pi - (t1 - t2) = ttt /\ t21 = ttt + &2 * pi * real_of_int (k21 - &1) /\ ~(t1 - t2 = &0) /\ t1 - t2 < &2 * pi /\ &0 <= t1 - t2 /\ &0 <= ttt /\ ttt < &2 * pi ==> t1 - t2 = t12 /\ ttt = t21 `));; +e (ONCE_REWRITE_TAC[EQ_SYM_EQ]);; +e (SIMP_TAC[]);; +e (STRIP_TAC);; +e (CONV_TAC REAL_RING);; + +let PDPFQUK = top_thm();; +*) + +let PDPFQUK = prove_by_refinement( +`!t1 t2 k12 k21. +&0 <= t1 /\ +t1 < &2 * pi /\ +&0 <= t2 /\ +t2 < &2 * pi /\ +&0 <= t12 /\ +t12 < &2 * pi /\ +&0 <= t21 /\ +t21 < &2 * pi /\ +t12 = t1 - t2 + &2 * pi * real_of_int k12 /\ +t21 = t2 - t1 + &2 * pi * real_of_int k21 +==> (t1 = t2 ==> t12 + t21 = &0) /\ (~(t1 = t2) ==> t12 + t21 = &2 * pi)`, + (* {{{ proof *) + [ + (REPEAT STRIP_TAC); + (DOWN_TAC); + (DAO); + (IMP_TAC); + (SIMP_TAC[REAL_SUB_REFL; REAL_ADD_LID; REAL_ADD_RID]); + (NHANH (MESON[IN_A_PERIOD_IDE0]` t21 = &2 * pi * real_of_int k21 /\ t12 = &2 * pi * real_of_int k12 /\ t21 < &2 * pi /\ &0 <= t21 /\ t12 < &2 * pi /\ &0 <= t12 /\ l ==> &0 = t12 /\ &0 = t21 `)); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + BY((SIMP_TAC[REAL_ADD_LID])); + (DOWN_TAC); + (SPEC_TAC(`t1:real`,` t1:real`)); + (SPEC_TAC(`t2:real`,` t2:real`)); + (SPEC_TAC(`t12:real`,` t12:real`)); + (SPEC_TAC(`t21:real`,` t21:real`)); + (SPEC_TAC(`k12:int`,` k12:int`)); + (SPEC_TAC(`k21:int`,` k21:int`)); + (MATCH_MP_TAC (MESON[REAL_ARITH` a <= b \/ b <= a `]` (! a1 b1 a2 b2 a b. P a1 b1 a2 b2 a b <=> P b1 a1 b2 a2 b a ) /\ (! a2 b2. L a2 b2 <=> L b2 a2 ) /\ (! a1 b1 a2 b2 a b. P a1 b1 a2 b2 a b /\ a <= (b:real) ==> L a2 b2 ) ==> (! a1 b1 a2 b2 a b. P a1 b1 a2 b2 a b ==> L a2 b2 ) `)); + (CONJ_TAC); + BY((MESON_TAC[])); + (CONJ_TAC); + BY((SIMP_TAC[REAL_ADD_SYM])); + (NHANH (REAL_FIELD` &0 <= t1 /\ t1 < &2 * pi /\ &0 <= t2 /\ t2 < &2 * pi /\ &0 <= t12 /\ t12 < &2 * pi /\ l ==> t1 - t2 < &2 * pi`)); + (REPEAT STRIP_TAC); + (REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC)); + (ONCE_REWRITE_TAC[REAL_ARITH` a <= b <=> &0 <= b - a `]); + (PHA); + (ONCE_REWRITE_TAC[GSYM REAL_SUB_0]); + (NHANH (REAL_FIELD` ~( t2 = &0) /\ t2 < pp /\ &0 <= t2 ==> &0 <= pp - t2 /\ pp - t2 < pp `)); + (FIRST_X_ASSUM MP_TAC); + (ONCE_REWRITE_TAC[REAL_ARITH` a - b + &2* pi * c = &2 * pi - ( b - a ) + &2 * pi * ( c - &1 ) `]); + (ABBREV_TAC ` ttt = &2 * pi - (t1 - t2)`); + (ONCE_REWRITE_TAC[MESON[int_of_num_th]` &1 = real_of_int (&1)`]); + (DOWN_TAC); + (REWRITE_TAC[GSYM int_sub_th]); + (NHANH (MESON[UNIQUE_PROPERTY_IN_A_PERIOD]` &0 <= t12 /\ t12 < &2 * pi /\ &0 <= t21 /\ t21 < &2 * pi /\ t12 = t1 - t2 + &2 * pi * real_of_int k12 /\ &2 * pi - (t1 - t2) = ttt /\ t21 = ttt + &2 * pi * real_of_int (k21 - &1) /\ ~(t1 - t2 = &0) /\ t1 - t2 < &2 * pi /\ &0 <= t1 - t2 /\ &0 <= ttt /\ ttt < &2 * pi ==> t1 - t2 = t12 /\ ttt = t21 `)); + (ONCE_REWRITE_TAC[EQ_SYM_EQ]); + (SIMP_TAC[]); + (STRIP_TAC); + BY((CONV_TAC REAL_RING)) + ]);; + (* }}} *) + + +(* June, 2009 *) + + +(* June, 2009 *) +let QAFHJNM = prove(`! (v:real^N) w x . +let e3 = ( &1 / norm ( w - v )) % (w - v ) in +let r = norm ( x - v ) in +let phi = arcV v w x in +~( v = x ) /\ ~ ( v = w ) +==> (? u'. u' dot e3 = &0 /\ +x = v + u' + ( r * cos phi ) % e3 ) `, +NHANH (MESON[EXISTS_PROJECTING_POINT2]`l /\ ~(v = w) ==> (?pp. (pp:real^N) IN aff {w, v} +/\ (x - pp) dot (w - v) = &0 ) `) THEN REPEAT STRIP_TAC THEN REPEAT LET_TAC THEN +SIMP_TAC[AFF2; IN_ELIM_THM; VECTOR_ARITH` pp = t % w + (&1 - t) % v <=> pp - v = t % ( w - v ) `] +THEN EXPAND_TAC "phi" THEN STRIP_TAC THEN EXISTS_TAC ` x - (pp:real^N)` THEN +REPLICATE_TAC 4 (FIRST_X_ASSUM MP_TAC) THEN PHA THEN NHANH (SIMPLIZE_COS_IF_OTHOR) THEN +EXPAND_TAC "e3" THEN SIMP_TAC[DOT_RMUL; REAL_MUL_RZERO; VECTOR_MUL_ASSOC] THEN +ONCE_REWRITE_TAC[VECTOR_ARITH` a = b <=> b - a = vec 0 `] THEN +SIMP_TAC[GSYM NORM_EQ_0] THEN EXPAND_TAC "r" THEN SIMP_TAC[GSYM NORM_EQ_0; REAL_FIELD` +~(x = &0) /\ ~(w = &0) ==> ( x * t * w / x ) * &1 / w = t `] THEN +SIMP_TAC[VECTOR_ARITH` (v + x - pp + tt ) - x = (tt: real^N) - (pp - v) `]);; + +(* August, 2009 *) +let YBXRVTS = prove(`! v w (u:real^3) x. +~collinear {v,w,u} /\ +n = (w - v) cross (u - v ) /\ +x IN aff {v,w,u} ==> +angle (( v + n ), v, x) = pi / &2 `, +REWRITE_TAC[aff;AFFINE_HULL_3; IN_ELIM_THM;angle; vector_angle] THEN +REPEAT STRIP_TAC THEN COND_CASES_TAC THENL [REWRITE_TAC[]; +UNDISCH_TAC ` u' + v' + w' = &1 ` THEN +ASM_SIMP_TAC[VECTOR_ARITH`(a + b ) - a = (b:real^N)`; REAL_ARITH` a + b = &1 <=> a = &1 - b `; +VECTOR_ARITH` ((&1 - (v' + w')) % v + v' % w + w' % u) - v = v' % ( w - v ) + w' % ( u - v ) `; +DOT_RADD; DOT_RMUL; DOT_CROSS_SELF;REAL_MUL_RZERO ;REAL_ADD_RID; REAL_ARITH` &0 / a = &0`; PI2_EQ_ACS0]]);; + + + +(* +let types_thm th = let cl = concl th in +List.map dest_var (frees cl );; + +let seans_fn () = +let (tms,tm) = top_goal () in +let vss = map frees (tm::tms) in +let vs = setify (flat vss) in +map dest_var vs;; +*) + + +(* ========= NEW RULES and TAC TIC ============================= *) +(* ============================================================= *) +(* ============================================================= *) + + +let PAT_REWRITE_TAC tm thms = +(CONV_TAC (PAT_CONV tm (REWRITE_CONV thms )));; + +let FOR_ASM th = +let th1 = REWRITE_RULE[MESON[]` a /\ b ==> c <=> +a ==> b ==> c `] th in +let th2 = SPEC_ALL th1 in UNDISCH_ALL th2;; + +(* change a th having form |- A ==> t to the form A |- t +to get ready to some other commands + + +|- A ==> t +----------- FOR_ASM +A |- t +*) + +let ASSUME_TAC2 = ASSUME_TAC o FOR_ASM;; + + +let PAT_ONCE_REWRITE_TAC tm thms = +(CONV_TAC (PAT_CONV tm (ONCE_REWRITE_CONV thms )));; + +let ASM_PAT_RW_TAC tm thms = EVERY_ASSUM (fun th -> +(CONV_TAC (PAT_CONV tm (ONCE_REWRITE_CONV +( th ::[ thms ] )))));; + +let PAT_TH_TAC tm th = +(CONV_TAC (PAT_CONV tm (REWRITE_CONV[th] )));; + +(* rewurte a goal with one theorem *) + +let IMP_TO_EQ_RULE th = MATCH_MP (TAUT` (a ==> b ) ==> +( a <=> a /\ b )`) (SPEC_ALL th);; + +let NHANH_PAT tm th = PAT_ONCE_REWRITE_TAC tm +[ IMP_TO_EQ_RULE th ];; + + + +let USE_FIRST tm tac = UNDISCH_TAC tm THEN DISCH_TAC THEN +FIRST_ASSUM tac;; + + +let ONCE_SIMP_IDENT tm tth = (UNDISCH_TAC tm) THEN +DISCH_TAC THEN FIRST_ASSUM ( fun th -> +ONCE_REWRITE_TAC[(MATCH_MP tth th)] );; + + +let SIMP_TAC1 th = SIMP_TAC[ th];; + +let SIMP_TACC1 th = ASSUME_TAC2 th THEN FIRST_X_ASSUM +SIMP_TAC1;; + +let SIMP_IDENT thms tm = UNDISCH_TAC tm THEN (SIMP_TAC thms) +THEN DISCH_TAC;; +USE_FIRST;; + + + + +let ELIM_IDENTS th = ASSUME_TAC2 th THEN FIRST_X_ASSUM +( fun thh -> SIMP_TAC[ thh]);; + +(* ============================================================== *) +(* ============================================================== *) +(* ============================================================== *) + + + + + +let GIVEN_POINT_EXISTS_2_NOT_COLLINEAR = prove(` !(x:real^3). ? y z. ~ collinear {x,y,z} `, +GEOM_ORIGIN_TAC `x:real^3` THEN EXISTS_TAC` (vector [&1; &0; &0 ]) : real^3` THEN +EXISTS_TAC` (vector [&0; &1; &0 ]) : real^3` THEN +REWRITE_TAC[GSYM CROSS_EQ_0; cross; VECTOR_3] THEN +CONV_TAC REAL_RAT_REDUCE_CONV THEN +REWRITE_TAC[VECTOR_EQ; DOT_LZERO; DOT_3; VECTOR_3] THEN REAL_ARITH_TAC);; + + +let NOT_BASISES_EQ_VEC0 = prove(` ~( basis 1 = ((vec 0): real^3) \/ +basis 2 = ((vec 0): real^3) \/ basis 3 = ((vec 0): real^3) ) `, +REWRITE_TAC[DE_MORGAN_THM] THEN CONJ_TAC THENL [ +MATCH_MP_TAC BASIS_NONZERO THEN REWRITE_TAC[DIMINDEX_3] THEN ARITH_TAC; CONJ_TAC THENL [ +MATCH_MP_TAC BASIS_NONZERO THEN REWRITE_TAC[DIMINDEX_3] THEN ARITH_TAC; +MATCH_MP_TAC BASIS_NONZERO THEN REWRITE_TAC[DIMINDEX_3] THEN ARITH_TAC]]);; + + +let TOW_DISTINCT_POINTS_EXISTS_RD_NOT_COLLINEAR = prove( +`! x (y: real^3). ~( x = y ) ==> (? z. ~ collinear {x,y,z} )`, +GEOM_ORIGIN_TAC `x:real^3` THEN GEOM_BASIS_MULTIPLE_TAC 1 `y:real^3` THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN REWRITE_TAC[VECTOR_MUL_EQ_0] THEN +REPEAT STRIP_TAC THEN EXISTS_TAC ` (basis 2) :real^3` THEN +REWRITE_TAC[GSYM CROSS_EQ_0; CROSS_LMUL; CROSS_BASIS] THEN +REWRITE_TAC[VECTOR_MUL_EQ_0] THEN FIRST_X_ASSUM MP_TAC THEN +SIMP_TAC[REWRITE_RULE[DE_MORGAN_THM] NOT_BASISES_EQ_VEC0 ]);; + + +let SUBSET_IMP_SUBSET_HULL = prove(`a SUBSET b ==> a SUBSET P hull b `, +MATCH_MP_TAC (SET_RULE`b SUBSET P hull b ==> a SUBSET b ==> a SUBSET P hull b `) THEN +REWRITE_TAC[HULL_SUBSET]);; + + +let THREE_POINT_IMP_EXISTS_3 = prove(`! (v1:real^3) v2 v3. ? w2 w3. +~( collinear {v1,w2,w3} ) /\ {v1,v2,v3} SUBSET affine hull {v1,w2,w3} `, +REPEAT GEN_TAC THEN ASM_CASES_TAC` collinear {(v1: real^3),v2,v3} ` THENL +[FIRST_X_ASSUM MP_TAC THEN GEOM_ORIGIN_TAC `v1: real^3` THEN +REPEAT GEN_TAC THEN PAT_REWRITE_TAC `\x. x ==> _ ` [COLLINEAR_LEMMA] THEN +SPEC_TAC (`v3:real^3`,`v3: real^3`) THEN SPEC_TAC (`v2:real^3`,`v2: real^3`) THEN +MATCH_MP_TAC (MESON[]`(!a b. P a b <=> P b a) /\ (!v w. v = vec 0 \/ l v w ==> P v w) +==> (!v w. v = vec 0 \/ w = vec 0 \/ l v w ==> P v w)`) THEN +SIMP_TAC[INSERT_AC] THEN REPEAT STRIP_TAC THENL [ +ONCE_REWRITE_TAC[SET_RULE` {a,b,c} = {c,a,b} `] THEN +ASM_CASES_TAC `(v3:real^3) = vec 0 ` THENL [ +MP_TAC (SPEC`(vec 0) :real^3` GIVEN_POINT_EXISTS_2_NOT_COLLINEAR) THEN +STRIP_TAC THEN +EXISTS_TAC `y: real^3` THEN +EXISTS_TAC `z: real^3` THEN +ASM_SIMP_TAC[INSERT_EMPTY_SUBSET] THEN +MATCH_MP_TAC HULL_INC THEN +SET_TAC[]; +FIRST_X_ASSUM MP_TAC THEN NHANH TOW_DISTINCT_POINTS_EXISTS_RD_NOT_COLLINEAR THEN +STRIP_TAC THEN +EXISTS_TAC `v3: real^3` THEN +EXISTS_TAC `z: real^3` THEN +FIRST_X_ASSUM MP_TAC THEN +SIMP_TAC[INSERT_COMM] THEN +STRIP_TAC THEN +MATCH_MP_TAC SUBSET_IMP_SUBSET_HULL THEN +ASM_SIMP_TAC[] THEN +SET_TAC[]]; ONCE_REWRITE_TAC[SET_RULE` {a,b,c} = {c,a,b} `] THEN +ASM_CASES_TAC`v2: real^3 = vec 0 ` THENL [UNDISCH_TAC `v3 = c % (v2: real^3)` THEN +MATCH_MP_TAC (TAUT` a ==> b ==> a `) THEN +ASM_CASES_TAC `(v3:real^3) = vec 0 ` THENL [ +MP_TAC (SPEC`(vec 0) :real^3` GIVEN_POINT_EXISTS_2_NOT_COLLINEAR) THEN +STRIP_TAC THEN +EXISTS_TAC `y: real^3` THEN +EXISTS_TAC `z: real^3` THEN +ASM_SIMP_TAC[INSERT_EMPTY_SUBSET] THEN +MATCH_MP_TAC HULL_INC THEN +SET_TAC[]; +FIRST_X_ASSUM MP_TAC THEN NHANH TOW_DISTINCT_POINTS_EXISTS_RD_NOT_COLLINEAR THEN +STRIP_TAC THEN +EXISTS_TAC `v3: real^3` THEN +EXISTS_TAC `z: real^3` THEN +FIRST_X_ASSUM MP_TAC THEN +SIMP_TAC[INSERT_COMM] THEN +STRIP_TAC THEN +MATCH_MP_TAC SUBSET_IMP_SUBSET_HULL THEN +ASM_SIMP_TAC[] THEN +SET_TAC[]]; FIRST_X_ASSUM MP_TAC] THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +NHANH TOW_DISTINCT_POINTS_EXISTS_RD_NOT_COLLINEAR THEN +STRIP_TAC THEN +EXISTS_TAC`v2:real^3` THEN +EXISTS_TAC`z:real^3` THEN +ASM_SIMP_TAC[INSERT_EMPTY_SUBSET] THEN +ASM_SIMP_TAC[INSERT_EMPTY_SUBSET; IN_P_HULL_INSERT] THEN +ONCE_REWRITE_TAC[INSERT_AC] THEN +ASM_SIMP_TAC[AFFINE_HULL_3; IN_P_HULL_INSERT; IN_ELIM_THM] THEN +EXISTS_TAC `c: real` THEN +EXISTS_TAC `&1 - (c: real)` THEN +EXISTS_TAC `&0` THEN +SIMP_TAC[REAL_ARITH`c + &1 - c + &0 = &1 `] THEN +CONV_TAC VECTOR_ARITH]; ASM_MESON_TAC[HULL_SUBSET]]);; + + + +let SUBSET_AFFINE_HULL3_EQ_SUB_PLANE = prove(` +(? (u: real^3 ) v w. S SUBSET affine hull {u, v, w}) <=> (?x. plane x /\ S SUBSET x)`, +REWRITE_TAC[plane] THEN EQ_TAC THENL [STRIP_TAC THEN +MP_TAC (SPECL [`u: real^3`;`v:real^3`;`w:real^3`] THREE_POINT_IMP_EXISTS_3) THEN +STRIP_TAC THEN EXISTS_TAC` affine hull {u, w2, (w3: real^3)}` THEN CONJ_TAC THENL [ +ASM_MESON_TAC[]; FIRST_X_ASSUM MP_TAC THEN +NHANH_PAT `\x. x ==> y ` (MESON[HULL_MONO]` s SUBSET t ==> affine hull s SUBSET affine hull t`) +THEN ASM_SIMP_TAC[HULL_HULL] THEN ASM_MESON_TAC[SUBSET_TRANS]]; MESON_TAC[]]);; + +let coplanar2 = coplanar;; + + + +let NOT_COPLANAR_0_4_IMP_INDEPENDENT = prove +(`!v1 v2 v3:real^N. ~coplanar {vec 0,v1,v2,v3} ==> independent {v1,v2,v3}`, +REPEAT GEN_TAC THEN REWRITE_TAC[independent; CONTRAPOS_THM] THEN +REWRITE_TAC[dependent] THEN +SUBGOAL_THEN +`!v1 v2 v3:real^N. v1 IN span {v2,v3} ==> coplanar{vec 0,v1,v2,v3}` +ASSUME_TAC THENL +[REPEAT STRIP_TAC THEN REWRITE_TAC[coplanar] THEN +MAP_EVERY EXISTS_TAC [`vec 0:real^N`; `v2:real^N`; `v3:real^N`] THEN +SIMP_TAC[AFFINE_HULL_EQ_SPAN; HULL_INC; IN_INSERT] THEN +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET] THEN +ASM_SIMP_TAC[SPAN_SUPERSET; IN_INSERT] THEN +POP_ASSUM MP_TAC THEN SPEC_TAC(`v1:real^N`,`v1:real^N`) THEN +REWRITE_TAC[GSYM SUBSET] THEN MATCH_MP_TAC SPAN_MONO THEN SET_TAC[]; +REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY] THEN +STRIP_TAC THEN ASM_REWRITE_TAC[] THEN +FIRST_X_ASSUM SUBST_ALL_TAC THENL +[FIRST_X_ASSUM(MP_TAC o SPECL [`v1:real^N`; `v2:real^N`; `v3:real^N`]); +FIRST_X_ASSUM(MP_TAC o SPECL [`v2:real^N`; `v3:real^N`; `v1:real^N`]); +FIRST_X_ASSUM(MP_TAC o SPECL [`v3:real^N`; `v1:real^N`; `v2:real^N`])] +THEN REWRITE_TAC[INSERT_AC] THEN DISCH_THEN MATCH_MP_TAC THEN +FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (SET_RULE +`a IN s ==> s SUBSET t ==> a IN t`)) THEN +MATCH_MP_TAC SPAN_MONO THEN SET_TAC[]]);; + +let NONCOPLANAR_3_BASIS = prove +(`!v1 v2 v3 v0 v:real^3. +~coplanar {v0, v1, v2, v3} +==> ?t1 t2 t3. +v = t1 % (v1 - v0) + t2 % (v2 - v0) + t3 % (v3 - v0) /\ +(!ta tb tc. +v = ta % (v1 - v0) + tb % (v2 - v0) + tc % (v3 - v0) +==> ta = t1 /\ tb = t2 /\ tc = t3)`, +GEN_GEOM_ORIGIN_TAC `v0:real^3` ["v"] THEN REPEAT GEN_TAC THEN +MAP_EVERY (fun t -> +ASM_CASES_TAC t THENL [ASM_REWRITE_TAC[INSERT_AC; COPLANAR_3]; ALL_TAC]) +[`v1:real^3 = vec 0`; `v2:real^3 = vec 0`; `v3:real^3 = vec 0`; +`v2:real^3 = v1`; `v3:real^3 = v1`; `v3:real^3 = v2`] THEN +DISCH_THEN(ASSUME_TAC o MATCH_MP NOT_COPLANAR_0_4_IMP_INDEPENDENT) THEN +REWRITE_TAC[VECTOR_SUB_RZERO] THEN +MP_TAC(ISPECL [`(:real^3)`; `{v1,v2,v3}:real^3->bool`] +CARD_GE_DIM_INDEPENDENT) THEN +ASM_REWRITE_TAC[SUBSET_UNIV; DIM_UNIV; DIMINDEX_3] THEN +ASM_SIMP_TAC[CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY] THEN +ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; ARITH; SUBSET; IN_UNIV] THEN +DISCH_THEN(MP_TAC o SPEC `v:real^3`) THEN +REWRITE_TAC[SPAN_BREAKDOWN_EQ; SPAN_EMPTY; IN_SING] THEN +REWRITE_TAC[VECTOR_ARITH `a - b:real^3 = c <=> a = b + c`] THEN +REWRITE_TAC[VECTOR_ADD_RID] THEN +MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `t1:real` THEN +MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `t2:real` THEN +MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `t3:real` THEN +DISCH_TAC THEN ASM_REWRITE_TAC[] THEN +MAP_EVERY X_GEN_TAC [`ta:real`; `tb:real`; `tc:real`] THEN DISCH_TAC THEN +FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [INDEPENDENT_EXPLICIT]) THEN +REWRITE_TAC[FINITE_INSERT; FINITE_EMPTY] THEN +DISCH_THEN(MP_TAC o SPEC +`(\x. if x = v1 then t1 - ta +else if x = v2 then t2 - tb else t3 - tc):real^3->real`) THEN +REWRITE_TAC[FORALL_IN_INSERT] THEN +SIMP_TAC[VSUM_CLAUSES; FINITE_INSERT; FINITE_EMPTY] THEN +ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; VECTOR_ADD_RID] THEN +REWRITE_TAC[REAL_ARITH `s - t = &0 <=> t = s`] THEN +DISCH_THEN MATCH_MP_TAC THEN UNDISCH_TAC +`t1 % v1 + t2 % v2 + t3 % v3:real^3 = ta % v1 + tb % v2 + tc % v3` THEN +VECTOR_ARITH_TAC);; + + +let coplanar = prove(` ! (S:real^3 -> bool ). coplanar S <=> (?x. plane x /\ S SUBSET x)`, +REWRITE_TAC[SUBSET_AFFINE_HULL3_EQ_SUB_PLANE; coplanar]);; + + +let COPLANAR_DET_EQ_0 = prove +(`!v0 v1 (v2: real^3) v3. +coplanar {v0,v1,v2,v3} <=> +det(vector[v1 - v0; v2 - v0; v3 - v0]) = &0`, +REPEAT GEN_TAC THEN REWRITE_TAC[DET_EQ_0_RANK; RANK_ROW] THEN +REWRITE_TAC[rows; row; LAMBDA_ETA] THEN +ONCE_REWRITE_TAC[SIMPLE_IMAGE_GEN] THEN +REWRITE_TAC[GSYM numseg; DIMINDEX_3] THEN +CONV_TAC(ONCE_DEPTH_CONV NUMSEG_CONV) THEN +SIMP_TAC[IMAGE_CLAUSES; VECTOR_3] THEN EQ_TAC THENL +[REWRITE_TAC[coplanar; plane; LEFT_AND_EXISTS_THM; LEFT_IMP_EXISTS_THM] THEN +MAP_EVERY X_GEN_TAC +[`p:real^3->bool`; `a:real^3`; `b:real^3`; `c:real^3`] THEN +DISCH_THEN(CONJUNCTS_THEN2 STRIP_ASSUME_TAC MP_TAC) THEN +FIRST_X_ASSUM SUBST1_TAC THEN +W(MP_TAC o PART_MATCH lhand AFFINE_HULL_INSERT_SUBSET_SPAN o +rand o lhand o goal_concl) THEN +REWRITE_TAC[GSYM IMP_CONJ_ALT] THEN +DISCH_THEN(MP_TAC o MATCH_MP SUBSET_TRANS) THEN +DISCH_THEN(MP_TAC o ISPEC `\x:real^3. x - a` o MATCH_MP IMAGE_SUBSET) THEN +ONCE_REWRITE_TAC[SIMPLE_IMAGE_GEN] THEN +REWRITE_TAC[IMAGE_CLAUSES; GSYM IMAGE_o; o_DEF; VECTOR_ADD_SUB; IMAGE_ID; +SIMPLE_IMAGE] THEN +REWRITE_TAC[INSERT_SUBSET] THEN STRIP_TAC THEN +GEN_REWRITE_TAC LAND_CONV [GSYM DIM_SPAN] THEN MATCH_MP_TAC LET_TRANS THEN +EXISTS_TAC `CARD {b - a:real^3,c - a}` THEN +CONJ_TAC THENL +[MATCH_MP_TAC SPAN_CARD_GE_DIM; +SIMP_TAC[CARD_CLAUSES; FINITE_RULES] THEN ARITH_TAC] THEN +REWRITE_TAC[FINITE_INSERT; FINITE_RULES] THEN +GEN_REWRITE_TAC RAND_CONV [GSYM SPAN_SPAN] THEN +MATCH_MP_TAC SPAN_MONO THEN REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET] THEN +MP_TAC(VECTOR_ARITH `!x y:real^3. x - y = (x - a) - (y - a)`) THEN +DISCH_THEN(fun th -> REPEAT CONJ_TAC THEN +GEN_REWRITE_TAC LAND_CONV [th]) THEN +MATCH_MP_TAC SPAN_SUB THEN ASM_REWRITE_TAC[]; + + +DISCH_TAC THEN +MP_TAC(ISPECL [`{v1 - v0,v2 - v0,v3 - v0}:real^3->bool`; `2`] +LOWDIM_EXPAND_BASIS) THEN +ASM_REWRITE_TAC[ARITH_RULE `n <= 2 <=> n < 3`; DIMINDEX_3; ARITH] THEN +DISCH_THEN(X_CHOOSE_THEN `t:real^3->bool` +(CONJUNCTS_THEN2 MP_TAC STRIP_ASSUME_TAC)) THEN +CONV_TAC(LAND_CONV HAS_SIZE_CONV) THEN +REWRITE_TAC[LEFT_IMP_EXISTS_THM] THEN +MAP_EVERY X_GEN_TAC [`a:real^3`; `b:real^3`] THEN +DISCH_THEN(CONJUNCTS_THEN2 ASSUME_TAC SUBST_ALL_TAC) THEN +REWRITE_TAC[coplanar; plane] THEN +EXISTS_TAC `affine hull {v0,v0 + a,v0 + b}:real^3->bool` THEN +CONJ_TAC THENL +[MAP_EVERY EXISTS_TAC [`v0:real^3`; `v0 + a:real^3`; `v0 + b:real^3`] THEN +REWRITE_TAC[COLLINEAR_3; COLLINEAR_LEMMA; +VECTOR_ARITH `--x = vec 0 <=> x = vec 0`; +VECTOR_ARITH `u - (u + a):real^3 = --a`; +VECTOR_ARITH `(u + b) - (u + a):real^3 = b - a`] THEN +REWRITE_TAC[DE_MORGAN_THM; VECTOR_SUB_EQ; +VECTOR_ARITH `b - a = c % -- a <=> (c - &1) % a + &1 % b = vec 0`] THEN +ASM_REWRITE_TAC[] THEN CONJ_TAC THENL +[ASM_MESON_TAC[IN_INSERT; INDEPENDENT_NONZERO]; ALL_TAC] THEN +DISCH_THEN(X_CHOOSE_TAC `u:real`) THEN +FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [independent]) THEN +REWRITE_TAC[DEPENDENT_EXPLICIT] THEN +MAP_EVERY EXISTS_TAC [`{a:real^3,b}`; +`\x:real^3. if x = a then u - &1 else &1`] THEN +REWRITE_TAC[FINITE_INSERT; FINITE_RULES; SUBSET_REFL] THEN +CONJ_TAC THENL +[EXISTS_TAC `b:real^3` THEN ASM_REWRITE_TAC[IN_INSERT] THEN +REAL_ARITH_TAC; +ALL_TAC] THEN +SIMP_TAC[VSUM_CLAUSES; FINITE_RULES] THEN +ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; VECTOR_ADD_RID]; +ALL_TAC] THEN +W(MP_TAC o PART_MATCH (lhs o rand) AFFINE_HULL_INSERT_SPAN o +rand o goal_concl) THEN +ANTS_TAC THENL +[REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY] THEN +REWRITE_TAC[VECTOR_ARITH `u = u + a <=> a = vec 0`] THEN +ASM_MESON_TAC[INDEPENDENT_NONZERO; IN_INSERT]; +ALL_TAC] THEN +DISCH_THEN SUBST1_TAC THEN +ONCE_REWRITE_TAC[SIMPLE_IMAGE_GEN] THEN +REWRITE_TAC[SIMPLE_IMAGE; IMAGE_CLAUSES; IMAGE_ID; VECTOR_ADD_SUB] THEN +MATCH_MP_TAC SUBSET_TRANS THEN EXISTS_TAC +`IMAGE (\v:real^3. v0 + v) (span{v1 - v0, v2 - v0, v3 - v0})` THEN +ASM_SIMP_TAC[IMAGE_SUBSET] THEN +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET; IN_IMAGE] THEN CONJ_TAC THENL +[EXISTS_TAC `vec 0:real^3` THEN REWRITE_TAC[SPAN_0] THEN VECTOR_ARITH_TAC; +REWRITE_TAC[VECTOR_ARITH `v1:real^N = v0 + x <=> x = v1 - v0`] THEN +REWRITE_TAC[UNWIND_THM2] THEN REPEAT CONJ_TAC THEN +MATCH_MP_TAC SPAN_SUPERSET THEN REWRITE_TAC[IN_INSERT]]]);; + + +let det_vec3 = new_definition ` det_vec3 (a:real^3) (b:real^3) (c:real^3) = +a$1 * b$2 * c$3 + b$1 * c$2 * a$3 + c$1 * a$2 * b$3 - +( a$1 * c$2 * b$3 + b$1 * a$2 * c$3 + c$1 * b$2 * a$3 ) `;; + + +let DET_VEC3_EXPAND = prove +(`det (vector [a; b; (c:real^3)] ) = det_vec3 a b c`, +REWRITE_TAC[det_vec3; DET_3; VECTOR_3] THEN REAL_ARITH_TAC);; + +let COPLANAR_DET_VEC3_EQ_0 = prove( `!v0 v1 (v2: real^3) v3. +coplanar {v0,v1,v2,v3} <=> +det_vec3 ( v1 - v0 ) ( v2 - v0 ) ( v3 - v0 ) = &0`, REWRITE_TAC[COPLANAR_DET_EQ_0; DET_VEC3_EXPAND]);; + + +let coplanar1 = coplanar;; +let coplanar = coplanar2;; + + + +let DET_VEC3_AS_CROSS_DOT = prove(` det_vec3 v1 v2 v3 = (v1 cross v2 ) dot v3 `, +REWRITE_TAC[det_vec3; cross; DOT_3; VECTOR_3] +THEN REAL_ARITH_TAC);; + + +let ORTHONORMAL_IMP_NONZERO = prove +(`!e1 e2 e3. orthonormal e1 e2 e3 +==> ~(e1 = vec 0) /\ ~(e2 = vec 0) /\ ~(e3 = vec 0)`, +REPEAT GEN_TAC THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN +REWRITE_TAC[DE_MORGAN_THM] THEN STRIP_TAC THEN +ASM_REWRITE_TAC[orthonormal; DOT_LZERO] THEN REAL_ARITH_TAC);; + +let ORTHONORMAL_IMP_DISTINCT = prove +(`!e1 e2 e3. orthonormal e1 e2 e3 ==> ~(e1 = e2) /\ ~(e1 = e3) /\ ~(e2 = e3)`, +REPEAT GEN_TAC THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM] THEN +REWRITE_TAC[DE_MORGAN_THM] THEN STRIP_TAC THEN +ASM_REWRITE_TAC[orthonormal; DOT_LZERO] THEN REAL_ARITH_TAC);; + +let ORTHONORMAL_IMP_INDEPENDENT = prove +(`!e1 e2 e3. orthonormal e1 e2 e3 ==> independent {e1,e2,e3}`, +REPEAT STRIP_TAC THEN MATCH_MP_TAC PAIRWISE_ORTHOGONAL_INDEPENDENT THEN +CONJ_TAC THENL [ALL_TAC; ASM SET_TAC[ORTHONORMAL_IMP_NONZERO]] THEN +RULE_ASSUM_TAC(REWRITE_RULE[orthonormal]) THEN +REWRITE_TAC[pairwise; IN_INSERT; NOT_IN_EMPTY] THEN +REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[orthogonal] THEN +ASM_MESON_TAC[DOT_SYM]);; + +let ORTHONORMAL_IMP_SPANNING = prove +(`!e1 e2 e3. orthonormal e1 e2 e3 ==> span {e1,e2,e3} = (:real^3)`, +REPEAT STRIP_TAC THEN +MP_TAC(ISPECL [`(:real^3)`; `{e1:real^3,e2,e3}`] CARD_EQ_DIM) THEN +ASM_SIMP_TAC[ORTHONORMAL_IMP_INDEPENDENT; SUBSET_UNIV] THEN +REWRITE_TAC[DIM_UNIV; DIMINDEX_3; HAS_SIZE; FINITE_INSERT; FINITE_EMPTY] THEN +SIMP_TAC[CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY; IN_INSERT] THEN +FIRST_ASSUM(ASSUME_TAC o MATCH_MP ORTHONORMAL_IMP_DISTINCT) THEN +ASM_REWRITE_TAC[NOT_IN_EMPTY; ARITH] THEN SET_TAC[]);; + +let th = prove +(`!e1 e2 e3. +orthonormal e1 e2 e3 +==> !x. ?t1 t2 t3. +x = t1 % e1 + t2 % e2 + t3 % e3 /\ +!tt1 tt2 tt3. +x = tt1 % e1 + tt2 % e2 + tt3 % e3 +==> tt1 = t1 /\ tt2 = t2 /\ tt3 = t3`, +REPEAT STRIP_TAC THEN +FIRST_ASSUM(MP_TAC o MATCH_MP ORTHONORMAL_IMP_SPANNING) THEN +DISCH_THEN(MP_TAC o AP_TERM `(IN) (x:real^3)`) THEN +REWRITE_TAC[IN_UNIV; SPAN_BREAKDOWN_EQ; SPAN_EMPTY; IN_SING] THEN +SIMP_TAC[VECTOR_ARITH `x - a - b - c = vec 0 <=> x:real^3 = a + b + c`] THEN +MAP_EVERY (fun t -> MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC t) +[`t1:real`; `t2:real`; `t3:real`] THEN +DISCH_THEN SUBST1_TAC THEN REWRITE_TAC[] THEN REPEAT GEN_TAC THEN +ONCE_REWRITE_TAC[REAL_ARITH `x:real = y <=> y - x = &0`] THEN +REWRITE_TAC[VECTOR_ARITH +`a % x + b % y + c % z:real^3 = a' % x + b' % y + c' % z <=> +(a - a') % x + (b - b') % y + (c - c') % z = vec 0`] THEN +DISCH_TAC THEN +FIRST_ASSUM(MP_TAC o MATCH_MP ORTHONORMAL_IMP_INDEPENDENT) THEN +REWRITE_TAC[INDEPENDENT_EXPLICIT] THEN DISCH_THEN(MP_TAC o CONJUNCT2) THEN +DISCH_THEN(MP_TAC o SPEC +`\x:real^3. if x = e1 then t1 - tt1:real +else if x = e2 then t2 - tt2 +else t3 - tt3`) THEN +FIRST_ASSUM(ASSUME_TAC o MATCH_MP ORTHONORMAL_IMP_DISTINCT) THEN +ASM_SIMP_TAC[VSUM_CLAUSES; FINITE_INSERT; FINITE_EMPTY] THEN +ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; VECTOR_ADD_RID] THEN +DISCH_THEN(fun th -> MAP_EVERY (MP_TAC o C SPEC th) +[`e1:real^3`; `e2:real^3`; `e3:real^3`]) THEN +ASM_SIMP_TAC[]);; + +(* the following lemma are in collect_geom.ml *) +(* Hi Truong, + +In the very latest snapshot there is a theorem COPLANAR_DET_EQ_0 +(I think I proved it because you asked for it some time ago). By +combing that with DET_3 you should be able to get your first +theorem COPLANAR_DET_VEC3_EQ_0. + +I will work on the other one NONCOPLANAR_3_BASIS and send it later +today.*) + + +(* +Hi Truong, + +Here is the other theorem. Fortunately I proved the rather tedious +lemma NOT_COPLANAR_0_4_IMP_INDEPENDENT earlier in this week for use +in the volume properties. + +John. + +have been in trig.ml + +let NOT_COPLANAR_0_4_IMP_INDEPENDENT = prove +(`!v1 v2 v3:real^N. ~coplanar {vec 0,v1,v2,v3} ==> independent {v1,v2,v3}`, +REPEAT GEN_TAC THEN REWRITE_TAC[independent; CONTRAPOS_THM] THEN +REWRITE_TAC[dependent] THEN +SUBGOAL_THEN +`!v1 v2 v3:real^N. v1 IN span {v2,v3} ==> coplanar{vec 0,v1,v2,v3}` +ASSUME_TAC THENL +[REPEAT STRIP_TAC THEN REWRITE_TAC[coplanar] THEN +MAP_EVERY EXISTS_TAC [`vec 0:real^N`; `v2:real^N`; `v3:real^N`] THEN +SIMP_TAC[AFFINE_HULL_EQ_SPAN; HULL_INC; IN_INSERT] THEN +REWRITE_TAC[INSERT_SUBSET; EMPTY_SUBSET] THEN +ASM_SIMP_TAC[SPAN_SUPERSET; IN_INSERT] THEN +POP_ASSUM MP_TAC THEN SPEC_TAC(`v1:real^N`,`v1:real^N`) THEN +REWRITE_TAC[GSYM SUBSET] THEN MATCH_MP_TAC SPAN_MONO THEN SET_TAC[]; +REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY] THEN +STRIP_TAC THEN ASM_REWRITE_TAC[] THEN +FIRST_X_ASSUM SUBST_ALL_TAC THENL +[FIRST_X_ASSUM(MP_TAC o SPECL [`v1:real^N`; `v2:real^N`; `v3:real^N`]); +FIRST_X_ASSUM(MP_TAC o SPECL [`v2:real^N`; `v3:real^N`; `v1:real^N`]); +FIRST_X_ASSUM(MP_TAC o SPECL [`v3:real^N`; `v1:real^N`; `v2:real^N`])] +THEN REWRITE_TAC[INSERT_AC] THEN DISCH_THEN MATCH_MP_TAC THEN +FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (SET_RULE +`a IN s ==> s SUBSET t ==> a IN t`)) THEN +MATCH_MP_TAC SPAN_MONO THEN SET_TAC[]]);; + +let NONCOPLANAR_3_BASIS = prove +(`!v1 v2 v3 v0 v:real^3. +~coplanar {v0, v1, v2, v3} +==> ?t1 t2 t3. +v = t1 % (v1 - v0) + t2 % (v2 - v0) + t3 % (v3 - v0) /\ +(!ta tb tc. +v = ta % (v1 - v0) + tb % (v2 - v0) + tc % (v3 - v0) +==> ta = t1 /\ tb = t2 /\ tc = t3)`, +GEN_GEOM_ORIGIN_TAC `v0:real^3` ["v"] THEN REPEAT GEN_TAC THEN +MAP_EVERY (fun t -> +ASM_CASES_TAC t THENL [ASM_REWRITE_TAC[INSERT_AC; COPLANAR_3]; ALL_TAC]) +[`v1:real^3 = vec 0`; `v2:real^3 = vec 0`; `v3:real^3 = vec 0`; +`v2:real^3 = v1`; `v3:real^3 = v1`; `v3:real^3 = v2`] THEN +DISCH_THEN(ASSUME_TAC o MATCH_MP NOT_COPLANAR_0_4_IMP_INDEPENDENT) THEN +REWRITE_TAC[VECTOR_SUB_RZERO] THEN +MP_TAC(ISPECL [`(:real^3)`; `{v1,v2,v3}:real^3->bool`] +CARD_GE_DIM_INDEPENDENT) THEN +ASM_REWRITE_TAC[SUBSET_UNIV; DIM_UNIV; DIMINDEX_3] THEN +ASM_SIMP_TAC[CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY] THEN +ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; ARITH; SUBSET; IN_UNIV] THEN +DISCH_THEN(MP_TAC o SPEC `v:real^3`) THEN +REWRITE_TAC[SPAN_BREAKDOWN_EQ; SPAN_EMPTY; IN_SING] THEN +REWRITE_TAC[VECTOR_ARITH `a - b:real^3 = c <=> a = b + c`] THEN +REWRITE_TAC[VECTOR_ADD_RID] THEN +MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `t1:real` THEN +MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `t2:real` THEN +MATCH_MP_TAC MONO_EXISTS THEN X_GEN_TAC `t3:real` THEN +DISCH_TAC THEN ASM_REWRITE_TAC[] THEN +MAP_EVERY X_GEN_TAC [`ta:real`; `tb:real`; `tc:real`] THEN DISCH_TAC THEN +FIRST_X_ASSUM(MP_TAC o GEN_REWRITE_RULE I [INDEPENDENT_EXPLICIT]) THEN +REWRITE_TAC[FINITE_INSERT; FINITE_EMPTY] THEN +DISCH_THEN(MP_TAC o SPEC +`(\x. if x = v1 then t1 - ta +else if x = v2 then t2 - tb else t3 - tc):real^3->real`) THEN +REWRITE_TAC[FORALL_IN_INSERT] THEN +SIMP_TAC[VSUM_CLAUSES; FINITE_INSERT; FINITE_EMPTY] THEN +ASM_REWRITE_TAC[IN_INSERT; NOT_IN_EMPTY; VECTOR_ADD_RID] THEN +REWRITE_TAC[REAL_ARITH `s - t = &0 <=> t = s`] THEN +DISCH_THEN MATCH_MP_TAC THEN UNDISCH_TAC +`t1 % v1 + t2 % v2 + t3 % v3:real^3 = ta % v1 + tb % v2 + tc % v3` THEN +VECTOR_ARITH_TAC);; + + +*) + + + +let DIV_POW2 = REAL_FIELD` (a/b) pow 2 = a pow 2 / (b pow 2 )`;; + + + +let REAL_LE_SQUARE_POW = REWRITE_RULE[GSYM REAL_POW_2] REAL_LE_SQUARE;; + + +let NOT_EQ0_IMP_TRIGIZABLE = prove(` ~( x = &0 /\ y = &0 ) ==> +( x / sqrt ( x pow 2 + y pow 2 )) pow 2 ++ ( y / sqrt ( x pow 2 + y pow 2 )) pow 2 = &1 `,REWRITE_TAC[DIV_POW2] THEN +ASSUME_TAC (MESON [REAL_LE_SQUARE_POW; REAL_LE_ADD]` +&0 <= x pow 2 + y pow 2 `) THEN +ASM_SIMP_TAC[SQRT_POW_2; REAL_FIELD` a / (m:real) + b / m = +( a + b ) / m `;GSYM REAL_SOS_EQ_0; REAL_DIV_REFL]);; + + + +let POW2_1 = REAL_ARITH` ( &1 ) pow 2 = &1`;; + +let ABS_BOUNDS = REAL_ABS_BOUNDS;; + +let POW2_1_BOUNDED = prove( +` a pow 2 + b pow 2 = &1 ==> -- &1 <= a /\ a <= &1 `, +REWRITE_TAC[REAL_ARITH` a + b = c <=> b = c - a `] THEN +NHANH ( MESON[REAL_LE_POW_2]`a pow 2 = x ==> &0 <= x `) THEN +ONCE_REWRITE_TAC[REAL_ARITH` &1 = &1 pow 2 `] THEN +REWRITE_TAC[REAL_SUB_LE; GSYM REAL_LE_SQUARE_ABS; ABS_1; POW2_1; +ABS_BOUNDS] THEN SIMP_TAC[]);; + +let POW2_1_BOUNDED = +MESON[REAL_ADD_SYM; POW2_1_BOUNDED; REAL_ABS_BOUNDS]` +a pow 2 + b pow 2 = &1 ==> abs a <= &1 /\ abs b <= &1 `;; + +let SIN_COMPLEMENTIVE = prove(` sin x = sin ( pi - x ) `, +REWRITE_TAC[SIN_COS; REAL_ARITH` a / &2 - ( a - x ) = +-- ( a / &2 - x )`; COS_NEG]);; + + +let CYLINDER_CORDINATE = prove(` ! w u e1 e2 (e3:real^3) x. +orthonormal e1 e2 e3 /\ +e3 = ( &1 / norm ( w - u )) % ( w - u ) /\ +~ ( x IN aff {w,u} ) /\ ~( w = u ) +==> +(? r phi h. &0 < r /\ +x = u + (r * ( cos phi )) % e1 + +( r * sin phi) % e2 ++ h % ( w - u ) ) `, +REPEAT GEN_TAC THEN +REWRITE_TAC[orthonormal; GSYM DET_VEC3_AS_CROSS_DOT] THEN +NHANH (REAL_LT_IMP_NZ) THEN +ONCE_REWRITE_TAC[MESON[VECTOR_SUB_RZERO]` fv a b c = fv ( a - vec 0 ) ( b - vec 0 ) +( c - vec 0 ) `] THEN +REWRITE_TAC[GSYM COPLANAR_DET_VEC3_EQ_0] THEN +NHANH (SPECL [`e1 : real^3`;` e2 :real^3`; `e3 :real^3`; +`(vec 0 : real^3)`; `(x : real^3) - u` ] NONCOPLANAR_3_BASIS) THEN +REWRITE_TAC[VECTOR_SUB_RZERO] THEN +STRIP_TAC THEN +ASM_CASES_TAC` t1 = &0 /\ t2 = &0 ` THENL [ +FIRST_X_ASSUM (CONJUNCTS_THEN ASSUME_TAC) THEN +(ASSUME_TAC o FOR_ASM ) (prove(` t1 = &0 /\ t2 = &0 /\ +x - u= t1 % e1 + t2 % e2 + t3 % e3 +==> (x:real^3) - u = t3 % e3 `, +SIMP_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID])) THEN +FIRST_X_ASSUM MP_TAC THEN +UNDISCH_TAC` e3 = &1 / norm (w - u) % (w - (u:real^3))` THEN +SIMP_TAC[VECTOR_MUL_ASSOC; VECTOR_ARITH` +a -(b:real^n) = n % ( c - b )<=> a = n % c + +( &1 - n ) % b `] THEN +UNDISCH_TAC ` ~( x IN aff {w,(u:real^3)} )` THEN +REWRITE_TAC[AFF2; IN_ELIM_THM] THEN +MESON_TAC[]; +FIRST_X_ASSUM MP_TAC] THEN +NHANH NOT_EQ0_IMP_TRIGIZABLE THEN +NHANH CIRCLE_SINCOS THEN +SIMP_TAC[GSYM REAL_SOS_EQ_0] THEN +ONCE_REWRITE_TAC[MESON[]` a /\b ==> c <=> a ==> b ==> c `] THEN +SIMP_TAC[GSYM SQRT_EQ_0; MESON[REAL_LE_POW_2; +REAL_LE_ADD]` &0 <= t1 pow 2 + t2 pow 2 `; REAL_FIELD` +~ ( a = &0 ) ==> (t / a = d <=> t = a * d ) `] THEN +REPEAT STRIP_TAC THEN +UNDISCH_TAC`x - u = t1 % e1 + t2 % e2 + t3 % (e3: real^3)` THEN +REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN +UNDISCH_TAC` e3 = &1 / norm (w - u) % (w - (u:real^3))` THEN +PURE_ONCE_REWRITE_TAC[MESON[]` a = b ==> P a <=> a = b ==> +P b `] THEN +ABBREV_TAC `tt = t1 pow 2 + t2 pow 2 ` THEN +SIMP_TAC[] THEN +REPLICATE_TAC 3 DISCH_TAC THEN +REWRITE_TAC[VECTOR_ARITH` a - b = c <=> a = b + (c:real^N)`; +VECTOR_MUL_ASSOC] THEN REWRITE_TAC[REAL_ARITH` &0 < r /\ ~( r = &0 ) <=> &0 < r `] THEN +ASSUME_TAC2 (MESON[SQRT_POS_LE; REAL_LE_POW_2; REAL_LE_ADD]` t1 pow 2 + +t2 pow 2 = tt ==> &0 <= sqrt tt `) THEN +ASSUME_TAC2 (REAL_ARITH` ~ ( sqrt tt = &0 ) /\ &0 <= sqrt tt +==> &0 < sqrt tt `) THEN FIRST_ASSUM MP_TAC THEN MESON_TAC[]);; + + + + +(* NOT NEED AT ALL +let arith_lemma = prove +(`!a d x. &0 < d ==> +?y. (a <= y /\ y <= a + d) /\ ?n. y = x + &n * d \/ x = y + &n * d`, +REPEAT STRIP_TAC THEN DISJ_CASES_TAC (SPEC `(x - a):real` REAL_LE_NEGTOTAL) +THEN IMP_RES_THEN (IMP_RES_THEN STRIP_ASSUME_TAC) REAL_ARCH_LEAST THENL +[ EXISTS_TAC `x - &n * d` THEN STRIP_TAC THENL +[ (POP_ASSUM MP_TAC) THEN (POP_ASSUM MP_TAC) THEN +REWRITE_TAC [GSYM REAL_OF_NUM_SUC] THEN REAL_ARITH_TAC ; +EXISTS_TAC `n:num` THEN REAL_ARITH_TAC ] ; +EXISTS_TAC `x + &(SUC n) * d` THEN STRIP_TAC THENL +[ (POP_ASSUM MP_TAC) THEN (POP_ASSUM MP_TAC) THEN +REWRITE_TAC [GSYM REAL_OF_NUM_SUC] THEN REAL_ARITH_TAC ; +EXISTS_TAC `(SUC n):num` THEN REAL_ARITH_TAC ]]);; +*) + + +let COS_SUM_2PI = prove( +`! x. cos x = cos ( &2 * pi - x ) `, GEN_TAC THEN +ONCE_REWRITE_TAC[GSYM COS_NEG] THEN +PAT_ONCE_REWRITE_TAC `\x. _ = x ` [GSYM COS_PERIODIC] THEN +REWRITE_TAC[REAL_ARITH` --( a - b) + a = b `; COS_NEG]);; + + + +let POW2_EQ_0 = prove(` ! a. a pow 2 = &0 <=> a = &0 `, +GEN_TAC THEN MP_TAC REAL_LE_POW_2 THEN +ASSUME_TAC (GEN_ALL NOT_ZERO_EQ_POW2_LT) THEN +REWRITE_TAC[REAL_LE_LT] THEN +FIRST_ASSUM (fun th -> REWRITE_TAC[GSYM th] ) THEN +ASM_MESON_TAC[]);; + + +let UNIT_BOUNDED_IN_TOW_FORMS = prove(`-- &1 <= a /\ a <= &1 ==> &0 <= &1 - a pow 2 `, +DISCH_TAC THEN REWRITE_TAC[REAL_ARITH` &1 - a pow 2 = (&1 - a ) * ( &1 + a )`] THEN +MATCH_MP_TAC REAL_LE_MUL THEN ASM_REAL_ARITH_TAC);; + + +let COS_TOTAL = prove(`-- &1 <= a /\ a <= &1 ==> (?!x. &0 <= x /\ x <= pi /\ cos x = a ) `, +NHANH (UNIT_BOUNDED_IN_TOW_FORMS) THEN NHANH_PAT `\a. a ==> _` SQRT_WORKS THEN +ONCE_REWRITE_TAC[REAL_ARITH` a = &1 - b pow 2 <=> b pow 2 + a = &1 `] THEN +SIMP_TAC[EXISTS_UNIQUE] THEN NHANH SINCOS_TOTAL_PI THEN +STRIP_TAC THEN EXISTS_TAC` t:real` THEN ASM_SIMP_TAC[] THEN +ASM_MESON_TAC[COS_INJ_PI]);; + + + + +let SUM_POW2_EQ1_UNIQUE_TRIG = prove(` ! a b. a pow 2 + b pow 2 = &1 ==> (?!x. &0 <= x /\ +x < &2 * pi /\ cos x = a /\ sin x = b )`, +REPEAT GEN_TAC THEN NHANH (POW2_1_BOUNDED) THEN +REWRITE_TAC[REAL_ABS_BOUNDS] THEN +NHANH_PAT `\x. _ /\ x /\ _ ==> h ` COS_TOTAL THEN +PAT_REWRITE_TAC `\x. _ /\ _ /\ x ==> _ ` [REAL_ARITH` +-- &1 <= b /\ b <= &1 <=> -- &1 <= b /\ b < &0 \/ &0 <= b /\ +b <= &1 `] THEN REWRITE_TAC[EXISTS_UNIQUE] THEN STRIP_TAC +THENL [ASSUME_TAC PI_POS THEN ASM_CASES_TAC ` x = &0 ` THENL [ +FIRST_X_ASSUM SUBST_ALL_TAC THEN EXISTS_TAC ` &0` THEN +SUBST_ALL_TAC COS_0 THEN FIRST_X_ASSUM (SUBST_ALL_TAC o SYM ) +THEN UNDISCH_TAC `&1 pow 2 + b pow 2 = &1 ` THEN +REWRITE_TAC[REAL_ARITH` &1 pow 2 + b = &1 <=> +b = &0 `; POW2_EQ_0] THEN DISCH_TAC THEN +ASM_MESON_TAC[REAL_ARITH` b < &0 /\ b = &0 ==> F `]; +EXISTS_TAC ` &2 * pi - x ` THEN ASSUME_TAC2 ( +REAL_ARITH` x <= pi /\ &0 < pi ==> &0 <= &2 * pi - x `) THEN +FIRST_X_ASSUM SIMP_TAC1 THEN +ASSUME_TAC2 (REAL_ARITH` &0 <= x /\ ~( x = &0 ) ==> &0 < x `) THEN +REWRITE_TAC[REAL_ARITH` a - b < a <=> &0 < b `] THEN +FIRST_X_ASSUM SIMP_TAC1 THEN +REWRITE_TAC[GSYM COS_SUM_2PI; REAL_ARITH` a - b = +-- b + a `; SIN_PERIODIC; SIN_NEG] THEN +SIMP_TACC1 (TAUT` cos x = a ==> cos x = a `) THEN +SIMP_IDENT[] `cos x = a ` THEN +ASSUME_TAC2 (REAL_ARITH` b < &0 ==> b <= &0 `) THEN +ASSUME_TAC (SPEC_ALL SIN_CIRCLE) THEN +USE_FIRST `cos x = a` SUBST_ALL_TAC THEN +ASSUME_TAC2 (REAL_ARITH` sin x pow 2 + a pow 2 = &1 /\ +a pow 2 + b pow 2 = &1 ==> sin x pow 2 = b pow 2 `) THEN +SUBST_ALL_TAC (REAL_ARITH` b pow 2 = ( -- b ) pow 2 `) THEN +ASSUME_TAC2 (REAL_ARITH` b < &0 ==> &0 <= -- b `) THEN +ASSUME_TAC2 (SPEC_ALL SIN_POS_PI_LE) THEN +ASSUME_TAC2 (MESON[EQ_POW2_COND]` &0 <= -- b /\ +&0 <= sin x /\sin x pow 2 = -- b pow 2 ==> sin x = -- b `) THEN +SIMP_IDENT[REAL_NEGNEG] `sin x = -- b ` THEN +REPEAT STRIP_TAC THEN +UNDISCH_TAC `y < &2 * pi ` THEN +ONCE_SIMP_IDENT ` &0 < pi ` (REAL_ARITH` &0 < p ==> ( x +< &2 * p <=> x <= p \/ p < x /\ x < &2 * p )`) THEN +STRIP_TAC] THENL [ +ASSUME_TAC2 (SPEC `y:real` SIN_POS_PI_LE) THEN +ASSUME_TAC2 (REAL_ARITH` sin y = b /\ &0 <= sin y ==> +&0 <= b `) THEN UNDISCH_TAC ` b < &0 ` THEN +SIMP_IDENT[REAL_ARITH` &0 <= b <=> ~(b < &0 )`] `&0 <= b`; +REWRITE_TAC[REAL_ARITH` y = -- x + b <=> b - y = x `] THEN +REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN PHA THEN +REWRITE_TAC[REAL_ARITH` a < x /\ x < &2 * a <=> +&0 < &2 * a - x /\ &2 * a - x < a `] THEN +UNDISCH_TAC ` cos y = a ` THEN +ONCE_REWRITE_TAC[COS_SUM_2PI] THEN +NHANH (REAL_LT_IMP_LE) THEN +UNDISCH_TAC `!y. &0 <= y /\ y <= pi /\ cos y = a ==> y = x` THEN +MESON_TAC[]];EXISTS_TAC `x:real` THEN +SIMP_IDENT[] `&0 <= x ` THEN +SIMP_IDENT[]` cos x = a ` THEN +ASSUME_TAC PI_POS THEN +ASSUME_TAC2 (REAL_ARITH` x <= pi /\ &0 < pi ==> +x < &2 * pi `) THEN +SIMP_IDENT[]` x < &2 * pi` THEN +ASSUME_TAC (SPEC_ALL SIN_CIRCLE) THEN +USE_FIRST `cos x = a ` SUBST_ALL_TAC THEN +ASSUME_TAC2 (REAL_ARITH` a pow 2 + b pow 2 = &1 /\ +sin x pow 2 + a pow 2 = &1 ==> b pow 2 = sin x pow 2 `) THEN +ASSUME_TAC2 (SPEC_ALL SIN_POS_PI_LE) THEN +ASSUME_TAC2 (MESON[EQ_POW2_COND]` b pow 2 = sin x pow 2 +/\ &0 <= sin x /\ &0 <= b ==> sin x = b `) THEN +SIMP_IDENT[]` sin x = b ` THEN +ONCE_SIMP_IDENT ` &0 < pi ` (REAL_ARITH` &0 < p ==> ( x +< &2 * p <=> x <= p \/ p < x /\ x < &2 * p )`) THEN +REPEAT STRIP_TAC THENL [ASM_MESON_TAC[]; +ASSUME_TAC2 (REAL_ARITH` pi < y /\ y < &2 * pi ==> +&0 < y - pi /\ y - pi < pi `)] THEN +ASSUME_TAC (UNDISCH (SPEC ` y - pi ` SIN_POS_PI)) THEN +UNDISCH_TAC ` &0 < sin ( y - pi )` THEN +ONCE_REWRITE_TAC[GSYM SIN_PERIODIC] THEN +REWRITE_TAC[REAL_ARITH` a - b + &2 * b = a + b `; +SIN_PERIODIC_PI] THEN ASM_REWRITE_TAC[] THEN +SIMP_IDENT[REAL_ARITH` &0 <= a ==> ~( &0 < -- a )`] +` &0 <= b `]);; + + + + +let PERIODIC_AT0_IMP_ANY = prove( +` ! f p t. &0 < p /\ +(! x. f x = f ( x + p )) ==> +((?!x. &0 <= x /\ x < p /\ f x ) <=> (! t. &0 <= t /\ +t < p ==> (?!x. t <= x /\ +x < t + p /\ f x )))`, +REPEAT STRIP_TAC THEN REWRITE_TAC[EXISTS_UNIQUE] THEN +EQ_TAC THENL [REPEAT STRIP_TAC +THEN ASM_CASES_TAC ` t <= (x:real) ` THENL [ +EXISTS_TAC `x:real` THEN SIMP_IDENT[] `t <= x ` +THEN SIMP_IDENT[] `(f: real -> bool) x` THEN +ELIM_IDENTS (REAL_ARITH` x < p /\ &0 <= t ==> +x < t + p `) THEN REPEAT STRIP_TAC THEN +ASM_CASES_TAC ` y < (p:real)` THENL [ +ASSUME_TAC2 (REAL_ARITH` &0 <= t /\ t <= y ==> +&0 <= y `) THEN ASM_MESON_TAC[]; +DOWN_TAC THEN REWRITE_TAC[REAL_ARITH` ~( a < b ) <=> +&0 <= a - b `; REAL_ARITH` a < b + c <=> +a - c < b `] THEN STRIP_TAC THEN +ASSUME_TAC2 (REAL_ARITH` y - p < t /\ t < p ==> +y - p < p `) THEN +ASSUME_TAC2 (prove(`(! a. f a <=> f ( a + (p:real)) )/\ f y ==> +f ( y - p )`, PAT_ONCE_REWRITE_TAC `\x. _ /\ x ==> _` +[REAL_ARITH` a = a - p + p `] THEN MESON_TAC[])) THEN +SUBST_ALL_TAC ( +MESON[]`(!y. &0 <= y /\ y < p /\ f y ==> y = x) +<=> (!y. &0 <= y ==> y < p ==> f y ==> y = x)`) THEN +ASSUME_TAC2 ( +MESON[]`(!(y:real). &0 <= y ==> y < p ==> f y ==> y = x) /\ +&0 <= y - p /\y - p < p /\ f ((y:real) - p) ==> x = y - p `) THEN +REWRITE_TAC[REAL_ARITH` y = y - p <=> p = &0 `] THEN +ASM_MESON_TAC[REAL_ARITH` y < t /\ x = y ==> +~( t <= x ) `]];EXISTS_TAC `x + p ` THEN +SUBST_ALL_TAC (REAL_ARITH` ~( t <= x ) <=> x < t `) THEN +ELIM_IDENTS (REAL_ARITH` t < p /\ &0 <= x /\ x < t ==> +t <= x + p /\ x + p < t + p `) THEN +ELIM_IDENTS (MESON[]`(!x. f x <=> f ( x + (p:real))) +/\ f x ==> f ( x + p )`) THEN +REWRITE_TAC[REAL_ARITH` a < b + c <=> a - c < b `] THEN +REPEAT STRIP_TAC THEN +ASM_CASES_TAC ` &0 <= y - p ` THEN +ASSUME_TAC2 (REAL_ARITH` y - p < t /\ t < p ==> +y - p < p `) THEN +ASSUME_TAC2 (prove(`(! a. f a <=> f ( a + (p:real)) )/\ f y ==> +f ( y - p )`, PAT_ONCE_REWRITE_TAC `\x. _ /\ x ==> _` +[REAL_ARITH` a = a - p + p `] THEN MESON_TAC[]))] +THENL [SUBST_ALL_TAC ( +MESON[]`(!y. &0 <= y /\ y < p /\ f y ==> y = x) +<=> (!y. &0 <= y ==> y < p ==> f y ==> y = x)`) THEN +ASSUME_TAC2 ( +MESON[]`(!y. &0 <= y ==> y < p ==> f y ==> y = x) /\ +&0 <= y - p /\ y - p < p /\ f ( y - p) ==> y - p += x `) THEN +(SIMP_IDENT[REAL_ARITH` a - b = c <=> a = b + c `] +`y - p = (x:real) `) THEN SIMP_TAC[REAL_ADD_SYM]; +SUBST_ALL_TAC (REAL_ARITH`~( &0 <= y - p ) <=> y < p `) THEN +ASSUME_TAC2 (REAL_ARITH` &0 <= t /\ t <= y ==> +&0 <= y `) THEN SUBST_ALL_TAC ( +MESON[]`(!y. &0 <= y /\ y < p /\ f y ==> y = x) +<=> (!y. &0 <= y ==> y < p ==> f y ==> y = x)`) THEN +ASSUME_TAC2 (MESON[]`(!y. &0 <= y ==> y < p ==> f y ==> y = x)/\ +f y /\ y < p /\ &0 <= y ==> y = x `) THEN +(CONTR_TAC o UNDISCH_ALL o REAL_ARITH) ` y = x ==> x < t ==> t <= y ==> F `]; +DISCH_TAC THEN FIRST_X_ASSUM (ASSUME_TAC o (SPEC +` &0 ` )) THEN ASSUME_TAC (REAL_ARITH` &0 <= &0 `) +THEN DOWN_TAC THEN REWRITE_TAC[REAL_ADD_LID] +THEN MESON_TAC[]]);; + + + + + + +let SUM_TWO_POW2S = MESON[REAL_LE_POW_2; REAL_LE_ADD]` &0 <= a pow 2 + b pow 2 `;; + + + +let IDENT_WHEN_IDENT_SIN_COS = prove(` +&0 <= x' /\ x' < &2 * pi /\ &0 <= p /\ p < &2 * pi /\ +cos x' = cos p /\ sin x' = sin p ==> p = x' `, +MP_TAC SIN_CIRCLE THEN +ONCE_REWRITE_TAC[REAL_ADD_SYM] THEN +MESON_TAC[SUM_POW2_EQ1_UNIQUE_TRIG]);; + + + + + + + +let UNIQUE_EXISTSENCE_OF_RPHIH = +prove(`!w u (e1: real^3) e2 e3 x. +orthonormal e1 e2 e3 /\ +e3 = &1 / norm (w - u) % (w - u) /\ +~(x IN aff {w, u}) /\ +~(w = u) +==> (?r phii h. +(&0 <= phii /\ +phii < &2 * pi /\ +&0 < r /\ +x = +u + (r * cos phii) % e1 + (r * sin phii) % e2 + h % (w - u)) /\ +(!rr p hh. +&0 <= p /\ +p < &2 * pi /\ +&0 < rr /\ +x = +u + (rr * cos p) % e1 + (rr * sin p) % e2 + hh % (w - u) +==> rr = r /\ p = phii /\ hh = h))`, +REPEAT GEN_TAC THEN +REWRITE_TAC[orthonormal; GSYM DET_VEC3_AS_CROSS_DOT] THEN +NHANH (REAL_LT_IMP_NZ) THEN +ONCE_REWRITE_TAC[MESON[VECTOR_SUB_RZERO]` fv a b c = fv ( a - vec 0 ) ( b - vec 0 ) +( c - vec 0 ) `] THEN +REWRITE_TAC[GSYM COPLANAR_DET_VEC3_EQ_0] THEN +NHANH (SPECL [`e1 : real^3`;` e2 :real^3`; `e3 :real^3`; +`(vec 0 : real^3)`; `(x : real^3) - u` ] NONCOPLANAR_3_BASIS) THEN +REWRITE_TAC[VECTOR_SUB_RZERO] THEN +STRIP_TAC THEN +ASM_CASES_TAC` t1 = &0 /\ t2 = &0 ` THENL [ +FIRST_X_ASSUM (CONJUNCTS_THEN ASSUME_TAC) THEN +(ASSUME_TAC o FOR_ASM ) (prove(` t1 = &0 /\ t2 = &0 /\ +x - u= t1 % e1 + t2 % e2 + t3 % e3 +==> (x:real^3) - u = t3 % e3 `, +SIMP_TAC[VECTOR_MUL_LZERO; VECTOR_ADD_LID])) THEN +FIRST_X_ASSUM MP_TAC THEN +UNDISCH_TAC` e3 = &1 / norm (w - u) % (w - (u:real^3))` THEN +SIMP_TAC[VECTOR_MUL_ASSOC; VECTOR_ARITH` +a -(b:real^n) = n % ( c - b )<=> a = n % c + +( &1 - n ) % b `] THEN +UNDISCH_TAC ` ~( x IN aff {w,(u:real^3)} )` THEN +REWRITE_TAC[AFF2; IN_ELIM_THM] THEN +MESON_TAC[]; +FIRST_X_ASSUM MP_TAC THEN +NHANH NOT_EQ0_IMP_TRIGIZABLE THEN +NHANH SUM_POW2_EQ1_UNIQUE_TRIG THEN +PAT_REWRITE_TAC `\x. _ /\ _ /\ x ==> _ ` +[REAL_ARITH` a < &2 * b <=> a < &0 + &2 * b `] THEN +SIMP_TAC[GSYM REAL_SOS_EQ_0] THEN +ONCE_REWRITE_TAC[MESON[]` a /\b ==> c <=> a ==> b ==> c `] THEN +SIMP_TAC[GSYM SQRT_EQ_0; MESON[REAL_LE_POW_2; +REAL_LE_ADD]` &0 <= t1 pow 2 + t2 pow 2 `; REAL_FIELD` +~ ( a = &0 ) ==> (d = t / a <=> t = a * d ) `] THEN +REWRITE_TAC[EXISTS_UNIQUE] THEN +REPEAT STRIP_TAC THEN +UNDISCH_TAC`x - u = t1 % e1 + t2 % e2 + t3 % (e3: real^3)` THEN +ABBREV_TAC ` tt = t1 pow 2 + t2 pow 2 ` THEN +UNDISCH_TAC ` t1 = sqrt tt * cos x' ` THEN +UNDISCH_TAC ` t2 = sqrt tt * sin x' ` THEN +SIMP_TAC[] THEN +REWRITE_TAC[VECTOR_ARITH` a - b = c <=> a = b + (c:real^N)`] THEN +REPEAT STRIP_TAC THEN +EXISTS_TAC ` sqrt tt ` THEN +EXISTS_TAC ` x' :real ` THEN +EXISTS_TAC ` t3 * ( &1 / norm ( (w:real^3) - u )) ` THEN +CONJ_TAC THENL [ +UNDISCH_TAC`x = u + (sqrt tt * cos x') % e1 + +(sqrt tt * sin x') % e2 + t3 % (e3 : real^3 )` THEN +UNDISCH_TAC` e3 = &1 / norm (w - u) % (w - (u:real^3))` THEN +REWRITE_TAC[REAL_ARITH` &0 < a /\ ~( a = &0 ) <=> &0 < a `] THEN +ASSUME_TAC2 (REAL_ARITH` x' < &0 + &2 * pi ==> x' < +&2 * pi `) THEN +ASSUME_TAC2 (MESON[SQRT_POS_LE; REAL_LE_POW_2; REAL_LE_ADD]` t1 pow 2 + +t2 pow 2 = tt ==> &0 <= sqrt tt `) THEN +ASSUME_TAC2 (REAL_ARITH` ~ ( sqrt tt = &0 ) /\ &0 <= sqrt tt +==> &0 < sqrt tt `) THEN +UNDISCH_TAC ` &0 < sqrt tt ` THEN +UNDISCH_TAC ` x' < &2 * pi ` THEN +UNDISCH_TAC ` &0 <= x' ` THEN +SIMP_TAC[VECTOR_MUL_ASSOC]; +IMP_TAC THEN IMP_TAC THEN IMP_TAC THEN IMP_TAC THEN +REPEAT GEN_TAC THEN REPEAT DISCH_TAC THEN +UNDISCH_TAC `!ta tb tc. +x - (u:real^3) = ta % e1 + tb % e2 + tc % e3 +==> ta = t1 /\ tb = t2 /\ tc = t3` THEN +FIRST_X_ASSUM MP_TAC THEN +UNDISCH_TAC`x = u + (sqrt tt * cos x') % e1 ++ (sqrt tt * sin x') % e2 + t3 % (e3:real^3)` THEN +REWRITE_TAC[VECTOR_ARITH` a - b = (c:real^N) +<=> a = b + c `] THEN +UNDISCH_TAC`e3 = &1 / norm (w - u) % (w - (u:real^3))` THEN +UNDISCH_TAC` ~(w = (u:real^3) )` THEN +PHA THEN +PAT_ONCE_REWRITE_TAC `\x. x /\ _ ==> _ ` +[VECTOR_ARITH` ( a = (b:real^N)) +<=> ( a - b = vec 0 )`] THEN +REWRITE_TAC[ GSYM NORM_POS_LT] THEN +NHANH (MESON[REAL_FIELD ` &0 < a ==> a * &1 / a = &1`; +VECTOR_MUL_ASSOC]` &0 < a /\ aa = &1 / a % bb /\ l ==> +a % aa = ( &1 )% bb `) THEN +REWRITE_TAC[VECTOR_MUL_LID] THEN +DAO THEN +IMP_TAC THEN +DISCH_THEN (ASSUME_TAC o SYM) THEN +FIRST_ASSUM ( fun th -> PAT_ONCE_REWRITE_TAC ` +\x. _ /\ x /\ _ ==> _ ` [ th]) THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN +NHANH (MESON[]` (!ta tb tc. +x = u + ta % e1 + tb % e2 + tc % e3 ==> tc = t3 /\ ta = t1 /\ tb = t2 ) /\ +x = u + h1 % e1 + h2 % e2 + h3 % e3 /\ +x = u + l1 % e1 + l2 % e2 + l3 % e3 /\ ll ==> +l1 = h1 /\ l2 = h2 /\ l3 = h3 `) THEN +STRIP_TAC THEN +ELIM_IDENTS (REAL_FIELD` &0 < norm ((w:real^3) - u) /\ t3 = hh * norm ( w - u ) +==> hh = t3 * &1 / norm ( w - u ) `) THEN +REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN +PHA THEN +NHANH (MESON[]` a = b /\ aa = bb /\ l ==> a pow 2 + aa pow 2 = +b pow 2 + bb pow 2 `) THEN +REWRITE_TAC[REAL_ARITH` (a * b ) pow 2 + (a * c ) pow 2 = +a pow 2 * ( c pow 2 + b pow 2 ) `; SIN_CIRCLE; REAL_MUL_RID] THEN +ASSUME_TAC2 (MESON[SUM_TWO_POW2S]` t1 pow 2 + t2 pow 2 = tt +==> &0 <= tt `) THEN +ASSUME_TAC2 (SPEC `tt:real` SQRT_POS_LE) THEN +ASSUME_TAC2 (SPECL[` &0`;` rr:real `] REAL_LT_IMP_LE) THEN +ASSUME_TAC2 (SPECL[` rr:real `;` sqrt tt `] EQ_POW2_COND) THEN +FIRST_X_ASSUM (MP_TAC o SYM) THEN +PAT_ONCE_REWRITE_TAC `\x. (x <=> _ ) ==> _` [EQ_SYM_EQ] THEN +SIMP_TAC[] THEN +REPEAT STRIP_TAC THEN +FIRST_X_ASSUM (SUBST_ALL_TAC o SYM) THEN +ASSUME_TAC2 (REAL_FIELD` &0 < rr /\ rr * cos x' = rr * cos p /\ +rr * sin x' = rr * sin p ==> +cos x' = cos p /\ sin x' = sin p `) THEN +SUBST_ALL_TAC (REAL_ARITH` x' < &0 + &2 * pi <=> x' < &2 * pi `) THEN +FIRST_X_ASSUM (CONJUNCTS_THEN ASSUME_TAC) THEN +ELIM_IDENTS IDENT_WHEN_IDENT_SIN_COS]]);; + + + +let REAL_EXISTS_UNIQUE_TRANSABLE = +prove(` ! f (t:real). (?!x. f x ) <=> (?!x. f (x - t))`, +REWRITE_TAC[EXISTS_UNIQUE] THEN REPEAT GEN_TAC THEN EQ_TAC THENL [ +STRIP_TAC THEN EXISTS_TAC `x + (t:real)` THEN +ASM_REWRITE_TAC[REAL_ARITH` (a + b ) - b = a `] THEN +ASM_MESON_TAC[REAL_EQ_SUB_RADD; REAL_ARITH` (a + b ) - b = a `]; +STRIP_TAC THEN EXISTS_TAC ` x - (t:real)` THEN +ASM_REWRITE_TAC[] THEN GEN_TAC THEN ONCE_REWRITE_TAC +[REAL_ARITH` x = ( x + t ) - t `] THEN DISCH_TAC THEN +SUBGOAL_THEN ` y + t = (x:real)` ASSUME_TAC THENL +[ASM_MESON_TAC[]; ASM_REAL_ARITH_TAC]]);; + +(* ==================================================================== *) +(* in thms_doing_works.ml *) +(* ==================================================================== *) +(* ==================================================================== *) + + + +let COND_FOR_EXISTS_ANY_PERI = prove(` &0 < p /\ (!x. f x <=> f (x + p)) +/\ (?!x. &0 <= x /\ x < p /\ f x) ==> +(! t . &0 <= t /\ t < p ==> (?!x. t <= x /\ x < t + p /\ f x)) `, +ASSUME_TAC (SPEC_ALL PERIODIC_AT0_IMP_ANY) THEN ASM_MESON_TAC[]);; + + + +let IN_ORIGIN_PERIOD_IMP_UNIQUENESS = +prove(` ! x t. &0 <= t /\ t < &2 * pi ==> (?!gg. &0 <= gg /\ +gg < &2 * pi /\ cos x = cos ( t + gg ) +/\ sin x = sin ( t + gg )) `, REPEAT STRIP_TAC THEN +MP_TAC (ONCE_REWRITE_RULE[REAL_ADD_SYM] (SPEC_ALL SIN_CIRCLE)) THEN +NHANH SUM_POW2_EQ1_UNIQUE_TRIG THEN STRIP_TAC THEN +ONCE_REWRITE_TAC[REAL_EXISTS_UNIQUE_TRANSABLE] THEN +REWRITE_TAC[REAL_SUB_LE; REAL_LT_SUB_RADD; REAL_SUB_ADD2 ] THEN +ASSUME_TAC SIN_PERIODIC THEN ASSUME_TAC COS_PERIODIC THEN +MP_TAC PI_POS THEN +PAT_ONCE_REWRITE_TAC `\x. x ==> _ ` [REAL_ARITH` &0 < a <=> +&0 < &2 * a `] THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +ONCE_REWRITE_TAC[REAL_ADD_SYM] THEN +DISCH_TAC THEN UNDISCH_TAC ` t < &2 * pi ` THEN +UNDISCH_TAC ` &0 <= t ` THEN PHA THEN +SPEC_TAC (`t:real`,`t:real`) THEN +MATCH_MP_TAC COND_FOR_EXISTS_ANY_PERI THEN ASM_MESON_TAC[]);; + + + +let GIVEN_VALUED_IMP_UNIQUE_EXISTENCE = prove( +`! x0. (?!x. &0 <= x /\ x < &2 * pi /\ cos x = cos x0 /\ +sin x = sin x0 )`, REPEAT STRIP_TAC THEN +MP_TAC (ONCE_REWRITE_RULE[REAL_ADD_SYM] SIN_CIRCLE) THEN +NHANH SUM_POW2_EQ1_UNIQUE_TRIG THEN SIMP_TAC[]);; + + + +let EYFCXPP = prove(` !w u e1 e2 e3 (x1:real ^3 ) x2. +orthonormal e1 e2 e3 /\ +e3 = &1 / norm (w - u) % (w - u) /\ +~(x1 IN aff {w, u}) /\ +~(x2 IN aff {w,u}) /\ +~(w = u) +==> (? r1 r2 phii ssi h1 h2. +((&0 <= phii /\ +phii < &2 * pi /\ +&0 <= ssi /\ ssi < &2 * pi /\ +&0 < r1 /\ &0 < r2 /\ +x1 = +u + +(r1 * cos phii) % e1 + +(r1 * sin phii) % e2 + +h1 % (w - u) /\ +x2 = u + +(r2 * cos (phii + ssi )) % e1 + +(r2 * sin (phii + ssi )) % e2 + +h2 % (w - u))) /\ +(! rr1 rr2 pphii ssii h11 h22. +(&0 <= pphii /\ +pphii < &2 * pi /\ +&0 <= ssii /\ ssii < &2 * pi /\ +&0 < rr1 /\ &0 < rr2 /\ +x1 = +u + +(rr1 * cos pphii) % e1 + +(rr1 * sin pphii) % e2 + +h11 % (w - u) /\ +x2 = u + +(rr2 * cos (pphii + ssii )) % e1 + +(rr2 * sin (pphii + ssii )) % e2 + +h22 % (w - u)) ==> +rr1 = r1 /\ rr2 = r2 /\ pphii = phii /\ +ssii = ssi /\ h11 = h1 /\ h22 = h2 ) )`, +ONCE_REWRITE_TAC[MESON[]` a1 /\a2/\a3/\a4 /\a5 <=> +(a1/\a2/\a3/\a5) /\ a4 `] THEN +NHANH UNIQUE_EXISTSENCE_OF_RPHIH THEN +ONCE_REWRITE_TAC[MESON[]` (( a1 /\a2/\a3/\a4) /\ss)/\a5 <=> +(a1/\a2/\a5/\a4)/\a3/\ss`] THEN +NHANH UNIQUE_EXISTSENCE_OF_RPHIH THEN REPEAT STRIP_TAC THEN +UNDISCH_TAC ` phii' < &2 * pi ` THEN UNDISCH_TAC ` &0 <= phii' ` THEN +PHA THEN NHANH_PAT `\x. x ==> _ ` (SPEC `phii: real` IN_ORIGIN_PERIOD_IMP_UNIQUENESS) +THEN REWRITE_TAC[EXISTS_UNIQUE] THEN STRIP_TAC THEN +EXISTS_TAC `r': real` THEN EXISTS_TAC `r:real` THEN +EXISTS_TAC ` phii': real` THEN EXISTS_TAC `gg: real` THEN +EXISTS_TAC ` h': real` THEN EXISTS_TAC ` h: real` THEN +ASM_REWRITE_TAC[] THEN REPEAT GEN_TAC THEN REWRITE_TAC[TAUT` +a /\ b ==> c <=> a ==> b ==> c`] THEN REPEAT DISCH_TAC THEN +REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN +UNDISCH_TAC ` (x2: real^3 ) = u + (r * cos phii) % e1 + +(r * sin (phii)) % e2 + h % (w - u)` THEN +UNDISCH_TAC `(x1 : real^3) = u + (r' * cos phii') % e1 + +(r' * sin phii') % e2 + h' % (w - u)` THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN ASM_REWRITE_TAC[] THEN SIMP_TAC[] +THEN REPEAT DISCH_TAC THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +ASSUME_TAC2 (UNDISCH (MESON[]`(!rr p hh. &0 <= p /\ p < &2 * pi /\ &0 < rr /\ +(x1: real^3) = u + (rr * cos p) % e1 + (rr * sin p) % e2 + hh % (w - u) +==> rr = r' /\ p = phii' /\ hh = h') ==> +u + (rr1 * cos pphii) % e1 + (rr1 * sin pphii) % e2 + h11 % (w - u) = +x1 /\ &0 <= pphii /\ pphii < &2 * pi /\ &0 < rr1 ==> +rr1 = r' /\ pphii = phii' /\ h11 = h' `)) THEN ASM_REWRITE_TAC[] +THEN REPEAT (FIRST_X_ASSUM (CONJUNCTS_THEN ASSUME_TAC)) THEN +MP_TAC (SPEC `pphii + (ssii: real)` +GIVEN_VALUED_IMP_UNIQUE_EXISTENCE) THEN +REWRITE_TAC[EXISTS_UNIQUE] THEN STRIP_TAC THEN +UNDISCH_TAC ` (u: real^3) + (rr2 * cos (pphii + ssii)) % e1 + +(rr2 * sin (pphii + ssii)) % e2 + h22 % (w - u) = x2` THEN +REPLICATE_TAC 3 (FIRST_X_ASSUM MP_TAC) THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN SIMP_TAC[] THEN +PHA THEN STRIP_TAC THEN +ASSUME_TAC2 ((UNDISCH o MESON[])`(!rr p hh. &0 <= p /\ p < &2 * pi /\ &0 < rr /\ +(x2: real^3) = u + (rr * cos p) % e1 + (rr * sin p) % e2 + hh % (w - u) +==> rr = r /\ p = phii /\ hh = h) ==> +&0 < rr2 /\ &0 <= x /\ x < &2 * pi /\ +x2 = u + (rr2 * cos x) % e1 + (rr2 * sin x) % e2 + h22 % (w - u) +==> r = rr2 /\ h = h22 /\ x = phii `) THEN +FIRST_ASSUM (fun x -> REWRITE_TAC[ x]) THEN +USE_FIRST `(pphii: real) = phii' ` SUBST_ALL_TAC THEN +REPEAT (FIRST_X_ASSUM (CONJUNCTS_THEN ASSUME_TAC)) THEN +FIRST_X_ASSUM SUBST_ALL_TAC THEN +ELIM_IDENTS ((UNDISCH o MESON[])`(!y. &0 <= y /\ +y < &2 * pi /\ cos phii = cos (phii' + y) /\ +sin phii = sin (phii' + y) ==> y = gg) ==> +cos (phii' + ssii) = cos phii /\ +sin (phii' + ssii) = sin phii /\ &0 <= ssii /\ ssii < &2 * pi +==> gg = ssii `));; + + + +(* ========================== *) +(* ========================== *) + + +let INTERGRAL_UNIONS_INTERVALS = +prove(`! N. UNIONS {{x | &(n - 1) <= x /\ x < &n} | 0 < n /\ n <= N} = +{x | &0 <= x /\ x < &N}`, INDUCT_TAC THENL +[REWRITE_TAC[ARITH_RULE`~( 0 < b /\ b <= 0 )`; REAL_ARITH`~( &0 <= x /\ x < &0 )`] THEN +SET_TAC[]; +REWRITE_TAC[ARITH_RULE`0 < n /\ n <= SUC N <=> 0 < n /\ n <= N \/ n = N + 1`; SET_RULE` UNIONS +{ f x | h x \/ x = N} = ( UNIONS { f x | h x }) UNION ( f N ) `] THEN +REWRITE_TAC[ADD1; GSYM REAL_OF_NUM_ADD; REAL_ARITH` &0 <= x /\ x < &N + &1 <=> +&0 <= x /\ x < &N \/ &N <= x /\ x < &N + &1 `] THEN +ASM_SIMP_TAC[ARITH_RULE` (a + 1) - 1 = a `] THEN SET_TAC[]]);; + + +let REAL_LE_EQ_OR_LT = REAL_ARITH` &0 <= a <=> a = &0 \/ &0 < a `;; + + +let EXISTS_IN_UNIT_INTERVAL = prove(`!x. ?n. &0 <= x + real_of_int n /\ x + real_of_int n < &1`, +MATCH_MP_TAC (MESON[REAL_ARITH` &0 <= a \/ &0 <= -- a `]` (! a. P a ==> P ( -- a )) +/\ (! a. &0 <= a ==> P a ) /\ (! a. a = -- ( -- a )) ==> (! a . P a )`) THEN CONJ_TAC THENL [ +GEN_TAC THEN REWRITE_TAC[REAL_LE_EQ_OR_LT ] THEN STRIP_TAC THENL [ +EXISTS_TAC ` -- (n:int)` THEN +ASM_REWRITE_TAC[int_neg_th; GSYM REAL_NEG_ADD; REAL_NEG_EQ_0] THEN REAL_ARITH_TAC; +EXISTS_TAC ` -- n + (&1: int)` THEN +ASM_REWRITE_TAC[int_neg_th; GSYM REAL_NEG_ADD; REAL_NEG_EQ_0;int_add_th; int_of_num_th] +THEN ASM_REAL_ARITH_TAC];REWRITE_TAC[REAL_NEGNEG] THEN GEN_TAC THEN +CHOOSE_TAC (SPEC `x: real` (MATCH_MP REAL_ARCH (REAL_ARITH` &0 < &1 `))) THEN +ASSUME_TAC (SPEC `n: num ` INTERGRAL_UNIONS_INTERVALS) THEN +DOWN_TAC THEN REWRITE_TAC[REAL_MUL_RID] THEN +NHANH (SET_RULE` x < &n /\ aa = {x | &0 <= x /\ x < &n} /\ +&0 <= x ==> x IN aa `) THEN REWRITE_TAC[IN_UNIONS; IN_ELIM_THM] THEN +STRIP_TAC THEN EXISTS_TAC` -- ( &(n' - 1): int) ` THEN +REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN +PHA THEN NHANH (SET_RULE` t = {x| P x } /\ x IN t ==> P x `) THEN +REWRITE_TAC[int_neg_th; int_of_num_th] THEN STRIP_TAC THEN +REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN +ASSUME_TAC2 (ARITH_RULE` 0 < n' ==> 1 <= n'`) THEN +ASM_SIMP_TAC[GSYM REAL_OF_NUM_SUB] THEN REAL_ARITH_TAC]);; + +let TWO_PI_POS = prove(` &0 < &2 * pi `, MP_TAC PI_POS THEN REAL_ARITH_TAC);; + + +let MOVE_TO_UNIT_INTERVAL = prove(`!x. ?n. &0 <= x + ( real_of_int n )* &2 * pi /\ x + ( real_of_int n) * &2 * pi < &2 * pi`, +ONCE_REWRITE_TAC [GSYM (MATCH_MP REAL_LE_RDIV_0 TWO_PI_POS)] THEN +ONCE_REWRITE_TAC[GSYM (MATCH_MP REAL_LT_DIV2_EQ TWO_PI_POS)] THEN +REWRITE_TAC[REAL_ARITH` ( a + b ) / c = a / c + b / c `; MATCH_MP (REAL_FIELD` &0 < a ==> a / a = &1 `) TWO_PI_POS; +MATCH_MP (REAL_FIELD` &0 < c ==> (a * c ) / c = a `) TWO_PI_POS] THEN MESON_TAC[EXISTS_IN_UNIT_INTERVAL ]);; + + + +let SIN_TOTAL_PERIODIC = prove(`! n. sin (x + &n * &2 * pi) = sin x `, +INDUCT_TAC THEN REWRITE_TAC[REAL_MUL_LZERO; REAL_ADD_RID] THEN +ASM_REWRITE_TAC[ADD1;GSYM REAL_OF_NUM_ADD; +REAL_ARITH` x + (&n + &1) * a = (x + &n * a ) + a `; SIN_PERIODIC]);; + + +let SIN_PERIODIC_IN_WHOLE = prove(` !n. sin ( x + real_of_int n * &2 * pi ) = sin x `, +GEN_TAC THEN ASM_CASES_TAC` &0 <= (n: int) ` THENL [ +ASSUME_TAC2 (SPEC `n: int ` INT_OF_NUM_OF_INT) THEN EXPAND_TAC "n" THEN +REWRITE_TAC[int_of_num_th; SIN_TOTAL_PERIODIC ]; FIRST_X_ASSUM MP_TAC] THEN +NHANH (ARITH_RULE` ~( &0 <= (n: int) ) ==> &0 <= -- n `) THEN STRIP_TAC THEN +ASSUME_TAC2 (SPEC `-- n: int ` INT_OF_NUM_OF_INT) THEN +ONCE_REWRITE_TAC[ARITH_RULE` (a: int) = -- -- a `] THEN +ONCE_REWRITE_TAC[int_neg_th] THEN FIRST_X_ASSUM (SUBST1_TAC o SYM) THEN +REWRITE_TAC[int_of_num_th; REAL_MUL_LNEG] THEN +MESON_TAC[SIN_TOTAL_PERIODIC; REAL_ARITH`(a + -- b ) + (b:real) = a `]);; + + + +let COS_PERIODIC_IN_WHOLE = prove(` cos ( x + real_of_int n * &2 * pi ) = cos x `, +REWRITE_TAC[COS_SIN; REAL_ARITH` a - (b + c ) = a - b - c `] THEN +MESON_TAC[REAL_ARITH` x = x - y + y `; SIN_PERIODIC_IN_WHOLE]);; + + +let SIN_COS_PERIODIC_IN_WHOLE = +GEN_ALL (CONJ (SPEC_ALL SIN_PERIODIC_IN_WHOLE) COS_PERIODIC_IN_WHOLE);; + + +let SIN_COS_IDEN_IFF_DIFFER_PERS = prove(`! x y. cos x = cos y /\ sin x = sin y <=> (? k. x = y + real_of_int k * &2 * pi ) `, +REPEAT GEN_TAC THEN EQ_TAC THENL [CHOOSE_TAC (SPEC` x:real` MOVE_TO_UNIT_INTERVAL ) THEN +CHOOSE_TAC (SPEC` y:real` MOVE_TO_UNIT_INTERVAL ) THEN +ASSUME_TAC (GSYM (SPECL[`n:int`;`x:real`] SIN_COS_PERIODIC_IN_WHOLE)) THEN +FIRST_X_ASSUM (fun x -> PAT_ONCE_REWRITE_TAC`\x. x = _ /\ x = _ ==> _ ` [x]) THEN +ASSUME_TAC (GSYM (SPECL[`n':int`;`y:real`] SIN_COS_PERIODIC_IN_WHOLE)) THEN +FIRST_X_ASSUM (fun x -> PAT_ONCE_REWRITE_TAC `\x. _ = x /\ _ = x ==> _ ` [x]) THEN +DOWN_TAC THEN NHANH IDENT_WHEN_IDENT_SIN_COS THEN +REWRITE_TAC[REAL_ARITH`y + a * t = x + b * t <=> x = y + (a -b ) * t`; GSYM int_sub_th] THEN +STRIP_TAC THEN EXISTS_TAC ` n' - (n:int)` THEN ASM_REWRITE_TAC[]; +STRIP_TAC THEN ASM_SIMP_TAC[SIN_COS_PERIODIC_IN_WHOLE ]]);; + + +let NOT_EQ_IMP_AFF_AND_COLL3 = prove(`! v (w:real^N) u. ~( v = w ) ==> +( u IN aff {v,w} <=> collinear {v,w,u}) `, ONCE_REWRITE_TAC[COLLINEAR_3] THEN +REWRITE_TAC[COLLINEAR_LEMMA; VECTOR_SUB_EQ] THEN SIMP_TAC[] THEN REPEAT STRIP_TAC THEN +MATCH_MP_TAC (MESON[]` (P ==> Q) /\ (Q <=> L) ==> (L <=> P \/ Q)`) THEN CONJ_TAC THENL [ +STRIP_TAC THEN EXISTS_TAC `&0` THEN +ASM_REWRITE_TAC[VECTOR_MUL_LZERO; VECTOR_SUB_REFL]; REWRITE_TAC[AFF2; IN_ELIM_THM] THEN +EQ_TAC THENL [STRIP_TAC THEN EXISTS_TAC `c:real` THEN FIRST_X_ASSUM MP_TAC THEN +VECTOR_ARITH_TAC; STRIP_TAC THEN EXISTS_TAC `t:real` THEN FIRST_X_ASSUM MP_TAC THEN +VECTOR_ARITH_TAC]]);; + +let R_SIN_CIRCLE = prove(` ! r x. ( r * cos x ) pow 2 + ( r * sin x ) pow 2 = r pow 2 `, +REPEAT GEN_TAC THEN MP_TAC (SPEC_ALL SIN_CIRCLE) THEN CONV_TAC REAL_RING);; + + +let R_SIN_COS_IDENT = prove(`! r rr x y. &0 <= r /\ &0 <= rr /\ +r * cos x = rr * cos y /\ r * sin x = rr * sin y ==> r = rr /\ ( +r = &0 \/ cos x = cos y /\ sin x = sin y ) `, +NHANH (MESON[R_SIN_CIRCLE ]`r * cos x = rr * cos y /\ r * sin x = rr * sin y ==> +r pow 2 = rr pow 2 `) THEN REPEAT GEN_TAC THEN STRIP_TAC THEN +SUBGOAL_THEN `r = (rr: real)` ASSUME_TAC THENL [ASM_SIMP_TAC[EQ_POW2_COND]; +ASM_SIMP_TAC[]] THEN ASM_CASES_TAC ` rr = &0 ` THENL [ASM_SIMP_TAC[]; DISJ2_TAC] THEN +FIRST_X_ASSUM SUBST_ALL_TAC THEN DOWN_TAC THEN +REWRITE_TAC[REAL_EQ_MUL_LCANCEL] THEN MESON_TAC[]);; + + +let R_POS_SIN_COS_IDENT = prove(`! r rr x y. &0 < r /\ &0 < rr /\ +r * cos x = rr * cos y /\ r * sin x = rr * sin y ==> r = rr /\ +cos x = cos y /\ sin x = sin y `, +MESON_TAC[REAL_LT_IMP_LE; R_SIN_COS_IDENT; REAL_ARITH` &0 < a ==> ~( a = &0 )`]);; + + +let BEGIN_POINT_PERIODIC = prove(` ! x k. &0 <= x /\ x < &2 * pi /\ x = real_of_int k * &2 * pi ==> x = &0 `, +REPEAT GEN_TAC THEN ASSUME_TAC (SPEC` &0` REAL_LE_REFL) THEN ASSUME_TAC TWO_PI_POS THEN +STRIP_TAC THEN FIRST_X_ASSUM MP_TAC THEN +PAT_ONCE_REWRITE_TAC `\x. _ = x ==> _` [REAL_ARITH` a = &0 + a `] THEN +ASM_MESON_TAC[SIN_COS_PERIODIC_IN_WHOLE; IDENT_WHEN_IDENT_SIN_COS]);; + + +let BODE_YEU_ANH_DI = prove(`! k. &0 <= ppsssi /\ ppsssi < &2 * pi /\ +&0 <= ppsssi1 /\ ppsssi1 < &2 * pi /\ &0 <= aa /\ +aa < &2 * pi /\ +aa = ppsssi - ppsssi1 + real_of_int k * &2 * pi ==> +( aa = &0 <=> ppsssi = ppsssi1 ) `, +REPEAT STRIP_TAC THEN +EQ_TAC THENL [ASM_REWRITE_TAC[] THEN REWRITE_TAC[REAL_ARITH` a - b + c = &0 <=> b = a + c `] +THEN ASM_MESON_TAC[IDENT_WHEN_IDENT_SIN_COS; SIN_COS_IDEN_IFF_DIFFER_PERS]; +DISCH_THEN SUBST_ALL_TAC THEN DOWN_TAC THEN REWRITE_TAC[REAL_SUB_REFL; REAL_ADD_LID] THEN +MESON_TAC[BEGIN_POINT_PERIODIC ]]);; + + + +(* ====================== *) +(* ====================== *) +(* ========= LEMMA 1.31 =========== *) + + + + +let ORTHONORMAL_BASIS = prove( +` orthonormal ( basis 1 ) (basis 2 ) ( basis 3 ) `, +MP_TAC (MESON[DOT_BASIS_BASIS]`! i j. 1 <= i /\ i <= dimindex (:3) /\ 1 <= j /\ j <= dimindex (:3) +==> ((basis i): real^3) dot basis j = (if i = j then &1 else &0)`) THEN +REWRITE_TAC[orthonormal; DIMINDEX_3; ARITH_RULE` 1 <= i /\ i <= 3 <=> i = 1 \/ i = 2 \/ i = 3 `] THEN +NGOAC THEN +REWRITE_TAC[ARITH_RULE` 1 <= i /\ i <= 3 <=> i = 1 \/ i = 2 \/ i = 3 `] THEN +KHANANG THEN +REWRITE_TAC[TAUT`(a \/ v) \/ c <=> a \/ v \/ c `] THEN +SIMP_TAC[TAUT`(a \/ v) \/ c <=> a \/ v \/ c `; MESON[]`(! i j. i = a /\ j = b \/ Q i j ==> R i j) +<=> R a b /\ (! i j. Q i j ==> R i j)`; ARITH_RULE` ~(1 = 2 )/\ ~( 1 = 3 ) /\ ~( 2 = 3 )` ] THEN +STRIP_TAC THEN +FIRST_X_ASSUM (MP_TAC o (SPECL[` 3`;`3`])) THEN +SIMP_TAC[] THEN +SIMP_TAC[CROSS_BASIS; REAL_ARITH` &0 < &1 `]);; + + + + +let ORTHO_IMP_NORM_CROSS_PRODUCT = +prove(`! x y. x dot y = &0 ==> norm (x cross y) pow 2 = (norm x * norm y) pow 2 `, +REPEAT STRIP_TAC THEN MP_TAC (SPEC_ALL NORM_CROSS_DOT) THEN +ASM_SIMP_TAC[REAL_ARITH` a + &0 pow 2 = a `]);; + + +let TWO_UNIT_ORTH_VECTORS_IMP_ORTHONORMAL = prove(`! e1 (e3:real^3). norm e1 = &1 /\ norm e3 = &1 /\ e1 dot e3 = &0 ==> (? e2. +orthonormal e1 e2 e3 ) `, +REPEAT STRIP_TAC THEN +EXISTS_TAC ` e3 cross e1 ` THEN +ASM_SIMP_TAC[DOT_CROSS_SELF; orthonormal; CROSS_LAGRANGE; DOT_LSUB; +DOT_LMUL; DOT_SQUARE_NORM; DOT_SYM] THEN +ASM_SIMP_TAC[DOT_RSUB; DOT_RMUL; GSYM NORM_POW_2; DOT_SYM] THEN +FIRST_X_ASSUM (MP_TAC o (ONCE_REWRITE_RULE[DOT_SYM])) THEN +NHANH ORTHO_IMP_NORM_CROSS_PRODUCT THEN +ASM_SIMP_TAC[] THEN +REAL_ARITH_TAC);; + +let ORTHONORMAL_BASIS3 = REWRITE_RULE[orthonormal] ORTHONORMAL_BASIS;; + +let EXISTS_OTHOR_VECTOR_DIFFF_VEC0 = prove( +`! (u: real^3). ? v . ~(v = vec 0) /\ u dot v = &0 `, +GEOM_BASIS_MULTIPLE_TAC 1 `u:real^3` THEN REPEAT STRIP_TAC THEN +EXISTS_TAC `( basis 2): real^3` THEN MP_TAC ORTHONORMAL_BASIS THEN +SIMP_TAC[orthonormal; DOT_LMUL; REAL_MUL_RZERO; +REWRITE_RULE[DE_MORGAN_THM] NOT_BASISES_EQ_VEC0]);; + +let INVERT_NORM_POS_LE = prove(` ! (x: real^N). &0 <= &1 / norm x `, +GEN_TAC THEN MATCH_MP_TAC REAL_LE_DIV THEN REWRITE_TAC[NORM_POS_LE] THEN REAL_ARITH_TAC);; + +let NOT_0_INVERTABLE = REAL_FIELD` ~( a = &0) <=> &1 / a * a = &1 `;; + + +let NOT_VEC0_UNITABLE = prove(`! (u: real^N). ~( u = vec 0 ) <=> norm ( &1 / norm u % u ) = &1 `, +SIMP_TAC[NORM_MUL; REAL_ABS_DIV; REAL_ABS_NORM; ABS_1; GSYM NORM_EQ_0; NOT_0_INVERTABLE]);; + + +let EXISTS_UNIT_OTHOR_VECTOR = prove(` !(u: real^3). ?v. norm v = &1 /\ u dot v = &0 `, +GEN_TAC THEN (CHOOSE_TAC (SPEC` u:real^3 ` EXISTS_OTHOR_VECTOR_DIFFF_VEC0)) THEN +EXISTS_TAC ` &1 / norm v % ( v:real^3) ` THEN ASM_SIMP_TAC[GSYM NOT_VEC0_UNITABLE; DOT_RMUL; REAL_MUL_RZERO]);; + + + +let AFF3_TRANSLATION_IMAGE = prove( +` aff (IMAGE (\x. (v:real^N) + x) {v1, v2, v3}) = IMAGE (\x. v + x) ( aff {v1,v2,v3} ) `, +REWRITE_TAC[IMAGE_CLAUSES; aff; AFFINE_HULL_3; FUN_EQ_THM; IN_ELIM_THM] THEN +GEN_TAC THEN EQ_TAC THENL [PAT_ONCE_REWRITE_TAC ` \x. _ ==> x ` [GSYM IN] THEN +STRIP_TAC THEN REWRITE_TAC[IN_ELIM_THM; IN_IMAGE] THEN +EXISTS_TAC ` u % v1 + v' % v2 + w % (v3:real^N)` THEN +CONJ_TAC THENL [DOWN_TAC THEN SIMP_TAC[REAL_ARITH` a + b = &1 <=> a = &1 - b `] +THEN DISCH_TAC THEN VECTOR_ARITH_TAC; ASM_MESON_TAC[]]; +PAT_ONCE_REWRITE_TAC ` \x. x ==> _ ` [GSYM IN]] THEN +REWRITE_TAC[IN_IMAGE; IN_ELIM_THM] THEN STRIP_TAC THEN EXISTS_TAC `u:real` THEN +EXISTS_TAC `v':real` THEN EXISTS_TAC `w:real` THEN +ASM_SIMP_TAC[VECTOR_ARITH` u % (v + v1) + v' % (v + v2) + w % (v + v3) = (u + v' + w ) % v + +u % v1 + v' % v2 + w % v3 `; VECTOR_MUL_LID]);; + + +let IMAGE_INTER_AFF3 = prove(`IMAGE (\x. (v:real^N) + x) s INTER aff (IMAGE (\x. v + x) {v1,v2,v3}) = +IMAGE (\x. v + x) (s INTER aff {v1,v2,v3})`, +SUBGOAL_THEN ` ! x y. (\x. (v:real^N) + x) y = (\x. v + x) x ==> y = x ` MP_TAC THENL [ +REWRITE_TAC[BETA_THM; VECTOR_ARITH` a + b = a + c ==> b = (c:real^N)`]; +SIMP_TAC[AFF3_TRANSLATION_IMAGE; GSYM IMAGE_INTER_INJ]]);; + + +let DIHV_TRASABLE = prove(`! (v: real^N). dihV (v + u) (v + w) (v + v1) (v + v2) = dihV u w v1 v2`, +REWRITE_TAC[dihV; VECTOR_ARITH` ((v:real^N) + v1) - (v + u) = v1 - u `]);; + + +let VECTOR_MUL_R_TO_L = REWRITE_RULE[IMP_IMP] (prove(`!a (x:real^N) y. ~(a = &0) ==> a % x = y ==> x = &1 / a % y`, +REPEAT STRIP_TAC THEN MATCH_MP_TAC VECTOR_MUL_LCANCEL_IMP THEN EXISTS_TAC `a :real` THEN +ASM_SIMP_TAC[VECTOR_MUL_ASSOC; REAL_FIELD` ~( a = &0) ==> ( a * &1 / a ) = &1 ` +; VECTOR_MUL_LID]));; + + +let AFF2_VEC0 = prove(` aff {vec 0, (w: real^N)} = { x | ? k. x = k % w }`, +REWRITE_TAC[AFF2; FUN_EQ_THM; IN_ELIM_THM] THEN +GEN_TAC THEN EQ_TAC THENL [STRIP_TAC THEN EXISTS_TAC ` &1 - t ` THEN +EVERY_ASSUM MP_TAC THEN SIMP_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID]; +STRIP_TAC THEN EXISTS_TAC ` &1 - k ` THEN +ASM_SIMP_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID; REAL_ARITH` a - ( a - b ) = b `]]);; + + +let PERPENCULAR_PART_IDENT0 = prove(`~(w = vec 0) /\ (w dot w) % v1 - (v1 dot w) % w = vec 0 +==> v1 IN aff {vec 0, w}`, PAT_REWRITE_TAC `\x. x /\ _ ==> _ `[GSYM DOT_EQ_0] THEN +REWRITE_TAC[VECTOR_SUB_EQ] THEN NHANH (VECTOR_MUL_R_TO_L) THEN +REWRITE_TAC[AFF2_VEC0; IN_ELIM_THM; VECTOR_MUL_ASSOC] THEN MESON_TAC[]);; + + +let INSERT_INTER_EMPTY = SET_RULE` {} INTER s = {} /\ (( a INSERT s ) INTER ss = {} <=> +~( a IN ss ) /\ s INTER ss = {} )`;; + +(* + +Hi Truong, + +There is a related theorem AZIM_SPECIAL_SCALE already there in +"Multivariate/flyspeck.ml". This only covers scaling of one of the +arguments, but the proof can be generalized to handle all of them; +see the proof script below. + +Since the definition of "azim" has multiple quantifier alternations, I +handle things in a more automatic way using the same quantifier +modification conversion PARTIAL_EXPAND_QUANTS_CONV that is used inside +the "without loss of generality" tactics. + +John. + + + +let COLLINEAR_SCALE_ALL = prove +(`!a b v w. ~(a = &0) /\ ~(b = &0) +==> (collinear {vec 0,a % v,b % w} <=> collinear {vec 0,v,w})`, +REPEAT STRIP_TAC THEN ASM_SIMP_TAC[COLLINEAR_SPECIAL_SCALE] THEN +ONCE_REWRITE_TAC[SET_RULE `{a,b,c} = {a,c,b}`] THEN +ASM_SIMP_TAC[COLLINEAR_SPECIAL_SCALE]);; + +let AZIM_SCALE_ALL = prove +(`!a v w1 w2. +&0 < a /\ &0 < b /\ &0 < c +==> azim (vec 0) (a % v) (b % w1) (c % w2) = azim (vec 0) v w1 w2`, +let lemma = MESON[REAL_LT_IMP_NZ; REAL_DIV_LMUL] +`!a. &0 < a ==> (!y. ?x. a * x = y)` in +let SCALE_QUANT_TAC side asm avoid = +MP_TAC(MATCH_MP lemma (ASSUME asm)) THEN +DISCH_THEN(MP_TAC o MATCH_MP QUANTIFY_SURJECTION_THM) THEN +DISCH_THEN(CONV_TAC o side o PARTIAL_EXPAND_QUANTS_CONV avoid) in +REPEAT STRIP_TAC THEN +ASM_SIMP_TAC[azim_def; COLLINEAR_SCALE_ALL; REAL_LT_IMP_NZ] THEN +COND_CASES_TAC THEN ASM_REWRITE_TAC[VECTOR_SUB_RZERO] THEN +ASM_SIMP_TAC[DIST_0; NORM_MUL; GSYM VECTOR_MUL_ASSOC] THEN +ASM_SIMP_TAC[REAL_ARITH `&0 < a ==> abs a = a`; VECTOR_MUL_LCANCEL] THEN +ASM_SIMP_TAC[VECTOR_MUL_EQ_0; REAL_LT_IMP_NZ] THEN +SCALE_QUANT_TAC RAND_CONV `&0 < a` ["psi"; "r1"; "r2"] THEN +SCALE_QUANT_TAC LAND_CONV `&0 < b` ["psi"; "h2"; "r2"] THEN +SCALE_QUANT_TAC LAND_CONV `&0 < c` ["psi"; "h1"; "r1"] THEN +ASM_SIMP_TAC[GSYM VECTOR_MUL_ASSOC; GSYM VECTOR_ADD_LDISTRIB; +VECTOR_MUL_LCANCEL; REAL_LT_IMP_NZ; REAL_LT_MUL_EQ] THEN +REWRITE_TAC[VECTOR_MUL_ASSOC; REAL_MUL_AC]);; + +let AZIM_SCALE_INV_NORM = prove +(`!w v1 v2. +~(w = vec 0) /\ ~(v1 = vec 0) /\ ~(v2 = vec 0) +==> azim (vec 0) w v1 v2 = +azim (vec 0) (&1 / norm w % w) (&1 / norm v1 % v1) +(&1 / norm v2 % v2)`, +REWRITE_TAC[real_div; REAL_MUL_LID] THEN +SIMP_TAC[REAL_LT_INV_EQ; NORM_POS_LT; AZIM_SCALE_ALL]);; + +*) + + + +let ARCV_VEC0_ABS = prove(` ~(ku = &0) /\ ~( kv = &0 ) ==> arcV (vec 0) (u: real^N) v = +arcV (vec 0) ( abs ku % u ) (abs kv % v)`, STRIP_TAC THEN +ABBREV_TAC ` ahah = arcV (vec 0) (abs ku % (u: real^N)) (abs kv % v) ` THEN +FIRST_X_ASSUM (fun x -> ONCE_REWRITE_TAC[MATCH_MP WHEN_K_DIFF0_ARCV x]) THEN +ONCE_REWRITE_TAC[ARC_SYM] THEN FIRST_X_ASSUM (fun x -> ONCE_REWRITE_TAC[MATCH_MP WHEN_K_DIFF0_ARCV x]) +THEN EXPAND_TAC "ahah" THEN SIMP_TAC[ARC_SYM]);; + +let WHEN_A_B_POS_ARCV_STABLE = MESON[ARC_SYM; WHEN_K_POS_ARCV_STABLE] +` ! a b (x: real^N) y. &0 < a /\ &0 < b ==> arcV ( vec 0 ) x y = arcV ( vec 0 ) ( a % x ) ( b % y ) `;; + +let THREE_POS_IMP_DIHV_STABLE = prove(`!x y z. +&0 < a /\ &0 < b /\ &0 < c +==> dihV (vec 0) x y z = dihV (vec 0) (a % x) (b % y) (c % z)`, +REWRITE_TAC[DIHV_FORMULAR; VECTOR_SUB_RZERO] THEN +REWRITE_TAC[DOT_LMUL; DOT_RMUL; VECTOR_MUL_ASSOC] THEN +REWRITE_TAC[REAL_ARITH` ((a * a * xx) * b) = ( a pow 2 * b ) * xx `; +REAL_ARITH` (b * a * c) * a = ( a pow 2 * b ) * c `] THEN +ONCE_REWRITE_TAC[GSYM VECTOR_MUL_ASSOC] THEN +REWRITE_TAC[REAL_ARITH` ((a * a * xx) * b) = ( a pow 2 * b ) * xx `; +REAL_ARITH` (b * a * c) * a = ( a pow 2 * b ) * c `; GSYM VECTOR_SUB_LDISTRIB] THEN +REPEAT STRIP_TAC THEN MATCH_MP_TAC WHEN_A_B_POS_ARCV_STABLE THEN +CONJ_TAC THENL [MATCH_MP_TAC REAL_LT_MUL THEN +ASM_SIMP_TAC[POW_2; REAL_LT_MUL];MATCH_MP_TAC REAL_LT_MUL THEN +ASM_SIMP_TAC[POW_2; REAL_LT_MUL]]);; + + +let VECTOR_OF_DIHV_ORTHONORMAL = prove(` ((w dot w) % (v1: real^N) - (v1 dot w) % w ) dot w = &0 `, +REWRITE_TAC[DOT_LSUB; DOT_LMUL] THEN REAL_ARITH_TAC);; + +let ORTHOGORNAL_UNITIZE = prove(` ! x (y:real^N). x dot y = &0 ==> ( &1 / norm x % x ) dot ( &1 / norm y % y ) = &0 `, +REWRITE_TAC[DOT_LMUL; DOT_RMUL] THEN SIMP_TAC[REAL_MUL_RZERO]);; + +let NOT_MUL_EQ0_EQ = MESON[REAL_ENTIRE]`!x y. ~( x * y = &0 ) <=> ~( x = &0 ) /\ ~( y = &0) `;; + +let UNITS_NOT_EQ_0 = MESON[NOT_MUL_EQ0_EQ; REAL_ARITH` ~( &1 = &0 )`]`! x y. x * y = &1 ==> ~( x = &0 ) /\ ~( y = &0) `;; + +let REAL_MUL_LRINV = +let t1 = UNDISCH (SPEC_ALL REAL_MUL_LINV) in +let t2 = UNDISCH (SPEC_ALL REAL_MUL_RINV) in +let t3 = CONJ t1 t2 in DISCH ` ~( x = &0 ) ` t3;; + +let NOT_EQ0_IMP_NEITHER_INVERT = prove(` ~( a = &0 ) ==> ~( &1 / a = &0 ) `, +REWRITE_TAC[NOT_0_INVERTABLE; REAL_FIELD` &1 / ( &1 / a ) = a `] THEN SIMP_TAC[REAL_MUL_SYM]);; + + +let PROJECTOR_NOT_EQ_VEC0 = prove(`! w v1. ~( (w:real^N) = vec 0 ) /\ ~(v1 IN aff {vec 0, w}) <=> +~( (w dot w) % v1 - (v1 dot w) % w = vec 0 ) `, REPEAT GEN_TAC THEN +EQ_TAC THENL [REWRITE_TAC[GSYM DE_MORGAN_THM; CONTRAPOS_THM] THEN +ASM_CASES_TAC ` (w:real^N) = vec 0 ` THENL [ASM_SIMP_TAC[]; +ASM_SIMP_TAC[PERPENCULAR_PART_IDENT0]]; +ASM_CASES_TAC ` (w:real^N) = vec 0 ` THENL [ +ASM_SIMP_TAC[DOT_RZERO; VECTOR_MUL_LZERO; VECTOR_SUB_RZERO]; +ASM_SIMP_TAC[CONTRAPOS_THM; AFF2_VEC0; IN_ELIM_THM]] THEN STRIP_TAC THEN +ASM_SIMP_TAC[VECTOR_MUL_ASSOC; DOT_LMUL; REAL_MUL_SYM; VECTOR_SUB_REFL]]);; + +let NOT_EQ_VEC0_IMP_EQU_AFF_COLL = prove(` ! (w:real^N) u. ~( w = vec 0 ) ==> ( u IN aff {vec 0, w } <=> collinear {vec 0, w, u}) `, +REPEAT STRIP_TAC THEN EQ_TAC THENL [REWRITE_TAC[AFF2_VEC0; IN_ELIM_THM; COLLINEAR_LEMMA] THEN +MESON_TAC[]; REWRITE_TAC[AFF2_VEC0; IN_ELIM_THM; COLLINEAR_LEMMA] THEN +STRIP_TAC THENL [ASM_MESON_TAC[]; EXISTS_TAC `&0 ` THEN ASM_SIMP_TAC[VECTOR_MUL_LZERO]; +ASM_MESON_TAC[]]]);; + + +let NOT_EQ_IMP_EXISTS_BASIC = prove(`! v (w:real^3). ~( v = w ) ==> + (? e1 e2 e3. orthonormal e1 e2 e3 /\ dist (w,v) % e3 = w - v)`, +REPEAT STRIP_TAC THEN +CHOOSE_TAC (SPEC `w - (v:real^3)` EXISTS_UNIT_OTHOR_VECTOR) THEN +DOWN_TAC THEN ONCE_REWRITE_TAC[MESON[]` ~( a = b ) <=> ~ (b = a )`] +THEN PAT_ONCE_REWRITE_TAC`\ x. x ==> y ` [GSYM VECTOR_SUB_EQ] THEN +REWRITE_TAC[NOT_VEC0_UNITABLE] THEN +ABBREV_TAC` e1 = &1 / norm ( w - v ) % ( w - (v:real^3))` +THEN REWRITE_TAC[DOT_LNEG; REAL_NEG_EQ_0] THEN +NHANH (MESON[REAL_MUL_RZERO] ` a = &0 ==> + (&1 / norm ( w - (v:real^3))) * a = &0 `) THEN +ASM_REWRITE_TAC[GSYM DOT_LMUL] THEN +MATCH_MP_TAC (MESON[]` ( a /\ b /\ d ==> e ) ==> a /\ b +/\ c /\ d ==> e `) THEN +NHANH TWO_UNIT_ORTH_VECTORS_IMP_ORTHONORMAL THEN +STRIP_TAC THEN EXISTS_TAC` e2:real^3` THEN +EXISTS_TAC` v' : real^3` THEN EXISTS_TAC` e1: real^3` THEN +FIRST_X_ASSUM MP_TAC THEN SIMP_TAC[ORTHONORMAL_PERMUTE] THEN +STRIP_TAC THEN UNDISCH_TAC ` norm (e1:real^3) = &1 ` THEN +EXPAND_TAC "e1" THEN +REWRITE_TAC[GSYM NOT_VEC0_UNITABLE; GSYM NORM_EQ_0; +VECTOR_MUL_ASSOC; dist] THEN +SIMP_TAC[REAL_FIELD`~ ( a = &0 ) ==> ( a * &1 / a ) = &1 `; + VECTOR_MUL_LID]);; + +(* 19 aug 2009 *) +(* =========================================== *) +(* =========================================== *) +let YVREJIS = prove(`! (v: real^3) w w1 w2. +cyclic_set {w1, w2} v w +==> (azim v w w1 w2 = &0 ==> azim v w w1 w2 + azim v w w2 w1 = &0) /\ +(~(azim v w w1 w2 = &0) +==> azim v w w1 w2 + azim v w w2 w1 = &2 * pi)`, +REWRITE_TAC[cyclic_set] THEN +NHANH NOT_EQ_IMP_EXISTS_BASIC THEN +REPEAT GEN_TAC THEN STRIP_TAC THEN +ASSUME_TAC (SPECL[`v:real^3`;` w:real^3`] azim ) THEN +ASM_REWRITE_TAC[] THEN FIRST_ASSUM (ASSUME_TAC o SPEC_ALL) THEN +FIRST_X_ASSUM MP_TAC THEN STRIP_TAC THEN +UNDISCH_TAC `~(v = w:real^3)` THEN +UNDISCH_TAC `dist (w,v) % e3 = w - (v:real^3)` THEN +UNDISCH_TAC `orthonormal e1 e2 e3` THEN PHA THEN +ONCE_REWRITE_TAC[MESON[]`~(a = b ) <=> ~( b = a )`] THEN +FIRST_ASSUM NHANH THEN FIRST_X_ASSUM MP_TAC THEN +FIRST_X_ASSUM (ASSUME_TAC o (SPECL[`w2:real^3`;` w1:real^3`])) THEN +REPEAT (FIRST_X_ASSUM (CONJUNCTS_THEN ASSUME_TAC)) THEN +REPEAT (FIRST_X_ASSUM CHOOSE_TAC) THEN +FIRST_ASSUM (NHANH_PAT `\x. _ ==> x `) THEN +STRIP_TAC THEN STRIP_TAC THEN UNDISCH_TAC `w1 - v = +(r2 * cos (psi + azim v w w2 w1)) % e1 + +(r2 * sin (psi + azim v w w2 w1)) % e2 + +h2' % (w - v)` THEN +UNDISCH_TAC `w1 - (v: real^3) = (r1' * cos psi') % e1 + +(r1' * sin psi') % e2 + h1 % (w - v)` THEN +USE_FIRST ` dist (w,v) % e3 = w - (v:real^3)` (SUBST1_TAC o SYM) THEN +UNDISCH_TAC `orthonormal e1 e2 (e3: real^3)` THEN PHA THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN +NHANH (MESON[th]` orthonormal e1 e2 e3 /\ x = a1 % e1 + a2 % e2 + a3 % e3 /\ +x = aa1 %e1 + aa2 % e2 + aa3 % e3 ==> a1 = aa1 /\ a2 = aa2 /\ a3 = aa3 `) THEN +STRIP_TAC THEN +UNDISCH_TAC` w2 - (v: real^3) = (r1 * cos psi) % e1 + (r1 * sin psi) % e2 + h1' % (w - v)` THEN +UNDISCH_TAC` w2 - v = +(r2' * cos (psi' + azim v w w1 w2)) % e1 + +(r2' * sin (psi' + azim v w w1 w2)) % e2 + h2 % (w - v)` THEN +UNDISCH_TAC `orthonormal e1 e2 (e3: real^3)` THEN +USE_FIRST ` dist (w,v) % e3 = w - (v:real^3)` (SUBST1_TAC o SYM) THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN PHA THEN +NHANH (MESON[th]` orthonormal e1 e2 e3 /\ x = a1 % e1 + a2 % e2 + a3 % e3 /\ +x = aa1 %e1 + aa2 % e2 + aa3 % e3 ==> a1 = aa1 /\ a2 = aa2 /\ a3 = aa3 `) THEN STRIP_TAC THEN +UNDISCH_TAC`{w1, w2} INTER affine hull {(v: real^3), w} = {}` THEN +REWRITE_TAC[ GSYM aff; SET_RULE` {a,b} INTER s = {} <=> ~( a IN s ) /\ ~( b IN s ) `] THEN +UNDISCH_TAC `~(w = (v:real^3))` THEN +SIMP_TAC[EQ_SYM_EQ; NOT_EQ_IMP_AFF_AND_COLL3] THEN +STRIP_TAC THEN STRIP_TAC THEN +ASSUME_TAC2 (MESON[]`~collinear {v, w, w2} /\ (~collinear {(v:real^3), w, w2} ==> &0 < r1) ==> +&0 < r1 `) THEN +ASSUME_TAC2 (MESON[]`~collinear {v, w, w2} /\ (~collinear {(v:real^3), w, w2} ==> &0 < r2') ==> +&0 < r2' `) THEN +ASSUME_TAC2 (MESON[]`~collinear {v, w, w1} /\ (~collinear {(v:real^3), w, w1} ==> &0 < r1') ==> +&0 < r1' `) THEN +ASSUME_TAC2 (MESON[]`~collinear {v, w, w1} /\ (~collinear {(v:real^3), w, w1} ==> &0 < r2) ==> +&0 < r2 `) THEN +UNDISCH_TAC` r2' * sin (psi' + azim (v: real^3) w w1 w2) = r1 * sin psi` THEN +UNDISCH_TAC`r2' * cos (psi' + azim v w w1 w2) = r1 * cos psi` THEN +UNDISCH_TAC`&0 < r1` THEN UNDISCH_TAC`&0 < r2'` THEN PHA THEN +NHANH R_POS_SIN_COS_IDENT THEN +REWRITE_TAC[SIN_COS_IDEN_IFF_DIFFER_PERS ] THEN STRIP_TAC THEN +UNDISCH_TAC` r1' * sin psi' = r2 * sin (psi + azim v w w2 w1)` THEN +UNDISCH_TAC` r1' * cos psi' = r2 * cos (psi + azim v w w2 w1)` THEN +UNDISCH_TAC` &0 < r2 ` THEN UNDISCH_TAC` &0 < r1' ` THEN +PHA THEN NHANH R_POS_SIN_COS_IDENT THEN +REWRITE_TAC[SIN_COS_IDEN_IFF_DIFFER_PERS ] THEN STRIP_TAC THEN +CHOOSE_TAC (SPEC` psi: real` MOVE_TO_UNIT_INTERVAL ) THEN +CHOOSE_TAC (SPEC` psi': real` MOVE_TO_UNIT_INTERVAL ) THEN +SUBST_ALL_TAC (REWRITE_RULE[GSYM int_add_th;GSYM int_sub_th] (REAL_ARITH` psi' + azim v w w1 w2 = psi + real_of_int k * &2 * pi <=> +azim v w w1 w2 = ( psi + real_of_int n * &2 * pi) - ( psi' + real_of_int n' * &2 * pi) ++ (real_of_int k + real_of_int n' - real_of_int n )* &2 * pi `)) THEN +SUBST_ALL_TAC (REWRITE_RULE[GSYM int_add_th;GSYM int_sub_th] (REAL_ARITH` psi' = (psi + azim v w w2 w1) + real_of_int k' * &2 * pi <=> +azim v w w2 w1 = (psi' + real_of_int n' * &2 * pi) - (psi + real_of_int n * &2 * pi) ++ (real_of_int n - real_of_int k' - real_of_int n') * &2 * pi `)) THEN +ABBREV_TAC ` ppsssi = psi + real_of_int n * &2 * pi ` THEN +ABBREV_TAC ` ppsssi1 = psi' + real_of_int n' * &2 * pi ` THEN +REPEAT (FIRST_X_ASSUM (CONJUNCTS_THEN ASSUME_TAC)) THEN +ASSUME_TAC2 (SPECL [` azim v w w1 w2 `;` k + n' - (n: int) `] (GEN `aa: real` BODE_YEU_ANH_DI)) THEN +REWRITE_TAC[MESON[]` a = b ==> b + c = &0 <=> a = b ==> a + c = &0`] THEN +FIRST_X_ASSUM SUBST1_TAC THEN +UNDISCH_TAC `azim v w w2 w1 = ppsssi1 - ppsssi + real_of_int (n - k' - n') * &2 * pi` THEN +UNDISCH_TAC `azim v w w1 w2 = ppsssi - ppsssi1 + real_of_int (k + n' - n) * &2 * pi` THEN +UNDISCH_TAC` azim v w w2 w1 < &2 * pi ` THEN +UNDISCH_TAC` &0 <= azim v w w2 w1 ` THEN UNDISCH_TAC` azim v w w1 w2 < &2 * pi ` THEN +UNDISCH_TAC` &0 <= azim v w w1 w2 ` THEN UNDISCH_TAC` ppsssi1 < &2 * pi ` THEN +UNDISCH_TAC`&0 <= ppsssi1 ` THEN UNDISCH_TAC` ppsssi < &2 * pi ` THEN +UNDISCH_TAC`&0 <= ppsssi ` THEN PHA THEN +REWRITE_TAC[REWRITE_RULE[REAL_ARITH` &2 * a * b = b * &2 * a `] PDPFQUK]);; + + +let QQZKTXU = prove(`! v w v1 (v2:real^3). let gammma = dihV v w v1 v2 in {v1,v2} INTER aff {v,w} = {} /\ +~( v = w ) ==> cos ( azim v w v1 v2 ) = cos gammma `, +GEOM_ORIGIN_TAC `v:real^3` THEN +ONCE_REWRITE_TAC[SET_RULE`{a} = {a,a}`] THEN +REWRITE_TAC[IMAGE_INTER_AFF3] THEN +REWRITE_TAC[IMAGE_CLAUSES] THEN +REWRITE_TAC[IMAGE_CLAUSES; IMAGE_EQ_EMPTY; INSERT_INSERT] THEN +ONCE_REWRITE_TAC[SPEC ` -- v:real^N` (GSYM DIHV_TRASABLE)] THEN +REWRITE_TAC[VECTOR_ARITH` -- a + a + b = (b:real^N)`] THEN +REPEAT STRIP_TAC THEN +LET_TAC THEN +MP_TAC (SPECL [`(vec 0): real^3`;`w:real^3`; `v1:real^3`;`v2:real^3`] azim) THEN +REPEAT STRIP_TAC THEN +EXPAND_TAC "gammma" THEN +REWRITE_TAC[DIHV_FORMULAR; VECTOR_SUB_RZERO] THEN +REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN PHA THEN +REWRITE_TAC[INSERT_INTER_EMPTY] THEN +DAO THEN NGOAC THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +NHANH (MATCH_MP (MESON[]`(a /\ b ==> c) ==> ( a /\ ~ c ==> ~ b ) `) +PERPENCULAR_PART_IDENT0) THEN +NHANH (MATCH_MP (MESON[]` a dot b = &0 ==> ~( a = vec 0) ==> a dot b = &0`) +VECTOR_OF_DIHV_ORTHONORMAL) THEN +NHANH ORTHOGORNAL_UNITIZE THEN +REWRITE_TAC[NOT_VEC0_UNITABLE] THEN +ABBREV_TAC `e11 = &1 / norm ((w dot w) % v1 - (v1 dot w) % w) % +((w dot w) % v1 - (v1 dot w) % (w: real^3))` THEN +ABBREV_TAC ` e33 = &1 / norm w % (w:real^3)` THEN +STRIP_TAC THEN +UNDISCH_TAC `e11 dot (e33: real^3) = &0` THEN +UNDISCH_TAC` norm ( e33: real^3) = &1 ` THEN +UNDISCH_TAC` norm ( e11: real^3) = &1 ` THEN +PHA THEN +NHANH TWO_UNIT_ORTH_VECTORS_IMP_ORTHONORMAL THEN +EXPAND_TAC "e33" THEN +REWRITE_TAC[GSYM NOT_VEC0_UNITABLE] THEN +REWRITE_TAC[GSYM NOT_VEC0_UNITABLE; GSYM NORM_POS_LT] THEN +NHANH REAL_LT_IMP_NZ THEN +NHANH NOT_EQ0_IMP_NEITHER_INVERT THEN +ASM_REWRITE_TAC[] THEN +STRIP_TAC THEN +UNDISCH_TAC ` &1 / norm w % w = (e33:real^3)` THEN +UNDISCH_TAC ` ~(&1 / norm (w:real^3) = &0)` THEN +PHA THEN NHANH VECTOR_MUL_R_TO_L THEN +REWRITE_TAC[REAL_FIELD` &1 / ( &1 / a ) = a `; GSYM DIST_0] THEN +SUBST_ALL_TAC (MESON[NORM_POS_LT]` &0 < norm (w:real^3) <=> ~(w = vec 0)`) THEN +SIMP_TAC[DIST_SYM] THEN +REWRITE_TAC[VECTOR_ARITH` a = b % x <=> b % x = a - vec 0 `] THEN +STRIP_TAC THEN +UNDISCH_TAC `~((w:real^3) = vec 0)` THEN +FIRST_X_ASSUM MP_TAC THEN +UNDISCH_TAC ` orthonormal e11 e2 e33 ` THEN +PHA THEN FIRST_X_ASSUM NHANH THEN +STRIP_TAC THEN +UNDISCH_TAC ` ~(v1 IN aff {vec 0, (w:real^3)})` THEN +UNDISCH_TAC ` ~((w:real^3) = vec 0)` THEN +UNDISCH_TAC `~(v2 IN aff {vec 0, (w:real^3)})` THEN +ONCE_REWRITE_TAC[MESON[]` ~( a = b ) <=> ~( a = b ) /\ ~( a = b )`] THEN +PHA THEN +ONCE_REWRITE_TAC[TAUT` a /\ b/\ c/\ d <=> b /\ ( b /\ a ) /\c /\ d `] THEN +REWRITE_TAC[PROJECTOR_NOT_EQ_VEC0 ] THEN +REWRITE_TAC[VECTOR_ADD_RID; VECTOR_ARITH` ( a + b ) - a = (b:real^N)`] THEN +SIMP_TAC[NOT_EQ_IMPCOS_ARC; VECTOR_SUB_RZERO] THEN DOWN_TAC THEN +REWRITE_TAC[NOT_EQ_IMPCOS_ARC; VECTOR_SUB_RZERO] THEN +ABBREV_TAC ` azz = azim (vec 0) w v1 v2 ` THEN STRIP_TAC THEN +USE_FIRST `v2 = +(r2 * cos (psi + azz)) % e11 + (r2 * sin (psi + azz)) % e2 + h2 % (w:real^3)` SUBST1_TAC THEN +USE_FIRST `v1 = (r1 * cos psi) % e11 + (r1 * sin psi) % e2 + h1 % (w:real^3)` SUBST1_TAC THEN +UNDISCH_TAC ` orthonormal e11 e2 e33 ` THEN +SIMP_TAC[DOT_LADD; DOT_LMUL; orthonormal] THEN +ABBREV_TAC ` ww = w dot (w:real^3)` THEN +EXPAND_TAC "w" THEN +SIMP_TAC[DOT_SYM; DOT_RMUL; REAL_MUL_RZERO; REAL_ADD_LID; VECTOR_ADD_LDISTRIB] THEN +SIMP_TAC[VECTOR_MUL_ASSOC; REAL_MUL_SYM; VECTOR_ARITH`(a + c + b ) - b = (a:real^N) + c`] THEN +SIMP_TAC[vector_norm; DOT_LADD; DOT_RADD; DOT_LMUL; DOT_RMUL; REAL_MUL_RZERO; DOT_SYM; +REAL_ADD_RID; REAL_MUL_RID; REAL_ADD_LID; GSYM POW_2; REAL_ARITH`( a * b * c ) pow 2 + ( a * b +* d ) pow 2 = ( a * b ) pow 2 * ( d pow 2 + c pow 2 ) `; SIN_CIRCLE] THEN +STRIP_TAC THEN UNDISCH_TAC `~(ww % (v2: real^3) - (v2 dot w) % w = vec 0)` THEN +UNDISCH_TAC `~(ww % (v1: real^3) - (v1 dot w) % w = vec 0)` THEN +EXPAND_TAC "ww" THEN REWRITE_TAC[GSYM PROJECTOR_NOT_EQ_VEC0] THEN +NHANH (MATCH_MP (MESON[]` (a ==> ( b <=> c )) ==> (a /\ ~ b ==> ~ c) `) (SPEC_ALL NOT_EQ_VEC0_IMP_EQU_AFF_COLL)) THEN +FIRST_X_ASSUM NHANH THEN FIRST_X_ASSUM NHANH THEN +REWRITE_TAC[GSYM DOT_POS_LT] THEN STRIP_TAC THEN STRIP_TAC THEN +ASSUME_TAC2 (SPECL [`(w:real^3) dot w `;` r1: real `] REAL_LT_MUL) THEN +ASSUME_TAC2 (SPECL [`(w:real^3) dot w `;` r2: real `] REAL_LT_MUL) THEN +REPLICATE_TAC 2 (FIRST_X_ASSUM MP_TAC) THEN +NHANH REAL_LT_IMP_LE THEN PHA THEN SIMP_TAC[POW_2_SQRT] THEN +REWRITE_TAC[REAL_ARITH` ((w dot w) * r1 * a) * (w dot w) * r2 * b + +((w dot w) * r1 * c) * (w dot w) * r2 * d = +(((w dot w) * r1) * (w dot w) * r2) * (b * a + d * c) `] THEN +SIMP_TAC[REAL_FIELD` &0 < a /\ &0 < b ==> (( a * b ) * c ) / ( a * b ) = c `] THEN +REWRITE_TAC[GSYM COS_SUB; REAL_ARITH` (a + b ) - a = b`]);; + + +(* +("SIMPLIZE_COS_IF_OTHOR ", +|- !v0 v1 w p. +~(v0 = w) /\ +~(v0 = v1) /\ +p - v0 = k % (v1 - v0) /\ +(w - p) dot (v1 - v0) = &0 +==> cos (arcV v0 v1 w) = k * norm (v1 - v0) / norm (w - v0))] +*) +(* Lemma $100 promised with John *) +(* ============================= *) +(* ============================= *) + +let real_itv = new_definition ` real_itv a b = { x | a <= x /\ x < b } `;; +let tri_itv = new_definition ` tri_itv x <=> ( x IN real_itv ( &0 ) ( &2 * pi )) `;; + +(* +parse_as_infix("regular_lt",(12,"right"));; + +let regular_lt = new_definition +` (a:real) regular_lt (b:real) <=> a < b /\ a = &0 `;; + +*) + +parse_as_infix("polar_lt",(12,"right"));; + + +let polar_lt = new_definition +`(a: real^2) polar_lt (b: real^2) <=> + (!ra aa rb ab. + &0 < ra /\ + &0 < rb /\ + a = vector [ra * cos aa; ra * sin aa] /\ + b = vector [rb * cos ab; rb * sin ab] /\ + tri_itv aa /\ + tri_itv ab + ==> aa < ab \/ aa = ab /\ ra < rb) `;; + + +parse_as_infix("polar_le",(12,"right"));; + +let polar_le = new_definition +` a polar_le b <=> a polar_lt b \/ a = b `;; + + +parse_as_infix("polar_cycle_on",(12,"right"));; + +let polar_cycle_on = new_definition +` f polar_cycle_on (W: real^2 -> bool ) <=> + (!x. x IN W ==> f x IN W) /\ + (!x. x IN W + ==> x polar_lt f x /\ + (!y. y IN W ==> ~(x polar_lt y /\ y polar_lt f x)) \/ + (!y. y IN W ==> f x polar_le y /\ y polar_le x)) `;; + +let pl_angle = new_definition` pl_angle (x: real^2) = + (@ u. tri_itv u /\ ( ?t. &0 < t /\ x = + vector [ t * cos u; t * sin u ])) `;; + +let arg_diff = new_definition ` arg_diff a b = + let dd = pl_angle b - pl_angle a in + if a polar_le b then dd else dd + &2 * pi `;; + +let VEC2_PRE_TRIG_FORM = prove(` ! (x:real^2). ~( x = vec 0) ==> ( x$1 / ( sqrt (x$1 * x$1 + x$2 * x$2))) pow 2 + + ( x$2 / ( sqrt (x$1 * x$1 + x$2 * x$2))) pow 2 = &1 `, +REWRITE_TAC[DIV_POW2; GSYM POW_2] THEN +SIMP_TAC[GSYM NORM_EQ_0; vector_norm; DOT_2;GSYM POW_2; SUM_TWO_POW2S; SQRT_EQ_0; SQRT_POW_2] +THEN GEN_TAC THEN CONV_TAC REAL_FIELD);; + + +let PRE_TRIG_FORM_VEC2 = prove(`!(x: real^2). ~(x = vec 0) + ==> (?u. tri_itv u /\ x = vector [( norm x ) * cos u ; ( norm x ) * sin u])`, +NHANH VEC2_PRE_TRIG_FORM THEN +REWRITE_TAC[GSYM NORM_POS_LT; vector_norm; DOT_2] THEN +NHANH SUM_POW2_EQ1_UNIQUE_TRIG THEN +REWRITE_TAC[EXISTS_UNIQUE] THEN +GEN_TAC THEN STRIP_TAC THEN +EXISTS_TAC `x': real` THEN +SIMP_TAC[vector_norm; DOT_2;GSYM POW_2] THEN +ASM_REWRITE_TAC[] THEN +UNDISCH_TAC ` &0 < sqrt ((x:real^2)$1 * x$1 + x$2 * x$2)` THEN +NHANH REAL_LT_IMP_NZ THEN +SIMP_TAC[REAL_DIV_LMUL; POW_2] THEN +REWRITE_TAC[CART_EQ; DIMINDEX_2; FORALL_2; VECTOR_2; tri_itv; real_itv; IN_ELIM_THM] THEN +ASM_REWRITE_TAC[]);; + + +let PL_ANGLE_PROPERTY = prove(`!(x: real^2). ~(x = vec 0) + ==> tri_itv (pl_angle x) /\ + (? t. &0 < t /\ x = vector [ t * cos (pl_angle x); t * sin ( pl_angle x )])`, +NHANH PRE_TRIG_FORM_VEC2 THEN +PAT_REWRITE_TAC `\x. !y. x ==> _ ` [GSYM NORM_POS_LT; RIGHT_AND_EXISTS_THM] THEN +NHANH (MESON[]`(?u. &0 < norm x /\ L u /\ P u ( norm x )) ==> (?u. + L u /\ (?t. &0 < t /\ P u t ))`) THEN +REWRITE_TAC[pl_angle] THEN MESON_TAC[EXISTS_THM]);; + +let POLAR_LT_IMP_NOT_EQ = +prove(` ~( x = vec 0 ) /\ ~((y:real^2) = vec 0 ) ==> + x polar_lt y ==> ~( x = y ) `, +STRIP_TAC THEN REWRITE_TAC[polar_lt] THEN +ONCE_REWRITE_TAC[TAUT` a ==> ~ b <=> b ==> ~ a `] THEN +SIMP_TAC[ NOT_FORALL_THM] THEN +ASSUME_TAC2 (SPEC `y: real^2 ` PRE_TRIG_FORM_VEC2) THEN +FIRST_X_ASSUM CHOOSE_TAC THEN STRIP_TAC THEN +REWRITE_TAC[TAUT` ~ ( a ==> b ) <=> a /\ ~ b `] THEN +EXISTS_TAC `norm (y:real^2)` THEN EXISTS_TAC `u: real` THEN +EXISTS_TAC `norm (y:real^2)` THEN EXISTS_TAC `u:real` THEN +ASM_SIMP_TAC[NORM_POS_LT] THEN DOWN_TAC THEN STRIP_TAC THEN +ASM_REWRITE_TAC[] THEN CONJ_TAC THENL [FIRST_X_ASSUM ACCEPT_TAC; +REWRITE_TAC[REAL_LT_REFL]]);; + +let CART2_EQ = prove(` vector [a1; a2] = (vector [b1; b2]): real^2 +<=> a1 = b1 /\ a2 = b2 `, +REWRITE_TAC[CART_EQ; DIMINDEX_2; ARITH_RULE` 1 <= x /\ x <= 2 <=> +x = 1 \/ x = 2 `; MESON[]`(! x. x = a \/ x = b ==> P x ) <=> + P a /\ P b `; VECTOR_2]);; + + +let SE_ASM_TAC = FIRST_X_ASSUM (CONJUNCTS_THEN ASSUME_TAC);; +let SE_ALL_TAC = REPEAT SE_ASM_TAC;; + + +let POLAR_LT_TRANS = prove(`~( x = vec 0 ) /\ + ~ ((y:real^2) = vec 0 ) /\ ~ ( z = vec 0 ) /\ + x polar_lt y /\ y polar_lt z ==> x polar_lt z `, +REWRITE_TAC[polar_lt] THEN NHANH PL_ANGLE_PROPERTY THEN +STRIP_TAC THEN DOWN_TAC THEN REWRITE_TAC[polar_lt] THEN +REPEAT STRIP_TAC THEN UNDISCH_TAC` tri_itv ab ` THEN +UNDISCH_TAC` tri_itv ( pl_angle y ) ` THEN +UNDISCH_TAC`(z:real^2) = vector [rb * cos ab; rb * sin ab]` THEN +UNDISCH_TAC`(y:real^2) = vector [t' * cos (pl_angle y); t' * sin (pl_angle y)]` THEN +UNDISCH_TAC` &0 < rb ` THEN UNDISCH_TAC` &0 < t' ` THEN +PHA THEN FIRST_X_ASSUM NHANH THEN DISCH_TAC THEN +REPEAT (FIRST_X_ASSUM (CONJUNCTS_THEN ASSUME_TAC)) THEN +UNDISCH_TAC` tri_itv ( pl_angle y ) ` THEN +UNDISCH_TAC `tri_itv aa ` THEN +UNDISCH_TAC`(y:real^2) = vector [t' * cos (pl_angle y); t' * sin (pl_angle y)]` THEN +UNDISCH_TAC`(x:real^2) = vector [ra * cos aa; ra * sin aa]` THEN +UNDISCH_TAC` &0 < t' ` THEN UNDISCH_TAC` &0 < ra ` THEN +PHA THEN FIRST_X_ASSUM NHANH THEN DISCH_TAC THEN SE_ALL_TAC +THEN ASSUME_TAC2 ( +REAL_ARITH `(pl_angle y < ab \/ pl_angle y = ab /\ t' < rb ) /\ +( aa < pl_angle y \/ aa = pl_angle y /\ ra < t' ) ==> + aa < ab \/ aa = ab /\ ra < rb `) THEN FIRST_ASSUM ACCEPT_TAC);; + + + +let EXISTS_MAX_ELEMENT = prove + (`!S (lt:A->A->bool). + FINITE S /\ ~(S = {}) /\ + (!x y z. lt x y /\ lt y z ==> lt x z) /\ + (!x. ~(lt x x)) /\ + (!x y. S x /\ S y /\ ~( x = y ) ==> lt x y \/ lt y x ) + ==> ?m:A. S m /\ ( ! x. S x ==> lt x m \/ x = m )`, + REPEAT STRIP_TAC THEN + MP_TAC(ISPEC `\x:A y:A. x IN S /\ y IN S /\ lt y x` WF_FINITE) THEN + ASM_SIMP_TAC[FINITE_RESTRICT] THEN + ANTS_TAC THENL [ASM_MESON_TAC[]; ALL_TAC] THEN + REWRITE_TAC[WF] THEN DISCH_THEN(MP_TAC o SPEC `S:A->bool`) THEN + ASM SET_TAC[]);; + + +let NO_V0_IMP_NOT_SELF_POLLAR = MESON[POLAR_LT_IMP_NOT_EQ] +` ~ ( x = vec 0 ) ==> ~ ( x polar_lt x ) `;; + +let SET_TAC = let basicthms = +[NOT_IN_EMPTY; IN_UNIV; IN_UNION; IN_INTER; IN_DIFF; IN_INSERT; +IN_DELETE; IN_REST; IN_INTERS; IN_UNIONS; IN_IMAGE] in +let allthms = basicthms @ map (REWRITE_RULE[IN]) basicthms @ +[IN_ELIM_THM; IN] in +let PRESET_TAC = +TRY(POP_ASSUM_LIST(MP_TAC o end_itlist CONJ)) THEN +REPEAT COND_CASES_TAC THEN +REWRITE_TAC[EXTENSION; SUBSET; PSUBSET; DISJOINT; SING] THEN +REWRITE_TAC allthms in +fun ths -> +PRESET_TAC THEN +(if ths = [] then ALL_TAC else MP_TAC(end_itlist CONJ ths)) THEN +MESON_TAC ths ;; + +(* =========== improved SET_RULE ============= *) +let SET_RULE a = fun x -> prove(x, SET_TAC a );; + +let POLAR_CYCLIC_FUN_IMP_ALL_BELONG = +prove(` W p /\ f polar_cycle_on W ==> ! n. ITER n f p IN W `, +REWRITE_TAC[polar_cycle_on] THEN STRIP_TAC THEN INDUCT_TAC THENL [REWRITE_TAC[ITER] THEN +ASM SET_TAC[]; REWRITE_TAC[ITER] THEN ASM SET_TAC[]]);; + +let EXISTS_MIN_IN_ORDERED_FINITE_SET = +prove(`!(S: A -> bool) lt. + FINITE S /\ + ~(S = {}) /\ (! x. lt x x ) /\ + (!x y z. lt x y /\ lt y z ==> lt x z) /\ + (! x y. lt x y /\ lt y x ==> x = y ) /\ + (!x y. lt x y \/ lt y x) + ==> (?m. S m /\ (!x. S x ==> lt m x ))`, +REPEAT STRIP_TAC THEN MP_TAC (ISPEC`\(x : A ) ( y: A). + S x /\ S y /\ lt x y /\ ~ ( x = y )` WF_FINITE) THEN +ASM_SIMP_TAC[REWRITE_RULE[IN] FINITE_RESTRICT] THEN +ANTS_TAC THENL [ASM_MESON_TAC[]; REWRITE_TAC[WF]] THEN +DISCH_THEN (MP_TAC o SPEC `S: A -> bool `) THEN +ANTS_TAC THENL [ASM SET_TAC[]; STRIP_TAC] THEN +EXISTS_TAC `x: A` THEN ASM REWRITE_TAC[] THEN ASM_MESON_TAC[]);; + + +let EXISTS_MA_OR_FI_SET = BETA_RULE (SPECL[` S : A -> bool `; +`(\x y. (lt: A -> A -> bool) y x ) `] EXISTS_MIN_IN_ORDERED_FINITE_SET);; +(* EXISTS_MA_OR_FI_SET + |- FINITE S /\ + ~(S = {}) /\ + (!x. lt x x) /\ + (!x y z. lt y x /\ lt z y ==> lt z x) /\ + (!x y. lt y x /\ lt x y ==> x = y) /\ + (!x y. lt y x \/ lt x y) + ==> (?m. S m /\ (!x. S x ==> lt x m)) *) + + +let tri_itv = let t1 = CONJ tri_itv real_itv in CONJ t1 IN_ELIM_THM;; + +let DOWN = FIRST_X_ASSUM MP_TAC;; + +let WHILE_POLAR_LT_IMP_ST = prove(` p0 polar_lt p ==> +~ ( {y | ?N. y = ITER N f p0 /\ + (!n. 0 <= n /\ n < N ==> ITER n f p0 polar_lt y) /\ + y polar_lt p } = {} )`, +REWRITE_TAC[SET_RULE[]`~( x = {} ) <=> ? y. y IN x `; IN_ELIM_THM] THEN +STRIP_TAC THEN EXISTS_TAC` p0: real^2` THEN EXISTS_TAC `0 ` THEN +ASM_SIMP_TAC[ITER; ARITH_RULE`~( 0 <= a /\ a < 0 )`]);; + + +let DOT_ITSELF_2 = prove( ` (x:real^2) = vector[ a; b ] + ==> x dot x = a pow 2 + b pow 2 `, +SIMP_TAC[dot; DIMINDEX_2; SUM_2; VECTOR_2] THEN +DISCH_TAC THEN REAL_ARITH_TAC);; + + +let NORM_VECTOR2_TRIG = +prove(` (x:real^2) = vector [a * cos t ; a * sin t ] +/\ &0 <= a ==> norm x = a `, STRIP_TAC THEN UNDISCH_TAC ` &0 <= a ` +THEN SIMP_TAC[NORM_POS_LE; EQ_POW2_COND; NORM_POW_2] THEN +DOWN_TAC THEN NHANH DOT_ITSELF_2 THEN STRIP_TAC THEN +DOWN THEN DOWN THEN PHA THEN SIMP_TAC[] THEN +DISCH_TAC THEN REWRITE_TAC[R_SIN_CIRCLE]);; + + +let NOT_EQ_IMP_TOTAL_ORDER = prove( +` ! x y. ~( x = y ) ==> x polar_lt y \/ y polar_lt +x `, REWRITE_TAC[polar_lt] THEN REPEAT STRIP_TAC THEN +ASM_CASES_TAC `(x:real^2) = vec 0 \/ (y:real^2) += vec 0 ` THENL [ DISJ1_TAC THEN REPEAT GEN_TAC THEN +NHANH REAL_LT_IMP_LE THEN NHANH ( +MESON[NORM_VECTOR2_TRIG]`(aaa /\ &0 <= ra) /\ + (ac/\ &0 <= rb) /\ + (x:real^2) = vector [ra * cos aa; ra * sin aa] /\ + (y:real^2) = vector [rb * cos ab; rb * sin ab]/\ gg +==> norm x = ra /\ norm y = rb `) THEN DOWN THEN +REWRITE_TAC[GSYM NORM_EQ_0] THEN SIMP_TAC[] THEN +MESON_TAC[REAL_ARITH`~( a = &0 /\ &0 < a ) `]; ALL_TAC] +THEN DOWN THEN REWRITE_TAC[DE_MORGAN_THM] THEN +NHANH PRE_TRIG_FORM_VEC2 THEN STRIP_TAC THEN +DOWN_TAC THEN REWRITE_TAC[GSYM polar_lt] THEN +MP_TAC (REAL_ARITH` u < u' \/ u = u' \/ u' < u `) THEN +SPEC_TAC (`u:real`,`u:real`) THEN +SPEC_TAC (`u':real`,`u':real`) THEN +SPEC_TAC (`x:real^2`,`x:real^2`) THEN +SPEC_TAC (`y:real^2`,`y:real^2`) THEN +MATCH_MP_TAC ( +MESON[]`(! y x u' u. P1 u u' /\ M x y u u' ==> +Q x y ) /\ ((! y x u' u. P1 u u' /\ M x y u u' ==> +Q x y ) ==> (! y x u' u. P1 u' u /\ M x y u u' ==> +Q y x )) /\ (! y x u' u. u = u' /\ M x y u u' ==> +Q x y \/ Q y x) ==> (! y x u' u. +P1 u u' \/ u = u' \/ P1 u' u ==> +M x y u u' ==> Q x y \/ Q y x ) `) THEN CONJ_TAC +THENL [REPEAT STRIP_TAC THEN UNDISCH_TAC ` u < (u':real)` +THEN DISCH_TAC THEN REWRITE_TAC[polar_lt] THEN REPEAT STRIP_TAC THEN DISJ1_TAC THEN +UNDISCH_TAC`(x:real^2) = vector [norm x * cos u; norm x * sin u]` THEN +UNDISCH_TAC` (y:real^2) = vector [norm y * cos u' +; norm y * sin u' ]` THEN +EVERY_ASSUM (fun x -> PAT_REWRITE_TAC `\v. v = h ==> v = h ==> gg ` +[x ]) THEN REWRITE_TAC[CART2_EQ] THEN +REPEAT DISCH_TAC THEN +ASSUME_TAC2 (REAL_ARITH` &0 < ra /\ &0 < rb ==> +&0 <= ra /\ &0 <= rb `) THEN SE_ALL_TAC THEN +UNDISCH_TAC ` &0 <= ra ` THEN UNDISCH_TAC `(x:real^2) = vector +[ra * cos aa; ra * sin aa]` THEN +PHA THEN NHANH NORM_VECTOR2_TRIG THEN STRIP_TAC THEN +FIRST_X_ASSUM SUBST_ALL_TAC THEN UNDISCH_TAC ` &0 <= rb ` +THEN UNDISCH_TAC `(y:real^2) = vector +[rb * cos ab; rb * sin ab]` THEN PHA THEN +NHANH NORM_VECTOR2_TRIG THEN STRIP_TAC THEN +FIRST_X_ASSUM SUBST_ALL_TAC THEN +REPLICATE_TAC 8 DOWN THEN PHA THEN +ASM_SIMP_TAC[MESON[REAL_ARITH` &0 < a ==> ~( a = &0 )`; REAL_EQ_MUL_LCANCEL]` +&0 < a ==> ( a * x = a * y <=> x = y ) `] THEN +UNDISCH_TAC` tri_itv aa ` THEN UNDISCH_TAC ` tri_itv u ` THEN +UNDISCH_TAC`tri_itv u'` THEN UNDISCH_TAC` tri_itv ab` THEN +REWRITE_TAC[tri_itv; real_itv; IN_ELIM_THM] THEN +REPEAT STRIP_TAC THEN SUBGOAL_THEN` aa = (u: real) /\ ab = (u': real)` ASSUME_TAC +THENL [ASM_MESON_TAC[IDENT_WHEN_IDENT_SIN_COS]; +ASM_REWRITE_TAC[]]; +CONJ_TAC THENL [MESON_TAC[]; REPEAT GEN_TAC]] THEN +IMP_TAC THEN DISCH_THEN ( fun x -> REWRITE_TAC[ SYM x ]) THEN +ASM_CASES_TAC ` norm (x:real^2) = norm (y:real^2)` +THENL [ASM_REWRITE_TAC[] THEN MESON_TAC[]; DOWN] THEN +REWRITE_TAC[REAL_ARITH` ~( a = b ) <=> a < b \/ +b < a `] THEN SPEC_TAC (`x:real^2`,`x:real^2`) THEN +SPEC_TAC (`y:real^2`,`y:real^2`) THEN +MATCH_MP_TAC (MESON[]`(! x y. P x y /\ R x y ==> Q x y ) /\ +((! x y. P x y /\ R x y ==> Q x y ) ==> +(! x y. P y x /\ R x y ==> Q y x ) ) ==> +(! x y. P x y \/ P y x ==> R x y ==> Q x y \/ Q y x)`) THEN +CONJ_TAC THENL [ +REPEAT STRIP_TAC THEN REWRITE_TAC[polar_lt] THEN +REPEAT GEN_TAC THEN NHANH_PAT `\x. x ==> h ` REAL_LT_IMP_LE THEN +DISCH_TAC THEN SUBGOAL_THEN `norm (y':real^2) = ra /\ +norm (y:real^2) = rb ` ASSUME_TAC THENL [ +FIRST_X_ASSUM ( fun x -> MESON_TAC[x; NORM_VECTOR2_TRIG]) +; REPEAT STRIP_TAC] THEN DISJ2_TAC THEN +UNDISCH_TAC `(y': real^2) = +vector [norm y' * cos u; norm y' * sin u]` THEN +UNDISCH_TAC `(y: real^2) = +vector [norm y * cos u; norm y * sin u]` THEN +EVERY_ASSUM (fun x -> PAT_REWRITE_TAC `\x. +x = y ==> x = z ==> l ` [x]) THEN +REWRITE_TAC[CART2_EQ] THEN DOWN_TAC THEN +SIMP_TAC[GSYM NORM_POS_LT] THEN STRIP_TAC THEN +SUBGOAL_THEN ` ab = (u:real) /\ aa = u ` ASSUME_TAC +THENL [REPLICATE_TAC 4 DOWN THEN PHA THEN ASM_REWRITE_TAC[] THEN +ASM_SIMP_TAC[MESON[REAL_EQ_MUL_LCANCEL; REAL_ARITH` &0 < a ==> +~ ( a = &0 )`]` &0 < a ==> ( a * x = a * y <=> x = y ) `] THEN +UNDISCH_TAC` tri_itv aa ` THEN UNDISCH_TAC ` tri_itv ab ` THEN +UNDISCH_TAC `tri_itv u ` THEN PHA THEN REWRITE_TAC[tri_itv] THEN +MESON_TAC[IDENT_WHEN_IDENT_SIN_COS]; +ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[]]; +MESON_TAC[]]);; + + + + +let PROVE_XISTS_MAX_ELEMENT_LT_P = prove( +` ! W:real^2 -> bool. (! x. W x ==> ~ ( x = vec 0 )) /\ + FINITE W /\ + W p0 /\ + f polar_cycle_on W /\ + p0 polar_lt p /\ + SS = { y | ? N. y = ITER N f p0 /\ + ( ! n . 0 <= n /\ n < N ==> ITER n f p0 polar_lt y ) /\ + y polar_lt p } +==> (? mx. mx IN SS /\ ( ! x. SS x ==> x polar_lt mx \/ x = mx)) `, +ONCE_REWRITE_TAC[TAUT`aa /\ a /\ b /\ c /\ d <=> aa /\ +a /\ (b /\ c ) /\ d `] THEN +NHANH POLAR_CYCLIC_FUN_IMP_ALL_BELONG THEN REPEAT STRIP_TAC THEN +FIRST_X_ASSUM MP_TAC THEN +SUBGOAL_THEN `(! y n. y = ITER n f p0 ==> W (y:real^2))` ASSUME_TAC +THENL [ASM SET_TAC[]; FIRST_ASSUM NHANH] THEN +REWRITE_TAC[TAUT`( a /\ b) /\ c <=> b /\ a /\ c`; RIGHT_EXISTS_AND_THM] THEN +DOWN_TAC THEN NHANH (REWRITE_RULE[IN; RIGHT_FORALL_IMP_THM] FINITE_RESTRICT) THEN +STRIP_TAC THEN SUBGOAL_THEN ` FINITE (SS: real^2 -> bool) ` ASSUME_TAC THENL +[ASM_MESON_TAC[]; ALL_TAC] THEN +DOWN_TAC THEN REWRITE_TAC[GSYM RIGHT_EXISTS_AND_THM] THEN +PAT_REWRITE_TAC `\x. y /\ x ==> h ` [TAUT` a ==> b <=> a <=> +b /\ a `] THEN +NHANH (SET_RULE[]` S = {y | ? N. P y /\ Q N y } ==> S SUBSET P `) THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +REPLICATE_TAC 8 (IMP_TAC THEN STRIP_TAC) THEN NGOAC THEN +ASM_REWRITE_TAC[] THEN PHA THEN +DOWN THEN REWRITE_TAC[TAUT`(b /\ a <=> a) <=> a ==> b `] THEN +ASSUME_TAC2 WHILE_POLAR_LT_IMP_ST THEN +ABBREV_TAC ` lt x y = ( ( W x /\ W y ) /\ x polar_lt (y:real^2)) ` +THEN SUBGOAL_THEN `(! x. ~ lt x (x:real^2) )` ASSUME_TAC THENL +[FIRST_X_ASSUM ( fun x -> REWRITE_TAC [ GSYM x; +NO_V0_IMP_NOT_SELF_POLLAR]) THEN REWRITE_TAC[DE_MORGAN_THM] +THEN GEN_TAC THEN ASM_CASES_TAC` (W: real^2 -> bool ) x ` THENL +[DISJ2_TAC THEN ASM MESON_TAC[NO_V0_IMP_NOT_SELF_POLLAR]; +ASM_REWRITE_TAC[]]; +SUBGOAL_THEN `(!x y z. lt (x:real^2) (y: real^2) /\ lt y z ==> lt x z)` ASSUME_TAC +THEN DOWN] THENL [ +FIRST_X_ASSUM (fun x -> REWRITE_TAC[GSYM x ]) THEN +REPLICATE_TAC 5 STRIP_TAC THEN ASM_REWRITE_TAC[POLAR_LT_TRANS] +THEN DOWN_TAC THEN MESON_TAC[POLAR_LT_TRANS]; +REWRITE_TAC[TAUT`(a <=> b /\ a ) <=> a ==> b`] THEN +REPEAT STRIP_TAC THEN +UNDISCH_TAC ` ~({y | ?N. y = ITER N f p0 /\ + (!n. 0 <= n ==> n < N ==> ITER n f p0 polar_lt y) /\ + y polar_lt p} = + {})`] THEN REWRITE_TAC[IMP_IMP] THEN DOWN THEN DOWN THEN +FIRST_ASSUM SUBST1_TAC THEN REPEAT STRIP_TAC THEN +SUBGOAL_THEN `(!x y. (SS:real ^2 -> bool) x /\ SS y /\ ~(x = y) ==> +lt x y \/ lt y x)` ASSUME_TAC THENL [ +USE_FIRST `!x y. ((W:real^2 -> bool) x /\ W y) +/\ x polar_lt y <=> lt x y` (fun x -> REWRITE_TAC[ +GSYM x ]) THEN UNDISCH_TAC` SS SUBSET (W: real^2 -> bool)` THEN +SET_TAC[NOT_EQ_IMP_TOTAL_ORDER]; +SUBGOAL_THEN `(?m. (SS:real^2 -> bool) m /\ +(!x. SS x ==> lt x m \/ x = m)) ` ASSUME_TAC THENL +[FIRST_X_ASSUM MP_TAC THEN +UNDISCH_TAC` ! (x:real^2). ~ lt x x ` THEN +UNDISCH_TAC ` (!(x:real^2) y z. lt x y /\ +lt y z ==> lt x z) ` THEN +UNDISCH_TAC `~ ( (SS: real^2 -> bool ) = {})` THEN +UNDISCH_TAC `FINITE (SS: real^2 -> bool)` THEN +PHA THEN REWRITE_TAC[EXISTS_MAX_ELEMENT]; +REWRITE_TAC[IN] THEN FIRST_X_ASSUM CHOOSE_TAC THEN +EXISTS_TAC `m: real^2` THEN ASM SET_TAC[]]]);; + + + +let VEC0_BOTH_LT_GT = prove(` + y = vec 0 ==> x polar_lt y /\ y polar_lt z `, +REWRITE_TAC[polar_lt] THEN DISCH_TAC THEN +SUBGOAL_THEN `(! ry ay. ~ (&0 < ry /\ (y:real^2) = + vector[ ry * cos ay ; ry * sin ay ]))` ( fun x -> +ASM_MESON_TAC[x]) THEN NHANH REAL_LT_IMP_LE THEN +REPEAT STRIP_TAC THEN ASSUME_TAC2 (SPECL [` ay: real ` +;` y: real^2`;` ry: real`] (GEN_ALL NORM_VECTOR2_TRIG)) + THEN DOWN_TAC THEN REWRITE_TAC[GSYM NORM_EQ_0] THEN +MESON_TAC[REAL_ARITH` ~( &0 < y /\ y = &0 )`]);; + + + +let POLAR_LT_TRANS = prove(` ~( y = vec 0 ) ==> + x polar_lt y /\ y polar_lt z ==> x polar_lt z `, +MESON_TAC[POLAR_LT_TRANS; VEC0_BOTH_LT_GT]);; + + + +let PROVE_EXISTING_MAX_IN_CYCLIC_FINITE_SET = +prove(` ! (W: real^2 -> bool). FINITE W /\ ~( W = {} ) /\ +(! x. W x ==> ~( x = vec 0 )) ==> +? m. W m /\ (! x. W x ==> x polar_lt m \/ x = m ) `, +REPEAT STRIP_TAC THEN +ABBREV_TAC ` lt x y = ( W x /\ W y /\ x polar_lt y ) ` THEN +SUBGOAL_THEN `! x. ~ lt x (x:real^2) ` ASSUME_TAC THENL [ +FIRST_X_ASSUM (fun s -> REWRITE_TAC[GSYM s]) THEN +GEN_TAC THEN REWRITE_TAC[DE_MORGAN_THM] THEN +ASM_CASES_TAC ` (W: real^2 -> bool) (x:real^2)` THENL [ +DISJ2_TAC THEN DISJ2_TAC THEN +ASM_MESON_TAC[NO_V0_IMP_NOT_SELF_POLLAR]; ASM_SIMP_TAC[]]; +SUBGOAL_THEN `(! x y z. ( lt: real^2 -> real^2 -> bool) x y +/\ lt y z ==> lt x z) /\ (! x y. W x /\ W y /\ ~ ( x = y ) +==> lt x y \/ lt y x ) ` ASSUME_TAC] THENL [ +DOWN THEN FIRST_X_ASSUM ( fun x -> REWRITE_TAC[GSYM x]) +THEN SIMP_TAC[] THEN +DISCH_TAC THEN CONJ_TAC THENL [FIRST_X_ASSUM NHANH THEN +REPEAT STRIP_TAC THEN ASM_MESON_TAC[POLAR_LT_TRANS]; +SIMP_TAC[NOT_EQ_IMP_TOTAL_ORDER]]; +MP_TAC (ISPECL[`W:real^2 -> bool `;` lt: real^2 -> +real^2 -> bool `] EXISTS_MAX_ELEMENT) THEN ANTS_TAC THENL +[ASM_REWRITE_TAC[]; USE_FIRST `!x y. (W:real^2 -> bool) x /\ W y /\ +x polar_lt y <=> lt x y` (fun x -> REWRITE_TAC[ GSYM x]) THEN +MESON_TAC[]]]);; + + + +let PROVE_MIN_ELEMENT_IN_FINITE_CYCLIC_SET = +prove(` ! (W: real^2 -> bool). FINITE W /\ ~( W = {}) /\ +(! x. W x ==> ~ ( x = vec 0)) ==> + ? n. W n /\ (! x. W x ==> n polar_lt x \/ n = x ) `, +REPEAT STRIP_TAC THEN +MP_TAC (BETA_RULE (ISPECL [`W:real^2 -> bool `;` (\x y. W x /\ +W y /\ y polar_lt x ) `] EXISTS_MAX_ELEMENT)) THEN ANTS_TAC +THENL [ASM_MESON_TAC[POLAR_LT_TRANS; NO_V0_IMP_NOT_SELF_POLLAR +; NOT_EQ_IMP_TOTAL_ORDER]; MESON_TAC[]]);; + + + + + + + +let TOW_NON_VEC0_IMP_NOT_REFL_POLAR_LT = +prove(` ~((x:real^2) = vec 0 ) /\ ~( y = vec 0 ) ==> +~( x polar_lt y /\ y polar_lt x ) `, +MESON_TAC[NO_V0_IMP_NOT_SELF_POLLAR; POLAR_LT_TRANS]);; + + + + +let EXISTS_STEPS_FOR_FOLLOWING_POINTS = prove( + ` ! W:real^2 -> bool. (! x. W x ==> ~ ( x = vec 0 )) /\ + FINITE W /\ + W p0 /\ + f polar_cycle_on W /\ + p0 polar_lt p /\ W p +==> ? n. ITER n f p0 = p /\ (! nn. nn < n ==> ITER nn f p0 +polar_lt p ) `, REPEAT STRIP_TAC THEN +ABBREV_TAC ` SS = { y| ?N. (y:real^2) = ITER N f p0 /\ + (! n. 0 <= n /\ n < N ==> ITER n f p0 polar_lt y ) /\ + y polar_lt p} ` THEN MP_TAC (SPEC_ALL PROVE_XISTS_MAX_ELEMENT_LT_P) +THEN ANTS_TAC THENL [ASM_REWRITE_TAC[]; STRIP_TAC] THEN +UNDISCH_TAC `mx IN (SS: real^2 -> bool)` THEN +EXPAND_TAC "SS" THEN REWRITE_TAC[IN_ELIM_THM] THEN +STRIP_TAC THEN EXISTS_TAC ` N + 1` THEN +REWRITE_TAC[ARITH_RULE` n < b + 1 <=> n < b \/ n = b `; +MESON[]`(! x. P x \/ x = a ==> Q x ) <=> Q a /\ (! x. +P x ==> Q x )`] THEN REPLICATE_TAC 3 DOWN THEN PHA THEN +SIMP_TAC[ARITH_RULE` 0 <= n`] THEN +ASSUME_TAC2 ( SPEC `p0: real^2 ` ( GEN `p: real ^2 ` +POLAR_CYCLIC_FUN_IMP_ALL_BELONG)) THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN SIMP_TAC[] THEN DISCH_TAC + THEN SUBGOAL_THEN `~ (mx:real^2 = vec 0) ` ASSUME_TAC +THENL [ASM SET_TAC[]; CONJ_TAC] THENL [ALL_TAC ; +ASM_MESON_TAC[POLAR_LT_TRANS]] THEN +ASM_CASES_TAC ` p polar_lt ( ITER ( N + 1) f p0 ) \/ +p = ITER (N + 1) (f:real^2 -> real^2) p0` THEN +UNDISCH_TAC `f polar_cycle_on W ` THEN REWRITE_TAC[polar_cycle_on] +THEN STRIP_TAC THEN FIRST_X_ASSUM (MP_TAC o SPEC ` mx:real^2`) +THEN SUBGOAL_THEN ` mx IN (W: real^2 -> bool)` ASSUME_TAC +THENL [ASM_MESON_TAC[]; +ANTS_TAC THENL [FIRST_X_ASSUM ACCEPT_TAC; STRIP_TAC] THENL +[FIRST_X_ASSUM DISJ_CASES_TAC THEN DOWN_TAC THEN +REWRITE_TAC[GSYM ADD1; ITER] THEN SET_TAC[]; +DOWN_TAC THEN REWRITE_TAC[GSYM ADD1; ITER] THEN +STRIP_TAC THEN FIRST_X_ASSUM SUBST_ALL_TAC THEN +SUBGOAL_THEN ` ~((p:real^2) = vec 0 ) ` ASSUME_TAC THENL +[ASM_MESON_TAC[]; SUBGOAL_THEN ` mx polar_lt f mx ` ASSUME_TAC] +THENL [ASM_MESON_TAC[POLAR_LT_TRANS]; +DOWN_TAC THEN REWRITE_TAC[polar_le] THEN +SET_TAC[TOW_NON_VEC0_IMP_NOT_REFL_POLAR_LT; +POLAR_LT_TRANS]]]; ASM_MESON_TAC[]; +ANTS_TAC] THENL [FIRST_X_ASSUM ACCEPT_TAC; +DISCH_TAC THEN SE_ALL_TAC THEN +SUBGOAL_THEN ` ITER (N + 1) (f:real^2 -> real^2) p0 +polar_lt p ` ASSUME_TAC THENL [ +SET_TAC[TOW_NON_VEC0_IMP_NOT_REFL_POLAR_LT; +NOT_EQ_IMP_TOTAL_ORDER; IN]; +SUBGOAL_THEN ` ITER (N + 1) (f:real^2 -> real^2) p0 +IN SS` ASSUME_TAC]] THENL [ +SUBGOAL_THEN ` mx polar_lt (f:real^2 -> real^2) mx ` +ASSUME_TAC THENL [ +FIRST_X_ASSUM DISJ_CASES_TAC THENL [ASM_SIMP_TAC[]; +DOWN_TAC] THEN REWRITE_TAC[GSYM ADD1; ITER; polar_le] THEN +SET_TAC[TOW_NON_VEC0_IMP_NOT_REFL_POLAR_LT]; +EXPAND_TAC "SS" THEN REWRITE_TAC[IN_ELIM_THM] THEN +EXISTS_TAC `N + 1 ` THEN DOWN_TAC THEN REWRITE_TAC[GSYM ADD1; ITER] +THEN STRIP_TAC THEN ASM_REWRITE_TAC[LE_0; LT]] THENL [ +REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[] THEN +ASM SET_TAC[POLAR_LT_TRANS]; ASM SET_TAC[POLAR_LT_TRANS]]; +SUBGOAL_THEN ` mx polar_lt (f:real^2 -> real^2) mx ` +ASSUME_TAC THENL [FIRST_X_ASSUM DISJ_CASES_TAC THENL [ASM_SIMP_TAC[]; +DOWN_TAC] THEN REWRITE_TAC[GSYM ADD1; ITER; polar_le] THEN +SET_TAC[TOW_NON_VEC0_IMP_NOT_REFL_POLAR_LT]; +DOWN_TAC THEN REWRITE_TAC[GSYM ADD1; ITER] THEN +SET_TAC[TOW_NON_VEC0_IMP_NOT_REFL_POLAR_LT]]]);; + + + +let CARD_SING = prove(`! (x:A). CARD {x} = 1 `, +MP_TAC CARD_CLAUSES THEN STRIP_TAC THEN +GEN_TAC THEN FIRST_X_ASSUM (ASSUME_TAC o SPECL [` x: A `; ` {} : A -> bool `]) +THEN SUBGOAL_THEN `FINITE ({} : A -> bool ) ` MP_TAC THENL +[ REWRITE_TAC[FINITE_EMPTY]; FIRST_X_ASSUM NHANH] THEN +ASM_SIMP_TAC[NOT_IN_EMPTY; ADD1; ADD_CLAUSES]);; + + + + + +let POLAR_LE_REFL_EQ = prove(` a polar_le b /\ b polar_le a +<=> a = b \/ a = vec 0 \/ b = vec 0 `, +REWRITE_TAC[polar_le] THEN +MESON_TAC[VEC0_BOTH_LT_GT; POLAR_LT_TRANS; +TOW_NON_VEC0_IMP_NOT_REFL_POLAR_LT]);; + + +let CHANGE ne ol = fun x -> SPEC ne ( GEN ol x);; + + +let POLAR_MONOPOLY_IN_FIRST_ITERVAL = +prove(` (!x. W x ==> ~(x = vec 0)) /\ + FINITE W /\ + W p0 /\ + f polar_cycle_on W /\ + (!x. W x ==> p0 polar_le x ) /\ + i < CARD W - 1 ==> +ITER i f p0 polar_lt f (ITER i f p0) `, +ABBREV_TAC ` xx = ITER i f (p0: real^2) ` THEN STRIP_TAC +THEN SUBGOAL_THEN ` (xx: real^2) IN W ` ASSUME_TAC THENL [ +ASM_MESON_TAC[POLAR_CYCLIC_FUN_IMP_ALL_BELONG]; +DOWN THEN USE_FIRST ` f polar_cycle_on W ` MP_TAC] THEN +REWRITE_TAC[polar_cycle_on] THEN STRIP_TAC THEN +FIRST_X_ASSUM NHANH THEN STRIP_TAC THEN +SUBGOAL_THEN ` FINITE {y | ? ii. ii <= i /\ y = ITER ii +f (p0: real^2)} ` ASSUME_TAC THENL [ +SPEC_TAC (`i: num`,`i: num `) THEN INDUCT_TAC THENL [ +REWRITE_TAC[LE; MESON[]`(?a. a = b /\ P a) <=> P b`; ITER +; SET_RULE[]` {x| x = a} = {a} `] THEN SIMP_TAC[FINITE_RULES]; +REWRITE_TAC[ADD1; ARITH_RULE` a <= c + 1 <=> a <= c \/ +a = c + 1 `; SET_RULE[]` {y| ? x. ( P x \/ x = a ) /\ y = Q x } = +Q a INSERT {y | ? x. P x /\ y = Q x } `] THEN +ASM_SIMP_TAC[FINITE_RULES]]; +ABBREV_TAC ` SS = {y | ?ii. ii <= i /\ y = ITER ii f (p0:real^2)} +`] THEN SUBGOAL_THEN ` W SUBSET (SS:real^2 -> bool)` ASSUME_TAC +THENL [REWRITE_TAC[SUBSET] THEN REPEAT STRIP_TAC THEN +ASM_CASES_TAC ` p0 = (x:real^2)` THENL [ +EXPAND_TAC "x" THEN EXPAND_TAC "SS" THEN REWRITE_TAC[IN_ELIM_THM] +THEN EXISTS_TAC `0` THEN REWRITE_TAC[LE_0; ITER]; +ALL_TAC] THEN +SUBGOAL_THEN`p0 polar_lt x ` ASSUME_TAC THENL [DOWN_TAC +THEN REWRITE_TAC[polar_le] THEN SET_TAC[]; ALL_TAC] THEN +MP_TAC (SPEC_ALL (CHANGE `x: real^2 ` `p:real^2 ` +EXISTS_STEPS_FOR_FOLLOWING_POINTS)) THEN ANTS_TAC THENL [ +ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[GSYM IN] THEN +ASM_SIMP_TAC[]; STRIP_TAC] THEN +ASM_CASES_TAC ` n <= (i:num) ` THENL [EXPAND_TAC "SS" +THEN EXPAND_TAC "x" THEN REWRITE_TAC[IN_ELIM_THM] THEN +EXISTS_TAC `n:num` THEN ASM_REWRITE_TAC[]; DOWN] THEN +REWRITE_TAC[ARITH_RULE` ~( s <= h ) <=> (h:num) < s `] THEN +FIRST_ASSUM NHANH THEN +SUBGOAL_THEN ` x polar_le xx ` ASSUME_TAC THENL [ +ASM SET_TAC[]; ASM_REWRITE_TAC[]] THEN DOWN THEN +REWRITE_TAC[polar_le] THEN +ASM SET_TAC[NO_V0_IMP_NOT_SELF_POLLAR; +TOW_NON_VEC0_IMP_NOT_REFL_POLAR_LT]; SUBGOAL_THEN ` CARD (W:real^2 -> bool) <= CARD (SS: real^2 +-> bool)` ASSUME_TAC THENL [ASM_MESON_TAC[CARD_SUBSET]; +SUBGOAL_THEN ` CARD (SS: real^2 -> bool) <= i + 1 ` +ASSUME_TAC]] THENL [UNDISCH_TAC `FINITE (SS:real^2 -> bool)` THEN +EXPAND_TAC "SS" THEN SPEC_TAC (`i:num`,`i:num`) THEN +INDUCT_TAC THENL [REWRITE_TAC[LE; SET_RULE[]` {y| ?x. x = 0 /\ y = P x } += {P 0}`; ITER; CARD_SING; ADD; LE_REFL]; +PAT_REWRITE_TAC `\a. b ==> a <= c ` [ADD1; ARITH_RULE ` a <= b + 1 + <=> a <= b \/ a = b + 1 `] THEN PAT_REWRITE_TAC `\x. x ==> h ` [ADD1; +ARITH_RULE ` a <= b + 1 <=> a <= b \/ a = b + 1 `] THEN +REWRITE_TAC[ADD1; SET_RULE[]` {y| ? x. (P x \/ x = a ) /\ y = Q x } = +Q a INSERT {y| ?x. P x /\ y = Q x } `; FINITE_INSERT] THEN +FIRST_X_ASSUM NHANH THEN +NHANH (let [a;b] = CONJUNCTS CARD_CLAUSES in +ISPEC ` ITER (i' + 1) f (p0: real^2) ` b) THEN +COND_CASES_TAC THENL [STRIP_TAC THEN ASM_REWRITE_TAC[] +THEN DOWN THEN CONV_TAC ARITH_RULE; STRIP_TAC THEN +ASM_REWRITE_TAC[] THEN DOWN THEN ARITH_TAC THEN ASM_MESON_TAC[ +ARITH_RULE` i < CW - 1 /\ CW <= CS ==> ~( CS <= i + 1) ` +]]]; ASM_MESON_TAC[ +ARITH_RULE` i < CW - 1 /\ CW <= CS ==> ~( CS <= i + 1) `]]);; + + + + +let TRANS_SUC_IMP_INCREASE = prove(`! f. (! x y z. f x y /\ f y z ==> f x z ) /\ +(! i. f i ( i + 1 )) ==> +(! i j. i < j ==> f i j ) `, +GEN_TAC THEN STRIP_TAC THEN GEN_TAC THEN INDUCT_TAC +THENL [REWRITE_TAC[LT; ARITH_RULE` i < SUC j <=> i < j \/ j = i `]; +REWRITE_TAC[ARITH_RULE` i < SUC j <=> i < j \/ i = j `] THEN +ASM_MESON_TAC[ADD1]]);; + + + + +let MONOPOLY_IN_FIRST_PERIOD = prove( +` (!x. W x ==> ~(x = vec 0)) /\ + FINITE W /\ + W p0 /\ + f polar_cycle_on W /\ + (!x. W x ==> p0 polar_le x ) +==> (! i j. i < j /\ j < CARD W ==> +ITER i f p0 polar_lt ITER j f p0 ) `, +STRIP_TAC THEN GEN_TAC THEN INDUCT_TAC THENL [ +REWRITE_TAC[LT]; REWRITE_TAC[LT]] THEN STRIP_TAC THENL +[ASM_REWRITE_TAC[ITER] THEN +MATCH_MP_TAC POLAR_MONOPOLY_IN_FIRST_ITERVAL THEN +ASM_REWRITE_TAC[ARITH_RULE` a < b - 1 <=> a + 1 < b `; +GSYM ADD1]; +UNDISCH_TAC `i < j /\ j < CARD (W:real^2 -> bool) ==> +ITER i f p0 polar_lt ITER j f p0` THEN ANTS_TAC THENL [ +ASM_ARITH_TAC; DISCH_TAC]] THEN MP_TAC ( +CHANGE `j:num ` `i:num` POLAR_MONOPOLY_IN_FIRST_ITERVAL) +THEN ANTS_TAC THENL [ +ASM_REWRITE_TAC[ARITH_RULE` a < b - 1 <=> SUC a < b`]; +REWRITE_TAC[GSYM ITER]] THEN +SUBGOAL_THEN ` ~(ITER j f (p0: real^2) = vec 0 )` ASSUME_TAC +THENL [ASM SET_TAC[IN; POLAR_CYCLIC_FUN_IMP_ALL_BELONG]; +ASM_MESON_TAC[POLAR_LT_TRANS]]);; + + + +let FINITE_SEUBSET_OF_NATURAL = prove(`! n. FINITE { f i | i < (n:num) } `, +INDUCT_TAC THENL [REWRITE_TAC[LT; SET_RULE[]` { f i | i | F } = {} `; +FINITE_RULES]; +ASM_REWRITE_TAC[ARITH_RULE` i < SUC j <=> i < j \/ i = j `; +SET_RULE[]` {f i| P i \/ i = a } = f a INSERT {f i| P i }`; +FINITE_INSERT]]);; + + +let STRICTLY_INCREASE_PRESERVING_CARD = +prove(` ! lt f. (! (x:A) y. lt x y ==> ~( x = y )) /\ +(! i (j: num). i < j ==> lt (f i ) ( f j )) ==> +(! n. CARD ({ f i | i < n }) = n ) `, +REPEAT GEN_TAC THEN STRIP_TAC THEN INDUCT_TAC THENL [ +REWRITE_TAC[LT; SET_RULE[]` { f i | i | F } = {} `; +CARD_CLAUSES]; +ASM_SIMP_TAC[ARITH_RULE` i < SUC j <=> i < j \/ i = j `; +SET_RULE[]` {f i| P i \/ i = a } = f a INSERT {f i| P i }`; +CARD_CLAUSES; FINITE_SEUBSET_OF_NATURAL] THEN +SUBGOAL_THEN `~ ((f: num -> A) n IN {f i| i < n }) ` +( fun x -> SIMP_TAC[x]) THEN REWRITE_TAC[IN_ELIM_THM] THEN +ASM_MESON_TAC[]]);; + + + + + + + + + +let XXXXX = prove(`!lt (f: num -> A). + (!x y. lt x y ==> ~(x = y)) /\ + (!i j. i < j /\ j < N ==> lt (f i) (f j)) + ==> (!n. n < N ==> CARD {f i | i < n} = n)`, +REPEAT GEN_TAC THEN STRIP_TAC THEN INDUCT_TAC THENL [ +REWRITE_TAC[LT; EMPTY_GSPEC; SET_RULE[]` { f i| i | F } += {} `; CARD_CLAUSES]; REWRITE_TAC[ARITH_RULE` i < SUC v <=> i < v \/ i = v `]] +THEN DISCH_TAC THEN REWRITE_TAC[ +SET_RULE[]`{(f:num -> A) i| i < n \/ i = n } = +f n INSERT {f i | i < n } `] THEN +SIMP_TAC[FINITE_SEUBSET_OF_NATURAL; CARD_CLAUSES] THEN +SUBGOAL_THEN ` ~((f:num -> A) n IN { f i | i < n }) ` +ASSUME_TAC THENL [REWRITE_TAC[IN_ELIM_THM] THEN +ASM_MESON_TAC[ARITH_RULE` SUC v < g ==> v < g `]; +ASM_REWRITE_TAC[] THEN +ASM_MESON_TAC[ARITH_RULE` SUC x < y ==> x < y `]]);; + + + + +let TDHUFHCYVHYBCC = prove(` (!x. W x ==> ~(x = vec 0)) /\ + FINITE W /\ + W p0 /\ + f polar_cycle_on W /\ + (!x. W x ==> p0 polar_le x) +==> (! n. n < CARD W ==> +CARD { y | ? i. i < n /\ y = ITER i f p0 } = n ) `, +STRIP_TAC THEN +REWRITE_TAC[SET_RULE[]` {y | ? i. i < n /\ y = ITER i f p0 +} = {ITER i f p0 | i < n } `] THEN +MATCH_MP_TAC (BETA_RULE (ISPECL [`CARD (W: real^2 -> bool) ` +;`\x y. W x /\ W y /\ x polar_lt y `; `\i. ITER i f (p0:real^2) `] +(GEN_ALL XXXXX))) THEN +CONJ_TAC THENL [ +ASM_MESON_TAC[POLAR_LT_IMP_NOT_EQ]; REPEAT STRIP_TAC] +THENL [ + +ASM_REWRITE_TAC[SET_RULE[]` A ( p x ) <=> p x IN A `] THEN +ASM_MESON_TAC [POLAR_CYCLIC_FUN_IMP_ALL_BELONG]; + +ASM_REWRITE_TAC[SET_RULE[]` A ( p x ) <=> p x IN A `] THEN +ASM_MESON_TAC [POLAR_CYCLIC_FUN_IMP_ALL_BELONG]; + +MP_TAC MONOPOLY_IN_FIRST_PERIOD THEN +ANTS_TAC THENL [ASM_REWRITE_TAC[]; ASM_MESON_TAC[]]]);; + + + +let POLAR_CYCLIC_FUN_IMP_ALL_BELONG = +REWRITE_RULE[IN] POLAR_CYCLIC_FUN_IMP_ALL_BELONG;; + +let CARD_W_AS_ALL_LESS_THAN_PERIODIC = prove( +` (!x. W x ==> ~(x = vec 0)) /\ + FINITE W /\ + W p0 /\ + f polar_cycle_on W /\ + (!x. W x ==> p0 polar_le x) +==> (! n. n = CARD W ==> CARD { y | ? i. i < n /\ y = ITER i f p0 } = n ) `, +SIMP_TAC[] THEN ASM_CASES_TAC ` CARD (W:real^2 -> bool) = 0 ` +THENL [ASM_REWRITE_TAC[LT; EMPTY_GSPEC; CARD_CLAUSES]; +ASM_SIMP_TAC[ARITH_RULE` ~( a = 0 ) ==> ( b < a <=> b < +a - 1 \/ b = a - 1 )`] THEN REPEAT STRIP_TAC THEN +REWRITE_TAC[SET_RULE[]` {y | ?i. (P i \/ i = a ) /\ y = Q i} += Q a INSERT {y | ? i. P i /\ y = Q i }`]] THEN +SUBGOAL_THEN `FINITE {y | ?i. i < CARD (W:real^2 -> bool) + - 1 /\ y = ITER i f (p0:real^2)} ` ASSUME_TAC THENL [ +REWRITE_TAC[SET_RULE[]` {y | ?i . P i /\ y = Q i } = +{ Q i | P i } `] THEN +REWRITE_TAC[FINITE_SEUBSET_OF_NATURAL]; +ASM_SIMP_TAC[CARD_CLAUSES] THEN COND_CASES_TAC THENL [ +DOWN THEN REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC THEN +DOWN_TAC THEN +NHANH (ARITH_RULE `~( CARD W = 0 ) ==> CARD (W:real^2 -> bool) - 1 +< CARD W `) THEN STRIP_TAC THEN +SUBGOAL_THEN` ITER i f (p0:real^2) polar_lt ITER (CARD (W: +real^2 -> bool) - 1 ) f p0 ` ASSUME_TAC THENL [ +ASM_MESON_TAC [MONOPOLY_IN_FIRST_PERIOD]; +ASM_MESON_TAC[POLAR_LT_IMP_NOT_EQ; + MONOPOLY_IN_FIRST_PERIOD; +POLAR_CYCLIC_FUN_IMP_ALL_BELONG]]; DOWN_TAC] THEN +NHANH (ARITH_RULE` ~(x = 0 ) ==> x - 1 < x `) THEN +STRIP_TAC THEN MP_TAC TDHUFHCYVHYBCC THEN +ANTS_TAC THENL [ASM_REWRITE_TAC[]; +DISCH_THEN (MP_TAC o (SPEC ` CARD (W:real^2 -> bool) +- 1 `)) THEN +ANTS_TAC THENL [ASM_REWRITE_TAC[]; SIMP_TAC[] THEN +DISCH_TAC THEN UNDISCH_TAC `~( CARD (W:real^2 -> bool ) = 0)` +THEN ARITH_TAC]]]);; + + + +let AUTOMAP_IMP_ALL_ITER_IN = +prove(`W (p: A) /\ (! x. W x ==> f x IN W ) +==> (! N. ITER N f p IN W ) `, +STRIP_TAC THEN INDUCT_TAC THENL [ +ASM_REWRITE_TAC[ITER; IN]; +REWRITE_TAC[ITER] THEN ASM SET_TAC[]]);; + + + +let AUTOMAP_IMP_ITER_SET_IS_A_SUBSET = +prove(`W p /\ (! x. W x ==> f x IN W ) ==> +{y | ?n. y = ITER n f p } SUBSET W `, +STRIP_TAC THEN REWRITE_TAC[SUBSET; IN_ELIM_THM] THEN +ASM_MESON_TAC[AUTOMAP_IMP_ALL_ITER_IN]);; + + + + + +let TOW_NON_VEC0_POLAR_LE_IMP_NOT_LT = +prove(`~( x = vec 0 ) /\ ~( y = vec 0 ) /\ x polar_le y ==> +~( y polar_lt x ) `, REWRITE_TAC[polar_le] THEN +MESON_TAC[TOW_NON_VEC0_IMP_NOT_REFL_POLAR_LT; +NOT_EQ_IMP_TOTAL_ORDER; +NO_V0_IMP_NOT_SELF_POLLAR]);; + + +let CARD_W_IS_THE_PERIODIC = prove(` (!x. W x ==> ~(x = vec 0)) /\ + FINITE W /\ + W p0 /\ + f polar_cycle_on W /\ + (!x. W x ==> p0 polar_le x) +==> ITER (CARD W) f p0 = p0 `, +STRIP_TAC THEN MP_TAC CARD_W_AS_ALL_LESS_THAN_PERIODIC +THEN ANTS_TAC THENL [ASM_SIMP_TAC[]; +DISCH_THEN (MP_TAC o SPEC `CARD (W:real^2 -> bool)`)] THEN +REWRITE_TAC[] THEN + + +REWRITE_TAC[SET_RULE[]`{y | ?i. i < CARD W /\ y = ITER i f p0} = +{ITER i f p0 | i < CARD W }`] THEN SUBGOAL_THEN ` FINITE {ITER i f (p0:real^2) | +i < CARD (W:real^2 -> bool)}` ASSUME_TAC THENL [ +REWRITE_TAC[FINITE_SEUBSET_OF_NATURAL]; +ABBREV_TAC ` WW = {ITER i f (p0:real^2) | i < +CARD (W:real^2 -> bool ) }`] THEN +SUBGOAL_THEN ` WW SUBSET (W:real^2 -> bool) ` ASSUME_TAC +THENL [EXPAND_TAC "WW" THEN REWRITE_TAC[SUBSET; IN_ELIM_THM; IN] +THEN ASM_MESON_TAC[POLAR_CYCLIC_FUN_IMP_ALL_BELONG]; +DISCH_TAC] THEN SUBGOAL_THEN `WW = (W:real^2 -> bool) ` ASSUME_TAC THENL +[ASM_MESON_TAC[CARD_SUBSET_EQ]; ALL_TAC] THEN +SUBGOAL_THEN `! (x:real^2). W x ==> x polar_le ITER (CARD +W - 1 ) f p0 ` ASSUME_TAC THENL [ + + +EXPAND_TAC "W" THEN EXPAND_TAC "WW" THEN +REWRITE_TAC[IN_ELIM_THM] THEN +ASSUME_TAC2 (ISPEC` W: real^2 -> bool` CARD_EQ_0) THEN +ASM_CASES_TAC ` ~((W:real^2 -> bool) = {})` THENL [ + + + +FIRST_X_ASSUM (SUBST_ALL_TAC o SYM) THEN GEN_TAC THEN +ASM_REWRITE_TAC[] THEN DOWN THEN +SIMP_TAC[ARITH_RULE` ~( x = 0 ) ==> ( c < x <=> c < x - 1 +\/ c = x - 1) `] THEN PHA THEN STRIP_TAC THENL [ + + +ASM_REWRITE_TAC[] THEN +ASSUME_TAC2 (ARITH_RULE` ~(CARD W = 0) ==> +CARD (W:real^2 -> bool) - 1 < CARD W `) THEN +ASSUME_TAC2 MONOPOLY_IN_FIRST_PERIOD THEN +ASM_MESON_TAC[polar_le]; + + + +ASM_REWRITE_TAC[polar_le]]; + + + +DOWN THEN DOWN THEN MESON_TAC[LT]]; + + + + + + +ASSUME_TAC2 (ISPEC` W: real^2 -> bool` CARD_EQ_0) THEN +ASSUME_TAC2 (SET_RULE[]`W p0 ==> + ~((W:real^2 -> bool) = {})`) THEN +FIRST_X_ASSUM (SUBST_ALL_TAC o SYM) THEN DOWN THEN +SUBGOAL_THEN `W (ITER (CARD W - 1) f (p0:real^2))` ASSUME_TAC +THENL [ASM_MESON_TAC[POLAR_CYCLIC_FUN_IMP_ALL_BELONG]; +NHANH (ARITH_RULE` ~( a = 0 ) ==> a = a - 1 + 1 `)] THEN +STRIP_TAC THEN SUBGOAL_THEN `ITER (CARD (W:real^2 -> bool)) f (p0:real^2) += f (ITER ( CARD W - 1 ) f p0 )` ASSUME_TAC THENL [ +REWRITE_TAC[GSYM ITER; ADD1] THEN DOWN THEN MESON_TAC[]; +ALL_TAC]] THEN DOWN_TAC THEN REWRITE_TAC[polar_cycle_on] +THEN STRIP_TAC THEN +ABBREV_TAC ` AD = ITER (CARD (W:real^2 -> bool ) - 1) + f (p0:real^2)` THEN + + +SUBGOAL_THEN ` f (AD: real^2) polar_le AD ` ASSUME_TAC +THENL [FIRST_X_ASSUM MATCH_MP_TAC THEN ASM SET_TAC[]; + +SUBGOAL_THEN `~( AD polar_lt f AD ) ` ASSUME_TAC THENL [ +ASM SET_TAC[TOW_NON_VEC0_POLAR_LE_IMP_NOT_LT]; +DOWN_TAC THEN REWRITE_TAC[IN] THEN STRIP_TAC]] THEN +UNDISCH_TAC `(W:real^2 -> bool) (AD:real^2 )` THEN +USE_FIRST ` !x. W (x:real^2 ) + ==> x polar_lt f x /\ + (!y. W y ==> ~(x polar_lt y /\ y polar_lt f x)) \/ + (!y. W y ==> f x polar_le y /\ y polar_le x)` +NHANH THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN +UNDISCH_TAC `(W:real^2 -> bool) p0 ` THEN +FIRST_X_ASSUM NHANH THEN ASM_MESON_TAC[POLAR_LE_REFL_EQ]);; + + + + + + +let ITER_CARD_W_IDENTIFICATION = prove(` +(!x. W x ==> ~(x = vec 0)) /\ + FINITE W /\ + W p0 /\ + f polar_cycle_on W /\ + (!x. W x ==> p0 polar_le x) +==> (! x. W x ==> ITER (CARD W) f x = x) `, +STRIP_TAC THEN STRIP_TAC THEN FIRST_ASSUM NHANH THEN +REWRITE_TAC[polar_le] THEN STRIP_TAC THENL [ +MP_TAC (CHANGE `x:real^2 ` `p:real^2 ` (SPEC_ALL +EXISTS_STEPS_FOR_FOLLOWING_POINTS)) THEN +ANTS_TAC THENL [ASM_REWRITE_TAC[]; STRIP_TAC] THEN +EXPAND_TAC "x" THEN REWRITE_TAC[ITER_ADD] THEN +ONCE_REWRITE_TAC[ADD_SYM] THEN REWRITE_TAC[GSYM ITER_ADD] +THEN MATCH_MP_TAC (MESON[]` a = b ==> P a = P b `) THEN +MATCH_MP_TAC CARD_W_IS_THE_PERIODIC THEN ASM_REWRITE_TAC[]; +EXPAND_TAC "x" THEN MATCH_MP_TAC +CARD_W_IS_THE_PERIODIC THEN ASM_REWRITE_TAC[]]);; + + + + +let EXISTS_STEPS_FOR_FOLLOWING_POINTS = +prove(` (!x. W x ==> ~(x = vec 0)) /\ + FINITE W /\ + W p0 /\ + f polar_cycle_on W /\ + p0 polar_le p /\ + W p + ==> (?n. ITER n f p0 = p /\ + (!nn. nn < n ==> ITER nn f p0 polar_lt p))`, +REWRITE_TAC[polar_le] THEN STRIP_TAC THENL [ +MP_TAC (SPEC_ALL EXISTS_STEPS_FOR_FOLLOWING_POINTS) THEN +ANTS_TAC THENL [ASM_REWRITE_TAC[]; REWRITE_TAC[]]; +EXISTS_TAC `0` THEN EXPAND_TAC "p" THEN REWRITE_TAC[ITER; LT]]);; + + + + + + +let EXISTS_STEPS_FOR_FOLLOWING_POINTS = +prove(` (!x. W x ==> ~(x = vec 0)) /\ + FINITE W /\ + W p0 /\ + f polar_cycle_on W /\ + p0 polar_le p /\ + W p + ==> (?n. n < CARD W /\ + ITER n f p0 = p /\ + (!nn. nn < n ==> ITER nn f p0 polar_lt p))`, +NHANH EXISTS_STEPS_FOR_FOLLOWING_POINTS THEN +STRIP_TAC THEN ASM_CASES_TAC ` n < CARD (W:real^2 -> bool) ` THENL +[EXISTS_TAC `n: num ` THEN ASM_REWRITE_TAC[]; +UNDISCH_TAC `(W:real^2 -> bool) p ` THEN +NHANH_PAT `\x. x ==> s ` (SET_RULE[]` S c ==> ~( S = {})`) THEN +ASSUME_TAC2 (ISPEC `W:real^2 -> bool ` CARD_EQ_0) THEN +FIRST_X_ASSUM (SUBST1_TAC o SYM) THEN DOWN THEN +NHANH (ARITH_RULE` ~( a < (b:num)) ==> a = a - b + b `) THEN +STRIP_TAC THEN STRIP_TAC THEN +ASSUME_TAC2 (ARITH_RULE` ~( n < CARD (W:real^2 -> bool)) + ==> ~( CARD W = 0 ) ==> n - CARD W < n `) THEN +DOWN THEN FIRST_X_ASSUM NHANH THEN +SUBGOAL_THEN `ITER (n - CARD (W: real^2 -> bool)) f p0 += ITER ( n - CARD W + CARD W ) f (p0:real^2) ` ASSUME_TAC] +THENL [ REWRITE_TAC[GSYM ITER_ADD] THEN MP_TAC +(SPEC_ALL PROVE_MIN_ELEMENT_IN_FINITE_CYCLIC_SET) THEN +ANTS_TAC THENL [ +ASSUME_TAC2 (SET_RULE[]` (W:real^2 -> bool) p ==> +~( W = {} ) `) THEN ASM_REWRITE_TAC[]; +STRIP_TAC] THEN MP_TAC (CHANGE `n': real^2 ` `p0:real^2 ` +ITER_CARD_W_IDENTIFICATION) THEN +ANTS_TAC THENL [ASM_REWRITE_TAC[polar_le]; DISCH_TAC] THEN +UNDISCH_TAC ` (W:real^2 -> bool) p0 ` THEN +FIRST_X_ASSUM NHANH THEN SIMP_TAC[]; +DOWN THEN FIRST_X_ASSUM (SUBST1_TAC o SYM) THEN +ASM_MESON_TAC[POLAR_CYCLIC_FUN_IMP_ALL_BELONG; +NO_V0_IMP_NOT_SELF_POLLAR]]);; + + + + +let MONO_LE_IN_FIRST_PERIOD = prove( +`(!x. W x ==> ~(x = vec 0)) /\ + FINITE W /\ + W p0 /\ + f polar_cycle_on W /\ + (!x. W x ==> p0 polar_le x) + ==> (!i j. i <= j /\ j < CARD W +==> ITER i f p0 polar_le ITER j f p0) `, +REWRITE_TAC[LE_LT; polar_le] THEN REPEAT STRIP_TAC THENL +[DISJ1_TAC THEN DOWN_TAC THEN REWRITE_TAC[GSYM polar_le] +THEN MESON_TAC[MONOPOLY_IN_FIRST_PERIOD; polar_le]; +DISJ2_TAC THEN ASM_REWRITE_TAC[]]);; + + + + + + +let POLAR_LE_NOT_VEC0_IMP_PL_ANG_LE = +prove(` x polar_le y /\ ~( x = vec 0 ) /\ +~( y = vec 0 ) ==> pl_angle x <= pl_angle y `, +NHANH PL_ANGLE_PROPERTY THEN REWRITE_TAC[polar_le] THEN +STRIP_TAC THENL [UNDISCH_TAC ` x polar_lt y ` THEN +REWRITE_TAC[polar_lt; REAL_LE_LT] THEN +ASM_MESON_TAC[]; ASM_REWRITE_TAC[REAL_LE_REFL]]);; + + + + +let TWO_NOT_EQ_VECS_SUM_ARG_DIFF_TWO_PI = prove( + ` ~( x = vec 0 ) /\ ~ (y = vec 0 ) /\ ~( x = y )==> +arg_diff x y + arg_diff y x = &2 * pi `, +NHANH_PAT `\x. a /\ b /\ x ==> kk ` NOT_EQ_IMP_TOTAL_ORDER THEN +NGOAC THEN REWRITE_TAC[arg_diff; polar_le] +THEN (let ttc = ASM_REWRITE_TAC[] THEN +ASSUME_TAC2 TOW_NON_VEC0_IMP_NOT_REFL_POLAR_LT THEN DOWN +THEN ASM_SIMP_TAC[DE_MORGAN_THM] THEN DISCH_TAC THEN +CONV_TAC (DEPTH_CONV let_CONV) THEN REAL_ARITH_TAC in +STRIP_TAC THENL [ttc ;ttc]));; + + + +let ARG_DIFF_SUCCESSIBLE_IN_FIRST_PERIOD = +prove(`!(W: real^2 -> bool ) xicm. FINITE W /\ + CARD W = n /\ + (!x. W x ==> ~(x = vec 0)) /\ + xicm polar_cycle_on W + ==> (!p i j. + W p /\ 0 <= i /\ i <= j /\ j < n + ==> arg_diff p (ITER i xicm p) + + arg_diff (ITER i xicm p) (ITER j xicm p) = + arg_diff p (ITER j xicm p))`, +REPEAT STRIP_TAC THEN +MP_TAC (SPEC_ALL PROVE_MIN_ELEMENT_IN_FINITE_CYCLIC_SET) THEN +ANTS_TAC THENL [ +ASM_MESON_TAC[SET_RULE[]` A x ==> ~( A = {} ) `]; +STRIP_TAC] THEN UNDISCH_TAC ` (W:real^2 -> bool) p ` THEN +FIRST_ASSUM NHANH THEN REWRITE_TAC[GSYM polar_le] THEN STRIP_TAC +THEN MP_TAC (CHANGE `n': real^2 ` `p0: real^2 ` +(CHANGE `xicm: real^2 -> real^2 ` `f:real^2 -> real^2 ` +(SPEC_ALL EXISTS_STEPS_FOR_FOLLOWING_POINTS))) THEN ANTS_TAC +THENL [ASM_REWRITE_TAC[]; STRIP_TAC] THEN +ASM_CASES_TAC ` j + n'' < CARD (W:real^2 -> bool) ` +THENL [ + +UNDISCH_TAC ` i <= (j:num) ` THEN +NHANH (ARITH_RULE` (i:num) <= j ==> i + n'' <= j + n'' `) THEN +MP_TAC (CHANGE `xicm: real^2 -> real^2 ` `f:real^2 -> real^2 ` +(CHANGE `n': real^2 ` `p0: real^2 ` MONO_LE_IN_FIRST_PERIOD)) THEN +ANTS_TAC THENL [ASM_REWRITE_TAC[polar_le]; +STRIP_TAC THEN STRIP_TAC] THEN +UNDISCH_TAC` j + n'' < CARD (W:real^2 -> bool) ` THEN +DOWN THEN +PHA THEN +FIRST_ASSUM NHANH THEN +NHANH (ARITH_RULE` a <= b /\ b < c ==> a < (c:num) `) THEN +STRIP_TAC THEN +UNDISCH_TAC ` j + n'' < CARD (W:real^2 -> bool) ` THEN +MP_TAC (ARITH_RULE` n'' <= j + (n'':num) `) THEN +PHA THEN FIRST_ASSUM NHANH THEN +STRIP_TAC THEN +UNDISCH_TAC ` i + n'' < CARD (W:real^2 -> bool) ` THEN +MP_TAC (ARITH_RULE` n'' <= i + (n'':num) `) THEN +PHA THEN FIRST_ASSUM NHANH THEN +DOWN_TAC THEN +REWRITE_TAC[GSYM ITER_ADD] THEN +STRIP_TAC THEN +FIRST_X_ASSUM SUBST_ALL_TAC THEN +SUBGOAL_THEN ` pl_angle p <= pl_angle (ITER i xicm p) /\ +pl_angle p <= pl_angle (ITER j xicm p ) /\ +pl_angle (ITER i xicm p) <= pl_angle (ITER j xicm p) ` +ASSUME_TAC THENL [ASM_MESON_TAC[POLAR_CYCLIC_FUN_IMP_ALL_BELONG; +POLAR_LE_NOT_VEC0_IMP_PL_ANG_LE]; REWRITE_TAC[arg_diff] THEN +ASM_SIMP_TAC[] THEN CONV_TAC (DEPTH_CONV let_CONV) THEN +ARITH_TAC]; + + + + + +ASM_CASES_TAC` i + n'' < CARD (W:real^2 -> bool) `] THENL [ +ASSUME_TAC2 (ARITH_RULE` ~( j + n'' < CARD (W: real^2 -> bool)) +/\ j < n ==> CARD W = n ==> (j + n'') - CARD W < n''`) THEN +EXPAND_TAC "p" THEN +REWRITE_TAC[ITER_ADD] THEN +DOWN_TAC THEN +NHANH (ARITH_RULE` ~ (a < b ) ==> a - b + b = (a:num)`) THEN +ABBREV_TAC ` aa = j + (n'': num) ` THEN +STRIP_TAC THEN +EXPAND_TAC "aa" THEN +REWRITE_TAC[GSYM ITER_ADD] THEN +SUBGOAL_THEN `! x. W x ==> ITER (CARD (W:real^2 -> bool)) xicm x = x ` ASSUME_TAC +THENL [ +MATCH_MP_TAC (CHANGE `n':real^2` `p0:real^2 ` ITER_CARD_W_IDENTIFICATION) THEN +ASM_REWRITE_TAC[polar_le]; + + +UNDISCH_TAC ` (W:real^2 -> bool) n' `] THEN +FIRST_ASSUM NHANH THEN +SIMP_TAC[] THEN +REWRITE_TAC[ITER_ADD] THEN +STRIP_TAC THEN +ASSUME_TAC2 (ARITH_RULE` i <= j /\ j < n /\ CARD (W:real^2 +-> bool) = n ==> i < CARD W `) THEN +ASSUME_TAC (ARITH_RULE` n'' <= i + (n'':num) `) THEN +ASSUME_TAC2 (ARITH_RULE` aa - CARD (W:real^2 -> bool) < +n'' ==> aa - CARD W < i + n'' `) THEN + +(* +POLAR_LE_NOT_VEC0_IMP_PL_ANG_LE;; + + |- x polar_le y /\ ~(x = vec 0) /\ ~(y = vec 0) + ==> pl_angle x <= pl_angle y + + +POLAR_CYCLIC_FUN_IMP_ALL_BELONG;; + + it : thm = |- W p /\ f polar_cycle_on W ==> (!n. W (ITER n f p)) + + +MONO_LE_IN_FIRST_PERIOD;; + +*) +SUBGOAL_THEN` (ITER ( aa - CARD (W:real^2 -> bool)) xicm +(n':real^2) ) polar_lt (ITER n'' xicm n')/\ +ITER ( aa - CARD W ) xicm n' polar_lt ITER (i + n'') xicm n' + ` ASSUME_TAC THENL [ +DOWN_TAC THEN REWRITE_TAC[IN; GSYM polar_le] THEN +ASM_MESON_TAC[MONOPOLY_IN_FIRST_PERIOD]; ALL_TAC] THEN + + + + + +SUBGOAL_THEN ` ITER n'' xicm n' polar_le ITER (i + n'') +xicm n'` ASSUME_TAC THENL +[DOWN_TAC THEN REWRITE_TAC[GSYM polar_le] THEN +ASM_MESON_TAC[MONO_LE_IN_FIRST_PERIOD]; ALL_TAC] THEN + + + + + +SUBGOAL_THEN ` ~(ITER (aa - CARD (W:real^2 -> bool)) xicm +(n':real^2) = vec 0 ) /\ +~( ITER n'' xicm n' = vec 0 ) /\ +~( ITER (i + n'') xicm n' = vec 0 )` ASSUME_TAC THENL [ +ASM_MESON_TAC[POLAR_CYCLIC_FUN_IMP_ALL_BELONG]; ALL_TAC] THEN + +SUBGOAL_THEN ` ~(ITER n'' xicm n' polar_le ITER (aa - CARD (W:real^2 -> bool)) xicm n') /\ +~( ITER (i + n'') xicm n' polar_le ITER ( aa - CARD W) xicm n')` +ASSUME_TAC THENL [ASM_MESON_TAC[ +TOW_NON_VEC0_POLAR_LE_IMP_NOT_LT]; ALL_TAC] THEN + +ASM_REWRITE_TAC[arg_diff] THEN CONV_TAC (DEPTH_CONV let_CONV) +THEN REAL_ARITH_TAC; ALL_TAC] THEN DOWN THEN DOWN THEN +NHANH (ARITH_RULE` ~( a < (b:num)) ==> a = a - b + b `) THEN + + +SUBGOAL_THEN `(! (x:real^2). W x ==> ITER (CARD W) xicm x += x) ` ASSUME_TAC THENL [ + +MATCH_MP_TAC (CHANGE `n':real^2 ` `p0: real^2 ` (REWRITE_RULE[polar_le] +ITER_CARD_W_IDENTIFICATION)) THEN ASM_REWRITE_TAC[]; + +ABBREV_TAC ` wi = (i + n'') - CARD (W:real^2 -> bool) `] THEN +ABBREV_TAC ` wj = (j + n'') - CARD (W:real^2 -> bool) ` THEN +EXPAND_TAC "p" THEN SIMP_TAC[ITER_ADD] THEN +REWRITE_TAC[GSYM ITER_ADD] THEN ASM_SIMP_TAC[] THEN +STRIP_TAC THEN STRIP_TAC THEN +SUBGOAL_THEN ` wi < (n'': num) /\ wj < n'' /\ wi <= wj +/\ wj < CARD (W:real^2 -> bool)` ASSUME_TAC THENL [ +ASM_ARITH_TAC; ALL_TAC] THEN + + +SUBGOAL_THEN ` (ITER wi xicm n') polar_le (ITER wj xicm n') +/\ ITER wi xicm n' polar_lt ITER n'' xicm n' /\ +ITER wj xicm n' polar_lt ITER n'' xicm n' ` ASSUME_TAC THENL [ +DOWN_TAC THEN REWRITE_TAC[GSYM polar_le] THEN +MESON_TAC [MONOPOLY_IN_FIRST_PERIOD; +MONO_LE_IN_FIRST_PERIOD]; ALL_TAC] THEN + +SUBGOAL_THEN ` ~( ITER wi xicm (n':real^2) = vec 0 ) /\ +~( ITER wj xicm n' = vec 0 ) /\ ~( ITER n'' xicm n' = vec 0) ` +ASSUME_TAC THENL [ +ASM_MESON_TAC[POLAR_CYCLIC_FUN_IMP_ALL_BELONG]; ALL_TAC] THEN + +SUBGOAL_THEN ` ~(ITER n'' xicm n' polar_le ITER wi xicm n') /\ + ~( ITER n'' xicm n' polar_le ITER wj xicm n')` ASSUME_TAC +THENL [DOWN THEN DOWN THEN MESON_TAC [ +TOW_NON_VEC0_POLAR_LE_IMP_NOT_LT]; ALL_TAC] THEN + + +EXPAND_TAC "p" THEN REWRITE_TAC[arg_diff] THEN +ASM_REWRITE_TAC[] THEN CONV_TAC (DEPTH_CONV let_CONV) THEN +REAL_ARITH_TAC);; + + + +let TWO_NON_ZERO_VECS_NOT_EQ_EQ_PLT = +prove(` ~(x = vec 0) /\ ~(y = vec 0) ==> +( ~(x = y) <=> x polar_lt y \/ y polar_lt x ) `, +MESON_TAC[POLAR_LT_IMP_NOT_EQ;NOT_EQ_IMP_TOTAL_ORDER]);; + + + +let SUM_OVER_W_EQUAL_AT_ANY_POINT = +prove(` FINITE W /\ + CARD W = n /\ + (!x. W x ==> ~(x = vec 0)) /\ + xicm polar_cycle_on W /\ W p0 /\ +(! x. W x ==> p0 polar_le x ) +==> (! p. W p ==> +sum (0.. n - 1 ) (\i. arg_diff ( ITER i xicm p ) (ITER ( i + 1 ) +xicm p)) = +sum (0.. n - 1 ) (\i. arg_diff ( ITER i xicm p0 ) (ITER ( i + 1 ) +xicm p0))) `, +REPEAT STRIP_TAC THEN DOWN THEN FIRST_ASSUM NHANH THEN +STRIP_TAC THEN ASSUME_TAC2 ( +CHANGE `xicm: real^2 -> real^2 ` `f:real^2 -> real^2 ` +EXISTS_STEPS_FOR_FOLLOWING_POINTS) THEN DOWN THEN STRIP_TAC +THEN ASM_CASES_TAC ` n' = 0 ` THENL [ +FIRST_X_ASSUM SUBST_ALL_TAC THEN EXPAND_TAC "p" THEN +REWRITE_TAC[ITER_ADD; ADD_CLAUSES]; EXPAND_TAC "p"] THEN +REWRITE_TAC[ITER_ADD; ARITH_RULE` (i + 1) + n' = +(i + n' ) + 1 `] THEN ABBREV_TAC ` ff i = +arg_diff (ITER i xicm (p0:real^2)) (ITER (i + 1) xicm p0) ` + THEN REWRITE_TAC[GSYM SUM_OFFSET] THEN +ASSUME_TAC2 (ARITH_RULE` CARD (W:real^2 -> bool) = n /\ +n' < CARD W ==> n' <= n - 1 + 1 `) THEN +ASM_SIMP_TAC[ADD; SUM_ADD_SPLIT] THEN +ASSUME_TAC2 (ISPEC `W:real^2 -> bool ` CARD_EQ_0) THEN (* 000 *) +ASSUME_TAC2 (SET_RULE[]` (W:real^2 -> bool) p ==> +~( W = {} ) `) THEN FIRST_X_ASSUM (SUBST_ALL_TAC o SYM) THEN +EXPAND_TAC "n" THEN DOWN THEN UNDISCH_TAC ` ~( n' = 0)` THEN +PHA THEN NHANH (ARITH_RULE` ~(a = 0) /\ ~( b = 0 ) ==> +b - 1 + 1 = 0 + b /\ b - 1 + a = a - 1 + b `) THEN +SIMP_TAC[] THEN STRIP_TAC THEN +REWRITE_TAC[SUM_OFFSET] THEN +SUBGOAL_THEN `! i. (ff: num -> real) (i + CARD (W:real^2 +-> bool)) = ff i ` ASSUME_TAC THENL [ +DOWN_TAC THEN ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +SIMP_TAC[] THEN STRIP_TAC THEN +REWRITE_TAC[ARITH_RULE` (a + b ) + 1 = (a + 1 ) + b `] THEN +REWRITE_TAC[GSYM ITER_ADD] THEN +MP_TAC (CHANGE ` xicm: real^2 -> real^2 ` `f: real^2 -> real^2 ` +ITER_CARD_W_IDENTIFICATION) THEN +ANTS_TAC THENL [ASM_SIMP_TAC[]; DISCH_TAC] THEN +UNDISCH_TAC `(W:real^2 -> bool) p0 ` THEN +FIRST_X_ASSUM NHANH THEN SIMP_TAC[]; +ASM_REWRITE_TAC[] THEN ONCE_REWRITE_TAC[REAL_ADD_SYM] THEN +MP_TAC (ISPECL[`ff: num -> real `;`0`;`n': num`;` n - 1 `] +SUM_COMBINE_L) THEN +ANTS_TAC THENL [ASM_ARITH_TAC; SIMP_TAC[ETA_AX]]]);; + + +let SUM_INCREASE_ARG_DIFF = prove( + ` !(W: real^2 -> bool ) xicm. FINITE W /\ + CARD W = n /\ + (!x. W x ==> ~(x = vec 0)) /\ + xicm polar_cycle_on W + ==> (!p i j. + W p /\ 0 <= i /\ i < j /\ j < n + ==> sum (i .. (j - 1 )) (\i. arg_diff (ITER i xicm p) (ITER (i + 1) xicm p) ) + = arg_diff (ITER i xicm p) (ITER j xicm p)) `, +REPEAT GEN_TAC THEN STRIP_TAC THEN GEN_TAC THEN GEN_TAC THEN +INDUCT_TAC THENL [REWRITE_TAC[LT]; REWRITE_TAC[LT]] THEN STRIP_TAC +THENL [ASM_REWRITE_TAC[SUC_SUB1; SUM_SING_NUMSEG; ADD1]; +DOWN THEN NHANH (ARITH_RULE` SUC c < k ==> c < k `)] THEN +STRIP_TAC THEN UNDISCH_TAC` j < (n:num) ` THEN +UNDISCH_TAC` i < (j:num)` THEN +UNDISCH_TAC` 0 <= i ` THEN +UNDISCH_TAC`(W:real^2 -> bool) p ` THEN +PHA THEN +FIRST_ASSUM NHANH THEN +NHANH (ARITH_RULE`0 <= i /\ i < j /\ j < n ==> +SUC j - 1 = (j - 1) + 1 `) THEN +SIMP_TAC[] THEN +NHANH (ARITH_RULE` i < j ==> i <= j - 1 + 1`) THEN +SIMP_TAC[SUM_ADD_SPLIT] THEN +NHANH (ARITH_RULE` i < j ==> j - 1 + 1 = j `) THEN +STRIP_TAC THEN +ASM_REWRITE_TAC[SUM_SING_NUMSEG; ADD1] THEN +MP_TAC (SPEC_ALL ARG_DIFF_SUCCESSIBLE_IN_FIRST_PERIOD) THEN +ANTS_TAC THENL [ASM_REWRITE_TAC[]; ALL_TAC] THEN +DISCH_THEN (MP_TAC o (SPECL [`ITER i xicm (p:real^2)`; ` j - (i: num) `; +` j - i + 1 `])) THEN ANTS_TAC THENL [ +CONJ_TAC THENL [ASM_MESON_TAC[POLAR_CYCLIC_FUN_IMP_ALL_BELONG]; +ASM_ARITH_TAC]; REWRITE_TAC[ITER_ADD]] THEN +ASSUME_TAC2 (ARITH_RULE` (i:num) < j ==> j - i + i = j `) THEN +ASSUME_TAC2 (ARITH_RULE` i < j ==> (j - i + 1) + i = j + 1 `) THEN +DOWN THEN DOWN THEN SIMP_TAC[]);; + + + + +let LEMMA_SUM_ALL_OVER_CYCLIC_SET = prove(`!(W: real^2 -> bool ) xicm. FINITE W /\ + CARD W = n /\ + (!x. W x ==> ~(x = vec 0)) /\ + xicm polar_cycle_on W /\ W p + ==> ((?p q. W p /\ W q /\ ~(p = q)) + ==> sum (0..n - 1) + (\i. arg_diff (ITER i xicm p) (ITER (i + 1) xicm p)) = + &2 * pi)`, +REPEAT GEN_TAC THEN STRIP_TAC THEN +FIRST_ASSUM NHANH THEN +STRIP_TAC THEN +DOWN THEN +ASM_SIMP_TAC[TWO_NON_ZERO_VECS_NOT_EQ_EQ_PLT] THEN +REPLICATE_TAC 4 DOWN THEN +PHA THEN + + + + +SPEC_TAC (`q:real^2`, `q:real^2 `) THEN +SPEC_TAC (`p':real^2`, `p':real^2 `) THEN +REWRITE_TAC[MESON[]`(!x. P x ==> Q ) <=> (?x. P x ) ==> Q `; +MESON[]` (? x y. W x /\ ~( x = i ) /\ W y /\ +~( y = i ) /\ (x polar_lt y \/ y polar_lt x) ) <=> +(? x y. W x /\ ~( x = i )/\ W y /\ ~( y = i ) /\ x polar_lt y ) `] THEN +STRIP_TAC THEN +MP_TAC (SPEC_ALL PROVE_MIN_ELEMENT_IN_FINITE_CYCLIC_SET) THEN +ANTS_TAC THENL [ +ASM_MESON_TAC[SET_RULE[]` A s ==> ~(A = {})`]; + +STRIP_TAC] THEN + + + +MP_TAC (CHANGE `n':real^2 ` `p0:real^2 ` +SUM_OVER_W_EQUAL_AT_ANY_POINT) THEN ANTS_TAC THENL [ +ASM_REWRITE_TAC[polar_le]; DISCH_TAC] THEN + + +UNDISCH_TAC ` (W:real^2 -> bool) p ` THEN +FIRST_ASSUM NHANH THEN +SIMP_TAC[] THEN +STRIP_TAC THEN +ASM_CASES_TAC ` n' = (q:real^2) ` THENL [ + + +ASM_MESON_TAC[TOW_NON_VEC0_IMP_NOT_REFL_POLAR_LT; +POLAR_LT_IMP_NOT_EQ]; + +MP_TAC ( +CHANGE `q: real^2 ` `p:real^2 ` ( +CHANGE `xicm: real^2 -> real^2 ` `f: real^2 -> real^ 2 ` ( +CHANGE `n': real^2 ` `p0:real^2 ` EXISTS_STEPS_FOR_FOLLOWING_POINTS))) + ] THEN + +ANTS_TAC THENL [ +REWRITE_TAC[polar_le] THEN +ASM_MESON_TAC[]; STRIP_TAC] THEN + + +ASM_CASES_TAC `n'' = 0 ` THENL [ +REPLICATE_TAC 5 DOWN THEN PHA THEN +MESON_TAC[ITER]; + +ASSUME_TAC2 (ARITH_RULE`~( n'' = 0) ==> 0 <= n'' - 1 + 1 `)] + THEN + + + + +ASSUME_TAC2 (ARITH_RULE` CARD (W:real^2 -> bool) = n /\ +n'' < CARD W /\ ~(n'' = 0 ) ==> n'' - 1 <= n - 1 `) THEN +DOWN THEN DOWN THEN PHA THEN +NHANH ( + +SPEC `(\i. arg_diff (ITER i xicm n') +(ITER (i + 1) xicm n'))` (GSYM SUM_COMBINE_R)) THEN +SIMP_TAC[] THEN +STRIP_TAC THEN +MP_TAC (SPEC_ALL SUM_INCREASE_ARG_DIFF) THEN +ANTS_TAC THENL [ +ASM_REWRITE_TAC[]; +STRIP_TAC] THEN + + +UNDISCH_TAC `n'' < CARD (W:real^2 -> bool) ` THEN +UNDISCH_TAC `~( n'' = 0 ) ` THEN +REWRITE_TAC[ ARITH_RULE`~(a = 0) <=> 0 < a `] THEN +MP_TAC (ARITH_RULE` 0 <= 0 `) THEN +UNDISCH_TAC `(W:real^2 -> bool) n'` THEN +PHA THEN +ASM_REWRITE_TAC[] THEN +FIRST_ASSUM NHANH THEN +SIMP_TAC[] THEN +STRIP_TAC THEN +ASSUME_TAC2 ( +ARITH_RULE`0 < n'' /\ n'' < n ==> n - 1 = n - 1 - 1 + 1 `) THEN +FIRST_X_ASSUM (fun x -> ONCE_REWRITE_TAC[x]) THEN +ONCE_REWRITE_TAC[SUM_OFFSET] THEN + +REWRITE_TAC[BETA_THM; GSYM ITER_ADD] THEN +SUBGOAL_THEN ` (W:real^2 -> bool) (ITER 1 xicm (n':real^2)) ` MP_TAC +THENL [ +ASM_SIMP_TAC[POLAR_CYCLIC_FUN_IMP_ALL_BELONG]; +DISCH_TAC] THEN +ASSUME_TAC2 (ARITH_RULE` n'' < n ==> n - 1 < n `) THEN +DOWN THEN +ASSUME_TAC2 (ARITH_RULE`0 < n'' /\ n'' < n ==> +n'' - 1 < n - 1 `) THEN + + + + +UNDISCH_TAC `n'' - 1 < n - 1 ` THEN +ASSUME_TAC2 (ARITH_RULE` 0 < n'' ==> 0 <= n'' - 1 `) THEN +DOWN THEN +DOWN THEN +PHA THEN +FIRST_ASSUM NHANH THEN +SIMP_TAC[ITER_ADD] THEN +STRIP_TAC THEN +ASSUME_TAC2 (ARITH_RULE` 0 < n'' ==> n'' - 1 + 1 = n''`) THEN +ASSUME_TAC2 (ARITH_RULE` n'' < n ==> n - 1 + 1 = n `) THEN +ASM_REWRITE_TAC[ITER] THEN +UNDISCH_TAC` CARD (W:real^2 -> bool) = n ` THEN +DISCH_TAC THEN EXPAND_TAC "n" THEN +MP_TAC ( +CHANGE `xicm: real^2 -> real^2 ` `f:real^2 -> real^2 ` ( +CHANGE `n': real^2 ` `p0:real^2 `ITER_CARD_W_IDENTIFICATION) + ) THEN + + + +ANTS_TAC THENL [ +ASM_REWRITE_TAC[polar_le]; +DISCH_TAC] THEN + +UNDISCH_TAC` (W:real^2 -> bool) n' ` THEN +FIRST_ASSUM NHANH THEN +EXPAND_TAC "n" THEN +SIMP_TAC[] THEN +ASM_MESON_TAC[TWO_NOT_EQ_VECS_SUM_ARG_DIFF_TWO_PI]);; + + +parse_as_infix("re_eqvl",(12,"right"));; + +let re_eqvl = new_definition ` a re_eqvl (b:real) + <=> (? t. &0 < t /\ a = t * b )`;; + + +let VEC_DIV_MOV = prove( +` ~( a = &0 ) ==> (( b / a ) % x = y <=> +b % x = a % y ) `, +SIMP_TAC[MESON[VECTOR_MUL_LCANCEL]` ~( a = &0 ) ==> +(( b / a ) % x = y <=> a % ( b / a) % x = a % y ) `; +VECTOR_MUL_ASSOC; REAL_DIV_LMUL]);; + + + +(* ======================================================== *) +(* ----------------------------- *) +let JBDNJJB = prove( +`! u v w. sin ( azim ( vec 0 ) u v w ) re_eqvl (u cross v ) dot w `, + +REPEAT GEN_TAC THEN ASM_CASES_TAC `(u:real^3) = vec 0 ` THENL [ +ASM_SIMP_TAC[AZIM_DEGENERATE; CROSS_0; DOT_LZERO; +SIN_0; re_eqvl] THEN EXISTS_TAC `&1` THEN REAL_ARITH_TAC; + + +ASM_CASES_TAC` collinear {vec 0, u, (v:real^3)}`] + +THENL [ + + +FIRST_X_ASSUM MP_TAC THEN ASM_SIMP_TAC[GSYM CROSS_EQ_0] THEN +REWRITE_TAC[CROSS_EQ_0] THEN +ASM_SIMP_TAC[AZIM_DEGENERATE; CROSS_0; DOT_LZERO; +SIN_0; re_eqvl] THEN +DISCH_TAC THEN +EXISTS_TAC `&1 ` THEN +REAL_ARITH_TAC; + +ASM_CASES_TAC` collinear {vec 0, u, (w:real^3)}`] THENL [ + +FIRST_X_ASSUM MP_TAC THEN ASM_SIMP_TAC[GSYM CROSS_EQ_0] THEN +REWRITE_TAC[CROSS_EQ_0] THEN +ONCE_REWRITE_TAC[GSYM CROSS_TRIPLE] THEN +ONCE_REWRITE_TAC[SET_RULE[]` {a,b} = {b,a}`] THEN +ASM_SIMP_TAC[AZIM_DEGENERATE;GSYM CROSS_EQ_0] THEN +ASM_SIMP_TAC[CROSS_EQ_0] THEN +ASM_SIMP_TAC[AZIM_DEGENERATE; CROSS_0; DOT_LZERO; +SIN_0; re_eqvl; SET_RULE[]` {a,b} = {b,a}`] THEN +DISCH_TAC THEN +EXISTS_TAC `&1 ` THEN +REAL_ARITH_TAC; +ABBREV_TAC ` e3 = &1 / norm (u:real^3) % u ` THEN +ABBREV_TAC `v' = v - (e3 dot v) % (e3:real^3) ` THEN +ABBREV_TAC `(e1:real^3) = &1 / norm (v') % v' ` THEN +ABBREV_TAC ` e2 = e3 cross e1 ` THEN +SUBGOAL_THEN `orthonormal e1 e2 e3 ` ASSUME_TAC] + +THENL [ +REWRITE_TAC[orthonormal] THEN +EXPAND_TAC "e2" THEN +REWRITE_TAC[DOT_CROSS_SELF; DOT_CROSS] THEN +SUBGOAL_THEN `~((v':real^3) = vec 0)` ASSUME_TAC THENL [ + + +EXPAND_TAC "v'" THEN +EXPAND_TAC "e3" THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN +ASSUME_TAC2 (ISPECL [`u:real^3 `;` v:real^3 `] + NOT_EQ_VEC0_IMP_EQU_AFF_COLL) THEN +UNDISCH_TAC `~ collinear {vec 0, u, (v:real^3)}` THEN +FIRST_X_ASSUM MP_TAC THEN +ONCE_REWRITE_TAC[EQ_SYM_EQ] THEN +SIMP_TAC[] THEN +DISCH_TAC THEN +REWRITE_TAC[AFF2_VEC0; IN_ELIM_THM; VECTOR_ARITH` vec 0 = +x - y <=> x = y `] THEN +MESON_TAC[]; + + +SUBGOAL_THEN `e3 dot (e3:real^3) = &1 /\ e1 dot (e1:real^3) += &1 ` ASSUME_TAC] THENL [ + +EXPAND_TAC "e3" THEN +EXPAND_TAC "e1" THEN +REWRITE_TAC[DOT_LMUL; DOT_RMUL; GSYM NORM_POW_2] THEN +UNDISCH_TAC `~((u:real^3) = vec 0 ) ` THEN +UNDISCH_TAC `~((v':real^3) = vec 0) ` THEN +REWRITE_TAC[GSYM NORM_EQ_0] THEN +PHA THEN CONV_TAC REAL_FIELD; + + + +SUBGOAL_THEN `e1 dot (e3: real^3) = &0 ` ASSUME_TAC] THENL [ + + +EXPAND_TAC "e1" THEN +EXPAND_TAC "v'" THEN +REWRITE_TAC[DOT_LSUB; DOT_LMUL; REAL_MUL_RID] THEN +ASM_SIMP_TAC[REAL_MUL_RID; DOT_SYM; REAL_SUB_REFL; +REAL_MUL_RZERO]; + + + +ASM_SIMP_TAC[DOT_SYM] THEN +ONCE_REWRITE_TAC[DOT_SYM] THEN +ONCE_REWRITE_TAC[GSYM CROSS_TRIPLE] THEN +EXPAND_TAC "e2" THEN +REWRITE_TAC[DOT_CROSS] THEN +ASM_SIMP_TAC[DOT_SYM] THEN +REAL_ARITH_TAC]; + +MP_TAC (let ddd = (let dd = SPEC_ALL (SPECL [`v: real^3 `;` vec 0 : real^3 `;`u:real^3 `; +`w:real^3 `] SPHERICAL_COORDINATES) in SPEC `dist(vec 0, w:real^3 )` +(GEN `r:real` dd)) in +SPEC ` azim ( vec 0 ) u v w ` (GEN `theta: real` +(SPEC `arcV ( vec 0) w (u:real^3) ` (GEN `phi: real` ddd)))) THEN +ANTS_TAC] THENL [ + +(* one new goal *) +(* ============ *) + + +ASM_REWRITE_TAC[dist; VECTOR_SUB_RZERO] THEN +EXPAND_TAC "e3" THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN +UNDISCH_TAC `~((u:real^3) = vec 0 ) ` THEN +SIMP_TAC[GSYM NORM_EQ_0; REAL_FIELD` ~( x = &0) ==> +x * &1 / x = &1 `; VECTOR_MUL_LID] THEN +SUBGOAL_THEN `DISJOINT {vec 0, u} {v:real^3 }` ASSUME_TAC + + +THENL [ + + + +REWRITE_TAC[DISJOINT; SET_RULE[]` {a,b} INTER {c} = {} +<=> ~( c = a ) /\ ~( c = b ) `] THEN +(let drt = STRIP_TAC THEN +UNDISCH_TAC `~ collinear { vec 0, u, (v:real^3)} ` THEN +ASM_SIMP_TAC[INSERT_AC; COLLINEAR_2] in CONJ_TAC THENL [drt; +drt]); + + +FIRST_X_ASSUM MP_TAC THEN +NHANH AFF_GT_2_1 THEN +PHA THEN SIMP_TAC[] THEN +STRIP_TAC THEN +REWRITE_TAC[IN_ELIM_THM] THEN +EXPAND_TAC "e1" THEN +EXPAND_TAC "v'" THEN +SIMP_TAC[VECTOR_MUL_RZERO; VECTOR_ADD_LID; +VECTOR_SUB_LDISTRIB] THEN +SUBGOAL_THEN `~( v - (e3 dot v) % (e3:real^3) += vec 0) ` ASSUME_TAC] THENL [ + + + +EXPAND_TAC "e3" THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN +UNDISCH_TAC `~ collinear {vec 0, u, (v:real^3)}` THEN +FIRST_X_ASSUM MP_TAC THEN +REWRITE_TAC[NORM_EQ_0] THEN +PAT_ONCE_REWRITE_TAC `\x. x ==> _ ` [EQ_SYM_EQ] THEN +NHANH (GSYM (ISPECL [`u:real^3 `;` v:real^3 `] NOT_EQ_VEC0_IMP_EQU_AFF_COLL)) THEN +SIMP_TAC[] THEN DISCH_TAC THEN +REWRITE_TAC[AFF2_VEC0; IN_ELIM_THM; VECTOR_SUB_EQ] THEN +MESON_TAC[]; + + +ABBREV_TAC `r3 = e3 dot (v:real^3 ) ` THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN +ABBREV_TAC `e33 = r3 % (e3: real^3) ` THEN +EXPAND_TAC "e3" THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN +EXISTS_TAC ` &1 - &1 / norm ((v:real^3 ) - +e33) + (&1 / norm ((v:real^3) - e33) * r3) * &1 / norm (u:real^3) ` THEN +EXISTS_TAC `-- (&1 / norm ((v:real^3) - e33) * r3) * &1 / norm (u:real^3)` THEN +EXISTS_TAC `&1 / norm ((v:real^3) - e33)` THEN +CONJ_TAC THENL [ + + +MATCH_MP_TAC REAL_LT_DIV THEN +UNDISCH_TAC `~((v:real^3) - e33 = vec 0) ` THEN +REWRITE_TAC[GSYM NORM_POS_LT] THEN +SIMP_TAC[] THEN REAL_ARITH_TAC; +CONJ_TAC THENL [REAL_ARITH_TAC; +CONV_TAC VECTOR_ARITH]]]; + + +SUBGOAL_THEN `~( v - (e3 dot v) % (e3:real^3) += vec 0) ` ASSUME_TAC THENL [ + + +EXPAND_TAC "e3" THEN +REWRITE_TAC[VECTOR_MUL_ASSOC] THEN +UNDISCH_TAC `~ collinear {vec 0, u, (v:real^3)}` THEN +UNDISCH_TAC ` ~( (u:real^3) = vec 0) ` THEN +REWRITE_TAC[NORM_EQ_0] THEN +PAT_ONCE_REWRITE_TAC `\x. x ==> _ ` [EQ_SYM_EQ] THEN +NHANH (GSYM (ISPECL [`u:real^3 `;` v:real^3 `] NOT_EQ_VEC0_IMP_EQU_AFF_COLL)) THEN +SIMP_TAC[] THEN DISCH_TAC THEN +REWRITE_TAC[AFF2_VEC0; IN_ELIM_THM; VECTOR_SUB_EQ] THEN +MESON_TAC[]; + + + +SUBST_ALL_TAC (SYM (ISPEC `u:real^3 ` NORM_EQ_0))]] THEN + + + +ASSUME_TAC2 (ISPECL [`&1 `;` u: real^3 `; ` norm (u:real^3)` +; `e3: real^3`] (GEN_ALL VEC_DIV_MOV)) THEN +SUBST_ALL_TAC (ISPEC `u:real^3 ` VECTOR_MUL_LID) THEN +FIRST_X_ASSUM SUBST_ALL_TAC THEN +ABBREV_TAC ` azzz = azim (vec 0) u v w ` THEN +ABBREV_TAC `arrr = arcV (vec 0) w (u:real^3)` THEN +ABBREV_TAC ` diii = dist( vec 0, (w:real^3))` THEN + +SIMP_TAC[VECTOR_ADD_LID] THEN +DISCH_TAC THEN +ABBREV_TAC `no_u = norm (u:real^3)` THEN +ASM_REWRITE_TAC[] THEN +UNDISCH_TAC ` (v:real^3) - (e3 dot v ) %e3 += v' ` THEN +ABBREV_TAC ` era = e3 dot (v:real^3) ` THEN +REWRITE_TAC[VECTOR_ARITH` a - b = (x:real^N) <=> +a = x + b `] THEN +SIMP_TAC[CROSS_RADD; CROSS_RMUL; CROSS_LMUL; +CROSS_REFL; VECTOR_MUL_RZERO; VECTOR_ADD_RID] THEN +REWRITE_TAC[VECTOR_ARITH` a = b + (c:real^N) <=> +a - c = b `] THEN +DISCH_THEN SUBST_ALL_TAC THEN +UNDISCH_TAC ` &1 / norm v' % (v':real^3) = e1 ` THEN +UNDISCH_TAC `~((v':real^3) = vec 0 ) ` THEN +SIMP_TAC[GSYM NORM_EQ_0; VEC_DIV_MOV; VECTOR_MUL_LID] THEN +ABBREV_TAC `nov' = norm (v':real^3) ` THEN +SIMP_TAC[CROSS_RMUL] THEN +STRIP_TAC THEN +STRIP_TAC THEN +ASM_REWRITE_TAC[VECTOR_MUL_ASSOC; DOT_RADD; DOT_RMUL; +DOT_LMUL] THEN +UNDISCH_TAC `orthonormal e1 e2 e3 ` THEN +REWRITE_TAC[orthonormal] THEN +SIMP_TAC[DOT_SYM; REAL_MUL_RZERO; REAL_ADD_LID; REAL_ADD_RID] THEN +DISCH_TAC THEN +REWRITE_TAC[REAL_ARITH`(a * b * c ) * (d * e ) * &1 += (a * c * d * e ) * b `; re_eqvl] THEN +EXISTS_TAC ` &1 / ( diii * sin arrr * no_u * nov') ` THEN + +SUBGOAL_THEN ` &0 < diii * sin arrr * no_u * nov' ` +ASSUME_TAC THENL [ + + +MATCH_MP_TAC ( +MESON[REAL_LT_MUL]` &0 < a /\ &0 < b /\ &0 < c /\ &0 < d +==> &0 < b * a * c * d `) THEN +CONJ_TAC THENL [EXPAND_TAC "arrr" THEN +UNDISCH_TAC `~ collinear {vec 0, u, (w:real^3)}` THEN +SIMP_TAC[ARC_SYM; NOT_COLL_IM_SIN_LT]; +UNDISCH_TAC `~(no_u = &0) `] THEN +UNDISCH_TAC ` ~(nov' = &0)` THEN +UNDISCH_TAC `~ collinear {vec 0, u, (w:real^3)}` THEN +NHANH NOT_COLLINEAR_IMP_2_UNEQUAL THEN STRIP_TAC THEN +FIRST_X_ASSUM MP_TAC THEN SIMP_TAC[DIST_NZ] THEN +EXPAND_TAC "diii" THEN EXPAND_TAC "no_u" THEN EXPAND_TAC "nov'" THEN +PHA THEN CONV_TAC NORM_ARITH; CONJ_TAC] THENL [ + +MATCH_MP_TAC REAL_LT_DIV THEN +FIRST_X_ASSUM MP_TAC THEN REAL_ARITH_TAC; + +FIRST_X_ASSUM MP_TAC THEN NHANH REAL_POS_NZ THEN SIMP_TAC[REAL_MUL_RID] THEN +ONCE_REWRITE_TAC[REAL_RING`a * no * nv * di * az * z = az * a * (di * z * no * nv) `] THEN +SIMP_TAC[NOT_0_INVERTABLE; REAL_MUL_RID]]);; + + +let SET_TAC = +let basicthms = +[NOT_IN_EMPTY; IN_UNIV; IN_UNION; IN_INTER; IN_DIFF; IN_INSERT; +IN_DELETE; IN_REST; IN_INTERS; IN_UNIONS; IN_IMAGE] in +let allthms = basicthms @ map (REWRITE_RULE[IN]) basicthms @ +[IN_ELIM_THM; IN] in +let PRESET_TAC = +TRY(POP_ASSUM_LIST(MP_TAC o end_itlist CONJ)) THEN +REPEAT COND_CASES_TAC THEN +REWRITE_TAC[EXTENSION; SUBSET; PSUBSET; DISJOINT; SING] THEN +REWRITE_TAC allthms in +fun ths -> +PRESET_TAC THEN +(if ths = [] then ALL_TAC else MP_TAC(end_itlist CONJ ths)) THEN +MESON_TAC[];; +let SET_RULE tm = prove(tm,SET_TAC[]);; + + + + +let ISRTTNZ = prove(` FINITE W /\ + CARD W = n /\ + (!x. W x ==> ~(x = vec 0)) /\ + xicm polar_cycle_on W /\ + W p /\ (?p q. W p /\ W q /\ ~(p = q)) + ==> sum (0..n - 1) + (\i. arg_diff (ITER i xicm p) (ITER (i + 1) xicm p)) = + &2 * pi /\ +(!p i j. + W p /\ 0 <= i /\ i <= j /\ j < n + ==> arg_diff p (ITER i xicm p) + + arg_diff (ITER i xicm p) (ITER j xicm p) = + arg_diff p (ITER j xicm p)) `, STRIP_TAC THEN +MP_TAC (SPEC_ALL ARG_DIFF_SUCCESSIBLE_IN_FIRST_PERIOD) THEN +ANTS_TAC THENL [ASM_REWRITE_TAC[]; SIMP_TAC[]] THEN DISCH_TAC +THEN MP_TAC (SPEC_ALL LEMMA_SUM_ALL_OVER_CYCLIC_SET) THEN PHA THEN +ANTS_TAC THENL [ ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[]; +SIMP_TAC[]]);; + + +end;; diff --git a/text_formalization/trigonometry/trigonometry.hl b/text_formalization/trigonometry/trigonometry.hl new file mode 100644 index 0000000..798a6b1 --- /dev/null +++ b/text_formalization/trigonometry/trigonometry.hl @@ -0,0 +1,328 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Trigonometry *) +(* Author: Thomas C. Hales *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + + +(* summary of the trig chapter *) + + + + +(* + +Known issues: + +-- Flypaper defines sin and cos by their power series. HOL Light defines them +through complex analysis. + +-- NUHSVLM: 5 points in R3 ==> cayleyR = 0, moved to collect_geom2.ml. Slow to run. + I will keep it out of the daily build. + +-- Some results (marked LEG) may have been formalized but not imported from legacy directory. +Lemmas in Elementary Geometry. Now in leg/ directory. + +-- some minor results that haven't been done or located are marked UNKNOWN below + +-- polar_cycle deprecated 2011-08-01. + +*) + + +module type Trigonometry_type = sig + +end;; + +flyspeck_needs "general/sphere.hl";; +flyspeck_needs "leg/enclosed_def.hl";; +flyspeck_needs "leg/collect_geom.hl";; +flyspeck_needs "trigonometry/trig1.hl";; +flyspeck_needs "trigonometry/trig2.hl";; + + +module Trigonometry (* : Trigonometry_type *) = struct + +(* +let LIST_MK_CONJ b = match b with + [] -> TRUTH + |b::bs as a-> let g = itlist (curry mk_conj) (map concl bs) (concl b) in prove(g,REWRITE_TAC a);; +*) + let LIST_MK_CONJ (b:thm list) = b;; + +let UNKNOWN = REWRITE_RULE[TRUTH] (new_definition `unknown = T`);; + + let elimin = REWRITE_RULE[IN];; + +let FOYTTIX1 = cos;; +let FOYTTIX2 = sin;; +let FOYTTIX=LIST_MK_CONJ [FOYTTIX1;FOYTTIX2];; + +let YIXJNJQ1 = SIN_0;; +let YIXJNJQ2 = COS_0;; +let YIXJNJQ = LIST_MK_CONJ [YIXJNJQ1;YIXJNJQ2];; + +let WPMXVYZ = SIN_CIRCLE;; + +let WNYVJPE1 = SIN_ADD;; +let WNYVJPE2 = COS_ADD;; +let WNYVJPE = LIST_MK_CONJ [WNYVJPE1;WNYVJPE2];; + +let KGLLRQT1 = COS_NEG;; +let KGLLRQT2 = SIN_NEG;; +let KGLLRQT = LIST_MK_CONJ [KGLLRQT1;KGLLRQT2];; + +(* cos(pi/2) = 0 *) +let CFXEKKP1 = COS_PI2;; +let CFXEKKP2 = COS_POS_PI2;; + +(* This is combined between two lemmas *) +let ZSKECZV = COS_POS_PI_LE;; + +(* Lemma label{lemma:sin-pi2} *) +let CPIREMF1 = SIN_PI2;; +let CPIREMF2 = SIN_POS_PI_LE;; +let CPIREMF = LIST_MK_CONJ [CPIREMF1;CPIREMF2];; + +(* Lemma label{lemma:cos-sin} *) +let SCEZKRH1 = GSYM COS_SIN;; +let SCEZKRH2 = GSYM SIN_COS;; + +let SCEZKRH = LIST_MK_CONJ [SCEZKRH1;SCEZKRH2];; + +let WIBGJRR = SIN_POS_PI_LE;; + +let LLOYXRK1 = prove(`!x. cos(pi/ &2 + x) = -- (sin x)`, + REWRITE_TAC[REAL_ARITH `x + y = x - (-- y)`;GSYM SIN_COS;SIN_NEG]);; +let LLOYXRK2 = prove(`!x. sin(pi/ &2 + x) = cos x`, + REWRITE_TAC[REAL_ARITH `x + y = x - (-- y)`;GSYM COS_SIN;COS_NEG]);; +let LLOYXRK3 = SIN_PERIODIC_PI;; +let LLOYXRK4 = COS_PERIODIC_PI;; +let LLOYXRK5 = SIN_PERIODIC;; +let LLOYXRK6 = COS_PERIODIC;; +let LLOYXRK = LIST_MK_CONJ [LLOYXRK1;LLOYXRK2;LLOYXRK3;LLOYXRK4;LLOYXRK5;LLOYXRK6];; + +(* sin non-negative *) +let WIBGJRR = SIN_POS_PI_LE;; + +(* definition label{def:tan} *) + let BIRXGXP = tan ;; + +(* Lemma label{lemma:tan-add} *) +let KWYPRWZ = TAN_ADD;; + +(* Lemma label{lemma:tan-pi4} *) +let KSQDZSF = TAN_PI4;; + +(* tan increasing and one-to-one *) +let UTNKIAC = TAN_MONO_LT;; + +let RIQVMHH1 = atn;; +let RIQVMHH2 = ATN_BOUNDS ;; +let RIQVMHH=LIST_MK_CONJ [RIQVMHH1;RIQVMHH2];; + + +let EWITKLU = ATN_TAN ;; + +let YTXYLRB = ATN_1 ;; + +let OKENMAM= HAS_REAL_DERIVATIVE_ATN;; + + +let LQCXGZX = ATN_MONO_LT_EQ ;; + +(* atan2 *) +let GYKGARD = Sphere.atn2;; +let QZTBJMH1 = acs;; +let QZTBJMH2 = COS_ACS;; +let QZTBJMH3 = ACS_COS;; +let QZTBJMH = LIST_MK_CONJ [ QZTBJMH1; QZTBJMH2; QZTBJMH3];; +let FMGMALU = SIN_ACS;; +let OUIJTWY = Trigonometry2.acs_atn2 ;; +(* let asn = asn;; *) + + +(* VECTOR GEOMETRY *) + +let KRZJIAD = (`:real^N`,`v$i`,`vec 0`);; + +let WHIAXYD1 = [`(x:real^3) + (y:real^3)`;`(x:real^3) - (x:real^3)`; + `-- (x:real^3)`;`t % (x:real^3)`];; +let WHIAXYD2 = VECTOR_ADD_ASSOC;; +let WHIAXYD3 = VECTOR_ADD_SYM;; +let WHIAXYD = ( WHIAXYD1, WHIAXYD2, WHIAXYD3);; + + +let VFPCZBI = [`(x:real^3) dot (y:real^3)`];; + +let XHVXJVB = vector_norm;; + + +(*CAUCHY SCHWARZ Lemma label{} *) +let JJKJALK = NORM_CAUCHY_SCHWARZ ;; + + +(*TRIANGLE INEQ Lemma label{} *) +let OIPLPTM1 = NORM_TRIANGLE ;; +let OIPLPTM2 = NORM_TRIANGLE_EQ ;; +let OIPLPTM = LIST_MK_CONJ [OIPLPTM1;OIPLPTM2];; + +(* AFFINE GEOMETRY *) + +let KVLZSAQ1 = AFFINE;; +let KVLZSAQ2 = Sphere.aff;; (* deprecated *) +let KVLZSAQ = LIST_MK_CONJ [KVLZSAQ1;KVLZSAQ2];; + +(* see also affsign;; lin_combo;; *) + +let BYFLKYM1 = Sphere.aff;; +let BYFLKYM2 = Sphere.aff_ge_def;; +let BYFLKYM3 = Sphere.aff_gt_def;; +let BYFLKYM4 = Sphere.aff_lt_def;; +let BYFLKYM5 = Sphere.aff_le_def;; +let BYFLKYM = LIST_MK_CONJ [BYFLKYM1;BYFLKYM2;BYFLKYM3;BYFLKYM4;BYFLKYM5];; + +let OWECYNV1 = convex;; +let OWECYNV2 = `(hull) convex`;; +let OWECYNV = (OWECYNV1,OWECYNV2);; + +let GDCZMLO = CONVEX_HULL_AFF_GE;; + +let UIVNNRR1 = prove( + `!V. (aff_ge V EMPTY = aff_gt V EMPTY)`, + REWRITE_TAC[aff_ge_def;aff_gt_def;affsign] THEN + STRIP_TAC THEN + ONCE_REWRITE_TAC[FUN_EQ_THM] THEN + REWRITE_TAC[affsign;elimin NOT_IN_EMPTY] +);; + +let UIVNNRR2 = AFF_GT_EQ_AFFINE_HULL;; +let UIVNNRR = LIST_MK_CONJ [UIVNNRR1;UIVNNRR2];; + +let LLOUBAX = cone ;; +let SWKFLBJ1 = Sphere.line ;; +let SWKFLBJ2 = collinear ;; +let parallel = define `parallel (v:real^N) w = collinear {(vec 0),v,w}`;; +let SWKFLBJ3 = parallel;; +let SWKFLBJ = LIST_MK_CONJ [ SWKFLBJ1; SWKFLBJ2; SWKFLBJ3];; + +let JLWZFBH1 = plane ;; +let JLWZFBH2 = Sphere.closed_half_plane;; +let JLWZFBH3 = Sphere.open_half_plane;; +let JLWZFBH4 = coplanar ;; +let JLWZFBH = LIST_MK_CONJ [JLWZFBH1;JLWZFBH2;JLWZFBH3;JLWZFBH4];; + +let OAUVFPS1 = Sphere.closed_half_space ;; +let OAUVFPS2 = Sphere.open_half_space ;; +let OAUVFPS = LIST_MK_CONJ [OAUVFPS1;OAUVFPS2];; + +let AVWKGNB = delta_x;; + +let LBEVAKV = Collect_geom.DELTA_POS_4POINTS;; +let CTCZHMR = LIST_MK_CONJ [LBEVAKV;Collect_geom.POLFLZY];; (* Delta pos LEG [line 2690;line 3010], *) + + +let KZVHHBG = LIST_MK_CONJ [Collect_geom.LTCTBAN;Collect_geom.GJWYYPS;Collect_geom.GDLRUZB];; + +let NUHSVLM = UNKNOWN;; (* " implemented in collect_geom2.hl" ;; *) + +(* CayleyR results: lines from legacy/collect_geom.ml LEG: +2337/LTCTBAN: ups is leading coeff of quadratic cayleyR +2725/GJWYYPS: discriminant of cayleyR +2894/GDLRUZB: disc(cayleyR)=0 <=> one of tetra are coplanar +3010/NUHSVLM: 5 points in R3 ==> cayleyR = 0 + +RPFVZDI: enclosed function defined +*) + +let RPFVZDI = Enclosed.enclosed;; (* "implemented in enclosed_def.hl ";; *) + + +let WZYUXVC = arcV ;; + +let ACNBFRL = UNKNOWN ;; (* arcV atn2 *) + +let PQQDENV = Trigonometry1.ACS_ARCLENGTH;; + +let HQTBPCM1 = LAW_OF_COSINES ;; +let HQTBPCM2 = Trigonometry1.DIST_LAW_OF_COS ;; +let HQTBPCM = LIST_MK_CONJ [HQTBPCM1;HQTBPCM2];; + + +let OBPIOXD = Sphere.ups_x;; (* upsilon def *) +let QRAAWFS = LIST_MK_CONJ [Trigonometry2.UPS_X_POS;Collect_geom.FHFMKIY];; +let IHIQXLM = Trigonometry1.UPS_X_SQUARES;; (* upsilon factors *) + +let UKBAHKV = Trigonometry1.VECTOR_LAW_OF_SINES ;; (* slightly different from book *) + +let GVWTZKY = UNKNOWN;; (* arc, atn2 *) + + +(* cross product something *) +let FCUAGA = cross;; +let KVVWPNA = NORM_CROSS ;; (* norm cross and ups, combine with UKBAHKV *) + +(* Lemma label{} *) +(* cross product order and distribution with dot product *) +let BKMUSOX1 = CROSS_SKEW ;; +let BKMUSOX2 = CROSS_TRIPLE ;; +let BKMUSOX = LIST_MK_CONJ [ BKMUSOX1; BKMUSOX2];; + +(* Definition label{def:dih} *) +let dihV = dihV ;; + +let RLXWSTK = Trigonometry2.RLXWSTK;; + +let NLVWBBW = Trigonometry2.NLVWBBW;; + +let OJEKOJF = Trigonometry2.OJEKOJF;; + +let JLPSDHF = Euler_main_theorem.EULER_TRIANGLE;; (* euler_triangle ;; *) + + +let KEITDWB = Trigonometry2.ARCV_INEQUALTY ;; +let FGNMPAV = Trigonometry2.FGNMPAV ;; + +let FEVNANL = LIST_MK_CONJ [Trigonometry1.atn2_spec;Trigonometry1.ATAN2_EXISTS];; + +let AXBTGQX = orthonormal;; (* much more has been proved about orthonormal vectors *) + +let QAUQIEC = UNKNOWN;; (* "not found, adapted orthonormization ";; *) + +let EYFCXPP = [Trigonometry2.EYFCXPP;(* see also CYLINDER_CORDINATE *) + Trigonometry2.CYLINDER_CORDINATE];; + +let azim = azim ;; + +let QQZKTXU = Trigonometry2.QQZKTXU;; +let JBDNJJB = Trigonometry2.JBDNJJB;; + +(* zenith angle *) + +let QAFHJNM =Trigonometry2.QAFHJNM;; +let XPHCPNY = SPHERICAL_COORDINATES ;; + +(* Cycle *) + +(* DEPRECATED 2011-08-01. let TNZQDCX = Sphere.polar_cycle;; *) + +let PDPFQUK = Trigonometry2.PDPFQUK;; +let ISRTTNZ = Trigonometry2.ISRTTNZ;; +let KFKHLWK = Trigonometry2.cyclic_set;; +let YESEEWW = Sphere.azim_cycle;; +let NLOFMTR = UNKNOWN;; (* "not found, of doubtful use";; *) +let YVREJIS = Trigonometry2.YVREJIS;; +let ULEKUUB = UNKNOWN;; (* "not found, fan version given as Topology.ULEKUUB";; *) + +(* spherical triangle inequality *) + +let KEITDWB = Trigonometry2.KEITDWB;; +let FGNMPAV = Trigonometry2.FGNMPAV;; + + +end;; + diff --git a/text_formalization/usr/thales/hales_tactic.hl b/text_formalization/usr/thales/hales_tactic.hl new file mode 100644 index 0000000..65c4e43 --- /dev/null +++ b/text_formalization/usr/thales/hales_tactic.hl @@ -0,0 +1,458 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Author: Thomas C. Hales *) +(* Date: 2011-06-18 *) +(* ========================================================================== *) + + +(* Tactics. *) + +module Hales_tactic = struct + + + +let unlist tac t = tac [t];; + +let kill th = ALL_TAC;; + +(* moved to strictbuild.hl. +let dest_goal gl = gl;; + +let goal_asms = fst;; + +let goal_concl = snd;; + +let mk_goal(asl,w) = (asl,w);; + + +*) + +let LET_THM = CONJ LET_DEF LET_END_DEF;; + +let UNDISCH2 = repeat UNDISCH;; + +let COMBINE_TAC ttac1 ttac2 = (fun t -> ttac1 t THEN ttac2 t);; + +let ASM_TAC=REPEAT(POP_ASSUM MP_TAC);; + +let RED_TAC=ASM_REWRITE_TAC[] THEN DISCH_TAC;; + +let RES_TAC=ASM_REWRITE_TAC[] THEN STRIP_TAC;; + +let REDA_TAC=ASM_REWRITE_TAC[] THEN DISCH_TAC THEN ASM_REWRITE_TAC[];; + +let RESA_TAC=ASM_REWRITE_TAC[] THEN STRIP_TAC THEN ASM_REWRITE_TAC[];; + +let REDAL_TAC (th: thm list) =ASM_REWRITE_TAC th THEN DISCH_TAC THEN ASM_REWRITE_TAC th;; + +let RESAL_TAC (th: thm list) = ASM_REWRITE_TAC th THEN STRIP_TAC THEN ASM_REWRITE_TAC th;; + +(* +let REMOVE_ASSUM_TAC=POP_ASSUM(fun th-> REWRITE_TAC[]);; +let SYM_ASSUM_TAC=POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]);; +*) + +let REMOVE_ASSUM_TAC=POP_ASSUM kill THEN REWRITE_TAC[];; + +let SYM_ASSUM_TAC=POP_ASSUM((unlist REWRITE_TAC) o SYM);; + +let SYM_ASSUM1_TAC=POP_ASSUM(COMBINE_TAC ((unlist REWRITE_TAC) o SYM ) ASSUME_TAC);; + +let RESP_TAC=ASM_REWRITE_TAC[] THEN STRIP_TAC THEN POP_ASSUM(unlist REWRITE_TAC);; + +let RESPL_TAC (th: thm list) =ASM_REWRITE_TAC th THEN STRIP_TAC THEN POP_ASSUM(unlist REWRITE_TAC);; + +let REDUCE_ARITH_TAC=REWRITE_TAC[REAL_ARITH`&0 * a= &0`; REAL_ARITH`a * &0 = &0`; REAL_ARITH`a + &0 = a`; +REAL_ARITH`a- &0 =a`;REAL_ARITH`&0 +a =a`;REAL_ARITH`&1 * a =a`;REAL_ARITH`a * &1 =a`;REAL_ARITH`(A+B)-B=A`];; + +let REDUCE_VECTOR_TAC=REWRITE_TAC[VECTOR_ARITH`&0 % a= vec 0`; VECTOR_ARITH`a % vec 0= vec 0`;VECTOR_ARITH`a + vec 0 = a`; VECTOR_ARITH`vec 0 +a =a`; VECTOR_ARITH`a- vec 0 =a`;VECTOR_ARITH`&1 % a =a`;VECTOR_ARITH`a- b =vec 0<=> a=b`];; + +let MRESA_TAC th1 (th: term list) = MP_TAC(ISPECL th th1) THEN RESA_TAC;; + +let MRESA1_TAC th1 th = MP_TAC(ISPEC th th1) THEN RESA_TAC;; + +let MRESAL_TAC th1 (th: term list) (th2: thm list) =MP_TAC(ISPECL th th1) THEN ASM_REWRITE_TAC th2 THEN STRIP_TAC THEN ASM_REWRITE_TAC th2;; + +let MRESAL1_TAC th1 th (th2: thm list) =MP_TAC(ISPEC th th1) THEN ASM_REWRITE_TAC th2 THEN STRIP_TAC THEN ASM_REWRITE_TAC th2;; + +let ASM_SET_TAC l = + (TRY(POP_ASSUM_LIST(MP_TAC o end_itlist CONJ))) THEN SET_TAC l;; + + +(* GSYM theorems explicit *) + +let GSYM_EXISTS_PAIRED_THM = GSYM EXISTS_PAIRED_THM;; + +let has_stv t = + let typ = (type_vars_in_term t) in + can (find (fun ty -> (is_vartype ty) && ((dest_vartype ty).[0] = '?'))) typ;; + +let frees_of_goal gl = + let (asl,w) = dest_goal gl in + let tms = w::(map (concl o snd) asl) in + let varl = List.flatten (map frees tms) in + map (fun t -> (fst (dest_var t), t)) varl;; + +(* +let retype gls tm = + let varl = filter has_stv (setify(frees tm)) in + let svarl = map (fun t-> (fst(dest_var t),t)) varl in + let fn = fun buff (s,t) -> try (let (_,_,m)= term_match [] t (assoc s gls) in m @ buff) + with _ -> failwith ("not found: "^s) in + let tyassoc = List.fold_left fn [] svarl in + (instantiate ([],[],tyassoc)) tm ;; +*) + +(* new version 2013-07-13. Doesn't allow any new free variables, even if type inference works *) + +let retype gls tm = + let allv = setify(frees tm) in + let varl = filter has_stv allv in + let svarl = map (fun t-> (fst(dest_var t),t)) varl in + let fn = fun buff (s,t) -> try (let (_,_,m)= term_match [] t (assoc s gls) in m @ buff) + with _ -> failwith ("not found: "^s) in + let tyassoc = List.fold_left fn [] svarl in + let tm' = (instantiate ([],[],tyassoc)) tm in + let glt = map snd gls in + let _ = map (fun x -> mem x glt or failwith ("not found: "^ fst (dest_var x))) (setify (frees tm')) in + tm';; + +let env gl tm = + let gls = frees_of_goal gl in + retype gls tm;; + +let envl gl tml = + let gls = frees_of_goal gl in + let varl = filter has_stv (setify (List.flatten(map frees tml))) in + let svarl = setify(map (fun t-> (fst(dest_var t),t)) varl) in + let fn = fun buff (s,t) -> try (let (_,_,m)= term_match [] t (assoc s gls) in m @ buff) + with _ -> failwith ("not found: "^s) in + let tyassoc = List.fold_left fn [] svarl in + map (instantiate ([],[],tyassoc)) tml ;; + +let gtyp (ttac:term->tactic) tm gl = ttac (env gl tm) gl;; + +let gtypl (ttacl:term list -> tactic) tml gl = + ttacl (map (env gl) tml) gl;; + +let GEXISTS_TAC = gtyp EXISTS_TAC;; + +let GSUBGOAL_THEN t ttac gl = SUBGOAL_THEN (env gl t) ttac gl;; + +let argthen ttac tac t = (ttac t) THEN tac;; + +let CONJ2_TAC = let t = (TAUT `a /\ b ==> b /\ a`) in MATCH_MP_TAC t THEN CONJ_TAC;; + +let GEXISTL_TAC tl = EVERY (map GEXISTS_TAC tl);; + +(* ========================================================================== *) +(* TACTIC *) + +let FORCE_EQ = REPEAT (CHANGED_TAC (AP_TERM_TAC ORELSE AP_THM_TAC ORELSE BINOP_TAC)) ;; + +let FORCE_MATCH = (MATCH_MP_TAC (TAUT `(a = b) ==> (a ==> b)`)) THEN FORCE_EQ ;; + +let FORCE_MATCH_MP_TAC th = + MP_TAC th THEN ANTS_TAC THENL[ALL_TAC;FORCE_MATCH + ];; + +let HYP_CONJ_TAC = + let th = TAUT `(a ==> b==> c) ==> (a /\ b ==> c)` in + FIRST_X_ASSUM (fun t-> MP_TAC t THEN MATCH_MP_TAC th THEN DISCH_TAC THEN DISCH_TAC);; + +(* ****************************** +UNSORTED +****************************** *) + +let SELECT_EXIST = prove_by_refinement( + `!(P:A->bool) Q. (?y. P y) /\ (!t. (P t ==> Q t)) ==> Q ((@) P)`, + (* {{{ proof *) + + [ + REPEAT STRIP_TAC; + ASSUME_TAC (ISPECL[`P:(A->bool)`;`y:A`] SELECT_AX); + ASM_MESON_TAC[]; + ]);; + + (* }}} *) + +let SELECT_THM = MESON[SELECT_EXIST] + `!(P:A->bool) Q. (((?y. P y) ==> (!t. (P t ==> Q t))) /\ ((~(?y. P y)) ==> + (!t. Q t))) ==> Q ((@) P)`;; + +let SELECT_TAC = + let unbeta = prove( + `!(P:A->bool) (Q:A->bool). (Q ((@) P)) <=> (\t. Q t) ((@) P)`,MESON_TAC[]) in + let unbeta_tac = CONV_TAC (HIGHER_REWRITE_CONV[unbeta] true) in + unbeta_tac THEN (MATCH_MP_TAC SELECT_THM) THEN BETA_TAC THEN + REPEAT STRIP_TAC;; + +(* +let SELECT_TAC = Tactics.SELECT_TAC;; +*) + +let COMMENT s = (report s; ALL_TAC);; + +let NAME _ = ALL_TAC;; + +let ROT_TAC = (* permute conjuncts *) + let t1 = TAUT `b /\ a ==> a /\ b` in + let t2 = TAUT `((b /\ c) /\ a) = (b /\ c /\ a)` in + MATCH_MP_TAC t1 THEN PURE_REWRITE_TAC[t2];; + +let ENOUGH_TO_SHOW_TAC t = + let u = INST [(t,`A:bool`)] (TAUT ` ((A ==> B) /\ A) ==> B`) in + MATCH_MP_TAC u THEN CONJ_TAC;; + +(* like FIRST_X_ASSUM, except some subterm has to match t *) + +let FIRST_X_ASSUM_ST t x = + FIRST_X_ASSUM (fun u -> + let _ = find_term (can(term_match[] t)) (concl u) in x u);; + +let FIRST_ASSUM_ST t x = + FIRST_ASSUM (fun u -> + let _ = find_term (can(term_match[] t)) (concl u) in x u);; + +let BURY_TAC t gl = + let n = List.length (goal_asms gl) in + (REPEAT (FIRST_X_ASSUM MP_TAC) THEN ASSUME_TAC t THEN + REPLICATE_TAC n DISCH_TAC) gl;; + +let BURY_MP_TAC gl = + (POP_ASSUM_LIST(K ALL_TAC) THEN DISCH_TAC THEN + MAP_EVERY (fun (s,th) -> LABEL_TAC s (th)) + (rev (goal_asms gl))) gl;; + +let GOAL_TERM ttac g = (ttac g) g;; + +let TYPIFY t u = GOAL_TERM (fun w -> u (env w t));; + +let TYPIFY_GOAL_THEN t u = TYPIFY t (C SUBGOAL_THEN u);; + + +(* puts the hypotheses of a conditional rewrite as a conjunct, rather than + trying to prove them + thm should have the form a ==> (b = c) or the form a ==> b. + Doesn't do matching on bound variables. + *) + +let GMATCH_SIMP_TAC thm gl = + let w = goal_concl gl in + let lift_eq_thm = MESON[] `! a b c. (a ==> ((b:B) = c)) ==> (!P. a /\ P c ==> P b)` in + let lift_eq t = GEN_ALL (MATCH_MP lift_eq_thm (SPEC_ALL t)) in + let thm' = hd (mk_rewrites true thm []) in + let t1 = fst (dest_eq(snd (dest_imp(concl(thm'))))) in + let matcher u t = + let m = term_match [] t1 t in + let _ = subset (frees t) (frees u) or failwith "" in + m in + let w' = find_term (can (matcher w)) w in + let var1 = mk_var("v",type_of w') in + let vv = variant (frees w) var1 in + let athm = REWRITE_CONV[ ASSUME (mk_eq (w',vv))] w in + let bthm = (ISPECL [mk_abs(vv,rhs (concl athm));w'] BETA_THM) in + let betx = SYM(TRANS bthm (BETA_CONV (rhs (concl bthm)))) in + (ONCE_REWRITE_TAC[betx] THEN MATCH_MP_TAC (lift_eq thm') THEN + BETA_TAC THEN REWRITE_TAC[]) gl;; + + +(* +let ASM_REAL_ARITH_TAC t = + REPEAT (POP_ASSUM MP_TAC) THEN MP_TAC (itlist CONJ t TRUTH) THEN + REAL_ARITH_TAC;; + +let MP_LIST t = EVERY (map MP_TAC t);; +*) + + + +(* Gonthier's script organizational tactics. *) + +let BY (t:tactic) gl = + let (a,b,c) = t gl in + let _ = (b = []) or failwith "by failed to finish goal" in + (a,b,c);; + +let BRANCH_A (t::tl) = t THENL [EVERY tl;ALL_TAC];; + +let BRANCH_B (t::tl) = t THENL [ALL_TAC;EVERY tl];; + +(* a few from Jordan *) + +let X_IN = REWRITE_RULE[IN];; + +let SUBCONJ_TAC = + MATCH_MP_TAC (TAUT `A /\ (A ==>B) ==> (A /\ B)`) THEN CONJ_TAC;; + +let SUBCONJ2_TAC = + MATCH_MP_TAC (TAUT `B /\ (B ==>A) ==> (A /\ B)`) THEN CONJ_TAC;; + +let nCONJ_TAC n gl = + let w = goal_concl gl in + let w' = rhs(concl(PURE_REWRITE_CONV[GSYM CONJ_ASSOC] w)) in + let wn = List.nth (conjuncts w') n in + (SUBGOAL_THEN wn ASSUME_TAC) gl;; + +let PROOF_BY_CONTR_TAC = + MATCH_MP_TAC (TAUT `(~A ==> F) ==> A`) THEN DISCH_TAC;; + +let (UNDISCH_FIND_TAC: term -> tactic) = + fun tm gl -> + let asl = goal_asms gl in + let p = can (term_match[] tm) in + try let sthm,_ = remove + (fun (_,asm) -> can (find_term p) (concl ( asm))) asl in + UNDISCH_TAC (concl (snd sthm)) gl + with Failure _ -> failwith "UNDISCH_FIND_TAC";; + +let rec type_set: (string*term) list -> (term list*term) -> (term list*term)= + fun typinfo (acclist,utm) -> match acclist with + | [] -> (acclist,utm) + | (Var(s,_) as a)::rest -> + let a' = (assocd s typinfo a) in + if (a = a') then type_set typinfo (rest,utm) + else let inst = instantiate (term_match [] a a') in + type_set typinfo ((map inst rest),inst utm) + | _ -> failwith "type_set: variable expected" + ;; + +let has_stv t = + let typ = (type_vars_in_term t) in + can (find (fun ty -> (is_vartype ty) && ((dest_vartype ty).[0] = '?'))) typ;; + + +let TYPE_THEN: term -> (term -> tactic) -> tactic = + fun t (tac:term->tactic) gl -> + let (asl,w) = dest_goal gl in + let avoids = itlist (union o frees o concl o snd) asl + (frees w) in + let strip = fun t-> (match t with + |Var(s,_) -> (s,t) | _ -> failwith "TYPE_THEN" ) in + let typinfo = map strip avoids in + let t' = (snd (type_set typinfo ((frees t),t))) in + (warn ((has_stv t')) "TYPE_THEN: unresolved type variables"); + tac t' gl;; + +(* this version must take variables *) + +let TYPEL_THEN: term list -> (term list -> tactic) -> tactic = + fun t (tac:term list->tactic) gl -> + let (asl,w) = dest_goal gl in + let avoids = itlist (union o frees o concl o snd) asl + (frees w) in + let strip = fun t-> (match t with + |Var(s,_) -> (s,t) | _ -> failwith "TYPE_THEN" ) in + let typinfo = map strip avoids in + let t' = map (fun u -> snd (type_set typinfo ((frees u),u))) t in + (warn ((can (find has_stv) t')) "TYPEL_THEN: unresolved type vars"); + tac t' gl;; + +let (EXISTSv_TAC :string -> tactic) = + fun s gl -> + let (v,_) = dest_binder "?" (goal_concl gl) in + let (_,ty) = dest_var v in + EXISTS_TAC (mk_var(s,ty)) gl;; + +let (X_GENv_TAC:string ->tactic) = + fun s gl -> + let (v,_) = dest_binder "!" (goal_concl gl) in + let (_,ty) = dest_var v in + X_GEN_TAC (mk_var(s,ty)) gl;; + +(* weak version doesn't do conj *) + +let (WEAK_STRIP_TAC: tactic) = + fun gl -> + try (fun ttac -> FIRST [GEN_TAC; DISCH_THEN ttac]) STRIP_ASSUME_TAC gl + with Failure _ -> failwith "STRIP_TAC";; + +let WEAK_STRIP_THM_THEN = + FIRST_TCL [CONJUNCTS_THEN; CHOOSE_THEN];; + +let WEAK_STRIP_ASSUME_TAC = + let DISCARD_TAC th = + let tm = concl th in + fun gl -> + if exists (fun a -> aconv tm (concl(snd a))) (goal_asms gl) then ALL_TAC gl + else failwith "DISCARD_TAC: not already present" in + (REPEAT_TCL WEAK_STRIP_THM_THEN) + (fun gth -> FIRST [CONTR_TAC gth; ACCEPT_TAC gth; + DISCARD_TAC gth; ASSUME_TAC gth]);; + +let (WEAKER_STRIP_TAC: tactic) = + fun gl -> + try (fun ttac -> FIRST [GEN_TAC; DISCH_THEN ttac]) WEAK_STRIP_ASSUME_TAC gl + with Failure _ -> failwith "STRIP_TAC";; + +let hold_def = new_definition `(hold:A->A) = I`;; + +let hold = MATCH_MP_TAC (prove_by_refinement( + `!a. hold a ==> a`, [REWRITE_TAC [hold_def;I_DEF] ]));; + +let unhold = MATCH_MP_TAC (prove_by_refinement( + `!a. a ==> hold a`, [REWRITE_TAC [hold_def;I_DEF] ]));; + +let MP_ASM_THEN = + fun tac -> hold THEN + (REPEAT (POP_ASSUM MP_TAC)) THEN + tac THEN REPEAT DISCH_TAC + THEN unhold;; + +let FULL_EXPAND_TAC s = FIRST_ASSUM (fun t -> + let _ = (s = fst(dest_var(rhs(concl t)))) or failwith "" in + (MP_ASM_THEN (SUBST1_TAC (SYM t) THEN BETA_TAC)));; + +(* +let RENAME_VAR (t,s) = (* rename free variable *) + let svar = mk_var (s,snd(dest_var t)) in + MP_ASM_THEN (SPEC_TAC (t,s) THEN X_GENv_TAC s);; +*) +let RENAME_FREE_VAR (t,s) = (* rename free variable *) + MP_ASM_THEN (SPEC_TAC (t,t) THEN X_GENv_TAC s);; + +(* rebind bound variables *) + +let rec rec_alpha_at (t,s) tm = match tm with + | Comb (u,v) -> mk_comb (rec_alpha_at (t,s) u,rec_alpha_at (t,s) v) + | Abs (a,b) -> if (a=t) then alpha s tm else mk_abs(a,rec_alpha_at (t,s) b) + | _ -> tm;; + +let alpha_at (t,s) = + rec_alpha_at (t,mk_var(s,snd(dest_var t)));; + +let REBIND_CONV ts g = ALPHA g (alpha_at ts g);; + +REBIND_CONV (`x:real`,"y") (`pi + (\ x . x + pi) pi`);; + +let REBIND_RULE ts th1 = EQ_MP (REBIND_CONV ts (concl th1)) th1;; + +REBIND_RULE (`x:real`,"y") (ASSUME (`pi + (\ x . x + pi) pi = &1`));; + +let REBIND_TAC ts gl = (SUBST1_TAC (REBIND_CONV ts (goal_concl gl))) gl;; + +(* MISCELL. *) + +let arith tm = + let v = [ARITH_RULE;REAL_ARITH;(fun t -> prove(t,SIMPLE_COMPLEX_ARITH_TAC));REAL_RING;VECTOR_ARITH] in + tryfind (fun h -> h tm) v;; + +let varith = VECTOR_ARITH;; + +let COMMENT _ = ALL_TAC;; + +let INTRO_TAC th1 tml = + GOAL_TERM (fun w -> (MP_TAC (ISPECL ( envl w tml) th1)));; + + let COPY_TAC = DISCH_THEN (fun t -> MP_TAC t THEN ASSUME_TAC t);; + + let TYPED_ABBREV_TAC t gl = + let (a,b) = dest_eq t in + let b' = env gl b in + let (a',_) = dest_var a in + let t' = mk_eq(mk_var(a',type_of b'),b') + in ABBREV_TAC t' gl;; + + + +end;; diff --git a/text_formalization/usr/thales/init_search.hl b/text_formalization/usr/thales/init_search.hl new file mode 100644 index 0000000..5d24aa4 --- /dev/null +++ b/text_formalization/usr/thales/init_search.hl @@ -0,0 +1,372 @@ +(* initialization of search structures *) + +(* module Init = struct *) + + +flyspeck_needs "usr/thales/searching.hl";; + +module Init_search = struct + + open Hales_tactic;; + open Searching;; + +(* ========================================================================== *) +(* REWRITE SUGGEST *) + +update_database();; + +(* +let search_result_dump_march7_2012_8am = + ["Trigonometry2.COLLINEAR_TRANSABLE"; "Trigonometry2.COLLINEAR_TRANSABLE"; + "Trigonometry2.COLLINEAR_TRANSABLE"; "Trigonometry2.COLLINEAR_TRANSABLE"; + "COLLINEAR_LEMMA_ALT"; "WEDGE_LUNE_GT"; "COLLINEAR_3_AFFINE_HULL"; + "Sphere.aff"; "AFFINE_HULL_2_ALT"; + "Marchal_cells_2.RADIAL_VS_RADIAL_NORM"; "Conforming.SOL_UNIONS"; + "Vol1.sol"; "AFF_DIM_CONVEX_HULL"; "Hypermap.lemma_in_disjoint"; + "FACE_OF_DISJOINT_INTERIOR"; "real_div"; "SUM_RMUL"; "VECTOR_MUL_RZERO"; + "SUM_CLAUSES"; "Packing3.SING_UNION_EQ_INSERT"; "VSUM_LMUL"; + "Collect_geom.IN_AFFINE_HULL_IMP_COLLINEAR"; "AFF_DIM_2"; + "AFF_DIM_INSERT"; "AFF_DIM_SUBSET"; "Polyhedron.AFF_DIM_INTERIOR_EQ_3"; + "AFF_DIM_EQ_AFFINE_HULL"; "CONVEX_HULL_EQ"; + "Marchal_cells.CONVEX_HULL_SUBSET"; + "Upfzbzm_support_lemmas.SUM_SET_OF_2_ELEMENTS"; "SUM_SUBSET_SIMPLE"; + "HAS_SIZE_1_EXISTS"; "HAS_SIZE_0"; "SUM_UNION"; "SUM_POS_LE"; "sgn_gt"; + "FACE_OF_IMP_CONVEX"; "POLYTOPE_UNION_CONVEX_HULL_FACETS"; + "SUBSET_RELATIVE_INTERIOR"; + "EXPLICIT_SUBSET_RELATIVE_INTERIOR_CONVEX_HULL"; "Geomdetail.SUM_DIS3"; + "face_of"; "FACE_OF_CONVEX_HULL_SUBSET"; "Geomdetail.VSUM_DIS3"; + "Collect_geom.NOT_COLLINEAR_IMP_2_UNEQUAL"; + "Marchal_cells_2.VSUM_CLAUSES_alt"; "NOT_IN_EMPTY"; "UNION_EMPTY"; + "aff_gt_def"; "CONVEX_AFF_GT"; "affsign"; "Sphere.aff_gt_def"; + "AZIM_REFL"; "AZIM_BASE_SHIFT_LT"; "Counting_spheres.EMPTY_NOT_EXISTS_IN"; + "wedge"; "NORM_NEG"; "dist"; "IN_BALL"; "VECTOR_MUL_ASSOC"; + "Polyhedron.fchanged"; "NORMBALL_BALL"; "Sphere.radial"; + "Polyhedron.CARD_SET_OF_EDGE_INEQ_1_POLYHEDRON"; + "Polyhedron.POLYTOPE_FAN80"; "Conforming.PIIJBJK"; + "Polyhedron.POLYHEDRON_FAN"; + "Conforming.MEASURABLE_TOPOLOGICAL_COMPONENT_YFAN_INTER_BALL"; + "Polyhedron.FCHANGED_IN_COMPONENT"; "primitive"; "MEASURABLE_RULES"; + "Sphere.cone0"; "solid_triangle"; "Vol1.volume_prop_fix"; + "Sphere.eventually_radial"; "MEASURABLE_BALL_WEDGE"; "MEASURE_SUBSET"; + "NORM_EQ_0"; "DOT_EQ_0"; "NORM_POS_LE"; "Real_ext.REAL_PROP_NN_MUL2"; + "Calc_derivative.invert_den_le"; "DOT_SYM"; "Collect_geom.EQ_POW2_COND"; + "Trigonometry2.DIV_POW2"; "DOT_LZERO"; "Calc_derivative.invert_den_eq"; + "VECTOR_MUL_EQ_0"; "REAL_EQ_MUL_LCANCEL"; "NORM_POS_LT"; "SQRT_POS_LT"; + "ABS_SQUARE_LT_1"; "Calc_derivative.invert_den_lt"; "REAL_LT_MUL"; + "Trigonometry1.DOT_COS"; "Trigonometry2.NOT_ZERO_EQ_POW2_LT"; + "REAL_LT_MUL"; "REAL_LT_RMUL"; "Trigonometry2.UNIT_BOUNDED_IN_TOW_FORMS"; + "SQRT_POW_2"; "NORM_EQ_0"; "Collect_geom.DIST_POW2_DOT"; + "Tarjjuw.CHANGE_TARJJUW_4"; "NORM_POS_LE"; "Real_ext.REAL_PROP_NN_MUL2"; + "NORM_POW_2"; "DOT_SQUARE_NORM"; "Trigonometry2.MUL_POW2"; + "Tactics_jordan.REAL_POW_2_LT"; "DOT_SYM"; + "Polyhedron.INTERIOR_AFFINIE_HUL_EQ_UNIV"; + "Counting_spheres.affine_facet_hyper"; "RELATIVE_INTERIOR_SUBSET"; + "INTERIOR_SUBSET_RELATIVE_INTERIOR"; "facet_of"; "POLYHEDRON_IMP_CONVEX"; + "Ldurdpn.SUBSET_P_HULL"; "HULL_HULL"; "HULL_MONO"; "VECTOR_MUL_LID"; + "Marchal_cells_2.AFFINE_SUBSET_KY_LEMMA"; "RELATIVE_INTERIOR_SUBSET"; + "FACE_OF_STILLCONVEX"; "FACE_OF_DISJOINT_RELATIVE_INTERIOR"; + "REAL_LT_MUL"; "REAL_LT_LMUL"; "REAL_LT_DIV"; + "Local_lemmas.REAL_LT_DIV_NEG"; "Trigonometry2.LT_IMP_ABS_REFL"; + "NORM_POW_2"; "NORM_MUL"; "DOT_LMUL"; "DIST_0"; "VECTOR_SUB_RZERO"; + "rconesgn"; "rcone_gt"; "Polyhedron.REDUCE_POINT_FACET_EXISTS"; + "POLYHEDRON_COLLINEAR_FACES"; "DOT_POS_LT"; "DOT_RZERO"; "facet_of"; + "DOT_LMUL"; "Trigonometry2.EXISTS_OTHOR_VECTOR_DIFFF_VEC0"; + "Trigonometry2.EXISTS_UNIT_OTHOR_VECTOR"; "INJECTIVE_PAD2D3D"; + "COMPLEX_VEC_0"; "COMPLEX_VEC_0"; "Counting_spheres.facet_rep_def"; + "CX_INJ"; "COMPLEX_NORM_CX"; "POLYTOPE_EQ_BOUNDED_POLYHEDRON"; + "POLYTOPE_IMP_CONVEX"; "POLYTOPE_IMP_COMPACT"; + "EXTREME_POINT_EXISTS_CONVEX"; "FACE_OF_SING"; + "FACE_OF_POLYHEDRON_SUBSET_FACET"; "POLYTOPE_FACET_EXISTS"];; + +let remove_work_in_progress = + Lib.subtract search_result_dump_march7_2012_8am ["AZIM_BASE_SHIFT_LT"];; + +map refresh_rewrite_stag remove_work_in_progress;; + +(* augment_search_results search_result_dump_march7_2012_8am;; *) + +remove_rewrite_tag "POLYHEDRON_COLLINEAR_FACES";; + + + +map refresh_rewrite_stag + ["SQRT_POS_LE";"SUBSET_INTER";"VECTOR_MUL_RZERO";"VECTOR_ADD_RID"; + "VECTOR_SUB_RZERO";"VECTOR_ADD_LID";"VECTOR_SUB_LZERO";"IN_UNIV"; + "Local_lemmas.EXISTS_IN";"Collect_geom.IN_SET2";"DOT_RMUL";"DOT_LMUL"; + "FORALL_PAIR_THM";"EXISTS_PAIRED_THM";"Hales_tactic.GSYM_EXISTS_PAIRED_THM"; + "IN_SING"];; +*) + + +(* ========================================================================== *) +(* tactic patterns *) + +map add_tactic_pattern + [(match_g[`(@):(A->bool)->A`],"SELECT_ELIM_TAC","remove @", + fun t-> SELECT_ELIM_TAC); +(match_g[`(@):(A->bool)->A`],"SELECT_TAC","remove @ with subgoals", + fun t-> SELECT_TAC); +(match_g[full `(\x. f x = \x. g x)`],"ABS_TAC","strip abstractions from equality", + fun t-> ABS_TAC); +(match_g[full ` ((p ==> q) ==> r)`],"ANTS_TAC","ants", + fun t-> ANTS_TAC); +(match_g_no_ho[full ` (f x = g x)`],"AP_THM_TAC","drop the function argument", + fun t-> AP_THM_TAC); +(match_g_no_ho[full ` (f x y = f x' y)`],"AP_THM_TAC THEN AP_TERM_TAC","show first args of a binary function are equal", + fun t-> AP_THM_TAC THEN AP_TERM_TAC); +(match_g[`(\x. f) y`],"BETA_TAC","beta reduce", + fun t-> BETA_TAC); +(match_g[full ` (f x y = f x' y')`],"BINOP_TAC","show binary function args equal", + fun t-> BINOP_TAC); +(match_g[full ` (f x = f x' )`],"AP_TERM_TAC","show function args equal", + fun t-> AP_TERM_TAC); +(match_g[full `(a /\ b)`],"CONJ_TAC","split into two subgoals", + fun t-> CONJ_TAC); +(match_g[full `(a ==>b)`],"DISCH_TAC","discharge antecedent", + fun t -> DISCH_TAC); +(match_g[full `(a <=> b)`],"EQ_TAC","split <=> into two conditionals", + fun t -> EQ_TAC); +(match_g[full `(?x. t)`],"EXISTS_TAC","specify existence", + fun t -> failwith "syntax: EXISTS_TAC `u`"); +(match_g[full `(!x. t)`],"GEN_TAC","remove universal", + fun t-> GEN_TAC); +(match_g[full `((f:A->B) = g)`],"MATCH_MP_TAC EQ_EXT","apply to arg", + fun t-> MATCH_MP_TAC EQ_EXT); +(* was ONCE_REWRITE_TAC[FUN_EQ_THM] *) +(match_g[full `(!(x:num). t)`],"INDUCT_TAC","induction", + fun t->INDUCT_TAC); +(match_g[full `(!(n:A list). P)`],"LIST_INDUCT_TAC","structure induction on lists", + fun t->LIST_INDUCT_TAC); +(match_g[full `(f x = g y)`],"MK_COMB_TAC","show equality of functions and args", + fun t->MK_COMB_TAC); +(match_g[full`x <= (z:real)`],"MATCH_MP_TAC REAL_LE_TRANS","x <= y /\ y <= z ", + fun t -> MATCH_MP_TAC REAL_LE_TRANS); +(match_g[full`x < (z:real)`],"MATCH_MP_TAC REAL_LET_TRANS","x <= y /\ y < z ", + fun t -> MATCH_MP_TAC REAL_LET_TRANS); +(match_g[full`x < (z:real)`],"MATCH_MP_TAC REAL_LTE_TRANS","x < y /\ y <= z", + fun t -> MATCH_MP_TAC REAL_LTE_TRANS); +(match_asm[ full `x \/ y`],"FIRST_X_ASSUM DISJ_CASES_TAC","split x \/ y assumption", + fun t -> FIRST_X_ASSUM DISJ_CASES_TAC); +(match_asm[full `?(x:A). y`],"FIRST_X_ASSUM CHOOSE_TAC","choose existential quant in assumption list", + fun t-> FIRST_X_ASSUM CHOOSE_TAC); +(match_asm[full `x /\ y`],"FIRST_X_ASSUM (CONJUNCTS_THEN ASSUME_TAC)","split asumption conjunction", + fun t->FIRST_X_ASSUM (CONJUNCTS_THEN ASSUME_TAC)); +];; + +add_tactic_pattern (match_g[`let x = (y:A) in (z:B)`],"LET_TAC","let elimination", + fun t -> LET_TAC);; + +add_tactic_pattern (match_g[full `(a:A->bool) = b`],"MATCH_MP_TAC SUBSET_ANTISYM", + "subset conjunction", + fun t -> MATCH_MP_TAC SUBSET_ANTISYM);; + + +(* ========================================================================== *) +(* +ABBREVIATIONS OF TACTICS +*) + +tactic_abbreviations:= [ + ("fun","fun"); + ("then","THEN"); + ("real","REAL_ARITH_TAC"); + ("se","SELECT_TAC"); + ("if","COND_CASES_TAC"); + ("cc","COND_CASES_TAC"); + ("r","REWRITE_TAC"); + ("mp","MP_TAC"); +("ra","REAL_ARITH"); +("aru","ARITH_RULE"); +("field","REAL_FIELD"); +("fieldt","(CONV_TAC REAL_FIELD)"); +("ar","ASM_REWRITE_TAC"); +("hc","HYP_CONJ_TAC"); +("rt/a","ASM_REWRITE_TAC"); +("r/a","ASM_REWRITE_TAC"); +("r/o","ONCE_REWRITE_TAC"); +("rt/o","ONCE_REWRITE_TAC"); +("mmp","MATCH_MP_TAC"); +("st","WEAKER_STRIP_TAC"); +("st/r","REPEAT WEAKER_STRIP_TAC"); +("str","STRIP_TAC"); +("str/r","REPEAT STRIP_TAC"); +("e","EXISTS_TAC"); +("m","MESON_TAC"); +("mt/a","ASM_MESON_TAC"); +("m/a","ASM_MESON_TAC"); +("am","ASM_MESON_TAC"); +("c","CONJ_TAC"); +("a","ASSUME_TAC"); +("g","GEN_TAC"); +("g/r","REPEAT GEN_TAC"); +("sc","SUBCONJ_TAC"); +("su","SUBST1_TAC"); +("si","SIMP_TAC"); +("si/a","ASM_SIMP_TAC"); +("asi","ASM_SIMP_TAC"); +("sg","SUBGOAL_THEN"); +("d","DISCH_TAC"); +("an","ANTS_TAC"); +("le","LET_TAC"); +("l","LET_TAC"); +("rat","REAL_ARITH_TAC"); +("p","POP_ASSUM"); +("p/r","REPEAT POP_ASSUM"); +("by","BY"); +("exv","EXISTSv_TAC"); +("mu", "MESON"); +("gv","X_GENv_TAC"); +("sym","GSYM"); +("specl","ISPECL"); +("spec","ISPEC"); +("o","o"); +("rr","REWRITE_RULE"); +("orr","ONCE_REWRITE_RULE"); +("pbc","PROOF_BY_CONTR_TAC"); +("taut","TAUT"); +("snd","snd"); +("asl","asl"); +("let","let"); +("in","in"); +("@","SELECT_TAC"); +("/\\","CONJ_TAC"); +("!","GEN_TAC"); +];; + +abbrev ("fexp","FULL_EXPAND_TAC");; +abbrev ("ispecl","ISPECL");; +abbrev ("ispec","ISPEC");; +abbrev ("t","t");; +abbrev ("beta","BETA_TAC");; +abbrev ("subconj","SUBCONJ_TAC");; +abbrev ("fassum","FIRST_ASSUM");; +abbrev ("fa","FIRST_ASSUM");; +abbrev ("d/r","REPEAT DISCH_TAC");; +abbrev ("comment","COMMENT");; +abbrev ("name","NAME");; +abbrev ("rot","ROT_TAC");; +unabbrev ("rau");; +abbrev ("arith","arith");; +abbrev ("aa","ARITH_TAC");; +abbrev ("rep","REPLICATE_TAC");; +abbrev ("simp","SIMP_TAC");; +abbrev ("contr","PROOF_BY_CONTR_TAC");; +abbrev ("set","SET_TAC");; +(* abbrev ("sth","SEARCH_THEN");;*) +abbrev ("ets","ENOUGH_TO_SHOW_TAC");; +abbrev ("mm","MATCH_MP");; +abbrev ("calc","Calc_derivative.CALC_ID_TAC");; +abbrev ("gm","GMATCH_SIMP_TAC");; +abbrev ("w","w");; +abbrev ("asl","asl");; +abbrev ("replicate","replicate");; +abbrev ("2","2");; +abbrev ("fxast","FIRST_X_ASSUM_ST");; +abbrev ("fast","FIRST_ASSUM_ST");; +abbrev ("@","@");; +abbrev ("map","map");; +abbrev ("dt/r","REPEAT DISCH_TAC");; +abbrev ("1","1");; +abbrev ("2","2");; +abbrev ("3","3");; +abbrev ("4","4");; +abbrev ("5","5");; +abbrev ("uni","uni");; +abbrev ("intro","INTRO_TAC");; +abbrev ("conj2","CONJ2_TAC");; +abbrev ("subconj2","SUBCONJ2_TAC");; +abbrev ("name","RENAME_FREE_VAR");; +abbrev ("rebind","REBIND_TAC");; +abbrev ("s","s");; +abbrev ("copy","COPY_TAC");; +abbrev ("exl","GEXISTL_TAC");; +abbrev ("orelse","ORELSE");; +abbrev ("t","t");; +abbrev ("typ","TYPIFY");; +abbrev ("vat","VECTOR_ARITH_TAC");; +abbrev ("smp","(C SUBGOAL_THEN MP_TAC)");; +abbrev ("sat","(C SUBGOAL_THEN ASSUME_TAC)");; +abbrev ("s1","(C SUBGOAL_THEN SUBST1_TAC)");; +abbrev ("e","");; +abbrev ("abbrev","TYPED_ABBREV_TAC");; +abbrev ("strip/r","REPEAT STRIP_TAC");; +abbrev ("act","act");; +abbrev ("ls","LOCAL_STEP_TAC()");; +abbrev ("ra","RULE_ASSUM_TAC");; +abbrev ("rule","RULE_ASSUM_TAC");; +abbrev ("asm","ASM_TAC");; +abbrev ("gtyp","TYPIFY_GOAL_THEN");; +abbrev ("setr","SET_RULE");; +abbrev ("nconj","nCONJ_TAC");; +abbrev ("nrt","NUM_REDUCE_TAC");; +abbrev ("grt","GEN_REWRITE_TAC");; +abbrev ("land","LAND_CONV");; +abbrev ("rand","RAND_CONV");; +abbrev ("odc","ONCE_DEPTH_CONV");; +abbrev ("the","the");; + +(* follow your nose, type "fyn" to use *) + +add_your_nose(match_g[`&a + &b`],"REWRITE_TAC[REAL_OF_NUM_ADD]","&m + &n");; +add_your_nose(match_g[`&a = &b`],"REWRITE_TAC[REAL_OF_NUM_EQ]","&m = &n");; +add_your_nose(match_g[`&x < &y`],"REWRITE_TAC[ REAL_OF_NUM_LT]","&x < &y");; +add_your_nose(match_g[`&x <= &y`],"REWRITE_TAC[ REAL_OF_NUM_LE]","&x <= &y");; + +add_your_nose(match_g[full `(!(x:A). t)`],"GEN_TAC","GEN_TAC");; +add_your_nose(match_g[`&0 < sqrt x`],"GMATCH_SIMP_TAC SQRT_POS_LT","&0 < sqrt _");; +add_your_nose(match_g[`&0 <= sqrt x`],"GMATCH_SIMP_TAC SQRT_POS_LE","&0 <= sqrt _");; +add_your_nose(match_g[`x IN {}`],"REWRITE_TAC[NOT_IN_EMPTY]","_ IN {}");; +add_your_nose(match_g[`sqrt x <= sqrt y`],"GMATCH_SIMP_TAC SQRT_MONO_LE_EQ","sqrt _ <= sqrt _");; +add_your_nose(match_g[`sqrt x < sqrt y`],"GMATCH_SIMP_TAC SQRT_MONO_LT_EQ","sqrt _ < sqrt _");; +add_your_nose(match_g[`&0 < x * y`],"GMATCH_SIMP_TAC REAL_LT_MUL_EQ","&0 < pos1 * pow2");; +add_your_nose(match_g[`x * x <= y * y`],"GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE_LE","x * x <= y * y");; +add_your_nose(match_g[`&0 <= x/y`],"GMATCH_SIMP_TAC REAL_LE_DIV","&0 <= x/y");; +add_your_nose(match_g[`&0 <= x * y`],"GMATCH_SIMP_TAC REAL_LE_MUL","&0 <= x *y");; +add_your_nose(match_g[`&0 <= x * x`],"REWRITE_TAC[ REAL_LE_SQUARE]","&0 <= x *y");; +add_your_nose(match_g[`sqrt x pow 2`],"GMATCH_SIMP_TAC SQRT_POW_2","sqrt x pow 2");; +add_your_nose(match_g[`x /z <= y`],"GMATCH_SIMP_TAC REAL_LE_LDIV_EQ","x /z <= y");; +add_your_nose(match_g[`&0 <= x pow 2`],"REWRITE_TAC[ REAL_LE_POW_2]","&0 <= x pow 2");; +add_your_nose(match_g[`x < sqrt y`],"GMATCH_SIMP_TAC REAL_LT_RSQRT","x < sqrt y");; +add_your_nose(match_g[`x /z <= y/ z`],"GMATCH_SIMP_TAC REAL_LE_DIV2_EQ","x/z <= y/z");; +add_your_nose(match_g[`sqrt(y*y)`],"GMATCH_SIMP_TAC Nonlinear_lemma.sqrtxx","sqrt(x*x)");; +add_your_nose(match_g[`x * y <= x * z`],"GMATCH_SIMP_TAC Real_ext.REAL_LE_LMUL_IMP","x * y <= x * z");; +add_your_nose(match_g[`x < y/ z`],"GMATCH_SIMP_TAC REAL_LT_RDIV_EQ","x < y/z");; +add_your_nose(match_g[`&0 < x/y`],"GMATCH_SIMP_TAC REAL_LT_DIV","&0 < x/y");; +add_your_nose(match_g[`sqrt x * sqrt y`],"GMATCH_SIMP_TAC (GSYM SQRT_MUL)","sqrt x * sqrt y");; +add_your_nose(match_g[`x * x < y * y`],"GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE","x * x < y*y");; +add_your_nose(match_g[`&0 < y pow 2`],"REWRITE_TAC[GSYM Trigonometry2.NOT_ZERO_EQ_POW2_LT]","&0 < x pow 2");; +add_your_nose(match_g[`x * y < x * z`],"GMATCH_SIMP_TAC REAL_LT_LMUL_EQ","x * y < x*z");; +add_your_nose(match_g[`sqrt x = &0`],"GMATCH_SIMP_TAC SQRT_EQ_0","sqrt x = &0");; + add_your_nose(match_g[`x <= y/z`],"GMATCH_SIMP_TAC REAL_LE_RDIV_EQ","x <= y/z");; + add_your_nose(match_g[`x * x < y * y`],"GMATCH_SIMP_TAC Misc_defs_and_lemmas.ABS_SQUARE","x * x < y * y");; +add_your_nose(match_g[`inv y <= inv x`],"GMATCH_SIMP_TAC REAL_LE_INV2","inv y <= inv x");; +add_your_nose(match_g[`&0 < inv x`],"GMATCH_SIMP_TAC REAL_LT_INV","&0 < inv x");; +add_your_nose(match_g[`&0 <= inv x`],"REWRITE_TAC[REAL_LE_INV_EQ]","&0 <= inv x");; +add_your_nose(match_g[`abs(a*b)`],"REWRITE_TAC[REAL_ABS_MUL]","abs(a*b)");; + + let gnose s t prompt = add_your_nose(match_g[t],"GMATCH_SIMP_TAC "^s,prompt);; + let wnose s t prompt = add_your_nose(match_g[t],"REWRITE_TAC["^s^"]",prompt);; + let mnose s t prompt = add_your_nose(match_g[t],"MATCH_MP_TAC "^s,prompt);; + +wnose "VECTOR_MUL_LCANCEL" `a % v = a % w` "a % v = a % w";; +wnose "VECTOR_MUL_ASSOC" `a % b % w` "a % b % w";; +wnose "VECTOR_MUL_LID" `&1 % w` "&1 % w`";; +wnose "Counting_spheres.AZIM_NN" `&0 <= azim a b c d` "0 <= azim";; +wnose "DIST_EQ_0" `dist(x,y) = &0` "dist(x,y) = &0";; +wnose "DIST_REFL" `dist(x,x) = &0` "dist(x,x) = &0";; +wnose "DIST_POS_LE" `&0 <= dist(x,y)` "&0 <= dist(x,y)";; +wnose "VECTOR_SUB_RZERO" `v - vec 0` "v - vec 0";; +wnose "GSYM DIST_NZ" `&0 < dist(x,y)` "&0 < dist(x,y)";; +wnose "NORM_POS_LE" `&0 <= norm x` "&0 <= norm x";; +wnose "NORM_MUL" `norm (a % w)` "norm (a % w)";; +wnose "DOT_EQ_0" `w dot w = &0` "w dot w = &0";; +wnose "GSYM REAL_EQ_SQUARE_ABS" `a pow 2 = b pow 2` "a pow 2 = b pow 2 <=> abs a = abs b";; +wnose "NORM_EQ_0" `norm v = &0` "norm v = &0";; +wnose "DOT_POS_LT" `&0 < x dot x` "&0 < x dot x";; +wnose "WITHINREAL_UNIV" `net within (:real)` "within (:real)";; +gnose "Merge_ineq.sqrtpow2" `sqrt x * sqrt x` "sqrt x * sqrt x";; +gnose "(GSYM Trigonometry2.POW2_COND)" `a pow 2 <= b pow 2` "a pow 2 <= b pow 2";; +wnose "POW_2_SQRT_ABS" `sqrt(x pow 2)` "sqrt (x pow 2)";; +mnose "REAL_LE_RSQRT" `y <= sqrt x` "y <= sqrt x";; + +end;; diff --git a/text_formalization/usr/thales/searching.hl b/text_formalization/usr/thales/searching.hl new file mode 100644 index 0000000..77804d5 --- /dev/null +++ b/text_formalization/usr/thales/searching.hl @@ -0,0 +1,1097 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* Author: Thomas C. Hales *) +(* Date: 2011-06-18 *) +(* ========================================================================== *) + + + +#load "str.cma";; + +flyspeck_needs "usr/thales/hales_tactic.hl";; + +module Searching = struct + + open Hales_tactic;; + + +(* + +? forces interpretation as a theorem. +?-n follows suggestion n. +%`x` performs type matching +%%[`x`;`y`] performs type matching. + +*) + +(* +TODO: + -Combine different search mechanisms with the same return type. + -Make a log of all searches, all bookmarked items, with context, for data mining purposes. + -integrate suggest. +*) + + +(* quicksilver style search for name matching. + ignore case and look for nonconsecutive letters. *) + +let unsplit d f = function + | (x::xs) -> List.fold_left (fun s t -> s^d^(f t)) (f x) xs + | [] -> "";; + +let match_sparse s u = + let re = Str.regexp_case_fold (".*"^(unsplit ".*" I ( explode s))) in + Str.string_match re u 0;; + +let maxl0 xs = try (end_itlist max xs) with _ -> 0;; + +(* +let ignore = Pervasives.ignore;; +*) + +(* ========================================================================== *) +(* TYPES *) + + +let types_of = Print_types.print_term_types;; +let type_of_thm = Print_types.print_thm_types;; +let type_of_goal = Print_types.print_goal_types;; +let goal_types = Print_types.print_goal_types;; + + +(* ========================================================================== *) +(* HELP *) + + +let hollight_dir = + (try Sys.getenv "HOLLIGHT_DIR" with Not_found -> Sys.getcwd());; + +(* let local_help_dir = Filename.concat flyspeck_dir "../help";; *) + +let local_help_dir = ".";; + +let helpdirs = ref [ + local_help_dir; + Filename.concat hollight_dir "Help" + ];; + +help_path := !helpdirs @ (!help_path);; (* hol-light help *) + +let help_grep pat = + let split = Str.split (Str.regexp "\n") in + let cmd s = process_to_string ("(cd " ^s^ "; ls | grep -v '~' | sed 's/.doc$//g' | grep '" ^pat^ "')") in + List.flatten (map ( split o cmd ) (!helpdirs));; + +(* +todo: if pat starts with regexp "-[a-z]+ " then it should be taken as a flags command. +Also make help_grep_local a flag, say -l for local. +*) + +let help_flag flag pat = + let constant_of_regexp ss = + let re = Str.regexp_case_fold (".*"^ss) in + let c = map fst (constants()) in + filter (fun s -> Str.string_match re s 0) c in + let help_grep_local pat = + let backup = !helpdirs in + let _ = helpdirs := [local_help_dir] in + let out = help_grep pat in + let _ = helpdirs := backup in + out in + let split = Str.split (Str.regexp "\n") in + let grep_s s = Printf.sprintf "(cd %s; ls | sed 's/.doc$//g' | grep -i '%s')" s pat in + let cmd s = process_to_string (grep_s s) in + match flag with + | 'i' -> List.flatten (map ( split o cmd ) (!helpdirs)) + | 'd' -> constant_of_regexp pat + | 'l' -> help_grep_local pat + | 'g' -> help_grep pat + | _ -> [" 'd' search constants";"'g' help_grep"; "'i' ignore case"; "'l' help_grep local dir"];; + + +(* +Example: +help_grep "ASM.*REWRITE";; +help_grep "^ASM_";; +help_grep "help";; +help_grep "RULE";; +help_grep "ARITH";; +help_grep "_TAC$";; +List.length (help_grep ".*");; + +help_flag '?' "";; + +help_flag 'd' ".*contin";; +help_flag 'd' ".*integr";; +help_flag 'd' ".*auchy";; +help_flag 'd' "at.*[ng]$";; +help_flag 'd' "cos" ;; + +*) + + + +(* ========================================================================== *) +(* SEARCH *) + +let def s = mk_comb(mk_var("",W mk_fun_ty aty), + mk_var(s,aty));; + +let searches = ref[];; + +let searcht n pat = + let _ = searches := (n,pat)::!searches in + let def_of_regexp ss = + let c = help_flag 'd' ss in + let strip d = (fst o dest_const o fst o dest_eq o concl) d in + let def_assoc = map (fun t -> (strip t,t)) (definitions()) in + map (fun s -> (s,assoc s def_assoc)) c in + let raw = match pat with + | Comb(Var("",_),Var(ss,_))::_ -> def_of_regexp ss + | _ -> search pat in + let m = min n (List.length raw) in + let s = sortlength_thml raw in + let r = fst (chop_list m s) in + let z = zip (0--(List.length r - 1)) r in + z;; + +let searchl ls pat = search_thml (term_match []) pat ls;; + +(* added Oct 2012 *) + +let save_searc = ref [];; + +let searc c n tl = + let u = snd(List.nth (searcht (n+1) tl) n) in + let _ = (save_searc := (c,u)::!save_searc) in + u;; + +(* tactics that search assumption list for match. + Deprecated. Replaced with FIRST_X_ASSUM_ST *) + +(* +let SEARCH_THEN pat ttac (asl,w) = + let thl = map snd (searchl asl pat) in + ttac thl (asl,w);; + +let FIRST_SEARCH_THEN pat ttac (asl,w) = + let thl = map snd (searchl asl pat) in + ttac (hd thl) (asl,w);; +*) + +let searchn n f s = snd(List.nth (searcht (n+1) f) n);; (* used for write-up of search results *) + +(* +Example: searcht 5 [def "cos"];; +searcht 5 [def "mul"];; +*) + +let research m = + let (n,pat) = hd (!searches) in + searcht (m) pat;; + +let search_results = ref [];; + +(* add stored searches to list *) +let augment_search_results ss = + let get s = try (Lib.assoc s !theorems) with _ -> failwith s in + let cs = map (fun (_,s,_,_) -> s) !search_results in + let ss = Lib.subtract ss cs in + let ns = List.length cs in + let ss = Lib.zip (ns -- (ns+List.length ss - 1)) ss in + let ss = map (fun (i,s) -> (i,s,get s,[])) ss in + !search_results @ ss;; + +let mark m = + let (n,pat) = hd (!searches) in + let (s,th) = snd(List.nth (searcht (1 + min n m) pat) m) in + let v = (List.length !search_results,s,th,pat) in + let _ = search_results := v::(!search_results) in + v;; + +let result n pat = + let ls = map (fun (_,s,th,_) -> (s,th)) !search_results in + let a = zip ls !search_results in + let sl = if pat = [] then ls else searchl ls pat in + let n' = min n (List.length sl) in + let ts = fst(chop_list n' (sl)) in + map (fun t -> assoc t a) ts;; + +let results pat = + let n = List.length (!search_results) in + result n pat;; + +let retrieve_search_number n = + let (_,s,_,_) = Lib.find (fun (c,_,_,_) -> (c=n)) !search_results in + s;; + +(* + + +let (srch,more,less,retrieve_search) = + let allsearch = ref [] in + + let tags = explode "abcdefghijklmnopqrstuvwxyz" in + let tag_num = ref 0 in + + let update () = (tag_num := (!tag_num + 1) mod (List.length tags)) in + + let current_search = ref [] in + let nextdisplayed = ref 0 in + + let ziptg tg a xs = + let z = zip (a--(List.length xs - 1 + a)) xs in + map (fun (i,x) -> (tg^(string_of_int i),x)) z in + + let sub_range tg a b xs = + let b' = min b (List.length xs - 1) in + let _ = (a <= b') or failwith "bad range" in + let _ = (0 <= a) or failwith "bad neg index" in + let bs = fst (chop_list (b'+1) xs) in + ziptg tg a (snd (chop_list a bs)) in + + let more () = + let tg = List.nth tags (!tag_num) in + let sr = sub_range tg (!nextdisplayed) (!nextdisplayed + 5) (!current_search) in + let _ = (nextdisplayed := 5 + !nextdisplayed) in + sr in + + let less () = + let _ = (nextdisplayed := max 0 (!nextdisplayed - 10)) in + more() in + + let srch pat = + let raw = search pat in + let _ = update() in + let _ = (nextdisplayed := 0) in + let _ = current_search := sortlength_thml raw in + let tg = List.nth tags (!tag_num) in + let _ = (allsearch := (tg,!current_search) :: !allsearch) in + more() in + + let retrieve_search tag item = + fst ( List.nth (Hol_pervasives.assoc tag !allsearch) item) in + + (srch,more,less,retrieve_search);; +*) + +(* ========================================================================== *) +(* STATS of WORD COUNTS, indexing all words in HOL LIGHT and FLYSPECK *) + + +let wc_tmpfile = Filename.temp_file "tmp_" ".txt";; + +let int_tmpfile = + let ss1 = process_to_string ("ls "^flyspeck_dir^"/*/*.hl") in + let ss2 = Str.split (Str.regexp "\n") ss1 in + let ss1 = process_to_string ("ls "^hollight_dir^"/*/*.ml") in + let ss2 = Str.split (Str.regexp "\n") ss1 @ ss2 in + let tmpfile = wc_tmpfile in + let _ = Sys.command("touch "^tmpfile) in + let _ = map (fun s -> Sys.command("cat "^ s^ " >> " ^ tmpfile)) ss2 in + ();; + +let word_counts() = + let sout = Str.split (Str.regexp "\n") + (process_to_string("cat "^wc_tmpfile^" | tr -C 'A-Z:a-z0-9_' '\n' | sort | uniq -c | sed 's/^ *//'")) in + let sout1 = map (Str.split (Str.regexp " ")) sout in + let sout2 = filter (fun t -> List.length t = 2) sout1 in + let sout3 = map (function | [a;b]-> (b,int_of_string a) | _ -> ("?",0)) sout2 in + sout3;; + +let word_count_list = word_counts();; + +(* stats of the word immediately following another word. + This can be useful in determining, for example, which theorems are used + with MATCH_MP_TAC. Or which tactics are used with REPEAT. *) + +let word_successor_counts word_successor = + let sed_pipe = Printf.sprintf "grep '%s ' %s | sed 's/^.*%s *//' | sed 's/^[^a-z.A-Z]*//g' | sed 's/ .*$//g' | tr -C 'A-Z.a-z_0-9' '\n' | sed 's/ //g' | sort | uniq -c | sed 's/^ *//'" + word_successor wc_tmpfile word_successor in + let sout = Str.split (Str.regexp "\n") + (process_to_string(sed_pipe )) in + let sout1 = map (Str.split (Str.regexp " ")) sout in + let sout2 = filter (fun t -> List.length t = 2) sout1 in + let sout3 = map (function | [a;b]-> (b,int_of_string a) | _ -> ("?",0)) sout2 in + sort (fun (_,a) (_,b) -> (a > b)) sout3;; + +(* inaccurate because constants and theorems with the same name are overcounted *) + +let thm_counts = + let alpha_thm = sort (<) (map fst !theorems) in + let rec build buff ats bts = match (ats,bts) with + | ([],_) -> buff + | (_,[]) -> buff + | (a::atss,(b,n)::btss) -> if (a=b) then build ((b,n)::buff) atss btss + else if (a>b) then build buff ats btss else build buff atss bts in + sort (fun (_,a) (_,b) -> (a > b)) (build [] (alpha_thm) word_count_list);; + +let quasi_tactic_list = + let tactic_wordlist = + ["REPEAT";"POP_ASSUM"; + "FIRST_X_ASSUM";"FIRST_ASSUM"; + "fun";"REAL_ARITH";"ARITH_RULE";"TAUT"] in + let tactic_list = (help_grep "TAC$") in + let then_list = (help_grep "THEN") in + tactic_wordlist @ tactic_list @ then_list;; + +let tactic_counts = sort (fun (_,a) (_,b) -> (a > b)) + (filter (fun (a,_) -> mem a (quasi_tactic_list)) word_count_list);; + + +(* ========================================================================== *) +(* DEPTH FUNCTIONS *) +(* each constant is defined in terms of other constants. + The depth of a constant is the length of its longest chain down to the primitives *) + +(* SLOW BUT POTENTIALLY USEFUL. START HERE. + + +let nub = Parse_ineq.nub;; + +let rec c_of buf = function + | Const _ as t -> nub (t:: buf) + | Comb (r,s) -> c_of (c_of buf r) s + | Abs (x,t) -> c_of buf t + | _ -> nub buf;; + +let def_assoc = + let r = (map (dest_eq o concl) (definitions())) in + let s = fst o dest_const in + map (fun (x,y) -> ( s x,nub (map s (c_of [] y)))) r;; + +let stm_depth = + let cache = ref [] in + let rec s_depth t = + try (assoc t !cache) + with _ -> + let rs = try (assoc t def_assoc) + with _ -> [] in + let _ = not(mem t rs) or failwith t in + let u = 1 + maxl0 (map s_depth rs) in + let _ = cache:= (t,u)::!cache in + u in + s_depth;; + +let sdef_assoc = map (fun (t,ul) -> ((t,stm_depth t),(map (fun u -> (u,stm_depth u)) ul))) + def_assoc;; + +let tm_depth t = + let c = map (fst o dest_const )(c_of [] t) in + let u = map (fun x -> (x,stm_depth x)) c in + let s = nub (sort (fun (_,a) (_,b) -> a > b) u) in + s;; + +(* ball park distance of goal *) + +let rec rec_hash n acc = function + | [] -> acc + | (a,_)::b -> if (n<=0) then acc else rec_hash (n-1) (Hashtbl.hash a ::acc) b;; + +let hash_depths = sort (<) o (rec_hash 3 []);; + +let rec sorted_meet k al bl = if (k<1) then true else (* look for at least k matches *) + (match bl with + | [] -> false + | b::bl' -> match al with + | [] -> false + | a::al' -> if (a = b) then + (sorted_meet (k-1) al' bl') + else + (if (a 0 | ((_,d)::_) -> d in + let data r = (de r,hash_depths r) in + let thl = map (fun (s,t) -> ((data o get_tm_depth) t,s,t) ) thml in + thl;; + +let depth_encoded_theorems = preprocess_theorems (!theorems);; + +let rec ballpark i j thml (d,hd) = + if (List.length thml < 80) then thml else + let k = max i j in + let (thml',i',j') = + if (k=i) then (filter (fun ((d',_),_,_)-> abs(d-d') < 1+k) thml,i-1,j) else + (filter (fun ((_,hd'),_,_) -> (sorted_meet (3-k) hd hd')) thml,i,j-1) in + if (List.length thml' < 20) then thml else ballpark i' j' thml' (d,hd);; + +let ballpark_theorems (_,w) = + let thml = depth_encoded_theorems in + let get_tm_depth = (tm_depth o last o strip_imp o snd o strip_forall ) in + let de = function | [] -> 0 | ((_,d)::_) -> d in + let data r = (de r,hash_depths r) in + map (fun (_,s,t)->(s,t)) (ballpark 3 3 thml (data (get_tm_depth w)));; + + +(* fails on depth 0 *) + +let drop_depth_once ul = + List.flatten (map (fun u -> assoc u sdef_assoc) ul);; + +let rec drop_depth_to d ul = + let (hi,lo) = partition (fun (_,h) -> (h>d)) ul in + if hi = [] then ul else + let hi' = drop_depth_once hi in + (nub ((drop_depth_to d hi') @ lo));; + +(* metric symbol distance, an estimate of the distance between two lists of symbols. + dsofar = distance so far. + common = list of symbols and their shallowings that the two lists have already in common. + depth_weight is a heuristic weighting: matches should increase distance less than mismatches. +*) + +let rec msd dsofar common al bl = + if (al=[]) && (bl=[]) then dsofar else + let depth_weight = 10 in + let d = maxl0 (map snd (al @ bl)) in + let c = ( drop_depth_to d common) @ (intersect al bl) in + let al' = subtract al c in + let bl' = subtract bl c in + let dsofar' = dsofar +. float_of_int( List.length ((intersect al c) @ (intersect bl c)) + + depth_weight * List.length (al' @ bl')) in + if (d <=1) then dsofar' else + let al'' = drop_depth_to (d-1) al' in + let bl'' = drop_depth_to (d-1) bl' in + msd dsofar' c al'' bl'';; + +let metric_symbol_distance bl cl = + let tt tl = List.flatten (map tm_depth tl) in + if (List.length bl = 1)&&(List.length cl=1)&& (aconv (hd bl) (hd cl)) then 0.0 + else msd 10.0 [] (tt bl) (tt cl);; + +let nearest_thm_to_goal (asl,w) = + let tt tl = List.flatten (map (tm_depth o concl) tl) in + let common = tt (map snd asl) in + let thl = map (fun (s,t) -> ((tm_depth o snd o strip_forall o concl )t,s,t) ) (!theorems) in + let r = map (fun (tl,s,t) -> (tl,s,t,msd 0.0 common (tm_depth w) tl)) thl in + (sort (<) r);; + + +let thm_depth = tm_depth o concl;; + +let search_depth = + let dthm = map (fun (s,t) -> (maxl0 (map snd(thm_depth t)),(s,t))) !theorems in + let m tml = maxl0 (map snd (List.flatten (map (tm_depth) tml))) in + let fthm tml = map snd (filter (fun (x,(_,_)) -> (x <=m tml)) dthm) in + fun tml -> searchl (fthm tml) tml;; + +END SLOW BUT POTENTIALLY USEFUL +*) + +(* ========================================================================== *) +(* EVAL AND PROOF STACK *) + +(* +eval_command comes from + +http://solaria.dimino.org/cgi-bin/darcsweb.cgi?r=peps;a=headblob;f=/src/core/peps_top.ml +License: BSD3 + +If the expression is syntactically correct +and the evaluation raises an exception, then the return value is true. +*) + + +let eval_command ?(silent=false) command = + let buffer = Buffer.create 512 in + let pp = Format.formatter_of_buffer buffer in + Format.pp_set_margin pp max_int; + try + let _ = + Toploop.execute_phrase (not silent) pp + (!Toploop.parse_toplevel_phrase (Lexing.from_string (command ^ ";;"))) + in + (true, Buffer.contents buffer) + with exn -> + let save = !Toploop.parse_use_file in + Toploop.parse_use_file := (fun _ -> raise exn); + Pervasives.ignore (Toploop.use_silently pp "/dev/null"); + Toploop.parse_use_file := save; + (false, Buffer.contents buffer);; + +(* eval_command ~silent:false "g `x=y`";; *) + +type proof_record = Tax of string*int*tactic | Bax | Gax of term*string;; + +let proof_record =ref [];; +let tactic_cache = ref (fun () -> ALL_TAC);; + +(* we evaluate the tactic outside eval_command, so that we can catch exceptions *) + +let eval_tactic = + fun s -> + let (b,r) = eval_command ~silent:false + ("tactic_cache := (fun () -> ("^s^"));;") in + let _ = b or (print_string (r^"\n"^s^"\n"); failwith "bad input string") in + let t= (!tactic_cache)() in + let (_,gs,_) ::_ = !current_goalstack in + let i = List.length gs in + let v = Hol_pervasives.e(t) in + let _ = proof_record := Tax (s,i,t)::!proof_record in + v;; + +(* +let string_of_frees t = + let u = (map (fst o dest_var) o frees) t in + (unsplit " " I) u;; +*) + +let eval_goal t = + let _ = print_goalstack (Hol_pervasives.g(t)); + proof_record := Gax (t,process_to_string "date")::!proof_record; + warn (has_stv t) "?type in goal" in + ();; + +let eval_back () = + let _ = proof_record := Bax::!proof_record in Hol_pervasives.b();; + +(* +eval_goal `1 + 1 = 2`;; +eval_tactic "REPEAT STRIP_TAC";; +eval_back();; +eval_tactic "ARITH_TAC";; +eval_tactic "REWRITE_TAC[TRUTH]";; +*) + +let string_starts_with u s = + (String.length u <= String.length s) && (u = String.sub s 0 (String.length u));; + +let rec strs_of_proof_records ind skip buf = + let by t s = if t && (not (string_starts_with "BY" s)) then "BY("^s^")" else s in + function + [] -> buf + | Gax _ :: xs -> buf + | Tax (s,i,_) :: xs -> + let indent = String.make (2*i) ' ' in + if (skip=0) then strs_of_proof_records i skip ((indent^(by (i>ind) s))::buf) xs + else strs_of_proof_records ind (skip-1) buf xs + | Bax :: xs -> strs_of_proof_records ind (skip+1) buf xs;; + +let string_of_proof () = + let ss = strs_of_proof_records 0 0 [] !proof_record in + "\n[\n"^unsplit ";\n" I (ss) ^"\n]\n";; + +let print_proof () = + print_string (string_of_proof());; + +let string_of_proof_k k () = + let ss = strs_of_proof_records 0 0 [] !proof_record in + let k' = min k (List.length ss) in + let ss' = (fst(chop_list k' (List.rev ss))) in + if (List.length ss' = 0) then "" + else if (List.length ss' = 1) then hd(ss') + else "\n[ ... most recent steps ...\n"^unsplit ";\n" I (List.rev ss') ^"\n]\n";; + +let rec split_proof_record acc cur = function + | [] -> if (List.length cur > 0) then acc @[cur] else acc + | Gax (_,_) as a :: xs -> + let acc' = acc @ [cur @ [a]] in + split_proof_record acc' [] xs + | a :: xs -> split_proof_record acc (cur @ [a]) xs;; + +let gax() = + let u = split_proof_record [] [] (!proof_record) in + let j = zip u (0-- (List.length u - 1)) in + let k = map (fun (u,z) -> (z,List.length u,last u)) j in + k;; + + +split_proof_record [] [] (!proof_record);; + +(* +print_string (string_of_proof());; +*) + + +(* ========================================================================== *) +(* SUGGEST TACTIC *) + + + +(* term matching without higher order matches *) + + +let term_match_no_ho pat u = + let (_,b,c) = (term_match[] pat u) in + let v = instantiate ([],b,c) pat in + aconv v u or failwith "no match";; + +let match_g_no_ho pat (_,w) = not(search_thml term_match_no_ho pat [("", ASSUME w)] = []);; + +let match_g pat (_,w) = not(search_thml (term_match[]) pat [("", ASSUME w)] = []);; + +let match_asm pat (asl,_) = not(search_thml term_match_no_ho pat asl = []);; + +(* new version, july 2012 *) + +let noses = ref [];; + +let add_your_nose x = (noses := x::!noses);; + +let follow_your_nose_string() = + let aslw = top_realgoal() in + let n = + try + let (_,_,a) = find (fun (p,_,_) -> p aslw) !noses + in a + with Failure _ -> "" in + n;; + +let fyn () = + let aslw = top_realgoal() in + let (_,t,_) = find (fun (p,_,_) -> p aslw) !noses in + t;; + +let follow_your_nose_string_list() = + let aslw = top_realgoal() in + let m = filter (fun (p,_,_) -> p aslw) !noses in + let m2 = map (fun ((_,_,a),b) -> ("{"^string_of_int b ^":"^a^"}")) (zip m (0--((List.length m) -1))) in + Flyspeck_lib.join_comma m2;; + +let fynlist k = + let aslw = top_realgoal() in + let m = filter (fun (p,_,_) -> p aslw) !noses in + let l = List.length m in + let _ = k < l or failwith ("fyn length = "^string_of_int k ^ " "^string_of_int l) in + let (_,t,_) = List.nth m k in + t;; + + +(* new version, march 2012 *) + +let nub = Parse_ineq.nub;; + + +let rec c_of buf = function + | Const _ as t -> nub (t:: buf) + | Comb (r,s) -> c_of (c_of buf r) s + | Abs (x,t) -> c_of buf t + | _ -> nub buf;; + +let rewrite_tags = ref [];; +let remove_rewrite_tag s = + rewrite_tags:= filter (fun (_,_,s',_) -> not (s =s')) !rewrite_tags;; + +let st_of tm = map (fst o dest_const) (c_of [] tm);; +let add_rewrite_tag (s,th) = + let thl = mk_rewrites true th [] in + let tml = map concl thl in + let wd tm = if (is_imp ( tm)) then (snd(dest_imp( tm))) else tm in + let tml = map (fst o dest_eq o wd) tml in + let stl = map st_of tml in + let zl = map (fun (a,b)-> (a,b,s,th)) (zip tml stl) in + let _ = rewrite_tags := zl @ !rewrite_tags in + ();; + +let add_rewrite_stag s = + let _ = (can (assoc s) !theorems) or failwith (s ^ " not found ") in + add_rewrite_tag (s,assoc s !theorems);; + +let refresh_rewrite_stag s = + let _ = remove_rewrite_tag s in + add_rewrite_stag s;; + +let refresh() = + let _ = map (fun (_,s,_,_) -> refresh_rewrite_stag s) !search_results in + ();; + +let write m = + let u = mark m in + let (_,s,_,_) = u in + let _ = refresh_rewrite_stag s in + u;; + +let lookup_rewrite_tags (asl,w) = + let sw = st_of w in + let f1 = filter (fun (_,sl,_,_) -> (subset sl sw)) !rewrite_tags in + let ml = filter (fun (pat,_,_,_) -> match_g [pat] (asl,w)) f1 in + ml;; + +let rewrite_suggest() = + let rawl = lookup_rewrite_tags (top_realgoal()) in + zip (0--(List.length rawl - 1)) (map (fun (_,_,s,th) -> (s,th)) rawl);; + +let suggest = rewrite_suggest;; + +(* let assum t = mk_comb(mk_var("",W mk_fun_ty (type_of t)),t);; *) + +(* + +trigger pattern; +English text; +prompt; +tactic; + +*) + +let tactic_patterns = ref [];; + +let add_tactic_pattern t = (tactic_patterns := t::!tactic_patterns);; + +let tactic_suggest _ = + let s = filter (fun (a,_,_,_) -> a (top_realgoal())) !tactic_patterns in + zip (0-- (List.length s -1) ) s;; + +let print_suggest sg = + let print_one (i,(_,_,s,_)) = (print_int i; print_string (": "^s)) in + map (print_one) sg;; + +(* +let s () = let sg = suggest() in Pervasives.ignore(print_suggest sg);; +*) + +let expand_suggest s = + let sg = tactic_suggest() in + let n = (int_of_string s) in + let r = Lib.assoc n sg in + (fun (_,s,_,_) -> s) r;; + +(* +let eh n = let (_,(_,_,_,tac)) = List.nth (suggest()) n in e(tac());; +*) + +(* let follow n = let (_,(_,_,_,tac)) = List.nth (suggest()) n in tac();; *) + +(* +let rewrite_suggest = [ + ([`x IN {y}`],"IN_SING",IN_SING); +];; + +let rewrites _ = + let s = filter (fun (a,_,_) -> match_g a (top_realgoal())) rewrite_suggest in + zip (0-- (List.length s -1) ) s;; +*) + +(* ========================================================================== *) +(* ABBREVIATIONS *) + +let matching_tactics s = + filter (match_sparse s) (map fst tactic_counts);; + +let tactic_abbreviations = ref [];; + +let abbrev u = (tactic_abbreviations:= (u::!tactic_abbreviations));; + +let unabbrev s = (tactic_abbreviations:= (filter (fun (s',_) -> (s <> s')) !tactic_abbreviations));; + +let thm_abbreviations = ref[("elim","IN_ELIM_THM");("morgan","DE_MORGAN_THM")];; + +let thm_abbrev s = (let _ = thm_abbreviations:= s::!thm_abbreviations in s);; + +thm_abbrev ("empty","EMPTY");; + +let expansive_thms = + let full = (map fst thm_counts) in + fun op s -> + let searches = map (fun (_,s,_,_) -> s) !search_results in + op (match_sparse s) (searches @ full);; + +(* +?n to get marked theorem n. +?abbrev to abbreviate. +*) + +let expand_thm = + let charset = (explode "abcdefghijklmnopqrstuvwxyz0123456789'_.") in + let number s = + let n = int_of_string s in + retrieve_search_number n in + let search_thm s = + let c = s.[0] in + fst(Hol_pervasives.assoc c (!save_searc)) in + let abbreviable s = (subset (explode s) charset) in + let unabbrev s = + let _ = not(abbreviable s) or failwith "abbrev" in s in + let exact_thm s = (Pervasives.ignore (Hol_pervasives.assoc s !theorems); s) in + let assoct s = Hol_pervasives.assoc s !thm_abbreviations in + let match_t = expansive_thms Lib.find in + fun s-> tryfind (fun f -> f s) [unabbrev;search_thm;number;exact_thm;assoct;match_t;I];; + +(* +%`x` to expand types of term +%%[`x`;`y`] to expand types of term list. +*) + +(* deprecated HASH: *) + +(* +let el_to_hash s i = + let el_assoc = [ + ("u","HASH_UNDISCH_TAC"); + ("r","HASH_RULE_TAC"); + ("k","HASH_KILL_TAC"); + ("p","HASH_COPY_TAC"); + ("c","HASH_CHOOSE_TAC"); + ("x","HASH_X_CHOOSE_TAC"); + ("a","HASH_ASM_REWRITE_TAC")] in + let tac = assoc s el_assoc in + let h = el_hash i (top_realgoal()) in + tac ^ " " ^ (string_of_int h);; +*) + +let el_to_hash s i = failwith "el_to_hash has been deprecated";; + +let break_init init s = + let l_init = String.length init in + let _ = (l_init <= String.length s) or failwith "length mismatch break_init" in + let _ = (String.sub s 0 l_init = init) or failwith "mismatch break_init" in + String.sub s (l_init) (String.length s - l_init);; + +let unabbrev_string = + let charset = (explode "abcdefghijklmnopqrstuvwxyz0123456789'_/\\!?@") in + let abbreviable s = (subset (explode s) charset) in + let unabbrev s = + let _ = not(abbreviable s) or failwith "abbrev" in s in + let assoc_thm s = (Pervasives.ignore (Hol_pervasives.assoc s !theorems); s) in + let assoct s = Hol_pervasives.assoc s !tactic_abbreviations in + let assoc_sans_t s = + let len = String.length s in + let _ = (len > 1) or failwith "too short" in + let _ = (s.[len-1]= 't') or failwith "final char t" in + assoct (String.sub s 0 (len -1)) in + let hash s = + let rest = break_init "el" s in + let c = String.sub rest 0 1 in + let n = int_of_string (String.sub rest 1 (String.length rest - 1)) in + el_to_hash c n in + let tac s = + let v = matching_tactics s in + if (List.length v > 0) then hd v else s in + let fynose s = + if (s = "fyn") then fyn () + else + let _ = String.length s = 4 or failwith "fynose" in + let _ = "fyn" = String.sub s 0 3 or failwith "fynose2" in + let k = int_of_string (String.sub s 3 1) in + fynlist k in + let deprecated_fynose s = + let _ = (s = "fyn") or failwith "fynose" in fyn () in + fun s-> tryfind (fun f -> f s) [unabbrev;assoc_thm;fynose;assoct;assoc_sans_t;hash;hash;tac;];; + + + +(* ========================================================================== *) +(* PARSING INPUT *) + +type mtoken = + | M_comment + | M_string of string + | M_hol_term of string + | M_semicolon + | M_white of string + | M_text of string + | M_query of string + | M_lparen + | M_rparen + | M_lbracket + | M_rbracket + | M_env of int + (* not implemented : *) + | M_local of string + | M_asm of int ;; + +let some_look p = + function + [] -> raise Noparse + | [_] -> raise Noparse + | (h1::h2::t) -> if p (h1,h2) then (h1,h2::t) else raise Noparse;; + +let rec m_lex = + let stringchar = + some (fun i -> i <> "\"") in + let string = a "\"" ++ many stringchar ++ a "\"" >> + (fun ((_,s),_) -> M_string (implode s)) in + let hol_term_char = + some (fun i -> i <> "`") in + let hol_term = a "`" ++ many hol_term_char ++ a "`" >> + (fun ((_,s),_) -> M_hol_term (implode s)) in + let nonendcomment = (some_look (fun (h1,h2) -> h1 <> "*" or h2 <> ")")) in (* comment nesting unrecognized *) + let comment = a "(" ++ (a "*") ++ many nonendcomment ++ a "*" ++ a ")" + >> (fun _ -> M_comment) in + let semi = a ";" >> (fun _ -> M_semicolon) in + let textchar = some (fun i -> not (mem i (explode " %\t\n;()[]`\""))) in + let text = atleast 1 (textchar) >> (fun s -> M_text (implode s)) in + let numerical = (some (fun i -> (mem i (explode "0123456789")))) in + let asm = a "_" ++ atleast 1 numerical >> (fun (_,s) -> M_asm (int_of_string (implode s))) in + let local = a "_" ++ atleast 1 (textchar) >> (fun (_,s) -> M_local (implode s)) in + let query = a "?" ++ atleast 1 (textchar) >> (fun (_,s) -> M_query (implode s)) in + let lparen = a "(" >> (fun _ -> M_lparen) in + let rparen = a ")" >> (fun _ -> M_rparen) in + let lbracket = a "[" >> (fun _ -> M_lbracket) in + let rbracket = a "]" >> (fun _ -> M_rbracket) in + let menv = atleast 1 (a "%") >> (fun s -> M_env (List.length s)) in + let white = atleast 1 (some isspace) >> (fun s -> M_white (implode s)) in + many (some isspace) ++ + many(comment || string || hol_term || semi || menv || lparen || rparen || + lbracket || rbracket || asm || query || local || text || white) ;; + +let rec strip_space = function + | M_comment :: xs -> strip_space xs + | M_white _ :: xs -> strip_space xs + | M_semicolon :: xs -> strip_space xs + | xs -> xs;; + +let end_strip_space = List.rev o strip_space o List.rev o strip_space;; + +(* + +let test1 = " (* note *) _t _44 __33 `1 /\\ [3] (* 42` (* hi *) ; [lade] da(%% (\"quote\";)) then (* c *) \t\n ";; +let test2 = " (* hi *) (* (* hi again *) *) \"quote\" `&1 + &1`;; (* there *) ;; ";; +(end_strip_space o snd o fst o m_lex o explode) test1;; +implode;; +many (some isspace);; +test1;; +unabbrev test1;; + +*) + + + + +(* +let unabbrev_thm s = + let tg = String.sub s 0 1 in + let item = int_of_string (String.sub s 1 (String.length s - 1)) in + retrieve_search tg item;; +*) + +let unabbrev_token = function + | M_comment -> "" + | M_string s -> "\""^s^"\"" + | M_hol_term s -> "`"^s^"`" + | M_semicolon -> ";" + | M_white s -> " " + | M_text s -> unabbrev_string s + | M_lparen -> "(" + | M_rparen -> ")" + | M_lbracket -> "[" + | M_rbracket -> "]" + | M_query s -> if (s.[0]='-') then expand_suggest (String.sub s 1 (String.length s - 1)) + else expand_thm s + | M_env level -> if (level <=1) then " env w" else " envl w" + | M_local s -> ("loc_"^s) + | M_asm i -> ("asm_"^(string_of_int i));; + +let which_asms = mapfilter (function | M_asm i -> i | _ -> failwith "");; + +let has_env = can (Lib.find (function M_env _ -> true | _ -> false));; + + +let really_expand s = + let ((_,r),rest) = m_lex (explode s) in + let _ = (rest=[]) or (failwith ("unparsed data : " ^ (implode rest))) in + let r = end_strip_space r in + let rs = map unabbrev_token r in + let u = unsplit "" I rs in + let which = setify( which_asms r) in + let gets = map (fun i ->Printf.sprintf " let asm_%d = snd(List.nth (List.rev asl) %d ) in " i i) which in + let v = unsplit "" I gets in + let envA,envB = if (has_env r) or (List.length which > 0) then + "GOAL_TERM (fun w -> (","))" else "","" in + (envA^v^u^envB);; + + +(* +let escape s = + let ss = Str.split (Str.regexp "\"") s in + let s = unsplit "\\\"" I ss in + let ss = Str.split (Str.regexp "\\ ") s in + let s = unsplit "\\\\ " I ss in + s;; +*) + +let p() = + let history = 5 in + let _ = print_string (string_of_proof_k history ()) in + if ((!current_goalstack=[])) then print_string "There is no current goal." + else + let (_,gl,_) = hd !current_goalstack in + let ns = follow_your_nose_string_list() in + if (gl = []) then print_string "\nNo subgoal" + else + (Print_types.print_goal_var_overload() ; + print_goalstack (!current_goalstack); + print_string ("\n >>>last step: "^ (string_of_proof_k 1 ()) ^ "\n"); + print_string (" >>>total: "^(string_of_int (length gl)) ^ "\n"); + if not(ns="") then print_string ("Follow your nose: "^ns) + );; + +(* +let eval_tactic_abbrev s = + try( + let i = String.index s ',' in + let pre = String.sub s 0 i in + let post = String.sub s (i+1) (String.length s - (i+1)) in + ((unabbrev_tactic pre)^" "^post) + ) + with _ -> s in + (* let _ = print_string (String.escaped expand_s) in *) + let _ = eval_tactic (expand_s) in + p();; +*) + +let eval_tactic_abbrev2 s = + let sexp = really_expand s in + let _ = report sexp in + let _ = eval_tactic (sexp) in + p();; + +let blank_line = Str.regexp ("^ *$");; + +let eval_tactic_lines s = + let ss = Str.split (Str.regexp "\n") s in + let one_line s1 = + let sepx = try (really_expand s1) with _ -> (failwith "expansion error : "^s1) in + if (Str.string_match blank_line sepx 0) then () + else + try (Pervasives.ignore(eval_tactic sepx)) + with _ -> failwith ("tactic failure : "^s1^" >>> "^sepx) in + let _ = do_list one_line ss in + p();; +(* emacs: hol-light-tactic-replay "\C-c\C-r" *) + +let e_abbrev = eval_tactic_abbrev2;; + +let g = eval_goal;; + +let b() = + let _ = eval_back() in p();; + +let bb k = + let _ = map eval_back (replicate () k) in p();; + +let back_to s = + let r = List.rev (strs_of_proof_records 0 0 [] !proof_record) in + let re = Str.regexp_case_fold (".*"^s) in + let searcher a = Str.string_match re a 0 in + let z = find searcher r in + let _ = report z in + let i = index z r in + bb i;; + +(* +let directive_abbreviations= ref[ + ("-b",eval_back); + ("-?",fun () -> + let s = map snd tactic_counts in + let s1 = unsplit ": " +];; +*) + +(* EMACS BINDINGS: +see hol-light-mode.el + +eval_tactic_lines -> hol-light-tactic-replay "\C-c\C-r" +(local-set-key "\C-ct" 'hol-light-goal-types) +(local-set-key "\C-c\C-y" 'hol-light-type-region) + (local-set-key "\C-cr" 'hol-light-eval-region) + +*) + + + +end;; diff --git a/text_formalization/volume/vol1.hl b/text_formalization/volume/vol1.hl new file mode 100644 index 0000000..e3bfd06 --- /dev/null +++ b/text_formalization/volume/vol1.hl @@ -0,0 +1,2274 @@ +(* ========================================================================== *) +(* FLYSPECK - BOOK FORMALIZATION *) +(* *) +(* Chapter: Volume *) +(* Author: Nguyen Tat Thang *) +(* Date: 2010-02-09 *) +(* ========================================================================== *) + + + + +flyspeck_needs "general/prove_by_refinement.hl";; + +(* flyspeck_needs "trigonometry/trig2.hl";; *) + + + + +module Vol1 = struct + + + let prove_by_refinement = Prove_by_refinement.prove_by_refinement;; + + let BY = Hales_tactic.BY;; + + +(* DEPRECATED 2013-05-25. +let sphere= new_definition`sphere x=(?(v:real^3)(r:real). (r> &0)/\ (x={w:real^3 | norm (w-v)= r}))`;; +*) + +(* old definitions added by thales Nov 11, 2009 *) + +(* +let radial_norm = new_definition `radial_norm r (x:real^A) C <=> (C SUBSET normball x r) /\ (!u. (x+u) IN C ==> (!t.(t> &0) /\ (t* norm u < r)==>(x+ t % u) IN C))`;; +*) + +let radial_norm_deprecated = new_definition `(radial_norm:real->real^A->(real^A->bool)->bool) = radial`;; + +let radial_norm = prove_by_refinement( + `!r x C. radial_norm r (x:real^A) C <=> + C SUBSET normball x r /\ + (!u. x + u IN C + ==> (!t. t > &0 /\ t * norm u < r ==> x + t % u IN C))`, + (* {{{ proof *) + [ + (REWRITE_TAC[radial_norm_deprecated;NORMBALL_BALL;Sphere.radial]) + ]);; + (* }}} *) + +let RADIAL_VS_RADIAL_NORM = prove_by_refinement ( + `!(x:real^A) r C. radial r x C <=> radial_norm r x C`, +[ + (REWRITE_TAC[radial_norm_deprecated]) +]);; + +(* +let eventually_radial_norm = new_definition + `eventually_radial_norm x C <=> (?r. (r> &0) /\ radial_norm r x (C INTER normball x r))`;; +*) + + let eventually_radial_norm_deprecated = new_definition + `(eventually_radial_norm:real^A ->(real^A->bool)->bool) = eventually_radial`;; + +let eventually_radial_norm = prove_by_refinement( + `!C (x:real^A). eventually_radial_norm x C <=> + (?r. r > &0 /\ radial_norm r x (C INTER normball x r)) `, + (* {{{ proof *) + [ + REWRITE_TAC[eventually_radial_norm_deprecated;radial_norm_deprecated;Sphere.eventually_radial;NORMBALL_BALL] + ]);; + (* }}} *) + +let c_cone = new_definition `c_cone (v,w:real^3, r:real)={x:real^3 | ((x-v) dot w = norm (x-v)* norm w* r)}`;; + +let null_equiv = new_definition `null_equiv (s,t :real^3->bool)=(? (B:real^3-> bool). NULLSET B /\ + ((s DIFF t) UNION (t DIFF s)) SUBSET B)`;; + +let VOLUME_PROPS_MEASURABLE = prove_by_refinement( + `!C. measurable C ==> vol C >= &0`, + (* {{{ proof *) + [ + ASM_REWRITE_TAC[volume_props] + ]);; + (* }}} *) + +let VOLUME_PROPS_NULLSET = prove_by_refinement( + ` (!Z. NULLSET Z ==> vol Z = &0)`, + (* {{{ proof *) + [ + ASM_REWRITE_TAC[volume_props] + ]);; + (* }}} *) + +let VOLUME_PROPS_SDIFF = prove_by_refinement( + ` (!X Y. + measurable X /\ measurable Y /\ NULLSET (SDIFF X Y) + ==> vol X = vol Y)`, + (* {{{ proof *) + [ + ASM_REWRITE_TAC[volume_props] + ]);; + (* }}} *) + + +let VOLUME_PROPS_SCALE = prove_by_refinement( + `(!X t. + measurable X /\ measurable (IMAGE (scale t) X) + ==> vol (IMAGE (scale t) X) = abs (t$1 * t$2 * t$3) * vol X)`, + (* {{{ proof *) + [ + ASM_REWRITE_TAC[volume_props] + ]);; + (* }}} *) + +let VOLUME_PROPS_IMAGE = prove_by_refinement( + `(!X v. measurable X ==> vol (IMAGE ((+) v) X) = vol X)`, + (* {{{ proof *) + [ + ASM_REWRITE_TAC[volume_props] + ]);; + (* }}} *) + +let VOLUME_PROPS_SOLID_TRIANGLE = prove_by_refinement( + `(!v0 v1 v2 v3 r. + r > &0 /\ ~coplanar {v0, v1, v2, v3} + ==> vol (solid_triangle v0 {v1, v2, v3} r) = + vol_solid_triangle v0 v1 v2 v3 r)`, + (* {{{ proof *) + [ + ASM_REWRITE_TAC[volume_props] + ]);; + (* }}} *) + +let VOLUME_PROPS_CONV0 = prove_by_refinement( + ` (!v0 v1 v2 v3. vol (conv0 {v0, v1, v2, v3}) = vol_conv v0 v1 v2 v3)`, + (* {{{ proof *) + [ + ASM_REWRITE_TAC[volume_props] + ]);; + (* }}} *) + +let VOLUME_PROPS_FRUSTT = prove_by_refinement( + ` (!v0 v1 v2 v3 h a. + ~collinear {v0, v1, v2} /\ + ~collinear {v0, v1, v3} /\ + h >= &0 /\ + a > &0 /\ + a <= &1 + ==> vol (frustt v0 v1 h a INTER wedge v0 v1 v2 v3) = + vol_frustt_wedge v0 v1 v2 v3 h a)`, + (* {{{ proof *) + [ + ASM_REWRITE_TAC[volume_props] + ]);; + (* }}} *) + +let VOLUME_PROPS_CONIC_CAP = prove_by_refinement( + ` (!v0 v1 v2 v3 r c. + ~collinear {v0, v1, v2} /\ + ~collinear {v0, v1, v3} /\ + r >= &0 /\ + c >= -- &1 /\ + c <= &1 + ==> vol (conic_cap v0 v1 r c INTER wedge v0 v1 v2 v3) = + vol_conic_cap_wedge v0 v1 v2 v3 r c)`, + (* {{{ proof *) + [ + ASM_REWRITE_TAC[volume_props] + ]);; + (* }}} *) + +let VOLUME_PROPS_RECT = prove_by_refinement( + ` (!a b. vol (rect a b) = vol_rect a b) `, + (* {{{ proof *) + [ + ASM_REWRITE_TAC[volume_props] + ]);; + (* }}} *) + +let VOLUME_PROPS_NORMBALL = prove_by_refinement( + ` (!v0 v1 v2 v3 r. + ~collinear {v0, v1, v2} /\ ~collinear {v0, v1, v3} /\ r >= &0 + ==> vol (normball v0 r INTER wedge v0 v1 v2 v3) = + vol_ball_wedge v0 v1 v2 v3 r)`, + (* {{{ proof *) + [ + ASM_REWRITE_TAC[volume_props] + ]);; + (* }}} *) + + + +(*----------------------------------------------------------*) + +(*To prove Lemma 4.2*) + + + +let th1= prove(`!a b c. [a; b; c]= CONS a (CONS b [c])`,REPEAT GEN_TAC THEN MESON_TAC[]);; + +let dodai=prove(`!a b c. LENGTH [a; b; c] = 3`,REPEAT GEN_TAC THEN REWRITE_TAC[LENGTH;th1] THEN ARITH_TAC);; + +let th3=prove(`!i. (1<=i /\ i<= 3)==>(vec 1:real^3)$i= &1`,GEN_TAC THEN DISCH_TAC THEN (ASM_SIMP_TAC[VEC_COMPONENT;DIMINDEX_3]));; + +let identity_scale=prove(`scale (vec 1)= I`,REWRITE_TAC[FUN_EQ_THM] THEN GEN_TAC THEN REWRITE_TAC[I_THM] THEN REWRITE_TAC[scale] THEN REWRITE_TAC[vector] THEN SIMP_TAC[dodai] THEN REWRITE_TAC[CART_EQ] THEN REWRITE_TAC[DIMINDEX_3] THEN GEN_TAC THEN DISCH_TAC THEN ASM_SIMP_TAC[LAMBDA_BETA;DIMINDEX_3] THEN MP_TAC (ARITH_RULE `(1 <= i /\ i <= 3) <=> ( i=1 \/ i=2 \/ i=3)`) THEN ASM_REWRITE_TAC[] THEN REPEAT STRIP_TAC THENL [ASM_REWRITE_TAC[];ASM_REWRITE_TAC[];ASM_REWRITE_TAC[]] THENL [ASM_REWRITE_TAC[ARITH_RULE `1-1=0`];REWRITE_TAC[ARITH_RULE `2-1= SUC 0 `];REWRITE_TAC[ARITH_RULE `3-1= SUC 1 `]] THENL [REWRITE_TAC[EL];REWRITE_TAC[EL];REWRITE_TAC[EL]] THENL [REWRITE_TAC[HD];REWRITE_TAC[HD;TL];REWRITE_TAC[ARITH_RULE `1= SUC 0 `;EL]] THENL [SIMP_TAC[th3;ARITH_RULE `1<=1 /\ 1<=3`];SIMP_TAC[th3;ARITH_RULE `1<=2 /\ 2<=3`];REWRITE_TAC[HD;TL]] THENL [ARITH_TAC;ARITH_TAC;REWRITE_TAC[ARITH_RULE `SUC 0=1`]] THEN SIMP_TAC[th3;ARITH_RULE `1<=3 /\ 3<=3`] THEN ARITH_TAC);; + +let th4=prove(`!(S: A->bool). IMAGE I S= S`,GEN_TAC THEN REWRITE_TAC[IMAGE] THEN REWRITE_TAC[I_THM] THEN SET_TAC[]);; + +let SET_EQ=prove(`(A: real^3 -> bool) = B <=> (!a. a IN A ==> a IN B) /\ (!a. a IN B ==> a IN A)`,SET_TAC[]);; + +let scale_mul=prove(`!(s:real) t x. (scale (s%(t:real^3)) (x:real^3):real^3) = s% scale t x`,REPEAT GEN_TAC THEN REWRITE_TAC[scale] THEN REWRITE_TAC[vector] THEN SIMP_TAC[dodai] THEN REWRITE_TAC[CART_EQ] THEN REWRITE_TAC[DIMINDEX_3] THEN ASM_REWRITE_TAC[ARITH_RULE `(1 <= i /\ i <=3) <=> i =1 \/ i=2 \/ i=3`] THEN GEN_TAC THEN STRIP_TAC THENL [ASM_REWRITE_TAC[LAMBDA_BETA];ASM_REWRITE_TAC[];ASM_REWRITE_TAC[]] THENL [SIMP_TAC[LAMBDA_BETA;DIMINDEX_3;ARITH_RULE `1<=1 /\ 1<=3`];SIMP_TAC[VECTOR_MUL_COMPONENT;LAMBDA_BETA;DIMINDEX_3;ARITH_RULE `1<=2 /\ 2<=3`];SIMP_TAC[VECTOR_MUL_COMPONENT;LAMBDA_BETA;DIMINDEX_3;ARITH_RULE `1<=3 /\ 3<=3`]] THENL [SIMP_TAC[VECTOR_MUL_COMPONENT;DIMINDEX_3;ARITH_RULE `1<=1 /\ 1<=3` +];REWRITE_TAC[EL;ARITH_RULE `2-1=SUC 0`];REWRITE_TAC[EL;ARITH_RULE `3-1=SUC 1`]] THENL [SIMP_TAC[LAMBDA_BETA;DIMINDEX_3;ARITH_RULE `1<=1 /\ 1<=3`];REWRITE_TAC[HD;TL];REWRITE_TAC[EL;ARITH_RULE `1=SUC 0`]] THENL [REWRITE_TAC[ARITH_RULE `1-1=0`;EL];ARITH_TAC;REWRITE_TAC[HD;TL]] THENL[REWRITE_TAC[HD];ARITH_TAC] THEN ARITH_TAC);; + +let normball_ellip0=prove(`!r. normball (vec 0:real^3) r = ellipsoid (vec 1) r`,GEN_TAC THEN REWRITE_TAC[ellipsoid] THEN REWRITE_TAC[SET_EQ] THEN STRIP_TAC THENL [GEN_TAC;GEN_TAC] THENL [REWRITE_TAC[IN_IMAGE];REWRITE_TAC[IN_IMAGE]] THENL [DISCH_TAC;SIMP_TAC[identity_scale]] THENL [(EXISTS_TAC `a:real^3`);REWRITE_TAC[I_THM]] THENL [CONJ_TAC;REPEAT STRIP_TAC] THENL [SIMP_TAC[identity_scale];ASM_REWRITE_TAC[];ASM_REWRITE_TAC[]] THEN REWRITE_TAC[I_THM]);; + +let trans_normball=prove(`!(x:real^3) r. normball x r = IMAGE ((+) x) (normball (vec 0) r)`,REPEAT GEN_TAC THEN REWRITE_TAC[SET_EQ] THEN STRIP_TAC THENL [GEN_TAC;GEN_TAC] THENL [REWRITE_TAC[IN_IMAGE;normball];REWRITE_TAC[IN_IMAGE;normball]] THENL [REWRITE_TAC[IN_ELIM_THM];REWRITE_TAC[IN_ELIM_THM]] THENL [REWRITE_TAC[dist];REWRITE_TAC[dist]] THENL [DISCH_TAC;REWRITE_TAC[VECTOR_SUB_RZERO]] THENL [EXISTS_TAC `a-x:real^3`;REPEAT STRIP_TAC] THENL [REWRITE_TAC[VECTOR_ADD_SUB];ASM_REWRITE_TAC[]] THENL [CONJ_TAC;REWRITE_TAC[VECTOR_ADD_SUB]] THENL [REWRITE_TAC[VECTOR_SUB_ADD2];REWRITE_TAC[VECTOR_SUB_RZERO];ASM_REWRITE_TAC[]] THEN ASM_REWRITE_TAC[]);; + +let measurable_normball0=prove(`!r. measurable (normball (vec 0:real^3) r)`,GEN_TAC THEN MESON_TAC[primitive;MEASURABLE_RULES;normball_ellip0]);; + +let measurable_normball=prove(`!(x:real^3) r. measurable (normball x r)`,REPEAT GEN_TAC THEN MESON_TAC[MEASURABLE_RULES;trans_normball;measurable_normball0]);; + +let rsduong=prove(`!(s:real) (r:real). (s> &0) /\ (s r/s> &0`,REPEAT GEN_TAC THEN STRIP_TAC THEN UNDISCH_TAC `(s> &0):bool` THEN REWRITE_TAC[ARITH_RULE `s> &0 <=> &0 &0) /\ (s ~(r/s= &0)`,REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `r/s> &0` MP_TAC THENL[ASM_SIMP_TAC[rsduong];REAL_ARITH_TAC]);; + +let rduong=prove(`!(s:real) (r:real). (s> &0) /\ (s (r> &0)`,REPEAT GEN_TAC THEN STRIP_TAC THEN UNDISCH_TAC `(s &0):bool`THEN REAL_ARITH_TAC);; + +let rnon_zero=prove(`!(s:real) (r:real). (s> &0) /\ (s ~(r= &0)`,REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `r> &0` MP_TAC THENL[UNDISCH_TAC `(s &0):bool`THEN REWRITE_TAC[TAUT `A==>B ==> C <=> A/\B==>C`];REAL_ARITH_TAC] THEN ASM_REWRITE_TAC[rduong]);; + +let rs_sr_unit= prove(`!(s:real) (r:real). (s> &0) /\ (s (s / r * r / s= &1)`, +REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `~(r/s= &0)` MP_TAC +THENL [UNDISCH_TAC `(s &0):bool`THEN REWRITE_TAC[TAUT `A==>B ==> C <=> A/\B==>C`];STRIP_TAC] +THENL [ASM_REWRITE_TAC[rsnon_zero];SUBGOAL_THEN `r/s= inv(s/r)` MP_TAC] +THENL [UNDISCH_TAC `~(r / s = &0):bool`;SIMP_TAC[]] +THENL [ASM_SIMP_TAC[REAL_INV_DIV];DISCH_TAC] +THEN SUBGOAL_THEN `~(s/r= &0)` MP_TAC +THENL [MP_TAC(ARITH_RULE `s> &0 ==> ~(s= &0)`);SIMP_TAC[REAL_MUL_RINV]] +THEN ASM_REWRITE_TAC[] THEN SIMP_TAC[CONTRAPOS_THM] +THEN DISCH_TAC THEN SUBGOAL_THEN `r*s/r = r* &0` MP_TAC +THENL [REWRITE_TAC[ARITH_RULE `r * s / r = r * &0 <=> r * s / r - r * &0 = &0`];SUBGOAL_THEN `~(r= &0)` MP_TAC] +THENL [REWRITE_TAC[ARITH_RULE `r * s / r - r * &0 = r*(s/r- &0)`];UNDISCH_TAC `(s &0):bool`THEN REWRITE_TAC[TAUT `A==>B ==> C <=> A/\B==>C`];ASM_SIMP_TAC[REAL_DIV_LMUL]] +THENL [ASM_REWRITE_TAC[];ASM_REWRITE_TAC[rnon_zero];REAL_ARITH_TAC] +THEN ARITH_TAC);; + + +let SQRT_MUL_POW_2= prove(`!(a:real) b. (a>= &0) /\ (b>= &0) ==> sqrt((a*a)*b)= a* sqrt(b)`, +REPEAT GEN_TAC THEN STRIP_TAC THEN SUBGOAL_THEN `a*a>= &0` MP_TAC +THENL [REWRITE_TAC[ARITH_RULE `s>= &0 <=> &0<= s`];DISCH_TAC THEN UNDISCH_TAC `(b>= &0):bool`] +THENL [SIMP_TAC[REAL_LE_SQUARE];REWRITE_TAC[ARITH_RULE `s>= &0 <=> &0<= s`]] +THEN UNDISCH_TAC `(a * a >= &0):bool` THEN REWRITE_TAC[ARITH_RULE `a*a>= &0 <=> &0 <= a*a`] +THEN REWRITE_TAC[TAUT `A==>B ==>C <=> A/\ B ==> C`] +THEN SIMP_TAC[SQRT_MUL] THEN SUBGOAL_THEN `sqrt(a*a)= a` MP_TAC +THENL [UNDISCH_TAC `(a>= &0):bool`;MESON_TAC[]] +THEN REWRITE_TAC[ARITH_RULE `s>= &0 <=> &0<= s`] +THEN SIMP_TAC[SQRT_MUL] THEN SIMP_TAC[SQRT_POW_2] THEN MESON_TAC[REAL_POW_2;SQRT_POW_2]);; + +(* + +g `!r s (x:real^3) C. radial_norm r x C /\ (s > &0) /\ (s < r) ==> (C INTER normball x s = IMAGE ((+) x) (IMAGE (scale (s/r % (vec 1)))(IMAGE ((+) (--x)) (C INTER normball x r))))`;; + +e (REPEAT GEN_TAC THEN STRIP_TAC);; + +e (REWRITE_TAC[SET_EQ] THEN CONJ_TAC THEN GEN_TAC);; + +e (REWRITE_TAC[IN_INTER;IN_IMAGE]);; + +e (STRIP_TAC);; + +e (EXISTS_TAC `a-x:real^3`);; + +e (REWRITE_TAC[VECTOR_ARITH `(a:real^3)= x+a-x`]);; + +e (EXISTS_TAC `scale (r/s% vec 1)(a-x):real^3`);; + +e (SIMP_TAC[scale_mul] THEN SIMP_TAC[identity_scale] THEN REWRITE_TAC[I_THM]);; + +e (REWRITE_TAC[VECTOR_MUL_ASSOC]);; + +e (UNDISCH_TAC `(s> &0):bool` THEN UNDISCH_TAC `(sB==>C <=> A/\B==>C`]);; + +e (SIMP_TAC[rs_sr_unit]);; + +e (STRIP_TAC);; + +e (CONJ_TAC);; + +e (VECTOR_ARITH_TAC);; + +e (EXISTS_TAC `(x+r / s % (a - x)):real^3`);; + +e (CONJ_TAC);; + +e (VECTOR_ARITH_TAC);; + +e (CONJ_TAC);; + +e (SUBGOAL_THEN `(x:real^3)+(a-x) IN (C:real^3->bool)` MP_TAC);; + +e (UNDISCH_TAC `(a:real^3 IN (C:real^3->bool)):bool`);; + +e (MP_TAC(VECTOR_ARITH `(a:real^3)=x+(a-x)`));; + +e (REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]);; + +e (SET_TAC[]);; + +e (DISCH_TAC);; + +e (SUBGOAL_THEN `(r/s)> &0 /\ (r/s) * (norm (a:real^3-x):real)< r` MP_TAC);; + +e (UNDISCH_TAC `(s> &0):bool` THEN UNDISCH_TAC `(sB==>C <=> A/\B==>C`]);; + +e (SIMP_TAC[rsduong]);; + +e (STRIP_TAC);; + +e (UNDISCH_TAC `(a:real^3 IN normball x s):bool`);; + +e (REWRITE_TAC[normball]);; + +e (REWRITE_TAC[IN_ELIM_THM;dist]);; + +e (ABBREV_TAC `c= norm(a:real^3 -x)`);; + +e (DISCH_TAC);; + +e (SUBGOAL_THEN `r/s> &0` MP_TAC);; + +e (UNDISCH_TAC `(s &0):bool` THEN REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]);; + +e (SIMP_TAC[rsduong]);; + +e (REWRITE_TAC[ARITH_RULE `s> &0 <=> &0< s`]);; + +e (DISCH_TAC);; + +e (SUBGOAL_THEN `r/s*c < r/s*s` MP_TAC);; + +e (UNDISCH_TAC `(c < s):bool` THEN UNDISCH_TAC `(&0< r/s):bool` THEN REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]);; + +e (REWRITE_TAC[TAUT `A/\B==>C <=> B/\A==>C`] THEN REWRITE_TAC[ARITH_RULE `r / s * c < r / s * s <=> c*r/s < s*r/s`]);; + +e (REWRITE_TAC[REAL_LT_RMUL]);; + +e (MP_TAC(ARITH_RULE `s> &0 ==> ~(s= &0)`));; + +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[TAUT `A==>B==>C <=>A/\B==>C`]);; + +e (SIMP_TAC[]);; + +e (MESON_TAC[REAL_DIV_RMUL]);; + +e (ASM_MESON_TAC[radial_norm]);; + +e (REWRITE_TAC[normball;IN_ELIM_THM;dist]);; + +e (REWRITE_TAC[VECTOR_ARITH `((x:real^3) + r / s % (a - x)) - x= r / s % (a - x)`]);; + +e (REWRITE_TAC[vector_norm]);; + +e (REWRITE_TAC[VECTOR_ARITH `r / s % ((a:real^3) - x) dot r / s % (a - x)= (r/s *r/s) * (a-x) dot (a-x)`]);; + +e (SUBGOAL_THEN `r/s> &0` MP_TAC);; + +e (UNDISCH_TAC `(s &0):bool` THEN REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]);; + +e (REWRITE_TAC[rsduong]);; + +e (DISCH_TAC);; + +e (UNDISCH_TAC `(a IN normball (x:real^3) s):bool`);; + +e (REWRITE_TAC[normball;IN_ELIM_THM;dist]);; + +e (REWRITE_TAC[vector_norm]);; + +e (ABBREV_TAC `q2= (a:real^3 - x) dot (a - x)`);; + +e (DISCH_TAC);; + +e (UNDISCH_TAC `(sqrt q2 < s):bool`);; + +e (DISCH_TAC);; + +e (SUBGOAL_THEN `q2>= &0` MP_TAC);; + + +e (REWRITE_TAC[ARITH_RULE `q2>= &0 <=> &0<= q2`]);; + +e (ASM_MESON_TAC[DOT_POS_LE]);; + +e (MP_TAC(ARITH_RULE `r/s> &0 ==> r/s>= &0`));; + +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]);; + +e (SIMP_TAC[SQRT_MUL_POW_2]);; + +e (STRIP_TAC);; + +e (SUBGOAL_THEN `r/s*sqrt q2 sqrt q2* r/s< s* r/s`]);; + +e (UNDISCH_TAC `(r / s > &0):bool` THEN REWRITE_TAC[ARITH_RULE `r / s > &0<=> &0< r/s`] THEN UNDISCH_TAC `(sqrt q2 < s):bool`);; + +e (REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]);; + +e (SIMP_TAC[REAL_LT_RMUL]);; + +e (MP_TAC(ARITH_RULE `s> &0==> ~(s= &0)`));; + +e (ASM_REWRITE_TAC[]);; + +e (MESON_TAC[REAL_DIV_RMUL]);; + +e (REWRITE_TAC[IN_IMAGE;IN_INTER]);; + +e (REWRITE_TAC[scale_mul;identity_scale;I_THM]);; + +e(STRIP_TAC THEN CONJ_TAC);; + +e (ASM_SIMP_TAC[]);; + +e (SUBGOAL_THEN `(x:real^3) + (--x + x''') IN C` MP_TAC);; + +e (MP_TAC(VECTOR_ARITH `x'''= (x:real^3)+ (--x + x''')`));; + +e (ABBREV_TAC `u1= (x:real^3) + --x + x'''`);; + +e (UNDISCH_TAC `(x''' IN (C:real^3->bool)):bool`);; + +e (REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]);; + +e (SET_TAC[]);; + +e (SUBGOAL_THEN `s/r> &0 /\s/r* norm (--x+ x''':real^3)< r` MP_TAC);; + + +e (CONJ_TAC);; + +e (MP_TAC(ARITH_RULE `s &0 ==> r> &0`));; + +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[ARITH_RULE `a> &0 <=> &0 s> &0`]);; + +e (ASM_REWRITE_TAC[]);; + +e (SUBGOAL_THEN `s/r> &0` ASSUME_TAC);; + +e (MP_TAC(ARITH_RULE `s &0 ==> r> &0`) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[ARITH_RULE `a> &0 <=> &0 s> &0`] THEN ASM_REWRITE_TAC[]);; + +e (SUBGOAL_THEN `s/r< &1` ASSUME_TAC);; + +e (MP_TAC(ARITH_RULE `s &0 ==> r> &0`));; + +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[ARITH_RULE `r> &0 <=> &0 B==>C <=> A/\B==>C`]);; + +e (MP_TAC(ARITH_RULE `s/r> &0 /\ s/r< &1==> &0<= s/r /\ s/r< &1`));; + +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[TAUT `A==>B/\C==>D <=> A/\B/\C==>D`]);; + +e (ABBREV_TAC `y= norm (--x + x''':real^3)`);; + +e (UNDISCH_TAC `(s / r < &1):bool`);; + +e (REWRITE_TAC[TAUT `A==>B/\C/\D==>E <=> (B/\A/\C/\D==>E)`]);; + +e (DISCH_TAC);; + +e (SUBGOAL_THEN `s/r*y< &1*r` MP_TAC);; + +e (UNDISCH_TAC `(&0 <= s / r /\ s / r < &1 /\ &0 <= y /\ y < r):bool`);; + +e (MESON_TAC[REAL_LT_MUL2]);; + +e (MESON_TAC[ARITH_RULE `&1*r= r`]);; + +e (REWRITE_TAC[TAUT `A/\B==>C==>D <=> A/\B/\C==>D`]);; + +e (ASM_MESON_TAC[radial_norm]);; + +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[normball;IN_ELIM_THM;dist]);; + +e (REWRITE_TAC[VECTOR_ARITH `(x + s / r % (--x + x''')) - x= s / r % (--x + x''')`]);; + +e (SIMP_TAC[NORM_MUL]);; + +e (SUBGOAL_THEN `s/r> &0` ASSUME_TAC);; + +e (MP_TAC(ARITH_RULE `s &0 ==> r> &0`) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[ARITH_RULE `a> &0 <=> &0 s> &0`] THEN ASM_REWRITE_TAC[]);; + +e (MP_TAC(ARITH_RULE `s/r> &0==> s/r>= &0`));; + +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[ARITH_RULE `s/r>= &0 <=> &0<= s/r`]);; + +e (DISCH_TAC);; + +e (SUBGOAL_THEN `abs (s / r)= s/r` MP_TAC);; + +e (ASM_SIMP_TAC[REAL_ABS_REFL]);; + +e (SIMP_TAC[]);; + +e (DISCH_TAC);; + +e (UNDISCH_TAC `(x''':real^3 IN normball x r):bool`);; + +e (REWRITE_TAC[normball;IN_ELIM_THM;dist]);; + +e (SUBGOAL_THEN `norm (x''':real^3 - x)= norm (--x + x''')` ASSUME_TAC);; + +e (MP_TAC(VECTOR_ARITH `x''':real^3 - x = --x + x'''`));; + + +e (ABBREV_TAC `v2= x''':real^3 - x`);; + +e (MESON_TAC[]);; + +e (ASM_SIMP_TAC[]);; + +e (ABBREV_TAC `p= norm (--x + x''':real^3)`);; + +e (DISCH_TAC);; + +e (SUBGOAL_THEN `p*s/r< r*s/r` MP_TAC);; + +e (MP_TAC(ARITH_RULE `s / r > &0 ==> &0< s/r`));; + +e (ASM_REWRITE_TAC[]);; + +e (UNDISCH_TAC `(p < r):bool` THEN REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]);; + +e (SIMP_TAC[REAL_LT_RMUL]);; + +e (REWRITE_TAC[ARITH_RULE `s/r*p p*s/r< s`]);; + +e (MP_TAC(ARITH_RULE `s &0 ==> ~(r= &0)`));; + +e (ASM_REWRITE_TAC[]);; + +e (REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]);; + +e (MESON_TAC[REAL_DIV_LMUL]);; + + +let trans_strech_trans_radial=top_thm();; + +*) + +let trans_strech_trans_radial = prove_by_refinement( +`!r s (x:real^3) C. radial_norm r x C /\ (s > &0) /\ (s < r) ==> (C INTER normball x s = IMAGE ((+) x) (IMAGE (scale (s/r % (vec 1)))(IMAGE ((+) (--x)) (C INTER normball x r))))`, + (* {{{ proof *) + [ + (REPEAT GEN_TAC THEN STRIP_TAC); + (REWRITE_TAC[SET_EQ] THEN CONJ_TAC THEN GEN_TAC); + (REWRITE_TAC[IN_INTER;IN_IMAGE]); + (STRIP_TAC); + (EXISTS_TAC `a-x:real^3`); + (REWRITE_TAC[VECTOR_ARITH `(a:real^3)= x+a-x`]); + (EXISTS_TAC `scale (r/s% vec 1)(a-x):real^3`); + (SIMP_TAC[scale_mul] THEN SIMP_TAC[identity_scale] THEN REWRITE_TAC[I_THM]); + (REWRITE_TAC[VECTOR_MUL_ASSOC]); + (UNDISCH_TAC `(s> &0):bool` THEN UNDISCH_TAC `(sB==>C <=> A/\B==>C`]); + (SIMP_TAC[rs_sr_unit]); + (STRIP_TAC); + (CONJ_TAC); + BY((VECTOR_ARITH_TAC)); + (EXISTS_TAC `(x+r / s % (a - x)):real^3`); + (CONJ_TAC); + BY((VECTOR_ARITH_TAC)); + (CONJ_TAC); + (SUBGOAL_THEN `(x:real^3)+(a-x) IN (C:real^3->bool)` MP_TAC); + (UNDISCH_TAC `(a:real^3 IN (C:real^3->bool)):bool`); + (MP_TAC(VECTOR_ARITH `(a:real^3)=x+(a-x)`)); + (REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]); + BY((SET_TAC[])); + (DISCH_TAC); + (SUBGOAL_THEN `(r/s)> &0 /\ (r/s) * (norm (a:real^3-x):real)< r` MP_TAC); + (UNDISCH_TAC `(s> &0):bool` THEN UNDISCH_TAC `(sB==>C <=> A/\B==>C`]); + (SIMP_TAC[rsduong]); + (STRIP_TAC); + (UNDISCH_TAC `(a:real^3 IN normball x s):bool`); + (REWRITE_TAC[normball]); + (REWRITE_TAC[IN_ELIM_THM;dist]); + (ABBREV_TAC `c= norm(a:real^3 -x)`); + (DISCH_TAC); + (SUBGOAL_THEN `r/s> &0` MP_TAC); + (UNDISCH_TAC `(s &0):bool` THEN REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]); + BY((SIMP_TAC[rsduong])); + (REWRITE_TAC[ARITH_RULE `s> &0 <=> &0< s`]); + (DISCH_TAC); + (SUBGOAL_THEN `r/s*c < r/s*s` MP_TAC); + (UNDISCH_TAC `(c < s):bool` THEN UNDISCH_TAC `(&0< r/s):bool` THEN REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]); + (REWRITE_TAC[TAUT `A/\B==>C <=> B/\A==>C`] THEN REWRITE_TAC[ARITH_RULE `r / s * c < r / s * s <=> c*r/s < s*r/s`]); + BY((REWRITE_TAC[REAL_LT_RMUL])); + (MP_TAC(ARITH_RULE `s> &0 ==> ~(s= &0)`)); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[TAUT `A==>B==>C <=>A/\B==>C`]); + (SIMP_TAC[]); + BY((MESON_TAC[REAL_DIV_RMUL])); + BY((ASM_MESON_TAC[radial_norm])); + (REWRITE_TAC[normball;IN_ELIM_THM;dist]); + (REWRITE_TAC[VECTOR_ARITH `((x:real^3) + r / s % (a - x)) - x= r / s % (a - x)`]); + (REWRITE_TAC[vector_norm]); + (REWRITE_TAC[VECTOR_ARITH `r / s % ((a:real^3) - x) dot r / s % (a - x)= (r/s *r/s) * (a-x) dot (a-x)`]); + (SUBGOAL_THEN `r/s> &0` MP_TAC); + (UNDISCH_TAC `(s &0):bool` THEN REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]); + BY((REWRITE_TAC[rsduong])); + (DISCH_TAC); + (UNDISCH_TAC `(a IN normball (x:real^3) s):bool`); + (REWRITE_TAC[normball;IN_ELIM_THM;dist]); + (REWRITE_TAC[vector_norm]); + (ABBREV_TAC `q2= (a:real^3 - x) dot (a - x)`); + (DISCH_TAC); + (UNDISCH_TAC `(sqrt q2 < s):bool`); + (DISCH_TAC); + (SUBGOAL_THEN `q2>= &0` MP_TAC); + (REWRITE_TAC[ARITH_RULE `q2>= &0 <=> &0<= q2`]); + BY((ASM_MESON_TAC[DOT_POS_LE])); + (MP_TAC(ARITH_RULE `r/s> &0 ==> r/s>= &0`)); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]); + (SIMP_TAC[SQRT_MUL_POW_2]); + (STRIP_TAC); + (SUBGOAL_THEN `r/s*sqrt q2 sqrt q2* r/s< s* r/s`]); + (UNDISCH_TAC `(r / s > &0):bool` THEN REWRITE_TAC[ARITH_RULE `r / s > &0<=> &0< r/s`] THEN UNDISCH_TAC `(sqrt q2 < s):bool`); + (REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]); + BY((SIMP_TAC[REAL_LT_RMUL])); + (MP_TAC(ARITH_RULE `s> &0==> ~(s= &0)`)); + (ASM_REWRITE_TAC[]); + BY((MESON_TAC[REAL_DIV_RMUL])); + (REWRITE_TAC[IN_IMAGE;IN_INTER]); + (REWRITE_TAC[scale_mul;identity_scale;I_THM]); + (STRIP_TAC THEN CONJ_TAC); + (ASM_SIMP_TAC[]); + (SUBGOAL_THEN `(x:real^3) + (--x + x''') IN C` MP_TAC); + (MP_TAC(VECTOR_ARITH `x'''= (x:real^3)+ (--x + x''')`)); + (ABBREV_TAC `u1= (x:real^3) + --x + x'''`); + (UNDISCH_TAC `(x''' IN (C:real^3->bool)):bool`); + (REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]); + BY((SET_TAC[])); + (SUBGOAL_THEN `s/r> &0 /\s/r* norm (--x+ x''':real^3)< r` MP_TAC); + (CONJ_TAC); + (MP_TAC(ARITH_RULE `s &0 ==> r> &0`)); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `a> &0 <=> &0 s> &0`]); + BY((ASM_REWRITE_TAC[])); + (SUBGOAL_THEN `s/r> &0` ASSUME_TAC); + BY((MP_TAC(ARITH_RULE `s &0 ==> r> &0`) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[ARITH_RULE `a> &0 <=> &0 s> &0`] THEN ASM_REWRITE_TAC[])); + (SUBGOAL_THEN `s/r< &1` ASSUME_TAC); + (MP_TAC(ARITH_RULE `s &0 ==> r> &0`)); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `r> &0 <=> &0 B==>C <=> A/\B==>C`]); + (MP_TAC(ARITH_RULE `s/r> &0 /\ s/r< &1==> &0<= s/r /\ s/r< &1`)); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[TAUT `A==>B/\C==>D <=> A/\B/\C==>D`]); + (ABBREV_TAC `y= norm (--x + x''':real^3)`); + (UNDISCH_TAC `(s / r < &1):bool`); + (REWRITE_TAC[TAUT `A==>B/\C/\D==>E <=> (B/\A/\C/\D==>E)`]); + (DISCH_TAC); + (SUBGOAL_THEN `s/r*y< &1*r` MP_TAC); + (UNDISCH_TAC `(&0 <= s / r /\ s / r < &1 /\ &0 <= y /\ y < r):bool`); + BY((MESON_TAC[REAL_LT_MUL2])); + BY((MESON_TAC[ARITH_RULE `&1*r= r`])); + (REWRITE_TAC[TAUT `A/\B==>C==>D <=> A/\B/\C==>D`]); + BY((ASM_MESON_TAC[radial_norm])); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[normball;IN_ELIM_THM;dist]); + (REWRITE_TAC[VECTOR_ARITH `(x + s / r % (--x + x''')) - x= s / r % (--x + x''')`]); + (SIMP_TAC[NORM_MUL]); + (SUBGOAL_THEN `s/r> &0` ASSUME_TAC); + BY((MP_TAC(ARITH_RULE `s &0 ==> r> &0`) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[ARITH_RULE `a> &0 <=> &0 s> &0`] THEN ASM_REWRITE_TAC[])); + (MP_TAC(ARITH_RULE `s/r> &0==> s/r>= &0`)); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[ARITH_RULE `s/r>= &0 <=> &0<= s/r`]); + (DISCH_TAC); + (SUBGOAL_THEN `abs (s / r)= s/r` MP_TAC); + BY((ASM_SIMP_TAC[REAL_ABS_REFL])); + (SIMP_TAC[]); + (DISCH_TAC); + (UNDISCH_TAC `(x''':real^3 IN normball x r):bool`); + (REWRITE_TAC[normball;IN_ELIM_THM;dist]); + (SUBGOAL_THEN `norm (x''':real^3 - x)= norm (--x + x''')` ASSUME_TAC); + (MP_TAC(VECTOR_ARITH `x''':real^3 - x = --x + x'''`)); + (ABBREV_TAC `v2= x''':real^3 - x`); + BY((MESON_TAC[])); + (ASM_SIMP_TAC[]); + (ABBREV_TAC `p= norm (--x + x''':real^3)`); + (DISCH_TAC); + (SUBGOAL_THEN `p*s/r< r*s/r` MP_TAC); + (MP_TAC(ARITH_RULE `s / r > &0 ==> &0< s/r`)); + (ASM_REWRITE_TAC[]); + (UNDISCH_TAC `(p < r):bool` THEN REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]); + BY((SIMP_TAC[REAL_LT_RMUL])); + (REWRITE_TAC[ARITH_RULE `s/r*p p*s/r< s`]); + (MP_TAC(ARITH_RULE `s &0 ==> ~(r= &0)`)); + (ASM_REWRITE_TAC[]); + (REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]); + BY((MESON_TAC[REAL_DIV_LMUL])) + ]);; + (* }}} *) + + + +(*----------------------------------------------*) + +(* Lemma 4.2*) + +(* changed volume_props to volume_prop in the rest of this file. volume_props uses ball in the definition and volume_prop + uses normball in the definition*) + +(* +let volume_prop = new_definition `volume_prop (vol:(real^3->bool)->real) = + ( (!C. vol C >= &0) /\ + (!Z. NULLSET Z ==> (vol Z = &0)) /\ + (!X Y. measurable X /\ measurable Y /\ NULLSET (SDIFF X Y) ==> (vol X = vol Y)) /\ + (!X t. (measurable X) /\ (measurable (IMAGE (scale t) X)) ==> (vol (IMAGE (scale t) X) = abs(t$1 * t$2 * t$3)*vol(X))) /\ + (!X v. measurable X ==> (vol (IMAGE ((+) v) X) = vol X)) /\ + (!v0 v1 v2 v3 r. (r > &0) /\ (~(collinear {v0,v1,v2})) /\ ~(collinear {v0,v1,v3}) ==> vol (solid_triangle v0 {v1,v2,v3} r) = vol_solid_triangle v0 v1 v2 v3 r) /\ + (!v0 v1 v2 v3. vol(conv0 {v0,v1,v2,v3}) = vol_conv v0 v1 v2 v3) /\ + (!v0 v1 v2 v3 h a. ~(collinear {v0,v1,v2}) /\ ~(collinear {v0,v1,v3}) /\ (h >= &0) /\ (a > &0) /\ (a <= &1) ==> vol(frustt v0 v1 h a INTER wedge v0 v1 v2 v3) = vol_frustt_wedge v0 v1 v2 v3 h a) /\ + (!v0 v1 v2 v3 r c. ~(collinear {v0,v1,v2}) /\ ~(collinear {v0,v1,v3}) /\ (r >= &0) /\ (c >= -- (&1)) /\ (c <= &1) ==> (vol(conic_cap v0 v1 r c INTER wedge v0 v1 v2 v3) = vol_conic_cap_wedge v0 v1 v2 v3 r c)) /\ + (!(a:real^3) (b:real^3). vol(rect a b) = vol_rect a b) /\ + (!v0 v1 v2 v3 r. ~(collinear {v0,v1,v2}) /\ ~(collinear {v0,v1,v3}) /\ (r >= &0) ==> (vol(normball v0 r INTER wedge v0 v1 v2 v3) = vol_ball_wedge v0 v1 v2 v3 r)))`;; +*) + +let volume_prop_fix = new_definition `volume_prop_fix (vol:(real^3->bool)->real) = + ( (!C. measurable C ==> vol C >= &0) /\ + (!Z. NULLSET Z ==> (vol Z = &0)) /\ + (!X Y. measurable X /\ measurable Y /\ NULLSET (SDIFF X Y) ==> (vol X = vol Y)) /\ + (!X t. (measurable X) /\ (measurable (IMAGE (scale t) X)) ==> (vol (IMAGE (scale t) X) = abs(t$1 * t$2 * t$3)*vol(X))) /\ + (!X v. measurable X ==> (vol (IMAGE ((+) v) X) = vol X)) /\ + (!v0 v1 v2 v3 r. (r > &0) /\ ~coplanar {v0, v1, v2, v3} ==> vol (solid_triangle v0 {v1,v2,v3} r) = vol_solid_triangle v0 v1 v2 v3 r) /\ + (!v0 v1 v2 v3. vol(conv0 {v0,v1,v2,v3}) = vol_conv v0 v1 v2 v3) /\ + (!v0 v1 v2 v3 h a. ~(collinear {v0,v1,v2}) /\ ~(collinear {v0,v1,v3}) /\ (h >= &0) /\ (a > &0) /\ (a <= &1) ==> vol(frustt v0 v1 h a INTER wedge v0 v1 v2 v3) = vol_frustt_wedge v0 v1 v2 v3 h a) /\ + (!v0 v1 v2 v3 r c. ~(collinear {v0,v1,v2}) /\ ~(collinear {v0,v1,v3}) /\ (r >= &0) /\ (c >= -- (&1)) /\ (c <= &1) ==> (vol(conic_cap v0 v1 r c INTER wedge v0 v1 v2 v3) = vol_conic_cap_wedge v0 v1 v2 v3 r c)) /\ + (!(a:real^3) (b:real^3). vol(rect a b) = vol_rect a b) /\ + (!v0 v1 v2 v3 r. ~(collinear {v0,v1,v2}) /\ ~(collinear {v0,v1,v3}) /\ (r >= &0) ==> (vol(normball v0 r INTER wedge v0 v1 v2 v3) = vol_ball_wedge v0 v1 v2 v3 r)))`;; + +let VOLUME_FIX = prove(`volume_prop_fix vol`, + REWRITE_TAC[volume_prop_fix;volume_props]; + );; + + +let lemma_r_r' = prove_by_refinement(`! (C:real^3->bool) (x:real^3) r s. measurable C /\ volume_prop_fix (vol) /\ radial_norm r x C /\ (s > &0) /\ (s < r) ==> measurable (C INTER normball x s) /\ vol (C INTER normball x s)= vol (C) *(s/r) pow 3`, +[ +REPEAT GEN_TAC THEN STRIP_TAC THEN CONJ_TAC; +ASM_MESON_TAC[MEASURABLE_RULES;measurable_normball]; +SUBGOAL_THEN `C INTER normball x s = IMAGE ((+) x) (IMAGE (scale (s/r % (vec 1)))(IMAGE ((+) (--x)) (C INTER normball x r)))` ASSUME_TAC; +ASM_SIMP_TAC[trans_strech_trans_radial]; +ASM_REWRITE_TAC[]; +SUBGOAL_THEN `measurable ((C:real^3->bool) INTER normball x r)` ASSUME_TAC; +ASM_MESON_TAC[MEASURABLE_RULES;measurable_normball]; +SUBGOAL_THEN `measurable (IMAGE ((+) (--x)) ((C:real^3->bool) INTER normball x r))` ASSUME_TAC; +ASM_MESON_TAC[MEASURABLE_RULES]; +SUBGOAL_THEN `measurable (IMAGE (scale (s / r % vec 1)) (IMAGE ((+) (--x)) (C INTER normball x r)))` ASSUME_TAC; +ASM_MESON_TAC[MEASURABLE_RULES]; +SUBGOAL_THEN `measurable (IMAGE ((+) x) (IMAGE (scale (s / r % vec 1)) (IMAGE ((+) (--x)) (C INTER normball x r))))` ASSUME_TAC; +ASM_MESON_TAC[MEASURABLE_RULES]; +ABBREV_TAC `A2:real^3->bool= (IMAGE (scale (s / r % vec 1)) (IMAGE ((+) (--x)) (C INTER normball x r)))`; +SUBGOAL_THEN `vol (IMAGE ((+) x) A2)=vol (A2)` MP_TAC; +UNDISCH_TAC `(volume_prop_fix vol):bool`; +UNDISCH_TAC `(measurable (A2:real^3->bool)):bool`; +REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]; +SIMP_TAC[volume_prop_fix]; +SIMP_TAC[]; +DISCH_TAC; +UNDISCH_TAC `(IMAGE (scale (s / r % vec 1)) (IMAGE ((+) (--x)) (C INTER normball x r)):real^3->bool = A2):bool`; +REWRITE_TAC[SET_RULE `IMAGE (scale (s / r % vec 1)) (IMAGE ((+) (--x)) (C INTER normball x r)) = A2:real^3->bool <=> A2= IMAGE (scale (s / r % vec 1)) (IMAGE ((+) (--x)) (C INTER normball x r))`]; +SIMP_TAC[]; +DISCH_TAC; +ABBREV_TAC `M1:real^3->bool= (IMAGE ((+) (--x)) (C INTER normball x r))`; +ABBREV_TAC `w:real^3= s / r % vec 1`; +SUBGOAL_THEN `vol (IMAGE (scale (w:real^3)) M1)= abs (w$1*w$2*w$3)*vol (M1)` MP_TAC; +SUBGOAL_THEN `measurable (IMAGE (scale w) M1)` MP_TAC; +UNDISCH_TAC `(A2 = IMAGE (scale w) M1:real^3->bool):bool`; +REWRITE_TAC[SET_RULE `A2 = IMAGE (scale w) M1 <=> IMAGE (scale w) M1= A2`]; +SIMP_TAC[]; +ASM_MESON_TAC[]; +UNDISCH_TAC `(volume_prop_fix vol):bool`; +UNDISCH_TAC `(measurable (M1:real^3->bool)):bool`; +REWRITE_TAC[TAUT `P1 ==> P2 ==> P3 ==> P4 <=> P1 /\ P2 /\ P3 ==> P4`]; +SIMP_TAC[volume_prop_fix]; +SIMP_TAC[]; +DISCH_TAC; +SUBGOAL_THEN `((w:real^3)$1 = s/r)/\ (w$2 = s/r) /\ (w$3 = s/r)` MP_TAC; +REPEAT STRIP_TAC; +UNDISCH_TAC `(s / r % vec 1 = w:real^3):bool`; +REWRITE_TAC[VECTOR_ARITH `s / r % vec 1 = w:real^3 <=> w= s / r % vec 1`]; +SIMP_TAC[]; +DISCH_TAC; +SIMP_TAC[VECTOR_MUL_COMPONENT;DIMINDEX_3;ARITH_RULE `1<=1 /\ 1<=3`]; +SIMP_TAC[VEC_COMPONENT;DIMINDEX_3;ARITH_RULE `1<=1 /\ 1<= 3`]; +ARITH_TAC; +UNDISCH_TAC `(s / r % vec 1 = w:real^3):bool`; +REWRITE_TAC[VECTOR_ARITH `s / r % vec 1 = w:real^3 <=> w= s / r % vec 1`]; +SIMP_TAC[]; +DISCH_TAC; +SIMP_TAC[VECTOR_MUL_COMPONENT;DIMINDEX_3;ARITH_RULE `1<=2 /\ 2<=3`]; +SIMP_TAC[VEC_COMPONENT;DIMINDEX_3;ARITH_RULE `1<=2 /\ 2<= 3`]; +ARITH_TAC; +UNDISCH_TAC `(s / r % vec 1 = w:real^3):bool`; +REWRITE_TAC[VECTOR_ARITH `s / r % vec 1 = w:real^3 <=> w= s / r % vec 1`]; +SIMP_TAC[]; +DISCH_TAC; +SIMP_TAC[VECTOR_MUL_COMPONENT;DIMINDEX_3;ARITH_RULE `1<=3 /\ 3<=3`]; +SIMP_TAC[VEC_COMPONENT;DIMINDEX_3;ARITH_RULE `1<=3 /\ 3<= 3`]; +ARITH_TAC; +SIMP_TAC[]; +REWRITE_TAC[ARITH_RULE `s / r * s / r * s / r= (s/r) pow 3`]; +DISCH_TAC; +SUBGOAL_THEN `s/r > &0` MP_TAC; +SUBGOAL_THEN `r> &0` MP_TAC; +UNDISCH_TAC `(s < r):bool` THEN UNDISCH_TAC `(s > &0):bool`; +REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]; +MESON_TAC[rduong]; +REWRITE_TAC[ARITH_RULE `(r> &0 <=> &0< r) /\ (s / r > &0 <=> &0 < s/r)`]; +SIMP_TAC[REAL_LT_RDIV_EQ]; +DISCH_TAC; +REWRITE_TAC[ARITH_RULE `&0*r= &0`]; +ASM_REWRITE_TAC[ARITH_RULE `&0< s<=> s> &0`]; +DISCH_TAC; +SUBGOAL_THEN `&0<= s/r` MP_TAC; +REWRITE_TAC[ARITH_RULE `&0 <= s / r <=> s/r >= &0`]; +UNDISCH_TAC `(s / r > &0):bool`; +ARITH_TAC; +DISCH_TAC; +SUBGOAL_THEN `&0<= (s / r) pow 3` MP_TAC; +UNDISCH_TAC `(&0<=s / r):bool`; +MP_TAC(ARITH_RULE `&0 <= &0`); +REWRITE_TAC[TAUT `a==>b==>c <=> a/\b==>c`]; +DISCH_TAC; +REWRITE_TAC[ARITH_RULE `&0<= (s/r) pow 3 <=> &0 pow 3<= (s/r) pow 3`]; +UNDISCH_TAC `(&0 <= &0 /\ &0 <= s / r):bool`; +MP_TAC(ARITH_RULE `~(3= 0)`); +REWRITE_TAC[TAUT `a==>b==>c <=> a/\b==>c`]; +SIMP_TAC[REAL_POW_LE2]; +DISCH_TAC; +SUBGOAL_THEN `abs ((s / r) pow 3)=(s / r) pow 3` MP_TAC; +SIMP_TAC[REAL_ABS_REFL]; +ASM_MESON_TAC[]; +SIMP_TAC[]; +DISCH_TAC; +REWRITE_TAC[ARITH_RULE `(s / r) pow 3 * vol M1= vol M1 * (s / r) pow 3`]; +SUBGOAL_THEN `vol M1= vol C` MP_TAC; +UNDISCH_TAC `(IMAGE ((+) (--x:real^3)) ((C:real^3->bool) INTER normball x r) = (M1:real^3->bool)):bool`; +REWRITE_TAC[SET_RULE `IMAGE ((+) (--x)) ((C:real^3->bool) INTER normball x r) = M1 <=> M1= IMAGE ((+) (--x)) ((C:real^3->bool) INTER normball x r)`]; +SIMP_TAC[]; +DISCH_TAC; +SUBGOAL_THEN `vol (IMAGE ((+) (--x)) (C INTER normball x r))= vol (C INTER normball (x:real^3) r)` MP_TAC; +UNDISCH_TAC `(volume_prop_fix vol):bool`; +UNDISCH_TAC `(measurable ((C:real^3->bool) INTER normball x r)):bool`; +REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]; +SIMP_TAC[volume_prop_fix]; +SIMP_TAC[]; +DISCH_TAC; +SUBGOAL_THEN `C INTER normball (x:real^3) r= C` MP_TAC; +UNDISCH_TAC `(radial_norm r (x:real^3) C):bool`; +REWRITE_TAC[radial_norm]; +REPEAT STRIP_TAC; +UNDISCH_TAC `((C:real^3->bool) SUBSET normball (x:real^3) r):bool`; +SIMP_TAC[SUBSET_INTER_ABSORPTION]; +DISCH_TAC; +ABBREV_TAC `(E:real^3->bool)= C INTER normball x r`; +ASM_MESON_TAC[]; +ABBREV_TAC `a:real= (s / r) pow 3`; +ABBREV_TAC `a1:real= vol M1` THEN ABBREV_TAC `a2:real= vol C`; +SIMP_TAC[] +]);; + +let lemma_r_r'_fix = REWRITE_RULE[VOLUME_FIX] lemma_r_r';; + + +(* +(* start old lemma_r_r' here *) + +g `! (C:real^3->bool) (x:real^3) r s. measurable C /\ volume_prop (vol) /\ radial_norm r x C /\ (s > &0) /\ (s < r) ==> measurable (C INTER normball x s) /\ vol (C INTER normball x s)= vol (C) *(s/r) pow 3`;; + +e (REPEAT GEN_TAC THEN STRIP_TAC THEN CONJ_TAC);; + +e (ASM_MESON_TAC[MEASURABLE_RULES;measurable_normball]);; + +e (SUBGOAL_THEN `C INTER normball x s = IMAGE ((+) x) (IMAGE (scale (s/r % (vec 1)))(IMAGE ((+) (--x)) (C INTER normball x r)))` ASSUME_TAC);; + +e (ASM_SIMP_TAC[trans_strech_trans_radial]);; + +e (ASM_REWRITE_TAC[]);; + +e (SUBGOAL_THEN `measurable ((C:real^3->bool) INTER normball x r)` ASSUME_TAC);; + +e (ASM_MESON_TAC[MEASURABLE_RULES;measurable_normball]);; + +e (SUBGOAL_THEN `measurable (IMAGE ((+) (--x)) ((C:real^3->bool) INTER normball x r))` ASSUME_TAC);; + +e (ASM_MESON_TAC[MEASURABLE_RULES]);; + +e (SUBGOAL_THEN `measurable (IMAGE (scale (s / r % vec 1)) (IMAGE ((+) (--x)) (C INTER normball x r)))` ASSUME_TAC);; + +e (ASM_MESON_TAC[MEASURABLE_RULES]);; + +e (SUBGOAL_THEN `measurable (IMAGE ((+) x) + (IMAGE (scale (s / r % vec 1)) (IMAGE ((+) (--x)) (C INTER normball x r))))` ASSUME_TAC);; + +e (ASM_MESON_TAC[MEASURABLE_RULES]);; + +e (ABBREV_TAC `A2:real^3->bool= (IMAGE (scale (s / r % vec 1)) + (IMAGE ((+) (--x)) (C INTER normball x r)))`);; + +e (SUBGOAL_THEN `vol (IMAGE ((+) x) A2)=vol (A2)` MP_TAC);; + +e (UNDISCH_TAC `(volume_prop vol):bool`);; + +e (UNDISCH_TAC `(measurable (A2:real^3->bool)):bool`);; + +e (REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]);; + +e (SIMP_TAC[volume_prop]);; + +e (SIMP_TAC[]);; + +e (DISCH_TAC);; + +e (UNDISCH_TAC `(IMAGE (scale (s / r % vec 1)) + (IMAGE ((+) (--x)) (C INTER normball x r)):real^3->bool = + A2):bool`);; + +e (REWRITE_TAC[SET_RULE `IMAGE (scale (s / r % vec 1)) (IMAGE ((+) (--x)) (C INTER normball x r)) = + A2:real^3->bool <=> A2= IMAGE (scale (s / r % vec 1)) (IMAGE ((+) (--x)) (C INTER normball x r))`]);; + +e (SIMP_TAC[]);; + +e (DISCH_TAC);; + + +e (ABBREV_TAC `M1:real^3->bool= (IMAGE ((+) (--x)) (C INTER normball x r))`);; + +e (ABBREV_TAC `w:real^3= s / r % vec 1`);; + +e (SUBGOAL_THEN `vol (IMAGE (scale (w:real^3)) M1)= abs (w$1*w$2*w$3)*vol (M1)` MP_TAC);; + +e (SUBGOAL_THEN `measurable (IMAGE (scale w) M1)` MP_TAC);; + +e (UNDISCH_TAC `(A2 = IMAGE (scale w) M1:real^3->bool):bool`);; + +e (REWRITE_TAC[SET_RULE `A2 = IMAGE (scale w) M1 <=> IMAGE (scale w) M1= A2`]);; + +e (SIMP_TAC[]);; + +e (ASM_MESON_TAC[]);; + +e (UNDISCH_TAC `(volume_prop vol):bool`);; + +e (UNDISCH_TAC `(measurable (M1:real^3->bool)):bool`);; + +e (REWRITE_TAC[TAUT `P1 ==> P2 ==> P3 ==> P4 <=> P1 /\ P2 /\ P3 ==> P4`]);; + +e (SIMP_TAC[volume_prop]);; + +e (SIMP_TAC[]);; + +e (DISCH_TAC);; + +e (SUBGOAL_THEN `((w:real^3)$1 = s/r)/\ (w$2 = s/r) /\ (w$3 = s/r)` MP_TAC);; + +e (REPEAT STRIP_TAC);; + +e (UNDISCH_TAC `(s / r % vec 1 = w:real^3):bool`);; + +e (REWRITE_TAC[VECTOR_ARITH `s / r % vec 1 = w:real^3 <=> w= s / r % vec 1`]);; + +e (SIMP_TAC[]);; + +e (DISCH_TAC);; + +e (SIMP_TAC[VECTOR_MUL_COMPONENT;DIMINDEX_3;ARITH_RULE `1<=1 /\ 1<=3`]);; + +e (SIMP_TAC[VEC_COMPONENT;DIMINDEX_3;ARITH_RULE `1<=1 /\ 1<= 3`]);; + +e (ARITH_TAC);; + +e (UNDISCH_TAC `(s / r % vec 1 = w:real^3):bool`);; + +e (REWRITE_TAC[VECTOR_ARITH `s / r % vec 1 = w:real^3 <=> w= s / r % vec 1`]);; + +e (SIMP_TAC[]);; + +e (DISCH_TAC);; + +e (SIMP_TAC[VECTOR_MUL_COMPONENT;DIMINDEX_3;ARITH_RULE `1<=2 /\ 2<=3`]);; + +e (SIMP_TAC[VEC_COMPONENT;DIMINDEX_3;ARITH_RULE `1<=2 /\ 2<= 3`]);; + +e (ARITH_TAC);; + +e (UNDISCH_TAC `(s / r % vec 1 = w:real^3):bool`);; + +e (REWRITE_TAC[VECTOR_ARITH `s / r % vec 1 = w:real^3 <=> w= s / r % vec 1`]);; + +e (SIMP_TAC[]);; + +e (DISCH_TAC);; + +e (SIMP_TAC[VECTOR_MUL_COMPONENT;DIMINDEX_3;ARITH_RULE `1<=3 /\ 3<=3`]);; + +e (SIMP_TAC[VEC_COMPONENT;DIMINDEX_3;ARITH_RULE `1<=3 /\ 3<= 3`]);; + +e (ARITH_TAC);; + +e (SIMP_TAC[]);; + +e (REWRITE_TAC[ARITH_RULE `s / r * s / r * s / r= (s/r) pow 3`]);; + +e (DISCH_TAC);; + +e (SUBGOAL_THEN `s/r > &0` MP_TAC);; + +e (SUBGOAL_THEN `r> &0` MP_TAC);; + +e (UNDISCH_TAC `(s < r):bool` THEN UNDISCH_TAC `(s > &0):bool`);; + +e (REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]);; + +e (MESON_TAC[rduong]);; + +e (REWRITE_TAC[ARITH_RULE `(r> &0 <=> &0< r) /\ (s / r > &0 <=> &0 < s/r)`]);; + +e (SIMP_TAC[REAL_LT_RDIV_EQ]);; + +e (DISCH_TAC);; + +e (REWRITE_TAC[ARITH_RULE `&0*r= &0`]);; + +e (ASM_REWRITE_TAC[ARITH_RULE `&0< s<=> s> &0`]);; + +e (DISCH_TAC);; + +e (SUBGOAL_THEN `&0<= s/r` MP_TAC);; + +e (REWRITE_TAC[ARITH_RULE `&0 <= s / r <=> s/r >= &0`]);; + +e (UNDISCH_TAC `(s / r > &0):bool`);; + +e (ARITH_TAC);; + +e (DISCH_TAC);; + +e (SUBGOAL_THEN `&0<= (s / r) pow 3` MP_TAC);; + +e (UNDISCH_TAC `(&0<=s / r):bool`);; + +e (MP_TAC(ARITH_RULE `&0 <= &0`));; + +e (REWRITE_TAC[TAUT `a==>b==>c <=> a/\b==>c`]);; + +e (DISCH_TAC);; + +e (REWRITE_TAC[ARITH_RULE `&0<= (s/r) pow 3 <=> &0 pow 3<= (s/r) pow 3`]);; + +e (UNDISCH_TAC `(&0 <= &0 /\ &0 <= s / r):bool`);; + +e (MP_TAC(ARITH_RULE `~(3= 0)`));; + +e (REWRITE_TAC[TAUT `a==>b==>c <=> a/\b==>c`]);; + +e (SIMP_TAC[REAL_POW_LE2]);; + +e (DISCH_TAC);; + +e (SUBGOAL_THEN `abs ((s / r) pow 3)=(s / r) pow 3` MP_TAC);; + +e (SIMP_TAC[REAL_ABS_REFL]);; + +e (ASM_MESON_TAC[]);; + +e (SIMP_TAC[]);; + +e (DISCH_TAC);; + +e (REWRITE_TAC[ARITH_RULE `(s / r) pow 3 * vol M1= vol M1 * (s / r) pow 3`]);; + +e (SUBGOAL_THEN `vol M1= vol C` MP_TAC);; + +e (UNDISCH_TAC `(IMAGE ((+) (--x:real^3)) ((C:real^3->bool) INTER normball x r) = (M1:real^3->bool)):bool`);; + +e (REWRITE_TAC[SET_RULE `IMAGE ((+) (--x)) ((C:real^3->bool) INTER normball x r) = M1 <=> M1= IMAGE ((+) (--x)) ((C:real^3->bool) INTER normball x r)`]);; + +e (SIMP_TAC[]);; + +e (DISCH_TAC);; + +e (SUBGOAL_THEN `vol (IMAGE ((+) (--x)) (C INTER normball x r))= vol (C INTER normball (x:real^3) r)` MP_TAC);; + +e (UNDISCH_TAC `(volume_prop vol):bool`);; + +e (UNDISCH_TAC `(measurable ((C:real^3->bool) INTER normball x r)):bool`);; + +e (REWRITE_TAC[TAUT `A==>B==>C <=> A/\B==>C`]);; + +e (SIMP_TAC[volume_prop]);; + +e (SIMP_TAC[]);; + +e (DISCH_TAC);; + +e (SUBGOAL_THEN `C INTER normball (x:real^3) r= C` MP_TAC);; + +e (UNDISCH_TAC `(radial_norm r (x:real^3) C):bool`);; + +e (REWRITE_TAC[radial_norm]);; + +e (REPEAT STRIP_TAC);; + +e (UNDISCH_TAC `((C:real^3->bool) SUBSET normball (x:real^3) r):bool`);; + +e (SIMP_TAC[SUBSET_INTER_ABSORPTION]);; + +e (DISCH_TAC);; + +e (ABBREV_TAC `(E:real^3->bool)= C INTER normball x r`);; + +e (ASM_MESON_TAC[]);; + +e (ABBREV_TAC `a:real= (s / r) pow 3`);; + +e (ABBREV_TAC `a1:real= vol M1` THEN ABBREV_TAC `a2:real= vol C`);; + +e (SIMP_TAC[]);; + +let lemma_r_r'=top_thm();; + +*) + +(*------------------------ Definition of Solid angle ---------------------------------------------------------*) + + +let normball_subset= prove(`!(x:real^3) r r'. (r'> &0) /\ (r' normball x r' SUBSET normball x r`, (REPEAT GEN_TAC THEN REPEAT STRIP_TAC) THEN REWRITE_TAC[SUBSET] THEN GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN REWRITE_TAC[normball] THEN REWRITE_TAC[IN_ELIM_THM] THEN REWRITE_TAC[dist] THEN UNDISCH_TAC `(r' < r):bool` THEN REWRITE_TAC[TAUT `a==>b ==> c <=> a /\ b ==> c`] THEN ARITH_TAC);; +let subset_inter=prove(`! (A:real^3->bool) (B:real^3->bool). A SUBSET B ==> A INTER B= A`,REPEAT GEN_TAC THEN SET_TAC[]);; +let normball_eq=prove(`!(C:real^3->bool) x r r'. (r'> &0)/\ (r'< r)==> (C INTER normball x r) INTER normball x r' = C INTER normball x r'`,REPEAT GEN_TAC THEN REPEAT STRIP_TAC THEN (MP_TAC(SET_RULE `((C:real^3->bool) INTER normball x r) INTER normball x r'=(C INTER normball x r') INTER normball x r`)) THEN SIMP_TAC[] THEN DISCH_TAC THEN (SUBGOAL_THEN `(((C:real^3->bool) INTER normball x r') SUBSET normball x r)` MP_TAC) THENL[ASM_MESON_TAC[INTER_SUBSET;SUBSET_TRANS;normball_subset];MESON_TAC[subset_inter]]);; + +(* redone by thales below on 2010-06-06 : + +let pre_def1_4_3=prove(`!(C:real^3->bool)(x:real^3). volume_prop_fix (vol) /\ measurable C /\ eventually_radial_norm x C ==> (?s. ?c. (c > &0) /\ (!r. (r > &0) /\ (r < c) ==> (s= &3 * vol(C INTER normball x r)/(r pow 3)))) `, + (REPEAT GEN_TAC) + THEN (REWRITE_TAC[eventually_radial_norm]) + THEN (REPEAT STRIP_TAC) + THEN (EXISTS_TAC `(&3* vol (C INTER normball x r) / r pow 3):real`) + THEN (EXISTS_TAC `(r:real)`) + THEN (ASM_REWRITE_TAC[]) + THEN (GEN_TAC) + THEN (REPEAT STRIP_TAC) + THEN (REWRITE_TAC[REAL_ARITH `&3 * vol (C INTER normball x r) / r pow 3 = &3 * vol (C INTER normball x r') / r' pow 3 <=> vol (C INTER normball x r) / r pow 3 = vol (C INTER normball x r') / r' pow 3`]) + THEN (SUBGOAL_THEN `(C:real^3->bool) INTER normball x r'= (C INTER normball x r) INTER normball x r'` MP_TAC) + THENL[ASM_MESON_TAC[normball_eq];SIMP_TAC[]] + THEN DISCH_TAC + THEN (SUBGOAL_THEN `measurable ((C:real^3->bool) INTER normball x r)` ASSUME_TAC) + THENL[ASM_MESON_TAC[MEASURABLE_RULES;measurable_normball];(SUBGOAL_THEN `vol ((C INTER normball x r) INTER normball x r')= vol (C INTER normball x r) * (r'/r) pow 3` MP_TAC)] + THENL[ASM_MESON_TAC[lemma_r_r'];ABBREV_TAC `(a:real)=vol (C INTER normball x r)`] + THEN ABBREV_TAC `(b:real)=vol ((C INTER normball x r) INTER normball x r')` + THEN SIMP_TAC[] + THEN DISCH_TAC + THEN SIMP_TAC[REAL_POW_DIV] + THEN MP_TAC(REAL_ARITH `r'> &0 ==> ~(r'= &0)`) + THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN MP_TAC(MESON[REAL_POW_NZ] `~(r'= &0)==> ~(r' pow 3= &0)`) + THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC + THEN REWRITE_TAC[REAL_ARITH `(a * r' pow 3 / r pow 3) / r' pow 3= (a * r' pow 3/ r' pow 3)/ r pow 3`] + THEN MP_TAC(MESON[REAL_DIV_REFL] `~(r' pow 3 = &0)==> r' pow 3 / r' pow 3= &1`) + THEN ASM_REWRITE_TAC[] + THEN SIMP_TAC[] + THEN DISCH_TAC + THEN ARITH_TAC);; + +let pre_def_4_3=REWRITE_RULE[VOLUME_FIX] (prove(`?(s:(real^3->bool)->real^3 -> real). !C x. volume_prop_fix vol /\ measurable C /\ eventually_radial_norm x C ==> (?r'.r' > &0 /\(!r. r > &0 /\ r < r' ==> s C x = &3 * vol (C INTER normball x r) / r pow 3))`,MESON_TAC[SKOLEM_THM;pre_def1_4_3]));; + +let sol= new_specification ["sol"] pre_def_4_3;; + +*) + + +let radial_normball = prove_by_refinement( `!r x C. + radial_norm r (x:real^A) C ==> radial_norm r x (C INTER normball x r)`, +[ + REWRITE_TAC[radial_norm]; + STRIP_TAC THEN STRIP_TAC THEN STRIP_TAC; + + SUBGOAL_THEN `C SUBSET normball (x:real^A) r ==> (C INTER normball x r =C)` MP_TAC; + SET_TAC[]; + MESON_TAC[]; +]);; + + +(* +A big part of the proof is devoted to this identity + `(b = a * (r'/r) pow 3 ) /\ (r > &0) /\ (r' > &0) ==> a / r pow 3 = b / r' pow 3`;; *) + +(* +let pre_def1_4_3=prove_by_refinement( +` !(C:real^3->bool) x. + volume_prop_fix vol /\ + (?r. r > &0 /\ + measurable (C INTER normball x r) /\ + radial_norm r x (C INTER normball x r)) + ==> (?s c. + c > &0 /\ + (!r. r > &0 /\ r < c + ==> s = &3 * vol (C INTER normball x r) / r pow 3))`, +[ + (REPEAT STRIP_TAC) ; + (EXISTS_TAC `(&3* vol (C INTER normball x r) / r pow 3):real`) ; + (EXISTS_TAC `(r:real)`) ; + (ASM_REWRITE_TAC[]) ; + (REPEAT STRIP_TAC) ; + (REWRITE_TAC[REAL_ARITH `(&3 * x = &3 *y) = (x = y)`]) ; + (SUBGOAL_THEN `(C:real^3->bool) INTER normball x r'= (C INTER normball x r) INTER normball x r'` MP_TAC) THENL[ASM_MESON_TAC[normball_eq];SIMP_TAC[]] ; + DISCH_TAC ; +(* (SUBGOAL_THEN `measurable ((C:real^3->bool) INTER normball x r)` ASSUME_TAC) THENL[ASM_MESON_TAC[MEASURABLE_RULES;measurable_normball]; *) +(SUBGOAL_THEN `vol ((C INTER normball x r) INTER normball x r')= vol (C INTER normball x r) * (r'/r) pow 3` MP_TAC); + ASM_MESON_TAC[lemma_r_r';radial_normball]; + ABBREV_TAC `(a:real)=vol (C INTER normball x r)`; + ABBREV_TAC `(b:real)=vol ((C INTER normball x r) INTER normball x r')` ; + SIMP_TAC[] ; + DISCH_TAC ; + SIMP_TAC[REAL_POW_DIV] ; + MP_TAC(REAL_ARITH `r'> &0 ==> ~(r'= &0)`) ; + ASM_REWRITE_TAC[] ; + DISCH_TAC ; + MP_TAC(MESON[REAL_POW_NZ] `~(r'= &0)==> ~(r' pow 3= &0)`) ; + ASM_REWRITE_TAC[] ; + DISCH_TAC ; + REWRITE_TAC[REAL_ARITH `(a * r' pow 3 / r pow 3) / r' pow 3= (a * r' pow 3/ r' pow 3)/ r pow 3`] ; + MP_TAC(MESON[REAL_DIV_REFL] `~(r' pow 3 = &0)==> r' pow 3 / r' pow 3= &1`) ; + ASM_REWRITE_TAC[] ; + SIMP_TAC[] ; + DISCH_TAC ; + ARITH_TAC; +]);; +*) + +(* +A big part of the proof of pre_def1_4_3 is devoted to this identity +*) + +let pow3_identity = prove_by_refinement( + `(b = a * (r'/r) pow 3 ) /\ (r > &0) /\ (r' > &0) ==> a / r pow 3 = b / r' pow 3`, + [ + SIMP_TAC[REAL_POW_DIV] ; + MP_TAC(REAL_ARITH `r'> &0 ==> ~(r'= &0)`) ; + MP_TAC(MESON[REAL_POW_NZ;REAL_DIV_REFL] `~(r'= &0)==> r' pow 3 / r' pow 3= &1`) ; + REWRITE_TAC[REAL_ARITH `(a * b / c) / b= (a * b/ b)/ c`] ; + SIMP_TAC[] ; + ARITH_TAC; + ]);; +(* +let pre_def1_4_3=prove_by_refinement( +` !(C:real^3->bool) x. + volume_prop_fix vol /\ + (?r. r > &0 /\ + measurable (C INTER normball x r) /\ + radial_norm r x (C INTER normball x r)) + ==> (?s c. + c > &0 /\ + (!r. r > &0 /\ r < c + ==> s = &3 * vol (C INTER normball x r) / r pow 3))`, +[ + (REPEAT STRIP_TAC) ; + (EXISTS_TAC `(&3* vol (C INTER normball x r) / r pow 3):real`) ; + (EXISTS_TAC `(r:real)`) ; + (ASM_REWRITE_TAC[]) ; + (REPEAT STRIP_TAC) ; + (REWRITE_TAC[REAL_ARITH `(&3 * x = &3 *y) = (x = y)`]) ; + (SUBGOAL_THEN `(C:real^3->bool) INTER normball x r'= (C INTER normball x r) INTER normball x r'` MP_TAC) THENL[ASM_MESON_TAC[normball_eq];SIMP_TAC[]] ; + DISCH_TAC ; + (SUBGOAL_THEN `vol ((C INTER normball x r) INTER normball x r')= vol (C INTER normball x r) * (r'/r) pow 3` MP_TAC); + ASM_MESON_TAC[lemma_r_r';radial_normball]; + DISCH_TAC THEN ASM_REWRITE_TAC[]; +ASM_MESON_TAC[pow3_identity]; +]);; +*) + +let pre_def1_4_3b=prove_by_refinement( +` !x (C:real^3->bool). volume_prop_fix vol ==> ?s. !r. + (( r > &0 /\ + measurable (C INTER normball x r) /\ + radial_norm r x (C INTER normball x r)) + ==> (s = &3 * vol (C INTER normball x r) / r pow 3))`, +[ + (REPEAT STRIP_TAC) ; + (DISJ_CASES_TAC (ISPEC `?t. (t > &0) /\ measurable (C INTER normball (x:real^3) t) /\ (radial_norm t x (C INTER normball x t))` (TAUT `!x. ~x \/ x`))); + ASM_MESON_TAC[]; + (FIRST_X_ASSUM MP_TAC); + STRIP_TAC; + (EXISTS_TAC `(&3* vol (C INTER normball x t) / t pow 3):real`) ; + (REPEAT STRIP_TAC) ; + (REWRITE_TAC[REAL_ARITH `(&3 * x = &3 *y) = (x = y)`]) ; +(* to here *) + DISJ_CASES_TAC (ARITH_RULE `(t < r) \/ (r < t) \/ (r = t)`); + (SUBGOAL_THEN `(C:real^3->bool) INTER normball x t= (C INTER normball x r) INTER normball x t` MP_TAC) THENL[ASM_MESON_TAC[normball_eq];SIMP_TAC[]] ; + DISCH_TAC ; + (SUBGOAL_THEN `vol ((C INTER normball x r) INTER normball x t)= vol (C INTER normball x r) * (t/r) pow 3` MP_TAC); + ASM_MESON_TAC[lemma_r_r';radial_normball]; + DISCH_TAC THEN ASM_REWRITE_TAC[]; +ASM_MESON_TAC[pow3_identity]; + FIRST_X_ASSUM DISJ_CASES_TAC; + (SUBGOAL_THEN `(C:real^3->bool) INTER normball x r= (C INTER normball x t) INTER normball x r` MP_TAC) THENL[ASM_MESON_TAC[normball_eq];SIMP_TAC[]] ; + DISCH_TAC ; + (SUBGOAL_THEN `vol ((C INTER normball x t) INTER normball x r)= vol (C INTER normball x t) * (r/t) pow 3` MP_TAC); + ASM_MESON_TAC[lemma_r_r';radial_normball]; + DISCH_TAC THEN ASM_REWRITE_TAC[]; +ASM_MESON_TAC[pow3_identity]; + ASM_REWRITE_TAC[]; +]);; + +(* +let pre_def_4_3=REWRITE_RULE[VOLUME_FIX] (prove(`?(s:(real^3->bool)->real^3 -> real). !C x. (?r. (r > &0) /\ measurable (C INTER normball x r) /\ radial_norm r x (C INTER normball x r)) ==> (?r'.r' > &0 /\(!r. r > &0 /\ r < r' ==> s C x = &3 * vol (C INTER normball x r) / r pow 3))`,MESON_TAC[VOLUME_FIX;SKOLEM_THM;pre_def1_4_3]));; +*) + +let pre_def_4_3b=REWRITE_RULE[VOLUME_FIX;SKOLEM_THM] + pre_def1_4_3b;; + +let pre_def_4_3b_alt = prove_by_refinement( + `?s. !(x:real^3) C r. + r > &0 /\ + measurable (C INTER ball (x, r)) /\ + radial r x (C INTER ball (x, r)) + ==> s x C = &3 * vol (C INTER ball(x,r)) / r pow 3`, + (* {{{ proof *) + [ + REWRITE_TAC[GSYM NORMBALL_BALL;GSYM radial_norm_deprecated;pre_def_4_3b] + ]);; + (* }}} *) + +(* +let sol= new_specification ["sol"] pre_def_4_3b;; +*) + +let sol_spec = new_specification ["sol"] pre_def_4_3b_alt;; + +let sol = prove_by_refinement( + `!(x:real^3) C r. + r > &0 /\ + measurable (C INTER normball x r) /\ + radial_norm r x (C INTER normball x r) + ==> sol x C = &3 * vol (C INTER normball x r) / r pow 3`, + (* {{{ proof *) + [ + REWRITE_TAC[NORMBALL_BALL;radial_norm_deprecated]; + REPEAT STRIP_TAC; + ASM_MESON_TAC[sol_spec] + ]);; + (* }}} *) + +let AFF_GT_1_3=prove(`!x u v w. + DISJOINT {x} {u, v, w} + ==> aff_gt {x} {u, v, w} = + {y | ?t1 t2 t3 t4. + &0 < t2 /\ + &0 < t3 /\ + &0 < t4 /\ + t1 + t2 + t3 +t4= &1 /\ + y = t1 % x + t2 %u + t3 % v + t4 % w}`, +AFF_TAC);; + + + +let aff_normball =prove_by_refinement +(`!t (x:real^B) u r. (r > &0) /\ (t > &0) /\ (t * norm u < r) /\ (x + u IN normball x r) ==> (x + t % u IN normball x r)`, +[ +REWRITE_TAC[normball;IN_ELIM_THM;dist; + VECTOR_ARITH `((x:real^B) + u ) - x = u`;NORM_MUL]; +REAL_ARITH_TAC; +]);; + + +(* insert in vol1.hl after solid angle *) + +let aff_gt_radial = prove_by_refinement(`!x u v w r. + (DISJOINT {(x:real^B)} {u,v,w} /\ (r > &0) ) ==> + radial_norm r x (aff_gt {x} {u,v,w} INTER normball x r)`, +[ +REWRITE_TAC[radial_norm]; +REPEAT STRIP_TAC; +SET_TAC[]; +UNDISCH_TAC `(x:real^B) + u' IN aff_gt {x} {u, v, w} INTER normball x r`; +ASM_SIMP_TAC[AFF_GT_1_3]; +REWRITE_TAC[IN_ELIM_THM;IN_INTER]; +REPEAT STRIP_TAC; +EXISTS_TAC `&1 + (t:real) * t1 - t`; +EXISTS_TAC `(t:real) * t2`; +EXISTS_TAC `(t:real) * t3`; +EXISTS_TAC `(t:real) * t4`; +SUBGOAL_THEN `&0 < t * t2 /\ &0 < t * t3 /\ &0 < t * t4` (fun t -> REWRITE_TAC[t]); +ASM_MESON_TAC[REAL_MUL_POS_LT;REAL_ARITH `r > &0 <=> &0 < r`]; +CONJ_TAC; +SUBGOAL_THEN `(&1 + t * t1 - t) + t * t2 + t * t3 + t * t4 = &1 - t + t * (t1 + t2 + t3 + t4)` (fun t-> ASM_REWRITE_TAC[t]); +REAL_ARITH_TAC; +REAL_ARITH_TAC; +ONCE_REWRITE_TAC[ VECTOR_ARITH `( &1 + t * t1 - t) % (x:real^B) + (t * t2) % u + (t * t3) % v + (t * t4) % w = x - t % x + t % (t1 % x + t2 % u + t3 % v + t4 % w)`]; +UNDISCH_TAC `(x:real^B) + u' = t1 % x + t2 % u + t3 % v + t4 % w`; +DISCH_THEN(fun thm -> ONCE_REWRITE_TAC[GSYM thm]); +VECTOR_ARITH_TAC; +MATCH_MP_TAC aff_normball; +ASM_REWRITE_TAC[]; +]);; + + +(*---------------------------------------------------------------------------------------------------------------*) + + + +(*Lemma 4.3*) + + +let tr5=prove(`!r v0 C C'.(radial_norm r v0 C /\ radial_norm r v0 C' ==> (!u. ((v0+u) IN (C INTER C')) ==> (!t.(t > &0) /\ (t * norm u < r)==> (v0+t % u IN (C INTER C')))))`, REPEAT GEN_TAC THEN REWRITE_TAC[IN_INTER] THEN MESON_TAC[radial_norm;IN_INTER]);; +let tr6=prove(`!r v0 C C'.(radial_norm r v0 C /\ radial_norm r v0 C' ==> C INTER C' SUBSET normball v0 r)`, REPEAT GEN_TAC THEN MESON_TAC[radial_norm;INTER_SUBSET;SUBSET_TRANS]);; + +let inter_radial =prove(`!r v0 C C'.(radial_norm r v0 C /\ radial_norm r v0 C') ==> radial_norm r v0 (C INTER C')`, REPEAT GEN_TAC THEN MESON_TAC[radial_norm;tr5;tr6]);; + + +(*4.2.11 combining solid angle and volume*) + +(* removed by thales, nov 11, 2008. Conflicts with definition of phi already provided *) + +(* +let phi=new_definition `phi(h:real,t:real,l:real^2)= l$1*t*h*(t+h)/ &6 + l$2`;; +let A=new_definition `A(h:real,t:real,l:real^2)=(&1-h/t)*(phi (h,t,l)-phi (t,t,l))`;; + +*) + + +(*-------------------------------------------------------------------------------------*) +(* Finiteness *) +(*-------------------------------------------------------------------------------------*) + + +(*------------------------------------------------------*) +(* Useful definitions *) +(*------------------------------------------------------*) + +let cube= new_definition `cube (x:real^3)= {y:real^3 | !i. (1<= i)/\ (i<= 3) ==> ( x$i < y$i ) /\ ( y$i < x$i + &1)}`;; + + + +(* +let hinhcau=new_definition `hinhcau (x:real^3) (r:real)={y: real^3 | norm ( x - y ) < r } `;; +*) + +let hinhcau_deprecated = new_definition `hinhcau (x:real^A) r = ball (x,r)`;; + +let hinhcau = prove_by_refinement( + ` !(x:real^A) r. hinhcau x r = {y | norm (x - y) < r}`, + (* {{{ proof *) + [ + REWRITE_TAC[EXTENSION;IN_ELIM_THM;hinhcau_deprecated;ball;IN_ELIM_THM;dist] + ]);; + (* }}} *) + + +let set_of_cube= new_definition`set_of_cube S= {cube x| x IN S}`;; + +let union_of_cube= new_definition `union_of_cube (x:real^3) (r:real)= UNIONS (set_of_cube (hinhcau x r))`;; + +let int_ball= new_definition `int_ball (x:real^3) r= { y :real^3 | !i. (1<= i) /\ (i<= 3) ==> integer (y$i)} INTER (hinhcau x r)`;; +let union_of_int_cube=new_definition `union_of_int_cube (x:real^3) (r:real) = UNIONS (set_of_cube (int_ball x r))`;; + +(* +let map0=new_definition `map0 = \(c:real^3). cube c`;; +*) + +(* +let map0 = new_definition `map0 = cube`;; +*) + +(*-------------------------------------------------------*) +(* Somes lemmas *) +(*-------------------------------------------------------*) + +let COMPONENT_LE_NORM_3=prove(`!(x:real^3) i. (1<= i) /\ (i<= 3) ==> abs (x$i)<= norm x`,MESON_TAC[COMPONENT_LE_NORM;DIMINDEX_3]);; + + +let component_hinhcau_bound=prove(`! (p:real^3) (r:real) x. x IN hinhcau p r ==> (!i. (1 <= i) /\ ( i <= 3 ) ==> ( p$i - r <= x$i ) /\ ( x$i <= p$i + r))`,REPEAT GEN_TAC THEN REWRITE_TAC[hinhcau] THEN REWRITE_TAC[IN_ELIM_THM] THEN REWRITE_TAC[REAL_ARITH `(p$i):real - r <= x$i <=> p$i - x$i <= r`; REAL_ARITH `a:real <= b+c <=> -- c <= b-a`] THEN REWRITE_TAC[MESON[] `C/\B <=> B/\ C`] THEN REWRITE_TAC[GSYM REAL_ABS_BOUNDS] THEN REWRITE_TAC[MESON[] `C/\B <=> B/\ C`] THEN REPEAT STRIP_TAC THEN MP_TAC(SPECL [`p - x:real^3`; `i:num`] COMPONENT_LE_NORM_3) THEN ASM_REWRITE_TAC[] THEN UNDISCH_TAC `(norm (p:real^3 - x) < r):bool` THEN REWRITE_TAC[VECTOR_SUB_COMPONENT] THEN REAL_ARITH_TAC);; + +let int_interval= new_definition `int_interval (a:real) b = {x:real | integer x /\ (a<= x) /\ (x <= b)}`;; + +let finite_int_interval=prove(`! a:real b. FINITE (int_interval a b)`,REPEAT GEN_TAC THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[FINITE_INTSEG] THEN REWRITE_TAC[int_interval] THEN ASM_REWRITE_TAC[] THEN SIMP_TAC[FINITE_INTSEG]);; + +(* +let finite_int_interval=prove(`! a:real b. FINITE (int_interval a b)`,REPEAT GEN_TAC THEN ASSUME_TAC (GSYM INTEGER_IS_INT) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[INTEGER_IS_INT;FINITE_INTSEG] THEN REWRITE_TAC[int_interval] THEN ASM_REWRITE_TAC[] THEN SIMP_TAC[FINITE_INTSEG]);; +*) + +let vector_to_pair =new_definition`vector_to_pair (x:real^3) = x$1, x$2, x$3 `;; + +let lm1=prove(`!(x:real^3) (r:real) y. y IN int_ball x r ==> (!i. 1<=i /\i<= 3 ==> y$i IN int_interval (x$i - r) (x$i + r) )`,REPEAT GEN_TAC + THEN REWRITE_TAC[int_ball;IN_ELIM_THM] THEN REWRITE_TAC[IN_INTER;IN_ELIM_THM] THEN REWRITE_TAC[int_interval;IN_ELIM_THM] THEN MESON_TAC[component_hinhcau_bound]);; + + +let lm2 =prove(`! (x:real^3) (r:real) y. y IN (int_ball x r) ==> vector_to_pair y IN (int_interval (x$1 - r) (x$1 + r) CROSS (int_interval (x$2 - r) (x$2 + r)) CROSS (int_interval (x$3 - r) (x$3 + r)))`,REPEAT GEN_TAC THEN REWRITE_TAC[IN_CROSS;vector_to_pair] THEN MESON_TAC[ARITH_RULE `1<=i /\ i<=3 <=> i=1\/ i=2 \/ i=3`;lm1]);; + +let vector_eq1=prove(`! (x:real^3) y. x= y <=> x - y= vec 0`,REPEAT GEN_TAC THEN VECTOR_ARITH_TAC);; + +let trip_eq=prove(`! (x:real^3) (y:real^3). x$1, x$2, x$3= y$1,y$2,y$3 <=> !i. 1<= i /\ i<=3 ==> x$i= y$i `,REPEAT GEN_TAC THEN REWRITE_TAC[PAIR_EQ] THEN REWRITE_TAC[ARITH_RULE `1<=i /\ i<= 3 <=> i=1 \/ i=2 \/ i=3`] THEN MESON_TAC[]);; + +let int_ball_subset_CROSS=prove(`! (x:real^3) (r:real). INJ vector_to_pair (int_ball x r) (int_interval (x$1 - r) (x$1 + r) CROSS (int_interval (x$2 - r) (x$2 + r)) CROSS (int_interval (x$3 - r) (x$3 + r)))`,REPEAT GEN_TAC THEN REWRITE_TAC[INJ] THEN REWRITE_TAC[lm2] THEN REWRITE_TAC[vector_to_pair] THEN REPEAT GEN_TAC THEN REWRITE_TAC[CART_EQ;DIMINDEX_3;trip_eq] THEN MESON_TAC[]);; + + +let FINITE_IMAGE_INJ=prove(`! (h:real^3->B) (s:real^3 ->bool) t. (!(x:real^3). x IN s ==> h x IN t) /\ INJ h s t /\ FINITE t ==> FINITE s`, +REPEAT GEN_TAC THEN REWRITE_TAC[INJ] THEN SIMP_TAC[MESON[] `p /\ (p /\ q) /\ w <=> p /\ q /\ w`] THEN STRIP_TAC + THEN SUBGOAL_THEN `s= { x:real^3 | x IN s /\ (h:real^3->B) x IN t}` ASSUME_TAC +THENL [REWRITE_TAC[GSYM SUBSET_ANTISYM_EQ];ASM_MESON_TAC[FINITE_IMAGE_INJ_GENERAL]] + THEN REWRITE_TAC[SET_RULE `{x | x IN s /\ (h:real^3->B) x IN t} SUBSET s`] THEN REWRITE_TAC[SUBSET] THEN REWRITE_TAC[IN_ELIM_THM] THEN ASM_SIMP_TAC[]);; + +let finite_cross_int_interval=prove(`!(x:real^3) (r:real). FINITE (int_interval (x$1 - r) (x$1 + r) CROSS (int_interval (x$2 - r) (x$2 + r)) CROSS (int_interval (x$3 - r) (x$3 + r)))`,REPEAT GEN_TAC THEN MESON_TAC[finite_int_interval;FINITE_CROSS]);; + +(*----------------------------------------------------------*) +(* Finiteness of integer points in a ball *) +(*----------------------------------------------------------*) + + +let finite_int_ball=prove(`!(x:real^3) (r:real). FINITE (int_ball x r)`,REPEAT GEN_TAC THEN MATCH_MP_TAC(ISPECL [`vector_to_pair: real^3 -> real#real#real`; `(int_ball (x:real^3) (r:real)):real^3 -> bool`; `(int_interval ((x:real^3)$1 - r:real) (x$1 + r) CROSS (int_interval (x$2 - r) (x$2 + r)) CROSS (int_interval (x$3 - r) (x$3 + r))):real#real#real -> bool`] FINITE_IMAGE_INJ) THEN SIMP_TAC[SPECL [`x:real^3`;`r:real`;`x':real^3`] lm2;finite_cross_int_interval;int_ball_subset_CROSS]);; + +(*----------------------------------------------------------*) +(* Needed lemmas *) +(*----------------------------------------------------------*) + +let disjoint_line_interval=prove(`!(x:real) (y:real). integer x /\ integer y /\ (? (z:real). x< z /\ z< x+ &1 /\ y x= y`, +(* +REPEAT GEN_TAC THEN SIMP_TAC[GSYM INTEGER_IS_INT] THEN REPEAT STRIP_TAC THEN MP_TAC(SPECL [`x:real`;`y:real`] REAL_LE_CASES_INTEGERS) +-- 2/16/2011. *) +REPEAT GEN_TAC THEN SIMP_TAC[] THEN REPEAT STRIP_TAC THEN MP_TAC(SPECL [`x:real`;`y:real`] REAL_LE_CASES_INTEGERS) + THEN ASM_SIMP_TAC[] THEN ASM_SIMP_TAC[SPECL [`x:real`;`y:real`] REAL_LE_INTEGERS] THEN SIMP_TAC[MESON[] `(((P\/Q)\/R ==> P) <=> (Q\/R ==> P))`] + THEN STRIP_TAC +THENL [UNDISCH_TAC `(y:real Q ==> R <=> Q /\ P ==> R`] THEN DISCH_TAC THEN MP_TAC(REAL_ARITH ` (y:real) < z /\ (z:real) < x+ &1 ==> y< x+ &1 `);REWRITE_TAC[MESON[] `P ==> Q ==> R <=> Q /\ P ==> R`] THEN DISCH_TAC THEN MP_TAC(REAL_ARITH ` (x:real) < z /\ (z:real) < y+ &1 ==> x< y+ &1 `)] +THENL [ASM_SIMP_TAC[];ASM_SIMP_TAC[]] +THENL [UNDISCH_TAC `(x + &1 <= y:real):bool` THEN REWRITE_TAC[MESON[] `P ==> Q ==> R <=> Q /\ P ==> R`];UNDISCH_TAC `(y + &1 <= x:real):bool` THEN REWRITE_TAC[MESON[] `P ==> Q ==> R <=> Q /\ P ==> R`]] +THENL [MESON_TAC[REAL_ARITH `a:real < b /\ b<= a ==> F`];MESON_TAC[REAL_ARITH `a:real < b /\ b<= a ==> F`]]);; + +let vector_eq2=prove(`!(x:real^3) (y:real^3). (!i. 1 <= i /\ i <= 3 ==> x$i = y$i) ==> x = y `,SIMP_TAC[CART_EQ;DIMINDEX_3]);; + +let nonempty_cube=prove(`!(x:real^3). ~ (cube x= {})`,GEN_TAC THEN REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] + THEN EXISTS_TAC `(lambda i. (x:real^3)$i + &1/ &2):real^3` +THEN REWRITE_TAC[cube;IN_ELIM_THM] THEN GEN_TAC THEN DISCH_TAC THEN ASM_SIMP_TAC[LAMBDA_BETA;DIMINDEX_3] THEN REAL_ARITH_TAC);; + + +let disjoint_cube=prove(`!(x:real^3) (y:real^3).(!i. 1<=i /\ i<=3 ==> integer (x$i) /\ integer (y$i)) + ==> ( ~(DISJOINT (cube x) (cube y)) <=> x = y)`, REPEAT STRIP_TAC THEN EQ_TAC +THENL [REWRITE_TAC[DISJOINT;SET_RULE `~ ((B:real^3 -> bool)= {}) <=> ?(x:real^3). x IN B`];SIMP_TAC[]] +THENL [DISCH_TAC THEN FIRST_X_ASSUM(CHOOSE_TAC);REWRITE_TAC[DISJOINT]] +THENL [UNDISCH_TAC `(x' IN cube (x:real^3) INTER cube y):bool`;SIMP_TAC[INTER_ACI;nonempty_cube]] + THEN REWRITE_TAC[IN_INTER;IN_ELIM_THM;cube] THEN +UNDISCH_TAC `(!i. 1 <= i /\ i <= 3 ==> integer ((x:real^3)$i) /\ integer ((y:real^3)$i)):bool` + THEN SIMP_TAC[FORALL_3] THEN REWRITE_TAC[MESON[] `P ==> Q ==> R <=> P /\ Q ==> R`] + THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC (SPECL [`x:real^3`;`y:real^3`] vector_eq2) + THEN REWRITE_TAC[FORALL_3] THEN ASM_MESON_TAC[disjoint_line_interval]);; + + +(*-----------------------------------------------------------*) +(* Bijectivity of map from int_ball to set_of_cube *) +(*-----------------------------------------------------------*) + + +let inj_cube= prove_by_refinement( + `! (x:real^3) (r:real). INJ cube (int_ball x r) (set_of_cube (int_ball x r))`, + [ + REWRITE_TAC[INJ;set_of_cube]; + SIMP_TAC[SET_RULE `(x':real^3) IN int_ball x r ==> cube x' IN {cube x' | x' IN int_ball x r}`]; + REPEAT GEN_TAC; + REWRITE_TAC[int_ball]; + REWRITE_TAC[IN_INTER;IN_ELIM_THM]; + REPEAT STRIP_TAC; + ASM_SIMP_TAC[GSYM (SPECL [`x':real^3`;`y:real^3`] disjoint_cube)]; + BY(ASM_REWRITE_TAC[DISJOINT;INTER_ACI;nonempty_cube]); + ]);; + +let surj_cube= prove_by_refinement( + `! (x:real^3) (r:real). SURJ cube (int_ball x r) (set_of_cube (int_ball x r))`, + [ + REWRITE_TAC[SURJ]; + REWRITE_TAC[set_of_cube] ; + SIMP_TAC[SET_RULE `x' IN int_ball x r ==> cube x' IN {cube x' | x' IN int_ball x r}`]; + REPEAT GEN_TAC; + REWRITE_TAC[IN_ELIM_THM]; DISCH_TAC; FIRST_X_ASSUM CHOOSE_TAC + ; EXISTS_TAC `x'':real^3`; ASM_MESON_TAC[] + ]);; + + +let bij_cube=prove(`! (x:real^3) (r:real). BIJ cube (int_ball x r) (set_of_cube (int_ball x r))`, +MESON_TAC[BIJ;inj_cube;surj_cube]);; + + +(*-----------------------------------------------------------*) + +let surj2_cube= prove_by_refinement( + `!(x:real^3) (r:real). IMAGE cube (int_ball x r) = set_of_cube (int_ball x r)`, + [REWRITE_TAC[IMAGE] THEN REWRITE_TAC[] THEN REWRITE_TAC[set_of_cube] THEN SIMP_TAC[EXTENSION] +THEN REWRITE_TAC[IN_ELIM_THM] THEN SIMP_TAC[GSYM EXTENSION]]);; + + + +let int_ball_card_eq=prove(`!(x:real^3) (r:real). CARD (int_ball x r)= CARD (set_of_cube (int_ball x r))`, +REPEAT GEN_TAC THEN SIMP_TAC[GSYM (SPECL [`X:real^3`;`r:real` ] surj2_cube)] + THEN MP_TAC(SPECL [`x:real^3`;`r:real`] finite_int_ball) THEN MP_TAC(SPECL [`x:real^3`;`r:real`] inj_cube) + THEN REWRITE_TAC[MESON[] `a==>b==>c <=> a/\ b ==>c`;INJ] + THEN SIMP_TAC[set_of_cube;cube;SET_RULE `x' IN int_ball x r ==> cube x' IN {cube x' | x' IN int_ball x r}`] + THEN REWRITE_TAC[MESON[cube] `cube (x':real^3)= cube x'`;GSYM cube] + THEN MESON_TAC[ISPECL [`cube:real^3 -> real^3 -> bool`;`(int_ball x r):real^3 -> bool`] CARD_IMAGE_INJ]);; + + + +let cube_eq_interval=prove(`!(x:real^3). cube x= interval(x,x+ lambda i. &1)`, +GEN_TAC THEN REWRITE_TAC[EXTENSION;cube;interval;DIMINDEX_3] THEN SIMP_TAC[IN_ELIM_THM;LAMBDA_BETA;DIMINDEX_3] + THEN SIMP_TAC[VECTOR_ADD_COMPONENT;LAMBDA_BETA;DIMINDEX_3]);; + +let measurable_cube=prove( `!(x:real^3). measurable (cube x)`,REWRITE_TAC[cube_eq_interval;MEASURABLE_INTERVAL]);; + +let finite_set_of_cube=prove(`!(x:real^3)(r:real). FINITE (set_of_cube (int_ball x r))`, +MESON_TAC[ISPECL [`cube:real^3 -> real^3 -> bool`; `(int_ball x r):real^3 -> bool`] FINITE_IMAGE;finite_int_ball;surj2_cube]);; + +let MEASURABLE_UNIONS2 = prove + (`!f:(real^N->bool)->bool. + FINITE f /\ (!s. s IN f ==> measurable s) + ==> measurable (UNIONS f)`, +(* GEN_TAC THEN *)REWRITE_TAC[IMP_CONJ] THEN + MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + SIMP_TAC[UNIONS_0; UNIONS_INSERT; MEASURABLE_EMPTY] THEN + REWRITE_TAC[IN_INSERT] THEN REPEAT STRIP_TAC THEN + MATCH_MP_TAC MEASURABLE_UNION THEN ASM_SIMP_TAC[]);; + +let measurable_unions_cube=prove( `!(x:real^3)(r:real). measurable (UNIONS (set_of_cube (int_ball x r)))`, +REPEAT GEN_TAC THEN MATCH_MP_TAC(ISPEC `set_of_cube (int_ball x r):(real^3 -> bool) -> bool` MEASURABLE_UNIONS2) THEN REWRITE_TAC[finite_set_of_cube] THEN REWRITE_TAC[set_of_cube;IN_ELIM_THM] THEN MESON_TAC[measurable_cube]);; + +let non_empty_cinterval=prove(`!(x:real^3). ~ (interval[x,x+ (lambda i. &1)]= {})`, +GEN_TAC THEN REWRITE_TAC[GSYM MEMBER_NOT_EMPTY] THEN EXISTS_TAC `(lambda i. ((x:real^3)$i+ &1/ &2)):real^3` + THEN REWRITE_TAC[interval;IN_ELIM_THM;LAMBDA_BETA;DIMINDEX_3] + THEN GEN_TAC THEN DISCH_TAC THEN ASM_SIMP_TAC[VECTOR_ADD_COMPONENT;LAMBDA_BETA;DIMINDEX_3] + THEN REAL_ARITH_TAC);; + +(* in line 997 changed t to emoi, esusick 11/12 *) +let product_3=prove(`!(f:num -> real). product (1..3) f= f 1 * f 2 * f 3 `, let emoi= CONJUNCT2 PRODUCT_CLAUSES in +GEN_TAC THEN MP_TAC(GSYM (SPECL [`1:num`;`3:num`] NUMSEG_RREC)) + THEN SIMP_TAC[ARITH_RULE `1<= 3`;ARITH_RULE `3-1 = 2`] + THEN REPEAT DISCH_TAC + THEN MP_TAC(ISPECL [`3:num`;`f:num -> real`;`((1..2)):num ->bool`] emoi) + THEN SIMP_TAC[MESON[NUMSEG_RREC;FINITE_NUMSEG] `FINITE (1..2)`] + THEN SIMP_TAC[MESON[IN_NUMSEG;ARITH_RULE `~ (3<=2)`] ` ~( 3 IN (1..2))`] + THEN DISCH_TAC + THEN MP_TAC(GSYM (SPECL [`1:num`;`2:num`] NUMSEG_RREC)) + THEN SIMP_TAC[ARITH_RULE `1<=2`;ARITH_RULE `2-1=1`] + THEN MP_TAC(ISPECL [`2:num`;`f:num -> real`;`((1..1)):num ->bool`] emoi) + THEN SIMP_TAC[MESON[NUMSEG_RREC;FINITE_NUMSEG] `FINITE (1..1)`] + THEN SIMP_TAC[MESON[IN_NUMSEG;ARITH_RULE `~ (2<=1)`] ` ~( 2 IN (1..1))`] + THEN SIMP_TAC[SPECL [`f : num -> real`;`1:num`] PRODUCT_SING_NUMSEG] THEN REAL_ARITH_TAC);; + + +(*------------------------------------------------------------------*) +(* Measures of cube and union of cubes *) +(*------------------------------------------------------------------*) + + +let interval_upper_lowerbound=prove(`!(x:real^3). (interval_upperbound (interval [x,x + (lambda i. &1)])= x + (lambda i. &1)) /\ ( interval_lowerbound (interval [x,x + (lambda i. &1)])= x)`, +GEN_TAC +THEN MP_TAC(ISPECL [`x:real^3`;`x + (lambda i. &1):real^3`] INTERVAL_UPPERBOUND) +THEN MP_TAC(ISPECL [`x:real^3`;`x + (lambda i. &1):real^3`] INTERVAL_LOWERBOUND) +THEN REWRITE_TAC[VECTOR_ADD_COMPONENT;DIMINDEX_3] +THEN SIMP_TAC[LAMBDA_BETA;DIMINDEX_3] +THEN SIMP_TAC[REAL_ARITH `a:real <= a+ &1`]);; + + +let measure_cube=prove(`!(x:real^3). measure (cube x)= &1`, +REWRITE_TAC[cube_eq_interval] +THEN GEN_TAC +THEN SIMP_TAC[MEASURE_INTERVAL] +THEN REWRITE_TAC[content] +THEN SIMP_TAC[MESON[] `(if P then a else b) = &1 <=> if P then a= &1 else b= &1`] +THEN SIMP_TAC[COND_EXPAND] +THEN SIMP_TAC[non_empty_cinterval;DIMINDEX_3] +THEN REWRITE_TAC[GSYM VECTOR_SUB_COMPONENT;PRODUCT_CLAUSES;LAMBDA_BETA;DIMINDEX_3] +THEN SIMP_TAC[ISPEC `(\i. (interval_upperbound (interval [x,x + (lambda i. &1)]) - +interval_lowerbound (interval [x,x + (lambda i. &1)]))$i):num -> real` product_3] +THEN SIMP_TAC[SPEC `x:real^3` interval_upper_lowerbound] +THEN SIMP_TAC[VECTOR_ARITH `((a:real^3) + b )- a = b`] +THEN SIMP_TAC[product_3] +THEN SIMP_TAC[LAMBDA_BETA;DIMINDEX_3;ARITH_RULE `1<= 1 /\ 1<= 3/\ 1<= 2 /\ 2<= 3 /\ 1<= 3 /\ 3<=3`] +THEN REAL_ARITH_TAC);; + + +let has_measure_cube=prove(`!(x:real^3)(r:real) (s:real^3 -> bool). s IN set_of_cube (int_ball x r) ==> s has_measure &1`, +REPEAT GEN_TAC THEN REWRITE_TAC[set_of_cube;IN_ELIM_THM] THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN ASM_MESON_TAC[measurable_cube;measure_cube;HAS_MEASURE_MEASURABLE_MEASURE]);; + +(*Negligiblity of intersection of cubes *) + +let negligible_cube=prove( `!(x:real^3)(r:real) (s:real^3 ->bool) (t:real^3 ->bool). s IN set_of_cube (int_ball x r) /\ t IN set_of_cube (int_ball x r) /\ ~(s = t) +==> negligible (s INTER t)`,REPEAT GEN_TAC THEN REWRITE_TAC[set_of_cube;IN_ELIM_THM] + THEN REPEAT STRIP_TAC THEN UNDISCH_TAC `(~ ((s:real^3 -> bool) = t)):bool` THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN MP_TAC(MESON[] ` (x':real^3 = x'') ==> (cube x'= cube x'')`) + THEN ONCE_REWRITE_TAC[MESON[] `(A ==> B) <=> (~B ==> ~A)`] THEN ASM_REWRITE_TAC[] + THEN MP_TAC(MESON[int_ball;IN_INTER;IN_ELIM_THM] `x' IN int_ball x r /\ x'' IN int_ball x r ==> !i. 1 <= i /\ i <= 3 ==> integer ((x')$i) /\ integer ((x'')$i)`) THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN MP_TAC(SPECL [`x':real^3`;`x'':real^3`] disjoint_cube) THEN ASM_REWRITE_TAC[] +THEN SIMP_TAC[DISJOINT;NEGLIGIBLE_EMPTY] THEN ONCE_REWRITE_TAC[MESON[] `( a<=>b ) <=> (b<=>a)`] + THEN SIMP_TAC[NEGLIGIBLE_EMPTY;MESON[] `~ a ==> ~b <=> b==> a`]);; + + +let SUM_CONST2 = prove + (`!c s. FINITE s ==> (sum s (\n. c) = &(CARD s) * c)`, + GEN_TAC THEN MATCH_MP_TAC FINITE_INDUCT_STRONG THEN + SIMP_TAC[SUM_CLAUSES; CARD_CLAUSES; GSYM REAL_OF_NUM_SUC] THEN + REPEAT STRIP_TAC THEN REAL_ARITH_TAC);; + +(*There are two different theorems about SUM_CONST*) + + +let measure_unions_of_cube=prove( `!(x:real^3) (r:real). measure (UNIONS (set_of_cube (int_ball x r)))= & (CARD (set_of_cube (int_ball x r)))`,REPEAT GEN_TAC THEN MP_TAC(ISPECL [`(\s. &1):(real^3 ->bool) ->real`;`set_of_cube (int_ball x r):(real^3 -> bool) -> bool`] MEASURE_NEGLIGIBLE_UNIONS) + THEN SIMP_TAC[SPECL [`x:real^3`;`r:real`] finite_set_of_cube;ABS_SIMP;has_measure_cube] + THEN REWRITE_TAC[SPECL [`x:real^3`;`r:real`] has_measure_cube] + THEN REWRITE_TAC[SPECL [`x:real^3`;`r:real`] negligible_cube] + THEN SIMP_TAC[] THEN DISCH_TAC THEN MP_TAC(SPECL [`x:real^3`;`r:real`] finite_set_of_cube) THEN REWRITE_TAC[REAL_ARITH `&(CARD (set_of_cube (int_ball x r)))= &(CARD (set_of_cube (int_ball x r)))* &1`] + THEN MESON_TAC[ISPECL [`&1:real`;`set_of_cube (int_ball x r):(real^3 ->bool)-> bool`] SUM_CONST2;REAL_ARITH `&(CARD (set_of_cube (int_ball x r)))= &(CARD (set_of_cube (int_ball x r)))* &1`]);; + +(*-----------------------------------------------------------------*) +(* Union of cubes is contained in ball *) +(*-----------------------------------------------------------------*) + + +let pow_lesthan_1=prove( `!(a:real). &0 < a /\ a < &1 ==> a*a < &1`,REPEAT STRIP_TAC THEN MP_TAC(SPECL [`a:real`;`a:real`;`&1:real`] REAL_LT_LMUL) THEN ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[REAL_ARITH `(x:real)* &1= x`;REAL_ARITH `a:real a< c`]);; + + +let cube_to_ball=prove(`!(x:real^3) (y:real^3). y IN cube x ==> norm (x-y)< sqrt(&3)`, +REPEAT STRIP_TAC THEN MP_TAC(ISPEC `(x-y):real^3` NORM_POS_LE) + THEN MP_TAC (SPEC `&3:real` SQRT_POS_LE) THEN ASM_REWRITE_TAC[REAL_ARITH `&0<= &3`;REAL_ARITH `&0 A= abs (A)`] + THEN ONCE_REWRITE_TAC[GSYM REAL_ABS_REFL] + THEN ONCE_REWRITE_TAC[MESON[] `a= b <=> b=a`] + THEN REWRITE_TAC[MESON[] `((a:real) = b ==> (c:real) = d ==> c< a ) <=> ((a:real) = b ==> (c:real) = d ==> d< b )`] + THEN REWRITE_TAC[REAL_LT_SQUARE_ABS] THEN SIMP_TAC[SQRT_POW_2; REAL_ARITH `&0<= &3`] + THEN SIMP_TAC[NORM_POW_2;DOT_3] THEN REWRITE_TAC[VECTOR_SUB_COMPONENT] THEN UNDISCH_TAC `(y IN cube (x:real^3)):bool` + THEN REWRITE_TAC[cube;IN_ELIM_THM] THEN REWRITE_TAC[FORALL_3] + THEN REWRITE_TAC[REAL_ARITH `(a:real) &0< b-a /\ b-a < &1`] + THEN ONCE_REWRITE_TAC[REAL_FIELD `((x:real^3)$1 - (y:real^3)$1) * (x$1 - y$1) + + (x$2 - y$2) * (x$2 - y$2) + + (x$3 - y$3) * (x$3 - y$3)= (y$1 - x$1) * (y$1 - x$1) + + (y$2 - x$2) * (y$2 - x$2) + + (y$3 - x$3) * (y$3 - x$3)`] + THEN REPEAT STRIP_TAC THEN MP_TAC(MESON[pow_lesthan_1] `&0 < (y:real^3)$1 - (x:real^3)$1 /\ y$1 - x$1 < &1 ==> (y$1 - x$1) * (y$1 - x$1)< &1`) + THEN ASM_REWRITE_TAC[] + THEN MP_TAC(MESON[pow_lesthan_1] `&0 < (y:real^3)$2 - (x:real^3)$2 /\ y$2 - x$2 < &1 ==> (y$2 - x$2) * (y$2 - x$2)< &1`) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(MESON[pow_lesthan_1] `&0 < (y:real^3)$3 - (x:real^3)$3 /\ y$3 - x$3 < &1 ==> (y$3 - x$3) * (y$3 - x$3)< &1`) THEN ASM_REWRITE_TAC[] + THEN MESON_TAC[REAL_ARITH `(a:real)< &1 /\ b< &1 /\c < &1 ==> a+b+c < &3`]);; + + +let unions_cube_subset_ball=prove(`!(x:real^3) (r:real). UNIONS (set_of_cube (int_ball x r)) SUBSET (hinhcau x (r+ sqrt (&3)))`,REPEAT GEN_TAC THEN REWRITE_TAC[SUBSET;UNIONS] + THEN GEN_TAC THEN REWRITE_TAC[hinhcau;IN_ELIM_THM] + THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC + THEN UNDISCH_TAC `(u IN set_of_cube (int_ball x r) /\ (x':real^3) IN u):bool` + THEN REWRITE_TAC[set_of_cube] THEN REWRITE_TAC[IN_ELIM_THM] THEN REPEAT STRIP_TAC + THEN UNDISCH_TAC `((x':real^3) IN u):bool` THEN ASM_REWRITE_TAC[] + THEN DISCH_TAC THEN MP_TAC(SPECL [`x'':real^3`;`x':real^3`] cube_to_ball) THEN ASM_REWRITE_TAC[] + THEN UNDISCH_TAC `(x'' IN int_ball (x:real^3) r):bool` + THEN REWRITE_TAC[int_ball;IN_INTER] THEN STRIP_TAC + THEN MP_TAC(MESON[hinhcau;IN_ELIM_THM] `(x'':real^3) IN (hinhcau x r) ==> norm (x - x'') < r`) THEN ASM_REWRITE_TAC[] + THEN ONCE_REWRITE_TAC[MESON[VECTOR_ARITH `(x:real^3)- x' = (x - x'') + (x'' - x')`] `norm ((x:real^3) - x') < r + sqrt (&3) <=> norm ((x - x'') + (x'' - x')) < r + sqrt (&3)`] + THEN MESON_TAC[ISPECL [`(x - x''):real^3`;`(x'' - x'):real^3`] NORM_TRIANGLE;REAL_ARITH `((e:real) <= (a + c)) /\a e < b+ d`]);; + +(*-----------------------------------------------------------------*) + + +let hinhcau_ball=prove(`!(x:real^3)(r:real). hinhcau x r= ball (x,r)`,REPEAT GEN_TAC THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM] + THEN REWRITE_TAC[hinhcau;ball;IN_ELIM_THM;dist]);; + +let measure_unions_cube_less_ball=prove(`!(x:real^3)(r:real). measure (UNIONS (set_of_cube (int_ball x r))) +<= measure (hinhcau x (r+ sqrt(&3)))`,REPEAT GEN_TAC THEN MP_TAC(SPECL [`x:real^3`;`r:real`] unions_cube_subset_ball) THEN MP_TAC(SPECL [`x:real^3`;`r:real`] measurable_unions_cube) THEN SIMP_TAC[SPECL [`x:real^3`;`r+ sqrt(&3):real`] hinhcau_ball] + THEN MP_TAC(ISPECL [`x:real^3`;`r+ sqrt(&3):real`] MEASURABLE_BALL) THEN MESON_TAC[MEASURE_SUBSET]);; + +let measure_hinhcau=prove(`!(x:real^3)(r:real). &0<= r ==> measure (hinhcau x r) = &4 / &3 * pi * (r pow 3)`,MESON_TAC[hinhcau_ball;VOLUME_BALL]);; + + +(*-----------------------------------------------------------------------*) +(*Lemma 2.14 [WQZISRI]:Upperbound for number of integer points in a ball *) +(*-----------------------------------------------------------------------*) + +let WQZISRI=prove(`!(p:real^3)(r:real). &0<= r ==> FINITE (int_ball p r) /\ (& (CARD(int_ball p r)) +<= (&4/ &3) * pi * ((r+ sqrt (&3)) pow 3))`,REPEAT GEN_TAC THEN SIMP_TAC[finite_int_ball] + THEN DISCH_TAC THEN MP_TAC(GSYM(SPECL [`p:real^3`;`r + sqrt (&3):real`] measure_hinhcau)) + THEN MP_TAC(MESON[REAL_LE_RADD;REAL_ARITH `&0+ a= a`] `&0<= r ==> sqrt(&3)<= r+ sqrt(&3)`) + THEN ASM_REWRITE_TAC[] THEN MP_TAC(SPEC `&3:real` SQRT_POS_LE) THEN REWRITE_TAC[REAL_ARITH `&0<= &3`] + THEN ONCE_REWRITE_TAC[MESON[] `a ==> b==>c ==> d <=> a/\b ==>c==>d`] + THEN DISCH_TAC THEN MP_TAC(REAL_ARITH `&0 <= sqrt (&3) /\ sqrt (&3) <= r + sqrt (&3) ==> &0<= r+ sqrt(&3)`) THEN ASM_REWRITE_TAC[] + THEN SIMP_TAC[] THEN SIMP_TAC[int_ball_card_eq] THEN SIMP_TAC[GSYM measure_unions_of_cube] THEN SIMP_TAC[measure_unions_cube_less_ball]);; + + +(*------------------------------------------------------------------------*) + + +let ccube=new_definition`ccube (x:real^3)={y :real^3 | !i. 1<= i /\ i<= 3 ==> x$i<= y$i /\ y$i <= x$i + &1}`;; + +let set_of_ccube=new_definition`set_of_ccube(S:real^3 -> bool)= {ccube x| x IN S}`;; + +let close_hinhcau=new_definition`close_hinhcau (x:real^3)(r:real)={ y:real^3 | norm (y-x)<= r}`;; + +let map1=new_definition`map1 (x:real^3)= ccube x`;; + + +let daumut_ccube=prove(`!(x:real^3). x IN ccube x /\ (x + lambda i. &1) IN ccube x`,REWRITE_TAC[ccube;IN_ELIM_THM] + THEN REWRITE_TAC[VECTOR_ADD_COMPONENT;LAMBDA_BETA;DIMINDEX_3] + THEN SIMP_TAC[LAMBDA_BETA;DIMINDEX_3] THEN REAL_ARITH_TAC);; + + +let different_ccube=prove( `!(x:real^3) (y:real^3).((ccube x) = (ccube y) ==> x = y)`, +REPEAT STRIP_TAC THEN MP_TAC(SPEC `x:real^3` daumut_ccube) THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[ccube;VECTOR_ADD_COMPONENT;LAMBDA_BETA;DIMINDEX_3;IN_ELIM_THM] + THEN SIMP_TAC[LAMBDA_BETA;DIMINDEX_3] THEN SIMP_TAC[REAL_ARITH `(a:real) + &1 <= b+ &1 <=> a <= b `] + THEN REWRITE_TAC[FORALL_3] THEN REPEAT STRIP_TAC THEN MATCH_MP_TAC(SPECL [`x:real^3`;`y:real^3`] vector_eq2) + THEN REWRITE_TAC[FORALL_3] THEN ASM_MESON_TAC[REAL_ARITH `(a:real)<= b /\ b<= a ==> a=b`]);; + + +let inj_map1=prove(`! (x:real^3) (r:real). INJ map1 (int_ball x r) (set_of_ccube (int_ball x r))`, +REWRITE_TAC[INJ;map1;set_of_ccube] THEN SIMP_TAC[SET_RULE `x' IN int_ball x r ==> ccube x' IN {ccube x' | x' IN int_ball x r}`] THEN REPEAT GEN_TAC THEN REWRITE_TAC[int_ball] THEN MESON_TAC[different_ccube]);; + +let surj2_map1=prove(`!(x:real^3) (r:real). IMAGE map1 (int_ball x r) = set_of_ccube (int_ball x r)`, +REWRITE_TAC[IMAGE] THEN REWRITE_TAC[map1] THEN REWRITE_TAC[set_of_ccube] THEN SIMP_TAC[EXTENSION] +THEN REWRITE_TAC[IN_ELIM_THM] THEN SIMP_TAC[GSYM EXTENSION]);; + +let int_ball_card_eq_ccube=prove(`!(x:real^3) (r:real). CARD (int_ball x r)= CARD (set_of_ccube (int_ball x r))`, +REPEAT GEN_TAC THEN SIMP_TAC[GSYM (SPECL [`X:real^3`;`r:real` ] surj2_map1)] + THEN MP_TAC(SPECL [`x:real^3`;`r:real`] finite_int_ball) THEN MP_TAC(SPECL [`x:real^3`;`r:real`] inj_map1) + THEN REWRITE_TAC[MESON[] `a==>b==>c <=> a/\ b ==>c`;INJ] + THEN SIMP_TAC[set_of_ccube;map1;SET_RULE `x' IN int_ball x r ==> ccube x' IN {ccube x' | x' IN int_ball x r}`] + THEN REWRITE_TAC[MESON[map1] `ccube (x':real^3)= map1 x'`;GSYM map1] + THEN MESON_TAC[ISPECL [`map1:real^3 -> real^3 -> bool`;`(int_ball x r):real^3 -> bool`] CARD_IMAGE_INJ]);; + +let ccube_eq_interval=prove(`!(x:real^3). ccube x= interval[x,x+ lambda i. &1]`, +GEN_TAC THEN REWRITE_TAC[EXTENSION;ccube;interval;DIMINDEX_3] THEN SIMP_TAC[IN_ELIM_THM;LAMBDA_BETA;DIMINDEX_3] + THEN SIMP_TAC[VECTOR_ADD_COMPONENT;LAMBDA_BETA;DIMINDEX_3]);; + + +let measurable_ccube=prove( `!(x:real^3). measurable (ccube x)`,REWRITE_TAC[ccube_eq_interval;MEASURABLE_INTERVAL]);; + +let finite_set_of_ccube=prove(`!(x:real^3)(r:real). FINITE (set_of_ccube (int_ball x r))`, +MESON_TAC[ISPECL [`map1:real^3 -> real^3 -> bool`; `(int_ball x r):real^3 -> bool`] FINITE_IMAGE;finite_int_ball;surj2_map1]);; + + + +let measurable_unions_ccube=prove( `!(x:real^3)(r:real). measurable (UNIONS (set_of_ccube (int_ball x r)))`, +REPEAT GEN_TAC THEN MATCH_MP_TAC(ISPEC `set_of_ccube (int_ball x r):(real^3 -> bool) -> bool` MEASURABLE_UNIONS2) +THEN REWRITE_TAC[finite_set_of_ccube] THEN REWRITE_TAC[set_of_ccube;IN_ELIM_THM] THEN MESON_TAC[measurable_ccube]);; + + +let measure_ccube=prove(`!(x:real^3). measure (ccube x)= &1`,REWRITE_TAC[ccube_eq_interval] + THEN GEN_TAC THEN SIMP_TAC[MEASURE_INTERVAL] THEN REWRITE_TAC[content] + THEN SIMP_TAC[MESON[] `(if P then a else b) = &1 <=> if P then a= &1 else b= &1`] + THEN SIMP_TAC[COND_EXPAND] THEN SIMP_TAC[non_empty_cinterval;DIMINDEX_3] + THEN REWRITE_TAC[GSYM VECTOR_SUB_COMPONENT;PRODUCT_CLAUSES;LAMBDA_BETA;DIMINDEX_3] + THEN SIMP_TAC[ISPEC `(\i. (interval_upperbound (interval [x,x + (lambda i. &1)]) - +interval_lowerbound (interval [x,x + (lambda i. &1)]))$i):num -> real` product_3] + THEN SIMP_TAC[SPEC `x:real^3` interval_upper_lowerbound] + THEN SIMP_TAC[VECTOR_ARITH `((a:real^3) + b )- a = b`] + THEN SIMP_TAC[product_3] + THEN SIMP_TAC[LAMBDA_BETA;DIMINDEX_3;ARITH_RULE `1<= 1 /\ 1<= 3/\ 1<= 2 /\ 2<= 3 /\ 1<= 3 /\ 3<=3`] + THEN REAL_ARITH_TAC);; + + +let has_measure_ccube=prove(`!(x:real^3)(r:real) (s:real^3 -> bool). s IN set_of_ccube (int_ball x r) ==> s has_measure &1`, +REPEAT GEN_TAC THEN REWRITE_TAC[set_of_ccube;IN_ELIM_THM] THEN DISCH_TAC THEN FIRST_X_ASSUM CHOOSE_TAC THEN ASM_MESON_TAC[measurable_ccube;measure_ccube;HAS_MEASURE_MEASURABLE_MEASURE]);; + + +let measure_element_set_ccube=prove( `! (S:real^3 -> bool) (t:real^3 -> bool). t IN (set_of_ccube S) ==> measure t= &1`, +REPEAT GEN_TAC THEN REWRITE_TAC[set_of_ccube;IN_ELIM_THM]THEN MESON_TAC[measure_ccube]);; + +let sum_measure_ccube=prove(`!(p:real^3)(r:real). sum (set_of_ccube (int_ball p r)) (\s. measure s)= &(CARD (set_of_ccube (int_ball p r)))`,REPEAT GEN_TAC + THEN MP_TAC(ISPECL [`(\s. measure s):(real^3-> bool)-> real`;`(\s. &1):(real^3-> bool)-> real`;`set_of_ccube (int_ball p r):(real^3->bool) -> bool`] SUM_EQ) + THEN REWRITE_TAC[IN_ELIM_THM] + THEN REWRITE_TAC[measure_element_set_ccube] + THEN REWRITE_TAC[MESON[] `a=b ==> a=c <=> a=b ==> b=c`] + THEN MP_TAC(SPECL [`p:real^3`;`r:real`] finite_set_of_ccube) + THEN MESON_TAC[ISPECL [`&1:real`;`set_of_ccube (int_ball x r):(real^3 ->bool)-> bool`] SUM_CONST;REAL_ARITH `&(CARD (set_of_ccube (int_ball x r)))= &(CARD (set_of_ccube (int_ball x r)))* &1`]);; + +(* There are two different theorems about SUM_EQ and sum *) + + +let mea_unions_ccube_le_card=prove(`!(x:real^3) (r:real). measure (UNIONS (set_of_ccube (int_ball x r)))<= & (CARD (set_of_ccube (int_ball x r)))`,REPEAT GEN_TAC THEN MP_TAC(ISPEC `set_of_ccube (int_ball x r):(real^3 -> bool) -> bool` MEASURE_UNIONS_LE) THEN SIMP_TAC[SPECL [`x:real^3`;`r:real`] finite_set_of_ccube;ABS_SIMP;has_measure_ccube] + THEN REWRITE_TAC[set_of_ccube;IN_ELIM_THM] + THEN REWRITE_TAC[MESON[measurable_ccube] `!s. (?x'. x' IN int_ball x r /\ s = ccube x') ==> measurable s`] THEN REWRITE_TAC[GSYM set_of_ccube] THEN MESON_TAC[SPECL [`x:real^3`;`r:real`] sum_measure_ccube]);; + +let in_ccube_floor=prove(`!(x:real^3). x IN ccube (lambda i. floor (x$i)) `,GEN_TAC THEN REWRITE_TAC[ccube;IN_ELIM_THM] + THEN GEN_TAC THEN SIMP_TAC[LAMBDA_BETA;DIMINDEX_3] + THEN REWRITE_TAC[FLOOR] THEN MESON_TAC[FLOOR;REAL_ARITH `(a:real) < b ==> a<= b`]);; +REAL_LE_SQUARE_ABS;; +REAL_ABS_REFL;; + +let pow_lesthan_eq_1=prove( `!(a:real). &0 <= a /\ a <= &1 ==> a*a <= &1`,REPEAT STRIP_TAC THEN MP_TAC(SPECL [`a:real`;`a:real`;`&1:real`] REAL_LE_LMUL) THEN ASM_REWRITE_TAC[] THEN ASM_MESON_TAC[REAL_ARITH `(x:real)* &1= x`;REAL_ARITH `a:real <=b /\ b<= c ==> a<= c`]);; + +let ccube_to_ball=prove(`!(x:real^3) (y:real^3). y IN ccube x ==> norm (x-y)<= sqrt(&3)`, +REPEAT STRIP_TAC THEN MP_TAC(ISPEC `((x:real^3)-y):real^3` NORM_POS_LE) + THEN MP_TAC (SPEC `&3:real` SQRT_POS_LE) THEN ASM_REWRITE_TAC[REAL_ARITH `&0<= &3`;REAL_ARITH `&0 A= abs (A)`] + THEN ONCE_REWRITE_TAC[GSYM REAL_ABS_REFL] + THEN ONCE_REWRITE_TAC[MESON[] `(a:real)= b <=> b=a`] + THEN REWRITE_TAC[MESON[] `((a:real) = b ==> (c:real) = d ==> c<= a ) <=> ((a:real) = b ==> (c:real) = d ==> d<= b )`] + THEN REWRITE_TAC[REAL_LE_SQUARE_ABS] THEN SIMP_TAC[SQRT_POW_2; REAL_ARITH `&0<= &3`] + THEN SIMP_TAC[NORM_POW_2;DOT_3] THEN REWRITE_TAC[VECTOR_SUB_COMPONENT] THEN UNDISCH_TAC `(y IN ccube (x:real^3)):bool` + THEN REWRITE_TAC[ccube;IN_ELIM_THM] THEN REWRITE_TAC[FORALL_3] + THEN REWRITE_TAC[REAL_ARITH `(a:real) <=b /\ b<= a+ &1 <=> &0<= b-a /\ b-a <= &1`] + THEN ONCE_REWRITE_TAC[REAL_FIELD `((x:real^3)$1 - (y:real^3)$1) * (x$1 - y$1) + + (x$2 - y$2) * (x$2 - y$2) + + (x$3 - y$3) * (x$3 - y$3)= (y$1 - x$1) * (y$1 - x$1) + + (y$2 - x$2) * (y$2 - x$2) + + (y$3 - x$3) * (y$3 - x$3)`] + THEN REPEAT STRIP_TAC THEN MP_TAC(MESON[pow_lesthan_eq_1] `&0 <= (y:real^3)$1 - (x:real^3)$1 /\ y$1 - x$1 <= &1 ==> (y$1 - x$1) * (y$1 - x$1)<= &1`) + THEN ASM_REWRITE_TAC[] + THEN MP_TAC(MESON[pow_lesthan_eq_1] `&0 <= (y:real^3)$2 - (x:real^3)$2 /\ y$2 - x$2 <= &1 ==> (y$2 - x$2) * (y$2 - x$2)<= &1`) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(MESON[pow_lesthan_eq_1] `&0 <= (y:real^3)$3 - (x:real^3)$3 /\ y$3 - x$3 <= &1 ==> (y$3 - x$3) * (y$3 - x$3)<= &1`) THEN ASM_REWRITE_TAC[] THEN MESON_TAC[REAL_ARITH `(a:real)<= &1 /\ b<= &1 /\c <= &1 ==> a+b+c <= &3`]);; + + +let ball_subset_union_ccube=prove(`!(x:real^3) (r:real).ball(x,r- sqrt(&3)) SUBSET (UNIONS (set_of_ccube (int_ball x r)))`,REPEAT GEN_TAC THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;UNIONS;set_of_ccube] + THEN GEN_TAC THEN REWRITE_TAC[ball;IN_ELIM_THM] + THEN REWRITE_TAC[dist] THEN DISCH_TAC THEN EXISTS_TAC `ccube (lambda i. (floor (((x':real^3))$i)):real):real^3 ->bool` + THEN REWRITE_TAC[SPEC `x':real^3` in_ccube_floor] + THEN EXISTS_TAC `(lambda i. (floor ((x':real^3)$i)):real):real^3` + THEN SIMP_TAC[] THEN REWRITE_TAC[int_ball;IN_ELIM_THM] + THEN REWRITE_TAC[IN_INTER;IN_ELIM_THM] + THEN SIMP_TAC[LAMBDA_BETA;DIMINDEX_3;hinhcau;IN_ELIM_THM;FLOOR] + THEN REWRITE_TAC[FLOOR;(* GSYM INTEGER_IS_INT *)] + THEN REWRITE_TAC[MESON[VECTOR_ARITH `(x:real^3) - (lambda i. floor ((x':real^3)$i))= (x- x') + (x' - (lambda i. floor (x'$i)))`] `(norm:real^3 ->real) ((x:real^3) - (lambda i. (floor ((x':real^3)$i)):real))= norm ((x- x') + (x' - (lambda i. floor (x'$i))))`] + THEN MP_TAC(SPECL [`(lambda i. (floor ((x':real^3)$i)):real):real^3`;`x':real^3`] ccube_to_ball) + THEN SIMP_TAC[SPEC `x':real^3` in_ccube_floor] + THEN UNDISCH_TAC `((norm:real^3 ->real) ((x:real^3) - x') < (r:real) - sqrt (&3)):bool` + THEN MP_TAC(ISPECL [`x - (x':real^3)`; ` x' - (lambda i. (floor ((x':real^3)$i):real)):real^3`] NORM_TRIANGLE) + THEN ONCE_REWRITE_TAC[MESON[] `a ==>b ==> c ==> d <=> a/\b/\c ==> d`] + THEN MESON_TAC[NORM_SUB;REAL_ARITH `a:real <= b+ c /\ b< r- sqrt(&3) /\ c<= sqrt (&3) ==> a< r`]);; + + +let volume_ball_gon=prove( `!(x:real^3)(r:real). sqrt(&3) <= r ==> measurable (ball(x,r- sqrt(&3))) /\ measure (ball(x,r- sqrt(&3)))= (&4/ &3)* pi* (r- sqrt (&3)) pow 3`,ONCE_REWRITE_TAC[REAL_ARITH `a:real <=b <=> &0<= b-a`] THEN MESON_TAC[MEASURABLE_BALL;VOLUME_BALL]);; + +let lower_bound_measure_unions_ccube=prove(`!(x:real^3)(r:real). (sqrt(&3)<= r) ==> (&4/ &3)* pi* (r- sqrt (&3)) pow 3 <= measure (UNIONS (set_of_ccube (int_ball x r)))`,REPEAT STRIP_TAC THEN MP_TAC(ISPECL [`ball(x,r- sqrt(&3)):real^3 -> bool`;`UNIONS (set_of_ccube (int_ball x r)):real^3 -> bool`] MEASURE_SUBSET) THEN ASM_REWRITE_TAC[volume_ball_gon; measurable_unions_ccube;ball_subset_union_ccube] THEN ASM_SIMP_TAC[volume_ball_gon]);; + + +(*-----------------------------------------------------------------------*) +(* Lemma 2.15 [PWVIIOL] lower bound for number of integer points in ball *) +(*-----------------------------------------------------------------------*) + + +let PWVIIOL=prove(`!(x:real^3)(r:real). (sqrt(&3) <= r) ==> FINITE (int_ball x r) /\ (&4/ &3)* pi* (r- sqrt (&3)) pow 3 <= &(CARD(int_ball x r))`,REPEAT STRIP_TAC THEN SIMP_TAC[finite_int_ball] THEN ASM_MESON_TAC[ int_ball_card_eq_ccube;mea_unions_ccube_le_card;lower_bound_measure_unions_ccube;REAL_ARITH `a:real <= b /\ b<= c ==> a<= c`]);; + + +(*-----------------------------------------------------------------------*) + + +let integer_point= new_definition`integer_point (S:real^3 -> bool)= {x:real^3 | (!i. 1<= i /\ i<=3 ==> integer(x$i)) /\ x IN S}`;; + +let int_ball_subset=prove( `!(x:real^3)(r1:real)(r2:real). r1< r2 ==> (int_ball x r1) SUBSET (int_ball x r2)`,REPEAT STRIP_TAC THEN REWRITE_TAC[SUBSET;int_ball;IN_INTER;IN_ELIM_THM] THEN GEN_TAC THEN SIMP_TAC[] + THEN REWRITE_TAC[hinhcau;IN_ELIM_THM] THEN ASM_MESON_TAC[REAL_ARITH `a:real< b /\ b< c ==> a< c`]);; + +let card_int_ball_ineq=prove(`!(x:real^3)(r1:real)(r2:real). r1< r2 ==> CARD (int_ball x r1)<= CARD (int_ball x r2)`,MESON_TAC[int_ball_subset;finite_int_ball;CARD_SUBSET]);; + + +let eq_def_intball=prove( `!(x:real^3)(k1:real)(k2:real)(r:real).(&0< k1 /\ &0< k2 /\ k2<= r) ==> integer_point (ball(x,r+ k1) DIFF ball(x,r- k2)) = (int_ball x (r+ k1)) DIFF (int_ball x (r- k2))`,REPEAT STRIP_TAC + THEN REWRITE_TAC[EXTENSION;integer_point;DIFF;ball;int_ball;IN_ELIM_THM] + THEN GEN_TAC THEN REWRITE_TAC[IN_ELIM_THM] THEN REWRITE_TAC[dist;IN_INTER;IN_ELIM_THM] + THEN REWRITE_TAC[hinhcau;IN_ELIM_THM;MESON[] `~ (A /\ B ) <=> ~A \/ ~B`] + THEN MESON_TAC[]);; + +let card_int_ball_le=prove( `!(x:real^3)(k1:real)(k2:real)(r:real).(&0 &(CARD (int_ball x (r + k1))) <= + &4 / &3 * pi * ((r + k1) + sqrt (&3)) pow 3`,REPEAT STRIP_TAC THEN MP_TAC(SPECL [`x:real^3`;`r+ k1:real`] WQZISRI) THEN MP_TAC(REAL_ARITH `&0 sqrt(&3)< r+k1`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(MESON[SPEC `&3:real` SQRT_POS_LE;REAL_ARITH `&0 <= &3`] `&0<= sqrt(&3)`) THEN DISCH_TAC THEN MP_TAC(REAL_ARITH `&0 <= sqrt (&3) /\ (sqrt (&3) < r + k1) ==> &0<= r+ k1`) THEN ASM_REWRITE_TAC[] THEN SIMP_TAC[]);; + +let card_int_ball_le2=prove( `!(x:real^3)(k1:real)(r:real).(&0<=k1 /\ &0<= r) ==> &(CARD (int_ball x (r + k1))) <= + &4 / &3 * pi * ((r + k1) + sqrt (&3)) pow 3`,REPEAT STRIP_TAC THEN MP_TAC(SPECL [`x:real^3`;`r+ k1:real`] WQZISRI) THEN MP_TAC(REAL_ARITH `&0<=k1 /\ &0<= r ==> &0<= r+k1`) THEN ASM_REWRITE_TAC[] THEN MESON_TAC[]);; + + +let card_int_ball_pos=prove(`!(x:real^3)(k1:real)(k2:real)(r:real).(&0 &4 / &3 * pi * ((r - k2) - sqrt (&3)) pow 3 <= &(CARD (int_ball x (r - k2)))`,REPEAT STRIP_TAC THEN MP_TAC(SPECL [`x:real^3`;`r- k2:real`] PWVIIOL) THEN MP_TAC(REAL_ARITH `k2 + sqrt (&3) <= r ==> sqrt(&3)<= r- k2`) THEN ASM_REWRITE_TAC[] THEN SIMP_TAC[]);; + +let bdt1_finiteness=prove(`!(r:real)(k:real). &0 &4*pi*r*k <= &4*pi*r* abs k`,REPEAT STRIP_TAC + THEN ASSUME_TAC PI_POS THEN MP_TAC(MESON[REAL_LT_LMUL;REAL_ARITH `&0* r= &0`;REAL_ARITH `pi* r= r* pi`;REAL_ARITH `&0< e ==> &0< &4* e`] `&0< r /\ &0< pi ==> &0< &4*pi*r`) THEN ASM_REWRITE_TAC[] + THEN REWRITE_TAC[REAL_ARITH `(a:real) *b*C*d= (a*b*C)*d`] + THEN MP_TAC(SPEC `k:real` REAL_ABS_LE) THEN MESON_TAC[REAL_ARITH `&0 < &4 * pi * r ==> &0<= &4 * pi * r`;REAL_LE_LMUL]);; + + +let bdt2_finiteness=prove( `!(r:real)(k:real)(i:num).(&0< k /\ k<= r ==> &1 <= r pow i / k pow i)`,REPEAT STRIP_TAC + THEN MP_TAC(SPECL [`k:real`;`i:num`] REAL_POW_LT) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_SIMP_TAC[GSYM (ISPECL [`&1:real`;`(r pow i/ k pow i):real`;`(k pow i):real`] REAL_LE_RMUL_EQ)] THEN MP_TAC(REAL_ARITH ` &0 < k pow i ==> ~ (&0= k pow i)`) THEN ASM_REWRITE_TAC[] + THEN SIMP_TAC[REAL_DIV_RMUL] THEN ASM_SIMP_TAC[REAL_ARITH ` &1 * a= a`;REAL_ARITH `a< b ==> a<= b`] THEN ASM_MESON_TAC[REAL_POW_LE2;REAL_ARITH `&0< k ==> &0 <= k`]);; + + +let bdt3_finiteness=prove( `!(r:real)(k1:real)(k2:real) (k:real). ( &0 < r/\ &0 < k1 /\ &0< k2) ==>( &0<= &4 * pi *r* (abs k) /\ &0 <= &4/ &3 *pi*( (k1 + sqrt (&3)) pow 3 + (k2 + sqrt (&3)) pow 3))`, + REPEAT STRIP_TAC THENL [ASM_MESON_TAC[REAL_ARITH `&0< A==> &0<= A`;PI_POS_LE;REAL_ABS_POS;REAL_LE_MUL;REAL_ARITH `&0<= &4`];MP_TAC(MESON[REAL_ARITH `&0< k1 ==> sqrt(&3)<= k1 + sqrt(&3)`;SQRT_POS_LE;REAL_ARITH `&0<= &3`;REAL_ARITH `a<= b /\ b<=c ==> a<= c`] `&0< k1 ==> &0<= k1 + sqrt (&3)`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(MESON[REAL_ARITH `&0< k2 ==> sqrt(&3)<= k2 + sqrt(&3)`;SQRT_POS_LE;REAL_ARITH `&0<= &3`;REAL_ARITH `a<= b /\ b<=c ==> a<= c`] `&0< k2 ==> &0<= k2 + sqrt (&3)`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC THEN MP_TAC(SPECL [`k1 + sqrt (&3):real`;` 3:num`] REAL_POW_LE) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(SPECL [`k2 + sqrt (&3):real`;` 3:num`] REAL_POW_LE) THEN ASM_REWRITE_TAC[] + THEN REPEAT DISCH_TAC THEN MP_TAC(REAL_ARITH `&0 <= (k2 + sqrt (&3)) pow 3 /\ &0 <= (k1 + sqrt (&3)) pow 3 ==> &0<= (k1 + sqrt (&3)) pow 3+ (k2 + sqrt (&3)) pow 3`) THEN ASM_REWRITE_TAC[] THEN MESON_TAC[REAL_LE_MUL;REAL_ARITH `&0<= &4/ &3`;PI_POS_LE]]);; + + +let bdt4_finiteness = prove(`!(k1:real)(k2:real) (r:real). (&0< k1 /\ &0< k2 /\ k2 + sqrt (&3) <= r) ==> (&4 / &3 * pi * ((r + k1) + sqrt (&3)) pow 3)- (&4 / &3 * pi * (r - k2 - sqrt (&3)) pow 3)<= (&4/ &3* pi*( &3*(k1+ k2+ &2*sqrt(&3)) +((k1 + sqrt (&3)) pow 3 + (k2 + sqrt (&3)) pow 3) /((k2 + sqrt (&3)) pow 2) + &3 * abs(((k1 + sqrt (&3)) pow 2 - (k2 + sqrt (&3)) pow 2)) / (k2 + sqrt (&3)))) *r pow 2`, REPEAT STRIP_TAC THEN REWRITE_TAC[REAL_FIELD `&4 / &3 * pi * ((r + k1) + sqrt (&3)) pow 3 - + &4 / &3 * pi * (r - k2 - sqrt (&3)) pow 3= ( &4*pi*r pow 2 * (k1+k2+ &2*sqrt(&3)) + &4*pi*r* ((k1+ sqrt(&3))pow 2 - (k2+ sqrt(&3)) pow 2)+ &4/ &3*pi*((k1+ sqrt(&3))pow 3 + (k2+ sqrt(&3)) pow 3))`] + THEN REWRITE_TAC[REAL_FIELD ` (&4/ &3 * pi*( &3* (k1+k2+ &2*sqrt(&3)) + + ((k1 + sqrt (&3)) pow 3 + (k2 + sqrt (&3)) pow 3) / ((k2 + sqrt (&3)) pow 2) + + &3 * + abs (((k1 + sqrt (&3)) pow 2 - (k2 + sqrt (&3)) pow 2)) / (k2 + sqrt (&3)))) * + r pow 2= (&4 * pi * r pow 2 * (k1 + k2 + &2 * sqrt (&3))+ &4*pi*r pow 2* abs (((k1 + sqrt (&3)) pow 2 - (k2 + sqrt (&3)) pow 2)) / (k2 + sqrt (&3))+ &4/ &3*pi* r pow 2* ((k1 + sqrt (&3)) pow 3 + (k2 + sqrt (&3)) pow 3) / ((k2 + sqrt (&3)) pow 2))`] + THEN REWRITE_TAC[REAL_ARITH `(a:real) + b+ c <= a + d + e <=> b+c <= d+ e`] + THEN MATCH_MP_TAC(REAL_ARITH `&4 * pi * r * ((k1 + sqrt (&3)) pow 2 - (k2 + sqrt (&3)) pow 2)<= &4 * + pi * + r pow 2 * + abs ((k1 + sqrt (&3)) pow 2 - (k2 + sqrt (&3)) pow 2) / (k2 + sqrt (&3)) /\ &4 / &3 * pi * ((k1 + sqrt (&3)) pow 3 + (k2 + sqrt (&3)) pow 3)<= &4 / &3 * + pi * + r pow 2 * + ((k1 + sqrt (&3)) pow 3 + (k2 + sqrt (&3)) pow 3) / ((k2 + sqrt (&3)) pow 2) ==> &4 * pi * r * ((k1 + sqrt (&3)) pow 2 - (k2 + sqrt (&3)) pow 2) + + &4 / &3 * pi * ((k1 + sqrt (&3)) pow 3 + (k2 + sqrt (&3)) pow 3) <= + &4 * + pi * + r pow 2 * + abs ((k1 + sqrt (&3)) pow 2 - (k2 + sqrt (&3)) pow 2) / (k2 + sqrt (&3)) + + &4 / &3 * + pi * + r pow 2 * + ((k1 + sqrt (&3)) pow 3 + (k2 + sqrt (&3)) pow 3) / ((k2 + sqrt (&3)) pow 2)`) + THEN MATCH_MP_TAC(REAL_ARITH `&4 * pi * r * ((k1 + sqrt (&3)) pow 2 - (k2 + sqrt (&3)) pow 2) <= &4*pi* r * abs ((k1 + sqrt (&3)) pow 2 - (k2 + sqrt (&3)) pow 2) /\ &4*pi* r * abs ((k1 + sqrt (&3)) pow 2 - (k2 + sqrt (&3)) pow 2)<= &4 * + pi * + r pow 2 * + abs ((k1 + sqrt (&3)) pow 2 - (k2 + sqrt (&3)) pow 2) / (k2 + sqrt (&3)) /\ &4 / &3 * pi * ((k1 + sqrt (&3)) pow 3 + (k2 + sqrt (&3)) pow 3) <= + &4 / &3 * + pi * + r pow 2 * + ((k1 + sqrt (&3)) pow 3 + (k2 + sqrt (&3)) pow 3) / ((k2 + sqrt (&3)) pow 2) ==> &4 * pi * r * ((k1 + sqrt (&3)) pow 2 - (k2 + sqrt (&3)) pow 2) <= + &4 * + pi * + r pow 2 * + abs ((k1 + sqrt (&3)) pow 2 - (k2 + sqrt (&3)) pow 2) / (k2 + sqrt (&3)) /\ + &4 / &3 * pi * ((k1 + sqrt (&3)) pow 3 + (k2 + sqrt (&3)) pow 3) <= + &4 / &3 * + pi * + r pow 2 * + ((k1 + sqrt (&3)) pow 3 + (k2 + sqrt (&3)) pow 3) / ((k2 + sqrt (&3)) pow 2) `) + THEN MP_TAC(MESON[REAL_ARITH `&0 < k2 /\ k2 + sqrt (&3) <= r ==> sqrt(&3)< r`;MESON[SQRT_POS_LT;REAL_ARITH `&0< &3`] `&0< sqrt( &3)`;REAL_ARITH `a:real a< c`] `&0 < k2 /\ k2 + sqrt (&3) <= r ==> &0< r`) + THEN ASM_SIMP_TAC[bdt1_finiteness] THEN DISCH_TAC THEN REWRITE_TAC[bdt1_finiteness] THEN MP_TAC(REAL_ARITH `&0< k2 ==> &0 <=k2`) THEN ASM_REWRITE_TAC[] THEN REWRITE_TAC[REAL_FIELD `&4 * + pi * + r pow 2 * + abs + ((k1 + sqrt (&3)) pow 2 - (k2 + sqrt (&3)) pow 2) / (k2 + sqrt (&3))= ( &4*pi* r* abs + ((k1 + sqrt (&3)) pow 2 - (k2 + sqrt (&3)) pow 2))*(r/ (k2+ sqrt(&3)))`] THEN REWRITE_TAC[REAL_FIELD `&4 / &3 * + pi * + r pow 2 * + ((k1 + sqrt (&3)) pow 3 + (k2 + sqrt (&3)) pow 3) / + ((k2 + sqrt (&3)) pow 2) = (&4 / &3 * + pi *((k1 + sqrt (&3)) pow 3 + (k2 + sqrt (&3)) pow 3))*(r pow 2/ ((k2 + sqrt (&3)) pow 2))`] + THEN DISCH_TAC THEN MP_TAC(SPECL [`r:real`;`k2+ sqrt(&3):real`;`1:num`] bdt2_finiteness) + THEN MP_TAC(MESON[MESON[SQRT_POS_LT;REAL_ARITH `&0< &3`] `&0< sqrt( &3)`;REAL_ARITH `&0 < k2 +==> sqrt(&3)< k2 + sqrt(&3)`;REAL_ARITH `a:real a< c`] `&0 < k2 +==> &0< k2 + sqrt(&3)`) THEN ASM_REWRITE_TAC[] THEN SIMP_TAC[REAL_ARITH `(x:real) pow 1= x`] + THEN DISCH_TAC THEN MP_TAC(SPECL [`r:real`;`k2+ sqrt(&3):real`;`2:num`] bdt2_finiteness) THEN ASM_REWRITE_TAC[] + THEN REPEAT DISCH_TAC THEN MP_TAC(SPECL [`r:real`;`k1:real`;`k2:real`;`((k1 + sqrt (&3)) pow 2 - (k2 + sqrt (&3)) pow 2):real`] bdt3_finiteness) THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN ASM_MESON_TAC[REAL_LE_LMUL;REAL_ARITH ` a* &1= a`]);; + + + +let card_diff_ineq=prove( `!(x:real^3)(k1:real)(k2:real) (r:real). CARD ((int_ball x (r+ k1)) DIFF (int_ball x (r- k2))) <= CARD (int_ball x (r+ k1))`,REPEAT GEN_TAC THEN ASSUME_TAC(SPECL [`x:real^3`;`r+ k1:real`] finite_int_ball) THEN ASM_MESON_TAC[CARD_SUBSET;SUBSET_DIFF]);; + +let bdt6_finiteness=prove(`!(x:real^3)(k1:real)(k2:real) (r:real). (&0< k1 /\ &0 &(CARD ((int_ball x (r+ k1)) DIFF (int_ball x (r- k2)))) <= &4/ &3*pi*(r+k1+ sqrt(&3))pow 3`,REPEAT STRIP_TAC THEN MP_TAC(GSYM (SPECL [`CARD (int_ball x (r + k1) DIFF int_ball x (r - k2)):num`;`CARD (int_ball x (r+ k1)):num`] REAL_OF_NUM_LE)) THEN SIMP_TAC[card_diff_ineq] + THEN MP_TAC(SPECL [`x:real^3`;`k1:real`;`r:real`] card_int_ball_le2) THEN ASM_SIMP_TAC[REAL_ARITH `&0< k1 /\ &0< r ==> &0<= k1 /\ &0<= r`] THEN ASM_SIMP_TAC[REAL_ARITH `&0< a ==> &0<= a`] THEN MESON_TAC[REAL_ARITH `a<= b /\ c<=a ==> c<= b`; REAL_ARITH `r + k1 + sqrt (&3)= (r + k1) + sqrt (&3)`]);; + +(* Quantifiers corrected by thales below. +let bdt5_finiteness=prove(`!(x:real^3)(k1:real)(k2:real) (r:real). (&0< k1 /\ &0< k2 /\ k2 + sqrt (&3) <= r) ==> ?(C:real). &(CARD ((int_ball x (r+ k1)) DIFF (int_ball x (r- k2))))<= C* r pow 2`,REPEAT STRIP_TAC THEN EXISTS_TAC `(&4 / &3 * + pi * + (&3 * (k1 + k2 + &2 * sqrt (&3)) + + ((k1 + sqrt (&3)) pow 3 + (k2 + sqrt (&3)) pow 3) / (k2 + sqrt (&3)) pow 2 + + &3 * + abs ((k1 + sqrt (&3)) pow 2 - (k2 + sqrt (&3)) pow 2) / (k2 + sqrt (&3)))):real` + THEN MP_TAC(ISPECL [`int_ball x (r + k1):real^3 -> bool`;`int_ball x (r - k2):real^3 -> bool`] CARD_DIFF) + THEN REWRITE_TAC[finite_int_ball] THEN MP_TAC(REAL_ARITH `&0 r:real -k2 < r + k1`) + THEN ASM_REWRITE_TAC[] THEN SIMP_TAC[int_ball_subset] + THEN DISCH_TAC THEN MP_TAC(SPECL [`x:real^3`;`r-k2:real`;`r+k1:real`] card_int_ball_ineq) + THEN ASM_SIMP_TAC[GSYM REAL_OF_NUM_SUB] THEN REPEAT DISCH_TAC + THEN MP_TAC(SPECL [`x:real^3`;`k1:real`;`k2:real`;`r:real`] card_int_ball_le) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(SPECL [`x:real^3`;`k1:real`;`k2:real`;`r:real`] card_int_ball_pos) THEN ASM_REWRITE_TAC[] + THEN MP_TAC(SPECL [`k1:real`;`k2:real`;`r:real`] bdt4_finiteness) THEN ASM_REWRITE_TAC[] THEN REAL_ARITH_TAC);; +*) + +let bdt5_finiteness=prove(`!(x:real^3)(k1:real)(k2:real) . + (&0< k1 /\ &0< k2) ==> ( ?(C:real). !r. ( k2 + sqrt (&3) <= r) ==> (&(CARD ((int_ball x (r+ k1)) DIFF (int_ball x (r- k2))))<= C* r pow 2))`, + REPEAT STRIP_TAC THEN + EXISTS_TAC `(&4 / &3 * pi * (&3 * (k1 + k2 + &2 * sqrt (&3)) + ((k1 + sqrt (&3)) pow 3 + (k2 + sqrt (&3)) pow 3) / (k2 + sqrt (&3)) pow 2 + &3 * abs ((k1 + sqrt (&3)) pow 2 - (k2 + sqrt (&3)) pow 2) / (k2 + sqrt (&3)))):real` THEN + STRIP_TAC THEN + MP_TAC(ISPECL [`int_ball x (r + k1):real^3 -> bool`;`int_ball x (r - k2):real^3 -> bool`] CARD_DIFF) THEN + REWRITE_TAC[finite_int_ball] THEN MP_TAC(REAL_ARITH `&0 r:real -k2 < r + k1`) THEN + ASM_REWRITE_TAC[] THEN SIMP_TAC[int_ball_subset] THEN + DISCH_TAC THEN MP_TAC(SPECL [`x:real^3`;`r-k2:real`;`r+k1:real`] card_int_ball_ineq) THEN + ASM_SIMP_TAC[GSYM REAL_OF_NUM_SUB] THEN REPEAT DISCH_TAC THEN + MP_TAC(SPECL [`x:real^3`;`k1:real`;`k2:real`;`r:real`] card_int_ball_le) THEN +ASM_REWRITE_TAC[] THEN + MP_TAC(SPECL [`x:real^3`;`k1:real`;`k2:real`;`r:real`] card_int_ball_pos) THEN +ASM_REWRITE_TAC[] THEN + MP_TAC(SPECL [`k1:real`;`k2:real`;`r:real`] bdt4_finiteness) THEN +ASM_REWRITE_TAC[] THEN + REAL_ARITH_TAC);; + +(* fixed quantifier order -thales +let bdt7_finiteness=prove(`!(x:real^3)(k1:real)(k2:real) (r:real). (&0< k1 /\ &0< k2 /\ r< k2 + sqrt (&3) /\ k2 <= r) ==> ?(C:real). &(CARD ((int_ball x (r+ k1)) DIFF (int_ball x (r- k2))))<= C* r pow 2`, + REPEAT STRIP_TAC THEN EXISTS_TAC `(&4/ &3*pi*(k2+k1+ &2*sqrt(&3)) pow 3/ (k2 pow 2)):real` + THEN MATCH_MP_TAC(REAL_ARITH `&(CARD (int_ball x (r + k1) DIFF int_ball x (r - k2))) +<= &4/ &3*pi*(r+k1+ sqrt(&3))pow 3 /\ &4/ &3*pi*(r+k1+ sqrt(&3))pow 3 <= (&4 / &3 * pi * (k2 + k1 + &2 * sqrt (&3)) pow 3 / k2 pow 2) * r pow 2 ==> &(CARD (int_ball x (r + k1) DIFF int_ball x (r - k2))) <= ( &4 / &3 * pi * (k2 + k1 + &2 * sqrt (&3)) pow 3 / k2 pow 2) * r pow 2`) THEN MP_TAC(REAL_ARITH `&0< k2 /\ k2<= r ==> &0< r`) THEN ASM_REWRITE_TAC[] THEN DISCH_TAC + THEN ASM_SIMP_TAC[SPECL [`x:real^3`;`k1:real`;`k2:real`; `r:real`] bdt6_finiteness] + THEN MATCH_MP_TAC(REAL_ARITH `&4 / &3 * pi * (r + k1 + sqrt (&3)) pow 3 +<= &4 / &3 * pi * (k2 + k1 + &2*sqrt (&3)) pow 3 /\ &4 / &3 * pi * (k2 + k1 + &2*sqrt (&3)) pow 3 +<= (&4 / &3 * pi * (k2 + k1 + &2 * sqrt (&3)) pow 3 / k2 pow 2) * r pow 2 ==> &4 / &3 * pi * (r + k1 + sqrt (&3)) pow 3 <= + (&4 / &3 * pi * (k2 + k1 + &2 * sqrt (&3)) pow 3 / k2 pow 2) * r pow 2`) + THEN MP_TAC(MESON[REAL_ARITH `&0 sqrt(&3)<= r+k1+ sqrt(&3)`;SPEC `&3:real` SQRT_POS_LE; +REAL_ARITH `&0<= &3`;REAL_ARITH `a<=b /\ b<= c ==> a<= c`] `&0 &0<= r+k1+ sqrt(&3)`) + THEN ASM_REWRITE_TAC[] THEN MP_TAC(REAL_ARITH `r < k2 + sqrt (&3) ==> r+ k1+ sqrt(&3) <= k2+ k1+ &2* sqrt(&3)`) THEN ASM_REWRITE_TAC[] THEN MP_TAC(MESON[PI_POS_LE;REAL_ARITH `&0<= &4/ &3`;REAL_LE_MUL] `&0<= &4/ &3*pi`) + THEN REPEAT DISCH_TAC THEN MP_TAC(ISPECL [`3:num`;`r + k1 + sqrt (&3):real`;`k2 + k1 + &2 * sqrt (&3):real`] REAL_POW_LE2) THEN ASM_REWRITE_TAC[] THEN ASM_SIMP_TAC[REAL_ARITH `(a:real)*b*c = (a*b)*c`;REAL_LE_LMUL] + THEN DISCH_TAC THEN REWRITE_TAC[REAL_FIELD `((&4 / &3 * pi) * (k2 + k1 + &2 * sqrt (&3)) pow 3 / k2 pow 2) * r pow 2= ((&4 / &3 * pi)*((k2 + k1 + &2 * sqrt (&3)) pow 3))*(r pow 2/ k2 pow 2)`] + THEN MP_TAC(MESON[MESON[REAL_POW_LE] `&0 <= r + k1 + sqrt (&3) ==> &0 <= (r + k1 + sqrt (&3)) pow 3`;REAL_ARITH `a<= b /\ b<= c ==> a<= c`] `&0 <= r + k1 + sqrt (&3) /\ (r + k1 + sqrt (&3)) pow 3 <= (k2 + k1 + &2 * sqrt (&3)) pow 3 ==> &0<= (k2 + k1 + &2 * sqrt (&3)) pow 3`) THEN ASM_REWRITE_TAC[] THEN MP_TAC(SPECL [`r:real`;`k2:real`;`2:num`] bdt2_finiteness) THEN ASM_REWRITE_TAC[] + THEN REPEAT DISCH_TAC THEN MP_TAC(MESON[REAL_LE_MUL] `&0 <= &4 / &3 * pi /\ &0 <= (k2 + k1 + &2 * sqrt (&3)) pow 3 ==> &0<= (&4 / &3 * pi) * (k2 + k1 + &2 * sqrt (&3)) pow 3`) THEN ASM_REWRITE_TAC[] +THEN ASM_MESON_TAC[REAL_LE_LMUL;REAL_ARITH ` a* &1= a`]);; +*) + + +let bdt7_finiteness=prove(`!(x:real^3)(k1:real)(k2:real) (r:real). + (&0< k1 /\ &0< k2) ==> + ?(C:real). !r. ( r< k2 + sqrt (&3) /\ k2 <= r) ==> &(CARD ((int_ball x (r+ k1)) DIFF (int_ball x (r- k2))))<= C* r pow 2`, + REPEAT STRIP_TAC THEN +EXISTS_TAC `(&4/ &3*pi*(k2+k1+ &2*sqrt(&3)) pow 3/ (k2 pow 2)):real` THEN +REPEAT STRIP_TAC THEN +MATCH_MP_TAC(REAL_ARITH `&(CARD (int_ball x (r + k1) DIFF int_ball x (r - k2))) <= &4/ &3*pi*(r+k1+ sqrt(&3))pow 3 /\ &4/ &3*pi*(r+k1+ sqrt(&3))pow 3 <= (&4 / &3 * pi * (k2 + k1 + &2 * sqrt (&3)) pow 3 / k2 pow 2) * r pow 2 ==> &(CARD (int_ball x (r + k1) DIFF int_ball x (r - k2))) <= ( &4 / &3 * pi * (k2 + k1 + &2 * sqrt (&3)) pow 3 / k2 pow 2) * r pow 2`) THEN +MP_TAC(REAL_ARITH `&0< k2 /\ k2<= r ==> &0< r`) THEN +ASM_REWRITE_TAC[] THEN +DISCH_TAC THEN +ASM_SIMP_TAC[SPECL [`x:real^3`;`k1:real`;`k2:real`; `r:real`] bdt6_finiteness] THEN +MATCH_MP_TAC(REAL_ARITH `&4 / &3 * pi * (r + k1 + sqrt (&3)) pow 3 <= &4 / &3 * pi * (k2 + k1 + &2*sqrt (&3)) pow 3 /\ &4 / &3 * pi * (k2 + k1 + &2*sqrt (&3)) pow 3 <= (&4 / &3 * pi * (k2 + k1 + &2 * sqrt (&3)) pow 3 / k2 pow 2) * r pow 2 ==> &4 / &3 * pi * (r + k1 + sqrt (&3)) pow 3 <= (&4 / &3 * pi * (k2 + k1 + &2 * sqrt (&3)) pow 3 / k2 pow 2) * r pow 2`) THEN +MP_TAC(MESON[REAL_ARITH `&0 sqrt(&3)<= r+k1+ sqrt(&3)`;SPEC `&3:real` SQRT_POS_LE; REAL_ARITH `&0<= &3`;REAL_ARITH `a<=b /\ b<= c ==> a<= c`] `&0 &0<= r+k1+ sqrt(&3)`) THEN +ASM_REWRITE_TAC[] THEN +MP_TAC(REAL_ARITH `r < k2 + sqrt (&3) ==> r+ k1+ sqrt(&3) <= k2+ k1+ &2* sqrt(&3)`) THEN +ASM_REWRITE_TAC[] THEN +MP_TAC(MESON[PI_POS_LE;REAL_ARITH `&0<= &4/ &3`;REAL_LE_MUL] `&0<= &4/ &3*pi`) THEN +REPEAT DISCH_TAC THEN +MP_TAC(ISPECL [`3:num`;`r + k1 + sqrt (&3):real`;`k2 + k1 + &2 * sqrt (&3):real`] REAL_POW_LE2) THEN +ASM_REWRITE_TAC[] THEN +ASM_SIMP_TAC[REAL_ARITH `(a:real)*b*c = (a*b)*c`;REAL_LE_LMUL] THEN +DISCH_TAC THEN +REWRITE_TAC[REAL_FIELD `((&4 / &3 * pi) * (k2 + k1 + &2 * sqrt (&3)) pow 3 / k2 pow 2) * r pow 2= ((&4 / &3 * pi)*((k2 + k1 + &2 * sqrt (&3)) pow 3))*(r pow 2/ k2 pow 2)`] THEN +MP_TAC(MESON[MESON[REAL_POW_LE] `&0 <= r + k1 + sqrt (&3) ==> &0 <= (r + k1 + sqrt (&3)) pow 3`;REAL_ARITH `a<= b /\ b<= c ==> a<= c`] `&0 <= r + k1 + sqrt (&3) /\ (r + k1 + sqrt (&3)) pow 3 <= (k2 + k1 + &2 * sqrt (&3)) pow 3 ==> &0<= (k2 + k1 + &2 * sqrt (&3)) pow 3`) THEN +ASM_REWRITE_TAC[] THEN +MP_TAC(SPECL [`r:real`;`k2:real`;`2:num`] bdt2_finiteness) THEN +ASM_REWRITE_TAC[] THEN +REPEAT DISCH_TAC THEN +MP_TAC(MESON[REAL_LE_MUL] `&0 <= &4 / &3 * pi /\ &0 <= (k2 + k1 + &2 * sqrt (&3)) pow 3 ==> &0<= (&4 / &3 * pi) * (k2 + k1 + &2 * sqrt (&3)) pow 3`) THEN +ASM_REWRITE_TAC[] THEN +ASM_MESON_TAC[REAL_LE_LMUL;REAL_ARITH ` a* &1= a`]);; + +let REAL_LE_SQUARE_POW = +MESON[REAL_POW_2; REAL_LE_SQUARE]`! x. &0 <= x pow 2 `;; + + +(*--------------------------------------------------------------------*) +(*Lemma 2.16 [TXIWYHI] Bound of number of int points between two balls*) +(*--------------------------------------------------------------------*) + +let TXIWYHI=prove( `!(x:real^3)(k1:real)(k2:real) (r:real). + (&0< k1 /\ &0< k2) ==> ?(C:real). !r. (k2 <= r) ==> + &(CARD (integer_point (ball(x,r+ k1) DIFF ball(x,r- k2))))<= C* r pow 2`, + REPEAT GEN_TAC THEN SIMP_TAC[eq_def_intball] THEN +REPEAT STRIP_TAC THEN +SUBGOAL_THEN `?C. !r. k2+sqrt(&3) <= r ==> &(CARD (int_ball x (r + k1) DIFF int_ball x (r - k2))) <= C * r pow 2` ASSUME_TAC THENL + [ASM_MESON_TAC[bdt5_finiteness];ALL_TAC] THEN +SUBGOAL_THEN `(?C. !r. r < k2 + sqrt (&3) /\ k2 <= r ==> &(CARD (int_ball x (r + k1) DIFF int_ball x (r - k2))) <= C * r pow 2)` ASSUME_TAC THENL + [ASM_MESON_TAC[bdt7_finiteness];ALL_TAC] THEN + FIRST_X_ASSUM CHOOSE_TAC THEN + FIRST_X_ASSUM CHOOSE_TAC THEN + EXISTS_TAC `(abs(C:real)+abs(C':real))` THEN + GEN_TAC THEN + STRIP_TAC THEN + MATCH_MP_TAC (REAL_ARITH `(?b. (a<=b /\ b<=c) ) ==> (a <= c)`) THEN +SUBGOAL_THEN `(C*r pow 2 <= (abs(C)+abs(C'))* r pow 2) /\ (C'*r pow 2 <= (abs(C)+abs(C')) * r pow 2)` MP_TAC THENL + [CONJ_TAC THEN MATCH_MP_TAC REAL_LE_RMUL THEN REWRITE_TAC[REAL_LE_SQUARE_POW] THEN REAL_ARITH_TAC;ALL_TAC] THEN + REPEAT STRIP_TAC THEN +DISJ_CASES_TAC(REAL_ARITH `(r:real)< k2+ sqrt(&3) \/ (k2+ sqrt(&3)<= r)`) THEN +ASM_MESON_TAC[] +);; + +(* old version with reversed quantifiers -thales +let TXIWYHI=prove( `!(x:real^3)(k1:real)(k2:real) (r:real). + (&0< k1 /\ &0< k2 /\ k2 <= r) ==> ?(C:real). + &(CARD (integer_point (ball(x,r+ k1) DIFF ball(x,r- k2))))<= C* r pow 2`, + REPEAT GEN_TAC THEN SIMP_TAC[eq_def_intball] + THEN STRIP_TAC THEN DISJ_CASES_TAC(REAL_ARITH `(r:real)< k2+ sqrt(&3) \/ (k2+ sqrt(&3)<= r)`) + THENL [ASM_MESON_TAC[bdt7_finiteness];ASM_MESON_TAC[bdt5_finiteness]]);; +*) + +(*--------------------------------------------------------------------*) + + +end;; -- 1.7.1